xref: /freebsd/sys/compat/linuxkpi/common/include/net/cfg80211.h (revision 5036d9652a5701d00e9e40ea942c278e9f77d33d)
1 /*-
2  * Copyright (c) 2020-2024 The FreeBSD Foundation
3  * Copyright (c) 2021-2022 Bjoern A. Zeeb
4  *
5  * This software was developed by Björn Zeeb under sponsorship from
6  * the FreeBSD Foundation.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
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.
16  *
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
27  * SUCH DAMAGE.
28  */
29 
30 #ifndef	_LINUXKPI_NET_CFG80211_H
31 #define	_LINUXKPI_NET_CFG80211_H
32 
33 #include <linux/types.h>
34 #include <linux/nl80211.h>
35 #include <linux/ieee80211.h>
36 #include <linux/if_ether.h>
37 #include <linux/ethtool.h>
38 #include <linux/device.h>
39 #include <linux/netdevice.h>
40 #include <linux/random.h>
41 #include <linux/skbuff.h>
42 #include <linux/timer.h>
43 #include <linux/workqueue.h>
44 #include <net/regulatory.h>
45 
46 /* linux_80211.c */
47 extern int linuxkpi_debug_80211;
48 #ifndef	D80211_TODO
49 #define	D80211_TODO		0x1
50 #endif
51 #ifndef	D80211_IMPROVE
52 #define	D80211_IMPROVE		0x2
53 #endif
54 #define	TODO(fmt, ...)		if (linuxkpi_debug_80211 & D80211_TODO)	\
55     printf("%s:%d: XXX LKPI80211 TODO " fmt "\n",  __func__, __LINE__, ##__VA_ARGS__)
56 #define	IMPROVE(...)	if (linuxkpi_debug_80211 & D80211_IMPROVE)	\
57     printf("%s:%d: XXX LKPI80211 IMPROVE\n", __func__, __LINE__)
58 
59 enum rfkill_hard_block_reasons {
60 	RFKILL_HARD_BLOCK_NOT_OWNER		= BIT(0),
61 };
62 
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 */
67 
68 #define	CFG80211_SIGNAL_TYPE_MBM			__LINE__ /* TODO FIXME brcmfmac */
69 
70 #define	UPDATE_ASSOC_IES	1
71 
72 #define	IEEE80211_MAX_CHAINS	4		/* net80211: IEEE80211_MAX_CHAINS copied */
73 
74 enum cfg80211_rate_info_flags {
75 	RATE_INFO_FLAGS_MCS		= BIT(0),
76 	RATE_INFO_FLAGS_VHT_MCS		= BIT(1),
77 	RATE_INFO_FLAGS_SHORT_GI	= BIT(2),
78 	RATE_INFO_FLAGS_HE_MCS		= BIT(4),
79 	RATE_INFO_FLAGS_EHT_MCS		= BIT(7),
80 	/* Max 8 bits as used in struct rate_info. */
81 };
82 
83 extern const uint8_t rfc1042_header[6];
84 extern const uint8_t bridge_tunnel_header[6];
85 
86 enum ieee80211_privacy {
87 	IEEE80211_PRIVACY_ANY,
88 };
89 
90 enum ieee80211_bss_type {
91 	IEEE80211_BSS_TYPE_ANY,
92 };
93 
94 enum cfg80211_bss_frame_type {
95 	CFG80211_BSS_FTYPE_UNKNOWN,
96 	CFG80211_BSS_FTYPE_BEACON,
97 	CFG80211_BSS_FTYPE_PRESP,
98 };
99 
100 enum ieee80211_channel_flags {
101 	IEEE80211_CHAN_DISABLED			= BIT(0),
102 	IEEE80211_CHAN_INDOOR_ONLY		= BIT(1),
103 	IEEE80211_CHAN_IR_CONCURRENT		= BIT(2),
104 	IEEE80211_CHAN_RADAR			= BIT(3),
105 	IEEE80211_CHAN_NO_IR			= BIT(4),
106 	IEEE80211_CHAN_NO_HT40MINUS		= BIT(5),
107 	IEEE80211_CHAN_NO_HT40PLUS		= BIT(6),
108 	IEEE80211_CHAN_NO_80MHZ			= BIT(7),
109 	IEEE80211_CHAN_NO_160MHZ		= BIT(8),
110 	IEEE80211_CHAN_NO_OFDM			= BIT(9),
111 	IEEE80211_CHAN_NO_6GHZ_VLP_CLIENT	= BIT(10),
112 	IEEE80211_CHAN_NO_6GHZ_AFC_CLIENT	= BIT(11),
113 	IEEE80211_CHAN_PSD			= BIT(12),
114 	IEEE80211_CHAN_ALLOW_6GHZ_VLP_AP	= BIT(13),
115 	IEEE80211_CHAN_CAN_MONITOR		= BIT(14),
116 };
117 #define	IEEE80211_CHAN_NO_HT40	(IEEE80211_CHAN_NO_HT40MINUS|IEEE80211_CHAN_NO_HT40PLUS)
118 
119 struct ieee80211_txrx_stypes {
120 	uint16_t	tx;
121 	uint16_t	rx;
122 };
123 
124 /* XXX net80211 has an ieee80211_channel as well. */
125 struct linuxkpi_ieee80211_channel {
126 	/* TODO FIXME */
127 	uint32_t				hw_value;	/* ic_ieee */
128 	uint32_t				center_freq;	/* ic_freq */
129 	enum ieee80211_channel_flags		flags;		/* ic_flags */
130 	enum nl80211_band			band;
131 	int8_t					max_power;	/* ic_maxpower */
132 	bool					beacon_found;
133 	int     max_antenna_gain, max_reg_power;
134 	int     orig_flags;
135 	int	dfs_cac_ms, dfs_state;
136 	int	orig_mpwr;
137 };
138 
139 struct cfg80211_bitrate_mask {
140 	/* TODO FIXME */
141 	struct {
142 		uint32_t			legacy;
143 		uint8_t				ht_mcs[IEEE80211_HT_MCS_MASK_LEN];
144 		uint16_t			vht_mcs[8];
145 		uint16_t			he_mcs[8];
146 		enum nl80211_txrate_gi		gi;
147 		enum nl80211_he_gi		he_gi;
148 		uint8_t				he_ltf;		/* XXX enum? */
149 	} control[NUM_NL80211_BANDS];
150 };
151 
152 enum rate_info_bw {
153 	RATE_INFO_BW_20		= 0,
154 	RATE_INFO_BW_5,
155 	RATE_INFO_BW_10,
156 	RATE_INFO_BW_40,
157 	RATE_INFO_BW_80,
158 	RATE_INFO_BW_160,
159 	RATE_INFO_BW_HE_RU,
160 	RATE_INFO_BW_320,
161 	RATE_INFO_BW_EHT_RU,
162 };
163 
164 struct rate_info {
165 	uint8_t					flags;			/* enum cfg80211_rate_info_flags */
166 	uint8_t					bw;
167 	uint16_t				legacy;
168 	uint8_t					mcs;
169 	uint8_t					nss;
170 	uint8_t					he_dcm;
171 	uint8_t					he_gi;
172 	uint8_t					he_ru_alloc;
173 	uint8_t					eht_gi;
174 };
175 
176 struct ieee80211_rate {
177 	/* TODO FIXME */
178 	uint32_t		bitrate;
179 	uint32_t		hw_value;
180 	uint32_t		hw_value_short;
181 	uint32_t		flags;
182 };
183 
184 struct ieee80211_sta_ht_cap {
185 	bool					ht_supported;
186 	uint8_t					ampdu_density;
187 	uint8_t					ampdu_factor;
188 	uint16_t				cap;
189 	struct ieee80211_mcs_info		mcs;
190 };
191 
192 /* XXX net80211 calls these IEEE80211_VHTCAP_* */
193 #define	IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_3895	0x00000000	/* IEEE80211_VHTCAP_MAX_MPDU_LENGTH_3895 */
194 #define	IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_7991	0x00000001	/* IEEE80211_VHTCAP_MAX_MPDU_LENGTH_7991 */
195 #define	IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454	0x00000002	/* IEEE80211_VHTCAP_MAX_MPDU_LENGTH_11454 */
196 #define	IEEE80211_VHT_CAP_MAX_MPDU_MASK		0x00000003	/* IEEE80211_VHTCAP_MAX_MPDU_MASK */
197 
198 #define	IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ		(IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_160MHZ << IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_MASK_S)
199 #define	IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ	(IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_160_80P80MHZ << IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_MASK_S)
200 #define	IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK	0x0000000c	/* IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_MASK */
201 
202 #define	IEEE80211_VHT_CAP_RXLDPC		0x00000010	/* IEEE80211_VHTCAP_RXLDPC */
203 
204 #define	IEEE80211_VHT_CAP_SHORT_GI_80		0x00000020	/* IEEE80211_VHTCAP_SHORT_GI_80 */
205 #define	IEEE80211_VHT_CAP_SHORT_GI_160		0x00000040	/* IEEE80211_VHTCAP_SHORT_GI_160 */
206 
207 #define	IEEE80211_VHT_CAP_TXSTBC		0x00000080	/* IEEE80211_VHTCAP_TXSTBC */
208 
209 #define	IEEE80211_VHT_CAP_RXSTBC_1		0x00000100	/* IEEE80211_VHTCAP_RXSTBC_1 */
210 #define	IEEE80211_VHT_CAP_RXSTBC_MASK		0x00000700	/* IEEE80211_VHTCAP_RXSTBC_MASK */
211 
212 #define	IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE	0x00000800	/* IEEE80211_VHTCAP_SU_BEAMFORMER_CAPABLE */
213 
214 #define	IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE	0x00001000	/* IEEE80211_VHTCAP_SU_BEAMFORMEE_CAPABLE */
215 
216 #define	IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE	0x00080000	/* IEEE80211_VHTCAP_MU_BEAMFORMER_CAPABLE */
217 
218 #define	IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE	0x00100000	/* IEEE80211_VHTCAP_MU_BEAMFORMEE_CAPABLE */
219 
220 #define	IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT		13	/* IEEE80211_VHTCAP_BEAMFORMEE_STS_SHIFT */
221 #define	IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK		(7 << IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT)	/* IEEE80211_VHTCAP_BEAMFORMEE_STS_MASK */
222 
223 #define	IEEE80211_VHT_CAP_HTC_VHT		0x00400000	/* IEEE80211_VHTCAP_HTC_VHT */
224 
225 #define	IEEE80211_VHT_CAP_RX_ANTENNA_PATTERN	0x10000000	/* IEEE80211_VHTCAP_RX_ANTENNA_PATTERN */
226 #define	IEEE80211_VHT_CAP_TX_ANTENNA_PATTERN	0x20000000	/* IEEE80211_VHTCAP_TX_ANTENNA_PATTERN */
227 
228 #define	IEEE80211_VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB	0x0c000000	/* IEEE80211_VHTCAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB */
229 
230 #define	IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_SHIFT	16	/* IEEE80211_VHTCAP_SOUNDING_DIMENSIONS_SHIFT */
231 #define	IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MASK		\
232 	(7 << IEEE80211_VHTCAP_SOUNDING_DIMENSIONS_SHIFT)	/* IEEE80211_VHTCAP_SOUNDING_DIMENSIONS_MASK */
233 
234 #define	IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT	23	/* IEEE80211_VHTCAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT */
235 #define	IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK	\
236 	(7 << IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT)	/* IEEE80211_VHTCAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK */
237 
238 #define	IEEE80211_VHT_CAP_EXT_NSS_BW_MASK	0xc0000000
239 
240 struct ieee80211_sta_vht_cap {
241 		/* TODO FIXME */
242 	bool				vht_supported;
243 	uint32_t			cap;
244 	struct ieee80211_vht_mcs_info	vht_mcs;
245 };
246 
247 enum ieee80211_vht_opmode {
248 	IEEE80211_OPMODE_NOTIF_RX_NSS_SHIFT	= 4,
249 };
250 
251 struct cfg80211_connect_resp_params {
252 		/* XXX TODO */
253 	uint8_t				*bssid;
254 	const uint8_t			*req_ie;
255 	const uint8_t			*resp_ie;
256 	uint32_t			req_ie_len;
257 	uint32_t			resp_ie_len;
258 	int	status;
259 };
260 
261 struct cfg80211_inform_bss {
262 		/* XXX TODO */
263 	int     boottime_ns, scan_width, signal;
264 	struct linuxkpi_ieee80211_channel	*chan;
265 };
266 
267 struct cfg80211_roam_info {
268 		/* XXX TODO */
269 	uint8_t				*bssid;
270 	const uint8_t			*req_ie;
271 	const uint8_t			*resp_ie;
272 	uint32_t			req_ie_len;
273 	uint32_t			resp_ie_len;
274 	struct linuxkpi_ieee80211_channel	*channel;
275 };
276 
277 struct cfg80211_bss_ies {
278 	uint8_t				*data;
279 	size_t				len;
280 };
281 
282 struct cfg80211_bss {
283 		/* XXX TODO */
284 	struct cfg80211_bss_ies		*ies;
285 	struct cfg80211_bss_ies		*beacon_ies;
286 
287 	int32_t				signal;
288 };
289 
290 struct cfg80211_chan_def {
291 		/* XXX TODO */
292 	struct linuxkpi_ieee80211_channel	*chan;
293 	enum nl80211_chan_width		width;
294 	uint32_t			center_freq1;
295 	uint32_t			center_freq2;
296 	uint16_t			punctured;
297 };
298 
299 struct cfg80211_ftm_responder_stats {
300 		/* XXX TODO */
301 	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;
302 };
303 
304 struct cfg80211_pmsr_capabilities {
305 		/* XXX TODO */
306 	int	max_peers, randomize_mac_addr, report_ap_tsf;
307 	struct {
308 		int	 asap, bandwidths, max_bursts_exponent, max_ftms_per_burst, non_asap, non_trigger_based, preambles, request_civicloc, request_lci, supported, trigger_based;
309 	} ftm;
310 };
311 
312 struct cfg80211_pmsr_ftm_request {
313 		/* XXX TODO */
314 	int     asap, burst_period, ftmr_retries, ftms_per_burst, non_trigger_based, num_bursts_exp, request_civicloc, request_lci, trigger_based;
315 	uint8_t					bss_color;
316 	bool					lmr_feedback;
317 };
318 
319 struct cfg80211_pmsr_request_peer {
320 		/* XXX TODO */
321 	struct cfg80211_chan_def		chandef;
322 	struct cfg80211_pmsr_ftm_request	ftm;
323 	uint8_t					addr[ETH_ALEN];
324 	int	report_ap_tsf;
325 };
326 
327 struct cfg80211_pmsr_request {
328 		/* XXX TODO */
329 	int	cookie, n_peers, timeout;
330 	uint8_t					mac_addr[ETH_ALEN], mac_addr_mask[ETH_ALEN];
331 	struct cfg80211_pmsr_request_peer	peers[];
332 };
333 
334 struct cfg80211_pmsr_ftm_result {
335 		/* XXX TODO */
336 	int	burst_index, busy_retry_time, failure_reason;
337 	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 	uint8_t					*lci;
339 	uint8_t					*civicloc;
340 	int					lci_len;
341 	int					civicloc_len;
342 };
343 
344 struct cfg80211_pmsr_result {
345 		/* XXX TODO */
346 	int	ap_tsf, ap_tsf_valid, final, host_time, status, type;
347 	uint8_t					addr[ETH_ALEN];
348 	struct cfg80211_pmsr_ftm_result		ftm;
349 };
350 
351 struct cfg80211_sar_freq_ranges {
352 	uint32_t				start_freq;
353 	uint32_t				end_freq;
354 };
355 
356 struct cfg80211_sar_sub_specs {
357 	uint32_t				freq_range_index;
358 	int					power;
359 };
360 
361 struct cfg80211_sar_specs {
362 	enum nl80211_sar_type			type;
363 	uint32_t				num_sub_specs;
364 	struct cfg80211_sar_sub_specs		sub_specs[];
365 };
366 
367 struct cfg80211_sar_capa {
368 	enum nl80211_sar_type			type;
369 	uint32_t				num_freq_ranges;
370 	const struct cfg80211_sar_freq_ranges	*freq_ranges;
371 };
372 
373 struct cfg80211_ssid {
374 	int	ssid_len;
375 	uint8_t	ssid[IEEE80211_MAX_SSID_LEN];
376 };
377 
378 struct cfg80211_scan_6ghz_params {
379 	/* XXX TODO */
380 	uint8_t				*bssid;
381 	int	channel_idx, psc_no_listen, short_ssid, short_ssid_valid, unsolicited_probe, psd_20;
382 };
383 
384 struct cfg80211_match_set {
385 	uint8_t					bssid[ETH_ALEN];
386 	struct cfg80211_ssid	ssid;
387 	int			rssi_thold;
388 };
389 
390 struct cfg80211_scan_request {
391 		/* XXX TODO */
392 	bool					no_cck;
393 	bool					scan_6ghz;
394 	bool					duration_mandatory;
395 	int8_t					tsf_report_link_id;
396 	uint16_t				duration;
397 	uint32_t				flags;
398 	struct wireless_dev			*wdev;
399 	struct wiphy				*wiphy;
400 	uint64_t				scan_start;
401 	uint32_t				rates[NUM_NL80211_BANDS];
402 	int					ie_len;
403 	uint8_t					*ie;
404 	uint8_t					mac_addr[ETH_ALEN], mac_addr_mask[ETH_ALEN];
405 	uint8_t					bssid[ETH_ALEN];
406 	int					n_ssids;
407 	int					n_6ghz_params;
408 	int					n_channels;
409 	struct cfg80211_ssid			*ssids;
410 	struct cfg80211_scan_6ghz_params 	*scan_6ghz_params;
411 	struct linuxkpi_ieee80211_channel	*channels[0];
412 };
413 
414 struct cfg80211_sched_scan_plan {
415 		/* XXX TODO */
416 	int	interval, iterations;
417 };
418 
419 struct cfg80211_sched_scan_request {
420 		/* XXX TODO */
421 	int	delay, flags;
422 	uint8_t					mac_addr[ETH_ALEN], mac_addr_mask[ETH_ALEN];
423 	uint64_t				reqid;
424 	int					n_match_sets;
425 	int					n_scan_plans;
426 	int					n_ssids;
427 	int					n_channels;
428 	int					ie_len;
429 	uint8_t					*ie;
430 	struct cfg80211_match_set		*match_sets;
431 	struct cfg80211_sched_scan_plan		*scan_plans;
432 	struct cfg80211_ssid			*ssids;
433 	struct linuxkpi_ieee80211_channel	*channels[0];
434 };
435 
436 struct cfg80211_scan_info {
437 	uint64_t				scan_start_tsf;
438 	uint8_t					tsf_bssid[ETH_ALEN];
439 	bool					aborted;
440 };
441 
442 struct cfg80211_beacon_data {
443 	/* XXX TODO */
444 	const uint8_t				*head;
445 	const uint8_t				*tail;
446 	uint32_t				head_len;
447 	uint32_t				tail_len;
448 	const uint8_t				*proberesp_ies;
449 	const uint8_t				*assocresp_ies;
450 	uint32_t				proberesp_ies_len;
451 	uint32_t				assocresp_ies_len;
452 };
453 
454 struct cfg80211_ap_settings {
455 	/* XXX TODO */
456 	int     auth_type, beacon_interval, dtim_period, hidden_ssid, inactivity_timeout;
457 	const uint8_t				*ssid;
458 	size_t					ssid_len;
459 	struct cfg80211_beacon_data		beacon;
460 	struct cfg80211_chan_def		chandef;
461 };
462 
463 struct cfg80211_bss_selection {
464 	/* XXX TODO */
465 	enum nl80211_bss_select_attr		behaviour;
466 	union {
467 		enum nl80211_band		band_pref;
468 		struct {
469 			enum nl80211_band	band;
470 			uint8_t			delta;
471 		} adjust;
472 	} param;
473 };
474 
475 struct cfg80211_crypto {		/* XXX made up name */
476 	/* XXX TODO */
477 	enum nl80211_wpa_versions		wpa_versions;
478 	uint32_t				cipher_group;	/* WLAN_CIPHER_SUITE_* */
479 	uint32_t				*akm_suites;
480 	uint32_t				*ciphers_pairwise;
481 	const uint8_t				*sae_pwd;
482 	const uint8_t				*psk;
483 	int					n_akm_suites;
484 	int					n_ciphers_pairwise;
485 	int					sae_pwd_len;
486 };
487 
488 struct cfg80211_connect_params {
489 	/* XXX TODO */
490 	struct linuxkpi_ieee80211_channel	*channel;
491 	uint8_t					*bssid;
492 	const uint8_t				*ie;
493 	const uint8_t				*ssid;
494 	uint32_t				ie_len;
495 	uint32_t				ssid_len;
496 	const void				*key;
497 	uint32_t				key_len;
498 	int     auth_type, key_idx, privacy, want_1x;
499 	struct cfg80211_bss_selection		bss_select;
500 	struct cfg80211_crypto			crypto;
501 };
502 
503 enum bss_param_flags {		/* Used as bitflags. XXX FIXME values? */
504 	BSS_PARAM_FLAGS_CTS_PROT	= 0x01,
505 	BSS_PARAM_FLAGS_SHORT_PREAMBLE	= 0x02,
506 	BSS_PARAM_FLAGS_SHORT_SLOT_TIME = 0x04,
507 };
508 
509 struct cfg80211_ibss_params {
510 	/* XXX TODO */
511 	int     basic_rates, beacon_interval;
512 	int	channel_fixed, ie, ie_len, privacy;
513 	int	dtim_period;
514 	uint8_t					*ssid;
515 	uint8_t					*bssid;
516 	int					ssid_len;
517 	struct cfg80211_chan_def		chandef;
518 	enum bss_param_flags			flags;
519 };
520 
521 struct cfg80211_mgmt_tx_params {
522 	/* XXX TODO */
523 	struct linuxkpi_ieee80211_channel	*chan;
524 	const uint8_t				*buf;
525 	size_t					len;
526 	int	wait;
527 };
528 
529 struct cfg80211_pmk_conf {
530 	/* XXX TODO */
531 	const uint8_t			*pmk;
532 	uint8_t				pmk_len;
533 };
534 
535 struct cfg80211_pmksa {
536 	/* XXX TODO */
537 	const uint8_t			*bssid;
538 	const uint8_t			*pmkid;
539 };
540 
541 struct station_del_parameters {
542 	/* XXX TODO */
543 	const uint8_t				*mac;
544 	uint32_t				reason_code;	/* elsewhere uint16_t? */
545 };
546 
547 struct station_info {
548 	/* TODO FIXME */
549 	int     assoc_req_ies_len, connected_time;
550 	int	generation, inactive_time, rx_bytes, rx_dropped_misc, rx_packets, signal, tx_bytes, tx_packets;
551 	int     filled, rx_beacon, rx_beacon_signal_avg, signal_avg;
552 	int	rx_duration, tx_duration, tx_failed, tx_retries;
553 	int	ack_signal, avg_ack_signal;
554 
555 	int					chains;
556 	uint8_t					chain_signal[IEEE80211_MAX_CHAINS];
557 	uint8_t					chain_signal_avg[IEEE80211_MAX_CHAINS];
558 
559 	uint8_t					*assoc_req_ies;
560 	struct rate_info			rxrate;
561 	struct rate_info			txrate;
562 	struct cfg80211_ibss_params		bss_param;
563 	struct nl80211_sta_flag_update		sta_flags;
564 };
565 
566 struct station_parameters {
567 	/* XXX TODO */
568 	int     sta_flags_mask, sta_flags_set;
569 };
570 
571 struct key_params {
572 	/* XXX TODO */
573 	const uint8_t	*key;
574 	const uint8_t	*seq;
575 	int		key_len;
576 	int		seq_len;
577 	uint32_t	cipher;			/* WLAN_CIPHER_SUITE_* */
578 };
579 
580 struct mgmt_frame_regs {
581 	/* XXX TODO */
582 	int	interface_stypes;
583 };
584 
585 struct vif_params {
586 	/* XXX TODO */
587 	uint8_t			macaddr[ETH_ALEN];
588 };
589 
590 /* That the world needs so many different structs for this is amazing. */
591 struct mac_address {
592 	uint8_t	addr[ETH_ALEN];
593 };
594 
595 struct ieee80211_reg_rule {
596 	/* TODO FIXME */
597 	uint32_t	flags;
598 	int	dfs_cac_ms;
599 	struct freq_range {
600 		int	start_freq_khz;
601 		int	end_freq_khz;
602 		int	max_bandwidth_khz;
603 	} freq_range;
604 	struct power_rule {
605 		int	max_antenna_gain;
606 		int	max_eirp;
607 	} power_rule;
608 };
609 
610 struct linuxkpi_ieee80211_regdomain {
611 	/* TODO FIXME */
612 	uint8_t					alpha2[2];
613 	int	dfs_region;
614 	int					n_reg_rules;
615 	struct ieee80211_reg_rule		reg_rules[];
616 };
617 
618 /* XXX-BZ this are insensible values probably ... */
619 #define	IEEE80211_HE_MAC_CAP0_HTC_HE			0x1
620 #define	IEEE80211_HE_MAC_CAP0_TWT_REQ			0x2
621 #define	IEEE80211_HE_MAC_CAP0_TWT_RES			0x4
622 
623 #define	IEEE80211_HE_MAC_CAP1_LINK_ADAPTATION		0x1
624 #define	IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_RX_QOS_8	0x2
625 #define	IEEE80211_HE_MAC_CAP1_TF_MAC_PAD_DUR_16US	0x4
626 #define	IEEE80211_HE_MAC_CAP1_TF_MAC_PAD_DUR_MASK	0x8
627 
628 #define	IEEE80211_HE_MAC_CAP2_32BIT_BA_BITMAP		0x1
629 #define	IEEE80211_HE_MAC_CAP2_ACK_EN			0x2
630 #define	IEEE80211_HE_MAC_CAP2_BSR			0x4
631 #define	IEEE80211_HE_MAC_CAP2_LINK_ADAPTATION		0x8
632 #define	IEEE80211_HE_MAC_CAP2_BCAST_TWT			0x10
633 #define	IEEE80211_HE_MAC_CAP2_ALL_ACK			0x20
634 #define	IEEE80211_HE_MAC_CAP2_MU_CASCADING		0x40
635 #define	IEEE80211_HE_MAC_CAP2_TRS			0x80
636 
637 #define	IEEE80211_HE_MAC_CAP3_OMI_CONTROL		0x02
638 #define	IEEE80211_HE_MAC_CAP3_OFDMA_RA			0x04
639 #define	IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_EXT_1	0x08
640 #define	IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_EXT_2	0x10
641 #define	IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_EXT_3	0x18
642 #define	IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_MASK	0x18
643 #define	IEEE80211_HE_MAC_CAP3_FLEX_TWT_SCHED		0x40
644 #define	IEEE80211_HE_MAC_CAP3_RX_CTRL_FRAME_TO_MULTIBSS	0x80
645 
646 #define	IEEE80211_HE_MAC_CAP4_AMDSU_IN_AMPDU		0x1
647 #define	IEEE80211_HE_MAC_CAP4_BQR			0x2
648 #define	IEEE80211_HE_MAC_CAP4_MULTI_TID_AGG_TX_QOS_B39	0x4
649 #define	IEEE80211_HE_MAC_CAP4_AMSDU_IN_AMPDU		0x8
650 #define	IEEE80211_HE_MAC_CAP4_OPS			0x10
651 #define	IEEE80211_HE_MAC_CAP4_BSRP_BQRP_A_MPDU_AGG	0x20
652 
653 #define	IEEE80211_HE_MAC_CAP5_HE_DYNAMIC_SM_PS		0x1
654 #define	IEEE80211_HE_MAC_CAP5_HT_VHT_TRIG_FRAME_RX	0x2
655 #define	IEEE80211_HE_MAC_CAP5_MULTI_TID_AGG_TX_QOS_B40	0x4
656 #define	IEEE80211_HE_MAC_CAP5_MULTI_TID_AGG_TX_QOS_B41	0x8
657 #define	IEEE80211_HE_MAC_CAP5_UL_2x996_TONE_RU		0x10
658 #define	IEEE80211_HE_MAC_CAP5_OM_CTRL_UL_MU_DATA_DIS_RX	0x20
659 #define	IEEE80211_HE_MAC_CAP5_PUNCTURED_SOUNDING	0x40
660 #define	IEEE80211_HE_MAC_CAP5_SUBCHAN_SELECTIVE_TRANSMISSION	0x80
661 
662 #define	IEEE80211_HE_MCS_NOT_SUPPORTED			0x0
663 #define	IEEE80211_HE_MCS_SUPPORT_0_7			0x1
664 #define	IEEE80211_HE_MCS_SUPPORT_0_9			0x2
665 #define	IEEE80211_HE_MCS_SUPPORT_0_11			0x4
666 
667 #define	IEEE80211_HE_6GHZ_CAP_TX_ANTPAT_CONS		0x01
668 #define	IEEE80211_HE_6GHZ_CAP_RX_ANTPAT_CONS		0x02
669 #define	IEEE80211_HE_6GHZ_CAP_MIN_MPDU_START		0x04
670 #define	IEEE80211_HE_6GHZ_CAP_MAX_MPDU_LEN		0x08
671 #define	IEEE80211_HE_6GHZ_CAP_MAX_AMPDU_LEN_EXP		0x10
672 #define	IEEE80211_HE_6GHZ_CAP_SM_PS			0x20
673 
674 #define	IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G		0x1
675 #define	IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G	0x2
676 #define	IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_IN_2G		0x4
677 #define	IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G	0x8
678 #define	IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_RU_MAPPING_IN_2G	0x10
679 #define	IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_RU_MAPPING_IN_5G	0x20
680 #define	IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_MASK			0x40
681 #define	IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_MASK_ALL		0xff
682 
683 #define	IEEE80211_HE_PHY_CAP1_DEVICE_CLASS_A		0x1
684 #define	IEEE80211_HE_PHY_CAP1_LDPC_CODING_IN_PAYLOAD	0x2
685 #define	IEEE80211_HE_PHY_CAP1_MIDAMBLE_RX_TX_MAX_NSTS	0x4
686 #define	IEEE80211_HE_PHY_CAP1_PREAMBLE_PUNC_RX_MASK	0x8
687 #define	IEEE80211_HE_PHY_CAP1_HE_LTF_AND_GI_FOR_HE_PPDUS_0_8US	0x10
688 
689 #define	IEEE80211_HE_PHY_CAP2_MIDAMBLE_RX_TX_MAX_NSTS	0x1
690 #define	IEEE80211_HE_PHY_CAP2_NDP_4x_LTF_AND_3_2US	0x2
691 #define	IEEE80211_HE_PHY_CAP2_STBC_TX_UNDER_80MHZ	0x4
692 #define	IEEE80211_HE_PHY_CAP2_STBC_RX_UNDER_80MHZ	0x8
693 #define	IEEE80211_HE_PHY_CAP2_DOPPLER_TX		0x10
694 #define	IEEE80211_HE_PHY_CAP2_UL_MU_PARTIAL_MU_MIMO	0x20
695 #define	IEEE80211_HE_PHY_CAP2_UL_MU_FULL_MU_MIMO	0x40
696 
697 #define	IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_MASK	0x1
698 #define	IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_NO_DCM	0x2
699 #define	IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_NO_DCM	0x4
700 #define	IEEE80211_HE_PHY_CAP3_DCM_MAX_RX_NSS_1		0x8
701 #define	IEEE80211_HE_PHY_CAP3_DCM_MAX_TX_NSS_1		0x10
702 #define	IEEE80211_HE_PHY_CAP3_SU_BEAMFORMER		0x20
703 #define	IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_16_QAM	0x40
704 #define	IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_16_QAM	0x80
705 #define	IEEE80211_HE_PHY_CAP3_DCM_MAX_TX_NSS_2		0x10
706 #define	IEEE80211_HE_PHY_CAP3_RX_PARTIAL_BW_SU_IN_20MHZ_MU	0x20
707 #define	IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_BPSK	0x40
708 #define	IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_BPSK	0x80
709 #define	IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_MASK	0x80
710 #define	IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_QPSK	0x80
711 #define	IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_QPSK	0x80
712 #define	IEEE80211_HE_PHY_CAP3_DCM_MAX_RX_NSS_2		0x80
713 
714 #define	IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_UNDER_80MHZ_8	0x1
715 #define	IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_ABOVE_80MHZ_8	0x2
716 #define	IEEE80211_HE_PHY_CAP4_SU_BEAMFORMEE			0x4
717 #define	IEEE80211_HE_PHY_CAP4_MU_BEAMFORMER			0x8
718 #define	IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_UNDER_80MHZ_4	0x10
719 #define	IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_ABOVE_80MHZ_4	0x20
720 #define	IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_ABOVE_80MHZ_MASK	0x40
721 #define	IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_UNDER_80MHZ_MASK	0x80
722 
723 #define	IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_ABOVE_80MHZ_2	0x1
724 #define	IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_2	0x2
725 #define	IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_MASK	0x4
726 #define	IEEE80211_HE_PHY_CAP5_NG16_MU_FEEDBACK				0x8
727 #define	IEEE80211_HE_PHY_CAP5_NG16_SU_FEEDBACK				0x10
728 #define	IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_ABOVE_80MHZ_MASK	0x20
729 
730 #define	IEEE80211_HE_PHY_CAP6_PPE_THRESHOLD_PRESENT	0x1
731 #define	IEEE80211_HE_PHY_CAP6_TRIG_MU_BEAMFORMER_FB	0x2
732 #define	IEEE80211_HE_PHY_CAP6_TRIG_SU_BEAMFORMER_FB	0x4
733 #define	IEEE80211_HE_PHY_CAP6_TRIG_SU_BEAMFORMING_FB	0x8
734 #define	IEEE80211_HE_PHY_CAP6_TRIG_MU_BEAMFORMING_PARTIAL_BW_FB	0x20
735 #define	IEEE80211_HE_PHY_CAP6_CODEBOOK_SIZE_42_SU	0x40
736 #define	IEEE80211_HE_PHY_CAP6_CODEBOOK_SIZE_75_MU	0x80
737 #define	IEEE80211_HE_PHY_CAP6_PARTIAL_BW_EXT_RANGE	0x80
738 #define	IEEE80211_HE_PHY_CAP6_TRIG_CQI_FB		0x80
739 #define	IEEE80211_HE_PHY_CAP6_PARTIAL_BANDWIDTH_DL_MUMIMO	0x80
740 
741 #define	IEEE80211_HE_PHY_CAP7_HE_SU_MU_PPDU_4XLTF_AND_08_US_GI	0x1
742 #define	IEEE80211_HE_PHY_CAP7_MAX_NC_1				0x2
743 #define	IEEE80211_HE_PHY_CAP7_MAX_NC_2				0x4
744 #define	IEEE80211_HE_PHY_CAP7_MAX_NC_MASK			0x6
745 #define	IEEE80211_HE_PHY_CAP7_POWER_BOOST_FACTOR_AR		0x8
746 #define	IEEE80211_HE_PHY_CAP7_POWER_BOOST_FACTOR_SUPP		0x10
747 #define	IEEE80211_HE_PHY_CAP7_STBC_RX_ABOVE_80MHZ		0x20
748 #define	IEEE80211_HE_PHY_CAP7_STBC_TX_ABOVE_80MHZ		0x40
749 #define	IEEE80211_HE_PHY_CAP7_PSR_BASED_SR			0x80
750 
751 #define	IEEE80211_HE_PHY_CAP8_20MHZ_IN_160MHZ_HE_PPDU		0x1
752 #define	IEEE80211_HE_PHY_CAP8_20MHZ_IN_40MHZ_HE_PPDU_IN_2G	0x2
753 #define	IEEE80211_HE_PHY_CAP8_80MHZ_IN_160MHZ_HE_PPDU		0x4
754 #define	IEEE80211_HE_PHY_CAP8_DCM_MAX_RU_242			0x8
755 #define	IEEE80211_HE_PHY_CAP8_DCM_MAX_RU_484			0x10
756 #define	IEEE80211_HE_PHY_CAP8_DCM_MAX_RU_996			0x18
757 #define	IEEE80211_HE_PHY_CAP8_DCM_MAX_RU_2x996			0x20
758 #define	IEEE80211_HE_PHY_CAP8_DCM_MAX_RU_MASK			0x28
759 #define	IEEE80211_HE_PHY_CAP8_HE_ER_SU_PPDU_4XLTF_AND_08_US_GI	0x40
760 #define	IEEE80211_HE_PHY_CAP8_HE_ER_SU_1XLTF_AND_08_US_GI	0x80
761 
762 #define	IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_0US		0x1
763 #define	IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_16US		0x2
764 #define	IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_8US		0x4
765 #define	IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_MASK		0x8
766 #define	IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_RESERVED	0x10
767 #define	IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_POS		0x0
768 #define	IEEE80211_HE_PHY_CAP9_NON_TRIGGERED_CQI_FEEDBACK	0x20
769 #define	IEEE80211_HE_PHY_CAP9_RX_FULL_BW_SU_USING_MU_WITH_COMP_SIGB	0x4
770 #define	IEEE80211_HE_PHY_CAP9_RX_FULL_BW_SU_USING_MU_WITH_NON_COMP_SIGB	0x8
771 #define	IEEE80211_HE_PHY_CAP9_RX_1024_QAM_LESS_THAN_242_TONE_RU	0x10
772 #define	IEEE80211_HE_PHY_CAP9_TX_1024_QAM_LESS_THAN_242_TONE_RU	0x20
773 #define	IEEE80211_HE_PHY_CAP9_LONGER_THAN_16_SIGB_OFDM_SYM	0x40
774 
775 #define	IEEE80211_HE_PHY_CAP10_HE_MU_M1RU_MAX_LTF		0x1
776 
777 #define	IEEE80211_HE_OPERATION_BSS_COLOR_DISABLED		0x1
778 #define	IEEE80211_HE_OPERATION_BSS_COLOR_OFFSET			0x2
779 #define	IEEE80211_HE_OPERATION_ER_SU_DISABLE			0x4
780 
781 #define	IEEE80211_HE_SPR_HESIGA_SR_VAL15_ALLOWED		0x01
782 #define	IEEE80211_HE_SPR_NON_SRG_OBSS_PD_SR_DISALLOWED		0x02
783 #define	IEEE80211_HE_SPR_NON_SRG_OFFSET_PRESENT			0x04
784 #define	IEEE80211_HE_SPR_SRG_INFORMATION_PRESENT		0x08
785 
786 #define	IEEE80211_EHT_MAC_CAP0_EPCS_PRIO_ACCESS			0x01
787 #define	IEEE80211_EHT_MAC_CAP0_MAX_MPDU_LEN_11454		0x02
788 #define	IEEE80211_EHT_MAC_CAP0_MAX_MPDU_LEN_MASK		0x03
789 #define	IEEE80211_EHT_MAC_CAP0_OM_CONTROL			0x04
790 #define	IEEE80211_EHT_MAC_CAP0_TRIG_TXOP_SHARING_MODE1		0x05
791 #define	IEEE80211_EHT_MAC_CAP0_TRIG_TXOP_SHARING_MODE2		0x06
792 #define	IEEE80211_EHT_MAC_CAP0_MAX_MPDU_LEN_7991		0x07
793 #define	IEEE80211_EHT_MAC_CAP0_SCS_TRAFFIC_DESC			0x08
794 
795 #define	IEEE80211_EHT_MAC_CAP1_MAX_AMPDU_LEN_MASK		0x01
796 
797 #define	IEEE80211_EHT_MCS_NSS_RX				0x01
798 #define	IEEE80211_EHT_MCS_NSS_TX				0x02
799 
800 #define	IEEE80211_EHT_PHY_CAP0_242_TONE_RU_GT20MHZ		0x01
801 #define	IEEE80211_EHT_PHY_CAP0_320MHZ_IN_6GHZ			0x02
802 #define	IEEE80211_EHT_PHY_CAP0_BEAMFORMEE_SS_80MHZ_MASK		0x03
803 #define	IEEE80211_EHT_PHY_CAP0_NDP_4_EHT_LFT_32_GI		0x04
804 #define	IEEE80211_EHT_PHY_CAP0_PARTIAL_BW_UL_MU_MIMO		0x05
805 #define	IEEE80211_EHT_PHY_CAP0_SU_BEAMFORMEE			0x06
806 #define	IEEE80211_EHT_PHY_CAP0_SU_BEAMFORMER			0x07
807 
808 #define	IEEE80211_EHT_PHY_CAP1_BEAMFORMEE_SS_160MHZ_MASK	0x01
809 #define	IEEE80211_EHT_PHY_CAP1_BEAMFORMEE_SS_320MHZ_MASK	0x02
810 #define	IEEE80211_EHT_PHY_CAP1_BEAMFORMEE_SS_80MHZ_MASK		0x03
811 
812 #define	IEEE80211_EHT_PHY_CAP2_SOUNDING_DIM_80MHZ_MASK		0x01
813 #define	IEEE80211_EHT_PHY_CAP2_SOUNDING_DIM_160MHZ_MASK		0x02
814 #define	IEEE80211_EHT_PHY_CAP2_SOUNDING_DIM_320MHZ_MASK		0x03
815 
816 #define	IEEE80211_EHT_PHY_CAP3_CODEBOOK_4_2_SU_FDBK		0x01
817 #define	IEEE80211_EHT_PHY_CAP3_CODEBOOK_7_5_MU_FDBK		0x02
818 #define	IEEE80211_EHT_PHY_CAP3_NG_16_MU_FEEDBACK		0x03
819 #define	IEEE80211_EHT_PHY_CAP3_NG_16_SU_FEEDBACK		0x04
820 #define	IEEE80211_EHT_PHY_CAP3_TRIG_CQI_FDBK			0x05
821 #define	IEEE80211_EHT_PHY_CAP3_TRIG_MU_BF_PART_BW_FDBK		0x06
822 #define	IEEE80211_EHT_PHY_CAP3_TRIG_SU_BF_FDBK			0x07
823 #define	IEEE80211_EHT_PHY_CAP3_SOUNDING_DIM_320MHZ_MASK		0x08
824 
825 #define	IEEE80211_EHT_PHY_CAP4_EHT_MU_PPDU_4_EHT_LTF_08_GI	0x01
826 #define	IEEE80211_EHT_PHY_CAP4_PART_BW_DL_MU_MIMO		0x02
827 #define	IEEE80211_EHT_PHY_CAP4_POWER_BOOST_FACT_SUPP		0x03
828 #define	IEEE80211_EHT_PHY_CAP4_MAX_NC_MASK			0x04
829 
830 #define	IEEE80211_EHT_PHY_CAP5_COMMON_NOMINAL_PKT_PAD_0US	0x01
831 #define	IEEE80211_EHT_PHY_CAP5_COMMON_NOMINAL_PKT_PAD_16US	0x02
832 #define	IEEE80211_EHT_PHY_CAP5_COMMON_NOMINAL_PKT_PAD_20US	0x03
833 #define	IEEE80211_EHT_PHY_CAP5_COMMON_NOMINAL_PKT_PAD_8US	0x04
834 #define	IEEE80211_EHT_PHY_CAP5_COMMON_NOMINAL_PKT_PAD_MASK	0x05
835 #define	IEEE80211_EHT_PHY_CAP5_NON_TRIG_CQI_FEEDBACK		0x06
836 #define	IEEE80211_EHT_PHY_CAP5_PPE_THRESHOLD_PRESENT		0x07
837 #define	IEEE80211_EHT_PHY_CAP5_RX_LESS_242_TONE_RU_SUPP		0x08
838 #define	IEEE80211_EHT_PHY_CAP5_TX_LESS_242_TONE_RU_SUPP		0x09
839 #define	IEEE80211_EHT_PHY_CAP5_MAX_NUM_SUPP_EHT_LTF_MASK	0x0a
840 #define	IEEE80211_EHT_PHY_CAP5_SUPP_EXTRA_EHT_LTF		0x0b
841 
842 #define	IEEE80211_EHT_PHY_CAP6_EHT_DUP_6GHZ_SUPP		0x01
843 #define	IEEE80211_EHT_PHY_CAP6_MCS15_SUPP_MASK			0x02
844 #define	IEEE80211_EHT_PHY_CAP6_MAX_NUM_SUPP_EHT_LTF_MASK	0x03
845 
846 #define	IEEE80211_EHT_PHY_CAP7_MU_BEAMFORMER_80MHZ		0x01
847 #define	IEEE80211_EHT_PHY_CAP7_MU_BEAMFORMER_160MHZ		0x02
848 #define	IEEE80211_EHT_PHY_CAP7_MU_BEAMFORMER_320MHZ		0x03
849 #define	IEEE80211_EHT_PHY_CAP7_NON_OFDMA_UL_MU_MIMO_80MHZ	0x04
850 #define	IEEE80211_EHT_PHY_CAP7_NON_OFDMA_UL_MU_MIMO_160MHZ	0x05
851 #define	IEEE80211_EHT_PHY_CAP7_NON_OFDMA_UL_MU_MIMO_320MHZ	0x06
852 
853 #define	IEEE80211_EHT_PHY_CAP8_RX_1024QAM_WIDER_BW_DL_OFDMA	0x01
854 #define	IEEE80211_EHT_PHY_CAP8_RX_4096QAM_WIDER_BW_DL_OFDMA	0x02
855 
856 #define	IEEE80211_EHT_PPE_THRES_INFO_HEADER_SIZE		0x01
857 #define	IEEE80211_EHT_PPE_THRES_NSS_MASK			0x02
858 #define	IEEE80211_EHT_PPE_THRES_RU_INDEX_BITMASK_MASK		0x03
859 #define	IEEE80211_EHT_PPE_THRES_INFO_PPET_SIZE			0x04
860 
861 #define	IEEE80211_EML_CAP_EMLSR_SUPP				0x01
862 #define	IEEE80211_EML_CAP_TRANSITION_TIMEOUT			0x02
863 #define	IEEE80211_EML_CAP_TRANSITION_TIMEOUT_128TU		0x04
864 #define	IEEE80211_EML_CAP_EMLSR_PADDING_DELAY			0x08
865 #define	IEEE80211_EML_CAP_EMLSR_PADDING_DELAY_32US		0x10
866 #define	IEEE80211_EML_CAP_EMLSR_TRANSITION_DELAY		0x20
867 #define	IEEE80211_EML_CAP_EMLSR_TRANSITION_DELAY_64US		0x40
868 
869 #define	VENDOR_CMD_RAW_DATA	(void *)(uintptr_t)(-ENOENT)
870 
871 struct ieee80211_he_cap_elem {
872 	u8 mac_cap_info[6];
873 	u8 phy_cap_info[11];
874 } __packed;
875 
876 struct ieee80211_he_mcs_nss_supp {
877 	/* TODO FIXME */
878 	uint32_t	rx_mcs_80;
879 	uint32_t	tx_mcs_80;
880 	uint32_t	rx_mcs_160;
881 	uint32_t	tx_mcs_160;
882 	uint32_t	rx_mcs_80p80;
883 	uint32_t	tx_mcs_80p80;
884 };
885 
886 #define	IEEE80211_STA_HE_CAP_PPE_THRES_MAX	32
887 struct ieee80211_sta_he_cap {
888 	/* TODO FIXME */
889 	int					has_he;
890 	struct ieee80211_he_cap_elem		he_cap_elem;
891 	struct ieee80211_he_mcs_nss_supp	he_mcs_nss_supp;
892 	uint8_t					ppe_thres[IEEE80211_STA_HE_CAP_PPE_THRES_MAX];
893 };
894 
895 struct cfg80211_he_bss_color {
896 	int	color, enabled;
897 };
898 
899 struct ieee80211_he_obss_pd {
900 	bool					enable;
901 	uint8_t					min_offset;
902 	uint8_t					max_offset;
903 	uint8_t					non_srg_max_offset;
904 	uint8_t					sr_ctrl;
905 	uint8_t					bss_color_bitmap[8];
906 	uint8_t					partial_bssid_bitmap[8];
907 };
908 
909 struct ieee80211_sta_he_6ghz_capa {
910 	/* TODO FIXME */
911 	int	capa;
912 };
913 
914 struct ieee80211_eht_mcs_nss_supp_20mhz_only {
915 	union {
916 		struct {
917 			uint8_t				rx_tx_mcs7_max_nss;
918 			uint8_t				rx_tx_mcs9_max_nss;
919 			uint8_t				rx_tx_mcs11_max_nss;
920 			uint8_t				rx_tx_mcs13_max_nss;
921 		};
922 		uint8_t					rx_tx_max_nss[4];
923 	};
924 };
925 
926 struct ieee80211_eht_mcs_nss_supp_bw {
927 	union {
928 		struct {
929 			uint8_t				rx_tx_mcs9_max_nss;
930 			uint8_t				rx_tx_mcs11_max_nss;
931 			uint8_t				rx_tx_mcs13_max_nss;
932 		};
933 		uint8_t					rx_tx_max_nss[3];
934 	};
935 };
936 
937 struct ieee80211_eht_cap_elem_fixed {
938 	uint8_t					mac_cap_info[2];
939 	uint8_t					phy_cap_info[9];
940 };
941 
942 struct ieee80211_eht_mcs_nss_supp {
943 	/* TODO FIXME */
944 	/* Can only have either or... */
945 	union {
946 		struct ieee80211_eht_mcs_nss_supp_20mhz_only		only_20mhz;
947 		struct {
948 			struct ieee80211_eht_mcs_nss_supp_bw		_80;
949 			struct ieee80211_eht_mcs_nss_supp_bw		_160;
950 			struct ieee80211_eht_mcs_nss_supp_bw		_320;
951 		} bw;
952 	};
953 };
954 
955 #define	IEEE80211_STA_EHT_PPE_THRES_MAX		32
956 struct ieee80211_sta_eht_cap {
957 	bool					has_eht;
958 	struct ieee80211_eht_cap_elem_fixed	eht_cap_elem;
959 	struct ieee80211_eht_mcs_nss_supp	eht_mcs_nss_supp;
960 	uint8_t					eht_ppe_thres[IEEE80211_STA_EHT_PPE_THRES_MAX];
961 };
962 
963 struct ieee80211_sband_iftype_data {
964 	/* TODO FIXME */
965 	enum nl80211_iftype			types_mask;
966 	struct ieee80211_sta_he_cap		he_cap;
967 	struct ieee80211_sta_he_6ghz_capa	he_6ghz_capa;
968 	struct ieee80211_sta_eht_cap		eht_cap;
969 	struct {
970 		const uint8_t			*data;
971 		size_t				len;
972 	} vendor_elems;
973 };
974 
975 struct ieee80211_supported_band {
976 	/* TODO FIXME */
977 	struct linuxkpi_ieee80211_channel	*channels;
978 	struct ieee80211_rate			*bitrates;
979 	struct ieee80211_sband_iftype_data	*iftype_data;
980 	int					n_channels;
981 	int					n_bitrates;
982 	int					n_iftype_data;
983 	enum nl80211_band			band;
984 	struct ieee80211_sta_ht_cap		ht_cap;
985 	struct ieee80211_sta_vht_cap		vht_cap;
986 };
987 
988 struct cfg80211_pkt_pattern {
989 	/* XXX TODO */
990 	uint8_t					*mask;
991 	uint8_t					*pattern;
992 	int					pattern_len;
993 	int					pkt_offset;
994 };
995 
996 struct cfg80211_wowlan_nd_match {
997 	/* XXX TODO */
998 	struct cfg80211_ssid		ssid;
999 	int				n_channels;
1000 	uint32_t			channels[0];	/* freq! = ieee80211_channel_to_frequency() */
1001 };
1002 
1003 struct cfg80211_wowlan_nd_info {
1004 	/* XXX TODO */
1005 	int				n_matches;
1006 	struct cfg80211_wowlan_nd_match	*matches[0];
1007 };
1008 
1009 enum wiphy_wowlan_support_flags {
1010 	WIPHY_WOWLAN_DISCONNECT,
1011 	WIPHY_WOWLAN_GTK_REKEY_FAILURE,
1012 	WIPHY_WOWLAN_MAGIC_PKT,
1013 	WIPHY_WOWLAN_SUPPORTS_GTK_REKEY,
1014 	WIPHY_WOWLAN_NET_DETECT,
1015 };
1016 
1017 struct wiphy_wowlan_support {
1018 	/* XXX TODO */
1019 	enum wiphy_wowlan_support_flags		flags;
1020 	int	max_nd_match_sets, max_pkt_offset, n_patterns, pattern_max_len, pattern_min_len;
1021 };
1022 
1023 struct cfg80211_wowlan_wakeup {
1024 	/* XXX TODO */
1025 	uint16_t				pattern_idx;
1026 	bool					disconnect;
1027 	bool					eap_identity_req;
1028 	bool					four_way_handshake;
1029 	bool					gtk_rekey_failure;
1030 	bool					magic_pkt;
1031 	bool					rfkill_release;
1032 	bool					tcp_connlost;
1033 	bool					tcp_nomoretokens;
1034 	bool					tcp_match;
1035 	bool					packet_80211;
1036 	struct cfg80211_wowlan_nd_info		*net_detect;
1037 	uint8_t					*packet;
1038 	uint16_t				packet_len;
1039 	uint16_t				packet_present_len;
1040 };
1041 
1042 struct cfg80211_wowlan {
1043 	/* XXX TODO */
1044 	int	disconnect, gtk_rekey_failure, magic_pkt;
1045 	int	eap_identity_req, four_way_handshake, rfkill_release, tcp, any;
1046 	int					n_patterns;
1047 	struct cfg80211_sched_scan_request	*nd_config;
1048 	struct cfg80211_pkt_pattern		*patterns;
1049 };
1050 
1051 struct cfg80211_gtk_rekey_data {
1052 	/* XXX TODO */
1053 	const uint8_t				*kck, *kek, *replay_ctr;
1054 	uint32_t				akm;
1055 	uint8_t					kck_len, kek_len;
1056 };
1057 
1058 struct cfg80211_tid_cfg {
1059 	/* XXX TODO */
1060 	int	mask, noack, retry_long, rtscts, tids, amsdu, ampdu;
1061 	enum nl80211_tx_rate_setting		txrate_type;
1062 	struct cfg80211_bitrate_mask		txrate_mask;
1063 };
1064 
1065 struct cfg80211_tid_config {
1066 	/* XXX TODO */
1067 	int	n_tid_conf;
1068 	struct cfg80211_tid_cfg			tid_conf[0];
1069 };
1070 
1071 struct ieee80211_iface_limit {
1072 	/* TODO FIXME */
1073 	int		max, types;
1074 };
1075 
1076 struct ieee80211_iface_combination {
1077 	/* TODO FIXME */
1078 	const struct ieee80211_iface_limit	*limits;
1079 	int					n_limits;
1080 	int		max_interfaces, num_different_channels;
1081 	int		beacon_int_infra_match, beacon_int_min_gcd;
1082 	int		radar_detect_widths;
1083 };
1084 
1085 struct iface_combination_params {
1086 	int num_different_channels;
1087 	int iftype_num[NUM_NL80211_IFTYPES];
1088 };
1089 
1090 struct regulatory_request {
1091 		/* XXX TODO */
1092 	uint8_t					alpha2[2];
1093 	enum environment_cap			country_ie_env;
1094 	int	initiator, dfs_region;
1095 	int	user_reg_hint_type;
1096 };
1097 
1098 struct cfg80211_set_hw_timestamp {
1099 	const uint8_t				*macaddr;
1100 	bool					enable;
1101 };
1102 
1103 enum wiphy_vendor_cmd_need_flags {
1104 	WIPHY_VENDOR_CMD_NEED_NETDEV		= 0x01,
1105 	WIPHY_VENDOR_CMD_NEED_RUNNING		= 0x02,
1106 	WIPHY_VENDOR_CMD_NEED_WDEV		= 0x04,
1107 };
1108 
1109 struct wiphy_vendor_command {
1110 	struct {
1111 		uint32_t	vendor_id;
1112 		uint32_t	subcmd;
1113 	};
1114 	uint32_t		flags;
1115 	void			*policy;
1116 	int (*doit)(struct wiphy *, struct wireless_dev *, const void *, int);
1117 };
1118 
1119 struct wiphy_iftype_ext_capab {
1120 	/* TODO FIXME */
1121 	enum nl80211_iftype			iftype;
1122 	const uint8_t				*extended_capabilities;
1123 	const uint8_t				*extended_capabilities_mask;
1124 	uint8_t					extended_capabilities_len;
1125 	uint16_t				eml_capabilities;
1126 	uint16_t				mld_capa_and_ops;
1127 };
1128 
1129 struct tid_config_support {
1130 	/* TODO FIXME */
1131 	uint64_t				vif;	/* enum nl80211_tid_cfg_attr */
1132 	uint64_t		 		peer;	/* enum nl80211_tid_cfg_attr */
1133 };
1134 
1135 enum cfg80211_regulatory {
1136 	REGULATORY_CUSTOM_REG			= BIT(0),
1137 	REGULATORY_STRICT_REG			= BIT(1),
1138 	REGULATORY_DISABLE_BEACON_HINTS		= BIT(2),
1139 	REGULATORY_ENABLE_RELAX_NO_IR		= BIT(3),
1140 	REGULATORY_WIPHY_SELF_MANAGED		= BIT(4),
1141 	REGULATORY_COUNTRY_IE_IGNORE		= BIT(5),
1142 	REGULATORY_COUNTRY_IE_FOLLOW_POWER	= BIT(6),
1143 };
1144 
1145 enum wiphy_flags {
1146 	WIPHY_FLAG_AP_UAPSD			= BIT(0),
1147 	WIPHY_FLAG_HAS_CHANNEL_SWITCH		= BIT(1),
1148 	WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL	= BIT(2),
1149 	WIPHY_FLAG_HAVE_AP_SME			= BIT(3),
1150 	WIPHY_FLAG_IBSS_RSN			= BIT(4),
1151 	WIPHY_FLAG_NETNS_OK			= BIT(5),
1152 	WIPHY_FLAG_OFFCHAN_TX			= BIT(6),
1153 	WIPHY_FLAG_PS_ON_BY_DEFAULT		= BIT(7),
1154 	WIPHY_FLAG_SPLIT_SCAN_6GHZ		= BIT(8),
1155 	WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK		= BIT(9),
1156 	WIPHY_FLAG_SUPPORTS_FW_ROAM		= BIT(10),
1157 	WIPHY_FLAG_SUPPORTS_TDLS		= BIT(11),
1158 	WIPHY_FLAG_TDLS_EXTERNAL_SETUP		= BIT(12),
1159 	WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD	= BIT(13),
1160 	WIPHY_FLAG_4ADDR_AP			= BIT(14),
1161 	WIPHY_FLAG_4ADDR_STATION		= BIT(15),
1162 	WIPHY_FLAG_SUPPORTS_MLO			= BIT(16),
1163 	WIPHY_FLAG_DISABLE_WEXT			= BIT(17),
1164 };
1165 
1166 struct wiphy_work;
1167 typedef void (*wiphy_work_fn)(struct wiphy *, struct wiphy_work *);
1168 struct wiphy_work {
1169 	struct list_head			entry;
1170 	wiphy_work_fn				fn;
1171 };
1172 struct wiphy_delayed_work {
1173 	struct wiphy_work			work;
1174 	struct wiphy				*wiphy;
1175 	struct timer_list			timer;
1176 };
1177 
1178 struct wiphy {
1179 	struct mutex				mtx;
1180 	struct device				*dev;
1181 	struct mac_address			*addresses;
1182 	int					n_addresses;
1183 	uint32_t				flags;
1184 	struct ieee80211_supported_band		*bands[NUM_NL80211_BANDS];
1185 	uint8_t					perm_addr[ETH_ALEN];
1186 	uint16_t				max_scan_ie_len;
1187 
1188 	/* XXX TODO */
1189 	const struct cfg80211_pmsr_capabilities	*pmsr_capa;
1190 	const struct cfg80211_sar_capa		*sar_capa;
1191 	const struct wiphy_iftype_ext_capab	*iftype_ext_capab;
1192 	const struct linuxkpi_ieee80211_regdomain *regd;
1193 	char					fw_version[ETHTOOL_FWVERS_LEN];
1194 	const struct ieee80211_iface_combination *iface_combinations;
1195 	const uint32_t				*cipher_suites;
1196 	int					n_iface_combinations;
1197 	int					n_cipher_suites;
1198 	void(*reg_notifier)(struct wiphy *, struct regulatory_request *);
1199 	enum cfg80211_regulatory		regulatory_flags;
1200 	int					n_vendor_commands;
1201 	const struct wiphy_vendor_command	*vendor_commands;
1202 	const struct ieee80211_txrx_stypes	*mgmt_stypes;
1203 	uint32_t				rts_threshold;
1204 	uint32_t				frag_threshold;
1205 	struct tid_config_support		tid_config_support;
1206 	uint8_t					available_antennas_rx;
1207 	uint8_t					available_antennas_tx;
1208 
1209 	int	features, hw_version;
1210 	int	interface_modes, max_match_sets, max_remain_on_channel_duration, 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;
1211 	int	num_iftype_ext_capab;
1212 	int	max_ap_assoc_sta, probe_resp_offload, software_iftypes;
1213 	int     bss_select_support, max_num_pmkids, retry_long, retry_short, signal_type;
1214 	int	max_data_retry_count;
1215 	int     tx_queue_len, rfkill;
1216 	int	mbssid_max_interfaces;
1217 	int	hw_timestamp_max_peers;
1218 	int	ema_max_profile_periodicity;
1219 
1220 	unsigned long				ext_features[BITS_TO_LONGS(NUM_NL80211_EXT_FEATURES)];
1221 	struct dentry				*debugfsdir;
1222 	struct cfg80211_wowlan_support		*wowlan;
1223 	/* Lower layer (driver/mac80211) specific data. */
1224 	/* Must stay last. */
1225 	uint8_t					priv[0] __aligned(CACHE_LINE_SIZE);
1226 };
1227 
1228 #define	lockdep_assert_wiphy(wiphy)					\
1229     lockdep_assert_held(&(wiphy)->mtx)
1230 
1231 struct wireless_dev {
1232 		/* XXX TODO, like ic? */
1233 	int		iftype;
1234 	int     address;
1235 	struct net_device			*netdev;
1236 	struct wiphy				*wiphy;
1237 };
1238 
1239 struct cfg80211_ops {
1240 	/* XXX TODO */
1241 	struct wireless_dev *(*add_virtual_intf)(struct wiphy *, const char *, unsigned char, enum nl80211_iftype, struct vif_params *);
1242 	int (*del_virtual_intf)(struct wiphy *,  struct wireless_dev *);
1243 	s32 (*change_virtual_intf)(struct wiphy *,  struct net_device *, enum nl80211_iftype, struct vif_params *);
1244 	s32 (*scan)(struct wiphy *,  struct cfg80211_scan_request *);
1245 	s32 (*set_wiphy_params)(struct wiphy *,  u32);
1246 	s32 (*join_ibss)(struct wiphy *,  struct net_device *, struct cfg80211_ibss_params *);
1247 	s32 (*leave_ibss)(struct wiphy *,  struct net_device *);
1248 	s32 (*get_station)(struct wiphy *, struct net_device *, const u8 *, struct station_info *);
1249 	int (*dump_station)(struct wiphy *,  struct net_device *, int,  u8 *,  struct station_info *);
1250 	s32 (*set_tx_power)(struct wiphy *,  struct wireless_dev *, enum nl80211_tx_power_setting,  s32);
1251 	s32 (*get_tx_power)(struct wiphy *,  struct wireless_dev *, s32 *);
1252 	s32 (*add_key)(struct wiphy *,  struct net_device *, u8,  bool,  const u8 *, struct key_params *);
1253 	s32 (*del_key)(struct wiphy *,  struct net_device *, u8,  bool,  const u8 *);
1254 	s32 (*get_key)(struct wiphy *,  struct net_device *,  u8, bool,  const u8 *,  void *, void(*)(void *, struct key_params *));
1255 	s32 (*set_default_key)(struct wiphy *,  struct net_device *, u8,  bool,  bool);
1256 	s32 (*set_default_mgmt_key)(struct wiphy *, struct net_device *,  u8);
1257 	s32 (*set_power_mgmt)(struct wiphy *,  struct net_device *, bool,  s32);
1258 	s32 (*connect)(struct wiphy *,  struct net_device *, struct cfg80211_connect_params *);
1259 	s32 (*disconnect)(struct wiphy *,  struct net_device *, u16);
1260 	s32 (*suspend)(struct wiphy *, struct cfg80211_wowlan *);
1261 	s32 (*resume)(struct wiphy *);
1262 	s32 (*set_pmksa)(struct wiphy *, struct net_device *, struct cfg80211_pmksa *);
1263 	s32 (*del_pmksa)(struct wiphy *, struct net_device *, struct cfg80211_pmksa *);
1264 	s32 (*flush_pmksa)(struct wiphy *,  struct net_device *);
1265 	s32 (*start_ap)(struct wiphy *,  struct net_device *, struct cfg80211_ap_settings *);
1266 	int (*stop_ap)(struct wiphy *,  struct net_device *);
1267 	s32 (*change_beacon)(struct wiphy *,  struct net_device *, struct cfg80211_beacon_data *);
1268 	int (*del_station)(struct wiphy *,  struct net_device *, struct station_del_parameters *);
1269 	int (*change_station)(struct wiphy *,  struct net_device *, const u8 *,  struct station_parameters *);
1270 	int (*sched_scan_start)(struct wiphy *, struct net_device *, struct cfg80211_sched_scan_request *);
1271 	int (*sched_scan_stop)(struct wiphy *, struct net_device *,  u64);
1272 	void (*update_mgmt_frame_registrations)(struct wiphy *, struct wireless_dev *, struct mgmt_frame_regs *);
1273 	int (*mgmt_tx)(struct wiphy *,  struct wireless_dev *, struct cfg80211_mgmt_tx_params *,  u64 *);
1274 	int (*cancel_remain_on_channel)(struct wiphy *, struct wireless_dev *, u64);
1275 	int (*get_channel)(struct wiphy *, struct wireless_dev *, struct cfg80211_chan_def *);
1276 	int (*crit_proto_start)(struct wiphy *, struct wireless_dev *, enum nl80211_crit_proto_id, u16);
1277 	void (*crit_proto_stop)(struct wiphy *, struct wireless_dev *);
1278 	int (*tdls_oper)(struct wiphy *, struct net_device *,  const u8 *, enum nl80211_tdls_operation);
1279 	int (*update_connect_params)(struct wiphy *, struct net_device *, struct cfg80211_connect_params *, u32);
1280 	int (*set_pmk)(struct wiphy *,  struct net_device *, const struct cfg80211_pmk_conf *);
1281 	int (*del_pmk)(struct wiphy *,  struct net_device *, const u8 *);
1282 	int (*remain_on_channel)(struct wiphy *,  struct wireless_dev *, struct linuxkpi_ieee80211_channel *, unsigned int,  u64 *);
1283 	int (*start_p2p_device)(struct wiphy *,  struct wireless_dev *);
1284 	void (*stop_p2p_device)(struct wiphy *,  struct wireless_dev *);
1285 };
1286 
1287 
1288 /* -------------------------------------------------------------------------- */
1289 
1290 /* linux_80211.c */
1291 
1292 struct wiphy *linuxkpi_wiphy_new(const struct cfg80211_ops *, size_t);
1293 void linuxkpi_wiphy_free(struct wiphy *wiphy);
1294 
1295 void linuxkpi_wiphy_work_queue(struct wiphy *, struct wiphy_work *);
1296 void linuxkpi_wiphy_work_cancel(struct wiphy *, struct wiphy_work *);
1297 void linuxkpi_wiphy_work_flush(struct wiphy *, struct wiphy_work *);
1298 void lkpi_wiphy_delayed_work_timer(struct timer_list *);
1299 void linuxkpi_wiphy_delayed_work_queue(struct wiphy *,
1300     struct wiphy_delayed_work *, unsigned long);
1301 void linuxkpi_wiphy_delayed_work_cancel(struct wiphy *,
1302     struct wiphy_delayed_work *);
1303 
1304 int linuxkpi_regulatory_set_wiphy_regd_sync(struct wiphy *wiphy,
1305     struct linuxkpi_ieee80211_regdomain *regd);
1306 uint32_t linuxkpi_ieee80211_channel_to_frequency(uint32_t, enum nl80211_band);
1307 uint32_t linuxkpi_ieee80211_frequency_to_channel(uint32_t, uint32_t);
1308 struct linuxkpi_ieee80211_channel *
1309     linuxkpi_ieee80211_get_channel(struct wiphy *, uint32_t);
1310 struct cfg80211_bss *linuxkpi_cfg80211_get_bss(struct wiphy *,
1311     struct linuxkpi_ieee80211_channel *, const uint8_t *,
1312     const uint8_t *, size_t, enum ieee80211_bss_type, enum ieee80211_privacy);
1313 void linuxkpi_cfg80211_put_bss(struct wiphy *, struct cfg80211_bss *);
1314 void linuxkpi_cfg80211_bss_flush(struct wiphy *);
1315 struct linuxkpi_ieee80211_regdomain *
1316     lkpi_get_linuxkpi_ieee80211_regdomain(size_t);
1317 
1318 /* -------------------------------------------------------------------------- */
1319 
1320 static __inline struct wiphy *
1321 wiphy_new(const struct cfg80211_ops *ops, size_t priv_len)
1322 {
1323 
1324 	return (linuxkpi_wiphy_new(ops, priv_len));
1325 }
1326 
1327 static __inline void
1328 wiphy_free(struct wiphy *wiphy)
1329 {
1330 
1331 	linuxkpi_wiphy_free(wiphy);
1332 }
1333 
1334 static __inline void *
1335 wiphy_priv(struct wiphy *wiphy)
1336 {
1337 
1338 	return (wiphy->priv);
1339 }
1340 
1341 static __inline void
1342 set_wiphy_dev(struct wiphy *wiphy, struct device *dev)
1343 {
1344 
1345 	wiphy->dev = dev;
1346 }
1347 
1348 static __inline struct device *
1349 wiphy_dev(struct wiphy *wiphy)
1350 {
1351 
1352 	return (wiphy->dev);
1353 }
1354 
1355 #define	wiphy_dereference(wiphy, p)					\
1356     rcu_dereference_check(p, lockdep_is_held(&(wiphy)->mtx))
1357 
1358 static __inline void
1359 wiphy_lock(struct wiphy *wiphy)
1360 {
1361 	TODO();
1362 }
1363 
1364 static __inline void
1365 wiphy_unlock(struct wiphy *wiphy)
1366 {
1367 	TODO();
1368 }
1369 
1370 static __inline void
1371 wiphy_rfkill_set_hw_state_reason(struct wiphy *wiphy, bool blocked,
1372     enum rfkill_hard_block_reasons reason)
1373 {
1374 	TODO();
1375 }
1376 
1377 /* -------------------------------------------------------------------------- */
1378 
1379 static inline struct cfg80211_bss *
1380 cfg80211_get_bss(struct wiphy *wiphy, struct linuxkpi_ieee80211_channel *chan,
1381     const uint8_t *bssid, const uint8_t *ssid, size_t ssid_len,
1382     enum ieee80211_bss_type bss_type, enum ieee80211_privacy privacy)
1383 {
1384 
1385 	return (linuxkpi_cfg80211_get_bss(wiphy, chan, bssid, ssid, ssid_len,
1386 	    bss_type, privacy));
1387 }
1388 
1389 static inline void
1390 cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss)
1391 {
1392 
1393 	linuxkpi_cfg80211_put_bss(wiphy, bss);
1394 }
1395 
1396 static inline void
1397 cfg80211_bss_flush(struct wiphy *wiphy)
1398 {
1399 
1400 	linuxkpi_cfg80211_bss_flush(wiphy);
1401 }
1402 
1403 /* -------------------------------------------------------------------------- */
1404 
1405 static __inline bool
1406 rfkill_blocked(int rfkill)		/* argument type? */
1407 {
1408 	TODO();
1409 	return (false);
1410 }
1411 
1412 static __inline bool
1413 rfkill_soft_blocked(int rfkill)
1414 {
1415 	TODO();
1416 	return (false);
1417 }
1418 
1419 static __inline int
1420 reg_query_regdb_wmm(uint8_t *alpha2, uint32_t center_freq,
1421     struct ieee80211_reg_rule *rule)
1422 {
1423 
1424 	/* ETSI has special rules. FreeBSD regdb needs to learn about them. */
1425 	TODO();
1426 
1427 	return (-ENXIO);
1428 }
1429 
1430 static __inline const u8 *
1431 cfg80211_find_ie_match(uint32_t f, const u8 *ies, size_t ies_len,
1432     const u8 *match, int x, int y)
1433 {
1434 	TODO();
1435 	return (NULL);
1436 }
1437 
1438 static __inline const u8 *
1439 cfg80211_find_ie(uint8_t eid, const uint8_t *ie, uint32_t ielen)
1440 {
1441 	TODO();
1442 	return (NULL);
1443 }
1444 
1445 static __inline void
1446 cfg80211_pmsr_complete(struct wireless_dev *wdev,
1447     struct cfg80211_pmsr_request *req, gfp_t gfp)
1448 {
1449 	TODO();
1450 }
1451 
1452 static __inline void
1453 cfg80211_pmsr_report(struct wireless_dev *wdev,
1454     struct cfg80211_pmsr_request *req,
1455     struct cfg80211_pmsr_result *result, gfp_t gfp)
1456 {
1457 	TODO();
1458 }
1459 
1460 static __inline void
1461 cfg80211_chandef_create(struct cfg80211_chan_def *chandef,
1462     struct linuxkpi_ieee80211_channel *chan, enum nl80211_chan_flags chan_flag)
1463 {
1464 
1465 	KASSERT(chandef != NULL, ("%s: chandef is NULL\n", __func__));
1466 	KASSERT(chan != NULL, ("%s: chan is NULL\n", __func__));
1467 
1468 	memset(chandef, 0, sizeof(*chandef));
1469 	chandef->chan = chan;
1470 	chandef->center_freq2 = 0;	/* Set here and only overwrite if needed. */
1471 
1472 	switch (chan_flag) {
1473 	case NL80211_CHAN_NO_HT:
1474 		chandef->width = NL80211_CHAN_WIDTH_20_NOHT;
1475 		chandef->center_freq1 = chan->center_freq;
1476 		break;
1477 	default:
1478 		IMPROVE("Also depends on our manual settings");
1479 		if (chan->flags & IEEE80211_CHAN_NO_HT40)
1480 			chandef->width = NL80211_CHAN_WIDTH_20;
1481 		else if (chan->flags & IEEE80211_CHAN_NO_80MHZ)
1482 			chandef->width = NL80211_CHAN_WIDTH_40;
1483 		else if (chan->flags & IEEE80211_CHAN_NO_160MHZ)
1484 			chandef->width = NL80211_CHAN_WIDTH_80;
1485 		else {
1486 			chandef->width = NL80211_CHAN_WIDTH_160;
1487 			IMPROVE("80P80 and 320 ...");
1488 		}
1489 		chandef->center_freq1 = chan->center_freq;
1490 		break;
1491 	};
1492 }
1493 
1494 static __inline void
1495 cfg80211_bss_iter(struct wiphy *wiphy, struct cfg80211_chan_def *chandef,
1496     void (*iterfunc)(struct wiphy *, struct cfg80211_bss *, void *), void *data)
1497 {
1498 	TODO();
1499 }
1500 
1501 struct element {
1502 	uint8_t					id;
1503 	uint8_t					datalen;
1504 	uint8_t					data[0];
1505 } __packed;
1506 
1507 static inline const struct element *
1508 lkpi_cfg80211_find_elem_pattern(enum ieee80211_eid eid,
1509     const uint8_t *data, size_t len, uint8_t *pattern, size_t plen)
1510 {
1511 	const struct element *elem;
1512 	const uint8_t *p;
1513 	size_t ielen;
1514 
1515 	p = data;
1516 	elem = (const struct element *)p;
1517 	ielen = len;
1518 	while (elem != NULL && ielen > 1) {
1519 		if ((2 + elem->datalen) > ielen)
1520 			/* Element overruns our memory. */
1521 			return (NULL);
1522 		if (elem->id == eid) {
1523 			if (pattern == NULL)
1524 				return (elem);
1525 			if (elem->datalen >= plen &&
1526 			    memcmp(elem->data, pattern, plen) == 0)
1527 				return (elem);
1528 		}
1529 		ielen -= 2 + elem->datalen;
1530 		p += 2 + elem->datalen;
1531 		elem = (const struct element *)p;
1532 	}
1533 
1534 	return (NULL);
1535 }
1536 
1537 static inline const struct element *
1538 cfg80211_find_elem(enum ieee80211_eid eid, const uint8_t *data, size_t len)
1539 {
1540 
1541 	return (lkpi_cfg80211_find_elem_pattern(eid, data, len, NULL, 0));
1542 }
1543 
1544 static inline const struct element *
1545 ieee80211_bss_get_elem(struct cfg80211_bss *bss, uint32_t eid)
1546 {
1547 
1548 	if (bss->ies == NULL)
1549 		return (NULL);
1550 	return (cfg80211_find_elem(eid, bss->ies->data, bss->ies->len));
1551 }
1552 
1553 static inline const uint8_t *
1554 ieee80211_bss_get_ie(struct cfg80211_bss *bss, uint32_t eid)
1555 {
1556 
1557 	return ((const uint8_t *)ieee80211_bss_get_elem(bss, eid));
1558 }
1559 
1560 static inline uint8_t *
1561 cfg80211_find_vendor_ie(unsigned int oui, int oui_type,
1562     uint8_t *data, size_t len)
1563 {
1564 	const struct element *elem;
1565 	uint8_t pattern[4] = { oui << 16, oui << 8, oui, oui_type };
1566 	uint8_t plen = 4;		/* >= 3? oui_type always part of this? */
1567 	IMPROVE("plen currently always incl. oui_type");
1568 
1569 	elem = lkpi_cfg80211_find_elem_pattern(IEEE80211_ELEMID_VENDOR,
1570 	    data, len, pattern, plen);
1571 	if (elem == NULL)
1572 		return (NULL);
1573 	return (__DECONST(uint8_t *, elem));
1574 }
1575 
1576 static __inline uint32_t
1577 cfg80211_calculate_bitrate(struct rate_info *rate)
1578 {
1579 	TODO();
1580 	return (-1);
1581 }
1582 
1583 static __inline uint32_t
1584 ieee80211_channel_to_frequency(uint32_t channel, enum nl80211_band band)
1585 {
1586 
1587 	return (linuxkpi_ieee80211_channel_to_frequency(channel, band));
1588 }
1589 
1590 static __inline uint32_t
1591 ieee80211_frequency_to_channel(uint32_t freq)
1592 {
1593 
1594 	return (linuxkpi_ieee80211_frequency_to_channel(freq, 0));
1595 }
1596 
1597 static __inline int
1598 regulatory_set_wiphy_regd_sync(struct wiphy *wiphy,
1599     struct linuxkpi_ieee80211_regdomain *regd)
1600 {
1601 	IMPROVE();
1602 	return (linuxkpi_regulatory_set_wiphy_regd_sync(wiphy, regd));
1603 }
1604 
1605 static __inline int
1606 regulatory_set_wiphy_regd_sync_rtnl(struct wiphy *wiphy,
1607     struct linuxkpi_ieee80211_regdomain *regd)
1608 {
1609 
1610 	IMPROVE();
1611 	return (linuxkpi_regulatory_set_wiphy_regd_sync(wiphy, regd));
1612 }
1613 
1614 static __inline int
1615 regulatory_set_wiphy_regd(struct wiphy *wiphy,
1616     struct linuxkpi_ieee80211_regdomain *regd)
1617 {
1618 
1619 	IMPROVE();
1620 	if (regd == NULL)
1621 		return (EINVAL);
1622 
1623 	/* XXX-BZ wild guessing here based on brcmfmac. */
1624 	if (wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED)
1625 		wiphy->regd = regd;
1626 	else
1627 		return (EPERM);
1628 
1629 	/* XXX FIXME, do we have to do anything with reg_notifier? */
1630 	return (0);
1631 }
1632 
1633 static __inline int
1634 regulatory_hint(struct wiphy *wiphy, const uint8_t *alpha2)
1635 {
1636 	struct linuxkpi_ieee80211_regdomain *regd;
1637 
1638 	if (wiphy->regd != NULL)
1639 		return (-EBUSY);
1640 
1641 	regd = lkpi_get_linuxkpi_ieee80211_regdomain(0);
1642 	if (regd == NULL)
1643 		return (-ENOMEM);
1644 
1645 	regd->alpha2[0] = alpha2[0];
1646 	regd->alpha2[1] = alpha2[1];
1647 	wiphy->regd = regd;
1648 
1649 	IMPROVE("are there flags who is managing? update net8011?");
1650 
1651 	return (0);
1652 }
1653 
1654 static __inline const char *
1655 reg_initiator_name(enum nl80211_reg_initiator initiator)
1656 {
1657 	TODO();
1658 	return (NULL);
1659 }
1660 
1661 static __inline struct linuxkpi_ieee80211_regdomain *
1662 rtnl_dereference(const struct linuxkpi_ieee80211_regdomain *regd)
1663 {
1664 	TODO();
1665 	return (NULL);
1666 }
1667 
1668 static __inline struct ieee80211_reg_rule *
1669 freq_reg_info(struct wiphy *wiphy, uint32_t center_freq)
1670 {
1671 	TODO();
1672 	return (NULL);
1673 }
1674 
1675 static __inline void
1676 wiphy_apply_custom_regulatory(struct wiphy *wiphy,
1677     const struct linuxkpi_ieee80211_regdomain *regd)
1678 {
1679 	TODO();
1680 }
1681 
1682 static __inline char *
1683 wiphy_name(struct wiphy *wiphy)
1684 {
1685 	if (wiphy != NULL && wiphy->dev != NULL)
1686 		return dev_name(wiphy->dev);
1687 	else {
1688 		IMPROVE("wlanNA");
1689 		return ("wlanNA");
1690 	}
1691 }
1692 
1693 static __inline void
1694 wiphy_read_of_freq_limits(struct wiphy *wiphy)
1695 {
1696 #ifdef FDT
1697 	TODO();
1698 #endif
1699 }
1700 
1701 static __inline void
1702 wiphy_ext_feature_set(struct wiphy *wiphy, enum nl80211_ext_feature ef)
1703 {
1704 
1705 	set_bit(ef, wiphy->ext_features);
1706 }
1707 
1708 static inline bool
1709 wiphy_ext_feature_isset(struct wiphy *wiphy, enum nl80211_ext_feature ef)
1710 {
1711 	return (test_bit(ef, wiphy->ext_features));
1712 }
1713 
1714 static __inline void *
1715 wiphy_net(struct wiphy *wiphy)
1716 {
1717 	TODO();
1718 	return (NULL);	/* XXX passed to dev_net_set() */
1719 }
1720 
1721 static __inline int
1722 wiphy_register(struct wiphy *wiphy)
1723 {
1724 	TODO();
1725 	return (0);
1726 }
1727 
1728 static __inline void
1729 wiphy_unregister(struct wiphy *wiphy)
1730 {
1731 	TODO();
1732 }
1733 
1734 static __inline void
1735 wiphy_warn(struct wiphy *wiphy, const char *fmt, ...)
1736 {
1737 	TODO();
1738 }
1739 
1740 static __inline int
1741 cfg80211_check_combinations(struct wiphy *wiphy,
1742     struct iface_combination_params *params)
1743 {
1744 	TODO();
1745 	return (-ENOENT);
1746 }
1747 
1748 static __inline uint8_t
1749 cfg80211_classify8021d(struct sk_buff *skb, void *p)
1750 {
1751 	TODO();
1752 	return (0);
1753 }
1754 
1755 static __inline void
1756 cfg80211_connect_done(struct net_device *ndev,
1757     struct cfg80211_connect_resp_params *conn_params, gfp_t gfp)
1758 {
1759 	TODO();
1760 }
1761 
1762 static __inline void
1763 cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp)
1764 {
1765 	TODO();
1766 }
1767 
1768 static __inline void
1769 cfg80211_disconnected(struct net_device *ndev, uint16_t reason,
1770     void *p, int x, bool locally_generated, gfp_t gfp)
1771 {
1772 	TODO();
1773 }
1774 
1775 static __inline int
1776 cfg80211_get_p2p_attr(const u8 *ie, u32 ie_len,
1777     enum ieee80211_p2p_attr_ids attr, u8 *p, size_t p_len)
1778 {
1779 	TODO();
1780 	return (-1);
1781 }
1782 
1783 static __inline void
1784 cfg80211_ibss_joined(struct net_device *ndev, const uint8_t *addr,
1785     struct linuxkpi_ieee80211_channel *chan, gfp_t gfp)
1786 {
1787 	TODO();
1788 }
1789 
1790 static __inline struct cfg80211_bss *
1791 cfg80211_inform_bss(struct wiphy *wiphy,
1792     struct linuxkpi_ieee80211_channel *channel,
1793     enum cfg80211_bss_frame_type bss_ftype, const uint8_t *bss, int _x,
1794     uint16_t cap, uint16_t intvl, const uint8_t *ie, size_t ie_len,
1795     int signal, gfp_t gfp)
1796 {
1797 	TODO();
1798 	return (NULL);
1799 }
1800 
1801 static __inline struct cfg80211_bss *
1802 cfg80211_inform_bss_data(struct wiphy *wiphy,
1803     struct cfg80211_inform_bss *bss_data,
1804     enum cfg80211_bss_frame_type bss_ftype, const uint8_t *bss, int _x,
1805     uint16_t cap, uint16_t intvl, const uint8_t *ie, size_t ie_len, gfp_t gfp)
1806 {
1807 	TODO();
1808 	return (NULL);
1809 }
1810 
1811 static __inline void
1812 cfg80211_mgmt_tx_status(struct wireless_dev *wdev, uint64_t cookie,
1813     const u8 *buf, size_t len, bool ack, gfp_t gfp)
1814 {
1815 	TODO();
1816 }
1817 
1818 static __inline void
1819 cfg80211_michael_mic_failure(struct net_device *ndev, const uint8_t *addr,
1820     enum nl80211_key_type key_type, int _x, void *p, gfp_t gfp)
1821 {
1822 	TODO();
1823 }
1824 
1825 static __inline void
1826 cfg80211_new_sta(struct net_device *ndev, const uint8_t *addr,
1827     struct station_info *sinfo, gfp_t gfp)
1828 {
1829 	TODO();
1830 }
1831 
1832 static __inline void
1833 cfg80211_del_sta(struct net_device *ndev, const uint8_t *addr, gfp_t gfp)
1834 {
1835 	TODO();
1836 }
1837 
1838 static __inline void
1839 cfg80211_port_authorized(struct net_device *ndev, const uint8_t *bssid,
1840     gfp_t gfp)
1841 {
1842 	TODO();
1843 }
1844 
1845 static __inline void
1846 cfg80211_ready_on_channel(struct wireless_dev *wdev, uint64_t cookie,
1847     struct linuxkpi_ieee80211_channel *channel, unsigned int duration,
1848     gfp_t gfp)
1849 {
1850 	TODO();
1851 }
1852 
1853 static __inline void
1854 cfg80211_remain_on_channel_expired(struct wireless_dev *wdev,
1855     uint64_t cookie, struct linuxkpi_ieee80211_channel *channel, gfp_t gfp)
1856 {
1857 	TODO();
1858 }
1859 
1860 static __inline void
1861 cfg80211_report_wowlan_wakeup(void)
1862 {
1863 	TODO();
1864 }
1865 
1866 static __inline void
1867 cfg80211_roamed(struct net_device *ndev, struct cfg80211_roam_info *roam_info,
1868     gfp_t gfp)
1869 {
1870 	TODO();
1871 }
1872 
1873 static __inline void
1874 cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int _x,
1875     uint8_t *p, size_t p_len, int _x2)
1876 {
1877 	TODO();
1878 }
1879 
1880 static __inline void
1881 cfg80211_scan_done(struct cfg80211_scan_request *scan_request,
1882     struct cfg80211_scan_info *info)
1883 {
1884 	TODO();
1885 }
1886 
1887 static __inline void
1888 cfg80211_sched_scan_results(struct wiphy *wiphy, uint64_t reqid)
1889 {
1890 	TODO();
1891 }
1892 
1893 static __inline void
1894 cfg80211_sched_scan_stopped(struct wiphy *wiphy, int _x)
1895 {
1896 	TODO();
1897 }
1898 
1899 static __inline void
1900 cfg80211_unregister_wdev(struct wireless_dev *wdev)
1901 {
1902 	TODO();
1903 }
1904 
1905 static __inline struct sk_buff *
1906 cfg80211_vendor_cmd_alloc_reply_skb(struct wiphy *wiphy, unsigned int len)
1907 {
1908 	TODO();
1909 	return (NULL);
1910 }
1911 
1912 static __inline int
1913 cfg80211_vendor_cmd_reply(struct sk_buff *skb)
1914 {
1915 	TODO();
1916 	return (-ENXIO);
1917 }
1918 
1919 static __inline struct linuxkpi_ieee80211_channel *
1920 ieee80211_get_channel(struct wiphy *wiphy, uint32_t freq)
1921 {
1922 
1923 	return (linuxkpi_ieee80211_get_channel(wiphy, freq));
1924 }
1925 
1926 static inline size_t
1927 ieee80211_get_hdrlen_from_skb(struct sk_buff *skb)
1928 {
1929 	const struct ieee80211_hdr *hdr;
1930 	size_t len;
1931 
1932 	if (skb->len < 10)	/* sizeof(ieee80211_frame_[ack,cts]) */
1933 		return (0);
1934 
1935 	hdr = (const struct ieee80211_hdr *)skb->data;
1936 	len = ieee80211_hdrlen(hdr->frame_control);
1937 
1938 	/* If larger than what is in the skb return. */
1939 	if (len > skb->len)
1940 		return (0);
1941 
1942 	return (len);
1943 }
1944 
1945 static __inline bool
1946 cfg80211_channel_is_psc(struct linuxkpi_ieee80211_channel *channel)
1947 {
1948 
1949 	/* Only 6Ghz. */
1950 	if (channel->band != NL80211_BAND_6GHZ)
1951 		return (false);
1952 
1953 	TODO();
1954 	return (false);
1955 }
1956 
1957 static inline int
1958 cfg80211_get_ies_channel_number(const uint8_t *ie, size_t len,
1959     enum nl80211_band band, enum cfg80211_bss_frame_type ftype)
1960 {
1961 	const struct element *elem;
1962 
1963 	switch (band) {
1964 	case NL80211_BAND_6GHZ:
1965 		TODO();
1966 		break;
1967 	case NL80211_BAND_5GHZ:
1968 	case NL80211_BAND_2GHZ:
1969 		/* DSPARAMS has the channel number. */
1970 		elem = cfg80211_find_elem(IEEE80211_ELEMID_DSPARMS, ie, len);
1971 		if (elem != NULL && elem->datalen == 1)
1972 			return (elem->data[0]);
1973 		/* HTINFO has the primary center channel. */
1974 		elem = cfg80211_find_elem(IEEE80211_ELEMID_HTINFO, ie, len);
1975 		if (elem != NULL &&
1976 		    elem->datalen >= (sizeof(struct ieee80211_ie_htinfo) - 2)) {
1977 			const struct ieee80211_ie_htinfo *htinfo;
1978 			htinfo = (const struct ieee80211_ie_htinfo *)elem;
1979 			return (htinfo->hi_ctrlchannel);
1980 		}
1981 		/* What else? */
1982 		break;
1983 	default:
1984 		IMPROVE("Unsupported");
1985 		break;
1986 	}
1987 	return (-1);
1988 }
1989 
1990 /* Used for scanning at least. */
1991 static __inline void
1992 get_random_mask_addr(uint8_t *dst, const uint8_t *addr, const uint8_t *mask)
1993 {
1994 	int i;
1995 
1996 	/* Get a completely random address and then overlay what we want. */
1997 	get_random_bytes(dst, ETH_ALEN);
1998 	for (i = 0; i < ETH_ALEN; i++)
1999 		dst[i] = (dst[i] & ~(mask[i])) | (addr[i] & mask[i]);
2000 }
2001 
2002 static __inline void
2003 cfg80211_shutdown_all_interfaces(struct wiphy *wiphy)
2004 {
2005 	TODO();
2006 }
2007 
2008 static __inline bool
2009 cfg80211_reg_can_beacon(struct wiphy *wiphy, struct cfg80211_chan_def *chandef,
2010     enum nl80211_iftype iftype)
2011 {
2012 	TODO();
2013 	return (false);
2014 }
2015 
2016 static __inline void
2017 cfg80211_background_radar_event(struct wiphy *wiphy,
2018     struct cfg80211_chan_def *chandef, gfp_t gfp)
2019 {
2020 	TODO();
2021 }
2022 
2023 static __inline const u8 *
2024 cfg80211_find_ext_ie(uint8_t eid, const uint8_t *p, size_t len)
2025 {
2026 	TODO();
2027 	return (NULL);
2028 }
2029 
2030 static __inline bool
2031 cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef)
2032 {
2033 	TODO();
2034 	return (false);
2035 }
2036 
2037 static __inline bool
2038 cfg80211_chandef_dfs_usable(struct wiphy *wiphy, const struct cfg80211_chan_def *chandef)
2039 {
2040 	TODO();
2041 	return (false);
2042 }
2043 
2044 static __inline unsigned int
2045 cfg80211_chandef_dfs_cac_time(struct wiphy *wiphy, const struct cfg80211_chan_def *chandef)
2046 {
2047 	TODO();
2048 	return (0);
2049 }
2050 
2051 static inline void
2052 _ieee80211_set_sband_iftype_data(struct ieee80211_supported_band *band,
2053     struct ieee80211_sband_iftype_data *iftype_data, size_t nitems)
2054 {
2055 	band->iftype_data = iftype_data;
2056 	band->n_iftype_data = nitems;
2057 }
2058 
2059 static inline const struct ieee80211_sband_iftype_data *
2060 ieee80211_get_sband_iftype_data(const struct ieee80211_supported_band *band,
2061     enum nl80211_iftype iftype)
2062 {
2063 	const struct ieee80211_sband_iftype_data *iftype_data;
2064 	int i;
2065 
2066 	for (i = 0; i < band->n_iftype_data; i++) {
2067 		iftype_data = (const void *)&band->iftype_data[i];
2068 		if (iftype_data->types_mask & BIT(iftype))
2069 			return (iftype_data);
2070 	}
2071 
2072 	return (NULL);
2073 }
2074 
2075 static __inline const struct ieee80211_sta_eht_cap *
2076 ieee80211_get_eht_iftype_cap(const struct ieee80211_supported_band *band,
2077     enum nl80211_iftype iftype)
2078 {
2079 	TODO();
2080 	return (NULL);
2081 }
2082 
2083 static inline bool
2084 cfg80211_ssid_eq(struct cfg80211_ssid *ssid1, struct cfg80211_ssid *ssid2)
2085 {
2086 	int error;
2087 
2088 	if (ssid1 == NULL || ssid2 == NULL)	/* Can we KASSERT this? */
2089 		return (false);
2090 
2091 	if (ssid1->ssid_len != ssid2->ssid_len)
2092 		return (false);
2093 	error = memcmp(ssid1->ssid, ssid2->ssid, ssid2->ssid_len);
2094 	if (error != 0)
2095 		return (false);
2096 	return (true);
2097 }
2098 
2099 static inline void
2100 cfg80211_rx_unprot_mlme_mgmt(struct net_device *ndev, const uint8_t *hdr,
2101     uint32_t len)
2102 {
2103 	TODO();
2104 }
2105 
2106 static inline const struct wiphy_iftype_ext_capab *
2107 cfg80211_get_iftype_ext_capa(struct wiphy *wiphy, enum nl80211_iftype iftype)
2108 {
2109 
2110 	TODO();
2111 	return (NULL);
2112 }
2113 
2114 static inline int
2115 nl80211_chan_width_to_mhz(enum nl80211_chan_width width)
2116 {
2117 	switch (width) {
2118 	case NL80211_CHAN_WIDTH_5:
2119 		return (5);
2120 		break;
2121 	case NL80211_CHAN_WIDTH_10:
2122 		return (10);
2123 		break;
2124 	case NL80211_CHAN_WIDTH_20_NOHT:
2125 	case NL80211_CHAN_WIDTH_20:
2126 		return (20);
2127 		break;
2128 	case NL80211_CHAN_WIDTH_40:
2129 		return (40);
2130 		break;
2131 	case NL80211_CHAN_WIDTH_80:
2132 	case NL80211_CHAN_WIDTH_80P80:
2133 		return (80);
2134 		break;
2135 	case NL80211_CHAN_WIDTH_160:
2136 		return (160);
2137 		break;
2138 	case NL80211_CHAN_WIDTH_320:
2139 		return (320);
2140 		break;
2141 	}
2142 }
2143 
2144 /* -------------------------------------------------------------------------- */
2145 
2146 static inline void
2147 wiphy_work_init(struct wiphy_work *wwk, wiphy_work_fn fn)
2148 {
2149 	INIT_LIST_HEAD(&wwk->entry);
2150 	wwk->fn = fn;
2151 }
2152 
2153 static inline void
2154 wiphy_work_queue(struct wiphy *wiphy, struct wiphy_work *wwk)
2155 {
2156 	linuxkpi_wiphy_work_queue(wiphy, wwk);
2157 }
2158 
2159 static inline void
2160 wiphy_work_cancel(struct wiphy *wiphy, struct wiphy_work *wwk)
2161 {
2162 	linuxkpi_wiphy_work_cancel(wiphy, wwk);
2163 }
2164 
2165 static inline void
2166 wiphy_work_flush(struct wiphy *wiphy, struct wiphy_work *wwk)
2167 {
2168 	linuxkpi_wiphy_work_flush(wiphy, wwk);
2169 }
2170 
2171 static inline void
2172 wiphy_delayed_work_init(struct wiphy_delayed_work *wdwk, wiphy_work_fn fn)
2173 {
2174 	wiphy_work_init(&wdwk->work, fn);
2175 	timer_setup(&wdwk->timer, lkpi_wiphy_delayed_work_timer, 0);
2176 }
2177 
2178 static inline void
2179 wiphy_delayed_work_queue(struct wiphy *wiphy, struct wiphy_delayed_work *wdwk,
2180     unsigned long delay)
2181 {
2182 	linuxkpi_wiphy_delayed_work_queue(wiphy, wdwk, delay);
2183 }
2184 
2185 static inline void
2186 wiphy_delayed_work_cancel(struct wiphy *wiphy, struct wiphy_delayed_work *wdwk)
2187 {
2188 	linuxkpi_wiphy_delayed_work_cancel(wiphy, wdwk);
2189 }
2190 
2191 /* -------------------------------------------------------------------------- */
2192 
2193 #define	wiphy_err(_wiphy, _fmt, ...)					\
2194     dev_err((_wiphy)->dev, _fmt, __VA_ARGS__)
2195 #define	wiphy_info(wiphy, fmt, ...)					\
2196     dev_info(&(wiphy)->dev, fmt, ##__VA_ARGS__)
2197 #define	wiphy_info_once(wiphy, fmt, ...)				\
2198     dev_info_once(&(wiphy)->dev, fmt, ##__VA_ARGS__)
2199 
2200 #ifndef LINUXKPI_NET80211
2201 #define	ieee80211_channel		linuxkpi_ieee80211_channel
2202 #define	ieee80211_regdomain		linuxkpi_ieee80211_regdomain
2203 #endif
2204 
2205 #include <net/mac80211.h>
2206 
2207 #endif	/* _LINUXKPI_NET_CFG80211_H */
2208