Skip to contentSkip to conversation

crypto/dpaaX_sec: Support Wireless algos

PATCH Superseded Akhil Goyal 4 participants 75 messages Sep 2, 2019 – Sep 30, 2019 Crypto API Page 2 of 2

lore
Share & tools
lore
#67 lore raw

PATCH v3 18/24 crypto/dpaa2_sec/hw: support kasumi

In reply to Akhil Goyal

From: Vakul Garg <[email protected]>

Add Kasumi processing for non PDCP proto offload cases. Also add support for pre-computed IV in Kasumi-f9

---
 drivers/crypto/dpaa2_sec/hw/desc/algo.h | 64 +++++++++++--------------
 1 file changed, 29 insertions(+), 35 deletions(-)
drivers/crypto/dpaa2_sec/hw/desc/algo.h +29 -35
index 042cffa59..4316ca15e 100644
@@ -349,34 +349,25 @@ cnstr_shdsc_hmac(uint32_t *descbuf, bool ps, bool swap,
  */
 static inline int
 cnstr_shdsc_kasumi_f8(uint32_t *descbuf, bool ps, bool swap,
-		      struct alginfo *cipherdata, uint8_t dir,
-		      uint32_t count, uint8_t bearer, uint8_t direction)
+		      struct alginfo *cipherdata, uint8_t dir)
 {
 	struct program prg;
 	struct program *p = &prg;
-	uint64_t ct = count;
-	uint64_t br = bearer;
-	uint64_t dr = direction;
-	uint32_t context[2] = { ct, (br << 27) | (dr << 26) };
 
 	PROGRAM_CNTXT_INIT(p, descbuf, 0);
-	if (swap) {
+	if (swap)
 		PROGRAM_SET_BSWAP(p);
-
-		context[0] = swab32(context[0]);
-		context[1] = swab32(context[1]);
-	}
 	if (ps)
 		PROGRAM_SET_36BIT_ADDR(p);
 	SHR_HDR(p, SHR_ALWAYS, 1, 0);
 
 	KEY(p, KEY1, cipherdata->key_enc_flags, cipherdata->key,
 	    cipherdata->keylen, INLINE_KEY(cipherdata));
+	SEQLOAD(p, CONTEXT1, 0, 8, 0);
 	MATHB(p, SEQINSZ, SUB, MATH2, VSEQINSZ, 4, 0);
 	MATHB(p, SEQINSZ, SUB, MATH2, VSEQOUTSZ, 4, 0);
 	ALG_OPERATION(p, OP_ALG_ALGSEL_KASUMI, OP_ALG_AAI_F8,
 		      OP_ALG_AS_INITFINAL, 0, dir);
-	LOAD(p, (uintptr_t)context, CONTEXT1, 0, 8, IMMED | COPY);
 	SEQFIFOLOAD(p, MSG1, 0, VLF | LAST1);
 	SEQFIFOSTORE(p, MSG, 0, 0, VLF);
 
@@ -390,46 +381,49 @@ cnstr_shdsc_kasumi_f8(uint32_t *descbuf, bool ps, bool swap,
  * @ps: if 36/40bit addressing is desired, this parameter must be true
  * @swap: must be true when core endianness doesn't match SEC endianness
  * @authdata: pointer to authentication transform definitions
- * @dir: cipher direction (DIR_ENC/DIR_DEC)
- * @count: count value (32 bits)
- * @fresh: fresh value ID (32 bits)
- * @direction: direction (1 bit)
- * @datalen: size of data
+ * @chk_icv: check or generate ICV value
+ * @authlen: size of digest
  *
  * Return: size of descriptor written in words or negative number on error
  */
 static inline int
 cnstr_shdsc_kasumi_f9(uint32_t *descbuf, bool ps, bool swap,
-		      struct alginfo *authdata, uint8_t dir,
-		      uint32_t count, uint32_t fresh, uint8_t direction,
-		      uint32_t datalen)
+		    struct alginfo *authdata, uint8_t chk_icv,
+		    uint32_t authlen)
 {
 	struct program prg;
 	struct program *p = &prg;
-	uint16_t ctx_offset = 16;
-	uint32_t context[6] = {count, direction << 26, fresh, 0, 0, 0};
+	int dir = chk_icv ? DIR_DEC : DIR_ENC;
 
 	PROGRAM_CNTXT_INIT(p, descbuf, 0);
-	if (swap) {
+	if (swap)
 		PROGRAM_SET_BSWAP(p);
 
-		context[0] = swab32(context[0]);
-		context[1] = swab32(context[1]);
-		context[2] = swab32(context[2]);
-	}
 	if (ps)
 		PROGRAM_SET_36BIT_ADDR(p);
+
 	SHR_HDR(p, SHR_ALWAYS, 1, 0);
 
-	KEY(p, KEY1, authdata->key_enc_flags, authdata->key, authdata->keylen,
-	    INLINE_KEY(authdata));
-	MATHB(p, SEQINSZ, SUB, MATH2, VSEQINSZ, 4, 0);
+	KEY(p, KEY2, authdata->key_enc_flags, authdata->key,
+	    authdata->keylen, INLINE_KEY(authdata));
+
+	SEQLOAD(p, CONTEXT2, 0, 12, 0);
+
+	if (chk_icv == ICV_CHECK_ENABLE)
+		MATHB(p, SEQINSZ, SUB, authlen, VSEQINSZ, 4, IMMED2);
+	else
+		MATHB(p, SEQINSZ, SUB, ZERO, VSEQINSZ, 4, 0);
+
 	ALG_OPERATION(p, OP_ALG_ALGSEL_KASUMI, OP_ALG_AAI_F9,
-		      OP_ALG_AS_INITFINAL, 0, dir);
-	LOAD(p, (uintptr_t)context, CONTEXT1, 0, 24, IMMED | COPY);
-	SEQFIFOLOAD(p, BIT_DATA, datalen, CLASS1 | LAST1);
-	/* Save output MAC of DWORD 2 into a 32-bit sequence */
-	SEQSTORE(p, CONTEXT1, ctx_offset, 4, 0);
+		      OP_ALG_AS_INITFINAL, chk_icv, dir);
+
+	SEQFIFOLOAD(p, MSG2, 0, VLF | CLASS2 | LAST2);
+
+	if (chk_icv == ICV_CHECK_ENABLE)
+		SEQFIFOLOAD(p, ICV2, authlen, LAST2);
+	else
+		/* Save lower half of MAC out into a 32-bit sequence */
+		SEQSTORE(p, CONTEXT2, 0, authlen, 0);
 
 	return PROGRAM_FINALIZE(p);
 }
Signature · 1 line
2.17.1
#68 lore raw

PATCH v3 19/24 crypto/dpaa2_sec/hw: support ZUCE and ZUCA

In reply to Akhil Goyal

From: Vakul Garg <[email protected]>

This patch add support for ZUC Encryption and ZUC Authentication. Before passing to CAAM, the 16-byte ZUCA IV is converted to 8-byte format which consists of 38-bits of count||bearer|direction.

---
 drivers/crypto/dpaa2_sec/hw/desc/algo.h | 136 +++++++++++++++++++++++-
 1 file changed, 132 insertions(+), 4 deletions(-)
drivers/crypto/dpaa2_sec/hw/desc/algo.h +132 -4
index 4316ca15e..32ce787fa 100644
@@ -17,6 +17,103 @@
  * Shared descriptors for algorithms (i.e. not for protocols).
  */
 
+/**
+ * cnstr_shdsc_zuce - ZUC Enc (EEA2) as a shared descriptor
+ * @descbuf: pointer to descriptor-under-construction buffer
+ * @ps: if 36/40bit addressing is desired, this parameter must be true
+ * @swap: must be true when core endianness doesn't match SEC endianness
+ * @cipherdata: pointer to block cipher transform definitions
+ * @dir: Cipher direction (DIR_ENC/DIR_DEC)
+ *
+ * Return: size of descriptor written in words or negative number on error
+ */
+static inline int
+cnstr_shdsc_zuce(uint32_t *descbuf, bool ps, bool swap,
+		    struct alginfo *cipherdata, uint8_t dir)
+{
+	struct program prg;
+	struct program *p = &prg;
+
+	PROGRAM_CNTXT_INIT(p, descbuf, 0);
+	if (swap)
+		PROGRAM_SET_BSWAP(p);
+
+	if (ps)
+		PROGRAM_SET_36BIT_ADDR(p);
+	SHR_HDR(p, SHR_ALWAYS, 1, 0);
+
+	KEY(p, KEY1, cipherdata->key_enc_flags, cipherdata->key,
+	    cipherdata->keylen, INLINE_KEY(cipherdata));
+
+	SEQLOAD(p, CONTEXT1, 0, 16, 0);
+
+	MATHB(p, SEQINSZ, SUB, MATH2, VSEQINSZ, 4, 0);
+	MATHB(p, SEQINSZ, SUB, MATH2, VSEQOUTSZ, 4, 0);
+	ALG_OPERATION(p, OP_ALG_ALGSEL_ZUCE, OP_ALG_AAI_F8,
+		      OP_ALG_AS_INITFINAL, 0, dir);
+	SEQFIFOLOAD(p, MSG1, 0, VLF | LAST1);
+	SEQFIFOSTORE(p, MSG, 0, 0, VLF);
+
+	return PROGRAM_FINALIZE(p);
+}
+
+/**
+ * cnstr_shdsc_zuca - ZUC Auth (EIA2) as a shared descriptor
+ * @descbuf: pointer to descriptor-under-construction buffer
+ * @ps: if 36/40bit addressing is desired, this parameter must be true
+ * @swap: must be true when core endianness doesn't match SEC endianness
+ * @authdata: pointer to authentication transform definitions
+ * @chk_icv: Whether to compare and verify ICV (true/false)
+ * @authlen: size of digest
+ *
+ * The IV prepended before hmac payload must be 8 bytes consisting
+ * of COUNT||BEAERER||DIR. The COUNT is of 32-bits, bearer is of 5 bits and
+ * direction is of 1 bit - totalling to 38 bits.
+ *
+ * Return: size of descriptor written in words or negative number on error
+ */
+static inline int
+cnstr_shdsc_zuca(uint32_t *descbuf, bool ps, bool swap,
+		 struct alginfo *authdata, uint8_t chk_icv,
+		 uint32_t authlen)
+{
+	struct program prg;
+	struct program *p = &prg;
+	int dir = chk_icv ? DIR_DEC : DIR_ENC;
+
+	PROGRAM_CNTXT_INIT(p, descbuf, 0);
+	if (swap)
+		PROGRAM_SET_BSWAP(p);
+
+	if (ps)
+		PROGRAM_SET_36BIT_ADDR(p);
+	SHR_HDR(p, SHR_ALWAYS, 1, 0);
+
+	KEY(p, KEY2, authdata->key_enc_flags, authdata->key,
+	    authdata->keylen, INLINE_KEY(authdata));
+
+	SEQLOAD(p, CONTEXT2, 0, 8, 0);
+
+	if (chk_icv == ICV_CHECK_ENABLE)
+		MATHB(p, SEQINSZ, SUB, authlen, VSEQINSZ, 4, IMMED2);
+	else
+		MATHB(p, SEQINSZ, SUB, ZERO, VSEQINSZ, 4, 0);
+
+	ALG_OPERATION(p, OP_ALG_ALGSEL_ZUCA, OP_ALG_AAI_F9,
+		      OP_ALG_AS_INITFINAL, chk_icv, dir);
+
+	SEQFIFOLOAD(p, MSG2, 0, VLF | CLASS2 | LAST2);
+
+	if (chk_icv == ICV_CHECK_ENABLE)
+		SEQFIFOLOAD(p, ICV2, authlen, LAST2);
+	else
+		/* Save lower half of MAC out into a 32-bit sequence */
+		SEQSTORE(p, CONTEXT2, 0, authlen, 0);
+
+	return PROGRAM_FINALIZE(p);
+}
+
+
 /**
  * cnstr_shdsc_snow_f8 - SNOW/f8 (UEA2) as a shared descriptor
  * @descbuf: pointer to descriptor-under-construction buffer
@@ -58,11 +155,43 @@ cnstr_shdsc_snow_f8(uint32_t *descbuf, bool ps, bool swap,
 }
 
 /**
- * conv_to_snow_f9_iv - SNOW/f9 (UIA2) IV 16bit to 12 bit convert
+ * conv_to_zuc_eia_iv - ZUCA IV 16-byte to 8-byte convert
+ * function for 3G.
+ * @iv: 16 bytes of original IV data.
+ *
+ * From the original IV, we extract 32-bits of COUNT,
+ * 5-bits of bearer and 1-bit of direction.
+ * Refer to CAAM refman for ZUCA IV format. Then these values are
+ * appended as COUNT||BEARER||DIR continuously to make a 38-bit block.
+ * This 38-bit block is copied left justified into 8-byte array used as
+ * converted IV.
+ *
+ * Return: 8-bytes of IV data as understood by SEC HW
+ */
+
+static inline uint8_t *conv_to_zuc_eia_iv(uint8_t *iv)
+{
+	uint8_t dir = (iv[14] & 0x80) ? 4 : 0;
+
+	iv[12] = iv[4] | dir;
+	iv[13] = 0;
+	iv[14] = 0;
+	iv[15] = 0;
+
+	iv[8] = iv[0];
+	iv[9] = iv[1];
+	iv[10] = iv[2];
+	iv[11] = iv[3];
+
+	return (iv + 8);
+}
+
+/**
+ * conv_to_snow_f9_iv - SNOW/f9 (UIA2) IV 16 byte to 12 byte convert
  * function for 3G.
- * @iv: 16 bit original IV data
+ * @iv: 16 byte original IV data
  *
- * Return: 12 bit IV data as understood by SEC HW
+ * Return: 12 byte IV data as understood by SEC HW
  */
 
 static inline uint8_t *conv_to_snow_f9_iv(uint8_t *iv)
@@ -93,7 +222,6 @@ static inline uint8_t *conv_to_snow_f9_iv(uint8_t *iv)
  * @ps: if 36/40bit addressing is desired, this parameter must be true
  * @swap: must be true when core endianness doesn't match SEC endianness
  * @authdata: pointer to authentication transform definitions
- * @dir: cipher direction (DIR_ENC/DIR_DEC)
  * @chk_icv: check or generate ICV value
  * @authlen: size of digest
  *
Signature · 1 line
2.17.1
#69 lore raw

PATCH v3 20/24 crypto/dpaa2_sec: support zuc ciphering/integrity

In reply to Akhil Goyal

From: Hemant Agrawal <[email protected]>

---
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 25 +++++++++++-
 drivers/crypto/dpaa2_sec/dpaa2_sec_priv.h   | 45 +++++++++++++++++++++
 2 files changed, 68 insertions(+), 2 deletions(-)
drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +23 -2
index 451fa91fb..165324567 100644
@@ -1072,6 +1072,9 @@ build_auth_fd(dpaa2_sec_session *sess, struct rte_crypto_op *op,
 		if (sess->auth_alg == RTE_CRYPTO_AUTH_SNOW3G_UIA2) {
 			iv_ptr = conv_to_snow_f9_iv(iv_ptr);
 			sge->length = 12;
+		} else if (sess->auth_alg == RTE_CRYPTO_AUTH_ZUC_EIA3) {
+			iv_ptr = conv_to_zuc_eia_iv(iv_ptr);
+			sge->length = 8;
 		} else {
 			sge->length = sess->iv.length;
 		}
@@ -1897,8 +1900,14 @@ dpaa2_sec_cipher_init(struct rte_cryptodev *dev,
 					      &cipherdata,
 					      session->dir);
 		break;
-	case RTE_CRYPTO_CIPHER_KASUMI_F8:
 	case RTE_CRYPTO_CIPHER_ZUC_EEA3:
+		cipherdata.algtype = OP_ALG_ALGSEL_ZUCE;
+		session->cipher_alg = RTE_CRYPTO_CIPHER_ZUC_EEA3;
+		bufsize = cnstr_shdsc_zuce(priv->flc_desc[0].desc, 1, 0,
+					      &cipherdata,
+					      session->dir);
+		break;
+	case RTE_CRYPTO_CIPHER_KASUMI_F8:
 	case RTE_CRYPTO_CIPHER_AES_F8:
 	case RTE_CRYPTO_CIPHER_AES_ECB:
 	case RTE_CRYPTO_CIPHER_3DES_ECB:
@@ -2045,8 +2054,18 @@ dpaa2_sec_auth_init(struct rte_cryptodev *dev,
 					      !session->dir,
 					      session->digest_length);
 		break;
-	case RTE_CRYPTO_AUTH_KASUMI_F9:
 	case RTE_CRYPTO_AUTH_ZUC_EIA3:
+		authdata.algtype = OP_ALG_ALGSEL_ZUCA;
+		authdata.algmode = OP_ALG_AAI_F9;
+		session->auth_alg = RTE_CRYPTO_AUTH_ZUC_EIA3;
+		session->iv.offset = xform->auth.iv.offset;
+		session->iv.length = xform->auth.iv.length;
+		bufsize = cnstr_shdsc_zuca(priv->flc_desc[DESC_INITFINAL].desc,
+					   1, 0, &authdata,
+					   !session->dir,
+					   session->digest_length);
+		break;
+	case RTE_CRYPTO_AUTH_KASUMI_F9:
 	case RTE_CRYPTO_AUTH_NULL:
 	case RTE_CRYPTO_AUTH_SHA1:
 	case RTE_CRYPTO_AUTH_SHA256:
@@ -2357,6 +2376,7 @@ dpaa2_sec_aead_chain_init(struct rte_cryptodev *dev,
 		session->cipher_alg = RTE_CRYPTO_CIPHER_AES_CTR;
 		break;
 	case RTE_CRYPTO_CIPHER_SNOW3G_UEA2:
+	case RTE_CRYPTO_CIPHER_ZUC_EEA3:
 	case RTE_CRYPTO_CIPHER_NULL:
 	case RTE_CRYPTO_CIPHER_3DES_ECB:
 	case RTE_CRYPTO_CIPHER_AES_ECB:
@@ -2651,6 +2671,7 @@ dpaa2_sec_ipsec_proto_init(struct rte_crypto_cipher_xform *cipher_xform,
 		cipherdata->algtype = OP_PCL_IPSEC_NULL;
 		break;
 	case RTE_CRYPTO_CIPHER_SNOW3G_UEA2:
+	case RTE_CRYPTO_CIPHER_ZUC_EEA3:
 	case RTE_CRYPTO_CIPHER_3DES_ECB:
 	case RTE_CRYPTO_CIPHER_AES_ECB:
 	case RTE_CRYPTO_CIPHER_KASUMI_F8:
drivers/crypto/dpaa2_sec/dpaa2_sec_priv.h +45 -0

51 lines not on this page · raw message

Signature · 1 line
2.17.1
#70 lore raw

PATCH v3 21/24 crypto/dpaa2_sec: allocate context as per num segs

In reply to Akhil Goyal

From: Hemant Agrawal <[email protected]>

DPAA2_SEC hardware can support any number of SG entries. This patch allocate as many SG entries as are required.

---
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 28 +++++++++++++--------
 1 file changed, 17 insertions(+), 11 deletions(-)
drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +17 -11
index 165324567..b811f2f1b 100644
@@ -55,7 +55,7 @@ typedef uint64_t	dma_addr_t;
 #define FLE_POOL_NUM_BUFS	32000
 #define FLE_POOL_BUF_SIZE	256
 #define FLE_POOL_CACHE_SIZE	512
-#define FLE_SG_MEM_SIZE		2048
+#define FLE_SG_MEM_SIZE(num)	(FLE_POOL_BUF_SIZE + ((num) * 32))
 #define SEC_FLC_DHR_OUTBOUND	-114
 #define SEC_FLC_DHR_INBOUND	0
 
@@ -83,13 +83,14 @@ build_proto_compound_sg_fd(dpaa2_sec_session *sess,
 		mbuf = sym_op->m_src;
 
 	/* first FLE entry used to store mbuf and session ctxt */
-	fle = (struct qbman_fle *)rte_malloc(NULL, FLE_SG_MEM_SIZE,
+	fle = (struct qbman_fle *)rte_malloc(NULL,
+			FLE_SG_MEM_SIZE(mbuf->nb_segs + sym_op->m_src->nb_segs),
 			RTE_CACHE_LINE_SIZE);
 	if (unlikely(!fle)) {
 		DPAA2_SEC_DP_ERR("Proto:SG: Memory alloc failed for SGE");
 		return -1;
 	}
-	memset(fle, 0, FLE_SG_MEM_SIZE);
+	memset(fle, 0, FLE_SG_MEM_SIZE(mbuf->nb_segs + sym_op->m_src->nb_segs));
 	DPAA2_SET_FLE_ADDR(fle, (size_t)op);
 	DPAA2_FLE_SAVE_CTXT(fle, (ptrdiff_t)priv);
 
@@ -312,13 +313,14 @@ build_authenc_gcm_sg_fd(dpaa2_sec_session *sess,
 		mbuf = sym_op->m_src;
 
 	/* first FLE entry used to store mbuf and session ctxt */
-	fle = (struct qbman_fle *)rte_malloc(NULL, FLE_SG_MEM_SIZE,
+	fle = (struct qbman_fle *)rte_malloc(NULL,
+			FLE_SG_MEM_SIZE(mbuf->nb_segs + sym_op->m_src->nb_segs),
 			RTE_CACHE_LINE_SIZE);
 	if (unlikely(!fle)) {
 		DPAA2_SEC_ERR("GCM SG: Memory alloc failed for SGE");
 		return -1;
 	}
-	memset(fle, 0, FLE_SG_MEM_SIZE);
+	memset(fle, 0, FLE_SG_MEM_SIZE(mbuf->nb_segs + sym_op->m_src->nb_segs));
 	DPAA2_SET_FLE_ADDR(fle, (size_t)op);
 	DPAA2_FLE_SAVE_CTXT(fle, (size_t)priv);
 
@@ -608,13 +610,14 @@ build_authenc_sg_fd(dpaa2_sec_session *sess,
 		mbuf = sym_op->m_src;
 
 	/* first FLE entry used to store mbuf and session ctxt */
-	fle = (struct qbman_fle *)rte_malloc(NULL, FLE_SG_MEM_SIZE,
+	fle = (struct qbman_fle *)rte_malloc(NULL,
+			FLE_SG_MEM_SIZE(mbuf->nb_segs + sym_op->m_src->nb_segs),
 			RTE_CACHE_LINE_SIZE);
 	if (unlikely(!fle)) {
 		DPAA2_SEC_ERR("AUTHENC SG: Memory alloc failed for SGE");
 		return -1;
 	}
-	memset(fle, 0, FLE_SG_MEM_SIZE);
+	memset(fle, 0, FLE_SG_MEM_SIZE(mbuf->nb_segs + sym_op->m_src->nb_segs));
 	DPAA2_SET_FLE_ADDR(fle, (size_t)op);
 	DPAA2_FLE_SAVE_CTXT(fle, (ptrdiff_t)priv);
 
@@ -901,13 +904,14 @@ static inline int build_auth_sg_fd(
 	}
 
 	mbuf = sym_op->m_src;
-	fle = (struct qbman_fle *)rte_malloc(NULL, FLE_SG_MEM_SIZE,
+	fle = (struct qbman_fle *)rte_malloc(NULL,
+			FLE_SG_MEM_SIZE(mbuf->nb_segs),
 			RTE_CACHE_LINE_SIZE);
 	if (unlikely(!fle)) {
 		DPAA2_SEC_ERR("AUTH SG: Memory alloc failed for SGE");
 		return -1;
 	}
-	memset(fle, 0, FLE_SG_MEM_SIZE);
+	memset(fle, 0, FLE_SG_MEM_SIZE(mbuf->nb_segs));
 	/* first FLE entry used to store mbuf and session ctxt */
 	DPAA2_SET_FLE_ADDR(fle, (size_t)op);
 	DPAA2_FLE_SAVE_CTXT(fle, (ptrdiff_t)priv);
@@ -1140,13 +1144,15 @@ build_cipher_sg_fd(dpaa2_sec_session *sess, struct rte_crypto_op *op,
 	else
 		mbuf = sym_op->m_src;
 
-	fle = (struct qbman_fle *)rte_malloc(NULL, FLE_SG_MEM_SIZE,
+	/* first FLE entry used to store mbuf and session ctxt */
+	fle = (struct qbman_fle *)rte_malloc(NULL,
+			FLE_SG_MEM_SIZE(mbuf->nb_segs + sym_op->m_src->nb_segs),
 			RTE_CACHE_LINE_SIZE);
 	if (!fle) {
 		DPAA2_SEC_ERR("CIPHER SG: Memory alloc failed for SGE");
 		return -1;
 	}
-	memset(fle, 0, FLE_SG_MEM_SIZE);
+	memset(fle, 0, FLE_SG_MEM_SIZE(mbuf->nb_segs + sym_op->m_src->nb_segs));
 	/* first FLE entry used to store mbuf and session ctxt */
 	DPAA2_SET_FLE_ADDR(fle, (size_t)op);
 	DPAA2_FLE_SAVE_CTXT(fle, (ptrdiff_t)priv);
Signature · 1 line
2.17.1
#71 lore raw

PATCH v3 22/24 crypto/dpaa_sec: dynamic contxt buffer for SG cases

In reply to Akhil Goyal

From: Hemant Agrawal <[email protected]>

This patch allocate/clean the SEC context dynamically based on the number of SG entries in the buffer.

---
 drivers/crypto/dpaa_sec/dpaa_sec.c | 43 ++++++++++++++----------------
 drivers/crypto/dpaa_sec/dpaa_sec.h |  8 +++---
 2 files changed, 23 insertions(+), 28 deletions(-)
drivers/crypto/dpaa_sec/dpaa_sec.c +20 -23
index 291cba28d..fa9d03adc 100644
@@ -65,10 +65,10 @@ dpaa_sec_op_ending(struct dpaa_sec_op_ctx *ctx)
 }
 
 static inline struct dpaa_sec_op_ctx *
-dpaa_sec_alloc_ctx(dpaa_sec_session *ses)
+dpaa_sec_alloc_ctx(dpaa_sec_session *ses, int sg_count)
 {
 	struct dpaa_sec_op_ctx *ctx;
-	int retval;
+	int i, retval;
 
 	retval = rte_mempool_get(ses->ctx_pool, (void **)(&ctx));
 	if (!ctx || retval) {
@@ -81,14 +81,11 @@ dpaa_sec_alloc_ctx(dpaa_sec_session *ses)
 	 * to clear all the SG entries. dpaa_sec_alloc_ctx() is called for
 	 * each packet, memset is costlier than dcbz_64().
 	 */
-	dcbz_64(&ctx->job.sg[SG_CACHELINE_0]);
-	dcbz_64(&ctx->job.sg[SG_CACHELINE_1]);
-	dcbz_64(&ctx->job.sg[SG_CACHELINE_2]);
-	dcbz_64(&ctx->job.sg[SG_CACHELINE_3]);
+	for (i = 0; i < sg_count && i < MAX_JOB_SG_ENTRIES; i += 4)
+		dcbz_64(&ctx->job.sg[i]);
 
 	ctx->ctx_pool = ses->ctx_pool;
-	ctx->vtop_offset = (size_t) ctx
-				- rte_mempool_virt2iova(ctx);
+	ctx->vtop_offset = (size_t) ctx - rte_mempool_virt2iova(ctx);
 
 	return ctx;
 }
@@ -855,12 +852,12 @@ build_auth_only_sg(struct rte_crypto_op *op, dpaa_sec_session *ses)
 	else
 		extra_segs = 2;
 
-	if ((mbuf->nb_segs + extra_segs) > MAX_SG_ENTRIES) {
+	if (mbuf->nb_segs > MAX_SG_ENTRIES) {
 		DPAA_SEC_DP_ERR("Auth: Max sec segs supported is %d",
 				MAX_SG_ENTRIES);
 		return NULL;
 	}
-	ctx = dpaa_sec_alloc_ctx(ses);
+	ctx = dpaa_sec_alloc_ctx(ses, mbuf->nb_segs + extra_segs);
 	if (!ctx)
 		return NULL;
 
@@ -938,7 +935,7 @@ build_auth_only(struct rte_crypto_op *op, dpaa_sec_session *ses)
 	rte_iova_t start_addr;
 	uint8_t *old_digest;
 
-	ctx = dpaa_sec_alloc_ctx(ses);
+	ctx = dpaa_sec_alloc_ctx(ses, 4);
 	if (!ctx)
 		return NULL;
 
@@ -1008,13 +1005,13 @@ build_cipher_only_sg(struct rte_crypto_op *op, dpaa_sec_session *ses)
 		req_segs = mbuf->nb_segs * 2 + 3;
 	}
 
-	if (req_segs > MAX_SG_ENTRIES) {
+	if (mbuf->nb_segs > MAX_SG_ENTRIES) {
 		DPAA_SEC_DP_ERR("Cipher: Max sec segs supported is %d",
 				MAX_SG_ENTRIES);
 		return NULL;
 	}
 
-	ctx = dpaa_sec_alloc_ctx(ses);
+	ctx = dpaa_sec_alloc_ctx(ses, req_segs);
 	if (!ctx)
 		return NULL;
 
@@ -1094,7 +1091,7 @@ build_cipher_only(struct rte_crypto_op *op, dpaa_sec_session *ses)
 	uint8_t *IV_ptr = rte_crypto_op_ctod_offset(op, uint8_t *,
 			ses->iv.offset);
 
-	ctx = dpaa_sec_alloc_ctx(ses);
+	ctx = dpaa_sec_alloc_ctx(ses, 4);
 	if (!ctx)
 		return NULL;
 
@@ -1161,13 +1158,13 @@ build_cipher_auth_gcm_sg(struct rte_crypto_op *op, dpaa_sec_session *ses)
 	if (ses->auth_only_len)
 		req_segs++;
 
-	if (req_segs > MAX_SG_ENTRIES) {
+	if (mbuf->nb_segs > MAX_SG_ENTRIES) {
 		DPAA_SEC_DP_ERR("AEAD: Max sec segs supported is %d",
 				MAX_SG_ENTRIES);
 		return NULL;
 	}
 
-	ctx = dpaa_sec_alloc_ctx(ses);
+	ctx = dpaa_sec_alloc_ctx(ses, req_segs);
 	if (!ctx)
 		return NULL;
 
@@ -1296,7 +1293,7 @@ build_cipher_auth_gcm(struct rte_crypto_op *op, dpaa_sec_session *ses)
 	else
 		dst_start_addr = src_start_addr;
 
-	ctx = dpaa_sec_alloc_ctx(ses);
+	ctx = dpaa_sec_alloc_ctx(ses, 7);
 	if (!ctx)
 		return NULL;
 
@@ -1409,13 +1406,13 @@ build_cipher_auth_sg(struct rte_crypto_op *op, dpaa_sec_session *ses)
 		req_segs = mbuf->nb_segs * 2 + 4;
 	}
 
-	if (req_segs > MAX_SG_ENTRIES) {
+	if (mbuf->nb_segs > MAX_SG_ENTRIES) {
 		DPAA_SEC_DP_ERR("Cipher-Auth: Max sec segs supported is %d",
 				MAX_SG_ENTRIES);
 		return NULL;
 	}
 
-	ctx = dpaa_sec_alloc_ctx(ses);
+	ctx = dpaa_sec_alloc_ctx(ses, req_segs);
 	if (!ctx)
 		return NULL;
 
@@ -1533,7 +1530,7 @@ build_cipher_auth(struct rte_crypto_op *op, dpaa_sec_session *ses)
 	else
 		dst_start_addr = src_start_addr;
 
-	ctx = dpaa_sec_alloc_ctx(ses);
+	ctx = dpaa_sec_alloc_ctx(ses, 7);
 	if (!ctx)
 		return NULL;
 
@@ -1619,7 +1616,7 @@ build_proto(struct rte_crypto_op *op, dpaa_sec_session *ses)
 	struct qm_sg_entry *sg;
 	phys_addr_t src_start_addr, dst_start_addr;
 
-	ctx = dpaa_sec_alloc_ctx(ses);
+	ctx = dpaa_sec_alloc_ctx(ses, 2);
 	if (!ctx)
 		return NULL;
 	cf = &ctx->job;
@@ -1666,13 +1663,13 @@ build_proto_sg(struct rte_crypto_op *op, dpaa_sec_session *ses)
 		mbuf = sym->m_src;
 
 	req_segs = mbuf->nb_segs + sym->m_src->nb_segs + 2;
-	if (req_segs > MAX_SG_ENTRIES) {
+	if (mbuf->nb_segs > MAX_SG_ENTRIES) {
 		DPAA_SEC_DP_ERR("Proto: Max sec segs supported is %d",
 				MAX_SG_ENTRIES);
 		return NULL;
 	}
 
-	ctx = dpaa_sec_alloc_ctx(ses);
+	ctx = dpaa_sec_alloc_ctx(ses, req_segs);
 	if (!ctx)
 		return NULL;
 	cf = &ctx->job;
drivers/crypto/dpaa_sec/dpaa_sec.h +3 -5
index 68461cecc..2a6a3fad7 100644
@@ -183,13 +183,11 @@ struct dpaa_sec_dev_private {
 };
 
 #define MAX_SG_ENTRIES		16
-#define SG_CACHELINE_0		0
-#define SG_CACHELINE_1		4
-#define SG_CACHELINE_2		8
-#define SG_CACHELINE_3		12
+#define MAX_JOB_SG_ENTRIES	36
+
 struct dpaa_sec_job {
 	/* sg[0] output, sg[1] input, others are possible sub frames */
-	struct qm_sg_entry sg[MAX_SG_ENTRIES];
+	struct qm_sg_entry sg[MAX_JOB_SG_ENTRIES];
 };
 
 #define DPAA_MAX_NB_MAX_DIGEST	32
Signature · 1 line
2.17.1
#72 lore raw

PATCH v3 23/24 crypto/dpaa_sec: change per cryptodev pool to per qp

In reply to Akhil Goyal

In cases where single cryptodev is used by multiple cores using multiple queues, there will be contention for mempool resources and may eventually get exhuasted.
Basically, mempool should be defined per core.
Now since qp is used per core, mempools are defined in qp setup.

---
 drivers/crypto/dpaa_sec/dpaa_sec.c | 58 ++++++++++++------------------
 drivers/crypto/dpaa_sec/dpaa_sec.h |  3 +-
 2 files changed, 24 insertions(+), 37 deletions(-)
drivers/crypto/dpaa_sec/dpaa_sec.c +23 -35
index fa9d03adc..32c7392d8 100644
@@ -70,7 +70,9 @@ dpaa_sec_alloc_ctx(dpaa_sec_session *ses, int sg_count)
 	struct dpaa_sec_op_ctx *ctx;
 	int i, retval;
 
-	retval = rte_mempool_get(ses->ctx_pool, (void **)(&ctx));
+	retval = rte_mempool_get(
+			ses->qp[rte_lcore_id() % MAX_DPAA_CORES]->ctx_pool,
+			(void **)(&ctx));
 	if (!ctx || retval) {
 		DPAA_SEC_DP_WARN("Alloc sec descriptor failed!");
 		return NULL;
@@ -84,7 +86,7 @@ dpaa_sec_alloc_ctx(dpaa_sec_session *ses, int sg_count)
 	for (i = 0; i < sg_count && i < MAX_JOB_SG_ENTRIES; i += 4)
 		dcbz_64(&ctx->job.sg[i]);
 
-	ctx->ctx_pool = ses->ctx_pool;
+	ctx->ctx_pool = ses->qp[rte_lcore_id() % MAX_DPAA_CORES]->ctx_pool;
 	ctx->vtop_offset = (size_t) ctx - rte_mempool_virt2iova(ctx);
 
 	return ctx;
@@ -1939,6 +1941,7 @@ dpaa_sec_queue_pair_release(struct rte_cryptodev *dev,
 	}
 
 	qp = &internals->qps[qp_id];
+	rte_mempool_free(qp->ctx_pool);
 	qp->internals = NULL;
 	dev->data->queue_pairs[qp_id] = NULL;
 
@@ -1953,6 +1956,7 @@ dpaa_sec_queue_pair_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 {
 	struct dpaa_sec_dev_private *internals;
 	struct dpaa_sec_qp *qp = NULL;
+	char str[20];
 
 	DPAA_SEC_DEBUG("dev =%p, queue =%d, conf =%p", dev, qp_id, qp_conf);
 
@@ -1965,6 +1969,22 @@ dpaa_sec_queue_pair_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 
 	qp = &internals->qps[qp_id];
 	qp->internals = internals;
+	snprintf(str, sizeof(str), "ctx_pool_d%d_qp%d",
+			dev->data->dev_id, qp_id);
+	if (!qp->ctx_pool) {
+		qp->ctx_pool = rte_mempool_create((const char *)str,
+							CTX_POOL_NUM_BUFS,
+							CTX_POOL_BUF_SIZE,
+							CTX_POOL_CACHE_SIZE, 0,
+							NULL, NULL, NULL, NULL,
+							SOCKET_ID_ANY, 0);
+		if (!qp->ctx_pool) {
+			DPAA_SEC_ERR("%s create failed\n", str);
+			return -ENOMEM;
+		}
+	} else
+		DPAA_SEC_INFO("mempool already created for dev_id : %d, qp: %d",
+				dev->data->dev_id, qp_id);
 	dev->data->queue_pairs[qp_id] = qp;
 
 	return 0;
@@ -2181,7 +2201,6 @@ dpaa_sec_set_session_parameters(struct rte_cryptodev *dev,
 		DPAA_SEC_ERR("Invalid crypto type");
 		return -EINVAL;
 	}
-	session->ctx_pool = internals->ctx_pool;
 	rte_spinlock_lock(&internals->lock);
 	for (i = 0; i < MAX_DPAA_CORES; i++) {
 		session->inq[i] = dpaa_sec_attach_rxq(internals);
@@ -2436,7 +2455,6 @@ dpaa_sec_set_ipsec_session(__rte_unused struct rte_cryptodev *dev,
 		session->dir = DIR_DEC;
 	} else
 		goto out;
-	session->ctx_pool = internals->ctx_pool;
 	rte_spinlock_lock(&internals->lock);
 	for (i = 0; i < MAX_DPAA_CORES; i++) {
 		session->inq[i] = dpaa_sec_attach_rxq(internals);
@@ -2547,7 +2565,6 @@ dpaa_sec_set_pdcp_session(struct rte_cryptodev *dev,
 	session->pdcp.hfn_ovd = pdcp_xform->hfn_ovrd;
 	session->pdcp.hfn_ovd_offset = cipher_xform->iv.offset;
 
-	session->ctx_pool = dev_priv->ctx_pool;
 	rte_spinlock_lock(&dev_priv->lock);
 	for (i = 0; i < MAX_DPAA_CORES; i++) {
 		session->inq[i] = dpaa_sec_attach_rxq(dev_priv);
@@ -2624,32 +2641,11 @@ dpaa_sec_security_session_destroy(void *dev __rte_unused,
 }
 
 static int
-dpaa_sec_dev_configure(struct rte_cryptodev *dev,
+dpaa_sec_dev_configure(struct rte_cryptodev *dev __rte_unused,
 		       struct rte_cryptodev_config *config __rte_unused)
 {
-
-	char str[20];
-	struct dpaa_sec_dev_private *internals;
-
 	PMD_INIT_FUNC_TRACE();
 
-	internals = dev->data->dev_private;
-	snprintf(str, sizeof(str), "ctx_pool_%d", dev->data->dev_id);
-	if (!internals->ctx_pool) {
-		internals->ctx_pool = rte_mempool_create((const char *)str,
-							CTX_POOL_NUM_BUFS,
-							CTX_POOL_BUF_SIZE,
-							CTX_POOL_CACHE_SIZE, 0,
-							NULL, NULL, NULL, NULL,
-							SOCKET_ID_ANY, 0);
-		if (!internals->ctx_pool) {
-			DPAA_SEC_ERR("%s create failed\n", str);
-			return -ENOMEM;
-		}
-	} else
-		DPAA_SEC_INFO("mempool already created for dev_id : %d",
-				dev->data->dev_id);
-
 	return 0;
 }
 
@@ -2669,17 +2665,11 @@ dpaa_sec_dev_stop(struct rte_cryptodev *dev __rte_unused)
 static int
 dpaa_sec_dev_close(struct rte_cryptodev *dev)
 {
-	struct dpaa_sec_dev_private *internals;
-
 	PMD_INIT_FUNC_TRACE();
 
 	if (dev == NULL)
 		return -ENOMEM;
 
-	internals = dev->data->dev_private;
-	rte_mempool_free(internals->ctx_pool);
-	internals->ctx_pool = NULL;
-
 	return 0;
 }
 
@@ -2919,8 +2909,6 @@ dpaa_sec_uninit(struct rte_cryptodev *dev)
 	internals = dev->data->dev_private;
 	rte_free(dev->security_ctx);
 
-	/* In case close has been called, internals->ctx_pool would be NULL */
-	rte_mempool_free(internals->ctx_pool);
 	rte_free(internals);
 
 	DPAA_SEC_INFO("Closing DPAA_SEC device %s on numa socket %u",
drivers/crypto/dpaa_sec/dpaa_sec.h +1 -2
index 2a6a3fad7..009ab7536 100644
@@ -154,11 +154,11 @@ typedef struct dpaa_sec_session_entry {
 	struct dpaa_sec_qp *qp[MAX_DPAA_CORES];
 	struct qman_fq *inq[MAX_DPAA_CORES];
 	struct sec_cdb cdb;	/**< cmd block associated with qp */
-	struct rte_mempool *ctx_pool; /* session mempool for dpaa_sec_op_ctx */
 } dpaa_sec_session;
 
 struct dpaa_sec_qp {
 	struct dpaa_sec_dev_private *internals;
+	struct rte_mempool *ctx_pool; /* mempool for dpaa_sec_op_ctx */
 	struct qman_fq outq;
 	int rx_pkts;
 	int rx_errs;
@@ -173,7 +173,6 @@ struct dpaa_sec_qp {
 /* internal sec queue interface */
 struct dpaa_sec_dev_private {
 	void *sec_hw;
-	struct rte_mempool *ctx_pool; /* per dev mempool for dpaa_sec_op_ctx */
 	struct dpaa_sec_qp qps[RTE_DPAA_MAX_NB_SEC_QPS]; /* i/o queue for sec */
 	struct qman_fq inq[RTE_DPAA_MAX_RX_QUEUE];
 	unsigned char inq_attach[RTE_DPAA_MAX_RX_QUEUE];
Signature · 1 line
2.17.1
#73 lore raw

PATCH v3 24/24 crypto/dpaa2_sec: improve debug logging

In reply to Akhil Goyal

From: Hemant Agrawal <[email protected]>

unnecessary debug logs in data path are removed
and hardware debug logs are compiled off.

---
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 41 ++++++++-------------
 1 file changed, 16 insertions(+), 25 deletions(-)
drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +16 -25
index b811f2f1b..2ab34a00f 100644
@@ -305,8 +305,6 @@ build_authenc_gcm_sg_fd(dpaa2_sec_session *sess,
 	uint8_t *IV_ptr = rte_crypto_op_ctod_offset(op, uint8_t *,
 			sess->iv.offset);
 
-	PMD_INIT_FUNC_TRACE();
-
 	if (sym_op->m_dst)
 		mbuf = sym_op->m_dst;
 	else
@@ -453,8 +451,6 @@ build_authenc_gcm_fd(dpaa2_sec_session *sess,
 	uint8_t *IV_ptr = rte_crypto_op_ctod_offset(op, uint8_t *,
 			sess->iv.offset);
 
-	PMD_INIT_FUNC_TRACE();
-
 	if (sym_op->m_dst)
 		dst = sym_op->m_dst;
 	else
@@ -602,8 +598,6 @@ build_authenc_sg_fd(dpaa2_sec_session *sess,
 	uint8_t *iv_ptr = rte_crypto_op_ctod_offset(op, uint8_t *,
 			sess->iv.offset);
 
-	PMD_INIT_FUNC_TRACE();
-
 	if (sym_op->m_dst)
 		mbuf = sym_op->m_dst;
 	else
@@ -748,8 +742,6 @@ build_authenc_fd(dpaa2_sec_session *sess,
 			sess->iv.offset);
 	struct rte_mbuf *dst;
 
-	PMD_INIT_FUNC_TRACE();
-
 	if (sym_op->m_dst)
 		dst = sym_op->m_dst;
 	else
@@ -887,8 +879,6 @@ static inline int build_auth_sg_fd(
 	uint8_t *old_digest;
 	struct rte_mbuf *mbuf;
 
-	PMD_INIT_FUNC_TRACE();
-
 	data_len = sym_op->auth.data.length;
 	data_offset = sym_op->auth.data.offset;
 
@@ -1006,8 +996,6 @@ build_auth_fd(dpaa2_sec_session *sess, struct rte_crypto_op *op,
 	uint8_t *old_digest;
 	int retval;
 
-	PMD_INIT_FUNC_TRACE();
-
 	data_len = sym_op->auth.data.length;
 	data_offset = sym_op->auth.data.offset;
 
@@ -1123,8 +1111,6 @@ build_cipher_sg_fd(dpaa2_sec_session *sess, struct rte_crypto_op *op,
 	uint8_t *iv_ptr = rte_crypto_op_ctod_offset(op, uint8_t *,
 			sess->iv.offset);
 
-	PMD_INIT_FUNC_TRACE();
-
 	data_len = sym_op->cipher.data.length;
 	data_offset = sym_op->cipher.data.offset;
 
@@ -1258,8 +1244,6 @@ build_cipher_fd(dpaa2_sec_session *sess, struct rte_crypto_op *op,
 			sess->iv.offset);
 	struct rte_mbuf *dst;
 
-	PMD_INIT_FUNC_TRACE();
-
 	data_len = sym_op->cipher.data.length;
 	data_offset = sym_op->cipher.data.offset;
 
@@ -1371,8 +1355,6 @@ build_sec_fd(struct rte_crypto_op *op,
 	int ret = -1;
 	dpaa2_sec_session *sess;
 
-	PMD_INIT_FUNC_TRACE();
-
 	if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION)
 		sess = (dpaa2_sec_session *)get_sym_session_private_data(
 				op->sym->session, cryptodev_driver_id);
@@ -1821,7 +1803,7 @@ dpaa2_sec_cipher_init(struct rte_cryptodev *dev,
 {
 	struct dpaa2_sec_dev_private *dev_priv = dev->data->dev_private;
 	struct alginfo cipherdata;
-	int bufsize, i;
+	int bufsize;
 	struct ctxt_priv *priv;
 	struct sec_flow_context *flc;
 
@@ -1937,9 +1919,11 @@ dpaa2_sec_cipher_init(struct rte_cryptodev *dev,
 	flc->word1_sdl = (uint8_t)bufsize;
 	session->ctxt = priv;
 
+#ifdef CAAM_DESC_DEBUG
+	int i;
 	for (i = 0; i < bufsize; i++)
 		DPAA2_SEC_DEBUG("DESC[%d]:0x%x", i, priv->flc_desc[0].desc[i]);
-
+#endif
 	return 0;
 
 error_out:
@@ -1955,7 +1939,7 @@ dpaa2_sec_auth_init(struct rte_cryptodev *dev,
 {
 	struct dpaa2_sec_dev_private *dev_priv = dev->data->dev_private;
 	struct alginfo authdata;
-	int bufsize, i;
+	int bufsize;
 	struct ctxt_priv *priv;
 	struct sec_flow_context *flc;
 
@@ -2099,10 +2083,12 @@ dpaa2_sec_auth_init(struct rte_cryptodev *dev,
 
 	flc->word1_sdl = (uint8_t)bufsize;
 	session->ctxt = priv;
+#ifdef CAAM_DESC_DEBUG
+	int i;
 	for (i = 0; i < bufsize; i++)
 		DPAA2_SEC_DEBUG("DESC[%d]:0x%x",
 				i, priv->flc_desc[DESC_INITFINAL].desc[i]);
-
+#endif
 
 	return 0;
 
@@ -2120,7 +2106,7 @@ dpaa2_sec_aead_init(struct rte_cryptodev *dev,
 	struct dpaa2_sec_aead_ctxt *ctxt = &session->ext_params.aead_ctxt;
 	struct dpaa2_sec_dev_private *dev_priv = dev->data->dev_private;
 	struct alginfo aeaddata;
-	int bufsize, i;
+	int bufsize;
 	struct ctxt_priv *priv;
 	struct sec_flow_context *flc;
 	struct rte_crypto_aead_xform *aead_xform = &xform->aead;
@@ -2218,10 +2204,12 @@ dpaa2_sec_aead_init(struct rte_cryptodev *dev,
 
 	flc->word1_sdl = (uint8_t)bufsize;
 	session->ctxt = priv;
+#ifdef CAAM_DESC_DEBUG
+	int i;
 	for (i = 0; i < bufsize; i++)
 		DPAA2_SEC_DEBUG("DESC[%d]:0x%x\n",
 			    i, priv->flc_desc[0].desc[i]);
-
+#endif
 	return 0;
 
 error_out:
@@ -2239,7 +2227,7 @@ dpaa2_sec_aead_chain_init(struct rte_cryptodev *dev,
 	struct dpaa2_sec_aead_ctxt *ctxt = &session->ext_params.aead_ctxt;
 	struct dpaa2_sec_dev_private *dev_priv = dev->data->dev_private;
 	struct alginfo authdata, cipherdata;
-	int bufsize, i;
+	int bufsize;
 	struct ctxt_priv *priv;
 	struct sec_flow_context *flc;
 	struct rte_crypto_cipher_xform *cipher_xform;
@@ -2444,9 +2432,12 @@ dpaa2_sec_aead_chain_init(struct rte_cryptodev *dev,
 
 	flc->word1_sdl = (uint8_t)bufsize;
 	session->ctxt = priv;
+#ifdef CAAM_DESC_DEBUG
+	int i;
 	for (i = 0; i < bufsize; i++)
 		DPAA2_SEC_DEBUG("DESC[%d]:0x%x",
 			    i, priv->flc_desc[0].desc[i]);
+#endif
 
 	return 0;
 
Signature · 1 line
2.17.1
author Applied
#74 lore raw
In reply to Akhil Goyal
Quoted 74 lines

PDCP protocol offload using rte_security are supported in dpaa2_sec and dpaa_sec drivers.

Wireless algos(SNOW/ZUC) without protocol offload are also supported as per crypto APIs.

changes in v3:
- fix meson build
- fix checkpatch warnings
- include dependent patches(last 4) which were sent separately. CI was failing due to apply issues.

changes in V2:
- fix clang build
- enable zuc authentication
- minor fixes

Akhil Goyal (6):
security: add hfn override option in PDCP drivers/crypto: support hfn override for NXP PMDs crypto/dpaa2_sec: update desc for pdcp 18bit enc-auth crypto/dpaa2_sec/hw: update 12bit SN desc for NULL auth crypto/dpaa_sec: support scatter gather for PDCP crypto/dpaa_sec: change per cryptodev pool to per qp

Hemant Agrawal (7):
crypto/dpaa2_sec: support CAAM HW era 10 crypto/dpaa2_sec: support scatter gather for proto offloads crypto/dpaa2_sec: support snow3g cipher/integrity crypto/dpaa2_sec: support zuc ciphering/integrity crypto/dpaa2_sec: allocate context as per num segs crypto/dpaa_sec: dynamic contxt buffer for SG cases crypto/dpaa2_sec: improve debug logging

Vakul Garg (11):
drivers/crypto: support PDCP 12-bit c-plane processing drivers/crypto: support PDCP u-plane with integrity crypto/dpaa2_sec: disable 'write-safe' for PDCP crypto/dpaa2_sec/hw: support 18-bit PDCP enc-auth cases crypto/dpaa2_sec/hw: support aes-aes 18-bit PDCP crypto/dpaa2_sec/hw: support zuc-zuc 18-bit PDCP crypto/dpaa2_sec/hw: support snow-snow 18-bit PDCP crypto/dpaa2_sec/hw: support snow-f8 crypto/dpaa2_sec/hw: support snow-f9 crypto/dpaa2_sec/hw: support kasumi crypto/dpaa2_sec/hw: support ZUCE and ZUCA

 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c   |  625 ++++++--
 drivers/crypto/dpaa2_sec/dpaa2_sec_logs.h     |    4 +-
 drivers/crypto/dpaa2_sec/dpaa2_sec_priv.h     |   96 +-
 drivers/crypto/dpaa2_sec/hw/desc.h            |    8 +-
 drivers/crypto/dpaa2_sec/hw/desc/algo.h       |  295 +++-
 drivers/crypto/dpaa2_sec/hw/desc/pdcp.h       | 1387 ++++++++++++++---
 .../dpaa2_sec/hw/rta/fifo_load_store_cmd.h    |    9 +-
 drivers/crypto/dpaa2_sec/hw/rta/header_cmd.h  |   21 +-
 drivers/crypto/dpaa2_sec/hw/rta/jump_cmd.h    |    3 +-
 drivers/crypto/dpaa2_sec/hw/rta/key_cmd.h     |    5 +-
 drivers/crypto/dpaa2_sec/hw/rta/load_cmd.h    |   10 +-
 drivers/crypto/dpaa2_sec/hw/rta/math_cmd.h    |   12 +-
 drivers/crypto/dpaa2_sec/hw/rta/move_cmd.h    |    8 +-
 drivers/crypto/dpaa2_sec/hw/rta/nfifo_cmd.h   |   10 +-
 .../crypto/dpaa2_sec/hw/rta/operation_cmd.h   |    6 +-
 .../crypto/dpaa2_sec/hw/rta/protocol_cmd.h    |   11 +-
 .../dpaa2_sec/hw/rta/sec_run_time_asm.h       |   27 +-
 .../dpaa2_sec/hw/rta/seq_in_out_ptr_cmd.h     |    7 +-
 drivers/crypto/dpaa2_sec/hw/rta/store_cmd.h   |    6 +-
 drivers/crypto/dpaa_sec/dpaa_sec.c            |  361 +++--
 drivers/crypto/dpaa_sec/dpaa_sec.h            |   16 +-
 lib/librte_security/rte_security.h            |   11 +-
 22 files changed, 2296 insertions(+), 642 deletions(-)
Quoted 2 lines

--
2.17.1

Applied to dpdk-next-crypto