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

Vidya Sagar Velumuri vvelumuri at marvell.com
Fri Aug 16 09:22:36 CEST 2024


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 at marvell.com>

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);
 }
 
-- 
2.25.1



More information about the dev mailing list