From: Akhil Goyal Date: Mon, 2 Sep 2019 12:27:00 +0000 (+0530) Subject: drivers/crypto: enable ESN in NXP drivers X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=0f318781bda6a72a2099ca617ddd315baa442da6;p=dpdk.git drivers/crypto: enable ESN in NXP drivers 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 --- diff --git a/drivers/crypto/caam_jr/caam_jr.c b/drivers/crypto/caam_jr/caam_jr.c index e87c9895a3..57101d9a64 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 26458e5d16..420e865893 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 19132b4520..fd5b24840f 100644 --- a/drivers/crypto/dpaa_sec/dpaa_sec.c +++ b/drivers/crypto/dpaa_sec/dpaa_sec.c @@ -2261,6 +2261,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); @@ -2269,6 +2272,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;