[11/13] net/bnxt: reschedule the health check alarm correctly
Checks
Commit Message
From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
When the driver receives the error recovery notify event from fw
for the first time, it has to read the heartbeat count register and
recovery count register and schedule the fw health check task for
periodically monitoring the fw health.
FW may send this event at a later time when the state of master function
changes. There is no need to schedule the health check task this time.
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
drivers/net/bnxt/bnxt.h | 1 +
drivers/net/bnxt/bnxt_cpr.c | 3 +++
drivers/net/bnxt/bnxt_ethdev.c | 2 ++
3 files changed, 6 insertions(+)
@@ -422,6 +422,7 @@ struct bnxt {
#define BNXT_FLAG_EXT_STATS_SUPPORTED BIT(19)
#define BNXT_FLAG_NEW_RM BIT(20)
#define BNXT_FLAG_INIT_DONE BIT(21)
+#define BNXT_FLAG_FW_HEALTH_CHECK_SCHEDULED BIT(22)
#define BNXT_PF(bp) (!((bp)->flags & BNXT_FLAG_VF))
#define BNXT_VF(bp) ((bp)->flags & BNXT_FLAG_VF)
#define BNXT_NPAR(bp) ((bp)->port_partition_type)
@@ -89,6 +89,9 @@ void bnxt_handle_async_event(struct bnxt *bp,
bnxt_is_recovery_enabled(bp),
bnxt_is_master_func(bp));
+ if (bp->flags & BNXT_FLAG_FW_HEALTH_CHECK_SCHEDULED)
+ return;
+
info->last_heart_beat =
bnxt_read_fw_status_reg(bp, BNXT_FW_HEARTBEAT_CNT_REG);
info->last_reset_counter =
@@ -3687,6 +3687,7 @@ void bnxt_schedule_fw_health_check(struct bnxt *bp)
rte_eal_alarm_set(US_PER_MS * polling_freq,
bnxt_check_fw_health, (void *)bp);
+ bp->flags |= BNXT_FLAG_FW_HEALTH_CHECK_SCHEDULED;
}
static void bnxt_cancel_fw_health_check(struct bnxt *bp)
@@ -3695,6 +3696,7 @@ static void bnxt_cancel_fw_health_check(struct bnxt *bp)
return;
rte_eal_alarm_cancel(bnxt_check_fw_health, (void *)bp);
+ bp->flags &= ~BNXT_FLAG_FW_HEALTH_CHECK_SCHEDULED;
}
static bool bnxt_vf_pciid(uint16_t id)