[v2,10/13] net/bnxt: remove the VNIC async event handler

Message ID 20241027171128.50221-11-ajit.khaparde@broadcom.com (mailing list archive)
State Accepted, archived
Delegated to: Ajit Khaparde
Headers
Series patchset for bnxt PMD |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Ajit Khaparde Oct. 27, 2024, 5:11 p.m. UTC
From: Kishore Padmanabha <kishore.padmanabha@broadcom.com>

The VNIC async event handler is removed, it is no longer required if
during the port initialization if svif is used instead of VNIC which
could be invalid for rep port if the rep's VF port link is down.

Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Reviewed-by: Shahaji Bhosle <sbhosle@broadcom.com>
---
 drivers/net/bnxt/bnxt_cpr.c  | 48 ------------------------------------
 drivers/net/bnxt/bnxt_hwrm.c | 21 +++++++++++++---
 drivers/net/bnxt/bnxt_reps.c |  4 +--
 3 files changed, 19 insertions(+), 54 deletions(-)
  

Patch

diff --git a/drivers/net/bnxt/bnxt_cpr.c b/drivers/net/bnxt/bnxt_cpr.c
index ac1d537bc9..c6606e19a8 100644
--- a/drivers/net/bnxt/bnxt_cpr.c
+++ b/drivers/net/bnxt/bnxt_cpr.c
@@ -47,51 +47,6 @@  void bnxt_wait_for_device_shutdown(struct bnxt *bp)
 	} while (timeout);
 }
 
-static void
-bnxt_process_default_vnic_change(struct bnxt *bp,
-				 struct hwrm_async_event_cmpl *async_cmp)
-{
-	uint16_t vnic_state, vf_fid, vf_id;
-	struct bnxt_representor *vf_rep_bp;
-	struct rte_eth_dev *eth_dev;
-	bool vfr_found = false;
-	uint32_t event_data;
-
-	if (!BNXT_TRUFLOW_EN(bp))
-		return;
-
-	PMD_DRV_LOG_LINE(INFO, "Default vnic change async event received");
-	event_data = rte_le_to_cpu_32(async_cmp->event_data1);
-
-	vnic_state = (event_data & BNXT_DEFAULT_VNIC_STATE_MASK) >>
-			BNXT_DEFAULT_VNIC_STATE_SFT;
-	if (vnic_state != BNXT_DEFAULT_VNIC_ALLOC)
-		return;
-
-	if (!bp->rep_info)
-		return;
-
-	vf_fid = (event_data & BNXT_DEFAULT_VNIC_CHANGE_VF_ID_MASK) >>
-			BNXT_DEFAULT_VNIC_CHANGE_VF_ID_SFT;
-	PMD_DRV_LOG_LINE(INFO, "async event received vf_id 0x%x", vf_fid);
-
-	for (vf_id = 0; vf_id < BNXT_MAX_VF_REPS(bp); vf_id++) {
-		eth_dev = bp->rep_info[vf_id].vfr_eth_dev;
-		if (!eth_dev)
-			continue;
-		vf_rep_bp = eth_dev->data->dev_private;
-		if (vf_rep_bp &&
-		    vf_rep_bp->fw_fid == vf_fid) {
-			vfr_found = true;
-			break;
-		}
-	}
-	if (!vfr_found)
-		return;
-
-	bnxt_rep_dev_start_op(eth_dev);
-}
-
 static void bnxt_handle_event_error_report(struct bnxt *bp,
 					   uint32_t data1,
 					   uint32_t data2)
@@ -278,9 +233,6 @@  void bnxt_handle_async_event(struct bnxt *bp,
 		PMD_DRV_LOG_LINE(INFO, "Port: %u DNC event: data1 %#x data2 %#x",
 			    port_id, data1, data2);
 		break;
-	case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_DEFAULT_VNIC_CHANGE:
-		bnxt_process_default_vnic_change(bp, async_cmp);
-		break;
 	case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_ECHO_REQUEST:
 		PMD_DRV_LOG_LINE(INFO,
 			    "Port %u: Received fw echo request: data1 %#x data2 %#x",
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 80f7c1a6a1..8dea446e60 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -4336,12 +4336,25 @@  int bnxt_hwrm_get_dflt_vnic_svif(struct bnxt *bp, uint16_t fid,
 
 	HWRM_CHECK_RESULT();
 
-	if (vnic_id)
-		*vnic_id = rte_le_to_cpu_16(resp->dflt_vnic_id);
-
 	svif_info = rte_le_to_cpu_16(resp->svif_info);
-	if (svif && (svif_info & HWRM_FUNC_QCFG_OUTPUT_SVIF_INFO_SVIF_VALID))
+	if (svif && (svif_info & HWRM_FUNC_QCFG_OUTPUT_SVIF_INFO_SVIF_VALID)) {
 		*svif = svif_info & HWRM_FUNC_QCFG_OUTPUT_SVIF_INFO_SVIF_MASK;
+		/* When the VF corresponding to the VFR is down at the time of
+		 * VFR conduit creation, the VFR rule will be programmed with
+		 * invalid vnic id because FW will return default vnic id as
+		 * INVALID when queried through FUNC_QCFG. As a result, when
+		 * the VF is brought up, VF won't receive packets because
+		 * INVALID vnic id is already programmed.
+		 *
+		 * Hence, use svif value as vnic id during VFR conduit creation
+		 * as both svif and default vnic id values are same and will
+		 * never change.
+		 */
+		if (vnic_id)
+			*vnic_id = *svif;
+	} else {
+		rc = -EINVAL;
+	}
 
 	HWRM_UNLOCK();
 
diff --git a/drivers/net/bnxt/bnxt_reps.c b/drivers/net/bnxt/bnxt_reps.c
index 6c431c7dd8..6f5c3f80eb 100644
--- a/drivers/net/bnxt/bnxt_reps.c
+++ b/drivers/net/bnxt/bnxt_reps.c
@@ -540,12 +540,12 @@  static int bnxt_vfr_free(struct bnxt_representor *vfr)
 		return -ENOMEM;
 	}
 
-	parent_bp = vfr->parent_dev->data->dev_private;
-	if (!parent_bp) {
+	if (!bnxt_rep_check_parent(vfr)) {
 		PMD_DRV_LOG_LINE(DEBUG, "BNXT Port:%d VFR already freed",
 			    vfr->dpdk_port_id);
 		return 0;
 	}
+	parent_bp = vfr->parent_dev->data->dev_private;
 
 	/* Check if representor has been already freed in FW */
 	if (!vfr->vfr_tx_cfa_action)