enum tf_wc_num_slice num_slices_per_row)
{
int rc;
- struct tf_session *tfs;
+ struct tf_session *tfs = NULL;
/* Retrieve the session information */
rc = tf_session_get_session_internal(tfp, &tfs);
enum tf_wc_num_slice num_slices_per_row)
{
int rc;
- struct tf_session *tfs;
+ struct tf_session *tfs = NULL;
/* Retrieve the session information */
rc = tf_session_get_session_internal(tfp, &tfs);
uint16_t *num_slices_per_row)
{
int rc;
- struct tf_session *tfs;
+ struct tf_session *tfs = NULL;
/* Retrieve the session information */
rc = tf_session_get_session_internal(tfp, &tfs);
struct tf_global_cfg_cfg *global_cfg_db[TF_DIR_MAX];
};
-/**
- * Init flag, set on bind and cleared on unbind
- */
-static uint8_t init;
-
/**
* Get HCAPI type parameters for a single element
*/
TF_CHECK_PARMS2(tfp, parms);
- if (init) {
- TFP_DRV_LOG(ERR, "Global Cfg DB already initialized\n");
- return -EINVAL;
- }
-
cparms.nitems = 1;
cparms.size = sizeof(struct tf_global_cfg_db);
cparms.alignment = 0;
global_cfg_db = cparms.mem_va;
global_cfg_db->global_cfg_db[TF_DIR_RX] = parms->cfg;
global_cfg_db->global_cfg_db[TF_DIR_TX] = parms->cfg;
-
tf_session_set_global_db(tfp, (void *)global_cfg_db);
- init = 1;
-
TFP_DRV_LOG(INFO, "Global Cfg - initialized\n");
-
return 0;
}
TF_CHECK_PARMS1(tfp);
- /* Bail if nothing has been initialized */
- if (!init) {
- TFP_DRV_LOG(INFO, "No Global Cfg DBs created\n");
- return 0;
- }
-
rc = tf_session_get_global_db(tfp, (void **)&global_cfg_db_ptr);
if (rc) {
TFP_DRV_LOG(INFO, "global_cfg_db is not initialized\n");
}
tfp_free((void *)global_cfg_db_ptr);
- init = 0;
-
return 0;
}
TF_CHECK_PARMS3(tfp, parms, parms->config);
- if (!init) {
- TFP_DRV_LOG(ERR, "%s: No Global Cfg DBs created\n",
- tf_dir_2_str(parms->dir));
- return -EINVAL;
- }
-
rc = tf_session_get_global_db(tfp, (void **)&global_cfg_db_ptr);
if (rc) {
TFP_DRV_LOG(INFO, "No global cfg DBs initialized\n");
TF_CHECK_PARMS3(tfp, parms, parms->config);
- if (!init) {
- TFP_DRV_LOG(ERR,
- "%s: No Global Cfg DBs created\n",
- tf_dir_2_str(parms->dir));
- return -EINVAL;
- }
-
rc = tf_session_get_global_db(tfp, (void **)&global_cfg_db_ptr);
if (rc) {
TFP_DRV_LOG(INFO, "No Global cfg DBs initialized\n");
*
* Returns
* - (0) if successful.
- * - (-EINVAL) on failure.
+ * - (-ENOMEM) on failure.
*/
int
tf_global_cfg_bind(struct tf *tfp,
static pthread_mutex_t bnxt_ulp_global_mutex = PTHREAD_MUTEX_INITIALIZER;
/* Spin lock to protect context global list */
+uint32_t bnxt_ulp_ctxt_lock_created;
rte_spinlock_t bnxt_ulp_ctxt_lock;
TAILQ_HEAD(cntx_list_entry_list, ulp_context_list_entry);
static struct cntx_list_entry_list ulp_cntx_list =
static int32_t
bnxt_ulp_cntxt_list_init(void)
{
- /* Create the cntxt spin lock */
- rte_spinlock_init(&bnxt_ulp_ctxt_lock);
-
+ /* Create the cntxt spin lock only once*/
+ if (!bnxt_ulp_ctxt_lock_created)
+ rte_spinlock_init(&bnxt_ulp_ctxt_lock);
+ bnxt_ulp_ctxt_lock_created = 1;
return 0;
}
}
struct bnxt_ulp_context *
-bnxt_ulp_cntxt_entry_acquire(void)
+bnxt_ulp_cntxt_entry_acquire(void *arg)
{
struct ulp_context_list_entry *entry;
/* take a lock and get the first ulp context available */
if (rte_spinlock_trylock(&bnxt_ulp_ctxt_lock)) {
TAILQ_FOREACH(entry, &ulp_cntx_list, next)
- if (entry->ulp_ctx)
+ if (entry->ulp_ctx->cfg_data == arg)
return entry->ulp_ctx;
}
return NULL;
bnxt_ulp_cntxt_ha_enabled(struct bnxt_ulp_context *ulp_ctx);
struct bnxt_ulp_context *
-bnxt_ulp_cntxt_entry_acquire(void);
+bnxt_ulp_cntxt_entry_acquire(void *arg);
void
bnxt_ulp_cntxt_entry_release(void);
if (ulp_fc_info && !(ulp_fc_info->flags & ULP_FLAG_FC_THREAD)) {
rte_eal_alarm_set(US_PER_S * ULP_FC_TIMER,
- ulp_fc_mgr_alarm_cb, NULL);
+ ulp_fc_mgr_alarm_cb, (void *)ctxt->cfg_data);
ulp_fc_info->flags |= ULP_FLAG_FC_THREAD;
}
return;
ulp_fc_info->flags &= ~ULP_FLAG_FC_THREAD;
- rte_eal_alarm_cancel(ulp_fc_mgr_alarm_cb, NULL);
+ rte_eal_alarm_cancel(ulp_fc_mgr_alarm_cb, ctxt->cfg_data);
}
/*
*/
void
-ulp_fc_mgr_alarm_cb(void *arg __rte_unused)
+ulp_fc_mgr_alarm_cb(void *arg)
{
int rc = 0;
unsigned int j;
struct tf *tfp;
uint32_t dev_id, hw_cntr_id = 0, num_entries = 0;
- ctxt = bnxt_ulp_cntxt_entry_acquire();
+ ctxt = bnxt_ulp_cntxt_entry_acquire(arg);
if (ctxt == NULL) {
BNXT_TF_DBG(INFO, "could not get the ulp context lock\n");
rte_eal_alarm_set(US_PER_S * ULP_FC_TIMER,
- ulp_fc_mgr_alarm_cb, NULL);
+ ulp_fc_mgr_alarm_cb, arg);
return;
}
out:
bnxt_ulp_cntxt_entry_release();
rte_eal_alarm_set(US_PER_S * ULP_FC_TIMER,
- ulp_fc_mgr_alarm_cb, NULL);
+ ulp_fc_mgr_alarm_cb, arg);
}
/*
#define ULP_HA_CLIENT_CNT_IF_TBL_IDX 9
static void ulp_ha_mgr_timer_cancel(void);
-static int32_t ulp_ha_mgr_timer_start(void);
+static int32_t ulp_ha_mgr_timer_start(void *arg);
static void ulp_ha_mgr_timer_cb(void *arg);
static int32_t ulp_ha_mgr_app_type_set(struct bnxt_ulp_context *ulp_ctx,
enum ulp_ha_mgr_app_type app_type);
}
static void
-ulp_ha_mgr_timer_cb(void *arg __rte_unused)
+ulp_ha_mgr_timer_cb(void *arg)
{
struct tf_move_tcam_shared_entries_parms mparms = { 0 };
struct tf_clear_tcam_shared_entries_parms cparms = { 0 };
struct tf *tfp;
int32_t rc;
- ulp_ctx = bnxt_ulp_cntxt_entry_acquire();
+ ulp_ctx = bnxt_ulp_cntxt_entry_acquire(arg);
if (ulp_ctx == NULL) {
- ulp_ha_mgr_timer_start();
+ ulp_ha_mgr_timer_start(arg);
return;
}
bnxt_ulp_cntxt_release_fdb_lock(ulp_ctx);
cb_restart:
bnxt_ulp_cntxt_entry_release();
- ulp_ha_mgr_timer_start();
+ ulp_ha_mgr_timer_start(arg);
}
static int32_t
-ulp_ha_mgr_timer_start(void)
+ulp_ha_mgr_timer_start(void *arg)
{
rte_eal_alarm_set(US_PER_S * ULP_HA_TIMER_SEC,
- ulp_ha_mgr_timer_cb, NULL);
+ ulp_ha_mgr_timer_cb, arg);
return 0;
}
PMD_DRV_LOG(ERR, "Failed to initialize ha mutex\n");
goto cleanup;
}
- rc = ulp_ha_mgr_timer_start();
+ rc = ulp_ha_mgr_timer_start(ulp_ctx->cfg_data);
if (rc) {
BNXT_TF_DBG(ERR, "Unable to start timer CB.\n");
goto cleanup;