DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM |
DEV_RX_OFFLOAD_RSS_HASH |
DEV_RX_OFFLOAD_VLAN_FILTER)) &&
- !bp->truflow) {
+ !BNXT_TRUFLOW_EN(bp)) {
PMD_DRV_LOG(INFO, "Using vector mode receive for port %d\n",
eth_dev->data->port_id);
bp->flags |= BNXT_FLAG_RX_VECTOR_PKT_MODE;
bnxt_schedule_fw_health_check(bp);
pthread_mutex_unlock(&bp->def_cp_lock);
- if (bp->truflow)
+ if (BNXT_TRUFLOW_EN(bp))
bnxt_ulp_init(bp);
return 0;
struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
- if (bp->truflow)
+ if (BNXT_TRUFLOW_EN(bp))
bnxt_ulp_deinit(bp);
eth_dev->data->dev_started = 0;
case RTE_ETH_FILTER_GENERIC:
if (filter_op != RTE_ETH_FILTER_GET)
return -EINVAL;
- if (bp->truflow)
+ if (BNXT_TRUFLOW_EN(bp))
*(const void **)arg = &bnxt_ulp_rte_flow_ops;
else
*(const void **)arg = &bnxt_flow_ops;
return -EINVAL;
}
- bp->truflow = truflow;
- if (bp->truflow)
+ bp->flags |= BNXT_FLAG_TRUFLOW_EN;
+ if (BNXT_TRUFLOW_EN(bp))
PMD_DRV_LOG(INFO, "Host-based truflow feature enabled.\n");
return 0;
if (!bp)
return 0;
- if (&bp->tfp == bp->ulp_ctx.g_tfp)
+ if (&bp->tfp == bp->ulp_ctx->g_tfp)
return 1;
return 0;
tf_close_session(&bp->tfp);
session->session_opened = 0;
session->g_tfp = NULL;
- bp->ulp_ctx.g_tfp = NULL;
+ bp->ulp_ctx->g_tfp = NULL;
}
static void
uint32_t dev_id;
int rc;
- rc = bnxt_ulp_cntxt_dev_id_get(&bp->ulp_ctx, &dev_id);
+ rc = bnxt_ulp_cntxt_dev_id_get(bp->ulp_ctx, &dev_id);
if (rc)
/* TBD: For now, just use default. */
dparms = 0;
return rc;
}
- 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) {
BNXT_TF_DBG(ERR, "Unable to set table scope id\n");
return rc;
/* Free the contents */
if (session->cfg_data) {
rte_free(session->cfg_data);
- bp->ulp_ctx.cfg_data = NULL;
+ bp->ulp_ctx->cfg_data = NULL;
session->cfg_data = NULL;
}
return 0;
}
/* Increment the ulp context data reference count usage. */
- bp->ulp_ctx.cfg_data = ulp_data;
+ bp->ulp_ctx->cfg_data = ulp_data;
session->cfg_data = ulp_data;
ulp_data->ref_cnt++;
(void)ulp_ctx_deinit(bp, session);
return rc;
}
- bnxt_ulp_cntxt_tfp_set(&bp->ulp_ctx, session->g_tfp);
+ bnxt_ulp_cntxt_tfp_set(bp->ulp_ctx, session->g_tfp);
return rc;
}
BNXT_TF_DBG(ERR, "Invalid Arguments\n");
return -EINVAL;
}
- ulp_ctx = &bp->ulp_ctx;
+ ulp_ctx = bp->ulp_ctx;
if (!ulp_ctx->cfg_data)
return 0;
bool init;
int rc;
+ if (bp->ulp_ctx) {
+ BNXT_TF_DBG(ERR, "ulp ctx already allocated\n");
+ return -EINVAL;
+ }
+
/*
* Multiple uplink ports can be associated with a single vswitch.
* Make sure only the port that is started first will initialize
return -EINVAL;
}
+ bp->ulp_ctx = rte_zmalloc("bnxt_ulp_ctx",
+ sizeof(struct bnxt_ulp_context), 0);
+ if (!bp->ulp_ctx) {
+ BNXT_TF_DBG(ERR, "Failed to allocate ulp ctx\n");
+ ulp_session_deinit(session);
+ return -ENOMEM;
+ }
+
/*
* If ULP is already initialized for a specific domain then simply
* assign the ulp context to this rte_eth_dev.
*/
if (init) {
- rc = ulp_ctx_attach(&bp->ulp_ctx, session);
+ rc = ulp_ctx_attach(bp->ulp_ctx, session);
if (rc) {
BNXT_TF_DBG(ERR,
"Failed to attach the ulp context\n");
+ ulp_session_deinit(session);
+ rte_free(bp->ulp_ctx);
return rc;
}
/* update the port database */
- rc = ulp_port_db_dev_port_intf_update(&bp->ulp_ctx, bp);
+ rc = ulp_port_db_dev_port_intf_update(bp->ulp_ctx, bp);
if (rc) {
BNXT_TF_DBG(ERR,
"Failed to update port database\n");
+ ulp_ctx_detach(bp, session);
+ ulp_session_deinit(session);
+ rte_free(bp->ulp_ctx);
}
return rc;
}
}
/* create the port database */
- rc = ulp_port_db_init(&bp->ulp_ctx);
+ rc = ulp_port_db_init(bp->ulp_ctx);
if (rc) {
BNXT_TF_DBG(ERR, "Failed to create the port database\n");
goto jump_to_error;
}
/* update the port database */
- rc = ulp_port_db_dev_port_intf_update(&bp->ulp_ctx, bp);
+ rc = ulp_port_db_dev_port_intf_update(bp->ulp_ctx, bp);
if (rc) {
BNXT_TF_DBG(ERR, "Failed to update port database\n");
goto jump_to_error;
}
/* Create the Mark database. */
- rc = ulp_mark_db_init(&bp->ulp_ctx);
+ rc = ulp_mark_db_init(bp->ulp_ctx);
if (rc) {
BNXT_TF_DBG(ERR, "Failed to create the mark database\n");
goto jump_to_error;
}
/* Create the flow database. */
- rc = ulp_flow_db_init(&bp->ulp_ctx);
+ rc = ulp_flow_db_init(bp->ulp_ctx);
if (rc) {
BNXT_TF_DBG(ERR, "Failed to create the flow database\n");
goto jump_to_error;
goto jump_to_error;
}
- rc = ulp_mapper_init(&bp->ulp_ctx);
+ rc = ulp_mapper_init(bp->ulp_ctx);
if (rc) {
BNXT_TF_DBG(ERR, "Failed to initialize ulp mapper\n");
goto jump_to_error;
return;
/* clean up regular flows */
- ulp_flow_db_flush_flows(&bp->ulp_ctx, BNXT_ULP_REGULAR_FLOW_TABLE);
+ ulp_flow_db_flush_flows(bp->ulp_ctx, BNXT_ULP_REGULAR_FLOW_TABLE);
/* cleanup the eem table scope */
- ulp_eem_tbl_scope_deinit(bp, &bp->ulp_ctx);
+ ulp_eem_tbl_scope_deinit(bp, bp->ulp_ctx);
/* cleanup the flow database */
- ulp_flow_db_deinit(&bp->ulp_ctx);
+ ulp_flow_db_deinit(bp->ulp_ctx);
/* Delete the Mark database */
- ulp_mark_db_deinit(&bp->ulp_ctx);
+ ulp_mark_db_deinit(bp->ulp_ctx);
/* cleanup the ulp mapper */
- ulp_mapper_deinit(&bp->ulp_ctx);
+ ulp_mapper_deinit(bp->ulp_ctx);
/* Delete the Port database */
- ulp_port_db_deinit(&bp->ulp_ctx);
+ ulp_port_db_deinit(bp->ulp_ctx);
/* Delete the ulp context and tf session */
ulp_ctx_detach(bp, session);
/* Finally delete the bnxt session*/
ulp_session_deinit(session);
+
+ rte_free(bp->ulp_ctx);
}
/* Function to set the Mark DB into the context */
BNXT_TF_DBG(ERR, "Bnxt private data is not initialized\n");
return NULL;
}
- return &bp->ulp_ctx;
+ return bp->ulp_ctx;
}
int32_t