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
5 If peer support reception of STBC and LDPC, enable them for better
8 Signed-off-by: Chaitanya TK <chaitanya.mgit@gmail.com>
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 @@ -1136,13 +1136,14 @@ 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;
37 /* fall back to the old minstrel for legacy stations */
38 if (!sta->ht_cap.ht_supported)
39 @@ -1180,16 +1181,24 @@ minstrel_ht_update_caps(void *priv, stru
43 - /* TODO tx_flags for vht - ATM the RC API is not fine-grained enough */
45 - stbc = (sta_cap & IEEE80211_HT_CAP_RX_STBC) >>
46 + stbc = (ht_cap & IEEE80211_HT_CAP_RX_STBC) >>
47 IEEE80211_HT_CAP_RX_STBC_SHIFT;
48 - mi->tx_flags |= stbc << IEEE80211_TX_CTL_STBC_SHIFT;
50 - if (sta_cap & IEEE80211_HT_CAP_LDPC_CODING)
51 - mi->tx_flags |= IEEE80211_TX_CTL_LDPC;
52 + if (ht_cap & IEEE80211_HT_CAP_LDPC_CODING)
55 + stbc = (vht_cap->cap & IEEE80211_VHT_CAP_RXSTBC_MASK) >>
56 + IEEE80211_VHT_CAP_RXSTBC_SHIFT;
58 + if (vht_cap->cap & IEEE80211_VHT_CAP_RXLDPC)
62 + mi->tx_flags |= stbc << IEEE80211_TX_CTL_STBC_SHIFT;
64 + mi->tx_flags |= IEEE80211_TX_CTL_LDPC;
66 for (i = 0; i < ARRAY_SIZE(mi->groups); i++) {
67 u32 gflags = minstrel_mcs_groups[i].flags;
69 @@ -1202,10 +1211,10 @@ minstrel_ht_update_caps(void *priv, stru
71 if (gflags & IEEE80211_TX_RC_SHORT_GI) {
72 if (gflags & IEEE80211_TX_RC_40_MHZ_WIDTH) {
73 - if (!(sta_cap & IEEE80211_HT_CAP_SGI_40))
74 + if (!(ht_cap & IEEE80211_HT_CAP_SGI_40))
77 - if (!(sta_cap & IEEE80211_HT_CAP_SGI_20))
78 + if (!(ht_cap & IEEE80211_HT_CAP_SGI_20))