From: Nithin Dabilpuram <ndabilpuram@marvell.com>
To: <jerinj@marvell.com>, Radu Nicolau <radu.nicolau@intel.com>,
Akhil Goyal <gakhil@marvell.com>
Cc: <dev@dpdk.org>, Nithin Dabilpuram <ndabilpuram@marvell.com>,
<schalla@marvell.com>, <stable@dpdk.org>
Subject: [PATCH v2 3/4] examples/ipsec-secgw: fix buffer free logic in vector mode
Date: Mon, 7 Feb 2022 11:56:40 +0530 [thread overview]
Message-ID: <20220207062641.26574-3-ndabilpuram@marvell.com> (raw)
In-Reply-To: <20220207062641.26574-1-ndabilpuram@marvell.com>
Fix packet processing to skip after mbuf is freed instead of
touching and Tx'ing it.
Also free vector event buffer in event worker when after processing
there is no pkt to be enqueued to Tx adapter.
Fixes: 86738ebe1e3d ("examples/ipsec-secgw: support event vector")
Cc: schalla@marvell.com
Cc: stable@dpdk.org
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
---
examples/ipsec-secgw/ipsec_worker.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/examples/ipsec-secgw/ipsec_worker.c b/examples/ipsec-secgw/ipsec_worker.c
index e9493c5..8639426 100644
--- a/examples/ipsec-secgw/ipsec_worker.c
+++ b/examples/ipsec-secgw/ipsec_worker.c
@@ -205,12 +205,16 @@ check_sp_sa_bulk(struct sp_ctx *sp, struct sa_ctx *sa_ctx,
ip->pkts[j++] = m;
else {
sa = *(struct ipsec_sa **)rte_security_dynfield(m);
- if (sa == NULL)
+ if (sa == NULL) {
free_pkts(&m, 1);
+ continue;
+ }
/* SPI on the packet should match with the one in SA */
- if (unlikely(sa->spi != sa_ctx->sa[res - 1].spi))
+ if (unlikely(sa->spi != sa_ctx->sa[res - 1].spi)) {
free_pkts(&m, 1);
+ continue;
+ }
ip->pkts[j++] = m;
}
@@ -536,6 +540,7 @@ ipsec_ev_route_pkts(struct rte_event_vector *vec, struct route_table *rt,
RTE_SECURITY_ACTION_TYPE_INLINE_PROTOCOL)) {
RTE_LOG(ERR, IPSEC, "SA type not supported\n");
free_pkts(&pkt, 1);
+ continue;
}
rte_security_set_pkt_metadata(sess->security.ctx,
sess->security.ses, pkt, NULL);
@@ -695,11 +700,13 @@ ipsec_ev_vector_process(struct lcore_conf_ev_tx_int_port_wrkr *lconf,
ret = process_ipsec_ev_outbound_vector(&lconf->outbound,
&lconf->rt, vec);
- if (ret > 0) {
+ if (likely(ret > 0)) {
vec->nb_elem = ret;
rte_event_eth_tx_adapter_enqueue(links[0].eventdev_id,
links[0].event_port_id,
ev, 1, 0);
+ } else {
+ rte_mempool_put(rte_mempool_from_obj(vec), vec);
}
}
@@ -720,6 +727,8 @@ ipsec_ev_vector_drv_mode_process(struct eh_event_link_info *links,
rte_event_eth_tx_adapter_enqueue(links[0].eventdev_id,
links[0].event_port_id,
ev, 1, 0);
+ else
+ rte_mempool_put(rte_mempool_from_obj(vec), vec);
}
/*
--
2.8.4
next prev parent reply other threads:[~2022-02-07 6:27 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-06 14:30 [PATCH 1/4] examples/ipsec-secgw: update error prints to data path log Nithin Dabilpuram
2022-02-06 14:30 ` [PATCH 2/4] examples/ipsec-secgw: disable Tx chksum offload for inline Nithin Dabilpuram
2022-02-07 9:52 ` Ananyev, Konstantin
2022-02-07 14:15 ` Nithin Kumar Dabilpuram
2022-02-17 19:17 ` Ananyev, Konstantin
2022-02-18 13:58 ` Nithin Kumar Dabilpuram
2022-02-23 9:58 ` Nithin Kumar Dabilpuram
2022-02-06 14:30 ` [PATCH 3/4] examples/ipsec-secgw: fix buffer free logic in vector mode Nithin Dabilpuram
2022-02-06 14:30 ` [PATCH 4/4] examples/ipsec-secgw: add per port pool and vector pool size Nithin Dabilpuram
2022-02-07 6:26 ` [PATCH v2 1/4] examples/ipsec-secgw: update error prints to data path log Nithin Dabilpuram
2022-02-07 6:26 ` [PATCH v2 2/4] examples/ipsec-secgw: disable Tx chksum offload for inline Nithin Dabilpuram
2022-02-17 18:12 ` Akhil Goyal
2022-02-17 19:22 ` Ananyev, Konstantin
2022-02-07 6:26 ` Nithin Dabilpuram [this message]
2022-02-17 18:12 ` [PATCH v2 3/4] examples/ipsec-secgw: fix buffer free logic in vector mode Akhil Goyal
2022-02-07 6:26 ` [PATCH v2 4/4] examples/ipsec-secgw: add per port pool and vector pool size Nithin Dabilpuram
2022-02-17 18:13 ` Akhil Goyal
2022-02-17 18:11 ` [PATCH v2 1/4] examples/ipsec-secgw: update error prints to data path log Akhil Goyal
2022-02-23 9:53 ` [PATCH v3 1/3] " Nithin Dabilpuram
2022-02-23 9:53 ` [PATCH v3 2/3] examples/ipsec-secgw: fix buffer free logic in vector mode Nithin Dabilpuram
2022-02-23 9:53 ` [PATCH v3 3/3] examples/ipsec-secgw: add per port pool and vector pool size Nithin Dabilpuram
2022-02-23 10:48 ` [PATCH v3 1/3] examples/ipsec-secgw: update error prints to data path log Akhil Goyal
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=20220207062641.26574-3-ndabilpuram@marvell.com \
--to=ndabilpuram@marvell.com \
--cc=dev@dpdk.org \
--cc=gakhil@marvell.com \
--cc=jerinj@marvell.com \
--cc=radu.nicolau@intel.com \
--cc=schalla@marvell.com \
--cc=stable@dpdk.org \
/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).