From: Tejasree Kondoj <ktejasree@marvell.com>
To: Akhil Goyal <gakhil@marvell.com>
Cc: Vidya Sagar Velumuri <vvelumuri@marvell.com>,
Anoob Joseph <anoobj@marvell.com>, <dev@dpdk.org>
Subject: [PATCH 05/13] common/cnxk: support custom UDP port values
Date: Wed, 19 Oct 2022 19:45:05 +0530 [thread overview]
Message-ID: <20221019141513.1969052-6-ktejasree@marvell.com> (raw)
In-Reply-To: <20221019141513.1969052-1-ktejasree@marvell.com>
From: Vidya Sagar Velumuri <vvelumuri@marvell.com>
Add support for custom port values for UDP encapsulation
Signed-off-by: Vidya Sagar Velumuri <vvelumuri@marvell.com>
---
drivers/common/cnxk/cnxk_security.c | 26 ++++++++++++++++++--------
1 file changed, 18 insertions(+), 8 deletions(-)
diff --git a/drivers/common/cnxk/cnxk_security.c b/drivers/common/cnxk/cnxk_security.c
index f8bdeabeac..f220d2577f 100644
--- a/drivers/common/cnxk/cnxk_security.c
+++ b/drivers/common/cnxk/cnxk_security.c
@@ -1219,6 +1219,7 @@ cnxk_on_ipsec_outb_sa_create(struct rte_security_ipsec_xform *ipsec,
struct rte_ipv6_hdr *ip6;
struct rte_ipv4_hdr *ip4;
const uint8_t *auth_key;
+ uint16_t sport, dport;
int auth_key_len = 0;
size_t ctx_len;
int ret;
@@ -1266,10 +1267,20 @@ cnxk_on_ipsec_outb_sa_create(struct rte_security_ipsec_xform *ipsec,
}
ip4 = (struct rte_ipv4_hdr *)&template->ip4.ipv4_hdr;
+ /* If custom port values are provided, Overwrite default port values. */
if (ipsec->options.udp_encap) {
+ sport = 4500;
+ dport = 4500;
+
+ if (ipsec->udp.sport)
+ sport = ipsec->udp.sport;
+
+ if (ipsec->udp.dport)
+ dport = ipsec->udp.dport;
+
ip4->next_proto_id = IPPROTO_UDP;
- template->ip4.udp_src = rte_be_to_cpu_16(4500);
- template->ip4.udp_dst = rte_be_to_cpu_16(4500);
+ template->ip4.udp_src = rte_be_to_cpu_16(sport);
+ template->ip4.udp_dst = rte_be_to_cpu_16(dport);
} else {
if (ipsec->proto == RTE_SECURITY_IPSEC_SA_PROTO_AH)
ip4->next_proto_id = IPPROTO_AH;
@@ -1303,13 +1314,12 @@ cnxk_on_ipsec_outb_sa_create(struct rte_security_ipsec_xform *ipsec,
ip6 = (struct rte_ipv6_hdr *)&template->ip6.ipv6_hdr;
if (ipsec->options.udp_encap) {
ip6->proto = IPPROTO_UDP;
- template->ip6.udp_src = rte_be_to_cpu_16(4500);
- template->ip6.udp_dst = rte_be_to_cpu_16(4500);
+ template->ip6.udp_src = rte_be_to_cpu_16(sport);
+ template->ip6.udp_dst = rte_be_to_cpu_16(dport);
} else {
- ip6->proto = (ipsec->proto ==
- RTE_SECURITY_IPSEC_SA_PROTO_ESP) ?
- IPPROTO_ESP :
- IPPROTO_AH;
+ ip6->proto = (ipsec->proto == RTE_SECURITY_IPSEC_SA_PROTO_ESP) ?
+ IPPROTO_ESP :
+ IPPROTO_AH;
}
ip6->vtc_flow =
rte_cpu_to_be_32(0x60000000 |
--
2.25.1
next prev parent reply other threads:[~2022-10-19 14:15 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20221019141513.1969052-1-ktejasree@marvell.com>
2022-10-19 14:15 ` [PATCH 01/13] crypto/cnxk: fix length of AES-CMAC algo Tejasree Kondoj
2022-10-19 14:15 ` [PATCH 02/13] common/cnxk: set inplace bit of lookaside IPsec Tejasree Kondoj
2022-10-19 14:15 ` [PATCH 03/13] crypto/cnxk: change capabilities as per firmware Tejasree Kondoj
2022-10-19 14:15 ` [PATCH 04/13] common/cnxk: support 103XX CPT Tejasree Kondoj
2022-10-19 14:15 ` Tejasree Kondoj [this message]
2022-10-19 14:15 ` [PATCH 06/13] crypto/cnxk: update rlen calculation for lookaside mode Tejasree Kondoj
2022-10-19 14:15 ` [PATCH 07/13] crypto/cnxk: add support for DES and MD5 Tejasree Kondoj
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=20221019141513.1969052-6-ktejasree@marvell.com \
--to=ktejasree@marvell.com \
--cc=anoobj@marvell.com \
--cc=dev@dpdk.org \
--cc=gakhil@marvell.com \
--cc=vvelumuri@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).