Fresh pull from upstream
[librecmc/librecmc.git] / package / kernel / mac80211 / patches / 335-mac80211-minstrel_ht-move-short-preamble-check-out-o.patch
1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Wed, 14 Dec 2016 20:06:08 +0100
3 Subject: [PATCH] mac80211: minstrel_ht: move short preamble check out of
4  get_rate
5
6 Test short preamble support in minstrel_ht_update_caps instead of
7 looking at the per-packet flag. Makes the code more efficient.
8
9 Signed-off-by: Felix Fietkau <nbd@nbd.name>
10 ---
11
12 --- a/net/mac80211/rc80211_minstrel_ht.c
13 +++ b/net/mac80211/rc80211_minstrel_ht.c
14 @@ -14,6 +14,7 @@
15  #include <linux/ieee80211.h>
16  #include <net/mac80211.h>
17  #include "rate.h"
18 +#include "sta_info.h"
19  #include "rc80211_minstrel.h"
20  #include "rc80211_minstrel_ht.h"
21  
22 @@ -1049,22 +1050,6 @@ minstrel_get_sample_rate(struct minstrel
23  }
24  
25  static void
26 -minstrel_ht_check_cck_shortpreamble(struct minstrel_priv *mp,
27 -                                   struct minstrel_ht_sta *mi, bool val)
28 -{
29 -       u8 supported = mi->supported[MINSTREL_CCK_GROUP];
30 -
31 -       if (!supported || !mi->cck_supported_short)
32 -               return;
33 -
34 -       if (supported & (mi->cck_supported_short << (val * 4)))
35 -               return;
36 -
37 -       supported ^= mi->cck_supported_short | (mi->cck_supported_short << 4);
38 -       mi->supported[MINSTREL_CCK_GROUP] = supported;
39 -}
40 -
41 -static void
42  minstrel_ht_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta,
43                       struct ieee80211_tx_rate_control *txrc)
44  {
45 @@ -1087,7 +1072,6 @@ minstrel_ht_get_rate(void *priv, struct
46                 minstrel_aggr_check(sta, txrc->skb);
47  
48         info->flags |= mi->tx_flags;
49 -       minstrel_ht_check_cck_shortpreamble(mp, mi, txrc->short_preamble);
50  
51  #ifdef CPTCFG_MAC80211_DEBUGFS
52         if (mp->fixed_rate_idx != -1)
53 @@ -1168,6 +1152,7 @@ minstrel_ht_update_caps(void *priv, stru
54         struct ieee80211_mcs_info *mcs = &sta->ht_cap.mcs;
55         u16 ht_cap = sta->ht_cap.cap;
56         struct ieee80211_sta_vht_cap *vht_cap = &sta->vht_cap;
57 +       struct sta_info *sinfo = container_of(sta, struct sta_info, sta);
58         int use_vht;
59         int n_supported = 0;
60         int ack_dur;
61 @@ -1302,6 +1287,9 @@ minstrel_ht_update_caps(void *priv, stru
62         if (!n_supported)
63                 goto use_legacy;
64  
65 +       if (test_sta_flag(sinfo, WLAN_STA_SHORT_PREAMBLE))
66 +               mi->cck_supported_short |= mi->cck_supported_short << 4;
67 +
68         /* create an initial rate table with the lowest supported rates */
69         minstrel_ht_update_stats(mp, mi);
70         minstrel_ht_update_rates(mp, mi);