[dpdk-dev] [PATCH 11/13] net/bnxt: reschedule the health check alarm correctly

Ajit Khaparde ajit.khaparde at broadcom.com
Thu Aug 22 07:53:58 CEST 2019


From: Kalesh AP <kalesh-anakkur.purayil at 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 at broadcom.com>
Reviewed-by: Santoshkumar Karanappa Rastapur <santosh.rastapur at broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde at 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(+)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index 93aac15b4..edaef7897 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -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)
diff --git a/drivers/net/bnxt/bnxt_cpr.c b/drivers/net/bnxt/bnxt_cpr.c
index a692fbe7c..50f93bd21 100644
--- a/drivers/net/bnxt/bnxt_cpr.c
+++ b/drivers/net/bnxt/bnxt_cpr.c
@@ -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 =
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 0317eb888..e7b0b44c4 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -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)
-- 
2.20.1 (Apple Git-117)



More information about the dev mailing list