661fb46ea47aef467d96ab4a1ee087efedae33b1
[openwrt/staging/blogic.git] /
1 From: Chaitanya T K <chaitanya.mgit@gmail.com>
2 Date: Mon, 27 Jun 2016 15:23:26 +0530
3 Subject: [PATCH] mac80211: minstrel: Enable STBC and LDPC for VHT Rates
4
5 If peer support reception of STBC and LDPC, enable them for better
6 performance.
7
8 Signed-off-by: Chaitanya TK <chaitanya.mgit@gmail.com>
9 ---
10
11 --- a/include/linux/ieee80211.h
12 +++ b/include/linux/ieee80211.h
13 @@ -1659,6 +1659,7 @@ struct ieee80211_mu_edca_param_set {
14 #define IEEE80211_VHT_CAP_RXSTBC_3 0x00000300
15 #define IEEE80211_VHT_CAP_RXSTBC_4 0x00000400
16 #define IEEE80211_VHT_CAP_RXSTBC_MASK 0x00000700
17 +#define IEEE80211_VHT_CAP_RXSTBC_SHIFT 8
18 #define IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE 0x00000800
19 #define IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE 0x00001000
20 #define IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT 13
21 --- a/net/mac80211/rc80211_minstrel_ht.c
22 +++ b/net/mac80211/rc80211_minstrel_ht.c
23 @@ -1130,7 +1130,7 @@ minstrel_ht_update_caps(void *priv, stru
24 struct minstrel_ht_sta_priv *msp = priv_sta;
25 struct minstrel_ht_sta *mi = &msp->ht;
26 struct ieee80211_mcs_info *mcs = &sta->ht_cap.mcs;
27 - u16 sta_cap = sta->ht_cap.cap;
28 + u16 ht_cap = sta->ht_cap.cap;
29 struct ieee80211_sta_vht_cap *vht_cap = &sta->vht_cap;
30 struct sta_info *sinfo = container_of(sta, struct sta_info, sta);
31 int use_vht;
32 @@ -1138,6 +1138,7 @@ minstrel_ht_update_caps(void *priv, stru
33 int ack_dur;
34 int stbc;
35 int i;
36 + bool ldpc = false;
37
38 /* fall back to the old minstrel for legacy stations */
39 if (!sta->ht_cap.ht_supported)
40 @@ -1175,16 +1176,24 @@ minstrel_ht_update_caps(void *priv, stru
41 }
42 mi->sample_tries = 4;
43
44 - /* TODO tx_flags for vht - ATM the RC API is not fine-grained enough */
45 if (!use_vht) {
46 - stbc = (sta_cap & IEEE80211_HT_CAP_RX_STBC) >>
47 + stbc = (ht_cap & IEEE80211_HT_CAP_RX_STBC) >>
48 IEEE80211_HT_CAP_RX_STBC_SHIFT;
49 - mi->tx_flags |= stbc << IEEE80211_TX_CTL_STBC_SHIFT;
50
51 - if (sta_cap & IEEE80211_HT_CAP_LDPC_CODING)
52 - mi->tx_flags |= IEEE80211_TX_CTL_LDPC;
53 + if (ht_cap & IEEE80211_HT_CAP_LDPC_CODING)
54 + ldpc = true;
55 + } else {
56 + stbc = (vht_cap->cap & IEEE80211_VHT_CAP_RXSTBC_MASK) >>
57 + IEEE80211_VHT_CAP_RXSTBC_SHIFT;
58 +
59 + if (vht_cap->cap & IEEE80211_VHT_CAP_RXLDPC)
60 + ldpc = true;
61 }
62
63 + mi->tx_flags |= stbc << IEEE80211_TX_CTL_STBC_SHIFT;
64 + if (ldpc)
65 + mi->tx_flags |= IEEE80211_TX_CTL_LDPC;
66 +
67 for (i = 0; i < ARRAY_SIZE(mi->groups); i++) {
68 u32 gflags = minstrel_mcs_groups[i].flags;
69 int bw, nss;
70 @@ -1197,10 +1206,10 @@ minstrel_ht_update_caps(void *priv, stru
71
72 if (gflags & IEEE80211_TX_RC_SHORT_GI) {
73 if (gflags & IEEE80211_TX_RC_40_MHZ_WIDTH) {
74 - if (!(sta_cap & IEEE80211_HT_CAP_SGI_40))
75 + if (!(ht_cap & IEEE80211_HT_CAP_SGI_40))
76 continue;
77 } else {
78 - if (!(sta_cap & IEEE80211_HT_CAP_SGI_20))
79 + if (!(ht_cap & IEEE80211_HT_CAP_SGI_20))
80 continue;
81 }
82 }