Lines Matching +full:ieee80211 +full:- +full:freq +full:- +full:limit
1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright 2002-2005, Instant802 Networks, Inc.
4 * Copyright 2005-2006, Devicescape Software, Inc.
5 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
7 * Copyright 2013-2014 Intel Mobile Communications GmbH
8 * Copyright (C) 2015-2017 Intel Deutschland GmbH
9 * Copyright (C) 2018-2023 Intel Corporation
30 #include "driver-ops.h"
45 return &local->hw; in wiphy_to_ieee80211_hw()
52 __le16 fc = hdr->frame_control; in ieee80211_get_bssid()
61 return hdr->addr1; in ieee80211_get_bssid()
63 return hdr->addr2; in ieee80211_get_bssid()
65 return hdr->addr3; in ieee80211_get_bssid()
71 return ext->u.s1g_beacon.sa; in ieee80211_get_bssid()
77 return hdr->addr3; in ieee80211_get_bssid()
82 return hdr->addr1; in ieee80211_get_bssid()
87 return hdr->addr2; in ieee80211_get_bssid()
90 return hdr->addr1; in ieee80211_get_bssid()
106 skb_queue_walk(&tx->skbs, skb) { in ieee80211_tx_set_protected()
107 hdr = (struct ieee80211_hdr *) skb->data; in ieee80211_tx_set_protected()
108 hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); in ieee80211_tx_set_protected()
136 * 802.11a - 18.5.2: aSIFSTime = 16 usec in ieee80211_frame_duration()
137 * 802.11g - 19.8.4: aSIFSTime = 10 usec + in ieee80211_frame_duration()
141 dur += 16; /* IEEE 802.11-2012 18.3.2.4: T_PREAMBLE = 16 usec */ in ieee80211_frame_duration()
142 dur += 4; /* IEEE 802.11-2012 18.3.2.4: T_SIGNAL = 4 usec */ in ieee80211_frame_duration()
184 short_preamble = sdata->vif.bss_conf.use_short_preamble; in ieee80211_generic_frame_duration()
185 if (sdata->deflink.operating_11g_mode) in ieee80211_generic_frame_duration()
186 erp = rate->flags & IEEE80211_RATE_ERP_G; in ieee80211_generic_frame_duration()
189 dur = ieee80211_frame_duration(band, frame_len, rate->bitrate, erp, in ieee80211_generic_frame_duration()
208 sband = local->hw.wiphy->bands[frame_txctl->band]; in ieee80211_rts_duration()
212 rate = &sband->bitrates[frame_txctl->control.rts_cts_rate_idx]; in ieee80211_rts_duration()
217 short_preamble = sdata->vif.bss_conf.use_short_preamble; in ieee80211_rts_duration()
218 if (sdata->deflink.operating_11g_mode) in ieee80211_rts_duration()
219 erp = rate->flags & IEEE80211_RATE_ERP_G; in ieee80211_rts_duration()
222 bitrate = rate->bitrate; in ieee80211_rts_duration()
225 dur = ieee80211_frame_duration(sband->band, 10, bitrate, in ieee80211_rts_duration()
228 dur += ieee80211_frame_duration(sband->band, frame_len, bitrate, in ieee80211_rts_duration()
231 dur += ieee80211_frame_duration(sband->band, 10, bitrate, in ieee80211_rts_duration()
251 sband = local->hw.wiphy->bands[frame_txctl->band]; in ieee80211_ctstoself_duration()
255 rate = &sband->bitrates[frame_txctl->control.rts_cts_rate_idx]; in ieee80211_ctstoself_duration()
259 short_preamble = sdata->vif.bss_conf.use_short_preamble; in ieee80211_ctstoself_duration()
260 if (sdata->deflink.operating_11g_mode) in ieee80211_ctstoself_duration()
261 erp = rate->flags & IEEE80211_RATE_ERP_G; in ieee80211_ctstoself_duration()
264 bitrate = rate->bitrate; in ieee80211_ctstoself_duration()
267 dur = ieee80211_frame_duration(sband->band, frame_len, bitrate, in ieee80211_ctstoself_duration()
269 if (!(frame_txctl->flags & IEEE80211_TX_CTL_NO_ACK)) { in ieee80211_ctstoself_duration()
271 dur += ieee80211_frame_duration(sband->band, 10, bitrate, in ieee80211_ctstoself_duration()
284 .sta = queue->sta, in wake_tx_push_queue()
289 skb = ieee80211_tx_dequeue(&local->hw, queue); in wake_tx_push_queue()
302 struct ieee80211_sub_if_data *sdata = vif_to_sdata(txq->vif); in ieee80211_handle_wake_tx_queue()
305 spin_lock(&local->handle_wake_tx_queue_lock); in ieee80211_handle_wake_tx_queue()
308 ieee80211_txq_schedule_start(hw, txq->ac); in ieee80211_handle_wake_tx_queue()
309 while ((queue = ieee80211_next_txq(hw, txq->ac))) { in ieee80211_handle_wake_tx_queue()
313 ieee80211_txq_schedule_end(hw, txq->ac); in ieee80211_handle_wake_tx_queue()
314 spin_unlock(&local->handle_wake_tx_queue_lock); in ieee80211_handle_wake_tx_queue()
320 struct ieee80211_local *local = sdata->local; in __ieee80211_wake_txqs()
321 struct ieee80211_vif *vif = &sdata->vif; in __ieee80211_wake_txqs()
322 struct fq *fq = &local->fq; in __ieee80211_wake_txqs()
329 spin_lock(&fq->lock); in __ieee80211_wake_txqs()
331 if (!test_bit(SDATA_STATE_RUNNING, &sdata->state)) in __ieee80211_wake_txqs()
334 if (sdata->vif.type == NL80211_IFTYPE_AP) in __ieee80211_wake_txqs()
335 ps = &sdata->bss->ps; in __ieee80211_wake_txqs()
337 list_for_each_entry_rcu(sta, &local->sta_list, list) { in __ieee80211_wake_txqs()
338 if (sdata != sta->sdata) in __ieee80211_wake_txqs()
341 for (i = 0; i < ARRAY_SIZE(sta->sta.txq); i++) { in __ieee80211_wake_txqs()
342 struct ieee80211_txq *txq = sta->sta.txq[i]; in __ieee80211_wake_txqs()
349 if (ac != txq->ac) in __ieee80211_wake_txqs()
353 &txqi->flags)) in __ieee80211_wake_txqs()
356 spin_unlock(&fq->lock); in __ieee80211_wake_txqs()
358 spin_lock(&fq->lock); in __ieee80211_wake_txqs()
362 if (!vif->txq) in __ieee80211_wake_txqs()
365 txqi = to_txq_info(vif->txq); in __ieee80211_wake_txqs()
367 if (!test_and_clear_bit(IEEE80211_TXQ_DIRTY, &txqi->flags) || in __ieee80211_wake_txqs()
368 (ps && atomic_read(&ps->num_sta_ps)) || ac != vif->txq->ac) in __ieee80211_wake_txqs()
371 spin_unlock(&fq->lock); in __ieee80211_wake_txqs()
377 spin_unlock(&fq->lock); in __ieee80211_wake_txqs()
382 __releases(&local->queue_stop_reason_lock)
383 __acquires(&local->queue_stop_reason_lock)
392 if (local->hw.queues < IEEE80211_NUM_ACS) in _ieee80211_wake_txqs()
395 for (i = 0; i < local->hw.queues; i++) { in _ieee80211_wake_txqs()
396 if (local->queue_stop_reasons[i]) in _ieee80211_wake_txqs()
399 spin_unlock_irqrestore(&local->queue_stop_reason_lock, *flags); in _ieee80211_wake_txqs()
400 list_for_each_entry_rcu(sdata, &local->interfaces, list) { in _ieee80211_wake_txqs()
404 int ac_queue = sdata->vif.hw_queue[ac]; in _ieee80211_wake_txqs()
407 sdata->vif.cab_queue == i) in _ieee80211_wake_txqs()
411 spin_lock_irqsave(&local->queue_stop_reason_lock, *flags); in _ieee80211_wake_txqs()
423 spin_lock_irqsave(&local->queue_stop_reason_lock, flags); in ieee80211_wake_txqs()
425 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); in ieee80211_wake_txqs()
437 if (WARN_ON(queue >= hw->queues)) in __ieee80211_wake_queue()
440 if (!test_bit(reason, &local->queue_stop_reasons[queue])) in __ieee80211_wake_queue()
444 local->q_stop_reasons[queue][reason] = 0; in __ieee80211_wake_queue()
446 local->q_stop_reasons[queue][reason]--; in __ieee80211_wake_queue()
447 if (WARN_ON(local->q_stop_reasons[queue][reason] < 0)) in __ieee80211_wake_queue()
448 local->q_stop_reasons[queue][reason] = 0; in __ieee80211_wake_queue()
451 if (local->q_stop_reasons[queue][reason] == 0) in __ieee80211_wake_queue()
452 __clear_bit(reason, &local->queue_stop_reasons[queue]); in __ieee80211_wake_queue()
454 if (local->queue_stop_reasons[queue] != 0) in __ieee80211_wake_queue()
458 if (!skb_queue_empty(&local->pending[queue])) in __ieee80211_wake_queue()
459 tasklet_schedule(&local->tx_pending_tasklet); in __ieee80211_wake_queue()
469 tasklet_schedule(&local->wake_txqs_tasklet); in __ieee80211_wake_queue()
481 spin_lock_irqsave(&local->queue_stop_reason_lock, flags); in ieee80211_wake_queue_by_reason()
483 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); in ieee80211_wake_queue_by_reason()
502 if (WARN_ON(queue >= hw->queues)) in __ieee80211_stop_queue()
506 local->q_stop_reasons[queue][reason] = 1; in __ieee80211_stop_queue()
508 local->q_stop_reasons[queue][reason]++; in __ieee80211_stop_queue()
510 set_bit(reason, &local->queue_stop_reasons[queue]); in __ieee80211_stop_queue()
520 spin_lock_irqsave(&local->queue_stop_reason_lock, flags); in ieee80211_stop_queue_by_reason()
522 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); in ieee80211_stop_queue_by_reason()
536 struct ieee80211_hw *hw = &local->hw; in ieee80211_add_pending_skb()
539 int queue = info->hw_queue; in ieee80211_add_pending_skb()
541 if (WARN_ON(!info->control.vif)) { in ieee80211_add_pending_skb()
542 ieee80211_free_txskb(&local->hw, skb); in ieee80211_add_pending_skb()
546 spin_lock_irqsave(&local->queue_stop_reason_lock, flags); in ieee80211_add_pending_skb()
549 __skb_queue_tail(&local->pending[queue], skb); in ieee80211_add_pending_skb()
552 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); in ieee80211_add_pending_skb()
558 struct ieee80211_hw *hw = &local->hw; in ieee80211_add_pending_skbs()
563 spin_lock_irqsave(&local->queue_stop_reason_lock, flags); in ieee80211_add_pending_skbs()
567 if (WARN_ON(!info->control.vif)) { in ieee80211_add_pending_skbs()
568 ieee80211_free_txskb(&local->hw, skb); in ieee80211_add_pending_skbs()
572 queue = info->hw_queue; in ieee80211_add_pending_skbs()
578 __skb_queue_tail(&local->pending[queue], skb); in ieee80211_add_pending_skbs()
581 for (i = 0; i < hw->queues; i++) in ieee80211_add_pending_skbs()
585 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); in ieee80211_add_pending_skbs()
597 spin_lock_irqsave(&local->queue_stop_reason_lock, flags); in ieee80211_stop_queues_by_reason()
599 for_each_set_bit(i, &queues, hw->queues) in ieee80211_stop_queues_by_reason()
602 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); in ieee80211_stop_queues_by_reason()
619 if (WARN_ON(queue >= hw->queues)) in ieee80211_queue_stopped()
622 spin_lock_irqsave(&local->queue_stop_reason_lock, flags); in ieee80211_queue_stopped()
624 &local->queue_stop_reasons[queue]); in ieee80211_queue_stopped()
625 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); in ieee80211_queue_stopped()
639 spin_lock_irqsave(&local->queue_stop_reason_lock, flags); in ieee80211_wake_queues_by_reason()
641 for_each_set_bit(i, &queues, hw->queues) in ieee80211_wake_queues_by_reason()
644 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); in ieee80211_wake_queues_by_reason()
661 if (sdata && ieee80211_hw_check(&local->hw, QUEUE_CONTROL)) { in ieee80211_get_vif_queues()
667 queues |= BIT(sdata->vif.hw_queue[ac]); in ieee80211_get_vif_queues()
668 if (sdata->vif.cab_queue != IEEE80211_INVAL_HW_QUEUE) in ieee80211_get_vif_queues()
669 queues |= BIT(sdata->vif.cab_queue); in ieee80211_get_vif_queues()
672 queues = BIT(local->hw.queues) - 1; in ieee80211_get_vif_queues()
682 if (!local->ops->flush) in __ieee80211_flush_queues()
687 * IEEE80211_HW_QUEUE_CONTROL - flush all queues in __ieee80211_flush_queues()
689 if (!queues || !ieee80211_hw_check(&local->hw, QUEUE_CONTROL)) in __ieee80211_flush_queues()
692 ieee80211_stop_queues_by_reason(&local->hw, queues, in __ieee80211_flush_queues()
702 list_for_each_entry(sta, &local->sta_list, list) { in __ieee80211_flush_queues()
703 if (sdata != sta->sdata) in __ieee80211_flush_queues()
711 ieee80211_wake_queues_by_reason(&local->hw, queues, in __ieee80211_flush_queues()
726 ieee80211_stop_queues_by_reason(&local->hw, in ieee80211_stop_vif_queues()
735 ieee80211_wake_queues_by_reason(&local->hw, in ieee80211_wake_vif_queues()
749 list_for_each_entry_rcu(sdata, &local->interfaces, list) { in __iterate_interfaces()
750 switch (sdata->vif.type) { in __iterate_interfaces()
752 if (!(sdata->u.mntr.flags & MONITOR_FLAG_ACTIVE)) in __iterate_interfaces()
761 active_only && !(sdata->flags & IEEE80211_SDATA_IN_DRIVER)) in __iterate_interfaces()
764 !(sdata->flags & IEEE80211_SDATA_IN_DRIVER)) in __iterate_interfaces()
767 iterator(data, sdata->vif.addr, in __iterate_interfaces()
768 &sdata->vif); in __iterate_interfaces()
771 sdata = rcu_dereference_check(local->monitor_sdata, in __iterate_interfaces()
772 lockdep_is_held(&local->iflist_mtx) || in __iterate_interfaces()
773 lockdep_is_held(&local->hw.wiphy->mtx)); in __iterate_interfaces()
776 sdata->flags & IEEE80211_SDATA_IN_DRIVER)) in __iterate_interfaces()
777 iterator(data, sdata->vif.addr, &sdata->vif); in __iterate_interfaces()
788 mutex_lock(&local->iflist_mtx); in ieee80211_iterate_interfaces()
790 mutex_unlock(&local->iflist_mtx); in ieee80211_iterate_interfaces()
817 lockdep_assert_wiphy(hw->wiphy); in ieee80211_iterate_active_interfaces_mtx()
831 list_for_each_entry_rcu(sta, &local->sta_list, list) { in __iterate_stations()
832 if (!sta->uploaded) in __iterate_stations()
835 iterator(data, &sta->sta); in __iterate_stations()
857 !(sdata->flags & IEEE80211_SDATA_IN_DRIVER)) in wdev_to_ieee80211_vif()
859 return &sdata->vif; in wdev_to_ieee80211_vif()
868 return &vif_to_sdata(vif)->wdev; in ieee80211_vif_to_wdev()
874 * the suspend->resume cycle. Since we can't check each caller
883 if (local->quiescing || (local->suspended && !local->resuming)) { in ieee80211_can_queue_work()
884 pr_warn("queueing ieee80211 work while going to suspend\n"); in ieee80211_can_queue_work()
898 queue_work(local->workqueue, work); in ieee80211_queue_work()
911 queue_delayed_work(local->workqueue, dwork, delay); in ieee80211_queue_delayed_work()
921 const void *data = elem->data + 1; in ieee80211_parse_extension_element()
925 if (!elem->datalen) in ieee80211_parse_extension_element()
928 len = elem->datalen - 1; in ieee80211_parse_extension_element()
930 switch (elem->data[0]) { in ieee80211_parse_extension_element()
933 if (len >= sizeof(*elems->mu_edca_param_set)) in ieee80211_parse_extension_element()
934 elems->mu_edca_param_set = data; in ieee80211_parse_extension_element()
938 elems->he_cap = data; in ieee80211_parse_extension_element()
939 elems->he_cap_len = len; in ieee80211_parse_extension_element()
944 if (len >= sizeof(*elems->he_operation) && in ieee80211_parse_extension_element()
945 len >= ieee80211_he_oper_size(data) - 1) in ieee80211_parse_extension_element()
946 elems->he_operation = data; in ieee80211_parse_extension_element()
950 elems->uora_element = data; in ieee80211_parse_extension_element()
954 elems->max_channel_switch_time = data; in ieee80211_parse_extension_element()
957 if (len >= sizeof(*elems->mbssid_config_ie)) in ieee80211_parse_extension_element()
958 elems->mbssid_config_ie = data; in ieee80211_parse_extension_element()
961 if (len >= sizeof(*elems->he_spr) && in ieee80211_parse_extension_element()
963 elems->he_spr = data; in ieee80211_parse_extension_element()
966 if (len >= sizeof(*elems->he_6ghz_capa)) in ieee80211_parse_extension_element()
967 elems->he_6ghz_capa = data; in ieee80211_parse_extension_element()
970 if (ieee80211_eht_capa_size_ok(elems->he_cap, in ieee80211_parse_extension_element()
972 params->from_ap)) { in ieee80211_parse_extension_element()
973 elems->eht_cap = data; in ieee80211_parse_extension_element()
974 elems->eht_cap_len = len; in ieee80211_parse_extension_element()
979 elems->eht_operation = data; in ieee80211_parse_extension_element()
989 switch (le16_get_bits(mle->control, in ieee80211_parse_extension_element()
992 elems->ml_basic_elem = (void *)elem; in ieee80211_parse_extension_element()
993 elems->ml_basic = data; in ieee80211_parse_extension_element()
994 elems->ml_basic_len = len; in ieee80211_parse_extension_element()
997 elems->ml_reconf_elem = (void *)elem; in ieee80211_parse_extension_element()
998 elems->ml_reconf = data; in ieee80211_parse_extension_element()
999 elems->ml_reconf_len = len; in ieee80211_parse_extension_element()
1008 elems->bandwidth_indication = data; in ieee80211_parse_extension_element()
1014 elems->ttlm_num < ARRAY_SIZE(elems->ttlm)) { in ieee80211_parse_extension_element()
1015 elems->ttlm[elems->ttlm_num] = (void *)data; in ieee80211_parse_extension_element()
1016 elems->ttlm_num++; in ieee80211_parse_extension_element()
1022 *crc = crc32_be(*crc, (void *)elem, elem->datalen + 2); in ieee80211_parse_extension_element()
1031 bool calc_crc = params->filter != 0; in _ieee802_11_parse_elems_full()
1033 u32 crc = params->crc; in _ieee802_11_parse_elems_full()
1037 for_each_element(elem, params->start, params->len) { in _ieee802_11_parse_elems_full()
1040 u8 id = elem->id; in _ieee802_11_parse_elems_full()
1041 u8 elen = elem->datalen; in _ieee802_11_parse_elems_full()
1042 const u8 *pos = elem->data; in _ieee802_11_parse_elems_full()
1091 * not listing WLAN_EID_CHANNEL_SWITCH_WRAPPER -- it seems possible in _ieee802_11_parse_elems_full()
1095 elems->parse_error = true; in _ieee802_11_parse_elems_full()
1101 if (calc_crc && id < 64 && (params->filter & (1ULL << id))) in _ieee802_11_parse_elems_full()
1102 crc = crc32_be(crc, pos - 2, elen + 2); in _ieee802_11_parse_elems_full()
1112 elems->lnk_id = (void *)(pos - 2); in _ieee802_11_parse_elems_full()
1119 elems->ch_sw_timing = (void *)pos; in _ieee802_11_parse_elems_full()
1122 elems->ext_capab = pos; in _ieee802_11_parse_elems_full()
1123 elems->ext_capab_len = elen; in _ieee802_11_parse_elems_full()
1126 elems->ssid = pos; in _ieee802_11_parse_elems_full()
1127 elems->ssid_len = elen; in _ieee802_11_parse_elems_full()
1130 elems->supp_rates = pos; in _ieee802_11_parse_elems_full()
1131 elems->supp_rates_len = elen; in _ieee802_11_parse_elems_full()
1135 elems->ds_params = pos; in _ieee802_11_parse_elems_full()
1141 elems->tim = (void *)pos; in _ieee802_11_parse_elems_full()
1142 elems->tim_len = elen; in _ieee802_11_parse_elems_full()
1152 crc = crc32_be(crc, pos - 2, elen + 2); in _ieee802_11_parse_elems_full()
1155 /* OUI Type 2 - WMM IE */ in _ieee802_11_parse_elems_full()
1157 elems->wmm_info = pos; in _ieee802_11_parse_elems_full()
1158 elems->wmm_info_len = elen; in _ieee802_11_parse_elems_full()
1160 elems->wmm_param = pos; in _ieee802_11_parse_elems_full()
1161 elems->wmm_param_len = elen; in _ieee802_11_parse_elems_full()
1167 elems->rsn = pos; in _ieee802_11_parse_elems_full()
1168 elems->rsn_len = elen; in _ieee802_11_parse_elems_full()
1172 elems->erp_info = pos; in _ieee802_11_parse_elems_full()
1177 elems->ext_supp_rates = pos; in _ieee802_11_parse_elems_full()
1178 elems->ext_supp_rates_len = elen; in _ieee802_11_parse_elems_full()
1182 elems->ht_cap_elem = (void *)pos; in _ieee802_11_parse_elems_full()
1188 elems->ht_operation = (void *)pos; in _ieee802_11_parse_elems_full()
1194 elems->vht_cap_elem = (void *)pos; in _ieee802_11_parse_elems_full()
1200 elems->vht_operation = (void *)pos; in _ieee802_11_parse_elems_full()
1202 crc = crc32_be(crc, pos - 2, elen + 2); in _ieee802_11_parse_elems_full()
1209 elems->opmode_notif = pos; in _ieee802_11_parse_elems_full()
1211 crc = crc32_be(crc, pos - 2, elen + 2); in _ieee802_11_parse_elems_full()
1217 elems->mesh_id = pos; in _ieee802_11_parse_elems_full()
1218 elems->mesh_id_len = elen; in _ieee802_11_parse_elems_full()
1222 elems->mesh_config = (void *)pos; in _ieee802_11_parse_elems_full()
1227 elems->peering = pos; in _ieee802_11_parse_elems_full()
1228 elems->peering_len = elen; in _ieee802_11_parse_elems_full()
1232 elems->awake_window = (void *)pos; in _ieee802_11_parse_elems_full()
1235 elems->preq = pos; in _ieee802_11_parse_elems_full()
1236 elems->preq_len = elen; in _ieee802_11_parse_elems_full()
1239 elems->prep = pos; in _ieee802_11_parse_elems_full()
1240 elems->prep_len = elen; in _ieee802_11_parse_elems_full()
1243 elems->perr = pos; in _ieee802_11_parse_elems_full()
1244 elems->perr_len = elen; in _ieee802_11_parse_elems_full()
1248 elems->rann = (void *)pos; in _ieee802_11_parse_elems_full()
1257 elems->ch_switch_ie = (void *)pos; in _ieee802_11_parse_elems_full()
1264 elems->ext_chansw_ie = (void *)pos; in _ieee802_11_parse_elems_full()
1271 elems->sec_chan_offs = (void *)pos; in _ieee802_11_parse_elems_full()
1275 sizeof(*elems->mesh_chansw_params_ie)) { in _ieee802_11_parse_elems_full()
1279 elems->mesh_chansw_params_ie = (void *)pos; in _ieee802_11_parse_elems_full()
1282 if (!params->action || in _ieee802_11_parse_elems_full()
1283 elen < sizeof(*elems->wide_bw_chansw_ie)) { in _ieee802_11_parse_elems_full()
1287 elems->wide_bw_chansw_ie = (void *)pos; in _ieee802_11_parse_elems_full()
1290 if (params->action) { in _ieee802_11_parse_elems_full()
1301 if (subelem->datalen >= sizeof(*elems->wide_bw_chansw_ie)) in _ieee802_11_parse_elems_full()
1302 elems->wide_bw_chansw_ie = in _ieee802_11_parse_elems_full()
1303 (void *)subelem->data; in _ieee802_11_parse_elems_full()
1311 const void *edata = subelem->data + 1; in _ieee802_11_parse_elems_full()
1312 u8 edatalen = subelem->datalen - 1; in _ieee802_11_parse_elems_full()
1316 elems->bandwidth_indication = edata; in _ieee802_11_parse_elems_full()
1322 elems->country_elem = pos; in _ieee802_11_parse_elems_full()
1323 elems->country_elem_len = elen; in _ieee802_11_parse_elems_full()
1330 elems->pwr_constr_elem = pos; in _ieee802_11_parse_elems_full()
1353 crc = crc32_be(crc, pos - 2, elen + 2); in _ieee802_11_parse_elems_full()
1355 elems->cisco_dtpc_elem = pos; in _ieee802_11_parse_elems_full()
1362 elems->addba_ext_ie = (void *)pos; in _ieee802_11_parse_elems_full()
1366 elems->timeout_int = (void *)pos; in _ieee802_11_parse_elems_full()
1371 if (elen >= sizeof(*elems->max_idle_period_ie)) in _ieee802_11_parse_elems_full()
1372 elems->max_idle_period_ie = (void *)pos; in _ieee802_11_parse_elems_full()
1375 elems->rsnx = pos; in _ieee802_11_parse_elems_full()
1376 elems->rsnx_len = elen; in _ieee802_11_parse_elems_full()
1383 if (elems->tx_pwr_env_num >= ARRAY_SIZE(elems->tx_pwr_env)) in _ieee802_11_parse_elems_full()
1386 elems->tx_pwr_env[elems->tx_pwr_env_num] = (void *)pos; in _ieee802_11_parse_elems_full()
1387 elems->tx_pwr_env_len[elems->tx_pwr_env_num] = elen; in _ieee802_11_parse_elems_full()
1388 elems->tx_pwr_env_num++; in _ieee802_11_parse_elems_full()
1396 if (elen >= sizeof(*elems->s1g_capab)) in _ieee802_11_parse_elems_full()
1397 elems->s1g_capab = (void *)pos; in _ieee802_11_parse_elems_full()
1402 if (elen == sizeof(*elems->s1g_oper)) in _ieee802_11_parse_elems_full()
1403 elems->s1g_oper = (void *)pos; in _ieee802_11_parse_elems_full()
1408 if (elen == sizeof(*elems->s1g_bcn_compat)) in _ieee802_11_parse_elems_full()
1409 elems->s1g_bcn_compat = (void *)pos; in _ieee802_11_parse_elems_full()
1415 elems->aid_resp = (void *)pos; in _ieee802_11_parse_elems_full()
1424 elems->parse_error = true; in _ieee802_11_parse_elems_full()
1429 if (!for_each_element_completed(elem, params->start, params->len)) in _ieee802_11_parse_elems_full()
1430 elems->parse_error = true; in _ieee802_11_parse_elems_full()
1444 if (!bss || !bss->transmitted_bss) in ieee802_11_find_bssid_profile()
1448 if (elem->datalen < 2) in ieee802_11_find_bssid_profile()
1450 if (elem->data[0] < 1 || elem->data[0] > 8) in ieee802_11_find_bssid_profile()
1453 for_each_element(sub, elem->data + 1, elem->datalen - 1) { in ieee802_11_find_bssid_profile()
1457 if (sub->id != 0 || sub->datalen < 4) { in ieee802_11_find_bssid_profile()
1462 if (sub->data[0] != WLAN_EID_NON_TX_BSSID_CAP || in ieee802_11_find_bssid_profile()
1463 sub->data[1] != 2) { in ieee802_11_find_bssid_profile()
1488 cfg80211_gen_new_bssid(bss->transmitted_bss->bssid, in ieee802_11_find_bssid_profile()
1489 elem->data[0], in ieee802_11_find_bssid_profile()
1492 if (ether_addr_equal(new_bssid, bss->bssid)) { in ieee802_11_find_bssid_profile()
1494 elems->bssid_index_len = index[1]; in ieee802_11_find_bssid_profile()
1495 elems->bssid_index = (void *)&index[2]; in ieee802_11_find_bssid_profile()
1507 const struct ieee80211_multi_link_elem *ml = elems->ml_basic; in ieee80211_mle_get_sta_prof()
1508 ssize_t ml_len = elems->ml_basic_len; in ieee80211_mle_get_sta_prof()
1514 if (le16_get_bits(ml->control, IEEE80211_ML_CONTROL_TYPE) != in ieee80211_mle_get_sta_prof()
1519 struct ieee80211_mle_per_sta_profile *prof = (void *)sub->data; in ieee80211_mle_get_sta_prof()
1523 if (sub->id != IEEE80211_MLE_SUBELEM_PER_STA_PROFILE) in ieee80211_mle_get_sta_prof()
1526 if (!ieee80211_mle_basic_sta_prof_size_ok(sub->data, in ieee80211_mle_get_sta_prof()
1527 sub->datalen)) in ieee80211_mle_get_sta_prof()
1530 control = le16_to_cpu(prof->control); in ieee80211_mle_get_sta_prof()
1543 elems->scratch_pos, in ieee80211_mle_get_sta_prof()
1544 elems->scratch + in ieee80211_mle_get_sta_prof()
1545 elems->scratch_len - in ieee80211_mle_get_sta_prof()
1546 elems->scratch_pos, in ieee80211_mle_get_sta_prof()
1552 elems->prof = (void *)elems->scratch_pos; in ieee80211_mle_get_sta_prof()
1553 elems->sta_prof_len = sta_prof_len; in ieee80211_mle_get_sta_prof()
1554 elems->scratch_pos += sta_prof_len; in ieee80211_mle_get_sta_prof()
1565 .action = params->action, in ieee80211_mle_parse_link()
1566 .from_ap = params->from_ap, in ieee80211_mle_parse_link()
1567 .link_id = -1, in ieee80211_mle_parse_link()
1569 ssize_t ml_len = elems->ml_basic_len; in ieee80211_mle_parse_link()
1573 if (params->link_id == -1) in ieee80211_mle_parse_link()
1576 ml_len = cfg80211_defragment_element(elems->ml_basic_elem, in ieee80211_mle_parse_link()
1577 elems->ie_start, in ieee80211_mle_parse_link()
1578 elems->total_len, in ieee80211_mle_parse_link()
1579 elems->scratch_pos, in ieee80211_mle_parse_link()
1580 elems->scratch + in ieee80211_mle_parse_link()
1581 elems->scratch_len - in ieee80211_mle_parse_link()
1582 elems->scratch_pos, in ieee80211_mle_parse_link()
1588 elems->ml_basic = (const void *)elems->scratch_pos; in ieee80211_mle_parse_link()
1589 elems->ml_basic_len = ml_len; in ieee80211_mle_parse_link()
1591 ieee80211_mle_get_sta_prof(elems, params->link_id); in ieee80211_mle_parse_link()
1592 prof = elems->prof; in ieee80211_mle_parse_link()
1598 if (elems->sta_prof_len < sizeof(*prof) + prof->sta_info_len - 1 + 4) { in ieee80211_mle_parse_link()
1599 elems->prof = NULL; in ieee80211_mle_parse_link()
1600 elems->sta_prof_len = 0; in ieee80211_mle_parse_link()
1607 * the -1 is because the 'sta_info_len' is accounted to as part of the in ieee80211_mle_parse_link()
1608 * per-STA profile, but not part of the 'u8 variable[]' portion. in ieee80211_mle_parse_link()
1610 sub.start = prof->variable + prof->sta_info_len - 1 + 4; in ieee80211_mle_parse_link()
1611 end = (const u8 *)prof + elems->sta_prof_len; in ieee80211_mle_parse_link()
1612 sub.len = end - sub.start; in ieee80211_mle_parse_link()
1626 size_t scratch_len = 3 * params->len; in ieee802_11_parse_elems_full()
1631 elems->ie_start = params->start; in ieee802_11_parse_elems_full()
1632 elems->total_len = params->len; in ieee802_11_parse_elems_full()
1633 elems->scratch_len = scratch_len; in ieee802_11_parse_elems_full()
1634 elems->scratch_pos = elems->scratch; in ieee802_11_parse_elems_full()
1636 nontransmitted_profile = elems->scratch_pos; in ieee802_11_parse_elems_full()
1638 ieee802_11_find_bssid_profile(params->start, params->len, in ieee802_11_parse_elems_full()
1639 elems, params->bss, in ieee802_11_parse_elems_full()
1641 elems->scratch_pos += nontransmitted_profile_len; in ieee802_11_parse_elems_full()
1642 elems->scratch_len -= nontransmitted_profile_len; in ieee802_11_parse_elems_full()
1647 elems->crc = _ieee802_11_parse_elems_full(params, elems, non_inherit); in ieee802_11_parse_elems_full()
1654 .action = params->action, in ieee802_11_parse_elems_full()
1655 .link_id = params->link_id, in ieee802_11_parse_elems_full()
1663 if (elems->tim && !elems->parse_error) { in ieee802_11_parse_elems_full()
1664 const struct ieee80211_tim_ie *tim_ie = elems->tim; in ieee802_11_parse_elems_full()
1666 elems->dtim_period = tim_ie->dtim_period; in ieee802_11_parse_elems_full()
1667 elems->dtim_count = tim_ie->dtim_count; in ieee802_11_parse_elems_full()
1671 if (elems->bssid_index && in ieee802_11_parse_elems_full()
1672 elems->bssid_index_len >= in ieee802_11_parse_elems_full()
1674 elems->dtim_period = elems->bssid_index->dtim_period; in ieee802_11_parse_elems_full()
1676 if (elems->bssid_index && in ieee802_11_parse_elems_full()
1677 elems->bssid_index_len >= in ieee802_11_parse_elems_full()
1679 elems->dtim_count = elems->bssid_index->dtim_count; in ieee802_11_parse_elems_full()
1694 if (sdata->vif.type != NL80211_IFTYPE_AP && in ieee80211_regulatory_limit_wmm_params()
1695 sdata->vif.type != NL80211_IFTYPE_STATION) in ieee80211_regulatory_limit_wmm_params()
1699 chanctx_conf = rcu_dereference(sdata->vif.bss_conf.chanctx_conf); in ieee80211_regulatory_limit_wmm_params()
1701 center_freq = chanctx_conf->def.chan->center_freq; in ieee80211_regulatory_limit_wmm_params()
1708 rrule = freq_reg_info(sdata->wdev.wiphy, MHZ_TO_KHZ(center_freq)); in ieee80211_regulatory_limit_wmm_params()
1710 if (IS_ERR_OR_NULL(rrule) || !rrule->has_wmm) { in ieee80211_regulatory_limit_wmm_params()
1715 if (sdata->vif.type == NL80211_IFTYPE_AP) in ieee80211_regulatory_limit_wmm_params()
1716 wmm_ac = &rrule->wmm_rule.ap[ac]; in ieee80211_regulatory_limit_wmm_params()
1718 wmm_ac = &rrule->wmm_rule.client[ac]; in ieee80211_regulatory_limit_wmm_params()
1719 qparam->cw_min = max_t(u16, qparam->cw_min, wmm_ac->cw_min); in ieee80211_regulatory_limit_wmm_params()
1720 qparam->cw_max = max_t(u16, qparam->cw_max, wmm_ac->cw_max); in ieee80211_regulatory_limit_wmm_params()
1721 qparam->aifs = max_t(u8, qparam->aifs, wmm_ac->aifsn); in ieee80211_regulatory_limit_wmm_params()
1722 qparam->txop = min_t(u16, qparam->txop, wmm_ac->cot / 32); in ieee80211_regulatory_limit_wmm_params()
1729 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_set_wmm_default()
1730 struct ieee80211_local *local = sdata->local; in ieee80211_set_wmm_default()
1738 if (!local->ops->conf_tx) in ieee80211_set_wmm_default()
1741 if (local->hw.queues < IEEE80211_NUM_ACS) in ieee80211_set_wmm_default()
1747 chanctx_conf = rcu_dereference(link->conf->chanctx_conf); in ieee80211_set_wmm_default()
1749 chanctx_conf->def.chan->band == NL80211_BAND_2GHZ) && in ieee80211_set_wmm_default()
1750 !link->operating_11g_mode; in ieee80211_set_wmm_default()
1753 is_ocb = (sdata->vif.type == NL80211_IFTYPE_OCB); in ieee80211_set_wmm_default()
1755 /* Set defaults according to 802.11-2007 Table 7-37 */ in ieee80211_set_wmm_default()
1794 qparam.cw_min = (aCWmin + 1) / 2 - 1; in ieee80211_set_wmm_default()
1808 qparam.cw_max = (aCWmin + 1) / 2 - 1; in ieee80211_set_wmm_default()
1809 qparam.cw_min = (aCWmin + 1) / 4 - 1; in ieee80211_set_wmm_default()
1824 link->tx_conf[ac] = qparam; in ieee80211_set_wmm_default()
1828 if (sdata->vif.type != NL80211_IFTYPE_MONITOR && in ieee80211_set_wmm_default()
1829 sdata->vif.type != NL80211_IFTYPE_P2P_DEVICE && in ieee80211_set_wmm_default()
1830 sdata->vif.type != NL80211_IFTYPE_NAN) { in ieee80211_set_wmm_default()
1831 link->conf->qos = enable_qos; in ieee80211_set_wmm_default()
1844 struct ieee80211_local *local = sdata->local; in ieee80211_send_auth()
1847 bool multi_link = ieee80211_vif_is_mld(&sdata->vif); in ieee80211_send_auth()
1856 .len = sizeof(mle) - 2, in ieee80211_send_auth()
1863 memcpy(mle.basic.mld_mac_addr, sdata->vif.addr, ETH_ALEN); in ieee80211_send_auth()
1866 skb = dev_alloc_skb(local->hw.extra_tx_headroom + IEEE80211_WEP_IV_LEN + in ieee80211_send_auth()
1872 skb_reserve(skb, local->hw.extra_tx_headroom + IEEE80211_WEP_IV_LEN); in ieee80211_send_auth()
1875 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | in ieee80211_send_auth()
1877 memcpy(mgmt->da, da, ETH_ALEN); in ieee80211_send_auth()
1878 memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); in ieee80211_send_auth()
1879 memcpy(mgmt->bssid, bssid, ETH_ALEN); in ieee80211_send_auth()
1880 mgmt->u.auth.auth_alg = cpu_to_le16(auth_alg); in ieee80211_send_auth()
1881 mgmt->u.auth.auth_transaction = cpu_to_le16(transaction); in ieee80211_send_auth()
1882 mgmt->u.auth.status_code = cpu_to_le16(status); in ieee80211_send_auth()
1889 mgmt->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); in ieee80211_send_auth()
1897 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT | in ieee80211_send_auth()
1907 struct ieee80211_local *local = sdata->local; in ieee80211_send_deauth_disassoc()
1912 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | stype); in ieee80211_send_deauth_disassoc()
1913 mgmt->duration = 0; /* initialize only */ in ieee80211_send_deauth_disassoc()
1914 mgmt->seq_ctrl = 0; /* initialize only */ in ieee80211_send_deauth_disassoc()
1915 memcpy(mgmt->da, da, ETH_ALEN); in ieee80211_send_deauth_disassoc()
1916 memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); in ieee80211_send_deauth_disassoc()
1917 memcpy(mgmt->bssid, bssid, ETH_ALEN); in ieee80211_send_deauth_disassoc()
1919 mgmt->u.deauth.reason_code = cpu_to_le16(reason); in ieee80211_send_deauth_disassoc()
1922 skb = dev_alloc_skb(local->hw.extra_tx_headroom + in ieee80211_send_deauth_disassoc()
1927 skb_reserve(skb, local->hw.extra_tx_headroom); in ieee80211_send_deauth_disassoc()
1932 if (sdata->vif.type != NL80211_IFTYPE_STATION || in ieee80211_send_deauth_disassoc()
1933 !(sdata->u.mgd.flags & IEEE80211_STA_MFP_ENABLED)) in ieee80211_send_deauth_disassoc()
1934 IEEE80211_SKB_CB(skb)->flags |= in ieee80211_send_deauth_disassoc()
1943 if ((end - pos) < 5) in ieee80211_write_he_6ghz_cap()
1962 struct ieee80211_local *local = sdata->local; in ieee80211_build_preq_ies_band()
1977 sband = local->hw.wiphy->bands[band]; in ieee80211_build_preq_ies_band()
1985 if (end - pos < 2 + sizeof(struct ieee80211_s1g_cap)) in ieee80211_build_preq_ies_band()
1987 pos = ieee80211_ie_build_s1g_cap(pos, &sband->s1g_cap); in ieee80211_build_preq_ies_band()
1992 for (i = 0; i < sband->n_bitrates; i++) { in ieee80211_build_preq_ies_band()
1995 if ((rate_flags & sband->bitrates[i].flags) != rate_flags) in ieee80211_build_preq_ies_band()
1999 (u8) DIV_ROUND_UP(sband->bitrates[i].bitrate, 5); in ieee80211_build_preq_ies_band()
2004 if (end - pos < 2 + supp_rates_len) in ieee80211_build_preq_ies_band()
2022 if (end - pos < noffset - *offset) in ieee80211_build_preq_ies_band()
2024 memcpy(pos, ie + *offset, noffset - *offset); in ieee80211_build_preq_ies_band()
2025 pos += noffset - *offset; in ieee80211_build_preq_ies_band()
2029 ext_rates_len = num_rates - supp_rates_len; in ieee80211_build_preq_ies_band()
2031 if (end - pos < 2 + ext_rates_len) in ieee80211_build_preq_ies_band()
2039 if (chandef->chan && sband->band == NL80211_BAND_2GHZ) { in ieee80211_build_preq_ies_band()
2040 if (end - pos < 3) in ieee80211_build_preq_ies_band()
2045 chandef->chan->center_freq); in ieee80211_build_preq_ies_band()
2064 if (end - pos < noffset - *offset) in ieee80211_build_preq_ies_band()
2066 memcpy(pos, ie + *offset, noffset - *offset); in ieee80211_build_preq_ies_band()
2067 pos += noffset - *offset; in ieee80211_build_preq_ies_band()
2071 if (sband->ht_cap.ht_supported) { in ieee80211_build_preq_ies_band()
2072 if (end - pos < 2 + sizeof(struct ieee80211_ht_cap)) in ieee80211_build_preq_ies_band()
2074 pos = ieee80211_ie_build_ht_cap(pos, &sband->ht_cap, in ieee80211_build_preq_ies_band()
2075 sband->ht_cap.cap); in ieee80211_build_preq_ies_band()
2091 /* 60 GHz (Multi-band, DMG, MMS) can't happen */ in ieee80211_build_preq_ies_band()
2096 if (end - pos < noffset - *offset) in ieee80211_build_preq_ies_band()
2098 memcpy(pos, ie + *offset, noffset - *offset); in ieee80211_build_preq_ies_band()
2099 pos += noffset - *offset; in ieee80211_build_preq_ies_band()
2104 for (i = 0; i < sband->n_channels; i++) { in ieee80211_build_preq_ies_band()
2105 if (sband->channels[i].flags & (IEEE80211_CHAN_DISABLED | in ieee80211_build_preq_ies_band()
2113 if (sband->vht_cap.vht_supported && have_80mhz) { in ieee80211_build_preq_ies_band()
2114 if (end - pos < 2 + sizeof(struct ieee80211_vht_cap)) in ieee80211_build_preq_ies_band()
2116 pos = ieee80211_ie_build_vht_cap(pos, &sband->vht_cap, in ieee80211_build_preq_ies_band()
2117 sband->vht_cap.cap); in ieee80211_build_preq_ies_band()
2134 if (end - pos < noffset - *offset) in ieee80211_build_preq_ies_band()
2136 memcpy(pos, ie + *offset, noffset - *offset); in ieee80211_build_preq_ies_band()
2137 pos += noffset - *offset; in ieee80211_build_preq_ies_band()
2141 he_cap = ieee80211_get_he_iftype_cap_vif(sband, &sdata->vif); in ieee80211_build_preq_ies_band()
2143 cfg80211_any_usable_channels(local->hw.wiphy, BIT(sband->band), in ieee80211_build_preq_ies_band()
2150 eht_cap = ieee80211_get_eht_iftype_cap_vif(sband, &sdata->vif); in ieee80211_build_preq_ies_band()
2153 cfg80211_any_usable_channels(local->hw.wiphy, BIT(sband->band), in ieee80211_build_preq_ies_band()
2157 sdata->vif.type == NL80211_IFTYPE_AP); in ieee80211_build_preq_ies_band()
2162 if (cfg80211_any_usable_channels(local->hw.wiphy, in ieee80211_build_preq_ies_band()
2167 sband6 = local->hw.wiphy->bands[NL80211_BAND_6GHZ]; in ieee80211_build_preq_ies_band()
2168 he_cap = ieee80211_get_he_iftype_cap_vif(sband6, &sdata->vif); in ieee80211_build_preq_ies_band()
2172 ieee80211_vif_type_p2p(&sdata->vif); in ieee80211_build_preq_ies_band()
2181 * that calculates local->scan_ies_len. in ieee80211_build_preq_ies_band()
2184 return pos - buffer; in ieee80211_build_preq_ies_band()
2188 return pos - buffer; in ieee80211_build_preq_ies_band()
2208 buffer_len - pos, in ieee80211_build_preq_ies()
2214 ie_desc->ies[i] = buffer + old_pos; in ieee80211_build_preq_ies()
2215 ie_desc->len[i] = pos - old_pos; in ieee80211_build_preq_ies()
2222 if (WARN_ONCE(buffer_len - pos < ie_len - custom_ie_offset, in ieee80211_build_preq_ies()
2226 ie_len - custom_ie_offset); in ieee80211_build_preq_ies()
2227 ie_desc->common_ies = buffer + pos; in ieee80211_build_preq_ies()
2228 ie_desc->common_ie_len = ie_len - custom_ie_offset; in ieee80211_build_preq_ies()
2229 pos += ie_len - custom_ie_offset; in ieee80211_build_preq_ies()
2243 struct ieee80211_local *local = sdata->local; in ieee80211_build_probe_req()
2254 * badly-behaved APs don't respond when this parameter is included. in ieee80211_build_probe_req()
2256 chandef.width = sdata->vif.bss_conf.chandef.width; in ieee80211_build_probe_req()
2262 skb = ieee80211_probereq_get(&local->hw, src, ssid, ssid_len, in ieee80211_build_probe_req()
2263 local->scan_ies_len + ie_len); in ieee80211_build_probe_req()
2267 rate_masks[chan->band] = ratemask; in ieee80211_build_probe_req()
2270 ie, ie_len, BIT(chan->band), in ieee80211_build_probe_req()
2275 mgmt = (struct ieee80211_mgmt *) skb->data; in ieee80211_build_probe_req()
2276 memcpy(mgmt->da, dst, ETH_ALEN); in ieee80211_build_probe_req()
2277 memcpy(mgmt->bssid, dst, ETH_ALEN); in ieee80211_build_probe_req()
2280 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; in ieee80211_build_probe_req()
2294 sband = sdata->local->hw.wiphy->bands[band]; in ieee80211_sta_get_rates()
2298 rate_flags = ieee80211_chandef_rate_flags(&sdata->vif.bss_conf.chandef); in ieee80211_sta_get_rates()
2300 num_rates = sband->n_bitrates; in ieee80211_sta_get_rates()
2302 for (i = 0; i < elems->supp_rates_len + in ieee80211_sta_get_rates()
2303 elems->ext_supp_rates_len; i++) { in ieee80211_sta_get_rates()
2307 if (i < elems->supp_rates_len) in ieee80211_sta_get_rates()
2308 rate = elems->supp_rates[i]; in ieee80211_sta_get_rates()
2309 else if (elems->ext_supp_rates) in ieee80211_sta_get_rates()
2310 rate = elems->ext_supp_rates in ieee80211_sta_get_rates()
2311 [i - elems->supp_rates_len]; in ieee80211_sta_get_rates()
2320 if ((rate_flags & sband->bitrates[j].flags) in ieee80211_sta_get_rates()
2324 brate = sband->bitrates[j].bitrate; in ieee80211_sta_get_rates()
2341 wiphy_work_cancel(local->hw.wiphy, &local->reconfig_filter); in ieee80211_stop_device()
2343 flush_workqueue(local->workqueue); in ieee80211_stop_device()
2344 wiphy_work_flush(local->hw.wiphy, NULL); in ieee80211_stop_device()
2358 if (test_bit(SCAN_COMPLETED, &local->scanning)) { in ieee80211_flush_completed_scan()
2360 * we don't attempt to continue a partial HW scan - which is in ieee80211_flush_completed_scan()
2365 set_bit(SCAN_ABORTED, &local->scanning); in ieee80211_flush_completed_scan()
2366 wiphy_delayed_work_queue(local->hw.wiphy, &local->scan_work, 0); in ieee80211_flush_completed_scan()
2367 wiphy_delayed_work_flush(local->hw.wiphy, &local->scan_work); in ieee80211_flush_completed_scan()
2376 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_handle_reconfig_failure()
2388 local->resuming = false; in ieee80211_handle_reconfig_failure()
2389 local->suspended = false; in ieee80211_handle_reconfig_failure()
2390 local->in_reconfig = false; in ieee80211_handle_reconfig_failure()
2391 local->reconfig_failure = true; in ieee80211_handle_reconfig_failure()
2400 list_for_each_entry(sdata, &local->interfaces, list) in ieee80211_handle_reconfig_failure()
2401 sdata->flags &= ~IEEE80211_SDATA_IN_DRIVER; in ieee80211_handle_reconfig_failure()
2406 list_for_each_entry(ctx, &local->chanctx_list, list) in ieee80211_handle_reconfig_failure()
2407 ctx->driver_present = false; in ieee80211_handle_reconfig_failure()
2417 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_assign_chanctx()
2419 if (!local->use_chanctx) in ieee80211_assign_chanctx()
2422 conf = rcu_dereference_protected(link->conf->chanctx_conf, in ieee80211_assign_chanctx()
2423 lockdep_is_held(&local->hw.wiphy->mtx)); in ieee80211_assign_chanctx()
2426 drv_assign_vif_chanctx(local, sdata, link->conf, ctx); in ieee80211_assign_chanctx()
2432 struct ieee80211_local *local = sdata->local; in ieee80211_reconfig_stations()
2435 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_reconfig_stations()
2438 list_for_each_entry(sta, &local->sta_list, list) { in ieee80211_reconfig_stations()
2441 if (!sta->uploaded || sta->sdata != sdata) in ieee80211_reconfig_stations()
2445 state < sta->sta_state; state++) in ieee80211_reconfig_stations()
2446 WARN_ON(drv_sta_state(local, sta->sdata, sta, state, in ieee80211_reconfig_stations()
2456 res = drv_start_nan(sdata->local, sdata, in ieee80211_reconfig_nan()
2457 &sdata->u.nan.conf); in ieee80211_reconfig_nan()
2461 funcs = kcalloc(sdata->local->hw.max_nan_de_entries + 1, in ieee80211_reconfig_nan()
2465 return -ENOMEM; in ieee80211_reconfig_nan()
2471 spin_lock_bh(&sdata->u.nan.func_lock); in ieee80211_reconfig_nan()
2473 idr_for_each_entry(&sdata->u.nan.function_inst_ids, func, id) in ieee80211_reconfig_nan()
2476 spin_unlock_bh(&sdata->u.nan.func_lock); in ieee80211_reconfig_nan()
2479 res = drv_add_nan_func(sdata->local, sdata, funcs[i]); in ieee80211_reconfig_nan()
2481 ieee80211_nan_func_terminated(&sdata->vif, in ieee80211_reconfig_nan()
2482 funcs[i]->instance_id, in ieee80211_reconfig_nan()
2498 for (link_id = 0; link_id < ARRAY_SIZE(sdata->link); link_id++) { in ieee80211_reconfig_ap_links()
2501 if (!(sdata->vif.active_links & BIT(link_id))) in ieee80211_reconfig_ap_links()
2504 link = sdata_dereference(sdata->link[link_id], sdata); in ieee80211_reconfig_ap_links()
2508 if (rcu_access_pointer(link->u.ap.beacon)) in ieee80211_reconfig_ap_links()
2509 drv_start_ap(local, sdata, link->conf); in ieee80211_reconfig_ap_links()
2511 if (!link->conf->enable_beacon) in ieee80211_reconfig_ap_links()
2523 struct ieee80211_hw *hw = &local->hw; in ieee80211_reconfig()
2532 bool suspended = local->suspended; in ieee80211_reconfig()
2535 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_reconfig()
2538 if (!local->open_count) in ieee80211_reconfig()
2543 local->resuming = true; in ieee80211_reconfig()
2545 if (local->wowlan) { in ieee80211_reconfig()
2549 * clear local->suspended so the device could operate in ieee80211_reconfig()
2552 local->suspended = false; in ieee80211_reconfig()
2554 local->wowlan = false; in ieee80211_reconfig()
2556 local->resuming = false; in ieee80211_reconfig()
2565 * restore local->suspended in this case. in ieee80211_reconfig()
2568 local->suspended = true; in ieee80211_reconfig()
2579 if (suspended && local->in_reconfig && !reconfig_due_to_wowlan) in ieee80211_reconfig()
2580 cancel_work_sync(&local->restart_work); in ieee80211_reconfig()
2582 local->started = false; in ieee80211_reconfig()
2601 drv_set_frag_threshold(local, hw->wiphy->frag_threshold); in ieee80211_reconfig()
2604 drv_set_rts_threshold(local, hw->wiphy->rts_threshold); in ieee80211_reconfig()
2607 drv_set_coverage_class(local, hw->wiphy->coverage_class); in ieee80211_reconfig()
2614 sdata = wiphy_dereference(local->hw.wiphy, local->monitor_sdata); in ieee80211_reconfig()
2617 WARN_ON(local->resuming); in ieee80211_reconfig()
2620 RCU_INIT_POINTER(local->monitor_sdata, NULL); in ieee80211_reconfig()
2626 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_reconfig()
2627 if (sdata->vif.type != NL80211_IFTYPE_AP_VLAN && in ieee80211_reconfig()
2628 sdata->vif.type != NL80211_IFTYPE_MONITOR && in ieee80211_reconfig()
2640 list_for_each_entry_continue_reverse(sdata, &local->interfaces, in ieee80211_reconfig()
2642 if (sdata->vif.type != NL80211_IFTYPE_AP_VLAN && in ieee80211_reconfig()
2643 sdata->vif.type != NL80211_IFTYPE_MONITOR && in ieee80211_reconfig()
2651 if (local->use_chanctx) { in ieee80211_reconfig()
2652 list_for_each_entry(ctx, &local->chanctx_list, list) in ieee80211_reconfig()
2653 if (ctx->replace_state != in ieee80211_reconfig()
2657 sdata = wiphy_dereference(local->hw.wiphy, in ieee80211_reconfig()
2658 local->monitor_sdata); in ieee80211_reconfig()
2660 ieee80211_assign_chanctx(local, sdata, &sdata->deflink); in ieee80211_reconfig()
2669 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_reconfig()
2670 /* common change flags for all interface types - link only */ in ieee80211_reconfig()
2689 if (ieee80211_vif_is_mld(&sdata->vif)) { in ieee80211_reconfig()
2691 [0] = &sdata->vif.bss_conf, in ieee80211_reconfig()
2694 if (sdata->vif.type == NL80211_IFTYPE_STATION) { in ieee80211_reconfig()
2696 active_links = sdata->vif.active_links; in ieee80211_reconfig()
2697 link_id = ffs(active_links) - 1; in ieee80211_reconfig()
2698 sdata->vif.active_links = BIT(link_id); in ieee80211_reconfig()
2702 sdata->vif.active_links, in ieee80211_reconfig()
2707 link_id < ARRAY_SIZE(sdata->vif.link_conf); in ieee80211_reconfig()
2709 if (ieee80211_vif_is_mld(&sdata->vif) && in ieee80211_reconfig()
2710 !(sdata->vif.active_links & BIT(link_id))) in ieee80211_reconfig()
2713 link = sdata_dereference(sdata->link[link_id], sdata); in ieee80211_reconfig()
2720 switch (sdata->vif.type) { in ieee80211_reconfig()
2725 if (sdata->vif.cfg.ibss_joined) in ieee80211_reconfig()
2733 drv_conf_tx(local, &sdata->deflink, i, in ieee80211_reconfig()
2734 &sdata->deflink.tx_conf[i]); in ieee80211_reconfig()
2738 if (sdata->vif.bss_conf.mu_mimo_owner) in ieee80211_reconfig()
2741 if (!ieee80211_vif_is_mld(&sdata->vif)) in ieee80211_reconfig()
2744 switch (sdata->vif.type) { in ieee80211_reconfig()
2746 if (!ieee80211_vif_is_mld(&sdata->vif)) { in ieee80211_reconfig()
2751 /* Re-send beacon info report to the driver */ in ieee80211_reconfig()
2752 if (sdata->deflink.u.mgd.have_beacon) in ieee80211_reconfig()
2755 if (sdata->vif.bss_conf.max_idle_period || in ieee80211_reconfig()
2756 sdata->vif.bss_conf.protected_keep_alive) in ieee80211_reconfig()
2759 if (sdata->vif.bss_conf.eht_puncturing) in ieee80211_reconfig()
2784 if (ieee80211_vif_is_mld(&sdata->vif)) in ieee80211_reconfig()
2790 if (sdata->vif.bss_conf.ftm_responder == 1 && in ieee80211_reconfig()
2791 wiphy_ext_feature_isset(sdata->local->hw.wiphy, in ieee80211_reconfig()
2795 if (sdata->vif.type == NL80211_IFTYPE_AP) { in ieee80211_reconfig()
2798 if (ieee80211_vif_is_mld(&sdata->vif)) { in ieee80211_reconfig()
2805 if (rcu_access_pointer(sdata->deflink.u.ap.beacon)) in ieee80211_reconfig()
2807 sdata->deflink.conf); in ieee80211_reconfig()
2811 if (sdata->vif.bss_conf.enable_beacon) { in ieee80211_reconfig()
2839 ieee80211_set_active_links(&sdata->vif, active_links); in ieee80211_reconfig()
2850 if (!(local->hw.conf.flags & IEEE80211_CONF_PS)) { in ieee80211_reconfig()
2851 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_reconfig()
2852 if (sdata->vif.type != NL80211_IFTYPE_STATION) in ieee80211_reconfig()
2854 if (!sdata->u.mgd.associated) in ieee80211_reconfig()
2862 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_reconfig()
2866 switch (sdata->vif.type) { in ieee80211_reconfig()
2877 list_for_each_entry(sdata, &local->interfaces, list) in ieee80211_reconfig()
2881 sched_scan_sdata = rcu_dereference_protected(local->sched_scan_sdata, in ieee80211_reconfig()
2882 lockdep_is_held(&local->hw.wiphy->mtx)); in ieee80211_reconfig()
2883 sched_scan_req = rcu_dereference_protected(local->sched_scan_req, in ieee80211_reconfig()
2884 lockdep_is_held(&local->hw.wiphy->mtx)); in ieee80211_reconfig()
2893 if (sched_scan_req->n_scan_plans > 1 || in ieee80211_reconfig()
2896 RCU_INIT_POINTER(local->sched_scan_sdata, NULL); in ieee80211_reconfig()
2897 RCU_INIT_POINTER(local->sched_scan_req, NULL); in ieee80211_reconfig()
2902 cfg80211_sched_scan_stopped_locked(local->hw.wiphy, 0); in ieee80211_reconfig()
2906 if (local->monitors == local->open_count && local->monitors > 0) in ieee80211_reconfig()
2920 list_for_each_entry(sta, &local->sta_list, list) { in ieee80211_reconfig()
2921 if (!local->resuming) in ieee80211_reconfig()
2932 if (local->open_count && (!suspended || reconfig_due_to_wowlan)) in ieee80211_reconfig()
2935 if (local->in_reconfig) { in ieee80211_reconfig()
2936 in_reconfig = local->in_reconfig; in ieee80211_reconfig()
2937 local->in_reconfig = false; in ieee80211_reconfig()
2944 list_for_each_entry(sdata, &local->interfaces, list) in ieee80211_reconfig()
2945 wiphy_work_queue(local->hw.wiphy, &sdata->work); in ieee80211_reconfig()
2953 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_reconfig()
2956 if (sdata->vif.type == NL80211_IFTYPE_STATION) in ieee80211_reconfig()
2966 local->suspended = false; in ieee80211_reconfig()
2968 local->resuming = false; in ieee80211_reconfig()
2972 if (local->open_count && !reconfig_due_to_wowlan) in ieee80211_reconfig()
2975 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_reconfig()
2978 if (sdata->vif.type == NL80211_IFTYPE_STATION) in ieee80211_reconfig()
2982 mod_timer(&local->sta_cleanup, jiffies + 1); in ieee80211_reconfig()
3000 local = sdata->local; in ieee80211_reconfig_disconnect()
3002 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_reconfig_disconnect()
3005 !local->resuming)) in ieee80211_reconfig_disconnect()
3009 !local->in_reconfig)) in ieee80211_reconfig_disconnect()
3012 if (WARN_ON(vif->type != NL80211_IFTYPE_STATION)) in ieee80211_reconfig_disconnect()
3015 sdata->flags |= flag; in ieee80211_reconfig_disconnect()
3017 list_for_each_entry(key, &sdata->key_list, list) in ieee80211_reconfig_disconnect()
3018 key->flags |= KEY_FLAG_TAINTED; in ieee80211_reconfig_disconnect()
3036 struct ieee80211_local *local = sdata->local; in ieee80211_recalc_smps()
3040 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_recalc_smps()
3042 chanctx_conf = rcu_dereference_protected(link->conf->chanctx_conf, in ieee80211_recalc_smps()
3043 lockdep_is_held(&local->hw.wiphy->mtx)); in ieee80211_recalc_smps()
3061 struct ieee80211_local *local = sdata->local; in ieee80211_recalc_min_chandef()
3066 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_recalc_min_chandef()
3068 for (i = 0; i < ARRAY_SIZE(sdata->vif.link_conf); i++) { in ieee80211_recalc_min_chandef()
3075 bss_conf = rcu_dereference(sdata->vif.link_conf[i]); in ieee80211_recalc_min_chandef()
3081 chanctx_conf = rcu_dereference_protected(bss_conf->chanctx_conf, in ieee80211_recalc_min_chandef()
3082 lockdep_is_held(&local->hw.wiphy->mtx)); in ieee80211_recalc_min_chandef()
3087 * the mutex. Just the way we reached it could - in in ieee80211_recalc_min_chandef()
3088 * theory - go away, but we don't really care and in ieee80211_recalc_min_chandef()
3118 memcpy(pos, &s1g_cap->cap, sizeof(s1g_cap->cap)); in ieee80211_ie_build_s1g_cap()
3119 pos += sizeof(s1g_cap->cap); in ieee80211_ie_build_s1g_cap()
3121 memcpy(pos, &s1g_cap->nss_mcs, sizeof(s1g_cap->nss_mcs)); in ieee80211_ie_build_s1g_cap()
3122 pos += sizeof(s1g_cap->nss_mcs); in ieee80211_ie_build_s1g_cap()
3142 *pos++ = ht_cap->ampdu_factor | in ieee80211_ie_build_ht_cap()
3143 (ht_cap->ampdu_density << in ieee80211_ie_build_ht_cap()
3147 memcpy(pos, &ht_cap->mcs, sizeof(ht_cap->mcs)); in ieee80211_ie_build_ht_cap()
3148 pos += sizeof(ht_cap->mcs); in ieee80211_ie_build_ht_cap()
3177 memcpy(pos, &vht_cap->vht_mcs, sizeof(vht_cap->vht_mcs)); in ieee80211_ie_build_vht_cap()
3178 pos += sizeof(vht_cap->vht_mcs); in ieee80211_ie_build_vht_cap()
3197 n = ieee80211_he_mcs_nss_size(&he_cap->he_cap_elem); in ieee80211_ie_len_he_cap()
3199 sizeof(he_cap->he_cap_elem) + n + in ieee80211_ie_len_he_cap()
3200 ieee80211_he_ppe_size(he_cap->ppe_thres[0], in ieee80211_ie_len_he_cap()
3201 he_cap->he_cap_elem.phy_cap_info); in ieee80211_ie_len_he_cap()
3222 elem = he_cap->he_cap_elem; in ieee80211_ie_build_he_cap()
3239 sizeof(he_cap->he_cap_elem) + n + in ieee80211_ie_build_he_cap()
3240 ieee80211_he_ppe_size(he_cap->ppe_thres[0], in ieee80211_ie_build_he_cap()
3241 he_cap->he_cap_elem.phy_cap_info); in ieee80211_ie_build_he_cap()
3243 if ((end - pos) < ie_len) in ieee80211_ie_build_he_cap()
3254 memcpy(pos, &he_cap->he_mcs_nss_supp, n); in ieee80211_ie_build_he_cap()
3258 if ((he_cap->he_cap_elem.phy_cap_info[6] & in ieee80211_ie_build_he_cap()
3266 n = hweight8(he_cap->ppe_thres[0] & in ieee80211_ie_build_he_cap()
3268 n *= (1 + ((he_cap->ppe_thres[0] & IEEE80211_PPE_THRES_NSS_MASK) >> in ieee80211_ie_build_he_cap()
3279 memcpy(pos, &he_cap->ppe_thres, n); in ieee80211_ie_build_he_cap()
3283 orig_pos[1] = (pos - orig_pos) - 2; in ieee80211_ie_build_he_cap()
3293 enum nl80211_iftype iftype = ieee80211_vif_type_p2p(&sdata->vif); in ieee80211_ie_build_he_6ghz_cap()
3297 if (!cfg80211_any_usable_channels(sdata->local->hw.wiphy, in ieee80211_ie_build_he_6ghz_cap()
3302 sband = sdata->local->hw.wiphy->bands[NL80211_BAND_6GHZ]; in ieee80211_ie_build_he_6ghz_cap()
3309 if (!iftd->he_6ghz_capa.capa) in ieee80211_ie_build_he_6ghz_cap()
3312 cap = le16_to_cpu(iftd->he_6ghz_capa.capa); in ieee80211_ie_build_he_6ghz_cap()
3348 ht_oper->primary_chan = ieee80211_frequency_to_channel( in ieee80211_ie_build_ht_oper()
3349 chandef->chan->center_freq); in ieee80211_ie_build_ht_oper()
3350 switch (chandef->width) { in ieee80211_ie_build_ht_oper()
3355 if (chandef->center_freq1 > chandef->chan->center_freq) in ieee80211_ie_build_ht_oper()
3356 ht_oper->ht_param = IEEE80211_HT_PARAM_CHA_SEC_ABOVE; in ieee80211_ie_build_ht_oper()
3358 ht_oper->ht_param = IEEE80211_HT_PARAM_CHA_SEC_BELOW; in ieee80211_ie_build_ht_oper()
3365 ht_oper->ht_param = IEEE80211_HT_PARAM_CHA_SEC_NONE; in ieee80211_ie_build_ht_oper()
3368 if (ht_cap->cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40 && in ieee80211_ie_build_ht_oper()
3369 chandef->width != NL80211_CHAN_WIDTH_20_NOHT && in ieee80211_ie_build_ht_oper()
3370 chandef->width != NL80211_CHAN_WIDTH_20) in ieee80211_ie_build_ht_oper()
3371 ht_oper->ht_param |= IEEE80211_HT_PARAM_CHAN_WIDTH_ANY; in ieee80211_ie_build_ht_oper()
3374 ht_oper->ht_param |= IEEE80211_HT_PARAM_RIFS_MODE; in ieee80211_ie_build_ht_oper()
3376 ht_oper->operation_mode = cpu_to_le16(prot_mode); in ieee80211_ie_build_ht_oper()
3377 ht_oper->stbc_param = 0x0000; in ieee80211_ie_build_ht_oper()
3381 memset(&ht_oper->basic_set, 0, 16); in ieee80211_ie_build_ht_oper()
3382 memcpy(&ht_oper->basic_set, &ht_cap->mcs, 10); in ieee80211_ie_build_ht_oper()
3393 switch (chandef->width) { in ieee80211_ie_build_wide_bw_cs()
3412 *pos++ = ieee80211_frequency_to_channel(chandef->center_freq1); in ieee80211_ie_build_wide_bw_cs()
3414 if (chandef->center_freq2) in ieee80211_ie_build_wide_bw_cs()
3415 *pos++ = ieee80211_frequency_to_channel(chandef->center_freq2); in ieee80211_ie_build_wide_bw_cs()
3428 vht_oper->center_freq_seg0_idx = ieee80211_frequency_to_channel( in ieee80211_ie_build_vht_oper()
3429 chandef->center_freq1); in ieee80211_ie_build_vht_oper()
3430 if (chandef->center_freq2) in ieee80211_ie_build_vht_oper()
3431 vht_oper->center_freq_seg1_idx = in ieee80211_ie_build_vht_oper()
3432 ieee80211_frequency_to_channel(chandef->center_freq2); in ieee80211_ie_build_vht_oper()
3434 vht_oper->center_freq_seg1_idx = 0x00; in ieee80211_ie_build_vht_oper()
3436 switch (chandef->width) { in ieee80211_ie_build_vht_oper()
3442 vht_oper->chan_width = IEEE80211_VHT_CHANWIDTH_80MHZ; in ieee80211_ie_build_vht_oper()
3443 vht_oper->center_freq_seg1_idx = vht_oper->center_freq_seg0_idx; in ieee80211_ie_build_vht_oper()
3444 if (chandef->chan->center_freq < chandef->center_freq1) in ieee80211_ie_build_vht_oper()
3445 vht_oper->center_freq_seg0_idx -= 8; in ieee80211_ie_build_vht_oper()
3447 vht_oper->center_freq_seg0_idx += 8; in ieee80211_ie_build_vht_oper()
3454 vht_oper->chan_width = IEEE80211_VHT_CHANWIDTH_80MHZ; in ieee80211_ie_build_vht_oper()
3457 vht_oper->chan_width = IEEE80211_VHT_CHANWIDTH_80MHZ; in ieee80211_ie_build_vht_oper()
3464 vht_oper->chan_width = IEEE80211_VHT_CHANWIDTH_USE_HT; in ieee80211_ie_build_vht_oper()
3469 vht_oper->basic_mcs_set = cpu_to_le16(0xffff); in ieee80211_ie_build_vht_oper()
3481 if (chandef->chan->band == NL80211_BAND_6GHZ) in ieee80211_ie_build_he_oper()
3495 if (chandef->chan->band == NL80211_BAND_6GHZ) in ieee80211_ie_build_he_oper()
3500 he_oper->he_oper_params = cpu_to_le32(he_oper_params); in ieee80211_ie_build_he_oper()
3503 he_oper->he_mcs_nss_set = cpu_to_le16(0xffff); in ieee80211_ie_build_he_oper()
3506 if (chandef->chan->band != NL80211_BAND_6GHZ) in ieee80211_ie_build_he_oper()
3511 he_6ghz_op->minrate = 6; /* 6 Mbps */ in ieee80211_ie_build_he_oper()
3512 he_6ghz_op->primary = in ieee80211_ie_build_he_oper()
3513 ieee80211_frequency_to_channel(chandef->chan->center_freq); in ieee80211_ie_build_he_oper()
3514 he_6ghz_op->ccfs0 = in ieee80211_ie_build_he_oper()
3515 ieee80211_frequency_to_channel(chandef->center_freq1); in ieee80211_ie_build_he_oper()
3516 if (chandef->center_freq2) in ieee80211_ie_build_he_oper()
3517 he_6ghz_op->ccfs1 = in ieee80211_ie_build_he_oper()
3518 ieee80211_frequency_to_channel(chandef->center_freq2); in ieee80211_ie_build_he_oper()
3520 he_6ghz_op->ccfs1 = 0; in ieee80211_ie_build_he_oper()
3522 switch (chandef->width) { in ieee80211_ie_build_he_oper()
3534 he_6ghz_op->control = in ieee80211_ie_build_he_oper()
3536 he_6ghz_op->ccfs1 = he_6ghz_op->ccfs0; in ieee80211_ie_build_he_oper()
3537 if (chandef->chan->center_freq < chandef->center_freq1) in ieee80211_ie_build_he_oper()
3538 he_6ghz_op->ccfs0 -= 8; in ieee80211_ie_build_he_oper()
3540 he_6ghz_op->ccfs0 += 8; in ieee80211_ie_build_he_oper()
3543 he_6ghz_op->control = in ieee80211_ie_build_he_oper()
3547 he_6ghz_op->control = in ieee80211_ie_build_he_oper()
3551 he_6ghz_op->control = in ieee80211_ie_build_he_oper()
3555 he_6ghz_op->control = in ieee80211_ie_build_he_oper()
3571 &eht_cap->eht_mcs_nss_supp.only_20mhz; in ieee80211_ie_build_eht_oper()
3585 memcpy(&eht_oper->basic_mcs_nss, eht_mcs_nss, sizeof(*eht_mcs_nss)); in ieee80211_ie_build_eht_oper()
3586 eht_oper->params |= IEEE80211_EHT_OPER_INFO_PRESENT; in ieee80211_ie_build_eht_oper()
3590 (struct ieee80211_eht_operation_info *)eht_oper->optional; in ieee80211_ie_build_eht_oper()
3592 eht_oper_info->ccfs0 = in ieee80211_ie_build_eht_oper()
3593 ieee80211_frequency_to_channel(chandef->center_freq1); in ieee80211_ie_build_eht_oper()
3594 if (chandef->center_freq2) in ieee80211_ie_build_eht_oper()
3595 eht_oper_info->ccfs1 = in ieee80211_ie_build_eht_oper()
3596 ieee80211_frequency_to_channel(chandef->center_freq2); in ieee80211_ie_build_eht_oper()
3598 eht_oper_info->ccfs1 = 0; in ieee80211_ie_build_eht_oper()
3600 switch (chandef->width) { in ieee80211_ie_build_eht_oper()
3603 eht_oper_info->ccfs1 = eht_oper_info->ccfs0; in ieee80211_ie_build_eht_oper()
3604 if (chandef->chan->center_freq < chandef->center_freq1) in ieee80211_ie_build_eht_oper()
3605 eht_oper_info->ccfs0 -= 16; in ieee80211_ie_build_eht_oper()
3607 eht_oper_info->ccfs0 += 16; in ieee80211_ie_build_eht_oper()
3610 eht_oper_info->ccfs1 = eht_oper_info->ccfs0; in ieee80211_ie_build_eht_oper()
3611 if (chandef->chan->center_freq < chandef->center_freq1) in ieee80211_ie_build_eht_oper()
3612 eht_oper_info->ccfs0 -= 8; in ieee80211_ie_build_eht_oper()
3614 eht_oper_info->ccfs0 += 8; in ieee80211_ie_build_eht_oper()
3629 eht_oper_info->control = chan_width; in ieee80211_ie_build_eht_oper()
3632 /* TODO: eht_oper_info->optional */ in ieee80211_ie_build_eht_oper()
3645 switch (ht_oper->ht_param & IEEE80211_HT_PARAM_CHA_SEC_OFFSET) { in ieee80211_chandef_ht_oper()
3659 cfg80211_chandef_create(chandef, chandef->chan, channel_type); in ieee80211_chandef_ht_oper()
3683 vht_cap = hw->wiphy->bands[chandef->chan->band]->vht_cap.cap; in ieee80211_chandef_vht_oper()
3692 ccfs0 = oper->center_freq_seg0_idx; in ieee80211_chandef_vht_oper()
3693 ccfs1 = oper->center_freq_seg1_idx; in ieee80211_chandef_vht_oper()
3694 ccfs2 = (le16_to_cpu(htop->operation_mode) & in ieee80211_chandef_vht_oper()
3705 * Cf. IEEE 802.11 Table 9-250 in ieee80211_chandef_vht_oper()
3741 cf0 = ieee80211_channel_to_frequency(ccf0, chandef->chan->band); in ieee80211_chandef_vht_oper()
3742 cf1 = ieee80211_channel_to_frequency(ccf1, chandef->chan->band); in ieee80211_chandef_vht_oper()
3744 switch (oper->chan_width) { in ieee80211_chandef_vht_oper()
3755 diff = abs(ccf1 - ccf0); in ieee80211_chandef_vht_oper()
3791 chandef->center_freq1 = in ieee80211_chandef_eht_oper()
3792 ieee80211_channel_to_frequency(info->ccfs0, in ieee80211_chandef_eht_oper()
3793 chandef->chan->band); in ieee80211_chandef_eht_oper()
3795 switch (u8_get_bits(info->control, in ieee80211_chandef_eht_oper()
3798 chandef->width = NL80211_CHAN_WIDTH_20; in ieee80211_chandef_eht_oper()
3801 chandef->width = NL80211_CHAN_WIDTH_40; in ieee80211_chandef_eht_oper()
3804 chandef->width = NL80211_CHAN_WIDTH_80; in ieee80211_chandef_eht_oper()
3808 chandef->width = NL80211_CHAN_WIDTH_160; in ieee80211_chandef_eht_oper()
3809 chandef->center_freq1 = in ieee80211_chandef_eht_oper()
3810 ieee80211_channel_to_frequency(info->ccfs1, in ieee80211_chandef_eht_oper()
3811 chandef->chan->band); in ieee80211_chandef_eht_oper()
3813 chandef->width = NL80211_CHAN_WIDTH_80; in ieee80211_chandef_eht_oper()
3818 chandef->width = NL80211_CHAN_WIDTH_320; in ieee80211_chandef_eht_oper()
3819 chandef->center_freq1 = in ieee80211_chandef_eht_oper()
3820 ieee80211_channel_to_frequency(info->ccfs1, in ieee80211_chandef_eht_oper()
3821 chandef->chan->band); in ieee80211_chandef_eht_oper()
3823 chandef->width = NL80211_CHAN_WIDTH_160; in ieee80211_chandef_eht_oper()
3825 chandef->width = NL80211_CHAN_WIDTH_80; in ieee80211_chandef_eht_oper()
3827 if (chandef->center_freq1 > chandef->chan->center_freq) in ieee80211_chandef_eht_oper()
3828 chandef->center_freq1 -= 40; in ieee80211_chandef_eht_oper()
3830 chandef->center_freq1 += 40; in ieee80211_chandef_eht_oper()
3841 struct ieee80211_local *local = sdata->local; in ieee80211_chandef_he_6ghz_oper()
3843 enum nl80211_iftype iftype = ieee80211_vif_type_p2p(&sdata->vif); in ieee80211_chandef_he_6ghz_oper()
3848 struct ieee80211_bss_conf *bss_conf = &sdata->vif.bss_conf; in ieee80211_chandef_he_6ghz_oper()
3851 u32 freq; in ieee80211_chandef_he_6ghz_oper() local
3853 if (chandef->chan->band != NL80211_BAND_6GHZ) in ieee80211_chandef_he_6ghz_oper()
3856 sband = local->hw.wiphy->bands[NL80211_BAND_6GHZ]; in ieee80211_chandef_he_6ghz_oper()
3864 he_phy_cap = he_cap->he_cap_elem.phy_cap_info[0]; in ieee80211_chandef_he_6ghz_oper()
3875 chandef->chan->center_freq); in ieee80211_chandef_he_6ghz_oper()
3888 chandef->chan->center_freq); in ieee80211_chandef_he_6ghz_oper()
3897 freq = ieee80211_channel_to_frequency(he_6ghz_oper->primary, in ieee80211_chandef_he_6ghz_oper()
3899 he_chandef.chan = ieee80211_get_channel(sdata->local->hw.wiphy, freq); in ieee80211_chandef_he_6ghz_oper()
3901 switch (u8_get_bits(he_6ghz_oper->control, in ieee80211_chandef_he_6ghz_oper()
3904 bss_conf->power_type = IEEE80211_REG_LPI_AP; in ieee80211_chandef_he_6ghz_oper()
3907 bss_conf->power_type = IEEE80211_REG_SP_AP; in ieee80211_chandef_he_6ghz_oper()
3910 bss_conf->power_type = IEEE80211_REG_UNSET_AP; in ieee80211_chandef_he_6ghz_oper()
3915 !(eht_oper->params & IEEE80211_EHT_OPER_INFO_PRESENT)) { in ieee80211_chandef_he_6ghz_oper()
3916 switch (u8_get_bits(he_6ghz_oper->control, in ieee80211_chandef_he_6ghz_oper()
3929 if (!he_6ghz_oper->ccfs1) in ieee80211_chandef_he_6ghz_oper()
3931 if (abs(he_6ghz_oper->ccfs1 - he_6ghz_oper->ccfs0) == 8) { in ieee80211_chandef_he_6ghz_oper()
3943 ieee80211_channel_to_frequency(he_6ghz_oper->ccfs1, in ieee80211_chandef_he_6ghz_oper()
3947 ieee80211_channel_to_frequency(he_6ghz_oper->ccfs0, in ieee80211_chandef_he_6ghz_oper()
3951 ieee80211_channel_to_frequency(he_6ghz_oper->ccfs1, in ieee80211_chandef_he_6ghz_oper()
3955 eht_phy_cap = eht_cap->eht_cap_elem.phy_cap_info[0]; in ieee80211_chandef_he_6ghz_oper()
3959 ieee80211_chandef_eht_oper((const void *)eht_oper->optional, in ieee80211_chandef_he_6ghz_oper()
3967 he_chandef.chan ? he_chandef.chan->center_freq : 0, in ieee80211_chandef_he_6ghz_oper()
3987 switch (FIELD_GET(S1G_OPER_CH_WIDTH_OPER, oper->ch_width)) { in ieee80211_chandef_s1g_oper()
3989 chandef->width = NL80211_CHAN_WIDTH_1; in ieee80211_chandef_s1g_oper()
3992 chandef->width = NL80211_CHAN_WIDTH_2; in ieee80211_chandef_s1g_oper()
3995 chandef->width = NL80211_CHAN_WIDTH_4; in ieee80211_chandef_s1g_oper()
3998 chandef->width = NL80211_CHAN_WIDTH_8; in ieee80211_chandef_s1g_oper()
4001 chandef->width = NL80211_CHAN_WIDTH_16; in ieee80211_chandef_s1g_oper()
4007 oper_freq = ieee80211_channel_to_freq_khz(oper->oper_ch, in ieee80211_chandef_s1g_oper()
4009 chandef->center_freq1 = KHZ_TO_MHZ(oper_freq); in ieee80211_chandef_s1g_oper()
4010 chandef->freq1_offset = oper_freq % 1000; in ieee80211_chandef_s1g_oper()
4028 for (j = 0; j < sband->n_bitrates; j++) { in ieee80211_parse_bitrates()
4029 br = &sband->bitrates[j]; in ieee80211_parse_bitrates()
4030 if ((rate_flags & br->flags) != rate_flags) in ieee80211_parse_bitrates()
4033 brate = DIV_ROUND_UP(br->bitrate, 5); in ieee80211_parse_bitrates()
4048 struct ieee80211_local *local = sdata->local; in ieee80211_add_srates_ie()
4052 u32 basic_rates = sdata->vif.bss_conf.basic_rates; in ieee80211_add_srates_ie()
4055 rate_flags = ieee80211_chandef_rate_flags(&sdata->vif.bss_conf.chandef); in ieee80211_add_srates_ie()
4056 sband = local->hw.wiphy->bands[band]; in ieee80211_add_srates_ie()
4058 for (i = 0; i < sband->n_bitrates; i++) { in ieee80211_add_srates_ie()
4059 if ((rate_flags & sband->bitrates[i].flags) != rate_flags) in ieee80211_add_srates_ie()
4067 return -ENOMEM; in ieee80211_add_srates_ie()
4074 if ((rate_flags & sband->bitrates[i].flags) != rate_flags) in ieee80211_add_srates_ie()
4079 rate = DIV_ROUND_UP(sband->bitrates[i].bitrate, 5); in ieee80211_add_srates_ie()
4090 struct ieee80211_local *local = sdata->local; in ieee80211_add_ext_srates_ie()
4094 u32 basic_rates = sdata->vif.bss_conf.basic_rates; in ieee80211_add_ext_srates_ie()
4097 rate_flags = ieee80211_chandef_rate_flags(&sdata->vif.bss_conf.chandef); in ieee80211_add_ext_srates_ie()
4099 sband = local->hw.wiphy->bands[band]; in ieee80211_add_ext_srates_ie()
4101 for (i = 0; i < sband->n_bitrates; i++) { in ieee80211_add_ext_srates_ie()
4102 if ((rate_flags & sband->bitrates[i].flags) != rate_flags) in ieee80211_add_ext_srates_ie()
4108 exrates -= 8; in ieee80211_add_ext_srates_ie()
4113 return -ENOMEM; in ieee80211_add_ext_srates_ie()
4119 for (i = 8; i < sband->n_bitrates; i++) { in ieee80211_add_ext_srates_ie()
4121 if ((rate_flags & sband->bitrates[i].flags) in ieee80211_add_ext_srates_ie()
4126 rate = DIV_ROUND_UP(sband->bitrates[i].bitrate, 5); in ieee80211_add_ext_srates_ie()
4137 if (WARN_ON_ONCE(sdata->vif.type != NL80211_IFTYPE_STATION)) in ieee80211_ave_rssi()
4140 return -ewma_beacon_signal_read(&sdata->deflink.u.mgd.ave_beacon_signal); in ieee80211_ave_rssi()
4151 if (mcs->rx_mask[3]) in ieee80211_mcs_to_chains()
4153 if (mcs->rx_mask[2]) in ieee80211_mcs_to_chains()
4155 if (mcs->rx_mask[1]) in ieee80211_mcs_to_chains()
4161 * ieee80211_calculate_rx_timestamp - calculate timestamp in frame
4178 u64 ts = status->mactime; in ieee80211_calculate_rx_timestamp()
4187 mactime_plcp_start = (status->flag & RX_FLAG_MACTIME) == in ieee80211_calculate_rx_timestamp()
4192 ri.bw = status->bw; in ieee80211_calculate_rx_timestamp()
4195 switch (status->encoding) { in ieee80211_calculate_rx_timestamp()
4198 ri.mcs = status->rate_idx; in ieee80211_calculate_rx_timestamp()
4199 ri.nss = status->nss; in ieee80211_calculate_rx_timestamp()
4200 ri.eht_ru_alloc = status->eht.ru; in ieee80211_calculate_rx_timestamp()
4201 if (status->enc_flags & RX_ENC_FLAG_SHORT_GI) in ieee80211_calculate_rx_timestamp()
4211 ri.mcs = status->rate_idx; in ieee80211_calculate_rx_timestamp()
4212 ri.nss = status->nss; in ieee80211_calculate_rx_timestamp()
4213 ri.he_ru_alloc = status->he_ru; in ieee80211_calculate_rx_timestamp()
4214 if (status->enc_flags & RX_ENC_FLAG_SHORT_GI) in ieee80211_calculate_rx_timestamp()
4227 * For HE MU PPDU, add the HE-SIG-B. in ieee80211_calculate_rx_timestamp()
4228 * For HE ER PPDU, add 8us for the HE-SIG-A. in ieee80211_calculate_rx_timestamp()
4229 * For HE TB PPDU, add 4us for the HE-STF. in ieee80211_calculate_rx_timestamp()
4230 * Add the HE-LTF durations - variable. in ieee80211_calculate_rx_timestamp()
4236 ri.mcs = status->rate_idx; in ieee80211_calculate_rx_timestamp()
4238 if (status->enc_flags & RX_ENC_FLAG_SHORT_GI) in ieee80211_calculate_rx_timestamp()
4247 if (status->enc_flags & RX_ENC_FLAG_HT_GF) in ieee80211_calculate_rx_timestamp()
4253 * Add Data HT-LTFs per streams in ieee80211_calculate_rx_timestamp()
4254 * TODO: add Extension HT-LTFs, 4us per LTF in ieee80211_calculate_rx_timestamp()
4264 ri.mcs = status->rate_idx; in ieee80211_calculate_rx_timestamp()
4265 ri.nss = status->nss; in ieee80211_calculate_rx_timestamp()
4266 if (status->enc_flags & RX_ENC_FLAG_SHORT_GI) in ieee80211_calculate_rx_timestamp()
4278 * Add VHT-LTFs per streams in ieee80211_calculate_rx_timestamp()
4292 sband = local->hw.wiphy->bands[status->band]; in ieee80211_calculate_rx_timestamp()
4293 ri.legacy = sband->bitrates[status->rate_idx].bitrate; in ieee80211_calculate_rx_timestamp()
4296 if (status->band == NL80211_BAND_5GHZ) { in ieee80211_calculate_rx_timestamp()
4299 } else if (status->enc_flags & RX_ENC_FLAG_SHORTPRE) { in ieee80211_calculate_rx_timestamp()
4312 (unsigned long long)status->flag, status->rate_idx, in ieee80211_calculate_rx_timestamp()
4313 status->nss)) in ieee80211_calculate_rx_timestamp()
4317 if ((status->flag & RX_FLAG_MACTIME) == RX_FLAG_MACTIME_END) in ieee80211_calculate_rx_timestamp()
4318 ts -= mpdu_len * 8 * 10 / rate; in ieee80211_calculate_rx_timestamp()
4330 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_dfs_cac_cancel()
4332 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_dfs_cac_cancel()
4333 /* it might be waiting for the local->mtx, but then in ieee80211_dfs_cac_cancel()
4334 * by the time it gets it, sdata->wdev.cac_started in ieee80211_dfs_cac_cancel()
4337 wiphy_delayed_work_cancel(local->hw.wiphy, in ieee80211_dfs_cac_cancel()
4338 &sdata->deflink.dfs_cac_timer_work); in ieee80211_dfs_cac_cancel()
4340 if (sdata->wdev.cac_started) { in ieee80211_dfs_cac_cancel()
4341 chandef = sdata->vif.bss_conf.chandef; in ieee80211_dfs_cac_cancel()
4342 ieee80211_link_release_channel(&sdata->deflink); in ieee80211_dfs_cac_cancel()
4343 cfg80211_cac_event(sdata->dev, in ieee80211_dfs_cac_cancel()
4356 struct cfg80211_chan_def chandef = local->hw.conf.chandef; in ieee80211_dfs_radar_detected_work()
4360 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_dfs_radar_detected_work()
4362 list_for_each_entry(ctx, &local->chanctx_list, list) { in ieee80211_dfs_radar_detected_work()
4363 if (ctx->replace_state == IEEE80211_CHANCTX_REPLACES_OTHER) in ieee80211_dfs_radar_detected_work()
4367 chandef = ctx->conf.def; in ieee80211_dfs_radar_detected_work()
4373 /* XXX: multi-channel is not supported yet */ in ieee80211_dfs_radar_detected_work()
4376 cfg80211_radar_event(local->hw.wiphy, &chandef, GFP_KERNEL); in ieee80211_dfs_radar_detected_work()
4385 wiphy_work_queue(hw->wiphy, &local->radar_detected_work); in ieee80211_radar_detected()
4394 switch (c->width) { in ieee80211_chandef_downgrade()
4396 c->width = NL80211_CHAN_WIDTH_20_NOHT; in ieee80211_chandef_downgrade()
4400 c->width = NL80211_CHAN_WIDTH_20; in ieee80211_chandef_downgrade()
4401 c->center_freq1 = c->chan->center_freq; in ieee80211_chandef_downgrade()
4406 tmp = (30 + c->chan->center_freq - c->center_freq1)/20; in ieee80211_chandef_downgrade()
4410 c->center_freq1 = c->center_freq1 - 20 + 40 * tmp; in ieee80211_chandef_downgrade()
4411 c->width = NL80211_CHAN_WIDTH_40; in ieee80211_chandef_downgrade()
4415 c->center_freq2 = 0; in ieee80211_chandef_downgrade()
4416 c->width = NL80211_CHAN_WIDTH_80; in ieee80211_chandef_downgrade()
4422 tmp = (70 + c->chan->center_freq - c->center_freq1)/20; in ieee80211_chandef_downgrade()
4425 c->center_freq1 = c->center_freq1 - 40 + 80 * tmp; in ieee80211_chandef_downgrade()
4426 c->width = NL80211_CHAN_WIDTH_80; in ieee80211_chandef_downgrade()
4432 tmp = (150 + c->chan->center_freq - c->center_freq1) / 20; in ieee80211_chandef_downgrade()
4435 c->center_freq1 = c->center_freq1 - 80 + 160 * tmp; in ieee80211_chandef_downgrade()
4436 c->width = NL80211_CHAN_WIDTH_160; in ieee80211_chandef_downgrade()
4442 c->width = NL80211_CHAN_WIDTH_20_NOHT; in ieee80211_chandef_downgrade()
4453 /* keep c->width */ in ieee80211_chandef_downgrade()
4493 struct ieee80211_local *local = sdata->local; in ieee80211_send_action_csa()
4494 int freq; in ieee80211_send_action_csa() local
4499 if (sdata->vif.type != NL80211_IFTYPE_ADHOC && in ieee80211_send_action_csa()
4500 sdata->vif.type != NL80211_IFTYPE_MESH_POINT) in ieee80211_send_action_csa()
4501 return -EOPNOTSUPP; in ieee80211_send_action_csa()
4503 skb = dev_alloc_skb(local->tx_headroom + hdr_len + in ieee80211_send_action_csa()
4509 return -ENOMEM; in ieee80211_send_action_csa()
4511 skb_reserve(skb, local->tx_headroom); in ieee80211_send_action_csa()
4513 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | in ieee80211_send_action_csa()
4516 eth_broadcast_addr(mgmt->da); in ieee80211_send_action_csa()
4517 memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); in ieee80211_send_action_csa()
4518 if (ieee80211_vif_is_mesh(&sdata->vif)) { in ieee80211_send_action_csa()
4519 memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN); in ieee80211_send_action_csa()
4521 struct ieee80211_if_ibss *ifibss = &sdata->u.ibss; in ieee80211_send_action_csa()
4522 memcpy(mgmt->bssid, ifibss->bssid, ETH_ALEN); in ieee80211_send_action_csa()
4524 mgmt->u.action.category = WLAN_CATEGORY_SPECTRUM_MGMT; in ieee80211_send_action_csa()
4525 mgmt->u.action.u.chan_switch.action_code = WLAN_ACTION_SPCT_CHL_SWITCH; in ieee80211_send_action_csa()
4529 *pos++ = csa_settings->block_tx ? 1 : 0; /* CSA mode */ in ieee80211_send_action_csa()
4530 freq = csa_settings->chandef.chan->center_freq; in ieee80211_send_action_csa()
4531 *pos++ = ieee80211_frequency_to_channel(freq); /* channel */ in ieee80211_send_action_csa()
4532 *pos++ = csa_settings->count; /* count */ in ieee80211_send_action_csa()
4534 if (csa_settings->chandef.width == NL80211_CHAN_WIDTH_40) { in ieee80211_send_action_csa()
4540 ch_type = cfg80211_get_chandef_type(&csa_settings->chandef); in ieee80211_send_action_csa()
4547 if (ieee80211_vif_is_mesh(&sdata->vif)) { in ieee80211_send_action_csa()
4548 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; in ieee80211_send_action_csa()
4553 *pos++ = sdata->u.mesh.mshcfg.dot11MeshTTL; /* Mesh TTL */ in ieee80211_send_action_csa()
4556 *pos++ |= csa_settings->block_tx ? in ieee80211_send_action_csa()
4560 put_unaligned_le16(ifmsh->pre_value, pos);/* Precedence Value */ in ieee80211_send_action_csa()
4564 if (csa_settings->chandef.width == NL80211_CHAN_WIDTH_80 || in ieee80211_send_action_csa()
4565 csa_settings->chandef.width == NL80211_CHAN_WIDTH_80P80 || in ieee80211_send_action_csa()
4566 csa_settings->chandef.width == NL80211_CHAN_WIDTH_160) { in ieee80211_send_action_csa()
4568 ieee80211_ie_build_wide_bw_cs(pos, &csa_settings->chandef); in ieee80211_send_action_csa()
4578 s32 end = data->desc[i].start + data->desc[i].duration - (tsf + 1); in ieee80211_extend_noa_desc()
4585 if (data->count[i] == 1) in ieee80211_extend_noa_desc()
4588 if (data->desc[i].interval == 0) in ieee80211_extend_noa_desc()
4592 skip = DIV_ROUND_UP(-end, data->desc[i].interval); in ieee80211_extend_noa_desc()
4593 if (data->count[i] < 255) { in ieee80211_extend_noa_desc()
4594 if (data->count[i] <= skip) { in ieee80211_extend_noa_desc()
4595 data->count[i] = 0; in ieee80211_extend_noa_desc()
4599 data->count[i] -= skip; in ieee80211_extend_noa_desc()
4602 data->desc[i].start += skip * data->desc[i].interval; in ieee80211_extend_noa_desc()
4617 if (!data->count[i]) in ieee80211_extend_absent_time()
4623 cur = data->desc[i].start - tsf; in ieee80211_extend_absent_time()
4627 cur = data->desc[i].start + data->desc[i].duration - tsf; in ieee80211_extend_absent_time()
4641 * arbitrary limit, used to avoid infinite loops when combined NoA in ieee80211_get_noa_absent_time()
4659 u32 next_offset = BIT(31) - 1; in ieee80211_update_p2p_noa()
4662 data->absent = 0; in ieee80211_update_p2p_noa()
4663 data->has_next_tsf = false; in ieee80211_update_p2p_noa()
4667 if (!data->count[i]) in ieee80211_update_p2p_noa()
4671 start = data->desc[i].start - tsf; in ieee80211_update_p2p_noa()
4673 data->absent |= BIT(i); in ieee80211_update_p2p_noa()
4678 data->has_next_tsf = true; in ieee80211_update_p2p_noa()
4681 if (data->absent) in ieee80211_update_p2p_noa()
4684 data->next_tsf = tsf + next_offset; in ieee80211_update_p2p_noa()
4697 const struct ieee80211_p2p_noa_desc *desc = &attr->desc[i]; in ieee80211_parse_p2p_noa()
4699 if (!desc->count || !desc->duration) in ieee80211_parse_p2p_noa()
4702 data->count[i] = desc->count; in ieee80211_parse_p2p_noa()
4703 data->desc[i].start = le32_to_cpu(desc->start_time); in ieee80211_parse_p2p_noa()
4704 data->desc[i].duration = le32_to_cpu(desc->duration); in ieee80211_parse_p2p_noa()
4705 data->desc[i].interval = le32_to_cpu(desc->interval); in ieee80211_parse_p2p_noa()
4707 if (data->count[i] > 1 && in ieee80211_parse_p2p_noa()
4708 data->desc[i].interval < data->desc[i].duration) in ieee80211_parse_p2p_noa()
4727 u16 beacon_int = sdata->vif.bss_conf.beacon_int * 1024; in ieee80211_recalc_dtim()
4728 u8 dtim_period = sdata->vif.bss_conf.dtim_period; in ieee80211_recalc_dtim()
4732 if (tsf == -1ULL || !beacon_int || !dtim_period) in ieee80211_recalc_dtim()
4735 if (sdata->vif.type == NL80211_IFTYPE_AP || in ieee80211_recalc_dtim()
4736 sdata->vif.type == NL80211_IFTYPE_AP_VLAN) { in ieee80211_recalc_dtim()
4737 if (!sdata->bss) in ieee80211_recalc_dtim()
4740 ps = &sdata->bss->ps; in ieee80211_recalc_dtim()
4741 } else if (ieee80211_vif_is_mesh(&sdata->vif)) { in ieee80211_recalc_dtim()
4742 ps = &sdata->u.mesh.ps; in ieee80211_recalc_dtim()
4750 * dtim_count = dtim_period - (tsf / bcn_int) % dtim_period in ieee80211_recalc_dtim()
4758 dtim_count = dtim_period - bcns_from_dtim; in ieee80211_recalc_dtim()
4760 ps->dtim_count = dtim_count; in ieee80211_recalc_dtim()
4769 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_chanctx_radar_detect()
4771 if (WARN_ON(ctx->replace_state == IEEE80211_CHANCTX_WILL_BE_REPLACED)) in ieee80211_chanctx_radar_detect()
4774 list_for_each_entry(link, &ctx->reserved_links, reserved_chanctx_list) in ieee80211_chanctx_radar_detect()
4775 if (link->reserved_radar_required) in ieee80211_chanctx_radar_detect()
4776 radar_detect |= BIT(link->reserved_chandef.width); in ieee80211_chanctx_radar_detect()
4779 * An in-place reservation context should not have any assigned vifs in ieee80211_chanctx_radar_detect()
4782 WARN_ON(ctx->replace_state == IEEE80211_CHANCTX_REPLACES_OTHER && in ieee80211_chanctx_radar_detect()
4783 !list_empty(&ctx->assigned_links)); in ieee80211_chanctx_radar_detect()
4785 list_for_each_entry(link, &ctx->assigned_links, assigned_chanctx_list) { in ieee80211_chanctx_radar_detect()
4786 if (!link->radar_required) in ieee80211_chanctx_radar_detect()
4790 BIT(link->conf->chandef.width); in ieee80211_chanctx_radar_detect()
4801 struct ieee80211_local *local = sdata->local; in ieee80211_check_combinations()
4803 enum nl80211_iftype iftype = sdata->wdev.iftype; in ieee80211_check_combinations()
4810 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_check_combinations()
4813 return -EINVAL; in ieee80211_check_combinations()
4816 !chandef->chan)) in ieee80211_check_combinations()
4817 return -EINVAL; in ieee80211_check_combinations()
4820 return -EINVAL; in ieee80211_check_combinations()
4822 if (sdata->vif.type == NL80211_IFTYPE_AP || in ieee80211_check_combinations()
4823 sdata->vif.type == NL80211_IFTYPE_MESH_POINT) { in ieee80211_check_combinations()
4829 params.new_beacon_int = sdata->vif.bss_conf.beacon_int; in ieee80211_check_combinations()
4833 if (cfg80211_iftype_allowed(local->hw.wiphy, iftype, 0, 1)) { in ieee80211_check_combinations()
4835 return -EINVAL; in ieee80211_check_combinations()
4845 list_for_each_entry(ctx, &local->chanctx_list, list) { in ieee80211_check_combinations()
4846 if (ctx->replace_state == IEEE80211_CHANCTX_WILL_BE_REPLACED) in ieee80211_check_combinations()
4850 if (ctx->mode == IEEE80211_CHANCTX_EXCLUSIVE) { in ieee80211_check_combinations()
4856 &ctx->conf.def)) in ieee80211_check_combinations()
4861 list_for_each_entry_rcu(sdata_iter, &local->interfaces, list) { in ieee80211_check_combinations()
4864 wdev_iter = &sdata_iter->wdev; in ieee80211_check_combinations()
4868 cfg80211_iftype_allowed(local->hw.wiphy, in ieee80211_check_combinations()
4869 wdev_iter->iftype, 0, 1)) in ieee80211_check_combinations()
4872 params.iftype_num[wdev_iter->iftype]++; in ieee80211_check_combinations()
4879 return cfg80211_check_combinations(local->hw.wiphy, ¶ms); in ieee80211_check_combinations()
4889 c->num_different_channels); in ieee80211_iter_max_chans()
4900 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_max_num_channels()
4902 list_for_each_entry(ctx, &local->chanctx_list, list) { in ieee80211_max_num_channels()
4903 if (ctx->replace_state == IEEE80211_CHANCTX_WILL_BE_REPLACED) in ieee80211_max_num_channels()
4912 list_for_each_entry_rcu(sdata, &local->interfaces, list) in ieee80211_max_num_channels()
4913 params.iftype_num[sdata->wdev.iftype]++; in ieee80211_max_num_channels()
4915 err = cfg80211_iter_combinations(local->hw.wiphy, ¶ms, in ieee80211_max_num_channels()
4928 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_add_s1g_capab_ie()
4933 if (WARN_ON(sdata->vif.type != NL80211_IFTYPE_STATION)) in ieee80211_add_s1g_capab_ie()
4936 if (!caps->s1g) in ieee80211_add_s1g_capab_ie()
4939 memcpy(s1g_capab.capab_info, caps->cap, sizeof(caps->cap)); in ieee80211_add_s1g_capab_ie()
4940 memcpy(s1g_capab.supp_mcs_nss, caps->nss_mcs, sizeof(caps->nss_mcs)); in ieee80211_add_s1g_capab_ie()
4943 for (i = 0; i < sizeof(ifmgd->s1g_capa.capab_info); i++) { in ieee80211_add_s1g_capab_ie()
4944 u8 mask = ifmgd->s1g_capa_mask.capab_info[i]; in ieee80211_add_s1g_capab_ie()
4947 s1g_capab.capab_info[i] |= ifmgd->s1g_capa.capab_info[i] & mask; in ieee80211_add_s1g_capab_ie()
4951 for (i = 0; i < sizeof(ifmgd->s1g_capa.supp_mcs_nss); i++) { in ieee80211_add_s1g_capab_ie()
4952 u8 mask = ifmgd->s1g_capa_mask.supp_mcs_nss[i]; in ieee80211_add_s1g_capab_ie()
4956 ifmgd->s1g_capa.supp_mcs_nss[i] & mask; in ieee80211_add_s1g_capab_ie()
4986 *buf++ = qosinfo; /* U-APSD no in use */ in ieee80211_add_wmm_info_ie()
4999 skb_queue_walk(&txqi->frags, skb) { in ieee80211_txq_get_depth()
5001 frag_bytes += skb->len; in ieee80211_txq_get_depth()
5005 *frame_cnt = txqi->tin.backlog_packets + frag_cnt; in ieee80211_txq_get_depth()
5008 *byte_cnt = txqi->tin.backlog_bytes + frag_bytes; in ieee80211_txq_get_depth()
5060 n = ieee80211_eht_mcs_nss_size(&he_cap->he_cap_elem, in ieee80211_ie_len_eht_cap()
5061 &eht_cap->eht_cap_elem, in ieee80211_ie_len_eht_cap()
5064 sizeof(eht_cap->eht_cap_elem) + n + in ieee80211_ie_len_eht_cap()
5065 ieee80211_eht_ppe_size(eht_cap->eht_ppe_thres[0], in ieee80211_ie_len_eht_cap()
5066 eht_cap->eht_cap_elem.phy_cap_info); in ieee80211_ie_len_eht_cap()
5084 mcs_nss_len = ieee80211_eht_mcs_nss_size(&he_cap->he_cap_elem, in ieee80211_ie_build_eht_cap()
5085 &eht_cap->eht_cap_elem, in ieee80211_ie_build_eht_cap()
5087 ppet_len = ieee80211_eht_ppe_size(eht_cap->eht_ppe_thres[0], in ieee80211_ie_build_eht_cap()
5088 eht_cap->eht_cap_elem.phy_cap_info); in ieee80211_ie_build_eht_cap()
5090 ie_len = 2 + 1 + sizeof(eht_cap->eht_cap_elem) + mcs_nss_len + ppet_len; in ieee80211_ie_build_eht_cap()
5091 if ((end - pos) < ie_len) in ieee80211_ie_build_eht_cap()
5095 *pos++ = ie_len - 2; in ieee80211_ie_build_eht_cap()
5099 memcpy(pos, &eht_cap->eht_cap_elem, sizeof(eht_cap->eht_cap_elem)); in ieee80211_ie_build_eht_cap()
5100 pos += sizeof(eht_cap->eht_cap_elem); in ieee80211_ie_build_eht_cap()
5102 memcpy(pos, &eht_cap->eht_mcs_nss_supp, mcs_nss_len); in ieee80211_ie_build_eht_cap()
5106 memcpy(pos, &eht_cap->eht_ppe_thres, ppet_len); in ieee80211_ie_build_eht_cap()