aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2012-03-08 09:02:04 -0500
committerJohn W. Linville <linville@tuxdriver.com>2012-03-12 14:22:12 -0400
commit4e74bfdb30f79e9bf87aa359eff29fbdb93cc12a (patch)
treea29af65110d4762828833afa6cf88770c4d4bb93 /net/mac80211
parentde5036aae635b7ea5a920e56fcf074a333b325ca (diff)
mac80211: simplify HT checks
Always set/use IEEE80211_STA_DISABLE_11N instead of duplicating the queue, WMM and HT checks in all places. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211')
-rw-r--r--net/mac80211/mlme.c57
1 files changed, 26 insertions, 31 deletions
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 059a4eba9fec..5dfc1e8a1a22 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -192,33 +192,27 @@ static u32 ieee80211_enable_ht(struct ieee80211_sub_if_data *sdata,
192 enum nl80211_channel_type channel_type = NL80211_CHAN_NO_HT; 192 enum nl80211_channel_type channel_type = NL80211_CHAN_NO_HT;
193 193
194 sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; 194 sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
195
196 prev_chantype = sdata->vif.bss_conf.channel_type; 195 prev_chantype = sdata->vif.bss_conf.channel_type;
197 196
198 /* HT is not supported */
199 if (!sband->ht_cap.ht_supported)
200 enable_ht = false;
201 197
202 if (enable_ht) { 198 hti_cfreq = ieee80211_channel_to_frequency(hti->control_chan,
203 hti_cfreq = ieee80211_channel_to_frequency(hti->control_chan, 199 sband->band);
204 sband->band); 200 /* check that channel matches the right operating channel */
205 /* check that channel matches the right operating channel */ 201 if (local->hw.conf.channel->center_freq != hti_cfreq) {
206 if (local->hw.conf.channel->center_freq != hti_cfreq) { 202 /* Some APs mess this up, evidently.
207 /* Some APs mess this up, evidently. 203 * Netgear WNDR3700 sometimes reports 4 higher than
208 * Netgear WNDR3700 sometimes reports 4 higher than 204 * the actual channel, for instance.
209 * the actual channel, for instance. 205 */
210 */ 206 printk(KERN_DEBUG
211 printk(KERN_DEBUG 207 "%s: Wrong control channel in association"
212 "%s: Wrong control channel in association" 208 " response: configured center-freq: %d"
213 " response: configured center-freq: %d" 209 " hti-cfreq: %d hti->control_chan: %d"
214 " hti-cfreq: %d hti->control_chan: %d" 210 " band: %d. Disabling HT.\n",
215 " band: %d. Disabling HT.\n", 211 sdata->name,
216 sdata->name, 212 local->hw.conf.channel->center_freq,
217 local->hw.conf.channel->center_freq, 213 hti_cfreq, hti->control_chan,
218 hti_cfreq, hti->control_chan, 214 sband->band);
219 sband->band); 215 enable_ht = false;
220 enable_ht = false;
221 }
222 } 216 }
223 217
224 if (enable_ht) { 218 if (enable_ht) {
@@ -335,9 +329,6 @@ static void ieee80211_add_ht_ie(struct ieee80211_sub_if_data *sdata,
335 329
336 BUILD_BUG_ON(sizeof(ht_cap) != sizeof(sband->ht_cap)); 330 BUILD_BUG_ON(sizeof(ht_cap) != sizeof(sband->ht_cap));
337 331
338 if (!sband->ht_cap.ht_supported)
339 return;
340
341 if (!ht_info_ie) 332 if (!ht_info_ie)
342 return; 333 return;
343 334
@@ -405,7 +396,6 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata)
405 u16 capab; 396 u16 capab;
406 struct ieee80211_supported_band *sband; 397 struct ieee80211_supported_band *sband;
407 u32 rates = 0; 398 u32 rates = 0;
408 struct ieee80211_bss *bss = (void *)assoc_data->bss->priv;
409 399
410 lockdep_assert_held(&ifmgd->mtx); 400 lockdep_assert_held(&ifmgd->mtx);
411 401
@@ -566,8 +556,7 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata)
566 offset = noffset; 556 offset = noffset;
567 } 557 }
568 558
569 if (!(ifmgd->flags & IEEE80211_STA_DISABLE_11N) && 559 if (!(ifmgd->flags & IEEE80211_STA_DISABLE_11N))
570 bss->wmm_used && local->hw.queues >= 4)
571 ieee80211_add_ht_ie(sdata, skb, assoc_data->ht_information_ie, 560 ieee80211_add_ht_ie(sdata, skb, assoc_data->ht_information_ie,
572 sband, local->oper_channel, ifmgd->ap_smps); 561 sband, local->oper_channel, ifmgd->ap_smps);
573 562
@@ -2147,7 +2136,6 @@ static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata,
2147 changed |= BSS_CHANGED_QOS; 2136 changed |= BSS_CHANGED_QOS;
2148 2137
2149 if (elems.ht_info_elem && elems.wmm_param && 2138 if (elems.ht_info_elem && elems.wmm_param &&
2150 (sdata->local->hw.queues >= 4) &&
2151 !(ifmgd->flags & IEEE80211_STA_DISABLE_11N)) 2139 !(ifmgd->flags & IEEE80211_STA_DISABLE_11N))
2152 changed |= ieee80211_enable_ht(sdata, elems.ht_info_elem, 2140 changed |= ieee80211_enable_ht(sdata, elems.ht_info_elem,
2153 cbss->bssid, ap_ht_cap_flags, 2141 cbss->bssid, ap_ht_cap_flags,
@@ -3232,6 +3220,7 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,
3232 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; 3220 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
3233 struct ieee80211_bss *bss = (void *)req->bss->priv; 3221 struct ieee80211_bss *bss = (void *)req->bss->priv;
3234 struct ieee80211_mgd_assoc_data *assoc_data; 3222 struct ieee80211_mgd_assoc_data *assoc_data;
3223 struct ieee80211_supported_band *sband;
3235 struct sta_info *sta; 3224 struct sta_info *sta;
3236 const u8 *ssidie; 3225 const u8 *ssidie;
3237 int i, err; 3226 int i, err;
@@ -3290,6 +3279,12 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,
3290 if (req->flags & ASSOC_REQ_DISABLE_HT) 3279 if (req->flags & ASSOC_REQ_DISABLE_HT)
3291 ifmgd->flags |= IEEE80211_STA_DISABLE_11N; 3280 ifmgd->flags |= IEEE80211_STA_DISABLE_11N;
3292 3281
3282 /* Also disable HT if we don't support it or the AP doesn't use WMM */
3283 sband = local->hw.wiphy->bands[req->bss->channel->band];
3284 if (!sband->ht_cap.ht_supported ||
3285 local->hw.queues < 4 || !bss->wmm_used)
3286 ifmgd->flags |= IEEE80211_STA_DISABLE_11N;
3287
3293 memcpy(&ifmgd->ht_capa, &req->ht_capa, sizeof(ifmgd->ht_capa)); 3288 memcpy(&ifmgd->ht_capa, &req->ht_capa, sizeof(ifmgd->ht_capa));
3294 memcpy(&ifmgd->ht_capa_mask, &req->ht_capa_mask, 3289 memcpy(&ifmgd->ht_capa_mask, &req->ht_capa_mask,
3295 sizeof(ifmgd->ht_capa_mask)); 3290 sizeof(ifmgd->ht_capa_mask));