aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/mlme.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/mac80211/mlme.c')
-rw-r--r--net/mac80211/mlme.c826
1 files changed, 626 insertions, 200 deletions
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 132938b073dc..aca22b00b6a3 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -17,10 +17,13 @@
17#include <linux/if_arp.h> 17#include <linux/if_arp.h>
18#include <linux/etherdevice.h> 18#include <linux/etherdevice.h>
19#include <linux/rtnetlink.h> 19#include <linux/rtnetlink.h>
20#include <linux/pm_qos_params.h>
21#include <linux/crc32.h>
20#include <net/mac80211.h> 22#include <net/mac80211.h>
21#include <asm/unaligned.h> 23#include <asm/unaligned.h>
22 24
23#include "ieee80211_i.h" 25#include "ieee80211_i.h"
26#include "driver-ops.h"
24#include "rate.h" 27#include "rate.h"
25#include "led.h" 28#include "led.h"
26 29
@@ -30,9 +33,13 @@
30#define IEEE80211_ASSOC_TIMEOUT (HZ / 5) 33#define IEEE80211_ASSOC_TIMEOUT (HZ / 5)
31#define IEEE80211_ASSOC_MAX_TRIES 3 34#define IEEE80211_ASSOC_MAX_TRIES 3
32#define IEEE80211_MONITORING_INTERVAL (2 * HZ) 35#define IEEE80211_MONITORING_INTERVAL (2 * HZ)
36#define IEEE80211_PROBE_WAIT (HZ / 5)
33#define IEEE80211_PROBE_IDLE_TIME (60 * HZ) 37#define IEEE80211_PROBE_IDLE_TIME (60 * HZ)
34#define IEEE80211_RETRY_AUTH_INTERVAL (1 * HZ) 38#define IEEE80211_RETRY_AUTH_INTERVAL (1 * HZ)
35 39
40#define TMR_RUNNING_TIMER 0
41#define TMR_RUNNING_CHANSW 1
42
36/* utils */ 43/* utils */
37static int ecw2cw(int ecw) 44static int ecw2cw(int ecw)
38{ 45{
@@ -80,6 +87,92 @@ static int ieee80211_compatible_rates(struct ieee80211_bss *bss,
80 return count; 87 return count;
81} 88}
82 89
90/*
91 * ieee80211_enable_ht should be called only after the operating band
92 * has been determined as ht configuration depends on the hw's
93 * HT abilities for a specific band.
94 */
95static u32 ieee80211_enable_ht(struct ieee80211_sub_if_data *sdata,
96 struct ieee80211_ht_info *hti,
97 u16 ap_ht_cap_flags)
98{
99 struct ieee80211_local *local = sdata->local;
100 struct ieee80211_supported_band *sband;
101 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
102 struct sta_info *sta;
103 u32 changed = 0;
104 u16 ht_opmode;
105 bool enable_ht = true, ht_changed;
106 enum nl80211_channel_type channel_type = NL80211_CHAN_NO_HT;
107
108 sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
109
110 /* HT is not supported */
111 if (!sband->ht_cap.ht_supported)
112 enable_ht = false;
113
114 /* check that channel matches the right operating channel */
115 if (local->hw.conf.channel->center_freq !=
116 ieee80211_channel_to_frequency(hti->control_chan))
117 enable_ht = false;
118
119 if (enable_ht) {
120 channel_type = NL80211_CHAN_HT20;
121
122 if (!(ap_ht_cap_flags & IEEE80211_HT_CAP_40MHZ_INTOLERANT) &&
123 (sband->ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40) &&
124 (hti->ht_param & IEEE80211_HT_PARAM_CHAN_WIDTH_ANY)) {
125 switch(hti->ht_param & IEEE80211_HT_PARAM_CHA_SEC_OFFSET) {
126 case IEEE80211_HT_PARAM_CHA_SEC_ABOVE:
127 if (!(local->hw.conf.channel->flags &
128 IEEE80211_CHAN_NO_HT40PLUS))
129 channel_type = NL80211_CHAN_HT40PLUS;
130 break;
131 case IEEE80211_HT_PARAM_CHA_SEC_BELOW:
132 if (!(local->hw.conf.channel->flags &
133 IEEE80211_CHAN_NO_HT40MINUS))
134 channel_type = NL80211_CHAN_HT40MINUS;
135 break;
136 }
137 }
138 }
139
140 ht_changed = conf_is_ht(&local->hw.conf) != enable_ht ||
141 channel_type != local->hw.conf.channel_type;
142
143 local->oper_channel_type = channel_type;
144
145 if (ht_changed) {
146 /* channel_type change automatically detected */
147 ieee80211_hw_config(local, 0);
148
149 rcu_read_lock();
150
151 sta = sta_info_get(local, ifmgd->bssid);
152 if (sta)
153 rate_control_rate_update(local, sband, sta,
154 IEEE80211_RC_HT_CHANGED);
155
156 rcu_read_unlock();
157 }
158
159 /* disable HT */
160 if (!enable_ht)
161 return 0;
162
163 ht_opmode = le16_to_cpu(hti->operation_mode);
164
165 /* if bss configuration changed store the new one */
166 if (!sdata->ht_opmode_valid ||
167 sdata->vif.bss_conf.ht_operation_mode != ht_opmode) {
168 changed |= BSS_CHANGED_HT;
169 sdata->vif.bss_conf.ht_operation_mode = ht_opmode;
170 sdata->ht_opmode_valid = true;
171 }
172
173 return changed;
174}
175
83/* frame sending functions */ 176/* frame sending functions */
84 177
85static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata) 178static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata)
@@ -263,13 +356,13 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata)
263 356
264 switch (ht_info->ht_param & IEEE80211_HT_PARAM_CHA_SEC_OFFSET) { 357 switch (ht_info->ht_param & IEEE80211_HT_PARAM_CHA_SEC_OFFSET) {
265 case IEEE80211_HT_PARAM_CHA_SEC_ABOVE: 358 case IEEE80211_HT_PARAM_CHA_SEC_ABOVE:
266 if (flags & IEEE80211_CHAN_NO_FAT_ABOVE) { 359 if (flags & IEEE80211_CHAN_NO_HT40PLUS) {
267 cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40; 360 cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40;
268 cap &= ~IEEE80211_HT_CAP_SGI_40; 361 cap &= ~IEEE80211_HT_CAP_SGI_40;
269 } 362 }
270 break; 363 break;
271 case IEEE80211_HT_PARAM_CHA_SEC_BELOW: 364 case IEEE80211_HT_PARAM_CHA_SEC_BELOW:
272 if (flags & IEEE80211_CHAN_NO_FAT_BELOW) { 365 if (flags & IEEE80211_CHAN_NO_HT40MINUS) {
273 cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40; 366 cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40;
274 cap &= ~IEEE80211_HT_CAP_SGI_40; 367 cap &= ~IEEE80211_HT_CAP_SGI_40;
275 } 368 }
@@ -325,6 +418,10 @@ static void ieee80211_send_deauth_disassoc(struct ieee80211_sub_if_data *sdata,
325 /* u.deauth.reason_code == u.disassoc.reason_code */ 418 /* u.deauth.reason_code == u.disassoc.reason_code */
326 mgmt->u.deauth.reason_code = cpu_to_le16(reason); 419 mgmt->u.deauth.reason_code = cpu_to_le16(reason);
327 420
421 if (stype == IEEE80211_STYPE_DEAUTH)
422 cfg80211_send_deauth(sdata->dev, (u8 *) mgmt, skb->len);
423 else
424 cfg80211_send_disassoc(sdata->dev, (u8 *) mgmt, skb->len);
328 ieee80211_tx_skb(sdata, skb, ifmgd->flags & IEEE80211_STA_MFP_ENABLED); 425 ieee80211_tx_skb(sdata, skb, ifmgd->flags & IEEE80211_STA_MFP_ENABLED);
329} 426}
330 427
@@ -359,6 +456,277 @@ void ieee80211_send_pspoll(struct ieee80211_local *local,
359 ieee80211_tx_skb(sdata, skb, 0); 456 ieee80211_tx_skb(sdata, skb, 0);
360} 457}
361 458
459void ieee80211_send_nullfunc(struct ieee80211_local *local,
460 struct ieee80211_sub_if_data *sdata,
461 int powersave)
462{
463 struct sk_buff *skb;
464 struct ieee80211_hdr *nullfunc;
465 __le16 fc;
466
467 if (WARN_ON(sdata->vif.type != NL80211_IFTYPE_STATION))
468 return;
469
470 skb = dev_alloc_skb(local->hw.extra_tx_headroom + 24);
471 if (!skb) {
472 printk(KERN_DEBUG "%s: failed to allocate buffer for nullfunc "
473 "frame\n", sdata->dev->name);
474 return;
475 }
476 skb_reserve(skb, local->hw.extra_tx_headroom);
477
478 nullfunc = (struct ieee80211_hdr *) skb_put(skb, 24);
479 memset(nullfunc, 0, 24);
480 fc = cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_NULLFUNC |
481 IEEE80211_FCTL_TODS);
482 if (powersave)
483 fc |= cpu_to_le16(IEEE80211_FCTL_PM);
484 nullfunc->frame_control = fc;
485 memcpy(nullfunc->addr1, sdata->u.mgd.bssid, ETH_ALEN);
486 memcpy(nullfunc->addr2, sdata->dev->dev_addr, ETH_ALEN);
487 memcpy(nullfunc->addr3, sdata->u.mgd.bssid, ETH_ALEN);
488
489 ieee80211_tx_skb(sdata, skb, 0);
490}
491
492/* spectrum management related things */
493static void ieee80211_chswitch_work(struct work_struct *work)
494{
495 struct ieee80211_sub_if_data *sdata =
496 container_of(work, struct ieee80211_sub_if_data, u.mgd.chswitch_work);
497 struct ieee80211_bss *bss;
498 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
499
500 if (!netif_running(sdata->dev))
501 return;
502
503 bss = ieee80211_rx_bss_get(sdata->local, ifmgd->bssid,
504 sdata->local->hw.conf.channel->center_freq,
505 ifmgd->ssid, ifmgd->ssid_len);
506 if (!bss)
507 goto exit;
508
509 sdata->local->oper_channel = sdata->local->csa_channel;
510 /* XXX: shouldn't really modify cfg80211-owned data! */
511 if (!ieee80211_hw_config(sdata->local, IEEE80211_CONF_CHANGE_CHANNEL))
512 bss->cbss.channel = sdata->local->oper_channel;
513
514 ieee80211_rx_bss_put(sdata->local, bss);
515exit:
516 ifmgd->flags &= ~IEEE80211_STA_CSA_RECEIVED;
517 ieee80211_wake_queues_by_reason(&sdata->local->hw,
518 IEEE80211_QUEUE_STOP_REASON_CSA);
519}
520
521static void ieee80211_chswitch_timer(unsigned long data)
522{
523 struct ieee80211_sub_if_data *sdata =
524 (struct ieee80211_sub_if_data *) data;
525 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
526
527 if (sdata->local->quiescing) {
528 set_bit(TMR_RUNNING_CHANSW, &ifmgd->timers_running);
529 return;
530 }
531
532 queue_work(sdata->local->hw.workqueue, &ifmgd->chswitch_work);
533}
534
535void ieee80211_sta_process_chanswitch(struct ieee80211_sub_if_data *sdata,
536 struct ieee80211_channel_sw_ie *sw_elem,
537 struct ieee80211_bss *bss)
538{
539 struct ieee80211_channel *new_ch;
540 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
541 int new_freq = ieee80211_channel_to_frequency(sw_elem->new_ch_num);
542
543 if (ifmgd->state != IEEE80211_STA_MLME_ASSOCIATED)
544 return;
545
546 if (sdata->local->sw_scanning || sdata->local->hw_scanning)
547 return;
548
549 /* Disregard subsequent beacons if we are already running a timer
550 processing a CSA */
551
552 if (ifmgd->flags & IEEE80211_STA_CSA_RECEIVED)
553 return;
554
555 new_ch = ieee80211_get_channel(sdata->local->hw.wiphy, new_freq);
556 if (!new_ch || new_ch->flags & IEEE80211_CHAN_DISABLED)
557 return;
558
559 sdata->local->csa_channel = new_ch;
560
561 if (sw_elem->count <= 1) {
562 queue_work(sdata->local->hw.workqueue, &ifmgd->chswitch_work);
563 } else {
564 ieee80211_stop_queues_by_reason(&sdata->local->hw,
565 IEEE80211_QUEUE_STOP_REASON_CSA);
566 ifmgd->flags |= IEEE80211_STA_CSA_RECEIVED;
567 mod_timer(&ifmgd->chswitch_timer,
568 jiffies +
569 msecs_to_jiffies(sw_elem->count *
570 bss->cbss.beacon_interval));
571 }
572}
573
574static void ieee80211_handle_pwr_constr(struct ieee80211_sub_if_data *sdata,
575 u16 capab_info, u8 *pwr_constr_elem,
576 u8 pwr_constr_elem_len)
577{
578 struct ieee80211_conf *conf = &sdata->local->hw.conf;
579
580 if (!(capab_info & WLAN_CAPABILITY_SPECTRUM_MGMT))
581 return;
582
583 /* Power constraint IE length should be 1 octet */
584 if (pwr_constr_elem_len != 1)
585 return;
586
587 if ((*pwr_constr_elem <= conf->channel->max_power) &&
588 (*pwr_constr_elem != sdata->local->power_constr_level)) {
589 sdata->local->power_constr_level = *pwr_constr_elem;
590 ieee80211_hw_config(sdata->local, 0);
591 }
592}
593
594/* powersave */
595static void ieee80211_enable_ps(struct ieee80211_local *local,
596 struct ieee80211_sub_if_data *sdata)
597{
598 struct ieee80211_conf *conf = &local->hw.conf;
599
600 /*
601 * If we are scanning right now then the parameters will
602 * take effect when scan finishes.
603 */
604 if (local->hw_scanning || local->sw_scanning)
605 return;
606
607 if (conf->dynamic_ps_timeout > 0 &&
608 !(local->hw.flags & IEEE80211_HW_SUPPORTS_DYNAMIC_PS)) {
609 mod_timer(&local->dynamic_ps_timer, jiffies +
610 msecs_to_jiffies(conf->dynamic_ps_timeout));
611 } else {
612 if (local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK)
613 ieee80211_send_nullfunc(local, sdata, 1);
614 conf->flags |= IEEE80211_CONF_PS;
615 ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS);
616 }
617}
618
619static void ieee80211_change_ps(struct ieee80211_local *local)
620{
621 struct ieee80211_conf *conf = &local->hw.conf;
622
623 if (local->ps_sdata) {
624 ieee80211_enable_ps(local, local->ps_sdata);
625 } else if (conf->flags & IEEE80211_CONF_PS) {
626 conf->flags &= ~IEEE80211_CONF_PS;
627 ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS);
628 del_timer_sync(&local->dynamic_ps_timer);
629 cancel_work_sync(&local->dynamic_ps_enable_work);
630 }
631}
632
633/* need to hold RTNL or interface lock */
634void ieee80211_recalc_ps(struct ieee80211_local *local, s32 latency)
635{
636 struct ieee80211_sub_if_data *sdata, *found = NULL;
637 int count = 0;
638
639 if (!(local->hw.flags & IEEE80211_HW_SUPPORTS_PS)) {
640 local->ps_sdata = NULL;
641 return;
642 }
643
644 list_for_each_entry(sdata, &local->interfaces, list) {
645 if (!netif_running(sdata->dev))
646 continue;
647 if (sdata->vif.type != NL80211_IFTYPE_STATION)
648 continue;
649 found = sdata;
650 count++;
651 }
652
653 if (count == 1 && found->u.mgd.powersave &&
654 (found->u.mgd.flags & IEEE80211_STA_ASSOCIATED) &&
655 !(found->u.mgd.flags & IEEE80211_STA_PROBEREQ_POLL)) {
656 s32 beaconint_us;
657
658 if (latency < 0)
659 latency = pm_qos_requirement(PM_QOS_NETWORK_LATENCY);
660
661 beaconint_us = ieee80211_tu_to_usec(
662 found->vif.bss_conf.beacon_int);
663
664 if (beaconint_us > latency) {
665 local->ps_sdata = NULL;
666 } else {
667 u8 dtimper = found->vif.bss_conf.dtim_period;
668 int maxslp = 1;
669
670 if (dtimper > 1)
671 maxslp = min_t(int, dtimper,
672 latency / beaconint_us);
673
674 local->hw.conf.max_sleep_period = maxslp;
675 local->ps_sdata = found;
676 }
677 } else {
678 local->ps_sdata = NULL;
679 }
680
681 ieee80211_change_ps(local);
682}
683
684void ieee80211_dynamic_ps_disable_work(struct work_struct *work)
685{
686 struct ieee80211_local *local =
687 container_of(work, struct ieee80211_local,
688 dynamic_ps_disable_work);
689
690 if (local->hw.conf.flags & IEEE80211_CONF_PS) {
691 local->hw.conf.flags &= ~IEEE80211_CONF_PS;
692 ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS);
693 }
694
695 ieee80211_wake_queues_by_reason(&local->hw,
696 IEEE80211_QUEUE_STOP_REASON_PS);
697}
698
699void ieee80211_dynamic_ps_enable_work(struct work_struct *work)
700{
701 struct ieee80211_local *local =
702 container_of(work, struct ieee80211_local,
703 dynamic_ps_enable_work);
704 struct ieee80211_sub_if_data *sdata = local->ps_sdata;
705
706 /* can only happen when PS was just disabled anyway */
707 if (!sdata)
708 return;
709
710 if (local->hw.conf.flags & IEEE80211_CONF_PS)
711 return;
712
713 if (local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK)
714 ieee80211_send_nullfunc(local, sdata, 1);
715
716 local->hw.conf.flags |= IEEE80211_CONF_PS;
717 ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS);
718}
719
720void ieee80211_dynamic_ps_timer(unsigned long data)
721{
722 struct ieee80211_local *local = (void *) data;
723
724 if (local->quiescing)
725 return;
726
727 queue_work(local->hw.workqueue, &local->dynamic_ps_enable_work);
728}
729
362/* MLME */ 730/* MLME */
363static void ieee80211_sta_wmm_params(struct ieee80211_local *local, 731static void ieee80211_sta_wmm_params(struct ieee80211_local *local,
364 struct ieee80211_if_managed *ifmgd, 732 struct ieee80211_if_managed *ifmgd,
@@ -424,41 +792,16 @@ static void ieee80211_sta_wmm_params(struct ieee80211_local *local,
424#ifdef CONFIG_MAC80211_VERBOSE_DEBUG 792#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
425 printk(KERN_DEBUG "%s: WMM queue=%d aci=%d acm=%d aifs=%d " 793 printk(KERN_DEBUG "%s: WMM queue=%d aci=%d acm=%d aifs=%d "
426 "cWmin=%d cWmax=%d txop=%d\n", 794 "cWmin=%d cWmax=%d txop=%d\n",
427 local->mdev->name, queue, aci, acm, params.aifs, params.cw_min, 795 wiphy_name(local->hw.wiphy), queue, aci, acm,
428 params.cw_max, params.txop); 796 params.aifs, params.cw_min, params.cw_max, params.txop);
429#endif 797#endif
430 if (local->ops->conf_tx && 798 if (drv_conf_tx(local, queue, &params) && local->ops->conf_tx)
431 local->ops->conf_tx(local_to_hw(local), queue, &params)) {
432 printk(KERN_DEBUG "%s: failed to set TX queue " 799 printk(KERN_DEBUG "%s: failed to set TX queue "
433 "parameters for queue %d\n", local->mdev->name, queue); 800 "parameters for queue %d\n",
434 } 801 wiphy_name(local->hw.wiphy), queue);
435 } 802 }
436} 803}
437 804
438static bool ieee80211_check_tim(struct ieee802_11_elems *elems, u16 aid)
439{
440 u8 mask;
441 u8 index, indexn1, indexn2;
442 struct ieee80211_tim_ie *tim = (struct ieee80211_tim_ie *) elems->tim;
443
444 if (unlikely(!tim || elems->tim_len < 4))
445 return false;
446
447 aid &= 0x3fff;
448 index = aid / 8;
449 mask = 1 << (aid & 7);
450
451 indexn1 = tim->bitmap_ctrl & 0xfe;
452 indexn2 = elems->tim_len + indexn1 - 4;
453
454 if (index < indexn1 || index > indexn2)
455 return false;
456
457 index -= indexn1;
458
459 return !!(tim->virtual_map[index] & mask);
460}
461
462static u32 ieee80211_handle_bss_capability(struct ieee80211_sub_if_data *sdata, 805static u32 ieee80211_handle_bss_capability(struct ieee80211_sub_if_data *sdata,
463 u16 capab, bool erp_valid, u8 erp) 806 u16 capab, bool erp_valid, u8 erp)
464{ 807{
@@ -610,6 +953,7 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata,
610 sdata->vif.bss_conf.timestamp = bss->cbss.tsf; 953 sdata->vif.bss_conf.timestamp = bss->cbss.tsf;
611 sdata->vif.bss_conf.dtim_period = bss->dtim_period; 954 sdata->vif.bss_conf.dtim_period = bss->dtim_period;
612 955
956 bss_info_changed |= BSS_CHANGED_BEACON_INT;
613 bss_info_changed |= ieee80211_handle_bss_capability(sdata, 957 bss_info_changed |= ieee80211_handle_bss_capability(sdata,
614 bss->cbss.capability, bss->has_erp_value, bss->erp_value); 958 bss->cbss.capability, bss->has_erp_value, bss->erp_value);
615 959
@@ -632,20 +976,17 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata,
632 * changed or not. 976 * changed or not.
633 */ 977 */
634 bss_info_changed |= BSS_CHANGED_BASIC_RATES; 978 bss_info_changed |= BSS_CHANGED_BASIC_RATES;
979
980 /* And the BSSID changed - we're associated now */
981 bss_info_changed |= BSS_CHANGED_BSSID;
982
635 ieee80211_bss_info_change_notify(sdata, bss_info_changed); 983 ieee80211_bss_info_change_notify(sdata, bss_info_changed);
636 984
637 if (local->powersave) { 985 /* will be same as sdata */
638 if (!(local->hw.flags & IEEE80211_HW_SUPPORTS_DYNAMIC_PS) && 986 if (local->ps_sdata) {
639 local->hw.conf.dynamic_ps_timeout > 0) { 987 mutex_lock(&local->iflist_mtx);
640 mod_timer(&local->dynamic_ps_timer, jiffies + 988 ieee80211_recalc_ps(local, -1);
641 msecs_to_jiffies( 989 mutex_unlock(&local->iflist_mtx);
642 local->hw.conf.dynamic_ps_timeout));
643 } else {
644 if (local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK)
645 ieee80211_send_nullfunc(local, sdata, 1);
646 conf->flags |= IEEE80211_CONF_PS;
647 ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS);
648 }
649 } 990 }
650 991
651 netif_tx_start_all_queues(sdata->dev); 992 netif_tx_start_all_queues(sdata->dev);
@@ -664,7 +1005,8 @@ static void ieee80211_direct_probe(struct ieee80211_sub_if_data *sdata)
664 printk(KERN_DEBUG "%s: direct probe to AP %pM timed out\n", 1005 printk(KERN_DEBUG "%s: direct probe to AP %pM timed out\n",
665 sdata->dev->name, ifmgd->bssid); 1006 sdata->dev->name, ifmgd->bssid);
666 ifmgd->state = IEEE80211_STA_MLME_DISABLED; 1007 ifmgd->state = IEEE80211_STA_MLME_DISABLED;
667 ieee80211_sta_send_apinfo(sdata); 1008 ieee80211_recalc_idle(local);
1009 cfg80211_send_auth_timeout(sdata->dev, ifmgd->bssid);
668 1010
669 /* 1011 /*
670 * Most likely AP is not in the range so remove the 1012 * Most likely AP is not in the range so remove the
@@ -689,8 +1031,6 @@ static void ieee80211_direct_probe(struct ieee80211_sub_if_data *sdata)
689 1031
690 ifmgd->state = IEEE80211_STA_MLME_DIRECT_PROBE; 1032 ifmgd->state = IEEE80211_STA_MLME_DIRECT_PROBE;
691 1033
692 set_bit(IEEE80211_STA_REQ_DIRECT_PROBE, &ifmgd->request);
693
694 /* Direct probe is sent to broadcast address as some APs 1034 /* Direct probe is sent to broadcast address as some APs
695 * will not answer to direct packet in unassociated state. 1035 * will not answer to direct packet in unassociated state.
696 */ 1036 */
@@ -714,7 +1054,8 @@ static void ieee80211_authenticate(struct ieee80211_sub_if_data *sdata)
714 " timed out\n", 1054 " timed out\n",
715 sdata->dev->name, ifmgd->bssid); 1055 sdata->dev->name, ifmgd->bssid);
716 ifmgd->state = IEEE80211_STA_MLME_DISABLED; 1056 ifmgd->state = IEEE80211_STA_MLME_DISABLED;
717 ieee80211_sta_send_apinfo(sdata); 1057 ieee80211_recalc_idle(local);
1058 cfg80211_send_auth_timeout(sdata->dev, ifmgd->bssid);
718 ieee80211_rx_bss_remove(sdata, ifmgd->bssid, 1059 ieee80211_rx_bss_remove(sdata, ifmgd->bssid,
719 sdata->local->hw.conf.channel->center_freq, 1060 sdata->local->hw.conf.channel->center_freq,
720 ifmgd->ssid, ifmgd->ssid_len); 1061 ifmgd->ssid, ifmgd->ssid_len);
@@ -761,14 +1102,6 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
761 struct sta_info *sta; 1102 struct sta_info *sta;
762 u32 changed = 0, config_changed = 0; 1103 u32 changed = 0, config_changed = 0;
763 1104
764 rcu_read_lock();
765
766 sta = sta_info_get(local, ifmgd->bssid);
767 if (!sta) {
768 rcu_read_unlock();
769 return;
770 }
771
772 if (deauth) { 1105 if (deauth) {
773 ifmgd->direct_probe_tries = 0; 1106 ifmgd->direct_probe_tries = 0;
774 ifmgd->auth_tries = 0; 1107 ifmgd->auth_tries = 0;
@@ -779,7 +1112,11 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
779 netif_tx_stop_all_queues(sdata->dev); 1112 netif_tx_stop_all_queues(sdata->dev);
780 netif_carrier_off(sdata->dev); 1113 netif_carrier_off(sdata->dev);
781 1114
782 ieee80211_sta_tear_down_BA_sessions(sta); 1115 rcu_read_lock();
1116 sta = sta_info_get(local, ifmgd->bssid);
1117 if (sta)
1118 ieee80211_sta_tear_down_BA_sessions(sta);
1119 rcu_read_unlock();
783 1120
784 bss = ieee80211_rx_bss_get(local, ifmgd->bssid, 1121 bss = ieee80211_rx_bss_get(local, ifmgd->bssid,
785 conf->channel->center_freq, 1122 conf->channel->center_freq,
@@ -815,11 +1152,16 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
815 ifmgd->ssid, ifmgd->ssid_len); 1152 ifmgd->ssid, ifmgd->ssid_len);
816 } 1153 }
817 1154
818 rcu_read_unlock(); 1155 ieee80211_set_wmm_default(sdata);
1156
1157 ieee80211_recalc_idle(local);
819 1158
820 /* channel(_type) changes are handled by ieee80211_hw_config */ 1159 /* channel(_type) changes are handled by ieee80211_hw_config */
821 local->oper_channel_type = NL80211_CHAN_NO_HT; 1160 local->oper_channel_type = NL80211_CHAN_NO_HT;
822 1161
1162 /* on the next assoc, re-program HT parameters */
1163 sdata->ht_opmode_valid = false;
1164
823 local->power_constr_level = 0; 1165 local->power_constr_level = 0;
824 1166
825 del_timer_sync(&local->dynamic_ps_timer); 1167 del_timer_sync(&local->dynamic_ps_timer);
@@ -831,6 +1173,9 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
831 } 1173 }
832 1174
833 ieee80211_hw_config(local, config_changed); 1175 ieee80211_hw_config(local, config_changed);
1176
1177 /* And the BSSID changed -- not very interesting here */
1178 changed |= BSS_CHANGED_BSSID;
834 ieee80211_bss_info_change_notify(sdata, changed); 1179 ieee80211_bss_info_change_notify(sdata, changed);
835 1180
836 rcu_read_lock(); 1181 rcu_read_lock();
@@ -897,7 +1242,8 @@ static void ieee80211_associate(struct ieee80211_sub_if_data *sdata)
897 " timed out\n", 1242 " timed out\n",
898 sdata->dev->name, ifmgd->bssid); 1243 sdata->dev->name, ifmgd->bssid);
899 ifmgd->state = IEEE80211_STA_MLME_DISABLED; 1244 ifmgd->state = IEEE80211_STA_MLME_DISABLED;
900 ieee80211_sta_send_apinfo(sdata); 1245 ieee80211_recalc_idle(local);
1246 cfg80211_send_assoc_timeout(sdata->dev, ifmgd->bssid);
901 ieee80211_rx_bss_remove(sdata, ifmgd->bssid, 1247 ieee80211_rx_bss_remove(sdata, ifmgd->bssid,
902 sdata->local->hw.conf.channel->center_freq, 1248 sdata->local->hw.conf.channel->center_freq,
903 ifmgd->ssid, ifmgd->ssid_len); 1249 ifmgd->ssid, ifmgd->ssid_len);
@@ -917,6 +1263,7 @@ static void ieee80211_associate(struct ieee80211_sub_if_data *sdata)
917 printk(KERN_DEBUG "%s: mismatch in privacy configuration and " 1263 printk(KERN_DEBUG "%s: mismatch in privacy configuration and "
918 "mixed-cell disabled - abort association\n", sdata->dev->name); 1264 "mixed-cell disabled - abort association\n", sdata->dev->name);
919 ifmgd->state = IEEE80211_STA_MLME_DISABLED; 1265 ifmgd->state = IEEE80211_STA_MLME_DISABLED;
1266 ieee80211_recalc_idle(local);
920 return; 1267 return;
921 } 1268 }
922 1269
@@ -948,6 +1295,17 @@ void ieee80211_beacon_loss_work(struct work_struct *work)
948 u.mgd.beacon_loss_work); 1295 u.mgd.beacon_loss_work);
949 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; 1296 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
950 1297
1298 /*
1299 * The driver has already reported this event and we have
1300 * already sent a probe request. Maybe the AP died and the
1301 * driver keeps reporting until we disassociate... We have
1302 * to ignore that because otherwise we would continually
1303 * reset the timer and never check whether we received a
1304 * probe response!
1305 */
1306 if (ifmgd->flags & IEEE80211_STA_PROBEREQ_POLL)
1307 return;
1308
951#ifdef CONFIG_MAC80211_VERBOSE_DEBUG 1309#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
952 if (net_ratelimit()) { 1310 if (net_ratelimit()) {
953 printk(KERN_DEBUG "%s: driver reports beacon loss from AP %pM " 1311 printk(KERN_DEBUG "%s: driver reports beacon loss from AP %pM "
@@ -957,10 +1315,15 @@ void ieee80211_beacon_loss_work(struct work_struct *work)
957#endif 1315#endif
958 1316
959 ifmgd->flags |= IEEE80211_STA_PROBEREQ_POLL; 1317 ifmgd->flags |= IEEE80211_STA_PROBEREQ_POLL;
1318
1319 mutex_lock(&sdata->local->iflist_mtx);
1320 ieee80211_recalc_ps(sdata->local, -1);
1321 mutex_unlock(&sdata->local->iflist_mtx);
1322
960 ieee80211_send_probe_req(sdata, ifmgd->bssid, ifmgd->ssid, 1323 ieee80211_send_probe_req(sdata, ifmgd->bssid, ifmgd->ssid,
961 ifmgd->ssid_len, NULL, 0); 1324 ifmgd->ssid_len, NULL, 0);
962 1325
963 mod_timer(&ifmgd->timer, jiffies + IEEE80211_MONITORING_INTERVAL); 1326 mod_timer(&ifmgd->timer, jiffies + IEEE80211_PROBE_WAIT);
964} 1327}
965 1328
966void ieee80211_beacon_loss(struct ieee80211_vif *vif) 1329void ieee80211_beacon_loss(struct ieee80211_vif *vif)
@@ -977,6 +1340,7 @@ static void ieee80211_associated(struct ieee80211_sub_if_data *sdata)
977 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; 1340 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
978 struct ieee80211_local *local = sdata->local; 1341 struct ieee80211_local *local = sdata->local;
979 struct sta_info *sta; 1342 struct sta_info *sta;
1343 unsigned long last_rx;
980 bool disassoc = false; 1344 bool disassoc = false;
981 1345
982 /* TODO: start monitoring current AP signal quality and number of 1346 /* TODO: start monitoring current AP signal quality and number of
@@ -993,17 +1357,21 @@ static void ieee80211_associated(struct ieee80211_sub_if_data *sdata)
993 printk(KERN_DEBUG "%s: No STA entry for own AP %pM\n", 1357 printk(KERN_DEBUG "%s: No STA entry for own AP %pM\n",
994 sdata->dev->name, ifmgd->bssid); 1358 sdata->dev->name, ifmgd->bssid);
995 disassoc = true; 1359 disassoc = true;
996 goto unlock; 1360 rcu_read_unlock();
1361 goto out;
997 } 1362 }
998 1363
1364 last_rx = sta->last_rx;
1365 rcu_read_unlock();
1366
999 if ((ifmgd->flags & IEEE80211_STA_PROBEREQ_POLL) && 1367 if ((ifmgd->flags & IEEE80211_STA_PROBEREQ_POLL) &&
1000 time_after(jiffies, sta->last_rx + IEEE80211_MONITORING_INTERVAL)) { 1368 time_after(jiffies, last_rx + IEEE80211_PROBE_WAIT)) {
1001 printk(KERN_DEBUG "%s: no probe response from AP %pM " 1369 printk(KERN_DEBUG "%s: no probe response from AP %pM "
1002 "- disassociating\n", 1370 "- disassociating\n",
1003 sdata->dev->name, ifmgd->bssid); 1371 sdata->dev->name, ifmgd->bssid);
1004 disassoc = true; 1372 disassoc = true;
1005 ifmgd->flags &= ~IEEE80211_STA_PROBEREQ_POLL; 1373 ifmgd->flags &= ~IEEE80211_STA_PROBEREQ_POLL;
1006 goto unlock; 1374 goto out;
1007 } 1375 }
1008 1376
1009 /* 1377 /*
@@ -1022,27 +1390,31 @@ static void ieee80211_associated(struct ieee80211_sub_if_data *sdata)
1022 } 1390 }
1023#endif 1391#endif
1024 ifmgd->flags |= IEEE80211_STA_PROBEREQ_POLL; 1392 ifmgd->flags |= IEEE80211_STA_PROBEREQ_POLL;
1393 mutex_lock(&local->iflist_mtx);
1394 ieee80211_recalc_ps(local, -1);
1395 mutex_unlock(&local->iflist_mtx);
1025 ieee80211_send_probe_req(sdata, ifmgd->bssid, ifmgd->ssid, 1396 ieee80211_send_probe_req(sdata, ifmgd->bssid, ifmgd->ssid,
1026 ifmgd->ssid_len, NULL, 0); 1397 ifmgd->ssid_len, NULL, 0);
1027 goto unlock; 1398 mod_timer(&ifmgd->timer, jiffies + IEEE80211_PROBE_WAIT);
1028 1399 goto out;
1029 } 1400 }
1030 1401
1031 if (time_after(jiffies, sta->last_rx + IEEE80211_PROBE_IDLE_TIME)) { 1402 if (time_after(jiffies, last_rx + IEEE80211_PROBE_IDLE_TIME)) {
1032 ifmgd->flags |= IEEE80211_STA_PROBEREQ_POLL; 1403 ifmgd->flags |= IEEE80211_STA_PROBEREQ_POLL;
1404 mutex_lock(&local->iflist_mtx);
1405 ieee80211_recalc_ps(local, -1);
1406 mutex_unlock(&local->iflist_mtx);
1033 ieee80211_send_probe_req(sdata, ifmgd->bssid, ifmgd->ssid, 1407 ieee80211_send_probe_req(sdata, ifmgd->bssid, ifmgd->ssid,
1034 ifmgd->ssid_len, NULL, 0); 1408 ifmgd->ssid_len, NULL, 0);
1035 } 1409 }
1036 1410
1037 unlock: 1411 out:
1038 rcu_read_unlock(); 1412 if (!disassoc)
1039 1413 mod_timer(&ifmgd->timer,
1040 if (disassoc) 1414 jiffies + IEEE80211_MONITORING_INTERVAL);
1415 else
1041 ieee80211_set_disassoc(sdata, true, true, 1416 ieee80211_set_disassoc(sdata, true, true,
1042 WLAN_REASON_PREV_AUTH_NOT_VALID); 1417 WLAN_REASON_PREV_AUTH_NOT_VALID);
1043 else
1044 mod_timer(&ifmgd->timer, jiffies +
1045 IEEE80211_MONITORING_INTERVAL);
1046} 1418}
1047 1419
1048 1420
@@ -1055,6 +1427,7 @@ static void ieee80211_auth_completed(struct ieee80211_sub_if_data *sdata)
1055 if (ifmgd->flags & IEEE80211_STA_EXT_SME) { 1427 if (ifmgd->flags & IEEE80211_STA_EXT_SME) {
1056 /* Wait for SME to request association */ 1428 /* Wait for SME to request association */
1057 ifmgd->state = IEEE80211_STA_MLME_DISABLED; 1429 ifmgd->state = IEEE80211_STA_MLME_DISABLED;
1430 ieee80211_recalc_idle(sdata->local);
1058 } else 1431 } else
1059 ieee80211_associate(sdata); 1432 ieee80211_associate(sdata);
1060} 1433}
@@ -1187,7 +1560,7 @@ static void ieee80211_rx_mgmt_deauth(struct ieee80211_sub_if_data *sdata,
1187 1560
1188 ieee80211_set_disassoc(sdata, true, false, 0); 1561 ieee80211_set_disassoc(sdata, true, false, 0);
1189 ifmgd->flags &= ~IEEE80211_STA_AUTHENTICATED; 1562 ifmgd->flags &= ~IEEE80211_STA_AUTHENTICATED;
1190 cfg80211_send_rx_deauth(sdata->dev, (u8 *) mgmt, len); 1563 cfg80211_send_deauth(sdata->dev, (u8 *) mgmt, len);
1191} 1564}
1192 1565
1193 1566
@@ -1218,7 +1591,7 @@ static void ieee80211_rx_mgmt_disassoc(struct ieee80211_sub_if_data *sdata,
1218 } 1591 }
1219 1592
1220 ieee80211_set_disassoc(sdata, false, false, reason_code); 1593 ieee80211_set_disassoc(sdata, false, false, reason_code);
1221 cfg80211_send_rx_disassoc(sdata->dev, (u8 *) mgmt, len); 1594 cfg80211_send_disassoc(sdata->dev, (u8 *) mgmt, len);
1222} 1595}
1223 1596
1224 1597
@@ -1287,6 +1660,12 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
1287 * association next time. This works around some broken APs 1660 * association next time. This works around some broken APs
1288 * which do not correctly reject reassociation requests. */ 1661 * which do not correctly reject reassociation requests. */
1289 ifmgd->flags &= ~IEEE80211_STA_PREV_BSSID_SET; 1662 ifmgd->flags &= ~IEEE80211_STA_PREV_BSSID_SET;
1663 cfg80211_send_rx_assoc(sdata->dev, (u8 *) mgmt, len);
1664 if (ifmgd->flags & IEEE80211_STA_EXT_SME) {
1665 /* Wait for SME to decide what to do next */
1666 ifmgd->state = IEEE80211_STA_MLME_DISABLED;
1667 ieee80211_recalc_idle(local);
1668 }
1290 return; 1669 return;
1291 } 1670 }
1292 1671
@@ -1340,8 +1719,9 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
1340 * to between the sta_info_alloc() and sta_info_insert() above. 1719 * to between the sta_info_alloc() and sta_info_insert() above.
1341 */ 1720 */
1342 1721
1343 set_sta_flags(sta, WLAN_STA_AUTH | WLAN_STA_ASSOC | WLAN_STA_ASSOC_AP | 1722 set_sta_flags(sta, WLAN_STA_AUTH | WLAN_STA_ASSOC | WLAN_STA_ASSOC_AP);
1344 WLAN_STA_AUTHORIZED); 1723 if (!(ifmgd->flags & IEEE80211_STA_CONTROL_PORT))
1724 set_sta_flags(sta, WLAN_STA_AUTHORIZED);
1345 1725
1346 rates = 0; 1726 rates = 0;
1347 basic_rates = 0; 1727 basic_rates = 0;
@@ -1421,6 +1801,8 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
1421 if (elems.wmm_param) 1801 if (elems.wmm_param)
1422 ieee80211_sta_wmm_params(local, ifmgd, elems.wmm_param, 1802 ieee80211_sta_wmm_params(local, ifmgd, elems.wmm_param,
1423 elems.wmm_param_len); 1803 elems.wmm_param_len);
1804 else
1805 ieee80211_set_wmm_default(sdata);
1424 1806
1425 if (elems.ht_info_elem && elems.wmm_param && 1807 if (elems.ht_info_elem && elems.wmm_param &&
1426 (ifmgd->flags & IEEE80211_STA_WMM_ENABLED) && 1808 (ifmgd->flags & IEEE80211_STA_WMM_ENABLED) &&
@@ -1476,7 +1858,7 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
1476 (memcmp(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN) == 0)) { 1858 (memcmp(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN) == 0)) {
1477 struct ieee80211_channel_sw_ie *sw_elem = 1859 struct ieee80211_channel_sw_ie *sw_elem =
1478 (struct ieee80211_channel_sw_ie *)elems->ch_switch_elem; 1860 (struct ieee80211_channel_sw_ie *)elems->ch_switch_elem;
1479 ieee80211_process_chanswitch(sdata, sw_elem, bss); 1861 ieee80211_sta_process_chanswitch(sdata, sw_elem, bss);
1480 } 1862 }
1481 1863
1482 ieee80211_rx_bss_put(local, bss); 1864 ieee80211_rx_bss_put(local, bss);
@@ -1507,57 +1889,98 @@ static void ieee80211_rx_mgmt_probe_resp(struct ieee80211_sub_if_data *sdata,
1507 ieee80211_rx_bss_info(sdata, mgmt, len, rx_status, &elems, false); 1889 ieee80211_rx_bss_info(sdata, mgmt, len, rx_status, &elems, false);
1508 1890
1509 /* direct probe may be part of the association flow */ 1891 /* direct probe may be part of the association flow */
1510 if (test_and_clear_bit(IEEE80211_STA_REQ_DIRECT_PROBE, 1892 if (ifmgd->state == IEEE80211_STA_MLME_DIRECT_PROBE) {
1511 &ifmgd->request)) {
1512 printk(KERN_DEBUG "%s direct probe responded\n", 1893 printk(KERN_DEBUG "%s direct probe responded\n",
1513 sdata->dev->name); 1894 sdata->dev->name);
1514 ieee80211_authenticate(sdata); 1895 ieee80211_authenticate(sdata);
1515 } 1896 }
1516 1897
1517 if (ifmgd->flags & IEEE80211_STA_PROBEREQ_POLL) 1898 if (ifmgd->flags & IEEE80211_STA_PROBEREQ_POLL) {
1518 ifmgd->flags &= ~IEEE80211_STA_PROBEREQ_POLL; 1899 ifmgd->flags &= ~IEEE80211_STA_PROBEREQ_POLL;
1900 mutex_lock(&sdata->local->iflist_mtx);
1901 ieee80211_recalc_ps(sdata->local, -1);
1902 mutex_unlock(&sdata->local->iflist_mtx);
1903 }
1519} 1904}
1520 1905
1906/*
1907 * This is the canonical list of information elements we care about,
1908 * the filter code also gives us all changes to the Microsoft OUI
1909 * (00:50:F2) vendor IE which is used for WMM which we need to track.
1910 *
1911 * We implement beacon filtering in software since that means we can
1912 * avoid processing the frame here and in cfg80211, and userspace
1913 * will not be able to tell whether the hardware supports it or not.
1914 *
1915 * XXX: This list needs to be dynamic -- userspace needs to be able to
1916 * add items it requires. It also needs to be able to tell us to
1917 * look out for other vendor IEs.
1918 */
1919static const u64 care_about_ies =
1920 (1ULL << WLAN_EID_COUNTRY) |
1921 (1ULL << WLAN_EID_ERP_INFO) |
1922 (1ULL << WLAN_EID_CHANNEL_SWITCH) |
1923 (1ULL << WLAN_EID_PWR_CONSTRAINT) |
1924 (1ULL << WLAN_EID_HT_CAPABILITY) |
1925 (1ULL << WLAN_EID_HT_INFORMATION);
1926
1521static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata, 1927static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
1522 struct ieee80211_mgmt *mgmt, 1928 struct ieee80211_mgmt *mgmt,
1523 size_t len, 1929 size_t len,
1524 struct ieee80211_rx_status *rx_status) 1930 struct ieee80211_rx_status *rx_status)
1525{ 1931{
1526 struct ieee80211_if_managed *ifmgd; 1932 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
1527 size_t baselen; 1933 size_t baselen;
1528 struct ieee802_11_elems elems; 1934 struct ieee802_11_elems elems;
1529 struct ieee80211_local *local = sdata->local; 1935 struct ieee80211_local *local = sdata->local;
1530 u32 changed = 0; 1936 u32 changed = 0;
1531 bool erp_valid, directed_tim; 1937 bool erp_valid, directed_tim = false;
1532 u8 erp_value = 0; 1938 u8 erp_value = 0;
1939 u32 ncrc;
1533 1940
1534 /* Process beacon from the current BSS */ 1941 /* Process beacon from the current BSS */
1535 baselen = (u8 *) mgmt->u.beacon.variable - (u8 *) mgmt; 1942 baselen = (u8 *) mgmt->u.beacon.variable - (u8 *) mgmt;
1536 if (baselen > len) 1943 if (baselen > len)
1537 return; 1944 return;
1538 1945
1539 ieee802_11_parse_elems(mgmt->u.beacon.variable, len - baselen, &elems); 1946 if (rx_status->freq != local->hw.conf.channel->center_freq)
1540
1541 ieee80211_rx_bss_info(sdata, mgmt, len, rx_status, &elems, true);
1542
1543 if (sdata->vif.type != NL80211_IFTYPE_STATION)
1544 return; 1947 return;
1545 1948
1546 ifmgd = &sdata->u.mgd;
1547
1548 if (!(ifmgd->flags & IEEE80211_STA_ASSOCIATED) || 1949 if (!(ifmgd->flags & IEEE80211_STA_ASSOCIATED) ||
1549 memcmp(ifmgd->bssid, mgmt->bssid, ETH_ALEN) != 0) 1950 memcmp(ifmgd->bssid, mgmt->bssid, ETH_ALEN) != 0)
1550 return; 1951 return;
1551 1952
1552 if (rx_status->freq != local->hw.conf.channel->center_freq) 1953 if (ifmgd->flags & IEEE80211_STA_PROBEREQ_POLL) {
1553 return; 1954#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
1955 if (net_ratelimit()) {
1956 printk(KERN_DEBUG "%s: cancelling probereq poll due "
1957 "to a received beacon\n", sdata->dev->name);
1958 }
1959#endif
1960 ifmgd->flags &= ~IEEE80211_STA_PROBEREQ_POLL;
1961 mutex_lock(&local->iflist_mtx);
1962 ieee80211_recalc_ps(local, -1);
1963 mutex_unlock(&local->iflist_mtx);
1964 }
1554 1965
1555 ieee80211_sta_wmm_params(local, ifmgd, elems.wmm_param, 1966 ncrc = crc32_be(0, (void *)&mgmt->u.beacon.beacon_int, 4);
1556 elems.wmm_param_len); 1967 ncrc = ieee802_11_parse_elems_crc(mgmt->u.beacon.variable,
1968 len - baselen, &elems,
1969 care_about_ies, ncrc);
1557 1970
1558 if (local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK) { 1971 if (local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK)
1559 directed_tim = ieee80211_check_tim(&elems, ifmgd->aid); 1972 directed_tim = ieee80211_check_tim(elems.tim, elems.tim_len,
1973 ifmgd->aid);
1560 1974
1975 if (ncrc != ifmgd->beacon_crc) {
1976 ieee80211_rx_bss_info(sdata, mgmt, len, rx_status, &elems,
1977 true);
1978
1979 ieee80211_sta_wmm_params(local, ifmgd, elems.wmm_param,
1980 elems.wmm_param_len);
1981 }
1982
1983 if (local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK) {
1561 if (directed_tim) { 1984 if (directed_tim) {
1562 if (local->hw.conf.dynamic_ps_timeout > 0) { 1985 if (local->hw.conf.dynamic_ps_timeout > 0) {
1563 local->hw.conf.flags &= ~IEEE80211_CONF_PS; 1986 local->hw.conf.flags &= ~IEEE80211_CONF_PS;
@@ -1580,6 +2003,10 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
1580 } 2003 }
1581 } 2004 }
1582 2005
2006 if (ncrc == ifmgd->beacon_crc)
2007 return;
2008 ifmgd->beacon_crc = ncrc;
2009
1583 if (elems.erp_info && elems.erp_info_len >= 1) { 2010 if (elems.erp_info && elems.erp_info_len >= 1) {
1584 erp_valid = true; 2011 erp_valid = true;
1585 erp_value = elems.erp_info[0]; 2012 erp_value = elems.erp_info[0];
@@ -1714,6 +2141,11 @@ static void ieee80211_sta_timer(unsigned long data)
1714 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; 2141 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
1715 struct ieee80211_local *local = sdata->local; 2142 struct ieee80211_local *local = sdata->local;
1716 2143
2144 if (local->quiescing) {
2145 set_bit(TMR_RUNNING_TIMER, &ifmgd->timers_running);
2146 return;
2147 }
2148
1717 set_bit(IEEE80211_STA_REQ_RUN, &ifmgd->request); 2149 set_bit(IEEE80211_STA_REQ_RUN, &ifmgd->request);
1718 queue_work(local->hw.workqueue, &ifmgd->work); 2150 queue_work(local->hw.workqueue, &ifmgd->work);
1719} 2151}
@@ -1723,10 +2155,8 @@ static void ieee80211_sta_reset_auth(struct ieee80211_sub_if_data *sdata)
1723 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; 2155 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
1724 struct ieee80211_local *local = sdata->local; 2156 struct ieee80211_local *local = sdata->local;
1725 2157
1726 if (local->ops->reset_tsf) { 2158 /* Reset own TSF to allow time synchronization work. */
1727 /* Reset own TSF to allow time synchronization work. */ 2159 drv_reset_tsf(local);
1728 local->ops->reset_tsf(local_to_hw(local));
1729 }
1730 2160
1731 ifmgd->wmm_last_param_set = -1; /* allow any WMM update */ 2161 ifmgd->wmm_last_param_set = -1; /* allow any WMM update */
1732 2162
@@ -1787,7 +2217,10 @@ static int ieee80211_sta_config_auth(struct ieee80211_sub_if_data *sdata)
1787 capa_mask, capa_val); 2217 capa_mask, capa_val);
1788 2218
1789 if (bss) { 2219 if (bss) {
1790 ieee80211_set_freq(sdata, bss->cbss.channel->center_freq); 2220 local->oper_channel = bss->cbss.channel;
2221 local->oper_channel_type = NL80211_CHAN_NO_HT;
2222 ieee80211_hw_config(local, 0);
2223
1791 if (!(ifmgd->flags & IEEE80211_STA_SSID_SET)) 2224 if (!(ifmgd->flags & IEEE80211_STA_SSID_SET))
1792 ieee80211_sta_set_ssid(sdata, bss->ssid, 2225 ieee80211_sta_set_ssid(sdata, bss->ssid,
1793 bss->ssid_len); 2226 bss->ssid_len);
@@ -1814,25 +2247,18 @@ static int ieee80211_sta_config_auth(struct ieee80211_sub_if_data *sdata)
1814 return 0; 2247 return 0;
1815 } else { 2248 } else {
1816 if (ifmgd->assoc_scan_tries < IEEE80211_ASSOC_SCANS_MAX_TRIES) { 2249 if (ifmgd->assoc_scan_tries < IEEE80211_ASSOC_SCANS_MAX_TRIES) {
2250
1817 ifmgd->assoc_scan_tries++; 2251 ifmgd->assoc_scan_tries++;
1818 /* XXX maybe racy? */
1819 if (local->scan_req)
1820 return -1;
1821 memcpy(local->int_scan_req.ssids[0].ssid,
1822 ifmgd->ssid, IEEE80211_MAX_SSID_LEN);
1823 if (ifmgd->flags & IEEE80211_STA_AUTO_SSID_SEL)
1824 local->int_scan_req.ssids[0].ssid_len = 0;
1825 else
1826 local->int_scan_req.ssids[0].ssid_len = ifmgd->ssid_len;
1827 2252
1828 if (ieee80211_start_scan(sdata, &local->int_scan_req)) 2253 ieee80211_request_internal_scan(sdata, ifmgd->ssid,
1829 ieee80211_scan_failed(local); 2254 ssid_len);
1830 2255
1831 ifmgd->state = IEEE80211_STA_MLME_AUTHENTICATE; 2256 ifmgd->state = IEEE80211_STA_MLME_AUTHENTICATE;
1832 set_bit(IEEE80211_STA_REQ_AUTH, &ifmgd->request); 2257 set_bit(IEEE80211_STA_REQ_AUTH, &ifmgd->request);
1833 } else { 2258 } else {
1834 ifmgd->assoc_scan_tries = 0; 2259 ifmgd->assoc_scan_tries = 0;
1835 ifmgd->state = IEEE80211_STA_MLME_DISABLED; 2260 ifmgd->state = IEEE80211_STA_MLME_DISABLED;
2261 ieee80211_recalc_idle(local);
1836 } 2262 }
1837 } 2263 }
1838 return -1; 2264 return -1;
@@ -1855,6 +2281,17 @@ static void ieee80211_sta_work(struct work_struct *work)
1855 2281
1856 if (WARN_ON(sdata->vif.type != NL80211_IFTYPE_STATION)) 2282 if (WARN_ON(sdata->vif.type != NL80211_IFTYPE_STATION))
1857 return; 2283 return;
2284
2285 /*
2286 * Nothing should have been stuffed into the workqueue during
2287 * the suspend->resume cycle. If this WARN is seen then there
2288 * is a bug with either the driver suspend or something in
2289 * mac80211 stuffing into the workqueue which we haven't yet
2290 * cleared during mac80211's suspend cycle.
2291 */
2292 if (WARN_ON(local->suspended))
2293 return;
2294
1858 ifmgd = &sdata->u.mgd; 2295 ifmgd = &sdata->u.mgd;
1859 2296
1860 while ((skb = skb_dequeue(&ifmgd->skb_queue))) 2297 while ((skb = skb_dequeue(&ifmgd->skb_queue)))
@@ -1864,14 +2301,8 @@ static void ieee80211_sta_work(struct work_struct *work)
1864 ifmgd->state != IEEE80211_STA_MLME_AUTHENTICATE && 2301 ifmgd->state != IEEE80211_STA_MLME_AUTHENTICATE &&
1865 ifmgd->state != IEEE80211_STA_MLME_ASSOCIATE && 2302 ifmgd->state != IEEE80211_STA_MLME_ASSOCIATE &&
1866 test_and_clear_bit(IEEE80211_STA_REQ_SCAN, &ifmgd->request)) { 2303 test_and_clear_bit(IEEE80211_STA_REQ_SCAN, &ifmgd->request)) {
1867 /* 2304 queue_delayed_work(local->hw.workqueue, &local->scan_work,
1868 * The call to ieee80211_start_scan can fail but ieee80211_request_scan 2305 round_jiffies_relative(0));
1869 * (which queued ieee80211_sta_work) did not return an error. Thus, call
1870 * ieee80211_scan_failed here if ieee80211_start_scan fails in order to
1871 * notify the scan requester.
1872 */
1873 if (ieee80211_start_scan(sdata, local->scan_req))
1874 ieee80211_scan_failed(local);
1875 return; 2306 return;
1876 } 2307 }
1877 2308
@@ -1882,6 +2313,8 @@ static void ieee80211_sta_work(struct work_struct *work)
1882 } else if (!test_and_clear_bit(IEEE80211_STA_REQ_RUN, &ifmgd->request)) 2313 } else if (!test_and_clear_bit(IEEE80211_STA_REQ_RUN, &ifmgd->request))
1883 return; 2314 return;
1884 2315
2316 ieee80211_recalc_idle(local);
2317
1885 switch (ifmgd->state) { 2318 switch (ifmgd->state) {
1886 case IEEE80211_STA_MLME_DISABLED: 2319 case IEEE80211_STA_MLME_DISABLED:
1887 break; 2320 break;
@@ -1926,10 +2359,43 @@ static void ieee80211_restart_sta_timer(struct ieee80211_sub_if_data *sdata)
1926 } 2359 }
1927} 2360}
1928 2361
2362#ifdef CONFIG_PM
2363void ieee80211_sta_quiesce(struct ieee80211_sub_if_data *sdata)
2364{
2365 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
2366
2367 /*
2368 * we need to use atomic bitops for the running bits
2369 * only because both timers might fire at the same
2370 * time -- the code here is properly synchronised.
2371 */
2372
2373 cancel_work_sync(&ifmgd->work);
2374 cancel_work_sync(&ifmgd->beacon_loss_work);
2375 if (del_timer_sync(&ifmgd->timer))
2376 set_bit(TMR_RUNNING_TIMER, &ifmgd->timers_running);
2377
2378 cancel_work_sync(&ifmgd->chswitch_work);
2379 if (del_timer_sync(&ifmgd->chswitch_timer))
2380 set_bit(TMR_RUNNING_CHANSW, &ifmgd->timers_running);
2381}
2382
2383void ieee80211_sta_restart(struct ieee80211_sub_if_data *sdata)
2384{
2385 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
2386
2387 if (test_and_clear_bit(TMR_RUNNING_TIMER, &ifmgd->timers_running))
2388 add_timer(&ifmgd->timer);
2389 if (test_and_clear_bit(TMR_RUNNING_CHANSW, &ifmgd->timers_running))
2390 add_timer(&ifmgd->chswitch_timer);
2391}
2392#endif
2393
1929/* interface setup */ 2394/* interface setup */
1930void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata) 2395void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata)
1931{ 2396{
1932 struct ieee80211_if_managed *ifmgd; 2397 struct ieee80211_if_managed *ifmgd;
2398 u32 hw_flags;
1933 2399
1934 ifmgd = &sdata->u.mgd; 2400 ifmgd = &sdata->u.mgd;
1935 INIT_WORK(&ifmgd->work, ieee80211_sta_work); 2401 INIT_WORK(&ifmgd->work, ieee80211_sta_work);
@@ -1949,6 +2415,13 @@ void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata)
1949 IEEE80211_STA_AUTO_CHANNEL_SEL; 2415 IEEE80211_STA_AUTO_CHANNEL_SEL;
1950 if (sdata->local->hw.queues >= 4) 2416 if (sdata->local->hw.queues >= 4)
1951 ifmgd->flags |= IEEE80211_STA_WMM_ENABLED; 2417 ifmgd->flags |= IEEE80211_STA_WMM_ENABLED;
2418
2419 hw_flags = sdata->local->hw.flags;
2420
2421 if (hw_flags & IEEE80211_HW_SUPPORTS_PS) {
2422 ifmgd->powersave = CONFIG_MAC80211_DEFAULT_PS_VALUE;
2423 sdata->local->hw.conf.dynamic_ps_timeout = 500;
2424 }
1952} 2425}
1953 2426
1954/* configuration hooks */ 2427/* configuration hooks */
@@ -1969,6 +2442,14 @@ void ieee80211_sta_req_auth(struct ieee80211_sub_if_data *sdata)
1969 ieee80211_set_disassoc(sdata, true, true, 2442 ieee80211_set_disassoc(sdata, true, true,
1970 WLAN_REASON_DEAUTH_LEAVING); 2443 WLAN_REASON_DEAUTH_LEAVING);
1971 2444
2445 if (ifmgd->ssid_len == 0) {
2446 /*
2447 * Only allow association to be started if a valid SSID
2448 * is configured.
2449 */
2450 return;
2451 }
2452
1972 if (!(ifmgd->flags & IEEE80211_STA_EXT_SME) || 2453 if (!(ifmgd->flags & IEEE80211_STA_EXT_SME) ||
1973 ifmgd->state != IEEE80211_STA_MLME_ASSOCIATE) 2454 ifmgd->state != IEEE80211_STA_MLME_ASSOCIATE)
1974 set_bit(IEEE80211_STA_REQ_AUTH, &ifmgd->request); 2455 set_bit(IEEE80211_STA_REQ_AUTH, &ifmgd->request);
@@ -2000,6 +2481,10 @@ int ieee80211_sta_set_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size
2000 ifmgd = &sdata->u.mgd; 2481 ifmgd = &sdata->u.mgd;
2001 2482
2002 if (ifmgd->ssid_len != len || memcmp(ifmgd->ssid, ssid, len) != 0) { 2483 if (ifmgd->ssid_len != len || memcmp(ifmgd->ssid, ssid, len) != 0) {
2484 if (ifmgd->state == IEEE80211_STA_MLME_ASSOCIATED)
2485 ieee80211_set_disassoc(sdata, true, true,
2486 WLAN_REASON_DEAUTH_LEAVING);
2487
2003 /* 2488 /*
2004 * Do not use reassociation if SSID is changed (different ESS). 2489 * Do not use reassociation if SSID is changed (different ESS).
2005 */ 2490 */
@@ -2024,6 +2509,11 @@ int ieee80211_sta_set_bssid(struct ieee80211_sub_if_data *sdata, u8 *bssid)
2024{ 2509{
2025 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; 2510 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
2026 2511
2512 if (compare_ether_addr(bssid, ifmgd->bssid) != 0 &&
2513 ifmgd->state == IEEE80211_STA_MLME_ASSOCIATED)
2514 ieee80211_set_disassoc(sdata, true, true,
2515 WLAN_REASON_DEAUTH_LEAVING);
2516
2027 if (is_valid_ether_addr(bssid)) { 2517 if (is_valid_ether_addr(bssid)) {
2028 memcpy(ifmgd->bssid, bssid, ETH_ALEN); 2518 memcpy(ifmgd->bssid, bssid, ETH_ALEN);
2029 ifmgd->flags |= IEEE80211_STA_BSSID_SET; 2519 ifmgd->flags |= IEEE80211_STA_BSSID_SET;
@@ -2032,13 +2522,6 @@ int ieee80211_sta_set_bssid(struct ieee80211_sub_if_data *sdata, u8 *bssid)
2032 ifmgd->flags &= ~IEEE80211_STA_BSSID_SET; 2522 ifmgd->flags &= ~IEEE80211_STA_BSSID_SET;
2033 } 2523 }
2034 2524
2035 if (netif_running(sdata->dev)) {
2036 if (ieee80211_if_config(sdata, IEEE80211_IFCC_BSSID)) {
2037 printk(KERN_DEBUG "%s: Failed to config new BSSID to "
2038 "the low-level driver\n", sdata->dev->name);
2039 }
2040 }
2041
2042 return ieee80211_sta_commit(sdata); 2525 return ieee80211_sta_commit(sdata);
2043} 2526}
2044 2527
@@ -2047,6 +2530,13 @@ int ieee80211_sta_set_extra_ie(struct ieee80211_sub_if_data *sdata,
2047{ 2530{
2048 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; 2531 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
2049 2532
2533 if (len == 0 && ifmgd->extra_ie_len == 0)
2534 return -EALREADY;
2535
2536 if (len == ifmgd->extra_ie_len && ifmgd->extra_ie &&
2537 memcmp(ifmgd->extra_ie, ie, len) == 0)
2538 return -EALREADY;
2539
2050 kfree(ifmgd->extra_ie); 2540 kfree(ifmgd->extra_ie);
2051 if (len == 0) { 2541 if (len == 0) {
2052 ifmgd->extra_ie = NULL; 2542 ifmgd->extra_ie = NULL;
@@ -2068,9 +2558,6 @@ int ieee80211_sta_deauthenticate(struct ieee80211_sub_if_data *sdata, u16 reason
2068 printk(KERN_DEBUG "%s: deauthenticating by local choice (reason=%d)\n", 2558 printk(KERN_DEBUG "%s: deauthenticating by local choice (reason=%d)\n",
2069 sdata->dev->name, reason); 2559 sdata->dev->name, reason);
2070 2560
2071 if (sdata->vif.type != NL80211_IFTYPE_STATION)
2072 return -EINVAL;
2073
2074 ieee80211_set_disassoc(sdata, true, true, reason); 2561 ieee80211_set_disassoc(sdata, true, true, reason);
2075 return 0; 2562 return 0;
2076} 2563}
@@ -2082,9 +2569,6 @@ int ieee80211_sta_disassociate(struct ieee80211_sub_if_data *sdata, u16 reason)
2082 printk(KERN_DEBUG "%s: disassociating by local choice (reason=%d)\n", 2569 printk(KERN_DEBUG "%s: disassociating by local choice (reason=%d)\n",
2083 sdata->dev->name, reason); 2570 sdata->dev->name, reason);
2084 2571
2085 if (sdata->vif.type != NL80211_IFTYPE_STATION)
2086 return -EINVAL;
2087
2088 if (!(ifmgd->flags & IEEE80211_STA_ASSOCIATED)) 2572 if (!(ifmgd->flags & IEEE80211_STA_ASSOCIATED))
2089 return -ENOLINK; 2573 return -ENOLINK;
2090 2574
@@ -2104,75 +2588,17 @@ void ieee80211_mlme_notify_scan_completed(struct ieee80211_local *local)
2104 rcu_read_unlock(); 2588 rcu_read_unlock();
2105} 2589}
2106 2590
2107void ieee80211_dynamic_ps_disable_work(struct work_struct *work) 2591int ieee80211_max_network_latency(struct notifier_block *nb,
2108{ 2592 unsigned long data, void *dummy)
2109 struct ieee80211_local *local =
2110 container_of(work, struct ieee80211_local,
2111 dynamic_ps_disable_work);
2112
2113 if (local->hw.conf.flags & IEEE80211_CONF_PS) {
2114 local->hw.conf.flags &= ~IEEE80211_CONF_PS;
2115 ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS);
2116 }
2117
2118 ieee80211_wake_queues_by_reason(&local->hw,
2119 IEEE80211_QUEUE_STOP_REASON_PS);
2120}
2121
2122void ieee80211_dynamic_ps_enable_work(struct work_struct *work)
2123{ 2593{
2594 s32 latency_usec = (s32) data;
2124 struct ieee80211_local *local = 2595 struct ieee80211_local *local =
2125 container_of(work, struct ieee80211_local, 2596 container_of(nb, struct ieee80211_local,
2126 dynamic_ps_enable_work); 2597 network_latency_notifier);
2127 /* XXX: using scan_sdata is completely broken! */
2128 struct ieee80211_sub_if_data *sdata = local->scan_sdata;
2129
2130 if (local->hw.conf.flags & IEEE80211_CONF_PS)
2131 return;
2132
2133 if (local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK && sdata)
2134 ieee80211_send_nullfunc(local, sdata, 1);
2135 2598
2136 local->hw.conf.flags |= IEEE80211_CONF_PS; 2599 mutex_lock(&local->iflist_mtx);
2137 ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS); 2600 ieee80211_recalc_ps(local, latency_usec);
2138} 2601 mutex_unlock(&local->iflist_mtx);
2139
2140void ieee80211_dynamic_ps_timer(unsigned long data)
2141{
2142 struct ieee80211_local *local = (void *) data;
2143
2144 queue_work(local->hw.workqueue, &local->dynamic_ps_enable_work);
2145}
2146
2147void ieee80211_send_nullfunc(struct ieee80211_local *local,
2148 struct ieee80211_sub_if_data *sdata,
2149 int powersave)
2150{
2151 struct sk_buff *skb;
2152 struct ieee80211_hdr *nullfunc;
2153 __le16 fc;
2154 2602
2155 if (WARN_ON(sdata->vif.type != NL80211_IFTYPE_STATION)) 2603 return 0;
2156 return;
2157
2158 skb = dev_alloc_skb(local->hw.extra_tx_headroom + 24);
2159 if (!skb) {
2160 printk(KERN_DEBUG "%s: failed to allocate buffer for nullfunc "
2161 "frame\n", sdata->dev->name);
2162 return;
2163 }
2164 skb_reserve(skb, local->hw.extra_tx_headroom);
2165
2166 nullfunc = (struct ieee80211_hdr *) skb_put(skb, 24);
2167 memset(nullfunc, 0, 24);
2168 fc = cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_NULLFUNC |
2169 IEEE80211_FCTL_TODS);
2170 if (powersave)
2171 fc |= cpu_to_le16(IEEE80211_FCTL_PM);
2172 nullfunc->frame_control = fc;
2173 memcpy(nullfunc->addr1, sdata->u.mgd.bssid, ETH_ALEN);
2174 memcpy(nullfunc->addr2, sdata->dev->dev_addr, ETH_ALEN);
2175 memcpy(nullfunc->addr3, sdata->u.mgd.bssid, ETH_ALEN);
2176
2177 ieee80211_tx_skb(sdata, skb, 0);
2178} 2604}