From: Chaoyong He <chaoyong.he@corigine.com>
To: dev@dpdk.org
Cc: oss-drivers@corigine.com, Zerun Fu <zerun.fu@corigine.com>,
peng.zhang@corigine.com, stable@dpdk.org,
Chaoyong He <chaoyong.he@corigine.com>,
Long Wu <long.wu@corigine.com>
Subject: [PATCH] net/nfp: fix multiple PFs check from NSP
Date: Wed, 22 Jan 2025 09:28:15 +0800 [thread overview]
Message-ID: <20250122012815.1703017-1-chaoyong.he@corigine.com> (raw)
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
reply other threads:[~2025-01-22 1:28 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20250122012815.1703017-1-chaoyong.he@corigine.com \
--to=chaoyong.he@corigine.com \
--cc=dev@dpdk.org \
--cc=long.wu@corigine.com \
--cc=oss-drivers@corigine.com \
--cc=peng.zhang@corigine.com \
--cc=stable@dpdk.org \
--cc=zerun.fu@corigine.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).