blob: bc9e8fc48785f940d2df58518ae9f0a55a105037 [file] [log] [blame]
Mahesh Palivela818255e2012-10-10 11:33:04 +00001/*
2 * VHT handling
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#include <linux/ieee80211.h>
10#include <linux/export.h>
11#include <net/mac80211.h>
12#include "ieee80211_i.h"
Johannes Berg0af83d32012-12-27 18:55:36 +010013#include "rate.h"
Mahesh Palivela818255e2012-10-10 11:33:04 +000014
15
Johannes Bergdd5ecfe2013-02-21 17:40:19 +010016static void __check_vhtcap_disable(struct ieee80211_sub_if_data *sdata,
17 struct ieee80211_sta_vht_cap *vht_cap,
18 u32 flag)
19{
20 __le32 le_flag = cpu_to_le32(flag);
21
22 if (sdata->u.mgd.vht_capa_mask.vht_cap_info & le_flag &&
23 !(sdata->u.mgd.vht_capa.vht_cap_info & le_flag))
24 vht_cap->cap &= ~flag;
25}
26
27void ieee80211_apply_vhtcap_overrides(struct ieee80211_sub_if_data *sdata,
28 struct ieee80211_sta_vht_cap *vht_cap)
29{
30 int i;
31 u16 rxmcs_mask, rxmcs_cap, rxmcs_n, txmcs_mask, txmcs_cap, txmcs_n;
32
33 if (!vht_cap->vht_supported)
34 return;
35
36 if (sdata->vif.type != NL80211_IFTYPE_STATION)
37 return;
38
39 __check_vhtcap_disable(sdata, vht_cap,
40 IEEE80211_VHT_CAP_RXLDPC);
41 __check_vhtcap_disable(sdata, vht_cap,
42 IEEE80211_VHT_CAP_SHORT_GI_80);
43 __check_vhtcap_disable(sdata, vht_cap,
44 IEEE80211_VHT_CAP_SHORT_GI_160);
45 __check_vhtcap_disable(sdata, vht_cap,
46 IEEE80211_VHT_CAP_TXSTBC);
47 __check_vhtcap_disable(sdata, vht_cap,
48 IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE);
49 __check_vhtcap_disable(sdata, vht_cap,
50 IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE);
51 __check_vhtcap_disable(sdata, vht_cap,
52 IEEE80211_VHT_CAP_RX_ANTENNA_PATTERN);
53 __check_vhtcap_disable(sdata, vht_cap,
54 IEEE80211_VHT_CAP_TX_ANTENNA_PATTERN);
55
56 /* Allow user to decrease AMPDU length exponent */
57 if (sdata->u.mgd.vht_capa_mask.vht_cap_info &
58 cpu_to_le32(IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK)) {
59 u32 cap, n;
60
61 n = le32_to_cpu(sdata->u.mgd.vht_capa.vht_cap_info) &
62 IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK;
63 n >>= IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT;
64 cap = vht_cap->cap & IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK;
65 cap >>= IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT;
66
67 if (n < cap) {
68 vht_cap->cap &=
69 ~IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK;
70 vht_cap->cap |=
71 n << IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT;
72 }
73 }
74
75 /* Allow the user to decrease MCSes */
76 rxmcs_mask =
77 le16_to_cpu(sdata->u.mgd.vht_capa_mask.supp_mcs.rx_mcs_map);
78 rxmcs_n = le16_to_cpu(sdata->u.mgd.vht_capa.supp_mcs.rx_mcs_map);
79 rxmcs_n &= rxmcs_mask;
80 rxmcs_cap = le16_to_cpu(vht_cap->vht_mcs.rx_mcs_map);
81
82 txmcs_mask =
83 le16_to_cpu(sdata->u.mgd.vht_capa_mask.supp_mcs.tx_mcs_map);
84 txmcs_n = le16_to_cpu(sdata->u.mgd.vht_capa.supp_mcs.tx_mcs_map);
85 txmcs_n &= txmcs_mask;
86 txmcs_cap = le16_to_cpu(vht_cap->vht_mcs.tx_mcs_map);
87 for (i = 0; i < 8; i++) {
88 u8 m, n, c;
89
90 m = (rxmcs_mask >> 2*i) & IEEE80211_VHT_MCS_NOT_SUPPORTED;
91 n = (rxmcs_n >> 2*i) & IEEE80211_VHT_MCS_NOT_SUPPORTED;
92 c = (rxmcs_cap >> 2*i) & IEEE80211_VHT_MCS_NOT_SUPPORTED;
93
94 if (m && ((c != IEEE80211_VHT_MCS_NOT_SUPPORTED && n < c) ||
95 n == IEEE80211_VHT_MCS_NOT_SUPPORTED)) {
96 rxmcs_cap &= ~(3 << 2*i);
97 rxmcs_cap |= (rxmcs_n & (3 << 2*i));
98 }
99
100 m = (txmcs_mask >> 2*i) & IEEE80211_VHT_MCS_NOT_SUPPORTED;
101 n = (txmcs_n >> 2*i) & IEEE80211_VHT_MCS_NOT_SUPPORTED;
102 c = (txmcs_cap >> 2*i) & IEEE80211_VHT_MCS_NOT_SUPPORTED;
103
104 if (m && ((c != IEEE80211_VHT_MCS_NOT_SUPPORTED && n < c) ||
105 n == IEEE80211_VHT_MCS_NOT_SUPPORTED)) {
106 txmcs_cap &= ~(3 << 2*i);
107 txmcs_cap |= (txmcs_n & (3 << 2*i));
108 }
109 }
110 vht_cap->vht_mcs.rx_mcs_map = cpu_to_le16(rxmcs_cap);
111 vht_cap->vht_mcs.tx_mcs_map = cpu_to_le16(txmcs_cap);
112}
113
Johannes Berg4a3cb702013-02-12 16:43:19 +0100114void
115ieee80211_vht_cap_ie_to_sta_vht_cap(struct ieee80211_sub_if_data *sdata,
116 struct ieee80211_supported_band *sband,
117 const struct ieee80211_vht_cap *vht_cap_ie,
118 struct sta_info *sta)
Mahesh Palivela818255e2012-10-10 11:33:04 +0000119{
Johannes Berg4a342152013-02-07 11:58:58 +0100120 struct ieee80211_sta_vht_cap *vht_cap = &sta->sta.vht_cap;
Johannes Berg55d942f2013-03-01 13:07:48 +0100121 struct ieee80211_sta_vht_cap own_cap;
122 u32 cap_info, i;
Mahesh Palivela818255e2012-10-10 11:33:04 +0000123
124 memset(vht_cap, 0, sizeof(*vht_cap));
125
Johannes Berg4a342152013-02-07 11:58:58 +0100126 if (!sta->sta.ht_cap.ht_supported)
127 return;
128
Mahesh Palivela818255e2012-10-10 11:33:04 +0000129 if (!vht_cap_ie || !sband->vht_cap.vht_supported)
130 return;
131
Arik Nemtsovbed766b2014-07-17 17:14:28 +0300132 /* don't support VHT for TDLS peers for now */
133 if (test_sta_flag(sta, WLAN_STA_TDLS_PEER))
134 return;
135
Johannes Berg4a817aa2014-05-09 09:56:53 +0200136 /*
137 * A VHT STA must support 40 MHz, but if we verify that here
138 * then we break a few things - some APs (e.g. Netgear R6300v2
139 * and others based on the BCM4360 chipset) will unset this
140 * capability bit when operating in 20 MHz.
141 */
Johannes Berge1a0c6b2013-02-07 11:47:44 +0100142
Mahesh Palivela818255e2012-10-10 11:33:04 +0000143 vht_cap->vht_supported = true;
144
Johannes Berg55d942f2013-03-01 13:07:48 +0100145 own_cap = sband->vht_cap;
146 /*
147 * If user has specified capability overrides, take care
148 * of that if the station we're setting up is the AP that
149 * we advertised a restricted capability set to. Override
150 * our own capabilities and then use those below.
151 */
152 if (sdata->vif.type == NL80211_IFTYPE_STATION &&
153 !test_sta_flag(sta, WLAN_STA_TDLS_PEER))
154 ieee80211_apply_vhtcap_overrides(sdata, &own_cap);
155
156 /* take some capabilities as-is */
157 cap_info = le32_to_cpu(vht_cap_ie->vht_cap_info);
158 vht_cap->cap = cap_info;
159 vht_cap->cap &= IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_3895 |
160 IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_7991 |
161 IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 |
162 IEEE80211_VHT_CAP_RXLDPC |
163 IEEE80211_VHT_CAP_VHT_TXOP_PS |
164 IEEE80211_VHT_CAP_HTC_VHT |
165 IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK |
166 IEEE80211_VHT_CAP_VHT_LINK_ADAPTATION_VHT_UNSOL_MFB |
167 IEEE80211_VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB |
168 IEEE80211_VHT_CAP_RX_ANTENNA_PATTERN |
169 IEEE80211_VHT_CAP_TX_ANTENNA_PATTERN;
170
171 /* and some based on our own capabilities */
172 switch (own_cap.cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK) {
173 case IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ:
174 vht_cap->cap |= cap_info &
175 IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ;
176 break;
177 case IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ:
178 vht_cap->cap |= cap_info &
179 IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK;
180 break;
181 default:
182 /* nothing */
183 break;
184 }
185
186 /* symmetric capabilities */
187 vht_cap->cap |= cap_info & own_cap.cap &
188 (IEEE80211_VHT_CAP_SHORT_GI_80 |
189 IEEE80211_VHT_CAP_SHORT_GI_160);
190
191 /* remaining ones */
Eyal Shapirafbdd90e2013-11-11 20:14:00 +0200192 if (own_cap.cap & IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE)
Johannes Berg55d942f2013-03-01 13:07:48 +0100193 vht_cap->cap |= cap_info &
194 (IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE |
Eyal Shapirafbdd90e2013-11-11 20:14:00 +0200195 IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MASK);
Johannes Berg55d942f2013-03-01 13:07:48 +0100196
197 if (own_cap.cap & IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE)
198 vht_cap->cap |= cap_info &
Eliad Peller5eb79062013-08-29 15:03:14 +0300199 (IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE |
Eyal Shapirafbdd90e2013-11-11 20:14:00 +0200200 IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK);
Johannes Berg55d942f2013-03-01 13:07:48 +0100201
202 if (own_cap.cap & IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE)
203 vht_cap->cap |= cap_info &
204 IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE;
205
206 if (own_cap.cap & IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE)
207 vht_cap->cap |= cap_info &
208 IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE;
209
210 if (own_cap.cap & IEEE80211_VHT_CAP_TXSTBC)
211 vht_cap->cap |= cap_info & IEEE80211_VHT_CAP_RXSTBC_MASK;
212
213 if (own_cap.cap & IEEE80211_VHT_CAP_RXSTBC_MASK)
214 vht_cap->cap |= cap_info & IEEE80211_VHT_CAP_TXSTBC;
Mahesh Palivela818255e2012-10-10 11:33:04 +0000215
216 /* Copy peer MCS info, the driver might need them. */
217 memcpy(&vht_cap->vht_mcs, &vht_cap_ie->supp_mcs,
218 sizeof(struct ieee80211_vht_mcs_info));
Johannes Berge1a0c6b2013-02-07 11:47:44 +0100219
Johannes Berg55d942f2013-03-01 13:07:48 +0100220 /* but also restrict MCSes */
221 for (i = 0; i < 8; i++) {
222 u16 own_rx, own_tx, peer_rx, peer_tx;
223
224 own_rx = le16_to_cpu(own_cap.vht_mcs.rx_mcs_map);
225 own_rx = (own_rx >> i * 2) & IEEE80211_VHT_MCS_NOT_SUPPORTED;
226
227 own_tx = le16_to_cpu(own_cap.vht_mcs.tx_mcs_map);
228 own_tx = (own_tx >> i * 2) & IEEE80211_VHT_MCS_NOT_SUPPORTED;
229
230 peer_rx = le16_to_cpu(vht_cap->vht_mcs.rx_mcs_map);
231 peer_rx = (peer_rx >> i * 2) & IEEE80211_VHT_MCS_NOT_SUPPORTED;
232
233 peer_tx = le16_to_cpu(vht_cap->vht_mcs.tx_mcs_map);
234 peer_tx = (peer_tx >> i * 2) & IEEE80211_VHT_MCS_NOT_SUPPORTED;
235
236 if (peer_tx != IEEE80211_VHT_MCS_NOT_SUPPORTED) {
237 if (own_rx == IEEE80211_VHT_MCS_NOT_SUPPORTED)
238 peer_tx = IEEE80211_VHT_MCS_NOT_SUPPORTED;
239 else if (own_rx < peer_tx)
240 peer_tx = own_rx;
241 }
242
243 if (peer_rx != IEEE80211_VHT_MCS_NOT_SUPPORTED) {
244 if (own_tx == IEEE80211_VHT_MCS_NOT_SUPPORTED)
245 peer_rx = IEEE80211_VHT_MCS_NOT_SUPPORTED;
246 else if (own_tx < peer_rx)
247 peer_rx = own_tx;
248 }
249
250 vht_cap->vht_mcs.rx_mcs_map &=
251 ~cpu_to_le16(IEEE80211_VHT_MCS_NOT_SUPPORTED << i * 2);
252 vht_cap->vht_mcs.rx_mcs_map |= cpu_to_le16(peer_rx << i * 2);
253
254 vht_cap->vht_mcs.tx_mcs_map &=
255 ~cpu_to_le16(IEEE80211_VHT_MCS_NOT_SUPPORTED << i * 2);
256 vht_cap->vht_mcs.tx_mcs_map |= cpu_to_le16(peer_tx << i * 2);
257 }
258
259 /* finally set up the bandwidth */
Johannes Berg0af83d32012-12-27 18:55:36 +0100260 switch (vht_cap->cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK) {
261 case IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ:
262 case IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ:
263 sta->cur_max_bandwidth = IEEE80211_STA_RX_BW_160;
264 break;
265 default:
266 sta->cur_max_bandwidth = IEEE80211_STA_RX_BW_80;
267 }
268
Johannes Berge1a0c6b2013-02-07 11:47:44 +0100269 sta->sta.bandwidth = ieee80211_sta_cur_vht_bw(sta);
270}
271
272enum ieee80211_sta_rx_bandwidth ieee80211_sta_cur_vht_bw(struct sta_info *sta)
273{
274 struct ieee80211_sub_if_data *sdata = sta->sdata;
275 u32 cap = sta->sta.vht_cap.cap;
Johannes Berg0af83d32012-12-27 18:55:36 +0100276 enum ieee80211_sta_rx_bandwidth bw;
Johannes Berge1a0c6b2013-02-07 11:47:44 +0100277
Johannes Berg0af83d32012-12-27 18:55:36 +0100278 if (!sta->sta.vht_cap.vht_supported) {
279 bw = sta->sta.ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40 ?
Johannes Berge1a0c6b2013-02-07 11:47:44 +0100280 IEEE80211_STA_RX_BW_40 : IEEE80211_STA_RX_BW_20;
Johannes Berg0af83d32012-12-27 18:55:36 +0100281 goto check_max;
282 }
Johannes Berge1a0c6b2013-02-07 11:47:44 +0100283
284 switch (sdata->vif.bss_conf.chandef.width) {
285 default:
286 WARN_ON_ONCE(1);
287 /* fall through */
288 case NL80211_CHAN_WIDTH_20_NOHT:
289 case NL80211_CHAN_WIDTH_20:
Eliad Peller8b1956f2014-11-11 18:11:22 +0200290 bw = IEEE80211_STA_RX_BW_20;
291 break;
Johannes Berge1a0c6b2013-02-07 11:47:44 +0100292 case NL80211_CHAN_WIDTH_40:
Johannes Berg0af83d32012-12-27 18:55:36 +0100293 bw = sta->sta.ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40 ?
Johannes Berge1a0c6b2013-02-07 11:47:44 +0100294 IEEE80211_STA_RX_BW_40 : IEEE80211_STA_RX_BW_20;
Johannes Berg0af83d32012-12-27 18:55:36 +0100295 break;
Johannes Berge1a0c6b2013-02-07 11:47:44 +0100296 case NL80211_CHAN_WIDTH_160:
Johannes Berg0af83d32012-12-27 18:55:36 +0100297 if ((cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK) ==
298 IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ) {
299 bw = IEEE80211_STA_RX_BW_160;
300 break;
301 }
Johannes Berge1a0c6b2013-02-07 11:47:44 +0100302 /* fall through */
303 case NL80211_CHAN_WIDTH_80P80:
Johannes Berg0af83d32012-12-27 18:55:36 +0100304 if ((cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK) ==
305 IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ) {
306 bw = IEEE80211_STA_RX_BW_160;
307 break;
308 }
Johannes Berge1a0c6b2013-02-07 11:47:44 +0100309 /* fall through */
310 case NL80211_CHAN_WIDTH_80:
Johannes Berg0af83d32012-12-27 18:55:36 +0100311 bw = IEEE80211_STA_RX_BW_80;
Johannes Berge1a0c6b2013-02-07 11:47:44 +0100312 }
Johannes Berg0af83d32012-12-27 18:55:36 +0100313
314 check_max:
315 if (bw > sta->cur_max_bandwidth)
316 bw = sta->cur_max_bandwidth;
317 return bw;
Mahesh Palivela818255e2012-10-10 11:33:04 +0000318}
Johannes Berg8921d042012-12-27 18:26:42 +0100319
320void ieee80211_sta_set_rx_nss(struct sta_info *sta)
321{
322 u8 ht_rx_nss = 0, vht_rx_nss = 0;
323
324 /* if we received a notification already don't overwrite it */
325 if (sta->sta.rx_nss)
326 return;
327
328 if (sta->sta.ht_cap.ht_supported) {
329 if (sta->sta.ht_cap.mcs.rx_mask[0])
330 ht_rx_nss++;
331 if (sta->sta.ht_cap.mcs.rx_mask[1])
332 ht_rx_nss++;
333 if (sta->sta.ht_cap.mcs.rx_mask[2])
334 ht_rx_nss++;
335 if (sta->sta.ht_cap.mcs.rx_mask[3])
336 ht_rx_nss++;
337 /* FIXME: consider rx_highest? */
338 }
339
340 if (sta->sta.vht_cap.vht_supported) {
341 int i;
342 u16 rx_mcs_map;
343
344 rx_mcs_map = le16_to_cpu(sta->sta.vht_cap.vht_mcs.rx_mcs_map);
345
346 for (i = 7; i >= 0; i--) {
347 u8 mcs = (rx_mcs_map >> (2 * i)) & 3;
348
349 if (mcs != IEEE80211_VHT_MCS_NOT_SUPPORTED) {
350 vht_rx_nss = i + 1;
351 break;
352 }
353 }
354 /* FIXME: consider rx_highest? */
355 }
356
357 ht_rx_nss = max(ht_rx_nss, vht_rx_nss);
358 sta->sta.rx_nss = max_t(u8, 1, ht_rx_nss);
359}
Johannes Berg0af83d32012-12-27 18:55:36 +0100360
Marek Kwaczynskib1bce14a2014-02-03 14:44:44 +0100361u32 __ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata,
362 struct sta_info *sta, u8 opmode,
363 enum ieee80211_band band, bool nss_only)
Johannes Berg0af83d32012-12-27 18:55:36 +0100364{
365 struct ieee80211_local *local = sdata->local;
366 struct ieee80211_supported_band *sband;
367 enum ieee80211_sta_rx_bandwidth new_bw;
368 u32 changed = 0;
369 u8 nss;
370
371 sband = local->hw.wiphy->bands[band];
372
373 /* ignore - no support for BF yet */
374 if (opmode & IEEE80211_OPMODE_NOTIF_RX_NSS_TYPE_BF)
Marek Kwaczynskib1bce14a2014-02-03 14:44:44 +0100375 return 0;
Johannes Berg0af83d32012-12-27 18:55:36 +0100376
377 nss = opmode & IEEE80211_OPMODE_NOTIF_RX_NSS_MASK;
378 nss >>= IEEE80211_OPMODE_NOTIF_RX_NSS_SHIFT;
379 nss += 1;
380
381 if (sta->sta.rx_nss != nss) {
382 sta->sta.rx_nss = nss;
383 changed |= IEEE80211_RC_NSS_CHANGED;
384 }
385
Johannes Bergbee7f582013-02-07 22:24:55 +0100386 if (nss_only)
Marek Kwaczynskib1bce14a2014-02-03 14:44:44 +0100387 return changed;
Johannes Bergbee7f582013-02-07 22:24:55 +0100388
Johannes Berg0af83d32012-12-27 18:55:36 +0100389 switch (opmode & IEEE80211_OPMODE_NOTIF_CHANWIDTH_MASK) {
390 case IEEE80211_OPMODE_NOTIF_CHANWIDTH_20MHZ:
391 sta->cur_max_bandwidth = IEEE80211_STA_RX_BW_20;
392 break;
393 case IEEE80211_OPMODE_NOTIF_CHANWIDTH_40MHZ:
394 sta->cur_max_bandwidth = IEEE80211_STA_RX_BW_40;
395 break;
396 case IEEE80211_OPMODE_NOTIF_CHANWIDTH_80MHZ:
397 sta->cur_max_bandwidth = IEEE80211_STA_RX_BW_80;
398 break;
399 case IEEE80211_OPMODE_NOTIF_CHANWIDTH_160MHZ:
400 sta->cur_max_bandwidth = IEEE80211_STA_RX_BW_160;
401 break;
402 }
403
404 new_bw = ieee80211_sta_cur_vht_bw(sta);
405 if (new_bw != sta->sta.bandwidth) {
406 sta->sta.bandwidth = new_bw;
Ilan Peer38745c72013-06-10 10:34:14 +0300407 changed |= IEEE80211_RC_BW_CHANGED;
Johannes Berg0af83d32012-12-27 18:55:36 +0100408 }
409
Marek Kwaczynskib1bce14a2014-02-03 14:44:44 +0100410 return changed;
411}
412
413void ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata,
414 struct sta_info *sta, u8 opmode,
415 enum ieee80211_band band, bool nss_only)
416{
417 struct ieee80211_local *local = sdata->local;
418 struct ieee80211_supported_band *sband = local->hw.wiphy->bands[band];
419
420 u32 changed = __ieee80211_vht_handle_opmode(sdata, sta, opmode,
421 band, nss_only);
422
423 if (changed > 0)
Johannes Berg0af83d32012-12-27 18:55:36 +0100424 rate_control_rate_update(local, sband, sta, changed);
425}