Added support for the internal exact match entries.
Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
ulp_eem_tbl_scope_init(struct bnxt *bp)
{
struct tf_alloc_tbl_scope_parms params = {0};
+ uint32_t dev_id;
+ struct bnxt_ulp_device_params *dparms;
int rc;
+ /* Get the dev specific number of flows that needed to be supported. */
+ if (bnxt_ulp_cntxt_dev_id_get(bp->ulp_ctx, &dev_id)) {
+ BNXT_TF_DBG(ERR, "Invalid device id\n");
+ return -EINVAL;
+ }
+
+ dparms = bnxt_ulp_device_params_get(dev_id);
+ if (!dparms) {
+ BNXT_TF_DBG(ERR, "could not fetch the device params\n");
+ return -ENODEV;
+ }
+
+ if (dparms->flow_mem_type != BNXT_ULP_FLOW_MEM_TYPE_EXT) {
+ BNXT_TF_DBG(INFO, "Table Scope alloc is not required\n");
+ return 0;
+ }
+
bnxt_init_tbl_scope_parms(bp, ¶ms);
rc = tf_alloc_tbl_scope(&bp->tfp, ¶ms);
struct tf_free_tbl_scope_parms params = {0};
struct tf *tfp;
int32_t rc = 0;
+ struct bnxt_ulp_device_params *dparms;
+ uint32_t dev_id;
if (!ulp_ctx || !ulp_ctx->cfg_data)
return -EINVAL;
return -EINVAL;
}
+ /* Get the dev specific number of flows that needed to be supported. */
+ if (bnxt_ulp_cntxt_dev_id_get(bp->ulp_ctx, &dev_id)) {
+ BNXT_TF_DBG(ERR, "Invalid device id\n");
+ return -EINVAL;
+ }
+
+ dparms = bnxt_ulp_device_params_get(dev_id);
+ if (!dparms) {
+ BNXT_TF_DBG(ERR, "could not fetch the device params\n");
+ return -ENODEV;
+ }
+
+ if (dparms->flow_mem_type != BNXT_ULP_FLOW_MEM_TYPE_EXT) {
+ BNXT_TF_DBG(INFO, "Table Scope free is not required\n");
+ return 0;
+ }
+
rc = bnxt_ulp_cntxt_tbl_scope_id_get(ulp_ctx, ¶ms.tbl_scope_id);
if (rc) {
BNXT_TF_DBG(ERR, "Failed to get the table scope id\n");
}
/* Store the handle as 64bit only for EM table entries */
- if (params->resource_func != BNXT_ULP_RESOURCE_FUNC_EM_TABLE) {
+ if (params->resource_func != BNXT_ULP_RESOURCE_FUNC_EXT_EM_TABLE &&
+ params->resource_func != BNXT_ULP_RESOURCE_FUNC_INT_EM_TABLE) {
resource_info->resource_hndl = (uint32_t)params->resource_hndl;
resource_info->resource_type = params->resource_type;
resource_info->resource_sub_type = params->resource_sub_type;
/* use the helper function to get the resource func */
params->resource_func = ulp_flow_db_resource_func_get(resource_info);
- if (params->resource_func == BNXT_ULP_RESOURCE_FUNC_EM_TABLE) {
+ if (params->resource_func == BNXT_ULP_RESOURCE_FUNC_EXT_EM_TABLE ||
+ params->resource_func == BNXT_ULP_RESOURCE_FUNC_INT_EM_TABLE) {
params->resource_hndl = resource_info->resource_em_handle;
} else if (params->resource_func & ULP_FLOW_DB_RES_FUNC_NEED_LOWER) {
params->resource_hndl = resource_info->resource_hndl;
}
} else if (resource_func ==
- BNXT_ULP_RESOURCE_FUNC_EM_TABLE){
+ BNXT_ULP_RESOURCE_FUNC_EXT_EM_TABLE ||
+ resource_func ==
+ BNXT_ULP_RESOURCE_FUNC_INT_EM_TABLE) {
*res_hndl = fid_res->resource_em_handle;
return 0;
}
BNXT_TF_DBG(DEBUG, "Resource func = %x, nxt_resource_idx = %x\n",
res_func, (ULP_FLOW_DB_RES_NXT_MASK & r->nxt_resource_idx));
- if (res_func == BNXT_ULP_RESOURCE_FUNC_EM_TABLE)
+ if (res_func == BNXT_ULP_RESOURCE_FUNC_EXT_EM_TABLE ||
+ res_func == BNXT_ULP_RESOURCE_FUNC_INT_EM_TABLE)
BNXT_TF_DBG(DEBUG, "EM Handle = 0x%016" PRIX64 "\n",
r->resource_em_handle);
else
}
static inline int32_t
-ulp_mapper_eem_entry_free(struct bnxt_ulp_context *ulp,
- struct tf *tfp,
- struct ulp_flow_db_res_params *res)
+ulp_mapper_em_entry_free(struct bnxt_ulp_context *ulp,
+ struct tf *tfp,
+ struct ulp_flow_db_res_params *res)
{
struct tf_delete_em_entry_parms fparms = { 0 };
int32_t rc;
fparms.dir = res->direction;
- fparms.mem = TF_MEM_EXTERNAL;
+ if (res->resource_func == BNXT_ULP_RESOURCE_FUNC_EXT_EM_TABLE)
+ fparms.mem = TF_MEM_EXTERNAL;
+ else
+ fparms.mem = TF_MEM_INTERNAL;
fparms.flow_handle = res->resource_hndl;
rc = bnxt_ulp_cntxt_tbl_scope_id_get(ulp, &fparms.tbl_scope_id);
#endif
/* do the transpose for the internal EM keys */
- if (tbl->resource_type == TF_MEM_INTERNAL)
+ if (tbl->resource_func == BNXT_ULP_RESOURCE_FUNC_INT_EM_TABLE)
ulp_blob_perform_byte_reverse(&key);
rc = bnxt_ulp_cntxt_tbl_scope_id_get(parms->ulp_ctx,
case BNXT_ULP_RESOURCE_FUNC_TCAM_TABLE:
rc = ulp_mapper_tcam_tbl_process(parms, tbl);
break;
- case BNXT_ULP_RESOURCE_FUNC_EM_TABLE:
+ case BNXT_ULP_RESOURCE_FUNC_EXT_EM_TABLE:
+ case BNXT_ULP_RESOURCE_FUNC_INT_EM_TABLE:
rc = ulp_mapper_em_tbl_process(parms, tbl);
break;
case BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE:
case BNXT_ULP_RESOURCE_FUNC_TCAM_TABLE:
rc = ulp_mapper_tcam_entry_free(ulp, tfp, res);
break;
- case BNXT_ULP_RESOURCE_FUNC_EM_TABLE:
- rc = ulp_mapper_eem_entry_free(ulp, tfp, res);
+ case BNXT_ULP_RESOURCE_FUNC_EXT_EM_TABLE:
+ case BNXT_ULP_RESOURCE_FUNC_INT_EM_TABLE:
+ rc = ulp_mapper_em_entry_free(ulp, tfp, res);
break;
case BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE:
rc = ulp_mapper_index_entry_free(ulp, tfp, res);
/* Need to allocate 2 * Num flows to account for hash type bit */
mark_tbl->gfid_num_entries = dparms->mark_db_gfid_entries;
+ if (!mark_tbl->gfid_num_entries)
+ goto gfid_not_required;
+
mark_tbl->gfid_tbl = rte_zmalloc("ulp_rx_eem_flow_mark_table",
mark_tbl->gfid_num_entries *
sizeof(struct bnxt_gfid_mark_info),
mark_tbl->gfid_num_entries - 1,
mark_tbl->gfid_mask);
+gfid_not_required:
/* Add the mark tbl to the ulp context. */
bnxt_ulp_cntxt_ptr2_mark_db_set(ctxt, mark_tbl);
return 0;
.critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO
},
{
- .resource_func = BNXT_ULP_RESOURCE_FUNC_EM_TABLE,
+ .resource_func = BNXT_ULP_RESOURCE_FUNC_EXT_EM_TABLE,
.resource_type = TF_MEM_EXTERNAL,
.resource_sub_type =
BNXT_ULP_RESOURCE_SUB_TYPE_NOT_USED,
.critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO
},
{
- .resource_func = BNXT_ULP_RESOURCE_FUNC_EM_TABLE,
+ .resource_func = BNXT_ULP_RESOURCE_FUNC_EXT_EM_TABLE,
.resource_type = TF_MEM_EXTERNAL,
.resource_sub_type =
BNXT_ULP_RESOURCE_SUB_TYPE_NOT_USED,
.critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO
},
{
- .resource_func = BNXT_ULP_RESOURCE_FUNC_EM_TABLE,
+ .resource_func = BNXT_ULP_RESOURCE_FUNC_EXT_EM_TABLE,
.resource_type = TF_MEM_EXTERNAL,
.resource_sub_type =
BNXT_ULP_RESOURCE_SUB_TYPE_NOT_USED,
};
enum bnxt_ulp_glb_regfile_index {
- BNXT_ULP_GLB_REGFILE_INDEX_GLB_PROF_FUNC_ID = 0,
- BNXT_ULP_GLB_REGFILE_INDEX_GLB_L2_CNTXT_ID = 1,
- BNXT_ULP_GLB_REGFILE_INDEX_GLB_LOOPBACK_AREC_INDEX = 2,
- BNXT_ULP_GLB_REGFILE_INDEX_LAST = 3
+ BNXT_ULP_GLB_REGFILE_INDEX_NOT_USED = 0,
+ BNXT_ULP_GLB_REGFILE_INDEX_GLB_PROF_FUNC_ID = 1,
+ BNXT_ULP_GLB_REGFILE_INDEX_GLB_L2_CNTXT_ID = 2,
+ BNXT_ULP_GLB_REGFILE_INDEX_GLB_LB_AREC_PTR = 3,
+ BNXT_ULP_GLB_REGFILE_INDEX_LAST = 4
};
enum bnxt_ulp_hdr_type {
enum bnxt_ulp_resource_func {
BNXT_ULP_RESOURCE_FUNC_INVALID = 0x00,
- BNXT_ULP_RESOURCE_FUNC_EM_TABLE = 0x20,
- BNXT_ULP_RESOURCE_FUNC_RSVD1 = 0x40,
+ BNXT_ULP_RESOURCE_FUNC_EXT_EM_TABLE = 0x20,
+ BNXT_ULP_RESOURCE_FUNC_INT_EM_TABLE = 0x40,
BNXT_ULP_RESOURCE_FUNC_RSVD2 = 0x60,
BNXT_ULP_RESOURCE_FUNC_TCAM_TABLE = 0x80,
BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE = 0x81,
.mark_db_gfid_entries = 65536,
.flow_count_db_entries = 16384,
.num_resources_per_flow = 8,
- .num_phy_ports = 2
+ .num_phy_ports = 2,
+ .ext_cntr_table_type = 0,
+ .byte_count_mask = 0x00000003ffffffff,
+ .packet_count_mask = 0xfffffffc00000000,
+ .byte_count_shift = 0,
+ .packet_count_shift = 36
}
};
uint64_t flow_db_num_entries;
uint32_t flow_count_db_entries;
uint32_t num_resources_per_flow;
+ uint32_t ext_cntr_table_type;
+ uint64_t byte_count_mask;
+ uint64_t packet_count_mask;
+ uint32_t byte_count_shift;
+ uint32_t packet_count_shift;
};
/* Flow Mapper */