patch 'net/nfp: fix repeat disable port' has been queued to stable release 23.11.2

Xueming Li xuemingl at nvidia.com
Mon Aug 12 14:49:30 CEST 2024


Hi,

FYI, your patch has been queued to stable release 23.11.2

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 08/14/24. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://git.dpdk.org/dpdk-stable/log/?h=23.11-staging

This queued commit can be viewed at:
https://git.dpdk.org/dpdk-stable/commit/?h=23.11-staging&id=5453c7a0b0a10851b2e23fba077d191c981a1906

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From 5453c7a0b0a10851b2e23fba077d191c981a1906 Mon Sep 17 00:00:00 2001
From: Peng Zhang <peng.zhang at corigine.com>
Date: Wed, 19 Jun 2024 17:58:11 +0800
Subject: [PATCH] net/nfp: fix repeat disable port
Cc: Xueming Li <xuemingl at nvidia.com>

[ upstream commit bd4969ab939e0f188926f64e410a8ab285392b3a ]

For firmware with multiple PFs, all the PFs share
the same 'nfp_eth_table' data structure. So the original
logic loop the ports in 'nfp_eth_table' will make other
PFs suddently down, which will cause problem.

Fix this by adding the special logic for firmware with
multiple PFs.

Fixes: 3b00109d2b65 ("net/nfp: add PF ID used to format symbols")

Signed-off-by: Peng Zhang <peng.zhang at corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he at corigine.com>
Reviewed-by: Long Wu <long.wu at corigine.com>
---
 drivers/net/nfp/nfp_ethdev.c     | 35 +++++++++++++++++++++++++-------
 drivers/net/nfp/nfp_net_common.c | 10 +++++++++
 drivers/net/nfp/nfp_net_common.h |  2 ++
 3 files changed, 40 insertions(+), 7 deletions(-)

diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 7d86618bc9..8bb6715450 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -1187,14 +1187,35 @@ app_cleanup:
 	return ret;
 }
 
+/* Force the physical port down to clear the possible DMA error */
 static int
-nfp_pf_init(struct rte_pci_device *pci_dev)
+nfp_net_force_port_down(struct nfp_pf_dev *pf_dev,
+		struct nfp_eth_table *nfp_eth_table,
+		struct nfp_cpp *cpp)
 {
+	int ret;
 	uint32_t i;
 	uint32_t id;
+	uint32_t index;
+	uint32_t count;
+
+	count = nfp_net_get_port_num(pf_dev, nfp_eth_table);
+	for (i = 0; i < count; i++) {
+		id = nfp_function_id_get(pf_dev, i);
+		index = nfp_eth_table->ports[id].index;
+		ret = nfp_eth_set_configured(cpp, index, 0);
+		if (ret < 0)
+			return ret;
+	}
+
+	return 0;
+}
+
+static int
+nfp_pf_init(struct rte_pci_device *pci_dev)
+{
 	int ret = 0;
 	uint64_t addr;
-	uint32_t index;
 	uint32_t cpp_id;
 	uint8_t function_id;
 	struct nfp_cpp *cpp;
@@ -1266,11 +1287,11 @@ nfp_pf_init(struct rte_pci_device *pci_dev)
 	pf_dev->multi_pf.enabled = nfp_check_multi_pf_from_nsp(pci_dev, cpp);
 	pf_dev->multi_pf.function_id = function_id;
 
-	/* Force the physical port down to clear the possible DMA error */
-	for (i = 0; i < nfp_eth_table->count; i++) {
-		id = nfp_function_id_get(pf_dev, i);
-		index = nfp_eth_table->ports[id].index;
-		nfp_eth_set_configured(cpp, index, 0);
+	ret = nfp_net_force_port_down(pf_dev, nfp_eth_table, cpp);
+	if (ret != 0) {
+		PMD_INIT_LOG(ERR, "Failed to force port down");
+		ret = -EIO;
+		goto eth_table_cleanup;
 	}
 
 	if (nfp_fw_setup(pci_dev, cpp, nfp_eth_table, hwinfo,
diff --git a/drivers/net/nfp/nfp_net_common.c b/drivers/net/nfp/nfp_net_common.c
index 10732f459c..effb104af5 100644
--- a/drivers/net/nfp/nfp_net_common.c
+++ b/drivers/net/nfp/nfp_net_common.c
@@ -2250,3 +2250,13 @@ nfp_net_flow_ctrl_set(struct rte_eth_dev *dev,
 
 	return 0;
 }
+
+uint32_t
+nfp_net_get_port_num(struct nfp_pf_dev *pf_dev,
+		struct nfp_eth_table *nfp_eth_table)
+{
+	if (pf_dev->multi_pf.enabled)
+		return 1;
+	else
+		return nfp_eth_table->count;
+}
diff --git a/drivers/net/nfp/nfp_net_common.h b/drivers/net/nfp/nfp_net_common.h
index c96f55976a..827aa2c0e2 100644
--- a/drivers/net/nfp/nfp_net_common.h
+++ b/drivers/net/nfp/nfp_net_common.h
@@ -274,6 +274,8 @@ int nfp_net_flow_ctrl_get(struct rte_eth_dev *dev,
 int nfp_net_flow_ctrl_set(struct rte_eth_dev *dev,
 		struct rte_eth_fc_conf *fc_conf);
 void nfp_pf_uninit(struct nfp_pf_dev *pf_dev);
+uint32_t nfp_net_get_port_num(struct nfp_pf_dev *pf_dev,
+		struct nfp_eth_table *nfp_eth_table);
 
 #define NFP_PRIV_TO_APP_FW_NIC(app_fw_priv)\
 	((struct nfp_app_fw_nic *)app_fw_priv)
-- 
2.34.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2024-08-12 20:44:05.523373860 +0800
+++ 0093-net-nfp-fix-repeat-disable-port.patch	2024-08-12 20:44:02.365069347 +0800
@@ -1 +1 @@
-From bd4969ab939e0f188926f64e410a8ab285392b3a Mon Sep 17 00:00:00 2001
+From 5453c7a0b0a10851b2e23fba077d191c981a1906 Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit bd4969ab939e0f188926f64e410a8ab285392b3a ]
@@ -15 +17,0 @@
-Cc: stable at dpdk.org
@@ -21 +23 @@
- drivers/net/nfp/nfp_ethdev.c     | 35 ++++++++++++++++++++++++++------
+ drivers/net/nfp/nfp_ethdev.c     | 35 +++++++++++++++++++++++++-------
@@ -24 +26 @@
- 3 files changed, 41 insertions(+), 6 deletions(-)
+ 3 files changed, 40 insertions(+), 7 deletions(-)
@@ -27 +29 @@
-index a3c237e607..d706f27ac2 100644
+index 7d86618bc9..8bb6715450 100644
@@ -30,2 +32,2 @@
-@@ -1772,6 +1772,30 @@ nfp_net_speed_capa_get(struct nfp_pf_dev *pf_dev,
- 	return 0;
+@@ -1187,14 +1187,35 @@ app_cleanup:
+ 	return ret;
@@ -35 +37,2 @@
-+static int
+ static int
+-nfp_pf_init(struct rte_pci_device *pci_dev)
@@ -39 +42 @@
-+{
+ {
@@ -41,2 +44,2 @@
-+	uint32_t i;
-+	uint32_t id;
+ 	uint32_t i;
+ 	uint32_t id;
@@ -58,5 +61,3 @@
- static int
- nfp_pf_init(struct rte_pci_device *pci_dev)
- {
-@@ -1780,7 +1804,6 @@ nfp_pf_init(struct rte_pci_device *pci_dev)
- 	uint32_t id;
++static int
++nfp_pf_init(struct rte_pci_device *pci_dev)
++{
@@ -69 +70 @@
-@@ -1874,11 +1897,11 @@ nfp_pf_init(struct rte_pci_device *pci_dev)
+@@ -1266,11 +1287,11 @@ nfp_pf_init(struct rte_pci_device *pci_dev)
@@ -85 +86 @@
- 	ret = nfp_devargs_parse(&pf_dev->devargs, pci_dev->device.devargs);
+ 	if (nfp_fw_setup(pci_dev, cpp, nfp_eth_table, hwinfo,
@@ -87 +88 @@
-index 260920ecff..30ad6fc29e 100644
+index 10732f459c..effb104af5 100644
@@ -90 +91 @@
-@@ -2554,3 +2554,13 @@ nfp_net_fec_set(struct rte_eth_dev *dev,
+@@ -2250,3 +2250,13 @@ nfp_net_flow_ctrl_set(struct rte_eth_dev *dev,
@@ -92 +93 @@
- 	return nfp_eth_set_fec(hw_priv->pf_dev->cpp, eth_port->index, fec);
+ 	return 0;
@@ -105 +106 @@
-index 2feeb6f5bd..4016652cf9 100644
+index c96f55976a..827aa2c0e2 100644
@@ -108,4 +109,4 @@
-@@ -326,6 +326,8 @@ void nfp_net_get_fw_version(struct nfp_cpp *cpp,
- 		uint32_t *fw_version);
- int nfp_net_txrwb_alloc(struct rte_eth_dev *eth_dev);
- void nfp_net_txrwb_free(struct rte_eth_dev *eth_dev);
+@@ -274,6 +274,8 @@ int nfp_net_flow_ctrl_get(struct rte_eth_dev *dev,
+ int nfp_net_flow_ctrl_set(struct rte_eth_dev *dev,
+ 		struct rte_eth_fc_conf *fc_conf);
+ void nfp_pf_uninit(struct nfp_pf_dev *pf_dev);


More information about the stable mailing list