Lines Matching +full:local +full:- +full:cap +full:- +full:size

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"
41 struct ieee80211_local *local; in wiphy_to_ieee80211_hw() local
43 local = wiphy_priv(wiphy); in wiphy_to_ieee80211_hw()
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()
210 struct ieee80211_local *local = hw_to_local(hw); in ieee80211_rts_duration() local
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()
254 struct ieee80211_local *local = hw_to_local(hw); in ieee80211_ctstoself_duration() local
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() local
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()
329 drv_wake_tx_queue(local, txqi); 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()
345 drv_wake_tx_queue(local, txqi); 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)
356 _ieee80211_wake_txqs(struct ieee80211_local *local, unsigned long *flags) in _ieee80211_wake_txqs() argument
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()
391 struct ieee80211_local *local = (struct ieee80211_local *)data; in ieee80211_wake_txqs() local
394 spin_lock_irqsave(&local->queue_stop_reason_lock, flags); in ieee80211_wake_txqs()
395 _ieee80211_wake_txqs(local, &flags); in ieee80211_wake_txqs()
396 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); in ieee80211_wake_txqs()
399 void ieee80211_propagate_queue_wake(struct ieee80211_local *local, int queue) in ieee80211_propagate_queue_wake() argument
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()
437 struct ieee80211_local *local = hw_to_local(hw); in __ieee80211_wake_queue() local
439 trace_wake_queue(local, queue, reason); in __ieee80211_wake_queue()
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()
464 ieee80211_propagate_queue_wake(local, 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()
480 _ieee80211_wake_txqs(local, flags); in __ieee80211_wake_queue()
488 struct ieee80211_local *local = hw_to_local(hw); in ieee80211_wake_queue_by_reason() local
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()
508 struct ieee80211_local *local = hw_to_local(hw); in __ieee80211_stop_queue() local
512 trace_stop_queue(local, queue, reason); in __ieee80211_stop_queue()
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()
555 struct ieee80211_local *local = hw_to_local(hw); in ieee80211_stop_queue_by_reason() local
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()
571 void ieee80211_add_pending_skb(struct ieee80211_local *local, in ieee80211_add_pending_skb() argument
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()
593 void ieee80211_add_pending_skbs(struct ieee80211_local *local, in ieee80211_add_pending_skbs() argument
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()
631 struct ieee80211_local *local = hw_to_local(hw); in ieee80211_stop_queues_by_reason() local
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()
653 struct ieee80211_local *local = hw_to_local(hw); in ieee80211_queue_stopped() local
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()
673 struct ieee80211_local *local = hw_to_local(hw); in ieee80211_wake_queues_by_reason() local
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()
694 ieee80211_get_vif_queues(struct ieee80211_local *local, in ieee80211_get_vif_queues() argument
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()
716 void __ieee80211_flush_queues(struct ieee80211_local *local, in __ieee80211_flush_queues() argument
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()
728 queues = ieee80211_get_vif_queues(local, sdata); in __ieee80211_flush_queues()
730 ieee80211_stop_queues_by_reason(&local->hw, queues, in __ieee80211_flush_queues()
734 drv_flush(local, sdata, queues, drop); in __ieee80211_flush_queues()
736 ieee80211_wake_queues_by_reason(&local->hw, queues, in __ieee80211_flush_queues()
741 void ieee80211_flush_queues(struct ieee80211_local *local, in ieee80211_flush_queues() argument
744 __ieee80211_flush_queues(local, sdata, 0, drop); in ieee80211_flush_queues()
747 void ieee80211_stop_vif_queues(struct ieee80211_local *local, in ieee80211_stop_vif_queues() argument
751 ieee80211_stop_queues_by_reason(&local->hw, in ieee80211_stop_vif_queues()
752 ieee80211_get_vif_queues(local, sdata), in ieee80211_stop_vif_queues()
756 void ieee80211_wake_vif_queues(struct ieee80211_local *local, in ieee80211_wake_vif_queues() argument
760 ieee80211_wake_queues_by_reason(&local->hw, in ieee80211_wake_vif_queues()
761 ieee80211_get_vif_queues(local, sdata), in ieee80211_wake_vif_queues()
765 static void __iterate_interfaces(struct ieee80211_local *local, in __iterate_interfaces() argument
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()
811 struct ieee80211_local *local = hw_to_local(hw); in ieee80211_iterate_interfaces() local
813 mutex_lock(&local->iflist_mtx); in ieee80211_iterate_interfaces()
814 __iterate_interfaces(local, iter_flags, iterator, data); in ieee80211_iterate_interfaces()
815 mutex_unlock(&local->iflist_mtx); in ieee80211_iterate_interfaces()
825 struct ieee80211_local *local = hw_to_local(hw); in ieee80211_iterate_active_interfaces_atomic() local
828 __iterate_interfaces(local, iter_flags | IEEE80211_IFACE_ITER_ACTIVE, in ieee80211_iterate_active_interfaces_atomic()
840 struct ieee80211_local *local = hw_to_local(hw); in ieee80211_iterate_active_interfaces_rtnl() local
844 __iterate_interfaces(local, iter_flags | IEEE80211_IFACE_ITER_ACTIVE, in ieee80211_iterate_active_interfaces_rtnl()
849 static void __iterate_stations(struct ieee80211_local *local, in __iterate_stations() argument
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()
869 struct ieee80211_local *local = hw_to_local(hw); in ieee80211_iterate_stations_atomic() local
872 __iterate_stations(local, iterator, data); in ieee80211_iterate_stations_atomic()
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
914 static bool ieee80211_can_queue_work(struct ieee80211_local *local) in ieee80211_can_queue_work() argument
916 if (local->quiescing || (local->suspended && !local->resuming)) { in ieee80211_can_queue_work()
926 struct ieee80211_local *local = hw_to_local(hw); in ieee80211_queue_work() local
928 if (!ieee80211_can_queue_work(local)) in ieee80211_queue_work()
931 queue_work(local->workqueue, work); in ieee80211_queue_work()
939 struct ieee80211_local *local = hw_to_local(hw); in ieee80211_queue_delayed_work() local
941 if (!ieee80211_can_queue_work(local)) in ieee80211_queue_delayed_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()
1494 if (elems->tim && !elems->parse_error) { in ieee802_11_parse_elems_crc()
1495 const struct ieee80211_tim_ie *tim_ie = elems->tim; in ieee802_11_parse_elems_crc()
1497 elems->dtim_period = tim_ie->dtim_period; in ieee802_11_parse_elems_crc()
1498 elems->dtim_count = tim_ie->dtim_count; in ieee802_11_parse_elems_crc()
1502 if (elems->bssid_index && in ieee802_11_parse_elems_crc()
1503 elems->bssid_index_len >= in ieee802_11_parse_elems_crc()
1505 elems->dtim_period = elems->bssid_index->dtim_period; 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_count = elems->bssid_index->dtim_count; in ieee802_11_parse_elems_crc()
1526 if (sdata->vif.type != NL80211_IFTYPE_AP && in ieee80211_regulatory_limit_wmm_params()
1527 sdata->vif.type != NL80211_IFTYPE_STATION) in ieee80211_regulatory_limit_wmm_params()
1531 chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); in ieee80211_regulatory_limit_wmm_params()
1533 center_freq = chanctx_conf->def.chan->center_freq; in ieee80211_regulatory_limit_wmm_params()
1540 rrule = freq_reg_info(sdata->wdev.wiphy, MHZ_TO_KHZ(center_freq)); in ieee80211_regulatory_limit_wmm_params()
1542 if (IS_ERR_OR_NULL(rrule) || !rrule->has_wmm) { in ieee80211_regulatory_limit_wmm_params()
1547 if (sdata->vif.type == NL80211_IFTYPE_AP) in ieee80211_regulatory_limit_wmm_params()
1548 wmm_ac = &rrule->wmm_rule.ap[ac]; in ieee80211_regulatory_limit_wmm_params()
1550 wmm_ac = &rrule->wmm_rule.client[ac]; in ieee80211_regulatory_limit_wmm_params()
1551 qparam->cw_min = max_t(u16, qparam->cw_min, wmm_ac->cw_min); in ieee80211_regulatory_limit_wmm_params()
1552 qparam->cw_max = max_t(u16, qparam->cw_max, wmm_ac->cw_max); in ieee80211_regulatory_limit_wmm_params()
1553 qparam->aifs = max_t(u8, qparam->aifs, wmm_ac->aifsn); in ieee80211_regulatory_limit_wmm_params()
1554 qparam->txop = min_t(u16, qparam->txop, wmm_ac->cot / 32); in ieee80211_regulatory_limit_wmm_params()
1561 struct ieee80211_local *local = sdata->local; in ieee80211_set_wmm_default() local
1569 if (!local->ops->conf_tx) in ieee80211_set_wmm_default()
1572 if (local->hw.queues < IEEE80211_NUM_ACS) in ieee80211_set_wmm_default()
1578 chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); in ieee80211_set_wmm_default()
1580 chanctx_conf->def.chan->band == NL80211_BAND_2GHZ) && in ieee80211_set_wmm_default()
1581 !(sdata->flags & IEEE80211_SDATA_OPERATING_GMODE); in ieee80211_set_wmm_default()
1584 is_ocb = (sdata->vif.type == NL80211_IFTYPE_OCB); in ieee80211_set_wmm_default()
1586 /* Set defaults according to 802.11-2007 Table 7-37 */ in ieee80211_set_wmm_default()
1625 qparam.cw_min = (aCWmin + 1) / 2 - 1; in ieee80211_set_wmm_default()
1639 qparam.cw_max = (aCWmin + 1) / 2 - 1; in ieee80211_set_wmm_default()
1640 qparam.cw_min = (aCWmin + 1) / 4 - 1; in ieee80211_set_wmm_default()
1655 sdata->tx_conf[ac] = qparam; in ieee80211_set_wmm_default()
1656 drv_conf_tx(local, sdata, ac, &qparam); in ieee80211_set_wmm_default()
1659 if (sdata->vif.type != NL80211_IFTYPE_MONITOR && in ieee80211_set_wmm_default()
1660 sdata->vif.type != NL80211_IFTYPE_P2P_DEVICE && in ieee80211_set_wmm_default()
1661 sdata->vif.type != NL80211_IFTYPE_NAN) { in ieee80211_set_wmm_default()
1662 sdata->vif.bss_conf.qos = enable_qos; in ieee80211_set_wmm_default()
1675 struct ieee80211_local *local = sdata->local; in ieee80211_send_auth() local
1681 skb = dev_alloc_skb(local->hw.extra_tx_headroom + IEEE80211_WEP_IV_LEN + in ieee80211_send_auth()
1686 skb_reserve(skb, local->hw.extra_tx_headroom + IEEE80211_WEP_IV_LEN); in ieee80211_send_auth()
1689 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | in ieee80211_send_auth()
1691 memcpy(mgmt->da, da, ETH_ALEN); in ieee80211_send_auth()
1692 memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); in ieee80211_send_auth()
1693 memcpy(mgmt->bssid, bssid, ETH_ALEN); in ieee80211_send_auth()
1694 mgmt->u.auth.auth_alg = cpu_to_le16(auth_alg); in ieee80211_send_auth()
1695 mgmt->u.auth.auth_transaction = cpu_to_le16(transaction); in ieee80211_send_auth()
1696 mgmt->u.auth.status_code = cpu_to_le16(status); in ieee80211_send_auth()
1701 mgmt->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); in ieee80211_send_auth()
1702 err = ieee80211_wep_encrypt(local, skb, key, key_len, key_idx); in ieee80211_send_auth()
1706 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT | in ieee80211_send_auth()
1716 struct ieee80211_local *local = sdata->local; in ieee80211_send_deauth_disassoc() local
1721 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | stype); in ieee80211_send_deauth_disassoc()
1722 mgmt->duration = 0; /* initialize only */ in ieee80211_send_deauth_disassoc()
1723 mgmt->seq_ctrl = 0; /* initialize only */ in ieee80211_send_deauth_disassoc()
1724 memcpy(mgmt->da, da, ETH_ALEN); in ieee80211_send_deauth_disassoc()
1725 memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); in ieee80211_send_deauth_disassoc()
1726 memcpy(mgmt->bssid, bssid, ETH_ALEN); in ieee80211_send_deauth_disassoc()
1728 mgmt->u.deauth.reason_code = cpu_to_le16(reason); in ieee80211_send_deauth_disassoc()
1731 skb = dev_alloc_skb(local->hw.extra_tx_headroom + in ieee80211_send_deauth_disassoc()
1736 skb_reserve(skb, local->hw.extra_tx_headroom); in ieee80211_send_deauth_disassoc()
1741 if (sdata->vif.type != NL80211_IFTYPE_STATION || in ieee80211_send_deauth_disassoc()
1742 !(sdata->u.mgd.flags & IEEE80211_STA_MFP_ENABLED)) in ieee80211_send_deauth_disassoc()
1743 IEEE80211_SKB_CB(skb)->flags |= in ieee80211_send_deauth_disassoc()
1750 static u8 *ieee80211_write_he_6ghz_cap(u8 *pos, __le16 cap, u8 *end) in ieee80211_write_he_6ghz_cap() argument
1752 if ((end - pos) < 5) in ieee80211_write_he_6ghz_cap()
1756 *pos++ = 1 + sizeof(cap); in ieee80211_write_he_6ghz_cap()
1758 memcpy(pos, &cap, sizeof(cap)); in ieee80211_write_he_6ghz_cap()
1771 struct ieee80211_local *local = sdata->local; in ieee80211_build_preq_ies_band() local
1786 sband = local->hw.wiphy->bands[band]; in ieee80211_build_preq_ies_band()
1794 for (i = 0; i < sband->n_bitrates; i++) { in ieee80211_build_preq_ies_band()
1797 if ((rate_flags & sband->bitrates[i].flags) != rate_flags) in ieee80211_build_preq_ies_band()
1801 (u8) DIV_ROUND_UP(sband->bitrates[i].bitrate, in ieee80211_build_preq_ies_band()
1807 if (end - pos < 2 + supp_rates_len) in ieee80211_build_preq_ies_band()
1825 if (end - pos < noffset - *offset) in ieee80211_build_preq_ies_band()
1827 memcpy(pos, ie + *offset, noffset - *offset); in ieee80211_build_preq_ies_band()
1828 pos += noffset - *offset; in ieee80211_build_preq_ies_band()
1832 ext_rates_len = num_rates - supp_rates_len; in ieee80211_build_preq_ies_band()
1834 if (end - pos < 2 + ext_rates_len) in ieee80211_build_preq_ies_band()
1842 if (chandef->chan && sband->band == NL80211_BAND_2GHZ) { in ieee80211_build_preq_ies_band()
1843 if (end - pos < 3) in ieee80211_build_preq_ies_band()
1848 chandef->chan->center_freq); in ieee80211_build_preq_ies_band()
1867 if (end - pos < noffset - *offset) in ieee80211_build_preq_ies_band()
1869 memcpy(pos, ie + *offset, noffset - *offset); in ieee80211_build_preq_ies_band()
1870 pos += noffset - *offset; in ieee80211_build_preq_ies_band()
1874 if (sband->ht_cap.ht_supported) { in ieee80211_build_preq_ies_band()
1875 if (end - pos < 2 + sizeof(struct ieee80211_ht_cap)) in ieee80211_build_preq_ies_band()
1877 pos = ieee80211_ie_build_ht_cap(pos, &sband->ht_cap, in ieee80211_build_preq_ies_band()
1878 sband->ht_cap.cap); in ieee80211_build_preq_ies_band()
1894 /* 60 GHz (Multi-band, DMG, MMS) can't happen */ in ieee80211_build_preq_ies_band()
1899 if (end - pos < noffset - *offset) in ieee80211_build_preq_ies_band()
1901 memcpy(pos, ie + *offset, noffset - *offset); in ieee80211_build_preq_ies_band()
1902 pos += noffset - *offset; in ieee80211_build_preq_ies_band()
1907 for (i = 0; i < sband->n_channels; i++) { in ieee80211_build_preq_ies_band()
1908 if (sband->channels[i].flags & (IEEE80211_CHAN_DISABLED | in ieee80211_build_preq_ies_band()
1916 if (sband->vht_cap.vht_supported && have_80mhz) { in ieee80211_build_preq_ies_band()
1917 if (end - pos < 2 + sizeof(struct ieee80211_vht_cap)) in ieee80211_build_preq_ies_band()
1919 pos = ieee80211_ie_build_vht_cap(pos, &sband->vht_cap, in ieee80211_build_preq_ies_band()
1920 sband->vht_cap.cap); in ieee80211_build_preq_ies_band()
1937 if (end - pos < noffset - *offset) in ieee80211_build_preq_ies_band()
1939 memcpy(pos, ie + *offset, noffset - *offset); in ieee80211_build_preq_ies_band()
1940 pos += noffset - *offset; in ieee80211_build_preq_ies_band()
1950 if (sband->band == NL80211_BAND_6GHZ) { in ieee80211_build_preq_ies_band()
1952 ieee80211_vif_type_p2p(&sdata->vif); in ieee80211_build_preq_ies_band()
1953 __le16 cap = ieee80211_get_he_6ghz_capa(sband, iftype); in ieee80211_build_preq_ies_band() local
1955 pos = ieee80211_write_he_6ghz_cap(pos, cap, end); in ieee80211_build_preq_ies_band()
1961 * that calculates local->scan_ies_len. in ieee80211_build_preq_ies_band()
1964 return pos - buffer; in ieee80211_build_preq_ies_band()
1968 return pos - buffer; in ieee80211_build_preq_ies_band()
1988 buffer_len - pos, in ieee80211_build_preq_ies()
1994 ie_desc->ies[i] = buffer + old_pos; in ieee80211_build_preq_ies()
1995 ie_desc->len[i] = pos - old_pos; in ieee80211_build_preq_ies()
2002 if (WARN_ONCE(buffer_len - pos < ie_len - custom_ie_offset, in ieee80211_build_preq_ies()
2006 ie_len - custom_ie_offset); in ieee80211_build_preq_ies()
2007 ie_desc->common_ies = buffer + pos; in ieee80211_build_preq_ies()
2008 ie_desc->common_ie_len = ie_len - custom_ie_offset; in ieee80211_build_preq_ies()
2009 pos += ie_len - custom_ie_offset; in ieee80211_build_preq_ies()
2023 struct ieee80211_local *local = sdata->local; in ieee80211_build_probe_req() local
2034 * badly-behaved APs don't respond when this parameter is included. in ieee80211_build_probe_req()
2036 chandef.width = sdata->vif.bss_conf.chandef.width; in ieee80211_build_probe_req()
2042 skb = ieee80211_probereq_get(&local->hw, src, ssid, ssid_len, in ieee80211_build_probe_req()
2047 rate_masks[chan->band] = ratemask; in ieee80211_build_probe_req()
2050 ie, ie_len, BIT(chan->band), in ieee80211_build_probe_req()
2055 mgmt = (struct ieee80211_mgmt *) skb->data; in ieee80211_build_probe_req()
2056 memcpy(mgmt->da, dst, ETH_ALEN); in ieee80211_build_probe_req()
2057 memcpy(mgmt->bssid, dst, ETH_ALEN); in ieee80211_build_probe_req()
2060 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; in ieee80211_build_probe_req()
2074 sband = sdata->local->hw.wiphy->bands[band]; in ieee80211_sta_get_rates()
2078 rate_flags = ieee80211_chandef_rate_flags(&sdata->vif.bss_conf.chandef); in ieee80211_sta_get_rates()
2079 shift = ieee80211_vif_get_shift(&sdata->vif); in ieee80211_sta_get_rates()
2081 num_rates = sband->n_bitrates; in ieee80211_sta_get_rates()
2083 for (i = 0; i < elems->supp_rates_len + in ieee80211_sta_get_rates()
2084 elems->ext_supp_rates_len; i++) { in ieee80211_sta_get_rates()
2088 if (i < elems->supp_rates_len) in ieee80211_sta_get_rates()
2089 rate = elems->supp_rates[i]; in ieee80211_sta_get_rates()
2090 else if (elems->ext_supp_rates) in ieee80211_sta_get_rates()
2091 rate = elems->ext_supp_rates in ieee80211_sta_get_rates()
2092 [i - elems->supp_rates_len]; in ieee80211_sta_get_rates()
2101 if ((rate_flags & sband->bitrates[j].flags) in ieee80211_sta_get_rates()
2105 brate = DIV_ROUND_UP(sband->bitrates[j].bitrate, in ieee80211_sta_get_rates()
2118 void ieee80211_stop_device(struct ieee80211_local *local) in ieee80211_stop_device() argument
2120 ieee80211_led_radio(local, false); in ieee80211_stop_device()
2121 ieee80211_mod_tpt_led_trig(local, 0, IEEE80211_TPT_LEDTRIG_FL_RADIO); in ieee80211_stop_device()
2123 cancel_work_sync(&local->reconfig_filter); in ieee80211_stop_device()
2125 flush_workqueue(local->workqueue); in ieee80211_stop_device()
2126 drv_stop(local); in ieee80211_stop_device()
2129 static void ieee80211_flush_completed_scan(struct ieee80211_local *local, in ieee80211_flush_completed_scan() argument
2139 if (test_bit(SCAN_COMPLETED, &local->scanning)) { in ieee80211_flush_completed_scan()
2141 * we don't attempt to continue a partial HW scan - which is in ieee80211_flush_completed_scan()
2146 set_bit(SCAN_ABORTED, &local->scanning); in ieee80211_flush_completed_scan()
2147 ieee80211_queue_delayed_work(&local->hw, &local->scan_work, 0); in ieee80211_flush_completed_scan()
2148 flush_delayed_work(&local->scan_work); in ieee80211_flush_completed_scan()
2152 static void ieee80211_handle_reconfig_failure(struct ieee80211_local *local) in ieee80211_handle_reconfig_failure() argument
2167 local->resuming = false; in ieee80211_handle_reconfig_failure()
2168 local->suspended = false; in ieee80211_handle_reconfig_failure()
2169 local->in_reconfig = false; in ieee80211_handle_reconfig_failure()
2171 ieee80211_flush_completed_scan(local, true); in ieee80211_handle_reconfig_failure()
2174 * cfg80211 and clear local state in ieee80211_handle_reconfig_failure()
2176 ieee80211_sched_scan_end(local); in ieee80211_handle_reconfig_failure()
2178 list_for_each_entry(sdata, &local->interfaces, list) in ieee80211_handle_reconfig_failure()
2179 sdata->flags &= ~IEEE80211_SDATA_IN_DRIVER; in ieee80211_handle_reconfig_failure()
2184 mutex_lock(&local->chanctx_mtx); in ieee80211_handle_reconfig_failure()
2185 list_for_each_entry(ctx, &local->chanctx_list, list) in ieee80211_handle_reconfig_failure()
2186 ctx->driver_present = false; in ieee80211_handle_reconfig_failure()
2187 mutex_unlock(&local->chanctx_mtx); in ieee80211_handle_reconfig_failure()
2189 cfg80211_shutdown_all_interfaces(local->hw.wiphy); in ieee80211_handle_reconfig_failure()
2192 static void ieee80211_assign_chanctx(struct ieee80211_local *local, in ieee80211_assign_chanctx() argument
2198 if (!local->use_chanctx) in ieee80211_assign_chanctx()
2201 mutex_lock(&local->chanctx_mtx); in ieee80211_assign_chanctx()
2202 conf = rcu_dereference_protected(sdata->vif.chanctx_conf, in ieee80211_assign_chanctx()
2203 lockdep_is_held(&local->chanctx_mtx)); in ieee80211_assign_chanctx()
2206 drv_assign_vif_chanctx(local, sdata, ctx); in ieee80211_assign_chanctx()
2208 mutex_unlock(&local->chanctx_mtx); in ieee80211_assign_chanctx()
2213 struct ieee80211_local *local = sdata->local; in ieee80211_reconfig_stations() local
2217 mutex_lock(&local->sta_mtx); in ieee80211_reconfig_stations()
2218 list_for_each_entry(sta, &local->sta_list, list) { in ieee80211_reconfig_stations()
2221 if (!sta->uploaded || sta->sdata != sdata) in ieee80211_reconfig_stations()
2225 state < sta->sta_state; state++) in ieee80211_reconfig_stations()
2226 WARN_ON(drv_sta_state(local, sta->sdata, sta, state, in ieee80211_reconfig_stations()
2229 mutex_unlock(&local->sta_mtx); in ieee80211_reconfig_stations()
2237 res = drv_start_nan(sdata->local, sdata, in ieee80211_reconfig_nan()
2238 &sdata->u.nan.conf); in ieee80211_reconfig_nan()
2242 funcs = kcalloc(sdata->local->hw.max_nan_de_entries + 1, in ieee80211_reconfig_nan()
2246 return -ENOMEM; in ieee80211_reconfig_nan()
2252 spin_lock_bh(&sdata->u.nan.func_lock); in ieee80211_reconfig_nan()
2254 idr_for_each_entry(&sdata->u.nan.function_inst_ids, func, id) in ieee80211_reconfig_nan()
2257 spin_unlock_bh(&sdata->u.nan.func_lock); in ieee80211_reconfig_nan()
2260 res = drv_add_nan_func(sdata->local, sdata, funcs[i]); in ieee80211_reconfig_nan()
2262 ieee80211_nan_func_terminated(&sdata->vif, in ieee80211_reconfig_nan()
2263 funcs[i]->instance_id, in ieee80211_reconfig_nan()
2273 int ieee80211_reconfig(struct ieee80211_local *local) in ieee80211_reconfig() argument
2275 struct ieee80211_hw *hw = &local->hw; in ieee80211_reconfig()
2284 bool suspended = local->suspended; in ieee80211_reconfig()
2287 if (!local->open_count) in ieee80211_reconfig()
2292 local->resuming = true; in ieee80211_reconfig()
2294 if (local->wowlan) { in ieee80211_reconfig()
2298 * clear local->suspended so the device could operate in ieee80211_reconfig()
2301 local->suspended = false; in ieee80211_reconfig()
2302 res = drv_resume(local); in ieee80211_reconfig()
2303 local->wowlan = false; in ieee80211_reconfig()
2305 local->resuming = false; in ieee80211_reconfig()
2314 * restore local->suspended in this case. in ieee80211_reconfig()
2317 local->suspended = true; in ieee80211_reconfig()
2328 if (suspended && local->in_reconfig && !reconfig_due_to_wowlan) in ieee80211_reconfig()
2329 cancel_work_sync(&local->restart_work); in ieee80211_reconfig()
2331 local->started = false; in ieee80211_reconfig()
2339 res = drv_start(local); in ieee80211_reconfig()
2345 ieee80211_handle_reconfig_failure(local); in ieee80211_reconfig()
2350 drv_set_frag_threshold(local, hw->wiphy->frag_threshold); in ieee80211_reconfig()
2353 drv_set_rts_threshold(local, hw->wiphy->rts_threshold); in ieee80211_reconfig()
2356 drv_set_coverage_class(local, hw->wiphy->coverage_class); in ieee80211_reconfig()
2358 ieee80211_led_radio(local, true); in ieee80211_reconfig()
2359 ieee80211_mod_tpt_led_trig(local, in ieee80211_reconfig()
2363 sdata = rtnl_dereference(local->monitor_sdata); in ieee80211_reconfig()
2366 WARN_ON(local->resuming); in ieee80211_reconfig()
2367 res = drv_add_interface(local, sdata); in ieee80211_reconfig()
2369 RCU_INIT_POINTER(local->monitor_sdata, NULL); in ieee80211_reconfig()
2375 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_reconfig()
2376 if (sdata->vif.type != NL80211_IFTYPE_AP_VLAN && in ieee80211_reconfig()
2377 sdata->vif.type != NL80211_IFTYPE_MONITOR && in ieee80211_reconfig()
2379 res = drv_add_interface(local, sdata); in ieee80211_reconfig()
2389 list_for_each_entry_continue_reverse(sdata, &local->interfaces, in ieee80211_reconfig()
2391 if (sdata->vif.type != NL80211_IFTYPE_AP_VLAN && in ieee80211_reconfig()
2392 sdata->vif.type != NL80211_IFTYPE_MONITOR && in ieee80211_reconfig()
2394 drv_remove_interface(local, sdata); in ieee80211_reconfig()
2395 ieee80211_handle_reconfig_failure(local); in ieee80211_reconfig()
2400 if (local->use_chanctx) { in ieee80211_reconfig()
2401 mutex_lock(&local->chanctx_mtx); in ieee80211_reconfig()
2402 list_for_each_entry(ctx, &local->chanctx_list, list) in ieee80211_reconfig()
2403 if (ctx->replace_state != in ieee80211_reconfig()
2405 WARN_ON(drv_add_chanctx(local, ctx)); in ieee80211_reconfig()
2406 mutex_unlock(&local->chanctx_mtx); in ieee80211_reconfig()
2408 sdata = rtnl_dereference(local->monitor_sdata); in ieee80211_reconfig()
2410 ieee80211_assign_chanctx(local, sdata); in ieee80211_reconfig()
2414 ieee80211_hw_config(local, ~0); in ieee80211_reconfig()
2416 ieee80211_configure_filter(local); in ieee80211_reconfig()
2419 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_reconfig()
2425 ieee80211_assign_chanctx(local, sdata); in ieee80211_reconfig()
2427 switch (sdata->vif.type) { in ieee80211_reconfig()
2432 if (sdata->vif.bss_conf.ibss_joined) in ieee80211_reconfig()
2433 WARN_ON(drv_join_ibss(local, sdata)); in ieee80211_reconfig()
2440 drv_conf_tx(local, sdata, i, in ieee80211_reconfig()
2441 &sdata->tx_conf[i]); in ieee80211_reconfig()
2459 if (sdata->vif.mu_mimo_owner) in ieee80211_reconfig()
2462 switch (sdata->vif.type) { in ieee80211_reconfig()
2468 /* Re-send beacon info report to the driver */ in ieee80211_reconfig()
2469 if (sdata->u.mgd.have_beacon) in ieee80211_reconfig()
2472 if (sdata->vif.bss_conf.max_idle_period || in ieee80211_reconfig()
2473 sdata->vif.bss_conf.protected_keep_alive) in ieee80211_reconfig()
2490 if (sdata->vif.bss_conf.ftm_responder == 1 && in ieee80211_reconfig()
2491 wiphy_ext_feature_isset(sdata->local->hw.wiphy, in ieee80211_reconfig()
2495 if (sdata->vif.type == NL80211_IFTYPE_AP) { in ieee80211_reconfig()
2498 if (rcu_access_pointer(sdata->u.ap.beacon)) in ieee80211_reconfig()
2499 drv_start_ap(local, sdata); in ieee80211_reconfig()
2503 if (sdata->vif.bss_conf.enable_beacon) { in ieee80211_reconfig()
2512 ieee80211_handle_reconfig_failure(local); in ieee80211_reconfig()
2531 ieee80211_recalc_ps(local); in ieee80211_reconfig()
2539 if (!(local->hw.conf.flags & IEEE80211_CONF_PS)) { in ieee80211_reconfig()
2540 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_reconfig()
2541 if (sdata->vif.type != NL80211_IFTYPE_STATION) in ieee80211_reconfig()
2543 if (!sdata->u.mgd.associated) in ieee80211_reconfig()
2546 ieee80211_send_nullfunc(local, sdata, false); in ieee80211_reconfig()
2551 mutex_lock(&local->sta_mtx); in ieee80211_reconfig()
2552 list_for_each_entry(sta, &local->sta_list, list) { in ieee80211_reconfig()
2555 if (!sta->uploaded) in ieee80211_reconfig()
2558 if (sta->sdata->vif.type != NL80211_IFTYPE_AP && in ieee80211_reconfig()
2559 sta->sdata->vif.type != NL80211_IFTYPE_AP_VLAN) in ieee80211_reconfig()
2563 state < sta->sta_state; state++) in ieee80211_reconfig()
2564 WARN_ON(drv_sta_state(local, sta->sdata, sta, state, in ieee80211_reconfig()
2567 mutex_unlock(&local->sta_mtx); in ieee80211_reconfig()
2570 list_for_each_entry(sdata, &local->interfaces, list) in ieee80211_reconfig()
2574 mutex_lock(&local->mtx); in ieee80211_reconfig()
2575 sched_scan_sdata = rcu_dereference_protected(local->sched_scan_sdata, in ieee80211_reconfig()
2576 lockdep_is_held(&local->mtx)); in ieee80211_reconfig()
2577 sched_scan_req = rcu_dereference_protected(local->sched_scan_req, in ieee80211_reconfig()
2578 lockdep_is_held(&local->mtx)); in ieee80211_reconfig()
2587 if (sched_scan_req->n_scan_plans > 1 || in ieee80211_reconfig()
2590 RCU_INIT_POINTER(local->sched_scan_sdata, NULL); in ieee80211_reconfig()
2591 RCU_INIT_POINTER(local->sched_scan_req, NULL); in ieee80211_reconfig()
2594 mutex_unlock(&local->mtx); in ieee80211_reconfig()
2597 cfg80211_sched_scan_stopped_rtnl(local->hw.wiphy, 0); in ieee80211_reconfig()
2601 if (local->monitors == local->open_count && local->monitors > 0) in ieee80211_reconfig()
2602 ieee80211_add_virtual_monitor(local); in ieee80211_reconfig()
2615 mutex_lock(&local->sta_mtx); in ieee80211_reconfig()
2617 list_for_each_entry(sta, &local->sta_list, list) { in ieee80211_reconfig()
2618 if (!local->resuming) in ieee80211_reconfig()
2624 mutex_unlock(&local->sta_mtx); in ieee80211_reconfig()
2627 if (local->in_reconfig) { in ieee80211_reconfig()
2628 local->in_reconfig = false; in ieee80211_reconfig()
2632 mutex_lock(&local->mtx); in ieee80211_reconfig()
2633 ieee80211_start_next_roc(local); in ieee80211_reconfig()
2634 mutex_unlock(&local->mtx); in ieee80211_reconfig()
2637 list_for_each_entry(sdata, &local->interfaces, list) in ieee80211_reconfig()
2638 ieee80211_queue_work(&local->hw, &sdata->work); in ieee80211_reconfig()
2649 if (local->open_count && (!suspended || reconfig_due_to_wowlan)) in ieee80211_reconfig()
2650 drv_reconfig_complete(local, IEEE80211_RECONFIG_TYPE_RESTART); in ieee80211_reconfig()
2657 local->suspended = false; in ieee80211_reconfig()
2659 local->resuming = false; in ieee80211_reconfig()
2661 ieee80211_flush_completed_scan(local, false); in ieee80211_reconfig()
2663 if (local->open_count && !reconfig_due_to_wowlan) in ieee80211_reconfig()
2664 drv_reconfig_complete(local, IEEE80211_RECONFIG_TYPE_SUSPEND); in ieee80211_reconfig()
2666 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_reconfig()
2669 if (sdata->vif.type == NL80211_IFTYPE_STATION) in ieee80211_reconfig()
2673 mod_timer(&local->sta_cleanup, jiffies + 1); in ieee80211_reconfig()
2684 struct ieee80211_local *local; in ieee80211_resume_disconnect() local
2691 local = sdata->local; in ieee80211_resume_disconnect()
2693 if (WARN_ON(!local->resuming)) in ieee80211_resume_disconnect()
2696 if (WARN_ON(vif->type != NL80211_IFTYPE_STATION)) in ieee80211_resume_disconnect()
2699 sdata->flags |= IEEE80211_SDATA_DISCONNECT_RESUME; in ieee80211_resume_disconnect()
2701 mutex_lock(&local->key_mtx); in ieee80211_resume_disconnect()
2702 list_for_each_entry(key, &sdata->key_list, list) in ieee80211_resume_disconnect()
2703 key->flags |= KEY_FLAG_TAINTED; in ieee80211_resume_disconnect()
2704 mutex_unlock(&local->key_mtx); in ieee80211_resume_disconnect()
2710 struct ieee80211_local *local = sdata->local; in ieee80211_recalc_smps() local
2714 mutex_lock(&local->chanctx_mtx); in ieee80211_recalc_smps()
2716 chanctx_conf = rcu_dereference_protected(sdata->vif.chanctx_conf, in ieee80211_recalc_smps()
2717 lockdep_is_held(&local->chanctx_mtx)); in ieee80211_recalc_smps()
2729 ieee80211_recalc_smps_chanctx(local, chanctx); in ieee80211_recalc_smps()
2731 mutex_unlock(&local->chanctx_mtx); in ieee80211_recalc_smps()
2736 struct ieee80211_local *local = sdata->local; in ieee80211_recalc_min_chandef() local
2740 mutex_lock(&local->chanctx_mtx); in ieee80211_recalc_min_chandef()
2742 chanctx_conf = rcu_dereference_protected(sdata->vif.chanctx_conf, in ieee80211_recalc_min_chandef()
2743 lockdep_is_held(&local->chanctx_mtx)); in ieee80211_recalc_min_chandef()
2749 ieee80211_recalc_chanctx_min_def(local, chanctx); in ieee80211_recalc_min_chandef()
2751 mutex_unlock(&local->chanctx_mtx); in ieee80211_recalc_min_chandef()
2770 if (WARN_ON(sdata->vif.type != NL80211_IFTYPE_STATION)) in _ieee80211_enable_rssi_reports()
2778 sdata->u.mgd.rssi_min_thold = rssi_min_thold*16; in _ieee80211_enable_rssi_reports()
2779 sdata->u.mgd.rssi_max_thold = rssi_max_thold*16; in _ieee80211_enable_rssi_reports()
2805 u16 cap) in ieee80211_ie_build_ht_cap() argument
2814 tmp = cpu_to_le16(cap); in ieee80211_ie_build_ht_cap()
2819 *pos++ = ht_cap->ampdu_factor | in ieee80211_ie_build_ht_cap()
2820 (ht_cap->ampdu_density << in ieee80211_ie_build_ht_cap()
2824 memcpy(pos, &ht_cap->mcs, sizeof(ht_cap->mcs)); in ieee80211_ie_build_ht_cap()
2825 pos += sizeof(ht_cap->mcs); in ieee80211_ie_build_ht_cap()
2840 u32 cap) in ieee80211_ie_build_vht_cap() argument
2849 tmp = cpu_to_le32(cap); in ieee80211_ie_build_vht_cap()
2854 memcpy(pos, &vht_cap->vht_mcs, sizeof(vht_cap->vht_mcs)); in ieee80211_ie_build_vht_cap()
2855 pos += sizeof(vht_cap->vht_mcs); in ieee80211_ie_build_vht_cap()
2874 n = ieee80211_he_mcs_nss_size(&he_cap->he_cap_elem); in ieee80211_ie_len_he_cap()
2876 sizeof(he_cap->he_cap_elem) + n + in ieee80211_ie_len_he_cap()
2877 ieee80211_he_ppe_size(he_cap->ppe_thres[0], in ieee80211_ie_len_he_cap()
2878 he_cap->he_cap_elem.phy_cap_info); in ieee80211_ie_len_he_cap()
2897 n = ieee80211_he_mcs_nss_size(&he_cap->he_cap_elem); in ieee80211_ie_build_he_cap()
2899 sizeof(he_cap->he_cap_elem) + n + in ieee80211_ie_build_he_cap()
2900 ieee80211_he_ppe_size(he_cap->ppe_thres[0], in ieee80211_ie_build_he_cap()
2901 he_cap->he_cap_elem.phy_cap_info); in ieee80211_ie_build_he_cap()
2903 if ((end - pos) < ie_len) in ieee80211_ie_build_he_cap()
2907 pos++; /* We'll set the size later below */ in ieee80211_ie_build_he_cap()
2911 memcpy(pos, &he_cap->he_cap_elem, sizeof(he_cap->he_cap_elem)); in ieee80211_ie_build_he_cap()
2912 pos += sizeof(he_cap->he_cap_elem); in ieee80211_ie_build_he_cap()
2914 memcpy(pos, &he_cap->he_mcs_nss_supp, n); in ieee80211_ie_build_he_cap()
2918 if ((he_cap->he_cap_elem.phy_cap_info[6] & in ieee80211_ie_build_he_cap()
2926 n = hweight8(he_cap->ppe_thres[0] & in ieee80211_ie_build_he_cap()
2928 n *= (1 + ((he_cap->ppe_thres[0] & IEEE80211_PPE_THRES_NSS_MASK) >> in ieee80211_ie_build_he_cap()
2933 * total size. in ieee80211_ie_build_he_cap()
2939 memcpy(pos, &he_cap->ppe_thres, n); in ieee80211_ie_build_he_cap()
2943 orig_pos[1] = (pos - orig_pos) - 2; in ieee80211_ie_build_he_cap()
2952 enum nl80211_iftype iftype = ieee80211_vif_type_p2p(&sdata->vif); in ieee80211_ie_build_he_6ghz_cap()
2954 u16 cap; in ieee80211_ie_build_he_6ghz_cap() local
2965 if (!iftd->he_6ghz_capa.capa) in ieee80211_ie_build_he_6ghz_cap()
2968 cap = le16_to_cpu(iftd->he_6ghz_capa.capa); in ieee80211_ie_build_he_6ghz_cap()
2969 cap &= ~IEEE80211_HE_6GHZ_CAP_SM_PS; in ieee80211_ie_build_he_6ghz_cap()
2971 switch (sdata->smps_mode) { in ieee80211_ie_build_he_6ghz_cap()
2977 cap |= u16_encode_bits(WLAN_HT_CAP_SM_PS_DISABLED, in ieee80211_ie_build_he_6ghz_cap()
2981 cap |= u16_encode_bits(WLAN_HT_CAP_SM_PS_STATIC, in ieee80211_ie_build_he_6ghz_cap()
2985 cap |= u16_encode_bits(WLAN_HT_CAP_SM_PS_DYNAMIC, in ieee80211_ie_build_he_6ghz_cap()
2990 pos = skb_put(skb, 2 + 1 + sizeof(cap)); in ieee80211_ie_build_he_6ghz_cap()
2991 ieee80211_write_he_6ghz_cap(pos, cpu_to_le16(cap), in ieee80211_ie_build_he_6ghz_cap()
2992 pos + 2 + 1 + sizeof(cap)); in ieee80211_ie_build_he_6ghz_cap()
3004 ht_oper->primary_chan = ieee80211_frequency_to_channel( in ieee80211_ie_build_ht_oper()
3005 chandef->chan->center_freq); in ieee80211_ie_build_ht_oper()
3006 switch (chandef->width) { in ieee80211_ie_build_ht_oper()
3011 if (chandef->center_freq1 > chandef->chan->center_freq) in ieee80211_ie_build_ht_oper()
3012 ht_oper->ht_param = IEEE80211_HT_PARAM_CHA_SEC_ABOVE; in ieee80211_ie_build_ht_oper()
3014 ht_oper->ht_param = IEEE80211_HT_PARAM_CHA_SEC_BELOW; in ieee80211_ie_build_ht_oper()
3017 ht_oper->ht_param = IEEE80211_HT_PARAM_CHA_SEC_NONE; in ieee80211_ie_build_ht_oper()
3020 if (ht_cap->cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40 && in ieee80211_ie_build_ht_oper()
3021 chandef->width != NL80211_CHAN_WIDTH_20_NOHT && in ieee80211_ie_build_ht_oper()
3022 chandef->width != NL80211_CHAN_WIDTH_20) in ieee80211_ie_build_ht_oper()
3023 ht_oper->ht_param |= IEEE80211_HT_PARAM_CHAN_WIDTH_ANY; in ieee80211_ie_build_ht_oper()
3026 ht_oper->ht_param |= IEEE80211_HT_PARAM_RIFS_MODE; in ieee80211_ie_build_ht_oper()
3028 ht_oper->operation_mode = cpu_to_le16(prot_mode); in ieee80211_ie_build_ht_oper()
3029 ht_oper->stbc_param = 0x0000; in ieee80211_ie_build_ht_oper()
3033 memset(&ht_oper->basic_set, 0, 16); in ieee80211_ie_build_ht_oper()
3034 memcpy(&ht_oper->basic_set, &ht_cap->mcs, 10); in ieee80211_ie_build_ht_oper()
3045 switch (chandef->width) { in ieee80211_ie_build_wide_bw_cs()
3060 *pos++ = ieee80211_frequency_to_channel(chandef->center_freq1); in ieee80211_ie_build_wide_bw_cs()
3062 if (chandef->center_freq2) in ieee80211_ie_build_wide_bw_cs()
3063 *pos++ = ieee80211_frequency_to_channel(chandef->center_freq2); in ieee80211_ie_build_wide_bw_cs()
3076 vht_oper->center_freq_seg0_idx = ieee80211_frequency_to_channel( in ieee80211_ie_build_vht_oper()
3077 chandef->center_freq1); in ieee80211_ie_build_vht_oper()
3078 if (chandef->center_freq2) in ieee80211_ie_build_vht_oper()
3079 vht_oper->center_freq_seg1_idx = in ieee80211_ie_build_vht_oper()
3080 ieee80211_frequency_to_channel(chandef->center_freq2); in ieee80211_ie_build_vht_oper()
3082 vht_oper->center_freq_seg1_idx = 0x00; in ieee80211_ie_build_vht_oper()
3084 switch (chandef->width) { in ieee80211_ie_build_vht_oper()
3090 vht_oper->chan_width = IEEE80211_VHT_CHANWIDTH_80MHZ; in ieee80211_ie_build_vht_oper()
3091 vht_oper->center_freq_seg1_idx = vht_oper->center_freq_seg0_idx; in ieee80211_ie_build_vht_oper()
3092 if (chandef->chan->center_freq < chandef->center_freq1) in ieee80211_ie_build_vht_oper()
3093 vht_oper->center_freq_seg0_idx -= 8; in ieee80211_ie_build_vht_oper()
3095 vht_oper->center_freq_seg0_idx += 8; in ieee80211_ie_build_vht_oper()
3102 vht_oper->chan_width = IEEE80211_VHT_CHANWIDTH_80MHZ; in ieee80211_ie_build_vht_oper()
3105 vht_oper->chan_width = IEEE80211_VHT_CHANWIDTH_80MHZ; in ieee80211_ie_build_vht_oper()
3108 vht_oper->chan_width = IEEE80211_VHT_CHANWIDTH_USE_HT; in ieee80211_ie_build_vht_oper()
3113 vht_oper->basic_mcs_set = cpu_to_le16(0xffff); in ieee80211_ie_build_vht_oper()
3125 if (chandef->chan->band == NL80211_BAND_6GHZ) in ieee80211_ie_build_he_oper()
3139 if (chandef->chan->band == NL80211_BAND_6GHZ) in ieee80211_ie_build_he_oper()
3144 he_oper->he_oper_params = cpu_to_le32(he_oper_params); in ieee80211_ie_build_he_oper()
3147 he_oper->he_mcs_nss_set = cpu_to_le16(0xffff); in ieee80211_ie_build_he_oper()
3150 if (chandef->chan->band != NL80211_BAND_6GHZ) in ieee80211_ie_build_he_oper()
3155 he_6ghz_op->minrate = 6; /* 6 Mbps */ in ieee80211_ie_build_he_oper()
3156 he_6ghz_op->primary = in ieee80211_ie_build_he_oper()
3157 ieee80211_frequency_to_channel(chandef->chan->center_freq); in ieee80211_ie_build_he_oper()
3158 he_6ghz_op->ccfs0 = in ieee80211_ie_build_he_oper()
3159 ieee80211_frequency_to_channel(chandef->center_freq1); in ieee80211_ie_build_he_oper()
3160 if (chandef->center_freq2) in ieee80211_ie_build_he_oper()
3161 he_6ghz_op->ccfs1 = in ieee80211_ie_build_he_oper()
3162 ieee80211_frequency_to_channel(chandef->center_freq2); in ieee80211_ie_build_he_oper()
3164 he_6ghz_op->ccfs1 = 0; in ieee80211_ie_build_he_oper()
3166 switch (chandef->width) { in ieee80211_ie_build_he_oper()
3171 he_6ghz_op->control = in ieee80211_ie_build_he_oper()
3173 he_6ghz_op->ccfs1 = he_6ghz_op->ccfs0; in ieee80211_ie_build_he_oper()
3174 if (chandef->chan->center_freq < chandef->center_freq1) in ieee80211_ie_build_he_oper()
3175 he_6ghz_op->ccfs0 -= 8; in ieee80211_ie_build_he_oper()
3177 he_6ghz_op->ccfs0 += 8; in ieee80211_ie_build_he_oper()
3180 he_6ghz_op->control = in ieee80211_ie_build_he_oper()
3184 he_6ghz_op->control = in ieee80211_ie_build_he_oper()
3188 he_6ghz_op->control = in ieee80211_ie_build_he_oper()
3192 he_6ghz_op->control = in ieee80211_ie_build_he_oper()
3211 switch (ht_oper->ht_param & IEEE80211_HT_PARAM_CHA_SEC_OFFSET) { in ieee80211_chandef_ht_oper()
3226 cfg80211_chandef_create(chandef, chandef->chan, channel_type); in ieee80211_chandef_ht_oper()
3250 vht_cap = hw->wiphy->bands[chandef->chan->band]->vht_cap.cap; in ieee80211_chandef_vht_oper()
3259 ccfs0 = oper->center_freq_seg0_idx; in ieee80211_chandef_vht_oper()
3260 ccfs1 = oper->center_freq_seg1_idx; in ieee80211_chandef_vht_oper()
3261 ccfs2 = (le16_to_cpu(htop->operation_mode) & in ieee80211_chandef_vht_oper()
3272 * Cf. IEEE 802.11 Table 9-250 in ieee80211_chandef_vht_oper()
3308 cf0 = ieee80211_channel_to_frequency(ccf0, chandef->chan->band); in ieee80211_chandef_vht_oper()
3309 cf1 = ieee80211_channel_to_frequency(ccf1, chandef->chan->band); in ieee80211_chandef_vht_oper()
3311 switch (oper->chan_width) { in ieee80211_chandef_vht_oper()
3322 diff = abs(ccf1 - ccf0); in ieee80211_chandef_vht_oper()
3358 struct ieee80211_local *local = sdata->local; in ieee80211_chandef_he_6ghz_oper() local
3360 enum nl80211_iftype iftype = ieee80211_vif_type_p2p(&sdata->vif); in ieee80211_chandef_he_6ghz_oper()
3368 if (chandef->chan->band != NL80211_BAND_6GHZ) in ieee80211_chandef_he_6ghz_oper()
3371 sband = local->hw.wiphy->bands[NL80211_BAND_6GHZ]; in ieee80211_chandef_he_6ghz_oper()
3375 sdata_info(sdata, "Missing iftype sband data/HE cap"); in ieee80211_chandef_he_6ghz_oper()
3379 he_phy_cap = he_cap->he_cap_elem.phy_cap_info[0]; in ieee80211_chandef_he_6ghz_oper()
3390 chandef->chan->center_freq); in ieee80211_chandef_he_6ghz_oper()
3399 chandef->chan->center_freq); in ieee80211_chandef_he_6ghz_oper()
3403 freq = ieee80211_channel_to_frequency(he_6ghz_oper->primary, in ieee80211_chandef_he_6ghz_oper()
3405 he_chandef.chan = ieee80211_get_channel(sdata->local->hw.wiphy, freq); in ieee80211_chandef_he_6ghz_oper()
3407 switch (u8_get_bits(he_6ghz_oper->control, in ieee80211_chandef_he_6ghz_oper()
3420 if (!he_6ghz_oper->ccfs1) in ieee80211_chandef_he_6ghz_oper()
3422 if (abs(he_6ghz_oper->ccfs1 - he_6ghz_oper->ccfs0) == 8) { in ieee80211_chandef_he_6ghz_oper()
3434 ieee80211_channel_to_frequency(he_6ghz_oper->ccfs1, in ieee80211_chandef_he_6ghz_oper()
3438 ieee80211_channel_to_frequency(he_6ghz_oper->ccfs0, in ieee80211_chandef_he_6ghz_oper()
3442 ieee80211_channel_to_frequency(he_6ghz_oper->ccfs1, in ieee80211_chandef_he_6ghz_oper()
3449 he_chandef.chan ? he_chandef.chan->center_freq : 0, in ieee80211_chandef_he_6ghz_oper()
3469 switch (FIELD_GET(S1G_OPER_CH_WIDTH_OPER, oper->ch_width)) { in ieee80211_chandef_s1g_oper()
3471 chandef->width = NL80211_CHAN_WIDTH_1; in ieee80211_chandef_s1g_oper()
3474 chandef->width = NL80211_CHAN_WIDTH_2; in ieee80211_chandef_s1g_oper()
3477 chandef->width = NL80211_CHAN_WIDTH_4; in ieee80211_chandef_s1g_oper()
3480 chandef->width = NL80211_CHAN_WIDTH_8; in ieee80211_chandef_s1g_oper()
3483 chandef->width = NL80211_CHAN_WIDTH_16; in ieee80211_chandef_s1g_oper()
3489 oper_freq = ieee80211_channel_to_freq_khz(oper->oper_ch, in ieee80211_chandef_s1g_oper()
3491 chandef->center_freq1 = KHZ_TO_MHZ(oper_freq); in ieee80211_chandef_s1g_oper()
3492 chandef->freq1_offset = oper_freq % 1000; in ieee80211_chandef_s1g_oper()
3511 for (j = 0; j < sband->n_bitrates; j++) { in ieee80211_parse_bitrates()
3512 br = &sband->bitrates[j]; in ieee80211_parse_bitrates()
3513 if ((rate_flags & br->flags) != rate_flags) in ieee80211_parse_bitrates()
3516 brate = DIV_ROUND_UP(br->bitrate, (1 << shift) * 5); in ieee80211_parse_bitrates()
3531 struct ieee80211_local *local = sdata->local; in ieee80211_add_srates_ie() local
3535 u32 basic_rates = sdata->vif.bss_conf.basic_rates; in ieee80211_add_srates_ie()
3538 shift = ieee80211_vif_get_shift(&sdata->vif); in ieee80211_add_srates_ie()
3539 rate_flags = ieee80211_chandef_rate_flags(&sdata->vif.bss_conf.chandef); in ieee80211_add_srates_ie()
3540 sband = local->hw.wiphy->bands[band]; in ieee80211_add_srates_ie()
3542 for (i = 0; i < sband->n_bitrates; i++) { in ieee80211_add_srates_ie()
3543 if ((rate_flags & sband->bitrates[i].flags) != rate_flags) in ieee80211_add_srates_ie()
3551 return -ENOMEM; in ieee80211_add_srates_ie()
3558 if ((rate_flags & sband->bitrates[i].flags) != rate_flags) in ieee80211_add_srates_ie()
3563 rate = DIV_ROUND_UP(sband->bitrates[i].bitrate, in ieee80211_add_srates_ie()
3575 struct ieee80211_local *local = sdata->local; in ieee80211_add_ext_srates_ie() local
3579 u32 basic_rates = sdata->vif.bss_conf.basic_rates; in ieee80211_add_ext_srates_ie()
3582 rate_flags = ieee80211_chandef_rate_flags(&sdata->vif.bss_conf.chandef); in ieee80211_add_ext_srates_ie()
3583 shift = ieee80211_vif_get_shift(&sdata->vif); in ieee80211_add_ext_srates_ie()
3585 sband = local->hw.wiphy->bands[band]; in ieee80211_add_ext_srates_ie()
3587 for (i = 0; i < sband->n_bitrates; i++) { in ieee80211_add_ext_srates_ie()
3588 if ((rate_flags & sband->bitrates[i].flags) != rate_flags) in ieee80211_add_ext_srates_ie()
3594 exrates -= 8; in ieee80211_add_ext_srates_ie()
3599 return -ENOMEM; in ieee80211_add_ext_srates_ie()
3605 for (i = 8; i < sband->n_bitrates; i++) { in ieee80211_add_ext_srates_ie()
3607 if ((rate_flags & sband->bitrates[i].flags) in ieee80211_add_ext_srates_ie()
3612 rate = DIV_ROUND_UP(sband->bitrates[i].bitrate, in ieee80211_add_ext_srates_ie()
3623 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_ave_rssi()
3625 if (WARN_ON_ONCE(sdata->vif.type != NL80211_IFTYPE_STATION)) { in ieee80211_ave_rssi()
3626 /* non-managed type inferfaces */ in ieee80211_ave_rssi()
3629 return -ewma_beacon_signal_read(&ifmgd->ave_beacon_signal); in ieee80211_ave_rssi()
3640 if (mcs->rx_mask[3]) in ieee80211_mcs_to_chains()
3642 if (mcs->rx_mask[2]) in ieee80211_mcs_to_chains()
3644 if (mcs->rx_mask[1]) in ieee80211_mcs_to_chains()
3650 * ieee80211_calculate_rx_timestamp - calculate timestamp in frame
3651 * @local: mac80211 hw info struct
3660 u64 ieee80211_calculate_rx_timestamp(struct ieee80211_local *local, in ieee80211_calculate_rx_timestamp() argument
3665 u64 ts = status->mactime; in ieee80211_calculate_rx_timestamp()
3674 ri.bw = status->bw; in ieee80211_calculate_rx_timestamp()
3677 switch (status->encoding) { in ieee80211_calculate_rx_timestamp()
3679 ri.mcs = status->rate_idx; in ieee80211_calculate_rx_timestamp()
3681 if (status->enc_flags & RX_ENC_FLAG_SHORT_GI) in ieee80211_calculate_rx_timestamp()
3686 ri.mcs = status->rate_idx; in ieee80211_calculate_rx_timestamp()
3687 ri.nss = status->nss; in ieee80211_calculate_rx_timestamp()
3688 if (status->enc_flags & RX_ENC_FLAG_SHORT_GI) in ieee80211_calculate_rx_timestamp()
3699 switch (status->bw) { in ieee80211_calculate_rx_timestamp()
3708 sband = local->hw.wiphy->bands[status->band]; in ieee80211_calculate_rx_timestamp()
3709 bitrate = sband->bitrates[status->rate_idx].bitrate; in ieee80211_calculate_rx_timestamp()
3712 if (status->flag & RX_FLAG_MACTIME_PLCP_START) { in ieee80211_calculate_rx_timestamp()
3714 if (status->band == NL80211_BAND_5GHZ) { in ieee80211_calculate_rx_timestamp()
3717 } else if (status->enc_flags & RX_ENC_FLAG_SHORTPRE) { in ieee80211_calculate_rx_timestamp()
3730 (unsigned long long)status->flag, status->rate_idx, in ieee80211_calculate_rx_timestamp()
3731 status->nss)) in ieee80211_calculate_rx_timestamp()
3735 if (status->flag & RX_FLAG_MACTIME_END) in ieee80211_calculate_rx_timestamp()
3736 ts -= mpdu_len * 8 * 10 / rate; in ieee80211_calculate_rx_timestamp()
3743 void ieee80211_dfs_cac_cancel(struct ieee80211_local *local) in ieee80211_dfs_cac_cancel() argument
3751 mutex_lock(&local->mtx); in ieee80211_dfs_cac_cancel()
3752 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_dfs_cac_cancel()
3753 /* it might be waiting for the local->mtx, but then in ieee80211_dfs_cac_cancel()
3754 * by the time it gets it, sdata->wdev.cac_started in ieee80211_dfs_cac_cancel()
3757 cancel_delayed_work(&sdata->dfs_cac_timer_work); in ieee80211_dfs_cac_cancel()
3759 if (sdata->wdev.cac_started) { in ieee80211_dfs_cac_cancel()
3760 chandef = sdata->vif.bss_conf.chandef; in ieee80211_dfs_cac_cancel()
3762 cfg80211_cac_event(sdata->dev, in ieee80211_dfs_cac_cancel()
3768 mutex_unlock(&local->mtx); in ieee80211_dfs_cac_cancel()
3773 struct ieee80211_local *local = in ieee80211_dfs_radar_detected_work() local
3775 struct cfg80211_chan_def chandef = local->hw.conf.chandef; in ieee80211_dfs_radar_detected_work()
3779 mutex_lock(&local->chanctx_mtx); in ieee80211_dfs_radar_detected_work()
3780 list_for_each_entry(ctx, &local->chanctx_list, list) { in ieee80211_dfs_radar_detected_work()
3781 if (ctx->replace_state == IEEE80211_CHANCTX_REPLACES_OTHER) in ieee80211_dfs_radar_detected_work()
3785 chandef = ctx->conf.def; in ieee80211_dfs_radar_detected_work()
3787 mutex_unlock(&local->chanctx_mtx); in ieee80211_dfs_radar_detected_work()
3790 ieee80211_dfs_cac_cancel(local); in ieee80211_dfs_radar_detected_work()
3794 /* XXX: multi-channel is not supported yet */ in ieee80211_dfs_radar_detected_work()
3797 cfg80211_radar_event(local->hw.wiphy, &chandef, GFP_KERNEL); in ieee80211_dfs_radar_detected_work()
3802 struct ieee80211_local *local = hw_to_local(hw); in ieee80211_radar_detected() local
3804 trace_api_radar_detected(local); in ieee80211_radar_detected()
3806 schedule_work(&local->radar_detected_work); in ieee80211_radar_detected()
3815 switch (c->width) { in ieee80211_chandef_downgrade()
3817 c->width = NL80211_CHAN_WIDTH_20_NOHT; in ieee80211_chandef_downgrade()
3821 c->width = NL80211_CHAN_WIDTH_20; in ieee80211_chandef_downgrade()
3822 c->center_freq1 = c->chan->center_freq; in ieee80211_chandef_downgrade()
3827 tmp = (30 + c->chan->center_freq - c->center_freq1)/20; in ieee80211_chandef_downgrade()
3831 c->center_freq1 = c->center_freq1 - 20 + 40 * tmp; in ieee80211_chandef_downgrade()
3832 c->width = NL80211_CHAN_WIDTH_40; in ieee80211_chandef_downgrade()
3836 c->center_freq2 = 0; in ieee80211_chandef_downgrade()
3837 c->width = NL80211_CHAN_WIDTH_80; in ieee80211_chandef_downgrade()
3843 tmp = (70 + c->chan->center_freq - c->center_freq1)/20; in ieee80211_chandef_downgrade()
3846 c->center_freq1 = c->center_freq1 - 40 + 80 * tmp; in ieee80211_chandef_downgrade()
3847 c->width = NL80211_CHAN_WIDTH_80; in ieee80211_chandef_downgrade()
3854 c->width = NL80211_CHAN_WIDTH_20_NOHT; in ieee80211_chandef_downgrade()
3865 /* keep c->width */ in ieee80211_chandef_downgrade()
3905 struct ieee80211_local *local = sdata->local; in ieee80211_send_action_csa() local
3911 if (sdata->vif.type != NL80211_IFTYPE_ADHOC && in ieee80211_send_action_csa()
3912 sdata->vif.type != NL80211_IFTYPE_MESH_POINT) in ieee80211_send_action_csa()
3913 return -EOPNOTSUPP; in ieee80211_send_action_csa()
3915 skb = dev_alloc_skb(local->tx_headroom + hdr_len + in ieee80211_send_action_csa()
3921 return -ENOMEM; in ieee80211_send_action_csa()
3923 skb_reserve(skb, local->tx_headroom); in ieee80211_send_action_csa()
3925 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | in ieee80211_send_action_csa()
3928 eth_broadcast_addr(mgmt->da); in ieee80211_send_action_csa()
3929 memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); in ieee80211_send_action_csa()
3930 if (ieee80211_vif_is_mesh(&sdata->vif)) { in ieee80211_send_action_csa()
3931 memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN); in ieee80211_send_action_csa()
3933 struct ieee80211_if_ibss *ifibss = &sdata->u.ibss; in ieee80211_send_action_csa()
3934 memcpy(mgmt->bssid, ifibss->bssid, ETH_ALEN); in ieee80211_send_action_csa()
3936 mgmt->u.action.category = WLAN_CATEGORY_SPECTRUM_MGMT; in ieee80211_send_action_csa()
3937 mgmt->u.action.u.chan_switch.action_code = WLAN_ACTION_SPCT_CHL_SWITCH; in ieee80211_send_action_csa()
3941 *pos++ = csa_settings->block_tx ? 1 : 0; /* CSA mode */ in ieee80211_send_action_csa()
3942 freq = csa_settings->chandef.chan->center_freq; in ieee80211_send_action_csa()
3944 *pos++ = csa_settings->count; /* count */ in ieee80211_send_action_csa()
3946 if (csa_settings->chandef.width == NL80211_CHAN_WIDTH_40) { in ieee80211_send_action_csa()
3952 ch_type = cfg80211_get_chandef_type(&csa_settings->chandef); in ieee80211_send_action_csa()
3959 if (ieee80211_vif_is_mesh(&sdata->vif)) { in ieee80211_send_action_csa()
3960 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; in ieee80211_send_action_csa()
3965 *pos++ = sdata->u.mesh.mshcfg.dot11MeshTTL; /* Mesh TTL */ in ieee80211_send_action_csa()
3968 *pos++ |= csa_settings->block_tx ? in ieee80211_send_action_csa()
3972 put_unaligned_le16(ifmsh->pre_value, pos);/* Precedence Value */ in ieee80211_send_action_csa()
3976 if (csa_settings->chandef.width == NL80211_CHAN_WIDTH_80 || in ieee80211_send_action_csa()
3977 csa_settings->chandef.width == NL80211_CHAN_WIDTH_80P80 || in ieee80211_send_action_csa()
3978 csa_settings->chandef.width == NL80211_CHAN_WIDTH_160) { in ieee80211_send_action_csa()
3980 ieee80211_ie_build_wide_bw_cs(pos, &csa_settings->chandef); in ieee80211_send_action_csa()
3989 return !(cs == NULL || cs->cipher == 0 || in ieee80211_cs_valid()
3990 cs->hdr_len < cs->pn_len + cs->pn_off || in ieee80211_cs_valid()
3991 cs->hdr_len <= cs->key_idx_off || in ieee80211_cs_valid()
3992 cs->key_idx_shift > 7 || in ieee80211_cs_valid()
3993 cs->key_idx_mask == 0); in ieee80211_cs_valid()
4011 ieee80211_cs_get(struct ieee80211_local *local, u32 cipher, in ieee80211_cs_get() argument
4014 const struct ieee80211_cipher_scheme *l = local->hw.cipher_schemes; in ieee80211_cs_get()
4015 int n = local->hw.n_cipher_schemes; in ieee80211_cs_get()
4026 if (!cs || !(cs->iftype & BIT(iftype))) in ieee80211_cs_get()
4032 int ieee80211_cs_headroom(struct ieee80211_local *local, in ieee80211_cs_headroom() argument
4040 for (i = 0; i < crypto->n_ciphers_pairwise; i++) { in ieee80211_cs_headroom()
4041 cs = ieee80211_cs_get(local, crypto->ciphers_pairwise[i], in ieee80211_cs_headroom()
4044 if (cs && headroom < cs->hdr_len) in ieee80211_cs_headroom()
4045 headroom = cs->hdr_len; in ieee80211_cs_headroom()
4048 cs = ieee80211_cs_get(local, crypto->cipher_group, iftype); in ieee80211_cs_headroom()
4049 if (cs && headroom < cs->hdr_len) in ieee80211_cs_headroom()
4050 headroom = cs->hdr_len; in ieee80211_cs_headroom()
4058 s32 end = data->desc[i].start + data->desc[i].duration - (tsf + 1); in ieee80211_extend_noa_desc()
4065 if (data->count[i] == 1) in ieee80211_extend_noa_desc()
4068 if (data->desc[i].interval == 0) in ieee80211_extend_noa_desc()
4072 skip = DIV_ROUND_UP(-end, data->desc[i].interval); in ieee80211_extend_noa_desc()
4073 if (data->count[i] < 255) { in ieee80211_extend_noa_desc()
4074 if (data->count[i] <= skip) { in ieee80211_extend_noa_desc()
4075 data->count[i] = 0; in ieee80211_extend_noa_desc()
4079 data->count[i] -= skip; in ieee80211_extend_noa_desc()
4082 data->desc[i].start += skip * data->desc[i].interval; in ieee80211_extend_noa_desc()
4097 if (!data->count[i]) in ieee80211_extend_absent_time()
4103 cur = data->desc[i].start - tsf; in ieee80211_extend_absent_time()
4107 cur = data->desc[i].start + data->desc[i].duration - tsf; in ieee80211_extend_absent_time()
4139 u32 next_offset = BIT(31) - 1; in ieee80211_update_p2p_noa()
4142 data->absent = 0; in ieee80211_update_p2p_noa()
4143 data->has_next_tsf = false; in ieee80211_update_p2p_noa()
4147 if (!data->count[i]) in ieee80211_update_p2p_noa()
4151 start = data->desc[i].start - tsf; in ieee80211_update_p2p_noa()
4153 data->absent |= BIT(i); in ieee80211_update_p2p_noa()
4158 data->has_next_tsf = true; in ieee80211_update_p2p_noa()
4161 if (data->absent) in ieee80211_update_p2p_noa()
4164 data->next_tsf = tsf + next_offset; in ieee80211_update_p2p_noa()
4177 const struct ieee80211_p2p_noa_desc *desc = &attr->desc[i]; in ieee80211_parse_p2p_noa()
4179 if (!desc->count || !desc->duration) in ieee80211_parse_p2p_noa()
4182 data->count[i] = desc->count; in ieee80211_parse_p2p_noa()
4183 data->desc[i].start = le32_to_cpu(desc->start_time); in ieee80211_parse_p2p_noa()
4184 data->desc[i].duration = le32_to_cpu(desc->duration); in ieee80211_parse_p2p_noa()
4185 data->desc[i].interval = le32_to_cpu(desc->interval); in ieee80211_parse_p2p_noa()
4187 if (data->count[i] > 1 && in ieee80211_parse_p2p_noa()
4188 data->desc[i].interval < data->desc[i].duration) in ieee80211_parse_p2p_noa()
4202 void ieee80211_recalc_dtim(struct ieee80211_local *local, in ieee80211_recalc_dtim() argument
4205 u64 tsf = drv_get_tsf(local, sdata); in ieee80211_recalc_dtim()
4207 u16 beacon_int = sdata->vif.bss_conf.beacon_int * 1024; in ieee80211_recalc_dtim()
4208 u8 dtim_period = sdata->vif.bss_conf.dtim_period; in ieee80211_recalc_dtim()
4212 if (tsf == -1ULL || !beacon_int || !dtim_period) in ieee80211_recalc_dtim()
4215 if (sdata->vif.type == NL80211_IFTYPE_AP || in ieee80211_recalc_dtim()
4216 sdata->vif.type == NL80211_IFTYPE_AP_VLAN) { in ieee80211_recalc_dtim()
4217 if (!sdata->bss) in ieee80211_recalc_dtim()
4220 ps = &sdata->bss->ps; in ieee80211_recalc_dtim()
4221 } else if (ieee80211_vif_is_mesh(&sdata->vif)) { in ieee80211_recalc_dtim()
4222 ps = &sdata->u.mesh.ps; in ieee80211_recalc_dtim()
4230 * dtim_count = dtim_period - (tsf / bcn_int) % dtim_period in ieee80211_recalc_dtim()
4238 dtim_count = dtim_period - bcns_from_dtim; in ieee80211_recalc_dtim()
4240 ps->dtim_count = dtim_count; in ieee80211_recalc_dtim()
4243 static u8 ieee80211_chanctx_radar_detect(struct ieee80211_local *local, in ieee80211_chanctx_radar_detect() argument
4249 lockdep_assert_held(&local->chanctx_mtx); in ieee80211_chanctx_radar_detect()
4251 if (WARN_ON(ctx->replace_state == IEEE80211_CHANCTX_WILL_BE_REPLACED)) in ieee80211_chanctx_radar_detect()
4254 list_for_each_entry(sdata, &ctx->reserved_vifs, reserved_chanctx_list) in ieee80211_chanctx_radar_detect()
4255 if (sdata->reserved_radar_required) in ieee80211_chanctx_radar_detect()
4256 radar_detect |= BIT(sdata->reserved_chandef.width); in ieee80211_chanctx_radar_detect()
4259 * An in-place reservation context should not have any assigned vifs in ieee80211_chanctx_radar_detect()
4262 WARN_ON(ctx->replace_state == IEEE80211_CHANCTX_REPLACES_OTHER && in ieee80211_chanctx_radar_detect()
4263 !list_empty(&ctx->assigned_vifs)); in ieee80211_chanctx_radar_detect()
4265 list_for_each_entry(sdata, &ctx->assigned_vifs, assigned_chanctx_list) in ieee80211_chanctx_radar_detect()
4266 if (sdata->radar_required) in ieee80211_chanctx_radar_detect()
4267 radar_detect |= BIT(sdata->vif.bss_conf.chandef.width); in ieee80211_chanctx_radar_detect()
4277 struct ieee80211_local *local = sdata->local; in ieee80211_check_combinations() local
4279 enum nl80211_iftype iftype = sdata->wdev.iftype; in ieee80211_check_combinations()
4286 lockdep_assert_held(&local->chanctx_mtx); in ieee80211_check_combinations()
4289 return -EINVAL; in ieee80211_check_combinations()
4292 !chandef->chan)) in ieee80211_check_combinations()
4293 return -EINVAL; in ieee80211_check_combinations()
4296 return -EINVAL; in ieee80211_check_combinations()
4298 if (sdata->vif.type == NL80211_IFTYPE_AP || in ieee80211_check_combinations()
4299 sdata->vif.type == NL80211_IFTYPE_MESH_POINT) { in ieee80211_check_combinations()
4305 params.new_beacon_int = sdata->vif.bss_conf.beacon_int; in ieee80211_check_combinations()
4309 if (cfg80211_iftype_allowed(local->hw.wiphy, iftype, 0, 1)) { in ieee80211_check_combinations()
4311 return -EINVAL; in ieee80211_check_combinations()
4321 list_for_each_entry(ctx, &local->chanctx_list, list) { in ieee80211_check_combinations()
4322 if (ctx->replace_state == IEEE80211_CHANCTX_WILL_BE_REPLACED) in ieee80211_check_combinations()
4325 ieee80211_chanctx_radar_detect(local, ctx); in ieee80211_check_combinations()
4326 if (ctx->mode == IEEE80211_CHANCTX_EXCLUSIVE) { in ieee80211_check_combinations()
4332 &ctx->conf.def)) in ieee80211_check_combinations()
4337 list_for_each_entry_rcu(sdata_iter, &local->interfaces, list) { in ieee80211_check_combinations()
4340 wdev_iter = &sdata_iter->wdev; in ieee80211_check_combinations()
4344 cfg80211_iftype_allowed(local->hw.wiphy, in ieee80211_check_combinations()
4345 wdev_iter->iftype, 0, 1)) in ieee80211_check_combinations()
4348 params.iftype_num[wdev_iter->iftype]++; in ieee80211_check_combinations()
4355 return cfg80211_check_combinations(local->hw.wiphy, &params); in ieee80211_check_combinations()
4365 c->num_different_channels); in ieee80211_iter_max_chans()
4368 int ieee80211_max_num_channels(struct ieee80211_local *local) in ieee80211_max_num_channels() argument
4376 lockdep_assert_held(&local->chanctx_mtx); in ieee80211_max_num_channels()
4378 list_for_each_entry(ctx, &local->chanctx_list, list) { in ieee80211_max_num_channels()
4379 if (ctx->replace_state == IEEE80211_CHANCTX_WILL_BE_REPLACED) in ieee80211_max_num_channels()
4385 ieee80211_chanctx_radar_detect(local, ctx); in ieee80211_max_num_channels()
4388 list_for_each_entry_rcu(sdata, &local->interfaces, list) in ieee80211_max_num_channels()
4389 params.iftype_num[sdata->wdev.iftype]++; in ieee80211_max_num_channels()
4391 err = cfg80211_iter_combinations(local->hw.wiphy, &params, in ieee80211_max_num_channels()
4404 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_add_s1g_capab_ie()
4409 if (WARN_ON(sdata->vif.type != NL80211_IFTYPE_STATION)) in ieee80211_add_s1g_capab_ie()
4412 if (!caps->s1g) in ieee80211_add_s1g_capab_ie()
4415 memcpy(s1g_capab.capab_info, caps->cap, sizeof(caps->cap)); in ieee80211_add_s1g_capab_ie()
4416 memcpy(s1g_capab.supp_mcs_nss, caps->nss_mcs, sizeof(caps->nss_mcs)); in ieee80211_add_s1g_capab_ie()
4419 for (i = 0; i < sizeof(ifmgd->s1g_capa.capab_info); i++) { in ieee80211_add_s1g_capab_ie()
4420 u8 mask = ifmgd->s1g_capa_mask.capab_info[i]; in ieee80211_add_s1g_capab_ie()
4423 s1g_capab.capab_info[i] |= ifmgd->s1g_capa.capab_info[i] & mask; in ieee80211_add_s1g_capab_ie()
4427 for (i = 0; i < sizeof(ifmgd->s1g_capa.supp_mcs_nss); i++) { in ieee80211_add_s1g_capab_ie()
4428 u8 mask = ifmgd->s1g_capa_mask.supp_mcs_nss[i]; in ieee80211_add_s1g_capab_ie()
4432 ifmgd->s1g_capa.supp_mcs_nss[i] & mask; in ieee80211_add_s1g_capab_ie()
4462 *buf++ = qosinfo; /* U-APSD no in use */ in ieee80211_add_wmm_info_ie()
4475 skb_queue_walk(&txqi->frags, skb) { in ieee80211_txq_get_depth()
4477 frag_bytes += skb->len; in ieee80211_txq_get_depth()
4481 *frame_cnt = txqi->tin.backlog_packets + frag_cnt; in ieee80211_txq_get_depth()
4484 *byte_cnt = txqi->tin.backlog_bytes + frag_bytes; in ieee80211_txq_get_depth()