[v1] common/idpf: fix memory leak on AVX512 TX queue close

Message ID 20230531013955.1069485-1-wenjun1.wu@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Qi Zhang
Headers
Series [v1] common/idpf: fix memory leak on AVX512 TX queue close |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/iol-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS

Commit Message

Wenjun Wu May 31, 2023, 1:39 a.m. UTC
  When releasing mbufs for TX queue software ring of AVX512,
the mbuf in the range [i, tx_tail] should also be freed.
The variable i refers to the index of the last mbuf released
in the software ring.

Signed-off-by: Wenjun Wu <wenjun1.wu@intel.com>
---
 drivers/common/idpf/idpf_common_rxtx_avx512.c | 4 ++++
 1 file changed, 4 insertions(+)
  

Patch

diff --git a/drivers/common/idpf/idpf_common_rxtx_avx512.c b/drivers/common/idpf/idpf_common_rxtx_avx512.c
index dffb11fcf2..81312617cc 100644
--- a/drivers/common/idpf/idpf_common_rxtx_avx512.c
+++ b/drivers/common/idpf/idpf_common_rxtx_avx512.c
@@ -1601,6 +1601,10 @@  idpf_tx_release_mbufs_avx512(struct idpf_tx_queue *txq)
 		}
 		i = 0;
 	}
+	for (; i < txq->tx_tail; i++) {
+		rte_pktmbuf_free_seg(swr[i].mbuf);
+		swr[i].mbuf = NULL;
+	}
 }
 
 static const struct idpf_txq_ops avx512_tx_vec_ops = {