DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] net/nfp: fix failure of PF initiation on flower firmware
@ 2024-03-08  3:11 Chaoyong He
  2024-03-08  9:46 ` Ferruh Yigit
  0 siblings, 1 reply; 2+ messages in thread
From: Chaoyong He @ 2024-03-08  3:11 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Zerun Fu, stable, Chaoyong He, Long Wu, Peng Zhang

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


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

* Re: [PATCH] net/nfp: fix failure of PF initiation on flower firmware
  2024-03-08  3:11 [PATCH] net/nfp: fix failure of PF initiation on flower firmware Chaoyong He
@ 2024-03-08  9:46 ` Ferruh Yigit
  0 siblings, 0 replies; 2+ messages in thread
From: Ferruh Yigit @ 2024-03-08  9:46 UTC (permalink / raw)
  To: Chaoyong He, dev; +Cc: oss-drivers, Zerun Fu, stable, Long Wu, Peng Zhang

On 3/8/2024 3:11 AM, Chaoyong He wrote:
> 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>
>

Applied to dpdk-next-net/main, thanks.

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

end of thread, other threads:[~2024-03-08  9:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-08  3:11 [PATCH] net/nfp: fix failure of PF initiation on flower firmware Chaoyong He
2024-03-08  9:46 ` Ferruh Yigit

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