Lines Matching +full:mu +full:- +full:side +full:- +full:b
1 // SPDX-License-Identifier: GPL-2.0-only
4 * Copyright 2003-2008, Jouni Malinen <j@w1.fi>
7 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
9 * Copyright 2013-2014 Intel Mobile Communications GmbH
10 * Copyright (C) 2015 - 2017 Intel Deutschland GmbH
11 * Copyright (C) 2018 - 2024 Intel Corporation
29 #include "driver-ops.h"
105 * has happened -- the work that runs from this timer will
111 lockdep_assert_wiphy(sdata->local->hw.wiphy); in run_again()
113 if (!timer_pending(&sdata->u.mgd.timer) || in run_again()
114 time_before(timeout, sdata->u.mgd.timer.expires)) in run_again()
115 mod_timer(&sdata->u.mgd.timer, timeout); in run_again()
120 if (sdata->vif.driver_flags & IEEE80211_VIF_BEACON_FILTER) in ieee80211_sta_reset_beacon_monitor()
123 if (ieee80211_hw_check(&sdata->local->hw, CONNECTION_MONITOR)) in ieee80211_sta_reset_beacon_monitor()
126 mod_timer(&sdata->u.mgd.bcn_mon_timer, in ieee80211_sta_reset_beacon_monitor()
127 round_jiffies_up(jiffies + sdata->u.mgd.beacon_timeout)); in ieee80211_sta_reset_beacon_monitor()
132 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_sta_reset_conn_monitor()
134 if (unlikely(!ifmgd->associated)) in ieee80211_sta_reset_conn_monitor()
137 if (ifmgd->probe_send_count) in ieee80211_sta_reset_conn_monitor()
138 ifmgd->probe_send_count = 0; in ieee80211_sta_reset_conn_monitor()
140 if (ieee80211_hw_check(&sdata->local->hw, CONNECTION_MONITOR)) in ieee80211_sta_reset_conn_monitor()
143 mod_timer(&ifmgd->conn_mon_timer, in ieee80211_sta_reset_conn_monitor()
149 return (1 << ecw) - 1; in ecw2cw()
161 const struct ieee80211_ht_operation *ht_oper = elems->ht_operation; in ieee80211_determine_ap_chan()
162 const struct ieee80211_vht_operation *vht_oper = elems->vht_operation; in ieee80211_determine_ap_chan()
163 const struct ieee80211_he_operation *he_oper = elems->he_operation; in ieee80211_determine_ap_chan()
164 const struct ieee80211_eht_operation *eht_oper = elems->eht_operation; in ieee80211_determine_ap_chan()
166 sdata->local->hw.wiphy->bands[channel->band]; in ieee80211_determine_ap_chan()
174 .center_freq1 = channel->center_freq, in ieee80211_determine_ap_chan()
175 .freq1_offset = channel->freq_offset, in ieee80211_determine_ap_chan()
179 if (sband->band == NL80211_BAND_S1GHZ) { in ieee80211_determine_ap_chan()
180 if (!ieee80211_chandef_s1g_oper(elems->s1g_oper, chandef)) { in ieee80211_determine_ap_chan()
183 chandef->width = ieee80211_s1g_channel_width(channel); in ieee80211_determine_ap_chan()
190 if (sband->band == NL80211_BAND_6GHZ) { in ieee80211_determine_ap_chan()
194 if (conn->mode < IEEE80211_CONN_MODE_HE) in ieee80211_determine_ap_chan()
197 if (!elems->he_6ghz_capa || !elems->he_cap) { in ieee80211_determine_ap_chan()
203 if (!eht_oper || !elems->eht_cap) { in ieee80211_determine_ap_chan()
208 if (!ieee80211_chandef_he_6ghz_oper(sdata->local, he_oper, in ieee80211_determine_ap_chan()
218 if (conn->mode < IEEE80211_CONN_MODE_HT) in ieee80211_determine_ap_chan()
221 if (!ht_oper || !elems->ht_cap_elem) in ieee80211_determine_ap_chan()
224 chandef->width = NL80211_CHAN_WIDTH_20; in ieee80211_determine_ap_chan()
226 ht_cfreq = ieee80211_channel_to_frequency(ht_oper->primary_chan, in ieee80211_determine_ap_chan()
227 channel->band); in ieee80211_determine_ap_chan()
229 if (!ignore_ht_channel_mismatch && channel->center_freq != ht_cfreq) { in ieee80211_determine_ap_chan()
238 …"Wrong control channel: center-freq: %d ht-cfreq: %d ht->primary_chan: %d band: %d - Disabling HT\… in ieee80211_determine_ap_chan()
239 channel->center_freq, ht_cfreq, in ieee80211_determine_ap_chan()
240 ht_oper->primary_chan, channel->band); in ieee80211_determine_ap_chan()
246 if (conn->mode < IEEE80211_CONN_MODE_VHT) in ieee80211_determine_ap_chan()
255 if (elems->he_cap && he_oper && in ieee80211_determine_ap_chan()
256 he_oper->he_oper_params & cpu_to_le32(IEEE80211_HE_OPERATION_VHT_OPER_INFO)) { in ieee80211_determine_ap_chan()
263 memcpy(&he_oper_vht_cap, he_oper->optional, 3); in ieee80211_determine_ap_chan()
266 if (!ieee80211_chandef_vht_oper(&sdata->local->hw, vht_cap_info, in ieee80211_determine_ap_chan()
271 /* this will cause us to re-parse as VHT STA */ in ieee80211_determine_ap_chan()
274 } else if (!vht_oper || !elems->vht_cap_elem) { in ieee80211_determine_ap_chan()
275 if (sband->band == NL80211_BAND_5GHZ) { in ieee80211_determine_ap_chan()
281 } else if (sband->band == NL80211_BAND_2GHZ) { in ieee80211_determine_ap_chan()
283 } else if (!ieee80211_chandef_vht_oper(&sdata->local->hw, in ieee80211_determine_ap_chan()
301 if (conn->mode < IEEE80211_CONN_MODE_HE || in ieee80211_determine_ap_chan()
302 !elems->he_operation || !elems->he_cap) { in ieee80211_determine_ap_chan()
309 if (conn->mode < IEEE80211_CONN_MODE_EHT || in ieee80211_determine_ap_chan()
310 !eht_oper || !elems->eht_cap) in ieee80211_determine_ap_chan()
318 if (eht_oper->params & IEEE80211_EHT_OPER_INFO_PRESENT) { in ieee80211_determine_ap_chan()
321 ieee80211_chandef_eht_oper((const void *)eht_oper->optional, in ieee80211_determine_ap_chan()
362 mcs_80_map_tx = le16_to_cpu(he_mcs_nss_supp->tx_mcs_80); in ieee80211_verify_peer_he_mcs_support()
363 mcs_80_map_rx = le16_to_cpu(he_mcs_nss_supp->rx_mcs_80); in ieee80211_verify_peer_he_mcs_support()
365 /* P802.11-REVme/D0.3 in ieee80211_verify_peer_he_mcs_support()
370 * Single spatial stream HE-MCSs 0 to 7 (transmit and receive) in all in ieee80211_verify_peer_he_mcs_support()
384 ap_min_req_set = le16_to_cpu(he_op->he_mcs_nss_set); in ieee80211_verify_peer_he_mcs_support()
396 * P802.11-REVme/D0.3 in ieee80211_verify_peer_he_mcs_support()
400 * transmit at each of the <HE-MCS, NSS> tuple values indicated by the in ieee80211_verify_peer_he_mcs_support()
401 * Basic HE-MCS And NSS Set field of the HE Operation parameter of the in ieee80211_verify_peer_he_mcs_support()
402 * MLME-START.request primitive and shall be able to receive at each of in ieee80211_verify_peer_he_mcs_support()
403 * the <HE-MCS, NSS> tuple values indicated by the Supported HE-MCS and in ieee80211_verify_peer_he_mcs_support()
407 for (nss = 8; nss > 0; nss--) { in ieee80211_verify_peer_he_mcs_support()
408 u8 ap_op_val = (ap_min_req_set >> (2 * (nss - 1))) & 3; in ieee80211_verify_peer_he_mcs_support()
415 ap_rx_val = (mcs_80_map_rx >> (2 * (nss - 1))) & 3; in ieee80211_verify_peer_he_mcs_support()
416 ap_tx_val = (mcs_80_map_tx >> (2 * (nss - 1))) & 3; in ieee80211_verify_peer_he_mcs_support()
437 ieee80211_get_he_iftype_cap_vif(sband, &sdata->vif); in ieee80211_verify_sta_he_mcs_support()
444 ap_min_req_set = le16_to_cpu(he_op->he_mcs_nss_set); in ieee80211_verify_sta_he_mcs_support()
457 &sta_he_cap->he_mcs_nss_supp; in ieee80211_verify_sta_he_mcs_support()
467 * possible. Each of the sta_mcs_map_* is a 16-bit struct built in ieee80211_verify_sta_he_mcs_support()
468 * of 2 bits per NSS (1-8), with the values defined in enum in ieee80211_verify_sta_he_mcs_support()
474 for (nss = 8; nss > 0; nss--) { in ieee80211_verify_sta_he_mcs_support()
475 u8 sta_rx_val = (sta_mcs_map_rx >> (2 * (nss - 1))) & 3; in ieee80211_verify_sta_he_mcs_support()
476 u8 sta_tx_val = (sta_mcs_map_tx >> (2 * (nss - 1))) & 3; in ieee80211_verify_sta_he_mcs_support()
477 u8 ap_val = (ap_min_req_set >> (2 * (nss - 1))) & 3; in ieee80211_verify_sta_he_mcs_support()
486 * P802.11-REVme/D0.3 in ieee80211_verify_sta_he_mcs_support()
489 * An HE STA shall not attempt to join * (MLME-JOIN.request primitive) in ieee80211_verify_sta_he_mcs_support()
491 * receive using) all of the <HE-MCS, NSS> tuples in the basic in ieee80211_verify_sta_he_mcs_support()
492 * HE-MCS and NSS set. in ieee80211_verify_sta_he_mcs_support()
515 u8 he_phy_cap0 = sta_he_cap->he_cap_elem.phy_cap_info[0]; in ieee80211_get_eht_cap_mcs_nss()
516 u8 eht_phy_cap0 = sta_eht_cap->eht_cap_elem.phy_cap_info[0]; in ieee80211_get_eht_cap_mcs_nss()
518 /* handle us being a 20 MHz-only EHT STA - with four values in ieee80211_get_eht_cap_mcs_nss()
519 * for MCS 0-7, 8-9, 10-11, 12-13. in ieee80211_get_eht_cap_mcs_nss()
522 return sta_eht_cap->eht_mcs_nss_supp.only_20mhz.rx_tx_max_nss[idx]; in ieee80211_get_eht_cap_mcs_nss()
524 /* the others have MCS 0-9 together, rather than separately from 0-7 */ in ieee80211_get_eht_cap_mcs_nss()
526 idx--; in ieee80211_get_eht_cap_mcs_nss()
530 return sta_eht_cap->eht_mcs_nss_supp.bw._80.rx_tx_max_nss[idx]; in ieee80211_get_eht_cap_mcs_nss()
536 return sta_eht_cap->eht_mcs_nss_supp.bw._160.rx_tx_max_nss[idx]; in ieee80211_get_eht_cap_mcs_nss()
540 return sta_eht_cap->eht_mcs_nss_supp.bw._320.rx_tx_max_nss[idx]; in ieee80211_get_eht_cap_mcs_nss()
553 ieee80211_get_he_iftype_cap_vif(sband, &sdata->vif); in ieee80211_verify_sta_eht_mcs_support()
555 ieee80211_get_eht_iftype_cap_vif(sband, &sdata->vif); in ieee80211_verify_sta_eht_mcs_support()
562 req = &eht_op->basic_mcs_nss; in ieee80211_verify_sta_eht_mcs_support()
564 for (i = 0; i < ARRAY_SIZE(req->rx_tx_max_nss); i++) { in ieee80211_verify_sta_eht_mcs_support()
568 req_rx_nss = u8_get_bits(req->rx_tx_max_nss[i], in ieee80211_verify_sta_eht_mcs_support()
570 req_tx_nss = u8_get_bits(req->rx_tx_max_nss[i], in ieee80211_verify_sta_eht_mcs_support()
608 ext_supp_rates[i - supp_rates_len]; in ieee80211_get_rates()
628 for (j = 0; j < sband->n_bitrates; j++) { in ieee80211_get_rates()
632 br = &sband->bitrates[j]; in ieee80211_get_rates()
634 brate = DIV_ROUND_UP(br->bitrate, 5); in ieee80211_get_rates()
650 if (is_basic && unknown_rates_selectors && j == sband->n_bitrates) in ieee80211_get_rates()
659 if (!cfg80211_chandef_usable(sdata->local->hw.wiphy, in ieee80211_chandef_usable()
663 if (chandef->punctured && in ieee80211_chandef_usable()
664 ieee80211_hw_check(&sdata->local->hw, DISALLOW_PUNCTURING)) in ieee80211_chandef_usable()
667 if (chandef->punctured && chandef->chan->band == NL80211_BAND_5GHZ && in ieee80211_chandef_usable()
668 ieee80211_hw_check(&sdata->local->hw, DISALLOW_PUNCTURING_5GHZ)) in ieee80211_chandef_usable()
676 if (c->width == NL80211_CHAN_WIDTH_80P80) in ieee80211_chandef_num_subchans()
679 return nl80211_chan_width_to_mhz(c->width) / 20; in ieee80211_chandef_num_subchans()
684 switch (c->width) { in ieee80211_chandef_num_widths()
722 /* don't WARN - misconfigured APs could cause this if their N > width */ in ieee80211_calc_chandef_subchan_offset()
740 * 80+80 with secondary 80 below primary - four subchannels for it in ieee80211_calc_chandef_subchan_offset()
743 if (ap->width == NL80211_CHAN_WIDTH_80P80 && in ieee80211_calc_chandef_subchan_offset()
744 ap->center_freq2 < ap->center_freq1) in ieee80211_calc_chandef_subchan_offset()
761 if (!psd->valid) in ieee80211_rearrange_tpe_psd()
765 if (!psd->n) in ieee80211_rearrange_tpe_psd()
768 BUILD_BUG_ON(sizeof(tmp) != sizeof(psd->power)); in ieee80211_rearrange_tpe_psd()
774 * In psd->power we have values in the order 0..N, 0..K, where in ieee80211_rearrange_tpe_psd()
776 * doesn't then we've pre-filled 'unlimited' as defaults. in ieee80211_rearrange_tpe_psd()
789 * N entries: |--|--|--|--| in ieee80211_rearrange_tpe_psd()
790 * K entries: |--|--|--|--|--|--|--|--| |--|--|--|--| in ieee80211_rearrange_tpe_psd()
805 offset = ieee80211_calc_chandef_subchan_offset(ap, psd->n); in ieee80211_rearrange_tpe_psd()
808 tmp[i] = psd->power[i + psd->n]; in ieee80211_rearrange_tpe_psd()
809 else if (i < offset + psd->n) in ieee80211_rearrange_tpe_psd()
810 tmp[i] = psd->power[i - offset]; in ieee80211_rearrange_tpe_psd()
812 tmp[i] = psd->power[i]; in ieee80211_rearrange_tpe_psd()
819 memset(psd->power, IEEE80211_TPE_PSD_NO_LIMIT, sizeof(psd->power)); in ieee80211_rearrange_tpe_psd()
822 psd->power[i] = tmp[offset + i]; in ieee80211_rearrange_tpe_psd()
826 if (needed < psd->count) in ieee80211_rearrange_tpe_psd()
827 psd->count = needed; in ieee80211_rearrange_tpe_psd()
845 ieee80211_rearrange_tpe_psd(&tpe->psd_local[i], ap, used); in ieee80211_rearrange_tpe()
846 ieee80211_rearrange_tpe_psd(&tpe->psd_reg_client[i], ap, used); in ieee80211_rearrange_tpe()
850 if (needed_pwr_count < tpe->max_local[i].count) in ieee80211_rearrange_tpe()
851 tpe->max_local[i].count = needed_pwr_count; in ieee80211_rearrange_tpe()
852 if (needed_pwr_count < tpe->max_reg_client[i].count) in ieee80211_rearrange_tpe()
853 tpe->max_reg_client[i].count = needed_pwr_count; in ieee80211_rearrange_tpe()
870 chanreq->ap.chan = NULL; in ieee80211_set_chanreq_ap()
872 if (conn->mode < IEEE80211_CONN_MODE_EHT) in ieee80211_set_chanreq_ap()
874 if (sdata->vif.driver_flags & IEEE80211_VIF_IGNORE_OFDMA_WIDER_BW) in ieee80211_set_chanreq_ap()
877 chanreq->ap = *ap_chandef; in ieee80211_set_chanreq_ap()
888 const struct cfg80211_bss_ies *ies = rcu_dereference(cbss->ies); in ieee80211_determine_chan_mode()
889 struct ieee80211_bss *bss = (void *)cbss->priv; in ieee80211_determine_chan_mode()
890 struct ieee80211_channel *channel = cbss->channel; in ieee80211_determine_chan_mode()
892 .link_id = -1, in ieee80211_determine_chan_mode()
894 .start = ies->data, in ieee80211_determine_chan_mode()
895 .len = ies->len, in ieee80211_determine_chan_mode()
905 parse_params.mode = conn->mode; in ieee80211_determine_chan_mode()
908 return ERR_PTR(-ENOMEM); in ieee80211_determine_chan_mode()
910 ap_mode = ieee80211_determine_ap_chan(sdata, channel, bss->vht_cap_info, in ieee80211_determine_chan_mode()
914 if (WARN_ON(ap_mode > conn->mode)) { in ieee80211_determine_chan_mode()
915 ret = -EINVAL; in ieee80211_determine_chan_mode()
919 if (conn->mode != ap_mode) { in ieee80211_determine_chan_mode()
920 conn->mode = ap_mode; in ieee80211_determine_chan_mode()
926 cbss->bssid, ieee80211_conn_mode_str(ap_mode)); in ieee80211_determine_chan_mode()
928 sband = sdata->local->hw.wiphy->bands[channel->band]; in ieee80211_determine_chan_mode()
930 ieee80211_get_rates(sband, elems->supp_rates, elems->supp_rates_len, in ieee80211_determine_chan_mode()
931 elems->ext_supp_rates, elems->ext_supp_rates_len, in ieee80211_determine_chan_mode()
935 switch (channel->band) { in ieee80211_determine_chan_mode()
938 ret = -EINVAL; in ieee80211_determine_chan_mode()
945 "Rejecting non-HE 6/7 GHz connection"); in ieee80211_determine_chan_mode()
946 ret = -EINVAL; in ieee80211_determine_chan_mode()
952 ret = -EINVAL; in ieee80211_determine_chan_mode()
960 ret = -EINVAL; in ieee80211_determine_chan_mode()
963 conn->bw_limit = IEEE80211_CONN_BW_LIMIT_20; in ieee80211_determine_chan_mode()
966 conn->bw_limit = min_t(enum ieee80211_conn_bw_limit, in ieee80211_determine_chan_mode()
967 conn->bw_limit, in ieee80211_determine_chan_mode()
972 conn->bw_limit = min_t(enum ieee80211_conn_bw_limit, in ieee80211_determine_chan_mode()
973 conn->bw_limit, in ieee80211_determine_chan_mode()
977 conn->bw_limit = min_t(enum ieee80211_conn_bw_limit, in ieee80211_determine_chan_mode()
978 conn->bw_limit, in ieee80211_determine_chan_mode()
983 chanreq->oper = *ap_chandef; in ieee80211_determine_chan_mode()
986 if (conn->mode >= IEEE80211_CONN_MODE_HT) in ieee80211_determine_chan_mode()
988 if (conn->mode >= IEEE80211_CONN_MODE_VHT) in ieee80211_determine_chan_mode()
990 if (conn->mode >= IEEE80211_CONN_MODE_HE) in ieee80211_determine_chan_mode()
992 if (conn->mode >= IEEE80211_CONN_MODE_EHT) in ieee80211_determine_chan_mode()
1004 ret = -EINVAL; in ieee80211_determine_chan_mode()
1010 while (!ieee80211_chandef_usable(sdata, &chanreq->oper, in ieee80211_determine_chan_mode()
1012 if (WARN_ON(chanreq->oper.width == NL80211_CHAN_WIDTH_20_NOHT)) { in ieee80211_determine_chan_mode()
1013 ret = -EINVAL; in ieee80211_determine_chan_mode()
1020 if (conn->mode >= IEEE80211_CONN_MODE_HE && in ieee80211_determine_chan_mode()
1021 !cfg80211_chandef_usable(sdata->wdev.wiphy, &chanreq->oper, in ieee80211_determine_chan_mode()
1023 conn->mode = IEEE80211_CONN_MODE_VHT; in ieee80211_determine_chan_mode()
1024 conn->bw_limit = min_t(enum ieee80211_conn_bw_limit, in ieee80211_determine_chan_mode()
1025 conn->bw_limit, in ieee80211_determine_chan_mode()
1029 if (conn->mode >= IEEE80211_CONN_MODE_EHT && in ieee80211_determine_chan_mode()
1030 !cfg80211_chandef_usable(sdata->wdev.wiphy, &chanreq->oper, in ieee80211_determine_chan_mode()
1032 conn->mode = IEEE80211_CONN_MODE_HE; in ieee80211_determine_chan_mode()
1033 conn->bw_limit = min_t(enum ieee80211_conn_bw_limit, in ieee80211_determine_chan_mode()
1034 conn->bw_limit, in ieee80211_determine_chan_mode()
1038 if (chanreq->oper.width != ap_chandef->width || ap_mode != conn->mode) in ieee80211_determine_chan_mode()
1042 if (conn->mode >= IEEE80211_CONN_MODE_HE && in ieee80211_determine_chan_mode()
1044 (void *)elems->he_cap, in ieee80211_determine_chan_mode()
1045 elems->he_operation) || in ieee80211_determine_chan_mode()
1047 elems->he_operation))) { in ieee80211_determine_chan_mode()
1048 conn->mode = IEEE80211_CONN_MODE_VHT; in ieee80211_determine_chan_mode()
1053 if (conn->mode >= IEEE80211_CONN_MODE_EHT && in ieee80211_determine_chan_mode()
1055 elems->eht_operation)) { in ieee80211_determine_chan_mode()
1056 conn->mode = IEEE80211_CONN_MODE_HE; in ieee80211_determine_chan_mode()
1057 conn->bw_limit = min_t(enum ieee80211_conn_bw_limit, in ieee80211_determine_chan_mode()
1058 conn->bw_limit, in ieee80211_determine_chan_mode()
1065 if (ap_mode != conn->mode) { in ieee80211_determine_chan_mode()
1072 ieee80211_conn_mode_str(conn->mode), in ieee80211_determine_chan_mode()
1073 20 * (1 << conn->bw_limit)); in ieee80211_determine_chan_mode()
1075 if (WARN_ON_ONCE(!cfg80211_chandef_valid(&chanreq->oper))) { in ieee80211_determine_chan_mode()
1076 ret = -EINVAL; in ieee80211_determine_chan_mode()
1091 struct ieee80211_channel *channel = link->conf->chanreq.oper.chan; in ieee80211_config_bw()
1092 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_config_bw()
1101 if (link->u.mgd.conn.mode == IEEE80211_CONN_MODE_LEGACY || in ieee80211_config_bw()
1102 link->u.mgd.conn.mode == IEEE80211_CONN_MODE_S1G) in ieee80211_config_bw()
1105 if (elems->vht_cap_elem) in ieee80211_config_bw()
1106 vht_cap_info = le32_to_cpu(elems->vht_cap_elem->vht_cap_info); in ieee80211_config_bw()
1109 elems, true, &link->u.mgd.conn, in ieee80211_config_bw()
1112 if (ap_mode != link->u.mgd.conn.mode) { in ieee80211_config_bw()
1115 link->u.mgd.bssid, in ieee80211_config_bw()
1116 ieee80211_conn_mode_str(link->u.mgd.conn.mode), in ieee80211_config_bw()
1118 return -EINVAL; in ieee80211_config_bw()
1122 ieee80211_set_chanreq_ap(sdata, &chanreq, &link->u.mgd.conn, in ieee80211_config_bw()
1126 * if HT operation mode changed store the new one - in ieee80211_config_bw()
1129 if (elems->ht_operation) { in ieee80211_config_bw()
1130 ht_opmode = le16_to_cpu(elems->ht_operation->operation_mode); in ieee80211_config_bw()
1131 if (link->conf->ht_operation_mode != ht_opmode) { in ieee80211_config_bw()
1133 link->conf->ht_operation_mode = ht_opmode; in ieee80211_config_bw()
1142 * won't do us any good -- we couldn't use it with the AP. in ieee80211_config_bw()
1144 while (link->u.mgd.conn.bw_limit < in ieee80211_config_bw()
1148 if (ap_chandef.chan->band == NL80211_BAND_6GHZ && in ieee80211_config_bw()
1149 link->u.mgd.conn.mode >= IEEE80211_CONN_MODE_HE) { in ieee80211_config_bw()
1150 ieee80211_rearrange_tpe(&elems->tpe, &ap_chandef, in ieee80211_config_bw()
1152 if (memcmp(&link->conf->tpe, &elems->tpe, sizeof(elems->tpe))) { in ieee80211_config_bw()
1153 link->conf->tpe = elems->tpe; in ieee80211_config_bw()
1158 if (ieee80211_chanreq_identical(&chanreq, &link->conf->chanreq)) in ieee80211_config_bw()
1163 link->u.mgd.bssid, frame, chanreq.oper.chan->center_freq, in ieee80211_config_bw()
1164 chanreq.oper.chan->freq_offset, chanreq.oper.width, in ieee80211_config_bw()
1170 "AP %pM changed caps/bw in %s in a way we can't support - disconnect\n", in ieee80211_config_bw()
1171 link->u.mgd.bssid, frame); in ieee80211_config_bw()
1172 return -EINVAL; in ieee80211_config_bw()
1176 link->conf->chanreq = chanreq; in ieee80211_config_bw()
1182 * here. This keeps us from playing ping-pong with regulatory, without in ieee80211_config_bw()
1184 * - connect to an AP with 80 MHz, world regdom allows 80 MHz in ieee80211_config_bw()
1185 * - AP advertises regdom US in ieee80211_config_bw()
1186 * - CRDA loads regdom US with 80 MHz prohibited (old database) in ieee80211_config_bw()
1187 * - we detect an unsupported channel and disconnect in ieee80211_config_bw()
1188 * - disconnect causes CRDA to reload world regdomain and the game in ieee80211_config_bw()
1200 "AP %pM changed bandwidth in %s to incompatible one - disconnect\n", in ieee80211_config_bw()
1201 link->u.mgd.bssid, frame); in ieee80211_config_bw()
1205 cfg80211_schedule_channels_check(&sdata->wdev); in ieee80211_config_bw()
1219 u32 flags = channel->flags; in ieee80211_add_ht_ie()
1223 BUILD_BUG_ON(sizeof(ht_cap) != sizeof(sband->ht_cap)); in ieee80211_add_ht_ie()
1225 memcpy(&ht_cap, &sband->ht_cap, sizeof(ht_cap)); in ieee80211_add_ht_ie()
1248 * capable of 40 MHz -- some broken APs will never fall in ieee80211_add_ht_ie()
1251 if (conn->bw_limit <= IEEE80211_CONN_BW_LIMIT_20) { in ieee80211_add_ht_ie()
1284 * Note - the function returns true to own the MU-MIMO capability
1292 struct ieee80211_local *local = sdata->local; in ieee80211_add_vht_ie()
1299 BUILD_BUG_ON(sizeof(vht_cap) != sizeof(sband->vht_cap)); in ieee80211_add_vht_ie()
1301 memcpy(&vht_cap, &sband->vht_cap, sizeof(vht_cap)); in ieee80211_add_vht_ie()
1307 if (conn->bw_limit <= IEEE80211_CONN_BW_LIMIT_80) { in ieee80211_add_vht_ie()
1316 if (!(ap_vht_cap->vht_cap_info & in ieee80211_add_vht_ie()
1320 else if (!(ap_vht_cap->vht_cap_info & in ieee80211_add_vht_ie()
1325 * If some other vif is using the MU-MIMO capability we cannot associate in ieee80211_add_vht_ie()
1326 * using MU-MIMO - this will lead to contradictions in the group-id in ieee80211_add_vht_ie()
1329 * simultaneous associations with MU-MIMO. in ieee80211_add_vht_ie()
1335 list_for_each_entry(other, &local->interfaces, list) { in ieee80211_add_vht_ie()
1336 if (other->vif.bss_conf.mu_mimo_owner) { in ieee80211_add_vht_ie()
1349 ap_bf_sts = le32_to_cpu(ap_vht_cap->vht_cap_info) & mask; in ieee80211_add_vht_ie()
1371 if (assoc_data->supp_rates_len) { in ieee80211_assoc_add_rates()
1375 * in the association request (e.g. D-Link DAP 1353 in in ieee80211_assoc_add_rates()
1376 * b-only mode)... in ieee80211_assoc_add_rates()
1379 assoc_data->supp_rates, in ieee80211_assoc_add_rates()
1380 assoc_data->supp_rates_len, in ieee80211_assoc_add_rates()
1427 /* 60 GHz (Multi-band, DMG, MMS) can't happen */ in ieee80211_add_before_ht_elems()
1441 skb_put_data(skb, elems + offset, noffset - offset); in ieee80211_add_before_ht_elems()
1461 /* 60 GHz (Multi-band, DMG, MMS) can't happen */ in ieee80211_add_before_vht_elems()
1472 skb_put_data(skb, elems + offset, noffset - offset); in ieee80211_add_before_vht_elems()
1506 skb_put_data(skb, elems + offset, noffset - offset); in ieee80211_add_before_he_elems()
1532 enum nl80211_iftype iftype = ieee80211_vif_type_p2p(&sdata->vif); in ieee80211_add_link_elems()
1533 struct cfg80211_bss *cbss = assoc_data->link[link_id].bss; in ieee80211_add_link_elems()
1534 struct ieee80211_channel *chan = cbss->channel; in ieee80211_add_link_elems()
1536 struct ieee80211_local *local = sdata->local; in ieee80211_add_link_elems()
1548 /* need a last for termination - we use 0 == SSID */ \ in ieee80211_add_link_elems()
1549 if (!WARN_ON(present_elems_len >= PRESENT_ELEMS_MAX - 1)) \ in ieee80211_add_link_elems()
1555 smps_mode = link->smps_mode; in ieee80211_add_link_elems()
1556 else if (sdata->u.mgd.powersave) in ieee80211_add_link_elems()
1568 chanctx_conf = rcu_dereference(link->conf->chanctx_conf); in ieee80211_add_link_elems()
1570 width = chanctx_conf->def.width; in ieee80211_add_link_elems()
1574 sband = local->hw.wiphy->bands[chan->band]; in ieee80211_add_link_elems()
1577 if (sband->band == NL80211_BAND_2GHZ) { in ieee80211_add_link_elems()
1582 if ((cbss->capability & WLAN_CAPABILITY_SPECTRUM_MGMT) && in ieee80211_add_link_elems()
1583 ieee80211_hw_check(&local->hw, SPECTRUM_MGMT)) in ieee80211_add_link_elems()
1586 if (sband->band != NL80211_BAND_S1GHZ) in ieee80211_add_link_elems()
1611 (sband->band != NL80211_BAND_6GHZ || in ieee80211_add_link_elems()
1612 !ext_capa || ext_capa->datalen < 1 || in ieee80211_add_link_elems()
1613 !(ext_capa->data[0] & WLAN_EXT_CAPA1_EXT_CHANNEL_SWITCHING))) { in ieee80211_add_link_elems()
1615 pos = skb_put(skb, 2 * sband->n_channels + 2); in ieee80211_add_link_elems()
1617 *pos++ = 2 * sband->n_channels; in ieee80211_add_link_elems()
1618 for (i = 0; i < sband->n_channels; i++) { in ieee80211_add_link_elems()
1619 int cf = sband->channels[i].center_freq; in ieee80211_add_link_elems()
1632 if (sband->band != NL80211_BAND_6GHZ && in ieee80211_add_link_elems()
1633 assoc_data->link[link_id].conn.mode >= IEEE80211_CONN_MODE_HT) { in ieee80211_add_link_elems()
1635 assoc_data->link[link_id].ap_ht_param, in ieee80211_add_link_elems()
1637 &assoc_data->link[link_id].conn); in ieee80211_add_link_elems()
1646 if (sband->band != NL80211_BAND_6GHZ && in ieee80211_add_link_elems()
1647 assoc_data->link[link_id].conn.mode >= IEEE80211_CONN_MODE_VHT && in ieee80211_add_link_elems()
1648 sband->vht_cap.vht_supported) { in ieee80211_add_link_elems()
1651 &assoc_data->link[link_id].ap_vht_cap, in ieee80211_add_link_elems()
1652 &assoc_data->link[link_id].conn); in ieee80211_add_link_elems()
1655 link->conf->mu_mimo_owner = mu_mimo_owner; in ieee80211_add_link_elems()
1664 if (assoc_data->link[link_id].conn.mode >= IEEE80211_CONN_MODE_HE) { in ieee80211_add_link_elems()
1666 &assoc_data->link[link_id].conn); in ieee80211_add_link_elems()
1672 * careful - need to know about all the present elems before in ieee80211_add_link_elems()
1676 if (assoc_data->link[link_id].conn.mode >= IEEE80211_CONN_MODE_EHT) in ieee80211_add_link_elems()
1679 if (link_id == assoc_data->assoc_link_id) in ieee80211_add_link_elems()
1686 if (assoc_data->link[link_id].conn.mode >= IEEE80211_CONN_MODE_EHT) in ieee80211_add_link_elems()
1688 &assoc_data->link[link_id].conn); in ieee80211_add_link_elems()
1690 if (sband->band == NL80211_BAND_S1GHZ) { in ieee80211_add_link_elems()
1692 ieee80211_add_s1g_capab_ie(sdata, &sband->s1g_cap, skb); in ieee80211_add_link_elems()
1695 if (iftd && iftd->vendor_elems.data && iftd->vendor_elems.len) in ieee80211_add_link_elems()
1696 skb_put_data(skb, iftd->vendor_elems.data, iftd->vendor_elems.len); in ieee80211_add_link_elems()
1705 unsigned int skb_len = skb->len; in ieee80211_add_non_inheritance_elem()
1719 /* should at least be sorted in the sense of normal -> ext */ in ieee80211_add_non_inheritance_elem()
1749 /* if we added a list but no extension list, make a zero-len one */ in ieee80211_add_non_inheritance_elem()
1757 *len = skb->len - skb_len - 2; in ieee80211_add_non_inheritance_elem()
1767 struct ieee80211_local *local = sdata->local; in ieee80211_assoc_add_ml_elem()
1776 if (!ieee80211_vif_is_mld(&sdata->vif)) in ieee80211_assoc_add_ml_elem()
1779 ift_ext_capa = cfg80211_get_iftype_ext_capa(local->hw.wiphy, in ieee80211_assoc_add_ml_elem()
1780 ieee80211_vif_type_p2p(&sdata->vif)); in ieee80211_assoc_add_ml_elem()
1782 eml_capa = cpu_to_le16(ift_ext_capa->eml_capabilities); in ieee80211_assoc_add_ml_elem()
1783 mld_capa_ops = cpu_to_le16(ift_ext_capa->mld_capa_and_ops); in ieee80211_assoc_add_ml_elem()
1790 ml_elem->control = in ieee80211_assoc_add_ml_elem()
1794 common->len = sizeof(*common) + in ieee80211_assoc_add_ml_elem()
1796 memcpy(common->mld_mac_addr, sdata->vif.addr, ETH_ALEN); in ieee80211_assoc_add_ml_elem()
1802 common->len += 2; /* EML capabilities */ in ieee80211_assoc_add_ml_elem()
1803 ml_elem->control |= in ieee80211_assoc_add_ml_elem()
1817 if (!assoc_data->link[link_id].bss || in ieee80211_assoc_add_ml_elem()
1818 link_id == assoc_data->assoc_link_id) in ieee80211_assoc_add_ml_elem()
1821 extra_elems = assoc_data->link[link_id].elems; in ieee80211_assoc_add_ml_elem()
1822 extra_elems_len = assoc_data->link[link_id].elems_len; in ieee80211_assoc_add_ml_elem()
1832 skb_put_data(skb, assoc_data->link[link_id].addr, in ieee80211_assoc_add_ml_elem()
1853 extra_elems_len - extra_used); in ieee80211_assoc_add_ml_elem()
1873 struct ieee80211_local *local = sdata->local; in ieee80211_link_common_elems_size()
1881 sband = local->hw.wiphy->bands[cbss->channel->band]; in ieee80211_link_common_elems_size()
1887 size += 4 + sband->n_bitrates; in ieee80211_link_common_elems_size()
1890 size += 2 + 2 * sband->n_channels; in ieee80211_link_common_elems_size()
1894 size += iftd->vendor_elems.len; in ieee80211_link_common_elems_size()
1906 if (sband->band == NL80211_BAND_6GHZ) in ieee80211_link_common_elems_size()
1918 struct ieee80211_local *local = sdata->local; in ieee80211_send_assoc()
1919 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_send_assoc()
1920 struct ieee80211_mgd_assoc_data *assoc_data = ifmgd->assoc_data; in ieee80211_send_assoc()
1929 enum nl80211_iftype iftype = ieee80211_vif_type_p2p(&sdata->vif); in ieee80211_send_assoc()
1938 if (assoc_data->ie_len) in ieee80211_send_assoc()
1940 assoc_data->ie, in ieee80211_send_assoc()
1941 assoc_data->ie_len); in ieee80211_send_assoc()
1943 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_send_assoc()
1945 size = local->hw.extra_tx_headroom + in ieee80211_send_assoc()
1947 2 + assoc_data->ssid_len + /* SSID */ in ieee80211_send_assoc()
1948 assoc_data->ie_len + /* extra IEs */ in ieee80211_send_assoc()
1949 (assoc_data->fils_kek_len ? 16 /* AES-SIV */ : 0) + in ieee80211_send_assoc()
1953 struct cfg80211_bss *cbss = assoc_data->link[link_id].bss; in ieee80211_send_assoc()
1954 size_t elems_len = assoc_data->link[link_id].elems_len; in ieee80211_send_assoc()
1964 /* non-inheritance element */ in ieee80211_send_assoc()
1968 if (cbss->capability & WLAN_CAPABILITY_PRIVACY) in ieee80211_send_assoc()
1972 if (ieee80211_vif_is_mld(&sdata->vif)) { in ieee80211_send_assoc()
1973 /* consider the multi-link element with STA profile */ in ieee80211_send_assoc()
1975 /* max common info field in basic multi-link element */ in ieee80211_send_assoc()
1982 * note this over-estimates a bit because there's no in ieee80211_send_assoc()
1985 size += (n_links - 1) * in ieee80211_send_assoc()
1991 link = sdata_dereference(sdata->link[assoc_data->assoc_link_id], sdata); in ieee80211_send_assoc()
1993 return -EINVAL; in ieee80211_send_assoc()
1995 if (WARN_ON(!assoc_data->link[assoc_data->assoc_link_id].bss)) in ieee80211_send_assoc()
1996 return -EINVAL; in ieee80211_send_assoc()
2000 return -ENOMEM; in ieee80211_send_assoc()
2002 skb_reserve(skb, local->hw.extra_tx_headroom); in ieee80211_send_assoc()
2004 if (ifmgd->flags & IEEE80211_STA_ENABLE_RRM) in ieee80211_send_assoc()
2008 if (ieee80211_hw_check(&local->hw, SUPPORTS_ONLY_HE_MULTI_BSSID) && in ieee80211_send_assoc()
2009 link->u.mgd.conn.mode >= IEEE80211_CONN_MODE_HE && in ieee80211_send_assoc()
2010 ext_capa && ext_capa->datalen >= 3) in ieee80211_send_assoc()
2011 ext_capa->data[2] |= WLAN_EXT_CAPA3_MULTI_BSSID_SUPPORT; in ieee80211_send_assoc()
2014 memcpy(mgmt->da, sdata->vif.cfg.ap_addr, ETH_ALEN); in ieee80211_send_assoc()
2015 memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); in ieee80211_send_assoc()
2016 memcpy(mgmt->bssid, sdata->vif.cfg.ap_addr, ETH_ALEN); in ieee80211_send_assoc()
2018 listen_int = cpu_to_le16(assoc_data->s1g ? in ieee80211_send_assoc()
2019 ieee80211_encode_usf(local->hw.conf.listen_interval) : in ieee80211_send_assoc()
2020 local->hw.conf.listen_interval); in ieee80211_send_assoc()
2021 if (!is_zero_ether_addr(assoc_data->prev_ap_addr)) { in ieee80211_send_assoc()
2023 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | in ieee80211_send_assoc()
2025 capab_pos = &mgmt->u.reassoc_req.capab_info; in ieee80211_send_assoc()
2026 mgmt->u.reassoc_req.listen_interval = listen_int; in ieee80211_send_assoc()
2027 memcpy(mgmt->u.reassoc_req.current_ap, in ieee80211_send_assoc()
2028 assoc_data->prev_ap_addr, ETH_ALEN); in ieee80211_send_assoc()
2032 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | in ieee80211_send_assoc()
2034 capab_pos = &mgmt->u.assoc_req.capab_info; in ieee80211_send_assoc()
2035 mgmt->u.assoc_req.listen_interval = listen_int; in ieee80211_send_assoc()
2040 pos = skb_put(skb, 2 + assoc_data->ssid_len); in ieee80211_send_assoc()
2043 *pos++ = assoc_data->ssid_len; in ieee80211_send_assoc()
2044 memcpy(pos, assoc_data->ssid, assoc_data->ssid_len); in ieee80211_send_assoc()
2052 * pre-EHT connections as we used to do. in ieee80211_send_assoc()
2054 if (link->u.mgd.conn.mode < IEEE80211_CONN_MODE_EHT) in ieee80211_send_assoc()
2061 assoc_data->ie, in ieee80211_send_assoc()
2062 assoc_data->ie_len, in ieee80211_send_assoc()
2063 assoc_data->assoc_link_id, link, in ieee80211_send_assoc()
2067 /* if present, add any custom non-vendor IEs */ in ieee80211_send_assoc()
2068 if (assoc_data->ie_len) { in ieee80211_send_assoc()
2069 noffset = ieee80211_ie_split_vendor(assoc_data->ie, in ieee80211_send_assoc()
2070 assoc_data->ie_len, in ieee80211_send_assoc()
2072 skb_put_data(skb, assoc_data->ie + offset, noffset - offset); in ieee80211_send_assoc()
2076 if (assoc_data->wmm) { in ieee80211_send_assoc()
2077 if (assoc_data->uapsd) { in ieee80211_send_assoc()
2078 qos_info = ifmgd->uapsd_queues; in ieee80211_send_assoc()
2079 qos_info |= (ifmgd->uapsd_max_sp_len << in ieee80211_send_assoc()
2089 if (assoc_data->ie_len) { in ieee80211_send_assoc()
2090 noffset = assoc_data->ie_len; in ieee80211_send_assoc()
2091 skb_put_data(skb, assoc_data->ie + offset, noffset - offset); in ieee80211_send_assoc()
2094 if (assoc_data->fils_kek_len) { in ieee80211_send_assoc()
2103 kfree(ifmgd->assoc_req_ies); in ieee80211_send_assoc()
2104 ifmgd->assoc_req_ies = kmemdup(ie_start, pos - ie_start, GFP_ATOMIC); in ieee80211_send_assoc()
2105 if (!ifmgd->assoc_req_ies) { in ieee80211_send_assoc()
2107 return -ENOMEM; in ieee80211_send_assoc()
2110 ifmgd->assoc_req_ies_len = pos - ie_start; in ieee80211_send_assoc()
2112 info.link_id = assoc_data->assoc_link_id; in ieee80211_send_assoc()
2115 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; in ieee80211_send_assoc()
2116 if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) in ieee80211_send_assoc()
2117 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS | in ieee80211_send_assoc()
2130 skb = ieee80211_pspoll_get(&local->hw, &sdata->vif); in ieee80211_send_pspoll()
2134 pspoll = (struct ieee80211_pspoll *) skb->data; in ieee80211_send_pspoll()
2135 pspoll->frame_control |= cpu_to_le16(IEEE80211_FCTL_PM); in ieee80211_send_pspoll()
2137 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; in ieee80211_send_pspoll()
2147 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_send_nullfunc()
2149 skb = ieee80211_nullfunc_get(&local->hw, &sdata->vif, -1, in ieee80211_send_nullfunc()
2150 !ieee80211_hw_check(&local->hw, in ieee80211_send_nullfunc()
2155 nullfunc = (struct ieee80211_hdr_3addr *) skb->data; in ieee80211_send_nullfunc()
2157 nullfunc->frame_control |= cpu_to_le16(IEEE80211_FCTL_PM); in ieee80211_send_nullfunc()
2159 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT | in ieee80211_send_nullfunc()
2162 if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) in ieee80211_send_nullfunc()
2163 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS; in ieee80211_send_nullfunc()
2165 if (ifmgd->flags & IEEE80211_STA_CONNECTION_POLL) in ieee80211_send_nullfunc()
2166 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_CTL_USE_MINRATE; in ieee80211_send_nullfunc()
2178 if (WARN_ON(sdata->vif.type != NL80211_IFTYPE_STATION)) in ieee80211_send_4addr_nullfunc()
2181 skb = dev_alloc_skb(local->hw.extra_tx_headroom + 30); in ieee80211_send_4addr_nullfunc()
2185 skb_reserve(skb, local->hw.extra_tx_headroom); in ieee80211_send_4addr_nullfunc()
2190 nullfunc->frame_control = fc; in ieee80211_send_4addr_nullfunc()
2191 memcpy(nullfunc->addr1, sdata->deflink.u.mgd.bssid, ETH_ALEN); in ieee80211_send_4addr_nullfunc()
2192 memcpy(nullfunc->addr2, sdata->vif.addr, ETH_ALEN); in ieee80211_send_4addr_nullfunc()
2193 memcpy(nullfunc->addr3, sdata->deflink.u.mgd.bssid, ETH_ALEN); in ieee80211_send_4addr_nullfunc()
2194 memcpy(nullfunc->addr4, sdata->vif.addr, ETH_ALEN); in ieee80211_send_4addr_nullfunc()
2196 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; in ieee80211_send_4addr_nullfunc()
2197 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_CTL_USE_MINRATE; in ieee80211_send_4addr_nullfunc()
2208 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_csa_switch_work()
2209 struct ieee80211_local *local = sdata->local; in ieee80211_csa_switch_work()
2210 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_csa_switch_work()
2216 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_csa_switch_work()
2218 if (!ifmgd->associated) in ieee80211_csa_switch_work()
2221 if (!link->conf->csa_active) in ieee80211_csa_switch_work()
2229 if (!ieee80211_vif_link_active(&sdata->vif, link->link_id)) { in ieee80211_csa_switch_work()
2230 link->conf->chanreq = link->csa.chanreq; in ieee80211_csa_switch_work()
2231 cfg80211_ch_switch_notify(sdata->dev, &link->csa.chanreq.oper, in ieee80211_csa_switch_work()
2232 link->link_id); in ieee80211_csa_switch_work()
2238 * with multi-vif. once reservation is complete it will re-schedule the in ieee80211_csa_switch_work()
2243 if (link->reserved_chanctx) { in ieee80211_csa_switch_work()
2245 * with multi-vif csa driver may call ieee80211_csa_finish() in ieee80211_csa_switch_work()
2249 if (link->reserved_ready) in ieee80211_csa_switch_work()
2257 wiphy_work_queue(sdata->local->hw.wiphy, in ieee80211_csa_switch_work()
2258 &ifmgd->csa_connection_drop_work); in ieee80211_csa_switch_work()
2263 if (!ieee80211_chanreq_identical(&link->conf->chanreq, in ieee80211_csa_switch_work()
2264 &link->csa.chanreq)) { in ieee80211_csa_switch_work()
2267 wiphy_work_queue(sdata->local->hw.wiphy, in ieee80211_csa_switch_work()
2268 &ifmgd->csa_connection_drop_work); in ieee80211_csa_switch_work()
2272 link->u.mgd.csa.waiting_bcn = true; in ieee80211_csa_switch_work()
2275 if (link->u.mgd.csa.ap_chandef.chan->band == NL80211_BAND_6GHZ && in ieee80211_csa_switch_work()
2276 link->u.mgd.conn.mode >= IEEE80211_CONN_MODE_HE) { in ieee80211_csa_switch_work()
2277 ieee80211_rearrange_tpe(&link->u.mgd.csa.tpe, in ieee80211_csa_switch_work()
2278 &link->u.mgd.csa.ap_chandef, in ieee80211_csa_switch_work()
2279 &link->conf->chanreq.oper); in ieee80211_csa_switch_work()
2280 if (memcmp(&link->conf->tpe, &link->u.mgd.csa.tpe, in ieee80211_csa_switch_work()
2281 sizeof(link->u.mgd.csa.tpe))) { in ieee80211_csa_switch_work()
2282 link->conf->tpe = link->u.mgd.csa.tpe; in ieee80211_csa_switch_work()
2294 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_chswitch_post_beacon()
2295 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_chswitch_post_beacon()
2298 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_chswitch_post_beacon()
2300 WARN_ON(!link->conf->csa_active); in ieee80211_chswitch_post_beacon()
2304 link->conf->csa_active = false; in ieee80211_chswitch_post_beacon()
2305 link->u.mgd.csa.blocked_tx = false; in ieee80211_chswitch_post_beacon()
2306 link->u.mgd.csa.waiting_bcn = false; in ieee80211_chswitch_post_beacon()
2312 wiphy_work_queue(sdata->local->hw.wiphy, in ieee80211_chswitch_post_beacon()
2313 &ifmgd->csa_connection_drop_work); in ieee80211_chswitch_post_beacon()
2317 cfg80211_ch_switch_notify(sdata->dev, &link->conf->chanreq.oper, in ieee80211_chswitch_post_beacon()
2318 link->link_id); in ieee80211_chswitch_post_beacon()
2334 wiphy_work_queue(sdata->local->hw.wiphy, in ieee80211_chswitch_done()
2335 &sdata->u.mgd.csa_connection_drop_work); in ieee80211_chswitch_done()
2338 rcu_dereference(sdata->link[link_id]); in ieee80211_chswitch_done()
2345 wiphy_delayed_work_queue(sdata->local->hw.wiphy, in ieee80211_chswitch_done()
2346 &link->u.mgd.csa.switch_work, 0); in ieee80211_chswitch_done()
2356 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_sta_abort_chanswitch()
2357 struct ieee80211_local *local = sdata->local; in ieee80211_sta_abort_chanswitch()
2359 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_sta_abort_chanswitch()
2361 if (!local->ops->abort_channel_switch) in ieee80211_sta_abort_chanswitch()
2368 link->conf->csa_active = false; in ieee80211_sta_abort_chanswitch()
2369 link->u.mgd.csa.blocked_tx = false; in ieee80211_sta_abort_chanswitch()
2386 struct ieee80211_link_data *link = data->link; in ieee80211_sta_csa_rnr_iter()
2387 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_sta_csa_rnr_iter()
2388 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_sta_csa_rnr_iter()
2402 if (ti->mld_params.mld_id != data->mld_id) in ieee80211_sta_csa_rnr_iter()
2405 link_id = le16_get_bits(ti->mld_params.params, in ieee80211_sta_csa_rnr_iter()
2407 if (link_id != data->link->link_id) in ieee80211_sta_csa_rnr_iter()
2413 if (!ieee80211_operating_class_to_band(info->op_class, &band)) { in ieee80211_sta_csa_rnr_iter()
2416 wiphy_work_queue(sdata->local->hw.wiphy, in ieee80211_sta_csa_rnr_iter()
2417 &ifmgd->csa_connection_drop_work); in ieee80211_sta_csa_rnr_iter()
2421 center_freq = ieee80211_channel_to_frequency(info->channel, band); in ieee80211_sta_csa_rnr_iter()
2422 data->chan = ieee80211_get_channel(sdata->local->hw.wiphy, center_freq); in ieee80211_sta_csa_rnr_iter()
2431 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_sta_other_link_csa_disappeared()
2432 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_sta_other_link_csa_disappeared()
2447 if (WARN_ON(!elems->ml_basic)) in ieee80211_sta_other_link_csa_disappeared()
2450 data.mld_id = ieee80211_mle_get_mld_id((const void *)elems->ml_basic); in ieee80211_sta_other_link_csa_disappeared()
2456 cfg80211_iter_rnr(elems->ie_start, elems->total_len, in ieee80211_sta_other_link_csa_disappeared()
2462 wiphy_work_queue(sdata->local->hw.wiphy, in ieee80211_sta_other_link_csa_disappeared()
2463 &ifmgd->csa_connection_drop_work); in ieee80211_sta_other_link_csa_disappeared()
2474 if (data.chan != link->csa.chanreq.oper.chan) in ieee80211_sta_other_link_csa_disappeared()
2492 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_sta_process_chanswitch()
2493 struct ieee80211_local *local = sdata->local; in ieee80211_sta_process_chanswitch()
2494 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_sta_process_chanswitch()
2499 .link_id = link->link_id, in ieee80211_sta_process_chanswitch()
2506 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_sta_process_chanswitch()
2509 struct cfg80211_bss *cbss = link->conf->bss; in ieee80211_sta_process_chanswitch()
2516 current_band = cbss->channel->band; in ieee80211_sta_process_chanswitch()
2517 bss = (void *)cbss->priv; in ieee80211_sta_process_chanswitch()
2521 bss->vht_cap_info, in ieee80211_sta_process_chanswitch()
2522 &link->u.mgd.conn, in ieee80211_sta_process_chanswitch()
2523 link->u.mgd.bssid, in ieee80211_sta_process_chanswitch()
2533 link->u.mgd.csa.tpe = csa_elems->csa_tpe; in ieee80211_sta_process_chanswitch()
2536 * If there was no per-STA profile for this link, we in ieee80211_sta_process_chanswitch()
2551 if (link->conf->csa_active) { in ieee80211_sta_process_chanswitch()
2555 /* already processing - disregard action frames */ in ieee80211_sta_process_chanswitch()
2558 if (link->u.mgd.csa.waiting_bcn) { in ieee80211_sta_process_chanswitch()
2576 if (ieee80211_vif_link_active(&sdata->vif, in ieee80211_sta_process_chanswitch()
2577 link->link_id)) in ieee80211_sta_process_chanswitch()
2581 if (link->u.mgd.csa.waiting_bcn) { in ieee80211_sta_process_chanswitch()
2608 * bit set. This is a trade-off, we want to be quiet as soon as in ieee80211_sta_process_chanswitch()
2612 if (unlikely(link->u.mgd.csa.blocked_tx)) { in ieee80211_sta_process_chanswitch()
2613 link->u.mgd.csa.blocked_tx = false; in ieee80211_sta_process_chanswitch()
2627 link->u.mgd.csa.blocked_tx = true; in ieee80211_sta_process_chanswitch()
2633 if (link->conf->chanreq.oper.chan->band != in ieee80211_sta_process_chanswitch()
2634 csa_ie.chanreq.oper.chan->band) { in ieee80211_sta_process_chanswitch()
2637 link->u.mgd.bssid, in ieee80211_sta_process_chanswitch()
2638 csa_ie.chanreq.oper.chan->center_freq, in ieee80211_sta_process_chanswitch()
2645 if (!cfg80211_chandef_usable(local->hw.wiphy, &csa_ie.chanreq.oper, in ieee80211_sta_process_chanswitch()
2649 link->u.mgd.bssid, in ieee80211_sta_process_chanswitch()
2650 csa_ie.chanreq.oper.chan->center_freq, in ieee80211_sta_process_chanswitch()
2651 csa_ie.chanreq.oper.chan->freq_offset, in ieee80211_sta_process_chanswitch()
2660 &link->conf->chanreq.oper) && in ieee80211_sta_process_chanswitch()
2662 if (link->u.mgd.csa.ignored_same_chan) in ieee80211_sta_process_chanswitch()
2666 link->u.mgd.bssid); in ieee80211_sta_process_chanswitch()
2667 link->u.mgd.csa.ignored_same_chan = true; in ieee80211_sta_process_chanswitch()
2672 * Drop all TDLS peers on the affected link - either we disconnect or in ieee80211_sta_process_chanswitch()
2680 conf = rcu_dereference_protected(link->conf->chanctx_conf, in ieee80211_sta_process_chanswitch()
2681 lockdep_is_held(&local->hw.wiphy->mtx)); in ieee80211_sta_process_chanswitch()
2682 if (ieee80211_vif_link_active(&sdata->vif, link->link_id) && !conf) { in ieee80211_sta_process_chanswitch()
2691 if (!ieee80211_hw_check(&local->hw, CHANCTX_STA_CSA)) { in ieee80211_sta_process_chanswitch()
2693 "driver doesn't support chan-switch with channel contexts\n"); in ieee80211_sta_process_chanswitch()
2703 link->u.mgd.csa.ap_chandef = csa_ie.chanreq.ap; in ieee80211_sta_process_chanswitch()
2705 link->csa.chanreq.oper = csa_ie.chanreq.oper; in ieee80211_sta_process_chanswitch()
2706 ieee80211_set_chanreq_ap(sdata, &link->csa.chanreq, &link->u.mgd.conn, in ieee80211_sta_process_chanswitch()
2710 res = ieee80211_link_reserve_chanctx(link, &link->csa.chanreq, in ieee80211_sta_process_chanswitch()
2711 chanctx->mode, false); in ieee80211_sta_process_chanswitch()
2720 link->conf->csa_active = true; in ieee80211_sta_process_chanswitch()
2721 link->u.mgd.csa.ignored_same_chan = false; in ieee80211_sta_process_chanswitch()
2722 link->u.mgd.beacon_crc_valid = false; in ieee80211_sta_process_chanswitch()
2723 link->u.mgd.csa.blocked_tx = csa_ie.mode; in ieee80211_sta_process_chanswitch()
2728 cfg80211_ch_switch_started_notify(sdata->dev, &csa_ie.chanreq.oper, in ieee80211_sta_process_chanswitch()
2729 link->link_id, csa_ie.count, in ieee80211_sta_process_chanswitch()
2734 link->u.mgd.csa.time = now + in ieee80211_sta_process_chanswitch()
2735 TU_TO_JIFFIES((max_t(int, csa_ie.count, 1) - 1) * in ieee80211_sta_process_chanswitch()
2736 link->conf->beacon_int); in ieee80211_sta_process_chanswitch()
2738 if (ieee80211_vif_link_active(&sdata->vif, link->link_id) && in ieee80211_sta_process_chanswitch()
2739 local->ops->channel_switch) { in ieee80211_sta_process_chanswitch()
2751 wiphy_delayed_work_queue(local->hw.wiphy, in ieee80211_sta_process_chanswitch()
2752 &link->u.mgd.csa.switch_work, in ieee80211_sta_process_chanswitch()
2753 link->u.mgd.csa.time - now); in ieee80211_sta_process_chanswitch()
2763 link->conf->csa_active = true; in ieee80211_sta_process_chanswitch()
2764 link->u.mgd.csa.blocked_tx = csa_ie.mode; in ieee80211_sta_process_chanswitch()
2766 wiphy_work_queue(sdata->local->hw.wiphy, in ieee80211_sta_process_chanswitch()
2767 &ifmgd->csa_connection_drop_work); in ieee80211_sta_process_chanswitch()
2782 struct ieee80211_sub_if_data *sdata = data->sdata; in ieee80211_sta_bss_param_ch_cnt_iter()
2795 if (ti->mld_params.mld_id != data->mld_id) in ieee80211_sta_bss_param_ch_cnt_iter()
2798 link_id = le16_get_bits(ti->mld_params.params, in ieee80211_sta_bss_param_ch_cnt_iter()
2801 le16_get_bits(ti->mld_params.params, in ieee80211_sta_bss_param_ch_cnt_iter()
2805 link_id < ARRAY_SIZE(sdata->link)) { in ieee80211_sta_bss_param_ch_cnt_iter()
2807 sdata_dereference(sdata->link[link_id], sdata); in ieee80211_sta_bss_param_ch_cnt_iter()
2809 if (link && link->conf->bss_param_ch_cnt != bss_param_ch_cnt) { in ieee80211_sta_bss_param_ch_cnt_iter()
2810 link->conf->bss_param_ch_cnt = bss_param_ch_cnt; in ieee80211_sta_bss_param_ch_cnt_iter()
2811 link->conf->bss_param_ch_cnt_link_id = in ieee80211_sta_bss_param_ch_cnt_iter()
2812 data->reporting_link_id; in ieee80211_sta_bss_param_ch_cnt_iter()
2825 .reporting_link_id = bss_conf->link_id, in ieee80211_mgd_update_bss_param_ch_cnt()
2830 if (!elems->ml_basic) in ieee80211_mgd_update_bss_param_ch_cnt()
2833 data.mld_id = ieee80211_mle_get_mld_id((const void *)elems->ml_basic); in ieee80211_mgd_update_bss_param_ch_cnt()
2835 cfg80211_iter_rnr(elems->ie_start, elems->total_len, in ieee80211_mgd_update_bss_param_ch_cnt()
2839 ieee80211_mle_get_bss_param_ch_cnt((const void *)elems->ml_basic); in ieee80211_mgd_update_bss_param_ch_cnt()
2847 bss_conf->bss_param_ch_cnt = bss_param_ch_cnt; in ieee80211_mgd_update_bss_param_ch_cnt()
2848 bss_conf->bss_param_ch_cnt_link_id = in ieee80211_mgd_update_bss_param_ch_cnt()
2849 bss_conf->link_id; in ieee80211_mgd_update_bss_param_ch_cnt()
2860 int chan = ieee80211_frequency_to_channel(channel->center_freq); in ieee80211_find_80211h_pwr_constr()
2869 country_ie_len -= 3; in ieee80211_find_80211h_pwr_constr()
2871 switch (channel->band) { in ieee80211_find_80211h_pwr_constr()
2896 u8 first_channel = triplet->chans.first_channel; in ieee80211_find_80211h_pwr_constr()
2901 for (i = 0; i < triplet->chans.num_channels; i++) { in ieee80211_find_80211h_pwr_constr()
2904 *chan_pwr = triplet->chans.max_power; in ieee80211_find_80211h_pwr_constr()
2913 country_ie_len -= 3; in ieee80211_find_80211h_pwr_constr()
2930 * APs clearly state the range is -127 to 127 dBm, which indicates in ieee80211_find_cisco_dtpc()
2944 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_handle_pwr_constr()
2949 __le16 capab = mgmt->u.probe_resp.capab_info; in ieee80211_handle_pwr_constr()
2951 if (ieee80211_is_s1g_beacon(mgmt->frame_control)) in ieee80211_handle_pwr_constr()
2961 max_t(int, 0, chan_pwr - pwr_reduction_80211h); in ieee80211_handle_pwr_constr()
2980 if (link->ap_power_level == new_ap_level) in ieee80211_handle_pwr_constr()
2984 "Limiting TX power to %d (%d - %d) dBm as advertised by %pM\n", in ieee80211_handle_pwr_constr()
2986 link->u.mgd.bssid); in ieee80211_handle_pwr_constr()
2990 if (link->ap_power_level == new_ap_level) in ieee80211_handle_pwr_constr()
2995 pwr_level_cisco, link->u.mgd.bssid); in ieee80211_handle_pwr_constr()
2998 link->ap_power_level = new_ap_level; in ieee80211_handle_pwr_constr()
3008 struct ieee80211_conf *conf = &local->hw.conf; in ieee80211_enable_ps()
3014 if (local->scanning) in ieee80211_enable_ps()
3017 if (conf->dynamic_ps_timeout > 0 && in ieee80211_enable_ps()
3018 !ieee80211_hw_check(&local->hw, SUPPORTS_DYNAMIC_PS)) { in ieee80211_enable_ps()
3019 mod_timer(&local->dynamic_ps_timer, jiffies + in ieee80211_enable_ps()
3020 msecs_to_jiffies(conf->dynamic_ps_timeout)); in ieee80211_enable_ps()
3022 if (ieee80211_hw_check(&local->hw, PS_NULLFUNC_STACK)) in ieee80211_enable_ps()
3025 if (ieee80211_hw_check(&local->hw, PS_NULLFUNC_STACK) && in ieee80211_enable_ps()
3026 ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) in ieee80211_enable_ps()
3029 conf->flags |= IEEE80211_CONF_PS; in ieee80211_enable_ps()
3036 struct ieee80211_conf *conf = &local->hw.conf; in ieee80211_change_ps()
3038 if (local->ps_sdata) { in ieee80211_change_ps()
3039 ieee80211_enable_ps(local, local->ps_sdata); in ieee80211_change_ps()
3040 } else if (conf->flags & IEEE80211_CONF_PS) { in ieee80211_change_ps()
3041 conf->flags &= ~IEEE80211_CONF_PS; in ieee80211_change_ps()
3043 del_timer_sync(&local->dynamic_ps_timer); in ieee80211_change_ps()
3044 wiphy_work_cancel(local->hw.wiphy, in ieee80211_change_ps()
3045 &local->dynamic_ps_enable_work); in ieee80211_change_ps()
3051 struct ieee80211_local *local = sdata->local; in ieee80211_powersave_allowed()
3052 struct ieee80211_if_managed *mgd = &sdata->u.mgd; in ieee80211_powersave_allowed()
3056 if (!mgd->powersave) in ieee80211_powersave_allowed()
3059 if (mgd->broken_ap) in ieee80211_powersave_allowed()
3062 if (!mgd->associated) in ieee80211_powersave_allowed()
3065 if (mgd->flags & IEEE80211_STA_CONNECTION_POLL) in ieee80211_powersave_allowed()
3068 if (!(local->hw.wiphy->flags & WIPHY_FLAG_SUPPORTS_MLO) && in ieee80211_powersave_allowed()
3069 !sdata->deflink.u.mgd.have_beacon) in ieee80211_powersave_allowed()
3073 sta = sta_info_get(sdata, sdata->vif.cfg.ap_addr); in ieee80211_powersave_allowed()
3088 if (!ieee80211_hw_check(&local->hw, SUPPORTS_PS) || in ieee80211_recalc_ps()
3089 ieee80211_hw_check(&local->hw, SUPPORTS_DYNAMIC_PS)) { in ieee80211_recalc_ps()
3090 local->ps_sdata = NULL; in ieee80211_recalc_ps()
3094 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_recalc_ps()
3097 if (sdata->vif.type == NL80211_IFTYPE_AP) { in ieee80211_recalc_ps()
3105 if (sdata->vif.type != NL80211_IFTYPE_STATION) in ieee80211_recalc_ps()
3112 u8 dtimper = found->deflink.u.mgd.dtim_period; in ieee80211_recalc_ps()
3114 timeout = local->dynamic_ps_forced_timeout; in ieee80211_recalc_ps()
3117 local->hw.conf.dynamic_ps_timeout = timeout; in ieee80211_recalc_ps()
3123 local->hw.conf.ps_dtim_period = dtimper; in ieee80211_recalc_ps()
3124 local->ps_sdata = found; in ieee80211_recalc_ps()
3126 local->ps_sdata = NULL; in ieee80211_recalc_ps()
3136 if (sdata->vif.cfg.ps != ps_allowed) { in ieee80211_recalc_ps_vif()
3137 sdata->vif.cfg.ps = ps_allowed; in ieee80211_recalc_ps_vif()
3149 if (local->hw.conf.flags & IEEE80211_CONF_PS) { in ieee80211_dynamic_ps_disable_work()
3150 local->hw.conf.flags &= ~IEEE80211_CONF_PS; in ieee80211_dynamic_ps_disable_work()
3154 ieee80211_wake_queues_by_reason(&local->hw, in ieee80211_dynamic_ps_disable_work()
3166 struct ieee80211_sub_if_data *sdata = local->ps_sdata; in ieee80211_dynamic_ps_enable_work()
3175 ifmgd = &sdata->u.mgd; in ieee80211_dynamic_ps_enable_work()
3177 if (local->hw.conf.flags & IEEE80211_CONF_PS) in ieee80211_dynamic_ps_enable_work()
3180 if (local->hw.conf.dynamic_ps_timeout > 0) { in ieee80211_dynamic_ps_enable_work()
3183 mod_timer(&local->dynamic_ps_timer, jiffies + in ieee80211_dynamic_ps_enable_work()
3185 local->hw.conf.dynamic_ps_timeout)); in ieee80211_dynamic_ps_enable_work()
3194 spin_lock_irqsave(&local->queue_stop_reason_lock, flags); in ieee80211_dynamic_ps_enable_work()
3195 for (q = 0; q < local->hw.queues; q++) { in ieee80211_dynamic_ps_enable_work()
3196 if (local->queue_stop_reasons[q]) { in ieee80211_dynamic_ps_enable_work()
3197 spin_unlock_irqrestore(&local->queue_stop_reason_lock, in ieee80211_dynamic_ps_enable_work()
3199 mod_timer(&local->dynamic_ps_timer, jiffies + in ieee80211_dynamic_ps_enable_work()
3201 local->hw.conf.dynamic_ps_timeout)); in ieee80211_dynamic_ps_enable_work()
3205 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); in ieee80211_dynamic_ps_enable_work()
3208 if (ieee80211_hw_check(&local->hw, PS_NULLFUNC_STACK) && in ieee80211_dynamic_ps_enable_work()
3209 !(ifmgd->flags & IEEE80211_STA_NULLFUNC_ACKED)) { in ieee80211_dynamic_ps_enable_work()
3211 mod_timer(&local->dynamic_ps_timer, jiffies + in ieee80211_dynamic_ps_enable_work()
3213 local->hw.conf.dynamic_ps_timeout)); in ieee80211_dynamic_ps_enable_work()
3221 if (!(ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS) && in ieee80211_dynamic_ps_enable_work()
3222 ieee80211_hw_check(&local->hw, PS_NULLFUNC_STACK)) || in ieee80211_dynamic_ps_enable_work()
3223 (ifmgd->flags & IEEE80211_STA_NULLFUNC_ACKED)) { in ieee80211_dynamic_ps_enable_work()
3224 ifmgd->flags &= ~IEEE80211_STA_NULLFUNC_ACKED; in ieee80211_dynamic_ps_enable_work()
3225 local->hw.conf.flags |= IEEE80211_CONF_PS; in ieee80211_dynamic_ps_enable_work()
3234 wiphy_work_queue(local->hw.wiphy, &local->dynamic_ps_enable_work); in ieee80211_dynamic_ps_timer()
3242 struct cfg80211_chan_def chandef = link->conf->chanreq.oper; in ieee80211_dfs_cac_timer_work()
3243 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_dfs_cac_timer_work()
3245 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_dfs_cac_timer_work()
3247 if (sdata->wdev.links[link->link_id].cac_started) { in ieee80211_dfs_cac_timer_work()
3249 cfg80211_cac_event(sdata->dev, &chandef, in ieee80211_dfs_cac_timer_work()
3251 GFP_KERNEL, link->link_id); in ieee80211_dfs_cac_timer_work()
3258 struct ieee80211_local *local = sdata->local; in __ieee80211_sta_handle_tspec_ac_params()
3259 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in __ieee80211_sta_handle_tspec_ac_params()
3263 if (local->hw.queues < IEEE80211_NUM_ACS) in __ieee80211_sta_handle_tspec_ac_params()
3267 struct ieee80211_sta_tx_tspec *tx_tspec = &ifmgd->tx_tspec[ac]; in __ieee80211_sta_handle_tspec_ac_params()
3271 if (tx_tspec->action == TX_TSPEC_ACTION_NONE && in __ieee80211_sta_handle_tspec_ac_params()
3272 tx_tspec->admitted_time && in __ieee80211_sta_handle_tspec_ac_params()
3273 time_after(now, tx_tspec->time_slice_start + HZ)) { in __ieee80211_sta_handle_tspec_ac_params()
3274 tx_tspec->consumed_tx_time = 0; in __ieee80211_sta_handle_tspec_ac_params()
3275 tx_tspec->time_slice_start = now; in __ieee80211_sta_handle_tspec_ac_params()
3277 if (tx_tspec->downgraded) in __ieee80211_sta_handle_tspec_ac_params()
3278 tx_tspec->action = in __ieee80211_sta_handle_tspec_ac_params()
3282 switch (tx_tspec->action) { in __ieee80211_sta_handle_tspec_ac_params()
3285 if (drv_conf_tx(local, &sdata->deflink, ac, in __ieee80211_sta_handle_tspec_ac_params()
3286 &sdata->deflink.tx_conf[ac])) in __ieee80211_sta_handle_tspec_ac_params()
3287 link_err(&sdata->deflink, in __ieee80211_sta_handle_tspec_ac_params()
3290 tx_tspec->action = TX_TSPEC_ACTION_NONE; in __ieee80211_sta_handle_tspec_ac_params()
3291 tx_tspec->downgraded = false; in __ieee80211_sta_handle_tspec_ac_params()
3295 if (time_after(now, tx_tspec->time_slice_start + HZ)) { in __ieee80211_sta_handle_tspec_ac_params()
3296 tx_tspec->action = TX_TSPEC_ACTION_NONE; in __ieee80211_sta_handle_tspec_ac_params()
3300 /* downgrade next lower non-ACM AC */ in __ieee80211_sta_handle_tspec_ac_params()
3304 if (!(sdata->wmm_acm & BIT(7 - 2 * non_acm_ac))) in __ieee80211_sta_handle_tspec_ac_params()
3308 * makes no sense and we have to transmit somehow - the in __ieee80211_sta_handle_tspec_ac_params()
3315 if (drv_conf_tx(local, &sdata->deflink, ac, in __ieee80211_sta_handle_tspec_ac_params()
3316 &sdata->deflink.tx_conf[non_acm_ac])) in __ieee80211_sta_handle_tspec_ac_params()
3317 link_err(&sdata->deflink, in __ieee80211_sta_handle_tspec_ac_params()
3320 tx_tspec->action = TX_TSPEC_ACTION_NONE; in __ieee80211_sta_handle_tspec_ac_params()
3322 wiphy_delayed_work_queue(local->hw.wiphy, in __ieee80211_sta_handle_tspec_ac_params()
3323 &ifmgd->tx_tspec_wk, in __ieee80211_sta_handle_tspec_ac_params()
3324 tx_tspec->time_slice_start + in __ieee80211_sta_handle_tspec_ac_params()
3325 HZ - now + 1); in __ieee80211_sta_handle_tspec_ac_params()
3339 ieee80211_link_info_change_notify(sdata, &sdata->deflink, in ieee80211_sta_handle_tspec_ac_params()
3355 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_mgd_set_link_qos_params()
3356 struct ieee80211_local *local = sdata->local; in ieee80211_mgd_set_link_qos_params()
3357 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_mgd_set_link_qos_params()
3358 struct ieee80211_tx_queue_params *params = link->tx_conf; in ieee80211_mgd_set_link_qos_params()
3367 ifmgd->tx_tspec[ac].downgraded); in ieee80211_mgd_set_link_qos_params()
3368 if (!ifmgd->tx_tspec[ac].downgraded && in ieee80211_mgd_set_link_qos_params()
3383 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_sta_wmm_params()
3385 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_sta_wmm_params()
3391 if (!local->ops->conf_tx) in ieee80211_sta_wmm_params()
3394 if (local->hw.queues < IEEE80211_NUM_ACS) in ieee80211_sta_wmm_params()
3403 if (ifmgd->flags & IEEE80211_STA_UAPSD_ENABLED) in ieee80211_sta_wmm_params()
3404 uapsd_queues = ifmgd->uapsd_queues; in ieee80211_sta_wmm_params()
3407 /* -1 is the initial value of ifmgd->mu_edca_last_param_set. in ieee80211_sta_wmm_params()
3411 mu_edca_count = mu_edca ? mu_edca->mu_qos_info & 0x0f : -1; in ieee80211_sta_wmm_params()
3412 if (count == link->u.mgd.wmm_last_param_set && in ieee80211_sta_wmm_params()
3413 mu_edca_count == link->u.mgd.mu_edca_last_param_set) in ieee80211_sta_wmm_params()
3415 link->u.mgd.wmm_last_param_set = count; in ieee80211_sta_wmm_params()
3416 link->u.mgd.mu_edca_last_param_set = mu_edca_count; in ieee80211_sta_wmm_params()
3419 left = wmm_param_len - 8; in ieee80211_sta_wmm_params()
3423 sdata->wmm_acm = 0; in ieee80211_sta_wmm_params()
3424 for (; left >= 4; left -= 4, pos += 4) { in ieee80211_sta_wmm_params()
3433 sdata->wmm_acm |= BIT(1) | BIT(2); /* BK/- */ in ieee80211_sta_wmm_params()
3438 params[ac].mu_edca_param_rec = mu_edca->ac_bk; in ieee80211_sta_wmm_params()
3443 sdata->wmm_acm |= BIT(4) | BIT(5); /* CL/VI */ in ieee80211_sta_wmm_params()
3448 params[ac].mu_edca_param_rec = mu_edca->ac_vi; in ieee80211_sta_wmm_params()
3453 sdata->wmm_acm |= BIT(6) | BIT(7); /* VO/NC */ in ieee80211_sta_wmm_params()
3458 params[ac].mu_edca_param_rec = mu_edca->ac_vo; in ieee80211_sta_wmm_params()
3464 sdata->wmm_acm |= BIT(0) | BIT(3); /* BE/EE */ in ieee80211_sta_wmm_params()
3469 params[ac].mu_edca_param_rec = mu_edca->ac_be; in ieee80211_sta_wmm_params()
3508 link->tx_conf[ac] = params[ac]; in ieee80211_sta_wmm_params()
3513 link->conf->qos = true; in ieee80211_sta_wmm_params()
3519 lockdep_assert_wiphy(sdata->local->hw.wiphy); in __ieee80211_stop_poll()
3521 sdata->u.mgd.flags &= ~IEEE80211_STA_CONNECTION_POLL; in __ieee80211_stop_poll()
3522 ieee80211_run_deferred_scan(sdata->local); in __ieee80211_stop_poll()
3527 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_stop_poll()
3535 struct ieee80211_bss_conf *bss_conf = link->conf; in ieee80211_handle_bss_capability()
3555 if (sband->band == NL80211_BAND_5GHZ || in ieee80211_handle_bss_capability()
3556 sband->band == NL80211_BAND_6GHZ) in ieee80211_handle_bss_capability()
3559 if (use_protection != bss_conf->use_cts_prot) { in ieee80211_handle_bss_capability()
3560 bss_conf->use_cts_prot = use_protection; in ieee80211_handle_bss_capability()
3564 if (use_short_preamble != bss_conf->use_short_preamble) { in ieee80211_handle_bss_capability()
3565 bss_conf->use_short_preamble = use_short_preamble; in ieee80211_handle_bss_capability()
3569 if (use_short_slot != bss_conf->use_short_slot) { in ieee80211_handle_bss_capability()
3570 bss_conf->use_short_slot = use_short_slot; in ieee80211_handle_bss_capability()
3580 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_link_set_associated()
3581 struct ieee80211_bss_conf *bss_conf = link->conf; in ieee80211_link_set_associated()
3582 struct ieee80211_bss *bss = (void *)cbss->priv; in ieee80211_link_set_associated()
3586 sdata->u.mgd.beacon_timeout = in ieee80211_link_set_associated()
3588 bss_conf->beacon_int)); in ieee80211_link_set_associated()
3591 bss_conf->assoc_capability, in ieee80211_link_set_associated()
3592 bss->has_erp_value, in ieee80211_link_set_associated()
3593 bss->erp_value); in ieee80211_link_set_associated()
3597 link->conf->bss = cbss; in ieee80211_link_set_associated()
3598 memcpy(link->u.mgd.bssid, cbss->bssid, ETH_ALEN); in ieee80211_link_set_associated()
3600 if (sdata->vif.p2p || in ieee80211_link_set_associated()
3601 sdata->vif.driver_flags & IEEE80211_VIF_GET_NOA_UPDATE) { in ieee80211_link_set_associated()
3605 ies = rcu_dereference(cbss->ies); in ieee80211_link_set_associated()
3610 ies->data, ies->len, in ieee80211_link_set_associated()
3612 (u8 *) &bss_conf->p2p_noa_attr, in ieee80211_link_set_associated()
3613 sizeof(bss_conf->p2p_noa_attr)); in ieee80211_link_set_associated()
3615 link->u.mgd.p2p_noa_index = in ieee80211_link_set_associated()
3616 bss_conf->p2p_noa_attr.index; in ieee80211_link_set_associated()
3623 if (link->u.mgd.have_beacon) { in ieee80211_link_set_associated()
3624 bss_conf->beacon_rate = bss->beacon_rate; in ieee80211_link_set_associated()
3627 bss_conf->beacon_rate = NULL; in ieee80211_link_set_associated()
3631 if (sdata->vif.driver_flags & IEEE80211_VIF_SUPPORTS_CQM_RSSI && in ieee80211_link_set_associated()
3632 bss_conf->cqm_rssi_thold) in ieee80211_link_set_associated()
3642 struct ieee80211_local *local = sdata->local; in ieee80211_set_associated()
3643 struct ieee80211_vif_cfg *vif_cfg = &sdata->vif.cfg; in ieee80211_set_associated()
3647 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_set_associated()
3649 sdata->u.mgd.associated = true; in ieee80211_set_associated()
3652 struct cfg80211_bss *cbss = assoc_data->link[link_id].bss; in ieee80211_set_associated()
3656 assoc_data->link[link_id].status != WLAN_STATUS_SUCCESS) in ieee80211_set_associated()
3659 if (ieee80211_vif_is_mld(&sdata->vif) && in ieee80211_set_associated()
3660 !(ieee80211_vif_usable_links(&sdata->vif) & BIT(link_id))) in ieee80211_set_associated()
3663 link = sdata_dereference(sdata->link[link_id], sdata); in ieee80211_set_associated()
3675 vif_cfg->assoc = 1; in ieee80211_set_associated()
3678 if (vif_cfg->arp_addr_cnt) in ieee80211_set_associated()
3681 if (ieee80211_vif_is_mld(&sdata->vif)) { in ieee80211_set_associated()
3686 struct cfg80211_bss *cbss = assoc_data->link[link_id].bss; in ieee80211_set_associated()
3690 ieee80211_vif_usable_links(&sdata->vif)) || in ieee80211_set_associated()
3691 assoc_data->link[link_id].status != WLAN_STATUS_SUCCESS) in ieee80211_set_associated()
3694 link = sdata_dereference(sdata->link[link_id], sdata); in ieee80211_set_associated()
3712 /* leave this here to not change ordering in non-MLO cases */ in ieee80211_set_associated()
3713 if (!ieee80211_vif_is_mld(&sdata->vif)) in ieee80211_set_associated()
3714 ieee80211_recalc_smps(sdata, &sdata->deflink); in ieee80211_set_associated()
3717 netif_carrier_on(sdata->dev); in ieee80211_set_associated()
3723 sdata->u.mgd.reconf.add_links_data; in ieee80211_ml_reconf_reset()
3725 if (!ieee80211_vif_is_mld(&sdata->vif) || in ieee80211_ml_reconf_reset()
3726 !(sdata->u.mgd.reconf.added_links | in ieee80211_ml_reconf_reset()
3727 sdata->u.mgd.reconf.removed_links)) in ieee80211_ml_reconf_reset()
3730 wiphy_delayed_work_cancel(sdata->local->hw.wiphy, in ieee80211_ml_reconf_reset()
3731 &sdata->u.mgd.reconf.wk); in ieee80211_ml_reconf_reset()
3732 sdata->u.mgd.reconf.added_links = 0; in ieee80211_ml_reconf_reset()
3733 sdata->u.mgd.reconf.removed_links = 0; in ieee80211_ml_reconf_reset()
3734 sdata->u.mgd.reconf.dialog_token = 0; in ieee80211_ml_reconf_reset()
3743 add_links_data->link[link_id].bss; in ieee80211_ml_reconf_reset()
3745 cfg80211_mlo_reconf_add_done(sdata->dev, &done_data); in ieee80211_ml_reconf_reset()
3747 kfree(sdata->u.mgd.reconf.add_links_data); in ieee80211_ml_reconf_reset()
3748 sdata->u.mgd.reconf.add_links_data = NULL; in ieee80211_ml_reconf_reset()
3756 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_set_disassoc()
3757 struct ieee80211_local *local = sdata->local; in ieee80211_set_disassoc()
3758 struct sta_info *ap_sta = sta_info_get(sdata, sdata->vif.cfg.ap_addr); in ieee80211_set_disassoc()
3764 .link_id = ffs(sdata->vif.active_links) - 1, in ieee80211_set_disassoc()
3767 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_set_disassoc()
3775 if (WARN_ON(!ifmgd->associated)) in ieee80211_set_disassoc()
3780 ifmgd->associated = false; in ieee80211_set_disassoc()
3783 sdata->deflink.conf->bss = NULL; in ieee80211_set_disassoc()
3784 sdata->deflink.smps_mode = IEEE80211_SMPS_OFF; in ieee80211_set_disassoc()
3786 netif_carrier_off(sdata->dev); in ieee80211_set_disassoc()
3790 * to do it before sending disassoc, as otherwise the null-packet in ieee80211_set_disassoc()
3793 if (local->hw.conf.flags & IEEE80211_CONF_PS) { in ieee80211_set_disassoc()
3794 local->hw.conf.flags &= ~IEEE80211_CONF_PS; in ieee80211_set_disassoc()
3797 local->ps_sdata = NULL; in ieee80211_set_disassoc()
3799 /* disable per-vif ps */ in ieee80211_set_disassoc()
3816 drv_mgd_prepare_tx(sdata->local, sdata, &info); in ieee80211_set_disassoc()
3818 ieee80211_send_deauth_disassoc(sdata, sdata->vif.cfg.ap_addr, in ieee80211_set_disassoc()
3819 sdata->vif.cfg.ap_addr, stype, in ieee80211_set_disassoc()
3823 /* flush out frame - make sure the deauth was actually sent */ in ieee80211_set_disassoc()
3827 drv_mgd_complete_tx(sdata->local, sdata, &info); in ieee80211_set_disassoc()
3830 eth_zero_addr(sdata->deflink.u.mgd.bssid); in ieee80211_set_disassoc()
3831 eth_zero_addr(sdata->vif.cfg.ap_addr); in ieee80211_set_disassoc()
3833 sdata->vif.cfg.ssid_len = 0; in ieee80211_set_disassoc()
3836 __sta_info_flush(sdata, false, -1, ap_sta); in ieee80211_set_disassoc()
3838 if (sdata->vif.driver_flags & IEEE80211_VIF_REMOVE_AP_AFTER_DISASSOC) { in ieee80211_set_disassoc()
3843 sta_info_flush(sdata, -1); in ieee80211_set_disassoc()
3847 if (!ieee80211_vif_is_mld(&sdata->vif)) in ieee80211_set_disassoc()
3852 sdata->vif.cfg.assoc = false; in ieee80211_set_disassoc()
3854 sdata->deflink.u.mgd.p2p_noa_index = -1; in ieee80211_set_disassoc()
3855 memset(&sdata->vif.bss_conf.p2p_noa_attr, 0, in ieee80211_set_disassoc()
3856 sizeof(sdata->vif.bss_conf.p2p_noa_attr)); in ieee80211_set_disassoc()
3858 /* on the next assoc, re-program HT/VHT parameters */ in ieee80211_set_disassoc()
3859 memset(&ifmgd->ht_capa, 0, sizeof(ifmgd->ht_capa)); in ieee80211_set_disassoc()
3860 memset(&ifmgd->ht_capa_mask, 0, sizeof(ifmgd->ht_capa_mask)); in ieee80211_set_disassoc()
3861 memset(&ifmgd->vht_capa, 0, sizeof(ifmgd->vht_capa)); in ieee80211_set_disassoc()
3862 memset(&ifmgd->vht_capa_mask, 0, sizeof(ifmgd->vht_capa_mask)); in ieee80211_set_disassoc()
3865 * reset MU-MIMO ownership and group data in default link, in ieee80211_set_disassoc()
3868 memset(sdata->vif.bss_conf.mu_group.membership, 0, in ieee80211_set_disassoc()
3869 sizeof(sdata->vif.bss_conf.mu_group.membership)); in ieee80211_set_disassoc()
3870 memset(sdata->vif.bss_conf.mu_group.position, 0, in ieee80211_set_disassoc()
3871 sizeof(sdata->vif.bss_conf.mu_group.position)); in ieee80211_set_disassoc()
3872 if (!ieee80211_vif_is_mld(&sdata->vif)) in ieee80211_set_disassoc()
3874 sdata->vif.bss_conf.mu_mimo_owner = false; in ieee80211_set_disassoc()
3876 sdata->deflink.ap_power_level = IEEE80211_UNSET_POWER_LEVEL; in ieee80211_set_disassoc()
3878 del_timer_sync(&local->dynamic_ps_timer); in ieee80211_set_disassoc()
3879 wiphy_work_cancel(local->hw.wiphy, &local->dynamic_ps_enable_work); in ieee80211_set_disassoc()
3882 if (sdata->vif.cfg.arp_addr_cnt) in ieee80211_set_disassoc()
3885 sdata->vif.bss_conf.qos = false; in ieee80211_set_disassoc()
3886 if (!ieee80211_vif_is_mld(&sdata->vif)) { in ieee80211_set_disassoc()
3895 if (sdata->vif.driver_flags & IEEE80211_VIF_REMOVE_AP_AFTER_DISASSOC) { in ieee80211_set_disassoc()
3900 sta_info_flush(sdata, -1); in ieee80211_set_disassoc()
3903 /* disassociated - set to defaults now */ in ieee80211_set_disassoc()
3904 ieee80211_set_wmm_default(&sdata->deflink, false, false); in ieee80211_set_disassoc()
3906 del_timer_sync(&sdata->u.mgd.conn_mon_timer); in ieee80211_set_disassoc()
3907 del_timer_sync(&sdata->u.mgd.bcn_mon_timer); in ieee80211_set_disassoc()
3908 del_timer_sync(&sdata->u.mgd.timer); in ieee80211_set_disassoc()
3910 sdata->vif.bss_conf.dtim_period = 0; in ieee80211_set_disassoc()
3911 sdata->vif.bss_conf.beacon_rate = NULL; in ieee80211_set_disassoc()
3913 sdata->deflink.u.mgd.have_beacon = false; in ieee80211_set_disassoc()
3914 sdata->deflink.u.mgd.tracking_signal_avg = false; in ieee80211_set_disassoc()
3915 sdata->deflink.u.mgd.disable_wmm_tracking = false; in ieee80211_set_disassoc()
3917 ifmgd->flags = 0; in ieee80211_set_disassoc()
3919 for (link_id = 0; link_id < ARRAY_SIZE(sdata->link); link_id++) { in ieee80211_set_disassoc()
3922 link = sdata_dereference(sdata->link[link_id], sdata); in ieee80211_set_disassoc()
3928 sdata->vif.bss_conf.csa_active = false; in ieee80211_set_disassoc()
3929 sdata->deflink.u.mgd.csa.blocked_tx = false; in ieee80211_set_disassoc()
3930 sdata->deflink.u.mgd.csa.waiting_bcn = false; in ieee80211_set_disassoc()
3931 sdata->deflink.u.mgd.csa.ignored_same_chan = false; in ieee80211_set_disassoc()
3935 memset(ifmgd->tx_tspec, 0, sizeof(ifmgd->tx_tspec)); in ieee80211_set_disassoc()
3936 wiphy_delayed_work_cancel(local->hw.wiphy, &ifmgd->tx_tspec_wk); in ieee80211_set_disassoc()
3938 sdata->vif.bss_conf.power_type = IEEE80211_REG_UNSET_AP; in ieee80211_set_disassoc()
3939 sdata->vif.bss_conf.pwr_reduction = 0; in ieee80211_set_disassoc()
3940 ieee80211_clear_tpe(&sdata->vif.bss_conf.tpe); in ieee80211_set_disassoc()
3942 sdata->vif.cfg.eml_cap = 0; in ieee80211_set_disassoc()
3943 sdata->vif.cfg.eml_med_sync_delay = 0; in ieee80211_set_disassoc()
3944 sdata->vif.cfg.mld_capa_op = 0; in ieee80211_set_disassoc()
3946 memset(&sdata->u.mgd.ttlm_info, 0, in ieee80211_set_disassoc()
3947 sizeof(sdata->u.mgd.ttlm_info)); in ieee80211_set_disassoc()
3948 wiphy_delayed_work_cancel(sdata->local->hw.wiphy, &ifmgd->ttlm_work); in ieee80211_set_disassoc()
3950 memset(&sdata->vif.neg_ttlm, 0, sizeof(sdata->vif.neg_ttlm)); in ieee80211_set_disassoc()
3951 wiphy_delayed_work_cancel(sdata->local->hw.wiphy, in ieee80211_set_disassoc()
3952 &ifmgd->neg_ttlm_timeout_work); in ieee80211_set_disassoc()
3954 sdata->u.mgd.removed_links = 0; in ieee80211_set_disassoc()
3955 wiphy_delayed_work_cancel(sdata->local->hw.wiphy, in ieee80211_set_disassoc()
3956 &sdata->u.mgd.ml_reconf_work); in ieee80211_set_disassoc()
3958 wiphy_work_cancel(sdata->local->hw.wiphy, in ieee80211_set_disassoc()
3959 &ifmgd->teardown_ttlm_work); in ieee80211_set_disassoc()
3963 ifmgd->mcast_seq_last = IEEE80211_SN_MODULO; in ieee80211_set_disassoc()
3974 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_reset_ap_probe()
3975 struct ieee80211_local *local = sdata->local; in ieee80211_reset_ap_probe()
3977 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_reset_ap_probe()
3979 if (!(ifmgd->flags & IEEE80211_STA_CONNECTION_POLL)) in ieee80211_reset_ap_probe()
3986 if (ieee80211_hw_check(&sdata->local->hw, CONNECTION_MONITOR)) in ieee80211_reset_ap_probe()
3996 mod_timer(&ifmgd->conn_mon_timer, in ieee80211_reset_ap_probe()
4005 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_sta_tx_wmm_ac_notify()
4011 if (!ieee80211_is_data_qos(hdr->frame_control)) in ieee80211_sta_tx_wmm_ac_notify()
4016 tx_tspec = &ifmgd->tx_tspec[ac]; in ieee80211_sta_tx_wmm_ac_notify()
4018 if (likely(!tx_tspec->admitted_time)) in ieee80211_sta_tx_wmm_ac_notify()
4021 if (time_after(now, tx_tspec->time_slice_start + HZ)) { in ieee80211_sta_tx_wmm_ac_notify()
4022 tx_tspec->consumed_tx_time = 0; in ieee80211_sta_tx_wmm_ac_notify()
4023 tx_tspec->time_slice_start = now; in ieee80211_sta_tx_wmm_ac_notify()
4025 if (tx_tspec->downgraded) { in ieee80211_sta_tx_wmm_ac_notify()
4026 tx_tspec->action = TX_TSPEC_ACTION_STOP_DOWNGRADE; in ieee80211_sta_tx_wmm_ac_notify()
4027 wiphy_delayed_work_queue(sdata->local->hw.wiphy, in ieee80211_sta_tx_wmm_ac_notify()
4028 &ifmgd->tx_tspec_wk, 0); in ieee80211_sta_tx_wmm_ac_notify()
4032 if (tx_tspec->downgraded) in ieee80211_sta_tx_wmm_ac_notify()
4035 tx_tspec->consumed_tx_time += tx_time; in ieee80211_sta_tx_wmm_ac_notify()
4037 if (tx_tspec->consumed_tx_time >= tx_tspec->admitted_time) { in ieee80211_sta_tx_wmm_ac_notify()
4038 tx_tspec->downgraded = true; in ieee80211_sta_tx_wmm_ac_notify()
4039 tx_tspec->action = TX_TSPEC_ACTION_DOWNGRADE; in ieee80211_sta_tx_wmm_ac_notify()
4040 wiphy_delayed_work_queue(sdata->local->hw.wiphy, in ieee80211_sta_tx_wmm_ac_notify()
4041 &ifmgd->tx_tspec_wk, 0); in ieee80211_sta_tx_wmm_ac_notify()
4050 if (!ieee80211_is_any_nullfunc(hdr->frame_control) || in ieee80211_sta_tx_notify()
4051 !sdata->u.mgd.probe_send_count) in ieee80211_sta_tx_notify()
4055 sdata->u.mgd.probe_send_count = 0; in ieee80211_sta_tx_notify()
4057 sdata->u.mgd.nullfunc_failed = true; in ieee80211_sta_tx_notify()
4058 wiphy_work_queue(sdata->local->hw.wiphy, &sdata->work); in ieee80211_sta_tx_notify()
4068 skb = ieee80211_build_probe_req(sdata, src, dst, (u32)-1, channel, in ieee80211_mlme_send_probe_req()
4077 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_mgd_probe_ap_send()
4078 u8 *dst = sdata->vif.cfg.ap_addr; in ieee80211_mgd_probe_ap_send()
4079 u8 unicast_limit = max(1, max_probe_tries - 3); in ieee80211_mgd_probe_ap_send()
4082 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_mgd_probe_ap_send()
4084 if (WARN_ON(ieee80211_vif_is_mld(&sdata->vif))) in ieee80211_mgd_probe_ap_send()
4092 if (ifmgd->probe_send_count >= unicast_limit) in ieee80211_mgd_probe_ap_send()
4102 ifmgd->probe_send_count++; in ieee80211_mgd_probe_ap_send()
4110 if (ieee80211_hw_check(&sdata->local->hw, REPORTS_TX_ACK_STATUS)) { in ieee80211_mgd_probe_ap_send()
4111 ifmgd->nullfunc_failed = false; in ieee80211_mgd_probe_ap_send()
4112 ieee80211_send_nullfunc(sdata->local, sdata, false); in ieee80211_mgd_probe_ap_send()
4114 ieee80211_mlme_send_probe_req(sdata, sdata->vif.addr, dst, in ieee80211_mgd_probe_ap_send()
4115 sdata->vif.cfg.ssid, in ieee80211_mgd_probe_ap_send()
4116 sdata->vif.cfg.ssid_len, in ieee80211_mgd_probe_ap_send()
4117 sdata->deflink.conf->bss->channel); in ieee80211_mgd_probe_ap_send()
4120 ifmgd->probe_timeout = jiffies + msecs_to_jiffies(probe_wait_ms); in ieee80211_mgd_probe_ap_send()
4121 run_again(sdata, ifmgd->probe_timeout); in ieee80211_mgd_probe_ap_send()
4127 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_mgd_probe_ap()
4130 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_mgd_probe_ap()
4132 if (WARN_ON_ONCE(ieee80211_vif_is_mld(&sdata->vif))) in ieee80211_mgd_probe_ap()
4138 if (!ifmgd->associated) in ieee80211_mgd_probe_ap()
4141 if (sdata->local->tmp_channel || sdata->local->scanning) in ieee80211_mgd_probe_ap()
4144 if (sdata->local->suspending) { in ieee80211_mgd_probe_ap()
4152 "detected beacon loss from AP (missed %d beacons) - probing\n", in ieee80211_mgd_probe_ap()
4155 ieee80211_cqm_beacon_loss_notify(&sdata->vif, GFP_KERNEL); in ieee80211_mgd_probe_ap()
4169 if (ifmgd->flags & IEEE80211_STA_CONNECTION_POLL) in ieee80211_mgd_probe_ap()
4172 ifmgd->flags |= IEEE80211_STA_CONNECTION_POLL; in ieee80211_mgd_probe_ap()
4177 ieee80211_recalc_ps(sdata->local); in ieee80211_mgd_probe_ap()
4179 ifmgd->probe_send_count = 0; in ieee80211_mgd_probe_ap()
4187 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_ap_probereq_get()
4193 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_ap_probereq_get()
4195 if (WARN_ON(sdata->vif.type != NL80211_IFTYPE_STATION || in ieee80211_ap_probereq_get()
4196 ieee80211_vif_is_mld(&sdata->vif))) in ieee80211_ap_probereq_get()
4199 if (ifmgd->associated) in ieee80211_ap_probereq_get()
4200 cbss = sdata->deflink.conf->bss; in ieee80211_ap_probereq_get()
4201 else if (ifmgd->auth_data) in ieee80211_ap_probereq_get()
4202 cbss = ifmgd->auth_data->bss; in ieee80211_ap_probereq_get()
4203 else if (ifmgd->assoc_data && ifmgd->assoc_data->link[0].bss) in ieee80211_ap_probereq_get()
4204 cbss = ifmgd->assoc_data->link[0].bss; in ieee80211_ap_probereq_get()
4210 if (WARN_ONCE(!ssid || ssid->datalen > IEEE80211_MAX_SSID_LEN, in ieee80211_ap_probereq_get()
4212 ssid ? ssid->datalen : -1)) in ieee80211_ap_probereq_get()
4215 ssid_len = ssid->datalen; in ieee80211_ap_probereq_get()
4217 skb = ieee80211_build_probe_req(sdata, sdata->vif.addr, cbss->bssid, in ieee80211_ap_probereq_get()
4218 (u32) -1, cbss->channel, in ieee80211_ap_probereq_get()
4219 ssid->data, ssid_len, in ieee80211_ap_probereq_get()
4238 cfg80211_tx_mlme_mgmt(sdata->dev, buf, len, reconnect); in ieee80211_report_disconnect()
4240 cfg80211_rx_mlme_mgmt(sdata->dev, buf, len); in ieee80211_report_disconnect()
4242 drv_event_callback(sdata->local, sdata, &event); in ieee80211_report_disconnect()
4247 struct ieee80211_local *local = sdata->local; in __ieee80211_disconnect()
4248 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in __ieee80211_disconnect()
4252 lockdep_assert_wiphy(local->hw.wiphy); in __ieee80211_disconnect()
4254 if (!ifmgd->associated) in __ieee80211_disconnect()
4259 link_id < ARRAY_SIZE(sdata->link); in __ieee80211_disconnect()
4263 if (!ieee80211_vif_link_active(&sdata->vif, link_id)) in __ieee80211_disconnect()
4266 link = sdata_dereference(sdata->link[link_id], sdata); in __ieee80211_disconnect()
4270 if (link->u.mgd.csa.blocked_tx) in __ieee80211_disconnect()
4277 if (!ifmgd->driver_disconnect) { in __ieee80211_disconnect()
4283 * of multi-link, it's not clear that all of them really are in __ieee80211_disconnect()
4288 link_id < ARRAY_SIZE(sdata->link); in __ieee80211_disconnect()
4292 link = sdata_dereference(sdata->link[link_id], sdata); in __ieee80211_disconnect()
4295 cfg80211_unlink_bss(local->hw.wiphy, link->conf->bss); in __ieee80211_disconnect()
4296 link->conf->bss = NULL; in __ieee80211_disconnect()
4301 ifmgd->driver_disconnect ? in __ieee80211_disconnect()
4306 sdata->vif.bss_conf.csa_active = false; in __ieee80211_disconnect()
4307 sdata->deflink.u.mgd.csa.waiting_bcn = false; in __ieee80211_disconnect()
4308 sdata->deflink.u.mgd.csa.blocked_tx = false; in __ieee80211_disconnect()
4313 ifmgd->reconnect); in __ieee80211_disconnect()
4314 ifmgd->reconnect = false; in __ieee80211_disconnect()
4323 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_beacon_connection_loss_work()
4325 if (ifmgd->connection_loss) { in ieee80211_beacon_connection_loss_work()
4327 sdata->vif.cfg.ap_addr); in ieee80211_beacon_connection_loss_work()
4329 ifmgd->connection_loss = false; in ieee80211_beacon_connection_loss_work()
4330 } else if (ifmgd->driver_disconnect) { in ieee80211_beacon_connection_loss_work()
4333 sdata->vif.cfg.ap_addr); in ieee80211_beacon_connection_loss_work()
4335 ifmgd->driver_disconnect = false; in ieee80211_beacon_connection_loss_work()
4337 if (ifmgd->associated) in ieee80211_beacon_connection_loss_work()
4338 sdata->deflink.u.mgd.beacon_loss_count++; in ieee80211_beacon_connection_loss_work()
4356 struct ieee80211_hw *hw = &sdata->local->hw; in ieee80211_beacon_loss()
4360 sdata->u.mgd.connection_loss = false; in ieee80211_beacon_loss()
4361 wiphy_work_queue(hw->wiphy, &sdata->u.mgd.beacon_connection_loss_work); in ieee80211_beacon_loss()
4373 hw = &sdata->local->hw; in ieee80211_connection_loss()
4377 sdata->u.mgd.connection_loss = true; in ieee80211_connection_loss()
4378 wiphy_work_queue(hw->wiphy, &sdata->u.mgd.beacon_connection_loss_work); in ieee80211_connection_loss()
4385 struct ieee80211_hw *hw = &sdata->local->hw; in ieee80211_disconnect()
4389 if (WARN_ON(sdata->vif.type != NL80211_IFTYPE_STATION)) in ieee80211_disconnect()
4392 sdata->u.mgd.driver_disconnect = true; in ieee80211_disconnect()
4393 sdata->u.mgd.reconnect = reconnect; in ieee80211_disconnect()
4394 wiphy_work_queue(hw->wiphy, &sdata->u.mgd.beacon_connection_loss_work); in ieee80211_disconnect()
4401 struct ieee80211_mgd_auth_data *auth_data = sdata->u.mgd.auth_data; in ieee80211_destroy_auth_data()
4403 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_destroy_auth_data()
4405 sdata->u.mgd.auth_data = NULL; in ieee80211_destroy_auth_data()
4413 del_timer_sync(&sdata->u.mgd.timer); in ieee80211_destroy_auth_data()
4414 sta_info_destroy_addr(sdata, auth_data->ap_addr); in ieee80211_destroy_auth_data()
4417 eth_zero_addr(sdata->deflink.u.mgd.bssid); in ieee80211_destroy_auth_data()
4418 ieee80211_link_info_change_notify(sdata, &sdata->deflink, in ieee80211_destroy_auth_data()
4420 sdata->u.mgd.flags = 0; in ieee80211_destroy_auth_data()
4422 ieee80211_link_release_channel(&sdata->deflink); in ieee80211_destroy_auth_data()
4426 cfg80211_put_bss(sdata->local->hw.wiphy, auth_data->bss); in ieee80211_destroy_auth_data()
4440 struct ieee80211_mgd_assoc_data *assoc_data = sdata->u.mgd.assoc_data; in ieee80211_destroy_assoc_data()
4442 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_destroy_assoc_data()
4444 sdata->u.mgd.assoc_data = NULL; in ieee80211_destroy_assoc_data()
4452 del_timer_sync(&sdata->u.mgd.timer); in ieee80211_destroy_assoc_data()
4453 sta_info_destroy_addr(sdata, assoc_data->ap_addr); in ieee80211_destroy_assoc_data()
4455 eth_zero_addr(sdata->deflink.u.mgd.bssid); in ieee80211_destroy_assoc_data()
4456 ieee80211_link_info_change_notify(sdata, &sdata->deflink, in ieee80211_destroy_assoc_data()
4458 sdata->u.mgd.flags = 0; in ieee80211_destroy_assoc_data()
4459 sdata->vif.bss_conf.mu_mimo_owner = false; in ieee80211_destroy_assoc_data()
4468 ARRAY_SIZE(assoc_data->link)); in ieee80211_destroy_assoc_data()
4471 data.bss[i] = assoc_data->link[i].bss; in ieee80211_destroy_assoc_data()
4473 if (ieee80211_vif_is_mld(&sdata->vif)) in ieee80211_destroy_assoc_data()
4474 data.ap_mld_addr = assoc_data->ap_addr; in ieee80211_destroy_assoc_data()
4476 cfg80211_assoc_failure(sdata->dev, &data); in ieee80211_destroy_assoc_data()
4479 ieee80211_link_release_channel(&sdata->deflink); in ieee80211_destroy_assoc_data()
4489 struct ieee80211_local *local = sdata->local; in ieee80211_auth_challenge()
4490 struct ieee80211_mgd_auth_data *auth_data = sdata->u.mgd.auth_data; in ieee80211_auth_challenge()
4496 .link_id = auth_data->link_id, in ieee80211_auth_challenge()
4499 pos = mgmt->u.auth.variable; in ieee80211_auth_challenge()
4501 len - (pos - (u8 *)mgmt)); in ieee80211_auth_challenge()
4504 auth_data->expected_transaction = 4; in ieee80211_auth_challenge()
4505 drv_mgd_prepare_tx(sdata->local, sdata, &info); in ieee80211_auth_challenge()
4506 if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) in ieee80211_auth_challenge()
4509 ieee80211_send_auth(sdata, 3, auth_data->algorithm, 0, in ieee80211_auth_challenge()
4511 challenge->datalen + sizeof(*challenge), in ieee80211_auth_challenge()
4512 auth_data->ap_addr, auth_data->ap_addr, in ieee80211_auth_challenge()
4513 auth_data->key, auth_data->key_len, in ieee80211_auth_challenge()
4514 auth_data->key_idx, tx_flags); in ieee80211_auth_challenge()
4519 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_mark_sta_auth()
4520 const u8 *ap_addr = ifmgd->auth_data->ap_addr; in ieee80211_mark_sta_auth()
4523 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_mark_sta_auth()
4526 ifmgd->auth_data->done = true; in ieee80211_mark_sta_auth()
4527 ifmgd->auth_data->timeout = jiffies + IEEE80211_AUTH_WAIT_ASSOC; in ieee80211_mark_sta_auth()
4528 ifmgd->auth_data->timeout_started = true; in ieee80211_mark_sta_auth()
4529 run_again(sdata, ifmgd->auth_data->timeout); in ieee80211_mark_sta_auth()
4534 WARN_ONCE(1, "%s: STA %pM not found", sdata->name, ap_addr); in ieee80211_mark_sta_auth()
4548 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_rx_mgmt_auth()
4558 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_rx_mgmt_auth()
4563 if (!ifmgd->auth_data || ifmgd->auth_data->done) in ieee80211_rx_mgmt_auth()
4566 if (!ether_addr_equal(ifmgd->auth_data->ap_addr, mgmt->bssid)) in ieee80211_rx_mgmt_auth()
4569 auth_alg = le16_to_cpu(mgmt->u.auth.auth_alg); in ieee80211_rx_mgmt_auth()
4570 auth_transaction = le16_to_cpu(mgmt->u.auth.auth_transaction); in ieee80211_rx_mgmt_auth()
4571 status_code = le16_to_cpu(mgmt->u.auth.status_code); in ieee80211_rx_mgmt_auth()
4573 if (auth_alg != ifmgd->auth_data->algorithm || in ieee80211_rx_mgmt_auth()
4575 auth_transaction != ifmgd->auth_data->expected_transaction) || in ieee80211_rx_mgmt_auth()
4577 (auth_transaction < ifmgd->auth_data->expected_transaction || in ieee80211_rx_mgmt_auth()
4580 mgmt->sa, auth_alg, ifmgd->auth_data->algorithm, in ieee80211_rx_mgmt_auth()
4582 ifmgd->auth_data->expected_transaction); in ieee80211_rx_mgmt_auth()
4587 cfg80211_rx_mlme_mgmt(sdata->dev, (u8 *)mgmt, len); in ieee80211_rx_mgmt_auth()
4595 ifmgd->auth_data->waiting = true; in ieee80211_rx_mgmt_auth()
4596 ifmgd->auth_data->timeout = in ieee80211_rx_mgmt_auth()
4598 ifmgd->auth_data->timeout_started = true; in ieee80211_rx_mgmt_auth()
4599 run_again(sdata, ifmgd->auth_data->timeout); in ieee80211_rx_mgmt_auth()
4604 mgmt->sa, status_code); in ieee80211_rx_mgmt_auth()
4608 drv_event_callback(sdata->local, sdata, &event); in ieee80211_rx_mgmt_auth()
4612 switch (ifmgd->auth_data->algorithm) { in ieee80211_rx_mgmt_auth()
4622 if (ifmgd->auth_data->expected_transaction != 4) { in ieee80211_rx_mgmt_auth()
4630 ifmgd->auth_data->algorithm); in ieee80211_rx_mgmt_auth()
4636 drv_event_callback(sdata->local, sdata, &event); in ieee80211_rx_mgmt_auth()
4637 if (ifmgd->auth_data->algorithm != WLAN_AUTH_SAE || in ieee80211_rx_mgmt_auth()
4639 ifmgd->auth_data->expected_transaction == 2)) { in ieee80211_rx_mgmt_auth()
4641 return; /* ignore frame -- wait for timeout */ in ieee80211_rx_mgmt_auth()
4642 } else if (ifmgd->auth_data->algorithm == WLAN_AUTH_SAE && in ieee80211_rx_mgmt_auth()
4645 ifmgd->auth_data->peer_confirmed = true; in ieee80211_rx_mgmt_auth()
4648 cfg80211_rx_mlme_mgmt(sdata->dev, (u8 *)mgmt, len); in ieee80211_rx_mgmt_auth()
4650 drv_mgd_complete_tx(sdata->local, sdata, &info); in ieee80211_rx_mgmt_auth()
4713 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_rx_mgmt_deauth()
4714 u16 reason_code = le16_to_cpu(mgmt->u.deauth.reason_code); in ieee80211_rx_mgmt_deauth()
4716 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_rx_mgmt_deauth()
4721 if (!ether_addr_equal(mgmt->bssid, mgmt->sa)) { in ieee80211_rx_mgmt_deauth()
4722 ieee80211_tdls_handle_disconnect(sdata, mgmt->sa, reason_code); in ieee80211_rx_mgmt_deauth()
4726 if (ifmgd->associated && in ieee80211_rx_mgmt_deauth()
4727 ether_addr_equal(mgmt->bssid, sdata->vif.cfg.ap_addr)) { in ieee80211_rx_mgmt_deauth()
4729 sdata->vif.cfg.ap_addr, reason_code, in ieee80211_rx_mgmt_deauth()
4739 if (ifmgd->assoc_data && in ieee80211_rx_mgmt_deauth()
4740 ether_addr_equal(mgmt->bssid, ifmgd->assoc_data->ap_addr)) { in ieee80211_rx_mgmt_deauth()
4743 ifmgd->assoc_data->ap_addr, reason_code, in ieee80211_rx_mgmt_deauth()
4748 cfg80211_rx_mlme_mgmt(sdata->dev, (u8 *)mgmt, len); in ieee80211_rx_mgmt_deauth()
4757 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_rx_mgmt_disassoc()
4760 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_rx_mgmt_disassoc()
4765 if (!ifmgd->associated || in ieee80211_rx_mgmt_disassoc()
4766 !ether_addr_equal(mgmt->bssid, sdata->vif.cfg.ap_addr)) in ieee80211_rx_mgmt_disassoc()
4769 reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code); in ieee80211_rx_mgmt_disassoc()
4771 if (!ether_addr_equal(mgmt->bssid, mgmt->sa)) { in ieee80211_rx_mgmt_disassoc()
4772 ieee80211_tdls_handle_disconnect(sdata, mgmt->sa, reason_code); in ieee80211_rx_mgmt_disassoc()
4777 sdata->vif.cfg.ap_addr, reason_code, in ieee80211_rx_mgmt_disassoc()
4792 ieee80211_get_he_iftype_cap_vif(sband, &sdata->vif); in ieee80211_twt_req_supported()
4794 if (elems->ext_capab_len < 10) in ieee80211_twt_req_supported()
4797 if (!(elems->ext_capab[9] & WLAN_EXT_CAPA10_TWT_RESPONDER_SUPPORT)) in ieee80211_twt_req_supported()
4800 return link_sta->pub->he_cap.he_cap_elem.mac_cap_info[0] & in ieee80211_twt_req_supported()
4803 (own_he_cap->he_cap_elem.mac_cap_info[0] & in ieee80211_twt_req_supported()
4815 if (link->conf->twt_requester != twt) { in ieee80211_recalc_twt_req()
4816 link->conf->twt_requester = twt; in ieee80211_recalc_twt_req()
4828 ieee80211_get_he_iftype_cap_vif(sband, &sdata->vif); in ieee80211_twt_bcast_support()
4830 return bss_conf->he_support && in ieee80211_twt_bcast_support()
4831 (link_sta->pub->he_cap.he_cap_elem.mac_cap_info[2] & in ieee80211_twt_bcast_support()
4834 (own_he_cap->he_cap_elem.mac_cap_info[2] & in ieee80211_twt_bcast_support()
4846 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_assoc_config_link()
4848 sdata->u.mgd.assoc_data ?: sdata->u.mgd.reconf.add_links_data; in ieee80211_assoc_config_link()
4849 struct ieee80211_bss_conf *bss_conf = link->conf; in ieee80211_assoc_config_link()
4850 struct ieee80211_local *local = sdata->local; in ieee80211_assoc_config_link()
4851 unsigned int link_id = link->link_id; in ieee80211_assoc_config_link()
4853 .mode = link->u.mgd.conn.mode, in ieee80211_assoc_config_link()
4856 .link_id = link_id == assoc_data->assoc_link_id ? -1 : link_id, in ieee80211_assoc_config_link()
4859 bool is_5ghz = cbss->channel->band == NL80211_BAND_5GHZ; in ieee80211_assoc_config_link()
4860 bool is_6ghz = cbss->channel->band == NL80211_BAND_6GHZ; in ieee80211_assoc_config_link()
4861 bool is_s1g = cbss->channel->band == NL80211_BAND_S1GHZ; in ieee80211_assoc_config_link()
4874 if (link_id == assoc_data->assoc_link_id) { in ieee80211_assoc_config_link()
4875 capab_info = le16_to_cpu(mgmt->u.assoc_resp.capab_info); in ieee80211_assoc_config_link()
4881 assoc_data->link[link_id].status = WLAN_STATUS_SUCCESS; in ieee80211_assoc_config_link()
4882 if (elems->ml_basic) { in ieee80211_assoc_config_link()
4884 ieee80211_mle_get_bss_param_ch_cnt((const void *)elems->ml_basic); in ieee80211_assoc_config_link()
4890 bss_conf->bss_param_ch_cnt = bss_param_ch_cnt; in ieee80211_assoc_config_link()
4891 bss_conf->bss_param_ch_cnt_link_id = link_id; in ieee80211_assoc_config_link()
4893 } else if (elems->parse_error & IEEE80211_PARSE_ERR_DUP_NEST_ML_BASIC || in ieee80211_assoc_config_link()
4894 !elems->prof || in ieee80211_assoc_config_link()
4895 !(elems->prof->control & prof_bss_param_ch_present)) { in ieee80211_assoc_config_link()
4899 const u8 *ptr = elems->prof->variable + in ieee80211_assoc_config_link()
4900 elems->prof->sta_info_len - 1; in ieee80211_assoc_config_link()
4905 * otherwise elems->prof would have been set to NULL. in ieee80211_assoc_config_link()
4908 assoc_data->link[link_id].status = get_unaligned_le16(ptr + 2); in ieee80211_assoc_config_link()
4910 ieee80211_mle_basic_sta_prof_bss_param_ch_cnt(elems->prof); in ieee80211_assoc_config_link()
4911 bss_conf->bss_param_ch_cnt = bss_param_ch_cnt; in ieee80211_assoc_config_link()
4912 bss_conf->bss_param_ch_cnt_link_id = link_id; in ieee80211_assoc_config_link()
4914 if (assoc_data->link[link_id].status != WLAN_STATUS_SUCCESS) { in ieee80211_assoc_config_link()
4916 assoc_data->link[link_id].status); in ieee80211_assoc_config_link()
4922 if (!is_s1g && !elems->supp_rates) { in ieee80211_assoc_config_link()
4928 link->u.mgd.tdls_chan_switch_prohibited = in ieee80211_assoc_config_link()
4929 elems->ext_capab && elems->ext_capab_len >= 5 && in ieee80211_assoc_config_link()
4930 (elems->ext_capab[4] & WLAN_EXT_CAPA5_TDLS_CH_SW_PROHIBITED); in ieee80211_assoc_config_link()
4937 * "Vodafone PocketWiFi 2", "ZTE MF60" and a similar T-Mobile device. in ieee80211_assoc_config_link()
4940 ((assoc_data->wmm && !elems->wmm_param) || in ieee80211_assoc_config_link()
4941 (link->u.mgd.conn.mode >= IEEE80211_CONN_MODE_HT && in ieee80211_assoc_config_link()
4942 (!elems->ht_cap_elem || !elems->ht_operation)) || in ieee80211_assoc_config_link()
4943 (is_5ghz && link->u.mgd.conn.mode >= IEEE80211_CONN_MODE_VHT && in ieee80211_assoc_config_link()
4944 (!elems->vht_cap_elem || !elems->vht_operation)))) { in ieee80211_assoc_config_link()
4949 ies = rcu_dereference(cbss->ies); in ieee80211_assoc_config_link()
4951 bss_ies = kmemdup(ies, sizeof(*ies) + ies->len, in ieee80211_assoc_config_link()
4959 parse_params.start = bss_ies->data; in ieee80211_assoc_config_link()
4960 parse_params.len = bss_ies->len; in ieee80211_assoc_config_link()
4962 parse_params.link_id = -1; in ieee80211_assoc_config_link()
4969 if (assoc_data->wmm && in ieee80211_assoc_config_link()
4970 !elems->wmm_param && bss_elems->wmm_param) { in ieee80211_assoc_config_link()
4971 elems->wmm_param = bss_elems->wmm_param; in ieee80211_assoc_config_link()
4980 if (!elems->ht_cap_elem && bss_elems->ht_cap_elem && in ieee80211_assoc_config_link()
4981 link->u.mgd.conn.mode >= IEEE80211_CONN_MODE_HT) { in ieee80211_assoc_config_link()
4982 elems->ht_cap_elem = bss_elems->ht_cap_elem; in ieee80211_assoc_config_link()
4986 if (!elems->ht_operation && bss_elems->ht_operation && in ieee80211_assoc_config_link()
4987 link->u.mgd.conn.mode >= IEEE80211_CONN_MODE_HT) { in ieee80211_assoc_config_link()
4988 elems->ht_operation = bss_elems->ht_operation; in ieee80211_assoc_config_link()
4994 if (!elems->vht_cap_elem && bss_elems->vht_cap_elem && in ieee80211_assoc_config_link()
4995 link->u.mgd.conn.mode >= IEEE80211_CONN_MODE_VHT) { in ieee80211_assoc_config_link()
4996 elems->vht_cap_elem = bss_elems->vht_cap_elem; in ieee80211_assoc_config_link()
5001 if (!elems->vht_operation && bss_elems->vht_operation && in ieee80211_assoc_config_link()
5002 link->u.mgd.conn.mode >= IEEE80211_CONN_MODE_VHT) { in ieee80211_assoc_config_link()
5003 elems->vht_operation = bss_elems->vht_operation; in ieee80211_assoc_config_link()
5017 if (!is_6ghz && link->u.mgd.conn.mode >= IEEE80211_CONN_MODE_HT && in ieee80211_assoc_config_link()
5018 (!elems->wmm_param || !elems->ht_cap_elem || !elems->ht_operation)) { in ieee80211_assoc_config_link()
5025 if (is_5ghz && link->u.mgd.conn.mode >= IEEE80211_CONN_MODE_VHT && in ieee80211_assoc_config_link()
5026 (!elems->vht_cap_elem || !elems->vht_operation)) { in ieee80211_assoc_config_link()
5035 link_id == assoc_data->assoc_link_id, in ieee80211_assoc_config_link()
5041 if (WARN_ON(!link->conf->chanreq.oper.chan)) { in ieee80211_assoc_config_link()
5045 sband = local->hw.wiphy->bands[link->conf->chanreq.oper.chan->band]; in ieee80211_assoc_config_link()
5048 if (elems->ht_cap_elem && link->u.mgd.conn.mode >= IEEE80211_CONN_MODE_HT) in ieee80211_assoc_config_link()
5050 elems->ht_cap_elem, in ieee80211_assoc_config_link()
5053 if (elems->vht_cap_elem && in ieee80211_assoc_config_link()
5054 link->u.mgd.conn.mode >= IEEE80211_CONN_MODE_VHT) { in ieee80211_assoc_config_link()
5065 ies = rcu_dereference(cbss->ies); in ieee80211_assoc_config_link()
5070 ies->data, ies->len); in ieee80211_assoc_config_link()
5071 if (elem && elem->datalen >= sizeof(*bss_vht_cap)) in ieee80211_assoc_config_link()
5072 bss_vht_cap = (const void *)elem->data; in ieee80211_assoc_config_link()
5076 elems->vht_cap_elem, in ieee80211_assoc_config_link()
5081 if (elems->he_operation && in ieee80211_assoc_config_link()
5082 link->u.mgd.conn.mode >= IEEE80211_CONN_MODE_HE && in ieee80211_assoc_config_link()
5083 elems->he_cap) { in ieee80211_assoc_config_link()
5085 elems->he_cap, in ieee80211_assoc_config_link()
5086 elems->he_cap_len, in ieee80211_assoc_config_link()
5087 elems->he_6ghz_capa, in ieee80211_assoc_config_link()
5090 bss_conf->he_support = link_sta->pub->he_cap.has_he; in ieee80211_assoc_config_link()
5091 if (elems->rsnx && elems->rsnx_len && in ieee80211_assoc_config_link()
5092 (elems->rsnx[0] & WLAN_RSNX_CAPA_PROTECTED_TWT) && in ieee80211_assoc_config_link()
5093 wiphy_ext_feature_isset(local->hw.wiphy, in ieee80211_assoc_config_link()
5095 bss_conf->twt_protected = true; in ieee80211_assoc_config_link()
5097 bss_conf->twt_protected = false; in ieee80211_assoc_config_link()
5102 if (elems->eht_operation && elems->eht_cap && in ieee80211_assoc_config_link()
5103 link->u.mgd.conn.mode >= IEEE80211_CONN_MODE_EHT) { in ieee80211_assoc_config_link()
5105 elems->he_cap, in ieee80211_assoc_config_link()
5106 elems->he_cap_len, in ieee80211_assoc_config_link()
5107 elems->eht_cap, in ieee80211_assoc_config_link()
5108 elems->eht_cap_len, in ieee80211_assoc_config_link()
5111 bss_conf->eht_support = link_sta->pub->eht_cap.has_eht; in ieee80211_assoc_config_link()
5113 bss_conf->eht_support = false; in ieee80211_assoc_config_link()
5116 bss_conf->he_support = false; in ieee80211_assoc_config_link()
5117 bss_conf->twt_requester = false; in ieee80211_assoc_config_link()
5118 bss_conf->twt_protected = false; in ieee80211_assoc_config_link()
5119 bss_conf->eht_support = false; in ieee80211_assoc_config_link()
5122 bss_conf->twt_broadcast = in ieee80211_assoc_config_link()
5125 if (bss_conf->he_support) { in ieee80211_assoc_config_link()
5126 bss_conf->he_bss_color.color = in ieee80211_assoc_config_link()
5127 le32_get_bits(elems->he_operation->he_oper_params, in ieee80211_assoc_config_link()
5129 bss_conf->he_bss_color.partial = in ieee80211_assoc_config_link()
5130 le32_get_bits(elems->he_operation->he_oper_params, in ieee80211_assoc_config_link()
5132 bss_conf->he_bss_color.enabled = in ieee80211_assoc_config_link()
5133 !le32_get_bits(elems->he_operation->he_oper_params, in ieee80211_assoc_config_link()
5136 if (bss_conf->he_bss_color.enabled) in ieee80211_assoc_config_link()
5139 bss_conf->htc_trig_based_pkt_ext = in ieee80211_assoc_config_link()
5140 le32_get_bits(elems->he_operation->he_oper_params, in ieee80211_assoc_config_link()
5142 bss_conf->frame_time_rts_th = in ieee80211_assoc_config_link()
5143 le32_get_bits(elems->he_operation->he_oper_params, in ieee80211_assoc_config_link()
5146 bss_conf->uora_exists = !!elems->uora_element; in ieee80211_assoc_config_link()
5147 if (elems->uora_element) in ieee80211_assoc_config_link()
5148 bss_conf->uora_ocw_range = elems->uora_element[0]; in ieee80211_assoc_config_link()
5150 ieee80211_he_op_ie_to_bss_conf(&sdata->vif, elems->he_operation); in ieee80211_assoc_config_link()
5151 ieee80211_he_spr_ie_to_bss_conf(&sdata->vif, elems->he_spr); in ieee80211_assoc_config_link()
5155 if (cbss->transmitted_bss) { in ieee80211_assoc_config_link()
5156 bss_conf->nontransmitted = true; in ieee80211_assoc_config_link()
5157 ether_addr_copy(bss_conf->transmitter_bssid, in ieee80211_assoc_config_link()
5158 cbss->transmitted_bss->bssid); in ieee80211_assoc_config_link()
5159 bss_conf->bssid_indicator = cbss->max_bssid_indicator; in ieee80211_assoc_config_link()
5160 bss_conf->bssid_index = cbss->bssid_index; in ieee80211_assoc_config_link()
5175 if (elems->opmode_notif && in ieee80211_assoc_config_link()
5176 !(*elems->opmode_notif & IEEE80211_OPMODE_NOTIF_RX_NSS_TYPE_BF)) { in ieee80211_assoc_config_link()
5179 nss = *elems->opmode_notif & IEEE80211_OPMODE_NOTIF_RX_NSS_MASK; in ieee80211_assoc_config_link()
5182 link_sta->pub->rx_nss = nss; in ieee80211_assoc_config_link()
5187 * of the first value the AP uses. Setting -1 here has in ieee80211_assoc_config_link()
5189 * 4-bit value. in ieee80211_assoc_config_link()
5191 link->u.mgd.wmm_last_param_set = -1; in ieee80211_assoc_config_link()
5192 link->u.mgd.mu_edca_last_param_set = -1; in ieee80211_assoc_config_link()
5194 if (link->u.mgd.disable_wmm_tracking) { in ieee80211_assoc_config_link()
5196 } else if (!ieee80211_sta_wmm_params(local, link, elems->wmm_param, in ieee80211_assoc_config_link()
5197 elems->wmm_param_len, in ieee80211_assoc_config_link()
5198 elems->mu_edca_param_set)) { in ieee80211_assoc_config_link()
5208 link->u.mgd.disable_wmm_tracking = true; in ieee80211_assoc_config_link()
5211 if (elems->max_idle_period_ie) { in ieee80211_assoc_config_link()
5212 bss_conf->max_idle_period = in ieee80211_assoc_config_link()
5213 le16_to_cpu(elems->max_idle_period_ie->max_idle_period); in ieee80211_assoc_config_link()
5214 bss_conf->protected_keep_alive = in ieee80211_assoc_config_link()
5215 !!(elems->max_idle_period_ie->idle_options & in ieee80211_assoc_config_link()
5219 bss_conf->max_idle_period = 0; in ieee80211_assoc_config_link()
5220 bss_conf->protected_keep_alive = false; in ieee80211_assoc_config_link()
5225 bss_conf->assoc_capability = capab_info; in ieee80211_assoc_config_link()
5239 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_mgd_setup_link_sta()
5240 struct ieee80211_local *local = sdata->local; in ieee80211_mgd_setup_link_sta()
5241 struct ieee80211_bss *bss = (void *)cbss->priv; in ieee80211_mgd_setup_link_sta()
5244 int min_rate = INT_MAX, min_rate_index = -1; in ieee80211_mgd_setup_link_sta()
5247 memcpy(link_sta->addr, cbss->bssid, ETH_ALEN); in ieee80211_mgd_setup_link_sta()
5248 memcpy(link_sta->pub->addr, cbss->bssid, ETH_ALEN); in ieee80211_mgd_setup_link_sta()
5251 if (cbss->channel->band == NL80211_BAND_S1GHZ) { in ieee80211_mgd_setup_link_sta()
5256 sband = local->hw.wiphy->bands[cbss->channel->band]; in ieee80211_mgd_setup_link_sta()
5258 ieee80211_get_rates(sband, bss->supp_rates, bss->supp_rates_len, in ieee80211_mgd_setup_link_sta()
5270 * we can connect -- with a warning. in ieee80211_mgd_setup_link_sta()
5276 return -EINVAL; in ieee80211_mgd_setup_link_sta()
5283 link_sta->pub->supp_rates[cbss->channel->band] = rates; in ieee80211_mgd_setup_link_sta()
5287 link->conf->basic_rates = basic_rates; in ieee80211_mgd_setup_link_sta()
5290 link->operating_11g_mode = sband->band == NL80211_BAND_2GHZ && in ieee80211_mgd_setup_link_sta()
5311 if (link->u.mgd.conn.mode < IEEE80211_CONN_MODE_HT) in ieee80211_max_rx_chains()
5315 if (ht_cap_elem && ht_cap_elem->datalen >= sizeof(*ht_cap)) { in ieee80211_max_rx_chains()
5316 ht_cap = (void *)ht_cap_elem->data; in ieee80211_max_rx_chains()
5317 chains = ieee80211_mcs_to_chains(&ht_cap->mcs); in ieee80211_max_rx_chains()
5324 if (link->u.mgd.conn.mode < IEEE80211_CONN_MODE_VHT) in ieee80211_max_rx_chains()
5328 if (vht_cap_elem && vht_cap_elem->datalen >= sizeof(*vht_cap)) { in ieee80211_max_rx_chains()
5332 vht_cap = (void *)vht_cap_elem->data; in ieee80211_max_rx_chains()
5333 tx_mcs_map = le16_to_cpu(vht_cap->supp_mcs.tx_mcs_map); in ieee80211_max_rx_chains()
5334 for (nss = 8; nss > 0; nss--) { in ieee80211_max_rx_chains()
5335 if (((tx_mcs_map >> (2 * (nss - 1))) & 3) != in ieee80211_max_rx_chains()
5343 if (link->u.mgd.conn.mode < IEEE80211_CONN_MODE_HE) in ieee80211_max_rx_chains()
5346 ies = rcu_dereference(cbss->ies); in ieee80211_max_rx_chains()
5348 ies->data, ies->len); in ieee80211_max_rx_chains()
5350 if (!he_cap_elem || he_cap_elem->datalen < sizeof(*he_cap)) in ieee80211_max_rx_chains()
5354 he_cap = (void *)(he_cap_elem->data + 1); in ieee80211_max_rx_chains()
5358 if (he_cap_elem->datalen < 1 + mcs_nss_size + sizeof(*he_cap)) in ieee80211_max_rx_chains()
5364 mcs_80_map = le16_to_cpu(he_mcs_nss_supp->tx_mcs_80); in ieee80211_max_rx_chains()
5366 for (i = 7; i >= 0; i--) { in ieee80211_max_rx_chains()
5375 support_160 = he_cap->phy_cap_info[0] & in ieee80211_max_rx_chains()
5381 mcs_160_map = le16_to_cpu(he_mcs_nss_supp->tx_mcs_160); in ieee80211_max_rx_chains()
5382 for (i = 7; i >= 0; i--) { in ieee80211_max_rx_chains()
5401 struct ieee80211_sta_ht_cap sta_ht_cap = sband->ht_cap; in ieee80211_determine_our_sta_mode()
5402 bool is_5ghz = sband->band == NL80211_BAND_5GHZ; in ieee80211_determine_our_sta_mode()
5403 bool is_6ghz = sband->band == NL80211_BAND_6GHZ; in ieee80211_determine_our_sta_mode()
5408 if (sband->band == NL80211_BAND_S1GHZ) { in ieee80211_determine_our_sta_mode()
5409 conn->mode = IEEE80211_CONN_MODE_S1G; in ieee80211_determine_our_sta_mode()
5410 conn->bw_limit = IEEE80211_CONN_BW_LIMIT_20; in ieee80211_determine_our_sta_mode()
5415 conn->mode = IEEE80211_CONN_MODE_LEGACY; in ieee80211_determine_our_sta_mode()
5416 conn->bw_limit = IEEE80211_CONN_BW_LIMIT_20; in ieee80211_determine_our_sta_mode()
5420 if (req && req->flags & ASSOC_REQ_DISABLE_HT) { in ieee80211_determine_our_sta_mode()
5435 for (i = 0; i < req->crypto.n_ciphers_pairwise; i++) { in ieee80211_determine_our_sta_mode()
5436 if (req->crypto.ciphers_pairwise[i] == WLAN_CIPHER_SUITE_WEP40 || in ieee80211_determine_our_sta_mode()
5437 req->crypto.ciphers_pairwise[i] == WLAN_CIPHER_SUITE_TKIP || in ieee80211_determine_our_sta_mode()
5438 req->crypto.ciphers_pairwise[i] == WLAN_CIPHER_SUITE_WEP104) { in ieee80211_determine_our_sta_mode()
5439 netdev_info(sdata->dev, in ieee80211_determine_our_sta_mode()
5453 conn->mode = IEEE80211_CONN_MODE_HT; in ieee80211_determine_our_sta_mode()
5454 conn->bw_limit = sta_ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40 ? in ieee80211_determine_our_sta_mode()
5458 memcpy(&vht_cap, &sband->vht_cap, sizeof(vht_cap)); in ieee80211_determine_our_sta_mode()
5461 if (req && req->flags & ASSOC_REQ_DISABLE_VHT) { in ieee80211_determine_our_sta_mode()
5471 if (conn->bw_limit == IEEE80211_CONN_BW_LIMIT_20) { in ieee80211_determine_our_sta_mode()
5478 for (i = 0; i < sband->n_channels; i++) { in ieee80211_determine_our_sta_mode()
5479 if (sband->channels[i].flags & (IEEE80211_CHAN_DISABLED | in ieee80211_determine_our_sta_mode()
5498 /* VHT - if we have - is fine, including 80 MHz, check 160 below again */ in ieee80211_determine_our_sta_mode()
5499 if (sband->band != NL80211_BAND_2GHZ) { in ieee80211_determine_our_sta_mode()
5500 conn->mode = IEEE80211_CONN_MODE_VHT; in ieee80211_determine_our_sta_mode()
5501 conn->bw_limit = IEEE80211_CONN_BW_LIMIT_160; in ieee80211_determine_our_sta_mode()
5507 conn->bw_limit = IEEE80211_CONN_BW_LIMIT_80; in ieee80211_determine_our_sta_mode()
5512 if (req && req->flags & ASSOC_REQ_DISABLE_HE) { in ieee80211_determine_our_sta_mode()
5518 he_cap = ieee80211_get_he_iftype_cap_vif(sband, &sdata->vif); in ieee80211_determine_our_sta_mode()
5527 conn->mode = IEEE80211_CONN_MODE_HE; in ieee80211_determine_our_sta_mode()
5530 switch (sband->band) { in ieee80211_determine_our_sta_mode()
5533 if (he_cap->he_cap_elem.phy_cap_info[0] & in ieee80211_determine_our_sta_mode()
5536 conn->bw_limit = IEEE80211_CONN_BW_LIMIT_20; in ieee80211_determine_our_sta_mode()
5541 if (!(he_cap->he_cap_elem.phy_cap_info[0] & in ieee80211_determine_our_sta_mode()
5543 conn->bw_limit = IEEE80211_CONN_BW_LIMIT_20; in ieee80211_determine_our_sta_mode()
5548 if (!(he_cap->he_cap_elem.phy_cap_info[0] & in ieee80211_determine_our_sta_mode()
5550 conn->bw_limit = min_t(enum ieee80211_conn_bw_limit, in ieee80211_determine_our_sta_mode()
5551 conn->bw_limit, in ieee80211_determine_our_sta_mode()
5558 if (he_cap->he_cap_elem.phy_cap_info[0] & in ieee80211_determine_our_sta_mode()
5561 conn->bw_limit = min_t(enum ieee80211_conn_bw_limit, in ieee80211_determine_our_sta_mode()
5562 conn->bw_limit, in ieee80211_determine_our_sta_mode()
5569 if (req && req->flags & ASSOC_REQ_DISABLE_EHT) { in ieee80211_determine_our_sta_mode()
5575 eht_cap = ieee80211_get_eht_iftype_cap_vif(sband, &sdata->vif); in ieee80211_determine_our_sta_mode()
5584 conn->mode = IEEE80211_CONN_MODE_EHT; in ieee80211_determine_our_sta_mode()
5588 eht_cap->eht_cap_elem.phy_cap_info[0] & IEEE80211_EHT_PHY_CAP0_320MHZ_IN_6GHZ) in ieee80211_determine_our_sta_mode()
5589 conn->bw_limit = IEEE80211_CONN_BW_LIMIT_320; in ieee80211_determine_our_sta_mode()
5597 ieee80211_conn_mode_str(conn->mode), in ieee80211_determine_our_sta_mode()
5598 20 * (1 << conn->bw_limit)); in ieee80211_determine_our_sta_mode()
5609 req->link_id > 0 ? req->link_id : 0, in ieee80211_determine_our_sta_mode_auth()
5627 conn->mode = min_t(enum ieee80211_conn_mode, in ieee80211_determine_our_sta_mode_assoc()
5628 conn->mode, tmp.mode); in ieee80211_determine_our_sta_mode_assoc()
5629 conn->bw_limit = min_t(enum ieee80211_conn_bw_limit, in ieee80211_determine_our_sta_mode_assoc()
5630 conn->bw_limit, tmp.bw_limit); in ieee80211_determine_our_sta_mode_assoc()
5657 struct ieee80211_local *local = sdata->local; in ieee80211_prep_channel()
5658 bool is_6ghz = cbss->channel->band == NL80211_BAND_6GHZ; in ieee80211_prep_channel()
5664 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_prep_channel()
5676 if (mlo && !elems->ml_basic) { in ieee80211_prep_channel()
5680 return -EINVAL; in ieee80211_prep_channel()
5683 if (link && is_6ghz && conn->mode >= IEEE80211_CONN_MODE_HE) { in ieee80211_prep_channel()
5686 if (elems->pwr_constr_elem) in ieee80211_prep_channel()
5687 link->conf->pwr_reduction = *elems->pwr_constr_elem; in ieee80211_prep_channel()
5689 he_6ghz_oper = ieee80211_he_6ghz_oper(elems->he_operation); in ieee80211_prep_channel()
5691 link->conf->power_type = in ieee80211_prep_channel()
5692 ieee80211_ap_power_type(he_6ghz_oper->control); in ieee80211_prep_channel()
5696 cbss->channel->center_freq); in ieee80211_prep_channel()
5698 link->conf->tpe = elems->tpe; in ieee80211_prep_channel()
5699 ieee80211_rearrange_tpe(&link->conf->tpe, &ap_chandef, in ieee80211_prep_channel()
5711 link->needed_rx_chains = min(ieee80211_max_rx_chains(link, cbss), in ieee80211_prep_channel()
5712 local->rx_chains); in ieee80211_prep_channel()
5741 const u8 *tim_ie = cfg80211_find_ie(WLAN_EID_TIM, ies->data, ies->len); in ieee80211_get_dtim()
5742 const u8 *idx_ie = cfg80211_find_ie(WLAN_EID_MULTI_BSSID_IDX, ies->data, in ieee80211_get_dtim()
5743 ies->len); in ieee80211_get_dtim()
5752 *dtim_count = valid ? tim->dtim_count : 0; in ieee80211_get_dtim()
5755 *dtim_period = valid ? tim->dtim_period : 0; in ieee80211_get_dtim()
5757 /* Check if value is overridden by non-transmitted profile */ in ieee80211_get_dtim()
5764 *dtim_count = idx->dtim_count; in ieee80211_get_dtim()
5767 *dtim_period = idx->dtim_period; in ieee80211_get_dtim()
5777 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_assoc_success()
5778 struct ieee80211_mgd_assoc_data *assoc_data = ifmgd->assoc_data; in ieee80211_assoc_success()
5779 struct ieee80211_local *local = sdata->local; in ieee80211_assoc_success()
5786 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_assoc_success()
5791 sta = sta_info_get(sdata, assoc_data->ap_addr); in ieee80211_assoc_success()
5795 sta->sta.spp_amsdu = assoc_data->spp_amsdu; in ieee80211_assoc_success()
5797 if (ieee80211_vif_is_mld(&sdata->vif)) { in ieee80211_assoc_success()
5799 if (!assoc_data->link[link_id].bss) in ieee80211_assoc_success()
5803 if (assoc_data->link[link_id].disabled) in ieee80211_assoc_success()
5806 if (link_id != assoc_data->assoc_link_id) { in ieee80211_assoc_success()
5817 struct cfg80211_bss *cbss = assoc_data->link[link_id].bss; in ieee80211_assoc_success()
5824 link = sdata_dereference(sdata->link[link_id], sdata); in ieee80211_assoc_success()
5828 if (ieee80211_vif_is_mld(&sdata->vif)) in ieee80211_assoc_success()
5831 link->conf->addr, in ieee80211_assoc_success()
5832 assoc_data->link[link_id].bss->bssid, in ieee80211_assoc_success()
5833 link_id == assoc_data->assoc_link_id ? in ieee80211_assoc_success()
5836 link_sta = rcu_dereference_protected(sta->link[link_id], in ieee80211_assoc_success()
5837 lockdep_is_held(&local->hw.wiphy->mtx)); in ieee80211_assoc_success()
5841 if (!link->u.mgd.have_beacon) { in ieee80211_assoc_success()
5845 ies = rcu_dereference(cbss->beacon_ies); in ieee80211_assoc_success()
5847 link->u.mgd.have_beacon = true; in ieee80211_assoc_success()
5849 ies = rcu_dereference(cbss->ies); in ieee80211_assoc_success()
5851 &link->conf->sync_dtim_count, in ieee80211_assoc_success()
5852 &link->u.mgd.dtim_period); in ieee80211_assoc_success()
5853 link->conf->beacon_int = cbss->beacon_interval; in ieee80211_assoc_success()
5857 link->conf->dtim_period = link->u.mgd.dtim_period ?: 1; in ieee80211_assoc_success()
5859 if (link_id != assoc_data->assoc_link_id) { in ieee80211_assoc_success()
5860 link->u.mgd.conn = assoc_data->link[link_id].conn; in ieee80211_assoc_success()
5863 true, &link->u.mgd.conn, in ieee80211_assoc_success()
5864 assoc_data->userspace_selectors); in ieee80211_assoc_success()
5872 assoc_data->link[link_id].bss); in ieee80211_assoc_success()
5877 assoc_data->link[link_id].bss, in ieee80211_assoc_success()
5882 if (assoc_data->link[link_id].status != WLAN_STATUS_SUCCESS) { in ieee80211_assoc_success()
5888 if (link_id != assoc_data->assoc_link_id) { in ieee80211_assoc_success()
5900 if (ifmgd->flags & IEEE80211_STA_MFP_ENABLED) { in ieee80211_assoc_success()
5902 sta->sta.mfp = true; in ieee80211_assoc_success()
5904 sta->sta.mfp = false; in ieee80211_assoc_success()
5907 ieee80211_sta_set_max_amsdu_subframes(sta, elems->ext_capab, in ieee80211_assoc_success()
5908 elems->ext_capab_len); in ieee80211_assoc_success()
5910 sta->sta.wme = (elems->wmm_param || elems->s1g_capab) && in ieee80211_assoc_success()
5911 local->hw.queues >= IEEE80211_NUM_ACS; in ieee80211_assoc_success()
5914 if (!err && !(ifmgd->flags & IEEE80211_STA_CONTROL_PORT)) in ieee80211_assoc_success()
5919 sta->sta.addr); in ieee80211_assoc_success()
5924 if (sdata->wdev.use_4addr) in ieee80211_assoc_success()
5925 drv_sta_set_4addr(local, sdata, &sta->sta, true); in ieee80211_assoc_success()
5930 * If we're using 4-addr mode, let the AP know that we're in ieee80211_assoc_success()
5931 * doing so, so that it can create the STA VLAN on its side in ieee80211_assoc_success()
5933 if (ifmgd->use_4addr) in ieee80211_assoc_success()
5945 eth_zero_addr(sdata->vif.cfg.ap_addr); in ieee80211_assoc_success()
5953 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_rx_mgmt_assoc_resp()
5954 struct ieee80211_mgd_assoc_data *assoc_data = ifmgd->assoc_data; in ieee80211_rx_mgmt_assoc_resp()
5958 .link_id = -1, in ieee80211_rx_mgmt_assoc_resp()
5972 .uapsd_queues = -1, in ieee80211_rx_mgmt_assoc_resp()
5977 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_rx_mgmt_assoc_resp()
5982 info.link_id = assoc_data->assoc_link_id; in ieee80211_rx_mgmt_assoc_resp()
5985 assoc_data->link[assoc_data->assoc_link_id].conn.mode; in ieee80211_rx_mgmt_assoc_resp()
5987 if (!ether_addr_equal(assoc_data->ap_addr, mgmt->bssid) || in ieee80211_rx_mgmt_assoc_resp()
5988 !ether_addr_equal(assoc_data->ap_addr, mgmt->sa)) in ieee80211_rx_mgmt_assoc_resp()
5999 reassoc = ieee80211_is_reassoc_resp(mgmt->frame_control); in ieee80211_rx_mgmt_assoc_resp()
6000 capab_info = le16_to_cpu(mgmt->u.assoc_resp.capab_info); in ieee80211_rx_mgmt_assoc_resp()
6001 status_code = le16_to_cpu(mgmt->u.assoc_resp.status_code); in ieee80211_rx_mgmt_assoc_resp()
6002 if (assoc_data->s1g) in ieee80211_rx_mgmt_assoc_resp()
6003 elem_start = mgmt->u.s1g_assoc_resp.variable; in ieee80211_rx_mgmt_assoc_resp()
6005 elem_start = mgmt->u.assoc_resp.variable; in ieee80211_rx_mgmt_assoc_resp()
6008 * Note: this may not be perfect, AP might misbehave - if in ieee80211_rx_mgmt_assoc_resp()
6016 if (assoc_data->fils_kek_len && in ieee80211_rx_mgmt_assoc_resp()
6020 elem_len = len - (elem_start - (u8 *)mgmt); in ieee80211_rx_mgmt_assoc_resp()
6027 if (elems->aid_resp) in ieee80211_rx_mgmt_assoc_resp()
6028 aid = le16_to_cpu(elems->aid_resp->aid); in ieee80211_rx_mgmt_assoc_resp()
6029 else if (assoc_data->s1g) in ieee80211_rx_mgmt_assoc_resp()
6032 aid = le16_to_cpu(mgmt->u.assoc_resp.aid); in ieee80211_rx_mgmt_assoc_resp()
6036 * (802.11-2016 9.4.1.8 AID field) in ieee80211_rx_mgmt_assoc_resp()
6042 reassoc ? "Rea" : "A", assoc_data->ap_addr, in ieee80211_rx_mgmt_assoc_resp()
6045 ifmgd->broken_ap = false; in ieee80211_rx_mgmt_assoc_resp()
6048 elems->timeout_int && in ieee80211_rx_mgmt_assoc_resp()
6049 elems->timeout_int->type == WLAN_TIMEOUT_ASSOC_COMEBACK) { in ieee80211_rx_mgmt_assoc_resp()
6052 cfg80211_assoc_comeback(sdata->dev, assoc_data->ap_addr, in ieee80211_rx_mgmt_assoc_resp()
6053 le32_to_cpu(elems->timeout_int->value)); in ieee80211_rx_mgmt_assoc_resp()
6055 tu = le32_to_cpu(elems->timeout_int->value); in ieee80211_rx_mgmt_assoc_resp()
6059 assoc_data->ap_addr, tu, ms); in ieee80211_rx_mgmt_assoc_resp()
6060 assoc_data->timeout = jiffies + msecs_to_jiffies(ms); in ieee80211_rx_mgmt_assoc_resp()
6061 assoc_data->timeout_started = true; in ieee80211_rx_mgmt_assoc_resp()
6062 assoc_data->comeback = true; in ieee80211_rx_mgmt_assoc_resp()
6064 run_again(sdata, assoc_data->timeout); in ieee80211_rx_mgmt_assoc_resp()
6070 assoc_data->ap_addr, status_code); in ieee80211_rx_mgmt_assoc_resp()
6073 drv_event_callback(sdata->local, sdata, &event); in ieee80211_rx_mgmt_assoc_resp()
6080 ifmgd->broken_ap = true; in ieee80211_rx_mgmt_assoc_resp()
6083 if (ieee80211_vif_is_mld(&sdata->vif)) { in ieee80211_rx_mgmt_assoc_resp()
6086 if (!elems->ml_basic) { in ieee80211_rx_mgmt_assoc_resp()
6088 "MLO association with %pM but no (basic) multi-link element in response!\n", in ieee80211_rx_mgmt_assoc_resp()
6089 assoc_data->ap_addr); in ieee80211_rx_mgmt_assoc_resp()
6093 common = (void *)elems->ml_basic->variable; in ieee80211_rx_mgmt_assoc_resp()
6095 if (memcmp(assoc_data->ap_addr, in ieee80211_rx_mgmt_assoc_resp()
6096 common->mld_mac_addr, ETH_ALEN)) { in ieee80211_rx_mgmt_assoc_resp()
6099 common->mld_mac_addr, in ieee80211_rx_mgmt_assoc_resp()
6100 assoc_data->ap_addr); in ieee80211_rx_mgmt_assoc_resp()
6104 sdata->vif.cfg.eml_cap = in ieee80211_rx_mgmt_assoc_resp()
6105 ieee80211_mle_get_eml_cap((const void *)elems->ml_basic); in ieee80211_rx_mgmt_assoc_resp()
6106 sdata->vif.cfg.eml_med_sync_delay = in ieee80211_rx_mgmt_assoc_resp()
6107 ieee80211_mle_get_eml_med_sync_delay((const void *)elems->ml_basic); in ieee80211_rx_mgmt_assoc_resp()
6108 sdata->vif.cfg.mld_capa_op = in ieee80211_rx_mgmt_assoc_resp()
6109 ieee80211_mle_get_mld_capa_op((const void *)elems->ml_basic); in ieee80211_rx_mgmt_assoc_resp()
6112 sdata->vif.cfg.aid = aid; in ieee80211_rx_mgmt_assoc_resp()
6116 /* oops -- internal error -- send timeout for now */ in ieee80211_rx_mgmt_assoc_resp()
6121 drv_event_callback(sdata->local, sdata, &event); in ieee80211_rx_mgmt_assoc_resp()
6130 if (!assoc_data->link[link_id].bss) in ieee80211_rx_mgmt_assoc_resp()
6133 resp.links[link_id].bss = assoc_data->link[link_id].bss; in ieee80211_rx_mgmt_assoc_resp()
6135 assoc_data->link[link_id].addr); in ieee80211_rx_mgmt_assoc_resp()
6136 resp.links[link_id].status = assoc_data->link[link_id].status; in ieee80211_rx_mgmt_assoc_resp()
6138 link = sdata_dereference(sdata->link[link_id], sdata); in ieee80211_rx_mgmt_assoc_resp()
6142 /* get uapsd queues configuration - same for all links */ in ieee80211_rx_mgmt_assoc_resp()
6145 if (link->tx_conf[ac].uapsd) in ieee80211_rx_mgmt_assoc_resp()
6149 if (ieee80211_vif_is_mld(&sdata->vif)) { in ieee80211_rx_mgmt_assoc_resp()
6150 ether_addr_copy(ap_mld_addr, sdata->vif.cfg.ap_addr); in ieee80211_rx_mgmt_assoc_resp()
6161 resp.req_ies = ifmgd->assoc_req_ies; in ieee80211_rx_mgmt_assoc_resp()
6162 resp.req_ies_len = ifmgd->assoc_req_ies_len; in ieee80211_rx_mgmt_assoc_resp()
6163 cfg80211_rx_assoc_resp(sdata->dev, &resp); in ieee80211_rx_mgmt_assoc_resp()
6165 drv_mgd_complete_tx(sdata->local, sdata, &info); in ieee80211_rx_mgmt_assoc_resp()
6177 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_rx_bss_info()
6178 struct ieee80211_local *local = sdata->local; in ieee80211_rx_bss_info()
6182 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_rx_bss_info()
6184 channel = ieee80211_get_channel_khz(local->hw.wiphy, in ieee80211_rx_bss_info()
6191 link->conf->beacon_rate = bss->beacon_rate; in ieee80211_rx_bss_info()
6200 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_rx_mgmt_probe_resp()
6201 struct ieee80211_mgmt *mgmt = (void *)skb->data; in ieee80211_rx_mgmt_probe_resp()
6203 struct ieee80211_rx_status *rx_status = (void *) skb->cb; in ieee80211_rx_mgmt_probe_resp()
6205 size_t baselen, len = skb->len; in ieee80211_rx_mgmt_probe_resp()
6207 ifmgd = &sdata->u.mgd; in ieee80211_rx_mgmt_probe_resp()
6209 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_rx_mgmt_probe_resp()
6218 channel = ieee80211_get_channel(sdata->local->hw.wiphy, in ieee80211_rx_mgmt_probe_resp()
6219 rx_status->freq); in ieee80211_rx_mgmt_probe_resp()
6223 if (!ether_addr_equal(mgmt->da, sdata->vif.addr) && in ieee80211_rx_mgmt_probe_resp()
6224 (channel->band != NL80211_BAND_6GHZ || in ieee80211_rx_mgmt_probe_resp()
6225 !is_broadcast_ether_addr(mgmt->da))) in ieee80211_rx_mgmt_probe_resp()
6228 baselen = (u8 *) mgmt->u.probe_resp.variable - (u8 *) mgmt; in ieee80211_rx_mgmt_probe_resp()
6234 if (ifmgd->associated && in ieee80211_rx_mgmt_probe_resp()
6235 ether_addr_equal(mgmt->bssid, link->u.mgd.bssid)) in ieee80211_rx_mgmt_probe_resp()
6250 * XXX: This list needs to be dynamic -- userspace needs to be able to
6269 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_handle_beacon_sig()
6273 if (!link->u.mgd.tracking_signal_avg) { in ieee80211_handle_beacon_sig()
6274 link->u.mgd.tracking_signal_avg = true; in ieee80211_handle_beacon_sig()
6275 ewma_beacon_signal_init(&link->u.mgd.ave_beacon_signal); in ieee80211_handle_beacon_sig()
6276 link->u.mgd.last_cqm_event_signal = 0; in ieee80211_handle_beacon_sig()
6277 link->u.mgd.count_beacon_signal = 1; in ieee80211_handle_beacon_sig()
6278 link->u.mgd.last_ave_beacon_signal = 0; in ieee80211_handle_beacon_sig()
6280 link->u.mgd.count_beacon_signal++; in ieee80211_handle_beacon_sig()
6283 ewma_beacon_signal_add(&link->u.mgd.ave_beacon_signal, in ieee80211_handle_beacon_sig()
6284 -rx_status->signal); in ieee80211_handle_beacon_sig()
6286 if (ifmgd->rssi_min_thold != ifmgd->rssi_max_thold && in ieee80211_handle_beacon_sig()
6287 link->u.mgd.count_beacon_signal >= IEEE80211_SIGNAL_AVE_MIN_COUNT) { in ieee80211_handle_beacon_sig()
6288 int sig = -ewma_beacon_signal_read(&link->u.mgd.ave_beacon_signal); in ieee80211_handle_beacon_sig()
6289 int last_sig = link->u.mgd.last_ave_beacon_signal; in ieee80211_handle_beacon_sig()
6298 if (sig > ifmgd->rssi_max_thold && in ieee80211_handle_beacon_sig()
6299 (last_sig <= ifmgd->rssi_min_thold || last_sig == 0)) { in ieee80211_handle_beacon_sig()
6300 link->u.mgd.last_ave_beacon_signal = sig; in ieee80211_handle_beacon_sig()
6303 } else if (sig < ifmgd->rssi_min_thold && in ieee80211_handle_beacon_sig()
6304 (last_sig >= ifmgd->rssi_max_thold || in ieee80211_handle_beacon_sig()
6306 link->u.mgd.last_ave_beacon_signal = sig; in ieee80211_handle_beacon_sig()
6312 if (bss_conf->cqm_rssi_thold && in ieee80211_handle_beacon_sig()
6313 link->u.mgd.count_beacon_signal >= IEEE80211_SIGNAL_AVE_MIN_COUNT && in ieee80211_handle_beacon_sig()
6314 !(sdata->vif.driver_flags & IEEE80211_VIF_SUPPORTS_CQM_RSSI)) { in ieee80211_handle_beacon_sig()
6315 int sig = -ewma_beacon_signal_read(&link->u.mgd.ave_beacon_signal); in ieee80211_handle_beacon_sig()
6316 int last_event = link->u.mgd.last_cqm_event_signal; in ieee80211_handle_beacon_sig()
6317 int thold = bss_conf->cqm_rssi_thold; in ieee80211_handle_beacon_sig()
6318 int hyst = bss_conf->cqm_rssi_hyst; in ieee80211_handle_beacon_sig()
6321 (last_event == 0 || sig < last_event - hyst)) { in ieee80211_handle_beacon_sig()
6322 link->u.mgd.last_cqm_event_signal = sig; in ieee80211_handle_beacon_sig()
6324 &sdata->vif, in ieee80211_handle_beacon_sig()
6329 link->u.mgd.last_cqm_event_signal = sig; in ieee80211_handle_beacon_sig()
6331 &sdata->vif, in ieee80211_handle_beacon_sig()
6337 if (bss_conf->cqm_rssi_low && in ieee80211_handle_beacon_sig()
6338 link->u.mgd.count_beacon_signal >= IEEE80211_SIGNAL_AVE_MIN_COUNT) { in ieee80211_handle_beacon_sig()
6339 int sig = -ewma_beacon_signal_read(&link->u.mgd.ave_beacon_signal); in ieee80211_handle_beacon_sig()
6340 int last_event = link->u.mgd.last_cqm_event_signal; in ieee80211_handle_beacon_sig()
6341 int low = bss_conf->cqm_rssi_low; in ieee80211_handle_beacon_sig()
6342 int high = bss_conf->cqm_rssi_high; in ieee80211_handle_beacon_sig()
6346 link->u.mgd.last_cqm_event_signal = sig; in ieee80211_handle_beacon_sig()
6348 &sdata->vif, in ieee80211_handle_beacon_sig()
6353 link->u.mgd.last_cqm_event_signal = sig; in ieee80211_handle_beacon_sig()
6355 &sdata->vif, in ieee80211_handle_beacon_sig()
6365 if (ether_addr_equal(tx_bssid, bss->bssid)) in ieee80211_rx_our_beacon()
6367 if (!bss->transmitted_bss) in ieee80211_rx_our_beacon()
6369 return ether_addr_equal(tx_bssid, bss->transmitted_bss->bssid); in ieee80211_rx_our_beacon()
6381 if (!sdata->u.mgd.removed_links) in ieee80211_ml_reconf_work()
6386 sdata->vif.valid_links, sdata->u.mgd.removed_links); in ieee80211_ml_reconf_work()
6388 new_valid_links = sdata->vif.valid_links & ~sdata->u.mgd.removed_links; in ieee80211_ml_reconf_work()
6389 if (new_valid_links == sdata->vif.valid_links) in ieee80211_ml_reconf_work()
6393 !(new_valid_links & ~sdata->vif.dormant_links)) { in ieee80211_ml_reconf_work()
6395 ret = -EINVAL; in ieee80211_ml_reconf_work()
6399 new_active_links = sdata->vif.active_links & ~sdata->u.mgd.removed_links; in ieee80211_ml_reconf_work()
6400 if (new_active_links != sdata->vif.active_links) { in ieee80211_ml_reconf_work()
6404 ~sdata->vif.dormant_links) - 1); in ieee80211_ml_reconf_work()
6406 ret = ieee80211_set_active_links(&sdata->vif, new_active_links); in ieee80211_ml_reconf_work()
6414 new_dormant_links = sdata->vif.dormant_links & ~sdata->u.mgd.removed_links; in ieee80211_ml_reconf_work()
6425 cfg80211_links_removed(sdata->dev, sdata->u.mgd.removed_links); in ieee80211_ml_reconf_work()
6429 sdata->u.mgd.removed_links = 0; in ieee80211_ml_reconf_work()
6441 if (!ieee80211_vif_is_mld(&sdata->vif) || !elems->ml_reconf) in ieee80211_ml_reconfiguration()
6447 for_each_mle_subelement(sub, (const u8 *)elems->ml_reconf, in ieee80211_ml_reconfiguration()
6448 elems->ml_reconf_len) { in ieee80211_ml_reconfiguration()
6449 struct ieee80211_mle_per_sta_profile *prof = (void *)sub->data; in ieee80211_ml_reconfiguration()
6450 u8 *pos = prof->variable; in ieee80211_ml_reconfiguration()
6453 if (sub->id != IEEE80211_MLE_SUBELEM_PER_STA_PROFILE) in ieee80211_ml_reconfiguration()
6456 if (!ieee80211_mle_reconf_sta_prof_size_ok(sub->data, in ieee80211_ml_reconfiguration()
6457 sub->datalen)) in ieee80211_ml_reconfiguration()
6460 control = le16_to_cpu(prof->control); in ieee80211_ml_reconfiguration()
6479 removed_links &= sdata->vif.valid_links; in ieee80211_ml_reconfiguration()
6482 if (sdata->u.mgd.removed_links) { in ieee80211_ml_reconfiguration()
6483 sdata->u.mgd.removed_links = 0; in ieee80211_ml_reconfiguration()
6484 wiphy_delayed_work_cancel(sdata->local->hw.wiphy, in ieee80211_ml_reconfiguration()
6485 &sdata->u.mgd.ml_reconf_work); in ieee80211_ml_reconfiguration()
6493 sdata_dereference(sdata->vif.link_conf[link_id], sdata); in ieee80211_ml_reconfiguration()
6504 link_delay = link_conf->beacon_int * in ieee80211_ml_reconfiguration()
6505 (link_removal_timeout[link_id] - 1); in ieee80211_ml_reconfiguration()
6513 sdata->u.mgd.removed_links = removed_links; in ieee80211_ml_reconfiguration()
6514 wiphy_delayed_work_queue(sdata->local->hw.wiphy, in ieee80211_ml_reconfiguration()
6515 &sdata->u.mgd.ml_reconf_work, in ieee80211_ml_reconfiguration()
6527 ret = -EINVAL; in ieee80211_ttlm_set_links()
6534 if (sdata->vif.neg_ttlm.valid) { in ieee80211_ttlm_set_links()
6535 memset(&sdata->vif.neg_ttlm, 0, sizeof(sdata->vif.neg_ttlm)); in ieee80211_ttlm_set_links()
6536 sdata->vif.suspended_links = 0; in ieee80211_ttlm_set_links()
6540 if (sdata->vif.active_links != active_links) { in ieee80211_ttlm_set_links()
6545 active_links &= sdata->vif.active_links; in ieee80211_ttlm_set_links()
6548 BIT(__ffs(sdata->vif.valid_links & in ieee80211_ttlm_set_links()
6550 ret = ieee80211_set_active_links(&sdata->vif, active_links); in ieee80211_ttlm_set_links()
6557 ret = ieee80211_vif_set_links(sdata, sdata->vif.valid_links, in ieee80211_ttlm_set_links()
6564 sdata->vif.suspended_links = suspended_links; in ieee80211_ttlm_set_links()
6565 if (sdata->vif.suspended_links) in ieee80211_ttlm_set_links()
6572 ieee80211_disconnect(&sdata->vif, false); in ieee80211_ttlm_set_links()
6585 new_active_links = sdata->u.mgd.ttlm_info.map & in ieee80211_tid_to_link_map_work()
6586 sdata->vif.valid_links; in ieee80211_tid_to_link_map_work()
6587 new_dormant_links = ~sdata->u.mgd.ttlm_info.map & in ieee80211_tid_to_link_map_work()
6588 sdata->vif.valid_links; in ieee80211_tid_to_link_map_work()
6590 ieee80211_vif_set_links(sdata, sdata->vif.valid_links, 0); in ieee80211_tid_to_link_map_work()
6595 sdata->u.mgd.ttlm_info.active = true; in ieee80211_tid_to_link_map_work()
6596 sdata->u.mgd.ttlm_info.switch_time = 0; in ieee80211_tid_to_link_map_work()
6619 pos = (void *)ttlm->optional; in ieee80211_parse_adv_t2l()
6620 control = ttlm->control; in ieee80211_parse_adv_t2l()
6629 return -EINVAL; in ieee80211_parse_adv_t2l()
6635 ttlm_info->switch_time = get_unaligned_le16(pos); in ieee80211_parse_adv_t2l()
6637 /* Since ttlm_info->switch_time == 0 means no switch time, bump it in ieee80211_parse_adv_t2l()
6640 if (!ttlm_info->switch_time) in ieee80211_parse_adv_t2l()
6641 ttlm_info->switch_time = 1; in ieee80211_parse_adv_t2l()
6646 ttlm_info->duration = pos[0] | pos[1] << 8 | pos[2] << 16; in ieee80211_parse_adv_t2l()
6656 * not advertise a TID-to-link mapping that does not map all TIDs to the in ieee80211_parse_adv_t2l()
6662 return -EINVAL; in ieee80211_parse_adv_t2l()
6665 ttlm_info->map = ieee80211_get_ttlm(map_size, pos); in ieee80211_parse_adv_t2l()
6666 if (!ttlm_info->map) { in ieee80211_parse_adv_t2l()
6669 return -EINVAL; in ieee80211_parse_adv_t2l()
6677 if (map != ttlm_info->map) { in ieee80211_parse_adv_t2l()
6680 return -EINVAL; in ieee80211_parse_adv_t2l()
6695 if (!ieee80211_vif_is_mld(&sdata->vif)) in ieee80211_process_adv_ttlm()
6698 if (!elems->ttlm_num) { in ieee80211_process_adv_ttlm()
6699 if (sdata->u.mgd.ttlm_info.switch_time) { in ieee80211_process_adv_ttlm()
6700 /* if a planned TID-to-link mapping was cancelled - in ieee80211_process_adv_ttlm()
6703 wiphy_delayed_work_cancel(sdata->local->hw.wiphy, in ieee80211_process_adv_ttlm()
6704 &sdata->u.mgd.ttlm_work); in ieee80211_process_adv_ttlm()
6705 } else if (sdata->u.mgd.ttlm_info.active) { in ieee80211_process_adv_ttlm()
6706 /* if no TID-to-link element, set to default mapping in in ieee80211_process_adv_ttlm()
6710 sdata->vif.valid_links, in ieee80211_process_adv_ttlm()
6719 memset(&sdata->u.mgd.ttlm_info, 0, in ieee80211_process_adv_ttlm()
6720 sizeof(sdata->u.mgd.ttlm_info)); in ieee80211_process_adv_ttlm()
6724 for (i = 0; i < elems->ttlm_num; i++) { in ieee80211_process_adv_ttlm()
6728 res = ieee80211_parse_adv_t2l(sdata, elems->ttlm[i], in ieee80211_process_adv_ttlm()
6748 delay = st_tu - beacon_ts_tu; in ieee80211_process_adv_ttlm()
6766 delay_jiffies -= in ieee80211_process_adv_ttlm()
6771 sdata->u.mgd.ttlm_info = ttlm_info; in ieee80211_process_adv_ttlm()
6772 wiphy_delayed_work_cancel(sdata->local->hw.wiphy, in ieee80211_process_adv_ttlm()
6773 &sdata->u.mgd.ttlm_work); in ieee80211_process_adv_ttlm()
6774 wiphy_delayed_work_queue(sdata->local->hw.wiphy, in ieee80211_process_adv_ttlm()
6775 &sdata->u.mgd.ttlm_work, in ieee80211_process_adv_ttlm()
6795 if (!ieee80211_mle_size_ok((u8 *)elems->ml_basic, elems->ml_basic_len)) in ieee80211_mgd_check_cross_link_csa()
6798 common_size = ieee80211_mle_common_size((u8 *)elems->ml_basic); in ieee80211_mgd_check_cross_link_csa()
6799 subelems = (u8 *)elems->ml_basic + common_size; in ieee80211_mgd_check_cross_link_csa()
6800 subelems_len = elems->ml_basic_len - common_size; in ieee80211_mgd_check_cross_link_csa()
6804 struct ieee80211_mle_per_sta_profile *prof = (void *)sub->data; in ieee80211_mgd_check_cross_link_csa()
6808 if (!ieee80211_mle_basic_sta_prof_size_ok(sub->data, in ieee80211_mgd_check_cross_link_csa()
6809 sub->datalen)) in ieee80211_mgd_check_cross_link_csa()
6812 link_id = le16_get_bits(prof->control, in ieee80211_mgd_check_cross_link_csa()
6819 link = sdata_dereference(sdata->link[link_id], sdata); in ieee80211_mgd_check_cross_link_csa()
6842 link = sdata_dereference(sdata->link[link_id], sdata); in ieee80211_mgd_check_cross_link_csa()
6851 /* we can defragment in-place, won't use the buffer again */ in ieee80211_mgd_check_cross_link_csa()
6861 prof_elems = ieee802_11_parse_elems(prof->variable + in ieee80211_mgd_check_cross_link_csa()
6862 (prof->sta_info_len - 1), in ieee80211_mgd_check_cross_link_csa()
6863 len - in ieee80211_mgd_check_cross_link_csa()
6864 (prof->sta_info_len - 1), in ieee80211_mgd_check_cross_link_csa()
6867 /* memory allocation failed - let's hope that's transient */ in ieee80211_mgd_check_cross_link_csa()
6889 struct ieee80211_vif_cfg *cfg = &sdata->vif.cfg; in ieee80211_mgd_ssid_mismatch()
6892 if (!elems->ssid) in ieee80211_mgd_ssid_mismatch()
6896 if (elems->ssid_len == 0) in ieee80211_mgd_ssid_mismatch()
6899 if (elems->ssid_len != cfg->ssid_len) in ieee80211_mgd_ssid_mismatch()
6903 if (!memcmp(elems->ssid, zero_ssid, elems->ssid_len)) in ieee80211_mgd_ssid_mismatch()
6906 return memcmp(elems->ssid, cfg->ssid, cfg->ssid_len); in ieee80211_mgd_ssid_mismatch()
6913 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_rx_mgmt_beacon()
6914 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_rx_mgmt_beacon()
6915 struct ieee80211_bss_conf *bss_conf = link->conf; in ieee80211_rx_mgmt_beacon()
6916 struct ieee80211_vif_cfg *vif_cfg = &sdata->vif.cfg; in ieee80211_rx_mgmt_beacon()
6920 struct ieee80211_local *local = sdata->local; in ieee80211_rx_mgmt_beacon()
6930 u8 *bssid, *variable = mgmt->u.beacon.variable; in ieee80211_rx_mgmt_beacon()
6933 .mode = link->u.mgd.conn.mode, in ieee80211_rx_mgmt_beacon()
6934 .link_id = -1, in ieee80211_rx_mgmt_beacon()
6938 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_rx_mgmt_beacon()
6941 bssid = ieee80211_get_bssid(hdr, len, sdata->vif.type); in ieee80211_rx_mgmt_beacon()
6942 if (ieee80211_is_s1g_beacon(mgmt->frame_control)) { in ieee80211_rx_mgmt_beacon()
6945 if (ieee80211_is_s1g_short_beacon(ext->frame_control)) in ieee80211_rx_mgmt_beacon()
6946 variable = ext->u.s1g_short_beacon.variable; in ieee80211_rx_mgmt_beacon()
6948 variable = ext->u.s1g_beacon.variable; in ieee80211_rx_mgmt_beacon()
6951 baselen = (u8 *) variable - (u8 *) mgmt; in ieee80211_rx_mgmt_beacon()
6956 parse_params.len = len - baselen; in ieee80211_rx_mgmt_beacon()
6959 chanctx_conf = rcu_dereference(bss_conf->chanctx_conf); in ieee80211_rx_mgmt_beacon()
6966 ieee80211_channel_to_khz(chanctx_conf->def.chan)) { in ieee80211_rx_mgmt_beacon()
6970 chan = chanctx_conf->def.chan; in ieee80211_rx_mgmt_beacon()
6973 if (ifmgd->assoc_data && ifmgd->assoc_data->need_beacon && in ieee80211_rx_mgmt_beacon()
6974 !WARN_ON(ieee80211_vif_is_mld(&sdata->vif)) && in ieee80211_rx_mgmt_beacon()
6975 ieee80211_rx_our_beacon(bssid, ifmgd->assoc_data->link[0].bss)) { in ieee80211_rx_mgmt_beacon()
6976 parse_params.bss = ifmgd->assoc_data->link[0].bss; in ieee80211_rx_mgmt_beacon()
6983 if (elems->dtim_period) in ieee80211_rx_mgmt_beacon()
6984 link->u.mgd.dtim_period = elems->dtim_period; in ieee80211_rx_mgmt_beacon()
6985 link->u.mgd.have_beacon = true; in ieee80211_rx_mgmt_beacon()
6986 ifmgd->assoc_data->need_beacon = false; in ieee80211_rx_mgmt_beacon()
6987 if (ieee80211_hw_check(&local->hw, TIMING_BEACON_ONLY) && in ieee80211_rx_mgmt_beacon()
6988 !ieee80211_is_s1g_beacon(hdr->frame_control)) { in ieee80211_rx_mgmt_beacon()
6989 bss_conf->sync_tsf = in ieee80211_rx_mgmt_beacon()
6990 le64_to_cpu(mgmt->u.beacon.timestamp); in ieee80211_rx_mgmt_beacon()
6991 bss_conf->sync_device_ts = in ieee80211_rx_mgmt_beacon()
6992 rx_status->device_timestamp; in ieee80211_rx_mgmt_beacon()
6993 bss_conf->sync_dtim_count = elems->dtim_count; in ieee80211_rx_mgmt_beacon()
6996 if (elems->mbssid_config_ie) in ieee80211_rx_mgmt_beacon()
6997 bss_conf->profile_periodicity = in ieee80211_rx_mgmt_beacon()
6998 elems->mbssid_config_ie->profile_periodicity; in ieee80211_rx_mgmt_beacon()
7000 bss_conf->profile_periodicity = 0; in ieee80211_rx_mgmt_beacon()
7002 if (elems->ext_capab_len >= 11 && in ieee80211_rx_mgmt_beacon()
7003 (elems->ext_capab[10] & WLAN_EXT_CAPA11_EMA_SUPPORT)) in ieee80211_rx_mgmt_beacon()
7004 bss_conf->ema_ap = true; in ieee80211_rx_mgmt_beacon()
7006 bss_conf->ema_ap = false; in ieee80211_rx_mgmt_beacon()
7009 ifmgd->assoc_data->timeout = jiffies; in ieee80211_rx_mgmt_beacon()
7010 ifmgd->assoc_data->timeout_started = true; in ieee80211_rx_mgmt_beacon()
7011 run_again(sdata, ifmgd->assoc_data->timeout); in ieee80211_rx_mgmt_beacon()
7016 if (!ifmgd->associated || in ieee80211_rx_mgmt_beacon()
7017 !ieee80211_rx_our_beacon(bssid, bss_conf->bss)) in ieee80211_rx_mgmt_beacon()
7019 bssid = link->u.mgd.bssid; in ieee80211_rx_mgmt_beacon()
7021 if (!(rx_status->flag & RX_FLAG_NO_SIGNAL_VAL)) in ieee80211_rx_mgmt_beacon()
7025 if (ifmgd->flags & IEEE80211_STA_CONNECTION_POLL) { in ieee80211_rx_mgmt_beacon()
7042 if (!ieee80211_is_s1g_beacon(hdr->frame_control)) in ieee80211_rx_mgmt_beacon()
7043 ncrc = crc32_be(0, (void *)&mgmt->u.beacon.beacon_int, 4); in ieee80211_rx_mgmt_beacon()
7044 parse_params.bss = bss_conf->bss; in ieee80211_rx_mgmt_beacon()
7051 if (rx_status->flag & RX_FLAG_DECRYPTED && in ieee80211_rx_mgmt_beacon()
7054 sdata->vif.cfg.ap_addr); in ieee80211_rx_mgmt_beacon()
7059 ncrc = elems->crc; in ieee80211_rx_mgmt_beacon()
7061 if (ieee80211_hw_check(&local->hw, PS_NULLFUNC_STACK) && in ieee80211_rx_mgmt_beacon()
7062 ieee80211_check_tim(elems->tim, elems->tim_len, vif_cfg->aid)) { in ieee80211_rx_mgmt_beacon()
7063 if (local->hw.conf.dynamic_ps_timeout > 0) { in ieee80211_rx_mgmt_beacon()
7064 if (local->hw.conf.flags & IEEE80211_CONF_PS) { in ieee80211_rx_mgmt_beacon()
7065 local->hw.conf.flags &= ~IEEE80211_CONF_PS; in ieee80211_rx_mgmt_beacon()
7070 } else if (!local->pspolling && sdata->u.mgd.powersave) { in ieee80211_rx_mgmt_beacon()
7071 local->pspolling = true; in ieee80211_rx_mgmt_beacon()
7075 * able to send ps-poll frame and receive a in ieee80211_rx_mgmt_beacon()
7085 if (sdata->vif.p2p || in ieee80211_rx_mgmt_beacon()
7086 sdata->vif.driver_flags & IEEE80211_VIF_GET_NOA_UPDATE) { in ieee80211_rx_mgmt_beacon()
7091 len - baselen, in ieee80211_rx_mgmt_beacon()
7095 if (link->u.mgd.p2p_noa_index != noa.index) { in ieee80211_rx_mgmt_beacon()
7097 link->u.mgd.p2p_noa_index = noa.index; in ieee80211_rx_mgmt_beacon()
7098 memcpy(&bss_conf->p2p_noa_attr, &noa, sizeof(noa)); in ieee80211_rx_mgmt_beacon()
7104 link->u.mgd.beacon_crc_valid = false; in ieee80211_rx_mgmt_beacon()
7106 } else if (link->u.mgd.p2p_noa_index != -1) { in ieee80211_rx_mgmt_beacon()
7108 link->u.mgd.p2p_noa_index = -1; in ieee80211_rx_mgmt_beacon()
7109 memset(&bss_conf->p2p_noa_attr, 0, sizeof(bss_conf->p2p_noa_attr)); in ieee80211_rx_mgmt_beacon()
7111 link->u.mgd.beacon_crc_valid = false; in ieee80211_rx_mgmt_beacon()
7123 if (ieee80211_hw_check(&local->hw, TIMING_BEACON_ONLY) && in ieee80211_rx_mgmt_beacon()
7124 !ieee80211_is_s1g_beacon(hdr->frame_control)) { in ieee80211_rx_mgmt_beacon()
7125 bss_conf->sync_tsf = in ieee80211_rx_mgmt_beacon()
7126 le64_to_cpu(mgmt->u.beacon.timestamp); in ieee80211_rx_mgmt_beacon()
7127 bss_conf->sync_device_ts = in ieee80211_rx_mgmt_beacon()
7128 rx_status->device_timestamp; in ieee80211_rx_mgmt_beacon()
7129 bss_conf->sync_dtim_count = elems->dtim_count; in ieee80211_rx_mgmt_beacon()
7132 if ((ncrc == link->u.mgd.beacon_crc && link->u.mgd.beacon_crc_valid) || in ieee80211_rx_mgmt_beacon()
7133 ieee80211_is_s1g_short_beacon(mgmt->frame_control)) in ieee80211_rx_mgmt_beacon()
7135 link->u.mgd.beacon_crc = ncrc; in ieee80211_rx_mgmt_beacon()
7136 link->u.mgd.beacon_crc_valid = true; in ieee80211_rx_mgmt_beacon()
7140 ieee80211_sta_process_chanswitch(link, rx_status->mactime, in ieee80211_rx_mgmt_beacon()
7141 rx_status->device_timestamp, in ieee80211_rx_mgmt_beacon()
7145 /* note that after this elems->ml_basic can no longer be used fully */ in ieee80211_rx_mgmt_beacon()
7146 ieee80211_mgd_check_cross_link_csa(sdata, rx_status->link_id, elems); in ieee80211_rx_mgmt_beacon()
7150 if (!link->u.mgd.disable_wmm_tracking && in ieee80211_rx_mgmt_beacon()
7151 ieee80211_sta_wmm_params(local, link, elems->wmm_param, in ieee80211_rx_mgmt_beacon()
7152 elems->wmm_param_len, in ieee80211_rx_mgmt_beacon()
7153 elems->mu_edca_param_set)) in ieee80211_rx_mgmt_beacon()
7160 if (!link->u.mgd.have_beacon) { in ieee80211_rx_mgmt_beacon()
7162 bss_conf->dtim_period = elems->dtim_period ?: 1; in ieee80211_rx_mgmt_beacon()
7165 link->u.mgd.have_beacon = true; in ieee80211_rx_mgmt_beacon()
7172 if (elems->erp_info) { in ieee80211_rx_mgmt_beacon()
7174 erp_value = elems->erp_info[0]; in ieee80211_rx_mgmt_beacon()
7179 if (!ieee80211_is_s1g_beacon(hdr->frame_control)) in ieee80211_rx_mgmt_beacon()
7181 le16_to_cpu(mgmt->u.beacon.capab_info), in ieee80211_rx_mgmt_beacon()
7184 sta = sta_info_get(sdata, sdata->vif.cfg.ap_addr); in ieee80211_rx_mgmt_beacon()
7188 link_sta = rcu_dereference_protected(sta->link[link->link_id], in ieee80211_rx_mgmt_beacon()
7189 lockdep_is_held(&local->hw.wiphy->mtx)); in ieee80211_rx_mgmt_beacon()
7194 if (WARN_ON(!bss_conf->chanreq.oper.chan)) in ieee80211_rx_mgmt_beacon()
7197 sband = local->hw.wiphy->bands[bss_conf->chanreq.oper.chan->band]; in ieee80211_rx_mgmt_beacon()
7212 if (elems->opmode_notif) in ieee80211_rx_mgmt_beacon()
7214 *elems->opmode_notif, in ieee80211_rx_mgmt_beacon()
7215 rx_status->band); in ieee80211_rx_mgmt_beacon()
7218 elems->country_elem, in ieee80211_rx_mgmt_beacon()
7219 elems->country_elem_len, in ieee80211_rx_mgmt_beacon()
7220 elems->pwr_constr_elem, in ieee80211_rx_mgmt_beacon()
7221 elems->cisco_dtpc_elem); in ieee80211_rx_mgmt_beacon()
7225 le64_to_cpu(mgmt->u.beacon.timestamp)); in ieee80211_rx_mgmt_beacon()
7242 if (sdata->vif.neg_ttlm.valid) in ieee80211_apply_neg_ttlm()
7243 sdata->vif.dormant_links &= ~sdata->vif.suspended_links; in ieee80211_apply_neg_ttlm()
7247 map & sdata->vif.valid_links & ~sdata->vif.dormant_links; in ieee80211_apply_neg_ttlm()
7249 (~map & sdata->vif.valid_links) & ~sdata->vif.dormant_links; in ieee80211_apply_neg_ttlm()
7250 new_dormant_links = sdata->vif.dormant_links | new_suspended_links; in ieee80211_apply_neg_ttlm()
7255 sdata->vif.neg_ttlm = neg_ttlm; in ieee80211_apply_neg_ttlm()
7256 sdata->vif.neg_ttlm.valid = true; in ieee80211_apply_neg_ttlm()
7278 if (memcmp(neg_ttlm->downlink, neg_ttlm->uplink, in ieee80211_neg_ttlm_add_suggested_map()
7279 sizeof(neg_ttlm->downlink))) { in ieee80211_neg_ttlm_add_suggested_map()
7300 cpu_to_le16(neg_ttlm->uplink[tid]) : in ieee80211_neg_ttlm_add_suggested_map()
7301 cpu_to_le16(neg_ttlm->downlink[tid]); in ieee80211_neg_ttlm_add_suggested_map()
7323 struct ieee80211_local *local = sdata->local; in ieee80211_send_neg_ttlm_req()
7330 skb = dev_alloc_skb(local->tx_headroom + hdr_len + ttlm_max_len); in ieee80211_send_neg_ttlm_req()
7334 skb_reserve(skb, local->tx_headroom); in ieee80211_send_neg_ttlm_req()
7336 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | in ieee80211_send_neg_ttlm_req()
7338 memcpy(mgmt->da, sdata->vif.cfg.ap_addr, ETH_ALEN); in ieee80211_send_neg_ttlm_req()
7339 memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); in ieee80211_send_neg_ttlm_req()
7340 memcpy(mgmt->bssid, sdata->vif.cfg.ap_addr, ETH_ALEN); in ieee80211_send_neg_ttlm_req()
7342 mgmt->u.action.category = WLAN_CATEGORY_PROTECTED_EHT; in ieee80211_send_neg_ttlm_req()
7343 mgmt->u.action.u.ttlm_req.action_code = in ieee80211_send_neg_ttlm_req()
7345 mgmt->u.action.u.ttlm_req.dialog_token = dialog_token; in ieee80211_send_neg_ttlm_req()
7356 if (!ieee80211_vif_is_mld(&sdata->vif) || in ieee80211_req_neg_ttlm()
7357 !(sdata->vif.cfg.mld_capa_op & in ieee80211_req_neg_ttlm()
7359 return -EINVAL; in ieee80211_req_neg_ttlm()
7362 if ((params->dlink[i] & ~sdata->vif.valid_links) || in ieee80211_req_neg_ttlm()
7363 (params->ulink[i] & ~sdata->vif.valid_links)) in ieee80211_req_neg_ttlm()
7364 return -EINVAL; in ieee80211_req_neg_ttlm()
7366 neg_ttlm.downlink[i] = params->dlink[i]; in ieee80211_req_neg_ttlm()
7367 neg_ttlm.uplink[i] = params->ulink[i]; in ieee80211_req_neg_ttlm()
7370 if (drv_can_neg_ttlm(sdata->local, sdata, &neg_ttlm) != in ieee80211_req_neg_ttlm()
7372 return -EINVAL; in ieee80211_req_neg_ttlm()
7375 sdata->u.mgd.dialog_token_alloc++; in ieee80211_req_neg_ttlm()
7376 ieee80211_send_neg_ttlm_req(sdata, &sdata->vif.neg_ttlm, in ieee80211_req_neg_ttlm()
7377 sdata->u.mgd.dialog_token_alloc); in ieee80211_req_neg_ttlm()
7378 wiphy_delayed_work_cancel(sdata->local->hw.wiphy, in ieee80211_req_neg_ttlm()
7379 &sdata->u.mgd.neg_ttlm_timeout_work); in ieee80211_req_neg_ttlm()
7380 wiphy_delayed_work_queue(sdata->local->hw.wiphy, in ieee80211_req_neg_ttlm()
7381 &sdata->u.mgd.neg_ttlm_timeout_work, in ieee80211_req_neg_ttlm()
7392 struct ieee80211_local *local = sdata->local; in ieee80211_send_neg_ttlm_res()
7399 skb = dev_alloc_skb(local->tx_headroom + hdr_len + ttlm_max_len); in ieee80211_send_neg_ttlm_res()
7403 skb_reserve(skb, local->tx_headroom); in ieee80211_send_neg_ttlm_res()
7405 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | in ieee80211_send_neg_ttlm_res()
7407 memcpy(mgmt->da, sdata->vif.cfg.ap_addr, ETH_ALEN); in ieee80211_send_neg_ttlm_res()
7408 memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); in ieee80211_send_neg_ttlm_res()
7409 memcpy(mgmt->bssid, sdata->vif.cfg.ap_addr, ETH_ALEN); in ieee80211_send_neg_ttlm_res()
7411 mgmt->u.action.category = WLAN_CATEGORY_PROTECTED_EHT; in ieee80211_send_neg_ttlm_res()
7412 mgmt->u.action.u.ttlm_res.action_code = in ieee80211_send_neg_ttlm_res()
7414 mgmt->u.action.u.ttlm_res.dialog_token = dialog_token; in ieee80211_send_neg_ttlm_res()
7420 mgmt->u.action.u.ttlm_res.status_code = in ieee80211_send_neg_ttlm_res()
7424 mgmt->u.action.u.ttlm_res.status_code = WLAN_STATUS_SUCCESS; in ieee80211_send_neg_ttlm_res()
7427 mgmt->u.action.u.ttlm_res.status_code = in ieee80211_send_neg_ttlm_res()
7448 pos = (void *)ttlm->optional; in ieee80211_parse_neg_ttlm()
7450 control = ttlm->control; in ieee80211_parse_neg_ttlm()
7459 return -EINVAL; in ieee80211_parse_neg_ttlm()
7464 neg_ttlm->downlink[tid] = sdata->vif.valid_links; in ieee80211_parse_neg_ttlm()
7465 neg_ttlm->uplink[tid] = sdata->vif.valid_links; in ieee80211_parse_neg_ttlm()
7475 return -EINVAL; in ieee80211_parse_neg_ttlm()
7493 return -EINVAL; in ieee80211_parse_neg_ttlm()
7501 neg_ttlm->downlink[tid] = map; in ieee80211_parse_neg_ttlm()
7502 neg_ttlm->uplink[tid] = map; in ieee80211_parse_neg_ttlm()
7505 neg_ttlm->downlink[tid] = map; in ieee80211_parse_neg_ttlm()
7508 neg_ttlm->uplink[tid] = map; in ieee80211_parse_neg_ttlm()
7511 return -EINVAL; in ieee80211_parse_neg_ttlm()
7527 BUILD_BUG_ON(ARRAY_SIZE(direction) != ARRAY_SIZE(elems->ttlm)); in ieee80211_process_neg_ttlm_req()
7529 if (!ieee80211_vif_is_mld(&sdata->vif)) in ieee80211_process_neg_ttlm_req()
7532 dialog_token = mgmt->u.action.u.ttlm_req.dialog_token; in ieee80211_process_neg_ttlm_req()
7533 ies_len = len - offsetof(struct ieee80211_mgmt, in ieee80211_process_neg_ttlm_req()
7535 elems = ieee802_11_parse_elems(mgmt->u.action.u.ttlm_req.variable, in ieee80211_process_neg_ttlm_req()
7542 for (i = 0; i < elems->ttlm_num; i++) { in ieee80211_process_neg_ttlm_req()
7543 if (ieee80211_parse_neg_ttlm(sdata, elems->ttlm[i], in ieee80211_process_neg_ttlm_req()
7546 elems->ttlm_num != 1)) { in ieee80211_process_neg_ttlm_req()
7552 if (!elems->ttlm_num || in ieee80211_process_neg_ttlm_req()
7553 (elems->ttlm_num == 2 && direction[0] == direction[1])) { in ieee80211_process_neg_ttlm_req()
7560 (neg_ttlm.downlink[i] & ~sdata->vif.valid_links)) || in ieee80211_process_neg_ttlm_req()
7562 (neg_ttlm.uplink[i] & ~sdata->vif.valid_links))) { in ieee80211_process_neg_ttlm_req()
7568 ttlm_res = drv_can_neg_ttlm(sdata->local, sdata, &neg_ttlm); in ieee80211_process_neg_ttlm_req()
7582 if (!ieee80211_vif_is_mld(&sdata->vif) || in ieee80211_process_neg_ttlm_res()
7583 mgmt->u.action.u.ttlm_req.dialog_token != in ieee80211_process_neg_ttlm_res()
7584 sdata->u.mgd.dialog_token_alloc) in ieee80211_process_neg_ttlm_res()
7587 wiphy_delayed_work_cancel(sdata->local->hw.wiphy, in ieee80211_process_neg_ttlm_res()
7588 &sdata->u.mgd.neg_ttlm_timeout_work); in ieee80211_process_neg_ttlm_res()
7598 if (mgmt->u.action.u.ttlm_res.status_code != WLAN_STATUS_SUCCESS) in ieee80211_process_neg_ttlm_res()
7610 if (!sdata->vif.neg_ttlm.valid) in ieee80211_teardown_ttlm_work()
7613 memset(&sdata->vif.neg_ttlm, 0, sizeof(sdata->vif.neg_ttlm)); in ieee80211_teardown_ttlm_work()
7615 sdata->vif.dormant_links & ~sdata->vif.suspended_links; in ieee80211_teardown_ttlm_work()
7616 sdata->vif.suspended_links = 0; in ieee80211_teardown_ttlm_work()
7617 ieee80211_vif_set_links(sdata, sdata->vif.valid_links, in ieee80211_teardown_ttlm_work()
7626 struct ieee80211_local *local = sdata->local; in ieee80211_send_teardown_neg_ttlm()
7633 skb = dev_alloc_skb(local->hw.extra_tx_headroom + frame_len); in ieee80211_send_teardown_neg_ttlm()
7637 skb_reserve(skb, local->hw.extra_tx_headroom); in ieee80211_send_teardown_neg_ttlm()
7639 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | in ieee80211_send_teardown_neg_ttlm()
7641 memcpy(mgmt->da, sdata->vif.cfg.ap_addr, ETH_ALEN); in ieee80211_send_teardown_neg_ttlm()
7642 memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); in ieee80211_send_teardown_neg_ttlm()
7643 memcpy(mgmt->bssid, sdata->vif.cfg.ap_addr, ETH_ALEN); in ieee80211_send_teardown_neg_ttlm()
7645 mgmt->u.action.category = WLAN_CATEGORY_PROTECTED_EHT; in ieee80211_send_teardown_neg_ttlm()
7646 mgmt->u.action.u.ttlm_tear_down.action_code = in ieee80211_send_teardown_neg_ttlm()
7650 info->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS; in ieee80211_send_teardown_neg_ttlm()
7651 info->status_data = IEEE80211_STATUS_TYPE_NEG_TTLM; in ieee80211_send_teardown_neg_ttlm()
7659 struct ieee80211_link_data *link = &sdata->deflink; in ieee80211_sta_rx_queued_ext()
7664 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_sta_rx_queued_ext()
7666 rx_status = (struct ieee80211_rx_status *) skb->cb; in ieee80211_sta_rx_queued_ext()
7667 hdr = (struct ieee80211_hdr *) skb->data; in ieee80211_sta_rx_queued_ext()
7668 fc = le16_to_cpu(hdr->frame_control); in ieee80211_sta_rx_queued_ext()
7672 ieee80211_rx_mgmt_beacon(link, hdr, skb->len, rx_status); in ieee80211_sta_rx_queued_ext()
7680 struct ieee80211_link_data *link = &sdata->deflink; in ieee80211_sta_rx_queued_mgmt()
7687 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_sta_rx_queued_mgmt()
7689 rx_status = (struct ieee80211_rx_status *) skb->cb; in ieee80211_sta_rx_queued_mgmt()
7690 mgmt = (struct ieee80211_mgmt *) skb->data; in ieee80211_sta_rx_queued_mgmt()
7691 fc = le16_to_cpu(mgmt->frame_control); in ieee80211_sta_rx_queued_mgmt()
7693 if (rx_status->link_valid) { in ieee80211_sta_rx_queued_mgmt()
7694 link = sdata_dereference(sdata->link[rx_status->link_id], in ieee80211_sta_rx_queued_mgmt()
7703 skb->len, rx_status); in ieee80211_sta_rx_queued_mgmt()
7709 ieee80211_rx_mgmt_auth(sdata, mgmt, skb->len); in ieee80211_sta_rx_queued_mgmt()
7712 ieee80211_rx_mgmt_deauth(sdata, mgmt, skb->len); in ieee80211_sta_rx_queued_mgmt()
7715 ieee80211_rx_mgmt_disassoc(sdata, mgmt, skb->len); in ieee80211_sta_rx_queued_mgmt()
7719 ieee80211_rx_mgmt_assoc_resp(sdata, mgmt, skb->len); in ieee80211_sta_rx_queued_mgmt()
7722 if (!sdata->u.mgd.associated || in ieee80211_sta_rx_queued_mgmt()
7723 !ether_addr_equal(mgmt->bssid, sdata->vif.cfg.ap_addr)) in ieee80211_sta_rx_queued_mgmt()
7726 switch (mgmt->u.action.category) { in ieee80211_sta_rx_queued_mgmt()
7728 ies_len = skb->len - in ieee80211_sta_rx_queued_mgmt()
7737 mgmt->u.action.u.chan_switch.variable, in ieee80211_sta_rx_queued_mgmt()
7740 if (elems && !elems->parse_error) { in ieee80211_sta_rx_queued_mgmt()
7745 rx_status->mactime, in ieee80211_sta_rx_queued_mgmt()
7746 rx_status->device_timestamp, in ieee80211_sta_rx_queued_mgmt()
7754 ies_len = skb->len - in ieee80211_sta_rx_queued_mgmt()
7766 mgmt->u.action.u.ext_chan_switch.variable, in ieee80211_sta_rx_queued_mgmt()
7769 if (elems && !elems->parse_error) { in ieee80211_sta_rx_queued_mgmt()
7772 if (mgmt->u.action.category == in ieee80211_sta_rx_queued_mgmt()
7779 elems->ext_chansw_ie = in ieee80211_sta_rx_queued_mgmt()
7780 &mgmt->u.action.u.ext_chan_switch.data; in ieee80211_sta_rx_queued_mgmt()
7783 rx_status->mactime, in ieee80211_sta_rx_queued_mgmt()
7784 rx_status->device_timestamp, in ieee80211_sta_rx_queued_mgmt()
7801 wiphy_work_queue(sdata->local->hw.wiphy, &sdata->work); in ieee80211_sta_timer()
7818 struct ieee80211_local *local = sdata->local; in ieee80211_auth()
7819 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_auth()
7820 struct ieee80211_mgd_auth_data *auth_data = ifmgd->auth_data; in ieee80211_auth()
7828 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_auth()
7831 return -EINVAL; in ieee80211_auth()
7833 auth_data->tries++; in ieee80211_auth()
7835 if (auth_data->tries > IEEE80211_AUTH_MAX_TRIES) { in ieee80211_auth()
7837 auth_data->ap_addr); in ieee80211_auth()
7843 cfg80211_unlink_bss(local->hw.wiphy, auth_data->bss); in ieee80211_auth()
7845 return -ETIMEDOUT; in ieee80211_auth()
7848 if (auth_data->algorithm == WLAN_AUTH_SAE) in ieee80211_auth()
7851 info.link_id = auth_data->link_id; in ieee80211_auth()
7855 auth_data->ap_addr, auth_data->tries, in ieee80211_auth()
7858 auth_data->expected_transaction = 2; in ieee80211_auth()
7860 if (auth_data->algorithm == WLAN_AUTH_SAE) { in ieee80211_auth()
7861 trans = auth_data->sae_trans; in ieee80211_auth()
7862 status = auth_data->sae_status; in ieee80211_auth()
7863 auth_data->expected_transaction = trans; in ieee80211_auth()
7866 if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) in ieee80211_auth()
7870 ieee80211_send_auth(sdata, trans, auth_data->algorithm, status, in ieee80211_auth()
7871 auth_data->data, auth_data->data_len, in ieee80211_auth()
7872 auth_data->ap_addr, auth_data->ap_addr, in ieee80211_auth()
7876 if (auth_data->algorithm == WLAN_AUTH_SAE) in ieee80211_auth()
7877 auth_data->timeout = jiffies + in ieee80211_auth()
7880 auth_data->timeout = jiffies + IEEE80211_AUTH_TIMEOUT; in ieee80211_auth()
7882 auth_data->timeout = in ieee80211_auth()
7886 auth_data->timeout_started = true; in ieee80211_auth()
7887 run_again(sdata, auth_data->timeout); in ieee80211_auth()
7894 struct ieee80211_mgd_assoc_data *assoc_data = sdata->u.mgd.assoc_data; in ieee80211_do_assoc()
7895 struct ieee80211_local *local = sdata->local; in ieee80211_do_assoc()
7898 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_do_assoc()
7900 assoc_data->tries++; in ieee80211_do_assoc()
7901 assoc_data->comeback = false; in ieee80211_do_assoc()
7902 if (assoc_data->tries > IEEE80211_ASSOC_MAX_TRIES) { in ieee80211_do_assoc()
7904 assoc_data->ap_addr); in ieee80211_do_assoc()
7910 cfg80211_unlink_bss(local->hw.wiphy, in ieee80211_do_assoc()
7911 assoc_data->link[assoc_data->assoc_link_id].bss); in ieee80211_do_assoc()
7913 return -ETIMEDOUT; in ieee80211_do_assoc()
7917 assoc_data->ap_addr, assoc_data->tries, in ieee80211_do_assoc()
7923 if (!ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) { in ieee80211_do_assoc()
7924 assoc_data->timeout = jiffies + IEEE80211_ASSOC_TIMEOUT; in ieee80211_do_assoc()
7925 assoc_data->timeout_started = true; in ieee80211_do_assoc()
7926 run_again(sdata, assoc_data->timeout); in ieee80211_do_assoc()
7928 assoc_data->timeout = in ieee80211_do_assoc()
7931 assoc_data->timeout_started = true; in ieee80211_do_assoc()
7932 run_again(sdata, assoc_data->timeout); in ieee80211_do_assoc()
7941 struct ieee80211_local *local = sdata->local; in ieee80211_mgd_conn_tx_status()
7943 sdata->u.mgd.status_fc = fc; in ieee80211_mgd_conn_tx_status()
7944 sdata->u.mgd.status_acked = acked; in ieee80211_mgd_conn_tx_status()
7945 sdata->u.mgd.status_received = true; in ieee80211_mgd_conn_tx_status()
7947 wiphy_work_queue(local->hw.wiphy, &sdata->work); in ieee80211_mgd_conn_tx_status()
7952 struct ieee80211_local *local = sdata->local; in ieee80211_sta_work()
7953 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_sta_work()
7955 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_sta_work()
7957 if (ifmgd->status_received) { in ieee80211_sta_work()
7958 __le16 fc = ifmgd->status_fc; in ieee80211_sta_work()
7959 bool status_acked = ifmgd->status_acked; in ieee80211_sta_work()
7961 ifmgd->status_received = false; in ieee80211_sta_work()
7962 if (ifmgd->auth_data && ieee80211_is_auth(fc)) { in ieee80211_sta_work()
7964 if (ifmgd->auth_data->algorithm == in ieee80211_sta_work()
7966 ifmgd->auth_data->timeout = in ieee80211_sta_work()
7970 ifmgd->auth_data->timeout = in ieee80211_sta_work()
7973 run_again(sdata, ifmgd->auth_data->timeout); in ieee80211_sta_work()
7975 ifmgd->auth_data->timeout = jiffies - 1; in ieee80211_sta_work()
7977 ifmgd->auth_data->timeout_started = true; in ieee80211_sta_work()
7978 } else if (ifmgd->assoc_data && in ieee80211_sta_work()
7979 !ifmgd->assoc_data->comeback && in ieee80211_sta_work()
7992 ifmgd->assoc_data->timeout = in ieee80211_sta_work()
7994 run_again(sdata, ifmgd->assoc_data->timeout); in ieee80211_sta_work()
7996 ifmgd->assoc_data->timeout = jiffies - 1; in ieee80211_sta_work()
7998 ifmgd->assoc_data->timeout_started = true; in ieee80211_sta_work()
8002 if (ifmgd->auth_data && ifmgd->auth_data->timeout_started && in ieee80211_sta_work()
8003 time_after(jiffies, ifmgd->auth_data->timeout)) { in ieee80211_sta_work()
8004 if (ifmgd->auth_data->done || ifmgd->auth_data->waiting) { in ieee80211_sta_work()
8018 memcpy(ap_addr, ifmgd->auth_data->ap_addr, ETH_ALEN); in ieee80211_sta_work()
8022 cfg80211_auth_timeout(sdata->dev, ap_addr); in ieee80211_sta_work()
8023 drv_event_callback(sdata->local, sdata, &event); in ieee80211_sta_work()
8025 } else if (ifmgd->auth_data && ifmgd->auth_data->timeout_started) in ieee80211_sta_work()
8026 run_again(sdata, ifmgd->auth_data->timeout); in ieee80211_sta_work()
8028 if (ifmgd->assoc_data && ifmgd->assoc_data->timeout_started && in ieee80211_sta_work()
8029 time_after(jiffies, ifmgd->assoc_data->timeout)) { in ieee80211_sta_work()
8030 if ((ifmgd->assoc_data->need_beacon && in ieee80211_sta_work()
8031 !sdata->deflink.u.mgd.have_beacon) || in ieee80211_sta_work()
8040 drv_event_callback(sdata->local, sdata, &event); in ieee80211_sta_work()
8042 } else if (ifmgd->assoc_data && ifmgd->assoc_data->timeout_started) in ieee80211_sta_work()
8043 run_again(sdata, ifmgd->assoc_data->timeout); in ieee80211_sta_work()
8045 if (ifmgd->flags & IEEE80211_STA_CONNECTION_POLL && in ieee80211_sta_work()
8046 ifmgd->associated) { in ieee80211_sta_work()
8047 u8 *bssid = sdata->deflink.u.mgd.bssid; in ieee80211_sta_work()
8050 if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) in ieee80211_sta_work()
8056 if (!ifmgd->probe_send_count) in ieee80211_sta_work()
8058 else if (ifmgd->nullfunc_failed) { in ieee80211_sta_work()
8059 if (ifmgd->probe_send_count < max_tries) { in ieee80211_sta_work()
8062 bssid, ifmgd->probe_send_count, in ieee80211_sta_work()
8073 } else if (time_is_after_jiffies(ifmgd->probe_timeout)) in ieee80211_sta_work()
8074 run_again(sdata, ifmgd->probe_timeout); in ieee80211_sta_work()
8075 else if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) { in ieee80211_sta_work()
8081 } else if (ifmgd->probe_send_count < max_tries) { in ieee80211_sta_work()
8085 ifmgd->probe_send_count, max_tries); in ieee80211_sta_work()
8107 if (WARN_ON(ieee80211_vif_is_mld(&sdata->vif))) in ieee80211_sta_bcn_mon_timer()
8110 if (sdata->vif.bss_conf.csa_active && in ieee80211_sta_bcn_mon_timer()
8111 !sdata->deflink.u.mgd.csa.waiting_bcn) in ieee80211_sta_bcn_mon_timer()
8114 if (sdata->vif.driver_flags & IEEE80211_VIF_BEACON_FILTER) in ieee80211_sta_bcn_mon_timer()
8117 sdata->u.mgd.connection_loss = false; in ieee80211_sta_bcn_mon_timer()
8118 wiphy_work_queue(sdata->local->hw.wiphy, in ieee80211_sta_bcn_mon_timer()
8119 &sdata->u.mgd.beacon_connection_loss_work); in ieee80211_sta_bcn_mon_timer()
8126 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_sta_conn_mon_timer()
8127 struct ieee80211_local *local = sdata->local; in ieee80211_sta_conn_mon_timer()
8131 if (WARN_ON(ieee80211_vif_is_mld(&sdata->vif))) in ieee80211_sta_conn_mon_timer()
8134 if (sdata->vif.bss_conf.csa_active && in ieee80211_sta_conn_mon_timer()
8135 !sdata->deflink.u.mgd.csa.waiting_bcn) in ieee80211_sta_conn_mon_timer()
8138 sta = sta_info_get(sdata, sdata->vif.cfg.ap_addr); in ieee80211_sta_conn_mon_timer()
8142 timeout = sta->deflink.status_stats.last_ack; in ieee80211_sta_conn_mon_timer()
8143 if (time_before(sta->deflink.status_stats.last_ack, sta->deflink.rx_stats.last_rx)) in ieee80211_sta_conn_mon_timer()
8144 timeout = sta->deflink.rx_stats.last_rx; in ieee80211_sta_conn_mon_timer()
8151 mod_timer(&ifmgd->conn_mon_timer, round_jiffies_up(timeout)); in ieee80211_sta_conn_mon_timer()
8155 wiphy_work_queue(local->hw.wiphy, &sdata->u.mgd.monitor_work); in ieee80211_sta_conn_mon_timer()
8170 if (sdata->vif.type == NL80211_IFTYPE_STATION) { in ieee80211_restart_sta_timer()
8174 if (!ieee80211_hw_check(&sdata->local->hw, CONNECTION_MONITOR)) in ieee80211_restart_sta_timer()
8175 wiphy_work_queue(sdata->local->hw.wiphy, in ieee80211_restart_sta_timer()
8176 &sdata->u.mgd.monitor_work); in ieee80211_restart_sta_timer()
8183 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_mgd_quiesce()
8186 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_mgd_quiesce()
8188 if (ifmgd->auth_data || ifmgd->assoc_data) { in ieee80211_mgd_quiesce()
8189 const u8 *ap_addr = ifmgd->auth_data ? in ieee80211_mgd_quiesce()
8190 ifmgd->auth_data->ap_addr : in ieee80211_mgd_quiesce()
8191 ifmgd->assoc_data->ap_addr; in ieee80211_mgd_quiesce()
8202 if (ifmgd->assoc_data) in ieee80211_mgd_quiesce()
8204 if (ifmgd->auth_data) in ieee80211_mgd_quiesce()
8206 cfg80211_tx_mlme_mgmt(sdata->dev, frame_buf, in ieee80211_mgd_quiesce()
8211 /* This is a bit of a hack - we should find a better and more generic in ieee80211_mgd_quiesce()
8228 if (ifmgd->associated && !sdata->local->wowlan) { in ieee80211_mgd_quiesce()
8235 memcpy(bssid, sdata->vif.cfg.ap_addr, ETH_ALEN); in ieee80211_mgd_quiesce()
8243 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_sta_restart()
8245 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_sta_restart()
8247 if (!ifmgd->associated) in ieee80211_sta_restart()
8250 if (sdata->flags & IEEE80211_SDATA_DISCONNECT_RESUME) { in ieee80211_sta_restart()
8251 sdata->flags &= ~IEEE80211_SDATA_DISCONNECT_RESUME; in ieee80211_sta_restart()
8259 if (sdata->flags & IEEE80211_SDATA_DISCONNECT_HW_RESTART) { in ieee80211_sta_restart()
8260 sdata->flags &= ~IEEE80211_SDATA_DISCONNECT_HW_RESTART; in ieee80211_sta_restart()
8276 __ieee80211_request_smps_mgd(link->sdata, link, in ieee80211_request_smps_mgd_work()
8277 link->u.mgd.driver_smps_mode); in ieee80211_request_smps_mgd_work()
8287 if (!sdata->u.mgd.reconf.added_links && in ieee80211_ml_sta_reconf_timeout()
8288 !sdata->u.mgd.reconf.removed_links) in ieee80211_ml_sta_reconf_timeout()
8293 sdata->u.mgd.reconf.added_links, in ieee80211_ml_sta_reconf_timeout()
8294 sdata->u.mgd.reconf.removed_links); in ieee80211_ml_sta_reconf_timeout()
8302 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_sta_setup_sdata()
8304 wiphy_work_init(&ifmgd->monitor_work, ieee80211_sta_monitor_work); in ieee80211_sta_setup_sdata()
8305 wiphy_work_init(&ifmgd->beacon_connection_loss_work, in ieee80211_sta_setup_sdata()
8307 wiphy_work_init(&ifmgd->csa_connection_drop_work, in ieee80211_sta_setup_sdata()
8309 wiphy_delayed_work_init(&ifmgd->tdls_peer_del_work, in ieee80211_sta_setup_sdata()
8311 wiphy_delayed_work_init(&ifmgd->ml_reconf_work, in ieee80211_sta_setup_sdata()
8313 wiphy_delayed_work_init(&ifmgd->reconf.wk, in ieee80211_sta_setup_sdata()
8315 timer_setup(&ifmgd->timer, ieee80211_sta_timer, 0); in ieee80211_sta_setup_sdata()
8316 timer_setup(&ifmgd->bcn_mon_timer, ieee80211_sta_bcn_mon_timer, 0); in ieee80211_sta_setup_sdata()
8317 timer_setup(&ifmgd->conn_mon_timer, ieee80211_sta_conn_mon_timer, 0); in ieee80211_sta_setup_sdata()
8318 wiphy_delayed_work_init(&ifmgd->tx_tspec_wk, in ieee80211_sta_setup_sdata()
8320 wiphy_delayed_work_init(&ifmgd->ttlm_work, in ieee80211_sta_setup_sdata()
8322 wiphy_delayed_work_init(&ifmgd->neg_ttlm_timeout_work, in ieee80211_sta_setup_sdata()
8324 wiphy_work_init(&ifmgd->teardown_ttlm_work, in ieee80211_sta_setup_sdata()
8327 ifmgd->flags = 0; in ieee80211_sta_setup_sdata()
8328 ifmgd->powersave = sdata->wdev.ps; in ieee80211_sta_setup_sdata()
8329 ifmgd->uapsd_queues = sdata->local->hw.uapsd_queues; in ieee80211_sta_setup_sdata()
8330 ifmgd->uapsd_max_sp_len = sdata->local->hw.uapsd_max_sp_len; in ieee80211_sta_setup_sdata()
8332 spin_lock_init(&ifmgd->teardown_lock); in ieee80211_sta_setup_sdata()
8333 ifmgd->teardown_skb = NULL; in ieee80211_sta_setup_sdata()
8334 ifmgd->orig_teardown_skb = NULL; in ieee80211_sta_setup_sdata()
8335 ifmgd->mcast_seq_last = IEEE80211_SN_MODULO; in ieee80211_sta_setup_sdata()
8345 ieee80211_recalc_smps(link->sdata, link); in ieee80211_recalc_smps_work()
8350 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_mgd_setup_link()
8351 struct ieee80211_local *local = sdata->local; in ieee80211_mgd_setup_link()
8352 unsigned int link_id = link->link_id; in ieee80211_mgd_setup_link()
8354 link->u.mgd.p2p_noa_index = -1; in ieee80211_mgd_setup_link()
8355 link->conf->bssid = link->u.mgd.bssid; in ieee80211_mgd_setup_link()
8356 link->smps_mode = IEEE80211_SMPS_OFF; in ieee80211_mgd_setup_link()
8358 wiphy_work_init(&link->u.mgd.request_smps_work, in ieee80211_mgd_setup_link()
8360 wiphy_work_init(&link->u.mgd.recalc_smps, in ieee80211_mgd_setup_link()
8362 if (local->hw.wiphy->features & NL80211_FEATURE_DYNAMIC_SMPS) in ieee80211_mgd_setup_link()
8363 link->u.mgd.req_smps = IEEE80211_SMPS_AUTOMATIC; in ieee80211_mgd_setup_link()
8365 link->u.mgd.req_smps = IEEE80211_SMPS_OFF; in ieee80211_mgd_setup_link()
8367 wiphy_delayed_work_init(&link->u.mgd.csa.switch_work, in ieee80211_mgd_setup_link()
8370 ieee80211_clear_tpe(&link->conf->tpe); in ieee80211_mgd_setup_link()
8372 if (sdata->u.mgd.assoc_data) in ieee80211_mgd_setup_link()
8373 ether_addr_copy(link->conf->addr, in ieee80211_mgd_setup_link()
8374 sdata->u.mgd.assoc_data->link[link_id].addr); in ieee80211_mgd_setup_link()
8375 else if (sdata->u.mgd.reconf.add_links_data) in ieee80211_mgd_setup_link()
8376 ether_addr_copy(link->conf->addr, in ieee80211_mgd_setup_link()
8377 sdata->u.mgd.reconf.add_links_data->link[link_id].addr); in ieee80211_mgd_setup_link()
8378 else if (!is_valid_ether_addr(link->conf->addr)) in ieee80211_mgd_setup_link()
8379 eth_random_addr(link->conf->addr); in ieee80211_mgd_setup_link()
8389 list_for_each_entry_rcu(sdata, &local->interfaces, list) { in ieee80211_mlme_notify_scan_completed()
8403 struct ieee80211_local *local = sdata->local; in ieee80211_prep_connection()
8404 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_prep_connection()
8405 struct ieee80211_bss *bss = (void *)cbss->priv; in ieee80211_prep_connection()
8415 return -EINVAL; in ieee80211_prep_connection()
8419 return -EINVAL; in ieee80211_prep_connection()
8420 ap_mld_addr = cbss->bssid; in ieee80211_prep_connection()
8429 link = sdata_dereference(sdata->link[link_id], sdata); in ieee80211_prep_connection()
8431 err = -ENOLINK; in ieee80211_prep_connection()
8435 if (WARN_ON(!ifmgd->auth_data && !ifmgd->assoc_data)) { in ieee80211_prep_connection()
8436 err = -EINVAL; in ieee80211_prep_connection()
8441 if (local->in_reconfig) { in ieee80211_prep_connection()
8442 err = -EBUSY; in ieee80211_prep_connection()
8455 link_id, cbss->bssid, in ieee80211_prep_connection()
8461 err = -ENOMEM; in ieee80211_prep_connection()
8465 new_sta->sta.mlo = mlo; in ieee80211_prep_connection()
8470 * new channel. We can't - completely race-free - change the basic in ieee80211_prep_connection()
8474 * call that from changing the channel - only for IDLE and perhaps in ieee80211_prep_connection()
8486 link_sta = rcu_dereference(new_sta->link[link_id]); in ieee80211_prep_connection()
8490 err = -EINVAL; in ieee80211_prep_connection()
8502 memcpy(link->u.mgd.bssid, cbss->bssid, ETH_ALEN); in ieee80211_prep_connection()
8505 link->conf->beacon_int = cbss->beacon_interval; in ieee80211_prep_connection()
8506 ies = rcu_dereference(cbss->beacon_ies); in ieee80211_prep_connection()
8508 link->conf->sync_tsf = ies->tsf; in ieee80211_prep_connection()
8509 link->conf->sync_device_ts = in ieee80211_prep_connection()
8510 bss->device_ts_beacon; in ieee80211_prep_connection()
8513 &link->conf->sync_dtim_count, in ieee80211_prep_connection()
8515 } else if (!ieee80211_hw_check(&sdata->local->hw, in ieee80211_prep_connection()
8517 ies = rcu_dereference(cbss->proberesp_ies); in ieee80211_prep_connection()
8518 /* must be non-NULL since beacon IEs were NULL */ in ieee80211_prep_connection()
8519 link->conf->sync_tsf = ies->tsf; in ieee80211_prep_connection()
8520 link->conf->sync_device_ts = in ieee80211_prep_connection()
8521 bss->device_ts_presp; in ieee80211_prep_connection()
8522 link->conf->sync_dtim_count = 0; in ieee80211_prep_connection()
8524 link->conf->sync_tsf = 0; in ieee80211_prep_connection()
8525 link->conf->sync_device_ts = 0; in ieee80211_prep_connection()
8526 link->conf->sync_dtim_count = 0; in ieee80211_prep_connection()
8538 link->u.mgd.conn = *conn; in ieee80211_prep_connection()
8539 err = ieee80211_prep_channel(sdata, link, link->link_id, cbss, in ieee80211_prep_connection()
8540 mlo, &link->u.mgd.conn, in ieee80211_prep_connection()
8548 *conn = link->u.mgd.conn; in ieee80211_prep_connection()
8573 WARN_ON_ONCE(!ether_addr_equal(link->u.mgd.bssid, cbss->bssid)); in ieee80211_prep_connection()
8576 if (local->scanning) in ieee80211_prep_connection()
8600 ies->data, ies->len); in ieee80211_mgd_csa_present()
8601 if (csa_elem && csa_elem->datalen == sizeof(*csa)) in ieee80211_mgd_csa_present()
8602 csa = (void *)csa_elem->data; in ieee80211_mgd_csa_present()
8605 ies->data, ies->len); in ieee80211_mgd_csa_present()
8606 if (ecsa_elem && ecsa_elem->datalen == sizeof(*ecsa)) in ieee80211_mgd_csa_present()
8607 ecsa = (void *)ecsa_elem->data; in ieee80211_mgd_csa_present()
8609 if (csa && csa->count == 0) in ieee80211_mgd_csa_present()
8611 if (csa && !csa->mode && csa->new_ch_num == cur_channel) in ieee80211_mgd_csa_present()
8614 if (ecsa && ecsa->count == 0) in ieee80211_mgd_csa_present()
8616 if (ecsa && !ecsa->mode && ecsa->new_ch_num == cur_channel) in ieee80211_mgd_csa_present()
8621 "Ignoring ECSA in probe response - was considered stuck!\n"); in ieee80211_mgd_csa_present()
8634 cur_channel = ieee80211_frequency_to_channel(bss->channel->center_freq); in ieee80211_mgd_csa_in_process()
8638 rcu_dereference(bss->beacon_ies), in ieee80211_mgd_csa_in_process()
8645 rcu_dereference(bss->proberesp_ies), in ieee80211_mgd_csa_in_process()
8646 cur_channel, bss->proberesp_ecsa_stuck)) { in ieee80211_mgd_csa_in_process()
8677 struct ieee80211_local *local = sdata->local; in ieee80211_mgd_auth()
8678 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_mgd_auth()
8688 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_mgd_auth()
8692 switch (req->auth_type) { in ieee80211_mgd_auth()
8698 return -EOPNOTSUPP; in ieee80211_mgd_auth()
8720 return -EOPNOTSUPP; in ieee80211_mgd_auth()
8723 if (ifmgd->assoc_data) in ieee80211_mgd_auth()
8724 return -EBUSY; in ieee80211_mgd_auth()
8726 if (ieee80211_mgd_csa_in_process(sdata, req->bss)) { in ieee80211_mgd_auth()
8728 return -EINVAL; in ieee80211_mgd_auth()
8731 auth_data = kzalloc(sizeof(*auth_data) + req->auth_data_len + in ieee80211_mgd_auth()
8732 req->ie_len, GFP_KERNEL); in ieee80211_mgd_auth()
8734 return -ENOMEM; in ieee80211_mgd_auth()
8736 memcpy(auth_data->ap_addr, in ieee80211_mgd_auth()
8737 req->ap_mld_addr ?: req->bss->bssid, in ieee80211_mgd_auth()
8739 auth_data->bss = req->bss; in ieee80211_mgd_auth()
8740 auth_data->link_id = req->link_id; in ieee80211_mgd_auth()
8742 if (req->auth_data_len >= 4) { in ieee80211_mgd_auth()
8743 if (req->auth_type == NL80211_AUTHTYPE_SAE) { in ieee80211_mgd_auth()
8744 __le16 *pos = (__le16 *) req->auth_data; in ieee80211_mgd_auth()
8746 auth_data->sae_trans = le16_to_cpu(pos[0]); in ieee80211_mgd_auth()
8747 auth_data->sae_status = le16_to_cpu(pos[1]); in ieee80211_mgd_auth()
8749 memcpy(auth_data->data, req->auth_data + 4, in ieee80211_mgd_auth()
8750 req->auth_data_len - 4); in ieee80211_mgd_auth()
8751 auth_data->data_len += req->auth_data_len - 4; in ieee80211_mgd_auth()
8756 * removal and re-addition of the STA entry in in ieee80211_mgd_auth()
8759 cont_auth = ifmgd->auth_data && req->bss == ifmgd->auth_data->bss && in ieee80211_mgd_auth()
8760 ifmgd->auth_data->link_id == req->link_id; in ieee80211_mgd_auth()
8762 if (req->ie && req->ie_len) { in ieee80211_mgd_auth()
8763 memcpy(&auth_data->data[auth_data->data_len], in ieee80211_mgd_auth()
8764 req->ie, req->ie_len); in ieee80211_mgd_auth()
8765 auth_data->data_len += req->ie_len; in ieee80211_mgd_auth()
8768 if (req->key && req->key_len) { in ieee80211_mgd_auth()
8769 auth_data->key_len = req->key_len; in ieee80211_mgd_auth()
8770 auth_data->key_idx = req->key_idx; in ieee80211_mgd_auth()
8771 memcpy(auth_data->key, req->key, req->key_len); in ieee80211_mgd_auth()
8774 ieee80211_parse_cfg_selectors(auth_data->userspace_selectors, in ieee80211_mgd_auth()
8775 req->supported_selectors, in ieee80211_mgd_auth()
8776 req->supported_selectors_len); in ieee80211_mgd_auth()
8778 auth_data->algorithm = auth_alg; in ieee80211_mgd_auth()
8782 if (ifmgd->auth_data) { in ieee80211_mgd_auth()
8783 if (cont_auth && req->auth_type == NL80211_AUTHTYPE_SAE) { in ieee80211_mgd_auth()
8784 auth_data->peer_confirmed = in ieee80211_mgd_auth()
8785 ifmgd->auth_data->peer_confirmed; in ieee80211_mgd_auth()
8791 ifmgd->auth_data = auth_data; in ieee80211_mgd_auth()
8798 if (cont_auth && req->auth_type == NL80211_AUTHTYPE_SAE && in ieee80211_mgd_auth()
8799 auth_data->peer_confirmed && auth_data->sae_trans == 2) in ieee80211_mgd_auth()
8802 if (ifmgd->associated) { in ieee80211_mgd_auth()
8807 sdata->vif.cfg.ap_addr, auth_data->ap_addr); in ieee80211_mgd_auth()
8819 memcpy(sdata->vif.cfg.ap_addr, auth_data->ap_addr, ETH_ALEN); in ieee80211_mgd_auth()
8821 bss = (void *)req->bss->priv; in ieee80211_mgd_auth()
8822 wmm_used = bss->wmm_used && (local->hw.queues >= IEEE80211_NUM_ACS); in ieee80211_mgd_auth()
8824 sband = local->hw.wiphy->bands[req->bss->channel->band]; in ieee80211_mgd_auth()
8829 err = ieee80211_prep_connection(sdata, req->bss, req->link_id, in ieee80211_mgd_auth()
8830 req->ap_mld_addr, cont_auth, in ieee80211_mgd_auth()
8832 auth_data->userspace_selectors); in ieee80211_mgd_auth()
8836 if (req->link_id >= 0) in ieee80211_mgd_auth()
8837 link = sdata_dereference(sdata->link[req->link_id], sdata); in ieee80211_mgd_auth()
8839 link = &sdata->deflink; in ieee80211_mgd_auth()
8842 err = -ENOLINK; in ieee80211_mgd_auth()
8847 auth_data->ap_addr, link->conf->addr); in ieee80211_mgd_auth()
8851 sta_info_destroy_addr(sdata, auth_data->ap_addr); in ieee80211_mgd_auth()
8856 cfg80211_ref_bss(local->hw.wiphy, auth_data->bss); in ieee80211_mgd_auth()
8860 if (!ieee80211_vif_is_mld(&sdata->vif)) { in ieee80211_mgd_auth()
8861 eth_zero_addr(sdata->deflink.u.mgd.bssid); in ieee80211_mgd_auth()
8862 ieee80211_link_info_change_notify(sdata, &sdata->deflink, in ieee80211_mgd_auth()
8864 ieee80211_link_release_channel(&sdata->deflink); in ieee80211_mgd_auth()
8866 ifmgd->auth_data = NULL; in ieee80211_mgd_auth()
8878 struct ieee80211_local *local = sdata->local; in ieee80211_setup_assoc_link()
8885 cbss = assoc_data->link[link_id].bss; in ieee80211_setup_assoc_link()
8889 bss = (void *)cbss->priv; in ieee80211_setup_assoc_link()
8891 sband = local->hw.wiphy->bands[cbss->channel->band]; in ieee80211_setup_assoc_link()
8895 link = sdata_dereference(sdata->link[link_id], sdata); in ieee80211_setup_assoc_link()
8900 if (!req->ap_mld_addr) { in ieee80211_setup_assoc_link()
8901 assoc_data->supp_rates = bss->supp_rates; in ieee80211_setup_assoc_link()
8902 assoc_data->supp_rates_len = bss->supp_rates_len; in ieee80211_setup_assoc_link()
8906 if (req->links[link_id].elems_len) { in ieee80211_setup_assoc_link()
8907 memcpy(assoc_data->ie_pos, req->links[link_id].elems, in ieee80211_setup_assoc_link()
8908 req->links[link_id].elems_len); in ieee80211_setup_assoc_link()
8909 assoc_data->link[link_id].elems = assoc_data->ie_pos; in ieee80211_setup_assoc_link()
8910 assoc_data->link[link_id].elems_len = req->links[link_id].elems_len; in ieee80211_setup_assoc_link()
8911 assoc_data->ie_pos += req->links[link_id].elems_len; in ieee80211_setup_assoc_link()
8914 link->u.mgd.beacon_crc_valid = false; in ieee80211_setup_assoc_link()
8915 link->u.mgd.dtim_period = 0; in ieee80211_setup_assoc_link()
8916 link->u.mgd.have_beacon = false; in ieee80211_setup_assoc_link()
8919 if (conn->mode >= IEEE80211_CONN_MODE_HT) { in ieee80211_setup_assoc_link()
8922 memcpy(&sta_ht_cap, &sband->ht_cap, sizeof(sta_ht_cap)); in ieee80211_setup_assoc_link()
8927 bss_ies = rcu_dereference(cbss->beacon_ies); in ieee80211_setup_assoc_link()
8932 &link->u.mgd.dtim_period); in ieee80211_setup_assoc_link()
8934 sdata->deflink.u.mgd.have_beacon = true; in ieee80211_setup_assoc_link()
8936 if (ieee80211_hw_check(&local->hw, TIMING_BEACON_ONLY)) { in ieee80211_setup_assoc_link()
8937 link->conf->sync_tsf = bss_ies->tsf; in ieee80211_setup_assoc_link()
8938 link->conf->sync_device_ts = bss->device_ts_beacon; in ieee80211_setup_assoc_link()
8939 link->conf->sync_dtim_count = dtim_count; in ieee80211_setup_assoc_link()
8942 bss_ies = rcu_dereference(cbss->ies); in ieee80211_setup_assoc_link()
8949 bss_ies->data, bss_ies->len); in ieee80211_setup_assoc_link()
8950 if (elem && elem->datalen >= 3) in ieee80211_setup_assoc_link()
8951 link->conf->profile_periodicity = elem->data[2]; in ieee80211_setup_assoc_link()
8953 link->conf->profile_periodicity = 0; in ieee80211_setup_assoc_link()
8956 bss_ies->data, bss_ies->len); in ieee80211_setup_assoc_link()
8957 if (elem && elem->datalen >= 11 && in ieee80211_setup_assoc_link()
8958 (elem->data[10] & WLAN_EXT_CAPA11_EMA_SUPPORT)) in ieee80211_setup_assoc_link()
8959 link->conf->ema_ap = true; in ieee80211_setup_assoc_link()
8961 link->conf->ema_ap = false; in ieee80211_setup_assoc_link()
8965 if (bss->corrupt_data) { in ieee80211_setup_assoc_link()
8968 if (bss->corrupt_data & IEEE80211_BSS_CORRUPT_BEACON) { in ieee80211_setup_assoc_link()
8969 if (bss->corrupt_data & IEEE80211_BSS_CORRUPT_PROBE_RESP) in ieee80211_setup_assoc_link()
8973 } else if (bss->corrupt_data & IEEE80211_BSS_CORRUPT_PROBE_RESP) { in ieee80211_setup_assoc_link()
8977 cbss->bssid, corrupt_type); in ieee80211_setup_assoc_link()
8980 if (link->u.mgd.req_smps == IEEE80211_SMPS_AUTOMATIC) { in ieee80211_setup_assoc_link()
8981 if (sdata->u.mgd.powersave) in ieee80211_setup_assoc_link()
8982 link->smps_mode = IEEE80211_SMPS_DYNAMIC; in ieee80211_setup_assoc_link()
8984 link->smps_mode = IEEE80211_SMPS_OFF; in ieee80211_setup_assoc_link()
8986 link->smps_mode = link->u.mgd.req_smps; in ieee80211_setup_assoc_link()
8995 struct cfg80211_bss *cbss = assoc_data->link[link_id].bss; in ieee80211_mgd_get_ap_ht_vht_capa()
8996 enum nl80211_band band = cbss->channel->band; in ieee80211_mgd_get_ap_ht_vht_capa()
9005 if (assoc_data->link[link_id].conn.mode < IEEE80211_CONN_MODE_HT) in ieee80211_mgd_get_ap_ht_vht_capa()
9010 if (!elem || elem->datalen < sizeof(struct ieee80211_ht_operation)) { in ieee80211_mgd_get_ap_ht_vht_capa()
9012 cbss->bssid); in ieee80211_mgd_get_ap_ht_vht_capa()
9013 err = -EINVAL; in ieee80211_mgd_get_ap_ht_vht_capa()
9016 assoc_data->link[link_id].ap_ht_param = in ieee80211_mgd_get_ap_ht_vht_capa()
9017 ((struct ieee80211_ht_operation *)(elem->data))->ht_param; in ieee80211_mgd_get_ap_ht_vht_capa()
9020 if (assoc_data->link[link_id].conn.mode < IEEE80211_CONN_MODE_VHT) in ieee80211_mgd_get_ap_ht_vht_capa()
9024 sband = sdata->local->hw.wiphy->bands[band]; in ieee80211_mgd_get_ap_ht_vht_capa()
9025 if (!sband->vht_cap.vht_supported) in ieee80211_mgd_get_ap_ht_vht_capa()
9035 if (!elem || elem->datalen < sizeof(struct ieee80211_vht_cap)) { in ieee80211_mgd_get_ap_ht_vht_capa()
9037 cbss->bssid); in ieee80211_mgd_get_ap_ht_vht_capa()
9038 err = -EINVAL; in ieee80211_mgd_get_ap_ht_vht_capa()
9041 memcpy(&assoc_data->link[link_id].ap_vht_cap, elem->data, in ieee80211_mgd_get_ap_ht_vht_capa()
9054 unsigned int assoc_link_id = req->link_id < 0 ? 0 : req->link_id; in ieee80211_mgd_assoc()
9055 struct ieee80211_local *local = sdata->local; in ieee80211_mgd_assoc()
9056 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_mgd_assoc()
9059 struct ieee80211_vif_cfg *vif_cfg = &sdata->vif.cfg; in ieee80211_mgd_assoc()
9065 size_t size = sizeof(*assoc_data) + req->ie_len; in ieee80211_mgd_assoc()
9068 size += req->links[i].elems_len; in ieee80211_mgd_assoc()
9070 /* FIXME: no support for 4-addr MLO yet */ in ieee80211_mgd_assoc()
9071 if (sdata->u.mgd.use_4addr && req->link_id >= 0) in ieee80211_mgd_assoc()
9072 return -EOPNOTSUPP; in ieee80211_mgd_assoc()
9076 return -ENOMEM; in ieee80211_mgd_assoc()
9078 cbss = req->link_id < 0 ? req->bss : req->links[req->link_id].bss; in ieee80211_mgd_assoc()
9082 err = -EINVAL; in ieee80211_mgd_assoc()
9088 if (!ssid_elem || ssid_elem->datalen > sizeof(assoc_data->ssid)) { in ieee80211_mgd_assoc()
9090 err = -EINVAL; in ieee80211_mgd_assoc()
9094 memcpy(assoc_data->ssid, ssid_elem->data, ssid_elem->datalen); in ieee80211_mgd_assoc()
9095 assoc_data->ssid_len = ssid_elem->datalen; in ieee80211_mgd_assoc()
9098 if (req->ap_mld_addr) in ieee80211_mgd_assoc()
9099 memcpy(assoc_data->ap_addr, req->ap_mld_addr, ETH_ALEN); in ieee80211_mgd_assoc()
9101 memcpy(assoc_data->ap_addr, cbss->bssid, ETH_ALEN); in ieee80211_mgd_assoc()
9103 if (ifmgd->associated) { in ieee80211_mgd_assoc()
9108 sdata->vif.cfg.ap_addr, assoc_data->ap_addr); in ieee80211_mgd_assoc()
9119 ieee80211_parse_cfg_selectors(assoc_data->userspace_selectors, in ieee80211_mgd_assoc()
9120 req->supported_selectors, in ieee80211_mgd_assoc()
9121 req->supported_selectors_len); in ieee80211_mgd_assoc()
9123 memcpy(&ifmgd->ht_capa, &req->ht_capa, sizeof(ifmgd->ht_capa)); in ieee80211_mgd_assoc()
9124 memcpy(&ifmgd->ht_capa_mask, &req->ht_capa_mask, in ieee80211_mgd_assoc()
9125 sizeof(ifmgd->ht_capa_mask)); in ieee80211_mgd_assoc()
9127 memcpy(&ifmgd->vht_capa, &req->vht_capa, sizeof(ifmgd->vht_capa)); in ieee80211_mgd_assoc()
9128 memcpy(&ifmgd->vht_capa_mask, &req->vht_capa_mask, in ieee80211_mgd_assoc()
9129 sizeof(ifmgd->vht_capa_mask)); in ieee80211_mgd_assoc()
9131 memcpy(&ifmgd->s1g_capa, &req->s1g_capa, sizeof(ifmgd->s1g_capa)); in ieee80211_mgd_assoc()
9132 memcpy(&ifmgd->s1g_capa_mask, &req->s1g_capa_mask, in ieee80211_mgd_assoc()
9133 sizeof(ifmgd->s1g_capa_mask)); in ieee80211_mgd_assoc()
9136 match_auth = ifmgd->auth_data && in ieee80211_mgd_assoc()
9137 ether_addr_equal(ifmgd->auth_data->ap_addr, in ieee80211_mgd_assoc()
9138 assoc_data->ap_addr) && in ieee80211_mgd_assoc()
9139 ifmgd->auth_data->link_id == req->link_id; in ieee80211_mgd_assoc()
9141 if (req->ap_mld_addr) { in ieee80211_mgd_assoc()
9144 if (req->flags & (ASSOC_REQ_DISABLE_HT | in ieee80211_mgd_assoc()
9148 err = -EINVAL; in ieee80211_mgd_assoc()
9154 struct cfg80211_bss *link_cbss = req->links[i].bss; in ieee80211_mgd_assoc()
9160 bss = (void *)link_cbss->priv; in ieee80211_mgd_assoc()
9162 if (!bss->wmm_used) { in ieee80211_mgd_assoc()
9163 err = -EINVAL; in ieee80211_mgd_assoc()
9164 req->links[i].error = err; in ieee80211_mgd_assoc()
9168 if (link_cbss->channel->band == NL80211_BAND_S1GHZ) { in ieee80211_mgd_assoc()
9169 err = -EINVAL; in ieee80211_mgd_assoc()
9170 req->links[i].error = err; in ieee80211_mgd_assoc()
9174 link = sdata_dereference(sdata->link[i], sdata); in ieee80211_mgd_assoc()
9176 ether_addr_copy(assoc_data->link[i].addr, in ieee80211_mgd_assoc()
9177 link->conf->addr); in ieee80211_mgd_assoc()
9179 eth_random_addr(assoc_data->link[i].addr); in ieee80211_mgd_assoc()
9180 sband = local->hw.wiphy->bands[link_cbss->channel->band]; in ieee80211_mgd_assoc()
9183 assoc_data->link[i].conn = link->u.mgd.conn; in ieee80211_mgd_assoc()
9185 assoc_data->link[i].conn = in ieee80211_mgd_assoc()
9189 &assoc_data->link[i].conn); in ieee80211_mgd_assoc()
9190 assoc_data->link[i].bss = link_cbss; in ieee80211_mgd_assoc()
9191 assoc_data->link[i].disabled = req->links[i].disabled; in ieee80211_mgd_assoc()
9193 if (!bss->uapsd_supported) in ieee80211_mgd_assoc()
9196 if (assoc_data->link[i].conn.mode < IEEE80211_CONN_MODE_EHT) { in ieee80211_mgd_assoc()
9197 err = -EINVAL; in ieee80211_mgd_assoc()
9198 req->links[i].error = err; in ieee80211_mgd_assoc()
9205 err = -EINVAL; in ieee80211_mgd_assoc()
9206 req->links[i].error = err; in ieee80211_mgd_assoc()
9211 assoc_data->wmm = true; in ieee80211_mgd_assoc()
9214 struct ieee80211_bss *bss = (void *)cbss->priv; in ieee80211_mgd_assoc()
9216 memcpy(assoc_data->link[0].addr, sdata->vif.addr, ETH_ALEN); in ieee80211_mgd_assoc()
9217 assoc_data->s1g = cbss->channel->band == NL80211_BAND_S1GHZ; in ieee80211_mgd_assoc()
9219 assoc_data->wmm = bss->wmm_used && in ieee80211_mgd_assoc()
9220 (local->hw.queues >= IEEE80211_NUM_ACS); in ieee80211_mgd_assoc()
9222 if (cbss->channel->band == NL80211_BAND_6GHZ && in ieee80211_mgd_assoc()
9223 req->flags & (ASSOC_REQ_DISABLE_HT | in ieee80211_mgd_assoc()
9226 err = -EINVAL; in ieee80211_mgd_assoc()
9230 sband = local->hw.wiphy->bands[cbss->channel->band]; in ieee80211_mgd_assoc()
9232 assoc_data->link[0].bss = cbss; in ieee80211_mgd_assoc()
9235 assoc_data->link[0].conn = sdata->deflink.u.mgd.conn; in ieee80211_mgd_assoc()
9237 assoc_data->link[0].conn = in ieee80211_mgd_assoc()
9240 assoc_data->wmm, 0, in ieee80211_mgd_assoc()
9241 &assoc_data->link[0].conn); in ieee80211_mgd_assoc()
9243 uapsd_supported = bss->uapsd_supported; in ieee80211_mgd_assoc()
9250 assoc_data->spp_amsdu = req->flags & ASSOC_REQ_SPP_AMSDU; in ieee80211_mgd_assoc()
9252 if (ifmgd->auth_data && !ifmgd->auth_data->done) { in ieee80211_mgd_assoc()
9253 err = -EBUSY; in ieee80211_mgd_assoc()
9257 if (ifmgd->assoc_data) { in ieee80211_mgd_assoc()
9258 err = -EBUSY; in ieee80211_mgd_assoc()
9263 if (ifmgd->auth_data && !match_auth) in ieee80211_mgd_assoc()
9266 if (req->ie && req->ie_len) { in ieee80211_mgd_assoc()
9267 memcpy(assoc_data->ie, req->ie, req->ie_len); in ieee80211_mgd_assoc()
9268 assoc_data->ie_len = req->ie_len; in ieee80211_mgd_assoc()
9269 assoc_data->ie_pos = assoc_data->ie + assoc_data->ie_len; in ieee80211_mgd_assoc()
9271 assoc_data->ie_pos = assoc_data->ie; in ieee80211_mgd_assoc()
9274 if (req->fils_kek) { in ieee80211_mgd_assoc()
9275 /* should already be checked in cfg80211 - so warn */ in ieee80211_mgd_assoc()
9276 if (WARN_ON(req->fils_kek_len > FILS_MAX_KEK_LEN)) { in ieee80211_mgd_assoc()
9277 err = -EINVAL; in ieee80211_mgd_assoc()
9280 memcpy(assoc_data->fils_kek, req->fils_kek, in ieee80211_mgd_assoc()
9281 req->fils_kek_len); in ieee80211_mgd_assoc()
9282 assoc_data->fils_kek_len = req->fils_kek_len; in ieee80211_mgd_assoc()
9285 if (req->fils_nonces) in ieee80211_mgd_assoc()
9286 memcpy(assoc_data->fils_nonces, req->fils_nonces, in ieee80211_mgd_assoc()
9290 assoc_data->timeout = jiffies; in ieee80211_mgd_assoc()
9291 assoc_data->timeout_started = true; in ieee80211_mgd_assoc()
9293 assoc_data->assoc_link_id = assoc_link_id; in ieee80211_mgd_assoc()
9295 if (req->ap_mld_addr) { in ieee80211_mgd_assoc()
9302 link = sdata_dereference(sdata->link[assoc_link_id], sdata); in ieee80211_mgd_assoc()
9304 err = -EINVAL; in ieee80211_mgd_assoc()
9308 override = link->u.mgd.conn.mode != in ieee80211_mgd_assoc()
9309 assoc_data->link[assoc_link_id].conn.mode || in ieee80211_mgd_assoc()
9310 link->u.mgd.conn.bw_limit != in ieee80211_mgd_assoc()
9311 assoc_data->link[assoc_link_id].conn.bw_limit; in ieee80211_mgd_assoc()
9312 link->u.mgd.conn = assoc_data->link[assoc_link_id].conn; in ieee80211_mgd_assoc()
9314 ieee80211_setup_assoc_link(sdata, assoc_data, req, &link->u.mgd.conn, in ieee80211_mgd_assoc()
9317 if (WARN((sdata->vif.driver_flags & IEEE80211_VIF_SUPPORTS_UAPSD) && in ieee80211_mgd_assoc()
9318 ieee80211_hw_check(&local->hw, PS_NULLFUNC_STACK), in ieee80211_mgd_assoc()
9319 "U-APSD not supported with HW_PS_NULLFUNC_STACK\n")) in ieee80211_mgd_assoc()
9320 sdata->vif.driver_flags &= ~IEEE80211_VIF_SUPPORTS_UAPSD; in ieee80211_mgd_assoc()
9322 if (assoc_data->wmm && uapsd_supported && in ieee80211_mgd_assoc()
9323 (sdata->vif.driver_flags & IEEE80211_VIF_SUPPORTS_UAPSD)) { in ieee80211_mgd_assoc()
9324 assoc_data->uapsd = true; in ieee80211_mgd_assoc()
9325 ifmgd->flags |= IEEE80211_STA_UAPSD_ENABLED; in ieee80211_mgd_assoc()
9327 assoc_data->uapsd = false; in ieee80211_mgd_assoc()
9328 ifmgd->flags &= ~IEEE80211_STA_UAPSD_ENABLED; in ieee80211_mgd_assoc()
9331 if (req->prev_bssid) in ieee80211_mgd_assoc()
9332 memcpy(assoc_data->prev_ap_addr, req->prev_bssid, ETH_ALEN); in ieee80211_mgd_assoc()
9334 if (req->use_mfp) { in ieee80211_mgd_assoc()
9335 ifmgd->mfp = IEEE80211_MFP_REQUIRED; in ieee80211_mgd_assoc()
9336 ifmgd->flags |= IEEE80211_STA_MFP_ENABLED; in ieee80211_mgd_assoc()
9338 ifmgd->mfp = IEEE80211_MFP_DISABLED; in ieee80211_mgd_assoc()
9339 ifmgd->flags &= ~IEEE80211_STA_MFP_ENABLED; in ieee80211_mgd_assoc()
9342 if (req->flags & ASSOC_REQ_USE_RRM) in ieee80211_mgd_assoc()
9343 ifmgd->flags |= IEEE80211_STA_ENABLE_RRM; in ieee80211_mgd_assoc()
9345 ifmgd->flags &= ~IEEE80211_STA_ENABLE_RRM; in ieee80211_mgd_assoc()
9347 if (req->crypto.control_port) in ieee80211_mgd_assoc()
9348 ifmgd->flags |= IEEE80211_STA_CONTROL_PORT; in ieee80211_mgd_assoc()
9350 ifmgd->flags &= ~IEEE80211_STA_CONTROL_PORT; in ieee80211_mgd_assoc()
9352 sdata->control_port_protocol = req->crypto.control_port_ethertype; in ieee80211_mgd_assoc()
9353 sdata->control_port_no_encrypt = req->crypto.control_port_no_encrypt; in ieee80211_mgd_assoc()
9354 sdata->control_port_over_nl80211 = in ieee80211_mgd_assoc()
9355 req->crypto.control_port_over_nl80211; in ieee80211_mgd_assoc()
9356 sdata->control_port_no_preauth = req->crypto.control_port_no_preauth; in ieee80211_mgd_assoc()
9359 ifmgd->assoc_data = assoc_data; in ieee80211_mgd_assoc()
9361 for (i = 0; i < ARRAY_SIZE(assoc_data->link); i++) { in ieee80211_mgd_assoc()
9362 if (!assoc_data->link[i].bss) in ieee80211_mgd_assoc()
9364 if (i == assoc_data->assoc_link_id) in ieee80211_mgd_assoc()
9368 assoc_data->link[i].bss, true, in ieee80211_mgd_assoc()
9369 &assoc_data->link[i].conn, in ieee80211_mgd_assoc()
9370 assoc_data->userspace_selectors); in ieee80211_mgd_assoc()
9372 req->links[i].error = err; in ieee80211_mgd_assoc()
9377 memcpy(vif_cfg->ssid, assoc_data->ssid, assoc_data->ssid_len); in ieee80211_mgd_assoc()
9378 vif_cfg->ssid_len = assoc_data->ssid_len; in ieee80211_mgd_assoc()
9381 memcpy(sdata->vif.cfg.ap_addr, assoc_data->ap_addr, ETH_ALEN); in ieee80211_mgd_assoc()
9383 err = ieee80211_prep_connection(sdata, cbss, req->link_id, in ieee80211_mgd_assoc()
9384 req->ap_mld_addr, true, in ieee80211_mgd_assoc()
9385 &assoc_data->link[assoc_link_id].conn, in ieee80211_mgd_assoc()
9387 assoc_data->userspace_selectors); in ieee80211_mgd_assoc()
9391 if (ieee80211_hw_check(&sdata->local->hw, NEED_DTIM_BEFORE_ASSOC)) { in ieee80211_mgd_assoc()
9395 beacon_ies = rcu_dereference(req->bss->beacon_ies); in ieee80211_mgd_assoc()
9402 link->u.mgd.bssid); in ieee80211_mgd_assoc()
9403 assoc_data->timeout = TU_TO_EXP_TIME(req->bss->beacon_interval); in ieee80211_mgd_assoc()
9404 assoc_data->timeout_started = true; in ieee80211_mgd_assoc()
9405 assoc_data->need_beacon = true; in ieee80211_mgd_assoc()
9410 run_again(sdata, assoc_data->timeout); in ieee80211_mgd_assoc()
9413 if (ifmgd->auth_data) in ieee80211_mgd_assoc()
9418 if (!ifmgd->auth_data) { in ieee80211_mgd_assoc()
9419 eth_zero_addr(sdata->deflink.u.mgd.bssid); in ieee80211_mgd_assoc()
9420 ieee80211_link_info_change_notify(sdata, &sdata->deflink, in ieee80211_mgd_assoc()
9423 ifmgd->assoc_data = NULL; in ieee80211_mgd_assoc()
9432 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_mgd_deauth()
9434 bool tx = !req->local_state_change; in ieee80211_mgd_deauth()
9439 if (ifmgd->auth_data && in ieee80211_mgd_deauth()
9440 ether_addr_equal(ifmgd->auth_data->ap_addr, req->bssid)) { in ieee80211_mgd_deauth()
9443 req->bssid, req->reason_code, in ieee80211_mgd_deauth()
9444 ieee80211_get_reason_code_string(req->reason_code)); in ieee80211_mgd_deauth()
9446 info.link_id = ifmgd->auth_data->link_id; in ieee80211_mgd_deauth()
9447 drv_mgd_prepare_tx(sdata->local, sdata, &info); in ieee80211_mgd_deauth()
9448 ieee80211_send_deauth_disassoc(sdata, req->bssid, req->bssid, in ieee80211_mgd_deauth()
9450 req->reason_code, tx, in ieee80211_mgd_deauth()
9455 req->reason_code, false); in ieee80211_mgd_deauth()
9456 drv_mgd_complete_tx(sdata->local, sdata, &info); in ieee80211_mgd_deauth()
9460 if (ifmgd->assoc_data && in ieee80211_mgd_deauth()
9461 ether_addr_equal(ifmgd->assoc_data->ap_addr, req->bssid)) { in ieee80211_mgd_deauth()
9464 req->bssid, req->reason_code, in ieee80211_mgd_deauth()
9465 ieee80211_get_reason_code_string(req->reason_code)); in ieee80211_mgd_deauth()
9467 info.link_id = ifmgd->assoc_data->assoc_link_id; in ieee80211_mgd_deauth()
9468 drv_mgd_prepare_tx(sdata->local, sdata, &info); in ieee80211_mgd_deauth()
9469 ieee80211_send_deauth_disassoc(sdata, req->bssid, req->bssid, in ieee80211_mgd_deauth()
9471 req->reason_code, tx, in ieee80211_mgd_deauth()
9476 req->reason_code, false); in ieee80211_mgd_deauth()
9477 drv_mgd_complete_tx(sdata->local, sdata, &info); in ieee80211_mgd_deauth()
9481 if (ifmgd->associated && in ieee80211_mgd_deauth()
9482 ether_addr_equal(sdata->vif.cfg.ap_addr, req->bssid)) { in ieee80211_mgd_deauth()
9485 req->bssid, req->reason_code, in ieee80211_mgd_deauth()
9486 ieee80211_get_reason_code_string(req->reason_code)); in ieee80211_mgd_deauth()
9489 req->reason_code, tx, frame_buf); in ieee80211_mgd_deauth()
9492 req->reason_code, false); in ieee80211_mgd_deauth()
9493 drv_mgd_complete_tx(sdata->local, sdata, &info); in ieee80211_mgd_deauth()
9497 return -ENOTCONN; in ieee80211_mgd_deauth()
9505 if (!sdata->u.mgd.associated || in ieee80211_mgd_disassoc()
9506 memcmp(sdata->vif.cfg.ap_addr, req->ap_addr, ETH_ALEN)) in ieee80211_mgd_disassoc()
9507 return -ENOTCONN; in ieee80211_mgd_disassoc()
9511 req->ap_addr, req->reason_code, in ieee80211_mgd_disassoc()
9512 ieee80211_get_reason_code_string(req->reason_code)); in ieee80211_mgd_disassoc()
9515 req->reason_code, !req->local_state_change, in ieee80211_mgd_disassoc()
9519 req->reason_code, false); in ieee80211_mgd_disassoc()
9526 wiphy_work_cancel(link->sdata->local->hw.wiphy, in ieee80211_mgd_stop_link()
9527 &link->u.mgd.request_smps_work); in ieee80211_mgd_stop_link()
9528 wiphy_work_cancel(link->sdata->local->hw.wiphy, in ieee80211_mgd_stop_link()
9529 &link->u.mgd.recalc_smps); in ieee80211_mgd_stop_link()
9530 wiphy_delayed_work_cancel(link->sdata->local->hw.wiphy, in ieee80211_mgd_stop_link()
9531 &link->u.mgd.csa.switch_work); in ieee80211_mgd_stop_link()
9536 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_mgd_stop()
9543 wiphy_work_cancel(sdata->local->hw.wiphy, in ieee80211_mgd_stop()
9544 &ifmgd->monitor_work); in ieee80211_mgd_stop()
9545 wiphy_work_cancel(sdata->local->hw.wiphy, in ieee80211_mgd_stop()
9546 &ifmgd->beacon_connection_loss_work); in ieee80211_mgd_stop()
9547 wiphy_work_cancel(sdata->local->hw.wiphy, in ieee80211_mgd_stop()
9548 &ifmgd->csa_connection_drop_work); in ieee80211_mgd_stop()
9549 wiphy_delayed_work_cancel(sdata->local->hw.wiphy, in ieee80211_mgd_stop()
9550 &ifmgd->tdls_peer_del_work); in ieee80211_mgd_stop()
9552 if (ifmgd->assoc_data) in ieee80211_mgd_stop()
9554 if (ifmgd->auth_data) in ieee80211_mgd_stop()
9556 spin_lock_bh(&ifmgd->teardown_lock); in ieee80211_mgd_stop()
9557 if (ifmgd->teardown_skb) { in ieee80211_mgd_stop()
9558 kfree_skb(ifmgd->teardown_skb); in ieee80211_mgd_stop()
9559 ifmgd->teardown_skb = NULL; in ieee80211_mgd_stop()
9560 ifmgd->orig_teardown_skb = NULL; in ieee80211_mgd_stop()
9562 kfree(ifmgd->assoc_req_ies); in ieee80211_mgd_stop()
9563 ifmgd->assoc_req_ies = NULL; in ieee80211_mgd_stop()
9564 ifmgd->assoc_req_ies_len = 0; in ieee80211_mgd_stop()
9565 spin_unlock_bh(&ifmgd->teardown_lock); in ieee80211_mgd_stop()
9566 del_timer_sync(&ifmgd->timer); in ieee80211_mgd_stop()
9578 cfg80211_cqm_rssi_notify(sdata->dev, rssi_event, rssi_level, gfp); in ieee80211_cqm_rssi_notify()
9586 trace_api_cqm_beacon_loss_notify(sdata->local, sdata); in ieee80211_cqm_beacon_loss_notify()
9588 cfg80211_cqm_beacon_loss_notify(sdata->dev, gfp); in ieee80211_cqm_beacon_loss_notify()
9598 if (WARN_ON(sdata->vif.type != NL80211_IFTYPE_STATION)) in _ieee80211_enable_rssi_reports()
9606 sdata->u.mgd.rssi_min_thold = rssi_min_thold*16; in _ieee80211_enable_rssi_reports()
9607 sdata->u.mgd.rssi_max_thold = rssi_max_thold*16; in _ieee80211_enable_rssi_reports()
9645 struct ieee80211_local *local = sdata->local; in ieee80211_process_ml_reconf_resp()
9646 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_process_ml_reconf_resp()
9648 ifmgd->reconf.add_links_data; in ieee80211_process_ml_reconf_resp()
9651 u16 sta_changed_links = sdata->u.mgd.reconf.added_links | in ieee80211_process_ml_reconf_resp()
9652 sdata->u.mgd.reconf.removed_links; in ieee80211_process_ml_reconf_resp()
9660 if (!ieee80211_vif_is_mld(&sdata->vif) || in ieee80211_process_ml_reconf_resp()
9662 mgmt->u.action.u.ml_reconf_resp.dialog_token != in ieee80211_process_ml_reconf_resp()
9663 sdata->u.mgd.reconf.dialog_token || in ieee80211_process_ml_reconf_resp()
9667 pos = mgmt->u.action.u.ml_reconf_resp.variable; in ieee80211_process_ml_reconf_resp()
9668 len -= offsetofend(typeof(*mgmt), u.action.u.ml_reconf_resp); in ieee80211_process_ml_reconf_resp()
9671 if (len < mgmt->u.action.u.ml_reconf_resp.count * 3) { in ieee80211_process_ml_reconf_resp()
9674 len, mgmt->u.action.u.ml_reconf_resp.count); in ieee80211_process_ml_reconf_resp()
9679 for (i = 0; i < mgmt->u.action.u.ml_reconf_resp.count; i++) { in ieee80211_process_ml_reconf_resp()
9708 if (sdata->u.mgd.reconf.removed_links & BIT(link_id)) in ieee80211_process_ml_reconf_resp()
9714 sdata->u.mgd.reconf.added_links &= ~BIT(link_id); in ieee80211_process_ml_reconf_resp()
9718 len -= 3; in ieee80211_process_ml_reconf_resp()
9728 if (!sdata->u.mgd.reconf.added_links) in ieee80211_process_ml_reconf_resp()
9743 len -= group_key_data_len + 1; in ieee80211_process_ml_reconf_resp()
9746 sta = sta_info_get(sdata, sdata->vif.cfg.ap_addr); in ieee80211_process_ml_reconf_resp()
9750 valid_links = sdata->vif.valid_links; in ieee80211_process_ml_reconf_resp()
9752 if (!add_links_data->link[link_id].bss || in ieee80211_process_ml_reconf_resp()
9753 !(sdata->u.mgd.reconf.added_links & BIT(link_id))) in ieee80211_process_ml_reconf_resp()
9762 ieee80211_vif_set_links(sdata, valid_links, sdata->vif.dormant_links); in ieee80211_process_ml_reconf_resp()
9766 struct cfg80211_bss *cbss = add_links_data->link[link_id].bss; in ieee80211_process_ml_reconf_resp()
9774 link = sdata_dereference(sdata->link[link_id], sdata); in ieee80211_process_ml_reconf_resp()
9780 add_links_data->link[link_id].addr, in ieee80211_process_ml_reconf_resp()
9781 add_links_data->link[link_id].bss->bssid); in ieee80211_process_ml_reconf_resp()
9783 link_sta = rcu_dereference_protected(sta->link[link_id], in ieee80211_process_ml_reconf_resp()
9784 lockdep_is_held(&local->hw.wiphy->mtx)); in ieee80211_process_ml_reconf_resp()
9788 if (!link->u.mgd.have_beacon) { in ieee80211_process_ml_reconf_resp()
9792 ies = rcu_dereference(cbss->beacon_ies); in ieee80211_process_ml_reconf_resp()
9794 link->u.mgd.have_beacon = true; in ieee80211_process_ml_reconf_resp()
9796 ies = rcu_dereference(cbss->ies); in ieee80211_process_ml_reconf_resp()
9798 &link->conf->sync_dtim_count, in ieee80211_process_ml_reconf_resp()
9799 &link->u.mgd.dtim_period); in ieee80211_process_ml_reconf_resp()
9800 link->conf->beacon_int = cbss->beacon_interval; in ieee80211_process_ml_reconf_resp()
9804 link->conf->dtim_period = link->u.mgd.dtim_period ?: 1; in ieee80211_process_ml_reconf_resp()
9806 link->u.mgd.conn = add_links_data->link[link_id].conn; in ieee80211_process_ml_reconf_resp()
9808 true, &link->u.mgd.conn, in ieee80211_process_ml_reconf_resp()
9815 add_links_data->link[link_id].bss)) in ieee80211_process_ml_reconf_resp()
9819 add_links_data->link[link_id].bss, in ieee80211_process_ml_reconf_resp()
9828 if (add_links_data->link[link_id].status != WLAN_STATUS_SUCCESS) in ieee80211_process_ml_reconf_resp()
9847 ieee80211_vif_set_links(sdata, valid_links, sdata->vif.dormant_links); in ieee80211_process_ml_reconf_resp()
9858 done_data.links[link_id].bss = add_links_data->link[link_id].bss; in ieee80211_process_ml_reconf_resp()
9860 cfg80211_mlo_reconf_add_done(sdata->dev, &done_data); in ieee80211_process_ml_reconf_resp()
9861 kfree(sdata->u.mgd.reconf.add_links_data); in ieee80211_process_ml_reconf_resp()
9862 sdata->u.mgd.reconf.add_links_data = NULL; in ieee80211_process_ml_reconf_resp()
9876 struct ieee80211_local *local = sdata->local; in ieee80211_build_ml_reconf_req()
9880 enum nl80211_iftype iftype = ieee80211_vif_type_p2p(&sdata->vif); in ieee80211_build_ml_reconf_req()
9890 size = local->hw.extra_tx_headroom + sizeof(*mgmt); in ieee80211_build_ml_reconf_req()
9905 cfg80211_get_iftype_ext_capa(local->hw.wiphy, in ieee80211_build_ml_reconf_req()
9906 ieee80211_vif_type_p2p(&sdata->vif)); in ieee80211_build_ml_reconf_req()
9909 eml_capa = cpu_to_le16(ift_ext_capa->eml_capabilities); in ieee80211_build_ml_reconf_req()
9911 cpu_to_le16(ift_ext_capa->mld_capa_and_ops); in ieee80211_build_ml_reconf_req()
9936 if (!add_links_data || !add_links_data->link[link_id].bss) in ieee80211_build_ml_reconf_req()
9939 elems_len = add_links_data->link[link_id].elems_len; in ieee80211_build_ml_reconf_req()
9940 cbss = add_links_data->link[link_id].bss; in ieee80211_build_ml_reconf_req()
9943 if (cbss->capability & WLAN_CAPABILITY_PRIVACY) in ieee80211_build_ml_reconf_req()
9950 size += 2 + sdata->vif.cfg.ssid_len + 9; in ieee80211_build_ml_reconf_req()
9959 skb_reserve(skb, local->hw.extra_tx_headroom); in ieee80211_build_ml_reconf_req()
9964 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | in ieee80211_build_ml_reconf_req()
9966 memcpy(mgmt->da, sdata->vif.cfg.ap_addr, ETH_ALEN); in ieee80211_build_ml_reconf_req()
9967 memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); in ieee80211_build_ml_reconf_req()
9968 memcpy(mgmt->bssid, sdata->vif.cfg.ap_addr, ETH_ALEN); in ieee80211_build_ml_reconf_req()
9971 mgmt->u.action.category = WLAN_CATEGORY_PROTECTED_EHT; in ieee80211_build_ml_reconf_req()
9972 mgmt->u.action.u.ml_reconf_req.action_code = in ieee80211_build_ml_reconf_req()
9976 sdata->u.mgd.reconf.dialog_token = ++sdata->u.mgd.dialog_token_alloc; in ieee80211_build_ml_reconf_req()
9977 mgmt->u.action.u.ml_reconf_req.dialog_token = in ieee80211_build_ml_reconf_req()
9978 sdata->u.mgd.reconf.dialog_token; in ieee80211_build_ml_reconf_req()
9985 ml_elem->control = in ieee80211_build_ml_reconf_req()
9989 common->len = common_size + var_common_size; in ieee80211_build_ml_reconf_req()
9990 memcpy(common->mld_mac_addr, sdata->vif.addr, ETH_ALEN); in ieee80211_build_ml_reconf_req()
9996 ml_elem->control |= in ieee80211_build_ml_reconf_req()
10001 ml_elem->control |= in ieee80211_build_ml_reconf_req()
10007 if (sdata->u.mgd.flags & IEEE80211_STA_ENABLE_RRM) in ieee80211_build_ml_reconf_req()
10018 (!add_links_data || !add_links_data->link[link_id].bss)) in ieee80211_build_ml_reconf_req()
10026 sdata_dereference(sdata->vif.link_conf[link_id], in ieee80211_build_ml_reconf_req()
10031 addr = conf->addr; in ieee80211_build_ml_reconf_req()
10035 addr = add_links_data->link[link_id].addr; in ieee80211_build_ml_reconf_req()
10057 skb_put_u8(skb, sdata->vif.cfg.ssid_len); in ieee80211_build_ml_reconf_req()
10058 skb_put_data(skb, sdata->vif.cfg.ssid, in ieee80211_build_ml_reconf_req()
10059 sdata->vif.cfg.ssid_len); in ieee80211_build_ml_reconf_req()
10063 add_links_data->link[link_id].elems, in ieee80211_build_ml_reconf_req()
10064 add_links_data->link[link_id].elems_len, in ieee80211_build_ml_reconf_req()
10069 if (add_links_data->link[link_id].elems) in ieee80211_build_ml_reconf_req()
10071 add_links_data->link[link_id].elems + in ieee80211_build_ml_reconf_req()
10073 add_links_data->link[link_id].elems_len - in ieee80211_build_ml_reconf_req()
10075 if (sdata->u.mgd.flags & IEEE80211_STA_UAPSD_ENABLED) { in ieee80211_build_ml_reconf_req()
10076 qos_info = sdata->u.mgd.uapsd_queues; in ieee80211_build_ml_reconf_req()
10077 qos_info |= (sdata->u.mgd.uapsd_max_sp_len << in ieee80211_build_ml_reconf_req()
10094 info->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS; in ieee80211_build_ml_reconf_req()
10103 struct ieee80211_local *local = sdata->local; in ieee80211_mgd_assoc_ml_reconf()
10110 if (!ieee80211_vif_is_mld(&sdata->vif) || in ieee80211_mgd_assoc_ml_reconf()
10111 !(sdata->vif.cfg.mld_capa_op & in ieee80211_mgd_assoc_ml_reconf()
10113 return -EINVAL; in ieee80211_mgd_assoc_ml_reconf()
10116 if (sdata->u.mgd.reconf.added_links || in ieee80211_mgd_assoc_ml_reconf()
10117 sdata->u.mgd.reconf.removed_links) in ieee80211_mgd_assoc_ml_reconf()
10118 return -EBUSY; in ieee80211_mgd_assoc_ml_reconf()
10129 sta = sta_info_get(sdata, sdata->vif.cfg.ap_addr); in ieee80211_mgd_assoc_ml_reconf()
10131 return -ENOLINK; in ieee80211_mgd_assoc_ml_reconf()
10133 if (rem_links & BIT(sta->sta.deflink.link_id)) in ieee80211_mgd_assoc_ml_reconf()
10134 return -EINVAL; in ieee80211_mgd_assoc_ml_reconf()
10147 return -ENOMEM; in ieee80211_mgd_assoc_ml_reconf()
10160 bss = (void *)link_cbss->priv; in ieee80211_mgd_assoc_ml_reconf()
10162 if (!bss->wmm_used) { in ieee80211_mgd_assoc_ml_reconf()
10163 err = -EINVAL; in ieee80211_mgd_assoc_ml_reconf()
10167 if (link_cbss->channel->band == NL80211_BAND_S1GHZ) { in ieee80211_mgd_assoc_ml_reconf()
10168 err = -EINVAL; in ieee80211_mgd_assoc_ml_reconf()
10172 eth_random_addr(data->link[link_id].addr); in ieee80211_mgd_assoc_ml_reconf()
10173 data->link[link_id].conn = in ieee80211_mgd_assoc_ml_reconf()
10176 local->hw.wiphy->bands[link_cbss->channel->band]; in ieee80211_mgd_assoc_ml_reconf()
10180 &data->link[link_id].conn); in ieee80211_mgd_assoc_ml_reconf()
10182 data->link[link_id].bss = link_cbss; in ieee80211_mgd_assoc_ml_reconf()
10183 data->link[link_id].disabled = in ieee80211_mgd_assoc_ml_reconf()
10185 data->link[link_id].elems = in ieee80211_mgd_assoc_ml_reconf()
10187 data->link[link_id].elems_len = in ieee80211_mgd_assoc_ml_reconf()
10190 if (!bss->uapsd_supported) in ieee80211_mgd_assoc_ml_reconf()
10193 if (data->link[link_id].conn.mode < in ieee80211_mgd_assoc_ml_reconf()
10195 err = -EINVAL; in ieee80211_mgd_assoc_ml_reconf()
10202 err = -EINVAL; in ieee80211_mgd_assoc_ml_reconf()
10207 /* Require U-APSD support to be similar to the current valid in ieee80211_mgd_assoc_ml_reconf()
10211 !!(sdata->u.mgd.flags & IEEE80211_STA_UAPSD_ENABLED)) { in ieee80211_mgd_assoc_ml_reconf()
10212 err = -EINVAL; in ieee80211_mgd_assoc_ml_reconf()
10218 if (!data->link[link_id].bss) in ieee80211_mgd_assoc_ml_reconf()
10223 data->link[link_id].bss, in ieee80211_mgd_assoc_ml_reconf()
10225 &data->link[link_id].conn, in ieee80211_mgd_assoc_ml_reconf()
10239 u16 new_active_links = sdata->vif.active_links & ~rem_links; in ieee80211_mgd_assoc_ml_reconf()
10241 new_valid_links = sdata->vif.valid_links & ~rem_links; in ieee80211_mgd_assoc_ml_reconf()
10247 !(new_valid_links & ~sdata->vif.dormant_links)) { in ieee80211_mgd_assoc_ml_reconf()
10249 err = -EINVAL; in ieee80211_mgd_assoc_ml_reconf()
10253 if (new_active_links != sdata->vif.active_links) { in ieee80211_mgd_assoc_ml_reconf()
10257 ~sdata->vif.dormant_links)); in ieee80211_mgd_assoc_ml_reconf()
10259 err = ieee80211_set_active_links(&sdata->vif, in ieee80211_mgd_assoc_ml_reconf()
10278 err = -ENOMEM; in ieee80211_mgd_assoc_ml_reconf()
10283 u16 new_dormant_links = sdata->vif.dormant_links & ~rem_links; in ieee80211_mgd_assoc_ml_reconf()
10305 cfg80211_links_removed(sdata->dev, rem_links); in ieee80211_mgd_assoc_ml_reconf()
10313 sdata->u.mgd.reconf.added_links = added_links; in ieee80211_mgd_assoc_ml_reconf()
10314 sdata->u.mgd.reconf.add_links_data = data; in ieee80211_mgd_assoc_ml_reconf()
10315 sdata->u.mgd.reconf.removed_links = rem_links; in ieee80211_mgd_assoc_ml_reconf()
10316 wiphy_delayed_work_queue(sdata->local->hw.wiphy, in ieee80211_mgd_assoc_ml_reconf()
10317 &sdata->u.mgd.reconf.wk, in ieee80211_mgd_assoc_ml_reconf()