Skip to content

Commit f415748

Browse files
maurerlebenzea
authored andcommitted
ath11k: fix transmit queue flushing through flush_sta implementation
warning print "ath11k c000000.wifi: failed to flush transmit queue 0" is observed during busy times. The mac80211 fallback implementation of `flush_sta` does not handle the per STA queues well. This is fixed by providing a ath11k specific implementation of flush_sta telling the firmware to flush a given station. The draining of the transmit queues should therefore stop correctly, even if new packets arrive in the mean time. An upstream ath11k RFC is available at: https://patchwork.kernel.org/project/linux-wireless/patch/GV1P250MB14333A5BF24623C4753A10E1E8E0A@GV1P250MB1433.EURP250.PROD.OUTLOOK.COM/ The patch was tested on a Xiaomi AX3600. Signed-off-by: Florian Maurer <[email protected]> Tested-by: Florian Maurer <[email protected]> Co-authored-by: Benjamin Berg <[email protected]> Tested-by: Flole <[email protected]> Link: openwrt/openwrt#20293 Signed-off-by: Christian Marangi <[email protected]> (cherry picked from commit 8faa9de) Signed-off-by: Felix Baumann <[email protected]> Link: openwrt/openwrt#20667 Signed-off-by: Hauke Mehrtens <[email protected]>
1 parent 9123a0c commit f415748

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
From b5ade0e0e1c1622a85fbfd2c93b41caff479f305 Mon Sep 17 00:00:00 2001
2+
From: Florian Maurer <[email protected]>
3+
Date: Fri, 3 Oct 2025 12:56:13 +0200
4+
Subject: [PATCH] ath11k: add ath11k_mac_op_flush_sta to properly flush pending
5+
packets
6+
7+
When a STA is marked as no longer authorized, if the driver doesn't
8+
implement flush_sta(), mac80211 calls ieee80211_flush_queues() to
9+
flush hardware queues to avoid sending unencrypted frames.
10+
11+
This has became a problem for ath11k because ieee80211_flush_queues()
12+
will stop all traffic and call ath11k_flush, which waits until the
13+
whole HW queue is empty. In a busy environment this will trigger a
14+
timeout warning and stalls other STAs.
15+
16+
Fix this by implementing flush_sta method using WMI command to flush
17+
frames of a specific STA.
18+
Flushed frames will be marked as discard in tx complete indication.
19+
20+
warning print "ath11k c000000.wifi: failed to flush transmit queue 0"
21+
was observed on various openwrt devices, and is fixed through this patch.
22+
23+
Tested-by: Florian Maurer <[email protected]>
24+
Tested-by: Flole <[email protected]>
25+
Co-developed-by: Benjamin Berg <[email protected]>
26+
Signed-off-by: Benjamin Berg <[email protected]>
27+
Signed-off-by: Florian Maurer <[email protected]>
28+
---
29+
drivers/net/wireless/ath/ath11k/mac.c | 18 ++++++++++++++++++
30+
1 file changed, 18 insertions(+)
31+
32+
--- a/drivers/net/wireless/ath/ath11k/mac.c
33+
+++ b/drivers/net/wireless/ath/ath11k/mac.c
34+
@@ -8278,6 +8278,23 @@ static void ath11k_mac_op_flush(struct i
35+
ath11k_mac_flush_tx_complete(ar);
36+
}
37+
38+
+static void ath11k_mac_op_flush_sta(struct ieee80211_hw *hw,
39+
+ struct ieee80211_vif *vif,
40+
+ struct ieee80211_sta *sta)
41+
+{
42+
+ struct ath11k_vif *arvif = (void *)vif->drv_priv;
43+
+ struct ath11k *ar = hw->priv;
44+
+ struct peer_flush_params params = {
45+
+ .peer_tid_bitmap = 0xFF,
46+
+ .vdev_id = arvif->vdev_id,
47+
+ };
48+
+ int ret;
49+
+
50+
+ ret = ath11k_wmi_send_peer_flush_tids_cmd(ar, sta->addr, &params);
51+
+ if (ret)
52+
+ ath11k_warn(ar->ab, "failed to flush sta %pM: %d\n", sta->addr, ret);
53+
+}
54+
+
55+
static bool
56+
ath11k_mac_has_single_legacy_rate(struct ath11k *ar,
57+
enum nl80211_band band,
58+
@@ -9910,6 +9927,7 @@ static const struct ieee80211_ops ath11k
59+
.set_bitrate_mask = ath11k_mac_op_set_bitrate_mask,
60+
.get_survey = ath11k_mac_op_get_survey,
61+
.flush = ath11k_mac_op_flush,
62+
+ .flush_sta = ath11k_mac_op_flush_sta,
63+
.sta_statistics = ath11k_mac_op_sta_statistics,
64+
CFG80211_TESTMODE_CMD(ath11k_tm_cmd)
65+

0 commit comments

Comments
 (0)