From: Hemant Agrawal <hemant.agrawal@nxp.com>
To: gakhil@marvell.com
Cc: dev@dpdk.org, Gagandeep Singh <g.singh@nxp.com>,
Barry Cao <barry.cao@nxp.com>
Subject: [PATCH 1/4] crypto/dpaa_sec: enhance IPsec extended sequence number
Date: Thu, 24 Oct 2024 20:31:48 +0530 [thread overview]
Message-ID: <20241024150151.2290617-1-hemant.agrawal@nxp.com> (raw)
From: Gagandeep Singh <g.singh@nxp.com>
Setting ESN seq number initialization.
Initialize the sequence number of ESP to 1.
Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
Signed-off-by: Barry Cao <barry.cao@nxp.com>
---
drivers/crypto/dpaa_sec/dpaa_sec.c | 17 ++++++++++++++---
drivers/crypto/dpaa_sec/dpaa_sec.h | 10 +++++++---
2 files changed, 21 insertions(+), 6 deletions(-)
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c
index 225bf950e9..e6ca0e6f0e 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec.c
@@ -3011,9 +3011,17 @@ dpaa_sec_set_ipsec_session(__rte_unused struct rte_cryptodev *dev,
PDBHMO_ESP_SNR;
if (ipsec_xform->options.dec_ttl)
session->encap_pdb.options |= PDBHMO_ESP_ENCAP_DTTL;
- if (ipsec_xform->options.esn)
- session->encap_pdb.options |= PDBOPTS_ESP_ESN;
session->encap_pdb.spi = ipsec_xform->spi;
+ /* Initializing the sequence number to 1, Security
+ * engine will choose this sequence number for first packet
+ * Refer: RFC4303 section: 3.3.3.Sequence Number Generation
+ */
+ session->encap_pdb.seq_num = 1;
+ if (ipsec_xform->options.esn) {
+ session->encap_pdb.options |= PDBOPTS_ESP_ESN;
+ session->encap_pdb.seq_num_ext_hi = conf->ipsec.esn.hi;
+ session->encap_pdb.seq_num = conf->ipsec.esn.low;
+ }
} else if (ipsec_xform->direction ==
RTE_SECURITY_IPSEC_SA_DIR_INGRESS) {
@@ -3022,8 +3030,11 @@ dpaa_sec_set_ipsec_session(__rte_unused struct rte_cryptodev *dev,
else
session->decap_pdb.options =
sizeof(struct rte_ipv6_hdr) << 16;
- if (ipsec_xform->options.esn)
+ if (ipsec_xform->options.esn) {
session->decap_pdb.options |= PDBOPTS_ESP_ESN;
+ session->decap_pdb.seq_num_ext_hi = conf->ipsec.esn.hi;
+ session->decap_pdb.seq_num = conf->ipsec.esn.low;
+ }
if (ipsec_xform->replay_win_sz) {
uint32_t win_sz;
win_sz = rte_align32pow2(ipsec_xform->replay_win_sz);
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.h b/drivers/crypto/dpaa_sec/dpaa_sec.h
index eff6dcf311..02e5307660 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec.h
+++ b/drivers/crypto/dpaa_sec/dpaa_sec.h
@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: BSD-3-Clause
*
- * Copyright 2016-2023 NXP
+ * Copyright 2016-2024 NXP
*
*/
@@ -989,7 +989,9 @@ static const struct rte_security_capability dpaa_sec_security_cap[] = {
.proto = RTE_SECURITY_IPSEC_SA_PROTO_ESP,
.mode = RTE_SECURITY_IPSEC_SA_MODE_TUNNEL,
.direction = RTE_SECURITY_IPSEC_SA_DIR_EGRESS,
- .options = { 0 },
+ .options = {
+ .esn = 1,
+ },
.replay_win_sz_max = 128
},
.crypto_capabilities = dpaa_sec_capabilities
@@ -1001,7 +1003,9 @@ static const struct rte_security_capability dpaa_sec_security_cap[] = {
.proto = RTE_SECURITY_IPSEC_SA_PROTO_ESP,
.mode = RTE_SECURITY_IPSEC_SA_MODE_TUNNEL,
.direction = RTE_SECURITY_IPSEC_SA_DIR_INGRESS,
- .options = { 0 },
+ .options = {
+ .esn = 1,
+ },
.replay_win_sz_max = 128
},
.crypto_capabilities = dpaa_sec_capabilities
--
2.25.1
next reply other threads:[~2024-10-24 15:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-24 15:01 Hemant Agrawal [this message]
2024-10-24 15:01 ` [PATCH 2/4] crypto/dpaa_sec: enabling diffserv and ECN support Hemant Agrawal
2024-10-24 15:01 ` [PATCH 3/4] crypto/dpaa_sec: add support for UDP-encapsulated ESP Hemant Agrawal
2024-10-24 15:01 ` [PATCH 4/4] crypto/dpaa2_sec: add support for IPv6 UDP encap Hemant Agrawal
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=20241024150151.2290617-1-hemant.agrawal@nxp.com \
--to=hemant.agrawal@nxp.com \
--cc=barry.cao@nxp.com \
--cc=dev@dpdk.org \
--cc=g.singh@nxp.com \
--cc=gakhil@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).