DPDK patches and discussions
 help / color / mirror / Atom feed
From: Chaoyong He <chaoyong.he@corigine.com>
To: dev@dpdk.org
Cc: oss-drivers@corigine.com, Peng Zhang <peng.zhang@corigine.com>,
	Chaoyong He <chaoyong.he@corigine.com>,
	Long Wu <long.wu@corigine.com>
Subject: [PATCH 3/8] net/nfp: optimize loading the firmware process
Date: Mon, 15 Jan 2024 10:54:14 +0800	[thread overview]
Message-ID: <20240115025419.2447759-4-chaoyong.he@corigine.com> (raw)
In-Reply-To: <20240115025419.2447759-1-chaoyong.he@corigine.com>

From: Peng Zhang <peng.zhang@corigine.com>

Add the skip loading firmware flag, when any other
port is alive, this flag will be true.
Also make sure the order of starting the keepalive
is earlier than getting the firmware status.

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

diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index e06e6b7f59..e908fc8472 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -1059,10 +1059,8 @@ nfp_fw_reload(struct nfp_nsp *nsp,
 	return err;
 }
 
-static int
-nfp_fw_loaded_check_alive(struct nfp_nsp *nsp,
-		char *fw_name,
-		const struct nfp_dev_info *dev_info,
+static bool
+nfp_fw_skip_load(const struct nfp_dev_info *dev_info,
 		struct nfp_multi_pf *multi_pf)
 {
 	uint8_t i;
@@ -1088,11 +1086,11 @@ nfp_fw_loaded_check_alive(struct nfp_nsp *nsp,
 
 			tmp_beat = nn_readq(multi_pf->beat_addr + offset[port_num]);
 			if (tmp_beat != beat[port_num])
-				return 0;
+				return true;
 		}
 	}
 
-	return nfp_fw_reload(nsp, fw_name);
+	return false;
 }
 
 static int
@@ -1103,17 +1101,11 @@ nfp_fw_reload_for_multipf(struct nfp_nsp *nsp,
 		struct nfp_multi_pf *multi_pf)
 {
 	int err;
+	bool skip_load_fw = false;
 
 	err = nfp_net_keepalive_init(cpp, multi_pf);
-	if (err != 0)
-		PMD_DRV_LOG(ERR, "NFP write beat failed");
-
-	if (nfp_nsp_fw_loaded(nsp))
-		err = nfp_fw_loaded_check_alive(nsp, fw_name, dev_info, multi_pf);
-	else
-		err = nfp_fw_reload(nsp, fw_name);
 	if (err != 0) {
-		nfp_net_keepalive_uninit(multi_pf);
+		PMD_DRV_LOG(ERR, "NFP init beat failed");
 		return err;
 	}
 
@@ -1121,9 +1113,23 @@ nfp_fw_reload_for_multipf(struct nfp_nsp *nsp,
 	if (err != 0) {
 		nfp_net_keepalive_uninit(multi_pf);
 		PMD_DRV_LOG(ERR, "NFP write beat failed");
+		return err;
 	}
 
-	return err;
+	if (nfp_nsp_fw_loaded(nsp))
+		skip_load_fw = nfp_fw_skip_load(dev_info, multi_pf);
+
+	if (skip_load_fw)
+		return 0;
+
+	err = nfp_fw_reload(nsp, fw_name);
+	if (err != 0) {
+		nfp_net_keepalive_stop(multi_pf);
+		nfp_net_keepalive_uninit(multi_pf);
+		return err;
+	}
+
+	return 0;
 }
 
 static int
-- 
2.39.1


  parent reply	other threads:[~2024-01-15  2:55 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-15  2:54 [PATCH 0/8] optimize the firmware loading process Chaoyong He
2024-01-15  2:54 ` [PATCH 1/8] net/nfp: add the interface for getting the firmware name Chaoyong He
2024-01-15  2:54 ` [PATCH 2/8] net/nfp: speed up the firmware loading process Chaoyong He
2024-01-15  2:54 ` Chaoyong He [this message]
2024-01-15  2:54 ` [PATCH 4/8] net/nfp: enlarge the range of skipping loading the firmware Chaoyong He
2024-01-15  2:54 ` [PATCH 5/8] net/nfp: add the step of clearing the beat time Chaoyong He
2024-01-15  2:54 ` [PATCH 6/8] net/nfp: add the elf module Chaoyong He
2024-01-15  2:54 ` [PATCH 7/8] net/nfp: reload the firmware only when firmware changed Chaoyong He
2024-01-15  2:54 ` [PATCH 8/8] net/nfp: simplify the port name for multiple PFs Chaoyong He
2024-01-22 15:08 ` [PATCH 0/8] optimize the firmware loading process Ferruh Yigit
2024-01-23  1:46   ` Chaoyong He
2024-01-23  9:14     ` Ferruh Yigit
2024-01-23 11:27       ` Chaoyong He
2024-01-23 11:42         ` Ferruh Yigit
2024-01-26  8:25           ` Chaoyong He
2024-01-23 15:18 ` 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=20240115025419.2447759-4-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 \
    /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).