patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH 03/11] net/bnxt: fix Rx handler
       [not found] <20250205172004.50395-1-ajit.khaparde@broadcom.com>
@ 2025-02-05 17:19 ` Ajit Khaparde
  2025-02-05 17:19 ` [PATCH 05/11] net/bnxt/truFlow: Fix seg fault when rep are re-attached Ajit Khaparde
  1 sibling, 0 replies; 2+ messages in thread
From: Ajit Khaparde @ 2025-02-05 17:19 UTC (permalink / raw)
  To: dev; +Cc: thomas, stable

Fix the code accounting the status of compressed CQE handler.
The code was inside the block handling the normal CQE mode.
Moved the code out. Without this the Rx datapath was broken
for compressed CQEs in scalar mode.

Fixes: 5c980062d895 ("net/bnxt: support compressed Rx CQE")
Cc: stable@dpdk.org
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_rxr.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_rxr.c b/drivers/net/bnxt/bnxt_rxr.c
index 5b43bcbea6..b53d9a917a 100644
--- a/drivers/net/bnxt/bnxt_rxr.c
+++ b/drivers/net/bnxt/bnxt_rxr.c
@@ -1390,14 +1390,6 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		} else if ((CMP_TYPE(rxcmp) >= CMPL_BASE_TYPE_RX_TPA_START_V2) &&
 			   (CMP_TYPE(rxcmp) <= CMPL_BASE_TYPE_RX_TPA_START_V3)) {
 			rc = bnxt_rx_pkt(&rx_pkts[nb_rx_pkts], rxq, &raw_cons);
-			if (!rc)
-				nb_rx_pkts++;
-			else if (rc == -EBUSY)	/* partial completion */
-				break;
-			else if (rc == -ENODEV)	/* completion for representor */
-				nb_rep_rx_pkts++;
-			else if (rc == -ENOMEM)
-				nb_rx_pkts++;
 		} else if (!BNXT_NUM_ASYNC_CPR(rxq->bp)) {
 			evt =
 			bnxt_event_hwrm_resp_handler(rxq->bp,
@@ -1407,6 +1399,14 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 				goto done;
 		}
 
+		if (!rc)
+			nb_rx_pkts++;
+		else if (rc == -EBUSY)	/* partial completion */
+			break;
+		else if (rc == -ENODEV)	/* completion for representor */
+			nb_rep_rx_pkts++;
+		else if (rc == -ENOMEM)
+			nb_rx_pkts++;
 		raw_cons = NEXT_RAW_CMP(raw_cons);
 		/*
 		 * The HW reposting may fall behind if mbuf allocation has
-- 
2.39.5 (Apple Git-154)


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH 05/11] net/bnxt/truFlow: Fix seg fault when rep are re-attached
       [not found] <20250205172004.50395-1-ajit.khaparde@broadcom.com>
  2025-02-05 17:19 ` [PATCH 03/11] net/bnxt: fix Rx handler Ajit Khaparde
@ 2025-02-05 17:19 ` Ajit Khaparde
  1 sibling, 0 replies; 2+ messages in thread
From: Ajit Khaparde @ 2025-02-05 17:19 UTC (permalink / raw)
  To: dev; +Cc: thomas, Sangtani Parag Satishbhai, stable, Somnath Kotur, Kalesh AP

From: Sangtani Parag Satishbhai <parag-satishbhai.sangtani@broadcom.com>

When the PCI port is detached using the testpmd command,
as part of cleanup testpmd removes resources of parent
port and all the children's ports and calls the driver specific
pci_remove API with the parent rte ethdev to clean-up ethdevs.
For the bnxt driver, a condition to check type of ethdev is added
in bnxt_pci_remove and based on the condition relevant
ethdev is removed (VF/PF or VFR). As the RTE layer always
calls PCI remove with the parent ethdev, the bnxt_pci_remove
never frees children (VFRs) ethdev. As, these ethdevs were not
freed it gives spurious status in re-allocation check(when pci
port attach command is executed) and when RTE layers tries to
access interrupt specific info from the ethdev due to uninitialized
members it access NULL pointer which results in seg fault. The fix
is made in bnxt_pci_remove to clean ethdev for parent (PF/VF) along
with children (VFRs).

Fixes: 322bd6e70272 ("net/bnxt: add port representor infrastructure")
Cc: stable@dpdk.org
Signed-off-by: Sangtani Parag Satishbhai <parag-satishbhai.sangtani@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index b18247feb2..144d4377bd 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -6993,6 +6993,8 @@ static int bnxt_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 static int bnxt_pci_remove(struct rte_pci_device *pci_dev)
 {
 	struct rte_eth_dev *eth_dev;
+	uint16_t port_id;
+	int rc = 0;
 
 	eth_dev = rte_eth_dev_allocated(pci_dev->device.name);
 	if (!eth_dev)
@@ -7002,14 +7004,20 @@ static int bnxt_pci_remove(struct rte_pci_device *pci_dev)
 			   * +ve value will at least help in proper cleanup
 			   */
 
-	PMD_DRV_LOG_LINE(DEBUG, "BNXT Port:%d pci remove", eth_dev->data->port_id);
 	if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
-		if (rte_eth_dev_is_repr(eth_dev))
-			return rte_eth_dev_destroy(eth_dev,
-						   bnxt_representor_uninit);
-		else
-			return rte_eth_dev_destroy(eth_dev,
-						   bnxt_dev_uninit);
+		RTE_ETH_FOREACH_DEV_OF(port_id, &pci_dev->device) {
+			PMD_DRV_LOG_LINE(DEBUG, "BNXT Port:%d pci remove", port_id);
+			eth_dev = &rte_eth_devices[port_id];
+			if (eth_dev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR)
+				rc = rte_eth_dev_destroy(eth_dev,
+							 bnxt_representor_uninit);
+			else
+				rc = rte_eth_dev_destroy(eth_dev,
+							 bnxt_dev_uninit);
+			if (rc != 0)
+				return rc;
+		}
+		return rc;
 	} else {
 		return rte_eth_dev_pci_generic_remove(pci_dev, NULL);
 	}
-- 
2.39.5 (Apple Git-154)


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-02-05 17:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20250205172004.50395-1-ajit.khaparde@broadcom.com>
2025-02-05 17:19 ` [PATCH 03/11] net/bnxt: fix Rx handler Ajit Khaparde
2025-02-05 17:19 ` [PATCH 05/11] net/bnxt/truFlow: Fix seg fault when rep are re-attached Ajit Khaparde

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).