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