Lines Matching +full:ri +full:- +full:override
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
29 #include "driver-ops.h"
44 return &local->hw; in wiphy_to_ieee80211_hw()
51 __le16 fc = hdr->frame_control; in ieee80211_get_bssid()
60 return hdr->addr1; in ieee80211_get_bssid()
62 return hdr->addr2; in ieee80211_get_bssid()
64 return hdr->addr3; in ieee80211_get_bssid()
70 return ext->u.s1g_beacon.sa; in ieee80211_get_bssid()
76 return hdr->addr3; in ieee80211_get_bssid()
81 return hdr->addr1; in ieee80211_get_bssid()
86 return hdr->addr2; in ieee80211_get_bssid()
89 return hdr->addr1; in ieee80211_get_bssid()
105 skb_queue_walk(&tx->skbs, skb) { in ieee80211_tx_set_protected()
106 hdr = (struct ieee80211_hdr *) skb->data; in ieee80211_tx_set_protected()
107 hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); in ieee80211_tx_set_protected()
139 * 802.11a - 18.5.2: aSIFSTime = 16 usec in ieee80211_frame_duration()
140 * 802.11g - 19.8.4: aSIFSTime = 10 usec + in ieee80211_frame_duration()
144 dur += 16; /* IEEE 802.11-2012 18.3.2.4: T_PREAMBLE = 16 usec */ in ieee80211_frame_duration()
145 dur += 4; /* IEEE 802.11-2012 18.3.2.4: T_SIGNAL = 4 usec */ in ieee80211_frame_duration()
147 /* IEEE 802.11-2012 18.3.2.4: all values above are: in ieee80211_frame_duration()
193 short_preamble = sdata->vif.bss_conf.use_short_preamble; in ieee80211_generic_frame_duration()
194 if (sdata->deflink.operating_11g_mode) in ieee80211_generic_frame_duration()
195 erp = rate->flags & IEEE80211_RATE_ERP_G; in ieee80211_generic_frame_duration()
199 dur = ieee80211_frame_duration(band, frame_len, rate->bitrate, erp, in ieee80211_generic_frame_duration()
218 sband = local->hw.wiphy->bands[frame_txctl->band]; in ieee80211_rts_duration()
222 rate = &sband->bitrates[frame_txctl->control.rts_cts_rate_idx]; in ieee80211_rts_duration()
227 short_preamble = sdata->vif.bss_conf.use_short_preamble; in ieee80211_rts_duration()
228 if (sdata->deflink.operating_11g_mode) in ieee80211_rts_duration()
229 erp = rate->flags & IEEE80211_RATE_ERP_G; in ieee80211_rts_duration()
233 bitrate = DIV_ROUND_UP(rate->bitrate, 1 << shift); in ieee80211_rts_duration()
236 dur = ieee80211_frame_duration(sband->band, 10, bitrate, in ieee80211_rts_duration()
239 dur += ieee80211_frame_duration(sband->band, frame_len, bitrate, in ieee80211_rts_duration()
242 dur += ieee80211_frame_duration(sband->band, 10, bitrate, in ieee80211_rts_duration()
262 sband = local->hw.wiphy->bands[frame_txctl->band]; in ieee80211_ctstoself_duration()
266 rate = &sband->bitrates[frame_txctl->control.rts_cts_rate_idx]; in ieee80211_ctstoself_duration()
270 short_preamble = sdata->vif.bss_conf.use_short_preamble; in ieee80211_ctstoself_duration()
271 if (sdata->deflink.operating_11g_mode) in ieee80211_ctstoself_duration()
272 erp = rate->flags & IEEE80211_RATE_ERP_G; in ieee80211_ctstoself_duration()
276 bitrate = DIV_ROUND_UP(rate->bitrate, 1 << shift); in ieee80211_ctstoself_duration()
279 dur = ieee80211_frame_duration(sband->band, frame_len, bitrate, in ieee80211_ctstoself_duration()
281 if (!(frame_txctl->flags & IEEE80211_TX_CTL_NO_ACK)) { in ieee80211_ctstoself_duration()
283 dur += ieee80211_frame_duration(sband->band, 10, bitrate, in ieee80211_ctstoself_duration()
296 .sta = queue->sta, in wake_tx_push_queue()
301 skb = ieee80211_tx_dequeue(&local->hw, queue); in wake_tx_push_queue()
314 struct ieee80211_sub_if_data *sdata = vif_to_sdata(txq->vif); in ieee80211_handle_wake_tx_queue()
317 spin_lock(&local->handle_wake_tx_queue_lock); in ieee80211_handle_wake_tx_queue()
320 ieee80211_txq_schedule_start(hw, txq->ac); in ieee80211_handle_wake_tx_queue()
321 while ((queue = ieee80211_next_txq(hw, txq->ac))) { in ieee80211_handle_wake_tx_queue()
325 ieee80211_txq_schedule_end(hw, txq->ac); in ieee80211_handle_wake_tx_queue()
326 spin_unlock(&local->handle_wake_tx_queue_lock); in ieee80211_handle_wake_tx_queue()
332 struct ieee80211_local *local = sdata->local; in __ieee80211_wake_txqs()
333 struct ieee80211_vif *vif = &sdata->vif; in __ieee80211_wake_txqs()
334 struct fq *fq = &local->fq; in __ieee80211_wake_txqs()
341 spin_lock(&fq->lock); in __ieee80211_wake_txqs()
343 if (!test_bit(SDATA_STATE_RUNNING, &sdata->state)) in __ieee80211_wake_txqs()
346 if (sdata->vif.type == NL80211_IFTYPE_AP) in __ieee80211_wake_txqs()
347 ps = &sdata->bss->ps; in __ieee80211_wake_txqs()
349 list_for_each_entry_rcu(sta, &local->sta_list, list) { in __ieee80211_wake_txqs()
350 if (sdata != sta->sdata) in __ieee80211_wake_txqs()
353 for (i = 0; i < ARRAY_SIZE(sta->sta.txq); i++) { in __ieee80211_wake_txqs()
354 struct ieee80211_txq *txq = sta->sta.txq[i]; in __ieee80211_wake_txqs()
361 if (ac != txq->ac) in __ieee80211_wake_txqs()
365 &txqi->flags)) in __ieee80211_wake_txqs()
368 spin_unlock(&fq->lock); in __ieee80211_wake_txqs()
370 spin_lock(&fq->lock); in __ieee80211_wake_txqs()
374 if (!vif->txq) in __ieee80211_wake_txqs()
377 txqi = to_txq_info(vif->txq); in __ieee80211_wake_txqs()
379 if (!test_and_clear_bit(IEEE80211_TXQ_DIRTY, &txqi->flags) || in __ieee80211_wake_txqs()
380 (ps && atomic_read(&ps->num_sta_ps)) || ac != vif->txq->ac) in __ieee80211_wake_txqs()
383 spin_unlock(&fq->lock); in __ieee80211_wake_txqs()
389 spin_unlock(&fq->lock); in __ieee80211_wake_txqs()
394 __releases(&local->queue_stop_reason_lock)
395 __acquires(&local->queue_stop_reason_lock)
404 if (local->hw.queues < IEEE80211_NUM_ACS) in _ieee80211_wake_txqs()
407 for (i = 0; i < local->hw.queues; i++) { in _ieee80211_wake_txqs()
408 if (local->queue_stop_reasons[i]) in _ieee80211_wake_txqs()
411 spin_unlock_irqrestore(&local->queue_stop_reason_lock, *flags); in _ieee80211_wake_txqs()
412 list_for_each_entry_rcu(sdata, &local->interfaces, list) { in _ieee80211_wake_txqs()
416 int ac_queue = sdata->vif.hw_queue[ac]; in _ieee80211_wake_txqs()
419 sdata->vif.cab_queue == i) in _ieee80211_wake_txqs()
423 spin_lock_irqsave(&local->queue_stop_reason_lock, *flags); in _ieee80211_wake_txqs()
435 spin_lock_irqsave(&local->queue_stop_reason_lock, flags); in ieee80211_wake_txqs()
437 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); in ieee80211_wake_txqs()
449 if (WARN_ON(queue >= hw->queues)) in __ieee80211_wake_queue()
452 if (!test_bit(reason, &local->queue_stop_reasons[queue])) in __ieee80211_wake_queue()
456 local->q_stop_reasons[queue][reason] = 0; in __ieee80211_wake_queue()
458 local->q_stop_reasons[queue][reason]--; in __ieee80211_wake_queue()
459 if (WARN_ON(local->q_stop_reasons[queue][reason] < 0)) in __ieee80211_wake_queue()
460 local->q_stop_reasons[queue][reason] = 0; in __ieee80211_wake_queue()
463 if (local->q_stop_reasons[queue][reason] == 0) in __ieee80211_wake_queue()
464 __clear_bit(reason, &local->queue_stop_reasons[queue]); in __ieee80211_wake_queue()
466 if (local->queue_stop_reasons[queue] != 0) in __ieee80211_wake_queue()
470 if (!skb_queue_empty(&local->pending[queue])) in __ieee80211_wake_queue()
471 tasklet_schedule(&local->tx_pending_tasklet); in __ieee80211_wake_queue()
481 tasklet_schedule(&local->wake_txqs_tasklet); in __ieee80211_wake_queue()
493 spin_lock_irqsave(&local->queue_stop_reason_lock, flags); in ieee80211_wake_queue_by_reason()
495 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); in ieee80211_wake_queue_by_reason()
514 if (WARN_ON(queue >= hw->queues)) in __ieee80211_stop_queue()
518 local->q_stop_reasons[queue][reason] = 1; in __ieee80211_stop_queue()
520 local->q_stop_reasons[queue][reason]++; in __ieee80211_stop_queue()
522 set_bit(reason, &local->queue_stop_reasons[queue]); in __ieee80211_stop_queue()
532 spin_lock_irqsave(&local->queue_stop_reason_lock, flags); in ieee80211_stop_queue_by_reason()
534 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); in ieee80211_stop_queue_by_reason()
548 struct ieee80211_hw *hw = &local->hw; in ieee80211_add_pending_skb()
551 int queue = info->hw_queue; in ieee80211_add_pending_skb()
553 if (WARN_ON(!info->control.vif)) { in ieee80211_add_pending_skb()
554 ieee80211_free_txskb(&local->hw, skb); in ieee80211_add_pending_skb()
558 spin_lock_irqsave(&local->queue_stop_reason_lock, flags); in ieee80211_add_pending_skb()
561 __skb_queue_tail(&local->pending[queue], skb); in ieee80211_add_pending_skb()
564 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); in ieee80211_add_pending_skb()
570 struct ieee80211_hw *hw = &local->hw; in ieee80211_add_pending_skbs()
575 spin_lock_irqsave(&local->queue_stop_reason_lock, flags); in ieee80211_add_pending_skbs()
579 if (WARN_ON(!info->control.vif)) { in ieee80211_add_pending_skbs()
580 ieee80211_free_txskb(&local->hw, skb); in ieee80211_add_pending_skbs()
584 queue = info->hw_queue; in ieee80211_add_pending_skbs()
590 __skb_queue_tail(&local->pending[queue], skb); in ieee80211_add_pending_skbs()
593 for (i = 0; i < hw->queues; i++) in ieee80211_add_pending_skbs()
597 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); in ieee80211_add_pending_skbs()
609 spin_lock_irqsave(&local->queue_stop_reason_lock, flags); in ieee80211_stop_queues_by_reason()
611 for_each_set_bit(i, &queues, hw->queues) in ieee80211_stop_queues_by_reason()
614 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); in ieee80211_stop_queues_by_reason()
631 if (WARN_ON(queue >= hw->queues)) in ieee80211_queue_stopped()
634 spin_lock_irqsave(&local->queue_stop_reason_lock, flags); in ieee80211_queue_stopped()
636 &local->queue_stop_reasons[queue]); in ieee80211_queue_stopped()
637 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); in ieee80211_queue_stopped()
651 spin_lock_irqsave(&local->queue_stop_reason_lock, flags); in ieee80211_wake_queues_by_reason()
653 for_each_set_bit(i, &queues, hw->queues) in ieee80211_wake_queues_by_reason()
656 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); in ieee80211_wake_queues_by_reason()
673 if (sdata && ieee80211_hw_check(&local->hw, QUEUE_CONTROL)) { in ieee80211_get_vif_queues()
679 queues |= BIT(sdata->vif.hw_queue[ac]); in ieee80211_get_vif_queues()
680 if (sdata->vif.cab_queue != IEEE80211_INVAL_HW_QUEUE) in ieee80211_get_vif_queues()
681 queues |= BIT(sdata->vif.cab_queue); in ieee80211_get_vif_queues()
684 queues = BIT(local->hw.queues) - 1; in ieee80211_get_vif_queues()
694 if (!local->ops->flush) in __ieee80211_flush_queues()
699 * IEEE80211_HW_QUEUE_CONTROL - flush all queues in __ieee80211_flush_queues()
701 if (!queues || !ieee80211_hw_check(&local->hw, QUEUE_CONTROL)) in __ieee80211_flush_queues()
704 ieee80211_stop_queues_by_reason(&local->hw, queues, in __ieee80211_flush_queues()
710 ieee80211_wake_queues_by_reason(&local->hw, queues, in __ieee80211_flush_queues()
725 ieee80211_stop_queues_by_reason(&local->hw, in ieee80211_stop_vif_queues()
734 ieee80211_wake_queues_by_reason(&local->hw, in ieee80211_wake_vif_queues()
748 list_for_each_entry_rcu(sdata, &local->interfaces, list) { in __iterate_interfaces()
749 switch (sdata->vif.type) { in __iterate_interfaces()
751 if (!(sdata->u.mntr.flags & MONITOR_FLAG_ACTIVE)) in __iterate_interfaces()
760 active_only && !(sdata->flags & IEEE80211_SDATA_IN_DRIVER)) in __iterate_interfaces()
763 !(sdata->flags & IEEE80211_SDATA_IN_DRIVER)) in __iterate_interfaces()
766 iterator(data, sdata->vif.addr, in __iterate_interfaces()
767 &sdata->vif); in __iterate_interfaces()
770 sdata = rcu_dereference_check(local->monitor_sdata, in __iterate_interfaces()
771 lockdep_is_held(&local->iflist_mtx) || in __iterate_interfaces()
772 lockdep_is_held(&local->hw.wiphy->mtx)); in __iterate_interfaces()
775 sdata->flags & IEEE80211_SDATA_IN_DRIVER)) in __iterate_interfaces()
776 iterator(data, sdata->vif.addr, &sdata->vif); in __iterate_interfaces()
787 mutex_lock(&local->iflist_mtx); in ieee80211_iterate_interfaces()
789 mutex_unlock(&local->iflist_mtx); in ieee80211_iterate_interfaces()
816 lockdep_assert_wiphy(hw->wiphy); in ieee80211_iterate_active_interfaces_mtx()
830 list_for_each_entry_rcu(sta, &local->sta_list, list, in __iterate_stations()
831 lockdep_is_held(&local->hw.wiphy->mtx)) { in __iterate_stations()
832 if (!sta->uploaded) in __iterate_stations()
835 iterator(data, &sta->sta); in __iterate_stations()
859 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_iterate_stations_mtx()
870 !(sdata->flags & IEEE80211_SDATA_IN_DRIVER)) in wdev_to_ieee80211_vif()
872 return &sdata->vif; in wdev_to_ieee80211_vif()
881 return &vif_to_sdata(vif)->wdev; in ieee80211_vif_to_wdev()
887 * the suspend->resume cycle. Since we can't check each caller
896 if (local->quiescing || (local->suspended && !local->resuming)) { in ieee80211_can_queue_work()
911 queue_work(local->workqueue, work); in ieee80211_queue_work()
924 queue_delayed_work(local->workqueue, dwork, delay); in ieee80211_queue_delayed_work()
934 const void *data = elem->data + 1; in ieee80211_parse_extension_element()
938 if (!elem->datalen) in ieee80211_parse_extension_element()
941 len = elem->datalen - 1; in ieee80211_parse_extension_element()
943 switch (elem->data[0]) { in ieee80211_parse_extension_element()
946 if (len >= sizeof(*elems->mu_edca_param_set)) in ieee80211_parse_extension_element()
947 elems->mu_edca_param_set = data; in ieee80211_parse_extension_element()
951 elems->he_cap = data; in ieee80211_parse_extension_element()
952 elems->he_cap_len = len; in ieee80211_parse_extension_element()
957 if (len >= sizeof(*elems->he_operation) && in ieee80211_parse_extension_element()
958 len >= ieee80211_he_oper_size(data) - 1) in ieee80211_parse_extension_element()
959 elems->he_operation = data; in ieee80211_parse_extension_element()
963 elems->uora_element = data; in ieee80211_parse_extension_element()
967 elems->max_channel_switch_time = data; in ieee80211_parse_extension_element()
970 if (len >= sizeof(*elems->mbssid_config_ie)) in ieee80211_parse_extension_element()
971 elems->mbssid_config_ie = data; in ieee80211_parse_extension_element()
974 if (len >= sizeof(*elems->he_spr) && in ieee80211_parse_extension_element()
976 elems->he_spr = data; in ieee80211_parse_extension_element()
979 if (len >= sizeof(*elems->he_6ghz_capa)) in ieee80211_parse_extension_element()
980 elems->he_6ghz_capa = data; in ieee80211_parse_extension_element()
983 if (ieee80211_eht_capa_size_ok(elems->he_cap, in ieee80211_parse_extension_element()
985 params->from_ap)) { in ieee80211_parse_extension_element()
986 elems->eht_cap = data; in ieee80211_parse_extension_element()
987 elems->eht_cap_len = len; in ieee80211_parse_extension_element()
992 elems->eht_operation = data; in ieee80211_parse_extension_element()
1002 switch (le16_get_bits(mle->control, in ieee80211_parse_extension_element()
1005 elems->ml_basic_elem = (void *)elem; in ieee80211_parse_extension_element()
1006 elems->ml_basic = data; in ieee80211_parse_extension_element()
1007 elems->ml_basic_len = len; in ieee80211_parse_extension_element()
1010 elems->ml_reconf_elem = (void *)elem; in ieee80211_parse_extension_element()
1011 elems->ml_reconf = data; in ieee80211_parse_extension_element()
1012 elems->ml_reconf_len = len; 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()
1038 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()
1302 if (ie[1] >= sizeof(*elems->wide_bw_chansw_ie)) in _ieee802_11_parse_elems_full()
1303 elems->wide_bw_chansw_ie = in _ieee802_11_parse_elems_full()
1310 elems->country_elem = pos; in _ieee802_11_parse_elems_full()
1311 elems->country_elem_len = elen; in _ieee802_11_parse_elems_full()
1318 elems->pwr_constr_elem = pos; in _ieee802_11_parse_elems_full()
1341 crc = crc32_be(crc, pos - 2, elen + 2); in _ieee802_11_parse_elems_full()
1343 elems->cisco_dtpc_elem = pos; in _ieee802_11_parse_elems_full()
1350 elems->addba_ext_ie = (void *)pos; in _ieee802_11_parse_elems_full()
1354 elems->timeout_int = (void *)pos; in _ieee802_11_parse_elems_full()
1359 if (elen >= sizeof(*elems->max_idle_period_ie)) in _ieee802_11_parse_elems_full()
1360 elems->max_idle_period_ie = (void *)pos; in _ieee802_11_parse_elems_full()
1363 elems->rsnx = pos; in _ieee802_11_parse_elems_full()
1364 elems->rsnx_len = elen; in _ieee802_11_parse_elems_full()
1371 if (elems->tx_pwr_env_num >= ARRAY_SIZE(elems->tx_pwr_env)) in _ieee802_11_parse_elems_full()
1374 elems->tx_pwr_env[elems->tx_pwr_env_num] = (void *)pos; in _ieee802_11_parse_elems_full()
1375 elems->tx_pwr_env_len[elems->tx_pwr_env_num] = elen; in _ieee802_11_parse_elems_full()
1376 elems->tx_pwr_env_num++; in _ieee802_11_parse_elems_full()
1384 if (elen >= sizeof(*elems->s1g_capab)) in _ieee802_11_parse_elems_full()
1385 elems->s1g_capab = (void *)pos; in _ieee802_11_parse_elems_full()
1390 if (elen == sizeof(*elems->s1g_oper)) in _ieee802_11_parse_elems_full()
1391 elems->s1g_oper = (void *)pos; in _ieee802_11_parse_elems_full()
1396 if (elen == sizeof(*elems->s1g_bcn_compat)) in _ieee802_11_parse_elems_full()
1397 elems->s1g_bcn_compat = (void *)pos; in _ieee802_11_parse_elems_full()
1403 elems->aid_resp = (void *)pos; in _ieee802_11_parse_elems_full()
1412 elems->parse_error = true; in _ieee802_11_parse_elems_full()
1417 if (!for_each_element_completed(elem, params->start, params->len)) in _ieee802_11_parse_elems_full()
1418 elems->parse_error = true; in _ieee802_11_parse_elems_full()
1432 if (!bss || !bss->transmitted_bss) in ieee802_11_find_bssid_profile()
1436 if (elem->datalen < 2) in ieee802_11_find_bssid_profile()
1438 if (elem->data[0] < 1 || elem->data[0] > 8) in ieee802_11_find_bssid_profile()
1441 for_each_element(sub, elem->data + 1, elem->datalen - 1) { in ieee802_11_find_bssid_profile()
1445 if (sub->id != 0 || sub->datalen < 4) { in ieee802_11_find_bssid_profile()
1450 if (sub->data[0] != WLAN_EID_NON_TX_BSSID_CAP || in ieee802_11_find_bssid_profile()
1451 sub->data[1] != 2) { in ieee802_11_find_bssid_profile()
1476 cfg80211_gen_new_bssid(bss->transmitted_bss->bssid, in ieee802_11_find_bssid_profile()
1477 elem->data[0], in ieee802_11_find_bssid_profile()
1480 if (ether_addr_equal(new_bssid, bss->bssid)) { in ieee802_11_find_bssid_profile()
1482 elems->bssid_index_len = index[1]; in ieee802_11_find_bssid_profile()
1483 elems->bssid_index = (void *)&index[2]; in ieee802_11_find_bssid_profile()
1495 const struct ieee80211_multi_link_elem *ml = elems->ml_basic; in ieee80211_mle_get_sta_prof()
1496 ssize_t ml_len = elems->ml_basic_len; in ieee80211_mle_get_sta_prof()
1502 if (le16_get_bits(ml->control, IEEE80211_ML_CONTROL_TYPE) != in ieee80211_mle_get_sta_prof()
1507 struct ieee80211_mle_per_sta_profile *prof = (void *)sub->data; in ieee80211_mle_get_sta_prof()
1511 if (sub->id != IEEE80211_MLE_SUBELEM_PER_STA_PROFILE) in ieee80211_mle_get_sta_prof()
1514 if (!ieee80211_mle_basic_sta_prof_size_ok(sub->data, in ieee80211_mle_get_sta_prof()
1515 sub->datalen)) in ieee80211_mle_get_sta_prof()
1518 control = le16_to_cpu(prof->control); in ieee80211_mle_get_sta_prof()
1531 elems->scratch_pos, in ieee80211_mle_get_sta_prof()
1532 elems->scratch + in ieee80211_mle_get_sta_prof()
1533 elems->scratch_len - in ieee80211_mle_get_sta_prof()
1534 elems->scratch_pos, in ieee80211_mle_get_sta_prof()
1540 elems->prof = (void *)elems->scratch_pos; in ieee80211_mle_get_sta_prof()
1541 elems->sta_prof_len = sta_prof_len; in ieee80211_mle_get_sta_prof()
1542 elems->scratch_pos += sta_prof_len; in ieee80211_mle_get_sta_prof()
1553 .action = params->action, in ieee80211_mle_parse_link()
1554 .from_ap = params->from_ap, in ieee80211_mle_parse_link()
1555 .link_id = -1, in ieee80211_mle_parse_link()
1557 ssize_t ml_len = elems->ml_basic_len; in ieee80211_mle_parse_link()
1561 if (params->link_id == -1) in ieee80211_mle_parse_link()
1564 ml_len = cfg80211_defragment_element(elems->ml_basic_elem, in ieee80211_mle_parse_link()
1565 elems->ie_start, in ieee80211_mle_parse_link()
1566 elems->total_len, in ieee80211_mle_parse_link()
1567 elems->scratch_pos, in ieee80211_mle_parse_link()
1568 elems->scratch + in ieee80211_mle_parse_link()
1569 elems->scratch_len - in ieee80211_mle_parse_link()
1570 elems->scratch_pos, in ieee80211_mle_parse_link()
1576 elems->ml_basic = (const void *)elems->scratch_pos; in ieee80211_mle_parse_link()
1577 elems->ml_basic_len = ml_len; in ieee80211_mle_parse_link()
1579 ieee80211_mle_get_sta_prof(elems, params->link_id); in ieee80211_mle_parse_link()
1580 prof = elems->prof; in ieee80211_mle_parse_link()
1586 if (elems->sta_prof_len < sizeof(*prof) + prof->sta_info_len - 1 + 4) { in ieee80211_mle_parse_link()
1587 elems->prof = NULL; in ieee80211_mle_parse_link()
1588 elems->sta_prof_len = 0; in ieee80211_mle_parse_link()
1595 * the -1 is because the 'sta_info_len' is accounted to as part of the in ieee80211_mle_parse_link()
1596 * per-STA profile, but not part of the 'u8 variable[]' portion. in ieee80211_mle_parse_link()
1598 sub.start = prof->variable + prof->sta_info_len - 1 + 4; in ieee80211_mle_parse_link()
1599 end = (const u8 *)prof + elems->sta_prof_len; in ieee80211_mle_parse_link()
1600 sub.len = end - sub.start; in ieee80211_mle_parse_link()
1614 size_t scratch_len = 3 * params->len; in ieee802_11_parse_elems_full()
1619 elems->ie_start = params->start; in ieee802_11_parse_elems_full()
1620 elems->total_len = params->len; in ieee802_11_parse_elems_full()
1621 elems->scratch_len = scratch_len; in ieee802_11_parse_elems_full()
1622 elems->scratch_pos = elems->scratch; in ieee802_11_parse_elems_full()
1624 nontransmitted_profile = elems->scratch_pos; in ieee802_11_parse_elems_full()
1626 ieee802_11_find_bssid_profile(params->start, params->len, in ieee802_11_parse_elems_full()
1627 elems, params->bss, in ieee802_11_parse_elems_full()
1629 elems->scratch_pos += nontransmitted_profile_len; in ieee802_11_parse_elems_full()
1630 elems->scratch_len -= nontransmitted_profile_len; in ieee802_11_parse_elems_full()
1635 elems->crc = _ieee802_11_parse_elems_full(params, elems, non_inherit); in ieee802_11_parse_elems_full()
1637 /* Override with nontransmitted profile, if found */ in ieee802_11_parse_elems_full()
1642 .action = params->action, in ieee802_11_parse_elems_full()
1643 .link_id = params->link_id, in ieee802_11_parse_elems_full()
1651 if (elems->tim && !elems->parse_error) { in ieee802_11_parse_elems_full()
1652 const struct ieee80211_tim_ie *tim_ie = elems->tim; in ieee802_11_parse_elems_full()
1654 elems->dtim_period = tim_ie->dtim_period; in ieee802_11_parse_elems_full()
1655 elems->dtim_count = tim_ie->dtim_count; in ieee802_11_parse_elems_full()
1658 /* Override DTIM period and count if needed */ in ieee802_11_parse_elems_full()
1659 if (elems->bssid_index && in ieee802_11_parse_elems_full()
1660 elems->bssid_index_len >= in ieee802_11_parse_elems_full()
1662 elems->dtim_period = elems->bssid_index->dtim_period; in ieee802_11_parse_elems_full()
1664 if (elems->bssid_index && in ieee802_11_parse_elems_full()
1665 elems->bssid_index_len >= in ieee802_11_parse_elems_full()
1667 elems->dtim_count = elems->bssid_index->dtim_count; in ieee802_11_parse_elems_full()
1681 if (sdata->vif.type != NL80211_IFTYPE_AP && in ieee80211_regulatory_limit_wmm_params()
1682 sdata->vif.type != NL80211_IFTYPE_STATION) in ieee80211_regulatory_limit_wmm_params()
1686 chanctx_conf = rcu_dereference(sdata->vif.bss_conf.chanctx_conf); in ieee80211_regulatory_limit_wmm_params()
1688 center_freq = chanctx_conf->def.chan->center_freq; in ieee80211_regulatory_limit_wmm_params()
1695 rrule = freq_reg_info(sdata->wdev.wiphy, MHZ_TO_KHZ(center_freq)); in ieee80211_regulatory_limit_wmm_params()
1697 if (IS_ERR_OR_NULL(rrule) || !rrule->has_wmm) { in ieee80211_regulatory_limit_wmm_params()
1702 if (sdata->vif.type == NL80211_IFTYPE_AP) in ieee80211_regulatory_limit_wmm_params()
1703 wmm_ac = &rrule->wmm_rule.ap[ac]; in ieee80211_regulatory_limit_wmm_params()
1705 wmm_ac = &rrule->wmm_rule.client[ac]; in ieee80211_regulatory_limit_wmm_params()
1706 qparam->cw_min = max_t(u16, qparam->cw_min, wmm_ac->cw_min); in ieee80211_regulatory_limit_wmm_params()
1707 qparam->cw_max = max_t(u16, qparam->cw_max, wmm_ac->cw_max); in ieee80211_regulatory_limit_wmm_params()
1708 qparam->aifs = max_t(u8, qparam->aifs, wmm_ac->aifsn); in ieee80211_regulatory_limit_wmm_params()
1709 qparam->txop = min_t(u16, qparam->txop, wmm_ac->cot / 32); in ieee80211_regulatory_limit_wmm_params()
1716 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_set_wmm_default()
1717 struct ieee80211_local *local = sdata->local; in ieee80211_set_wmm_default()
1725 if (!local->ops->conf_tx) in ieee80211_set_wmm_default()
1728 if (local->hw.queues < IEEE80211_NUM_ACS) in ieee80211_set_wmm_default()
1734 chanctx_conf = rcu_dereference(link->conf->chanctx_conf); in ieee80211_set_wmm_default()
1736 chanctx_conf->def.chan->band == NL80211_BAND_2GHZ) && in ieee80211_set_wmm_default()
1737 !link->operating_11g_mode; in ieee80211_set_wmm_default()
1740 is_ocb = (sdata->vif.type == NL80211_IFTYPE_OCB); in ieee80211_set_wmm_default()
1742 /* Set defaults according to 802.11-2007 Table 7-37 */ in ieee80211_set_wmm_default()
1781 qparam.cw_min = (aCWmin + 1) / 2 - 1; in ieee80211_set_wmm_default()
1795 qparam.cw_max = (aCWmin + 1) / 2 - 1; in ieee80211_set_wmm_default()
1796 qparam.cw_min = (aCWmin + 1) / 4 - 1; in ieee80211_set_wmm_default()
1811 link->tx_conf[ac] = qparam; in ieee80211_set_wmm_default()
1815 if (sdata->vif.type != NL80211_IFTYPE_MONITOR && in ieee80211_set_wmm_default()
1816 sdata->vif.type != NL80211_IFTYPE_P2P_DEVICE && in ieee80211_set_wmm_default()
1817 sdata->vif.type != NL80211_IFTYPE_NAN) { in ieee80211_set_wmm_default()
1818 link->conf->qos = enable_qos; in ieee80211_set_wmm_default()
1831 struct ieee80211_local *local = sdata->local; in ieee80211_send_auth()
1834 bool multi_link = ieee80211_vif_is_mld(&sdata->vif); in ieee80211_send_auth()
1843 .len = sizeof(mle) - 2, in ieee80211_send_auth()
1850 memcpy(mle.basic.mld_mac_addr, sdata->vif.addr, ETH_ALEN); in ieee80211_send_auth()
1853 skb = dev_alloc_skb(local->hw.extra_tx_headroom + IEEE80211_WEP_IV_LEN + in ieee80211_send_auth()
1859 skb_reserve(skb, local->hw.extra_tx_headroom + IEEE80211_WEP_IV_LEN); in ieee80211_send_auth()
1862 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | in ieee80211_send_auth()
1864 memcpy(mgmt->da, da, ETH_ALEN); in ieee80211_send_auth()
1865 memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); in ieee80211_send_auth()
1866 memcpy(mgmt->bssid, bssid, ETH_ALEN); in ieee80211_send_auth()
1867 mgmt->u.auth.auth_alg = cpu_to_le16(auth_alg); in ieee80211_send_auth()
1868 mgmt->u.auth.auth_transaction = cpu_to_le16(transaction); in ieee80211_send_auth()
1869 mgmt->u.auth.status_code = cpu_to_le16(status); in ieee80211_send_auth()
1876 mgmt->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); in ieee80211_send_auth()
1884 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT | in ieee80211_send_auth()
1894 struct ieee80211_local *local = sdata->local; in ieee80211_send_deauth_disassoc()
1899 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | stype); in ieee80211_send_deauth_disassoc()
1900 mgmt->duration = 0; /* initialize only */ in ieee80211_send_deauth_disassoc()
1901 mgmt->seq_ctrl = 0; /* initialize only */ in ieee80211_send_deauth_disassoc()
1902 memcpy(mgmt->da, da, ETH_ALEN); in ieee80211_send_deauth_disassoc()
1903 memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); in ieee80211_send_deauth_disassoc()
1904 memcpy(mgmt->bssid, bssid, ETH_ALEN); in ieee80211_send_deauth_disassoc()
1906 mgmt->u.deauth.reason_code = cpu_to_le16(reason); in ieee80211_send_deauth_disassoc()
1909 skb = dev_alloc_skb(local->hw.extra_tx_headroom + in ieee80211_send_deauth_disassoc()
1914 skb_reserve(skb, local->hw.extra_tx_headroom); in ieee80211_send_deauth_disassoc()
1919 if (sdata->vif.type != NL80211_IFTYPE_STATION || in ieee80211_send_deauth_disassoc()
1920 !(sdata->u.mgd.flags & IEEE80211_STA_MFP_ENABLED)) in ieee80211_send_deauth_disassoc()
1921 IEEE80211_SKB_CB(skb)->flags |= in ieee80211_send_deauth_disassoc()
1930 if ((end - pos) < 5) in ieee80211_write_he_6ghz_cap()
1949 struct ieee80211_local *local = sdata->local; in ieee80211_build_preq_ies_band()
1965 sband = local->hw.wiphy->bands[band]; in ieee80211_build_preq_ies_band()
1972 /* For direct scan add S1G IE and consider its override bits */ in ieee80211_build_preq_ies_band()
1974 if (end - pos < 2 + sizeof(struct ieee80211_s1g_cap)) in ieee80211_build_preq_ies_band()
1976 pos = ieee80211_ie_build_s1g_cap(pos, &sband->s1g_cap); in ieee80211_build_preq_ies_band()
1981 for (i = 0; i < sband->n_bitrates; i++) { in ieee80211_build_preq_ies_band()
1984 if ((rate_flags & sband->bitrates[i].flags) != rate_flags) in ieee80211_build_preq_ies_band()
1988 (u8) DIV_ROUND_UP(sband->bitrates[i].bitrate, in ieee80211_build_preq_ies_band()
1994 if (end - pos < 2 + supp_rates_len) in ieee80211_build_preq_ies_band()
2012 if (end - pos < noffset - *offset) in ieee80211_build_preq_ies_band()
2014 memcpy(pos, ie + *offset, noffset - *offset); in ieee80211_build_preq_ies_band()
2015 pos += noffset - *offset; in ieee80211_build_preq_ies_band()
2019 ext_rates_len = num_rates - supp_rates_len; in ieee80211_build_preq_ies_band()
2021 if (end - pos < 2 + ext_rates_len) in ieee80211_build_preq_ies_band()
2029 if (chandef->chan && sband->band == NL80211_BAND_2GHZ) { in ieee80211_build_preq_ies_band()
2030 if (end - pos < 3) in ieee80211_build_preq_ies_band()
2035 chandef->chan->center_freq); in ieee80211_build_preq_ies_band()
2054 if (end - pos < noffset - *offset) in ieee80211_build_preq_ies_band()
2056 memcpy(pos, ie + *offset, noffset - *offset); in ieee80211_build_preq_ies_band()
2057 pos += noffset - *offset; in ieee80211_build_preq_ies_band()
2061 if (sband->ht_cap.ht_supported) { in ieee80211_build_preq_ies_band()
2062 if (end - pos < 2 + sizeof(struct ieee80211_ht_cap)) in ieee80211_build_preq_ies_band()
2064 pos = ieee80211_ie_build_ht_cap(pos, &sband->ht_cap, in ieee80211_build_preq_ies_band()
2065 sband->ht_cap.cap); in ieee80211_build_preq_ies_band()
2081 /* 60 GHz (Multi-band, DMG, MMS) can't happen */ in ieee80211_build_preq_ies_band()
2086 if (end - pos < noffset - *offset) in ieee80211_build_preq_ies_band()
2088 memcpy(pos, ie + *offset, noffset - *offset); in ieee80211_build_preq_ies_band()
2089 pos += noffset - *offset; in ieee80211_build_preq_ies_band()
2094 for (i = 0; i < sband->n_channels; i++) { in ieee80211_build_preq_ies_band()
2095 if (sband->channels[i].flags & (IEEE80211_CHAN_DISABLED | in ieee80211_build_preq_ies_band()
2103 if (sband->vht_cap.vht_supported && have_80mhz) { in ieee80211_build_preq_ies_band()
2104 if (end - pos < 2 + sizeof(struct ieee80211_vht_cap)) in ieee80211_build_preq_ies_band()
2106 pos = ieee80211_ie_build_vht_cap(pos, &sband->vht_cap, in ieee80211_build_preq_ies_band()
2107 sband->vht_cap.cap); in ieee80211_build_preq_ies_band()
2124 if (end - pos < noffset - *offset) in ieee80211_build_preq_ies_band()
2126 memcpy(pos, ie + *offset, noffset - *offset); in ieee80211_build_preq_ies_band()
2127 pos += noffset - *offset; in ieee80211_build_preq_ies_band()
2131 he_cap = ieee80211_get_he_iftype_cap_vif(sband, &sdata->vif); in ieee80211_build_preq_ies_band()
2133 cfg80211_any_usable_channels(local->hw.wiphy, BIT(sband->band), in ieee80211_build_preq_ies_band()
2140 eht_cap = ieee80211_get_eht_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()
2147 sdata->vif.type == NL80211_IFTYPE_AP); in ieee80211_build_preq_ies_band()
2152 if (cfg80211_any_usable_channels(local->hw.wiphy, in ieee80211_build_preq_ies_band()
2157 sband6 = local->hw.wiphy->bands[NL80211_BAND_6GHZ]; in ieee80211_build_preq_ies_band()
2158 he_cap = ieee80211_get_he_iftype_cap_vif(sband6, &sdata->vif); in ieee80211_build_preq_ies_band()
2162 ieee80211_vif_type_p2p(&sdata->vif); in ieee80211_build_preq_ies_band()
2171 * that calculates local->scan_ies_len. in ieee80211_build_preq_ies_band()
2174 return pos - buffer; in ieee80211_build_preq_ies_band()
2178 return pos - buffer; in ieee80211_build_preq_ies_band()
2198 buffer_len - pos, in ieee80211_build_preq_ies()
2204 ie_desc->ies[i] = buffer + old_pos; in ieee80211_build_preq_ies()
2205 ie_desc->len[i] = pos - old_pos; in ieee80211_build_preq_ies()
2212 if (WARN_ONCE(buffer_len - pos < ie_len - custom_ie_offset, in ieee80211_build_preq_ies()
2216 ie_len - custom_ie_offset); in ieee80211_build_preq_ies()
2217 ie_desc->common_ies = buffer + pos; in ieee80211_build_preq_ies()
2218 ie_desc->common_ie_len = ie_len - custom_ie_offset; in ieee80211_build_preq_ies()
2219 pos += ie_len - custom_ie_offset; in ieee80211_build_preq_ies()
2233 struct ieee80211_local *local = sdata->local; in ieee80211_build_probe_req()
2244 * badly-behaved APs don't respond when this parameter is included. in ieee80211_build_probe_req()
2246 chandef.width = sdata->vif.bss_conf.chandef.width; in ieee80211_build_probe_req()
2252 skb = ieee80211_probereq_get(&local->hw, src, ssid, ssid_len, in ieee80211_build_probe_req()
2253 local->scan_ies_len + ie_len); in ieee80211_build_probe_req()
2257 rate_masks[chan->band] = ratemask; in ieee80211_build_probe_req()
2260 ie, ie_len, BIT(chan->band), in ieee80211_build_probe_req()
2265 mgmt = (struct ieee80211_mgmt *) skb->data; in ieee80211_build_probe_req()
2266 memcpy(mgmt->da, dst, ETH_ALEN); in ieee80211_build_probe_req()
2267 memcpy(mgmt->bssid, dst, ETH_ALEN); in ieee80211_build_probe_req()
2270 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; in ieee80211_build_probe_req()
2284 sband = sdata->local->hw.wiphy->bands[band]; in ieee80211_sta_get_rates()
2288 rate_flags = ieee80211_chandef_rate_flags(&sdata->vif.bss_conf.chandef); in ieee80211_sta_get_rates()
2289 shift = ieee80211_vif_get_shift(&sdata->vif); in ieee80211_sta_get_rates()
2291 num_rates = sband->n_bitrates; in ieee80211_sta_get_rates()
2293 for (i = 0; i < elems->supp_rates_len + in ieee80211_sta_get_rates()
2294 elems->ext_supp_rates_len; i++) { in ieee80211_sta_get_rates()
2298 if (i < elems->supp_rates_len) in ieee80211_sta_get_rates()
2299 rate = elems->supp_rates[i]; in ieee80211_sta_get_rates()
2300 else if (elems->ext_supp_rates) in ieee80211_sta_get_rates()
2301 rate = elems->ext_supp_rates in ieee80211_sta_get_rates()
2302 [i - elems->supp_rates_len]; in ieee80211_sta_get_rates()
2311 if ((rate_flags & sband->bitrates[j].flags) in ieee80211_sta_get_rates()
2315 brate = DIV_ROUND_UP(sband->bitrates[j].bitrate, in ieee80211_sta_get_rates()
2337 cancel_work_sync(&local->reconfig_filter); in ieee80211_stop_device()
2339 flush_workqueue(local->workqueue); in ieee80211_stop_device()
2353 if (test_bit(SCAN_COMPLETED, &local->scanning)) { in ieee80211_flush_completed_scan()
2355 * we don't attempt to continue a partial HW scan - which is in ieee80211_flush_completed_scan()
2360 set_bit(SCAN_ABORTED, &local->scanning); in ieee80211_flush_completed_scan()
2361 wiphy_delayed_work_queue(local->hw.wiphy, &local->scan_work, 0); in ieee80211_flush_completed_scan()
2362 wiphy_delayed_work_flush(local->hw.wiphy, &local->scan_work); in ieee80211_flush_completed_scan()
2381 local->resuming = false; in ieee80211_handle_reconfig_failure()
2382 local->suspended = false; in ieee80211_handle_reconfig_failure()
2383 local->in_reconfig = false; in ieee80211_handle_reconfig_failure()
2384 local->reconfig_failure = true; in ieee80211_handle_reconfig_failure()
2393 list_for_each_entry(sdata, &local->interfaces, list) in ieee80211_handle_reconfig_failure()
2394 sdata->flags &= ~IEEE80211_SDATA_IN_DRIVER; in ieee80211_handle_reconfig_failure()
2399 mutex_lock(&local->chanctx_mtx); in ieee80211_handle_reconfig_failure()
2400 list_for_each_entry(ctx, &local->chanctx_list, list) in ieee80211_handle_reconfig_failure()
2401 ctx->driver_present = false; in ieee80211_handle_reconfig_failure()
2402 mutex_unlock(&local->chanctx_mtx); in ieee80211_handle_reconfig_failure()
2412 if (!local->use_chanctx) in ieee80211_assign_chanctx()
2415 mutex_lock(&local->chanctx_mtx); in ieee80211_assign_chanctx()
2416 conf = rcu_dereference_protected(link->conf->chanctx_conf, in ieee80211_assign_chanctx()
2417 lockdep_is_held(&local->chanctx_mtx)); in ieee80211_assign_chanctx()
2420 drv_assign_vif_chanctx(local, sdata, link->conf, ctx); in ieee80211_assign_chanctx()
2422 mutex_unlock(&local->chanctx_mtx); in ieee80211_assign_chanctx()
2427 struct ieee80211_local *local = sdata->local; in ieee80211_reconfig_stations()
2431 mutex_lock(&local->sta_mtx); in ieee80211_reconfig_stations()
2432 list_for_each_entry(sta, &local->sta_list, list) { in ieee80211_reconfig_stations()
2435 if (!sta->uploaded || sta->sdata != sdata) in ieee80211_reconfig_stations()
2439 state < sta->sta_state; state++) in ieee80211_reconfig_stations()
2440 WARN_ON(drv_sta_state(local, sta->sdata, sta, state, in ieee80211_reconfig_stations()
2443 mutex_unlock(&local->sta_mtx); in ieee80211_reconfig_stations()
2451 res = drv_start_nan(sdata->local, sdata, in ieee80211_reconfig_nan()
2452 &sdata->u.nan.conf); in ieee80211_reconfig_nan()
2456 funcs = kcalloc(sdata->local->hw.max_nan_de_entries + 1, in ieee80211_reconfig_nan()
2460 return -ENOMEM; in ieee80211_reconfig_nan()
2466 spin_lock_bh(&sdata->u.nan.func_lock); in ieee80211_reconfig_nan()
2468 idr_for_each_entry(&sdata->u.nan.function_inst_ids, func, id) in ieee80211_reconfig_nan()
2471 spin_unlock_bh(&sdata->u.nan.func_lock); in ieee80211_reconfig_nan()
2474 res = drv_add_nan_func(sdata->local, sdata, funcs[i]); in ieee80211_reconfig_nan()
2476 ieee80211_nan_func_terminated(&sdata->vif, in ieee80211_reconfig_nan()
2477 funcs[i]->instance_id, in ieee80211_reconfig_nan()
2493 for (link_id = 0; link_id < ARRAY_SIZE(sdata->link); link_id++) { in ieee80211_reconfig_ap_links()
2496 if (!(sdata->vif.active_links & BIT(link_id))) in ieee80211_reconfig_ap_links()
2499 link = sdata_dereference(sdata->link[link_id], sdata); in ieee80211_reconfig_ap_links()
2503 if (rcu_access_pointer(link->u.ap.beacon)) in ieee80211_reconfig_ap_links()
2504 drv_start_ap(local, sdata, link->conf); in ieee80211_reconfig_ap_links()
2506 if (!link->conf->enable_beacon) in ieee80211_reconfig_ap_links()
2518 struct ieee80211_hw *hw = &local->hw; in ieee80211_reconfig()
2527 bool suspended = local->suspended; in ieee80211_reconfig()
2531 if (!local->open_count) in ieee80211_reconfig()
2536 local->resuming = true; in ieee80211_reconfig()
2538 if (local->wowlan) { in ieee80211_reconfig()
2542 * clear local->suspended so the device could operate in ieee80211_reconfig()
2545 local->suspended = false; in ieee80211_reconfig()
2547 local->wowlan = false; in ieee80211_reconfig()
2549 local->resuming = false; in ieee80211_reconfig()
2558 * restore local->suspended in this case. in ieee80211_reconfig()
2561 local->suspended = true; in ieee80211_reconfig()
2572 if (suspended && local->in_reconfig && !reconfig_due_to_wowlan) in ieee80211_reconfig()
2573 cancel_work_sync(&local->restart_work); in ieee80211_reconfig()
2575 local->started = false; in ieee80211_reconfig()
2597 drv_set_frag_threshold(local, hw->wiphy->frag_threshold); in ieee80211_reconfig()
2600 drv_set_rts_threshold(local, hw->wiphy->rts_threshold); in ieee80211_reconfig()
2603 drv_set_coverage_class(local, hw->wiphy->coverage_class); in ieee80211_reconfig()
2610 sdata = wiphy_dereference(local->hw.wiphy, local->monitor_sdata); in ieee80211_reconfig()
2613 WARN_ON(local->resuming); in ieee80211_reconfig()
2616 RCU_INIT_POINTER(local->monitor_sdata, NULL); in ieee80211_reconfig()
2622 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_reconfig()
2623 if (sdata->vif.type != NL80211_IFTYPE_AP_VLAN && in ieee80211_reconfig()
2624 sdata->vif.type != NL80211_IFTYPE_MONITOR && in ieee80211_reconfig()
2636 list_for_each_entry_continue_reverse(sdata, &local->interfaces, in ieee80211_reconfig()
2638 if (sdata->vif.type != NL80211_IFTYPE_AP_VLAN && in ieee80211_reconfig()
2639 sdata->vif.type != NL80211_IFTYPE_MONITOR && in ieee80211_reconfig()
2647 if (local->use_chanctx) { in ieee80211_reconfig()
2648 mutex_lock(&local->chanctx_mtx); in ieee80211_reconfig()
2649 list_for_each_entry(ctx, &local->chanctx_list, list) in ieee80211_reconfig()
2650 if (ctx->replace_state != in ieee80211_reconfig()
2653 mutex_unlock(&local->chanctx_mtx); in ieee80211_reconfig()
2655 sdata = wiphy_dereference(local->hw.wiphy, in ieee80211_reconfig()
2656 local->monitor_sdata); in ieee80211_reconfig()
2658 ieee80211_assign_chanctx(local, sdata, &sdata->deflink); in ieee80211_reconfig()
2667 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_reconfig()
2668 /* common change flags for all interface types - link only */ in ieee80211_reconfig()
2688 if (ieee80211_vif_is_mld(&sdata->vif)) { in ieee80211_reconfig()
2690 [0] = &sdata->vif.bss_conf, in ieee80211_reconfig()
2693 if (sdata->vif.type == NL80211_IFTYPE_STATION) { in ieee80211_reconfig()
2695 active_links = sdata->vif.active_links; in ieee80211_reconfig()
2696 link_id = ffs(active_links) - 1; in ieee80211_reconfig()
2697 sdata->vif.active_links = BIT(link_id); in ieee80211_reconfig()
2701 sdata->vif.active_links, in ieee80211_reconfig()
2706 link_id < ARRAY_SIZE(sdata->vif.link_conf); in ieee80211_reconfig()
2708 if (ieee80211_vif_is_mld(&sdata->vif) && in ieee80211_reconfig()
2709 !(sdata->vif.active_links & BIT(link_id))) in ieee80211_reconfig()
2712 link = sdata_dereference(sdata->link[link_id], sdata); in ieee80211_reconfig()
2719 switch (sdata->vif.type) { in ieee80211_reconfig()
2724 if (sdata->vif.cfg.ibss_joined) in ieee80211_reconfig()
2732 drv_conf_tx(local, &sdata->deflink, i, in ieee80211_reconfig()
2733 &sdata->deflink.tx_conf[i]); in ieee80211_reconfig()
2737 if (sdata->vif.bss_conf.mu_mimo_owner) in ieee80211_reconfig()
2740 if (!ieee80211_vif_is_mld(&sdata->vif)) in ieee80211_reconfig()
2743 switch (sdata->vif.type) { in ieee80211_reconfig()
2745 if (!ieee80211_vif_is_mld(&sdata->vif)) { in ieee80211_reconfig()
2750 /* Re-send beacon info report to the driver */ in ieee80211_reconfig()
2751 if (sdata->deflink.u.mgd.have_beacon) in ieee80211_reconfig()
2754 if (sdata->vif.bss_conf.max_idle_period || in ieee80211_reconfig()
2755 sdata->vif.bss_conf.protected_keep_alive) in ieee80211_reconfig()
2758 if (sdata->vif.bss_conf.eht_puncturing) in ieee80211_reconfig()
2783 if (ieee80211_vif_is_mld(&sdata->vif)) in ieee80211_reconfig()
2789 if (sdata->vif.bss_conf.ftm_responder == 1 && in ieee80211_reconfig()
2790 wiphy_ext_feature_isset(sdata->local->hw.wiphy, in ieee80211_reconfig()
2794 if (sdata->vif.type == NL80211_IFTYPE_AP) { in ieee80211_reconfig()
2797 if (ieee80211_vif_is_mld(&sdata->vif)) { in ieee80211_reconfig()
2804 if (rcu_access_pointer(sdata->deflink.u.ap.beacon)) in ieee80211_reconfig()
2806 sdata->deflink.conf); in ieee80211_reconfig()
2810 if (sdata->vif.bss_conf.enable_beacon) { in ieee80211_reconfig()
2840 ieee80211_set_active_links(&sdata->vif, active_links); in ieee80211_reconfig()
2851 if (!(local->hw.conf.flags & IEEE80211_CONF_PS)) { in ieee80211_reconfig()
2852 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_reconfig()
2853 if (sdata->vif.type != NL80211_IFTYPE_STATION) in ieee80211_reconfig()
2855 if (!sdata->u.mgd.associated) in ieee80211_reconfig()
2863 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_reconfig()
2868 switch (sdata->vif.type) { in ieee80211_reconfig()
2880 list_for_each_entry(sdata, &local->interfaces, list) in ieee80211_reconfig()
2884 mutex_lock(&local->mtx); in ieee80211_reconfig()
2885 sched_scan_sdata = rcu_dereference_protected(local->sched_scan_sdata, in ieee80211_reconfig()
2886 lockdep_is_held(&local->mtx)); in ieee80211_reconfig()
2887 sched_scan_req = rcu_dereference_protected(local->sched_scan_req, in ieee80211_reconfig()
2888 lockdep_is_held(&local->mtx)); in ieee80211_reconfig()
2897 if (sched_scan_req->n_scan_plans > 1 || in ieee80211_reconfig()
2900 RCU_INIT_POINTER(local->sched_scan_sdata, NULL); in ieee80211_reconfig()
2901 RCU_INIT_POINTER(local->sched_scan_req, NULL); in ieee80211_reconfig()
2904 mutex_unlock(&local->mtx); in ieee80211_reconfig()
2907 cfg80211_sched_scan_stopped_locked(local->hw.wiphy, 0); in ieee80211_reconfig()
2911 if (local->monitors == local->open_count && local->monitors > 0) in ieee80211_reconfig()
2925 mutex_lock(&local->sta_mtx); in ieee80211_reconfig()
2927 list_for_each_entry(sta, &local->sta_list, list) { in ieee80211_reconfig()
2928 if (!local->resuming) in ieee80211_reconfig()
2934 mutex_unlock(&local->sta_mtx); in ieee80211_reconfig()
2941 if (local->open_count && (!suspended || reconfig_due_to_wowlan)) in ieee80211_reconfig()
2944 if (local->in_reconfig) { in ieee80211_reconfig()
2945 in_reconfig = local->in_reconfig; in ieee80211_reconfig()
2946 local->in_reconfig = false; in ieee80211_reconfig()
2950 mutex_lock(&local->mtx); in ieee80211_reconfig()
2952 mutex_unlock(&local->mtx); in ieee80211_reconfig()
2955 list_for_each_entry(sdata, &local->interfaces, list) in ieee80211_reconfig()
2956 wiphy_work_queue(local->hw.wiphy, &sdata->work); in ieee80211_reconfig()
2964 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_reconfig()
2967 if (sdata->vif.type == NL80211_IFTYPE_STATION) in ieee80211_reconfig()
2977 local->suspended = false; in ieee80211_reconfig()
2979 local->resuming = false; in ieee80211_reconfig()
2983 if (local->open_count && !reconfig_due_to_wowlan) in ieee80211_reconfig()
2986 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_reconfig()
2989 if (sdata->vif.type == NL80211_IFTYPE_STATION) in ieee80211_reconfig()
2993 mod_timer(&local->sta_cleanup, jiffies + 1); in ieee80211_reconfig()
3011 local = sdata->local; in ieee80211_reconfig_disconnect()
3014 !local->resuming)) in ieee80211_reconfig_disconnect()
3018 !local->in_reconfig)) in ieee80211_reconfig_disconnect()
3021 if (WARN_ON(vif->type != NL80211_IFTYPE_STATION)) in ieee80211_reconfig_disconnect()
3024 sdata->flags |= flag; in ieee80211_reconfig_disconnect()
3026 mutex_lock(&local->key_mtx); in ieee80211_reconfig_disconnect()
3027 list_for_each_entry(key, &sdata->key_list, list) in ieee80211_reconfig_disconnect()
3028 key->flags |= KEY_FLAG_TAINTED; in ieee80211_reconfig_disconnect()
3029 mutex_unlock(&local->key_mtx); in ieee80211_reconfig_disconnect()
3047 struct ieee80211_local *local = sdata->local; in ieee80211_recalc_smps()
3051 mutex_lock(&local->chanctx_mtx); in ieee80211_recalc_smps()
3053 chanctx_conf = rcu_dereference_protected(link->conf->chanctx_conf, in ieee80211_recalc_smps()
3054 lockdep_is_held(&local->chanctx_mtx)); in ieee80211_recalc_smps()
3068 mutex_unlock(&local->chanctx_mtx); in ieee80211_recalc_smps()
3074 struct ieee80211_local *local = sdata->local; in ieee80211_recalc_min_chandef()
3079 mutex_lock(&local->chanctx_mtx); in ieee80211_recalc_min_chandef()
3081 for (i = 0; i < ARRAY_SIZE(sdata->vif.link_conf); i++) { in ieee80211_recalc_min_chandef()
3088 bss_conf = rcu_dereference(sdata->vif.link_conf[i]); in ieee80211_recalc_min_chandef()
3094 chanctx_conf = rcu_dereference_protected(bss_conf->chanctx_conf, in ieee80211_recalc_min_chandef()
3095 lockdep_is_held(&local->chanctx_mtx)); in ieee80211_recalc_min_chandef()
3100 * the mutex. Just the way we reached it could - in in ieee80211_recalc_min_chandef()
3101 * theory - go away, but we don't really care and in ieee80211_recalc_min_chandef()
3114 mutex_unlock(&local->chanctx_mtx); in ieee80211_recalc_min_chandef()
3133 memcpy(pos, &s1g_cap->cap, sizeof(s1g_cap->cap)); in ieee80211_ie_build_s1g_cap()
3134 pos += sizeof(s1g_cap->cap); in ieee80211_ie_build_s1g_cap()
3136 memcpy(pos, &s1g_cap->nss_mcs, sizeof(s1g_cap->nss_mcs)); in ieee80211_ie_build_s1g_cap()
3137 pos += sizeof(s1g_cap->nss_mcs); in ieee80211_ie_build_s1g_cap()
3157 *pos++ = ht_cap->ampdu_factor | in ieee80211_ie_build_ht_cap()
3158 (ht_cap->ampdu_density << in ieee80211_ie_build_ht_cap()
3162 memcpy(pos, &ht_cap->mcs, sizeof(ht_cap->mcs)); in ieee80211_ie_build_ht_cap()
3163 pos += sizeof(ht_cap->mcs); in ieee80211_ie_build_ht_cap()
3192 memcpy(pos, &vht_cap->vht_mcs, sizeof(vht_cap->vht_mcs)); in ieee80211_ie_build_vht_cap()
3193 pos += sizeof(vht_cap->vht_mcs); in ieee80211_ie_build_vht_cap()
3212 n = ieee80211_he_mcs_nss_size(&he_cap->he_cap_elem); in ieee80211_ie_len_he_cap()
3214 sizeof(he_cap->he_cap_elem) + n + in ieee80211_ie_len_he_cap()
3215 ieee80211_he_ppe_size(he_cap->ppe_thres[0], in ieee80211_ie_len_he_cap()
3216 he_cap->he_cap_elem.phy_cap_info); in ieee80211_ie_len_he_cap()
3237 elem = he_cap->he_cap_elem; in ieee80211_ie_build_he_cap()
3254 sizeof(he_cap->he_cap_elem) + n + in ieee80211_ie_build_he_cap()
3255 ieee80211_he_ppe_size(he_cap->ppe_thres[0], in ieee80211_ie_build_he_cap()
3256 he_cap->he_cap_elem.phy_cap_info); in ieee80211_ie_build_he_cap()
3258 if ((end - pos) < ie_len) in ieee80211_ie_build_he_cap()
3269 memcpy(pos, &he_cap->he_mcs_nss_supp, n); in ieee80211_ie_build_he_cap()
3273 if ((he_cap->he_cap_elem.phy_cap_info[6] & in ieee80211_ie_build_he_cap()
3281 n = hweight8(he_cap->ppe_thres[0] & in ieee80211_ie_build_he_cap()
3283 n *= (1 + ((he_cap->ppe_thres[0] & IEEE80211_PPE_THRES_NSS_MASK) >> in ieee80211_ie_build_he_cap()
3294 memcpy(pos, &he_cap->ppe_thres, n); in ieee80211_ie_build_he_cap()
3298 orig_pos[1] = (pos - orig_pos) - 2; in ieee80211_ie_build_he_cap()
3308 enum nl80211_iftype iftype = ieee80211_vif_type_p2p(&sdata->vif); in ieee80211_ie_build_he_6ghz_cap()
3312 if (!cfg80211_any_usable_channels(sdata->local->hw.wiphy, in ieee80211_ie_build_he_6ghz_cap()
3317 sband = sdata->local->hw.wiphy->bands[NL80211_BAND_6GHZ]; in ieee80211_ie_build_he_6ghz_cap()
3324 if (!iftd->he_6ghz_capa.capa) in ieee80211_ie_build_he_6ghz_cap()
3327 cap = le16_to_cpu(iftd->he_6ghz_capa.capa); in ieee80211_ie_build_he_6ghz_cap()
3363 ht_oper->primary_chan = ieee80211_frequency_to_channel( in ieee80211_ie_build_ht_oper()
3364 chandef->chan->center_freq); in ieee80211_ie_build_ht_oper()
3365 switch (chandef->width) { in ieee80211_ie_build_ht_oper()
3370 if (chandef->center_freq1 > chandef->chan->center_freq) in ieee80211_ie_build_ht_oper()
3371 ht_oper->ht_param = IEEE80211_HT_PARAM_CHA_SEC_ABOVE; in ieee80211_ie_build_ht_oper()
3373 ht_oper->ht_param = IEEE80211_HT_PARAM_CHA_SEC_BELOW; in ieee80211_ie_build_ht_oper()
3380 ht_oper->ht_param = IEEE80211_HT_PARAM_CHA_SEC_NONE; in ieee80211_ie_build_ht_oper()
3383 if (ht_cap->cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40 && in ieee80211_ie_build_ht_oper()
3384 chandef->width != NL80211_CHAN_WIDTH_20_NOHT && in ieee80211_ie_build_ht_oper()
3385 chandef->width != NL80211_CHAN_WIDTH_20) in ieee80211_ie_build_ht_oper()
3386 ht_oper->ht_param |= IEEE80211_HT_PARAM_CHAN_WIDTH_ANY; in ieee80211_ie_build_ht_oper()
3389 ht_oper->ht_param |= IEEE80211_HT_PARAM_RIFS_MODE; in ieee80211_ie_build_ht_oper()
3391 ht_oper->operation_mode = cpu_to_le16(prot_mode); in ieee80211_ie_build_ht_oper()
3392 ht_oper->stbc_param = 0x0000; in ieee80211_ie_build_ht_oper()
3396 memset(&ht_oper->basic_set, 0, 16); in ieee80211_ie_build_ht_oper()
3397 memcpy(&ht_oper->basic_set, &ht_cap->mcs, 10); in ieee80211_ie_build_ht_oper()
3408 switch (chandef->width) { in ieee80211_ie_build_wide_bw_cs()
3427 *pos++ = ieee80211_frequency_to_channel(chandef->center_freq1); in ieee80211_ie_build_wide_bw_cs()
3429 if (chandef->center_freq2) in ieee80211_ie_build_wide_bw_cs()
3430 *pos++ = ieee80211_frequency_to_channel(chandef->center_freq2); in ieee80211_ie_build_wide_bw_cs()
3443 vht_oper->center_freq_seg0_idx = ieee80211_frequency_to_channel( in ieee80211_ie_build_vht_oper()
3444 chandef->center_freq1); in ieee80211_ie_build_vht_oper()
3445 if (chandef->center_freq2) in ieee80211_ie_build_vht_oper()
3446 vht_oper->center_freq_seg1_idx = in ieee80211_ie_build_vht_oper()
3447 ieee80211_frequency_to_channel(chandef->center_freq2); in ieee80211_ie_build_vht_oper()
3449 vht_oper->center_freq_seg1_idx = 0x00; in ieee80211_ie_build_vht_oper()
3451 switch (chandef->width) { in ieee80211_ie_build_vht_oper()
3457 vht_oper->chan_width = IEEE80211_VHT_CHANWIDTH_80MHZ; in ieee80211_ie_build_vht_oper()
3458 vht_oper->center_freq_seg1_idx = vht_oper->center_freq_seg0_idx; in ieee80211_ie_build_vht_oper()
3459 if (chandef->chan->center_freq < chandef->center_freq1) in ieee80211_ie_build_vht_oper()
3460 vht_oper->center_freq_seg0_idx -= 8; in ieee80211_ie_build_vht_oper()
3462 vht_oper->center_freq_seg0_idx += 8; in ieee80211_ie_build_vht_oper()
3469 vht_oper->chan_width = IEEE80211_VHT_CHANWIDTH_80MHZ; in ieee80211_ie_build_vht_oper()
3472 vht_oper->chan_width = IEEE80211_VHT_CHANWIDTH_80MHZ; in ieee80211_ie_build_vht_oper()
3479 vht_oper->chan_width = IEEE80211_VHT_CHANWIDTH_USE_HT; in ieee80211_ie_build_vht_oper()
3484 vht_oper->basic_mcs_set = cpu_to_le16(0xffff); in ieee80211_ie_build_vht_oper()
3496 if (chandef->chan->band == NL80211_BAND_6GHZ) in ieee80211_ie_build_he_oper()
3510 if (chandef->chan->band == NL80211_BAND_6GHZ) in ieee80211_ie_build_he_oper()
3515 he_oper->he_oper_params = cpu_to_le32(he_oper_params); in ieee80211_ie_build_he_oper()
3518 he_oper->he_mcs_nss_set = cpu_to_le16(0xffff); in ieee80211_ie_build_he_oper()
3521 if (chandef->chan->band != NL80211_BAND_6GHZ) in ieee80211_ie_build_he_oper()
3526 he_6ghz_op->minrate = 6; /* 6 Mbps */ in ieee80211_ie_build_he_oper()
3527 he_6ghz_op->primary = in ieee80211_ie_build_he_oper()
3528 ieee80211_frequency_to_channel(chandef->chan->center_freq); in ieee80211_ie_build_he_oper()
3529 he_6ghz_op->ccfs0 = in ieee80211_ie_build_he_oper()
3530 ieee80211_frequency_to_channel(chandef->center_freq1); in ieee80211_ie_build_he_oper()
3531 if (chandef->center_freq2) in ieee80211_ie_build_he_oper()
3532 he_6ghz_op->ccfs1 = in ieee80211_ie_build_he_oper()
3533 ieee80211_frequency_to_channel(chandef->center_freq2); in ieee80211_ie_build_he_oper()
3535 he_6ghz_op->ccfs1 = 0; in ieee80211_ie_build_he_oper()
3537 switch (chandef->width) { in ieee80211_ie_build_he_oper()
3549 he_6ghz_op->control = in ieee80211_ie_build_he_oper()
3551 he_6ghz_op->ccfs1 = he_6ghz_op->ccfs0; in ieee80211_ie_build_he_oper()
3552 if (chandef->chan->center_freq < chandef->center_freq1) in ieee80211_ie_build_he_oper()
3553 he_6ghz_op->ccfs0 -= 8; in ieee80211_ie_build_he_oper()
3555 he_6ghz_op->ccfs0 += 8; in ieee80211_ie_build_he_oper()
3558 he_6ghz_op->control = in ieee80211_ie_build_he_oper()
3562 he_6ghz_op->control = in ieee80211_ie_build_he_oper()
3566 he_6ghz_op->control = in ieee80211_ie_build_he_oper()
3570 he_6ghz_op->control = in ieee80211_ie_build_he_oper()
3586 &eht_cap->eht_mcs_nss_supp.only_20mhz; in ieee80211_ie_build_eht_oper()
3600 memcpy(&eht_oper->basic_mcs_nss, eht_mcs_nss, sizeof(*eht_mcs_nss)); in ieee80211_ie_build_eht_oper()
3601 eht_oper->params |= IEEE80211_EHT_OPER_INFO_PRESENT; in ieee80211_ie_build_eht_oper()
3605 (struct ieee80211_eht_operation_info *)eht_oper->optional; in ieee80211_ie_build_eht_oper()
3607 eht_oper_info->ccfs0 = in ieee80211_ie_build_eht_oper()
3608 ieee80211_frequency_to_channel(chandef->center_freq1); in ieee80211_ie_build_eht_oper()
3609 if (chandef->center_freq2) in ieee80211_ie_build_eht_oper()
3610 eht_oper_info->ccfs1 = in ieee80211_ie_build_eht_oper()
3611 ieee80211_frequency_to_channel(chandef->center_freq2); in ieee80211_ie_build_eht_oper()
3613 eht_oper_info->ccfs1 = 0; in ieee80211_ie_build_eht_oper()
3615 switch (chandef->width) { in ieee80211_ie_build_eht_oper()
3618 eht_oper_info->ccfs1 = eht_oper_info->ccfs0; in ieee80211_ie_build_eht_oper()
3619 if (chandef->chan->center_freq < chandef->center_freq1) in ieee80211_ie_build_eht_oper()
3620 eht_oper_info->ccfs0 -= 16; in ieee80211_ie_build_eht_oper()
3622 eht_oper_info->ccfs0 += 16; in ieee80211_ie_build_eht_oper()
3625 eht_oper_info->ccfs1 = eht_oper_info->ccfs0; in ieee80211_ie_build_eht_oper()
3626 if (chandef->chan->center_freq < chandef->center_freq1) in ieee80211_ie_build_eht_oper()
3627 eht_oper_info->ccfs0 -= 8; in ieee80211_ie_build_eht_oper()
3629 eht_oper_info->ccfs0 += 8; in ieee80211_ie_build_eht_oper()
3644 eht_oper_info->control = chan_width; in ieee80211_ie_build_eht_oper()
3647 /* TODO: eht_oper_info->optional */ in ieee80211_ie_build_eht_oper()
3660 switch (ht_oper->ht_param & IEEE80211_HT_PARAM_CHA_SEC_OFFSET) { in ieee80211_chandef_ht_oper()
3674 cfg80211_chandef_create(chandef, chandef->chan, channel_type); in ieee80211_chandef_ht_oper()
3698 vht_cap = hw->wiphy->bands[chandef->chan->band]->vht_cap.cap; in ieee80211_chandef_vht_oper()
3707 ccfs0 = oper->center_freq_seg0_idx; in ieee80211_chandef_vht_oper()
3708 ccfs1 = oper->center_freq_seg1_idx; in ieee80211_chandef_vht_oper()
3709 ccfs2 = (le16_to_cpu(htop->operation_mode) & in ieee80211_chandef_vht_oper()
3720 * Cf. IEEE 802.11 Table 9-250 in ieee80211_chandef_vht_oper()
3756 cf0 = ieee80211_channel_to_frequency(ccf0, chandef->chan->band); in ieee80211_chandef_vht_oper()
3757 cf1 = ieee80211_channel_to_frequency(ccf1, chandef->chan->band); in ieee80211_chandef_vht_oper()
3759 switch (oper->chan_width) { in ieee80211_chandef_vht_oper()
3770 diff = abs(ccf1 - ccf0); in ieee80211_chandef_vht_oper()
3806 struct ieee80211_eht_operation_info *info = (void *)eht_oper->optional; in ieee80211_chandef_eht_oper()
3808 chandef->center_freq1 = in ieee80211_chandef_eht_oper()
3809 ieee80211_channel_to_frequency(info->ccfs0, in ieee80211_chandef_eht_oper()
3810 chandef->chan->band); in ieee80211_chandef_eht_oper()
3812 switch (u8_get_bits(info->control, in ieee80211_chandef_eht_oper()
3815 chandef->width = NL80211_CHAN_WIDTH_20; in ieee80211_chandef_eht_oper()
3818 chandef->width = NL80211_CHAN_WIDTH_40; in ieee80211_chandef_eht_oper()
3821 chandef->width = NL80211_CHAN_WIDTH_80; in ieee80211_chandef_eht_oper()
3825 chandef->width = NL80211_CHAN_WIDTH_160; in ieee80211_chandef_eht_oper()
3826 chandef->center_freq1 = in ieee80211_chandef_eht_oper()
3827 ieee80211_channel_to_frequency(info->ccfs1, in ieee80211_chandef_eht_oper()
3828 chandef->chan->band); in ieee80211_chandef_eht_oper()
3830 chandef->width = NL80211_CHAN_WIDTH_80; in ieee80211_chandef_eht_oper()
3835 chandef->width = NL80211_CHAN_WIDTH_320; in ieee80211_chandef_eht_oper()
3836 chandef->center_freq1 = in ieee80211_chandef_eht_oper()
3837 ieee80211_channel_to_frequency(info->ccfs1, in ieee80211_chandef_eht_oper()
3838 chandef->chan->band); in ieee80211_chandef_eht_oper()
3840 chandef->width = NL80211_CHAN_WIDTH_160; in ieee80211_chandef_eht_oper()
3842 chandef->width = NL80211_CHAN_WIDTH_80; in ieee80211_chandef_eht_oper()
3844 if (chandef->center_freq1 > chandef->chan->center_freq) in ieee80211_chandef_eht_oper()
3845 chandef->center_freq1 -= 40; in ieee80211_chandef_eht_oper()
3847 chandef->center_freq1 += 40; in ieee80211_chandef_eht_oper()
3858 struct ieee80211_local *local = sdata->local; in ieee80211_chandef_he_6ghz_oper()
3860 enum nl80211_iftype iftype = ieee80211_vif_type_p2p(&sdata->vif); in ieee80211_chandef_he_6ghz_oper()
3865 struct ieee80211_bss_conf *bss_conf = &sdata->vif.bss_conf; in ieee80211_chandef_he_6ghz_oper()
3870 if (chandef->chan->band != NL80211_BAND_6GHZ) in ieee80211_chandef_he_6ghz_oper()
3873 sband = local->hw.wiphy->bands[NL80211_BAND_6GHZ]; in ieee80211_chandef_he_6ghz_oper()
3881 he_phy_cap = he_cap->he_cap_elem.phy_cap_info[0]; in ieee80211_chandef_he_6ghz_oper()
3892 chandef->chan->center_freq); in ieee80211_chandef_he_6ghz_oper()
3905 chandef->chan->center_freq); in ieee80211_chandef_he_6ghz_oper()
3914 freq = ieee80211_channel_to_frequency(he_6ghz_oper->primary, in ieee80211_chandef_he_6ghz_oper()
3916 he_chandef.chan = ieee80211_get_channel(sdata->local->hw.wiphy, freq); in ieee80211_chandef_he_6ghz_oper()
3918 switch (u8_get_bits(he_6ghz_oper->control, in ieee80211_chandef_he_6ghz_oper()
3921 bss_conf->power_type = IEEE80211_REG_LPI_AP; in ieee80211_chandef_he_6ghz_oper()
3924 bss_conf->power_type = IEEE80211_REG_SP_AP; in ieee80211_chandef_he_6ghz_oper()
3927 bss_conf->power_type = IEEE80211_REG_UNSET_AP; in ieee80211_chandef_he_6ghz_oper()
3932 !(eht_oper->params & IEEE80211_EHT_OPER_INFO_PRESENT)) { in ieee80211_chandef_he_6ghz_oper()
3933 switch (u8_get_bits(he_6ghz_oper->control, in ieee80211_chandef_he_6ghz_oper()
3946 if (!he_6ghz_oper->ccfs1) in ieee80211_chandef_he_6ghz_oper()
3948 if (abs(he_6ghz_oper->ccfs1 - he_6ghz_oper->ccfs0) == 8) { in ieee80211_chandef_he_6ghz_oper()
3960 ieee80211_channel_to_frequency(he_6ghz_oper->ccfs1, in ieee80211_chandef_he_6ghz_oper()
3964 ieee80211_channel_to_frequency(he_6ghz_oper->ccfs0, in ieee80211_chandef_he_6ghz_oper()
3968 ieee80211_channel_to_frequency(he_6ghz_oper->ccfs1, in ieee80211_chandef_he_6ghz_oper()
3972 eht_phy_cap = eht_cap->eht_cap_elem.phy_cap_info[0]; in ieee80211_chandef_he_6ghz_oper()
3983 he_chandef.chan ? he_chandef.chan->center_freq : 0, in ieee80211_chandef_he_6ghz_oper()
4003 switch (FIELD_GET(S1G_OPER_CH_WIDTH_OPER, oper->ch_width)) { in ieee80211_chandef_s1g_oper()
4005 chandef->width = NL80211_CHAN_WIDTH_1; in ieee80211_chandef_s1g_oper()
4008 chandef->width = NL80211_CHAN_WIDTH_2; in ieee80211_chandef_s1g_oper()
4011 chandef->width = NL80211_CHAN_WIDTH_4; in ieee80211_chandef_s1g_oper()
4014 chandef->width = NL80211_CHAN_WIDTH_8; in ieee80211_chandef_s1g_oper()
4017 chandef->width = NL80211_CHAN_WIDTH_16; in ieee80211_chandef_s1g_oper()
4023 oper_freq = ieee80211_channel_to_freq_khz(oper->oper_ch, in ieee80211_chandef_s1g_oper()
4025 chandef->center_freq1 = KHZ_TO_MHZ(oper_freq); in ieee80211_chandef_s1g_oper()
4026 chandef->freq1_offset = oper_freq % 1000; in ieee80211_chandef_s1g_oper()
4045 for (j = 0; j < sband->n_bitrates; j++) { in ieee80211_parse_bitrates()
4046 br = &sband->bitrates[j]; in ieee80211_parse_bitrates()
4047 if ((rate_flags & br->flags) != rate_flags) in ieee80211_parse_bitrates()
4050 brate = DIV_ROUND_UP(br->bitrate, (1 << shift) * 5); in ieee80211_parse_bitrates()
4065 struct ieee80211_local *local = sdata->local; in ieee80211_add_srates_ie()
4069 u32 basic_rates = sdata->vif.bss_conf.basic_rates; in ieee80211_add_srates_ie()
4072 shift = ieee80211_vif_get_shift(&sdata->vif); in ieee80211_add_srates_ie()
4073 rate_flags = ieee80211_chandef_rate_flags(&sdata->vif.bss_conf.chandef); in ieee80211_add_srates_ie()
4074 sband = local->hw.wiphy->bands[band]; in ieee80211_add_srates_ie()
4076 for (i = 0; i < sband->n_bitrates; i++) { in ieee80211_add_srates_ie()
4077 if ((rate_flags & sband->bitrates[i].flags) != rate_flags) in ieee80211_add_srates_ie()
4085 return -ENOMEM; in ieee80211_add_srates_ie()
4092 if ((rate_flags & sband->bitrates[i].flags) != rate_flags) in ieee80211_add_srates_ie()
4097 rate = DIV_ROUND_UP(sband->bitrates[i].bitrate, in ieee80211_add_srates_ie()
4109 struct ieee80211_local *local = sdata->local; in ieee80211_add_ext_srates_ie()
4113 u32 basic_rates = sdata->vif.bss_conf.basic_rates; in ieee80211_add_ext_srates_ie()
4116 rate_flags = ieee80211_chandef_rate_flags(&sdata->vif.bss_conf.chandef); in ieee80211_add_ext_srates_ie()
4117 shift = ieee80211_vif_get_shift(&sdata->vif); in ieee80211_add_ext_srates_ie()
4119 sband = local->hw.wiphy->bands[band]; in ieee80211_add_ext_srates_ie()
4121 for (i = 0; i < sband->n_bitrates; i++) { in ieee80211_add_ext_srates_ie()
4122 if ((rate_flags & sband->bitrates[i].flags) != rate_flags) in ieee80211_add_ext_srates_ie()
4128 exrates -= 8; in ieee80211_add_ext_srates_ie()
4133 return -ENOMEM; in ieee80211_add_ext_srates_ie()
4139 for (i = 8; i < sband->n_bitrates; i++) { in ieee80211_add_ext_srates_ie()
4141 if ((rate_flags & sband->bitrates[i].flags) in ieee80211_add_ext_srates_ie()
4146 rate = DIV_ROUND_UP(sband->bitrates[i].bitrate, in ieee80211_add_ext_srates_ie()
4158 if (WARN_ON_ONCE(sdata->vif.type != NL80211_IFTYPE_STATION)) in ieee80211_ave_rssi()
4161 return -ewma_beacon_signal_read(&sdata->deflink.u.mgd.ave_beacon_signal); in ieee80211_ave_rssi()
4172 if (mcs->rx_mask[3]) in ieee80211_mcs_to_chains()
4174 if (mcs->rx_mask[2]) in ieee80211_mcs_to_chains()
4176 if (mcs->rx_mask[1]) in ieee80211_mcs_to_chains()
4182 * ieee80211_calculate_rx_timestamp - calculate timestamp in frame
4197 u64 ts = status->mactime; in ieee80211_calculate_rx_timestamp()
4198 struct rate_info ri; in ieee80211_calculate_rx_timestamp() local
4205 memset(&ri, 0, sizeof(ri)); in ieee80211_calculate_rx_timestamp()
4207 ri.bw = status->bw; in ieee80211_calculate_rx_timestamp()
4210 switch (status->encoding) { in ieee80211_calculate_rx_timestamp()
4212 ri.flags |= RATE_INFO_FLAGS_EHT_MCS; in ieee80211_calculate_rx_timestamp()
4213 ri.mcs = status->rate_idx; in ieee80211_calculate_rx_timestamp()
4214 ri.nss = status->nss; in ieee80211_calculate_rx_timestamp()
4215 ri.eht_ru_alloc = status->eht.ru; in ieee80211_calculate_rx_timestamp()
4216 if (status->enc_flags & RX_ENC_FLAG_SHORT_GI) in ieee80211_calculate_rx_timestamp()
4217 ri.flags |= RATE_INFO_FLAGS_SHORT_GI; in ieee80211_calculate_rx_timestamp()
4219 if (status->flag & RX_FLAG_MACTIME_PLCP_START) { in ieee80211_calculate_rx_timestamp()
4225 ri.flags |= RATE_INFO_FLAGS_HE_MCS; in ieee80211_calculate_rx_timestamp()
4226 ri.mcs = status->rate_idx; in ieee80211_calculate_rx_timestamp()
4227 ri.nss = status->nss; in ieee80211_calculate_rx_timestamp()
4228 ri.he_ru_alloc = status->he_ru; in ieee80211_calculate_rx_timestamp()
4229 if (status->enc_flags & RX_ENC_FLAG_SHORT_GI) in ieee80211_calculate_rx_timestamp()
4230 ri.flags |= RATE_INFO_FLAGS_SHORT_GI; in ieee80211_calculate_rx_timestamp()
4236 if (status->flag & RX_FLAG_MACTIME_PLCP_START) { in ieee80211_calculate_rx_timestamp()
4242 * For HE MU PPDU, add the HE-SIG-B. in ieee80211_calculate_rx_timestamp()
4243 * For HE ER PPDU, add 8us for the HE-SIG-A. in ieee80211_calculate_rx_timestamp()
4244 * For HE TB PPDU, add 4us for the HE-STF. in ieee80211_calculate_rx_timestamp()
4245 * Add the HE-LTF durations - variable. in ieee80211_calculate_rx_timestamp()
4251 ri.mcs = status->rate_idx; in ieee80211_calculate_rx_timestamp()
4252 ri.flags |= RATE_INFO_FLAGS_MCS; in ieee80211_calculate_rx_timestamp()
4253 if (status->enc_flags & RX_ENC_FLAG_SHORT_GI) in ieee80211_calculate_rx_timestamp()
4254 ri.flags |= RATE_INFO_FLAGS_SHORT_GI; in ieee80211_calculate_rx_timestamp()
4260 if (status->flag & RX_FLAG_MACTIME_PLCP_START) { in ieee80211_calculate_rx_timestamp()
4262 if (status->enc_flags & RX_ENC_FLAG_HT_GF) in ieee80211_calculate_rx_timestamp()
4268 * Add Data HT-LTFs per streams in ieee80211_calculate_rx_timestamp()
4269 * TODO: add Extension HT-LTFs, 4us per LTF in ieee80211_calculate_rx_timestamp()
4271 n_ltf = ((ri.mcs >> 3) & 3) + 1; in ieee80211_calculate_rx_timestamp()
4278 ri.flags |= RATE_INFO_FLAGS_VHT_MCS; in ieee80211_calculate_rx_timestamp()
4279 ri.mcs = status->rate_idx; in ieee80211_calculate_rx_timestamp()
4280 ri.nss = status->nss; in ieee80211_calculate_rx_timestamp()
4281 if (status->enc_flags & RX_ENC_FLAG_SHORT_GI) in ieee80211_calculate_rx_timestamp()
4282 ri.flags |= RATE_INFO_FLAGS_SHORT_GI; in ieee80211_calculate_rx_timestamp()
4288 if (status->flag & RX_FLAG_MACTIME_PLCP_START) { in ieee80211_calculate_rx_timestamp()
4293 * Add VHT-LTFs per streams in ieee80211_calculate_rx_timestamp()
4295 n_ltf = (ri.nss != 1) && (ri.nss % 2) ? in ieee80211_calculate_rx_timestamp()
4296 ri.nss + 1 : ri.nss; in ieee80211_calculate_rx_timestamp()
4309 switch (status->bw) { in ieee80211_calculate_rx_timestamp()
4318 sband = local->hw.wiphy->bands[status->band]; in ieee80211_calculate_rx_timestamp()
4319 bitrate = sband->bitrates[status->rate_idx].bitrate; in ieee80211_calculate_rx_timestamp()
4320 ri.legacy = DIV_ROUND_UP(bitrate, (1 << shift)); in ieee80211_calculate_rx_timestamp()
4322 if (status->flag & RX_FLAG_MACTIME_PLCP_START) { in ieee80211_calculate_rx_timestamp()
4323 if (status->band == NL80211_BAND_5GHZ) { in ieee80211_calculate_rx_timestamp()
4326 } else if (status->enc_flags & RX_ENC_FLAG_SHORTPRE) { in ieee80211_calculate_rx_timestamp()
4336 rate = cfg80211_calculate_bitrate(&ri); in ieee80211_calculate_rx_timestamp()
4339 (unsigned long long)status->flag, status->rate_idx, in ieee80211_calculate_rx_timestamp()
4340 status->nss)) in ieee80211_calculate_rx_timestamp()
4344 if (status->flag & RX_FLAG_MACTIME_END) in ieee80211_calculate_rx_timestamp()
4345 ts -= mpdu_len * 8 * 10 / rate; in ieee80211_calculate_rx_timestamp()
4358 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_dfs_cac_cancel()
4360 mutex_lock(&local->mtx); in ieee80211_dfs_cac_cancel()
4361 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_dfs_cac_cancel()
4362 /* it might be waiting for the local->mtx, but then in ieee80211_dfs_cac_cancel()
4363 * by the time it gets it, sdata->wdev.cac_started in ieee80211_dfs_cac_cancel()
4366 cancel_delayed_work(&sdata->deflink.dfs_cac_timer_work); in ieee80211_dfs_cac_cancel()
4368 if (sdata->wdev.cac_started) { in ieee80211_dfs_cac_cancel()
4369 chandef = sdata->vif.bss_conf.chandef; in ieee80211_dfs_cac_cancel()
4370 ieee80211_link_release_channel(&sdata->deflink); in ieee80211_dfs_cac_cancel()
4371 cfg80211_cac_event(sdata->dev, in ieee80211_dfs_cac_cancel()
4377 mutex_unlock(&local->mtx); in ieee80211_dfs_cac_cancel()
4385 struct cfg80211_chan_def chandef = local->hw.conf.chandef; in ieee80211_dfs_radar_detected_work()
4389 mutex_lock(&local->chanctx_mtx); in ieee80211_dfs_radar_detected_work()
4390 list_for_each_entry(ctx, &local->chanctx_list, list) { in ieee80211_dfs_radar_detected_work()
4391 if (ctx->replace_state == IEEE80211_CHANCTX_REPLACES_OTHER) in ieee80211_dfs_radar_detected_work()
4395 chandef = ctx->conf.def; in ieee80211_dfs_radar_detected_work()
4397 mutex_unlock(&local->chanctx_mtx); in ieee80211_dfs_radar_detected_work()
4402 /* XXX: multi-channel is not supported yet */ in ieee80211_dfs_radar_detected_work()
4405 cfg80211_radar_event(local->hw.wiphy, &chandef, GFP_KERNEL); in ieee80211_dfs_radar_detected_work()
4414 wiphy_work_queue(hw->wiphy, &local->radar_detected_work); in ieee80211_radar_detected()
4423 switch (c->width) { in ieee80211_chandef_downgrade()
4425 c->width = NL80211_CHAN_WIDTH_20_NOHT; in ieee80211_chandef_downgrade()
4429 c->width = NL80211_CHAN_WIDTH_20; in ieee80211_chandef_downgrade()
4430 c->center_freq1 = c->chan->center_freq; in ieee80211_chandef_downgrade()
4435 tmp = (30 + c->chan->center_freq - c->center_freq1)/20; in ieee80211_chandef_downgrade()
4439 c->center_freq1 = c->center_freq1 - 20 + 40 * tmp; in ieee80211_chandef_downgrade()
4440 c->width = NL80211_CHAN_WIDTH_40; in ieee80211_chandef_downgrade()
4444 c->center_freq2 = 0; in ieee80211_chandef_downgrade()
4445 c->width = NL80211_CHAN_WIDTH_80; in ieee80211_chandef_downgrade()
4451 tmp = (70 + c->chan->center_freq - c->center_freq1)/20; in ieee80211_chandef_downgrade()
4454 c->center_freq1 = c->center_freq1 - 40 + 80 * tmp; in ieee80211_chandef_downgrade()
4455 c->width = NL80211_CHAN_WIDTH_80; in ieee80211_chandef_downgrade()
4461 tmp = (150 + c->chan->center_freq - c->center_freq1) / 20; in ieee80211_chandef_downgrade()
4464 c->center_freq1 = c->center_freq1 - 80 + 160 * tmp; in ieee80211_chandef_downgrade()
4465 c->width = NL80211_CHAN_WIDTH_160; in ieee80211_chandef_downgrade()
4471 c->width = NL80211_CHAN_WIDTH_20_NOHT; in ieee80211_chandef_downgrade()
4482 /* keep c->width */ in ieee80211_chandef_downgrade()
4522 struct ieee80211_local *local = sdata->local; in ieee80211_send_action_csa()
4528 if (sdata->vif.type != NL80211_IFTYPE_ADHOC && in ieee80211_send_action_csa()
4529 sdata->vif.type != NL80211_IFTYPE_MESH_POINT) in ieee80211_send_action_csa()
4530 return -EOPNOTSUPP; in ieee80211_send_action_csa()
4532 skb = dev_alloc_skb(local->tx_headroom + hdr_len + in ieee80211_send_action_csa()
4538 return -ENOMEM; in ieee80211_send_action_csa()
4540 skb_reserve(skb, local->tx_headroom); in ieee80211_send_action_csa()
4542 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | in ieee80211_send_action_csa()
4545 eth_broadcast_addr(mgmt->da); in ieee80211_send_action_csa()
4546 memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); in ieee80211_send_action_csa()
4547 if (ieee80211_vif_is_mesh(&sdata->vif)) { in ieee80211_send_action_csa()
4548 memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN); in ieee80211_send_action_csa()
4550 struct ieee80211_if_ibss *ifibss = &sdata->u.ibss; in ieee80211_send_action_csa()
4551 memcpy(mgmt->bssid, ifibss->bssid, ETH_ALEN); in ieee80211_send_action_csa()
4553 mgmt->u.action.category = WLAN_CATEGORY_SPECTRUM_MGMT; in ieee80211_send_action_csa()
4554 mgmt->u.action.u.chan_switch.action_code = WLAN_ACTION_SPCT_CHL_SWITCH; in ieee80211_send_action_csa()
4558 *pos++ = csa_settings->block_tx ? 1 : 0; /* CSA mode */ in ieee80211_send_action_csa()
4559 freq = csa_settings->chandef.chan->center_freq; in ieee80211_send_action_csa()
4561 *pos++ = csa_settings->count; /* count */ in ieee80211_send_action_csa()
4563 if (csa_settings->chandef.width == NL80211_CHAN_WIDTH_40) { in ieee80211_send_action_csa()
4569 ch_type = cfg80211_get_chandef_type(&csa_settings->chandef); in ieee80211_send_action_csa()
4576 if (ieee80211_vif_is_mesh(&sdata->vif)) { in ieee80211_send_action_csa()
4577 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; in ieee80211_send_action_csa()
4582 *pos++ = sdata->u.mesh.mshcfg.dot11MeshTTL; /* Mesh TTL */ in ieee80211_send_action_csa()
4585 *pos++ |= csa_settings->block_tx ? in ieee80211_send_action_csa()
4589 put_unaligned_le16(ifmsh->pre_value, pos);/* Precedence Value */ in ieee80211_send_action_csa()
4593 if (csa_settings->chandef.width == NL80211_CHAN_WIDTH_80 || in ieee80211_send_action_csa()
4594 csa_settings->chandef.width == NL80211_CHAN_WIDTH_80P80 || in ieee80211_send_action_csa()
4595 csa_settings->chandef.width == NL80211_CHAN_WIDTH_160) { in ieee80211_send_action_csa()
4597 ieee80211_ie_build_wide_bw_cs(pos, &csa_settings->chandef); in ieee80211_send_action_csa()
4607 s32 end = data->desc[i].start + data->desc[i].duration - (tsf + 1); in ieee80211_extend_noa_desc()
4614 if (data->count[i] == 1) in ieee80211_extend_noa_desc()
4617 if (data->desc[i].interval == 0) in ieee80211_extend_noa_desc()
4621 skip = DIV_ROUND_UP(-end, data->desc[i].interval); in ieee80211_extend_noa_desc()
4622 if (data->count[i] < 255) { in ieee80211_extend_noa_desc()
4623 if (data->count[i] <= skip) { in ieee80211_extend_noa_desc()
4624 data->count[i] = 0; in ieee80211_extend_noa_desc()
4628 data->count[i] -= skip; in ieee80211_extend_noa_desc()
4631 data->desc[i].start += skip * data->desc[i].interval; in ieee80211_extend_noa_desc()
4646 if (!data->count[i]) in ieee80211_extend_absent_time()
4652 cur = data->desc[i].start - tsf; in ieee80211_extend_absent_time()
4656 cur = data->desc[i].start + data->desc[i].duration - tsf; in ieee80211_extend_absent_time()
4688 u32 next_offset = BIT(31) - 1; in ieee80211_update_p2p_noa()
4691 data->absent = 0; in ieee80211_update_p2p_noa()
4692 data->has_next_tsf = false; in ieee80211_update_p2p_noa()
4696 if (!data->count[i]) in ieee80211_update_p2p_noa()
4700 start = data->desc[i].start - tsf; in ieee80211_update_p2p_noa()
4702 data->absent |= BIT(i); in ieee80211_update_p2p_noa()
4707 data->has_next_tsf = true; in ieee80211_update_p2p_noa()
4710 if (data->absent) in ieee80211_update_p2p_noa()
4713 data->next_tsf = tsf + next_offset; in ieee80211_update_p2p_noa()
4726 const struct ieee80211_p2p_noa_desc *desc = &attr->desc[i]; in ieee80211_parse_p2p_noa()
4728 if (!desc->count || !desc->duration) in ieee80211_parse_p2p_noa()
4731 data->count[i] = desc->count; in ieee80211_parse_p2p_noa()
4732 data->desc[i].start = le32_to_cpu(desc->start_time); in ieee80211_parse_p2p_noa()
4733 data->desc[i].duration = le32_to_cpu(desc->duration); in ieee80211_parse_p2p_noa()
4734 data->desc[i].interval = le32_to_cpu(desc->interval); in ieee80211_parse_p2p_noa()
4736 if (data->count[i] > 1 && in ieee80211_parse_p2p_noa()
4737 data->desc[i].interval < data->desc[i].duration) in ieee80211_parse_p2p_noa()
4756 u32 beacon_int = sdata->vif.bss_conf.beacon_int * 1024; in ieee80211_recalc_dtim()
4757 u8 dtim_period = sdata->vif.bss_conf.dtim_period; in ieee80211_recalc_dtim()
4761 if (tsf == -1ULL || !beacon_int || !dtim_period) in ieee80211_recalc_dtim()
4764 if (sdata->vif.type == NL80211_IFTYPE_AP || in ieee80211_recalc_dtim()
4765 sdata->vif.type == NL80211_IFTYPE_AP_VLAN) { in ieee80211_recalc_dtim()
4766 if (!sdata->bss) in ieee80211_recalc_dtim()
4769 ps = &sdata->bss->ps; in ieee80211_recalc_dtim()
4770 } else if (ieee80211_vif_is_mesh(&sdata->vif)) { in ieee80211_recalc_dtim()
4771 ps = &sdata->u.mesh.ps; in ieee80211_recalc_dtim()
4779 * dtim_count = dtim_period - (tsf / bcn_int) % dtim_period in ieee80211_recalc_dtim()
4787 dtim_count = dtim_period - bcns_from_dtim; in ieee80211_recalc_dtim()
4789 ps->dtim_count = dtim_count; in ieee80211_recalc_dtim()
4798 lockdep_assert_held(&local->chanctx_mtx); in ieee80211_chanctx_radar_detect()
4800 if (WARN_ON(ctx->replace_state == IEEE80211_CHANCTX_WILL_BE_REPLACED)) in ieee80211_chanctx_radar_detect()
4803 list_for_each_entry(link, &ctx->reserved_links, reserved_chanctx_list) in ieee80211_chanctx_radar_detect()
4804 if (link->reserved_radar_required) in ieee80211_chanctx_radar_detect()
4805 radar_detect |= BIT(link->reserved_chandef.width); in ieee80211_chanctx_radar_detect()
4808 * An in-place reservation context should not have any assigned vifs in ieee80211_chanctx_radar_detect()
4811 WARN_ON(ctx->replace_state == IEEE80211_CHANCTX_REPLACES_OTHER && in ieee80211_chanctx_radar_detect()
4812 !list_empty(&ctx->assigned_links)); in ieee80211_chanctx_radar_detect()
4814 list_for_each_entry(link, &ctx->assigned_links, assigned_chanctx_list) { in ieee80211_chanctx_radar_detect()
4815 if (!link->radar_required) in ieee80211_chanctx_radar_detect()
4819 BIT(link->conf->chandef.width); in ieee80211_chanctx_radar_detect()
4830 struct ieee80211_local *local = sdata->local; in ieee80211_check_combinations()
4832 enum nl80211_iftype iftype = sdata->wdev.iftype; in ieee80211_check_combinations()
4839 lockdep_assert_held(&local->chanctx_mtx); in ieee80211_check_combinations()
4842 return -EINVAL; in ieee80211_check_combinations()
4845 !chandef->chan)) in ieee80211_check_combinations()
4846 return -EINVAL; in ieee80211_check_combinations()
4849 return -EINVAL; in ieee80211_check_combinations()
4851 if (sdata->vif.type == NL80211_IFTYPE_AP || in ieee80211_check_combinations()
4852 sdata->vif.type == NL80211_IFTYPE_MESH_POINT) { in ieee80211_check_combinations()
4858 params.new_beacon_int = sdata->vif.bss_conf.beacon_int; in ieee80211_check_combinations()
4862 if (cfg80211_iftype_allowed(local->hw.wiphy, iftype, 0, 1)) { in ieee80211_check_combinations()
4864 return -EINVAL; in ieee80211_check_combinations()
4874 list_for_each_entry(ctx, &local->chanctx_list, list) { in ieee80211_check_combinations()
4875 if (ctx->replace_state == IEEE80211_CHANCTX_WILL_BE_REPLACED) in ieee80211_check_combinations()
4879 if (ctx->mode == IEEE80211_CHANCTX_EXCLUSIVE) { in ieee80211_check_combinations()
4885 &ctx->conf.def)) in ieee80211_check_combinations()
4890 list_for_each_entry_rcu(sdata_iter, &local->interfaces, list) { in ieee80211_check_combinations()
4893 wdev_iter = &sdata_iter->wdev; in ieee80211_check_combinations()
4897 cfg80211_iftype_allowed(local->hw.wiphy, in ieee80211_check_combinations()
4898 wdev_iter->iftype, 0, 1)) in ieee80211_check_combinations()
4901 params.iftype_num[wdev_iter->iftype]++; in ieee80211_check_combinations()
4908 return cfg80211_check_combinations(local->hw.wiphy, ¶ms); in ieee80211_check_combinations()
4918 c->num_different_channels); in ieee80211_iter_max_chans()
4929 lockdep_assert_held(&local->chanctx_mtx); in ieee80211_max_num_channels()
4931 list_for_each_entry(ctx, &local->chanctx_list, list) { in ieee80211_max_num_channels()
4932 if (ctx->replace_state == IEEE80211_CHANCTX_WILL_BE_REPLACED) in ieee80211_max_num_channels()
4941 list_for_each_entry_rcu(sdata, &local->interfaces, list) in ieee80211_max_num_channels()
4942 params.iftype_num[sdata->wdev.iftype]++; in ieee80211_max_num_channels()
4944 err = cfg80211_iter_combinations(local->hw.wiphy, ¶ms, in ieee80211_max_num_channels()
4957 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_add_s1g_capab_ie()
4962 if (WARN_ON(sdata->vif.type != NL80211_IFTYPE_STATION)) in ieee80211_add_s1g_capab_ie()
4965 if (!caps->s1g) in ieee80211_add_s1g_capab_ie()
4968 memcpy(s1g_capab.capab_info, caps->cap, sizeof(caps->cap)); in ieee80211_add_s1g_capab_ie()
4969 memcpy(s1g_capab.supp_mcs_nss, caps->nss_mcs, sizeof(caps->nss_mcs)); in ieee80211_add_s1g_capab_ie()
4971 /* override the capability info */ in ieee80211_add_s1g_capab_ie()
4972 for (i = 0; i < sizeof(ifmgd->s1g_capa.capab_info); i++) { in ieee80211_add_s1g_capab_ie()
4973 u8 mask = ifmgd->s1g_capa_mask.capab_info[i]; in ieee80211_add_s1g_capab_ie()
4976 s1g_capab.capab_info[i] |= ifmgd->s1g_capa.capab_info[i] & mask; in ieee80211_add_s1g_capab_ie()
4980 for (i = 0; i < sizeof(ifmgd->s1g_capa.supp_mcs_nss); i++) { in ieee80211_add_s1g_capab_ie()
4981 u8 mask = ifmgd->s1g_capa_mask.supp_mcs_nss[i]; in ieee80211_add_s1g_capab_ie()
4985 ifmgd->s1g_capa.supp_mcs_nss[i] & mask; in ieee80211_add_s1g_capab_ie()
5015 *buf++ = qosinfo; /* U-APSD no in use */ in ieee80211_add_wmm_info_ie()
5028 skb_queue_walk(&txqi->frags, skb) { in ieee80211_txq_get_depth()
5030 frag_bytes += skb->len; in ieee80211_txq_get_depth()
5034 *frame_cnt = txqi->tin.backlog_packets + frag_cnt; in ieee80211_txq_get_depth()
5037 *byte_cnt = txqi->tin.backlog_bytes + frag_bytes; in ieee80211_txq_get_depth()
5089 n = ieee80211_eht_mcs_nss_size(&he_cap->he_cap_elem, in ieee80211_ie_len_eht_cap()
5090 &eht_cap->eht_cap_elem, in ieee80211_ie_len_eht_cap()
5093 sizeof(eht_cap->eht_cap_elem) + n + in ieee80211_ie_len_eht_cap()
5094 ieee80211_eht_ppe_size(eht_cap->eht_ppe_thres[0], in ieee80211_ie_len_eht_cap()
5095 eht_cap->eht_cap_elem.phy_cap_info); in ieee80211_ie_len_eht_cap()
5113 mcs_nss_len = ieee80211_eht_mcs_nss_size(&he_cap->he_cap_elem, in ieee80211_ie_build_eht_cap()
5114 &eht_cap->eht_cap_elem, in ieee80211_ie_build_eht_cap()
5116 ppet_len = ieee80211_eht_ppe_size(eht_cap->eht_ppe_thres[0], in ieee80211_ie_build_eht_cap()
5117 eht_cap->eht_cap_elem.phy_cap_info); in ieee80211_ie_build_eht_cap()
5119 ie_len = 2 + 1 + sizeof(eht_cap->eht_cap_elem) + mcs_nss_len + ppet_len; in ieee80211_ie_build_eht_cap()
5120 if ((end - pos) < ie_len) in ieee80211_ie_build_eht_cap()
5124 *pos++ = ie_len - 2; in ieee80211_ie_build_eht_cap()
5128 memcpy(pos, &eht_cap->eht_cap_elem, sizeof(eht_cap->eht_cap_elem)); in ieee80211_ie_build_eht_cap()
5129 pos += sizeof(eht_cap->eht_cap_elem); in ieee80211_ie_build_eht_cap()
5131 memcpy(pos, &eht_cap->eht_mcs_nss_supp, mcs_nss_len); in ieee80211_ie_build_eht_cap()
5135 memcpy(pos, &eht_cap->eht_ppe_thres, ppet_len); in ieee80211_ie_build_eht_cap()
5149 elem_len = skb->data + skb->len - len_pos - 1; in ieee80211_fragment_element()
5155 elem_len -= 255; in ieee80211_fragment_element()