aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/vht.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2012-12-27 12:26:42 -0500
committerJohannes Berg <johannes.berg@intel.com>2013-02-15 03:41:31 -0500
commit8921d04e8df7475d733d853564bdb001e83bf33f (patch)
tree44961c6570025b439e7f6b905819d6e54e2d6b43 /net/mac80211/vht.c
parent7bf9b9a0f0372d45b581f00173505fb76a9c5d23 (diff)
mac80211: track number of spatial streams
With VHT, a station can change the number of spatial streams it can receive on the fly, not unlike spatial multiplexing in HT. Prepare for that by tracking the maximum number of spatial streams it can receive when the connection is established. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/vht.c')
-rw-r--r--net/mac80211/vht.c41
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
78void 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}