DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH 1/2] common/dpaax: remove dead code
@ 2022-03-17  8:55 Gagandeep Singh
  2022-03-17  8:55 ` [PATCH 2/2] crypto/dpaa_sec: fix digest size Gagandeep Singh
  2022-04-16 19:36 ` [EXT] [PATCH 1/2] common/dpaax: remove dead code Akhil Goyal
  0 siblings, 2 replies; 3+ messages in thread
From: Gagandeep Singh @ 2022-03-17  8:55 UTC (permalink / raw)
  To: gakhil, dev; +Cc: Gagandeep Singh, stable

This patch remove structural and logical dead code from
caamflib.

coverity issues: 375251 375258 375261 375267 375269 375285 373161
		 375249 375257

Fixes: 6127fff842a7 ("common/dpaax: remove outdated caamflib code")
Fixes: 81eb760d2207 ("common/dpaax/caamflib: remove some inline keys")
Cc: stable@dpdk.org

Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
---
 drivers/common/dpaax/caamflib/desc/pdcp.h | 196 +++++-----------------
 drivers/common/dpaax/caamflib/desc/sdap.h |  44 +----
 2 files changed, 45 insertions(+), 195 deletions(-)

diff --git a/drivers/common/dpaax/caamflib/desc/pdcp.h b/drivers/common/dpaax/caamflib/desc/pdcp.h
index 2fe56c53c6..46153b9c29 100644
--- a/drivers/common/dpaax/caamflib/desc/pdcp.h
+++ b/drivers/common/dpaax/caamflib/desc/pdcp.h
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: BSD-3-Clause or GPL-2.0+
  * Copyright 2008-2013 Freescale Semiconductor, Inc.
- * Copyright 2019-2021 NXP
+ * Copyright 2019-2022 NXP
  */
 
 #ifndef __DESC_PDCP_H__
@@ -776,21 +776,11 @@ pdcp_insert_uplane_snow_snow_op(struct program *p,
 
 		return 0;
 	}
-	/* Non-proto is supported only for 5bit cplane and 18bit uplane */
-	switch (sn_size) {
-	case PDCP_SN_SIZE_18:
-		offset = 5;
-		length = 3;
-		sn_mask = (swap == false) ? PDCP_U_PLANE_18BIT_SN_MASK :
-					PDCP_U_PLANE_18BIT_SN_MASK_BE;
-		break;
-	case PDCP_SN_SIZE_5:
-	case PDCP_SN_SIZE_7:
-	case PDCP_SN_SIZE_12:
-	case PDCP_SN_SIZE_15:
-		pr_err("Invalid sn_size for %s\n", __func__);
-		return -ENOTSUP;
-	}
+	/* sn_size is 18 */
+	offset = 5;
+	length = 3;
+	sn_mask = (swap == false) ? PDCP_U_PLANE_18BIT_SN_MASK :
+				PDCP_U_PLANE_18BIT_SN_MASK_BE;
 
 	if (dir == OP_TYPE_ENCAP_PROTOCOL)
 		MATHB(p, SEQINSZ, SUB, length, VSEQINSZ, 4, IMMED2);
@@ -901,21 +891,11 @@ pdcp_insert_uplane_zuc_zuc_op(struct program *p,
 
 		return 0;
 	}
-	/* Non-proto is supported only for 5bit cplane and 18bit uplane */
-	switch (sn_size) {
-	case PDCP_SN_SIZE_18:
-		offset = 5;
-		length = 3;
-		sn_mask = (swap == false) ? PDCP_U_PLANE_18BIT_SN_MASK :
-					PDCP_U_PLANE_18BIT_SN_MASK_BE;
-		break;
-	case PDCP_SN_SIZE_5:
-	case PDCP_SN_SIZE_7:
-	case PDCP_SN_SIZE_12:
-	case PDCP_SN_SIZE_15:
-		pr_err("Invalid sn_size for %s\n", __func__);
-		return -ENOTSUP;
-	}
+	/* sn_size is 18 */
+	offset = 5;
+	length = 3;
+	sn_mask = (swap == false) ? PDCP_U_PLANE_18BIT_SN_MASK :
+				PDCP_U_PLANE_18BIT_SN_MASK_BE;
 
 	SEQLOAD(p, MATH0, offset, length, 0);
 	JUMP(p, 1, LOCAL_JUMP, ALL_TRUE, CALM);
@@ -1190,27 +1170,11 @@ pdcp_insert_cplane_snow_aes_op(struct program *p,
 
 		return 0;
 	}
-	/* Non-proto is supported only for 5bit cplane and 18bit uplane */
-	switch (sn_size) {
-	case PDCP_SN_SIZE_5:
-		offset = 7;
-		length = 1;
-		sn_mask = (swap == false) ? PDCP_C_PLANE_SN_MASK :
-					PDCP_C_PLANE_SN_MASK_BE;
-		break;
-	case PDCP_SN_SIZE_18:
-		offset = 5;
-		length = 3;
-		sn_mask = (swap == false) ? PDCP_U_PLANE_18BIT_SN_MASK :
-					PDCP_U_PLANE_18BIT_SN_MASK_BE;
-		break;
-	case PDCP_SN_SIZE_7:
-	case PDCP_SN_SIZE_12:
-	case PDCP_SN_SIZE_15:
-		pr_err("Invalid sn_size for %s\n", __func__);
-		return -ENOTSUP;
-
-	}
+	/* sn_size is 18 */
+	offset = 5;
+	length = 3;
+	sn_mask = (swap == false) ? PDCP_U_PLANE_18BIT_SN_MASK :
+				PDCP_U_PLANE_18BIT_SN_MASK_BE;
 
 	SEQLOAD(p, MATH0, offset, length, 0);
 	JUMP(p, 1, LOCAL_JUMP, ALL_TRUE, CALM);
@@ -1421,27 +1385,11 @@ pdcp_insert_cplane_aes_snow_op(struct program *p,
 
 		return 0;
 	}
-	/* Non-proto is supported only for 5bit cplane and 18bit uplane */
-	switch (sn_size) {
-	case PDCP_SN_SIZE_5:
-		offset = 7;
-		length = 1;
-		sn_mask = (swap == false) ? PDCP_C_PLANE_SN_MASK :
-					PDCP_C_PLANE_SN_MASK_BE;
-		break;
-	case PDCP_SN_SIZE_18:
-		offset = 5;
-		length = 3;
-		sn_mask = (swap == false) ? PDCP_U_PLANE_18BIT_SN_MASK :
-					PDCP_U_PLANE_18BIT_SN_MASK_BE;
-		break;
-	case PDCP_SN_SIZE_7:
-	case PDCP_SN_SIZE_12:
-	case PDCP_SN_SIZE_15:
-		pr_err("Invalid sn_size for %s\n", __func__);
-		return -ENOTSUP;
-
-	}
+	/* sn_size is 18 */
+	offset = 5;
+	length = 3;
+	sn_mask = (swap == false) ? PDCP_U_PLANE_18BIT_SN_MASK :
+				PDCP_U_PLANE_18BIT_SN_MASK_BE;
 
 	if (dir == OP_TYPE_ENCAP_PROTOCOL)
 		MATHB(p, SEQINSZ, SUB, length, VSEQINSZ, 4, IMMED2);
@@ -1548,27 +1496,11 @@ pdcp_insert_cplane_snow_zuc_op(struct program *p,
 			 (uint16_t)authdata->algtype);
 		return 0;
 	}
-	/* Non-proto is supported only for 5bit cplane and 18bit uplane */
-	switch (sn_size) {
-	case PDCP_SN_SIZE_5:
-		offset = 7;
-		length = 1;
-		sn_mask = (swap == false) ? PDCP_C_PLANE_SN_MASK :
-					PDCP_C_PLANE_SN_MASK_BE;
-		break;
-	case PDCP_SN_SIZE_18:
-		offset = 5;
-		length = 3;
-		sn_mask = (swap == false) ? PDCP_U_PLANE_18BIT_SN_MASK :
-					PDCP_U_PLANE_18BIT_SN_MASK_BE;
-		break;
-	case PDCP_SN_SIZE_7:
-	case PDCP_SN_SIZE_12:
-	case PDCP_SN_SIZE_15:
-		pr_err("Invalid sn_size for %s\n", __func__);
-		return -ENOTSUP;
-
-	}
+	/* sn_size is 18 */
+	offset = 5;
+	length = 3;
+	sn_mask = (swap == false) ? PDCP_U_PLANE_18BIT_SN_MASK :
+				PDCP_U_PLANE_18BIT_SN_MASK_BE;
 
 	pkeyjump = JUMP(p, keyjump, LOCAL_JUMP, ALL_TRUE, SHRD | SELF | BOTH);
 	KEY(p, KEY1, cipherdata->key_enc_flags, cipherdata->key,
@@ -1667,27 +1599,12 @@ pdcp_insert_cplane_aes_zuc_op(struct program *p,
 
 		return 0;
 	}
-	/* Non-proto is supported only for 5bit cplane and 18bit uplane */
-	switch (sn_size) {
-	case PDCP_SN_SIZE_5:
-		offset = 7;
-		length = 1;
-		sn_mask = (swap == false) ? PDCP_C_PLANE_SN_MASK :
-					PDCP_C_PLANE_SN_MASK_BE;
-		break;
-	case PDCP_SN_SIZE_18:
-		offset = 5;
-		length = 3;
-		sn_mask = (swap == false) ? PDCP_U_PLANE_18BIT_SN_MASK :
-					PDCP_U_PLANE_18BIT_SN_MASK_BE;
-		break;
-	case PDCP_SN_SIZE_7:
-	case PDCP_SN_SIZE_12:
-	case PDCP_SN_SIZE_15:
-		pr_err("Invalid sn_size for %s\n", __func__);
-		return -ENOTSUP;
+	/* sn_size is 18 */
+	offset = 5;
+	length = 3;
+	sn_mask = (swap == false) ? PDCP_U_PLANE_18BIT_SN_MASK :
+				PDCP_U_PLANE_18BIT_SN_MASK_BE;
 
-	}
 	pkeyjump = JUMP(p, keyjump, LOCAL_JUMP, ALL_TRUE, SHRD | SELF | BOTH);
 	KEY(p, KEY1, cipherdata->key_enc_flags, cipherdata->key,
 	    cipherdata->keylen, INLINE_KEY(cipherdata));
@@ -1789,27 +1706,12 @@ pdcp_insert_cplane_zuc_snow_op(struct program *p,
 
 		return 0;
 	}
-	/* Non-proto is supported only for 5bit cplane and 18bit uplane */
-	switch (sn_size) {
-	case PDCP_SN_SIZE_5:
-		offset = 7;
-		length = 1;
-		sn_mask = (swap == false) ? PDCP_C_PLANE_SN_MASK :
-					PDCP_C_PLANE_SN_MASK_BE;
-		break;
-	case PDCP_SN_SIZE_18:
-		offset = 5;
-		length = 3;
-		sn_mask = (swap == false) ? PDCP_U_PLANE_18BIT_SN_MASK :
-					PDCP_U_PLANE_18BIT_SN_MASK_BE;
-		break;
-	case PDCP_SN_SIZE_7:
-	case PDCP_SN_SIZE_12:
-	case PDCP_SN_SIZE_15:
-		pr_err("Invalid sn_size for %s\n", __func__);
-		return -ENOTSUP;
+	/* sn_size is 18 */
+	offset = 5;
+	length = 3;
+	sn_mask = (swap == false) ? PDCP_U_PLANE_18BIT_SN_MASK :
+				PDCP_U_PLANE_18BIT_SN_MASK_BE;
 
-	}
 	pkeyjump = JUMP(p, keyjump, LOCAL_JUMP, ALL_TRUE, SHRD | SELF | BOTH);
 	KEY(p, KEY1, cipherdata->key_enc_flags, cipherdata->key,
 	    cipherdata->keylen, INLINE_KEY(cipherdata));
@@ -1929,26 +1831,12 @@ pdcp_insert_cplane_zuc_aes_op(struct program *p,
 			 (uint16_t)authdata->algtype);
 		return 0;
 	}
-	/* Non-proto is supported only for 5bit cplane and 18bit uplane */
-	switch (sn_size) {
-	case PDCP_SN_SIZE_5:
-		offset = 7;
-		length = 1;
-		sn_mask = (swap == false) ? PDCP_C_PLANE_SN_MASK :
-					PDCP_C_PLANE_SN_MASK_BE;
-		break;
-	case PDCP_SN_SIZE_18:
-		offset = 5;
-		length = 3;
-		sn_mask = (swap == false) ? PDCP_U_PLANE_18BIT_SN_MASK :
-					PDCP_U_PLANE_18BIT_SN_MASK_BE;
-		break;
-	case PDCP_SN_SIZE_7:
-	case PDCP_SN_SIZE_12:
-	case PDCP_SN_SIZE_15:
-		pr_err("Invalid sn_size for %s\n", __func__);
-		return -ENOTSUP;
-	}
+
+	/* sn_size is 18 */
+	offset = 5;
+	length = 3;
+	sn_mask = (swap == false) ? PDCP_U_PLANE_18BIT_SN_MASK :
+				PDCP_U_PLANE_18BIT_SN_MASK_BE;
 
 	SEQLOAD(p, MATH0, offset, length, 0);
 	JUMP(p, 1, LOCAL_JUMP, ALL_TRUE, CALM);
diff --git a/drivers/common/dpaax/caamflib/desc/sdap.h b/drivers/common/dpaax/caamflib/desc/sdap.h
index 07a544295e..b38c15a24f 100644
--- a/drivers/common/dpaax/caamflib/desc/sdap.h
+++ b/drivers/common/dpaax/caamflib/desc/sdap.h
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2020-2021 NXP
+ * Copyright 2020-2022 NXP
  */
 
 #ifndef __DESC_SDAP_H__
@@ -29,52 +29,14 @@
 static inline int
 rta_inline_pdcp_sdap_query(enum auth_type_pdcp auth_alg,
 		      enum cipher_type_pdcp cipher_alg,
-		      enum pdcp_sn_size sn_size,
-		      int8_t hfn_ovd)
+		      __rte_unused enum pdcp_sn_size sn_size,
+		      __rte_unused int8_t hfn_ovd)
 {
-	int nb_key_to_inline = 0;
-
 	if ((cipher_alg != PDCP_CIPHER_TYPE_NULL) &&
 			(auth_alg != PDCP_AUTH_TYPE_NULL))
 		return 2;
 	else
 		return 0;
-
-	/**
-	 * Shared Descriptors for some of the cases does not fit in the
-	 * MAX_DESC_SIZE of the descriptor
-	 * The cases which exceed are for RTA_SEC_ERA=8 and HFN override
-	 * enabled and 12/18 bit uplane and either of following Algo combo.
-	 * - AES-SNOW
-	 * - AES-ZUC
-	 * - SNOW-SNOW
-	 * - SNOW-ZUC
-	 * - ZUC-SNOW
-	 * - ZUC-SNOW
-	 *
-	 * We cannot make inline for all cases, as this will impact performance
-	 * due to extra memory accesses for the keys.
-	 */
-
-	/* Inline only the cipher key */
-	if ((rta_sec_era == RTA_SEC_ERA_8) && hfn_ovd &&
-		((sn_size == PDCP_SN_SIZE_12) ||
-		 (sn_size == PDCP_SN_SIZE_18)) &&
-		(cipher_alg != PDCP_CIPHER_TYPE_NULL) &&
-		((auth_alg == PDCP_AUTH_TYPE_SNOW) ||
-		 (auth_alg == PDCP_AUTH_TYPE_ZUC))) {
-
-		nb_key_to_inline++;
-
-		/* Sub case where inlining another key is required */
-		if ((cipher_alg == PDCP_CIPHER_TYPE_AES) &&
-			(auth_alg == PDCP_AUTH_TYPE_SNOW))
-			nb_key_to_inline++;
-	}
-
-	/* Inline both keys */
-
-	return nb_key_to_inline;
 }
 
 static inline void key_loading_opti(struct program *p,
-- 
2.25.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 2/2] crypto/dpaa_sec: fix digest size
  2022-03-17  8:55 [PATCH 1/2] common/dpaax: remove dead code Gagandeep Singh
@ 2022-03-17  8:55 ` Gagandeep Singh
  2022-04-16 19:36 ` [EXT] [PATCH 1/2] common/dpaax: remove dead code Akhil Goyal
  1 sibling, 0 replies; 3+ messages in thread
From: Gagandeep Singh @ 2022-03-17  8:55 UTC (permalink / raw)
  To: gakhil, dev; +Cc: Gagandeep Singh, stable

DPAA crypto driver can support 64 bytes size digest size
for SHA512-HMAC.
This patch changes the value of macro max supported digest size to
64.

Fixes: c3e85bdcc6e6 ("crypto/dpaa_sec: add crypto driver for NXP DPAA platform")
Cc: stable@dpdk.org

Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
---
 drivers/crypto/dpaa_sec/dpaa_sec.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.h b/drivers/crypto/dpaa_sec/dpaa_sec.h
index 7890687828..b3f2258ead 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec.h
+++ b/drivers/crypto/dpaa_sec/dpaa_sec.h
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  *
- *   Copyright 2016-2021 NXP
+ *   Copyright 2016-2022 NXP
  *
  */
 
@@ -231,7 +231,7 @@ struct dpaa_sec_job {
 	struct qm_sg_entry sg[MAX_JOB_SG_ENTRIES];
 };
 
-#define DPAA_MAX_NB_MAX_DIGEST	32
+#define DPAA_MAX_NB_MAX_DIGEST	64
 struct dpaa_sec_op_ctx {
 	struct dpaa_sec_job job;
 	union {
-- 
2.25.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [EXT] [PATCH 1/2] common/dpaax: remove dead code
  2022-03-17  8:55 [PATCH 1/2] common/dpaax: remove dead code Gagandeep Singh
  2022-03-17  8:55 ` [PATCH 2/2] crypto/dpaa_sec: fix digest size Gagandeep Singh
@ 2022-04-16 19:36 ` Akhil Goyal
  1 sibling, 0 replies; 3+ messages in thread
From: Akhil Goyal @ 2022-04-16 19:36 UTC (permalink / raw)
  To: Gagandeep Singh, dev; +Cc: stable

> This patch remove structural and logical dead code from
> caamflib.
> 
> coverity issues: 375251 375258 375261 375267 375269 375285 373161
> 		 375249 375257
> 
> Fixes: 6127fff842a7 ("common/dpaax: remove outdated caamflib code")
> Fixes: 81eb760d2207 ("common/dpaax/caamflib: remove some inline keys")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
> ---
Series Applied to dpdk-next-crypto

Thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-04-16 19:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-17  8:55 [PATCH 1/2] common/dpaax: remove dead code Gagandeep Singh
2022-03-17  8:55 ` [PATCH 2/2] crypto/dpaa_sec: fix digest size Gagandeep Singh
2022-04-16 19:36 ` [EXT] [PATCH 1/2] common/dpaax: remove dead code Akhil Goyal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).