diff options
Diffstat (limited to 'net/mac80211/vht.c')
-rw-r--r-- | net/mac80211/vht.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/net/mac80211/vht.c b/net/mac80211/vht.c index 0fc9a2fb8d53..67436e3efbbd 100644 --- a/net/mac80211/vht.c +++ b/net/mac80211/vht.c | |||
@@ -74,3 +74,44 @@ enum ieee80211_sta_rx_bandwidth ieee80211_sta_cur_vht_bw(struct sta_info *sta) | |||
74 | return IEEE80211_STA_RX_BW_80; | 74 | return IEEE80211_STA_RX_BW_80; |
75 | } | 75 | } |
76 | } | 76 | } |
77 | |||
78 | void ieee80211_sta_set_rx_nss(struct sta_info *sta) | ||
79 | { | ||
80 | u8 ht_rx_nss = 0, vht_rx_nss = 0; | ||
81 | |||
82 | /* if we received a notification already don't overwrite it */ | ||
83 | if (sta->sta.rx_nss) | ||
84 | return; | ||
85 | |||
86 | if (sta->sta.ht_cap.ht_supported) { | ||
87 | if (sta->sta.ht_cap.mcs.rx_mask[0]) | ||
88 | ht_rx_nss++; | ||
89 | if (sta->sta.ht_cap.mcs.rx_mask[1]) | ||
90 | ht_rx_nss++; | ||
91 | if (sta->sta.ht_cap.mcs.rx_mask[2]) | ||
92 | ht_rx_nss++; | ||
93 | if (sta->sta.ht_cap.mcs.rx_mask[3]) | ||
94 | ht_rx_nss++; | ||
95 | /* FIXME: consider rx_highest? */ | ||
96 | } | ||
97 | |||
98 | if (sta->sta.vht_cap.vht_supported) { | ||
99 | int i; | ||
100 | u16 rx_mcs_map; | ||
101 | |||
102 | rx_mcs_map = le16_to_cpu(sta->sta.vht_cap.vht_mcs.rx_mcs_map); | ||
103 | |||
104 | for (i = 7; i >= 0; i--) { | ||
105 | u8 mcs = (rx_mcs_map >> (2 * i)) & 3; | ||
106 | |||
107 | if (mcs != IEEE80211_VHT_MCS_NOT_SUPPORTED) { | ||
108 | vht_rx_nss = i + 1; | ||
109 | break; | ||
110 | } | ||
111 | } | ||
112 | /* FIXME: consider rx_highest? */ | ||
113 | } | ||
114 | |||
115 | ht_rx_nss = max(ht_rx_nss, vht_rx_nss); | ||
116 | sta->sta.rx_nss = max_t(u8, 1, ht_rx_nss); | ||
117 | } | ||