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