#include "tf_util.h"
#include "ulp_template_db_tbl.h"
#include "ulp_port_db.h"
+#include "ulp_ha_mgr.h"
+#include "bnxt_tf_pmd_shim.h"
+
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+#include "ulp_template_debug_proto.h"
+#include "ulp_tf_debug.h"
+#endif
static uint8_t mapper_fld_zeros[16] = { 0 };
struct tf *tfp;
int32_t rc = 0;
- tfp = bnxt_ulp_cntxt_tfp_get(ulp_ctx);
+ tfp = bnxt_ulp_cntxt_tfp_get(ulp_ctx, BNXT_ULP_SHARED_SESSION_NO);
if (!tfp)
return -EINVAL;
tf_free_identifier(tfp, &fparms);
return rc;
}
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG_MAPPER
+ BNXT_TF_DBG(DEBUG, "Allocated Glb Res Ident [%s][%d][%d] = 0x%04x\n",
+ tf_dir_2_str(iparms.dir),
+ glb_res->glb_regfile_index, iparms.ident_type, iparms.id);
+#endif
+#endif
return rc;
}
uint32_t tbl_scope_id;
int32_t rc = 0;
- tfp = bnxt_ulp_cntxt_tfp_get(ulp_ctx);
+ tfp = bnxt_ulp_cntxt_tfp_get(ulp_ctx, BNXT_ULP_SHARED_SESSION_NO);
if (!tfp)
return -EINVAL;
aparms.type = glb_res->resource_type;
aparms.dir = glb_res->direction;
- aparms.search_enable = 0;
aparms.tbl_scope_id = tbl_scope_id;
/* Allocate the index tbl using tf api */
rc = tf_alloc_tbl_entry(tfp, &aparms);
if (rc) {
- BNXT_TF_DBG(ERR, "Failed to alloc identifier [%s][%d]\n",
+ BNXT_TF_DBG(ERR, "Failed to alloc index table [%s][%d]\n",
tf_dir_2_str(aparms.dir), aparms.type);
return rc;
}
tf_free_tbl_entry(tfp, &free_parms);
return rc;
}
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG_MAPPER
+ BNXT_TF_DBG(DEBUG, "Allocated Glb Res Index [%s][%d][%d] = 0x%04x\n",
+ tf_dir_2_str(aparms.dir),
+ glb_res->glb_regfile_index, aparms.type, aparms.idx);
+#endif
+#endif
return rc;
}
}
static inline int32_t
-ulp_mapper_tcam_entry_free(struct bnxt_ulp_context *ulp __rte_unused,
+ulp_mapper_tcam_entry_free(struct bnxt_ulp_context *ulp,
struct tf *tfp,
struct ulp_flow_db_res_params *res)
{
.idx = (uint16_t)res->resource_hndl
};
+ /* If HA is enabled, we may have to remap the TF Type */
+ if (bnxt_ulp_cntxt_ha_enabled(ulp)) {
+ enum ulp_ha_mgr_region region;
+ int32_t rc;
+
+ switch (res->resource_type) {
+ case TF_TCAM_TBL_TYPE_WC_TCAM_HIGH:
+ case TF_TCAM_TBL_TYPE_WC_TCAM_LOW:
+ rc = ulp_ha_mgr_region_get(ulp, ®ion);
+ if (rc)
+ /* Log this, but assume region is correct */
+ BNXT_TF_DBG(ERR,
+ "Unable to get HA region (%d)\n",
+ rc);
+ else
+ fparms.tcam_tbl_type =
+ (region == ULP_HA_REGION_LOW) ?
+ TF_TCAM_TBL_TYPE_WC_TCAM_LOW :
+ TF_TCAM_TBL_TYPE_WC_TCAM_HIGH;
+ break;
+ default:
+ break;
+ }
+ }
return tf_free_tcam_entry(tfp, &fparms);
}
uint32_t parent_fid,
struct ulp_flow_db_res_params *res)
{
- uint32_t idx, child_fid = 0, parent_idx;
- struct bnxt_ulp_flow_db *flow_db;
+ uint32_t pc_idx;
- parent_idx = (uint32_t)res->resource_hndl;
+ pc_idx = (uint32_t)res->resource_hndl;
- /* check the validity of the parent fid */
- if (ulp_flow_db_parent_flow_idx_get(ulp, parent_fid, &idx) ||
- idx != parent_idx) {
- BNXT_TF_DBG(ERR, "invalid parent flow id %x\n", parent_fid);
- return -EINVAL;
- }
-
- /* Clear all the child flows parent index */
- flow_db = bnxt_ulp_cntxt_ptr2_flow_db_get(ulp);
- while (!ulp_flow_db_parent_child_flow_next_entry_get(flow_db, idx,
- &child_fid)) {
- /* update the child flows resource handle */
- if (ulp_flow_db_child_flow_reset(ulp, BNXT_ULP_FDB_TYPE_REGULAR,
- child_fid)) {
- BNXT_TF_DBG(ERR, "failed to reset child flow %x\n",
- child_fid);
- return -EINVAL;
- }
- }
-
- /* free the parent entry in the parent table flow */
- if (ulp_flow_db_parent_flow_free(ulp, parent_fid)) {
- BNXT_TF_DBG(ERR, "failed to free parent flow %x\n", parent_fid);
+ /* reset the child flow bitset*/
+ if (ulp_flow_db_pc_db_parent_flow_set(ulp, pc_idx, parent_fid, 0)) {
+ BNXT_TF_DBG(ERR, "error in reset parent flow bitset %x:%x\n",
+ pc_idx, parent_fid);
return -EINVAL;
}
return 0;
uint32_t child_fid,
struct ulp_flow_db_res_params *res)
{
- uint32_t parent_fid;
+ uint32_t pc_idx;
- parent_fid = (uint32_t)res->resource_hndl;
- if (!parent_fid)
- return 0; /* Already freed - orphan child*/
+ pc_idx = (uint32_t)res->resource_hndl;
/* reset the child flow bitset*/
- if (ulp_flow_db_parent_child_flow_set(ulp, parent_fid, child_fid, 0)) {
+ if (ulp_flow_db_pc_db_child_flow_set(ulp, pc_idx, child_fid, 0)) {
BNXT_TF_DBG(ERR, "error in resetting child flow bitset %x:%x\n",
- parent_fid, child_fid);
+ pc_idx, child_fid);
return -EINVAL;
}
return 0;
struct tf *tfp;
int rc;
- tfp = bnxt_ulp_cntxt_tfp_get(parms->ulp_ctx);
+ tfp = bnxt_ulp_cntxt_tfp_get(parms->ulp_ctx, tbl->shared_session);
if (!tfp) {
BNXT_TF_DBG(ERR, "Failed to get tf pointer\n");
return -EINVAL;
tf_ident_2_str(iparms.ident_type));
return rc;
}
+ BNXT_TF_INF("Alloc ident %s:%s.success.\n",
+ tf_dir_2_str(iparms.dir),
+ tf_ident_2_str(iparms.ident_type));
id = (uint64_t)tfp_cpu_to_be_64(iparms.id);
if (ulp_regfile_write(parms->regfile, idx, id)) {
fid_parms.resource_type = ident->ident_type;
fid_parms.resource_hndl = iparms.id;
fid_parms.critical_resource = tbl->critical_resource;
+ ulp_flow_db_shared_session_set(&fid_parms, tbl->shared_session);
rc = ulp_mapper_fdb_opc_process(parms, tbl, &fid_parms);
if (rc) {
} else {
*val = iparms.id;
}
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG_MAPPER
+ ulp_mapper_ident_field_dump("Ident", ident, tbl, iparms.id);
+#endif
+#endif
return 0;
error:
int rc;
/* Get the tfp from ulp context */
- tfp = bnxt_ulp_cntxt_tfp_get(parms->ulp_ctx);
+ tfp = bnxt_ulp_cntxt_tfp_get(parms->ulp_ctx, tbl->shared_session);
if (!tfp) {
BNXT_TF_DBG(ERR, "Failed to get tf pointer\n");
return -EINVAL;
sparms.search_id);
return rc;
}
+ BNXT_TF_INF("Search ident %s:%s:%x.success.\n",
+ tf_dir_2_str(sparms.dir),
+ tf_tbl_type_2_str(sparms.ident_type),
+ sparms.search_id);
/* Write it to the regfile */
id = (uint64_t)tfp_cpu_to_be_64(sparms.search_id);
fid_parms.resource_type = ident->ident_type;
fid_parms.resource_hndl = sparms.search_id;
fid_parms.critical_resource = tbl->critical_resource;
+ ulp_flow_db_shared_session_set(&fid_parms, tbl->shared_session);
+
rc = ulp_mapper_fdb_opc_process(parms, tbl, &fid_parms);
if (rc) {
BNXT_TF_DBG(ERR, "Failed to link res to flow rc = %d\n",
goto error;
}
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG_MAPPER
+ ulp_mapper_ident_field_dump("Ident", ident, tbl, sparms.search_id);
+#endif
+#endif
return 0;
error:
return -EINVAL;
}
buffer = (uint8_t *)&parms->comp_fld[idx];
- *val = &buffer[sizeof(uint32_t) - bytelen];
+ *val = &buffer[sizeof(uint64_t) - bytelen];
*value = ULP_COMP_FLD_IDX_RD(parms, idx);
break;
case BNXT_ULP_FIELD_SRC_RF:
break;
}
- return rc;
+ if (!rc) {
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG_MAPPER
+ if (fld->field_src1 != BNXT_ULP_FIELD_SRC_ZERO)
+ ulp_mapper_field_dump(name, fld, blob, write_idx, val,
+ val_len);
+#endif
+#endif
+ return rc;
+ }
error:
BNXT_TF_DBG(ERR, "Error in %s:%s process %u:%u\n", name,
fld->description, (val) ? write_idx : 0, val_len);
}
/* if encap bit swap is enabled perform the bit swap */
- if (parms->device_params->encap_byte_swap && encap_flds)
+ if (parms->device_params->encap_byte_swap && encap_flds) {
ulp_blob_perform_encap_swap(data);
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG_MAPPER
+ BNXT_TF_DBG(INFO, "Dump after encap swap\n");
+ ulp_mapper_blob_dump(data);
+#endif
+#endif
+ }
return rc;
}
fid_parms.critical_resource = tbl->critical_resource;
fid_parms.resource_type = mark_flag;
fid_parms.resource_hndl = gfid;
+ ulp_flow_db_shared_session_set(&fid_parms, tbl->shared_session);
+
rc = ulp_mapper_fdb_opc_process(parms, tbl, &fid_parms);
if (rc)
BNXT_TF_DBG(ERR, "Fail to link res to flow rc = %d\n", rc);
fid_parms.critical_resource = tbl->critical_resource;
fid_parms.resource_type = mark_flag;
fid_parms.resource_hndl = act_idx;
+ ulp_flow_db_shared_session_set(&fid_parms, tbl->shared_session);
+
rc = ulp_mapper_fdb_opc_process(parms, tbl, &fid_parms);
if (rc)
BNXT_TF_DBG(ERR, "Fail to link res to flow rc = %d\n", rc);
fid_parms.critical_resource = tbl->critical_resource;
fid_parms.resource_type = mark_flag;
fid_parms.resource_hndl = act_idx;
+ ulp_flow_db_shared_session_set(&fid_parms, tbl->shared_session);
+
rc = ulp_mapper_fdb_opc_process(parms, tbl, &fid_parms);
if (rc)
BNXT_TF_DBG(ERR, "Fail to link res to flow rc = %d\n", rc);
uint16_t tmplen;
int32_t rc;
- tfp = bnxt_ulp_cntxt_tfp_get(parms->ulp_ctx);
+ tfp = bnxt_ulp_cntxt_tfp_get(parms->ulp_ctx, tbl->shared_session);
if (!tfp) {
BNXT_TF_DBG(ERR, "Failed to get truflow pointer\n");
return -EINVAL;
tf_dir_2_str(sparms.dir), sparms.idx);
return -EIO;
}
+ BNXT_TF_INF("tcam[%s][%s][%x] write success.\n",
+ tf_tcam_tbl_2_str(sparms.tcam_tbl_type),
+ tf_dir_2_str(sparms.dir), sparms.idx);
/* Mark action */
rc = ulp_mapper_mark_act_ptr_process(parms, tbl);
return rc;
}
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG_MAPPER
+ ulp_mapper_tcam_entry_dump("TCAM", idx, tbl, key, mask, data);
+#endif
+#endif
return rc;
}
{
ulp_blob_perform_64B_word_swap(blob);
ulp_blob_perform_64B_byte_swap(blob);
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG_MAPPER
+ BNXT_TF_DBG(INFO, "Dump after wc tcam post process\n");
+ ulp_mapper_blob_dump(blob);
+#endif
+#endif
}
static int32_t
return 0;
}
- tfp = bnxt_ulp_cntxt_tfp_get(parms->ulp_ctx);
+ tfp = bnxt_ulp_cntxt_tfp_get(parms->ulp_ctx, tbl->shared_session);
if (!tfp) {
BNXT_TF_DBG(ERR, "Failed to get truflow pointer\n");
return -EINVAL;
}
+ /* If only allocation of identifier then perform and exit */
+ if (tbl->tbl_opcode == BNXT_ULP_TCAM_TBL_OPC_ALLOC_IDENT) {
+ rc = ulp_mapper_tcam_tbl_scan_ident_alloc(parms, tbl);
+ return rc;
+ }
+
kflds = ulp_mapper_key_fields_get(parms, tbl, &num_kflds);
if (!kflds || !num_kflds) {
BNXT_TF_DBG(ERR, "Failed to get key fields\n");
}
/* For wild card tcam perform the post process to swap the blob */
- if (tbl->resource_type == TF_TCAM_TBL_TYPE_WC_TCAM) {
+ if (tbl->resource_type == TF_TCAM_TBL_TYPE_WC_TCAM ||
+ tbl->resource_type == TF_TCAM_TBL_TYPE_WC_TCAM_HIGH ||
+ tbl->resource_type == TF_TCAM_TBL_TYPE_WC_TCAM_LOW) {
if (dparms->dynamic_pad_en) {
/* Sets up the slices for writing to the WC TCAM */
rc = ulp_mapper_wc_tcam_tbl_dyn_post_process(dparms,
fid_parms.resource_type = tbl->resource_type;
fid_parms.critical_resource = tbl->critical_resource;
fid_parms.resource_hndl = idx;
+ ulp_flow_db_shared_session_set(&fid_parms, tbl->shared_session);
+
rc = ulp_mapper_fdb_opc_process(parms, tbl, &fid_parms);
if (rc) {
BNXT_TF_DBG(ERR, "Failed to link resource to flow rc = %d\n",
struct ulp_blob key, data;
uint32_t i, num_kflds;
uint16_t tmplen;
- struct tf *tfp = bnxt_ulp_cntxt_tfp_get(parms->ulp_ctx);
+ struct tf *tfp;
struct ulp_flow_db_res_params fid_parms = { 0 };
struct tf_insert_em_entry_parms iparms = { 0 };
struct tf_delete_em_entry_parms free_parms = { 0 };
int32_t rc = 0;
int32_t pad = 0;
+ tfp = bnxt_ulp_cntxt_tfp_get(parms->ulp_ctx, tbl->shared_session);
rc = bnxt_ulp_cntxt_mem_type_get(parms->ulp_ctx, &mtype);
if (rc) {
BNXT_TF_DBG(ERR, "Failed to get the mem type for EM\n");
BNXT_TF_DBG(ERR, "Failed to build the result blob\n");
return rc;
}
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG_MAPPER
+ ulp_mapper_result_dump("EM Result", tbl, &data);
+#endif
+#endif
if (dparms->dynamic_pad_en) {
uint32_t abits = dparms->em_blk_align_bits;
ulp_blob_pad_align(&data, abits);
ulp_blob_perform_byte_reverse(&data, ULP_BITS_2_BYTE(abits));
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG_MAPPER
+ ulp_mapper_result_dump("EM Merged Result", tbl, &data);
+#endif
+#endif
}
/* do the transpose for the internal EM keys */
}
tmplen = ulp_blob_data_len_get(&key);
ulp_blob_perform_byte_reverse(&key, ULP_BITS_2_BYTE(tmplen));
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG_MAPPER
+ ulp_mapper_result_dump("EM Key Transpose", tbl, &key);
+#endif
+#endif
}
rc = bnxt_ulp_cntxt_tbl_scope_id_get(parms->ulp_ctx,
return rc;
}
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG_MAPPER
+ ulp_mapper_em_dump("EM", &key, &data, &iparms);
+ /* tf_dump_tables(tfp, iparms.tbl_scope_id); */
+#endif
+#endif
/* Mark action process */
if (mtype == BNXT_ULP_FLOW_MEM_TYPE_EXT &&
tbl->resource_type == TF_MEM_EXTERNAL)
struct tf_get_tbl_entry_parms gparms = { 0 };
struct tf_free_tbl_entry_parms free_parms = { 0 };
uint32_t tbl_scope_id;
- struct tf *tfp = bnxt_ulp_cntxt_tfp_get(parms->ulp_ctx);
- struct bnxt_ulp_glb_resource_info glb_res;
+ struct tf *tfp;
+ struct bnxt_ulp_glb_resource_info glb_res = { 0 };
uint16_t bit_size;
bool alloc = false;
bool write = false;
uint64_t act_rec_size;
bool shared = false;
+ tfp = bnxt_ulp_cntxt_tfp_get(parms->ulp_ctx, tbl->shared_session);
/* use the max size if encap is enabled */
if (tbl->encap_num_fields)
bit_size = BNXT_ULP_FLMP_BLOB_SIZE_IN_BITS;
sparms.idx, rc);
goto error;
}
+ BNXT_TF_INF("Index table[%s][%s][%x] write successful.\n",
+ tf_tbl_type_2_str(sparms.type),
+ tf_dir_2_str(sparms.dir), sparms.idx);
/* Calculate action record size */
if (tbl->resource_type == TF_TBL_TYPE_EXT) {
fid_parms.resource_sub_type = tbl->resource_sub_type;
fid_parms.resource_hndl = index;
fid_parms.critical_resource = tbl->critical_resource;
+ ulp_flow_db_shared_session_set(&fid_parms, tbl->shared_session);
rc = ulp_mapper_fdb_opc_process(parms, tbl, &fid_parms);
if (rc) {
int32_t rc = 0;
struct tf_set_if_tbl_entry_parms iftbl_params = { 0 };
struct tf_get_if_tbl_entry_parms get_parms = { 0 };
- struct tf *tfp = bnxt_ulp_cntxt_tfp_get(parms->ulp_ctx);
+ struct tf *tfp;
enum bnxt_ulp_if_tbl_opc if_opc = tbl->tbl_opcode;
uint32_t res_size;
+ tfp = bnxt_ulp_cntxt_tfp_get(parms->ulp_ctx, tbl->shared_session);
/* Initialize the blob data */
if (!ulp_blob_init(&data, tbl->result_bit_size,
parms->device_params->byte_order)) {
iftbl_params.idx, rc);
return rc;
}
+ BNXT_TF_INF("Set table[%s][%s][%x] success.\n",
+ tf_if_tbl_2_str(iftbl_params.type),
+ tf_dir_2_str(iftbl_params.dir),
+ iftbl_params.idx);
/*
* TBD: Need to look at the need to store idx in flow db for restore
struct ulp_flow_db_res_params fid_parms;
struct ulp_mapper_gen_tbl_entry gen_tbl_ent, *g;
struct ulp_gen_hash_entry_params hash_entry;
- uint16_t tmplen;
+ uint16_t tmplen = 0;
struct ulp_blob key, data;
uint8_t *cache_key;
int32_t tbl_idx;
/* The_key is a byte array convert it to a search index */
cache_key = ulp_blob_data_get(&key, &tmplen);
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG_MAPPER
+ BNXT_TF_DBG(DEBUG, "The gen_tbl[%u] key\n", tbl_idx);
+ ulp_mapper_blob_dump(&key);
+#endif
+#endif
/* get the generic table */
gen_tbl_list = &parms->mapper_data->gen_tbl_list[tbl_idx];
}
} else {
/* convert key to index directly */
+ if (ULP_BITS_2_BYTE(tmplen) > (int32_t)sizeof(key_index)) {
+ BNXT_TF_DBG(ERR, "%s: keysize is bigger then 4 bytes\n",
+ gen_tbl_list->gen_tbl_name);
+ return -EINVAL;
+ }
memcpy(&key_index, cache_key, ULP_BITS_2_BYTE(tmplen));
/* Get the generic table entry */
if (ulp_mapper_gen_tbl_entry_get(gen_tbl_list, key_index,
fid_parms.resource_sub_type = tbl->resource_sub_type;
fid_parms.resource_hndl = key_index;
fid_parms.critical_resource = tbl->critical_resource;
+ ulp_flow_db_shared_session_set(&fid_parms, tbl->shared_session);
+
rc = ulp_mapper_fdb_opc_process(parms, tbl, &fid_parms);
if (rc)
BNXT_TF_DBG(ERR, "Fail to add gen ent flowdb %d\n", rc);
ulp_mapper_app_glb_resource_info_init(struct bnxt_ulp_context *ulp_ctx,
struct bnxt_ulp_mapper_data *mapper_data)
{
+ struct tf_get_shared_tbl_increment_parms iparms;
struct bnxt_ulp_glb_resource_info *glb_res;
struct tf_get_session_info_parms sparms;
uint32_t num_entries, i, dev_id, res;
struct tf_resource_info *res_info;
+ uint32_t addend;
uint64_t regval;
enum tf_dir dir;
int32_t rc = 0;
uint8_t app_id;
memset(&sparms, 0, sizeof(sparms));
-
glb_res = bnxt_ulp_app_glb_resource_info_list_get(&num_entries);
if (!glb_res || !num_entries) {
BNXT_TF_DBG(ERR, "Invalid Arguments\n");
return -EINVAL;
}
-
tfp = bnxt_ulp_cntxt_shared_tfp_get(ulp_ctx);
if (!tfp) {
BNXT_TF_DBG(ERR, "Failed to get tfp for app global init");
continue;
dir = glb_res[i].direction;
res = glb_res[i].resource_type;
+ addend = 1;
switch (glb_res[i].resource_func) {
case BNXT_ULP_RESOURCE_FUNC_IDENTIFIER:
res_info = &sparms.session_info.ident[dir].info[res];
break;
case BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE:
+ /*
+ * Tables may have various strides for the allocations.
+ * Need to account.
+ */
+ memset(&iparms, 0, sizeof(iparms));
+ iparms.dir = dir;
+ iparms.type = res;
+ rc = tf_get_shared_tbl_increment(tfp, &iparms);
+ if (rc) {
+ BNXT_TF_DBG(ERR,
+ "Failed to get addend for %s[%s] rc=(%d)\n",
+ tf_tbl_type_2_str(res),
+ tf_dir_2_str(dir), rc);
+ return rc;
+ }
+ addend = iparms.increment_cnt;
res_info = &sparms.session_info.tbl[dir].info[res];
break;
case BNXT_ULP_RESOURCE_FUNC_TCAM_TABLE:
glb_res[i].resource_func);
continue;
}
-
regval = tfp_cpu_to_be_64((uint64_t)res_info->start);
- res_info->start++;
-
+ res_info->start += addend;
/*
* All resources written to the global regfile are shared for
* this function.
}
static int32_t
-ulp_mapper_cc_upd_opr_compute(struct bnxt_ulp_mapper_parms *parms,
- enum tf_dir dir,
- enum bnxt_ulp_cc_upd_src cc_src,
- uint16_t cc_opr,
- uint64_t *result)
+ulp_mapper_func_opr_compute(struct bnxt_ulp_mapper_parms *parms,
+ enum tf_dir dir,
+ enum bnxt_ulp_func_src func_src,
+ uint16_t func_opr,
+ uint64_t *result)
{
uint64_t regval;
bool shared;
*result = false;
- switch (cc_src) {
- case BNXT_ULP_CC_UPD_SRC_COMP_FIELD:
- if (cc_opr >= BNXT_ULP_CF_IDX_LAST) {
- BNXT_TF_DBG(ERR, "invalid index %u\n", cc_opr);
+ switch (func_src) {
+ case BNXT_ULP_FUNC_SRC_COMP_FIELD:
+ if (func_opr >= BNXT_ULP_CF_IDX_LAST) {
+ BNXT_TF_DBG(ERR, "invalid index %u\n", func_opr);
return -EINVAL;
}
- *result = (uint64_t)ULP_COMP_FLD_IDX_RD(parms, cc_opr);
+ *result = ULP_COMP_FLD_IDX_RD(parms, func_opr);
break;
- case BNXT_ULP_CC_UPD_SRC_REGFILE:
- if (!ulp_regfile_read(parms->regfile, cc_opr, ®val)) {
- BNXT_TF_DBG(ERR, "regfile[%d] read oob\n", cc_opr);
+ case BNXT_ULP_FUNC_SRC_REGFILE:
+ if (!ulp_regfile_read(parms->regfile, func_opr, ®val)) {
+ BNXT_TF_DBG(ERR, "regfile[%d] read oob\n", func_opr);
return -EINVAL;
}
*result = tfp_be_to_cpu_64(regval);
break;
- case BNXT_ULP_CC_UPD_SRC_GLB_REGFILE:
+ case BNXT_ULP_FUNC_SRC_GLB_REGFILE:
if (ulp_mapper_glb_resource_read(parms->mapper_data, dir,
- cc_opr, ®val, &shared)) {
+ func_opr, ®val, &shared)) {
BNXT_TF_DBG(ERR, "global regfile[%d] read failed.\n",
- cc_opr);
+ func_opr);
return -EINVAL;
}
*result = tfp_be_to_cpu_64(regval);
break;
- case BNXT_ULP_CC_UPD_SRC_CONST:
- *result = cc_opr;
+ case BNXT_ULP_FUNC_SRC_CONST:
+ *result = func_opr;
break;
default:
- BNXT_TF_DBG(ERR, "invalid src code %u\n", cc_src);
+ BNXT_TF_DBG(ERR, "invalid src code %u\n", func_src);
return -EINVAL;
}
return 0;
}
static int32_t
-ulp_mapper_cc_upd_info_process(struct bnxt_ulp_mapper_parms *parms,
- struct bnxt_ulp_mapper_tbl_info *tbl)
+ulp_mapper_func_info_process(struct bnxt_ulp_mapper_parms *parms,
+ struct bnxt_ulp_mapper_tbl_info *tbl)
{
- struct bnxt_ulp_mapper_cc_upd_info *cc_upd = &tbl->cc_upd_info;
- uint64_t res = 0, res1, res2;
+ struct bnxt_ulp_mapper_func_info *func_info = &tbl->func_info;
+ uint64_t res = 0, res1 = 0, res2 = 0;
int32_t rc = 0;
+ uint32_t process_src1 = 0, process_src2 = 0;
- if (cc_upd->cc_opc == BNXT_ULP_CC_UPD_OPC_NOP)
+ /* determine which functional operands to compute */
+ switch (func_info->func_opc) {
+ case BNXT_ULP_FUNC_OPC_NOP:
return rc;
+ case BNXT_ULP_FUNC_OPC_EQ:
+ case BNXT_ULP_FUNC_OPC_NE:
+ case BNXT_ULP_FUNC_OPC_GE:
+ case BNXT_ULP_FUNC_OPC_GT:
+ case BNXT_ULP_FUNC_OPC_LE:
+ case BNXT_ULP_FUNC_OPC_LT:
+ process_src1 = 1;
+ process_src2 = 1;
+ break;
+ case BNXT_ULP_FUNC_OPC_COPY_SRC1_TO_RF:
+ process_src1 = 1;
+ break;
+ default:
+ break;
+ }
- rc = ulp_mapper_cc_upd_opr_compute(parms, tbl->direction,
- cc_upd->cc_src1,
- cc_upd->cc_opr1, &res1);
- if (rc)
- return rc;
+ if (process_src1) {
+ rc = ulp_mapper_func_opr_compute(parms, tbl->direction,
+ func_info->func_src1,
+ func_info->func_opr1, &res1);
+ if (rc)
+ return rc;
+ }
- rc = ulp_mapper_cc_upd_opr_compute(parms, tbl->direction,
- cc_upd->cc_src2,
- cc_upd->cc_opr2, &res2);
- if (rc)
- return rc;
+ if (process_src2) {
+ rc = ulp_mapper_func_opr_compute(parms, tbl->direction,
+ func_info->func_src2,
+ func_info->func_opr2, &res2);
+ if (rc)
+ return rc;
+ }
- switch (cc_upd->cc_opc) {
- case BNXT_ULP_CC_UPD_OPC_NOP:
- res = 1;
- break;
- case BNXT_ULP_CC_UPD_OPC_EQ:
+ /* perform the functional opcode operations */
+ switch (func_info->func_opc) {
+ case BNXT_ULP_FUNC_OPC_EQ:
if (res1 == res2)
res = 1;
break;
- case BNXT_ULP_CC_UPD_OPC_NE:
+ case BNXT_ULP_FUNC_OPC_NE:
if (res1 != res2)
res = 1;
break;
- case BNXT_ULP_CC_UPD_OPC_GE:
+ case BNXT_ULP_FUNC_OPC_GE:
if (res1 >= res2)
res = 1;
break;
- case BNXT_ULP_CC_UPD_OPC_GT:
+ case BNXT_ULP_FUNC_OPC_GT:
if (res1 > res2)
res = 1;
break;
- case BNXT_ULP_CC_UPD_OPC_LE:
+ case BNXT_ULP_FUNC_OPC_LE:
if (res1 <= res2)
res = 1;
break;
- case BNXT_ULP_CC_UPD_OPC_LT:
+ case BNXT_ULP_FUNC_OPC_LT:
if (res1 < res2)
res = 1;
break;
- case BNXT_ULP_CC_UPD_OPC_LAST:
- BNXT_TF_DBG(ERR, "invalid code %u\n", cc_upd->cc_opc);
+ case BNXT_ULP_FUNC_OPC_COPY_SRC1_TO_RF:
+ res = res1;
+ break;
+ case BNXT_ULP_FUNC_OPC_RSS_CONFIG:
+ /* apply the rss config using pmd method */
+ return bnxt_rss_config_action_apply(parms);
+ case BNXT_ULP_FUNC_OPC_GET_PARENT_MAC_ADDR:
+ rc = bnxt_pmd_get_parent_mac_addr(parms, (uint8_t *)&res);
+ if (rc)
+ return -EINVAL;
+ res = tfp_be_to_cpu_64(res);
+ break;
+ default:
+ BNXT_TF_DBG(ERR, "invalid func code %u\n", func_info->func_opc);
return -EINVAL;
}
- if (ulp_regfile_write(parms->regfile, cc_upd->cc_dst_opr,
+ if (ulp_regfile_write(parms->regfile, func_info->func_dst_opr,
tfp_cpu_to_be_64(res))) {
- BNXT_TF_DBG(ERR, "Failed write the cc_opc %u\n",
- cc_upd->cc_dst_opr);
+ BNXT_TF_DBG(ERR, "Failed write the func_opc %u\n",
+ func_info->func_dst_opr);
return -EINVAL;
}
{
int32_t rc = 0;
uint64_t regval;
- uint64_t comp_sig_id;
+ uint64_t comp_sig;
*res = 0;
switch (tbl->accept_opcode) {
BNXT_ULP_RF_IDX_FLOW_SIG_ID);
return -EINVAL;
}
- comp_sig_id = ULP_COMP_FLD_IDX_RD(parms,
- BNXT_ULP_CF_IDX_FLOW_SIG_ID);
+ comp_sig = ULP_COMP_FLD_IDX_RD(parms,
+ BNXT_ULP_CF_IDX_FLOW_SIG_ID);
regval = tfp_be_to_cpu_64(regval);
- if (comp_sig_id == regval)
+ if (comp_sig == regval)
*res = 1;
else
- BNXT_TF_DBG(ERR, "failed signature match %x:%x\n",
- (uint32_t)comp_sig_id, (uint32_t)regval);
+ BNXT_TF_DBG(ERR, "failed signature match 0x%016"
+ PRIX64 ":%x\n", comp_sig, (uint32_t)regval);
break;
default:
BNXT_TF_DBG(ERR, "Invalid accept opcode %d\n",
for (tbl_idx = 0; tbl_idx < num_tbls && cond_goto;) {
tbl = &tbls[tbl_idx];
- /* Process the conditional code update opcodes */
- if (ulp_mapper_cc_upd_info_process(parms, tbl)) {
+ cond_goto = tbl->execute_info.cond_true_goto;
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG_MAPPER
+ ulp_mapper_table_dump(tbl, tbl_idx);
+#endif
+#endif
+ /* Process the conditional func code opcodes */
+ if (ulp_mapper_func_info_process(parms, tbl)) {
BNXT_TF_DBG(ERR, "Failed to process cond update\n");
rc = -EINVAL;
goto error;
BNXT_TF_DBG(ERR, "Unable to free resource\n ");
return -EINVAL;
}
-
- tfp = bnxt_ulp_cntxt_tfp_get(ulp);
+ if (res->fdb_flags & ULP_FDB_FLAG_SHARED_SESSION)
+ tfp = bnxt_ulp_cntxt_tfp_get(ulp, BNXT_ULP_SHARED_SESSION_YES);
+ else
+ tfp = bnxt_ulp_cntxt_tfp_get(ulp, BNXT_ULP_SHARED_SESSION_NO);
if (!tfp) {
BNXT_TF_DBG(ERR, "Unable to free resource failed to get tfp\n");
return -EINVAL;
parms.hdr_field = cparms->hdr_field;
parms.fld_bitmap = cparms->fld_bitmap;
parms.comp_fld = cparms->comp_fld;
- parms.tfp = bnxt_ulp_cntxt_tfp_get(ulp_ctx);
parms.ulp_ctx = ulp_ctx;
parms.act_tid = cparms->act_tid;
parms.class_tid = cparms->class_tid;
parms.flow_type = cparms->flow_type;
parms.parent_flow = cparms->parent_flow;
- parms.parent_fid = cparms->parent_fid;
+ parms.child_flow = cparms->child_flow;
parms.fid = cparms->flow_id;
parms.tun_idx = cparms->tun_idx;
parms.app_priority = cparms->app_priority;
parms.flow_pattern_id = cparms->flow_pattern_id;
parms.act_pattern_id = cparms->act_pattern_id;
parms.app_id = cparms->app_id;
+ parms.port_id = cparms->port_id;
/* Get the device id from the ulp context */
if (bnxt_ulp_cntxt_dev_id_get(ulp_ctx, &parms.dev_id)) {
rc = ulp_flow_db_parent_flow_create(&parms);
if (rc)
goto flow_error;
- } else if (parms.parent_fid) {
+ } else if (parms.child_flow) {
/* create a child flow details */
rc = ulp_flow_db_child_flow_create(&parms);
if (rc)
if (!ulp_ctx)
return -EINVAL;
- tfp = bnxt_ulp_cntxt_tfp_get(ulp_ctx);
+ tfp = bnxt_ulp_cntxt_tfp_get(ulp_ctx, BNXT_ULP_SHARED_SESSION_NO);
if (!tfp)
return -EINVAL;
return;
}
- tfp = bnxt_ulp_cntxt_tfp_get(ulp_ctx);
+ tfp = bnxt_ulp_cntxt_tfp_get(ulp_ctx, BNXT_ULP_SHARED_SESSION_NO);
if (!tfp) {
BNXT_TF_DBG(ERR, "Failed to acquire tfp.\n");
/* Free the mapper data regardless of errors. */