Lines Matching +full:ri +full:- +full:override

1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright 2002-2005, Instant802 Networks, Inc.
4 * Copyright 2005-2006, Devicescape Software, Inc.
5 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
7 * Copyright 2013-2014 Intel Mobile Communications GmbH
8 * Copyright (C) 2015-2017 Intel Deutschland GmbH
9 * Copyright (C) 2018-2025 Intel Corporation
30 #include "driver-ops.h"
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()
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()
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()
289 .sta = queue->sta, in wake_tx_push_queue()
294 skb = ieee80211_tx_dequeue(&local->hw, queue); in wake_tx_push_queue()
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()
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()
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()
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()
382 spin_unlock(&fq->lock); in __ieee80211_wake_txqs()
387 __releases(&local->queue_stop_reason_lock)
388 __acquires(&local->queue_stop_reason_lock)
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()
428 spin_lock_irqsave(&local->queue_stop_reason_lock, flags); in ieee80211_wake_txqs()
430 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); in ieee80211_wake_txqs()
440 if (WARN_ON(queue >= hw->queues)) in __ieee80211_wake_queue()
443 if (!test_bit(reason, &local->queue_stop_reasons[queue])) in __ieee80211_wake_queue()
447 local->q_stop_reasons[queue][reason] = 0; in __ieee80211_wake_queue()
449 local->q_stop_reasons[queue][reason]--; in __ieee80211_wake_queue()
450 if (WARN_ON(local->q_stop_reasons[queue][reason] < 0)) in __ieee80211_wake_queue()
451 local->q_stop_reasons[queue][reason] = 0; in __ieee80211_wake_queue()
454 if (local->q_stop_reasons[queue][reason] == 0) in __ieee80211_wake_queue()
455 __clear_bit(reason, &local->queue_stop_reasons[queue]); in __ieee80211_wake_queue()
458 local->q_stop_reasons[queue][reason]); in __ieee80211_wake_queue()
460 if (local->queue_stop_reasons[queue] != 0) in __ieee80211_wake_queue()
464 if (!skb_queue_empty(&local->pending[queue])) in __ieee80211_wake_queue()
465 tasklet_schedule(&local->tx_pending_tasklet); in __ieee80211_wake_queue()
475 tasklet_schedule(&local->wake_txqs_tasklet); in __ieee80211_wake_queue()
487 spin_lock_irqsave(&local->queue_stop_reason_lock, flags); in ieee80211_wake_queue_by_reason()
489 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); in ieee80211_wake_queue_by_reason()
506 if (WARN_ON(queue >= hw->queues)) in __ieee80211_stop_queue()
510 local->q_stop_reasons[queue][reason] = 1; in __ieee80211_stop_queue()
512 local->q_stop_reasons[queue][reason]++; in __ieee80211_stop_queue()
515 local->q_stop_reasons[queue][reason]); in __ieee80211_stop_queue()
517 set_bit(reason, &local->queue_stop_reasons[queue]); in __ieee80211_stop_queue()
527 spin_lock_irqsave(&local->queue_stop_reason_lock, flags); in ieee80211_stop_queue_by_reason()
529 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); in ieee80211_stop_queue_by_reason()
543 struct ieee80211_hw *hw = &local->hw; in ieee80211_add_pending_skb()
546 int queue = info->hw_queue; in ieee80211_add_pending_skb()
548 if (WARN_ON(!info->control.vif)) { in ieee80211_add_pending_skb()
549 ieee80211_free_txskb(&local->hw, skb); in ieee80211_add_pending_skb()
553 spin_lock_irqsave(&local->queue_stop_reason_lock, flags); in ieee80211_add_pending_skb()
556 __skb_queue_tail(&local->pending[queue], skb); in ieee80211_add_pending_skb()
559 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); in ieee80211_add_pending_skb()
565 struct ieee80211_hw *hw = &local->hw; in ieee80211_add_pending_skbs()
570 spin_lock_irqsave(&local->queue_stop_reason_lock, flags); in ieee80211_add_pending_skbs()
574 if (WARN_ON(!info->control.vif)) { in ieee80211_add_pending_skbs()
575 ieee80211_free_txskb(&local->hw, skb); in ieee80211_add_pending_skbs()
579 queue = info->hw_queue; in ieee80211_add_pending_skbs()
585 __skb_queue_tail(&local->pending[queue], skb); in ieee80211_add_pending_skbs()
588 for (i = 0; i < hw->queues; i++) in ieee80211_add_pending_skbs()
592 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); in ieee80211_add_pending_skbs()
604 spin_lock_irqsave(&local->queue_stop_reason_lock, flags); in ieee80211_stop_queues_by_reason()
606 for_each_set_bit(i, &queues, hw->queues) in ieee80211_stop_queues_by_reason()
609 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); in ieee80211_stop_queues_by_reason()
626 if (WARN_ON(queue >= hw->queues)) in ieee80211_queue_stopped()
629 spin_lock_irqsave(&local->queue_stop_reason_lock, flags); in ieee80211_queue_stopped()
631 &local->queue_stop_reasons[queue]); in ieee80211_queue_stopped()
632 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); in ieee80211_queue_stopped()
646 spin_lock_irqsave(&local->queue_stop_reason_lock, flags); in ieee80211_wake_queues_by_reason()
648 for_each_set_bit(i, &queues, hw->queues) in ieee80211_wake_queues_by_reason()
651 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); in ieee80211_wake_queues_by_reason()
668 if (sdata && ieee80211_hw_check(&local->hw, QUEUE_CONTROL)) { in ieee80211_get_vif_queues()
674 if (sdata->vif.hw_queue[ac] != IEEE80211_INVAL_HW_QUEUE) in ieee80211_get_vif_queues()
675 queues |= BIT(sdata->vif.hw_queue[ac]); in ieee80211_get_vif_queues()
676 if (sdata->vif.cab_queue != IEEE80211_INVAL_HW_QUEUE) in ieee80211_get_vif_queues()
677 queues |= BIT(sdata->vif.cab_queue); in ieee80211_get_vif_queues()
680 queues = BIT(local->hw.queues) - 1; in ieee80211_get_vif_queues()
690 if (!local->ops->flush && !drop) in __ieee80211_flush_queues()
695 * IEEE80211_HW_QUEUE_CONTROL - flush all queues in __ieee80211_flush_queues()
697 if (!queues || !ieee80211_hw_check(&local->hw, QUEUE_CONTROL)) in __ieee80211_flush_queues()
700 ieee80211_stop_queues_by_reason(&local->hw, queues, in __ieee80211_flush_queues()
710 list_for_each_entry(sta, &local->sta_list, list) { in __ieee80211_flush_queues()
711 if (sdata != sta->sdata) in __ieee80211_flush_queues()
717 if (local->ops->flush) in __ieee80211_flush_queues()
720 ieee80211_wake_queues_by_reason(&local->hw, queues, in __ieee80211_flush_queues()
740 list_for_each_entry_rcu(sdata, &local->interfaces, list, in __iterate_interfaces()
741 lockdep_is_held(&local->iflist_mtx) || in __iterate_interfaces()
742 lockdep_is_held(&local->hw.wiphy->mtx)) { in __iterate_interfaces()
743 switch (sdata->vif.type) { in __iterate_interfaces()
745 if (!(sdata->u.mntr.flags & MONITOR_FLAG_ACTIVE) && in __iterate_interfaces()
746 !ieee80211_hw_check(&local->hw, NO_VIRTUAL_MONITOR)) in __iterate_interfaces()
755 active_only && !(sdata->flags & IEEE80211_SDATA_IN_DRIVER)) in __iterate_interfaces()
758 !(sdata->flags & IEEE80211_SDATA_IN_DRIVER)) in __iterate_interfaces()
761 iterator(data, sdata->vif.addr, in __iterate_interfaces()
762 &sdata->vif); in __iterate_interfaces()
765 sdata = rcu_dereference_check(local->monitor_sdata, in __iterate_interfaces()
766 lockdep_is_held(&local->iflist_mtx) || in __iterate_interfaces()
767 lockdep_is_held(&local->hw.wiphy->mtx)); in __iterate_interfaces()
768 if (sdata && ieee80211_hw_check(&local->hw, WANT_MONITOR_VIF) && in __iterate_interfaces()
770 sdata->flags & IEEE80211_SDATA_IN_DRIVER)) in __iterate_interfaces()
771 iterator(data, sdata->vif.addr, &sdata->vif); in __iterate_interfaces()
782 mutex_lock(&local->iflist_mtx); in ieee80211_iterate_interfaces()
784 mutex_unlock(&local->iflist_mtx); in ieee80211_iterate_interfaces()
811 lockdep_assert_wiphy(hw->wiphy); in ieee80211_iterate_active_interfaces_mtx()
825 list_for_each_entry_rcu(sta, &local->sta_list, list, in __iterate_stations()
826 lockdep_is_held(&local->hw.wiphy->mtx)) { in __iterate_stations()
827 if (!sta->uploaded) in __iterate_stations()
830 iterator(data, &sta->sta); in __iterate_stations()
854 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_iterate_stations_mtx()
865 !(sdata->flags & IEEE80211_SDATA_IN_DRIVER)) in wdev_to_ieee80211_vif()
867 return &sdata->vif; in wdev_to_ieee80211_vif()
876 return &vif_to_sdata(vif)->wdev; in ieee80211_vif_to_wdev()
882 * the suspend->resume cycle. Since we can't check each caller
891 if (local->quiescing || (local->suspended && !local->resuming)) { in ieee80211_can_queue_work()
906 queue_work(local->workqueue, work); in ieee80211_queue_work()
919 queue_delayed_work(local->workqueue, dwork, delay); in ieee80211_queue_delayed_work()
932 if (sdata->vif.type != NL80211_IFTYPE_AP && in ieee80211_regulatory_limit_wmm_params()
933 sdata->vif.type != NL80211_IFTYPE_STATION) in ieee80211_regulatory_limit_wmm_params()
937 chanctx_conf = rcu_dereference(sdata->vif.bss_conf.chanctx_conf); in ieee80211_regulatory_limit_wmm_params()
939 center_freq = chanctx_conf->def.chan->center_freq; in ieee80211_regulatory_limit_wmm_params()
946 rrule = freq_reg_info(sdata->wdev.wiphy, MHZ_TO_KHZ(center_freq)); in ieee80211_regulatory_limit_wmm_params()
948 if (IS_ERR_OR_NULL(rrule) || !rrule->has_wmm) { in ieee80211_regulatory_limit_wmm_params()
953 if (sdata->vif.type == NL80211_IFTYPE_AP) in ieee80211_regulatory_limit_wmm_params()
954 wmm_ac = &rrule->wmm_rule.ap[ac]; in ieee80211_regulatory_limit_wmm_params()
956 wmm_ac = &rrule->wmm_rule.client[ac]; in ieee80211_regulatory_limit_wmm_params()
957 qparam->cw_min = max_t(u16, qparam->cw_min, wmm_ac->cw_min); in ieee80211_regulatory_limit_wmm_params()
958 qparam->cw_max = max_t(u16, qparam->cw_max, wmm_ac->cw_max); in ieee80211_regulatory_limit_wmm_params()
959 qparam->aifs = max_t(u8, qparam->aifs, wmm_ac->aifsn); in ieee80211_regulatory_limit_wmm_params()
960 qparam->txop = min_t(u16, qparam->txop, wmm_ac->cot / 32); in ieee80211_regulatory_limit_wmm_params()
967 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_set_wmm_default()
968 struct ieee80211_local *local = sdata->local; in ieee80211_set_wmm_default()
976 if (!local->ops->conf_tx) in ieee80211_set_wmm_default()
979 if (local->hw.queues < IEEE80211_NUM_ACS) in ieee80211_set_wmm_default()
985 chanctx_conf = rcu_dereference(link->conf->chanctx_conf); in ieee80211_set_wmm_default()
987 chanctx_conf->def.chan->band == NL80211_BAND_2GHZ) && in ieee80211_set_wmm_default()
988 !link->operating_11g_mode; in ieee80211_set_wmm_default()
991 is_ocb = (sdata->vif.type == NL80211_IFTYPE_OCB); in ieee80211_set_wmm_default()
993 /* Set defaults according to 802.11-2007 Table 7-37 */ in ieee80211_set_wmm_default()
1032 qparam.cw_min = (aCWmin + 1) / 2 - 1; in ieee80211_set_wmm_default()
1046 qparam.cw_max = (aCWmin + 1) / 2 - 1; in ieee80211_set_wmm_default()
1047 qparam.cw_min = (aCWmin + 1) / 4 - 1; in ieee80211_set_wmm_default()
1062 link->tx_conf[ac] = qparam; in ieee80211_set_wmm_default()
1066 if (sdata->vif.type != NL80211_IFTYPE_MONITOR && in ieee80211_set_wmm_default()
1067 sdata->vif.type != NL80211_IFTYPE_P2P_DEVICE && in ieee80211_set_wmm_default()
1068 sdata->vif.type != NL80211_IFTYPE_NAN) { in ieee80211_set_wmm_default()
1069 link->conf->qos = enable_qos; in ieee80211_set_wmm_default()
1082 struct ieee80211_local *local = sdata->local; in ieee80211_send_auth()
1085 bool multi_link = ieee80211_vif_is_mld(&sdata->vif); in ieee80211_send_auth()
1094 .len = sizeof(mle) - 2, in ieee80211_send_auth()
1101 memcpy(mle.basic.mld_mac_addr, sdata->vif.addr, ETH_ALEN); in ieee80211_send_auth()
1104 skb = dev_alloc_skb(local->hw.extra_tx_headroom + IEEE80211_WEP_IV_LEN + in ieee80211_send_auth()
1110 skb_reserve(skb, local->hw.extra_tx_headroom + IEEE80211_WEP_IV_LEN); in ieee80211_send_auth()
1113 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | in ieee80211_send_auth()
1115 memcpy(mgmt->da, da, ETH_ALEN); in ieee80211_send_auth()
1116 memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); in ieee80211_send_auth()
1117 memcpy(mgmt->bssid, bssid, ETH_ALEN); in ieee80211_send_auth()
1118 mgmt->u.auth.auth_alg = cpu_to_le16(auth_alg); in ieee80211_send_auth()
1119 mgmt->u.auth.auth_transaction = cpu_to_le16(transaction); in ieee80211_send_auth()
1120 mgmt->u.auth.status_code = cpu_to_le16(status); in ieee80211_send_auth()
1127 mgmt->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); in ieee80211_send_auth()
1135 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT | in ieee80211_send_auth()
1145 struct ieee80211_local *local = sdata->local; in ieee80211_send_deauth_disassoc()
1150 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | stype); in ieee80211_send_deauth_disassoc()
1151 mgmt->duration = 0; /* initialize only */ in ieee80211_send_deauth_disassoc()
1152 mgmt->seq_ctrl = 0; /* initialize only */ in ieee80211_send_deauth_disassoc()
1153 memcpy(mgmt->da, da, ETH_ALEN); in ieee80211_send_deauth_disassoc()
1154 memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); in ieee80211_send_deauth_disassoc()
1155 memcpy(mgmt->bssid, bssid, ETH_ALEN); in ieee80211_send_deauth_disassoc()
1157 mgmt->u.deauth.reason_code = cpu_to_le16(reason); in ieee80211_send_deauth_disassoc()
1160 skb = dev_alloc_skb(local->hw.extra_tx_headroom + in ieee80211_send_deauth_disassoc()
1165 skb_reserve(skb, local->hw.extra_tx_headroom); in ieee80211_send_deauth_disassoc()
1170 if (sdata->vif.type != NL80211_IFTYPE_STATION || in ieee80211_send_deauth_disassoc()
1171 !(sdata->u.mgd.flags & IEEE80211_STA_MFP_ENABLED)) in ieee80211_send_deauth_disassoc()
1172 IEEE80211_SKB_CB(skb)->flags |= in ieee80211_send_deauth_disassoc()
1183 return -ENOBUFS; in ieee80211_put_s1g_cap()
1188 skb_put_data(skb, &s1g_cap->cap, sizeof(s1g_cap->cap)); in ieee80211_put_s1g_cap()
1189 skb_put_data(skb, &s1g_cap->nss_mcs, sizeof(s1g_cap->nss_mcs)); in ieee80211_put_s1g_cap()
1203 struct ieee80211_local *local = sdata->local; in ieee80211_put_preq_ies_band()
1212 sband = local->hw.wiphy->bands[band]; in ieee80211_put_preq_ies_band()
1218 /* For direct scan add S1G IE and consider its override bits */ in ieee80211_put_preq_ies_band()
1220 return ieee80211_put_s1g_cap(skb, &sband->s1g_cap); in ieee80211_put_preq_ies_band()
1238 if (skb_tailroom(skb) < noffset - *offset) in ieee80211_put_preq_ies_band()
1239 return -ENOBUFS; in ieee80211_put_preq_ies_band()
1240 skb_put_data(skb, ie + *offset, noffset - *offset); in ieee80211_put_preq_ies_band()
1249 if (chandef->chan && sband->band == NL80211_BAND_2GHZ) { in ieee80211_put_preq_ies_band()
1251 return -ENOBUFS; in ieee80211_put_preq_ies_band()
1255 ieee80211_frequency_to_channel(chandef->chan->center_freq)); in ieee80211_put_preq_ies_band()
1274 if (skb_tailroom(skb) < noffset - *offset) in ieee80211_put_preq_ies_band()
1275 return -ENOBUFS; in ieee80211_put_preq_ies_band()
1276 skb_put_data(skb, ie + *offset, noffset - *offset); in ieee80211_put_preq_ies_band()
1280 if (sband->ht_cap.ht_supported) { in ieee80211_put_preq_ies_band()
1284 return -ENOBUFS; in ieee80211_put_preq_ies_band()
1287 ieee80211_ie_build_ht_cap(pos, &sband->ht_cap, in ieee80211_put_preq_ies_band()
1288 sband->ht_cap.cap); in ieee80211_put_preq_ies_band()
1304 /* 60 GHz (Multi-band, DMG, MMS) can't happen */ in ieee80211_put_preq_ies_band()
1309 if (skb_tailroom(skb) < noffset - *offset) in ieee80211_put_preq_ies_band()
1310 return -ENOBUFS; in ieee80211_put_preq_ies_band()
1311 skb_put_data(skb, ie + *offset, noffset - *offset); in ieee80211_put_preq_ies_band()
1316 for (i = 0; i < sband->n_channels; i++) { in ieee80211_put_preq_ies_band()
1317 if (sband->channels[i].flags & (IEEE80211_CHAN_DISABLED | in ieee80211_put_preq_ies_band()
1325 if (sband->vht_cap.vht_supported && have_80mhz) { in ieee80211_put_preq_ies_band()
1329 return -ENOBUFS; in ieee80211_put_preq_ies_band()
1332 ieee80211_ie_build_vht_cap(pos, &sband->vht_cap, in ieee80211_put_preq_ies_band()
1333 sband->vht_cap.cap); in ieee80211_put_preq_ies_band()
1350 if (skb_tailroom(skb) < noffset - *offset) in ieee80211_put_preq_ies_band()
1351 return -ENOBUFS; in ieee80211_put_preq_ies_band()
1352 skb_put_data(skb, ie + *offset, noffset - *offset); in ieee80211_put_preq_ies_band()
1356 if (cfg80211_any_usable_channels(local->hw.wiphy, BIT(sband->band), in ieee80211_put_preq_ies_band()
1363 if (cfg80211_any_usable_channels(local->hw.wiphy, BIT(sband->band), in ieee80211_put_preq_ies_band()
1377 * that calculates local->scan_ies_len. in ieee80211_put_preq_ies_band()
1398 ie_desc->ies[i] = skb_tail_pointer(skb); in ieee80211_put_preq_ies()
1406 ie_desc->len[i] = skb_tail_pointer(skb) - in ieee80211_put_preq_ies()
1407 ie_desc->ies[i]; in ieee80211_put_preq_ies()
1413 if (WARN_ONCE(skb_tailroom(skb) < ie_len - custom_ie_offset, in ieee80211_put_preq_ies()
1415 return -ENOBUFS; in ieee80211_put_preq_ies()
1416 ie_desc->common_ies = skb_tail_pointer(skb); in ieee80211_put_preq_ies()
1418 ie_len - custom_ie_offset); in ieee80211_put_preq_ies()
1419 ie_desc->common_ie_len = skb_tail_pointer(skb) - in ieee80211_put_preq_ies()
1420 ie_desc->common_ies; in ieee80211_put_preq_ies()
1440 return -ENOMEM; in ieee80211_build_preq_ies()
1451 if (skb->len > buffer_len) { in ieee80211_build_preq_ies()
1452 ret = -ENOBUFS; in ieee80211_build_preq_ies()
1456 memcpy(buffer, start, skb->len); in ieee80211_build_preq_ies()
1460 offs = ie_desc->ies[i] - start; in ieee80211_build_preq_ies()
1461 ie_desc->ies[i] = buffer + offs; in ieee80211_build_preq_ies()
1463 offs = ie_desc->common_ies - start; in ieee80211_build_preq_ies()
1464 ie_desc->common_ies = buffer + offs; in ieee80211_build_preq_ies()
1466 ret = skb->len; in ieee80211_build_preq_ies()
1480 struct ieee80211_local *local = sdata->local; in ieee80211_build_probe_req()
1490 * badly-behaved APs don't respond when this parameter is included. in ieee80211_build_probe_req()
1492 chandef.width = sdata->vif.bss_conf.chanreq.oper.width; in ieee80211_build_probe_req()
1498 skb = ieee80211_probereq_get(&local->hw, src, ssid, ssid_len, in ieee80211_build_probe_req()
1499 local->scan_ies_len + ie_len); in ieee80211_build_probe_req()
1503 rate_masks[chan->band] = ratemask; in ieee80211_build_probe_req()
1505 ie, ie_len, BIT(chan->band), in ieee80211_build_probe_req()
1509 mgmt = (struct ieee80211_mgmt *) skb->data; in ieee80211_build_probe_req()
1510 memcpy(mgmt->da, dst, ETH_ALEN); in ieee80211_build_probe_req()
1511 memcpy(mgmt->bssid, dst, ETH_ALEN); in ieee80211_build_probe_req()
1514 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; in ieee80211_build_probe_req()
1528 sband = sdata->local->hw.wiphy->bands[band]; in ieee80211_sta_get_rates()
1533 ieee80211_chandef_rate_flags(&sdata->vif.bss_conf.chanreq.oper); in ieee80211_sta_get_rates()
1535 num_rates = sband->n_bitrates; in ieee80211_sta_get_rates()
1537 for (i = 0; i < elems->supp_rates_len + in ieee80211_sta_get_rates()
1538 elems->ext_supp_rates_len; i++) { in ieee80211_sta_get_rates()
1542 if (i < elems->supp_rates_len) in ieee80211_sta_get_rates()
1543 rate = elems->supp_rates[i]; in ieee80211_sta_get_rates()
1544 else if (elems->ext_supp_rates) in ieee80211_sta_get_rates()
1545 rate = elems->ext_supp_rates in ieee80211_sta_get_rates()
1546 [i - elems->supp_rates_len]; in ieee80211_sta_get_rates()
1555 if ((rate_flags & sband->bitrates[j].flags) in ieee80211_sta_get_rates()
1559 brate = sband->bitrates[j].bitrate; in ieee80211_sta_get_rates()
1580 wiphy_work_cancel(local->hw.wiphy, &local->reconfig_filter); in ieee80211_stop_device()
1582 flush_workqueue(local->workqueue); in ieee80211_stop_device()
1583 wiphy_work_flush(local->hw.wiphy, NULL); in ieee80211_stop_device()
1597 if (test_bit(SCAN_COMPLETED, &local->scanning)) { in ieee80211_flush_completed_scan()
1599 * we don't attempt to continue a partial HW scan - which is in ieee80211_flush_completed_scan()
1604 set_bit(SCAN_ABORTED, &local->scanning); in ieee80211_flush_completed_scan()
1605 wiphy_delayed_work_queue(local->hw.wiphy, &local->scan_work, 0); in ieee80211_flush_completed_scan()
1606 wiphy_delayed_work_flush(local->hw.wiphy, &local->scan_work); in ieee80211_flush_completed_scan()
1615 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_handle_reconfig_failure()
1627 local->resuming = false; in ieee80211_handle_reconfig_failure()
1628 local->suspended = false; in ieee80211_handle_reconfig_failure()
1629 local->in_reconfig = false; in ieee80211_handle_reconfig_failure()
1630 local->reconfig_failure = true; in ieee80211_handle_reconfig_failure()
1639 list_for_each_entry(sdata, &local->interfaces, list) in ieee80211_handle_reconfig_failure()
1640 sdata->flags &= ~IEEE80211_SDATA_IN_DRIVER; in ieee80211_handle_reconfig_failure()
1645 list_for_each_entry(ctx, &local->chanctx_list, list) in ieee80211_handle_reconfig_failure()
1646 ctx->driver_present = false; in ieee80211_handle_reconfig_failure()
1656 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_assign_chanctx()
1658 conf = rcu_dereference_protected(link->conf->chanctx_conf, in ieee80211_assign_chanctx()
1659 lockdep_is_held(&local->hw.wiphy->mtx)); in ieee80211_assign_chanctx()
1662 drv_assign_vif_chanctx(local, sdata, link->conf, ctx); in ieee80211_assign_chanctx()
1668 struct ieee80211_local *local = sdata->local; in ieee80211_reconfig_stations()
1671 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_reconfig_stations()
1674 list_for_each_entry(sta, &local->sta_list, list) { in ieee80211_reconfig_stations()
1677 if (!sta->uploaded || sta->sdata != sdata) in ieee80211_reconfig_stations()
1681 state < sta->sta_state; state++) in ieee80211_reconfig_stations()
1682 WARN_ON(drv_sta_state(local, sta->sdata, sta, state, in ieee80211_reconfig_stations()
1692 res = drv_start_nan(sdata->local, sdata, in ieee80211_reconfig_nan()
1693 &sdata->u.nan.conf); in ieee80211_reconfig_nan()
1697 funcs = kcalloc(sdata->local->hw.max_nan_de_entries + 1, in ieee80211_reconfig_nan()
1701 return -ENOMEM; in ieee80211_reconfig_nan()
1707 spin_lock_bh(&sdata->u.nan.func_lock); in ieee80211_reconfig_nan()
1709 idr_for_each_entry(&sdata->u.nan.function_inst_ids, func, id) in ieee80211_reconfig_nan()
1712 spin_unlock_bh(&sdata->u.nan.func_lock); in ieee80211_reconfig_nan()
1715 res = drv_add_nan_func(sdata->local, sdata, funcs[i]); in ieee80211_reconfig_nan()
1717 ieee80211_nan_func_terminated(&sdata->vif, in ieee80211_reconfig_nan()
1718 funcs[i]->instance_id, in ieee80211_reconfig_nan()
1734 for (link_id = 0; link_id < ARRAY_SIZE(sdata->link); link_id++) { in ieee80211_reconfig_ap_links()
1737 if (!(sdata->vif.active_links & BIT(link_id))) in ieee80211_reconfig_ap_links()
1740 link = sdata_dereference(sdata->link[link_id], sdata); in ieee80211_reconfig_ap_links()
1744 if (rcu_access_pointer(link->u.ap.beacon)) in ieee80211_reconfig_ap_links()
1745 drv_start_ap(local, sdata, link->conf); in ieee80211_reconfig_ap_links()
1747 if (!link->conf->enable_beacon) in ieee80211_reconfig_ap_links()
1759 struct ieee80211_hw *hw = &local->hw; in ieee80211_reconfig()
1768 bool suspended = local->suspended; in ieee80211_reconfig()
1771 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_reconfig()
1774 if (!local->open_count) in ieee80211_reconfig()
1779 local->resuming = true; in ieee80211_reconfig()
1781 if (local->wowlan) { in ieee80211_reconfig()
1785 * clear local->suspended so the device could operate in ieee80211_reconfig()
1788 local->suspended = false; in ieee80211_reconfig()
1790 local->wowlan = false; in ieee80211_reconfig()
1792 local->resuming = false; in ieee80211_reconfig()
1801 * restore local->suspended in this case. in ieee80211_reconfig()
1804 local->suspended = true; in ieee80211_reconfig()
1815 if (suspended && local->in_reconfig && !reconfig_due_to_wowlan) in ieee80211_reconfig()
1816 cancel_work_sync(&local->restart_work); in ieee80211_reconfig()
1818 local->started = false; in ieee80211_reconfig()
1840 drv_set_frag_threshold(local, hw->wiphy->frag_threshold); in ieee80211_reconfig()
1843 drv_set_rts_threshold(local, hw->wiphy->rts_threshold); in ieee80211_reconfig()
1846 drv_set_coverage_class(local, hw->wiphy->coverage_class); in ieee80211_reconfig()
1853 sdata = wiphy_dereference(local->hw.wiphy, local->monitor_sdata); in ieee80211_reconfig()
1854 if (sdata && ieee80211_hw_check(&local->hw, WANT_MONITOR_VIF)) { in ieee80211_reconfig()
1856 WARN_ON(local->resuming); in ieee80211_reconfig()
1859 RCU_INIT_POINTER(local->monitor_sdata, NULL); in ieee80211_reconfig()
1865 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_reconfig()
1866 if (sdata->vif.type == NL80211_IFTYPE_MONITOR && in ieee80211_reconfig()
1867 !ieee80211_hw_check(&local->hw, NO_VIRTUAL_MONITOR)) in ieee80211_reconfig()
1869 if (sdata->vif.type != NL80211_IFTYPE_AP_VLAN && in ieee80211_reconfig()
1881 list_for_each_entry_continue_reverse(sdata, &local->interfaces, in ieee80211_reconfig()
1883 if (sdata->vif.type == NL80211_IFTYPE_MONITOR && in ieee80211_reconfig()
1884 !ieee80211_hw_check(&local->hw, NO_VIRTUAL_MONITOR)) in ieee80211_reconfig()
1886 if (sdata->vif.type != NL80211_IFTYPE_AP_VLAN && in ieee80211_reconfig()
1895 list_for_each_entry(ctx, &local->chanctx_list, list) in ieee80211_reconfig()
1896 if (ctx->replace_state != IEEE80211_CHANCTX_REPLACES_OTHER) in ieee80211_reconfig()
1899 sdata = wiphy_dereference(local->hw.wiphy, local->monitor_sdata); in ieee80211_reconfig()
1901 ieee80211_assign_chanctx(local, sdata, &sdata->deflink); in ieee80211_reconfig()
1913 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_reconfig()
1914 /* common change flags for all interface types - link only */ in ieee80211_reconfig()
1933 if (ieee80211_vif_is_mld(&sdata->vif)) { in ieee80211_reconfig()
1935 [0] = &sdata->vif.bss_conf, in ieee80211_reconfig()
1938 if (sdata->vif.type == NL80211_IFTYPE_STATION) { in ieee80211_reconfig()
1940 active_links = sdata->vif.active_links; in ieee80211_reconfig()
1941 link_id = ffs(active_links) - 1; in ieee80211_reconfig()
1942 sdata->vif.active_links = BIT(link_id); in ieee80211_reconfig()
1946 sdata->vif.active_links, in ieee80211_reconfig()
1950 sdata->restart_active_links = active_links; in ieee80211_reconfig()
1953 link_id < ARRAY_SIZE(sdata->vif.link_conf); in ieee80211_reconfig()
1955 if (!ieee80211_vif_link_active(&sdata->vif, link_id)) in ieee80211_reconfig()
1958 link = sdata_dereference(sdata->link[link_id], sdata); in ieee80211_reconfig()
1965 switch (sdata->vif.type) { in ieee80211_reconfig()
1970 if (sdata->vif.cfg.ibss_joined) in ieee80211_reconfig()
1978 drv_conf_tx(local, &sdata->deflink, i, in ieee80211_reconfig()
1979 &sdata->deflink.tx_conf[i]); in ieee80211_reconfig()
1983 if (sdata->vif.bss_conf.mu_mimo_owner) in ieee80211_reconfig()
1986 if (!ieee80211_vif_is_mld(&sdata->vif)) in ieee80211_reconfig()
1989 switch (sdata->vif.type) { in ieee80211_reconfig()
1991 if (!ieee80211_vif_is_mld(&sdata->vif)) { in ieee80211_reconfig()
1996 /* Re-send beacon info report to the driver */ in ieee80211_reconfig()
1997 if (sdata->deflink.u.mgd.have_beacon) in ieee80211_reconfig()
2000 if (sdata->vif.bss_conf.max_idle_period || in ieee80211_reconfig()
2001 sdata->vif.bss_conf.protected_keep_alive) in ieee80211_reconfig()
2026 if (ieee80211_vif_is_mld(&sdata->vif)) in ieee80211_reconfig()
2032 if (sdata->vif.bss_conf.ftm_responder == 1 && in ieee80211_reconfig()
2033 wiphy_ext_feature_isset(sdata->local->hw.wiphy, in ieee80211_reconfig()
2037 if (sdata->vif.type == NL80211_IFTYPE_AP) { in ieee80211_reconfig()
2040 if (ieee80211_vif_is_mld(&sdata->vif)) { in ieee80211_reconfig()
2047 if (rcu_access_pointer(sdata->deflink.u.ap.beacon)) in ieee80211_reconfig()
2049 sdata->deflink.conf); in ieee80211_reconfig()
2053 if (sdata->vif.bss_conf.enable_beacon) { in ieee80211_reconfig()
2089 if (!(local->hw.conf.flags & IEEE80211_CONF_PS)) { in ieee80211_reconfig()
2090 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_reconfig()
2091 if (sdata->vif.type != NL80211_IFTYPE_STATION) in ieee80211_reconfig()
2093 if (!sdata->u.mgd.associated) in ieee80211_reconfig()
2101 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_reconfig()
2105 switch (sdata->vif.type) { in ieee80211_reconfig()
2116 list_for_each_entry(sdata, &local->interfaces, list) in ieee80211_reconfig()
2119 /* re-enable multi-link for client interfaces */ in ieee80211_reconfig()
2120 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_reconfig()
2121 if (sdata->restart_active_links) in ieee80211_reconfig()
2122 ieee80211_set_active_links(&sdata->vif, in ieee80211_reconfig()
2123 sdata->restart_active_links); in ieee80211_reconfig()
2126 * before reconfig, it will do nothing, so re-schedule. in ieee80211_reconfig()
2128 if (sdata->desired_active_links) in ieee80211_reconfig()
2129 wiphy_work_queue(sdata->local->hw.wiphy, in ieee80211_reconfig()
2130 &sdata->activate_links_work); in ieee80211_reconfig()
2134 sched_scan_sdata = rcu_dereference_protected(local->sched_scan_sdata, in ieee80211_reconfig()
2135 lockdep_is_held(&local->hw.wiphy->mtx)); in ieee80211_reconfig()
2136 sched_scan_req = rcu_dereference_protected(local->sched_scan_req, in ieee80211_reconfig()
2137 lockdep_is_held(&local->hw.wiphy->mtx)); in ieee80211_reconfig()
2146 if (sched_scan_req->n_scan_plans > 1 || in ieee80211_reconfig()
2149 RCU_INIT_POINTER(local->sched_scan_sdata, NULL); in ieee80211_reconfig()
2150 RCU_INIT_POINTER(local->sched_scan_req, NULL); in ieee80211_reconfig()
2155 cfg80211_sched_scan_stopped_locked(local->hw.wiphy, 0); in ieee80211_reconfig()
2159 if (local->monitors == local->open_count && local->monitors > 0) in ieee80211_reconfig()
2173 list_for_each_entry(sta, &local->sta_list, list) { in ieee80211_reconfig()
2174 if (!local->resuming) in ieee80211_reconfig()
2185 if (local->open_count && (!suspended || reconfig_due_to_wowlan)) in ieee80211_reconfig()
2188 if (local->in_reconfig) { in ieee80211_reconfig()
2189 in_reconfig = local->in_reconfig; in ieee80211_reconfig()
2190 local->in_reconfig = false; in ieee80211_reconfig()
2196 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_reconfig()
2198 wiphy_work_queue(local->hw.wiphy, &sdata->work); in ieee80211_reconfig()
2207 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_reconfig()
2210 if (sdata->vif.type == NL80211_IFTYPE_STATION) in ieee80211_reconfig()
2220 local->suspended = false; in ieee80211_reconfig()
2222 local->resuming = false; in ieee80211_reconfig()
2226 if (local->open_count && !reconfig_due_to_wowlan) in ieee80211_reconfig()
2229 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_reconfig()
2232 if (sdata->vif.type == NL80211_IFTYPE_STATION) in ieee80211_reconfig()
2236 mod_timer(&local->sta_cleanup, jiffies + 1); in ieee80211_reconfig()
2254 local = sdata->local; in ieee80211_reconfig_disconnect()
2256 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_reconfig_disconnect()
2259 !local->resuming)) in ieee80211_reconfig_disconnect()
2263 !local->in_reconfig)) in ieee80211_reconfig_disconnect()
2266 if (WARN_ON(vif->type != NL80211_IFTYPE_STATION)) in ieee80211_reconfig_disconnect()
2269 sdata->flags |= flag; in ieee80211_reconfig_disconnect()
2271 list_for_each_entry(key, &sdata->key_list, list) in ieee80211_reconfig_disconnect()
2272 key->flags |= KEY_FLAG_TAINTED; in ieee80211_reconfig_disconnect()
2290 struct ieee80211_local *local = sdata->local; in ieee80211_recalc_smps()
2294 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_recalc_smps()
2296 chanctx_conf = rcu_dereference_protected(link->conf->chanctx_conf, in ieee80211_recalc_smps()
2297 lockdep_is_held(&local->hw.wiphy->mtx)); in ieee80211_recalc_smps()
2315 struct ieee80211_local *local = sdata->local; in ieee80211_recalc_min_chandef()
2320 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_recalc_min_chandef()
2322 for (i = 0; i < ARRAY_SIZE(sdata->vif.link_conf); i++) { in ieee80211_recalc_min_chandef()
2329 bss_conf = rcu_dereference(sdata->vif.link_conf[i]); in ieee80211_recalc_min_chandef()
2335 chanctx_conf = rcu_dereference_protected(bss_conf->chanctx_conf, in ieee80211_recalc_min_chandef()
2336 lockdep_is_held(&local->hw.wiphy->mtx)); in ieee80211_recalc_min_chandef()
2341 * the mutex. Just the way we reached it could - in in ieee80211_recalc_min_chandef()
2342 * theory - go away, but we don't really care and in ieee80211_recalc_min_chandef()
2381 *pos++ = ht_cap->ampdu_factor | in ieee80211_ie_build_ht_cap()
2382 (ht_cap->ampdu_density << in ieee80211_ie_build_ht_cap()
2386 memcpy(pos, &ht_cap->mcs, sizeof(ht_cap->mcs)); in ieee80211_ie_build_ht_cap()
2387 pos += sizeof(ht_cap->mcs); in ieee80211_ie_build_ht_cap()
2416 memcpy(pos, &vht_cap->vht_mcs, sizeof(vht_cap->vht_mcs)); in ieee80211_ie_build_vht_cap()
2417 pos += sizeof(vht_cap->vht_mcs); in ieee80211_ie_build_vht_cap()
2433 he_cap = ieee80211_get_he_iftype_cap_vif(sband, &sdata->vif); in ieee80211_ie_len_he_cap()
2437 n = ieee80211_he_mcs_nss_size(&he_cap->he_cap_elem); in ieee80211_ie_len_he_cap()
2439 sizeof(he_cap->he_cap_elem) + n + in ieee80211_ie_len_he_cap()
2440 ieee80211_he_ppe_size(he_cap->ppe_thres[0], in ieee80211_ie_len_he_cap()
2441 he_cap->he_cap_elem.phy_cap_info); in ieee80211_ie_len_he_cap()
2451 *elem = he_cap->he_cap_elem; in ieee80211_get_adjusted_he_cap()
2453 switch (conn->bw_limit) { in ieee80211_get_adjusted_he_cap()
2468 max_ru = elem->phy_cap_info[8] & IEEE80211_HE_PHY_CAP8_DCM_MAX_RU_MASK; in ieee80211_get_adjusted_he_cap()
2470 elem->phy_cap_info[8] &= ~IEEE80211_HE_PHY_CAP8_DCM_MAX_RU_MASK; in ieee80211_get_adjusted_he_cap()
2471 elem->phy_cap_info[8] |= max_ru; in ieee80211_get_adjusted_he_cap()
2473 if (conn->bw_limit < IEEE80211_CONN_BW_LIMIT_40) { in ieee80211_get_adjusted_he_cap()
2474 elem->phy_cap_info[0] &= in ieee80211_get_adjusted_he_cap()
2477 elem->phy_cap_info[9] &= in ieee80211_get_adjusted_he_cap()
2481 if (conn->bw_limit < IEEE80211_CONN_BW_LIMIT_160) { in ieee80211_get_adjusted_he_cap()
2482 elem->phy_cap_info[0] &= in ieee80211_get_adjusted_he_cap()
2485 elem->phy_cap_info[5] &= in ieee80211_get_adjusted_he_cap()
2487 elem->phy_cap_info[7] &= in ieee80211_get_adjusted_he_cap()
2507 he_cap = ieee80211_get_he_iftype_cap_vif(sband, &sdata->vif); in ieee80211_put_he_cap()
2516 sizeof(he_cap->he_cap_elem) + n + in ieee80211_put_he_cap()
2517 ieee80211_he_ppe_size(he_cap->ppe_thres[0], in ieee80211_put_he_cap()
2518 he_cap->he_cap_elem.phy_cap_info); in ieee80211_put_he_cap()
2521 return -ENOBUFS; in ieee80211_put_he_cap()
2530 skb_put_data(skb, &he_cap->he_mcs_nss_supp, n); in ieee80211_put_he_cap()
2533 if ((he_cap->he_cap_elem.phy_cap_info[6] & in ieee80211_put_he_cap()
2541 n = hweight8(he_cap->ppe_thres[0] & in ieee80211_put_he_cap()
2543 n *= (1 + ((he_cap->ppe_thres[0] & IEEE80211_PPE_THRES_NSS_MASK) >> in ieee80211_put_he_cap()
2554 skb_put_data(skb, &he_cap->ppe_thres, n); in ieee80211_put_he_cap()
2557 *len = skb_tail_pointer(skb) - len - 1; in ieee80211_put_he_cap()
2567 enum nl80211_iftype iftype = ieee80211_vif_type_p2p(&sdata->vif); in ieee80211_put_he_6ghz_cap()
2570 if (!cfg80211_any_usable_channels(sdata->local->hw.wiphy, in ieee80211_put_he_6ghz_cap()
2575 sband = sdata->local->hw.wiphy->bands[NL80211_BAND_6GHZ]; in ieee80211_put_he_6ghz_cap()
2582 if (!iftd->he_6ghz_capa.capa) in ieee80211_put_he_6ghz_cap()
2585 cap = iftd->he_6ghz_capa.capa; in ieee80211_put_he_6ghz_cap()
2608 return -ENOBUFS; in ieee80211_put_he_6ghz_cap()
2626 ht_oper->primary_chan = ieee80211_frequency_to_channel( in ieee80211_ie_build_ht_oper()
2627 chandef->chan->center_freq); in ieee80211_ie_build_ht_oper()
2628 switch (chandef->width) { in ieee80211_ie_build_ht_oper()
2633 if (chandef->center_freq1 > chandef->chan->center_freq) in ieee80211_ie_build_ht_oper()
2634 ht_oper->ht_param = IEEE80211_HT_PARAM_CHA_SEC_ABOVE; in ieee80211_ie_build_ht_oper()
2636 ht_oper->ht_param = IEEE80211_HT_PARAM_CHA_SEC_BELOW; in ieee80211_ie_build_ht_oper()
2643 ht_oper->ht_param = IEEE80211_HT_PARAM_CHA_SEC_NONE; in ieee80211_ie_build_ht_oper()
2646 if (ht_cap->cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40 && in ieee80211_ie_build_ht_oper()
2647 chandef->width != NL80211_CHAN_WIDTH_20_NOHT && in ieee80211_ie_build_ht_oper()
2648 chandef->width != NL80211_CHAN_WIDTH_20) in ieee80211_ie_build_ht_oper()
2649 ht_oper->ht_param |= IEEE80211_HT_PARAM_CHAN_WIDTH_ANY; in ieee80211_ie_build_ht_oper()
2652 ht_oper->ht_param |= IEEE80211_HT_PARAM_RIFS_MODE; in ieee80211_ie_build_ht_oper()
2654 ht_oper->operation_mode = cpu_to_le16(prot_mode); in ieee80211_ie_build_ht_oper()
2655 ht_oper->stbc_param = 0x0000; in ieee80211_ie_build_ht_oper()
2659 memset(&ht_oper->basic_set, 0, 16); in ieee80211_ie_build_ht_oper()
2660 memcpy(&ht_oper->basic_set, &ht_cap->mcs, 10); in ieee80211_ie_build_ht_oper()
2671 switch (chandef->width) { in ieee80211_ie_build_wide_bw_cs()
2690 *pos++ = ieee80211_frequency_to_channel(chandef->center_freq1); in ieee80211_ie_build_wide_bw_cs()
2692 if (chandef->center_freq2) in ieee80211_ie_build_wide_bw_cs()
2693 *pos++ = ieee80211_frequency_to_channel(chandef->center_freq2); in ieee80211_ie_build_wide_bw_cs()
2706 vht_oper->center_freq_seg0_idx = ieee80211_frequency_to_channel( in ieee80211_ie_build_vht_oper()
2707 chandef->center_freq1); in ieee80211_ie_build_vht_oper()
2708 if (chandef->center_freq2) in ieee80211_ie_build_vht_oper()
2709 vht_oper->center_freq_seg1_idx = in ieee80211_ie_build_vht_oper()
2710 ieee80211_frequency_to_channel(chandef->center_freq2); in ieee80211_ie_build_vht_oper()
2712 vht_oper->center_freq_seg1_idx = 0x00; in ieee80211_ie_build_vht_oper()
2714 switch (chandef->width) { in ieee80211_ie_build_vht_oper()
2720 vht_oper->chan_width = IEEE80211_VHT_CHANWIDTH_80MHZ; in ieee80211_ie_build_vht_oper()
2721 vht_oper->center_freq_seg1_idx = vht_oper->center_freq_seg0_idx; in ieee80211_ie_build_vht_oper()
2722 if (chandef->chan->center_freq < chandef->center_freq1) in ieee80211_ie_build_vht_oper()
2723 vht_oper->center_freq_seg0_idx -= 8; in ieee80211_ie_build_vht_oper()
2725 vht_oper->center_freq_seg0_idx += 8; in ieee80211_ie_build_vht_oper()
2732 vht_oper->chan_width = IEEE80211_VHT_CHANWIDTH_80MHZ; in ieee80211_ie_build_vht_oper()
2735 vht_oper->chan_width = IEEE80211_VHT_CHANWIDTH_80MHZ; in ieee80211_ie_build_vht_oper()
2742 vht_oper->chan_width = IEEE80211_VHT_CHANWIDTH_USE_HT; in ieee80211_ie_build_vht_oper()
2747 vht_oper->basic_mcs_set = cpu_to_le16(0xffff); in ieee80211_ie_build_vht_oper()
2760 if (chandef->chan->band == NL80211_BAND_6GHZ) in ieee80211_ie_build_he_oper()
2774 if (chandef->chan->band == NL80211_BAND_6GHZ) in ieee80211_ie_build_he_oper()
2779 he_oper->he_oper_params = cpu_to_le32(he_oper_params); in ieee80211_ie_build_he_oper()
2782 he_oper->he_mcs_nss_set = cpu_to_le16(0xffff); in ieee80211_ie_build_he_oper()
2785 if (chandef->chan->band != NL80211_BAND_6GHZ) in ieee80211_ie_build_he_oper()
2788 cfg80211_chandef_create(&he_chandef, chandef->chan, NL80211_CHAN_NO_HT); in ieee80211_ie_build_he_oper()
2789 he_chandef.center_freq1 = chandef->center_freq1; in ieee80211_ie_build_he_oper()
2790 he_chandef.center_freq2 = chandef->center_freq2; in ieee80211_ie_build_he_oper()
2791 he_chandef.width = chandef->width; in ieee80211_ie_build_he_oper()
2795 he_6ghz_op->minrate = 6; /* 6 Mbps */ in ieee80211_ie_build_he_oper()
2796 he_6ghz_op->primary = in ieee80211_ie_build_he_oper()
2797 ieee80211_frequency_to_channel(he_chandef.chan->center_freq); in ieee80211_ie_build_he_oper()
2798 he_6ghz_op->ccfs0 = in ieee80211_ie_build_he_oper()
2801 he_6ghz_op->ccfs1 = in ieee80211_ie_build_he_oper()
2804 he_6ghz_op->ccfs1 = 0; in ieee80211_ie_build_he_oper()
2812 he_6ghz_op->ccfs0 = in ieee80211_ie_build_he_oper()
2819 he_6ghz_op->control = in ieee80211_ie_build_he_oper()
2821 he_6ghz_op->ccfs1 = he_6ghz_op->ccfs0; in ieee80211_ie_build_he_oper()
2822 if (he_chandef.chan->center_freq < he_chandef.center_freq1) in ieee80211_ie_build_he_oper()
2823 he_6ghz_op->ccfs0 -= 8; in ieee80211_ie_build_he_oper()
2825 he_6ghz_op->ccfs0 += 8; 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()
2840 he_6ghz_op->control = in ieee80211_ie_build_he_oper()
2856 &eht_cap->eht_mcs_nss_supp.only_20mhz; in ieee80211_ie_build_eht_oper()
2870 memcpy(&eht_oper->basic_mcs_nss, eht_mcs_nss, sizeof(*eht_mcs_nss)); in ieee80211_ie_build_eht_oper()
2871 eht_oper->params |= IEEE80211_EHT_OPER_INFO_PRESENT; in ieee80211_ie_build_eht_oper()
2875 (struct ieee80211_eht_operation_info *)eht_oper->optional; in ieee80211_ie_build_eht_oper()
2877 eht_oper_info->ccfs0 = in ieee80211_ie_build_eht_oper()
2878 ieee80211_frequency_to_channel(chandef->center_freq1); in ieee80211_ie_build_eht_oper()
2879 if (chandef->center_freq2) in ieee80211_ie_build_eht_oper()
2880 eht_oper_info->ccfs1 = in ieee80211_ie_build_eht_oper()
2881 ieee80211_frequency_to_channel(chandef->center_freq2); in ieee80211_ie_build_eht_oper()
2883 eht_oper_info->ccfs1 = 0; in ieee80211_ie_build_eht_oper()
2885 switch (chandef->width) { in ieee80211_ie_build_eht_oper()
2888 eht_oper_info->ccfs1 = eht_oper_info->ccfs0; in ieee80211_ie_build_eht_oper()
2889 if (chandef->chan->center_freq < chandef->center_freq1) in ieee80211_ie_build_eht_oper()
2890 eht_oper_info->ccfs0 -= 16; in ieee80211_ie_build_eht_oper()
2892 eht_oper_info->ccfs0 += 16; in ieee80211_ie_build_eht_oper()
2895 eht_oper_info->ccfs1 = eht_oper_info->ccfs0; in ieee80211_ie_build_eht_oper()
2896 if (chandef->chan->center_freq < chandef->center_freq1) in ieee80211_ie_build_eht_oper()
2897 eht_oper_info->ccfs0 -= 8; in ieee80211_ie_build_eht_oper()
2899 eht_oper_info->ccfs0 += 8; in ieee80211_ie_build_eht_oper()
2914 eht_oper_info->control = chan_width; in ieee80211_ie_build_eht_oper()
2917 /* TODO: eht_oper_info->optional */ in ieee80211_ie_build_eht_oper()
2930 switch (ht_oper->ht_param & IEEE80211_HT_PARAM_CHA_SEC_OFFSET) { in ieee80211_chandef_ht_oper()
2944 cfg80211_chandef_create(chandef, chandef->chan, channel_type); in ieee80211_chandef_ht_oper()
2968 vht_cap = hw->wiphy->bands[chandef->chan->band]->vht_cap.cap; in ieee80211_chandef_vht_oper()
2977 ccfs0 = oper->center_freq_seg0_idx; in ieee80211_chandef_vht_oper()
2978 ccfs1 = oper->center_freq_seg1_idx; in ieee80211_chandef_vht_oper()
2979 ccfs2 = (le16_to_cpu(htop->operation_mode) & in ieee80211_chandef_vht_oper()
2990 * Cf. IEEE 802.11 Table 9-250 in ieee80211_chandef_vht_oper()
3026 cf0 = ieee80211_channel_to_frequency(ccf0, chandef->chan->band); in ieee80211_chandef_vht_oper()
3027 cf1 = ieee80211_channel_to_frequency(ccf1, chandef->chan->band); in ieee80211_chandef_vht_oper()
3029 switch (oper->chan_width) { in ieee80211_chandef_vht_oper()
3040 diff = abs(ccf1 - ccf0); in ieee80211_chandef_vht_oper()
3075 chandef->center_freq1 = in ieee80211_chandef_eht_oper()
3076 ieee80211_channel_to_frequency(info->ccfs0, in ieee80211_chandef_eht_oper()
3077 chandef->chan->band); in ieee80211_chandef_eht_oper()
3079 switch (u8_get_bits(info->control, in ieee80211_chandef_eht_oper()
3082 chandef->width = NL80211_CHAN_WIDTH_20; in ieee80211_chandef_eht_oper()
3085 chandef->width = NL80211_CHAN_WIDTH_40; in ieee80211_chandef_eht_oper()
3088 chandef->width = NL80211_CHAN_WIDTH_80; in ieee80211_chandef_eht_oper()
3091 chandef->width = NL80211_CHAN_WIDTH_160; in ieee80211_chandef_eht_oper()
3092 chandef->center_freq1 = in ieee80211_chandef_eht_oper()
3093 ieee80211_channel_to_frequency(info->ccfs1, in ieee80211_chandef_eht_oper()
3094 chandef->chan->band); in ieee80211_chandef_eht_oper()
3097 chandef->width = NL80211_CHAN_WIDTH_320; in ieee80211_chandef_eht_oper()
3098 chandef->center_freq1 = in ieee80211_chandef_eht_oper()
3099 ieee80211_channel_to_frequency(info->ccfs1, in ieee80211_chandef_eht_oper()
3100 chandef->chan->band); in ieee80211_chandef_eht_oper()
3114 if (chandef->chan->band != NL80211_BAND_6GHZ) in ieee80211_chandef_he_6ghz_oper()
3129 freq = ieee80211_channel_to_frequency(he_6ghz_oper->primary, in ieee80211_chandef_he_6ghz_oper()
3131 he_chandef.chan = ieee80211_get_channel(local->hw.wiphy, freq); in ieee80211_chandef_he_6ghz_oper()
3137 !(eht_oper->params & IEEE80211_EHT_OPER_INFO_PRESENT)) { in ieee80211_chandef_he_6ghz_oper()
3138 switch (u8_get_bits(he_6ghz_oper->control, in ieee80211_chandef_he_6ghz_oper()
3151 if (!he_6ghz_oper->ccfs1) in ieee80211_chandef_he_6ghz_oper()
3153 if (abs(he_6ghz_oper->ccfs1 - he_6ghz_oper->ccfs0) == 8) in ieee80211_chandef_he_6ghz_oper()
3162 ieee80211_channel_to_frequency(he_6ghz_oper->ccfs1, in ieee80211_chandef_he_6ghz_oper()
3166 ieee80211_channel_to_frequency(he_6ghz_oper->ccfs0, in ieee80211_chandef_he_6ghz_oper()
3169 ieee80211_channel_to_frequency(he_6ghz_oper->ccfs1, in ieee80211_chandef_he_6ghz_oper()
3173 ieee80211_chandef_eht_oper((const void *)eht_oper->optional, in ieee80211_chandef_he_6ghz_oper()
3195 switch (FIELD_GET(S1G_OPER_CH_WIDTH_OPER, oper->ch_width)) { in ieee80211_chandef_s1g_oper()
3197 chandef->width = NL80211_CHAN_WIDTH_1; in ieee80211_chandef_s1g_oper()
3200 chandef->width = NL80211_CHAN_WIDTH_2; in ieee80211_chandef_s1g_oper()
3203 chandef->width = NL80211_CHAN_WIDTH_4; in ieee80211_chandef_s1g_oper()
3206 chandef->width = NL80211_CHAN_WIDTH_8; in ieee80211_chandef_s1g_oper()
3209 chandef->width = NL80211_CHAN_WIDTH_16; in ieee80211_chandef_s1g_oper()
3215 oper_freq = ieee80211_channel_to_freq_khz(oper->oper_ch, in ieee80211_chandef_s1g_oper()
3217 chandef->center_freq1 = KHZ_TO_MHZ(oper_freq); in ieee80211_chandef_s1g_oper()
3218 chandef->freq1_offset = oper_freq % 1000; in ieee80211_chandef_s1g_oper()
3231 for (i = 0; i < sband->n_bitrates; i++) { in ieee80211_put_srates_elem()
3232 if ((rate_flags & sband->bitrates[i].flags) != rate_flags) in ieee80211_put_srates_elem()
3246 rates -= skip; in ieee80211_put_srates_elem()
3250 return -ENOBUFS; in ieee80211_put_srates_elem()
3255 for (i = 0; i < sband->n_bitrates && rates; i++) { in ieee80211_put_srates_elem()
3259 if ((rate_flags & sband->bitrates[i].flags) != rate_flags) in ieee80211_put_srates_elem()
3265 skip--; in ieee80211_put_srates_elem()
3271 rate = DIV_ROUND_UP(sband->bitrates[i].bitrate, 5); in ieee80211_put_srates_elem()
3273 rates--; in ieee80211_put_srates_elem()
3286 if (WARN_ON_ONCE(sdata->vif.type != NL80211_IFTYPE_STATION)) in ieee80211_ave_rssi()
3289 return -ewma_beacon_signal_read(&sdata->deflink.u.mgd.ave_beacon_signal); in ieee80211_ave_rssi()
3300 if (mcs->rx_mask[3]) in ieee80211_mcs_to_chains()
3302 if (mcs->rx_mask[2]) in ieee80211_mcs_to_chains()
3304 if (mcs->rx_mask[1]) in ieee80211_mcs_to_chains()
3310 * ieee80211_calculate_rx_timestamp - calculate timestamp in frame
3327 u64 ts = status->mactime; in ieee80211_calculate_rx_timestamp()
3329 struct rate_info ri; in ieee80211_calculate_rx_timestamp() local
3336 mactime_plcp_start = (status->flag & RX_FLAG_MACTIME) == in ieee80211_calculate_rx_timestamp()
3339 memset(&ri, 0, sizeof(ri)); in ieee80211_calculate_rx_timestamp()
3341 ri.bw = status->bw; in ieee80211_calculate_rx_timestamp()
3344 switch (status->encoding) { in ieee80211_calculate_rx_timestamp()
3346 ri.flags |= RATE_INFO_FLAGS_EHT_MCS; in ieee80211_calculate_rx_timestamp()
3347 ri.mcs = status->rate_idx; in ieee80211_calculate_rx_timestamp()
3348 ri.nss = status->nss; in ieee80211_calculate_rx_timestamp()
3349 ri.eht_ru_alloc = status->eht.ru; in ieee80211_calculate_rx_timestamp()
3350 if (status->enc_flags & RX_ENC_FLAG_SHORT_GI) in ieee80211_calculate_rx_timestamp()
3351 ri.flags |= RATE_INFO_FLAGS_SHORT_GI; in ieee80211_calculate_rx_timestamp()
3359 ri.flags |= RATE_INFO_FLAGS_HE_MCS; in ieee80211_calculate_rx_timestamp()
3360 ri.mcs = status->rate_idx; in ieee80211_calculate_rx_timestamp()
3361 ri.nss = status->nss; in ieee80211_calculate_rx_timestamp()
3362 ri.he_ru_alloc = status->he_ru; in ieee80211_calculate_rx_timestamp()
3363 if (status->enc_flags & RX_ENC_FLAG_SHORT_GI) in ieee80211_calculate_rx_timestamp()
3364 ri.flags |= RATE_INFO_FLAGS_SHORT_GI; in ieee80211_calculate_rx_timestamp()
3376 * For HE MU PPDU, add the HE-SIG-B. in ieee80211_calculate_rx_timestamp()
3377 * For HE ER PPDU, add 8us for the HE-SIG-A. in ieee80211_calculate_rx_timestamp()
3378 * For HE TB PPDU, add 4us for the HE-STF. in ieee80211_calculate_rx_timestamp()
3379 * Add the HE-LTF durations - variable. in ieee80211_calculate_rx_timestamp()
3385 ri.mcs = status->rate_idx; in ieee80211_calculate_rx_timestamp()
3386 ri.flags |= RATE_INFO_FLAGS_MCS; in ieee80211_calculate_rx_timestamp()
3387 if (status->enc_flags & RX_ENC_FLAG_SHORT_GI) in ieee80211_calculate_rx_timestamp()
3388 ri.flags |= RATE_INFO_FLAGS_SHORT_GI; in ieee80211_calculate_rx_timestamp()
3396 if (status->enc_flags & RX_ENC_FLAG_HT_GF) in ieee80211_calculate_rx_timestamp()
3402 * Add Data HT-LTFs per streams in ieee80211_calculate_rx_timestamp()
3403 * TODO: add Extension HT-LTFs, 4us per LTF in ieee80211_calculate_rx_timestamp()
3405 n_ltf = ((ri.mcs >> 3) & 3) + 1; in ieee80211_calculate_rx_timestamp()
3412 ri.flags |= RATE_INFO_FLAGS_VHT_MCS; in ieee80211_calculate_rx_timestamp()
3413 ri.mcs = status->rate_idx; in ieee80211_calculate_rx_timestamp()
3414 ri.nss = status->nss; in ieee80211_calculate_rx_timestamp()
3415 if (status->enc_flags & RX_ENC_FLAG_SHORT_GI) in ieee80211_calculate_rx_timestamp()
3416 ri.flags |= RATE_INFO_FLAGS_SHORT_GI; in ieee80211_calculate_rx_timestamp()
3427 * Add VHT-LTFs per streams in ieee80211_calculate_rx_timestamp()
3429 n_ltf = (ri.nss != 1) && (ri.nss % 2) ? in ieee80211_calculate_rx_timestamp()
3430 ri.nss + 1 : ri.nss; in ieee80211_calculate_rx_timestamp()
3441 sband = local->hw.wiphy->bands[status->band]; in ieee80211_calculate_rx_timestamp()
3442 ri.legacy = sband->bitrates[status->rate_idx].bitrate; in ieee80211_calculate_rx_timestamp()
3445 if (status->band == NL80211_BAND_5GHZ) { in ieee80211_calculate_rx_timestamp()
3448 } else if (status->enc_flags & RX_ENC_FLAG_SHORTPRE) { in ieee80211_calculate_rx_timestamp()
3458 rate = cfg80211_calculate_bitrate(&ri); in ieee80211_calculate_rx_timestamp()
3461 (unsigned long long)status->flag, status->rate_idx, in ieee80211_calculate_rx_timestamp()
3462 status->nss)) in ieee80211_calculate_rx_timestamp()
3466 if ((status->flag & RX_FLAG_MACTIME) == RX_FLAG_MACTIME_END) in ieee80211_calculate_rx_timestamp()
3467 ts -= mpdu_len * 8 * 10 / rate; in ieee80211_calculate_rx_timestamp()
3486 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_dfs_cac_cancel()
3488 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_dfs_cac_cancel()
3491 link = sdata_dereference(sdata->link[link_id], in ieee80211_dfs_cac_cancel()
3496 chanctx_conf = sdata_dereference(link->conf->chanctx_conf, in ieee80211_dfs_cac_cancel()
3498 if (ctx && &ctx->conf != chanctx_conf) in ieee80211_dfs_cac_cancel()
3501 wiphy_delayed_work_cancel(local->hw.wiphy, in ieee80211_dfs_cac_cancel()
3502 &link->dfs_cac_timer_work); in ieee80211_dfs_cac_cancel()
3504 if (!sdata->wdev.links[link_id].cac_started) in ieee80211_dfs_cac_cancel()
3507 chandef = link->conf->chanreq.oper; in ieee80211_dfs_cac_cancel()
3509 cfg80211_cac_event(sdata->dev, &chandef, in ieee80211_dfs_cac_cancel()
3524 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_dfs_radar_detected_work()
3526 list_for_each_entry(ctx, &local->chanctx_list, list) { in ieee80211_dfs_radar_detected_work()
3527 if (ctx->replace_state == IEEE80211_CHANCTX_REPLACES_OTHER) in ieee80211_dfs_radar_detected_work()
3530 if (!ctx->radar_detected) in ieee80211_dfs_radar_detected_work()
3533 ctx->radar_detected = false; in ieee80211_dfs_radar_detected_work()
3535 chandef = ctx->conf.def; in ieee80211_dfs_radar_detected_work()
3538 cfg80211_radar_event(local->hw.wiphy, &chandef, GFP_KERNEL); in ieee80211_dfs_radar_detected_work()
3551 if (ctx->replace_state == IEEE80211_CHANCTX_REPLACES_OTHER) in ieee80211_radar_mark_chan_ctx_iterator()
3557 ctx->radar_detected = true; in ieee80211_radar_mark_chan_ctx_iterator()
3570 wiphy_work_queue(hw->wiphy, &local->radar_detected_work); in ieee80211_radar_detected()
3585 /* no-HT indicates nothing to do */ in ieee80211_chandef_downgrade()
3588 switch (c->width) { in ieee80211_chandef_downgrade()
3594 c->width = NL80211_CHAN_WIDTH_20_NOHT; in ieee80211_chandef_downgrade()
3595 conn->mode = IEEE80211_CONN_MODE_LEGACY; in ieee80211_chandef_downgrade()
3596 conn->bw_limit = IEEE80211_CONN_BW_LIMIT_20; in ieee80211_chandef_downgrade()
3597 c->punctured = 0; in ieee80211_chandef_downgrade()
3600 c->width = NL80211_CHAN_WIDTH_20; in ieee80211_chandef_downgrade()
3601 c->center_freq1 = c->chan->center_freq; in ieee80211_chandef_downgrade()
3602 if (conn->mode == IEEE80211_CONN_MODE_VHT) in ieee80211_chandef_downgrade()
3603 conn->mode = IEEE80211_CONN_MODE_HT; in ieee80211_chandef_downgrade()
3604 conn->bw_limit = IEEE80211_CONN_BW_LIMIT_20; in ieee80211_chandef_downgrade()
3605 c->punctured = 0; in ieee80211_chandef_downgrade()
3609 if (conn->mode == IEEE80211_CONN_MODE_VHT) in ieee80211_chandef_downgrade()
3610 conn->mode = IEEE80211_CONN_MODE_HT; in ieee80211_chandef_downgrade()
3611 conn->bw_limit = IEEE80211_CONN_BW_LIMIT_40; in ieee80211_chandef_downgrade()
3614 c->center_freq2 = 0; in ieee80211_chandef_downgrade()
3615 c->width = NL80211_CHAN_WIDTH_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_80; in ieee80211_chandef_downgrade()
3624 conn->bw_limit = IEEE80211_CONN_BW_LIMIT_160; in ieee80211_chandef_downgrade()
3632 /* keep c->width */ in ieee80211_chandef_downgrade()
3633 conn->mode = IEEE80211_CONN_MODE_S1G; in ieee80211_chandef_downgrade()
3634 conn->bw_limit = IEEE80211_CONN_BW_LIMIT_20; in ieee80211_chandef_downgrade()
3639 /* keep c->width */ in ieee80211_chandef_downgrade()
3640 conn->mode = IEEE80211_CONN_MODE_LEGACY; in ieee80211_chandef_downgrade()
3641 conn->bw_limit = IEEE80211_CONN_BW_LIMIT_20; in ieee80211_chandef_downgrade()
3646 c->center_freq1 = cfg80211_chandef_primary(c, new_primary_width, in ieee80211_chandef_downgrade()
3647 &c->punctured); in ieee80211_chandef_downgrade()
3648 c->width = new_primary_width; in ieee80211_chandef_downgrade()
3656 if (!cfg80211_chandef_valid(c) && c->punctured) in ieee80211_chandef_downgrade()
3667 struct ieee80211_local *local = sdata->local; in ieee80211_send_action_csa()
3673 if (sdata->vif.type != NL80211_IFTYPE_ADHOC && in ieee80211_send_action_csa()
3674 sdata->vif.type != NL80211_IFTYPE_MESH_POINT) in ieee80211_send_action_csa()
3675 return -EOPNOTSUPP; in ieee80211_send_action_csa()
3677 skb = dev_alloc_skb(local->tx_headroom + hdr_len + in ieee80211_send_action_csa()
3683 return -ENOMEM; in ieee80211_send_action_csa()
3685 skb_reserve(skb, local->tx_headroom); in ieee80211_send_action_csa()
3687 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | in ieee80211_send_action_csa()
3690 eth_broadcast_addr(mgmt->da); in ieee80211_send_action_csa()
3691 memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); in ieee80211_send_action_csa()
3692 if (ieee80211_vif_is_mesh(&sdata->vif)) { in ieee80211_send_action_csa()
3693 memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN); in ieee80211_send_action_csa()
3695 struct ieee80211_if_ibss *ifibss = &sdata->u.ibss; in ieee80211_send_action_csa()
3696 memcpy(mgmt->bssid, ifibss->bssid, ETH_ALEN); in ieee80211_send_action_csa()
3698 mgmt->u.action.category = WLAN_CATEGORY_SPECTRUM_MGMT; in ieee80211_send_action_csa()
3699 mgmt->u.action.u.chan_switch.action_code = WLAN_ACTION_SPCT_CHL_SWITCH; in ieee80211_send_action_csa()
3703 *pos++ = csa_settings->block_tx ? 1 : 0; /* CSA mode */ in ieee80211_send_action_csa()
3704 freq = csa_settings->chandef.chan->center_freq; in ieee80211_send_action_csa()
3706 *pos++ = csa_settings->count; /* count */ in ieee80211_send_action_csa()
3708 if (csa_settings->chandef.width == NL80211_CHAN_WIDTH_40) { in ieee80211_send_action_csa()
3714 ch_type = cfg80211_get_chandef_type(&csa_settings->chandef); in ieee80211_send_action_csa()
3721 if (ieee80211_vif_is_mesh(&sdata->vif)) { in ieee80211_send_action_csa()
3722 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; in ieee80211_send_action_csa()
3727 *pos++ = sdata->u.mesh.mshcfg.dot11MeshTTL; /* Mesh TTL */ in ieee80211_send_action_csa()
3730 *pos++ |= csa_settings->block_tx ? in ieee80211_send_action_csa()
3734 put_unaligned_le16(ifmsh->pre_value, pos);/* Precedence Value */ in ieee80211_send_action_csa()
3738 if (csa_settings->chandef.width == NL80211_CHAN_WIDTH_80 || in ieee80211_send_action_csa()
3739 csa_settings->chandef.width == NL80211_CHAN_WIDTH_80P80 || in ieee80211_send_action_csa()
3740 csa_settings->chandef.width == NL80211_CHAN_WIDTH_160) { in ieee80211_send_action_csa()
3742 ieee80211_ie_build_wide_bw_cs(pos, &csa_settings->chandef); in ieee80211_send_action_csa()
3752 s32 end = data->desc[i].start + data->desc[i].duration - (tsf + 1); in ieee80211_extend_noa_desc()
3759 if (data->count[i] == 1) in ieee80211_extend_noa_desc()
3762 if (data->desc[i].interval == 0) in ieee80211_extend_noa_desc()
3766 skip = DIV_ROUND_UP(-end, data->desc[i].interval); in ieee80211_extend_noa_desc()
3767 if (data->count[i] < 255) { in ieee80211_extend_noa_desc()
3768 if (data->count[i] <= skip) { in ieee80211_extend_noa_desc()
3769 data->count[i] = 0; in ieee80211_extend_noa_desc()
3773 data->count[i] -= skip; in ieee80211_extend_noa_desc()
3776 data->desc[i].start += skip * data->desc[i].interval; in ieee80211_extend_noa_desc()
3791 if (!data->count[i]) in ieee80211_extend_absent_time()
3797 cur = data->desc[i].start - tsf; in ieee80211_extend_absent_time()
3801 cur = data->desc[i].start + data->desc[i].duration - tsf; in ieee80211_extend_absent_time()
3833 u32 next_offset = BIT(31) - 1; in ieee80211_update_p2p_noa()
3836 data->absent = 0; in ieee80211_update_p2p_noa()
3837 data->has_next_tsf = false; in ieee80211_update_p2p_noa()
3841 if (!data->count[i]) in ieee80211_update_p2p_noa()
3845 start = data->desc[i].start - tsf; in ieee80211_update_p2p_noa()
3847 data->absent |= BIT(i); in ieee80211_update_p2p_noa()
3852 data->has_next_tsf = true; in ieee80211_update_p2p_noa()
3855 if (data->absent) in ieee80211_update_p2p_noa()
3858 data->next_tsf = tsf + next_offset; in ieee80211_update_p2p_noa()
3871 const struct ieee80211_p2p_noa_desc *desc = &attr->desc[i]; in ieee80211_parse_p2p_noa()
3873 if (!desc->count || !desc->duration) in ieee80211_parse_p2p_noa()
3876 data->count[i] = desc->count; in ieee80211_parse_p2p_noa()
3877 data->desc[i].start = le32_to_cpu(desc->start_time); in ieee80211_parse_p2p_noa()
3878 data->desc[i].duration = le32_to_cpu(desc->duration); in ieee80211_parse_p2p_noa()
3879 data->desc[i].interval = le32_to_cpu(desc->interval); in ieee80211_parse_p2p_noa()
3881 if (data->count[i] > 1 && in ieee80211_parse_p2p_noa()
3882 data->desc[i].interval < data->desc[i].duration) in ieee80211_parse_p2p_noa()
3901 u16 beacon_int = sdata->vif.bss_conf.beacon_int * 1024; in ieee80211_recalc_dtim()
3902 u8 dtim_period = sdata->vif.bss_conf.dtim_period; in ieee80211_recalc_dtim()
3906 if (tsf == -1ULL || !beacon_int || !dtim_period) in ieee80211_recalc_dtim()
3909 if (sdata->vif.type == NL80211_IFTYPE_AP || in ieee80211_recalc_dtim()
3910 sdata->vif.type == NL80211_IFTYPE_AP_VLAN) { in ieee80211_recalc_dtim()
3911 if (!sdata->bss) in ieee80211_recalc_dtim()
3914 ps = &sdata->bss->ps; in ieee80211_recalc_dtim()
3915 } else if (ieee80211_vif_is_mesh(&sdata->vif)) { in ieee80211_recalc_dtim()
3916 ps = &sdata->u.mesh.ps; in ieee80211_recalc_dtim()
3924 * dtim_count = dtim_period - (tsf / bcn_int) % dtim_period in ieee80211_recalc_dtim()
3932 dtim_count = dtim_period - bcns_from_dtim; in ieee80211_recalc_dtim()
3934 ps->dtim_count = dtim_count; in ieee80211_recalc_dtim()
3943 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_chanctx_radar_detect()
3945 if (WARN_ON(ctx->replace_state == IEEE80211_CHANCTX_WILL_BE_REPLACED)) in ieee80211_chanctx_radar_detect()
3948 list_for_each_entry(link, &ctx->reserved_links, reserved_chanctx_list) in ieee80211_chanctx_radar_detect()
3949 if (link->reserved_radar_required) in ieee80211_chanctx_radar_detect()
3950 radar_detect |= BIT(link->reserved.oper.width); in ieee80211_chanctx_radar_detect()
3953 * An in-place reservation context should not have any assigned vifs in ieee80211_chanctx_radar_detect()
3956 WARN_ON(ctx->replace_state == IEEE80211_CHANCTX_REPLACES_OTHER && in ieee80211_chanctx_radar_detect()
3957 !list_empty(&ctx->assigned_links)); in ieee80211_chanctx_radar_detect()
3959 list_for_each_entry(link, &ctx->assigned_links, assigned_chanctx_list) { in ieee80211_chanctx_radar_detect()
3960 if (!link->radar_required) in ieee80211_chanctx_radar_detect()
3964 BIT(link->conf->chanreq.oper.width); in ieee80211_chanctx_radar_detect()
3978 for_each_vif_active_link(&sdata->vif, link_conf, link_id) { in __ieee80211_get_radio_mask()
3979 conf = sdata_dereference(link_conf->chanctx_conf, sdata); in __ieee80211_get_radio_mask()
3980 if (!conf || conf->radio_idx < 0) in __ieee80211_get_radio_mask()
3983 mask |= BIT(conf->radio_idx); in __ieee80211_get_radio_mask()
4015 list_for_each_entry(ctx, &local->chanctx_list, list) { in ieee80211_fill_ifcomb_params()
4016 if (ctx->replace_state == IEEE80211_CHANCTX_WILL_BE_REPLACED) in ieee80211_fill_ifcomb_params()
4019 if (params->radio_idx >= 0 && in ieee80211_fill_ifcomb_params()
4020 ctx->conf.radio_idx != params->radio_idx) in ieee80211_fill_ifcomb_params()
4023 params->radar_detect |= in ieee80211_fill_ifcomb_params()
4026 if (chandef && ctx->mode != IEEE80211_CHANCTX_EXCLUSIVE && in ieee80211_fill_ifcomb_params()
4027 cfg80211_chandef_compatible(chandef, &ctx->conf.def)) in ieee80211_fill_ifcomb_params()
4030 params->num_different_channels++; in ieee80211_fill_ifcomb_params()
4033 list_for_each_entry(sdata_iter, &local->interfaces, list) { in ieee80211_fill_ifcomb_params()
4036 wdev_iter = &sdata_iter->wdev; in ieee80211_fill_ifcomb_params()
4040 cfg80211_iftype_allowed(local->hw.wiphy, in ieee80211_fill_ifcomb_params()
4041 wdev_iter->iftype, 0, 1)) in ieee80211_fill_ifcomb_params()
4044 if (!ieee80211_sdata_uses_radio(sdata_iter, params->radio_idx)) in ieee80211_fill_ifcomb_params()
4047 params->iftype_num[wdev_iter->iftype]++; in ieee80211_fill_ifcomb_params()
4060 struct ieee80211_local *local = sdata->local; in ieee80211_check_combinations()
4061 enum nl80211_iftype iftype = sdata->wdev.iftype; in ieee80211_check_combinations()
4068 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_check_combinations()
4071 return -EINVAL; in ieee80211_check_combinations()
4074 !chandef->chan)) in ieee80211_check_combinations()
4075 return -EINVAL; in ieee80211_check_combinations()
4078 return -EINVAL; in ieee80211_check_combinations()
4080 if (sdata->vif.type == NL80211_IFTYPE_AP || in ieee80211_check_combinations()
4081 sdata->vif.type == NL80211_IFTYPE_MESH_POINT) { in ieee80211_check_combinations()
4087 params.new_beacon_int = sdata->vif.bss_conf.beacon_int; in ieee80211_check_combinations()
4091 if (cfg80211_iftype_allowed(local->hw.wiphy, iftype, 0, 1)) { in ieee80211_check_combinations()
4093 return -EINVAL; in ieee80211_check_combinations()
4109 return cfg80211_check_combinations(local->hw.wiphy, &params); in ieee80211_check_combinations()
4119 c->num_different_channels); in ieee80211_iter_max_chans()
4130 lockdep_assert_wiphy(local->hw.wiphy); in ieee80211_max_num_channels()
4134 err = cfg80211_iter_combinations(local->hw.wiphy, &params, in ieee80211_max_num_channels()
4147 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_add_s1g_capab_ie()
4152 if (WARN_ON(sdata->vif.type != NL80211_IFTYPE_STATION)) in ieee80211_add_s1g_capab_ie()
4155 if (!caps->s1g) in ieee80211_add_s1g_capab_ie()
4158 memcpy(s1g_capab.capab_info, caps->cap, sizeof(caps->cap)); in ieee80211_add_s1g_capab_ie()
4159 memcpy(s1g_capab.supp_mcs_nss, caps->nss_mcs, sizeof(caps->nss_mcs)); in ieee80211_add_s1g_capab_ie()
4161 /* override the capability info */ in ieee80211_add_s1g_capab_ie()
4162 for (i = 0; i < sizeof(ifmgd->s1g_capa.capab_info); i++) { in ieee80211_add_s1g_capab_ie()
4163 u8 mask = ifmgd->s1g_capa_mask.capab_info[i]; in ieee80211_add_s1g_capab_ie()
4166 s1g_capab.capab_info[i] |= ifmgd->s1g_capa.capab_info[i] & mask; in ieee80211_add_s1g_capab_ie()
4170 for (i = 0; i < sizeof(ifmgd->s1g_capa.supp_mcs_nss); i++) { in ieee80211_add_s1g_capab_ie()
4171 u8 mask = ifmgd->s1g_capa_mask.supp_mcs_nss[i]; in ieee80211_add_s1g_capab_ie()
4175 ifmgd->s1g_capa.supp_mcs_nss[i] & mask; in ieee80211_add_s1g_capab_ie()
4205 *buf++ = qosinfo; /* U-APSD no in use */ in ieee80211_add_wmm_info_ie()
4218 skb_queue_walk(&txqi->frags, skb) { in ieee80211_txq_get_depth()
4220 frag_bytes += skb->len; in ieee80211_txq_get_depth()
4224 *frame_cnt = txqi->tin.backlog_packets + frag_cnt; in ieee80211_txq_get_depth()
4227 *byte_cnt = txqi->tin.backlog_bytes + frag_bytes; in ieee80211_txq_get_depth()
4272 he_cap = ieee80211_get_he_iftype_cap_vif(sband, &sdata->vif); in ieee80211_ie_len_eht_cap()
4273 eht_cap = ieee80211_get_eht_iftype_cap_vif(sband, &sdata->vif); in ieee80211_ie_len_eht_cap()
4277 is_ap = sdata->vif.type == NL80211_IFTYPE_AP; in ieee80211_ie_len_eht_cap()
4279 n = ieee80211_eht_mcs_nss_size(&he_cap->he_cap_elem, in ieee80211_ie_len_eht_cap()
4280 &eht_cap->eht_cap_elem, in ieee80211_ie_len_eht_cap()
4283 sizeof(eht_cap->eht_cap_elem) + n + in ieee80211_ie_len_eht_cap()
4284 ieee80211_eht_ppe_size(eht_cap->eht_ppe_thres[0], in ieee80211_ie_len_eht_cap()
4285 eht_cap->eht_cap_elem.phy_cap_info); in ieee80211_ie_len_eht_cap()
4295 ieee80211_get_he_iftype_cap_vif(sband, &sdata->vif); in ieee80211_put_eht_cap()
4297 ieee80211_get_eht_iftype_cap_vif(sband, &sdata->vif); in ieee80211_put_eht_cap()
4298 bool for_ap = sdata->vif.type == NL80211_IFTYPE_AP; in ieee80211_put_eht_cap()
4312 orig_mcs_nss_len = ieee80211_eht_mcs_nss_size(&he_cap->he_cap_elem, in ieee80211_put_eht_cap()
4313 &eht_cap->eht_cap_elem, in ieee80211_put_eht_cap()
4318 fixed = eht_cap->eht_cap_elem; in ieee80211_put_eht_cap()
4320 if (conn->bw_limit < IEEE80211_CONN_BW_LIMIT_80) in ieee80211_put_eht_cap()
4324 if (conn->bw_limit < IEEE80211_CONN_BW_LIMIT_160) { in ieee80211_put_eht_cap()
4333 if (conn->bw_limit < IEEE80211_CONN_BW_LIMIT_320) { in ieee80211_put_eht_cap()
4344 if (conn->bw_limit == IEEE80211_CONN_BW_LIMIT_20) in ieee80211_put_eht_cap()
4349 ppet_len = ieee80211_eht_ppe_size(eht_cap->eht_ppe_thres[0], in ieee80211_put_eht_cap()
4352 ie_len = 2 + 1 + sizeof(eht_cap->eht_cap_elem) + mcs_nss_len + ppet_len; in ieee80211_put_eht_cap()
4354 return -ENOBUFS; in ieee80211_put_eht_cap()
4357 skb_put_u8(skb, ie_len - 2); in ieee80211_put_eht_cap()
4363 * If the (non-AP) STA became 20 MHz only, then convert from in ieee80211_put_eht_cap()
4364 * <=80 to 20-MHz-only format, where MCSes are indicated in in ieee80211_put_eht_cap()
4365 * the groups 0-7, 8-9, 10-11, 12-13 rather than just 0-9, in ieee80211_put_eht_cap()
4366 * 10-11, 12-13. Thus, use 0-9 for 0-7 and 8-9. in ieee80211_put_eht_cap()
4368 skb_put_u8(skb, eht_cap->eht_mcs_nss_supp.bw._80.rx_tx_mcs9_max_nss); in ieee80211_put_eht_cap()
4369 skb_put_u8(skb, eht_cap->eht_mcs_nss_supp.bw._80.rx_tx_mcs9_max_nss); in ieee80211_put_eht_cap()
4370 skb_put_u8(skb, eht_cap->eht_mcs_nss_supp.bw._80.rx_tx_mcs11_max_nss); in ieee80211_put_eht_cap()
4371 skb_put_u8(skb, eht_cap->eht_mcs_nss_supp.bw._80.rx_tx_mcs13_max_nss); in ieee80211_put_eht_cap()
4373 skb_put_data(skb, &eht_cap->eht_mcs_nss_supp, mcs_nss_len); in ieee80211_put_eht_cap()
4377 skb_put_data(skb, &eht_cap->eht_ppe_thres, ppet_len); in ieee80211_put_eht_cap()
4402 switch (chandef->width) { in ieee80211_min_bw_limit_from_chandef()
4416 WARN(1, "unhandled chandef width %d\n", chandef->width); in ieee80211_min_bw_limit_from_chandef()
4424 tpe->max_local[i].valid = false; in ieee80211_clear_tpe()
4425 memset(tpe->max_local[i].power, in ieee80211_clear_tpe()
4427 sizeof(tpe->max_local[i].power)); in ieee80211_clear_tpe()
4429 tpe->max_reg_client[i].valid = false; in ieee80211_clear_tpe()
4430 memset(tpe->max_reg_client[i].power, in ieee80211_clear_tpe()
4432 sizeof(tpe->max_reg_client[i].power)); in ieee80211_clear_tpe()
4434 tpe->psd_local[i].valid = false; in ieee80211_clear_tpe()
4435 memset(tpe->psd_local[i].power, in ieee80211_clear_tpe()
4437 sizeof(tpe->psd_local[i].power)); in ieee80211_clear_tpe()
4439 tpe->psd_reg_client[i].valid = false; in ieee80211_clear_tpe()
4440 memset(tpe->psd_reg_client[i].power, in ieee80211_clear_tpe()
4442 sizeof(tpe->psd_reg_client[i].power)); in ieee80211_clear_tpe()