From: Hemant Agrawal <hemant.agrawal@nxp.com>
To: gakhil@marvell.com
Cc: dev@dpdk.org
Subject: [PATCH 2/4] crypto/dpaa_sec: enabling diffserv and ECN support
Date: Thu, 24 Oct 2024 20:31:49 +0530 [thread overview]
Message-ID: <20241024150151.2290617-2-hemant.agrawal@nxp.com> (raw)
In-Reply-To: <20241024150151.2290617-1-hemant.agrawal@nxp.com>
Enabling DIFFSERV and ECN in IPSEC proto offload descriptor.
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
drivers/crypto/dpaa_sec/dpaa_sec.c | 14 ++++++++++++--
drivers/crypto/dpaa_sec/dpaa_sec.h | 8 ++++++++
2 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c
index e6ca0e6f0e..881435fdb6 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec.c
@@ -3023,18 +3023,28 @@ dpaa_sec_set_ipsec_session(__rte_unused struct rte_cryptodev *dev,
session->encap_pdb.seq_num = conf->ipsec.esn.low;
}
+ if (ipsec_xform->options.ecn)
+ session->encap_pdb.options |= PDBOPTS_ESP_TECN;
} else if (ipsec_xform->direction ==
RTE_SECURITY_IPSEC_SA_DIR_INGRESS) {
- if (ipsec_xform->tunnel.type == RTE_SECURITY_IPSEC_TUNNEL_IPV4)
+ if (ipsec_xform->tunnel.type == RTE_SECURITY_IPSEC_TUNNEL_IPV4) {
session->decap_pdb.options = sizeof(struct ip) << 16;
- else
+ if (ipsec_xform->options.copy_df)
+ session->decap_pdb.options |= PDBHMO_ESP_DFV;
+ } else {
session->decap_pdb.options =
sizeof(struct rte_ipv6_hdr) << 16;
+ }
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->options.copy_dscp)
+ session->decap_pdb.options |= PDBHMO_ESP_DIFFSERV;
+ if (ipsec_xform->options.ecn)
+ session->decap_pdb.options |= PDBOPTS_ESP_TECN;
+
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 02e5307660..603a7d8f38 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec.h
+++ b/drivers/crypto/dpaa_sec/dpaa_sec.h
@@ -990,6 +990,10 @@ static const struct rte_security_capability dpaa_sec_security_cap[] = {
.mode = RTE_SECURITY_IPSEC_SA_MODE_TUNNEL,
.direction = RTE_SECURITY_IPSEC_SA_DIR_EGRESS,
.options = {
+ .copy_df = 1,
+ .copy_dscp = 1,
+ .dec_ttl = 1,
+ .ecn = 1,
.esn = 1,
},
.replay_win_sz_max = 128
@@ -1004,6 +1008,10 @@ static const struct rte_security_capability dpaa_sec_security_cap[] = {
.mode = RTE_SECURITY_IPSEC_SA_MODE_TUNNEL,
.direction = RTE_SECURITY_IPSEC_SA_DIR_INGRESS,
.options = {
+ .copy_df = 1,
+ .copy_dscp = 1,
+ .dec_ttl = 1,
+ .ecn = 1,
.esn = 1,
},
.replay_win_sz_max = 128
--
2.25.1
next prev parent 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 [PATCH 1/4] crypto/dpaa_sec: enhance IPsec extended sequence number Hemant Agrawal
2024-10-24 15:01 ` Hemant Agrawal [this message]
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-2-hemant.agrawal@nxp.com \
--to=hemant.agrawal@nxp.com \
--cc=dev@dpdk.org \
--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).