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