patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH] drivers/crypto: fix ipsec inner ip header ttl decrement option
@ 2021-11-18  7:00 Gagandeep Singh
  2021-11-18  7:09 ` [EXT] " Akhil Goyal
  0 siblings, 1 reply; 3+ messages in thread
From: Gagandeep Singh @ 2021-11-18  7:00 UTC (permalink / raw)
  To: gakhil, dev; +Cc: Gagandeep Singh, stable

dpaa, dpaa2 and caam_jr drivers decrement the inner IP header
TTL for all packets and ignoring the dec_ttl option of SA.

In this patch, using the dec_ttl to decide to decrement the
packets inner IP header TTL or not.

Fixes: 0a23d4b6f4c2 ("crypto/dpaa2_sec: support protocol offload IPsec")
Fixes: 3e33486f80a5 ("crypto/caam_jr: add security offload")
Fixes: 1f14d500bce1 ("crypto/dpaa_sec: support IPsec protocol offload")
Cc: stable@dpdk.org

Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
---
 drivers/crypto/caam_jr/caam_jr.c            | 5 +++--
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 3 ++-
 drivers/crypto/dpaa_sec/dpaa_sec.c          | 4 +++-
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/crypto/caam_jr/caam_jr.c b/drivers/crypto/caam_jr/caam_jr.c
index 8c56610ac8..5909eca6e4 100644
--- a/drivers/crypto/caam_jr/caam_jr.c
+++ b/drivers/crypto/caam_jr/caam_jr.c
@@ -1881,8 +1881,9 @@ caam_jr_set_ipsec_session(__rte_unused struct rte_cryptodev *dev,
 		session->encap_pdb.options =
 			(IPVERSION << PDBNH_ESP_ENCAP_SHIFT) |
 			PDBOPTS_ESP_OIHI_PDB_INL |
-			PDBOPTS_ESP_IVSRC |
-			PDBHMO_ESP_ENCAP_DTTL;
+			PDBOPTS_ESP_IVSRC;
+		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;
diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
index cb2ad435bf..2e8e4c6adf 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
@@ -2935,8 +2935,9 @@ dpaa2_sec_set_ipsec_session(struct rte_cryptodev *dev,
 		encap_pdb.options = (IPVERSION << PDBNH_ESP_ENCAP_SHIFT) |
 			PDBOPTS_ESP_OIHI_PDB_INL |
 			PDBOPTS_ESP_IVSRC |
-			PDBHMO_ESP_ENCAP_DTTL |
 			PDBHMO_ESP_SNR;
+		if (ipsec_xform->options.dec_ttl)
+			encap_pdb.options |= PDBHMO_ESP_ENCAP_DTTL;
 		if (ipsec_xform->options.esn)
 			encap_pdb.options |= PDBOPTS_ESP_ESN;
 		encap_pdb.spi = ipsec_xform->spi;
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c
index 454b9c4785..9a7d5eb8b7 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec.c
@@ -2898,12 +2898,14 @@ dpaa_sec_set_ipsec_session(__rte_unused struct rte_cryptodev *dev,
 			session->encap_pdb.ip_hdr_len =
 						sizeof(struct rte_ipv6_hdr);
 		}
+
 		session->encap_pdb.options =
 			(IPVERSION << PDBNH_ESP_ENCAP_SHIFT) |
 			PDBOPTS_ESP_OIHI_PDB_INL |
 			PDBOPTS_ESP_IVSRC |
-			PDBHMO_ESP_ENCAP_DTTL |
 			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;
-- 
2.25.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [EXT] [PATCH] drivers/crypto: fix ipsec inner ip header ttl decrement option
  2021-11-18  7:00 [PATCH] drivers/crypto: fix ipsec inner ip header ttl decrement option Gagandeep Singh
@ 2021-11-18  7:09 ` Akhil Goyal
  2021-11-23 18:47   ` Akhil Goyal
  0 siblings, 1 reply; 3+ messages in thread
From: Akhil Goyal @ 2021-11-18  7:09 UTC (permalink / raw)
  To: Gagandeep Singh, dev; +Cc: stable

> dpaa, dpaa2 and caam_jr drivers decrement the inner IP header
> TTL for all packets and ignoring the dec_ttl option of SA.
> 
> In this patch, using the dec_ttl to decide to decrement the
> packets inner IP header TTL or not.
> 
> Fixes: 0a23d4b6f4c2 ("crypto/dpaa2_sec: support protocol offload IPsec")
> Fixes: 3e33486f80a5 ("crypto/caam_jr: add security offload")
> Fixes: 1f14d500bce1 ("crypto/dpaa_sec: support IPsec protocol offload")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [EXT] [PATCH] drivers/crypto: fix ipsec inner ip header ttl decrement option
  2021-11-18  7:09 ` [EXT] " Akhil Goyal
@ 2021-11-23 18:47   ` Akhil Goyal
  0 siblings, 0 replies; 3+ messages in thread
From: Akhil Goyal @ 2021-11-23 18:47 UTC (permalink / raw)
  To: Akhil Goyal, Gagandeep Singh, dev; +Cc: stable

> Subject: RE: [EXT] [PATCH] drivers/crypto: fix ipsec inner ip header ttl
> decrement option
> 
Title updated
Applied to dpdk-next-crypto

> > dpaa, dpaa2 and caam_jr drivers decrement the inner IP header
> > TTL for all packets and ignoring the dec_ttl option of SA.
> >
> > In this patch, using the dec_ttl to decide to decrement the
> > packets inner IP header TTL or not.
> >
> > Fixes: 0a23d4b6f4c2 ("crypto/dpaa2_sec: support protocol offload IPsec")
> > Fixes: 3e33486f80a5 ("crypto/caam_jr: add security offload")
> > Fixes: 1f14d500bce1 ("crypto/dpaa_sec: support IPsec protocol offload")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
> Acked-by: Akhil Goyal <gakhil@marvell.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-11-23 18:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-18  7:00 [PATCH] drivers/crypto: fix ipsec inner ip header ttl decrement option Gagandeep Singh
2021-11-18  7:09 ` [EXT] " Akhil Goyal
2021-11-23 18:47   ` Akhil Goyal

patches for DPDK stable branches

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ http://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git