net/bnxt: support flow template for Thor

Template adds non-VFR based support for testpmd with:
matches to include
- DMAC, SIP, DIP, Proto, Sport, Dport
- SIP, DIP, Proto, Sport, Dport
actions:
- count, drop

Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Mike Baucom <michael.baucom@broadcom.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
This commit is contained in:
Kishore Padmanabha 2021-09-20 13:12:06 +05:30 committed by Ajit Khaparde
parent 37ff91c158
commit ad9eed0248
16 changed files with 348 additions and 41 deletions

View File

@ -13,6 +13,12 @@
#define BNXT_TF_DBG(lvl, fmt, args...) PMD_DRV_LOG(lvl, fmt, ## args) #define BNXT_TF_DBG(lvl, fmt, args...) PMD_DRV_LOG(lvl, fmt, ## args)
#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
#define BNXT_TF_INF(fmt, args...) PMD_DRV_LOG(INFO, fmt, ## args)
#else
#define BNXT_TF_INF(fmt, args...)
#endif
#define BNXT_ULP_EM_FLOWS 8192 #define BNXT_ULP_EM_FLOWS 8192
#define BNXT_ULP_1M_FLOWS 1000000 #define BNXT_ULP_1M_FLOWS 1000000
#define BNXT_EEM_RX_GLOBAL_ID_MASK (BNXT_ULP_1M_FLOWS - 1) #define BNXT_EEM_RX_GLOBAL_ID_MASK (BNXT_ULP_1M_FLOWS - 1)

View File

@ -698,6 +698,11 @@ ulp_eem_tbl_scope_init(struct bnxt *bp)
rc); rc);
return rc; return rc;
} }
#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
BNXT_TF_DBG(DEBUG, "TableScope=0x%0x %d\n",
params.tbl_scope_id,
params.tbl_scope_id);
#endif
rc = bnxt_ulp_cntxt_tbl_scope_id_set(bp->ulp_ctx, params.tbl_scope_id); rc = bnxt_ulp_cntxt_tbl_scope_id_set(bp->ulp_ctx, params.tbl_scope_id);
if (rc) { if (rc) {
BNXT_TF_DBG(ERR, "Unable to set table scope id\n"); BNXT_TF_DBG(ERR, "Unable to set table scope id\n");
@ -825,6 +830,8 @@ ulp_ctx_init(struct bnxt *bp,
goto error_deinit; goto error_deinit;
} }
/* TODO: For now we are overriding to APP:1 on this branch*/
bp->app_id = 1;
rc = bnxt_ulp_cntxt_app_id_set(bp->ulp_ctx, bp->app_id); rc = bnxt_ulp_cntxt_app_id_set(bp->ulp_ctx, bp->app_id);
if (rc) { if (rc) {
BNXT_TF_DBG(ERR, "Unable to set app_id for ULP init.\n"); BNXT_TF_DBG(ERR, "Unable to set app_id for ULP init.\n");
@ -838,11 +845,6 @@ ulp_ctx_init(struct bnxt *bp,
goto error_deinit; goto error_deinit;
} }
if (devid == BNXT_ULP_DEVICE_ID_THOR) {
ulp_data->ulp_flags &= ~BNXT_ULP_VF_REP_ENABLED;
BNXT_TF_DBG(ERR, "Enabled non-VFR mode\n");
}
/* /*
* Shared session must be created before first regular session but after * Shared session must be created before first regular session but after
* the ulp_ctx is valid. * the ulp_ctx is valid.
@ -902,7 +904,7 @@ ulp_dparms_init(struct bnxt *bp, struct bnxt_ulp_context *ulp_ctx)
dparms->ext_flow_db_num_entries = bp->max_num_kflows * 1024; dparms->ext_flow_db_num_entries = bp->max_num_kflows * 1024;
/* GFID = 2 * num_flows */ /* GFID = 2 * num_flows */
dparms->mark_db_gfid_entries = dparms->ext_flow_db_num_entries * 2; dparms->mark_db_gfid_entries = dparms->ext_flow_db_num_entries * 2;
BNXT_TF_DBG(DEBUG, "Set the number of flows = %"PRIu64"\n", BNXT_TF_DBG(DEBUG, "Set the number of flows = %" PRIu64 "\n",
dparms->ext_flow_db_num_entries); dparms->ext_flow_db_num_entries);
return 0; return 0;
@ -1393,17 +1395,13 @@ bnxt_ulp_port_init(struct bnxt *bp)
uint32_t ulp_flags; uint32_t ulp_flags;
int32_t rc = 0; int32_t rc = 0;
if (!bp || !BNXT_TRUFLOW_EN(bp))
return rc;
if (!BNXT_PF(bp) && !BNXT_VF_IS_TRUSTED(bp)) { if (!BNXT_PF(bp) && !BNXT_VF_IS_TRUSTED(bp)) {
BNXT_TF_DBG(ERR, BNXT_TF_DBG(ERR,
"Skip ulp init for port: %d, not a TVF or PF\n", "Skip ulp init for port: %d, not a TVF or PF\n",
bp->eth_dev->data->port_id); bp->eth_dev->data->port_id);
return rc;
}
if (!BNXT_TRUFLOW_EN(bp)) {
BNXT_TF_DBG(DEBUG,
"Skip ulp init for port: %d, truflow is not enabled\n",
bp->eth_dev->data->port_id);
return rc; return rc;
} }
@ -1524,6 +1522,9 @@ bnxt_ulp_port_deinit(struct bnxt *bp)
struct rte_pci_device *pci_dev; struct rte_pci_device *pci_dev;
struct rte_pci_addr *pci_addr; struct rte_pci_addr *pci_addr;
if (!BNXT_TRUFLOW_EN(bp))
return;
if (!BNXT_PF(bp) && !BNXT_VF_IS_TRUSTED(bp)) { if (!BNXT_PF(bp) && !BNXT_VF_IS_TRUSTED(bp)) {
BNXT_TF_DBG(ERR, BNXT_TF_DBG(ERR,
"Skip ULP deinit port:%d, not a TVF or PF\n", "Skip ULP deinit port:%d, not a TVF or PF\n",
@ -1531,13 +1532,6 @@ bnxt_ulp_port_deinit(struct bnxt *bp)
return; return;
} }
if (!BNXT_TRUFLOW_EN(bp)) {
BNXT_TF_DBG(DEBUG,
"Skip ULP deinit for port:%d, truflow is not enabled\n",
bp->eth_dev->data->port_id);
return;
}
if (!bp->ulp_ctx) { if (!bp->ulp_ctx) {
BNXT_TF_DBG(DEBUG, "ulp ctx already de-allocated\n"); BNXT_TF_DBG(DEBUG, "ulp ctx already de-allocated\n");
return; return;

View File

@ -13,6 +13,9 @@
#include "ulp_port_db.h" #include "ulp_port_db.h"
#include "ulp_ha_mgr.h" #include "ulp_ha_mgr.h"
#include <rte_malloc.h> #include <rte_malloc.h>
#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
#include "ulp_template_debug_proto.h"
#endif
static int32_t static int32_t
bnxt_ulp_flow_validate_args(const struct rte_flow_attr *attr, bnxt_ulp_flow_validate_args(const struct rte_flow_attr *attr,
@ -222,6 +225,15 @@ bnxt_ulp_flow_create(struct rte_eth_dev *dev,
else if (ret == BNXT_TF_RC_FID) else if (ret == BNXT_TF_RC_FID)
goto return_fid; goto return_fid;
#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG_PARSER
/* Dump the rte flow pattern */
ulp_parser_hdr_info_dump(&params);
/* Dump the rte flow action */
ulp_parser_act_info_dump(&params);
#endif
#endif
ret = ulp_matcher_pattern_match(&params, &params.class_id); ret = ulp_matcher_pattern_match(&params, &params.class_id);
if (ret != BNXT_TF_RC_SUCCESS) if (ret != BNXT_TF_RC_SUCCESS)
goto free_fid; goto free_fid;

View File

@ -2,7 +2,10 @@
# Copyright(c) 2018 Intel Corporation # Copyright(c) 2018 Intel Corporation
# Copyright(c) 2020 Broadcom # Copyright(c) 2020 Broadcom
#Include the folder for headers
includes += include_directories('.') includes += include_directories('.')
#Add the source files
sources += files( sources += files(
'ulp_template_db_class.c', 'ulp_template_db_class.c',
'ulp_template_db_act.c', 'ulp_template_db_act.c',

View File

@ -6104,4 +6104,3 @@ struct bnxt_ulp_mapper_ident_info ulp_thor_class_ident_list[] = {
.ident_bit_pos = 29 .ident_bit_pos = 29
} }
}; };

View File

@ -35,7 +35,7 @@ ulp_fc_mgr_shadow_mem_alloc(struct hw_fc_mem_info *parms, int size)
rte_mem_lock_page(parms->mem_va); rte_mem_lock_page(parms->mem_va);
parms->mem_pa = (void *)(uintptr_t)rte_mem_virt2phy(parms->mem_va); parms->mem_pa = (void *)(uintptr_t)rte_mem_virt2phy(parms->mem_va);
if (parms->mem_pa == (void *)(uintptr_t)RTE_BAD_IOVA) { if (parms->mem_pa == (void *)RTE_BAD_IOVA) {
BNXT_TF_DBG(ERR, "Allocate failed mem_pa\n"); BNXT_TF_DBG(ERR, "Allocate failed mem_pa\n");
return -ENOMEM; return -ENOMEM;
} }

View File

@ -116,7 +116,7 @@ ulp_flow_db_resource_func_get(struct ulp_fdb_resource_info *res_info)
func = (((res_info->nxt_resource_idx & ULP_FLOW_DB_RES_FUNC_MASK) >> func = (((res_info->nxt_resource_idx & ULP_FLOW_DB_RES_FUNC_MASK) >>
ULP_FLOW_DB_RES_FUNC_BITS) << ULP_FLOW_DB_RES_FUNC_UPPER); ULP_FLOW_DB_RES_FUNC_BITS) << ULP_FLOW_DB_RES_FUNC_UPPER);
/* The resource func is split into upper and lower */ /* The reource func is split into upper and lower */
if (func & ULP_FLOW_DB_RES_FUNC_NEED_LOWER) if (func & ULP_FLOW_DB_RES_FUNC_NEED_LOWER)
return (func | res_info->resource_func_lower); return (func | res_info->resource_func_lower);
return func; return func;
@ -654,6 +654,9 @@ ulp_flow_db_fid_alloc(struct bnxt_ulp_context *ulp_ctxt,
if (flow_type == BNXT_ULP_FDB_TYPE_REGULAR) if (flow_type == BNXT_ULP_FDB_TYPE_REGULAR)
ulp_flow_db_func_id_set(flow_db, *fid, func_id); ulp_flow_db_func_id_set(flow_db, *fid, func_id);
#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
BNXT_TF_DBG(ERR, "flow_id = %u:%u allocated\n", flow_type, *fid);
#endif
/* return success */ /* return success */
return 0; return 0;
} }
@ -766,7 +769,7 @@ ulp_flow_db_resource_add(struct bnxt_ulp_context *ulp_ctxt,
* flow_type [in] Specify it is regular or default flow * flow_type [in] Specify it is regular or default flow
* fid [in] The index to the flow entry * fid [in] The index to the flow entry
* params [in/out] The contents to be copied into params. * params [in/out] The contents to be copied into params.
* Only the critical_resource needs to be set by the caller. * Onlythe critical_resource needs to be set by the caller.
* *
* Returns 0 on success and negative on failure. * Returns 0 on success and negative on failure.
*/ */
@ -937,6 +940,9 @@ ulp_flow_db_fid_free(struct bnxt_ulp_context *ulp_ctxt,
ulp_clear_tun_inner_entry(tun_tbl, fid); ulp_clear_tun_inner_entry(tun_tbl, fid);
#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
BNXT_TF_DBG(ERR, "flow_id = %u:%u freed\n", flow_type, fid);
#endif
/* all good, return success */ /* all good, return success */
return 0; return 0;
} }
@ -1921,3 +1927,113 @@ void ulp_flow_db_shared_session_set(struct ulp_flow_db_res_params *res,
if (res && (shared & BNXT_ULP_SHARED_SESSION_YES)) if (res && (shared & BNXT_ULP_SHARED_SESSION_YES))
res->fdb_flags |= ULP_FDB_FLAG_SHARED_SESSION; res->fdb_flags |= ULP_FDB_FLAG_SHARED_SESSION;
} }
#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
/*
* Dump the entry details
*
* ulp_ctxt [in] Ptr to ulp_context
*
* returns none
*/
static void ulp_flow_db_res_dump(struct ulp_fdb_resource_info *r,
uint32_t *nxt_res)
{
uint8_t res_func = ulp_flow_db_resource_func_get(r);
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)
BNXT_TF_DBG(DEBUG, "EM Handle = 0x%016" PRIX64 "\n",
r->resource_em_handle);
else
BNXT_TF_DBG(DEBUG, "Handle = 0x%08x\n", r->resource_hndl);
*nxt_res = 0;
ULP_FLOW_DB_RES_NXT_SET(*nxt_res,
r->nxt_resource_idx);
}
/*
* Dump the flow entry details
*
* flow_db [in] Ptr to flow db
* fid [in] flow id
*
* returns none
*/
void
ulp_flow_db_debug_fid_dump(struct bnxt_ulp_flow_db *flow_db, uint32_t fid)
{
struct ulp_fdb_resource_info *r;
struct bnxt_ulp_flow_tbl *flow_tbl;
uint32_t nxt_res = 0;
uint32_t def_flag = 0, reg_flag = 0;
flow_tbl = &flow_db->flow_tbl;
if (ulp_flow_db_active_flows_bit_is_set(flow_db,
BNXT_ULP_FDB_TYPE_REGULAR, fid))
reg_flag = 1;
if (ulp_flow_db_active_flows_bit_is_set(flow_db,
BNXT_ULP_FDB_TYPE_DEFAULT, fid))
def_flag = 1;
if (reg_flag && def_flag)
BNXT_TF_DBG(DEBUG, "RID = %u\n", fid);
else if (reg_flag)
BNXT_TF_DBG(DEBUG, "Regular fid = %u and func id = %u\n",
fid, flow_db->func_id_tbl[fid]);
else if (def_flag)
BNXT_TF_DBG(DEBUG, "Default fid = %u\n", fid);
else
return;
/* iterate the resource */
nxt_res = fid;
do {
r = &flow_tbl->flow_resources[nxt_res];
ulp_flow_db_res_dump(r, &nxt_res);
} while (nxt_res);
}
/*
* Dump the flow database entry details
*
* ulp_ctxt [in] Ptr to ulp_context
* flow_id [in] if zero then all fids are dumped.
*
* returns none
*/
int32_t ulp_flow_db_debug_dump(struct bnxt_ulp_context *ulp_ctxt,
uint32_t flow_id)
{
struct bnxt_ulp_flow_db *flow_db;
struct bnxt_ulp_flow_tbl *flow_tbl;
uint32_t fid;
if (!ulp_ctxt || !ulp_ctxt->cfg_data) {
BNXT_TF_DBG(ERR, "Invalid Arguments\n");
return -EINVAL;
}
flow_db = bnxt_ulp_cntxt_ptr2_flow_db_get(ulp_ctxt);
if (!flow_db) {
BNXT_TF_DBG(ERR, "Invalid Arguments\n");
return -EINVAL;
}
flow_tbl = &flow_db->flow_tbl;
if (flow_id) {
ulp_flow_db_debug_fid_dump(flow_db, flow_id);
return 0;
}
BNXT_TF_DBG(DEBUG, "Dump flows = %u:%u\n",
flow_tbl->num_flows,
flow_tbl->num_resources);
BNXT_TF_DBG(DEBUG, "Head_index = %u, Tail_index = %u\n",
flow_tbl->head_index, flow_tbl->tail_index);
for (fid = 1; fid < flow_tbl->num_flows; fid++)
ulp_flow_db_debug_fid_dump(flow_db, fid);
BNXT_TF_DBG(DEBUG, "Done.\n");
return 0;
}
#endif

View File

@ -18,7 +18,7 @@
/* /*
* Structure for the flow database resource information * Structure for the flow database resource information
* The below structure is based on the below partitions * The below structure is based on the below paritions
* nxt_resource_idx = dir[31],resource_func_upper[30:28],nxt_resource_idx[27:0] * nxt_resource_idx = dir[31],resource_func_upper[30:28],nxt_resource_idx[27:0]
* If resource_func is EM_TBL then use resource_em_handle. * If resource_func is EM_TBL then use resource_em_handle.
* Else the other part of the union is used and * Else the other part of the union is used and
@ -417,4 +417,28 @@ ulp_flow_db_parent_flow_count_reset(struct bnxt_ulp_context *ulp_ctxt);
void ulp_flow_db_shared_session_set(struct ulp_flow_db_res_params *res, void ulp_flow_db_shared_session_set(struct ulp_flow_db_res_params *res,
enum bnxt_ulp_shared_session shared); enum bnxt_ulp_shared_session shared);
#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
/*
* Dump the flow entry details
*
* flow_db [in] Ptr to flow db
* fid [in] flow id
*
* returns none
*/
void
ulp_flow_db_debug_fid_dump(struct bnxt_ulp_flow_db *flow_db, uint32_t fid);
/*
* Dump the flow database entry details
*
* ulp_ctxt [in] Ptr to ulp_context
* flow_id [in] if zero then all fids are dumped.
*
* returns none
*/
int32_t ulp_flow_db_debug_dump(struct bnxt_ulp_context *ulp_ctxt,
uint32_t flow_id);
#endif
#endif /* _ULP_FLOW_DB_H_ */ #endif /* _ULP_FLOW_DB_H_ */

View File

@ -10,6 +10,11 @@
#include "ulp_mapper.h" #include "ulp_mapper.h"
#include "ulp_flow_db.h" #include "ulp_flow_db.h"
#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
#include "ulp_template_debug_proto.h"
#include "ulp_tf_debug.h"
#endif
/* Retrieve the generic table initialization parameters for the tbl_idx */ /* Retrieve the generic table initialization parameters for the tbl_idx */
static struct bnxt_ulp_generic_tbl_params* static struct bnxt_ulp_generic_tbl_params*
ulp_mapper_gen_tbl_params_get(uint32_t tbl_idx) ulp_mapper_gen_tbl_params_get(uint32_t tbl_idx)

View File

@ -185,7 +185,7 @@ ulp_ha_mgr_timer_cb(void *arg __rte_unused)
rc = ulp_ha_mgr_state_get(ulp_ctx, &curr_state); rc = ulp_ha_mgr_state_get(ulp_ctx, &curr_state);
if (rc) { if (rc) {
/* /*
* This shouldn't happen, if it does, reset the timer * This shouldn't happen, if it does, resetart the timer
* and try again next time. * and try again next time.
*/ */
BNXT_TF_DBG(ERR, "Failed(%d) to get state.\n", BNXT_TF_DBG(ERR, "Failed(%d) to get state.\n",

View File

@ -22,6 +22,11 @@
#include "ulp_ha_mgr.h" #include "ulp_ha_mgr.h"
#include "bnxt_tf_pmd_shim.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 }; static uint8_t mapper_fld_zeros[16] = { 0 };
static uint8_t mapper_fld_ones[16] = { static uint8_t mapper_fld_ones[16] = {
@ -156,6 +161,13 @@ ulp_mapper_resource_ident_allocate(struct bnxt_ulp_context *ulp_ctx,
tf_free_identifier(tfp, &fparms); tf_free_identifier(tfp, &fparms);
return rc; 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; return rc;
} }
@ -216,6 +228,13 @@ ulp_mapper_resource_index_tbl_alloc(struct bnxt_ulp_context *ulp_ctx,
tf_free_tbl_entry(tfp, &free_parms); tf_free_tbl_entry(tfp, &free_parms);
return rc; 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; return rc;
} }
@ -784,6 +803,9 @@ ulp_mapper_ident_process(struct bnxt_ulp_mapper_parms *parms,
tf_ident_2_str(iparms.ident_type)); tf_ident_2_str(iparms.ident_type));
return rc; 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); id = (uint64_t)tfp_cpu_to_be_64(iparms.id);
if (ulp_regfile_write(parms->regfile, idx, id)) { if (ulp_regfile_write(parms->regfile, idx, id)) {
@ -813,6 +835,11 @@ ulp_mapper_ident_process(struct bnxt_ulp_mapper_parms *parms,
} else { } else {
*val = iparms.id; *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; return 0;
error: error:
@ -877,6 +904,10 @@ ulp_mapper_ident_extract(struct bnxt_ulp_mapper_parms *parms,
sparms.search_id); sparms.search_id);
return rc; 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 */ /* Write it to the regfile */
id = (uint64_t)tfp_cpu_to_be_64(sparms.search_id); id = (uint64_t)tfp_cpu_to_be_64(sparms.search_id);
@ -904,6 +935,11 @@ ulp_mapper_ident_extract(struct bnxt_ulp_mapper_parms *parms,
goto error; 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; return 0;
error: error:
@ -996,7 +1032,7 @@ ulp_mapper_field_src_process(struct bnxt_ulp_mapper_parms *parms,
return -EINVAL; return -EINVAL;
} }
idx = tfp_be_to_cpu_16(idx); idx = tfp_be_to_cpu_16(idx);
if (idx >= BNXT_ULP_CF_IDX_LAST || bytelen > sizeof(uint64_t)) { if (idx >= BNXT_ULP_CF_IDX_LAST || bytelen > sizeof(uint32_t)) {
BNXT_TF_DBG(ERR, "comp field [%d] read oob %d\n", idx, BNXT_TF_DBG(ERR, "comp field [%d] read oob %d\n", idx,
bytelen); bytelen);
return -EINVAL; return -EINVAL;
@ -1448,7 +1484,16 @@ ulp_mapper_field_opc_process(struct bnxt_ulp_mapper_parms *parms,
break; 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: error:
BNXT_TF_DBG(ERR, "Error in %s:%s process %u:%u\n", name, BNXT_TF_DBG(ERR, "Error in %s:%s process %u:%u\n", name,
fld->description, (val) ? write_idx : 0, val_len); fld->description, (val) ? write_idx : 0, val_len);
@ -1500,8 +1545,15 @@ ulp_mapper_tbl_result_build(struct bnxt_ulp_mapper_parms *parms,
} }
/* if encap bit swap is enabled perform the bit swap */ /* 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); 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; return rc;
} }
@ -1725,6 +1777,9 @@ ulp_mapper_tcam_tbl_entry_write(struct bnxt_ulp_mapper_parms *parms,
tf_dir_2_str(sparms.dir), sparms.idx); tf_dir_2_str(sparms.dir), sparms.idx);
return -EIO; 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 */ /* Mark action */
rc = ulp_mapper_mark_act_ptr_process(parms, tbl); rc = ulp_mapper_mark_act_ptr_process(parms, tbl);
@ -1733,6 +1788,11 @@ ulp_mapper_tcam_tbl_entry_write(struct bnxt_ulp_mapper_parms *parms,
return rc; 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; return rc;
} }
@ -1838,6 +1898,12 @@ static void ulp_mapper_wc_tcam_tbl_post_process(struct ulp_blob *blob)
{ {
ulp_blob_perform_64B_word_swap(blob); ulp_blob_perform_64B_word_swap(blob);
ulp_blob_perform_64B_byte_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 static int32_t
@ -2134,6 +2200,11 @@ ulp_mapper_em_tbl_process(struct bnxt_ulp_mapper_parms *parms,
BNXT_TF_DBG(ERR, "Failed to build the result blob\n"); BNXT_TF_DBG(ERR, "Failed to build the result blob\n");
return rc; 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) { if (dparms->dynamic_pad_en) {
uint32_t abits = dparms->em_blk_align_bits; uint32_t abits = dparms->em_blk_align_bits;
@ -2148,6 +2219,11 @@ ulp_mapper_em_tbl_process(struct bnxt_ulp_mapper_parms *parms,
ulp_blob_pad_align(&data, abits); ulp_blob_pad_align(&data, abits);
ulp_blob_perform_byte_reverse(&data, ULP_BITS_2_BYTE(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 */ /* do the transpose for the internal EM keys */
@ -2160,6 +2236,11 @@ ulp_mapper_em_tbl_process(struct bnxt_ulp_mapper_parms *parms,
} }
tmplen = ulp_blob_data_len_get(&key); tmplen = ulp_blob_data_len_get(&key);
ulp_blob_perform_byte_reverse(&key, ULP_BITS_2_BYTE(tmplen)); 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, rc = bnxt_ulp_cntxt_tbl_scope_id_get(parms->ulp_ctx,
@ -2190,6 +2271,12 @@ ulp_mapper_em_tbl_process(struct bnxt_ulp_mapper_parms *parms,
return rc; 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 */ /* Mark action process */
if (mtype == BNXT_ULP_FLOW_MEM_TYPE_EXT && if (mtype == BNXT_ULP_FLOW_MEM_TYPE_EXT &&
tbl->resource_type == TF_MEM_EXTERNAL) tbl->resource_type == TF_MEM_EXTERNAL)
@ -2479,6 +2566,9 @@ ulp_mapper_index_tbl_process(struct bnxt_ulp_mapper_parms *parms,
sparms.idx, rc); sparms.idx, rc);
goto error; 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 */ /* Calculate action record size */
if (tbl->resource_type == TF_TBL_TYPE_EXT) { if (tbl->resource_type == TF_TBL_TYPE_EXT) {
@ -2635,6 +2725,10 @@ ulp_mapper_if_tbl_process(struct bnxt_ulp_mapper_parms *parms,
iftbl_params.idx, rc); iftbl_params.idx, rc);
return 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 * TBD: Need to look at the need to store idx in flow db for restore
@ -2697,6 +2791,12 @@ ulp_mapper_gen_tbl_process(struct bnxt_ulp_mapper_parms *parms,
/* The_key is a byte array convert it to a search index */ /* The_key is a byte array convert it to a search index */
cache_key = ulp_blob_data_get(&key, &tmplen); 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 */ /* get the generic table */
gen_tbl_list = &parms->mapper_data->gen_tbl_list[tbl_idx]; gen_tbl_list = &parms->mapper_data->gen_tbl_list[tbl_idx];
@ -3495,6 +3595,11 @@ ulp_mapper_tbls_process(struct bnxt_ulp_mapper_parms *parms, uint32_t tid)
for (tbl_idx = 0; tbl_idx < num_tbls && cond_goto;) { for (tbl_idx = 0; tbl_idx < num_tbls && cond_goto;) {
tbl = &tbls[tbl_idx]; tbl = &tbls[tbl_idx];
cond_goto = tbl->execute_info.cond_true_goto; 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 */ /* Process the conditional func code opcodes */
if (ulp_mapper_func_info_process(parms, tbl)) { if (ulp_mapper_func_info_process(parms, tbl)) {
BNXT_TF_DBG(ERR, "Failed to process cond update\n"); BNXT_TF_DBG(ERR, "Failed to process cond update\n");

View File

@ -6,6 +6,10 @@
#include "ulp_matcher.h" #include "ulp_matcher.h"
#include "ulp_utils.h" #include "ulp_utils.h"
#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
#include "ulp_template_debug_proto.h"
#endif
/* Utility function to calculate the class matcher hash */ /* Utility function to calculate the class matcher hash */
static uint32_t static uint32_t
ulp_matcher_class_hash_calculate(uint64_t hi_sig, uint64_t lo_sig) ulp_matcher_class_hash_calculate(uint64_t hi_sig, uint64_t lo_sig)
@ -95,6 +99,11 @@ ulp_matcher_pattern_match(struct ulp_rte_parser_params *params,
error: error:
BNXT_TF_DBG(DEBUG, "Did not find any matching template\n"); BNXT_TF_DBG(DEBUG, "Did not find any matching template\n");
#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
BNXT_TF_DBG(DEBUG, "class_hid:0x%x, Hdr:%" PRIX64 " Fld:%" PRIX64 "\n",
class_hid, params->hdr_bitmap.bits,
params->fld_bitmap.bits);
#endif
*class_id = 0; *class_id = 0;
return BNXT_TF_RC_ERROR; return BNXT_TF_RC_ERROR;
} }
@ -142,6 +151,10 @@ ulp_matcher_action_match(struct ulp_rte_parser_params *params,
error: error:
BNXT_TF_DBG(DEBUG, "Did not find any matching action template\n"); BNXT_TF_DBG(DEBUG, "Did not find any matching action template\n");
#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
BNXT_TF_DBG(DEBUG, "act_hid:0x%x, Hdr:%" PRIX64 "\n",
act_hid, params->act_bitmap.bits);
#endif
*act_id = 0; *act_id = 0;
return BNXT_TF_RC_ERROR; return BNXT_TF_RC_ERROR;
} }

View File

@ -7,9 +7,13 @@
#include "bnxt.h" #include "bnxt.h"
#include "bnxt_vnic.h" #include "bnxt_vnic.h"
#include "bnxt_tf_common.h" #include "bnxt_tf_common.h"
#include "bnxt_tf_pmd_shim.h"
#include "ulp_port_db.h" #include "ulp_port_db.h"
#include "tfp.h" #include "tfp.h"
#include "bnxt_tf_pmd_shim.h"
#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
#include "ulp_tf_debug.h"
#endif
static uint32_t static uint32_t
ulp_port_db_allocate_ifindex(struct bnxt_ulp_port_db *port_db) ulp_port_db_allocate_ifindex(struct bnxt_ulp_port_db *port_db)
@ -151,12 +155,12 @@ int32_t ulp_port_db_dev_port_intf_update(struct bnxt_ulp_context *ulp_ctxt,
intf->type = bnxt_pmd_get_interface_type(port_id); intf->type = bnxt_pmd_get_interface_type(port_id);
intf->drv_func_id = bnxt_pmd_get_fw_func_id(port_id, intf->drv_func_id = bnxt_pmd_get_fw_func_id(port_id,
BNXT_ULP_INTF_TYPE_INVALID); BNXT_ULP_INTF_TYPE_INVALID);
func = &port_db->ulp_func_id_tbl[intf->drv_func_id]; func = &port_db->ulp_func_id_tbl[intf->drv_func_id];
if (!func->func_valid) { if (!func->func_valid) {
func->func_svif = bnxt_pmd_get_svif(port_id, true, func->func_svif = bnxt_pmd_get_svif(port_id, true,
BNXT_ULP_INTF_TYPE_INVALID); BNXT_ULP_INTF_TYPE_INVALID);
func->func_spif = bnxt_pmd_get_phy_port_id(port_id); func->func_spif = bnxt_pmd_get_phy_port_id(port_id);
func->func_parif = func->func_parif =
bnxt_pmd_get_parif(port_id, BNXT_ULP_INTF_TYPE_INVALID); bnxt_pmd_get_parif(port_id, BNXT_ULP_INTF_TYPE_INVALID);
@ -202,6 +206,11 @@ int32_t ulp_port_db_dev_port_intf_update(struct bnxt_ulp_context *ulp_ctxt,
port_data->port_vport = bnxt_pmd_get_vport(port_id); port_data->port_vport = bnxt_pmd_get_vport(port_id);
port_data->port_valid = true; port_data->port_valid = true;
} }
#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG_PORT
ulp_port_db_dump(port_db, intf, port_id);
#endif
#endif
return 0; return 0;
} }

View File

@ -8,6 +8,7 @@
#include "ulp_template_struct.h" #include "ulp_template_struct.h"
#include "bnxt_ulp.h" #include "bnxt_ulp.h"
#include "bnxt_tf_common.h" #include "bnxt_tf_common.h"
#include "bnxt_tf_pmd_shim.h"
#include "ulp_rte_parser.h" #include "ulp_rte_parser.h"
#include "ulp_matcher.h" #include "ulp_matcher.h"
#include "ulp_utils.h" #include "ulp_utils.h"
@ -855,7 +856,7 @@ ulp_rte_vlan_hdr_handler(const struct rte_flow_item *item,
BNXT_ULP_HDR_BIT_II_VLAN); BNXT_ULP_HDR_BIT_II_VLAN);
inner_flag = 1; inner_flag = 1;
} else { } else {
BNXT_TF_DBG(ERR, "Error Parsing:Vlan hdr found without eth\n"); BNXT_TF_DBG(ERR, "Error Parsing:Vlan hdr found withtout eth\n");
return BNXT_TF_RC_ERROR; return BNXT_TF_RC_ERROR;
} }
/* Update the field protocol hdr bitmap */ /* Update the field protocol hdr bitmap */
@ -1135,8 +1136,8 @@ ulp_rte_ipv6_hdr_handler(const struct rte_flow_item *item,
ulp_rte_prsr_fld_mask(params, &idx, size, &ver_spec, &ver_mask, ulp_rte_prsr_fld_mask(params, &idx, size, &ver_spec, &ver_mask,
ULP_PRSR_ACT_DEFAULT); ULP_PRSR_ACT_DEFAULT);
/* /*
* The TC and flow label field are ignored since OVS is setting * The TC and flow label field are ignored since OVS is
* it for match and it is not supported. * setting it for match and it is not supported.
* This is a work around and * This is a work around and
* shall be addressed in the future. * shall be addressed in the future.
*/ */
@ -2138,7 +2139,7 @@ ulp_rte_vf_act_handler(const struct rte_flow_action *action_item,
return BNXT_TF_RC_PARSE_ERR; return BNXT_TF_RC_PARSE_ERR;
} }
bp = bnxt_get_bp(params->port_id); bp = bnxt_pmd_get_bp(params->port_id);
if (bp == NULL) { if (bp == NULL) {
BNXT_TF_DBG(ERR, "Invalid bp\n"); BNXT_TF_DBG(ERR, "Invalid bp\n");
return BNXT_TF_RC_ERROR; return BNXT_TF_RC_ERROR;

View File

@ -3,6 +3,8 @@
* All rights reserved. * All rights reserved.
*/ */
#include <sys/queue.h>
#include <rte_malloc.h> #include <rte_malloc.h>
#include "ulp_tun.h" #include "ulp_tun.h"
@ -29,6 +31,15 @@ ulp_install_outer_tun_flow(struct ulp_rte_parser_params *params,
ULP_BITMAP_SET(params->hdr_bitmap.bits, BNXT_ULP_HDR_BIT_F1); ULP_BITMAP_SET(params->hdr_bitmap.bits, BNXT_ULP_HDR_BIT_F1);
#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG_PARSER
/* Dump the rte flow pattern */
ulp_parser_hdr_info_dump(params);
/* Dump the rte flow action */
ulp_parser_act_info_dump(params);
#endif
#endif
ret = ulp_matcher_pattern_match(params, &params->class_id); ret = ulp_matcher_pattern_match(params, &params->class_id);
if (ret != BNXT_TF_RC_SUCCESS) if (ret != BNXT_TF_RC_SUCCESS)
goto err; goto err;
@ -146,6 +157,15 @@ ulp_post_process_cache_inner_tun_flow(struct ulp_rte_parser_params *params,
struct ulp_per_port_flow_info *flow_info; struct ulp_per_port_flow_info *flow_info;
int ret; int ret;
#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG_PARSER
/* Dump the rte flow pattern */
ulp_parser_hdr_info_dump(params);
/* Dump the rte flow action */
ulp_parser_act_info_dump(params);
#endif
#endif
ret = ulp_matcher_pattern_match(params, &params->class_id); ret = ulp_matcher_pattern_match(params, &params->class_id);
if (ret != BNXT_TF_RC_SUCCESS) if (ret != BNXT_TF_RC_SUCCESS)
return BNXT_TF_RC_ERROR; return BNXT_TF_RC_ERROR;

View File

@ -62,7 +62,7 @@ ulp_regfile_read(struct ulp_regfile *regfile,
* data [in] The value is written into this variable. It is going to be in the * data [in] The value is written into this variable. It is going to be in the
* same byte order as it was written. * same byte order as it was written.
* *
* size [in] The size in bytes of the value being written into this * size [in] The size in bytes of the value beingritten into this
* variable. * variable.
* *
* returns 0 on success * returns 0 on success
@ -295,7 +295,7 @@ ulp_blob_push(struct ulp_blob *blob,
datalen, datalen,
data); data);
if (!rc) { if (!rc) {
BNXT_TF_DBG(ERR, "Failed to write blob\n"); BNXT_TF_DBG(ERR, "Failed ro write blob\n");
return 0; return 0;
} }
blob->write_idx += datalen; blob->write_idx += datalen;
@ -355,7 +355,7 @@ ulp_blob_insert(struct ulp_blob *blob, uint32_t offset,
datalen, datalen,
data); data);
if (!rc) { if (!rc) {
BNXT_TF_DBG(ERR, "Failed to write blob\n"); BNXT_TF_DBG(ERR, "Failed ro write blob\n");
return 0; return 0;
} }
/* copy the previously stored data */ /* copy the previously stored data */
@ -409,7 +409,7 @@ ulp_blob_push_64(struct ulp_blob *blob,
* *
* data [in] 32-bit value to be added to the blob. * data [in] 32-bit value to be added to the blob.
* *
* datalen [in] The number of bits to be added to the blob. * datalen [in] The number of bits to be added ot the blob.
* *
* The offset of the data is updated after each push of data. * The offset of the data is updated after each push of data.
* NULL returned on error, pointer pushed value otherwise. * NULL returned on error, pointer pushed value otherwise.