• 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-2020 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->flags & IEEE80211_SDATA_OPERATING_GMODE) 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->flags & IEEE80211_SDATA_OPERATING_GMODE) 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->flags & IEEE80211_SDATA_OPERATING_GMODE) 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()
293 struct ieee80211_local *local = sdata->local; in __ieee80211_wake_txqs()
294 struct ieee80211_vif *vif = &sdata->vif; in __ieee80211_wake_txqs()
295 struct fq *fq = &local->fq; in __ieee80211_wake_txqs()
302 spin_lock(&fq->lock); in __ieee80211_wake_txqs()
304 if (sdata->vif.type == NL80211_IFTYPE_AP) in __ieee80211_wake_txqs()
305 ps = &sdata->bss->ps; in __ieee80211_wake_txqs()
307 sdata->vif.txqs_stopped[ac] = false; in __ieee80211_wake_txqs()
309 list_for_each_entry_rcu(sta, &local->sta_list, list) { in __ieee80211_wake_txqs()
310 if (sdata != sta->sdata) in __ieee80211_wake_txqs()
313 for (i = 0; i < ARRAY_SIZE(sta->sta.txq); i++) { in __ieee80211_wake_txqs()
314 struct ieee80211_txq *txq = sta->sta.txq[i]; in __ieee80211_wake_txqs()
321 if (ac != txq->ac) in __ieee80211_wake_txqs()
325 &txqi->flags)) in __ieee80211_wake_txqs()
328 spin_unlock(&fq->lock); in __ieee80211_wake_txqs()
330 spin_lock(&fq->lock); in __ieee80211_wake_txqs()
334 if (!vif->txq) in __ieee80211_wake_txqs()
337 txqi = to_txq_info(vif->txq); in __ieee80211_wake_txqs()
339 if (!test_and_clear_bit(IEEE80211_TXQ_STOP_NETIF_TX, &txqi->flags) || in __ieee80211_wake_txqs()
340 (ps && atomic_read(&ps->num_sta_ps)) || ac != vif->txq->ac) in __ieee80211_wake_txqs()
343 spin_unlock(&fq->lock); in __ieee80211_wake_txqs()
349 spin_unlock(&fq->lock); in __ieee80211_wake_txqs()
354 __releases(&local->queue_stop_reason_lock)
355 __acquires(&local->queue_stop_reason_lock)
364 if (local->hw.queues < IEEE80211_NUM_ACS) in _ieee80211_wake_txqs()
367 for (i = 0; i < local->hw.queues; i++) { in _ieee80211_wake_txqs()
368 if (local->queue_stop_reasons[i]) in _ieee80211_wake_txqs()
371 spin_unlock_irqrestore(&local->queue_stop_reason_lock, *flags); in _ieee80211_wake_txqs()
372 list_for_each_entry_rcu(sdata, &local->interfaces, list) { in _ieee80211_wake_txqs()
376 int ac_queue = sdata->vif.hw_queue[ac]; in _ieee80211_wake_txqs()
379 sdata->vif.cab_queue == i) in _ieee80211_wake_txqs()
383 spin_lock_irqsave(&local->queue_stop_reason_lock, *flags); in _ieee80211_wake_txqs()
394 spin_lock_irqsave(&local->queue_stop_reason_lock, flags); in ieee80211_wake_txqs()
396 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); in ieee80211_wake_txqs()
404 if (local->ops->wake_tx_queue) in ieee80211_propagate_queue_wake()
407 if (local->hw.queues < IEEE80211_NUM_ACS) in ieee80211_propagate_queue_wake()
410 list_for_each_entry_rcu(sdata, &local->interfaces, list) { in ieee80211_propagate_queue_wake()
413 if (!sdata->dev) in ieee80211_propagate_queue_wake()
416 if (sdata->vif.cab_queue != IEEE80211_INVAL_HW_QUEUE && in ieee80211_propagate_queue_wake()
417 local->queue_stop_reasons[sdata->vif.cab_queue] != 0) in ieee80211_propagate_queue_wake()
421 int ac_queue = sdata->vif.hw_queue[ac]; in ieee80211_propagate_queue_wake()
424 (sdata->vif.cab_queue == queue && in ieee80211_propagate_queue_wake()
425 local->queue_stop_reasons[ac_queue] == 0 && in ieee80211_propagate_queue_wake()
426 skb_queue_empty(&local->pending[ac_queue]))) in ieee80211_propagate_queue_wake()
427 netif_wake_subqueue(sdata->dev, ac); in ieee80211_propagate_queue_wake()
441 if (WARN_ON(queue >= hw->queues)) in __ieee80211_wake_queue()
444 if (!test_bit(reason, &local->queue_stop_reasons[queue])) in __ieee80211_wake_queue()
448 local->q_stop_reasons[queue][reason] = 0; in __ieee80211_wake_queue()
450 local->q_stop_reasons[queue][reason]--; in __ieee80211_wake_queue()
451 if (WARN_ON(local->q_stop_reasons[queue][reason] < 0)) in __ieee80211_wake_queue()
452 local->q_stop_reasons[queue][reason] = 0; in __ieee80211_wake_queue()
455 if (local->q_stop_reasons[queue][reason] == 0) in __ieee80211_wake_queue()
456 __clear_bit(reason, &local->queue_stop_reasons[queue]); in __ieee80211_wake_queue()
458 if (local->queue_stop_reasons[queue] != 0) in __ieee80211_wake_queue()
462 if (skb_queue_empty(&local->pending[queue])) { in __ieee80211_wake_queue()
467 tasklet_schedule(&local->tx_pending_tasklet); in __ieee80211_wake_queue()
476 if (local->ops->wake_tx_queue) { in __ieee80211_wake_queue()
478 tasklet_schedule(&local->wake_txqs_tasklet); in __ieee80211_wake_queue()
491 spin_lock_irqsave(&local->queue_stop_reason_lock, flags); in ieee80211_wake_queue_by_reason()
493 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 if (__test_and_set_bit(reason, &local->queue_stop_reasons[queue])) in __ieee80211_stop_queue()
525 if (local->hw.queues < IEEE80211_NUM_ACS) in __ieee80211_stop_queue()
529 list_for_each_entry_rcu(sdata, &local->interfaces, list) { in __ieee80211_stop_queue()
532 if (!sdata->dev) in __ieee80211_stop_queue()
536 if (sdata->vif.hw_queue[ac] == queue || in __ieee80211_stop_queue()
537 sdata->vif.cab_queue == queue) { in __ieee80211_stop_queue()
538 if (!local->ops->wake_tx_queue) { in __ieee80211_stop_queue()
539 netif_stop_subqueue(sdata->dev, ac); in __ieee80211_stop_queue()
542 spin_lock(&local->fq.lock); in __ieee80211_stop_queue()
543 sdata->vif.txqs_stopped[ac] = true; in __ieee80211_stop_queue()
544 spin_unlock(&local->fq.lock); in __ieee80211_stop_queue()
558 spin_lock_irqsave(&local->queue_stop_reason_lock, flags); in ieee80211_stop_queue_by_reason()
560 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); in ieee80211_stop_queue_by_reason()
574 struct ieee80211_hw *hw = &local->hw; in ieee80211_add_pending_skb()
577 int queue = info->hw_queue; in ieee80211_add_pending_skb()
579 if (WARN_ON(!info->control.vif)) { in ieee80211_add_pending_skb()
580 ieee80211_free_txskb(&local->hw, skb); in ieee80211_add_pending_skb()
584 spin_lock_irqsave(&local->queue_stop_reason_lock, flags); in ieee80211_add_pending_skb()
587 __skb_queue_tail(&local->pending[queue], skb); in ieee80211_add_pending_skb()
590 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); in ieee80211_add_pending_skb()
596 struct ieee80211_hw *hw = &local->hw; in ieee80211_add_pending_skbs()
601 spin_lock_irqsave(&local->queue_stop_reason_lock, flags); in ieee80211_add_pending_skbs()
605 if (WARN_ON(!info->control.vif)) { in ieee80211_add_pending_skbs()
606 ieee80211_free_txskb(&local->hw, skb); in ieee80211_add_pending_skbs()
610 queue = info->hw_queue; in ieee80211_add_pending_skbs()
616 __skb_queue_tail(&local->pending[queue], skb); in ieee80211_add_pending_skbs()
619 for (i = 0; i < hw->queues; i++) in ieee80211_add_pending_skbs()
623 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); in ieee80211_add_pending_skbs()
635 spin_lock_irqsave(&local->queue_stop_reason_lock, flags); in ieee80211_stop_queues_by_reason()
637 for_each_set_bit(i, &queues, hw->queues) in ieee80211_stop_queues_by_reason()
640 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); in ieee80211_stop_queues_by_reason()
657 if (WARN_ON(queue >= hw->queues)) in ieee80211_queue_stopped()
660 spin_lock_irqsave(&local->queue_stop_reason_lock, flags); in ieee80211_queue_stopped()
662 &local->queue_stop_reasons[queue]); in ieee80211_queue_stopped()
663 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); in ieee80211_queue_stopped()
677 spin_lock_irqsave(&local->queue_stop_reason_lock, flags); in ieee80211_wake_queues_by_reason()
679 for_each_set_bit(i, &queues, hw->queues) in ieee80211_wake_queues_by_reason()
682 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); in ieee80211_wake_queues_by_reason()
699 if (sdata && ieee80211_hw_check(&local->hw, QUEUE_CONTROL)) { in ieee80211_get_vif_queues()
705 queues |= BIT(sdata->vif.hw_queue[ac]); in ieee80211_get_vif_queues()
706 if (sdata->vif.cab_queue != IEEE80211_INVAL_HW_QUEUE) in ieee80211_get_vif_queues()
707 queues |= BIT(sdata->vif.cab_queue); in ieee80211_get_vif_queues()
710 queues = BIT(local->hw.queues) - 1; in ieee80211_get_vif_queues()
720 if (!local->ops->flush) in __ieee80211_flush_queues()
725 * IEEE80211_HW_QUEUE_CONTROL - flush all queues in __ieee80211_flush_queues()
727 if (!queues || !ieee80211_hw_check(&local->hw, QUEUE_CONTROL)) in __ieee80211_flush_queues()
730 ieee80211_stop_queues_by_reason(&local->hw, queues, in __ieee80211_flush_queues()
736 ieee80211_wake_queues_by_reason(&local->hw, queues, in __ieee80211_flush_queues()
751 ieee80211_stop_queues_by_reason(&local->hw, in ieee80211_stop_vif_queues()
760 ieee80211_wake_queues_by_reason(&local->hw, in ieee80211_wake_vif_queues()
774 list_for_each_entry_rcu(sdata, &local->interfaces, list) { in __iterate_interfaces()
775 switch (sdata->vif.type) { in __iterate_interfaces()
777 if (!(sdata->u.mntr.flags & MONITOR_FLAG_ACTIVE)) in __iterate_interfaces()
786 active_only && !(sdata->flags & IEEE80211_SDATA_IN_DRIVER)) in __iterate_interfaces()
789 !(sdata->flags & IEEE80211_SDATA_IN_DRIVER)) in __iterate_interfaces()
792 iterator(data, sdata->vif.addr, in __iterate_interfaces()
793 &sdata->vif); in __iterate_interfaces()
796 sdata = rcu_dereference_check(local->monitor_sdata, in __iterate_interfaces()
797 lockdep_is_held(&local->iflist_mtx) || in __iterate_interfaces()
801 sdata->flags & IEEE80211_SDATA_IN_DRIVER)) in __iterate_interfaces()
802 iterator(data, sdata->vif.addr, &sdata->vif); in __iterate_interfaces()
813 mutex_lock(&local->iflist_mtx); in ieee80211_iterate_interfaces()
815 mutex_unlock(&local->iflist_mtx); in ieee80211_iterate_interfaces()
856 list_for_each_entry_rcu(sta, &local->sta_list, list) { in __iterate_stations()
857 if (!sta->uploaded) in __iterate_stations()
860 iterator(data, &sta->sta); in __iterate_stations()
882 !(sdata->flags & IEEE80211_SDATA_IN_DRIVER)) in wdev_to_ieee80211_vif()
884 return &sdata->vif; in wdev_to_ieee80211_vif()
898 !(sdata->flags & IEEE80211_SDATA_IN_DRIVER)) in ieee80211_vif_to_wdev()
901 return &sdata->wdev; in ieee80211_vif_to_wdev()
907 * the suspend->resume cycle. Since we can't check each caller
916 if (local->quiescing || (local->suspended && !local->resuming)) { in ieee80211_can_queue_work()
931 queue_work(local->workqueue, work); in ieee80211_queue_work()
944 queue_delayed_work(local->workqueue, dwork, delay); in ieee80211_queue_delayed_work()
952 const void *data = elem->data + 1; in ieee80211_parse_extension_element()
953 u8 len = elem->datalen - 1; in ieee80211_parse_extension_element()
955 switch (elem->data[0]) { in ieee80211_parse_extension_element()
957 if (len >= sizeof(*elems->mu_edca_param_set)) { in ieee80211_parse_extension_element()
958 elems->mu_edca_param_set = data; in ieee80211_parse_extension_element()
961 elem->datalen + 2); in ieee80211_parse_extension_element()
965 elems->he_cap = data; in ieee80211_parse_extension_element()
966 elems->he_cap_len = len; in ieee80211_parse_extension_element()
969 if (len >= sizeof(*elems->he_operation) && in ieee80211_parse_extension_element()
970 len >= ieee80211_he_oper_size(data) - 1) { in ieee80211_parse_extension_element()
973 elem->datalen + 2); in ieee80211_parse_extension_element()
974 elems->he_operation = data; in ieee80211_parse_extension_element()
979 elems->uora_element = data; in ieee80211_parse_extension_element()
983 elems->max_channel_switch_time = data; in ieee80211_parse_extension_element()
986 if (len >= sizeof(*elems->mbssid_config_ie)) in ieee80211_parse_extension_element()
987 elems->mbssid_config_ie = data; in ieee80211_parse_extension_element()
990 if (len >= sizeof(*elems->he_spr) && in ieee80211_parse_extension_element()
992 elems->he_spr = data; in ieee80211_parse_extension_element()
995 if (len >= sizeof(*elems->he_6ghz_capa)) in ieee80211_parse_extension_element()
996 elems->he_6ghz_capa = data; in ieee80211_parse_extension_element()
1016 u8 id = elem->id; in _ieee802_11_parse_elems_crc()
1017 u8 elen = elem->datalen; in _ieee802_11_parse_elems_crc()
1018 const u8 *pos = elem->data; in _ieee802_11_parse_elems_crc()
1067 * not listing WLAN_EID_CHANNEL_SWITCH_WRAPPER -- it seems possible in _ieee802_11_parse_elems_crc()
1071 elems->parse_error = true; in _ieee802_11_parse_elems_crc()
1078 crc = crc32_be(crc, pos - 2, elen + 2); in _ieee802_11_parse_elems_crc()
1088 elems->lnk_id = (void *)(pos - 2); in _ieee802_11_parse_elems_crc()
1095 elems->ch_sw_timing = (void *)pos; in _ieee802_11_parse_elems_crc()
1098 elems->ext_capab = pos; in _ieee802_11_parse_elems_crc()
1099 elems->ext_capab_len = elen; in _ieee802_11_parse_elems_crc()
1102 elems->ssid = pos; in _ieee802_11_parse_elems_crc()
1103 elems->ssid_len = elen; in _ieee802_11_parse_elems_crc()
1106 elems->supp_rates = pos; in _ieee802_11_parse_elems_crc()
1107 elems->supp_rates_len = elen; in _ieee802_11_parse_elems_crc()
1111 elems->ds_params = pos; in _ieee802_11_parse_elems_crc()
1117 elems->tim = (void *)pos; in _ieee802_11_parse_elems_crc()
1118 elems->tim_len = elen; in _ieee802_11_parse_elems_crc()
1123 elems->challenge = pos; in _ieee802_11_parse_elems_crc()
1124 elems->challenge_len = elen; in _ieee802_11_parse_elems_crc()
1132 crc = crc32_be(crc, pos - 2, elen + 2); in _ieee802_11_parse_elems_crc()
1135 /* OUI Type 2 - WMM IE */ in _ieee802_11_parse_elems_crc()
1137 elems->wmm_info = pos; in _ieee802_11_parse_elems_crc()
1138 elems->wmm_info_len = elen; in _ieee802_11_parse_elems_crc()
1140 elems->wmm_param = pos; in _ieee802_11_parse_elems_crc()
1141 elems->wmm_param_len = elen; in _ieee802_11_parse_elems_crc()
1147 elems->rsn = pos; in _ieee802_11_parse_elems_crc()
1148 elems->rsn_len = elen; in _ieee802_11_parse_elems_crc()
1152 elems->erp_info = pos; in _ieee802_11_parse_elems_crc()
1157 elems->ext_supp_rates = pos; in _ieee802_11_parse_elems_crc()
1158 elems->ext_supp_rates_len = elen; in _ieee802_11_parse_elems_crc()
1162 elems->ht_cap_elem = (void *)pos; in _ieee802_11_parse_elems_crc()
1168 elems->ht_operation = (void *)pos; in _ieee802_11_parse_elems_crc()
1174 elems->vht_cap_elem = (void *)pos; in _ieee802_11_parse_elems_crc()
1180 elems->vht_operation = (void *)pos; in _ieee802_11_parse_elems_crc()
1182 crc = crc32_be(crc, pos - 2, elen + 2); in _ieee802_11_parse_elems_crc()
1189 elems->opmode_notif = pos; in _ieee802_11_parse_elems_crc()
1191 crc = crc32_be(crc, pos - 2, elen + 2); in _ieee802_11_parse_elems_crc()
1197 elems->mesh_id = pos; in _ieee802_11_parse_elems_crc()
1198 elems->mesh_id_len = elen; in _ieee802_11_parse_elems_crc()
1202 elems->mesh_config = (void *)pos; in _ieee802_11_parse_elems_crc()
1207 elems->peering = pos; in _ieee802_11_parse_elems_crc()
1208 elems->peering_len = elen; in _ieee802_11_parse_elems_crc()
1212 elems->awake_window = (void *)pos; in _ieee802_11_parse_elems_crc()
1215 elems->preq = pos; in _ieee802_11_parse_elems_crc()
1216 elems->preq_len = elen; in _ieee802_11_parse_elems_crc()
1219 elems->prep = pos; in _ieee802_11_parse_elems_crc()
1220 elems->prep_len = elen; in _ieee802_11_parse_elems_crc()
1223 elems->perr = pos; in _ieee802_11_parse_elems_crc()
1224 elems->perr_len = elen; in _ieee802_11_parse_elems_crc()
1228 elems->rann = (void *)pos; in _ieee802_11_parse_elems_crc()
1237 elems->ch_switch_ie = (void *)pos; in _ieee802_11_parse_elems_crc()
1244 elems->ext_chansw_ie = (void *)pos; in _ieee802_11_parse_elems_crc()
1251 elems->sec_chan_offs = (void *)pos; in _ieee802_11_parse_elems_crc()
1255 sizeof(*elems->mesh_chansw_params_ie)) { in _ieee802_11_parse_elems_crc()
1259 elems->mesh_chansw_params_ie = (void *)pos; in _ieee802_11_parse_elems_crc()
1263 elen < sizeof(*elems->wide_bw_chansw_ie)) { in _ieee802_11_parse_elems_crc()
1267 elems->wide_bw_chansw_ie = (void *)pos; in _ieee802_11_parse_elems_crc()
1282 if (ie[1] >= sizeof(*elems->wide_bw_chansw_ie)) in _ieee802_11_parse_elems_crc()
1283 elems->wide_bw_chansw_ie = in _ieee802_11_parse_elems_crc()
1290 elems->country_elem = pos; in _ieee802_11_parse_elems_crc()
1291 elems->country_elem_len = elen; in _ieee802_11_parse_elems_crc()
1298 elems->pwr_constr_elem = pos; in _ieee802_11_parse_elems_crc()
1321 crc = crc32_be(crc, pos - 2, elen + 2); in _ieee802_11_parse_elems_crc()
1323 elems->cisco_dtpc_elem = pos; in _ieee802_11_parse_elems_crc()
1330 elems->addba_ext_ie = (void *)pos; in _ieee802_11_parse_elems_crc()
1334 elems->timeout_int = (void *)pos; in _ieee802_11_parse_elems_crc()
1339 if (elen >= sizeof(*elems->max_idle_period_ie)) in _ieee802_11_parse_elems_crc()
1340 elems->max_idle_period_ie = (void *)pos; in _ieee802_11_parse_elems_crc()
1343 elems->rsnx = pos; in _ieee802_11_parse_elems_crc()
1344 elems->rsnx_len = elen; in _ieee802_11_parse_elems_crc()
1352 if (elen >= sizeof(*elems->s1g_capab)) in _ieee802_11_parse_elems_crc()
1353 elems->s1g_capab = (void *)pos; in _ieee802_11_parse_elems_crc()
1358 if (elen == sizeof(*elems->s1g_oper)) in _ieee802_11_parse_elems_crc()
1359 elems->s1g_oper = (void *)pos; in _ieee802_11_parse_elems_crc()
1364 if (elen == sizeof(*elems->s1g_bcn_compat)) in _ieee802_11_parse_elems_crc()
1365 elems->s1g_bcn_compat = (void *)pos; in _ieee802_11_parse_elems_crc()
1371 elems->aid_resp = (void *)pos; in _ieee802_11_parse_elems_crc()
1380 elems->parse_error = true; in _ieee802_11_parse_elems_crc()
1386 elems->parse_error = true; in _ieee802_11_parse_elems_crc()
1405 if (elem->datalen < 2) in ieee802_11_find_bssid_profile()
1408 for_each_element(sub, elem->data + 1, elem->datalen - 1) { in ieee802_11_find_bssid_profile()
1412 if (sub->id != 0 || sub->datalen < 4) { in ieee802_11_find_bssid_profile()
1417 if (sub->data[0] != WLAN_EID_NON_TX_BSSID_CAP || in ieee802_11_find_bssid_profile()
1418 sub->data[1] != 2) { in ieee802_11_find_bssid_profile()
1444 elem->data[0], in ieee802_11_find_bssid_profile()
1449 elems->bssid_index_len = index[1]; in ieee802_11_find_bssid_profile()
1450 elems->bssid_index = (void *)&index[2]; in ieee802_11_find_bssid_profile()
1469 elems->ie_start = start; in ieee802_11_parse_elems_crc()
1470 elems->total_len = len; in ieee802_11_parse_elems_crc()
1493 /* Override with nontransmitted profile, if found */ in ieee802_11_parse_elems_crc()
1499 if (elems->tim && !elems->parse_error) { in ieee802_11_parse_elems_crc()
1500 const struct ieee80211_tim_ie *tim_ie = elems->tim; in ieee802_11_parse_elems_crc()
1502 elems->dtim_period = tim_ie->dtim_period; in ieee802_11_parse_elems_crc()
1503 elems->dtim_count = tim_ie->dtim_count; in ieee802_11_parse_elems_crc()
1506 /* Override DTIM period and count if needed */ in ieee802_11_parse_elems_crc()
1507 if (elems->bssid_index && in ieee802_11_parse_elems_crc()
1508 elems->bssid_index_len >= in ieee802_11_parse_elems_crc()
1510 elems->dtim_period = elems->bssid_index->dtim_period; in ieee802_11_parse_elems_crc()
1512 if (elems->bssid_index && in ieee802_11_parse_elems_crc()
1513 elems->bssid_index_len >= in ieee802_11_parse_elems_crc()
1515 elems->dtim_count = elems->bssid_index->dtim_count; in ieee802_11_parse_elems_crc()
1517 elems->nontx_profile = nontransmitted_profile; in ieee802_11_parse_elems_crc()
1531 if (sdata->vif.type != NL80211_IFTYPE_AP && in ieee80211_regulatory_limit_wmm_params()
1532 sdata->vif.type != NL80211_IFTYPE_STATION) in ieee80211_regulatory_limit_wmm_params()
1536 chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); in ieee80211_regulatory_limit_wmm_params()
1538 center_freq = chanctx_conf->def.chan->center_freq; in ieee80211_regulatory_limit_wmm_params()
1545 rrule = freq_reg_info(sdata->wdev.wiphy, MHZ_TO_KHZ(center_freq)); in ieee80211_regulatory_limit_wmm_params()
1547 if (IS_ERR_OR_NULL(rrule) || !rrule->has_wmm) { in ieee80211_regulatory_limit_wmm_params()
1552 if (sdata->vif.type == NL80211_IFTYPE_AP) in ieee80211_regulatory_limit_wmm_params()
1553 wmm_ac = &rrule->wmm_rule.ap[ac]; in ieee80211_regulatory_limit_wmm_params()
1555 wmm_ac = &rrule->wmm_rule.client[ac]; in ieee80211_regulatory_limit_wmm_params()
1556 qparam->cw_min = max_t(u16, qparam->cw_min, wmm_ac->cw_min); in ieee80211_regulatory_limit_wmm_params()
1557 qparam->cw_max = max_t(u16, qparam->cw_max, wmm_ac->cw_max); in ieee80211_regulatory_limit_wmm_params()
1558 qparam->aifs = max_t(u8, qparam->aifs, wmm_ac->aifsn); in ieee80211_regulatory_limit_wmm_params()
1559 qparam->txop = min_t(u16, qparam->txop, wmm_ac->cot / 32); in ieee80211_regulatory_limit_wmm_params()
1566 struct ieee80211_local *local = sdata->local; in ieee80211_set_wmm_default()
1574 if (!local->ops->conf_tx) in ieee80211_set_wmm_default()
1577 if (local->hw.queues < IEEE80211_NUM_ACS) in ieee80211_set_wmm_default()
1583 chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); in ieee80211_set_wmm_default()
1585 chanctx_conf->def.chan->band == NL80211_BAND_2GHZ) && in ieee80211_set_wmm_default()
1586 !(sdata->flags & IEEE80211_SDATA_OPERATING_GMODE); in ieee80211_set_wmm_default()
1589 is_ocb = (sdata->vif.type == NL80211_IFTYPE_OCB); in ieee80211_set_wmm_default()
1591 /* Set defaults according to 802.11-2007 Table 7-37 */ in ieee80211_set_wmm_default()
1630 qparam.cw_min = (aCWmin + 1) / 2 - 1; in ieee80211_set_wmm_default()
1644 qparam.cw_max = (aCWmin + 1) / 2 - 1; in ieee80211_set_wmm_default()
1645 qparam.cw_min = (aCWmin + 1) / 4 - 1; in ieee80211_set_wmm_default()
1660 sdata->tx_conf[ac] = qparam; in ieee80211_set_wmm_default()
1664 if (sdata->vif.type != NL80211_IFTYPE_MONITOR && in ieee80211_set_wmm_default()
1665 sdata->vif.type != NL80211_IFTYPE_P2P_DEVICE && in ieee80211_set_wmm_default()
1666 sdata->vif.type != NL80211_IFTYPE_NAN) { in ieee80211_set_wmm_default()
1667 sdata->vif.bss_conf.qos = enable_qos; in ieee80211_set_wmm_default()
1680 struct ieee80211_local *local = sdata->local; in ieee80211_send_auth()
1686 skb = dev_alloc_skb(local->hw.extra_tx_headroom + IEEE80211_WEP_IV_LEN + in ieee80211_send_auth()
1691 skb_reserve(skb, local->hw.extra_tx_headroom + IEEE80211_WEP_IV_LEN); in ieee80211_send_auth()
1694 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | in ieee80211_send_auth()
1696 memcpy(mgmt->da, da, ETH_ALEN); in ieee80211_send_auth()
1697 memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); in ieee80211_send_auth()
1698 memcpy(mgmt->bssid, bssid, ETH_ALEN); in ieee80211_send_auth()
1699 mgmt->u.auth.auth_alg = cpu_to_le16(auth_alg); in ieee80211_send_auth()
1700 mgmt->u.auth.auth_transaction = cpu_to_le16(transaction); in ieee80211_send_auth()
1701 mgmt->u.auth.status_code = cpu_to_le16(status); in ieee80211_send_auth()
1706 mgmt->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); in ieee80211_send_auth()
1711 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT | in ieee80211_send_auth()
1721 struct ieee80211_local *local = sdata->local; in ieee80211_send_deauth_disassoc()
1726 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | stype); in ieee80211_send_deauth_disassoc()
1727 mgmt->duration = 0; /* initialize only */ in ieee80211_send_deauth_disassoc()
1728 mgmt->seq_ctrl = 0; /* initialize only */ in ieee80211_send_deauth_disassoc()
1729 memcpy(mgmt->da, da, ETH_ALEN); in ieee80211_send_deauth_disassoc()
1730 memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); in ieee80211_send_deauth_disassoc()
1731 memcpy(mgmt->bssid, bssid, ETH_ALEN); in ieee80211_send_deauth_disassoc()
1733 mgmt->u.deauth.reason_code = cpu_to_le16(reason); in ieee80211_send_deauth_disassoc()
1736 skb = dev_alloc_skb(local->hw.extra_tx_headroom + in ieee80211_send_deauth_disassoc()
1741 skb_reserve(skb, local->hw.extra_tx_headroom); in ieee80211_send_deauth_disassoc()
1746 if (sdata->vif.type != NL80211_IFTYPE_STATION || in ieee80211_send_deauth_disassoc()
1747 !(sdata->u.mgd.flags & IEEE80211_STA_MFP_ENABLED)) in ieee80211_send_deauth_disassoc()
1748 IEEE80211_SKB_CB(skb)->flags |= in ieee80211_send_deauth_disassoc()
1757 if ((end - pos) < 5) in ieee80211_write_he_6ghz_cap()
1776 struct ieee80211_local *local = sdata->local; in ieee80211_build_preq_ies_band()
1791 sband = local->hw.wiphy->bands[band]; in ieee80211_build_preq_ies_band()
1799 for (i = 0; i < sband->n_bitrates; i++) { in ieee80211_build_preq_ies_band()
1802 if ((rate_flags & sband->bitrates[i].flags) != rate_flags) in ieee80211_build_preq_ies_band()
1806 (u8) DIV_ROUND_UP(sband->bitrates[i].bitrate, in ieee80211_build_preq_ies_band()
1812 if (end - pos < 2 + supp_rates_len) in ieee80211_build_preq_ies_band()
1830 if (end - pos < noffset - *offset) in ieee80211_build_preq_ies_band()
1832 memcpy(pos, ie + *offset, noffset - *offset); in ieee80211_build_preq_ies_band()
1833 pos += noffset - *offset; in ieee80211_build_preq_ies_band()
1837 ext_rates_len = num_rates - supp_rates_len; in ieee80211_build_preq_ies_band()
1839 if (end - pos < 2 + ext_rates_len) in ieee80211_build_preq_ies_band()
1847 if (chandef->chan && sband->band == NL80211_BAND_2GHZ) { in ieee80211_build_preq_ies_band()
1848 if (end - pos < 3) in ieee80211_build_preq_ies_band()
1853 chandef->chan->center_freq); in ieee80211_build_preq_ies_band()
1872 if (end - pos < noffset - *offset) in ieee80211_build_preq_ies_band()
1874 memcpy(pos, ie + *offset, noffset - *offset); in ieee80211_build_preq_ies_band()
1875 pos += noffset - *offset; in ieee80211_build_preq_ies_band()
1879 if (sband->ht_cap.ht_supported) { in ieee80211_build_preq_ies_band()
1880 if (end - pos < 2 + sizeof(struct ieee80211_ht_cap)) in ieee80211_build_preq_ies_band()
1882 pos = ieee80211_ie_build_ht_cap(pos, &sband->ht_cap, in ieee80211_build_preq_ies_band()
1883 sband->ht_cap.cap); in ieee80211_build_preq_ies_band()
1899 /* 60 GHz (Multi-band, DMG, MMS) can't happen */ in ieee80211_build_preq_ies_band()
1904 if (end - pos < noffset - *offset) in ieee80211_build_preq_ies_band()
1906 memcpy(pos, ie + *offset, noffset - *offset); in ieee80211_build_preq_ies_band()
1907 pos += noffset - *offset; in ieee80211_build_preq_ies_band()
1912 for (i = 0; i < sband->n_channels; i++) { in ieee80211_build_preq_ies_band()
1913 if (sband->channels[i].flags & (IEEE80211_CHAN_DISABLED | in ieee80211_build_preq_ies_band()
1921 if (sband->vht_cap.vht_supported && have_80mhz) { in ieee80211_build_preq_ies_band()
1922 if (end - pos < 2 + sizeof(struct ieee80211_vht_cap)) in ieee80211_build_preq_ies_band()
1924 pos = ieee80211_ie_build_vht_cap(pos, &sband->vht_cap, in ieee80211_build_preq_ies_band()
1925 sband->vht_cap.cap); in ieee80211_build_preq_ies_band()
1942 if (end - pos < noffset - *offset) in ieee80211_build_preq_ies_band()
1944 memcpy(pos, ie + *offset, noffset - *offset); in ieee80211_build_preq_ies_band()
1945 pos += noffset - *offset; in ieee80211_build_preq_ies_band()
1955 if (sband->band == NL80211_BAND_6GHZ) { in ieee80211_build_preq_ies_band()
1957 ieee80211_vif_type_p2p(&sdata->vif); in ieee80211_build_preq_ies_band()
1966 * that calculates local->scan_ies_len. in ieee80211_build_preq_ies_band()
1969 return pos - buffer; in ieee80211_build_preq_ies_band()
1973 return pos - buffer; in ieee80211_build_preq_ies_band()
1993 buffer_len - pos, in ieee80211_build_preq_ies()
1999 ie_desc->ies[i] = buffer + old_pos; in ieee80211_build_preq_ies()
2000 ie_desc->len[i] = pos - old_pos; in ieee80211_build_preq_ies()
2007 if (WARN_ONCE(buffer_len - pos < ie_len - custom_ie_offset, in ieee80211_build_preq_ies()
2011 ie_len - custom_ie_offset); in ieee80211_build_preq_ies()
2012 ie_desc->common_ies = buffer + pos; in ieee80211_build_preq_ies()
2013 ie_desc->common_ie_len = ie_len - custom_ie_offset; in ieee80211_build_preq_ies()
2014 pos += ie_len - custom_ie_offset; in ieee80211_build_preq_ies()
2028 struct ieee80211_local *local = sdata->local; in ieee80211_build_probe_req()
2039 * badly-behaved APs don't respond when this parameter is included. in ieee80211_build_probe_req()
2041 chandef.width = sdata->vif.bss_conf.chandef.width; in ieee80211_build_probe_req()
2047 skb = ieee80211_probereq_get(&local->hw, src, ssid, ssid_len, in ieee80211_build_probe_req()
2052 rate_masks[chan->band] = ratemask; in ieee80211_build_probe_req()
2055 ie, ie_len, BIT(chan->band), in ieee80211_build_probe_req()
2060 mgmt = (struct ieee80211_mgmt *) skb->data; in ieee80211_build_probe_req()
2061 memcpy(mgmt->da, dst, ETH_ALEN); in ieee80211_build_probe_req()
2062 memcpy(mgmt->bssid, dst, ETH_ALEN); in ieee80211_build_probe_req()
2065 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; in ieee80211_build_probe_req()
2079 sband = sdata->local->hw.wiphy->bands[band]; in ieee80211_sta_get_rates()
2083 rate_flags = ieee80211_chandef_rate_flags(&sdata->vif.bss_conf.chandef); in ieee80211_sta_get_rates()
2084 shift = ieee80211_vif_get_shift(&sdata->vif); in ieee80211_sta_get_rates()
2086 num_rates = sband->n_bitrates; in ieee80211_sta_get_rates()
2088 for (i = 0; i < elems->supp_rates_len + in ieee80211_sta_get_rates()
2089 elems->ext_supp_rates_len; i++) { in ieee80211_sta_get_rates()
2093 if (i < elems->supp_rates_len) in ieee80211_sta_get_rates()
2094 rate = elems->supp_rates[i]; in ieee80211_sta_get_rates()
2095 else if (elems->ext_supp_rates) in ieee80211_sta_get_rates()
2096 rate = elems->ext_supp_rates in ieee80211_sta_get_rates()
2097 [i - elems->supp_rates_len]; in ieee80211_sta_get_rates()
2106 if ((rate_flags & sband->bitrates[j].flags) in ieee80211_sta_get_rates()
2110 brate = DIV_ROUND_UP(sband->bitrates[j].bitrate, in ieee80211_sta_get_rates()
2128 cancel_work_sync(&local->reconfig_filter); in ieee80211_stop_device()
2130 flush_workqueue(local->workqueue); in ieee80211_stop_device()
2144 if (test_bit(SCAN_COMPLETED, &local->scanning)) { in ieee80211_flush_completed_scan()
2146 * we don't attempt to continue a partial HW scan - which is in ieee80211_flush_completed_scan()
2151 set_bit(SCAN_ABORTED, &local->scanning); in ieee80211_flush_completed_scan()
2152 ieee80211_queue_delayed_work(&local->hw, &local->scan_work, 0); in ieee80211_flush_completed_scan()
2153 flush_delayed_work(&local->scan_work); in ieee80211_flush_completed_scan()
2172 local->resuming = false; in ieee80211_handle_reconfig_failure()
2173 local->suspended = false; in ieee80211_handle_reconfig_failure()
2174 local->in_reconfig = false; in ieee80211_handle_reconfig_failure()
2183 list_for_each_entry(sdata, &local->interfaces, list) in ieee80211_handle_reconfig_failure()
2184 sdata->flags &= ~IEEE80211_SDATA_IN_DRIVER; in ieee80211_handle_reconfig_failure()
2189 mutex_lock(&local->chanctx_mtx); in ieee80211_handle_reconfig_failure()
2190 list_for_each_entry(ctx, &local->chanctx_list, list) in ieee80211_handle_reconfig_failure()
2191 ctx->driver_present = false; in ieee80211_handle_reconfig_failure()
2192 mutex_unlock(&local->chanctx_mtx); in ieee80211_handle_reconfig_failure()
2194 cfg80211_shutdown_all_interfaces(local->hw.wiphy); in ieee80211_handle_reconfig_failure()
2203 if (!local->use_chanctx) in ieee80211_assign_chanctx()
2206 mutex_lock(&local->chanctx_mtx); in ieee80211_assign_chanctx()
2207 conf = rcu_dereference_protected(sdata->vif.chanctx_conf, in ieee80211_assign_chanctx()
2208 lockdep_is_held(&local->chanctx_mtx)); in ieee80211_assign_chanctx()
2213 mutex_unlock(&local->chanctx_mtx); in ieee80211_assign_chanctx()
2218 struct ieee80211_local *local = sdata->local; in ieee80211_reconfig_stations()
2222 mutex_lock(&local->sta_mtx); in ieee80211_reconfig_stations()
2223 list_for_each_entry(sta, &local->sta_list, list) { in ieee80211_reconfig_stations()
2226 if (!sta->uploaded || sta->sdata != sdata) in ieee80211_reconfig_stations()
2230 state < sta->sta_state; state++) in ieee80211_reconfig_stations()
2231 WARN_ON(drv_sta_state(local, sta->sdata, sta, state, in ieee80211_reconfig_stations()
2234 mutex_unlock(&local->sta_mtx); in ieee80211_reconfig_stations()
2242 res = drv_start_nan(sdata->local, sdata, in ieee80211_reconfig_nan()
2243 &sdata->u.nan.conf); in ieee80211_reconfig_nan()
2247 funcs = kcalloc(sdata->local->hw.max_nan_de_entries + 1, in ieee80211_reconfig_nan()
2251 return -ENOMEM; in ieee80211_reconfig_nan()
2257 spin_lock_bh(&sdata->u.nan.func_lock); in ieee80211_reconfig_nan()
2259 idr_for_each_entry(&sdata->u.nan.function_inst_ids, func, id) in ieee80211_reconfig_nan()
2262 spin_unlock_bh(&sdata->u.nan.func_lock); in ieee80211_reconfig_nan()
2265 res = drv_add_nan_func(sdata->local, sdata, funcs[i]); in ieee80211_reconfig_nan()
2267 ieee80211_nan_func_terminated(&sdata->vif, in ieee80211_reconfig_nan()
2268 funcs[i]->instance_id, in ieee80211_reconfig_nan()
2280 struct ieee80211_hw *hw = &local->hw; in ieee80211_reconfig()
2289 bool suspended = local->suspended; in ieee80211_reconfig()
2292 if (!local->open_count) in ieee80211_reconfig()
2297 local->resuming = true; in ieee80211_reconfig()
2299 if (local->wowlan) { in ieee80211_reconfig()
2303 * clear local->suspended so the device could operate in ieee80211_reconfig()
2306 local->suspended = false; in ieee80211_reconfig()
2308 local->wowlan = false; in ieee80211_reconfig()
2310 local->resuming = false; in ieee80211_reconfig()
2319 * restore local->suspended in this case. in ieee80211_reconfig()
2322 local->suspended = true; in ieee80211_reconfig()
2333 if (suspended && local->in_reconfig && !reconfig_due_to_wowlan) in ieee80211_reconfig()
2334 cancel_work_sync(&local->restart_work); in ieee80211_reconfig()
2336 local->started = false; in ieee80211_reconfig()
2355 drv_set_frag_threshold(local, hw->wiphy->frag_threshold); in ieee80211_reconfig()
2358 drv_set_rts_threshold(local, hw->wiphy->rts_threshold); in ieee80211_reconfig()
2361 drv_set_coverage_class(local, hw->wiphy->coverage_class); in ieee80211_reconfig()
2368 sdata = rtnl_dereference(local->monitor_sdata); in ieee80211_reconfig()
2371 WARN_ON(local->resuming); in ieee80211_reconfig()
2374 RCU_INIT_POINTER(local->monitor_sdata, NULL); in ieee80211_reconfig()
2380 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_reconfig()
2381 if (sdata->vif.type != NL80211_IFTYPE_AP_VLAN && in ieee80211_reconfig()
2382 sdata->vif.type != NL80211_IFTYPE_MONITOR && in ieee80211_reconfig()
2394 list_for_each_entry_continue_reverse(sdata, &local->interfaces, in ieee80211_reconfig()
2396 if (sdata->vif.type != NL80211_IFTYPE_AP_VLAN && in ieee80211_reconfig()
2397 sdata->vif.type != NL80211_IFTYPE_MONITOR && in ieee80211_reconfig()
2405 if (local->use_chanctx) { in ieee80211_reconfig()
2406 mutex_lock(&local->chanctx_mtx); in ieee80211_reconfig()
2407 list_for_each_entry(ctx, &local->chanctx_list, list) in ieee80211_reconfig()
2408 if (ctx->replace_state != in ieee80211_reconfig()
2411 mutex_unlock(&local->chanctx_mtx); in ieee80211_reconfig()
2413 sdata = rtnl_dereference(local->monitor_sdata); in ieee80211_reconfig()
2424 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_reconfig()
2432 switch (sdata->vif.type) { in ieee80211_reconfig()
2437 if (sdata->vif.bss_conf.ibss_joined) in ieee80211_reconfig()
2446 &sdata->tx_conf[i]); in ieee80211_reconfig()
2464 if (sdata->vif.mu_mimo_owner) in ieee80211_reconfig()
2467 switch (sdata->vif.type) { in ieee80211_reconfig()
2473 /* Re-send beacon info report to the driver */ in ieee80211_reconfig()
2474 if (sdata->u.mgd.have_beacon) in ieee80211_reconfig()
2477 if (sdata->vif.bss_conf.max_idle_period || in ieee80211_reconfig()
2478 sdata->vif.bss_conf.protected_keep_alive) in ieee80211_reconfig()
2495 if (sdata->vif.bss_conf.ftm_responder == 1 && in ieee80211_reconfig()
2496 wiphy_ext_feature_isset(sdata->local->hw.wiphy, in ieee80211_reconfig()
2500 if (sdata->vif.type == NL80211_IFTYPE_AP) { in ieee80211_reconfig()
2503 if (rcu_access_pointer(sdata->u.ap.beacon)) in ieee80211_reconfig()
2508 if (sdata->vif.bss_conf.enable_beacon) { in ieee80211_reconfig()
2544 if (!(local->hw.conf.flags & IEEE80211_CONF_PS)) { in ieee80211_reconfig()
2545 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_reconfig()
2546 if (sdata->vif.type != NL80211_IFTYPE_STATION) in ieee80211_reconfig()
2548 if (!sdata->u.mgd.associated) in ieee80211_reconfig()
2556 mutex_lock(&local->sta_mtx); in ieee80211_reconfig()
2557 list_for_each_entry(sta, &local->sta_list, list) { in ieee80211_reconfig()
2560 if (!sta->uploaded) in ieee80211_reconfig()
2563 if (sta->sdata->vif.type != NL80211_IFTYPE_AP && in ieee80211_reconfig()
2564 sta->sdata->vif.type != NL80211_IFTYPE_AP_VLAN) in ieee80211_reconfig()
2568 state < sta->sta_state; state++) in ieee80211_reconfig()
2569 WARN_ON(drv_sta_state(local, sta->sdata, sta, state, in ieee80211_reconfig()
2572 mutex_unlock(&local->sta_mtx); in ieee80211_reconfig()
2575 list_for_each_entry(sdata, &local->interfaces, list) in ieee80211_reconfig()
2579 mutex_lock(&local->mtx); in ieee80211_reconfig()
2580 sched_scan_sdata = rcu_dereference_protected(local->sched_scan_sdata, in ieee80211_reconfig()
2581 lockdep_is_held(&local->mtx)); in ieee80211_reconfig()
2582 sched_scan_req = rcu_dereference_protected(local->sched_scan_req, in ieee80211_reconfig()
2583 lockdep_is_held(&local->mtx)); in ieee80211_reconfig()
2592 if (sched_scan_req->n_scan_plans > 1 || in ieee80211_reconfig()
2595 RCU_INIT_POINTER(local->sched_scan_sdata, NULL); in ieee80211_reconfig()
2596 RCU_INIT_POINTER(local->sched_scan_req, NULL); in ieee80211_reconfig()
2599 mutex_unlock(&local->mtx); in ieee80211_reconfig()
2602 cfg80211_sched_scan_stopped_rtnl(local->hw.wiphy, 0); in ieee80211_reconfig()
2606 if (local->monitors == local->open_count && local->monitors > 0) in ieee80211_reconfig()
2620 mutex_lock(&local->sta_mtx); in ieee80211_reconfig()
2622 list_for_each_entry(sta, &local->sta_list, list) { in ieee80211_reconfig()
2623 if (!local->resuming) in ieee80211_reconfig()
2629 mutex_unlock(&local->sta_mtx); in ieee80211_reconfig()
2632 if (local->in_reconfig) { in ieee80211_reconfig()
2633 local->in_reconfig = false; in ieee80211_reconfig()
2637 mutex_lock(&local->mtx); in ieee80211_reconfig()
2639 mutex_unlock(&local->mtx); in ieee80211_reconfig()
2642 list_for_each_entry(sdata, &local->interfaces, list) in ieee80211_reconfig()
2643 ieee80211_queue_work(&local->hw, &sdata->work); in ieee80211_reconfig()
2654 if (local->open_count && (!suspended || reconfig_due_to_wowlan)) in ieee80211_reconfig()
2662 local->suspended = false; in ieee80211_reconfig()
2664 local->resuming = false; in ieee80211_reconfig()
2668 if (local->open_count && !reconfig_due_to_wowlan) in ieee80211_reconfig()
2671 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_reconfig()
2674 if (sdata->vif.type == NL80211_IFTYPE_STATION) in ieee80211_reconfig()
2678 mod_timer(&local->sta_cleanup, jiffies + 1); in ieee80211_reconfig()
2696 local = sdata->local; in ieee80211_resume_disconnect()
2698 if (WARN_ON(!local->resuming)) in ieee80211_resume_disconnect()
2701 if (WARN_ON(vif->type != NL80211_IFTYPE_STATION)) in ieee80211_resume_disconnect()
2704 sdata->flags |= IEEE80211_SDATA_DISCONNECT_RESUME; in ieee80211_resume_disconnect()
2706 mutex_lock(&local->key_mtx); in ieee80211_resume_disconnect()
2707 list_for_each_entry(key, &sdata->key_list, list) in ieee80211_resume_disconnect()
2708 key->flags |= KEY_FLAG_TAINTED; in ieee80211_resume_disconnect()
2709 mutex_unlock(&local->key_mtx); in ieee80211_resume_disconnect()
2715 struct ieee80211_local *local = sdata->local; in ieee80211_recalc_smps()
2719 mutex_lock(&local->chanctx_mtx); in ieee80211_recalc_smps()
2721 chanctx_conf = rcu_dereference_protected(sdata->vif.chanctx_conf, in ieee80211_recalc_smps()
2722 lockdep_is_held(&local->chanctx_mtx)); in ieee80211_recalc_smps()
2736 mutex_unlock(&local->chanctx_mtx); in ieee80211_recalc_smps()
2741 struct ieee80211_local *local = sdata->local; in ieee80211_recalc_min_chandef()
2745 mutex_lock(&local->chanctx_mtx); in ieee80211_recalc_min_chandef()
2747 chanctx_conf = rcu_dereference_protected(sdata->vif.chanctx_conf, in ieee80211_recalc_min_chandef()
2748 lockdep_is_held(&local->chanctx_mtx)); in ieee80211_recalc_min_chandef()
2756 mutex_unlock(&local->chanctx_mtx); in ieee80211_recalc_min_chandef()
2775 if (WARN_ON(sdata->vif.type != NL80211_IFTYPE_STATION)) in _ieee80211_enable_rssi_reports()
2783 sdata->u.mgd.rssi_min_thold = rssi_min_thold*16; in _ieee80211_enable_rssi_reports()
2784 sdata->u.mgd.rssi_max_thold = rssi_max_thold*16; in _ieee80211_enable_rssi_reports()
2824 *pos++ = ht_cap->ampdu_factor | in ieee80211_ie_build_ht_cap()
2825 (ht_cap->ampdu_density << in ieee80211_ie_build_ht_cap()
2829 memcpy(pos, &ht_cap->mcs, sizeof(ht_cap->mcs)); in ieee80211_ie_build_ht_cap()
2830 pos += sizeof(ht_cap->mcs); in ieee80211_ie_build_ht_cap()
2859 memcpy(pos, &vht_cap->vht_mcs, sizeof(vht_cap->vht_mcs)); in ieee80211_ie_build_vht_cap()
2860 pos += sizeof(vht_cap->vht_mcs); in ieee80211_ie_build_vht_cap()
2879 n = ieee80211_he_mcs_nss_size(&he_cap->he_cap_elem); in ieee80211_ie_len_he_cap()
2881 sizeof(he_cap->he_cap_elem) + n + in ieee80211_ie_len_he_cap()
2882 ieee80211_he_ppe_size(he_cap->ppe_thres[0], in ieee80211_ie_len_he_cap()
2883 he_cap->he_cap_elem.phy_cap_info); in ieee80211_ie_len_he_cap()
2902 n = ieee80211_he_mcs_nss_size(&he_cap->he_cap_elem); in ieee80211_ie_build_he_cap()
2904 sizeof(he_cap->he_cap_elem) + n + in ieee80211_ie_build_he_cap()
2905 ieee80211_he_ppe_size(he_cap->ppe_thres[0], in ieee80211_ie_build_he_cap()
2906 he_cap->he_cap_elem.phy_cap_info); in ieee80211_ie_build_he_cap()
2908 if ((end - pos) < ie_len) in ieee80211_ie_build_he_cap()
2916 memcpy(pos, &he_cap->he_cap_elem, sizeof(he_cap->he_cap_elem)); in ieee80211_ie_build_he_cap()
2917 pos += sizeof(he_cap->he_cap_elem); in ieee80211_ie_build_he_cap()
2919 memcpy(pos, &he_cap->he_mcs_nss_supp, n); in ieee80211_ie_build_he_cap()
2923 if ((he_cap->he_cap_elem.phy_cap_info[6] & in ieee80211_ie_build_he_cap()
2931 n = hweight8(he_cap->ppe_thres[0] & in ieee80211_ie_build_he_cap()
2933 n *= (1 + ((he_cap->ppe_thres[0] & IEEE80211_PPE_THRES_NSS_MASK) >> in ieee80211_ie_build_he_cap()
2944 memcpy(pos, &he_cap->ppe_thres, n); in ieee80211_ie_build_he_cap()
2948 orig_pos[1] = (pos - orig_pos) - 2; in ieee80211_ie_build_he_cap()
2957 enum nl80211_iftype iftype = ieee80211_vif_type_p2p(&sdata->vif); in ieee80211_ie_build_he_6ghz_cap()
2970 if (!iftd->he_6ghz_capa.capa) in ieee80211_ie_build_he_6ghz_cap()
2973 cap = le16_to_cpu(iftd->he_6ghz_capa.capa); in ieee80211_ie_build_he_6ghz_cap()
2976 switch (sdata->smps_mode) { in ieee80211_ie_build_he_6ghz_cap()
3009 ht_oper->primary_chan = ieee80211_frequency_to_channel( in ieee80211_ie_build_ht_oper()
3010 chandef->chan->center_freq); in ieee80211_ie_build_ht_oper()
3011 switch (chandef->width) { in ieee80211_ie_build_ht_oper()
3016 if (chandef->center_freq1 > chandef->chan->center_freq) in ieee80211_ie_build_ht_oper()
3017 ht_oper->ht_param = IEEE80211_HT_PARAM_CHA_SEC_ABOVE; in ieee80211_ie_build_ht_oper()
3019 ht_oper->ht_param = IEEE80211_HT_PARAM_CHA_SEC_BELOW; in ieee80211_ie_build_ht_oper()
3022 ht_oper->ht_param = IEEE80211_HT_PARAM_CHA_SEC_NONE; in ieee80211_ie_build_ht_oper()
3025 if (ht_cap->cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40 && in ieee80211_ie_build_ht_oper()
3026 chandef->width != NL80211_CHAN_WIDTH_20_NOHT && in ieee80211_ie_build_ht_oper()
3027 chandef->width != NL80211_CHAN_WIDTH_20) in ieee80211_ie_build_ht_oper()
3028 ht_oper->ht_param |= IEEE80211_HT_PARAM_CHAN_WIDTH_ANY; in ieee80211_ie_build_ht_oper()
3031 ht_oper->ht_param |= IEEE80211_HT_PARAM_RIFS_MODE; in ieee80211_ie_build_ht_oper()
3033 ht_oper->operation_mode = cpu_to_le16(prot_mode); in ieee80211_ie_build_ht_oper()
3034 ht_oper->stbc_param = 0x0000; in ieee80211_ie_build_ht_oper()
3038 memset(&ht_oper->basic_set, 0, 16); in ieee80211_ie_build_ht_oper()
3039 memcpy(&ht_oper->basic_set, &ht_cap->mcs, 10); in ieee80211_ie_build_ht_oper()
3050 switch (chandef->width) { in ieee80211_ie_build_wide_bw_cs()
3065 *pos++ = ieee80211_frequency_to_channel(chandef->center_freq1); in ieee80211_ie_build_wide_bw_cs()
3067 if (chandef->center_freq2) in ieee80211_ie_build_wide_bw_cs()
3068 *pos++ = ieee80211_frequency_to_channel(chandef->center_freq2); in ieee80211_ie_build_wide_bw_cs()
3081 vht_oper->center_freq_seg0_idx = ieee80211_frequency_to_channel( in ieee80211_ie_build_vht_oper()
3082 chandef->center_freq1); in ieee80211_ie_build_vht_oper()
3083 if (chandef->center_freq2) in ieee80211_ie_build_vht_oper()
3084 vht_oper->center_freq_seg1_idx = in ieee80211_ie_build_vht_oper()
3085 ieee80211_frequency_to_channel(chandef->center_freq2); in ieee80211_ie_build_vht_oper()
3087 vht_oper->center_freq_seg1_idx = 0x00; in ieee80211_ie_build_vht_oper()
3089 switch (chandef->width) { in ieee80211_ie_build_vht_oper()
3095 vht_oper->chan_width = IEEE80211_VHT_CHANWIDTH_80MHZ; in ieee80211_ie_build_vht_oper()
3096 vht_oper->center_freq_seg1_idx = vht_oper->center_freq_seg0_idx; in ieee80211_ie_build_vht_oper()
3097 if (chandef->chan->center_freq < chandef->center_freq1) in ieee80211_ie_build_vht_oper()
3098 vht_oper->center_freq_seg0_idx -= 8; in ieee80211_ie_build_vht_oper()
3100 vht_oper->center_freq_seg0_idx += 8; in ieee80211_ie_build_vht_oper()
3107 vht_oper->chan_width = IEEE80211_VHT_CHANWIDTH_80MHZ; in ieee80211_ie_build_vht_oper()
3110 vht_oper->chan_width = IEEE80211_VHT_CHANWIDTH_80MHZ; in ieee80211_ie_build_vht_oper()
3113 vht_oper->chan_width = IEEE80211_VHT_CHANWIDTH_USE_HT; in ieee80211_ie_build_vht_oper()
3118 vht_oper->basic_mcs_set = cpu_to_le16(0xffff); in ieee80211_ie_build_vht_oper()
3130 if (chandef->chan->band == NL80211_BAND_6GHZ) in ieee80211_ie_build_he_oper()
3144 if (chandef->chan->band == NL80211_BAND_6GHZ) in ieee80211_ie_build_he_oper()
3149 he_oper->he_oper_params = cpu_to_le32(he_oper_params); in ieee80211_ie_build_he_oper()
3152 he_oper->he_mcs_nss_set = cpu_to_le16(0xffff); in ieee80211_ie_build_he_oper()
3155 if (chandef->chan->band != NL80211_BAND_6GHZ) in ieee80211_ie_build_he_oper()
3160 he_6ghz_op->minrate = 6; /* 6 Mbps */ in ieee80211_ie_build_he_oper()
3161 he_6ghz_op->primary = in ieee80211_ie_build_he_oper()
3162 ieee80211_frequency_to_channel(chandef->chan->center_freq); in ieee80211_ie_build_he_oper()
3163 he_6ghz_op->ccfs0 = in ieee80211_ie_build_he_oper()
3164 ieee80211_frequency_to_channel(chandef->center_freq1); in ieee80211_ie_build_he_oper()
3165 if (chandef->center_freq2) in ieee80211_ie_build_he_oper()
3166 he_6ghz_op->ccfs1 = in ieee80211_ie_build_he_oper()
3167 ieee80211_frequency_to_channel(chandef->center_freq2); in ieee80211_ie_build_he_oper()
3169 he_6ghz_op->ccfs1 = 0; in ieee80211_ie_build_he_oper()
3171 switch (chandef->width) { in ieee80211_ie_build_he_oper()
3176 he_6ghz_op->control = in ieee80211_ie_build_he_oper()
3178 he_6ghz_op->ccfs1 = he_6ghz_op->ccfs0; in ieee80211_ie_build_he_oper()
3179 if (chandef->chan->center_freq < chandef->center_freq1) in ieee80211_ie_build_he_oper()
3180 he_6ghz_op->ccfs0 -= 8; in ieee80211_ie_build_he_oper()
3182 he_6ghz_op->ccfs0 += 8; in ieee80211_ie_build_he_oper()
3185 he_6ghz_op->control = in ieee80211_ie_build_he_oper()
3189 he_6ghz_op->control = in ieee80211_ie_build_he_oper()
3193 he_6ghz_op->control = in ieee80211_ie_build_he_oper()
3197 he_6ghz_op->control = in ieee80211_ie_build_he_oper()
3216 switch (ht_oper->ht_param & IEEE80211_HT_PARAM_CHA_SEC_OFFSET) { in ieee80211_chandef_ht_oper()
3231 cfg80211_chandef_create(chandef, chandef->chan, channel_type); in ieee80211_chandef_ht_oper()
3255 vht_cap = hw->wiphy->bands[chandef->chan->band]->vht_cap.cap; in ieee80211_chandef_vht_oper()
3264 ccfs0 = oper->center_freq_seg0_idx; in ieee80211_chandef_vht_oper()
3265 ccfs1 = oper->center_freq_seg1_idx; in ieee80211_chandef_vht_oper()
3266 ccfs2 = (le16_to_cpu(htop->operation_mode) & in ieee80211_chandef_vht_oper()
3277 * Cf. IEEE 802.11 Table 9-250 in ieee80211_chandef_vht_oper()
3313 cf0 = ieee80211_channel_to_frequency(ccf0, chandef->chan->band); in ieee80211_chandef_vht_oper()
3314 cf1 = ieee80211_channel_to_frequency(ccf1, chandef->chan->band); in ieee80211_chandef_vht_oper()
3316 switch (oper->chan_width) { in ieee80211_chandef_vht_oper()
3327 diff = abs(ccf1 - ccf0); in ieee80211_chandef_vht_oper()
3363 struct ieee80211_local *local = sdata->local; in ieee80211_chandef_he_6ghz_oper()
3365 enum nl80211_iftype iftype = ieee80211_vif_type_p2p(&sdata->vif); in ieee80211_chandef_he_6ghz_oper()
3373 if (chandef->chan->band != NL80211_BAND_6GHZ) in ieee80211_chandef_he_6ghz_oper()
3376 sband = local->hw.wiphy->bands[NL80211_BAND_6GHZ]; in ieee80211_chandef_he_6ghz_oper()
3384 he_phy_cap = he_cap->he_cap_elem.phy_cap_info[0]; in ieee80211_chandef_he_6ghz_oper()
3395 chandef->chan->center_freq); in ieee80211_chandef_he_6ghz_oper()
3404 chandef->chan->center_freq); in ieee80211_chandef_he_6ghz_oper()
3408 freq = ieee80211_channel_to_frequency(he_6ghz_oper->primary, in ieee80211_chandef_he_6ghz_oper()
3410 he_chandef.chan = ieee80211_get_channel(sdata->local->hw.wiphy, freq); in ieee80211_chandef_he_6ghz_oper()
3412 switch (u8_get_bits(he_6ghz_oper->control, in ieee80211_chandef_he_6ghz_oper()
3425 if (!he_6ghz_oper->ccfs1) in ieee80211_chandef_he_6ghz_oper()
3427 if (abs(he_6ghz_oper->ccfs1 - he_6ghz_oper->ccfs0) == 8) { in ieee80211_chandef_he_6ghz_oper()
3439 ieee80211_channel_to_frequency(he_6ghz_oper->ccfs1, in ieee80211_chandef_he_6ghz_oper()
3443 ieee80211_channel_to_frequency(he_6ghz_oper->ccfs0, in ieee80211_chandef_he_6ghz_oper()
3447 ieee80211_channel_to_frequency(he_6ghz_oper->ccfs1, in ieee80211_chandef_he_6ghz_oper()
3454 he_chandef.chan ? he_chandef.chan->center_freq : 0, in ieee80211_chandef_he_6ghz_oper()
3474 switch (FIELD_GET(S1G_OPER_CH_WIDTH_OPER, oper->ch_width)) { in ieee80211_chandef_s1g_oper()
3476 chandef->width = NL80211_CHAN_WIDTH_1; in ieee80211_chandef_s1g_oper()
3479 chandef->width = NL80211_CHAN_WIDTH_2; in ieee80211_chandef_s1g_oper()
3482 chandef->width = NL80211_CHAN_WIDTH_4; in ieee80211_chandef_s1g_oper()
3485 chandef->width = NL80211_CHAN_WIDTH_8; in ieee80211_chandef_s1g_oper()
3488 chandef->width = NL80211_CHAN_WIDTH_16; in ieee80211_chandef_s1g_oper()
3494 oper_freq = ieee80211_channel_to_freq_khz(oper->oper_ch, in ieee80211_chandef_s1g_oper()
3496 chandef->center_freq1 = KHZ_TO_MHZ(oper_freq); in ieee80211_chandef_s1g_oper()
3497 chandef->freq1_offset = oper_freq % 1000; in ieee80211_chandef_s1g_oper()
3516 for (j = 0; j < sband->n_bitrates; j++) { in ieee80211_parse_bitrates()
3517 br = &sband->bitrates[j]; in ieee80211_parse_bitrates()
3518 if ((rate_flags & br->flags) != rate_flags) in ieee80211_parse_bitrates()
3521 brate = DIV_ROUND_UP(br->bitrate, (1 << shift) * 5); in ieee80211_parse_bitrates()
3536 struct ieee80211_local *local = sdata->local; in ieee80211_add_srates_ie()
3540 u32 basic_rates = sdata->vif.bss_conf.basic_rates; in ieee80211_add_srates_ie()
3543 shift = ieee80211_vif_get_shift(&sdata->vif); in ieee80211_add_srates_ie()
3544 rate_flags = ieee80211_chandef_rate_flags(&sdata->vif.bss_conf.chandef); in ieee80211_add_srates_ie()
3545 sband = local->hw.wiphy->bands[band]; in ieee80211_add_srates_ie()
3547 for (i = 0; i < sband->n_bitrates; i++) { in ieee80211_add_srates_ie()
3548 if ((rate_flags & sband->bitrates[i].flags) != rate_flags) in ieee80211_add_srates_ie()
3556 return -ENOMEM; in ieee80211_add_srates_ie()
3563 if ((rate_flags & sband->bitrates[i].flags) != rate_flags) in ieee80211_add_srates_ie()
3568 rate = DIV_ROUND_UP(sband->bitrates[i].bitrate, in ieee80211_add_srates_ie()
3580 struct ieee80211_local *local = sdata->local; in ieee80211_add_ext_srates_ie()
3584 u32 basic_rates = sdata->vif.bss_conf.basic_rates; in ieee80211_add_ext_srates_ie()
3587 rate_flags = ieee80211_chandef_rate_flags(&sdata->vif.bss_conf.chandef); in ieee80211_add_ext_srates_ie()
3588 shift = ieee80211_vif_get_shift(&sdata->vif); in ieee80211_add_ext_srates_ie()
3590 sband = local->hw.wiphy->bands[band]; in ieee80211_add_ext_srates_ie()
3592 for (i = 0; i < sband->n_bitrates; i++) { in ieee80211_add_ext_srates_ie()
3593 if ((rate_flags & sband->bitrates[i].flags) != rate_flags) in ieee80211_add_ext_srates_ie()
3599 exrates -= 8; in ieee80211_add_ext_srates_ie()
3604 return -ENOMEM; in ieee80211_add_ext_srates_ie()
3610 for (i = 8; i < sband->n_bitrates; i++) { in ieee80211_add_ext_srates_ie()
3612 if ((rate_flags & sband->bitrates[i].flags) in ieee80211_add_ext_srates_ie()
3617 rate = DIV_ROUND_UP(sband->bitrates[i].bitrate, in ieee80211_add_ext_srates_ie()
3628 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_ave_rssi()
3630 if (WARN_ON_ONCE(sdata->vif.type != NL80211_IFTYPE_STATION)) { in ieee80211_ave_rssi()
3631 /* non-managed type inferfaces */ in ieee80211_ave_rssi()
3634 return -ewma_beacon_signal_read(&ifmgd->ave_beacon_signal); in ieee80211_ave_rssi()
3645 if (mcs->rx_mask[3]) in ieee80211_mcs_to_chains()
3647 if (mcs->rx_mask[2]) in ieee80211_mcs_to_chains()
3649 if (mcs->rx_mask[1]) in ieee80211_mcs_to_chains()
3655 * ieee80211_calculate_rx_timestamp - calculate timestamp in frame
3670 u64 ts = status->mactime; in ieee80211_calculate_rx_timestamp()
3671 struct rate_info ri; in ieee80211_calculate_rx_timestamp() local
3677 memset(&ri, 0, sizeof(ri)); in ieee80211_calculate_rx_timestamp()
3679 ri.bw = status->bw; in ieee80211_calculate_rx_timestamp()
3682 switch (status->encoding) { in ieee80211_calculate_rx_timestamp()
3684 ri.mcs = status->rate_idx; in ieee80211_calculate_rx_timestamp()
3685 ri.flags |= RATE_INFO_FLAGS_MCS; in ieee80211_calculate_rx_timestamp()
3686 if (status->enc_flags & RX_ENC_FLAG_SHORT_GI) in ieee80211_calculate_rx_timestamp()
3687 ri.flags |= RATE_INFO_FLAGS_SHORT_GI; in ieee80211_calculate_rx_timestamp()
3690 ri.flags |= RATE_INFO_FLAGS_VHT_MCS; in ieee80211_calculate_rx_timestamp()
3691 ri.mcs = status->rate_idx; in ieee80211_calculate_rx_timestamp()
3692 ri.nss = status->nss; in ieee80211_calculate_rx_timestamp()
3693 if (status->enc_flags & RX_ENC_FLAG_SHORT_GI) in ieee80211_calculate_rx_timestamp()
3694 ri.flags |= RATE_INFO_FLAGS_SHORT_GI; in ieee80211_calculate_rx_timestamp()
3704 switch (status->bw) { in ieee80211_calculate_rx_timestamp()
3713 sband = local->hw.wiphy->bands[status->band]; in ieee80211_calculate_rx_timestamp()
3714 bitrate = sband->bitrates[status->rate_idx].bitrate; in ieee80211_calculate_rx_timestamp()
3715 ri.legacy = DIV_ROUND_UP(bitrate, (1 << shift)); in ieee80211_calculate_rx_timestamp()
3717 if (status->flag & RX_FLAG_MACTIME_PLCP_START) { in ieee80211_calculate_rx_timestamp()
3719 if (status->band == NL80211_BAND_5GHZ) { in ieee80211_calculate_rx_timestamp()
3722 } else if (status->enc_flags & RX_ENC_FLAG_SHORTPRE) { in ieee80211_calculate_rx_timestamp()
3732 rate = cfg80211_calculate_bitrate(&ri); in ieee80211_calculate_rx_timestamp()
3735 (unsigned long long)status->flag, status->rate_idx, in ieee80211_calculate_rx_timestamp()
3736 status->nss)) in ieee80211_calculate_rx_timestamp()
3740 if (status->flag & RX_FLAG_MACTIME_END) in ieee80211_calculate_rx_timestamp()
3741 ts -= mpdu_len * 8 * 10 / rate; in ieee80211_calculate_rx_timestamp()
3756 mutex_lock(&local->mtx); in ieee80211_dfs_cac_cancel()
3757 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_dfs_cac_cancel()
3758 /* it might be waiting for the local->mtx, but then in ieee80211_dfs_cac_cancel()
3759 * by the time it gets it, sdata->wdev.cac_started in ieee80211_dfs_cac_cancel()
3762 cancel_delayed_work(&sdata->dfs_cac_timer_work); in ieee80211_dfs_cac_cancel()
3764 if (sdata->wdev.cac_started) { in ieee80211_dfs_cac_cancel()
3765 chandef = sdata->vif.bss_conf.chandef; in ieee80211_dfs_cac_cancel()
3767 cfg80211_cac_event(sdata->dev, in ieee80211_dfs_cac_cancel()
3773 mutex_unlock(&local->mtx); in ieee80211_dfs_cac_cancel()
3780 struct cfg80211_chan_def chandef = local->hw.conf.chandef; in ieee80211_dfs_radar_detected_work()
3784 mutex_lock(&local->chanctx_mtx); in ieee80211_dfs_radar_detected_work()
3785 list_for_each_entry(ctx, &local->chanctx_list, list) { in ieee80211_dfs_radar_detected_work()
3786 if (ctx->replace_state == IEEE80211_CHANCTX_REPLACES_OTHER) in ieee80211_dfs_radar_detected_work()
3790 chandef = ctx->conf.def; in ieee80211_dfs_radar_detected_work()
3792 mutex_unlock(&local->chanctx_mtx); in ieee80211_dfs_radar_detected_work()
3799 /* XXX: multi-channel is not supported yet */ in ieee80211_dfs_radar_detected_work()
3802 cfg80211_radar_event(local->hw.wiphy, &chandef, GFP_KERNEL); in ieee80211_dfs_radar_detected_work()
3811 schedule_work(&local->radar_detected_work); in ieee80211_radar_detected()
3820 switch (c->width) { in ieee80211_chandef_downgrade()
3822 c->width = NL80211_CHAN_WIDTH_20_NOHT; in ieee80211_chandef_downgrade()
3826 c->width = NL80211_CHAN_WIDTH_20; in ieee80211_chandef_downgrade()
3827 c->center_freq1 = c->chan->center_freq; in ieee80211_chandef_downgrade()
3832 tmp = (30 + c->chan->center_freq - c->center_freq1)/20; in ieee80211_chandef_downgrade()
3836 c->center_freq1 = c->center_freq1 - 20 + 40 * tmp; in ieee80211_chandef_downgrade()
3837 c->width = NL80211_CHAN_WIDTH_40; in ieee80211_chandef_downgrade()
3841 c->center_freq2 = 0; in ieee80211_chandef_downgrade()
3842 c->width = NL80211_CHAN_WIDTH_80; in ieee80211_chandef_downgrade()
3848 tmp = (70 + c->chan->center_freq - c->center_freq1)/20; in ieee80211_chandef_downgrade()
3851 c->center_freq1 = c->center_freq1 - 40 + 80 * tmp; in ieee80211_chandef_downgrade()
3852 c->width = NL80211_CHAN_WIDTH_80; in ieee80211_chandef_downgrade()
3859 c->width = NL80211_CHAN_WIDTH_20_NOHT; in ieee80211_chandef_downgrade()
3870 /* keep c->width */ in ieee80211_chandef_downgrade()
3910 struct ieee80211_local *local = sdata->local; in ieee80211_send_action_csa()
3916 if (sdata->vif.type != NL80211_IFTYPE_ADHOC && in ieee80211_send_action_csa()
3917 sdata->vif.type != NL80211_IFTYPE_MESH_POINT) in ieee80211_send_action_csa()
3918 return -EOPNOTSUPP; in ieee80211_send_action_csa()
3920 skb = dev_alloc_skb(local->tx_headroom + hdr_len + in ieee80211_send_action_csa()
3926 return -ENOMEM; in ieee80211_send_action_csa()
3928 skb_reserve(skb, local->tx_headroom); in ieee80211_send_action_csa()
3930 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | in ieee80211_send_action_csa()
3933 eth_broadcast_addr(mgmt->da); in ieee80211_send_action_csa()
3934 memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); in ieee80211_send_action_csa()
3935 if (ieee80211_vif_is_mesh(&sdata->vif)) { in ieee80211_send_action_csa()
3936 memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN); in ieee80211_send_action_csa()
3938 struct ieee80211_if_ibss *ifibss = &sdata->u.ibss; in ieee80211_send_action_csa()
3939 memcpy(mgmt->bssid, ifibss->bssid, ETH_ALEN); in ieee80211_send_action_csa()
3941 mgmt->u.action.category = WLAN_CATEGORY_SPECTRUM_MGMT; in ieee80211_send_action_csa()
3942 mgmt->u.action.u.chan_switch.action_code = WLAN_ACTION_SPCT_CHL_SWITCH; in ieee80211_send_action_csa()
3946 *pos++ = csa_settings->block_tx ? 1 : 0; /* CSA mode */ in ieee80211_send_action_csa()
3947 freq = csa_settings->chandef.chan->center_freq; in ieee80211_send_action_csa()
3949 *pos++ = csa_settings->count; /* count */ in ieee80211_send_action_csa()
3951 if (csa_settings->chandef.width == NL80211_CHAN_WIDTH_40) { in ieee80211_send_action_csa()
3957 ch_type = cfg80211_get_chandef_type(&csa_settings->chandef); in ieee80211_send_action_csa()
3964 if (ieee80211_vif_is_mesh(&sdata->vif)) { in ieee80211_send_action_csa()
3965 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; in ieee80211_send_action_csa()
3970 *pos++ = sdata->u.mesh.mshcfg.dot11MeshTTL; /* Mesh TTL */ in ieee80211_send_action_csa()
3973 *pos++ |= csa_settings->block_tx ? in ieee80211_send_action_csa()
3977 put_unaligned_le16(ifmsh->pre_value, pos);/* Precedence Value */ in ieee80211_send_action_csa()
3981 if (csa_settings->chandef.width == NL80211_CHAN_WIDTH_80 || in ieee80211_send_action_csa()
3982 csa_settings->chandef.width == NL80211_CHAN_WIDTH_80P80 || in ieee80211_send_action_csa()
3983 csa_settings->chandef.width == NL80211_CHAN_WIDTH_160) { in ieee80211_send_action_csa()
3985 ieee80211_ie_build_wide_bw_cs(pos, &csa_settings->chandef); in ieee80211_send_action_csa()
3994 return !(cs == NULL || cs->cipher == 0 || in ieee80211_cs_valid()
3995 cs->hdr_len < cs->pn_len + cs->pn_off || in ieee80211_cs_valid()
3996 cs->hdr_len <= cs->key_idx_off || in ieee80211_cs_valid()
3997 cs->key_idx_shift > 7 || in ieee80211_cs_valid()
3998 cs->key_idx_mask == 0); in ieee80211_cs_valid()
4019 const struct ieee80211_cipher_scheme *l = local->hw.cipher_schemes; in ieee80211_cs_get()
4020 int n = local->hw.n_cipher_schemes; in ieee80211_cs_get()
4031 if (!cs || !(cs->iftype & BIT(iftype))) in ieee80211_cs_get()
4045 for (i = 0; i < crypto->n_ciphers_pairwise; i++) { in ieee80211_cs_headroom()
4046 cs = ieee80211_cs_get(local, crypto->ciphers_pairwise[i], in ieee80211_cs_headroom()
4049 if (cs && headroom < cs->hdr_len) in ieee80211_cs_headroom()
4050 headroom = cs->hdr_len; in ieee80211_cs_headroom()
4053 cs = ieee80211_cs_get(local, crypto->cipher_group, iftype); in ieee80211_cs_headroom()
4054 if (cs && headroom < cs->hdr_len) in ieee80211_cs_headroom()
4055 headroom = cs->hdr_len; in ieee80211_cs_headroom()
4063 s32 end = data->desc[i].start + data->desc[i].duration - (tsf + 1); in ieee80211_extend_noa_desc()
4070 if (data->count[i] == 1) in ieee80211_extend_noa_desc()
4073 if (data->desc[i].interval == 0) in ieee80211_extend_noa_desc()
4077 skip = DIV_ROUND_UP(-end, data->desc[i].interval); in ieee80211_extend_noa_desc()
4078 if (data->count[i] < 255) { in ieee80211_extend_noa_desc()
4079 if (data->count[i] <= skip) { in ieee80211_extend_noa_desc()
4080 data->count[i] = 0; in ieee80211_extend_noa_desc()
4084 data->count[i] -= skip; in ieee80211_extend_noa_desc()
4087 data->desc[i].start += skip * data->desc[i].interval; in ieee80211_extend_noa_desc()
4102 if (!data->count[i]) in ieee80211_extend_absent_time()
4108 cur = data->desc[i].start - tsf; in ieee80211_extend_absent_time()
4112 cur = data->desc[i].start + data->desc[i].duration - tsf; in ieee80211_extend_absent_time()
4144 u32 next_offset = BIT(31) - 1; in ieee80211_update_p2p_noa()
4147 data->absent = 0; in ieee80211_update_p2p_noa()
4148 data->has_next_tsf = false; in ieee80211_update_p2p_noa()
4152 if (!data->count[i]) in ieee80211_update_p2p_noa()
4156 start = data->desc[i].start - tsf; in ieee80211_update_p2p_noa()
4158 data->absent |= BIT(i); in ieee80211_update_p2p_noa()
4163 data->has_next_tsf = true; in ieee80211_update_p2p_noa()
4166 if (data->absent) in ieee80211_update_p2p_noa()
4169 data->next_tsf = tsf + next_offset; in ieee80211_update_p2p_noa()
4182 const struct ieee80211_p2p_noa_desc *desc = &attr->desc[i]; in ieee80211_parse_p2p_noa()
4184 if (!desc->count || !desc->duration) in ieee80211_parse_p2p_noa()
4187 data->count[i] = desc->count; in ieee80211_parse_p2p_noa()
4188 data->desc[i].start = le32_to_cpu(desc->start_time); in ieee80211_parse_p2p_noa()
4189 data->desc[i].duration = le32_to_cpu(desc->duration); in ieee80211_parse_p2p_noa()
4190 data->desc[i].interval = le32_to_cpu(desc->interval); in ieee80211_parse_p2p_noa()
4192 if (data->count[i] > 1 && in ieee80211_parse_p2p_noa()
4193 data->desc[i].interval < data->desc[i].duration) in ieee80211_parse_p2p_noa()
4212 u16 beacon_int = sdata->vif.bss_conf.beacon_int * 1024; in ieee80211_recalc_dtim()
4213 u8 dtim_period = sdata->vif.bss_conf.dtim_period; in ieee80211_recalc_dtim()
4217 if (tsf == -1ULL || !beacon_int || !dtim_period) in ieee80211_recalc_dtim()
4220 if (sdata->vif.type == NL80211_IFTYPE_AP || in ieee80211_recalc_dtim()
4221 sdata->vif.type == NL80211_IFTYPE_AP_VLAN) { in ieee80211_recalc_dtim()
4222 if (!sdata->bss) in ieee80211_recalc_dtim()
4225 ps = &sdata->bss->ps; in ieee80211_recalc_dtim()
4226 } else if (ieee80211_vif_is_mesh(&sdata->vif)) { in ieee80211_recalc_dtim()
4227 ps = &sdata->u.mesh.ps; in ieee80211_recalc_dtim()
4235 * dtim_count = dtim_period - (tsf / bcn_int) % dtim_period in ieee80211_recalc_dtim()
4243 dtim_count = dtim_period - bcns_from_dtim; in ieee80211_recalc_dtim()
4245 ps->dtim_count = dtim_count; in ieee80211_recalc_dtim()
4254 lockdep_assert_held(&local->chanctx_mtx); in ieee80211_chanctx_radar_detect()
4256 if (WARN_ON(ctx->replace_state == IEEE80211_CHANCTX_WILL_BE_REPLACED)) in ieee80211_chanctx_radar_detect()
4259 list_for_each_entry(sdata, &ctx->reserved_vifs, reserved_chanctx_list) in ieee80211_chanctx_radar_detect()
4260 if (sdata->reserved_radar_required) in ieee80211_chanctx_radar_detect()
4261 radar_detect |= BIT(sdata->reserved_chandef.width); in ieee80211_chanctx_radar_detect()
4264 * An in-place reservation context should not have any assigned vifs in ieee80211_chanctx_radar_detect()
4267 WARN_ON(ctx->replace_state == IEEE80211_CHANCTX_REPLACES_OTHER && in ieee80211_chanctx_radar_detect()
4268 !list_empty(&ctx->assigned_vifs)); in ieee80211_chanctx_radar_detect()
4270 list_for_each_entry(sdata, &ctx->assigned_vifs, assigned_chanctx_list) in ieee80211_chanctx_radar_detect()
4271 if (sdata->radar_required) in ieee80211_chanctx_radar_detect()
4272 radar_detect |= BIT(sdata->vif.bss_conf.chandef.width); in ieee80211_chanctx_radar_detect()
4282 struct ieee80211_local *local = sdata->local; in ieee80211_check_combinations()
4284 enum nl80211_iftype iftype = sdata->wdev.iftype; in ieee80211_check_combinations()
4291 lockdep_assert_held(&local->chanctx_mtx); in ieee80211_check_combinations()
4294 return -EINVAL; in ieee80211_check_combinations()
4297 !chandef->chan)) in ieee80211_check_combinations()
4298 return -EINVAL; in ieee80211_check_combinations()
4301 return -EINVAL; in ieee80211_check_combinations()
4303 if (sdata->vif.type == NL80211_IFTYPE_AP || in ieee80211_check_combinations()
4304 sdata->vif.type == NL80211_IFTYPE_MESH_POINT) { in ieee80211_check_combinations()
4310 params.new_beacon_int = sdata->vif.bss_conf.beacon_int; in ieee80211_check_combinations()
4314 if (cfg80211_iftype_allowed(local->hw.wiphy, iftype, 0, 1)) { in ieee80211_check_combinations()
4316 return -EINVAL; in ieee80211_check_combinations()
4326 list_for_each_entry(ctx, &local->chanctx_list, list) { in ieee80211_check_combinations()
4327 if (ctx->replace_state == IEEE80211_CHANCTX_WILL_BE_REPLACED) in ieee80211_check_combinations()
4331 if (ctx->mode == IEEE80211_CHANCTX_EXCLUSIVE) { in ieee80211_check_combinations()
4337 &ctx->conf.def)) in ieee80211_check_combinations()
4342 list_for_each_entry_rcu(sdata_iter, &local->interfaces, list) { in ieee80211_check_combinations()
4345 wdev_iter = &sdata_iter->wdev; in ieee80211_check_combinations()
4349 cfg80211_iftype_allowed(local->hw.wiphy, in ieee80211_check_combinations()
4350 wdev_iter->iftype, 0, 1)) in ieee80211_check_combinations()
4353 params.iftype_num[wdev_iter->iftype]++; in ieee80211_check_combinations()
4360 return cfg80211_check_combinations(local->hw.wiphy, &params); in ieee80211_check_combinations()
4370 c->num_different_channels); in ieee80211_iter_max_chans()
4381 lockdep_assert_held(&local->chanctx_mtx); in ieee80211_max_num_channels()
4383 list_for_each_entry(ctx, &local->chanctx_list, list) { in ieee80211_max_num_channels()
4384 if (ctx->replace_state == IEEE80211_CHANCTX_WILL_BE_REPLACED) in ieee80211_max_num_channels()
4393 list_for_each_entry_rcu(sdata, &local->interfaces, list) in ieee80211_max_num_channels()
4394 params.iftype_num[sdata->wdev.iftype]++; in ieee80211_max_num_channels()
4396 err = cfg80211_iter_combinations(local->hw.wiphy, &params, in ieee80211_max_num_channels()
4409 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_add_s1g_capab_ie()
4414 if (WARN_ON(sdata->vif.type != NL80211_IFTYPE_STATION)) in ieee80211_add_s1g_capab_ie()
4417 if (!caps->s1g) in ieee80211_add_s1g_capab_ie()
4420 memcpy(s1g_capab.capab_info, caps->cap, sizeof(caps->cap)); in ieee80211_add_s1g_capab_ie()
4421 memcpy(s1g_capab.supp_mcs_nss, caps->nss_mcs, sizeof(caps->nss_mcs)); in ieee80211_add_s1g_capab_ie()
4423 /* override the capability info */ in ieee80211_add_s1g_capab_ie()
4424 for (i = 0; i < sizeof(ifmgd->s1g_capa.capab_info); i++) { in ieee80211_add_s1g_capab_ie()
4425 u8 mask = ifmgd->s1g_capa_mask.capab_info[i]; in ieee80211_add_s1g_capab_ie()
4428 s1g_capab.capab_info[i] |= ifmgd->s1g_capa.capab_info[i] & mask; in ieee80211_add_s1g_capab_ie()
4432 for (i = 0; i < sizeof(ifmgd->s1g_capa.supp_mcs_nss); i++) { in ieee80211_add_s1g_capab_ie()
4433 u8 mask = ifmgd->s1g_capa_mask.supp_mcs_nss[i]; in ieee80211_add_s1g_capab_ie()
4437 ifmgd->s1g_capa.supp_mcs_nss[i] & mask; in ieee80211_add_s1g_capab_ie()
4467 *buf++ = qosinfo; /* U-APSD no in use */ in ieee80211_add_wmm_info_ie()
4480 skb_queue_walk(&txqi->frags, skb) { in ieee80211_txq_get_depth()
4482 frag_bytes += skb->len; in ieee80211_txq_get_depth()
4486 *frame_cnt = txqi->tin.backlog_packets + frag_cnt; in ieee80211_txq_get_depth()
4489 *byte_cnt = txqi->tin.backlog_bytes + frag_bytes; in ieee80211_txq_get_depth()