DPDK patches and discussions
 help / color / mirror / Atom feed
From: Nithin Dabilpuram <ndabilpuram@marvell.com>
To: <konstantin.ananyev@intel.com>, <jerinj@marvell.com>,
	<gakhil@marvell.com>, <roy.fan.zhang@intel.com>,
	<hemant.agrawal@nxp.com>, <matan@nvidia.com>
Cc: <ndabilpuram@marvell.com>, <dev@dpdk.org>,
	<ferruh.yigit@intel.com>, <radu.nicolau@intel.com>,
	<olivier.matz@6wind.com>, <g.singh@nxp.com>,
	<declan.doherty@intel.com>, <jiawenwu@trustnetic.com>
Subject: [dpdk-dev] [PATCH v6 3/3] examples/ipsec-secgw: update event mode inline path
Date: Wed, 15 Sep 2021 22:00:01 +0530	[thread overview]
Message-ID: <20210915163001.26859-4-ndabilpuram@marvell.com> (raw)
In-Reply-To: <20210915163001.26859-1-ndabilpuram@marvell.com>

Update mbuf.l2_len with L2 header size for outbound
inline processing.

This patch also fixes a bug in arg parsing.

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
---
 examples/ipsec-secgw/ipsec-secgw.c  |  2 ++
 examples/ipsec-secgw/ipsec_worker.c | 41 ++++++++++++++++++++++++-------------
 2 files changed, 29 insertions(+), 14 deletions(-)

diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c
index f252d34..7ad94cb 100644
--- a/examples/ipsec-secgw/ipsec-secgw.c
+++ b/examples/ipsec-secgw/ipsec-secgw.c
@@ -1495,6 +1495,8 @@ parse_portmask(const char *portmask)
 	char *end = NULL;
 	unsigned long pm;
 
+	errno = 0;
+
 	/* parse hexadecimal string */
 	pm = strtoul(portmask, &end, 16);
 	if ((portmask[0] == '\0') || (end == NULL) || (*end != '\0'))
diff --git a/examples/ipsec-secgw/ipsec_worker.c b/examples/ipsec-secgw/ipsec_worker.c
index 647e22d..c545497 100644
--- a/examples/ipsec-secgw/ipsec_worker.c
+++ b/examples/ipsec-secgw/ipsec_worker.c
@@ -12,6 +12,11 @@
 #include "ipsec-secgw.h"
 #include "ipsec_worker.h"
 
+struct port_drv_mode_data {
+	struct rte_security_session *sess;
+	struct rte_security_ctx *ctx;
+};
+
 static inline enum pkt_type
 process_ipsec_get_pkt_type(struct rte_mbuf *pkt, uint8_t **nlp)
 {
@@ -60,7 +65,8 @@ ipsec_event_pre_forward(struct rte_mbuf *m, unsigned int port_id)
 
 static inline void
 prepare_out_sessions_tbl(struct sa_ctx *sa_out,
-		struct rte_security_session **sess_tbl, uint16_t size)
+			 struct port_drv_mode_data *data,
+			 uint16_t size)
 {
 	struct rte_ipsec_session *pri_sess;
 	struct ipsec_sa *sa;
@@ -95,9 +101,10 @@ prepare_out_sessions_tbl(struct sa_ctx *sa_out,
 		}
 
 		/* Use only first inline session found for a given port */
-		if (sess_tbl[sa->portid])
+		if (data[sa->portid].sess)
 			continue;
-		sess_tbl[sa->portid] = pri_sess->security.ses;
+		data[sa->portid].sess = pri_sess->security.ses;
+		data[sa->portid].ctx = pri_sess->security.ctx;
 	}
 }
 
@@ -356,9 +363,8 @@ process_ipsec_ev_outbound(struct ipsec_ctx *ctx, struct route_table *rt,
 		goto drop_pkt_and_exit;
 	}
 
-	if (sess->security.ol_flags & RTE_SECURITY_TX_OLOAD_NEED_MDATA)
-		*(struct rte_security_session **)rte_security_dynfield(pkt) =
-				sess->security.ses;
+	rte_security_set_pkt_metadata(sess->security.ctx,
+				      sess->security.ses, pkt, NULL);
 
 	/* Mark the packet for Tx security offload */
 	pkt->ol_flags |= PKT_TX_SEC_OFFLOAD;
@@ -367,6 +373,9 @@ process_ipsec_ev_outbound(struct ipsec_ctx *ctx, struct route_table *rt,
 	port_id = sa->portid;
 
 send_pkt:
+	/* Provide L2 len for Outbound processing */
+	pkt->l2_len = RTE_ETHER_HDR_LEN;
+
 	/* Update mac addresses */
 	update_mac_addrs(pkt, port_id);
 
@@ -398,7 +407,7 @@ static void
 ipsec_wrkr_non_burst_int_port_drv_mode(struct eh_event_link_info *links,
 		uint8_t nb_links)
 {
-	struct rte_security_session *sess_tbl[RTE_MAX_ETHPORTS] = { NULL };
+	struct port_drv_mode_data data[RTE_MAX_ETHPORTS];
 	unsigned int nb_rx = 0;
 	struct rte_mbuf *pkt;
 	struct rte_event ev;
@@ -412,6 +421,8 @@ ipsec_wrkr_non_burst_int_port_drv_mode(struct eh_event_link_info *links,
 		return;
 	}
 
+	memset(&data, 0, sizeof(struct port_drv_mode_data));
+
 	/* Get core ID */
 	lcore_id = rte_lcore_id();
 
@@ -422,8 +433,8 @@ ipsec_wrkr_non_burst_int_port_drv_mode(struct eh_event_link_info *links,
 	 * Prepare security sessions table. In outbound driver mode
 	 * we always use first session configured for a given port
 	 */
-	prepare_out_sessions_tbl(socket_ctx[socket_id].sa_out, sess_tbl,
-			RTE_MAX_ETHPORTS);
+	prepare_out_sessions_tbl(socket_ctx[socket_id].sa_out, data,
+				 RTE_MAX_ETHPORTS);
 
 	RTE_LOG(INFO, IPSEC,
 		"Launching event mode worker (non-burst - Tx internal port - "
@@ -460,19 +471,21 @@ ipsec_wrkr_non_burst_int_port_drv_mode(struct eh_event_link_info *links,
 
 		if (!is_unprotected_port(port_id)) {
 
-			if (unlikely(!sess_tbl[port_id])) {
+			if (unlikely(!data[port_id].sess)) {
 				rte_pktmbuf_free(pkt);
 				continue;
 			}
 
 			/* Save security session */
-			if (rte_security_dynfield_is_registered())
-				*(struct rte_security_session **)
-					rte_security_dynfield(pkt) =
-						sess_tbl[port_id];
+			rte_security_set_pkt_metadata(data[port_id].ctx,
+						      data[port_id].sess, pkt,
+						      NULL);
 
 			/* Mark the packet for Tx security offload */
 			pkt->ol_flags |= PKT_TX_SEC_OFFLOAD;
+
+			/* Provide L2 len for Outbound processing */
+			pkt->l2_len = RTE_ETHER_HDR_LEN;
 		}
 
 		/*
-- 
2.8.4


      parent reply	other threads:[~2021-09-15 16:30 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-24 10:28 [dpdk-dev] [PATCH 1/2] security: enforce semantics for Tx inline processing Akhil Goyal
2021-06-24 10:28 ` [dpdk-dev] [PATCH 2/2] examples/ipsec-secgw: modify event mode inline path Akhil Goyal
2021-07-06  9:13 ` [dpdk-dev] [PATCH 1/2] security: enforce semantics for Tx inline processing Akhil Goyal
2021-07-06 10:56 ` Ananyev, Konstantin
2021-07-06 12:27   ` Nithin Dabilpuram
2021-07-06 12:42     ` Ananyev, Konstantin
2021-07-06 12:58       ` Nithin Dabilpuram
2021-07-06 14:07         ` Ananyev, Konstantin
2021-07-07  9:07           ` Nithin Dabilpuram
2021-07-07  9:59             ` Ananyev, Konstantin
2021-07-07 11:22               ` Nithin Dabilpuram
2021-07-10 12:57                 ` Ananyev, Konstantin
2021-07-12 17:01                   ` Nithin Dabilpuram
2021-07-13 12:33                     ` Ananyev, Konstantin
2021-07-13 14:08                       ` Ananyev, Konstantin
2021-07-13 15:58                         ` Nithin Dabilpuram
2021-07-14 11:09                           ` Ananyev, Konstantin
2021-07-14 13:29                             ` Nithin Dabilpuram
2021-07-14 17:28                               ` Ananyev, Konstantin
2021-07-15  6:09 ` [dpdk-dev] [PATCH v2 0/3] security: Improve inline fast path routines Nithin Dabilpuram
2021-07-15  6:09   ` [dpdk-dev] [PATCH v2 1/3] security: enforce semantics for Tx inline processing Nithin Dabilpuram
2021-07-15  6:09   ` [dpdk-dev] [PATCH v2 2/3] security: add option for faster udata or mdata access Nithin Dabilpuram
2021-07-15  6:09   ` [dpdk-dev] [PATCH v2 3/3] examples/ipsec-secgw: update L2 length for Tx Nithin Dabilpuram
2021-08-10  6:07 ` [dpdk-dev] [PATCH v3 0/3] security: Improve inline fast path routines Nithin Dabilpuram
2021-08-10  6:07   ` [dpdk-dev] [PATCH v3 1/3] security: enforce semantics for Tx inline processing Nithin Dabilpuram
2021-08-10  6:07   ` [dpdk-dev] [PATCH v3 2/3] security: add option for faster udata or mdata access Nithin Dabilpuram
2021-08-10  6:07   ` [dpdk-dev] [PATCH v3 3/3] examples/ipsec-secgw: update event mode inline path Nithin Dabilpuram
2021-08-12 12:32 ` [dpdk-dev] [PATCH v4 0/4] security: Improve inline fast path routines Nithin Dabilpuram
2021-08-12 12:32   ` [dpdk-dev] [PATCH v4 1/4] security: enforce semantics for Tx inline processing Nithin Dabilpuram
2021-09-06 18:58     ` Akhil Goyal
2021-08-12 12:32   ` [dpdk-dev] [PATCH v4 2/4] security: add option for faster udata or mdata access Nithin Dabilpuram
2021-09-06 18:58     ` Akhil Goyal
2021-09-06 18:59     ` Akhil Goyal
2021-08-12 12:32   ` [dpdk-dev] [PATCH v4 3/4] examples/ipsec-secgw: update event mode inline path Nithin Dabilpuram
2021-09-06 18:59     ` Akhil Goyal
2021-08-12 12:32   ` [dpdk-dev] [PATCH v4 4/4] doc: remove deprecation notice for security fast path change Nithin Dabilpuram
2021-09-06 18:57     ` Akhil Goyal
2021-09-14 15:14 ` [dpdk-dev] [PATCH v5 0/3] security: Improve inline fast path routines Nithin Dabilpuram
2021-09-14 15:14   ` [dpdk-dev] [PATCH v5 1/3] security: enforce semantics for Tx inline processing Nithin Dabilpuram
2021-09-15 14:25     ` Ananyev, Konstantin
2021-09-14 15:14   ` [dpdk-dev] [PATCH v5 2/3] security: add option for faster udata or mdata access Nithin Dabilpuram
2021-09-15 14:33     ` Ananyev, Konstantin
2021-09-14 15:14   ` [dpdk-dev] [PATCH v5 3/3] examples/ipsec-secgw: update event mode inline path Nithin Dabilpuram
2021-09-15 14:34     ` Ananyev, Konstantin
2021-09-15 16:29 ` [dpdk-dev] [PATCH v6 0/3] security: Improve inline fast path routines Nithin Dabilpuram
2021-09-15 16:29   ` [dpdk-dev] [PATCH v6 1/3] security: enforce semantics for Tx inline processing Nithin Dabilpuram
2021-09-21 13:50     ` Akhil Goyal
2021-09-15 16:30   ` [dpdk-dev] [PATCH v6 2/3] security: add option for faster udata or mdata access Nithin Dabilpuram
2021-09-27 17:10     ` Thomas Monjalon
2021-09-28  8:24       ` [dpdk-dev] [EXT] " Akhil Goyal
2021-09-15 16:30   ` Nithin Dabilpuram [this message]

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=20210915163001.26859-4-ndabilpuram@marvell.com \
    --to=ndabilpuram@marvell.com \
    --cc=declan.doherty@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=g.singh@nxp.com \
    --cc=gakhil@marvell.com \
    --cc=hemant.agrawal@nxp.com \
    --cc=jerinj@marvell.com \
    --cc=jiawenwu@trustnetic.com \
    --cc=konstantin.ananyev@intel.com \
    --cc=matan@nvidia.com \
    --cc=olivier.matz@6wind.com \
    --cc=radu.nicolau@intel.com \
    --cc=roy.fan.zhang@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).