mac80211: Update to version 5.9.12-1
[openwrt/openwrt.git] / package / kernel / mac80211 / patches / subsys / 332-mac80211-fix-regression-in-sta-connection-monitor.patch
1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Mon, 21 Sep 2020 17:43:06 +0200
3 Subject: [PATCH] mac80211: fix regression in sta connection monitor
4
5 When a frame was acked and probe frames were sent, the connection monitoring
6 needs to be reset, otherwise it will keep probing until the connection is
7 considered dead, even though frames have been acked in the mean time.
8
9 Fixes: 9abf4e49830d ("mac80211: optimize station connection monitor")
10 Reported-by: Georgi Valkov <gvalkov@abv.bg>
11 Signed-off-by: Felix Fietkau <nbd@nbd.name>
12 ---
13
14 --- a/net/mac80211/status.c
15 +++ b/net/mac80211/status.c
16 @@ -989,10 +989,6 @@ static void __ieee80211_tx_status(struct
17 if (!(info->flags & IEEE80211_TX_CTL_INJECTED) && acked)
18 ieee80211_frame_acked(sta, skb);
19
20 - if ((sta->sdata->vif.type == NL80211_IFTYPE_STATION) &&
21 - ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS))
22 - ieee80211_sta_tx_notify(sta->sdata, (void *) skb->data,
23 - acked, info->status.tx_time);
24 }
25
26 /* SNMP counters
27 @@ -1127,11 +1123,18 @@ void ieee80211_tx_status_ext(struct ieee
28 noack_success = !!(info->flags & IEEE80211_TX_STAT_NOACK_TRANSMITTED);
29
30 if (pubsta) {
31 + struct ieee80211_sub_if_data *sdata = sta->sdata;
32 +
33 if (!acked && !noack_success)
34 sta->status_stats.retry_failed++;
35 sta->status_stats.retry_count += retry_count;
36
37 if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) {
38 + if (sdata->vif.type == NL80211_IFTYPE_STATION &&
39 + skb && !(info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP))
40 + ieee80211_sta_tx_notify(sdata, (void *) skb->data,
41 + acked, info->status.tx_time);
42 +
43 if (acked) {
44 sta->status_stats.last_ack = jiffies;
45
46 @@ -1141,6 +1144,11 @@ void ieee80211_tx_status_ext(struct ieee
47 /* Track when last packet was ACKed */
48 sta->status_stats.last_pkt_time = jiffies;
49
50 + /* Reset connection monitor */
51 + if (sdata->vif.type == NL80211_IFTYPE_STATION &&
52 + unlikely(sdata->u.mgd.probe_send_count > 0))
53 + sdata->u.mgd.probe_send_count = 0;
54 +
55 if (info->status.is_valid_ack_signal) {
56 sta->status_stats.last_ack_signal =
57 (s8)info->status.ack_signal;
58 --- a/net/mac80211/mlme.c
59 +++ b/net/mac80211/mlme.c
60 @@ -2508,7 +2508,9 @@ void ieee80211_sta_tx_notify(struct ieee
61 !sdata->u.mgd.probe_send_count)
62 return;
63
64 - if (!ack)
65 + if (ack)
66 + sdata->u.mgd.probe_send_count = 0;
67 + else
68 sdata->u.mgd.nullfunc_failed = true;
69 ieee80211_queue_work(&sdata->local->hw, &sdata->work);
70 }