[4/8] net/nfp: enlarge the range of skipping loading the firmware
Checks
Commit Message
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(-)
@@ -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;