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 @@ -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);
32 @@ -1138,6 +1138,7 @@ minstrel_ht_update_caps(void *priv, stru
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
44 - /* TODO tx_flags for vht - ATM the RC API is not fine-grained enough */
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;
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)
56 + stbc = (vht_cap->cap & IEEE80211_VHT_CAP_RXSTBC_MASK) >>
57 + IEEE80211_VHT_CAP_RXSTBC_SHIFT;
59 + if (vht_cap->cap & IEEE80211_VHT_CAP_RXLDPC)
63 + mi->tx_flags |= stbc << IEEE80211_TX_CTL_STBC_SHIFT;
65 + mi->tx_flags |= IEEE80211_TX_CTL_LDPC;
67 for (i = 0; i < ARRAY_SIZE(mi->groups); i++) {
68 u32 gflags = minstrel_mcs_groups[i].flags;
70 @@ -1197,10 +1206,10 @@ minstrel_ht_update_caps(void *priv, stru
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))
78 - if (!(sta_cap & IEEE80211_HT_CAP_SGI_20))
79 + if (!(ht_cap & IEEE80211_HT_CAP_SGI_20))