DPDK patches and discussions
 help / color / mirror / Atom feed
From: Gagandeep Singh <g.singh@nxp.com>
To: gakhil@marvell.com, dev@dpdk.org
Cc: Gagandeep Singh <g.singh@nxp.com>, stable@dpdk.org
Subject: [PATCH 1/2] common/dpaax: remove dead code
Date: Thu, 17 Mar 2022 14:25:57 +0530	[thread overview]
Message-ID: <20220317085558.2575554-1-g.singh@nxp.com> (raw)

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


             reply	other threads:[~2022-03-17  8:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-17  8:55 Gagandeep Singh [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220317085558.2575554-1-g.singh@nxp.com \
    --to=g.singh@nxp.com \
    --cc=dev@dpdk.org \
    --cc=gakhil@marvell.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).