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