• Home
  • Raw
  • Download

Lines Matching +full:mu +full:- +full:side +full:- +full:b

3  * Copyright 2003-2008, Jouni Malinen <j@w1.fi>
6 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
8 * Copyright 2013-2014 Intel Mobile Communications GmbH
9 * Copyright (C) 2015 - 2017 Intel Deutschland GmbH
31 #include "driver-ops.h"
99 * has happened -- the work that runs from this timer will
107 if (!timer_pending(&sdata->u.mgd.timer) || in run_again()
108 time_before(timeout, sdata->u.mgd.timer.expires)) in run_again()
109 mod_timer(&sdata->u.mgd.timer, timeout); in run_again()
114 if (sdata->vif.driver_flags & IEEE80211_VIF_BEACON_FILTER) in ieee80211_sta_reset_beacon_monitor()
117 if (ieee80211_hw_check(&sdata->local->hw, CONNECTION_MONITOR)) in ieee80211_sta_reset_beacon_monitor()
120 mod_timer(&sdata->u.mgd.bcn_mon_timer, in ieee80211_sta_reset_beacon_monitor()
121 round_jiffies_up(jiffies + sdata->u.mgd.beacon_timeout)); in ieee80211_sta_reset_beacon_monitor()
126 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_sta_reset_conn_monitor()
128 if (unlikely(!ifmgd->associated)) in ieee80211_sta_reset_conn_monitor()
131 if (ifmgd->probe_send_count) in ieee80211_sta_reset_conn_monitor()
132 ifmgd->probe_send_count = 0; in ieee80211_sta_reset_conn_monitor()
134 if (ieee80211_hw_check(&sdata->local->hw, CONNECTION_MONITOR)) in ieee80211_sta_reset_conn_monitor()
137 mod_timer(&ifmgd->conn_mon_timer, in ieee80211_sta_reset_conn_monitor()
143 return (1 << ecw) - 1; in ecw2cw()
155 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_determine_chantype()
160 memcpy(&sta_ht_cap, &sband->ht_cap, sizeof(sta_ht_cap)); in ieee80211_determine_chantype()
163 chandef->chan = channel; in ieee80211_determine_chantype()
164 chandef->width = NL80211_CHAN_WIDTH_20_NOHT; in ieee80211_determine_chantype()
165 chandef->center_freq1 = channel->center_freq; in ieee80211_determine_chantype()
166 chandef->center_freq2 = 0; in ieee80211_determine_chantype()
173 chandef->width = NL80211_CHAN_WIDTH_20; in ieee80211_determine_chantype()
175 ht_cfreq = ieee80211_channel_to_frequency(ht_oper->primary_chan, in ieee80211_determine_chantype()
176 channel->band); in ieee80211_determine_chantype()
178 if (!tracking && channel->center_freq != ht_cfreq) { in ieee80211_determine_chantype()
187 …"Wrong control channel: center-freq: %d ht-cfreq: %d ht->primary_chan: %d band: %d - Disabling HT\… in ieee80211_determine_chantype()
188 channel->center_freq, ht_cfreq, in ieee80211_determine_chantype()
189 ht_oper->primary_chan, channel->band); in ieee80211_determine_chantype()
205 if (!vht_oper || !sband->vht_cap.vht_supported) { in ieee80211_determine_chantype()
211 if (!(ifmgd->flags & IEEE80211_STA_DISABLE_HE) && he_oper && in ieee80211_determine_chantype()
212 (le32_to_cpu(he_oper->he_oper_params) & in ieee80211_determine_chantype()
220 memcpy(&he_oper_vht_cap, he_oper->optional, 3); in ieee80211_determine_chantype()
225 if (!(ifmgd->flags & IEEE80211_STA_DISABLE_HE)) in ieee80211_determine_chantype()
232 if (!(ifmgd->flags & IEEE80211_STA_DISABLE_VHT)) in ieee80211_determine_chantype()
240 if (!(ifmgd->flags & IEEE80211_STA_DISABLE_VHT)) in ieee80211_determine_chantype()
253 if (!(ifmgd->flags & IEEE80211_STA_DISABLE_VHT)) in ieee80211_determine_chantype()
268 * connection. This keeps us from playing ping-pong with regulatory, in ieee80211_determine_chantype()
270 * - connect to an AP with 80 MHz, world regdom allows 80 MHz in ieee80211_determine_chantype()
271 * - AP advertises regdom US in ieee80211_determine_chantype()
272 * - CRDA loads regdom US with 80 MHz prohibited (old database) in ieee80211_determine_chantype()
273 * - the code below detects an unsupported channel, downgrades, and in ieee80211_determine_chantype()
275 * - disconnect causes CRDA to reload world regdomain and the game in ieee80211_determine_chantype()
284 cfg80211_chandef_identical(chandef, &sdata->vif.bss_conf.chandef)) in ieee80211_determine_chantype()
293 * tracking the APs beacon for bandwidth changes - otherwise we in ieee80211_determine_chantype()
299 while (!cfg80211_chandef_usable(sdata->local->hw.wiphy, chandef, in ieee80211_determine_chantype()
302 if (WARN_ON(chandef->width == NL80211_CHAN_WIDTH_20_NOHT)) { in ieee80211_determine_chantype()
311 if (chandef->width != vht_chandef.width && !tracking) in ieee80211_determine_chantype()
327 struct ieee80211_local *local = sdata->local; in ieee80211_config_bw()
328 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_config_bw()
329 struct ieee80211_channel *chan = sdata->vif.bss_conf.chandef.chan; in ieee80211_config_bw()
331 local->hw.wiphy->bands[chan->band]; in ieee80211_config_bw()
339 if (ifmgd->flags & IEEE80211_STA_DISABLE_HT || !ht_oper) in ieee80211_config_bw()
342 /* don't check VHT if we associated as non-VHT station */ in ieee80211_config_bw()
343 if (ifmgd->flags & IEEE80211_STA_DISABLE_VHT) in ieee80211_config_bw()
346 /* don't check HE if we associated as non-HE station */ in ieee80211_config_bw()
347 if (ifmgd->flags & IEEE80211_STA_DISABLE_HE || in ieee80211_config_bw()
352 return -EINVAL; in ieee80211_config_bw()
355 * if bss configuration changed store the new one - in ieee80211_config_bw()
358 ht_opmode = le16_to_cpu(ht_oper->operation_mode); in ieee80211_config_bw()
359 if (sdata->vif.bss_conf.ht_operation_mode != ht_opmode) { in ieee80211_config_bw()
361 sdata->vif.bss_conf.ht_operation_mode = ht_opmode; in ieee80211_config_bw()
374 * any good -- we couldn't use it with the AP. in ieee80211_config_bw()
376 if (ifmgd->flags & IEEE80211_STA_DISABLE_80P80MHZ && in ieee80211_config_bw()
379 if (ifmgd->flags & IEEE80211_STA_DISABLE_160MHZ && in ieee80211_config_bw()
382 if (ifmgd->flags & IEEE80211_STA_DISABLE_40MHZ && in ieee80211_config_bw()
386 if (cfg80211_chandef_identical(&chandef, &sdata->vif.bss_conf.chandef)) in ieee80211_config_bw()
391 ifmgd->bssid, chandef.chan->center_freq, chandef.width, in ieee80211_config_bw()
394 if (flags != (ifmgd->flags & (IEEE80211_STA_DISABLE_HT | in ieee80211_config_bw()
401 "AP %pM changed bandwidth in a way we can't support - disconnect\n", in ieee80211_config_bw()
402 ifmgd->bssid); in ieee80211_config_bw()
403 return -EINVAL; in ieee80211_config_bw()
422 return -EINVAL; in ieee80211_config_bw()
425 if (new_sta_bw > sta->cur_max_bandwidth) in ieee80211_config_bw()
426 new_sta_bw = sta->cur_max_bandwidth; in ieee80211_config_bw()
428 if (new_sta_bw < sta->sta.bandwidth) { in ieee80211_config_bw()
429 sta->sta.bandwidth = new_sta_bw; in ieee80211_config_bw()
437 "AP %pM changed bandwidth to incompatible one - disconnect\n", in ieee80211_config_bw()
438 ifmgd->bssid); in ieee80211_config_bw()
442 if (new_sta_bw > sta->sta.bandwidth) { in ieee80211_config_bw()
443 sta->sta.bandwidth = new_sta_bw; in ieee80211_config_bw()
460 u32 flags = channel->flags; in ieee80211_add_ht_ie()
464 BUILD_BUG_ON(sizeof(ht_cap) != sizeof(sband->ht_cap)); in ieee80211_add_ht_ie()
466 memcpy(&ht_cap, &sband->ht_cap, sizeof(ht_cap)); in ieee80211_add_ht_ie()
489 * capable of 40 MHz -- some broken APs will never fall in ieee80211_add_ht_ie()
492 if (sdata->u.mgd.flags & IEEE80211_STA_DISABLE_40MHZ) { in ieee80211_add_ht_ie()
525 * Note - the function may set the owner of the MU-MIMO capability
532 struct ieee80211_local *local = sdata->local; in ieee80211_add_vht_ie()
538 BUILD_BUG_ON(sizeof(vht_cap) != sizeof(sband->vht_cap)); in ieee80211_add_vht_ie()
540 memcpy(&vht_cap, &sband->vht_cap, sizeof(vht_cap)); in ieee80211_add_vht_ie()
546 if (sdata->u.mgd.flags & IEEE80211_STA_DISABLE_80P80MHZ) { in ieee80211_add_vht_ie()
555 if (sdata->u.mgd.flags & IEEE80211_STA_DISABLE_160MHZ) { in ieee80211_add_vht_ie()
564 if (!(ap_vht_cap->vht_cap_info & in ieee80211_add_vht_ie()
568 else if (!(ap_vht_cap->vht_cap_info & in ieee80211_add_vht_ie()
573 * If some other vif is using the MU-MIMO capablity we cannot associate in ieee80211_add_vht_ie()
574 * using MU-MIMO - this will lead to contradictions in the group-id in ieee80211_add_vht_ie()
577 * simultaneous associations with MU-MIMO. in ieee80211_add_vht_ie()
583 list_for_each_entry_rcu(other, &local->interfaces, list) { in ieee80211_add_vht_ie()
584 if (other->vif.mu_mimo_owner) { in ieee80211_add_vht_ie()
592 sdata->vif.mu_mimo_owner = true; in ieee80211_add_vht_ie()
597 ap_bf_sts = le32_to_cpu(ap_vht_cap->vht_cap_info) & mask; in ieee80211_add_vht_ie()
630 2 + 1 + sizeof(he_cap->he_cap_elem) + in ieee80211_add_he_ie()
631 ieee80211_he_mcs_nss_size(&he_cap->he_cap_elem) + in ieee80211_add_he_ie()
632 ieee80211_he_ppe_size(he_cap->ppe_thres[0], in ieee80211_add_he_ie()
633 he_cap->he_cap_elem.phy_cap_info); in ieee80211_add_he_ie()
640 struct ieee80211_local *local = sdata->local; in ieee80211_send_assoc()
641 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_send_assoc()
642 struct ieee80211_mgd_assoc_data *assoc_data = ifmgd->assoc_data; in ieee80211_send_assoc()
657 chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); in ieee80211_send_assoc()
662 chan = chanctx_conf->def.chan; in ieee80211_send_assoc()
664 sband = local->hw.wiphy->bands[chan->band]; in ieee80211_send_assoc()
665 shift = ieee80211_vif_get_shift(&sdata->vif); in ieee80211_send_assoc()
667 if (assoc_data->supp_rates_len) { in ieee80211_send_assoc()
671 * in the association request (e.g. D-Link DAP 1353 in in ieee80211_send_assoc()
672 * b-only mode)... in ieee80211_send_assoc()
674 rates_len = ieee80211_parse_bitrates(&chanctx_conf->def, sband, in ieee80211_send_assoc()
675 assoc_data->supp_rates, in ieee80211_send_assoc()
676 assoc_data->supp_rates_len, in ieee80211_send_assoc()
685 for (i = 0; i < sband->n_bitrates; i++) { in ieee80211_send_assoc()
691 skb = alloc_skb(local->hw.extra_tx_headroom + in ieee80211_send_assoc()
693 2 + assoc_data->ssid_len + /* SSID */ in ieee80211_send_assoc()
696 2 + 2 * sband->n_channels + /* supported channels */ in ieee80211_send_assoc()
702 assoc_data->ie_len + /* extra IEs */ in ieee80211_send_assoc()
703 (assoc_data->fils_kek_len ? 16 /* AES-SIV */ : 0) + in ieee80211_send_assoc()
709 skb_reserve(skb, local->hw.extra_tx_headroom); in ieee80211_send_assoc()
713 if (sband->band == NL80211_BAND_2GHZ) { in ieee80211_send_assoc()
718 if (assoc_data->capability & WLAN_CAPABILITY_PRIVACY) in ieee80211_send_assoc()
721 if ((assoc_data->capability & WLAN_CAPABILITY_SPECTRUM_MGMT) && in ieee80211_send_assoc()
722 ieee80211_hw_check(&local->hw, SPECTRUM_MGMT)) in ieee80211_send_assoc()
725 if (ifmgd->flags & IEEE80211_STA_ENABLE_RRM) in ieee80211_send_assoc()
729 memcpy(mgmt->da, assoc_data->bss->bssid, ETH_ALEN); in ieee80211_send_assoc()
730 memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); in ieee80211_send_assoc()
731 memcpy(mgmt->bssid, assoc_data->bss->bssid, ETH_ALEN); in ieee80211_send_assoc()
733 if (!is_zero_ether_addr(assoc_data->prev_bssid)) { in ieee80211_send_assoc()
735 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | in ieee80211_send_assoc()
737 mgmt->u.reassoc_req.capab_info = cpu_to_le16(capab); in ieee80211_send_assoc()
738 mgmt->u.reassoc_req.listen_interval = in ieee80211_send_assoc()
739 cpu_to_le16(local->hw.conf.listen_interval); in ieee80211_send_assoc()
740 memcpy(mgmt->u.reassoc_req.current_ap, assoc_data->prev_bssid, in ieee80211_send_assoc()
744 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | in ieee80211_send_assoc()
746 mgmt->u.assoc_req.capab_info = cpu_to_le16(capab); in ieee80211_send_assoc()
747 mgmt->u.assoc_req.listen_interval = in ieee80211_send_assoc()
748 cpu_to_le16(local->hw.conf.listen_interval); in ieee80211_send_assoc()
752 pos = skb_put(skb, 2 + assoc_data->ssid_len); in ieee80211_send_assoc()
754 *pos++ = assoc_data->ssid_len; in ieee80211_send_assoc()
755 memcpy(pos, assoc_data->ssid, assoc_data->ssid_len); in ieee80211_send_assoc()
767 for (i = 0; i < sband->n_bitrates; i++) { in ieee80211_send_assoc()
769 int rate = DIV_ROUND_UP(sband->bitrates[i].bitrate, in ieee80211_send_assoc()
778 pos = skb_put(skb, rates_len - count + 2); in ieee80211_send_assoc()
780 *pos++ = rates_len - count; in ieee80211_send_assoc()
782 for (i++; i < sband->n_bitrates; i++) { in ieee80211_send_assoc()
785 rate = DIV_ROUND_UP(sband->bitrates[i].bitrate, in ieee80211_send_assoc()
799 *pos++ = ieee80211_chandef_max_power(&chanctx_conf->def); in ieee80211_send_assoc()
804 pos = skb_put(skb, 2 * sband->n_channels + 2); in ieee80211_send_assoc()
806 *pos++ = 2 * sband->n_channels; in ieee80211_send_assoc()
807 for (i = 0; i < sband->n_channels; i++) { in ieee80211_send_assoc()
809 sband->channels[i].center_freq); in ieee80211_send_assoc()
815 if (assoc_data->ie_len) { in ieee80211_send_assoc()
839 /* 60 GHz (Multi-band, DMG, MMS) can't happen */ in ieee80211_send_assoc()
844 noffset = ieee80211_ie_split_ric(assoc_data->ie, in ieee80211_send_assoc()
845 assoc_data->ie_len, in ieee80211_send_assoc()
851 skb_put_data(skb, assoc_data->ie + offset, noffset - offset); in ieee80211_send_assoc()
855 if (WARN_ON_ONCE((ifmgd->flags & IEEE80211_STA_DISABLE_HT) && in ieee80211_send_assoc()
856 !(ifmgd->flags & IEEE80211_STA_DISABLE_VHT))) in ieee80211_send_assoc()
857 ifmgd->flags |= IEEE80211_STA_DISABLE_VHT; in ieee80211_send_assoc()
859 if (!(ifmgd->flags & IEEE80211_STA_DISABLE_HT)) in ieee80211_send_assoc()
860 ieee80211_add_ht_ie(sdata, skb, assoc_data->ap_ht_param, in ieee80211_send_assoc()
861 sband, chan, sdata->smps_mode); in ieee80211_send_assoc()
864 if (assoc_data->ie_len) { in ieee80211_send_assoc()
875 /* 60 GHz (Multi-band, DMG, MMS) can't happen */ in ieee80211_send_assoc()
879 noffset = ieee80211_ie_split(assoc_data->ie, assoc_data->ie_len, in ieee80211_send_assoc()
882 skb_put_data(skb, assoc_data->ie + offset, noffset - offset); in ieee80211_send_assoc()
887 if (assoc_data->ie_len) { in ieee80211_send_assoc()
905 noffset = ieee80211_ie_split(assoc_data->ie, assoc_data->ie_len, in ieee80211_send_assoc()
908 pos = skb_put(skb, noffset - offset); in ieee80211_send_assoc()
909 memcpy(pos, assoc_data->ie + offset, noffset - offset); in ieee80211_send_assoc()
913 if (!(ifmgd->flags & IEEE80211_STA_DISABLE_VHT)) in ieee80211_send_assoc()
915 &assoc_data->ap_vht_cap); in ieee80211_send_assoc()
917 if (!(ifmgd->flags & IEEE80211_STA_DISABLE_HE)) in ieee80211_send_assoc()
920 /* if present, add any custom non-vendor IEs that go after HE */ in ieee80211_send_assoc()
921 if (assoc_data->ie_len) { in ieee80211_send_assoc()
922 noffset = ieee80211_ie_split_vendor(assoc_data->ie, in ieee80211_send_assoc()
923 assoc_data->ie_len, in ieee80211_send_assoc()
925 skb_put_data(skb, assoc_data->ie + offset, noffset - offset); in ieee80211_send_assoc()
929 if (assoc_data->wmm) { in ieee80211_send_assoc()
930 if (assoc_data->uapsd) { in ieee80211_send_assoc()
931 qos_info = ifmgd->uapsd_queues; in ieee80211_send_assoc()
932 qos_info |= (ifmgd->uapsd_max_sp_len << in ieee80211_send_assoc()
942 if (assoc_data->ie_len) { in ieee80211_send_assoc()
943 noffset = assoc_data->ie_len; in ieee80211_send_assoc()
944 skb_put_data(skb, assoc_data->ie + offset, noffset - offset); in ieee80211_send_assoc()
947 if (assoc_data->fils_kek_len && in ieee80211_send_assoc()
955 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; in ieee80211_send_assoc()
956 if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) in ieee80211_send_assoc()
957 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS | in ieee80211_send_assoc()
968 skb = ieee80211_pspoll_get(&local->hw, &sdata->vif); in ieee80211_send_pspoll()
972 pspoll = (struct ieee80211_pspoll *) skb->data; in ieee80211_send_pspoll()
973 pspoll->frame_control |= cpu_to_le16(IEEE80211_FCTL_PM); in ieee80211_send_pspoll()
975 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; in ieee80211_send_pspoll()
985 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_send_nullfunc()
988 if (sdata->vif.type == NL80211_IFTYPE_STATION && in ieee80211_send_nullfunc()
989 !(ifmgd->flags & IEEE80211_STA_DISABLE_HE)) in ieee80211_send_nullfunc()
992 skb = ieee80211_nullfunc_get(&local->hw, &sdata->vif, in ieee80211_send_nullfunc()
993 !ieee80211_hw_check(&local->hw, DOESNT_SUPPORT_QOS_NDP)); in ieee80211_send_nullfunc()
997 nullfunc = (struct ieee80211_hdr_3addr *) skb->data; in ieee80211_send_nullfunc()
999 nullfunc->frame_control |= cpu_to_le16(IEEE80211_FCTL_PM); in ieee80211_send_nullfunc()
1001 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT | in ieee80211_send_nullfunc()
1004 if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) in ieee80211_send_nullfunc()
1005 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS; in ieee80211_send_nullfunc()
1007 if (ifmgd->flags & IEEE80211_STA_CONNECTION_POLL) in ieee80211_send_nullfunc()
1008 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_CTL_USE_MINRATE; in ieee80211_send_nullfunc()
1020 if (WARN_ON(sdata->vif.type != NL80211_IFTYPE_STATION)) in ieee80211_send_4addr_nullfunc()
1024 if (!(sdata->u.mgd.flags & IEEE80211_STA_DISABLE_HE)) in ieee80211_send_4addr_nullfunc()
1027 skb = dev_alloc_skb(local->hw.extra_tx_headroom + 30); in ieee80211_send_4addr_nullfunc()
1031 skb_reserve(skb, local->hw.extra_tx_headroom); in ieee80211_send_4addr_nullfunc()
1036 nullfunc->frame_control = fc; in ieee80211_send_4addr_nullfunc()
1037 memcpy(nullfunc->addr1, sdata->u.mgd.bssid, ETH_ALEN); in ieee80211_send_4addr_nullfunc()
1038 memcpy(nullfunc->addr2, sdata->vif.addr, ETH_ALEN); in ieee80211_send_4addr_nullfunc()
1039 memcpy(nullfunc->addr3, sdata->u.mgd.bssid, ETH_ALEN); in ieee80211_send_4addr_nullfunc()
1040 memcpy(nullfunc->addr4, sdata->vif.addr, ETH_ALEN); in ieee80211_send_4addr_nullfunc()
1042 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; in ieee80211_send_4addr_nullfunc()
1051 struct ieee80211_local *local = sdata->local; in ieee80211_chswitch_work()
1052 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_chswitch_work()
1059 mutex_lock(&local->mtx); in ieee80211_chswitch_work()
1060 mutex_lock(&local->chanctx_mtx); in ieee80211_chswitch_work()
1062 if (!ifmgd->associated) in ieee80211_chswitch_work()
1065 if (!sdata->vif.csa_active) in ieee80211_chswitch_work()
1070 * with multi-vif. once reservation is complete it will re-schedule the in ieee80211_chswitch_work()
1075 if (sdata->reserved_chanctx) { in ieee80211_chswitch_work()
1081 * with multi-vif csa driver may call ieee80211_csa_finish() in ieee80211_chswitch_work()
1085 if (sdata->reserved_ready) in ieee80211_chswitch_work()
1088 if (sdata->vif.bss_conf.chandef.width != in ieee80211_chswitch_work()
1089 sdata->csa_chandef.width) { in ieee80211_chswitch_work()
1100 switch (sdata->csa_chandef.width) { in ieee80211_chswitch_work()
1118 mgd_sta = sta_info_get(sdata, ifmgd->bssid); in ieee80211_chswitch_work()
1120 local->hw.wiphy->bands[sdata->csa_chandef.chan->band]; in ieee80211_chswitch_work()
1123 if (sdata->vif.bss_conf.chandef.width > in ieee80211_chswitch_work()
1124 sdata->csa_chandef.width) { in ieee80211_chswitch_work()
1125 mgd_sta->sta.bandwidth = bw; in ieee80211_chswitch_work()
1135 ieee80211_queue_work(&sdata->local->hw, in ieee80211_chswitch_work()
1136 &ifmgd->csa_connection_drop_work); in ieee80211_chswitch_work()
1140 if (sdata->vif.bss_conf.chandef.width < in ieee80211_chswitch_work()
1141 sdata->csa_chandef.width) { in ieee80211_chswitch_work()
1142 mgd_sta->sta.bandwidth = bw; in ieee80211_chswitch_work()
1150 if (!cfg80211_chandef_identical(&sdata->vif.bss_conf.chandef, in ieee80211_chswitch_work()
1151 &sdata->csa_chandef)) { in ieee80211_chswitch_work()
1154 ieee80211_queue_work(&sdata->local->hw, in ieee80211_chswitch_work()
1155 &ifmgd->csa_connection_drop_work); in ieee80211_chswitch_work()
1159 ifmgd->csa_waiting_bcn = true; in ieee80211_chswitch_work()
1165 mutex_unlock(&local->chanctx_mtx); in ieee80211_chswitch_work()
1166 mutex_unlock(&local->mtx); in ieee80211_chswitch_work()
1172 struct ieee80211_local *local = sdata->local; in ieee80211_chswitch_post_beacon()
1173 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_chswitch_post_beacon()
1178 WARN_ON(!sdata->vif.csa_active); in ieee80211_chswitch_post_beacon()
1180 if (sdata->csa_block_tx) { in ieee80211_chswitch_post_beacon()
1183 sdata->csa_block_tx = false; in ieee80211_chswitch_post_beacon()
1186 sdata->vif.csa_active = false; in ieee80211_chswitch_post_beacon()
1187 ifmgd->csa_waiting_bcn = false; in ieee80211_chswitch_post_beacon()
1193 ieee80211_queue_work(&local->hw, in ieee80211_chswitch_post_beacon()
1194 &ifmgd->csa_connection_drop_work); in ieee80211_chswitch_post_beacon()
1198 cfg80211_ch_switch_notify(sdata->dev, &sdata->reserved_chandef); in ieee80211_chswitch_post_beacon()
1204 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_chswitch_done()
1210 ieee80211_queue_work(&sdata->local->hw, in ieee80211_chswitch_done()
1211 &ifmgd->csa_connection_drop_work); in ieee80211_chswitch_done()
1213 ieee80211_queue_work(&sdata->local->hw, &ifmgd->chswitch_work); in ieee80211_chswitch_done()
1223 ieee80211_queue_work(&sdata->local->hw, &sdata->u.mgd.chswitch_work); in ieee80211_chswitch_timer()
1232 struct ieee80211_local *local = sdata->local; in ieee80211_sta_process_chanswitch()
1233 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_sta_process_chanswitch()
1234 struct cfg80211_bss *cbss = ifmgd->associated; in ieee80211_sta_process_chanswitch()
1247 if (local->scanning) in ieee80211_sta_process_chanswitch()
1251 if (sdata->vif.csa_active) in ieee80211_sta_process_chanswitch()
1254 current_band = cbss->channel->band; in ieee80211_sta_process_chanswitch()
1256 ifmgd->flags, in ieee80211_sta_process_chanswitch()
1257 ifmgd->associated->bssid, &csa_ie); in ieee80211_sta_process_chanswitch()
1259 ieee80211_queue_work(&local->hw, in ieee80211_sta_process_chanswitch()
1260 &ifmgd->csa_connection_drop_work); in ieee80211_sta_process_chanswitch()
1264 if (!cfg80211_chandef_usable(local->hw.wiphy, &csa_ie.chandef, in ieee80211_sta_process_chanswitch()
1268 ifmgd->associated->bssid, in ieee80211_sta_process_chanswitch()
1269 csa_ie.chandef.chan->center_freq, in ieee80211_sta_process_chanswitch()
1272 ieee80211_queue_work(&local->hw, in ieee80211_sta_process_chanswitch()
1273 &ifmgd->csa_connection_drop_work); in ieee80211_sta_process_chanswitch()
1278 &sdata->vif.bss_conf.chandef)) { in ieee80211_sta_process_chanswitch()
1279 if (ifmgd->csa_ignored_same_chan) in ieee80211_sta_process_chanswitch()
1283 ifmgd->associated->bssid); in ieee80211_sta_process_chanswitch()
1284 ifmgd->csa_ignored_same_chan = true; in ieee80211_sta_process_chanswitch()
1289 * Drop all TDLS peers - either we disconnect or move to a different in ieee80211_sta_process_chanswitch()
1296 mutex_lock(&local->mtx); in ieee80211_sta_process_chanswitch()
1297 mutex_lock(&local->chanctx_mtx); in ieee80211_sta_process_chanswitch()
1298 conf = rcu_dereference_protected(sdata->vif.chanctx_conf, in ieee80211_sta_process_chanswitch()
1299 lockdep_is_held(&local->chanctx_mtx)); in ieee80211_sta_process_chanswitch()
1308 if (local->use_chanctx && in ieee80211_sta_process_chanswitch()
1309 !ieee80211_hw_check(&local->hw, CHANCTX_STA_CSA)) { in ieee80211_sta_process_chanswitch()
1311 "driver doesn't support chan-switch with channel contexts\n"); in ieee80211_sta_process_chanswitch()
1328 chanctx->mode, false); in ieee80211_sta_process_chanswitch()
1335 mutex_unlock(&local->chanctx_mtx); in ieee80211_sta_process_chanswitch()
1337 sdata->vif.csa_active = true; in ieee80211_sta_process_chanswitch()
1338 sdata->csa_chandef = csa_ie.chandef; in ieee80211_sta_process_chanswitch()
1339 sdata->csa_block_tx = csa_ie.mode; in ieee80211_sta_process_chanswitch()
1340 ifmgd->csa_ignored_same_chan = false; in ieee80211_sta_process_chanswitch()
1342 if (sdata->csa_block_tx) in ieee80211_sta_process_chanswitch()
1345 mutex_unlock(&local->mtx); in ieee80211_sta_process_chanswitch()
1347 cfg80211_ch_switch_started_notify(sdata->dev, &csa_ie.chandef, in ieee80211_sta_process_chanswitch()
1350 if (local->ops->channel_switch) { in ieee80211_sta_process_chanswitch()
1358 ieee80211_queue_work(&local->hw, &ifmgd->chswitch_work); in ieee80211_sta_process_chanswitch()
1360 mod_timer(&ifmgd->chswitch_timer, in ieee80211_sta_process_chanswitch()
1361 TU_TO_EXP_TIME((csa_ie.count - 1) * in ieee80211_sta_process_chanswitch()
1362 cbss->beacon_interval)); in ieee80211_sta_process_chanswitch()
1372 sdata->vif.csa_active = true; in ieee80211_sta_process_chanswitch()
1373 sdata->csa_block_tx = csa_ie.mode; in ieee80211_sta_process_chanswitch()
1375 ieee80211_queue_work(&local->hw, &ifmgd->csa_connection_drop_work); in ieee80211_sta_process_chanswitch()
1376 mutex_unlock(&local->chanctx_mtx); in ieee80211_sta_process_chanswitch()
1377 mutex_unlock(&local->mtx); in ieee80211_sta_process_chanswitch()
1388 int chan = ieee80211_frequency_to_channel(channel->center_freq); in ieee80211_find_80211h_pwr_constr()
1397 country_ie_len -= 3; in ieee80211_find_80211h_pwr_constr()
1399 switch (channel->band) { in ieee80211_find_80211h_pwr_constr()
1414 u8 first_channel = triplet->chans.first_channel; in ieee80211_find_80211h_pwr_constr()
1419 for (i = 0; i < triplet->chans.num_channels; i++) { in ieee80211_find_80211h_pwr_constr()
1422 *chan_pwr = triplet->chans.max_power; in ieee80211_find_80211h_pwr_constr()
1431 country_ie_len -= 3; in ieee80211_find_80211h_pwr_constr()
1449 * APs clearly state the range is -127 to 127 dBm, which indicates in ieee80211_find_cisco_dtpc()
1467 __le16 capab = mgmt->u.probe_resp.capab_info; in ieee80211_handle_pwr_constr()
1476 max_t(int, 0, chan_pwr - pwr_reduction_80211h); in ieee80211_handle_pwr_constr()
1495 if (sdata->ap_power_level == new_ap_level) in ieee80211_handle_pwr_constr()
1499 "Limiting TX power to %d (%d - %d) dBm as advertised by %pM\n", in ieee80211_handle_pwr_constr()
1501 sdata->u.mgd.bssid); in ieee80211_handle_pwr_constr()
1505 if (sdata->ap_power_level == new_ap_level) in ieee80211_handle_pwr_constr()
1510 pwr_level_cisco, sdata->u.mgd.bssid); in ieee80211_handle_pwr_constr()
1513 sdata->ap_power_level = new_ap_level; in ieee80211_handle_pwr_constr()
1523 struct ieee80211_conf *conf = &local->hw.conf; in ieee80211_enable_ps()
1529 if (local->scanning) in ieee80211_enable_ps()
1532 if (conf->dynamic_ps_timeout > 0 && in ieee80211_enable_ps()
1533 !ieee80211_hw_check(&local->hw, SUPPORTS_DYNAMIC_PS)) { in ieee80211_enable_ps()
1534 mod_timer(&local->dynamic_ps_timer, jiffies + in ieee80211_enable_ps()
1535 msecs_to_jiffies(conf->dynamic_ps_timeout)); in ieee80211_enable_ps()
1537 if (ieee80211_hw_check(&local->hw, PS_NULLFUNC_STACK)) in ieee80211_enable_ps()
1540 if (ieee80211_hw_check(&local->hw, PS_NULLFUNC_STACK) && in ieee80211_enable_ps()
1541 ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) in ieee80211_enable_ps()
1544 conf->flags |= IEEE80211_CONF_PS; in ieee80211_enable_ps()
1551 struct ieee80211_conf *conf = &local->hw.conf; in ieee80211_change_ps()
1553 if (local->ps_sdata) { in ieee80211_change_ps()
1554 ieee80211_enable_ps(local, local->ps_sdata); in ieee80211_change_ps()
1555 } else if (conf->flags & IEEE80211_CONF_PS) { in ieee80211_change_ps()
1556 conf->flags &= ~IEEE80211_CONF_PS; in ieee80211_change_ps()
1558 del_timer_sync(&local->dynamic_ps_timer); in ieee80211_change_ps()
1559 cancel_work_sync(&local->dynamic_ps_enable_work); in ieee80211_change_ps()
1565 struct ieee80211_if_managed *mgd = &sdata->u.mgd; in ieee80211_powersave_allowed()
1569 if (!mgd->powersave) in ieee80211_powersave_allowed()
1572 if (mgd->broken_ap) in ieee80211_powersave_allowed()
1575 if (!mgd->associated) in ieee80211_powersave_allowed()
1578 if (mgd->flags & IEEE80211_STA_CONNECTION_POLL) in ieee80211_powersave_allowed()
1581 if (!mgd->have_beacon) in ieee80211_powersave_allowed()
1585 sta = sta_info_get(sdata, mgd->bssid); in ieee80211_powersave_allowed()
1600 if (!ieee80211_hw_check(&local->hw, SUPPORTS_PS)) { in ieee80211_recalc_ps()
1601 local->ps_sdata = NULL; in ieee80211_recalc_ps()
1605 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_recalc_ps()
1608 if (sdata->vif.type == NL80211_IFTYPE_AP) { in ieee80211_recalc_ps()
1616 if (sdata->vif.type != NL80211_IFTYPE_STATION) in ieee80211_recalc_ps()
1623 u8 dtimper = found->u.mgd.dtim_period; in ieee80211_recalc_ps()
1625 timeout = local->dynamic_ps_forced_timeout; in ieee80211_recalc_ps()
1628 local->hw.conf.dynamic_ps_timeout = timeout; in ieee80211_recalc_ps()
1634 local->hw.conf.ps_dtim_period = dtimper; in ieee80211_recalc_ps()
1635 local->ps_sdata = found; in ieee80211_recalc_ps()
1637 local->ps_sdata = NULL; in ieee80211_recalc_ps()
1647 if (sdata->vif.bss_conf.ps != ps_allowed) { in ieee80211_recalc_ps_vif()
1648 sdata->vif.bss_conf.ps = ps_allowed; in ieee80211_recalc_ps_vif()
1659 if (local->hw.conf.flags & IEEE80211_CONF_PS) { in ieee80211_dynamic_ps_disable_work()
1660 local->hw.conf.flags &= ~IEEE80211_CONF_PS; in ieee80211_dynamic_ps_disable_work()
1664 ieee80211_wake_queues_by_reason(&local->hw, in ieee80211_dynamic_ps_disable_work()
1675 struct ieee80211_sub_if_data *sdata = local->ps_sdata; in ieee80211_dynamic_ps_enable_work()
1684 ifmgd = &sdata->u.mgd; in ieee80211_dynamic_ps_enable_work()
1686 if (local->hw.conf.flags & IEEE80211_CONF_PS) in ieee80211_dynamic_ps_enable_work()
1689 if (local->hw.conf.dynamic_ps_timeout > 0) { in ieee80211_dynamic_ps_enable_work()
1692 mod_timer(&local->dynamic_ps_timer, jiffies + in ieee80211_dynamic_ps_enable_work()
1694 local->hw.conf.dynamic_ps_timeout)); in ieee80211_dynamic_ps_enable_work()
1703 spin_lock_irqsave(&local->queue_stop_reason_lock, flags); in ieee80211_dynamic_ps_enable_work()
1704 for (q = 0; q < local->hw.queues; q++) { in ieee80211_dynamic_ps_enable_work()
1705 if (local->queue_stop_reasons[q]) { in ieee80211_dynamic_ps_enable_work()
1706 spin_unlock_irqrestore(&local->queue_stop_reason_lock, in ieee80211_dynamic_ps_enable_work()
1708 mod_timer(&local->dynamic_ps_timer, jiffies + in ieee80211_dynamic_ps_enable_work()
1710 local->hw.conf.dynamic_ps_timeout)); in ieee80211_dynamic_ps_enable_work()
1714 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); in ieee80211_dynamic_ps_enable_work()
1717 if (ieee80211_hw_check(&local->hw, PS_NULLFUNC_STACK) && in ieee80211_dynamic_ps_enable_work()
1718 !(ifmgd->flags & IEEE80211_STA_NULLFUNC_ACKED)) { in ieee80211_dynamic_ps_enable_work()
1720 mod_timer(&local->dynamic_ps_timer, jiffies + in ieee80211_dynamic_ps_enable_work()
1722 local->hw.conf.dynamic_ps_timeout)); in ieee80211_dynamic_ps_enable_work()
1730 if (!(ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS) && in ieee80211_dynamic_ps_enable_work()
1731 ieee80211_hw_check(&local->hw, PS_NULLFUNC_STACK)) || in ieee80211_dynamic_ps_enable_work()
1732 (ifmgd->flags & IEEE80211_STA_NULLFUNC_ACKED)) { in ieee80211_dynamic_ps_enable_work()
1733 ifmgd->flags &= ~IEEE80211_STA_NULLFUNC_ACKED; in ieee80211_dynamic_ps_enable_work()
1734 local->hw.conf.flags |= IEEE80211_CONF_PS; in ieee80211_dynamic_ps_enable_work()
1743 ieee80211_queue_work(&local->hw, &local->dynamic_ps_enable_work); in ieee80211_dynamic_ps_timer()
1752 struct cfg80211_chan_def chandef = sdata->vif.bss_conf.chandef; in ieee80211_dfs_cac_timer_work()
1754 mutex_lock(&sdata->local->mtx); in ieee80211_dfs_cac_timer_work()
1755 if (sdata->wdev.cac_started) { in ieee80211_dfs_cac_timer_work()
1757 cfg80211_cac_event(sdata->dev, &chandef, in ieee80211_dfs_cac_timer_work()
1761 mutex_unlock(&sdata->local->mtx); in ieee80211_dfs_cac_timer_work()
1767 struct ieee80211_local *local = sdata->local; in __ieee80211_sta_handle_tspec_ac_params()
1768 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in __ieee80211_sta_handle_tspec_ac_params()
1772 if (local->hw.queues < IEEE80211_NUM_ACS) in __ieee80211_sta_handle_tspec_ac_params()
1776 struct ieee80211_sta_tx_tspec *tx_tspec = &ifmgd->tx_tspec[ac]; in __ieee80211_sta_handle_tspec_ac_params()
1780 if (tx_tspec->action == TX_TSPEC_ACTION_NONE && in __ieee80211_sta_handle_tspec_ac_params()
1781 tx_tspec->admitted_time && in __ieee80211_sta_handle_tspec_ac_params()
1782 time_after(now, tx_tspec->time_slice_start + HZ)) { in __ieee80211_sta_handle_tspec_ac_params()
1783 tx_tspec->consumed_tx_time = 0; in __ieee80211_sta_handle_tspec_ac_params()
1784 tx_tspec->time_slice_start = now; in __ieee80211_sta_handle_tspec_ac_params()
1786 if (tx_tspec->downgraded) in __ieee80211_sta_handle_tspec_ac_params()
1787 tx_tspec->action = in __ieee80211_sta_handle_tspec_ac_params()
1791 switch (tx_tspec->action) { in __ieee80211_sta_handle_tspec_ac_params()
1794 if (drv_conf_tx(local, sdata, ac, &sdata->tx_conf[ac])) in __ieee80211_sta_handle_tspec_ac_params()
1798 tx_tspec->action = TX_TSPEC_ACTION_NONE; in __ieee80211_sta_handle_tspec_ac_params()
1799 tx_tspec->downgraded = false; in __ieee80211_sta_handle_tspec_ac_params()
1803 if (time_after(now, tx_tspec->time_slice_start + HZ)) { in __ieee80211_sta_handle_tspec_ac_params()
1804 tx_tspec->action = TX_TSPEC_ACTION_NONE; in __ieee80211_sta_handle_tspec_ac_params()
1808 /* downgrade next lower non-ACM AC */ in __ieee80211_sta_handle_tspec_ac_params()
1812 if (!(sdata->wmm_acm & BIT(7 - 2 * non_acm_ac))) in __ieee80211_sta_handle_tspec_ac_params()
1816 * makes no sense and we have to transmit somehow - the in __ieee80211_sta_handle_tspec_ac_params()
1824 &sdata->tx_conf[non_acm_ac])) in __ieee80211_sta_handle_tspec_ac_params()
1828 tx_tspec->action = TX_TSPEC_ACTION_NONE; in __ieee80211_sta_handle_tspec_ac_params()
1830 schedule_delayed_work(&ifmgd->tx_tspec_wk, in __ieee80211_sta_handle_tspec_ac_params()
1831 tx_tspec->time_slice_start + HZ - now + 1); in __ieee80211_sta_handle_tspec_ac_params()
1865 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_sta_wmm_params()
1871 if (!local->ops->conf_tx) in ieee80211_sta_wmm_params()
1874 if (local->hw.queues < IEEE80211_NUM_ACS) in ieee80211_sta_wmm_params()
1883 if (ifmgd->flags & IEEE80211_STA_UAPSD_ENABLED) in ieee80211_sta_wmm_params()
1884 uapsd_queues = ifmgd->uapsd_queues; in ieee80211_sta_wmm_params()
1887 if (count == ifmgd->wmm_last_param_set) in ieee80211_sta_wmm_params()
1889 ifmgd->wmm_last_param_set = count; in ieee80211_sta_wmm_params()
1892 left = wmm_param_len - 8; in ieee80211_sta_wmm_params()
1896 sdata->wmm_acm = 0; in ieee80211_sta_wmm_params()
1897 for (; left >= 4; left -= 4, pos += 4) { in ieee80211_sta_wmm_params()
1906 sdata->wmm_acm |= BIT(1) | BIT(2); /* BK/- */ in ieee80211_sta_wmm_params()
1911 params[ac].mu_edca_param_rec = mu_edca->ac_bk; in ieee80211_sta_wmm_params()
1916 sdata->wmm_acm |= BIT(4) | BIT(5); /* CL/VI */ in ieee80211_sta_wmm_params()
1921 params[ac].mu_edca_param_rec = mu_edca->ac_vi; in ieee80211_sta_wmm_params()
1926 sdata->wmm_acm |= BIT(6) | BIT(7); /* VO/NC */ in ieee80211_sta_wmm_params()
1931 params[ac].mu_edca_param_rec = mu_edca->ac_vo; in ieee80211_sta_wmm_params()
1937 sdata->wmm_acm |= BIT(0) | BIT(3); /* BE/EE */ in ieee80211_sta_wmm_params()
1942 params[ac].mu_edca_param_rec = mu_edca->ac_be; in ieee80211_sta_wmm_params()
1986 ifmgd->tx_tspec[ac].downgraded); in ieee80211_sta_wmm_params()
1987 sdata->tx_conf[ac] = params[ac]; in ieee80211_sta_wmm_params()
1988 if (!ifmgd->tx_tspec[ac].downgraded && in ieee80211_sta_wmm_params()
1996 sdata->vif.bss_conf.qos = true; in ieee80211_sta_wmm_params()
2002 lockdep_assert_held(&sdata->local->mtx); in __ieee80211_stop_poll()
2004 sdata->u.mgd.flags &= ~IEEE80211_STA_CONNECTION_POLL; in __ieee80211_stop_poll()
2005 ieee80211_run_deferred_scan(sdata->local); in __ieee80211_stop_poll()
2010 mutex_lock(&sdata->local->mtx); in ieee80211_stop_poll()
2012 mutex_unlock(&sdata->local->mtx); in ieee80211_stop_poll()
2018 struct ieee80211_bss_conf *bss_conf = &sdata->vif.bss_conf; in ieee80211_handle_bss_capability()
2038 if (sband->band == NL80211_BAND_5GHZ) in ieee80211_handle_bss_capability()
2041 if (use_protection != bss_conf->use_cts_prot) { in ieee80211_handle_bss_capability()
2042 bss_conf->use_cts_prot = use_protection; in ieee80211_handle_bss_capability()
2046 if (use_short_preamble != bss_conf->use_short_preamble) { in ieee80211_handle_bss_capability()
2047 bss_conf->use_short_preamble = use_short_preamble; in ieee80211_handle_bss_capability()
2051 if (use_short_slot != bss_conf->use_short_slot) { in ieee80211_handle_bss_capability()
2052 bss_conf->use_short_slot = use_short_slot; in ieee80211_handle_bss_capability()
2063 struct ieee80211_bss *bss = (void *)cbss->priv; in ieee80211_set_associated()
2064 struct ieee80211_local *local = sdata->local; in ieee80211_set_associated()
2065 struct ieee80211_bss_conf *bss_conf = &sdata->vif.bss_conf; in ieee80211_set_associated()
2069 bss_conf->assoc_capability, bss->has_erp_value, bss->erp_value); in ieee80211_set_associated()
2071 sdata->u.mgd.beacon_timeout = usecs_to_jiffies(ieee80211_tu_to_usec( in ieee80211_set_associated()
2072 beacon_loss_count * bss_conf->beacon_int)); in ieee80211_set_associated()
2074 sdata->u.mgd.associated = cbss; in ieee80211_set_associated()
2075 memcpy(sdata->u.mgd.bssid, cbss->bssid, ETH_ALEN); in ieee80211_set_associated()
2079 sdata->u.mgd.flags |= IEEE80211_STA_RESET_SIGNAL_AVE; in ieee80211_set_associated()
2081 if (sdata->vif.p2p || in ieee80211_set_associated()
2082 sdata->vif.driver_flags & IEEE80211_VIF_GET_NOA_UPDATE) { in ieee80211_set_associated()
2086 ies = rcu_dereference(cbss->ies); in ieee80211_set_associated()
2091 ies->data, ies->len, in ieee80211_set_associated()
2093 (u8 *) &bss_conf->p2p_noa_attr, in ieee80211_set_associated()
2094 sizeof(bss_conf->p2p_noa_attr)); in ieee80211_set_associated()
2096 sdata->u.mgd.p2p_noa_index = in ieee80211_set_associated()
2097 bss_conf->p2p_noa_attr.index; in ieee80211_set_associated()
2109 if (sdata->u.mgd.have_beacon) { in ieee80211_set_associated()
2116 bss_conf->dtim_period = sdata->u.mgd.dtim_period ?: 1; in ieee80211_set_associated()
2117 bss_conf->beacon_rate = bss->beacon_rate; in ieee80211_set_associated()
2120 bss_conf->beacon_rate = NULL; in ieee80211_set_associated()
2121 bss_conf->dtim_period = 0; in ieee80211_set_associated()
2124 bss_conf->assoc = 1; in ieee80211_set_associated()
2127 if (sdata->vif.driver_flags & IEEE80211_VIF_SUPPORTS_CQM_RSSI && in ieee80211_set_associated()
2128 bss_conf->cqm_rssi_thold) in ieee80211_set_associated()
2132 if (bss_conf->arp_addr_cnt) in ieee80211_set_associated()
2137 mutex_lock(&local->iflist_mtx); in ieee80211_set_associated()
2139 mutex_unlock(&local->iflist_mtx); in ieee80211_set_associated()
2144 netif_carrier_on(sdata->dev); in ieee80211_set_associated()
2151 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_set_disassoc()
2152 struct ieee80211_local *local = sdata->local; in ieee80211_set_disassoc()
2160 if (WARN_ON(!ifmgd->associated)) in ieee80211_set_disassoc()
2165 ifmgd->associated = NULL; in ieee80211_set_disassoc()
2166 netif_carrier_off(sdata->dev); in ieee80211_set_disassoc()
2170 * to do it before sending disassoc, as otherwise the null-packet in ieee80211_set_disassoc()
2173 if (local->hw.conf.flags & IEEE80211_CONF_PS) { in ieee80211_set_disassoc()
2174 local->hw.conf.flags &= ~IEEE80211_CONF_PS; in ieee80211_set_disassoc()
2177 local->ps_sdata = NULL; in ieee80211_set_disassoc()
2179 /* disable per-vif ps */ in ieee80211_set_disassoc()
2202 if (ieee80211_hw_check(&local->hw, DEAUTH_NEED_MGD_TX_PREP) && in ieee80211_set_disassoc()
2203 !ifmgd->have_beacon) in ieee80211_set_disassoc()
2204 drv_mgd_prepare_tx(sdata->local, sdata, 0); in ieee80211_set_disassoc()
2206 ieee80211_send_deauth_disassoc(sdata, ifmgd->bssid, stype, in ieee80211_set_disassoc()
2210 /* flush out frame - make sure the deauth was actually sent */ in ieee80211_set_disassoc()
2215 eth_zero_addr(ifmgd->bssid); in ieee80211_set_disassoc()
2225 sdata->vif.bss_conf.assoc = false; in ieee80211_set_disassoc()
2227 ifmgd->p2p_noa_index = -1; in ieee80211_set_disassoc()
2228 memset(&sdata->vif.bss_conf.p2p_noa_attr, 0, in ieee80211_set_disassoc()
2229 sizeof(sdata->vif.bss_conf.p2p_noa_attr)); in ieee80211_set_disassoc()
2231 /* on the next assoc, re-program HT/VHT parameters */ in ieee80211_set_disassoc()
2232 memset(&ifmgd->ht_capa, 0, sizeof(ifmgd->ht_capa)); in ieee80211_set_disassoc()
2233 memset(&ifmgd->ht_capa_mask, 0, sizeof(ifmgd->ht_capa_mask)); in ieee80211_set_disassoc()
2234 memset(&ifmgd->vht_capa, 0, sizeof(ifmgd->vht_capa)); in ieee80211_set_disassoc()
2235 memset(&ifmgd->vht_capa_mask, 0, sizeof(ifmgd->vht_capa_mask)); in ieee80211_set_disassoc()
2237 /* reset MU-MIMO ownership and group data */ in ieee80211_set_disassoc()
2238 memset(sdata->vif.bss_conf.mu_group.membership, 0, in ieee80211_set_disassoc()
2239 sizeof(sdata->vif.bss_conf.mu_group.membership)); in ieee80211_set_disassoc()
2240 memset(sdata->vif.bss_conf.mu_group.position, 0, in ieee80211_set_disassoc()
2241 sizeof(sdata->vif.bss_conf.mu_group.position)); in ieee80211_set_disassoc()
2243 sdata->vif.mu_mimo_owner = false; in ieee80211_set_disassoc()
2245 sdata->ap_power_level = IEEE80211_UNSET_POWER_LEVEL; in ieee80211_set_disassoc()
2247 del_timer_sync(&local->dynamic_ps_timer); in ieee80211_set_disassoc()
2248 cancel_work_sync(&local->dynamic_ps_enable_work); in ieee80211_set_disassoc()
2251 if (sdata->vif.bss_conf.arp_addr_cnt) in ieee80211_set_disassoc()
2254 sdata->vif.bss_conf.qos = false; in ieee80211_set_disassoc()
2261 /* disassociated - set to defaults now */ in ieee80211_set_disassoc()
2264 del_timer_sync(&sdata->u.mgd.conn_mon_timer); in ieee80211_set_disassoc()
2265 del_timer_sync(&sdata->u.mgd.bcn_mon_timer); in ieee80211_set_disassoc()
2266 del_timer_sync(&sdata->u.mgd.timer); in ieee80211_set_disassoc()
2267 del_timer_sync(&sdata->u.mgd.chswitch_timer); in ieee80211_set_disassoc()
2269 sdata->vif.bss_conf.dtim_period = 0; in ieee80211_set_disassoc()
2270 sdata->vif.bss_conf.beacon_rate = NULL; in ieee80211_set_disassoc()
2272 ifmgd->have_beacon = false; in ieee80211_set_disassoc()
2274 ifmgd->flags = 0; in ieee80211_set_disassoc()
2275 mutex_lock(&local->mtx); in ieee80211_set_disassoc()
2278 sdata->vif.csa_active = false; in ieee80211_set_disassoc()
2279 ifmgd->csa_waiting_bcn = false; in ieee80211_set_disassoc()
2280 ifmgd->csa_ignored_same_chan = false; in ieee80211_set_disassoc()
2281 if (sdata->csa_block_tx) { in ieee80211_set_disassoc()
2284 sdata->csa_block_tx = false; in ieee80211_set_disassoc()
2286 mutex_unlock(&local->mtx); in ieee80211_set_disassoc()
2289 memset(ifmgd->tx_tspec, 0, sizeof(ifmgd->tx_tspec)); in ieee80211_set_disassoc()
2290 cancel_delayed_work_sync(&ifmgd->tx_tspec_wk); in ieee80211_set_disassoc()
2292 sdata->encrypt_headroom = IEEE80211_ENCRYPT_HEADROOM; in ieee80211_set_disassoc()
2306 if (is_multicast_ether_addr(hdr->addr1)) in ieee80211_sta_rx_notify()
2314 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_reset_ap_probe()
2315 struct ieee80211_local *local = sdata->local; in ieee80211_reset_ap_probe()
2317 mutex_lock(&local->mtx); in ieee80211_reset_ap_probe()
2318 if (!(ifmgd->flags & IEEE80211_STA_CONNECTION_POLL)) in ieee80211_reset_ap_probe()
2323 mutex_lock(&local->iflist_mtx); in ieee80211_reset_ap_probe()
2325 mutex_unlock(&local->iflist_mtx); in ieee80211_reset_ap_probe()
2327 if (ieee80211_hw_check(&sdata->local->hw, CONNECTION_MONITOR)) in ieee80211_reset_ap_probe()
2337 mod_timer(&ifmgd->conn_mon_timer, in ieee80211_reset_ap_probe()
2341 mutex_unlock(&local->mtx); in ieee80211_reset_ap_probe()
2348 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_sta_tx_wmm_ac_notify()
2351 struct ieee80211_sta_tx_tspec *tx_tspec = &ifmgd->tx_tspec[ac]; in ieee80211_sta_tx_wmm_ac_notify()
2354 if (likely(!tx_tspec->admitted_time)) in ieee80211_sta_tx_wmm_ac_notify()
2357 if (time_after(now, tx_tspec->time_slice_start + HZ)) { in ieee80211_sta_tx_wmm_ac_notify()
2358 tx_tspec->consumed_tx_time = 0; in ieee80211_sta_tx_wmm_ac_notify()
2359 tx_tspec->time_slice_start = now; in ieee80211_sta_tx_wmm_ac_notify()
2361 if (tx_tspec->downgraded) { in ieee80211_sta_tx_wmm_ac_notify()
2362 tx_tspec->action = TX_TSPEC_ACTION_STOP_DOWNGRADE; in ieee80211_sta_tx_wmm_ac_notify()
2363 schedule_delayed_work(&ifmgd->tx_tspec_wk, 0); in ieee80211_sta_tx_wmm_ac_notify()
2367 if (tx_tspec->downgraded) in ieee80211_sta_tx_wmm_ac_notify()
2370 tx_tspec->consumed_tx_time += tx_time; in ieee80211_sta_tx_wmm_ac_notify()
2372 if (tx_tspec->consumed_tx_time >= tx_tspec->admitted_time) { in ieee80211_sta_tx_wmm_ac_notify()
2373 tx_tspec->downgraded = true; in ieee80211_sta_tx_wmm_ac_notify()
2374 tx_tspec->action = TX_TSPEC_ACTION_DOWNGRADE; in ieee80211_sta_tx_wmm_ac_notify()
2375 schedule_delayed_work(&ifmgd->tx_tspec_wk, 0); in ieee80211_sta_tx_wmm_ac_notify()
2384 if (!ieee80211_is_data(hdr->frame_control)) in ieee80211_sta_tx_notify()
2387 if (ieee80211_is_any_nullfunc(hdr->frame_control) && in ieee80211_sta_tx_notify()
2388 sdata->u.mgd.probe_send_count > 0) { in ieee80211_sta_tx_notify()
2392 sdata->u.mgd.nullfunc_failed = true; in ieee80211_sta_tx_notify()
2393 ieee80211_queue_work(&sdata->local->hw, &sdata->work); in ieee80211_sta_tx_notify()
2408 skb = ieee80211_build_probe_req(sdata, src, dst, (u32)-1, channel, in ieee80211_mlme_send_probe_req()
2417 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_mgd_probe_ap_send()
2419 u8 *dst = ifmgd->associated->bssid; in ieee80211_mgd_probe_ap_send()
2420 u8 unicast_limit = max(1, max_probe_tries - 3); in ieee80211_mgd_probe_ap_send()
2428 if (ifmgd->probe_send_count >= unicast_limit) in ieee80211_mgd_probe_ap_send()
2438 ifmgd->probe_send_count++; in ieee80211_mgd_probe_ap_send()
2441 mutex_lock(&sdata->local->sta_mtx); in ieee80211_mgd_probe_ap_send()
2445 mutex_unlock(&sdata->local->sta_mtx); in ieee80211_mgd_probe_ap_send()
2448 if (ieee80211_hw_check(&sdata->local->hw, REPORTS_TX_ACK_STATUS)) { in ieee80211_mgd_probe_ap_send()
2449 ifmgd->nullfunc_failed = false; in ieee80211_mgd_probe_ap_send()
2450 ieee80211_send_nullfunc(sdata->local, sdata, false); in ieee80211_mgd_probe_ap_send()
2455 ssid = ieee80211_bss_get_ie(ifmgd->associated, WLAN_EID_SSID); in ieee80211_mgd_probe_ap_send()
2461 ieee80211_mlme_send_probe_req(sdata, sdata->vif.addr, dst, in ieee80211_mgd_probe_ap_send()
2463 ifmgd->associated->channel); in ieee80211_mgd_probe_ap_send()
2467 ifmgd->probe_timeout = jiffies + msecs_to_jiffies(probe_wait_ms); in ieee80211_mgd_probe_ap_send()
2468 run_again(sdata, ifmgd->probe_timeout); in ieee80211_mgd_probe_ap_send()
2474 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_mgd_probe_ap()
2482 if (!ifmgd->associated) in ieee80211_mgd_probe_ap()
2485 mutex_lock(&sdata->local->mtx); in ieee80211_mgd_probe_ap()
2487 if (sdata->local->tmp_channel || sdata->local->scanning) { in ieee80211_mgd_probe_ap()
2488 mutex_unlock(&sdata->local->mtx); in ieee80211_mgd_probe_ap()
2494 "detected beacon loss from AP (missed %d beacons) - probing\n", in ieee80211_mgd_probe_ap()
2497 ieee80211_cqm_beacon_loss_notify(&sdata->vif, GFP_KERNEL); in ieee80211_mgd_probe_ap()
2511 if (ifmgd->flags & IEEE80211_STA_CONNECTION_POLL) in ieee80211_mgd_probe_ap()
2514 ifmgd->flags |= IEEE80211_STA_CONNECTION_POLL; in ieee80211_mgd_probe_ap()
2516 mutex_unlock(&sdata->local->mtx); in ieee80211_mgd_probe_ap()
2521 mutex_lock(&sdata->local->iflist_mtx); in ieee80211_mgd_probe_ap()
2522 ieee80211_recalc_ps(sdata->local); in ieee80211_mgd_probe_ap()
2523 mutex_unlock(&sdata->local->iflist_mtx); in ieee80211_mgd_probe_ap()
2525 ifmgd->probe_send_count = 0; in ieee80211_mgd_probe_ap()
2535 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_ap_probereq_get()
2541 if (WARN_ON(sdata->vif.type != NL80211_IFTYPE_STATION)) in ieee80211_ap_probereq_get()
2546 if (ifmgd->associated) in ieee80211_ap_probereq_get()
2547 cbss = ifmgd->associated; in ieee80211_ap_probereq_get()
2548 else if (ifmgd->auth_data) in ieee80211_ap_probereq_get()
2549 cbss = ifmgd->auth_data->bss; in ieee80211_ap_probereq_get()
2550 else if (ifmgd->assoc_data) in ieee80211_ap_probereq_get()
2551 cbss = ifmgd->assoc_data->bss; in ieee80211_ap_probereq_get()
2558 "invalid SSID element (len=%d)", ssid ? ssid[1] : -1)) in ieee80211_ap_probereq_get()
2563 skb = ieee80211_build_probe_req(sdata, sdata->vif.addr, cbss->bssid, in ieee80211_ap_probereq_get()
2564 (u32) -1, cbss->channel, in ieee80211_ap_probereq_get()
2584 cfg80211_tx_mlme_mgmt(sdata->dev, buf, len); in ieee80211_report_disconnect()
2586 cfg80211_rx_mlme_mgmt(sdata->dev, buf, len); in ieee80211_report_disconnect()
2588 drv_event_callback(sdata->local, sdata, &event); in ieee80211_report_disconnect()
2593 struct ieee80211_local *local = sdata->local; in __ieee80211_disconnect()
2594 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in __ieee80211_disconnect()
2599 if (!ifmgd->associated) { in __ieee80211_disconnect()
2604 tx = !sdata->csa_block_tx; in __ieee80211_disconnect()
2609 cfg80211_unlink_bss(local->hw.wiphy, ifmgd->associated); in __ieee80211_disconnect()
2614 mutex_lock(&local->mtx); in __ieee80211_disconnect()
2615 sdata->vif.csa_active = false; in __ieee80211_disconnect()
2616 ifmgd->csa_waiting_bcn = false; in __ieee80211_disconnect()
2617 if (sdata->csa_block_tx) { in __ieee80211_disconnect()
2620 sdata->csa_block_tx = false; in __ieee80211_disconnect()
2622 mutex_unlock(&local->mtx); in __ieee80211_disconnect()
2635 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_beacon_connection_loss_work()
2637 if (ifmgd->associated) in ieee80211_beacon_connection_loss_work()
2638 ifmgd->beacon_loss_count++; in ieee80211_beacon_connection_loss_work()
2640 if (ifmgd->connection_loss) { in ieee80211_beacon_connection_loss_work()
2642 ifmgd->bssid); in ieee80211_beacon_connection_loss_work()
2661 struct ieee80211_hw *hw = &sdata->local->hw; in ieee80211_beacon_loss()
2665 sdata->u.mgd.connection_loss = false; in ieee80211_beacon_loss()
2666 ieee80211_queue_work(hw, &sdata->u.mgd.beacon_connection_loss_work); in ieee80211_beacon_loss()
2673 struct ieee80211_hw *hw = &sdata->local->hw; in ieee80211_connection_loss()
2677 sdata->u.mgd.connection_loss = true; in ieee80211_connection_loss()
2678 ieee80211_queue_work(hw, &sdata->u.mgd.beacon_connection_loss_work); in ieee80211_connection_loss()
2686 struct ieee80211_mgd_auth_data *auth_data = sdata->u.mgd.auth_data; in ieee80211_destroy_auth_data()
2696 del_timer_sync(&sdata->u.mgd.timer); in ieee80211_destroy_auth_data()
2697 sta_info_destroy_addr(sdata, auth_data->bss->bssid); in ieee80211_destroy_auth_data()
2699 eth_zero_addr(sdata->u.mgd.bssid); in ieee80211_destroy_auth_data()
2701 sdata->u.mgd.flags = 0; in ieee80211_destroy_auth_data()
2702 mutex_lock(&sdata->local->mtx); in ieee80211_destroy_auth_data()
2704 mutex_unlock(&sdata->local->mtx); in ieee80211_destroy_auth_data()
2707 cfg80211_put_bss(sdata->local->hw.wiphy, auth_data->bss); in ieee80211_destroy_auth_data()
2709 sdata->u.mgd.auth_data = NULL; in ieee80211_destroy_auth_data()
2715 struct ieee80211_mgd_assoc_data *assoc_data = sdata->u.mgd.assoc_data; in ieee80211_destroy_assoc_data()
2725 del_timer_sync(&sdata->u.mgd.timer); in ieee80211_destroy_assoc_data()
2726 sta_info_destroy_addr(sdata, assoc_data->bss->bssid); in ieee80211_destroy_assoc_data()
2728 eth_zero_addr(sdata->u.mgd.bssid); in ieee80211_destroy_assoc_data()
2730 sdata->u.mgd.flags = 0; in ieee80211_destroy_assoc_data()
2731 sdata->vif.mu_mimo_owner = false; in ieee80211_destroy_assoc_data()
2733 mutex_lock(&sdata->local->mtx); in ieee80211_destroy_assoc_data()
2735 mutex_unlock(&sdata->local->mtx); in ieee80211_destroy_assoc_data()
2738 cfg80211_abandon_assoc(sdata->dev, assoc_data->bss); in ieee80211_destroy_assoc_data()
2742 sdata->u.mgd.assoc_data = NULL; in ieee80211_destroy_assoc_data()
2748 struct ieee80211_local *local = sdata->local; in ieee80211_auth_challenge()
2749 struct ieee80211_mgd_auth_data *auth_data = sdata->u.mgd.auth_data; in ieee80211_auth_challenge()
2754 pos = mgmt->u.auth.variable; in ieee80211_auth_challenge()
2755 ieee802_11_parse_elems(pos, len - (pos - (u8 *) mgmt), false, &elems); in ieee80211_auth_challenge()
2758 auth_data->expected_transaction = 4; in ieee80211_auth_challenge()
2759 drv_mgd_prepare_tx(sdata->local, sdata, 0); in ieee80211_auth_challenge()
2760 if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) in ieee80211_auth_challenge()
2763 ieee80211_send_auth(sdata, 3, auth_data->algorithm, 0, in ieee80211_auth_challenge()
2764 elems.challenge - 2, elems.challenge_len + 2, in ieee80211_auth_challenge()
2765 auth_data->bss->bssid, auth_data->bss->bssid, in ieee80211_auth_challenge()
2766 auth_data->key, auth_data->key_len, in ieee80211_auth_challenge()
2767 auth_data->key_idx, tx_flags); in ieee80211_auth_challenge()
2773 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_rx_mgmt_auth()
2787 if (!ifmgd->auth_data || ifmgd->auth_data->done) in ieee80211_rx_mgmt_auth()
2790 memcpy(bssid, ifmgd->auth_data->bss->bssid, ETH_ALEN); in ieee80211_rx_mgmt_auth()
2792 if (!ether_addr_equal(bssid, mgmt->bssid)) in ieee80211_rx_mgmt_auth()
2795 auth_alg = le16_to_cpu(mgmt->u.auth.auth_alg); in ieee80211_rx_mgmt_auth()
2796 auth_transaction = le16_to_cpu(mgmt->u.auth.auth_transaction); in ieee80211_rx_mgmt_auth()
2797 status_code = le16_to_cpu(mgmt->u.auth.status_code); in ieee80211_rx_mgmt_auth()
2799 if (auth_alg != ifmgd->auth_data->algorithm || in ieee80211_rx_mgmt_auth()
2800 auth_transaction != ifmgd->auth_data->expected_transaction) { in ieee80211_rx_mgmt_auth()
2802 mgmt->sa, auth_alg, ifmgd->auth_data->algorithm, in ieee80211_rx_mgmt_auth()
2804 ifmgd->auth_data->expected_transaction); in ieee80211_rx_mgmt_auth()
2810 mgmt->sa, status_code); in ieee80211_rx_mgmt_auth()
2812 cfg80211_rx_mlme_mgmt(sdata->dev, (u8 *)mgmt, len); in ieee80211_rx_mgmt_auth()
2815 drv_event_callback(sdata->local, sdata, &event); in ieee80211_rx_mgmt_auth()
2819 switch (ifmgd->auth_data->algorithm) { in ieee80211_rx_mgmt_auth()
2829 if (ifmgd->auth_data->expected_transaction != 4) { in ieee80211_rx_mgmt_auth()
2837 ifmgd->auth_data->algorithm); in ieee80211_rx_mgmt_auth()
2842 drv_event_callback(sdata->local, sdata, &event); in ieee80211_rx_mgmt_auth()
2844 ifmgd->auth_data->done = true; in ieee80211_rx_mgmt_auth()
2845 ifmgd->auth_data->timeout = jiffies + IEEE80211_AUTH_WAIT_ASSOC; in ieee80211_rx_mgmt_auth()
2846 ifmgd->auth_data->timeout_started = true; in ieee80211_rx_mgmt_auth()
2847 run_again(sdata, ifmgd->auth_data->timeout); in ieee80211_rx_mgmt_auth()
2849 if (ifmgd->auth_data->algorithm == WLAN_AUTH_SAE && in ieee80211_rx_mgmt_auth()
2850 ifmgd->auth_data->expected_transaction != 2) { in ieee80211_rx_mgmt_auth()
2855 cfg80211_rx_mlme_mgmt(sdata->dev, (u8 *)mgmt, len); in ieee80211_rx_mgmt_auth()
2860 mutex_lock(&sdata->local->sta_mtx); in ieee80211_rx_mgmt_auth()
2863 WARN_ONCE(1, "%s: STA %pM not found", sdata->name, bssid); in ieee80211_rx_mgmt_auth()
2870 mutex_unlock(&sdata->local->sta_mtx); in ieee80211_rx_mgmt_auth()
2872 cfg80211_rx_mlme_mgmt(sdata->dev, (u8 *)mgmt, len); in ieee80211_rx_mgmt_auth()
2875 mutex_unlock(&sdata->local->sta_mtx); in ieee80211_rx_mgmt_auth()
2876 /* ignore frame -- wait for timeout */ in ieee80211_rx_mgmt_auth()
2939 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_rx_mgmt_deauth()
2940 u16 reason_code = le16_to_cpu(mgmt->u.deauth.reason_code); in ieee80211_rx_mgmt_deauth()
2947 if (!ether_addr_equal(mgmt->bssid, mgmt->sa)) { in ieee80211_rx_mgmt_deauth()
2948 ieee80211_tdls_handle_disconnect(sdata, mgmt->sa, reason_code); in ieee80211_rx_mgmt_deauth()
2952 if (ifmgd->associated && in ieee80211_rx_mgmt_deauth()
2953 ether_addr_equal(mgmt->bssid, ifmgd->associated->bssid)) { in ieee80211_rx_mgmt_deauth()
2954 const u8 *bssid = ifmgd->associated->bssid; in ieee80211_rx_mgmt_deauth()
2967 if (ifmgd->assoc_data && in ieee80211_rx_mgmt_deauth()
2968 ether_addr_equal(mgmt->bssid, ifmgd->assoc_data->bss->bssid)) { in ieee80211_rx_mgmt_deauth()
2969 const u8 *bssid = ifmgd->assoc_data->bss->bssid; in ieee80211_rx_mgmt_deauth()
2978 cfg80211_rx_mlme_mgmt(sdata->dev, (u8 *)mgmt, len); in ieee80211_rx_mgmt_deauth()
2987 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_rx_mgmt_disassoc()
2995 if (!ifmgd->associated || in ieee80211_rx_mgmt_disassoc()
2996 !ether_addr_equal(mgmt->bssid, ifmgd->associated->bssid)) in ieee80211_rx_mgmt_disassoc()
2999 reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code); in ieee80211_rx_mgmt_disassoc()
3001 if (!ether_addr_equal(mgmt->bssid, mgmt->sa)) { in ieee80211_rx_mgmt_disassoc()
3002 ieee80211_tdls_handle_disconnect(sdata, mgmt->sa, reason_code); in ieee80211_rx_mgmt_disassoc()
3007 mgmt->sa, reason_code, in ieee80211_rx_mgmt_disassoc()
3043 for (j = 0; j < sband->n_bitrates; j++) { in ieee80211_get_rates()
3047 br = &sband->bitrates[j]; in ieee80211_get_rates()
3049 brate = DIV_ROUND_UP(br->bitrate, (1 << shift) * 5); in ieee80211_get_rates()
3068 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_assoc_success()
3069 struct ieee80211_local *local = sdata->local; in ieee80211_assoc_success()
3075 struct ieee80211_bss_conf *bss_conf = &sdata->vif.bss_conf; in ieee80211_assoc_success()
3077 struct ieee80211_mgd_assoc_data *assoc_data = ifmgd->assoc_data; in ieee80211_assoc_success()
3084 aid = le16_to_cpu(mgmt->u.assoc_resp.aid); in ieee80211_assoc_success()
3085 capab_info = le16_to_cpu(mgmt->u.assoc_resp.capab_info); in ieee80211_assoc_success()
3089 * (802.11-2016 9.4.1.8 AID field) in ieee80211_assoc_success()
3093 ifmgd->broken_ap = false; in ieee80211_assoc_success()
3099 ifmgd->broken_ap = true; in ieee80211_assoc_success()
3102 pos = mgmt->u.assoc_resp.variable; in ieee80211_assoc_success()
3103 ieee802_11_parse_elems(pos, len - (pos - (u8 *) mgmt), false, &elems); in ieee80211_assoc_success()
3110 ifmgd->aid = aid; in ieee80211_assoc_success()
3111 ifmgd->tdls_chan_switch_prohibited = in ieee80211_assoc_success()
3120 * "Vodafone PocketWiFi 2", "ZTE MF60" and a similar T-Mobile device. in ieee80211_assoc_success()
3122 if ((assoc_data->wmm && !elems.wmm_param) || in ieee80211_assoc_success()
3123 (!(ifmgd->flags & IEEE80211_STA_DISABLE_HT) && in ieee80211_assoc_success()
3125 (!(ifmgd->flags & IEEE80211_STA_DISABLE_VHT) && in ieee80211_assoc_success()
3131 ies = rcu_dereference(cbss->ies); in ieee80211_assoc_success()
3133 bss_ies = kmemdup(ies, sizeof(*ies) + ies->len, in ieee80211_assoc_success()
3139 ieee802_11_parse_elems(bss_ies->data, bss_ies->len, in ieee80211_assoc_success()
3141 if (assoc_data->wmm && in ieee80211_assoc_success()
3153 !(ifmgd->flags & IEEE80211_STA_DISABLE_HT)) { in ieee80211_assoc_success()
3159 !(ifmgd->flags & IEEE80211_STA_DISABLE_HT)) { in ieee80211_assoc_success()
3165 !(ifmgd->flags & IEEE80211_STA_DISABLE_VHT)) { in ieee80211_assoc_success()
3171 !(ifmgd->flags & IEEE80211_STA_DISABLE_VHT)) { in ieee80211_assoc_success()
3182 if (!(ifmgd->flags & IEEE80211_STA_DISABLE_HT) && in ieee80211_assoc_success()
3190 if (!(ifmgd->flags & IEEE80211_STA_DISABLE_VHT) && in ieee80211_assoc_success()
3198 mutex_lock(&sdata->local->sta_mtx); in ieee80211_assoc_success()
3203 sta = sta_info_get(sdata, cbss->bssid); in ieee80211_assoc_success()
3205 mutex_unlock(&sdata->local->sta_mtx); in ieee80211_assoc_success()
3212 mutex_unlock(&sdata->local->sta_mtx); in ieee80211_assoc_success()
3221 if (ifmgd->flags & IEEE80211_STA_DISABLE_HT || in ieee80211_assoc_success()
3222 (sband->band == NL80211_BAND_5GHZ && in ieee80211_assoc_success()
3223 ifmgd->flags & IEEE80211_STA_DISABLE_VHT) || in ieee80211_assoc_success()
3225 ifmgd->flags |= IEEE80211_STA_DISABLE_HE; in ieee80211_assoc_success()
3227 if (!(ifmgd->flags & IEEE80211_STA_DISABLE_HE) && in ieee80211_assoc_success()
3229 mutex_unlock(&sdata->local->sta_mtx); in ieee80211_assoc_success()
3237 if (elems.ht_cap_elem && !(ifmgd->flags & IEEE80211_STA_DISABLE_HT)) in ieee80211_assoc_success()
3241 if (elems.vht_cap_elem && !(ifmgd->flags & IEEE80211_STA_DISABLE_VHT)) in ieee80211_assoc_success()
3245 if (elems.he_operation && !(ifmgd->flags & IEEE80211_STA_DISABLE_HE) && in ieee80211_assoc_success()
3252 bss_conf->he_support = sta->sta.he_cap.has_he; in ieee80211_assoc_success()
3254 bss_conf->he_support = false; in ieee80211_assoc_success()
3257 if (bss_conf->he_support) { in ieee80211_assoc_success()
3258 bss_conf->bss_color = in ieee80211_assoc_success()
3259 le32_get_bits(elems.he_operation->he_oper_params, in ieee80211_assoc_success()
3262 bss_conf->htc_trig_based_pkt_ext = in ieee80211_assoc_success()
3263 le32_get_bits(elems.he_operation->he_oper_params, in ieee80211_assoc_success()
3265 bss_conf->frame_time_rts_th = in ieee80211_assoc_success()
3266 le32_get_bits(elems.he_operation->he_oper_params, in ieee80211_assoc_success()
3269 bss_conf->multi_sta_back_32bit = in ieee80211_assoc_success()
3270 sta->sta.he_cap.he_cap_elem.mac_cap_info[2] & in ieee80211_assoc_success()
3273 bss_conf->ack_enabled = in ieee80211_assoc_success()
3274 sta->sta.he_cap.he_cap_elem.mac_cap_info[2] & in ieee80211_assoc_success()
3277 bss_conf->uora_exists = !!elems.uora_element; in ieee80211_assoc_success()
3279 bss_conf->uora_ocw_range = elems.uora_element[0]; in ieee80211_assoc_success()
3303 sta->sta.rx_nss = nss; in ieee80211_assoc_success()
3308 if (ifmgd->flags & IEEE80211_STA_MFP_ENABLED) { in ieee80211_assoc_success()
3310 sta->sta.mfp = true; in ieee80211_assoc_success()
3312 sta->sta.mfp = false; in ieee80211_assoc_success()
3315 sta->sta.wme = elems.wmm_param && local->hw.queues >= IEEE80211_NUM_ACS; in ieee80211_assoc_success()
3318 if (!err && !(ifmgd->flags & IEEE80211_STA_CONTROL_PORT)) in ieee80211_assoc_success()
3323 sta->sta.addr); in ieee80211_assoc_success()
3325 mutex_unlock(&sdata->local->sta_mtx); in ieee80211_assoc_success()
3330 mutex_unlock(&sdata->local->sta_mtx); in ieee80211_assoc_success()
3334 * of the first value the AP uses. Setting -1 here has in ieee80211_assoc_success()
3336 * 4-bit value. in ieee80211_assoc_success()
3338 ifmgd->wmm_last_param_set = -1; in ieee80211_assoc_success()
3340 if (ifmgd->flags & IEEE80211_STA_DISABLE_WMM) { in ieee80211_assoc_success()
3347 /* set the disable-WMM flag in this case to disable in ieee80211_assoc_success()
3354 ifmgd->flags |= IEEE80211_STA_DISABLE_WMM; in ieee80211_assoc_success()
3359 bss_conf->max_idle_period = in ieee80211_assoc_success()
3360 le16_to_cpu(elems.max_idle_period_ie->max_idle_period); in ieee80211_assoc_success()
3361 bss_conf->protected_keep_alive = in ieee80211_assoc_success()
3362 !!(elems.max_idle_period_ie->idle_options & in ieee80211_assoc_success()
3366 bss_conf->max_idle_period = 0; in ieee80211_assoc_success()
3367 bss_conf->protected_keep_alive = false; in ieee80211_assoc_success()
3372 bss_conf->aid = aid; in ieee80211_assoc_success()
3373 bss_conf->assoc_capability = capab_info; in ieee80211_assoc_success()
3377 * If we're using 4-addr mode, let the AP know that we're in ieee80211_assoc_success()
3378 * doing so, so that it can create the STA VLAN on its side in ieee80211_assoc_success()
3380 if (ifmgd->use_4addr) in ieee80211_assoc_success()
3400 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_rx_mgmt_assoc_resp()
3401 struct ieee80211_mgd_assoc_data *assoc_data = ifmgd->assoc_data; in ieee80211_rx_mgmt_assoc_resp()
3404 int ac, uapsd_queues = -1; in ieee80211_rx_mgmt_assoc_resp()
3417 if (!ether_addr_equal(assoc_data->bss->bssid, mgmt->bssid)) in ieee80211_rx_mgmt_assoc_resp()
3428 reassoc = ieee80211_is_reassoc_resp(mgmt->frame_control); in ieee80211_rx_mgmt_assoc_resp()
3429 capab_info = le16_to_cpu(mgmt->u.assoc_resp.capab_info); in ieee80211_rx_mgmt_assoc_resp()
3430 status_code = le16_to_cpu(mgmt->u.assoc_resp.status_code); in ieee80211_rx_mgmt_assoc_resp()
3431 aid = le16_to_cpu(mgmt->u.assoc_resp.aid); in ieee80211_rx_mgmt_assoc_resp()
3435 reassoc ? "Rea" : "A", mgmt->sa, in ieee80211_rx_mgmt_assoc_resp()
3438 if (assoc_data->fils_kek_len && in ieee80211_rx_mgmt_assoc_resp()
3442 pos = mgmt->u.assoc_resp.variable; in ieee80211_rx_mgmt_assoc_resp()
3443 ieee802_11_parse_elems(pos, len - (pos - (u8 *) mgmt), false, &elems); in ieee80211_rx_mgmt_assoc_resp()
3447 elems.timeout_int->type == WLAN_TIMEOUT_ASSOC_COMEBACK) { in ieee80211_rx_mgmt_assoc_resp()
3449 tu = le32_to_cpu(elems.timeout_int->value); in ieee80211_rx_mgmt_assoc_resp()
3453 mgmt->sa, tu, ms); in ieee80211_rx_mgmt_assoc_resp()
3454 assoc_data->timeout = jiffies + msecs_to_jiffies(ms); in ieee80211_rx_mgmt_assoc_resp()
3455 assoc_data->timeout_started = true; in ieee80211_rx_mgmt_assoc_resp()
3457 run_again(sdata, assoc_data->timeout); in ieee80211_rx_mgmt_assoc_resp()
3461 bss = assoc_data->bss; in ieee80211_rx_mgmt_assoc_resp()
3465 mgmt->sa, status_code); in ieee80211_rx_mgmt_assoc_resp()
3469 drv_event_callback(sdata->local, sdata, &event); in ieee80211_rx_mgmt_assoc_resp()
3472 /* oops -- internal error -- send timeout for now */ in ieee80211_rx_mgmt_assoc_resp()
3474 cfg80211_assoc_timeout(sdata->dev, bss); in ieee80211_rx_mgmt_assoc_resp()
3478 drv_event_callback(sdata->local, sdata, &event); in ieee80211_rx_mgmt_assoc_resp()
3491 if (sdata->tx_conf[ac].uapsd) in ieee80211_rx_mgmt_assoc_resp()
3495 cfg80211_rx_assoc_resp(sdata->dev, bss, (u8 *)mgmt, len, uapsd_queues); in ieee80211_rx_mgmt_assoc_resp()
3503 struct ieee80211_local *local = sdata->local; in ieee80211_rx_bss_info()
3509 channel = ieee80211_get_channel(local->hw.wiphy, rx_status->freq); in ieee80211_rx_bss_info()
3516 sdata->vif.bss_conf.beacon_rate = bss->beacon_rate; in ieee80211_rx_bss_info()
3525 struct ieee80211_mgmt *mgmt = (void *)skb->data; in ieee80211_rx_mgmt_probe_resp()
3527 struct ieee80211_rx_status *rx_status = (void *) skb->cb; in ieee80211_rx_mgmt_probe_resp()
3528 size_t baselen, len = skb->len; in ieee80211_rx_mgmt_probe_resp()
3531 ifmgd = &sdata->u.mgd; in ieee80211_rx_mgmt_probe_resp()
3535 if (!ether_addr_equal(mgmt->da, sdata->vif.addr)) in ieee80211_rx_mgmt_probe_resp()
3538 baselen = (u8 *) mgmt->u.probe_resp.variable - (u8 *) mgmt; in ieee80211_rx_mgmt_probe_resp()
3542 ieee802_11_parse_elems(mgmt->u.probe_resp.variable, len - baselen, in ieee80211_rx_mgmt_probe_resp()
3547 if (ifmgd->associated && in ieee80211_rx_mgmt_probe_resp()
3548 ether_addr_equal(mgmt->bssid, ifmgd->associated->bssid)) in ieee80211_rx_mgmt_probe_resp()
3563 * XXX: This list needs to be dynamic -- userspace needs to be able to
3584 if (ifmgd->flags & IEEE80211_STA_RESET_SIGNAL_AVE) { in ieee80211_handle_beacon_sig()
3585 ifmgd->flags &= ~IEEE80211_STA_RESET_SIGNAL_AVE; in ieee80211_handle_beacon_sig()
3586 ewma_beacon_signal_init(&ifmgd->ave_beacon_signal); in ieee80211_handle_beacon_sig()
3587 ifmgd->last_cqm_event_signal = 0; in ieee80211_handle_beacon_sig()
3588 ifmgd->count_beacon_signal = 1; in ieee80211_handle_beacon_sig()
3589 ifmgd->last_ave_beacon_signal = 0; in ieee80211_handle_beacon_sig()
3591 ifmgd->count_beacon_signal++; in ieee80211_handle_beacon_sig()
3594 ewma_beacon_signal_add(&ifmgd->ave_beacon_signal, -rx_status->signal); in ieee80211_handle_beacon_sig()
3596 if (ifmgd->rssi_min_thold != ifmgd->rssi_max_thold && in ieee80211_handle_beacon_sig()
3597 ifmgd->count_beacon_signal >= IEEE80211_SIGNAL_AVE_MIN_COUNT) { in ieee80211_handle_beacon_sig()
3598 int sig = -ewma_beacon_signal_read(&ifmgd->ave_beacon_signal); in ieee80211_handle_beacon_sig()
3599 int last_sig = ifmgd->last_ave_beacon_signal; in ieee80211_handle_beacon_sig()
3608 if (sig > ifmgd->rssi_max_thold && in ieee80211_handle_beacon_sig()
3609 (last_sig <= ifmgd->rssi_min_thold || last_sig == 0)) { in ieee80211_handle_beacon_sig()
3610 ifmgd->last_ave_beacon_signal = sig; in ieee80211_handle_beacon_sig()
3613 } else if (sig < ifmgd->rssi_min_thold && in ieee80211_handle_beacon_sig()
3614 (last_sig >= ifmgd->rssi_max_thold || in ieee80211_handle_beacon_sig()
3616 ifmgd->last_ave_beacon_signal = sig; in ieee80211_handle_beacon_sig()
3622 if (bss_conf->cqm_rssi_thold && in ieee80211_handle_beacon_sig()
3623 ifmgd->count_beacon_signal >= IEEE80211_SIGNAL_AVE_MIN_COUNT && in ieee80211_handle_beacon_sig()
3624 !(sdata->vif.driver_flags & IEEE80211_VIF_SUPPORTS_CQM_RSSI)) { in ieee80211_handle_beacon_sig()
3625 int sig = -ewma_beacon_signal_read(&ifmgd->ave_beacon_signal); in ieee80211_handle_beacon_sig()
3626 int last_event = ifmgd->last_cqm_event_signal; in ieee80211_handle_beacon_sig()
3627 int thold = bss_conf->cqm_rssi_thold; in ieee80211_handle_beacon_sig()
3628 int hyst = bss_conf->cqm_rssi_hyst; in ieee80211_handle_beacon_sig()
3631 (last_event == 0 || sig < last_event - hyst)) { in ieee80211_handle_beacon_sig()
3632 ifmgd->last_cqm_event_signal = sig; in ieee80211_handle_beacon_sig()
3634 &sdata->vif, in ieee80211_handle_beacon_sig()
3639 ifmgd->last_cqm_event_signal = sig; in ieee80211_handle_beacon_sig()
3641 &sdata->vif, in ieee80211_handle_beacon_sig()
3647 if (bss_conf->cqm_rssi_low && in ieee80211_handle_beacon_sig()
3648 ifmgd->count_beacon_signal >= IEEE80211_SIGNAL_AVE_MIN_COUNT) { in ieee80211_handle_beacon_sig()
3649 int sig = -ewma_beacon_signal_read(&ifmgd->ave_beacon_signal); in ieee80211_handle_beacon_sig()
3650 int last_event = ifmgd->last_cqm_event_signal; in ieee80211_handle_beacon_sig()
3651 int low = bss_conf->cqm_rssi_low; in ieee80211_handle_beacon_sig()
3652 int high = bss_conf->cqm_rssi_high; in ieee80211_handle_beacon_sig()
3656 ifmgd->last_cqm_event_signal = sig; in ieee80211_handle_beacon_sig()
3658 &sdata->vif, in ieee80211_handle_beacon_sig()
3663 ifmgd->last_cqm_event_signal = sig; in ieee80211_handle_beacon_sig()
3665 &sdata->vif, in ieee80211_handle_beacon_sig()
3676 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_rx_mgmt_beacon()
3677 struct ieee80211_bss_conf *bss_conf = &sdata->vif.bss_conf; in ieee80211_rx_mgmt_beacon()
3680 struct ieee80211_local *local = sdata->local; in ieee80211_rx_mgmt_beacon()
3694 baselen = (u8 *) mgmt->u.beacon.variable - (u8 *) mgmt; in ieee80211_rx_mgmt_beacon()
3699 chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); in ieee80211_rx_mgmt_beacon()
3705 if (rx_status->freq != chanctx_conf->def.chan->center_freq) { in ieee80211_rx_mgmt_beacon()
3709 chan = chanctx_conf->def.chan; in ieee80211_rx_mgmt_beacon()
3712 if (ifmgd->assoc_data && ifmgd->assoc_data->need_beacon && in ieee80211_rx_mgmt_beacon()
3713 ether_addr_equal(mgmt->bssid, ifmgd->assoc_data->bss->bssid)) { in ieee80211_rx_mgmt_beacon()
3714 ieee802_11_parse_elems(mgmt->u.beacon.variable, in ieee80211_rx_mgmt_beacon()
3715 len - baselen, false, &elems); in ieee80211_rx_mgmt_beacon()
3720 ifmgd->dtim_period = tim_ie->dtim_period; in ieee80211_rx_mgmt_beacon()
3722 ifmgd->have_beacon = true; in ieee80211_rx_mgmt_beacon()
3723 ifmgd->assoc_data->need_beacon = false; in ieee80211_rx_mgmt_beacon()
3724 if (ieee80211_hw_check(&local->hw, TIMING_BEACON_ONLY)) { in ieee80211_rx_mgmt_beacon()
3725 sdata->vif.bss_conf.sync_tsf = in ieee80211_rx_mgmt_beacon()
3726 le64_to_cpu(mgmt->u.beacon.timestamp); in ieee80211_rx_mgmt_beacon()
3727 sdata->vif.bss_conf.sync_device_ts = in ieee80211_rx_mgmt_beacon()
3728 rx_status->device_timestamp; in ieee80211_rx_mgmt_beacon()
3730 sdata->vif.bss_conf.sync_dtim_count = in ieee80211_rx_mgmt_beacon()
3731 elems.tim->dtim_count; in ieee80211_rx_mgmt_beacon()
3733 sdata->vif.bss_conf.sync_dtim_count = 0; in ieee80211_rx_mgmt_beacon()
3736 ifmgd->assoc_data->timeout = jiffies; in ieee80211_rx_mgmt_beacon()
3737 ifmgd->assoc_data->timeout_started = true; in ieee80211_rx_mgmt_beacon()
3738 run_again(sdata, ifmgd->assoc_data->timeout); in ieee80211_rx_mgmt_beacon()
3742 if (!ifmgd->associated || in ieee80211_rx_mgmt_beacon()
3743 !ether_addr_equal(mgmt->bssid, ifmgd->associated->bssid)) in ieee80211_rx_mgmt_beacon()
3745 bssid = ifmgd->associated->bssid; in ieee80211_rx_mgmt_beacon()
3747 if (!(rx_status->flag & RX_FLAG_NO_SIGNAL_VAL)) in ieee80211_rx_mgmt_beacon()
3751 if (ifmgd->flags & IEEE80211_STA_CONNECTION_POLL) { in ieee80211_rx_mgmt_beacon()
3763 ncrc = crc32_be(0, (void *)&mgmt->u.beacon.beacon_int, 4); in ieee80211_rx_mgmt_beacon()
3764 ncrc = ieee802_11_parse_elems_crc(mgmt->u.beacon.variable, in ieee80211_rx_mgmt_beacon()
3765 len - baselen, false, &elems, in ieee80211_rx_mgmt_beacon()
3768 if (ieee80211_hw_check(&local->hw, PS_NULLFUNC_STACK) && in ieee80211_rx_mgmt_beacon()
3769 ieee80211_check_tim(elems.tim, elems.tim_len, ifmgd->aid)) { in ieee80211_rx_mgmt_beacon()
3770 if (local->hw.conf.dynamic_ps_timeout > 0) { in ieee80211_rx_mgmt_beacon()
3771 if (local->hw.conf.flags & IEEE80211_CONF_PS) { in ieee80211_rx_mgmt_beacon()
3772 local->hw.conf.flags &= ~IEEE80211_CONF_PS; in ieee80211_rx_mgmt_beacon()
3777 } else if (!local->pspolling && sdata->u.mgd.powersave) { in ieee80211_rx_mgmt_beacon()
3778 local->pspolling = true; in ieee80211_rx_mgmt_beacon()
3782 * able to send ps-poll frame and receive a in ieee80211_rx_mgmt_beacon()
3792 if (sdata->vif.p2p || in ieee80211_rx_mgmt_beacon()
3793 sdata->vif.driver_flags & IEEE80211_VIF_GET_NOA_UPDATE) { in ieee80211_rx_mgmt_beacon()
3797 ret = cfg80211_get_p2p_attr(mgmt->u.beacon.variable, in ieee80211_rx_mgmt_beacon()
3798 len - baselen, in ieee80211_rx_mgmt_beacon()
3802 if (sdata->u.mgd.p2p_noa_index != noa.index) { in ieee80211_rx_mgmt_beacon()
3804 sdata->u.mgd.p2p_noa_index = noa.index; in ieee80211_rx_mgmt_beacon()
3805 memcpy(&bss_conf->p2p_noa_attr, &noa, sizeof(noa)); in ieee80211_rx_mgmt_beacon()
3811 ifmgd->beacon_crc_valid = false; in ieee80211_rx_mgmt_beacon()
3813 } else if (sdata->u.mgd.p2p_noa_index != -1) { in ieee80211_rx_mgmt_beacon()
3815 sdata->u.mgd.p2p_noa_index = -1; in ieee80211_rx_mgmt_beacon()
3816 memset(&bss_conf->p2p_noa_attr, 0, sizeof(bss_conf->p2p_noa_attr)); in ieee80211_rx_mgmt_beacon()
3818 ifmgd->beacon_crc_valid = false; in ieee80211_rx_mgmt_beacon()
3822 if (ifmgd->csa_waiting_bcn) in ieee80211_rx_mgmt_beacon()
3833 if (ieee80211_hw_check(&local->hw, TIMING_BEACON_ONLY)) { in ieee80211_rx_mgmt_beacon()
3834 sdata->vif.bss_conf.sync_tsf = in ieee80211_rx_mgmt_beacon()
3835 le64_to_cpu(mgmt->u.beacon.timestamp); in ieee80211_rx_mgmt_beacon()
3836 sdata->vif.bss_conf.sync_device_ts = in ieee80211_rx_mgmt_beacon()
3837 rx_status->device_timestamp; in ieee80211_rx_mgmt_beacon()
3839 sdata->vif.bss_conf.sync_dtim_count = in ieee80211_rx_mgmt_beacon()
3840 elems.tim->dtim_count; in ieee80211_rx_mgmt_beacon()
3842 sdata->vif.bss_conf.sync_dtim_count = 0; in ieee80211_rx_mgmt_beacon()
3845 if (ncrc == ifmgd->beacon_crc && ifmgd->beacon_crc_valid) in ieee80211_rx_mgmt_beacon()
3847 ifmgd->beacon_crc = ncrc; in ieee80211_rx_mgmt_beacon()
3848 ifmgd->beacon_crc_valid = true; in ieee80211_rx_mgmt_beacon()
3852 ieee80211_sta_process_chanswitch(sdata, rx_status->mactime, in ieee80211_rx_mgmt_beacon()
3853 rx_status->device_timestamp, in ieee80211_rx_mgmt_beacon()
3856 if (!(ifmgd->flags & IEEE80211_STA_DISABLE_WMM) && in ieee80211_rx_mgmt_beacon()
3866 if (!ifmgd->have_beacon) { in ieee80211_rx_mgmt_beacon()
3869 bss_conf->dtim_period = elems.tim->dtim_period ?: 1; in ieee80211_rx_mgmt_beacon()
3871 bss_conf->dtim_period = 1; in ieee80211_rx_mgmt_beacon()
3874 ifmgd->have_beacon = true; in ieee80211_rx_mgmt_beacon()
3876 mutex_lock(&local->iflist_mtx); in ieee80211_rx_mgmt_beacon()
3878 mutex_unlock(&local->iflist_mtx); in ieee80211_rx_mgmt_beacon()
3890 le16_to_cpu(mgmt->u.beacon.capab_info), in ieee80211_rx_mgmt_beacon()
3893 mutex_lock(&local->sta_mtx); in ieee80211_rx_mgmt_beacon()
3900 mutex_unlock(&local->sta_mtx); in ieee80211_rx_mgmt_beacon()
3915 rx_status->band); in ieee80211_rx_mgmt_beacon()
3916 mutex_unlock(&local->sta_mtx); in ieee80211_rx_mgmt_beacon()
3936 rx_status = (struct ieee80211_rx_status *) skb->cb; in ieee80211_sta_rx_queued_mgmt()
3937 mgmt = (struct ieee80211_mgmt *) skb->data; in ieee80211_sta_rx_queued_mgmt()
3938 fc = le16_to_cpu(mgmt->frame_control); in ieee80211_sta_rx_queued_mgmt()
3944 ieee80211_rx_mgmt_beacon(sdata, mgmt, skb->len, rx_status); in ieee80211_sta_rx_queued_mgmt()
3950 ieee80211_rx_mgmt_auth(sdata, mgmt, skb->len); in ieee80211_sta_rx_queued_mgmt()
3953 ieee80211_rx_mgmt_deauth(sdata, mgmt, skb->len); in ieee80211_sta_rx_queued_mgmt()
3956 ieee80211_rx_mgmt_disassoc(sdata, mgmt, skb->len); in ieee80211_sta_rx_queued_mgmt()
3960 ieee80211_rx_mgmt_assoc_resp(sdata, mgmt, skb->len); in ieee80211_sta_rx_queued_mgmt()
3963 if (mgmt->u.action.category == WLAN_CATEGORY_SPECTRUM_MGMT) { in ieee80211_sta_rx_queued_mgmt()
3964 ies_len = skb->len - in ieee80211_sta_rx_queued_mgmt()
3972 mgmt->u.action.u.chan_switch.variable, in ieee80211_sta_rx_queued_mgmt()
3979 rx_status->mactime, in ieee80211_sta_rx_queued_mgmt()
3980 rx_status->device_timestamp, in ieee80211_sta_rx_queued_mgmt()
3982 } else if (mgmt->u.action.category == WLAN_CATEGORY_PUBLIC) { in ieee80211_sta_rx_queued_mgmt()
3983 ies_len = skb->len - in ieee80211_sta_rx_queued_mgmt()
3991 mgmt->u.action.u.ext_chan_switch.variable, in ieee80211_sta_rx_queued_mgmt()
3999 &mgmt->u.action.u.ext_chan_switch.data; in ieee80211_sta_rx_queued_mgmt()
4002 rx_status->mactime, in ieee80211_sta_rx_queued_mgmt()
4003 rx_status->device_timestamp, in ieee80211_sta_rx_queued_mgmt()
4016 ieee80211_queue_work(&sdata->local->hw, &sdata->work); in ieee80211_sta_timer()
4033 struct ieee80211_local *local = sdata->local; in ieee80211_auth()
4034 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_auth()
4035 struct ieee80211_mgd_auth_data *auth_data = ifmgd->auth_data; in ieee80211_auth()
4044 return -EINVAL; in ieee80211_auth()
4046 auth_data->tries++; in ieee80211_auth()
4048 if (auth_data->tries > IEEE80211_AUTH_MAX_TRIES) { in ieee80211_auth()
4050 auth_data->bss->bssid); in ieee80211_auth()
4056 cfg80211_unlink_bss(local->hw.wiphy, auth_data->bss); in ieee80211_auth()
4058 return -ETIMEDOUT; in ieee80211_auth()
4061 if (auth_data->algorithm == WLAN_AUTH_SAE) in ieee80211_auth()
4068 auth_data->bss->bssid, auth_data->tries, in ieee80211_auth()
4071 auth_data->expected_transaction = 2; in ieee80211_auth()
4073 if (auth_data->algorithm == WLAN_AUTH_SAE) { in ieee80211_auth()
4074 trans = auth_data->sae_trans; in ieee80211_auth()
4075 status = auth_data->sae_status; in ieee80211_auth()
4076 auth_data->expected_transaction = trans; in ieee80211_auth()
4079 if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) in ieee80211_auth()
4083 ieee80211_send_auth(sdata, trans, auth_data->algorithm, status, in ieee80211_auth()
4084 auth_data->data, auth_data->data_len, in ieee80211_auth()
4085 auth_data->bss->bssid, in ieee80211_auth()
4086 auth_data->bss->bssid, NULL, 0, 0, in ieee80211_auth()
4090 if (auth_data->algorithm == WLAN_AUTH_SAE) in ieee80211_auth()
4091 auth_data->timeout = jiffies + in ieee80211_auth()
4094 auth_data->timeout = jiffies + IEEE80211_AUTH_TIMEOUT; in ieee80211_auth()
4096 auth_data->timeout = in ieee80211_auth()
4100 auth_data->timeout_started = true; in ieee80211_auth()
4101 run_again(sdata, auth_data->timeout); in ieee80211_auth()
4108 struct ieee80211_mgd_assoc_data *assoc_data = sdata->u.mgd.assoc_data; in ieee80211_do_assoc()
4109 struct ieee80211_local *local = sdata->local; in ieee80211_do_assoc()
4113 assoc_data->tries++; in ieee80211_do_assoc()
4114 if (assoc_data->tries > IEEE80211_ASSOC_MAX_TRIES) { in ieee80211_do_assoc()
4116 assoc_data->bss->bssid); in ieee80211_do_assoc()
4122 cfg80211_unlink_bss(local->hw.wiphy, assoc_data->bss); in ieee80211_do_assoc()
4124 return -ETIMEDOUT; in ieee80211_do_assoc()
4128 assoc_data->bss->bssid, assoc_data->tries, in ieee80211_do_assoc()
4132 if (!ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) { in ieee80211_do_assoc()
4133 assoc_data->timeout = jiffies + IEEE80211_ASSOC_TIMEOUT; in ieee80211_do_assoc()
4134 assoc_data->timeout_started = true; in ieee80211_do_assoc()
4135 run_again(sdata, assoc_data->timeout); in ieee80211_do_assoc()
4137 assoc_data->timeout = in ieee80211_do_assoc()
4140 assoc_data->timeout_started = true; in ieee80211_do_assoc()
4141 run_again(sdata, assoc_data->timeout); in ieee80211_do_assoc()
4150 struct ieee80211_local *local = sdata->local; in ieee80211_mgd_conn_tx_status()
4152 sdata->u.mgd.status_fc = fc; in ieee80211_mgd_conn_tx_status()
4153 sdata->u.mgd.status_acked = acked; in ieee80211_mgd_conn_tx_status()
4154 sdata->u.mgd.status_received = true; in ieee80211_mgd_conn_tx_status()
4156 ieee80211_queue_work(&local->hw, &sdata->work); in ieee80211_mgd_conn_tx_status()
4161 struct ieee80211_local *local = sdata->local; in ieee80211_sta_work()
4162 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_sta_work()
4166 if (ifmgd->status_received) { in ieee80211_sta_work()
4167 __le16 fc = ifmgd->status_fc; in ieee80211_sta_work()
4168 bool status_acked = ifmgd->status_acked; in ieee80211_sta_work()
4170 ifmgd->status_received = false; in ieee80211_sta_work()
4171 if (ifmgd->auth_data && ieee80211_is_auth(fc)) { in ieee80211_sta_work()
4173 if (ifmgd->auth_data->algorithm == in ieee80211_sta_work()
4175 ifmgd->auth_data->timeout = in ieee80211_sta_work()
4179 ifmgd->auth_data->timeout = in ieee80211_sta_work()
4182 run_again(sdata, ifmgd->auth_data->timeout); in ieee80211_sta_work()
4184 ifmgd->auth_data->timeout = jiffies - 1; in ieee80211_sta_work()
4186 ifmgd->auth_data->timeout_started = true; in ieee80211_sta_work()
4187 } else if (ifmgd->assoc_data && in ieee80211_sta_work()
4191 ifmgd->assoc_data->timeout = in ieee80211_sta_work()
4193 run_again(sdata, ifmgd->assoc_data->timeout); in ieee80211_sta_work()
4195 ifmgd->assoc_data->timeout = jiffies - 1; in ieee80211_sta_work()
4197 ifmgd->assoc_data->timeout_started = true; in ieee80211_sta_work()
4201 if (ifmgd->auth_data && ifmgd->auth_data->timeout_started && in ieee80211_sta_work()
4202 time_after(jiffies, ifmgd->auth_data->timeout)) { in ieee80211_sta_work()
4203 if (ifmgd->auth_data->done) { in ieee80211_sta_work()
4217 memcpy(bssid, ifmgd->auth_data->bss->bssid, ETH_ALEN); in ieee80211_sta_work()
4221 cfg80211_auth_timeout(sdata->dev, bssid); in ieee80211_sta_work()
4222 drv_event_callback(sdata->local, sdata, &event); in ieee80211_sta_work()
4224 } else if (ifmgd->auth_data && ifmgd->auth_data->timeout_started) in ieee80211_sta_work()
4225 run_again(sdata, ifmgd->auth_data->timeout); in ieee80211_sta_work()
4227 if (ifmgd->assoc_data && ifmgd->assoc_data->timeout_started && in ieee80211_sta_work()
4228 time_after(jiffies, ifmgd->assoc_data->timeout)) { in ieee80211_sta_work()
4229 if ((ifmgd->assoc_data->need_beacon && !ifmgd->have_beacon) || in ieee80211_sta_work()
4231 struct cfg80211_bss *bss = ifmgd->assoc_data->bss; in ieee80211_sta_work()
4239 cfg80211_assoc_timeout(sdata->dev, bss); in ieee80211_sta_work()
4240 drv_event_callback(sdata->local, sdata, &event); in ieee80211_sta_work()
4242 } else if (ifmgd->assoc_data && ifmgd->assoc_data->timeout_started) in ieee80211_sta_work()
4243 run_again(sdata, ifmgd->assoc_data->timeout); in ieee80211_sta_work()
4245 if (ifmgd->flags & IEEE80211_STA_CONNECTION_POLL && in ieee80211_sta_work()
4246 ifmgd->associated) { in ieee80211_sta_work()
4250 memcpy(bssid, ifmgd->associated->bssid, ETH_ALEN); in ieee80211_sta_work()
4252 if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) in ieee80211_sta_work()
4258 if (!ifmgd->probe_send_count) in ieee80211_sta_work()
4260 else if (ifmgd->nullfunc_failed) { in ieee80211_sta_work()
4261 if (ifmgd->probe_send_count < max_tries) { in ieee80211_sta_work()
4264 bssid, ifmgd->probe_send_count, in ieee80211_sta_work()
4275 } else if (time_is_after_jiffies(ifmgd->probe_timeout)) in ieee80211_sta_work()
4276 run_again(sdata, ifmgd->probe_timeout); in ieee80211_sta_work()
4277 else if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) { in ieee80211_sta_work()
4283 } else if (ifmgd->probe_send_count < max_tries) { in ieee80211_sta_work()
4287 ifmgd->probe_send_count, max_tries); in ieee80211_sta_work()
4310 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_sta_bcn_mon_timer()
4312 if (sdata->vif.csa_active && !ifmgd->csa_waiting_bcn) in ieee80211_sta_bcn_mon_timer()
4315 sdata->u.mgd.connection_loss = false; in ieee80211_sta_bcn_mon_timer()
4316 ieee80211_queue_work(&sdata->local->hw, in ieee80211_sta_bcn_mon_timer()
4317 &sdata->u.mgd.beacon_connection_loss_work); in ieee80211_sta_bcn_mon_timer()
4324 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_sta_conn_mon_timer()
4325 struct ieee80211_local *local = sdata->local; in ieee80211_sta_conn_mon_timer()
4327 if (sdata->vif.csa_active && !ifmgd->csa_waiting_bcn) in ieee80211_sta_conn_mon_timer()
4330 ieee80211_queue_work(&local->hw, &ifmgd->monitor_work); in ieee80211_sta_conn_mon_timer()
4344 if (sdata->vif.type == NL80211_IFTYPE_STATION) { in ieee80211_restart_sta_timer()
4348 if (!ieee80211_hw_check(&sdata->local->hw, CONNECTION_MONITOR)) in ieee80211_restart_sta_timer()
4349 ieee80211_queue_work(&sdata->local->hw, in ieee80211_restart_sta_timer()
4350 &sdata->u.mgd.monitor_work); in ieee80211_restart_sta_timer()
4357 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_mgd_quiesce()
4362 if (ifmgd->auth_data || ifmgd->assoc_data) { in ieee80211_mgd_quiesce()
4363 const u8 *bssid = ifmgd->auth_data ? in ieee80211_mgd_quiesce()
4364 ifmgd->auth_data->bss->bssid : in ieee80211_mgd_quiesce()
4365 ifmgd->assoc_data->bss->bssid; in ieee80211_mgd_quiesce()
4376 if (ifmgd->assoc_data) in ieee80211_mgd_quiesce()
4378 if (ifmgd->auth_data) in ieee80211_mgd_quiesce()
4380 cfg80211_tx_mlme_mgmt(sdata->dev, frame_buf, in ieee80211_mgd_quiesce()
4384 /* This is a bit of a hack - we should find a better and more generic in ieee80211_mgd_quiesce()
4401 if (ifmgd->associated && !sdata->local->wowlan) { in ieee80211_mgd_quiesce()
4408 memcpy(bssid, ifmgd->associated->bssid, ETH_ALEN); in ieee80211_mgd_quiesce()
4417 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_sta_restart()
4420 if (!ifmgd->associated) { in ieee80211_sta_restart()
4425 if (sdata->flags & IEEE80211_SDATA_DISCONNECT_RESUME) { in ieee80211_sta_restart()
4426 sdata->flags &= ~IEEE80211_SDATA_DISCONNECT_RESUME; in ieee80211_sta_restart()
4429 ifmgd->associated->bssid, in ieee80211_sta_restart()
4444 ifmgd = &sdata->u.mgd; in ieee80211_sta_setup_sdata()
4445 INIT_WORK(&ifmgd->monitor_work, ieee80211_sta_monitor_work); in ieee80211_sta_setup_sdata()
4446 INIT_WORK(&ifmgd->chswitch_work, ieee80211_chswitch_work); in ieee80211_sta_setup_sdata()
4447 INIT_WORK(&ifmgd->beacon_connection_loss_work, in ieee80211_sta_setup_sdata()
4449 INIT_WORK(&ifmgd->csa_connection_drop_work, in ieee80211_sta_setup_sdata()
4451 INIT_WORK(&ifmgd->request_smps_work, ieee80211_request_smps_mgd_work); in ieee80211_sta_setup_sdata()
4452 INIT_DELAYED_WORK(&ifmgd->tdls_peer_del_work, in ieee80211_sta_setup_sdata()
4454 timer_setup(&ifmgd->timer, ieee80211_sta_timer, 0); in ieee80211_sta_setup_sdata()
4455 timer_setup(&ifmgd->bcn_mon_timer, ieee80211_sta_bcn_mon_timer, 0); in ieee80211_sta_setup_sdata()
4456 timer_setup(&ifmgd->conn_mon_timer, ieee80211_sta_conn_mon_timer, 0); in ieee80211_sta_setup_sdata()
4457 timer_setup(&ifmgd->chswitch_timer, ieee80211_chswitch_timer, 0); in ieee80211_sta_setup_sdata()
4458 INIT_DELAYED_WORK(&ifmgd->tx_tspec_wk, in ieee80211_sta_setup_sdata()
4461 ifmgd->flags = 0; in ieee80211_sta_setup_sdata()
4462 ifmgd->powersave = sdata->wdev.ps; in ieee80211_sta_setup_sdata()
4463 ifmgd->uapsd_queues = sdata->local->hw.uapsd_queues; in ieee80211_sta_setup_sdata()
4464 ifmgd->uapsd_max_sp_len = sdata->local->hw.uapsd_max_sp_len; in ieee80211_sta_setup_sdata()
4465 ifmgd->p2p_noa_index = -1; in ieee80211_sta_setup_sdata()
4467 if (sdata->local->hw.wiphy->features & NL80211_FEATURE_DYNAMIC_SMPS) in ieee80211_sta_setup_sdata()
4468 ifmgd->req_smps = IEEE80211_SMPS_AUTOMATIC; in ieee80211_sta_setup_sdata()
4470 ifmgd->req_smps = IEEE80211_SMPS_OFF; in ieee80211_sta_setup_sdata()
4473 spin_lock_init(&ifmgd->teardown_lock); in ieee80211_sta_setup_sdata()
4474 ifmgd->teardown_skb = NULL; in ieee80211_sta_setup_sdata()
4475 ifmgd->orig_teardown_skb = NULL; in ieee80211_sta_setup_sdata()
4485 list_for_each_entry_rcu(sdata, &local->interfaces, list) { in ieee80211_mlme_notify_scan_completed()
4495 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_ht_vht_rx_chains()
4501 if (ifmgd->flags & IEEE80211_STA_DISABLE_HT) in ieee80211_ht_vht_rx_chains()
4507 chains = ieee80211_mcs_to_chains(&ht_cap->mcs); in ieee80211_ht_vht_rx_chains()
4514 if (ifmgd->flags & IEEE80211_STA_DISABLE_VHT) in ieee80211_ht_vht_rx_chains()
4523 tx_mcs_map = le16_to_cpu(vht_cap->supp_mcs.tx_mcs_map); in ieee80211_ht_vht_rx_chains()
4524 for (nss = 8; nss > 0; nss--) { in ieee80211_ht_vht_rx_chains()
4525 if (((tx_mcs_map >> (2 * (nss - 1))) & 3) != in ieee80211_ht_vht_rx_chains()
4548 ap_min_req_set = le16_to_cpu(he_op->he_mcs_nss_set); in ieee80211_verify_sta_he_mcs_support()
4553 &sta_he_cap->he_mcs_nss_supp; in ieee80211_verify_sta_he_mcs_support()
4563 * possible. Each of the sta_mcs_map_* is a 16-bit struct built in ieee80211_verify_sta_he_mcs_support()
4564 * of 2 bits per NSS (1-8), with the values defined in enum in ieee80211_verify_sta_he_mcs_support()
4570 for (nss = 8; nss > 0; nss--) { in ieee80211_verify_sta_he_mcs_support()
4571 u8 sta_rx_val = (sta_mcs_map_rx >> (2 * (nss - 1))) & 3; in ieee80211_verify_sta_he_mcs_support()
4572 u8 sta_tx_val = (sta_mcs_map_tx >> (2 * (nss - 1))) & 3; in ieee80211_verify_sta_he_mcs_support()
4573 u8 ap_val = (ap_min_req_set >> (2 * (nss - 1))) & 3; in ieee80211_verify_sta_he_mcs_support()
4601 struct ieee80211_local *local = sdata->local; in ieee80211_prep_channel()
4602 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_prep_channel()
4613 sband = local->hw.wiphy->bands[cbss->channel->band]; in ieee80211_prep_channel()
4615 ifmgd->flags &= ~(IEEE80211_STA_DISABLE_40MHZ | in ieee80211_prep_channel()
4621 if (!(ifmgd->flags & IEEE80211_STA_DISABLE_HT) && in ieee80211_prep_channel()
4622 sband->ht_cap.ht_supported) { in ieee80211_prep_channel()
4634 ifmgd->flags |= IEEE80211_STA_DISABLE_HT; in ieee80211_prep_channel()
4639 if (!(ifmgd->flags & IEEE80211_STA_DISABLE_VHT) && in ieee80211_prep_channel()
4640 sband->vht_cap.vht_supported) { in ieee80211_prep_channel()
4651 ifmgd->flags |= IEEE80211_STA_DISABLE_HT; in ieee80211_prep_channel()
4652 ifmgd->flags |= IEEE80211_STA_DISABLE_VHT; in ieee80211_prep_channel()
4657 ifmgd->flags |= IEEE80211_STA_DISABLE_VHT; in ieee80211_prep_channel()
4662 if (!(ifmgd->flags & IEEE80211_STA_DISABLE_HE) && in ieee80211_prep_channel()
4667 ies = rcu_dereference(cbss->ies); in ieee80211_prep_channel()
4669 ies->data, ies->len); in ieee80211_prep_channel()
4677 ifmgd->flags |= IEEE80211_STA_DISABLE_HE; in ieee80211_prep_channel()
4682 for (i = 0; i < sband->n_channels; i++) { in ieee80211_prep_channel()
4683 if (sband->channels[i].flags & (IEEE80211_CHAN_DISABLED | in ieee80211_prep_channel()
4692 ifmgd->flags |= IEEE80211_STA_DISABLE_VHT; in ieee80211_prep_channel()
4694 ifmgd->flags |= ieee80211_determine_chantype(sdata, sband, in ieee80211_prep_channel()
4695 cbss->channel, in ieee80211_prep_channel()
4699 sdata->needed_rx_chains = min(ieee80211_ht_vht_rx_chains(sdata, cbss), in ieee80211_prep_channel()
4700 local->rx_chains); in ieee80211_prep_channel()
4705 sdata->smps_mode = IEEE80211_SMPS_OFF; in ieee80211_prep_channel()
4707 mutex_lock(&local->mtx); in ieee80211_prep_channel()
4722 ifmgd->flags |= ieee80211_chandef_downgrade(&chandef); in ieee80211_prep_channel()
4727 mutex_unlock(&local->mtx); in ieee80211_prep_channel()
4735 struct ieee80211_local *local = sdata->local; in ieee80211_prep_connection()
4736 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_prep_connection()
4737 struct ieee80211_bss *bss = (void *)cbss->priv; in ieee80211_prep_connection()
4743 sband = local->hw.wiphy->bands[cbss->channel->band]; in ieee80211_prep_connection()
4745 if (WARN_ON(!ifmgd->auth_data && !ifmgd->assoc_data)) in ieee80211_prep_connection()
4746 return -EINVAL; in ieee80211_prep_connection()
4749 if (local->in_reconfig) in ieee80211_prep_connection()
4750 return -EBUSY; in ieee80211_prep_connection()
4754 have_sta = sta_info_get(sdata, cbss->bssid); in ieee80211_prep_connection()
4759 new_sta = sta_info_alloc(sdata, cbss->bssid, GFP_KERNEL); in ieee80211_prep_connection()
4761 return -ENOMEM; in ieee80211_prep_connection()
4766 * new channel. We can't - completely race-free - change the basic in ieee80211_prep_connection()
4770 * call that from changing the channel - only for IDLE and perhaps in ieee80211_prep_connection()
4780 int min_rate = INT_MAX, min_rate_index = -1; in ieee80211_prep_connection()
4782 int shift = ieee80211_vif_get_shift(&sdata->vif); in ieee80211_prep_connection()
4784 ieee80211_get_rates(sband, bss->supp_rates, in ieee80211_prep_connection()
4785 bss->supp_rates_len, in ieee80211_prep_connection()
4797 * we can connect -- with a warning. in ieee80211_prep_connection()
4805 new_sta->sta.supp_rates[cbss->channel->band] = rates; in ieee80211_prep_connection()
4806 sdata->vif.bss_conf.basic_rates = basic_rates; in ieee80211_prep_connection()
4809 if (cbss->channel->band == NL80211_BAND_2GHZ && in ieee80211_prep_connection()
4811 sdata->flags |= IEEE80211_SDATA_OPERATING_GMODE; in ieee80211_prep_connection()
4813 sdata->flags &= ~IEEE80211_SDATA_OPERATING_GMODE; in ieee80211_prep_connection()
4815 memcpy(ifmgd->bssid, cbss->bssid, ETH_ALEN); in ieee80211_prep_connection()
4818 sdata->vif.bss_conf.beacon_int = cbss->beacon_interval; in ieee80211_prep_connection()
4820 ies = rcu_dereference(cbss->beacon_ies); in ieee80211_prep_connection()
4824 sdata->vif.bss_conf.sync_tsf = ies->tsf; in ieee80211_prep_connection()
4825 sdata->vif.bss_conf.sync_device_ts = in ieee80211_prep_connection()
4826 bss->device_ts_beacon; in ieee80211_prep_connection()
4828 ies->data, ies->len); in ieee80211_prep_connection()
4830 sdata->vif.bss_conf.sync_dtim_count = tim_ie[2]; in ieee80211_prep_connection()
4832 sdata->vif.bss_conf.sync_dtim_count = 0; in ieee80211_prep_connection()
4833 } else if (!ieee80211_hw_check(&sdata->local->hw, in ieee80211_prep_connection()
4835 ies = rcu_dereference(cbss->proberesp_ies); in ieee80211_prep_connection()
4836 /* must be non-NULL since beacon IEs were NULL */ in ieee80211_prep_connection()
4837 sdata->vif.bss_conf.sync_tsf = ies->tsf; in ieee80211_prep_connection()
4838 sdata->vif.bss_conf.sync_device_ts = in ieee80211_prep_connection()
4839 bss->device_ts_presp; in ieee80211_prep_connection()
4840 sdata->vif.bss_conf.sync_dtim_count = 0; in ieee80211_prep_connection()
4842 sdata->vif.bss_conf.sync_tsf = 0; in ieee80211_prep_connection()
4843 sdata->vif.bss_conf.sync_device_ts = 0; in ieee80211_prep_connection()
4844 sdata->vif.bss_conf.sync_dtim_count = 0; in ieee80211_prep_connection()
4854 return -EINVAL; in ieee80211_prep_connection()
4879 WARN_ON_ONCE(!ether_addr_equal(ifmgd->bssid, cbss->bssid)); in ieee80211_prep_connection()
4882 if (local->scanning) in ieee80211_prep_connection()
4892 struct ieee80211_local *local = sdata->local; in ieee80211_mgd_auth()
4893 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_mgd_auth()
4900 switch (req->auth_type) { in ieee80211_mgd_auth()
4905 if (IS_ERR(local->wep_tx_tfm)) in ieee80211_mgd_auth()
4906 return -EOPNOTSUPP; in ieee80211_mgd_auth()
4928 return -EOPNOTSUPP; in ieee80211_mgd_auth()
4931 auth_data = kzalloc(sizeof(*auth_data) + req->auth_data_len + in ieee80211_mgd_auth()
4932 req->ie_len, GFP_KERNEL); in ieee80211_mgd_auth()
4934 return -ENOMEM; in ieee80211_mgd_auth()
4936 auth_data->bss = req->bss; in ieee80211_mgd_auth()
4938 if (req->auth_data_len >= 4) { in ieee80211_mgd_auth()
4939 if (req->auth_type == NL80211_AUTHTYPE_SAE) { in ieee80211_mgd_auth()
4940 __le16 *pos = (__le16 *) req->auth_data; in ieee80211_mgd_auth()
4942 auth_data->sae_trans = le16_to_cpu(pos[0]); in ieee80211_mgd_auth()
4943 auth_data->sae_status = le16_to_cpu(pos[1]); in ieee80211_mgd_auth()
4945 memcpy(auth_data->data, req->auth_data + 4, in ieee80211_mgd_auth()
4946 req->auth_data_len - 4); in ieee80211_mgd_auth()
4947 auth_data->data_len += req->auth_data_len - 4; in ieee80211_mgd_auth()
4950 if (req->ie && req->ie_len) { in ieee80211_mgd_auth()
4951 memcpy(&auth_data->data[auth_data->data_len], in ieee80211_mgd_auth()
4952 req->ie, req->ie_len); in ieee80211_mgd_auth()
4953 auth_data->data_len += req->ie_len; in ieee80211_mgd_auth()
4956 if (req->key && req->key_len) { in ieee80211_mgd_auth()
4957 auth_data->key_len = req->key_len; in ieee80211_mgd_auth()
4958 auth_data->key_idx = req->key_idx; in ieee80211_mgd_auth()
4959 memcpy(auth_data->key, req->key, req->key_len); in ieee80211_mgd_auth()
4962 auth_data->algorithm = auth_alg; in ieee80211_mgd_auth()
4966 if ((ifmgd->auth_data && !ifmgd->auth_data->done) || in ieee80211_mgd_auth()
4967 ifmgd->assoc_data) { in ieee80211_mgd_auth()
4968 err = -EBUSY; in ieee80211_mgd_auth()
4972 if (ifmgd->auth_data) in ieee80211_mgd_auth()
4976 ifmgd->auth_data = auth_data; in ieee80211_mgd_auth()
4978 if (ifmgd->associated) { in ieee80211_mgd_auth()
4983 ifmgd->associated->bssid, req->bss->bssid); in ieee80211_mgd_auth()
4993 sdata_info(sdata, "authenticate with %pM\n", req->bss->bssid); in ieee80211_mgd_auth()
4995 err = ieee80211_prep_connection(sdata, req->bss, false, false); in ieee80211_mgd_auth()
5001 sta_info_destroy_addr(sdata, req->bss->bssid); in ieee80211_mgd_auth()
5006 cfg80211_ref_bss(local->hw.wiphy, auth_data->bss); in ieee80211_mgd_auth()
5010 eth_zero_addr(ifmgd->bssid); in ieee80211_mgd_auth()
5012 ifmgd->auth_data = NULL; in ieee80211_mgd_auth()
5013 mutex_lock(&sdata->local->mtx); in ieee80211_mgd_auth()
5015 mutex_unlock(&sdata->local->mtx); in ieee80211_mgd_auth()
5024 struct ieee80211_local *local = sdata->local; in ieee80211_mgd_assoc()
5025 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_mgd_assoc()
5026 struct ieee80211_bss *bss = (void *)req->bss->priv; in ieee80211_mgd_assoc()
5034 assoc_data = kzalloc(sizeof(*assoc_data) + req->ie_len, GFP_KERNEL); in ieee80211_mgd_assoc()
5036 return -ENOMEM; in ieee80211_mgd_assoc()
5039 ssidie = ieee80211_bss_get_ie(req->bss, WLAN_EID_SSID); in ieee80211_mgd_assoc()
5040 if (!ssidie || ssidie[1] > sizeof(assoc_data->ssid)) { in ieee80211_mgd_assoc()
5043 return -EINVAL; in ieee80211_mgd_assoc()
5045 memcpy(assoc_data->ssid, ssidie + 2, ssidie[1]); in ieee80211_mgd_assoc()
5046 assoc_data->ssid_len = ssidie[1]; in ieee80211_mgd_assoc()
5049 if (ifmgd->associated) { in ieee80211_mgd_assoc()
5054 ifmgd->associated->bssid, req->bss->bssid); in ieee80211_mgd_assoc()
5064 if (ifmgd->auth_data && !ifmgd->auth_data->done) { in ieee80211_mgd_assoc()
5065 err = -EBUSY; in ieee80211_mgd_assoc()
5069 if (ifmgd->assoc_data) { in ieee80211_mgd_assoc()
5070 err = -EBUSY; in ieee80211_mgd_assoc()
5074 if (ifmgd->auth_data) { in ieee80211_mgd_assoc()
5078 match = ether_addr_equal(ifmgd->bssid, req->bss->bssid); in ieee80211_mgd_assoc()
5084 ifmgd->beacon_crc_valid = false; in ieee80211_mgd_assoc()
5086 assoc_data->wmm = bss->wmm_used && in ieee80211_mgd_assoc()
5087 (local->hw.queues >= IEEE80211_NUM_ACS); in ieee80211_mgd_assoc()
5091 * We still associate in non-HT mode (11a/b/g) if any one of these in ieee80211_mgd_assoc()
5093 * We can set this to true for non-11n hardware, that'll be checked in ieee80211_mgd_assoc()
5096 for (i = 0; i < req->crypto.n_ciphers_pairwise; i++) { in ieee80211_mgd_assoc()
5097 if (req->crypto.ciphers_pairwise[i] == WLAN_CIPHER_SUITE_WEP40 || in ieee80211_mgd_assoc()
5098 req->crypto.ciphers_pairwise[i] == WLAN_CIPHER_SUITE_TKIP || in ieee80211_mgd_assoc()
5099 req->crypto.ciphers_pairwise[i] == WLAN_CIPHER_SUITE_WEP104) { in ieee80211_mgd_assoc()
5100 ifmgd->flags |= IEEE80211_STA_DISABLE_HT; in ieee80211_mgd_assoc()
5101 ifmgd->flags |= IEEE80211_STA_DISABLE_VHT; in ieee80211_mgd_assoc()
5102 ifmgd->flags |= IEEE80211_STA_DISABLE_HE; in ieee80211_mgd_assoc()
5103 netdev_info(sdata->dev, in ieee80211_mgd_assoc()
5109 sband = local->hw.wiphy->bands[req->bss->channel->band]; in ieee80211_mgd_assoc()
5110 if (!sband->ht_cap.ht_supported || in ieee80211_mgd_assoc()
5111 local->hw.queues < IEEE80211_NUM_ACS || !bss->wmm_used || in ieee80211_mgd_assoc()
5112 ifmgd->flags & IEEE80211_STA_DISABLE_WMM) { in ieee80211_mgd_assoc()
5113 ifmgd->flags |= IEEE80211_STA_DISABLE_HT; in ieee80211_mgd_assoc()
5114 if (!bss->wmm_used && in ieee80211_mgd_assoc()
5115 !(ifmgd->flags & IEEE80211_STA_DISABLE_WMM)) in ieee80211_mgd_assoc()
5116 netdev_info(sdata->dev, in ieee80211_mgd_assoc()
5121 if (!sband->vht_cap.vht_supported || in ieee80211_mgd_assoc()
5122 local->hw.queues < IEEE80211_NUM_ACS || !bss->wmm_used || in ieee80211_mgd_assoc()
5123 ifmgd->flags & IEEE80211_STA_DISABLE_WMM) { in ieee80211_mgd_assoc()
5124 ifmgd->flags |= IEEE80211_STA_DISABLE_VHT; in ieee80211_mgd_assoc()
5125 if (!bss->wmm_used && in ieee80211_mgd_assoc()
5126 !(ifmgd->flags & IEEE80211_STA_DISABLE_WMM)) in ieee80211_mgd_assoc()
5127 netdev_info(sdata->dev, in ieee80211_mgd_assoc()
5131 memcpy(&ifmgd->ht_capa, &req->ht_capa, sizeof(ifmgd->ht_capa)); in ieee80211_mgd_assoc()
5132 memcpy(&ifmgd->ht_capa_mask, &req->ht_capa_mask, in ieee80211_mgd_assoc()
5133 sizeof(ifmgd->ht_capa_mask)); in ieee80211_mgd_assoc()
5135 memcpy(&ifmgd->vht_capa, &req->vht_capa, sizeof(ifmgd->vht_capa)); in ieee80211_mgd_assoc()
5136 memcpy(&ifmgd->vht_capa_mask, &req->vht_capa_mask, in ieee80211_mgd_assoc()
5137 sizeof(ifmgd->vht_capa_mask)); in ieee80211_mgd_assoc()
5139 if (req->ie && req->ie_len) { in ieee80211_mgd_assoc()
5140 memcpy(assoc_data->ie, req->ie, req->ie_len); in ieee80211_mgd_assoc()
5141 assoc_data->ie_len = req->ie_len; in ieee80211_mgd_assoc()
5144 if (req->fils_kek) { in ieee80211_mgd_assoc()
5145 /* should already be checked in cfg80211 - so warn */ in ieee80211_mgd_assoc()
5146 if (WARN_ON(req->fils_kek_len > FILS_MAX_KEK_LEN)) { in ieee80211_mgd_assoc()
5147 err = -EINVAL; in ieee80211_mgd_assoc()
5150 memcpy(assoc_data->fils_kek, req->fils_kek, in ieee80211_mgd_assoc()
5151 req->fils_kek_len); in ieee80211_mgd_assoc()
5152 assoc_data->fils_kek_len = req->fils_kek_len; in ieee80211_mgd_assoc()
5155 if (req->fils_nonces) in ieee80211_mgd_assoc()
5156 memcpy(assoc_data->fils_nonces, req->fils_nonces, in ieee80211_mgd_assoc()
5159 assoc_data->bss = req->bss; in ieee80211_mgd_assoc()
5161 if (ifmgd->req_smps == IEEE80211_SMPS_AUTOMATIC) { in ieee80211_mgd_assoc()
5162 if (ifmgd->powersave) in ieee80211_mgd_assoc()
5163 sdata->smps_mode = IEEE80211_SMPS_DYNAMIC; in ieee80211_mgd_assoc()
5165 sdata->smps_mode = IEEE80211_SMPS_OFF; in ieee80211_mgd_assoc()
5167 sdata->smps_mode = ifmgd->req_smps; in ieee80211_mgd_assoc()
5169 assoc_data->capability = req->bss->capability; in ieee80211_mgd_assoc()
5170 assoc_data->supp_rates = bss->supp_rates; in ieee80211_mgd_assoc()
5171 assoc_data->supp_rates_len = bss->supp_rates_len; in ieee80211_mgd_assoc()
5174 ht_ie = ieee80211_bss_get_ie(req->bss, WLAN_EID_HT_OPERATION); in ieee80211_mgd_assoc()
5176 assoc_data->ap_ht_param = in ieee80211_mgd_assoc()
5177 ((struct ieee80211_ht_operation *)(ht_ie + 2))->ht_param; in ieee80211_mgd_assoc()
5179 ifmgd->flags |= IEEE80211_STA_DISABLE_HT; in ieee80211_mgd_assoc()
5180 vht_ie = ieee80211_bss_get_ie(req->bss, WLAN_EID_VHT_CAPABILITY); in ieee80211_mgd_assoc()
5182 memcpy(&assoc_data->ap_vht_cap, vht_ie + 2, in ieee80211_mgd_assoc()
5185 ifmgd->flags |= IEEE80211_STA_DISABLE_VHT; in ieee80211_mgd_assoc()
5188 if (WARN((sdata->vif.driver_flags & IEEE80211_VIF_SUPPORTS_UAPSD) && in ieee80211_mgd_assoc()
5189 ieee80211_hw_check(&local->hw, PS_NULLFUNC_STACK), in ieee80211_mgd_assoc()
5190 "U-APSD not supported with HW_PS_NULLFUNC_STACK\n")) in ieee80211_mgd_assoc()
5191 sdata->vif.driver_flags &= ~IEEE80211_VIF_SUPPORTS_UAPSD; in ieee80211_mgd_assoc()
5193 if (bss->wmm_used && bss->uapsd_supported && in ieee80211_mgd_assoc()
5194 (sdata->vif.driver_flags & IEEE80211_VIF_SUPPORTS_UAPSD)) { in ieee80211_mgd_assoc()
5195 assoc_data->uapsd = true; in ieee80211_mgd_assoc()
5196 ifmgd->flags |= IEEE80211_STA_UAPSD_ENABLED; in ieee80211_mgd_assoc()
5198 assoc_data->uapsd = false; in ieee80211_mgd_assoc()
5199 ifmgd->flags &= ~IEEE80211_STA_UAPSD_ENABLED; in ieee80211_mgd_assoc()
5202 if (req->prev_bssid) in ieee80211_mgd_assoc()
5203 memcpy(assoc_data->prev_bssid, req->prev_bssid, ETH_ALEN); in ieee80211_mgd_assoc()
5205 if (req->use_mfp) { in ieee80211_mgd_assoc()
5206 ifmgd->mfp = IEEE80211_MFP_REQUIRED; in ieee80211_mgd_assoc()
5207 ifmgd->flags |= IEEE80211_STA_MFP_ENABLED; in ieee80211_mgd_assoc()
5209 ifmgd->mfp = IEEE80211_MFP_DISABLED; in ieee80211_mgd_assoc()
5210 ifmgd->flags &= ~IEEE80211_STA_MFP_ENABLED; in ieee80211_mgd_assoc()
5213 if (req->flags & ASSOC_REQ_USE_RRM) in ieee80211_mgd_assoc()
5214 ifmgd->flags |= IEEE80211_STA_ENABLE_RRM; in ieee80211_mgd_assoc()
5216 ifmgd->flags &= ~IEEE80211_STA_ENABLE_RRM; in ieee80211_mgd_assoc()
5218 if (req->crypto.control_port) in ieee80211_mgd_assoc()
5219 ifmgd->flags |= IEEE80211_STA_CONTROL_PORT; in ieee80211_mgd_assoc()
5221 ifmgd->flags &= ~IEEE80211_STA_CONTROL_PORT; in ieee80211_mgd_assoc()
5223 sdata->control_port_protocol = req->crypto.control_port_ethertype; in ieee80211_mgd_assoc()
5224 sdata->control_port_no_encrypt = req->crypto.control_port_no_encrypt; in ieee80211_mgd_assoc()
5225 sdata->control_port_over_nl80211 = in ieee80211_mgd_assoc()
5226 req->crypto.control_port_over_nl80211; in ieee80211_mgd_assoc()
5227 sdata->encrypt_headroom = ieee80211_cs_headroom(local, &req->crypto, in ieee80211_mgd_assoc()
5228 sdata->vif.type); in ieee80211_mgd_assoc()
5232 ifmgd->assoc_data = assoc_data; in ieee80211_mgd_assoc()
5233 ifmgd->dtim_period = 0; in ieee80211_mgd_assoc()
5234 ifmgd->have_beacon = false; in ieee80211_mgd_assoc()
5237 if (!(ifmgd->flags & IEEE80211_STA_DISABLE_HT)) { in ieee80211_mgd_assoc()
5240 if (req->flags & ASSOC_REQ_DISABLE_HT) in ieee80211_mgd_assoc()
5243 memcpy(&sta_ht_cap, &sband->ht_cap, sizeof(sta_ht_cap)); in ieee80211_mgd_assoc()
5247 if (!(ifmgd->flags & IEEE80211_STA_DISABLE_40MHZ) && in ieee80211_mgd_assoc()
5248 sband->ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40 && in ieee80211_mgd_assoc()
5252 if (!(ifmgd->flags & IEEE80211_STA_DISABLE_VHT) && in ieee80211_mgd_assoc()
5253 req->flags & ASSOC_REQ_DISABLE_VHT) in ieee80211_mgd_assoc()
5257 if (req->flags & ASSOC_REQ_DISABLE_HT) { in ieee80211_mgd_assoc()
5258 ifmgd->flags |= IEEE80211_STA_DISABLE_HT; in ieee80211_mgd_assoc()
5259 ifmgd->flags |= IEEE80211_STA_DISABLE_VHT; in ieee80211_mgd_assoc()
5262 if (req->flags & ASSOC_REQ_DISABLE_VHT) in ieee80211_mgd_assoc()
5263 ifmgd->flags |= IEEE80211_STA_DISABLE_VHT; in ieee80211_mgd_assoc()
5265 err = ieee80211_prep_connection(sdata, req->bss, true, override); in ieee80211_mgd_assoc()
5270 beacon_ies = rcu_dereference(req->bss->beacon_ies); in ieee80211_mgd_assoc()
5272 if (ieee80211_hw_check(&sdata->local->hw, NEED_DTIM_BEFORE_ASSOC) && in ieee80211_mgd_assoc()
5279 ifmgd->bssid); in ieee80211_mgd_assoc()
5280 assoc_data->timeout = TU_TO_EXP_TIME(req->bss->beacon_interval); in ieee80211_mgd_assoc()
5281 assoc_data->timeout_started = true; in ieee80211_mgd_assoc()
5282 assoc_data->need_beacon = true; in ieee80211_mgd_assoc()
5285 beacon_ies->data, in ieee80211_mgd_assoc()
5286 beacon_ies->len); in ieee80211_mgd_assoc()
5292 ifmgd->dtim_period = tim->dtim_period; in ieee80211_mgd_assoc()
5293 dtim_count = tim->dtim_count; in ieee80211_mgd_assoc()
5295 ifmgd->have_beacon = true; in ieee80211_mgd_assoc()
5296 assoc_data->timeout = jiffies; in ieee80211_mgd_assoc()
5297 assoc_data->timeout_started = true; in ieee80211_mgd_assoc()
5299 if (ieee80211_hw_check(&local->hw, TIMING_BEACON_ONLY)) { in ieee80211_mgd_assoc()
5300 sdata->vif.bss_conf.sync_tsf = beacon_ies->tsf; in ieee80211_mgd_assoc()
5301 sdata->vif.bss_conf.sync_device_ts = in ieee80211_mgd_assoc()
5302 bss->device_ts_beacon; in ieee80211_mgd_assoc()
5303 sdata->vif.bss_conf.sync_dtim_count = dtim_count; in ieee80211_mgd_assoc()
5306 assoc_data->timeout = jiffies; in ieee80211_mgd_assoc()
5307 assoc_data->timeout_started = true; in ieee80211_mgd_assoc()
5311 run_again(sdata, assoc_data->timeout); in ieee80211_mgd_assoc()
5313 if (bss->corrupt_data) { in ieee80211_mgd_assoc()
5315 if (bss->corrupt_data & IEEE80211_BSS_CORRUPT_BEACON) { in ieee80211_mgd_assoc()
5316 if (bss->corrupt_data & in ieee80211_mgd_assoc()
5321 } else if (bss->corrupt_data & IEEE80211_BSS_CORRUPT_PROBE_RESP) in ieee80211_mgd_assoc()
5329 eth_zero_addr(ifmgd->bssid); in ieee80211_mgd_assoc()
5331 ifmgd->assoc_data = NULL; in ieee80211_mgd_assoc()
5340 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_mgd_deauth()
5342 bool tx = !req->local_state_change; in ieee80211_mgd_deauth()
5344 if (ifmgd->auth_data && in ieee80211_mgd_deauth()
5345 ether_addr_equal(ifmgd->auth_data->bss->bssid, req->bssid)) { in ieee80211_mgd_deauth()
5348 req->bssid, req->reason_code, in ieee80211_mgd_deauth()
5349 ieee80211_get_reason_code_string(req->reason_code)); in ieee80211_mgd_deauth()
5351 drv_mgd_prepare_tx(sdata->local, sdata, 0); in ieee80211_mgd_deauth()
5352 ieee80211_send_deauth_disassoc(sdata, req->bssid, in ieee80211_mgd_deauth()
5354 req->reason_code, tx, in ieee80211_mgd_deauth()
5359 req->reason_code); in ieee80211_mgd_deauth()
5364 if (ifmgd->assoc_data && in ieee80211_mgd_deauth()
5365 ether_addr_equal(ifmgd->assoc_data->bss->bssid, req->bssid)) { in ieee80211_mgd_deauth()
5368 req->bssid, req->reason_code, in ieee80211_mgd_deauth()
5369 ieee80211_get_reason_code_string(req->reason_code)); in ieee80211_mgd_deauth()
5371 drv_mgd_prepare_tx(sdata->local, sdata, 0); in ieee80211_mgd_deauth()
5372 ieee80211_send_deauth_disassoc(sdata, req->bssid, in ieee80211_mgd_deauth()
5374 req->reason_code, tx, in ieee80211_mgd_deauth()
5379 req->reason_code); in ieee80211_mgd_deauth()
5383 if (ifmgd->associated && in ieee80211_mgd_deauth()
5384 ether_addr_equal(ifmgd->associated->bssid, req->bssid)) { in ieee80211_mgd_deauth()
5387 req->bssid, req->reason_code, in ieee80211_mgd_deauth()
5388 ieee80211_get_reason_code_string(req->reason_code)); in ieee80211_mgd_deauth()
5391 req->reason_code, tx, frame_buf); in ieee80211_mgd_deauth()
5394 req->reason_code); in ieee80211_mgd_deauth()
5398 return -ENOTCONN; in ieee80211_mgd_deauth()
5404 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_mgd_disassoc()
5414 if (ifmgd->associated != req->bss) in ieee80211_mgd_disassoc()
5415 return -ENOLINK; in ieee80211_mgd_disassoc()
5419 req->bss->bssid, req->reason_code, ieee80211_get_reason_code_string(req->reason_code)); in ieee80211_mgd_disassoc()
5421 memcpy(bssid, req->bss->bssid, ETH_ALEN); in ieee80211_mgd_disassoc()
5423 req->reason_code, !req->local_state_change, in ieee80211_mgd_disassoc()
5427 req->reason_code); in ieee80211_mgd_disassoc()
5434 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_mgd_stop()
5441 cancel_work_sync(&ifmgd->monitor_work); in ieee80211_mgd_stop()
5442 cancel_work_sync(&ifmgd->beacon_connection_loss_work); in ieee80211_mgd_stop()
5443 cancel_work_sync(&ifmgd->request_smps_work); in ieee80211_mgd_stop()
5444 cancel_work_sync(&ifmgd->csa_connection_drop_work); in ieee80211_mgd_stop()
5445 cancel_work_sync(&ifmgd->chswitch_work); in ieee80211_mgd_stop()
5446 cancel_delayed_work_sync(&ifmgd->tdls_peer_del_work); in ieee80211_mgd_stop()
5449 if (ifmgd->assoc_data) { in ieee80211_mgd_stop()
5450 struct cfg80211_bss *bss = ifmgd->assoc_data->bss; in ieee80211_mgd_stop()
5452 cfg80211_assoc_timeout(sdata->dev, bss); in ieee80211_mgd_stop()
5454 if (ifmgd->auth_data) in ieee80211_mgd_stop()
5456 spin_lock_bh(&ifmgd->teardown_lock); in ieee80211_mgd_stop()
5457 if (ifmgd->teardown_skb) { in ieee80211_mgd_stop()
5458 kfree_skb(ifmgd->teardown_skb); in ieee80211_mgd_stop()
5459 ifmgd->teardown_skb = NULL; in ieee80211_mgd_stop()
5460 ifmgd->orig_teardown_skb = NULL; in ieee80211_mgd_stop()
5462 spin_unlock_bh(&ifmgd->teardown_lock); in ieee80211_mgd_stop()
5463 del_timer_sync(&ifmgd->timer); in ieee80211_mgd_stop()
5476 cfg80211_cqm_rssi_notify(sdata->dev, rssi_event, rssi_level, gfp); in ieee80211_cqm_rssi_notify()
5484 trace_api_cqm_beacon_loss_notify(sdata->local, sdata); in ieee80211_cqm_beacon_loss_notify()
5486 cfg80211_cqm_beacon_loss_notify(sdata->dev, gfp); in ieee80211_cqm_beacon_loss_notify()