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