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 4/8] net/nfp: enlarge the range of skipping loading the firmware
Date: Mon, 15 Jan 2024 10:54:15 +0800	[thread overview]
Message-ID: <20240115025419.2447759-5-chaoyong.he@corigine.com> (raw)
In-Reply-To: <20240115025419.2447759-1-chaoyong.he@corigine.com>

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

Enlarge the range of skip loading firmware by add the condition
there is no port with the condition of abnormal.

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 | 30 ++++++++++++++++++++++++------
 1 file changed, 24 insertions(+), 6 deletions(-)

diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index e908fc8472..25f5fe483f 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -1066,28 +1066,46 @@ nfp_fw_skip_load(const struct nfp_dev_info *dev_info,
 	uint8_t i;
 	uint64_t tmp_beat;
 	uint32_t port_num;
+	uint8_t in_use = 0;
 	uint64_t beat[dev_info->pf_num_per_unit];
 	uint32_t offset[dev_info->pf_num_per_unit];
+	uint8_t abnormal = 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 (beat[port_num] == 0)
+			abnormal--;
 	}
 
-	/*
-	 * If the beats of any other port changed in 3s,
-	 * we should not reload the firmware.
-	 */
+	if (abnormal == 0)
+		return true;
+
 	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;
 
+			if (beat[port_num] == 0)
+				continue;
+
 			tmp_beat = nn_readq(multi_pf->beat_addr + offset[port_num]);
-			if (tmp_beat != beat[port_num])
-				return true;
+			if (tmp_beat != beat[port_num]) {
+				in_use++;
+				abnormal--;
+				beat[port_num] = 0;
+			}
 		}
+
+		if (abnormal == 0)
+			return true;
+	}
+
+	if (in_use != 0) {
+		PMD_DRV_LOG(WARNING, "Abnormal %u != 0, the nic has port which is exit abnormally.",
+				abnormal);
+		return true;
 	}
 
 	return false;
-- 
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 ` [PATCH 3/8] net/nfp: optimize loading the firmware process Chaoyong He
2024-01-15  2:54 ` Chaoyong He [this message]
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-5-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).