crypto/dpaax_sec: fix inline query for descriptors
authorAkhil Goyal <akhil.goyal@nxp.com>
Thu, 4 Jun 2020 20:04:10 +0000 (01:34 +0530)
committerThomas Monjalon <thomas@monjalon.net>
Wed, 8 Jul 2020 16:16:17 +0000 (18:16 +0200)
The maximum length of job descriptor which is formed
is 13 words and hence rta_inline_query should take
care of the max descriptor(shared + job) lengths and
thus find out of the key can be referenced or immediate.

Fixes: 05b12700cd4c ("crypto/dpaa_sec: support null algos for protocol offload")
Fixes: 13273250eec5 ("crypto/dpaa2_sec: support AES-GCM and CTR")
Cc: stable@dpdk.org
Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
drivers/common/dpaax/caamflib/desc.h
drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
drivers/crypto/dpaa_sec/dpaa_sec.c

index e4139aa..635d6ba 100644 (file)
@@ -26,7 +26,7 @@ extern enum rta_sec_era rta_sec_era;
 #define CAAM_CMD_SZ sizeof(uint32_t)
 #define CAAM_PTR_SZ sizeof(dma_addr_t)
 #define CAAM_DESC_BYTES_MAX (CAAM_CMD_SZ * MAX_CAAM_DESCSIZE)
-#define DESC_JOB_IO_LEN (CAAM_CMD_SZ * 5 + CAAM_PTR_SZ * 3)
+#define DESC_JOB_IO_LEN (CAAM_CMD_SZ * 7 + CAAM_PTR_SZ * 3)
 
 /* Block size of any entity covered/uncovered with a KEK/TKEK */
 #define KEK_BLOCKSIZE          16
index 60fdced..c56fb21 100644 (file)
@@ -2192,7 +2192,7 @@ dpaa2_sec_aead_init(struct rte_cryptodev *dev,
 
        priv->flc_desc[0].desc[0] = aeaddata.keylen;
        err = rta_inline_query(IPSEC_AUTH_VAR_AES_DEC_BASE_DESC_LEN,
-                              MIN_JOB_DESC_SIZE,
+                              DESC_JOB_IO_LEN,
                               (unsigned int *)priv->flc_desc[0].desc,
                               &priv->flc_desc[0].desc[1], 1);
 
@@ -2416,7 +2416,7 @@ dpaa2_sec_aead_chain_init(struct rte_cryptodev *dev,
        priv->flc_desc[0].desc[0] = cipherdata.keylen;
        priv->flc_desc[0].desc[1] = authdata.keylen;
        err = rta_inline_query(IPSEC_AUTH_VAR_AES_DEC_BASE_DESC_LEN,
-                              MIN_JOB_DESC_SIZE,
+                              DESC_JOB_IO_LEN,
                               (unsigned int *)priv->flc_desc[0].desc,
                               &priv->flc_desc[0].desc[2], 2);
 
index 01e79c8..5ce7e35 100644 (file)
@@ -351,7 +351,7 @@ dpaa_sec_prep_ipsec_cdb(dpaa_sec_session *ses)
        cdb->sh_desc[0] = cipherdata.keylen;
        cdb->sh_desc[1] = authdata.keylen;
        err = rta_inline_query(IPSEC_AUTH_VAR_AES_DEC_BASE_DESC_LEN,
-                              MIN_JOB_DESC_SIZE,
+                              DESC_JOB_IO_LEN,
                               (unsigned int *)cdb->sh_desc,
                               &cdb->sh_desc[2], 2);
 
@@ -537,7 +537,7 @@ dpaa_sec_prep_cdb(dpaa_sec_session *ses)
                cdb->sh_desc[0] = alginfo_c.keylen;
                cdb->sh_desc[1] = alginfo_a.keylen;
                err = rta_inline_query(IPSEC_AUTH_VAR_AES_DEC_BASE_DESC_LEN,
-                                      MIN_JOB_DESC_SIZE,
+                                      DESC_JOB_IO_LEN,
                                       (unsigned int *)cdb->sh_desc,
                                       &cdb->sh_desc[2], 2);