net/bnxt: support negative conditional opcodes
authorKishore Padmanabha <kishore.padmanabha@broadcom.com>
Mon, 6 Jul 2020 08:24:45 +0000 (13:54 +0530)
committerFerruh Yigit <ferruh.yigit@intel.com>
Sat, 11 Jul 2020 04:18:52 +0000 (06:18 +0200)
Added support for negative conditional opcodes in the
mapper processing.

Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Mike Baucom <michael.baucom@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
drivers/net/bnxt/tf_ulp/ulp_mapper.c
drivers/net/bnxt/tf_ulp/ulp_template_db_act.c
drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h

index df3dea8..c96381b 100644 (file)
@@ -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");
index 3d65073..c587ff5 100644 (file)
@@ -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,
index e13d20b..6d6a734 100644 (file)
@@ -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 {