aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/mlme.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2012-03-28 04:58:37 -0400
committerJohn W. Linville <linville@tuxdriver.com>2012-04-10 14:54:08 -0400
commit64f68e5d15bee47e0d6d0c57a1cf52cedd9b3527 (patch)
treee000cea46fd57d876d725224d2b51b74cec35572 /net/mac80211/mlme.c
parent24398e39c8ee4a9d9123eed322b859ece4d16cac (diff)
mac80211: remove channel type argument from rate_update
The channel type argument to the rate_update() callback isn't really the correct way to give the rate control algorithm about the desired RX bandwidth of the peer. Remove this argument, and instead update the STA capabilities with 20/40 appropriately. The SMPS update done by this callback works in the same way, so this makes the callback cleaner. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/mlme.c')
-rw-r--r--net/mac80211/mlme.c51
1 files changed, 35 insertions, 16 deletions
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 30259a73195c..9cc5dda68219 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -180,21 +180,38 @@ static u32 ieee80211_config_ht_tx(struct ieee80211_sub_if_data *sdata,
180 struct sta_info *sta; 180 struct sta_info *sta;
181 u32 changed = 0; 181 u32 changed = 0;
182 u16 ht_opmode; 182 u16 ht_opmode;
183 enum nl80211_channel_type channel_type; 183 bool disable_40 = false;
184 184
185 sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; 185 sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
186 channel_type = local->hw.conf.channel_type;
187 186
188 if (WARN_ON_ONCE(channel_type == NL80211_CHAN_NO_HT)) 187 switch (sdata->vif.bss_conf.channel_type) {
189 return 0; 188 case NL80211_CHAN_HT40PLUS:
190 189 if (local->hw.conf.channel->flags & IEEE80211_CHAN_NO_HT40PLUS)
191 channel_type = ieee80211_get_tx_channel_type(local, channel_type); 190 disable_40 = true;
191 break;
192 case NL80211_CHAN_HT40MINUS:
193 if (local->hw.conf.channel->flags & IEEE80211_CHAN_NO_HT40MINUS)
194 disable_40 = true;
195 break;
196 default:
197 break;
198 }
192 199
193 /* This can change during the lifetime of the BSS */ 200 /* This can change during the lifetime of the BSS */
194 if (!(ht_oper->ht_param & IEEE80211_HT_PARAM_CHAN_WIDTH_ANY)) 201 if (!(ht_oper->ht_param & IEEE80211_HT_PARAM_CHAN_WIDTH_ANY))
195 channel_type = NL80211_CHAN_HT20; 202 disable_40 = true;
196 203
197 if (!reconfig || (sdata->u.mgd.tx_chantype != channel_type)) { 204 mutex_lock(&local->sta_mtx);
205 sta = sta_info_get(sdata, bssid);
206
207 WARN_ON_ONCE(!sta);
208
209 if (sta && !sta->supports_40mhz)
210 disable_40 = true;
211
212 if (sta && (!reconfig ||
213 (disable_40 != !!(sta->sta.ht_cap.cap &
214 IEEE80211_HT_CAP_SUP_WIDTH_20_40)))) {
198 if (reconfig) { 215 if (reconfig) {
199 /* 216 /*
200 * Whenever the AP announces the HT mode changed 217 * Whenever the AP announces the HT mode changed
@@ -211,20 +228,19 @@ static u32 ieee80211_config_ht_tx(struct ieee80211_sub_if_data *sdata,
211 drv_flush(local, false); 228 drv_flush(local, false);
212 } 229 }
213 230
214 rcu_read_lock(); 231 if (disable_40)
215 sta = sta_info_get(sdata, bssid); 232 sta->sta.ht_cap.cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40;
216 if (sta) 233 else
217 rate_control_rate_update(local, sband, sta, 234 sta->sta.ht_cap.cap |= IEEE80211_HT_CAP_SUP_WIDTH_20_40;
218 IEEE80211_RC_HT_CHANGED,
219 channel_type);
220 rcu_read_unlock();
221 235
222 sdata->u.mgd.tx_chantype = channel_type; 236 rate_control_rate_update(local, sband, sta,
237 IEEE80211_RC_HT_CHANGED);
223 238
224 if (reconfig) 239 if (reconfig)
225 ieee80211_wake_queues_by_reason(&sdata->local->hw, 240 ieee80211_wake_queues_by_reason(&sdata->local->hw,
226 IEEE80211_QUEUE_STOP_REASON_CHTYPE_CHANGE); 241 IEEE80211_QUEUE_STOP_REASON_CHTYPE_CHANGE);
227 } 242 }
243 mutex_unlock(&local->sta_mtx);
228 244
229 ht_opmode = le16_to_cpu(ht_oper->operation_mode); 245 ht_opmode = le16_to_cpu(ht_oper->operation_mode);
230 246
@@ -2006,6 +2022,9 @@ static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata,
2006 ieee80211_ht_cap_ie_to_sta_ht_cap(sdata, sband, 2022 ieee80211_ht_cap_ie_to_sta_ht_cap(sdata, sband,
2007 elems.ht_cap_elem, &sta->sta.ht_cap); 2023 elems.ht_cap_elem, &sta->sta.ht_cap);
2008 2024
2025 sta->supports_40mhz =
2026 sta->sta.ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40;
2027
2009 rate_control_rate_init(sta); 2028 rate_control_rate_init(sta);
2010 2029
2011 if (ifmgd->flags & IEEE80211_STA_MFP_ENABLED) 2030 if (ifmgd->flags & IEEE80211_STA_MFP_ENABLED)