mac80211: Update to version 5.5.19
[oweals/openwrt.git] / package / kernel / mac80211 / patches / subsys / 305-mac80211-fix-tx-status-for-no-ack-cases.patch
1 From: Markus Theil <markus.theil@tu-ilmenau.de>
2 Date: Wed, 18 Dec 2019 15:27:36 +0100
3 Subject: [PATCH] mac80211: fix tx status for no ack cases
4
5 Before this patch, frames which where successfully transmitted without
6 requiring acks where accounted as lost frames.
7
8 Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
9 Link: https://lore.kernel.org/r/20191218142736.15843-1-markus.theil@tu-ilmenau.de
10 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 ---
12
13 --- a/net/mac80211/status.c
14 +++ b/net/mac80211/status.c
15 @@ -895,6 +895,7 @@ static void __ieee80211_tx_status(struct
16         int rates_idx;
17         bool send_to_cooked;
18         bool acked;
19 +       bool noack_success;
20         struct ieee80211_bar *bar;
21         int shift = 0;
22         int tid = IEEE80211_NUM_TIDS;
23 @@ -913,6 +914,8 @@ static void __ieee80211_tx_status(struct
24                         clear_sta_flag(sta, WLAN_STA_SP);
25  
26                 acked = !!(info->flags & IEEE80211_TX_STAT_ACK);
27 +               noack_success = !!(info->flags &
28 +                                  IEEE80211_TX_STAT_NOACK_TRANSMITTED);
29  
30                 /* mesh Peer Service Period support */
31                 if (ieee80211_vif_is_mesh(&sta->sdata->vif) &&
32 @@ -977,12 +980,12 @@ static void __ieee80211_tx_status(struct
33                         ieee80211_handle_filtered_frame(local, sta, skb);
34                         return;
35                 } else {
36 -                       if (!acked)
37 +                       if (!acked && !noack_success)
38                                 sta->status_stats.retry_failed++;
39                         sta->status_stats.retry_count += retry_count;
40  
41                         if (ieee80211_is_data_present(fc)) {
42 -                               if (!acked)
43 +                               if (!acked && !noack_success)
44                                         sta->status_stats.msdu_failed[tid]++;
45  
46                                 sta->status_stats.msdu_retries[tid] +=
47 @@ -1020,7 +1023,7 @@ static void __ieee80211_tx_status(struct
48                 }
49  
50                 if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) {
51 -                       if (info->flags & IEEE80211_TX_STAT_ACK) {
52 +                       if (acked) {
53                                 if (sta->status_stats.lost_packets)
54                                         sta->status_stats.lost_packets = 0;
55  
56 @@ -1028,6 +1031,8 @@ static void __ieee80211_tx_status(struct
57                                 if (test_sta_flag(sta, WLAN_STA_TDLS_PEER_AUTH))
58                                         sta->status_stats.last_tdls_pkt_time =
59                                                 jiffies;
60 +                       } else if (noack_success) {
61 +                               /* nothing to do here, do not account as lost */
62                         } else {
63                                 ieee80211_lost_packet(sta, info);
64                         }
65 @@ -1148,7 +1153,7 @@ void ieee80211_tx_status_ext(struct ieee
66  
67                 sta = container_of(pubsta, struct sta_info, sta);
68  
69 -               if (!acked)
70 +               if (!acked && !noack_success)
71                         sta->status_stats.retry_failed++;
72                 sta->status_stats.retry_count += retry_count;
73  
74 @@ -1163,6 +1168,8 @@ void ieee80211_tx_status_ext(struct ieee
75                                 sta->status_stats.last_tdls_pkt_time = jiffies;
76                 } else if (test_sta_flag(sta, WLAN_STA_PS_STA)) {
77                         return;
78 +               } else if (noack_success) {
79 +                       /* nothing to do here, do not account as lost */
80                 } else {
81                         ieee80211_lost_packet(sta, info);
82                 }