From: Chaoyong He <chaoyong.he@corigine.com>
To: dev@dpdk.org
Cc: oss-drivers@corigine.com, Zerun Fu <zerun.fu@corigine.com>,
stable@dpdk.org, Chaoyong He <chaoyong.he@corigine.com>,
Long Wu <long.wu@corigine.com>,
Peng Zhang <peng.zhang@corigine.com>
Subject: [PATCH] net/nfp: fix failure of PF initiation on flower firmware
Date: Fri, 8 Mar 2024 11:11:10 +0800 [thread overview]
Message-ID: <20240308031110.2041280-1-chaoyong.he@corigine.com> (raw)
From: Zerun Fu <zerun.fu@corigine.com>
The previous logic did not distinguish the firmware type when
reading the value of "app_cap" during the initialization of the
PF. This operation is not supported by the flower firmware, and
this will lead to a startup failure.
Fix this by adding the logic to check the firmware type.
Fixes: c7a6970fc637 ("net/nfp: notify BSP if FW speed needs to be switched")
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 | 28 ++++++++++++++++------------
1 file changed, 16 insertions(+), 12 deletions(-)
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 8c38b4e134..1e713ee111 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -1605,30 +1605,34 @@ nfp_init_app_fw_nic(struct nfp_pf_dev *pf_dev,
static int
nfp_net_hwinfo_set(uint8_t function_id,
struct nfp_rtsym_table *sym_tbl,
- struct nfp_cpp *cpp)
+ struct nfp_cpp *cpp,
+ enum nfp_app_fw_id app_fw_id)
{
int ret = 0;
uint64_t app_cap;
- uint8_t sp_indiff;
struct nfp_nsp *nsp;
+ uint8_t sp_indiff = 1;
char hw_info[RTE_ETH_NAME_MAX_LEN];
char app_cap_name[RTE_ETH_NAME_MAX_LEN];
- /* Read the app capabilities of the firmware loaded */
- snprintf(app_cap_name, sizeof(app_cap_name), "_pf%u_net_app_cap", function_id);
- app_cap = nfp_rtsym_read_le(sym_tbl, app_cap_name, &ret);
- if (ret != 0) {
- PMD_INIT_LOG(ERR, "Couldn't read app_fw_cap from firmware.");
- return ret;
+ if (app_fw_id != NFP_APP_FW_FLOWER_NIC) {
+ /* Read the app capabilities of the firmware loaded */
+ snprintf(app_cap_name, sizeof(app_cap_name), "_pf%u_net_app_cap", function_id);
+ app_cap = nfp_rtsym_read_le(sym_tbl, app_cap_name, &ret);
+ if (ret != 0) {
+ PMD_INIT_LOG(ERR, "Could not read app_fw_cap from firmware.");
+ return ret;
+ }
+
+ /* Calculate the value of sp_indiff and write to hw_info */
+ sp_indiff = app_cap & NFP_NET_APP_CAP_SP_INDIFF;
}
- /* Calculate the value of sp_indiff and write to hw_info */
- sp_indiff = app_cap & NFP_NET_APP_CAP_SP_INDIFF;
snprintf(hw_info, sizeof(hw_info), "sp_indiff=%u", sp_indiff);
nsp = nfp_nsp_open(cpp);
if (nsp == NULL) {
- PMD_INIT_LOG(ERR, "Couldn't get NSP.");
+ PMD_INIT_LOG(ERR, "Could not get NSP.");
return -EIO;
}
@@ -1873,7 +1877,7 @@ nfp_pf_init(struct rte_pci_device *pci_dev)
}
/* Write sp_indiff to hw_info */
- ret = nfp_net_hwinfo_set(function_id, sym_tbl, cpp);
+ ret = nfp_net_hwinfo_set(function_id, sym_tbl, cpp, app_fw_id);
if (ret != 0) {
PMD_INIT_LOG(ERR, "Failed to set hwinfo.");
ret = -EIO;
--
2.39.1
next reply other threads:[~2024-03-08 3:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-08 3:11 Chaoyong He [this message]
2024-03-08 9:46 ` Ferruh Yigit
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=20240308031110.2041280-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).