[03/20] net/bnxt: add support for negative conditional opcodes
diff mbox series

Message ID 20200706082502.26935-4-somnath.kotur@broadcom.com
State Accepted, archived
Delegated to: Ajit Khaparde
Headers show
Series
  • bnxt patches
Related show

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

Somnath Kotur July 6, 2020, 8:24 a.m. UTC
From: Kishore Padmanabha <kishore.padmanabha@broadcom.com>

Added support for negative conditional opcodes in the
mapper processing.

Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Reviewed-by: Ajit Kumar Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Michael Baucom <michael.baucom@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
---
 drivers/net/bnxt/tf_ulp/ulp_mapper.c           | 21 ++++++++++++++++++---
 drivers/net/bnxt/tf_ulp/ulp_template_db_act.c  |  6 +++---
 drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h | 11 +++++++----
 3 files changed, 28 insertions(+), 10 deletions(-)

Patch
diff mbox series

diff --git a/drivers/net/bnxt/tf_ulp/ulp_mapper.c b/drivers/net/bnxt/tf_ulp/ulp_mapper.c
index 3f175fb..eb77328 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_mapper.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_mapper.c
@@ -2006,21 +2006,36 @@  ulp_mapper_tbl_cond_opcode_process(struct bnxt_ulp_mapper_parms *parms,
 	case BNXT_ULP_COND_OPCODE_NOP:
 		rc = 0;
 		break;
-	case BNXT_ULP_COND_OPCODE_COMP_FIELD:
+	case BNXT_ULP_COND_OPCODE_COMP_FIELD_IS_SET:
 		if (tbl->cond_operand < BNXT_ULP_CF_IDX_LAST &&
 		    ULP_COMP_FLD_IDX_RD(parms, tbl->cond_operand))
 			rc = 0;
 		break;
-	case BNXT_ULP_COND_OPCODE_ACTION_BIT:
+	case BNXT_ULP_COND_OPCODE_ACTION_BIT_IS_SET:
 		if (ULP_BITMAP_ISSET(parms->act_bitmap->bits,
 				     tbl->cond_operand))
 			rc = 0;
 		break;
-	case BNXT_ULP_COND_OPCODE_HDR_BIT:
+	case BNXT_ULP_COND_OPCODE_HDR_BIT_IS_SET:
 		if (ULP_BITMAP_ISSET(parms->hdr_bitmap->bits,
 				     tbl->cond_operand))
 			rc = 0;
 		break;
+	case BNXT_ULP_COND_OPCODE_COMP_FIELD_NOT_SET:
+		if (tbl->cond_operand < BNXT_ULP_CF_IDX_LAST &&
+		    !ULP_COMP_FLD_IDX_RD(parms, tbl->cond_operand))
+			rc = 0;
+		break;
+	case BNXT_ULP_COND_OPCODE_ACTION_BIT_NOT_SET:
+		if (!ULP_BITMAP_ISSET(parms->act_bitmap->bits,
+				      tbl->cond_operand))
+			rc = 0;
+		break;
+	case BNXT_ULP_COND_OPCODE_HDR_BIT_NOT_SET:
+		if (!ULP_BITMAP_ISSET(parms->hdr_bitmap->bits,
+				      tbl->cond_operand))
+			rc = 0;
+		break;
 	default:
 		BNXT_TF_DBG(ERR,
 			    "Invalid arg in mapper tbl for cond opcode\n");
diff --git a/drivers/net/bnxt/tf_ulp/ulp_template_db_act.c b/drivers/net/bnxt/tf_ulp/ulp_template_db_act.c
index 3d65073..c587ff5 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_template_db_act.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_template_db_act.c
@@ -284,7 +284,7 @@  struct bnxt_ulp_mapper_tbl_info ulp_act_tbl_list[] = {
 	.resource_type = TF_TBL_TYPE_ACT_STATS_64,
 	.resource_sub_type =
 		BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_INT_COUNT,
-	.cond_opcode = BNXT_ULP_COND_OPCODE_ACTION_BIT,
+	.cond_opcode = BNXT_ULP_COND_OPCODE_ACTION_BIT_IS_SET,
 	.cond_operand = BNXT_ULP_ACTION_BIT_COUNT,
 	.direction = TF_DIR_RX,
 	.srch_b4_alloc = BNXT_ULP_SEARCH_BEFORE_ALLOC_NO,
@@ -331,7 +331,7 @@  struct bnxt_ulp_mapper_tbl_info ulp_act_tbl_list[] = {
 	.resource_type = TF_TBL_TYPE_ACT_SP_SMAC_IPV4,
 	.resource_sub_type =
 		BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_NORMAL,
-	.cond_opcode = BNXT_ULP_COND_OPCODE_COMP_FIELD,
+	.cond_opcode = BNXT_ULP_COND_OPCODE_COMP_FIELD_IS_SET,
 	.cond_operand = BNXT_ULP_CF_IDX_ACT_ENCAP_IPV4_FLAG,
 	.direction = TF_DIR_TX,
 	.srch_b4_alloc = BNXT_ULP_SEARCH_BEFORE_ALLOC_NO,
@@ -348,7 +348,7 @@  struct bnxt_ulp_mapper_tbl_info ulp_act_tbl_list[] = {
 	.resource_type = TF_TBL_TYPE_ACT_SP_SMAC_IPV4,
 	.resource_sub_type =
 		BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_NORMAL,
-	.cond_opcode = BNXT_ULP_COND_OPCODE_COMP_FIELD,
+	.cond_opcode = BNXT_ULP_COND_OPCODE_COMP_FIELD_IS_SET,
 	.cond_operand = BNXT_ULP_CF_IDX_ACT_ENCAP_IPV6_FLAG,
 	.direction = TF_DIR_TX,
 	.srch_b4_alloc = BNXT_ULP_SEARCH_BEFORE_ALLOC_NO,
diff --git a/drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h b/drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h
index e13d20b..6d6a734 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h
+++ b/drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h
@@ -127,10 +127,13 @@  enum bnxt_ulp_cf_idx {
 
 enum bnxt_ulp_cond_opcode {
 	BNXT_ULP_COND_OPCODE_NOP = 0,
-	BNXT_ULP_COND_OPCODE_COMP_FIELD = 1,
-	BNXT_ULP_COND_OPCODE_ACTION_BIT = 2,
-	BNXT_ULP_COND_OPCODE_HDR_BIT = 3,
-	BNXT_ULP_COND_OPCODE_LAST = 4
+	BNXT_ULP_COND_OPCODE_COMP_FIELD_IS_SET = 1,
+	BNXT_ULP_COND_OPCODE_ACTION_BIT_IS_SET = 2,
+	BNXT_ULP_COND_OPCODE_HDR_BIT_IS_SET = 3,
+	BNXT_ULP_COND_OPCODE_COMP_FIELD_NOT_SET = 4,
+	BNXT_ULP_COND_OPCODE_ACTION_BIT_NOT_SET = 5,
+	BNXT_ULP_COND_OPCODE_HDR_BIT_NOT_SET = 6,
+	BNXT_ULP_COND_OPCODE_LAST = 7
 };
 
 enum bnxt_ulp_critical_resource {