[v1] examples/ipsec-secgw: free the actual mbuf pointer

Message ID 20240816072236.3686666-1-vvelumuri@marvell.com (mailing list archive)
State Accepted
Delegated to: akhil goyal
Headers
Series [v1] examples/ipsec-secgw: free the actual mbuf pointer |

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/github-robot: build success github build: passed
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-marvell-Functional success Functional Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-sample-apps-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/intel-Functional success Functional PASS

Commit Message

Vidya Sagar Velumuri Aug. 16, 2024, 7:22 a.m. UTC
In case of crypto event vector, the vector points to crypto op structure
in priv area and not actual mbuf.
Extract the mbuf pointer and pass these to rte_mbuf_free to free the
mbufs.

Signed-off-by: Vidya Sagar Velumuri <vvelumuri@marvell.com>
  

Comments

Anoob Joseph Aug. 22, 2024, 4:03 a.m. UTC | #1
> Subject: [PATCH v1] examples/ipsec-secgw: free the actual mbuf pointer
> 
> In case of crypto event vector, the vector points to crypto op structure in priv area
> and not actual mbuf.
> Extract the mbuf pointer and pass these to rte_mbuf_free to free the mbufs.
> 
> Signed-off-by: Vidya Sagar Velumuri <vvelumuri@marvell.com>

Acked-by: Anoob Joseph <anoobj@marvell.com>
  
Akhil Goyal Oct. 9, 2024, 2:53 p.m. UTC | #2
> Subject: [PATCH v1] examples/ipsec-secgw: free the actual mbuf pointer
> 
> In case of crypto event vector, the vector points to crypto op structure
> in priv area and not actual mbuf.
> Extract the mbuf pointer and pass these to rte_mbuf_free to free the
> mbufs.
> 
> Signed-off-by: Vidya Sagar Velumuri <vvelumuri@marvell.com>
Applied to dpdk-next-crypto
Thanks.
  

Patch

diff --git a/examples/ipsec-secgw/ipsec_worker.c b/examples/ipsec-secgw/ipsec_worker.c
index c9c43ebd2b..dd14226e81 100644
--- a/examples/ipsec-secgw/ipsec_worker.c
+++ b/examples/ipsec-secgw/ipsec_worker.c
@@ -960,7 +960,18 @@  static void
 ipsec_event_vector_free(struct rte_event *ev)
 {
 	struct rte_event_vector *vec = ev->vec;
-	rte_pktmbuf_free_bulk(vec->mbufs + vec->elem_offset, vec->nb_elem);
+
+	if (ev->event_type == RTE_EVENT_TYPE_CRYPTODEV_VECTOR) {
+		struct rte_crypto_op *cop;
+		int i;
+
+		for (i = 0; i < vec->nb_elem; i++) {
+			cop = vec->ptrs[i];
+			rte_pktmbuf_free(cop->sym->m_src);
+		}
+	} else {
+		rte_pktmbuf_free_bulk(vec->mbufs + vec->elem_offset, vec->nb_elem);
+	}
 	rte_mempool_put(rte_mempool_from_obj(vec), vec);
 }