drivers/crypto: enable esn for dpaa/dpaa2/caam_jr

Message ID 20190902122700.1298-1-akhil.goyal@nxp.com (mailing list archive)
State Accepted, archived
Delegated to: akhil goyal
Headers
Series drivers/crypto: enable esn for dpaa/dpaa2/caam_jr |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/iol-dpdk_compile_ovs success Compile Testing PASS
ci/iol-dpdk_compile success Compile Testing PASS
ci/iol-dpdk_compile_spdk success Compile Testing PASS
ci/intel-Performance success Performance Testing PASS
ci/mellanox-Performance success Performance Testing PASS

Commit Message

Akhil Goyal Sept. 2, 2019, 12:27 p.m. UTC
  If the application enables the use of ESN in the
ipsec_xform for security session create, pdb options
are set for enabling ESN.

Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
---
 drivers/crypto/caam_jr/caam_jr.c            | 4 ++++
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 4 ++++
 drivers/crypto/dpaa_sec/dpaa_sec.c          | 5 +++++
 3 files changed, 13 insertions(+)
  

Comments

Akhil Goyal Sept. 19, 2019, 3:07 p.m. UTC | #1
> If the application enables the use of ESN in the
> ipsec_xform for security session create, pdb options
> are set for enabling ESN.
> 
> Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
> ---

Changed title to drivers/crypto: enable esn for NXP PMDs
Applied to dpdk-next-crypto
  

Patch

diff --git a/drivers/crypto/caam_jr/caam_jr.c b/drivers/crypto/caam_jr/caam_jr.c
index e87c9895a..57101d9a6 100644
--- a/drivers/crypto/caam_jr/caam_jr.c
+++ b/drivers/crypto/caam_jr/caam_jr.c
@@ -1893,6 +1893,8 @@  caam_jr_set_ipsec_session(__rte_unused struct rte_cryptodev *dev,
 			PDBOPTS_ESP_OIHI_PDB_INL |
 			PDBOPTS_ESP_IVSRC |
 			PDBHMO_ESP_ENCAP_DTTL;
+		if (ipsec_xform->options.esn)
+			session->encap_pdb.options |= PDBOPTS_ESP_ESN;
 		session->encap_pdb.spi = ipsec_xform->spi;
 		session->encap_pdb.ip_hdr_len = sizeof(struct ip);
 
@@ -1901,6 +1903,8 @@  caam_jr_set_ipsec_session(__rte_unused struct rte_cryptodev *dev,
 			RTE_SECURITY_IPSEC_SA_DIR_INGRESS) {
 		memset(&session->decap_pdb, 0, sizeof(struct ipsec_decap_pdb));
 		session->decap_pdb.options = sizeof(struct ip) << 16;
+		if (ipsec_xform->options.esn)
+			session->decap_pdb.options |= PDBOPTS_ESP_ESN;
 		session->dir = DIR_DEC;
 	} else
 		goto out;
diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
index 26458e5d1..420e86589 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
@@ -2489,6 +2489,8 @@  dpaa2_sec_set_ipsec_session(struct rte_cryptodev *dev,
 			PDBOPTS_ESP_IVSRC |
 			PDBHMO_ESP_ENCAP_DTTL |
 			PDBHMO_ESP_SNR;
+		if (ipsec_xform->options.esn)
+			encap_pdb.options |= PDBOPTS_ESP_ESN;
 		encap_pdb.spi = ipsec_xform->spi;
 		encap_pdb.ip_hdr_len = sizeof(struct ip);
 
@@ -2502,6 +2504,8 @@  dpaa2_sec_set_ipsec_session(struct rte_cryptodev *dev,
 		flc->dhr = SEC_FLC_DHR_INBOUND;
 		memset(&decap_pdb, 0, sizeof(struct ipsec_decap_pdb));
 		decap_pdb.options = sizeof(struct ip) << 16;
+		if (ipsec_xform->options.esn)
+			decap_pdb.options |= PDBOPTS_ESP_ESN;
 		session->dir = DIR_DEC;
 		bufsize = cnstr_shdsc_ipsec_new_decap(priv->flc_desc[0].desc,
 				1, 0, SHR_SERIAL,
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c
index 122c80a07..55a47640a 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec.c
@@ -2256,6 +2256,9 @@  dpaa_sec_set_ipsec_session(__rte_unused struct rte_cryptodev *dev,
 			PDBOPTS_ESP_IVSRC |
 			PDBHMO_ESP_ENCAP_DTTL |
 			PDBHMO_ESP_SNR;
+		if (ipsec_xform->options.esn)
+			session->encap_pdb.options |= PDBOPTS_ESP_ESN;
+
 		session->encap_pdb.spi = ipsec_xform->spi;
 		session->encap_pdb.ip_hdr_len = sizeof(struct ip);
 
@@ -2264,6 +2267,8 @@  dpaa_sec_set_ipsec_session(__rte_unused struct rte_cryptodev *dev,
 			RTE_SECURITY_IPSEC_SA_DIR_INGRESS) {
 		memset(&session->decap_pdb, 0, sizeof(struct ipsec_decap_pdb));
 		session->decap_pdb.options = sizeof(struct ip) << 16;
+		if (ipsec_xform->options.esn)
+			session->decap_pdb.options |= PDBOPTS_ESP_ESN;
 		session->dir = DIR_DEC;
 	} else
 		goto out;