net/bnxt: support index opcode constant
authorKishore Padmanabha <kishore.padmanabha@broadcom.com>
Mon, 6 Jul 2020 08:24:47 +0000 (13:54 +0530)
committerFerruh Yigit <ferruh.yigit@intel.com>
Sat, 11 Jul 2020 04:18:53 +0000 (06:18 +0200)
Add support for index opcode constant so that
parif configuration could be constant value.

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_def_rules.c
drivers/net/bnxt/tf_ulp/ulp_mapper.c
drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h

index 46b558f..b01ad0b 100644 (file)
@@ -12,6 +12,8 @@
 #include "ulp_flow_db.h"
 #include "ulp_mapper.h"
 
+#define BNXT_ULP_FREE_PARIF_BASE 11
+
 struct bnxt_ulp_def_param_handler {
        int32_t (*vfr_func)(struct bnxt_ulp_context *ulp_ctx,
                            struct ulp_tlv_param *param,
@@ -81,12 +83,15 @@ ulp_set_parif_in_comp_fld(struct bnxt_ulp_context *ulp_ctx,
        if (rc)
                return rc;
 
-       if (parif_type == BNXT_ULP_PHY_PORT_PARIF)
+       if (parif_type == BNXT_ULP_PHY_PORT_PARIF) {
                idx = BNXT_ULP_CF_IDX_PHY_PORT_PARIF;
-       else if (parif_type == BNXT_ULP_DRV_FUNC_PARIF)
+       } else if (parif_type == BNXT_ULP_DRV_FUNC_PARIF) {
                idx = BNXT_ULP_CF_IDX_DRV_FUNC_PARIF;
-       else
+               /* Parif needs to be reset to a free partition */
+               parif += BNXT_ULP_FREE_PARIF_BASE;
+       } else {
                idx = BNXT_ULP_CF_IDX_VF_FUNC_PARIF;
+       }
 
        ULP_COMP_FLD_IDX_WR(mapper_params, idx, parif);
 
index c96381b..733766c 100644 (file)
@@ -1922,11 +1922,14 @@ ulp_mapper_if_tbl_process(struct bnxt_ulp_mapper_parms *parms,
        }
 
        /* Get the index details from computed field */
-       if (tbl->index_opcode != BNXT_ULP_INDEX_OPCODE_COMP_FIELD) {
+       if (tbl->index_opcode == BNXT_ULP_INDEX_OPCODE_COMP_FIELD) {
+               idx = ULP_COMP_FLD_IDX_RD(parms, tbl->index_operand);
+       } else if (tbl->index_opcode == BNXT_ULP_INDEX_OPCODE_CONSTANT) {
+               idx = tbl->index_operand;
+       } else {
                BNXT_TF_DBG(ERR, "Invalid tbl index opcode\n");
                return -EINVAL;
        }
-       idx = ULP_COMP_FLD_IDX_RD(parms, tbl->index_operand);
 
        /* Perform the tf table set by filling the set params */
        iftbl_params.dir = tbl->direction;
index 6d6a734..892d8ea 100644 (file)
@@ -188,7 +188,8 @@ enum bnxt_ulp_index_opcode {
        BNXT_ULP_INDEX_OPCODE_ALLOCATE = 1,
        BNXT_ULP_INDEX_OPCODE_GLOBAL = 2,
        BNXT_ULP_INDEX_OPCODE_COMP_FIELD = 3,
-       BNXT_ULP_INDEX_OPCODE_LAST = 4
+       BNXT_ULP_INDEX_OPCODE_CONSTANT = 4,
+       BNXT_ULP_INDEX_OPCODE_LAST = 5
 };
 
 enum bnxt_ulp_mapper_opc {
@@ -511,6 +512,7 @@ enum bnxt_ulp_sym {
        BNXT_ULP_SYM_IP_PROTO_IP_IN_IP = 4,
        BNXT_ULP_SYM_IP_PROTO_TCP = 6,
        BNXT_ULP_SYM_IP_PROTO_UDP = 17,
+       BNXT_ULP_SYM_VF_FUNC_PARIF = 15,
        BNXT_ULP_SYM_NO = 0,
        BNXT_ULP_SYM_YES = 1
 };