aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/mac80211/ieee80211_i.h2
-rw-r--r--net/mac80211/rx.c3
-rw-r--r--net/mac80211/vht.c32
3 files changed, 35 insertions, 2 deletions
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 9237ffb4e986..6c341d89448c 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -1816,6 +1816,8 @@ void ieee80211_apply_vhtcap_overrides(struct ieee80211_sub_if_data *sdata,
1816 struct ieee80211_sta_vht_cap *vht_cap); 1816 struct ieee80211_sta_vht_cap *vht_cap);
1817void ieee80211_get_vht_mask_from_cap(__le16 vht_cap, 1817void ieee80211_get_vht_mask_from_cap(__le16 vht_cap,
1818 u16 vht_mask[NL80211_VHT_NSS_MAX]); 1818 u16 vht_mask[NL80211_VHT_NSS_MAX]);
1819enum nl80211_chan_width
1820ieee80211_sta_rx_bw_to_chan_width(struct sta_info *sta);
1819 1821
1820/* Spectrum management */ 1822/* Spectrum management */
1821void ieee80211_process_measurement_req(struct ieee80211_sub_if_data *sdata, 1823void ieee80211_process_measurement_req(struct ieee80211_sub_if_data *sdata,
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index f8c69acfda48..3a9f0c0a2de8 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -2922,7 +2922,8 @@ ieee80211_rx_h_action(struct ieee80211_rx_data *rx)
2922 2922
2923 rx->sta->sta.bandwidth = new_bw; 2923 rx->sta->sta.bandwidth = new_bw;
2924 sband = rx->local->hw.wiphy->bands[status->band]; 2924 sband = rx->local->hw.wiphy->bands[status->band];
2925 sta_opmode.bw = new_bw; 2925 sta_opmode.bw =
2926 ieee80211_sta_rx_bw_to_chan_width(rx->sta);
2926 sta_opmode.changed = STA_OPMODE_MAX_BW_CHANGED; 2927 sta_opmode.changed = STA_OPMODE_MAX_BW_CHANGED;
2927 2928
2928 rate_control_rate_update(local, sband, rx->sta, 2929 rate_control_rate_update(local, sband, rx->sta,
diff --git a/net/mac80211/vht.c b/net/mac80211/vht.c
index 5714dee76b12..259325cbcc31 100644
--- a/net/mac80211/vht.c
+++ b/net/mac80211/vht.c
@@ -358,6 +358,36 @@ enum nl80211_chan_width ieee80211_sta_cap_chan_bw(struct sta_info *sta)
358 return NL80211_CHAN_WIDTH_80; 358 return NL80211_CHAN_WIDTH_80;
359} 359}
360 360
361enum nl80211_chan_width
362ieee80211_sta_rx_bw_to_chan_width(struct sta_info *sta)
363{
364 enum ieee80211_sta_rx_bandwidth cur_bw = sta->sta.bandwidth;
365 struct ieee80211_sta_vht_cap *vht_cap = &sta->sta.vht_cap;
366 u32 cap_width;
367
368 switch (cur_bw) {
369 case IEEE80211_STA_RX_BW_20:
370 if (!sta->sta.ht_cap.ht_supported)
371 return NL80211_CHAN_WIDTH_20_NOHT;
372 else
373 return NL80211_CHAN_WIDTH_20;
374 case IEEE80211_STA_RX_BW_40:
375 return NL80211_CHAN_WIDTH_40;
376 case IEEE80211_STA_RX_BW_80:
377 return NL80211_CHAN_WIDTH_80;
378 case IEEE80211_STA_RX_BW_160:
379 cap_width =
380 vht_cap->cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK;
381
382 if (cap_width == IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ)
383 return NL80211_CHAN_WIDTH_160;
384
385 return NL80211_CHAN_WIDTH_80P80;
386 default:
387 return NL80211_CHAN_WIDTH_20;
388 }
389}
390
361enum ieee80211_sta_rx_bandwidth 391enum ieee80211_sta_rx_bandwidth
362ieee80211_chan_width_to_rx_bw(enum nl80211_chan_width width) 392ieee80211_chan_width_to_rx_bw(enum nl80211_chan_width width)
363{ 393{
@@ -484,7 +514,7 @@ u32 __ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata,
484 new_bw = ieee80211_sta_cur_vht_bw(sta); 514 new_bw = ieee80211_sta_cur_vht_bw(sta);
485 if (new_bw != sta->sta.bandwidth) { 515 if (new_bw != sta->sta.bandwidth) {
486 sta->sta.bandwidth = new_bw; 516 sta->sta.bandwidth = new_bw;
487 sta_opmode.bw = new_bw; 517 sta_opmode.bw = ieee80211_sta_rx_bw_to_chan_width(sta);
488 changed |= IEEE80211_RC_BW_CHANGED; 518 changed |= IEEE80211_RC_BW_CHANGED;
489 sta_opmode.changed |= STA_OPMODE_MAX_BW_CHANGED; 519 sta_opmode.changed |= STA_OPMODE_MAX_BW_CHANGED;
490 } 520 }