[v6,23/47] net/bnxt: tf_ulp: VFR updates for Thor 2

Message ID 20241021082607.232829-24-sriharsha.basavapatna@broadcom.com (mailing list archive)
State Changes Requested, archived
Delegated to: Ajit Khaparde
Headers
Series TruFlow update for Thor2 |

Checks

Context Check Description
ci/checkpatch warning coding style issues

Commit Message

Sriharsha Basavapatna Oct. 21, 2024, 8:25 a.m. UTC
From: Mike Baucom <michael.baucom@broadcom.com>

Update to VFR code to:
- add the endpoint (efid) to the session
- modify the generic tables to write the l2 context id
- tfc session code changes to allow the efid to be added to the sid
- release both rfid and efid from afm

This patch includes a few related changes:

Thor2 change the counter get to clear on request
	Allow the caller to either clear on read or simply read based
	on their request.

Reject duplicate EM flow entry
	It is not necessary to add an duplicate EM entry to WC.
	This change will reject it.

Signed-off-by: Mike Baucom <michael.baucom@broadcom.com>
Signed-off-by: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
Reviewed-by: Farah Smith <farah.smith@broadcom.com>
Reviewed-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c           |  15 +++
 drivers/net/bnxt/bnxt_reps.c             |  63 ++++++++++---
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c       |  28 ++++++
 drivers/net/bnxt/tf_ulp/bnxt_ulp.h       |  12 +++
 drivers/net/bnxt/tf_ulp/bnxt_ulp_tf.c    |   2 +
 drivers/net/bnxt/tf_ulp/bnxt_ulp_tfc.c   | 115 ++++++++++++++++++-----
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr_tfc.c |  11 ++-
 drivers/net/bnxt/tf_ulp/ulp_mapper_tfc.c |  33 ++++++-
 8 files changed, 231 insertions(+), 48 deletions(-)
  

Patch

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 50b1e26126..2a0b06c97b 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1846,6 +1846,21 @@  int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
 
 	/* Initialize bnxt ULP port details */
 	if (bnxt_enable_ulp(bp)) {
+		if (BNXT_CHIP_P7(bp)) {
+			/* Need to release the Fid from AFM control */
+			rc = bnxt_hwrm_release_afm_func(bp, bp->fw_fid,
+							bp->fw_fid,
+							HWRM_CFA_RELEASE_AFM_FUNC_INPUT_TYPE_RFID,
+							0);
+			if (rc) {
+				PMD_DRV_LOG_LINE(ERR,
+						 "Failed in hwrm release afm func:%u rc=%d",
+						 bp->fw_fid, rc);
+				goto error;
+			}
+			PMD_DRV_LOG_LINE(DEBUG, "Released RFID:%d", bp->fw_fid);
+		}
+
 		rc = bnxt_ulp_port_init(bp);
 		if (rc)
 			goto error;
diff --git a/drivers/net/bnxt/bnxt_reps.c b/drivers/net/bnxt/bnxt_reps.c
index 3f58f29ec6..00900ad631 100644
--- a/drivers/net/bnxt/bnxt_reps.c
+++ b/drivers/net/bnxt/bnxt_reps.c
@@ -34,7 +34,7 @@  static const struct eth_dev_ops bnxt_rep_dev_ops = {
 
 static bool bnxt_rep_check_parent(struct bnxt_representor *rep)
 {
-	if (!rep->parent_dev->data->dev_private)
+	if (!rep->parent_dev->data || !rep->parent_dev->data->dev_private)
 		return false;
 
 	return true;
@@ -357,28 +357,41 @@  static int bnxt_tf_vfr_alloc(struct rte_eth_dev *vfr_ethdev)
 		rc = bnxt_hwrm_release_afm_func(parent_bp,
 				vfr->fw_fid,
 				parent_bp->fw_fid,
-				HWRM_CFA_RELEASE_AFM_FUNC_INPUT_TYPE_RFID,
+				HWRM_CFA_RELEASE_AFM_FUNC_INPUT_TYPE_EFID,
 				0);
 
-		if (rc)
+		if (rc) {
 			PMD_DRV_LOG_LINE(ERR,
-					 "Failed in hwrm release afm func:%u rc=%d",
-					 vfr->vf_id, rc);
+					 "Failed to release EFID:%d from RFID:%d rc=%d",
+					 vfr->vf_id, parent_bp->fw_fid, rc);
+			goto error_del_rules;
+		}
+		PMD_DRV_LOG_LINE(DEBUG, "Released EFID:%d from RFID:%d",
+				 vfr->fw_fid, parent_bp->fw_fid);
+
 	} else {
 		rc = bnxt_hwrm_cfa_pair_alloc(parent_bp, vfr);
-		if (rc)
+		if (rc) {
 			PMD_DRV_LOG_LINE(ERR,
 					 "Failed in hwrm vfr alloc vfr:%u rc=%d",
 					 vfr->vf_id, rc);
+			goto error_del_rules;
+		}
 	}
 
+	/* if supported, it will add the vfr endpoint to the session, otherwise
+	 * it returns success
+	 */
+	rc = bnxt_ulp_vfr_session_fid_add(parent_bp->ulp_ctx, vfr->fw_fid);
 	if (rc)
-		(void)bnxt_ulp_delete_vfr_default_rules(vfr);
+		goto error_del_rules;
 	else
 		PMD_DRV_LOG_LINE(DEBUG,
 				 "BNXT Port:%d VFR created and initialized",
 				 vfr->dpdk_port_id);
-
+	return rc;
+error_del_rules:
+	(void)bnxt_ulp_delete_vfr_default_rules(vfr);
 	return rc;
 }
 
@@ -490,9 +503,29 @@  int bnxt_rep_dev_start_op(struct rte_eth_dev *eth_dev)
 
 static int bnxt_tf_vfr_free(struct bnxt_representor *vfr)
 {
-	PMD_DRV_LOG_LINE(DEBUG, "BNXT Port:%d VFR ulp free",
-			 vfr->dpdk_port_id);
-	return bnxt_ulp_delete_vfr_default_rules(vfr);
+	struct bnxt *parent_bp;
+	int32_t rc;
+
+	PMD_DRV_LOG_LINE(DEBUG, "BNXT Port:%d VFR ulp free", vfr->dpdk_port_id);
+	rc = bnxt_ulp_delete_vfr_default_rules(vfr);
+	if (rc)
+		PMD_DRV_LOG_LINE(ERR,
+				 "Failed to delete dflt rules from Port:%d VFR",
+				 vfr->dpdk_port_id);
+
+	/* Need to remove the vfr fid from the session regardless */
+	parent_bp = vfr->parent_dev->data->dev_private;
+	if (!parent_bp) {
+		PMD_DRV_LOG_LINE(DEBUG, "BNXT Port:%d VFR already freed",
+				 vfr->dpdk_port_id);
+		return 0;
+	}
+	rc = bnxt_ulp_vfr_session_fid_rem(parent_bp->ulp_ctx, vfr->fw_fid);
+	if (rc)
+		PMD_DRV_LOG_LINE(ERR,
+				 "Failed to remove BNXT Port:%d VFR from session",
+				 vfr->dpdk_port_id);
+	return rc;
 }
 
 static int bnxt_vfr_free(struct bnxt_representor *vfr)
@@ -568,13 +601,15 @@  int bnxt_rep_dev_info_get_op(struct rte_eth_dev *eth_dev,
 	struct bnxt_representor *rep_bp = eth_dev->data->dev_private;
 	struct bnxt *parent_bp;
 	unsigned int max_rx_rings;
-	int rc = 0;
 
 	/* MAC Specifics */
 	if (!bnxt_rep_check_parent(rep_bp)) {
+		PMD_DRV_LOG_LINE(INFO, "Rep parent port does not exist");
+		/* Need be an error scenario, if parent is removed first */
+		if (eth_dev->device->driver == NULL)
+			return -ENODEV;
 		/* Need not be an error scenario, if parent is closed first */
-		PMD_DRV_LOG_LINE(INFO, "Rep parent port does not exist.");
-		return rc;
+		return 0;
 	}
 	parent_bp = rep_bp->parent_dev->data->dev_private;
 	PMD_DRV_LOG_LINE(DEBUG, "Representor dev_info_get_op");
diff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp.c b/drivers/net/bnxt/tf_ulp/bnxt_ulp.c
index 037723f20c..a942af4486 100644
--- a/drivers/net/bnxt/tf_ulp/bnxt_ulp.c
+++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp.c
@@ -1567,3 +1567,31 @@  bnxt_ulp_feature_bits_get(struct bnxt_ulp_context *ulp_ctx)
 	return ulp_ctx->cfg_data->feature_bits;
 }
 
+/* Add the VF Rep endpoint to the session */
+int32_t
+bnxt_ulp_vfr_session_fid_add(struct bnxt_ulp_context *ulp_ctx,
+			     uint16_t vfr_fid)
+{
+	int32_t rc = 0;
+
+	if (ulp_ctx == NULL || ulp_ctx->ops == NULL)
+		return -EINVAL;
+	if (ulp_ctx->ops->ulp_vfr_session_fid_add)
+		rc = ulp_ctx->ops->ulp_vfr_session_fid_add(ulp_ctx, vfr_fid);
+
+	return rc;
+}
+
+/* Remove the VF Rep endpoint from the session */
+int32_t
+bnxt_ulp_vfr_session_fid_rem(struct bnxt_ulp_context *ulp_ctx,
+			     uint16_t vfr_fid)
+{
+	int32_t rc = 0;
+
+	if (ulp_ctx == NULL || ulp_ctx->ops == NULL)
+		return -EINVAL;
+	if (ulp_ctx->ops->ulp_vfr_session_fid_rem)
+		rc = ulp_ctx->ops->ulp_vfr_session_fid_rem(ulp_ctx, vfr_fid);
+	return rc;
+}
diff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp.h b/drivers/net/bnxt/tf_ulp/bnxt_ulp.h
index 3ab142767f..9ea34eab3b 100644
--- a/drivers/net/bnxt/tf_ulp/bnxt_ulp.h
+++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp.h
@@ -220,6 +220,12 @@  struct bnxt_ulp_core_ops {
 	void
 	(*ulp_ctx_detach)(struct bnxt *bp,
 			  struct bnxt_ulp_session_state *session);
+	int32_t
+	(*ulp_vfr_session_fid_add)(struct bnxt_ulp_context *ulp_ctx,
+				  uint16_t rep_fid);
+	int32_t
+	(*ulp_vfr_session_fid_rem)(struct bnxt_ulp_context *ulp_ctx,
+				  uint16_t rep_fid);
 };
 
 extern const struct bnxt_ulp_core_ops bnxt_ulp_tf_core_ops;
@@ -581,4 +587,10 @@  int32_t bnxt_ulp_num_key_recipes_get(struct bnxt_ulp_context *ulp_ctx);
 uint64_t
 bnxt_ulp_feature_bits_get(struct bnxt_ulp_context *ulp_ctx);
 
+int32_t
+bnxt_ulp_vfr_session_fid_add(struct bnxt_ulp_context *ulp_ctx,
+			     uint16_t vfr_fid);
+int32_t
+bnxt_ulp_vfr_session_fid_rem(struct bnxt_ulp_context *ulp_ctx,
+			     uint16_t vfr_fid);
 #endif /* _BNXT_ULP_H_ */
diff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp_tf.c b/drivers/net/bnxt/tf_ulp/bnxt_ulp_tf.c
index 00a36b2e82..2d46d21a5d 100644
--- a/drivers/net/bnxt/tf_ulp/bnxt_ulp_tf.c
+++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp_tf.c
@@ -1511,4 +1511,6 @@  const struct bnxt_ulp_core_ops bnxt_ulp_tf_core_ops = {
 	.ulp_ctx_detach = ulp_tf_ctx_detach,
 	.ulp_deinit =  ulp_tf_deinit,
 	.ulp_init =  ulp_tf_init,
+	.ulp_vfr_session_fid_add = NULL,
+	.ulp_vfr_session_fid_rem = NULL
 };
diff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp_tfc.c b/drivers/net/bnxt/tf_ulp/bnxt_ulp_tfc.c
index 191eb09160..45a4d8bf64 100644
--- a/drivers/net/bnxt/tf_ulp/bnxt_ulp_tfc.c
+++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp_tfc.c
@@ -336,7 +336,7 @@  ulp_tfc_tbl_scope_init(struct bnxt *bp)
 {
 	struct tfc_tbl_scope_mem_alloc_parms mem_parms;
 	struct tfc_tbl_scope_size_query_parms qparms =  { 0 };
-	uint8_t max_lkup_sz[CFA_DIR_MAX], max_act_sz[CFA_DIR_MAX];
+	uint16_t max_lkup_sz[CFA_DIR_MAX], max_act_sz[CFA_DIR_MAX];
 	struct tfc_tbl_scope_cpm_alloc_parms cparms;
 	uint16_t fid, max_pools;
 	bool first = true, shared = false;
@@ -681,6 +681,71 @@  ulp_tfc_ctx_init(struct bnxt *bp,
 	return rc;
 }
 
+static int32_t
+ulp_tfc_vfr_session_fid_add(struct bnxt_ulp_context *ulp_ctx, uint16_t rep_fid)
+{
+	uint16_t fid_cnt = 0, sid = 0;
+	struct tfc *tfcp = NULL;
+	int rc;
+
+	tfcp = bnxt_ulp_cntxt_tfcp_get(ulp_ctx);
+	if (!tfcp) {
+		PMD_DRV_LOG_LINE(ERR, "Unable to get tfcp from ulp_ctx");
+		return -EINVAL;
+	}
+
+	/* Get the session id */
+	rc = bnxt_ulp_cntxt_sid_get(ulp_ctx, &sid);
+	if (rc) {
+		PMD_DRV_LOG_LINE(ERR, "Unable to get SID for VFR FID=%d", rep_fid);
+		return rc;
+	}
+
+	rc = tfc_session_fid_add(tfcp, rep_fid, sid, &fid_cnt);
+	if (!rc)
+		PMD_DRV_LOG_LINE(DEBUG,
+				 "EFID=%d added to SID=%d, %d total",
+				 rep_fid, sid, fid_cnt);
+	else
+		PMD_DRV_LOG_LINE(ERR,
+				 "Failed to add EFID=%d to SID=%d",
+				 rep_fid, sid);
+	return rc;
+}
+
+static int32_t
+ulp_tfc_vfr_session_fid_rem(struct bnxt_ulp_context *ulp_ctx, uint16_t rep_fid)
+{
+	uint16_t fid_cnt = 0, sid = 0;
+	struct tfc *tfcp = NULL;
+	int rc;
+
+	tfcp = bnxt_ulp_cntxt_tfcp_get(ulp_ctx);
+	if (!tfcp) {
+		PMD_DRV_LOG_LINE(ERR, "Unable tfcp from ulp_ctx");
+		return -EINVAL;
+	}
+
+	/* Get the session id */
+	rc = bnxt_ulp_cntxt_sid_get(ulp_ctx, &sid);
+	if (rc) {
+		PMD_DRV_LOG_LINE(ERR, "Unable to get SID for VFR FID=%d", rep_fid);
+		return rc;
+	}
+
+	rc = tfc_session_fid_rem(tfcp, rep_fid, &fid_cnt);
+	if (!rc)
+		PMD_DRV_LOG_LINE(DEBUG,
+				 "Removed EFID=%d from SID=%d, %d remain",
+				 rep_fid, sid, fid_cnt);
+	else
+		PMD_DRV_LOG_LINE(ERR,
+				 "Failed to remove EFID=%d from SID=%d",
+				 rep_fid, sid);
+
+	return rc;
+}
+
 static int32_t
 ulp_tfc_ctx_attach(struct bnxt *bp,
 		   struct bnxt_ulp_session_state *session)
@@ -703,6 +768,12 @@  ulp_tfc_ctx_attach(struct bnxt *bp,
 		return rc;
 	}
 
+	rc = bnxt_ulp_devid_get(bp, &dev_id);
+	if (rc) {
+		BNXT_DRV_DBG(ERR, "Unable to get device id from ulp.\n");
+		return rc;
+	}
+
 	/* Increment the ulp context data reference count usage. */
 	bp->ulp_ctx->cfg_data = session->cfg_data;
 	bp->ulp_ctx->cfg_data->ref_cnt++;
@@ -710,12 +781,12 @@  ulp_tfc_ctx_attach(struct bnxt *bp,
 	rc = tfc_session_fid_add(&bp->tfcp, bp->fw_fid,
 				 session->session_id, &fid_cnt);
 	if (rc) {
-		BNXT_DRV_DBG(ERR, "Failed to add FID:%d to SID:%d.\n",
+		BNXT_DRV_DBG(ERR, "Failed to add RFID:%d to SID:%d.\n",
 			     bp->fw_fid, session->session_id);
 		return rc;
 	}
-	BNXT_DRV_DBG(DEBUG, "SID:%d added FID:%d\n",
-		     session->session_id, bp->fw_fid);
+	BNXT_DRV_DBG(DEBUG, "RFID:%d added to SID:%d\n",
+		     bp->fw_fid, session->session_id);
 
 	rc = bnxt_ulp_cntxt_sid_set(bp->ulp_ctx, session->session_id);
 	if (rc) {
@@ -739,13 +810,6 @@  ulp_tfc_ctx_attach(struct bnxt *bp,
 		BNXT_DRV_DBG(ERR, "Unable to get the app id from ulp.\n");
 		return -EINVAL;
 	}
-
-	rc = bnxt_ulp_cntxt_dev_id_get(bp->ulp_ctx, &dev_id);
-	if (rc) {
-		BNXT_DRV_DBG(ERR, "Unable do get the dev_id.\n");
-		return -EINVAL;
-	}
-
 	flags = bp->ulp_ctx->cfg_data->ulp_flags;
 	if (ULP_APP_DEV_UNSUPPORTED_ENABLED(flags)) {
 		BNXT_DRV_DBG(ERR, "APP ID %d, Device ID: 0x%x not supported.\n",
@@ -769,11 +833,11 @@  ulp_tfc_ctx_detach(struct bnxt *bp,
 
 	rc = tfc_session_fid_rem(&bp->tfcp, bp->fw_fid, &fid_cnt);
 	if (rc)
-		BNXT_DRV_DBG(ERR, "Failed to remove FID:%d from SID:%d\n",
+		BNXT_DRV_DBG(ERR, "Failed to remove RFID:%d from SID:%d\n",
 			     bp->fw_fid, session->session_id);
 	else
-		BNXT_DRV_DBG(DEBUG, "SID:%d removed FID:%d CNT:%d\n",
-			     session->session_id, bp->fw_fid, fid_cnt);
+		BNXT_DRV_DBG(DEBUG, "Removed RFID:%d from SID:%d CNT:%d\n",
+			     bp->fw_fid, session->session_id, fid_cnt);
 	bnxt_ulp_cntxt_sid_reset(bp->ulp_ctx);
 	(void)tfc_close(&bp->tfcp);
 }
@@ -826,11 +890,11 @@  ulp_tfc_deinit(struct bnxt *bp,
 
 	rc = tfc_session_fid_rem(&bp->tfcp, bp->fw_fid, &fid_cnt);
 	if (rc)
-		BNXT_DRV_DBG(ERR, "Failed to remove FID:%d from SID:%d\n",
+		BNXT_DRV_DBG(ERR, "Failed to remove RFID:%d from SID:%d\n",
 			     bp->fw_fid, session->session_id);
 	else
-		BNXT_DRV_DBG(DEBUG, "SID:%d removed FID:%d CNT:%d\n",
-			     session->session_id, bp->fw_fid, fid_cnt);
+		BNXT_DRV_DBG(DEBUG, "Removed RFID:%d from SID:%d CNT:%d\n",
+			     bp->fw_fid, session->session_id, fid_cnt);
 	bnxt_ulp_cntxt_sid_reset(bp->ulp_ctx);
 	(void)tfc_close(&bp->tfcp);
 
@@ -853,6 +917,12 @@  ulp_tfc_init(struct bnxt *bp,
 	uint16_t sid;
 	int rc;
 
+	rc = bnxt_ulp_devid_get(bp, &ulp_dev_id);
+	if (rc) {
+		BNXT_DRV_DBG(ERR, "Unable to get device id from ulp.\n");
+		return rc;
+	}
+
 	bp->tfcp.bp = bp;
 	rc = tfc_open(&bp->tfcp);
 	if (rc) {
@@ -872,7 +942,7 @@  ulp_tfc_init(struct bnxt *bp,
 		BNXT_DRV_DBG(ERR, "Failed to allocate a session id\n");
 		return rc;
 	}
-	BNXT_DRV_DBG(DEBUG, "SID:%d allocated with FID:%d\n", sid, bp->fw_fid);
+	BNXT_DRV_DBG(DEBUG, "SID:%d allocated with RFID:%d\n", sid, bp->fw_fid);
 	session->session_id = sid;
 	rc = bnxt_ulp_cntxt_sid_set(bp->ulp_ctx, sid);
 	if (rc) {
@@ -899,13 +969,6 @@  ulp_tfc_init(struct bnxt *bp,
 		goto jump_to_error;
 	}
 
-	/* Initialize ulp dparms with values devargs passed */
-	rc = bnxt_ulp_cntxt_dev_id_get(bp->ulp_ctx, &ulp_dev_id);
-	if (rc) {
-		BNXT_DRV_DBG(ERR, "Unable to get device id from ulp.\n");
-		return rc;
-	}
-
 	rc = ulp_tfc_dparms_init(bp, bp->ulp_ctx, ulp_dev_id);
 	if (rc) {
 		BNXT_DRV_DBG(ERR, "Failed to initialize the dparms\n");
@@ -968,4 +1031,6 @@  const struct bnxt_ulp_core_ops bnxt_ulp_tfc_core_ops = {
 	.ulp_ctx_detach = ulp_tfc_ctx_detach,
 	.ulp_deinit =  ulp_tfc_deinit,
 	.ulp_init =  ulp_tfc_init,
+	.ulp_vfr_session_fid_add = ulp_tfc_vfr_session_fid_add,
+	.ulp_vfr_session_fid_rem = ulp_tfc_vfr_session_fid_rem
 };
diff --git a/drivers/net/bnxt/tf_ulp/ulp_fc_mgr_tfc.c b/drivers/net/bnxt/tf_ulp/ulp_fc_mgr_tfc.c
index 2be37b59c2..24299a269b 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_fc_mgr_tfc.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_fc_mgr_tfc.c
@@ -83,10 +83,13 @@  ulp_fc_tfc_flow_stat_get(struct bnxt_ulp_context *ctxt,
 	cmm_info.rsubtype = CFA_RSUBTYPE_CMM_ACT;
 	cmm_info.act_handle = handle;
 	cmm_info.dir = (enum cfa_dir)direction;
-	cmm_clr.clr = true;
-	cmm_clr.offset_in_byte = 0;
-	cmm_clr.sz_in_byte = sizeof(data64[ULP_FC_TFC_PKT_CNT_OFFS]) +
-			     sizeof(data64[ULP_FC_TFC_BYTE_CNT_OFFS]);
+	/* Read and Clear the hw stat if requested */
+	if (count->reset) {
+		cmm_clr.clr = true;
+		cmm_clr.offset_in_byte = 0;
+		cmm_clr.sz_in_byte = sizeof(data64[ULP_FC_TFC_PKT_CNT_OFFS]) +
+			sizeof(data64[ULP_FC_TFC_BYTE_CNT_OFFS]);
+	}
 	rc = tfc_act_get(tfcp, NULL, &cmm_info, &cmm_clr, data, &word_size);
 	if (rc) {
 		BNXT_DRV_DBG(ERR,
diff --git a/drivers/net/bnxt/tf_ulp/ulp_mapper_tfc.c b/drivers/net/bnxt/tf_ulp/ulp_mapper_tfc.c
index a2fa2d4eed..80f5989991 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_mapper_tfc.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_mapper_tfc.c
@@ -608,8 +608,12 @@  ulp_mapper_tfc_em_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 		if (tbl->tbl_opcode == BNXT_ULP_EM_TBL_OPC_WR_REGFILE) {
 			uint64_t val = 0;
 
-			/* over max flows or hash collision */
-			if (rc == -E2BIG || rc == -ENOMEM) {
+			/* hash collision */
+			if (rc == -E2BIG)
+				BNXT_DRV_DBG(DEBUG, "Dulicate EM entry\n");
+
+			/* over max flows */
+			if (rc == -ENOMEM) {
 				val = 1;
 				rc = 0;
 				BNXT_DRV_DBG(DEBUG,
@@ -618,9 +622,11 @@  ulp_mapper_tfc_em_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 			ulp_regfile_write(parms->regfile, tbl->tbl_operand,
 					  rte_cpu_to_be_64(val));
 		}
-		if (rc)
+
+		if (rc && rc != -E2BIG)
 			BNXT_DRV_DBG(ERR,
 				     "Failed to insert em entry rc=%d.\n", rc);
+
 		if (rc && error != NULL && tfc_is_mpc_error(rc))
 			rte_flow_error_set((struct rte_flow_error *)error, EIO,
 					   RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
@@ -1021,6 +1027,7 @@  ulp_mapper_tfc_index_entry_free(struct bnxt_ulp_context *ulp_ctx,
 	struct tfc *tfcp = NULL;
 	struct tfc_idx_tbl_info tbl_info = { 0 };
 	uint16_t fw_fid = 0;
+	int32_t rc;
 
 	if (bnxt_ulp_cntxt_fid_get(ulp_ctx, &fw_fid)) {
 		BNXT_DRV_DBG(ERR, "Failed to get func_id\n");
@@ -1039,7 +1046,16 @@  ulp_mapper_tfc_index_entry_free(struct bnxt_ulp_context *ulp_ctx,
 	tbl_info.id = (uint16_t)res->resource_hndl;
 
 	/* TBD: check to see if the memory needs to be cleaned as well*/
-	return tfc_idx_tbl_free(tfcp, fw_fid, &tbl_info);
+	rc = tfc_idx_tbl_free(tfcp, fw_fid, &tbl_info);
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG_MAPPER
+	if (!rc)
+		BNXT_DRV_DBG(DEBUG, "Freed Index [%s]:[%s] = 0x%X\n",
+		     tfc_dir_2_str(tbl_info.dir),
+		     tfc_idx_tbl_2_str(tbl_info.rsubtype), tbl_info.id);
+#endif
+#endif
+	return rc;
 }
 
 static int32_t
@@ -1568,7 +1584,7 @@  ulp_mapper_tfc_ident_free(struct bnxt_ulp_context *ulp_ctx,
 	}
 #ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
 #ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG_MAPPER
-	BNXT_DRV_INF("Freed Identifier [%s]:[%s] = 0x%X\n",
+	BNXT_DRV_DBG(DEBUG, "Freed Identifier [%s]:[%s] = 0x%X\n",
 		     tfc_dir_2_str(ident_info.dir),
 		     tfc_ident_2_str(ident_info.rsubtype), ident_info.id);
 #endif
@@ -1604,6 +1620,13 @@  ulp_mapper_tfc_tcam_entry_free(struct bnxt_ulp_context *ulp,
 			    tcam_info.id);
 		return -EINVAL;
 	}
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG_MAPPER
+	BNXT_DRV_DBG(DEBUG, "Freed TCAM [%s]:[%s] = 0x%X\n",
+		     tfc_dir_2_str(tcam_info.dir),
+		     tfc_tcam_2_str(tcam_info.rsubtype), tcam_info.id);
+#endif
+#endif
 	return 0;
 }