From: Kishore Padmanabha Date: Fri, 12 Jun 2020 12:50:07 +0000 (+0530) Subject: net/bnxt: convert critical resource to enum X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=f48751338c878fd43bb3d01e4f74c29925fffa2c;p=dpdk.git net/bnxt: convert critical resource to enum The critical resource field in the template table is assigned enumeration values instead of hard coded values. Signed-off-by: Kishore Padmanabha Signed-off-by: Somnath Kotur Reviewed-by: Mike Baucom Reviewed-by: Ajit Khaparde --- diff --git a/drivers/net/bnxt/tf_ulp/ulp_mapper.c b/drivers/net/bnxt/tf_ulp/ulp_mapper.c index 1054c01fdc..9c53451b9c 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_mapper.c +++ b/drivers/net/bnxt/tf_ulp/ulp_mapper.c @@ -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, diff --git a/drivers/net/bnxt/tf_ulp/ulp_template_db.c b/drivers/net/bnxt/tf_ulp/ulp_template_db.c index 20bcbb4b08..5bc6b25e47 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_template_db.c +++ b/drivers/net/bnxt/tf_ulp/ulp_template_db.c @@ -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 } }; diff --git a/drivers/net/bnxt/tf_ulp/ulp_template_db.h b/drivers/net/bnxt/tf_ulp/ulp_template_db.h index cf9cc58531..dd0c42a03b 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_template_db.h +++ b/drivers/net/bnxt/tf_ulp/ulp_template_db.h @@ -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, diff --git a/drivers/net/bnxt/tf_ulp/ulp_template_struct.h b/drivers/net/bnxt/tf_ulp/ulp_template_struct.h index 27ad421b56..86a0e5c71e 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_template_struct.h +++ b/drivers/net/bnxt/tf_ulp/ulp_template_struct.h @@ -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;