mt76: update to the latest version
[oweals/openwrt.git] / package / kernel / mac80211 / patches / 368-ath10k-fix-recent-bandwidth-conversion-bug.patch
1 From: Christian Lamparter <chunkeey@gmail.com>
2 Date: Wed, 1 Nov 2017 21:01:57 +0100
3 Subject: [PATCH] ath10k: fix recent bandwidth conversion bug
4
5 The commit "cfg80211: make RATE_INFO_BW_20 the default" changed
6 the index of RATE_INFO_BW_20, but the updates to ath10k missed
7 the special bandwidth calculation case in
8 ath10k_update_per_peer_tx_stats().
9
10 Fixes: 842be75c77cb ("cfg80211: make RATE_INFO_BW_20 the default")
11 Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
12 Patchwork-Id: 10037035
13 Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
14 ---
15
16 --- a/drivers/net/wireless/ath/ath10k/htt_rx.c
17 +++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
18 @@ -592,6 +592,9 @@ struct amsdu_subframe_hdr {
19  
20  #define GROUP_ID_IS_SU_MIMO(x) ((x) == 0 || (x) == 63)
21  
22 +static const u8 ath10k_bw_to_mac80211[] = { RATE_INFO_BW_20, RATE_INFO_BW_40,
23 +       RATE_INFO_BW_80, RATE_INFO_BW_160 };
24 +
25  static void ath10k_htt_rx_h_rates(struct ath10k *ar,
26                                   struct ieee80211_rx_status *status,
27                                   struct htt_rx_desc *rxd)
28 @@ -694,23 +697,7 @@ static void ath10k_htt_rx_h_rates(struct
29                 if (sgi)
30                         status->enc_flags |= RX_ENC_FLAG_SHORT_GI;
31  
32 -               switch (bw) {
33 -               /* 20MHZ */
34 -               case 0:
35 -                       break;
36 -               /* 40MHZ */
37 -               case 1:
38 -                       status->bw = RATE_INFO_BW_40;
39 -                       break;
40 -               /* 80MHZ */
41 -               case 2:
42 -                       status->bw = RATE_INFO_BW_80;
43 -                       break;
44 -               case 3:
45 -                       status->bw = RATE_INFO_BW_160;
46 -                       break;
47 -               }
48 -
49 +               status->bw = ath10k_bw_to_mac80211[bw];
50                 status->encoding = RX_ENC_VHT;
51                 break;
52         default:
53 @@ -2297,7 +2284,7 @@ ath10k_update_per_peer_tx_stats(struct a
54                 arsta->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI;
55  
56         arsta->txrate.nss = txrate.nss;
57 -       arsta->txrate.bw = txrate.bw + RATE_INFO_BW_20;
58 +       arsta->txrate.bw = ath10k_bw_to_mac80211[txrate.bw];
59  }
60  
61  static void ath10k_htt_fetch_peer_stats(struct ath10k *ar,