aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/mlme.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2008-10-08 04:59:33 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-10-31 18:58:53 -0400
commit7a5158ef8da70fdedeb0530faaa8128aa645be3c (patch)
tree6db285b5fc4971c5e15168fc0fb7cf442b89f168 /net/mac80211/mlme.c
parente87a2feea75e3cba7af43ed9317b56b282d87742 (diff)
mac80211: fix short slot handling
This patch makes mac80211 handle short slot requests from the AP properly. Also warn about uses of IEEE80211_CONF_SHORT_SLOT_TIME and optimise out the code since it cannot ever be hit anyway. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/mlme.c')
-rw-r--r--net/mac80211/mlme.c74
1 files changed, 40 insertions, 34 deletions
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 6ad2619db85..829995e740a 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -568,15 +568,27 @@ static void ieee80211_sta_wmm_params(struct ieee80211_local *local,
568 } 568 }
569} 569}
570 570
571static u32 ieee80211_handle_protect_preamb(struct ieee80211_sub_if_data *sdata, 571static u32 ieee80211_handle_bss_capability(struct ieee80211_sub_if_data *sdata,
572 bool use_protection, 572 u16 capab, bool erp_valid, u8 erp)
573 bool use_short_preamble)
574{ 573{
575 struct ieee80211_bss_conf *bss_conf = &sdata->bss_conf; 574 struct ieee80211_bss_conf *bss_conf = &sdata->bss_conf;
576#ifdef CONFIG_MAC80211_VERBOSE_DEBUG 575#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
577 struct ieee80211_if_sta *ifsta = &sdata->u.sta; 576 struct ieee80211_if_sta *ifsta = &sdata->u.sta;
578#endif 577#endif
579 u32 changed = 0; 578 u32 changed = 0;
579 bool use_protection;
580 bool use_short_preamble;
581 bool use_short_slot;
582
583 if (erp_valid) {
584 use_protection = (erp & WLAN_ERP_USE_PROTECTION) != 0;
585 use_short_preamble = (erp & WLAN_ERP_BARKER_PREAMBLE) == 0;
586 } else {
587 use_protection = false;
588 use_short_preamble = !!(capab & WLAN_CAPABILITY_SHORT_PREAMBLE);
589 }
590
591 use_short_slot = !!(capab & WLAN_CAPABILITY_SHORT_SLOT_TIME);
580 592
581 if (use_protection != bss_conf->use_cts_prot) { 593 if (use_protection != bss_conf->use_cts_prot) {
582#ifdef CONFIG_MAC80211_VERBOSE_DEBUG 594#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
@@ -605,30 +617,18 @@ static u32 ieee80211_handle_protect_preamb(struct ieee80211_sub_if_data *sdata,
605 changed |= BSS_CHANGED_ERP_PREAMBLE; 617 changed |= BSS_CHANGED_ERP_PREAMBLE;
606 } 618 }
607 619
608 return changed; 620 if (use_short_slot != bss_conf->use_short_slot) {
609} 621#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
610 622 if (net_ratelimit()) {
611static u32 ieee80211_handle_erp_ie(struct ieee80211_sub_if_data *sdata, 623 printk(KERN_DEBUG "%s: switched to %s slot"
612 u8 erp_value) 624 " (BSSID=%s)\n",
613{ 625 sdata->dev->name,
614 bool use_protection = (erp_value & WLAN_ERP_USE_PROTECTION) != 0; 626 use_short_slot ? "short" : "long",
615 bool use_short_preamble = (erp_value & WLAN_ERP_BARKER_PREAMBLE) == 0; 627 ifsta->bssid);
616 628 }
617 return ieee80211_handle_protect_preamb(sdata, 629#endif
618 use_protection, use_short_preamble); 630 bss_conf->use_short_slot = use_short_slot;
619} 631 changed |= BSS_CHANGED_ERP_SLOT;
620
621static u32 ieee80211_handle_bss_capability(struct ieee80211_sub_if_data *sdata,
622 struct ieee80211_bss *bss)
623{
624 u32 changed = 0;
625
626 if (bss->has_erp_value)
627 changed |= ieee80211_handle_erp_ie(sdata, bss->erp_value);
628 else {
629 u16 capab = bss->capability;
630 changed |= ieee80211_handle_protect_preamb(sdata, false,
631 (capab & WLAN_CAPABILITY_SHORT_PREAMBLE) != 0);
632 } 632 }
633 633
634 return changed; 634 return changed;
@@ -721,7 +721,8 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata,
721 sdata->bss_conf.timestamp = bss->timestamp; 721 sdata->bss_conf.timestamp = bss->timestamp;
722 sdata->bss_conf.dtim_period = bss->dtim_period; 722 sdata->bss_conf.dtim_period = bss->dtim_period;
723 723
724 changed |= ieee80211_handle_bss_capability(sdata, bss); 724 changed |= ieee80211_handle_bss_capability(sdata,
725 bss->capability, bss->has_erp_value, bss->erp_value);
725 726
726 ieee80211_rx_bss_put(local, bss); 727 ieee80211_rx_bss_put(local, bss);
727 } 728 }
@@ -1657,6 +1658,8 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
1657 struct ieee80211_local *local = sdata->local; 1658 struct ieee80211_local *local = sdata->local;
1658 struct ieee80211_conf *conf = &local->hw.conf; 1659 struct ieee80211_conf *conf = &local->hw.conf;
1659 u32 changed = 0; 1660 u32 changed = 0;
1661 bool erp_valid;
1662 u8 erp_value = 0;
1660 1663
1661 /* Process beacon from the current BSS */ 1664 /* Process beacon from the current BSS */
1662 baselen = (u8 *) mgmt->u.beacon.variable - (u8 *) mgmt; 1665 baselen = (u8 *) mgmt->u.beacon.variable - (u8 *) mgmt;
@@ -1678,13 +1681,16 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
1678 ieee80211_sta_wmm_params(local, ifsta, elems.wmm_param, 1681 ieee80211_sta_wmm_params(local, ifsta, elems.wmm_param,
1679 elems.wmm_param_len); 1682 elems.wmm_param_len);
1680 1683
1681 if (elems.erp_info && elems.erp_info_len >= 1) 1684
1682 changed |= ieee80211_handle_erp_ie(sdata, elems.erp_info[0]); 1685 if (elems.erp_info && elems.erp_info_len >= 1) {
1683 else { 1686 erp_valid = true;
1684 u16 capab = le16_to_cpu(mgmt->u.beacon.capab_info); 1687 erp_value = elems.erp_info[0];
1685 changed |= ieee80211_handle_protect_preamb(sdata, false, 1688 } else {
1686 (capab & WLAN_CAPABILITY_SHORT_PREAMBLE) != 0); 1689 erp_valid = false;
1687 } 1690 }
1691 changed |= ieee80211_handle_bss_capability(sdata,
1692 le16_to_cpu(mgmt->u.beacon.capab_info),
1693 erp_valid, erp_value);
1688 1694
1689 if (elems.ht_cap_elem && elems.ht_info_elem && 1695 if (elems.ht_cap_elem && elems.ht_info_elem &&
1690 elems.wmm_param && conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) { 1696 elems.wmm_param && conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) {