diff mbox series

wifi: ath12k: change to initialize recovery variables earlier in ath12k_core_reset()

Message ID 20230830060850.18881-1-quic_wgong@quicinc.com (mailing list archive)
State Accepted
Commit 41e7a399aea1dbf3d0ffdeb6ef8e9eaea7fa6cf5
Delegated to: Kalle Valo
Headers show
Series wifi: ath12k: change to initialize recovery variables earlier in ath12k_core_reset() | expand

Commit Message

Wen Gong Aug. 30, 2023, 6:08 a.m. UTC
Sometimes device recovery fail with this operation.
Run test command for many times:
echo assert > /sys/kernel/debug/ath12k/wcn7850\ hw2.0_0000\:03\:00.0/simulate_fw_crash

While recovery start, ath12k_core_post_reconfigure_recovery() will
call ieee80211_restart_hw(), and the restart_work which queued by
ieee80211_restart_hw() is running in another thread, it will call
into ath12k_mac_op_start() and ath12k_mac_wait_reconfigure(), and
the variables ab->recovery_start_count and ab->recovery_start is used
in ath12k_mac_wait_reconfigure(), so ath12k need to initialize the
variables before queue the restart_work, otherwise ath12k_mac_wait_reconfigure()
maybe use the un-initialized variables. Change to initialize the 2
variables earlier and then recovery process become correct.

Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0-03427-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1.15378.4

Signed-off-by: Wen Gong <quic_wgong@quicinc.com>
---
 drivers/net/wireless/ath/ath12k/core.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)


base-commit: 3f257461ab0ab19806bae2bfde4c3cd88dbf050e

Comments

Kalle Valo Sept. 20, 2023, 1:37 p.m. UTC | #1
Wen Gong <quic_wgong@quicinc.com> wrote:

> Sometimes device recovery fail with this operation.
> Run test command for many times:
> echo assert > /sys/kernel/debug/ath12k/wcn7850\ hw2.0_0000\:03\:00.0/simulate_fw_crash
> 
> While recovery start, ath12k_core_post_reconfigure_recovery() will
> call ieee80211_restart_hw(), and the restart_work which queued by
> ieee80211_restart_hw() is running in another thread, it will call
> into ath12k_mac_op_start() and ath12k_mac_wait_reconfigure(), and
> the variables ab->recovery_start_count and ab->recovery_start is used
> in ath12k_mac_wait_reconfigure(), so ath12k need to initialize the
> variables before queue the restart_work, otherwise ath12k_mac_wait_reconfigure()
> maybe use the un-initialized variables. Change to initialize the 2
> variables earlier and then recovery process become correct.
> 
> Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0-03427-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1.15378.4
> 
> Signed-off-by: Wen Gong <quic_wgong@quicinc.com>
> Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>

Patch applied to ath-next branch of ath.git, thanks.

41e7a399aea1 wifi: ath12k: change to initialize recovery variables earlier in ath12k_core_reset()
diff mbox series

Patch

diff --git a/drivers/net/wireless/ath/ath12k/core.c b/drivers/net/wireless/ath/ath12k/core.c
index 3df8059d5512..39f938fafa81 100644
--- a/drivers/net/wireless/ath/ath12k/core.c
+++ b/drivers/net/wireless/ath/ath12k/core.c
@@ -823,6 +823,8 @@  static void ath12k_core_reset(struct work_struct *work)
 	ath12k_dbg(ab, ATH12K_DBG_BOOT, "reset starting\n");
 
 	ab->is_reset = true;
+	atomic_set(&ab->recovery_start_count, 0);
+	reinit_completion(&ab->recovery_start);
 	atomic_set(&ab->recovery_count, 0);
 
 	ath12k_core_pre_reconfigure_recovery(ab);
@@ -830,9 +832,6 @@  static void ath12k_core_reset(struct work_struct *work)
 	reinit_completion(&ab->reconfigure_complete);
 	ath12k_core_post_reconfigure_recovery(ab);
 
-	reinit_completion(&ab->recovery_start);
-	atomic_set(&ab->recovery_start_count, 0);
-
 	ath12k_dbg(ab, ATH12K_DBG_BOOT, "waiting recovery start...\n");
 
 	time_left = wait_for_completion_timeout(&ab->recovery_start,