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 2/8] net/nfp: speed up the firmware loading process
Date: Mon, 15 Jan 2024 10:54:13 +0800	[thread overview]
Message-ID: <20240115025419.2447759-3-chaoyong.he@corigine.com> (raw)
In-Reply-To: <20240115025419.2447759-1-chaoyong.he@corigine.com>

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

The previous design spent too much time checking whether
the port was alive, now optimize this process and speed
up the firmware loading process.

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 | 29 +++++++++++++++++------------
 1 file changed, 17 insertions(+), 12 deletions(-)

diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 434d664573..e06e6b7f59 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -1065,24 +1065,29 @@ nfp_fw_loaded_check_alive(struct nfp_nsp *nsp,
 		const struct nfp_dev_info *dev_info,
 		struct nfp_multi_pf *multi_pf)
 {
-	int offset;
-	uint32_t i;
-	uint64_t beat;
+	uint8_t i;
+	uint64_t tmp_beat;
 	uint32_t port_num;
+	uint64_t beat[dev_info->pf_num_per_unit];
+	uint32_t offset[dev_info->pf_num_per_unit];
+
+	for (port_num = 0; port_num < dev_info->pf_num_per_unit; port_num++) {
+		offset[port_num] = NFP_BEAT_OFFSET(port_num);
+		beat[port_num] = nn_readq(multi_pf->beat_addr + offset[port_num]);
+	}
 
 	/*
 	 * If the beats of any other port changed in 3s,
 	 * we should not reload the firmware.
 	 */
-	for (port_num = 0; port_num < dev_info->pf_num_per_unit; port_num++) {
-		if (port_num == multi_pf->function_id)
-			continue;
-
-		offset = NFP_BEAT_OFFSET(port_num);
-		beat = nn_readq(multi_pf->beat_addr + offset);
-		for (i = 0; i < 3; i++) {
-			sleep(1);
-			if (nn_readq(multi_pf->beat_addr + offset) != beat)
+	for (i = 0; i < 3; i++) {
+		sleep(1);
+		for (port_num = 0; port_num < dev_info->pf_num_per_unit; port_num++) {
+			if (port_num == multi_pf->function_id)
+				continue;
+
+			tmp_beat = nn_readq(multi_pf->beat_addr + offset[port_num]);
+			if (tmp_beat != beat[port_num])
 				return 0;
 		}
 	}
-- 
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 " 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 ` Chaoyong He [this message]
2024-01-15  2:54 ` [PATCH 3/8] net/nfp: optimize loading the firmware process Chaoyong He
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-3-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).