net/bnxt: convert critical resource to enum
authorKishore Padmanabha <kishore.padmanabha@broadcom.com>
Fri, 12 Jun 2020 12:50:07 +0000 (18:20 +0530)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 30 Jun 2020 12:52:30 +0000 (14:52 +0200)
The critical resource field in the template table is assigned
enumeration values instead of hard coded values.

Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@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.c
drivers/net/bnxt/tf_ulp/ulp_template_db.h
drivers/net/bnxt/tf_ulp/ulp_template_struct.h

index 1054c01..9c53451 100644 (file)
@@ -568,7 +568,7 @@ ulp_mapper_ident_process(struct bnxt_ulp_mapper_parms *parms,
                fid_parms.resource_func = ident->resource_func;
                fid_parms.resource_type = ident->ident_type;
                fid_parms.resource_hndl = iparms.id;
-               fid_parms.critical_resource     = 0;
+               fid_parms.critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO;
 
                rc = ulp_flow_db_resource_add(parms->ulp_ctx,
                                              parms->tbl_idx,
@@ -923,7 +923,7 @@ ulp_mapper_mark_gfid_process(struct bnxt_ulp_mapper_parms *parms,
        }
        fid_parms.direction = tbl->direction;
        fid_parms.resource_func = BNXT_ULP_RESOURCE_FUNC_HW_FID;
-       fid_parms.critical_resource = 0;
+       fid_parms.critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO;
        fid_parms.resource_type = mark_flag;
        fid_parms.resource_hndl = gfid;
        rc = ulp_flow_db_resource_add(parms->ulp_ctx,
@@ -972,7 +972,7 @@ ulp_mapper_mark_act_ptr_process(struct bnxt_ulp_mapper_parms *parms,
        }
        fid_parms.direction = tbl->direction;
        fid_parms.resource_func = BNXT_ULP_RESOURCE_FUNC_HW_FID;
-       fid_parms.critical_resource = 0;
+       fid_parms.critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO;
        fid_parms.resource_type = mark_flag;
        fid_parms.resource_hndl = act_idx;
        rc = ulp_flow_db_resource_add(parms->ulp_ctx,
@@ -1498,7 +1498,7 @@ ulp_mapper_index_tbl_process(struct bnxt_ulp_mapper_parms *parms,
        fid_parms.resource_func = tbl->resource_func;
        fid_parms.resource_type = tbl->resource_type;
        fid_parms.resource_hndl = aparms.idx;
-       fid_parms.critical_resource     = 0;
+       fid_parms.critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO;
 
        rc = ulp_flow_db_resource_add(parms->ulp_ctx,
                                      parms->tbl_idx,
@@ -1861,7 +1861,7 @@ ulp_mapper_resources_free(struct bnxt_ulp_context *ulp_ctx,
         * Set the critical resource on the first resource del, then iterate
         * while status is good
         */
-       res_parms.critical_resource = 1;
+       res_parms.critical_resource = BNXT_ULP_CRITICAL_RESOURCE_YES;
        rc = ulp_flow_db_resource_del(ulp_ctx, tbl_type, fid, &res_parms);
 
        if (rc) {
@@ -1887,8 +1887,8 @@ ulp_mapper_resources_free(struct bnxt_ulp_context *ulp_ctx,
                                    tbl_type, fid, res_parms.resource_func,
                                    res_parms.resource_hndl, trc);
 
-               /* All subsequent call require the critical_resource be zero */
-               res_parms.critical_resource = 0;
+               /* All subsequent call require the non-critical_resource */
+               res_parms.critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO;
 
                rc = ulp_flow_db_resource_del(ulp_ctx,
                                              tbl_type,
index 20bcbb4..5bc6b25 100644 (file)
@@ -606,7 +606,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_class_tbl_list[] = {
        .ident_start_idx = 0,
        .ident_nums = 1,
        .mark_enable = BNXT_ULP_MARK_ENABLE_NO,
-       .critical_resource = 0,
+       .critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO,
        .regfile_wr_idx = BNXT_ULP_REGFILE_INDEX_NOT_USED
        },
        {
@@ -627,7 +627,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_class_tbl_list[] = {
        .ident_start_idx = 1,
        .ident_nums = 0,
        .mark_enable = BNXT_ULP_MARK_ENABLE_NO,
-       .critical_resource = 0,
+       .critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO,
        .regfile_wr_idx = BNXT_ULP_REGFILE_INDEX_NOT_USED
        },
        {
@@ -648,7 +648,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_class_tbl_list[] = {
        .ident_start_idx = 1,
        .ident_nums = 1,
        .mark_enable = BNXT_ULP_MARK_ENABLE_NO,
-       .critical_resource = 0,
+       .critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO,
        .regfile_wr_idx = BNXT_ULP_REGFILE_INDEX_NOT_USED
        },
        {
@@ -669,7 +669,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_class_tbl_list[] = {
        .ident_start_idx = 2,
        .ident_nums = 0,
        .mark_enable = BNXT_ULP_MARK_ENABLE_NO,
-       .critical_resource = 0,
+       .critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO,
        .regfile_wr_idx = BNXT_ULP_REGFILE_INDEX_NOT_USED
        },
        {
@@ -690,7 +690,7 @@ struct bnxt_ulp_mapper_tbl_info ulp_class_tbl_list[] = {
        .ident_start_idx = 2,
        .ident_nums = 0,
        .mark_enable = BNXT_ULP_MARK_ENABLE_YES,
-       .critical_resource = 1,
+       .critical_resource = BNXT_ULP_CRITICAL_RESOURCE_YES,
        .regfile_wr_idx = BNXT_ULP_REGFILE_INDEX_NOT_USED
        }
 };
index cf9cc58..dd0c42a 100644 (file)
@@ -129,6 +129,12 @@ enum bnxt_ulp_cf_idx {
        BNXT_ULP_CF_IDX_LAST = 29
 };
 
+enum bnxt_ulp_critical_resource {
+       BNXT_ULP_CRITICAL_RESOURCE_NO = 0,
+       BNXT_ULP_CRITICAL_RESOURCE_YES = 1,
+       BNXT_ULP_CRITICAL_RESOURCE_LAST = 2
+};
+
 enum bnxt_ulp_device_id {
        BNXT_ULP_DEVICE_ID_WH_PLUS = 0,
        BNXT_ULP_DEVICE_ID_THOR = 1,
index 27ad421..86a0e5c 100644 (file)
@@ -162,7 +162,7 @@ struct bnxt_ulp_mapper_tbl_info {
        uint8_t         direction;
        uint32_t        priority;
        uint8_t         srch_b4_alloc;
-       uint32_t        critical_resource;
+       enum bnxt_ulp_critical_resource critical_resource;
 
        /* Information for accessing the ulp_key_field_list */
        uint32_t        key_start_idx;