Lines Matching +full:out +full:- +full:of +full:- +full:band
1 // SPDX-License-Identifier: GPL-2.0
5 * Copyright 2007-2009 Johannes Berg <johannes@sipsolutions.net>
6 * Copyright 2013-2014 Intel Mobile Communications GmbH
8 * Copyright (C) 2018-2023 Intel Corporation
24 #include "rdev-ops.h"
31 struct ieee80211_rate *result = &sband->bitrates[0]; in ieee80211_get_response_rate()
34 for (i = 0; i < sband->n_bitrates; i++) { in ieee80211_get_response_rate()
37 if (sband->bitrates[i].bitrate > bitrate) in ieee80211_get_response_rate()
39 result = &sband->bitrates[i]; in ieee80211_get_response_rate()
56 if (sband->band == NL80211_BAND_2GHZ) in ieee80211_mandatory_rates()
61 bitrates = sband->bitrates; in ieee80211_mandatory_rates()
62 for (i = 0; i < sband->n_bitrates; i++) in ieee80211_mandatory_rates()
69 u32 ieee80211_channel_to_freq_khz(int chan, enum nl80211_band band) in ieee80211_channel_to_freq_khz() argument
75 switch (band) { in ieee80211_channel_to_freq_khz()
112 if (WARN_ON(!chan || chan->band != NL80211_BAND_S1GHZ)) in ieee80211_s1g_channel_width()
118 if (chan->flags & IEEE80211_CHAN_1MHZ) in ieee80211_s1g_channel_width()
120 else if (chan->flags & IEEE80211_CHAN_2MHZ) in ieee80211_s1g_channel_width()
122 else if (chan->flags & IEEE80211_CHAN_4MHZ) in ieee80211_s1g_channel_width()
124 else if (chan->flags & IEEE80211_CHAN_8MHZ) in ieee80211_s1g_channel_width()
126 else if (chan->flags & IEEE80211_CHAN_16MHZ) in ieee80211_s1g_channel_width()
145 return (freq - 2407) / 5; in ieee80211_freq_khz_to_channel()
147 return (freq - 4000) / 5; in ieee80211_freq_khz_to_channel()
149 return (freq - 5000) / 5; in ieee80211_freq_khz_to_channel()
152 else if (freq <= 45000) /* DMG band lower limit */ in ieee80211_freq_khz_to_channel()
154 return (freq - 5950) / 5; in ieee80211_freq_khz_to_channel()
156 return (freq - 56160) / 2160; in ieee80211_freq_khz_to_channel()
165 enum nl80211_band band; in ieee80211_get_channel_khz() local
169 for (band = 0; band < NUM_NL80211_BANDS; band++) { in ieee80211_get_channel_khz()
170 sband = wiphy->bands[band]; in ieee80211_get_channel_khz()
175 for (i = 0; i < sband->n_channels; i++) { in ieee80211_get_channel_khz()
176 struct ieee80211_channel *chan = &sband->channels[i]; in ieee80211_get_channel_khz()
191 switch (sband->band) { in set_mandatory_flags_band()
195 for (i = 0; i < sband->n_bitrates; i++) { in set_mandatory_flags_band()
196 if (sband->bitrates[i].bitrate == 60 || in set_mandatory_flags_band()
197 sband->bitrates[i].bitrate == 120 || in set_mandatory_flags_band()
198 sband->bitrates[i].bitrate == 240) { in set_mandatory_flags_band()
199 sband->bitrates[i].flags |= in set_mandatory_flags_band()
201 want--; in set_mandatory_flags_band()
209 for (i = 0; i < sband->n_bitrates; i++) { in set_mandatory_flags_band()
210 switch (sband->bitrates[i].bitrate) { in set_mandatory_flags_band()
215 sband->bitrates[i].flags |= in set_mandatory_flags_band()
218 want--; in set_mandatory_flags_band()
223 sband->bitrates[i].flags |= in set_mandatory_flags_band()
225 want--; in set_mandatory_flags_band()
228 sband->bitrates[i].flags |= in set_mandatory_flags_band()
237 WARN_ON(!sband->ht_cap.ht_supported); in set_mandatory_flags_band()
238 WARN_ON((sband->ht_cap.mcs.rx_mask[0] & 0x1e) != 0x1e); in set_mandatory_flags_band()
241 /* Figure 9-589bd: 3 means unsupported, so != 3 means at least in set_mandatory_flags_band()
244 WARN_ON((sband->s1g_cap.nss_mcs[0] & 0x3) == 0x3); in set_mandatory_flags_band()
255 enum nl80211_band band; in ieee80211_set_bitrate_flags() local
257 for (band = 0; band < NUM_NL80211_BANDS; band++) in ieee80211_set_bitrate_flags()
258 if (wiphy->bands[band]) in ieee80211_set_bitrate_flags()
259 set_mandatory_flags_band(wiphy->bands[band]); in ieee80211_set_bitrate_flags()
265 for (i = 0; i < wiphy->n_cipher_suites; i++) in cfg80211_supported_cipher_suite()
266 if (cipher == wiphy->cipher_suites[i]) in cfg80211_supported_cipher_suite()
274 struct wiphy *wiphy = &rdev->wiphy; in cfg80211_igtk_cipher_supported()
277 for (i = 0; i < wiphy->n_cipher_suites; i++) { in cfg80211_igtk_cipher_supported()
278 switch (wiphy->cipher_suites[i]) { in cfg80211_igtk_cipher_supported()
297 else if (wiphy_ext_feature_isset(&rdev->wiphy, in cfg80211_valid_key_idx()
299 wiphy_ext_feature_isset(&rdev->wiphy, in cfg80211_valid_key_idx()
318 return -EINVAL; in cfg80211_validate_key_settings()
320 if (!pairwise && mac_addr && !(rdev->wiphy.flags & WIPHY_FLAG_IBSS_RSN)) in cfg80211_validate_key_settings()
321 return -EINVAL; in cfg80211_validate_key_settings()
324 return -EINVAL; in cfg80211_validate_key_settings()
326 switch (params->cipher) { in cfg80211_validate_key_settings()
330 params->mode != NL80211_KEY_RX_TX) in cfg80211_validate_key_settings()
331 return -EINVAL; in cfg80211_validate_key_settings()
337 /* IEEE802.11-2016 allows only 0 and - when supporting in cfg80211_validate_key_settings()
338 * Extended Key ID - 1 as index for pairwise keys. in cfg80211_validate_key_settings()
344 if ((params->mode == NL80211_KEY_NO_TX && !pairwise) || in cfg80211_validate_key_settings()
345 params->mode == NL80211_KEY_SET_TX) in cfg80211_validate_key_settings()
346 return -EINVAL; in cfg80211_validate_key_settings()
347 if (wiphy_ext_feature_isset(&rdev->wiphy, in cfg80211_validate_key_settings()
350 return -EINVAL; in cfg80211_validate_key_settings()
352 return -EINVAL; in cfg80211_validate_key_settings()
359 /* Disallow BIP (group-only) cipher as pairwise cipher */ in cfg80211_validate_key_settings()
361 return -EINVAL; in cfg80211_validate_key_settings()
363 return -EINVAL; in cfg80211_validate_key_settings()
368 return -EINVAL; in cfg80211_validate_key_settings()
374 switch (params->cipher) { in cfg80211_validate_key_settings()
376 if (params->key_len != WLAN_KEY_LEN_WEP40) in cfg80211_validate_key_settings()
377 return -EINVAL; in cfg80211_validate_key_settings()
380 if (params->key_len != WLAN_KEY_LEN_TKIP) in cfg80211_validate_key_settings()
381 return -EINVAL; in cfg80211_validate_key_settings()
384 if (params->key_len != WLAN_KEY_LEN_CCMP) in cfg80211_validate_key_settings()
385 return -EINVAL; in cfg80211_validate_key_settings()
388 if (params->key_len != WLAN_KEY_LEN_CCMP_256) in cfg80211_validate_key_settings()
389 return -EINVAL; in cfg80211_validate_key_settings()
392 if (params->key_len != WLAN_KEY_LEN_GCMP) in cfg80211_validate_key_settings()
393 return -EINVAL; in cfg80211_validate_key_settings()
396 if (params->key_len != WLAN_KEY_LEN_GCMP_256) in cfg80211_validate_key_settings()
397 return -EINVAL; in cfg80211_validate_key_settings()
400 if (params->key_len != WLAN_KEY_LEN_WEP104) in cfg80211_validate_key_settings()
401 return -EINVAL; in cfg80211_validate_key_settings()
404 if (params->key_len != WLAN_KEY_LEN_AES_CMAC) in cfg80211_validate_key_settings()
405 return -EINVAL; in cfg80211_validate_key_settings()
408 if (params->key_len != WLAN_KEY_LEN_BIP_CMAC_256) in cfg80211_validate_key_settings()
409 return -EINVAL; in cfg80211_validate_key_settings()
412 if (params->key_len != WLAN_KEY_LEN_BIP_GMAC_128) in cfg80211_validate_key_settings()
413 return -EINVAL; in cfg80211_validate_key_settings()
416 if (params->key_len != WLAN_KEY_LEN_BIP_GMAC_256) in cfg80211_validate_key_settings()
417 return -EINVAL; in cfg80211_validate_key_settings()
422 * allow using it -- but the driver must check in cfg80211_validate_key_settings()
425 * of course. in cfg80211_validate_key_settings()
430 if (params->seq) { in cfg80211_validate_key_settings()
431 switch (params->cipher) { in cfg80211_validate_key_settings()
435 return -EINVAL; in cfg80211_validate_key_settings()
445 if (params->seq_len != 6) in cfg80211_validate_key_settings()
446 return -EINVAL; in cfg80211_validate_key_settings()
451 if (!cfg80211_supported_cipher_suite(&rdev->wiphy, params->cipher)) in cfg80211_validate_key_settings()
452 return -EINVAL; in cfg80211_validate_key_settings()
463 goto out; in ieee80211_hdrlen()
474 goto out; in ieee80211_hdrlen()
480 goto out; in ieee80211_hdrlen()
491 * value of those: 0b0000000011000000 (0x00C0) in ieee80211_hdrlen()
498 out: in ieee80211_hdrlen()
506 (const struct ieee80211_hdr *)skb->data; in ieee80211_get_hdrlen_from_skb()
509 if (unlikely(skb->len < 10)) in ieee80211_get_hdrlen_from_skb()
511 hdrlen = ieee80211_hdrlen(hdr->frame_control); in ieee80211_get_hdrlen_from_skb()
512 if (unlikely(hdrlen > skb->len)) in ieee80211_get_hdrlen_from_skb()
521 /* 802.11-2012, 8.2.4.7.3 */ in __ieee80211_get_mesh_hdrlen()
535 return __ieee80211_get_mesh_hdrlen(meshhdr->flags); in ieee80211_get_mesh_hdrlen()
572 ieee80211_get_8023_tunnel_proto(skb->data + hdrlen, in ieee80211_strip_8023_mesh_hdr()
576 return -EINVAL; in ieee80211_strip_8023_mesh_hdr()
578 payload.eth.h_proto = htons(skb->len - hdrlen); in ieee80211_strip_8023_mesh_hdr()
580 mesh_addr = skb->data + sizeof(payload.eth) + ETH_ALEN; in ieee80211_strip_8023_mesh_hdr()
592 pskb_pull(skb, hdrlen - sizeof(payload.eth)); in ieee80211_strip_8023_mesh_hdr()
593 memcpy(skb->data, &payload.eth, sizeof(payload.eth)); in ieee80211_strip_8023_mesh_hdr()
603 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; in ieee80211_data_to_8023_exthdr()
611 if (unlikely(!ieee80211_is_data_present(hdr->frame_control))) in ieee80211_data_to_8023_exthdr()
612 return -1; in ieee80211_data_to_8023_exthdr()
614 hdrlen = ieee80211_hdrlen(hdr->frame_control) + data_offset; in ieee80211_data_to_8023_exthdr()
615 if (skb->len < hdrlen) in ieee80211_data_to_8023_exthdr()
616 return -1; in ieee80211_data_to_8023_exthdr()
630 switch (hdr->frame_control & in ieee80211_data_to_8023_exthdr()
636 return -1; in ieee80211_data_to_8023_exthdr()
642 return -1; in ieee80211_data_to_8023_exthdr()
650 return -1; in ieee80211_data_to_8023_exthdr()
656 return -1; in ieee80211_data_to_8023_exthdr()
663 /* remove RFC1042 or Bridge-Tunnel encapsulation */ in ieee80211_data_to_8023_exthdr()
667 tmp.h_proto = htons(skb->len - hdrlen); in ieee80211_data_to_8023_exthdr()
688 page_offset = ptr - page_address(page); in __frame_add_frag()
689 skb_add_rx_frag(skb, sh->nr_frags, page, page_offset, len, size); in __frame_add_frag()
697 const skb_frag_t *frag = &sh->frags[0]; in __ieee80211_amsdu_copy_frag()
701 int head_size = skb->len - skb->data_len; in __ieee80211_amsdu_copy_frag()
704 frag_page = virt_to_head_page(skb->head); in __ieee80211_amsdu_copy_frag()
705 frag_ptr = skb->data; in __ieee80211_amsdu_copy_frag()
709 offset -= frag_size; in __ieee80211_amsdu_copy_frag()
717 frag_len = frag_size - offset; in __ieee80211_amsdu_copy_frag()
722 len -= cur_len; in __ieee80211_amsdu_copy_frag()
729 len -= cur_len; in __ieee80211_amsdu_copy_frag()
742 if (skb->len - offset < len) in __ieee80211_amsdu_copy()
761 frame->priority = skb->priority; in __ieee80211_amsdu_copy()
765 len -= cur_len; in __ieee80211_amsdu_copy()
796 for (offset = 0; offset < skb->len; offset += subframe_len + padding) { in ieee80211_is_valid_amsdu()
797 int remaining = skb->len - offset; in ieee80211_is_valid_amsdu()
813 padding = (4 - subframe_len) & 0x3; in ieee80211_is_valid_amsdu()
836 bool reuse_frag = skb->head_frag && !skb_has_frag_list(skb); in ieee80211_amsdu_to_8023s()
845 int remaining = skb->len - offset; in ieee80211_amsdu_to_8023s()
859 padding = (4 - subframe_len) & 0x3; in ieee80211_amsdu_to_8023s()
864 /* mitigate A-MSDU aggregation injection attacks */ in ieee80211_amsdu_to_8023s()
894 frame->dev = skb->dev; in ieee80211_amsdu_to_8023s()
895 frame->priority = skb->priority; in ieee80211_amsdu_to_8023s()
898 ieee80211_get_8023_tunnel_proto(frame->data, &hdr.eth.h_proto))) in ieee80211_amsdu_to_8023s()
924 /* skb->priority values from 256->263 are magic values to in cfg80211_classify8021d()
929 if (skb->priority >= 256 && skb->priority <= 263) { in cfg80211_classify8021d()
930 ret = skb->priority - 256; in cfg80211_classify8021d()
931 goto out; in cfg80211_classify8021d()
939 goto out; in cfg80211_classify8021d()
943 switch (skb->protocol) { in cfg80211_classify8021d()
959 ret = (ntohl(mpls->entry) & MPLS_LS_TC_MASK) in cfg80211_classify8021d()
961 goto out; in cfg80211_classify8021d()
973 for (i = 0; i < qos_map->num_des; i++) { in cfg80211_classify8021d()
974 if (tmp_dscp == qos_map->dscp_exception[i].dscp) { in cfg80211_classify8021d()
975 ret = qos_map->dscp_exception[i].up; in cfg80211_classify8021d()
976 goto out; in cfg80211_classify8021d()
981 if (tmp_dscp >= qos_map->up[i].low && in cfg80211_classify8021d()
982 tmp_dscp <= qos_map->up[i].high) { in cfg80211_classify8021d()
984 goto out; in cfg80211_classify8021d()
990 * Most Significant Bits (MSBs) of the DSCP are used as the in cfg80211_classify8021d()
996 * described above) doesn't adhere to the intended usage of the DSCP in cfg80211_classify8021d()
999 * - Standard: DF in cfg80211_classify8021d()
1000 * - Low Priority Data: CS1 in cfg80211_classify8021d()
1001 * - Multimedia Conferencing: AF41, AF42, AF43 in cfg80211_classify8021d()
1002 * - Network Control Traffic: CS7 in cfg80211_classify8021d()
1003 * - Real-Time Interactive: CS4 in cfg80211_classify8021d()
1004 * - Signaling: CS5 in cfg80211_classify8021d()
1048 out: in cfg80211_classify8021d()
1057 ies = rcu_dereference(bss->ies); in ieee80211_bss_get_elem()
1061 return cfg80211_find_elem(id, ies->data, ies->len); in ieee80211_bss_get_elem()
1067 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); in cfg80211_upload_connect_keys()
1068 struct net_device *dev = wdev->netdev; in cfg80211_upload_connect_keys()
1071 if (!wdev->connect_keys) in cfg80211_upload_connect_keys()
1075 if (!wdev->connect_keys->params[i].cipher) in cfg80211_upload_connect_keys()
1077 if (rdev_add_key(rdev, dev, -1, i, false, NULL, in cfg80211_upload_connect_keys()
1078 &wdev->connect_keys->params[i])) { in cfg80211_upload_connect_keys()
1082 if (wdev->connect_keys->def == i && in cfg80211_upload_connect_keys()
1083 rdev_set_default_key(rdev, dev, -1, i, true, true)) { in cfg80211_upload_connect_keys()
1089 kfree_sensitive(wdev->connect_keys); in cfg80211_upload_connect_keys()
1090 wdev->connect_keys = NULL; in cfg80211_upload_connect_keys()
1098 spin_lock_irqsave(&wdev->event_lock, flags); in cfg80211_process_wdev_events()
1099 while (!list_empty(&wdev->event_list)) { in cfg80211_process_wdev_events()
1100 ev = list_first_entry(&wdev->event_list, in cfg80211_process_wdev_events()
1102 list_del(&ev->list); in cfg80211_process_wdev_events()
1103 spin_unlock_irqrestore(&wdev->event_lock, flags); in cfg80211_process_wdev_events()
1105 switch (ev->type) { in cfg80211_process_wdev_events()
1108 wdev->netdev, in cfg80211_process_wdev_events()
1109 &ev->cr, in cfg80211_process_wdev_events()
1110 ev->cr.status == WLAN_STATUS_SUCCESS); in cfg80211_process_wdev_events()
1113 __cfg80211_roamed(wdev, &ev->rm); in cfg80211_process_wdev_events()
1116 __cfg80211_disconnected(wdev->netdev, in cfg80211_process_wdev_events()
1117 ev->dc.ie, ev->dc.ie_len, in cfg80211_process_wdev_events()
1118 ev->dc.reason, in cfg80211_process_wdev_events()
1119 !ev->dc.locally_generated); in cfg80211_process_wdev_events()
1122 __cfg80211_ibss_joined(wdev->netdev, ev->ij.bssid, in cfg80211_process_wdev_events()
1123 ev->ij.channel); in cfg80211_process_wdev_events()
1126 cfg80211_leave(wiphy_to_rdev(wdev->wiphy), wdev); in cfg80211_process_wdev_events()
1129 __cfg80211_port_authorized(wdev, ev->pa.peer_addr, in cfg80211_process_wdev_events()
1130 ev->pa.td_bitmap, in cfg80211_process_wdev_events()
1131 ev->pa.td_bitmap_len); in cfg80211_process_wdev_events()
1137 spin_lock_irqsave(&wdev->event_lock, flags); in cfg80211_process_wdev_events()
1139 spin_unlock_irqrestore(&wdev->event_lock, flags); in cfg80211_process_wdev_events()
1146 lockdep_assert_held(&rdev->wiphy.mtx); in cfg80211_process_rdev_events()
1148 list_for_each_entry(wdev, &rdev->wiphy.wdev_list, list) in cfg80211_process_rdev_events()
1157 enum nl80211_iftype otype = dev->ieee80211_ptr->iftype; in cfg80211_change_iface()
1159 lockdep_assert_held(&rdev->wiphy.mtx); in cfg80211_change_iface()
1161 /* don't support changing VLANs, you just re-create them */ in cfg80211_change_iface()
1163 return -EOPNOTSUPP; in cfg80211_change_iface()
1168 return -EOPNOTSUPP; in cfg80211_change_iface()
1170 if (!rdev->ops->change_virtual_intf || in cfg80211_change_iface()
1171 !(rdev->wiphy.interface_modes & (1 << ntype))) in cfg80211_change_iface()
1172 return -EOPNOTSUPP; in cfg80211_change_iface()
1175 /* if it's part of a bridge, reject changing type to station/ibss */ in cfg80211_change_iface()
1180 return -EBUSY; in cfg80211_change_iface()
1182 dev->ieee80211_ptr->use_4addr = false; in cfg80211_change_iface()
1188 cfg80211_stop_ap(rdev, dev, -1, true); in cfg80211_change_iface()
1209 cfg80211_mlme_purge_registrations(dev->ieee80211_ptr); in cfg80211_change_iface()
1211 memset(&dev->ieee80211_ptr->u, 0, in cfg80211_change_iface()
1212 sizeof(dev->ieee80211_ptr->u)); in cfg80211_change_iface()
1213 memset(&dev->ieee80211_ptr->links, 0, in cfg80211_change_iface()
1214 sizeof(dev->ieee80211_ptr->links)); in cfg80211_change_iface()
1219 WARN_ON(!err && dev->ieee80211_ptr->iftype != ntype); in cfg80211_change_iface()
1221 if (!err && params && params->use_4addr != -1) in cfg80211_change_iface()
1222 dev->ieee80211_ptr->use_4addr = params->use_4addr; in cfg80211_change_iface()
1225 dev->priv_flags &= ~IFF_DONT_BRIDGE; in cfg80211_change_iface()
1228 if (dev->ieee80211_ptr->use_4addr) in cfg80211_change_iface()
1234 dev->priv_flags |= IFF_DONT_BRIDGE; in cfg80211_change_iface()
1259 cfg80211_update_iface_num(rdev, otype, -1); in cfg80211_change_iface()
1270 if (WARN_ON_ONCE(rate->mcs >= 32)) in cfg80211_calculate_bitrate_ht()
1273 modulation = rate->mcs & 7; in cfg80211_calculate_bitrate_ht()
1274 streams = (rate->mcs >> 3) + 1; in cfg80211_calculate_bitrate_ht()
1276 bitrate = (rate->bw == RATE_INFO_BW_40) ? 13500000 : 6500000; in cfg80211_calculate_bitrate_ht()
1287 if (rate->flags & RATE_INFO_FLAGS_SHORT_GI) in cfg80211_calculate_bitrate_ht()
1325 /* LP-SC PHY */ in cfg80211_calculate_bitrate_dmg()
1335 if (WARN_ON_ONCE(rate->mcs >= ARRAY_SIZE(__mcs2bitrate))) in cfg80211_calculate_bitrate_dmg()
1338 return __mcs2bitrate[rate->mcs]; in cfg80211_calculate_bitrate_dmg()
1344 [6 - 6] = 26950, /* MCS 9.1 : 2695.0 mbps */ in cfg80211_calculate_bitrate_extended_sc_dmg()
1345 [7 - 6] = 50050, /* MCS 12.1 */ in cfg80211_calculate_bitrate_extended_sc_dmg()
1346 [8 - 6] = 53900, in cfg80211_calculate_bitrate_extended_sc_dmg()
1347 [9 - 6] = 57750, in cfg80211_calculate_bitrate_extended_sc_dmg()
1348 [10 - 6] = 63900, in cfg80211_calculate_bitrate_extended_sc_dmg()
1349 [11 - 6] = 75075, in cfg80211_calculate_bitrate_extended_sc_dmg()
1350 [12 - 6] = 80850, in cfg80211_calculate_bitrate_extended_sc_dmg()
1354 if (WARN_ON_ONCE(rate->mcs < 6 || rate->mcs > 12)) in cfg80211_calculate_bitrate_extended_sc_dmg()
1357 return __mcs2bitrate[rate->mcs - 6]; in cfg80211_calculate_bitrate_extended_sc_dmg()
1388 if (WARN_ON_ONCE(rate->mcs >= ARRAY_SIZE(__mcs2bitrate))) in cfg80211_calculate_bitrate_edmg()
1391 return __mcs2bitrate[rate->mcs] * rate->n_bonded_ch; in cfg80211_calculate_bitrate_edmg()
1454 if (rate->mcs > 11) in cfg80211_calculate_bitrate_vht()
1457 switch (rate->bw) { in cfg80211_calculate_bitrate_vht()
1475 bitrate = base[idx][rate->mcs]; in cfg80211_calculate_bitrate_vht()
1476 bitrate *= rate->nss; in cfg80211_calculate_bitrate_vht()
1478 if (rate->flags & RATE_INFO_FLAGS_SHORT_GI) in cfg80211_calculate_bitrate_vht()
1485 rate->bw, rate->mcs, rate->nss); in cfg80211_calculate_bitrate_vht()
1518 if (WARN_ON_ONCE(rate->mcs > 13)) in cfg80211_calculate_bitrate_he()
1521 if (WARN_ON_ONCE(rate->he_gi > NL80211_RATE_INFO_HE_GI_3_2)) in cfg80211_calculate_bitrate_he()
1523 if (WARN_ON_ONCE(rate->he_ru_alloc > in cfg80211_calculate_bitrate_he()
1526 if (WARN_ON_ONCE(rate->nss < 1 || rate->nss > 8)) in cfg80211_calculate_bitrate_he()
1529 if (rate->bw == RATE_INFO_BW_160 || in cfg80211_calculate_bitrate_he()
1530 (rate->bw == RATE_INFO_BW_HE_RU && in cfg80211_calculate_bitrate_he()
1531 rate->he_ru_alloc == NL80211_RATE_INFO_HE_RU_ALLOC_2x996)) in cfg80211_calculate_bitrate_he()
1532 result = rates_160M[rate->he_gi]; in cfg80211_calculate_bitrate_he()
1533 else if (rate->bw == RATE_INFO_BW_80 || in cfg80211_calculate_bitrate_he()
1534 (rate->bw == RATE_INFO_BW_HE_RU && in cfg80211_calculate_bitrate_he()
1535 rate->he_ru_alloc == NL80211_RATE_INFO_HE_RU_ALLOC_996)) in cfg80211_calculate_bitrate_he()
1536 result = rates_996[rate->he_gi]; in cfg80211_calculate_bitrate_he()
1537 else if (rate->bw == RATE_INFO_BW_40 || in cfg80211_calculate_bitrate_he()
1538 (rate->bw == RATE_INFO_BW_HE_RU && in cfg80211_calculate_bitrate_he()
1539 rate->he_ru_alloc == NL80211_RATE_INFO_HE_RU_ALLOC_484)) in cfg80211_calculate_bitrate_he()
1540 result = rates_484[rate->he_gi]; in cfg80211_calculate_bitrate_he()
1541 else if (rate->bw == RATE_INFO_BW_20 || in cfg80211_calculate_bitrate_he()
1542 (rate->bw == RATE_INFO_BW_HE_RU && in cfg80211_calculate_bitrate_he()
1543 rate->he_ru_alloc == NL80211_RATE_INFO_HE_RU_ALLOC_242)) in cfg80211_calculate_bitrate_he()
1544 result = rates_242[rate->he_gi]; in cfg80211_calculate_bitrate_he()
1545 else if (rate->bw == RATE_INFO_BW_HE_RU && in cfg80211_calculate_bitrate_he()
1546 rate->he_ru_alloc == NL80211_RATE_INFO_HE_RU_ALLOC_106) in cfg80211_calculate_bitrate_he()
1547 result = rates_106[rate->he_gi]; in cfg80211_calculate_bitrate_he()
1548 else if (rate->bw == RATE_INFO_BW_HE_RU && in cfg80211_calculate_bitrate_he()
1549 rate->he_ru_alloc == NL80211_RATE_INFO_HE_RU_ALLOC_52) in cfg80211_calculate_bitrate_he()
1550 result = rates_52[rate->he_gi]; in cfg80211_calculate_bitrate_he()
1551 else if (rate->bw == RATE_INFO_BW_HE_RU && in cfg80211_calculate_bitrate_he()
1552 rate->he_ru_alloc == NL80211_RATE_INFO_HE_RU_ALLOC_26) in cfg80211_calculate_bitrate_he()
1553 result = rates_26[rate->he_gi]; in cfg80211_calculate_bitrate_he()
1556 rate->bw, rate->he_ru_alloc); in cfg80211_calculate_bitrate_he()
1563 do_div(tmp, mcs_divisors[rate->mcs]); in cfg80211_calculate_bitrate_he()
1567 result = (result * rate->nss) / 8; in cfg80211_calculate_bitrate_he()
1568 if (rate->he_dcm) in cfg80211_calculate_bitrate_he()
1604 if (WARN_ON_ONCE(rate->mcs > 15)) in cfg80211_calculate_bitrate_eht()
1606 if (WARN_ON_ONCE(rate->eht_gi > NL80211_RATE_INFO_EHT_GI_3_2)) in cfg80211_calculate_bitrate_eht()
1608 if (WARN_ON_ONCE(rate->eht_ru_alloc > in cfg80211_calculate_bitrate_eht()
1611 if (WARN_ON_ONCE(rate->nss < 1 || rate->nss > 8)) in cfg80211_calculate_bitrate_eht()
1615 if (rate->mcs == 14) { in cfg80211_calculate_bitrate_eht()
1616 if ((rate->bw != RATE_INFO_BW_EHT_RU && in cfg80211_calculate_bitrate_eht()
1617 rate->bw != RATE_INFO_BW_80 && in cfg80211_calculate_bitrate_eht()
1618 rate->bw != RATE_INFO_BW_160 && in cfg80211_calculate_bitrate_eht()
1619 rate->bw != RATE_INFO_BW_320) || in cfg80211_calculate_bitrate_eht()
1620 (rate->bw == RATE_INFO_BW_EHT_RU && in cfg80211_calculate_bitrate_eht()
1621 rate->eht_ru_alloc != NL80211_RATE_INFO_EHT_RU_ALLOC_996 && in cfg80211_calculate_bitrate_eht()
1622 rate->eht_ru_alloc != NL80211_RATE_INFO_EHT_RU_ALLOC_2x996 && in cfg80211_calculate_bitrate_eht()
1623 rate->eht_ru_alloc != NL80211_RATE_INFO_EHT_RU_ALLOC_4x996)) { in cfg80211_calculate_bitrate_eht()
1625 rate->bw, rate->eht_ru_alloc); in cfg80211_calculate_bitrate_eht()
1630 if (rate->bw == RATE_INFO_BW_320 || in cfg80211_calculate_bitrate_eht()
1631 (rate->bw == RATE_INFO_BW_EHT_RU && in cfg80211_calculate_bitrate_eht()
1632 rate->eht_ru_alloc == NL80211_RATE_INFO_EHT_RU_ALLOC_4x996)) in cfg80211_calculate_bitrate_eht()
1633 result = 4 * rates_996[rate->eht_gi]; in cfg80211_calculate_bitrate_eht()
1634 else if (rate->bw == RATE_INFO_BW_EHT_RU && in cfg80211_calculate_bitrate_eht()
1635 rate->eht_ru_alloc == NL80211_RATE_INFO_EHT_RU_ALLOC_3x996P484) in cfg80211_calculate_bitrate_eht()
1636 result = 3 * rates_996[rate->eht_gi] + rates_484[rate->eht_gi]; in cfg80211_calculate_bitrate_eht()
1637 else if (rate->bw == RATE_INFO_BW_EHT_RU && in cfg80211_calculate_bitrate_eht()
1638 rate->eht_ru_alloc == NL80211_RATE_INFO_EHT_RU_ALLOC_3x996) in cfg80211_calculate_bitrate_eht()
1639 result = 3 * rates_996[rate->eht_gi]; in cfg80211_calculate_bitrate_eht()
1640 else if (rate->bw == RATE_INFO_BW_EHT_RU && in cfg80211_calculate_bitrate_eht()
1641 rate->eht_ru_alloc == NL80211_RATE_INFO_EHT_RU_ALLOC_2x996P484) in cfg80211_calculate_bitrate_eht()
1642 result = 2 * rates_996[rate->eht_gi] + rates_484[rate->eht_gi]; in cfg80211_calculate_bitrate_eht()
1643 else if (rate->bw == RATE_INFO_BW_160 || in cfg80211_calculate_bitrate_eht()
1644 (rate->bw == RATE_INFO_BW_EHT_RU && in cfg80211_calculate_bitrate_eht()
1645 rate->eht_ru_alloc == NL80211_RATE_INFO_EHT_RU_ALLOC_2x996)) in cfg80211_calculate_bitrate_eht()
1646 result = 2 * rates_996[rate->eht_gi]; in cfg80211_calculate_bitrate_eht()
1647 else if (rate->bw == RATE_INFO_BW_EHT_RU && in cfg80211_calculate_bitrate_eht()
1648 rate->eht_ru_alloc == in cfg80211_calculate_bitrate_eht()
1650 result = rates_996[rate->eht_gi] + rates_484[rate->eht_gi] in cfg80211_calculate_bitrate_eht()
1651 + rates_242[rate->eht_gi]; in cfg80211_calculate_bitrate_eht()
1652 else if (rate->bw == RATE_INFO_BW_EHT_RU && in cfg80211_calculate_bitrate_eht()
1653 rate->eht_ru_alloc == NL80211_RATE_INFO_EHT_RU_ALLOC_996P484) in cfg80211_calculate_bitrate_eht()
1654 result = rates_996[rate->eht_gi] + rates_484[rate->eht_gi]; in cfg80211_calculate_bitrate_eht()
1655 else if (rate->bw == RATE_INFO_BW_80 || in cfg80211_calculate_bitrate_eht()
1656 (rate->bw == RATE_INFO_BW_EHT_RU && in cfg80211_calculate_bitrate_eht()
1657 rate->eht_ru_alloc == NL80211_RATE_INFO_EHT_RU_ALLOC_996)) in cfg80211_calculate_bitrate_eht()
1658 result = rates_996[rate->eht_gi]; in cfg80211_calculate_bitrate_eht()
1659 else if (rate->bw == RATE_INFO_BW_EHT_RU && in cfg80211_calculate_bitrate_eht()
1660 rate->eht_ru_alloc == NL80211_RATE_INFO_EHT_RU_ALLOC_484P242) in cfg80211_calculate_bitrate_eht()
1661 result = rates_484[rate->eht_gi] + rates_242[rate->eht_gi]; in cfg80211_calculate_bitrate_eht()
1662 else if (rate->bw == RATE_INFO_BW_40 || in cfg80211_calculate_bitrate_eht()
1663 (rate->bw == RATE_INFO_BW_EHT_RU && in cfg80211_calculate_bitrate_eht()
1664 rate->eht_ru_alloc == NL80211_RATE_INFO_EHT_RU_ALLOC_484)) in cfg80211_calculate_bitrate_eht()
1665 result = rates_484[rate->eht_gi]; in cfg80211_calculate_bitrate_eht()
1666 else if (rate->bw == RATE_INFO_BW_20 || in cfg80211_calculate_bitrate_eht()
1667 (rate->bw == RATE_INFO_BW_EHT_RU && in cfg80211_calculate_bitrate_eht()
1668 rate->eht_ru_alloc == NL80211_RATE_INFO_EHT_RU_ALLOC_242)) in cfg80211_calculate_bitrate_eht()
1669 result = rates_242[rate->eht_gi]; in cfg80211_calculate_bitrate_eht()
1670 else if (rate->bw == RATE_INFO_BW_EHT_RU && in cfg80211_calculate_bitrate_eht()
1671 rate->eht_ru_alloc == NL80211_RATE_INFO_EHT_RU_ALLOC_106P26) in cfg80211_calculate_bitrate_eht()
1672 result = rates_106[rate->eht_gi] + rates_26[rate->eht_gi]; in cfg80211_calculate_bitrate_eht()
1673 else if (rate->bw == RATE_INFO_BW_EHT_RU && in cfg80211_calculate_bitrate_eht()
1674 rate->eht_ru_alloc == NL80211_RATE_INFO_EHT_RU_ALLOC_106) in cfg80211_calculate_bitrate_eht()
1675 result = rates_106[rate->eht_gi]; in cfg80211_calculate_bitrate_eht()
1676 else if (rate->bw == RATE_INFO_BW_EHT_RU && in cfg80211_calculate_bitrate_eht()
1677 rate->eht_ru_alloc == NL80211_RATE_INFO_EHT_RU_ALLOC_52P26) in cfg80211_calculate_bitrate_eht()
1678 result = rates_52[rate->eht_gi] + rates_26[rate->eht_gi]; in cfg80211_calculate_bitrate_eht()
1679 else if (rate->bw == RATE_INFO_BW_EHT_RU && in cfg80211_calculate_bitrate_eht()
1680 rate->eht_ru_alloc == NL80211_RATE_INFO_EHT_RU_ALLOC_52) in cfg80211_calculate_bitrate_eht()
1681 result = rates_52[rate->eht_gi]; in cfg80211_calculate_bitrate_eht()
1682 else if (rate->bw == RATE_INFO_BW_EHT_RU && in cfg80211_calculate_bitrate_eht()
1683 rate->eht_ru_alloc == NL80211_RATE_INFO_EHT_RU_ALLOC_26) in cfg80211_calculate_bitrate_eht()
1684 result = rates_26[rate->eht_gi]; in cfg80211_calculate_bitrate_eht()
1687 rate->bw, rate->eht_ru_alloc); in cfg80211_calculate_bitrate_eht()
1694 do_div(tmp, mcs_divisors[rate->mcs]); in cfg80211_calculate_bitrate_eht()
1697 tmp *= rate->nss; in cfg80211_calculate_bitrate_eht()
1771 if (rate->mcs >= 11) in cfg80211_calculate_bitrate_s1g()
1774 switch (rate->bw) { in cfg80211_calculate_bitrate_s1g()
1800 bitrate = base[idx][rate->mcs]; in cfg80211_calculate_bitrate_s1g()
1801 bitrate *= rate->nss; in cfg80211_calculate_bitrate_s1g()
1803 if (rate->flags & RATE_INFO_FLAGS_SHORT_GI) in cfg80211_calculate_bitrate_s1g()
1809 rate->bw, rate->mcs, rate->nss); in cfg80211_calculate_bitrate_s1g()
1815 if (rate->flags & RATE_INFO_FLAGS_MCS) in cfg80211_calculate_bitrate()
1817 if (rate->flags & RATE_INFO_FLAGS_DMG) in cfg80211_calculate_bitrate()
1819 if (rate->flags & RATE_INFO_FLAGS_EXTENDED_SC_DMG) in cfg80211_calculate_bitrate()
1821 if (rate->flags & RATE_INFO_FLAGS_EDMG) in cfg80211_calculate_bitrate()
1823 if (rate->flags & RATE_INFO_FLAGS_VHT_MCS) in cfg80211_calculate_bitrate()
1825 if (rate->flags & RATE_INFO_FLAGS_HE_MCS) in cfg80211_calculate_bitrate()
1827 if (rate->flags & RATE_INFO_FLAGS_EHT_MCS) in cfg80211_calculate_bitrate()
1829 if (rate->flags & RATE_INFO_FLAGS_S1G_MCS) in cfg80211_calculate_bitrate()
1832 return rate->legacy; in cfg80211_calculate_bitrate()
1840 u8 *out = buf; in cfg80211_get_p2p_attr() local
1851 return -EILSEQ; in cfg80211_get_p2p_attr()
1854 return -EILSEQ; in cfg80211_get_p2p_attr()
1869 iedatalen -= 4; in cfg80211_get_p2p_attr()
1876 if (out) { in cfg80211_get_p2p_attr()
1877 memcpy(out, iedata, min(bufsize, copy)); in cfg80211_get_p2p_attr()
1878 out += min(bufsize, copy); in cfg80211_get_p2p_attr()
1879 bufsize -= min(bufsize, copy); in cfg80211_get_p2p_attr()
1887 attr_remaining -= copy; in cfg80211_get_p2p_attr()
1891 iedatalen -= copy; in cfg80211_get_p2p_attr()
1899 return -EILSEQ; in cfg80211_get_p2p_attr()
1902 iedatalen -= 3; in cfg80211_get_p2p_attr()
1909 if (out) { in cfg80211_get_p2p_attr()
1910 memcpy(out, iedata, min(bufsize, copy)); in cfg80211_get_p2p_attr()
1911 out += min(bufsize, copy); in cfg80211_get_p2p_attr()
1912 bufsize -= min(bufsize, copy); in cfg80211_get_p2p_attr()
1920 iedatalen -= copy; in cfg80211_get_p2p_attr()
1921 attr_remaining = attr_len - copy; in cfg80211_get_p2p_attr()
1925 len -= ies[1] + 2; in cfg80211_get_p2p_attr()
1930 return -EILSEQ; in cfg80211_get_p2p_attr()
1932 return -ENOENT; in cfg80211_get_p2p_attr()
1941 if (WARN_ON(ids[n_ids - 1] == WLAN_EID_EXTENSION)) in ieee80211_id_in_list()
2036 elem_len = skb->data + skb->len - len_pos - 1; in ieee80211_fragment_element()
2042 elem_len -= 255; in ieee80211_fragment_element()
2059 enum nl80211_band *band) in ieee80211_operating_class_to_band() argument
2065 *band = NL80211_BAND_5GHZ; in ieee80211_operating_class_to_band()
2069 *band = NL80211_BAND_6GHZ; in ieee80211_operating_class_to_band()
2075 *band = NL80211_BAND_2GHZ; in ieee80211_operating_class_to_band()
2078 *band = NL80211_BAND_60GHZ; in ieee80211_operating_class_to_band()
2091 enum nl80211_band band; in ieee80211_operating_class_to_chandef() local
2093 if (!ieee80211_operating_class_to_band(operating_class, &band) || in ieee80211_operating_class_to_chandef()
2094 !chan || band != chan->band) in ieee80211_operating_class_to_chandef()
2097 control_freq = chan->center_freq; in ieee80211_operating_class_to_chandef()
2098 chandef->chan = chan; in ieee80211_operating_class_to_chandef()
2101 offset = control_freq - 5955; in ieee80211_operating_class_to_chandef()
2103 offset = control_freq - 5745; in ieee80211_operating_class_to_chandef()
2105 offset = control_freq - 5180; in ieee80211_operating_class_to_chandef()
2109 case 81: /* 2 GHz band; 20 MHz; channels 1..13 */ in ieee80211_operating_class_to_chandef()
2110 case 82: /* 2 GHz band; 20 MHz; channel 14 */ in ieee80211_operating_class_to_chandef()
2111 case 115: /* 5 GHz band; 20 MHz; channels 36,40,44,48 */ in ieee80211_operating_class_to_chandef()
2112 case 118: /* 5 GHz band; 20 MHz; channels 52,56,60,64 */ in ieee80211_operating_class_to_chandef()
2113 case 121: /* 5 GHz band; 20 MHz; channels 100..144 */ in ieee80211_operating_class_to_chandef()
2114 case 124: /* 5 GHz band; 20 MHz; channels 149,153,157,161 */ in ieee80211_operating_class_to_chandef()
2115 case 125: /* 5 GHz band; 20 MHz; channels 149..177 */ in ieee80211_operating_class_to_chandef()
2116 case 131: /* 6 GHz band; 20 MHz; channels 1..233*/ in ieee80211_operating_class_to_chandef()
2117 case 136: /* 6 GHz band; 20 MHz; channel 2 */ in ieee80211_operating_class_to_chandef()
2118 chandef->center_freq1 = control_freq; in ieee80211_operating_class_to_chandef()
2119 chandef->width = NL80211_CHAN_WIDTH_20; in ieee80211_operating_class_to_chandef()
2121 case 83: /* 2 GHz band; 40 MHz; channels 1..9 */ in ieee80211_operating_class_to_chandef()
2122 case 116: /* 5 GHz band; 40 MHz; channels 36,44 */ in ieee80211_operating_class_to_chandef()
2123 case 119: /* 5 GHz band; 40 MHz; channels 52,60 */ in ieee80211_operating_class_to_chandef()
2124 case 122: /* 5 GHz band; 40 MHz; channels 100,108,116,124,132,140 */ in ieee80211_operating_class_to_chandef()
2125 case 126: /* 5 GHz band; 40 MHz; channels 149,157,165,173 */ in ieee80211_operating_class_to_chandef()
2126 chandef->center_freq1 = control_freq + 10; in ieee80211_operating_class_to_chandef()
2127 chandef->width = NL80211_CHAN_WIDTH_40; in ieee80211_operating_class_to_chandef()
2129 case 84: /* 2 GHz band; 40 MHz; channels 5..13 */ in ieee80211_operating_class_to_chandef()
2130 case 117: /* 5 GHz band; 40 MHz; channels 40,48 */ in ieee80211_operating_class_to_chandef()
2131 case 120: /* 5 GHz band; 40 MHz; channels 56,64 */ in ieee80211_operating_class_to_chandef()
2132 case 123: /* 5 GHz band; 40 MHz; channels 104,112,120,128,136,144 */ in ieee80211_operating_class_to_chandef()
2133 case 127: /* 5 GHz band; 40 MHz; channels 153,161,169,177 */ in ieee80211_operating_class_to_chandef()
2134 chandef->center_freq1 = control_freq - 10; in ieee80211_operating_class_to_chandef()
2135 chandef->width = NL80211_CHAN_WIDTH_40; in ieee80211_operating_class_to_chandef()
2137 case 132: /* 6 GHz band; 40 MHz; channels 1,5,..,229*/ in ieee80211_operating_class_to_chandef()
2138 chandef->center_freq1 = control_freq + 10 - (offset & 1) * 20; in ieee80211_operating_class_to_chandef()
2139 chandef->width = NL80211_CHAN_WIDTH_40; in ieee80211_operating_class_to_chandef()
2141 case 128: /* 5 GHz band; 80 MHz; channels 36..64,100..144,149..177 */ in ieee80211_operating_class_to_chandef()
2142 case 133: /* 6 GHz band; 80 MHz; channels 1,5,..,229 */ in ieee80211_operating_class_to_chandef()
2143 chandef->center_freq1 = control_freq + 30 - (offset & 3) * 20; in ieee80211_operating_class_to_chandef()
2144 chandef->width = NL80211_CHAN_WIDTH_80; in ieee80211_operating_class_to_chandef()
2146 case 129: /* 5 GHz band; 160 MHz; channels 36..64,100..144,149..177 */ in ieee80211_operating_class_to_chandef()
2147 case 134: /* 6 GHz band; 160 MHz; channels 1,5,..,229 */ in ieee80211_operating_class_to_chandef()
2148 chandef->center_freq1 = control_freq + 70 - (offset & 7) * 20; in ieee80211_operating_class_to_chandef()
2149 chandef->width = NL80211_CHAN_WIDTH_160; in ieee80211_operating_class_to_chandef()
2151 case 130: /* 5 GHz band; 80+80 MHz; channels 36..64,100..144,149..177 */ in ieee80211_operating_class_to_chandef()
2152 case 135: /* 6 GHz band; 80+80 MHz; channels 1,5,..,229 */ in ieee80211_operating_class_to_chandef()
2153 /* The center_freq2 of 80+80 MHz is unknown */ in ieee80211_operating_class_to_chandef()
2154 case 137: /* 6 GHz band; 320 MHz; channels 1,5,..,229 */ in ieee80211_operating_class_to_chandef()
2155 /* 320-1 or 320-2 channelization is unknown */ in ieee80211_operating_class_to_chandef()
2166 u32 freq = chandef->center_freq1; in ieee80211_chandef_to_operating_class()
2169 if (chandef->width > NL80211_CHAN_WIDTH_40) in ieee80211_chandef_to_operating_class()
2173 if (chandef->width == NL80211_CHAN_WIDTH_40) { in ieee80211_chandef_to_operating_class()
2174 if (freq > chandef->chan->center_freq) in ieee80211_chandef_to_operating_class()
2177 *op_class = 84; /* HT40- */ in ieee80211_chandef_to_operating_class()
2187 if (chandef->width != NL80211_CHAN_WIDTH_20_NOHT) in ieee80211_chandef_to_operating_class()
2194 switch (chandef->width) { in ieee80211_chandef_to_operating_class()
2216 } else if (chandef->width == NL80211_CHAN_WIDTH_40) { in ieee80211_chandef_to_operating_class()
2217 if (freq > chandef->chan->center_freq) in ieee80211_chandef_to_operating_class()
2232 } else if (chandef->width == NL80211_CHAN_WIDTH_40) { in ieee80211_chandef_to_operating_class()
2233 if (freq > chandef->chan->center_freq) in ieee80211_chandef_to_operating_class()
2248 } else if (chandef->width == NL80211_CHAN_WIDTH_40) { in ieee80211_chandef_to_operating_class()
2249 if (freq > chandef->chan->center_freq) in ieee80211_chandef_to_operating_class()
2264 } else if (chandef->width == NL80211_CHAN_WIDTH_40) { in ieee80211_chandef_to_operating_class()
2265 if (freq > chandef->chan->center_freq) in ieee80211_chandef_to_operating_class()
2280 if (chandef->width >= NL80211_CHAN_WIDTH_40) in ieee80211_chandef_to_operating_class()
2294 switch (wdev->iftype) { in cfg80211_wdev_bi()
2297 WARN_ON(wdev->valid_links); in cfg80211_wdev_bi()
2298 return wdev->links[0].ap.beacon_interval; in cfg80211_wdev_bi()
2300 return wdev->u.mesh.beacon_interval; in cfg80211_wdev_bi()
2302 return wdev->u.ibss.beacon_interval; in cfg80211_wdev_bi()
2322 list_for_each_entry(wdev, &wiphy->wdev_list, list) { in cfg80211_calculate_bi_data()
2326 if (wdev->valid_links) in cfg80211_calculate_bi_data()
2331 !(rdev_get_radio_mask(rdev, wdev->netdev) & BIT(radio_idx))) in cfg80211_calculate_bi_data()
2362 * This is just a basic pre-condition check; if interface combinations in cfg80211_validate_beacon_int()
2370 return -EINVAL; in cfg80211_validate_beacon_int()
2391 if (params->radio_idx >= 0) in cfg80211_iter_combinations()
2392 radio = &wiphy->radio[params->radio_idx]; in cfg80211_iter_combinations()
2397 * in form of the currently operating interfaces. in cfg80211_iter_combinations()
2401 * cfg80211 already - the only thing not would appear to be any new in cfg80211_iter_combinations()
2404 cfg80211_calculate_bi_data(wiphy, params->new_beacon_int, in cfg80211_iter_combinations()
2406 params->radio_idx); in cfg80211_iter_combinations()
2408 if (params->radar_detect) { in cfg80211_iter_combinations()
2412 region = regdom->dfs_region; in cfg80211_iter_combinations()
2417 num_interfaces += params->iftype_num[iftype]; in cfg80211_iter_combinations()
2418 if (params->iftype_num[iftype] > 0 && in cfg80211_iter_combinations()
2424 cs = radio->iface_combinations; in cfg80211_iter_combinations()
2425 n = radio->n_iface_combinations; in cfg80211_iter_combinations()
2427 cs = wiphy->iface_combinations; in cfg80211_iter_combinations()
2428 n = wiphy->n_iface_combinations; in cfg80211_iter_combinations()
2435 if (num_interfaces > c->max_interfaces) in cfg80211_iter_combinations()
2437 if (params->num_different_channels > c->num_different_channels) in cfg80211_iter_combinations()
2440 limits = kmemdup_array(c->limits, c->n_limits, sizeof(*limits), in cfg80211_iter_combinations()
2443 return -ENOMEM; in cfg80211_iter_combinations()
2448 for (j = 0; j < c->n_limits; j++) { in cfg80211_iter_combinations()
2452 if (limits[j].max < params->iftype_num[iftype]) in cfg80211_iter_combinations()
2454 limits[j].max -= params->iftype_num[iftype]; in cfg80211_iter_combinations()
2458 if (params->radar_detect != in cfg80211_iter_combinations()
2459 (c->radar_detect_widths & params->radar_detect)) in cfg80211_iter_combinations()
2462 if (params->radar_detect && c->radar_detect_regions && in cfg80211_iter_combinations()
2463 !(c->radar_detect_regions & BIT(region))) in cfg80211_iter_combinations()
2467 * using are actually part of this combination. If they in cfg80211_iter_combinations()
2475 if (c->beacon_int_min_gcd && in cfg80211_iter_combinations()
2476 beacon_int_gcd < c->beacon_int_min_gcd) in cfg80211_iter_combinations()
2478 if (!c->beacon_int_min_gcd && beacon_int_different) in cfg80211_iter_combinations()
2513 return -EBUSY; in cfg80211_check_combinations()
2526 return -EINVAL; in ieee80211_get_ratemask()
2529 return -EINVAL; in ieee80211_get_ratemask()
2537 for (j = 0; j < sband->n_bitrates; j++) { in ieee80211_get_ratemask()
2538 if (sband->bitrates[j].bitrate == rate) { in ieee80211_get_ratemask()
2545 return -EINVAL; in ieee80211_get_ratemask()
2550 * didn't accept a 0-length rates array nor allowed in ieee80211_get_ratemask()
2559 enum nl80211_band band; in ieee80211_get_num_supported_channels() local
2562 for (band = 0; band < NUM_NL80211_BANDS; band++) in ieee80211_get_num_supported_channels()
2563 if (wiphy->bands[band]) in ieee80211_get_num_supported_channels()
2564 n_channels += wiphy->bands[band]->n_channels; in ieee80211_get_num_supported_channels()
2577 wdev = dev->ieee80211_ptr; in cfg80211_get_station()
2579 return -EOPNOTSUPP; in cfg80211_get_station()
2581 rdev = wiphy_to_rdev(wdev->wiphy); in cfg80211_get_station()
2582 if (!rdev->ops->get_station) in cfg80211_get_station()
2583 return -EOPNOTSUPP; in cfg80211_get_station()
2587 wiphy_lock(&rdev->wiphy); in cfg80211_get_station()
2589 wiphy_unlock(&rdev->wiphy); in cfg80211_get_station()
2602 kfree(f->serv_spec_info); in cfg80211_free_nan_func()
2603 kfree(f->srf_bf); in cfg80211_free_nan_func()
2604 kfree(f->srf_macs); in cfg80211_free_nan_func()
2605 for (i = 0; i < f->num_rx_filters; i++) in cfg80211_free_nan_func()
2606 kfree(f->rx_filters[i].filter); in cfg80211_free_nan_func()
2608 for (i = 0; i < f->num_tx_filters; i++) in cfg80211_free_nan_func()
2609 kfree(f->tx_filters[i].filter); in cfg80211_free_nan_func()
2611 kfree(f->rx_filters); in cfg80211_free_nan_func()
2612 kfree(f->tx_filters); in cfg80211_free_nan_func()
2622 start_freq_khz = center_freq_khz - (bw_khz / 2); in cfg80211_does_bw_fit_range()
2625 if (start_freq_khz >= freq_range->start_freq_khz && in cfg80211_does_bw_fit_range()
2626 end_freq_khz <= freq_range->end_freq_khz) in cfg80211_does_bw_fit_range()
2634 sinfo->pertid = kcalloc(IEEE80211_NUM_TIDS + 1, in cfg80211_sinfo_alloc_tid_stats()
2635 sizeof(*(sinfo->pertid)), in cfg80211_sinfo_alloc_tid_stats()
2637 if (!sinfo->pertid) in cfg80211_sinfo_alloc_tid_stats()
2638 return -ENOMEM; in cfg80211_sinfo_alloc_tid_stats()
2645 /* Ethernet-II snap header (RFC1042 for most EtherTypes) */
2650 /* Bridge-Tunnel header (for EtherTypes ETH_P_AARP and ETH_P_IPX) */
2680 * Update response frame; IEEE Std 802.2-1998, 5.4.1.2.1 */ in cfg80211_send_layer2_update()
2682 eth_broadcast_addr(msg->da); in cfg80211_send_layer2_update()
2683 ether_addr_copy(msg->sa, addr); in cfg80211_send_layer2_update()
2684 msg->len = htons(6); in cfg80211_send_layer2_update()
2685 msg->dsap = 0; in cfg80211_send_layer2_update()
2686 msg->ssap = 0x01; /* NULL LSAP, CR Bit: Response */ in cfg80211_send_layer2_update()
2687 msg->control = 0xaf; /* XID response lsb.1111F101. in cfg80211_send_layer2_update()
2689 msg->xid_info[0] = 0x81; /* XID format identifier */ in cfg80211_send_layer2_update()
2690 msg->xid_info[1] = 1; /* LLC types/classes: Type 1 LLC */ in cfg80211_send_layer2_update()
2691 msg->xid_info[2] = 0; /* XID sender's receive window size (RW) */ in cfg80211_send_layer2_update()
2693 skb->dev = dev; in cfg80211_send_layer2_update()
2694 skb->protocol = eth_type_trans(skb, dev); in cfg80211_send_layer2_update()
2695 memset(skb->cb, 0, sizeof(skb->cb)); in cfg80211_send_layer2_update()
2705 u16 map = le16_to_cpu(cap->supp_mcs.rx_mcs_map); in ieee80211_get_vht_max_nss()
2724 for (i = 7; i >= 0; i--) { in ieee80211_get_vht_max_nss()
2737 if (!(cap->supp_mcs.tx_mcs_map & in ieee80211_get_vht_max_nss()
2741 ext_nss_bw = le32_get_bits(cap->vht_cap_info, in ieee80211_get_vht_max_nss()
2743 supp_width = le32_get_bits(cap->vht_cap_info, in ieee80211_get_vht_max_nss()
2759 * Cover all the special cases according to IEEE 802.11-2016 in ieee80211_get_vht_max_nss()
2760 * Table 9-250. All other cases are either factor of 1 or not in ieee80211_get_vht_max_nss()
2816 return wiphy->flags & WIPHY_FLAG_4ADDR_AP; in cfg80211_iftype_allowed()
2817 return wiphy->interface_modes & BIT(iftype); in cfg80211_iftype_allowed()
2819 if (!(wiphy->software_iftypes & BIT(iftype)) && is_vlan) in cfg80211_iftype_allowed()
2820 return wiphy->flags & WIPHY_FLAG_4ADDR_AP; in cfg80211_iftype_allowed()
2821 return wiphy->software_iftypes & BIT(iftype); in cfg80211_iftype_allowed()
2832 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); in cfg80211_remove_link()
2834 lockdep_assert_wiphy(wdev->wiphy); in cfg80211_remove_link()
2836 switch (wdev->iftype) { in cfg80211_remove_link()
2839 cfg80211_stop_ap(rdev, wdev->netdev, link_id, true); in cfg80211_remove_link()
2842 /* per-link not relevant */ in cfg80211_remove_link()
2846 wdev->valid_links &= ~BIT(link_id); in cfg80211_remove_link()
2850 eth_zero_addr(wdev->links[link_id].addr); in cfg80211_remove_link()
2861 if (wdev->iftype != NL80211_IFTYPE_AP) in cfg80211_remove_links()
2864 if (wdev->valid_links) { in cfg80211_remove_links()
2883 for (i = 0; i < wiphy->num_iftype_ext_capab; i++) { in cfg80211_get_iftype_ext_capa()
2884 if (wiphy->iftype_ext_capab[i].iftype == type) in cfg80211_get_iftype_ext_capa()
2885 return &wiphy->iftype_ext_capab[i]; in cfg80211_get_iftype_ext_capa()
2899 for (i = 0; i < radio->n_freq_range; i++) { in ieee80211_radio_freq_range_valid()
2900 r = &radio->freq_range[i]; in ieee80211_radio_freq_range_valid()
2901 if (freq - width / 2 >= r->start_freq && in ieee80211_radio_freq_range_valid()
2902 freq + width / 2 <= r->end_freq) in ieee80211_radio_freq_range_valid()
2915 width = nl80211_chan_width_to_mhz(chandef->width); in cfg80211_radio_chandef_valid()
2919 freq = MHZ_TO_KHZ(chandef->center_freq2); in cfg80211_radio_chandef_valid()