• Home
  • Raw
  • Download

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 if (!sta->uploaded) in __iterate_stations()
834 iterator(data, &sta->sta); in __iterate_stations()
856 !(sdata->flags & IEEE80211_SDATA_IN_DRIVER)) in wdev_to_ieee80211_vif()
858 return &sdata->vif; in wdev_to_ieee80211_vif()
867 return &vif_to_sdata(vif)->wdev; in ieee80211_vif_to_wdev()
873 * the suspend->resume cycle. Since we can't check each caller
882 if (local->quiescing || (local->suspended && !local->resuming)) { in ieee80211_can_queue_work()
897 queue_work(local->workqueue, work); in ieee80211_queue_work()
910 queue_delayed_work(local->workqueue, dwork, delay); in ieee80211_queue_delayed_work()
920 const void *data = elem->data + 1; in ieee80211_parse_extension_element()
924 if (!elem->datalen) in ieee80211_parse_extension_element()
927 len = elem->datalen - 1; in ieee80211_parse_extension_element()
929 switch (elem->data[0]) { in ieee80211_parse_extension_element()
932 if (len >= sizeof(*elems->mu_edca_param_set)) in ieee80211_parse_extension_element()
933 elems->mu_edca_param_set = data; in ieee80211_parse_extension_element()
937 elems->he_cap = data; in ieee80211_parse_extension_element()
938 elems->he_cap_len = len; in ieee80211_parse_extension_element()
943 if (len >= sizeof(*elems->he_operation) && in ieee80211_parse_extension_element()
944 len >= ieee80211_he_oper_size(data) - 1) in ieee80211_parse_extension_element()
945 elems->he_operation = data; in ieee80211_parse_extension_element()
949 elems->uora_element = data; in ieee80211_parse_extension_element()
953 elems->max_channel_switch_time = data; in ieee80211_parse_extension_element()
956 if (len >= sizeof(*elems->mbssid_config_ie)) in ieee80211_parse_extension_element()
957 elems->mbssid_config_ie = data; in ieee80211_parse_extension_element()
960 if (len >= sizeof(*elems->he_spr) && in ieee80211_parse_extension_element()
962 elems->he_spr = data; in ieee80211_parse_extension_element()
965 if (len >= sizeof(*elems->he_6ghz_capa)) in ieee80211_parse_extension_element()
966 elems->he_6ghz_capa = data; in ieee80211_parse_extension_element()
969 if (ieee80211_eht_capa_size_ok(elems->he_cap, in ieee80211_parse_extension_element()
971 params->from_ap)) { in ieee80211_parse_extension_element()
972 elems->eht_cap = data; in ieee80211_parse_extension_element()
973 elems->eht_cap_len = len; in ieee80211_parse_extension_element()
978 elems->eht_operation = data; in ieee80211_parse_extension_element()
988 switch (le16_get_bits(mle->control, in ieee80211_parse_extension_element()
991 elems->ml_basic_elem = (void *)elem; in ieee80211_parse_extension_element()
992 elems->ml_basic = data; in ieee80211_parse_extension_element()
993 elems->ml_basic_len = len; in ieee80211_parse_extension_element()
996 elems->ml_reconf_elem = (void *)elem; in ieee80211_parse_extension_element()
997 elems->ml_reconf = data; in ieee80211_parse_extension_element()
998 elems->ml_reconf_len = len; in ieee80211_parse_extension_element()
1008 *crc = crc32_be(*crc, (void *)elem, elem->datalen + 2); in ieee80211_parse_extension_element()
1017 bool calc_crc = params->filter != 0; in _ieee802_11_parse_elems_full()
1019 u32 crc = params->crc; in _ieee802_11_parse_elems_full()
1024 for_each_element(elem, params->start, params->len) { in _ieee802_11_parse_elems_full()
1026 u8 id = elem->id; in _ieee802_11_parse_elems_full()
1027 u8 elen = elem->datalen; in _ieee802_11_parse_elems_full()
1028 const u8 *pos = elem->data; in _ieee802_11_parse_elems_full()
1077 * not listing WLAN_EID_CHANNEL_SWITCH_WRAPPER -- it seems possible in _ieee802_11_parse_elems_full()
1081 elems->parse_error = true; in _ieee802_11_parse_elems_full()
1087 if (calc_crc && id < 64 && (params->filter & (1ULL << id))) in _ieee802_11_parse_elems_full()
1088 crc = crc32_be(crc, pos - 2, elen + 2); in _ieee802_11_parse_elems_full()
1098 elems->lnk_id = (void *)(pos - 2); in _ieee802_11_parse_elems_full()
1105 elems->ch_sw_timing = (void *)pos; in _ieee802_11_parse_elems_full()
1108 elems->ext_capab = pos; in _ieee802_11_parse_elems_full()
1109 elems->ext_capab_len = elen; in _ieee802_11_parse_elems_full()
1112 elems->ssid = pos; in _ieee802_11_parse_elems_full()
1113 elems->ssid_len = elen; in _ieee802_11_parse_elems_full()
1116 elems->supp_rates = pos; in _ieee802_11_parse_elems_full()
1117 elems->supp_rates_len = elen; in _ieee802_11_parse_elems_full()
1121 elems->ds_params = pos; in _ieee802_11_parse_elems_full()
1127 elems->tim = (void *)pos; in _ieee802_11_parse_elems_full()
1128 elems->tim_len = elen; in _ieee802_11_parse_elems_full()
1138 crc = crc32_be(crc, pos - 2, elen + 2); in _ieee802_11_parse_elems_full()
1141 /* OUI Type 2 - WMM IE */ in _ieee802_11_parse_elems_full()
1143 elems->wmm_info = pos; in _ieee802_11_parse_elems_full()
1144 elems->wmm_info_len = elen; in _ieee802_11_parse_elems_full()
1146 elems->wmm_param = pos; in _ieee802_11_parse_elems_full()
1147 elems->wmm_param_len = elen; in _ieee802_11_parse_elems_full()
1153 elems->rsn = pos; in _ieee802_11_parse_elems_full()
1154 elems->rsn_len = elen; in _ieee802_11_parse_elems_full()
1158 elems->erp_info = pos; in _ieee802_11_parse_elems_full()
1163 elems->ext_supp_rates = pos; in _ieee802_11_parse_elems_full()
1164 elems->ext_supp_rates_len = elen; in _ieee802_11_parse_elems_full()
1168 elems->ht_cap_elem = (void *)pos; in _ieee802_11_parse_elems_full()
1174 elems->ht_operation = (void *)pos; in _ieee802_11_parse_elems_full()
1180 elems->vht_cap_elem = (void *)pos; in _ieee802_11_parse_elems_full()
1186 elems->vht_operation = (void *)pos; in _ieee802_11_parse_elems_full()
1188 crc = crc32_be(crc, pos - 2, elen + 2); in _ieee802_11_parse_elems_full()
1195 elems->opmode_notif = pos; in _ieee802_11_parse_elems_full()
1197 crc = crc32_be(crc, pos - 2, elen + 2); in _ieee802_11_parse_elems_full()
1203 elems->mesh_id = pos; in _ieee802_11_parse_elems_full()
1204 elems->mesh_id_len = elen; in _ieee802_11_parse_elems_full()
1208 elems->mesh_config = (void *)pos; in _ieee802_11_parse_elems_full()
1213 elems->peering = pos; in _ieee802_11_parse_elems_full()
1214 elems->peering_len = elen; in _ieee802_11_parse_elems_full()
1218 elems->awake_window = (void *)pos; in _ieee802_11_parse_elems_full()
1221 elems->preq = pos; in _ieee802_11_parse_elems_full()
1222 elems->preq_len = elen; in _ieee802_11_parse_elems_full()
1225 elems->prep = pos; in _ieee802_11_parse_elems_full()
1226 elems->prep_len = elen; in _ieee802_11_parse_elems_full()
1229 elems->perr = pos; in _ieee802_11_parse_elems_full()
1230 elems->perr_len = elen; in _ieee802_11_parse_elems_full()
1234 elems->rann = (void *)pos; in _ieee802_11_parse_elems_full()
1243 elems->ch_switch_ie = (void *)pos; in _ieee802_11_parse_elems_full()
1250 elems->ext_chansw_ie = (void *)pos; in _ieee802_11_parse_elems_full()
1257 elems->sec_chan_offs = (void *)pos; in _ieee802_11_parse_elems_full()
1261 sizeof(*elems->mesh_chansw_params_ie)) { in _ieee802_11_parse_elems_full()
1265 elems->mesh_chansw_params_ie = (void *)pos; in _ieee802_11_parse_elems_full()
1268 if (!params->action || in _ieee802_11_parse_elems_full()
1269 elen < sizeof(*elems->wide_bw_chansw_ie)) { in _ieee802_11_parse_elems_full()
1273 elems->wide_bw_chansw_ie = (void *)pos; in _ieee802_11_parse_elems_full()
1276 if (params->action) { in _ieee802_11_parse_elems_full()
1288 if (ie[1] >= sizeof(*elems->wide_bw_chansw_ie)) in _ieee802_11_parse_elems_full()
1289 elems->wide_bw_chansw_ie = in _ieee802_11_parse_elems_full()
1296 elems->country_elem = pos; in _ieee802_11_parse_elems_full()
1297 elems->country_elem_len = elen; in _ieee802_11_parse_elems_full()
1304 elems->pwr_constr_elem = pos; in _ieee802_11_parse_elems_full()
1327 crc = crc32_be(crc, pos - 2, elen + 2); in _ieee802_11_parse_elems_full()
1329 elems->cisco_dtpc_elem = pos; in _ieee802_11_parse_elems_full()
1336 elems->addba_ext_ie = (void *)pos; in _ieee802_11_parse_elems_full()
1340 elems->timeout_int = (void *)pos; in _ieee802_11_parse_elems_full()
1345 if (elen >= sizeof(*elems->max_idle_period_ie)) in _ieee802_11_parse_elems_full()
1346 elems->max_idle_period_ie = (void *)pos; in _ieee802_11_parse_elems_full()
1349 elems->rsnx = pos; in _ieee802_11_parse_elems_full()
1350 elems->rsnx_len = elen; in _ieee802_11_parse_elems_full()
1357 if (elems->tx_pwr_env_num >= ARRAY_SIZE(elems->tx_pwr_env)) in _ieee802_11_parse_elems_full()
1360 elems->tx_pwr_env[elems->tx_pwr_env_num] = (void *)pos; in _ieee802_11_parse_elems_full()
1361 elems->tx_pwr_env_len[elems->tx_pwr_env_num] = elen; in _ieee802_11_parse_elems_full()
1362 elems->tx_pwr_env_num++; in _ieee802_11_parse_elems_full()
1370 if (elen >= sizeof(*elems->s1g_capab)) in _ieee802_11_parse_elems_full()
1371 elems->s1g_capab = (void *)pos; in _ieee802_11_parse_elems_full()
1376 if (elen == sizeof(*elems->s1g_oper)) in _ieee802_11_parse_elems_full()
1377 elems->s1g_oper = (void *)pos; in _ieee802_11_parse_elems_full()
1382 if (elen == sizeof(*elems->s1g_bcn_compat)) in _ieee802_11_parse_elems_full()
1383 elems->s1g_bcn_compat = (void *)pos; in _ieee802_11_parse_elems_full()
1389 elems->aid_resp = (void *)pos; in _ieee802_11_parse_elems_full()
1398 elems->parse_error = true; in _ieee802_11_parse_elems_full()
1403 if (!for_each_element_completed(elem, params->start, params->len)) in _ieee802_11_parse_elems_full()
1404 elems->parse_error = true; in _ieee802_11_parse_elems_full()
1418 if (!bss || !bss->transmitted_bss) in ieee802_11_find_bssid_profile()
1422 if (elem->datalen < 2) in ieee802_11_find_bssid_profile()
1424 if (elem->data[0] < 1 || elem->data[0] > 8) in ieee802_11_find_bssid_profile()
1427 for_each_element(sub, elem->data + 1, elem->datalen - 1) { in ieee802_11_find_bssid_profile()
1431 if (sub->id != 0 || sub->datalen < 4) { in ieee802_11_find_bssid_profile()
1436 if (sub->data[0] != WLAN_EID_NON_TX_BSSID_CAP || in ieee802_11_find_bssid_profile()
1437 sub->data[1] != 2) { in ieee802_11_find_bssid_profile()
1462 cfg80211_gen_new_bssid(bss->transmitted_bss->bssid, in ieee802_11_find_bssid_profile()
1463 elem->data[0], in ieee802_11_find_bssid_profile()
1466 if (ether_addr_equal(new_bssid, bss->bssid)) { in ieee802_11_find_bssid_profile()
1468 elems->bssid_index_len = index[1]; in ieee802_11_find_bssid_profile()
1469 elems->bssid_index = (void *)&index[2]; in ieee802_11_find_bssid_profile()
1481 const struct ieee80211_multi_link_elem *ml = elems->ml_basic; in ieee80211_mle_get_sta_prof()
1482 ssize_t ml_len = elems->ml_basic_len; in ieee80211_mle_get_sta_prof()
1488 if (le16_get_bits(ml->control, IEEE80211_ML_CONTROL_TYPE) != in ieee80211_mle_get_sta_prof()
1493 struct ieee80211_mle_per_sta_profile *prof = (void *)sub->data; in ieee80211_mle_get_sta_prof()
1497 if (sub->id != IEEE80211_MLE_SUBELEM_PER_STA_PROFILE) in ieee80211_mle_get_sta_prof()
1500 if (!ieee80211_mle_basic_sta_prof_size_ok(sub->data, in ieee80211_mle_get_sta_prof()
1501 sub->datalen)) in ieee80211_mle_get_sta_prof()
1504 control = le16_to_cpu(prof->control); in ieee80211_mle_get_sta_prof()
1517 elems->scratch_pos, in ieee80211_mle_get_sta_prof()
1518 elems->scratch + in ieee80211_mle_get_sta_prof()
1519 elems->scratch_len - in ieee80211_mle_get_sta_prof()
1520 elems->scratch_pos, in ieee80211_mle_get_sta_prof()
1526 elems->prof = (void *)elems->scratch_pos; in ieee80211_mle_get_sta_prof()
1527 elems->sta_prof_len = sta_prof_len; in ieee80211_mle_get_sta_prof()
1528 elems->scratch_pos += sta_prof_len; in ieee80211_mle_get_sta_prof()
1539 .action = params->action, in ieee80211_mle_parse_link()
1540 .from_ap = params->from_ap, in ieee80211_mle_parse_link()
1541 .link_id = -1, in ieee80211_mle_parse_link()
1543 ssize_t ml_len = elems->ml_basic_len; in ieee80211_mle_parse_link()
1547 if (params->link_id == -1) in ieee80211_mle_parse_link()
1550 ml_len = cfg80211_defragment_element(elems->ml_basic_elem, in ieee80211_mle_parse_link()
1551 elems->ie_start, in ieee80211_mle_parse_link()
1552 elems->total_len, in ieee80211_mle_parse_link()
1553 elems->scratch_pos, in ieee80211_mle_parse_link()
1554 elems->scratch + in ieee80211_mle_parse_link()
1555 elems->scratch_len - in ieee80211_mle_parse_link()
1556 elems->scratch_pos, in ieee80211_mle_parse_link()
1562 elems->ml_basic = (const void *)elems->scratch_pos; in ieee80211_mle_parse_link()
1563 elems->ml_basic_len = ml_len; in ieee80211_mle_parse_link()
1565 ieee80211_mle_get_sta_prof(elems, params->link_id); in ieee80211_mle_parse_link()
1566 prof = elems->prof; in ieee80211_mle_parse_link()
1572 if (elems->sta_prof_len < sizeof(*prof) + prof->sta_info_len - 1 + 4) { in ieee80211_mle_parse_link()
1573 elems->prof = NULL; in ieee80211_mle_parse_link()
1574 elems->sta_prof_len = 0; in ieee80211_mle_parse_link()
1581 * the -1 is because the 'sta_info_len' is accounted to as part of the in ieee80211_mle_parse_link()
1582 * per-STA profile, but not part of the 'u8 variable[]' portion. in ieee80211_mle_parse_link()
1584 sub.start = prof->variable + prof->sta_info_len - 1 + 4; in ieee80211_mle_parse_link()
1585 end = (const u8 *)prof + elems->sta_prof_len; in ieee80211_mle_parse_link()
1586 sub.len = end - sub.start; in ieee80211_mle_parse_link()
1600 size_t scratch_len = 3 * params->len; in ieee802_11_parse_elems_full()
1605 elems->ie_start = params->start; in ieee802_11_parse_elems_full()
1606 elems->total_len = params->len; in ieee802_11_parse_elems_full()
1607 elems->scratch_len = scratch_len; in ieee802_11_parse_elems_full()
1608 elems->scratch_pos = elems->scratch; in ieee802_11_parse_elems_full()
1610 nontransmitted_profile = elems->scratch_pos; in ieee802_11_parse_elems_full()
1612 ieee802_11_find_bssid_profile(params->start, params->len, in ieee802_11_parse_elems_full()
1613 elems, params->bss, in ieee802_11_parse_elems_full()
1615 elems->scratch_pos += nontransmitted_profile_len; in ieee802_11_parse_elems_full()
1616 elems->scratch_len -= nontransmitted_profile_len; in ieee802_11_parse_elems_full()
1621 elems->crc = _ieee802_11_parse_elems_full(params, elems, non_inherit); in ieee802_11_parse_elems_full()
1623 /* Override with nontransmitted profile, if found */ in ieee802_11_parse_elems_full()
1628 .action = params->action, in ieee802_11_parse_elems_full()
1629 .link_id = params->link_id, in ieee802_11_parse_elems_full()
1637 if (elems->tim && !elems->parse_error) { in ieee802_11_parse_elems_full()
1638 const struct ieee80211_tim_ie *tim_ie = elems->tim; in ieee802_11_parse_elems_full()
1640 elems->dtim_period = tim_ie->dtim_period; in ieee802_11_parse_elems_full()
1641 elems->dtim_count = tim_ie->dtim_count; in ieee802_11_parse_elems_full()
1644 /* Override DTIM period and count if needed */ in ieee802_11_parse_elems_full()
1645 if (elems->bssid_index && in ieee802_11_parse_elems_full()
1646 elems->bssid_index_len >= in ieee802_11_parse_elems_full()
1648 elems->dtim_period = elems->bssid_index->dtim_period; in ieee802_11_parse_elems_full()
1650 if (elems->bssid_index && in ieee802_11_parse_elems_full()
1651 elems->bssid_index_len >= in ieee802_11_parse_elems_full()
1653 elems->dtim_count = elems->bssid_index->dtim_count; in ieee802_11_parse_elems_full()
1667 if (sdata->vif.type != NL80211_IFTYPE_AP && in ieee80211_regulatory_limit_wmm_params()
1668 sdata->vif.type != NL80211_IFTYPE_STATION) in ieee80211_regulatory_limit_wmm_params()
1672 chanctx_conf = rcu_dereference(sdata->vif.bss_conf.chanctx_conf); in ieee80211_regulatory_limit_wmm_params()
1674 center_freq = chanctx_conf->def.chan->center_freq; in ieee80211_regulatory_limit_wmm_params()
1681 rrule = freq_reg_info(sdata->wdev.wiphy, MHZ_TO_KHZ(center_freq)); in ieee80211_regulatory_limit_wmm_params()
1683 if (IS_ERR_OR_NULL(rrule) || !rrule->has_wmm) { in ieee80211_regulatory_limit_wmm_params()
1688 if (sdata->vif.type == NL80211_IFTYPE_AP) in ieee80211_regulatory_limit_wmm_params()
1689 wmm_ac = &rrule->wmm_rule.ap[ac]; in ieee80211_regulatory_limit_wmm_params()
1691 wmm_ac = &rrule->wmm_rule.client[ac]; in ieee80211_regulatory_limit_wmm_params()
1692 qparam->cw_min = max_t(u16, qparam->cw_min, wmm_ac->cw_min); in ieee80211_regulatory_limit_wmm_params()
1693 qparam->cw_max = max_t(u16, qparam->cw_max, wmm_ac->cw_max); in ieee80211_regulatory_limit_wmm_params()
1694 qparam->aifs = max_t(u8, qparam->aifs, wmm_ac->aifsn); in ieee80211_regulatory_limit_wmm_params()
1695 qparam->txop = min_t(u16, qparam->txop, wmm_ac->cot / 32); in ieee80211_regulatory_limit_wmm_params()
1702 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_set_wmm_default()
1703 struct ieee80211_local *local = sdata->local; in ieee80211_set_wmm_default()
1711 if (!local->ops->conf_tx) in ieee80211_set_wmm_default()
1714 if (local->hw.queues < IEEE80211_NUM_ACS) in ieee80211_set_wmm_default()
1720 chanctx_conf = rcu_dereference(link->conf->chanctx_conf); in ieee80211_set_wmm_default()
1722 chanctx_conf->def.chan->band == NL80211_BAND_2GHZ) && in ieee80211_set_wmm_default()
1723 !link->operating_11g_mode; in ieee80211_set_wmm_default()
1726 is_ocb = (sdata->vif.type == NL80211_IFTYPE_OCB); in ieee80211_set_wmm_default()
1728 /* Set defaults according to 802.11-2007 Table 7-37 */ in ieee80211_set_wmm_default()
1767 qparam.cw_min = (aCWmin + 1) / 2 - 1; in ieee80211_set_wmm_default()
1781 qparam.cw_max = (aCWmin + 1) / 2 - 1; in ieee80211_set_wmm_default()
1782 qparam.cw_min = (aCWmin + 1) / 4 - 1; in ieee80211_set_wmm_default()
1797 link->tx_conf[ac] = qparam; in ieee80211_set_wmm_default()
1801 if (sdata->vif.type != NL80211_IFTYPE_MONITOR && in ieee80211_set_wmm_default()
1802 sdata->vif.type != NL80211_IFTYPE_P2P_DEVICE && in ieee80211_set_wmm_default()
1803 sdata->vif.type != NL80211_IFTYPE_NAN) { in ieee80211_set_wmm_default()
1804 link->conf->qos = enable_qos; in ieee80211_set_wmm_default()
1817 struct ieee80211_local *local = sdata->local; in ieee80211_send_auth()
1820 bool multi_link = ieee80211_vif_is_mld(&sdata->vif); in ieee80211_send_auth()
1829 .len = sizeof(mle) - 2, in ieee80211_send_auth()
1836 memcpy(mle.basic.mld_mac_addr, sdata->vif.addr, ETH_ALEN); in ieee80211_send_auth()
1839 skb = dev_alloc_skb(local->hw.extra_tx_headroom + IEEE80211_WEP_IV_LEN + in ieee80211_send_auth()
1845 skb_reserve(skb, local->hw.extra_tx_headroom + IEEE80211_WEP_IV_LEN); in ieee80211_send_auth()
1848 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | in ieee80211_send_auth()
1850 memcpy(mgmt->da, da, ETH_ALEN); in ieee80211_send_auth()
1851 memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); in ieee80211_send_auth()
1852 memcpy(mgmt->bssid, bssid, ETH_ALEN); in ieee80211_send_auth()
1853 mgmt->u.auth.auth_alg = cpu_to_le16(auth_alg); in ieee80211_send_auth()
1854 mgmt->u.auth.auth_transaction = cpu_to_le16(transaction); in ieee80211_send_auth()
1855 mgmt->u.auth.status_code = cpu_to_le16(status); in ieee80211_send_auth()
1862 mgmt->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); in ieee80211_send_auth()
1870 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT | in ieee80211_send_auth()
1880 struct ieee80211_local *local = sdata->local; in ieee80211_send_deauth_disassoc()
1885 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | stype); in ieee80211_send_deauth_disassoc()
1886 mgmt->duration = 0; /* initialize only */ in ieee80211_send_deauth_disassoc()
1887 mgmt->seq_ctrl = 0; /* initialize only */ in ieee80211_send_deauth_disassoc()
1888 memcpy(mgmt->da, da, ETH_ALEN); in ieee80211_send_deauth_disassoc()
1889 memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); in ieee80211_send_deauth_disassoc()
1890 memcpy(mgmt->bssid, bssid, ETH_ALEN); in ieee80211_send_deauth_disassoc()
1892 mgmt->u.deauth.reason_code = cpu_to_le16(reason); in ieee80211_send_deauth_disassoc()
1895 skb = dev_alloc_skb(local->hw.extra_tx_headroom + in ieee80211_send_deauth_disassoc()
1900 skb_reserve(skb, local->hw.extra_tx_headroom); in ieee80211_send_deauth_disassoc()
1905 if (sdata->vif.type != NL80211_IFTYPE_STATION || in ieee80211_send_deauth_disassoc()
1906 !(sdata->u.mgd.flags & IEEE80211_STA_MFP_ENABLED)) in ieee80211_send_deauth_disassoc()
1907 IEEE80211_SKB_CB(skb)->flags |= in ieee80211_send_deauth_disassoc()
1916 if ((end - pos) < 5) in ieee80211_write_he_6ghz_cap()
1935 struct ieee80211_local *local = sdata->local; in ieee80211_build_preq_ies_band()
1951 sband = local->hw.wiphy->bands[band]; in ieee80211_build_preq_ies_band()
1958 /* For direct scan add S1G IE and consider its override bits */ in ieee80211_build_preq_ies_band()
1960 if (end - pos < 2 + sizeof(struct ieee80211_s1g_cap)) in ieee80211_build_preq_ies_band()
1962 pos = ieee80211_ie_build_s1g_cap(pos, &sband->s1g_cap); in ieee80211_build_preq_ies_band()
1967 for (i = 0; i < sband->n_bitrates; i++) { in ieee80211_build_preq_ies_band()
1970 if ((rate_flags & sband->bitrates[i].flags) != rate_flags) in ieee80211_build_preq_ies_band()
1974 (u8) DIV_ROUND_UP(sband->bitrates[i].bitrate, in ieee80211_build_preq_ies_band()
1980 if (end - pos < 2 + supp_rates_len) in ieee80211_build_preq_ies_band()
1998 if (end - pos < noffset - *offset) in ieee80211_build_preq_ies_band()
2000 memcpy(pos, ie + *offset, noffset - *offset); in ieee80211_build_preq_ies_band()
2001 pos += noffset - *offset; in ieee80211_build_preq_ies_band()
2005 ext_rates_len = num_rates - supp_rates_len; in ieee80211_build_preq_ies_band()
2007 if (end - pos < 2 + ext_rates_len) in ieee80211_build_preq_ies_band()
2015 if (chandef->chan && sband->band == NL80211_BAND_2GHZ) { in ieee80211_build_preq_ies_band()
2016 if (end - pos < 3) in ieee80211_build_preq_ies_band()
2021 chandef->chan->center_freq); in ieee80211_build_preq_ies_band()
2040 if (end - pos < noffset - *offset) in ieee80211_build_preq_ies_band()
2042 memcpy(pos, ie + *offset, noffset - *offset); in ieee80211_build_preq_ies_band()
2043 pos += noffset - *offset; in ieee80211_build_preq_ies_band()
2047 if (sband->ht_cap.ht_supported) { in ieee80211_build_preq_ies_band()
2048 if (end - pos < 2 + sizeof(struct ieee80211_ht_cap)) in ieee80211_build_preq_ies_band()
2050 pos = ieee80211_ie_build_ht_cap(pos, &sband->ht_cap, in ieee80211_build_preq_ies_band()
2051 sband->ht_cap.cap); in ieee80211_build_preq_ies_band()
2067 /* 60 GHz (Multi-band, DMG, MMS) can't happen */ in ieee80211_build_preq_ies_band()
2072 if (end - pos < noffset - *offset) in ieee80211_build_preq_ies_band()
2074 memcpy(pos, ie + *offset, noffset - *offset); in ieee80211_build_preq_ies_band()
2075 pos += noffset - *offset; in ieee80211_build_preq_ies_band()
2080 for (i = 0; i < sband->n_channels; i++) { in ieee80211_build_preq_ies_band()
2081 if (sband->channels[i].flags & (IEEE80211_CHAN_DISABLED | in ieee80211_build_preq_ies_band()
2089 if (sband->vht_cap.vht_supported && have_80mhz) { in ieee80211_build_preq_ies_band()
2090 if (end - pos < 2 + sizeof(struct ieee80211_vht_cap)) in ieee80211_build_preq_ies_band()
2092 pos = ieee80211_ie_build_vht_cap(pos, &sband->vht_cap, in ieee80211_build_preq_ies_band()
2093 sband->vht_cap.cap); in ieee80211_build_preq_ies_band()
2110 if (end - pos < noffset - *offset) in ieee80211_build_preq_ies_band()
2112 memcpy(pos, ie + *offset, noffset - *offset); in ieee80211_build_preq_ies_band()
2113 pos += noffset - *offset; in ieee80211_build_preq_ies_band()
2117 he_cap = ieee80211_get_he_iftype_cap_vif(sband, &sdata->vif); in ieee80211_build_preq_ies_band()
2119 cfg80211_any_usable_channels(local->hw.wiphy, BIT(sband->band), in ieee80211_build_preq_ies_band()
2126 eht_cap = ieee80211_get_eht_iftype_cap_vif(sband, &sdata->vif); in ieee80211_build_preq_ies_band()
2129 cfg80211_any_usable_channels(local->hw.wiphy, BIT(sband->band), in ieee80211_build_preq_ies_band()
2133 sdata->vif.type == NL80211_IFTYPE_AP); in ieee80211_build_preq_ies_band()
2138 if (cfg80211_any_usable_channels(local->hw.wiphy, in ieee80211_build_preq_ies_band()
2143 sband6 = local->hw.wiphy->bands[NL80211_BAND_6GHZ]; in ieee80211_build_preq_ies_band()
2144 he_cap = ieee80211_get_he_iftype_cap_vif(sband6, &sdata->vif); in ieee80211_build_preq_ies_band()
2148 ieee80211_vif_type_p2p(&sdata->vif); in ieee80211_build_preq_ies_band()
2157 * that calculates local->scan_ies_len. in ieee80211_build_preq_ies_band()
2160 return pos - buffer; in ieee80211_build_preq_ies_band()
2164 return pos - buffer; in ieee80211_build_preq_ies_band()
2184 buffer_len - pos, in ieee80211_build_preq_ies()
2190 ie_desc->ies[i] = buffer + old_pos; in ieee80211_build_preq_ies()
2191 ie_desc->len[i] = pos - old_pos; in ieee80211_build_preq_ies()
2198 if (WARN_ONCE(buffer_len - pos < ie_len - custom_ie_offset, in ieee80211_build_preq_ies()
2202 ie_len - custom_ie_offset); in ieee80211_build_preq_ies()
2203 ie_desc->common_ies = buffer + pos; in ieee80211_build_preq_ies()
2204 ie_desc->common_ie_len = ie_len - custom_ie_offset; in ieee80211_build_preq_ies()
2205 pos += ie_len - custom_ie_offset; in ieee80211_build_preq_ies()
2219 struct ieee80211_local *local = sdata->local; in ieee80211_build_probe_req()
2230 * badly-behaved APs don't respond when this parameter is included. in ieee80211_build_probe_req()
2232 chandef.width = sdata->vif.bss_conf.chandef.width; in ieee80211_build_probe_req()
2238 skb = ieee80211_probereq_get(&local->hw, src, ssid, ssid_len, in ieee80211_build_probe_req()
2239 local->scan_ies_len + ie_len); in ieee80211_build_probe_req()
2243 rate_masks[chan->band] = ratemask; in ieee80211_build_probe_req()
2246 ie, ie_len, BIT(chan->band), in ieee80211_build_probe_req()
2251 mgmt = (struct ieee80211_mgmt *) skb->data; in ieee80211_build_probe_req()
2252 memcpy(mgmt->da, dst, ETH_ALEN); in ieee80211_build_probe_req()
2253 memcpy(mgmt->bssid, dst, ETH_ALEN); in ieee80211_build_probe_req()
2256 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; in ieee80211_build_probe_req()
2270 sband = sdata->local->hw.wiphy->bands[band]; in ieee80211_sta_get_rates()
2274 rate_flags = ieee80211_chandef_rate_flags(&sdata->vif.bss_conf.chandef); in ieee80211_sta_get_rates()
2275 shift = ieee80211_vif_get_shift(&sdata->vif); in ieee80211_sta_get_rates()
2277 num_rates = sband->n_bitrates; in ieee80211_sta_get_rates()
2279 for (i = 0; i < elems->supp_rates_len + in ieee80211_sta_get_rates()
2280 elems->ext_supp_rates_len; i++) { in ieee80211_sta_get_rates()
2284 if (i < elems->supp_rates_len) in ieee80211_sta_get_rates()
2285 rate = elems->supp_rates[i]; in ieee80211_sta_get_rates()
2286 else if (elems->ext_supp_rates) in ieee80211_sta_get_rates()
2287 rate = elems->ext_supp_rates in ieee80211_sta_get_rates()
2288 [i - elems->supp_rates_len]; in ieee80211_sta_get_rates()
2297 if ((rate_flags & sband->bitrates[j].flags) in ieee80211_sta_get_rates()
2301 brate = DIV_ROUND_UP(sband->bitrates[j].bitrate, in ieee80211_sta_get_rates()
2319 cancel_work_sync(&local->reconfig_filter); in ieee80211_stop_device()
2321 flush_workqueue(local->workqueue); in ieee80211_stop_device()
2335 if (test_bit(SCAN_COMPLETED, &local->scanning)) { in ieee80211_flush_completed_scan()
2337 * we don't attempt to continue a partial HW scan - which is in ieee80211_flush_completed_scan()
2342 set_bit(SCAN_ABORTED, &local->scanning); in ieee80211_flush_completed_scan()
2343 wiphy_delayed_work_queue(local->hw.wiphy, &local->scan_work, 0); in ieee80211_flush_completed_scan()
2344 wiphy_delayed_work_flush(local->hw.wiphy, &local->scan_work); in ieee80211_flush_completed_scan()
2363 local->resuming = false; in ieee80211_handle_reconfig_failure()
2364 local->suspended = false; in ieee80211_handle_reconfig_failure()
2365 local->in_reconfig = false; in ieee80211_handle_reconfig_failure()
2366 local->reconfig_failure = true; in ieee80211_handle_reconfig_failure()
2375 list_for_each_entry(sdata, &local->interfaces, list) in ieee80211_handle_reconfig_failure()
2376 sdata->flags &= ~IEEE80211_SDATA_IN_DRIVER; in ieee80211_handle_reconfig_failure()
2381 mutex_lock(&local->chanctx_mtx); in ieee80211_handle_reconfig_failure()
2382 list_for_each_entry(ctx, &local->chanctx_list, list) in ieee80211_handle_reconfig_failure()
2383 ctx->driver_present = false; in ieee80211_handle_reconfig_failure()
2384 mutex_unlock(&local->chanctx_mtx); in ieee80211_handle_reconfig_failure()
2394 if (!local->use_chanctx) in ieee80211_assign_chanctx()
2397 mutex_lock(&local->chanctx_mtx); in ieee80211_assign_chanctx()
2398 conf = rcu_dereference_protected(link->conf->chanctx_conf, in ieee80211_assign_chanctx()
2399 lockdep_is_held(&local->chanctx_mtx)); in ieee80211_assign_chanctx()
2402 drv_assign_vif_chanctx(local, sdata, link->conf, ctx); in ieee80211_assign_chanctx()
2404 mutex_unlock(&local->chanctx_mtx); in ieee80211_assign_chanctx()
2409 struct ieee80211_local *local = sdata->local; in ieee80211_reconfig_stations()
2413 mutex_lock(&local->sta_mtx); in ieee80211_reconfig_stations()
2414 list_for_each_entry(sta, &local->sta_list, list) { in ieee80211_reconfig_stations()
2417 if (!sta->uploaded || sta->sdata != sdata) in ieee80211_reconfig_stations()
2421 state < sta->sta_state; state++) in ieee80211_reconfig_stations()
2422 WARN_ON(drv_sta_state(local, sta->sdata, sta, state, in ieee80211_reconfig_stations()
2425 mutex_unlock(&local->sta_mtx); in ieee80211_reconfig_stations()
2433 res = drv_start_nan(sdata->local, sdata, in ieee80211_reconfig_nan()
2434 &sdata->u.nan.conf); in ieee80211_reconfig_nan()
2438 funcs = kcalloc(sdata->local->hw.max_nan_de_entries + 1, in ieee80211_reconfig_nan()
2442 return -ENOMEM; in ieee80211_reconfig_nan()
2448 spin_lock_bh(&sdata->u.nan.func_lock); in ieee80211_reconfig_nan()
2450 idr_for_each_entry(&sdata->u.nan.function_inst_ids, func, id) in ieee80211_reconfig_nan()
2453 spin_unlock_bh(&sdata->u.nan.func_lock); in ieee80211_reconfig_nan()
2456 res = drv_add_nan_func(sdata->local, sdata, funcs[i]); in ieee80211_reconfig_nan()
2458 ieee80211_nan_func_terminated(&sdata->vif, in ieee80211_reconfig_nan()
2459 funcs[i]->instance_id, in ieee80211_reconfig_nan()
2475 for (link_id = 0; link_id < ARRAY_SIZE(sdata->link); link_id++) { in ieee80211_reconfig_ap_links()
2478 if (!(sdata->vif.active_links & BIT(link_id))) in ieee80211_reconfig_ap_links()
2481 link = sdata_dereference(sdata->link[link_id], sdata); in ieee80211_reconfig_ap_links()
2485 if (rcu_access_pointer(link->u.ap.beacon)) in ieee80211_reconfig_ap_links()
2486 drv_start_ap(local, sdata, link->conf); in ieee80211_reconfig_ap_links()
2488 if (!link->conf->enable_beacon) in ieee80211_reconfig_ap_links()
2500 struct ieee80211_hw *hw = &local->hw; in ieee80211_reconfig()
2509 bool suspended = local->suspended; in ieee80211_reconfig()
2513 if (!local->open_count) in ieee80211_reconfig()
2518 local->resuming = true; in ieee80211_reconfig()
2520 if (local->wowlan) { in ieee80211_reconfig()
2524 * clear local->suspended so the device could operate in ieee80211_reconfig()
2527 local->suspended = false; in ieee80211_reconfig()
2529 local->wowlan = false; in ieee80211_reconfig()
2531 local->resuming = false; in ieee80211_reconfig()
2540 * restore local->suspended in this case. in ieee80211_reconfig()
2543 local->suspended = true; in ieee80211_reconfig()
2554 if (suspended && local->in_reconfig && !reconfig_due_to_wowlan) in ieee80211_reconfig()
2555 cancel_work_sync(&local->restart_work); in ieee80211_reconfig()
2557 local->started = false; in ieee80211_reconfig()
2576 drv_set_frag_threshold(local, hw->wiphy->frag_threshold); in ieee80211_reconfig()
2579 drv_set_rts_threshold(local, hw->wiphy->rts_threshold); in ieee80211_reconfig()
2582 drv_set_coverage_class(local, hw->wiphy->coverage_class); in ieee80211_reconfig()
2589 sdata = wiphy_dereference(local->hw.wiphy, local->monitor_sdata); in ieee80211_reconfig()
2592 WARN_ON(local->resuming); in ieee80211_reconfig()
2595 RCU_INIT_POINTER(local->monitor_sdata, NULL); in ieee80211_reconfig()
2601 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_reconfig()
2602 if (sdata->vif.type != NL80211_IFTYPE_AP_VLAN && in ieee80211_reconfig()
2603 sdata->vif.type != NL80211_IFTYPE_MONITOR && in ieee80211_reconfig()
2615 list_for_each_entry_continue_reverse(sdata, &local->interfaces, in ieee80211_reconfig()
2617 if (sdata->vif.type != NL80211_IFTYPE_AP_VLAN && in ieee80211_reconfig()
2618 sdata->vif.type != NL80211_IFTYPE_MONITOR && in ieee80211_reconfig()
2626 if (local->use_chanctx) { in ieee80211_reconfig()
2627 mutex_lock(&local->chanctx_mtx); in ieee80211_reconfig()
2628 list_for_each_entry(ctx, &local->chanctx_list, list) in ieee80211_reconfig()
2629 if (ctx->replace_state != in ieee80211_reconfig()
2632 mutex_unlock(&local->chanctx_mtx); in ieee80211_reconfig()
2634 sdata = wiphy_dereference(local->hw.wiphy, in ieee80211_reconfig()
2635 local->monitor_sdata); in ieee80211_reconfig()
2637 ieee80211_assign_chanctx(local, sdata, &sdata->deflink); in ieee80211_reconfig()
2646 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_reconfig()
2647 /* common change flags for all interface types - link only */ in ieee80211_reconfig()
2667 if (ieee80211_vif_is_mld(&sdata->vif)) { in ieee80211_reconfig()
2669 [0] = &sdata->vif.bss_conf, in ieee80211_reconfig()
2672 if (sdata->vif.type == NL80211_IFTYPE_STATION) { in ieee80211_reconfig()
2674 active_links = sdata->vif.active_links; in ieee80211_reconfig()
2675 link_id = ffs(active_links) - 1; in ieee80211_reconfig()
2676 sdata->vif.active_links = BIT(link_id); in ieee80211_reconfig()
2680 sdata->vif.active_links, in ieee80211_reconfig()
2685 link_id < ARRAY_SIZE(sdata->vif.link_conf); in ieee80211_reconfig()
2687 if (ieee80211_vif_is_mld(&sdata->vif) && in ieee80211_reconfig()
2688 !(sdata->vif.active_links & BIT(link_id))) in ieee80211_reconfig()
2691 link = sdata_dereference(sdata->link[link_id], sdata); in ieee80211_reconfig()
2698 switch (sdata->vif.type) { in ieee80211_reconfig()
2703 if (sdata->vif.cfg.ibss_joined) in ieee80211_reconfig()
2711 drv_conf_tx(local, &sdata->deflink, i, in ieee80211_reconfig()
2712 &sdata->deflink.tx_conf[i]); in ieee80211_reconfig()
2716 if (sdata->vif.bss_conf.mu_mimo_owner) in ieee80211_reconfig()
2719 if (!ieee80211_vif_is_mld(&sdata->vif)) in ieee80211_reconfig()
2722 switch (sdata->vif.type) { in ieee80211_reconfig()
2724 if (!ieee80211_vif_is_mld(&sdata->vif)) { in ieee80211_reconfig()
2729 /* Re-send beacon info report to the driver */ in ieee80211_reconfig()
2730 if (sdata->deflink.u.mgd.have_beacon) in ieee80211_reconfig()
2733 if (sdata->vif.bss_conf.max_idle_period || in ieee80211_reconfig()
2734 sdata->vif.bss_conf.protected_keep_alive) in ieee80211_reconfig()
2737 if (sdata->vif.bss_conf.eht_puncturing) in ieee80211_reconfig()
2762 if (ieee80211_vif_is_mld(&sdata->vif)) in ieee80211_reconfig()
2768 if (sdata->vif.bss_conf.ftm_responder == 1 && in ieee80211_reconfig()
2769 wiphy_ext_feature_isset(sdata->local->hw.wiphy, in ieee80211_reconfig()
2773 if (sdata->vif.type == NL80211_IFTYPE_AP) { in ieee80211_reconfig()
2776 if (ieee80211_vif_is_mld(&sdata->vif)) { in ieee80211_reconfig()
2783 if (rcu_access_pointer(sdata->deflink.u.ap.beacon)) in ieee80211_reconfig()
2785 sdata->deflink.conf); in ieee80211_reconfig()
2789 if (sdata->vif.bss_conf.enable_beacon) { in ieee80211_reconfig()
2819 ieee80211_set_active_links(&sdata->vif, active_links); in ieee80211_reconfig()
2830 if (!(local->hw.conf.flags & IEEE80211_CONF_PS)) { in ieee80211_reconfig()
2831 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_reconfig()
2832 if (sdata->vif.type != NL80211_IFTYPE_STATION) in ieee80211_reconfig()
2834 if (!sdata->u.mgd.associated) in ieee80211_reconfig()
2842 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_reconfig()
2847 switch (sdata->vif.type) { in ieee80211_reconfig()
2859 list_for_each_entry(sdata, &local->interfaces, list) in ieee80211_reconfig()
2863 mutex_lock(&local->mtx); in ieee80211_reconfig()
2864 sched_scan_sdata = rcu_dereference_protected(local->sched_scan_sdata, in ieee80211_reconfig()
2865 lockdep_is_held(&local->mtx)); in ieee80211_reconfig()
2866 sched_scan_req = rcu_dereference_protected(local->sched_scan_req, in ieee80211_reconfig()
2867 lockdep_is_held(&local->mtx)); in ieee80211_reconfig()
2876 if (sched_scan_req->n_scan_plans > 1 || in ieee80211_reconfig()
2879 RCU_INIT_POINTER(local->sched_scan_sdata, NULL); in ieee80211_reconfig()
2880 RCU_INIT_POINTER(local->sched_scan_req, NULL); in ieee80211_reconfig()
2883 mutex_unlock(&local->mtx); in ieee80211_reconfig()
2886 cfg80211_sched_scan_stopped_locked(local->hw.wiphy, 0); in ieee80211_reconfig()
2890 if (local->monitors == local->open_count && local->monitors > 0) in ieee80211_reconfig()
2904 mutex_lock(&local->sta_mtx); in ieee80211_reconfig()
2906 list_for_each_entry(sta, &local->sta_list, list) { in ieee80211_reconfig()
2907 if (!local->resuming) in ieee80211_reconfig()
2913 mutex_unlock(&local->sta_mtx); in ieee80211_reconfig()
2920 if (local->open_count && (!suspended || reconfig_due_to_wowlan)) in ieee80211_reconfig()
2923 if (local->in_reconfig) { in ieee80211_reconfig()
2924 in_reconfig = local->in_reconfig; in ieee80211_reconfig()
2925 local->in_reconfig = false; in ieee80211_reconfig()
2929 mutex_lock(&local->mtx); in ieee80211_reconfig()
2931 mutex_unlock(&local->mtx); in ieee80211_reconfig()
2934 list_for_each_entry(sdata, &local->interfaces, list) in ieee80211_reconfig()
2935 wiphy_work_queue(local->hw.wiphy, &sdata->work); in ieee80211_reconfig()
2943 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_reconfig()
2946 if (sdata->vif.type == NL80211_IFTYPE_STATION) in ieee80211_reconfig()
2956 local->suspended = false; in ieee80211_reconfig()
2958 local->resuming = false; in ieee80211_reconfig()
2962 if (local->open_count && !reconfig_due_to_wowlan) in ieee80211_reconfig()
2965 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_reconfig()
2968 if (sdata->vif.type == NL80211_IFTYPE_STATION) in ieee80211_reconfig()
2972 mod_timer(&local->sta_cleanup, jiffies + 1); in ieee80211_reconfig()
2990 local = sdata->local; in ieee80211_reconfig_disconnect()
2993 !local->resuming)) in ieee80211_reconfig_disconnect()
2997 !local->in_reconfig)) in ieee80211_reconfig_disconnect()
3000 if (WARN_ON(vif->type != NL80211_IFTYPE_STATION)) in ieee80211_reconfig_disconnect()
3003 sdata->flags |= flag; in ieee80211_reconfig_disconnect()
3005 mutex_lock(&local->key_mtx); in ieee80211_reconfig_disconnect()
3006 list_for_each_entry(key, &sdata->key_list, list) in ieee80211_reconfig_disconnect()
3007 key->flags |= KEY_FLAG_TAINTED; in ieee80211_reconfig_disconnect()
3008 mutex_unlock(&local->key_mtx); in ieee80211_reconfig_disconnect()
3026 struct ieee80211_local *local = sdata->local; in ieee80211_recalc_smps()
3030 mutex_lock(&local->chanctx_mtx); in ieee80211_recalc_smps()
3032 chanctx_conf = rcu_dereference_protected(link->conf->chanctx_conf, in ieee80211_recalc_smps()
3033 lockdep_is_held(&local->chanctx_mtx)); in ieee80211_recalc_smps()
3047 mutex_unlock(&local->chanctx_mtx); in ieee80211_recalc_smps()
3053 struct ieee80211_local *local = sdata->local; in ieee80211_recalc_min_chandef()
3058 mutex_lock(&local->chanctx_mtx); in ieee80211_recalc_min_chandef()
3060 for (i = 0; i < ARRAY_SIZE(sdata->vif.link_conf); i++) { in ieee80211_recalc_min_chandef()
3067 bss_conf = rcu_dereference(sdata->vif.link_conf[i]); in ieee80211_recalc_min_chandef()
3073 chanctx_conf = rcu_dereference_protected(bss_conf->chanctx_conf, in ieee80211_recalc_min_chandef()
3074 lockdep_is_held(&local->chanctx_mtx)); in ieee80211_recalc_min_chandef()
3079 * the mutex. Just the way we reached it could - in in ieee80211_recalc_min_chandef()
3080 * theory - go away, but we don't really care and in ieee80211_recalc_min_chandef()
3093 mutex_unlock(&local->chanctx_mtx); in ieee80211_recalc_min_chandef()
3112 memcpy(pos, &s1g_cap->cap, sizeof(s1g_cap->cap)); in ieee80211_ie_build_s1g_cap()
3113 pos += sizeof(s1g_cap->cap); in ieee80211_ie_build_s1g_cap()
3115 memcpy(pos, &s1g_cap->nss_mcs, sizeof(s1g_cap->nss_mcs)); in ieee80211_ie_build_s1g_cap()
3116 pos += sizeof(s1g_cap->nss_mcs); in ieee80211_ie_build_s1g_cap()
3136 *pos++ = ht_cap->ampdu_factor | in ieee80211_ie_build_ht_cap()
3137 (ht_cap->ampdu_density << in ieee80211_ie_build_ht_cap()
3141 memcpy(pos, &ht_cap->mcs, sizeof(ht_cap->mcs)); in ieee80211_ie_build_ht_cap()
3142 pos += sizeof(ht_cap->mcs); in ieee80211_ie_build_ht_cap()
3171 memcpy(pos, &vht_cap->vht_mcs, sizeof(vht_cap->vht_mcs)); in ieee80211_ie_build_vht_cap()
3172 pos += sizeof(vht_cap->vht_mcs); in ieee80211_ie_build_vht_cap()
3191 n = ieee80211_he_mcs_nss_size(&he_cap->he_cap_elem); in ieee80211_ie_len_he_cap()
3193 sizeof(he_cap->he_cap_elem) + n + in ieee80211_ie_len_he_cap()
3194 ieee80211_he_ppe_size(he_cap->ppe_thres[0], in ieee80211_ie_len_he_cap()
3195 he_cap->he_cap_elem.phy_cap_info); in ieee80211_ie_len_he_cap()
3216 elem = he_cap->he_cap_elem; in ieee80211_ie_build_he_cap()
3233 sizeof(he_cap->he_cap_elem) + n + in ieee80211_ie_build_he_cap()
3234 ieee80211_he_ppe_size(he_cap->ppe_thres[0], in ieee80211_ie_build_he_cap()
3235 he_cap->he_cap_elem.phy_cap_info); in ieee80211_ie_build_he_cap()
3237 if ((end - pos) < ie_len) in ieee80211_ie_build_he_cap()
3248 memcpy(pos, &he_cap->he_mcs_nss_supp, n); in ieee80211_ie_build_he_cap()
3252 if ((he_cap->he_cap_elem.phy_cap_info[6] & in ieee80211_ie_build_he_cap()
3260 n = hweight8(he_cap->ppe_thres[0] & in ieee80211_ie_build_he_cap()
3262 n *= (1 + ((he_cap->ppe_thres[0] & IEEE80211_PPE_THRES_NSS_MASK) >> in ieee80211_ie_build_he_cap()
3273 memcpy(pos, &he_cap->ppe_thres, n); in ieee80211_ie_build_he_cap()
3277 orig_pos[1] = (pos - orig_pos) - 2; in ieee80211_ie_build_he_cap()
3287 enum nl80211_iftype iftype = ieee80211_vif_type_p2p(&sdata->vif); in ieee80211_ie_build_he_6ghz_cap()
3291 if (!cfg80211_any_usable_channels(sdata->local->hw.wiphy, in ieee80211_ie_build_he_6ghz_cap()
3296 sband = sdata->local->hw.wiphy->bands[NL80211_BAND_6GHZ]; in ieee80211_ie_build_he_6ghz_cap()
3303 if (!iftd->he_6ghz_capa.capa) in ieee80211_ie_build_he_6ghz_cap()
3306 cap = le16_to_cpu(iftd->he_6ghz_capa.capa); in ieee80211_ie_build_he_6ghz_cap()
3342 ht_oper->primary_chan = ieee80211_frequency_to_channel( in ieee80211_ie_build_ht_oper()
3343 chandef->chan->center_freq); in ieee80211_ie_build_ht_oper()
3344 switch (chandef->width) { in ieee80211_ie_build_ht_oper()
3349 if (chandef->center_freq1 > chandef->chan->center_freq) in ieee80211_ie_build_ht_oper()
3350 ht_oper->ht_param = IEEE80211_HT_PARAM_CHA_SEC_ABOVE; in ieee80211_ie_build_ht_oper()
3352 ht_oper->ht_param = IEEE80211_HT_PARAM_CHA_SEC_BELOW; in ieee80211_ie_build_ht_oper()
3359 ht_oper->ht_param = IEEE80211_HT_PARAM_CHA_SEC_NONE; in ieee80211_ie_build_ht_oper()
3362 if (ht_cap->cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40 && in ieee80211_ie_build_ht_oper()
3363 chandef->width != NL80211_CHAN_WIDTH_20_NOHT && in ieee80211_ie_build_ht_oper()
3364 chandef->width != NL80211_CHAN_WIDTH_20) in ieee80211_ie_build_ht_oper()
3365 ht_oper->ht_param |= IEEE80211_HT_PARAM_CHAN_WIDTH_ANY; in ieee80211_ie_build_ht_oper()
3368 ht_oper->ht_param |= IEEE80211_HT_PARAM_RIFS_MODE; in ieee80211_ie_build_ht_oper()
3370 ht_oper->operation_mode = cpu_to_le16(prot_mode); in ieee80211_ie_build_ht_oper()
3371 ht_oper->stbc_param = 0x0000; in ieee80211_ie_build_ht_oper()
3375 memset(&ht_oper->basic_set, 0, 16); in ieee80211_ie_build_ht_oper()
3376 memcpy(&ht_oper->basic_set, &ht_cap->mcs, 10); in ieee80211_ie_build_ht_oper()
3387 switch (chandef->width) { in ieee80211_ie_build_wide_bw_cs()
3406 *pos++ = ieee80211_frequency_to_channel(chandef->center_freq1); in ieee80211_ie_build_wide_bw_cs()
3408 if (chandef->center_freq2) in ieee80211_ie_build_wide_bw_cs()
3409 *pos++ = ieee80211_frequency_to_channel(chandef->center_freq2); in ieee80211_ie_build_wide_bw_cs()
3422 vht_oper->center_freq_seg0_idx = ieee80211_frequency_to_channel( in ieee80211_ie_build_vht_oper()
3423 chandef->center_freq1); in ieee80211_ie_build_vht_oper()
3424 if (chandef->center_freq2) in ieee80211_ie_build_vht_oper()
3425 vht_oper->center_freq_seg1_idx = in ieee80211_ie_build_vht_oper()
3426 ieee80211_frequency_to_channel(chandef->center_freq2); in ieee80211_ie_build_vht_oper()
3428 vht_oper->center_freq_seg1_idx = 0x00; in ieee80211_ie_build_vht_oper()
3430 switch (chandef->width) { in ieee80211_ie_build_vht_oper()
3436 vht_oper->chan_width = IEEE80211_VHT_CHANWIDTH_80MHZ; in ieee80211_ie_build_vht_oper()
3437 vht_oper->center_freq_seg1_idx = vht_oper->center_freq_seg0_idx; in ieee80211_ie_build_vht_oper()
3438 if (chandef->chan->center_freq < chandef->center_freq1) in ieee80211_ie_build_vht_oper()
3439 vht_oper->center_freq_seg0_idx -= 8; in ieee80211_ie_build_vht_oper()
3441 vht_oper->center_freq_seg0_idx += 8; in ieee80211_ie_build_vht_oper()
3448 vht_oper->chan_width = IEEE80211_VHT_CHANWIDTH_80MHZ; in ieee80211_ie_build_vht_oper()
3451 vht_oper->chan_width = IEEE80211_VHT_CHANWIDTH_80MHZ; in ieee80211_ie_build_vht_oper()
3458 vht_oper->chan_width = IEEE80211_VHT_CHANWIDTH_USE_HT; in ieee80211_ie_build_vht_oper()
3463 vht_oper->basic_mcs_set = cpu_to_le16(0xffff); in ieee80211_ie_build_vht_oper()
3475 if (chandef->chan->band == NL80211_BAND_6GHZ) in ieee80211_ie_build_he_oper()
3489 if (chandef->chan->band == NL80211_BAND_6GHZ) in ieee80211_ie_build_he_oper()
3494 he_oper->he_oper_params = cpu_to_le32(he_oper_params); in ieee80211_ie_build_he_oper()
3497 he_oper->he_mcs_nss_set = cpu_to_le16(0xffff); in ieee80211_ie_build_he_oper()
3500 if (chandef->chan->band != NL80211_BAND_6GHZ) in ieee80211_ie_build_he_oper()
3505 he_6ghz_op->minrate = 6; /* 6 Mbps */ in ieee80211_ie_build_he_oper()
3506 he_6ghz_op->primary = in ieee80211_ie_build_he_oper()
3507 ieee80211_frequency_to_channel(chandef->chan->center_freq); in ieee80211_ie_build_he_oper()
3508 he_6ghz_op->ccfs0 = in ieee80211_ie_build_he_oper()
3509 ieee80211_frequency_to_channel(chandef->center_freq1); in ieee80211_ie_build_he_oper()
3510 if (chandef->center_freq2) in ieee80211_ie_build_he_oper()
3511 he_6ghz_op->ccfs1 = in ieee80211_ie_build_he_oper()
3512 ieee80211_frequency_to_channel(chandef->center_freq2); in ieee80211_ie_build_he_oper()
3514 he_6ghz_op->ccfs1 = 0; in ieee80211_ie_build_he_oper()
3516 switch (chandef->width) { in ieee80211_ie_build_he_oper()
3528 he_6ghz_op->control = in ieee80211_ie_build_he_oper()
3530 he_6ghz_op->ccfs1 = he_6ghz_op->ccfs0; in ieee80211_ie_build_he_oper()
3531 if (chandef->chan->center_freq < chandef->center_freq1) in ieee80211_ie_build_he_oper()
3532 he_6ghz_op->ccfs0 -= 8; in ieee80211_ie_build_he_oper()
3534 he_6ghz_op->ccfs0 += 8; in ieee80211_ie_build_he_oper()
3537 he_6ghz_op->control = in ieee80211_ie_build_he_oper()
3541 he_6ghz_op->control = in ieee80211_ie_build_he_oper()
3545 he_6ghz_op->control = in ieee80211_ie_build_he_oper()
3549 he_6ghz_op->control = in ieee80211_ie_build_he_oper()
3565 &eht_cap->eht_mcs_nss_supp.only_20mhz; in ieee80211_ie_build_eht_oper()
3579 memcpy(&eht_oper->basic_mcs_nss, eht_mcs_nss, sizeof(*eht_mcs_nss)); in ieee80211_ie_build_eht_oper()
3580 eht_oper->params |= IEEE80211_EHT_OPER_INFO_PRESENT; in ieee80211_ie_build_eht_oper()
3584 (struct ieee80211_eht_operation_info *)eht_oper->optional; in ieee80211_ie_build_eht_oper()
3586 eht_oper_info->ccfs0 = in ieee80211_ie_build_eht_oper()
3587 ieee80211_frequency_to_channel(chandef->center_freq1); in ieee80211_ie_build_eht_oper()
3588 if (chandef->center_freq2) in ieee80211_ie_build_eht_oper()
3589 eht_oper_info->ccfs1 = in ieee80211_ie_build_eht_oper()
3590 ieee80211_frequency_to_channel(chandef->center_freq2); in ieee80211_ie_build_eht_oper()
3592 eht_oper_info->ccfs1 = 0; in ieee80211_ie_build_eht_oper()
3594 switch (chandef->width) { in ieee80211_ie_build_eht_oper()
3597 eht_oper_info->ccfs1 = eht_oper_info->ccfs0; in ieee80211_ie_build_eht_oper()
3598 if (chandef->chan->center_freq < chandef->center_freq1) in ieee80211_ie_build_eht_oper()
3599 eht_oper_info->ccfs0 -= 16; in ieee80211_ie_build_eht_oper()
3601 eht_oper_info->ccfs0 += 16; in ieee80211_ie_build_eht_oper()
3604 eht_oper_info->ccfs1 = eht_oper_info->ccfs0; in ieee80211_ie_build_eht_oper()
3605 if (chandef->chan->center_freq < chandef->center_freq1) in ieee80211_ie_build_eht_oper()
3606 eht_oper_info->ccfs0 -= 8; in ieee80211_ie_build_eht_oper()
3608 eht_oper_info->ccfs0 += 8; in ieee80211_ie_build_eht_oper()
3623 eht_oper_info->control = chan_width; in ieee80211_ie_build_eht_oper()
3626 /* TODO: eht_oper_info->optional */ in ieee80211_ie_build_eht_oper()
3639 switch (ht_oper->ht_param & IEEE80211_HT_PARAM_CHA_SEC_OFFSET) { in ieee80211_chandef_ht_oper()
3653 cfg80211_chandef_create(chandef, chandef->chan, channel_type); in ieee80211_chandef_ht_oper()
3677 vht_cap = hw->wiphy->bands[chandef->chan->band]->vht_cap.cap; in ieee80211_chandef_vht_oper()
3686 ccfs0 = oper->center_freq_seg0_idx; in ieee80211_chandef_vht_oper()
3687 ccfs1 = oper->center_freq_seg1_idx; in ieee80211_chandef_vht_oper()
3688 ccfs2 = (le16_to_cpu(htop->operation_mode) & in ieee80211_chandef_vht_oper()
3699 * Cf. IEEE 802.11 Table 9-250 in ieee80211_chandef_vht_oper()
3735 cf0 = ieee80211_channel_to_frequency(ccf0, chandef->chan->band); in ieee80211_chandef_vht_oper()
3736 cf1 = ieee80211_channel_to_frequency(ccf1, chandef->chan->band); in ieee80211_chandef_vht_oper()
3738 switch (oper->chan_width) { in ieee80211_chandef_vht_oper()
3749 diff = abs(ccf1 - ccf0); in ieee80211_chandef_vht_oper()
3785 struct ieee80211_eht_operation_info *info = (void *)eht_oper->optional; in ieee80211_chandef_eht_oper()
3787 chandef->center_freq1 = in ieee80211_chandef_eht_oper()
3788 ieee80211_channel_to_frequency(info->ccfs0, in ieee80211_chandef_eht_oper()
3789 chandef->chan->band); in ieee80211_chandef_eht_oper()
3791 switch (u8_get_bits(info->control, in ieee80211_chandef_eht_oper()
3794 chandef->width = NL80211_CHAN_WIDTH_20; in ieee80211_chandef_eht_oper()
3797 chandef->width = NL80211_CHAN_WIDTH_40; in ieee80211_chandef_eht_oper()
3800 chandef->width = NL80211_CHAN_WIDTH_80; in ieee80211_chandef_eht_oper()
3804 chandef->width = NL80211_CHAN_WIDTH_160; in ieee80211_chandef_eht_oper()
3805 chandef->center_freq1 = in ieee80211_chandef_eht_oper()
3806 ieee80211_channel_to_frequency(info->ccfs1, in ieee80211_chandef_eht_oper()
3807 chandef->chan->band); in ieee80211_chandef_eht_oper()
3809 chandef->width = NL80211_CHAN_WIDTH_80; in ieee80211_chandef_eht_oper()
3814 chandef->width = NL80211_CHAN_WIDTH_320; in ieee80211_chandef_eht_oper()
3815 chandef->center_freq1 = in ieee80211_chandef_eht_oper()
3816 ieee80211_channel_to_frequency(info->ccfs1, in ieee80211_chandef_eht_oper()
3817 chandef->chan->band); in ieee80211_chandef_eht_oper()
3819 chandef->width = NL80211_CHAN_WIDTH_160; in ieee80211_chandef_eht_oper()
3821 chandef->width = NL80211_CHAN_WIDTH_80; in ieee80211_chandef_eht_oper()
3823 if (chandef->center_freq1 > chandef->chan->center_freq) in ieee80211_chandef_eht_oper()
3824 chandef->center_freq1 -= 40; in ieee80211_chandef_eht_oper()
3826 chandef->center_freq1 += 40; in ieee80211_chandef_eht_oper()
3837 struct ieee80211_local *local = sdata->local; in ieee80211_chandef_he_6ghz_oper()
3839 enum nl80211_iftype iftype = ieee80211_vif_type_p2p(&sdata->vif); in ieee80211_chandef_he_6ghz_oper()
3844 struct ieee80211_bss_conf *bss_conf = &sdata->vif.bss_conf; in ieee80211_chandef_he_6ghz_oper()
3849 if (chandef->chan->band != NL80211_BAND_6GHZ) in ieee80211_chandef_he_6ghz_oper()
3852 sband = local->hw.wiphy->bands[NL80211_BAND_6GHZ]; in ieee80211_chandef_he_6ghz_oper()
3860 he_phy_cap = he_cap->he_cap_elem.phy_cap_info[0]; in ieee80211_chandef_he_6ghz_oper()
3871 chandef->chan->center_freq); in ieee80211_chandef_he_6ghz_oper()
3884 chandef->chan->center_freq); in ieee80211_chandef_he_6ghz_oper()
3893 freq = ieee80211_channel_to_frequency(he_6ghz_oper->primary, in ieee80211_chandef_he_6ghz_oper()
3895 he_chandef.chan = ieee80211_get_channel(sdata->local->hw.wiphy, freq); in ieee80211_chandef_he_6ghz_oper()
3897 switch (u8_get_bits(he_6ghz_oper->control, in ieee80211_chandef_he_6ghz_oper()
3900 bss_conf->power_type = IEEE80211_REG_LPI_AP; in ieee80211_chandef_he_6ghz_oper()
3903 bss_conf->power_type = IEEE80211_REG_SP_AP; in ieee80211_chandef_he_6ghz_oper()
3906 bss_conf->power_type = IEEE80211_REG_UNSET_AP; in ieee80211_chandef_he_6ghz_oper()
3911 !(eht_oper->params & IEEE80211_EHT_OPER_INFO_PRESENT)) { in ieee80211_chandef_he_6ghz_oper()
3912 switch (u8_get_bits(he_6ghz_oper->control, in ieee80211_chandef_he_6ghz_oper()
3925 if (!he_6ghz_oper->ccfs1) in ieee80211_chandef_he_6ghz_oper()
3927 if (abs(he_6ghz_oper->ccfs1 - he_6ghz_oper->ccfs0) == 8) { in ieee80211_chandef_he_6ghz_oper()
3939 ieee80211_channel_to_frequency(he_6ghz_oper->ccfs1, in ieee80211_chandef_he_6ghz_oper()
3943 ieee80211_channel_to_frequency(he_6ghz_oper->ccfs0, in ieee80211_chandef_he_6ghz_oper()
3947 ieee80211_channel_to_frequency(he_6ghz_oper->ccfs1, in ieee80211_chandef_he_6ghz_oper()
3951 eht_phy_cap = eht_cap->eht_cap_elem.phy_cap_info[0]; in ieee80211_chandef_he_6ghz_oper()
3962 he_chandef.chan ? he_chandef.chan->center_freq : 0, in ieee80211_chandef_he_6ghz_oper()
3982 switch (FIELD_GET(S1G_OPER_CH_WIDTH_OPER, oper->ch_width)) { in ieee80211_chandef_s1g_oper()
3984 chandef->width = NL80211_CHAN_WIDTH_1; in ieee80211_chandef_s1g_oper()
3987 chandef->width = NL80211_CHAN_WIDTH_2; in ieee80211_chandef_s1g_oper()
3990 chandef->width = NL80211_CHAN_WIDTH_4; in ieee80211_chandef_s1g_oper()
3993 chandef->width = NL80211_CHAN_WIDTH_8; in ieee80211_chandef_s1g_oper()
3996 chandef->width = NL80211_CHAN_WIDTH_16; in ieee80211_chandef_s1g_oper()
4002 oper_freq = ieee80211_channel_to_freq_khz(oper->oper_ch, in ieee80211_chandef_s1g_oper()
4004 chandef->center_freq1 = KHZ_TO_MHZ(oper_freq); in ieee80211_chandef_s1g_oper()
4005 chandef->freq1_offset = oper_freq % 1000; in ieee80211_chandef_s1g_oper()
4024 for (j = 0; j < sband->n_bitrates; j++) { in ieee80211_parse_bitrates()
4025 br = &sband->bitrates[j]; in ieee80211_parse_bitrates()
4026 if ((rate_flags & br->flags) != rate_flags) in ieee80211_parse_bitrates()
4029 brate = DIV_ROUND_UP(br->bitrate, (1 << shift) * 5); in ieee80211_parse_bitrates()
4044 struct ieee80211_local *local = sdata->local; in ieee80211_add_srates_ie()
4048 u32 basic_rates = sdata->vif.bss_conf.basic_rates; in ieee80211_add_srates_ie()
4051 shift = ieee80211_vif_get_shift(&sdata->vif); in ieee80211_add_srates_ie()
4052 rate_flags = ieee80211_chandef_rate_flags(&sdata->vif.bss_conf.chandef); in ieee80211_add_srates_ie()
4053 sband = local->hw.wiphy->bands[band]; in ieee80211_add_srates_ie()
4055 for (i = 0; i < sband->n_bitrates; i++) { in ieee80211_add_srates_ie()
4056 if ((rate_flags & sband->bitrates[i].flags) != rate_flags) in ieee80211_add_srates_ie()
4064 return -ENOMEM; in ieee80211_add_srates_ie()
4071 if ((rate_flags & sband->bitrates[i].flags) != rate_flags) in ieee80211_add_srates_ie()
4076 rate = DIV_ROUND_UP(sband->bitrates[i].bitrate, in ieee80211_add_srates_ie()
4088 struct ieee80211_local *local = sdata->local; in ieee80211_add_ext_srates_ie()
4092 u32 basic_rates = sdata->vif.bss_conf.basic_rates; in ieee80211_add_ext_srates_ie()
4095 rate_flags = ieee80211_chandef_rate_flags(&sdata->vif.bss_conf.chandef); in ieee80211_add_ext_srates_ie()
4096 shift = ieee80211_vif_get_shift(&sdata->vif); in ieee80211_add_ext_srates_ie()
4098 sband = local->hw.wiphy->bands[band]; in ieee80211_add_ext_srates_ie()
4100 for (i = 0; i < sband->n_bitrates; i++) { in ieee80211_add_ext_srates_ie()
4101 if ((rate_flags & sband->bitrates[i].flags) != rate_flags) in ieee80211_add_ext_srates_ie()
4107 exrates -= 8; in ieee80211_add_ext_srates_ie()
4112 return -ENOMEM; in ieee80211_add_ext_srates_ie()
4118 for (i = 8; i < sband->n_bitrates; i++) { in ieee80211_add_ext_srates_ie()
4120 if ((rate_flags & sband->bitrates[i].flags) in ieee80211_add_ext_srates_ie()
4125 rate = DIV_ROUND_UP(sband->bitrates[i].bitrate, 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
4176 u64 ts = status->mactime; in ieee80211_calculate_rx_timestamp()
4177 struct rate_info ri; in ieee80211_calculate_rx_timestamp() local
4184 memset(&ri, 0, sizeof(ri)); in ieee80211_calculate_rx_timestamp()
4186 ri.bw = status->bw; in ieee80211_calculate_rx_timestamp()
4189 switch (status->encoding) { in ieee80211_calculate_rx_timestamp()
4191 ri.flags |= RATE_INFO_FLAGS_EHT_MCS; in ieee80211_calculate_rx_timestamp()
4192 ri.mcs = status->rate_idx; in ieee80211_calculate_rx_timestamp()
4193 ri.nss = status->nss; in ieee80211_calculate_rx_timestamp()
4194 ri.eht_ru_alloc = status->eht.ru; in ieee80211_calculate_rx_timestamp()
4195 if (status->enc_flags & RX_ENC_FLAG_SHORT_GI) in ieee80211_calculate_rx_timestamp()
4196 ri.flags |= RATE_INFO_FLAGS_SHORT_GI; in ieee80211_calculate_rx_timestamp()
4198 if (status->flag & RX_FLAG_MACTIME_PLCP_START) { in ieee80211_calculate_rx_timestamp()
4204 ri.flags |= RATE_INFO_FLAGS_HE_MCS; in ieee80211_calculate_rx_timestamp()
4205 ri.mcs = status->rate_idx; in ieee80211_calculate_rx_timestamp()
4206 ri.nss = status->nss; in ieee80211_calculate_rx_timestamp()
4207 ri.he_ru_alloc = status->he_ru; in ieee80211_calculate_rx_timestamp()
4208 if (status->enc_flags & RX_ENC_FLAG_SHORT_GI) in ieee80211_calculate_rx_timestamp()
4209 ri.flags |= RATE_INFO_FLAGS_SHORT_GI; in ieee80211_calculate_rx_timestamp()
4215 if (status->flag & RX_FLAG_MACTIME_PLCP_START) { in ieee80211_calculate_rx_timestamp()
4221 * For HE MU PPDU, add the HE-SIG-B. in ieee80211_calculate_rx_timestamp()
4222 * For HE ER PPDU, add 8us for the HE-SIG-A. in ieee80211_calculate_rx_timestamp()
4223 * For HE TB PPDU, add 4us for the HE-STF. in ieee80211_calculate_rx_timestamp()
4224 * Add the HE-LTF durations - variable. in ieee80211_calculate_rx_timestamp()
4230 ri.mcs = status->rate_idx; in ieee80211_calculate_rx_timestamp()
4231 ri.flags |= RATE_INFO_FLAGS_MCS; in ieee80211_calculate_rx_timestamp()
4232 if (status->enc_flags & RX_ENC_FLAG_SHORT_GI) in ieee80211_calculate_rx_timestamp()
4233 ri.flags |= RATE_INFO_FLAGS_SHORT_GI; in ieee80211_calculate_rx_timestamp()
4239 if (status->flag & RX_FLAG_MACTIME_PLCP_START) { in ieee80211_calculate_rx_timestamp()
4241 if (status->enc_flags & RX_ENC_FLAG_HT_GF) in ieee80211_calculate_rx_timestamp()
4247 * Add Data HT-LTFs per streams in ieee80211_calculate_rx_timestamp()
4248 * TODO: add Extension HT-LTFs, 4us per LTF in ieee80211_calculate_rx_timestamp()
4250 n_ltf = ((ri.mcs >> 3) & 3) + 1; in ieee80211_calculate_rx_timestamp()
4257 ri.flags |= RATE_INFO_FLAGS_VHT_MCS; in ieee80211_calculate_rx_timestamp()
4258 ri.mcs = status->rate_idx; in ieee80211_calculate_rx_timestamp()
4259 ri.nss = status->nss; in ieee80211_calculate_rx_timestamp()
4260 if (status->enc_flags & RX_ENC_FLAG_SHORT_GI) in ieee80211_calculate_rx_timestamp()
4261 ri.flags |= RATE_INFO_FLAGS_SHORT_GI; in ieee80211_calculate_rx_timestamp()
4267 if (status->flag & RX_FLAG_MACTIME_PLCP_START) { in ieee80211_calculate_rx_timestamp()
4272 * Add VHT-LTFs per streams in ieee80211_calculate_rx_timestamp()
4274 n_ltf = (ri.nss != 1) && (ri.nss % 2) ? in ieee80211_calculate_rx_timestamp()
4275 ri.nss + 1 : ri.nss; in ieee80211_calculate_rx_timestamp()
4288 switch (status->bw) { in ieee80211_calculate_rx_timestamp()
4297 sband = local->hw.wiphy->bands[status->band]; in ieee80211_calculate_rx_timestamp()
4298 bitrate = sband->bitrates[status->rate_idx].bitrate; in ieee80211_calculate_rx_timestamp()
4299 ri.legacy = DIV_ROUND_UP(bitrate, (1 << shift)); in ieee80211_calculate_rx_timestamp()
4301 if (status->flag & RX_FLAG_MACTIME_PLCP_START) { in ieee80211_calculate_rx_timestamp()
4302 if (status->band == NL80211_BAND_5GHZ) { in ieee80211_calculate_rx_timestamp()
4305 } else if (status->enc_flags & RX_ENC_FLAG_SHORTPRE) { in ieee80211_calculate_rx_timestamp()
4315 rate = cfg80211_calculate_bitrate(&ri); in ieee80211_calculate_rx_timestamp()
4318 (unsigned long long)status->flag, status->rate_idx, in ieee80211_calculate_rx_timestamp()
4319 status->nss)) in ieee80211_calculate_rx_timestamp()
4323 if (status->flag & RX_FLAG_MACTIME_END) in ieee80211_calculate_rx_timestamp()
4324 ts -= mpdu_len * 8 * 10 / rate; in ieee80211_calculate_rx_timestamp()
4337 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_dfs_cac_cancel()
4339 mutex_lock(&local->mtx); in ieee80211_dfs_cac_cancel()
4340 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_dfs_cac_cancel()
4341 /* it might be waiting for the local->mtx, but then in ieee80211_dfs_cac_cancel()
4342 * by the time it gets it, sdata->wdev.cac_started in ieee80211_dfs_cac_cancel()
4345 cancel_delayed_work(&sdata->deflink.dfs_cac_timer_work); in ieee80211_dfs_cac_cancel()
4347 if (sdata->wdev.cac_started) { in ieee80211_dfs_cac_cancel()
4348 chandef = sdata->vif.bss_conf.chandef; in ieee80211_dfs_cac_cancel()
4349 ieee80211_link_release_channel(&sdata->deflink); in ieee80211_dfs_cac_cancel()
4350 cfg80211_cac_event(sdata->dev, in ieee80211_dfs_cac_cancel()
4356 mutex_unlock(&local->mtx); in ieee80211_dfs_cac_cancel()
4364 struct cfg80211_chan_def chandef = local->hw.conf.chandef; in ieee80211_dfs_radar_detected_work()
4368 mutex_lock(&local->chanctx_mtx); in ieee80211_dfs_radar_detected_work()
4369 list_for_each_entry(ctx, &local->chanctx_list, list) { in ieee80211_dfs_radar_detected_work()
4370 if (ctx->replace_state == IEEE80211_CHANCTX_REPLACES_OTHER) in ieee80211_dfs_radar_detected_work()
4374 chandef = ctx->conf.def; in ieee80211_dfs_radar_detected_work()
4376 mutex_unlock(&local->chanctx_mtx); in ieee80211_dfs_radar_detected_work()
4381 /* XXX: multi-channel is not supported yet */ in ieee80211_dfs_radar_detected_work()
4384 cfg80211_radar_event(local->hw.wiphy, &chandef, GFP_KERNEL); in ieee80211_dfs_radar_detected_work()
4393 wiphy_work_queue(hw->wiphy, &local->radar_detected_work); in ieee80211_radar_detected()
4402 switch (c->width) { in ieee80211_chandef_downgrade()
4404 c->width = NL80211_CHAN_WIDTH_20_NOHT; in ieee80211_chandef_downgrade()
4408 c->width = NL80211_CHAN_WIDTH_20; in ieee80211_chandef_downgrade()
4409 c->center_freq1 = c->chan->center_freq; in ieee80211_chandef_downgrade()
4414 tmp = (30 + c->chan->center_freq - c->center_freq1)/20; in ieee80211_chandef_downgrade()
4418 c->center_freq1 = c->center_freq1 - 20 + 40 * tmp; in ieee80211_chandef_downgrade()
4419 c->width = NL80211_CHAN_WIDTH_40; in ieee80211_chandef_downgrade()
4423 c->center_freq2 = 0; in ieee80211_chandef_downgrade()
4424 c->width = NL80211_CHAN_WIDTH_80; in ieee80211_chandef_downgrade()
4430 tmp = (70 + c->chan->center_freq - c->center_freq1)/20; in ieee80211_chandef_downgrade()
4433 c->center_freq1 = c->center_freq1 - 40 + 80 * tmp; in ieee80211_chandef_downgrade()
4434 c->width = NL80211_CHAN_WIDTH_80; in ieee80211_chandef_downgrade()
4440 tmp = (150 + c->chan->center_freq - c->center_freq1) / 20; in ieee80211_chandef_downgrade()
4443 c->center_freq1 = c->center_freq1 - 80 + 160 * tmp; in ieee80211_chandef_downgrade()
4444 c->width = NL80211_CHAN_WIDTH_160; in ieee80211_chandef_downgrade()
4450 c->width = NL80211_CHAN_WIDTH_20_NOHT; in ieee80211_chandef_downgrade()
4461 /* keep c->width */ in ieee80211_chandef_downgrade()
4501 struct ieee80211_local *local = sdata->local; in ieee80211_send_action_csa()
4507 if (sdata->vif.type != NL80211_IFTYPE_ADHOC && in ieee80211_send_action_csa()
4508 sdata->vif.type != NL80211_IFTYPE_MESH_POINT) in ieee80211_send_action_csa()
4509 return -EOPNOTSUPP; in ieee80211_send_action_csa()
4511 skb = dev_alloc_skb(local->tx_headroom + hdr_len + in ieee80211_send_action_csa()
4517 return -ENOMEM; in ieee80211_send_action_csa()
4519 skb_reserve(skb, local->tx_headroom); in ieee80211_send_action_csa()
4521 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | in ieee80211_send_action_csa()
4524 eth_broadcast_addr(mgmt->da); in ieee80211_send_action_csa()
4525 memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); in ieee80211_send_action_csa()
4526 if (ieee80211_vif_is_mesh(&sdata->vif)) { in ieee80211_send_action_csa()
4527 memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN); in ieee80211_send_action_csa()
4529 struct ieee80211_if_ibss *ifibss = &sdata->u.ibss; in ieee80211_send_action_csa()
4530 memcpy(mgmt->bssid, ifibss->bssid, ETH_ALEN); in ieee80211_send_action_csa()
4532 mgmt->u.action.category = WLAN_CATEGORY_SPECTRUM_MGMT; in ieee80211_send_action_csa()
4533 mgmt->u.action.u.chan_switch.action_code = WLAN_ACTION_SPCT_CHL_SWITCH; in ieee80211_send_action_csa()
4537 *pos++ = csa_settings->block_tx ? 1 : 0; /* CSA mode */ in ieee80211_send_action_csa()
4538 freq = csa_settings->chandef.chan->center_freq; in ieee80211_send_action_csa()
4540 *pos++ = csa_settings->count; /* count */ in ieee80211_send_action_csa()
4542 if (csa_settings->chandef.width == NL80211_CHAN_WIDTH_40) { in ieee80211_send_action_csa()
4548 ch_type = cfg80211_get_chandef_type(&csa_settings->chandef); in ieee80211_send_action_csa()
4555 if (ieee80211_vif_is_mesh(&sdata->vif)) { in ieee80211_send_action_csa()
4556 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; in ieee80211_send_action_csa()
4561 *pos++ = sdata->u.mesh.mshcfg.dot11MeshTTL; /* Mesh TTL */ in ieee80211_send_action_csa()
4564 *pos++ |= csa_settings->block_tx ? in ieee80211_send_action_csa()
4568 put_unaligned_le16(ifmsh->pre_value, pos);/* Precedence Value */ in ieee80211_send_action_csa()
4572 if (csa_settings->chandef.width == NL80211_CHAN_WIDTH_80 || in ieee80211_send_action_csa()
4573 csa_settings->chandef.width == NL80211_CHAN_WIDTH_80P80 || in ieee80211_send_action_csa()
4574 csa_settings->chandef.width == NL80211_CHAN_WIDTH_160) { in ieee80211_send_action_csa()
4576 ieee80211_ie_build_wide_bw_cs(pos, &csa_settings->chandef); in ieee80211_send_action_csa()
4586 s32 end = data->desc[i].start + data->desc[i].duration - (tsf + 1); in ieee80211_extend_noa_desc()
4593 if (data->count[i] == 1) in ieee80211_extend_noa_desc()
4596 if (data->desc[i].interval == 0) in ieee80211_extend_noa_desc()
4600 skip = DIV_ROUND_UP(-end, data->desc[i].interval); in ieee80211_extend_noa_desc()
4601 if (data->count[i] < 255) { in ieee80211_extend_noa_desc()
4602 if (data->count[i] <= skip) { in ieee80211_extend_noa_desc()
4603 data->count[i] = 0; in ieee80211_extend_noa_desc()
4607 data->count[i] -= skip; in ieee80211_extend_noa_desc()
4610 data->desc[i].start += skip * data->desc[i].interval; in ieee80211_extend_noa_desc()
4625 if (!data->count[i]) in ieee80211_extend_absent_time()
4631 cur = data->desc[i].start - tsf; in ieee80211_extend_absent_time()
4635 cur = data->desc[i].start + data->desc[i].duration - tsf; in ieee80211_extend_absent_time()
4667 u32 next_offset = BIT(31) - 1; in ieee80211_update_p2p_noa()
4670 data->absent = 0; in ieee80211_update_p2p_noa()
4671 data->has_next_tsf = false; in ieee80211_update_p2p_noa()
4675 if (!data->count[i]) in ieee80211_update_p2p_noa()
4679 start = data->desc[i].start - tsf; in ieee80211_update_p2p_noa()
4681 data->absent |= BIT(i); in ieee80211_update_p2p_noa()
4686 data->has_next_tsf = true; in ieee80211_update_p2p_noa()
4689 if (data->absent) in ieee80211_update_p2p_noa()
4692 data->next_tsf = tsf + next_offset; in ieee80211_update_p2p_noa()
4705 const struct ieee80211_p2p_noa_desc *desc = &attr->desc[i]; in ieee80211_parse_p2p_noa()
4707 if (!desc->count || !desc->duration) in ieee80211_parse_p2p_noa()
4710 data->count[i] = desc->count; in ieee80211_parse_p2p_noa()
4711 data->desc[i].start = le32_to_cpu(desc->start_time); in ieee80211_parse_p2p_noa()
4712 data->desc[i].duration = le32_to_cpu(desc->duration); in ieee80211_parse_p2p_noa()
4713 data->desc[i].interval = le32_to_cpu(desc->interval); in ieee80211_parse_p2p_noa()
4715 if (data->count[i] > 1 && in ieee80211_parse_p2p_noa()
4716 data->desc[i].interval < data->desc[i].duration) in ieee80211_parse_p2p_noa()
4735 u16 beacon_int = sdata->vif.bss_conf.beacon_int * 1024; in ieee80211_recalc_dtim()
4736 u8 dtim_period = sdata->vif.bss_conf.dtim_period; in ieee80211_recalc_dtim()
4740 if (tsf == -1ULL || !beacon_int || !dtim_period) in ieee80211_recalc_dtim()
4743 if (sdata->vif.type == NL80211_IFTYPE_AP || in ieee80211_recalc_dtim()
4744 sdata->vif.type == NL80211_IFTYPE_AP_VLAN) { in ieee80211_recalc_dtim()
4745 if (!sdata->bss) in ieee80211_recalc_dtim()
4748 ps = &sdata->bss->ps; in ieee80211_recalc_dtim()
4749 } else if (ieee80211_vif_is_mesh(&sdata->vif)) { in ieee80211_recalc_dtim()
4750 ps = &sdata->u.mesh.ps; in ieee80211_recalc_dtim()
4758 * dtim_count = dtim_period - (tsf / bcn_int) % dtim_period in ieee80211_recalc_dtim()
4766 dtim_count = dtim_period - bcns_from_dtim; in ieee80211_recalc_dtim()
4768 ps->dtim_count = dtim_count; in ieee80211_recalc_dtim()
4777 lockdep_assert_held(&local->chanctx_mtx); in ieee80211_chanctx_radar_detect()
4779 if (WARN_ON(ctx->replace_state == IEEE80211_CHANCTX_WILL_BE_REPLACED)) in ieee80211_chanctx_radar_detect()
4782 list_for_each_entry(link, &ctx->reserved_links, reserved_chanctx_list) in ieee80211_chanctx_radar_detect()
4783 if (link->reserved_radar_required) in ieee80211_chanctx_radar_detect()
4784 radar_detect |= BIT(link->reserved_chandef.width); in ieee80211_chanctx_radar_detect()
4787 * An in-place reservation context should not have any assigned vifs in ieee80211_chanctx_radar_detect()
4790 WARN_ON(ctx->replace_state == IEEE80211_CHANCTX_REPLACES_OTHER && in ieee80211_chanctx_radar_detect()
4791 !list_empty(&ctx->assigned_links)); in ieee80211_chanctx_radar_detect()
4793 list_for_each_entry(link, &ctx->assigned_links, assigned_chanctx_list) { in ieee80211_chanctx_radar_detect()
4794 if (!link->radar_required) in ieee80211_chanctx_radar_detect()
4798 BIT(link->conf->chandef.width); in ieee80211_chanctx_radar_detect()
4809 struct ieee80211_local *local = sdata->local; in ieee80211_check_combinations()
4811 enum nl80211_iftype iftype = sdata->wdev.iftype; in ieee80211_check_combinations()
4818 lockdep_assert_held(&local->chanctx_mtx); in ieee80211_check_combinations()
4821 return -EINVAL; in ieee80211_check_combinations()
4824 !chandef->chan)) in ieee80211_check_combinations()
4825 return -EINVAL; in ieee80211_check_combinations()
4828 return -EINVAL; in ieee80211_check_combinations()
4830 if (sdata->vif.type == NL80211_IFTYPE_AP || in ieee80211_check_combinations()
4831 sdata->vif.type == NL80211_IFTYPE_MESH_POINT) { in ieee80211_check_combinations()
4837 params.new_beacon_int = sdata->vif.bss_conf.beacon_int; in ieee80211_check_combinations()
4841 if (cfg80211_iftype_allowed(local->hw.wiphy, iftype, 0, 1)) { in ieee80211_check_combinations()
4843 return -EINVAL; in ieee80211_check_combinations()
4853 list_for_each_entry(ctx, &local->chanctx_list, list) { in ieee80211_check_combinations()
4854 if (ctx->replace_state == IEEE80211_CHANCTX_WILL_BE_REPLACED) in ieee80211_check_combinations()
4858 if (ctx->mode == IEEE80211_CHANCTX_EXCLUSIVE) { in ieee80211_check_combinations()
4864 &ctx->conf.def)) in ieee80211_check_combinations()
4869 list_for_each_entry_rcu(sdata_iter, &local->interfaces, list) { in ieee80211_check_combinations()
4872 wdev_iter = &sdata_iter->wdev; in ieee80211_check_combinations()
4876 cfg80211_iftype_allowed(local->hw.wiphy, in ieee80211_check_combinations()
4877 wdev_iter->iftype, 0, 1)) in ieee80211_check_combinations()
4880 params.iftype_num[wdev_iter->iftype]++; in ieee80211_check_combinations()
4887 return cfg80211_check_combinations(local->hw.wiphy, &params); in ieee80211_check_combinations()
4897 c->num_different_channels); in ieee80211_iter_max_chans()
4908 lockdep_assert_held(&local->chanctx_mtx); in ieee80211_max_num_channels()
4910 list_for_each_entry(ctx, &local->chanctx_list, list) { in ieee80211_max_num_channels()
4911 if (ctx->replace_state == IEEE80211_CHANCTX_WILL_BE_REPLACED) in ieee80211_max_num_channels()
4920 list_for_each_entry_rcu(sdata, &local->interfaces, list) in ieee80211_max_num_channels()
4921 params.iftype_num[sdata->wdev.iftype]++; in ieee80211_max_num_channels()
4923 err = cfg80211_iter_combinations(local->hw.wiphy, &params, in ieee80211_max_num_channels()
4936 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_add_s1g_capab_ie()
4941 if (WARN_ON(sdata->vif.type != NL80211_IFTYPE_STATION)) in ieee80211_add_s1g_capab_ie()
4944 if (!caps->s1g) in ieee80211_add_s1g_capab_ie()
4947 memcpy(s1g_capab.capab_info, caps->cap, sizeof(caps->cap)); in ieee80211_add_s1g_capab_ie()
4948 memcpy(s1g_capab.supp_mcs_nss, caps->nss_mcs, sizeof(caps->nss_mcs)); in ieee80211_add_s1g_capab_ie()
4950 /* override the capability info */ in ieee80211_add_s1g_capab_ie()
4951 for (i = 0; i < sizeof(ifmgd->s1g_capa.capab_info); i++) { in ieee80211_add_s1g_capab_ie()
4952 u8 mask = ifmgd->s1g_capa_mask.capab_info[i]; in ieee80211_add_s1g_capab_ie()
4955 s1g_capab.capab_info[i] |= ifmgd->s1g_capa.capab_info[i] & mask; in ieee80211_add_s1g_capab_ie()
4959 for (i = 0; i < sizeof(ifmgd->s1g_capa.supp_mcs_nss); i++) { in ieee80211_add_s1g_capab_ie()
4960 u8 mask = ifmgd->s1g_capa_mask.supp_mcs_nss[i]; in ieee80211_add_s1g_capab_ie()
4964 ifmgd->s1g_capa.supp_mcs_nss[i] & mask; in ieee80211_add_s1g_capab_ie()
4994 *buf++ = qosinfo; /* U-APSD no in use */ in ieee80211_add_wmm_info_ie()
5007 skb_queue_walk(&txqi->frags, skb) { in ieee80211_txq_get_depth()
5009 frag_bytes += skb->len; in ieee80211_txq_get_depth()
5013 *frame_cnt = txqi->tin.backlog_packets + frag_cnt; in ieee80211_txq_get_depth()
5016 *byte_cnt = txqi->tin.backlog_bytes + frag_bytes; in ieee80211_txq_get_depth()
5068 n = ieee80211_eht_mcs_nss_size(&he_cap->he_cap_elem, in ieee80211_ie_len_eht_cap()
5069 &eht_cap->eht_cap_elem, in ieee80211_ie_len_eht_cap()
5072 sizeof(eht_cap->eht_cap_elem) + n + in ieee80211_ie_len_eht_cap()
5073 ieee80211_eht_ppe_size(eht_cap->eht_ppe_thres[0], in ieee80211_ie_len_eht_cap()
5074 eht_cap->eht_cap_elem.phy_cap_info); in ieee80211_ie_len_eht_cap()
5092 mcs_nss_len = ieee80211_eht_mcs_nss_size(&he_cap->he_cap_elem, in ieee80211_ie_build_eht_cap()
5093 &eht_cap->eht_cap_elem, in ieee80211_ie_build_eht_cap()
5095 ppet_len = ieee80211_eht_ppe_size(eht_cap->eht_ppe_thres[0], in ieee80211_ie_build_eht_cap()
5096 eht_cap->eht_cap_elem.phy_cap_info); in ieee80211_ie_build_eht_cap()
5098 ie_len = 2 + 1 + sizeof(eht_cap->eht_cap_elem) + mcs_nss_len + ppet_len; in ieee80211_ie_build_eht_cap()
5099 if ((end - pos) < ie_len) in ieee80211_ie_build_eht_cap()
5103 *pos++ = ie_len - 2; in ieee80211_ie_build_eht_cap()
5107 memcpy(pos, &eht_cap->eht_cap_elem, sizeof(eht_cap->eht_cap_elem)); in ieee80211_ie_build_eht_cap()
5108 pos += sizeof(eht_cap->eht_cap_elem); in ieee80211_ie_build_eht_cap()
5110 memcpy(pos, &eht_cap->eht_mcs_nss_supp, mcs_nss_len); in ieee80211_ie_build_eht_cap()
5114 memcpy(pos, &eht_cap->eht_ppe_thres, ppet_len); in ieee80211_ie_build_eht_cap()
5128 elem_len = skb->data + skb->len - len_pos - 1; in ieee80211_fragment_element()
5134 elem_len -= 255; in ieee80211_fragment_element()