patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH] net/nfp: fix multiple PFs check from NSP
@ 2025-01-22  1:28 Chaoyong He
  0 siblings, 0 replies; only message in thread
From: Chaoyong He @ 2025-01-22  1:28 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Zerun Fu, peng.zhang, stable, Chaoyong He, Long Wu

From: Zerun Fu <zerun.fu@corigine.com>

Fix multiple PFs check from NSP problem in the logic of PF initialization.

Fixes: 8ad2cc8fec37 ("net/nfp: add flag for multiple PFs support")
Cc: peng.zhang@corigine.com
Cc: stable@dpdk.org

Signed-off-by: Zerun Fu <zerun.fu@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
---
 drivers/net/nfp/nfp_ethdev.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index f54483822f..aad044a0f7 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -1749,24 +1749,25 @@ nfp_check_multi_pf_from_fw(uint32_t total_vnics)
 	return false;
 }
 
-static inline bool
+static inline int
 nfp_check_multi_pf_from_nsp(struct rte_pci_device *pci_dev,
-		struct nfp_cpp *cpp)
+		struct nfp_cpp *cpp,
+		bool *flag)
 {
-	bool flag;
 	struct nfp_nsp *nsp;
 
 	nsp = nfp_nsp_open(cpp);
 	if (nsp == NULL) {
 		PMD_DRV_LOG(ERR, "NFP error when obtaining NSP handle.");
-		return false;
+		return -EIO;
 	}
 
-	flag = (nfp_nsp_get_abi_ver_major(nsp) > 0) &&
+	*flag = (nfp_nsp_get_abi_ver_major(nsp) > 0) &&
 			(pci_dev->id.device_id == PCI_DEVICE_ID_NFP3800_PF_NIC);
 
 	nfp_nsp_close(nsp);
-	return flag;
+
+	return 0;
 }
 
 static int
@@ -2432,8 +2433,13 @@ nfp_pf_init(struct rte_pci_device *pci_dev)
 		goto eth_table_cleanup;
 	}
 
+	ret = nfp_check_multi_pf_from_nsp(pci_dev, cpp, &pf_dev->multi_pf.enabled);
+	if (ret != 0) {
+		PMD_INIT_LOG(ERR, "Failed to check multi pf from NSP.");
+		goto eth_table_cleanup;
+	}
+
 	pf_dev->nfp_eth_table = nfp_eth_table;
-	pf_dev->multi_pf.enabled = nfp_check_multi_pf_from_nsp(pci_dev, cpp);
 	pf_dev->multi_pf.function_id = function_id;
 	pf_dev->total_phyports = nfp_net_get_phyports_from_nsp(pf_dev);
 
-- 
2.43.5


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-01-22  1:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-22  1:28 [PATCH] net/nfp: fix multiple PFs check from NSP Chaoyong He

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