DPDK patches and discussions
 help / color / mirror / Atom feed
From: Vidya Sagar Velumuri <vvelumuri@marvell.com>
To: Radu Nicolau <radu.nicolau@intel.com>, Akhil Goyal <gakhil@marvell.com>
Cc: <jerinj@marvell.com>, <anoobj@marvell.com>,
	<vvelumuri@marvell.com>, <asasidharan@marvell.com>,
	<ktejasree@marvell.com>, <gmuthukrishn@marvell.com>,
	<dev@dpdk.org>
Subject: [PATCH v1] examples/ipsec-secgw: free the actual mbuf pointer
Date: Fri, 16 Aug 2024 00:22:36 -0700	[thread overview]
Message-ID: <20240816072236.3686666-1-vvelumuri@marvell.com> (raw)

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>

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


             reply	other threads:[~2024-08-16  7:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-16  7:22 Vidya Sagar Velumuri [this message]
2024-08-22  4:03 ` Anoob Joseph

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240816072236.3686666-1-vvelumuri@marvell.com \
    --to=vvelumuri@marvell.com \
    --cc=anoobj@marvell.com \
    --cc=asasidharan@marvell.com \
    --cc=dev@dpdk.org \
    --cc=gakhil@marvell.com \
    --cc=gmuthukrishn@marvell.com \
    --cc=jerinj@marvell.com \
    --cc=ktejasree@marvell.com \
    --cc=radu.nicolau@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).