DPDK patches and discussions
 help / color / mirror / Atom feed
From: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
To: dev@dpdk.org
Cc: Mike Baucom <michael.baucom@broadcom.com>,
	Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>,
	Farah Smith <farah.smith@broadcom.com>,
	Kishore Padmanabha <kishore.padmanabha@broadcom.com>,
	Ajit Khaparde <ajit.khaparde@broadcom.com>
Subject: [PATCH v3 23/47] net/bnxt: tf_ulp: VFR updates for Thor 2
Date: Tue,  1 Oct 2024 11:28:09 +0530	[thread overview]
Message-ID: <20241001055833.757163-24-sriharsha.basavapatna@broadcom.com> (raw)
In-Reply-To: <20241001055833.757163-1-sriharsha.basavapatna@broadcom.com>

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             |  60 +++++++++---
 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   | 114 ++++++++++++++++++-----
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr_tfc.c |  11 ++-
 drivers/net/bnxt/tf_ulp/ulp_mapper_tfc.c |  33 ++++++-
 8 files changed, 229 insertions(+), 46 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 2c638193a5..aac487bdb2 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1800,6 +1800,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(ERR,
+					    "Failed in hwrm release afm func:%u rc=%d\n",
+					    bp->fw_fid, rc);
+				goto error;
+			}
+			PMD_DRV_LOG(DEBUG, "Released RFID:%d\n", 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 701f75f53c..f058f1aac2 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(ERR,
-			    "Failed in hwrm release afm func:%u rc=%d\n",
-			    vfr->vf_id, rc);
+			    "Failed to release EFID:%d from RFID:%d rc=%d\n",
+			    vfr->vf_id, parent_bp->fw_fid, rc);
+			goto error_del_rules;
+		}
+		PMD_DRV_LOG(DEBUG, "Released EFID:%d from RFID:%d\n",
+			    vfr->fw_fid, parent_bp->fw_fid);
+
 	} else {
 		rc = bnxt_hwrm_cfa_pair_alloc(parent_bp, vfr);
-		if (rc)
+		if (rc) {
 			PMD_DRV_LOG(ERR,
 				    "Failed in hwrm vfr alloc vfr:%u rc=%d\n",
 				    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(DEBUG,
 			    "BNXT Port:%d VFR created and initialized\n",
 			    vfr->dpdk_port_id);
-
+	return rc;
+error_del_rules:
+	(void)bnxt_ulp_delete_vfr_default_rules(vfr);
 	return rc;
 }
 
@@ -489,8 +502,29 @@ int bnxt_rep_dev_start_op(struct rte_eth_dev *eth_dev)
 
 static int bnxt_tf_vfr_free(struct bnxt_representor *vfr)
 {
+	struct bnxt *parent_bp;
+	int32_t rc;
+
 	PMD_DRV_LOG(DEBUG, "BNXT Port:%d VFR ulp free\n", vfr->dpdk_port_id);
-	return bnxt_ulp_delete_vfr_default_rules(vfr);
+	rc = bnxt_ulp_delete_vfr_default_rules(vfr);
+	if (rc)
+		PMD_DRV_LOG(ERR,
+			    "Failed to delete dflt rules from Port:%d VFR\n",
+			    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(DEBUG, "BNXT Port:%d VFR already freed\n",
+			    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(ERR,
+			    "Failed to remove BNXT Port:%d VFR from session\n",
+			    vfr->dpdk_port_id);
+	return rc;
 }
 
 static int bnxt_vfr_free(struct bnxt_representor *vfr)
@@ -564,13 +598,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)) {
-		/* Need not be an error scenario, if parent is closed first */
 		PMD_DRV_LOG(INFO, "Rep parent port does not exist.\n");
-		return rc;
+		/* 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 */
+		return 0;
 	}
 	parent_bp = rep_bp->parent_dev->data->dev_private;
 	PMD_DRV_LOG(DEBUG, "Representor dev_info_get_op\n");
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..3e934c861a 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,70 @@ 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(ERR, "Unable to get tfcp from ulp_ctx\n");
+		return -EINVAL;
+	}
+
+	/* Get the session id */
+	rc = bnxt_ulp_cntxt_sid_get(ulp_ctx, &sid);
+	if (rc) {
+		PMD_DRV_LOG(ERR, "Unable to get SID for VFR FID=%d\n", rep_fid);
+		return rc;
+	}
+
+	rc = tfc_session_fid_add(tfcp, rep_fid, sid, &fid_cnt);
+	if (!rc)
+		PMD_DRV_LOG(DEBUG,
+			    "EFID=%d added to SID=%d, %d total.\n",
+			    rep_fid, sid, fid_cnt);
+	else
+		PMD_DRV_LOG(ERR,
+			    "Failed to add EFID=%d to SID=%d\n",
+			    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(ERR, "Unable tfcp from ulp_ctx\n");
+		return -EINVAL;
+	}
+
+	/* Get the session id */
+	rc = bnxt_ulp_cntxt_sid_get(ulp_ctx, &sid);
+	if (rc) {
+		PMD_DRV_LOG(ERR, "Unable to get SID for VFR FID=%d\n", rep_fid);
+		return rc;
+	}
+
+	rc = tfc_session_fid_rem(tfcp, rep_fid, &fid_cnt);
+	if (!rc)
+		PMD_DRV_LOG(DEBUG,
+			    "Removed EFID=%d from SID=%d, %d remain.\n",
+			    rep_fid, sid, fid_cnt);
+	else
+		PMD_DRV_LOG(ERR, "Failed to remove EFID=%d from SID=%d\n",
+			    rep_fid, sid);
+
+	return rc;
+}
+
 static int32_t
 ulp_tfc_ctx_attach(struct bnxt *bp,
 		   struct bnxt_ulp_session_state *session)
@@ -703,6 +767,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 +780,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 +809,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 +832,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 +889,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 +916,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 +941,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 +968,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 +1030,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 d8539134d2..ed840b111c 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;
 }
 
-- 
2.39.3


  parent reply	other threads:[~2024-10-01  5:51 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-01  5:57 [PATCH v3 00/47] TruFlow update for Thor2 Sriharsha Basavapatna
2024-10-01  5:57 ` [PATCH v3 01/47] net/bnxt: tf_core: fix wc tcam multi slice delete issue Sriharsha Basavapatna
2024-10-01  5:57 ` [PATCH v3 02/47] net/bnxt: tf_core: tcam manager data corruption Sriharsha Basavapatna
2024-10-01  5:57 ` [PATCH v3 03/47] net/bnxt: tf_core: External EM support cleanup Sriharsha Basavapatna
2024-10-01  5:57 ` [PATCH v3 04/47] net/bnxt: tf_core: Thor TF EM key size check Sriharsha Basavapatna
2024-10-01  5:57 ` [PATCH v3 05/47] net/bnxt: tf_core: flow scale improvement Sriharsha Basavapatna
2024-10-01  5:57 ` [PATCH v3 06/47] net/bnxt: tf_core: TF support flow scale query Sriharsha Basavapatna
2024-10-01  5:57 ` [PATCH v3 07/47] net/bnxt: tf_core: fix slice count in case of HA entry move Sriharsha Basavapatna
2024-10-01  5:57 ` [PATCH v3 08/47] net/bnxt: tf_core: convert priority based TCAM manager to dynamic allocation Sriharsha Basavapatna
2024-10-01  5:57 ` [PATCH v3 09/47] net/bnxt: tf_core: remove dead AFM code from session-based priority TCAM mgr Sriharsha Basavapatna
2024-10-01  5:57 ` [PATCH v3 10/47] net/bnxt: tf_core: remove dead " Sriharsha Basavapatna
2024-10-01  5:57 ` [PATCH v3 13/47] net/bnxt: tf_ulp: add custom l2 etype tunnel support Sriharsha Basavapatna
2024-10-01  5:58 ` [PATCH v3 14/47] net/bnxt: tf_ulp: add support for vf to vf flow offload Sriharsha Basavapatna
2024-10-01  5:58 ` [PATCH v3 15/47] net/bnxt: tf_ulp: Wh+ mirroring support Sriharsha Basavapatna
2024-10-01  5:58 ` [PATCH v3 16/47] net/bnxt: tf_ulp: miscellaneous fixes Sriharsha Basavapatna
2024-10-01  5:58 ` [PATCH v3 19/47] net/bnxt: tf_ulp: convert recipe table to dynamic memory Sriharsha Basavapatna
2024-10-01  5:58 ` [PATCH v3 21/47] net/bnxt: tf_ulp: add action read and clear support Sriharsha Basavapatna
2024-10-01  5:58 ` Sriharsha Basavapatna [this message]
2024-10-01  5:58 ` [PATCH v3 25/47] net/bnxt: tf_ulp: update template files Sriharsha Basavapatna
2024-10-01  5:58 ` [PATCH v3 26/47] net/bnxt: tf_ulp: enable recipe id generation Sriharsha Basavapatna
2024-10-01  5:58 ` [PATCH v3 27/47] net/bnxt: tf_ulp: fixed parent child db counters Sriharsha Basavapatna
2024-10-01  5:58 ` [PATCH v3 28/47] net/bnxt: tf_ulp: modify return values to adhere to C coding standard Sriharsha Basavapatna
2024-10-01  5:58 ` [PATCH v3 29/47] net/bnxt: tf_ulp: update template files Sriharsha Basavapatna
2024-10-01  5:58 ` [PATCH v3 30/47] net/bnxt: tf_ulp: add mask defaults when mask is not specified Sriharsha Basavapatna
2024-10-01  5:58 ` [PATCH v3 32/47] net/bnxt: tf_ulp: add support for flow priority Sriharsha Basavapatna
2024-10-01  5:58 ` [PATCH v3 34/47] net/bnxt: tf_ulp: add rte_mtr support for Thor2 Sriharsha Basavapatna
2024-10-01  5:58 ` [PATCH v3 35/47] net/bnxt: tf_ulp: TF support flow scale query Sriharsha Basavapatna
2024-10-01  5:58 ` [PATCH v3 36/47] net/bnxt: tf_ulp: add support for rss flow query to ULP Sriharsha Basavapatna
2024-10-01  5:58 ` [PATCH v3 38/47] net/bnxt: tf_ulp: inline utility functions and use likely/unlikely Sriharsha Basavapatna
2024-10-01  5:58 ` [PATCH v3 39/47] net/bnxt: tf_ulp: switch ulp to use rte crc32 hash Sriharsha Basavapatna
2024-10-01  5:58 ` [PATCH v3 41/47] net/bnxt: tf_ulp: support a few generic template items Sriharsha Basavapatna
2024-10-01  5:58 ` [PATCH v3 42/47] net/bnxt: tf_ulp: TFC support flow scale query for Thor2 Sriharsha Basavapatna
2024-10-01  5:58 ` [PATCH v3 44/47] net/bnxt: tf_ulp: enable support for truflow feature configuration Sriharsha Basavapatna
2024-10-01  5:58 ` [PATCH v3 45/47] net/bnxt: tf_ulp: support a few feature extensions Sriharsha Basavapatna
2024-10-01  5:58 ` [PATCH v3 47/47] net/bnxt: tf_ulp: add stats cache for thor2 Sriharsha Basavapatna

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241001055833.757163-24-sriharsha.basavapatna@broadcom.com \
    --to=sriharsha.basavapatna@broadcom.com \
    --cc=ajit.khaparde@broadcom.com \
    --cc=dev@dpdk.org \
    --cc=farah.smith@broadcom.com \
    --cc=kishore.padmanabha@broadcom.com \
    --cc=michael.baucom@broadcom.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).