Skip to content

Commit

Permalink
drivers/crypto: fix IPsec TTL decrement option
Browse files Browse the repository at this point in the history
[ upstream commit 0aa5986 ]

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: 0a23d4b ("crypto/dpaa2_sec: support protocol offload IPsec")
Fixes: 3e33486 ("crypto/caam_jr: add security offload")
Fixes: 1f14d50 ("crypto/dpaa_sec: support IPsec protocol offload")

Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
  • Loading branch information
Gagandeep Singh authored and cpaelzer committed Nov 30, 2021
1 parent 49fdbb9 commit 71476c8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
5 changes: 3 additions & 2 deletions drivers/crypto/caam_jr/caam_jr.c
Expand Up @@ -1888,8 +1888,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;
Expand Down
3 changes: 2 additions & 1 deletion drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
Expand Up @@ -2834,8 +2834,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;
Expand Down
4 changes: 3 additions & 1 deletion drivers/crypto/dpaa_sec/dpaa_sec.c
Expand Up @@ -2781,12 +2781,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;
Expand Down

0 comments on commit 71476c8

Please sign in to comment.