DPDK patches and discussions
 help / color / mirror / Atom feed
From: Nithin Dabilpuram <ndabilpuram@marvell.com>
To: Nithin Dabilpuram <ndabilpuram@marvell.com>,
	Kiran Kumar K <kirankumark@marvell.com>,
	Sunil Kumar Kori <skori@marvell.com>,
	Satha Rao <skoteshwar@marvell.com>,
	Harman Kalra <hkalra@marvell.com>
Cc: <jerinj@marvell.com>, <dev@dpdk.org>
Subject: [PATCH 04/10] common/cnxk: override UDP encap ports with session data
Date: Fri, 17 May 2024 13:14:42 +0530	[thread overview]
Message-ID: <20240517074448.3146611-4-ndabilpuram@marvell.com> (raw)
In-Reply-To: <20240517074448.3146611-1-ndabilpuram@marvell.com>

Override UDP encap ports with session info when non-zero on cn10k.
This makes the UDP encap ports configurable by user as needed.
Default UDP source and destination ports will still be 4500.

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
---
 drivers/common/cnxk/cnxk_security.c | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/drivers/common/cnxk/cnxk_security.c b/drivers/common/cnxk/cnxk_security.c
index bab015e3b3..15b0bedf43 100644
--- a/drivers/common/cnxk/cnxk_security.c
+++ b/drivers/common/cnxk/cnxk_security.c
@@ -308,6 +308,7 @@ cnxk_ot_ipsec_inb_sa_fill(struct roc_ot_ipsec_inb_sa *sa,
 			  struct rte_crypto_sym_xform *crypto_xfrm,
 			  bool is_inline)
 {
+	uint16_t sport = 4500, dport = 4500;
 	union roc_ot_ipsec_sa_word2 w2;
 	uint32_t replay_win_sz;
 	size_t offset;
@@ -353,8 +354,14 @@ cnxk_ot_ipsec_inb_sa_fill(struct roc_ot_ipsec_inb_sa *sa,
 	/* ESN */
 	sa->w2.s.esn_en = !!ipsec_xfrm->options.esn;
 	if (ipsec_xfrm->options.udp_encap) {
-		sa->w10.s.udp_src_port = 4500;
-		sa->w10.s.udp_dst_port = 4500;
+		if (ipsec_xfrm->udp.sport)
+			sport = ipsec_xfrm->udp.sport;
+
+		if (ipsec_xfrm->udp.dport)
+			dport = ipsec_xfrm->udp.dport;
+
+		sa->w10.s.udp_src_port = sport;
+		sa->w10.s.udp_dst_port = dport;
 	}
 
 	if (ipsec_xfrm->options.udp_ports_verify)
@@ -411,6 +418,7 @@ cnxk_ot_ipsec_outb_sa_fill(struct roc_ot_ipsec_outb_sa *sa,
 			   struct rte_crypto_sym_xform *crypto_xfrm)
 {
 	struct rte_security_ipsec_tunnel_param *tunnel = &ipsec_xfrm->tunnel;
+	uint16_t sport = 4500, dport = 4500;
 	union roc_ot_ipsec_sa_word2 w2;
 	size_t offset;
 	int rc;
@@ -506,8 +514,14 @@ cnxk_ot_ipsec_outb_sa_fill(struct roc_ot_ipsec_outb_sa *sa,
 		sa->ctx.esn_val = ipsec_xfrm->esn.value - 1;
 
 	if (ipsec_xfrm->options.udp_encap) {
-		sa->w10.s.udp_src_port = 4500;
-		sa->w10.s.udp_dst_port = 4500;
+		if (ipsec_xfrm->udp.sport)
+			sport = ipsec_xfrm->udp.sport;
+
+		if (ipsec_xfrm->udp.dport)
+			dport = ipsec_xfrm->udp.dport;
+
+		sa->w10.s.udp_src_port = sport;
+		sa->w10.s.udp_dst_port = dport;
 	}
 
 	offset = offsetof(struct roc_ot_ipsec_outb_sa, ctx);
-- 
2.25.1


  parent reply	other threads:[~2024-05-17  7:45 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-17  7:44 [PATCH 01/10] common/cnxk: sync VF root weight with kernel Nithin Dabilpuram
2024-05-17  7:44 ` [PATCH 02/10] net/cnxk: set VF default root schedule weight Nithin Dabilpuram
2024-05-17  7:44 ` [PATCH 03/10] net/cnxk: fix extbuf handling for multisegment packet Nithin Dabilpuram
2024-05-17  7:44 ` Nithin Dabilpuram [this message]
2024-05-17  7:44 ` [PATCH 05/10] net/cnxk: update SA userdata and keep original cookie Nithin Dabilpuram
2024-05-17  7:44 ` [PATCH 06/10] net/cnxk: add option to disable custom meta aura Nithin Dabilpuram
2024-05-27 17:29   ` Jerin Jacob
2024-05-17  7:44 ` [PATCH 07/10] net/cnxk: fix issue with outbound security higher pkt burst Nithin Dabilpuram
2024-05-17  7:44 ` [PATCH 08/10] common/cnxk: add API to reset CGX stats Nithin Dabilpuram
2024-05-17  7:44 ` [PATCH 09/10] net/cnxk: clear CGX stats during xstats reset Nithin Dabilpuram
2024-05-27 17:28   ` Jerin Jacob
2024-05-17  7:44 ` [PATCH 10/10] net/cnxk: define CPT HW result format for PMD API Nithin Dabilpuram
2024-05-27 17:27   ` Jerin Jacob
2024-05-28  7:05 ` [PATCH v2 01/10] common/cnxk: sync VF root weight with kernel Nithin Dabilpuram
2024-05-28  7:05   ` [PATCH v2 02/10] net/cnxk: set VF default root schedule weight Nithin Dabilpuram
2024-05-28  7:05   ` [PATCH v2 03/10] net/cnxk: fix extbuf handling for multisegment packet Nithin Dabilpuram
2024-05-28  7:05   ` [PATCH v2 04/10] common/cnxk: override UDP encap ports with session data Nithin Dabilpuram
2024-05-28  7:05   ` [PATCH v2 05/10] net/cnxk: update SA userdata and keep original cookie Nithin Dabilpuram
2024-05-28  7:05   ` [PATCH v2 06/10] net/cnxk: add option to disable custom meta aura Nithin Dabilpuram
2024-05-28  7:05   ` [PATCH v2 07/10] net/cnxk: fix issue with outbound security higher pkt burst Nithin Dabilpuram
2024-05-28  7:05   ` [PATCH v2 08/10] common/cnxk: add API to reset CGX stats Nithin Dabilpuram
2024-05-28  7:05   ` [PATCH v2 09/10] net/cnxk: fix xstats reset Nithin Dabilpuram
2024-05-28  7:05   ` [PATCH v2 10/10] net/cnxk: define CPT HW result format for PMD API Nithin Dabilpuram
2024-05-28 16:03     ` Jerin Jacob

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=20240517074448.3146611-4-ndabilpuram@marvell.com \
    --to=ndabilpuram@marvell.com \
    --cc=dev@dpdk.org \
    --cc=hkalra@marvell.com \
    --cc=jerinj@marvell.com \
    --cc=kirankumark@marvell.com \
    --cc=skori@marvell.com \
    --cc=skoteshwar@marvell.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).