diff mbox series

[16/58] net/bnxt: update shared session functionality

Message ID 20210530085929.29695-17-venkatkumar.duvvuru@broadcom.com (mailing list archive)
State Superseded, archived
Delegated to: Ajit Khaparde
Headers show
Series enhancements to host based flow table management | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Venkat Duvvuru May 30, 2021, 8:58 a.m. UTC
From: Jay Ding <jay.ding@broadcom.com>

- Distinguish the shared session on host side using PCI address
- One session could be shared by multiple interfaces.

Signed-off-by: Jay Ding <jay.ding@broadcom.com>
Signed-off-by: Randy Schacher <stuart.schacher@broadcom.com>
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Farah Smith <farah.smith@broadcom.com>
---
 drivers/net/bnxt/tf_core/tf_core.c        |  9 ---
 drivers/net/bnxt/tf_core/tf_core.h        |  4 ++
 drivers/net/bnxt/tf_core/tf_device.c      | 28 +++++----
 drivers/net/bnxt/tf_core/tf_device_p58.c  |  7 ++-
 drivers/net/bnxt/tf_core/tf_em_internal.c | 23 ++++----
 drivers/net/bnxt/tf_core/tf_identifier.c  | 15 ++---
 drivers/net/bnxt/tf_core/tf_msg.c         | 69 +++++++++++++----------
 drivers/net/bnxt/tf_core/tf_session.c     | 13 ++++-
 drivers/net/bnxt/tf_core/tf_session.h     |  9 +--
 drivers/net/bnxt/tf_core/tf_tbl.c         | 57 ++++++++++++++++---
 drivers/net/bnxt/tf_core/tf_tcam.c        | 15 ++---
 drivers/net/bnxt/tf_core/tfp.c            |  4 +-
 12 files changed, 153 insertions(+), 100 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/bnxt/tf_core/tf_core.c b/drivers/net/bnxt/tf_core/tf_core.c
index 69f5c10293..945e54bfdd 100644
--- a/drivers/net/bnxt/tf_core/tf_core.c
+++ b/drivers/net/bnxt/tf_core/tf_core.c
@@ -27,8 +27,6 @@  tf_open_session(struct tf *tfp,
 	int rc;
 	unsigned int domain, bus, slot, device;
 	struct tf_session_open_session_parms oparms;
-	int name_len;
-	char *name;
 
 	TF_CHECK_PARMS2(tfp, parms);
 
@@ -71,13 +69,6 @@  tf_open_session(struct tf *tfp,
 		}
 	}
 
-	name_len = strlen(parms->ctrl_chan_name);
-	name = &parms->ctrl_chan_name[name_len - strlen("tf_shared")];
-	if (!strncmp(name, "tf_shared", strlen("tf_shared"))) {
-		memset(parms->ctrl_chan_name, 0, strlen(parms->ctrl_chan_name));
-		strcpy(parms->ctrl_chan_name, "tf_share");
-	}
-
 	parms->session_id.internal.domain = domain;
 	parms->session_id.internal.bus = bus;
 	parms->session_id.internal.device = device;
diff --git a/drivers/net/bnxt/tf_core/tf_core.h b/drivers/net/bnxt/tf_core/tf_core.h
index 08a083077c..3d14dc5391 100644
--- a/drivers/net/bnxt/tf_core/tf_core.h
+++ b/drivers/net/bnxt/tf_core/tf_core.h
@@ -458,6 +458,10 @@  struct tf_session_info {
  */
 struct tf {
 	struct tf_session_info *session;
+	/**
+	 * the pointer to the parent bp struct
+	 */
+	void *bp;
 };
 
 /**
diff --git a/drivers/net/bnxt/tf_core/tf_device.c b/drivers/net/bnxt/tf_core/tf_device.c
index fed4156200..97ae73fa5a 100644
--- a/drivers/net/bnxt/tf_core/tf_device.c
+++ b/drivers/net/bnxt/tf_core/tf_device.c
@@ -44,7 +44,11 @@  tf_dev_reservation_check(uint16_t count,
 		rm_num = (uint16_t *)reservations + i * count;
 		for (j = 0; j < count; j++) {
 			if ((cfg[j].cfg_type == TF_RM_ELEM_CFG_HCAPI ||
-			     cfg[j].cfg_type == TF_RM_ELEM_CFG_HCAPI_BA) &&
+			     cfg[j].cfg_type == TF_RM_ELEM_CFG_HCAPI_BA ||
+			     cfg[j].cfg_type ==
+				TF_RM_ELEM_CFG_HCAPI_BA_PARENT ||
+			     cfg[j].cfg_type ==
+				TF_RM_ELEM_CFG_HCAPI_BA_CHILD) &&
 			     rm_num[j] > 0)
 				cnt++;
 		}
@@ -263,49 +267,49 @@  tf_dev_unbind_p4(struct tf *tfp)
 	 */
 	rc = tf_tcam_unbind(tfp);
 	if (rc) {
-		TFP_DRV_LOG(ERR,
+		TFP_DRV_LOG(INFO,
 			    "Device unbind failed, TCAM\n");
 		fail = true;
 	}
 
 	rc = tf_ident_unbind(tfp);
 	if (rc) {
-		TFP_DRV_LOG(ERR,
+		TFP_DRV_LOG(INFO,
 			    "Device unbind failed, Identifier\n");
 		fail = true;
 	}
 
 	rc = tf_tbl_unbind(tfp);
 	if (rc) {
-		TFP_DRV_LOG(ERR,
+		TFP_DRV_LOG(INFO,
 			    "Device unbind failed, Table Type\n");
 		fail = true;
 	}
 
 	rc = tf_em_ext_common_unbind(tfp);
 	if (rc) {
-		TFP_DRV_LOG(ERR,
+		TFP_DRV_LOG(INFO,
 			    "Device unbind failed, EEM\n");
 		fail = true;
 	}
 
 	rc = tf_em_int_unbind(tfp);
 	if (rc) {
-		TFP_DRV_LOG(ERR,
+		TFP_DRV_LOG(INFO,
 			    "Device unbind failed, EM\n");
 		fail = true;
 	}
 
 	rc = tf_if_tbl_unbind(tfp);
 	if (rc) {
-		TFP_DRV_LOG(ERR,
+		TFP_DRV_LOG(INFO,
 			    "Device unbind failed, IF Table Type\n");
 		fail = true;
 	}
 
 	rc = tf_global_cfg_unbind(tfp);
 	if (rc) {
-		TFP_DRV_LOG(ERR,
+		TFP_DRV_LOG(INFO,
 			    "Device unbind failed, Global Cfg Type\n");
 		fail = true;
 	}
@@ -515,28 +519,28 @@  tf_dev_unbind_p58(struct tf *tfp)
 	 */
 	rc = tf_tcam_unbind(tfp);
 	if (rc) {
-		TFP_DRV_LOG(ERR,
+		TFP_DRV_LOG(INFO,
 			    "Device unbind failed, TCAM\n");
 		fail = true;
 	}
 
 	rc = tf_ident_unbind(tfp);
 	if (rc) {
-		TFP_DRV_LOG(ERR,
+		TFP_DRV_LOG(INFO,
 			    "Device unbind failed, Identifier\n");
 		fail = true;
 	}
 
 	rc = tf_tbl_unbind(tfp);
 	if (rc) {
-		TFP_DRV_LOG(ERR,
+		TFP_DRV_LOG(INFO,
 			    "Device unbind failed, Table Type\n");
 		fail = true;
 	}
 
 	rc = tf_em_int_unbind(tfp);
 	if (rc) {
-		TFP_DRV_LOG(ERR,
+		TFP_DRV_LOG(INFO,
 			    "Device unbind failed, EM\n");
 		fail = true;
 	}
diff --git a/drivers/net/bnxt/tf_core/tf_device_p58.c b/drivers/net/bnxt/tf_core/tf_device_p58.c
index 7917c9613a..ba82efdfe2 100644
--- a/drivers/net/bnxt/tf_core/tf_device_p58.c
+++ b/drivers/net/bnxt/tf_core/tf_device_p58.c
@@ -193,8 +193,11 @@  static int tf_dev_p58_get_sram_tbl_info(struct tf *tfp __rte_unused,
 	parms.hcapi_type = &hcapi_type;
 
 	rc = tf_rm_get_hcapi_type(&parms);
-	if (rc)
-		return rc;
+	if (rc) {
+		*base = 0;
+		*shift = 0;
+		return 0;
+	}
 
 	switch (hcapi_type) {
 	case CFA_RESOURCE_TYPE_P58_SRAM_BANK_0:
diff --git a/drivers/net/bnxt/tf_core/tf_em_internal.c b/drivers/net/bnxt/tf_core/tf_em_internal.c
index eec15b89bc..3b1e4e385d 100644
--- a/drivers/net/bnxt/tf_core/tf_em_internal.c
+++ b/drivers/net/bnxt/tf_core/tf_em_internal.c
@@ -509,21 +509,21 @@  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(ERR,
-			    "Failed to get em_ext_db from session, rc:%s\n",
+		TFP_DRV_LOG(INFO,
+			    "Em_db is not initialized, rc:%s\n",
 			    strerror(-rc));
-		return rc;
+		return 0;
 	}
 	em_db = (struct em_rm_db *)em_db_ptr;
 
 	for (i = 0; i < TF_DIR_MAX; i++) {
+		if (em_db->em_db[i] == NULL)
+			continue;
 		fparms.dir = i;
 		fparms.rm_db = em_db->em_db[i];
-		if (em_db->em_db[i] != NULL) {
-			rc = tf_rm_free_db(tfp, &fparms);
-			if (rc)
-				return rc;
-		}
+		rc = tf_rm_free_db(tfp, &fparms);
+		if (rc)
+			return rc;
 
 		em_db->em_db[i] = NULL;
 	}
@@ -546,10 +546,9 @@  tf_em_get_resc_info(struct tf *tfp,
 
 	rc = tf_session_get_db(tfp, TF_MODULE_TYPE_EM, &em_db_ptr);
 	if (rc) {
-		TFP_DRV_LOG(ERR,
-			    "Failed to get em_ext_db from session, rc:%s\n",
-			    strerror(-rc));
-		return rc;
+		TFP_DRV_LOG(INFO,
+			    "No resource allocated for em from session\n");
+		return 0;
 	}
 	em_db = (struct em_rm_db *)em_db_ptr;
 
diff --git a/drivers/net/bnxt/tf_core/tf_identifier.c b/drivers/net/bnxt/tf_core/tf_identifier.c
index 4063f3ba17..ebb975562d 100644
--- a/drivers/net/bnxt/tf_core/tf_identifier.c
+++ b/drivers/net/bnxt/tf_core/tf_identifier.c
@@ -119,14 +119,16 @@  tf_ident_unbind(struct tf *tfp)
 
 	rc = tf_session_get_db(tfp, TF_MODULE_TYPE_IDENTIFIER, &ident_db_ptr);
 	if (rc) {
-		TFP_DRV_LOG(ERR,
-			    "Failed to get ident_db from session, rc:%s\n",
+		TFP_DRV_LOG(INFO,
+			    "Ident_db is not initialized, rc:%s\n",
 			    strerror(-rc));
-		return rc;
+		return 0;
 	}
 	ident_db = (struct ident_rm_db *)ident_db_ptr;
 
 	for (i = 0; i < TF_DIR_MAX; i++) {
+		if (ident_db->ident_db[i] == NULL)
+			continue;
 		fparms.rm_db = ident_db->ident_db[i];
 		fparms.dir = i;
 		rc = tf_rm_free_db(tfp, &fparms);
@@ -372,10 +374,9 @@  tf_ident_get_resc_info(struct tf *tfp,
 
 	rc = tf_session_get_db(tfp, TF_MODULE_TYPE_IDENTIFIER, &ident_db_ptr);
 	if (rc) {
-		TFP_DRV_LOG(ERR,
-			    "Failed to get ident_db from session, rc:%s\n",
-			    strerror(-rc));
-		return rc;
+		TFP_DRV_LOG(INFO,
+			    "No resource allocated for ident from session\n");
+		return 0;
 	}
 	ident_db = (struct ident_rm_db *)ident_db_ptr;
 
diff --git a/drivers/net/bnxt/tf_core/tf_msg.c b/drivers/net/bnxt/tf_core/tf_msg.c
index 2ee8a1e8a9..18eea8338a 100644
--- a/drivers/net/bnxt/tf_core/tf_msg.c
+++ b/drivers/net/bnxt/tf_core/tf_msg.c
@@ -125,9 +125,16 @@  tf_msg_session_open(struct bnxt *bp,
 	struct hwrm_tf_session_open_input req = { 0 };
 	struct hwrm_tf_session_open_output resp = { 0 };
 	struct tfp_send_msg_parms parms = { 0 };
+	int name_len;
+	char *name;
 
 	/* Populate the request */
-	tfp_memcpy(&req.session_name, ctrl_chan_name, TF_SESSION_NAME_MAX);
+	name_len = strnlen(ctrl_chan_name, TF_SESSION_NAME_MAX);
+	name = &ctrl_chan_name[name_len - strlen("tf_shared")];
+	if (!strncmp(name, "tf_shared", strlen("tf_shared")))
+		tfp_memcpy(&req.session_name, name, strlen("tf_share"));
+	else
+		tfp_memcpy(&req.session_name, ctrl_chan_name, TF_SESSION_NAME_MAX);
 
 	parms.tf_type = HWRM_TF_SESSION_OPEN;
 	parms.req_data = (uint32_t *)&req;
@@ -201,7 +208,7 @@  tf_msg_session_client_register(struct tf *tfp,
 	parms.resp_size = sizeof(resp);
 	parms.mailbox = dev->ops->tf_dev_get_mailbox();
 
-	rc = tfp_send_msg_direct(tf_session_get_bp(tfs),
+	rc = tfp_send_msg_direct(tf_session_get_bp(tfp),
 				 &parms);
 	if (rc)
 		return rc;
@@ -252,7 +259,7 @@  tf_msg_session_client_unregister(struct tf *tfp,
 	parms.resp_size = sizeof(resp);
 	parms.mailbox = dev->ops->tf_dev_get_mailbox();
 
-	rc = tfp_send_msg_direct(tf_session_get_bp(tfs),
+	rc = tfp_send_msg_direct(tf_session_get_bp(tfp),
 				 &parms);
 
 	return rc;
@@ -296,7 +303,7 @@  tf_msg_session_close(struct tf *tfp,
 	parms.resp_size = sizeof(resp);
 	parms.mailbox = dev->ops->tf_dev_get_mailbox();
 
-	rc = tfp_send_msg_direct(tf_session_get_bp(tfs),
+	rc = tfp_send_msg_direct(tf_session_get_bp(tfp),
 				 &parms);
 	return rc;
 }
@@ -348,7 +355,7 @@  tf_msg_session_qcfg(struct tf *tfp)
 	parms.resp_size = sizeof(resp);
 	parms.mailbox = dev->ops->tf_dev_get_mailbox();
 
-	rc = tfp_send_msg_direct(tf_session_get_bp(tfs),
+	rc = tfp_send_msg_direct(tf_session_get_bp(tfp),
 				 &parms);
 	return rc;
 }
@@ -411,7 +418,7 @@  tf_msg_session_resc_qcaps(struct tf *tfp,
 	parms.resp_size = sizeof(resp);
 	parms.mailbox = dev->ops->tf_dev_get_mailbox();
 
-	rc = tfp_send_msg_direct(tf_session_get_bp(tfs), &parms);
+	rc = tfp_send_msg_direct(tf_session_get_bp(tfp), &parms);
 	if (rc)
 		goto cleanup;
 
@@ -521,7 +528,7 @@  tf_msg_session_resc_alloc(struct tf *tfp,
 	parms.resp_size = sizeof(resp);
 	parms.mailbox = dev->ops->tf_dev_get_mailbox();
 
-	rc = tfp_send_msg_direct(tf_session_get_bp(tfs), &parms);
+	rc = tfp_send_msg_direct(tf_session_get_bp(tfp), &parms);
 	if (rc)
 		goto cleanup;
 
@@ -628,7 +635,7 @@  tf_msg_session_resc_info(struct tf *tfp,
 	parms.resp_size = sizeof(resp);
 	parms.mailbox = dev->ops->tf_dev_get_mailbox();
 
-	rc = tfp_send_msg_direct(tf_session_get_bp(tfs), &parms);
+	rc = tfp_send_msg_direct(tf_session_get_bp(tfp), &parms);
 	if (rc)
 		goto cleanup;
 
@@ -735,7 +742,7 @@  tf_msg_session_resc_flush(struct tf *tfp,
 	parms.resp_size = sizeof(resp);
 	parms.mailbox = dev->ops->tf_dev_get_mailbox();
 
-	rc = tfp_send_msg_direct(tf_session_get_bp(tfs), &parms);
+	rc = tfp_send_msg_direct(tf_session_get_bp(tfp), &parms);
 
 	tf_msg_free_dma_buf(&resv_buf);
 
@@ -829,7 +836,7 @@  tf_msg_insert_em_internal_entry(struct tf *tfp,
 	parms.resp_size = sizeof(resp);
 	parms.mailbox = dev->ops->tf_dev_get_mailbox();
 
-	rc = tfp_send_msg_direct(tf_session_get_bp(tfs),
+	rc = tfp_send_msg_direct(tf_session_get_bp(tfp),
 				 &parms);
 	if (rc)
 		return rc;
@@ -924,7 +931,7 @@  tf_msg_hash_insert_em_internal_entry(struct tf *tfp,
 	parms.resp_size = sizeof(resp);
 	parms.mailbox = dev->ops->tf_dev_get_mailbox();
 
-	rc = tfp_send_msg_direct(tf_session_get_bp(tfs),
+	rc = tfp_send_msg_direct(tf_session_get_bp(tfp),
 				 &parms);
 	if (rc)
 		return rc;
@@ -994,7 +1001,7 @@  tf_msg_delete_em_entry(struct tf *tfp,
 	parms.resp_size = sizeof(resp);
 	parms.mailbox = dev->ops->tf_dev_get_mailbox();
 
-	rc = tfp_send_msg_direct(tf_session_get_bp(tfs),
+	rc = tfp_send_msg_direct(tf_session_get_bp(tfp),
 				 &parms);
 	if (rc)
 		return rc;
@@ -1063,7 +1070,7 @@  tf_msg_move_em_entry(struct tf *tfp,
 	parms.resp_size = sizeof(resp);
 	parms.mailbox = dev->ops->tf_dev_get_mailbox();
 
-	rc = tfp_send_msg_direct(tf_session_get_bp(tfs),
+	rc = tfp_send_msg_direct(tf_session_get_bp(tfp),
 				 &parms);
 	if (rc)
 		return rc;
@@ -1119,7 +1126,7 @@  int tf_msg_ext_em_ctxt_mem_alloc(struct tf *tfp,
 		parms.resp_data = (uint32_t *)&resp;
 		parms.resp_size = sizeof(resp);
 		parms.mailbox = dev->ops->tf_dev_get_mailbox();
-		rc = tfp_send_msg_direct(tf_session_get_bp(tfs), &parms);
+		rc = tfp_send_msg_direct(tf_session_get_bp(tfp), &parms);
 		if (rc) {
 			TFP_DRV_LOG(ERR, "Failed ext_em_alloc error rc:%s\n",
 				strerror(-rc));
@@ -1179,7 +1186,7 @@  int tf_msg_ext_em_ctxt_mem_free(struct tf *tfp,
 	parms.resp_data = (uint32_t *)&resp;
 	parms.resp_size = sizeof(resp);
 	parms.mailbox = dev->ops->tf_dev_get_mailbox();
-	rc = tfp_send_msg_direct(tf_session_get_bp(tfs), &parms);
+	rc = tfp_send_msg_direct(tf_session_get_bp(tfp), &parms);
 
 	return rc;
 }
@@ -1230,7 +1237,7 @@  tf_msg_em_mem_rgtr(struct tf *tfp,
 	parms.resp_size = sizeof(resp);
 	parms.mailbox = dev->ops->tf_dev_get_mailbox();
 
-	rc = tfp_send_msg_direct(tf_session_get_bp(tfs),
+	rc = tfp_send_msg_direct(tf_session_get_bp(tfp),
 				 &parms);
 	if (rc)
 		return rc;
@@ -1282,7 +1289,7 @@  tf_msg_em_mem_unrgtr(struct tf *tfp,
 	parms.resp_size = sizeof(resp);
 	parms.mailbox = dev->ops->tf_dev_get_mailbox();
 
-	rc = tfp_send_msg_direct(tf_session_get_bp(tfs),
+	rc = tfp_send_msg_direct(tf_session_get_bp(tfp),
 				 &parms);
 	return rc;
 }
@@ -1334,7 +1341,7 @@  tf_msg_em_qcaps(struct tf *tfp,
 	parms.resp_size = sizeof(resp);
 	parms.mailbox = dev->ops->tf_dev_get_mailbox();
 
-	rc = tfp_send_msg_direct(tf_session_get_bp(tfs),
+	rc = tfp_send_msg_direct(tf_session_get_bp(tfp),
 				 &parms);
 	if (rc)
 		return rc;
@@ -1409,7 +1416,7 @@  tf_msg_em_cfg(struct tf *tfp,
 	parms.resp_size = sizeof(resp);
 	parms.mailbox = dev->ops->tf_dev_get_mailbox();
 
-	rc = tfp_send_msg_direct(tf_session_get_bp(tfs),
+	rc = tfp_send_msg_direct(tf_session_get_bp(tfp),
 				 &parms);
 	return rc;
 }
@@ -1483,7 +1490,7 @@  tf_msg_ext_em_cfg(struct tf *tfp,
 	parms.resp_size = sizeof(resp);
 	parms.mailbox = dev->ops->tf_dev_get_mailbox();
 
-	rc = tfp_send_msg_direct(tf_session_get_bp(tfs),
+	rc = tfp_send_msg_direct(tf_session_get_bp(tfp),
 				 &parms);
 	return rc;
 }
@@ -1533,7 +1540,7 @@  tf_msg_em_op(struct tf *tfp,
 	parms.resp_size = sizeof(resp);
 	parms.mailbox = dev->ops->tf_dev_get_mailbox();
 
-	rc = tfp_send_msg_direct(tf_session_get_bp(tfs),
+	rc = tfp_send_msg_direct(tf_session_get_bp(tfp),
 				 &parms);
 	return rc;
 }
@@ -1611,7 +1618,7 @@  tf_msg_tcam_entry_set(struct tf *tfp,
 	mparms.resp_size = sizeof(resp);
 	mparms.mailbox = dev->ops->tf_dev_get_mailbox();
 
-	rc = tfp_send_msg_direct(tf_session_get_bp(tfs),
+	rc = tfp_send_msg_direct(tf_session_get_bp(tfp),
 				 &mparms);
 
 cleanup:
@@ -1664,7 +1671,7 @@  tf_msg_tcam_entry_get(struct tf *tfp,
 	mparms.resp_size = sizeof(resp);
 	mparms.mailbox = dev->ops->tf_dev_get_mailbox();
 
-	rc = tfp_send_msg_direct(tf_session_get_bp(tfs),
+	rc = tfp_send_msg_direct(tf_session_get_bp(tfp),
 				 &mparms);
 
 	if (rc != 0)
@@ -1735,7 +1742,7 @@  tf_msg_tcam_entry_free(struct tf *tfp,
 	parms.resp_size = sizeof(resp);
 	parms.mailbox = dev->ops->tf_dev_get_mailbox();
 
-	rc = tfp_send_msg_direct(tf_session_get_bp(tfs),
+	rc = tfp_send_msg_direct(tf_session_get_bp(tfp),
 				 &parms);
 	return rc;
 }
@@ -1816,7 +1823,7 @@  tf_msg_set_tbl_entry(struct tf *tfp,
 	parms.resp_size = sizeof(resp);
 	parms.mailbox = dev->ops->tf_dev_get_mailbox();
 
-	rc = tfp_send_msg_direct(tf_session_get_bp(tfs),
+	rc = tfp_send_msg_direct(tf_session_get_bp(tfp),
 				 &parms);
 	if (rc)
 		return rc;
@@ -1882,7 +1889,7 @@  tf_msg_get_tbl_entry(struct tf *tfp,
 	parms.resp_size = sizeof(resp);
 	parms.mailbox = dev->ops->tf_dev_get_mailbox();
 
-	rc = tfp_send_msg_direct(tf_session_get_bp(tfs),
+	rc = tfp_send_msg_direct(tf_session_get_bp(tfp),
 				 &parms);
 	if (rc)
 		return rc;
@@ -1968,7 +1975,7 @@  tf_msg_get_global_cfg(struct tf *tfp,
 	parms.resp_size = sizeof(resp);
 	parms.mailbox = dev->ops->tf_dev_get_mailbox();
 
-	rc = tfp_send_msg_direct(tf_session_get_bp(tfs), &parms);
+	rc = tfp_send_msg_direct(tf_session_get_bp(tfp), &parms);
 	if (rc != 0)
 		return rc;
 
@@ -2069,7 +2076,7 @@  tf_msg_set_global_cfg(struct tf *tfp,
 	parms.resp_size = sizeof(resp);
 	parms.mailbox = dev->ops->tf_dev_get_mailbox();
 
-	rc = tfp_send_msg_direct(tf_session_get_bp(tfs), &parms);
+	rc = tfp_send_msg_direct(tf_session_get_bp(tfp), &parms);
 
 	if (rc != 0)
 		return rc;
@@ -2142,7 +2149,7 @@  tf_msg_bulk_get_tbl_entry(struct tf *tfp,
 	parms.resp_size = sizeof(resp);
 	parms.mailbox = dev->ops->tf_dev_get_mailbox();
 
-	rc = tfp_send_msg_direct(tf_session_get_bp(tfs),
+	rc = tfp_send_msg_direct(tf_session_get_bp(tfp),
 				 &parms);
 	if (rc)
 		return rc;
@@ -2205,7 +2212,7 @@  tf_msg_get_if_tbl_entry(struct tf *tfp,
 	parms.resp_size = sizeof(resp);
 	parms.mailbox = dev->ops->tf_dev_get_mailbox();
 
-	rc = tfp_send_msg_direct(tf_session_get_bp(tfs), &parms);
+	rc = tfp_send_msg_direct(tf_session_get_bp(tfp), &parms);
 
 	if (rc != 0)
 		return rc;
@@ -2262,7 +2269,7 @@  tf_msg_set_if_tbl_entry(struct tf *tfp,
 	parms.resp_size = sizeof(resp);
 	parms.mailbox = dev->ops->tf_dev_get_mailbox();
 
-	rc = tfp_send_msg_direct(tf_session_get_bp(tfs), &parms);
+	rc = tfp_send_msg_direct(tf_session_get_bp(tfp), &parms);
 
 	if (rc != 0)
 		return rc;
diff --git a/drivers/net/bnxt/tf_core/tf_session.c b/drivers/net/bnxt/tf_core/tf_session.c
index 391d8786ab..93876d8e5d 100644
--- a/drivers/net/bnxt/tf_core/tf_session.c
+++ b/drivers/net/bnxt/tf_core/tf_session.c
@@ -59,6 +59,8 @@  tf_session_create(struct tf *tfp,
 	union tf_session_id *session_id;
 	struct tf_dev_info dev;
 	bool shared_session_creator;
+	int name_len;
+	char *name;
 
 	TF_CHECK_PARMS2(tfp, parms);
 
@@ -140,7 +142,6 @@  tf_session_create(struct tf *tfp,
 	session_id->id = session->session_id.id;
 
 	session->shadow_copy = parms->open_cfg->shadow_copy;
-	session->bp = parms->open_cfg->bp;
 
 	/* Init session client list */
 	ll_init(&session->client_ll);
@@ -179,7 +180,12 @@  tf_session_create(struct tf *tfp,
 
 	/* Init session em_ext_db */
 	session->em_ext_db_handle = NULL;
-	if (!strcmp(parms->open_cfg->ctrl_chan_name, "tf_share"))
+
+	/* Populate the request */
+	name_len = strnlen(parms->open_cfg->ctrl_chan_name,
+			   TF_SESSION_NAME_MAX);
+	name = &parms->open_cfg->ctrl_chan_name[name_len - strlen("tf_shared")];
+	if (!strncmp(name, "tf_shared", strlen("tf_shared")))
 		session->shared_session = true;
 
 	if (session->shared_session && shared_session_creator) {
@@ -404,8 +410,9 @@  tf_session_open_session(struct tf *tfp,
 	int rc;
 	struct tf_session_client_create_parms scparms;
 
-	TF_CHECK_PARMS2(tfp, parms);
+	TF_CHECK_PARMS3(tfp, parms, parms->open_cfg->bp);
 
+	tfp->bp = parms->open_cfg->bp;
 	/* Decide if we're creating a new session or session client */
 	if (tfp->session == NULL) {
 		rc = tf_session_create(tfp, parms);
diff --git a/drivers/net/bnxt/tf_core/tf_session.h b/drivers/net/bnxt/tf_core/tf_session.h
index e2cebd20a1..034a2213a4 100644
--- a/drivers/net/bnxt/tf_core/tf_session.h
+++ b/drivers/net/bnxt/tf_core/tf_session.h
@@ -155,11 +155,6 @@  struct tf_session {
 	 */
 	void *em_db_handle;
 
-	/**
-	 * the pointer to the parent bp struct
-	 */
-	void *bp;
-
 	/**
 	 * EM allocator for session
 	 */
@@ -567,8 +562,8 @@  tf_session_is_shared_session_creator(struct tf_session *tfs)
  *   - the pointer to the parent bnxt struct
  */
 static inline struct bnxt*
-tf_session_get_bp(struct tf_session *tfs)
+tf_session_get_bp(struct tf *tfp)
 {
-	return tfs->bp;
+	return tfp->bp;
 }
 #endif /* _TF_SESSION_H_ */
diff --git a/drivers/net/bnxt/tf_core/tf_tbl.c b/drivers/net/bnxt/tf_core/tf_tbl.c
index 17fb550917..ca1aef8ebf 100644
--- a/drivers/net/bnxt/tf_core/tf_tbl.c
+++ b/drivers/net/bnxt/tf_core/tf_tbl.c
@@ -109,14 +109,16 @@  tf_tbl_unbind(struct tf *tfp)
 
 	rc = tf_session_get_db(tfp, TF_MODULE_TYPE_TABLE, &tbl_db_ptr);
 	if (rc) {
-		TFP_DRV_LOG(ERR,
-			    "Failed to get em_ext_db from session, rc:%s\n",
+		TFP_DRV_LOG(INFO,
+			    "Tbl_db is not initialized, rc:%s\n",
 			    strerror(-rc));
-		return rc;
+		return 0;
 	}
 	tbl_db = (struct tbl_rm_db *)tbl_db_ptr;
 
 	for (i = 0; i < TF_DIR_MAX; i++) {
+		if (tbl_db->tbl_db[i] == NULL)
+			continue;
 		fparms.dir = i;
 		fparms.rm_db = tbl_db->tbl_db[i];
 		rc = tf_rm_free_db(tfp, &fparms);
@@ -621,23 +623,36 @@  tf_tbl_get_resc_info(struct tf *tfp,
 		     struct tf_tbl_resource_info *tbl)
 {
 	int rc;
-	int d;
+	int d, i;
 	struct tf_resource_info *dinfo;
 	struct tf_rm_get_alloc_info_parms ainfo;
 	void *tbl_db_ptr = NULL;
 	struct tbl_rm_db *tbl_db;
+	uint16_t base = 0, shift = 0;
+	struct tf_dev_info *dev;
+	struct tf_session *tfs;
 
 	TF_CHECK_PARMS2(tfp, tbl);
 
+	/* Retrieve the session information */
+	rc = tf_session_get_session_internal(tfp, &tfs);
+	if (rc)
+		return rc;
+
+	/* Retrieve the device information */
+	rc = tf_session_get_device(tfs, &dev);
+	if (rc)
+		return rc;
+
 	rc = tf_session_get_db(tfp, TF_MODULE_TYPE_TABLE, &tbl_db_ptr);
 	if (rc) {
-		TFP_DRV_LOG(ERR,
-			    "Failed to get em_ext_db from session, rc:%s\n",
-			    strerror(-rc));
-		return rc;
+		TFP_DRV_LOG(INFO,
+			    "No resource allocated for table from session\n");
+		return 0;
 	}
 	tbl_db = (struct tbl_rm_db *)tbl_db_ptr;
 
+
 	/* check if reserved resource for WC is multiple of num_slices */
 	for (d = 0; d < TF_DIR_MAX; d++) {
 		ainfo.rm_db = tbl_db->tbl_db[d];
@@ -648,7 +663,33 @@  tf_tbl_get_resc_info(struct tf *tfp,
 		rc = tf_rm_get_all_info(&ainfo, TF_TBL_TYPE_MAX);
 		if (rc)
 			return rc;
+
+		if (dev->ops->tf_dev_get_tbl_info) {
+			/* Adjust all */
+			for (i = 0; i < TF_TBL_TYPE_MAX; i++) {
+				/* Only get table info if required for the device */
+				rc = dev->ops->tf_dev_get_tbl_info(tfp,
+								   tbl_db->tbl_db[d],
+								   i,
+								   &base,
+								   &shift);
+				if (rc) {
+					TFP_DRV_LOG(ERR,
+						    "%s: Failed to get table info:%d\n",
+						    tf_dir_2_str(d),
+						    i);
+					return rc;
+				}
+				if (dinfo[i].stride)
+					TF_TBL_RM_TO_PTR(&dinfo[i].start,
+							 dinfo[i].start,
+							 base,
+							 shift);
+			}
+		}
 	}
 
+
+
 	return 0;
 }
diff --git a/drivers/net/bnxt/tf_core/tf_tcam.c b/drivers/net/bnxt/tf_core/tf_tcam.c
index 70dc539f15..0f05af87f1 100644
--- a/drivers/net/bnxt/tf_core/tf_tcam.c
+++ b/drivers/net/bnxt/tf_core/tf_tcam.c
@@ -220,14 +220,16 @@  tf_tcam_unbind(struct tf *tfp)
 
 	rc = tf_session_get_db(tfp, TF_MODULE_TYPE_TCAM, &tcam_db_ptr);
 	if (rc) {
-		TFP_DRV_LOG(ERR,
-			    "Failed to get em_ext_db from session, rc:%s\n",
+		TFP_DRV_LOG(INFO,
+			    "Tcam_db is not initialized, rc:%s\n",
 			    strerror(-rc));
-		return rc;
+		return 0;
 	}
 	tcam_db = (struct tcam_rm_db *)tcam_db_ptr;
 
 	for (i = 0; i < TF_DIR_MAX; i++) {
+		if (tcam_db->tcam_db[i] == NULL)
+			continue;
 		memset(&fparms, 0, sizeof(fparms));
 		fparms.dir = i;
 		fparms.rm_db = tcam_db->tcam_db[i];
@@ -816,10 +818,9 @@  tf_tcam_get_resc_info(struct tf *tfp,
 
 	rc = tf_session_get_db(tfp, TF_MODULE_TYPE_TCAM, &tcam_db_ptr);
 	if (rc) {
-		TFP_DRV_LOG(ERR,
-			    "Failed to get em_ext_db from session, rc:%s\n",
-			    strerror(-rc));
-		return rc;
+		TFP_DRV_LOG(INFO,
+			    "No resource allocated for tcam from session\n");
+		return 0;
 	}
 	tcam_db = (struct tcam_rm_db *)tcam_db_ptr;
 
diff --git a/drivers/net/bnxt/tf_core/tfp.c b/drivers/net/bnxt/tf_core/tfp.c
index 4d9b37f749..a4b0934610 100644
--- a/drivers/net/bnxt/tf_core/tfp.c
+++ b/drivers/net/bnxt/tf_core/tfp.c
@@ -134,7 +134,7 @@  tfp_get_fid(struct tf *tfp, uint16_t *fw_fid)
 	if (tfp == NULL || fw_fid == NULL)
 		return -EINVAL;
 
-	bp = container_of(tfp, struct bnxt, tfp);
+	bp = (struct bnxt *)tfp->bp;
 	if (bp == NULL)
 		return -EINVAL;
 
@@ -151,7 +151,7 @@  tfp_get_pf(struct tf *tfp, uint16_t *pf)
 	if (tfp == NULL || pf == NULL)
 		return -EINVAL;
 
-	bp = container_of(tfp, struct bnxt, tfp);
+	bp = (struct bnxt *)tfp->bp;
 	if (BNXT_VF(bp) && bp->parent) {
 		*pf = bp->parent->fid - 1;
 		return 0;