Lines Matching +full:mu +full:- +full:side +full:- +full:b
1 // SPDX-License-Identifier: GPL-2.0-only
4 * Copyright 2003-2008, Jouni Malinen <j@w1.fi>
7 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
9 * Copyright 2013-2014 Intel Mobile Communications GmbH
10 * Copyright (C) 2015 - 2017 Intel Deutschland GmbH
11 * Copyright (C) 2018 - 2021 Intel Corporation
29 #include "driver-ops.h"
97 * has happened -- the work that runs from this timer will
105 if (!timer_pending(&sdata->u.mgd.timer) || in run_again()
106 time_before(timeout, sdata->u.mgd.timer.expires)) in run_again()
107 mod_timer(&sdata->u.mgd.timer, timeout); in run_again()
112 if (sdata->vif.driver_flags & IEEE80211_VIF_BEACON_FILTER) in ieee80211_sta_reset_beacon_monitor()
115 if (ieee80211_hw_check(&sdata->local->hw, CONNECTION_MONITOR)) in ieee80211_sta_reset_beacon_monitor()
118 mod_timer(&sdata->u.mgd.bcn_mon_timer, in ieee80211_sta_reset_beacon_monitor()
119 round_jiffies_up(jiffies + sdata->u.mgd.beacon_timeout)); in ieee80211_sta_reset_beacon_monitor()
124 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_sta_reset_conn_monitor()
126 if (unlikely(!ifmgd->associated)) in ieee80211_sta_reset_conn_monitor()
129 if (ifmgd->probe_send_count) in ieee80211_sta_reset_conn_monitor()
130 ifmgd->probe_send_count = 0; in ieee80211_sta_reset_conn_monitor()
132 if (ieee80211_hw_check(&sdata->local->hw, CONNECTION_MONITOR)) in ieee80211_sta_reset_conn_monitor()
135 mod_timer(&ifmgd->conn_mon_timer, in ieee80211_sta_reset_conn_monitor()
141 return (1 << ecw) - 1; in ecw2cw()
155 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_determine_chantype()
161 chandef->chan = channel; in ieee80211_determine_chantype()
162 chandef->width = NL80211_CHAN_WIDTH_20_NOHT; in ieee80211_determine_chantype()
163 chandef->center_freq1 = channel->center_freq; in ieee80211_determine_chantype()
164 chandef->freq1_offset = channel->freq_offset; in ieee80211_determine_chantype()
166 if (channel->band == NL80211_BAND_6GHZ) { in ieee80211_determine_chantype()
175 } else if (sband->band == NL80211_BAND_S1GHZ) { in ieee80211_determine_chantype()
179 chandef->width = ieee80211_s1g_channel_width(channel); in ieee80211_determine_chantype()
189 memcpy(&sta_ht_cap, &sband->ht_cap, sizeof(sta_ht_cap)); in ieee80211_determine_chantype()
199 chandef->width = NL80211_CHAN_WIDTH_20; in ieee80211_determine_chantype()
201 ht_cfreq = ieee80211_channel_to_frequency(ht_oper->primary_chan, in ieee80211_determine_chantype()
202 channel->band); in ieee80211_determine_chantype()
204 if (!tracking && channel->center_freq != ht_cfreq) { in ieee80211_determine_chantype()
213 …"Wrong control channel: center-freq: %d ht-cfreq: %d ht->primary_chan: %d band: %d - Disabling HT\… in ieee80211_determine_chantype()
214 channel->center_freq, ht_cfreq, in ieee80211_determine_chantype()
215 ht_oper->primary_chan, channel->band); in ieee80211_determine_chantype()
233 if (!vht_oper || !sband->vht_cap.vht_supported) { in ieee80211_determine_chantype()
239 if (!(ifmgd->flags & IEEE80211_STA_DISABLE_HE) && he_oper && in ieee80211_determine_chantype()
240 (le32_to_cpu(he_oper->he_oper_params) & in ieee80211_determine_chantype()
248 memcpy(&he_oper_vht_cap, he_oper->optional, 3); in ieee80211_determine_chantype()
251 if (!ieee80211_chandef_vht_oper(&sdata->local->hw, vht_cap_info, in ieee80211_determine_chantype()
254 if (!(ifmgd->flags & IEEE80211_STA_DISABLE_HE)) in ieee80211_determine_chantype()
260 } else if (!ieee80211_chandef_vht_oper(&sdata->local->hw, in ieee80211_determine_chantype()
264 if (!(ifmgd->flags & IEEE80211_STA_DISABLE_VHT)) in ieee80211_determine_chantype()
272 if (!(ifmgd->flags & IEEE80211_STA_DISABLE_VHT)) in ieee80211_determine_chantype()
285 if (!(ifmgd->flags & IEEE80211_STA_DISABLE_VHT)) in ieee80211_determine_chantype()
300 * connection. This keeps us from playing ping-pong with regulatory, in ieee80211_determine_chantype()
302 * - connect to an AP with 80 MHz, world regdom allows 80 MHz in ieee80211_determine_chantype()
303 * - AP advertises regdom US in ieee80211_determine_chantype()
304 * - CRDA loads regdom US with 80 MHz prohibited (old database) in ieee80211_determine_chantype()
305 * - the code below detects an unsupported channel, downgrades, and in ieee80211_determine_chantype()
307 * - disconnect causes CRDA to reload world regdomain and the game in ieee80211_determine_chantype()
316 cfg80211_chandef_identical(chandef, &sdata->vif.bss_conf.chandef)) in ieee80211_determine_chantype()
325 * tracking the APs beacon for bandwidth changes - otherwise we in ieee80211_determine_chantype()
331 while (!cfg80211_chandef_usable(sdata->local->hw.wiphy, chandef, in ieee80211_determine_chantype()
334 if (WARN_ON(chandef->width == NL80211_CHAN_WIDTH_20_NOHT)) { in ieee80211_determine_chantype()
344 if (!he_oper || !cfg80211_chandef_usable(sdata->wdev.wiphy, chandef, in ieee80211_determine_chantype()
348 if (chandef->width != vht_chandef.width && !tracking) in ieee80211_determine_chantype()
366 struct ieee80211_local *local = sdata->local; in ieee80211_config_bw()
367 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_config_bw()
368 struct ieee80211_channel *chan = sdata->vif.bss_conf.chandef.chan; in ieee80211_config_bw()
370 local->hw.wiphy->bands[chan->band]; in ieee80211_config_bw()
378 if (ifmgd->flags & IEEE80211_STA_DISABLE_HT || !ht_oper) in ieee80211_config_bw()
381 /* don't check VHT if we associated as non-VHT station */ in ieee80211_config_bw()
382 if (ifmgd->flags & IEEE80211_STA_DISABLE_VHT) in ieee80211_config_bw()
385 /* don't check HE if we associated as non-HE station */ in ieee80211_config_bw()
386 if (ifmgd->flags & IEEE80211_STA_DISABLE_HE || in ieee80211_config_bw()
388 ieee80211_vif_type_p2p(&sdata->vif))) in ieee80211_config_bw()
393 return -EINVAL; in ieee80211_config_bw()
396 * if bss configuration changed store the new one - in ieee80211_config_bw()
399 ht_opmode = le16_to_cpu(ht_oper->operation_mode); in ieee80211_config_bw()
400 if (sdata->vif.bss_conf.ht_operation_mode != ht_opmode) { in ieee80211_config_bw()
402 sdata->vif.bss_conf.ht_operation_mode = ht_opmode; in ieee80211_config_bw()
406 vht_cap_info = le32_to_cpu(vht_cap->vht_cap_info); in ieee80211_config_bw()
418 * any good -- we couldn't use it with the AP. in ieee80211_config_bw()
420 if (ifmgd->flags & IEEE80211_STA_DISABLE_80P80MHZ && in ieee80211_config_bw()
423 if (ifmgd->flags & IEEE80211_STA_DISABLE_160MHZ && in ieee80211_config_bw()
426 if (ifmgd->flags & IEEE80211_STA_DISABLE_40MHZ && in ieee80211_config_bw()
430 if (cfg80211_chandef_identical(&chandef, &sdata->vif.bss_conf.chandef)) in ieee80211_config_bw()
436 ifmgd->bssid, chandef.chan->center_freq, in ieee80211_config_bw()
437 chandef.chan->freq_offset, chandef.width, in ieee80211_config_bw()
441 if (flags != (ifmgd->flags & (IEEE80211_STA_DISABLE_HT | in ieee80211_config_bw()
449 "AP %pM changed caps/bw in a way we can't support (0x%x/0x%x) - disconnect\n", in ieee80211_config_bw()
450 ifmgd->bssid, flags, ifmgd->flags); in ieee80211_config_bw()
451 return -EINVAL; in ieee80211_config_bw()
458 "AP %pM changed bandwidth to incompatible one - disconnect\n", in ieee80211_config_bw()
459 ifmgd->bssid); in ieee80211_config_bw()
475 u32 flags = channel->flags; in ieee80211_add_ht_ie()
479 BUILD_BUG_ON(sizeof(ht_cap) != sizeof(sband->ht_cap)); in ieee80211_add_ht_ie()
481 memcpy(&ht_cap, &sband->ht_cap, sizeof(ht_cap)); in ieee80211_add_ht_ie()
504 * capable of 40 MHz -- some broken APs will never fall in ieee80211_add_ht_ie()
507 if (sdata->u.mgd.flags & IEEE80211_STA_DISABLE_40MHZ) { in ieee80211_add_ht_ie()
540 * Note - the function may set the owner of the MU-MIMO capability
547 struct ieee80211_local *local = sdata->local; in ieee80211_add_vht_ie()
553 BUILD_BUG_ON(sizeof(vht_cap) != sizeof(sband->vht_cap)); in ieee80211_add_vht_ie()
555 memcpy(&vht_cap, &sband->vht_cap, sizeof(vht_cap)); in ieee80211_add_vht_ie()
561 if (sdata->u.mgd.flags & IEEE80211_STA_DISABLE_80P80MHZ) { in ieee80211_add_vht_ie()
570 if (sdata->u.mgd.flags & IEEE80211_STA_DISABLE_160MHZ) { in ieee80211_add_vht_ie()
579 if (!(ap_vht_cap->vht_cap_info & in ieee80211_add_vht_ie()
583 else if (!(ap_vht_cap->vht_cap_info & in ieee80211_add_vht_ie()
588 * If some other vif is using the MU-MIMO capability we cannot associate in ieee80211_add_vht_ie()
589 * using MU-MIMO - this will lead to contradictions in the group-id in ieee80211_add_vht_ie()
592 * simultaneous associations with MU-MIMO. in ieee80211_add_vht_ie()
598 list_for_each_entry_rcu(other, &local->interfaces, list) { in ieee80211_add_vht_ie()
599 if (other->vif.mu_mimo_owner) { in ieee80211_add_vht_ie()
607 sdata->vif.mu_mimo_owner = true; in ieee80211_add_vht_ie()
612 ap_bf_sts = le32_to_cpu(ap_vht_cap->vht_cap_info) & mask; in ieee80211_add_vht_ie()
639 chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); in ieee80211_add_he_ie()
641 reg_cap = cfg80211_chandef_usable(sdata->wdev.wiphy, in ieee80211_add_he_ie()
642 &chanctx_conf->def, in ieee80211_add_he_ie()
648 ieee80211_vif_type_p2p(&sdata->vif)); in ieee80211_add_he_ie()
657 2 + 1 + sizeof(he_cap->he_cap_elem) + in ieee80211_add_he_ie()
658 ieee80211_he_mcs_nss_size(&he_cap->he_cap_elem) + in ieee80211_add_he_ie()
659 ieee80211_he_ppe_size(he_cap->ppe_thres[0], in ieee80211_add_he_ie()
660 he_cap->he_cap_elem.phy_cap_info); in ieee80211_add_he_ie()
669 struct ieee80211_local *local = sdata->local; in ieee80211_send_assoc()
670 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_send_assoc()
671 struct ieee80211_mgd_assoc_data *assoc_data = ifmgd->assoc_data; in ieee80211_send_assoc()
684 enum nl80211_iftype iftype = ieee80211_vif_type_p2p(&sdata->vif); in ieee80211_send_assoc()
689 if (assoc_data->ie_len) in ieee80211_send_assoc()
691 assoc_data->ie, in ieee80211_send_assoc()
692 assoc_data->ie_len); in ieee80211_send_assoc()
697 chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); in ieee80211_send_assoc()
702 chan = chanctx_conf->def.chan; in ieee80211_send_assoc()
704 sband = local->hw.wiphy->bands[chan->band]; in ieee80211_send_assoc()
705 shift = ieee80211_vif_get_shift(&sdata->vif); in ieee80211_send_assoc()
707 if (assoc_data->supp_rates_len) { in ieee80211_send_assoc()
711 * in the association request (e.g. D-Link DAP 1353 in in ieee80211_send_assoc()
712 * b-only mode)... in ieee80211_send_assoc()
714 rates_len = ieee80211_parse_bitrates(&chanctx_conf->def, sband, in ieee80211_send_assoc()
715 assoc_data->supp_rates, in ieee80211_send_assoc()
716 assoc_data->supp_rates_len, in ieee80211_send_assoc()
725 for (i = 0; i < sband->n_bitrates; i++) { in ieee80211_send_assoc()
733 skb = alloc_skb(local->hw.extra_tx_headroom + in ieee80211_send_assoc()
735 2 + assoc_data->ssid_len + /* SSID */ in ieee80211_send_assoc()
738 2 + 2 * sband->n_channels + /* supported channels */ in ieee80211_send_assoc()
745 assoc_data->ie_len + /* extra IEs */ in ieee80211_send_assoc()
746 (assoc_data->fils_kek_len ? 16 /* AES-SIV */ : 0) + in ieee80211_send_assoc()
748 (iftd ? iftd->vendor_elems.len : 0), in ieee80211_send_assoc()
753 skb_reserve(skb, local->hw.extra_tx_headroom); in ieee80211_send_assoc()
757 if (sband->band == NL80211_BAND_2GHZ) { in ieee80211_send_assoc()
762 if (assoc_data->capability & WLAN_CAPABILITY_PRIVACY) in ieee80211_send_assoc()
765 if ((assoc_data->capability & WLAN_CAPABILITY_SPECTRUM_MGMT) && in ieee80211_send_assoc()
766 ieee80211_hw_check(&local->hw, SPECTRUM_MGMT)) in ieee80211_send_assoc()
769 if (ifmgd->flags & IEEE80211_STA_ENABLE_RRM) in ieee80211_send_assoc()
773 memcpy(mgmt->da, assoc_data->bss->bssid, ETH_ALEN); in ieee80211_send_assoc()
774 memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); in ieee80211_send_assoc()
775 memcpy(mgmt->bssid, assoc_data->bss->bssid, ETH_ALEN); in ieee80211_send_assoc()
777 listen_int = cpu_to_le16(sband->band == NL80211_BAND_S1GHZ ? in ieee80211_send_assoc()
778 ieee80211_encode_usf(local->hw.conf.listen_interval) : in ieee80211_send_assoc()
779 local->hw.conf.listen_interval); in ieee80211_send_assoc()
780 if (!is_zero_ether_addr(assoc_data->prev_bssid)) { in ieee80211_send_assoc()
782 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | in ieee80211_send_assoc()
784 mgmt->u.reassoc_req.capab_info = cpu_to_le16(capab); in ieee80211_send_assoc()
785 mgmt->u.reassoc_req.listen_interval = listen_int; in ieee80211_send_assoc()
786 memcpy(mgmt->u.reassoc_req.current_ap, assoc_data->prev_bssid, in ieee80211_send_assoc()
791 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | in ieee80211_send_assoc()
793 mgmt->u.assoc_req.capab_info = cpu_to_le16(capab); in ieee80211_send_assoc()
794 mgmt->u.assoc_req.listen_interval = listen_int; in ieee80211_send_assoc()
799 pos = skb_put(skb, 2 + assoc_data->ssid_len); in ieee80211_send_assoc()
802 *pos++ = assoc_data->ssid_len; in ieee80211_send_assoc()
803 memcpy(pos, assoc_data->ssid, assoc_data->ssid_len); in ieee80211_send_assoc()
805 if (sband->band == NL80211_BAND_S1GHZ) in ieee80211_send_assoc()
818 for (i = 0; i < sband->n_bitrates; i++) { in ieee80211_send_assoc()
820 int rate = DIV_ROUND_UP(sband->bitrates[i].bitrate, in ieee80211_send_assoc()
829 pos = skb_put(skb, rates_len - count + 2); in ieee80211_send_assoc()
831 *pos++ = rates_len - count; in ieee80211_send_assoc()
833 for (i++; i < sband->n_bitrates; i++) { in ieee80211_send_assoc()
836 rate = DIV_ROUND_UP(sband->bitrates[i].bitrate, in ieee80211_send_assoc()
851 *pos++ = ieee80211_chandef_max_power(&chanctx_conf->def); in ieee80211_send_assoc()
860 (sband->band != NL80211_BAND_6GHZ || in ieee80211_send_assoc()
861 !ext_capa || ext_capa->datalen < 1 || in ieee80211_send_assoc()
862 !(ext_capa->data[0] & WLAN_EXT_CAPA1_EXT_CHANNEL_SWITCHING))) { in ieee80211_send_assoc()
864 pos = skb_put(skb, 2 * sband->n_channels + 2); in ieee80211_send_assoc()
866 *pos++ = 2 * sband->n_channels; in ieee80211_send_assoc()
867 for (i = 0; i < sband->n_channels; i++) { in ieee80211_send_assoc()
869 sband->channels[i].center_freq); in ieee80211_send_assoc()
875 if (ieee80211_hw_check(&local->hw, SUPPORTS_ONLY_HE_MULTI_BSSID) && in ieee80211_send_assoc()
876 !(ifmgd->flags & IEEE80211_STA_DISABLE_HE) && assoc_data->ie_len && in ieee80211_send_assoc()
877 ext_capa && ext_capa->datalen >= 3) in ieee80211_send_assoc()
878 ext_capa->data[2] |= WLAN_EXT_CAPA3_MULTI_BSSID_SUPPORT; in ieee80211_send_assoc()
881 if (assoc_data->ie_len) { in ieee80211_send_assoc()
905 /* 60 GHz (Multi-band, DMG, MMS) can't happen */ in ieee80211_send_assoc()
910 noffset = ieee80211_ie_split_ric(assoc_data->ie, in ieee80211_send_assoc()
911 assoc_data->ie_len, in ieee80211_send_assoc()
917 skb_put_data(skb, assoc_data->ie + offset, noffset - offset); in ieee80211_send_assoc()
921 if (WARN_ON_ONCE((ifmgd->flags & IEEE80211_STA_DISABLE_HT) && in ieee80211_send_assoc()
922 !(ifmgd->flags & IEEE80211_STA_DISABLE_VHT))) in ieee80211_send_assoc()
923 ifmgd->flags |= IEEE80211_STA_DISABLE_VHT; in ieee80211_send_assoc()
925 if (sband->band != NL80211_BAND_6GHZ && in ieee80211_send_assoc()
926 !(ifmgd->flags & IEEE80211_STA_DISABLE_HT)) in ieee80211_send_assoc()
927 ieee80211_add_ht_ie(sdata, skb, assoc_data->ap_ht_param, in ieee80211_send_assoc()
928 sband, chan, sdata->smps_mode); in ieee80211_send_assoc()
931 if (assoc_data->ie_len) { in ieee80211_send_assoc()
942 /* 60 GHz (Multi-band, DMG, MMS) can't happen */ in ieee80211_send_assoc()
946 noffset = ieee80211_ie_split(assoc_data->ie, assoc_data->ie_len, in ieee80211_send_assoc()
949 skb_put_data(skb, assoc_data->ie + offset, noffset - offset); in ieee80211_send_assoc()
954 if (assoc_data->ie_len) { in ieee80211_send_assoc()
972 noffset = ieee80211_ie_split(assoc_data->ie, assoc_data->ie_len, in ieee80211_send_assoc()
975 pos = skb_put(skb, noffset - offset); in ieee80211_send_assoc()
976 memcpy(pos, assoc_data->ie + offset, noffset - offset); in ieee80211_send_assoc()
980 if (sband->band != NL80211_BAND_6GHZ && in ieee80211_send_assoc()
981 !(ifmgd->flags & IEEE80211_STA_DISABLE_VHT)) in ieee80211_send_assoc()
983 &assoc_data->ap_vht_cap); in ieee80211_send_assoc()
989 if (ifmgd->flags & IEEE80211_STA_DISABLE_HT || in ieee80211_send_assoc()
990 (sband->band == NL80211_BAND_5GHZ && in ieee80211_send_assoc()
991 ifmgd->flags & IEEE80211_STA_DISABLE_VHT)) in ieee80211_send_assoc()
992 ifmgd->flags |= IEEE80211_STA_DISABLE_HE; in ieee80211_send_assoc()
994 if (!(ifmgd->flags & IEEE80211_STA_DISABLE_HE)) in ieee80211_send_assoc()
997 /* if present, add any custom non-vendor IEs that go after HE */ in ieee80211_send_assoc()
998 if (assoc_data->ie_len) { in ieee80211_send_assoc()
999 noffset = ieee80211_ie_split_vendor(assoc_data->ie, in ieee80211_send_assoc()
1000 assoc_data->ie_len, in ieee80211_send_assoc()
1002 skb_put_data(skb, assoc_data->ie + offset, noffset - offset); in ieee80211_send_assoc()
1006 if (assoc_data->wmm) { in ieee80211_send_assoc()
1007 if (assoc_data->uapsd) { in ieee80211_send_assoc()
1008 qos_info = ifmgd->uapsd_queues; in ieee80211_send_assoc()
1009 qos_info |= (ifmgd->uapsd_max_sp_len << in ieee80211_send_assoc()
1018 if (sband->band == NL80211_BAND_S1GHZ) { in ieee80211_send_assoc()
1020 ieee80211_add_s1g_capab_ie(sdata, &sband->s1g_cap, skb); in ieee80211_send_assoc()
1023 if (iftd && iftd->vendor_elems.data && iftd->vendor_elems.len) in ieee80211_send_assoc()
1024 skb_put_data(skb, iftd->vendor_elems.data, iftd->vendor_elems.len); in ieee80211_send_assoc()
1027 if (assoc_data->ie_len) { in ieee80211_send_assoc()
1028 noffset = assoc_data->ie_len; in ieee80211_send_assoc()
1029 skb_put_data(skb, assoc_data->ie + offset, noffset - offset); in ieee80211_send_assoc()
1032 if (assoc_data->fils_kek_len && in ieee80211_send_assoc()
1039 kfree(ifmgd->assoc_req_ies); in ieee80211_send_assoc()
1040 ifmgd->assoc_req_ies = kmemdup(ie_start, pos - ie_start, GFP_ATOMIC); in ieee80211_send_assoc()
1041 ifmgd->assoc_req_ies_len = pos - ie_start; in ieee80211_send_assoc()
1045 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; in ieee80211_send_assoc()
1046 if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) in ieee80211_send_assoc()
1047 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS | in ieee80211_send_assoc()
1058 skb = ieee80211_pspoll_get(&local->hw, &sdata->vif); in ieee80211_send_pspoll()
1062 pspoll = (struct ieee80211_pspoll *) skb->data; in ieee80211_send_pspoll()
1063 pspoll->frame_control |= cpu_to_le16(IEEE80211_FCTL_PM); in ieee80211_send_pspoll()
1065 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; in ieee80211_send_pspoll()
1075 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_send_nullfunc()
1077 skb = ieee80211_nullfunc_get(&local->hw, &sdata->vif, in ieee80211_send_nullfunc()
1078 !ieee80211_hw_check(&local->hw, DOESNT_SUPPORT_QOS_NDP)); in ieee80211_send_nullfunc()
1082 nullfunc = (struct ieee80211_hdr_3addr *) skb->data; in ieee80211_send_nullfunc()
1084 nullfunc->frame_control |= cpu_to_le16(IEEE80211_FCTL_PM); in ieee80211_send_nullfunc()
1086 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT | in ieee80211_send_nullfunc()
1089 if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) in ieee80211_send_nullfunc()
1090 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS; in ieee80211_send_nullfunc()
1092 if (ifmgd->flags & IEEE80211_STA_CONNECTION_POLL) in ieee80211_send_nullfunc()
1093 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_CTL_USE_MINRATE; in ieee80211_send_nullfunc()
1105 if (WARN_ON(sdata->vif.type != NL80211_IFTYPE_STATION)) in ieee80211_send_4addr_nullfunc()
1108 skb = dev_alloc_skb(local->hw.extra_tx_headroom + 30); in ieee80211_send_4addr_nullfunc()
1112 skb_reserve(skb, local->hw.extra_tx_headroom); in ieee80211_send_4addr_nullfunc()
1117 nullfunc->frame_control = fc; in ieee80211_send_4addr_nullfunc()
1118 memcpy(nullfunc->addr1, sdata->u.mgd.bssid, ETH_ALEN); in ieee80211_send_4addr_nullfunc()
1119 memcpy(nullfunc->addr2, sdata->vif.addr, ETH_ALEN); in ieee80211_send_4addr_nullfunc()
1120 memcpy(nullfunc->addr3, sdata->u.mgd.bssid, ETH_ALEN); in ieee80211_send_4addr_nullfunc()
1121 memcpy(nullfunc->addr4, sdata->vif.addr, ETH_ALEN); in ieee80211_send_4addr_nullfunc()
1123 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; in ieee80211_send_4addr_nullfunc()
1132 struct ieee80211_local *local = sdata->local; in ieee80211_chswitch_work()
1133 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_chswitch_work()
1140 mutex_lock(&local->mtx); in ieee80211_chswitch_work()
1141 mutex_lock(&local->chanctx_mtx); in ieee80211_chswitch_work()
1143 if (!ifmgd->associated) in ieee80211_chswitch_work()
1146 if (!sdata->vif.csa_active) in ieee80211_chswitch_work()
1151 * with multi-vif. once reservation is complete it will re-schedule the in ieee80211_chswitch_work()
1156 if (sdata->reserved_chanctx) { in ieee80211_chswitch_work()
1158 * with multi-vif csa driver may call ieee80211_csa_finish() in ieee80211_chswitch_work()
1162 if (sdata->reserved_ready) in ieee80211_chswitch_work()
1170 ieee80211_queue_work(&sdata->local->hw, in ieee80211_chswitch_work()
1171 &ifmgd->csa_connection_drop_work); in ieee80211_chswitch_work()
1178 if (!cfg80211_chandef_identical(&sdata->vif.bss_conf.chandef, in ieee80211_chswitch_work()
1179 &sdata->csa_chandef)) { in ieee80211_chswitch_work()
1182 ieee80211_queue_work(&sdata->local->hw, in ieee80211_chswitch_work()
1183 &ifmgd->csa_connection_drop_work); in ieee80211_chswitch_work()
1187 ifmgd->csa_waiting_bcn = true; in ieee80211_chswitch_work()
1193 mutex_unlock(&local->chanctx_mtx); in ieee80211_chswitch_work()
1194 mutex_unlock(&local->mtx); in ieee80211_chswitch_work()
1200 struct ieee80211_local *local = sdata->local; in ieee80211_chswitch_post_beacon()
1201 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_chswitch_post_beacon()
1206 WARN_ON(!sdata->vif.csa_active); in ieee80211_chswitch_post_beacon()
1208 if (sdata->csa_block_tx) { in ieee80211_chswitch_post_beacon()
1211 sdata->csa_block_tx = false; in ieee80211_chswitch_post_beacon()
1214 sdata->vif.csa_active = false; in ieee80211_chswitch_post_beacon()
1215 ifmgd->csa_waiting_bcn = false; in ieee80211_chswitch_post_beacon()
1220 ifmgd->beacon_crc_valid = false; in ieee80211_chswitch_post_beacon()
1226 ieee80211_queue_work(&local->hw, in ieee80211_chswitch_post_beacon()
1227 &ifmgd->csa_connection_drop_work); in ieee80211_chswitch_post_beacon()
1231 cfg80211_ch_switch_notify(sdata->dev, &sdata->reserved_chandef); in ieee80211_chswitch_post_beacon()
1237 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_chswitch_done()
1243 ieee80211_queue_work(&sdata->local->hw, in ieee80211_chswitch_done()
1244 &ifmgd->csa_connection_drop_work); in ieee80211_chswitch_done()
1246 ieee80211_queue_work(&sdata->local->hw, &ifmgd->chswitch_work); in ieee80211_chswitch_done()
1256 ieee80211_queue_work(&sdata->local->hw, &sdata->u.mgd.chswitch_work); in ieee80211_chswitch_timer()
1262 struct ieee80211_local *local = sdata->local; in ieee80211_sta_abort_chanswitch()
1264 if (!local->ops->abort_channel_switch) in ieee80211_sta_abort_chanswitch()
1267 mutex_lock(&local->mtx); in ieee80211_sta_abort_chanswitch()
1269 mutex_lock(&local->chanctx_mtx); in ieee80211_sta_abort_chanswitch()
1271 mutex_unlock(&local->chanctx_mtx); in ieee80211_sta_abort_chanswitch()
1273 if (sdata->csa_block_tx) in ieee80211_sta_abort_chanswitch()
1277 sdata->csa_block_tx = false; in ieee80211_sta_abort_chanswitch()
1278 sdata->vif.csa_active = false; in ieee80211_sta_abort_chanswitch()
1280 mutex_unlock(&local->mtx); in ieee80211_sta_abort_chanswitch()
1291 struct ieee80211_local *local = sdata->local; in ieee80211_sta_process_chanswitch()
1292 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_sta_process_chanswitch()
1293 struct cfg80211_bss *cbss = ifmgd->associated; in ieee80211_sta_process_chanswitch()
1307 if (local->scanning) in ieee80211_sta_process_chanswitch()
1310 current_band = cbss->channel->band; in ieee80211_sta_process_chanswitch()
1311 bss = (void *)cbss->priv; in ieee80211_sta_process_chanswitch()
1313 bss->vht_cap_info, in ieee80211_sta_process_chanswitch()
1314 ifmgd->flags, in ieee80211_sta_process_chanswitch()
1315 ifmgd->associated->bssid, &csa_ie); in ieee80211_sta_process_chanswitch()
1329 if (beacon && sdata->vif.csa_active && !ifmgd->csa_waiting_bcn) { in ieee80211_sta_process_chanswitch()
1335 } else if (sdata->vif.csa_active || res) { in ieee80211_sta_process_chanswitch()
1340 if (sdata->vif.bss_conf.chandef.chan->band != in ieee80211_sta_process_chanswitch()
1341 csa_ie.chandef.chan->band) { in ieee80211_sta_process_chanswitch()
1344 ifmgd->associated->bssid, in ieee80211_sta_process_chanswitch()
1345 csa_ie.chandef.chan->center_freq, in ieee80211_sta_process_chanswitch()
1351 if (!cfg80211_chandef_usable(local->hw.wiphy, &csa_ie.chandef, in ieee80211_sta_process_chanswitch()
1357 ifmgd->associated->bssid, in ieee80211_sta_process_chanswitch()
1358 csa_ie.chandef.chan->center_freq, in ieee80211_sta_process_chanswitch()
1359 csa_ie.chandef.chan->freq_offset, in ieee80211_sta_process_chanswitch()
1367 &sdata->vif.bss_conf.chandef) && in ieee80211_sta_process_chanswitch()
1369 if (ifmgd->csa_ignored_same_chan) in ieee80211_sta_process_chanswitch()
1373 ifmgd->associated->bssid); in ieee80211_sta_process_chanswitch()
1374 ifmgd->csa_ignored_same_chan = true; in ieee80211_sta_process_chanswitch()
1379 * Drop all TDLS peers - either we disconnect or move to a different in ieee80211_sta_process_chanswitch()
1386 mutex_lock(&local->mtx); in ieee80211_sta_process_chanswitch()
1387 mutex_lock(&local->chanctx_mtx); in ieee80211_sta_process_chanswitch()
1388 conf = rcu_dereference_protected(sdata->vif.chanctx_conf, in ieee80211_sta_process_chanswitch()
1389 lockdep_is_held(&local->chanctx_mtx)); in ieee80211_sta_process_chanswitch()
1398 if (local->use_chanctx && in ieee80211_sta_process_chanswitch()
1399 !ieee80211_hw_check(&local->hw, CHANCTX_STA_CSA)) { in ieee80211_sta_process_chanswitch()
1401 "driver doesn't support chan-switch with channel contexts\n"); in ieee80211_sta_process_chanswitch()
1412 chanctx->mode, false); in ieee80211_sta_process_chanswitch()
1419 mutex_unlock(&local->chanctx_mtx); in ieee80211_sta_process_chanswitch()
1421 sdata->vif.csa_active = true; in ieee80211_sta_process_chanswitch()
1422 sdata->csa_chandef = csa_ie.chandef; in ieee80211_sta_process_chanswitch()
1423 sdata->csa_block_tx = csa_ie.mode; in ieee80211_sta_process_chanswitch()
1424 ifmgd->csa_ignored_same_chan = false; in ieee80211_sta_process_chanswitch()
1425 ifmgd->beacon_crc_valid = false; in ieee80211_sta_process_chanswitch()
1427 if (sdata->csa_block_tx) in ieee80211_sta_process_chanswitch()
1430 mutex_unlock(&local->mtx); in ieee80211_sta_process_chanswitch()
1432 cfg80211_ch_switch_started_notify(sdata->dev, &csa_ie.chandef, in ieee80211_sta_process_chanswitch()
1435 if (local->ops->channel_switch) { in ieee80211_sta_process_chanswitch()
1443 ieee80211_queue_work(&local->hw, &ifmgd->chswitch_work); in ieee80211_sta_process_chanswitch()
1445 mod_timer(&ifmgd->chswitch_timer, in ieee80211_sta_process_chanswitch()
1446 TU_TO_EXP_TIME((csa_ie.count - 1) * in ieee80211_sta_process_chanswitch()
1447 cbss->beacon_interval)); in ieee80211_sta_process_chanswitch()
1450 mutex_lock(&local->mtx); in ieee80211_sta_process_chanswitch()
1451 mutex_lock(&local->chanctx_mtx); in ieee80211_sta_process_chanswitch()
1460 sdata->vif.csa_active = true; in ieee80211_sta_process_chanswitch()
1461 sdata->csa_block_tx = csa_ie.mode; in ieee80211_sta_process_chanswitch()
1463 ieee80211_queue_work(&local->hw, &ifmgd->csa_connection_drop_work); in ieee80211_sta_process_chanswitch()
1464 mutex_unlock(&local->chanctx_mtx); in ieee80211_sta_process_chanswitch()
1465 mutex_unlock(&local->mtx); in ieee80211_sta_process_chanswitch()
1476 int chan = ieee80211_frequency_to_channel(channel->center_freq); in ieee80211_find_80211h_pwr_constr()
1485 country_ie_len -= 3; in ieee80211_find_80211h_pwr_constr()
1487 switch (channel->band) { in ieee80211_find_80211h_pwr_constr()
1511 u8 first_channel = triplet->chans.first_channel; in ieee80211_find_80211h_pwr_constr()
1516 for (i = 0; i < triplet->chans.num_channels; i++) { in ieee80211_find_80211h_pwr_constr()
1519 *chan_pwr = triplet->chans.max_power; in ieee80211_find_80211h_pwr_constr()
1528 country_ie_len -= 3; in ieee80211_find_80211h_pwr_constr()
1546 * APs clearly state the range is -127 to 127 dBm, which indicates in ieee80211_find_cisco_dtpc()
1564 __le16 capab = mgmt->u.probe_resp.capab_info; in ieee80211_handle_pwr_constr()
1566 if (ieee80211_is_s1g_beacon(mgmt->frame_control)) in ieee80211_handle_pwr_constr()
1576 max_t(int, 0, chan_pwr - pwr_reduction_80211h); in ieee80211_handle_pwr_constr()
1595 if (sdata->ap_power_level == new_ap_level) in ieee80211_handle_pwr_constr()
1599 "Limiting TX power to %d (%d - %d) dBm as advertised by %pM\n", in ieee80211_handle_pwr_constr()
1601 sdata->u.mgd.bssid); in ieee80211_handle_pwr_constr()
1605 if (sdata->ap_power_level == new_ap_level) in ieee80211_handle_pwr_constr()
1610 pwr_level_cisco, sdata->u.mgd.bssid); in ieee80211_handle_pwr_constr()
1613 sdata->ap_power_level = new_ap_level; in ieee80211_handle_pwr_constr()
1623 struct ieee80211_conf *conf = &local->hw.conf; in ieee80211_enable_ps()
1629 if (local->scanning) in ieee80211_enable_ps()
1632 if (conf->dynamic_ps_timeout > 0 && in ieee80211_enable_ps()
1633 !ieee80211_hw_check(&local->hw, SUPPORTS_DYNAMIC_PS)) { in ieee80211_enable_ps()
1634 mod_timer(&local->dynamic_ps_timer, jiffies + in ieee80211_enable_ps()
1635 msecs_to_jiffies(conf->dynamic_ps_timeout)); in ieee80211_enable_ps()
1637 if (ieee80211_hw_check(&local->hw, PS_NULLFUNC_STACK)) in ieee80211_enable_ps()
1640 if (ieee80211_hw_check(&local->hw, PS_NULLFUNC_STACK) && in ieee80211_enable_ps()
1641 ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) in ieee80211_enable_ps()
1644 conf->flags |= IEEE80211_CONF_PS; in ieee80211_enable_ps()
1651 struct ieee80211_conf *conf = &local->hw.conf; in ieee80211_change_ps()
1653 if (local->ps_sdata) { in ieee80211_change_ps()
1654 ieee80211_enable_ps(local, local->ps_sdata); in ieee80211_change_ps()
1655 } else if (conf->flags & IEEE80211_CONF_PS) { in ieee80211_change_ps()
1656 conf->flags &= ~IEEE80211_CONF_PS; in ieee80211_change_ps()
1658 del_timer_sync(&local->dynamic_ps_timer); in ieee80211_change_ps()
1659 cancel_work_sync(&local->dynamic_ps_enable_work); in ieee80211_change_ps()
1665 struct ieee80211_if_managed *mgd = &sdata->u.mgd; in ieee80211_powersave_allowed()
1669 if (!mgd->powersave) in ieee80211_powersave_allowed()
1672 if (mgd->broken_ap) in ieee80211_powersave_allowed()
1675 if (!mgd->associated) in ieee80211_powersave_allowed()
1678 if (mgd->flags & IEEE80211_STA_CONNECTION_POLL) in ieee80211_powersave_allowed()
1681 if (!mgd->have_beacon) in ieee80211_powersave_allowed()
1685 sta = sta_info_get(sdata, mgd->bssid); in ieee80211_powersave_allowed()
1700 if (!ieee80211_hw_check(&local->hw, SUPPORTS_PS)) { in ieee80211_recalc_ps()
1701 local->ps_sdata = NULL; in ieee80211_recalc_ps()
1705 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_recalc_ps()
1708 if (sdata->vif.type == NL80211_IFTYPE_AP) { in ieee80211_recalc_ps()
1716 if (sdata->vif.type != NL80211_IFTYPE_STATION) in ieee80211_recalc_ps()
1723 u8 dtimper = found->u.mgd.dtim_period; in ieee80211_recalc_ps()
1725 timeout = local->dynamic_ps_forced_timeout; in ieee80211_recalc_ps()
1728 local->hw.conf.dynamic_ps_timeout = timeout; in ieee80211_recalc_ps()
1734 local->hw.conf.ps_dtim_period = dtimper; in ieee80211_recalc_ps()
1735 local->ps_sdata = found; in ieee80211_recalc_ps()
1737 local->ps_sdata = NULL; in ieee80211_recalc_ps()
1747 if (sdata->vif.bss_conf.ps != ps_allowed) { in ieee80211_recalc_ps_vif()
1748 sdata->vif.bss_conf.ps = ps_allowed; in ieee80211_recalc_ps_vif()
1759 if (local->hw.conf.flags & IEEE80211_CONF_PS) { in ieee80211_dynamic_ps_disable_work()
1760 local->hw.conf.flags &= ~IEEE80211_CONF_PS; in ieee80211_dynamic_ps_disable_work()
1764 ieee80211_wake_queues_by_reason(&local->hw, in ieee80211_dynamic_ps_disable_work()
1775 struct ieee80211_sub_if_data *sdata = local->ps_sdata; in ieee80211_dynamic_ps_enable_work()
1784 ifmgd = &sdata->u.mgd; in ieee80211_dynamic_ps_enable_work()
1786 if (local->hw.conf.flags & IEEE80211_CONF_PS) in ieee80211_dynamic_ps_enable_work()
1789 if (local->hw.conf.dynamic_ps_timeout > 0) { in ieee80211_dynamic_ps_enable_work()
1792 mod_timer(&local->dynamic_ps_timer, jiffies + in ieee80211_dynamic_ps_enable_work()
1794 local->hw.conf.dynamic_ps_timeout)); in ieee80211_dynamic_ps_enable_work()
1803 spin_lock_irqsave(&local->queue_stop_reason_lock, flags); in ieee80211_dynamic_ps_enable_work()
1804 for (q = 0; q < local->hw.queues; q++) { in ieee80211_dynamic_ps_enable_work()
1805 if (local->queue_stop_reasons[q]) { in ieee80211_dynamic_ps_enable_work()
1806 spin_unlock_irqrestore(&local->queue_stop_reason_lock, in ieee80211_dynamic_ps_enable_work()
1808 mod_timer(&local->dynamic_ps_timer, jiffies + in ieee80211_dynamic_ps_enable_work()
1810 local->hw.conf.dynamic_ps_timeout)); in ieee80211_dynamic_ps_enable_work()
1814 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); in ieee80211_dynamic_ps_enable_work()
1817 if (ieee80211_hw_check(&local->hw, PS_NULLFUNC_STACK) && in ieee80211_dynamic_ps_enable_work()
1818 !(ifmgd->flags & IEEE80211_STA_NULLFUNC_ACKED)) { in ieee80211_dynamic_ps_enable_work()
1820 mod_timer(&local->dynamic_ps_timer, jiffies + in ieee80211_dynamic_ps_enable_work()
1822 local->hw.conf.dynamic_ps_timeout)); in ieee80211_dynamic_ps_enable_work()
1830 if (!(ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS) && in ieee80211_dynamic_ps_enable_work()
1831 ieee80211_hw_check(&local->hw, PS_NULLFUNC_STACK)) || in ieee80211_dynamic_ps_enable_work()
1832 (ifmgd->flags & IEEE80211_STA_NULLFUNC_ACKED)) { in ieee80211_dynamic_ps_enable_work()
1833 ifmgd->flags &= ~IEEE80211_STA_NULLFUNC_ACKED; in ieee80211_dynamic_ps_enable_work()
1834 local->hw.conf.flags |= IEEE80211_CONF_PS; in ieee80211_dynamic_ps_enable_work()
1843 ieee80211_queue_work(&local->hw, &local->dynamic_ps_enable_work); in ieee80211_dynamic_ps_timer()
1852 struct cfg80211_chan_def chandef = sdata->vif.bss_conf.chandef; in ieee80211_dfs_cac_timer_work()
1854 mutex_lock(&sdata->local->mtx); in ieee80211_dfs_cac_timer_work()
1855 if (sdata->wdev.cac_started) { in ieee80211_dfs_cac_timer_work()
1857 cfg80211_cac_event(sdata->dev, &chandef, in ieee80211_dfs_cac_timer_work()
1861 mutex_unlock(&sdata->local->mtx); in ieee80211_dfs_cac_timer_work()
1867 struct ieee80211_local *local = sdata->local; in __ieee80211_sta_handle_tspec_ac_params()
1868 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in __ieee80211_sta_handle_tspec_ac_params()
1872 if (local->hw.queues < IEEE80211_NUM_ACS) in __ieee80211_sta_handle_tspec_ac_params()
1876 struct ieee80211_sta_tx_tspec *tx_tspec = &ifmgd->tx_tspec[ac]; in __ieee80211_sta_handle_tspec_ac_params()
1880 if (tx_tspec->action == TX_TSPEC_ACTION_NONE && in __ieee80211_sta_handle_tspec_ac_params()
1881 tx_tspec->admitted_time && in __ieee80211_sta_handle_tspec_ac_params()
1882 time_after(now, tx_tspec->time_slice_start + HZ)) { in __ieee80211_sta_handle_tspec_ac_params()
1883 tx_tspec->consumed_tx_time = 0; in __ieee80211_sta_handle_tspec_ac_params()
1884 tx_tspec->time_slice_start = now; in __ieee80211_sta_handle_tspec_ac_params()
1886 if (tx_tspec->downgraded) in __ieee80211_sta_handle_tspec_ac_params()
1887 tx_tspec->action = in __ieee80211_sta_handle_tspec_ac_params()
1891 switch (tx_tspec->action) { in __ieee80211_sta_handle_tspec_ac_params()
1894 if (drv_conf_tx(local, sdata, ac, &sdata->tx_conf[ac])) in __ieee80211_sta_handle_tspec_ac_params()
1898 tx_tspec->action = TX_TSPEC_ACTION_NONE; in __ieee80211_sta_handle_tspec_ac_params()
1899 tx_tspec->downgraded = false; in __ieee80211_sta_handle_tspec_ac_params()
1903 if (time_after(now, tx_tspec->time_slice_start + HZ)) { in __ieee80211_sta_handle_tspec_ac_params()
1904 tx_tspec->action = TX_TSPEC_ACTION_NONE; in __ieee80211_sta_handle_tspec_ac_params()
1908 /* downgrade next lower non-ACM AC */ in __ieee80211_sta_handle_tspec_ac_params()
1912 if (!(sdata->wmm_acm & BIT(7 - 2 * non_acm_ac))) in __ieee80211_sta_handle_tspec_ac_params()
1916 * makes no sense and we have to transmit somehow - the in __ieee80211_sta_handle_tspec_ac_params()
1924 &sdata->tx_conf[non_acm_ac])) in __ieee80211_sta_handle_tspec_ac_params()
1928 tx_tspec->action = TX_TSPEC_ACTION_NONE; in __ieee80211_sta_handle_tspec_ac_params()
1930 schedule_delayed_work(&ifmgd->tx_tspec_wk, in __ieee80211_sta_handle_tspec_ac_params()
1931 tx_tspec->time_slice_start + HZ - now + 1); in __ieee80211_sta_handle_tspec_ac_params()
1965 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_sta_wmm_params()
1971 if (!local->ops->conf_tx) in ieee80211_sta_wmm_params()
1974 if (local->hw.queues < IEEE80211_NUM_ACS) in ieee80211_sta_wmm_params()
1983 if (ifmgd->flags & IEEE80211_STA_UAPSD_ENABLED) in ieee80211_sta_wmm_params()
1984 uapsd_queues = ifmgd->uapsd_queues; in ieee80211_sta_wmm_params()
1987 /* -1 is the initial value of ifmgd->mu_edca_last_param_set. in ieee80211_sta_wmm_params()
1991 mu_edca_count = mu_edca ? mu_edca->mu_qos_info & 0x0f : -1; in ieee80211_sta_wmm_params()
1992 if (count == ifmgd->wmm_last_param_set && in ieee80211_sta_wmm_params()
1993 mu_edca_count == ifmgd->mu_edca_last_param_set) in ieee80211_sta_wmm_params()
1995 ifmgd->wmm_last_param_set = count; in ieee80211_sta_wmm_params()
1996 ifmgd->mu_edca_last_param_set = mu_edca_count; in ieee80211_sta_wmm_params()
1999 left = wmm_param_len - 8; in ieee80211_sta_wmm_params()
2003 sdata->wmm_acm = 0; in ieee80211_sta_wmm_params()
2004 for (; left >= 4; left -= 4, pos += 4) { in ieee80211_sta_wmm_params()
2013 sdata->wmm_acm |= BIT(1) | BIT(2); /* BK/- */ in ieee80211_sta_wmm_params()
2018 params[ac].mu_edca_param_rec = mu_edca->ac_bk; in ieee80211_sta_wmm_params()
2023 sdata->wmm_acm |= BIT(4) | BIT(5); /* CL/VI */ in ieee80211_sta_wmm_params()
2028 params[ac].mu_edca_param_rec = mu_edca->ac_vi; in ieee80211_sta_wmm_params()
2033 sdata->wmm_acm |= BIT(6) | BIT(7); /* VO/NC */ in ieee80211_sta_wmm_params()
2038 params[ac].mu_edca_param_rec = mu_edca->ac_vo; in ieee80211_sta_wmm_params()
2044 sdata->wmm_acm |= BIT(0) | BIT(3); /* BE/EE */ in ieee80211_sta_wmm_params()
2049 params[ac].mu_edca_param_rec = mu_edca->ac_be; in ieee80211_sta_wmm_params()
2093 ifmgd->tx_tspec[ac].downgraded); in ieee80211_sta_wmm_params()
2094 sdata->tx_conf[ac] = params[ac]; in ieee80211_sta_wmm_params()
2095 if (!ifmgd->tx_tspec[ac].downgraded && in ieee80211_sta_wmm_params()
2103 sdata->vif.bss_conf.qos = true; in ieee80211_sta_wmm_params()
2109 lockdep_assert_held(&sdata->local->mtx); in __ieee80211_stop_poll()
2111 sdata->u.mgd.flags &= ~IEEE80211_STA_CONNECTION_POLL; in __ieee80211_stop_poll()
2112 ieee80211_run_deferred_scan(sdata->local); in __ieee80211_stop_poll()
2117 mutex_lock(&sdata->local->mtx); in ieee80211_stop_poll()
2119 mutex_unlock(&sdata->local->mtx); in ieee80211_stop_poll()
2125 struct ieee80211_bss_conf *bss_conf = &sdata->vif.bss_conf; in ieee80211_handle_bss_capability()
2145 if (sband->band == NL80211_BAND_5GHZ || in ieee80211_handle_bss_capability()
2146 sband->band == NL80211_BAND_6GHZ) in ieee80211_handle_bss_capability()
2149 if (use_protection != bss_conf->use_cts_prot) { in ieee80211_handle_bss_capability()
2150 bss_conf->use_cts_prot = use_protection; in ieee80211_handle_bss_capability()
2154 if (use_short_preamble != bss_conf->use_short_preamble) { in ieee80211_handle_bss_capability()
2155 bss_conf->use_short_preamble = use_short_preamble; in ieee80211_handle_bss_capability()
2159 if (use_short_slot != bss_conf->use_short_slot) { in ieee80211_handle_bss_capability()
2160 bss_conf->use_short_slot = use_short_slot; in ieee80211_handle_bss_capability()
2171 struct ieee80211_bss *bss = (void *)cbss->priv; in ieee80211_set_associated()
2172 struct ieee80211_local *local = sdata->local; in ieee80211_set_associated()
2173 struct ieee80211_bss_conf *bss_conf = &sdata->vif.bss_conf; in ieee80211_set_associated()
2177 bss_conf->assoc_capability, bss->has_erp_value, bss->erp_value); in ieee80211_set_associated()
2179 sdata->u.mgd.beacon_timeout = usecs_to_jiffies(ieee80211_tu_to_usec( in ieee80211_set_associated()
2180 beacon_loss_count * bss_conf->beacon_int)); in ieee80211_set_associated()
2182 sdata->u.mgd.associated = cbss; in ieee80211_set_associated()
2183 memcpy(sdata->u.mgd.bssid, cbss->bssid, ETH_ALEN); in ieee80211_set_associated()
2187 sdata->u.mgd.flags |= IEEE80211_STA_RESET_SIGNAL_AVE; in ieee80211_set_associated()
2189 if (sdata->vif.p2p || in ieee80211_set_associated()
2190 sdata->vif.driver_flags & IEEE80211_VIF_GET_NOA_UPDATE) { in ieee80211_set_associated()
2194 ies = rcu_dereference(cbss->ies); in ieee80211_set_associated()
2199 ies->data, ies->len, in ieee80211_set_associated()
2201 (u8 *) &bss_conf->p2p_noa_attr, in ieee80211_set_associated()
2202 sizeof(bss_conf->p2p_noa_attr)); in ieee80211_set_associated()
2204 sdata->u.mgd.p2p_noa_index = in ieee80211_set_associated()
2205 bss_conf->p2p_noa_attr.index; in ieee80211_set_associated()
2217 if (sdata->u.mgd.have_beacon) { in ieee80211_set_associated()
2224 bss_conf->dtim_period = sdata->u.mgd.dtim_period ?: 1; in ieee80211_set_associated()
2225 bss_conf->beacon_rate = bss->beacon_rate; in ieee80211_set_associated()
2228 bss_conf->beacon_rate = NULL; in ieee80211_set_associated()
2229 bss_conf->dtim_period = 0; in ieee80211_set_associated()
2232 bss_conf->assoc = 1; in ieee80211_set_associated()
2235 if (sdata->vif.driver_flags & IEEE80211_VIF_SUPPORTS_CQM_RSSI && in ieee80211_set_associated()
2236 bss_conf->cqm_rssi_thold) in ieee80211_set_associated()
2240 if (bss_conf->arp_addr_cnt) in ieee80211_set_associated()
2245 mutex_lock(&local->iflist_mtx); in ieee80211_set_associated()
2247 mutex_unlock(&local->iflist_mtx); in ieee80211_set_associated()
2252 netif_carrier_on(sdata->dev); in ieee80211_set_associated()
2259 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_set_disassoc()
2260 struct ieee80211_local *local = sdata->local; in ieee80211_set_disassoc()
2271 if (WARN_ON(!ifmgd->associated)) in ieee80211_set_disassoc()
2276 ifmgd->associated = NULL; in ieee80211_set_disassoc()
2277 netif_carrier_off(sdata->dev); in ieee80211_set_disassoc()
2281 * to do it before sending disassoc, as otherwise the null-packet in ieee80211_set_disassoc()
2284 if (local->hw.conf.flags & IEEE80211_CONF_PS) { in ieee80211_set_disassoc()
2285 local->hw.conf.flags &= ~IEEE80211_CONF_PS; in ieee80211_set_disassoc()
2288 local->ps_sdata = NULL; in ieee80211_set_disassoc()
2290 /* disable per-vif ps */ in ieee80211_set_disassoc()
2313 if (ieee80211_hw_check(&local->hw, DEAUTH_NEED_MGD_TX_PREP) && in ieee80211_set_disassoc()
2314 !ifmgd->have_beacon) { in ieee80211_set_disassoc()
2315 drv_mgd_prepare_tx(sdata->local, sdata, &info); in ieee80211_set_disassoc()
2318 ieee80211_send_deauth_disassoc(sdata, ifmgd->bssid, in ieee80211_set_disassoc()
2319 ifmgd->bssid, stype, reason, in ieee80211_set_disassoc()
2323 /* flush out frame - make sure the deauth was actually sent */ in ieee80211_set_disassoc()
2327 drv_mgd_complete_tx(sdata->local, sdata, &info); in ieee80211_set_disassoc()
2330 eth_zero_addr(ifmgd->bssid); in ieee80211_set_disassoc()
2332 sdata->vif.bss_conf.ssid_len = 0; in ieee80211_set_disassoc()
2342 sdata->vif.bss_conf.assoc = false; in ieee80211_set_disassoc()
2344 ifmgd->p2p_noa_index = -1; in ieee80211_set_disassoc()
2345 memset(&sdata->vif.bss_conf.p2p_noa_attr, 0, in ieee80211_set_disassoc()
2346 sizeof(sdata->vif.bss_conf.p2p_noa_attr)); in ieee80211_set_disassoc()
2348 /* on the next assoc, re-program HT/VHT parameters */ in ieee80211_set_disassoc()
2349 memset(&ifmgd->ht_capa, 0, sizeof(ifmgd->ht_capa)); in ieee80211_set_disassoc()
2350 memset(&ifmgd->ht_capa_mask, 0, sizeof(ifmgd->ht_capa_mask)); in ieee80211_set_disassoc()
2351 memset(&ifmgd->vht_capa, 0, sizeof(ifmgd->vht_capa)); in ieee80211_set_disassoc()
2352 memset(&ifmgd->vht_capa_mask, 0, sizeof(ifmgd->vht_capa_mask)); in ieee80211_set_disassoc()
2354 /* reset MU-MIMO ownership and group data */ in ieee80211_set_disassoc()
2355 memset(sdata->vif.bss_conf.mu_group.membership, 0, in ieee80211_set_disassoc()
2356 sizeof(sdata->vif.bss_conf.mu_group.membership)); in ieee80211_set_disassoc()
2357 memset(sdata->vif.bss_conf.mu_group.position, 0, in ieee80211_set_disassoc()
2358 sizeof(sdata->vif.bss_conf.mu_group.position)); in ieee80211_set_disassoc()
2360 sdata->vif.mu_mimo_owner = false; in ieee80211_set_disassoc()
2362 sdata->ap_power_level = IEEE80211_UNSET_POWER_LEVEL; in ieee80211_set_disassoc()
2364 del_timer_sync(&local->dynamic_ps_timer); in ieee80211_set_disassoc()
2365 cancel_work_sync(&local->dynamic_ps_enable_work); in ieee80211_set_disassoc()
2368 if (sdata->vif.bss_conf.arp_addr_cnt) in ieee80211_set_disassoc()
2371 sdata->vif.bss_conf.qos = false; in ieee80211_set_disassoc()
2378 /* disassociated - set to defaults now */ in ieee80211_set_disassoc()
2381 del_timer_sync(&sdata->u.mgd.conn_mon_timer); in ieee80211_set_disassoc()
2382 del_timer_sync(&sdata->u.mgd.bcn_mon_timer); in ieee80211_set_disassoc()
2383 del_timer_sync(&sdata->u.mgd.timer); in ieee80211_set_disassoc()
2384 del_timer_sync(&sdata->u.mgd.chswitch_timer); in ieee80211_set_disassoc()
2386 sdata->vif.bss_conf.dtim_period = 0; in ieee80211_set_disassoc()
2387 sdata->vif.bss_conf.beacon_rate = NULL; in ieee80211_set_disassoc()
2389 ifmgd->have_beacon = false; in ieee80211_set_disassoc()
2391 ifmgd->flags = 0; in ieee80211_set_disassoc()
2392 mutex_lock(&local->mtx); in ieee80211_set_disassoc()
2395 sdata->vif.csa_active = false; in ieee80211_set_disassoc()
2396 ifmgd->csa_waiting_bcn = false; in ieee80211_set_disassoc()
2397 ifmgd->csa_ignored_same_chan = false; in ieee80211_set_disassoc()
2398 if (sdata->csa_block_tx) { in ieee80211_set_disassoc()
2401 sdata->csa_block_tx = false; in ieee80211_set_disassoc()
2403 mutex_unlock(&local->mtx); in ieee80211_set_disassoc()
2406 memset(ifmgd->tx_tspec, 0, sizeof(ifmgd->tx_tspec)); in ieee80211_set_disassoc()
2407 cancel_delayed_work_sync(&ifmgd->tx_tspec_wk); in ieee80211_set_disassoc()
2409 sdata->encrypt_headroom = IEEE80211_ENCRYPT_HEADROOM; in ieee80211_set_disassoc()
2414 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_reset_ap_probe()
2415 struct ieee80211_local *local = sdata->local; in ieee80211_reset_ap_probe()
2417 mutex_lock(&local->mtx); in ieee80211_reset_ap_probe()
2418 if (!(ifmgd->flags & IEEE80211_STA_CONNECTION_POLL)) in ieee80211_reset_ap_probe()
2423 mutex_lock(&local->iflist_mtx); in ieee80211_reset_ap_probe()
2425 mutex_unlock(&local->iflist_mtx); in ieee80211_reset_ap_probe()
2427 if (ieee80211_hw_check(&sdata->local->hw, CONNECTION_MONITOR)) in ieee80211_reset_ap_probe()
2437 mod_timer(&ifmgd->conn_mon_timer, in ieee80211_reset_ap_probe()
2441 mutex_unlock(&local->mtx); in ieee80211_reset_ap_probe()
2448 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_sta_tx_wmm_ac_notify()
2451 struct ieee80211_sta_tx_tspec *tx_tspec = &ifmgd->tx_tspec[ac]; in ieee80211_sta_tx_wmm_ac_notify()
2454 if (likely(!tx_tspec->admitted_time)) in ieee80211_sta_tx_wmm_ac_notify()
2457 if (time_after(now, tx_tspec->time_slice_start + HZ)) { in ieee80211_sta_tx_wmm_ac_notify()
2458 tx_tspec->consumed_tx_time = 0; in ieee80211_sta_tx_wmm_ac_notify()
2459 tx_tspec->time_slice_start = now; in ieee80211_sta_tx_wmm_ac_notify()
2461 if (tx_tspec->downgraded) { in ieee80211_sta_tx_wmm_ac_notify()
2462 tx_tspec->action = TX_TSPEC_ACTION_STOP_DOWNGRADE; in ieee80211_sta_tx_wmm_ac_notify()
2463 schedule_delayed_work(&ifmgd->tx_tspec_wk, 0); in ieee80211_sta_tx_wmm_ac_notify()
2467 if (tx_tspec->downgraded) in ieee80211_sta_tx_wmm_ac_notify()
2470 tx_tspec->consumed_tx_time += tx_time; in ieee80211_sta_tx_wmm_ac_notify()
2472 if (tx_tspec->consumed_tx_time >= tx_tspec->admitted_time) { in ieee80211_sta_tx_wmm_ac_notify()
2473 tx_tspec->downgraded = true; in ieee80211_sta_tx_wmm_ac_notify()
2474 tx_tspec->action = TX_TSPEC_ACTION_DOWNGRADE; in ieee80211_sta_tx_wmm_ac_notify()
2475 schedule_delayed_work(&ifmgd->tx_tspec_wk, 0); in ieee80211_sta_tx_wmm_ac_notify()
2484 if (!ieee80211_is_any_nullfunc(hdr->frame_control) || in ieee80211_sta_tx_notify()
2485 !sdata->u.mgd.probe_send_count) in ieee80211_sta_tx_notify()
2489 sdata->u.mgd.probe_send_count = 0; in ieee80211_sta_tx_notify()
2491 sdata->u.mgd.nullfunc_failed = true; in ieee80211_sta_tx_notify()
2492 ieee80211_queue_work(&sdata->local->hw, &sdata->work); in ieee80211_sta_tx_notify()
2502 skb = ieee80211_build_probe_req(sdata, src, dst, (u32)-1, channel, in ieee80211_mlme_send_probe_req()
2511 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_mgd_probe_ap_send()
2513 u8 *dst = ifmgd->associated->bssid; in ieee80211_mgd_probe_ap_send()
2514 u8 unicast_limit = max(1, max_probe_tries - 3); in ieee80211_mgd_probe_ap_send()
2522 if (ifmgd->probe_send_count >= unicast_limit) in ieee80211_mgd_probe_ap_send()
2532 ifmgd->probe_send_count++; in ieee80211_mgd_probe_ap_send()
2535 mutex_lock(&sdata->local->sta_mtx); in ieee80211_mgd_probe_ap_send()
2539 mutex_unlock(&sdata->local->sta_mtx); in ieee80211_mgd_probe_ap_send()
2542 if (ieee80211_hw_check(&sdata->local->hw, REPORTS_TX_ACK_STATUS)) { in ieee80211_mgd_probe_ap_send()
2543 ifmgd->nullfunc_failed = false; in ieee80211_mgd_probe_ap_send()
2544 ieee80211_send_nullfunc(sdata->local, sdata, false); in ieee80211_mgd_probe_ap_send()
2549 ssid = ieee80211_bss_get_ie(ifmgd->associated, WLAN_EID_SSID); in ieee80211_mgd_probe_ap_send()
2555 ieee80211_mlme_send_probe_req(sdata, sdata->vif.addr, dst, in ieee80211_mgd_probe_ap_send()
2557 ifmgd->associated->channel); in ieee80211_mgd_probe_ap_send()
2561 ifmgd->probe_timeout = jiffies + msecs_to_jiffies(probe_wait_ms); in ieee80211_mgd_probe_ap_send()
2562 run_again(sdata, ifmgd->probe_timeout); in ieee80211_mgd_probe_ap_send()
2568 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_mgd_probe_ap()
2576 if (!ifmgd->associated) in ieee80211_mgd_probe_ap()
2579 mutex_lock(&sdata->local->mtx); in ieee80211_mgd_probe_ap()
2581 if (sdata->local->tmp_channel || sdata->local->scanning) { in ieee80211_mgd_probe_ap()
2582 mutex_unlock(&sdata->local->mtx); in ieee80211_mgd_probe_ap()
2588 "detected beacon loss from AP (missed %d beacons) - probing\n", in ieee80211_mgd_probe_ap()
2591 ieee80211_cqm_beacon_loss_notify(&sdata->vif, GFP_KERNEL); in ieee80211_mgd_probe_ap()
2605 if (ifmgd->flags & IEEE80211_STA_CONNECTION_POLL) in ieee80211_mgd_probe_ap()
2608 ifmgd->flags |= IEEE80211_STA_CONNECTION_POLL; in ieee80211_mgd_probe_ap()
2610 mutex_unlock(&sdata->local->mtx); in ieee80211_mgd_probe_ap()
2615 mutex_lock(&sdata->local->iflist_mtx); in ieee80211_mgd_probe_ap()
2616 ieee80211_recalc_ps(sdata->local); in ieee80211_mgd_probe_ap()
2617 mutex_unlock(&sdata->local->iflist_mtx); in ieee80211_mgd_probe_ap()
2619 ifmgd->probe_send_count = 0; in ieee80211_mgd_probe_ap()
2629 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_ap_probereq_get()
2635 if (WARN_ON(sdata->vif.type != NL80211_IFTYPE_STATION)) in ieee80211_ap_probereq_get()
2640 if (ifmgd->associated) in ieee80211_ap_probereq_get()
2641 cbss = ifmgd->associated; in ieee80211_ap_probereq_get()
2642 else if (ifmgd->auth_data) in ieee80211_ap_probereq_get()
2643 cbss = ifmgd->auth_data->bss; in ieee80211_ap_probereq_get()
2644 else if (ifmgd->assoc_data) in ieee80211_ap_probereq_get()
2645 cbss = ifmgd->assoc_data->bss; in ieee80211_ap_probereq_get()
2652 "invalid SSID element (len=%d)", ssid ? ssid[1] : -1)) in ieee80211_ap_probereq_get()
2657 skb = ieee80211_build_probe_req(sdata, sdata->vif.addr, cbss->bssid, in ieee80211_ap_probereq_get()
2658 (u32) -1, cbss->channel, in ieee80211_ap_probereq_get()
2678 cfg80211_tx_mlme_mgmt(sdata->dev, buf, len, reconnect); in ieee80211_report_disconnect()
2680 cfg80211_rx_mlme_mgmt(sdata->dev, buf, len); in ieee80211_report_disconnect()
2682 drv_event_callback(sdata->local, sdata, &event); in ieee80211_report_disconnect()
2687 struct ieee80211_local *local = sdata->local; in __ieee80211_disconnect()
2688 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in __ieee80211_disconnect()
2693 if (!ifmgd->associated) { in __ieee80211_disconnect()
2698 tx = !sdata->csa_block_tx; in __ieee80211_disconnect()
2700 if (!ifmgd->driver_disconnect) { in __ieee80211_disconnect()
2705 cfg80211_unlink_bss(local->hw.wiphy, ifmgd->associated); in __ieee80211_disconnect()
2709 ifmgd->driver_disconnect ? in __ieee80211_disconnect()
2713 mutex_lock(&local->mtx); in __ieee80211_disconnect()
2714 sdata->vif.csa_active = false; in __ieee80211_disconnect()
2715 ifmgd->csa_waiting_bcn = false; in __ieee80211_disconnect()
2716 if (sdata->csa_block_tx) { in __ieee80211_disconnect()
2719 sdata->csa_block_tx = false; in __ieee80211_disconnect()
2721 mutex_unlock(&local->mtx); in __ieee80211_disconnect()
2725 ifmgd->reconnect); in __ieee80211_disconnect()
2726 ifmgd->reconnect = false; in __ieee80211_disconnect()
2736 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_beacon_connection_loss_work()
2738 if (ifmgd->associated) in ieee80211_beacon_connection_loss_work()
2739 ifmgd->beacon_loss_count++; in ieee80211_beacon_connection_loss_work()
2741 if (ifmgd->connection_loss) { in ieee80211_beacon_connection_loss_work()
2743 ifmgd->bssid); in ieee80211_beacon_connection_loss_work()
2745 ifmgd->connection_loss = false; in ieee80211_beacon_connection_loss_work()
2746 } else if (ifmgd->driver_disconnect) { in ieee80211_beacon_connection_loss_work()
2749 ifmgd->bssid); in ieee80211_beacon_connection_loss_work()
2751 ifmgd->driver_disconnect = false; in ieee80211_beacon_connection_loss_work()
2769 struct ieee80211_hw *hw = &sdata->local->hw; in ieee80211_beacon_loss()
2773 sdata->u.mgd.connection_loss = false; in ieee80211_beacon_loss()
2774 ieee80211_queue_work(hw, &sdata->u.mgd.beacon_connection_loss_work); in ieee80211_beacon_loss()
2781 struct ieee80211_hw *hw = &sdata->local->hw; in ieee80211_connection_loss()
2785 sdata->u.mgd.connection_loss = true; in ieee80211_connection_loss()
2786 ieee80211_queue_work(hw, &sdata->u.mgd.beacon_connection_loss_work); in ieee80211_connection_loss()
2793 struct ieee80211_hw *hw = &sdata->local->hw; in ieee80211_disconnect()
2797 if (WARN_ON(sdata->vif.type != NL80211_IFTYPE_STATION)) in ieee80211_disconnect()
2800 sdata->u.mgd.driver_disconnect = true; in ieee80211_disconnect()
2801 sdata->u.mgd.reconnect = reconnect; in ieee80211_disconnect()
2802 ieee80211_queue_work(hw, &sdata->u.mgd.beacon_connection_loss_work); in ieee80211_disconnect()
2809 struct ieee80211_mgd_auth_data *auth_data = sdata->u.mgd.auth_data; in ieee80211_destroy_auth_data()
2819 del_timer_sync(&sdata->u.mgd.timer); in ieee80211_destroy_auth_data()
2820 sta_info_destroy_addr(sdata, auth_data->bss->bssid); in ieee80211_destroy_auth_data()
2822 eth_zero_addr(sdata->u.mgd.bssid); in ieee80211_destroy_auth_data()
2824 sdata->u.mgd.flags = 0; in ieee80211_destroy_auth_data()
2825 mutex_lock(&sdata->local->mtx); in ieee80211_destroy_auth_data()
2827 mutex_unlock(&sdata->local->mtx); in ieee80211_destroy_auth_data()
2830 cfg80211_put_bss(sdata->local->hw.wiphy, auth_data->bss); in ieee80211_destroy_auth_data()
2832 sdata->u.mgd.auth_data = NULL; in ieee80211_destroy_auth_data()
2838 struct ieee80211_mgd_assoc_data *assoc_data = sdata->u.mgd.assoc_data; in ieee80211_destroy_assoc_data()
2848 del_timer_sync(&sdata->u.mgd.timer); in ieee80211_destroy_assoc_data()
2849 sta_info_destroy_addr(sdata, assoc_data->bss->bssid); in ieee80211_destroy_assoc_data()
2851 eth_zero_addr(sdata->u.mgd.bssid); in ieee80211_destroy_assoc_data()
2853 sdata->u.mgd.flags = 0; in ieee80211_destroy_assoc_data()
2854 sdata->vif.mu_mimo_owner = false; in ieee80211_destroy_assoc_data()
2856 mutex_lock(&sdata->local->mtx); in ieee80211_destroy_assoc_data()
2858 mutex_unlock(&sdata->local->mtx); in ieee80211_destroy_assoc_data()
2861 cfg80211_abandon_assoc(sdata->dev, assoc_data->bss); in ieee80211_destroy_assoc_data()
2865 sdata->u.mgd.assoc_data = NULL; in ieee80211_destroy_assoc_data()
2871 struct ieee80211_local *local = sdata->local; in ieee80211_auth_challenge()
2872 struct ieee80211_mgd_auth_data *auth_data = sdata->u.mgd.auth_data; in ieee80211_auth_challenge()
2880 pos = mgmt->u.auth.variable; in ieee80211_auth_challenge()
2881 ieee802_11_parse_elems(pos, len - (pos - (u8 *)mgmt), false, &elems, in ieee80211_auth_challenge()
2882 mgmt->bssid, auth_data->bss->bssid); in ieee80211_auth_challenge()
2885 auth_data->expected_transaction = 4; in ieee80211_auth_challenge()
2886 drv_mgd_prepare_tx(sdata->local, sdata, &info); in ieee80211_auth_challenge()
2887 if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) in ieee80211_auth_challenge()
2890 ieee80211_send_auth(sdata, 3, auth_data->algorithm, 0, in ieee80211_auth_challenge()
2891 elems.challenge - 2, elems.challenge_len + 2, in ieee80211_auth_challenge()
2892 auth_data->bss->bssid, auth_data->bss->bssid, in ieee80211_auth_challenge()
2893 auth_data->key, auth_data->key_len, in ieee80211_auth_challenge()
2894 auth_data->key_idx, tx_flags); in ieee80211_auth_challenge()
2900 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_mark_sta_auth()
2905 ifmgd->auth_data->done = true; in ieee80211_mark_sta_auth()
2906 ifmgd->auth_data->timeout = jiffies + IEEE80211_AUTH_WAIT_ASSOC; in ieee80211_mark_sta_auth()
2907 ifmgd->auth_data->timeout_started = true; in ieee80211_mark_sta_auth()
2908 run_again(sdata, ifmgd->auth_data->timeout); in ieee80211_mark_sta_auth()
2911 mutex_lock(&sdata->local->sta_mtx); in ieee80211_mark_sta_auth()
2914 WARN_ONCE(1, "%s: STA %pM not found", sdata->name, bssid); in ieee80211_mark_sta_auth()
2925 mutex_unlock(&sdata->local->sta_mtx); in ieee80211_mark_sta_auth()
2932 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_rx_mgmt_auth()
2948 if (!ifmgd->auth_data || ifmgd->auth_data->done) in ieee80211_rx_mgmt_auth()
2951 memcpy(bssid, ifmgd->auth_data->bss->bssid, ETH_ALEN); in ieee80211_rx_mgmt_auth()
2953 if (!ether_addr_equal(bssid, mgmt->bssid)) in ieee80211_rx_mgmt_auth()
2956 auth_alg = le16_to_cpu(mgmt->u.auth.auth_alg); in ieee80211_rx_mgmt_auth()
2957 auth_transaction = le16_to_cpu(mgmt->u.auth.auth_transaction); in ieee80211_rx_mgmt_auth()
2958 status_code = le16_to_cpu(mgmt->u.auth.status_code); in ieee80211_rx_mgmt_auth()
2960 if (auth_alg != ifmgd->auth_data->algorithm || in ieee80211_rx_mgmt_auth()
2962 auth_transaction != ifmgd->auth_data->expected_transaction) || in ieee80211_rx_mgmt_auth()
2964 (auth_transaction < ifmgd->auth_data->expected_transaction || in ieee80211_rx_mgmt_auth()
2967 mgmt->sa, auth_alg, ifmgd->auth_data->algorithm, in ieee80211_rx_mgmt_auth()
2969 ifmgd->auth_data->expected_transaction); in ieee80211_rx_mgmt_auth()
2974 cfg80211_rx_mlme_mgmt(sdata->dev, (u8 *)mgmt, len); in ieee80211_rx_mgmt_auth()
2984 mgmt->sa, status_code); in ieee80211_rx_mgmt_auth()
2988 drv_event_callback(sdata->local, sdata, &event); in ieee80211_rx_mgmt_auth()
2992 switch (ifmgd->auth_data->algorithm) { in ieee80211_rx_mgmt_auth()
3002 if (ifmgd->auth_data->expected_transaction != 4) { in ieee80211_rx_mgmt_auth()
3010 ifmgd->auth_data->algorithm); in ieee80211_rx_mgmt_auth()
3016 drv_event_callback(sdata->local, sdata, &event); in ieee80211_rx_mgmt_auth()
3017 if (ifmgd->auth_data->algorithm != WLAN_AUTH_SAE || in ieee80211_rx_mgmt_auth()
3019 ifmgd->auth_data->expected_transaction == 2)) { in ieee80211_rx_mgmt_auth()
3021 return; /* ignore frame -- wait for timeout */ in ieee80211_rx_mgmt_auth()
3022 } else if (ifmgd->auth_data->algorithm == WLAN_AUTH_SAE && in ieee80211_rx_mgmt_auth()
3025 ifmgd->auth_data->peer_confirmed = true; in ieee80211_rx_mgmt_auth()
3028 cfg80211_rx_mlme_mgmt(sdata->dev, (u8 *)mgmt, len); in ieee80211_rx_mgmt_auth()
3030 drv_mgd_complete_tx(sdata->local, sdata, &info); in ieee80211_rx_mgmt_auth()
3093 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_rx_mgmt_deauth()
3094 u16 reason_code = le16_to_cpu(mgmt->u.deauth.reason_code); in ieee80211_rx_mgmt_deauth()
3101 if (!ether_addr_equal(mgmt->bssid, mgmt->sa)) { in ieee80211_rx_mgmt_deauth()
3102 ieee80211_tdls_handle_disconnect(sdata, mgmt->sa, reason_code); in ieee80211_rx_mgmt_deauth()
3106 if (ifmgd->associated && in ieee80211_rx_mgmt_deauth()
3107 ether_addr_equal(mgmt->bssid, ifmgd->associated->bssid)) { in ieee80211_rx_mgmt_deauth()
3108 const u8 *bssid = ifmgd->associated->bssid; in ieee80211_rx_mgmt_deauth()
3121 if (ifmgd->assoc_data && in ieee80211_rx_mgmt_deauth()
3122 ether_addr_equal(mgmt->bssid, ifmgd->assoc_data->bss->bssid)) { in ieee80211_rx_mgmt_deauth()
3123 const u8 *bssid = ifmgd->assoc_data->bss->bssid; in ieee80211_rx_mgmt_deauth()
3132 cfg80211_rx_mlme_mgmt(sdata->dev, (u8 *)mgmt, len); in ieee80211_rx_mgmt_deauth()
3141 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_rx_mgmt_disassoc()
3149 if (!ifmgd->associated || in ieee80211_rx_mgmt_disassoc()
3150 !ether_addr_equal(mgmt->bssid, ifmgd->associated->bssid)) in ieee80211_rx_mgmt_disassoc()
3153 reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code); in ieee80211_rx_mgmt_disassoc()
3155 if (!ether_addr_equal(mgmt->bssid, mgmt->sa)) { in ieee80211_rx_mgmt_disassoc()
3156 ieee80211_tdls_handle_disconnect(sdata, mgmt->sa, reason_code); in ieee80211_rx_mgmt_disassoc()
3161 mgmt->sa, reason_code, in ieee80211_rx_mgmt_disassoc()
3200 for (j = 0; j < sband->n_bitrates; j++) { in ieee80211_get_rates()
3204 br = &sband->bitrates[j]; in ieee80211_get_rates()
3206 brate = DIV_ROUND_UP(br->bitrate, (1 << shift) * 5); in ieee80211_get_rates()
3224 if (elems->ext_capab_len < 10) in ieee80211_twt_req_supported()
3227 if (!(elems->ext_capab[9] & WLAN_EXT_CAPA10_TWT_RESPONDER_SUPPORT)) in ieee80211_twt_req_supported()
3230 return sta->sta.he_cap.he_cap_elem.mac_cap_info[0] & in ieee80211_twt_req_supported()
3240 if (sdata->vif.bss_conf.twt_requester != twt) { in ieee80211_recalc_twt_req()
3241 sdata->vif.bss_conf.twt_requester = twt; in ieee80211_recalc_twt_req()
3254 ieee80211_vif_type_p2p(&sdata->vif)); in ieee80211_twt_bcast_support()
3256 return bss_conf->he_support && in ieee80211_twt_bcast_support()
3257 (sta->sta.he_cap.he_cap_elem.mac_cap_info[2] & in ieee80211_twt_bcast_support()
3260 (own_he_cap->he_cap_elem.mac_cap_info[2] & in ieee80211_twt_bcast_support()
3269 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_assoc_success()
3270 struct ieee80211_local *local = sdata->local; in ieee80211_assoc_success()
3274 struct ieee80211_bss_conf *bss_conf = &sdata->vif.bss_conf; in ieee80211_assoc_success()
3276 struct ieee80211_mgd_assoc_data *assoc_data = ifmgd->assoc_data; in ieee80211_assoc_success()
3277 bool is_6ghz = cbss->channel->band == NL80211_BAND_6GHZ; in ieee80211_assoc_success()
3278 bool is_s1g = cbss->channel->band == NL80211_BAND_S1GHZ; in ieee80211_assoc_success()
3286 pos = mgmt->u.assoc_resp.variable; in ieee80211_assoc_success()
3287 aid = le16_to_cpu(mgmt->u.assoc_resp.aid); in ieee80211_assoc_success()
3289 pos = (u8 *) mgmt->u.s1g_assoc_resp.variable; in ieee80211_assoc_success()
3292 capab_info = le16_to_cpu(mgmt->u.assoc_resp.capab_info); in ieee80211_assoc_success()
3293 ieee802_11_parse_elems(pos, len - (pos - (u8 *)mgmt), false, elems, in ieee80211_assoc_success()
3294 mgmt->bssid, assoc_data->bss->bssid); in ieee80211_assoc_success()
3296 if (elems->aid_resp) in ieee80211_assoc_success()
3297 aid = le16_to_cpu(elems->aid_resp->aid); in ieee80211_assoc_success()
3301 * (802.11-2016 9.4.1.8 AID field) in ieee80211_assoc_success()
3305 ifmgd->broken_ap = false; in ieee80211_assoc_success()
3311 ifmgd->broken_ap = true; in ieee80211_assoc_success()
3314 if (!is_s1g && !elems->supp_rates) { in ieee80211_assoc_success()
3319 sdata->vif.bss_conf.aid = aid; in ieee80211_assoc_success()
3320 ifmgd->tdls_chan_switch_prohibited = in ieee80211_assoc_success()
3321 elems->ext_capab && elems->ext_capab_len >= 5 && in ieee80211_assoc_success()
3322 (elems->ext_capab[4] & WLAN_EXT_CAPA5_TDLS_CH_SW_PROHIBITED); in ieee80211_assoc_success()
3329 * "Vodafone PocketWiFi 2", "ZTE MF60" and a similar T-Mobile device. in ieee80211_assoc_success()
3332 ((assoc_data->wmm && !elems->wmm_param) || in ieee80211_assoc_success()
3333 (!(ifmgd->flags & IEEE80211_STA_DISABLE_HT) && in ieee80211_assoc_success()
3334 (!elems->ht_cap_elem || !elems->ht_operation)) || in ieee80211_assoc_success()
3335 (!(ifmgd->flags & IEEE80211_STA_DISABLE_VHT) && in ieee80211_assoc_success()
3336 (!elems->vht_cap_elem || !elems->vht_operation)))) { in ieee80211_assoc_success()
3341 ies = rcu_dereference(cbss->ies); in ieee80211_assoc_success()
3343 bss_ies = kmemdup(ies, sizeof(*ies) + ies->len, in ieee80211_assoc_success()
3349 ieee802_11_parse_elems(bss_ies->data, bss_ies->len, in ieee80211_assoc_success()
3351 mgmt->bssid, in ieee80211_assoc_success()
3352 assoc_data->bss->bssid); in ieee80211_assoc_success()
3353 if (assoc_data->wmm && in ieee80211_assoc_success()
3354 !elems->wmm_param && bss_elems.wmm_param) { in ieee80211_assoc_success()
3355 elems->wmm_param = bss_elems.wmm_param; in ieee80211_assoc_success()
3364 if (!elems->ht_cap_elem && bss_elems.ht_cap_elem && in ieee80211_assoc_success()
3365 !(ifmgd->flags & IEEE80211_STA_DISABLE_HT)) { in ieee80211_assoc_success()
3366 elems->ht_cap_elem = bss_elems.ht_cap_elem; in ieee80211_assoc_success()
3370 if (!elems->ht_operation && bss_elems.ht_operation && in ieee80211_assoc_success()
3371 !(ifmgd->flags & IEEE80211_STA_DISABLE_HT)) { in ieee80211_assoc_success()
3372 elems->ht_operation = bss_elems.ht_operation; in ieee80211_assoc_success()
3376 if (!elems->vht_cap_elem && bss_elems.vht_cap_elem && in ieee80211_assoc_success()
3377 !(ifmgd->flags & IEEE80211_STA_DISABLE_VHT)) { in ieee80211_assoc_success()
3378 elems->vht_cap_elem = bss_elems.vht_cap_elem; in ieee80211_assoc_success()
3382 if (!elems->vht_operation && bss_elems.vht_operation && in ieee80211_assoc_success()
3383 !(ifmgd->flags & IEEE80211_STA_DISABLE_VHT)) { in ieee80211_assoc_success()
3384 elems->vht_operation = bss_elems.vht_operation; in ieee80211_assoc_success()
3394 if (!is_6ghz && !(ifmgd->flags & IEEE80211_STA_DISABLE_HT) && in ieee80211_assoc_success()
3395 (!elems->wmm_param || !elems->ht_cap_elem || !elems->ht_operation)) { in ieee80211_assoc_success()
3402 if (!is_6ghz && !(ifmgd->flags & IEEE80211_STA_DISABLE_VHT) && in ieee80211_assoc_success()
3403 (!elems->vht_cap_elem || !elems->vht_operation)) { in ieee80211_assoc_success()
3410 if (is_6ghz && !(ifmgd->flags & IEEE80211_STA_DISABLE_HE) && in ieee80211_assoc_success()
3411 !elems->he_6ghz_capa) { in ieee80211_assoc_success()
3418 mutex_lock(&sdata->local->sta_mtx); in ieee80211_assoc_success()
3423 sta = sta_info_get(sdata, cbss->bssid); in ieee80211_assoc_success()
3425 mutex_unlock(&sdata->local->sta_mtx); in ieee80211_assoc_success()
3432 mutex_unlock(&sdata->local->sta_mtx); in ieee80211_assoc_success()
3437 if (!(ifmgd->flags & IEEE80211_STA_DISABLE_HE) && in ieee80211_assoc_success()
3438 (!elems->he_cap || !elems->he_operation)) { in ieee80211_assoc_success()
3439 mutex_unlock(&sdata->local->sta_mtx); in ieee80211_assoc_success()
3447 if (elems->ht_cap_elem && !(ifmgd->flags & IEEE80211_STA_DISABLE_HT)) in ieee80211_assoc_success()
3449 elems->ht_cap_elem, sta); in ieee80211_assoc_success()
3451 if (elems->vht_cap_elem && !(ifmgd->flags & IEEE80211_STA_DISABLE_VHT)) in ieee80211_assoc_success()
3453 elems->vht_cap_elem, sta); in ieee80211_assoc_success()
3455 if (elems->he_operation && !(ifmgd->flags & IEEE80211_STA_DISABLE_HE) && in ieee80211_assoc_success()
3456 elems->he_cap) { in ieee80211_assoc_success()
3458 elems->he_cap, in ieee80211_assoc_success()
3459 elems->he_cap_len, in ieee80211_assoc_success()
3460 elems->he_6ghz_capa, in ieee80211_assoc_success()
3463 bss_conf->he_support = sta->sta.he_cap.has_he; in ieee80211_assoc_success()
3464 if (elems->rsnx && elems->rsnx_len && in ieee80211_assoc_success()
3465 (elems->rsnx[0] & WLAN_RSNX_CAPA_PROTECTED_TWT) && in ieee80211_assoc_success()
3466 wiphy_ext_feature_isset(local->hw.wiphy, in ieee80211_assoc_success()
3468 bss_conf->twt_protected = true; in ieee80211_assoc_success()
3470 bss_conf->twt_protected = false; in ieee80211_assoc_success()
3474 bss_conf->he_support = false; in ieee80211_assoc_success()
3475 bss_conf->twt_requester = false; in ieee80211_assoc_success()
3476 bss_conf->twt_protected = false; in ieee80211_assoc_success()
3479 bss_conf->twt_broadcast = in ieee80211_assoc_success()
3482 if (bss_conf->he_support) { in ieee80211_assoc_success()
3483 bss_conf->he_bss_color.color = in ieee80211_assoc_success()
3484 le32_get_bits(elems->he_operation->he_oper_params, in ieee80211_assoc_success()
3486 bss_conf->he_bss_color.partial = in ieee80211_assoc_success()
3487 le32_get_bits(elems->he_operation->he_oper_params, in ieee80211_assoc_success()
3489 bss_conf->he_bss_color.enabled = in ieee80211_assoc_success()
3490 !le32_get_bits(elems->he_operation->he_oper_params, in ieee80211_assoc_success()
3493 if (bss_conf->he_bss_color.enabled) in ieee80211_assoc_success()
3496 bss_conf->htc_trig_based_pkt_ext = in ieee80211_assoc_success()
3497 le32_get_bits(elems->he_operation->he_oper_params, in ieee80211_assoc_success()
3499 bss_conf->frame_time_rts_th = in ieee80211_assoc_success()
3500 le32_get_bits(elems->he_operation->he_oper_params, in ieee80211_assoc_success()
3503 bss_conf->uora_exists = !!elems->uora_element; in ieee80211_assoc_success()
3504 if (elems->uora_element) in ieee80211_assoc_success()
3505 bss_conf->uora_ocw_range = elems->uora_element[0]; in ieee80211_assoc_success()
3507 ieee80211_he_op_ie_to_bss_conf(&sdata->vif, elems->he_operation); in ieee80211_assoc_success()
3508 ieee80211_he_spr_ie_to_bss_conf(&sdata->vif, elems->he_spr); in ieee80211_assoc_success()
3512 if (cbss->transmitted_bss) { in ieee80211_assoc_success()
3513 bss_conf->nontransmitted = true; in ieee80211_assoc_success()
3514 ether_addr_copy(bss_conf->transmitter_bssid, in ieee80211_assoc_success()
3515 cbss->transmitted_bss->bssid); in ieee80211_assoc_success()
3516 bss_conf->bssid_indicator = cbss->max_bssid_indicator; in ieee80211_assoc_success()
3517 bss_conf->bssid_index = cbss->bssid_index; in ieee80211_assoc_success()
3532 if (elems->opmode_notif && in ieee80211_assoc_success()
3533 !(*elems->opmode_notif & IEEE80211_OPMODE_NOTIF_RX_NSS_TYPE_BF)) { in ieee80211_assoc_success()
3536 nss = *elems->opmode_notif & IEEE80211_OPMODE_NOTIF_RX_NSS_MASK; in ieee80211_assoc_success()
3539 sta->sta.rx_nss = nss; in ieee80211_assoc_success()
3544 if (ifmgd->flags & IEEE80211_STA_MFP_ENABLED) { in ieee80211_assoc_success()
3546 sta->sta.mfp = true; in ieee80211_assoc_success()
3548 sta->sta.mfp = false; in ieee80211_assoc_success()
3551 sta->sta.wme = (elems->wmm_param || elems->s1g_capab) && in ieee80211_assoc_success()
3552 local->hw.queues >= IEEE80211_NUM_ACS; in ieee80211_assoc_success()
3555 if (!err && !(ifmgd->flags & IEEE80211_STA_CONTROL_PORT)) in ieee80211_assoc_success()
3560 sta->sta.addr); in ieee80211_assoc_success()
3562 mutex_unlock(&sdata->local->sta_mtx); in ieee80211_assoc_success()
3567 if (sdata->wdev.use_4addr) in ieee80211_assoc_success()
3568 drv_sta_set_4addr(local, sdata, &sta->sta, true); in ieee80211_assoc_success()
3570 mutex_unlock(&sdata->local->sta_mtx); in ieee80211_assoc_success()
3574 * of the first value the AP uses. Setting -1 here has in ieee80211_assoc_success()
3576 * 4-bit value. in ieee80211_assoc_success()
3578 ifmgd->wmm_last_param_set = -1; in ieee80211_assoc_success()
3579 ifmgd->mu_edca_last_param_set = -1; in ieee80211_assoc_success()
3581 if (ifmgd->flags & IEEE80211_STA_DISABLE_WMM) { in ieee80211_assoc_success()
3583 } else if (!ieee80211_sta_wmm_params(local, sdata, elems->wmm_param, in ieee80211_assoc_success()
3584 elems->wmm_param_len, in ieee80211_assoc_success()
3585 elems->mu_edca_param_set)) { in ieee80211_assoc_success()
3588 /* set the disable-WMM flag in this case to disable in ieee80211_assoc_success()
3595 ifmgd->flags |= IEEE80211_STA_DISABLE_WMM; in ieee80211_assoc_success()
3599 if (elems->max_idle_period_ie) { in ieee80211_assoc_success()
3600 bss_conf->max_idle_period = in ieee80211_assoc_success()
3601 le16_to_cpu(elems->max_idle_period_ie->max_idle_period); in ieee80211_assoc_success()
3602 bss_conf->protected_keep_alive = in ieee80211_assoc_success()
3603 !!(elems->max_idle_period_ie->idle_options & in ieee80211_assoc_success()
3607 bss_conf->max_idle_period = 0; in ieee80211_assoc_success()
3608 bss_conf->protected_keep_alive = false; in ieee80211_assoc_success()
3613 bss_conf->assoc_capability = capab_info; in ieee80211_assoc_success()
3617 * If we're using 4-addr mode, let the AP know that we're in ieee80211_assoc_success()
3618 * doing so, so that it can create the STA VLAN on its side in ieee80211_assoc_success()
3620 if (ifmgd->use_4addr) in ieee80211_assoc_success()
3640 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_rx_mgmt_assoc_resp()
3641 struct ieee80211_mgd_assoc_data *assoc_data = ifmgd->assoc_data; in ieee80211_rx_mgmt_assoc_resp()
3644 int ac, uapsd_queues = -1; in ieee80211_rx_mgmt_assoc_resp()
3659 if (!ether_addr_equal(assoc_data->bss->bssid, mgmt->bssid)) in ieee80211_rx_mgmt_assoc_resp()
3662 cbss = assoc_data->bss; in ieee80211_rx_mgmt_assoc_resp()
3672 reassoc = ieee80211_is_reassoc_resp(mgmt->frame_control); in ieee80211_rx_mgmt_assoc_resp()
3673 capab_info = le16_to_cpu(mgmt->u.assoc_resp.capab_info); in ieee80211_rx_mgmt_assoc_resp()
3674 status_code = le16_to_cpu(mgmt->u.assoc_resp.status_code); in ieee80211_rx_mgmt_assoc_resp()
3675 pos = mgmt->u.assoc_resp.variable; in ieee80211_rx_mgmt_assoc_resp()
3676 aid = le16_to_cpu(mgmt->u.assoc_resp.aid); in ieee80211_rx_mgmt_assoc_resp()
3677 if (cbss->channel->band == NL80211_BAND_S1GHZ) { in ieee80211_rx_mgmt_assoc_resp()
3678 pos = (u8 *) mgmt->u.s1g_assoc_resp.variable; in ieee80211_rx_mgmt_assoc_resp()
3683 * Note: this may not be perfect, AP might misbehave - if in ieee80211_rx_mgmt_assoc_resp()
3693 reassoc ? "Rea" : "A", mgmt->sa, in ieee80211_rx_mgmt_assoc_resp()
3696 if (assoc_data->fils_kek_len && in ieee80211_rx_mgmt_assoc_resp()
3700 ieee802_11_parse_elems(pos, len - (pos - (u8 *)mgmt), false, &elems, in ieee80211_rx_mgmt_assoc_resp()
3701 mgmt->bssid, assoc_data->bss->bssid); in ieee80211_rx_mgmt_assoc_resp()
3705 elems.timeout_int->type == WLAN_TIMEOUT_ASSOC_COMEBACK) { in ieee80211_rx_mgmt_assoc_resp()
3707 tu = le32_to_cpu(elems.timeout_int->value); in ieee80211_rx_mgmt_assoc_resp()
3711 mgmt->sa, tu, ms); in ieee80211_rx_mgmt_assoc_resp()
3712 assoc_data->timeout = jiffies + msecs_to_jiffies(ms); in ieee80211_rx_mgmt_assoc_resp()
3713 assoc_data->timeout_started = true; in ieee80211_rx_mgmt_assoc_resp()
3715 run_again(sdata, assoc_data->timeout); in ieee80211_rx_mgmt_assoc_resp()
3721 mgmt->sa, status_code); in ieee80211_rx_mgmt_assoc_resp()
3725 drv_event_callback(sdata->local, sdata, &event); in ieee80211_rx_mgmt_assoc_resp()
3728 /* oops -- internal error -- send timeout for now */ in ieee80211_rx_mgmt_assoc_resp()
3730 cfg80211_assoc_timeout(sdata->dev, cbss); in ieee80211_rx_mgmt_assoc_resp()
3734 drv_event_callback(sdata->local, sdata, &event); in ieee80211_rx_mgmt_assoc_resp()
3747 if (sdata->tx_conf[ac].uapsd) in ieee80211_rx_mgmt_assoc_resp()
3753 cfg80211_rx_assoc_resp(sdata->dev, cbss, (u8 *)mgmt, len, uapsd_queues, in ieee80211_rx_mgmt_assoc_resp()
3754 ifmgd->assoc_req_ies, ifmgd->assoc_req_ies_len); in ieee80211_rx_mgmt_assoc_resp()
3756 drv_mgd_complete_tx(sdata->local, sdata, &info); in ieee80211_rx_mgmt_assoc_resp()
3763 struct ieee80211_local *local = sdata->local; in ieee80211_rx_bss_info()
3769 channel = ieee80211_get_channel_khz(local->hw.wiphy, in ieee80211_rx_bss_info()
3776 sdata->vif.bss_conf.beacon_rate = bss->beacon_rate; in ieee80211_rx_bss_info()
3785 struct ieee80211_mgmt *mgmt = (void *)skb->data; in ieee80211_rx_mgmt_probe_resp()
3787 struct ieee80211_rx_status *rx_status = (void *) skb->cb; in ieee80211_rx_mgmt_probe_resp()
3789 size_t baselen, len = skb->len; in ieee80211_rx_mgmt_probe_resp()
3791 ifmgd = &sdata->u.mgd; in ieee80211_rx_mgmt_probe_resp()
3802 channel = ieee80211_get_channel(sdata->local->hw.wiphy, in ieee80211_rx_mgmt_probe_resp()
3803 rx_status->freq); in ieee80211_rx_mgmt_probe_resp()
3807 if (!ether_addr_equal(mgmt->da, sdata->vif.addr) && in ieee80211_rx_mgmt_probe_resp()
3808 (channel->band != NL80211_BAND_6GHZ || in ieee80211_rx_mgmt_probe_resp()
3809 !is_broadcast_ether_addr(mgmt->da))) in ieee80211_rx_mgmt_probe_resp()
3812 baselen = (u8 *) mgmt->u.probe_resp.variable - (u8 *) mgmt; in ieee80211_rx_mgmt_probe_resp()
3818 if (ifmgd->associated && in ieee80211_rx_mgmt_probe_resp()
3819 ether_addr_equal(mgmt->bssid, ifmgd->associated->bssid)) in ieee80211_rx_mgmt_probe_resp()
3834 * XXX: This list needs to be dynamic -- userspace needs to be able to
3855 if (ifmgd->flags & IEEE80211_STA_RESET_SIGNAL_AVE) { in ieee80211_handle_beacon_sig()
3856 ifmgd->flags &= ~IEEE80211_STA_RESET_SIGNAL_AVE; in ieee80211_handle_beacon_sig()
3857 ewma_beacon_signal_init(&ifmgd->ave_beacon_signal); in ieee80211_handle_beacon_sig()
3858 ifmgd->last_cqm_event_signal = 0; in ieee80211_handle_beacon_sig()
3859 ifmgd->count_beacon_signal = 1; in ieee80211_handle_beacon_sig()
3860 ifmgd->last_ave_beacon_signal = 0; in ieee80211_handle_beacon_sig()
3862 ifmgd->count_beacon_signal++; in ieee80211_handle_beacon_sig()
3865 ewma_beacon_signal_add(&ifmgd->ave_beacon_signal, -rx_status->signal); in ieee80211_handle_beacon_sig()
3867 if (ifmgd->rssi_min_thold != ifmgd->rssi_max_thold && in ieee80211_handle_beacon_sig()
3868 ifmgd->count_beacon_signal >= IEEE80211_SIGNAL_AVE_MIN_COUNT) { in ieee80211_handle_beacon_sig()
3869 int sig = -ewma_beacon_signal_read(&ifmgd->ave_beacon_signal); in ieee80211_handle_beacon_sig()
3870 int last_sig = ifmgd->last_ave_beacon_signal; in ieee80211_handle_beacon_sig()
3879 if (sig > ifmgd->rssi_max_thold && in ieee80211_handle_beacon_sig()
3880 (last_sig <= ifmgd->rssi_min_thold || last_sig == 0)) { in ieee80211_handle_beacon_sig()
3881 ifmgd->last_ave_beacon_signal = sig; in ieee80211_handle_beacon_sig()
3884 } else if (sig < ifmgd->rssi_min_thold && in ieee80211_handle_beacon_sig()
3885 (last_sig >= ifmgd->rssi_max_thold || in ieee80211_handle_beacon_sig()
3887 ifmgd->last_ave_beacon_signal = sig; in ieee80211_handle_beacon_sig()
3893 if (bss_conf->cqm_rssi_thold && in ieee80211_handle_beacon_sig()
3894 ifmgd->count_beacon_signal >= IEEE80211_SIGNAL_AVE_MIN_COUNT && in ieee80211_handle_beacon_sig()
3895 !(sdata->vif.driver_flags & IEEE80211_VIF_SUPPORTS_CQM_RSSI)) { in ieee80211_handle_beacon_sig()
3896 int sig = -ewma_beacon_signal_read(&ifmgd->ave_beacon_signal); in ieee80211_handle_beacon_sig()
3897 int last_event = ifmgd->last_cqm_event_signal; in ieee80211_handle_beacon_sig()
3898 int thold = bss_conf->cqm_rssi_thold; in ieee80211_handle_beacon_sig()
3899 int hyst = bss_conf->cqm_rssi_hyst; in ieee80211_handle_beacon_sig()
3902 (last_event == 0 || sig < last_event - hyst)) { in ieee80211_handle_beacon_sig()
3903 ifmgd->last_cqm_event_signal = sig; in ieee80211_handle_beacon_sig()
3905 &sdata->vif, in ieee80211_handle_beacon_sig()
3910 ifmgd->last_cqm_event_signal = sig; in ieee80211_handle_beacon_sig()
3912 &sdata->vif, in ieee80211_handle_beacon_sig()
3918 if (bss_conf->cqm_rssi_low && in ieee80211_handle_beacon_sig()
3919 ifmgd->count_beacon_signal >= IEEE80211_SIGNAL_AVE_MIN_COUNT) { in ieee80211_handle_beacon_sig()
3920 int sig = -ewma_beacon_signal_read(&ifmgd->ave_beacon_signal); in ieee80211_handle_beacon_sig()
3921 int last_event = ifmgd->last_cqm_event_signal; in ieee80211_handle_beacon_sig()
3922 int low = bss_conf->cqm_rssi_low; in ieee80211_handle_beacon_sig()
3923 int high = bss_conf->cqm_rssi_high; in ieee80211_handle_beacon_sig()
3927 ifmgd->last_cqm_event_signal = sig; in ieee80211_handle_beacon_sig()
3929 &sdata->vif, in ieee80211_handle_beacon_sig()
3934 ifmgd->last_cqm_event_signal = sig; in ieee80211_handle_beacon_sig()
3936 &sdata->vif, in ieee80211_handle_beacon_sig()
3946 if (ether_addr_equal(tx_bssid, bss->bssid)) in ieee80211_rx_our_beacon()
3948 if (!bss->transmitted_bss) in ieee80211_rx_our_beacon()
3950 return ether_addr_equal(tx_bssid, bss->transmitted_bss->bssid); in ieee80211_rx_our_beacon()
3957 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_rx_mgmt_beacon()
3958 struct ieee80211_bss_conf *bss_conf = &sdata->vif.bss_conf; in ieee80211_rx_mgmt_beacon()
3962 struct ieee80211_local *local = sdata->local; in ieee80211_rx_mgmt_beacon()
3970 u8 *bssid, *variable = mgmt->u.beacon.variable; in ieee80211_rx_mgmt_beacon()
3976 bssid = ieee80211_get_bssid(hdr, len, sdata->vif.type); in ieee80211_rx_mgmt_beacon()
3977 if (ieee80211_is_s1g_beacon(mgmt->frame_control)) { in ieee80211_rx_mgmt_beacon()
3980 if (ieee80211_is_s1g_short_beacon(ext->frame_control)) in ieee80211_rx_mgmt_beacon()
3981 variable = ext->u.s1g_short_beacon.variable; in ieee80211_rx_mgmt_beacon()
3983 variable = ext->u.s1g_beacon.variable; in ieee80211_rx_mgmt_beacon()
3986 baselen = (u8 *) variable - (u8 *) mgmt; in ieee80211_rx_mgmt_beacon()
3991 chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); in ieee80211_rx_mgmt_beacon()
3998 ieee80211_channel_to_khz(chanctx_conf->def.chan)) { in ieee80211_rx_mgmt_beacon()
4002 chan = chanctx_conf->def.chan; in ieee80211_rx_mgmt_beacon()
4005 if (ifmgd->assoc_data && ifmgd->assoc_data->need_beacon && in ieee80211_rx_mgmt_beacon()
4006 ieee80211_rx_our_beacon(bssid, ifmgd->assoc_data->bss)) { in ieee80211_rx_mgmt_beacon()
4008 len - baselen, false, &elems, in ieee80211_rx_mgmt_beacon()
4010 ifmgd->assoc_data->bss->bssid); in ieee80211_rx_mgmt_beacon()
4015 ifmgd->dtim_period = elems.dtim_period; in ieee80211_rx_mgmt_beacon()
4016 ifmgd->have_beacon = true; in ieee80211_rx_mgmt_beacon()
4017 ifmgd->assoc_data->need_beacon = false; in ieee80211_rx_mgmt_beacon()
4018 if (ieee80211_hw_check(&local->hw, TIMING_BEACON_ONLY)) { in ieee80211_rx_mgmt_beacon()
4019 sdata->vif.bss_conf.sync_tsf = in ieee80211_rx_mgmt_beacon()
4020 le64_to_cpu(mgmt->u.beacon.timestamp); in ieee80211_rx_mgmt_beacon()
4021 sdata->vif.bss_conf.sync_device_ts = in ieee80211_rx_mgmt_beacon()
4022 rx_status->device_timestamp; in ieee80211_rx_mgmt_beacon()
4023 sdata->vif.bss_conf.sync_dtim_count = elems.dtim_count; in ieee80211_rx_mgmt_beacon()
4027 bss_conf->profile_periodicity = in ieee80211_rx_mgmt_beacon()
4028 elems.mbssid_config_ie->profile_periodicity; in ieee80211_rx_mgmt_beacon()
4030 bss_conf->profile_periodicity = 0; in ieee80211_rx_mgmt_beacon()
4034 bss_conf->ema_ap = true; in ieee80211_rx_mgmt_beacon()
4036 bss_conf->ema_ap = false; in ieee80211_rx_mgmt_beacon()
4039 ifmgd->assoc_data->timeout = jiffies; in ieee80211_rx_mgmt_beacon()
4040 ifmgd->assoc_data->timeout_started = true; in ieee80211_rx_mgmt_beacon()
4041 run_again(sdata, ifmgd->assoc_data->timeout); in ieee80211_rx_mgmt_beacon()
4045 if (!ifmgd->associated || in ieee80211_rx_mgmt_beacon()
4046 !ieee80211_rx_our_beacon(bssid, ifmgd->associated)) in ieee80211_rx_mgmt_beacon()
4048 bssid = ifmgd->associated->bssid; in ieee80211_rx_mgmt_beacon()
4050 if (!(rx_status->flag & RX_FLAG_NO_SIGNAL_VAL)) in ieee80211_rx_mgmt_beacon()
4054 if (ifmgd->flags & IEEE80211_STA_CONNECTION_POLL) { in ieee80211_rx_mgmt_beacon()
4071 if (!ieee80211_is_s1g_beacon(hdr->frame_control)) in ieee80211_rx_mgmt_beacon()
4072 ncrc = crc32_be(0, (void *)&mgmt->u.beacon.beacon_int, 4); in ieee80211_rx_mgmt_beacon()
4074 len - baselen, false, &elems, in ieee80211_rx_mgmt_beacon()
4076 mgmt->bssid, bssid); in ieee80211_rx_mgmt_beacon()
4078 if (ieee80211_hw_check(&local->hw, PS_NULLFUNC_STACK) && in ieee80211_rx_mgmt_beacon()
4079 ieee80211_check_tim(elems.tim, elems.tim_len, bss_conf->aid)) { in ieee80211_rx_mgmt_beacon()
4080 if (local->hw.conf.dynamic_ps_timeout > 0) { in ieee80211_rx_mgmt_beacon()
4081 if (local->hw.conf.flags & IEEE80211_CONF_PS) { in ieee80211_rx_mgmt_beacon()
4082 local->hw.conf.flags &= ~IEEE80211_CONF_PS; in ieee80211_rx_mgmt_beacon()
4087 } else if (!local->pspolling && sdata->u.mgd.powersave) { in ieee80211_rx_mgmt_beacon()
4088 local->pspolling = true; in ieee80211_rx_mgmt_beacon()
4092 * able to send ps-poll frame and receive a in ieee80211_rx_mgmt_beacon()
4102 if (sdata->vif.p2p || in ieee80211_rx_mgmt_beacon()
4103 sdata->vif.driver_flags & IEEE80211_VIF_GET_NOA_UPDATE) { in ieee80211_rx_mgmt_beacon()
4108 len - baselen, in ieee80211_rx_mgmt_beacon()
4112 if (sdata->u.mgd.p2p_noa_index != noa.index) { in ieee80211_rx_mgmt_beacon()
4114 sdata->u.mgd.p2p_noa_index = noa.index; in ieee80211_rx_mgmt_beacon()
4115 memcpy(&bss_conf->p2p_noa_attr, &noa, sizeof(noa)); in ieee80211_rx_mgmt_beacon()
4121 ifmgd->beacon_crc_valid = false; in ieee80211_rx_mgmt_beacon()
4123 } else if (sdata->u.mgd.p2p_noa_index != -1) { in ieee80211_rx_mgmt_beacon()
4125 sdata->u.mgd.p2p_noa_index = -1; in ieee80211_rx_mgmt_beacon()
4126 memset(&bss_conf->p2p_noa_attr, 0, sizeof(bss_conf->p2p_noa_attr)); in ieee80211_rx_mgmt_beacon()
4128 ifmgd->beacon_crc_valid = false; in ieee80211_rx_mgmt_beacon()
4132 if (ifmgd->csa_waiting_bcn) in ieee80211_rx_mgmt_beacon()
4143 if (ieee80211_hw_check(&local->hw, TIMING_BEACON_ONLY) && in ieee80211_rx_mgmt_beacon()
4144 !ieee80211_is_s1g_beacon(hdr->frame_control)) { in ieee80211_rx_mgmt_beacon()
4145 sdata->vif.bss_conf.sync_tsf = in ieee80211_rx_mgmt_beacon()
4146 le64_to_cpu(mgmt->u.beacon.timestamp); in ieee80211_rx_mgmt_beacon()
4147 sdata->vif.bss_conf.sync_device_ts = in ieee80211_rx_mgmt_beacon()
4148 rx_status->device_timestamp; in ieee80211_rx_mgmt_beacon()
4149 sdata->vif.bss_conf.sync_dtim_count = elems.dtim_count; in ieee80211_rx_mgmt_beacon()
4152 if ((ncrc == ifmgd->beacon_crc && ifmgd->beacon_crc_valid) || in ieee80211_rx_mgmt_beacon()
4153 ieee80211_is_s1g_short_beacon(mgmt->frame_control)) in ieee80211_rx_mgmt_beacon()
4155 ifmgd->beacon_crc = ncrc; in ieee80211_rx_mgmt_beacon()
4156 ifmgd->beacon_crc_valid = true; in ieee80211_rx_mgmt_beacon()
4160 ieee80211_sta_process_chanswitch(sdata, rx_status->mactime, in ieee80211_rx_mgmt_beacon()
4161 rx_status->device_timestamp, in ieee80211_rx_mgmt_beacon()
4164 if (!(ifmgd->flags & IEEE80211_STA_DISABLE_WMM) && in ieee80211_rx_mgmt_beacon()
4174 if (!ifmgd->have_beacon) { in ieee80211_rx_mgmt_beacon()
4176 bss_conf->dtim_period = elems.dtim_period ?: 1; in ieee80211_rx_mgmt_beacon()
4179 ifmgd->have_beacon = true; in ieee80211_rx_mgmt_beacon()
4181 mutex_lock(&local->iflist_mtx); in ieee80211_rx_mgmt_beacon()
4183 mutex_unlock(&local->iflist_mtx); in ieee80211_rx_mgmt_beacon()
4195 if (!ieee80211_is_s1g_beacon(hdr->frame_control)) in ieee80211_rx_mgmt_beacon()
4197 le16_to_cpu(mgmt->u.beacon.capab_info), in ieee80211_rx_mgmt_beacon()
4200 mutex_lock(&local->sta_mtx); in ieee80211_rx_mgmt_beacon()
4209 mutex_unlock(&local->sta_mtx); in ieee80211_rx_mgmt_beacon()
4225 rx_status->band); in ieee80211_rx_mgmt_beacon()
4226 mutex_unlock(&local->sta_mtx); in ieee80211_rx_mgmt_beacon()
4244 rx_status = (struct ieee80211_rx_status *) skb->cb; in ieee80211_sta_rx_queued_ext()
4245 hdr = (struct ieee80211_hdr *) skb->data; in ieee80211_sta_rx_queued_ext()
4246 fc = le16_to_cpu(hdr->frame_control); in ieee80211_sta_rx_queued_ext()
4251 ieee80211_rx_mgmt_beacon(sdata, hdr, skb->len, rx_status); in ieee80211_sta_rx_queued_ext()
4266 rx_status = (struct ieee80211_rx_status *) skb->cb; in ieee80211_sta_rx_queued_mgmt()
4267 mgmt = (struct ieee80211_mgmt *) skb->data; in ieee80211_sta_rx_queued_mgmt()
4268 fc = le16_to_cpu(mgmt->frame_control); in ieee80211_sta_rx_queued_mgmt()
4275 skb->len, rx_status); in ieee80211_sta_rx_queued_mgmt()
4281 ieee80211_rx_mgmt_auth(sdata, mgmt, skb->len); in ieee80211_sta_rx_queued_mgmt()
4284 ieee80211_rx_mgmt_deauth(sdata, mgmt, skb->len); in ieee80211_sta_rx_queued_mgmt()
4287 ieee80211_rx_mgmt_disassoc(sdata, mgmt, skb->len); in ieee80211_sta_rx_queued_mgmt()
4291 ieee80211_rx_mgmt_assoc_resp(sdata, mgmt, skb->len); in ieee80211_sta_rx_queued_mgmt()
4294 if (mgmt->u.action.category == WLAN_CATEGORY_SPECTRUM_MGMT) { in ieee80211_sta_rx_queued_mgmt()
4295 ies_len = skb->len - in ieee80211_sta_rx_queued_mgmt()
4304 mgmt->u.action.u.chan_switch.variable, in ieee80211_sta_rx_queued_mgmt()
4305 ies_len, true, &elems, mgmt->bssid, NULL); in ieee80211_sta_rx_queued_mgmt()
4311 rx_status->mactime, in ieee80211_sta_rx_queued_mgmt()
4312 rx_status->device_timestamp, in ieee80211_sta_rx_queued_mgmt()
4314 } else if (mgmt->u.action.category == WLAN_CATEGORY_PUBLIC) { in ieee80211_sta_rx_queued_mgmt()
4315 ies_len = skb->len - in ieee80211_sta_rx_queued_mgmt()
4327 mgmt->u.action.u.ext_chan_switch.variable, in ieee80211_sta_rx_queued_mgmt()
4328 ies_len, true, &elems, mgmt->bssid, NULL); in ieee80211_sta_rx_queued_mgmt()
4335 &mgmt->u.action.u.ext_chan_switch.data; in ieee80211_sta_rx_queued_mgmt()
4338 rx_status->mactime, in ieee80211_sta_rx_queued_mgmt()
4339 rx_status->device_timestamp, in ieee80211_sta_rx_queued_mgmt()
4352 ieee80211_queue_work(&sdata->local->hw, &sdata->work); in ieee80211_sta_timer()
4369 struct ieee80211_local *local = sdata->local; in ieee80211_auth()
4370 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_auth()
4371 struct ieee80211_mgd_auth_data *auth_data = ifmgd->auth_data; in ieee80211_auth()
4382 return -EINVAL; in ieee80211_auth()
4384 auth_data->tries++; in ieee80211_auth()
4386 if (auth_data->tries > IEEE80211_AUTH_MAX_TRIES) { in ieee80211_auth()
4388 auth_data->bss->bssid); in ieee80211_auth()
4394 cfg80211_unlink_bss(local->hw.wiphy, auth_data->bss); in ieee80211_auth()
4396 return -ETIMEDOUT; in ieee80211_auth()
4399 if (auth_data->algorithm == WLAN_AUTH_SAE) in ieee80211_auth()
4405 auth_data->bss->bssid, auth_data->tries, in ieee80211_auth()
4408 auth_data->expected_transaction = 2; in ieee80211_auth()
4410 if (auth_data->algorithm == WLAN_AUTH_SAE) { in ieee80211_auth()
4411 trans = auth_data->sae_trans; in ieee80211_auth()
4412 status = auth_data->sae_status; in ieee80211_auth()
4413 auth_data->expected_transaction = trans; in ieee80211_auth()
4416 if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) in ieee80211_auth()
4420 ieee80211_send_auth(sdata, trans, auth_data->algorithm, status, in ieee80211_auth()
4421 auth_data->data, auth_data->data_len, in ieee80211_auth()
4422 auth_data->bss->bssid, in ieee80211_auth()
4423 auth_data->bss->bssid, NULL, 0, 0, in ieee80211_auth()
4427 if (auth_data->algorithm == WLAN_AUTH_SAE) in ieee80211_auth()
4428 auth_data->timeout = jiffies + in ieee80211_auth()
4431 auth_data->timeout = jiffies + IEEE80211_AUTH_TIMEOUT; in ieee80211_auth()
4433 auth_data->timeout = in ieee80211_auth()
4437 auth_data->timeout_started = true; in ieee80211_auth()
4438 run_again(sdata, auth_data->timeout); in ieee80211_auth()
4445 struct ieee80211_mgd_assoc_data *assoc_data = sdata->u.mgd.assoc_data; in ieee80211_do_assoc()
4446 struct ieee80211_local *local = sdata->local; in ieee80211_do_assoc()
4450 assoc_data->tries++; in ieee80211_do_assoc()
4451 if (assoc_data->tries > IEEE80211_ASSOC_MAX_TRIES) { in ieee80211_do_assoc()
4453 assoc_data->bss->bssid); in ieee80211_do_assoc()
4459 cfg80211_unlink_bss(local->hw.wiphy, assoc_data->bss); in ieee80211_do_assoc()
4461 return -ETIMEDOUT; in ieee80211_do_assoc()
4465 assoc_data->bss->bssid, assoc_data->tries, in ieee80211_do_assoc()
4469 if (!ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) { in ieee80211_do_assoc()
4470 assoc_data->timeout = jiffies + IEEE80211_ASSOC_TIMEOUT; in ieee80211_do_assoc()
4471 assoc_data->timeout_started = true; in ieee80211_do_assoc()
4472 run_again(sdata, assoc_data->timeout); in ieee80211_do_assoc()
4474 assoc_data->timeout = in ieee80211_do_assoc()
4477 assoc_data->timeout_started = true; in ieee80211_do_assoc()
4478 run_again(sdata, assoc_data->timeout); in ieee80211_do_assoc()
4487 struct ieee80211_local *local = sdata->local; in ieee80211_mgd_conn_tx_status()
4489 sdata->u.mgd.status_fc = fc; in ieee80211_mgd_conn_tx_status()
4490 sdata->u.mgd.status_acked = acked; in ieee80211_mgd_conn_tx_status()
4491 sdata->u.mgd.status_received = true; in ieee80211_mgd_conn_tx_status()
4493 ieee80211_queue_work(&local->hw, &sdata->work); in ieee80211_mgd_conn_tx_status()
4498 struct ieee80211_local *local = sdata->local; in ieee80211_sta_work()
4499 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_sta_work()
4503 if (ifmgd->status_received) { in ieee80211_sta_work()
4504 __le16 fc = ifmgd->status_fc; in ieee80211_sta_work()
4505 bool status_acked = ifmgd->status_acked; in ieee80211_sta_work()
4507 ifmgd->status_received = false; in ieee80211_sta_work()
4508 if (ifmgd->auth_data && ieee80211_is_auth(fc)) { in ieee80211_sta_work()
4510 if (ifmgd->auth_data->algorithm == in ieee80211_sta_work()
4512 ifmgd->auth_data->timeout = in ieee80211_sta_work()
4516 ifmgd->auth_data->timeout = in ieee80211_sta_work()
4519 run_again(sdata, ifmgd->auth_data->timeout); in ieee80211_sta_work()
4521 ifmgd->auth_data->timeout = jiffies - 1; in ieee80211_sta_work()
4523 ifmgd->auth_data->timeout_started = true; in ieee80211_sta_work()
4524 } else if (ifmgd->assoc_data && in ieee80211_sta_work()
4528 ifmgd->assoc_data->timeout = in ieee80211_sta_work()
4530 run_again(sdata, ifmgd->assoc_data->timeout); in ieee80211_sta_work()
4532 ifmgd->assoc_data->timeout = jiffies - 1; in ieee80211_sta_work()
4534 ifmgd->assoc_data->timeout_started = true; in ieee80211_sta_work()
4538 if (ifmgd->auth_data && ifmgd->auth_data->timeout_started && in ieee80211_sta_work()
4539 time_after(jiffies, ifmgd->auth_data->timeout)) { in ieee80211_sta_work()
4540 if (ifmgd->auth_data->done) { in ieee80211_sta_work()
4554 memcpy(bssid, ifmgd->auth_data->bss->bssid, ETH_ALEN); in ieee80211_sta_work()
4558 cfg80211_auth_timeout(sdata->dev, bssid); in ieee80211_sta_work()
4559 drv_event_callback(sdata->local, sdata, &event); in ieee80211_sta_work()
4561 } else if (ifmgd->auth_data && ifmgd->auth_data->timeout_started) in ieee80211_sta_work()
4562 run_again(sdata, ifmgd->auth_data->timeout); in ieee80211_sta_work()
4564 if (ifmgd->assoc_data && ifmgd->assoc_data->timeout_started && in ieee80211_sta_work()
4565 time_after(jiffies, ifmgd->assoc_data->timeout)) { in ieee80211_sta_work()
4566 if ((ifmgd->assoc_data->need_beacon && !ifmgd->have_beacon) || in ieee80211_sta_work()
4568 struct cfg80211_bss *bss = ifmgd->assoc_data->bss; in ieee80211_sta_work()
4576 cfg80211_assoc_timeout(sdata->dev, bss); in ieee80211_sta_work()
4577 drv_event_callback(sdata->local, sdata, &event); in ieee80211_sta_work()
4579 } else if (ifmgd->assoc_data && ifmgd->assoc_data->timeout_started) in ieee80211_sta_work()
4580 run_again(sdata, ifmgd->assoc_data->timeout); in ieee80211_sta_work()
4582 if (ifmgd->flags & IEEE80211_STA_CONNECTION_POLL && in ieee80211_sta_work()
4583 ifmgd->associated) { in ieee80211_sta_work()
4587 memcpy(bssid, ifmgd->associated->bssid, ETH_ALEN); in ieee80211_sta_work()
4589 if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) in ieee80211_sta_work()
4595 if (!ifmgd->probe_send_count) in ieee80211_sta_work()
4597 else if (ifmgd->nullfunc_failed) { in ieee80211_sta_work()
4598 if (ifmgd->probe_send_count < max_tries) { in ieee80211_sta_work()
4601 bssid, ifmgd->probe_send_count, in ieee80211_sta_work()
4612 } else if (time_is_after_jiffies(ifmgd->probe_timeout)) in ieee80211_sta_work()
4613 run_again(sdata, ifmgd->probe_timeout); in ieee80211_sta_work()
4614 else if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) { in ieee80211_sta_work()
4620 } else if (ifmgd->probe_send_count < max_tries) { in ieee80211_sta_work()
4624 ifmgd->probe_send_count, max_tries); in ieee80211_sta_work()
4647 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_sta_bcn_mon_timer()
4649 if (sdata->vif.csa_active && !ifmgd->csa_waiting_bcn) in ieee80211_sta_bcn_mon_timer()
4652 if (sdata->vif.driver_flags & IEEE80211_VIF_BEACON_FILTER) in ieee80211_sta_bcn_mon_timer()
4655 sdata->u.mgd.connection_loss = false; in ieee80211_sta_bcn_mon_timer()
4656 ieee80211_queue_work(&sdata->local->hw, in ieee80211_sta_bcn_mon_timer()
4657 &sdata->u.mgd.beacon_connection_loss_work); in ieee80211_sta_bcn_mon_timer()
4664 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_sta_conn_mon_timer()
4665 struct ieee80211_local *local = sdata->local; in ieee80211_sta_conn_mon_timer()
4669 if (sdata->vif.csa_active && !ifmgd->csa_waiting_bcn) in ieee80211_sta_conn_mon_timer()
4672 sta = sta_info_get(sdata, ifmgd->bssid); in ieee80211_sta_conn_mon_timer()
4676 timeout = sta->status_stats.last_ack; in ieee80211_sta_conn_mon_timer()
4677 if (time_before(sta->status_stats.last_ack, sta->rx_stats.last_rx)) in ieee80211_sta_conn_mon_timer()
4678 timeout = sta->rx_stats.last_rx; in ieee80211_sta_conn_mon_timer()
4685 mod_timer(&ifmgd->conn_mon_timer, round_jiffies_up(timeout)); in ieee80211_sta_conn_mon_timer()
4689 ieee80211_queue_work(&local->hw, &ifmgd->monitor_work); in ieee80211_sta_conn_mon_timer()
4703 if (sdata->vif.type == NL80211_IFTYPE_STATION) { in ieee80211_restart_sta_timer()
4707 if (!ieee80211_hw_check(&sdata->local->hw, CONNECTION_MONITOR)) in ieee80211_restart_sta_timer()
4708 ieee80211_queue_work(&sdata->local->hw, in ieee80211_restart_sta_timer()
4709 &sdata->u.mgd.monitor_work); in ieee80211_restart_sta_timer()
4716 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_mgd_quiesce()
4721 if (ifmgd->auth_data || ifmgd->assoc_data) { in ieee80211_mgd_quiesce()
4722 const u8 *bssid = ifmgd->auth_data ? in ieee80211_mgd_quiesce()
4723 ifmgd->auth_data->bss->bssid : in ieee80211_mgd_quiesce()
4724 ifmgd->assoc_data->bss->bssid; in ieee80211_mgd_quiesce()
4735 if (ifmgd->assoc_data) in ieee80211_mgd_quiesce()
4737 if (ifmgd->auth_data) in ieee80211_mgd_quiesce()
4739 cfg80211_tx_mlme_mgmt(sdata->dev, frame_buf, in ieee80211_mgd_quiesce()
4744 /* This is a bit of a hack - we should find a better and more generic in ieee80211_mgd_quiesce()
4761 if (ifmgd->associated && !sdata->local->wowlan) { in ieee80211_mgd_quiesce()
4768 memcpy(bssid, ifmgd->associated->bssid, ETH_ALEN); in ieee80211_mgd_quiesce()
4777 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_sta_restart()
4780 if (!ifmgd->associated) { in ieee80211_sta_restart()
4785 if (sdata->flags & IEEE80211_SDATA_DISCONNECT_RESUME) { in ieee80211_sta_restart()
4786 sdata->flags &= ~IEEE80211_SDATA_DISCONNECT_RESUME; in ieee80211_sta_restart()
4789 ifmgd->associated->bssid, in ieee80211_sta_restart()
4804 ifmgd = &sdata->u.mgd; in ieee80211_sta_setup_sdata()
4805 INIT_WORK(&ifmgd->monitor_work, ieee80211_sta_monitor_work); in ieee80211_sta_setup_sdata()
4806 INIT_WORK(&ifmgd->chswitch_work, ieee80211_chswitch_work); in ieee80211_sta_setup_sdata()
4807 INIT_WORK(&ifmgd->beacon_connection_loss_work, in ieee80211_sta_setup_sdata()
4809 INIT_WORK(&ifmgd->csa_connection_drop_work, in ieee80211_sta_setup_sdata()
4811 INIT_WORK(&ifmgd->request_smps_work, ieee80211_request_smps_mgd_work); in ieee80211_sta_setup_sdata()
4812 INIT_DELAYED_WORK(&ifmgd->tdls_peer_del_work, in ieee80211_sta_setup_sdata()
4814 timer_setup(&ifmgd->timer, ieee80211_sta_timer, 0); in ieee80211_sta_setup_sdata()
4815 timer_setup(&ifmgd->bcn_mon_timer, ieee80211_sta_bcn_mon_timer, 0); in ieee80211_sta_setup_sdata()
4816 timer_setup(&ifmgd->conn_mon_timer, ieee80211_sta_conn_mon_timer, 0); in ieee80211_sta_setup_sdata()
4817 timer_setup(&ifmgd->chswitch_timer, ieee80211_chswitch_timer, 0); in ieee80211_sta_setup_sdata()
4818 INIT_DELAYED_WORK(&ifmgd->tx_tspec_wk, in ieee80211_sta_setup_sdata()
4821 ifmgd->flags = 0; in ieee80211_sta_setup_sdata()
4822 ifmgd->powersave = sdata->wdev.ps; in ieee80211_sta_setup_sdata()
4823 ifmgd->uapsd_queues = sdata->local->hw.uapsd_queues; in ieee80211_sta_setup_sdata()
4824 ifmgd->uapsd_max_sp_len = sdata->local->hw.uapsd_max_sp_len; in ieee80211_sta_setup_sdata()
4825 ifmgd->p2p_noa_index = -1; in ieee80211_sta_setup_sdata()
4827 if (sdata->local->hw.wiphy->features & NL80211_FEATURE_DYNAMIC_SMPS) in ieee80211_sta_setup_sdata()
4828 ifmgd->req_smps = IEEE80211_SMPS_AUTOMATIC; in ieee80211_sta_setup_sdata()
4830 ifmgd->req_smps = IEEE80211_SMPS_OFF; in ieee80211_sta_setup_sdata()
4833 spin_lock_init(&ifmgd->teardown_lock); in ieee80211_sta_setup_sdata()
4834 ifmgd->teardown_skb = NULL; in ieee80211_sta_setup_sdata()
4835 ifmgd->orig_teardown_skb = NULL; in ieee80211_sta_setup_sdata()
4845 list_for_each_entry_rcu(sdata, &local->interfaces, list) { in ieee80211_mlme_notify_scan_completed()
4855 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_ht_vht_rx_chains()
4861 if (ifmgd->flags & IEEE80211_STA_DISABLE_HT) in ieee80211_ht_vht_rx_chains()
4867 chains = ieee80211_mcs_to_chains(&ht_cap->mcs); in ieee80211_ht_vht_rx_chains()
4874 if (ifmgd->flags & IEEE80211_STA_DISABLE_VHT) in ieee80211_ht_vht_rx_chains()
4883 tx_mcs_map = le16_to_cpu(vht_cap->supp_mcs.tx_mcs_map); in ieee80211_ht_vht_rx_chains()
4884 for (nss = 8; nss > 0; nss--) { in ieee80211_ht_vht_rx_chains()
4885 if (((tx_mcs_map >> (2 * (nss - 1))) & 3) != in ieee80211_ht_vht_rx_chains()
4903 ieee80211_vif_type_p2p(&sdata->vif)); in ieee80211_verify_sta_he_mcs_support()
4910 ap_min_req_set = le16_to_cpu(he_op->he_mcs_nss_set); in ieee80211_verify_sta_he_mcs_support()
4915 &sta_he_cap->he_mcs_nss_supp; in ieee80211_verify_sta_he_mcs_support()
4925 * possible. Each of the sta_mcs_map_* is a 16-bit struct built in ieee80211_verify_sta_he_mcs_support()
4926 * of 2 bits per NSS (1-8), with the values defined in enum in ieee80211_verify_sta_he_mcs_support()
4932 for (nss = 8; nss > 0; nss--) { in ieee80211_verify_sta_he_mcs_support()
4933 u8 sta_rx_val = (sta_mcs_map_rx >> (2 * (nss - 1))) & 3; in ieee80211_verify_sta_he_mcs_support()
4934 u8 sta_tx_val = (sta_mcs_map_tx >> (2 * (nss - 1))) & 3; in ieee80211_verify_sta_he_mcs_support()
4935 u8 ap_val = (ap_min_req_set >> (2 * (nss - 1))) & 3; in ieee80211_verify_sta_he_mcs_support()
4963 struct ieee80211_local *local = sdata->local; in ieee80211_prep_channel()
4964 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_prep_channel()
4972 bool is_6ghz = cbss->channel->band == NL80211_BAND_6GHZ; in ieee80211_prep_channel()
4973 bool is_5ghz = cbss->channel->band == NL80211_BAND_5GHZ; in ieee80211_prep_channel()
4974 struct ieee80211_bss *bss = (void *)cbss->priv; in ieee80211_prep_channel()
4979 sband = local->hw.wiphy->bands[cbss->channel->band]; in ieee80211_prep_channel()
4981 ifmgd->flags &= ~(IEEE80211_STA_DISABLE_40MHZ | in ieee80211_prep_channel()
4986 if (!sband->ht_cap.ht_supported && !is_6ghz) { in ieee80211_prep_channel()
4987 ifmgd->flags |= IEEE80211_STA_DISABLE_HT; in ieee80211_prep_channel()
4988 ifmgd->flags |= IEEE80211_STA_DISABLE_VHT; in ieee80211_prep_channel()
4989 ifmgd->flags |= IEEE80211_STA_DISABLE_HE; in ieee80211_prep_channel()
4992 if (!sband->vht_cap.vht_supported && is_5ghz) { in ieee80211_prep_channel()
4993 ifmgd->flags |= IEEE80211_STA_DISABLE_VHT; in ieee80211_prep_channel()
4994 ifmgd->flags |= IEEE80211_STA_DISABLE_HE; in ieee80211_prep_channel()
4998 ieee80211_vif_type_p2p(&sdata->vif))) in ieee80211_prep_channel()
4999 ifmgd->flags |= IEEE80211_STA_DISABLE_HE; in ieee80211_prep_channel()
5003 if (!(ifmgd->flags & IEEE80211_STA_DISABLE_HT) && !is_6ghz) { in ieee80211_prep_channel()
5015 ifmgd->flags |= IEEE80211_STA_DISABLE_HT; in ieee80211_prep_channel()
5020 if (!(ifmgd->flags & IEEE80211_STA_DISABLE_VHT) && !is_6ghz) { in ieee80211_prep_channel()
5031 ifmgd->flags |= IEEE80211_STA_DISABLE_HT; in ieee80211_prep_channel()
5032 ifmgd->flags |= IEEE80211_STA_DISABLE_VHT; in ieee80211_prep_channel()
5033 ifmgd->flags |= IEEE80211_STA_DISABLE_HE; in ieee80211_prep_channel()
5038 ifmgd->flags |= IEEE80211_STA_DISABLE_VHT; in ieee80211_prep_channel()
5043 if (!(ifmgd->flags & IEEE80211_STA_DISABLE_HE)) { in ieee80211_prep_channel()
5047 ies = rcu_dereference(cbss->ies); in ieee80211_prep_channel()
5049 ies->data, ies->len); in ieee80211_prep_channel()
5057 ifmgd->flags |= IEEE80211_STA_DISABLE_HE; in ieee80211_prep_channel()
5062 for (i = 0; i < sband->n_channels; i++) { in ieee80211_prep_channel()
5063 if (sband->channels[i].flags & (IEEE80211_CHAN_DISABLED | in ieee80211_prep_channel()
5072 ifmgd->flags |= IEEE80211_STA_DISABLE_VHT; in ieee80211_prep_channel()
5074 if (sband->band == NL80211_BAND_S1GHZ) { in ieee80211_prep_channel()
5086 ifmgd->flags |= ieee80211_determine_chantype(sdata, sband, in ieee80211_prep_channel()
5087 cbss->channel, in ieee80211_prep_channel()
5088 bss->vht_cap_info, in ieee80211_prep_channel()
5093 sdata->needed_rx_chains = min(ieee80211_ht_vht_rx_chains(sdata, cbss), in ieee80211_prep_channel()
5094 local->rx_chains); in ieee80211_prep_channel()
5098 if (ifmgd->flags & IEEE80211_STA_DISABLE_HE && is_6ghz) { in ieee80211_prep_channel()
5099 sdata_info(sdata, "Rejecting non-HE 6/7 GHz connection"); in ieee80211_prep_channel()
5100 return -EINVAL; in ieee80211_prep_channel()
5104 sdata->smps_mode = IEEE80211_SMPS_OFF; in ieee80211_prep_channel()
5106 mutex_lock(&local->mtx); in ieee80211_prep_channel()
5121 ifmgd->flags |= ieee80211_chandef_downgrade(&chandef); in ieee80211_prep_channel()
5126 mutex_unlock(&local->mtx); in ieee80211_prep_channel()
5133 const u8 *tim_ie = cfg80211_find_ie(WLAN_EID_TIM, ies->data, ies->len); in ieee80211_get_dtim()
5134 const u8 *idx_ie = cfg80211_find_ie(WLAN_EID_MULTI_BSSID_IDX, ies->data, in ieee80211_get_dtim()
5135 ies->len); in ieee80211_get_dtim()
5144 *dtim_count = valid ? tim->dtim_count : 0; in ieee80211_get_dtim()
5147 *dtim_period = valid ? tim->dtim_period : 0; in ieee80211_get_dtim()
5149 /* Check if value is overridden by non-transmitted profile */ in ieee80211_get_dtim()
5156 *dtim_count = idx->dtim_count; in ieee80211_get_dtim()
5159 *dtim_period = idx->dtim_period; in ieee80211_get_dtim()
5168 struct ieee80211_local *local = sdata->local; in ieee80211_prep_connection()
5169 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_prep_connection()
5170 struct ieee80211_bss *bss = (void *)cbss->priv; in ieee80211_prep_connection()
5176 sband = local->hw.wiphy->bands[cbss->channel->band]; in ieee80211_prep_connection()
5178 if (WARN_ON(!ifmgd->auth_data && !ifmgd->assoc_data)) in ieee80211_prep_connection()
5179 return -EINVAL; in ieee80211_prep_connection()
5182 if (local->in_reconfig) in ieee80211_prep_connection()
5183 return -EBUSY; in ieee80211_prep_connection()
5187 have_sta = sta_info_get(sdata, cbss->bssid); in ieee80211_prep_connection()
5192 new_sta = sta_info_alloc(sdata, cbss->bssid, GFP_KERNEL); in ieee80211_prep_connection()
5194 return -ENOMEM; in ieee80211_prep_connection()
5199 * new channel. We can't - completely race-free - change the basic in ieee80211_prep_connection()
5203 * call that from changing the channel - only for IDLE and perhaps in ieee80211_prep_connection()
5213 int min_rate = INT_MAX, min_rate_index = -1; in ieee80211_prep_connection()
5215 int shift = ieee80211_vif_get_shift(&sdata->vif); in ieee80211_prep_connection()
5218 if (cbss->channel->band == NL80211_BAND_S1GHZ) { in ieee80211_prep_connection()
5223 ieee80211_get_rates(sband, bss->supp_rates, in ieee80211_prep_connection()
5224 bss->supp_rates_len, in ieee80211_prep_connection()
5236 * we can connect -- with a warning. in ieee80211_prep_connection()
5245 return -EINVAL; in ieee80211_prep_connection()
5253 new_sta->sta.supp_rates[cbss->channel->band] = rates; in ieee80211_prep_connection()
5258 sdata->vif.bss_conf.basic_rates = basic_rates; in ieee80211_prep_connection()
5261 if (cbss->channel->band == NL80211_BAND_2GHZ && in ieee80211_prep_connection()
5263 sdata->flags |= IEEE80211_SDATA_OPERATING_GMODE; in ieee80211_prep_connection()
5265 sdata->flags &= ~IEEE80211_SDATA_OPERATING_GMODE; in ieee80211_prep_connection()
5268 memcpy(ifmgd->bssid, cbss->bssid, ETH_ALEN); in ieee80211_prep_connection()
5271 sdata->vif.bss_conf.beacon_int = cbss->beacon_interval; in ieee80211_prep_connection()
5273 ies = rcu_dereference(cbss->beacon_ies); in ieee80211_prep_connection()
5275 sdata->vif.bss_conf.sync_tsf = ies->tsf; in ieee80211_prep_connection()
5276 sdata->vif.bss_conf.sync_device_ts = in ieee80211_prep_connection()
5277 bss->device_ts_beacon; in ieee80211_prep_connection()
5280 &sdata->vif.bss_conf.sync_dtim_count, in ieee80211_prep_connection()
5282 } else if (!ieee80211_hw_check(&sdata->local->hw, in ieee80211_prep_connection()
5284 ies = rcu_dereference(cbss->proberesp_ies); in ieee80211_prep_connection()
5285 /* must be non-NULL since beacon IEs were NULL */ in ieee80211_prep_connection()
5286 sdata->vif.bss_conf.sync_tsf = ies->tsf; in ieee80211_prep_connection()
5287 sdata->vif.bss_conf.sync_device_ts = in ieee80211_prep_connection()
5288 bss->device_ts_presp; in ieee80211_prep_connection()
5289 sdata->vif.bss_conf.sync_dtim_count = 0; in ieee80211_prep_connection()
5291 sdata->vif.bss_conf.sync_tsf = 0; in ieee80211_prep_connection()
5292 sdata->vif.bss_conf.sync_device_ts = 0; in ieee80211_prep_connection()
5293 sdata->vif.bss_conf.sync_dtim_count = 0; in ieee80211_prep_connection()
5303 return -EINVAL; in ieee80211_prep_connection()
5328 WARN_ON_ONCE(!ether_addr_equal(ifmgd->bssid, cbss->bssid)); in ieee80211_prep_connection()
5331 if (local->scanning) in ieee80211_prep_connection()
5341 struct ieee80211_local *local = sdata->local; in ieee80211_mgd_auth()
5342 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_mgd_auth()
5350 switch (req->auth_type) { in ieee80211_mgd_auth()
5356 return -EOPNOTSUPP; in ieee80211_mgd_auth()
5378 return -EOPNOTSUPP; in ieee80211_mgd_auth()
5381 if (ifmgd->assoc_data) in ieee80211_mgd_auth()
5382 return -EBUSY; in ieee80211_mgd_auth()
5384 auth_data = kzalloc(sizeof(*auth_data) + req->auth_data_len + in ieee80211_mgd_auth()
5385 req->ie_len, GFP_KERNEL); in ieee80211_mgd_auth()
5387 return -ENOMEM; in ieee80211_mgd_auth()
5389 auth_data->bss = req->bss; in ieee80211_mgd_auth()
5391 if (req->auth_data_len >= 4) { in ieee80211_mgd_auth()
5392 if (req->auth_type == NL80211_AUTHTYPE_SAE) { in ieee80211_mgd_auth()
5393 __le16 *pos = (__le16 *) req->auth_data; in ieee80211_mgd_auth()
5395 auth_data->sae_trans = le16_to_cpu(pos[0]); in ieee80211_mgd_auth()
5396 auth_data->sae_status = le16_to_cpu(pos[1]); in ieee80211_mgd_auth()
5398 memcpy(auth_data->data, req->auth_data + 4, in ieee80211_mgd_auth()
5399 req->auth_data_len - 4); in ieee80211_mgd_auth()
5400 auth_data->data_len += req->auth_data_len - 4; in ieee80211_mgd_auth()
5405 * removal and re-addition of the STA entry in in ieee80211_mgd_auth()
5408 cont_auth = ifmgd->auth_data && req->bss == ifmgd->auth_data->bss; in ieee80211_mgd_auth()
5410 if (req->ie && req->ie_len) { in ieee80211_mgd_auth()
5411 memcpy(&auth_data->data[auth_data->data_len], in ieee80211_mgd_auth()
5412 req->ie, req->ie_len); in ieee80211_mgd_auth()
5413 auth_data->data_len += req->ie_len; in ieee80211_mgd_auth()
5416 if (req->key && req->key_len) { in ieee80211_mgd_auth()
5417 auth_data->key_len = req->key_len; in ieee80211_mgd_auth()
5418 auth_data->key_idx = req->key_idx; in ieee80211_mgd_auth()
5419 memcpy(auth_data->key, req->key, req->key_len); in ieee80211_mgd_auth()
5422 auth_data->algorithm = auth_alg; in ieee80211_mgd_auth()
5426 if (ifmgd->auth_data) { in ieee80211_mgd_auth()
5427 if (cont_auth && req->auth_type == NL80211_AUTHTYPE_SAE) { in ieee80211_mgd_auth()
5428 auth_data->peer_confirmed = in ieee80211_mgd_auth()
5429 ifmgd->auth_data->peer_confirmed; in ieee80211_mgd_auth()
5435 ifmgd->auth_data = auth_data; in ieee80211_mgd_auth()
5442 if (cont_auth && req->auth_type == NL80211_AUTHTYPE_SAE && in ieee80211_mgd_auth()
5443 auth_data->peer_confirmed && auth_data->sae_trans == 2) in ieee80211_mgd_auth()
5444 ieee80211_mark_sta_auth(sdata, req->bss->bssid); in ieee80211_mgd_auth()
5446 if (ifmgd->associated) { in ieee80211_mgd_auth()
5451 ifmgd->associated->bssid, req->bss->bssid); in ieee80211_mgd_auth()
5462 sdata_info(sdata, "authenticate with %pM\n", req->bss->bssid); in ieee80211_mgd_auth()
5464 err = ieee80211_prep_connection(sdata, req->bss, cont_auth, false); in ieee80211_mgd_auth()
5470 sta_info_destroy_addr(sdata, req->bss->bssid); in ieee80211_mgd_auth()
5475 cfg80211_ref_bss(local->hw.wiphy, auth_data->bss); in ieee80211_mgd_auth()
5479 eth_zero_addr(ifmgd->bssid); in ieee80211_mgd_auth()
5481 ifmgd->auth_data = NULL; in ieee80211_mgd_auth()
5482 mutex_lock(&sdata->local->mtx); in ieee80211_mgd_auth()
5484 mutex_unlock(&sdata->local->mtx); in ieee80211_mgd_auth()
5492 bool is_6ghz = req->bss->channel->band == NL80211_BAND_6GHZ; in ieee80211_mgd_assoc()
5493 bool is_5ghz = req->bss->channel->band == NL80211_BAND_5GHZ; in ieee80211_mgd_assoc()
5494 struct ieee80211_local *local = sdata->local; in ieee80211_mgd_assoc()
5495 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_mgd_assoc()
5496 struct ieee80211_bss *bss = (void *)req->bss->priv; in ieee80211_mgd_assoc()
5500 struct ieee80211_bss_conf *bss_conf = &sdata->vif.bss_conf; in ieee80211_mgd_assoc()
5505 assoc_data = kzalloc(sizeof(*assoc_data) + req->ie_len, GFP_KERNEL); in ieee80211_mgd_assoc()
5507 return -ENOMEM; in ieee80211_mgd_assoc()
5510 ssidie = ieee80211_bss_get_ie(req->bss, WLAN_EID_SSID); in ieee80211_mgd_assoc()
5511 if (!ssidie || ssidie[1] > sizeof(assoc_data->ssid)) { in ieee80211_mgd_assoc()
5514 return -EINVAL; in ieee80211_mgd_assoc()
5516 memcpy(assoc_data->ssid, ssidie + 2, ssidie[1]); in ieee80211_mgd_assoc()
5517 assoc_data->ssid_len = ssidie[1]; in ieee80211_mgd_assoc()
5518 memcpy(bss_conf->ssid, assoc_data->ssid, assoc_data->ssid_len); in ieee80211_mgd_assoc()
5519 bss_conf->ssid_len = assoc_data->ssid_len; in ieee80211_mgd_assoc()
5522 if (ifmgd->associated) { in ieee80211_mgd_assoc()
5527 ifmgd->associated->bssid, req->bss->bssid); in ieee80211_mgd_assoc()
5538 if (ifmgd->auth_data && !ifmgd->auth_data->done) { in ieee80211_mgd_assoc()
5539 err = -EBUSY; in ieee80211_mgd_assoc()
5543 if (ifmgd->assoc_data) { in ieee80211_mgd_assoc()
5544 err = -EBUSY; in ieee80211_mgd_assoc()
5548 if (ifmgd->auth_data) { in ieee80211_mgd_assoc()
5552 match = ether_addr_equal(ifmgd->bssid, req->bss->bssid); in ieee80211_mgd_assoc()
5558 ifmgd->beacon_crc_valid = false; in ieee80211_mgd_assoc()
5560 assoc_data->wmm = bss->wmm_used && in ieee80211_mgd_assoc()
5561 (local->hw.queues >= IEEE80211_NUM_ACS); in ieee80211_mgd_assoc()
5565 * We still associate in non-HT mode (11a/b/g) if any one of these in ieee80211_mgd_assoc()
5567 * We can set this to true for non-11n hardware, that'll be checked in ieee80211_mgd_assoc()
5570 for (i = 0; i < req->crypto.n_ciphers_pairwise; i++) { in ieee80211_mgd_assoc()
5571 if (req->crypto.ciphers_pairwise[i] == WLAN_CIPHER_SUITE_WEP40 || in ieee80211_mgd_assoc()
5572 req->crypto.ciphers_pairwise[i] == WLAN_CIPHER_SUITE_TKIP || in ieee80211_mgd_assoc()
5573 req->crypto.ciphers_pairwise[i] == WLAN_CIPHER_SUITE_WEP104) { in ieee80211_mgd_assoc()
5574 ifmgd->flags |= IEEE80211_STA_DISABLE_HT; in ieee80211_mgd_assoc()
5575 ifmgd->flags |= IEEE80211_STA_DISABLE_VHT; in ieee80211_mgd_assoc()
5576 ifmgd->flags |= IEEE80211_STA_DISABLE_HE; in ieee80211_mgd_assoc()
5577 netdev_info(sdata->dev, in ieee80211_mgd_assoc()
5582 sband = local->hw.wiphy->bands[req->bss->channel->band]; in ieee80211_mgd_assoc()
5585 if (!bss->wmm_used) { in ieee80211_mgd_assoc()
5586 ifmgd->flags |= IEEE80211_STA_DISABLE_HT; in ieee80211_mgd_assoc()
5587 ifmgd->flags |= IEEE80211_STA_DISABLE_VHT; in ieee80211_mgd_assoc()
5588 ifmgd->flags |= IEEE80211_STA_DISABLE_HE; in ieee80211_mgd_assoc()
5589 netdev_info(sdata->dev, in ieee80211_mgd_assoc()
5593 memcpy(&ifmgd->ht_capa, &req->ht_capa, sizeof(ifmgd->ht_capa)); in ieee80211_mgd_assoc()
5594 memcpy(&ifmgd->ht_capa_mask, &req->ht_capa_mask, in ieee80211_mgd_assoc()
5595 sizeof(ifmgd->ht_capa_mask)); in ieee80211_mgd_assoc()
5597 memcpy(&ifmgd->vht_capa, &req->vht_capa, sizeof(ifmgd->vht_capa)); in ieee80211_mgd_assoc()
5598 memcpy(&ifmgd->vht_capa_mask, &req->vht_capa_mask, in ieee80211_mgd_assoc()
5599 sizeof(ifmgd->vht_capa_mask)); in ieee80211_mgd_assoc()
5601 memcpy(&ifmgd->s1g_capa, &req->s1g_capa, sizeof(ifmgd->s1g_capa)); in ieee80211_mgd_assoc()
5602 memcpy(&ifmgd->s1g_capa_mask, &req->s1g_capa_mask, in ieee80211_mgd_assoc()
5603 sizeof(ifmgd->s1g_capa_mask)); in ieee80211_mgd_assoc()
5605 if (req->ie && req->ie_len) { in ieee80211_mgd_assoc()
5606 memcpy(assoc_data->ie, req->ie, req->ie_len); in ieee80211_mgd_assoc()
5607 assoc_data->ie_len = req->ie_len; in ieee80211_mgd_assoc()
5610 if (req->fils_kek) { in ieee80211_mgd_assoc()
5611 /* should already be checked in cfg80211 - so warn */ in ieee80211_mgd_assoc()
5612 if (WARN_ON(req->fils_kek_len > FILS_MAX_KEK_LEN)) { in ieee80211_mgd_assoc()
5613 err = -EINVAL; in ieee80211_mgd_assoc()
5616 memcpy(assoc_data->fils_kek, req->fils_kek, in ieee80211_mgd_assoc()
5617 req->fils_kek_len); in ieee80211_mgd_assoc()
5618 assoc_data->fils_kek_len = req->fils_kek_len; in ieee80211_mgd_assoc()
5621 if (req->fils_nonces) in ieee80211_mgd_assoc()
5622 memcpy(assoc_data->fils_nonces, req->fils_nonces, in ieee80211_mgd_assoc()
5625 assoc_data->bss = req->bss; in ieee80211_mgd_assoc()
5626 assoc_data->capability = req->bss->capability; in ieee80211_mgd_assoc()
5627 assoc_data->supp_rates = bss->supp_rates; in ieee80211_mgd_assoc()
5628 assoc_data->supp_rates_len = bss->supp_rates_len; in ieee80211_mgd_assoc()
5631 ht_ie = ieee80211_bss_get_ie(req->bss, WLAN_EID_HT_OPERATION); in ieee80211_mgd_assoc()
5633 assoc_data->ap_ht_param = in ieee80211_mgd_assoc()
5634 ((struct ieee80211_ht_operation *)(ht_ie + 2))->ht_param; in ieee80211_mgd_assoc()
5636 ifmgd->flags |= IEEE80211_STA_DISABLE_HT; in ieee80211_mgd_assoc()
5637 vht_ie = ieee80211_bss_get_ie(req->bss, WLAN_EID_VHT_CAPABILITY); in ieee80211_mgd_assoc()
5639 memcpy(&assoc_data->ap_vht_cap, vht_ie + 2, in ieee80211_mgd_assoc()
5642 ifmgd->flags |= IEEE80211_STA_DISABLE_VHT | in ieee80211_mgd_assoc()
5646 if (WARN((sdata->vif.driver_flags & IEEE80211_VIF_SUPPORTS_UAPSD) && in ieee80211_mgd_assoc()
5647 ieee80211_hw_check(&local->hw, PS_NULLFUNC_STACK), in ieee80211_mgd_assoc()
5648 "U-APSD not supported with HW_PS_NULLFUNC_STACK\n")) in ieee80211_mgd_assoc()
5649 sdata->vif.driver_flags &= ~IEEE80211_VIF_SUPPORTS_UAPSD; in ieee80211_mgd_assoc()
5651 if (bss->wmm_used && bss->uapsd_supported && in ieee80211_mgd_assoc()
5652 (sdata->vif.driver_flags & IEEE80211_VIF_SUPPORTS_UAPSD)) { in ieee80211_mgd_assoc()
5653 assoc_data->uapsd = true; in ieee80211_mgd_assoc()
5654 ifmgd->flags |= IEEE80211_STA_UAPSD_ENABLED; in ieee80211_mgd_assoc()
5656 assoc_data->uapsd = false; in ieee80211_mgd_assoc()
5657 ifmgd->flags &= ~IEEE80211_STA_UAPSD_ENABLED; in ieee80211_mgd_assoc()
5660 if (req->prev_bssid) in ieee80211_mgd_assoc()
5661 memcpy(assoc_data->prev_bssid, req->prev_bssid, ETH_ALEN); in ieee80211_mgd_assoc()
5663 if (req->use_mfp) { in ieee80211_mgd_assoc()
5664 ifmgd->mfp = IEEE80211_MFP_REQUIRED; in ieee80211_mgd_assoc()
5665 ifmgd->flags |= IEEE80211_STA_MFP_ENABLED; in ieee80211_mgd_assoc()
5667 ifmgd->mfp = IEEE80211_MFP_DISABLED; in ieee80211_mgd_assoc()
5668 ifmgd->flags &= ~IEEE80211_STA_MFP_ENABLED; in ieee80211_mgd_assoc()
5671 if (req->flags & ASSOC_REQ_USE_RRM) in ieee80211_mgd_assoc()
5672 ifmgd->flags |= IEEE80211_STA_ENABLE_RRM; in ieee80211_mgd_assoc()
5674 ifmgd->flags &= ~IEEE80211_STA_ENABLE_RRM; in ieee80211_mgd_assoc()
5676 if (req->crypto.control_port) in ieee80211_mgd_assoc()
5677 ifmgd->flags |= IEEE80211_STA_CONTROL_PORT; in ieee80211_mgd_assoc()
5679 ifmgd->flags &= ~IEEE80211_STA_CONTROL_PORT; in ieee80211_mgd_assoc()
5681 sdata->control_port_protocol = req->crypto.control_port_ethertype; in ieee80211_mgd_assoc()
5682 sdata->control_port_no_encrypt = req->crypto.control_port_no_encrypt; in ieee80211_mgd_assoc()
5683 sdata->control_port_over_nl80211 = in ieee80211_mgd_assoc()
5684 req->crypto.control_port_over_nl80211; in ieee80211_mgd_assoc()
5685 sdata->control_port_no_preauth = req->crypto.control_port_no_preauth; in ieee80211_mgd_assoc()
5686 sdata->encrypt_headroom = ieee80211_cs_headroom(local, &req->crypto, in ieee80211_mgd_assoc()
5687 sdata->vif.type); in ieee80211_mgd_assoc()
5691 ifmgd->assoc_data = assoc_data; in ieee80211_mgd_assoc()
5692 ifmgd->dtim_period = 0; in ieee80211_mgd_assoc()
5693 ifmgd->have_beacon = false; in ieee80211_mgd_assoc()
5696 if (!(ifmgd->flags & IEEE80211_STA_DISABLE_HT)) { in ieee80211_mgd_assoc()
5699 if (req->flags & ASSOC_REQ_DISABLE_HT) in ieee80211_mgd_assoc()
5702 memcpy(&sta_ht_cap, &sband->ht_cap, sizeof(sta_ht_cap)); in ieee80211_mgd_assoc()
5706 if (!(ifmgd->flags & IEEE80211_STA_DISABLE_40MHZ) && in ieee80211_mgd_assoc()
5707 sband->ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40 && in ieee80211_mgd_assoc()
5711 if (!(ifmgd->flags & IEEE80211_STA_DISABLE_VHT) && in ieee80211_mgd_assoc()
5712 req->flags & ASSOC_REQ_DISABLE_VHT) in ieee80211_mgd_assoc()
5716 if (req->flags & ASSOC_REQ_DISABLE_HT) { in ieee80211_mgd_assoc()
5717 ifmgd->flags |= IEEE80211_STA_DISABLE_HT; in ieee80211_mgd_assoc()
5718 ifmgd->flags |= IEEE80211_STA_DISABLE_VHT; in ieee80211_mgd_assoc()
5719 ifmgd->flags |= IEEE80211_STA_DISABLE_HE; in ieee80211_mgd_assoc()
5722 if (req->flags & ASSOC_REQ_DISABLE_VHT) in ieee80211_mgd_assoc()
5723 ifmgd->flags |= IEEE80211_STA_DISABLE_VHT; in ieee80211_mgd_assoc()
5725 if (req->flags & ASSOC_REQ_DISABLE_HE) in ieee80211_mgd_assoc()
5726 ifmgd->flags |= IEEE80211_STA_DISABLE_HE; in ieee80211_mgd_assoc()
5728 err = ieee80211_prep_connection(sdata, req->bss, true, override); in ieee80211_mgd_assoc()
5732 if (ifmgd->req_smps == IEEE80211_SMPS_AUTOMATIC) { in ieee80211_mgd_assoc()
5733 if (ifmgd->powersave) in ieee80211_mgd_assoc()
5734 sdata->smps_mode = IEEE80211_SMPS_DYNAMIC; in ieee80211_mgd_assoc()
5736 sdata->smps_mode = IEEE80211_SMPS_OFF; in ieee80211_mgd_assoc()
5738 sdata->smps_mode = ifmgd->req_smps; in ieee80211_mgd_assoc()
5742 beacon_ies = rcu_dereference(req->bss->beacon_ies); in ieee80211_mgd_assoc()
5744 if (ieee80211_hw_check(&sdata->local->hw, NEED_DTIM_BEFORE_ASSOC) && in ieee80211_mgd_assoc()
5751 ifmgd->bssid); in ieee80211_mgd_assoc()
5752 assoc_data->timeout = TU_TO_EXP_TIME(req->bss->beacon_interval); in ieee80211_mgd_assoc()
5753 assoc_data->timeout_started = true; in ieee80211_mgd_assoc()
5754 assoc_data->need_beacon = true; in ieee80211_mgd_assoc()
5760 &ifmgd->dtim_period); in ieee80211_mgd_assoc()
5762 ifmgd->have_beacon = true; in ieee80211_mgd_assoc()
5763 assoc_data->timeout = jiffies; in ieee80211_mgd_assoc()
5764 assoc_data->timeout_started = true; in ieee80211_mgd_assoc()
5766 if (ieee80211_hw_check(&local->hw, TIMING_BEACON_ONLY)) { in ieee80211_mgd_assoc()
5767 sdata->vif.bss_conf.sync_tsf = beacon_ies->tsf; in ieee80211_mgd_assoc()
5768 sdata->vif.bss_conf.sync_device_ts = in ieee80211_mgd_assoc()
5769 bss->device_ts_beacon; in ieee80211_mgd_assoc()
5770 sdata->vif.bss_conf.sync_dtim_count = dtim_count; in ieee80211_mgd_assoc()
5774 beacon_ies->data, beacon_ies->len); in ieee80211_mgd_assoc()
5775 if (elem && elem->datalen >= 3) in ieee80211_mgd_assoc()
5776 sdata->vif.bss_conf.profile_periodicity = elem->data[2]; in ieee80211_mgd_assoc()
5778 sdata->vif.bss_conf.profile_periodicity = 0; in ieee80211_mgd_assoc()
5781 beacon_ies->data, beacon_ies->len); in ieee80211_mgd_assoc()
5782 if (elem && elem->datalen >= 11 && in ieee80211_mgd_assoc()
5783 (elem->data[10] & WLAN_EXT_CAPA11_EMA_SUPPORT)) in ieee80211_mgd_assoc()
5784 sdata->vif.bss_conf.ema_ap = true; in ieee80211_mgd_assoc()
5786 sdata->vif.bss_conf.ema_ap = false; in ieee80211_mgd_assoc()
5788 assoc_data->timeout = jiffies; in ieee80211_mgd_assoc()
5789 assoc_data->timeout_started = true; in ieee80211_mgd_assoc()
5793 run_again(sdata, assoc_data->timeout); in ieee80211_mgd_assoc()
5795 if (bss->corrupt_data) { in ieee80211_mgd_assoc()
5797 if (bss->corrupt_data & IEEE80211_BSS_CORRUPT_BEACON) { in ieee80211_mgd_assoc()
5798 if (bss->corrupt_data & in ieee80211_mgd_assoc()
5803 } else if (bss->corrupt_data & IEEE80211_BSS_CORRUPT_PROBE_RESP) in ieee80211_mgd_assoc()
5811 eth_zero_addr(ifmgd->bssid); in ieee80211_mgd_assoc()
5813 ifmgd->assoc_data = NULL; in ieee80211_mgd_assoc()
5822 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_mgd_deauth()
5824 bool tx = !req->local_state_change; in ieee80211_mgd_deauth()
5829 if (ifmgd->auth_data && in ieee80211_mgd_deauth()
5830 ether_addr_equal(ifmgd->auth_data->bss->bssid, req->bssid)) { in ieee80211_mgd_deauth()
5833 req->bssid, req->reason_code, in ieee80211_mgd_deauth()
5834 ieee80211_get_reason_code_string(req->reason_code)); in ieee80211_mgd_deauth()
5836 drv_mgd_prepare_tx(sdata->local, sdata, &info); in ieee80211_mgd_deauth()
5837 ieee80211_send_deauth_disassoc(sdata, req->bssid, req->bssid, in ieee80211_mgd_deauth()
5839 req->reason_code, tx, in ieee80211_mgd_deauth()
5844 req->reason_code, false); in ieee80211_mgd_deauth()
5845 drv_mgd_complete_tx(sdata->local, sdata, &info); in ieee80211_mgd_deauth()
5849 if (ifmgd->assoc_data && in ieee80211_mgd_deauth()
5850 ether_addr_equal(ifmgd->assoc_data->bss->bssid, req->bssid)) { in ieee80211_mgd_deauth()
5853 req->bssid, req->reason_code, in ieee80211_mgd_deauth()
5854 ieee80211_get_reason_code_string(req->reason_code)); in ieee80211_mgd_deauth()
5856 drv_mgd_prepare_tx(sdata->local, sdata, &info); in ieee80211_mgd_deauth()
5857 ieee80211_send_deauth_disassoc(sdata, req->bssid, req->bssid, in ieee80211_mgd_deauth()
5859 req->reason_code, tx, in ieee80211_mgd_deauth()
5864 req->reason_code, false); in ieee80211_mgd_deauth()
5868 if (ifmgd->associated && in ieee80211_mgd_deauth()
5869 ether_addr_equal(ifmgd->associated->bssid, req->bssid)) { in ieee80211_mgd_deauth()
5872 req->bssid, req->reason_code, in ieee80211_mgd_deauth()
5873 ieee80211_get_reason_code_string(req->reason_code)); in ieee80211_mgd_deauth()
5876 req->reason_code, tx, frame_buf); in ieee80211_mgd_deauth()
5879 req->reason_code, false); in ieee80211_mgd_deauth()
5880 drv_mgd_complete_tx(sdata->local, sdata, &info); in ieee80211_mgd_deauth()
5884 return -ENOTCONN; in ieee80211_mgd_deauth()
5890 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_mgd_disassoc()
5900 if (ifmgd->associated != req->bss) in ieee80211_mgd_disassoc()
5901 return -ENOLINK; in ieee80211_mgd_disassoc()
5905 req->bss->bssid, req->reason_code, ieee80211_get_reason_code_string(req->reason_code)); in ieee80211_mgd_disassoc()
5907 memcpy(bssid, req->bss->bssid, ETH_ALEN); in ieee80211_mgd_disassoc()
5909 req->reason_code, !req->local_state_change, in ieee80211_mgd_disassoc()
5913 req->reason_code, false); in ieee80211_mgd_disassoc()
5920 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_mgd_stop()
5927 cancel_work_sync(&ifmgd->monitor_work); in ieee80211_mgd_stop()
5928 cancel_work_sync(&ifmgd->beacon_connection_loss_work); in ieee80211_mgd_stop()
5929 cancel_work_sync(&ifmgd->request_smps_work); in ieee80211_mgd_stop()
5930 cancel_work_sync(&ifmgd->csa_connection_drop_work); in ieee80211_mgd_stop()
5931 cancel_work_sync(&ifmgd->chswitch_work); in ieee80211_mgd_stop()
5932 cancel_delayed_work_sync(&ifmgd->tdls_peer_del_work); in ieee80211_mgd_stop()
5935 if (ifmgd->assoc_data) { in ieee80211_mgd_stop()
5936 struct cfg80211_bss *bss = ifmgd->assoc_data->bss; in ieee80211_mgd_stop()
5938 cfg80211_assoc_timeout(sdata->dev, bss); in ieee80211_mgd_stop()
5940 if (ifmgd->auth_data) in ieee80211_mgd_stop()
5942 spin_lock_bh(&ifmgd->teardown_lock); in ieee80211_mgd_stop()
5943 if (ifmgd->teardown_skb) { in ieee80211_mgd_stop()
5944 kfree_skb(ifmgd->teardown_skb); in ieee80211_mgd_stop()
5945 ifmgd->teardown_skb = NULL; in ieee80211_mgd_stop()
5946 ifmgd->orig_teardown_skb = NULL; in ieee80211_mgd_stop()
5948 kfree(ifmgd->assoc_req_ies); in ieee80211_mgd_stop()
5949 ifmgd->assoc_req_ies = NULL; in ieee80211_mgd_stop()
5950 ifmgd->assoc_req_ies_len = 0; in ieee80211_mgd_stop()
5951 spin_unlock_bh(&ifmgd->teardown_lock); in ieee80211_mgd_stop()
5952 del_timer_sync(&ifmgd->timer); in ieee80211_mgd_stop()
5965 cfg80211_cqm_rssi_notify(sdata->dev, rssi_event, rssi_level, gfp); in ieee80211_cqm_rssi_notify()
5973 trace_api_cqm_beacon_loss_notify(sdata->local, sdata); in ieee80211_cqm_beacon_loss_notify()
5975 cfg80211_cqm_beacon_loss_notify(sdata->dev, gfp); in ieee80211_cqm_beacon_loss_notify()