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 v6 23/47] net/bnxt: tf_ulp: VFR updates for Thor 2
Date: Mon, 21 Oct 2024 13:55:43 +0530	[thread overview]
Message-ID: <20241021082607.232829-24-sriharsha.basavapatna@broadcom.com> (raw)
In-Reply-To: <20241021082607.232829-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             |  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(-)

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;
 }
 
-- 
2.39.3


  parent reply	other threads:[~2024-10-21  8:18 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-21  8:25 [PATCH v6 00/47] TruFlow update for Thor2 Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 01/47] net/bnxt: tf_core: fix wc tcam multi slice delete issue Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 02/47] net/bnxt: tf_core: tcam manager data corruption Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 03/47] net/bnxt: tf_core: External EM support cleanup Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 04/47] net/bnxt: tf_core: Thor TF EM key size check Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 05/47] net/bnxt: tf_core: flow scale improvement Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 06/47] net/bnxt: tf_core: TF support flow scale query Sriharsha Basavapatna
2024-10-21 16:09   ` Stephen Hemminger
2024-10-22 16:12     ` Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 07/47] net/bnxt: tf_core: fix slice count in case of HA entry move Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 08/47] net/bnxt: tf_core: convert priority based TCAM manager to dynamic allocation Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 09/47] net/bnxt: tf_core: remove dead AFM code from session-based priority TCAM mgr Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 10/47] net/bnxt: tf_core: remove dead " Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 11/47] net/bnxt: tfc: support tf-core for Thor2 Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 12/47] net/bnxt: tf_ulp: add vxlan-gpe base support Sriharsha Basavapatna
2024-10-21 15:54   ` Stephen Hemminger
2024-10-22 16:07     ` Sriharsha Basavapatna
2024-10-22 21:32       ` Ajit Khaparde
2024-10-23  0:44         ` Stephen Hemminger
2024-10-21  8:25 ` [PATCH v6 13/47] net/bnxt: tf_ulp: add custom l2 etype tunnel support Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 14/47] net/bnxt: tf_ulp: add support for vf to vf flow offload Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 15/47] net/bnxt: tf_ulp: Wh+ mirroring support Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 16/47] net/bnxt: tf_ulp: miscellaneous fixes Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 17/47] net/bnxt: tf_ulp: support for Thor2 ulp layer Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 18/47] net/bnxt: tf_ulp: add support for overlapping flows Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 19/47] net/bnxt: tf_ulp: convert recipe table to dynamic memory Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 20/47] net/bnxt: tf_ulp: add feature bit support Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 21/47] net/bnxt: tf_ulp: add action read and clear support Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 22/47] net/bnxt: tf_ulp: update template files Sriharsha Basavapatna
2024-10-21  8:25 ` Sriharsha Basavapatna [this message]
2024-10-21  8:25 ` [PATCH v6 24/47] net/bnxt: tf_ulp: add support for tunnel flow stats Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 25/47] net/bnxt: tf_ulp: update template files Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 26/47] net/bnxt: tf_ulp: enable recipe id generation Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 27/47] net/bnxt: tf_ulp: fixed parent child db counters Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 28/47] net/bnxt: tf_ulp: modify return values to adhere to C coding standard Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 29/47] net/bnxt: tf_ulp: update template files Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 30/47] net/bnxt: tf_ulp: add mask defaults when mask is not specified Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 31/47] net/bnxt: tf_ulp: add jump action support Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 32/47] net/bnxt: tf_ulp: add support for flow priority Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 33/47] net/bnxt: tf_ulp: support for dynamic tunnel ports Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 34/47] net/bnxt: tf_ulp: add rte_mtr support for Thor2 Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 35/47] net/bnxt: tf_ulp: TF support flow scale query Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 36/47] net/bnxt: tf_ulp: add support for rss flow query to ULP Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 37/47] net/bnxt: tf_ulp: add track type feature to tables Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 38/47] net/bnxt: tf_ulp: inline utility functions and use likely/unlikely Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 39/47] net/bnxt: tf_ulp: switch ulp to use rte crc32 hash Sriharsha Basavapatna
2024-10-21  8:26 ` [PATCH v6 40/47] net/bnxt: tf_ulp: update template files Sriharsha Basavapatna
2024-10-21  8:26 ` [PATCH v6 41/47] net/bnxt: tf_ulp: support a few generic template items Sriharsha Basavapatna
2024-10-21  8:26 ` [PATCH v6 42/47] net/bnxt: tf_ulp: TFC support flow scale query for Thor2 Sriharsha Basavapatna
2024-10-21  8:26 ` [PATCH v6 43/47] net/bnxt: tf_ulp: update template files Sriharsha Basavapatna
2024-10-21  8:26 ` [PATCH v6 44/47] net/bnxt: tf_ulp: enable support for truflow feature configuration Sriharsha Basavapatna
2024-10-21  8:26 ` [PATCH v6 45/47] net/bnxt: tf_ulp: support a few feature extensions Sriharsha Basavapatna
2024-10-21  8:26 ` [PATCH v6 46/47] net/bnxt: tf_ulp: update template files Sriharsha Basavapatna
2024-10-21  8:26 ` [PATCH v6 47/47] net/bnxt: tf_ulp: add stats cache for thor2 Sriharsha Basavapatna
2024-10-24  5:26 ` [PATCH v6 00/47] TruFlow update for Thor2 Ajit Khaparde
2024-10-28 12:58   ` Thomas Monjalon
2024-10-28 16:32     ` 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=20241021082607.232829-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).