@@ -216,20 +216,20 @@ tf_dev_bind_p4(struct tf *tfp,
return -ENOMEM;
}
- if (!tf_session_is_shared_session(tfs)) {
- /*
- * IF_TBL
- */
- if_tbl_cfg.num_elements = TF_IF_TBL_TYPE_MAX;
- if_tbl_cfg.cfg = tf_if_tbl_p4;
- if_tbl_cfg.shadow_copy = shadow_copy;
- rc = tf_if_tbl_bind(tfp, &if_tbl_cfg);
- if (rc) {
- TFP_DRV_LOG(ERR,
- "IF Table initialization failure\n");
- goto fail;
- }
+ /*
+ * IF_TBL
+ */
+ if_tbl_cfg.num_elements = TF_IF_TBL_TYPE_MAX;
+ if_tbl_cfg.cfg = tf_if_tbl_p4;
+ if_tbl_cfg.shadow_copy = shadow_copy;
+ rc = tf_if_tbl_bind(tfp, &if_tbl_cfg);
+ if (rc) {
+ TFP_DRV_LOG(ERR,
+ "IF Table initialization failure\n");
+ goto fail;
+ }
+ if (!tf_session_is_shared_session(tfs)) {
/*
* GLOBAL_CFG
*/
@@ -271,6 +271,12 @@ tf_dev_unbind_p4(struct tf *tfp)
{
int rc = 0;
bool fail = false;
+ struct tf_session *tfs;
+
+ /* Retrieve the session information */
+ rc = tf_session_get_session_internal(tfp, &tfs);
+ if (rc)
+ return rc;
/* Unbind all the support modules. As this is only done on
* close we only report errors as everything has to be cleaned
@@ -318,18 +324,20 @@ tf_dev_unbind_p4(struct tf *tfp)
fail = true;
}
- rc = tf_if_tbl_unbind(tfp);
- if (rc) {
- TFP_DRV_LOG(INFO,
- "Device unbind failed, IF Table Type\n");
- fail = true;
- }
+ if (!tf_session_is_shared_session(tfs)) {
+ rc = tf_if_tbl_unbind(tfp);
+ if (rc) {
+ TFP_DRV_LOG(INFO,
+ "Device unbind failed, IF Table Type\n");
+ fail = true;
+ }
- rc = tf_global_cfg_unbind(tfp);
- if (rc) {
- TFP_DRV_LOG(INFO,
- "Device unbind failed, Global Cfg Type\n");
- fail = true;
+ rc = tf_global_cfg_unbind(tfp);
+ if (rc) {
+ TFP_DRV_LOG(INFO,
+ "Device unbind failed, Global Cfg Type\n");
+ fail = true;
+ }
}
if (fail)
@@ -472,17 +480,17 @@ tf_dev_bind_p58(struct tf *tfp,
/*
* IF_TBL
*/
- if (!tf_session_is_shared_session(tfs)) {
- if_tbl_cfg.num_elements = TF_IF_TBL_TYPE_MAX;
- if_tbl_cfg.cfg = tf_if_tbl_p58;
- if_tbl_cfg.shadow_copy = shadow_copy;
- rc = tf_if_tbl_bind(tfp, &if_tbl_cfg);
- if (rc) {
- TFP_DRV_LOG(ERR,
- "IF Table initialization failure\n");
- goto fail;
- }
+ if_tbl_cfg.num_elements = TF_IF_TBL_TYPE_MAX;
+ if_tbl_cfg.cfg = tf_if_tbl_p58;
+ if_tbl_cfg.shadow_copy = shadow_copy;
+ rc = tf_if_tbl_bind(tfp, &if_tbl_cfg);
+ if (rc) {
+ TFP_DRV_LOG(ERR,
+ "IF Table initialization failure\n");
+ goto fail;
+ }
+ if (!tf_session_is_shared_session(tfs)) {
/*
* GLOBAL_CFG
*/
@@ -571,14 +579,14 @@ tf_dev_unbind_p58(struct tf *tfp)
fail = true;
}
- if (!tf_session_is_shared_session(tfs)) {
- rc = tf_if_tbl_unbind(tfp);
- if (rc) {
- TFP_DRV_LOG(ERR,
- "Device unbind failed, IF Table Type\n");
- fail = true;
- }
+ rc = tf_if_tbl_unbind(tfp);
+ if (rc) {
+ TFP_DRV_LOG(ERR,
+ "Device unbind failed, IF Table Type\n");
+ fail = true;
+ }
+ if (!tf_session_is_shared_session(tfs)) {
rc = tf_global_cfg_unbind(tfp);
if (rc) {
TFP_DRV_LOG(ERR,
@@ -412,17 +412,13 @@ tf_em_int_bind(struct tf *tfp,
db_rc[i] = tf_rm_create_db_no_reservation(tfp, &db_cfg);
else
db_rc[i] = tf_rm_create_db(tfp, &db_cfg);
- if (db_rc[i]) {
- TFP_DRV_LOG(ERR,
- "%s: EM Int DB creation failed\n",
- tf_dir_2_str(i));
-
- }
}
/* No db created */
- if (db_rc[TF_DIR_RX] && db_rc[TF_DIR_TX])
+ if (db_rc[TF_DIR_RX] && db_rc[TF_DIR_TX]) {
+ TFP_DRV_LOG(ERR, "EM Int DB creation failed\n");
return db_rc[TF_DIR_RX];
+ }
if (!tf_session_is_shared_session(tfs)) {
@@ -514,9 +510,6 @@ tf_em_int_unbind(struct tf *tfp)
rc = tf_session_get_db(tfp, TF_MODULE_TYPE_EM, &em_db_ptr);
if (rc) {
- TFP_DRV_LOG(INFO,
- "Em_db is not initialized, rc:%s\n",
- strerror(-rc));
return 0;
}
em_db = (struct em_rm_db *)em_db_ptr;
@@ -74,11 +74,6 @@ tf_ident_bind(struct tf *tfp,
db_rc[i] = tf_rm_create_db_no_reservation(tfp, &db_cfg);
else
db_rc[i] = tf_rm_create_db(tfp, &db_cfg);
- if (db_rc[i]) {
- TFP_DRV_LOG(INFO,
- "%s: No Identifier DB required\n",
- tf_dir_2_str(i));
- }
if (parms->shadow_copy) {
shadow_cfg.alloc_cnt =
@@ -99,8 +94,10 @@ tf_ident_bind(struct tf *tfp,
}
/* No db created */
- if (db_rc[TF_DIR_RX] && db_rc[TF_DIR_TX])
+ if (db_rc[TF_DIR_RX] && db_rc[TF_DIR_TX]) {
+ TFP_DRV_LOG(ERR, "No Identifier DB created\n");
return db_rc[TF_DIR_RX];
+ }
TFP_DRV_LOG(INFO,
"Identifier - initialized\n");
@@ -121,12 +118,8 @@ tf_ident_unbind(struct tf *tfp)
TF_CHECK_PARMS1(tfp);
rc = tf_session_get_db(tfp, TF_MODULE_TYPE_IDENTIFIER, &ident_db_ptr);
- if (rc) {
- TFP_DRV_LOG(INFO,
- "Ident_db is not initialized, rc:%s\n",
- strerror(-rc));
+ if (rc)
return 0;
- }
ident_db = (struct ident_rm_db *)ident_db_ptr;
for (i = 0; i < TF_DIR_MAX; i++) {
@@ -16,24 +16,16 @@ struct tf;
/**
* IF Table DBs.
+ * TODO: Store this data in session db
*/
static void *if_tbl_db[TF_DIR_MAX];
-/**
- * IF Table Shadow DBs
- */
-/* static void *shadow_if_tbl_db[TF_DIR_MAX]; */
-
/**
* Init flag, set on bind and cleared on unbind
+ * TODO: Store this data in session db
*/
static uint8_t init;
-/**
- * Shadow init flag, set on bind and cleared on unbind
- */
-/* static uint8_t shadow_init; */
-
/**
* Convert if_tbl_type to hwrm type.
*
@@ -70,12 +62,6 @@ tf_if_tbl_bind(struct tf *tfp __rte_unused,
{
TF_CHECK_PARMS2(tfp, parms);
- if (init) {
- TFP_DRV_LOG(ERR,
- "IF TBL DB already initialized\n");
- return -EINVAL;
- }
-
if_tbl_db[TF_DIR_RX] = parms->cfg;
if_tbl_db[TF_DIR_TX] = parms->cfg;
@@ -425,9 +425,11 @@ tf_session_open_session(struct tf *tfp,
}
TFP_DRV_LOG(INFO,
- "Session created, session_client_id:%d, session_id:%d\n",
+ "Session created, session_client_id:%d,"
+ "session_id:0x%08x, fw_session_id:%d\n",
parms->open_cfg->session_client_id.id,
- parms->open_cfg->session_id.id);
+ parms->open_cfg->session_id.id,
+ parms->open_cfg->session_id.internal.fw_session_id);
} else {
scparms.ctrl_chan_name = parms->open_cfg->ctrl_chan_name;
scparms.session_client_id = &parms->open_cfg->session_client_id;
@@ -438,16 +440,16 @@ tf_session_open_session(struct tf *tfp,
rc = tf_session_client_create(tfp, &scparms);
if (rc) {
TFP_DRV_LOG(ERR,
- "Failed to create client on session %d, rc:%s\n",
+ "Failed to create client on session 0x%x, rc:%s\n",
parms->open_cfg->session_id.id,
strerror(-rc));
return rc;
}
TFP_DRV_LOG(INFO,
- "Session Client:%d created on session:%d\n",
- parms->open_cfg->session_client_id.id,
- parms->open_cfg->session_id.id);
+ "Session Client:%d registered on session:0x%8x\n",
+ scparms.session_client_id->internal.fw_session_client_id,
+ tfp->session->session_id.id);
}
return 0;
@@ -541,7 +543,7 @@ tf_session_close_session(struct tf *tfp,
client->session_client_id.id);
TFP_DRV_LOG(INFO,
- "session_id:%d, ref_count:%d\n",
+ "session_id:0x%08x, ref_count:%d\n",
tfs->session_id.id,
tfs->ref_count);
@@ -587,7 +589,7 @@ tf_session_close_session(struct tf *tfp,
tfs->ref_count--;
TFP_DRV_LOG(INFO,
- "Closed session, session_id:%d, ref_count:%d\n",
+ "Closed session, session_id:0x%08x, ref_count:%d\n",
tfs->session_id.id,
tfs->ref_count);
@@ -83,17 +83,15 @@ tf_tbl_bind(struct tf *tfp,
db_rc[d] = tf_rm_create_db_no_reservation(tfp, &db_cfg);
else
db_rc[d] = tf_rm_create_db(tfp, &db_cfg);
- if (db_rc[d]) {
- TFP_DRV_LOG(ERR,
- "%s: No Table DB creation required\n",
- tf_dir_2_str(d));
-
- }
}
/* No db created */
- if (db_rc[TF_DIR_RX] && db_rc[TF_DIR_TX])
+ if (db_rc[TF_DIR_RX] && db_rc[TF_DIR_TX]) {
+ TFP_DRV_LOG(ERR,
+ "%s: No Table DB created\n",
+ tf_dir_2_str(d));
return db_rc[TF_DIR_RX];
+ }
TFP_DRV_LOG(INFO,
"Table Type - initialized\n");
@@ -112,12 +110,8 @@ tf_tbl_unbind(struct tf *tfp)
TF_CHECK_PARMS1(tfp);
rc = tf_session_get_db(tfp, TF_MODULE_TYPE_TABLE, &tbl_db_ptr);
- if (rc) {
- TFP_DRV_LOG(INFO,
- "Tbl_db is not initialized, rc:%s\n",
- strerror(-rc));
+ if (rc)
return 0;
- }
tbl_db = (struct tbl_rm_db *)tbl_db_ptr;
for (i = 0; i < TF_DIR_MAX; i++) {
@@ -113,16 +113,13 @@ tf_tcam_bind(struct tf *tfp,
db_rc[d] = tf_rm_create_db_no_reservation(tfp, &db_cfg);
else
db_rc[d] = tf_rm_create_db(tfp, &db_cfg);
- if (db_rc[d]) {
- TFP_DRV_LOG(INFO,
- "%s: no TCAM DB required\n",
- tf_dir_2_str(d));
- }
}
/* No db created */
- if (db_rc[TF_DIR_RX] && db_rc[TF_DIR_TX])
+ if (db_rc[TF_DIR_RX] && db_rc[TF_DIR_TX]) {
+ TFP_DRV_LOG(ERR, "No TCAM DB created\n");
return db_rc[TF_DIR_RX];
+ }
/* check if reserved resource for WC is multiple of num_slices */
for (d = 0; d < TF_DIR_MAX; d++) {
@@ -227,9 +224,6 @@ tf_tcam_unbind(struct tf *tfp)
rc = tf_session_get_db(tfp, TF_MODULE_TYPE_TCAM, &tcam_db_ptr);
if (rc) {
- TFP_DRV_LOG(INFO,
- "Tcam_db is not initialized, rc:%s\n",
- strerror(-rc));
return 0;
}
tcam_db = (struct tcam_rm_db *)tcam_db_ptr;