* [PATCH 1/2] net/nfp: fix logic of load firmware from flash
[not found] <20250122014751.1706413-1-chaoyong.he@corigine.com>
@ 2025-01-22 1:47 ` Chaoyong He
0 siblings, 0 replies; only message in thread
From: Chaoyong He @ 2025-01-22 1:47 UTC (permalink / raw)
To: dev; +Cc: oss-drivers, Chaoyong He, stable, Long Wu, Peng Zhang
The firmware load policy 'NFP_NSP_APP_FW_LOAD_FLASH' means first try to
load from file system, if failed then try to load from flash.
The original logic will cause load firmware fail if any mistake occurs
in the load from file system process.
Fix this by relocated the related logic.
Fixes: 08ea495d624b ("net/nfp: support loading firmware from flash")
Cc: stable@dpdk.org
Signed-off-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 | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index f54483822f..13751469b8 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -1529,16 +1529,16 @@ nfp_fw_reload_for_single_pf(struct nfp_nsp *nsp,
{
int ret;
- if (policy == NFP_NSP_APP_FW_LOAD_FLASH && nfp_nsp_has_stored_fw_load(nsp)) {
- ret = nfp_fw_reload_from_flash(nsp);
+ if (fw_name[0] != 0 && policy != NFP_NSP_APP_FW_LOAD_FLASH) {
+ ret = nfp_fw_reload_for_single_pf_from_disk(nsp, fw_name, pf_dev, reset);
if (ret != 0) {
- PMD_DRV_LOG(ERR, "Load single PF firmware from flash failed.");
+ PMD_DRV_LOG(ERR, "Load single PF firmware from disk failed.");
return ret;
}
- } else if (fw_name[0] != 0) {
- ret = nfp_fw_reload_for_single_pf_from_disk(nsp, fw_name, pf_dev, reset);
+ } else if (policy != NFP_NSP_APP_FW_LOAD_DISK && nfp_nsp_has_stored_fw_load(nsp)) {
+ ret = nfp_fw_reload_from_flash(nsp);
if (ret != 0) {
- PMD_DRV_LOG(ERR, "Load single PF firmware from disk failed.");
+ PMD_DRV_LOG(ERR, "Load single PF firmware from flash failed.");
return ret;
}
} else {
@@ -1605,19 +1605,19 @@ nfp_fw_reload_for_multi_pf(struct nfp_nsp *nsp,
goto keepalive_uninit;
}
- if (policy == NFP_NSP_APP_FW_LOAD_FLASH && nfp_nsp_has_stored_fw_load(nsp)) {
- err = nfp_fw_reload_from_flash(nsp);
- if (err != 0) {
- PMD_DRV_LOG(ERR, "Load multi PF firmware from flash failed.");
- goto keepalive_stop;
- }
- } else if (fw_name[0] != 0) {
+ if (fw_name[0] != 0 && policy != NFP_NSP_APP_FW_LOAD_FLASH) {
err = nfp_fw_reload_for_multi_pf_from_disk(nsp, fw_name, dev_info,
pf_dev, reset);
if (err != 0) {
PMD_DRV_LOG(ERR, "Load multi PF firmware from disk failed.");
goto keepalive_stop;
}
+ } else if (policy != NFP_NSP_APP_FW_LOAD_DISK && nfp_nsp_has_stored_fw_load(nsp)) {
+ err = nfp_fw_reload_from_flash(nsp);
+ if (err != 0) {
+ PMD_DRV_LOG(ERR, "Load multi PF firmware from flash failed.");
+ goto keepalive_stop;
+ }
} else {
PMD_DRV_LOG(ERR, "Not load firmware, please update flash or recofigure card.");
err = -ENODATA;
@@ -1723,8 +1723,8 @@ nfp_fw_setup(struct nfp_pf_dev *pf_dev,
if (policy != NFP_NSP_APP_FW_LOAD_FLASH) {
err = nfp_fw_get_name(pf_dev, fw_name, sizeof(fw_name));
if (err != 0) {
- PMD_DRV_LOG(ERR, "Can not find suitable firmware.");
- goto close_nsp;
+ fw_name[0] = 0;
+ PMD_DRV_LOG(DEBUG, "Can not find suitable firmware.");
}
}
--
2.43.5
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-01-22 1:48 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20250122014751.1706413-1-chaoyong.he@corigine.com>
2025-01-22 1:47 ` [PATCH 1/2] net/nfp: fix logic of load firmware from flash 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).