Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
From: David Bauer <mail@david-bauer.net>
Date: Thu, 14 Mar 2024 09:39:22 +0100
Subject: mt76: include fixes for MT7603 / MT7612
diff --git a/package/kernel/mt76/patches/0001-tx-add-limit-for-TXS-ack-override.patch b/package/kernel/mt76/patches/0001-tx-add-limit-for-TXS-ack-override.patch
new file mode 100644
index 0000000000000000000000000000000000000000..568c590f24c251dda70522865af32b3753cd5beb
--- /dev/null
+++ b/package/kernel/mt76/patches/0001-tx-add-limit-for-TXS-ack-override.patch
@@ -0,0 +1,79 @@
+From a95c23b2c2e923ed293eb794b74735c7d6c5b272 Mon Sep 17 00:00:00 2001
+From: David Bauer <mail@david-bauer.net>
+Date: Fri, 1 Mar 2024 17:41:33 +0100
+Subject: [PATCH 1/2] tx: add limit for TXS ack override
+
+Add an upper limit for overriding missing TX status for each client.
+
+This avoids clients, which to mac80211 still appear as if they are
+connected when in fact they are not reachable for the AP anymore.
+
+This can happen, as the radio (observed on MT7603 in particular) might
+skip TX status-reporting which the host will then mark as acked. This
+prevents the client from timing out and become "sticky" on the AP.
+
+Signed-off-by: David Bauer <mail@david-bauer.net>
+---
+ mt76.h | 2 ++
+ tx.c | 20 +++++++++++++++++++-
+ 2 files changed, 21 insertions(+), 1 deletion(-)
+
+diff --git a/mt76.h b/mt76.h
+index fd527649..6d9b7028 100644
+--- a/mt76.h
++++ b/mt76.h
+@@ -330,6 +330,8 @@ struct mt76_wcid {
+ u8 rx_key_pn[IEEE80211_NUM_TIDS + 1][6];
+ u16 cipher;
+
++ u8 txs_failed_cnt;
++
+ u32 tx_info;
+ bool sw_iv;
+
+diff --git a/tx.c b/tx.c
+index 1809b032..65d6104f 100644
+--- a/tx.c
++++ b/tx.c
+@@ -91,6 +91,7 @@ __mt76_tx_status_skb_done(struct mt76_dev *dev, struct sk_buff *skb, u8 flags,
+ {
+ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
+ struct mt76_tx_cb *cb = mt76_tx_skb_cb(skb);
++ struct mt76_wcid *wcid;
+ u8 done = MT_TX_CB_DMA_DONE | MT_TX_CB_TXS_DONE;
+
+ flags |= cb->flags;
+@@ -98,12 +99,29 @@ __mt76_tx_status_skb_done(struct mt76_dev *dev, struct sk_buff *skb, u8 flags,
+
+ if ((flags & done) != done)
+ return;
++
++ wcid = rcu_dereference(dev->wcid[cb->wcid]);
+
+ /* Tx status can be unreliable. if it fails, mark the frame as ACKed */
+ if (flags & MT_TX_CB_TXS_FAILED) {
++ /* Increment station counter */
++ if (wcid && wcid->sta)
++ wcid->txs_failed_cnt++;
++
+ info->status.rates[0].count = 0;
+ info->status.rates[0].idx = -1;
+- info->flags |= IEEE80211_TX_STAT_ACK;
++
++ /**
++ * Check if station counter exceeds the limit for
++ * implicit acks. If not, mark the frame as ACKed.
++ */
++ if (!wcid || wcid->txs_failed_cnt < 25) {
++ info->flags |= IEEE80211_TX_STAT_ACK;
++ }
++ } else if (info->flags & IEEE80211_TX_STAT_ACK) {
++ /* Reset station counter */
++ if (wcid && wcid->sta)
++ wcid->txs_failed_cnt = 0;
+ }
+
+ __skb_queue_tail(list, skb);
+--
+2.43.0
+
diff --git a/package/kernel/mt76/patches/0002-mt76x02-avoid-action-ghost-ack.patch b/package/kernel/mt76/patches/0002-mt76x02-avoid-action-ghost-ack.patch
new file mode 100644
index 0000000000000000000000000000000000000000..0910ed99ef473db9cf4129f88017912b5d63267d
--- /dev/null
+++ b/package/kernel/mt76/patches/0002-mt76x02-avoid-action-ghost-ack.patch
@@ -0,0 +1,80 @@
+From 3c9ecc0c77e85d9ff91faddde59764fbc9316b7c Mon Sep 17 00:00:00 2001
+From: David Bauer <mail@david-bauer.net>
+Date: Sat, 2 Mar 2024 13:14:49 +0100
+Subject: [PATCH 2/2] mt76x02: avoid action ghost-ack
+
+On PMF enabled networks, chip reports ACTION frames always as acked.
+
+In case a roaming-assistant sens link-measurements periodically,
+this results in the station never becoming inactive and not being removed
+from the AP's station list.
+
+Avoid this from happening by marking action frames sent on a PMF enabled
+network as no-ack.
+
+Signed-off-by: David Bauer <mail@david-bauer.net>
+---
+ mt76x02_mac.c | 27 +++++++++++++++++++++++++++
+ mt76x02_mac.h | 1 +
+ 2 files changed, 28 insertions(+)
+
+diff --git a/mt76x02_mac.c b/mt76x02_mac.c
+index d5db6ffd..672e01ec 100644
+--- a/mt76x02_mac.c
++++ b/mt76x02_mac.c
+@@ -544,6 +544,7 @@ void mt76x02_send_tx_status(struct mt76x02_dev *dev,
+ struct ieee80211_tx_status status = {
+ .info = &info
+ };
++ struct ieee80211_hdr *hdr;
+ static const u8 ac_to_tid[4] = {
+ [IEEE80211_AC_BE] = 0,
+ [IEEE80211_AC_BK] = 1,
+@@ -619,6 +620,32 @@ void mt76x02_send_tx_status(struct mt76x02_dev *dev,
+ *update = 1;
+ }
+
++ if (msta && status.skb &&
++ (status.info->flags & IEEE80211_TX_STAT_ACK)) {
++ hdr = (struct ieee80211_hdr *)status.skb->data;
++
++ if (ieee80211_has_protected(hdr->frame_control) &&
++ ieee80211_is_robust_mgmt_frame(status.skb)) {
++ /**
++ * On PMF enabled networks, chip reports ACTION frames
++ * always as acked.
++ *
++ * In case a roaming-assistant sends link-measurements
++ * periodically, this results in the station never
++ * becoming inactive and not being removed from the
++ * AP's station list.
++ */
++
++ if (msta->n_enc_mgmt >= 25) {
++ status.info->flags &= ~IEEE80211_TX_STAT_ACK;
++ } else {
++ msta->n_enc_mgmt++;
++ }
++ } else {
++ msta->n_enc_mgmt = 0;
++ }
++ }
++
+ if (status.skb) {
+ info = *status.info;
+ len = status.skb->len;
+diff --git a/mt76x02_mac.h b/mt76x02_mac.h
+index 5dc6c834..1bd2288f 100644
+--- a/mt76x02_mac.h
++++ b/mt76x02_mac.h
+@@ -39,6 +39,7 @@ struct mt76x02_sta {
+ struct mt76x02_vif *vif;
+ struct mt76x02_tx_status status;
+ int n_frames;
++ u8 n_enc_mgmt;
+
+ struct ewma_pktlen pktlen;
+ };
+--
+2.43.0
+