Lines Matching +full:ac +full:- +full:link
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 - 2024 Intel Corporation
29 #include "driver-ops.h"
103 * has happened -- the work that runs from this timer will
109 lockdep_assert_wiphy(sdata->local->hw.wiphy); in run_again()
111 if (!timer_pending(&sdata->u.mgd.timer) || in run_again()
112 time_before(timeout, sdata->u.mgd.timer.expires)) in run_again()
113 mod_timer(&sdata->u.mgd.timer, timeout); in run_again()
118 if (sdata->vif.driver_flags & IEEE80211_VIF_BEACON_FILTER) in ieee80211_sta_reset_beacon_monitor()
121 if (ieee80211_hw_check(&sdata->local->hw, CONNECTION_MONITOR)) in ieee80211_sta_reset_beacon_monitor()
124 mod_timer(&sdata->u.mgd.bcn_mon_timer, in ieee80211_sta_reset_beacon_monitor()
125 round_jiffies_up(jiffies + sdata->u.mgd.beacon_timeout)); in ieee80211_sta_reset_beacon_monitor()
130 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_sta_reset_conn_monitor()
132 if (unlikely(!ifmgd->associated)) in ieee80211_sta_reset_conn_monitor()
135 if (ifmgd->probe_send_count) in ieee80211_sta_reset_conn_monitor()
136 ifmgd->probe_send_count = 0; in ieee80211_sta_reset_conn_monitor()
138 if (ieee80211_hw_check(&sdata->local->hw, CONNECTION_MONITOR)) in ieee80211_sta_reset_conn_monitor()
141 mod_timer(&ifmgd->conn_mon_timer, in ieee80211_sta_reset_conn_monitor()
147 return (1 << ecw) - 1; in ecw2cw()
159 const struct ieee80211_ht_operation *ht_oper = elems->ht_operation; in ieee80211_determine_ap_chan()
160 const struct ieee80211_vht_operation *vht_oper = elems->vht_operation; in ieee80211_determine_ap_chan()
161 const struct ieee80211_he_operation *he_oper = elems->he_operation; in ieee80211_determine_ap_chan()
162 const struct ieee80211_eht_operation *eht_oper = elems->eht_operation; in ieee80211_determine_ap_chan()
164 sdata->local->hw.wiphy->bands[channel->band]; in ieee80211_determine_ap_chan()
172 .center_freq1 = channel->center_freq, in ieee80211_determine_ap_chan()
173 .freq1_offset = channel->freq_offset, in ieee80211_determine_ap_chan()
177 if (sband->band == NL80211_BAND_S1GHZ) { in ieee80211_determine_ap_chan()
178 if (!ieee80211_chandef_s1g_oper(elems->s1g_oper, chandef)) { in ieee80211_determine_ap_chan()
181 chandef->width = ieee80211_s1g_channel_width(channel); in ieee80211_determine_ap_chan()
188 if (sband->band == NL80211_BAND_6GHZ) { in ieee80211_determine_ap_chan()
192 if (conn->mode < IEEE80211_CONN_MODE_HE) in ieee80211_determine_ap_chan()
195 if (!elems->he_6ghz_capa || !elems->he_cap) { in ieee80211_determine_ap_chan()
201 if (!eht_oper || !elems->eht_cap) { in ieee80211_determine_ap_chan()
206 if (!ieee80211_chandef_he_6ghz_oper(sdata->local, he_oper, in ieee80211_determine_ap_chan()
216 if (conn->mode < IEEE80211_CONN_MODE_HT) in ieee80211_determine_ap_chan()
219 if (!ht_oper || !elems->ht_cap_elem) in ieee80211_determine_ap_chan()
222 chandef->width = NL80211_CHAN_WIDTH_20; in ieee80211_determine_ap_chan()
224 ht_cfreq = ieee80211_channel_to_frequency(ht_oper->primary_chan, in ieee80211_determine_ap_chan()
225 channel->band); in ieee80211_determine_ap_chan()
227 if (!ignore_ht_channel_mismatch && channel->center_freq != ht_cfreq) { in ieee80211_determine_ap_chan()
236 …"Wrong control channel: center-freq: %d ht-cfreq: %d ht->primary_chan: %d band: %d - Disabling HT\… in ieee80211_determine_ap_chan()
237 channel->center_freq, ht_cfreq, in ieee80211_determine_ap_chan()
238 ht_oper->primary_chan, channel->band); in ieee80211_determine_ap_chan()
244 if (conn->mode < IEEE80211_CONN_MODE_VHT) in ieee80211_determine_ap_chan()
253 if (elems->he_cap && he_oper && in ieee80211_determine_ap_chan()
254 he_oper->he_oper_params & cpu_to_le32(IEEE80211_HE_OPERATION_VHT_OPER_INFO)) { in ieee80211_determine_ap_chan()
261 memcpy(&he_oper_vht_cap, he_oper->optional, 3); in ieee80211_determine_ap_chan()
264 if (!ieee80211_chandef_vht_oper(&sdata->local->hw, vht_cap_info, in ieee80211_determine_ap_chan()
269 /* this will cause us to re-parse as VHT STA */ in ieee80211_determine_ap_chan()
272 } else if (!vht_oper || !elems->vht_cap_elem) { in ieee80211_determine_ap_chan()
273 if (sband->band == NL80211_BAND_5GHZ) { in ieee80211_determine_ap_chan()
279 } else if (sband->band == NL80211_BAND_2GHZ) { in ieee80211_determine_ap_chan()
281 } else if (!ieee80211_chandef_vht_oper(&sdata->local->hw, in ieee80211_determine_ap_chan()
299 if (conn->mode < IEEE80211_CONN_MODE_HE || in ieee80211_determine_ap_chan()
300 !elems->he_operation || !elems->he_cap) { in ieee80211_determine_ap_chan()
307 if (conn->mode < IEEE80211_CONN_MODE_EHT || in ieee80211_determine_ap_chan()
308 !eht_oper || !elems->eht_cap) in ieee80211_determine_ap_chan()
316 if (eht_oper->params & IEEE80211_EHT_OPER_INFO_PRESENT) { in ieee80211_determine_ap_chan()
319 ieee80211_chandef_eht_oper((const void *)eht_oper->optional, in ieee80211_determine_ap_chan()
359 mcs_80_map_tx = le16_to_cpu(he_mcs_nss_supp->tx_mcs_80); in ieee80211_verify_peer_he_mcs_support()
360 mcs_80_map_rx = le16_to_cpu(he_mcs_nss_supp->rx_mcs_80); in ieee80211_verify_peer_he_mcs_support()
362 /* P802.11-REVme/D0.3 in ieee80211_verify_peer_he_mcs_support()
367 * Single spatial stream HE-MCSs 0 to 7 (transmit and receive) in all in ieee80211_verify_peer_he_mcs_support()
381 ap_min_req_set = le16_to_cpu(he_op->he_mcs_nss_set); in ieee80211_verify_peer_he_mcs_support()
393 * P802.11-REVme/D0.3 in ieee80211_verify_peer_he_mcs_support()
397 * transmit at each of the <HE-MCS, NSS> tuple values indicated by the in ieee80211_verify_peer_he_mcs_support()
398 * Basic HE-MCS And NSS Set field of the HE Operation parameter of the in ieee80211_verify_peer_he_mcs_support()
399 * MLME-START.request primitive and shall be able to receive at each of in ieee80211_verify_peer_he_mcs_support()
400 * the <HE-MCS, NSS> tuple values indicated by the Supported HE-MCS and in ieee80211_verify_peer_he_mcs_support()
404 for (nss = 8; nss > 0; nss--) { in ieee80211_verify_peer_he_mcs_support()
405 u8 ap_op_val = (ap_min_req_set >> (2 * (nss - 1))) & 3; in ieee80211_verify_peer_he_mcs_support()
412 ap_rx_val = (mcs_80_map_rx >> (2 * (nss - 1))) & 3; in ieee80211_verify_peer_he_mcs_support()
413 ap_tx_val = (mcs_80_map_tx >> (2 * (nss - 1))) & 3; in ieee80211_verify_peer_he_mcs_support()
434 ieee80211_get_he_iftype_cap_vif(sband, &sdata->vif); in ieee80211_verify_sta_he_mcs_support()
441 ap_min_req_set = le16_to_cpu(he_op->he_mcs_nss_set); in ieee80211_verify_sta_he_mcs_support()
454 &sta_he_cap->he_mcs_nss_supp; in ieee80211_verify_sta_he_mcs_support()
464 * possible. Each of the sta_mcs_map_* is a 16-bit struct built in ieee80211_verify_sta_he_mcs_support()
465 * of 2 bits per NSS (1-8), with the values defined in enum in ieee80211_verify_sta_he_mcs_support()
471 for (nss = 8; nss > 0; nss--) { in ieee80211_verify_sta_he_mcs_support()
472 u8 sta_rx_val = (sta_mcs_map_rx >> (2 * (nss - 1))) & 3; in ieee80211_verify_sta_he_mcs_support()
473 u8 sta_tx_val = (sta_mcs_map_tx >> (2 * (nss - 1))) & 3; in ieee80211_verify_sta_he_mcs_support()
474 u8 ap_val = (ap_min_req_set >> (2 * (nss - 1))) & 3; in ieee80211_verify_sta_he_mcs_support()
483 * P802.11-REVme/D0.3 in ieee80211_verify_sta_he_mcs_support()
486 * An HE STA shall not attempt to join * (MLME-JOIN.request primitive) in ieee80211_verify_sta_he_mcs_support()
488 * receive using) all of the <HE-MCS, NSS> tuples in the basic in ieee80211_verify_sta_he_mcs_support()
489 * HE-MCS and NSS set. in ieee80211_verify_sta_he_mcs_support()
512 u8 he_phy_cap0 = sta_he_cap->he_cap_elem.phy_cap_info[0]; in ieee80211_get_eht_cap_mcs_nss()
513 u8 eht_phy_cap0 = sta_eht_cap->eht_cap_elem.phy_cap_info[0]; in ieee80211_get_eht_cap_mcs_nss()
515 /* handle us being a 20 MHz-only EHT STA - with four values in ieee80211_get_eht_cap_mcs_nss()
516 * for MCS 0-7, 8-9, 10-11, 12-13. in ieee80211_get_eht_cap_mcs_nss()
519 return sta_eht_cap->eht_mcs_nss_supp.only_20mhz.rx_tx_max_nss[idx]; in ieee80211_get_eht_cap_mcs_nss()
521 /* the others have MCS 0-9 together, rather than separately from 0-7 */ in ieee80211_get_eht_cap_mcs_nss()
523 idx--; in ieee80211_get_eht_cap_mcs_nss()
527 return sta_eht_cap->eht_mcs_nss_supp.bw._80.rx_tx_max_nss[idx]; in ieee80211_get_eht_cap_mcs_nss()
533 return sta_eht_cap->eht_mcs_nss_supp.bw._160.rx_tx_max_nss[idx]; in ieee80211_get_eht_cap_mcs_nss()
537 return sta_eht_cap->eht_mcs_nss_supp.bw._320.rx_tx_max_nss[idx]; in ieee80211_get_eht_cap_mcs_nss()
550 ieee80211_get_he_iftype_cap_vif(sband, &sdata->vif); in ieee80211_verify_sta_eht_mcs_support()
552 ieee80211_get_eht_iftype_cap_vif(sband, &sdata->vif); in ieee80211_verify_sta_eht_mcs_support()
559 req = &eht_op->basic_mcs_nss; in ieee80211_verify_sta_eht_mcs_support()
561 for (i = 0; i < ARRAY_SIZE(req->rx_tx_max_nss); i++) { in ieee80211_verify_sta_eht_mcs_support()
565 req_rx_nss = u8_get_bits(req->rx_tx_max_nss[i], in ieee80211_verify_sta_eht_mcs_support()
567 req_tx_nss = u8_get_bits(req->rx_tx_max_nss[i], in ieee80211_verify_sta_eht_mcs_support()
594 if (!cfg80211_chandef_usable(sdata->local->hw.wiphy, in ieee80211_chandef_usable()
598 if (chandef->punctured && in ieee80211_chandef_usable()
599 ieee80211_hw_check(&sdata->local->hw, DISALLOW_PUNCTURING)) in ieee80211_chandef_usable()
602 if (chandef->punctured && chandef->chan->band == NL80211_BAND_5GHZ && in ieee80211_chandef_usable()
603 ieee80211_hw_check(&sdata->local->hw, DISALLOW_PUNCTURING_5GHZ)) in ieee80211_chandef_usable()
611 if (c->width == NL80211_CHAN_WIDTH_80P80) in ieee80211_chandef_num_subchans()
614 return nl80211_chan_width_to_mhz(c->width) / 20; in ieee80211_chandef_num_subchans()
619 switch (c->width) { in ieee80211_chandef_num_widths()
657 /* don't WARN - misconfigured APs could cause this if their N > width */ in ieee80211_calc_chandef_subchan_offset()
675 * 80+80 with secondary 80 below primary - four subchannels for it in ieee80211_calc_chandef_subchan_offset()
678 if (ap->width == NL80211_CHAN_WIDTH_80P80 && in ieee80211_calc_chandef_subchan_offset()
679 ap->center_freq2 < ap->center_freq1) in ieee80211_calc_chandef_subchan_offset()
696 if (!psd->valid) in ieee80211_rearrange_tpe_psd()
700 if (!psd->n) in ieee80211_rearrange_tpe_psd()
703 BUILD_BUG_ON(sizeof(tmp) != sizeof(psd->power)); in ieee80211_rearrange_tpe_psd()
709 * In psd->power we have values in the order 0..N, 0..K, where in ieee80211_rearrange_tpe_psd()
711 * doesn't then we've pre-filled 'unlimited' as defaults. in ieee80211_rearrange_tpe_psd()
724 * N entries: |--|--|--|--| in ieee80211_rearrange_tpe_psd()
725 * K entries: |--|--|--|--|--|--|--|--| |--|--|--|--| in ieee80211_rearrange_tpe_psd()
740 offset = ieee80211_calc_chandef_subchan_offset(ap, psd->n); in ieee80211_rearrange_tpe_psd()
743 tmp[i] = psd->power[i + psd->n]; in ieee80211_rearrange_tpe_psd()
744 else if (i < offset + psd->n) in ieee80211_rearrange_tpe_psd()
745 tmp[i] = psd->power[i - offset]; in ieee80211_rearrange_tpe_psd()
747 tmp[i] = psd->power[i]; in ieee80211_rearrange_tpe_psd()
754 memset(psd->power, IEEE80211_TPE_PSD_NO_LIMIT, sizeof(psd->power)); in ieee80211_rearrange_tpe_psd()
757 psd->power[i] = tmp[offset + i]; in ieee80211_rearrange_tpe_psd()
761 if (needed < psd->count) in ieee80211_rearrange_tpe_psd()
762 psd->count = needed; in ieee80211_rearrange_tpe_psd()
780 ieee80211_rearrange_tpe_psd(&tpe->psd_local[i], ap, used); in ieee80211_rearrange_tpe()
781 ieee80211_rearrange_tpe_psd(&tpe->psd_reg_client[i], ap, used); in ieee80211_rearrange_tpe()
785 if (needed_pwr_count < tpe->max_local[i].count) in ieee80211_rearrange_tpe()
786 tpe->max_local[i].count = needed_pwr_count; in ieee80211_rearrange_tpe()
787 if (needed_pwr_count < tpe->max_reg_client[i].count) in ieee80211_rearrange_tpe()
788 tpe->max_reg_client[i].count = needed_pwr_count; in ieee80211_rearrange_tpe()
805 chanreq->ap.chan = NULL; in ieee80211_set_chanreq_ap()
807 if (conn->mode < IEEE80211_CONN_MODE_EHT) in ieee80211_set_chanreq_ap()
809 if (sdata->vif.driver_flags & IEEE80211_VIF_IGNORE_OFDMA_WIDER_BW) in ieee80211_set_chanreq_ap()
812 chanreq->ap = *ap_chandef; in ieee80211_set_chanreq_ap()
822 const struct cfg80211_bss_ies *ies = rcu_dereference(cbss->ies); in ieee80211_determine_chan_mode()
823 struct ieee80211_bss *bss = (void *)cbss->priv; in ieee80211_determine_chan_mode()
824 struct ieee80211_channel *channel = cbss->channel; in ieee80211_determine_chan_mode()
826 .link_id = -1, in ieee80211_determine_chan_mode()
828 .start = ies->data, in ieee80211_determine_chan_mode()
829 .len = ies->len, in ieee80211_determine_chan_mode()
837 parse_params.mode = conn->mode; in ieee80211_determine_chan_mode()
840 return ERR_PTR(-ENOMEM); in ieee80211_determine_chan_mode()
842 ap_mode = ieee80211_determine_ap_chan(sdata, channel, bss->vht_cap_info, in ieee80211_determine_chan_mode()
846 if (WARN_ON(ap_mode > conn->mode)) { in ieee80211_determine_chan_mode()
847 ret = -EINVAL; in ieee80211_determine_chan_mode()
851 if (conn->mode != ap_mode) { in ieee80211_determine_chan_mode()
852 conn->mode = ap_mode; in ieee80211_determine_chan_mode()
858 cbss->bssid, ieee80211_conn_mode_str(ap_mode)); in ieee80211_determine_chan_mode()
860 sband = sdata->local->hw.wiphy->bands[channel->band]; in ieee80211_determine_chan_mode()
862 switch (channel->band) { in ieee80211_determine_chan_mode()
865 ret = -EINVAL; in ieee80211_determine_chan_mode()
872 "Rejecting non-HE 6/7 GHz connection"); in ieee80211_determine_chan_mode()
873 ret = -EINVAL; in ieee80211_determine_chan_mode()
879 ret = -EINVAL; in ieee80211_determine_chan_mode()
887 ret = -EINVAL; in ieee80211_determine_chan_mode()
890 conn->bw_limit = IEEE80211_CONN_BW_LIMIT_20; in ieee80211_determine_chan_mode()
893 conn->bw_limit = min_t(enum ieee80211_conn_bw_limit, in ieee80211_determine_chan_mode()
894 conn->bw_limit, in ieee80211_determine_chan_mode()
899 conn->bw_limit = min_t(enum ieee80211_conn_bw_limit, in ieee80211_determine_chan_mode()
900 conn->bw_limit, in ieee80211_determine_chan_mode()
904 conn->bw_limit = min_t(enum ieee80211_conn_bw_limit, in ieee80211_determine_chan_mode()
905 conn->bw_limit, in ieee80211_determine_chan_mode()
910 chanreq->oper = *ap_chandef; in ieee80211_determine_chan_mode()
914 while (!ieee80211_chandef_usable(sdata, &chanreq->oper, in ieee80211_determine_chan_mode()
916 if (WARN_ON(chanreq->oper.width == NL80211_CHAN_WIDTH_20_NOHT)) { in ieee80211_determine_chan_mode()
917 ret = -EINVAL; in ieee80211_determine_chan_mode()
924 if (conn->mode >= IEEE80211_CONN_MODE_HE && in ieee80211_determine_chan_mode()
925 !cfg80211_chandef_usable(sdata->wdev.wiphy, &chanreq->oper, in ieee80211_determine_chan_mode()
927 conn->mode = IEEE80211_CONN_MODE_VHT; in ieee80211_determine_chan_mode()
928 conn->bw_limit = min_t(enum ieee80211_conn_bw_limit, in ieee80211_determine_chan_mode()
929 conn->bw_limit, in ieee80211_determine_chan_mode()
933 if (conn->mode >= IEEE80211_CONN_MODE_EHT && in ieee80211_determine_chan_mode()
934 !cfg80211_chandef_usable(sdata->wdev.wiphy, &chanreq->oper, in ieee80211_determine_chan_mode()
936 conn->mode = IEEE80211_CONN_MODE_HE; in ieee80211_determine_chan_mode()
937 conn->bw_limit = min_t(enum ieee80211_conn_bw_limit, in ieee80211_determine_chan_mode()
938 conn->bw_limit, in ieee80211_determine_chan_mode()
942 if (chanreq->oper.width != ap_chandef->width || ap_mode != conn->mode) in ieee80211_determine_chan_mode()
946 if (conn->mode >= IEEE80211_CONN_MODE_HE && in ieee80211_determine_chan_mode()
947 (!ieee80211_verify_peer_he_mcs_support(sdata, (void *)elems->he_cap, in ieee80211_determine_chan_mode()
948 elems->he_operation) || in ieee80211_determine_chan_mode()
950 elems->he_operation))) { in ieee80211_determine_chan_mode()
951 conn->mode = IEEE80211_CONN_MODE_VHT; in ieee80211_determine_chan_mode()
955 if (conn->mode >= IEEE80211_CONN_MODE_EHT && in ieee80211_determine_chan_mode()
957 elems->eht_operation)) { in ieee80211_determine_chan_mode()
958 conn->mode = IEEE80211_CONN_MODE_HE; in ieee80211_determine_chan_mode()
959 conn->bw_limit = min_t(enum ieee80211_conn_bw_limit, in ieee80211_determine_chan_mode()
960 conn->bw_limit, in ieee80211_determine_chan_mode()
966 if (ap_mode != conn->mode) { in ieee80211_determine_chan_mode()
973 ieee80211_conn_mode_str(conn->mode), in ieee80211_determine_chan_mode()
974 20 * (1 << conn->bw_limit)); in ieee80211_determine_chan_mode()
976 if (WARN_ON_ONCE(!cfg80211_chandef_valid(&chanreq->oper))) { in ieee80211_determine_chan_mode()
977 ret = -EINVAL; in ieee80211_determine_chan_mode()
987 static int ieee80211_config_bw(struct ieee80211_link_data *link, in ieee80211_config_bw() argument
991 struct ieee80211_channel *channel = link->conf->chanreq.oper.chan; in ieee80211_config_bw()
992 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_config_bw()
1001 if (link->u.mgd.conn.mode == IEEE80211_CONN_MODE_LEGACY || in ieee80211_config_bw()
1002 link->u.mgd.conn.mode == IEEE80211_CONN_MODE_S1G) in ieee80211_config_bw()
1005 if (elems->vht_cap_elem) in ieee80211_config_bw()
1006 vht_cap_info = le32_to_cpu(elems->vht_cap_elem->vht_cap_info); in ieee80211_config_bw()
1009 elems, true, &link->u.mgd.conn, in ieee80211_config_bw()
1012 if (ap_mode != link->u.mgd.conn.mode) { in ieee80211_config_bw()
1013 link_info(link, in ieee80211_config_bw()
1015 ieee80211_conn_mode_str(link->u.mgd.conn.mode), in ieee80211_config_bw()
1017 return -EINVAL; in ieee80211_config_bw()
1021 ieee80211_set_chanreq_ap(sdata, &chanreq, &link->u.mgd.conn, in ieee80211_config_bw()
1025 * if HT operation mode changed store the new one - in ieee80211_config_bw()
1028 if (elems->ht_operation) { in ieee80211_config_bw()
1029 ht_opmode = le16_to_cpu(elems->ht_operation->operation_mode); in ieee80211_config_bw()
1030 if (link->conf->ht_operation_mode != ht_opmode) { in ieee80211_config_bw()
1032 link->conf->ht_operation_mode = ht_opmode; in ieee80211_config_bw()
1041 * won't do us any good -- we couldn't use it with the AP. in ieee80211_config_bw()
1043 while (link->u.mgd.conn.bw_limit < in ieee80211_config_bw()
1047 if (ap_chandef.chan->band == NL80211_BAND_6GHZ && in ieee80211_config_bw()
1048 link->u.mgd.conn.mode >= IEEE80211_CONN_MODE_HE) { in ieee80211_config_bw()
1049 ieee80211_rearrange_tpe(&elems->tpe, &ap_chandef, in ieee80211_config_bw()
1051 if (memcmp(&link->conf->tpe, &elems->tpe, sizeof(elems->tpe))) { in ieee80211_config_bw()
1052 link->conf->tpe = elems->tpe; in ieee80211_config_bw()
1057 if (ieee80211_chanreq_identical(&chanreq, &link->conf->chanreq)) in ieee80211_config_bw()
1060 link_info(link, in ieee80211_config_bw()
1062 link->u.mgd.bssid, chanreq.oper.chan->center_freq, in ieee80211_config_bw()
1063 chanreq.oper.chan->freq_offset, chanreq.oper.width, in ieee80211_config_bw()
1069 "AP %pM changed caps/bw in a way we can't support - disconnect\n", in ieee80211_config_bw()
1070 link->u.mgd.bssid); in ieee80211_config_bw()
1071 return -EINVAL; in ieee80211_config_bw()
1075 link->conf->chanreq = chanreq; in ieee80211_config_bw()
1081 * here. This keeps us from playing ping-pong with regulatory, without in ieee80211_config_bw()
1083 * - connect to an AP with 80 MHz, world regdom allows 80 MHz in ieee80211_config_bw()
1084 * - AP advertises regdom US in ieee80211_config_bw()
1085 * - CRDA loads regdom US with 80 MHz prohibited (old database) in ieee80211_config_bw()
1086 * - we detect an unsupported channel and disconnect in ieee80211_config_bw()
1087 * - disconnect causes CRDA to reload world regdomain and the game in ieee80211_config_bw()
1096 ret = ieee80211_link_change_chanreq(link, &chanreq, changed); in ieee80211_config_bw()
1099 "AP %pM changed bandwidth to incompatible one - disconnect\n", in ieee80211_config_bw()
1100 link->u.mgd.bssid); in ieee80211_config_bw()
1104 cfg80211_schedule_channels_check(&sdata->wdev); in ieee80211_config_bw()
1118 u32 flags = channel->flags; in ieee80211_add_ht_ie()
1122 BUILD_BUG_ON(sizeof(ht_cap) != sizeof(sband->ht_cap)); in ieee80211_add_ht_ie()
1124 memcpy(&ht_cap, &sband->ht_cap, sizeof(ht_cap)); in ieee80211_add_ht_ie()
1147 * capable of 40 MHz -- some broken APs will never fall in ieee80211_add_ht_ie()
1150 if (conn->bw_limit <= IEEE80211_CONN_BW_LIMIT_20) { in ieee80211_add_ht_ie()
1183 * Note - the function returns true to own the MU-MIMO capability
1191 struct ieee80211_local *local = sdata->local; in ieee80211_add_vht_ie()
1198 BUILD_BUG_ON(sizeof(vht_cap) != sizeof(sband->vht_cap)); in ieee80211_add_vht_ie()
1200 memcpy(&vht_cap, &sband->vht_cap, sizeof(vht_cap)); in ieee80211_add_vht_ie()
1206 if (conn->bw_limit <= IEEE80211_CONN_BW_LIMIT_80) { in ieee80211_add_vht_ie()
1215 if (!(ap_vht_cap->vht_cap_info & in ieee80211_add_vht_ie()
1219 else if (!(ap_vht_cap->vht_cap_info & in ieee80211_add_vht_ie()
1224 * If some other vif is using the MU-MIMO capability we cannot associate in ieee80211_add_vht_ie()
1225 * using MU-MIMO - this will lead to contradictions in the group-id in ieee80211_add_vht_ie()
1228 * simultaneous associations with MU-MIMO. in ieee80211_add_vht_ie()
1234 list_for_each_entry(other, &local->interfaces, list) { in ieee80211_add_vht_ie()
1235 if (other->vif.bss_conf.mu_mimo_owner) { in ieee80211_add_vht_ie()
1248 ap_bf_sts = le32_to_cpu(ap_vht_cap->vht_cap_info) & mask; in ieee80211_add_vht_ie()
1270 if (assoc_data->supp_rates_len) { in ieee80211_assoc_add_rates()
1274 * in the association request (e.g. D-Link DAP 1353 in in ieee80211_assoc_add_rates()
1275 * b-only mode)... in ieee80211_assoc_add_rates()
1278 assoc_data->supp_rates, in ieee80211_assoc_add_rates()
1279 assoc_data->supp_rates_len, in ieee80211_assoc_add_rates()
1326 /* 60 GHz (Multi-band, DMG, MMS) can't happen */ in ieee80211_add_before_ht_elems()
1340 skb_put_data(skb, elems + offset, noffset - offset); in ieee80211_add_before_ht_elems()
1360 /* 60 GHz (Multi-band, DMG, MMS) can't happen */ in ieee80211_add_before_vht_elems()
1371 skb_put_data(skb, elems + offset, noffset - offset); in ieee80211_add_before_vht_elems()
1405 skb_put_data(skb, elems + offset, noffset - offset); in ieee80211_add_before_he_elems()
1424 struct ieee80211_link_data *link, in ieee80211_assoc_link_elems() argument
1427 enum nl80211_iftype iftype = ieee80211_vif_type_p2p(&sdata->vif); in ieee80211_assoc_link_elems()
1428 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_assoc_link_elems()
1429 struct ieee80211_mgd_assoc_data *assoc_data = ifmgd->assoc_data; in ieee80211_assoc_link_elems()
1430 struct cfg80211_bss *cbss = assoc_data->link[link_id].bss; in ieee80211_assoc_link_elems()
1431 struct ieee80211_channel *chan = cbss->channel; in ieee80211_assoc_link_elems()
1433 struct ieee80211_local *local = sdata->local; in ieee80211_assoc_link_elems()
1445 /* need a last for termination - we use 0 == SSID */ \ in ieee80211_assoc_link_elems()
1446 if (!WARN_ON(present_elems_len >= PRESENT_ELEMS_MAX - 1)) \ in ieee80211_assoc_link_elems()
1451 if (link) in ieee80211_assoc_link_elems()
1452 smps_mode = link->smps_mode; in ieee80211_assoc_link_elems()
1453 else if (sdata->u.mgd.powersave) in ieee80211_assoc_link_elems()
1458 if (link) { in ieee80211_assoc_link_elems()
1465 chanctx_conf = rcu_dereference(link->conf->chanctx_conf); in ieee80211_assoc_link_elems()
1467 width = chanctx_conf->def.width; in ieee80211_assoc_link_elems()
1471 sband = local->hw.wiphy->bands[chan->band]; in ieee80211_assoc_link_elems()
1474 if (sband->band == NL80211_BAND_2GHZ) { in ieee80211_assoc_link_elems()
1479 if ((cbss->capability & WLAN_CAPABILITY_SPECTRUM_MGMT) && in ieee80211_assoc_link_elems()
1480 ieee80211_hw_check(&local->hw, SPECTRUM_MGMT)) in ieee80211_assoc_link_elems()
1483 if (sband->band != NL80211_BAND_S1GHZ) in ieee80211_assoc_link_elems()
1508 (sband->band != NL80211_BAND_6GHZ || in ieee80211_assoc_link_elems()
1509 !ext_capa || ext_capa->datalen < 1 || in ieee80211_assoc_link_elems()
1510 !(ext_capa->data[0] & WLAN_EXT_CAPA1_EXT_CHANNEL_SWITCHING))) { in ieee80211_assoc_link_elems()
1512 pos = skb_put(skb, 2 * sband->n_channels + 2); in ieee80211_assoc_link_elems()
1514 *pos++ = 2 * sband->n_channels; in ieee80211_assoc_link_elems()
1515 for (i = 0; i < sband->n_channels; i++) { in ieee80211_assoc_link_elems()
1516 int cf = sband->channels[i].center_freq; in ieee80211_assoc_link_elems()
1529 if (sband->band != NL80211_BAND_6GHZ && in ieee80211_assoc_link_elems()
1530 assoc_data->link[link_id].conn.mode >= IEEE80211_CONN_MODE_HT) { in ieee80211_assoc_link_elems()
1532 assoc_data->link[link_id].ap_ht_param, in ieee80211_assoc_link_elems()
1534 &assoc_data->link[link_id].conn); in ieee80211_assoc_link_elems()
1543 if (sband->band != NL80211_BAND_6GHZ && in ieee80211_assoc_link_elems()
1544 assoc_data->link[link_id].conn.mode >= IEEE80211_CONN_MODE_VHT && in ieee80211_assoc_link_elems()
1545 sband->vht_cap.vht_supported) { in ieee80211_assoc_link_elems()
1548 &assoc_data->link[link_id].ap_vht_cap, in ieee80211_assoc_link_elems()
1549 &assoc_data->link[link_id].conn); in ieee80211_assoc_link_elems()
1551 if (link) in ieee80211_assoc_link_elems()
1552 link->conf->mu_mimo_owner = mu_mimo_owner; in ieee80211_assoc_link_elems()
1561 if (assoc_data->link[link_id].conn.mode >= IEEE80211_CONN_MODE_HE) { in ieee80211_assoc_link_elems()
1563 &assoc_data->link[link_id].conn); in ieee80211_assoc_link_elems()
1569 * careful - need to know about all the present elems before in ieee80211_assoc_link_elems()
1573 if (assoc_data->link[link_id].conn.mode >= IEEE80211_CONN_MODE_EHT) in ieee80211_assoc_link_elems()
1576 if (link_id == assoc_data->assoc_link_id) in ieee80211_assoc_link_elems()
1583 if (assoc_data->link[link_id].conn.mode >= IEEE80211_CONN_MODE_EHT) in ieee80211_assoc_link_elems()
1585 &assoc_data->link[link_id].conn); in ieee80211_assoc_link_elems()
1587 if (sband->band == NL80211_BAND_S1GHZ) { in ieee80211_assoc_link_elems()
1589 ieee80211_add_s1g_capab_ie(sdata, &sband->s1g_cap, skb); in ieee80211_assoc_link_elems()
1592 if (iftd && iftd->vendor_elems.data && iftd->vendor_elems.len) in ieee80211_assoc_link_elems()
1593 skb_put_data(skb, iftd->vendor_elems.data, iftd->vendor_elems.len); in ieee80211_assoc_link_elems()
1602 unsigned int skb_len = skb->len; in ieee80211_add_non_inheritance_elem()
1616 /* should at least be sorted in the sense of normal -> ext */ in ieee80211_add_non_inheritance_elem()
1646 /* if we added a list but no extension list, make a zero-len one */ in ieee80211_add_non_inheritance_elem()
1654 *len = skb->len - skb_len - 2; in ieee80211_add_non_inheritance_elem()
1662 struct ieee80211_local *local = sdata->local; in ieee80211_assoc_add_ml_elem()
1663 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_assoc_add_ml_elem()
1664 struct ieee80211_mgd_assoc_data *assoc_data = ifmgd->assoc_data; in ieee80211_assoc_add_ml_elem()
1673 if (!ieee80211_vif_is_mld(&sdata->vif)) in ieee80211_assoc_add_ml_elem()
1676 ift_ext_capa = cfg80211_get_iftype_ext_capa(local->hw.wiphy, in ieee80211_assoc_add_ml_elem()
1677 ieee80211_vif_type_p2p(&sdata->vif)); in ieee80211_assoc_add_ml_elem()
1679 eml_capa = cpu_to_le16(ift_ext_capa->eml_capabilities); in ieee80211_assoc_add_ml_elem()
1680 mld_capa_ops = cpu_to_le16(ift_ext_capa->mld_capa_and_ops); in ieee80211_assoc_add_ml_elem()
1687 ml_elem->control = in ieee80211_assoc_add_ml_elem()
1691 common->len = sizeof(*common) + in ieee80211_assoc_add_ml_elem()
1693 memcpy(common->mld_mac_addr, sdata->vif.addr, ETH_ALEN); in ieee80211_assoc_add_ml_elem()
1699 common->len += 2; /* EML capabilities */ in ieee80211_assoc_add_ml_elem()
1700 ml_elem->control |= in ieee80211_assoc_add_ml_elem()
1714 if (!assoc_data->link[link_id].bss || in ieee80211_assoc_add_ml_elem()
1715 link_id == assoc_data->assoc_link_id) in ieee80211_assoc_add_ml_elem()
1718 extra_elems = assoc_data->link[link_id].elems; in ieee80211_assoc_add_ml_elem()
1719 extra_elems_len = assoc_data->link[link_id].elems_len; in ieee80211_assoc_add_ml_elem()
1729 skb_put_data(skb, assoc_data->link[link_id].addr, in ieee80211_assoc_add_ml_elem()
1749 extra_elems_len - extra_used); in ieee80211_assoc_add_ml_elem()
1765 struct ieee80211_local *local = sdata->local; in ieee80211_send_assoc()
1766 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_send_assoc()
1767 struct ieee80211_mgd_assoc_data *assoc_data = ifmgd->assoc_data; in ieee80211_send_assoc()
1768 struct ieee80211_link_data *link; in ieee80211_send_assoc() local
1776 enum nl80211_iftype iftype = ieee80211_vif_type_p2p(&sdata->vif); in ieee80211_send_assoc()
1785 if (assoc_data->ie_len) in ieee80211_send_assoc()
1787 assoc_data->ie, in ieee80211_send_assoc()
1788 assoc_data->ie_len); in ieee80211_send_assoc()
1790 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_send_assoc()
1792 size = local->hw.extra_tx_headroom + in ieee80211_send_assoc()
1794 2 + assoc_data->ssid_len + /* SSID */ in ieee80211_send_assoc()
1795 assoc_data->ie_len + /* extra IEs */ in ieee80211_send_assoc()
1796 (assoc_data->fils_kek_len ? 16 /* AES-SIV */ : 0) + in ieee80211_send_assoc()
1800 struct cfg80211_bss *cbss = assoc_data->link[link_id].bss; in ieee80211_send_assoc()
1807 sband = local->hw.wiphy->bands[cbss->channel->band]; in ieee80211_send_assoc()
1811 size += assoc_data->link[link_id].elems_len; in ieee80211_send_assoc()
1813 size += 4 + sband->n_bitrates; in ieee80211_send_assoc()
1815 size += 2 + 2 * sband->n_channels; in ieee80211_send_assoc()
1819 size += iftd->vendor_elems.len; in ieee80211_send_assoc()
1831 if (sband->band == NL80211_BAND_6GHZ) in ieee80211_send_assoc()
1838 /* non-inheritance element */ in ieee80211_send_assoc()
1842 if (cbss->capability & WLAN_CAPABILITY_PRIVACY) in ieee80211_send_assoc()
1846 if (ieee80211_vif_is_mld(&sdata->vif)) { in ieee80211_send_assoc()
1847 /* consider the multi-link element with STA profile */ in ieee80211_send_assoc()
1849 /* max common info field in basic multi-link element */ in ieee80211_send_assoc()
1856 * note this over-estimates a bit because there's no in ieee80211_send_assoc()
1857 * STA profile for the assoc link. in ieee80211_send_assoc()
1859 size += (n_links - 1) * in ieee80211_send_assoc()
1865 link = sdata_dereference(sdata->link[assoc_data->assoc_link_id], sdata); in ieee80211_send_assoc()
1866 if (WARN_ON(!link)) in ieee80211_send_assoc()
1867 return -EINVAL; in ieee80211_send_assoc()
1869 if (WARN_ON(!assoc_data->link[assoc_data->assoc_link_id].bss)) in ieee80211_send_assoc()
1870 return -EINVAL; in ieee80211_send_assoc()
1874 return -ENOMEM; in ieee80211_send_assoc()
1876 skb_reserve(skb, local->hw.extra_tx_headroom); in ieee80211_send_assoc()
1878 if (ifmgd->flags & IEEE80211_STA_ENABLE_RRM) in ieee80211_send_assoc()
1882 if (ieee80211_hw_check(&local->hw, SUPPORTS_ONLY_HE_MULTI_BSSID) && in ieee80211_send_assoc()
1883 link->u.mgd.conn.mode >= IEEE80211_CONN_MODE_HE && in ieee80211_send_assoc()
1884 ext_capa && ext_capa->datalen >= 3) in ieee80211_send_assoc()
1885 ext_capa->data[2] |= WLAN_EXT_CAPA3_MULTI_BSSID_SUPPORT; in ieee80211_send_assoc()
1888 memcpy(mgmt->da, sdata->vif.cfg.ap_addr, ETH_ALEN); in ieee80211_send_assoc()
1889 memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); in ieee80211_send_assoc()
1890 memcpy(mgmt->bssid, sdata->vif.cfg.ap_addr, ETH_ALEN); in ieee80211_send_assoc()
1892 listen_int = cpu_to_le16(assoc_data->s1g ? in ieee80211_send_assoc()
1893 ieee80211_encode_usf(local->hw.conf.listen_interval) : in ieee80211_send_assoc()
1894 local->hw.conf.listen_interval); in ieee80211_send_assoc()
1895 if (!is_zero_ether_addr(assoc_data->prev_ap_addr)) { in ieee80211_send_assoc()
1897 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | in ieee80211_send_assoc()
1899 capab_pos = &mgmt->u.reassoc_req.capab_info; in ieee80211_send_assoc()
1900 mgmt->u.reassoc_req.listen_interval = listen_int; in ieee80211_send_assoc()
1901 memcpy(mgmt->u.reassoc_req.current_ap, in ieee80211_send_assoc()
1902 assoc_data->prev_ap_addr, ETH_ALEN); in ieee80211_send_assoc()
1906 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | in ieee80211_send_assoc()
1908 capab_pos = &mgmt->u.assoc_req.capab_info; in ieee80211_send_assoc()
1909 mgmt->u.assoc_req.listen_interval = listen_int; in ieee80211_send_assoc()
1914 pos = skb_put(skb, 2 + assoc_data->ssid_len); in ieee80211_send_assoc()
1917 *pos++ = assoc_data->ssid_len; in ieee80211_send_assoc()
1918 memcpy(pos, assoc_data->ssid, assoc_data->ssid_len); in ieee80211_send_assoc()
1926 * pre-EHT connections as we used to do. in ieee80211_send_assoc()
1928 if (link->u.mgd.conn.mode < IEEE80211_CONN_MODE_EHT) in ieee80211_send_assoc()
1931 /* add the elements for the assoc (main) link */ in ieee80211_send_assoc()
1935 assoc_data->ie, in ieee80211_send_assoc()
1936 assoc_data->ie_len, in ieee80211_send_assoc()
1937 assoc_data->assoc_link_id, link, in ieee80211_send_assoc()
1941 /* if present, add any custom non-vendor IEs */ in ieee80211_send_assoc()
1942 if (assoc_data->ie_len) { in ieee80211_send_assoc()
1943 noffset = ieee80211_ie_split_vendor(assoc_data->ie, in ieee80211_send_assoc()
1944 assoc_data->ie_len, in ieee80211_send_assoc()
1946 skb_put_data(skb, assoc_data->ie + offset, noffset - offset); in ieee80211_send_assoc()
1950 if (assoc_data->wmm) { in ieee80211_send_assoc()
1951 if (assoc_data->uapsd) { in ieee80211_send_assoc()
1952 qos_info = ifmgd->uapsd_queues; in ieee80211_send_assoc()
1953 qos_info |= (ifmgd->uapsd_max_sp_len << in ieee80211_send_assoc()
1963 if (assoc_data->ie_len) { in ieee80211_send_assoc()
1964 noffset = assoc_data->ie_len; in ieee80211_send_assoc()
1965 skb_put_data(skb, assoc_data->ie + offset, noffset - offset); in ieee80211_send_assoc()
1968 if (assoc_data->fils_kek_len) { in ieee80211_send_assoc()
1977 kfree(ifmgd->assoc_req_ies); in ieee80211_send_assoc()
1978 ifmgd->assoc_req_ies = kmemdup(ie_start, pos - ie_start, GFP_ATOMIC); in ieee80211_send_assoc()
1979 if (!ifmgd->assoc_req_ies) { in ieee80211_send_assoc()
1981 return -ENOMEM; in ieee80211_send_assoc()
1984 ifmgd->assoc_req_ies_len = pos - ie_start; in ieee80211_send_assoc()
1986 info.link_id = assoc_data->assoc_link_id; in ieee80211_send_assoc()
1989 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; in ieee80211_send_assoc()
1990 if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) in ieee80211_send_assoc()
1991 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS | in ieee80211_send_assoc()
2004 skb = ieee80211_pspoll_get(&local->hw, &sdata->vif); in ieee80211_send_pspoll()
2008 pspoll = (struct ieee80211_pspoll *) skb->data; in ieee80211_send_pspoll()
2009 pspoll->frame_control |= cpu_to_le16(IEEE80211_FCTL_PM); in ieee80211_send_pspoll()
2011 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; in ieee80211_send_pspoll()
2021 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_send_nullfunc()
2023 skb = ieee80211_nullfunc_get(&local->hw, &sdata->vif, -1, in ieee80211_send_nullfunc()
2024 !ieee80211_hw_check(&local->hw, in ieee80211_send_nullfunc()
2029 nullfunc = (struct ieee80211_hdr_3addr *) skb->data; in ieee80211_send_nullfunc()
2031 nullfunc->frame_control |= cpu_to_le16(IEEE80211_FCTL_PM); in ieee80211_send_nullfunc()
2033 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT | in ieee80211_send_nullfunc()
2036 if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) in ieee80211_send_nullfunc()
2037 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS; in ieee80211_send_nullfunc()
2039 if (ifmgd->flags & IEEE80211_STA_CONNECTION_POLL) in ieee80211_send_nullfunc()
2040 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_CTL_USE_MINRATE; in ieee80211_send_nullfunc()
2052 if (WARN_ON(sdata->vif.type != NL80211_IFTYPE_STATION)) in ieee80211_send_4addr_nullfunc()
2055 skb = dev_alloc_skb(local->hw.extra_tx_headroom + 30); in ieee80211_send_4addr_nullfunc()
2059 skb_reserve(skb, local->hw.extra_tx_headroom); in ieee80211_send_4addr_nullfunc()
2064 nullfunc->frame_control = fc; in ieee80211_send_4addr_nullfunc()
2065 memcpy(nullfunc->addr1, sdata->deflink.u.mgd.bssid, ETH_ALEN); in ieee80211_send_4addr_nullfunc()
2066 memcpy(nullfunc->addr2, sdata->vif.addr, ETH_ALEN); in ieee80211_send_4addr_nullfunc()
2067 memcpy(nullfunc->addr3, sdata->deflink.u.mgd.bssid, ETH_ALEN); in ieee80211_send_4addr_nullfunc()
2068 memcpy(nullfunc->addr4, sdata->vif.addr, ETH_ALEN); in ieee80211_send_4addr_nullfunc()
2070 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; in ieee80211_send_4addr_nullfunc()
2071 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_CTL_USE_MINRATE; in ieee80211_send_4addr_nullfunc()
2079 struct ieee80211_link_data *link = in ieee80211_csa_switch_work() local
2082 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_csa_switch_work()
2083 struct ieee80211_local *local = sdata->local; in ieee80211_csa_switch_work()
2084 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_csa_switch_work()
2090 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_csa_switch_work()
2092 if (!ifmgd->associated) in ieee80211_csa_switch_work()
2095 if (!link->conf->csa_active) in ieee80211_csa_switch_work()
2099 * If the link isn't active (now), we cannot wait for beacons, won't in ieee80211_csa_switch_work()
2103 if (!ieee80211_vif_link_active(&sdata->vif, link->link_id)) { in ieee80211_csa_switch_work()
2104 link->conf->chanreq = link->csa.chanreq; in ieee80211_csa_switch_work()
2105 cfg80211_ch_switch_notify(sdata->dev, &link->csa.chanreq.oper, in ieee80211_csa_switch_work()
2106 link->link_id); in ieee80211_csa_switch_work()
2112 * with multi-vif. once reservation is complete it will re-schedule the in ieee80211_csa_switch_work()
2117 if (link->reserved_chanctx) { in ieee80211_csa_switch_work()
2119 * with multi-vif csa driver may call ieee80211_csa_finish() in ieee80211_csa_switch_work()
2123 if (link->reserved_ready) in ieee80211_csa_switch_work()
2126 ret = ieee80211_link_use_reserved_context(link); in ieee80211_csa_switch_work()
2128 link_info(link, in ieee80211_csa_switch_work()
2131 wiphy_work_queue(sdata->local->hw.wiphy, in ieee80211_csa_switch_work()
2132 &ifmgd->csa_connection_drop_work); in ieee80211_csa_switch_work()
2137 if (!ieee80211_chanreq_identical(&link->conf->chanreq, in ieee80211_csa_switch_work()
2138 &link->csa.chanreq)) { in ieee80211_csa_switch_work()
2139 link_info(link, in ieee80211_csa_switch_work()
2141 wiphy_work_queue(sdata->local->hw.wiphy, in ieee80211_csa_switch_work()
2142 &ifmgd->csa_connection_drop_work); in ieee80211_csa_switch_work()
2146 link->u.mgd.csa.waiting_bcn = true; in ieee80211_csa_switch_work()
2149 if (link->u.mgd.csa.ap_chandef.chan->band == NL80211_BAND_6GHZ && in ieee80211_csa_switch_work()
2150 link->u.mgd.conn.mode >= IEEE80211_CONN_MODE_HE) { in ieee80211_csa_switch_work()
2151 ieee80211_rearrange_tpe(&link->u.mgd.csa.tpe, in ieee80211_csa_switch_work()
2152 &link->u.mgd.csa.ap_chandef, in ieee80211_csa_switch_work()
2153 &link->conf->chanreq.oper); in ieee80211_csa_switch_work()
2154 if (memcmp(&link->conf->tpe, &link->u.mgd.csa.tpe, in ieee80211_csa_switch_work()
2155 sizeof(link->u.mgd.csa.tpe))) { in ieee80211_csa_switch_work()
2156 link->conf->tpe = link->u.mgd.csa.tpe; in ieee80211_csa_switch_work()
2157 ieee80211_link_info_change_notify(sdata, link, in ieee80211_csa_switch_work()
2166 static void ieee80211_chswitch_post_beacon(struct ieee80211_link_data *link) in ieee80211_chswitch_post_beacon() argument
2168 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_chswitch_post_beacon()
2169 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_chswitch_post_beacon()
2172 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_chswitch_post_beacon()
2174 WARN_ON(!link->conf->csa_active); in ieee80211_chswitch_post_beacon()
2178 link->conf->csa_active = false; in ieee80211_chswitch_post_beacon()
2179 link->u.mgd.csa.blocked_tx = false; in ieee80211_chswitch_post_beacon()
2180 link->u.mgd.csa.waiting_bcn = false; in ieee80211_chswitch_post_beacon()
2182 ret = drv_post_channel_switch(link); in ieee80211_chswitch_post_beacon()
2184 link_info(link, in ieee80211_chswitch_post_beacon()
2186 wiphy_work_queue(sdata->local->hw.wiphy, in ieee80211_chswitch_post_beacon()
2187 &ifmgd->csa_connection_drop_work); in ieee80211_chswitch_post_beacon()
2191 cfg80211_ch_switch_notify(sdata->dev, &link->conf->chanreq.oper, in ieee80211_chswitch_post_beacon()
2192 link->link_id); in ieee80211_chswitch_post_beacon()
2206 "driver channel switch failed (link %d), disconnecting\n", in ieee80211_chswitch_done()
2208 wiphy_work_queue(sdata->local->hw.wiphy, in ieee80211_chswitch_done()
2209 &sdata->u.mgd.csa_connection_drop_work); in ieee80211_chswitch_done()
2211 struct ieee80211_link_data *link = in ieee80211_chswitch_done() local
2212 rcu_dereference(sdata->link[link_id]); in ieee80211_chswitch_done()
2214 if (WARN_ON(!link)) { in ieee80211_chswitch_done()
2219 wiphy_delayed_work_queue(sdata->local->hw.wiphy, in ieee80211_chswitch_done()
2220 &link->u.mgd.csa.switch_work, 0); in ieee80211_chswitch_done()
2228 ieee80211_sta_abort_chanswitch(struct ieee80211_link_data *link) in ieee80211_sta_abort_chanswitch() argument
2230 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_sta_abort_chanswitch()
2231 struct ieee80211_local *local = sdata->local; in ieee80211_sta_abort_chanswitch()
2233 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_sta_abort_chanswitch()
2235 if (!local->ops->abort_channel_switch) in ieee80211_sta_abort_chanswitch()
2238 ieee80211_link_unreserve_chanctx(link); in ieee80211_sta_abort_chanswitch()
2242 link->conf->csa_active = false; in ieee80211_sta_abort_chanswitch()
2243 link->u.mgd.csa.blocked_tx = false; in ieee80211_sta_abort_chanswitch()
2245 drv_abort_channel_switch(link); in ieee80211_sta_abort_chanswitch()
2249 struct ieee80211_link_data *link; member
2260 struct ieee80211_link_data *link = data->link; in ieee80211_sta_csa_rnr_iter() local
2261 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_sta_csa_rnr_iter()
2262 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_sta_csa_rnr_iter()
2276 if (ti->mld_params.mld_id != data->mld_id) in ieee80211_sta_csa_rnr_iter()
2279 link_id = le16_get_bits(ti->mld_params.params, in ieee80211_sta_csa_rnr_iter()
2281 if (link_id != data->link->link_id) in ieee80211_sta_csa_rnr_iter()
2284 /* we found the entry for our link! */ in ieee80211_sta_csa_rnr_iter()
2287 if (!ieee80211_operating_class_to_band(info->op_class, &band)) { in ieee80211_sta_csa_rnr_iter()
2288 link_info(link, in ieee80211_sta_csa_rnr_iter()
2290 wiphy_work_queue(sdata->local->hw.wiphy, in ieee80211_sta_csa_rnr_iter()
2291 &ifmgd->csa_connection_drop_work); in ieee80211_sta_csa_rnr_iter()
2295 center_freq = ieee80211_channel_to_frequency(info->channel, band); in ieee80211_sta_csa_rnr_iter()
2296 data->chan = ieee80211_get_channel(sdata->local->hw.wiphy, center_freq); in ieee80211_sta_csa_rnr_iter()
2302 ieee80211_sta_other_link_csa_disappeared(struct ieee80211_link_data *link, in ieee80211_sta_other_link_csa_disappeared() argument
2305 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_sta_other_link_csa_disappeared()
2306 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_sta_other_link_csa_disappeared()
2308 .link = link, in ieee80211_sta_other_link_csa_disappeared()
2312 * If we get here, we see a beacon from another link without in ieee80211_sta_other_link_csa_disappeared()
2316 * the puncturing, but in that case if the link in inactive in ieee80211_sta_other_link_csa_disappeared()
2317 * we don't really care, and if it's an active link (or when in ieee80211_sta_other_link_csa_disappeared()
2321 if (WARN_ON(!elems->ml_basic)) in ieee80211_sta_other_link_csa_disappeared()
2324 data.mld_id = ieee80211_mle_get_mld_id((const void *)elems->ml_basic); in ieee80211_sta_other_link_csa_disappeared()
2330 cfg80211_iter_rnr(elems->ie_start, elems->total_len, in ieee80211_sta_other_link_csa_disappeared()
2334 link_info(link, in ieee80211_sta_other_link_csa_disappeared()
2336 wiphy_work_queue(sdata->local->hw.wiphy, in ieee80211_sta_other_link_csa_disappeared()
2337 &ifmgd->csa_connection_drop_work); in ieee80211_sta_other_link_csa_disappeared()
2348 if (data.chan != link->csa.chanreq.oper.chan) in ieee80211_sta_other_link_csa_disappeared()
2349 ieee80211_sta_abort_chanswitch(link); in ieee80211_sta_other_link_csa_disappeared()
2360 ieee80211_sta_process_chanswitch(struct ieee80211_link_data *link, in ieee80211_sta_process_chanswitch() argument
2366 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_sta_process_chanswitch()
2367 struct ieee80211_local *local = sdata->local; in ieee80211_sta_process_chanswitch()
2368 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_sta_process_chanswitch()
2373 .link_id = link->link_id, in ieee80211_sta_process_chanswitch()
2380 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_sta_process_chanswitch()
2383 struct cfg80211_bss *cbss = link->conf->bss; in ieee80211_sta_process_chanswitch()
2390 current_band = cbss->channel->band; in ieee80211_sta_process_chanswitch()
2391 bss = (void *)cbss->priv; in ieee80211_sta_process_chanswitch()
2395 bss->vht_cap_info, in ieee80211_sta_process_chanswitch()
2396 &link->u.mgd.conn, in ieee80211_sta_process_chanswitch()
2397 link->u.mgd.bssid, in ieee80211_sta_process_chanswitch()
2407 link->u.mgd.csa.tpe = csa_elems->csa_tpe; in ieee80211_sta_process_chanswitch()
2410 * If there was no per-STA profile for this link, we in ieee80211_sta_process_chanswitch()
2425 if (link->conf->csa_active) { in ieee80211_sta_process_chanswitch()
2429 /* already processing - disregard action frames */ in ieee80211_sta_process_chanswitch()
2432 if (link->u.mgd.csa.waiting_bcn) { in ieee80211_sta_process_chanswitch()
2433 ieee80211_chswitch_post_beacon(link); in ieee80211_sta_process_chanswitch()
2441 ieee80211_sta_abort_chanswitch(link); in ieee80211_sta_process_chanswitch()
2449 /* active link: we want to see the beacon to continue */ in ieee80211_sta_process_chanswitch()
2450 if (ieee80211_vif_link_active(&sdata->vif, in ieee80211_sta_process_chanswitch()
2451 link->link_id)) in ieee80211_sta_process_chanswitch()
2455 if (link->u.mgd.csa.waiting_bcn) { in ieee80211_sta_process_chanswitch()
2456 ieee80211_chswitch_post_beacon(link); in ieee80211_sta_process_chanswitch()
2466 /* link still has CSA but we already know, do nothing */ in ieee80211_sta_process_chanswitch()
2471 ieee80211_sta_other_link_csa_disappeared(link, in ieee80211_sta_process_chanswitch()
2482 * bit set. This is a trade-off, we want to be quiet as soon as in ieee80211_sta_process_chanswitch()
2486 if (unlikely(link->u.mgd.csa.blocked_tx)) { in ieee80211_sta_process_chanswitch()
2487 link->u.mgd.csa.blocked_tx = false; in ieee80211_sta_process_chanswitch()
2501 link->u.mgd.csa.blocked_tx = true; in ieee80211_sta_process_chanswitch()
2507 if (link->conf->chanreq.oper.chan->band != in ieee80211_sta_process_chanswitch()
2508 csa_ie.chanreq.oper.chan->band) { in ieee80211_sta_process_chanswitch()
2509 link_info(link, in ieee80211_sta_process_chanswitch()
2511 link->u.mgd.bssid, in ieee80211_sta_process_chanswitch()
2512 csa_ie.chanreq.oper.chan->center_freq, in ieee80211_sta_process_chanswitch()
2519 if (!cfg80211_chandef_usable(local->hw.wiphy, &csa_ie.chanreq.oper, in ieee80211_sta_process_chanswitch()
2521 link_info(link, in ieee80211_sta_process_chanswitch()
2523 link->u.mgd.bssid, in ieee80211_sta_process_chanswitch()
2524 csa_ie.chanreq.oper.chan->center_freq, in ieee80211_sta_process_chanswitch()
2525 csa_ie.chanreq.oper.chan->freq_offset, in ieee80211_sta_process_chanswitch()
2534 &link->conf->chanreq.oper) && in ieee80211_sta_process_chanswitch()
2536 if (link->u.mgd.csa.ignored_same_chan) in ieee80211_sta_process_chanswitch()
2538 link_info(link, in ieee80211_sta_process_chanswitch()
2540 link->u.mgd.bssid); in ieee80211_sta_process_chanswitch()
2541 link->u.mgd.csa.ignored_same_chan = true; in ieee80211_sta_process_chanswitch()
2546 * Drop all TDLS peers on the affected link - either we disconnect or in ieee80211_sta_process_chanswitch()
2552 ieee80211_teardown_tdls_peers(link); in ieee80211_sta_process_chanswitch()
2554 conf = rcu_dereference_protected(link->conf->chanctx_conf, in ieee80211_sta_process_chanswitch()
2555 lockdep_is_held(&local->hw.wiphy->mtx)); in ieee80211_sta_process_chanswitch()
2556 if (ieee80211_vif_link_active(&sdata->vif, link->link_id) && !conf) { in ieee80211_sta_process_chanswitch()
2557 link_info(link, in ieee80211_sta_process_chanswitch()
2565 if (!ieee80211_hw_check(&local->hw, CHANCTX_STA_CSA)) { in ieee80211_sta_process_chanswitch()
2566 link_info(link, in ieee80211_sta_process_chanswitch()
2567 "driver doesn't support chan-switch with channel contexts\n"); in ieee80211_sta_process_chanswitch()
2572 link_info(link, in ieee80211_sta_process_chanswitch()
2577 link->u.mgd.csa.ap_chandef = csa_ie.chanreq.ap; in ieee80211_sta_process_chanswitch()
2579 link->csa.chanreq.oper = csa_ie.chanreq.oper; in ieee80211_sta_process_chanswitch()
2580 ieee80211_set_chanreq_ap(sdata, &link->csa.chanreq, &link->u.mgd.conn, in ieee80211_sta_process_chanswitch()
2584 res = ieee80211_link_reserve_chanctx(link, &link->csa.chanreq, in ieee80211_sta_process_chanswitch()
2585 chanctx->mode, false); in ieee80211_sta_process_chanswitch()
2587 link_info(link, in ieee80211_sta_process_chanswitch()
2594 link->conf->csa_active = true; in ieee80211_sta_process_chanswitch()
2595 link->u.mgd.csa.ignored_same_chan = false; in ieee80211_sta_process_chanswitch()
2596 link->u.mgd.beacon_crc_valid = false; in ieee80211_sta_process_chanswitch()
2597 link->u.mgd.csa.blocked_tx = csa_ie.mode; in ieee80211_sta_process_chanswitch()
2602 cfg80211_ch_switch_started_notify(sdata->dev, &csa_ie.chanreq.oper, in ieee80211_sta_process_chanswitch()
2603 link->link_id, csa_ie.count, in ieee80211_sta_process_chanswitch()
2606 /* we may have to handle timeout for deactivated link in software */ in ieee80211_sta_process_chanswitch()
2608 link->u.mgd.csa.time = now + in ieee80211_sta_process_chanswitch()
2609 TU_TO_JIFFIES((max_t(int, csa_ie.count, 1) - 1) * in ieee80211_sta_process_chanswitch()
2610 link->conf->beacon_int); in ieee80211_sta_process_chanswitch()
2612 if (ieee80211_vif_link_active(&sdata->vif, link->link_id) && in ieee80211_sta_process_chanswitch()
2613 local->ops->channel_switch) { in ieee80211_sta_process_chanswitch()
2617 * the link as well, we handle that elsewhere and queue in ieee80211_sta_process_chanswitch()
2625 wiphy_delayed_work_queue(local->hw.wiphy, in ieee80211_sta_process_chanswitch()
2626 &link->u.mgd.csa.switch_work, in ieee80211_sta_process_chanswitch()
2627 link->u.mgd.csa.time - now); in ieee80211_sta_process_chanswitch()
2637 link->conf->csa_active = true; in ieee80211_sta_process_chanswitch()
2638 link->u.mgd.csa.blocked_tx = csa_ie.mode; in ieee80211_sta_process_chanswitch()
2639 sdata->csa_blocked_queues = in ieee80211_sta_process_chanswitch()
2640 csa_ie.mode && !ieee80211_hw_check(&local->hw, HANDLES_QUIET_CSA); in ieee80211_sta_process_chanswitch()
2642 wiphy_work_queue(sdata->local->hw.wiphy, in ieee80211_sta_process_chanswitch()
2643 &ifmgd->csa_connection_drop_work); in ieee80211_sta_process_chanswitch()
2654 int chan = ieee80211_frequency_to_channel(channel->center_freq); in ieee80211_find_80211h_pwr_constr()
2663 country_ie_len -= 3; in ieee80211_find_80211h_pwr_constr()
2665 switch (channel->band) { in ieee80211_find_80211h_pwr_constr()
2690 u8 first_channel = triplet->chans.first_channel; in ieee80211_find_80211h_pwr_constr()
2695 for (i = 0; i < triplet->chans.num_channels; i++) { in ieee80211_find_80211h_pwr_constr()
2698 *chan_pwr = triplet->chans.max_power; in ieee80211_find_80211h_pwr_constr()
2707 country_ie_len -= 3; in ieee80211_find_80211h_pwr_constr()
2725 * APs clearly state the range is -127 to 127 dBm, which indicates in ieee80211_find_cisco_dtpc()
2732 static u64 ieee80211_handle_pwr_constr(struct ieee80211_link_data *link, in ieee80211_handle_pwr_constr() argument
2739 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_handle_pwr_constr()
2744 __le16 capab = mgmt->u.probe_resp.capab_info; in ieee80211_handle_pwr_constr()
2746 if (ieee80211_is_s1g_beacon(mgmt->frame_control)) in ieee80211_handle_pwr_constr()
2756 max_t(int, 0, chan_pwr - pwr_reduction_80211h); in ieee80211_handle_pwr_constr()
2775 if (link->ap_power_level == new_ap_level) in ieee80211_handle_pwr_constr()
2779 "Limiting TX power to %d (%d - %d) dBm as advertised by %pM\n", in ieee80211_handle_pwr_constr()
2781 link->u.mgd.bssid); in ieee80211_handle_pwr_constr()
2785 if (link->ap_power_level == new_ap_level) in ieee80211_handle_pwr_constr()
2790 pwr_level_cisco, link->u.mgd.bssid); in ieee80211_handle_pwr_constr()
2793 link->ap_power_level = new_ap_level; in ieee80211_handle_pwr_constr()
2803 struct ieee80211_conf *conf = &local->hw.conf; in ieee80211_enable_ps()
2809 if (local->scanning) in ieee80211_enable_ps()
2812 if (conf->dynamic_ps_timeout > 0 && in ieee80211_enable_ps()
2813 !ieee80211_hw_check(&local->hw, SUPPORTS_DYNAMIC_PS)) { in ieee80211_enable_ps()
2814 mod_timer(&local->dynamic_ps_timer, jiffies + in ieee80211_enable_ps()
2815 msecs_to_jiffies(conf->dynamic_ps_timeout)); in ieee80211_enable_ps()
2817 if (ieee80211_hw_check(&local->hw, PS_NULLFUNC_STACK)) in ieee80211_enable_ps()
2820 if (ieee80211_hw_check(&local->hw, PS_NULLFUNC_STACK) && in ieee80211_enable_ps()
2821 ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) in ieee80211_enable_ps()
2824 conf->flags |= IEEE80211_CONF_PS; in ieee80211_enable_ps()
2831 struct ieee80211_conf *conf = &local->hw.conf; in ieee80211_change_ps()
2833 if (local->ps_sdata) { in ieee80211_change_ps()
2834 ieee80211_enable_ps(local, local->ps_sdata); in ieee80211_change_ps()
2835 } else if (conf->flags & IEEE80211_CONF_PS) { in ieee80211_change_ps()
2836 conf->flags &= ~IEEE80211_CONF_PS; in ieee80211_change_ps()
2838 del_timer_sync(&local->dynamic_ps_timer); in ieee80211_change_ps()
2839 wiphy_work_cancel(local->hw.wiphy, in ieee80211_change_ps()
2840 &local->dynamic_ps_enable_work); in ieee80211_change_ps()
2846 struct ieee80211_local *local = sdata->local; in ieee80211_powersave_allowed()
2847 struct ieee80211_if_managed *mgd = &sdata->u.mgd; in ieee80211_powersave_allowed()
2851 if (!mgd->powersave) in ieee80211_powersave_allowed()
2854 if (mgd->broken_ap) in ieee80211_powersave_allowed()
2857 if (!mgd->associated) in ieee80211_powersave_allowed()
2860 if (mgd->flags & IEEE80211_STA_CONNECTION_POLL) in ieee80211_powersave_allowed()
2863 if (!(local->hw.wiphy->flags & WIPHY_FLAG_SUPPORTS_MLO) && in ieee80211_powersave_allowed()
2864 !sdata->deflink.u.mgd.have_beacon) in ieee80211_powersave_allowed()
2868 sta = sta_info_get(sdata, sdata->vif.cfg.ap_addr); in ieee80211_powersave_allowed()
2883 if (!ieee80211_hw_check(&local->hw, SUPPORTS_PS) || in ieee80211_recalc_ps()
2884 ieee80211_hw_check(&local->hw, SUPPORTS_DYNAMIC_PS)) { in ieee80211_recalc_ps()
2885 local->ps_sdata = NULL; in ieee80211_recalc_ps()
2889 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_recalc_ps()
2892 if (sdata->vif.type == NL80211_IFTYPE_AP) { in ieee80211_recalc_ps()
2900 if (sdata->vif.type != NL80211_IFTYPE_STATION) in ieee80211_recalc_ps()
2907 u8 dtimper = found->deflink.u.mgd.dtim_period; in ieee80211_recalc_ps()
2909 timeout = local->dynamic_ps_forced_timeout; in ieee80211_recalc_ps()
2912 local->hw.conf.dynamic_ps_timeout = timeout; in ieee80211_recalc_ps()
2918 local->hw.conf.ps_dtim_period = dtimper; in ieee80211_recalc_ps()
2919 local->ps_sdata = found; in ieee80211_recalc_ps()
2921 local->ps_sdata = NULL; in ieee80211_recalc_ps()
2931 if (sdata->vif.cfg.ps != ps_allowed) { in ieee80211_recalc_ps_vif()
2932 sdata->vif.cfg.ps = ps_allowed; in ieee80211_recalc_ps_vif()
2944 if (local->hw.conf.flags & IEEE80211_CONF_PS) { in ieee80211_dynamic_ps_disable_work()
2945 local->hw.conf.flags &= ~IEEE80211_CONF_PS; in ieee80211_dynamic_ps_disable_work()
2949 ieee80211_wake_queues_by_reason(&local->hw, in ieee80211_dynamic_ps_disable_work()
2961 struct ieee80211_sub_if_data *sdata = local->ps_sdata; in ieee80211_dynamic_ps_enable_work()
2970 ifmgd = &sdata->u.mgd; in ieee80211_dynamic_ps_enable_work()
2972 if (local->hw.conf.flags & IEEE80211_CONF_PS) in ieee80211_dynamic_ps_enable_work()
2975 if (local->hw.conf.dynamic_ps_timeout > 0) { in ieee80211_dynamic_ps_enable_work()
2978 mod_timer(&local->dynamic_ps_timer, jiffies + in ieee80211_dynamic_ps_enable_work()
2980 local->hw.conf.dynamic_ps_timeout)); in ieee80211_dynamic_ps_enable_work()
2989 spin_lock_irqsave(&local->queue_stop_reason_lock, flags); in ieee80211_dynamic_ps_enable_work()
2990 for (q = 0; q < local->hw.queues; q++) { in ieee80211_dynamic_ps_enable_work()
2991 if (local->queue_stop_reasons[q]) { in ieee80211_dynamic_ps_enable_work()
2992 spin_unlock_irqrestore(&local->queue_stop_reason_lock, in ieee80211_dynamic_ps_enable_work()
2994 mod_timer(&local->dynamic_ps_timer, jiffies + in ieee80211_dynamic_ps_enable_work()
2996 local->hw.conf.dynamic_ps_timeout)); in ieee80211_dynamic_ps_enable_work()
3000 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); in ieee80211_dynamic_ps_enable_work()
3003 if (ieee80211_hw_check(&local->hw, PS_NULLFUNC_STACK) && in ieee80211_dynamic_ps_enable_work()
3004 !(ifmgd->flags & IEEE80211_STA_NULLFUNC_ACKED)) { in ieee80211_dynamic_ps_enable_work()
3006 mod_timer(&local->dynamic_ps_timer, jiffies + in ieee80211_dynamic_ps_enable_work()
3008 local->hw.conf.dynamic_ps_timeout)); in ieee80211_dynamic_ps_enable_work()
3016 if (!(ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS) && in ieee80211_dynamic_ps_enable_work()
3017 ieee80211_hw_check(&local->hw, PS_NULLFUNC_STACK)) || in ieee80211_dynamic_ps_enable_work()
3018 (ifmgd->flags & IEEE80211_STA_NULLFUNC_ACKED)) { in ieee80211_dynamic_ps_enable_work()
3019 ifmgd->flags &= ~IEEE80211_STA_NULLFUNC_ACKED; in ieee80211_dynamic_ps_enable_work()
3020 local->hw.conf.flags |= IEEE80211_CONF_PS; in ieee80211_dynamic_ps_enable_work()
3029 wiphy_work_queue(local->hw.wiphy, &local->dynamic_ps_enable_work); in ieee80211_dynamic_ps_timer()
3034 struct ieee80211_link_data *link = in ieee80211_dfs_cac_timer_work() local
3037 struct cfg80211_chan_def chandef = link->conf->chanreq.oper; in ieee80211_dfs_cac_timer_work()
3038 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_dfs_cac_timer_work()
3040 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_dfs_cac_timer_work()
3042 if (sdata->wdev.links[link->link_id].cac_started) { in ieee80211_dfs_cac_timer_work()
3043 ieee80211_link_release_channel(link); in ieee80211_dfs_cac_timer_work()
3044 cfg80211_cac_event(sdata->dev, &chandef, in ieee80211_dfs_cac_timer_work()
3046 GFP_KERNEL, link->link_id); in ieee80211_dfs_cac_timer_work()
3053 struct ieee80211_local *local = sdata->local; in __ieee80211_sta_handle_tspec_ac_params()
3054 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in __ieee80211_sta_handle_tspec_ac_params()
3056 int ac; in __ieee80211_sta_handle_tspec_ac_params() local
3058 if (local->hw.queues < IEEE80211_NUM_ACS) in __ieee80211_sta_handle_tspec_ac_params()
3061 for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { in __ieee80211_sta_handle_tspec_ac_params()
3062 struct ieee80211_sta_tx_tspec *tx_tspec = &ifmgd->tx_tspec[ac]; in __ieee80211_sta_handle_tspec_ac_params()
3066 if (tx_tspec->action == TX_TSPEC_ACTION_NONE && in __ieee80211_sta_handle_tspec_ac_params()
3067 tx_tspec->admitted_time && in __ieee80211_sta_handle_tspec_ac_params()
3068 time_after(now, tx_tspec->time_slice_start + HZ)) { in __ieee80211_sta_handle_tspec_ac_params()
3069 tx_tspec->consumed_tx_time = 0; in __ieee80211_sta_handle_tspec_ac_params()
3070 tx_tspec->time_slice_start = now; in __ieee80211_sta_handle_tspec_ac_params()
3072 if (tx_tspec->downgraded) in __ieee80211_sta_handle_tspec_ac_params()
3073 tx_tspec->action = in __ieee80211_sta_handle_tspec_ac_params()
3077 switch (tx_tspec->action) { in __ieee80211_sta_handle_tspec_ac_params()
3080 if (drv_conf_tx(local, &sdata->deflink, ac, in __ieee80211_sta_handle_tspec_ac_params()
3081 &sdata->deflink.tx_conf[ac])) in __ieee80211_sta_handle_tspec_ac_params()
3082 link_err(&sdata->deflink, in __ieee80211_sta_handle_tspec_ac_params()
3084 ac); in __ieee80211_sta_handle_tspec_ac_params()
3085 tx_tspec->action = TX_TSPEC_ACTION_NONE; in __ieee80211_sta_handle_tspec_ac_params()
3086 tx_tspec->downgraded = false; in __ieee80211_sta_handle_tspec_ac_params()
3090 if (time_after(now, tx_tspec->time_slice_start + HZ)) { in __ieee80211_sta_handle_tspec_ac_params()
3091 tx_tspec->action = TX_TSPEC_ACTION_NONE; in __ieee80211_sta_handle_tspec_ac_params()
3095 /* downgrade next lower non-ACM AC */ in __ieee80211_sta_handle_tspec_ac_params()
3096 for (non_acm_ac = ac + 1; in __ieee80211_sta_handle_tspec_ac_params()
3099 if (!(sdata->wmm_acm & BIT(7 - 2 * non_acm_ac))) in __ieee80211_sta_handle_tspec_ac_params()
3103 * makes no sense and we have to transmit somehow - the in __ieee80211_sta_handle_tspec_ac_params()
3104 * AC selection does the same thing. in __ieee80211_sta_handle_tspec_ac_params()
3110 if (drv_conf_tx(local, &sdata->deflink, ac, in __ieee80211_sta_handle_tspec_ac_params()
3111 &sdata->deflink.tx_conf[non_acm_ac])) in __ieee80211_sta_handle_tspec_ac_params()
3112 link_err(&sdata->deflink, in __ieee80211_sta_handle_tspec_ac_params()
3114 ac); in __ieee80211_sta_handle_tspec_ac_params()
3115 tx_tspec->action = TX_TSPEC_ACTION_NONE; in __ieee80211_sta_handle_tspec_ac_params()
3117 wiphy_delayed_work_queue(local->hw.wiphy, in __ieee80211_sta_handle_tspec_ac_params()
3118 &ifmgd->tx_tspec_wk, in __ieee80211_sta_handle_tspec_ac_params()
3119 tx_tspec->time_slice_start + in __ieee80211_sta_handle_tspec_ac_params()
3120 HZ - now + 1); in __ieee80211_sta_handle_tspec_ac_params()
3134 ieee80211_link_info_change_notify(sdata, &sdata->deflink, in ieee80211_sta_handle_tspec_ac_params()
3148 void ieee80211_mgd_set_link_qos_params(struct ieee80211_link_data *link) in ieee80211_mgd_set_link_qos_params() argument
3150 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_mgd_set_link_qos_params()
3151 struct ieee80211_local *local = sdata->local; in ieee80211_mgd_set_link_qos_params()
3152 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_mgd_set_link_qos_params()
3153 struct ieee80211_tx_queue_params *params = link->tx_conf; in ieee80211_mgd_set_link_qos_params()
3154 u8 ac; in ieee80211_mgd_set_link_qos_params() local
3156 for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { in ieee80211_mgd_set_link_qos_params()
3158 "WMM AC=%d acm=%d aifs=%d cWmin=%d cWmax=%d txop=%d uapsd=%d, downgraded=%d\n", in ieee80211_mgd_set_link_qos_params()
3159 ac, params[ac].acm, in ieee80211_mgd_set_link_qos_params()
3160 params[ac].aifs, params[ac].cw_min, params[ac].cw_max, in ieee80211_mgd_set_link_qos_params()
3161 params[ac].txop, params[ac].uapsd, in ieee80211_mgd_set_link_qos_params()
3162 ifmgd->tx_tspec[ac].downgraded); in ieee80211_mgd_set_link_qos_params()
3163 if (!ifmgd->tx_tspec[ac].downgraded && in ieee80211_mgd_set_link_qos_params()
3164 drv_conf_tx(local, link, ac, ¶ms[ac])) in ieee80211_mgd_set_link_qos_params()
3165 link_err(link, in ieee80211_mgd_set_link_qos_params()
3166 "failed to set TX queue parameters for AC %d\n", in ieee80211_mgd_set_link_qos_params()
3167 ac); in ieee80211_mgd_set_link_qos_params()
3174 struct ieee80211_link_data *link, in ieee80211_sta_wmm_params() argument
3178 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_sta_wmm_params()
3180 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_sta_wmm_params()
3182 int count, mu_edca_count, ac; in ieee80211_sta_wmm_params() local
3186 if (!local->ops->conf_tx) in ieee80211_sta_wmm_params()
3189 if (local->hw.queues < IEEE80211_NUM_ACS) in ieee80211_sta_wmm_params()
3198 if (ifmgd->flags & IEEE80211_STA_UAPSD_ENABLED) in ieee80211_sta_wmm_params()
3199 uapsd_queues = ifmgd->uapsd_queues; in ieee80211_sta_wmm_params()
3202 /* -1 is the initial value of ifmgd->mu_edca_last_param_set. in ieee80211_sta_wmm_params()
3206 mu_edca_count = mu_edca ? mu_edca->mu_qos_info & 0x0f : -1; in ieee80211_sta_wmm_params()
3207 if (count == link->u.mgd.wmm_last_param_set && in ieee80211_sta_wmm_params()
3208 mu_edca_count == link->u.mgd.mu_edca_last_param_set) in ieee80211_sta_wmm_params()
3210 link->u.mgd.wmm_last_param_set = count; in ieee80211_sta_wmm_params()
3211 link->u.mgd.mu_edca_last_param_set = mu_edca_count; in ieee80211_sta_wmm_params()
3214 left = wmm_param_len - 8; in ieee80211_sta_wmm_params()
3218 sdata->wmm_acm = 0; in ieee80211_sta_wmm_params()
3219 for (; left >= 4; left -= 4, pos += 4) { in ieee80211_sta_wmm_params()
3226 ac = IEEE80211_AC_BK; in ieee80211_sta_wmm_params()
3228 sdata->wmm_acm |= BIT(1) | BIT(2); /* BK/- */ in ieee80211_sta_wmm_params()
3231 params[ac].mu_edca = !!mu_edca; in ieee80211_sta_wmm_params()
3233 params[ac].mu_edca_param_rec = mu_edca->ac_bk; in ieee80211_sta_wmm_params()
3236 ac = IEEE80211_AC_VI; in ieee80211_sta_wmm_params()
3238 sdata->wmm_acm |= BIT(4) | BIT(5); /* CL/VI */ in ieee80211_sta_wmm_params()
3241 params[ac].mu_edca = !!mu_edca; in ieee80211_sta_wmm_params()
3243 params[ac].mu_edca_param_rec = mu_edca->ac_vi; in ieee80211_sta_wmm_params()
3246 ac = IEEE80211_AC_VO; in ieee80211_sta_wmm_params()
3248 sdata->wmm_acm |= BIT(6) | BIT(7); /* VO/NC */ in ieee80211_sta_wmm_params()
3251 params[ac].mu_edca = !!mu_edca; in ieee80211_sta_wmm_params()
3253 params[ac].mu_edca_param_rec = mu_edca->ac_vo; in ieee80211_sta_wmm_params()
3257 ac = IEEE80211_AC_BE; in ieee80211_sta_wmm_params()
3259 sdata->wmm_acm |= BIT(0) | BIT(3); /* BE/EE */ in ieee80211_sta_wmm_params()
3262 params[ac].mu_edca = !!mu_edca; in ieee80211_sta_wmm_params()
3264 params[ac].mu_edca_param_rec = mu_edca->ac_be; in ieee80211_sta_wmm_params()
3268 params[ac].aifs = pos[0] & 0x0f; in ieee80211_sta_wmm_params()
3270 if (params[ac].aifs < 2) { in ieee80211_sta_wmm_params()
3271 link_info(link, in ieee80211_sta_wmm_params()
3273 params[ac].aifs, aci); in ieee80211_sta_wmm_params()
3274 params[ac].aifs = 2; in ieee80211_sta_wmm_params()
3276 params[ac].cw_max = ecw2cw((pos[1] & 0xf0) >> 4); in ieee80211_sta_wmm_params()
3277 params[ac].cw_min = ecw2cw(pos[1] & 0x0f); in ieee80211_sta_wmm_params()
3278 params[ac].txop = get_unaligned_le16(pos + 2); in ieee80211_sta_wmm_params()
3279 params[ac].acm = acm; in ieee80211_sta_wmm_params()
3280 params[ac].uapsd = uapsd; in ieee80211_sta_wmm_params()
3282 if (params[ac].cw_min == 0 || in ieee80211_sta_wmm_params()
3283 params[ac].cw_min > params[ac].cw_max) { in ieee80211_sta_wmm_params()
3284 link_info(link, in ieee80211_sta_wmm_params()
3286 params[ac].cw_min, params[ac].cw_max, aci); in ieee80211_sta_wmm_params()
3289 ieee80211_regulatory_limit_wmm_params(sdata, ¶ms[ac], ac); in ieee80211_sta_wmm_params()
3293 for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { in ieee80211_sta_wmm_params()
3294 if (params[ac].cw_min == 0) { in ieee80211_sta_wmm_params()
3295 link_info(link, in ieee80211_sta_wmm_params()
3296 "AP has invalid WMM params (missing AC %d), using defaults\n", in ieee80211_sta_wmm_params()
3297 ac); in ieee80211_sta_wmm_params()
3302 for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) in ieee80211_sta_wmm_params()
3303 link->tx_conf[ac] = params[ac]; in ieee80211_sta_wmm_params()
3305 ieee80211_mgd_set_link_qos_params(link); in ieee80211_sta_wmm_params()
3308 link->conf->qos = true; in ieee80211_sta_wmm_params()
3314 lockdep_assert_wiphy(sdata->local->hw.wiphy); in __ieee80211_stop_poll()
3316 sdata->u.mgd.flags &= ~IEEE80211_STA_CONNECTION_POLL; in __ieee80211_stop_poll()
3317 ieee80211_run_deferred_scan(sdata->local); in __ieee80211_stop_poll()
3322 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_stop_poll()
3327 static u64 ieee80211_handle_bss_capability(struct ieee80211_link_data *link, in ieee80211_handle_bss_capability() argument
3330 struct ieee80211_bss_conf *bss_conf = link->conf; in ieee80211_handle_bss_capability()
3337 sband = ieee80211_get_link_sband(link); in ieee80211_handle_bss_capability()
3350 if (sband->band == NL80211_BAND_5GHZ || in ieee80211_handle_bss_capability()
3351 sband->band == NL80211_BAND_6GHZ) in ieee80211_handle_bss_capability()
3354 if (use_protection != bss_conf->use_cts_prot) { in ieee80211_handle_bss_capability()
3355 bss_conf->use_cts_prot = use_protection; in ieee80211_handle_bss_capability()
3359 if (use_short_preamble != bss_conf->use_short_preamble) { in ieee80211_handle_bss_capability()
3360 bss_conf->use_short_preamble = use_short_preamble; in ieee80211_handle_bss_capability()
3364 if (use_short_slot != bss_conf->use_short_slot) { in ieee80211_handle_bss_capability()
3365 bss_conf->use_short_slot = use_short_slot; in ieee80211_handle_bss_capability()
3372 static u64 ieee80211_link_set_associated(struct ieee80211_link_data *link, in ieee80211_link_set_associated() argument
3375 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_link_set_associated()
3376 struct ieee80211_bss_conf *bss_conf = link->conf; in ieee80211_link_set_associated()
3377 struct ieee80211_bss *bss = (void *)cbss->priv; in ieee80211_link_set_associated()
3381 sdata->u.mgd.beacon_timeout = in ieee80211_link_set_associated()
3383 bss_conf->beacon_int)); in ieee80211_link_set_associated()
3385 changed |= ieee80211_handle_bss_capability(link, in ieee80211_link_set_associated()
3386 bss_conf->assoc_capability, in ieee80211_link_set_associated()
3387 bss->has_erp_value, in ieee80211_link_set_associated()
3388 bss->erp_value); in ieee80211_link_set_associated()
3390 ieee80211_check_rate_mask(link); in ieee80211_link_set_associated()
3392 link->conf->bss = cbss; in ieee80211_link_set_associated()
3393 memcpy(link->u.mgd.bssid, cbss->bssid, ETH_ALEN); in ieee80211_link_set_associated()
3395 if (sdata->vif.p2p || in ieee80211_link_set_associated()
3396 sdata->vif.driver_flags & IEEE80211_VIF_GET_NOA_UPDATE) { in ieee80211_link_set_associated()
3400 ies = rcu_dereference(cbss->ies); in ieee80211_link_set_associated()
3405 ies->data, ies->len, in ieee80211_link_set_associated()
3407 (u8 *) &bss_conf->p2p_noa_attr, in ieee80211_link_set_associated()
3408 sizeof(bss_conf->p2p_noa_attr)); in ieee80211_link_set_associated()
3410 link->u.mgd.p2p_noa_index = in ieee80211_link_set_associated()
3411 bss_conf->p2p_noa_attr.index; in ieee80211_link_set_associated()
3418 if (link->u.mgd.have_beacon) { in ieee80211_link_set_associated()
3419 bss_conf->beacon_rate = bss->beacon_rate; in ieee80211_link_set_associated()
3422 bss_conf->beacon_rate = NULL; in ieee80211_link_set_associated()
3426 if (sdata->vif.driver_flags & IEEE80211_VIF_SUPPORTS_CQM_RSSI && in ieee80211_link_set_associated()
3427 bss_conf->cqm_rssi_thold) in ieee80211_link_set_associated()
3437 struct ieee80211_local *local = sdata->local; in ieee80211_set_associated()
3438 struct ieee80211_vif_cfg *vif_cfg = &sdata->vif.cfg; in ieee80211_set_associated()
3442 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_set_associated()
3444 sdata->u.mgd.associated = true; in ieee80211_set_associated()
3447 struct cfg80211_bss *cbss = assoc_data->link[link_id].bss; in ieee80211_set_associated()
3448 struct ieee80211_link_data *link; in ieee80211_set_associated() local
3451 assoc_data->link[link_id].status != WLAN_STATUS_SUCCESS) in ieee80211_set_associated()
3454 if (ieee80211_vif_is_mld(&sdata->vif) && in ieee80211_set_associated()
3455 !(ieee80211_vif_usable_links(&sdata->vif) & BIT(link_id))) in ieee80211_set_associated()
3458 link = sdata_dereference(sdata->link[link_id], sdata); in ieee80211_set_associated()
3459 if (WARN_ON(!link)) in ieee80211_set_associated()
3462 changed[link_id] |= ieee80211_link_set_associated(link, cbss); in ieee80211_set_associated()
3470 vif_cfg->assoc = 1; in ieee80211_set_associated()
3473 if (vif_cfg->arp_addr_cnt) in ieee80211_set_associated()
3476 if (ieee80211_vif_is_mld(&sdata->vif)) { in ieee80211_set_associated()
3480 struct ieee80211_link_data *link; in ieee80211_set_associated() local
3481 struct cfg80211_bss *cbss = assoc_data->link[link_id].bss; in ieee80211_set_associated()
3485 ieee80211_vif_usable_links(&sdata->vif)) || in ieee80211_set_associated()
3486 assoc_data->link[link_id].status != WLAN_STATUS_SUCCESS) in ieee80211_set_associated()
3489 link = sdata_dereference(sdata->link[link_id], sdata); in ieee80211_set_associated()
3490 if (WARN_ON(!link)) in ieee80211_set_associated()
3493 ieee80211_link_info_change_notify(sdata, link, in ieee80211_set_associated()
3496 ieee80211_recalc_smps(sdata, link); in ieee80211_set_associated()
3507 /* leave this here to not change ordering in non-MLO cases */ in ieee80211_set_associated()
3508 if (!ieee80211_vif_is_mld(&sdata->vif)) in ieee80211_set_associated()
3509 ieee80211_recalc_smps(sdata, &sdata->deflink); in ieee80211_set_associated()
3512 netif_carrier_on(sdata->dev); in ieee80211_set_associated()
3519 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_set_disassoc()
3520 struct ieee80211_local *local = sdata->local; in ieee80211_set_disassoc()
3526 .link_id = ffs(sdata->vif.active_links) - 1, in ieee80211_set_disassoc()
3529 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_set_disassoc()
3534 if (WARN_ON(!ifmgd->associated)) in ieee80211_set_disassoc()
3539 ifmgd->associated = false; in ieee80211_set_disassoc()
3542 sdata->deflink.conf->bss = NULL; in ieee80211_set_disassoc()
3543 sdata->deflink.smps_mode = IEEE80211_SMPS_OFF; in ieee80211_set_disassoc()
3545 netif_carrier_off(sdata->dev); in ieee80211_set_disassoc()
3549 * to do it before sending disassoc, as otherwise the null-packet in ieee80211_set_disassoc()
3552 if (local->hw.conf.flags & IEEE80211_CONF_PS) { in ieee80211_set_disassoc()
3553 local->hw.conf.flags &= ~IEEE80211_CONF_PS; in ieee80211_set_disassoc()
3556 local->ps_sdata = NULL; in ieee80211_set_disassoc()
3558 /* disable per-vif ps */ in ieee80211_set_disassoc()
3575 drv_mgd_prepare_tx(sdata->local, sdata, &info); in ieee80211_set_disassoc()
3577 ieee80211_send_deauth_disassoc(sdata, sdata->vif.cfg.ap_addr, in ieee80211_set_disassoc()
3578 sdata->vif.cfg.ap_addr, stype, in ieee80211_set_disassoc()
3582 /* flush out frame - make sure the deauth was actually sent */ in ieee80211_set_disassoc()
3586 drv_mgd_complete_tx(sdata->local, sdata, &info); in ieee80211_set_disassoc()
3589 eth_zero_addr(sdata->deflink.u.mgd.bssid); in ieee80211_set_disassoc()
3590 eth_zero_addr(sdata->vif.cfg.ap_addr); in ieee80211_set_disassoc()
3592 sdata->vif.cfg.ssid_len = 0; in ieee80211_set_disassoc()
3595 sta_info_flush(sdata, -1); in ieee80211_set_disassoc()
3598 if (!ieee80211_vif_is_mld(&sdata->vif)) in ieee80211_set_disassoc()
3603 sdata->vif.cfg.assoc = false; in ieee80211_set_disassoc()
3605 sdata->deflink.u.mgd.p2p_noa_index = -1; in ieee80211_set_disassoc()
3606 memset(&sdata->vif.bss_conf.p2p_noa_attr, 0, in ieee80211_set_disassoc()
3607 sizeof(sdata->vif.bss_conf.p2p_noa_attr)); in ieee80211_set_disassoc()
3609 /* on the next assoc, re-program HT/VHT parameters */ in ieee80211_set_disassoc()
3610 memset(&ifmgd->ht_capa, 0, sizeof(ifmgd->ht_capa)); in ieee80211_set_disassoc()
3611 memset(&ifmgd->ht_capa_mask, 0, sizeof(ifmgd->ht_capa_mask)); in ieee80211_set_disassoc()
3612 memset(&ifmgd->vht_capa, 0, sizeof(ifmgd->vht_capa)); in ieee80211_set_disassoc()
3613 memset(&ifmgd->vht_capa_mask, 0, sizeof(ifmgd->vht_capa_mask)); in ieee80211_set_disassoc()
3616 * reset MU-MIMO ownership and group data in default link, in ieee80211_set_disassoc()
3619 memset(sdata->vif.bss_conf.mu_group.membership, 0, in ieee80211_set_disassoc()
3620 sizeof(sdata->vif.bss_conf.mu_group.membership)); in ieee80211_set_disassoc()
3621 memset(sdata->vif.bss_conf.mu_group.position, 0, in ieee80211_set_disassoc()
3622 sizeof(sdata->vif.bss_conf.mu_group.position)); in ieee80211_set_disassoc()
3623 if (!ieee80211_vif_is_mld(&sdata->vif)) in ieee80211_set_disassoc()
3625 sdata->vif.bss_conf.mu_mimo_owner = false; in ieee80211_set_disassoc()
3627 sdata->deflink.ap_power_level = IEEE80211_UNSET_POWER_LEVEL; in ieee80211_set_disassoc()
3629 del_timer_sync(&local->dynamic_ps_timer); in ieee80211_set_disassoc()
3630 wiphy_work_cancel(local->hw.wiphy, &local->dynamic_ps_enable_work); in ieee80211_set_disassoc()
3633 if (sdata->vif.cfg.arp_addr_cnt) in ieee80211_set_disassoc()
3636 sdata->vif.bss_conf.qos = false; in ieee80211_set_disassoc()
3637 if (!ieee80211_vif_is_mld(&sdata->vif)) { in ieee80211_set_disassoc()
3646 /* disassociated - set to defaults now */ in ieee80211_set_disassoc()
3647 ieee80211_set_wmm_default(&sdata->deflink, false, false); in ieee80211_set_disassoc()
3649 del_timer_sync(&sdata->u.mgd.conn_mon_timer); in ieee80211_set_disassoc()
3650 del_timer_sync(&sdata->u.mgd.bcn_mon_timer); in ieee80211_set_disassoc()
3651 del_timer_sync(&sdata->u.mgd.timer); in ieee80211_set_disassoc()
3653 sdata->vif.bss_conf.dtim_period = 0; in ieee80211_set_disassoc()
3654 sdata->vif.bss_conf.beacon_rate = NULL; in ieee80211_set_disassoc()
3656 sdata->deflink.u.mgd.have_beacon = false; in ieee80211_set_disassoc()
3657 sdata->deflink.u.mgd.tracking_signal_avg = false; in ieee80211_set_disassoc()
3658 sdata->deflink.u.mgd.disable_wmm_tracking = false; in ieee80211_set_disassoc()
3660 ifmgd->flags = 0; in ieee80211_set_disassoc()
3662 for (link_id = 0; link_id < ARRAY_SIZE(sdata->link); link_id++) { in ieee80211_set_disassoc()
3663 struct ieee80211_link_data *link; in ieee80211_set_disassoc() local
3665 link = sdata_dereference(sdata->link[link_id], sdata); in ieee80211_set_disassoc()
3666 if (!link) in ieee80211_set_disassoc()
3668 ieee80211_link_release_channel(link); in ieee80211_set_disassoc()
3671 sdata->vif.bss_conf.csa_active = false; in ieee80211_set_disassoc()
3672 sdata->deflink.u.mgd.csa.blocked_tx = false; in ieee80211_set_disassoc()
3673 sdata->deflink.u.mgd.csa.waiting_bcn = false; in ieee80211_set_disassoc()
3674 sdata->deflink.u.mgd.csa.ignored_same_chan = false; in ieee80211_set_disassoc()
3678 memset(ifmgd->tx_tspec, 0, sizeof(ifmgd->tx_tspec)); in ieee80211_set_disassoc()
3679 wiphy_delayed_work_cancel(local->hw.wiphy, &ifmgd->tx_tspec_wk); in ieee80211_set_disassoc()
3681 sdata->vif.bss_conf.power_type = IEEE80211_REG_UNSET_AP; in ieee80211_set_disassoc()
3682 sdata->vif.bss_conf.pwr_reduction = 0; in ieee80211_set_disassoc()
3683 ieee80211_clear_tpe(&sdata->vif.bss_conf.tpe); in ieee80211_set_disassoc()
3685 sdata->vif.cfg.eml_cap = 0; in ieee80211_set_disassoc()
3686 sdata->vif.cfg.eml_med_sync_delay = 0; in ieee80211_set_disassoc()
3687 sdata->vif.cfg.mld_capa_op = 0; in ieee80211_set_disassoc()
3689 memset(&sdata->u.mgd.ttlm_info, 0, in ieee80211_set_disassoc()
3690 sizeof(sdata->u.mgd.ttlm_info)); in ieee80211_set_disassoc()
3691 wiphy_delayed_work_cancel(sdata->local->hw.wiphy, &ifmgd->ttlm_work); in ieee80211_set_disassoc()
3693 memset(&sdata->vif.neg_ttlm, 0, sizeof(sdata->vif.neg_ttlm)); in ieee80211_set_disassoc()
3694 wiphy_delayed_work_cancel(sdata->local->hw.wiphy, in ieee80211_set_disassoc()
3695 &ifmgd->neg_ttlm_timeout_work); in ieee80211_set_disassoc()
3697 sdata->u.mgd.removed_links = 0; in ieee80211_set_disassoc()
3698 wiphy_delayed_work_cancel(sdata->local->hw.wiphy, in ieee80211_set_disassoc()
3699 &sdata->u.mgd.ml_reconf_work); in ieee80211_set_disassoc()
3701 wiphy_work_cancel(sdata->local->hw.wiphy, in ieee80211_set_disassoc()
3702 &ifmgd->teardown_ttlm_work); in ieee80211_set_disassoc()
3706 ifmgd->mcast_seq_last = IEEE80211_SN_MODULO; in ieee80211_set_disassoc()
3711 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_reset_ap_probe()
3712 struct ieee80211_local *local = sdata->local; in ieee80211_reset_ap_probe()
3714 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_reset_ap_probe()
3716 if (!(ifmgd->flags & IEEE80211_STA_CONNECTION_POLL)) in ieee80211_reset_ap_probe()
3723 if (ieee80211_hw_check(&sdata->local->hw, CONNECTION_MONITOR)) in ieee80211_reset_ap_probe()
3733 mod_timer(&ifmgd->conn_mon_timer, in ieee80211_reset_ap_probe()
3742 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_sta_tx_wmm_ac_notify()
3744 int ac; in ieee80211_sta_tx_wmm_ac_notify() local
3748 if (!ieee80211_is_data_qos(hdr->frame_control)) in ieee80211_sta_tx_wmm_ac_notify()
3752 ac = ieee80211_ac_from_tid(tid); in ieee80211_sta_tx_wmm_ac_notify()
3753 tx_tspec = &ifmgd->tx_tspec[ac]; in ieee80211_sta_tx_wmm_ac_notify()
3755 if (likely(!tx_tspec->admitted_time)) in ieee80211_sta_tx_wmm_ac_notify()
3758 if (time_after(now, tx_tspec->time_slice_start + HZ)) { in ieee80211_sta_tx_wmm_ac_notify()
3759 tx_tspec->consumed_tx_time = 0; in ieee80211_sta_tx_wmm_ac_notify()
3760 tx_tspec->time_slice_start = now; in ieee80211_sta_tx_wmm_ac_notify()
3762 if (tx_tspec->downgraded) { in ieee80211_sta_tx_wmm_ac_notify()
3763 tx_tspec->action = TX_TSPEC_ACTION_STOP_DOWNGRADE; in ieee80211_sta_tx_wmm_ac_notify()
3764 wiphy_delayed_work_queue(sdata->local->hw.wiphy, in ieee80211_sta_tx_wmm_ac_notify()
3765 &ifmgd->tx_tspec_wk, 0); in ieee80211_sta_tx_wmm_ac_notify()
3769 if (tx_tspec->downgraded) in ieee80211_sta_tx_wmm_ac_notify()
3772 tx_tspec->consumed_tx_time += tx_time; in ieee80211_sta_tx_wmm_ac_notify()
3774 if (tx_tspec->consumed_tx_time >= tx_tspec->admitted_time) { in ieee80211_sta_tx_wmm_ac_notify()
3775 tx_tspec->downgraded = true; in ieee80211_sta_tx_wmm_ac_notify()
3776 tx_tspec->action = TX_TSPEC_ACTION_DOWNGRADE; in ieee80211_sta_tx_wmm_ac_notify()
3777 wiphy_delayed_work_queue(sdata->local->hw.wiphy, in ieee80211_sta_tx_wmm_ac_notify()
3778 &ifmgd->tx_tspec_wk, 0); in ieee80211_sta_tx_wmm_ac_notify()
3787 if (!ieee80211_is_any_nullfunc(hdr->frame_control) || in ieee80211_sta_tx_notify()
3788 !sdata->u.mgd.probe_send_count) in ieee80211_sta_tx_notify()
3792 sdata->u.mgd.probe_send_count = 0; in ieee80211_sta_tx_notify()
3794 sdata->u.mgd.nullfunc_failed = true; in ieee80211_sta_tx_notify()
3795 wiphy_work_queue(sdata->local->hw.wiphy, &sdata->work); in ieee80211_sta_tx_notify()
3805 skb = ieee80211_build_probe_req(sdata, src, dst, (u32)-1, channel, in ieee80211_mlme_send_probe_req()
3814 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_mgd_probe_ap_send()
3815 u8 *dst = sdata->vif.cfg.ap_addr; in ieee80211_mgd_probe_ap_send()
3816 u8 unicast_limit = max(1, max_probe_tries - 3); in ieee80211_mgd_probe_ap_send()
3819 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_mgd_probe_ap_send()
3821 if (WARN_ON(ieee80211_vif_is_mld(&sdata->vif))) in ieee80211_mgd_probe_ap_send()
3829 if (ifmgd->probe_send_count >= unicast_limit) in ieee80211_mgd_probe_ap_send()
3839 ifmgd->probe_send_count++; in ieee80211_mgd_probe_ap_send()
3847 if (ieee80211_hw_check(&sdata->local->hw, REPORTS_TX_ACK_STATUS)) { in ieee80211_mgd_probe_ap_send()
3848 ifmgd->nullfunc_failed = false; in ieee80211_mgd_probe_ap_send()
3849 ieee80211_send_nullfunc(sdata->local, sdata, false); in ieee80211_mgd_probe_ap_send()
3851 ieee80211_mlme_send_probe_req(sdata, sdata->vif.addr, dst, in ieee80211_mgd_probe_ap_send()
3852 sdata->vif.cfg.ssid, in ieee80211_mgd_probe_ap_send()
3853 sdata->vif.cfg.ssid_len, in ieee80211_mgd_probe_ap_send()
3854 sdata->deflink.conf->bss->channel); in ieee80211_mgd_probe_ap_send()
3857 ifmgd->probe_timeout = jiffies + msecs_to_jiffies(probe_wait_ms); in ieee80211_mgd_probe_ap_send()
3858 run_again(sdata, ifmgd->probe_timeout); in ieee80211_mgd_probe_ap_send()
3864 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_mgd_probe_ap()
3867 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_mgd_probe_ap()
3869 if (WARN_ON_ONCE(ieee80211_vif_is_mld(&sdata->vif))) in ieee80211_mgd_probe_ap()
3875 if (!ifmgd->associated) in ieee80211_mgd_probe_ap()
3878 if (sdata->local->tmp_channel || sdata->local->scanning) in ieee80211_mgd_probe_ap()
3881 if (sdata->local->suspending) { in ieee80211_mgd_probe_ap()
3889 "detected beacon loss from AP (missed %d beacons) - probing\n", in ieee80211_mgd_probe_ap()
3892 ieee80211_cqm_beacon_loss_notify(&sdata->vif, GFP_KERNEL); in ieee80211_mgd_probe_ap()
3906 if (ifmgd->flags & IEEE80211_STA_CONNECTION_POLL) in ieee80211_mgd_probe_ap()
3909 ifmgd->flags |= IEEE80211_STA_CONNECTION_POLL; in ieee80211_mgd_probe_ap()
3914 ieee80211_recalc_ps(sdata->local); in ieee80211_mgd_probe_ap()
3916 ifmgd->probe_send_count = 0; in ieee80211_mgd_probe_ap()
3924 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_ap_probereq_get()
3930 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_ap_probereq_get()
3932 if (WARN_ON(sdata->vif.type != NL80211_IFTYPE_STATION || in ieee80211_ap_probereq_get()
3933 ieee80211_vif_is_mld(&sdata->vif))) in ieee80211_ap_probereq_get()
3936 if (ifmgd->associated) in ieee80211_ap_probereq_get()
3937 cbss = sdata->deflink.conf->bss; in ieee80211_ap_probereq_get()
3938 else if (ifmgd->auth_data) in ieee80211_ap_probereq_get()
3939 cbss = ifmgd->auth_data->bss; in ieee80211_ap_probereq_get()
3940 else if (ifmgd->assoc_data && ifmgd->assoc_data->link[0].bss) in ieee80211_ap_probereq_get()
3941 cbss = ifmgd->assoc_data->link[0].bss; in ieee80211_ap_probereq_get()
3947 if (WARN_ONCE(!ssid || ssid->datalen > IEEE80211_MAX_SSID_LEN, in ieee80211_ap_probereq_get()
3949 ssid ? ssid->datalen : -1)) in ieee80211_ap_probereq_get()
3952 ssid_len = ssid->datalen; in ieee80211_ap_probereq_get()
3954 skb = ieee80211_build_probe_req(sdata, sdata->vif.addr, cbss->bssid, in ieee80211_ap_probereq_get()
3955 (u32) -1, cbss->channel, in ieee80211_ap_probereq_get()
3956 ssid->data, ssid_len, in ieee80211_ap_probereq_get()
3975 cfg80211_tx_mlme_mgmt(sdata->dev, buf, len, reconnect); in ieee80211_report_disconnect()
3977 cfg80211_rx_mlme_mgmt(sdata->dev, buf, len); in ieee80211_report_disconnect()
3979 drv_event_callback(sdata->local, sdata, &event); in ieee80211_report_disconnect()
3984 struct ieee80211_local *local = sdata->local; in __ieee80211_disconnect()
3985 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in __ieee80211_disconnect()
3989 lockdep_assert_wiphy(local->hw.wiphy); in __ieee80211_disconnect()
3991 if (!ifmgd->associated) in __ieee80211_disconnect()
3994 /* only transmit if we have a link that makes that worthwhile */ in __ieee80211_disconnect()
3996 link_id < ARRAY_SIZE(sdata->link); in __ieee80211_disconnect()
3998 struct ieee80211_link_data *link; in __ieee80211_disconnect() local
4000 if (!ieee80211_vif_link_active(&sdata->vif, link_id)) in __ieee80211_disconnect()
4003 link = sdata_dereference(sdata->link[link_id], sdata); in __ieee80211_disconnect()
4004 if (WARN_ON_ONCE(!link)) in __ieee80211_disconnect()
4007 if (link->u.mgd.csa.blocked_tx) in __ieee80211_disconnect()
4014 if (!ifmgd->driver_disconnect) { in __ieee80211_disconnect()
4020 * of multi-link, it's not clear that all of them really are in __ieee80211_disconnect()
4022 * have switched to just have a single link active? in __ieee80211_disconnect()
4025 link_id < ARRAY_SIZE(sdata->link); in __ieee80211_disconnect()
4027 struct ieee80211_link_data *link; in __ieee80211_disconnect() local
4029 link = sdata_dereference(sdata->link[link_id], sdata); in __ieee80211_disconnect()
4030 if (!link) in __ieee80211_disconnect()
4032 cfg80211_unlink_bss(local->hw.wiphy, link->conf->bss); in __ieee80211_disconnect()
4033 link->conf->bss = NULL; in __ieee80211_disconnect()
4038 ifmgd->driver_disconnect ? in __ieee80211_disconnect()
4043 sdata->vif.bss_conf.csa_active = false; in __ieee80211_disconnect()
4044 sdata->deflink.u.mgd.csa.waiting_bcn = false; in __ieee80211_disconnect()
4045 sdata->deflink.u.mgd.csa.blocked_tx = false; in __ieee80211_disconnect()
4050 ifmgd->reconnect); in __ieee80211_disconnect()
4051 ifmgd->reconnect = false; in __ieee80211_disconnect()
4060 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_beacon_connection_loss_work()
4062 if (ifmgd->connection_loss) { in ieee80211_beacon_connection_loss_work()
4064 sdata->vif.cfg.ap_addr); in ieee80211_beacon_connection_loss_work()
4066 ifmgd->connection_loss = false; in ieee80211_beacon_connection_loss_work()
4067 } else if (ifmgd->driver_disconnect) { in ieee80211_beacon_connection_loss_work()
4070 sdata->vif.cfg.ap_addr); in ieee80211_beacon_connection_loss_work()
4072 ifmgd->driver_disconnect = false; in ieee80211_beacon_connection_loss_work()
4074 if (ifmgd->associated) in ieee80211_beacon_connection_loss_work()
4075 sdata->deflink.u.mgd.beacon_loss_count++; in ieee80211_beacon_connection_loss_work()
4093 struct ieee80211_hw *hw = &sdata->local->hw; in ieee80211_beacon_loss()
4097 sdata->u.mgd.connection_loss = false; in ieee80211_beacon_loss()
4098 wiphy_work_queue(hw->wiphy, &sdata->u.mgd.beacon_connection_loss_work); in ieee80211_beacon_loss()
4105 struct ieee80211_hw *hw = &sdata->local->hw; in ieee80211_connection_loss()
4109 sdata->u.mgd.connection_loss = true; in ieee80211_connection_loss()
4110 wiphy_work_queue(hw->wiphy, &sdata->u.mgd.beacon_connection_loss_work); in ieee80211_connection_loss()
4117 struct ieee80211_hw *hw = &sdata->local->hw; in ieee80211_disconnect()
4121 if (WARN_ON(sdata->vif.type != NL80211_IFTYPE_STATION)) in ieee80211_disconnect()
4124 sdata->u.mgd.driver_disconnect = true; in ieee80211_disconnect()
4125 sdata->u.mgd.reconnect = reconnect; in ieee80211_disconnect()
4126 wiphy_work_queue(hw->wiphy, &sdata->u.mgd.beacon_connection_loss_work); in ieee80211_disconnect()
4133 struct ieee80211_mgd_auth_data *auth_data = sdata->u.mgd.auth_data; in ieee80211_destroy_auth_data()
4135 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_destroy_auth_data()
4143 del_timer_sync(&sdata->u.mgd.timer); in ieee80211_destroy_auth_data()
4144 sta_info_destroy_addr(sdata, auth_data->ap_addr); in ieee80211_destroy_auth_data()
4147 eth_zero_addr(sdata->deflink.u.mgd.bssid); in ieee80211_destroy_auth_data()
4148 ieee80211_link_info_change_notify(sdata, &sdata->deflink, in ieee80211_destroy_auth_data()
4150 sdata->u.mgd.flags = 0; in ieee80211_destroy_auth_data()
4152 ieee80211_link_release_channel(&sdata->deflink); in ieee80211_destroy_auth_data()
4156 cfg80211_put_bss(sdata->local->hw.wiphy, auth_data->bss); in ieee80211_destroy_auth_data()
4158 sdata->u.mgd.auth_data = NULL; in ieee80211_destroy_auth_data()
4171 struct ieee80211_mgd_assoc_data *assoc_data = sdata->u.mgd.assoc_data; in ieee80211_destroy_assoc_data()
4173 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_destroy_assoc_data()
4181 del_timer_sync(&sdata->u.mgd.timer); in ieee80211_destroy_assoc_data()
4182 sta_info_destroy_addr(sdata, assoc_data->ap_addr); in ieee80211_destroy_assoc_data()
4184 eth_zero_addr(sdata->deflink.u.mgd.bssid); in ieee80211_destroy_assoc_data()
4185 ieee80211_link_info_change_notify(sdata, &sdata->deflink, in ieee80211_destroy_assoc_data()
4187 sdata->u.mgd.flags = 0; in ieee80211_destroy_assoc_data()
4188 sdata->vif.bss_conf.mu_mimo_owner = false; in ieee80211_destroy_assoc_data()
4197 ARRAY_SIZE(assoc_data->link)); in ieee80211_destroy_assoc_data()
4200 data.bss[i] = assoc_data->link[i].bss; in ieee80211_destroy_assoc_data()
4202 if (ieee80211_vif_is_mld(&sdata->vif)) in ieee80211_destroy_assoc_data()
4203 data.ap_mld_addr = assoc_data->ap_addr; in ieee80211_destroy_assoc_data()
4205 cfg80211_assoc_failure(sdata->dev, &data); in ieee80211_destroy_assoc_data()
4208 ieee80211_link_release_channel(&sdata->deflink); in ieee80211_destroy_assoc_data()
4213 sdata->u.mgd.assoc_data = NULL; in ieee80211_destroy_assoc_data()
4219 struct ieee80211_local *local = sdata->local; in ieee80211_auth_challenge()
4220 struct ieee80211_mgd_auth_data *auth_data = sdata->u.mgd.auth_data; in ieee80211_auth_challenge()
4226 .link_id = auth_data->link_id, in ieee80211_auth_challenge()
4229 pos = mgmt->u.auth.variable; in ieee80211_auth_challenge()
4231 len - (pos - (u8 *)mgmt)); in ieee80211_auth_challenge()
4234 auth_data->expected_transaction = 4; in ieee80211_auth_challenge()
4235 drv_mgd_prepare_tx(sdata->local, sdata, &info); in ieee80211_auth_challenge()
4236 if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) in ieee80211_auth_challenge()
4239 ieee80211_send_auth(sdata, 3, auth_data->algorithm, 0, in ieee80211_auth_challenge()
4241 challenge->datalen + sizeof(*challenge), in ieee80211_auth_challenge()
4242 auth_data->ap_addr, auth_data->ap_addr, in ieee80211_auth_challenge()
4243 auth_data->key, auth_data->key_len, in ieee80211_auth_challenge()
4244 auth_data->key_idx, tx_flags); in ieee80211_auth_challenge()
4249 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_mark_sta_auth()
4250 const u8 *ap_addr = ifmgd->auth_data->ap_addr; in ieee80211_mark_sta_auth()
4253 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_mark_sta_auth()
4256 ifmgd->auth_data->done = true; in ieee80211_mark_sta_auth()
4257 ifmgd->auth_data->timeout = jiffies + IEEE80211_AUTH_WAIT_ASSOC; in ieee80211_mark_sta_auth()
4258 ifmgd->auth_data->timeout_started = true; in ieee80211_mark_sta_auth()
4259 run_again(sdata, ifmgd->auth_data->timeout); in ieee80211_mark_sta_auth()
4264 WARN_ONCE(1, "%s: STA %pM not found", sdata->name, ap_addr); in ieee80211_mark_sta_auth()
4278 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_rx_mgmt_auth()
4288 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_rx_mgmt_auth()
4293 if (!ifmgd->auth_data || ifmgd->auth_data->done) in ieee80211_rx_mgmt_auth()
4296 if (!ether_addr_equal(ifmgd->auth_data->ap_addr, mgmt->bssid)) in ieee80211_rx_mgmt_auth()
4299 auth_alg = le16_to_cpu(mgmt->u.auth.auth_alg); in ieee80211_rx_mgmt_auth()
4300 auth_transaction = le16_to_cpu(mgmt->u.auth.auth_transaction); in ieee80211_rx_mgmt_auth()
4301 status_code = le16_to_cpu(mgmt->u.auth.status_code); in ieee80211_rx_mgmt_auth()
4303 if (auth_alg != ifmgd->auth_data->algorithm || in ieee80211_rx_mgmt_auth()
4305 auth_transaction != ifmgd->auth_data->expected_transaction) || in ieee80211_rx_mgmt_auth()
4307 (auth_transaction < ifmgd->auth_data->expected_transaction || in ieee80211_rx_mgmt_auth()
4310 mgmt->sa, auth_alg, ifmgd->auth_data->algorithm, in ieee80211_rx_mgmt_auth()
4312 ifmgd->auth_data->expected_transaction); in ieee80211_rx_mgmt_auth()
4317 cfg80211_rx_mlme_mgmt(sdata->dev, (u8 *)mgmt, len); in ieee80211_rx_mgmt_auth()
4325 ifmgd->auth_data->waiting = true; in ieee80211_rx_mgmt_auth()
4326 ifmgd->auth_data->timeout = in ieee80211_rx_mgmt_auth()
4328 ifmgd->auth_data->timeout_started = true; in ieee80211_rx_mgmt_auth()
4329 run_again(sdata, ifmgd->auth_data->timeout); in ieee80211_rx_mgmt_auth()
4334 mgmt->sa, status_code); in ieee80211_rx_mgmt_auth()
4338 drv_event_callback(sdata->local, sdata, &event); in ieee80211_rx_mgmt_auth()
4342 switch (ifmgd->auth_data->algorithm) { in ieee80211_rx_mgmt_auth()
4352 if (ifmgd->auth_data->expected_transaction != 4) { in ieee80211_rx_mgmt_auth()
4360 ifmgd->auth_data->algorithm); in ieee80211_rx_mgmt_auth()
4366 drv_event_callback(sdata->local, sdata, &event); in ieee80211_rx_mgmt_auth()
4367 if (ifmgd->auth_data->algorithm != WLAN_AUTH_SAE || in ieee80211_rx_mgmt_auth()
4369 ifmgd->auth_data->expected_transaction == 2)) { in ieee80211_rx_mgmt_auth()
4371 return; /* ignore frame -- wait for timeout */ in ieee80211_rx_mgmt_auth()
4372 } else if (ifmgd->auth_data->algorithm == WLAN_AUTH_SAE && in ieee80211_rx_mgmt_auth()
4375 ifmgd->auth_data->peer_confirmed = true; in ieee80211_rx_mgmt_auth()
4378 cfg80211_rx_mlme_mgmt(sdata->dev, (u8 *)mgmt, len); in ieee80211_rx_mgmt_auth()
4380 drv_mgd_complete_tx(sdata->local, sdata, &info); in ieee80211_rx_mgmt_auth()
4443 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_rx_mgmt_deauth()
4444 u16 reason_code = le16_to_cpu(mgmt->u.deauth.reason_code); in ieee80211_rx_mgmt_deauth()
4446 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_rx_mgmt_deauth()
4451 if (!ether_addr_equal(mgmt->bssid, mgmt->sa)) { in ieee80211_rx_mgmt_deauth()
4452 ieee80211_tdls_handle_disconnect(sdata, mgmt->sa, reason_code); in ieee80211_rx_mgmt_deauth()
4456 if (ifmgd->associated && in ieee80211_rx_mgmt_deauth()
4457 ether_addr_equal(mgmt->bssid, sdata->vif.cfg.ap_addr)) { in ieee80211_rx_mgmt_deauth()
4459 sdata->vif.cfg.ap_addr, reason_code, in ieee80211_rx_mgmt_deauth()
4469 if (ifmgd->assoc_data && in ieee80211_rx_mgmt_deauth()
4470 ether_addr_equal(mgmt->bssid, ifmgd->assoc_data->ap_addr)) { in ieee80211_rx_mgmt_deauth()
4473 ifmgd->assoc_data->ap_addr, reason_code, in ieee80211_rx_mgmt_deauth()
4478 cfg80211_rx_mlme_mgmt(sdata->dev, (u8 *)mgmt, len); in ieee80211_rx_mgmt_deauth()
4487 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_rx_mgmt_disassoc()
4490 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_rx_mgmt_disassoc()
4495 if (!ifmgd->associated || in ieee80211_rx_mgmt_disassoc()
4496 !ether_addr_equal(mgmt->bssid, sdata->vif.cfg.ap_addr)) in ieee80211_rx_mgmt_disassoc()
4499 reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code); in ieee80211_rx_mgmt_disassoc()
4501 if (!ether_addr_equal(mgmt->bssid, mgmt->sa)) { in ieee80211_rx_mgmt_disassoc()
4502 ieee80211_tdls_handle_disconnect(sdata, mgmt->sa, reason_code); in ieee80211_rx_mgmt_disassoc()
4507 sdata->vif.cfg.ap_addr, reason_code, in ieee80211_rx_mgmt_disassoc()
4546 for (j = 0; j < sband->n_bitrates; j++) { in ieee80211_get_rates()
4550 br = &sband->bitrates[j]; in ieee80211_get_rates()
4552 brate = DIV_ROUND_UP(br->bitrate, 5); in ieee80211_get_rates()
4573 ieee80211_get_he_iftype_cap_vif(sband, &sdata->vif); in ieee80211_twt_req_supported()
4575 if (elems->ext_capab_len < 10) in ieee80211_twt_req_supported()
4578 if (!(elems->ext_capab[9] & WLAN_EXT_CAPA10_TWT_RESPONDER_SUPPORT)) in ieee80211_twt_req_supported()
4581 return link_sta->pub->he_cap.he_cap_elem.mac_cap_info[0] & in ieee80211_twt_req_supported()
4584 (own_he_cap->he_cap_elem.mac_cap_info[0] & in ieee80211_twt_req_supported()
4590 struct ieee80211_link_data *link, in ieee80211_recalc_twt_req() argument
4596 if (link->conf->twt_requester != twt) { in ieee80211_recalc_twt_req()
4597 link->conf->twt_requester = twt; in ieee80211_recalc_twt_req()
4609 ieee80211_get_he_iftype_cap_vif(sband, &sdata->vif); in ieee80211_twt_bcast_support()
4611 return bss_conf->he_support && in ieee80211_twt_bcast_support()
4612 (link_sta->pub->he_cap.he_cap_elem.mac_cap_info[2] & in ieee80211_twt_bcast_support()
4615 (own_he_cap->he_cap_elem.mac_cap_info[2] & in ieee80211_twt_bcast_support()
4619 static bool ieee80211_assoc_config_link(struct ieee80211_link_data *link, in ieee80211_assoc_config_link() argument
4627 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_assoc_config_link()
4628 struct ieee80211_mgd_assoc_data *assoc_data = sdata->u.mgd.assoc_data; in ieee80211_assoc_config_link()
4629 struct ieee80211_bss_conf *bss_conf = link->conf; in ieee80211_assoc_config_link()
4630 struct ieee80211_local *local = sdata->local; in ieee80211_assoc_config_link()
4631 unsigned int link_id = link->link_id; in ieee80211_assoc_config_link()
4633 .mode = link->u.mgd.conn.mode, in ieee80211_assoc_config_link()
4636 .link_id = link_id == assoc_data->assoc_link_id ? -1 : link_id, in ieee80211_assoc_config_link()
4639 bool is_5ghz = cbss->channel->band == NL80211_BAND_5GHZ; in ieee80211_assoc_config_link()
4640 bool is_6ghz = cbss->channel->band == NL80211_BAND_6GHZ; in ieee80211_assoc_config_link()
4641 bool is_s1g = cbss->channel->band == NL80211_BAND_S1GHZ; in ieee80211_assoc_config_link()
4654 if (link_id == assoc_data->assoc_link_id) { in ieee80211_assoc_config_link()
4655 capab_info = le16_to_cpu(mgmt->u.assoc_resp.capab_info); in ieee80211_assoc_config_link()
4661 assoc_data->link[link_id].status = WLAN_STATUS_SUCCESS; in ieee80211_assoc_config_link()
4662 if (elems->ml_basic) { in ieee80211_assoc_config_link()
4664 ieee80211_mle_get_bss_param_ch_cnt((const void *)elems->ml_basic); in ieee80211_assoc_config_link()
4670 link->u.mgd.bss_param_ch_cnt = bss_param_ch_cnt; in ieee80211_assoc_config_link()
4672 } else if (elems->parse_error & IEEE80211_PARSE_ERR_DUP_NEST_ML_BASIC || in ieee80211_assoc_config_link()
4673 !elems->prof || in ieee80211_assoc_config_link()
4674 !(elems->prof->control & prof_bss_param_ch_present)) { in ieee80211_assoc_config_link()
4678 const u8 *ptr = elems->prof->variable + in ieee80211_assoc_config_link()
4679 elems->prof->sta_info_len - 1; in ieee80211_assoc_config_link()
4683 * otherwise elems->prof would have been set to NULL. in ieee80211_assoc_config_link()
4686 assoc_data->link[link_id].status = get_unaligned_le16(ptr + 2); in ieee80211_assoc_config_link()
4687 link->u.mgd.bss_param_ch_cnt = in ieee80211_assoc_config_link()
4688 ieee80211_mle_basic_sta_prof_bss_param_ch_cnt(elems->prof); in ieee80211_assoc_config_link()
4690 if (assoc_data->link[link_id].status != WLAN_STATUS_SUCCESS) { in ieee80211_assoc_config_link()
4691 link_info(link, "association response status code=%u\n", in ieee80211_assoc_config_link()
4692 assoc_data->link[link_id].status); in ieee80211_assoc_config_link()
4698 if (!is_s1g && !elems->supp_rates) { in ieee80211_assoc_config_link()
4704 link->u.mgd.tdls_chan_switch_prohibited = in ieee80211_assoc_config_link()
4705 elems->ext_capab && elems->ext_capab_len >= 5 && in ieee80211_assoc_config_link()
4706 (elems->ext_capab[4] & WLAN_EXT_CAPA5_TDLS_CH_SW_PROHIBITED); in ieee80211_assoc_config_link()
4713 * "Vodafone PocketWiFi 2", "ZTE MF60" and a similar T-Mobile device. in ieee80211_assoc_config_link()
4716 ((assoc_data->wmm && !elems->wmm_param) || in ieee80211_assoc_config_link()
4717 (link->u.mgd.conn.mode >= IEEE80211_CONN_MODE_HT && in ieee80211_assoc_config_link()
4718 (!elems->ht_cap_elem || !elems->ht_operation)) || in ieee80211_assoc_config_link()
4719 (is_5ghz && link->u.mgd.conn.mode >= IEEE80211_CONN_MODE_VHT && in ieee80211_assoc_config_link()
4720 (!elems->vht_cap_elem || !elems->vht_operation)))) { in ieee80211_assoc_config_link()
4725 ies = rcu_dereference(cbss->ies); in ieee80211_assoc_config_link()
4727 bss_ies = kmemdup(ies, sizeof(*ies) + ies->len, in ieee80211_assoc_config_link()
4735 parse_params.start = bss_ies->data; in ieee80211_assoc_config_link()
4736 parse_params.len = bss_ies->len; in ieee80211_assoc_config_link()
4744 if (assoc_data->wmm && in ieee80211_assoc_config_link()
4745 !elems->wmm_param && bss_elems->wmm_param) { in ieee80211_assoc_config_link()
4746 elems->wmm_param = bss_elems->wmm_param; in ieee80211_assoc_config_link()
4755 if (!elems->ht_cap_elem && bss_elems->ht_cap_elem && in ieee80211_assoc_config_link()
4756 link->u.mgd.conn.mode >= IEEE80211_CONN_MODE_HT) { in ieee80211_assoc_config_link()
4757 elems->ht_cap_elem = bss_elems->ht_cap_elem; in ieee80211_assoc_config_link()
4761 if (!elems->ht_operation && bss_elems->ht_operation && in ieee80211_assoc_config_link()
4762 link->u.mgd.conn.mode >= IEEE80211_CONN_MODE_HT) { in ieee80211_assoc_config_link()
4763 elems->ht_operation = bss_elems->ht_operation; in ieee80211_assoc_config_link()
4769 if (!elems->vht_cap_elem && bss_elems->vht_cap_elem && in ieee80211_assoc_config_link()
4770 link->u.mgd.conn.mode >= IEEE80211_CONN_MODE_VHT) { in ieee80211_assoc_config_link()
4771 elems->vht_cap_elem = bss_elems->vht_cap_elem; in ieee80211_assoc_config_link()
4776 if (!elems->vht_operation && bss_elems->vht_operation && in ieee80211_assoc_config_link()
4777 link->u.mgd.conn.mode >= IEEE80211_CONN_MODE_VHT) { in ieee80211_assoc_config_link()
4778 elems->vht_operation = bss_elems->vht_operation; in ieee80211_assoc_config_link()
4792 if (!is_6ghz && link->u.mgd.conn.mode >= IEEE80211_CONN_MODE_HT && in ieee80211_assoc_config_link()
4793 (!elems->wmm_param || !elems->ht_cap_elem || !elems->ht_operation)) { in ieee80211_assoc_config_link()
4800 if (is_5ghz && link->u.mgd.conn.mode >= IEEE80211_CONN_MODE_VHT && in ieee80211_assoc_config_link()
4801 (!elems->vht_cap_elem || !elems->vht_operation)) { in ieee80211_assoc_config_link()
4809 if (ieee80211_config_bw(link, elems, in ieee80211_assoc_config_link()
4810 link_id == assoc_data->assoc_link_id, in ieee80211_assoc_config_link()
4816 if (WARN_ON(!link->conf->chanreq.oper.chan)) { in ieee80211_assoc_config_link()
4820 sband = local->hw.wiphy->bands[link->conf->chanreq.oper.chan->band]; in ieee80211_assoc_config_link()
4823 if (elems->ht_cap_elem && link->u.mgd.conn.mode >= IEEE80211_CONN_MODE_HT) in ieee80211_assoc_config_link()
4825 elems->ht_cap_elem, in ieee80211_assoc_config_link()
4828 if (elems->vht_cap_elem && in ieee80211_assoc_config_link()
4829 link->u.mgd.conn.mode >= IEEE80211_CONN_MODE_VHT) { in ieee80211_assoc_config_link()
4840 ies = rcu_dereference(cbss->ies); in ieee80211_assoc_config_link()
4845 ies->data, ies->len); in ieee80211_assoc_config_link()
4846 if (elem && elem->datalen >= sizeof(*bss_vht_cap)) in ieee80211_assoc_config_link()
4847 bss_vht_cap = (const void *)elem->data; in ieee80211_assoc_config_link()
4851 elems->vht_cap_elem, in ieee80211_assoc_config_link()
4856 if (elems->he_operation && in ieee80211_assoc_config_link()
4857 link->u.mgd.conn.mode >= IEEE80211_CONN_MODE_HE && in ieee80211_assoc_config_link()
4858 elems->he_cap) { in ieee80211_assoc_config_link()
4860 elems->he_cap, in ieee80211_assoc_config_link()
4861 elems->he_cap_len, in ieee80211_assoc_config_link()
4862 elems->he_6ghz_capa, in ieee80211_assoc_config_link()
4865 bss_conf->he_support = link_sta->pub->he_cap.has_he; in ieee80211_assoc_config_link()
4866 if (elems->rsnx && elems->rsnx_len && in ieee80211_assoc_config_link()
4867 (elems->rsnx[0] & WLAN_RSNX_CAPA_PROTECTED_TWT) && in ieee80211_assoc_config_link()
4868 wiphy_ext_feature_isset(local->hw.wiphy, in ieee80211_assoc_config_link()
4870 bss_conf->twt_protected = true; in ieee80211_assoc_config_link()
4872 bss_conf->twt_protected = false; in ieee80211_assoc_config_link()
4874 *changed |= ieee80211_recalc_twt_req(sdata, sband, link, in ieee80211_assoc_config_link()
4877 if (elems->eht_operation && elems->eht_cap && in ieee80211_assoc_config_link()
4878 link->u.mgd.conn.mode >= IEEE80211_CONN_MODE_EHT) { in ieee80211_assoc_config_link()
4880 elems->he_cap, in ieee80211_assoc_config_link()
4881 elems->he_cap_len, in ieee80211_assoc_config_link()
4882 elems->eht_cap, in ieee80211_assoc_config_link()
4883 elems->eht_cap_len, in ieee80211_assoc_config_link()
4886 bss_conf->eht_support = link_sta->pub->eht_cap.has_eht; in ieee80211_assoc_config_link()
4888 bss_conf->eht_support = false; in ieee80211_assoc_config_link()
4891 bss_conf->he_support = false; in ieee80211_assoc_config_link()
4892 bss_conf->twt_requester = false; in ieee80211_assoc_config_link()
4893 bss_conf->twt_protected = false; in ieee80211_assoc_config_link()
4894 bss_conf->eht_support = false; in ieee80211_assoc_config_link()
4897 bss_conf->twt_broadcast = in ieee80211_assoc_config_link()
4900 if (bss_conf->he_support) { in ieee80211_assoc_config_link()
4901 bss_conf->he_bss_color.color = in ieee80211_assoc_config_link()
4902 le32_get_bits(elems->he_operation->he_oper_params, in ieee80211_assoc_config_link()
4904 bss_conf->he_bss_color.partial = in ieee80211_assoc_config_link()
4905 le32_get_bits(elems->he_operation->he_oper_params, in ieee80211_assoc_config_link()
4907 bss_conf->he_bss_color.enabled = in ieee80211_assoc_config_link()
4908 !le32_get_bits(elems->he_operation->he_oper_params, in ieee80211_assoc_config_link()
4911 if (bss_conf->he_bss_color.enabled) in ieee80211_assoc_config_link()
4914 bss_conf->htc_trig_based_pkt_ext = in ieee80211_assoc_config_link()
4915 le32_get_bits(elems->he_operation->he_oper_params, in ieee80211_assoc_config_link()
4917 bss_conf->frame_time_rts_th = in ieee80211_assoc_config_link()
4918 le32_get_bits(elems->he_operation->he_oper_params, in ieee80211_assoc_config_link()
4921 bss_conf->uora_exists = !!elems->uora_element; in ieee80211_assoc_config_link()
4922 if (elems->uora_element) in ieee80211_assoc_config_link()
4923 bss_conf->uora_ocw_range = elems->uora_element[0]; in ieee80211_assoc_config_link()
4925 ieee80211_he_op_ie_to_bss_conf(&sdata->vif, elems->he_operation); in ieee80211_assoc_config_link()
4926 ieee80211_he_spr_ie_to_bss_conf(&sdata->vif, elems->he_spr); in ieee80211_assoc_config_link()
4930 if (cbss->transmitted_bss) { in ieee80211_assoc_config_link()
4931 bss_conf->nontransmitted = true; in ieee80211_assoc_config_link()
4932 ether_addr_copy(bss_conf->transmitter_bssid, in ieee80211_assoc_config_link()
4933 cbss->transmitted_bss->bssid); in ieee80211_assoc_config_link()
4934 bss_conf->bssid_indicator = cbss->max_bssid_indicator; in ieee80211_assoc_config_link()
4935 bss_conf->bssid_index = cbss->bssid_index; in ieee80211_assoc_config_link()
4950 if (elems->opmode_notif && in ieee80211_assoc_config_link()
4951 !(*elems->opmode_notif & IEEE80211_OPMODE_NOTIF_RX_NSS_TYPE_BF)) { in ieee80211_assoc_config_link()
4954 nss = *elems->opmode_notif & IEEE80211_OPMODE_NOTIF_RX_NSS_MASK; in ieee80211_assoc_config_link()
4957 link_sta->pub->rx_nss = nss; in ieee80211_assoc_config_link()
4962 * of the first value the AP uses. Setting -1 here has in ieee80211_assoc_config_link()
4964 * 4-bit value. in ieee80211_assoc_config_link()
4966 link->u.mgd.wmm_last_param_set = -1; in ieee80211_assoc_config_link()
4967 link->u.mgd.mu_edca_last_param_set = -1; in ieee80211_assoc_config_link()
4969 if (link->u.mgd.disable_wmm_tracking) { in ieee80211_assoc_config_link()
4970 ieee80211_set_wmm_default(link, false, false); in ieee80211_assoc_config_link()
4971 } else if (!ieee80211_sta_wmm_params(local, link, elems->wmm_param, in ieee80211_assoc_config_link()
4972 elems->wmm_param_len, in ieee80211_assoc_config_link()
4973 elems->mu_edca_param_set)) { in ieee80211_assoc_config_link()
4975 ieee80211_set_wmm_default(link, false, true); in ieee80211_assoc_config_link()
4983 link->u.mgd.disable_wmm_tracking = true; in ieee80211_assoc_config_link()
4986 if (elems->max_idle_period_ie) { in ieee80211_assoc_config_link()
4987 bss_conf->max_idle_period = in ieee80211_assoc_config_link()
4988 le16_to_cpu(elems->max_idle_period_ie->max_idle_period); in ieee80211_assoc_config_link()
4989 bss_conf->protected_keep_alive = in ieee80211_assoc_config_link()
4990 !!(elems->max_idle_period_ie->idle_options & in ieee80211_assoc_config_link()
4994 bss_conf->max_idle_period = 0; in ieee80211_assoc_config_link()
4995 bss_conf->protected_keep_alive = false; in ieee80211_assoc_config_link()
5000 bss_conf->assoc_capability = capab_info; in ieee80211_assoc_config_link()
5009 static int ieee80211_mgd_setup_link_sta(struct ieee80211_link_data *link, in ieee80211_mgd_setup_link_sta() argument
5014 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_mgd_setup_link_sta()
5015 struct ieee80211_local *local = sdata->local; in ieee80211_mgd_setup_link_sta()
5016 struct ieee80211_bss *bss = (void *)cbss->priv; in ieee80211_mgd_setup_link_sta()
5019 int min_rate = INT_MAX, min_rate_index = -1; in ieee80211_mgd_setup_link_sta()
5022 memcpy(link_sta->addr, cbss->bssid, ETH_ALEN); in ieee80211_mgd_setup_link_sta()
5023 memcpy(link_sta->pub->addr, cbss->bssid, ETH_ALEN); in ieee80211_mgd_setup_link_sta()
5026 if (cbss->channel->band == NL80211_BAND_S1GHZ) { in ieee80211_mgd_setup_link_sta()
5031 sband = local->hw.wiphy->bands[cbss->channel->band]; in ieee80211_mgd_setup_link_sta()
5033 ieee80211_get_rates(sband, bss->supp_rates, bss->supp_rates_len, in ieee80211_mgd_setup_link_sta()
5043 * we can connect -- with a warning. in ieee80211_mgd_setup_link_sta()
5048 link_info(link, "No legacy rates in association response\n"); in ieee80211_mgd_setup_link_sta()
5049 return -EINVAL; in ieee80211_mgd_setup_link_sta()
5051 link_info(link, "No basic rates, using min rate instead\n"); in ieee80211_mgd_setup_link_sta()
5056 link_sta->pub->supp_rates[cbss->channel->band] = rates; in ieee80211_mgd_setup_link_sta()
5058 link_info(link, "No rates found, keeping mandatory only\n"); in ieee80211_mgd_setup_link_sta()
5060 link->conf->basic_rates = basic_rates; in ieee80211_mgd_setup_link_sta()
5063 link->operating_11g_mode = sband->band == NL80211_BAND_2GHZ && in ieee80211_mgd_setup_link_sta()
5069 static u8 ieee80211_max_rx_chains(struct ieee80211_link_data *link, in ieee80211_max_rx_chains() argument
5084 if (link->u.mgd.conn.mode < IEEE80211_CONN_MODE_HT) in ieee80211_max_rx_chains()
5088 if (ht_cap_elem && ht_cap_elem->datalen >= sizeof(*ht_cap)) { in ieee80211_max_rx_chains()
5089 ht_cap = (void *)ht_cap_elem->data; in ieee80211_max_rx_chains()
5090 chains = ieee80211_mcs_to_chains(&ht_cap->mcs); in ieee80211_max_rx_chains()
5097 if (link->u.mgd.conn.mode < IEEE80211_CONN_MODE_VHT) in ieee80211_max_rx_chains()
5101 if (vht_cap_elem && vht_cap_elem->datalen >= sizeof(*vht_cap)) { in ieee80211_max_rx_chains()
5105 vht_cap = (void *)vht_cap_elem->data; in ieee80211_max_rx_chains()
5106 tx_mcs_map = le16_to_cpu(vht_cap->supp_mcs.tx_mcs_map); in ieee80211_max_rx_chains()
5107 for (nss = 8; nss > 0; nss--) { in ieee80211_max_rx_chains()
5108 if (((tx_mcs_map >> (2 * (nss - 1))) & 3) != in ieee80211_max_rx_chains()
5116 if (link->u.mgd.conn.mode < IEEE80211_CONN_MODE_HE) in ieee80211_max_rx_chains()
5119 ies = rcu_dereference(cbss->ies); in ieee80211_max_rx_chains()
5121 ies->data, ies->len); in ieee80211_max_rx_chains()
5123 if (!he_cap_elem || he_cap_elem->datalen < sizeof(*he_cap)) in ieee80211_max_rx_chains()
5127 he_cap = (void *)(he_cap_elem->data + 1); in ieee80211_max_rx_chains()
5131 if (he_cap_elem->datalen < 1 + mcs_nss_size + sizeof(*he_cap)) in ieee80211_max_rx_chains()
5137 mcs_80_map = le16_to_cpu(he_mcs_nss_supp->tx_mcs_80); in ieee80211_max_rx_chains()
5139 for (i = 7; i >= 0; i--) { in ieee80211_max_rx_chains()
5148 support_160 = he_cap->phy_cap_info[0] & in ieee80211_max_rx_chains()
5154 mcs_160_map = le16_to_cpu(he_mcs_nss_supp->tx_mcs_160); in ieee80211_max_rx_chains()
5155 for (i = 7; i >= 0; i--) { in ieee80211_max_rx_chains()
5174 struct ieee80211_sta_ht_cap sta_ht_cap = sband->ht_cap; in ieee80211_determine_our_sta_mode()
5175 bool is_5ghz = sband->band == NL80211_BAND_5GHZ; in ieee80211_determine_our_sta_mode()
5176 bool is_6ghz = sband->band == NL80211_BAND_6GHZ; in ieee80211_determine_our_sta_mode()
5181 if (sband->band == NL80211_BAND_S1GHZ) { in ieee80211_determine_our_sta_mode()
5182 conn->mode = IEEE80211_CONN_MODE_S1G; in ieee80211_determine_our_sta_mode()
5183 conn->bw_limit = IEEE80211_CONN_BW_LIMIT_20; in ieee80211_determine_our_sta_mode()
5188 conn->mode = IEEE80211_CONN_MODE_LEGACY; in ieee80211_determine_our_sta_mode()
5189 conn->bw_limit = IEEE80211_CONN_BW_LIMIT_20; in ieee80211_determine_our_sta_mode()
5193 if (req && req->flags & ASSOC_REQ_DISABLE_HT) { in ieee80211_determine_our_sta_mode()
5208 for (i = 0; i < req->crypto.n_ciphers_pairwise; i++) { in ieee80211_determine_our_sta_mode()
5209 if (req->crypto.ciphers_pairwise[i] == WLAN_CIPHER_SUITE_WEP40 || in ieee80211_determine_our_sta_mode()
5210 req->crypto.ciphers_pairwise[i] == WLAN_CIPHER_SUITE_TKIP || in ieee80211_determine_our_sta_mode()
5211 req->crypto.ciphers_pairwise[i] == WLAN_CIPHER_SUITE_WEP104) { in ieee80211_determine_our_sta_mode()
5212 netdev_info(sdata->dev, in ieee80211_determine_our_sta_mode()
5226 conn->mode = IEEE80211_CONN_MODE_HT; in ieee80211_determine_our_sta_mode()
5227 conn->bw_limit = sta_ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40 ? in ieee80211_determine_our_sta_mode()
5231 memcpy(&vht_cap, &sband->vht_cap, sizeof(vht_cap)); in ieee80211_determine_our_sta_mode()
5234 if (req && req->flags & ASSOC_REQ_DISABLE_VHT) { in ieee80211_determine_our_sta_mode()
5244 if (conn->bw_limit == IEEE80211_CONN_BW_LIMIT_20) { in ieee80211_determine_our_sta_mode()
5251 for (i = 0; i < sband->n_channels; i++) { in ieee80211_determine_our_sta_mode()
5252 if (sband->channels[i].flags & (IEEE80211_CHAN_DISABLED | in ieee80211_determine_our_sta_mode()
5271 /* VHT - if we have - is fine, including 80 MHz, check 160 below again */ in ieee80211_determine_our_sta_mode()
5272 if (sband->band != NL80211_BAND_2GHZ) { in ieee80211_determine_our_sta_mode()
5273 conn->mode = IEEE80211_CONN_MODE_VHT; in ieee80211_determine_our_sta_mode()
5274 conn->bw_limit = IEEE80211_CONN_BW_LIMIT_160; in ieee80211_determine_our_sta_mode()
5280 conn->bw_limit = IEEE80211_CONN_BW_LIMIT_80; in ieee80211_determine_our_sta_mode()
5285 if (req && req->flags & ASSOC_REQ_DISABLE_HE) { in ieee80211_determine_our_sta_mode()
5291 he_cap = ieee80211_get_he_iftype_cap_vif(sband, &sdata->vif); in ieee80211_determine_our_sta_mode()
5300 conn->mode = IEEE80211_CONN_MODE_HE; in ieee80211_determine_our_sta_mode()
5303 switch (sband->band) { in ieee80211_determine_our_sta_mode()
5306 if (he_cap->he_cap_elem.phy_cap_info[0] & in ieee80211_determine_our_sta_mode()
5309 conn->bw_limit = IEEE80211_CONN_BW_LIMIT_20; in ieee80211_determine_our_sta_mode()
5314 if (!(he_cap->he_cap_elem.phy_cap_info[0] & in ieee80211_determine_our_sta_mode()
5316 conn->bw_limit = IEEE80211_CONN_BW_LIMIT_20; in ieee80211_determine_our_sta_mode()
5321 if (!(he_cap->he_cap_elem.phy_cap_info[0] & in ieee80211_determine_our_sta_mode()
5323 conn->bw_limit = min_t(enum ieee80211_conn_bw_limit, in ieee80211_determine_our_sta_mode()
5324 conn->bw_limit, in ieee80211_determine_our_sta_mode()
5331 if (he_cap->he_cap_elem.phy_cap_info[0] & in ieee80211_determine_our_sta_mode()
5334 conn->bw_limit = min_t(enum ieee80211_conn_bw_limit, in ieee80211_determine_our_sta_mode()
5335 conn->bw_limit, in ieee80211_determine_our_sta_mode()
5342 if (req && req->flags & ASSOC_REQ_DISABLE_EHT) { in ieee80211_determine_our_sta_mode()
5348 eht_cap = ieee80211_get_eht_iftype_cap_vif(sband, &sdata->vif); in ieee80211_determine_our_sta_mode()
5357 conn->mode = IEEE80211_CONN_MODE_EHT; in ieee80211_determine_our_sta_mode()
5361 eht_cap->eht_cap_elem.phy_cap_info[0] & IEEE80211_EHT_PHY_CAP0_320MHZ_IN_6GHZ) in ieee80211_determine_our_sta_mode()
5362 conn->bw_limit = IEEE80211_CONN_BW_LIMIT_320; in ieee80211_determine_our_sta_mode()
5370 ieee80211_conn_mode_str(conn->mode), in ieee80211_determine_our_sta_mode()
5371 20 * (1 << conn->bw_limit)); in ieee80211_determine_our_sta_mode()
5382 req->link_id > 0 ? req->link_id : 0, in ieee80211_determine_our_sta_mode_auth()
5400 conn->mode = min_t(enum ieee80211_conn_mode, in ieee80211_determine_our_sta_mode_assoc()
5401 conn->mode, tmp.mode); in ieee80211_determine_our_sta_mode_assoc()
5402 conn->bw_limit = min_t(enum ieee80211_conn_bw_limit, in ieee80211_determine_our_sta_mode_assoc()
5403 conn->bw_limit, tmp.bw_limit); in ieee80211_determine_our_sta_mode_assoc()
5424 struct ieee80211_link_data *link, in ieee80211_prep_channel() argument
5429 struct ieee80211_local *local = sdata->local; in ieee80211_prep_channel()
5430 bool is_6ghz = cbss->channel->band == NL80211_BAND_6GHZ; in ieee80211_prep_channel()
5436 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_prep_channel()
5447 if (mlo && !elems->ml_basic) { in ieee80211_prep_channel()
5451 return -EINVAL; in ieee80211_prep_channel()
5454 if (link && is_6ghz && conn->mode >= IEEE80211_CONN_MODE_HE) { in ieee80211_prep_channel()
5457 if (elems->pwr_constr_elem) in ieee80211_prep_channel()
5458 link->conf->pwr_reduction = *elems->pwr_constr_elem; in ieee80211_prep_channel()
5460 he_6ghz_oper = ieee80211_he_6ghz_oper(elems->he_operation); in ieee80211_prep_channel()
5462 link->conf->power_type = in ieee80211_prep_channel()
5463 ieee80211_ap_power_type(he_6ghz_oper->control); in ieee80211_prep_channel()
5465 link_info(link, in ieee80211_prep_channel()
5467 cbss->channel->center_freq); in ieee80211_prep_channel()
5469 link->conf->tpe = elems->tpe; in ieee80211_prep_channel()
5470 ieee80211_rearrange_tpe(&link->conf->tpe, &ap_chandef, in ieee80211_prep_channel()
5478 if (!link) in ieee80211_prep_channel()
5482 link->needed_rx_chains = min(ieee80211_max_rx_chains(link, cbss), in ieee80211_prep_channel()
5483 local->rx_chains); in ieee80211_prep_channel()
5491 ret = ieee80211_link_use_channel(link, &chanreq, in ieee80211_prep_channel()
5502 ret = ieee80211_link_use_channel(link, &chanreq, in ieee80211_prep_channel()
5512 const u8 *tim_ie = cfg80211_find_ie(WLAN_EID_TIM, ies->data, ies->len); in ieee80211_get_dtim()
5513 const u8 *idx_ie = cfg80211_find_ie(WLAN_EID_MULTI_BSSID_IDX, ies->data, in ieee80211_get_dtim()
5514 ies->len); in ieee80211_get_dtim()
5523 *dtim_count = valid ? tim->dtim_count : 0; in ieee80211_get_dtim()
5526 *dtim_period = valid ? tim->dtim_period : 0; in ieee80211_get_dtim()
5528 /* Check if value is overridden by non-transmitted profile */ in ieee80211_get_dtim()
5535 *dtim_count = idx->dtim_count; in ieee80211_get_dtim()
5538 *dtim_period = idx->dtim_period; in ieee80211_get_dtim()
5548 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_assoc_success()
5549 struct ieee80211_mgd_assoc_data *assoc_data = ifmgd->assoc_data; in ieee80211_assoc_success()
5550 struct ieee80211_local *local = sdata->local; in ieee80211_assoc_success()
5557 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_assoc_success()
5562 sta = sta_info_get(sdata, assoc_data->ap_addr); in ieee80211_assoc_success()
5566 sta->sta.spp_amsdu = assoc_data->spp_amsdu; in ieee80211_assoc_success()
5568 if (ieee80211_vif_is_mld(&sdata->vif)) { in ieee80211_assoc_success()
5570 if (!assoc_data->link[link_id].bss) in ieee80211_assoc_success()
5574 if (assoc_data->link[link_id].disabled) in ieee80211_assoc_success()
5577 if (link_id != assoc_data->assoc_link_id) { in ieee80211_assoc_success()
5588 struct cfg80211_bss *cbss = assoc_data->link[link_id].bss; in ieee80211_assoc_success()
5589 struct ieee80211_link_data *link; in ieee80211_assoc_success() local
5595 link = sdata_dereference(sdata->link[link_id], sdata); in ieee80211_assoc_success()
5596 if (WARN_ON(!link)) in ieee80211_assoc_success()
5599 if (ieee80211_vif_is_mld(&sdata->vif)) in ieee80211_assoc_success()
5600 link_info(link, in ieee80211_assoc_success()
5601 "local address %pM, AP link address %pM%s\n", in ieee80211_assoc_success()
5602 link->conf->addr, in ieee80211_assoc_success()
5603 assoc_data->link[link_id].bss->bssid, in ieee80211_assoc_success()
5604 link_id == assoc_data->assoc_link_id ? in ieee80211_assoc_success()
5607 link_sta = rcu_dereference_protected(sta->link[link_id], in ieee80211_assoc_success()
5608 lockdep_is_held(&local->hw.wiphy->mtx)); in ieee80211_assoc_success()
5612 if (!link->u.mgd.have_beacon) { in ieee80211_assoc_success()
5616 ies = rcu_dereference(cbss->beacon_ies); in ieee80211_assoc_success()
5618 link->u.mgd.have_beacon = true; in ieee80211_assoc_success()
5620 ies = rcu_dereference(cbss->ies); in ieee80211_assoc_success()
5622 &link->conf->sync_dtim_count, in ieee80211_assoc_success()
5623 &link->u.mgd.dtim_period); in ieee80211_assoc_success()
5624 link->conf->beacon_int = cbss->beacon_interval; in ieee80211_assoc_success()
5628 link->conf->dtim_period = link->u.mgd.dtim_period ?: 1; in ieee80211_assoc_success()
5630 if (link_id != assoc_data->assoc_link_id) { in ieee80211_assoc_success()
5631 link->u.mgd.conn = assoc_data->link[link_id].conn; in ieee80211_assoc_success()
5633 err = ieee80211_prep_channel(sdata, link, link_id, cbss, in ieee80211_assoc_success()
5634 true, &link->u.mgd.conn); in ieee80211_assoc_success()
5636 link_info(link, "prep_channel failed\n"); in ieee80211_assoc_success()
5641 err = ieee80211_mgd_setup_link_sta(link, sta, link_sta, in ieee80211_assoc_success()
5642 assoc_data->link[link_id].bss); in ieee80211_assoc_success()
5646 if (!ieee80211_assoc_config_link(link, link_sta, in ieee80211_assoc_success()
5647 assoc_data->link[link_id].bss, in ieee80211_assoc_success()
5652 if (assoc_data->link[link_id].status != WLAN_STATUS_SUCCESS) { in ieee80211_assoc_success()
5658 if (link_id != assoc_data->assoc_link_id) { in ieee80211_assoc_success()
5670 if (ifmgd->flags & IEEE80211_STA_MFP_ENABLED) { in ieee80211_assoc_success()
5672 sta->sta.mfp = true; in ieee80211_assoc_success()
5674 sta->sta.mfp = false; in ieee80211_assoc_success()
5677 ieee80211_sta_set_max_amsdu_subframes(sta, elems->ext_capab, in ieee80211_assoc_success()
5678 elems->ext_capab_len); in ieee80211_assoc_success()
5680 sta->sta.wme = (elems->wmm_param || elems->s1g_capab) && in ieee80211_assoc_success()
5681 local->hw.queues >= IEEE80211_NUM_ACS; in ieee80211_assoc_success()
5684 if (!err && !(ifmgd->flags & IEEE80211_STA_CONTROL_PORT)) in ieee80211_assoc_success()
5689 sta->sta.addr); in ieee80211_assoc_success()
5694 if (sdata->wdev.use_4addr) in ieee80211_assoc_success()
5695 drv_sta_set_4addr(local, sdata, &sta->sta, true); in ieee80211_assoc_success()
5700 * If we're using 4-addr mode, let the AP know that we're in ieee80211_assoc_success()
5703 if (ifmgd->use_4addr) in ieee80211_assoc_success()
5715 eth_zero_addr(sdata->vif.cfg.ap_addr); in ieee80211_assoc_success()
5723 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_rx_mgmt_assoc_resp()
5724 struct ieee80211_mgd_assoc_data *assoc_data = ifmgd->assoc_data; in ieee80211_rx_mgmt_assoc_resp()
5728 .link_id = -1, in ieee80211_rx_mgmt_assoc_resp()
5732 int ac; in ieee80211_rx_mgmt_assoc_resp() local
5742 .uapsd_queues = -1, in ieee80211_rx_mgmt_assoc_resp()
5747 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_rx_mgmt_assoc_resp()
5753 assoc_data->link[assoc_data->assoc_link_id].conn.mode; in ieee80211_rx_mgmt_assoc_resp()
5755 if (!ether_addr_equal(assoc_data->ap_addr, mgmt->bssid) || in ieee80211_rx_mgmt_assoc_resp()
5756 !ether_addr_equal(assoc_data->ap_addr, mgmt->sa)) in ieee80211_rx_mgmt_assoc_resp()
5767 reassoc = ieee80211_is_reassoc_resp(mgmt->frame_control); in ieee80211_rx_mgmt_assoc_resp()
5768 capab_info = le16_to_cpu(mgmt->u.assoc_resp.capab_info); in ieee80211_rx_mgmt_assoc_resp()
5769 status_code = le16_to_cpu(mgmt->u.assoc_resp.status_code); in ieee80211_rx_mgmt_assoc_resp()
5770 if (assoc_data->s1g) in ieee80211_rx_mgmt_assoc_resp()
5771 elem_start = mgmt->u.s1g_assoc_resp.variable; in ieee80211_rx_mgmt_assoc_resp()
5773 elem_start = mgmt->u.assoc_resp.variable; in ieee80211_rx_mgmt_assoc_resp()
5776 * Note: this may not be perfect, AP might misbehave - if in ieee80211_rx_mgmt_assoc_resp()
5784 if (assoc_data->fils_kek_len && in ieee80211_rx_mgmt_assoc_resp()
5788 elem_len = len - (elem_start - (u8 *)mgmt); in ieee80211_rx_mgmt_assoc_resp()
5795 if (elems->aid_resp) in ieee80211_rx_mgmt_assoc_resp()
5796 aid = le16_to_cpu(elems->aid_resp->aid); in ieee80211_rx_mgmt_assoc_resp()
5797 else if (assoc_data->s1g) in ieee80211_rx_mgmt_assoc_resp()
5800 aid = le16_to_cpu(mgmt->u.assoc_resp.aid); in ieee80211_rx_mgmt_assoc_resp()
5804 * (802.11-2016 9.4.1.8 AID field) in ieee80211_rx_mgmt_assoc_resp()
5810 reassoc ? "Rea" : "A", assoc_data->ap_addr, in ieee80211_rx_mgmt_assoc_resp()
5813 ifmgd->broken_ap = false; in ieee80211_rx_mgmt_assoc_resp()
5816 elems->timeout_int && in ieee80211_rx_mgmt_assoc_resp()
5817 elems->timeout_int->type == WLAN_TIMEOUT_ASSOC_COMEBACK) { in ieee80211_rx_mgmt_assoc_resp()
5820 cfg80211_assoc_comeback(sdata->dev, assoc_data->ap_addr, in ieee80211_rx_mgmt_assoc_resp()
5821 le32_to_cpu(elems->timeout_int->value)); in ieee80211_rx_mgmt_assoc_resp()
5823 tu = le32_to_cpu(elems->timeout_int->value); in ieee80211_rx_mgmt_assoc_resp()
5827 assoc_data->ap_addr, tu, ms); in ieee80211_rx_mgmt_assoc_resp()
5828 assoc_data->timeout = jiffies + msecs_to_jiffies(ms); in ieee80211_rx_mgmt_assoc_resp()
5829 assoc_data->timeout_started = true; in ieee80211_rx_mgmt_assoc_resp()
5830 assoc_data->comeback = true; in ieee80211_rx_mgmt_assoc_resp()
5832 run_again(sdata, assoc_data->timeout); in ieee80211_rx_mgmt_assoc_resp()
5838 assoc_data->ap_addr, status_code); in ieee80211_rx_mgmt_assoc_resp()
5841 drv_event_callback(sdata->local, sdata, &event); in ieee80211_rx_mgmt_assoc_resp()
5848 ifmgd->broken_ap = true; in ieee80211_rx_mgmt_assoc_resp()
5851 if (ieee80211_vif_is_mld(&sdata->vif)) { in ieee80211_rx_mgmt_assoc_resp()
5854 if (!elems->ml_basic) { in ieee80211_rx_mgmt_assoc_resp()
5856 "MLO association with %pM but no (basic) multi-link element in response!\n", in ieee80211_rx_mgmt_assoc_resp()
5857 assoc_data->ap_addr); in ieee80211_rx_mgmt_assoc_resp()
5861 common = (void *)elems->ml_basic->variable; in ieee80211_rx_mgmt_assoc_resp()
5863 if (memcmp(assoc_data->ap_addr, in ieee80211_rx_mgmt_assoc_resp()
5864 common->mld_mac_addr, ETH_ALEN)) { in ieee80211_rx_mgmt_assoc_resp()
5867 common->mld_mac_addr, in ieee80211_rx_mgmt_assoc_resp()
5868 assoc_data->ap_addr); in ieee80211_rx_mgmt_assoc_resp()
5872 sdata->vif.cfg.eml_cap = in ieee80211_rx_mgmt_assoc_resp()
5873 ieee80211_mle_get_eml_cap((const void *)elems->ml_basic); in ieee80211_rx_mgmt_assoc_resp()
5874 sdata->vif.cfg.eml_med_sync_delay = in ieee80211_rx_mgmt_assoc_resp()
5875 ieee80211_mle_get_eml_med_sync_delay((const void *)elems->ml_basic); in ieee80211_rx_mgmt_assoc_resp()
5876 sdata->vif.cfg.mld_capa_op = in ieee80211_rx_mgmt_assoc_resp()
5877 ieee80211_mle_get_mld_capa_op((const void *)elems->ml_basic); in ieee80211_rx_mgmt_assoc_resp()
5880 sdata->vif.cfg.aid = aid; in ieee80211_rx_mgmt_assoc_resp()
5884 /* oops -- internal error -- send timeout for now */ in ieee80211_rx_mgmt_assoc_resp()
5889 drv_event_callback(sdata->local, sdata, &event); in ieee80211_rx_mgmt_assoc_resp()
5896 struct ieee80211_link_data *link; in ieee80211_rx_mgmt_assoc_resp() local
5898 if (!assoc_data->link[link_id].bss) in ieee80211_rx_mgmt_assoc_resp()
5901 resp.links[link_id].bss = assoc_data->link[link_id].bss; in ieee80211_rx_mgmt_assoc_resp()
5903 assoc_data->link[link_id].addr); in ieee80211_rx_mgmt_assoc_resp()
5904 resp.links[link_id].status = assoc_data->link[link_id].status; in ieee80211_rx_mgmt_assoc_resp()
5906 link = sdata_dereference(sdata->link[link_id], sdata); in ieee80211_rx_mgmt_assoc_resp()
5907 if (!link) in ieee80211_rx_mgmt_assoc_resp()
5910 /* get uapsd queues configuration - same for all links */ in ieee80211_rx_mgmt_assoc_resp()
5912 for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) in ieee80211_rx_mgmt_assoc_resp()
5913 if (link->tx_conf[ac].uapsd) in ieee80211_rx_mgmt_assoc_resp()
5914 resp.uapsd_queues |= ieee80211_ac_to_qos_mask[ac]; in ieee80211_rx_mgmt_assoc_resp()
5917 if (ieee80211_vif_is_mld(&sdata->vif)) { in ieee80211_rx_mgmt_assoc_resp()
5918 ether_addr_copy(ap_mld_addr, sdata->vif.cfg.ap_addr); in ieee80211_rx_mgmt_assoc_resp()
5929 resp.req_ies = ifmgd->assoc_req_ies; in ieee80211_rx_mgmt_assoc_resp()
5930 resp.req_ies_len = ifmgd->assoc_req_ies_len; in ieee80211_rx_mgmt_assoc_resp()
5931 cfg80211_rx_assoc_resp(sdata->dev, &resp); in ieee80211_rx_mgmt_assoc_resp()
5933 drv_mgd_complete_tx(sdata->local, sdata, &info); in ieee80211_rx_mgmt_assoc_resp()
5941 static void ieee80211_rx_bss_info(struct ieee80211_link_data *link, in ieee80211_rx_bss_info() argument
5945 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_rx_bss_info()
5946 struct ieee80211_local *local = sdata->local; in ieee80211_rx_bss_info()
5950 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_rx_bss_info()
5952 channel = ieee80211_get_channel_khz(local->hw.wiphy, in ieee80211_rx_bss_info()
5959 link->conf->beacon_rate = bss->beacon_rate; in ieee80211_rx_bss_info()
5965 static void ieee80211_rx_mgmt_probe_resp(struct ieee80211_link_data *link, in ieee80211_rx_mgmt_probe_resp() argument
5968 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_rx_mgmt_probe_resp()
5969 struct ieee80211_mgmt *mgmt = (void *)skb->data; in ieee80211_rx_mgmt_probe_resp()
5971 struct ieee80211_rx_status *rx_status = (void *) skb->cb; in ieee80211_rx_mgmt_probe_resp()
5973 size_t baselen, len = skb->len; in ieee80211_rx_mgmt_probe_resp()
5975 ifmgd = &sdata->u.mgd; in ieee80211_rx_mgmt_probe_resp()
5977 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_rx_mgmt_probe_resp()
5986 channel = ieee80211_get_channel(sdata->local->hw.wiphy, in ieee80211_rx_mgmt_probe_resp()
5987 rx_status->freq); in ieee80211_rx_mgmt_probe_resp()
5991 if (!ether_addr_equal(mgmt->da, sdata->vif.addr) && in ieee80211_rx_mgmt_probe_resp()
5992 (channel->band != NL80211_BAND_6GHZ || in ieee80211_rx_mgmt_probe_resp()
5993 !is_broadcast_ether_addr(mgmt->da))) in ieee80211_rx_mgmt_probe_resp()
5996 baselen = (u8 *) mgmt->u.probe_resp.variable - (u8 *) mgmt; in ieee80211_rx_mgmt_probe_resp()
6000 ieee80211_rx_bss_info(link, mgmt, len, rx_status); in ieee80211_rx_mgmt_probe_resp()
6002 if (ifmgd->associated && in ieee80211_rx_mgmt_probe_resp()
6003 ether_addr_equal(mgmt->bssid, link->u.mgd.bssid)) in ieee80211_rx_mgmt_probe_resp()
6018 * XXX: This list needs to be dynamic -- userspace needs to be able to
6031 static void ieee80211_handle_beacon_sig(struct ieee80211_link_data *link, in ieee80211_handle_beacon_sig() argument
6037 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_handle_beacon_sig()
6041 if (!link->u.mgd.tracking_signal_avg) { in ieee80211_handle_beacon_sig()
6042 link->u.mgd.tracking_signal_avg = true; in ieee80211_handle_beacon_sig()
6043 ewma_beacon_signal_init(&link->u.mgd.ave_beacon_signal); in ieee80211_handle_beacon_sig()
6044 link->u.mgd.last_cqm_event_signal = 0; in ieee80211_handle_beacon_sig()
6045 link->u.mgd.count_beacon_signal = 1; in ieee80211_handle_beacon_sig()
6046 link->u.mgd.last_ave_beacon_signal = 0; in ieee80211_handle_beacon_sig()
6048 link->u.mgd.count_beacon_signal++; in ieee80211_handle_beacon_sig()
6051 ewma_beacon_signal_add(&link->u.mgd.ave_beacon_signal, in ieee80211_handle_beacon_sig()
6052 -rx_status->signal); in ieee80211_handle_beacon_sig()
6054 if (ifmgd->rssi_min_thold != ifmgd->rssi_max_thold && in ieee80211_handle_beacon_sig()
6055 link->u.mgd.count_beacon_signal >= IEEE80211_SIGNAL_AVE_MIN_COUNT) { in ieee80211_handle_beacon_sig()
6056 int sig = -ewma_beacon_signal_read(&link->u.mgd.ave_beacon_signal); in ieee80211_handle_beacon_sig()
6057 int last_sig = link->u.mgd.last_ave_beacon_signal; in ieee80211_handle_beacon_sig()
6066 if (sig > ifmgd->rssi_max_thold && in ieee80211_handle_beacon_sig()
6067 (last_sig <= ifmgd->rssi_min_thold || last_sig == 0)) { in ieee80211_handle_beacon_sig()
6068 link->u.mgd.last_ave_beacon_signal = sig; in ieee80211_handle_beacon_sig()
6071 } else if (sig < ifmgd->rssi_min_thold && in ieee80211_handle_beacon_sig()
6072 (last_sig >= ifmgd->rssi_max_thold || in ieee80211_handle_beacon_sig()
6074 link->u.mgd.last_ave_beacon_signal = sig; in ieee80211_handle_beacon_sig()
6080 if (bss_conf->cqm_rssi_thold && in ieee80211_handle_beacon_sig()
6081 link->u.mgd.count_beacon_signal >= IEEE80211_SIGNAL_AVE_MIN_COUNT && in ieee80211_handle_beacon_sig()
6082 !(sdata->vif.driver_flags & IEEE80211_VIF_SUPPORTS_CQM_RSSI)) { in ieee80211_handle_beacon_sig()
6083 int sig = -ewma_beacon_signal_read(&link->u.mgd.ave_beacon_signal); in ieee80211_handle_beacon_sig()
6084 int last_event = link->u.mgd.last_cqm_event_signal; in ieee80211_handle_beacon_sig()
6085 int thold = bss_conf->cqm_rssi_thold; in ieee80211_handle_beacon_sig()
6086 int hyst = bss_conf->cqm_rssi_hyst; in ieee80211_handle_beacon_sig()
6089 (last_event == 0 || sig < last_event - hyst)) { in ieee80211_handle_beacon_sig()
6090 link->u.mgd.last_cqm_event_signal = sig; in ieee80211_handle_beacon_sig()
6092 &sdata->vif, in ieee80211_handle_beacon_sig()
6097 link->u.mgd.last_cqm_event_signal = sig; in ieee80211_handle_beacon_sig()
6099 &sdata->vif, in ieee80211_handle_beacon_sig()
6105 if (bss_conf->cqm_rssi_low && in ieee80211_handle_beacon_sig()
6106 link->u.mgd.count_beacon_signal >= IEEE80211_SIGNAL_AVE_MIN_COUNT) { in ieee80211_handle_beacon_sig()
6107 int sig = -ewma_beacon_signal_read(&link->u.mgd.ave_beacon_signal); in ieee80211_handle_beacon_sig()
6108 int last_event = link->u.mgd.last_cqm_event_signal; in ieee80211_handle_beacon_sig()
6109 int low = bss_conf->cqm_rssi_low; in ieee80211_handle_beacon_sig()
6110 int high = bss_conf->cqm_rssi_high; in ieee80211_handle_beacon_sig()
6114 link->u.mgd.last_cqm_event_signal = sig; in ieee80211_handle_beacon_sig()
6116 &sdata->vif, in ieee80211_handle_beacon_sig()
6121 link->u.mgd.last_cqm_event_signal = sig; in ieee80211_handle_beacon_sig()
6123 &sdata->vif, in ieee80211_handle_beacon_sig()
6133 if (ether_addr_equal(tx_bssid, bss->bssid)) in ieee80211_rx_our_beacon()
6135 if (!bss->transmitted_bss) in ieee80211_rx_our_beacon()
6137 return ether_addr_equal(tx_bssid, bss->transmitted_bss->bssid); in ieee80211_rx_our_beacon()
6149 if (!sdata->u.mgd.removed_links) in ieee80211_ml_reconf_work()
6154 sdata->vif.valid_links, sdata->u.mgd.removed_links); in ieee80211_ml_reconf_work()
6156 new_valid_links = sdata->vif.valid_links & ~sdata->u.mgd.removed_links; in ieee80211_ml_reconf_work()
6157 if (new_valid_links == sdata->vif.valid_links) in ieee80211_ml_reconf_work()
6161 !(new_valid_links & ~sdata->vif.dormant_links)) { in ieee80211_ml_reconf_work()
6163 ret = -EINVAL; in ieee80211_ml_reconf_work()
6167 new_active_links = sdata->vif.active_links & ~sdata->u.mgd.removed_links; in ieee80211_ml_reconf_work()
6168 if (new_active_links != sdata->vif.active_links) { in ieee80211_ml_reconf_work()
6172 ~sdata->vif.dormant_links) - 1); in ieee80211_ml_reconf_work()
6174 ret = ieee80211_set_active_links(&sdata->vif, new_active_links); in ieee80211_ml_reconf_work()
6182 new_dormant_links = sdata->vif.dormant_links & ~sdata->u.mgd.removed_links; in ieee80211_ml_reconf_work()
6193 cfg80211_links_removed(sdata->dev, sdata->u.mgd.removed_links); in ieee80211_ml_reconf_work()
6197 sdata->u.mgd.removed_links = 0; in ieee80211_ml_reconf_work()
6209 if (!ieee80211_vif_is_mld(&sdata->vif) || !elems->ml_reconf) in ieee80211_ml_reconfiguration()
6215 for_each_mle_subelement(sub, (const u8 *)elems->ml_reconf, in ieee80211_ml_reconfiguration()
6216 elems->ml_reconf_len) { in ieee80211_ml_reconfiguration()
6217 struct ieee80211_mle_per_sta_profile *prof = (void *)sub->data; in ieee80211_ml_reconfiguration()
6218 u8 *pos = prof->variable; in ieee80211_ml_reconfiguration()
6221 if (sub->id != IEEE80211_MLE_SUBELEM_PER_STA_PROFILE) in ieee80211_ml_reconfiguration()
6224 if (!ieee80211_mle_reconf_sta_prof_size_ok(sub->data, in ieee80211_ml_reconfiguration()
6225 sub->datalen)) in ieee80211_ml_reconfiguration()
6228 control = le16_to_cpu(prof->control); in ieee80211_ml_reconfiguration()
6247 removed_links &= sdata->vif.valid_links; in ieee80211_ml_reconfiguration()
6250 if (sdata->u.mgd.removed_links) { in ieee80211_ml_reconfiguration()
6251 sdata->u.mgd.removed_links = 0; in ieee80211_ml_reconfiguration()
6252 wiphy_delayed_work_cancel(sdata->local->hw.wiphy, in ieee80211_ml_reconfiguration()
6253 &sdata->u.mgd.ml_reconf_work); in ieee80211_ml_reconfiguration()
6261 sdata_dereference(sdata->vif.link_conf[link_id], sdata); in ieee80211_ml_reconfiguration()
6272 link_delay = link_conf->beacon_int * in ieee80211_ml_reconfiguration()
6273 (link_removal_timeout[link_id] - 1); in ieee80211_ml_reconfiguration()
6281 sdata->u.mgd.removed_links = removed_links; in ieee80211_ml_reconfiguration()
6282 wiphy_delayed_work_queue(sdata->local->hw.wiphy, in ieee80211_ml_reconfiguration()
6283 &sdata->u.mgd.ml_reconf_work, in ieee80211_ml_reconfiguration()
6295 ret = -EINVAL; in ieee80211_ttlm_set_links()
6302 if (sdata->vif.neg_ttlm.valid) { in ieee80211_ttlm_set_links()
6303 memset(&sdata->vif.neg_ttlm, 0, sizeof(sdata->vif.neg_ttlm)); in ieee80211_ttlm_set_links()
6304 sdata->vif.suspended_links = 0; in ieee80211_ttlm_set_links()
6308 if (sdata->vif.active_links != active_links) { in ieee80211_ttlm_set_links()
6313 active_links &= sdata->vif.active_links; in ieee80211_ttlm_set_links()
6316 BIT(__ffs(sdata->vif.valid_links & in ieee80211_ttlm_set_links()
6318 ret = ieee80211_set_active_links(&sdata->vif, active_links); in ieee80211_ttlm_set_links()
6325 ret = ieee80211_vif_set_links(sdata, sdata->vif.valid_links, in ieee80211_ttlm_set_links()
6332 sdata->vif.suspended_links = suspended_links; in ieee80211_ttlm_set_links()
6333 if (sdata->vif.suspended_links) in ieee80211_ttlm_set_links()
6340 ieee80211_disconnect(&sdata->vif, false); in ieee80211_ttlm_set_links()
6353 new_active_links = sdata->u.mgd.ttlm_info.map & in ieee80211_tid_to_link_map_work()
6354 sdata->vif.valid_links; in ieee80211_tid_to_link_map_work()
6355 new_dormant_links = ~sdata->u.mgd.ttlm_info.map & in ieee80211_tid_to_link_map_work()
6356 sdata->vif.valid_links; in ieee80211_tid_to_link_map_work()
6358 ieee80211_vif_set_links(sdata, sdata->vif.valid_links, 0); in ieee80211_tid_to_link_map_work()
6363 sdata->u.mgd.ttlm_info.active = true; in ieee80211_tid_to_link_map_work()
6364 sdata->u.mgd.ttlm_info.switch_time = 0; in ieee80211_tid_to_link_map_work()
6387 pos = (void *)ttlm->optional; in ieee80211_parse_adv_t2l()
6388 control = ttlm->control; in ieee80211_parse_adv_t2l()
6397 return -EINVAL; in ieee80211_parse_adv_t2l()
6403 ttlm_info->switch_time = get_unaligned_le16(pos); in ieee80211_parse_adv_t2l()
6405 /* Since ttlm_info->switch_time == 0 means no switch time, bump it in ieee80211_parse_adv_t2l()
6408 if (!ttlm_info->switch_time) in ieee80211_parse_adv_t2l()
6409 ttlm_info->switch_time = 1; in ieee80211_parse_adv_t2l()
6414 ttlm_info->duration = pos[0] | pos[1] << 8 | pos[2] << 16; in ieee80211_parse_adv_t2l()
6424 * not advertise a TID-to-link mapping that does not map all TIDs to the in ieee80211_parse_adv_t2l()
6425 * same link set, reject frame if not all links have mapping in ieee80211_parse_adv_t2l()
6430 return -EINVAL; in ieee80211_parse_adv_t2l()
6433 ttlm_info->map = ieee80211_get_ttlm(map_size, pos); in ieee80211_parse_adv_t2l()
6434 if (!ttlm_info->map) { in ieee80211_parse_adv_t2l()
6437 return -EINVAL; in ieee80211_parse_adv_t2l()
6445 if (map != ttlm_info->map) { in ieee80211_parse_adv_t2l()
6448 return -EINVAL; in ieee80211_parse_adv_t2l()
6463 if (!ieee80211_vif_is_mld(&sdata->vif)) in ieee80211_process_adv_ttlm()
6466 if (!elems->ttlm_num) { in ieee80211_process_adv_ttlm()
6467 if (sdata->u.mgd.ttlm_info.switch_time) { in ieee80211_process_adv_ttlm()
6468 /* if a planned TID-to-link mapping was cancelled - in ieee80211_process_adv_ttlm()
6471 wiphy_delayed_work_cancel(sdata->local->hw.wiphy, in ieee80211_process_adv_ttlm()
6472 &sdata->u.mgd.ttlm_work); in ieee80211_process_adv_ttlm()
6473 } else if (sdata->u.mgd.ttlm_info.active) { in ieee80211_process_adv_ttlm()
6474 /* if no TID-to-link element, set to default mapping in in ieee80211_process_adv_ttlm()
6478 sdata->vif.valid_links, in ieee80211_process_adv_ttlm()
6487 memset(&sdata->u.mgd.ttlm_info, 0, in ieee80211_process_adv_ttlm()
6488 sizeof(sdata->u.mgd.ttlm_info)); in ieee80211_process_adv_ttlm()
6492 for (i = 0; i < elems->ttlm_num; i++) { in ieee80211_process_adv_ttlm()
6496 res = ieee80211_parse_adv_t2l(sdata, elems->ttlm[i], in ieee80211_process_adv_ttlm()
6516 delay = st_tu - beacon_ts_tu; in ieee80211_process_adv_ttlm()
6530 /* Link switching can take time, so schedule it in ieee80211_process_adv_ttlm()
6534 delay_jiffies -= in ieee80211_process_adv_ttlm()
6539 sdata->u.mgd.ttlm_info = ttlm_info; in ieee80211_process_adv_ttlm()
6540 wiphy_delayed_work_cancel(sdata->local->hw.wiphy, in ieee80211_process_adv_ttlm()
6541 &sdata->u.mgd.ttlm_work); in ieee80211_process_adv_ttlm()
6542 wiphy_delayed_work_queue(sdata->local->hw.wiphy, in ieee80211_process_adv_ttlm()
6543 &sdata->u.mgd.ttlm_work, in ieee80211_process_adv_ttlm()
6563 if (!ieee80211_mle_size_ok((u8 *)elems->ml_basic, elems->ml_basic_len)) in ieee80211_mgd_check_cross_link_csa()
6566 common_size = ieee80211_mle_common_size((u8 *)elems->ml_basic); in ieee80211_mgd_check_cross_link_csa()
6567 subelems = (u8 *)elems->ml_basic + common_size; in ieee80211_mgd_check_cross_link_csa()
6568 subelems_len = elems->ml_basic_len - common_size; in ieee80211_mgd_check_cross_link_csa()
6572 struct ieee80211_mle_per_sta_profile *prof = (void *)sub->data; in ieee80211_mgd_check_cross_link_csa()
6573 struct ieee80211_link_data *link; in ieee80211_mgd_check_cross_link_csa() local
6576 if (!ieee80211_mle_basic_sta_prof_size_ok(sub->data, in ieee80211_mgd_check_cross_link_csa()
6577 sub->datalen)) in ieee80211_mgd_check_cross_link_csa()
6580 link_id = le16_get_bits(prof->control, in ieee80211_mgd_check_cross_link_csa()
6582 /* need a valid link ID, but also not our own, both AP bugs */ in ieee80211_mgd_check_cross_link_csa()
6587 link = sdata_dereference(sdata->link[link_id], sdata); in ieee80211_mgd_check_cross_link_csa()
6588 if (!link) in ieee80211_mgd_check_cross_link_csa()
6604 struct ieee80211_link_data *link; in ieee80211_mgd_check_cross_link_csa() local
6610 link = sdata_dereference(sdata->link[link_id], sdata); in ieee80211_mgd_check_cross_link_csa()
6611 if (!link) in ieee80211_mgd_check_cross_link_csa()
6619 /* we can defragment in-place, won't use the buffer again */ in ieee80211_mgd_check_cross_link_csa()
6629 prof_elems = ieee802_11_parse_elems(prof->variable + in ieee80211_mgd_check_cross_link_csa()
6630 (prof->sta_info_len - 1), in ieee80211_mgd_check_cross_link_csa()
6631 len - in ieee80211_mgd_check_cross_link_csa()
6632 (prof->sta_info_len - 1), in ieee80211_mgd_check_cross_link_csa()
6635 /* memory allocation failed - let's hope that's transient */ in ieee80211_mgd_check_cross_link_csa()
6648 ieee80211_sta_process_chanswitch(link, 0, 0, elems, prof_elems, in ieee80211_mgd_check_cross_link_csa()
6657 struct ieee80211_vif_cfg *cfg = &sdata->vif.cfg; in ieee80211_mgd_ssid_mismatch()
6660 if (!elems->ssid) in ieee80211_mgd_ssid_mismatch()
6664 if (elems->ssid_len == 0) in ieee80211_mgd_ssid_mismatch()
6667 if (elems->ssid_len != cfg->ssid_len) in ieee80211_mgd_ssid_mismatch()
6671 if (!memcmp(elems->ssid, zero_ssid, elems->ssid_len)) in ieee80211_mgd_ssid_mismatch()
6674 return memcmp(elems->ssid, cfg->ssid, cfg->ssid_len); in ieee80211_mgd_ssid_mismatch()
6677 static void ieee80211_rx_mgmt_beacon(struct ieee80211_link_data *link, in ieee80211_rx_mgmt_beacon() argument
6681 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_rx_mgmt_beacon()
6682 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_rx_mgmt_beacon()
6683 struct ieee80211_bss_conf *bss_conf = link->conf; in ieee80211_rx_mgmt_beacon()
6684 struct ieee80211_vif_cfg *vif_cfg = &sdata->vif.cfg; in ieee80211_rx_mgmt_beacon()
6688 struct ieee80211_local *local = sdata->local; in ieee80211_rx_mgmt_beacon()
6698 u8 *bssid, *variable = mgmt->u.beacon.variable; in ieee80211_rx_mgmt_beacon()
6701 .mode = link->u.mgd.conn.mode, in ieee80211_rx_mgmt_beacon()
6702 .link_id = -1, in ieee80211_rx_mgmt_beacon()
6706 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_rx_mgmt_beacon()
6709 bssid = ieee80211_get_bssid(hdr, len, sdata->vif.type); in ieee80211_rx_mgmt_beacon()
6710 if (ieee80211_is_s1g_beacon(mgmt->frame_control)) { in ieee80211_rx_mgmt_beacon()
6713 if (ieee80211_is_s1g_short_beacon(ext->frame_control)) in ieee80211_rx_mgmt_beacon()
6714 variable = ext->u.s1g_short_beacon.variable; in ieee80211_rx_mgmt_beacon()
6716 variable = ext->u.s1g_beacon.variable; in ieee80211_rx_mgmt_beacon()
6719 baselen = (u8 *) variable - (u8 *) mgmt; in ieee80211_rx_mgmt_beacon()
6724 parse_params.len = len - baselen; in ieee80211_rx_mgmt_beacon()
6727 chanctx_conf = rcu_dereference(bss_conf->chanctx_conf); in ieee80211_rx_mgmt_beacon()
6734 ieee80211_channel_to_khz(chanctx_conf->def.chan)) { in ieee80211_rx_mgmt_beacon()
6738 chan = chanctx_conf->def.chan; in ieee80211_rx_mgmt_beacon()
6741 if (ifmgd->assoc_data && ifmgd->assoc_data->need_beacon && in ieee80211_rx_mgmt_beacon()
6742 !WARN_ON(ieee80211_vif_is_mld(&sdata->vif)) && in ieee80211_rx_mgmt_beacon()
6743 ieee80211_rx_our_beacon(bssid, ifmgd->assoc_data->link[0].bss)) { in ieee80211_rx_mgmt_beacon()
6744 parse_params.bss = ifmgd->assoc_data->link[0].bss; in ieee80211_rx_mgmt_beacon()
6749 ieee80211_rx_bss_info(link, mgmt, len, rx_status); in ieee80211_rx_mgmt_beacon()
6751 if (elems->dtim_period) in ieee80211_rx_mgmt_beacon()
6752 link->u.mgd.dtim_period = elems->dtim_period; in ieee80211_rx_mgmt_beacon()
6753 link->u.mgd.have_beacon = true; in ieee80211_rx_mgmt_beacon()
6754 ifmgd->assoc_data->need_beacon = false; in ieee80211_rx_mgmt_beacon()
6755 if (ieee80211_hw_check(&local->hw, TIMING_BEACON_ONLY) && in ieee80211_rx_mgmt_beacon()
6756 !ieee80211_is_s1g_beacon(hdr->frame_control)) { in ieee80211_rx_mgmt_beacon()
6757 bss_conf->sync_tsf = in ieee80211_rx_mgmt_beacon()
6758 le64_to_cpu(mgmt->u.beacon.timestamp); in ieee80211_rx_mgmt_beacon()
6759 bss_conf->sync_device_ts = in ieee80211_rx_mgmt_beacon()
6760 rx_status->device_timestamp; in ieee80211_rx_mgmt_beacon()
6761 bss_conf->sync_dtim_count = elems->dtim_count; in ieee80211_rx_mgmt_beacon()
6764 if (elems->mbssid_config_ie) in ieee80211_rx_mgmt_beacon()
6765 bss_conf->profile_periodicity = in ieee80211_rx_mgmt_beacon()
6766 elems->mbssid_config_ie->profile_periodicity; in ieee80211_rx_mgmt_beacon()
6768 bss_conf->profile_periodicity = 0; in ieee80211_rx_mgmt_beacon()
6770 if (elems->ext_capab_len >= 11 && in ieee80211_rx_mgmt_beacon()
6771 (elems->ext_capab[10] & WLAN_EXT_CAPA11_EMA_SUPPORT)) in ieee80211_rx_mgmt_beacon()
6772 bss_conf->ema_ap = true; in ieee80211_rx_mgmt_beacon()
6774 bss_conf->ema_ap = false; in ieee80211_rx_mgmt_beacon()
6777 ifmgd->assoc_data->timeout = jiffies; in ieee80211_rx_mgmt_beacon()
6778 ifmgd->assoc_data->timeout_started = true; in ieee80211_rx_mgmt_beacon()
6779 run_again(sdata, ifmgd->assoc_data->timeout); in ieee80211_rx_mgmt_beacon()
6784 if (!ifmgd->associated || in ieee80211_rx_mgmt_beacon()
6785 !ieee80211_rx_our_beacon(bssid, bss_conf->bss)) in ieee80211_rx_mgmt_beacon()
6787 bssid = link->u.mgd.bssid; in ieee80211_rx_mgmt_beacon()
6789 if (!(rx_status->flag & RX_FLAG_NO_SIGNAL_VAL)) in ieee80211_rx_mgmt_beacon()
6790 ieee80211_handle_beacon_sig(link, ifmgd, bss_conf, in ieee80211_rx_mgmt_beacon()
6793 if (ifmgd->flags & IEEE80211_STA_CONNECTION_POLL) { in ieee80211_rx_mgmt_beacon()
6810 if (!ieee80211_is_s1g_beacon(hdr->frame_control)) in ieee80211_rx_mgmt_beacon()
6811 ncrc = crc32_be(0, (void *)&mgmt->u.beacon.beacon_int, 4); in ieee80211_rx_mgmt_beacon()
6812 parse_params.bss = bss_conf->bss; in ieee80211_rx_mgmt_beacon()
6819 if (rx_status->flag & RX_FLAG_DECRYPTED && in ieee80211_rx_mgmt_beacon()
6822 sdata->vif.cfg.ap_addr); in ieee80211_rx_mgmt_beacon()
6827 ncrc = elems->crc; in ieee80211_rx_mgmt_beacon()
6829 if (ieee80211_hw_check(&local->hw, PS_NULLFUNC_STACK) && in ieee80211_rx_mgmt_beacon()
6830 ieee80211_check_tim(elems->tim, elems->tim_len, vif_cfg->aid)) { in ieee80211_rx_mgmt_beacon()
6831 if (local->hw.conf.dynamic_ps_timeout > 0) { in ieee80211_rx_mgmt_beacon()
6832 if (local->hw.conf.flags & IEEE80211_CONF_PS) { in ieee80211_rx_mgmt_beacon()
6833 local->hw.conf.flags &= ~IEEE80211_CONF_PS; in ieee80211_rx_mgmt_beacon()
6838 } else if (!local->pspolling && sdata->u.mgd.powersave) { in ieee80211_rx_mgmt_beacon()
6839 local->pspolling = true; in ieee80211_rx_mgmt_beacon()
6843 * able to send ps-poll frame and receive a in ieee80211_rx_mgmt_beacon()
6853 if (sdata->vif.p2p || in ieee80211_rx_mgmt_beacon()
6854 sdata->vif.driver_flags & IEEE80211_VIF_GET_NOA_UPDATE) { in ieee80211_rx_mgmt_beacon()
6859 len - baselen, in ieee80211_rx_mgmt_beacon()
6863 if (link->u.mgd.p2p_noa_index != noa.index) { in ieee80211_rx_mgmt_beacon()
6865 link->u.mgd.p2p_noa_index = noa.index; in ieee80211_rx_mgmt_beacon()
6866 memcpy(&bss_conf->p2p_noa_attr, &noa, sizeof(noa)); in ieee80211_rx_mgmt_beacon()
6872 link->u.mgd.beacon_crc_valid = false; in ieee80211_rx_mgmt_beacon()
6874 } else if (link->u.mgd.p2p_noa_index != -1) { in ieee80211_rx_mgmt_beacon()
6876 link->u.mgd.p2p_noa_index = -1; in ieee80211_rx_mgmt_beacon()
6877 memset(&bss_conf->p2p_noa_attr, 0, sizeof(bss_conf->p2p_noa_attr)); in ieee80211_rx_mgmt_beacon()
6879 link->u.mgd.beacon_crc_valid = false; in ieee80211_rx_mgmt_beacon()
6891 if (ieee80211_hw_check(&local->hw, TIMING_BEACON_ONLY) && in ieee80211_rx_mgmt_beacon()
6892 !ieee80211_is_s1g_beacon(hdr->frame_control)) { in ieee80211_rx_mgmt_beacon()
6893 bss_conf->sync_tsf = in ieee80211_rx_mgmt_beacon()
6894 le64_to_cpu(mgmt->u.beacon.timestamp); in ieee80211_rx_mgmt_beacon()
6895 bss_conf->sync_device_ts = in ieee80211_rx_mgmt_beacon()
6896 rx_status->device_timestamp; in ieee80211_rx_mgmt_beacon()
6897 bss_conf->sync_dtim_count = elems->dtim_count; in ieee80211_rx_mgmt_beacon()
6900 if ((ncrc == link->u.mgd.beacon_crc && link->u.mgd.beacon_crc_valid) || in ieee80211_rx_mgmt_beacon()
6901 ieee80211_is_s1g_short_beacon(mgmt->frame_control)) in ieee80211_rx_mgmt_beacon()
6903 link->u.mgd.beacon_crc = ncrc; in ieee80211_rx_mgmt_beacon()
6904 link->u.mgd.beacon_crc_valid = true; in ieee80211_rx_mgmt_beacon()
6906 ieee80211_rx_bss_info(link, mgmt, len, rx_status); in ieee80211_rx_mgmt_beacon()
6908 ieee80211_sta_process_chanswitch(link, rx_status->mactime, in ieee80211_rx_mgmt_beacon()
6909 rx_status->device_timestamp, in ieee80211_rx_mgmt_beacon()
6913 /* note that after this elems->ml_basic can no longer be used fully */ in ieee80211_rx_mgmt_beacon()
6914 ieee80211_mgd_check_cross_link_csa(sdata, rx_status->link_id, elems); in ieee80211_rx_mgmt_beacon()
6916 if (!link->u.mgd.disable_wmm_tracking && in ieee80211_rx_mgmt_beacon()
6917 ieee80211_sta_wmm_params(local, link, elems->wmm_param, in ieee80211_rx_mgmt_beacon()
6918 elems->wmm_param_len, in ieee80211_rx_mgmt_beacon()
6919 elems->mu_edca_param_set)) in ieee80211_rx_mgmt_beacon()
6926 if (!link->u.mgd.have_beacon) { in ieee80211_rx_mgmt_beacon()
6928 bss_conf->dtim_period = elems->dtim_period ?: 1; in ieee80211_rx_mgmt_beacon()
6931 link->u.mgd.have_beacon = true; in ieee80211_rx_mgmt_beacon()
6938 if (elems->erp_info) { in ieee80211_rx_mgmt_beacon()
6940 erp_value = elems->erp_info[0]; in ieee80211_rx_mgmt_beacon()
6945 if (!ieee80211_is_s1g_beacon(hdr->frame_control)) in ieee80211_rx_mgmt_beacon()
6946 changed |= ieee80211_handle_bss_capability(link, in ieee80211_rx_mgmt_beacon()
6947 le16_to_cpu(mgmt->u.beacon.capab_info), in ieee80211_rx_mgmt_beacon()
6950 sta = sta_info_get(sdata, sdata->vif.cfg.ap_addr); in ieee80211_rx_mgmt_beacon()
6954 link_sta = rcu_dereference_protected(sta->link[link->link_id], in ieee80211_rx_mgmt_beacon()
6955 lockdep_is_held(&local->hw.wiphy->mtx)); in ieee80211_rx_mgmt_beacon()
6960 if (WARN_ON(!bss_conf->chanreq.oper.chan)) in ieee80211_rx_mgmt_beacon()
6963 sband = local->hw.wiphy->bands[bss_conf->chanreq.oper.chan->band]; in ieee80211_rx_mgmt_beacon()
6965 changed |= ieee80211_recalc_twt_req(sdata, sband, link, link_sta, elems); in ieee80211_rx_mgmt_beacon()
6967 if (ieee80211_config_bw(link, elems, true, &changed)) { in ieee80211_rx_mgmt_beacon()
6978 if (elems->opmode_notif) in ieee80211_rx_mgmt_beacon()
6980 *elems->opmode_notif, in ieee80211_rx_mgmt_beacon()
6981 rx_status->band); in ieee80211_rx_mgmt_beacon()
6983 changed |= ieee80211_handle_pwr_constr(link, chan, mgmt, in ieee80211_rx_mgmt_beacon()
6984 elems->country_elem, in ieee80211_rx_mgmt_beacon()
6985 elems->country_elem_len, in ieee80211_rx_mgmt_beacon()
6986 elems->pwr_constr_elem, in ieee80211_rx_mgmt_beacon()
6987 elems->cisco_dtpc_elem); in ieee80211_rx_mgmt_beacon()
6991 le64_to_cpu(mgmt->u.beacon.timestamp)); in ieee80211_rx_mgmt_beacon()
6993 ieee80211_link_info_change_notify(sdata, link, changed); in ieee80211_rx_mgmt_beacon()
7008 if (sdata->vif.neg_ttlm.valid) in ieee80211_apply_neg_ttlm()
7009 sdata->vif.dormant_links &= ~sdata->vif.suspended_links; in ieee80211_apply_neg_ttlm()
7013 map & sdata->vif.valid_links & ~sdata->vif.dormant_links; in ieee80211_apply_neg_ttlm()
7015 (~map & sdata->vif.valid_links) & ~sdata->vif.dormant_links; in ieee80211_apply_neg_ttlm()
7016 new_dormant_links = sdata->vif.dormant_links | new_suspended_links; in ieee80211_apply_neg_ttlm()
7021 sdata->vif.neg_ttlm = neg_ttlm; in ieee80211_apply_neg_ttlm()
7022 sdata->vif.neg_ttlm.valid = true; in ieee80211_apply_neg_ttlm()
7044 if (memcmp(neg_ttlm->downlink, neg_ttlm->uplink, in ieee80211_neg_ttlm_add_suggested_map()
7045 sizeof(neg_ttlm->downlink))) { in ieee80211_neg_ttlm_add_suggested_map()
7066 cpu_to_le16(neg_ttlm->uplink[tid]) : in ieee80211_neg_ttlm_add_suggested_map()
7067 cpu_to_le16(neg_ttlm->downlink[tid]); in ieee80211_neg_ttlm_add_suggested_map()
7089 struct ieee80211_local *local = sdata->local; in ieee80211_send_neg_ttlm_req()
7096 skb = dev_alloc_skb(local->tx_headroom + hdr_len + ttlm_max_len); in ieee80211_send_neg_ttlm_req()
7100 skb_reserve(skb, local->tx_headroom); in ieee80211_send_neg_ttlm_req()
7102 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | in ieee80211_send_neg_ttlm_req()
7104 memcpy(mgmt->da, sdata->vif.cfg.ap_addr, ETH_ALEN); in ieee80211_send_neg_ttlm_req()
7105 memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); in ieee80211_send_neg_ttlm_req()
7106 memcpy(mgmt->bssid, sdata->vif.cfg.ap_addr, ETH_ALEN); in ieee80211_send_neg_ttlm_req()
7108 mgmt->u.action.category = WLAN_CATEGORY_PROTECTED_EHT; in ieee80211_send_neg_ttlm_req()
7109 mgmt->u.action.u.ttlm_req.action_code = in ieee80211_send_neg_ttlm_req()
7111 mgmt->u.action.u.ttlm_req.dialog_token = dialog_token; in ieee80211_send_neg_ttlm_req()
7122 if (!ieee80211_vif_is_mld(&sdata->vif) || in ieee80211_req_neg_ttlm()
7123 !(sdata->vif.cfg.mld_capa_op & in ieee80211_req_neg_ttlm()
7125 return -EINVAL; in ieee80211_req_neg_ttlm()
7128 if ((params->dlink[i] & ~sdata->vif.valid_links) || in ieee80211_req_neg_ttlm()
7129 (params->ulink[i] & ~sdata->vif.valid_links)) in ieee80211_req_neg_ttlm()
7130 return -EINVAL; in ieee80211_req_neg_ttlm()
7132 neg_ttlm.downlink[i] = params->dlink[i]; in ieee80211_req_neg_ttlm()
7133 neg_ttlm.uplink[i] = params->ulink[i]; in ieee80211_req_neg_ttlm()
7136 if (drv_can_neg_ttlm(sdata->local, sdata, &neg_ttlm) != in ieee80211_req_neg_ttlm()
7138 return -EINVAL; in ieee80211_req_neg_ttlm()
7141 sdata->u.mgd.dialog_token_alloc++; in ieee80211_req_neg_ttlm()
7142 ieee80211_send_neg_ttlm_req(sdata, &sdata->vif.neg_ttlm, in ieee80211_req_neg_ttlm()
7143 sdata->u.mgd.dialog_token_alloc); in ieee80211_req_neg_ttlm()
7144 wiphy_delayed_work_cancel(sdata->local->hw.wiphy, in ieee80211_req_neg_ttlm()
7145 &sdata->u.mgd.neg_ttlm_timeout_work); in ieee80211_req_neg_ttlm()
7146 wiphy_delayed_work_queue(sdata->local->hw.wiphy, in ieee80211_req_neg_ttlm()
7147 &sdata->u.mgd.neg_ttlm_timeout_work, in ieee80211_req_neg_ttlm()
7158 struct ieee80211_local *local = sdata->local; in ieee80211_send_neg_ttlm_res()
7165 skb = dev_alloc_skb(local->tx_headroom + hdr_len + ttlm_max_len); in ieee80211_send_neg_ttlm_res()
7169 skb_reserve(skb, local->tx_headroom); in ieee80211_send_neg_ttlm_res()
7171 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | in ieee80211_send_neg_ttlm_res()
7173 memcpy(mgmt->da, sdata->vif.cfg.ap_addr, ETH_ALEN); in ieee80211_send_neg_ttlm_res()
7174 memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); in ieee80211_send_neg_ttlm_res()
7175 memcpy(mgmt->bssid, sdata->vif.cfg.ap_addr, ETH_ALEN); in ieee80211_send_neg_ttlm_res()
7177 mgmt->u.action.category = WLAN_CATEGORY_PROTECTED_EHT; in ieee80211_send_neg_ttlm_res()
7178 mgmt->u.action.u.ttlm_res.action_code = in ieee80211_send_neg_ttlm_res()
7180 mgmt->u.action.u.ttlm_res.dialog_token = dialog_token; in ieee80211_send_neg_ttlm_res()
7186 mgmt->u.action.u.ttlm_res.status_code = in ieee80211_send_neg_ttlm_res()
7190 mgmt->u.action.u.ttlm_res.status_code = WLAN_STATUS_SUCCESS; in ieee80211_send_neg_ttlm_res()
7193 mgmt->u.action.u.ttlm_res.status_code = in ieee80211_send_neg_ttlm_res()
7214 pos = (void *)ttlm->optional; in ieee80211_parse_neg_ttlm()
7216 control = ttlm->control; in ieee80211_parse_neg_ttlm()
7225 return -EINVAL; in ieee80211_parse_neg_ttlm()
7230 neg_ttlm->downlink[tid] = sdata->vif.valid_links; in ieee80211_parse_neg_ttlm()
7231 neg_ttlm->uplink[tid] = sdata->vif.valid_links; in ieee80211_parse_neg_ttlm()
7241 return -EINVAL; in ieee80211_parse_neg_ttlm()
7259 return -EINVAL; in ieee80211_parse_neg_ttlm()
7267 neg_ttlm->downlink[tid] = map; in ieee80211_parse_neg_ttlm()
7268 neg_ttlm->uplink[tid] = map; in ieee80211_parse_neg_ttlm()
7271 neg_ttlm->downlink[tid] = map; in ieee80211_parse_neg_ttlm()
7274 neg_ttlm->uplink[tid] = map; in ieee80211_parse_neg_ttlm()
7277 return -EINVAL; in ieee80211_parse_neg_ttlm()
7293 BUILD_BUG_ON(ARRAY_SIZE(direction) != ARRAY_SIZE(elems->ttlm)); in ieee80211_process_neg_ttlm_req()
7295 if (!ieee80211_vif_is_mld(&sdata->vif)) in ieee80211_process_neg_ttlm_req()
7298 dialog_token = mgmt->u.action.u.ttlm_req.dialog_token; in ieee80211_process_neg_ttlm_req()
7299 ies_len = len - offsetof(struct ieee80211_mgmt, in ieee80211_process_neg_ttlm_req()
7301 elems = ieee802_11_parse_elems(mgmt->u.action.u.ttlm_req.variable, in ieee80211_process_neg_ttlm_req()
7308 for (i = 0; i < elems->ttlm_num; i++) { in ieee80211_process_neg_ttlm_req()
7309 if (ieee80211_parse_neg_ttlm(sdata, elems->ttlm[i], in ieee80211_process_neg_ttlm_req()
7312 elems->ttlm_num != 1)) { in ieee80211_process_neg_ttlm_req()
7318 if (!elems->ttlm_num || in ieee80211_process_neg_ttlm_req()
7319 (elems->ttlm_num == 2 && direction[0] == direction[1])) { in ieee80211_process_neg_ttlm_req()
7326 (neg_ttlm.downlink[i] & ~sdata->vif.valid_links)) || in ieee80211_process_neg_ttlm_req()
7328 (neg_ttlm.uplink[i] & ~sdata->vif.valid_links))) { in ieee80211_process_neg_ttlm_req()
7334 ttlm_res = drv_can_neg_ttlm(sdata->local, sdata, &neg_ttlm); in ieee80211_process_neg_ttlm_req()
7348 if (!ieee80211_vif_is_mld(&sdata->vif) || in ieee80211_process_neg_ttlm_res()
7349 mgmt->u.action.u.ttlm_req.dialog_token != in ieee80211_process_neg_ttlm_res()
7350 sdata->u.mgd.dialog_token_alloc) in ieee80211_process_neg_ttlm_res()
7353 wiphy_delayed_work_cancel(sdata->local->hw.wiphy, in ieee80211_process_neg_ttlm_res()
7354 &sdata->u.mgd.neg_ttlm_timeout_work); in ieee80211_process_neg_ttlm_res()
7356 /* MLD station sends a TID to link mapping request, mainly to handle in ieee80211_process_neg_ttlm_res()
7364 if (mgmt->u.action.u.ttlm_res.status_code != WLAN_STATUS_SUCCESS) in ieee80211_process_neg_ttlm_res()
7376 if (!sdata->vif.neg_ttlm.valid) in ieee80211_teardown_ttlm_work()
7379 memset(&sdata->vif.neg_ttlm, 0, sizeof(sdata->vif.neg_ttlm)); in ieee80211_teardown_ttlm_work()
7381 sdata->vif.dormant_links & ~sdata->vif.suspended_links; in ieee80211_teardown_ttlm_work()
7382 sdata->vif.suspended_links = 0; in ieee80211_teardown_ttlm_work()
7383 ieee80211_vif_set_links(sdata, sdata->vif.valid_links, in ieee80211_teardown_ttlm_work()
7392 struct ieee80211_local *local = sdata->local; in ieee80211_send_teardown_neg_ttlm()
7399 skb = dev_alloc_skb(local->hw.extra_tx_headroom + frame_len); in ieee80211_send_teardown_neg_ttlm()
7403 skb_reserve(skb, local->hw.extra_tx_headroom); in ieee80211_send_teardown_neg_ttlm()
7405 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | in ieee80211_send_teardown_neg_ttlm()
7407 memcpy(mgmt->da, sdata->vif.cfg.ap_addr, ETH_ALEN); in ieee80211_send_teardown_neg_ttlm()
7408 memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); in ieee80211_send_teardown_neg_ttlm()
7409 memcpy(mgmt->bssid, sdata->vif.cfg.ap_addr, ETH_ALEN); in ieee80211_send_teardown_neg_ttlm()
7411 mgmt->u.action.category = WLAN_CATEGORY_PROTECTED_EHT; in ieee80211_send_teardown_neg_ttlm()
7412 mgmt->u.action.u.ttlm_tear_down.action_code = in ieee80211_send_teardown_neg_ttlm()
7416 info->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS; in ieee80211_send_teardown_neg_ttlm()
7417 info->status_data = IEEE80211_STATUS_TYPE_NEG_TTLM; in ieee80211_send_teardown_neg_ttlm()
7425 struct ieee80211_link_data *link = &sdata->deflink; in ieee80211_sta_rx_queued_ext() local
7430 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_sta_rx_queued_ext()
7432 rx_status = (struct ieee80211_rx_status *) skb->cb; in ieee80211_sta_rx_queued_ext()
7433 hdr = (struct ieee80211_hdr *) skb->data; in ieee80211_sta_rx_queued_ext()
7434 fc = le16_to_cpu(hdr->frame_control); in ieee80211_sta_rx_queued_ext()
7438 ieee80211_rx_mgmt_beacon(link, hdr, skb->len, rx_status); in ieee80211_sta_rx_queued_ext()
7446 struct ieee80211_link_data *link = &sdata->deflink; in ieee80211_sta_rx_queued_mgmt() local
7453 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_sta_rx_queued_mgmt()
7455 rx_status = (struct ieee80211_rx_status *) skb->cb; in ieee80211_sta_rx_queued_mgmt()
7456 mgmt = (struct ieee80211_mgmt *) skb->data; in ieee80211_sta_rx_queued_mgmt()
7457 fc = le16_to_cpu(mgmt->frame_control); in ieee80211_sta_rx_queued_mgmt()
7459 if (rx_status->link_valid) { in ieee80211_sta_rx_queued_mgmt()
7460 link = sdata_dereference(sdata->link[rx_status->link_id], in ieee80211_sta_rx_queued_mgmt()
7462 if (!link) in ieee80211_sta_rx_queued_mgmt()
7468 ieee80211_rx_mgmt_beacon(link, (void *)mgmt, in ieee80211_sta_rx_queued_mgmt()
7469 skb->len, rx_status); in ieee80211_sta_rx_queued_mgmt()
7472 ieee80211_rx_mgmt_probe_resp(link, skb); in ieee80211_sta_rx_queued_mgmt()
7475 ieee80211_rx_mgmt_auth(sdata, mgmt, skb->len); in ieee80211_sta_rx_queued_mgmt()
7478 ieee80211_rx_mgmt_deauth(sdata, mgmt, skb->len); in ieee80211_sta_rx_queued_mgmt()
7481 ieee80211_rx_mgmt_disassoc(sdata, mgmt, skb->len); in ieee80211_sta_rx_queued_mgmt()
7485 ieee80211_rx_mgmt_assoc_resp(sdata, mgmt, skb->len); in ieee80211_sta_rx_queued_mgmt()
7488 if (!sdata->u.mgd.associated || in ieee80211_sta_rx_queued_mgmt()
7489 !ether_addr_equal(mgmt->bssid, sdata->vif.cfg.ap_addr)) in ieee80211_sta_rx_queued_mgmt()
7492 switch (mgmt->u.action.category) { in ieee80211_sta_rx_queued_mgmt()
7494 ies_len = skb->len - in ieee80211_sta_rx_queued_mgmt()
7503 mgmt->u.action.u.chan_switch.variable, in ieee80211_sta_rx_queued_mgmt()
7506 if (elems && !elems->parse_error) { in ieee80211_sta_rx_queued_mgmt()
7510 ieee80211_sta_process_chanswitch(link, in ieee80211_sta_rx_queued_mgmt()
7511 rx_status->mactime, in ieee80211_sta_rx_queued_mgmt()
7512 rx_status->device_timestamp, in ieee80211_sta_rx_queued_mgmt()
7520 ies_len = skb->len - in ieee80211_sta_rx_queued_mgmt()
7532 mgmt->u.action.u.ext_chan_switch.variable, in ieee80211_sta_rx_queued_mgmt()
7535 if (elems && !elems->parse_error) { in ieee80211_sta_rx_queued_mgmt()
7538 if (mgmt->u.action.category == in ieee80211_sta_rx_queued_mgmt()
7545 elems->ext_chansw_ie = in ieee80211_sta_rx_queued_mgmt()
7546 &mgmt->u.action.u.ext_chan_switch.data; in ieee80211_sta_rx_queued_mgmt()
7548 ieee80211_sta_process_chanswitch(link, in ieee80211_sta_rx_queued_mgmt()
7549 rx_status->mactime, in ieee80211_sta_rx_queued_mgmt()
7550 rx_status->device_timestamp, in ieee80211_sta_rx_queued_mgmt()
7567 wiphy_work_queue(sdata->local->hw.wiphy, &sdata->work); in ieee80211_sta_timer()
7584 struct ieee80211_local *local = sdata->local; in ieee80211_auth()
7585 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_auth()
7586 struct ieee80211_mgd_auth_data *auth_data = ifmgd->auth_data; in ieee80211_auth()
7594 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_auth()
7597 return -EINVAL; in ieee80211_auth()
7599 auth_data->tries++; in ieee80211_auth()
7601 if (auth_data->tries > IEEE80211_AUTH_MAX_TRIES) { in ieee80211_auth()
7603 auth_data->ap_addr); in ieee80211_auth()
7609 cfg80211_unlink_bss(local->hw.wiphy, auth_data->bss); in ieee80211_auth()
7611 return -ETIMEDOUT; in ieee80211_auth()
7614 if (auth_data->algorithm == WLAN_AUTH_SAE) in ieee80211_auth()
7617 info.link_id = auth_data->link_id; in ieee80211_auth()
7621 auth_data->ap_addr, auth_data->tries, in ieee80211_auth()
7624 auth_data->expected_transaction = 2; in ieee80211_auth()
7626 if (auth_data->algorithm == WLAN_AUTH_SAE) { in ieee80211_auth()
7627 trans = auth_data->sae_trans; in ieee80211_auth()
7628 status = auth_data->sae_status; in ieee80211_auth()
7629 auth_data->expected_transaction = trans; in ieee80211_auth()
7632 if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) in ieee80211_auth()
7636 ieee80211_send_auth(sdata, trans, auth_data->algorithm, status, in ieee80211_auth()
7637 auth_data->data, auth_data->data_len, in ieee80211_auth()
7638 auth_data->ap_addr, auth_data->ap_addr, in ieee80211_auth()
7642 if (auth_data->algorithm == WLAN_AUTH_SAE) in ieee80211_auth()
7643 auth_data->timeout = jiffies + in ieee80211_auth()
7646 auth_data->timeout = jiffies + IEEE80211_AUTH_TIMEOUT; in ieee80211_auth()
7648 auth_data->timeout = in ieee80211_auth()
7652 auth_data->timeout_started = true; in ieee80211_auth()
7653 run_again(sdata, auth_data->timeout); in ieee80211_auth()
7660 struct ieee80211_mgd_assoc_data *assoc_data = sdata->u.mgd.assoc_data; in ieee80211_do_assoc()
7661 struct ieee80211_local *local = sdata->local; in ieee80211_do_assoc()
7664 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_do_assoc()
7666 assoc_data->tries++; in ieee80211_do_assoc()
7667 assoc_data->comeback = false; in ieee80211_do_assoc()
7668 if (assoc_data->tries > IEEE80211_ASSOC_MAX_TRIES) { in ieee80211_do_assoc()
7670 assoc_data->ap_addr); in ieee80211_do_assoc()
7676 cfg80211_unlink_bss(local->hw.wiphy, in ieee80211_do_assoc()
7677 assoc_data->link[assoc_data->assoc_link_id].bss); in ieee80211_do_assoc()
7679 return -ETIMEDOUT; in ieee80211_do_assoc()
7683 assoc_data->ap_addr, assoc_data->tries, in ieee80211_do_assoc()
7689 if (!ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) { in ieee80211_do_assoc()
7690 assoc_data->timeout = jiffies + IEEE80211_ASSOC_TIMEOUT; in ieee80211_do_assoc()
7691 assoc_data->timeout_started = true; in ieee80211_do_assoc()
7692 run_again(sdata, assoc_data->timeout); in ieee80211_do_assoc()
7694 assoc_data->timeout = in ieee80211_do_assoc()
7697 assoc_data->timeout_started = true; in ieee80211_do_assoc()
7698 run_again(sdata, assoc_data->timeout); in ieee80211_do_assoc()
7707 struct ieee80211_local *local = sdata->local; in ieee80211_mgd_conn_tx_status()
7709 sdata->u.mgd.status_fc = fc; in ieee80211_mgd_conn_tx_status()
7710 sdata->u.mgd.status_acked = acked; in ieee80211_mgd_conn_tx_status()
7711 sdata->u.mgd.status_received = true; in ieee80211_mgd_conn_tx_status()
7713 wiphy_work_queue(local->hw.wiphy, &sdata->work); in ieee80211_mgd_conn_tx_status()
7718 struct ieee80211_local *local = sdata->local; in ieee80211_sta_work()
7719 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_sta_work()
7721 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_sta_work()
7723 if (ifmgd->status_received) { in ieee80211_sta_work()
7724 __le16 fc = ifmgd->status_fc; in ieee80211_sta_work()
7725 bool status_acked = ifmgd->status_acked; in ieee80211_sta_work()
7727 ifmgd->status_received = false; in ieee80211_sta_work()
7728 if (ifmgd->auth_data && ieee80211_is_auth(fc)) { in ieee80211_sta_work()
7730 if (ifmgd->auth_data->algorithm == in ieee80211_sta_work()
7732 ifmgd->auth_data->timeout = in ieee80211_sta_work()
7736 ifmgd->auth_data->timeout = in ieee80211_sta_work()
7739 run_again(sdata, ifmgd->auth_data->timeout); in ieee80211_sta_work()
7741 ifmgd->auth_data->timeout = jiffies - 1; in ieee80211_sta_work()
7743 ifmgd->auth_data->timeout_started = true; in ieee80211_sta_work()
7744 } else if (ifmgd->assoc_data && in ieee80211_sta_work()
7745 !ifmgd->assoc_data->comeback && in ieee80211_sta_work()
7758 ifmgd->assoc_data->timeout = in ieee80211_sta_work()
7760 run_again(sdata, ifmgd->assoc_data->timeout); in ieee80211_sta_work()
7762 ifmgd->assoc_data->timeout = jiffies - 1; in ieee80211_sta_work()
7764 ifmgd->assoc_data->timeout_started = true; in ieee80211_sta_work()
7768 if (ifmgd->auth_data && ifmgd->auth_data->timeout_started && in ieee80211_sta_work()
7769 time_after(jiffies, ifmgd->auth_data->timeout)) { in ieee80211_sta_work()
7770 if (ifmgd->auth_data->done || ifmgd->auth_data->waiting) { in ieee80211_sta_work()
7784 memcpy(ap_addr, ifmgd->auth_data->ap_addr, ETH_ALEN); in ieee80211_sta_work()
7788 cfg80211_auth_timeout(sdata->dev, ap_addr); in ieee80211_sta_work()
7789 drv_event_callback(sdata->local, sdata, &event); in ieee80211_sta_work()
7791 } else if (ifmgd->auth_data && ifmgd->auth_data->timeout_started) in ieee80211_sta_work()
7792 run_again(sdata, ifmgd->auth_data->timeout); in ieee80211_sta_work()
7794 if (ifmgd->assoc_data && ifmgd->assoc_data->timeout_started && in ieee80211_sta_work()
7795 time_after(jiffies, ifmgd->assoc_data->timeout)) { in ieee80211_sta_work()
7796 if ((ifmgd->assoc_data->need_beacon && in ieee80211_sta_work()
7797 !sdata->deflink.u.mgd.have_beacon) || in ieee80211_sta_work()
7806 drv_event_callback(sdata->local, sdata, &event); in ieee80211_sta_work()
7808 } else if (ifmgd->assoc_data && ifmgd->assoc_data->timeout_started) in ieee80211_sta_work()
7809 run_again(sdata, ifmgd->assoc_data->timeout); in ieee80211_sta_work()
7811 if (ifmgd->flags & IEEE80211_STA_CONNECTION_POLL && in ieee80211_sta_work()
7812 ifmgd->associated) { in ieee80211_sta_work()
7813 u8 *bssid = sdata->deflink.u.mgd.bssid; in ieee80211_sta_work()
7816 if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) in ieee80211_sta_work()
7822 if (!ifmgd->probe_send_count) in ieee80211_sta_work()
7824 else if (ifmgd->nullfunc_failed) { in ieee80211_sta_work()
7825 if (ifmgd->probe_send_count < max_tries) { in ieee80211_sta_work()
7828 bssid, ifmgd->probe_send_count, in ieee80211_sta_work()
7839 } else if (time_is_after_jiffies(ifmgd->probe_timeout)) in ieee80211_sta_work()
7840 run_again(sdata, ifmgd->probe_timeout); in ieee80211_sta_work()
7841 else if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) { in ieee80211_sta_work()
7847 } else if (ifmgd->probe_send_count < max_tries) { in ieee80211_sta_work()
7851 ifmgd->probe_send_count, max_tries); in ieee80211_sta_work()
7873 if (WARN_ON(ieee80211_vif_is_mld(&sdata->vif))) in ieee80211_sta_bcn_mon_timer()
7876 if (sdata->vif.bss_conf.csa_active && in ieee80211_sta_bcn_mon_timer()
7877 !sdata->deflink.u.mgd.csa.waiting_bcn) in ieee80211_sta_bcn_mon_timer()
7880 if (sdata->vif.driver_flags & IEEE80211_VIF_BEACON_FILTER) in ieee80211_sta_bcn_mon_timer()
7883 sdata->u.mgd.connection_loss = false; in ieee80211_sta_bcn_mon_timer()
7884 wiphy_work_queue(sdata->local->hw.wiphy, in ieee80211_sta_bcn_mon_timer()
7885 &sdata->u.mgd.beacon_connection_loss_work); in ieee80211_sta_bcn_mon_timer()
7892 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_sta_conn_mon_timer()
7893 struct ieee80211_local *local = sdata->local; in ieee80211_sta_conn_mon_timer()
7897 if (WARN_ON(ieee80211_vif_is_mld(&sdata->vif))) in ieee80211_sta_conn_mon_timer()
7900 if (sdata->vif.bss_conf.csa_active && in ieee80211_sta_conn_mon_timer()
7901 !sdata->deflink.u.mgd.csa.waiting_bcn) in ieee80211_sta_conn_mon_timer()
7904 sta = sta_info_get(sdata, sdata->vif.cfg.ap_addr); in ieee80211_sta_conn_mon_timer()
7908 timeout = sta->deflink.status_stats.last_ack; in ieee80211_sta_conn_mon_timer()
7909 if (time_before(sta->deflink.status_stats.last_ack, sta->deflink.rx_stats.last_rx)) in ieee80211_sta_conn_mon_timer()
7910 timeout = sta->deflink.rx_stats.last_rx; in ieee80211_sta_conn_mon_timer()
7917 mod_timer(&ifmgd->conn_mon_timer, round_jiffies_up(timeout)); in ieee80211_sta_conn_mon_timer()
7921 wiphy_work_queue(local->hw.wiphy, &sdata->u.mgd.monitor_work); in ieee80211_sta_conn_mon_timer()
7936 if (sdata->vif.type == NL80211_IFTYPE_STATION) { in ieee80211_restart_sta_timer()
7940 if (!ieee80211_hw_check(&sdata->local->hw, CONNECTION_MONITOR)) in ieee80211_restart_sta_timer()
7941 wiphy_work_queue(sdata->local->hw.wiphy, in ieee80211_restart_sta_timer()
7942 &sdata->u.mgd.monitor_work); in ieee80211_restart_sta_timer()
7949 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_mgd_quiesce()
7952 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_mgd_quiesce()
7954 if (ifmgd->auth_data || ifmgd->assoc_data) { in ieee80211_mgd_quiesce()
7955 const u8 *ap_addr = ifmgd->auth_data ? in ieee80211_mgd_quiesce()
7956 ifmgd->auth_data->ap_addr : in ieee80211_mgd_quiesce()
7957 ifmgd->assoc_data->ap_addr; in ieee80211_mgd_quiesce()
7968 if (ifmgd->assoc_data) in ieee80211_mgd_quiesce()
7970 if (ifmgd->auth_data) in ieee80211_mgd_quiesce()
7972 cfg80211_tx_mlme_mgmt(sdata->dev, frame_buf, in ieee80211_mgd_quiesce()
7977 /* This is a bit of a hack - we should find a better and more generic in ieee80211_mgd_quiesce()
7994 if (ifmgd->associated && !sdata->local->wowlan) { in ieee80211_mgd_quiesce()
8001 memcpy(bssid, sdata->vif.cfg.ap_addr, ETH_ALEN); in ieee80211_mgd_quiesce()
8009 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_sta_restart()
8011 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_sta_restart()
8013 if (!ifmgd->associated) in ieee80211_sta_restart()
8016 if (sdata->flags & IEEE80211_SDATA_DISCONNECT_RESUME) { in ieee80211_sta_restart()
8017 sdata->flags &= ~IEEE80211_SDATA_DISCONNECT_RESUME; in ieee80211_sta_restart()
8025 if (sdata->flags & IEEE80211_SDATA_DISCONNECT_HW_RESTART) { in ieee80211_sta_restart()
8026 sdata->flags &= ~IEEE80211_SDATA_DISCONNECT_HW_RESTART; in ieee80211_sta_restart()
8038 struct ieee80211_link_data *link = in ieee80211_request_smps_mgd_work() local
8042 __ieee80211_request_smps_mgd(link->sdata, link, in ieee80211_request_smps_mgd_work()
8043 link->u.mgd.driver_smps_mode); in ieee80211_request_smps_mgd_work()
8049 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_sta_setup_sdata()
8051 wiphy_work_init(&ifmgd->monitor_work, ieee80211_sta_monitor_work); in ieee80211_sta_setup_sdata()
8052 wiphy_work_init(&ifmgd->beacon_connection_loss_work, in ieee80211_sta_setup_sdata()
8054 wiphy_work_init(&ifmgd->csa_connection_drop_work, in ieee80211_sta_setup_sdata()
8056 wiphy_delayed_work_init(&ifmgd->tdls_peer_del_work, in ieee80211_sta_setup_sdata()
8058 wiphy_delayed_work_init(&ifmgd->ml_reconf_work, in ieee80211_sta_setup_sdata()
8060 timer_setup(&ifmgd->timer, ieee80211_sta_timer, 0); in ieee80211_sta_setup_sdata()
8061 timer_setup(&ifmgd->bcn_mon_timer, ieee80211_sta_bcn_mon_timer, 0); in ieee80211_sta_setup_sdata()
8062 timer_setup(&ifmgd->conn_mon_timer, ieee80211_sta_conn_mon_timer, 0); in ieee80211_sta_setup_sdata()
8063 wiphy_delayed_work_init(&ifmgd->tx_tspec_wk, in ieee80211_sta_setup_sdata()
8065 wiphy_delayed_work_init(&ifmgd->ttlm_work, in ieee80211_sta_setup_sdata()
8067 wiphy_delayed_work_init(&ifmgd->neg_ttlm_timeout_work, in ieee80211_sta_setup_sdata()
8069 wiphy_work_init(&ifmgd->teardown_ttlm_work, in ieee80211_sta_setup_sdata()
8072 ifmgd->flags = 0; in ieee80211_sta_setup_sdata()
8073 ifmgd->powersave = sdata->wdev.ps; in ieee80211_sta_setup_sdata()
8074 ifmgd->uapsd_queues = sdata->local->hw.uapsd_queues; in ieee80211_sta_setup_sdata()
8075 ifmgd->uapsd_max_sp_len = sdata->local->hw.uapsd_max_sp_len; in ieee80211_sta_setup_sdata()
8077 spin_lock_init(&ifmgd->teardown_lock); in ieee80211_sta_setup_sdata()
8078 ifmgd->teardown_skb = NULL; in ieee80211_sta_setup_sdata()
8079 ifmgd->orig_teardown_skb = NULL; in ieee80211_sta_setup_sdata()
8080 ifmgd->mcast_seq_last = IEEE80211_SN_MODULO; in ieee80211_sta_setup_sdata()
8086 struct ieee80211_link_data *link = in ieee80211_recalc_smps_work() local
8090 ieee80211_recalc_smps(link->sdata, link); in ieee80211_recalc_smps_work()
8093 void ieee80211_mgd_setup_link(struct ieee80211_link_data *link) in ieee80211_mgd_setup_link() argument
8095 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_mgd_setup_link()
8096 struct ieee80211_local *local = sdata->local; in ieee80211_mgd_setup_link()
8097 unsigned int link_id = link->link_id; in ieee80211_mgd_setup_link()
8099 link->u.mgd.p2p_noa_index = -1; in ieee80211_mgd_setup_link()
8100 link->conf->bssid = link->u.mgd.bssid; in ieee80211_mgd_setup_link()
8101 link->smps_mode = IEEE80211_SMPS_OFF; in ieee80211_mgd_setup_link()
8103 wiphy_work_init(&link->u.mgd.request_smps_work, in ieee80211_mgd_setup_link()
8105 wiphy_work_init(&link->u.mgd.recalc_smps, in ieee80211_mgd_setup_link()
8107 if (local->hw.wiphy->features & NL80211_FEATURE_DYNAMIC_SMPS) in ieee80211_mgd_setup_link()
8108 link->u.mgd.req_smps = IEEE80211_SMPS_AUTOMATIC; in ieee80211_mgd_setup_link()
8110 link->u.mgd.req_smps = IEEE80211_SMPS_OFF; in ieee80211_mgd_setup_link()
8112 wiphy_delayed_work_init(&link->u.mgd.csa.switch_work, in ieee80211_mgd_setup_link()
8115 ieee80211_clear_tpe(&link->conf->tpe); in ieee80211_mgd_setup_link()
8117 if (sdata->u.mgd.assoc_data) in ieee80211_mgd_setup_link()
8118 ether_addr_copy(link->conf->addr, in ieee80211_mgd_setup_link()
8119 sdata->u.mgd.assoc_data->link[link_id].addr); in ieee80211_mgd_setup_link()
8120 else if (!is_valid_ether_addr(link->conf->addr)) in ieee80211_mgd_setup_link()
8121 eth_random_addr(link->conf->addr); in ieee80211_mgd_setup_link()
8131 list_for_each_entry_rcu(sdata, &local->interfaces, list) { in ieee80211_mlme_notify_scan_completed()
8144 struct ieee80211_local *local = sdata->local; in ieee80211_prep_connection()
8145 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_prep_connection()
8146 struct ieee80211_bss *bss = (void *)cbss->priv; in ieee80211_prep_connection()
8148 struct ieee80211_link_data *link; in ieee80211_prep_connection() local
8156 return -EINVAL; in ieee80211_prep_connection()
8160 return -EINVAL; in ieee80211_prep_connection()
8161 ap_mld_addr = cbss->bssid; in ieee80211_prep_connection()
8170 link = sdata_dereference(sdata->link[link_id], sdata); in ieee80211_prep_connection()
8171 if (WARN_ON(!link)) { in ieee80211_prep_connection()
8172 err = -ENOLINK; in ieee80211_prep_connection()
8176 if (WARN_ON(!ifmgd->auth_data && !ifmgd->assoc_data)) { in ieee80211_prep_connection()
8177 err = -EINVAL; in ieee80211_prep_connection()
8182 if (local->in_reconfig) { in ieee80211_prep_connection()
8183 err = -EBUSY; in ieee80211_prep_connection()
8196 link_id, cbss->bssid, in ieee80211_prep_connection()
8202 err = -ENOMEM; in ieee80211_prep_connection()
8206 new_sta->sta.mlo = mlo; in ieee80211_prep_connection()
8211 * new channel. We can't - completely race-free - change the basic in ieee80211_prep_connection()
8215 * call that from changing the channel - only for IDLE and perhaps in ieee80211_prep_connection()
8227 link_sta = rcu_dereference(new_sta->link[link_id]); in ieee80211_prep_connection()
8231 err = -EINVAL; in ieee80211_prep_connection()
8235 err = ieee80211_mgd_setup_link_sta(link, new_sta, in ieee80211_prep_connection()
8243 memcpy(link->u.mgd.bssid, cbss->bssid, ETH_ALEN); in ieee80211_prep_connection()
8246 link->conf->beacon_int = cbss->beacon_interval; in ieee80211_prep_connection()
8247 ies = rcu_dereference(cbss->beacon_ies); in ieee80211_prep_connection()
8249 link->conf->sync_tsf = ies->tsf; in ieee80211_prep_connection()
8250 link->conf->sync_device_ts = in ieee80211_prep_connection()
8251 bss->device_ts_beacon; in ieee80211_prep_connection()
8254 &link->conf->sync_dtim_count, in ieee80211_prep_connection()
8256 } else if (!ieee80211_hw_check(&sdata->local->hw, in ieee80211_prep_connection()
8258 ies = rcu_dereference(cbss->proberesp_ies); in ieee80211_prep_connection()
8259 /* must be non-NULL since beacon IEs were NULL */ in ieee80211_prep_connection()
8260 link->conf->sync_tsf = ies->tsf; in ieee80211_prep_connection()
8261 link->conf->sync_device_ts = in ieee80211_prep_connection()
8262 bss->device_ts_presp; in ieee80211_prep_connection()
8263 link->conf->sync_dtim_count = 0; in ieee80211_prep_connection()
8265 link->conf->sync_tsf = 0; in ieee80211_prep_connection()
8266 link->conf->sync_device_ts = 0; in ieee80211_prep_connection()
8267 link->conf->sync_dtim_count = 0; in ieee80211_prep_connection()
8279 link->u.mgd.conn = *conn; in ieee80211_prep_connection()
8280 err = ieee80211_prep_channel(sdata, link, link->link_id, cbss, in ieee80211_prep_connection()
8281 mlo, &link->u.mgd.conn); in ieee80211_prep_connection()
8288 *conn = link->u.mgd.conn; in ieee80211_prep_connection()
8296 ieee80211_link_info_change_notify(sdata, link, in ieee80211_prep_connection()
8313 WARN_ON_ONCE(!ether_addr_equal(link->u.mgd.bssid, cbss->bssid)); in ieee80211_prep_connection()
8316 if (local->scanning) in ieee80211_prep_connection()
8322 ieee80211_link_release_channel(link); in ieee80211_prep_connection()
8340 ies->data, ies->len); in ieee80211_mgd_csa_present()
8341 if (csa_elem && csa_elem->datalen == sizeof(*csa)) in ieee80211_mgd_csa_present()
8342 csa = (void *)csa_elem->data; in ieee80211_mgd_csa_present()
8345 ies->data, ies->len); in ieee80211_mgd_csa_present()
8346 if (ecsa_elem && ecsa_elem->datalen == sizeof(*ecsa)) in ieee80211_mgd_csa_present()
8347 ecsa = (void *)ecsa_elem->data; in ieee80211_mgd_csa_present()
8349 if (csa && csa->count == 0) in ieee80211_mgd_csa_present()
8351 if (csa && !csa->mode && csa->new_ch_num == cur_channel) in ieee80211_mgd_csa_present()
8354 if (ecsa && ecsa->count == 0) in ieee80211_mgd_csa_present()
8356 if (ecsa && !ecsa->mode && ecsa->new_ch_num == cur_channel) in ieee80211_mgd_csa_present()
8361 "Ignoring ECSA in probe response - was considered stuck!\n"); in ieee80211_mgd_csa_present()
8374 cur_channel = ieee80211_frequency_to_channel(bss->channel->center_freq); in ieee80211_mgd_csa_in_process()
8378 rcu_dereference(bss->beacon_ies), in ieee80211_mgd_csa_in_process()
8385 rcu_dereference(bss->proberesp_ies), in ieee80211_mgd_csa_in_process()
8386 cur_channel, bss->proberesp_ecsa_stuck)) { in ieee80211_mgd_csa_in_process()
8401 struct ieee80211_local *local = sdata->local; in ieee80211_mgd_auth()
8402 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_mgd_auth()
8405 struct ieee80211_link_data *link; in ieee80211_mgd_auth() local
8412 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_mgd_auth()
8416 switch (req->auth_type) { in ieee80211_mgd_auth()
8422 return -EOPNOTSUPP; in ieee80211_mgd_auth()
8444 return -EOPNOTSUPP; in ieee80211_mgd_auth()
8447 if (ifmgd->assoc_data) in ieee80211_mgd_auth()
8448 return -EBUSY; in ieee80211_mgd_auth()
8450 if (ieee80211_mgd_csa_in_process(sdata, req->bss)) { in ieee80211_mgd_auth()
8452 return -EINVAL; in ieee80211_mgd_auth()
8455 auth_data = kzalloc(sizeof(*auth_data) + req->auth_data_len + in ieee80211_mgd_auth()
8456 req->ie_len, GFP_KERNEL); in ieee80211_mgd_auth()
8458 return -ENOMEM; in ieee80211_mgd_auth()
8460 memcpy(auth_data->ap_addr, in ieee80211_mgd_auth()
8461 req->ap_mld_addr ?: req->bss->bssid, in ieee80211_mgd_auth()
8463 auth_data->bss = req->bss; in ieee80211_mgd_auth()
8464 auth_data->link_id = req->link_id; in ieee80211_mgd_auth()
8466 if (req->auth_data_len >= 4) { in ieee80211_mgd_auth()
8467 if (req->auth_type == NL80211_AUTHTYPE_SAE) { in ieee80211_mgd_auth()
8468 __le16 *pos = (__le16 *) req->auth_data; in ieee80211_mgd_auth()
8470 auth_data->sae_trans = le16_to_cpu(pos[0]); in ieee80211_mgd_auth()
8471 auth_data->sae_status = le16_to_cpu(pos[1]); in ieee80211_mgd_auth()
8473 memcpy(auth_data->data, req->auth_data + 4, in ieee80211_mgd_auth()
8474 req->auth_data_len - 4); in ieee80211_mgd_auth()
8475 auth_data->data_len += req->auth_data_len - 4; in ieee80211_mgd_auth()
8480 * removal and re-addition of the STA entry in in ieee80211_mgd_auth()
8483 cont_auth = ifmgd->auth_data && req->bss == ifmgd->auth_data->bss && in ieee80211_mgd_auth()
8484 ifmgd->auth_data->link_id == req->link_id; in ieee80211_mgd_auth()
8486 if (req->ie && req->ie_len) { in ieee80211_mgd_auth()
8487 memcpy(&auth_data->data[auth_data->data_len], in ieee80211_mgd_auth()
8488 req->ie, req->ie_len); in ieee80211_mgd_auth()
8489 auth_data->data_len += req->ie_len; in ieee80211_mgd_auth()
8492 if (req->key && req->key_len) { in ieee80211_mgd_auth()
8493 auth_data->key_len = req->key_len; in ieee80211_mgd_auth()
8494 auth_data->key_idx = req->key_idx; in ieee80211_mgd_auth()
8495 memcpy(auth_data->key, req->key, req->key_len); in ieee80211_mgd_auth()
8498 auth_data->algorithm = auth_alg; in ieee80211_mgd_auth()
8502 if (ifmgd->auth_data) { in ieee80211_mgd_auth()
8503 if (cont_auth && req->auth_type == NL80211_AUTHTYPE_SAE) { in ieee80211_mgd_auth()
8504 auth_data->peer_confirmed = in ieee80211_mgd_auth()
8505 ifmgd->auth_data->peer_confirmed; in ieee80211_mgd_auth()
8511 ifmgd->auth_data = auth_data; in ieee80211_mgd_auth()
8518 if (cont_auth && req->auth_type == NL80211_AUTHTYPE_SAE && in ieee80211_mgd_auth()
8519 auth_data->peer_confirmed && auth_data->sae_trans == 2) in ieee80211_mgd_auth()
8522 if (ifmgd->associated) { in ieee80211_mgd_auth()
8527 sdata->vif.cfg.ap_addr, auth_data->ap_addr); in ieee80211_mgd_auth()
8539 memcpy(sdata->vif.cfg.ap_addr, auth_data->ap_addr, ETH_ALEN); in ieee80211_mgd_auth()
8541 bss = (void *)req->bss->priv; in ieee80211_mgd_auth()
8542 wmm_used = bss->wmm_used && (local->hw.queues >= IEEE80211_NUM_ACS); in ieee80211_mgd_auth()
8544 sband = local->hw.wiphy->bands[req->bss->channel->band]; in ieee80211_mgd_auth()
8549 err = ieee80211_prep_connection(sdata, req->bss, req->link_id, in ieee80211_mgd_auth()
8550 req->ap_mld_addr, cont_auth, in ieee80211_mgd_auth()
8555 if (req->link_id >= 0) in ieee80211_mgd_auth()
8556 link = sdata_dereference(sdata->link[req->link_id], sdata); in ieee80211_mgd_auth()
8558 link = &sdata->deflink; in ieee80211_mgd_auth()
8560 if (WARN_ON(!link)) { in ieee80211_mgd_auth()
8561 err = -ENOLINK; in ieee80211_mgd_auth()
8566 auth_data->ap_addr, link->conf->addr); in ieee80211_mgd_auth()
8570 sta_info_destroy_addr(sdata, auth_data->ap_addr); in ieee80211_mgd_auth()
8575 cfg80211_ref_bss(local->hw.wiphy, auth_data->bss); in ieee80211_mgd_auth()
8579 if (!ieee80211_vif_is_mld(&sdata->vif)) { in ieee80211_mgd_auth()
8580 eth_zero_addr(sdata->deflink.u.mgd.bssid); in ieee80211_mgd_auth()
8581 ieee80211_link_info_change_notify(sdata, &sdata->deflink, in ieee80211_mgd_auth()
8583 ieee80211_link_release_channel(&sdata->deflink); in ieee80211_mgd_auth()
8585 ifmgd->auth_data = NULL; in ieee80211_mgd_auth()
8597 struct ieee80211_local *local = sdata->local; in ieee80211_setup_assoc_link()
8600 struct ieee80211_link_data *link; in ieee80211_setup_assoc_link() local
8604 cbss = assoc_data->link[link_id].bss; in ieee80211_setup_assoc_link()
8608 bss = (void *)cbss->priv; in ieee80211_setup_assoc_link()
8610 sband = local->hw.wiphy->bands[cbss->channel->band]; in ieee80211_setup_assoc_link()
8614 link = sdata_dereference(sdata->link[link_id], sdata); in ieee80211_setup_assoc_link()
8615 if (WARN_ON(!link)) in ieee80211_setup_assoc_link()
8619 if (!req->ap_mld_addr) { in ieee80211_setup_assoc_link()
8620 assoc_data->supp_rates = bss->supp_rates; in ieee80211_setup_assoc_link()
8621 assoc_data->supp_rates_len = bss->supp_rates_len; in ieee80211_setup_assoc_link()
8624 /* copy and link elems for the STA profile */ in ieee80211_setup_assoc_link()
8625 if (req->links[link_id].elems_len) { in ieee80211_setup_assoc_link()
8626 memcpy(assoc_data->ie_pos, req->links[link_id].elems, in ieee80211_setup_assoc_link()
8627 req->links[link_id].elems_len); in ieee80211_setup_assoc_link()
8628 assoc_data->link[link_id].elems = assoc_data->ie_pos; in ieee80211_setup_assoc_link()
8629 assoc_data->link[link_id].elems_len = req->links[link_id].elems_len; in ieee80211_setup_assoc_link()
8630 assoc_data->ie_pos += req->links[link_id].elems_len; in ieee80211_setup_assoc_link()
8633 link->u.mgd.beacon_crc_valid = false; in ieee80211_setup_assoc_link()
8634 link->u.mgd.dtim_period = 0; in ieee80211_setup_assoc_link()
8635 link->u.mgd.have_beacon = false; in ieee80211_setup_assoc_link()
8638 if (conn->mode >= IEEE80211_CONN_MODE_HT) { in ieee80211_setup_assoc_link()
8641 memcpy(&sta_ht_cap, &sband->ht_cap, sizeof(sta_ht_cap)); in ieee80211_setup_assoc_link()
8646 bss_ies = rcu_dereference(cbss->beacon_ies); in ieee80211_setup_assoc_link()
8651 &link->u.mgd.dtim_period); in ieee80211_setup_assoc_link()
8653 sdata->deflink.u.mgd.have_beacon = true; in ieee80211_setup_assoc_link()
8655 if (ieee80211_hw_check(&local->hw, TIMING_BEACON_ONLY)) { in ieee80211_setup_assoc_link()
8656 link->conf->sync_tsf = bss_ies->tsf; in ieee80211_setup_assoc_link()
8657 link->conf->sync_device_ts = bss->device_ts_beacon; in ieee80211_setup_assoc_link()
8658 link->conf->sync_dtim_count = dtim_count; in ieee80211_setup_assoc_link()
8661 bss_ies = rcu_dereference(cbss->ies); in ieee80211_setup_assoc_link()
8668 bss_ies->data, bss_ies->len); in ieee80211_setup_assoc_link()
8669 if (elem && elem->datalen >= 3) in ieee80211_setup_assoc_link()
8670 link->conf->profile_periodicity = elem->data[2]; in ieee80211_setup_assoc_link()
8672 link->conf->profile_periodicity = 0; in ieee80211_setup_assoc_link()
8675 bss_ies->data, bss_ies->len); in ieee80211_setup_assoc_link()
8676 if (elem && elem->datalen >= 11 && in ieee80211_setup_assoc_link()
8677 (elem->data[10] & WLAN_EXT_CAPA11_EMA_SUPPORT)) in ieee80211_setup_assoc_link()
8678 link->conf->ema_ap = true; in ieee80211_setup_assoc_link()
8680 link->conf->ema_ap = false; in ieee80211_setup_assoc_link()
8684 if (bss->corrupt_data) { in ieee80211_setup_assoc_link()
8687 if (bss->corrupt_data & IEEE80211_BSS_CORRUPT_BEACON) { in ieee80211_setup_assoc_link()
8688 if (bss->corrupt_data & IEEE80211_BSS_CORRUPT_PROBE_RESP) in ieee80211_setup_assoc_link()
8692 } else if (bss->corrupt_data & IEEE80211_BSS_CORRUPT_PROBE_RESP) { in ieee80211_setup_assoc_link()
8696 cbss->bssid, corrupt_type); in ieee80211_setup_assoc_link()
8699 if (link->u.mgd.req_smps == IEEE80211_SMPS_AUTOMATIC) { in ieee80211_setup_assoc_link()
8700 if (sdata->u.mgd.powersave) in ieee80211_setup_assoc_link()
8701 link->smps_mode = IEEE80211_SMPS_DYNAMIC; in ieee80211_setup_assoc_link()
8703 link->smps_mode = IEEE80211_SMPS_OFF; in ieee80211_setup_assoc_link()
8705 link->smps_mode = link->u.mgd.req_smps; in ieee80211_setup_assoc_link()
8714 struct cfg80211_bss *cbss = assoc_data->link[link_id].bss; in ieee80211_mgd_get_ap_ht_vht_capa()
8715 enum nl80211_band band = cbss->channel->band; in ieee80211_mgd_get_ap_ht_vht_capa()
8724 if (assoc_data->link[link_id].conn.mode < IEEE80211_CONN_MODE_HT) in ieee80211_mgd_get_ap_ht_vht_capa()
8729 if (!elem || elem->datalen < sizeof(struct ieee80211_ht_operation)) { in ieee80211_mgd_get_ap_ht_vht_capa()
8731 cbss->bssid); in ieee80211_mgd_get_ap_ht_vht_capa()
8732 err = -EINVAL; in ieee80211_mgd_get_ap_ht_vht_capa()
8735 assoc_data->link[link_id].ap_ht_param = in ieee80211_mgd_get_ap_ht_vht_capa()
8736 ((struct ieee80211_ht_operation *)(elem->data))->ht_param; in ieee80211_mgd_get_ap_ht_vht_capa()
8739 if (assoc_data->link[link_id].conn.mode < IEEE80211_CONN_MODE_VHT) in ieee80211_mgd_get_ap_ht_vht_capa()
8743 sband = sdata->local->hw.wiphy->bands[band]; in ieee80211_mgd_get_ap_ht_vht_capa()
8744 if (!sband->vht_cap.vht_supported) in ieee80211_mgd_get_ap_ht_vht_capa()
8754 if (!elem || elem->datalen < sizeof(struct ieee80211_vht_cap)) { in ieee80211_mgd_get_ap_ht_vht_capa()
8756 cbss->bssid); in ieee80211_mgd_get_ap_ht_vht_capa()
8757 err = -EINVAL; in ieee80211_mgd_get_ap_ht_vht_capa()
8760 memcpy(&assoc_data->link[link_id].ap_vht_cap, elem->data, in ieee80211_mgd_get_ap_ht_vht_capa()
8773 unsigned int assoc_link_id = req->link_id < 0 ? 0 : req->link_id; in ieee80211_mgd_assoc()
8774 struct ieee80211_local *local = sdata->local; in ieee80211_mgd_assoc()
8775 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_mgd_assoc()
8778 struct ieee80211_vif_cfg *vif_cfg = &sdata->vif.cfg; in ieee80211_mgd_assoc()
8779 struct ieee80211_link_data *link; in ieee80211_mgd_assoc() local
8784 size_t size = sizeof(*assoc_data) + req->ie_len; in ieee80211_mgd_assoc()
8787 size += req->links[i].elems_len; in ieee80211_mgd_assoc()
8789 /* FIXME: no support for 4-addr MLO yet */ in ieee80211_mgd_assoc()
8790 if (sdata->u.mgd.use_4addr && req->link_id >= 0) in ieee80211_mgd_assoc()
8791 return -EOPNOTSUPP; in ieee80211_mgd_assoc()
8795 return -ENOMEM; in ieee80211_mgd_assoc()
8797 cbss = req->link_id < 0 ? req->bss : req->links[req->link_id].bss; in ieee80211_mgd_assoc()
8801 err = -EINVAL; in ieee80211_mgd_assoc()
8807 if (!ssid_elem || ssid_elem->datalen > sizeof(assoc_data->ssid)) { in ieee80211_mgd_assoc()
8809 err = -EINVAL; in ieee80211_mgd_assoc()
8813 memcpy(assoc_data->ssid, ssid_elem->data, ssid_elem->datalen); in ieee80211_mgd_assoc()
8814 assoc_data->ssid_len = ssid_elem->datalen; in ieee80211_mgd_assoc()
8817 if (req->ap_mld_addr) in ieee80211_mgd_assoc()
8818 memcpy(assoc_data->ap_addr, req->ap_mld_addr, ETH_ALEN); in ieee80211_mgd_assoc()
8820 memcpy(assoc_data->ap_addr, cbss->bssid, ETH_ALEN); in ieee80211_mgd_assoc()
8822 if (ifmgd->associated) { in ieee80211_mgd_assoc()
8827 sdata->vif.cfg.ap_addr, assoc_data->ap_addr); in ieee80211_mgd_assoc()
8838 memcpy(&ifmgd->ht_capa, &req->ht_capa, sizeof(ifmgd->ht_capa)); in ieee80211_mgd_assoc()
8839 memcpy(&ifmgd->ht_capa_mask, &req->ht_capa_mask, in ieee80211_mgd_assoc()
8840 sizeof(ifmgd->ht_capa_mask)); in ieee80211_mgd_assoc()
8842 memcpy(&ifmgd->vht_capa, &req->vht_capa, sizeof(ifmgd->vht_capa)); in ieee80211_mgd_assoc()
8843 memcpy(&ifmgd->vht_capa_mask, &req->vht_capa_mask, in ieee80211_mgd_assoc()
8844 sizeof(ifmgd->vht_capa_mask)); in ieee80211_mgd_assoc()
8846 memcpy(&ifmgd->s1g_capa, &req->s1g_capa, sizeof(ifmgd->s1g_capa)); in ieee80211_mgd_assoc()
8847 memcpy(&ifmgd->s1g_capa_mask, &req->s1g_capa_mask, in ieee80211_mgd_assoc()
8848 sizeof(ifmgd->s1g_capa_mask)); in ieee80211_mgd_assoc()
8851 match_auth = ifmgd->auth_data && in ieee80211_mgd_assoc()
8852 ether_addr_equal(ifmgd->auth_data->ap_addr, in ieee80211_mgd_assoc()
8853 assoc_data->ap_addr) && in ieee80211_mgd_assoc()
8854 ifmgd->auth_data->link_id == req->link_id; in ieee80211_mgd_assoc()
8856 if (req->ap_mld_addr) { in ieee80211_mgd_assoc()
8859 if (req->flags & (ASSOC_REQ_DISABLE_HT | in ieee80211_mgd_assoc()
8863 err = -EINVAL; in ieee80211_mgd_assoc()
8869 struct cfg80211_bss *link_cbss = req->links[i].bss; in ieee80211_mgd_assoc()
8875 bss = (void *)link_cbss->priv; in ieee80211_mgd_assoc()
8877 if (!bss->wmm_used) { in ieee80211_mgd_assoc()
8878 err = -EINVAL; in ieee80211_mgd_assoc()
8879 req->links[i].error = err; in ieee80211_mgd_assoc()
8883 if (link_cbss->channel->band == NL80211_BAND_S1GHZ) { in ieee80211_mgd_assoc()
8884 err = -EINVAL; in ieee80211_mgd_assoc()
8885 req->links[i].error = err; in ieee80211_mgd_assoc()
8889 link = sdata_dereference(sdata->link[i], sdata); in ieee80211_mgd_assoc()
8890 if (link) in ieee80211_mgd_assoc()
8891 ether_addr_copy(assoc_data->link[i].addr, in ieee80211_mgd_assoc()
8892 link->conf->addr); in ieee80211_mgd_assoc()
8894 eth_random_addr(assoc_data->link[i].addr); in ieee80211_mgd_assoc()
8895 sband = local->hw.wiphy->bands[link_cbss->channel->band]; in ieee80211_mgd_assoc()
8897 if (match_auth && i == assoc_link_id && link) in ieee80211_mgd_assoc()
8898 assoc_data->link[i].conn = link->u.mgd.conn; in ieee80211_mgd_assoc()
8900 assoc_data->link[i].conn = in ieee80211_mgd_assoc()
8904 &assoc_data->link[i].conn); in ieee80211_mgd_assoc()
8905 assoc_data->link[i].bss = link_cbss; in ieee80211_mgd_assoc()
8906 assoc_data->link[i].disabled = req->links[i].disabled; in ieee80211_mgd_assoc()
8908 if (!bss->uapsd_supported) in ieee80211_mgd_assoc()
8911 if (assoc_data->link[i].conn.mode < IEEE80211_CONN_MODE_EHT) { in ieee80211_mgd_assoc()
8912 err = -EINVAL; in ieee80211_mgd_assoc()
8913 req->links[i].error = err; in ieee80211_mgd_assoc()
8920 err = -EINVAL; in ieee80211_mgd_assoc()
8921 req->links[i].error = err; in ieee80211_mgd_assoc()
8926 assoc_data->wmm = true; in ieee80211_mgd_assoc()
8929 struct ieee80211_bss *bss = (void *)cbss->priv; in ieee80211_mgd_assoc()
8931 memcpy(assoc_data->link[0].addr, sdata->vif.addr, ETH_ALEN); in ieee80211_mgd_assoc()
8932 assoc_data->s1g = cbss->channel->band == NL80211_BAND_S1GHZ; in ieee80211_mgd_assoc()
8934 assoc_data->wmm = bss->wmm_used && in ieee80211_mgd_assoc()
8935 (local->hw.queues >= IEEE80211_NUM_ACS); in ieee80211_mgd_assoc()
8937 if (cbss->channel->band == NL80211_BAND_6GHZ && in ieee80211_mgd_assoc()
8938 req->flags & (ASSOC_REQ_DISABLE_HT | in ieee80211_mgd_assoc()
8941 err = -EINVAL; in ieee80211_mgd_assoc()
8945 sband = local->hw.wiphy->bands[cbss->channel->band]; in ieee80211_mgd_assoc()
8947 assoc_data->link[0].bss = cbss; in ieee80211_mgd_assoc()
8950 assoc_data->link[0].conn = sdata->deflink.u.mgd.conn; in ieee80211_mgd_assoc()
8952 assoc_data->link[0].conn = in ieee80211_mgd_assoc()
8955 assoc_data->wmm, 0, in ieee80211_mgd_assoc()
8956 &assoc_data->link[0].conn); in ieee80211_mgd_assoc()
8958 uapsd_supported = bss->uapsd_supported; in ieee80211_mgd_assoc()
8965 assoc_data->spp_amsdu = req->flags & ASSOC_REQ_SPP_AMSDU; in ieee80211_mgd_assoc()
8967 if (ifmgd->auth_data && !ifmgd->auth_data->done) { in ieee80211_mgd_assoc()
8968 err = -EBUSY; in ieee80211_mgd_assoc()
8972 if (ifmgd->assoc_data) { in ieee80211_mgd_assoc()
8973 err = -EBUSY; in ieee80211_mgd_assoc()
8978 if (ifmgd->auth_data && !match_auth) in ieee80211_mgd_assoc()
8981 if (req->ie && req->ie_len) { in ieee80211_mgd_assoc()
8982 memcpy(assoc_data->ie, req->ie, req->ie_len); in ieee80211_mgd_assoc()
8983 assoc_data->ie_len = req->ie_len; in ieee80211_mgd_assoc()
8984 assoc_data->ie_pos = assoc_data->ie + assoc_data->ie_len; in ieee80211_mgd_assoc()
8986 assoc_data->ie_pos = assoc_data->ie; in ieee80211_mgd_assoc()
8989 if (req->fils_kek) { in ieee80211_mgd_assoc()
8990 /* should already be checked in cfg80211 - so warn */ in ieee80211_mgd_assoc()
8991 if (WARN_ON(req->fils_kek_len > FILS_MAX_KEK_LEN)) { in ieee80211_mgd_assoc()
8992 err = -EINVAL; in ieee80211_mgd_assoc()
8995 memcpy(assoc_data->fils_kek, req->fils_kek, in ieee80211_mgd_assoc()
8996 req->fils_kek_len); in ieee80211_mgd_assoc()
8997 assoc_data->fils_kek_len = req->fils_kek_len; in ieee80211_mgd_assoc()
9000 if (req->fils_nonces) in ieee80211_mgd_assoc()
9001 memcpy(assoc_data->fils_nonces, req->fils_nonces, in ieee80211_mgd_assoc()
9005 assoc_data->timeout = jiffies; in ieee80211_mgd_assoc()
9006 assoc_data->timeout_started = true; in ieee80211_mgd_assoc()
9008 assoc_data->assoc_link_id = assoc_link_id; in ieee80211_mgd_assoc()
9010 if (req->ap_mld_addr) { in ieee80211_mgd_assoc()
9011 /* if there was no authentication, set up the link */ in ieee80211_mgd_assoc()
9017 link = sdata_dereference(sdata->link[assoc_link_id], sdata); in ieee80211_mgd_assoc()
9018 if (WARN_ON(!link)) { in ieee80211_mgd_assoc()
9019 err = -EINVAL; in ieee80211_mgd_assoc()
9023 override = link->u.mgd.conn.mode != in ieee80211_mgd_assoc()
9024 assoc_data->link[assoc_link_id].conn.mode || in ieee80211_mgd_assoc()
9025 link->u.mgd.conn.bw_limit != in ieee80211_mgd_assoc()
9026 assoc_data->link[assoc_link_id].conn.bw_limit; in ieee80211_mgd_assoc()
9027 link->u.mgd.conn = assoc_data->link[assoc_link_id].conn; in ieee80211_mgd_assoc()
9029 ieee80211_setup_assoc_link(sdata, assoc_data, req, &link->u.mgd.conn, in ieee80211_mgd_assoc()
9032 if (WARN((sdata->vif.driver_flags & IEEE80211_VIF_SUPPORTS_UAPSD) && in ieee80211_mgd_assoc()
9033 ieee80211_hw_check(&local->hw, PS_NULLFUNC_STACK), in ieee80211_mgd_assoc()
9034 "U-APSD not supported with HW_PS_NULLFUNC_STACK\n")) in ieee80211_mgd_assoc()
9035 sdata->vif.driver_flags &= ~IEEE80211_VIF_SUPPORTS_UAPSD; in ieee80211_mgd_assoc()
9037 if (assoc_data->wmm && uapsd_supported && in ieee80211_mgd_assoc()
9038 (sdata->vif.driver_flags & IEEE80211_VIF_SUPPORTS_UAPSD)) { in ieee80211_mgd_assoc()
9039 assoc_data->uapsd = true; in ieee80211_mgd_assoc()
9040 ifmgd->flags |= IEEE80211_STA_UAPSD_ENABLED; in ieee80211_mgd_assoc()
9042 assoc_data->uapsd = false; in ieee80211_mgd_assoc()
9043 ifmgd->flags &= ~IEEE80211_STA_UAPSD_ENABLED; in ieee80211_mgd_assoc()
9046 if (req->prev_bssid) in ieee80211_mgd_assoc()
9047 memcpy(assoc_data->prev_ap_addr, req->prev_bssid, ETH_ALEN); in ieee80211_mgd_assoc()
9049 if (req->use_mfp) { in ieee80211_mgd_assoc()
9050 ifmgd->mfp = IEEE80211_MFP_REQUIRED; in ieee80211_mgd_assoc()
9051 ifmgd->flags |= IEEE80211_STA_MFP_ENABLED; in ieee80211_mgd_assoc()
9053 ifmgd->mfp = IEEE80211_MFP_DISABLED; in ieee80211_mgd_assoc()
9054 ifmgd->flags &= ~IEEE80211_STA_MFP_ENABLED; in ieee80211_mgd_assoc()
9057 if (req->flags & ASSOC_REQ_USE_RRM) in ieee80211_mgd_assoc()
9058 ifmgd->flags |= IEEE80211_STA_ENABLE_RRM; in ieee80211_mgd_assoc()
9060 ifmgd->flags &= ~IEEE80211_STA_ENABLE_RRM; in ieee80211_mgd_assoc()
9062 if (req->crypto.control_port) in ieee80211_mgd_assoc()
9063 ifmgd->flags |= IEEE80211_STA_CONTROL_PORT; in ieee80211_mgd_assoc()
9065 ifmgd->flags &= ~IEEE80211_STA_CONTROL_PORT; in ieee80211_mgd_assoc()
9067 sdata->control_port_protocol = req->crypto.control_port_ethertype; in ieee80211_mgd_assoc()
9068 sdata->control_port_no_encrypt = req->crypto.control_port_no_encrypt; in ieee80211_mgd_assoc()
9069 sdata->control_port_over_nl80211 = in ieee80211_mgd_assoc()
9070 req->crypto.control_port_over_nl80211; in ieee80211_mgd_assoc()
9071 sdata->control_port_no_preauth = req->crypto.control_port_no_preauth; in ieee80211_mgd_assoc()
9074 ifmgd->assoc_data = assoc_data; in ieee80211_mgd_assoc()
9076 for (i = 0; i < ARRAY_SIZE(assoc_data->link); i++) { in ieee80211_mgd_assoc()
9077 if (!assoc_data->link[i].bss) in ieee80211_mgd_assoc()
9079 if (i == assoc_data->assoc_link_id) in ieee80211_mgd_assoc()
9081 /* only calculate the mode, hence link == NULL */ in ieee80211_mgd_assoc()
9083 assoc_data->link[i].bss, true, in ieee80211_mgd_assoc()
9084 &assoc_data->link[i].conn); in ieee80211_mgd_assoc()
9086 req->links[i].error = err; in ieee80211_mgd_assoc()
9091 memcpy(vif_cfg->ssid, assoc_data->ssid, assoc_data->ssid_len); in ieee80211_mgd_assoc()
9092 vif_cfg->ssid_len = assoc_data->ssid_len; in ieee80211_mgd_assoc()
9095 memcpy(sdata->vif.cfg.ap_addr, assoc_data->ap_addr, ETH_ALEN); in ieee80211_mgd_assoc()
9097 err = ieee80211_prep_connection(sdata, cbss, req->link_id, in ieee80211_mgd_assoc()
9098 req->ap_mld_addr, true, in ieee80211_mgd_assoc()
9099 &assoc_data->link[assoc_link_id].conn, in ieee80211_mgd_assoc()
9104 if (ieee80211_hw_check(&sdata->local->hw, NEED_DTIM_BEFORE_ASSOC)) { in ieee80211_mgd_assoc()
9108 beacon_ies = rcu_dereference(req->bss->beacon_ies); in ieee80211_mgd_assoc()
9115 link->u.mgd.bssid); in ieee80211_mgd_assoc()
9116 assoc_data->timeout = TU_TO_EXP_TIME(req->bss->beacon_interval); in ieee80211_mgd_assoc()
9117 assoc_data->timeout_started = true; in ieee80211_mgd_assoc()
9118 assoc_data->need_beacon = true; in ieee80211_mgd_assoc()
9123 run_again(sdata, assoc_data->timeout); in ieee80211_mgd_assoc()
9126 if (ifmgd->auth_data) in ieee80211_mgd_assoc()
9131 if (!ifmgd->auth_data) { in ieee80211_mgd_assoc()
9132 eth_zero_addr(sdata->deflink.u.mgd.bssid); in ieee80211_mgd_assoc()
9133 ieee80211_link_info_change_notify(sdata, &sdata->deflink, in ieee80211_mgd_assoc()
9136 ifmgd->assoc_data = NULL; in ieee80211_mgd_assoc()
9145 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_mgd_deauth()
9147 bool tx = !req->local_state_change; in ieee80211_mgd_deauth()
9152 if (ifmgd->auth_data && in ieee80211_mgd_deauth()
9153 ether_addr_equal(ifmgd->auth_data->ap_addr, req->bssid)) { in ieee80211_mgd_deauth()
9156 req->bssid, req->reason_code, in ieee80211_mgd_deauth()
9157 ieee80211_get_reason_code_string(req->reason_code)); in ieee80211_mgd_deauth()
9159 info.link_id = ifmgd->auth_data->link_id; in ieee80211_mgd_deauth()
9160 drv_mgd_prepare_tx(sdata->local, sdata, &info); in ieee80211_mgd_deauth()
9161 ieee80211_send_deauth_disassoc(sdata, req->bssid, req->bssid, in ieee80211_mgd_deauth()
9163 req->reason_code, tx, in ieee80211_mgd_deauth()
9168 req->reason_code, false); in ieee80211_mgd_deauth()
9169 drv_mgd_complete_tx(sdata->local, sdata, &info); in ieee80211_mgd_deauth()
9173 if (ifmgd->assoc_data && in ieee80211_mgd_deauth()
9174 ether_addr_equal(ifmgd->assoc_data->ap_addr, req->bssid)) { in ieee80211_mgd_deauth()
9177 req->bssid, req->reason_code, in ieee80211_mgd_deauth()
9178 ieee80211_get_reason_code_string(req->reason_code)); in ieee80211_mgd_deauth()
9180 info.link_id = ifmgd->assoc_data->assoc_link_id; in ieee80211_mgd_deauth()
9181 drv_mgd_prepare_tx(sdata->local, sdata, &info); in ieee80211_mgd_deauth()
9182 ieee80211_send_deauth_disassoc(sdata, req->bssid, req->bssid, in ieee80211_mgd_deauth()
9184 req->reason_code, tx, in ieee80211_mgd_deauth()
9189 req->reason_code, false); in ieee80211_mgd_deauth()
9190 drv_mgd_complete_tx(sdata->local, sdata, &info); in ieee80211_mgd_deauth()
9194 if (ifmgd->associated && in ieee80211_mgd_deauth()
9195 ether_addr_equal(sdata->vif.cfg.ap_addr, req->bssid)) { in ieee80211_mgd_deauth()
9198 req->bssid, req->reason_code, in ieee80211_mgd_deauth()
9199 ieee80211_get_reason_code_string(req->reason_code)); in ieee80211_mgd_deauth()
9202 req->reason_code, tx, frame_buf); in ieee80211_mgd_deauth()
9205 req->reason_code, false); in ieee80211_mgd_deauth()
9206 drv_mgd_complete_tx(sdata->local, sdata, &info); in ieee80211_mgd_deauth()
9210 return -ENOTCONN; in ieee80211_mgd_deauth()
9218 if (!sdata->u.mgd.associated || in ieee80211_mgd_disassoc()
9219 memcmp(sdata->vif.cfg.ap_addr, req->ap_addr, ETH_ALEN)) in ieee80211_mgd_disassoc()
9220 return -ENOTCONN; in ieee80211_mgd_disassoc()
9224 req->ap_addr, req->reason_code, in ieee80211_mgd_disassoc()
9225 ieee80211_get_reason_code_string(req->reason_code)); in ieee80211_mgd_disassoc()
9228 req->reason_code, !req->local_state_change, in ieee80211_mgd_disassoc()
9232 req->reason_code, false); in ieee80211_mgd_disassoc()
9237 void ieee80211_mgd_stop_link(struct ieee80211_link_data *link) in ieee80211_mgd_stop_link() argument
9239 wiphy_work_cancel(link->sdata->local->hw.wiphy, in ieee80211_mgd_stop_link()
9240 &link->u.mgd.request_smps_work); in ieee80211_mgd_stop_link()
9241 wiphy_work_cancel(link->sdata->local->hw.wiphy, in ieee80211_mgd_stop_link()
9242 &link->u.mgd.recalc_smps); in ieee80211_mgd_stop_link()
9243 wiphy_delayed_work_cancel(link->sdata->local->hw.wiphy, in ieee80211_mgd_stop_link()
9244 &link->u.mgd.csa.switch_work); in ieee80211_mgd_stop_link()
9249 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_mgd_stop()
9256 wiphy_work_cancel(sdata->local->hw.wiphy, in ieee80211_mgd_stop()
9257 &ifmgd->monitor_work); in ieee80211_mgd_stop()
9258 wiphy_work_cancel(sdata->local->hw.wiphy, in ieee80211_mgd_stop()
9259 &ifmgd->beacon_connection_loss_work); in ieee80211_mgd_stop()
9260 wiphy_work_cancel(sdata->local->hw.wiphy, in ieee80211_mgd_stop()
9261 &ifmgd->csa_connection_drop_work); in ieee80211_mgd_stop()
9262 wiphy_delayed_work_cancel(sdata->local->hw.wiphy, in ieee80211_mgd_stop()
9263 &ifmgd->tdls_peer_del_work); in ieee80211_mgd_stop()
9265 if (ifmgd->assoc_data) in ieee80211_mgd_stop()
9267 if (ifmgd->auth_data) in ieee80211_mgd_stop()
9269 spin_lock_bh(&ifmgd->teardown_lock); in ieee80211_mgd_stop()
9270 if (ifmgd->teardown_skb) { in ieee80211_mgd_stop()
9271 kfree_skb(ifmgd->teardown_skb); in ieee80211_mgd_stop()
9272 ifmgd->teardown_skb = NULL; in ieee80211_mgd_stop()
9273 ifmgd->orig_teardown_skb = NULL; in ieee80211_mgd_stop()
9275 kfree(ifmgd->assoc_req_ies); in ieee80211_mgd_stop()
9276 ifmgd->assoc_req_ies = NULL; in ieee80211_mgd_stop()
9277 ifmgd->assoc_req_ies_len = 0; in ieee80211_mgd_stop()
9278 spin_unlock_bh(&ifmgd->teardown_lock); in ieee80211_mgd_stop()
9279 del_timer_sync(&ifmgd->timer); in ieee80211_mgd_stop()
9291 cfg80211_cqm_rssi_notify(sdata->dev, rssi_event, rssi_level, gfp); in ieee80211_cqm_rssi_notify()
9299 trace_api_cqm_beacon_loss_notify(sdata->local, sdata); in ieee80211_cqm_beacon_loss_notify()
9301 cfg80211_cqm_beacon_loss_notify(sdata->dev, gfp); in ieee80211_cqm_beacon_loss_notify()
9311 if (WARN_ON(sdata->vif.type != NL80211_IFTYPE_STATION)) in _ieee80211_enable_rssi_reports()
9319 sdata->u.mgd.rssi_min_thold = rssi_min_thold*16; in _ieee80211_enable_rssi_reports()
9320 sdata->u.mgd.rssi_max_thold = rssi_max_thold*16; in _ieee80211_enable_rssi_reports()