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-2024 Intel Corporation
30 #include "driver-ops.h"
42 struct ieee80211_local *local; in wiphy_to_ieee80211_hw() local
44 local = wiphy_priv(wiphy); in wiphy_to_ieee80211_hw()
45 return &local->hw; in wiphy_to_ieee80211_hw()
57 __le16 fc = hdr->frame_control; in ieee80211_get_bssid()
66 return hdr->addr1; in ieee80211_get_bssid()
68 return hdr->addr2; in ieee80211_get_bssid()
70 return hdr->addr3; in ieee80211_get_bssid()
76 return ext->u.s1g_beacon.sa; in ieee80211_get_bssid()
82 return hdr->addr3; in ieee80211_get_bssid()
87 return hdr->addr1; in ieee80211_get_bssid()
92 return hdr->addr2; in ieee80211_get_bssid()
95 return hdr->addr1; in ieee80211_get_bssid()
111 skb_queue_walk(&tx->skbs, skb) { in ieee80211_tx_set_protected()
112 hdr = (struct ieee80211_hdr *) skb->data; in ieee80211_tx_set_protected()
113 hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); in ieee80211_tx_set_protected()
141 * 802.11a - 18.5.2: aSIFSTime = 16 usec in ieee80211_frame_duration()
142 * 802.11g - 19.8.4: aSIFSTime = 10 usec + in ieee80211_frame_duration()
146 dur += 16; /* IEEE 802.11-2012 18.3.2.4: T_PREAMBLE = 16 usec */ in ieee80211_frame_duration()
147 dur += 4; /* IEEE 802.11-2012 18.3.2.4: T_SIGNAL = 4 usec */ in ieee80211_frame_duration()
189 short_preamble = sdata->vif.bss_conf.use_short_preamble; in ieee80211_generic_frame_duration()
190 if (sdata->deflink.operating_11g_mode) in ieee80211_generic_frame_duration()
191 erp = rate->flags & IEEE80211_RATE_ERP_G; in ieee80211_generic_frame_duration()
194 dur = ieee80211_frame_duration(band, frame_len, rate->bitrate, erp, in ieee80211_generic_frame_duration()
205 struct ieee80211_local *local = hw_to_local(hw); in ieee80211_rts_duration() local
213 sband = local->hw.wiphy->bands[frame_txctl->band]; in ieee80211_rts_duration()
217 rate = &sband->bitrates[frame_txctl->control.rts_cts_rate_idx]; in ieee80211_rts_duration()
222 short_preamble = sdata->vif.bss_conf.use_short_preamble; in ieee80211_rts_duration()
223 if (sdata->deflink.operating_11g_mode) in ieee80211_rts_duration()
224 erp = rate->flags & IEEE80211_RATE_ERP_G; in ieee80211_rts_duration()
227 bitrate = rate->bitrate; in ieee80211_rts_duration()
230 dur = ieee80211_frame_duration(sband->band, 10, bitrate, in ieee80211_rts_duration()
233 dur += ieee80211_frame_duration(sband->band, frame_len, bitrate, in ieee80211_rts_duration()
236 dur += ieee80211_frame_duration(sband->band, 10, bitrate, in ieee80211_rts_duration()
248 struct ieee80211_local *local = hw_to_local(hw); in ieee80211_ctstoself_duration() local
256 sband = local->hw.wiphy->bands[frame_txctl->band]; in ieee80211_ctstoself_duration()
260 rate = &sband->bitrates[frame_txctl->control.rts_cts_rate_idx]; in ieee80211_ctstoself_duration()
264 short_preamble = sdata->vif.bss_conf.use_short_preamble; in ieee80211_ctstoself_duration()
265 if (sdata->deflink.operating_11g_mode) in ieee80211_ctstoself_duration()
266 erp = rate->flags & IEEE80211_RATE_ERP_G; in ieee80211_ctstoself_duration()
269 bitrate = rate->bitrate; in ieee80211_ctstoself_duration()
272 dur = ieee80211_frame_duration(sband->band, frame_len, bitrate, in ieee80211_ctstoself_duration()
274 if (!(frame_txctl->flags & IEEE80211_TX_CTL_NO_ACK)) { in ieee80211_ctstoself_duration()
276 dur += ieee80211_frame_duration(sband->band, 10, bitrate, in ieee80211_ctstoself_duration()
284 static void wake_tx_push_queue(struct ieee80211_local *local, in wake_tx_push_queue() argument
289 .sta = queue->sta, in wake_tx_push_queue()
294 skb = ieee80211_tx_dequeue(&local->hw, queue); in wake_tx_push_queue()
298 drv_tx(local, &control, skb); in wake_tx_push_queue()
306 struct ieee80211_local *local = hw_to_local(hw); in ieee80211_handle_wake_tx_queue() local
307 struct ieee80211_sub_if_data *sdata = vif_to_sdata(txq->vif); in ieee80211_handle_wake_tx_queue()
310 spin_lock(&local->handle_wake_tx_queue_lock); in ieee80211_handle_wake_tx_queue()
313 ieee80211_txq_schedule_start(hw, txq->ac); in ieee80211_handle_wake_tx_queue()
314 while ((queue = ieee80211_next_txq(hw, txq->ac))) { in ieee80211_handle_wake_tx_queue()
315 wake_tx_push_queue(local, sdata, queue); in ieee80211_handle_wake_tx_queue()
318 ieee80211_txq_schedule_end(hw, txq->ac); in ieee80211_handle_wake_tx_queue()
319 spin_unlock(&local->handle_wake_tx_queue_lock); in ieee80211_handle_wake_tx_queue()
325 struct ieee80211_local *local = sdata->local; in __ieee80211_wake_txqs() local
326 struct ieee80211_vif *vif = &sdata->vif; in __ieee80211_wake_txqs()
327 struct fq *fq = &local->fq; in __ieee80211_wake_txqs()
334 spin_lock(&fq->lock); in __ieee80211_wake_txqs()
336 if (!test_bit(SDATA_STATE_RUNNING, &sdata->state)) in __ieee80211_wake_txqs()
339 if (sdata->vif.type == NL80211_IFTYPE_AP) in __ieee80211_wake_txqs()
340 ps = &sdata->bss->ps; in __ieee80211_wake_txqs()
342 list_for_each_entry_rcu(sta, &local->sta_list, list) { in __ieee80211_wake_txqs()
343 if (sdata != sta->sdata) in __ieee80211_wake_txqs()
346 for (i = 0; i < ARRAY_SIZE(sta->sta.txq); i++) { in __ieee80211_wake_txqs()
347 struct ieee80211_txq *txq = sta->sta.txq[i]; in __ieee80211_wake_txqs()
354 if (ac != txq->ac) in __ieee80211_wake_txqs()
358 &txqi->flags)) in __ieee80211_wake_txqs()
361 spin_unlock(&fq->lock); in __ieee80211_wake_txqs()
362 drv_wake_tx_queue(local, txqi); in __ieee80211_wake_txqs()
363 spin_lock(&fq->lock); in __ieee80211_wake_txqs()
367 if (!vif->txq) in __ieee80211_wake_txqs()
370 txqi = to_txq_info(vif->txq); in __ieee80211_wake_txqs()
372 if (!test_and_clear_bit(IEEE80211_TXQ_DIRTY, &txqi->flags) || in __ieee80211_wake_txqs()
373 (ps && atomic_read(&ps->num_sta_ps)) || ac != vif->txq->ac) in __ieee80211_wake_txqs()
376 spin_unlock(&fq->lock); in __ieee80211_wake_txqs()
378 drv_wake_tx_queue(local, txqi); in __ieee80211_wake_txqs()
382 spin_unlock(&fq->lock); in __ieee80211_wake_txqs()
387 __releases(&local->queue_stop_reason_lock)
388 __acquires(&local->queue_stop_reason_lock)
389 _ieee80211_wake_txqs(struct ieee80211_local *local, unsigned long *flags) in _ieee80211_wake_txqs() argument
397 if (local->hw.queues < IEEE80211_NUM_ACS) in _ieee80211_wake_txqs()
400 for (i = 0; i < local->hw.queues; i++) { in _ieee80211_wake_txqs()
401 if (local->queue_stop_reasons[i]) in _ieee80211_wake_txqs()
404 spin_unlock_irqrestore(&local->queue_stop_reason_lock, *flags); in _ieee80211_wake_txqs()
405 list_for_each_entry_rcu(sdata, &local->interfaces, list) { in _ieee80211_wake_txqs()
409 int ac_queue = sdata->vif.hw_queue[ac]; in _ieee80211_wake_txqs()
412 sdata->vif.cab_queue == i) in _ieee80211_wake_txqs()
416 spin_lock_irqsave(&local->queue_stop_reason_lock, *flags); in _ieee80211_wake_txqs()
424 struct ieee80211_local *local = from_tasklet(local, t, in ieee80211_wake_txqs() local
428 spin_lock_irqsave(&local->queue_stop_reason_lock, flags); in ieee80211_wake_txqs()
429 _ieee80211_wake_txqs(local, &flags); in ieee80211_wake_txqs()
430 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); in ieee80211_wake_txqs()
438 struct ieee80211_local *local = hw_to_local(hw); in __ieee80211_wake_queue() local
440 trace_wake_queue(local, queue, reason); in __ieee80211_wake_queue()
442 if (WARN_ON(queue >= hw->queues)) in __ieee80211_wake_queue()
445 if (!test_bit(reason, &local->queue_stop_reasons[queue])) in __ieee80211_wake_queue()
449 local->q_stop_reasons[queue][reason] = 0; in __ieee80211_wake_queue()
451 local->q_stop_reasons[queue][reason]--; in __ieee80211_wake_queue()
452 if (WARN_ON(local->q_stop_reasons[queue][reason] < 0)) in __ieee80211_wake_queue()
453 local->q_stop_reasons[queue][reason] = 0; in __ieee80211_wake_queue()
456 if (local->q_stop_reasons[queue][reason] == 0) in __ieee80211_wake_queue()
457 __clear_bit(reason, &local->queue_stop_reasons[queue]); in __ieee80211_wake_queue()
459 if (local->queue_stop_reasons[queue] != 0) in __ieee80211_wake_queue()
463 if (!skb_queue_empty(&local->pending[queue])) in __ieee80211_wake_queue()
464 tasklet_schedule(&local->tx_pending_tasklet); in __ieee80211_wake_queue()
474 tasklet_schedule(&local->wake_txqs_tasklet); in __ieee80211_wake_queue()
476 _ieee80211_wake_txqs(local, flags); in __ieee80211_wake_queue()
483 struct ieee80211_local *local = hw_to_local(hw); in ieee80211_wake_queue_by_reason() local
486 spin_lock_irqsave(&local->queue_stop_reason_lock, flags); in ieee80211_wake_queue_by_reason()
488 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); in ieee80211_wake_queue_by_reason()
503 struct ieee80211_local *local = hw_to_local(hw); in __ieee80211_stop_queue() local
505 trace_stop_queue(local, queue, reason); in __ieee80211_stop_queue()
507 if (WARN_ON(queue >= hw->queues)) in __ieee80211_stop_queue()
511 local->q_stop_reasons[queue][reason] = 1; in __ieee80211_stop_queue()
513 local->q_stop_reasons[queue][reason]++; in __ieee80211_stop_queue()
515 set_bit(reason, &local->queue_stop_reasons[queue]); in __ieee80211_stop_queue()
522 struct ieee80211_local *local = hw_to_local(hw); in ieee80211_stop_queue_by_reason() local
525 spin_lock_irqsave(&local->queue_stop_reason_lock, flags); in ieee80211_stop_queue_by_reason()
527 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); in ieee80211_stop_queue_by_reason()
538 void ieee80211_add_pending_skb(struct ieee80211_local *local, in ieee80211_add_pending_skb() argument
541 struct ieee80211_hw *hw = &local->hw; in ieee80211_add_pending_skb()
544 int queue = info->hw_queue; in ieee80211_add_pending_skb()
546 if (WARN_ON(!info->control.vif)) { in ieee80211_add_pending_skb()
547 ieee80211_free_txskb(&local->hw, skb); in ieee80211_add_pending_skb()
551 spin_lock_irqsave(&local->queue_stop_reason_lock, flags); in ieee80211_add_pending_skb()
554 __skb_queue_tail(&local->pending[queue], skb); in ieee80211_add_pending_skb()
557 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); in ieee80211_add_pending_skb()
560 void ieee80211_add_pending_skbs(struct ieee80211_local *local, in ieee80211_add_pending_skbs() argument
563 struct ieee80211_hw *hw = &local->hw; in ieee80211_add_pending_skbs()
568 spin_lock_irqsave(&local->queue_stop_reason_lock, flags); in ieee80211_add_pending_skbs()
572 if (WARN_ON(!info->control.vif)) { in ieee80211_add_pending_skbs()
573 ieee80211_free_txskb(&local->hw, skb); in ieee80211_add_pending_skbs()
577 queue = info->hw_queue; in ieee80211_add_pending_skbs()
583 __skb_queue_tail(&local->pending[queue], skb); in ieee80211_add_pending_skbs()
586 for (i = 0; i < hw->queues; i++) in ieee80211_add_pending_skbs()
590 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); in ieee80211_add_pending_skbs()
598 struct ieee80211_local *local = hw_to_local(hw); in ieee80211_stop_queues_by_reason() local
602 spin_lock_irqsave(&local->queue_stop_reason_lock, flags); in ieee80211_stop_queues_by_reason()
604 for_each_set_bit(i, &queues, hw->queues) in ieee80211_stop_queues_by_reason()
607 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); in ieee80211_stop_queues_by_reason()
620 struct ieee80211_local *local = hw_to_local(hw); in ieee80211_queue_stopped() local
624 if (WARN_ON(queue >= hw->queues)) in ieee80211_queue_stopped()
627 spin_lock_irqsave(&local->queue_stop_reason_lock, flags); in ieee80211_queue_stopped()
629 &local->queue_stop_reasons[queue]); in ieee80211_queue_stopped()
630 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); in ieee80211_queue_stopped()
640 struct ieee80211_local *local = hw_to_local(hw); in ieee80211_wake_queues_by_reason() local
644 spin_lock_irqsave(&local->queue_stop_reason_lock, flags); in ieee80211_wake_queues_by_reason()
646 for_each_set_bit(i, &queues, hw->queues) in ieee80211_wake_queues_by_reason()
649 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); in ieee80211_wake_queues_by_reason()
661 ieee80211_get_vif_queues(struct ieee80211_local *local, in ieee80211_get_vif_queues() argument
666 if (sdata && ieee80211_hw_check(&local->hw, QUEUE_CONTROL)) { in ieee80211_get_vif_queues()
672 queues |= BIT(sdata->vif.hw_queue[ac]); in ieee80211_get_vif_queues()
673 if (sdata->vif.cab_queue != IEEE80211_INVAL_HW_QUEUE) in ieee80211_get_vif_queues()
674 queues |= BIT(sdata->vif.cab_queue); in ieee80211_get_vif_queues()
677 queues = BIT(local->hw.queues) - 1; in ieee80211_get_vif_queues()
683 void __ieee80211_flush_queues(struct ieee80211_local *local, in __ieee80211_flush_queues() argument
687 if (!local->ops->flush) in __ieee80211_flush_queues()
692 * IEEE80211_HW_QUEUE_CONTROL - flush all queues in __ieee80211_flush_queues()
694 if (!queues || !ieee80211_hw_check(&local->hw, QUEUE_CONTROL)) in __ieee80211_flush_queues()
695 queues = ieee80211_get_vif_queues(local, sdata); in __ieee80211_flush_queues()
697 ieee80211_stop_queues_by_reason(&local->hw, queues, in __ieee80211_flush_queues()
707 list_for_each_entry(sta, &local->sta_list, list) { in __ieee80211_flush_queues()
708 if (sdata != sta->sdata) in __ieee80211_flush_queues()
714 drv_flush(local, sdata, queues, drop); in __ieee80211_flush_queues()
716 ieee80211_wake_queues_by_reason(&local->hw, queues, in __ieee80211_flush_queues()
721 void ieee80211_flush_queues(struct ieee80211_local *local, in ieee80211_flush_queues() argument
724 __ieee80211_flush_queues(local, sdata, 0, drop); in ieee80211_flush_queues()
727 void ieee80211_stop_vif_queues(struct ieee80211_local *local, in ieee80211_stop_vif_queues() argument
731 ieee80211_stop_queues_by_reason(&local->hw, in ieee80211_stop_vif_queues()
732 ieee80211_get_vif_queues(local, sdata), in ieee80211_stop_vif_queues()
736 void ieee80211_wake_vif_queues(struct ieee80211_local *local, in ieee80211_wake_vif_queues() argument
740 ieee80211_wake_queues_by_reason(&local->hw, in ieee80211_wake_vif_queues()
741 ieee80211_get_vif_queues(local, sdata), in ieee80211_wake_vif_queues()
745 static void __iterate_interfaces(struct ieee80211_local *local, in __iterate_interfaces() argument
754 list_for_each_entry_rcu(sdata, &local->interfaces, list, in __iterate_interfaces()
755 lockdep_is_held(&local->iflist_mtx) || in __iterate_interfaces()
756 lockdep_is_held(&local->hw.wiphy->mtx)) { in __iterate_interfaces()
757 switch (sdata->vif.type) { in __iterate_interfaces()
759 if (!(sdata->u.mntr.flags & MONITOR_FLAG_ACTIVE)) in __iterate_interfaces()
768 active_only && !(sdata->flags & IEEE80211_SDATA_IN_DRIVER)) in __iterate_interfaces()
771 !(sdata->flags & IEEE80211_SDATA_IN_DRIVER)) in __iterate_interfaces()
774 iterator(data, sdata->vif.addr, in __iterate_interfaces()
775 &sdata->vif); in __iterate_interfaces()
778 sdata = rcu_dereference_check(local->monitor_sdata, in __iterate_interfaces()
779 lockdep_is_held(&local->iflist_mtx) || in __iterate_interfaces()
780 lockdep_is_held(&local->hw.wiphy->mtx)); in __iterate_interfaces()
781 if (sdata && ieee80211_hw_check(&local->hw, WANT_MONITOR_VIF) && in __iterate_interfaces()
783 sdata->flags & IEEE80211_SDATA_IN_DRIVER)) in __iterate_interfaces()
784 iterator(data, sdata->vif.addr, &sdata->vif); in __iterate_interfaces()
793 struct ieee80211_local *local = hw_to_local(hw); in ieee80211_iterate_interfaces() local
795 mutex_lock(&local->iflist_mtx); in ieee80211_iterate_interfaces()
796 __iterate_interfaces(local, iter_flags, iterator, data); in ieee80211_iterate_interfaces()
797 mutex_unlock(&local->iflist_mtx); in ieee80211_iterate_interfaces()
807 struct ieee80211_local *local = hw_to_local(hw); in ieee80211_iterate_active_interfaces_atomic() local
810 __iterate_interfaces(local, iter_flags | IEEE80211_IFACE_ITER_ACTIVE, in ieee80211_iterate_active_interfaces_atomic()
822 struct ieee80211_local *local = hw_to_local(hw); in ieee80211_iterate_active_interfaces_mtx() local
824 lockdep_assert_wiphy(hw->wiphy); in ieee80211_iterate_active_interfaces_mtx()
826 __iterate_interfaces(local, iter_flags | IEEE80211_IFACE_ITER_ACTIVE, in ieee80211_iterate_active_interfaces_mtx()
831 static void __iterate_stations(struct ieee80211_local *local, in __iterate_stations() argument
838 list_for_each_entry_rcu(sta, &local->sta_list, list, in __iterate_stations()
839 lockdep_is_held(&local->hw.wiphy->mtx)) { in __iterate_stations()
840 if (!sta->uploaded) in __iterate_stations()
843 iterator(data, &sta->sta); in __iterate_stations()
852 struct ieee80211_local *local = hw_to_local(hw); in ieee80211_iterate_stations_atomic() local
855 __iterate_stations(local, iterator, data); in ieee80211_iterate_stations_atomic()
865 struct ieee80211_local *local = hw_to_local(hw); in ieee80211_iterate_stations_mtx() local
867 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_iterate_stations_mtx()
869 __iterate_stations(local, iterator, data); in ieee80211_iterate_stations_mtx()
878 !(sdata->flags & IEEE80211_SDATA_IN_DRIVER)) in wdev_to_ieee80211_vif()
880 return &sdata->vif; in wdev_to_ieee80211_vif()
889 return &vif_to_sdata(vif)->wdev; in ieee80211_vif_to_wdev()
895 * the suspend->resume cycle. Since we can't check each caller
902 static bool ieee80211_can_queue_work(struct ieee80211_local *local) in ieee80211_can_queue_work() argument
904 if (local->quiescing || (local->suspended && !local->resuming)) { in ieee80211_can_queue_work()
914 struct ieee80211_local *local = hw_to_local(hw); in ieee80211_queue_work() local
916 if (!ieee80211_can_queue_work(local)) in ieee80211_queue_work()
919 queue_work(local->workqueue, work); in ieee80211_queue_work()
927 struct ieee80211_local *local = hw_to_local(hw); in ieee80211_queue_delayed_work() local
929 if (!ieee80211_can_queue_work(local)) in ieee80211_queue_delayed_work()
932 queue_delayed_work(local->workqueue, dwork, delay); in ieee80211_queue_delayed_work()
945 if (sdata->vif.type != NL80211_IFTYPE_AP && in ieee80211_regulatory_limit_wmm_params()
946 sdata->vif.type != NL80211_IFTYPE_STATION) in ieee80211_regulatory_limit_wmm_params()
950 chanctx_conf = rcu_dereference(sdata->vif.bss_conf.chanctx_conf); in ieee80211_regulatory_limit_wmm_params()
952 center_freq = chanctx_conf->def.chan->center_freq; in ieee80211_regulatory_limit_wmm_params()
959 rrule = freq_reg_info(sdata->wdev.wiphy, MHZ_TO_KHZ(center_freq)); in ieee80211_regulatory_limit_wmm_params()
961 if (IS_ERR_OR_NULL(rrule) || !rrule->has_wmm) { in ieee80211_regulatory_limit_wmm_params()
966 if (sdata->vif.type == NL80211_IFTYPE_AP) in ieee80211_regulatory_limit_wmm_params()
967 wmm_ac = &rrule->wmm_rule.ap[ac]; in ieee80211_regulatory_limit_wmm_params()
969 wmm_ac = &rrule->wmm_rule.client[ac]; in ieee80211_regulatory_limit_wmm_params()
970 qparam->cw_min = max_t(u16, qparam->cw_min, wmm_ac->cw_min); in ieee80211_regulatory_limit_wmm_params()
971 qparam->cw_max = max_t(u16, qparam->cw_max, wmm_ac->cw_max); in ieee80211_regulatory_limit_wmm_params()
972 qparam->aifs = max_t(u8, qparam->aifs, wmm_ac->aifsn); in ieee80211_regulatory_limit_wmm_params()
973 qparam->txop = min_t(u16, qparam->txop, wmm_ac->cot / 32); in ieee80211_regulatory_limit_wmm_params()
980 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_set_wmm_default()
981 struct ieee80211_local *local = sdata->local; in ieee80211_set_wmm_default() local
989 if (!local->ops->conf_tx) in ieee80211_set_wmm_default()
992 if (local->hw.queues < IEEE80211_NUM_ACS) in ieee80211_set_wmm_default()
998 chanctx_conf = rcu_dereference(link->conf->chanctx_conf); in ieee80211_set_wmm_default()
1000 chanctx_conf->def.chan->band == NL80211_BAND_2GHZ) && in ieee80211_set_wmm_default()
1001 !link->operating_11g_mode; in ieee80211_set_wmm_default()
1004 is_ocb = (sdata->vif.type == NL80211_IFTYPE_OCB); in ieee80211_set_wmm_default()
1006 /* Set defaults according to 802.11-2007 Table 7-37 */ in ieee80211_set_wmm_default()
1045 qparam.cw_min = (aCWmin + 1) / 2 - 1; in ieee80211_set_wmm_default()
1059 qparam.cw_max = (aCWmin + 1) / 2 - 1; in ieee80211_set_wmm_default()
1060 qparam.cw_min = (aCWmin + 1) / 4 - 1; in ieee80211_set_wmm_default()
1075 link->tx_conf[ac] = qparam; in ieee80211_set_wmm_default()
1076 drv_conf_tx(local, link, ac, &qparam); in ieee80211_set_wmm_default()
1079 if (sdata->vif.type != NL80211_IFTYPE_MONITOR && in ieee80211_set_wmm_default()
1080 sdata->vif.type != NL80211_IFTYPE_P2P_DEVICE && in ieee80211_set_wmm_default()
1081 sdata->vif.type != NL80211_IFTYPE_NAN) { in ieee80211_set_wmm_default()
1082 link->conf->qos = enable_qos; in ieee80211_set_wmm_default()
1095 struct ieee80211_local *local = sdata->local; in ieee80211_send_auth() local
1098 bool multi_link = ieee80211_vif_is_mld(&sdata->vif); in ieee80211_send_auth()
1107 .len = sizeof(mle) - 2, in ieee80211_send_auth()
1114 memcpy(mle.basic.mld_mac_addr, sdata->vif.addr, ETH_ALEN); in ieee80211_send_auth()
1117 skb = dev_alloc_skb(local->hw.extra_tx_headroom + IEEE80211_WEP_IV_LEN + in ieee80211_send_auth()
1123 skb_reserve(skb, local->hw.extra_tx_headroom + IEEE80211_WEP_IV_LEN); in ieee80211_send_auth()
1126 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | in ieee80211_send_auth()
1128 memcpy(mgmt->da, da, ETH_ALEN); in ieee80211_send_auth()
1129 memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); in ieee80211_send_auth()
1130 memcpy(mgmt->bssid, bssid, ETH_ALEN); in ieee80211_send_auth()
1131 mgmt->u.auth.auth_alg = cpu_to_le16(auth_alg); in ieee80211_send_auth()
1132 mgmt->u.auth.auth_transaction = cpu_to_le16(transaction); in ieee80211_send_auth()
1133 mgmt->u.auth.status_code = cpu_to_le16(status); in ieee80211_send_auth()
1140 mgmt->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); in ieee80211_send_auth()
1141 err = ieee80211_wep_encrypt(local, skb, key, key_len, key_idx); in ieee80211_send_auth()
1148 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT | in ieee80211_send_auth()
1158 struct ieee80211_local *local = sdata->local; in ieee80211_send_deauth_disassoc() local
1163 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | stype); in ieee80211_send_deauth_disassoc()
1164 mgmt->duration = 0; /* initialize only */ in ieee80211_send_deauth_disassoc()
1165 mgmt->seq_ctrl = 0; /* initialize only */ in ieee80211_send_deauth_disassoc()
1166 memcpy(mgmt->da, da, ETH_ALEN); in ieee80211_send_deauth_disassoc()
1167 memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); in ieee80211_send_deauth_disassoc()
1168 memcpy(mgmt->bssid, bssid, ETH_ALEN); in ieee80211_send_deauth_disassoc()
1170 mgmt->u.deauth.reason_code = cpu_to_le16(reason); in ieee80211_send_deauth_disassoc()
1173 skb = dev_alloc_skb(local->hw.extra_tx_headroom + in ieee80211_send_deauth_disassoc()
1178 skb_reserve(skb, local->hw.extra_tx_headroom); in ieee80211_send_deauth_disassoc()
1183 if (sdata->vif.type != NL80211_IFTYPE_STATION || in ieee80211_send_deauth_disassoc()
1184 !(sdata->u.mgd.flags & IEEE80211_STA_MFP_ENABLED)) in ieee80211_send_deauth_disassoc()
1185 IEEE80211_SKB_CB(skb)->flags |= in ieee80211_send_deauth_disassoc()
1196 return -ENOBUFS; in ieee80211_put_s1g_cap()
1201 skb_put_data(skb, &s1g_cap->cap, sizeof(s1g_cap->cap)); in ieee80211_put_s1g_cap()
1202 skb_put_data(skb, &s1g_cap->nss_mcs, sizeof(s1g_cap->nss_mcs)); in ieee80211_put_s1g_cap()
1216 struct ieee80211_local *local = sdata->local; in ieee80211_put_preq_ies_band() local
1225 sband = local->hw.wiphy->bands[band]; in ieee80211_put_preq_ies_band()
1233 return ieee80211_put_s1g_cap(skb, &sband->s1g_cap); in ieee80211_put_preq_ies_band()
1251 if (skb_tailroom(skb) < noffset - *offset) in ieee80211_put_preq_ies_band()
1252 return -ENOBUFS; in ieee80211_put_preq_ies_band()
1253 skb_put_data(skb, ie + *offset, noffset - *offset); in ieee80211_put_preq_ies_band()
1262 if (chandef->chan && sband->band == NL80211_BAND_2GHZ) { in ieee80211_put_preq_ies_band()
1264 return -ENOBUFS; in ieee80211_put_preq_ies_band()
1268 ieee80211_frequency_to_channel(chandef->chan->center_freq)); in ieee80211_put_preq_ies_band()
1287 if (skb_tailroom(skb) < noffset - *offset) in ieee80211_put_preq_ies_band()
1288 return -ENOBUFS; in ieee80211_put_preq_ies_band()
1289 skb_put_data(skb, ie + *offset, noffset - *offset); in ieee80211_put_preq_ies_band()
1293 if (sband->ht_cap.ht_supported) { in ieee80211_put_preq_ies_band()
1297 return -ENOBUFS; in ieee80211_put_preq_ies_band()
1300 ieee80211_ie_build_ht_cap(pos, &sband->ht_cap, in ieee80211_put_preq_ies_band()
1301 sband->ht_cap.cap); in ieee80211_put_preq_ies_band()
1317 /* 60 GHz (Multi-band, DMG, MMS) can't happen */ in ieee80211_put_preq_ies_band()
1322 if (skb_tailroom(skb) < noffset - *offset) in ieee80211_put_preq_ies_band()
1323 return -ENOBUFS; in ieee80211_put_preq_ies_band()
1324 skb_put_data(skb, ie + *offset, noffset - *offset); in ieee80211_put_preq_ies_band()
1329 for (i = 0; i < sband->n_channels; i++) { in ieee80211_put_preq_ies_band()
1330 if (sband->channels[i].flags & (IEEE80211_CHAN_DISABLED | in ieee80211_put_preq_ies_band()
1338 if (sband->vht_cap.vht_supported && have_80mhz) { in ieee80211_put_preq_ies_band()
1342 return -ENOBUFS; in ieee80211_put_preq_ies_band()
1345 ieee80211_ie_build_vht_cap(pos, &sband->vht_cap, in ieee80211_put_preq_ies_band()
1346 sband->vht_cap.cap); in ieee80211_put_preq_ies_band()
1363 if (skb_tailroom(skb) < noffset - *offset) in ieee80211_put_preq_ies_band()
1364 return -ENOBUFS; in ieee80211_put_preq_ies_band()
1365 skb_put_data(skb, ie + *offset, noffset - *offset); in ieee80211_put_preq_ies_band()
1369 if (cfg80211_any_usable_channels(local->hw.wiphy, BIT(sband->band), in ieee80211_put_preq_ies_band()
1376 if (cfg80211_any_usable_channels(local->hw.wiphy, BIT(sband->band), in ieee80211_put_preq_ies_band()
1390 * that calculates local->scan_ies_len. in ieee80211_put_preq_ies_band()
1411 ie_desc->ies[i] = skb_tail_pointer(skb); in ieee80211_put_preq_ies()
1419 ie_desc->len[i] = skb_tail_pointer(skb) - in ieee80211_put_preq_ies()
1420 ie_desc->ies[i]; in ieee80211_put_preq_ies()
1426 if (WARN_ONCE(skb_tailroom(skb) < ie_len - custom_ie_offset, in ieee80211_put_preq_ies()
1428 return -ENOBUFS; in ieee80211_put_preq_ies()
1429 ie_desc->common_ies = skb_tail_pointer(skb); in ieee80211_put_preq_ies()
1431 ie_len - custom_ie_offset); in ieee80211_put_preq_ies()
1432 ie_desc->common_ie_len = skb_tail_pointer(skb) - in ieee80211_put_preq_ies()
1433 ie_desc->common_ies; in ieee80211_put_preq_ies()
1453 return -ENOMEM; in ieee80211_build_preq_ies()
1464 if (skb->len > buffer_len) { in ieee80211_build_preq_ies()
1465 ret = -ENOBUFS; in ieee80211_build_preq_ies()
1469 memcpy(buffer, start, skb->len); in ieee80211_build_preq_ies()
1473 offs = ie_desc->ies[i] - start; in ieee80211_build_preq_ies()
1474 ie_desc->ies[i] = buffer + offs; in ieee80211_build_preq_ies()
1476 offs = ie_desc->common_ies - start; in ieee80211_build_preq_ies()
1477 ie_desc->common_ies = buffer + offs; in ieee80211_build_preq_ies()
1479 ret = skb->len; in ieee80211_build_preq_ies()
1493 struct ieee80211_local *local = sdata->local; in ieee80211_build_probe_req() local
1503 * badly-behaved APs don't respond when this parameter is included. in ieee80211_build_probe_req()
1505 chandef.width = sdata->vif.bss_conf.chanreq.oper.width; in ieee80211_build_probe_req()
1511 skb = ieee80211_probereq_get(&local->hw, src, ssid, ssid_len, in ieee80211_build_probe_req()
1512 local->scan_ies_len + ie_len); in ieee80211_build_probe_req()
1516 rate_masks[chan->band] = ratemask; in ieee80211_build_probe_req()
1518 ie, ie_len, BIT(chan->band), in ieee80211_build_probe_req()
1522 mgmt = (struct ieee80211_mgmt *) skb->data; in ieee80211_build_probe_req()
1523 memcpy(mgmt->da, dst, ETH_ALEN); in ieee80211_build_probe_req()
1524 memcpy(mgmt->bssid, dst, ETH_ALEN); in ieee80211_build_probe_req()
1527 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; in ieee80211_build_probe_req()
1541 sband = sdata->local->hw.wiphy->bands[band]; in ieee80211_sta_get_rates()
1546 ieee80211_chandef_rate_flags(&sdata->vif.bss_conf.chanreq.oper); in ieee80211_sta_get_rates()
1548 num_rates = sband->n_bitrates; in ieee80211_sta_get_rates()
1550 for (i = 0; i < elems->supp_rates_len + in ieee80211_sta_get_rates()
1551 elems->ext_supp_rates_len; i++) { in ieee80211_sta_get_rates()
1555 if (i < elems->supp_rates_len) in ieee80211_sta_get_rates()
1556 rate = elems->supp_rates[i]; in ieee80211_sta_get_rates()
1557 else if (elems->ext_supp_rates) in ieee80211_sta_get_rates()
1558 rate = elems->ext_supp_rates in ieee80211_sta_get_rates()
1559 [i - elems->supp_rates_len]; in ieee80211_sta_get_rates()
1568 if ((rate_flags & sband->bitrates[j].flags) in ieee80211_sta_get_rates()
1572 brate = sband->bitrates[j].bitrate; in ieee80211_sta_get_rates()
1584 void ieee80211_stop_device(struct ieee80211_local *local, bool suspend) in ieee80211_stop_device() argument
1587 ieee80211_handle_queued_frames(local); in ieee80211_stop_device()
1590 ieee80211_led_radio(local, false); in ieee80211_stop_device()
1591 ieee80211_mod_tpt_led_trig(local, 0, IEEE80211_TPT_LEDTRIG_FL_RADIO); in ieee80211_stop_device()
1593 wiphy_work_cancel(local->hw.wiphy, &local->reconfig_filter); in ieee80211_stop_device()
1595 flush_workqueue(local->workqueue); in ieee80211_stop_device()
1596 wiphy_work_flush(local->hw.wiphy, NULL); in ieee80211_stop_device()
1597 drv_stop(local, suspend); in ieee80211_stop_device()
1600 static void ieee80211_flush_completed_scan(struct ieee80211_local *local, in ieee80211_flush_completed_scan() argument
1610 if (test_bit(SCAN_COMPLETED, &local->scanning)) { in ieee80211_flush_completed_scan()
1612 * we don't attempt to continue a partial HW scan - which is in ieee80211_flush_completed_scan()
1617 set_bit(SCAN_ABORTED, &local->scanning); in ieee80211_flush_completed_scan()
1618 wiphy_delayed_work_queue(local->hw.wiphy, &local->scan_work, 0); in ieee80211_flush_completed_scan()
1619 wiphy_delayed_work_flush(local->hw.wiphy, &local->scan_work); in ieee80211_flush_completed_scan()
1623 static void ieee80211_handle_reconfig_failure(struct ieee80211_local *local) in ieee80211_handle_reconfig_failure() argument
1628 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_handle_reconfig_failure()
1640 local->resuming = false; in ieee80211_handle_reconfig_failure()
1641 local->suspended = false; in ieee80211_handle_reconfig_failure()
1642 local->in_reconfig = false; in ieee80211_handle_reconfig_failure()
1643 local->reconfig_failure = true; in ieee80211_handle_reconfig_failure()
1645 ieee80211_flush_completed_scan(local, true); in ieee80211_handle_reconfig_failure()
1648 * cfg80211 and clear local state in ieee80211_handle_reconfig_failure()
1650 ieee80211_sched_scan_end(local); in ieee80211_handle_reconfig_failure()
1652 list_for_each_entry(sdata, &local->interfaces, list) in ieee80211_handle_reconfig_failure()
1653 sdata->flags &= ~IEEE80211_SDATA_IN_DRIVER; in ieee80211_handle_reconfig_failure()
1658 list_for_each_entry(ctx, &local->chanctx_list, list) in ieee80211_handle_reconfig_failure()
1659 ctx->driver_present = false; in ieee80211_handle_reconfig_failure()
1662 static void ieee80211_assign_chanctx(struct ieee80211_local *local, in ieee80211_assign_chanctx() argument
1669 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_assign_chanctx()
1671 conf = rcu_dereference_protected(link->conf->chanctx_conf, in ieee80211_assign_chanctx()
1672 lockdep_is_held(&local->hw.wiphy->mtx)); in ieee80211_assign_chanctx()
1675 drv_assign_vif_chanctx(local, sdata, link->conf, ctx); in ieee80211_assign_chanctx()
1681 struct ieee80211_local *local = sdata->local; in ieee80211_reconfig_stations() local
1684 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_reconfig_stations()
1687 list_for_each_entry(sta, &local->sta_list, list) { in ieee80211_reconfig_stations()
1690 if (!sta->uploaded || sta->sdata != sdata) in ieee80211_reconfig_stations()
1694 state < sta->sta_state; state++) in ieee80211_reconfig_stations()
1695 WARN_ON(drv_sta_state(local, sta->sdata, sta, state, in ieee80211_reconfig_stations()
1705 res = drv_start_nan(sdata->local, sdata, in ieee80211_reconfig_nan()
1706 &sdata->u.nan.conf); in ieee80211_reconfig_nan()
1710 funcs = kcalloc(sdata->local->hw.max_nan_de_entries + 1, in ieee80211_reconfig_nan()
1714 return -ENOMEM; in ieee80211_reconfig_nan()
1720 spin_lock_bh(&sdata->u.nan.func_lock); in ieee80211_reconfig_nan()
1722 idr_for_each_entry(&sdata->u.nan.function_inst_ids, func, id) in ieee80211_reconfig_nan()
1725 spin_unlock_bh(&sdata->u.nan.func_lock); in ieee80211_reconfig_nan()
1728 res = drv_add_nan_func(sdata->local, sdata, funcs[i]); in ieee80211_reconfig_nan()
1730 ieee80211_nan_func_terminated(&sdata->vif, in ieee80211_reconfig_nan()
1731 funcs[i]->instance_id, in ieee80211_reconfig_nan()
1741 static void ieee80211_reconfig_ap_links(struct ieee80211_local *local, in ieee80211_reconfig_ap_links() argument
1747 for (link_id = 0; link_id < ARRAY_SIZE(sdata->link); link_id++) { in ieee80211_reconfig_ap_links()
1750 if (!(sdata->vif.active_links & BIT(link_id))) in ieee80211_reconfig_ap_links()
1753 link = sdata_dereference(sdata->link[link_id], sdata); in ieee80211_reconfig_ap_links()
1757 if (rcu_access_pointer(link->u.ap.beacon)) in ieee80211_reconfig_ap_links()
1758 drv_start_ap(local, sdata, link->conf); in ieee80211_reconfig_ap_links()
1760 if (!link->conf->enable_beacon) in ieee80211_reconfig_ap_links()
1770 int ieee80211_reconfig(struct ieee80211_local *local) in ieee80211_reconfig() argument
1772 struct ieee80211_hw *hw = &local->hw; in ieee80211_reconfig()
1781 bool suspended = local->suspended; in ieee80211_reconfig()
1784 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_reconfig()
1787 if (!local->open_count) in ieee80211_reconfig()
1792 local->resuming = true; in ieee80211_reconfig()
1794 if (local->wowlan) { in ieee80211_reconfig()
1798 * clear local->suspended so the device could operate in ieee80211_reconfig()
1801 local->suspended = false; in ieee80211_reconfig()
1802 res = drv_resume(local); in ieee80211_reconfig()
1803 local->wowlan = false; in ieee80211_reconfig()
1805 local->resuming = false; in ieee80211_reconfig()
1814 * restore local->suspended in this case. in ieee80211_reconfig()
1817 local->suspended = true; in ieee80211_reconfig()
1828 if (suspended && local->in_reconfig && !reconfig_due_to_wowlan) in ieee80211_reconfig()
1829 cancel_work_sync(&local->restart_work); in ieee80211_reconfig()
1831 local->started = false; in ieee80211_reconfig()
1839 res = drv_start(local); in ieee80211_reconfig()
1845 ieee80211_handle_reconfig_failure(local); in ieee80211_reconfig()
1850 drv_set_frag_threshold(local, hw->wiphy->frag_threshold); in ieee80211_reconfig()
1853 drv_set_rts_threshold(local, hw->wiphy->rts_threshold); in ieee80211_reconfig()
1856 drv_set_coverage_class(local, hw->wiphy->coverage_class); in ieee80211_reconfig()
1858 ieee80211_led_radio(local, true); in ieee80211_reconfig()
1859 ieee80211_mod_tpt_led_trig(local, in ieee80211_reconfig()
1863 sdata = wiphy_dereference(local->hw.wiphy, local->monitor_sdata); in ieee80211_reconfig()
1864 if (sdata && ieee80211_hw_check(&local->hw, WANT_MONITOR_VIF)) { in ieee80211_reconfig()
1866 WARN_ON(local->resuming); in ieee80211_reconfig()
1867 res = drv_add_interface(local, sdata); in ieee80211_reconfig()
1869 RCU_INIT_POINTER(local->monitor_sdata, NULL); in ieee80211_reconfig()
1875 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_reconfig()
1876 if (sdata->vif.type != NL80211_IFTYPE_AP_VLAN && in ieee80211_reconfig()
1877 sdata->vif.type != NL80211_IFTYPE_MONITOR && in ieee80211_reconfig()
1879 res = drv_add_interface(local, sdata); in ieee80211_reconfig()
1889 list_for_each_entry_continue_reverse(sdata, &local->interfaces, in ieee80211_reconfig()
1891 if (sdata->vif.type != NL80211_IFTYPE_AP_VLAN && in ieee80211_reconfig()
1892 sdata->vif.type != NL80211_IFTYPE_MONITOR && in ieee80211_reconfig()
1894 drv_remove_interface(local, sdata); in ieee80211_reconfig()
1895 ieee80211_handle_reconfig_failure(local); in ieee80211_reconfig()
1900 list_for_each_entry(ctx, &local->chanctx_list, list) in ieee80211_reconfig()
1901 if (ctx->replace_state != IEEE80211_CHANCTX_REPLACES_OTHER) in ieee80211_reconfig()
1902 WARN_ON(drv_add_chanctx(local, ctx)); in ieee80211_reconfig()
1904 sdata = wiphy_dereference(local->hw.wiphy, local->monitor_sdata); in ieee80211_reconfig()
1906 ieee80211_assign_chanctx(local, sdata, &sdata->deflink); in ieee80211_reconfig()
1909 ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_LISTEN_INTERVAL | in ieee80211_reconfig()
1915 ieee80211_configure_filter(local); in ieee80211_reconfig()
1918 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_reconfig()
1919 /* common change flags for all interface types - link only */ in ieee80211_reconfig()
1938 if (ieee80211_vif_is_mld(&sdata->vif)) { in ieee80211_reconfig()
1940 [0] = &sdata->vif.bss_conf, in ieee80211_reconfig()
1943 if (sdata->vif.type == NL80211_IFTYPE_STATION) { in ieee80211_reconfig()
1945 active_links = sdata->vif.active_links; in ieee80211_reconfig()
1946 link_id = ffs(active_links) - 1; in ieee80211_reconfig()
1947 sdata->vif.active_links = BIT(link_id); in ieee80211_reconfig()
1950 drv_change_vif_links(local, sdata, 0, in ieee80211_reconfig()
1951 sdata->vif.active_links, in ieee80211_reconfig()
1955 sdata->restart_active_links = active_links; in ieee80211_reconfig()
1958 link_id < ARRAY_SIZE(sdata->vif.link_conf); in ieee80211_reconfig()
1960 if (!ieee80211_vif_link_active(&sdata->vif, link_id)) in ieee80211_reconfig()
1963 link = sdata_dereference(sdata->link[link_id], sdata); in ieee80211_reconfig()
1967 ieee80211_assign_chanctx(local, sdata, link); in ieee80211_reconfig()
1970 switch (sdata->vif.type) { in ieee80211_reconfig()
1975 if (sdata->vif.cfg.ibss_joined) in ieee80211_reconfig()
1976 WARN_ON(drv_join_ibss(local, sdata)); in ieee80211_reconfig()
1983 drv_conf_tx(local, &sdata->deflink, i, in ieee80211_reconfig()
1984 &sdata->deflink.tx_conf[i]); in ieee80211_reconfig()
1988 if (sdata->vif.bss_conf.mu_mimo_owner) in ieee80211_reconfig()
1991 if (!ieee80211_vif_is_mld(&sdata->vif)) in ieee80211_reconfig()
1994 switch (sdata->vif.type) { in ieee80211_reconfig()
1996 if (!ieee80211_vif_is_mld(&sdata->vif)) { in ieee80211_reconfig()
2001 /* Re-send beacon info report to the driver */ in ieee80211_reconfig()
2002 if (sdata->deflink.u.mgd.have_beacon) in ieee80211_reconfig()
2005 if (sdata->vif.bss_conf.max_idle_period || in ieee80211_reconfig()
2006 sdata->vif.bss_conf.protected_keep_alive) in ieee80211_reconfig()
2031 if (ieee80211_vif_is_mld(&sdata->vif)) in ieee80211_reconfig()
2037 if (sdata->vif.bss_conf.ftm_responder == 1 && in ieee80211_reconfig()
2038 wiphy_ext_feature_isset(sdata->local->hw.wiphy, in ieee80211_reconfig()
2042 if (sdata->vif.type == NL80211_IFTYPE_AP) { in ieee80211_reconfig()
2045 if (ieee80211_vif_is_mld(&sdata->vif)) { in ieee80211_reconfig()
2046 ieee80211_reconfig_ap_links(local, in ieee80211_reconfig()
2052 if (rcu_access_pointer(sdata->deflink.u.ap.beacon)) in ieee80211_reconfig()
2053 drv_start_ap(local, sdata, in ieee80211_reconfig()
2054 sdata->deflink.conf); in ieee80211_reconfig()
2058 if (sdata->vif.bss_conf.enable_beacon) { in ieee80211_reconfig()
2067 ieee80211_handle_reconfig_failure(local); in ieee80211_reconfig()
2086 ieee80211_recalc_ps(local); in ieee80211_reconfig()
2094 if (!(local->hw.conf.flags & IEEE80211_CONF_PS)) { in ieee80211_reconfig()
2095 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_reconfig()
2096 if (sdata->vif.type != NL80211_IFTYPE_STATION) in ieee80211_reconfig()
2098 if (!sdata->u.mgd.associated) in ieee80211_reconfig()
2101 ieee80211_send_nullfunc(local, sdata, false); in ieee80211_reconfig()
2106 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_reconfig()
2110 switch (sdata->vif.type) { in ieee80211_reconfig()
2121 list_for_each_entry(sdata, &local->interfaces, list) in ieee80211_reconfig()
2124 /* re-enable multi-link for client interfaces */ in ieee80211_reconfig()
2125 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_reconfig()
2126 if (sdata->restart_active_links) in ieee80211_reconfig()
2127 ieee80211_set_active_links(&sdata->vif, in ieee80211_reconfig()
2128 sdata->restart_active_links); in ieee80211_reconfig()
2131 * before reconfig, it will do nothing, so re-schedule. in ieee80211_reconfig()
2133 if (sdata->desired_active_links) in ieee80211_reconfig()
2134 wiphy_work_queue(sdata->local->hw.wiphy, in ieee80211_reconfig()
2135 &sdata->activate_links_work); in ieee80211_reconfig()
2139 sched_scan_sdata = rcu_dereference_protected(local->sched_scan_sdata, in ieee80211_reconfig()
2140 lockdep_is_held(&local->hw.wiphy->mtx)); in ieee80211_reconfig()
2141 sched_scan_req = rcu_dereference_protected(local->sched_scan_req, in ieee80211_reconfig()
2142 lockdep_is_held(&local->hw.wiphy->mtx)); in ieee80211_reconfig()
2151 if (sched_scan_req->n_scan_plans > 1 || in ieee80211_reconfig()
2154 RCU_INIT_POINTER(local->sched_scan_sdata, NULL); in ieee80211_reconfig()
2155 RCU_INIT_POINTER(local->sched_scan_req, NULL); in ieee80211_reconfig()
2160 cfg80211_sched_scan_stopped_locked(local->hw.wiphy, 0); in ieee80211_reconfig()
2164 if (local->monitors == local->open_count && local->monitors > 0) in ieee80211_reconfig()
2165 ieee80211_add_virtual_monitor(local); in ieee80211_reconfig()
2178 list_for_each_entry(sta, &local->sta_list, list) { in ieee80211_reconfig()
2179 if (!local->resuming) in ieee80211_reconfig()
2190 if (local->open_count && (!suspended || reconfig_due_to_wowlan)) in ieee80211_reconfig()
2191 drv_reconfig_complete(local, IEEE80211_RECONFIG_TYPE_RESTART); in ieee80211_reconfig()
2193 if (local->in_reconfig) { in ieee80211_reconfig()
2194 in_reconfig = local->in_reconfig; in ieee80211_reconfig()
2195 local->in_reconfig = false; in ieee80211_reconfig()
2198 ieee80211_reconfig_roc(local); in ieee80211_reconfig()
2201 list_for_each_entry(sdata, &local->interfaces, list) in ieee80211_reconfig()
2202 wiphy_work_queue(local->hw.wiphy, &sdata->work); in ieee80211_reconfig()
2210 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_reconfig()
2213 if (sdata->vif.type == NL80211_IFTYPE_STATION) in ieee80211_reconfig()
2223 local->suspended = false; in ieee80211_reconfig()
2225 local->resuming = false; in ieee80211_reconfig()
2227 ieee80211_flush_completed_scan(local, false); in ieee80211_reconfig()
2229 if (local->open_count && !reconfig_due_to_wowlan) in ieee80211_reconfig()
2230 drv_reconfig_complete(local, IEEE80211_RECONFIG_TYPE_SUSPEND); in ieee80211_reconfig()
2232 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_reconfig()
2235 if (sdata->vif.type == NL80211_IFTYPE_STATION) in ieee80211_reconfig()
2239 mod_timer(&local->sta_cleanup, jiffies + 1); in ieee80211_reconfig()
2250 struct ieee80211_local *local; in ieee80211_reconfig_disconnect() local
2257 local = sdata->local; in ieee80211_reconfig_disconnect()
2259 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_reconfig_disconnect()
2262 !local->resuming)) in ieee80211_reconfig_disconnect()
2266 !local->in_reconfig)) in ieee80211_reconfig_disconnect()
2269 if (WARN_ON(vif->type != NL80211_IFTYPE_STATION)) in ieee80211_reconfig_disconnect()
2272 sdata->flags |= flag; in ieee80211_reconfig_disconnect()
2274 list_for_each_entry(key, &sdata->key_list, list) in ieee80211_reconfig_disconnect()
2275 key->flags |= KEY_FLAG_TAINTED; in ieee80211_reconfig_disconnect()
2293 struct ieee80211_local *local = sdata->local; in ieee80211_recalc_smps() local
2297 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_recalc_smps()
2299 chanctx_conf = rcu_dereference_protected(link->conf->chanctx_conf, in ieee80211_recalc_smps()
2300 lockdep_is_held(&local->hw.wiphy->mtx)); in ieee80211_recalc_smps()
2312 ieee80211_recalc_smps_chanctx(local, chanctx); in ieee80211_recalc_smps()
2318 struct ieee80211_local *local = sdata->local; in ieee80211_recalc_min_chandef() local
2323 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_recalc_min_chandef()
2325 for (i = 0; i < ARRAY_SIZE(sdata->vif.link_conf); i++) { in ieee80211_recalc_min_chandef()
2332 bss_conf = rcu_dereference(sdata->vif.link_conf[i]); in ieee80211_recalc_min_chandef()
2338 chanctx_conf = rcu_dereference_protected(bss_conf->chanctx_conf, in ieee80211_recalc_min_chandef()
2339 lockdep_is_held(&local->hw.wiphy->mtx)); in ieee80211_recalc_min_chandef()
2344 * the mutex. Just the way we reached it could - in in ieee80211_recalc_min_chandef()
2345 * theory - go away, but we don't really care and in ieee80211_recalc_min_chandef()
2355 ieee80211_recalc_chanctx_min_def(local, chanctx, NULL, false); in ieee80211_recalc_min_chandef()
2370 u16 cap) in ieee80211_ie_build_ht_cap() argument
2379 tmp = cpu_to_le16(cap); in ieee80211_ie_build_ht_cap()
2384 *pos++ = ht_cap->ampdu_factor | in ieee80211_ie_build_ht_cap()
2385 (ht_cap->ampdu_density << in ieee80211_ie_build_ht_cap()
2389 memcpy(pos, &ht_cap->mcs, sizeof(ht_cap->mcs)); in ieee80211_ie_build_ht_cap()
2390 pos += sizeof(ht_cap->mcs); in ieee80211_ie_build_ht_cap()
2405 u32 cap) in ieee80211_ie_build_vht_cap() argument
2414 tmp = cpu_to_le32(cap); in ieee80211_ie_build_vht_cap()
2419 memcpy(pos, &vht_cap->vht_mcs, sizeof(vht_cap->vht_mcs)); in ieee80211_ie_build_vht_cap()
2420 pos += sizeof(vht_cap->vht_mcs); in ieee80211_ie_build_vht_cap()
2436 he_cap = ieee80211_get_he_iftype_cap_vif(sband, &sdata->vif); in ieee80211_ie_len_he_cap()
2440 n = ieee80211_he_mcs_nss_size(&he_cap->he_cap_elem); in ieee80211_ie_len_he_cap()
2442 sizeof(he_cap->he_cap_elem) + n + in ieee80211_ie_len_he_cap()
2443 ieee80211_he_ppe_size(he_cap->ppe_thres[0], in ieee80211_ie_len_he_cap()
2444 he_cap->he_cap_elem.phy_cap_info); in ieee80211_ie_len_he_cap()
2454 *elem = he_cap->he_cap_elem; in ieee80211_get_adjusted_he_cap()
2456 switch (conn->bw_limit) { in ieee80211_get_adjusted_he_cap()
2471 max_ru = elem->phy_cap_info[8] & IEEE80211_HE_PHY_CAP8_DCM_MAX_RU_MASK; in ieee80211_get_adjusted_he_cap()
2473 elem->phy_cap_info[8] &= ~IEEE80211_HE_PHY_CAP8_DCM_MAX_RU_MASK; in ieee80211_get_adjusted_he_cap()
2474 elem->phy_cap_info[8] |= max_ru; in ieee80211_get_adjusted_he_cap()
2476 if (conn->bw_limit < IEEE80211_CONN_BW_LIMIT_40) { in ieee80211_get_adjusted_he_cap()
2477 elem->phy_cap_info[0] &= in ieee80211_get_adjusted_he_cap()
2480 elem->phy_cap_info[9] &= in ieee80211_get_adjusted_he_cap()
2484 if (conn->bw_limit < IEEE80211_CONN_BW_LIMIT_160) { in ieee80211_get_adjusted_he_cap()
2485 elem->phy_cap_info[0] &= in ieee80211_get_adjusted_he_cap()
2488 elem->phy_cap_info[5] &= in ieee80211_get_adjusted_he_cap()
2490 elem->phy_cap_info[7] &= in ieee80211_get_adjusted_he_cap()
2510 he_cap = ieee80211_get_he_iftype_cap_vif(sband, &sdata->vif); in ieee80211_put_he_cap()
2519 sizeof(he_cap->he_cap_elem) + n + in ieee80211_put_he_cap()
2520 ieee80211_he_ppe_size(he_cap->ppe_thres[0], in ieee80211_put_he_cap()
2521 he_cap->he_cap_elem.phy_cap_info); in ieee80211_put_he_cap()
2524 return -ENOBUFS; in ieee80211_put_he_cap()
2527 len = skb_put(skb, 1); /* We'll set the size later below */ in ieee80211_put_he_cap()
2533 skb_put_data(skb, &he_cap->he_mcs_nss_supp, n); in ieee80211_put_he_cap()
2536 if ((he_cap->he_cap_elem.phy_cap_info[6] & in ieee80211_put_he_cap()
2544 n = hweight8(he_cap->ppe_thres[0] & in ieee80211_put_he_cap()
2546 n *= (1 + ((he_cap->ppe_thres[0] & IEEE80211_PPE_THRES_NSS_MASK) >> in ieee80211_put_he_cap()
2551 * total size. in ieee80211_put_he_cap()
2557 skb_put_data(skb, &he_cap->ppe_thres, n); in ieee80211_put_he_cap()
2560 *len = skb_tail_pointer(skb) - len - 1; in ieee80211_put_he_cap()
2570 enum nl80211_iftype iftype = ieee80211_vif_type_p2p(&sdata->vif); in ieee80211_put_he_6ghz_cap()
2571 __le16 cap; in ieee80211_put_he_6ghz_cap() local
2573 if (!cfg80211_any_usable_channels(sdata->local->hw.wiphy, in ieee80211_put_he_6ghz_cap()
2578 sband = sdata->local->hw.wiphy->bands[NL80211_BAND_6GHZ]; in ieee80211_put_he_6ghz_cap()
2585 if (!iftd->he_6ghz_capa.capa) in ieee80211_put_he_6ghz_cap()
2588 cap = iftd->he_6ghz_capa.capa; in ieee80211_put_he_6ghz_cap()
2589 cap &= cpu_to_le16(~IEEE80211_HE_6GHZ_CAP_SM_PS); in ieee80211_put_he_6ghz_cap()
2597 cap |= le16_encode_bits(WLAN_HT_CAP_SM_PS_DISABLED, in ieee80211_put_he_6ghz_cap()
2601 cap |= le16_encode_bits(WLAN_HT_CAP_SM_PS_STATIC, in ieee80211_put_he_6ghz_cap()
2605 cap |= le16_encode_bits(WLAN_HT_CAP_SM_PS_DYNAMIC, in ieee80211_put_he_6ghz_cap()
2610 if (skb_tailroom(skb) < 2 + 1 + sizeof(cap)) in ieee80211_put_he_6ghz_cap()
2611 return -ENOBUFS; in ieee80211_put_he_6ghz_cap()
2614 skb_put_u8(skb, 1 + sizeof(cap)); in ieee80211_put_he_6ghz_cap()
2616 skb_put_data(skb, &cap, sizeof(cap)); in ieee80211_put_he_6ghz_cap()
2629 ht_oper->primary_chan = ieee80211_frequency_to_channel( in ieee80211_ie_build_ht_oper()
2630 chandef->chan->center_freq); in ieee80211_ie_build_ht_oper()
2631 switch (chandef->width) { in ieee80211_ie_build_ht_oper()
2636 if (chandef->center_freq1 > chandef->chan->center_freq) in ieee80211_ie_build_ht_oper()
2637 ht_oper->ht_param = IEEE80211_HT_PARAM_CHA_SEC_ABOVE; in ieee80211_ie_build_ht_oper()
2639 ht_oper->ht_param = IEEE80211_HT_PARAM_CHA_SEC_BELOW; in ieee80211_ie_build_ht_oper()
2646 ht_oper->ht_param = IEEE80211_HT_PARAM_CHA_SEC_NONE; in ieee80211_ie_build_ht_oper()
2649 if (ht_cap->cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40 && in ieee80211_ie_build_ht_oper()
2650 chandef->width != NL80211_CHAN_WIDTH_20_NOHT && in ieee80211_ie_build_ht_oper()
2651 chandef->width != NL80211_CHAN_WIDTH_20) in ieee80211_ie_build_ht_oper()
2652 ht_oper->ht_param |= IEEE80211_HT_PARAM_CHAN_WIDTH_ANY; in ieee80211_ie_build_ht_oper()
2655 ht_oper->ht_param |= IEEE80211_HT_PARAM_RIFS_MODE; in ieee80211_ie_build_ht_oper()
2657 ht_oper->operation_mode = cpu_to_le16(prot_mode); in ieee80211_ie_build_ht_oper()
2658 ht_oper->stbc_param = 0x0000; in ieee80211_ie_build_ht_oper()
2662 memset(&ht_oper->basic_set, 0, 16); in ieee80211_ie_build_ht_oper()
2663 memcpy(&ht_oper->basic_set, &ht_cap->mcs, 10); in ieee80211_ie_build_ht_oper()
2674 switch (chandef->width) { in ieee80211_ie_build_wide_bw_cs()
2693 *pos++ = ieee80211_frequency_to_channel(chandef->center_freq1); in ieee80211_ie_build_wide_bw_cs()
2695 if (chandef->center_freq2) in ieee80211_ie_build_wide_bw_cs()
2696 *pos++ = ieee80211_frequency_to_channel(chandef->center_freq2); in ieee80211_ie_build_wide_bw_cs()
2709 vht_oper->center_freq_seg0_idx = ieee80211_frequency_to_channel( in ieee80211_ie_build_vht_oper()
2710 chandef->center_freq1); in ieee80211_ie_build_vht_oper()
2711 if (chandef->center_freq2) in ieee80211_ie_build_vht_oper()
2712 vht_oper->center_freq_seg1_idx = in ieee80211_ie_build_vht_oper()
2713 ieee80211_frequency_to_channel(chandef->center_freq2); in ieee80211_ie_build_vht_oper()
2715 vht_oper->center_freq_seg1_idx = 0x00; in ieee80211_ie_build_vht_oper()
2717 switch (chandef->width) { in ieee80211_ie_build_vht_oper()
2723 vht_oper->chan_width = IEEE80211_VHT_CHANWIDTH_80MHZ; in ieee80211_ie_build_vht_oper()
2724 vht_oper->center_freq_seg1_idx = vht_oper->center_freq_seg0_idx; in ieee80211_ie_build_vht_oper()
2725 if (chandef->chan->center_freq < chandef->center_freq1) in ieee80211_ie_build_vht_oper()
2726 vht_oper->center_freq_seg0_idx -= 8; in ieee80211_ie_build_vht_oper()
2728 vht_oper->center_freq_seg0_idx += 8; in ieee80211_ie_build_vht_oper()
2735 vht_oper->chan_width = IEEE80211_VHT_CHANWIDTH_80MHZ; in ieee80211_ie_build_vht_oper()
2738 vht_oper->chan_width = IEEE80211_VHT_CHANWIDTH_80MHZ; in ieee80211_ie_build_vht_oper()
2745 vht_oper->chan_width = IEEE80211_VHT_CHANWIDTH_USE_HT; in ieee80211_ie_build_vht_oper()
2750 vht_oper->basic_mcs_set = cpu_to_le16(0xffff); in ieee80211_ie_build_vht_oper()
2762 if (chandef->chan->band == NL80211_BAND_6GHZ) in ieee80211_ie_build_he_oper()
2776 if (chandef->chan->band == NL80211_BAND_6GHZ) in ieee80211_ie_build_he_oper()
2781 he_oper->he_oper_params = cpu_to_le32(he_oper_params); in ieee80211_ie_build_he_oper()
2784 he_oper->he_mcs_nss_set = cpu_to_le16(0xffff); in ieee80211_ie_build_he_oper()
2787 if (chandef->chan->band != NL80211_BAND_6GHZ) in ieee80211_ie_build_he_oper()
2792 he_6ghz_op->minrate = 6; /* 6 Mbps */ in ieee80211_ie_build_he_oper()
2793 he_6ghz_op->primary = in ieee80211_ie_build_he_oper()
2794 ieee80211_frequency_to_channel(chandef->chan->center_freq); in ieee80211_ie_build_he_oper()
2795 he_6ghz_op->ccfs0 = in ieee80211_ie_build_he_oper()
2796 ieee80211_frequency_to_channel(chandef->center_freq1); in ieee80211_ie_build_he_oper()
2797 if (chandef->center_freq2) in ieee80211_ie_build_he_oper()
2798 he_6ghz_op->ccfs1 = in ieee80211_ie_build_he_oper()
2799 ieee80211_frequency_to_channel(chandef->center_freq2); in ieee80211_ie_build_he_oper()
2801 he_6ghz_op->ccfs1 = 0; in ieee80211_ie_build_he_oper()
2803 switch (chandef->width) { in ieee80211_ie_build_he_oper()
2815 he_6ghz_op->control = in ieee80211_ie_build_he_oper()
2817 he_6ghz_op->ccfs1 = he_6ghz_op->ccfs0; in ieee80211_ie_build_he_oper()
2818 if (chandef->chan->center_freq < chandef->center_freq1) in ieee80211_ie_build_he_oper()
2819 he_6ghz_op->ccfs0 -= 8; in ieee80211_ie_build_he_oper()
2821 he_6ghz_op->ccfs0 += 8; in ieee80211_ie_build_he_oper()
2824 he_6ghz_op->control = in ieee80211_ie_build_he_oper()
2828 he_6ghz_op->control = in ieee80211_ie_build_he_oper()
2832 he_6ghz_op->control = in ieee80211_ie_build_he_oper()
2836 he_6ghz_op->control = in ieee80211_ie_build_he_oper()
2852 &eht_cap->eht_mcs_nss_supp.only_20mhz; in ieee80211_ie_build_eht_oper()
2866 memcpy(&eht_oper->basic_mcs_nss, eht_mcs_nss, sizeof(*eht_mcs_nss)); in ieee80211_ie_build_eht_oper()
2867 eht_oper->params |= IEEE80211_EHT_OPER_INFO_PRESENT; in ieee80211_ie_build_eht_oper()
2871 (struct ieee80211_eht_operation_info *)eht_oper->optional; in ieee80211_ie_build_eht_oper()
2873 eht_oper_info->ccfs0 = in ieee80211_ie_build_eht_oper()
2874 ieee80211_frequency_to_channel(chandef->center_freq1); in ieee80211_ie_build_eht_oper()
2875 if (chandef->center_freq2) in ieee80211_ie_build_eht_oper()
2876 eht_oper_info->ccfs1 = in ieee80211_ie_build_eht_oper()
2877 ieee80211_frequency_to_channel(chandef->center_freq2); in ieee80211_ie_build_eht_oper()
2879 eht_oper_info->ccfs1 = 0; in ieee80211_ie_build_eht_oper()
2881 switch (chandef->width) { in ieee80211_ie_build_eht_oper()
2884 eht_oper_info->ccfs1 = eht_oper_info->ccfs0; in ieee80211_ie_build_eht_oper()
2885 if (chandef->chan->center_freq < chandef->center_freq1) in ieee80211_ie_build_eht_oper()
2886 eht_oper_info->ccfs0 -= 16; in ieee80211_ie_build_eht_oper()
2888 eht_oper_info->ccfs0 += 16; in ieee80211_ie_build_eht_oper()
2891 eht_oper_info->ccfs1 = eht_oper_info->ccfs0; in ieee80211_ie_build_eht_oper()
2892 if (chandef->chan->center_freq < chandef->center_freq1) in ieee80211_ie_build_eht_oper()
2893 eht_oper_info->ccfs0 -= 8; in ieee80211_ie_build_eht_oper()
2895 eht_oper_info->ccfs0 += 8; in ieee80211_ie_build_eht_oper()
2910 eht_oper_info->control = chan_width; in ieee80211_ie_build_eht_oper()
2913 /* TODO: eht_oper_info->optional */ in ieee80211_ie_build_eht_oper()
2926 switch (ht_oper->ht_param & IEEE80211_HT_PARAM_CHA_SEC_OFFSET) { in ieee80211_chandef_ht_oper()
2940 cfg80211_chandef_create(chandef, chandef->chan, channel_type); in ieee80211_chandef_ht_oper()
2964 vht_cap = hw->wiphy->bands[chandef->chan->band]->vht_cap.cap; in ieee80211_chandef_vht_oper()
2973 ccfs0 = oper->center_freq_seg0_idx; in ieee80211_chandef_vht_oper()
2974 ccfs1 = oper->center_freq_seg1_idx; in ieee80211_chandef_vht_oper()
2975 ccfs2 = (le16_to_cpu(htop->operation_mode) & in ieee80211_chandef_vht_oper()
2986 * Cf. IEEE 802.11 Table 9-250 in ieee80211_chandef_vht_oper()
3022 cf0 = ieee80211_channel_to_frequency(ccf0, chandef->chan->band); in ieee80211_chandef_vht_oper()
3023 cf1 = ieee80211_channel_to_frequency(ccf1, chandef->chan->band); in ieee80211_chandef_vht_oper()
3025 switch (oper->chan_width) { in ieee80211_chandef_vht_oper()
3036 diff = abs(ccf1 - ccf0); in ieee80211_chandef_vht_oper()
3071 chandef->center_freq1 = in ieee80211_chandef_eht_oper()
3072 ieee80211_channel_to_frequency(info->ccfs0, in ieee80211_chandef_eht_oper()
3073 chandef->chan->band); in ieee80211_chandef_eht_oper()
3075 switch (u8_get_bits(info->control, in ieee80211_chandef_eht_oper()
3078 chandef->width = NL80211_CHAN_WIDTH_20; in ieee80211_chandef_eht_oper()
3081 chandef->width = NL80211_CHAN_WIDTH_40; in ieee80211_chandef_eht_oper()
3084 chandef->width = NL80211_CHAN_WIDTH_80; in ieee80211_chandef_eht_oper()
3087 chandef->width = NL80211_CHAN_WIDTH_160; in ieee80211_chandef_eht_oper()
3088 chandef->center_freq1 = in ieee80211_chandef_eht_oper()
3089 ieee80211_channel_to_frequency(info->ccfs1, in ieee80211_chandef_eht_oper()
3090 chandef->chan->band); in ieee80211_chandef_eht_oper()
3093 chandef->width = NL80211_CHAN_WIDTH_320; in ieee80211_chandef_eht_oper()
3094 chandef->center_freq1 = in ieee80211_chandef_eht_oper()
3095 ieee80211_channel_to_frequency(info->ccfs1, in ieee80211_chandef_eht_oper()
3096 chandef->chan->band); in ieee80211_chandef_eht_oper()
3101 bool ieee80211_chandef_he_6ghz_oper(struct ieee80211_local *local, in ieee80211_chandef_he_6ghz_oper() argument
3110 if (chandef->chan->band != NL80211_BAND_6GHZ) in ieee80211_chandef_he_6ghz_oper()
3125 freq = ieee80211_channel_to_frequency(he_6ghz_oper->primary, in ieee80211_chandef_he_6ghz_oper()
3127 he_chandef.chan = ieee80211_get_channel(local->hw.wiphy, freq); in ieee80211_chandef_he_6ghz_oper()
3133 !(eht_oper->params & IEEE80211_EHT_OPER_INFO_PRESENT)) { in ieee80211_chandef_he_6ghz_oper()
3134 switch (u8_get_bits(he_6ghz_oper->control, in ieee80211_chandef_he_6ghz_oper()
3147 if (!he_6ghz_oper->ccfs1) in ieee80211_chandef_he_6ghz_oper()
3149 if (abs(he_6ghz_oper->ccfs1 - he_6ghz_oper->ccfs0) == 8) in ieee80211_chandef_he_6ghz_oper()
3158 ieee80211_channel_to_frequency(he_6ghz_oper->ccfs1, in ieee80211_chandef_he_6ghz_oper()
3162 ieee80211_channel_to_frequency(he_6ghz_oper->ccfs0, in ieee80211_chandef_he_6ghz_oper()
3165 ieee80211_channel_to_frequency(he_6ghz_oper->ccfs1, in ieee80211_chandef_he_6ghz_oper()
3169 ieee80211_chandef_eht_oper((const void *)eht_oper->optional, in ieee80211_chandef_he_6ghz_oper()
3191 switch (FIELD_GET(S1G_OPER_CH_WIDTH_OPER, oper->ch_width)) { in ieee80211_chandef_s1g_oper()
3193 chandef->width = NL80211_CHAN_WIDTH_1; in ieee80211_chandef_s1g_oper()
3196 chandef->width = NL80211_CHAN_WIDTH_2; in ieee80211_chandef_s1g_oper()
3199 chandef->width = NL80211_CHAN_WIDTH_4; in ieee80211_chandef_s1g_oper()
3202 chandef->width = NL80211_CHAN_WIDTH_8; in ieee80211_chandef_s1g_oper()
3205 chandef->width = NL80211_CHAN_WIDTH_16; in ieee80211_chandef_s1g_oper()
3211 oper_freq = ieee80211_channel_to_freq_khz(oper->oper_ch, in ieee80211_chandef_s1g_oper()
3213 chandef->center_freq1 = KHZ_TO_MHZ(oper_freq); in ieee80211_chandef_s1g_oper()
3214 chandef->freq1_offset = oper_freq % 1000; in ieee80211_chandef_s1g_oper()
3227 for (i = 0; i < sband->n_bitrates; i++) { in ieee80211_put_srates_elem()
3228 if ((rate_flags & sband->bitrates[i].flags) != rate_flags) in ieee80211_put_srates_elem()
3242 rates -= skip; in ieee80211_put_srates_elem()
3246 return -ENOBUFS; in ieee80211_put_srates_elem()
3251 for (i = 0; i < sband->n_bitrates && rates; i++) { in ieee80211_put_srates_elem()
3255 if ((rate_flags & sband->bitrates[i].flags) != rate_flags) in ieee80211_put_srates_elem()
3261 skip--; in ieee80211_put_srates_elem()
3267 rate = DIV_ROUND_UP(sband->bitrates[i].bitrate, 5); in ieee80211_put_srates_elem()
3269 rates--; in ieee80211_put_srates_elem()
3282 if (WARN_ON_ONCE(sdata->vif.type != NL80211_IFTYPE_STATION)) in ieee80211_ave_rssi()
3285 return -ewma_beacon_signal_read(&sdata->deflink.u.mgd.ave_beacon_signal); in ieee80211_ave_rssi()
3296 if (mcs->rx_mask[3]) in ieee80211_mcs_to_chains()
3298 if (mcs->rx_mask[2]) in ieee80211_mcs_to_chains()
3300 if (mcs->rx_mask[1]) in ieee80211_mcs_to_chains()
3306 * ieee80211_calculate_rx_timestamp - calculate timestamp in frame
3307 * @local: mac80211 hw info struct
3318 u64 ieee80211_calculate_rx_timestamp(struct ieee80211_local *local, in ieee80211_calculate_rx_timestamp() argument
3323 u64 ts = status->mactime; in ieee80211_calculate_rx_timestamp()
3332 mactime_plcp_start = (status->flag & RX_FLAG_MACTIME) == in ieee80211_calculate_rx_timestamp()
3337 ri.bw = status->bw; in ieee80211_calculate_rx_timestamp()
3340 switch (status->encoding) { in ieee80211_calculate_rx_timestamp()
3343 ri.mcs = status->rate_idx; in ieee80211_calculate_rx_timestamp()
3344 ri.nss = status->nss; in ieee80211_calculate_rx_timestamp()
3345 ri.eht_ru_alloc = status->eht.ru; in ieee80211_calculate_rx_timestamp()
3346 if (status->enc_flags & RX_ENC_FLAG_SHORT_GI) in ieee80211_calculate_rx_timestamp()
3356 ri.mcs = status->rate_idx; in ieee80211_calculate_rx_timestamp()
3357 ri.nss = status->nss; in ieee80211_calculate_rx_timestamp()
3358 ri.he_ru_alloc = status->he_ru; in ieee80211_calculate_rx_timestamp()
3359 if (status->enc_flags & RX_ENC_FLAG_SHORT_GI) in ieee80211_calculate_rx_timestamp()
3372 * For HE MU PPDU, add the HE-SIG-B. in ieee80211_calculate_rx_timestamp()
3373 * For HE ER PPDU, add 8us for the HE-SIG-A. in ieee80211_calculate_rx_timestamp()
3374 * For HE TB PPDU, add 4us for the HE-STF. in ieee80211_calculate_rx_timestamp()
3375 * Add the HE-LTF durations - variable. in ieee80211_calculate_rx_timestamp()
3381 ri.mcs = status->rate_idx; in ieee80211_calculate_rx_timestamp()
3383 if (status->enc_flags & RX_ENC_FLAG_SHORT_GI) in ieee80211_calculate_rx_timestamp()
3392 if (status->enc_flags & RX_ENC_FLAG_HT_GF) in ieee80211_calculate_rx_timestamp()
3398 * Add Data HT-LTFs per streams in ieee80211_calculate_rx_timestamp()
3399 * TODO: add Extension HT-LTFs, 4us per LTF in ieee80211_calculate_rx_timestamp()
3409 ri.mcs = status->rate_idx; in ieee80211_calculate_rx_timestamp()
3410 ri.nss = status->nss; in ieee80211_calculate_rx_timestamp()
3411 if (status->enc_flags & RX_ENC_FLAG_SHORT_GI) in ieee80211_calculate_rx_timestamp()
3423 * Add VHT-LTFs per streams in ieee80211_calculate_rx_timestamp()
3437 sband = local->hw.wiphy->bands[status->band]; in ieee80211_calculate_rx_timestamp()
3438 ri.legacy = sband->bitrates[status->rate_idx].bitrate; in ieee80211_calculate_rx_timestamp()
3441 if (status->band == NL80211_BAND_5GHZ) { in ieee80211_calculate_rx_timestamp()
3444 } else if (status->enc_flags & RX_ENC_FLAG_SHORTPRE) { in ieee80211_calculate_rx_timestamp()
3457 (unsigned long long)status->flag, status->rate_idx, in ieee80211_calculate_rx_timestamp()
3458 status->nss)) in ieee80211_calculate_rx_timestamp()
3462 if ((status->flag & RX_FLAG_MACTIME) == RX_FLAG_MACTIME_END) in ieee80211_calculate_rx_timestamp()
3463 ts -= mpdu_len * 8 * 10 / rate; in ieee80211_calculate_rx_timestamp()
3470 /* Cancel CAC for the interfaces under the specified @local. If @ctx is
3473 void ieee80211_dfs_cac_cancel(struct ieee80211_local *local, in ieee80211_dfs_cac_cancel() argument
3482 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_dfs_cac_cancel()
3484 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_dfs_cac_cancel()
3487 link = sdata_dereference(sdata->link[link_id], in ieee80211_dfs_cac_cancel()
3492 chanctx_conf = sdata_dereference(link->conf->chanctx_conf, in ieee80211_dfs_cac_cancel()
3494 if (ctx && &ctx->conf != chanctx_conf) in ieee80211_dfs_cac_cancel()
3497 wiphy_delayed_work_cancel(local->hw.wiphy, in ieee80211_dfs_cac_cancel()
3498 &link->dfs_cac_timer_work); in ieee80211_dfs_cac_cancel()
3500 if (!sdata->wdev.links[link_id].cac_started) in ieee80211_dfs_cac_cancel()
3503 chandef = link->conf->chanreq.oper; in ieee80211_dfs_cac_cancel()
3505 cfg80211_cac_event(sdata->dev, &chandef, in ieee80211_dfs_cac_cancel()
3515 struct ieee80211_local *local = in ieee80211_dfs_radar_detected_work() local
3520 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_dfs_radar_detected_work()
3522 list_for_each_entry(ctx, &local->chanctx_list, list) { in ieee80211_dfs_radar_detected_work()
3523 if (ctx->replace_state == IEEE80211_CHANCTX_REPLACES_OTHER) in ieee80211_dfs_radar_detected_work()
3526 if (!ctx->radar_detected) in ieee80211_dfs_radar_detected_work()
3529 ctx->radar_detected = false; in ieee80211_dfs_radar_detected_work()
3531 chandef = ctx->conf.def; in ieee80211_dfs_radar_detected_work()
3533 ieee80211_dfs_cac_cancel(local, ctx); in ieee80211_dfs_radar_detected_work()
3534 cfg80211_radar_event(local->hw.wiphy, &chandef, GFP_KERNEL); in ieee80211_dfs_radar_detected_work()
3547 if (ctx->replace_state == IEEE80211_CHANCTX_REPLACES_OTHER) in ieee80211_radar_mark_chan_ctx_iterator()
3553 ctx->radar_detected = true; in ieee80211_radar_mark_chan_ctx_iterator()
3559 struct ieee80211_local *local = hw_to_local(hw); in ieee80211_radar_detected() local
3561 trace_api_radar_detected(local); in ieee80211_radar_detected()
3566 wiphy_work_queue(hw->wiphy, &local->radar_detected_work); in ieee80211_radar_detected()
3581 /* no-HT indicates nothing to do */ in ieee80211_chandef_downgrade()
3584 switch (c->width) { in ieee80211_chandef_downgrade()
3590 c->width = NL80211_CHAN_WIDTH_20_NOHT; in ieee80211_chandef_downgrade()
3591 conn->mode = IEEE80211_CONN_MODE_LEGACY; in ieee80211_chandef_downgrade()
3592 conn->bw_limit = IEEE80211_CONN_BW_LIMIT_20; in ieee80211_chandef_downgrade()
3593 c->punctured = 0; in ieee80211_chandef_downgrade()
3596 c->width = NL80211_CHAN_WIDTH_20; in ieee80211_chandef_downgrade()
3597 c->center_freq1 = c->chan->center_freq; in ieee80211_chandef_downgrade()
3598 if (conn->mode == IEEE80211_CONN_MODE_VHT) in ieee80211_chandef_downgrade()
3599 conn->mode = IEEE80211_CONN_MODE_HT; in ieee80211_chandef_downgrade()
3600 conn->bw_limit = IEEE80211_CONN_BW_LIMIT_20; in ieee80211_chandef_downgrade()
3601 c->punctured = 0; in ieee80211_chandef_downgrade()
3605 if (conn->mode == IEEE80211_CONN_MODE_VHT) in ieee80211_chandef_downgrade()
3606 conn->mode = IEEE80211_CONN_MODE_HT; in ieee80211_chandef_downgrade()
3607 conn->bw_limit = IEEE80211_CONN_BW_LIMIT_40; in ieee80211_chandef_downgrade()
3610 c->center_freq2 = 0; in ieee80211_chandef_downgrade()
3611 c->width = NL80211_CHAN_WIDTH_80; in ieee80211_chandef_downgrade()
3612 conn->bw_limit = IEEE80211_CONN_BW_LIMIT_80; in ieee80211_chandef_downgrade()
3616 conn->bw_limit = IEEE80211_CONN_BW_LIMIT_80; in ieee80211_chandef_downgrade()
3620 conn->bw_limit = IEEE80211_CONN_BW_LIMIT_160; in ieee80211_chandef_downgrade()
3628 /* keep c->width */ in ieee80211_chandef_downgrade()
3629 conn->mode = IEEE80211_CONN_MODE_S1G; in ieee80211_chandef_downgrade()
3630 conn->bw_limit = IEEE80211_CONN_BW_LIMIT_20; in ieee80211_chandef_downgrade()
3635 /* keep c->width */ in ieee80211_chandef_downgrade()
3636 conn->mode = IEEE80211_CONN_MODE_LEGACY; in ieee80211_chandef_downgrade()
3637 conn->bw_limit = IEEE80211_CONN_BW_LIMIT_20; in ieee80211_chandef_downgrade()
3642 c->center_freq1 = cfg80211_chandef_primary(c, new_primary_width, in ieee80211_chandef_downgrade()
3643 &c->punctured); in ieee80211_chandef_downgrade()
3644 c->width = new_primary_width; in ieee80211_chandef_downgrade()
3652 if (!cfg80211_chandef_valid(c) && c->punctured) in ieee80211_chandef_downgrade()
3688 struct ieee80211_local *local = sdata->local; in ieee80211_send_action_csa() local
3694 if (sdata->vif.type != NL80211_IFTYPE_ADHOC && in ieee80211_send_action_csa()
3695 sdata->vif.type != NL80211_IFTYPE_MESH_POINT) in ieee80211_send_action_csa()
3696 return -EOPNOTSUPP; in ieee80211_send_action_csa()
3698 skb = dev_alloc_skb(local->tx_headroom + hdr_len + in ieee80211_send_action_csa()
3704 return -ENOMEM; in ieee80211_send_action_csa()
3706 skb_reserve(skb, local->tx_headroom); in ieee80211_send_action_csa()
3708 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | in ieee80211_send_action_csa()
3711 eth_broadcast_addr(mgmt->da); in ieee80211_send_action_csa()
3712 memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); in ieee80211_send_action_csa()
3713 if (ieee80211_vif_is_mesh(&sdata->vif)) { in ieee80211_send_action_csa()
3714 memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN); in ieee80211_send_action_csa()
3716 struct ieee80211_if_ibss *ifibss = &sdata->u.ibss; in ieee80211_send_action_csa()
3717 memcpy(mgmt->bssid, ifibss->bssid, ETH_ALEN); in ieee80211_send_action_csa()
3719 mgmt->u.action.category = WLAN_CATEGORY_SPECTRUM_MGMT; in ieee80211_send_action_csa()
3720 mgmt->u.action.u.chan_switch.action_code = WLAN_ACTION_SPCT_CHL_SWITCH; in ieee80211_send_action_csa()
3724 *pos++ = csa_settings->block_tx ? 1 : 0; /* CSA mode */ in ieee80211_send_action_csa()
3725 freq = csa_settings->chandef.chan->center_freq; in ieee80211_send_action_csa()
3727 *pos++ = csa_settings->count; /* count */ in ieee80211_send_action_csa()
3729 if (csa_settings->chandef.width == NL80211_CHAN_WIDTH_40) { in ieee80211_send_action_csa()
3735 ch_type = cfg80211_get_chandef_type(&csa_settings->chandef); in ieee80211_send_action_csa()
3742 if (ieee80211_vif_is_mesh(&sdata->vif)) { in ieee80211_send_action_csa()
3743 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; in ieee80211_send_action_csa()
3748 *pos++ = sdata->u.mesh.mshcfg.dot11MeshTTL; /* Mesh TTL */ in ieee80211_send_action_csa()
3751 *pos++ |= csa_settings->block_tx ? in ieee80211_send_action_csa()
3755 put_unaligned_le16(ifmsh->pre_value, pos);/* Precedence Value */ in ieee80211_send_action_csa()
3759 if (csa_settings->chandef.width == NL80211_CHAN_WIDTH_80 || in ieee80211_send_action_csa()
3760 csa_settings->chandef.width == NL80211_CHAN_WIDTH_80P80 || in ieee80211_send_action_csa()
3761 csa_settings->chandef.width == NL80211_CHAN_WIDTH_160) { in ieee80211_send_action_csa()
3763 ieee80211_ie_build_wide_bw_cs(pos, &csa_settings->chandef); in ieee80211_send_action_csa()
3773 s32 end = data->desc[i].start + data->desc[i].duration - (tsf + 1); in ieee80211_extend_noa_desc()
3780 if (data->count[i] == 1) in ieee80211_extend_noa_desc()
3783 if (data->desc[i].interval == 0) in ieee80211_extend_noa_desc()
3787 skip = DIV_ROUND_UP(-end, data->desc[i].interval); in ieee80211_extend_noa_desc()
3788 if (data->count[i] < 255) { in ieee80211_extend_noa_desc()
3789 if (data->count[i] <= skip) { in ieee80211_extend_noa_desc()
3790 data->count[i] = 0; in ieee80211_extend_noa_desc()
3794 data->count[i] -= skip; in ieee80211_extend_noa_desc()
3797 data->desc[i].start += skip * data->desc[i].interval; in ieee80211_extend_noa_desc()
3812 if (!data->count[i]) in ieee80211_extend_absent_time()
3818 cur = data->desc[i].start - tsf; in ieee80211_extend_absent_time()
3822 cur = data->desc[i].start + data->desc[i].duration - tsf; in ieee80211_extend_absent_time()
3854 u32 next_offset = BIT(31) - 1; in ieee80211_update_p2p_noa()
3857 data->absent = 0; in ieee80211_update_p2p_noa()
3858 data->has_next_tsf = false; in ieee80211_update_p2p_noa()
3862 if (!data->count[i]) in ieee80211_update_p2p_noa()
3866 start = data->desc[i].start - tsf; in ieee80211_update_p2p_noa()
3868 data->absent |= BIT(i); in ieee80211_update_p2p_noa()
3873 data->has_next_tsf = true; in ieee80211_update_p2p_noa()
3876 if (data->absent) in ieee80211_update_p2p_noa()
3879 data->next_tsf = tsf + next_offset; in ieee80211_update_p2p_noa()
3892 const struct ieee80211_p2p_noa_desc *desc = &attr->desc[i]; in ieee80211_parse_p2p_noa()
3894 if (!desc->count || !desc->duration) in ieee80211_parse_p2p_noa()
3897 data->count[i] = desc->count; in ieee80211_parse_p2p_noa()
3898 data->desc[i].start = le32_to_cpu(desc->start_time); in ieee80211_parse_p2p_noa()
3899 data->desc[i].duration = le32_to_cpu(desc->duration); in ieee80211_parse_p2p_noa()
3900 data->desc[i].interval = le32_to_cpu(desc->interval); in ieee80211_parse_p2p_noa()
3902 if (data->count[i] > 1 && in ieee80211_parse_p2p_noa()
3903 data->desc[i].interval < data->desc[i].duration) in ieee80211_parse_p2p_noa()
3917 void ieee80211_recalc_dtim(struct ieee80211_local *local, in ieee80211_recalc_dtim() argument
3920 u64 tsf = drv_get_tsf(local, sdata); in ieee80211_recalc_dtim()
3922 u16 beacon_int = sdata->vif.bss_conf.beacon_int * 1024; in ieee80211_recalc_dtim()
3923 u8 dtim_period = sdata->vif.bss_conf.dtim_period; in ieee80211_recalc_dtim()
3927 if (tsf == -1ULL || !beacon_int || !dtim_period) in ieee80211_recalc_dtim()
3930 if (sdata->vif.type == NL80211_IFTYPE_AP || in ieee80211_recalc_dtim()
3931 sdata->vif.type == NL80211_IFTYPE_AP_VLAN) { in ieee80211_recalc_dtim()
3932 if (!sdata->bss) in ieee80211_recalc_dtim()
3935 ps = &sdata->bss->ps; in ieee80211_recalc_dtim()
3936 } else if (ieee80211_vif_is_mesh(&sdata->vif)) { in ieee80211_recalc_dtim()
3937 ps = &sdata->u.mesh.ps; in ieee80211_recalc_dtim()
3945 * dtim_count = dtim_period - (tsf / bcn_int) % dtim_period in ieee80211_recalc_dtim()
3953 dtim_count = dtim_period - bcns_from_dtim; in ieee80211_recalc_dtim()
3955 ps->dtim_count = dtim_count; in ieee80211_recalc_dtim()
3958 static u8 ieee80211_chanctx_radar_detect(struct ieee80211_local *local, in ieee80211_chanctx_radar_detect() argument
3964 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_chanctx_radar_detect()
3966 if (WARN_ON(ctx->replace_state == IEEE80211_CHANCTX_WILL_BE_REPLACED)) in ieee80211_chanctx_radar_detect()
3969 list_for_each_entry(link, &ctx->reserved_links, reserved_chanctx_list) in ieee80211_chanctx_radar_detect()
3970 if (link->reserved_radar_required) in ieee80211_chanctx_radar_detect()
3971 radar_detect |= BIT(link->reserved.oper.width); in ieee80211_chanctx_radar_detect()
3974 * An in-place reservation context should not have any assigned vifs in ieee80211_chanctx_radar_detect()
3977 WARN_ON(ctx->replace_state == IEEE80211_CHANCTX_REPLACES_OTHER && in ieee80211_chanctx_radar_detect()
3978 !list_empty(&ctx->assigned_links)); in ieee80211_chanctx_radar_detect()
3980 list_for_each_entry(link, &ctx->assigned_links, assigned_chanctx_list) { in ieee80211_chanctx_radar_detect()
3981 if (!link->radar_required) in ieee80211_chanctx_radar_detect()
3985 BIT(link->conf->chanreq.oper.width); in ieee80211_chanctx_radar_detect()
3999 for_each_vif_active_link(&sdata->vif, link_conf, link_id) { in __ieee80211_get_radio_mask()
4000 conf = sdata_dereference(link_conf->chanctx_conf, sdata); in __ieee80211_get_radio_mask()
4001 if (!conf || conf->radio_idx < 0) in __ieee80211_get_radio_mask()
4004 mask |= BIT(conf->radio_idx); in __ieee80211_get_radio_mask()
4027 ieee80211_fill_ifcomb_params(struct ieee80211_local *local, in ieee80211_fill_ifcomb_params() argument
4036 list_for_each_entry(ctx, &local->chanctx_list, list) { in ieee80211_fill_ifcomb_params()
4037 if (ctx->replace_state == IEEE80211_CHANCTX_WILL_BE_REPLACED) in ieee80211_fill_ifcomb_params()
4040 if (params->radio_idx >= 0 && in ieee80211_fill_ifcomb_params()
4041 ctx->conf.radio_idx != params->radio_idx) in ieee80211_fill_ifcomb_params()
4044 params->radar_detect |= in ieee80211_fill_ifcomb_params()
4045 ieee80211_chanctx_radar_detect(local, ctx); in ieee80211_fill_ifcomb_params()
4047 if (chandef && ctx->mode != IEEE80211_CHANCTX_EXCLUSIVE && in ieee80211_fill_ifcomb_params()
4048 cfg80211_chandef_compatible(chandef, &ctx->conf.def)) in ieee80211_fill_ifcomb_params()
4051 params->num_different_channels++; in ieee80211_fill_ifcomb_params()
4054 list_for_each_entry(sdata_iter, &local->interfaces, list) { in ieee80211_fill_ifcomb_params()
4057 wdev_iter = &sdata_iter->wdev; in ieee80211_fill_ifcomb_params()
4061 cfg80211_iftype_allowed(local->hw.wiphy, in ieee80211_fill_ifcomb_params()
4062 wdev_iter->iftype, 0, 1)) in ieee80211_fill_ifcomb_params()
4065 if (!ieee80211_sdata_uses_radio(sdata_iter, params->radio_idx)) in ieee80211_fill_ifcomb_params()
4068 params->iftype_num[wdev_iter->iftype]++; in ieee80211_fill_ifcomb_params()
4081 struct ieee80211_local *local = sdata->local; in ieee80211_check_combinations() local
4082 enum nl80211_iftype iftype = sdata->wdev.iftype; in ieee80211_check_combinations()
4089 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_check_combinations()
4092 return -EINVAL; in ieee80211_check_combinations()
4095 !chandef->chan)) in ieee80211_check_combinations()
4096 return -EINVAL; in ieee80211_check_combinations()
4099 return -EINVAL; in ieee80211_check_combinations()
4101 if (sdata->vif.type == NL80211_IFTYPE_AP || in ieee80211_check_combinations()
4102 sdata->vif.type == NL80211_IFTYPE_MESH_POINT) { in ieee80211_check_combinations()
4108 params.new_beacon_int = sdata->vif.bss_conf.beacon_int; in ieee80211_check_combinations()
4112 if (cfg80211_iftype_allowed(local->hw.wiphy, iftype, 0, 1)) { in ieee80211_check_combinations()
4114 return -EINVAL; in ieee80211_check_combinations()
4124 total = ieee80211_fill_ifcomb_params(local, ¶ms, in ieee80211_check_combinations()
4130 return cfg80211_check_combinations(local->hw.wiphy, ¶ms); in ieee80211_check_combinations()
4140 c->num_different_channels); in ieee80211_iter_max_chans()
4143 int ieee80211_max_num_channels(struct ieee80211_local *local, int radio_idx) in ieee80211_max_num_channels() argument
4151 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_max_num_channels()
4153 ieee80211_fill_ifcomb_params(local, ¶ms, NULL, NULL); in ieee80211_max_num_channels()
4155 err = cfg80211_iter_combinations(local->hw.wiphy, ¶ms, in ieee80211_max_num_channels()
4168 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_add_s1g_capab_ie()
4173 if (WARN_ON(sdata->vif.type != NL80211_IFTYPE_STATION)) in ieee80211_add_s1g_capab_ie()
4176 if (!caps->s1g) in ieee80211_add_s1g_capab_ie()
4179 memcpy(s1g_capab.capab_info, caps->cap, sizeof(caps->cap)); in ieee80211_add_s1g_capab_ie()
4180 memcpy(s1g_capab.supp_mcs_nss, caps->nss_mcs, sizeof(caps->nss_mcs)); in ieee80211_add_s1g_capab_ie()
4183 for (i = 0; i < sizeof(ifmgd->s1g_capa.capab_info); i++) { in ieee80211_add_s1g_capab_ie()
4184 u8 mask = ifmgd->s1g_capa_mask.capab_info[i]; in ieee80211_add_s1g_capab_ie()
4187 s1g_capab.capab_info[i] |= ifmgd->s1g_capa.capab_info[i] & mask; in ieee80211_add_s1g_capab_ie()
4191 for (i = 0; i < sizeof(ifmgd->s1g_capa.supp_mcs_nss); i++) { in ieee80211_add_s1g_capab_ie()
4192 u8 mask = ifmgd->s1g_capa_mask.supp_mcs_nss[i]; in ieee80211_add_s1g_capab_ie()
4196 ifmgd->s1g_capa.supp_mcs_nss[i] & mask; in ieee80211_add_s1g_capab_ie()
4226 *buf++ = qosinfo; /* U-APSD no in use */ in ieee80211_add_wmm_info_ie()
4239 skb_queue_walk(&txqi->frags, skb) { in ieee80211_txq_get_depth()
4241 frag_bytes += skb->len; in ieee80211_txq_get_depth()
4245 *frame_cnt = txqi->tin.backlog_packets + frag_cnt; in ieee80211_txq_get_depth()
4248 *byte_cnt = txqi->tin.backlog_bytes + frag_bytes; in ieee80211_txq_get_depth()
4293 he_cap = ieee80211_get_he_iftype_cap_vif(sband, &sdata->vif); in ieee80211_ie_len_eht_cap()
4294 eht_cap = ieee80211_get_eht_iftype_cap_vif(sband, &sdata->vif); in ieee80211_ie_len_eht_cap()
4298 is_ap = sdata->vif.type == NL80211_IFTYPE_AP; in ieee80211_ie_len_eht_cap()
4300 n = ieee80211_eht_mcs_nss_size(&he_cap->he_cap_elem, in ieee80211_ie_len_eht_cap()
4301 &eht_cap->eht_cap_elem, in ieee80211_ie_len_eht_cap()
4304 sizeof(eht_cap->eht_cap_elem) + n + in ieee80211_ie_len_eht_cap()
4305 ieee80211_eht_ppe_size(eht_cap->eht_ppe_thres[0], in ieee80211_ie_len_eht_cap()
4306 eht_cap->eht_cap_elem.phy_cap_info); in ieee80211_ie_len_eht_cap()
4316 ieee80211_get_he_iftype_cap_vif(sband, &sdata->vif); in ieee80211_put_eht_cap()
4318 ieee80211_get_eht_iftype_cap_vif(sband, &sdata->vif); in ieee80211_put_eht_cap()
4319 bool for_ap = sdata->vif.type == NL80211_IFTYPE_AP; in ieee80211_put_eht_cap()
4333 orig_mcs_nss_len = ieee80211_eht_mcs_nss_size(&he_cap->he_cap_elem, in ieee80211_put_eht_cap()
4334 &eht_cap->eht_cap_elem, in ieee80211_put_eht_cap()
4339 fixed = eht_cap->eht_cap_elem; in ieee80211_put_eht_cap()
4341 if (conn->bw_limit < IEEE80211_CONN_BW_LIMIT_80) in ieee80211_put_eht_cap()
4345 if (conn->bw_limit < IEEE80211_CONN_BW_LIMIT_160) { in ieee80211_put_eht_cap()
4354 if (conn->bw_limit < IEEE80211_CONN_BW_LIMIT_320) { in ieee80211_put_eht_cap()
4365 if (conn->bw_limit == IEEE80211_CONN_BW_LIMIT_20) in ieee80211_put_eht_cap()
4370 ppet_len = ieee80211_eht_ppe_size(eht_cap->eht_ppe_thres[0], in ieee80211_put_eht_cap()
4373 ie_len = 2 + 1 + sizeof(eht_cap->eht_cap_elem) + mcs_nss_len + ppet_len; in ieee80211_put_eht_cap()
4375 return -ENOBUFS; in ieee80211_put_eht_cap()
4378 skb_put_u8(skb, ie_len - 2); in ieee80211_put_eht_cap()
4384 * If the (non-AP) STA became 20 MHz only, then convert from in ieee80211_put_eht_cap()
4385 * <=80 to 20-MHz-only format, where MCSes are indicated in in ieee80211_put_eht_cap()
4386 * the groups 0-7, 8-9, 10-11, 12-13 rather than just 0-9, in ieee80211_put_eht_cap()
4387 * 10-11, 12-13. Thus, use 0-9 for 0-7 and 8-9. in ieee80211_put_eht_cap()
4389 skb_put_u8(skb, eht_cap->eht_mcs_nss_supp.bw._80.rx_tx_mcs9_max_nss); in ieee80211_put_eht_cap()
4390 skb_put_u8(skb, eht_cap->eht_mcs_nss_supp.bw._80.rx_tx_mcs9_max_nss); in ieee80211_put_eht_cap()
4391 skb_put_u8(skb, eht_cap->eht_mcs_nss_supp.bw._80.rx_tx_mcs11_max_nss); in ieee80211_put_eht_cap()
4392 skb_put_u8(skb, eht_cap->eht_mcs_nss_supp.bw._80.rx_tx_mcs13_max_nss); in ieee80211_put_eht_cap()
4394 skb_put_data(skb, &eht_cap->eht_mcs_nss_supp, mcs_nss_len); in ieee80211_put_eht_cap()
4398 skb_put_data(skb, &eht_cap->eht_ppe_thres, ppet_len); in ieee80211_put_eht_cap()
4423 switch (chandef->width) { in ieee80211_min_bw_limit_from_chandef()
4437 WARN(1, "unhandled chandef width %d\n", chandef->width); in ieee80211_min_bw_limit_from_chandef()
4445 tpe->max_local[i].valid = false; in ieee80211_clear_tpe()
4446 memset(tpe->max_local[i].power, in ieee80211_clear_tpe()
4448 sizeof(tpe->max_local[i].power)); in ieee80211_clear_tpe()
4450 tpe->max_reg_client[i].valid = false; in ieee80211_clear_tpe()
4451 memset(tpe->max_reg_client[i].power, in ieee80211_clear_tpe()
4453 sizeof(tpe->max_reg_client[i].power)); in ieee80211_clear_tpe()
4455 tpe->psd_local[i].valid = false; in ieee80211_clear_tpe()
4456 memset(tpe->psd_local[i].power, in ieee80211_clear_tpe()
4458 sizeof(tpe->psd_local[i].power)); in ieee80211_clear_tpe()
4460 tpe->psd_reg_client[i].valid = false; in ieee80211_clear_tpe()
4461 memset(tpe->psd_reg_client[i].power, in ieee80211_clear_tpe()
4463 sizeof(tpe->psd_reg_client[i].power)); in ieee80211_clear_tpe()