[PATCH ath-next 4/8] wifi: ath10k: bound recovery time before entering WEDGED
Kang Yang
kang.yang at oss.qualcomm.com
Fri Sep 25 05:26:34 PDT 2026
Commit c256a94d1b1b ("wifi: ath10k: shutdown driver when
hardware is unreliable") added fail_cont_count tracking and
declared the device wedged after a fixed number of recovery
failures.
This relies solely on the number of observed failures and
does not place any bound on the total time spent in recovery.
As a result, the time required to reach ATH10K_STATE_WEDGED
depends on how recovery failures are observed rather than on
a fixed recovery budget.
In practice, recovery-related delays can stretch the interval
between failures and allow recovery attempts to continue far
longer than intended before the driver finally gives up.
Add ATH10K_RECOVERY_DEADLINE_HZ (15 seconds) as an independent upper
bound for each recovery attempt and declare the device wedged once either
the deadline expires or fail_cont_count reaches
ATH10K_RECOVERY_MAX_FAIL_COUNT.
Also reduce ATH10K_RECOVERY_MAX_FAIL_COUNT from 4 to 2 so
repeated failures reach the WEDGED state sooner.
This keeps recovery time bounded and helps avoid suspend
watchdog timeouts on platforms with tighter watchdog limits.
Tested-on: QCA6174 hw3.2 PCI WLAN.RM.4.4.1-00288-QCARMSWPZ-1
Fixes: c256a94d1b1b ("wifi: ath10k: shutdown driver when hardware is unreliable")
Signed-off-by: Kang Yang <kang.yang at oss.qualcomm.com>
---
drivers/net/wireless/ath/ath10k/core.c | 8 +++++---
drivers/net/wireless/ath/ath10k/core.h | 8 +++++++-
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
index f2e457a0fcbe..29ca34a643ed 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -15,6 +15,7 @@
#include <linux/ctype.h>
#include <linux/pm_qos.h>
#include <linux/nvmem-consumer.h>
+#include <linux/jiffies.h>
#include <asm/byteorder.h>
#include "core.h"
@@ -2541,9 +2542,10 @@ static void ath10k_core_recovery_check_work(struct work_struct *work)
/* Record the continuous recovery fail count when recovery is late. */
fail_count = atomic_inc_return(&ar->fail_cont_count);
- if (fail_count >= ATH10K_RECOVERY_MAX_FAIL_COUNT) {
- ath10k_err(ar, "consecutive fail %d times, will shutdown driver!",
- fail_count);
+ if (fail_count >= ATH10K_RECOVERY_MAX_FAIL_COUNT ||
+ time_after(jiffies, recovery_start + ATH10K_RECOVERY_DEADLINE_HZ)) {
+ ath10k_err(ar, "recovery timeout %ums, fail count %d, shutting down driver!",
+ jiffies_to_msecs(jiffies - recovery_start), fail_count);
ath10k_core_enter_wedged(ar);
}
}
diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h
index c739fbadc8bb..0319da3ec022 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -88,7 +88,13 @@
#define ATH10K_ITER_RESUME_FLAGS (IEEE80211_IFACE_ITER_RESUME_ALL |\
IEEE80211_IFACE_SKIP_SDATA_NOT_IN_DRIVER)
#define ATH10K_RECOVERY_TIMEOUT_HZ (5 * HZ)
-#define ATH10K_RECOVERY_MAX_FAIL_COUNT 4
+#define ATH10K_RECOVERY_MAX_FAIL_COUNT 2
+/*
+ * Some platforms configure suspend watchdogs as low as 25s; cap the
+ * total recovery time well under that so the WEDGED transition and
+ * any teardown that follows still have room to run before it fires.
+ */
+#define ATH10K_RECOVERY_DEADLINE_HZ (15 * HZ)
struct ath10k;
--
2.34.1
More information about the ath10k
mailing list