diff options
Diffstat (limited to 'net/mac80211/ieee80211_sta.c')
-rw-r--r-- | net/mac80211/ieee80211_sta.c | 50 |
1 files changed, 38 insertions, 12 deletions
diff --git a/net/mac80211/ieee80211_sta.c b/net/mac80211/ieee80211_sta.c index 9aeed5320228..c1706855460a 100644 --- a/net/mac80211/ieee80211_sta.c +++ b/net/mac80211/ieee80211_sta.c | |||
@@ -312,14 +312,12 @@ static void ieee80211_sta_wmm_params(struct net_device *dev, | |||
312 | } | 312 | } |
313 | } | 313 | } |
314 | 314 | ||
315 | 315 | static u32 ieee80211_handle_protect_preamb(struct ieee80211_sub_if_data *sdata, | |
316 | static u32 ieee80211_handle_erp_ie(struct ieee80211_sub_if_data *sdata, | 316 | bool use_protection, |
317 | u8 erp_value) | 317 | bool use_short_preamble) |
318 | { | 318 | { |
319 | struct ieee80211_bss_conf *bss_conf = &sdata->bss_conf; | 319 | struct ieee80211_bss_conf *bss_conf = &sdata->bss_conf; |
320 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; | 320 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; |
321 | bool use_protection = (erp_value & WLAN_ERP_USE_PROTECTION) != 0; | ||
322 | bool preamble_mode = (erp_value & WLAN_ERP_BARKER_PREAMBLE) != 0; | ||
323 | DECLARE_MAC_BUF(mac); | 321 | DECLARE_MAC_BUF(mac); |
324 | u32 changed = 0; | 322 | u32 changed = 0; |
325 | 323 | ||
@@ -335,22 +333,47 @@ static u32 ieee80211_handle_erp_ie(struct ieee80211_sub_if_data *sdata, | |||
335 | changed |= BSS_CHANGED_ERP_CTS_PROT; | 333 | changed |= BSS_CHANGED_ERP_CTS_PROT; |
336 | } | 334 | } |
337 | 335 | ||
338 | if (preamble_mode != bss_conf->use_short_preamble) { | 336 | if (use_short_preamble != bss_conf->use_short_preamble) { |
339 | if (net_ratelimit()) { | 337 | if (net_ratelimit()) { |
340 | printk(KERN_DEBUG "%s: switched to %s barker preamble" | 338 | printk(KERN_DEBUG "%s: switched to %s barker preamble" |
341 | " (BSSID=%s)\n", | 339 | " (BSSID=%s)\n", |
342 | sdata->dev->name, | 340 | sdata->dev->name, |
343 | (preamble_mode == WLAN_ERP_PREAMBLE_SHORT) ? | 341 | use_short_preamble ? "short" : "long", |
344 | "short" : "long", | ||
345 | print_mac(mac, ifsta->bssid)); | 342 | print_mac(mac, ifsta->bssid)); |
346 | } | 343 | } |
347 | bss_conf->use_short_preamble = preamble_mode; | 344 | bss_conf->use_short_preamble = use_short_preamble; |
348 | changed |= BSS_CHANGED_ERP_PREAMBLE; | 345 | changed |= BSS_CHANGED_ERP_PREAMBLE; |
349 | } | 346 | } |
350 | 347 | ||
351 | return changed; | 348 | return changed; |
352 | } | 349 | } |
353 | 350 | ||
351 | static u32 ieee80211_handle_erp_ie(struct ieee80211_sub_if_data *sdata, | ||
352 | u8 erp_value) | ||
353 | { | ||
354 | bool use_protection = (erp_value & WLAN_ERP_USE_PROTECTION) != 0; | ||
355 | bool use_short_preamble = (erp_value & WLAN_ERP_BARKER_PREAMBLE) == 0; | ||
356 | |||
357 | return ieee80211_handle_protect_preamb(sdata, | ||
358 | use_protection, use_short_preamble); | ||
359 | } | ||
360 | |||
361 | static u32 ieee80211_handle_bss_capability(struct ieee80211_sub_if_data *sdata, | ||
362 | struct ieee80211_sta_bss *bss) | ||
363 | { | ||
364 | u32 changed = 0; | ||
365 | |||
366 | if (bss->has_erp_value) | ||
367 | changed |= ieee80211_handle_erp_ie(sdata, bss->erp_value); | ||
368 | else { | ||
369 | u16 capab = bss->capability; | ||
370 | changed |= ieee80211_handle_protect_preamb(sdata, false, | ||
371 | (capab & WLAN_CAPABILITY_SHORT_PREAMBLE) != 0); | ||
372 | } | ||
373 | |||
374 | return changed; | ||
375 | } | ||
376 | |||
354 | int ieee80211_ht_cap_ie_to_ht_info(struct ieee80211_ht_cap *ht_cap_ie, | 377 | int ieee80211_ht_cap_ie_to_ht_info(struct ieee80211_ht_cap *ht_cap_ie, |
355 | struct ieee80211_ht_info *ht_info) | 378 | struct ieee80211_ht_info *ht_info) |
356 | { | 379 | { |
@@ -469,9 +492,7 @@ static void ieee80211_set_associated(struct net_device *dev, | |||
469 | local->hw.conf.channel, | 492 | local->hw.conf.channel, |
470 | ifsta->ssid, ifsta->ssid_len); | 493 | ifsta->ssid, ifsta->ssid_len); |
471 | if (bss) { | 494 | if (bss) { |
472 | if (bss->has_erp_value) | 495 | changed |= ieee80211_handle_bss_capability(sdata, bss); |
473 | changed |= ieee80211_handle_erp_ie( | ||
474 | sdata, bss->erp_value); | ||
475 | ieee80211_rx_bss_put(dev, bss); | 496 | ieee80211_rx_bss_put(dev, bss); |
476 | } | 497 | } |
477 | 498 | ||
@@ -2117,6 +2138,11 @@ static void ieee80211_rx_mgmt_beacon(struct net_device *dev, | |||
2117 | 2138 | ||
2118 | if (elems.erp_info && elems.erp_info_len >= 1) | 2139 | if (elems.erp_info && elems.erp_info_len >= 1) |
2119 | changed |= ieee80211_handle_erp_ie(sdata, elems.erp_info[0]); | 2140 | changed |= ieee80211_handle_erp_ie(sdata, elems.erp_info[0]); |
2141 | else { | ||
2142 | u16 capab = le16_to_cpu(mgmt->u.beacon.capab_info); | ||
2143 | changed |= ieee80211_handle_protect_preamb(sdata, false, | ||
2144 | (capab & WLAN_CAPABILITY_SHORT_PREAMBLE) != 0); | ||
2145 | } | ||
2120 | 2146 | ||
2121 | if (elems.ht_cap_elem && elems.ht_info_elem && | 2147 | if (elems.ht_cap_elem && elems.ht_info_elem && |
2122 | elems.wmm_param && local->ops->conf_ht && | 2148 | elems.wmm_param && local->ops->conf_ht && |