2 * Copyright (c) 2020-2021 The FreeBSD Foundation
3 * Copyright (c) 2021-2022 Bjoern A. Zeeb
5 * This software was developed by Björn Zeeb under sponsorship from
6 * the FreeBSD Foundation.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 #ifndef _LINUXKPI_NET_CFG80211_H
33 #define _LINUXKPI_NET_CFG80211_H
35 #include <linux/types.h>
36 #include <linux/nl80211.h>
37 #include <linux/ieee80211.h>
38 #include <linux/if_ether.h>
39 #include <linux/ethtool.h>
40 #include <linux/device.h>
41 #include <linux/netdevice.h>
42 #include <linux/random.h>
43 #include <linux/skbuff.h>
44 #include <net/regulatory.h>
47 extern int linuxkpi_debug_80211;
49 #define D80211_TODO 0x1
51 #ifndef D80211_IMPROVE
52 #define D80211_IMPROVE 0x2
54 #define TODO() if (linuxkpi_debug_80211 & D80211_TODO) \
55 printf("%s:%d: XXX LKPI80211 TODO\n", __func__, __LINE__)
56 #define IMPROVE(...) if (linuxkpi_debug_80211 & D80211_IMPROVE) \
57 printf("%s:%d: XXX LKPI80211 IMPROVE\n", __func__, __LINE__)
59 enum rfkill_hard_block_reasons {
60 RFKILL_HARD_BLOCK_NOT_OWNER = BIT(0),
63 #define WIPHY_PARAM_FRAG_THRESHOLD __LINE__ /* TODO FIXME brcmfmac */
64 #define WIPHY_PARAM_RETRY_LONG __LINE__ /* TODO FIXME brcmfmac */
65 #define WIPHY_PARAM_RETRY_SHORT __LINE__ /* TODO FIXME brcmfmac */
66 #define WIPHY_PARAM_RTS_THRESHOLD __LINE__ /* TODO FIXME brcmfmac */
68 #define CFG80211_SIGNAL_TYPE_MBM __LINE__ /* TODO FIXME brcmfmac */
70 #define UPDATE_ASSOC_IES 1
72 #define IEEE80211_MAX_CHAINS 4 /* net80211: IEEE80211_MAX_CHAINS copied */
74 enum cfg80211_rate_info_flags {
75 RATE_INFO_FLAGS_SHORT_GI = BIT(0),
76 RATE_INFO_FLAGS_MCS = BIT(1),
77 RATE_INFO_FLAGS_VHT_MCS = BIT(2),
78 RATE_INFO_FLAGS_HE_MCS = BIT(3),
81 extern const uint8_t rfc1042_header[6];
83 enum ieee80211_privacy {
84 IEEE80211_PRIVACY_ANY,
87 enum ieee80211_bss_type {
88 IEEE80211_BSS_TYPE_ANY,
91 enum cfg80211_bss_frame_type {
92 CFG80211_BSS_FTYPE_UNKNOWN,
93 CFG80211_BSS_FTYPE_BEACON,
94 CFG80211_BSS_FTYPE_PRESP,
97 enum ieee80211_channel_flags {
98 IEEE80211_CHAN_DISABLED = BIT(0),
99 IEEE80211_CHAN_INDOOR_ONLY = BIT(1),
100 IEEE80211_CHAN_IR_CONCURRENT = BIT(2),
101 IEEE80211_CHAN_RADAR = BIT(3),
102 IEEE80211_CHAN_NO_IR = BIT(4),
103 IEEE80211_CHAN_NO_HT40MINUS = BIT(5),
104 IEEE80211_CHAN_NO_HT40PLUS = BIT(6),
105 IEEE80211_CHAN_NO_80MHZ = BIT(7),
106 IEEE80211_CHAN_NO_160MHZ = BIT(8),
107 IEEE80211_CHAN_NO_OFDM = BIT(9),
109 #define IEEE80211_CHAN_NO_HT40 (IEEE80211_CHAN_NO_HT40MINUS|IEEE80211_CHAN_NO_HT40PLUS)
111 struct ieee80211_txrx_stypes {
116 /* XXX net80211 has an ieee80211_channel as well. */
117 struct linuxkpi_ieee80211_channel {
119 uint32_t hw_value; /* ic_ieee */
120 uint32_t center_freq; /* ic_freq */
121 enum ieee80211_channel_flags flags; /* ic_flags */
122 enum nl80211_band band;
123 int8_t max_power; /* ic_maxpower */
125 int max_antenna_gain, max_reg_power;
127 int dfs_cac_ms, dfs_state;
130 /* XXX net80211 calls these IEEE80211_HTCAP_* */
131 #define IEEE80211_HT_CAP_LDPC_CODING 0x0001 /* IEEE80211_HTCAP_LDPC */
132 #define IEEE80211_HT_CAP_SUP_WIDTH_20_40 0x0002 /* IEEE80211_HTCAP_CHWIDTH40 */
133 #define IEEE80211_HT_CAP_GRN_FLD 0x0010 /* IEEE80211_HTCAP_GREENFIELD */
134 #define IEEE80211_HT_CAP_SGI_20 0x0020 /* IEEE80211_HTCAP_SHORTGI20 */
135 #define IEEE80211_HT_CAP_SGI_40 0x0040 /* IEEE80211_HTCAP_SHORTGI40 */
136 #define IEEE80211_HT_CAP_TX_STBC 0x0080 /* IEEE80211_HTCAP_TXSTBC */
137 #define IEEE80211_HT_CAP_RX_STBC 0x0100 /* IEEE80211_HTCAP_RXSTBC */
138 #define IEEE80211_HT_CAP_RX_STBC_SHIFT 8 /* IEEE80211_HTCAP_RXSTBC_S */
139 #define IEEE80211_HT_CAP_MAX_AMSDU 0x0800 /* IEEE80211_HTCAP_MAXAMSDU */
140 #define IEEE80211_HT_CAP_DSSSCCK40 0x1000 /* IEEE80211_HTCAP_DSSSCCK40 */
141 #define IEEE80211_HT_CAP_SM_PS 0x000c /* IEEE80211_HTCAP_SMPS */
142 #define IEEE80211_HT_CAP_SM_PS_SHIFT 2
143 #define IEEE80211_HT_CAP_LSIG_TXOP_PROT 0x8000 /* IEEE80211_HTCAP_LSIGTXOPPROT */
145 #define IEEE80211_HT_MCS_TX_DEFINED 0x0001
146 #define IEEE80211_HT_MCS_TX_RX_DIFF 0x0002
147 #define IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT 2
148 #define IEEE80211_HT_MCS_RX_HIGHEST_MASK 0x3FF
149 #define IEEE80211_HT_MCS_MASK_LEN 10
151 enum ieee80211_vht_mcs_support {
152 LKPI_IEEE80211_VHT_MCS_SUPPORT_0_7,
153 LKPI_IEEE80211_VHT_MCS_SUPPORT_0_8,
154 LKPI_IEEE80211_VHT_MCS_SUPPORT_0_9,
157 struct cfg80211_bitrate_mask {
159 /* This is so weird but nothing else works out...*/
161 uint64_t legacy; /* XXX? */
162 uint8_t ht_mcs[IEEE80211_HT_MCS_MASK_LEN];
163 uint16_t vht_mcs[16]; /* XXX? */
164 uint16_t he_mcs[16]; /* XXX? */
165 enum nl80211_txrate_gi gi;
166 } control[NUM_NL80211_BANDS];
171 int bw, flags, he_dcm, he_gi, he_ru_alloc, legacy, mcs, nss;
174 struct ieee80211_rate {
178 uint32_t hw_value_short;
182 struct ieee80211_sta_ht_cap {
184 int ampdu_density, ampdu_factor;
188 uint16_t rx_mask[IEEE80211_HT_MCS_MASK_LEN]; /* XXX ? > 4 (rtw88) */
194 /* XXX net80211 calls these IEEE80211_VHTCAP_* */
195 #define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_3895 0x00000000 /* IEEE80211_VHTCAP_MAX_MPDU_LENGTH_3895 */
196 #define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_7991 0x00000001 /* IEEE80211_VHTCAP_MAX_MPDU_LENGTH_7991 */
197 #define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 0x00000002 /* IEEE80211_VHTCAP_MAX_MPDU_LENGTH_11454 */
198 #define IEEE80211_VHT_CAP_MAX_MPDU_MASK 0x00000003 /* IEEE80211_VHTCAP_MAX_MPDU_MASK */
200 #define IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ (IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_160MHZ << IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_MASK_S)
201 #define IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ (IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_160_80P80MHZ << IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_MASK_S)
202 #define IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK 0x0000000c /* IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_MASK */
204 #define IEEE80211_VHT_CAP_RXLDPC 0x00000010 /* IEEE80211_VHTCAP_RXLDPC */
206 #define IEEE80211_VHT_CAP_SHORT_GI_80 0x00000020 /* IEEE80211_VHTCAP_SHORT_GI_80 */
207 #define IEEE80211_VHT_CAP_SHORT_GI_160 0x00000040 /* IEEE80211_VHTCAP_SHORT_GI_160 */
209 #define IEEE80211_VHT_CAP_TXSTBC 0x00000080 /* IEEE80211_VHTCAP_TXSTBC */
211 #define IEEE80211_VHT_CAP_RXSTBC_1 0x00000100 /* IEEE80211_VHTCAP_RXSTBC_1 */
212 #define IEEE80211_VHT_CAP_RXSTBC_MASK 0x00000700 /* IEEE80211_VHTCAP_RXSTBC_MASK */
214 #define IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE 0x00000800 /* IEEE80211_VHTCAP_SU_BEAMFORMER_CAPABLE */
216 #define IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE 0x00001000 /* IEEE80211_VHTCAP_SU_BEAMFORMEE_CAPABLE */
218 #define IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE 0x00080000 /* IEEE80211_VHTCAP_MU_BEAMFORMER_CAPABLE */
220 #define IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE 0x00100000 /* IEEE80211_VHTCAP_MU_BEAMFORMEE_CAPABLE */
222 #define IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT 13 /* IEEE80211_VHTCAP_BEAMFORMEE_STS_SHIFT */
223 #define IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK (7 << IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT) /* IEEE80211_VHTCAP_BEAMFORMEE_STS_MASK */
225 #define IEEE80211_VHT_CAP_HTC_VHT 0x00400000 /* IEEE80211_VHTCAP_HTC_VHT */
227 #define IEEE80211_VHT_CAP_RX_ANTENNA_PATTERN 0x10000000 /* IEEE80211_VHTCAP_RX_ANTENNA_PATTERN */
228 #define IEEE80211_VHT_CAP_TX_ANTENNA_PATTERN 0x20000000 /* IEEE80211_VHTCAP_TX_ANTENNA_PATTERN */
230 #define IEEE80211_VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB 0x0c000000 /* IEEE80211_VHTCAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB */
232 #define IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_SHIFT 16 /* IEEE80211_VHTCAP_SOUNDING_DIMENSIONS_SHIFT */
233 #define IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MASK \
234 (7 << IEEE80211_VHTCAP_SOUNDING_DIMENSIONS_SHIFT) /* IEEE80211_VHTCAP_SOUNDING_DIMENSIONS_MASK */
236 #define IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT 23 /* IEEE80211_VHTCAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT */
237 #define IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK \
238 (7 << IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT) /* IEEE80211_VHTCAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK */
241 struct ieee80211_sta_vht_cap {
245 struct vht_mcs vht_mcs;
248 struct cfg80211_connect_resp_params {
251 const uint8_t *req_ie;
252 const uint8_t *resp_ie;
254 uint32_t resp_ie_len;
258 struct cfg80211_inform_bss {
260 int boottime_ns, scan_width, signal;
261 struct linuxkpi_ieee80211_channel *chan;
264 struct cfg80211_roam_info {
267 const uint8_t *req_ie;
268 const uint8_t *resp_ie;
270 uint32_t resp_ie_len;
271 struct linuxkpi_ieee80211_channel *channel;
274 struct cfg80211_bss_ies {
275 /* XXX TODO, type is best guess. Fix if more info. */
280 struct cfg80211_bss {
282 struct cfg80211_bss_ies *ies;
285 struct cfg80211_chan_def {
287 struct linuxkpi_ieee80211_channel *chan;
288 enum nl80211_chan_width width;
289 uint32_t center_freq1;
290 uint32_t center_freq2;
293 struct cfg80211_ftm_responder_stats {
295 int asap_num, failed_num, filled, non_asap_num, out_of_window_triggers_num, partial_num, reschedule_requests_num, success_num, total_duration_ms, unknown_triggers_num;
298 struct cfg80211_pmsr_capabilities {
300 int max_peers, randomize_mac_addr, report_ap_tsf;
302 int asap, bandwidths, max_bursts_exponent, max_ftms_per_burst, non_asap, non_trigger_based, preambles, request_civicloc, request_lci, supported, trigger_based;
306 struct cfg80211_pmsr_ftm_request {
308 int asap, burst_period, ftmr_retries, ftms_per_burst, non_trigger_based, num_bursts_exp, request_civicloc, request_lci, trigger_based;
313 struct cfg80211_pmsr_request_peer {
315 struct cfg80211_chan_def chandef;
316 struct cfg80211_pmsr_ftm_request ftm;
317 uint8_t addr[ETH_ALEN];
321 struct cfg80211_pmsr_request {
323 int cookie, n_peers, timeout;
324 uint8_t mac_addr[ETH_ALEN], mac_addr_mask[ETH_ALEN];
325 struct cfg80211_pmsr_request_peer peers[];
328 struct cfg80211_pmsr_ftm_result {
330 int burst_index, busy_retry_time, failure_reason;
331 int num_ftmr_successes, rssi_avg, rssi_avg_valid, rssi_spread, rssi_spread_valid, rtt_avg, rtt_avg_valid, rtt_spread, rtt_spread_valid, rtt_variance, rtt_variance_valid;
338 struct cfg80211_pmsr_result {
340 int ap_tsf, ap_tsf_valid, final, host_time, status, type;
341 uint8_t addr[ETH_ALEN];
342 struct cfg80211_pmsr_ftm_result ftm;
345 struct cfg80211_sar_freq_ranges {
350 struct cfg80211_sar_sub_specs {
351 uint32_t freq_range_index;
355 struct cfg80211_sar_specs {
356 enum nl80211_sar_type type;
357 uint32_t num_sub_specs;
358 struct cfg80211_sar_sub_specs sub_specs[];
361 struct cfg80211_sar_capa {
362 enum nl80211_sar_type type;
363 uint32_t num_freq_ranges;
364 const struct cfg80211_sar_freq_ranges *freq_ranges;
367 struct cfg80211_ssid {
369 uint8_t ssid[IEEE80211_MAX_SSID_LEN];
372 struct cfg80211_scan_6ghz_params {
375 int channel_idx, psc_no_listen, short_ssid, short_ssid_valid, unsolicited_probe;
378 struct cfg80211_match_set {
379 uint8_t bssid[ETH_ALEN];
380 struct cfg80211_ssid ssid;
384 struct cfg80211_scan_request {
386 int duration, duration_mandatory, flags;
389 struct wireless_dev *wdev;
393 uint8_t mac_addr[ETH_ALEN], mac_addr_mask[ETH_ALEN];
397 struct cfg80211_ssid *ssids;
398 struct cfg80211_scan_6ghz_params *scan_6ghz_params;
399 struct linuxkpi_ieee80211_channel *channels[0];
402 struct cfg80211_sched_scan_plan {
404 int interval, iterations;
407 struct cfg80211_sched_scan_request {
410 uint8_t mac_addr[ETH_ALEN], mac_addr_mask[ETH_ALEN];
416 struct cfg80211_match_set *match_sets;
417 struct cfg80211_sched_scan_plan *scan_plans;
418 struct cfg80211_ssid *ssids;
419 struct linuxkpi_ieee80211_channel *channels[0];
422 struct cfg80211_scan_info {
423 uint64_t scan_start_tsf;
424 uint8_t tsf_bssid[ETH_ALEN];
428 struct cfg80211_beacon_data {
434 const uint8_t *proberesp_ies;
435 const uint8_t *assocresp_ies;
436 uint32_t proberesp_ies_len;
437 uint32_t assocresp_ies_len;
440 struct cfg80211_ap_settings {
442 int auth_type, beacon_interval, dtim_period, hidden_ssid, inactivity_timeout;
445 struct cfg80211_beacon_data beacon;
446 struct cfg80211_chan_def chandef;
449 struct cfg80211_bss_selection {
451 enum nl80211_bss_select_attr behaviour;
453 enum nl80211_band band_pref;
455 enum nl80211_band band;
461 struct cfg80211_crypto { /* XXX made up name */
463 enum nl80211_wpa_versions wpa_versions;
464 uint32_t cipher_group; /* WLAN_CIPHER_SUITE_* */
465 uint32_t *akm_suites;
466 uint32_t *ciphers_pairwise;
467 const uint8_t *sae_pwd;
470 int n_ciphers_pairwise;
474 struct cfg80211_connect_params {
476 struct linuxkpi_ieee80211_channel *channel;
484 int auth_type, key_idx, privacy, want_1x;
485 struct cfg80211_bss_selection bss_select;
486 struct cfg80211_crypto crypto;
489 enum bss_param_flags { /* Used as bitflags. XXX FIXME values? */
490 BSS_PARAM_FLAGS_CTS_PROT = 0x01,
491 BSS_PARAM_FLAGS_SHORT_PREAMBLE = 0x02,
492 BSS_PARAM_FLAGS_SHORT_SLOT_TIME = 0x04,
495 struct cfg80211_ibss_params {
497 int basic_rates, beacon_interval;
498 int channel_fixed, ie, ie_len, privacy;
503 struct cfg80211_chan_def chandef;
504 enum bss_param_flags flags;
507 struct cfg80211_mgmt_tx_params {
509 struct linuxkpi_ieee80211_channel *chan;
515 struct cfg80211_pmk_conf {
521 struct cfg80211_pmksa {
523 const uint8_t *bssid;
524 const uint8_t *pmkid;
527 struct cfg80211_wowlan_nd_match {
529 struct cfg80211_ssid ssid;
531 uint32_t channels[0]; /* freq! = ieee80211_channel_to_frequency() */
534 struct cfg80211_wowlan_nd_info {
537 struct cfg80211_wowlan_nd_match *matches[0];
540 enum wiphy_wowlan_support_flags {
541 WIPHY_WOWLAN_DISCONNECT,
542 WIPHY_WOWLAN_GTK_REKEY_FAILURE,
543 WIPHY_WOWLAN_MAGIC_PKT,
544 WIPHY_WOWLAN_SUPPORTS_GTK_REKEY,
545 WIPHY_WOWLAN_NET_DETECT,
548 struct wiphy_wowlan_support {
550 enum wiphy_wowlan_support_flags flags;
551 int max_nd_match_sets, max_pkt_offset, n_patterns, pattern_max_len, pattern_min_len;
554 struct station_del_parameters {
557 uint32_t reason_code; /* elsewhere uint16_t? */
560 struct station_info {
562 int assoc_req_ies_len, connected_time;
563 int generation, inactive_time, rx_bytes, rx_dropped_misc, rx_packets, signal, tx_bytes, tx_packets;
564 int filled, rx_beacon, rx_beacon_signal_avg, signal_avg;
565 int rx_duration, tx_failed, tx_retries;
568 uint8_t chain_signal[IEEE80211_MAX_CHAINS];
569 uint8_t chain_signal_avg[IEEE80211_MAX_CHAINS];
571 uint8_t *assoc_req_ies;
572 struct rate_info rxrate;
573 struct rate_info txrate;
574 struct cfg80211_ibss_params bss_param;
575 struct nl80211_sta_flag_update sta_flags;
578 struct station_parameters {
580 int sta_flags_mask, sta_flags_set;
589 uint32_t cipher; /* WLAN_CIPHER_SUITE_* */
592 struct mgmt_frame_regs {
594 int interface_stypes;
599 uint8_t macaddr[ETH_ALEN];
602 /* That the world needs so many different structs for this is amazing. */
604 uint8_t addr[ETH_ALEN];
607 struct ieee80211_reg_rule {
613 int max_bandwidth_khz;
616 int max_antenna_gain;
621 struct linuxkpi_ieee80211_regdomain {
626 struct ieee80211_reg_rule reg_rules[];
629 /* XXX-BZ this are insensible values probably ... */
630 #define IEEE80211_HE_MAC_CAP0_HTC_HE 0x1
631 #define IEEE80211_HE_MAC_CAP0_TWT_REQ 0x2
633 #define IEEE80211_HE_MAC_CAP1_LINK_ADAPTATION 0x1
634 #define IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_RX_QOS_8 0x2
635 #define IEEE80211_HE_MAC_CAP1_TF_MAC_PAD_DUR_16US 0x4
637 #define IEEE80211_HE_MAC_CAP2_32BIT_BA_BITMAP 0x1
638 #define IEEE80211_HE_MAC_CAP2_ACK_EN 0x2
639 #define IEEE80211_HE_MAC_CAP2_BSR 0x4
640 #define IEEE80211_HE_MAC_CAP2_LINK_ADAPTATION 0x8
641 #define IEEE80211_HE_MAC_CAP2_BCAST_TWT 0x10
642 #define IEEE80211_HE_MAC_CAP2_ALL_ACK 0x20
644 #define IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_VHT_2 0x1
645 #define IEEE80211_HE_MAC_CAP3_OMI_CONTROL 0x2
646 #define IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_EXT_1 0x10
647 #define IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_EXT_2 0x20
648 #define IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_EXT_3 0x40
649 #define IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_MASK 0x70
650 #define IEEE80211_HE_MAC_CAP3_RX_CTRL_FRAME_TO_MULTIBSS 0x80
652 #define IEEE80211_HE_MAC_CAP4_AMDSU_IN_AMPDU 0x1
653 #define IEEE80211_HE_MAC_CAP4_BQR 0x2
654 #define IEEE80211_HE_MAC_CAP4_MULTI_TID_AGG_TX_QOS_B39 0x4
655 #define IEEE80211_HE_MAC_CAP4_AMSDU_IN_AMPDU 0x8
656 #define IEEE80211_HE_MAC_CAP4_OPS 0x10
658 #define IEEE80211_HE_MAC_CAP5_HE_DYNAMIC_SM_PS 0x1
659 #define IEEE80211_HE_MAC_CAP5_HT_VHT_TRIG_FRAME_RX 0x2
660 #define IEEE80211_HE_MAC_CAP5_MULTI_TID_AGG_TX_QOS_B40 0x4
661 #define IEEE80211_HE_MAC_CAP5_MULTI_TID_AGG_TX_QOS_B41 0x8
662 #define IEEE80211_HE_MAC_CAP5_UL_2x996_TONE_RU 0x10
664 #define IEEE80211_HE_MCS_NOT_SUPPORTED 0x0
665 #define IEEE80211_HE_MCS_SUPPORT_0_7 0x1
666 #define IEEE80211_HE_MCS_SUPPORT_0_9 0x2
667 #define IEEE80211_HE_MCS_SUPPORT_0_11 0x4
669 #define IEEE80211_HE_6GHZ_CAP_TX_ANTPAT_CONS 0x01
670 #define IEEE80211_HE_6GHZ_CAP_RX_ANTPAT_CONS 0x02
671 #define IEEE80211_HE_6GHZ_CAP_MIN_MPDU_START 0x04
672 #define IEEE80211_HE_6GHZ_CAP_MAX_MPDU_LEN 0x08
673 #define IEEE80211_HE_6GHZ_CAP_MAX_AMPDU_LEN_EXP 0x10
675 #define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G 0x1
676 #define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G 0x2
677 #define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_IN_2G 0x4
678 #define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G 0x8
680 #define IEEE80211_HE_PHY_CAP1_DEVICE_CLASS_A 0x1
681 #define IEEE80211_HE_PHY_CAP1_LDPC_CODING_IN_PAYLOAD 0x2
682 #define IEEE80211_HE_PHY_CAP1_MIDAMBLE_RX_TX_MAX_NSTS 0x4
683 #define IEEE80211_HE_PHY_CAP1_PREAMBLE_PUNC_RX_MASK 0x8
684 #define IEEE80211_HE_PHY_CAP1_HE_LTF_AND_GI_FOR_HE_PPDUS_0_8US 0x10
686 #define IEEE80211_HE_PHY_CAP2_MIDAMBLE_RX_TX_MAX_NSTS 0x1
687 #define IEEE80211_HE_PHY_CAP2_NDP_4x_LTF_AND_3_2US 0x2
688 #define IEEE80211_HE_PHY_CAP2_STBC_TX_UNDER_80MHZ 0x4
689 #define IEEE80211_HE_PHY_CAP2_STBC_RX_UNDER_80MHZ 0x8
690 #define IEEE80211_HE_PHY_CAP2_DOPPLER_TX 0x10
692 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_MASK 0x1
693 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_NO_DCM 0x2
694 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_NO_DCM 0x4
695 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_RX_NSS_1 0x8
696 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_TX_NSS_1 0x10
697 #define IEEE80211_HE_PHY_CAP3_SU_BEAMFORMER 0x20
698 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_16_QAM 0x40
699 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_16_QAM 0x80
700 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_TX_NSS_2 0x10
701 #define IEEE80211_HE_PHY_CAP3_RX_PARTIAL_BW_SU_IN_20MHZ_MU 0x20
702 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_BPSK 0x40
703 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_BPSK 0x80
704 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_MASK 0x80
706 #define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_UNDER_80MHZ_8 0x1
707 #define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_ABOVE_80MHZ_8 0x2
708 #define IEEE80211_HE_PHY_CAP4_SU_BEAMFORMEE 0x4
709 #define IEEE80211_HE_PHY_CAP4_MU_BEAMFORMER 0x8
710 #define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_UNDER_80MHZ_4 0x10
712 #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_ABOVE_80MHZ_2 0x1
713 #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_2 0x2
714 #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_MASK 0x4
715 #define IEEE80211_HE_PHY_CAP5_NG16_MU_FEEDBACK 0x8
716 #define IEEE80211_HE_PHY_CAP5_NG16_SU_FEEDBACK 0x10
718 #define IEEE80211_HE_PHY_CAP6_PPE_THRESHOLD_PRESENT 0x1
719 #define IEEE80211_HE_PHY_CAP6_TRIG_MU_BEAMFORMER_FB 0x2
720 #define IEEE80211_HE_PHY_CAP6_TRIG_SU_BEAMFORMER_FB 0x4
721 #define IEEE80211_HE_PHY_CAP6_TRIG_SU_BEAMFORMING_FB 0x8
722 #define IEEE80211_HE_PHY_CAP6_TRIG_MU_BEAMFORMING_PARTIAL_BW_FB 0x20
723 #define IEEE80211_HE_PHY_CAP6_CODEBOOK_SIZE_42_SU 0x40
724 #define IEEE80211_HE_PHY_CAP6_CODEBOOK_SIZE_75_MU 0x80
725 #define IEEE80211_HE_PHY_CAP6_PARTIAL_BW_EXT_RANGE 0x80
727 #define IEEE80211_HE_PHY_CAP7_HE_SU_MU_PPDU_4XLTF_AND_08_US_GI 0x1
728 #define IEEE80211_HE_PHY_CAP7_MAX_NC_1 0x2
729 #define IEEE80211_HE_PHY_CAP7_MAX_NC_2 0x4
730 #define IEEE80211_HE_PHY_CAP7_MAX_NC_MASK 0x6
731 #define IEEE80211_HE_PHY_CAP7_POWER_BOOST_FACTOR_AR 0x8
732 #define IEEE80211_HE_PHY_CAP7_POWER_BOOST_FACTOR_SUPP 0x10
733 #define IEEE80211_HE_PHY_CAP7_STBC_RX_ABOVE_80MHZ 0x20
735 #define IEEE80211_HE_PHY_CAP8_20MHZ_IN_160MHZ_HE_PPDU 0x1
736 #define IEEE80211_HE_PHY_CAP8_20MHZ_IN_40MHZ_HE_PPDU_IN_2G 0x2
737 #define IEEE80211_HE_PHY_CAP8_80MHZ_IN_160MHZ_HE_PPDU 0x4
738 #define IEEE80211_HE_PHY_CAP8_DCM_MAX_RU_2x996 0x8
739 #define IEEE80211_HE_PHY_CAP8_DCM_MAX_RU_242 0x10
740 #define IEEE80211_HE_PHY_CAP8_HE_ER_SU_PPDU_4XLTF_AND_08_US_GI 0x20
741 #define IEEE80211_HE_PHY_CAP8_DCM_MAX_RU_996 0x40
742 #define IEEE80211_HE_PHY_CAP8_HE_ER_SU_1XLTF_AND_08_US_GI 0x80
744 #define IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_0US 0x1
745 #define IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_16US 0x2
746 #define IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_8US 0x4
747 #define IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_MASK 0x8
748 #define IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_RESERVED 0x10
749 #define IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_POS 0x0
750 #define IEEE80211_HE_PHY_CAP9_NON_TRIGGERED_CQI_FEEDBACK 0x20
751 #define IEEE80211_HE_PHY_CAP9_RX_FULL_BW_SU_USING_MU_WITH_COMP_SIGB 0x4
752 #define IEEE80211_HE_PHY_CAP9_RX_FULL_BW_SU_USING_MU_WITH_NON_COMP_SIGB 0x8
753 #define IEEE80211_HE_PHY_CAP9_RX_1024_QAM_LESS_THAN_242_TONE_RU 0x10
754 #define IEEE80211_HE_PHY_CAP9_TX_1024_QAM_LESS_THAN_242_TONE_RU 0x20
755 #define IEEE80211_HE_PHY_CAP9_LONGER_THAN_16_SIGB_OFDM_SYM 0x40
757 #define IEEE80211_HE_PHY_CAP10_HE_MU_M1RU_MAX_LTF 0x1
759 #define VENDOR_CMD_RAW_DATA (void *)(uintptr_t)(-ENOENT)
761 struct ieee80211_he_cap_elem {
766 struct ieee80211_he_mcs_nss_supp {
772 uint32_t rx_mcs_80p80;
773 uint32_t tx_mcs_80p80;
776 #define IEEE80211_STA_HE_CAP_PPE_THRES_MAX 32
777 struct ieee80211_sta_he_cap {
780 struct ieee80211_he_cap_elem he_cap_elem;
781 struct ieee80211_he_mcs_nss_supp he_mcs_nss_supp;
782 uint8_t ppe_thres[IEEE80211_STA_HE_CAP_PPE_THRES_MAX];
785 struct ieee80211_sta_he_6ghz_capa {
790 struct ieee80211_sband_iftype_data {
792 enum nl80211_iftype types_mask;
793 struct ieee80211_sta_he_cap he_cap;
794 struct ieee80211_sta_he_6ghz_capa he_6ghz_capa;
801 struct ieee80211_supported_band {
803 struct linuxkpi_ieee80211_channel *channels;
804 struct ieee80211_rate *bitrates;
805 struct ieee80211_sband_iftype_data *iftype_data;
809 enum nl80211_band band;
810 struct ieee80211_sta_ht_cap ht_cap;
811 struct ieee80211_sta_vht_cap vht_cap;
814 struct cfg80211_pkt_pattern {
822 struct cfg80211_wowlan {
824 int disconnect, gtk_rekey_failure, magic_pkt;
826 struct cfg80211_sched_scan_request *nd_config;
827 struct cfg80211_pkt_pattern *patterns;
830 struct cfg80211_gtk_rekey_data {
832 int kck, kek, replay_ctr;
835 struct cfg80211_tid_cfg {
837 int mask, noack, retry_long, rtscts, tids;
838 enum nl80211_tx_rate_setting txrate_type;
839 struct cfg80211_bitrate_mask txrate_mask;
842 struct cfg80211_tid_config {
845 struct cfg80211_tid_cfg tid_conf[0];
848 struct ieee80211_iface_limit {
853 struct ieee80211_iface_combination {
855 const struct ieee80211_iface_limit *limits;
857 int max_interfaces, num_different_channels;
858 int beacon_int_infra_match, beacon_int_min_gcd;
861 struct iface_combination_params {
862 int num_different_channels;
863 int iftype_num[NUM_NL80211_IFTYPES];
866 struct regulatory_request {
869 int initiator, dfs_region;
872 enum wiphy_vendor_cmd_need_flags {
873 WIPHY_VENDOR_CMD_NEED_NETDEV = 0x01,
874 WIPHY_VENDOR_CMD_NEED_RUNNING = 0x02,
875 WIPHY_VENDOR_CMD_NEED_WDEV = 0x04,
878 struct wiphy_vendor_command {
885 int (*doit)(struct wiphy *, struct wireless_dev *, const void *, int);
888 struct wiphy_iftype_ext_capab {
890 enum nl80211_iftype iftype;
891 const uint8_t *extended_capabilities;
892 const uint8_t *extended_capabilities_mask;
893 uint8_t extended_capabilities_len;
897 struct tid_config_support {
899 uint64_t vif; /* enum nl80211_tid_cfg_attr */
900 uint64_t peer; /* enum nl80211_tid_cfg_attr */
903 enum cfg80211_regulatory {
904 REGULATORY_CUSTOM_REG = BIT(0),
905 REGULATORY_STRICT_REG = BIT(1),
906 REGULATORY_DISABLE_BEACON_HINTS = BIT(2),
907 REGULATORY_ENABLE_RELAX_NO_IR = BIT(3),
908 REGULATORY_WIPHY_SELF_MANAGED = BIT(4),
909 REGULATORY_COUNTRY_IE_IGNORE = BIT(5),
910 REGULATORY_COUNTRY_IE_FOLLOW_POWER = BIT(6),
913 #define WIPHY_FLAG_AP_UAPSD 0x00000001
914 #define WIPHY_FLAG_HAS_CHANNEL_SWITCH 0x00000002
915 #define WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL 0x00000004
916 #define WIPHY_FLAG_HAVE_AP_SME 0x00000008
917 #define WIPHY_FLAG_IBSS_RSN 0x00000010
918 #define WIPHY_FLAG_NETNS_OK 0x00000020
919 #define WIPHY_FLAG_OFFCHAN_TX 0x00000040
920 #define WIPHY_FLAG_PS_ON_BY_DEFAULT 0x00000080
921 #define WIPHY_FLAG_SPLIT_SCAN_6GHZ 0x00000100
922 #define WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK 0x00000200
923 #define WIPHY_FLAG_SUPPORTS_FW_ROAM 0x00000400
924 #define WIPHY_FLAG_SUPPORTS_TDLS 0x00000800
925 #define WIPHY_FLAG_TDLS_EXTERNAL_SETUP 0x00001000
926 #define WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD 0x00002000
931 struct mac_address *addresses;
934 struct ieee80211_supported_band *bands[NUM_NL80211_BANDS];
935 uint8_t perm_addr[ETH_ALEN];
938 const struct cfg80211_pmsr_capabilities *pmsr_capa;
939 const struct cfg80211_sar_capa *sar_capa;
940 const struct wiphy_iftype_ext_capab *iftype_ext_capab;
941 const struct linuxkpi_ieee80211_regdomain *regd;
942 char fw_version[ETHTOOL_FWVERS_LEN];
943 const struct ieee80211_iface_combination *iface_combinations;
944 const uint32_t *cipher_suites;
945 int n_iface_combinations;
947 void(*reg_notifier)(struct wiphy *, struct regulatory_request *);
948 enum cfg80211_regulatory regulatory_flags;
949 int n_vendor_commands;
950 const struct wiphy_vendor_command *vendor_commands;
951 const struct ieee80211_txrx_stypes *mgmt_stypes;
952 uint32_t rts_threshold;
953 uint32_t frag_threshold;
954 struct tid_config_support tid_config_support;
956 int available_antennas_rx, available_antennas_tx;
957 int features, hw_version;
958 int interface_modes, max_match_sets, max_remain_on_channel_duration, max_scan_ie_len, max_scan_ssids, max_sched_scan_ie_len, max_sched_scan_plan_interval, max_sched_scan_plan_iterations, max_sched_scan_plans, max_sched_scan_reqs, max_sched_scan_ssids;
959 int num_iftype_ext_capab;
960 int max_ap_assoc_sta, probe_resp_offload, software_iftypes;
961 int bss_select_support, max_num_pmkids, retry_long, retry_short, signal_type;
962 int max_data_retry_count;
963 int tx_queue_len, rfkill;
965 unsigned long ext_features[BITS_TO_LONGS(NUM_NL80211_EXT_FEATURES)];
966 struct dentry *debugfsdir;
967 struct cfg80211_wowlan_support *wowlan;
968 /* Lower layer (driver/mac80211) specific data. */
969 /* Must stay last. */
970 uint8_t priv[0] __aligned(CACHE_LINE_SIZE);
973 struct wireless_dev {
974 /* XXX TODO, like ic? */
977 struct net_device *netdev;
981 struct cfg80211_ops {
983 struct wireless_dev *(*add_virtual_intf)(struct wiphy *, const char *, unsigned char, enum nl80211_iftype, struct vif_params *);
984 int (*del_virtual_intf)(struct wiphy *, struct wireless_dev *);
985 s32 (*change_virtual_intf)(struct wiphy *, struct net_device *, enum nl80211_iftype, struct vif_params *);
986 s32 (*scan)(struct wiphy *, struct cfg80211_scan_request *);
987 s32 (*set_wiphy_params)(struct wiphy *, u32);
988 s32 (*join_ibss)(struct wiphy *, struct net_device *, struct cfg80211_ibss_params *);
989 s32 (*leave_ibss)(struct wiphy *, struct net_device *);
990 s32 (*get_station)(struct wiphy *, struct net_device *, const u8 *, struct station_info *);
991 int (*dump_station)(struct wiphy *, struct net_device *, int, u8 *, struct station_info *);
992 s32 (*set_tx_power)(struct wiphy *, struct wireless_dev *, enum nl80211_tx_power_setting, s32);
993 s32 (*get_tx_power)(struct wiphy *, struct wireless_dev *, s32 *);
994 s32 (*add_key)(struct wiphy *, struct net_device *, u8, bool, const u8 *, struct key_params *);
995 s32 (*del_key)(struct wiphy *, struct net_device *, u8, bool, const u8 *);
996 s32 (*get_key)(struct wiphy *, struct net_device *, u8, bool, const u8 *, void *, void(*)(void *, struct key_params *));
997 s32 (*set_default_key)(struct wiphy *, struct net_device *, u8, bool, bool);
998 s32 (*set_default_mgmt_key)(struct wiphy *, struct net_device *, u8);
999 s32 (*set_power_mgmt)(struct wiphy *, struct net_device *, bool, s32);
1000 s32 (*connect)(struct wiphy *, struct net_device *, struct cfg80211_connect_params *);
1001 s32 (*disconnect)(struct wiphy *, struct net_device *, u16);
1002 s32 (*suspend)(struct wiphy *, struct cfg80211_wowlan *);
1003 s32 (*resume)(struct wiphy *);
1004 s32 (*set_pmksa)(struct wiphy *, struct net_device *, struct cfg80211_pmksa *);
1005 s32 (*del_pmksa)(struct wiphy *, struct net_device *, struct cfg80211_pmksa *);
1006 s32 (*flush_pmksa)(struct wiphy *, struct net_device *);
1007 s32 (*start_ap)(struct wiphy *, struct net_device *, struct cfg80211_ap_settings *);
1008 int (*stop_ap)(struct wiphy *, struct net_device *);
1009 s32 (*change_beacon)(struct wiphy *, struct net_device *, struct cfg80211_beacon_data *);
1010 int (*del_station)(struct wiphy *, struct net_device *, struct station_del_parameters *);
1011 int (*change_station)(struct wiphy *, struct net_device *, const u8 *, struct station_parameters *);
1012 int (*sched_scan_start)(struct wiphy *, struct net_device *, struct cfg80211_sched_scan_request *);
1013 int (*sched_scan_stop)(struct wiphy *, struct net_device *, u64);
1014 void (*update_mgmt_frame_registrations)(struct wiphy *, struct wireless_dev *, struct mgmt_frame_regs *);
1015 int (*mgmt_tx)(struct wiphy *, struct wireless_dev *, struct cfg80211_mgmt_tx_params *, u64 *);
1016 int (*cancel_remain_on_channel)(struct wiphy *, struct wireless_dev *, u64);
1017 int (*get_channel)(struct wiphy *, struct wireless_dev *, struct cfg80211_chan_def *);
1018 int (*crit_proto_start)(struct wiphy *, struct wireless_dev *, enum nl80211_crit_proto_id, u16);
1019 void (*crit_proto_stop)(struct wiphy *, struct wireless_dev *);
1020 int (*tdls_oper)(struct wiphy *, struct net_device *, const u8 *, enum nl80211_tdls_operation);
1021 int (*update_connect_params)(struct wiphy *, struct net_device *, struct cfg80211_connect_params *, u32);
1022 int (*set_pmk)(struct wiphy *, struct net_device *, const struct cfg80211_pmk_conf *);
1023 int (*del_pmk)(struct wiphy *, struct net_device *, const u8 *);
1024 int (*remain_on_channel)(struct wiphy *, struct wireless_dev *, struct linuxkpi_ieee80211_channel *, unsigned int, u64 *);
1025 int (*start_p2p_device)(struct wiphy *, struct wireless_dev *);
1026 void (*stop_p2p_device)(struct wiphy *, struct wireless_dev *);
1030 /* -------------------------------------------------------------------------- */
1034 struct wiphy *linuxkpi_wiphy_new(const struct cfg80211_ops *, size_t);
1035 void linuxkpi_wiphy_free(struct wiphy *wiphy);
1037 int linuxkpi_regulatory_set_wiphy_regd_sync(struct wiphy *wiphy,
1038 struct linuxkpi_ieee80211_regdomain *regd);
1039 uint32_t linuxkpi_ieee80211_channel_to_frequency(uint32_t, enum nl80211_band);
1040 uint32_t linuxkpi_ieee80211_frequency_to_channel(uint32_t, uint32_t);
1041 struct linuxkpi_ieee80211_channel *
1042 linuxkpi_ieee80211_get_channel(struct wiphy *, uint32_t);
1044 /* -------------------------------------------------------------------------- */
1046 static __inline struct wiphy *
1047 wiphy_new(const struct cfg80211_ops *ops, size_t priv_len)
1050 return (linuxkpi_wiphy_new(ops, priv_len));
1053 static __inline void
1054 wiphy_free(struct wiphy *wiphy)
1057 linuxkpi_wiphy_free(wiphy);
1060 static __inline void *
1061 wiphy_priv(struct wiphy *wiphy)
1064 return (wiphy->priv);
1067 static __inline void
1068 set_wiphy_dev(struct wiphy *wiphy, struct device *dev)
1074 static __inline struct device *
1075 wiphy_dev(struct wiphy *wiphy)
1078 return (wiphy->dev);
1081 #define wiphy_err(_wiphy, _fmt, ...) \
1082 dev_err((_wiphy)->dev, _fmt, __VA_ARGS__)
1084 static __inline const struct linuxkpi_ieee80211_regdomain *
1085 wiphy_dereference(struct wiphy *wiphy,
1086 const struct linuxkpi_ieee80211_regdomain *regd)
1092 static __inline void
1093 wiphy_lock(struct wiphy *wiphy)
1098 static __inline void
1099 wiphy_unlock(struct wiphy *wiphy)
1104 static __inline void
1105 wiphy_rfkill_set_hw_state_reason(struct wiphy *wiphy, bool blocked,
1106 enum rfkill_hard_block_reasons reason)
1111 /* -------------------------------------------------------------------------- */
1113 static __inline bool
1114 rfkill_blocked(int rfkill) /* argument type? */
1121 reg_query_regdb_wmm(uint8_t *alpha2, uint32_t center_freq,
1122 struct ieee80211_reg_rule *rule)
1125 /* ETSI has special rules. FreeBSD regdb needs to learn about them. */
1131 static __inline const u8 *
1132 cfg80211_find_ie_match(uint32_t f, const u8 *ies, size_t ies_len,
1133 const u8 *match, int x, int y)
1139 static __inline const u8 *
1140 cfg80211_find_ie(uint8_t eid, uint8_t *variable, uint32_t frame_size)
1146 static __inline void
1147 cfg80211_pmsr_complete(struct wireless_dev *wdev,
1148 struct cfg80211_pmsr_request *req, gfp_t gfp)
1153 static __inline void
1154 cfg80211_pmsr_report(struct wireless_dev *wdev,
1155 struct cfg80211_pmsr_request *req,
1156 struct cfg80211_pmsr_result *result, gfp_t gfp)
1161 static __inline void
1162 cfg80211_chandef_create(struct cfg80211_chan_def *chandef,
1163 struct linuxkpi_ieee80211_channel *chan, enum nl80211_chan_flags chan_flag)
1166 KASSERT(chandef != NULL, ("%s: chandef is NULL\n", __func__));
1167 KASSERT(chan != NULL, ("%s: chan is NULL\n", __func__));
1169 memset(chandef, 0, sizeof(*chandef));
1170 chandef->chan = chan;
1171 chandef->center_freq2 = 0; /* Set here and only overwrite if needed. */
1173 switch (chan_flag) {
1174 case NL80211_CHAN_NO_HT:
1175 chandef->width = NL80211_CHAN_WIDTH_20_NOHT;
1176 chandef->center_freq1 = chan->center_freq;
1179 printf("%s: unsupported chan_flag %#0x\n", __func__, chan_flag);
1180 /* XXX-BZ should we panic instead? */
1181 chandef->width = NL80211_CHAN_WIDTH_20;
1182 chandef->center_freq1 = chan->center_freq;
1187 static __inline void
1188 cfg80211_bss_iter(struct wiphy *wiphy, struct cfg80211_chan_def *chandef,
1189 void (*iterfunc)(struct wiphy *, struct cfg80211_bss *, void *), void *data)
1200 static __inline const struct element *
1201 cfg80211_find_elem(enum ieee80211_eid eid, uint8_t *data, size_t len)
1207 static __inline uint32_t
1208 cfg80211_calculate_bitrate(struct rate_info *rate)
1214 static __inline uint32_t
1215 ieee80211_channel_to_frequency(uint32_t channel, enum nl80211_band band)
1218 return (linuxkpi_ieee80211_channel_to_frequency(channel, band));
1221 static __inline uint32_t
1222 ieee80211_frequency_to_channel(uint32_t freq)
1225 return (linuxkpi_ieee80211_frequency_to_channel(freq, 0));
1229 regulatory_set_wiphy_regd_sync(struct wiphy *wiphy,
1230 struct linuxkpi_ieee80211_regdomain *regd)
1233 return (linuxkpi_regulatory_set_wiphy_regd_sync(wiphy, regd));
1237 regulatory_set_wiphy_regd_sync_rtnl(struct wiphy *wiphy,
1238 struct linuxkpi_ieee80211_regdomain *regd)
1242 return (linuxkpi_regulatory_set_wiphy_regd_sync(wiphy, regd));
1246 regulatory_set_wiphy_regd(struct wiphy *wiphy,
1247 struct linuxkpi_ieee80211_regdomain *regd)
1254 /* XXX-BZ wild guessing here based on brcmfmac. */
1255 if (wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED)
1260 /* XXX FIXME, do we have to do anything with reg_notifier? */
1265 regulatory_hint(struct wiphy *wiphy, const uint8_t *alpha2)
1271 static __inline const char *
1272 reg_initiator_name(enum nl80211_reg_initiator initiator)
1278 static __inline struct linuxkpi_ieee80211_regdomain *
1279 rtnl_dereference(const struct linuxkpi_ieee80211_regdomain *regd)
1285 static __inline struct ieee80211_reg_rule *
1286 freq_reg_info(struct wiphy *wiphy, uint32_t center_freq)
1292 static __inline struct cfg80211_bss *
1293 cfg80211_get_bss(struct wiphy *wiphy, struct linuxkpi_ieee80211_channel *chan,
1294 uint8_t *bssid, void *p, int x, uint32_t f1, uint32_t f2)
1300 static __inline void
1301 cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss)
1306 static __inline void
1307 wiphy_apply_custom_regulatory(struct wiphy *wiphy,
1308 const struct linuxkpi_ieee80211_regdomain *regd)
1313 static __inline char *
1314 wiphy_name(struct wiphy *wiphy)
1316 if (wiphy != NULL && wiphy->dev != NULL)
1317 return dev_name(wiphy->dev);
1324 static __inline void
1325 wiphy_read_of_freq_limits(struct wiphy *wiphy)
1332 static __inline uint8_t *
1333 cfg80211_find_vendor_ie(unsigned int oui, u8 oui_type,
1334 uint8_t *data, size_t len)
1340 static __inline void
1341 wiphy_ext_feature_set(struct wiphy *wiphy, enum nl80211_ext_feature ef)
1344 set_bit(ef, wiphy->ext_features);
1347 static __inline void *
1348 wiphy_net(struct wiphy *wiphy)
1351 return (NULL); /* XXX passed to dev_net_set() */
1355 wiphy_register(struct wiphy *wiphy)
1361 static __inline void
1362 wiphy_unregister(struct wiphy *wiphy)
1367 static __inline void
1368 wiphy_warn(struct wiphy *wiphy, const char *fmt, ...)
1374 cfg80211_check_combinations(struct wiphy *wiphy,
1375 struct iface_combination_params *params)
1381 static __inline uint8_t
1382 cfg80211_classify8021d(struct sk_buff *skb, void *p)
1388 static __inline void
1389 cfg80211_connect_done(struct net_device *ndev,
1390 struct cfg80211_connect_resp_params *conn_params, gfp_t gfp)
1395 static __inline void
1396 cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp)
1401 static __inline void
1402 cfg80211_disconnected(struct net_device *ndev, uint16_t reason,
1403 void *p, int x, bool locally_generated, gfp_t gfp)
1409 cfg80211_get_p2p_attr(const u8 *ie, u32 ie_len,
1410 enum ieee80211_p2p_attr_ids attr, u8 *p, size_t p_len)
1416 static __inline void
1417 cfg80211_ibss_joined(struct net_device *ndev, const uint8_t *addr,
1418 struct linuxkpi_ieee80211_channel *chan, gfp_t gfp)
1423 static __inline struct cfg80211_bss *
1424 cfg80211_inform_bss(struct wiphy *wiphy,
1425 struct linuxkpi_ieee80211_channel *channel,
1426 enum cfg80211_bss_frame_type bss_ftype, const uint8_t *bss, int _x,
1427 uint16_t cap, uint16_t intvl, const uint8_t *ie, size_t ie_len,
1428 int signal, gfp_t gfp)
1434 static __inline struct cfg80211_bss *
1435 cfg80211_inform_bss_data(struct wiphy *wiphy,
1436 struct cfg80211_inform_bss *bss_data,
1437 enum cfg80211_bss_frame_type bss_ftype, const uint8_t *bss, int _x,
1438 uint16_t cap, uint16_t intvl, const uint8_t *ie, size_t ie_len, gfp_t gfp)
1444 static __inline void
1445 cfg80211_mgmt_tx_status(struct wireless_dev *wdev, uint64_t cookie,
1446 const u8 *buf, size_t len, bool ack, gfp_t gfp)
1451 static __inline void
1452 cfg80211_michael_mic_failure(struct net_device *ndev, const uint8_t *addr,
1453 enum nl80211_key_type key_type, int _x, void *p, gfp_t gfp)
1458 static __inline void
1459 cfg80211_new_sta(struct net_device *ndev, const uint8_t *addr,
1460 struct station_info *sinfo, gfp_t gfp)
1465 static __inline void
1466 cfg80211_del_sta(struct net_device *ndev, const uint8_t *addr, gfp_t gfp)
1471 static __inline void
1472 cfg80211_port_authorized(struct net_device *ndev, const uint8_t *bssid,
1478 static __inline void
1479 cfg80211_ready_on_channel(struct wireless_dev *wdev, uint64_t cookie,
1480 struct linuxkpi_ieee80211_channel *channel, unsigned int duration,
1486 static __inline void
1487 cfg80211_remain_on_channel_expired(struct wireless_dev *wdev,
1488 uint64_t cookie, struct linuxkpi_ieee80211_channel *channel, gfp_t gfp)
1493 static __inline void
1494 cfg80211_report_wowlan_wakeup(void)
1499 static __inline void
1500 cfg80211_roamed(struct net_device *ndev, struct cfg80211_roam_info *roam_info,
1506 static __inline void
1507 cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int _x,
1508 uint8_t *p, size_t p_len, int _x2)
1513 static __inline void
1514 cfg80211_scan_done(struct cfg80211_scan_request *scan_request,
1515 struct cfg80211_scan_info *info)
1520 static __inline void
1521 cfg80211_sched_scan_results(struct wiphy *wiphy, uint64_t reqid)
1526 static __inline void
1527 cfg80211_sched_scan_stopped(struct wiphy *wiphy, int _x)
1532 static __inline void
1533 cfg80211_unregister_wdev(struct wireless_dev *wdev)
1538 static __inline struct sk_buff *
1539 cfg80211_vendor_cmd_alloc_reply_skb(struct wiphy *wiphy, unsigned int len)
1546 cfg80211_vendor_cmd_reply(struct sk_buff *skb)
1552 static __inline struct linuxkpi_ieee80211_channel *
1553 ieee80211_get_channel(struct wiphy *wiphy, uint32_t freq)
1556 return (linuxkpi_ieee80211_get_channel(wiphy, freq));
1559 static __inline size_t
1560 ieee80211_get_hdrlen_from_skb(struct sk_buff *skb)
1567 static __inline void
1568 cfg80211_bss_flush(struct wiphy *wiphy)
1573 static __inline bool
1574 cfg80211_channel_is_psc(struct linuxkpi_ieee80211_channel *channel)
1578 if (channel->band != NL80211_BAND_6GHZ)
1586 cfg80211_get_ies_channel_number(const uint8_t *ie, size_t len,
1587 enum nl80211_band band, enum cfg80211_bss_frame_type ftype)
1594 /* Used for scanning at least. */
1595 static __inline void
1596 get_random_mask_addr(uint8_t *dst, const uint8_t *addr, const uint8_t *mask)
1600 /* Get a completely random address and then overlay what we want. */
1601 get_random_bytes(dst, ETH_ALEN);
1602 for (i = 0; i < ETH_ALEN; i++)
1603 dst[i] = (dst[i] & ~(mask[i])) | (addr[i] & mask[i]);
1606 static __inline void
1607 cfg80211_shutdown_all_interfaces(struct wiphy *wiphy)
1612 #ifndef LINUXKPI_NET80211
1613 #define ieee80211_channel linuxkpi_ieee80211_channel
1614 #define ieee80211_regdomain linuxkpi_ieee80211_regdomain
1615 /* net80211::IEEE80211_VHT_MCS_SUPPORT_0_n() conflicts */
1616 #if defined(IEEE80211_VHT_MCS_SUPPORT_0_7)
1617 #undef IEEE80211_VHT_MCS_SUPPORT_0_7
1619 #if defined(IEEE80211_VHT_MCS_SUPPORT_0_8)
1620 #undef IEEE80211_VHT_MCS_SUPPORT_0_8
1622 #if defined(IEEE80211_VHT_MCS_SUPPORT_0_9)
1623 #undef IEEE80211_VHT_MCS_SUPPORT_0_9
1625 #define IEEE80211_VHT_MCS_SUPPORT_0_7 LKPI_IEEE80211_VHT_MCS_SUPPORT_0_7
1626 #define IEEE80211_VHT_MCS_SUPPORT_0_8 LKPI_IEEE80211_VHT_MCS_SUPPORT_0_8
1627 #define IEEE80211_VHT_MCS_SUPPORT_0_9 LKPI_IEEE80211_VHT_MCS_SUPPORT_0_9
1630 #endif /* _LINUXKPI_NET_CFG80211_H */