Lines Matching +full:mu +full:- +full:side +full:- +full:b
1 // SPDX-License-Identifier: GPL-2.0-only
4 * Copyright 2003-2008, Jouni Malinen <[email protected]>
7 * Copyright 2006-2007 Jiri Benc <[email protected]>
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()
171 if (ieee80211_hw_check(&sdata->local->hw, STRICT)) in ieee80211_determine_ap_chan()
177 .center_freq1 = channel->center_freq, in ieee80211_determine_ap_chan()
178 .freq1_offset = channel->freq_offset, in ieee80211_determine_ap_chan()
182 if (sband->band == NL80211_BAND_S1GHZ) { in ieee80211_determine_ap_chan()
183 if (!ieee80211_chandef_s1g_oper(elems->s1g_oper, chandef)) { in ieee80211_determine_ap_chan()
186 chandef->width = ieee80211_s1g_channel_width(channel); in ieee80211_determine_ap_chan()
193 if (sband->band == NL80211_BAND_6GHZ) { in ieee80211_determine_ap_chan()
197 if (conn->mode < IEEE80211_CONN_MODE_HE) in ieee80211_determine_ap_chan()
200 if (!elems->he_6ghz_capa || !elems->he_cap) { in ieee80211_determine_ap_chan()
206 if (!eht_oper || !elems->eht_cap) { in ieee80211_determine_ap_chan()
211 if (!ieee80211_chandef_he_6ghz_oper(sdata->local, he_oper, in ieee80211_determine_ap_chan()
221 if (conn->mode < IEEE80211_CONN_MODE_HT) in ieee80211_determine_ap_chan()
224 if (!ht_oper || !elems->ht_cap_elem) in ieee80211_determine_ap_chan()
227 chandef->width = NL80211_CHAN_WIDTH_20; in ieee80211_determine_ap_chan()
229 ht_cfreq = ieee80211_channel_to_frequency(ht_oper->primary_chan, in ieee80211_determine_ap_chan()
230 channel->band); in ieee80211_determine_ap_chan()
232 if (!ignore_ht_channel_mismatch && channel->center_freq != ht_cfreq) { in ieee80211_determine_ap_chan()
241 …"Wrong control channel: center-freq: %d ht-cfreq: %d ht->primary_chan: %d band: %d - Disabling HT\… in ieee80211_determine_ap_chan()
242 channel->center_freq, ht_cfreq, in ieee80211_determine_ap_chan()
243 ht_oper->primary_chan, channel->band); in ieee80211_determine_ap_chan()
249 if (conn->mode < IEEE80211_CONN_MODE_VHT) in ieee80211_determine_ap_chan()
258 if (elems->he_cap && he_oper && in ieee80211_determine_ap_chan()
259 he_oper->he_oper_params & cpu_to_le32(IEEE80211_HE_OPERATION_VHT_OPER_INFO)) { in ieee80211_determine_ap_chan()
266 memcpy(&he_oper_vht_cap, he_oper->optional, 3); in ieee80211_determine_ap_chan()
269 if (!ieee80211_chandef_vht_oper(&sdata->local->hw, vht_cap_info, in ieee80211_determine_ap_chan()
274 /* this will cause us to re-parse as VHT STA */ in ieee80211_determine_ap_chan()
277 } else if (!vht_oper || !elems->vht_cap_elem) { in ieee80211_determine_ap_chan()
278 if (sband->band == NL80211_BAND_5GHZ) { in ieee80211_determine_ap_chan()
284 } else if (sband->band == NL80211_BAND_2GHZ) { in ieee80211_determine_ap_chan()
286 } else if (!ieee80211_chandef_vht_oper(&sdata->local->hw, in ieee80211_determine_ap_chan()
304 if (conn->mode < IEEE80211_CONN_MODE_HE || in ieee80211_determine_ap_chan()
305 !elems->he_operation || !elems->he_cap) { in ieee80211_determine_ap_chan()
312 if (conn->mode < IEEE80211_CONN_MODE_EHT || in ieee80211_determine_ap_chan()
313 !eht_oper || !elems->eht_cap) in ieee80211_determine_ap_chan()
321 if (eht_oper->params & IEEE80211_EHT_OPER_INFO_PRESENT) { in ieee80211_determine_ap_chan()
324 ieee80211_chandef_eht_oper((const void *)eht_oper->optional, in ieee80211_determine_ap_chan()
365 mcs_80_map_tx = le16_to_cpu(he_mcs_nss_supp->tx_mcs_80); in ieee80211_verify_peer_he_mcs_support()
366 mcs_80_map_rx = le16_to_cpu(he_mcs_nss_supp->rx_mcs_80); in ieee80211_verify_peer_he_mcs_support()
368 /* P802.11-REVme/D0.3 in ieee80211_verify_peer_he_mcs_support()
373 * Single spatial stream HE-MCSs 0 to 7 (transmit and receive) in all in ieee80211_verify_peer_he_mcs_support()
387 ap_min_req_set = le16_to_cpu(he_op->he_mcs_nss_set); in ieee80211_verify_peer_he_mcs_support()
394 if (!ieee80211_hw_check(&sdata->local->hw, STRICT) && !ap_min_req_set) in ieee80211_verify_peer_he_mcs_support()
399 * P802.11-REVme/D0.3 in ieee80211_verify_peer_he_mcs_support()
403 * transmit at each of the <HE-MCS, NSS> tuple values indicated by the in ieee80211_verify_peer_he_mcs_support()
404 * Basic HE-MCS And NSS Set field of the HE Operation parameter of the in ieee80211_verify_peer_he_mcs_support()
405 * MLME-START.request primitive and shall be able to receive at each of in ieee80211_verify_peer_he_mcs_support()
406 * the <HE-MCS, NSS> tuple values indicated by the Supported HE-MCS and in ieee80211_verify_peer_he_mcs_support()
410 for (nss = 8; nss > 0; nss--) { in ieee80211_verify_peer_he_mcs_support()
411 u8 ap_op_val = (ap_min_req_set >> (2 * (nss - 1))) & 3; in ieee80211_verify_peer_he_mcs_support()
418 ap_rx_val = (mcs_80_map_rx >> (2 * (nss - 1))) & 3; in ieee80211_verify_peer_he_mcs_support()
419 ap_tx_val = (mcs_80_map_tx >> (2 * (nss - 1))) & 3; in ieee80211_verify_peer_he_mcs_support()
440 ieee80211_get_he_iftype_cap_vif(sband, &sdata->vif); in ieee80211_verify_sta_he_mcs_support()
447 ap_min_req_set = le16_to_cpu(he_op->he_mcs_nss_set); in ieee80211_verify_sta_he_mcs_support()
454 if (!ieee80211_hw_check(&sdata->local->hw, STRICT) && !ap_min_req_set) in ieee80211_verify_sta_he_mcs_support()
460 &sta_he_cap->he_mcs_nss_supp; in ieee80211_verify_sta_he_mcs_support()
470 * possible. Each of the sta_mcs_map_* is a 16-bit struct built in ieee80211_verify_sta_he_mcs_support()
471 * of 2 bits per NSS (1-8), with the values defined in enum in ieee80211_verify_sta_he_mcs_support()
477 for (nss = 8; nss > 0; nss--) { in ieee80211_verify_sta_he_mcs_support()
478 u8 sta_rx_val = (sta_mcs_map_rx >> (2 * (nss - 1))) & 3; in ieee80211_verify_sta_he_mcs_support()
479 u8 sta_tx_val = (sta_mcs_map_tx >> (2 * (nss - 1))) & 3; in ieee80211_verify_sta_he_mcs_support()
480 u8 ap_val = (ap_min_req_set >> (2 * (nss - 1))) & 3; in ieee80211_verify_sta_he_mcs_support()
489 * P802.11-REVme/D0.3 in ieee80211_verify_sta_he_mcs_support()
492 * An HE STA shall not attempt to join * (MLME-JOIN.request primitive) in ieee80211_verify_sta_he_mcs_support()
494 * receive using) all of the <HE-MCS, NSS> tuples in the basic in ieee80211_verify_sta_he_mcs_support()
495 * HE-MCS and NSS set. in ieee80211_verify_sta_he_mcs_support()
518 u8 he_phy_cap0 = sta_he_cap->he_cap_elem.phy_cap_info[0]; in ieee80211_get_eht_cap_mcs_nss()
519 u8 eht_phy_cap0 = sta_eht_cap->eht_cap_elem.phy_cap_info[0]; in ieee80211_get_eht_cap_mcs_nss()
521 /* handle us being a 20 MHz-only EHT STA - with four values in ieee80211_get_eht_cap_mcs_nss()
522 * for MCS 0-7, 8-9, 10-11, 12-13. in ieee80211_get_eht_cap_mcs_nss()
525 return sta_eht_cap->eht_mcs_nss_supp.only_20mhz.rx_tx_max_nss[idx]; in ieee80211_get_eht_cap_mcs_nss()
527 /* the others have MCS 0-9 together, rather than separately from 0-7 */ in ieee80211_get_eht_cap_mcs_nss()
529 idx--; in ieee80211_get_eht_cap_mcs_nss()
533 return sta_eht_cap->eht_mcs_nss_supp.bw._80.rx_tx_max_nss[idx]; in ieee80211_get_eht_cap_mcs_nss()
539 return sta_eht_cap->eht_mcs_nss_supp.bw._160.rx_tx_max_nss[idx]; in ieee80211_get_eht_cap_mcs_nss()
543 return sta_eht_cap->eht_mcs_nss_supp.bw._320.rx_tx_max_nss[idx]; in ieee80211_get_eht_cap_mcs_nss()
556 ieee80211_get_he_iftype_cap_vif(sband, &sdata->vif); in ieee80211_verify_sta_eht_mcs_support()
558 ieee80211_get_eht_iftype_cap_vif(sband, &sdata->vif); in ieee80211_verify_sta_eht_mcs_support()
565 req = &eht_op->basic_mcs_nss; in ieee80211_verify_sta_eht_mcs_support()
567 for (i = 0; i < ARRAY_SIZE(req->rx_tx_max_nss); i++) { in ieee80211_verify_sta_eht_mcs_support()
571 req_rx_nss = u8_get_bits(req->rx_tx_max_nss[i], in ieee80211_verify_sta_eht_mcs_support()
573 req_tx_nss = u8_get_bits(req->rx_tx_max_nss[i], in ieee80211_verify_sta_eht_mcs_support()
611 ext_supp_rates[i - supp_rates_len]; in ieee80211_get_rates()
631 for (j = 0; j < sband->n_bitrates; j++) { in ieee80211_get_rates()
635 br = &sband->bitrates[j]; in ieee80211_get_rates()
637 brate = DIV_ROUND_UP(br->bitrate, 5); in ieee80211_get_rates()
653 if (is_basic && unknown_rates_selectors && j == sband->n_bitrates) in ieee80211_get_rates()
662 if (!cfg80211_chandef_usable(sdata->local->hw.wiphy, in ieee80211_chandef_usable()
666 if (chandef->punctured && in ieee80211_chandef_usable()
667 ieee80211_hw_check(&sdata->local->hw, DISALLOW_PUNCTURING)) in ieee80211_chandef_usable()
670 if (chandef->punctured && chandef->chan->band == NL80211_BAND_5GHZ && in ieee80211_chandef_usable()
671 ieee80211_hw_check(&sdata->local->hw, DISALLOW_PUNCTURING_5GHZ)) in ieee80211_chandef_usable()
679 if (c->width == NL80211_CHAN_WIDTH_80P80) in ieee80211_chandef_num_subchans()
682 return nl80211_chan_width_to_mhz(c->width) / 20; in ieee80211_chandef_num_subchans()
687 switch (c->width) { in ieee80211_chandef_num_widths()
725 /* don't WARN - misconfigured APs could cause this if their N > width */ in ieee80211_calc_chandef_subchan_offset()
743 * 80+80 with secondary 80 below primary - four subchannels for it in ieee80211_calc_chandef_subchan_offset()
746 if (ap->width == NL80211_CHAN_WIDTH_80P80 && in ieee80211_calc_chandef_subchan_offset()
747 ap->center_freq2 < ap->center_freq1) in ieee80211_calc_chandef_subchan_offset()
764 if (!psd->valid) in ieee80211_rearrange_tpe_psd()
768 if (!psd->n) in ieee80211_rearrange_tpe_psd()
771 BUILD_BUG_ON(sizeof(tmp) != sizeof(psd->power)); in ieee80211_rearrange_tpe_psd()
777 * In psd->power we have values in the order 0..N, 0..K, where in ieee80211_rearrange_tpe_psd()
779 * doesn't then we've pre-filled 'unlimited' as defaults. in ieee80211_rearrange_tpe_psd()
792 * N entries: |--|--|--|--| in ieee80211_rearrange_tpe_psd()
793 * K entries: |--|--|--|--|--|--|--|--| |--|--|--|--| in ieee80211_rearrange_tpe_psd()
808 offset = ieee80211_calc_chandef_subchan_offset(ap, psd->n); in ieee80211_rearrange_tpe_psd()
811 tmp[i] = psd->power[i + psd->n]; in ieee80211_rearrange_tpe_psd()
812 else if (i < offset + psd->n) in ieee80211_rearrange_tpe_psd()
813 tmp[i] = psd->power[i - offset]; in ieee80211_rearrange_tpe_psd()
815 tmp[i] = psd->power[i]; in ieee80211_rearrange_tpe_psd()
822 memset(psd->power, IEEE80211_TPE_PSD_NO_LIMIT, sizeof(psd->power)); in ieee80211_rearrange_tpe_psd()
825 psd->power[i] = tmp[offset + i]; in ieee80211_rearrange_tpe_psd()
829 if (needed < psd->count) in ieee80211_rearrange_tpe_psd()
830 psd->count = needed; in ieee80211_rearrange_tpe_psd()
848 ieee80211_rearrange_tpe_psd(&tpe->psd_local[i], ap, used); in ieee80211_rearrange_tpe()
849 ieee80211_rearrange_tpe_psd(&tpe->psd_reg_client[i], ap, used); in ieee80211_rearrange_tpe()
853 if (needed_pwr_count < tpe->max_local[i].count) in ieee80211_rearrange_tpe()
854 tpe->max_local[i].count = needed_pwr_count; in ieee80211_rearrange_tpe()
855 if (needed_pwr_count < tpe->max_reg_client[i].count) in ieee80211_rearrange_tpe()
856 tpe->max_reg_client[i].count = needed_pwr_count; in ieee80211_rearrange_tpe()
873 chanreq->ap.chan = NULL; in ieee80211_set_chanreq_ap()
875 if (conn->mode < IEEE80211_CONN_MODE_EHT) in ieee80211_set_chanreq_ap()
877 if (sdata->vif.driver_flags & IEEE80211_VIF_IGNORE_OFDMA_WIDER_BW) in ieee80211_set_chanreq_ap()
880 chanreq->ap = *ap_chandef; in ieee80211_set_chanreq_ap()
891 const struct cfg80211_bss_ies *ies = rcu_dereference(cbss->ies); in ieee80211_determine_chan_mode()
892 struct ieee80211_bss *bss = (void *)cbss->priv; in ieee80211_determine_chan_mode()
893 struct ieee80211_channel *channel = cbss->channel; in ieee80211_determine_chan_mode()
895 .link_id = -1, in ieee80211_determine_chan_mode()
897 .start = ies->data, in ieee80211_determine_chan_mode()
898 .len = ies->len, in ieee80211_determine_chan_mode()
908 parse_params.mode = conn->mode; in ieee80211_determine_chan_mode()
911 return ERR_PTR(-ENOMEM); in ieee80211_determine_chan_mode()
913 ap_mode = ieee80211_determine_ap_chan(sdata, channel, bss->vht_cap_info, in ieee80211_determine_chan_mode()
917 if (WARN_ON(ap_mode > conn->mode)) { in ieee80211_determine_chan_mode()
918 ret = -EINVAL; in ieee80211_determine_chan_mode()
922 if (conn->mode != ap_mode) { in ieee80211_determine_chan_mode()
923 conn->mode = ap_mode; in ieee80211_determine_chan_mode()
929 cbss->bssid, ieee80211_conn_mode_str(ap_mode)); in ieee80211_determine_chan_mode()
931 sband = sdata->local->hw.wiphy->bands[channel->band]; in ieee80211_determine_chan_mode()
933 ieee80211_get_rates(sband, elems->supp_rates, elems->supp_rates_len, in ieee80211_determine_chan_mode()
934 elems->ext_supp_rates, elems->ext_supp_rates_len, in ieee80211_determine_chan_mode()
938 switch (channel->band) { in ieee80211_determine_chan_mode()
941 ret = -EINVAL; in ieee80211_determine_chan_mode()
948 "Rejecting non-HE 6/7 GHz connection"); in ieee80211_determine_chan_mode()
949 ret = -EINVAL; in ieee80211_determine_chan_mode()
955 ret = -EINVAL; in ieee80211_determine_chan_mode()
963 ret = -EINVAL; in ieee80211_determine_chan_mode()
966 conn->bw_limit = IEEE80211_CONN_BW_LIMIT_20; in ieee80211_determine_chan_mode()
969 conn->bw_limit = min_t(enum ieee80211_conn_bw_limit, in ieee80211_determine_chan_mode()
970 conn->bw_limit, in ieee80211_determine_chan_mode()
975 conn->bw_limit = min_t(enum ieee80211_conn_bw_limit, in ieee80211_determine_chan_mode()
976 conn->bw_limit, in ieee80211_determine_chan_mode()
980 conn->bw_limit = min_t(enum ieee80211_conn_bw_limit, in ieee80211_determine_chan_mode()
981 conn->bw_limit, in ieee80211_determine_chan_mode()
986 chanreq->oper = *ap_chandef; in ieee80211_determine_chan_mode()
989 if (conn->mode >= IEEE80211_CONN_MODE_HT) in ieee80211_determine_chan_mode()
991 if (conn->mode >= IEEE80211_CONN_MODE_VHT) in ieee80211_determine_chan_mode()
993 if (conn->mode >= IEEE80211_CONN_MODE_HE) in ieee80211_determine_chan_mode()
995 if (conn->mode >= IEEE80211_CONN_MODE_EHT) in ieee80211_determine_chan_mode()
1007 ret = -EINVAL; in ieee80211_determine_chan_mode()
1013 while (!ieee80211_chandef_usable(sdata, &chanreq->oper, in ieee80211_determine_chan_mode()
1015 if (WARN_ON(chanreq->oper.width == NL80211_CHAN_WIDTH_20_NOHT)) { in ieee80211_determine_chan_mode()
1016 ret = -EINVAL; in ieee80211_determine_chan_mode()
1023 if (conn->mode >= IEEE80211_CONN_MODE_HE && in ieee80211_determine_chan_mode()
1024 !cfg80211_chandef_usable(sdata->wdev.wiphy, &chanreq->oper, in ieee80211_determine_chan_mode()
1026 conn->mode = IEEE80211_CONN_MODE_VHT; in ieee80211_determine_chan_mode()
1027 conn->bw_limit = min_t(enum ieee80211_conn_bw_limit, in ieee80211_determine_chan_mode()
1028 conn->bw_limit, in ieee80211_determine_chan_mode()
1032 if (conn->mode >= IEEE80211_CONN_MODE_EHT && in ieee80211_determine_chan_mode()
1033 !cfg80211_chandef_usable(sdata->wdev.wiphy, &chanreq->oper, in ieee80211_determine_chan_mode()
1035 conn->mode = IEEE80211_CONN_MODE_HE; in ieee80211_determine_chan_mode()
1036 conn->bw_limit = min_t(enum ieee80211_conn_bw_limit, in ieee80211_determine_chan_mode()
1037 conn->bw_limit, in ieee80211_determine_chan_mode()
1041 if (chanreq->oper.width != ap_chandef->width || ap_mode != conn->mode) in ieee80211_determine_chan_mode()
1045 if (conn->mode >= IEEE80211_CONN_MODE_HE && in ieee80211_determine_chan_mode()
1047 (void *)elems->he_cap, in ieee80211_determine_chan_mode()
1048 elems->he_operation) || in ieee80211_determine_chan_mode()
1050 elems->he_operation))) { in ieee80211_determine_chan_mode()
1051 conn->mode = IEEE80211_CONN_MODE_VHT; in ieee80211_determine_chan_mode()
1056 if (conn->mode >= IEEE80211_CONN_MODE_EHT && in ieee80211_determine_chan_mode()
1058 elems->eht_operation)) { in ieee80211_determine_chan_mode()
1059 conn->mode = IEEE80211_CONN_MODE_HE; in ieee80211_determine_chan_mode()
1060 conn->bw_limit = min_t(enum ieee80211_conn_bw_limit, in ieee80211_determine_chan_mode()
1061 conn->bw_limit, in ieee80211_determine_chan_mode()
1068 if (ap_mode != conn->mode) { in ieee80211_determine_chan_mode()
1075 ieee80211_conn_mode_str(conn->mode), in ieee80211_determine_chan_mode()
1076 20 * (1 << conn->bw_limit)); in ieee80211_determine_chan_mode()
1078 if (WARN_ON_ONCE(!cfg80211_chandef_valid(&chanreq->oper))) { in ieee80211_determine_chan_mode()
1079 ret = -EINVAL; in ieee80211_determine_chan_mode()
1094 struct ieee80211_channel *channel = link->conf->chanreq.oper.chan; in ieee80211_config_bw()
1095 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_config_bw()
1104 if (link->u.mgd.conn.mode == IEEE80211_CONN_MODE_LEGACY || in ieee80211_config_bw()
1105 link->u.mgd.conn.mode == IEEE80211_CONN_MODE_S1G) in ieee80211_config_bw()
1108 if (elems->vht_cap_elem) in ieee80211_config_bw()
1109 vht_cap_info = le32_to_cpu(elems->vht_cap_elem->vht_cap_info); in ieee80211_config_bw()
1112 elems, true, &link->u.mgd.conn, in ieee80211_config_bw()
1115 if (ap_mode != link->u.mgd.conn.mode) { in ieee80211_config_bw()
1118 link->u.mgd.bssid, in ieee80211_config_bw()
1119 ieee80211_conn_mode_str(link->u.mgd.conn.mode), in ieee80211_config_bw()
1121 return -EINVAL; in ieee80211_config_bw()
1125 ieee80211_set_chanreq_ap(sdata, &chanreq, &link->u.mgd.conn, in ieee80211_config_bw()
1129 * if HT operation mode changed store the new one - in ieee80211_config_bw()
1132 if (elems->ht_operation) { in ieee80211_config_bw()
1133 ht_opmode = le16_to_cpu(elems->ht_operation->operation_mode); in ieee80211_config_bw()
1134 if (link->conf->ht_operation_mode != ht_opmode) { in ieee80211_config_bw()
1136 link->conf->ht_operation_mode = ht_opmode; in ieee80211_config_bw()
1145 * won't do us any good -- we couldn't use it with the AP. in ieee80211_config_bw()
1147 while (link->u.mgd.conn.bw_limit < in ieee80211_config_bw()
1151 if (ap_chandef.chan->band == NL80211_BAND_6GHZ && in ieee80211_config_bw()
1152 link->u.mgd.conn.mode >= IEEE80211_CONN_MODE_HE) { in ieee80211_config_bw()
1153 ieee80211_rearrange_tpe(&elems->tpe, &ap_chandef, in ieee80211_config_bw()
1155 if (memcmp(&link->conf->tpe, &elems->tpe, sizeof(elems->tpe))) { in ieee80211_config_bw()
1156 link->conf->tpe = elems->tpe; in ieee80211_config_bw()
1161 if (ieee80211_chanreq_identical(&chanreq, &link->conf->chanreq)) in ieee80211_config_bw()
1166 link->u.mgd.bssid, frame, chanreq.oper.chan->center_freq, in ieee80211_config_bw()
1167 chanreq.oper.chan->freq_offset, chanreq.oper.width, in ieee80211_config_bw()
1173 "AP %pM changed caps/bw in %s in a way we can't support - disconnect\n", in ieee80211_config_bw()
1174 link->u.mgd.bssid, frame); in ieee80211_config_bw()
1175 return -EINVAL; in ieee80211_config_bw()
1179 link->conf->chanreq = chanreq; in ieee80211_config_bw()
1185 * here. This keeps us from playing ping-pong with regulatory, without in ieee80211_config_bw()
1187 * - connect to an AP with 80 MHz, world regdom allows 80 MHz in ieee80211_config_bw()
1188 * - AP advertises regdom US in ieee80211_config_bw()
1189 * - CRDA loads regdom US with 80 MHz prohibited (old database) in ieee80211_config_bw()
1190 * - we detect an unsupported channel and disconnect in ieee80211_config_bw()
1191 * - disconnect causes CRDA to reload world regdomain and the game in ieee80211_config_bw()
1203 "AP %pM changed bandwidth in %s to incompatible one - disconnect\n", in ieee80211_config_bw()
1204 link->u.mgd.bssid, frame); in ieee80211_config_bw()
1208 cfg80211_schedule_channels_check(&sdata->wdev); in ieee80211_config_bw()
1222 u32 flags = channel->flags; in ieee80211_add_ht_ie()
1226 BUILD_BUG_ON(sizeof(ht_cap) != sizeof(sband->ht_cap)); in ieee80211_add_ht_ie()
1228 memcpy(&ht_cap, &sband->ht_cap, sizeof(ht_cap)); in ieee80211_add_ht_ie()
1251 * capable of 40 MHz -- some broken APs will never fall in ieee80211_add_ht_ie()
1254 if (conn->bw_limit <= IEEE80211_CONN_BW_LIMIT_20) { in ieee80211_add_ht_ie()
1287 * Note - the function returns true to own the MU-MIMO capability
1295 struct ieee80211_local *local = sdata->local; in ieee80211_add_vht_ie()
1302 BUILD_BUG_ON(sizeof(vht_cap) != sizeof(sband->vht_cap)); in ieee80211_add_vht_ie()
1304 memcpy(&vht_cap, &sband->vht_cap, sizeof(vht_cap)); in ieee80211_add_vht_ie()
1310 if (conn->bw_limit <= IEEE80211_CONN_BW_LIMIT_80) { in ieee80211_add_vht_ie()
1319 if (!ieee80211_hw_check(&local->hw, STRICT)) { in ieee80211_add_vht_ie()
1320 if (!(ap_vht_cap->vht_cap_info & in ieee80211_add_vht_ie()
1324 else if (!(ap_vht_cap->vht_cap_info & in ieee80211_add_vht_ie()
1330 * If some other vif is using the MU-MIMO capability we cannot associate in ieee80211_add_vht_ie()
1331 * using MU-MIMO - this will lead to contradictions in the group-id in ieee80211_add_vht_ie()
1334 * simultaneous associations with MU-MIMO. in ieee80211_add_vht_ie()
1340 list_for_each_entry(other, &local->interfaces, list) { in ieee80211_add_vht_ie()
1341 if (other->vif.bss_conf.mu_mimo_owner) { in ieee80211_add_vht_ie()
1354 ap_bf_sts = le32_to_cpu(ap_vht_cap->vht_cap_info) & mask; in ieee80211_add_vht_ie()
1377 if (assoc_data->supp_rates_len && in ieee80211_assoc_add_rates()
1378 !ieee80211_hw_check(&local->hw, STRICT)) { in ieee80211_assoc_add_rates()
1382 * in the association request (e.g. D-Link DAP 1353 in in ieee80211_assoc_add_rates()
1383 * b-only mode)... in ieee80211_assoc_add_rates()
1386 assoc_data->supp_rates, in ieee80211_assoc_add_rates()
1387 assoc_data->supp_rates_len, in ieee80211_assoc_add_rates()
1434 /* 60 GHz (Multi-band, DMG, MMS) can't happen */ in ieee80211_add_before_ht_elems()
1448 skb_put_data(skb, elems + offset, noffset - offset); in ieee80211_add_before_ht_elems()
1468 /* 60 GHz (Multi-band, DMG, MMS) can't happen */ in ieee80211_add_before_vht_elems()
1479 skb_put_data(skb, elems + offset, noffset - offset); in ieee80211_add_before_vht_elems()
1513 skb_put_data(skb, elems + offset, noffset - offset); in ieee80211_add_before_he_elems()
1539 enum nl80211_iftype iftype = ieee80211_vif_type_p2p(&sdata->vif); in ieee80211_add_link_elems()
1540 struct cfg80211_bss *cbss = assoc_data->link[link_id].bss; in ieee80211_add_link_elems()
1541 struct ieee80211_channel *chan = cbss->channel; in ieee80211_add_link_elems()
1543 struct ieee80211_local *local = sdata->local; in ieee80211_add_link_elems()
1555 /* need a last for termination - we use 0 == SSID */ \ in ieee80211_add_link_elems()
1556 if (!WARN_ON(present_elems_len >= PRESENT_ELEMS_MAX - 1)) \ in ieee80211_add_link_elems()
1562 smps_mode = link->smps_mode; in ieee80211_add_link_elems()
1563 else if (sdata->u.mgd.powersave) in ieee80211_add_link_elems()
1575 chanctx_conf = rcu_dereference(link->conf->chanctx_conf); in ieee80211_add_link_elems()
1577 width = chanctx_conf->def.width; in ieee80211_add_link_elems()
1581 sband = local->hw.wiphy->bands[chan->band]; in ieee80211_add_link_elems()
1584 if (sband->band == NL80211_BAND_2GHZ) { in ieee80211_add_link_elems()
1589 if ((cbss->capability & WLAN_CAPABILITY_SPECTRUM_MGMT) && in ieee80211_add_link_elems()
1590 ieee80211_hw_check(&local->hw, SPECTRUM_MGMT)) in ieee80211_add_link_elems()
1593 if (sband->band != NL80211_BAND_S1GHZ) in ieee80211_add_link_elems()
1618 (sband->band != NL80211_BAND_6GHZ || in ieee80211_add_link_elems()
1619 !ext_capa || ext_capa->datalen < 1 || in ieee80211_add_link_elems()
1620 !(ext_capa->data[0] & WLAN_EXT_CAPA1_EXT_CHANNEL_SWITCHING))) { in ieee80211_add_link_elems()
1622 pos = skb_put(skb, 2 * sband->n_channels + 2); in ieee80211_add_link_elems()
1624 *pos++ = 2 * sband->n_channels; in ieee80211_add_link_elems()
1625 for (i = 0; i < sband->n_channels; i++) { in ieee80211_add_link_elems()
1626 int cf = sband->channels[i].center_freq; in ieee80211_add_link_elems()
1639 if (sband->band != NL80211_BAND_6GHZ && in ieee80211_add_link_elems()
1640 assoc_data->link[link_id].conn.mode >= IEEE80211_CONN_MODE_HT) { in ieee80211_add_link_elems()
1642 assoc_data->link[link_id].ap_ht_param, in ieee80211_add_link_elems()
1644 &assoc_data->link[link_id].conn); in ieee80211_add_link_elems()
1653 if (sband->band != NL80211_BAND_6GHZ && in ieee80211_add_link_elems()
1654 assoc_data->link[link_id].conn.mode >= IEEE80211_CONN_MODE_VHT && in ieee80211_add_link_elems()
1655 sband->vht_cap.vht_supported) { in ieee80211_add_link_elems()
1658 &assoc_data->link[link_id].ap_vht_cap, in ieee80211_add_link_elems()
1659 &assoc_data->link[link_id].conn); in ieee80211_add_link_elems()
1662 link->conf->mu_mimo_owner = mu_mimo_owner; in ieee80211_add_link_elems()
1671 if (assoc_data->link[link_id].conn.mode >= IEEE80211_CONN_MODE_HE) { in ieee80211_add_link_elems()
1673 &assoc_data->link[link_id].conn); in ieee80211_add_link_elems()
1679 * careful - need to know about all the present elems before in ieee80211_add_link_elems()
1683 if (assoc_data->link[link_id].conn.mode >= IEEE80211_CONN_MODE_EHT) in ieee80211_add_link_elems()
1686 if (link_id == assoc_data->assoc_link_id) in ieee80211_add_link_elems()
1693 if (assoc_data->link[link_id].conn.mode >= IEEE80211_CONN_MODE_EHT) in ieee80211_add_link_elems()
1695 &assoc_data->link[link_id].conn); in ieee80211_add_link_elems()
1697 if (sband->band == NL80211_BAND_S1GHZ) { in ieee80211_add_link_elems()
1699 ieee80211_add_s1g_capab_ie(sdata, &sband->s1g_cap, skb); in ieee80211_add_link_elems()
1702 if (iftd && iftd->vendor_elems.data && iftd->vendor_elems.len) in ieee80211_add_link_elems()
1703 skb_put_data(skb, iftd->vendor_elems.data, iftd->vendor_elems.len); in ieee80211_add_link_elems()
1712 unsigned int skb_len = skb->len; in ieee80211_add_non_inheritance_elem()
1726 /* should at least be sorted in the sense of normal -> ext */ in ieee80211_add_non_inheritance_elem()
1756 /* if we added a list but no extension list, make a zero-len one */ in ieee80211_add_non_inheritance_elem()
1764 *len = skb->len - skb_len - 2; in ieee80211_add_non_inheritance_elem()
1774 struct ieee80211_local *local = sdata->local; in ieee80211_assoc_add_ml_elem()
1783 if (!ieee80211_vif_is_mld(&sdata->vif)) in ieee80211_assoc_add_ml_elem()
1786 ift_ext_capa = cfg80211_get_iftype_ext_capa(local->hw.wiphy, in ieee80211_assoc_add_ml_elem()
1787 ieee80211_vif_type_p2p(&sdata->vif)); in ieee80211_assoc_add_ml_elem()
1789 eml_capa = cpu_to_le16(ift_ext_capa->eml_capabilities); in ieee80211_assoc_add_ml_elem()
1790 mld_capa_ops = cpu_to_le16(ift_ext_capa->mld_capa_and_ops); in ieee80211_assoc_add_ml_elem()
1797 ml_elem->control = in ieee80211_assoc_add_ml_elem()
1801 common->len = sizeof(*common) + in ieee80211_assoc_add_ml_elem()
1803 memcpy(common->mld_mac_addr, sdata->vif.addr, ETH_ALEN); in ieee80211_assoc_add_ml_elem()
1809 common->len += 2; /* EML capabilities */ in ieee80211_assoc_add_ml_elem()
1810 ml_elem->control |= in ieee80211_assoc_add_ml_elem()
1824 if (!assoc_data->link[link_id].bss || in ieee80211_assoc_add_ml_elem()
1825 link_id == assoc_data->assoc_link_id) in ieee80211_assoc_add_ml_elem()
1828 extra_elems = assoc_data->link[link_id].elems; in ieee80211_assoc_add_ml_elem()
1829 extra_elems_len = assoc_data->link[link_id].elems_len; in ieee80211_assoc_add_ml_elem()
1839 skb_put_data(skb, assoc_data->link[link_id].addr, in ieee80211_assoc_add_ml_elem()
1860 extra_elems_len - extra_used); in ieee80211_assoc_add_ml_elem()
1880 struct ieee80211_local *local = sdata->local; in ieee80211_link_common_elems_size()
1888 sband = local->hw.wiphy->bands[cbss->channel->band]; in ieee80211_link_common_elems_size()
1894 size += 4 + sband->n_bitrates; in ieee80211_link_common_elems_size()
1897 size += 2 + 2 * sband->n_channels; in ieee80211_link_common_elems_size()
1901 size += iftd->vendor_elems.len; in ieee80211_link_common_elems_size()
1913 if (sband->band == NL80211_BAND_6GHZ) in ieee80211_link_common_elems_size()
1925 struct ieee80211_local *local = sdata->local; in ieee80211_send_assoc()
1926 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_send_assoc()
1927 struct ieee80211_mgd_assoc_data *assoc_data = ifmgd->assoc_data; in ieee80211_send_assoc()
1936 enum nl80211_iftype iftype = ieee80211_vif_type_p2p(&sdata->vif); in ieee80211_send_assoc()
1945 if (assoc_data->ie_len) in ieee80211_send_assoc()
1947 assoc_data->ie, in ieee80211_send_assoc()
1948 assoc_data->ie_len); in ieee80211_send_assoc()
1950 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_send_assoc()
1952 size = local->hw.extra_tx_headroom + in ieee80211_send_assoc()
1954 2 + assoc_data->ssid_len + /* SSID */ in ieee80211_send_assoc()
1955 assoc_data->ie_len + /* extra IEs */ in ieee80211_send_assoc()
1956 (assoc_data->fils_kek_len ? 16 /* AES-SIV */ : 0) + in ieee80211_send_assoc()
1960 struct cfg80211_bss *cbss = assoc_data->link[link_id].bss; in ieee80211_send_assoc()
1961 size_t elems_len = assoc_data->link[link_id].elems_len; in ieee80211_send_assoc()
1971 /* non-inheritance element */ in ieee80211_send_assoc()
1975 if (cbss->capability & WLAN_CAPABILITY_PRIVACY) in ieee80211_send_assoc()
1979 if (ieee80211_vif_is_mld(&sdata->vif)) { in ieee80211_send_assoc()
1980 /* consider the multi-link element with STA profile */ in ieee80211_send_assoc()
1982 /* max common info field in basic multi-link element */ in ieee80211_send_assoc()
1989 * note this over-estimates a bit because there's no in ieee80211_send_assoc()
1992 size += (n_links - 1) * in ieee80211_send_assoc()
1998 link = sdata_dereference(sdata->link[assoc_data->assoc_link_id], sdata); in ieee80211_send_assoc()
2000 return -EINVAL; in ieee80211_send_assoc()
2002 if (WARN_ON(!assoc_data->link[assoc_data->assoc_link_id].bss)) in ieee80211_send_assoc()
2003 return -EINVAL; in ieee80211_send_assoc()
2007 return -ENOMEM; in ieee80211_send_assoc()
2009 skb_reserve(skb, local->hw.extra_tx_headroom); in ieee80211_send_assoc()
2011 if (ifmgd->flags & IEEE80211_STA_ENABLE_RRM) in ieee80211_send_assoc()
2015 if (ieee80211_hw_check(&local->hw, SUPPORTS_ONLY_HE_MULTI_BSSID) && in ieee80211_send_assoc()
2016 link->u.mgd.conn.mode >= IEEE80211_CONN_MODE_HE && in ieee80211_send_assoc()
2017 ext_capa && ext_capa->datalen >= 3) in ieee80211_send_assoc()
2018 ext_capa->data[2] |= WLAN_EXT_CAPA3_MULTI_BSSID_SUPPORT; in ieee80211_send_assoc()
2021 memcpy(mgmt->da, sdata->vif.cfg.ap_addr, ETH_ALEN); in ieee80211_send_assoc()
2022 memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); in ieee80211_send_assoc()
2023 memcpy(mgmt->bssid, sdata->vif.cfg.ap_addr, ETH_ALEN); in ieee80211_send_assoc()
2025 listen_int = cpu_to_le16(assoc_data->s1g ? in ieee80211_send_assoc()
2026 ieee80211_encode_usf(local->hw.conf.listen_interval) : in ieee80211_send_assoc()
2027 local->hw.conf.listen_interval); in ieee80211_send_assoc()
2028 if (!is_zero_ether_addr(assoc_data->prev_ap_addr)) { in ieee80211_send_assoc()
2030 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | in ieee80211_send_assoc()
2032 capab_pos = &mgmt->u.reassoc_req.capab_info; in ieee80211_send_assoc()
2033 mgmt->u.reassoc_req.listen_interval = listen_int; in ieee80211_send_assoc()
2034 memcpy(mgmt->u.reassoc_req.current_ap, in ieee80211_send_assoc()
2035 assoc_data->prev_ap_addr, ETH_ALEN); in ieee80211_send_assoc()
2039 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | in ieee80211_send_assoc()
2041 capab_pos = &mgmt->u.assoc_req.capab_info; in ieee80211_send_assoc()
2042 mgmt->u.assoc_req.listen_interval = listen_int; in ieee80211_send_assoc()
2047 pos = skb_put(skb, 2 + assoc_data->ssid_len); in ieee80211_send_assoc()
2050 *pos++ = assoc_data->ssid_len; in ieee80211_send_assoc()
2051 memcpy(pos, assoc_data->ssid, assoc_data->ssid_len); in ieee80211_send_assoc()
2059 * pre-EHT connections as we used to do. in ieee80211_send_assoc()
2061 if (link->u.mgd.conn.mode < IEEE80211_CONN_MODE_EHT && in ieee80211_send_assoc()
2062 !ieee80211_hw_check(&local->hw, STRICT)) in ieee80211_send_assoc()
2069 assoc_data->ie, in ieee80211_send_assoc()
2070 assoc_data->ie_len, in ieee80211_send_assoc()
2071 assoc_data->assoc_link_id, link, in ieee80211_send_assoc()
2075 /* if present, add any custom non-vendor IEs */ in ieee80211_send_assoc()
2076 if (assoc_data->ie_len) { in ieee80211_send_assoc()
2077 noffset = ieee80211_ie_split_vendor(assoc_data->ie, in ieee80211_send_assoc()
2078 assoc_data->ie_len, in ieee80211_send_assoc()
2080 skb_put_data(skb, assoc_data->ie + offset, noffset - offset); in ieee80211_send_assoc()
2084 if (assoc_data->wmm) { in ieee80211_send_assoc()
2085 if (assoc_data->uapsd) { in ieee80211_send_assoc()
2086 qos_info = ifmgd->uapsd_queues; in ieee80211_send_assoc()
2087 qos_info |= (ifmgd->uapsd_max_sp_len << in ieee80211_send_assoc()
2097 if (assoc_data->ie_len) { in ieee80211_send_assoc()
2098 noffset = assoc_data->ie_len; in ieee80211_send_assoc()
2099 skb_put_data(skb, assoc_data->ie + offset, noffset - offset); in ieee80211_send_assoc()
2102 if (assoc_data->fils_kek_len) { in ieee80211_send_assoc()
2111 kfree(ifmgd->assoc_req_ies); in ieee80211_send_assoc()
2112 ifmgd->assoc_req_ies = kmemdup(ie_start, pos - ie_start, GFP_ATOMIC); in ieee80211_send_assoc()
2113 if (!ifmgd->assoc_req_ies) { in ieee80211_send_assoc()
2115 return -ENOMEM; in ieee80211_send_assoc()
2118 ifmgd->assoc_req_ies_len = pos - ie_start; in ieee80211_send_assoc()
2120 info.link_id = assoc_data->assoc_link_id; in ieee80211_send_assoc()
2123 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; in ieee80211_send_assoc()
2124 if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) in ieee80211_send_assoc()
2125 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS | in ieee80211_send_assoc()
2138 skb = ieee80211_pspoll_get(&local->hw, &sdata->vif); in ieee80211_send_pspoll()
2142 pspoll = (struct ieee80211_pspoll *) skb->data; in ieee80211_send_pspoll()
2143 pspoll->frame_control |= cpu_to_le16(IEEE80211_FCTL_PM); in ieee80211_send_pspoll()
2145 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; in ieee80211_send_pspoll()
2155 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_send_nullfunc()
2157 skb = ieee80211_nullfunc_get(&local->hw, &sdata->vif, -1, in ieee80211_send_nullfunc()
2158 !ieee80211_hw_check(&local->hw, in ieee80211_send_nullfunc()
2163 nullfunc = (struct ieee80211_hdr_3addr *) skb->data; in ieee80211_send_nullfunc()
2165 nullfunc->frame_control |= cpu_to_le16(IEEE80211_FCTL_PM); in ieee80211_send_nullfunc()
2167 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT | in ieee80211_send_nullfunc()
2170 if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) in ieee80211_send_nullfunc()
2171 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS; in ieee80211_send_nullfunc()
2173 if (ifmgd->flags & IEEE80211_STA_CONNECTION_POLL) in ieee80211_send_nullfunc()
2174 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_CTL_USE_MINRATE; in ieee80211_send_nullfunc()
2186 if (WARN_ON(sdata->vif.type != NL80211_IFTYPE_STATION)) in ieee80211_send_4addr_nullfunc()
2189 skb = dev_alloc_skb(local->hw.extra_tx_headroom + 30); in ieee80211_send_4addr_nullfunc()
2193 skb_reserve(skb, local->hw.extra_tx_headroom); in ieee80211_send_4addr_nullfunc()
2198 nullfunc->frame_control = fc; in ieee80211_send_4addr_nullfunc()
2199 memcpy(nullfunc->addr1, sdata->deflink.u.mgd.bssid, ETH_ALEN); in ieee80211_send_4addr_nullfunc()
2200 memcpy(nullfunc->addr2, sdata->vif.addr, ETH_ALEN); in ieee80211_send_4addr_nullfunc()
2201 memcpy(nullfunc->addr3, sdata->deflink.u.mgd.bssid, ETH_ALEN); in ieee80211_send_4addr_nullfunc()
2202 memcpy(nullfunc->addr4, sdata->vif.addr, ETH_ALEN); in ieee80211_send_4addr_nullfunc()
2204 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; in ieee80211_send_4addr_nullfunc()
2205 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_CTL_USE_MINRATE; in ieee80211_send_4addr_nullfunc()
2216 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_csa_switch_work()
2217 struct ieee80211_local *local = sdata->local; in ieee80211_csa_switch_work()
2218 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_csa_switch_work()
2224 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_csa_switch_work()
2226 if (!ifmgd->associated) in ieee80211_csa_switch_work()
2229 if (!link->conf->csa_active) in ieee80211_csa_switch_work()
2237 if (!ieee80211_vif_link_active(&sdata->vif, link->link_id)) { in ieee80211_csa_switch_work()
2238 link->conf->chanreq = link->csa.chanreq; in ieee80211_csa_switch_work()
2239 cfg80211_ch_switch_notify(sdata->dev, &link->csa.chanreq.oper, in ieee80211_csa_switch_work()
2240 link->link_id); in ieee80211_csa_switch_work()
2246 * with multi-vif. once reservation is complete it will re-schedule the in ieee80211_csa_switch_work()
2251 if (link->reserved_chanctx) { in ieee80211_csa_switch_work()
2253 * with multi-vif csa driver may call ieee80211_csa_finish() in ieee80211_csa_switch_work()
2257 if (link->reserved_ready) in ieee80211_csa_switch_work()
2265 wiphy_work_queue(sdata->local->hw.wiphy, in ieee80211_csa_switch_work()
2266 &ifmgd->csa_connection_drop_work); in ieee80211_csa_switch_work()
2271 if (!ieee80211_chanreq_identical(&link->conf->chanreq, in ieee80211_csa_switch_work()
2272 &link->csa.chanreq)) { in ieee80211_csa_switch_work()
2275 wiphy_work_queue(sdata->local->hw.wiphy, in ieee80211_csa_switch_work()
2276 &ifmgd->csa_connection_drop_work); in ieee80211_csa_switch_work()
2280 link->u.mgd.csa.waiting_bcn = true; in ieee80211_csa_switch_work()
2283 if (link->u.mgd.csa.ap_chandef.chan->band == NL80211_BAND_6GHZ && in ieee80211_csa_switch_work()
2284 link->u.mgd.conn.mode >= IEEE80211_CONN_MODE_HE) { in ieee80211_csa_switch_work()
2285 ieee80211_rearrange_tpe(&link->u.mgd.csa.tpe, in ieee80211_csa_switch_work()
2286 &link->u.mgd.csa.ap_chandef, in ieee80211_csa_switch_work()
2287 &link->conf->chanreq.oper); in ieee80211_csa_switch_work()
2288 if (memcmp(&link->conf->tpe, &link->u.mgd.csa.tpe, in ieee80211_csa_switch_work()
2289 sizeof(link->u.mgd.csa.tpe))) { in ieee80211_csa_switch_work()
2290 link->conf->tpe = link->u.mgd.csa.tpe; in ieee80211_csa_switch_work()
2302 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_chswitch_post_beacon()
2303 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_chswitch_post_beacon()
2306 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_chswitch_post_beacon()
2308 WARN_ON(!link->conf->csa_active); in ieee80211_chswitch_post_beacon()
2312 link->conf->csa_active = false; in ieee80211_chswitch_post_beacon()
2313 link->u.mgd.csa.blocked_tx = false; in ieee80211_chswitch_post_beacon()
2314 link->u.mgd.csa.waiting_bcn = false; in ieee80211_chswitch_post_beacon()
2320 wiphy_work_queue(sdata->local->hw.wiphy, in ieee80211_chswitch_post_beacon()
2321 &ifmgd->csa_connection_drop_work); in ieee80211_chswitch_post_beacon()
2325 cfg80211_ch_switch_notify(sdata->dev, &link->conf->chanreq.oper, in ieee80211_chswitch_post_beacon()
2326 link->link_id); in ieee80211_chswitch_post_beacon()
2342 wiphy_work_queue(sdata->local->hw.wiphy, in ieee80211_chswitch_done()
2343 &sdata->u.mgd.csa_connection_drop_work); in ieee80211_chswitch_done()
2346 rcu_dereference(sdata->link[link_id]); in ieee80211_chswitch_done()
2353 wiphy_delayed_work_queue(sdata->local->hw.wiphy, in ieee80211_chswitch_done()
2354 &link->u.mgd.csa.switch_work, 0); in ieee80211_chswitch_done()
2364 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_sta_abort_chanswitch()
2365 struct ieee80211_local *local = sdata->local; in ieee80211_sta_abort_chanswitch()
2367 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_sta_abort_chanswitch()
2369 if (!local->ops->abort_channel_switch) in ieee80211_sta_abort_chanswitch()
2376 link->conf->csa_active = false; in ieee80211_sta_abort_chanswitch()
2377 link->u.mgd.csa.blocked_tx = false; in ieee80211_sta_abort_chanswitch()
2394 struct ieee80211_link_data *link = data->link; in ieee80211_sta_csa_rnr_iter()
2395 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_sta_csa_rnr_iter()
2396 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_sta_csa_rnr_iter()
2410 if (ti->mld_params.mld_id != data->mld_id) in ieee80211_sta_csa_rnr_iter()
2413 link_id = le16_get_bits(ti->mld_params.params, in ieee80211_sta_csa_rnr_iter()
2415 if (link_id != data->link->link_id) in ieee80211_sta_csa_rnr_iter()
2421 if (!ieee80211_operating_class_to_band(info->op_class, &band)) { in ieee80211_sta_csa_rnr_iter()
2424 wiphy_work_queue(sdata->local->hw.wiphy, in ieee80211_sta_csa_rnr_iter()
2425 &ifmgd->csa_connection_drop_work); in ieee80211_sta_csa_rnr_iter()
2429 center_freq = ieee80211_channel_to_frequency(info->channel, band); in ieee80211_sta_csa_rnr_iter()
2430 data->chan = ieee80211_get_channel(sdata->local->hw.wiphy, center_freq); in ieee80211_sta_csa_rnr_iter()
2439 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_sta_other_link_csa_disappeared()
2440 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_sta_other_link_csa_disappeared()
2455 if (WARN_ON(!elems->ml_basic)) in ieee80211_sta_other_link_csa_disappeared()
2458 data.mld_id = ieee80211_mle_get_mld_id((const void *)elems->ml_basic); in ieee80211_sta_other_link_csa_disappeared()
2464 cfg80211_iter_rnr(elems->ie_start, elems->total_len, in ieee80211_sta_other_link_csa_disappeared()
2470 wiphy_work_queue(sdata->local->hw.wiphy, in ieee80211_sta_other_link_csa_disappeared()
2471 &ifmgd->csa_connection_drop_work); in ieee80211_sta_other_link_csa_disappeared()
2482 if (data.chan != link->csa.chanreq.oper.chan) in ieee80211_sta_other_link_csa_disappeared()
2500 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_sta_process_chanswitch()
2501 struct ieee80211_local *local = sdata->local; in ieee80211_sta_process_chanswitch()
2502 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_sta_process_chanswitch()
2507 .link_id = link->link_id, in ieee80211_sta_process_chanswitch()
2514 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_sta_process_chanswitch()
2517 struct cfg80211_bss *cbss = link->conf->bss; in ieee80211_sta_process_chanswitch()
2524 current_band = cbss->channel->band; in ieee80211_sta_process_chanswitch()
2525 bss = (void *)cbss->priv; in ieee80211_sta_process_chanswitch()
2529 bss->vht_cap_info, in ieee80211_sta_process_chanswitch()
2530 &link->u.mgd.conn, in ieee80211_sta_process_chanswitch()
2531 link->u.mgd.bssid, in ieee80211_sta_process_chanswitch()
2541 link->u.mgd.csa.tpe = csa_elems->csa_tpe; in ieee80211_sta_process_chanswitch()
2544 * If there was no per-STA profile for this link, we in ieee80211_sta_process_chanswitch()
2559 if (link->conf->csa_active) { in ieee80211_sta_process_chanswitch()
2563 /* already processing - disregard action frames */ in ieee80211_sta_process_chanswitch()
2566 if (link->u.mgd.csa.waiting_bcn) { in ieee80211_sta_process_chanswitch()
2584 if (ieee80211_vif_link_active(&sdata->vif, in ieee80211_sta_process_chanswitch()
2585 link->link_id)) in ieee80211_sta_process_chanswitch()
2589 if (link->u.mgd.csa.waiting_bcn) { in ieee80211_sta_process_chanswitch()
2616 * bit set. This is a trade-off, we want to be quiet as soon as in ieee80211_sta_process_chanswitch()
2620 if (unlikely(link->u.mgd.csa.blocked_tx)) { in ieee80211_sta_process_chanswitch()
2621 link->u.mgd.csa.blocked_tx = false; in ieee80211_sta_process_chanswitch()
2635 link->u.mgd.csa.blocked_tx = true; in ieee80211_sta_process_chanswitch()
2641 if (link->conf->chanreq.oper.chan->band != in ieee80211_sta_process_chanswitch()
2642 csa_ie.chanreq.oper.chan->band) { in ieee80211_sta_process_chanswitch()
2645 link->u.mgd.bssid, in ieee80211_sta_process_chanswitch()
2646 csa_ie.chanreq.oper.chan->center_freq, in ieee80211_sta_process_chanswitch()
2653 if (!cfg80211_chandef_usable(local->hw.wiphy, &csa_ie.chanreq.oper, in ieee80211_sta_process_chanswitch()
2657 link->u.mgd.bssid, in ieee80211_sta_process_chanswitch()
2658 csa_ie.chanreq.oper.chan->center_freq, in ieee80211_sta_process_chanswitch()
2659 csa_ie.chanreq.oper.chan->freq_offset, in ieee80211_sta_process_chanswitch()
2668 &link->conf->chanreq.oper) && in ieee80211_sta_process_chanswitch()
2670 if (link->u.mgd.csa.ignored_same_chan) in ieee80211_sta_process_chanswitch()
2674 link->u.mgd.bssid); in ieee80211_sta_process_chanswitch()
2675 link->u.mgd.csa.ignored_same_chan = true; in ieee80211_sta_process_chanswitch()
2680 * Drop all TDLS peers on the affected link - either we disconnect or in ieee80211_sta_process_chanswitch()
2688 conf = rcu_dereference_protected(link->conf->chanctx_conf, in ieee80211_sta_process_chanswitch()
2689 lockdep_is_held(&local->hw.wiphy->mtx)); in ieee80211_sta_process_chanswitch()
2690 if (ieee80211_vif_link_active(&sdata->vif, link->link_id) && !conf) { in ieee80211_sta_process_chanswitch()
2699 if (!ieee80211_hw_check(&local->hw, CHANCTX_STA_CSA)) { in ieee80211_sta_process_chanswitch()
2701 "driver doesn't support chan-switch with channel contexts\n"); in ieee80211_sta_process_chanswitch()
2711 link->u.mgd.csa.ap_chandef = csa_ie.chanreq.ap; in ieee80211_sta_process_chanswitch()
2713 link->csa.chanreq.oper = csa_ie.chanreq.oper; in ieee80211_sta_process_chanswitch()
2714 ieee80211_set_chanreq_ap(sdata, &link->csa.chanreq, &link->u.mgd.conn, in ieee80211_sta_process_chanswitch()
2718 res = ieee80211_link_reserve_chanctx(link, &link->csa.chanreq, in ieee80211_sta_process_chanswitch()
2719 chanctx->mode, false); in ieee80211_sta_process_chanswitch()
2728 link->conf->csa_active = true; in ieee80211_sta_process_chanswitch()
2729 link->u.mgd.csa.ignored_same_chan = false; in ieee80211_sta_process_chanswitch()
2730 link->u.mgd.beacon_crc_valid = false; in ieee80211_sta_process_chanswitch()
2731 link->u.mgd.csa.blocked_tx = csa_ie.mode; in ieee80211_sta_process_chanswitch()
2736 cfg80211_ch_switch_started_notify(sdata->dev, &csa_ie.chanreq.oper, in ieee80211_sta_process_chanswitch()
2737 link->link_id, csa_ie.count, in ieee80211_sta_process_chanswitch()
2742 link->u.mgd.csa.time = now + in ieee80211_sta_process_chanswitch()
2743 TU_TO_JIFFIES((max_t(int, csa_ie.count, 1) - 1) * in ieee80211_sta_process_chanswitch()
2744 link->conf->beacon_int); in ieee80211_sta_process_chanswitch()
2746 if (ieee80211_vif_link_active(&sdata->vif, link->link_id) && in ieee80211_sta_process_chanswitch()
2747 local->ops->channel_switch) { in ieee80211_sta_process_chanswitch()
2759 wiphy_delayed_work_queue(local->hw.wiphy, in ieee80211_sta_process_chanswitch()
2760 &link->u.mgd.csa.switch_work, in ieee80211_sta_process_chanswitch()
2761 link->u.mgd.csa.time - now); in ieee80211_sta_process_chanswitch()
2771 link->conf->csa_active = true; in ieee80211_sta_process_chanswitch()
2772 link->u.mgd.csa.blocked_tx = csa_ie.mode; in ieee80211_sta_process_chanswitch()
2774 wiphy_work_queue(sdata->local->hw.wiphy, in ieee80211_sta_process_chanswitch()
2775 &ifmgd->csa_connection_drop_work); in ieee80211_sta_process_chanswitch()
2790 struct ieee80211_sub_if_data *sdata = data->sdata; in ieee80211_sta_bss_param_ch_cnt_iter()
2803 if (ti->mld_params.mld_id != data->mld_id) in ieee80211_sta_bss_param_ch_cnt_iter()
2806 link_id = le16_get_bits(ti->mld_params.params, in ieee80211_sta_bss_param_ch_cnt_iter()
2809 le16_get_bits(ti->mld_params.params, in ieee80211_sta_bss_param_ch_cnt_iter()
2813 link_id < ARRAY_SIZE(sdata->link)) { in ieee80211_sta_bss_param_ch_cnt_iter()
2815 sdata_dereference(sdata->link[link_id], sdata); in ieee80211_sta_bss_param_ch_cnt_iter()
2817 if (link && link->conf->bss_param_ch_cnt != bss_param_ch_cnt) { in ieee80211_sta_bss_param_ch_cnt_iter()
2818 link->conf->bss_param_ch_cnt = bss_param_ch_cnt; in ieee80211_sta_bss_param_ch_cnt_iter()
2819 link->conf->bss_param_ch_cnt_link_id = in ieee80211_sta_bss_param_ch_cnt_iter()
2820 data->reporting_link_id; in ieee80211_sta_bss_param_ch_cnt_iter()
2833 .reporting_link_id = bss_conf->link_id, in ieee80211_mgd_update_bss_param_ch_cnt()
2838 if (!elems->ml_basic) in ieee80211_mgd_update_bss_param_ch_cnt()
2841 data.mld_id = ieee80211_mle_get_mld_id((const void *)elems->ml_basic); in ieee80211_mgd_update_bss_param_ch_cnt()
2843 cfg80211_iter_rnr(elems->ie_start, elems->total_len, in ieee80211_mgd_update_bss_param_ch_cnt()
2847 ieee80211_mle_get_bss_param_ch_cnt((const void *)elems->ml_basic); in ieee80211_mgd_update_bss_param_ch_cnt()
2855 bss_conf->bss_param_ch_cnt = bss_param_ch_cnt; in ieee80211_mgd_update_bss_param_ch_cnt()
2856 bss_conf->bss_param_ch_cnt_link_id = in ieee80211_mgd_update_bss_param_ch_cnt()
2857 bss_conf->link_id; in ieee80211_mgd_update_bss_param_ch_cnt()
2868 int chan = ieee80211_frequency_to_channel(channel->center_freq); in ieee80211_find_80211h_pwr_constr()
2877 country_ie_len -= 3; in ieee80211_find_80211h_pwr_constr()
2879 switch (channel->band) { in ieee80211_find_80211h_pwr_constr()
2904 u8 first_channel = triplet->chans.first_channel; in ieee80211_find_80211h_pwr_constr()
2909 for (i = 0; i < triplet->chans.num_channels; i++) { in ieee80211_find_80211h_pwr_constr()
2912 *chan_pwr = triplet->chans.max_power; in ieee80211_find_80211h_pwr_constr()
2921 country_ie_len -= 3; in ieee80211_find_80211h_pwr_constr()
2938 * APs clearly state the range is -127 to 127 dBm, which indicates in ieee80211_find_cisco_dtpc()
2952 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_handle_pwr_constr()
2957 __le16 capab = mgmt->u.probe_resp.capab_info; in ieee80211_handle_pwr_constr()
2959 if (ieee80211_is_s1g_beacon(mgmt->frame_control)) in ieee80211_handle_pwr_constr()
2969 max_t(int, 0, chan_pwr - pwr_reduction_80211h); in ieee80211_handle_pwr_constr()
2988 if (link->ap_power_level == new_ap_level) in ieee80211_handle_pwr_constr()
2992 "Limiting TX power to %d (%d - %d) dBm as advertised by %pM\n", in ieee80211_handle_pwr_constr()
2994 link->u.mgd.bssid); in ieee80211_handle_pwr_constr()
2998 if (link->ap_power_level == new_ap_level) in ieee80211_handle_pwr_constr()
3003 pwr_level_cisco, link->u.mgd.bssid); in ieee80211_handle_pwr_constr()
3006 link->ap_power_level = new_ap_level; in ieee80211_handle_pwr_constr()
3016 struct ieee80211_conf *conf = &local->hw.conf; in ieee80211_enable_ps()
3022 if (local->scanning) in ieee80211_enable_ps()
3025 if (conf->dynamic_ps_timeout > 0 && in ieee80211_enable_ps()
3026 !ieee80211_hw_check(&local->hw, SUPPORTS_DYNAMIC_PS)) { in ieee80211_enable_ps()
3027 mod_timer(&local->dynamic_ps_timer, jiffies + in ieee80211_enable_ps()
3028 msecs_to_jiffies(conf->dynamic_ps_timeout)); in ieee80211_enable_ps()
3030 if (ieee80211_hw_check(&local->hw, PS_NULLFUNC_STACK)) in ieee80211_enable_ps()
3033 if (ieee80211_hw_check(&local->hw, PS_NULLFUNC_STACK) && in ieee80211_enable_ps()
3034 ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) in ieee80211_enable_ps()
3037 conf->flags |= IEEE80211_CONF_PS; in ieee80211_enable_ps()
3044 struct ieee80211_conf *conf = &local->hw.conf; in ieee80211_change_ps()
3046 if (local->ps_sdata) { in ieee80211_change_ps()
3047 ieee80211_enable_ps(local, local->ps_sdata); in ieee80211_change_ps()
3048 } else if (conf->flags & IEEE80211_CONF_PS) { in ieee80211_change_ps()
3049 conf->flags &= ~IEEE80211_CONF_PS; in ieee80211_change_ps()
3051 del_timer_sync(&local->dynamic_ps_timer); in ieee80211_change_ps()
3052 wiphy_work_cancel(local->hw.wiphy, in ieee80211_change_ps()
3053 &local->dynamic_ps_enable_work); in ieee80211_change_ps()
3059 struct ieee80211_local *local = sdata->local; in ieee80211_powersave_allowed()
3060 struct ieee80211_if_managed *mgd = &sdata->u.mgd; in ieee80211_powersave_allowed()
3064 if (!mgd->powersave) in ieee80211_powersave_allowed()
3067 if (mgd->broken_ap) in ieee80211_powersave_allowed()
3070 if (!mgd->associated) in ieee80211_powersave_allowed()
3073 if (mgd->flags & IEEE80211_STA_CONNECTION_POLL) in ieee80211_powersave_allowed()
3076 if (!(local->hw.wiphy->flags & WIPHY_FLAG_SUPPORTS_MLO) && in ieee80211_powersave_allowed()
3077 !sdata->deflink.u.mgd.have_beacon) in ieee80211_powersave_allowed()
3081 sta = sta_info_get(sdata, sdata->vif.cfg.ap_addr); in ieee80211_powersave_allowed()
3096 if (!ieee80211_hw_check(&local->hw, SUPPORTS_PS) || in ieee80211_recalc_ps()
3097 ieee80211_hw_check(&local->hw, SUPPORTS_DYNAMIC_PS)) { in ieee80211_recalc_ps()
3098 local->ps_sdata = NULL; in ieee80211_recalc_ps()
3102 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_recalc_ps()
3105 if (sdata->vif.type == NL80211_IFTYPE_AP) { in ieee80211_recalc_ps()
3113 if (sdata->vif.type != NL80211_IFTYPE_STATION) in ieee80211_recalc_ps()
3120 u8 dtimper = found->deflink.u.mgd.dtim_period; in ieee80211_recalc_ps()
3122 timeout = local->dynamic_ps_forced_timeout; in ieee80211_recalc_ps()
3125 local->hw.conf.dynamic_ps_timeout = timeout; in ieee80211_recalc_ps()
3131 local->hw.conf.ps_dtim_period = dtimper; in ieee80211_recalc_ps()
3132 local->ps_sdata = found; in ieee80211_recalc_ps()
3134 local->ps_sdata = NULL; in ieee80211_recalc_ps()
3144 if (sdata->vif.cfg.ps != ps_allowed) { in ieee80211_recalc_ps_vif()
3145 sdata->vif.cfg.ps = ps_allowed; in ieee80211_recalc_ps_vif()
3157 if (local->hw.conf.flags & IEEE80211_CONF_PS) { in ieee80211_dynamic_ps_disable_work()
3158 local->hw.conf.flags &= ~IEEE80211_CONF_PS; in ieee80211_dynamic_ps_disable_work()
3162 ieee80211_wake_queues_by_reason(&local->hw, in ieee80211_dynamic_ps_disable_work()
3174 struct ieee80211_sub_if_data *sdata = local->ps_sdata; in ieee80211_dynamic_ps_enable_work()
3183 ifmgd = &sdata->u.mgd; in ieee80211_dynamic_ps_enable_work()
3185 if (local->hw.conf.flags & IEEE80211_CONF_PS) in ieee80211_dynamic_ps_enable_work()
3188 if (local->hw.conf.dynamic_ps_timeout > 0) { in ieee80211_dynamic_ps_enable_work()
3191 mod_timer(&local->dynamic_ps_timer, jiffies + in ieee80211_dynamic_ps_enable_work()
3193 local->hw.conf.dynamic_ps_timeout)); in ieee80211_dynamic_ps_enable_work()
3202 spin_lock_irqsave(&local->queue_stop_reason_lock, flags); in ieee80211_dynamic_ps_enable_work()
3203 for (q = 0; q < local->hw.queues; q++) { in ieee80211_dynamic_ps_enable_work()
3204 if (local->queue_stop_reasons[q]) { in ieee80211_dynamic_ps_enable_work()
3205 spin_unlock_irqrestore(&local->queue_stop_reason_lock, in ieee80211_dynamic_ps_enable_work()
3207 mod_timer(&local->dynamic_ps_timer, jiffies + in ieee80211_dynamic_ps_enable_work()
3209 local->hw.conf.dynamic_ps_timeout)); in ieee80211_dynamic_ps_enable_work()
3213 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); in ieee80211_dynamic_ps_enable_work()
3216 if (ieee80211_hw_check(&local->hw, PS_NULLFUNC_STACK) && in ieee80211_dynamic_ps_enable_work()
3217 !(ifmgd->flags & IEEE80211_STA_NULLFUNC_ACKED)) { in ieee80211_dynamic_ps_enable_work()
3219 mod_timer(&local->dynamic_ps_timer, jiffies + in ieee80211_dynamic_ps_enable_work()
3221 local->hw.conf.dynamic_ps_timeout)); in ieee80211_dynamic_ps_enable_work()
3229 if (!(ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS) && in ieee80211_dynamic_ps_enable_work()
3230 ieee80211_hw_check(&local->hw, PS_NULLFUNC_STACK)) || in ieee80211_dynamic_ps_enable_work()
3231 (ifmgd->flags & IEEE80211_STA_NULLFUNC_ACKED)) { in ieee80211_dynamic_ps_enable_work()
3232 ifmgd->flags &= ~IEEE80211_STA_NULLFUNC_ACKED; in ieee80211_dynamic_ps_enable_work()
3233 local->hw.conf.flags |= IEEE80211_CONF_PS; in ieee80211_dynamic_ps_enable_work()
3242 wiphy_work_queue(local->hw.wiphy, &local->dynamic_ps_enable_work); in ieee80211_dynamic_ps_timer()
3250 struct cfg80211_chan_def chandef = link->conf->chanreq.oper; in ieee80211_dfs_cac_timer_work()
3251 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_dfs_cac_timer_work()
3253 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_dfs_cac_timer_work()
3255 if (sdata->wdev.links[link->link_id].cac_started) { in ieee80211_dfs_cac_timer_work()
3257 cfg80211_cac_event(sdata->dev, &chandef, in ieee80211_dfs_cac_timer_work()
3259 GFP_KERNEL, link->link_id); in ieee80211_dfs_cac_timer_work()
3266 struct ieee80211_local *local = sdata->local; in __ieee80211_sta_handle_tspec_ac_params()
3267 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in __ieee80211_sta_handle_tspec_ac_params()
3271 if (local->hw.queues < IEEE80211_NUM_ACS) in __ieee80211_sta_handle_tspec_ac_params()
3275 struct ieee80211_sta_tx_tspec *tx_tspec = &ifmgd->tx_tspec[ac]; in __ieee80211_sta_handle_tspec_ac_params()
3279 if (tx_tspec->action == TX_TSPEC_ACTION_NONE && in __ieee80211_sta_handle_tspec_ac_params()
3280 tx_tspec->admitted_time && in __ieee80211_sta_handle_tspec_ac_params()
3281 time_after(now, tx_tspec->time_slice_start + HZ)) { in __ieee80211_sta_handle_tspec_ac_params()
3282 tx_tspec->consumed_tx_time = 0; in __ieee80211_sta_handle_tspec_ac_params()
3283 tx_tspec->time_slice_start = now; in __ieee80211_sta_handle_tspec_ac_params()
3285 if (tx_tspec->downgraded) in __ieee80211_sta_handle_tspec_ac_params()
3286 tx_tspec->action = in __ieee80211_sta_handle_tspec_ac_params()
3290 switch (tx_tspec->action) { in __ieee80211_sta_handle_tspec_ac_params()
3293 if (drv_conf_tx(local, &sdata->deflink, ac, in __ieee80211_sta_handle_tspec_ac_params()
3294 &sdata->deflink.tx_conf[ac])) in __ieee80211_sta_handle_tspec_ac_params()
3295 link_err(&sdata->deflink, in __ieee80211_sta_handle_tspec_ac_params()
3298 tx_tspec->action = TX_TSPEC_ACTION_NONE; in __ieee80211_sta_handle_tspec_ac_params()
3299 tx_tspec->downgraded = false; in __ieee80211_sta_handle_tspec_ac_params()
3303 if (time_after(now, tx_tspec->time_slice_start + HZ)) { in __ieee80211_sta_handle_tspec_ac_params()
3304 tx_tspec->action = TX_TSPEC_ACTION_NONE; in __ieee80211_sta_handle_tspec_ac_params()
3308 /* downgrade next lower non-ACM AC */ in __ieee80211_sta_handle_tspec_ac_params()
3312 if (!(sdata->wmm_acm & BIT(7 - 2 * non_acm_ac))) in __ieee80211_sta_handle_tspec_ac_params()
3316 * makes no sense and we have to transmit somehow - the in __ieee80211_sta_handle_tspec_ac_params()
3323 if (drv_conf_tx(local, &sdata->deflink, ac, in __ieee80211_sta_handle_tspec_ac_params()
3324 &sdata->deflink.tx_conf[non_acm_ac])) in __ieee80211_sta_handle_tspec_ac_params()
3325 link_err(&sdata->deflink, in __ieee80211_sta_handle_tspec_ac_params()
3328 tx_tspec->action = TX_TSPEC_ACTION_NONE; in __ieee80211_sta_handle_tspec_ac_params()
3330 wiphy_delayed_work_queue(local->hw.wiphy, in __ieee80211_sta_handle_tspec_ac_params()
3331 &ifmgd->tx_tspec_wk, in __ieee80211_sta_handle_tspec_ac_params()
3332 tx_tspec->time_slice_start + in __ieee80211_sta_handle_tspec_ac_params()
3333 HZ - now + 1); in __ieee80211_sta_handle_tspec_ac_params()
3347 ieee80211_link_info_change_notify(sdata, &sdata->deflink, in ieee80211_sta_handle_tspec_ac_params()
3363 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_mgd_set_link_qos_params()
3364 struct ieee80211_local *local = sdata->local; in ieee80211_mgd_set_link_qos_params()
3365 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_mgd_set_link_qos_params()
3366 struct ieee80211_tx_queue_params *params = link->tx_conf; in ieee80211_mgd_set_link_qos_params()
3375 ifmgd->tx_tspec[ac].downgraded); in ieee80211_mgd_set_link_qos_params()
3376 if (!ifmgd->tx_tspec[ac].downgraded && in ieee80211_mgd_set_link_qos_params()
3391 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_sta_wmm_params()
3393 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_sta_wmm_params()
3399 if (!local->ops->conf_tx) in ieee80211_sta_wmm_params()
3402 if (local->hw.queues < IEEE80211_NUM_ACS) in ieee80211_sta_wmm_params()
3411 if (ifmgd->flags & IEEE80211_STA_UAPSD_ENABLED) in ieee80211_sta_wmm_params()
3412 uapsd_queues = ifmgd->uapsd_queues; in ieee80211_sta_wmm_params()
3415 /* -1 is the initial value of ifmgd->mu_edca_last_param_set. in ieee80211_sta_wmm_params()
3419 mu_edca_count = mu_edca ? mu_edca->mu_qos_info & 0x0f : -1; in ieee80211_sta_wmm_params()
3420 if (count == link->u.mgd.wmm_last_param_set && in ieee80211_sta_wmm_params()
3421 mu_edca_count == link->u.mgd.mu_edca_last_param_set) in ieee80211_sta_wmm_params()
3423 link->u.mgd.wmm_last_param_set = count; in ieee80211_sta_wmm_params()
3424 link->u.mgd.mu_edca_last_param_set = mu_edca_count; in ieee80211_sta_wmm_params()
3427 left = wmm_param_len - 8; in ieee80211_sta_wmm_params()
3431 sdata->wmm_acm = 0; in ieee80211_sta_wmm_params()
3432 for (; left >= 4; left -= 4, pos += 4) { in ieee80211_sta_wmm_params()
3441 sdata->wmm_acm |= BIT(1) | BIT(2); /* BK/- */ in ieee80211_sta_wmm_params()
3446 params[ac].mu_edca_param_rec = mu_edca->ac_bk; in ieee80211_sta_wmm_params()
3451 sdata->wmm_acm |= BIT(4) | BIT(5); /* CL/VI */ in ieee80211_sta_wmm_params()
3456 params[ac].mu_edca_param_rec = mu_edca->ac_vi; in ieee80211_sta_wmm_params()
3461 sdata->wmm_acm |= BIT(6) | BIT(7); /* VO/NC */ in ieee80211_sta_wmm_params()
3466 params[ac].mu_edca_param_rec = mu_edca->ac_vo; in ieee80211_sta_wmm_params()
3472 sdata->wmm_acm |= BIT(0) | BIT(3); /* BE/EE */ in ieee80211_sta_wmm_params()
3477 params[ac].mu_edca_param_rec = mu_edca->ac_be; in ieee80211_sta_wmm_params()
3516 link->tx_conf[ac] = params[ac]; in ieee80211_sta_wmm_params()
3521 link->conf->qos = true; in ieee80211_sta_wmm_params()
3527 lockdep_assert_wiphy(sdata->local->hw.wiphy); in __ieee80211_stop_poll()
3529 sdata->u.mgd.flags &= ~IEEE80211_STA_CONNECTION_POLL; in __ieee80211_stop_poll()
3530 ieee80211_run_deferred_scan(sdata->local); in __ieee80211_stop_poll()
3535 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_stop_poll()
3543 struct ieee80211_bss_conf *bss_conf = link->conf; in ieee80211_handle_bss_capability()
3563 if (sband->band == NL80211_BAND_5GHZ || in ieee80211_handle_bss_capability()
3564 sband->band == NL80211_BAND_6GHZ) in ieee80211_handle_bss_capability()
3567 if (use_protection != bss_conf->use_cts_prot) { in ieee80211_handle_bss_capability()
3568 bss_conf->use_cts_prot = use_protection; in ieee80211_handle_bss_capability()
3572 if (use_short_preamble != bss_conf->use_short_preamble) { in ieee80211_handle_bss_capability()
3573 bss_conf->use_short_preamble = use_short_preamble; in ieee80211_handle_bss_capability()
3577 if (use_short_slot != bss_conf->use_short_slot) { in ieee80211_handle_bss_capability()
3578 bss_conf->use_short_slot = use_short_slot; in ieee80211_handle_bss_capability()
3588 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_link_set_associated()
3589 struct ieee80211_bss_conf *bss_conf = link->conf; in ieee80211_link_set_associated()
3590 struct ieee80211_bss *bss = (void *)cbss->priv; in ieee80211_link_set_associated()
3594 sdata->u.mgd.beacon_timeout = in ieee80211_link_set_associated()
3596 bss_conf->beacon_int)); in ieee80211_link_set_associated()
3599 bss_conf->assoc_capability, in ieee80211_link_set_associated()
3600 bss->has_erp_value, in ieee80211_link_set_associated()
3601 bss->erp_value); in ieee80211_link_set_associated()
3605 link->conf->bss = cbss; in ieee80211_link_set_associated()
3606 memcpy(link->u.mgd.bssid, cbss->bssid, ETH_ALEN); in ieee80211_link_set_associated()
3608 if (sdata->vif.p2p || in ieee80211_link_set_associated()
3609 sdata->vif.driver_flags & IEEE80211_VIF_GET_NOA_UPDATE) { in ieee80211_link_set_associated()
3613 ies = rcu_dereference(cbss->ies); in ieee80211_link_set_associated()
3618 ies->data, ies->len, in ieee80211_link_set_associated()
3620 (u8 *) &bss_conf->p2p_noa_attr, in ieee80211_link_set_associated()
3621 sizeof(bss_conf->p2p_noa_attr)); in ieee80211_link_set_associated()
3623 link->u.mgd.p2p_noa_index = in ieee80211_link_set_associated()
3624 bss_conf->p2p_noa_attr.index; in ieee80211_link_set_associated()
3631 if (link->u.mgd.have_beacon) { in ieee80211_link_set_associated()
3632 bss_conf->beacon_rate = bss->beacon_rate; in ieee80211_link_set_associated()
3635 bss_conf->beacon_rate = NULL; in ieee80211_link_set_associated()
3639 if (sdata->vif.driver_flags & IEEE80211_VIF_SUPPORTS_CQM_RSSI && in ieee80211_link_set_associated()
3640 bss_conf->cqm_rssi_thold) in ieee80211_link_set_associated()
3650 struct ieee80211_local *local = sdata->local; in ieee80211_set_associated()
3651 struct ieee80211_vif_cfg *vif_cfg = &sdata->vif.cfg; in ieee80211_set_associated()
3655 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_set_associated()
3657 sdata->u.mgd.associated = true; in ieee80211_set_associated()
3660 struct cfg80211_bss *cbss = assoc_data->link[link_id].bss; in ieee80211_set_associated()
3664 assoc_data->link[link_id].status != WLAN_STATUS_SUCCESS) in ieee80211_set_associated()
3667 if (ieee80211_vif_is_mld(&sdata->vif) && in ieee80211_set_associated()
3668 !(ieee80211_vif_usable_links(&sdata->vif) & BIT(link_id))) in ieee80211_set_associated()
3671 link = sdata_dereference(sdata->link[link_id], sdata); in ieee80211_set_associated()
3683 vif_cfg->assoc = 1; in ieee80211_set_associated()
3686 if (vif_cfg->arp_addr_cnt) in ieee80211_set_associated()
3689 if (ieee80211_vif_is_mld(&sdata->vif)) { in ieee80211_set_associated()
3694 struct cfg80211_bss *cbss = assoc_data->link[link_id].bss; in ieee80211_set_associated()
3698 ieee80211_vif_usable_links(&sdata->vif)) || in ieee80211_set_associated()
3699 assoc_data->link[link_id].status != WLAN_STATUS_SUCCESS) in ieee80211_set_associated()
3702 link = sdata_dereference(sdata->link[link_id], sdata); in ieee80211_set_associated()
3720 /* leave this here to not change ordering in non-MLO cases */ in ieee80211_set_associated()
3721 if (!ieee80211_vif_is_mld(&sdata->vif)) in ieee80211_set_associated()
3722 ieee80211_recalc_smps(sdata, &sdata->deflink); in ieee80211_set_associated()
3725 netif_carrier_on(sdata->dev); in ieee80211_set_associated()
3731 sdata->u.mgd.reconf.add_links_data; in ieee80211_ml_reconf_reset()
3733 if (!ieee80211_vif_is_mld(&sdata->vif) || in ieee80211_ml_reconf_reset()
3734 !(sdata->u.mgd.reconf.added_links | in ieee80211_ml_reconf_reset()
3735 sdata->u.mgd.reconf.removed_links)) in ieee80211_ml_reconf_reset()
3738 wiphy_delayed_work_cancel(sdata->local->hw.wiphy, in ieee80211_ml_reconf_reset()
3739 &sdata->u.mgd.reconf.wk); in ieee80211_ml_reconf_reset()
3740 sdata->u.mgd.reconf.added_links = 0; in ieee80211_ml_reconf_reset()
3741 sdata->u.mgd.reconf.removed_links = 0; in ieee80211_ml_reconf_reset()
3742 sdata->u.mgd.reconf.dialog_token = 0; in ieee80211_ml_reconf_reset()
3751 add_links_data->link[link_id].bss; in ieee80211_ml_reconf_reset()
3753 cfg80211_mlo_reconf_add_done(sdata->dev, &done_data); in ieee80211_ml_reconf_reset()
3755 kfree(sdata->u.mgd.reconf.add_links_data); in ieee80211_ml_reconf_reset()
3756 sdata->u.mgd.reconf.add_links_data = NULL; in ieee80211_ml_reconf_reset()
3764 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_set_disassoc()
3765 struct ieee80211_local *local = sdata->local; in ieee80211_set_disassoc()
3766 struct sta_info *ap_sta = sta_info_get(sdata, sdata->vif.cfg.ap_addr); in ieee80211_set_disassoc()
3772 .link_id = ffs(sdata->vif.active_links) - 1, in ieee80211_set_disassoc()
3775 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_set_disassoc()
3783 if (WARN_ON(!ifmgd->associated)) in ieee80211_set_disassoc()
3788 ifmgd->associated = false; in ieee80211_set_disassoc()
3791 sdata->deflink.conf->bss = NULL; in ieee80211_set_disassoc()
3792 sdata->deflink.smps_mode = IEEE80211_SMPS_OFF; in ieee80211_set_disassoc()
3794 netif_carrier_off(sdata->dev); in ieee80211_set_disassoc()
3798 * to do it before sending disassoc, as otherwise the null-packet in ieee80211_set_disassoc()
3801 if (local->hw.conf.flags & IEEE80211_CONF_PS) { in ieee80211_set_disassoc()
3802 local->hw.conf.flags &= ~IEEE80211_CONF_PS; in ieee80211_set_disassoc()
3805 local->ps_sdata = NULL; in ieee80211_set_disassoc()
3807 /* disable per-vif ps */ in ieee80211_set_disassoc()
3824 drv_mgd_prepare_tx(sdata->local, sdata, &info); in ieee80211_set_disassoc()
3826 ieee80211_send_deauth_disassoc(sdata, sdata->vif.cfg.ap_addr, in ieee80211_set_disassoc()
3827 sdata->vif.cfg.ap_addr, stype, in ieee80211_set_disassoc()
3831 /* flush out frame - make sure the deauth was actually sent */ in ieee80211_set_disassoc()
3835 drv_mgd_complete_tx(sdata->local, sdata, &info); in ieee80211_set_disassoc()
3838 eth_zero_addr(sdata->deflink.u.mgd.bssid); in ieee80211_set_disassoc()
3839 eth_zero_addr(sdata->vif.cfg.ap_addr); in ieee80211_set_disassoc()
3841 sdata->vif.cfg.ssid_len = 0; in ieee80211_set_disassoc()
3844 __sta_info_flush(sdata, false, -1, ap_sta); in ieee80211_set_disassoc()
3846 if (sdata->vif.driver_flags & IEEE80211_VIF_REMOVE_AP_AFTER_DISASSOC) { in ieee80211_set_disassoc()
3851 sta_info_flush(sdata, -1); in ieee80211_set_disassoc()
3855 if (!ieee80211_vif_is_mld(&sdata->vif)) in ieee80211_set_disassoc()
3860 sdata->vif.cfg.assoc = false; in ieee80211_set_disassoc()
3862 sdata->deflink.u.mgd.p2p_noa_index = -1; in ieee80211_set_disassoc()
3863 memset(&sdata->vif.bss_conf.p2p_noa_attr, 0, in ieee80211_set_disassoc()
3864 sizeof(sdata->vif.bss_conf.p2p_noa_attr)); in ieee80211_set_disassoc()
3866 /* on the next assoc, re-program HT/VHT parameters */ in ieee80211_set_disassoc()
3867 memset(&ifmgd->ht_capa, 0, sizeof(ifmgd->ht_capa)); in ieee80211_set_disassoc()
3868 memset(&ifmgd->ht_capa_mask, 0, sizeof(ifmgd->ht_capa_mask)); in ieee80211_set_disassoc()
3869 memset(&ifmgd->vht_capa, 0, sizeof(ifmgd->vht_capa)); in ieee80211_set_disassoc()
3870 memset(&ifmgd->vht_capa_mask, 0, sizeof(ifmgd->vht_capa_mask)); in ieee80211_set_disassoc()
3873 * reset MU-MIMO ownership and group data in default link, in ieee80211_set_disassoc()
3876 memset(sdata->vif.bss_conf.mu_group.membership, 0, in ieee80211_set_disassoc()
3877 sizeof(sdata->vif.bss_conf.mu_group.membership)); in ieee80211_set_disassoc()
3878 memset(sdata->vif.bss_conf.mu_group.position, 0, in ieee80211_set_disassoc()
3879 sizeof(sdata->vif.bss_conf.mu_group.position)); in ieee80211_set_disassoc()
3880 if (!ieee80211_vif_is_mld(&sdata->vif)) in ieee80211_set_disassoc()
3882 sdata->vif.bss_conf.mu_mimo_owner = false; in ieee80211_set_disassoc()
3884 sdata->deflink.ap_power_level = IEEE80211_UNSET_POWER_LEVEL; in ieee80211_set_disassoc()
3886 del_timer_sync(&local->dynamic_ps_timer); in ieee80211_set_disassoc()
3887 wiphy_work_cancel(local->hw.wiphy, &local->dynamic_ps_enable_work); in ieee80211_set_disassoc()
3890 if (sdata->vif.cfg.arp_addr_cnt) in ieee80211_set_disassoc()
3893 sdata->vif.bss_conf.qos = false; in ieee80211_set_disassoc()
3894 if (!ieee80211_vif_is_mld(&sdata->vif)) { in ieee80211_set_disassoc()
3903 if (sdata->vif.driver_flags & IEEE80211_VIF_REMOVE_AP_AFTER_DISASSOC) { in ieee80211_set_disassoc()
3908 sta_info_flush(sdata, -1); in ieee80211_set_disassoc()
3911 /* disassociated - set to defaults now */ in ieee80211_set_disassoc()
3912 ieee80211_set_wmm_default(&sdata->deflink, false, false); in ieee80211_set_disassoc()
3914 del_timer_sync(&sdata->u.mgd.conn_mon_timer); in ieee80211_set_disassoc()
3915 del_timer_sync(&sdata->u.mgd.bcn_mon_timer); in ieee80211_set_disassoc()
3916 del_timer_sync(&sdata->u.mgd.timer); in ieee80211_set_disassoc()
3918 sdata->vif.bss_conf.dtim_period = 0; in ieee80211_set_disassoc()
3919 sdata->vif.bss_conf.beacon_rate = NULL; in ieee80211_set_disassoc()
3921 sdata->deflink.u.mgd.have_beacon = false; in ieee80211_set_disassoc()
3922 sdata->deflink.u.mgd.tracking_signal_avg = false; in ieee80211_set_disassoc()
3923 sdata->deflink.u.mgd.disable_wmm_tracking = false; in ieee80211_set_disassoc()
3925 ifmgd->flags = 0; in ieee80211_set_disassoc()
3927 for (link_id = 0; link_id < ARRAY_SIZE(sdata->link); link_id++) { in ieee80211_set_disassoc()
3930 link = sdata_dereference(sdata->link[link_id], sdata); in ieee80211_set_disassoc()
3936 sdata->vif.bss_conf.csa_active = false; in ieee80211_set_disassoc()
3937 sdata->deflink.u.mgd.csa.blocked_tx = false; in ieee80211_set_disassoc()
3938 sdata->deflink.u.mgd.csa.waiting_bcn = false; in ieee80211_set_disassoc()
3939 sdata->deflink.u.mgd.csa.ignored_same_chan = false; in ieee80211_set_disassoc()
3943 memset(ifmgd->tx_tspec, 0, sizeof(ifmgd->tx_tspec)); in ieee80211_set_disassoc()
3944 wiphy_delayed_work_cancel(local->hw.wiphy, &ifmgd->tx_tspec_wk); in ieee80211_set_disassoc()
3946 sdata->vif.bss_conf.power_type = IEEE80211_REG_UNSET_AP; in ieee80211_set_disassoc()
3947 sdata->vif.bss_conf.pwr_reduction = 0; in ieee80211_set_disassoc()
3948 ieee80211_clear_tpe(&sdata->vif.bss_conf.tpe); in ieee80211_set_disassoc()
3950 sdata->vif.cfg.eml_cap = 0; in ieee80211_set_disassoc()
3951 sdata->vif.cfg.eml_med_sync_delay = 0; in ieee80211_set_disassoc()
3952 sdata->vif.cfg.mld_capa_op = 0; in ieee80211_set_disassoc()
3954 memset(&sdata->u.mgd.ttlm_info, 0, in ieee80211_set_disassoc()
3955 sizeof(sdata->u.mgd.ttlm_info)); in ieee80211_set_disassoc()
3956 wiphy_delayed_work_cancel(sdata->local->hw.wiphy, &ifmgd->ttlm_work); in ieee80211_set_disassoc()
3958 memset(&sdata->vif.neg_ttlm, 0, sizeof(sdata->vif.neg_ttlm)); in ieee80211_set_disassoc()
3959 wiphy_delayed_work_cancel(sdata->local->hw.wiphy, in ieee80211_set_disassoc()
3960 &ifmgd->neg_ttlm_timeout_work); in ieee80211_set_disassoc()
3962 sdata->u.mgd.removed_links = 0; in ieee80211_set_disassoc()
3963 wiphy_delayed_work_cancel(sdata->local->hw.wiphy, in ieee80211_set_disassoc()
3964 &sdata->u.mgd.ml_reconf_work); in ieee80211_set_disassoc()
3966 wiphy_work_cancel(sdata->local->hw.wiphy, in ieee80211_set_disassoc()
3967 &ifmgd->teardown_ttlm_work); in ieee80211_set_disassoc()
3971 ifmgd->mcast_seq_last = IEEE80211_SN_MODULO; in ieee80211_set_disassoc()
3982 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_reset_ap_probe()
3983 struct ieee80211_local *local = sdata->local; in ieee80211_reset_ap_probe()
3985 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_reset_ap_probe()
3987 if (!(ifmgd->flags & IEEE80211_STA_CONNECTION_POLL)) in ieee80211_reset_ap_probe()
3994 if (ieee80211_hw_check(&sdata->local->hw, CONNECTION_MONITOR)) in ieee80211_reset_ap_probe()
4004 mod_timer(&ifmgd->conn_mon_timer, in ieee80211_reset_ap_probe()
4013 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_sta_tx_wmm_ac_notify()
4019 if (!ieee80211_is_data_qos(hdr->frame_control)) in ieee80211_sta_tx_wmm_ac_notify()
4024 tx_tspec = &ifmgd->tx_tspec[ac]; in ieee80211_sta_tx_wmm_ac_notify()
4026 if (likely(!tx_tspec->admitted_time)) in ieee80211_sta_tx_wmm_ac_notify()
4029 if (time_after(now, tx_tspec->time_slice_start + HZ)) { in ieee80211_sta_tx_wmm_ac_notify()
4030 tx_tspec->consumed_tx_time = 0; in ieee80211_sta_tx_wmm_ac_notify()
4031 tx_tspec->time_slice_start = now; in ieee80211_sta_tx_wmm_ac_notify()
4033 if (tx_tspec->downgraded) { in ieee80211_sta_tx_wmm_ac_notify()
4034 tx_tspec->action = TX_TSPEC_ACTION_STOP_DOWNGRADE; in ieee80211_sta_tx_wmm_ac_notify()
4035 wiphy_delayed_work_queue(sdata->local->hw.wiphy, in ieee80211_sta_tx_wmm_ac_notify()
4036 &ifmgd->tx_tspec_wk, 0); in ieee80211_sta_tx_wmm_ac_notify()
4040 if (tx_tspec->downgraded) in ieee80211_sta_tx_wmm_ac_notify()
4043 tx_tspec->consumed_tx_time += tx_time; in ieee80211_sta_tx_wmm_ac_notify()
4045 if (tx_tspec->consumed_tx_time >= tx_tspec->admitted_time) { in ieee80211_sta_tx_wmm_ac_notify()
4046 tx_tspec->downgraded = true; in ieee80211_sta_tx_wmm_ac_notify()
4047 tx_tspec->action = TX_TSPEC_ACTION_DOWNGRADE; in ieee80211_sta_tx_wmm_ac_notify()
4048 wiphy_delayed_work_queue(sdata->local->hw.wiphy, in ieee80211_sta_tx_wmm_ac_notify()
4049 &ifmgd->tx_tspec_wk, 0); in ieee80211_sta_tx_wmm_ac_notify()
4058 if (!ieee80211_is_any_nullfunc(hdr->frame_control) || in ieee80211_sta_tx_notify()
4059 !sdata->u.mgd.probe_send_count) in ieee80211_sta_tx_notify()
4063 sdata->u.mgd.probe_send_count = 0; in ieee80211_sta_tx_notify()
4065 sdata->u.mgd.nullfunc_failed = true; in ieee80211_sta_tx_notify()
4066 wiphy_work_queue(sdata->local->hw.wiphy, &sdata->work); in ieee80211_sta_tx_notify()
4076 skb = ieee80211_build_probe_req(sdata, src, dst, (u32)-1, channel, in ieee80211_mlme_send_probe_req()
4085 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_mgd_probe_ap_send()
4086 u8 *dst = sdata->vif.cfg.ap_addr; in ieee80211_mgd_probe_ap_send()
4087 u8 unicast_limit = max(1, max_probe_tries - 3); in ieee80211_mgd_probe_ap_send()
4090 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_mgd_probe_ap_send()
4092 if (WARN_ON(ieee80211_vif_is_mld(&sdata->vif))) in ieee80211_mgd_probe_ap_send()
4100 if (ifmgd->probe_send_count >= unicast_limit) in ieee80211_mgd_probe_ap_send()
4110 ifmgd->probe_send_count++; in ieee80211_mgd_probe_ap_send()
4118 if (ieee80211_hw_check(&sdata->local->hw, REPORTS_TX_ACK_STATUS)) { in ieee80211_mgd_probe_ap_send()
4119 ifmgd->nullfunc_failed = false; in ieee80211_mgd_probe_ap_send()
4120 ieee80211_send_nullfunc(sdata->local, sdata, false); in ieee80211_mgd_probe_ap_send()
4122 ieee80211_mlme_send_probe_req(sdata, sdata->vif.addr, dst, in ieee80211_mgd_probe_ap_send()
4123 sdata->vif.cfg.ssid, in ieee80211_mgd_probe_ap_send()
4124 sdata->vif.cfg.ssid_len, in ieee80211_mgd_probe_ap_send()
4125 sdata->deflink.conf->bss->channel); in ieee80211_mgd_probe_ap_send()
4128 ifmgd->probe_timeout = jiffies + msecs_to_jiffies(probe_wait_ms); in ieee80211_mgd_probe_ap_send()
4129 run_again(sdata, ifmgd->probe_timeout); in ieee80211_mgd_probe_ap_send()
4135 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_mgd_probe_ap()
4138 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_mgd_probe_ap()
4140 if (WARN_ON_ONCE(ieee80211_vif_is_mld(&sdata->vif))) in ieee80211_mgd_probe_ap()
4146 if (!ifmgd->associated) in ieee80211_mgd_probe_ap()
4149 if (sdata->local->tmp_channel || sdata->local->scanning) in ieee80211_mgd_probe_ap()
4152 if (sdata->local->suspending) { in ieee80211_mgd_probe_ap()
4160 "detected beacon loss from AP (missed %d beacons) - probing\n", in ieee80211_mgd_probe_ap()
4163 ieee80211_cqm_beacon_loss_notify(&sdata->vif, GFP_KERNEL); in ieee80211_mgd_probe_ap()
4177 if (ifmgd->flags & IEEE80211_STA_CONNECTION_POLL) in ieee80211_mgd_probe_ap()
4180 ifmgd->flags |= IEEE80211_STA_CONNECTION_POLL; in ieee80211_mgd_probe_ap()
4185 ieee80211_recalc_ps(sdata->local); in ieee80211_mgd_probe_ap()
4187 ifmgd->probe_send_count = 0; in ieee80211_mgd_probe_ap()
4195 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_ap_probereq_get()
4201 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_ap_probereq_get()
4203 if (WARN_ON(sdata->vif.type != NL80211_IFTYPE_STATION || in ieee80211_ap_probereq_get()
4204 ieee80211_vif_is_mld(&sdata->vif))) in ieee80211_ap_probereq_get()
4207 if (ifmgd->associated) in ieee80211_ap_probereq_get()
4208 cbss = sdata->deflink.conf->bss; in ieee80211_ap_probereq_get()
4209 else if (ifmgd->auth_data) in ieee80211_ap_probereq_get()
4210 cbss = ifmgd->auth_data->bss; in ieee80211_ap_probereq_get()
4211 else if (ifmgd->assoc_data && ifmgd->assoc_data->link[0].bss) in ieee80211_ap_probereq_get()
4212 cbss = ifmgd->assoc_data->link[0].bss; in ieee80211_ap_probereq_get()
4218 if (WARN_ONCE(!ssid || ssid->datalen > IEEE80211_MAX_SSID_LEN, in ieee80211_ap_probereq_get()
4220 ssid ? ssid->datalen : -1)) in ieee80211_ap_probereq_get()
4223 ssid_len = ssid->datalen; in ieee80211_ap_probereq_get()
4225 skb = ieee80211_build_probe_req(sdata, sdata->vif.addr, cbss->bssid, in ieee80211_ap_probereq_get()
4226 (u32) -1, cbss->channel, in ieee80211_ap_probereq_get()
4227 ssid->data, ssid_len, in ieee80211_ap_probereq_get()
4246 cfg80211_tx_mlme_mgmt(sdata->dev, buf, len, reconnect); in ieee80211_report_disconnect()
4248 cfg80211_rx_mlme_mgmt(sdata->dev, buf, len); in ieee80211_report_disconnect()
4250 drv_event_callback(sdata->local, sdata, &event); in ieee80211_report_disconnect()
4255 struct ieee80211_local *local = sdata->local; in __ieee80211_disconnect()
4256 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in __ieee80211_disconnect()
4260 lockdep_assert_wiphy(local->hw.wiphy); in __ieee80211_disconnect()
4262 if (!ifmgd->associated) in __ieee80211_disconnect()
4267 link_id < ARRAY_SIZE(sdata->link); in __ieee80211_disconnect()
4271 if (!ieee80211_vif_link_active(&sdata->vif, link_id)) in __ieee80211_disconnect()
4274 link = sdata_dereference(sdata->link[link_id], sdata); in __ieee80211_disconnect()
4278 if (link->u.mgd.csa.blocked_tx) in __ieee80211_disconnect()
4285 if (!ifmgd->driver_disconnect) { in __ieee80211_disconnect()
4291 * of multi-link, it's not clear that all of them really are in __ieee80211_disconnect()
4296 link_id < ARRAY_SIZE(sdata->link); in __ieee80211_disconnect()
4300 link = sdata_dereference(sdata->link[link_id], sdata); in __ieee80211_disconnect()
4303 cfg80211_unlink_bss(local->hw.wiphy, link->conf->bss); in __ieee80211_disconnect()
4304 link->conf->bss = NULL; in __ieee80211_disconnect()
4309 ifmgd->driver_disconnect ? in __ieee80211_disconnect()
4314 sdata->vif.bss_conf.csa_active = false; in __ieee80211_disconnect()
4315 sdata->deflink.u.mgd.csa.waiting_bcn = false; in __ieee80211_disconnect()
4316 sdata->deflink.u.mgd.csa.blocked_tx = false; in __ieee80211_disconnect()
4321 ifmgd->reconnect); in __ieee80211_disconnect()
4322 ifmgd->reconnect = false; in __ieee80211_disconnect()
4331 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_beacon_connection_loss_work()
4333 if (ifmgd->connection_loss) { in ieee80211_beacon_connection_loss_work()
4335 sdata->vif.cfg.ap_addr); in ieee80211_beacon_connection_loss_work()
4337 ifmgd->connection_loss = false; in ieee80211_beacon_connection_loss_work()
4338 } else if (ifmgd->driver_disconnect) { in ieee80211_beacon_connection_loss_work()
4341 sdata->vif.cfg.ap_addr); in ieee80211_beacon_connection_loss_work()
4343 ifmgd->driver_disconnect = false; in ieee80211_beacon_connection_loss_work()
4345 if (ifmgd->associated) in ieee80211_beacon_connection_loss_work()
4346 sdata->deflink.u.mgd.beacon_loss_count++; in ieee80211_beacon_connection_loss_work()
4364 struct ieee80211_hw *hw = &sdata->local->hw; in ieee80211_beacon_loss()
4368 sdata->u.mgd.connection_loss = false; in ieee80211_beacon_loss()
4369 wiphy_work_queue(hw->wiphy, &sdata->u.mgd.beacon_connection_loss_work); in ieee80211_beacon_loss()
4381 hw = &sdata->local->hw; in ieee80211_connection_loss()
4385 sdata->u.mgd.connection_loss = true; in ieee80211_connection_loss()
4386 wiphy_work_queue(hw->wiphy, &sdata->u.mgd.beacon_connection_loss_work); in ieee80211_connection_loss()
4393 struct ieee80211_hw *hw = &sdata->local->hw; in ieee80211_disconnect()
4397 if (WARN_ON(sdata->vif.type != NL80211_IFTYPE_STATION)) in ieee80211_disconnect()
4400 sdata->u.mgd.driver_disconnect = true; in ieee80211_disconnect()
4401 sdata->u.mgd.reconnect = reconnect; in ieee80211_disconnect()
4402 wiphy_work_queue(hw->wiphy, &sdata->u.mgd.beacon_connection_loss_work); in ieee80211_disconnect()
4409 struct ieee80211_mgd_auth_data *auth_data = sdata->u.mgd.auth_data; in ieee80211_destroy_auth_data()
4411 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_destroy_auth_data()
4413 sdata->u.mgd.auth_data = NULL; in ieee80211_destroy_auth_data()
4421 del_timer_sync(&sdata->u.mgd.timer); in ieee80211_destroy_auth_data()
4422 sta_info_destroy_addr(sdata, auth_data->ap_addr); in ieee80211_destroy_auth_data()
4425 eth_zero_addr(sdata->deflink.u.mgd.bssid); in ieee80211_destroy_auth_data()
4426 ieee80211_link_info_change_notify(sdata, &sdata->deflink, in ieee80211_destroy_auth_data()
4428 sdata->u.mgd.flags = 0; in ieee80211_destroy_auth_data()
4430 ieee80211_link_release_channel(&sdata->deflink); in ieee80211_destroy_auth_data()
4434 cfg80211_put_bss(sdata->local->hw.wiphy, auth_data->bss); in ieee80211_destroy_auth_data()
4448 struct ieee80211_mgd_assoc_data *assoc_data = sdata->u.mgd.assoc_data; in ieee80211_destroy_assoc_data()
4450 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_destroy_assoc_data()
4452 sdata->u.mgd.assoc_data = NULL; in ieee80211_destroy_assoc_data()
4460 del_timer_sync(&sdata->u.mgd.timer); in ieee80211_destroy_assoc_data()
4461 sta_info_destroy_addr(sdata, assoc_data->ap_addr); in ieee80211_destroy_assoc_data()
4463 eth_zero_addr(sdata->deflink.u.mgd.bssid); in ieee80211_destroy_assoc_data()
4464 ieee80211_link_info_change_notify(sdata, &sdata->deflink, in ieee80211_destroy_assoc_data()
4466 sdata->u.mgd.flags = 0; in ieee80211_destroy_assoc_data()
4467 sdata->vif.bss_conf.mu_mimo_owner = false; in ieee80211_destroy_assoc_data()
4476 ARRAY_SIZE(assoc_data->link)); in ieee80211_destroy_assoc_data()
4479 data.bss[i] = assoc_data->link[i].bss; in ieee80211_destroy_assoc_data()
4481 if (ieee80211_vif_is_mld(&sdata->vif)) in ieee80211_destroy_assoc_data()
4482 data.ap_mld_addr = assoc_data->ap_addr; in ieee80211_destroy_assoc_data()
4484 cfg80211_assoc_failure(sdata->dev, &data); in ieee80211_destroy_assoc_data()
4487 ieee80211_link_release_channel(&sdata->deflink); in ieee80211_destroy_assoc_data()
4497 struct ieee80211_local *local = sdata->local; in ieee80211_auth_challenge()
4498 struct ieee80211_mgd_auth_data *auth_data = sdata->u.mgd.auth_data; in ieee80211_auth_challenge()
4504 .link_id = auth_data->link_id, in ieee80211_auth_challenge()
4507 pos = mgmt->u.auth.variable; in ieee80211_auth_challenge()
4509 len - (pos - (u8 *)mgmt)); in ieee80211_auth_challenge()
4512 auth_data->expected_transaction = 4; in ieee80211_auth_challenge()
4513 drv_mgd_prepare_tx(sdata->local, sdata, &info); in ieee80211_auth_challenge()
4514 if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) in ieee80211_auth_challenge()
4517 ieee80211_send_auth(sdata, 3, auth_data->algorithm, 0, in ieee80211_auth_challenge()
4519 challenge->datalen + sizeof(*challenge), in ieee80211_auth_challenge()
4520 auth_data->ap_addr, auth_data->ap_addr, in ieee80211_auth_challenge()
4521 auth_data->key, auth_data->key_len, in ieee80211_auth_challenge()
4522 auth_data->key_idx, tx_flags); in ieee80211_auth_challenge()
4527 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_mark_sta_auth()
4528 const u8 *ap_addr = ifmgd->auth_data->ap_addr; in ieee80211_mark_sta_auth()
4531 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_mark_sta_auth()
4534 ifmgd->auth_data->done = true; in ieee80211_mark_sta_auth()
4535 ifmgd->auth_data->timeout = jiffies + IEEE80211_AUTH_WAIT_ASSOC; in ieee80211_mark_sta_auth()
4536 ifmgd->auth_data->timeout_started = true; in ieee80211_mark_sta_auth()
4537 run_again(sdata, ifmgd->auth_data->timeout); in ieee80211_mark_sta_auth()
4542 WARN_ONCE(1, "%s: STA %pM not found", sdata->name, ap_addr); in ieee80211_mark_sta_auth()
4556 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_rx_mgmt_auth()
4566 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_rx_mgmt_auth()
4571 if (!ifmgd->auth_data || ifmgd->auth_data->done) in ieee80211_rx_mgmt_auth()
4574 if (!ether_addr_equal(ifmgd->auth_data->ap_addr, mgmt->bssid)) in ieee80211_rx_mgmt_auth()
4577 auth_alg = le16_to_cpu(mgmt->u.auth.auth_alg); in ieee80211_rx_mgmt_auth()
4578 auth_transaction = le16_to_cpu(mgmt->u.auth.auth_transaction); in ieee80211_rx_mgmt_auth()
4579 status_code = le16_to_cpu(mgmt->u.auth.status_code); in ieee80211_rx_mgmt_auth()
4581 if (auth_alg != ifmgd->auth_data->algorithm || in ieee80211_rx_mgmt_auth()
4583 auth_transaction != ifmgd->auth_data->expected_transaction) || in ieee80211_rx_mgmt_auth()
4585 (auth_transaction < ifmgd->auth_data->expected_transaction || in ieee80211_rx_mgmt_auth()
4588 mgmt->sa, auth_alg, ifmgd->auth_data->algorithm, in ieee80211_rx_mgmt_auth()
4590 ifmgd->auth_data->expected_transaction); in ieee80211_rx_mgmt_auth()
4595 cfg80211_rx_mlme_mgmt(sdata->dev, (u8 *)mgmt, len); in ieee80211_rx_mgmt_auth()
4603 ifmgd->auth_data->waiting = true; in ieee80211_rx_mgmt_auth()
4604 ifmgd->auth_data->timeout = in ieee80211_rx_mgmt_auth()
4606 ifmgd->auth_data->timeout_started = true; in ieee80211_rx_mgmt_auth()
4607 run_again(sdata, ifmgd->auth_data->timeout); in ieee80211_rx_mgmt_auth()
4612 mgmt->sa, status_code); in ieee80211_rx_mgmt_auth()
4616 drv_event_callback(sdata->local, sdata, &event); in ieee80211_rx_mgmt_auth()
4620 switch (ifmgd->auth_data->algorithm) { in ieee80211_rx_mgmt_auth()
4630 if (ifmgd->auth_data->expected_transaction != 4) { in ieee80211_rx_mgmt_auth()
4638 ifmgd->auth_data->algorithm); in ieee80211_rx_mgmt_auth()
4644 drv_event_callback(sdata->local, sdata, &event); in ieee80211_rx_mgmt_auth()
4645 if (ifmgd->auth_data->algorithm != WLAN_AUTH_SAE || in ieee80211_rx_mgmt_auth()
4647 ifmgd->auth_data->expected_transaction == 2)) { in ieee80211_rx_mgmt_auth()
4649 return; /* ignore frame -- wait for timeout */ in ieee80211_rx_mgmt_auth()
4650 } else if (ifmgd->auth_data->algorithm == WLAN_AUTH_SAE && in ieee80211_rx_mgmt_auth()
4653 ifmgd->auth_data->peer_confirmed = true; in ieee80211_rx_mgmt_auth()
4656 cfg80211_rx_mlme_mgmt(sdata->dev, (u8 *)mgmt, len); in ieee80211_rx_mgmt_auth()
4658 drv_mgd_complete_tx(sdata->local, sdata, &info); in ieee80211_rx_mgmt_auth()
4721 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_rx_mgmt_deauth()
4722 u16 reason_code = le16_to_cpu(mgmt->u.deauth.reason_code); in ieee80211_rx_mgmt_deauth()
4724 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_rx_mgmt_deauth()
4729 if (!ether_addr_equal(mgmt->bssid, mgmt->sa)) { in ieee80211_rx_mgmt_deauth()
4730 ieee80211_tdls_handle_disconnect(sdata, mgmt->sa, reason_code); in ieee80211_rx_mgmt_deauth()
4734 if (ifmgd->associated && in ieee80211_rx_mgmt_deauth()
4735 ether_addr_equal(mgmt->bssid, sdata->vif.cfg.ap_addr)) { in ieee80211_rx_mgmt_deauth()
4737 sdata->vif.cfg.ap_addr, reason_code, in ieee80211_rx_mgmt_deauth()
4747 if (ifmgd->assoc_data && in ieee80211_rx_mgmt_deauth()
4748 ether_addr_equal(mgmt->bssid, ifmgd->assoc_data->ap_addr)) { in ieee80211_rx_mgmt_deauth()
4751 ifmgd->assoc_data->ap_addr, reason_code, in ieee80211_rx_mgmt_deauth()
4756 cfg80211_rx_mlme_mgmt(sdata->dev, (u8 *)mgmt, len); in ieee80211_rx_mgmt_deauth()
4765 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_rx_mgmt_disassoc()
4768 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_rx_mgmt_disassoc()
4773 if (!ifmgd->associated || in ieee80211_rx_mgmt_disassoc()
4774 !ether_addr_equal(mgmt->bssid, sdata->vif.cfg.ap_addr)) in ieee80211_rx_mgmt_disassoc()
4777 reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code); in ieee80211_rx_mgmt_disassoc()
4779 if (!ether_addr_equal(mgmt->bssid, mgmt->sa)) { in ieee80211_rx_mgmt_disassoc()
4780 ieee80211_tdls_handle_disconnect(sdata, mgmt->sa, reason_code); in ieee80211_rx_mgmt_disassoc()
4785 sdata->vif.cfg.ap_addr, reason_code, in ieee80211_rx_mgmt_disassoc()
4800 ieee80211_get_he_iftype_cap_vif(sband, &sdata->vif); in ieee80211_twt_req_supported()
4802 if (elems->ext_capab_len < 10) in ieee80211_twt_req_supported()
4805 if (!(elems->ext_capab[9] & WLAN_EXT_CAPA10_TWT_RESPONDER_SUPPORT)) in ieee80211_twt_req_supported()
4808 return link_sta->pub->he_cap.he_cap_elem.mac_cap_info[0] & in ieee80211_twt_req_supported()
4811 (own_he_cap->he_cap_elem.mac_cap_info[0] & in ieee80211_twt_req_supported()
4823 if (link->conf->twt_requester != twt) { in ieee80211_recalc_twt_req()
4824 link->conf->twt_requester = twt; in ieee80211_recalc_twt_req()
4836 ieee80211_get_he_iftype_cap_vif(sband, &sdata->vif); in ieee80211_twt_bcast_support()
4838 return bss_conf->he_support && in ieee80211_twt_bcast_support()
4839 (link_sta->pub->he_cap.he_cap_elem.mac_cap_info[2] & in ieee80211_twt_bcast_support()
4842 (own_he_cap->he_cap_elem.mac_cap_info[2] & in ieee80211_twt_bcast_support()
4854 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_assoc_config_link()
4856 sdata->u.mgd.assoc_data ?: sdata->u.mgd.reconf.add_links_data; in ieee80211_assoc_config_link()
4857 struct ieee80211_bss_conf *bss_conf = link->conf; in ieee80211_assoc_config_link()
4858 struct ieee80211_local *local = sdata->local; in ieee80211_assoc_config_link()
4859 unsigned int link_id = link->link_id; in ieee80211_assoc_config_link()
4861 .mode = link->u.mgd.conn.mode, in ieee80211_assoc_config_link()
4864 .link_id = link_id == assoc_data->assoc_link_id ? -1 : link_id, in ieee80211_assoc_config_link()
4867 bool is_5ghz = cbss->channel->band == NL80211_BAND_5GHZ; in ieee80211_assoc_config_link()
4868 bool is_6ghz = cbss->channel->band == NL80211_BAND_6GHZ; in ieee80211_assoc_config_link()
4869 bool is_s1g = cbss->channel->band == NL80211_BAND_S1GHZ; in ieee80211_assoc_config_link()
4882 if (link_id == assoc_data->assoc_link_id) { in ieee80211_assoc_config_link()
4883 capab_info = le16_to_cpu(mgmt->u.assoc_resp.capab_info); in ieee80211_assoc_config_link()
4889 assoc_data->link[link_id].status = WLAN_STATUS_SUCCESS; in ieee80211_assoc_config_link()
4890 if (elems->ml_basic) { in ieee80211_assoc_config_link()
4892 ieee80211_mle_get_bss_param_ch_cnt((const void *)elems->ml_basic); in ieee80211_assoc_config_link()
4898 bss_conf->bss_param_ch_cnt = bss_param_ch_cnt; in ieee80211_assoc_config_link()
4899 bss_conf->bss_param_ch_cnt_link_id = link_id; in ieee80211_assoc_config_link()
4901 } else if (elems->parse_error & IEEE80211_PARSE_ERR_DUP_NEST_ML_BASIC || in ieee80211_assoc_config_link()
4902 !elems->prof || in ieee80211_assoc_config_link()
4903 !(elems->prof->control & prof_bss_param_ch_present)) { in ieee80211_assoc_config_link()
4907 const u8 *ptr = elems->prof->variable + in ieee80211_assoc_config_link()
4908 elems->prof->sta_info_len - 1; in ieee80211_assoc_config_link()
4913 * otherwise elems->prof would have been set to NULL. in ieee80211_assoc_config_link()
4916 assoc_data->link[link_id].status = get_unaligned_le16(ptr + 2); in ieee80211_assoc_config_link()
4918 ieee80211_mle_basic_sta_prof_bss_param_ch_cnt(elems->prof); in ieee80211_assoc_config_link()
4919 bss_conf->bss_param_ch_cnt = bss_param_ch_cnt; in ieee80211_assoc_config_link()
4920 bss_conf->bss_param_ch_cnt_link_id = link_id; in ieee80211_assoc_config_link()
4922 if (assoc_data->link[link_id].status != WLAN_STATUS_SUCCESS) { in ieee80211_assoc_config_link()
4924 assoc_data->link[link_id].status); in ieee80211_assoc_config_link()
4930 if (!is_s1g && !elems->supp_rates) { in ieee80211_assoc_config_link()
4936 link->u.mgd.tdls_chan_switch_prohibited = in ieee80211_assoc_config_link()
4937 elems->ext_capab && elems->ext_capab_len >= 5 && in ieee80211_assoc_config_link()
4938 (elems->ext_capab[4] & WLAN_EXT_CAPA5_TDLS_CH_SW_PROHIBITED); in ieee80211_assoc_config_link()
4945 * "Vodafone PocketWiFi 2", "ZTE MF60" and a similar T-Mobile device. in ieee80211_assoc_config_link()
4947 if (!ieee80211_hw_check(&local->hw, STRICT) && !is_6ghz && in ieee80211_assoc_config_link()
4948 ((assoc_data->wmm && !elems->wmm_param) || in ieee80211_assoc_config_link()
4949 (link->u.mgd.conn.mode >= IEEE80211_CONN_MODE_HT && in ieee80211_assoc_config_link()
4950 (!elems->ht_cap_elem || !elems->ht_operation)) || in ieee80211_assoc_config_link()
4951 (is_5ghz && link->u.mgd.conn.mode >= IEEE80211_CONN_MODE_VHT && in ieee80211_assoc_config_link()
4952 (!elems->vht_cap_elem || !elems->vht_operation)))) { in ieee80211_assoc_config_link()
4957 ies = rcu_dereference(cbss->ies); in ieee80211_assoc_config_link()
4959 bss_ies = kmemdup(ies, sizeof(*ies) + ies->len, in ieee80211_assoc_config_link()
4967 parse_params.start = bss_ies->data; in ieee80211_assoc_config_link()
4968 parse_params.len = bss_ies->len; in ieee80211_assoc_config_link()
4970 parse_params.link_id = -1; in ieee80211_assoc_config_link()
4977 if (assoc_data->wmm && in ieee80211_assoc_config_link()
4978 !elems->wmm_param && bss_elems->wmm_param) { in ieee80211_assoc_config_link()
4979 elems->wmm_param = bss_elems->wmm_param; in ieee80211_assoc_config_link()
4988 if (!elems->ht_cap_elem && bss_elems->ht_cap_elem && in ieee80211_assoc_config_link()
4989 link->u.mgd.conn.mode >= IEEE80211_CONN_MODE_HT) { in ieee80211_assoc_config_link()
4990 elems->ht_cap_elem = bss_elems->ht_cap_elem; in ieee80211_assoc_config_link()
4994 if (!elems->ht_operation && bss_elems->ht_operation && in ieee80211_assoc_config_link()
4995 link->u.mgd.conn.mode >= IEEE80211_CONN_MODE_HT) { in ieee80211_assoc_config_link()
4996 elems->ht_operation = bss_elems->ht_operation; in ieee80211_assoc_config_link()
5002 if (!elems->vht_cap_elem && bss_elems->vht_cap_elem && in ieee80211_assoc_config_link()
5003 link->u.mgd.conn.mode >= IEEE80211_CONN_MODE_VHT) { in ieee80211_assoc_config_link()
5004 elems->vht_cap_elem = bss_elems->vht_cap_elem; in ieee80211_assoc_config_link()
5009 if (!elems->vht_operation && bss_elems->vht_operation && in ieee80211_assoc_config_link()
5010 link->u.mgd.conn.mode >= IEEE80211_CONN_MODE_VHT) { in ieee80211_assoc_config_link()
5011 elems->vht_operation = bss_elems->vht_operation; in ieee80211_assoc_config_link()
5025 if (!is_6ghz && link->u.mgd.conn.mode >= IEEE80211_CONN_MODE_HT && in ieee80211_assoc_config_link()
5026 (!elems->wmm_param || !elems->ht_cap_elem || !elems->ht_operation)) { in ieee80211_assoc_config_link()
5033 if (is_5ghz && link->u.mgd.conn.mode >= IEEE80211_CONN_MODE_VHT && in ieee80211_assoc_config_link()
5034 (!elems->vht_cap_elem || !elems->vht_operation)) { in ieee80211_assoc_config_link()
5043 link_id == assoc_data->assoc_link_id, in ieee80211_assoc_config_link()
5049 if (WARN_ON(!link->conf->chanreq.oper.chan)) { in ieee80211_assoc_config_link()
5053 sband = local->hw.wiphy->bands[link->conf->chanreq.oper.chan->band]; in ieee80211_assoc_config_link()
5056 if (elems->ht_cap_elem && link->u.mgd.conn.mode >= IEEE80211_CONN_MODE_HT) in ieee80211_assoc_config_link()
5058 elems->ht_cap_elem, in ieee80211_assoc_config_link()
5061 if (elems->vht_cap_elem && in ieee80211_assoc_config_link()
5062 link->u.mgd.conn.mode >= IEEE80211_CONN_MODE_VHT) { in ieee80211_assoc_config_link()
5073 ies = rcu_dereference(cbss->ies); in ieee80211_assoc_config_link()
5078 ies->data, ies->len); in ieee80211_assoc_config_link()
5079 if (elem && elem->datalen >= sizeof(*bss_vht_cap)) in ieee80211_assoc_config_link()
5080 bss_vht_cap = (const void *)elem->data; in ieee80211_assoc_config_link()
5083 if (ieee80211_hw_check(&local->hw, STRICT) && in ieee80211_assoc_config_link()
5084 (!bss_vht_cap || memcmp(bss_vht_cap, elems->vht_cap_elem, in ieee80211_assoc_config_link()
5093 elems->vht_cap_elem, in ieee80211_assoc_config_link()
5098 if (elems->he_operation && in ieee80211_assoc_config_link()
5099 link->u.mgd.conn.mode >= IEEE80211_CONN_MODE_HE && in ieee80211_assoc_config_link()
5100 elems->he_cap) { in ieee80211_assoc_config_link()
5102 elems->he_cap, in ieee80211_assoc_config_link()
5103 elems->he_cap_len, in ieee80211_assoc_config_link()
5104 elems->he_6ghz_capa, in ieee80211_assoc_config_link()
5107 bss_conf->he_support = link_sta->pub->he_cap.has_he; in ieee80211_assoc_config_link()
5108 if (elems->rsnx && elems->rsnx_len && in ieee80211_assoc_config_link()
5109 (elems->rsnx[0] & WLAN_RSNX_CAPA_PROTECTED_TWT) && in ieee80211_assoc_config_link()
5110 wiphy_ext_feature_isset(local->hw.wiphy, in ieee80211_assoc_config_link()
5112 bss_conf->twt_protected = true; in ieee80211_assoc_config_link()
5114 bss_conf->twt_protected = false; in ieee80211_assoc_config_link()
5119 if (elems->eht_operation && elems->eht_cap && in ieee80211_assoc_config_link()
5120 link->u.mgd.conn.mode >= IEEE80211_CONN_MODE_EHT) { in ieee80211_assoc_config_link()
5122 elems->he_cap, in ieee80211_assoc_config_link()
5123 elems->he_cap_len, in ieee80211_assoc_config_link()
5124 elems->eht_cap, in ieee80211_assoc_config_link()
5125 elems->eht_cap_len, in ieee80211_assoc_config_link()
5128 bss_conf->eht_support = link_sta->pub->eht_cap.has_eht; in ieee80211_assoc_config_link()
5130 bss_conf->eht_support = false; in ieee80211_assoc_config_link()
5133 bss_conf->he_support = false; in ieee80211_assoc_config_link()
5134 bss_conf->twt_requester = false; in ieee80211_assoc_config_link()
5135 bss_conf->twt_protected = false; in ieee80211_assoc_config_link()
5136 bss_conf->eht_support = false; in ieee80211_assoc_config_link()
5139 bss_conf->twt_broadcast = in ieee80211_assoc_config_link()
5142 if (bss_conf->he_support) { in ieee80211_assoc_config_link()
5143 bss_conf->he_bss_color.color = in ieee80211_assoc_config_link()
5144 le32_get_bits(elems->he_operation->he_oper_params, in ieee80211_assoc_config_link()
5146 bss_conf->he_bss_color.partial = in ieee80211_assoc_config_link()
5147 le32_get_bits(elems->he_operation->he_oper_params, in ieee80211_assoc_config_link()
5149 bss_conf->he_bss_color.enabled = in ieee80211_assoc_config_link()
5150 !le32_get_bits(elems->he_operation->he_oper_params, in ieee80211_assoc_config_link()
5153 if (bss_conf->he_bss_color.enabled) in ieee80211_assoc_config_link()
5156 bss_conf->htc_trig_based_pkt_ext = in ieee80211_assoc_config_link()
5157 le32_get_bits(elems->he_operation->he_oper_params, in ieee80211_assoc_config_link()
5159 bss_conf->frame_time_rts_th = in ieee80211_assoc_config_link()
5160 le32_get_bits(elems->he_operation->he_oper_params, in ieee80211_assoc_config_link()
5163 bss_conf->uora_exists = !!elems->uora_element; in ieee80211_assoc_config_link()
5164 if (elems->uora_element) in ieee80211_assoc_config_link()
5165 bss_conf->uora_ocw_range = elems->uora_element[0]; in ieee80211_assoc_config_link()
5167 ieee80211_he_op_ie_to_bss_conf(&sdata->vif, elems->he_operation); in ieee80211_assoc_config_link()
5168 ieee80211_he_spr_ie_to_bss_conf(&sdata->vif, elems->he_spr); in ieee80211_assoc_config_link()
5172 if (cbss->transmitted_bss) { in ieee80211_assoc_config_link()
5173 bss_conf->nontransmitted = true; in ieee80211_assoc_config_link()
5174 ether_addr_copy(bss_conf->transmitter_bssid, in ieee80211_assoc_config_link()
5175 cbss->transmitted_bss->bssid); in ieee80211_assoc_config_link()
5176 bss_conf->bssid_indicator = cbss->max_bssid_indicator; in ieee80211_assoc_config_link()
5177 bss_conf->bssid_index = cbss->bssid_index; in ieee80211_assoc_config_link()
5192 if (elems->opmode_notif && in ieee80211_assoc_config_link()
5193 !(*elems->opmode_notif & IEEE80211_OPMODE_NOTIF_RX_NSS_TYPE_BF)) { in ieee80211_assoc_config_link()
5196 nss = *elems->opmode_notif & IEEE80211_OPMODE_NOTIF_RX_NSS_MASK; in ieee80211_assoc_config_link()
5199 link_sta->pub->rx_nss = nss; in ieee80211_assoc_config_link()
5204 * of the first value the AP uses. Setting -1 here has in ieee80211_assoc_config_link()
5206 * 4-bit value. in ieee80211_assoc_config_link()
5208 link->u.mgd.wmm_last_param_set = -1; in ieee80211_assoc_config_link()
5209 link->u.mgd.mu_edca_last_param_set = -1; in ieee80211_assoc_config_link()
5211 if (link->u.mgd.disable_wmm_tracking) { in ieee80211_assoc_config_link()
5213 } else if (!ieee80211_sta_wmm_params(local, link, elems->wmm_param, in ieee80211_assoc_config_link()
5214 elems->wmm_param_len, in ieee80211_assoc_config_link()
5215 elems->mu_edca_param_set)) { in ieee80211_assoc_config_link()
5225 link->u.mgd.disable_wmm_tracking = true; in ieee80211_assoc_config_link()
5228 if (elems->max_idle_period_ie) { in ieee80211_assoc_config_link()
5229 bss_conf->max_idle_period = in ieee80211_assoc_config_link()
5230 le16_to_cpu(elems->max_idle_period_ie->max_idle_period); in ieee80211_assoc_config_link()
5231 bss_conf->protected_keep_alive = in ieee80211_assoc_config_link()
5232 !!(elems->max_idle_period_ie->idle_options & in ieee80211_assoc_config_link()
5236 bss_conf->max_idle_period = 0; in ieee80211_assoc_config_link()
5237 bss_conf->protected_keep_alive = false; in ieee80211_assoc_config_link()
5242 bss_conf->assoc_capability = capab_info; in ieee80211_assoc_config_link()
5256 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_mgd_setup_link_sta()
5257 struct ieee80211_local *local = sdata->local; in ieee80211_mgd_setup_link_sta()
5258 struct ieee80211_bss *bss = (void *)cbss->priv; in ieee80211_mgd_setup_link_sta()
5261 int min_rate = INT_MAX, min_rate_index = -1; in ieee80211_mgd_setup_link_sta()
5264 memcpy(link_sta->addr, cbss->bssid, ETH_ALEN); in ieee80211_mgd_setup_link_sta()
5265 memcpy(link_sta->pub->addr, cbss->bssid, ETH_ALEN); in ieee80211_mgd_setup_link_sta()
5268 if (cbss->channel->band == NL80211_BAND_S1GHZ) { in ieee80211_mgd_setup_link_sta()
5273 sband = local->hw.wiphy->bands[cbss->channel->band]; in ieee80211_mgd_setup_link_sta()
5275 ieee80211_get_rates(sband, bss->supp_rates, bss->supp_rates_len, in ieee80211_mgd_setup_link_sta()
5287 * we can connect -- with a warning. in ieee80211_mgd_setup_link_sta()
5293 return -EINVAL; in ieee80211_mgd_setup_link_sta()
5300 link_sta->pub->supp_rates[cbss->channel->band] = rates; in ieee80211_mgd_setup_link_sta()
5304 link->conf->basic_rates = basic_rates; in ieee80211_mgd_setup_link_sta()
5307 link->operating_11g_mode = sband->band == NL80211_BAND_2GHZ && in ieee80211_mgd_setup_link_sta()
5328 if (link->u.mgd.conn.mode < IEEE80211_CONN_MODE_HT) in ieee80211_max_rx_chains()
5332 if (ht_cap_elem && ht_cap_elem->datalen >= sizeof(*ht_cap)) { in ieee80211_max_rx_chains()
5333 ht_cap = (void *)ht_cap_elem->data; in ieee80211_max_rx_chains()
5334 chains = ieee80211_mcs_to_chains(&ht_cap->mcs); in ieee80211_max_rx_chains()
5341 if (link->u.mgd.conn.mode < IEEE80211_CONN_MODE_VHT) in ieee80211_max_rx_chains()
5345 if (vht_cap_elem && vht_cap_elem->datalen >= sizeof(*vht_cap)) { in ieee80211_max_rx_chains()
5349 vht_cap = (void *)vht_cap_elem->data; in ieee80211_max_rx_chains()
5350 tx_mcs_map = le16_to_cpu(vht_cap->supp_mcs.tx_mcs_map); in ieee80211_max_rx_chains()
5351 for (nss = 8; nss > 0; nss--) { in ieee80211_max_rx_chains()
5352 if (((tx_mcs_map >> (2 * (nss - 1))) & 3) != in ieee80211_max_rx_chains()
5360 if (link->u.mgd.conn.mode < IEEE80211_CONN_MODE_HE) in ieee80211_max_rx_chains()
5363 ies = rcu_dereference(cbss->ies); in ieee80211_max_rx_chains()
5365 ies->data, ies->len); in ieee80211_max_rx_chains()
5367 if (!he_cap_elem || he_cap_elem->datalen < sizeof(*he_cap)) in ieee80211_max_rx_chains()
5371 he_cap = (void *)(he_cap_elem->data + 1); in ieee80211_max_rx_chains()
5375 if (he_cap_elem->datalen < 1 + mcs_nss_size + sizeof(*he_cap)) in ieee80211_max_rx_chains()
5381 mcs_80_map = le16_to_cpu(he_mcs_nss_supp->tx_mcs_80); in ieee80211_max_rx_chains()
5383 for (i = 7; i >= 0; i--) { in ieee80211_max_rx_chains()
5392 support_160 = he_cap->phy_cap_info[0] & in ieee80211_max_rx_chains()
5398 mcs_160_map = le16_to_cpu(he_mcs_nss_supp->tx_mcs_160); in ieee80211_max_rx_chains()
5399 for (i = 7; i >= 0; i--) { in ieee80211_max_rx_chains()
5418 struct ieee80211_sta_ht_cap sta_ht_cap = sband->ht_cap; in ieee80211_determine_our_sta_mode()
5419 bool is_5ghz = sband->band == NL80211_BAND_5GHZ; in ieee80211_determine_our_sta_mode()
5420 bool is_6ghz = sband->band == NL80211_BAND_6GHZ; in ieee80211_determine_our_sta_mode()
5425 if (sband->band == NL80211_BAND_S1GHZ) { in ieee80211_determine_our_sta_mode()
5426 conn->mode = IEEE80211_CONN_MODE_S1G; in ieee80211_determine_our_sta_mode()
5427 conn->bw_limit = IEEE80211_CONN_BW_LIMIT_20; in ieee80211_determine_our_sta_mode()
5432 conn->mode = IEEE80211_CONN_MODE_LEGACY; in ieee80211_determine_our_sta_mode()
5433 conn->bw_limit = IEEE80211_CONN_BW_LIMIT_20; in ieee80211_determine_our_sta_mode()
5437 if (req && req->flags & ASSOC_REQ_DISABLE_HT) { in ieee80211_determine_our_sta_mode()
5452 for (i = 0; i < req->crypto.n_ciphers_pairwise; i++) { in ieee80211_determine_our_sta_mode()
5453 if (req->crypto.ciphers_pairwise[i] == WLAN_CIPHER_SUITE_WEP40 || in ieee80211_determine_our_sta_mode()
5454 req->crypto.ciphers_pairwise[i] == WLAN_CIPHER_SUITE_TKIP || in ieee80211_determine_our_sta_mode()
5455 req->crypto.ciphers_pairwise[i] == WLAN_CIPHER_SUITE_WEP104) { in ieee80211_determine_our_sta_mode()
5456 netdev_info(sdata->dev, in ieee80211_determine_our_sta_mode()
5470 conn->mode = IEEE80211_CONN_MODE_HT; in ieee80211_determine_our_sta_mode()
5471 conn->bw_limit = sta_ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40 ? in ieee80211_determine_our_sta_mode()
5475 memcpy(&vht_cap, &sband->vht_cap, sizeof(vht_cap)); in ieee80211_determine_our_sta_mode()
5478 if (req && req->flags & ASSOC_REQ_DISABLE_VHT) { in ieee80211_determine_our_sta_mode()
5488 if (conn->bw_limit == IEEE80211_CONN_BW_LIMIT_20) { in ieee80211_determine_our_sta_mode()
5495 for (i = 0; i < sband->n_channels; i++) { in ieee80211_determine_our_sta_mode()
5496 if (sband->channels[i].flags & (IEEE80211_CHAN_DISABLED | in ieee80211_determine_our_sta_mode()
5515 /* VHT - if we have - is fine, including 80 MHz, check 160 below again */ in ieee80211_determine_our_sta_mode()
5516 if (sband->band != NL80211_BAND_2GHZ) { in ieee80211_determine_our_sta_mode()
5517 conn->mode = IEEE80211_CONN_MODE_VHT; in ieee80211_determine_our_sta_mode()
5518 conn->bw_limit = IEEE80211_CONN_BW_LIMIT_160; in ieee80211_determine_our_sta_mode()
5524 conn->bw_limit = IEEE80211_CONN_BW_LIMIT_80; in ieee80211_determine_our_sta_mode()
5529 if (req && req->flags & ASSOC_REQ_DISABLE_HE) { in ieee80211_determine_our_sta_mode()
5535 he_cap = ieee80211_get_he_iftype_cap_vif(sband, &sdata->vif); in ieee80211_determine_our_sta_mode()
5544 conn->mode = IEEE80211_CONN_MODE_HE; in ieee80211_determine_our_sta_mode()
5547 switch (sband->band) { in ieee80211_determine_our_sta_mode()
5550 if (he_cap->he_cap_elem.phy_cap_info[0] & in ieee80211_determine_our_sta_mode()
5553 conn->bw_limit = IEEE80211_CONN_BW_LIMIT_20; in ieee80211_determine_our_sta_mode()
5558 if (!(he_cap->he_cap_elem.phy_cap_info[0] & in ieee80211_determine_our_sta_mode()
5560 conn->bw_limit = IEEE80211_CONN_BW_LIMIT_20; in ieee80211_determine_our_sta_mode()
5565 if (!(he_cap->he_cap_elem.phy_cap_info[0] & in ieee80211_determine_our_sta_mode()
5567 conn->bw_limit = min_t(enum ieee80211_conn_bw_limit, in ieee80211_determine_our_sta_mode()
5568 conn->bw_limit, in ieee80211_determine_our_sta_mode()
5575 if (he_cap->he_cap_elem.phy_cap_info[0] & in ieee80211_determine_our_sta_mode()
5578 conn->bw_limit = min_t(enum ieee80211_conn_bw_limit, in ieee80211_determine_our_sta_mode()
5579 conn->bw_limit, in ieee80211_determine_our_sta_mode()
5586 if (req && req->flags & ASSOC_REQ_DISABLE_EHT) { in ieee80211_determine_our_sta_mode()
5592 eht_cap = ieee80211_get_eht_iftype_cap_vif(sband, &sdata->vif); in ieee80211_determine_our_sta_mode()
5601 conn->mode = IEEE80211_CONN_MODE_EHT; in ieee80211_determine_our_sta_mode()
5605 eht_cap->eht_cap_elem.phy_cap_info[0] & IEEE80211_EHT_PHY_CAP0_320MHZ_IN_6GHZ) in ieee80211_determine_our_sta_mode()
5606 conn->bw_limit = IEEE80211_CONN_BW_LIMIT_320; in ieee80211_determine_our_sta_mode()
5614 ieee80211_conn_mode_str(conn->mode), in ieee80211_determine_our_sta_mode()
5615 20 * (1 << conn->bw_limit)); in ieee80211_determine_our_sta_mode()
5626 req->link_id > 0 ? req->link_id : 0, in ieee80211_determine_our_sta_mode_auth()
5644 conn->mode = min_t(enum ieee80211_conn_mode, in ieee80211_determine_our_sta_mode_assoc()
5645 conn->mode, tmp.mode); in ieee80211_determine_our_sta_mode_assoc()
5646 conn->bw_limit = min_t(enum ieee80211_conn_bw_limit, in ieee80211_determine_our_sta_mode_assoc()
5647 conn->bw_limit, tmp.bw_limit); in ieee80211_determine_our_sta_mode_assoc()
5674 struct ieee80211_local *local = sdata->local; in ieee80211_prep_channel()
5675 bool is_6ghz = cbss->channel->band == NL80211_BAND_6GHZ; in ieee80211_prep_channel()
5681 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_prep_channel()
5693 if (mlo && !elems->ml_basic) { in ieee80211_prep_channel()
5697 return -EINVAL; in ieee80211_prep_channel()
5700 if (link && is_6ghz && conn->mode >= IEEE80211_CONN_MODE_HE) { in ieee80211_prep_channel()
5703 if (elems->pwr_constr_elem) in ieee80211_prep_channel()
5704 link->conf->pwr_reduction = *elems->pwr_constr_elem; in ieee80211_prep_channel()
5706 he_6ghz_oper = ieee80211_he_6ghz_oper(elems->he_operation); in ieee80211_prep_channel()
5708 link->conf->power_type = in ieee80211_prep_channel()
5709 ieee80211_ap_power_type(he_6ghz_oper->control); in ieee80211_prep_channel()
5713 cbss->channel->center_freq); in ieee80211_prep_channel()
5715 link->conf->tpe = elems->tpe; in ieee80211_prep_channel()
5716 ieee80211_rearrange_tpe(&link->conf->tpe, &ap_chandef, in ieee80211_prep_channel()
5728 link->needed_rx_chains = min(ieee80211_max_rx_chains(link, cbss), in ieee80211_prep_channel()
5729 local->rx_chains); in ieee80211_prep_channel()
5758 const u8 *tim_ie = cfg80211_find_ie(WLAN_EID_TIM, ies->data, ies->len); in ieee80211_get_dtim()
5759 const u8 *idx_ie = cfg80211_find_ie(WLAN_EID_MULTI_BSSID_IDX, ies->data, in ieee80211_get_dtim()
5760 ies->len); in ieee80211_get_dtim()
5769 *dtim_count = valid ? tim->dtim_count : 0; in ieee80211_get_dtim()
5772 *dtim_period = valid ? tim->dtim_period : 0; in ieee80211_get_dtim()
5774 /* Check if value is overridden by non-transmitted profile */ in ieee80211_get_dtim()
5781 *dtim_count = idx->dtim_count; in ieee80211_get_dtim()
5784 *dtim_period = idx->dtim_period; in ieee80211_get_dtim()
5794 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_assoc_success()
5795 struct ieee80211_mgd_assoc_data *assoc_data = ifmgd->assoc_data; in ieee80211_assoc_success()
5796 struct ieee80211_local *local = sdata->local; in ieee80211_assoc_success()
5803 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_assoc_success()
5808 sta = sta_info_get(sdata, assoc_data->ap_addr); in ieee80211_assoc_success()
5812 sta->sta.spp_amsdu = assoc_data->spp_amsdu; in ieee80211_assoc_success()
5814 if (ieee80211_vif_is_mld(&sdata->vif)) { in ieee80211_assoc_success()
5816 if (!assoc_data->link[link_id].bss) in ieee80211_assoc_success()
5820 if (assoc_data->link[link_id].disabled) in ieee80211_assoc_success()
5823 if (link_id != assoc_data->assoc_link_id) { in ieee80211_assoc_success()
5834 struct cfg80211_bss *cbss = assoc_data->link[link_id].bss; in ieee80211_assoc_success()
5841 link = sdata_dereference(sdata->link[link_id], sdata); in ieee80211_assoc_success()
5845 if (ieee80211_vif_is_mld(&sdata->vif)) in ieee80211_assoc_success()
5848 link->conf->addr, in ieee80211_assoc_success()
5849 assoc_data->link[link_id].bss->bssid, in ieee80211_assoc_success()
5850 link_id == assoc_data->assoc_link_id ? in ieee80211_assoc_success()
5853 link_sta = rcu_dereference_protected(sta->link[link_id], in ieee80211_assoc_success()
5854 lockdep_is_held(&local->hw.wiphy->mtx)); in ieee80211_assoc_success()
5858 if (!link->u.mgd.have_beacon) { in ieee80211_assoc_success()
5862 ies = rcu_dereference(cbss->beacon_ies); in ieee80211_assoc_success()
5864 link->u.mgd.have_beacon = true; in ieee80211_assoc_success()
5866 ies = rcu_dereference(cbss->ies); in ieee80211_assoc_success()
5868 &link->conf->sync_dtim_count, in ieee80211_assoc_success()
5869 &link->u.mgd.dtim_period); in ieee80211_assoc_success()
5870 link->conf->beacon_int = cbss->beacon_interval; in ieee80211_assoc_success()
5874 link->conf->dtim_period = link->u.mgd.dtim_period ?: 1; in ieee80211_assoc_success()
5876 if (link_id != assoc_data->assoc_link_id) { in ieee80211_assoc_success()
5877 link->u.mgd.conn = assoc_data->link[link_id].conn; in ieee80211_assoc_success()
5880 true, &link->u.mgd.conn, in ieee80211_assoc_success()
5881 assoc_data->userspace_selectors); in ieee80211_assoc_success()
5889 assoc_data->link[link_id].bss); in ieee80211_assoc_success()
5894 assoc_data->link[link_id].bss, in ieee80211_assoc_success()
5899 if (assoc_data->link[link_id].status != WLAN_STATUS_SUCCESS) { in ieee80211_assoc_success()
5905 if (link_id != assoc_data->assoc_link_id) { in ieee80211_assoc_success()
5917 if (ifmgd->flags & IEEE80211_STA_MFP_ENABLED) { in ieee80211_assoc_success()
5919 sta->sta.mfp = true; in ieee80211_assoc_success()
5921 sta->sta.mfp = false; in ieee80211_assoc_success()
5924 ieee80211_sta_set_max_amsdu_subframes(sta, elems->ext_capab, in ieee80211_assoc_success()
5925 elems->ext_capab_len); in ieee80211_assoc_success()
5927 sta->sta.wme = (elems->wmm_param || elems->s1g_capab) && in ieee80211_assoc_success()
5928 local->hw.queues >= IEEE80211_NUM_ACS; in ieee80211_assoc_success()
5931 if (!err && !(ifmgd->flags & IEEE80211_STA_CONTROL_PORT)) in ieee80211_assoc_success()
5936 sta->sta.addr); in ieee80211_assoc_success()
5941 if (sdata->wdev.use_4addr) in ieee80211_assoc_success()
5942 drv_sta_set_4addr(local, sdata, &sta->sta, true); in ieee80211_assoc_success()
5947 * If we're using 4-addr mode, let the AP know that we're in ieee80211_assoc_success()
5948 * doing so, so that it can create the STA VLAN on its side in ieee80211_assoc_success()
5950 if (ifmgd->use_4addr) in ieee80211_assoc_success()
5962 eth_zero_addr(sdata->vif.cfg.ap_addr); in ieee80211_assoc_success()
5970 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_rx_mgmt_assoc_resp()
5971 struct ieee80211_mgd_assoc_data *assoc_data = ifmgd->assoc_data; in ieee80211_rx_mgmt_assoc_resp()
5975 .link_id = -1, in ieee80211_rx_mgmt_assoc_resp()
5989 .uapsd_queues = -1, in ieee80211_rx_mgmt_assoc_resp()
5994 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_rx_mgmt_assoc_resp()
5999 info.link_id = assoc_data->assoc_link_id; in ieee80211_rx_mgmt_assoc_resp()
6002 assoc_data->link[assoc_data->assoc_link_id].conn.mode; in ieee80211_rx_mgmt_assoc_resp()
6004 if (!ether_addr_equal(assoc_data->ap_addr, mgmt->bssid) || in ieee80211_rx_mgmt_assoc_resp()
6005 !ether_addr_equal(assoc_data->ap_addr, mgmt->sa)) in ieee80211_rx_mgmt_assoc_resp()
6016 reassoc = ieee80211_is_reassoc_resp(mgmt->frame_control); in ieee80211_rx_mgmt_assoc_resp()
6017 capab_info = le16_to_cpu(mgmt->u.assoc_resp.capab_info); in ieee80211_rx_mgmt_assoc_resp()
6018 status_code = le16_to_cpu(mgmt->u.assoc_resp.status_code); in ieee80211_rx_mgmt_assoc_resp()
6019 if (assoc_data->s1g) in ieee80211_rx_mgmt_assoc_resp()
6020 elem_start = mgmt->u.s1g_assoc_resp.variable; in ieee80211_rx_mgmt_assoc_resp()
6022 elem_start = mgmt->u.assoc_resp.variable; in ieee80211_rx_mgmt_assoc_resp()
6025 * Note: this may not be perfect, AP might misbehave - if in ieee80211_rx_mgmt_assoc_resp()
6033 if (assoc_data->fils_kek_len && in ieee80211_rx_mgmt_assoc_resp()
6037 elem_len = len - (elem_start - (u8 *)mgmt); in ieee80211_rx_mgmt_assoc_resp()
6044 if (elems->aid_resp) in ieee80211_rx_mgmt_assoc_resp()
6045 aid = le16_to_cpu(elems->aid_resp->aid); in ieee80211_rx_mgmt_assoc_resp()
6046 else if (assoc_data->s1g) in ieee80211_rx_mgmt_assoc_resp()
6049 aid = le16_to_cpu(mgmt->u.assoc_resp.aid); in ieee80211_rx_mgmt_assoc_resp()
6053 * (802.11-2016 9.4.1.8 AID field) in ieee80211_rx_mgmt_assoc_resp()
6059 reassoc ? "Rea" : "A", assoc_data->ap_addr, in ieee80211_rx_mgmt_assoc_resp()
6062 ifmgd->broken_ap = false; in ieee80211_rx_mgmt_assoc_resp()
6065 elems->timeout_int && in ieee80211_rx_mgmt_assoc_resp()
6066 elems->timeout_int->type == WLAN_TIMEOUT_ASSOC_COMEBACK) { in ieee80211_rx_mgmt_assoc_resp()
6069 cfg80211_assoc_comeback(sdata->dev, assoc_data->ap_addr, in ieee80211_rx_mgmt_assoc_resp()
6070 le32_to_cpu(elems->timeout_int->value)); in ieee80211_rx_mgmt_assoc_resp()
6072 tu = le32_to_cpu(elems->timeout_int->value); in ieee80211_rx_mgmt_assoc_resp()
6076 assoc_data->ap_addr, tu, ms); in ieee80211_rx_mgmt_assoc_resp()
6077 assoc_data->timeout = jiffies + msecs_to_jiffies(ms); in ieee80211_rx_mgmt_assoc_resp()
6078 assoc_data->timeout_started = true; in ieee80211_rx_mgmt_assoc_resp()
6079 assoc_data->comeback = true; in ieee80211_rx_mgmt_assoc_resp()
6081 run_again(sdata, assoc_data->timeout); in ieee80211_rx_mgmt_assoc_resp()
6087 assoc_data->ap_addr, status_code); in ieee80211_rx_mgmt_assoc_resp()
6090 drv_event_callback(sdata->local, sdata, &event); in ieee80211_rx_mgmt_assoc_resp()
6097 ifmgd->broken_ap = true; in ieee80211_rx_mgmt_assoc_resp()
6100 if (ieee80211_vif_is_mld(&sdata->vif)) { in ieee80211_rx_mgmt_assoc_resp()
6103 if (!elems->ml_basic) { in ieee80211_rx_mgmt_assoc_resp()
6105 "MLO association with %pM but no (basic) multi-link element in response!\n", in ieee80211_rx_mgmt_assoc_resp()
6106 assoc_data->ap_addr); in ieee80211_rx_mgmt_assoc_resp()
6110 common = (void *)elems->ml_basic->variable; in ieee80211_rx_mgmt_assoc_resp()
6112 if (memcmp(assoc_data->ap_addr, in ieee80211_rx_mgmt_assoc_resp()
6113 common->mld_mac_addr, ETH_ALEN)) { in ieee80211_rx_mgmt_assoc_resp()
6116 common->mld_mac_addr, in ieee80211_rx_mgmt_assoc_resp()
6117 assoc_data->ap_addr); in ieee80211_rx_mgmt_assoc_resp()
6121 sdata->vif.cfg.eml_cap = in ieee80211_rx_mgmt_assoc_resp()
6122 ieee80211_mle_get_eml_cap((const void *)elems->ml_basic); in ieee80211_rx_mgmt_assoc_resp()
6123 sdata->vif.cfg.eml_med_sync_delay = in ieee80211_rx_mgmt_assoc_resp()
6124 ieee80211_mle_get_eml_med_sync_delay((const void *)elems->ml_basic); in ieee80211_rx_mgmt_assoc_resp()
6125 sdata->vif.cfg.mld_capa_op = in ieee80211_rx_mgmt_assoc_resp()
6126 ieee80211_mle_get_mld_capa_op((const void *)elems->ml_basic); in ieee80211_rx_mgmt_assoc_resp()
6129 sdata->vif.cfg.aid = aid; in ieee80211_rx_mgmt_assoc_resp()
6133 /* oops -- internal error -- send timeout for now */ in ieee80211_rx_mgmt_assoc_resp()
6138 drv_event_callback(sdata->local, sdata, &event); in ieee80211_rx_mgmt_assoc_resp()
6147 if (!assoc_data->link[link_id].bss) in ieee80211_rx_mgmt_assoc_resp()
6150 resp.links[link_id].bss = assoc_data->link[link_id].bss; in ieee80211_rx_mgmt_assoc_resp()
6152 assoc_data->link[link_id].addr); in ieee80211_rx_mgmt_assoc_resp()
6153 resp.links[link_id].status = assoc_data->link[link_id].status; in ieee80211_rx_mgmt_assoc_resp()
6155 link = sdata_dereference(sdata->link[link_id], sdata); in ieee80211_rx_mgmt_assoc_resp()
6159 /* get uapsd queues configuration - same for all links */ in ieee80211_rx_mgmt_assoc_resp()
6162 if (link->tx_conf[ac].uapsd) in ieee80211_rx_mgmt_assoc_resp()
6166 if (ieee80211_vif_is_mld(&sdata->vif)) { in ieee80211_rx_mgmt_assoc_resp()
6167 ether_addr_copy(ap_mld_addr, sdata->vif.cfg.ap_addr); in ieee80211_rx_mgmt_assoc_resp()
6178 resp.req_ies = ifmgd->assoc_req_ies; in ieee80211_rx_mgmt_assoc_resp()
6179 resp.req_ies_len = ifmgd->assoc_req_ies_len; in ieee80211_rx_mgmt_assoc_resp()
6180 cfg80211_rx_assoc_resp(sdata->dev, &resp); in ieee80211_rx_mgmt_assoc_resp()
6182 drv_mgd_complete_tx(sdata->local, sdata, &info); in ieee80211_rx_mgmt_assoc_resp()
6194 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_rx_bss_info()
6195 struct ieee80211_local *local = sdata->local; in ieee80211_rx_bss_info()
6199 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_rx_bss_info()
6201 channel = ieee80211_get_channel_khz(local->hw.wiphy, in ieee80211_rx_bss_info()
6208 link->conf->beacon_rate = bss->beacon_rate; in ieee80211_rx_bss_info()
6217 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_rx_mgmt_probe_resp()
6218 struct ieee80211_mgmt *mgmt = (void *)skb->data; in ieee80211_rx_mgmt_probe_resp()
6220 struct ieee80211_rx_status *rx_status = (void *) skb->cb; in ieee80211_rx_mgmt_probe_resp()
6222 size_t baselen, len = skb->len; in ieee80211_rx_mgmt_probe_resp()
6224 ifmgd = &sdata->u.mgd; in ieee80211_rx_mgmt_probe_resp()
6226 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_rx_mgmt_probe_resp()
6235 channel = ieee80211_get_channel(sdata->local->hw.wiphy, in ieee80211_rx_mgmt_probe_resp()
6236 rx_status->freq); in ieee80211_rx_mgmt_probe_resp()
6240 if (!ether_addr_equal(mgmt->da, sdata->vif.addr) && in ieee80211_rx_mgmt_probe_resp()
6241 (channel->band != NL80211_BAND_6GHZ || in ieee80211_rx_mgmt_probe_resp()
6242 !is_broadcast_ether_addr(mgmt->da))) in ieee80211_rx_mgmt_probe_resp()
6245 baselen = (u8 *) mgmt->u.probe_resp.variable - (u8 *) mgmt; in ieee80211_rx_mgmt_probe_resp()
6251 if (ifmgd->associated && in ieee80211_rx_mgmt_probe_resp()
6252 ether_addr_equal(mgmt->bssid, link->u.mgd.bssid)) in ieee80211_rx_mgmt_probe_resp()
6267 * XXX: This list needs to be dynamic -- userspace needs to be able to
6286 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_handle_beacon_sig()
6290 if (!link->u.mgd.tracking_signal_avg) { in ieee80211_handle_beacon_sig()
6291 link->u.mgd.tracking_signal_avg = true; in ieee80211_handle_beacon_sig()
6292 ewma_beacon_signal_init(&link->u.mgd.ave_beacon_signal); in ieee80211_handle_beacon_sig()
6293 link->u.mgd.last_cqm_event_signal = 0; in ieee80211_handle_beacon_sig()
6294 link->u.mgd.count_beacon_signal = 1; in ieee80211_handle_beacon_sig()
6295 link->u.mgd.last_ave_beacon_signal = 0; in ieee80211_handle_beacon_sig()
6297 link->u.mgd.count_beacon_signal++; in ieee80211_handle_beacon_sig()
6300 ewma_beacon_signal_add(&link->u.mgd.ave_beacon_signal, in ieee80211_handle_beacon_sig()
6301 -rx_status->signal); in ieee80211_handle_beacon_sig()
6303 if (ifmgd->rssi_min_thold != ifmgd->rssi_max_thold && in ieee80211_handle_beacon_sig()
6304 link->u.mgd.count_beacon_signal >= IEEE80211_SIGNAL_AVE_MIN_COUNT) { in ieee80211_handle_beacon_sig()
6305 int sig = -ewma_beacon_signal_read(&link->u.mgd.ave_beacon_signal); in ieee80211_handle_beacon_sig()
6306 int last_sig = link->u.mgd.last_ave_beacon_signal; in ieee80211_handle_beacon_sig()
6315 if (sig > ifmgd->rssi_max_thold && in ieee80211_handle_beacon_sig()
6316 (last_sig <= ifmgd->rssi_min_thold || last_sig == 0)) { in ieee80211_handle_beacon_sig()
6317 link->u.mgd.last_ave_beacon_signal = sig; in ieee80211_handle_beacon_sig()
6320 } else if (sig < ifmgd->rssi_min_thold && in ieee80211_handle_beacon_sig()
6321 (last_sig >= ifmgd->rssi_max_thold || in ieee80211_handle_beacon_sig()
6323 link->u.mgd.last_ave_beacon_signal = sig; in ieee80211_handle_beacon_sig()
6329 if (bss_conf->cqm_rssi_thold && in ieee80211_handle_beacon_sig()
6330 link->u.mgd.count_beacon_signal >= IEEE80211_SIGNAL_AVE_MIN_COUNT && in ieee80211_handle_beacon_sig()
6331 !(sdata->vif.driver_flags & IEEE80211_VIF_SUPPORTS_CQM_RSSI)) { in ieee80211_handle_beacon_sig()
6332 int sig = -ewma_beacon_signal_read(&link->u.mgd.ave_beacon_signal); in ieee80211_handle_beacon_sig()
6333 int last_event = link->u.mgd.last_cqm_event_signal; in ieee80211_handle_beacon_sig()
6334 int thold = bss_conf->cqm_rssi_thold; in ieee80211_handle_beacon_sig()
6335 int hyst = bss_conf->cqm_rssi_hyst; in ieee80211_handle_beacon_sig()
6338 (last_event == 0 || sig < last_event - hyst)) { in ieee80211_handle_beacon_sig()
6339 link->u.mgd.last_cqm_event_signal = sig; in ieee80211_handle_beacon_sig()
6341 &sdata->vif, 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()
6354 if (bss_conf->cqm_rssi_low && in ieee80211_handle_beacon_sig()
6355 link->u.mgd.count_beacon_signal >= IEEE80211_SIGNAL_AVE_MIN_COUNT) { in ieee80211_handle_beacon_sig()
6356 int sig = -ewma_beacon_signal_read(&link->u.mgd.ave_beacon_signal); in ieee80211_handle_beacon_sig()
6357 int last_event = link->u.mgd.last_cqm_event_signal; in ieee80211_handle_beacon_sig()
6358 int low = bss_conf->cqm_rssi_low; in ieee80211_handle_beacon_sig()
6359 int high = bss_conf->cqm_rssi_high; in ieee80211_handle_beacon_sig()
6363 link->u.mgd.last_cqm_event_signal = sig; in ieee80211_handle_beacon_sig()
6365 &sdata->vif, in ieee80211_handle_beacon_sig()
6370 link->u.mgd.last_cqm_event_signal = sig; in ieee80211_handle_beacon_sig()
6372 &sdata->vif, in ieee80211_handle_beacon_sig()
6382 if (ether_addr_equal(tx_bssid, bss->bssid)) in ieee80211_rx_our_beacon()
6384 if (!bss->transmitted_bss) in ieee80211_rx_our_beacon()
6386 return ether_addr_equal(tx_bssid, bss->transmitted_bss->bssid); in ieee80211_rx_our_beacon()
6398 if (!sdata->u.mgd.removed_links) in ieee80211_ml_reconf_work()
6403 sdata->vif.valid_links, sdata->u.mgd.removed_links); in ieee80211_ml_reconf_work()
6405 new_valid_links = sdata->vif.valid_links & ~sdata->u.mgd.removed_links; in ieee80211_ml_reconf_work()
6406 if (new_valid_links == sdata->vif.valid_links) in ieee80211_ml_reconf_work()
6410 !(new_valid_links & ~sdata->vif.dormant_links)) { in ieee80211_ml_reconf_work()
6412 ret = -EINVAL; in ieee80211_ml_reconf_work()
6416 new_active_links = sdata->vif.active_links & ~sdata->u.mgd.removed_links; in ieee80211_ml_reconf_work()
6417 if (new_active_links != sdata->vif.active_links) { in ieee80211_ml_reconf_work()
6421 ~sdata->vif.dormant_links) - 1); in ieee80211_ml_reconf_work()
6423 ret = ieee80211_set_active_links(&sdata->vif, new_active_links); in ieee80211_ml_reconf_work()
6431 new_dormant_links = sdata->vif.dormant_links & ~sdata->u.mgd.removed_links; in ieee80211_ml_reconf_work()
6442 cfg80211_links_removed(sdata->dev, sdata->u.mgd.removed_links); in ieee80211_ml_reconf_work()
6446 sdata->u.mgd.removed_links = 0; in ieee80211_ml_reconf_work()
6458 if (!ieee80211_vif_is_mld(&sdata->vif) || !elems->ml_reconf) in ieee80211_ml_reconfiguration()
6464 for_each_mle_subelement(sub, (const u8 *)elems->ml_reconf, in ieee80211_ml_reconfiguration()
6465 elems->ml_reconf_len) { in ieee80211_ml_reconfiguration()
6466 struct ieee80211_mle_per_sta_profile *prof = (void *)sub->data; in ieee80211_ml_reconfiguration()
6467 u8 *pos = prof->variable; in ieee80211_ml_reconfiguration()
6470 if (sub->id != IEEE80211_MLE_SUBELEM_PER_STA_PROFILE) in ieee80211_ml_reconfiguration()
6473 if (!ieee80211_mle_reconf_sta_prof_size_ok(sub->data, in ieee80211_ml_reconfiguration()
6474 sub->datalen)) in ieee80211_ml_reconfiguration()
6477 control = le16_to_cpu(prof->control); in ieee80211_ml_reconfiguration()
6496 removed_links &= sdata->vif.valid_links; in ieee80211_ml_reconfiguration()
6499 if (sdata->u.mgd.removed_links) { in ieee80211_ml_reconfiguration()
6500 sdata->u.mgd.removed_links = 0; in ieee80211_ml_reconfiguration()
6501 wiphy_delayed_work_cancel(sdata->local->hw.wiphy, in ieee80211_ml_reconfiguration()
6502 &sdata->u.mgd.ml_reconf_work); in ieee80211_ml_reconfiguration()
6510 sdata_dereference(sdata->vif.link_conf[link_id], sdata); in ieee80211_ml_reconfiguration()
6521 link_delay = link_conf->beacon_int * in ieee80211_ml_reconfiguration()
6522 (link_removal_timeout[link_id] - 1); in ieee80211_ml_reconfiguration()
6530 sdata->u.mgd.removed_links = removed_links; in ieee80211_ml_reconfiguration()
6531 wiphy_delayed_work_queue(sdata->local->hw.wiphy, in ieee80211_ml_reconfiguration()
6532 &sdata->u.mgd.ml_reconf_work, in ieee80211_ml_reconfiguration()
6544 ret = -EINVAL; in ieee80211_ttlm_set_links()
6551 if (sdata->vif.neg_ttlm.valid) { in ieee80211_ttlm_set_links()
6552 memset(&sdata->vif.neg_ttlm, 0, sizeof(sdata->vif.neg_ttlm)); in ieee80211_ttlm_set_links()
6553 sdata->vif.suspended_links = 0; in ieee80211_ttlm_set_links()
6557 if (sdata->vif.active_links != active_links) { in ieee80211_ttlm_set_links()
6562 active_links &= sdata->vif.active_links; in ieee80211_ttlm_set_links()
6565 BIT(__ffs(sdata->vif.valid_links & in ieee80211_ttlm_set_links()
6567 ret = ieee80211_set_active_links(&sdata->vif, active_links); in ieee80211_ttlm_set_links()
6574 ret = ieee80211_vif_set_links(sdata, sdata->vif.valid_links, in ieee80211_ttlm_set_links()
6581 sdata->vif.suspended_links = suspended_links; in ieee80211_ttlm_set_links()
6582 if (sdata->vif.suspended_links) in ieee80211_ttlm_set_links()
6589 ieee80211_disconnect(&sdata->vif, false); in ieee80211_ttlm_set_links()
6602 new_active_links = sdata->u.mgd.ttlm_info.map & in ieee80211_tid_to_link_map_work()
6603 sdata->vif.valid_links; in ieee80211_tid_to_link_map_work()
6604 new_dormant_links = ~sdata->u.mgd.ttlm_info.map & in ieee80211_tid_to_link_map_work()
6605 sdata->vif.valid_links; in ieee80211_tid_to_link_map_work()
6607 ieee80211_vif_set_links(sdata, sdata->vif.valid_links, 0); in ieee80211_tid_to_link_map_work()
6612 sdata->u.mgd.ttlm_info.active = true; in ieee80211_tid_to_link_map_work()
6613 sdata->u.mgd.ttlm_info.switch_time = 0; in ieee80211_tid_to_link_map_work()
6636 pos = (void *)ttlm->optional; in ieee80211_parse_adv_t2l()
6637 control = ttlm->control; in ieee80211_parse_adv_t2l()
6646 return -EINVAL; in ieee80211_parse_adv_t2l()
6652 ttlm_info->switch_time = get_unaligned_le16(pos); in ieee80211_parse_adv_t2l()
6654 /* Since ttlm_info->switch_time == 0 means no switch time, bump it in ieee80211_parse_adv_t2l()
6657 if (!ttlm_info->switch_time) in ieee80211_parse_adv_t2l()
6658 ttlm_info->switch_time = 1; in ieee80211_parse_adv_t2l()
6663 ttlm_info->duration = pos[0] | pos[1] << 8 | pos[2] << 16; in ieee80211_parse_adv_t2l()
6673 * not advertise a TID-to-link mapping that does not map all TIDs to the in ieee80211_parse_adv_t2l()
6679 return -EINVAL; in ieee80211_parse_adv_t2l()
6682 ttlm_info->map = ieee80211_get_ttlm(map_size, pos); in ieee80211_parse_adv_t2l()
6683 if (!ttlm_info->map) { in ieee80211_parse_adv_t2l()
6686 return -EINVAL; in ieee80211_parse_adv_t2l()
6694 if (map != ttlm_info->map) { in ieee80211_parse_adv_t2l()
6697 return -EINVAL; in ieee80211_parse_adv_t2l()
6712 if (!ieee80211_vif_is_mld(&sdata->vif)) in ieee80211_process_adv_ttlm()
6715 if (!elems->ttlm_num) { in ieee80211_process_adv_ttlm()
6716 if (sdata->u.mgd.ttlm_info.switch_time) { in ieee80211_process_adv_ttlm()
6717 /* if a planned TID-to-link mapping was cancelled - in ieee80211_process_adv_ttlm()
6720 wiphy_delayed_work_cancel(sdata->local->hw.wiphy, in ieee80211_process_adv_ttlm()
6721 &sdata->u.mgd.ttlm_work); in ieee80211_process_adv_ttlm()
6722 } else if (sdata->u.mgd.ttlm_info.active) { in ieee80211_process_adv_ttlm()
6723 /* if no TID-to-link element, set to default mapping in in ieee80211_process_adv_ttlm()
6727 sdata->vif.valid_links, in ieee80211_process_adv_ttlm()
6736 memset(&sdata->u.mgd.ttlm_info, 0, in ieee80211_process_adv_ttlm()
6737 sizeof(sdata->u.mgd.ttlm_info)); in ieee80211_process_adv_ttlm()
6741 for (i = 0; i < elems->ttlm_num; i++) { in ieee80211_process_adv_ttlm()
6745 res = ieee80211_parse_adv_t2l(sdata, elems->ttlm[i], in ieee80211_process_adv_ttlm()
6765 delay = st_tu - beacon_ts_tu; in ieee80211_process_adv_ttlm()
6783 delay_jiffies -= in ieee80211_process_adv_ttlm()
6788 sdata->u.mgd.ttlm_info = ttlm_info; in ieee80211_process_adv_ttlm()
6789 wiphy_delayed_work_cancel(sdata->local->hw.wiphy, in ieee80211_process_adv_ttlm()
6790 &sdata->u.mgd.ttlm_work); in ieee80211_process_adv_ttlm()
6791 wiphy_delayed_work_queue(sdata->local->hw.wiphy, in ieee80211_process_adv_ttlm()
6792 &sdata->u.mgd.ttlm_work, in ieee80211_process_adv_ttlm()
6812 if (!ieee80211_mle_size_ok((u8 *)elems->ml_basic, elems->ml_basic_len)) in ieee80211_mgd_check_cross_link_csa()
6815 common_size = ieee80211_mle_common_size((u8 *)elems->ml_basic); in ieee80211_mgd_check_cross_link_csa()
6816 subelems = (u8 *)elems->ml_basic + common_size; in ieee80211_mgd_check_cross_link_csa()
6817 subelems_len = elems->ml_basic_len - common_size; in ieee80211_mgd_check_cross_link_csa()
6821 struct ieee80211_mle_per_sta_profile *prof = (void *)sub->data; in ieee80211_mgd_check_cross_link_csa()
6825 if (!ieee80211_mle_basic_sta_prof_size_ok(sub->data, in ieee80211_mgd_check_cross_link_csa()
6826 sub->datalen)) in ieee80211_mgd_check_cross_link_csa()
6829 link_id = le16_get_bits(prof->control, in ieee80211_mgd_check_cross_link_csa()
6836 link = sdata_dereference(sdata->link[link_id], sdata); in ieee80211_mgd_check_cross_link_csa()
6859 link = sdata_dereference(sdata->link[link_id], sdata); in ieee80211_mgd_check_cross_link_csa()
6868 /* we can defragment in-place, won't use the buffer again */ in ieee80211_mgd_check_cross_link_csa()
6878 prof_elems = ieee802_11_parse_elems(prof->variable + in ieee80211_mgd_check_cross_link_csa()
6879 (prof->sta_info_len - 1), in ieee80211_mgd_check_cross_link_csa()
6880 len - in ieee80211_mgd_check_cross_link_csa()
6881 (prof->sta_info_len - 1), in ieee80211_mgd_check_cross_link_csa()
6884 /* memory allocation failed - let's hope that's transient */ in ieee80211_mgd_check_cross_link_csa()
6906 struct ieee80211_vif_cfg *cfg = &sdata->vif.cfg; in ieee80211_mgd_ssid_mismatch()
6909 if (!elems->ssid) in ieee80211_mgd_ssid_mismatch()
6913 if (elems->ssid_len == 0) in ieee80211_mgd_ssid_mismatch()
6916 if (elems->ssid_len != cfg->ssid_len) in ieee80211_mgd_ssid_mismatch()
6920 if (!memcmp(elems->ssid, zero_ssid, elems->ssid_len)) in ieee80211_mgd_ssid_mismatch()
6923 return memcmp(elems->ssid, cfg->ssid, cfg->ssid_len); in ieee80211_mgd_ssid_mismatch()
6930 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_rx_mgmt_beacon()
6931 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_rx_mgmt_beacon()
6932 struct ieee80211_bss_conf *bss_conf = link->conf; in ieee80211_rx_mgmt_beacon()
6933 struct ieee80211_vif_cfg *vif_cfg = &sdata->vif.cfg; in ieee80211_rx_mgmt_beacon()
6937 struct ieee80211_local *local = sdata->local; in ieee80211_rx_mgmt_beacon()
6947 u8 *bssid, *variable = mgmt->u.beacon.variable; in ieee80211_rx_mgmt_beacon()
6950 .mode = link->u.mgd.conn.mode, in ieee80211_rx_mgmt_beacon()
6951 .link_id = -1, in ieee80211_rx_mgmt_beacon()
6955 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_rx_mgmt_beacon()
6958 bssid = ieee80211_get_bssid(hdr, len, sdata->vif.type); in ieee80211_rx_mgmt_beacon()
6959 if (ieee80211_is_s1g_beacon(mgmt->frame_control)) { in ieee80211_rx_mgmt_beacon()
6962 if (ieee80211_is_s1g_short_beacon(ext->frame_control)) in ieee80211_rx_mgmt_beacon()
6963 variable = ext->u.s1g_short_beacon.variable; in ieee80211_rx_mgmt_beacon()
6965 variable = ext->u.s1g_beacon.variable; in ieee80211_rx_mgmt_beacon()
6968 baselen = (u8 *) variable - (u8 *) mgmt; in ieee80211_rx_mgmt_beacon()
6973 parse_params.len = len - baselen; in ieee80211_rx_mgmt_beacon()
6976 chanctx_conf = rcu_dereference(bss_conf->chanctx_conf); in ieee80211_rx_mgmt_beacon()
6983 ieee80211_channel_to_khz(chanctx_conf->def.chan)) { in ieee80211_rx_mgmt_beacon()
6987 chan = chanctx_conf->def.chan; in ieee80211_rx_mgmt_beacon()
6990 if (ifmgd->assoc_data && ifmgd->assoc_data->need_beacon && in ieee80211_rx_mgmt_beacon()
6991 !WARN_ON(ieee80211_vif_is_mld(&sdata->vif)) && in ieee80211_rx_mgmt_beacon()
6992 ieee80211_rx_our_beacon(bssid, ifmgd->assoc_data->link[0].bss)) { in ieee80211_rx_mgmt_beacon()
6993 parse_params.bss = ifmgd->assoc_data->link[0].bss; in ieee80211_rx_mgmt_beacon()
7000 if (elems->dtim_period) in ieee80211_rx_mgmt_beacon()
7001 link->u.mgd.dtim_period = elems->dtim_period; in ieee80211_rx_mgmt_beacon()
7002 link->u.mgd.have_beacon = true; in ieee80211_rx_mgmt_beacon()
7003 ifmgd->assoc_data->need_beacon = false; in ieee80211_rx_mgmt_beacon()
7004 if (ieee80211_hw_check(&local->hw, TIMING_BEACON_ONLY) && in ieee80211_rx_mgmt_beacon()
7005 !ieee80211_is_s1g_beacon(hdr->frame_control)) { in ieee80211_rx_mgmt_beacon()
7006 bss_conf->sync_tsf = in ieee80211_rx_mgmt_beacon()
7007 le64_to_cpu(mgmt->u.beacon.timestamp); in ieee80211_rx_mgmt_beacon()
7008 bss_conf->sync_device_ts = in ieee80211_rx_mgmt_beacon()
7009 rx_status->device_timestamp; in ieee80211_rx_mgmt_beacon()
7010 bss_conf->sync_dtim_count = elems->dtim_count; in ieee80211_rx_mgmt_beacon()
7013 if (elems->mbssid_config_ie) in ieee80211_rx_mgmt_beacon()
7014 bss_conf->profile_periodicity = in ieee80211_rx_mgmt_beacon()
7015 elems->mbssid_config_ie->profile_periodicity; in ieee80211_rx_mgmt_beacon()
7017 bss_conf->profile_periodicity = 0; in ieee80211_rx_mgmt_beacon()
7019 if (elems->ext_capab_len >= 11 && in ieee80211_rx_mgmt_beacon()
7020 (elems->ext_capab[10] & WLAN_EXT_CAPA11_EMA_SUPPORT)) in ieee80211_rx_mgmt_beacon()
7021 bss_conf->ema_ap = true; in ieee80211_rx_mgmt_beacon()
7023 bss_conf->ema_ap = false; in ieee80211_rx_mgmt_beacon()
7026 ifmgd->assoc_data->timeout = jiffies; in ieee80211_rx_mgmt_beacon()
7027 ifmgd->assoc_data->timeout_started = true; in ieee80211_rx_mgmt_beacon()
7028 run_again(sdata, ifmgd->assoc_data->timeout); in ieee80211_rx_mgmt_beacon()
7033 if (!ifmgd->associated || in ieee80211_rx_mgmt_beacon()
7034 !ieee80211_rx_our_beacon(bssid, bss_conf->bss)) in ieee80211_rx_mgmt_beacon()
7036 bssid = link->u.mgd.bssid; in ieee80211_rx_mgmt_beacon()
7038 if (!(rx_status->flag & RX_FLAG_NO_SIGNAL_VAL)) in ieee80211_rx_mgmt_beacon()
7042 if (ifmgd->flags & IEEE80211_STA_CONNECTION_POLL) { in ieee80211_rx_mgmt_beacon()
7059 if (!ieee80211_is_s1g_beacon(hdr->frame_control)) in ieee80211_rx_mgmt_beacon()
7060 ncrc = crc32_be(0, (void *)&mgmt->u.beacon.beacon_int, 4); in ieee80211_rx_mgmt_beacon()
7061 parse_params.bss = bss_conf->bss; in ieee80211_rx_mgmt_beacon()
7068 if (rx_status->flag & RX_FLAG_DECRYPTED && in ieee80211_rx_mgmt_beacon()
7071 sdata->vif.cfg.ap_addr); in ieee80211_rx_mgmt_beacon()
7076 ncrc = elems->crc; in ieee80211_rx_mgmt_beacon()
7078 if (ieee80211_hw_check(&local->hw, PS_NULLFUNC_STACK) && in ieee80211_rx_mgmt_beacon()
7079 ieee80211_check_tim(elems->tim, elems->tim_len, vif_cfg->aid)) { in ieee80211_rx_mgmt_beacon()
7080 if (local->hw.conf.dynamic_ps_timeout > 0) { in ieee80211_rx_mgmt_beacon()
7081 if (local->hw.conf.flags & IEEE80211_CONF_PS) { in ieee80211_rx_mgmt_beacon()
7082 local->hw.conf.flags &= ~IEEE80211_CONF_PS; in ieee80211_rx_mgmt_beacon()
7087 } else if (!local->pspolling && sdata->u.mgd.powersave) { in ieee80211_rx_mgmt_beacon()
7088 local->pspolling = true; in ieee80211_rx_mgmt_beacon()
7092 * able to send ps-poll frame and receive a in ieee80211_rx_mgmt_beacon()
7102 if (sdata->vif.p2p || in ieee80211_rx_mgmt_beacon()
7103 sdata->vif.driver_flags & IEEE80211_VIF_GET_NOA_UPDATE) { in ieee80211_rx_mgmt_beacon()
7108 len - baselen, in ieee80211_rx_mgmt_beacon()
7112 if (link->u.mgd.p2p_noa_index != noa.index) { in ieee80211_rx_mgmt_beacon()
7114 link->u.mgd.p2p_noa_index = noa.index; in ieee80211_rx_mgmt_beacon()
7115 memcpy(&bss_conf->p2p_noa_attr, &noa, sizeof(noa)); in ieee80211_rx_mgmt_beacon()
7121 link->u.mgd.beacon_crc_valid = false; in ieee80211_rx_mgmt_beacon()
7123 } else if (link->u.mgd.p2p_noa_index != -1) { in ieee80211_rx_mgmt_beacon()
7125 link->u.mgd.p2p_noa_index = -1; in ieee80211_rx_mgmt_beacon()
7126 memset(&bss_conf->p2p_noa_attr, 0, sizeof(bss_conf->p2p_noa_attr)); in ieee80211_rx_mgmt_beacon()
7128 link->u.mgd.beacon_crc_valid = false; in ieee80211_rx_mgmt_beacon()
7140 if (ieee80211_hw_check(&local->hw, TIMING_BEACON_ONLY) && in ieee80211_rx_mgmt_beacon()
7141 !ieee80211_is_s1g_beacon(hdr->frame_control)) { in ieee80211_rx_mgmt_beacon()
7142 bss_conf->sync_tsf = in ieee80211_rx_mgmt_beacon()
7143 le64_to_cpu(mgmt->u.beacon.timestamp); in ieee80211_rx_mgmt_beacon()
7144 bss_conf->sync_device_ts = in ieee80211_rx_mgmt_beacon()
7145 rx_status->device_timestamp; in ieee80211_rx_mgmt_beacon()
7146 bss_conf->sync_dtim_count = elems->dtim_count; in ieee80211_rx_mgmt_beacon()
7149 if ((ncrc == link->u.mgd.beacon_crc && link->u.mgd.beacon_crc_valid) || in ieee80211_rx_mgmt_beacon()
7150 ieee80211_is_s1g_short_beacon(mgmt->frame_control)) in ieee80211_rx_mgmt_beacon()
7152 link->u.mgd.beacon_crc = ncrc; in ieee80211_rx_mgmt_beacon()
7153 link->u.mgd.beacon_crc_valid = true; in ieee80211_rx_mgmt_beacon()
7157 ieee80211_sta_process_chanswitch(link, rx_status->mactime, in ieee80211_rx_mgmt_beacon()
7158 rx_status->device_timestamp, in ieee80211_rx_mgmt_beacon()
7162 /* note that after this elems->ml_basic can no longer be used fully */ in ieee80211_rx_mgmt_beacon()
7163 ieee80211_mgd_check_cross_link_csa(sdata, rx_status->link_id, elems); in ieee80211_rx_mgmt_beacon()
7167 if (!link->u.mgd.disable_wmm_tracking && in ieee80211_rx_mgmt_beacon()
7168 ieee80211_sta_wmm_params(local, link, elems->wmm_param, in ieee80211_rx_mgmt_beacon()
7169 elems->wmm_param_len, in ieee80211_rx_mgmt_beacon()
7170 elems->mu_edca_param_set)) in ieee80211_rx_mgmt_beacon()
7177 if (!link->u.mgd.have_beacon) { in ieee80211_rx_mgmt_beacon()
7179 bss_conf->dtim_period = elems->dtim_period ?: 1; in ieee80211_rx_mgmt_beacon()
7182 link->u.mgd.have_beacon = true; in ieee80211_rx_mgmt_beacon()
7189 if (elems->erp_info) { in ieee80211_rx_mgmt_beacon()
7191 erp_value = elems->erp_info[0]; in ieee80211_rx_mgmt_beacon()
7196 if (!ieee80211_is_s1g_beacon(hdr->frame_control)) in ieee80211_rx_mgmt_beacon()
7198 le16_to_cpu(mgmt->u.beacon.capab_info), in ieee80211_rx_mgmt_beacon()
7201 sta = sta_info_get(sdata, sdata->vif.cfg.ap_addr); in ieee80211_rx_mgmt_beacon()
7205 link_sta = rcu_dereference_protected(sta->link[link->link_id], in ieee80211_rx_mgmt_beacon()
7206 lockdep_is_held(&local->hw.wiphy->mtx)); in ieee80211_rx_mgmt_beacon()
7211 if (WARN_ON(!bss_conf->chanreq.oper.chan)) in ieee80211_rx_mgmt_beacon()
7214 sband = local->hw.wiphy->bands[bss_conf->chanreq.oper.chan->band]; in ieee80211_rx_mgmt_beacon()
7229 if (elems->opmode_notif) in ieee80211_rx_mgmt_beacon()
7231 *elems->opmode_notif, in ieee80211_rx_mgmt_beacon()
7232 rx_status->band); in ieee80211_rx_mgmt_beacon()
7235 elems->country_elem, in ieee80211_rx_mgmt_beacon()
7236 elems->country_elem_len, in ieee80211_rx_mgmt_beacon()
7237 elems->pwr_constr_elem, in ieee80211_rx_mgmt_beacon()
7238 elems->cisco_dtpc_elem); in ieee80211_rx_mgmt_beacon()
7242 le64_to_cpu(mgmt->u.beacon.timestamp)); in ieee80211_rx_mgmt_beacon()
7259 if (sdata->vif.neg_ttlm.valid) in ieee80211_apply_neg_ttlm()
7260 sdata->vif.dormant_links &= ~sdata->vif.suspended_links; in ieee80211_apply_neg_ttlm()
7264 map & sdata->vif.valid_links & ~sdata->vif.dormant_links; in ieee80211_apply_neg_ttlm()
7266 (~map & sdata->vif.valid_links) & ~sdata->vif.dormant_links; in ieee80211_apply_neg_ttlm()
7267 new_dormant_links = sdata->vif.dormant_links | new_suspended_links; in ieee80211_apply_neg_ttlm()
7272 sdata->vif.neg_ttlm = neg_ttlm; in ieee80211_apply_neg_ttlm()
7273 sdata->vif.neg_ttlm.valid = true; in ieee80211_apply_neg_ttlm()
7295 if (memcmp(neg_ttlm->downlink, neg_ttlm->uplink, in ieee80211_neg_ttlm_add_suggested_map()
7296 sizeof(neg_ttlm->downlink))) { in ieee80211_neg_ttlm_add_suggested_map()
7317 cpu_to_le16(neg_ttlm->uplink[tid]) : in ieee80211_neg_ttlm_add_suggested_map()
7318 cpu_to_le16(neg_ttlm->downlink[tid]); in ieee80211_neg_ttlm_add_suggested_map()
7340 struct ieee80211_local *local = sdata->local; in ieee80211_send_neg_ttlm_req()
7347 skb = dev_alloc_skb(local->tx_headroom + hdr_len + ttlm_max_len); in ieee80211_send_neg_ttlm_req()
7351 skb_reserve(skb, local->tx_headroom); in ieee80211_send_neg_ttlm_req()
7353 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | in ieee80211_send_neg_ttlm_req()
7355 memcpy(mgmt->da, sdata->vif.cfg.ap_addr, ETH_ALEN); in ieee80211_send_neg_ttlm_req()
7356 memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); in ieee80211_send_neg_ttlm_req()
7357 memcpy(mgmt->bssid, sdata->vif.cfg.ap_addr, ETH_ALEN); in ieee80211_send_neg_ttlm_req()
7359 mgmt->u.action.category = WLAN_CATEGORY_PROTECTED_EHT; in ieee80211_send_neg_ttlm_req()
7360 mgmt->u.action.u.ttlm_req.action_code = in ieee80211_send_neg_ttlm_req()
7362 mgmt->u.action.u.ttlm_req.dialog_token = dialog_token; in ieee80211_send_neg_ttlm_req()
7373 if (!ieee80211_vif_is_mld(&sdata->vif) || in ieee80211_req_neg_ttlm()
7374 !(sdata->vif.cfg.mld_capa_op & in ieee80211_req_neg_ttlm()
7376 return -EINVAL; in ieee80211_req_neg_ttlm()
7379 if ((params->dlink[i] & ~sdata->vif.valid_links) || in ieee80211_req_neg_ttlm()
7380 (params->ulink[i] & ~sdata->vif.valid_links)) in ieee80211_req_neg_ttlm()
7381 return -EINVAL; in ieee80211_req_neg_ttlm()
7383 neg_ttlm.downlink[i] = params->dlink[i]; in ieee80211_req_neg_ttlm()
7384 neg_ttlm.uplink[i] = params->ulink[i]; in ieee80211_req_neg_ttlm()
7387 if (drv_can_neg_ttlm(sdata->local, sdata, &neg_ttlm) != in ieee80211_req_neg_ttlm()
7389 return -EINVAL; in ieee80211_req_neg_ttlm()
7392 sdata->u.mgd.dialog_token_alloc++; in ieee80211_req_neg_ttlm()
7393 ieee80211_send_neg_ttlm_req(sdata, &sdata->vif.neg_ttlm, in ieee80211_req_neg_ttlm()
7394 sdata->u.mgd.dialog_token_alloc); in ieee80211_req_neg_ttlm()
7395 wiphy_delayed_work_cancel(sdata->local->hw.wiphy, in ieee80211_req_neg_ttlm()
7396 &sdata->u.mgd.neg_ttlm_timeout_work); in ieee80211_req_neg_ttlm()
7397 wiphy_delayed_work_queue(sdata->local->hw.wiphy, in ieee80211_req_neg_ttlm()
7398 &sdata->u.mgd.neg_ttlm_timeout_work, in ieee80211_req_neg_ttlm()
7409 struct ieee80211_local *local = sdata->local; in ieee80211_send_neg_ttlm_res()
7416 skb = dev_alloc_skb(local->tx_headroom + hdr_len + ttlm_max_len); in ieee80211_send_neg_ttlm_res()
7420 skb_reserve(skb, local->tx_headroom); in ieee80211_send_neg_ttlm_res()
7422 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | in ieee80211_send_neg_ttlm_res()
7424 memcpy(mgmt->da, sdata->vif.cfg.ap_addr, ETH_ALEN); in ieee80211_send_neg_ttlm_res()
7425 memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); in ieee80211_send_neg_ttlm_res()
7426 memcpy(mgmt->bssid, sdata->vif.cfg.ap_addr, ETH_ALEN); in ieee80211_send_neg_ttlm_res()
7428 mgmt->u.action.category = WLAN_CATEGORY_PROTECTED_EHT; in ieee80211_send_neg_ttlm_res()
7429 mgmt->u.action.u.ttlm_res.action_code = in ieee80211_send_neg_ttlm_res()
7431 mgmt->u.action.u.ttlm_res.dialog_token = dialog_token; in ieee80211_send_neg_ttlm_res()
7437 mgmt->u.action.u.ttlm_res.status_code = in ieee80211_send_neg_ttlm_res()
7441 mgmt->u.action.u.ttlm_res.status_code = WLAN_STATUS_SUCCESS; in ieee80211_send_neg_ttlm_res()
7444 mgmt->u.action.u.ttlm_res.status_code = in ieee80211_send_neg_ttlm_res()
7465 pos = (void *)ttlm->optional; in ieee80211_parse_neg_ttlm()
7467 control = ttlm->control; in ieee80211_parse_neg_ttlm()
7476 return -EINVAL; in ieee80211_parse_neg_ttlm()
7481 neg_ttlm->downlink[tid] = sdata->vif.valid_links; in ieee80211_parse_neg_ttlm()
7482 neg_ttlm->uplink[tid] = sdata->vif.valid_links; in ieee80211_parse_neg_ttlm()
7492 return -EINVAL; in ieee80211_parse_neg_ttlm()
7510 return -EINVAL; in ieee80211_parse_neg_ttlm()
7518 neg_ttlm->downlink[tid] = map; in ieee80211_parse_neg_ttlm()
7519 neg_ttlm->uplink[tid] = map; in ieee80211_parse_neg_ttlm()
7522 neg_ttlm->downlink[tid] = map; in ieee80211_parse_neg_ttlm()
7525 neg_ttlm->uplink[tid] = map; in ieee80211_parse_neg_ttlm()
7528 return -EINVAL; in ieee80211_parse_neg_ttlm()
7544 BUILD_BUG_ON(ARRAY_SIZE(direction) != ARRAY_SIZE(elems->ttlm)); in ieee80211_process_neg_ttlm_req()
7546 if (!ieee80211_vif_is_mld(&sdata->vif)) in ieee80211_process_neg_ttlm_req()
7549 dialog_token = mgmt->u.action.u.ttlm_req.dialog_token; in ieee80211_process_neg_ttlm_req()
7550 ies_len = len - offsetof(struct ieee80211_mgmt, in ieee80211_process_neg_ttlm_req()
7552 elems = ieee802_11_parse_elems(mgmt->u.action.u.ttlm_req.variable, in ieee80211_process_neg_ttlm_req()
7559 for (i = 0; i < elems->ttlm_num; i++) { in ieee80211_process_neg_ttlm_req()
7560 if (ieee80211_parse_neg_ttlm(sdata, elems->ttlm[i], in ieee80211_process_neg_ttlm_req()
7563 elems->ttlm_num != 1)) { in ieee80211_process_neg_ttlm_req()
7569 if (!elems->ttlm_num || in ieee80211_process_neg_ttlm_req()
7570 (elems->ttlm_num == 2 && direction[0] == direction[1])) { in ieee80211_process_neg_ttlm_req()
7577 (neg_ttlm.downlink[i] & ~sdata->vif.valid_links)) || in ieee80211_process_neg_ttlm_req()
7579 (neg_ttlm.uplink[i] & ~sdata->vif.valid_links))) { in ieee80211_process_neg_ttlm_req()
7585 ttlm_res = drv_can_neg_ttlm(sdata->local, sdata, &neg_ttlm); in ieee80211_process_neg_ttlm_req()
7599 if (!ieee80211_vif_is_mld(&sdata->vif) || in ieee80211_process_neg_ttlm_res()
7600 mgmt->u.action.u.ttlm_req.dialog_token != in ieee80211_process_neg_ttlm_res()
7601 sdata->u.mgd.dialog_token_alloc) in ieee80211_process_neg_ttlm_res()
7604 wiphy_delayed_work_cancel(sdata->local->hw.wiphy, in ieee80211_process_neg_ttlm_res()
7605 &sdata->u.mgd.neg_ttlm_timeout_work); in ieee80211_process_neg_ttlm_res()
7615 if (mgmt->u.action.u.ttlm_res.status_code != WLAN_STATUS_SUCCESS) in ieee80211_process_neg_ttlm_res()
7627 if (!sdata->vif.neg_ttlm.valid) in ieee80211_teardown_ttlm_work()
7630 memset(&sdata->vif.neg_ttlm, 0, sizeof(sdata->vif.neg_ttlm)); in ieee80211_teardown_ttlm_work()
7632 sdata->vif.dormant_links & ~sdata->vif.suspended_links; in ieee80211_teardown_ttlm_work()
7633 sdata->vif.suspended_links = 0; in ieee80211_teardown_ttlm_work()
7634 ieee80211_vif_set_links(sdata, sdata->vif.valid_links, in ieee80211_teardown_ttlm_work()
7643 struct ieee80211_local *local = sdata->local; in ieee80211_send_teardown_neg_ttlm()
7650 skb = dev_alloc_skb(local->hw.extra_tx_headroom + frame_len); in ieee80211_send_teardown_neg_ttlm()
7654 skb_reserve(skb, local->hw.extra_tx_headroom); in ieee80211_send_teardown_neg_ttlm()
7656 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | in ieee80211_send_teardown_neg_ttlm()
7658 memcpy(mgmt->da, sdata->vif.cfg.ap_addr, ETH_ALEN); in ieee80211_send_teardown_neg_ttlm()
7659 memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); in ieee80211_send_teardown_neg_ttlm()
7660 memcpy(mgmt->bssid, sdata->vif.cfg.ap_addr, ETH_ALEN); in ieee80211_send_teardown_neg_ttlm()
7662 mgmt->u.action.category = WLAN_CATEGORY_PROTECTED_EHT; in ieee80211_send_teardown_neg_ttlm()
7663 mgmt->u.action.u.ttlm_tear_down.action_code = in ieee80211_send_teardown_neg_ttlm()
7667 info->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS; in ieee80211_send_teardown_neg_ttlm()
7668 info->status_data = IEEE80211_STATUS_TYPE_NEG_TTLM; in ieee80211_send_teardown_neg_ttlm()
7676 struct ieee80211_link_data *link = &sdata->deflink; in ieee80211_sta_rx_queued_ext()
7681 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_sta_rx_queued_ext()
7683 rx_status = (struct ieee80211_rx_status *) skb->cb; in ieee80211_sta_rx_queued_ext()
7684 hdr = (struct ieee80211_hdr *) skb->data; in ieee80211_sta_rx_queued_ext()
7685 fc = le16_to_cpu(hdr->frame_control); in ieee80211_sta_rx_queued_ext()
7689 ieee80211_rx_mgmt_beacon(link, hdr, skb->len, rx_status); in ieee80211_sta_rx_queued_ext()
7697 struct ieee80211_link_data *link = &sdata->deflink; in ieee80211_sta_rx_queued_mgmt()
7704 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_sta_rx_queued_mgmt()
7706 rx_status = (struct ieee80211_rx_status *) skb->cb; in ieee80211_sta_rx_queued_mgmt()
7707 mgmt = (struct ieee80211_mgmt *) skb->data; in ieee80211_sta_rx_queued_mgmt()
7708 fc = le16_to_cpu(mgmt->frame_control); in ieee80211_sta_rx_queued_mgmt()
7710 if (rx_status->link_valid) { in ieee80211_sta_rx_queued_mgmt()
7711 link = sdata_dereference(sdata->link[rx_status->link_id], in ieee80211_sta_rx_queued_mgmt()
7720 skb->len, rx_status); in ieee80211_sta_rx_queued_mgmt()
7726 ieee80211_rx_mgmt_auth(sdata, mgmt, skb->len); in ieee80211_sta_rx_queued_mgmt()
7729 ieee80211_rx_mgmt_deauth(sdata, mgmt, skb->len); in ieee80211_sta_rx_queued_mgmt()
7732 ieee80211_rx_mgmt_disassoc(sdata, mgmt, skb->len); in ieee80211_sta_rx_queued_mgmt()
7736 ieee80211_rx_mgmt_assoc_resp(sdata, mgmt, skb->len); in ieee80211_sta_rx_queued_mgmt()
7739 if (!sdata->u.mgd.associated || in ieee80211_sta_rx_queued_mgmt()
7740 !ether_addr_equal(mgmt->bssid, sdata->vif.cfg.ap_addr)) in ieee80211_sta_rx_queued_mgmt()
7743 switch (mgmt->u.action.category) { in ieee80211_sta_rx_queued_mgmt()
7745 ies_len = skb->len - in ieee80211_sta_rx_queued_mgmt()
7754 mgmt->u.action.u.chan_switch.variable, in ieee80211_sta_rx_queued_mgmt()
7757 if (elems && !elems->parse_error) { in ieee80211_sta_rx_queued_mgmt()
7762 rx_status->mactime, in ieee80211_sta_rx_queued_mgmt()
7763 rx_status->device_timestamp, in ieee80211_sta_rx_queued_mgmt()
7771 ies_len = skb->len - in ieee80211_sta_rx_queued_mgmt()
7783 mgmt->u.action.u.ext_chan_switch.variable, in ieee80211_sta_rx_queued_mgmt()
7786 if (elems && !elems->parse_error) { in ieee80211_sta_rx_queued_mgmt()
7789 if (mgmt->u.action.category == in ieee80211_sta_rx_queued_mgmt()
7796 elems->ext_chansw_ie = in ieee80211_sta_rx_queued_mgmt()
7797 &mgmt->u.action.u.ext_chan_switch.data; in ieee80211_sta_rx_queued_mgmt()
7800 rx_status->mactime, in ieee80211_sta_rx_queued_mgmt()
7801 rx_status->device_timestamp, in ieee80211_sta_rx_queued_mgmt()
7818 wiphy_work_queue(sdata->local->hw.wiphy, &sdata->work); in ieee80211_sta_timer()
7835 struct ieee80211_local *local = sdata->local; in ieee80211_auth()
7836 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_auth()
7837 struct ieee80211_mgd_auth_data *auth_data = ifmgd->auth_data; in ieee80211_auth()
7845 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_auth()
7848 return -EINVAL; in ieee80211_auth()
7850 auth_data->tries++; in ieee80211_auth()
7852 if (auth_data->tries > IEEE80211_AUTH_MAX_TRIES) { in ieee80211_auth()
7854 auth_data->ap_addr); in ieee80211_auth()
7860 cfg80211_unlink_bss(local->hw.wiphy, auth_data->bss); in ieee80211_auth()
7862 return -ETIMEDOUT; in ieee80211_auth()
7865 if (auth_data->algorithm == WLAN_AUTH_SAE) in ieee80211_auth()
7868 info.link_id = auth_data->link_id; in ieee80211_auth()
7872 auth_data->ap_addr, auth_data->tries, in ieee80211_auth()
7875 auth_data->expected_transaction = 2; in ieee80211_auth()
7877 if (auth_data->algorithm == WLAN_AUTH_SAE) { in ieee80211_auth()
7878 trans = auth_data->sae_trans; in ieee80211_auth()
7879 status = auth_data->sae_status; in ieee80211_auth()
7880 auth_data->expected_transaction = trans; in ieee80211_auth()
7883 if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) in ieee80211_auth()
7887 ieee80211_send_auth(sdata, trans, auth_data->algorithm, status, in ieee80211_auth()
7888 auth_data->data, auth_data->data_len, in ieee80211_auth()
7889 auth_data->ap_addr, auth_data->ap_addr, in ieee80211_auth()
7893 if (auth_data->algorithm == WLAN_AUTH_SAE) in ieee80211_auth()
7894 auth_data->timeout = jiffies + in ieee80211_auth()
7897 auth_data->timeout = jiffies + IEEE80211_AUTH_TIMEOUT; in ieee80211_auth()
7899 auth_data->timeout = in ieee80211_auth()
7903 auth_data->timeout_started = true; in ieee80211_auth()
7904 run_again(sdata, auth_data->timeout); in ieee80211_auth()
7911 struct ieee80211_mgd_assoc_data *assoc_data = sdata->u.mgd.assoc_data; in ieee80211_do_assoc()
7912 struct ieee80211_local *local = sdata->local; in ieee80211_do_assoc()
7915 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_do_assoc()
7917 assoc_data->tries++; in ieee80211_do_assoc()
7918 assoc_data->comeback = false; in ieee80211_do_assoc()
7919 if (assoc_data->tries > IEEE80211_ASSOC_MAX_TRIES) { in ieee80211_do_assoc()
7921 assoc_data->ap_addr); in ieee80211_do_assoc()
7927 cfg80211_unlink_bss(local->hw.wiphy, in ieee80211_do_assoc()
7928 assoc_data->link[assoc_data->assoc_link_id].bss); in ieee80211_do_assoc()
7930 return -ETIMEDOUT; in ieee80211_do_assoc()
7934 assoc_data->ap_addr, assoc_data->tries, in ieee80211_do_assoc()
7940 if (!ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) { in ieee80211_do_assoc()
7941 assoc_data->timeout = jiffies + IEEE80211_ASSOC_TIMEOUT; in ieee80211_do_assoc()
7942 assoc_data->timeout_started = true; in ieee80211_do_assoc()
7943 run_again(sdata, assoc_data->timeout); in ieee80211_do_assoc()
7945 assoc_data->timeout = in ieee80211_do_assoc()
7948 assoc_data->timeout_started = true; in ieee80211_do_assoc()
7949 run_again(sdata, assoc_data->timeout); in ieee80211_do_assoc()
7958 struct ieee80211_local *local = sdata->local; in ieee80211_mgd_conn_tx_status()
7960 sdata->u.mgd.status_fc = fc; in ieee80211_mgd_conn_tx_status()
7961 sdata->u.mgd.status_acked = acked; in ieee80211_mgd_conn_tx_status()
7962 sdata->u.mgd.status_received = true; in ieee80211_mgd_conn_tx_status()
7964 wiphy_work_queue(local->hw.wiphy, &sdata->work); in ieee80211_mgd_conn_tx_status()
7969 struct ieee80211_local *local = sdata->local; in ieee80211_sta_work()
7970 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_sta_work()
7972 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_sta_work()
7974 if (ifmgd->status_received) { in ieee80211_sta_work()
7975 __le16 fc = ifmgd->status_fc; in ieee80211_sta_work()
7976 bool status_acked = ifmgd->status_acked; in ieee80211_sta_work()
7978 ifmgd->status_received = false; in ieee80211_sta_work()
7979 if (ifmgd->auth_data && ieee80211_is_auth(fc)) { in ieee80211_sta_work()
7981 if (ifmgd->auth_data->algorithm == in ieee80211_sta_work()
7983 ifmgd->auth_data->timeout = in ieee80211_sta_work()
7987 ifmgd->auth_data->timeout = in ieee80211_sta_work()
7990 run_again(sdata, ifmgd->auth_data->timeout); in ieee80211_sta_work()
7992 ifmgd->auth_data->timeout = jiffies - 1; in ieee80211_sta_work()
7994 ifmgd->auth_data->timeout_started = true; in ieee80211_sta_work()
7995 } else if (ifmgd->assoc_data && in ieee80211_sta_work()
7996 !ifmgd->assoc_data->comeback && in ieee80211_sta_work()
8009 ifmgd->assoc_data->timeout = in ieee80211_sta_work()
8011 run_again(sdata, ifmgd->assoc_data->timeout); in ieee80211_sta_work()
8013 ifmgd->assoc_data->timeout = jiffies - 1; in ieee80211_sta_work()
8015 ifmgd->assoc_data->timeout_started = true; in ieee80211_sta_work()
8019 if (ifmgd->auth_data && ifmgd->auth_data->timeout_started && in ieee80211_sta_work()
8020 time_after(jiffies, ifmgd->auth_data->timeout)) { in ieee80211_sta_work()
8021 if (ifmgd->auth_data->done || ifmgd->auth_data->waiting) { in ieee80211_sta_work()
8035 memcpy(ap_addr, ifmgd->auth_data->ap_addr, ETH_ALEN); in ieee80211_sta_work()
8039 cfg80211_auth_timeout(sdata->dev, ap_addr); in ieee80211_sta_work()
8040 drv_event_callback(sdata->local, sdata, &event); in ieee80211_sta_work()
8042 } else if (ifmgd->auth_data && ifmgd->auth_data->timeout_started) in ieee80211_sta_work()
8043 run_again(sdata, ifmgd->auth_data->timeout); in ieee80211_sta_work()
8045 if (ifmgd->assoc_data && ifmgd->assoc_data->timeout_started && in ieee80211_sta_work()
8046 time_after(jiffies, ifmgd->assoc_data->timeout)) { in ieee80211_sta_work()
8047 if ((ifmgd->assoc_data->need_beacon && in ieee80211_sta_work()
8048 !sdata->deflink.u.mgd.have_beacon) || in ieee80211_sta_work()
8057 drv_event_callback(sdata->local, sdata, &event); in ieee80211_sta_work()
8059 } else if (ifmgd->assoc_data && ifmgd->assoc_data->timeout_started) in ieee80211_sta_work()
8060 run_again(sdata, ifmgd->assoc_data->timeout); in ieee80211_sta_work()
8062 if (ifmgd->flags & IEEE80211_STA_CONNECTION_POLL && in ieee80211_sta_work()
8063 ifmgd->associated) { in ieee80211_sta_work()
8064 u8 *bssid = sdata->deflink.u.mgd.bssid; in ieee80211_sta_work()
8067 if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) in ieee80211_sta_work()
8073 if (!ifmgd->probe_send_count) in ieee80211_sta_work()
8075 else if (ifmgd->nullfunc_failed) { in ieee80211_sta_work()
8076 if (ifmgd->probe_send_count < max_tries) { in ieee80211_sta_work()
8079 bssid, ifmgd->probe_send_count, in ieee80211_sta_work()
8090 } else if (time_is_after_jiffies(ifmgd->probe_timeout)) in ieee80211_sta_work()
8091 run_again(sdata, ifmgd->probe_timeout); in ieee80211_sta_work()
8092 else if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) { in ieee80211_sta_work()
8098 } else if (ifmgd->probe_send_count < max_tries) { in ieee80211_sta_work()
8102 ifmgd->probe_send_count, max_tries); in ieee80211_sta_work()
8124 if (WARN_ON(ieee80211_vif_is_mld(&sdata->vif))) in ieee80211_sta_bcn_mon_timer()
8127 if (sdata->vif.bss_conf.csa_active && in ieee80211_sta_bcn_mon_timer()
8128 !sdata->deflink.u.mgd.csa.waiting_bcn) in ieee80211_sta_bcn_mon_timer()
8131 if (sdata->vif.driver_flags & IEEE80211_VIF_BEACON_FILTER) in ieee80211_sta_bcn_mon_timer()
8134 sdata->u.mgd.connection_loss = false; in ieee80211_sta_bcn_mon_timer()
8135 wiphy_work_queue(sdata->local->hw.wiphy, in ieee80211_sta_bcn_mon_timer()
8136 &sdata->u.mgd.beacon_connection_loss_work); in ieee80211_sta_bcn_mon_timer()
8143 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_sta_conn_mon_timer()
8144 struct ieee80211_local *local = sdata->local; in ieee80211_sta_conn_mon_timer()
8148 if (WARN_ON(ieee80211_vif_is_mld(&sdata->vif))) in ieee80211_sta_conn_mon_timer()
8151 if (sdata->vif.bss_conf.csa_active && in ieee80211_sta_conn_mon_timer()
8152 !sdata->deflink.u.mgd.csa.waiting_bcn) in ieee80211_sta_conn_mon_timer()
8155 sta = sta_info_get(sdata, sdata->vif.cfg.ap_addr); in ieee80211_sta_conn_mon_timer()
8159 timeout = sta->deflink.status_stats.last_ack; in ieee80211_sta_conn_mon_timer()
8160 if (time_before(sta->deflink.status_stats.last_ack, sta->deflink.rx_stats.last_rx)) in ieee80211_sta_conn_mon_timer()
8161 timeout = sta->deflink.rx_stats.last_rx; in ieee80211_sta_conn_mon_timer()
8168 mod_timer(&ifmgd->conn_mon_timer, round_jiffies_up(timeout)); in ieee80211_sta_conn_mon_timer()
8172 wiphy_work_queue(local->hw.wiphy, &sdata->u.mgd.monitor_work); in ieee80211_sta_conn_mon_timer()
8187 if (sdata->vif.type == NL80211_IFTYPE_STATION) { in ieee80211_restart_sta_timer()
8191 if (!ieee80211_hw_check(&sdata->local->hw, CONNECTION_MONITOR)) in ieee80211_restart_sta_timer()
8192 wiphy_work_queue(sdata->local->hw.wiphy, in ieee80211_restart_sta_timer()
8193 &sdata->u.mgd.monitor_work); in ieee80211_restart_sta_timer()
8200 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_mgd_quiesce()
8203 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_mgd_quiesce()
8205 if (ifmgd->auth_data || ifmgd->assoc_data) { in ieee80211_mgd_quiesce()
8206 const u8 *ap_addr = ifmgd->auth_data ? in ieee80211_mgd_quiesce()
8207 ifmgd->auth_data->ap_addr : in ieee80211_mgd_quiesce()
8208 ifmgd->assoc_data->ap_addr; in ieee80211_mgd_quiesce()
8219 if (ifmgd->assoc_data) in ieee80211_mgd_quiesce()
8221 if (ifmgd->auth_data) in ieee80211_mgd_quiesce()
8223 cfg80211_tx_mlme_mgmt(sdata->dev, frame_buf, in ieee80211_mgd_quiesce()
8228 /* This is a bit of a hack - we should find a better and more generic in ieee80211_mgd_quiesce()
8245 if (ifmgd->associated && !sdata->local->wowlan) { in ieee80211_mgd_quiesce()
8252 memcpy(bssid, sdata->vif.cfg.ap_addr, ETH_ALEN); in ieee80211_mgd_quiesce()
8260 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_sta_restart()
8262 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_sta_restart()
8264 if (!ifmgd->associated) in ieee80211_sta_restart()
8267 if (sdata->flags & IEEE80211_SDATA_DISCONNECT_RESUME) { in ieee80211_sta_restart()
8268 sdata->flags &= ~IEEE80211_SDATA_DISCONNECT_RESUME; in ieee80211_sta_restart()
8276 if (sdata->flags & IEEE80211_SDATA_DISCONNECT_HW_RESTART) { in ieee80211_sta_restart()
8277 sdata->flags &= ~IEEE80211_SDATA_DISCONNECT_HW_RESTART; in ieee80211_sta_restart()
8293 __ieee80211_request_smps_mgd(link->sdata, link, in ieee80211_request_smps_mgd_work()
8294 link->u.mgd.driver_smps_mode); in ieee80211_request_smps_mgd_work()
8304 if (!sdata->u.mgd.reconf.added_links && in ieee80211_ml_sta_reconf_timeout()
8305 !sdata->u.mgd.reconf.removed_links) in ieee80211_ml_sta_reconf_timeout()
8310 sdata->u.mgd.reconf.added_links, in ieee80211_ml_sta_reconf_timeout()
8311 sdata->u.mgd.reconf.removed_links); in ieee80211_ml_sta_reconf_timeout()
8319 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_sta_setup_sdata()
8321 wiphy_work_init(&ifmgd->monitor_work, ieee80211_sta_monitor_work); in ieee80211_sta_setup_sdata()
8322 wiphy_work_init(&ifmgd->beacon_connection_loss_work, in ieee80211_sta_setup_sdata()
8324 wiphy_work_init(&ifmgd->csa_connection_drop_work, in ieee80211_sta_setup_sdata()
8326 wiphy_delayed_work_init(&ifmgd->tdls_peer_del_work, in ieee80211_sta_setup_sdata()
8328 wiphy_delayed_work_init(&ifmgd->ml_reconf_work, in ieee80211_sta_setup_sdata()
8330 wiphy_delayed_work_init(&ifmgd->reconf.wk, in ieee80211_sta_setup_sdata()
8332 timer_setup(&ifmgd->timer, ieee80211_sta_timer, 0); in ieee80211_sta_setup_sdata()
8333 timer_setup(&ifmgd->bcn_mon_timer, ieee80211_sta_bcn_mon_timer, 0); in ieee80211_sta_setup_sdata()
8334 timer_setup(&ifmgd->conn_mon_timer, ieee80211_sta_conn_mon_timer, 0); in ieee80211_sta_setup_sdata()
8335 wiphy_delayed_work_init(&ifmgd->tx_tspec_wk, in ieee80211_sta_setup_sdata()
8337 wiphy_delayed_work_init(&ifmgd->ttlm_work, in ieee80211_sta_setup_sdata()
8339 wiphy_delayed_work_init(&ifmgd->neg_ttlm_timeout_work, in ieee80211_sta_setup_sdata()
8341 wiphy_work_init(&ifmgd->teardown_ttlm_work, in ieee80211_sta_setup_sdata()
8344 ifmgd->flags = 0; in ieee80211_sta_setup_sdata()
8345 ifmgd->powersave = sdata->wdev.ps; in ieee80211_sta_setup_sdata()
8346 ifmgd->uapsd_queues = sdata->local->hw.uapsd_queues; in ieee80211_sta_setup_sdata()
8347 ifmgd->uapsd_max_sp_len = sdata->local->hw.uapsd_max_sp_len; in ieee80211_sta_setup_sdata()
8349 spin_lock_init(&ifmgd->teardown_lock); in ieee80211_sta_setup_sdata()
8350 ifmgd->teardown_skb = NULL; in ieee80211_sta_setup_sdata()
8351 ifmgd->orig_teardown_skb = NULL; in ieee80211_sta_setup_sdata()
8352 ifmgd->mcast_seq_last = IEEE80211_SN_MODULO; in ieee80211_sta_setup_sdata()
8362 ieee80211_recalc_smps(link->sdata, link); in ieee80211_recalc_smps_work()
8367 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_mgd_setup_link()
8368 struct ieee80211_local *local = sdata->local; in ieee80211_mgd_setup_link()
8369 unsigned int link_id = link->link_id; in ieee80211_mgd_setup_link()
8371 link->u.mgd.p2p_noa_index = -1; in ieee80211_mgd_setup_link()
8372 link->conf->bssid = link->u.mgd.bssid; in ieee80211_mgd_setup_link()
8373 link->smps_mode = IEEE80211_SMPS_OFF; in ieee80211_mgd_setup_link()
8375 wiphy_work_init(&link->u.mgd.request_smps_work, in ieee80211_mgd_setup_link()
8377 wiphy_work_init(&link->u.mgd.recalc_smps, in ieee80211_mgd_setup_link()
8379 if (local->hw.wiphy->features & NL80211_FEATURE_DYNAMIC_SMPS) in ieee80211_mgd_setup_link()
8380 link->u.mgd.req_smps = IEEE80211_SMPS_AUTOMATIC; in ieee80211_mgd_setup_link()
8382 link->u.mgd.req_smps = IEEE80211_SMPS_OFF; in ieee80211_mgd_setup_link()
8384 wiphy_delayed_work_init(&link->u.mgd.csa.switch_work, in ieee80211_mgd_setup_link()
8387 ieee80211_clear_tpe(&link->conf->tpe); in ieee80211_mgd_setup_link()
8389 if (sdata->u.mgd.assoc_data) in ieee80211_mgd_setup_link()
8390 ether_addr_copy(link->conf->addr, in ieee80211_mgd_setup_link()
8391 sdata->u.mgd.assoc_data->link[link_id].addr); in ieee80211_mgd_setup_link()
8392 else if (sdata->u.mgd.reconf.add_links_data) in ieee80211_mgd_setup_link()
8393 ether_addr_copy(link->conf->addr, in ieee80211_mgd_setup_link()
8394 sdata->u.mgd.reconf.add_links_data->link[link_id].addr); in ieee80211_mgd_setup_link()
8395 else if (!is_valid_ether_addr(link->conf->addr)) in ieee80211_mgd_setup_link()
8396 eth_random_addr(link->conf->addr); in ieee80211_mgd_setup_link()
8406 list_for_each_entry_rcu(sdata, &local->interfaces, list) { in ieee80211_mlme_notify_scan_completed()
8420 struct ieee80211_local *local = sdata->local; in ieee80211_prep_connection()
8421 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_prep_connection()
8422 struct ieee80211_bss *bss = (void *)cbss->priv; in ieee80211_prep_connection()
8432 return -EINVAL; in ieee80211_prep_connection()
8436 return -EINVAL; in ieee80211_prep_connection()
8437 ap_mld_addr = cbss->bssid; in ieee80211_prep_connection()
8446 link = sdata_dereference(sdata->link[link_id], sdata); in ieee80211_prep_connection()
8448 err = -ENOLINK; in ieee80211_prep_connection()
8452 if (WARN_ON(!ifmgd->auth_data && !ifmgd->assoc_data)) { in ieee80211_prep_connection()
8453 err = -EINVAL; in ieee80211_prep_connection()
8458 if (local->in_reconfig) { in ieee80211_prep_connection()
8459 err = -EBUSY; in ieee80211_prep_connection()
8472 link_id, cbss->bssid, in ieee80211_prep_connection()
8478 err = -ENOMEM; in ieee80211_prep_connection()
8482 new_sta->sta.mlo = mlo; in ieee80211_prep_connection()
8487 * new channel. We can't - completely race-free - change the basic in ieee80211_prep_connection()
8491 * call that from changing the channel - only for IDLE and perhaps in ieee80211_prep_connection()
8503 link_sta = rcu_dereference(new_sta->link[link_id]); in ieee80211_prep_connection()
8507 err = -EINVAL; in ieee80211_prep_connection()
8519 memcpy(link->u.mgd.bssid, cbss->bssid, ETH_ALEN); in ieee80211_prep_connection()
8522 link->conf->beacon_int = cbss->beacon_interval; in ieee80211_prep_connection()
8523 ies = rcu_dereference(cbss->beacon_ies); in ieee80211_prep_connection()
8525 link->conf->sync_tsf = ies->tsf; in ieee80211_prep_connection()
8526 link->conf->sync_device_ts = in ieee80211_prep_connection()
8527 bss->device_ts_beacon; in ieee80211_prep_connection()
8530 &link->conf->sync_dtim_count, in ieee80211_prep_connection()
8532 } else if (!ieee80211_hw_check(&sdata->local->hw, in ieee80211_prep_connection()
8534 ies = rcu_dereference(cbss->proberesp_ies); in ieee80211_prep_connection()
8535 /* must be non-NULL since beacon IEs were NULL */ in ieee80211_prep_connection()
8536 link->conf->sync_tsf = ies->tsf; in ieee80211_prep_connection()
8537 link->conf->sync_device_ts = in ieee80211_prep_connection()
8538 bss->device_ts_presp; in ieee80211_prep_connection()
8539 link->conf->sync_dtim_count = 0; in ieee80211_prep_connection()
8541 link->conf->sync_tsf = 0; in ieee80211_prep_connection()
8542 link->conf->sync_device_ts = 0; in ieee80211_prep_connection()
8543 link->conf->sync_dtim_count = 0; in ieee80211_prep_connection()
8555 link->u.mgd.conn = *conn; in ieee80211_prep_connection()
8556 err = ieee80211_prep_channel(sdata, link, link->link_id, cbss, in ieee80211_prep_connection()
8557 mlo, &link->u.mgd.conn, in ieee80211_prep_connection()
8565 *conn = link->u.mgd.conn; in ieee80211_prep_connection()
8590 WARN_ON_ONCE(!ether_addr_equal(link->u.mgd.bssid, cbss->bssid)); in ieee80211_prep_connection()
8593 if (local->scanning) in ieee80211_prep_connection()
8617 ies->data, ies->len); in ieee80211_mgd_csa_present()
8618 if (csa_elem && csa_elem->datalen == sizeof(*csa)) in ieee80211_mgd_csa_present()
8619 csa = (void *)csa_elem->data; in ieee80211_mgd_csa_present()
8622 ies->data, ies->len); in ieee80211_mgd_csa_present()
8623 if (ecsa_elem && ecsa_elem->datalen == sizeof(*ecsa)) in ieee80211_mgd_csa_present()
8624 ecsa = (void *)ecsa_elem->data; in ieee80211_mgd_csa_present()
8626 if (csa && csa->count == 0) in ieee80211_mgd_csa_present()
8628 if (csa && !csa->mode && csa->new_ch_num == cur_channel) in ieee80211_mgd_csa_present()
8631 if (ecsa && ecsa->count == 0) in ieee80211_mgd_csa_present()
8633 if (ecsa && !ecsa->mode && ecsa->new_ch_num == cur_channel) in ieee80211_mgd_csa_present()
8638 "Ignoring ECSA in probe response - was considered stuck!\n"); in ieee80211_mgd_csa_present()
8651 cur_channel = ieee80211_frequency_to_channel(bss->channel->center_freq); in ieee80211_mgd_csa_in_process()
8655 rcu_dereference(bss->beacon_ies), in ieee80211_mgd_csa_in_process()
8662 rcu_dereference(bss->proberesp_ies), in ieee80211_mgd_csa_in_process()
8663 cur_channel, bss->proberesp_ecsa_stuck)) { in ieee80211_mgd_csa_in_process()
8694 struct ieee80211_local *local = sdata->local; in ieee80211_mgd_auth()
8695 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_mgd_auth()
8705 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_mgd_auth()
8709 switch (req->auth_type) { in ieee80211_mgd_auth()
8715 return -EOPNOTSUPP; in ieee80211_mgd_auth()
8737 return -EOPNOTSUPP; in ieee80211_mgd_auth()
8740 if (ifmgd->assoc_data) in ieee80211_mgd_auth()
8741 return -EBUSY; in ieee80211_mgd_auth()
8743 if (ieee80211_mgd_csa_in_process(sdata, req->bss)) { in ieee80211_mgd_auth()
8745 return -EINVAL; in ieee80211_mgd_auth()
8748 auth_data = kzalloc(sizeof(*auth_data) + req->auth_data_len + in ieee80211_mgd_auth()
8749 req->ie_len, GFP_KERNEL); in ieee80211_mgd_auth()
8751 return -ENOMEM; in ieee80211_mgd_auth()
8753 memcpy(auth_data->ap_addr, in ieee80211_mgd_auth()
8754 req->ap_mld_addr ?: req->bss->bssid, in ieee80211_mgd_auth()
8756 auth_data->bss = req->bss; in ieee80211_mgd_auth()
8757 auth_data->link_id = req->link_id; in ieee80211_mgd_auth()
8759 if (req->auth_data_len >= 4) { in ieee80211_mgd_auth()
8760 if (req->auth_type == NL80211_AUTHTYPE_SAE) { in ieee80211_mgd_auth()
8761 __le16 *pos = (__le16 *) req->auth_data; in ieee80211_mgd_auth()
8763 auth_data->sae_trans = le16_to_cpu(pos[0]); in ieee80211_mgd_auth()
8764 auth_data->sae_status = le16_to_cpu(pos[1]); in ieee80211_mgd_auth()
8766 memcpy(auth_data->data, req->auth_data + 4, in ieee80211_mgd_auth()
8767 req->auth_data_len - 4); in ieee80211_mgd_auth()
8768 auth_data->data_len += req->auth_data_len - 4; in ieee80211_mgd_auth()
8773 * removal and re-addition of the STA entry in in ieee80211_mgd_auth()
8776 cont_auth = ifmgd->auth_data && req->bss == ifmgd->auth_data->bss && in ieee80211_mgd_auth()
8777 ifmgd->auth_data->link_id == req->link_id; in ieee80211_mgd_auth()
8779 if (req->ie && req->ie_len) { in ieee80211_mgd_auth()
8780 memcpy(&auth_data->data[auth_data->data_len], in ieee80211_mgd_auth()
8781 req->ie, req->ie_len); in ieee80211_mgd_auth()
8782 auth_data->data_len += req->ie_len; in ieee80211_mgd_auth()
8785 if (req->key && req->key_len) { in ieee80211_mgd_auth()
8786 auth_data->key_len = req->key_len; in ieee80211_mgd_auth()
8787 auth_data->key_idx = req->key_idx; in ieee80211_mgd_auth()
8788 memcpy(auth_data->key, req->key, req->key_len); in ieee80211_mgd_auth()
8791 ieee80211_parse_cfg_selectors(auth_data->userspace_selectors, in ieee80211_mgd_auth()
8792 req->supported_selectors, in ieee80211_mgd_auth()
8793 req->supported_selectors_len); in ieee80211_mgd_auth()
8795 auth_data->algorithm = auth_alg; in ieee80211_mgd_auth()
8799 if (ifmgd->auth_data) { in ieee80211_mgd_auth()
8800 if (cont_auth && req->auth_type == NL80211_AUTHTYPE_SAE) { in ieee80211_mgd_auth()
8801 auth_data->peer_confirmed = in ieee80211_mgd_auth()
8802 ifmgd->auth_data->peer_confirmed; in ieee80211_mgd_auth()
8808 ifmgd->auth_data = auth_data; in ieee80211_mgd_auth()
8815 if (cont_auth && req->auth_type == NL80211_AUTHTYPE_SAE && in ieee80211_mgd_auth()
8816 auth_data->peer_confirmed && auth_data->sae_trans == 2) in ieee80211_mgd_auth()
8819 if (ifmgd->associated) { in ieee80211_mgd_auth()
8824 sdata->vif.cfg.ap_addr, auth_data->ap_addr); in ieee80211_mgd_auth()
8836 memcpy(sdata->vif.cfg.ap_addr, auth_data->ap_addr, ETH_ALEN); in ieee80211_mgd_auth()
8838 bss = (void *)req->bss->priv; in ieee80211_mgd_auth()
8839 wmm_used = bss->wmm_used && (local->hw.queues >= IEEE80211_NUM_ACS); in ieee80211_mgd_auth()
8841 sband = local->hw.wiphy->bands[req->bss->channel->band]; in ieee80211_mgd_auth()
8846 err = ieee80211_prep_connection(sdata, req->bss, req->link_id, in ieee80211_mgd_auth()
8847 req->ap_mld_addr, cont_auth, in ieee80211_mgd_auth()
8849 auth_data->userspace_selectors); in ieee80211_mgd_auth()
8853 if (req->link_id >= 0) in ieee80211_mgd_auth()
8854 link = sdata_dereference(sdata->link[req->link_id], sdata); in ieee80211_mgd_auth()
8856 link = &sdata->deflink; in ieee80211_mgd_auth()
8859 err = -ENOLINK; in ieee80211_mgd_auth()
8864 auth_data->ap_addr, link->conf->addr); in ieee80211_mgd_auth()
8868 sta_info_destroy_addr(sdata, auth_data->ap_addr); in ieee80211_mgd_auth()
8873 cfg80211_ref_bss(local->hw.wiphy, auth_data->bss); in ieee80211_mgd_auth()
8877 if (!ieee80211_vif_is_mld(&sdata->vif)) { in ieee80211_mgd_auth()
8878 eth_zero_addr(sdata->deflink.u.mgd.bssid); in ieee80211_mgd_auth()
8879 ieee80211_link_info_change_notify(sdata, &sdata->deflink, in ieee80211_mgd_auth()
8881 ieee80211_link_release_channel(&sdata->deflink); in ieee80211_mgd_auth()
8883 ifmgd->auth_data = NULL; in ieee80211_mgd_auth()
8895 struct ieee80211_local *local = sdata->local; in ieee80211_setup_assoc_link()
8902 cbss = assoc_data->link[link_id].bss; in ieee80211_setup_assoc_link()
8906 bss = (void *)cbss->priv; in ieee80211_setup_assoc_link()
8908 sband = local->hw.wiphy->bands[cbss->channel->band]; in ieee80211_setup_assoc_link()
8912 link = sdata_dereference(sdata->link[link_id], sdata); in ieee80211_setup_assoc_link()
8917 if (!req->ap_mld_addr) { in ieee80211_setup_assoc_link()
8918 assoc_data->supp_rates = bss->supp_rates; in ieee80211_setup_assoc_link()
8919 assoc_data->supp_rates_len = bss->supp_rates_len; in ieee80211_setup_assoc_link()
8923 if (req->links[link_id].elems_len) { in ieee80211_setup_assoc_link()
8924 memcpy(assoc_data->ie_pos, req->links[link_id].elems, in ieee80211_setup_assoc_link()
8925 req->links[link_id].elems_len); in ieee80211_setup_assoc_link()
8926 assoc_data->link[link_id].elems = assoc_data->ie_pos; in ieee80211_setup_assoc_link()
8927 assoc_data->link[link_id].elems_len = req->links[link_id].elems_len; in ieee80211_setup_assoc_link()
8928 assoc_data->ie_pos += req->links[link_id].elems_len; in ieee80211_setup_assoc_link()
8931 link->u.mgd.beacon_crc_valid = false; in ieee80211_setup_assoc_link()
8932 link->u.mgd.dtim_period = 0; in ieee80211_setup_assoc_link()
8933 link->u.mgd.have_beacon = false; in ieee80211_setup_assoc_link()
8936 if (conn->mode >= IEEE80211_CONN_MODE_HT) { in ieee80211_setup_assoc_link()
8939 memcpy(&sta_ht_cap, &sband->ht_cap, sizeof(sta_ht_cap)); in ieee80211_setup_assoc_link()
8944 bss_ies = rcu_dereference(cbss->beacon_ies); in ieee80211_setup_assoc_link()
8949 &link->u.mgd.dtim_period); in ieee80211_setup_assoc_link()
8951 sdata->deflink.u.mgd.have_beacon = true; in ieee80211_setup_assoc_link()
8953 if (ieee80211_hw_check(&local->hw, TIMING_BEACON_ONLY)) { in ieee80211_setup_assoc_link()
8954 link->conf->sync_tsf = bss_ies->tsf; in ieee80211_setup_assoc_link()
8955 link->conf->sync_device_ts = bss->device_ts_beacon; in ieee80211_setup_assoc_link()
8956 link->conf->sync_dtim_count = dtim_count; in ieee80211_setup_assoc_link()
8959 bss_ies = rcu_dereference(cbss->ies); in ieee80211_setup_assoc_link()
8966 bss_ies->data, bss_ies->len); in ieee80211_setup_assoc_link()
8967 if (elem && elem->datalen >= 3) in ieee80211_setup_assoc_link()
8968 link->conf->profile_periodicity = elem->data[2]; in ieee80211_setup_assoc_link()
8970 link->conf->profile_periodicity = 0; in ieee80211_setup_assoc_link()
8973 bss_ies->data, bss_ies->len); in ieee80211_setup_assoc_link()
8974 if (elem && elem->datalen >= 11 && in ieee80211_setup_assoc_link()
8975 (elem->data[10] & WLAN_EXT_CAPA11_EMA_SUPPORT)) in ieee80211_setup_assoc_link()
8976 link->conf->ema_ap = true; in ieee80211_setup_assoc_link()
8978 link->conf->ema_ap = false; in ieee80211_setup_assoc_link()
8982 if (bss->corrupt_data) { in ieee80211_setup_assoc_link()
8985 if (bss->corrupt_data & IEEE80211_BSS_CORRUPT_BEACON) { in ieee80211_setup_assoc_link()
8986 if (bss->corrupt_data & IEEE80211_BSS_CORRUPT_PROBE_RESP) in ieee80211_setup_assoc_link()
8990 } else if (bss->corrupt_data & IEEE80211_BSS_CORRUPT_PROBE_RESP) { in ieee80211_setup_assoc_link()
8994 cbss->bssid, corrupt_type); in ieee80211_setup_assoc_link()
8997 if (link->u.mgd.req_smps == IEEE80211_SMPS_AUTOMATIC) { in ieee80211_setup_assoc_link()
8998 if (sdata->u.mgd.powersave) in ieee80211_setup_assoc_link()
8999 link->smps_mode = IEEE80211_SMPS_DYNAMIC; in ieee80211_setup_assoc_link()
9001 link->smps_mode = IEEE80211_SMPS_OFF; in ieee80211_setup_assoc_link()
9003 link->smps_mode = link->u.mgd.req_smps; in ieee80211_setup_assoc_link()
9012 struct cfg80211_bss *cbss = assoc_data->link[link_id].bss; in ieee80211_mgd_get_ap_ht_vht_capa()
9013 enum nl80211_band band = cbss->channel->band; in ieee80211_mgd_get_ap_ht_vht_capa()
9022 if (assoc_data->link[link_id].conn.mode < IEEE80211_CONN_MODE_HT) in ieee80211_mgd_get_ap_ht_vht_capa()
9027 if (!elem || elem->datalen < sizeof(struct ieee80211_ht_operation)) { in ieee80211_mgd_get_ap_ht_vht_capa()
9029 cbss->bssid); in ieee80211_mgd_get_ap_ht_vht_capa()
9030 err = -EINVAL; in ieee80211_mgd_get_ap_ht_vht_capa()
9033 assoc_data->link[link_id].ap_ht_param = in ieee80211_mgd_get_ap_ht_vht_capa()
9034 ((struct ieee80211_ht_operation *)(elem->data))->ht_param; in ieee80211_mgd_get_ap_ht_vht_capa()
9037 if (assoc_data->link[link_id].conn.mode < IEEE80211_CONN_MODE_VHT) in ieee80211_mgd_get_ap_ht_vht_capa()
9041 sband = sdata->local->hw.wiphy->bands[band]; in ieee80211_mgd_get_ap_ht_vht_capa()
9042 if (!sband->vht_cap.vht_supported) in ieee80211_mgd_get_ap_ht_vht_capa()
9052 if (!elem || elem->datalen < sizeof(struct ieee80211_vht_cap)) { in ieee80211_mgd_get_ap_ht_vht_capa()
9054 cbss->bssid); in ieee80211_mgd_get_ap_ht_vht_capa()
9055 err = -EINVAL; in ieee80211_mgd_get_ap_ht_vht_capa()
9058 memcpy(&assoc_data->link[link_id].ap_vht_cap, elem->data, in ieee80211_mgd_get_ap_ht_vht_capa()
9071 unsigned int assoc_link_id = req->link_id < 0 ? 0 : req->link_id; in ieee80211_mgd_assoc()
9072 struct ieee80211_local *local = sdata->local; in ieee80211_mgd_assoc()
9073 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_mgd_assoc()
9076 struct ieee80211_vif_cfg *vif_cfg = &sdata->vif.cfg; in ieee80211_mgd_assoc()
9082 size_t size = sizeof(*assoc_data) + req->ie_len; in ieee80211_mgd_assoc()
9085 size += req->links[i].elems_len; in ieee80211_mgd_assoc()
9087 /* FIXME: no support for 4-addr MLO yet */ in ieee80211_mgd_assoc()
9088 if (sdata->u.mgd.use_4addr && req->link_id >= 0) in ieee80211_mgd_assoc()
9089 return -EOPNOTSUPP; in ieee80211_mgd_assoc()
9093 return -ENOMEM; in ieee80211_mgd_assoc()
9095 cbss = req->link_id < 0 ? req->bss : req->links[req->link_id].bss; in ieee80211_mgd_assoc()
9099 err = -EINVAL; in ieee80211_mgd_assoc()
9105 if (!ssid_elem || ssid_elem->datalen > sizeof(assoc_data->ssid)) { in ieee80211_mgd_assoc()
9107 err = -EINVAL; in ieee80211_mgd_assoc()
9111 memcpy(assoc_data->ssid, ssid_elem->data, ssid_elem->datalen); in ieee80211_mgd_assoc()
9112 assoc_data->ssid_len = ssid_elem->datalen; in ieee80211_mgd_assoc()
9115 if (req->ap_mld_addr) in ieee80211_mgd_assoc()
9116 memcpy(assoc_data->ap_addr, req->ap_mld_addr, ETH_ALEN); in ieee80211_mgd_assoc()
9118 memcpy(assoc_data->ap_addr, cbss->bssid, ETH_ALEN); in ieee80211_mgd_assoc()
9120 if (ifmgd->associated) { in ieee80211_mgd_assoc()
9125 sdata->vif.cfg.ap_addr, assoc_data->ap_addr); in ieee80211_mgd_assoc()
9136 ieee80211_parse_cfg_selectors(assoc_data->userspace_selectors, in ieee80211_mgd_assoc()
9137 req->supported_selectors, in ieee80211_mgd_assoc()
9138 req->supported_selectors_len); in ieee80211_mgd_assoc()
9140 memcpy(&ifmgd->ht_capa, &req->ht_capa, sizeof(ifmgd->ht_capa)); in ieee80211_mgd_assoc()
9141 memcpy(&ifmgd->ht_capa_mask, &req->ht_capa_mask, in ieee80211_mgd_assoc()
9142 sizeof(ifmgd->ht_capa_mask)); in ieee80211_mgd_assoc()
9144 memcpy(&ifmgd->vht_capa, &req->vht_capa, sizeof(ifmgd->vht_capa)); in ieee80211_mgd_assoc()
9145 memcpy(&ifmgd->vht_capa_mask, &req->vht_capa_mask, in ieee80211_mgd_assoc()
9146 sizeof(ifmgd->vht_capa_mask)); in ieee80211_mgd_assoc()
9148 memcpy(&ifmgd->s1g_capa, &req->s1g_capa, sizeof(ifmgd->s1g_capa)); in ieee80211_mgd_assoc()
9149 memcpy(&ifmgd->s1g_capa_mask, &req->s1g_capa_mask, in ieee80211_mgd_assoc()
9150 sizeof(ifmgd->s1g_capa_mask)); in ieee80211_mgd_assoc()
9153 match_auth = ifmgd->auth_data && in ieee80211_mgd_assoc()
9154 ether_addr_equal(ifmgd->auth_data->ap_addr, in ieee80211_mgd_assoc()
9155 assoc_data->ap_addr) && in ieee80211_mgd_assoc()
9156 ifmgd->auth_data->link_id == req->link_id; in ieee80211_mgd_assoc()
9158 if (req->ap_mld_addr) { in ieee80211_mgd_assoc()
9161 if (req->flags & (ASSOC_REQ_DISABLE_HT | in ieee80211_mgd_assoc()
9165 err = -EINVAL; in ieee80211_mgd_assoc()
9171 struct cfg80211_bss *link_cbss = req->links[i].bss; in ieee80211_mgd_assoc()
9177 bss = (void *)link_cbss->priv; in ieee80211_mgd_assoc()
9179 if (!bss->wmm_used) { in ieee80211_mgd_assoc()
9180 err = -EINVAL; in ieee80211_mgd_assoc()
9181 req->links[i].error = err; in ieee80211_mgd_assoc()
9185 if (link_cbss->channel->band == NL80211_BAND_S1GHZ) { in ieee80211_mgd_assoc()
9186 err = -EINVAL; in ieee80211_mgd_assoc()
9187 req->links[i].error = err; in ieee80211_mgd_assoc()
9191 link = sdata_dereference(sdata->link[i], sdata); in ieee80211_mgd_assoc()
9193 ether_addr_copy(assoc_data->link[i].addr, in ieee80211_mgd_assoc()
9194 link->conf->addr); in ieee80211_mgd_assoc()
9196 eth_random_addr(assoc_data->link[i].addr); in ieee80211_mgd_assoc()
9197 sband = local->hw.wiphy->bands[link_cbss->channel->band]; in ieee80211_mgd_assoc()
9200 assoc_data->link[i].conn = link->u.mgd.conn; in ieee80211_mgd_assoc()
9202 assoc_data->link[i].conn = in ieee80211_mgd_assoc()
9206 &assoc_data->link[i].conn); in ieee80211_mgd_assoc()
9207 assoc_data->link[i].bss = link_cbss; in ieee80211_mgd_assoc()
9208 assoc_data->link[i].disabled = req->links[i].disabled; in ieee80211_mgd_assoc()
9210 if (!bss->uapsd_supported) in ieee80211_mgd_assoc()
9213 if (assoc_data->link[i].conn.mode < IEEE80211_CONN_MODE_EHT) { in ieee80211_mgd_assoc()
9214 err = -EINVAL; in ieee80211_mgd_assoc()
9215 req->links[i].error = err; in ieee80211_mgd_assoc()
9222 err = -EINVAL; in ieee80211_mgd_assoc()
9223 req->links[i].error = err; in ieee80211_mgd_assoc()
9228 assoc_data->wmm = true; in ieee80211_mgd_assoc()
9231 struct ieee80211_bss *bss = (void *)cbss->priv; in ieee80211_mgd_assoc()
9233 memcpy(assoc_data->link[0].addr, sdata->vif.addr, ETH_ALEN); in ieee80211_mgd_assoc()
9234 assoc_data->s1g = cbss->channel->band == NL80211_BAND_S1GHZ; in ieee80211_mgd_assoc()
9236 assoc_data->wmm = bss->wmm_used && in ieee80211_mgd_assoc()
9237 (local->hw.queues >= IEEE80211_NUM_ACS); in ieee80211_mgd_assoc()
9239 if (cbss->channel->band == NL80211_BAND_6GHZ && in ieee80211_mgd_assoc()
9240 req->flags & (ASSOC_REQ_DISABLE_HT | in ieee80211_mgd_assoc()
9243 err = -EINVAL; in ieee80211_mgd_assoc()
9247 sband = local->hw.wiphy->bands[cbss->channel->band]; in ieee80211_mgd_assoc()
9249 assoc_data->link[0].bss = cbss; in ieee80211_mgd_assoc()
9252 assoc_data->link[0].conn = sdata->deflink.u.mgd.conn; in ieee80211_mgd_assoc()
9254 assoc_data->link[0].conn = in ieee80211_mgd_assoc()
9257 assoc_data->wmm, 0, in ieee80211_mgd_assoc()
9258 &assoc_data->link[0].conn); in ieee80211_mgd_assoc()
9260 uapsd_supported = bss->uapsd_supported; in ieee80211_mgd_assoc()
9267 assoc_data->spp_amsdu = req->flags & ASSOC_REQ_SPP_AMSDU; in ieee80211_mgd_assoc()
9269 if (ifmgd->auth_data && !ifmgd->auth_data->done) { in ieee80211_mgd_assoc()
9270 err = -EBUSY; in ieee80211_mgd_assoc()
9274 if (ifmgd->assoc_data) { in ieee80211_mgd_assoc()
9275 err = -EBUSY; in ieee80211_mgd_assoc()
9280 if (ifmgd->auth_data && !match_auth) in ieee80211_mgd_assoc()
9283 if (req->ie && req->ie_len) { in ieee80211_mgd_assoc()
9284 memcpy(assoc_data->ie, req->ie, req->ie_len); in ieee80211_mgd_assoc()
9285 assoc_data->ie_len = req->ie_len; in ieee80211_mgd_assoc()
9286 assoc_data->ie_pos = assoc_data->ie + assoc_data->ie_len; in ieee80211_mgd_assoc()
9288 assoc_data->ie_pos = assoc_data->ie; in ieee80211_mgd_assoc()
9291 if (req->fils_kek) { in ieee80211_mgd_assoc()
9292 /* should already be checked in cfg80211 - so warn */ in ieee80211_mgd_assoc()
9293 if (WARN_ON(req->fils_kek_len > FILS_MAX_KEK_LEN)) { in ieee80211_mgd_assoc()
9294 err = -EINVAL; in ieee80211_mgd_assoc()
9297 memcpy(assoc_data->fils_kek, req->fils_kek, in ieee80211_mgd_assoc()
9298 req->fils_kek_len); in ieee80211_mgd_assoc()
9299 assoc_data->fils_kek_len = req->fils_kek_len; in ieee80211_mgd_assoc()
9302 if (req->fils_nonces) in ieee80211_mgd_assoc()
9303 memcpy(assoc_data->fils_nonces, req->fils_nonces, in ieee80211_mgd_assoc()
9307 assoc_data->timeout = jiffies; in ieee80211_mgd_assoc()
9308 assoc_data->timeout_started = true; in ieee80211_mgd_assoc()
9310 assoc_data->assoc_link_id = assoc_link_id; in ieee80211_mgd_assoc()
9312 if (req->ap_mld_addr) { in ieee80211_mgd_assoc()
9319 link = sdata_dereference(sdata->link[assoc_link_id], sdata); in ieee80211_mgd_assoc()
9321 err = -EINVAL; in ieee80211_mgd_assoc()
9325 override = link->u.mgd.conn.mode != in ieee80211_mgd_assoc()
9326 assoc_data->link[assoc_link_id].conn.mode || in ieee80211_mgd_assoc()
9327 link->u.mgd.conn.bw_limit != in ieee80211_mgd_assoc()
9328 assoc_data->link[assoc_link_id].conn.bw_limit; in ieee80211_mgd_assoc()
9329 link->u.mgd.conn = assoc_data->link[assoc_link_id].conn; in ieee80211_mgd_assoc()
9331 ieee80211_setup_assoc_link(sdata, assoc_data, req, &link->u.mgd.conn, in ieee80211_mgd_assoc()
9334 if (WARN((sdata->vif.driver_flags & IEEE80211_VIF_SUPPORTS_UAPSD) && in ieee80211_mgd_assoc()
9335 ieee80211_hw_check(&local->hw, PS_NULLFUNC_STACK), in ieee80211_mgd_assoc()
9336 "U-APSD not supported with HW_PS_NULLFUNC_STACK\n")) in ieee80211_mgd_assoc()
9337 sdata->vif.driver_flags &= ~IEEE80211_VIF_SUPPORTS_UAPSD; in ieee80211_mgd_assoc()
9339 if (assoc_data->wmm && uapsd_supported && in ieee80211_mgd_assoc()
9340 (sdata->vif.driver_flags & IEEE80211_VIF_SUPPORTS_UAPSD)) { in ieee80211_mgd_assoc()
9341 assoc_data->uapsd = true; in ieee80211_mgd_assoc()
9342 ifmgd->flags |= IEEE80211_STA_UAPSD_ENABLED; in ieee80211_mgd_assoc()
9344 assoc_data->uapsd = false; in ieee80211_mgd_assoc()
9345 ifmgd->flags &= ~IEEE80211_STA_UAPSD_ENABLED; in ieee80211_mgd_assoc()
9348 if (req->prev_bssid) in ieee80211_mgd_assoc()
9349 memcpy(assoc_data->prev_ap_addr, req->prev_bssid, ETH_ALEN); in ieee80211_mgd_assoc()
9351 if (req->use_mfp) { in ieee80211_mgd_assoc()
9352 ifmgd->mfp = IEEE80211_MFP_REQUIRED; in ieee80211_mgd_assoc()
9353 ifmgd->flags |= IEEE80211_STA_MFP_ENABLED; in ieee80211_mgd_assoc()
9355 ifmgd->mfp = IEEE80211_MFP_DISABLED; in ieee80211_mgd_assoc()
9356 ifmgd->flags &= ~IEEE80211_STA_MFP_ENABLED; in ieee80211_mgd_assoc()
9359 if (req->flags & ASSOC_REQ_USE_RRM) in ieee80211_mgd_assoc()
9360 ifmgd->flags |= IEEE80211_STA_ENABLE_RRM; in ieee80211_mgd_assoc()
9362 ifmgd->flags &= ~IEEE80211_STA_ENABLE_RRM; in ieee80211_mgd_assoc()
9364 if (req->crypto.control_port) in ieee80211_mgd_assoc()
9365 ifmgd->flags |= IEEE80211_STA_CONTROL_PORT; in ieee80211_mgd_assoc()
9367 ifmgd->flags &= ~IEEE80211_STA_CONTROL_PORT; in ieee80211_mgd_assoc()
9369 sdata->control_port_protocol = req->crypto.control_port_ethertype; in ieee80211_mgd_assoc()
9370 sdata->control_port_no_encrypt = req->crypto.control_port_no_encrypt; in ieee80211_mgd_assoc()
9371 sdata->control_port_over_nl80211 = in ieee80211_mgd_assoc()
9372 req->crypto.control_port_over_nl80211; in ieee80211_mgd_assoc()
9373 sdata->control_port_no_preauth = req->crypto.control_port_no_preauth; in ieee80211_mgd_assoc()
9376 ifmgd->assoc_data = assoc_data; in ieee80211_mgd_assoc()
9378 for (i = 0; i < ARRAY_SIZE(assoc_data->link); i++) { in ieee80211_mgd_assoc()
9379 if (!assoc_data->link[i].bss) in ieee80211_mgd_assoc()
9381 if (i == assoc_data->assoc_link_id) in ieee80211_mgd_assoc()
9385 assoc_data->link[i].bss, true, in ieee80211_mgd_assoc()
9386 &assoc_data->link[i].conn, in ieee80211_mgd_assoc()
9387 assoc_data->userspace_selectors); in ieee80211_mgd_assoc()
9389 req->links[i].error = err; in ieee80211_mgd_assoc()
9394 memcpy(vif_cfg->ssid, assoc_data->ssid, assoc_data->ssid_len); in ieee80211_mgd_assoc()
9395 vif_cfg->ssid_len = assoc_data->ssid_len; in ieee80211_mgd_assoc()
9398 memcpy(sdata->vif.cfg.ap_addr, assoc_data->ap_addr, ETH_ALEN); in ieee80211_mgd_assoc()
9400 err = ieee80211_prep_connection(sdata, cbss, req->link_id, in ieee80211_mgd_assoc()
9401 req->ap_mld_addr, true, in ieee80211_mgd_assoc()
9402 &assoc_data->link[assoc_link_id].conn, in ieee80211_mgd_assoc()
9404 assoc_data->userspace_selectors); in ieee80211_mgd_assoc()
9408 if (ieee80211_hw_check(&sdata->local->hw, NEED_DTIM_BEFORE_ASSOC)) { in ieee80211_mgd_assoc()
9412 beacon_ies = rcu_dereference(req->bss->beacon_ies); in ieee80211_mgd_assoc()
9419 link->u.mgd.bssid); in ieee80211_mgd_assoc()
9420 assoc_data->timeout = TU_TO_EXP_TIME(req->bss->beacon_interval); in ieee80211_mgd_assoc()
9421 assoc_data->timeout_started = true; in ieee80211_mgd_assoc()
9422 assoc_data->need_beacon = true; in ieee80211_mgd_assoc()
9427 run_again(sdata, assoc_data->timeout); in ieee80211_mgd_assoc()
9430 if (ifmgd->auth_data) in ieee80211_mgd_assoc()
9435 if (!ifmgd->auth_data) { in ieee80211_mgd_assoc()
9436 eth_zero_addr(sdata->deflink.u.mgd.bssid); in ieee80211_mgd_assoc()
9437 ieee80211_link_info_change_notify(sdata, &sdata->deflink, in ieee80211_mgd_assoc()
9440 ifmgd->assoc_data = NULL; in ieee80211_mgd_assoc()
9449 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_mgd_deauth()
9451 bool tx = !req->local_state_change; in ieee80211_mgd_deauth()
9456 if (ifmgd->auth_data && in ieee80211_mgd_deauth()
9457 ether_addr_equal(ifmgd->auth_data->ap_addr, req->bssid)) { in ieee80211_mgd_deauth()
9460 req->bssid, req->reason_code, in ieee80211_mgd_deauth()
9461 ieee80211_get_reason_code_string(req->reason_code)); in ieee80211_mgd_deauth()
9463 info.link_id = ifmgd->auth_data->link_id; in ieee80211_mgd_deauth()
9464 drv_mgd_prepare_tx(sdata->local, sdata, &info); in ieee80211_mgd_deauth()
9465 ieee80211_send_deauth_disassoc(sdata, req->bssid, req->bssid, in ieee80211_mgd_deauth()
9467 req->reason_code, tx, in ieee80211_mgd_deauth()
9472 req->reason_code, false); in ieee80211_mgd_deauth()
9473 drv_mgd_complete_tx(sdata->local, sdata, &info); in ieee80211_mgd_deauth()
9477 if (ifmgd->assoc_data && in ieee80211_mgd_deauth()
9478 ether_addr_equal(ifmgd->assoc_data->ap_addr, req->bssid)) { in ieee80211_mgd_deauth()
9481 req->bssid, req->reason_code, in ieee80211_mgd_deauth()
9482 ieee80211_get_reason_code_string(req->reason_code)); in ieee80211_mgd_deauth()
9484 info.link_id = ifmgd->assoc_data->assoc_link_id; in ieee80211_mgd_deauth()
9485 drv_mgd_prepare_tx(sdata->local, sdata, &info); in ieee80211_mgd_deauth()
9486 ieee80211_send_deauth_disassoc(sdata, req->bssid, req->bssid, in ieee80211_mgd_deauth()
9488 req->reason_code, tx, in ieee80211_mgd_deauth()
9493 req->reason_code, false); in ieee80211_mgd_deauth()
9494 drv_mgd_complete_tx(sdata->local, sdata, &info); in ieee80211_mgd_deauth()
9498 if (ifmgd->associated && in ieee80211_mgd_deauth()
9499 ether_addr_equal(sdata->vif.cfg.ap_addr, req->bssid)) { in ieee80211_mgd_deauth()
9502 req->bssid, req->reason_code, in ieee80211_mgd_deauth()
9503 ieee80211_get_reason_code_string(req->reason_code)); in ieee80211_mgd_deauth()
9506 req->reason_code, tx, frame_buf); in ieee80211_mgd_deauth()
9509 req->reason_code, false); in ieee80211_mgd_deauth()
9510 drv_mgd_complete_tx(sdata->local, sdata, &info); in ieee80211_mgd_deauth()
9514 return -ENOTCONN; in ieee80211_mgd_deauth()
9522 if (!sdata->u.mgd.associated || in ieee80211_mgd_disassoc()
9523 memcmp(sdata->vif.cfg.ap_addr, req->ap_addr, ETH_ALEN)) in ieee80211_mgd_disassoc()
9524 return -ENOTCONN; in ieee80211_mgd_disassoc()
9528 req->ap_addr, req->reason_code, in ieee80211_mgd_disassoc()
9529 ieee80211_get_reason_code_string(req->reason_code)); in ieee80211_mgd_disassoc()
9532 req->reason_code, !req->local_state_change, in ieee80211_mgd_disassoc()
9536 req->reason_code, false); in ieee80211_mgd_disassoc()
9543 wiphy_work_cancel(link->sdata->local->hw.wiphy, in ieee80211_mgd_stop_link()
9544 &link->u.mgd.request_smps_work); in ieee80211_mgd_stop_link()
9545 wiphy_work_cancel(link->sdata->local->hw.wiphy, in ieee80211_mgd_stop_link()
9546 &link->u.mgd.recalc_smps); in ieee80211_mgd_stop_link()
9547 wiphy_delayed_work_cancel(link->sdata->local->hw.wiphy, in ieee80211_mgd_stop_link()
9548 &link->u.mgd.csa.switch_work); in ieee80211_mgd_stop_link()
9553 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_mgd_stop()
9560 wiphy_work_cancel(sdata->local->hw.wiphy, in ieee80211_mgd_stop()
9561 &ifmgd->monitor_work); in ieee80211_mgd_stop()
9562 wiphy_work_cancel(sdata->local->hw.wiphy, in ieee80211_mgd_stop()
9563 &ifmgd->beacon_connection_loss_work); in ieee80211_mgd_stop()
9564 wiphy_work_cancel(sdata->local->hw.wiphy, in ieee80211_mgd_stop()
9565 &ifmgd->csa_connection_drop_work); in ieee80211_mgd_stop()
9566 wiphy_delayed_work_cancel(sdata->local->hw.wiphy, in ieee80211_mgd_stop()
9567 &ifmgd->tdls_peer_del_work); in ieee80211_mgd_stop()
9569 if (ifmgd->assoc_data) in ieee80211_mgd_stop()
9571 if (ifmgd->auth_data) in ieee80211_mgd_stop()
9573 spin_lock_bh(&ifmgd->teardown_lock); in ieee80211_mgd_stop()
9574 if (ifmgd->teardown_skb) { in ieee80211_mgd_stop()
9575 kfree_skb(ifmgd->teardown_skb); in ieee80211_mgd_stop()
9576 ifmgd->teardown_skb = NULL; in ieee80211_mgd_stop()
9577 ifmgd->orig_teardown_skb = NULL; in ieee80211_mgd_stop()
9579 kfree(ifmgd->assoc_req_ies); in ieee80211_mgd_stop()
9580 ifmgd->assoc_req_ies = NULL; in ieee80211_mgd_stop()
9581 ifmgd->assoc_req_ies_len = 0; in ieee80211_mgd_stop()
9582 spin_unlock_bh(&ifmgd->teardown_lock); in ieee80211_mgd_stop()
9583 del_timer_sync(&ifmgd->timer); in ieee80211_mgd_stop()
9595 cfg80211_cqm_rssi_notify(sdata->dev, rssi_event, rssi_level, gfp); in ieee80211_cqm_rssi_notify()
9603 trace_api_cqm_beacon_loss_notify(sdata->local, sdata); in ieee80211_cqm_beacon_loss_notify()
9605 cfg80211_cqm_beacon_loss_notify(sdata->dev, gfp); in ieee80211_cqm_beacon_loss_notify()
9615 if (WARN_ON(sdata->vif.type != NL80211_IFTYPE_STATION)) in _ieee80211_enable_rssi_reports()
9623 sdata->u.mgd.rssi_min_thold = rssi_min_thold*16; in _ieee80211_enable_rssi_reports()
9624 sdata->u.mgd.rssi_max_thold = rssi_max_thold*16; in _ieee80211_enable_rssi_reports()
9660 struct ieee80211_local *local = sdata->local; in ieee80211_process_ml_reconf_resp()
9661 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_process_ml_reconf_resp()
9663 ifmgd->reconf.add_links_data; in ieee80211_process_ml_reconf_resp()
9666 u16 sta_changed_links = sdata->u.mgd.reconf.added_links | in ieee80211_process_ml_reconf_resp()
9667 sdata->u.mgd.reconf.removed_links; in ieee80211_process_ml_reconf_resp()
9675 if (!ieee80211_vif_is_mld(&sdata->vif) || in ieee80211_process_ml_reconf_resp()
9677 mgmt->u.action.u.ml_reconf_resp.dialog_token != in ieee80211_process_ml_reconf_resp()
9678 sdata->u.mgd.reconf.dialog_token || in ieee80211_process_ml_reconf_resp()
9682 pos = mgmt->u.action.u.ml_reconf_resp.variable; in ieee80211_process_ml_reconf_resp()
9683 len -= offsetofend(typeof(*mgmt), u.action.u.ml_reconf_resp); in ieee80211_process_ml_reconf_resp()
9686 if (len < mgmt->u.action.u.ml_reconf_resp.count * 3) { in ieee80211_process_ml_reconf_resp()
9689 len, mgmt->u.action.u.ml_reconf_resp.count); in ieee80211_process_ml_reconf_resp()
9694 for (i = 0; i < mgmt->u.action.u.ml_reconf_resp.count; i++) { in ieee80211_process_ml_reconf_resp()
9723 if (sdata->u.mgd.reconf.removed_links & BIT(link_id)) in ieee80211_process_ml_reconf_resp()
9729 sdata->u.mgd.reconf.added_links &= ~BIT(link_id); in ieee80211_process_ml_reconf_resp()
9733 len -= 3; in ieee80211_process_ml_reconf_resp()
9743 if (!sdata->u.mgd.reconf.added_links) in ieee80211_process_ml_reconf_resp()
9758 len -= group_key_data_len + 1; in ieee80211_process_ml_reconf_resp()
9761 sta = sta_info_get(sdata, sdata->vif.cfg.ap_addr); in ieee80211_process_ml_reconf_resp()
9765 valid_links = sdata->vif.valid_links; in ieee80211_process_ml_reconf_resp()
9767 if (!add_links_data->link[link_id].bss || in ieee80211_process_ml_reconf_resp()
9768 !(sdata->u.mgd.reconf.added_links & BIT(link_id))) in ieee80211_process_ml_reconf_resp()
9777 ieee80211_vif_set_links(sdata, valid_links, sdata->vif.dormant_links); in ieee80211_process_ml_reconf_resp()
9781 struct cfg80211_bss *cbss = add_links_data->link[link_id].bss; in ieee80211_process_ml_reconf_resp()
9789 link = sdata_dereference(sdata->link[link_id], sdata); in ieee80211_process_ml_reconf_resp()
9795 add_links_data->link[link_id].addr, in ieee80211_process_ml_reconf_resp()
9796 add_links_data->link[link_id].bss->bssid); in ieee80211_process_ml_reconf_resp()
9798 link_sta = rcu_dereference_protected(sta->link[link_id], in ieee80211_process_ml_reconf_resp()
9799 lockdep_is_held(&local->hw.wiphy->mtx)); in ieee80211_process_ml_reconf_resp()
9803 if (!link->u.mgd.have_beacon) { in ieee80211_process_ml_reconf_resp()
9807 ies = rcu_dereference(cbss->beacon_ies); in ieee80211_process_ml_reconf_resp()
9809 link->u.mgd.have_beacon = true; in ieee80211_process_ml_reconf_resp()
9811 ies = rcu_dereference(cbss->ies); in ieee80211_process_ml_reconf_resp()
9813 &link->conf->sync_dtim_count, in ieee80211_process_ml_reconf_resp()
9814 &link->u.mgd.dtim_period); in ieee80211_process_ml_reconf_resp()
9815 link->conf->beacon_int = cbss->beacon_interval; in ieee80211_process_ml_reconf_resp()
9819 link->conf->dtim_period = link->u.mgd.dtim_period ?: 1; in ieee80211_process_ml_reconf_resp()
9821 link->u.mgd.conn = add_links_data->link[link_id].conn; in ieee80211_process_ml_reconf_resp()
9823 true, &link->u.mgd.conn, in ieee80211_process_ml_reconf_resp()
9830 add_links_data->link[link_id].bss)) in ieee80211_process_ml_reconf_resp()
9834 add_links_data->link[link_id].bss, in ieee80211_process_ml_reconf_resp()
9843 if (add_links_data->link[link_id].status != WLAN_STATUS_SUCCESS) in ieee80211_process_ml_reconf_resp()
9862 ieee80211_vif_set_links(sdata, valid_links, sdata->vif.dormant_links); in ieee80211_process_ml_reconf_resp()
9873 done_data.links[link_id].bss = add_links_data->link[link_id].bss; in ieee80211_process_ml_reconf_resp()
9875 cfg80211_mlo_reconf_add_done(sdata->dev, &done_data); in ieee80211_process_ml_reconf_resp()
9876 kfree(sdata->u.mgd.reconf.add_links_data); in ieee80211_process_ml_reconf_resp()
9877 sdata->u.mgd.reconf.add_links_data = NULL; in ieee80211_process_ml_reconf_resp()
9891 struct ieee80211_local *local = sdata->local; in ieee80211_build_ml_reconf_req()
9895 enum nl80211_iftype iftype = ieee80211_vif_type_p2p(&sdata->vif); in ieee80211_build_ml_reconf_req()
9905 size = local->hw.extra_tx_headroom + sizeof(*mgmt); in ieee80211_build_ml_reconf_req()
9920 cfg80211_get_iftype_ext_capa(local->hw.wiphy, in ieee80211_build_ml_reconf_req()
9921 ieee80211_vif_type_p2p(&sdata->vif)); in ieee80211_build_ml_reconf_req()
9924 eml_capa = cpu_to_le16(ift_ext_capa->eml_capabilities); in ieee80211_build_ml_reconf_req()
9926 cpu_to_le16(ift_ext_capa->mld_capa_and_ops); in ieee80211_build_ml_reconf_req()
9951 if (!add_links_data || !add_links_data->link[link_id].bss) in ieee80211_build_ml_reconf_req()
9954 elems_len = add_links_data->link[link_id].elems_len; in ieee80211_build_ml_reconf_req()
9955 cbss = add_links_data->link[link_id].bss; in ieee80211_build_ml_reconf_req()
9958 if (cbss->capability & WLAN_CAPABILITY_PRIVACY) in ieee80211_build_ml_reconf_req()
9974 skb_reserve(skb, local->hw.extra_tx_headroom); in ieee80211_build_ml_reconf_req()
9979 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | in ieee80211_build_ml_reconf_req()
9981 memcpy(mgmt->da, sdata->vif.cfg.ap_addr, ETH_ALEN); in ieee80211_build_ml_reconf_req()
9982 memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); in ieee80211_build_ml_reconf_req()
9983 memcpy(mgmt->bssid, sdata->vif.cfg.ap_addr, ETH_ALEN); in ieee80211_build_ml_reconf_req()
9986 mgmt->u.action.category = WLAN_CATEGORY_PROTECTED_EHT; in ieee80211_build_ml_reconf_req()
9987 mgmt->u.action.u.ml_reconf_req.action_code = in ieee80211_build_ml_reconf_req()
9991 sdata->u.mgd.reconf.dialog_token = ++sdata->u.mgd.dialog_token_alloc; in ieee80211_build_ml_reconf_req()
9992 mgmt->u.action.u.ml_reconf_req.dialog_token = in ieee80211_build_ml_reconf_req()
9993 sdata->u.mgd.reconf.dialog_token; in ieee80211_build_ml_reconf_req()
10000 ml_elem->control = in ieee80211_build_ml_reconf_req()
10004 common->len = common_size + var_common_size; in ieee80211_build_ml_reconf_req()
10005 memcpy(common->mld_mac_addr, sdata->vif.addr, ETH_ALEN); in ieee80211_build_ml_reconf_req()
10011 ml_elem->control |= in ieee80211_build_ml_reconf_req()
10016 ml_elem->control |= in ieee80211_build_ml_reconf_req()
10022 if (sdata->u.mgd.flags & IEEE80211_STA_ENABLE_RRM) in ieee80211_build_ml_reconf_req()
10033 (!add_links_data || !add_links_data->link[link_id].bss)) in ieee80211_build_ml_reconf_req()
10041 sdata_dereference(sdata->vif.link_conf[link_id], in ieee80211_build_ml_reconf_req()
10046 addr = conf->addr; in ieee80211_build_ml_reconf_req()
10050 addr = add_links_data->link[link_id].addr; in ieee80211_build_ml_reconf_req()
10073 add_links_data->link[link_id].elems, in ieee80211_build_ml_reconf_req()
10074 add_links_data->link[link_id].elems_len, in ieee80211_build_ml_reconf_req()
10079 if (add_links_data->link[link_id].elems) in ieee80211_build_ml_reconf_req()
10081 add_links_data->link[link_id].elems + in ieee80211_build_ml_reconf_req()
10083 add_links_data->link[link_id].elems_len - in ieee80211_build_ml_reconf_req()
10085 if (sdata->u.mgd.flags & IEEE80211_STA_UAPSD_ENABLED) { in ieee80211_build_ml_reconf_req()
10086 qos_info = sdata->u.mgd.uapsd_queues; in ieee80211_build_ml_reconf_req()
10087 qos_info |= (sdata->u.mgd.uapsd_max_sp_len << in ieee80211_build_ml_reconf_req()
10104 info->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS; in ieee80211_build_ml_reconf_req()
10113 struct ieee80211_local *local = sdata->local; in ieee80211_mgd_assoc_ml_reconf()
10120 if (!ieee80211_vif_is_mld(&sdata->vif) || in ieee80211_mgd_assoc_ml_reconf()
10121 !(sdata->vif.cfg.mld_capa_op & in ieee80211_mgd_assoc_ml_reconf()
10123 return -EINVAL; in ieee80211_mgd_assoc_ml_reconf()
10126 if (sdata->u.mgd.reconf.added_links || in ieee80211_mgd_assoc_ml_reconf()
10127 sdata->u.mgd.reconf.removed_links) in ieee80211_mgd_assoc_ml_reconf()
10128 return -EBUSY; in ieee80211_mgd_assoc_ml_reconf()
10139 sta = sta_info_get(sdata, sdata->vif.cfg.ap_addr); in ieee80211_mgd_assoc_ml_reconf()
10141 return -ENOLINK; in ieee80211_mgd_assoc_ml_reconf()
10143 if (rem_links & BIT(sta->sta.deflink.link_id)) in ieee80211_mgd_assoc_ml_reconf()
10144 return -EINVAL; in ieee80211_mgd_assoc_ml_reconf()
10157 return -ENOMEM; in ieee80211_mgd_assoc_ml_reconf()
10170 bss = (void *)link_cbss->priv; in ieee80211_mgd_assoc_ml_reconf()
10172 if (!bss->wmm_used) { in ieee80211_mgd_assoc_ml_reconf()
10173 err = -EINVAL; in ieee80211_mgd_assoc_ml_reconf()
10177 if (link_cbss->channel->band == NL80211_BAND_S1GHZ) { in ieee80211_mgd_assoc_ml_reconf()
10178 err = -EINVAL; in ieee80211_mgd_assoc_ml_reconf()
10182 eth_random_addr(data->link[link_id].addr); in ieee80211_mgd_assoc_ml_reconf()
10183 data->link[link_id].conn = in ieee80211_mgd_assoc_ml_reconf()
10186 local->hw.wiphy->bands[link_cbss->channel->band]; in ieee80211_mgd_assoc_ml_reconf()
10190 &data->link[link_id].conn); in ieee80211_mgd_assoc_ml_reconf()
10192 data->link[link_id].bss = link_cbss; in ieee80211_mgd_assoc_ml_reconf()
10193 data->link[link_id].disabled = in ieee80211_mgd_assoc_ml_reconf()
10195 data->link[link_id].elems = in ieee80211_mgd_assoc_ml_reconf()
10197 data->link[link_id].elems_len = in ieee80211_mgd_assoc_ml_reconf()
10200 if (!bss->uapsd_supported) in ieee80211_mgd_assoc_ml_reconf()
10203 if (data->link[link_id].conn.mode < in ieee80211_mgd_assoc_ml_reconf()
10205 err = -EINVAL; in ieee80211_mgd_assoc_ml_reconf()
10212 err = -EINVAL; in ieee80211_mgd_assoc_ml_reconf()
10217 /* Require U-APSD support to be similar to the current valid in ieee80211_mgd_assoc_ml_reconf()
10221 !!(sdata->u.mgd.flags & IEEE80211_STA_UAPSD_ENABLED)) { in ieee80211_mgd_assoc_ml_reconf()
10222 err = -EINVAL; in ieee80211_mgd_assoc_ml_reconf()
10228 if (!data->link[link_id].bss) in ieee80211_mgd_assoc_ml_reconf()
10233 data->link[link_id].bss, in ieee80211_mgd_assoc_ml_reconf()
10235 &data->link[link_id].conn, in ieee80211_mgd_assoc_ml_reconf()
10249 u16 new_active_links = sdata->vif.active_links & ~rem_links; in ieee80211_mgd_assoc_ml_reconf()
10251 new_valid_links = sdata->vif.valid_links & ~rem_links; in ieee80211_mgd_assoc_ml_reconf()
10257 !(new_valid_links & ~sdata->vif.dormant_links)) { in ieee80211_mgd_assoc_ml_reconf()
10259 err = -EINVAL; in ieee80211_mgd_assoc_ml_reconf()
10263 if (new_active_links != sdata->vif.active_links) { in ieee80211_mgd_assoc_ml_reconf()
10267 ~sdata->vif.dormant_links)); in ieee80211_mgd_assoc_ml_reconf()
10269 err = ieee80211_set_active_links(&sdata->vif, in ieee80211_mgd_assoc_ml_reconf()
10288 err = -ENOMEM; in ieee80211_mgd_assoc_ml_reconf()
10293 u16 new_dormant_links = sdata->vif.dormant_links & ~rem_links; in ieee80211_mgd_assoc_ml_reconf()
10315 cfg80211_links_removed(sdata->dev, rem_links); in ieee80211_mgd_assoc_ml_reconf()
10323 sdata->u.mgd.reconf.added_links = added_links; in ieee80211_mgd_assoc_ml_reconf()
10324 sdata->u.mgd.reconf.add_links_data = data; in ieee80211_mgd_assoc_ml_reconf()
10325 sdata->u.mgd.reconf.removed_links = rem_links; in ieee80211_mgd_assoc_ml_reconf()
10326 wiphy_delayed_work_queue(sdata->local->hw.wiphy, in ieee80211_mgd_assoc_ml_reconf()
10327 &sdata->u.mgd.reconf.wk, in ieee80211_mgd_assoc_ml_reconf()