drivers/crypto: enable ESN in NXP drivers
authorAkhil Goyal <akhil.goyal@nxp.com>
Mon, 2 Sep 2019 12:27:00 +0000 (17:57 +0530)
committerAkhil Goyal <akhil.goyal@nxp.com>
Wed, 9 Oct 2019 09:50:12 +0000 (11:50 +0200)
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
drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
drivers/crypto/dpaa_sec/dpaa_sec.c

index e87c989..57101d9 100644 (file)
@@ -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;
index 26458e5..420e865 100644 (file)
@@ -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,
index 19132b4..fd5b248 100644 (file)
@@ -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;