1 From 81e60b2dfb2744ab6642c4aa62534b4f711fdc5d Mon Sep 17 00:00:00 2001
2 From: Aditya Kumar Singh <quic_adisi@quicinc.com>
3 Date: Tue, 27 Sep 2022 09:18:54 +0300
4 Subject: [PATCH] wifi: ath11k: stop tx queues immediately upon firmware exit
6 Currently, recovery flag is set immediately upon firmware
7 exit but tx queues are stopped once firmware arrives back
8 and is ready which is during ath11k_core_restart. Once
9 ieee80211 hw restart is completed, tx queues are resumed.
10 If during the time delta between firmware exit and firmware
11 ready, mac80211 send packets, currently ath11k will drop it
12 since recovery flag will be set. But warning prints will
14 "ath11k c000000.wifi: failed to transmit frame -108"
16 If more tx packets are there, this could lead to flooding
19 However, actually tx queues should be stopped immediately
20 when firmware leaves. This will prevent packets to get
21 dropped when firmware is recovering.
23 Add fix to stop tx queues immediately after firmware exit.
25 Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.5.0.1-01100-QCAHKSWPL_SILICONZ-1
27 Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
28 Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
29 Link: https://lore.kernel.org/r/20220923170235.18873-1-quic_adisi@quicinc.com
31 drivers/net/wireless/ath/ath11k/core.c | 5 +----
32 drivers/net/wireless/ath/ath11k/core.h | 1 +
33 drivers/net/wireless/ath/ath11k/qmi.c | 3 +++
34 3 files changed, 5 insertions(+), 4 deletions(-)
36 --- a/drivers/net/wireless/ath/ath11k/core.c
37 +++ b/drivers/net/wireless/ath/ath11k/core.c
38 @@ -1641,7 +1641,7 @@ static void ath11k_update_11d(struct wor
42 -static void ath11k_core_pre_reconfigure_recovery(struct ath11k_base *ab)
43 +void ath11k_core_pre_reconfigure_recovery(struct ath11k_base *ab)
46 struct ath11k_pdev *pdev;
47 @@ -1730,9 +1730,6 @@ static void ath11k_core_restart(struct w
48 struct ath11k_base *ab = container_of(work, struct ath11k_base, restart_work);
52 - ath11k_core_pre_reconfigure_recovery(ab);
54 ret = ath11k_core_reconfigure_on_crash(ab);
56 ath11k_err(ab, "failed to reconfigure driver on crash recovery\n");
57 --- a/drivers/net/wireless/ath/ath11k/core.h
58 +++ b/drivers/net/wireless/ath/ath11k/core.h
59 @@ -1157,6 +1157,7 @@ int ath11k_core_check_smbios(struct ath1
60 void ath11k_core_halt(struct ath11k *ar);
61 int ath11k_core_resume(struct ath11k_base *ab);
62 int ath11k_core_suspend(struct ath11k_base *ab);
63 +void ath11k_core_pre_reconfigure_recovery(struct ath11k_base *ab);
65 const struct firmware *ath11k_core_firmware_request(struct ath11k_base *ab,
66 const char *filename);
67 --- a/drivers/net/wireless/ath/ath11k/qmi.c
68 +++ b/drivers/net/wireless/ath/ath11k/qmi.c
69 @@ -3158,6 +3158,9 @@ static void ath11k_qmi_driver_event_work
70 case ATH11K_QMI_EVENT_SERVER_EXIT:
71 set_bit(ATH11K_FLAG_CRASH_FLUSH, &ab->dev_flags);
72 set_bit(ATH11K_FLAG_RECOVERY, &ab->dev_flags);
75 + ath11k_core_pre_reconfigure_recovery(ab);
77 case ATH11K_QMI_EVENT_REQUEST_MEM:
78 ret = ath11k_qmi_event_mem_request(qmi);