1 /*-
2  * Copyright (c) 2020-2021 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  * $FreeBSD$
30  */
31 
32 #ifndef	_LINUXKPI_NET_CFG80211_H
33 #define	_LINUXKPI_NET_CFG80211_H
34 
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>
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(...)		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__)
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_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),
79 	/* Max 8 bits as used in struct rate_info. */
80 };
81 
82 extern const uint8_t rfc1042_header[6];
83 extern const uint8_t bridge_tunnel_header[6];
84 
85 enum ieee80211_privacy {
86 	IEEE80211_PRIVACY_ANY,
87 };
88 
89 enum ieee80211_bss_type {
90 	IEEE80211_BSS_TYPE_ANY,
91 };
92 
93 enum cfg80211_bss_frame_type {
94 	CFG80211_BSS_FTYPE_UNKNOWN,
95 	CFG80211_BSS_FTYPE_BEACON,
96 	CFG80211_BSS_FTYPE_PRESP,
97 };
98 
99 enum ieee80211_channel_flags {
100 	IEEE80211_CHAN_DISABLED			= BIT(0),
101 	IEEE80211_CHAN_INDOOR_ONLY		= BIT(1),
102 	IEEE80211_CHAN_IR_CONCURRENT		= BIT(2),
103 	IEEE80211_CHAN_RADAR			= BIT(3),
104 	IEEE80211_CHAN_NO_IR			= BIT(4),
105 	IEEE80211_CHAN_NO_HT40MINUS		= BIT(5),
106 	IEEE80211_CHAN_NO_HT40PLUS		= BIT(6),
107 	IEEE80211_CHAN_NO_80MHZ			= BIT(7),
108 	IEEE80211_CHAN_NO_160MHZ		= BIT(8),
109 	IEEE80211_CHAN_NO_OFDM			= BIT(9),
110 };
111 #define	IEEE80211_CHAN_NO_HT40	(IEEE80211_CHAN_NO_HT40MINUS|IEEE80211_CHAN_NO_HT40PLUS)
112 
113 struct ieee80211_txrx_stypes {
114 	uint16_t	tx;
115 	uint16_t	rx;
116 };
117 
118 /* XXX net80211 has an ieee80211_channel as well. */
119 struct linuxkpi_ieee80211_channel {
120 	/* TODO FIXME */
121 	uint32_t				hw_value;	/* ic_ieee */
122 	uint32_t				center_freq;	/* ic_freq */
123 	enum ieee80211_channel_flags		flags;		/* ic_flags */
124 	enum nl80211_band			band;
125 	int8_t					max_power;	/* ic_maxpower */
126 	bool					beacon_found;
127 	int     max_antenna_gain, max_reg_power;
128 	int     orig_flags;
129 	int	dfs_cac_ms, dfs_state;
130 	int	orig_mpwr;
131 };
132 
133 struct cfg80211_bitrate_mask {
134 	/* TODO FIXME */
135 	struct {
136 		uint32_t			legacy;
137 		uint8_t				ht_mcs[IEEE80211_HT_MCS_MASK_LEN];
138 		uint16_t			vht_mcs[8];
139 		uint16_t			he_mcs[8];
140 		enum nl80211_txrate_gi		gi;
141 		enum nl80211_he_gi		he_gi;
142 		uint8_t				he_ltf;		/* XXX enum? */
143 	} control[NUM_NL80211_BANDS];
144 };
145 
146 enum rate_info_bw {
147 	RATE_INFO_BW_20		= 0,
148 	RATE_INFO_BW_5,
149 	RATE_INFO_BW_10,
150 	RATE_INFO_BW_40,
151 	RATE_INFO_BW_80,
152 	RATE_INFO_BW_160,
153 	RATE_INFO_BW_HE_RU,
154 };
155 
156 struct rate_info {
157 	uint8_t					flags;			/* enum cfg80211_rate_info_flags */
158 	uint8_t					bw;
159 	uint16_t				legacy;
160 	uint8_t					mcs;
161 	uint8_t					nss;
162 	uint8_t					he_dcm;
163 	uint8_t					he_gi;
164 	uint8_t					he_ru_alloc;
165 };
166 
167 struct ieee80211_rate {
168 	/* TODO FIXME */
169 	uint32_t		bitrate;
170 	uint32_t		hw_value;
171 	uint32_t		hw_value_short;
172 	uint32_t		flags;
173 };
174 
175 struct ieee80211_sta_ht_cap {
176 		/* TODO FIXME */
177 	int	ampdu_density, ampdu_factor;
178 	bool					ht_supported;
179 	uint16_t				cap;
180 	struct ieee80211_mcs_info		mcs;
181 };
182 
183 /* XXX net80211 calls these IEEE80211_VHTCAP_* */
184 #define	IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_3895	0x00000000	/* IEEE80211_VHTCAP_MAX_MPDU_LENGTH_3895 */
185 #define	IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_7991	0x00000001	/* IEEE80211_VHTCAP_MAX_MPDU_LENGTH_7991 */
186 #define	IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454	0x00000002	/* IEEE80211_VHTCAP_MAX_MPDU_LENGTH_11454 */
187 #define	IEEE80211_VHT_CAP_MAX_MPDU_MASK		0x00000003	/* IEEE80211_VHTCAP_MAX_MPDU_MASK */
188 
189 #define	IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ		(IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_160MHZ << IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_MASK_S)
190 #define	IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ	(IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_160_80P80MHZ << IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_MASK_S)
191 #define	IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK	0x0000000c	/* IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_MASK */
192 
193 #define	IEEE80211_VHT_CAP_RXLDPC		0x00000010	/* IEEE80211_VHTCAP_RXLDPC */
194 
195 #define	IEEE80211_VHT_CAP_SHORT_GI_80		0x00000020	/* IEEE80211_VHTCAP_SHORT_GI_80 */
196 #define	IEEE80211_VHT_CAP_SHORT_GI_160		0x00000040	/* IEEE80211_VHTCAP_SHORT_GI_160 */
197 
198 #define	IEEE80211_VHT_CAP_TXSTBC		0x00000080	/* IEEE80211_VHTCAP_TXSTBC */
199 
200 #define	IEEE80211_VHT_CAP_RXSTBC_1		0x00000100	/* IEEE80211_VHTCAP_RXSTBC_1 */
201 #define	IEEE80211_VHT_CAP_RXSTBC_MASK		0x00000700	/* IEEE80211_VHTCAP_RXSTBC_MASK */
202 
203 #define	IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE	0x00000800	/* IEEE80211_VHTCAP_SU_BEAMFORMER_CAPABLE */
204 
205 #define	IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE	0x00001000	/* IEEE80211_VHTCAP_SU_BEAMFORMEE_CAPABLE */
206 
207 #define	IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE	0x00080000	/* IEEE80211_VHTCAP_MU_BEAMFORMER_CAPABLE */
208 
209 #define	IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE	0x00100000	/* IEEE80211_VHTCAP_MU_BEAMFORMEE_CAPABLE */
210 
211 #define	IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT		13	/* IEEE80211_VHTCAP_BEAMFORMEE_STS_SHIFT */
212 #define	IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK		(7 << IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT)	/* IEEE80211_VHTCAP_BEAMFORMEE_STS_MASK */
213 
214 #define	IEEE80211_VHT_CAP_HTC_VHT		0x00400000	/* IEEE80211_VHTCAP_HTC_VHT */
215 
216 #define	IEEE80211_VHT_CAP_RX_ANTENNA_PATTERN	0x10000000	/* IEEE80211_VHTCAP_RX_ANTENNA_PATTERN */
217 #define	IEEE80211_VHT_CAP_TX_ANTENNA_PATTERN	0x20000000	/* IEEE80211_VHTCAP_TX_ANTENNA_PATTERN */
218 
219 #define	IEEE80211_VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB	0x0c000000	/* IEEE80211_VHTCAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB */
220 
221 #define	IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_SHIFT	16	/* IEEE80211_VHTCAP_SOUNDING_DIMENSIONS_SHIFT */
222 #define	IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MASK		\
223 	(7 << IEEE80211_VHTCAP_SOUNDING_DIMENSIONS_SHIFT)	/* IEEE80211_VHTCAP_SOUNDING_DIMENSIONS_MASK */
224 
225 #define	IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT	23	/* IEEE80211_VHTCAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT */
226 #define	IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK	\
227 	(7 << IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT)	/* IEEE80211_VHTCAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK */
228 
229 
230 struct ieee80211_sta_vht_cap {
231 		/* TODO FIXME */
232 	bool				vht_supported;
233 	uint32_t			cap;
234 	struct ieee80211_vht_mcs_info	vht_mcs;
235 };
236 
237 enum ieee80211_vht_opmode {
238 	IEEE80211_OPMODE_NOTIF_RX_NSS_SHIFT	= 4,
239 };
240 
241 struct cfg80211_connect_resp_params {
242 		/* XXX TODO */
243 	uint8_t				*bssid;
244 	const uint8_t			*req_ie;
245 	const uint8_t			*resp_ie;
246 	uint32_t			req_ie_len;
247 	uint32_t			resp_ie_len;
248 	int	status;
249 };
250 
251 struct cfg80211_inform_bss {
252 		/* XXX TODO */
253 	int     boottime_ns, scan_width, signal;
254 	struct linuxkpi_ieee80211_channel	*chan;
255 };
256 
257 struct cfg80211_roam_info {
258 		/* XXX TODO */
259 	uint8_t				*bssid;
260 	const uint8_t			*req_ie;
261 	const uint8_t			*resp_ie;
262 	uint32_t			req_ie_len;
263 	uint32_t			resp_ie_len;
264 	struct linuxkpi_ieee80211_channel	*channel;
265 };
266 
267 struct cfg80211_bss_ies {
268 		/* XXX TODO, type is best guess. Fix if more info. */
269 	uint8_t				*data;
270 	int				len;
271 };
272 
273 struct cfg80211_bss {
274 		/* XXX TODO */
275 	struct cfg80211_bss_ies		*ies;
276 };
277 
278 struct cfg80211_chan_def {
279 		/* XXX TODO */
280 	struct linuxkpi_ieee80211_channel	*chan;
281 	enum nl80211_chan_width		width;
282 	uint32_t			center_freq1;
283 	uint32_t			center_freq2;
284 };
285 
286 struct cfg80211_ftm_responder_stats {
287 		/* XXX TODO */
288 	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;
289 };
290 
291 struct cfg80211_pmsr_capabilities {
292 		/* XXX TODO */
293 	int	max_peers, randomize_mac_addr, report_ap_tsf;
294 	struct {
295 		int	 asap, bandwidths, max_bursts_exponent, max_ftms_per_burst, non_asap, non_trigger_based, preambles, request_civicloc, request_lci, supported, trigger_based;
296 	} ftm;
297 };
298 
299 struct cfg80211_pmsr_ftm_request {
300 		/* XXX TODO */
301 	int     asap, burst_period, ftmr_retries, ftms_per_burst, non_trigger_based, num_bursts_exp, request_civicloc, request_lci, trigger_based;
302 	uint8_t					bss_color;
303 	bool					lmr_feedback;
304 };
305 
306 struct cfg80211_pmsr_request_peer {
307 		/* XXX TODO */
308 	struct cfg80211_chan_def		chandef;
309 	struct cfg80211_pmsr_ftm_request	ftm;
310 	uint8_t					addr[ETH_ALEN];
311 	int	report_ap_tsf;
312 };
313 
314 struct cfg80211_pmsr_request {
315 		/* XXX TODO */
316 	int	cookie, n_peers, timeout;
317 	uint8_t					mac_addr[ETH_ALEN], mac_addr_mask[ETH_ALEN];
318 	struct cfg80211_pmsr_request_peer	peers[];
319 };
320 
321 struct cfg80211_pmsr_ftm_result {
322 		/* XXX TODO */
323 	int	burst_index, busy_retry_time, failure_reason;
324 	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;
325 	uint8_t					*lci;
326 	uint8_t					*civicloc;
327 	int					lci_len;
328 	int					civicloc_len;
329 };
330 
331 struct cfg80211_pmsr_result {
332 		/* XXX TODO */
333 	int	ap_tsf, ap_tsf_valid, final, host_time, status, type;
334 	uint8_t					addr[ETH_ALEN];
335 	struct cfg80211_pmsr_ftm_result		ftm;
336 };
337 
338 struct cfg80211_sar_freq_ranges {
339 	uint32_t				start_freq;
340 	uint32_t				end_freq;
341 };
342 
343 struct cfg80211_sar_sub_specs {
344 	uint32_t				freq_range_index;
345 	int					power;
346 };
347 
348 struct cfg80211_sar_specs {
349 	enum nl80211_sar_type			type;
350 	uint32_t				num_sub_specs;
351 	struct cfg80211_sar_sub_specs		sub_specs[];
352 };
353 
354 struct cfg80211_sar_capa {
355 	enum nl80211_sar_type			type;
356 	uint32_t				num_freq_ranges;
357 	const struct cfg80211_sar_freq_ranges	*freq_ranges;
358 };
359 
360 struct cfg80211_ssid {
361 	int	ssid_len;
362 	uint8_t	ssid[IEEE80211_MAX_SSID_LEN];
363 };
364 
365 struct cfg80211_scan_6ghz_params {
366 	/* XXX TODO */
367 	uint8_t				*bssid;
368 	int	channel_idx, psc_no_listen, short_ssid, short_ssid_valid, unsolicited_probe;
369 };
370 
371 struct cfg80211_match_set {
372 	uint8_t					bssid[ETH_ALEN];
373 	struct cfg80211_ssid	ssid;
374 	int			rssi_thold;
375 };
376 
377 struct cfg80211_scan_request {
378 		/* XXX TODO */
379 	int	duration, duration_mandatory, flags;
380 	bool					no_cck;
381 	bool					scan_6ghz;
382 	struct wireless_dev			*wdev;
383 	struct wiphy				*wiphy;
384 	int					ie_len;
385 	uint8_t					*ie;
386 	uint8_t					mac_addr[ETH_ALEN], mac_addr_mask[ETH_ALEN];
387 	uint8_t					bssid[ETH_ALEN];
388 	int					n_ssids;
389 	int					n_6ghz_params;
390 	int					n_channels;
391 	struct cfg80211_ssid			*ssids;
392 	struct cfg80211_scan_6ghz_params 	*scan_6ghz_params;
393 	struct linuxkpi_ieee80211_channel	*channels[0];
394 };
395 
396 struct cfg80211_sched_scan_plan {
397 		/* XXX TODO */
398 	int	interval, iterations;
399 };
400 
401 struct cfg80211_sched_scan_request {
402 		/* XXX TODO */
403 	int	delay, flags;
404 	uint8_t					mac_addr[ETH_ALEN], mac_addr_mask[ETH_ALEN];
405 	uint64_t				reqid;
406 	int					n_match_sets;
407 	int					n_scan_plans;
408 	int					n_ssids;
409 	int					n_channels;
410 	int					ie_len;
411 	uint8_t					*ie;
412 	struct cfg80211_match_set		*match_sets;
413 	struct cfg80211_sched_scan_plan		*scan_plans;
414 	struct cfg80211_ssid			*ssids;
415 	struct linuxkpi_ieee80211_channel	*channels[0];
416 };
417 
418 struct cfg80211_scan_info {
419 	uint64_t				scan_start_tsf;
420 	uint8_t					tsf_bssid[ETH_ALEN];
421 	bool					aborted;
422 };
423 
424 struct cfg80211_beacon_data {
425 	/* XXX TODO */
426 	const uint8_t				*head;
427 	const uint8_t				*tail;
428 	uint32_t				head_len;
429 	uint32_t				tail_len;
430 	const uint8_t				*proberesp_ies;
431 	const uint8_t				*assocresp_ies;
432 	uint32_t				proberesp_ies_len;
433 	uint32_t				assocresp_ies_len;
434 };
435 
436 struct cfg80211_ap_settings {
437 	/* XXX TODO */
438 	int     auth_type, beacon_interval, dtim_period, hidden_ssid, inactivity_timeout;
439 	const uint8_t				*ssid;
440 	size_t					ssid_len;
441 	struct cfg80211_beacon_data		beacon;
442 	struct cfg80211_chan_def		chandef;
443 };
444 
445 struct cfg80211_bss_selection {
446 	/* XXX TODO */
447 	enum nl80211_bss_select_attr		behaviour;
448 	union {
449 		enum nl80211_band		band_pref;
450 		struct {
451 			enum nl80211_band	band;
452 			uint8_t			delta;
453 		} adjust;
454 	} param;
455 };
456 
457 struct cfg80211_crypto {		/* XXX made up name */
458 	/* XXX TODO */
459 	enum nl80211_wpa_versions		wpa_versions;
460 	uint32_t				cipher_group;	/* WLAN_CIPHER_SUITE_* */
461 	uint32_t				*akm_suites;
462 	uint32_t				*ciphers_pairwise;
463 	const uint8_t				*sae_pwd;
464 	const uint8_t				*psk;
465 	int					n_akm_suites;
466 	int					n_ciphers_pairwise;
467 	int					sae_pwd_len;
468 };
469 
470 struct cfg80211_connect_params {
471 	/* XXX TODO */
472 	struct linuxkpi_ieee80211_channel	*channel;
473 	uint8_t					*bssid;
474 	const uint8_t				*ie;
475 	const uint8_t				*ssid;
476 	uint32_t				ie_len;
477 	uint32_t				ssid_len;
478 	const void				*key;
479 	uint32_t				key_len;
480 	int     auth_type, key_idx, privacy, want_1x;
481 	struct cfg80211_bss_selection		bss_select;
482 	struct cfg80211_crypto			crypto;
483 };
484 
485 enum bss_param_flags {		/* Used as bitflags. XXX FIXME values? */
486 	BSS_PARAM_FLAGS_CTS_PROT	= 0x01,
487 	BSS_PARAM_FLAGS_SHORT_PREAMBLE	= 0x02,
488 	BSS_PARAM_FLAGS_SHORT_SLOT_TIME = 0x04,
489 };
490 
491 struct cfg80211_ibss_params {
492 	/* XXX TODO */
493 	int     basic_rates, beacon_interval;
494 	int	channel_fixed, ie, ie_len, privacy;
495 	int	dtim_period;
496 	uint8_t					*ssid;
497 	uint8_t					*bssid;
498 	int					ssid_len;
499 	struct cfg80211_chan_def		chandef;
500 	enum bss_param_flags			flags;
501 };
502 
503 struct cfg80211_mgmt_tx_params {
504 	/* XXX TODO */
505 	struct linuxkpi_ieee80211_channel	*chan;
506 	const uint8_t				*buf;
507 	size_t					len;
508 	int	wait;
509 };
510 
511 struct cfg80211_pmk_conf {
512 	/* XXX TODO */
513 	const uint8_t			*pmk;
514 	uint8_t				pmk_len;
515 };
516 
517 struct cfg80211_pmksa {
518 	/* XXX TODO */
519 	const uint8_t			*bssid;
520 	const uint8_t			*pmkid;
521 };
522 
523 struct station_del_parameters {
524 	/* XXX TODO */
525 	const uint8_t				*mac;
526 	uint32_t				reason_code;	/* elsewhere uint16_t? */
527 };
528 
529 struct station_info {
530 	/* TODO FIXME */
531 	int     assoc_req_ies_len, connected_time;
532 	int	generation, inactive_time, rx_bytes, rx_dropped_misc, rx_packets, signal, tx_bytes, tx_packets;
533 	int     filled, rx_beacon, rx_beacon_signal_avg, signal_avg;
534 	int	rx_duration, tx_failed, tx_retries;
535 
536 	int					chains;
537 	uint8_t					chain_signal[IEEE80211_MAX_CHAINS];
538 	uint8_t					chain_signal_avg[IEEE80211_MAX_CHAINS];
539 
540 	uint8_t					*assoc_req_ies;
541 	struct rate_info			rxrate;
542 	struct rate_info			txrate;
543 	struct cfg80211_ibss_params		bss_param;
544 	struct nl80211_sta_flag_update		sta_flags;
545 };
546 
547 struct station_parameters {
548 	/* XXX TODO */
549 	int     sta_flags_mask, sta_flags_set;
550 };
551 
552 struct key_params {
553 	/* XXX TODO */
554 	const uint8_t	*key;
555 	const uint8_t	*seq;
556 	int		key_len;
557 	int		seq_len;
558 	uint32_t	cipher;			/* WLAN_CIPHER_SUITE_* */
559 };
560 
561 struct mgmt_frame_regs {
562 	/* XXX TODO */
563 	int	interface_stypes;
564 };
565 
566 struct vif_params {
567 	/* XXX TODO */
568 	uint8_t			macaddr[ETH_ALEN];
569 };
570 
571 /* That the world needs so many different structs for this is amazing. */
572 struct mac_address {
573 	uint8_t	addr[ETH_ALEN];
574 };
575 
576 struct ieee80211_reg_rule {
577 	/* TODO FIXME */
578 	uint32_t	flags;
579 	struct freq_range {
580 		int	start_freq_khz;
581 		int	end_freq_khz;
582 		int	max_bandwidth_khz;
583 	} freq_range;
584 	struct power_rule {
585 		int	max_antenna_gain;
586 		int	max_eirp;
587 	} power_rule;
588 };
589 
590 struct linuxkpi_ieee80211_regdomain {
591 	/* TODO FIXME */
592 	uint8_t					alpha2[2];
593 	int	dfs_region;
594 	int					n_reg_rules;
595 	struct ieee80211_reg_rule		reg_rules[];
596 };
597 
598 /* XXX-BZ this are insensible values probably ... */
599 #define	IEEE80211_HE_MAC_CAP0_HTC_HE			0x1
600 #define	IEEE80211_HE_MAC_CAP0_TWT_REQ			0x2
601 #define	IEEE80211_HE_MAC_CAP0_TWT_RES			0x4
602 
603 #define	IEEE80211_HE_MAC_CAP1_LINK_ADAPTATION		0x1
604 #define	IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_RX_QOS_8	0x2
605 #define	IEEE80211_HE_MAC_CAP1_TF_MAC_PAD_DUR_16US	0x4
606 #define	IEEE80211_HE_MAC_CAP1_TF_MAC_PAD_DUR_MASK	0x8
607 
608 #define	IEEE80211_HE_MAC_CAP2_32BIT_BA_BITMAP		0x1
609 #define	IEEE80211_HE_MAC_CAP2_ACK_EN			0x2
610 #define	IEEE80211_HE_MAC_CAP2_BSR			0x4
611 #define	IEEE80211_HE_MAC_CAP2_LINK_ADAPTATION		0x8
612 #define	IEEE80211_HE_MAC_CAP2_BCAST_TWT			0x10
613 #define	IEEE80211_HE_MAC_CAP2_ALL_ACK			0x20
614 #define	IEEE80211_HE_MAC_CAP2_MU_CASCADING		0x40
615 #define	IEEE80211_HE_MAC_CAP2_TRS			0x80
616 
617 #define	IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_VHT_2	0x1
618 #define	IEEE80211_HE_MAC_CAP3_OMI_CONTROL		0x2
619 #define	IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_EXT_1	0x10
620 #define	IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_EXT_2	0x20
621 #define	IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_EXT_3	0x40
622 #define	IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_MASK	0x70
623 #define	IEEE80211_HE_MAC_CAP3_RX_CTRL_FRAME_TO_MULTIBSS	0x80
624 #define	IEEE80211_HE_MAC_CAP3_FLEX_TWT_SCHED		0x80
625 #define	IEEE80211_HE_MAC_CAP3_OFDMA_RA			0x80
626 
627 #define	IEEE80211_HE_MAC_CAP4_AMDSU_IN_AMPDU		0x1
628 #define	IEEE80211_HE_MAC_CAP4_BQR			0x2
629 #define	IEEE80211_HE_MAC_CAP4_MULTI_TID_AGG_TX_QOS_B39	0x4
630 #define	IEEE80211_HE_MAC_CAP4_AMSDU_IN_AMPDU		0x8
631 #define	IEEE80211_HE_MAC_CAP4_OPS			0x10
632 #define	IEEE80211_HE_MAC_CAP4_BSRP_BQRP_A_MPDU_AGG	0x20
633 
634 #define	IEEE80211_HE_MAC_CAP5_HE_DYNAMIC_SM_PS		0x1
635 #define	IEEE80211_HE_MAC_CAP5_HT_VHT_TRIG_FRAME_RX	0x2
636 #define	IEEE80211_HE_MAC_CAP5_MULTI_TID_AGG_TX_QOS_B40	0x4
637 #define	IEEE80211_HE_MAC_CAP5_MULTI_TID_AGG_TX_QOS_B41	0x8
638 #define	IEEE80211_HE_MAC_CAP5_UL_2x996_TONE_RU		0x10
639 #define	IEEE80211_HE_MAC_CAP5_OM_CTRL_UL_MU_DATA_DIS_RX	0x20
640 #define	IEEE80211_HE_MAC_CAP5_PUNCTURED_SOUNDING	0x40
641 #define	IEEE80211_HE_MAC_CAP5_SUBCHAN_SELECTIVE_TRANSMISSION	0x80
642 
643 #define	IEEE80211_HE_MCS_NOT_SUPPORTED			0x0
644 #define	IEEE80211_HE_MCS_SUPPORT_0_7			0x1
645 #define	IEEE80211_HE_MCS_SUPPORT_0_9			0x2
646 #define	IEEE80211_HE_MCS_SUPPORT_0_11			0x4
647 
648 #define	IEEE80211_HE_6GHZ_CAP_TX_ANTPAT_CONS		0x01
649 #define	IEEE80211_HE_6GHZ_CAP_RX_ANTPAT_CONS		0x02
650 #define	IEEE80211_HE_6GHZ_CAP_MIN_MPDU_START		0x04
651 #define	IEEE80211_HE_6GHZ_CAP_MAX_MPDU_LEN		0x08
652 #define	IEEE80211_HE_6GHZ_CAP_MAX_AMPDU_LEN_EXP		0x10
653 #define	IEEE80211_HE_6GHZ_CAP_SM_PS			0x20
654 #define	IEEE80211_HE_6GHZ_MAX_AMPDU_FACTOR		0x40
655 
656 #define	IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G		0x1
657 #define	IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G	0x2
658 #define	IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_IN_2G		0x4
659 #define	IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G	0x8
660 #define	IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_RU_MAPPING_IN_2G	0x10
661 #define	IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_RU_MAPPING_IN_5G	0x20
662 #define	IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_MASK			0x40
663 
664 #define	IEEE80211_HE_PHY_CAP1_DEVICE_CLASS_A		0x1
665 #define	IEEE80211_HE_PHY_CAP1_LDPC_CODING_IN_PAYLOAD	0x2
666 #define	IEEE80211_HE_PHY_CAP1_MIDAMBLE_RX_TX_MAX_NSTS	0x4
667 #define	IEEE80211_HE_PHY_CAP1_PREAMBLE_PUNC_RX_MASK	0x8
668 #define	IEEE80211_HE_PHY_CAP1_HE_LTF_AND_GI_FOR_HE_PPDUS_0_8US	0x10
669 
670 #define	IEEE80211_HE_PHY_CAP2_MIDAMBLE_RX_TX_MAX_NSTS	0x1
671 #define	IEEE80211_HE_PHY_CAP2_NDP_4x_LTF_AND_3_2US	0x2
672 #define	IEEE80211_HE_PHY_CAP2_STBC_TX_UNDER_80MHZ	0x4
673 #define	IEEE80211_HE_PHY_CAP2_STBC_RX_UNDER_80MHZ	0x8
674 #define	IEEE80211_HE_PHY_CAP2_DOPPLER_TX		0x10
675 #define	IEEE80211_HE_PHY_CAP2_UL_MU_PARTIAL_MU_MIMO	0x20
676 #define	IEEE80211_HE_PHY_CAP2_UL_MU_FULL_MU_MIMO	0x40
677 
678 #define	IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_MASK	0x1
679 #define	IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_NO_DCM	0x2
680 #define	IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_NO_DCM	0x4
681 #define	IEEE80211_HE_PHY_CAP3_DCM_MAX_RX_NSS_1		0x8
682 #define	IEEE80211_HE_PHY_CAP3_DCM_MAX_TX_NSS_1		0x10
683 #define	IEEE80211_HE_PHY_CAP3_SU_BEAMFORMER		0x20
684 #define	IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_16_QAM	0x40
685 #define	IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_16_QAM	0x80
686 #define	IEEE80211_HE_PHY_CAP3_DCM_MAX_TX_NSS_2		0x10
687 #define	IEEE80211_HE_PHY_CAP3_RX_PARTIAL_BW_SU_IN_20MHZ_MU	0x20
688 #define	IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_BPSK	0x40
689 #define	IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_BPSK	0x80
690 #define	IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_MASK	0x80
691 #define	IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_QPSK	0x80
692 #define	IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_QPSK	0x80
693 #define	IEEE80211_HE_PHY_CAP3_DCM_MAX_RX_NSS_2		0x80
694 
695 #define	IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_UNDER_80MHZ_8	0x1
696 #define	IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_ABOVE_80MHZ_8	0x2
697 #define	IEEE80211_HE_PHY_CAP4_SU_BEAMFORMEE			0x4
698 #define	IEEE80211_HE_PHY_CAP4_MU_BEAMFORMER			0x8
699 #define	IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_UNDER_80MHZ_4	0x10
700 #define	IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_ABOVE_80MHZ_4	0x20
701 #define	IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_ABOVE_80MHZ_MASK	0x40
702 #define	IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_UNDER_80MHZ_MASK	0x80
703 
704 #define	IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_ABOVE_80MHZ_2	0x1
705 #define	IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_2	0x2
706 #define	IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_MASK	0x4
707 #define	IEEE80211_HE_PHY_CAP5_NG16_MU_FEEDBACK				0x8
708 #define	IEEE80211_HE_PHY_CAP5_NG16_SU_FEEDBACK				0x10
709 #define	IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_ABOVE_80MHZ_MASK	0x20
710 
711 #define	IEEE80211_HE_PHY_CAP6_PPE_THRESHOLD_PRESENT	0x1
712 #define	IEEE80211_HE_PHY_CAP6_TRIG_MU_BEAMFORMER_FB	0x2
713 #define	IEEE80211_HE_PHY_CAP6_TRIG_SU_BEAMFORMER_FB	0x4
714 #define	IEEE80211_HE_PHY_CAP6_TRIG_SU_BEAMFORMING_FB	0x8
715 #define	IEEE80211_HE_PHY_CAP6_TRIG_MU_BEAMFORMING_PARTIAL_BW_FB	0x20
716 #define	IEEE80211_HE_PHY_CAP6_CODEBOOK_SIZE_42_SU	0x40
717 #define	IEEE80211_HE_PHY_CAP6_CODEBOOK_SIZE_75_MU	0x80
718 #define	IEEE80211_HE_PHY_CAP6_PARTIAL_BW_EXT_RANGE	0x80
719 #define	IEEE80211_HE_PHY_CAP6_TRIG_CQI_FB		0x80
720 #define	IEEE80211_HE_PHY_CAP6_PARTIAL_BANDWIDTH_DL_MUMIMO	0x80
721 
722 #define	IEEE80211_HE_PHY_CAP7_HE_SU_MU_PPDU_4XLTF_AND_08_US_GI	0x1
723 #define	IEEE80211_HE_PHY_CAP7_MAX_NC_1				0x2
724 #define	IEEE80211_HE_PHY_CAP7_MAX_NC_2				0x4
725 #define	IEEE80211_HE_PHY_CAP7_MAX_NC_MASK			0x6
726 #define	IEEE80211_HE_PHY_CAP7_POWER_BOOST_FACTOR_AR		0x8
727 #define	IEEE80211_HE_PHY_CAP7_POWER_BOOST_FACTOR_SUPP		0x10
728 #define	IEEE80211_HE_PHY_CAP7_STBC_RX_ABOVE_80MHZ		0x20
729 #define	IEEE80211_HE_PHY_CAP7_STBC_TX_ABOVE_80MHZ		0x40
730 #define	IEEE80211_HE_PHY_CAP7_PSR_BASED_SR			0x80
731 
732 #define	IEEE80211_HE_PHY_CAP8_20MHZ_IN_160MHZ_HE_PPDU		0x1
733 #define	IEEE80211_HE_PHY_CAP8_20MHZ_IN_40MHZ_HE_PPDU_IN_2G	0x2
734 #define	IEEE80211_HE_PHY_CAP8_80MHZ_IN_160MHZ_HE_PPDU		0x4
735 #define	IEEE80211_HE_PHY_CAP8_DCM_MAX_RU_242			0x8
736 #define	IEEE80211_HE_PHY_CAP8_DCM_MAX_RU_484			0x10
737 #define	IEEE80211_HE_PHY_CAP8_DCM_MAX_RU_996			0x18
738 #define	IEEE80211_HE_PHY_CAP8_DCM_MAX_RU_2x996			0x20
739 #define	IEEE80211_HE_PHY_CAP8_DCM_MAX_RU_MASK			0x28
740 #define	IEEE80211_HE_PHY_CAP8_HE_ER_SU_PPDU_4XLTF_AND_08_US_GI	0x40
741 #define	IEEE80211_HE_PHY_CAP8_HE_ER_SU_1XLTF_AND_08_US_GI	0x80
742 
743 #define	IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_0US		0x1
744 #define	IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_16US		0x2
745 #define	IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_8US		0x4
746 #define	IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_MASK		0x8
747 #define	IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_RESERVED	0x10
748 #define	IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_POS		0x0
749 #define	IEEE80211_HE_PHY_CAP9_NON_TRIGGERED_CQI_FEEDBACK	0x20
750 #define	IEEE80211_HE_PHY_CAP9_RX_FULL_BW_SU_USING_MU_WITH_COMP_SIGB	0x4
751 #define	IEEE80211_HE_PHY_CAP9_RX_FULL_BW_SU_USING_MU_WITH_NON_COMP_SIGB	0x8
752 #define	IEEE80211_HE_PHY_CAP9_RX_1024_QAM_LESS_THAN_242_TONE_RU	0x10
753 #define	IEEE80211_HE_PHY_CAP9_TX_1024_QAM_LESS_THAN_242_TONE_RU	0x20
754 #define	IEEE80211_HE_PHY_CAP9_LONGER_THAN_16_SIGB_OFDM_SYM	0x40
755 
756 #define	IEEE80211_HE_PHY_CAP10_HE_MU_M1RU_MAX_LTF		0x1
757 
758 #define	VENDOR_CMD_RAW_DATA	(void *)(uintptr_t)(-ENOENT)
759 
760 struct ieee80211_he_cap_elem {
761 	u8 mac_cap_info[6];
762 	u8 phy_cap_info[11];
763 } __packed;
764 
765 struct ieee80211_he_mcs_nss_supp {
766 	/* TODO FIXME */
767 	uint32_t	rx_mcs_80;
768 	uint32_t	tx_mcs_80;
769 	uint32_t	rx_mcs_160;
770 	uint32_t	tx_mcs_160;
771 	uint32_t	rx_mcs_80p80;
772 	uint32_t	tx_mcs_80p80;
773 };
774 
775 #define	IEEE80211_STA_HE_CAP_PPE_THRES_MAX	32
776 struct ieee80211_sta_he_cap {
777 	/* TODO FIXME */
778 	int					has_he;
779 	struct ieee80211_he_cap_elem		he_cap_elem;
780 	struct ieee80211_he_mcs_nss_supp	he_mcs_nss_supp;
781 	uint8_t					ppe_thres[IEEE80211_STA_HE_CAP_PPE_THRES_MAX];
782 };
783 
784 struct cfg80211_he_bss_color {
785 	int	color, enabled;
786 };
787 
788 struct ieee80211_he_obss_pd {
789 	bool					enable;
790 };
791 
792 struct ieee80211_sta_he_6ghz_capa {
793 	/* TODO FIXME */
794 	int	capa;
795 };
796 
797 struct ieee80211_sband_iftype_data {
798 	/* TODO FIXME */
799 	enum nl80211_iftype			types_mask;
800 	struct ieee80211_sta_he_cap		he_cap;
801 	struct ieee80211_sta_he_6ghz_capa	he_6ghz_capa;
802 	struct {
803 		const uint8_t			*data;
804 		size_t				len;
805 	} vendor_elems;
806 };
807 
808 struct ieee80211_supported_band {
809 	/* TODO FIXME */
810 	struct linuxkpi_ieee80211_channel	*channels;
811 	struct ieee80211_rate			*bitrates;
812 	struct ieee80211_sband_iftype_data	*iftype_data;
813 	int					n_channels;
814 	int					n_bitrates;
815 	int					n_iftype_data;
816 	enum nl80211_band			band;
817 	struct ieee80211_sta_ht_cap		ht_cap;
818 	struct ieee80211_sta_vht_cap		vht_cap;
819 };
820 
821 struct cfg80211_pkt_pattern {
822 	/* XXX TODO */
823 	uint8_t					*mask;
824 	uint8_t					*pattern;
825 	int					pattern_len;
826 	int					pkt_offset;
827 };
828 
829 struct cfg80211_wowlan_nd_match {
830 	/* XXX TODO */
831 	struct cfg80211_ssid		ssid;
832 	int				n_channels;
833 	uint32_t			channels[0];	/* freq! = ieee80211_channel_to_frequency() */
834 };
835 
836 struct cfg80211_wowlan_nd_info {
837 	/* XXX TODO */
838 	int				n_matches;
839 	struct cfg80211_wowlan_nd_match	*matches[0];
840 };
841 
842 enum wiphy_wowlan_support_flags {
843 	WIPHY_WOWLAN_DISCONNECT,
844 	WIPHY_WOWLAN_GTK_REKEY_FAILURE,
845 	WIPHY_WOWLAN_MAGIC_PKT,
846 	WIPHY_WOWLAN_SUPPORTS_GTK_REKEY,
847 	WIPHY_WOWLAN_NET_DETECT,
848 };
849 
850 struct wiphy_wowlan_support {
851 	/* XXX TODO */
852 	enum wiphy_wowlan_support_flags		flags;
853 	int	max_nd_match_sets, max_pkt_offset, n_patterns, pattern_max_len, pattern_min_len;
854 };
855 
856 struct cfg80211_wowlan_wakeup {
857 	/* XXX TODO */
858 	uint16_t				pattern_idx;
859 	bool					disconnect;
860 	bool					eap_identity_req;
861 	bool					four_way_handshake;
862 	bool					gtk_rekey_failure;
863 	bool					magic_pkt;
864 	bool					rfkill_release;
865 	bool					tcp_connlost;
866 	bool					tcp_nomoretokens;
867 	bool					tcp_match;
868 	bool					packet_80211;
869 	struct cfg80211_wowlan_nd_info		*net_detect;
870 	uint8_t					*packet;
871 	uint16_t				packet_len;
872 	uint16_t				packet_present_len;
873 };
874 
875 struct cfg80211_wowlan {
876 	/* XXX TODO */
877 	int	disconnect, gtk_rekey_failure, magic_pkt;
878 	int	eap_identity_req, four_way_handshake, rfkill_release, tcp, any;
879 	int					n_patterns;
880 	struct cfg80211_sched_scan_request	*nd_config;
881 	struct cfg80211_pkt_pattern		*patterns;
882 };
883 
884 struct cfg80211_gtk_rekey_data {
885 	/* XXX TODO */
886 	const uint8_t				*kck, *kek, *replay_ctr;
887 	uint32_t				akm;
888 	uint8_t					kck_len, kek_len;
889 };
890 
891 struct cfg80211_tid_cfg {
892 	/* XXX TODO */
893 	int	mask, noack, retry_long, rtscts, tids;
894 	enum nl80211_tx_rate_setting		txrate_type;
895 	struct cfg80211_bitrate_mask		txrate_mask;
896 };
897 
898 struct cfg80211_tid_config {
899 	/* XXX TODO */
900 	int	n_tid_conf;
901 	struct cfg80211_tid_cfg			tid_conf[0];
902 };
903 
904 struct ieee80211_iface_limit {
905 	/* TODO FIXME */
906 	int		max, types;
907 };
908 
909 struct ieee80211_iface_combination {
910 	/* TODO FIXME */
911 	const struct ieee80211_iface_limit	*limits;
912 	int					n_limits;
913 	int		max_interfaces, num_different_channels;
914 	int		beacon_int_infra_match, beacon_int_min_gcd;
915 	int		radar_detect_widths;
916 };
917 
918 struct iface_combination_params {
919 	int num_different_channels;
920 	int iftype_num[NUM_NL80211_IFTYPES];
921 };
922 
923 struct regulatory_request {
924 		/* XXX TODO */
925 	uint8_t					alpha2[2];
926 	int	initiator, dfs_region;
927 };
928 
929 enum wiphy_vendor_cmd_need_flags {
930 	WIPHY_VENDOR_CMD_NEED_NETDEV		= 0x01,
931 	WIPHY_VENDOR_CMD_NEED_RUNNING		= 0x02,
932 	WIPHY_VENDOR_CMD_NEED_WDEV		= 0x04,
933 };
934 
935 struct wiphy_vendor_command {
936 	struct {
937 		uint32_t	vendor_id;
938 		uint32_t	subcmd;
939 	};
940 	uint32_t		flags;
941 	void			*policy;
942 	int (*doit)(struct wiphy *, struct wireless_dev *, const void *, int);
943 };
944 
945 struct wiphy_iftype_ext_capab {
946 	/* TODO FIXME */
947 	enum nl80211_iftype			iftype;
948 	const uint8_t				*extended_capabilities;
949 	const uint8_t				*extended_capabilities_mask;
950 	uint8_t					extended_capabilities_len;
951 
952 };
953 
954 struct tid_config_support {
955 	/* TODO FIXME */
956 	uint64_t				vif;	/* enum nl80211_tid_cfg_attr */
957 	uint64_t		 		peer;	/* enum nl80211_tid_cfg_attr */
958 };
959 
960 enum cfg80211_regulatory {
961 	REGULATORY_CUSTOM_REG			= BIT(0),
962 	REGULATORY_STRICT_REG			= BIT(1),
963 	REGULATORY_DISABLE_BEACON_HINTS		= BIT(2),
964 	REGULATORY_ENABLE_RELAX_NO_IR		= BIT(3),
965 	REGULATORY_WIPHY_SELF_MANAGED		= BIT(4),
966 	REGULATORY_COUNTRY_IE_IGNORE		= BIT(5),
967 	REGULATORY_COUNTRY_IE_FOLLOW_POWER	= BIT(6),
968 };
969 
970 enum wiphy_flags {
971 	WIPHY_FLAG_AP_UAPSD			= BIT(0),
972 	WIPHY_FLAG_HAS_CHANNEL_SWITCH		= BIT(1),
973 	WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL	= BIT(2),
974 	WIPHY_FLAG_HAVE_AP_SME			= BIT(3),
975 	WIPHY_FLAG_IBSS_RSN			= BIT(4),
976 	WIPHY_FLAG_NETNS_OK			= BIT(5),
977 	WIPHY_FLAG_OFFCHAN_TX			= BIT(6),
978 	WIPHY_FLAG_PS_ON_BY_DEFAULT		= BIT(7),
979 	WIPHY_FLAG_SPLIT_SCAN_6GHZ		= BIT(8),
980 	WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK		= BIT(9),
981 	WIPHY_FLAG_SUPPORTS_FW_ROAM		= BIT(10),
982 	WIPHY_FLAG_SUPPORTS_TDLS		= BIT(11),
983 	WIPHY_FLAG_TDLS_EXTERNAL_SETUP		= BIT(12),
984 	WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD	= BIT(13),
985 	WIPHY_FLAG_4ADDR_AP			= BIT(14),
986 	WIPHY_FLAG_4ADDR_STATION		= BIT(15),
987 };
988 
989 struct wiphy {
990 
991 	struct device				*dev;
992 	struct mac_address			*addresses;
993 	int					n_addresses;
994 	uint32_t				flags;
995 	struct ieee80211_supported_band		*bands[NUM_NL80211_BANDS];
996 	uint8_t					perm_addr[ETH_ALEN];
997 	uint16_t				max_scan_ie_len;
998 
999 	/* XXX TODO */
1000 	const struct cfg80211_pmsr_capabilities	*pmsr_capa;
1001 	const struct cfg80211_sar_capa		*sar_capa;
1002 	const struct wiphy_iftype_ext_capab	*iftype_ext_capab;
1003 	const struct linuxkpi_ieee80211_regdomain *regd;
1004 	char					fw_version[ETHTOOL_FWVERS_LEN];
1005 	const struct ieee80211_iface_combination *iface_combinations;
1006 	const uint32_t				*cipher_suites;
1007 	int					n_iface_combinations;
1008 	int					n_cipher_suites;
1009 	void(*reg_notifier)(struct wiphy *, struct regulatory_request *);
1010 	enum cfg80211_regulatory		regulatory_flags;
1011 	int					n_vendor_commands;
1012 	const struct wiphy_vendor_command	*vendor_commands;
1013 	const struct ieee80211_txrx_stypes	*mgmt_stypes;
1014 	uint32_t				rts_threshold;
1015 	uint32_t				frag_threshold;
1016 	struct tid_config_support		tid_config_support;
1017 
1018 	int	available_antennas_rx, available_antennas_tx;
1019 	int	features, hw_version;
1020 	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;
1021 	int	num_iftype_ext_capab;
1022 	int	max_ap_assoc_sta, probe_resp_offload, software_iftypes;
1023 	int     bss_select_support, max_num_pmkids, retry_long, retry_short, signal_type;
1024 	int	max_data_retry_count;
1025 	int     tx_queue_len, rfkill;
1026 	int	mbssid_max_interfaces;
1027 
1028 	unsigned long				ext_features[BITS_TO_LONGS(NUM_NL80211_EXT_FEATURES)];
1029 	struct dentry				*debugfsdir;
1030 	struct cfg80211_wowlan_support		*wowlan;
1031 	/* Lower layer (driver/mac80211) specific data. */
1032 	/* Must stay last. */
1033 	uint8_t					priv[0] __aligned(CACHE_LINE_SIZE);
1034 };
1035 
1036 struct wireless_dev {
1037 		/* XXX TODO, like ic? */
1038 	int		iftype;
1039 	int     address;
1040 	struct net_device			*netdev;
1041 	struct wiphy				*wiphy;
1042 };
1043 
1044 struct cfg80211_ops {
1045 	/* XXX TODO */
1046 	struct wireless_dev *(*add_virtual_intf)(struct wiphy *, const char *, unsigned char, enum nl80211_iftype, struct vif_params *);
1047 	int (*del_virtual_intf)(struct wiphy *,  struct wireless_dev *);
1048 	s32 (*change_virtual_intf)(struct wiphy *,  struct net_device *, enum nl80211_iftype, struct vif_params *);
1049 	s32 (*scan)(struct wiphy *,  struct cfg80211_scan_request *);
1050 	s32 (*set_wiphy_params)(struct wiphy *,  u32);
1051 	s32 (*join_ibss)(struct wiphy *,  struct net_device *, struct cfg80211_ibss_params *);
1052 	s32 (*leave_ibss)(struct wiphy *,  struct net_device *);
1053 	s32 (*get_station)(struct wiphy *, struct net_device *, const u8 *, struct station_info *);
1054 	int (*dump_station)(struct wiphy *,  struct net_device *, int,  u8 *,  struct station_info *);
1055 	s32 (*set_tx_power)(struct wiphy *,  struct wireless_dev *, enum nl80211_tx_power_setting,  s32);
1056 	s32 (*get_tx_power)(struct wiphy *,  struct wireless_dev *, s32 *);
1057 	s32 (*add_key)(struct wiphy *,  struct net_device *, u8,  bool,  const u8 *, struct key_params *);
1058 	s32 (*del_key)(struct wiphy *,  struct net_device *, u8,  bool,  const u8 *);
1059 	s32 (*get_key)(struct wiphy *,  struct net_device *,  u8, bool,  const u8 *,  void *, void(*)(void *, struct key_params *));
1060 	s32 (*set_default_key)(struct wiphy *,  struct net_device *, u8,  bool,  bool);
1061 	s32 (*set_default_mgmt_key)(struct wiphy *, struct net_device *,  u8);
1062 	s32 (*set_power_mgmt)(struct wiphy *,  struct net_device *, bool,  s32);
1063 	s32 (*connect)(struct wiphy *,  struct net_device *, struct cfg80211_connect_params *);
1064 	s32 (*disconnect)(struct wiphy *,  struct net_device *, u16);
1065 	s32 (*suspend)(struct wiphy *, struct cfg80211_wowlan *);
1066 	s32 (*resume)(struct wiphy *);
1067 	s32 (*set_pmksa)(struct wiphy *, struct net_device *, struct cfg80211_pmksa *);
1068 	s32 (*del_pmksa)(struct wiphy *, struct net_device *, struct cfg80211_pmksa *);
1069 	s32 (*flush_pmksa)(struct wiphy *,  struct net_device *);
1070 	s32 (*start_ap)(struct wiphy *,  struct net_device *, struct cfg80211_ap_settings *);
1071 	int (*stop_ap)(struct wiphy *,  struct net_device *);
1072 	s32 (*change_beacon)(struct wiphy *,  struct net_device *, struct cfg80211_beacon_data *);
1073 	int (*del_station)(struct wiphy *,  struct net_device *, struct station_del_parameters *);
1074 	int (*change_station)(struct wiphy *,  struct net_device *, const u8 *,  struct station_parameters *);
1075 	int (*sched_scan_start)(struct wiphy *, struct net_device *, struct cfg80211_sched_scan_request *);
1076 	int (*sched_scan_stop)(struct wiphy *, struct net_device *,  u64);
1077 	void (*update_mgmt_frame_registrations)(struct wiphy *, struct wireless_dev *, struct mgmt_frame_regs *);
1078 	int (*mgmt_tx)(struct wiphy *,  struct wireless_dev *, struct cfg80211_mgmt_tx_params *,  u64 *);
1079 	int (*cancel_remain_on_channel)(struct wiphy *, struct wireless_dev *, u64);
1080 	int (*get_channel)(struct wiphy *, struct wireless_dev *, struct cfg80211_chan_def *);
1081 	int (*crit_proto_start)(struct wiphy *, struct wireless_dev *, enum nl80211_crit_proto_id, u16);
1082 	void (*crit_proto_stop)(struct wiphy *, struct wireless_dev *);
1083 	int (*tdls_oper)(struct wiphy *, struct net_device *,  const u8 *, enum nl80211_tdls_operation);
1084 	int (*update_connect_params)(struct wiphy *, struct net_device *, struct cfg80211_connect_params *, u32);
1085 	int (*set_pmk)(struct wiphy *,  struct net_device *, const struct cfg80211_pmk_conf *);
1086 	int (*del_pmk)(struct wiphy *,  struct net_device *, const u8 *);
1087 	int (*remain_on_channel)(struct wiphy *,  struct wireless_dev *, struct linuxkpi_ieee80211_channel *, unsigned int,  u64 *);
1088 	int (*start_p2p_device)(struct wiphy *,  struct wireless_dev *);
1089 	void (*stop_p2p_device)(struct wiphy *,  struct wireless_dev *);
1090 };
1091 
1092 
1093 /* -------------------------------------------------------------------------- */
1094 
1095 /* linux_80211.c */
1096 
1097 struct wiphy *linuxkpi_wiphy_new(const struct cfg80211_ops *, size_t);
1098 void linuxkpi_wiphy_free(struct wiphy *wiphy);
1099 
1100 int linuxkpi_regulatory_set_wiphy_regd_sync(struct wiphy *wiphy,
1101     struct linuxkpi_ieee80211_regdomain *regd);
1102 uint32_t linuxkpi_ieee80211_channel_to_frequency(uint32_t, enum nl80211_band);
1103 uint32_t linuxkpi_ieee80211_frequency_to_channel(uint32_t, uint32_t);
1104 struct linuxkpi_ieee80211_channel *
1105     linuxkpi_ieee80211_get_channel(struct wiphy *, uint32_t);
1106 void linuxkpi_cfg80211_bss_flush(struct wiphy *);
1107 
1108 /* -------------------------------------------------------------------------- */
1109 
1110 static __inline struct wiphy *
1111 wiphy_new(const struct cfg80211_ops *ops, size_t priv_len)
1112 {
1113 
1114 	return (linuxkpi_wiphy_new(ops, priv_len));
1115 }
1116 
1117 static __inline void
1118 wiphy_free(struct wiphy *wiphy)
1119 {
1120 
1121 	linuxkpi_wiphy_free(wiphy);
1122 }
1123 
1124 static __inline void *
1125 wiphy_priv(struct wiphy *wiphy)
1126 {
1127 
1128 	return (wiphy->priv);
1129 }
1130 
1131 static __inline void
1132 set_wiphy_dev(struct wiphy *wiphy, struct device *dev)
1133 {
1134 
1135 	wiphy->dev = dev;
1136 }
1137 
1138 static __inline struct device *
1139 wiphy_dev(struct wiphy *wiphy)
1140 {
1141 
1142 	return (wiphy->dev);
1143 }
1144 
1145 #define	wiphy_err(_wiphy, _fmt, ...)					\
1146     dev_err((_wiphy)->dev, _fmt, __VA_ARGS__)
1147 
1148 static __inline const struct linuxkpi_ieee80211_regdomain *
1149 wiphy_dereference(struct wiphy *wiphy,
1150     const struct linuxkpi_ieee80211_regdomain *regd)
1151 {
1152 	TODO();
1153         return (NULL);
1154 }
1155 
1156 static __inline void
1157 wiphy_lock(struct wiphy *wiphy)
1158 {
1159 	TODO();
1160 }
1161 
1162 static __inline void
1163 wiphy_unlock(struct wiphy *wiphy)
1164 {
1165 	TODO();
1166 }
1167 
1168 static __inline void
1169 wiphy_rfkill_set_hw_state_reason(struct wiphy *wiphy, bool blocked,
1170     enum rfkill_hard_block_reasons reason)
1171 {
1172 	TODO();
1173 }
1174 
1175 /* -------------------------------------------------------------------------- */
1176 
1177 static __inline bool
1178 rfkill_blocked(int rfkill)		/* argument type? */
1179 {
1180 	TODO();
1181 	return (false);
1182 }
1183 
1184 static __inline bool
1185 rfkill_soft_blocked(int rfkill)
1186 {
1187 	TODO();
1188 	return (false);
1189 }
1190 
1191 static __inline int
1192 reg_query_regdb_wmm(uint8_t *alpha2, uint32_t center_freq,
1193     struct ieee80211_reg_rule *rule)
1194 {
1195 
1196 	/* ETSI has special rules. FreeBSD regdb needs to learn about them. */
1197 	TODO();
1198 
1199 	return (-ENXIO);
1200 }
1201 
1202 static __inline const u8 *
1203 cfg80211_find_ie_match(uint32_t f, const u8 *ies, size_t ies_len,
1204     const u8 *match, int x, int y)
1205 {
1206 	TODO();
1207 	return (NULL);
1208 }
1209 
1210 static __inline const u8 *
1211 cfg80211_find_ie(uint8_t eid, const uint8_t *ie, uint32_t ielen)
1212 {
1213 	TODO();
1214 	return (NULL);
1215 }
1216 
1217 static __inline void
1218 cfg80211_pmsr_complete(struct wireless_dev *wdev,
1219     struct cfg80211_pmsr_request *req, gfp_t gfp)
1220 {
1221 	TODO();
1222 }
1223 
1224 static __inline void
1225 cfg80211_pmsr_report(struct wireless_dev *wdev,
1226     struct cfg80211_pmsr_request *req,
1227     struct cfg80211_pmsr_result *result, gfp_t gfp)
1228 {
1229 	TODO();
1230 }
1231 
1232 static __inline void
1233 cfg80211_chandef_create(struct cfg80211_chan_def *chandef,
1234     struct linuxkpi_ieee80211_channel *chan, enum nl80211_chan_flags chan_flag)
1235 {
1236 
1237 	KASSERT(chandef != NULL, ("%s: chandef is NULL\n", __func__));
1238 	KASSERT(chan != NULL, ("%s: chan is NULL\n", __func__));
1239 
1240 	memset(chandef, 0, sizeof(*chandef));
1241 	chandef->chan = chan;
1242 	chandef->center_freq2 = 0;	/* Set here and only overwrite if needed. */
1243 
1244 	switch (chan_flag) {
1245 	case NL80211_CHAN_NO_HT:
1246 		chandef->width = NL80211_CHAN_WIDTH_20_NOHT;
1247 		chandef->center_freq1 = chan->center_freq;
1248 		break;
1249 	default:
1250 		IMPROVE("Also depends on our manual settings");
1251 		if (chan->flags & IEEE80211_CHAN_NO_HT40)
1252 			chandef->width = NL80211_CHAN_WIDTH_20;
1253 		else if (chan->flags & IEEE80211_CHAN_NO_80MHZ)
1254 			chandef->width = NL80211_CHAN_WIDTH_40;
1255 		else if (chan->flags & IEEE80211_CHAN_NO_160MHZ)
1256 			chandef->width = NL80211_CHAN_WIDTH_80;
1257 		else {
1258 			chandef->width = NL80211_CHAN_WIDTH_160;
1259 			IMPROVE("80P80 and 320 ...");
1260 		}
1261 		chandef->center_freq1 = chan->center_freq;
1262 		break;
1263 	};
1264 }
1265 
1266 static __inline void
1267 cfg80211_bss_iter(struct wiphy *wiphy, struct cfg80211_chan_def *chandef,
1268     void (*iterfunc)(struct wiphy *, struct cfg80211_bss *, void *), void *data)
1269 {
1270 	TODO();
1271 }
1272 
1273 struct element {
1274 	uint8_t					id;
1275 	uint8_t					datalen;
1276 	uint8_t					data[0];
1277 } __packed;
1278 
1279 static __inline const struct element *
1280 cfg80211_find_elem(enum ieee80211_eid eid, uint8_t *data, size_t len)
1281 {
1282 	TODO();
1283 	return (NULL);
1284 }
1285 
1286 static __inline uint32_t
1287 cfg80211_calculate_bitrate(struct rate_info *rate)
1288 {
1289 	TODO();
1290 	return (-1);
1291 }
1292 
1293 static __inline uint32_t
1294 ieee80211_channel_to_frequency(uint32_t channel, enum nl80211_band band)
1295 {
1296 
1297 	return (linuxkpi_ieee80211_channel_to_frequency(channel, band));
1298 }
1299 
1300 static __inline uint32_t
1301 ieee80211_frequency_to_channel(uint32_t freq)
1302 {
1303 
1304 	return (linuxkpi_ieee80211_frequency_to_channel(freq, 0));
1305 }
1306 
1307 static __inline int
1308 regulatory_set_wiphy_regd_sync(struct wiphy *wiphy,
1309     struct linuxkpi_ieee80211_regdomain *regd)
1310 {
1311 	IMPROVE();
1312 	return (linuxkpi_regulatory_set_wiphy_regd_sync(wiphy, regd));
1313 }
1314 
1315 static __inline int
1316 regulatory_set_wiphy_regd_sync_rtnl(struct wiphy *wiphy,
1317     struct linuxkpi_ieee80211_regdomain *regd)
1318 {
1319 
1320 	IMPROVE();
1321 	return (linuxkpi_regulatory_set_wiphy_regd_sync(wiphy, regd));
1322 }
1323 
1324 static __inline int
1325 regulatory_set_wiphy_regd(struct wiphy *wiphy,
1326     struct linuxkpi_ieee80211_regdomain *regd)
1327 {
1328 
1329 	IMPROVE();
1330 	if (regd == NULL)
1331 		return (EINVAL);
1332 
1333 	/* XXX-BZ wild guessing here based on brcmfmac. */
1334 	if (wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED)
1335 		wiphy->regd = regd;
1336 	else
1337 		return (EPERM);
1338 
1339 	/* XXX FIXME, do we have to do anything with reg_notifier? */
1340 	return (0);
1341 }
1342 
1343 static __inline int
1344 regulatory_hint(struct wiphy *wiphy, const uint8_t *alpha2)
1345 {
1346 	TODO();
1347 	return (-ENXIO);
1348 }
1349 
1350 static __inline const char *
1351 reg_initiator_name(enum nl80211_reg_initiator initiator)
1352 {
1353 	TODO();
1354 	return (NULL);
1355 }
1356 
1357 static __inline struct linuxkpi_ieee80211_regdomain *
1358 rtnl_dereference(const struct linuxkpi_ieee80211_regdomain *regd)
1359 {
1360 	TODO();
1361 	return (NULL);
1362 }
1363 
1364 static __inline struct ieee80211_reg_rule *
1365 freq_reg_info(struct wiphy *wiphy, uint32_t center_freq)
1366 {
1367 	TODO();
1368 	return (NULL);
1369 }
1370 
1371 static __inline struct cfg80211_bss *
1372 cfg80211_get_bss(struct wiphy *wiphy, struct linuxkpi_ieee80211_channel *chan,
1373     const uint8_t *bssid, void *p, int x, uint32_t f1, uint32_t f2)
1374 {
1375 	TODO();
1376 	return (NULL);
1377 }
1378 
1379 static __inline void
1380 cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss)
1381 {
1382 	TODO();
1383 }
1384 
1385 static __inline void
1386 wiphy_apply_custom_regulatory(struct wiphy *wiphy,
1387     const struct linuxkpi_ieee80211_regdomain *regd)
1388 {
1389 	TODO();
1390 }
1391 
1392 static __inline char *
1393 wiphy_name(struct wiphy *wiphy)
1394 {
1395 	if (wiphy != NULL && wiphy->dev != NULL)
1396 		return dev_name(wiphy->dev);
1397 	else {
1398 		IMPROVE("wlanNA");
1399 		return ("wlanNA");
1400 	}
1401 }
1402 
1403 static __inline void
1404 wiphy_read_of_freq_limits(struct wiphy *wiphy)
1405 {
1406 #ifdef FDT
1407 	TODO();
1408 #endif
1409 }
1410 
1411 static __inline uint8_t *
1412 cfg80211_find_vendor_ie(unsigned int oui, u8 oui_type,
1413     uint8_t *data, size_t len)
1414 {
1415 	TODO();
1416 	return (NULL);
1417 }
1418 
1419 static __inline void
1420 wiphy_ext_feature_set(struct wiphy *wiphy, enum nl80211_ext_feature ef)
1421 {
1422 
1423 	set_bit(ef, wiphy->ext_features);
1424 }
1425 
1426 static __inline void *
1427 wiphy_net(struct wiphy *wiphy)
1428 {
1429 	TODO();
1430 	return (NULL);	/* XXX passed to dev_net_set() */
1431 }
1432 
1433 static __inline int
1434 wiphy_register(struct wiphy *wiphy)
1435 {
1436 	TODO();
1437 	return (0);
1438 }
1439 
1440 static __inline void
1441 wiphy_unregister(struct wiphy *wiphy)
1442 {
1443 	TODO();
1444 }
1445 
1446 static __inline void
1447 wiphy_warn(struct wiphy *wiphy, const char *fmt, ...)
1448 {
1449 	TODO();
1450 }
1451 
1452 static __inline int
1453 cfg80211_check_combinations(struct wiphy *wiphy,
1454     struct iface_combination_params *params)
1455 {
1456 	TODO();
1457 	return (-ENOENT);
1458 }
1459 
1460 static __inline uint8_t
1461 cfg80211_classify8021d(struct sk_buff *skb, void *p)
1462 {
1463 	TODO();
1464 	return (0);
1465 }
1466 
1467 static __inline void
1468 cfg80211_connect_done(struct net_device *ndev,
1469     struct cfg80211_connect_resp_params *conn_params, gfp_t gfp)
1470 {
1471 	TODO();
1472 }
1473 
1474 static __inline void
1475 cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp)
1476 {
1477 	TODO();
1478 }
1479 
1480 static __inline void
1481 cfg80211_disconnected(struct net_device *ndev, uint16_t reason,
1482     void *p, int x, bool locally_generated, gfp_t gfp)
1483 {
1484 	TODO();
1485 }
1486 
1487 static __inline int
1488 cfg80211_get_p2p_attr(const u8 *ie, u32 ie_len,
1489     enum ieee80211_p2p_attr_ids attr, u8 *p, size_t p_len)
1490 {
1491 	TODO();
1492 	return (-1);
1493 }
1494 
1495 static __inline void
1496 cfg80211_ibss_joined(struct net_device *ndev, const uint8_t *addr,
1497     struct linuxkpi_ieee80211_channel *chan, gfp_t gfp)
1498 {
1499 	TODO();
1500 }
1501 
1502 static __inline struct cfg80211_bss *
1503 cfg80211_inform_bss(struct wiphy *wiphy,
1504     struct linuxkpi_ieee80211_channel *channel,
1505     enum cfg80211_bss_frame_type bss_ftype, const uint8_t *bss, int _x,
1506     uint16_t cap, uint16_t intvl, const uint8_t *ie, size_t ie_len,
1507     int signal, gfp_t gfp)
1508 {
1509 	TODO();
1510 	return (NULL);
1511 }
1512 
1513 static __inline struct cfg80211_bss *
1514 cfg80211_inform_bss_data(struct wiphy *wiphy,
1515     struct cfg80211_inform_bss *bss_data,
1516     enum cfg80211_bss_frame_type bss_ftype, const uint8_t *bss, int _x,
1517     uint16_t cap, uint16_t intvl, const uint8_t *ie, size_t ie_len, gfp_t gfp)
1518 {
1519 	TODO();
1520 	return (NULL);
1521 }
1522 
1523 static __inline void
1524 cfg80211_mgmt_tx_status(struct wireless_dev *wdev, uint64_t cookie,
1525     const u8 *buf, size_t len, bool ack, gfp_t gfp)
1526 {
1527 	TODO();
1528 }
1529 
1530 static __inline void
1531 cfg80211_michael_mic_failure(struct net_device *ndev, const uint8_t *addr,
1532     enum nl80211_key_type key_type, int _x, void *p, gfp_t gfp)
1533 {
1534 	TODO();
1535 }
1536 
1537 static __inline void
1538 cfg80211_new_sta(struct net_device *ndev, const uint8_t *addr,
1539     struct station_info *sinfo, gfp_t gfp)
1540 {
1541 	TODO();
1542 }
1543 
1544 static __inline void
1545 cfg80211_del_sta(struct net_device *ndev, const uint8_t *addr, gfp_t gfp)
1546 {
1547 	TODO();
1548 }
1549 
1550 static __inline void
1551 cfg80211_port_authorized(struct net_device *ndev, const uint8_t *bssid,
1552     gfp_t gfp)
1553 {
1554 	TODO();
1555 }
1556 
1557 static __inline void
1558 cfg80211_ready_on_channel(struct wireless_dev *wdev, uint64_t cookie,
1559     struct linuxkpi_ieee80211_channel *channel, unsigned int duration,
1560     gfp_t gfp)
1561 {
1562 	TODO();
1563 }
1564 
1565 static __inline void
1566 cfg80211_remain_on_channel_expired(struct wireless_dev *wdev,
1567     uint64_t cookie, struct linuxkpi_ieee80211_channel *channel, gfp_t gfp)
1568 {
1569 	TODO();
1570 }
1571 
1572 static __inline void
1573 cfg80211_report_wowlan_wakeup(void)
1574 {
1575 	TODO();
1576 }
1577 
1578 static __inline void
1579 cfg80211_roamed(struct net_device *ndev, struct cfg80211_roam_info *roam_info,
1580     gfp_t gfp)
1581 {
1582 	TODO();
1583 }
1584 
1585 static __inline void
1586 cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int _x,
1587     uint8_t *p, size_t p_len, int _x2)
1588 {
1589 	TODO();
1590 }
1591 
1592 static __inline void
1593 cfg80211_scan_done(struct cfg80211_scan_request *scan_request,
1594     struct cfg80211_scan_info *info)
1595 {
1596 	TODO();
1597 }
1598 
1599 static __inline void
1600 cfg80211_sched_scan_results(struct wiphy *wiphy, uint64_t reqid)
1601 {
1602 	TODO();
1603 }
1604 
1605 static __inline void
1606 cfg80211_sched_scan_stopped(struct wiphy *wiphy, int _x)
1607 {
1608 	TODO();
1609 }
1610 
1611 static __inline void
1612 cfg80211_unregister_wdev(struct wireless_dev *wdev)
1613 {
1614 	TODO();
1615 }
1616 
1617 static __inline struct sk_buff *
1618 cfg80211_vendor_cmd_alloc_reply_skb(struct wiphy *wiphy, unsigned int len)
1619 {
1620 	TODO();
1621 	return (NULL);
1622 }
1623 
1624 static __inline int
1625 cfg80211_vendor_cmd_reply(struct sk_buff *skb)
1626 {
1627 	TODO();
1628 	return (-ENXIO);
1629 }
1630 
1631 static __inline struct linuxkpi_ieee80211_channel *
1632 ieee80211_get_channel(struct wiphy *wiphy, uint32_t freq)
1633 {
1634 
1635 	return (linuxkpi_ieee80211_get_channel(wiphy, freq));
1636 }
1637 
1638 static __inline size_t
1639 ieee80211_get_hdrlen_from_skb(struct sk_buff *skb)
1640 {
1641 
1642 	TODO();
1643 	return (-1);
1644 }
1645 
1646 static __inline void
1647 cfg80211_bss_flush(struct wiphy *wiphy)
1648 {
1649 
1650 	linuxkpi_cfg80211_bss_flush(wiphy);
1651 }
1652 
1653 static __inline bool
1654 cfg80211_channel_is_psc(struct linuxkpi_ieee80211_channel *channel)
1655 {
1656 
1657 	/* Only 6Ghz. */
1658 	if (channel->band != NL80211_BAND_6GHZ)
1659 		return (false);
1660 
1661 	TODO();
1662 	return (false);
1663 }
1664 
1665 static __inline int
1666 cfg80211_get_ies_channel_number(const uint8_t *ie, size_t len,
1667     enum nl80211_band band, enum cfg80211_bss_frame_type ftype)
1668 {
1669 
1670 	TODO();
1671 	return (-1);
1672 }
1673 
1674 /* Used for scanning at least. */
1675 static __inline void
1676 get_random_mask_addr(uint8_t *dst, const uint8_t *addr, const uint8_t *mask)
1677 {
1678 	int i;
1679 
1680 	/* Get a completely random address and then overlay what we want. */
1681 	get_random_bytes(dst, ETH_ALEN);
1682 	for (i = 0; i < ETH_ALEN; i++)
1683 		dst[i] = (dst[i] & ~(mask[i])) | (addr[i] & mask[i]);
1684 }
1685 
1686 static __inline void
1687 cfg80211_shutdown_all_interfaces(struct wiphy *wiphy)
1688 {
1689 	TODO();
1690 }
1691 
1692 static __inline bool
1693 cfg80211_reg_can_beacon(struct wiphy *wiphy, struct cfg80211_chan_def *chandef,
1694     enum nl80211_iftype iftype)
1695 {
1696 	TODO();
1697 	return (false);
1698 }
1699 
1700 static __inline void
1701 cfg80211_background_radar_event(struct wiphy *wiphy,
1702     struct cfg80211_chan_def *chandef, gfp_t gfp)
1703 {
1704 	TODO();
1705 }
1706 
1707 static __inline const u8 *
1708 cfg80211_find_ext_ie(uint8_t eid, uint8_t *p, size_t len)
1709 {
1710 	TODO();
1711 	return (NULL);
1712 }
1713 
1714 static __inline bool
1715 cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef)
1716 {
1717 	TODO();
1718 	return (false);
1719 }
1720 
1721 #define	wiphy_info(wiphy, fmt, ...)					\
1722 	printf("%s:%d XXX TODO " fmt, __func__, __LINE__, __VA_ARGS__)
1723 
1724 #ifndef LINUXKPI_NET80211
1725 #define	ieee80211_channel		linuxkpi_ieee80211_channel
1726 #define	ieee80211_regdomain		linuxkpi_ieee80211_regdomain
1727 #endif
1728 
1729 #include <net/mac80211.h>
1730 
1731 #endif	/* _LINUXKPI_NET_CFG80211_H */
1732