xref: /freebsd/sys/compat/linuxkpi/common/include/net/mac80211.h (revision 734e82fe33aa764367791a7d603b383996c6b40b)
1 /*-
2  * Copyright (c) 2020-2023 The FreeBSD Foundation
3  * Copyright (c) 2020-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_MAC80211_H
31 #define	_LINUXKPI_NET_MAC80211_H
32 
33 #include <sys/types.h>
34 
35 #include <asm/atomic64.h>
36 #include <linux/bitops.h>
37 #include <linux/etherdevice.h>
38 #include <linux/ethtool.h>
39 #include <linux/netdevice.h>
40 #include <linux/skbuff.h>
41 #include <linux/workqueue.h>
42 #include <linux/dcache.h>
43 #include <net/cfg80211.h>
44 
45 #define	ARPHRD_IEEE80211_RADIOTAP		__LINE__ /* XXX TODO brcmfmac */
46 
47 #define	WLAN_OUI_MICROSOFT			(0x0050F2)
48 #define	WLAN_OUI_TYPE_MICROSOFT_WPA		(1)
49 #define	WLAN_OUI_TYPE_MICROSOFT_TPC		(8)
50 #define	WLAN_OUI_TYPE_WFA_P2P			(9)
51 #define	WLAN_OUI_WFA				(0x506F9A)
52 
53 #define	IEEE80211_LINK_UNSPECIFIED		0x0f
54 
55 /* hw->conf.flags */
56 enum ieee80211_hw_conf_flags {
57 	IEEE80211_CONF_IDLE			= BIT(0),
58 	IEEE80211_CONF_PS			= BIT(1),
59 	IEEE80211_CONF_MONITOR			= BIT(2),
60 	IEEE80211_CONF_OFFCHANNEL		= BIT(3),
61 };
62 
63 /* (*ops->config()) */
64 enum ieee80211_hw_conf_changed_flags {
65 	IEEE80211_CONF_CHANGE_CHANNEL		= BIT(0),
66 	IEEE80211_CONF_CHANGE_IDLE		= BIT(1),
67 	IEEE80211_CONF_CHANGE_PS		= BIT(2),
68 	IEEE80211_CONF_CHANGE_MONITOR		= BIT(3),
69 	IEEE80211_CONF_CHANGE_POWER		= BIT(4),
70 };
71 
72 #define	CFG80211_TESTMODE_CMD(_x)	/* XXX TODO */
73 #define	CFG80211_TESTMODE_DUMP(_x)	/* XXX TODO */
74 
75 #define	FCS_LEN				4
76 
77 /* ops.configure_filter() */
78 enum mcast_filter_flags {
79 	FIF_ALLMULTI			= BIT(0),
80 	FIF_PROBE_REQ			= BIT(1),
81 	FIF_BCN_PRBRESP_PROMISC		= BIT(2),
82 	FIF_FCSFAIL			= BIT(3),
83 	FIF_OTHER_BSS			= BIT(4),
84 	FIF_PSPOLL			= BIT(5),
85 	FIF_CONTROL			= BIT(6),
86 };
87 
88 enum ieee80211_bss_changed {
89 	BSS_CHANGED_ARP_FILTER		= BIT(0),
90 	BSS_CHANGED_ASSOC		= BIT(1),
91 	BSS_CHANGED_BANDWIDTH		= BIT(2),
92 	BSS_CHANGED_BEACON		= BIT(3),
93 	BSS_CHANGED_BEACON_ENABLED	= BIT(4),
94 	BSS_CHANGED_BEACON_INFO		= BIT(5),
95 	BSS_CHANGED_BEACON_INT		= BIT(6),
96 	BSS_CHANGED_BSSID		= BIT(7),
97 	BSS_CHANGED_CQM			= BIT(8),
98 	BSS_CHANGED_ERP_CTS_PROT	= BIT(9),
99 	BSS_CHANGED_ERP_SLOT		= BIT(10),
100 	BSS_CHANGED_FTM_RESPONDER	= BIT(11),
101 	BSS_CHANGED_HT			= BIT(12),
102 	BSS_CHANGED_IDLE		= BIT(13),
103 	BSS_CHANGED_MU_GROUPS		= BIT(14),
104 	BSS_CHANGED_P2P_PS		= BIT(15),
105 	BSS_CHANGED_PS			= BIT(16),
106 	BSS_CHANGED_QOS			= BIT(17),
107 	BSS_CHANGED_TXPOWER		= BIT(18),
108 	BSS_CHANGED_HE_BSS_COLOR	= BIT(19),
109 	BSS_CHANGED_AP_PROBE_RESP	= BIT(20),
110 	BSS_CHANGED_BASIC_RATES		= BIT(21),
111 	BSS_CHANGED_ERP_PREAMBLE	= BIT(22),
112 	BSS_CHANGED_IBSS		= BIT(23),
113 	BSS_CHANGED_MCAST_RATE		= BIT(24),
114 	BSS_CHANGED_SSID		= BIT(25),
115 	BSS_CHANGED_FILS_DISCOVERY	= BIT(26),
116 	BSS_CHANGED_HE_OBSS_PD		= BIT(27),
117 	BSS_CHANGED_TWT			= BIT(28),
118 	BSS_CHANGED_UNSOL_BCAST_PROBE_RESP = BIT(30),
119 	BSS_CHANGED_EHT_PUNCTURING	= BIT(31),
120 };
121 
122 /* 802.11 Figure 9-256 Suite selector format. [OUI(3), SUITE TYPE(1)] */
123 #define	WLAN_CIPHER_SUITE_OUI(_oui, _x)	(((_oui) << 8) | ((_x) & 0xff))
124 
125 /* 802.11 Table 9-131 Cipher suite selectors. */
126 /* 802.1x suite B			11 */
127 #define	WLAN_CIPHER_SUITE(_x)		WLAN_CIPHER_SUITE_OUI(0x000fac, _x)
128 /* Use group				0 */
129 #define	WLAN_CIPHER_SUITE_WEP40		WLAN_CIPHER_SUITE(1)
130 #define	WLAN_CIPHER_SUITE_TKIP		WLAN_CIPHER_SUITE(2)
131 /* Reserved				3 */
132 #define	WLAN_CIPHER_SUITE_CCMP		WLAN_CIPHER_SUITE(4)	/* CCMP-128 */
133 #define	WLAN_CIPHER_SUITE_WEP104	WLAN_CIPHER_SUITE(5)
134 #define	WLAN_CIPHER_SUITE_AES_CMAC	WLAN_CIPHER_SUITE(6)	/* BIP-CMAC-128 */
135 /* Group addressed traffic not allowed	7 */
136 #define	WLAN_CIPHER_SUITE_GCMP		WLAN_CIPHER_SUITE(8)
137 #define	WLAN_CIPHER_SUITE_GCMP_256	WLAN_CIPHER_SUITE(9)
138 #define	WLAN_CIPHER_SUITE_CCMP_256	WLAN_CIPHER_SUITE(10)
139 #define	WLAN_CIPHER_SUITE_BIP_GMAC_128	WLAN_CIPHER_SUITE(11)
140 #define	WLAN_CIPHER_SUITE_BIP_GMAC_256	WLAN_CIPHER_SUITE(12)
141 #define	WLAN_CIPHER_SUITE_BIP_CMAC_256	WLAN_CIPHER_SUITE(13)
142 /* Reserved				14-255 */
143 
144 /* See ISO/IEC JTC 1 N 9880 Table 11 */
145 #define	WLAN_CIPHER_SUITE_SMS4		WLAN_CIPHER_SUITE_OUI(0x001472, 1)
146 
147 
148 /* 802.11 Table 9-133 AKM suite selectors. */
149 #define	WLAN_AKM_SUITE(_x)		WLAN_CIPHER_SUITE_OUI(0x000fac, _x)
150 /* Reserved				0 */
151 #define	WLAN_AKM_SUITE_8021X		WLAN_AKM_SUITE(1)
152 #define	WLAN_AKM_SUITE_PSK		WLAN_AKM_SUITE(2)
153 #define	WLAN_AKM_SUITE_FT_8021X		WLAN_AKM_SUITE(3)
154 #define	WLAN_AKM_SUITE_FT_PSK		WLAN_AKM_SUITE(4)
155 #define	WLAN_AKM_SUITE_8021X_SHA256	WLAN_AKM_SUITE(5)
156 #define	WLAN_AKM_SUITE_PSK_SHA256	WLAN_AKM_SUITE(6)
157 /* TDLS					7 */
158 #define	WLAN_AKM_SUITE_SAE		WLAN_AKM_SUITE(8)
159 /* FToSAE				9 */
160 /* AP peer key				10 */
161 /* 802.1x suite B			11 */
162 /* 802.1x suite B 384			12 */
163 /* FTo802.1x 384			13 */
164 /* Reserved				14-255 */
165 /* Apparently 11ax defines more. Seen (19,20) mentioned. */
166 
167 #define	TKIP_PN_TO_IV16(_x)		((uint16_t)(_x & 0xffff))
168 #define	TKIP_PN_TO_IV32(_x)		((uint32_t)((_x >> 16) & 0xffffffff))
169 
170 struct ieee80211_sta;
171 
172 /* 802.11-2020 9.4.2.55.3 A-MPDU Parameters field */
173 #define	IEEE80211_HT_AMPDU_PARM_FACTOR		0x3
174 #define	IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT	2
175 #define	IEEE80211_HT_AMPDU_PARM_DENSITY		(0x7 << IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT)
176 
177 struct ieee80211_ampdu_params {
178 	/* TODO FIXME */
179 	struct ieee80211_sta			*sta;
180 	uint8_t					tid;
181 	uint16_t				ssn;
182 	int		action, amsdu, buf_size, timeout;
183 };
184 
185 struct ieee80211_bar {
186 	/* TODO FIXME */
187 	int		control, start_seq_num;
188 	uint8_t		*ra;
189 	uint16_t	frame_control;
190 };
191 
192 struct ieee80211_p2p_noa_desc {
193 	uint32_t				count;		/* uint8_t ? */
194 	uint32_t				duration;
195 	uint32_t				interval;
196 	uint32_t				start_time;
197 };
198 
199 struct ieee80211_p2p_noa_attr {
200 	uint8_t					index;
201 	uint8_t					oppps_ctwindow;
202 	struct ieee80211_p2p_noa_desc		desc[4];
203 };
204 
205 struct ieee80211_mutable_offsets {
206 	/* TODO FIXME */
207 	uint16_t				tim_offset;
208 	uint16_t				cntdwn_counter_offs[2];
209 
210 	int	mbssid_off;
211 };
212 
213 struct mac80211_fils_discovery {
214 	uint32_t				max_interval;
215 };
216 
217 struct ieee80211_chanctx_conf {
218 	/* TODO FIXME */
219 	int		rx_chains_dynamic, rx_chains_static;
220 	bool					radar_enabled;
221 	struct cfg80211_chan_def		def;
222 	struct cfg80211_chan_def		min_def;
223 
224 	/* Must stay last. */
225 	uint8_t					drv_priv[0] __aligned(CACHE_LINE_SIZE);
226 };
227 
228 struct ieee80211_rate_status {
229 	struct rate_info			rate_idx;
230 	uint8_t					try_count;
231 };
232 
233 struct ieee80211_ema_beacons {
234 	uint8_t					cnt;
235 	struct {
236 		struct sk_buff			*skb;
237 		struct ieee80211_mutable_offsets offs;
238 	} bcn[0];
239 };
240 
241 #define	WLAN_MEMBERSHIP_LEN			(8)
242 #define	WLAN_USER_POSITION_LEN			(16)
243 
244 struct ieee80211_bss_conf {
245 	/* TODO FIXME */
246 	struct ieee80211_vif			*vif;
247 	const uint8_t				*bssid;
248 	uint8_t					addr[ETH_ALEN];
249 	uint8_t					link_id;
250 	uint8_t					_pad0;
251 	uint8_t					transmitter_bssid[ETH_ALEN];
252 	struct ieee80211_ftm_responder_params	*ftmr_params;
253 	struct ieee80211_p2p_noa_attr		p2p_noa_attr;
254 	struct cfg80211_chan_def		chandef;
255 	__be32					arp_addr_list[1];	/* XXX TODO */
256 	struct ieee80211_rate			*beacon_rate;
257 	struct {
258 		uint8_t membership[WLAN_MEMBERSHIP_LEN];
259 		uint8_t position[WLAN_USER_POSITION_LEN];
260 	}  mu_group;
261 	struct {
262 		uint32_t			params;
263 		/* single field struct? */
264 	} he_oper;
265 	struct cfg80211_he_bss_color		he_bss_color;
266 	struct ieee80211_he_obss_pd		he_obss_pd;
267 
268 	bool					ht_ldpc;
269 	bool					vht_ldpc;
270 	bool					he_ldpc;
271 	bool					vht_mu_beamformee;
272 	bool					vht_mu_beamformer;
273 	bool					vht_su_beamformee;
274 	bool					vht_su_beamformer;
275 	bool					he_mu_beamformer;
276 	bool					he_su_beamformee;
277 	bool					he_su_beamformer;
278 	bool					he_full_ul_mumimo;
279 	bool					eht_su_beamformee;
280 	bool					eht_su_beamformer;
281 	bool					eht_mu_beamformer;
282 
283 	size_t					ssid_len;
284 	uint8_t					ssid[IEEE80211_NWID_LEN];
285 	uint16_t				aid;
286 	uint16_t				ht_operation_mode;
287 	int					arp_addr_cnt;
288 	uint16_t				eht_puncturing;
289 
290 	uint8_t					dtim_period;
291 	uint8_t					sync_dtim_count;
292 	bool					assoc;
293 	bool					idle;
294 	bool					qos;
295 	bool					ps;
296 	bool					twt_broadcast;
297 	bool					use_cts_prot;
298 	bool					use_short_preamble;
299 	bool					use_short_slot;
300 	bool					he_support;
301 	bool					eht_support;
302 	bool					csa_active;
303 	bool					mu_mimo_owner;
304 	uint32_t				sync_device_ts;
305 	uint64_t				sync_tsf;
306 	uint16_t				beacon_int;
307 	int16_t					txpower;
308 	uint32_t				basic_rates;
309 	int					mcast_rate[NUM_NL80211_BANDS];
310 	enum ieee80211_reg_ap_power 		power_type;
311 	struct cfg80211_bitrate_mask		beacon_tx_rate;
312 	struct mac80211_fils_discovery		fils_discovery;
313 	struct ieee80211_chanctx_conf		*chanctx_conf;
314 	struct ieee80211_vif			*mbssid_tx_vif;
315 
316 	int		ack_enabled, bssid_index, bssid_indicator, cqm_rssi_hyst, cqm_rssi_thold, ema_ap, frame_time_rts_th, ftm_responder;
317 	int		htc_trig_based_pkt_ext;
318 	int		multi_sta_back_32bit, nontransmitted;
319 	int		profile_periodicity;
320 	int		twt_requester, uora_exists, uora_ocw_range;
321 	int		assoc_capability, enable_beacon, hidden_ssid, ibss_joined, twt_protected;
322 	int		twt_responder, unsol_bcast_probe_resp_interval;
323 	int		color_change_active;
324 };
325 
326 struct ieee80211_channel_switch {
327 	/* TODO FIXME */
328 	int		block_tx, count, delay, device_timestamp, timestamp;
329 	struct cfg80211_chan_def		chandef;
330 };
331 
332 struct ieee80211_cipher_scheme {
333 	uint32_t	cipher;
334 	uint8_t		iftype;		/* We do not know the size of this. */
335 	uint8_t		hdr_len;
336 	uint8_t		pn_len;
337 	uint8_t		pn_off;
338 	uint8_t		key_idx_off;
339 	uint8_t		key_idx_mask;
340 	uint8_t		key_idx_shift;
341 	uint8_t		mic_len;
342 };
343 
344 enum ieee80211_event_type {
345 	BA_FRAME_TIMEOUT,
346 	BAR_RX_EVENT,
347 	MLME_EVENT,
348 	RSSI_EVENT,
349 };
350 
351 enum ieee80211_rssi_event_data {
352 	RSSI_EVENT_LOW,
353 	RSSI_EVENT_HIGH,
354 };
355 
356 enum ieee80211_mlme_event_data {
357 	ASSOC_EVENT,
358 	AUTH_EVENT,
359 	DEAUTH_RX_EVENT,
360 	DEAUTH_TX_EVENT,
361 };
362 
363 enum ieee80211_mlme_event_status {
364 	MLME_DENIED,
365 	MLME_TIMEOUT,
366 };
367 
368 struct ieee80211_mlme_event {
369 	enum ieee80211_mlme_event_data		data;
370 	enum ieee80211_mlme_event_status	status;
371 	int					reason;
372 };
373 
374 struct ieee80211_event {
375 	/* TODO FIXME */
376 	enum ieee80211_event_type		type;
377 	union {
378 		struct {
379 			int     ssn;
380 			struct ieee80211_sta	*sta;
381 			uint8_t		 	tid;
382 		} ba;
383 		struct ieee80211_mlme_event	mlme;
384 	} u;
385 };
386 
387 struct ieee80211_ftm_responder_params {
388 	/* TODO FIXME */
389 	uint8_t					*lci;
390 	uint8_t					*civicloc;
391 	int					lci_len;
392 	int					civicloc_len;
393 };
394 
395 struct ieee80211_he_mu_edca_param_ac_rec {
396 	/* TODO FIXME */
397 	int		aifsn, ecw_min_max, mu_edca_timer;
398 };
399 
400 struct ieee80211_conf {
401 	int					dynamic_ps_timeout;
402 	int					power_level;
403 	uint32_t				listen_interval;
404 	bool					radar_enabled;
405 	enum ieee80211_hw_conf_flags		flags;
406 	struct cfg80211_chan_def		chandef;
407 };
408 
409 enum ieee80211_hw_flags {
410 	IEEE80211_HW_AMPDU_AGGREGATION,
411 	IEEE80211_HW_AP_LINK_PS,
412 	IEEE80211_HW_BUFF_MMPDU_TXQ,
413 	IEEE80211_HW_CHANCTX_STA_CSA,
414 	IEEE80211_HW_CONNECTION_MONITOR,
415 	IEEE80211_HW_DEAUTH_NEED_MGD_TX_PREP,
416 	IEEE80211_HW_HAS_RATE_CONTROL,
417 	IEEE80211_HW_MFP_CAPABLE,
418 	IEEE80211_HW_NEEDS_UNIQUE_STA_ADDR,
419 	IEEE80211_HW_REPORTS_TX_ACK_STATUS,
420 	IEEE80211_HW_RX_INCLUDES_FCS,
421 	IEEE80211_HW_SIGNAL_DBM,
422 	IEEE80211_HW_SINGLE_SCAN_ON_ALL_BANDS,
423 	IEEE80211_HW_SPECTRUM_MGMT,
424 	IEEE80211_HW_STA_MMPDU_TXQ,
425 	IEEE80211_HW_SUPPORTS_AMSDU_IN_AMPDU,
426 	IEEE80211_HW_SUPPORTS_CLONED_SKBS,
427 	IEEE80211_HW_SUPPORTS_DYNAMIC_PS,
428 	IEEE80211_HW_SUPPORTS_MULTI_BSSID,
429 	IEEE80211_HW_SUPPORTS_ONLY_HE_MULTI_BSSID,
430 	IEEE80211_HW_SUPPORTS_PS,
431 	IEEE80211_HW_SUPPORTS_REORDERING_BUFFER,
432 	IEEE80211_HW_SUPPORTS_VHT_EXT_NSS_BW,
433 	IEEE80211_HW_SUPPORT_FAST_XMIT,
434 	IEEE80211_HW_TDLS_WIDER_BW,
435 	IEEE80211_HW_TIMING_BEACON_ONLY,
436 	IEEE80211_HW_TX_AMPDU_SETUP_IN_HW,
437 	IEEE80211_HW_TX_AMSDU,
438 	IEEE80211_HW_TX_FRAG_LIST,
439 	IEEE80211_HW_USES_RSS,
440 	IEEE80211_HW_WANT_MONITOR_VIF,
441 	IEEE80211_HW_SW_CRYPTO_CONTROL,
442 	IEEE80211_HW_SUPPORTS_TX_FRAG,
443 	IEEE80211_HW_SUPPORTS_TDLS_BUFFER_STA,
444 	IEEE80211_HW_SUPPORTS_PER_STA_GTK,
445 	IEEE80211_HW_REPORTS_LOW_ACK,
446 	IEEE80211_HW_QUEUE_CONTROL,
447 	IEEE80211_HW_SUPPORTS_RX_DECAP_OFFLOAD,
448 	IEEE80211_HW_SUPPORTS_TX_ENCAP_OFFLOAD,
449 	IEEE80211_HW_SUPPORTS_RC_TABLE,
450 	IEEE80211_HW_DETECTS_COLOR_COLLISION,
451 
452 	/* Keep last. */
453 	NUM_IEEE80211_HW_FLAGS
454 };
455 
456 struct ieee80211_hw {
457 
458 	struct wiphy			*wiphy;
459 
460 	/* TODO FIXME */
461 	int		max_rx_aggregation_subframes, max_tx_aggregation_subframes;
462 	int		extra_tx_headroom, weight_multiplier;
463 	int		max_rate_tries, max_rates, max_report_rates;
464 	struct ieee80211_cipher_scheme	*cipher_schemes;
465 	int				n_cipher_schemes;
466 	const char			*rate_control_algorithm;
467 	struct {
468 		uint16_t units_pos;	/* radiotap "spec" is .. inconsistent. */
469 		uint16_t accuracy;
470 	} radiotap_timestamp;
471 	size_t				sta_data_size;
472 	size_t				vif_data_size;
473 	size_t				chanctx_data_size;
474 	size_t				txq_data_size;
475 	uint16_t			radiotap_mcs_details;
476 	uint16_t			radiotap_vht_details;
477 	uint16_t			queues;
478 	uint16_t			offchannel_tx_hw_queue;
479 	uint16_t			uapsd_max_sp_len;
480 	uint16_t			uapsd_queues;
481 	uint16_t			max_tx_fragments;
482 	uint16_t			max_listen_interval;
483 	uint32_t			extra_beacon_tailroom;
484 	netdev_features_t		netdev_features;
485 	unsigned long			flags[BITS_TO_LONGS(NUM_IEEE80211_HW_FLAGS)];
486 	struct ieee80211_conf		conf;
487 
488 #if 0	/* leave here for documentation purposes.  This does NOT work. */
489 	/* Must stay last. */
490 	uint8_t				priv[0] __aligned(CACHE_LINE_SIZE);
491 #else
492 	void				*priv;
493 #endif
494 };
495 
496 enum ieee802111_key_flag {
497 	IEEE80211_KEY_FLAG_GENERATE_IV		= BIT(0),
498 	IEEE80211_KEY_FLAG_GENERATE_MMIC	= BIT(1),
499 	IEEE80211_KEY_FLAG_PAIRWISE		= BIT(2),
500 	IEEE80211_KEY_FLAG_PUT_IV_SPACE		= BIT(3),
501 	IEEE80211_KEY_FLAG_PUT_MIC_SPACE	= BIT(4),
502 	IEEE80211_KEY_FLAG_SW_MGMT_TX		= BIT(5),
503 	IEEE80211_KEY_FLAG_GENERATE_IV_MGMT	= BIT(6),
504 	IEEE80211_KEY_FLAG_GENERATE_MMIE	= BIT(7),
505 	IEEE80211_KEY_FLAG_RESERVE_TAILROOM	= BIT(8),
506 };
507 
508 struct ieee80211_key_conf {
509 	atomic64_t			tx_pn;
510 	uint32_t			cipher;
511 	uint8_t				icv_len;	/* __unused nowadays? */
512 	uint8_t				iv_len;
513 	uint8_t				hw_key_idx;	/* Set by drv. */
514 	uint8_t				keyidx;
515 	uint16_t			flags;
516 	uint8_t				keylen;
517 	uint8_t				key[0];
518 	int8_t				link_id;	/* signed! */
519 };
520 
521 struct ieee80211_key_seq {
522 	/* TODO FIXME */
523 	union {
524 		struct {
525 			uint8_t		seq[IEEE80211_MAX_PN_LEN];
526 			uint8_t		seq_len;
527 		} hw;
528 		struct {
529 			uint8_t		pn[IEEE80211_CCMP_PN_LEN];
530 		} ccmp;
531 		struct {
532 			uint8_t		pn[IEEE80211_CCMP_PN_LEN];
533 		} aes_cmac;
534 		struct {
535 			uint32_t	iv32;
536 			uint16_t	iv16;
537 		} tkip;
538 	};
539 };
540 
541 
542 enum ieee80211_rx_status_flags {
543 	RX_FLAG_ALLOW_SAME_PN		= BIT(0),
544 	RX_FLAG_AMPDU_DETAILS		= BIT(1),
545 	RX_FLAG_AMPDU_EOF_BIT		= BIT(2),
546 	RX_FLAG_AMPDU_EOF_BIT_KNOWN	= BIT(3),
547 	RX_FLAG_DECRYPTED		= BIT(4),
548 	RX_FLAG_DUP_VALIDATED		= BIT(5),
549 	RX_FLAG_FAILED_FCS_CRC		= BIT(6),
550 	RX_FLAG_ICV_STRIPPED		= BIT(7),
551 	RX_FLAG_MACTIME_PLCP_START	= BIT(8),
552 	RX_FLAG_MACTIME_START		= BIT(9),
553 	RX_FLAG_MIC_STRIPPED		= BIT(10),
554 	RX_FLAG_MMIC_ERROR		= BIT(11),
555 	RX_FLAG_MMIC_STRIPPED		= BIT(12),
556 	RX_FLAG_NO_PSDU			= BIT(13),
557 	RX_FLAG_PN_VALIDATED		= BIT(14),
558 	RX_FLAG_RADIOTAP_HE		= BIT(15),
559 	RX_FLAG_RADIOTAP_HE_MU		= BIT(16),
560 	RX_FLAG_RADIOTAP_LSIG		= BIT(17),
561 	RX_FLAG_RADIOTAP_VENDOR_DATA	= BIT(18),
562 	RX_FLAG_NO_SIGNAL_VAL		= BIT(19),
563 	RX_FLAG_IV_STRIPPED		= BIT(20),
564 	RX_FLAG_AMPDU_IS_LAST		= BIT(21),
565 	RX_FLAG_AMPDU_LAST_KNOWN	= BIT(22),
566 	RX_FLAG_AMSDU_MORE		= BIT(23),
567 	RX_FLAG_MACTIME_END		= BIT(24),
568 	RX_FLAG_ONLY_MONITOR		= BIT(25),
569 	RX_FLAG_SKIP_MONITOR		= BIT(26),
570 	RX_FLAG_8023			= BIT(27),
571 	RX_FLAG_RADIOTAP_TLV_AT_END	= BIT(28),
572 };
573 
574 enum mac80211_rx_encoding {
575 	RX_ENC_LEGACY		= 0,
576 	RX_ENC_HT,
577 	RX_ENC_VHT,
578 	RX_ENC_HE,
579 	RX_ENC_EHT,
580 };
581 
582 struct ieee80211_rx_status {
583 	/* TODO FIXME, this is too large. Over-reduce types to u8 where possible. */
584 	union {
585 		uint64_t			boottime_ns;
586 		int64_t				ack_tx_hwtstamp;
587 	};
588 	uint64_t			mactime;
589 	uint32_t			device_timestamp;
590 	enum ieee80211_rx_status_flags	flag;
591 	uint16_t			freq;
592 	uint8_t				encoding:3, bw:4;	/* enum mac80211_rx_encoding, rate_info_bw */	/* See mt76.h */
593 	uint8_t				ampdu_reference;
594 	uint8_t				band;
595 	uint8_t				chains;
596 	int8_t				chain_signal[IEEE80211_MAX_CHAINS];
597 	int8_t				signal;
598 	uint8_t				enc_flags;
599 	union {
600 		struct {
601 			uint8_t		he_ru:3;	/* nl80211::enum nl80211_he_ru_alloc */
602 			uint8_t		he_gi:2;	/* nl80211::enum nl80211_he_gi */
603 			uint8_t		he_dcm:1;
604 		};
605 		struct {
606 			uint8_t		ru:4;		/* nl80211::enum nl80211_eht_ru_alloc */
607 			uint8_t		gi:2;		/* nl80211::enum nl80211_eht_gi */
608 		} eht;
609 	};
610 	bool				link_valid;
611 	uint8_t				link_id;	/* very incosistent sizes? */
612 	uint8_t				zero_length_psdu_type;
613 	uint8_t				nss;
614 	uint8_t				rate_idx;
615 };
616 
617 struct ieee80211_tx_status {
618 	struct ieee80211_sta		*sta;
619 	struct ieee80211_tx_info	*info;
620 	int64_t				ack_hwtstamp;
621 
622 	u8				n_rates;
623 	struct ieee80211_rate_status	*rates;
624 
625 	struct sk_buff			*skb;
626 	struct list_head		*free_list;
627 };
628 
629 struct ieee80211_scan_ies {
630 	/* TODO FIXME */
631 	int		common_ie_len;
632 	int		len[NUM_NL80211_BANDS];
633 	uint8_t		*common_ies;
634 	uint8_t		*ies[NUM_NL80211_BANDS];
635 };
636 
637 struct ieee80211_scan_request {
638 	struct ieee80211_scan_ies	ies;
639 	struct cfg80211_scan_request	req;
640 };
641 
642 struct ieee80211_txq {
643 	struct ieee80211_sta		*sta;
644 	struct ieee80211_vif		*vif;
645 	int				ac;
646 	uint8_t				tid;
647 
648 	/* Must stay last. */
649 	uint8_t				drv_priv[0] __aligned(CACHE_LINE_SIZE);
650 };
651 
652 struct ieee80211_sta_rates {
653 	/* XXX TODO */
654 	/* XXX some _rcu thing */
655 	struct {
656 		int	idx;
657 		int	flags;
658 	} rate[1];		/* XXX what is the real number? */
659 };
660 
661 struct ieee80211_sta_txpwr {
662 	/* XXX TODO */
663 	enum nl80211_tx_power_setting	type;
664 	short				power;
665 };
666 
667 #define	IEEE80211_NUM_TIDS			16	/* net80211::WME_NUM_TID */
668 struct ieee80211_sta_agg {
669 	uint16_t				max_amsdu_len;
670 	uint16_t				max_rc_amsdu_len;
671 	uint16_t				max_tid_amsdu_len[IEEE80211_NUM_TIDS];
672 };
673 
674 struct ieee80211_link_sta {
675 	uint8_t					addr[ETH_ALEN];
676 	uint8_t					link_id;
677 	uint32_t				supp_rates[NUM_NL80211_BANDS];
678 	struct ieee80211_sta_ht_cap		ht_cap;
679 	struct ieee80211_sta_vht_cap		vht_cap;
680 	struct ieee80211_sta_he_cap		he_cap;
681 	struct ieee80211_sta_he_6ghz_capa	he_6ghz_capa;
682 	struct ieee80211_sta_eht_cap		eht_cap;
683 	uint8_t					rx_nss;
684 	enum ieee80211_sta_rx_bw		bandwidth;
685 	enum ieee80211_smps_mode		smps_mode;
686 	struct ieee80211_sta_agg		agg;
687 	struct ieee80211_sta_txpwr		txpwr;
688 };
689 
690 struct ieee80211_sta {
691 	/* TODO FIXME */
692 	int		max_amsdu_subframes;
693 	int		mfp, smps_mode, tdls, tdls_initiator;
694 	struct ieee80211_txq			*txq[IEEE80211_NUM_TIDS + 1];	/* iwlwifi: 8 and adds +1 to tid_data, net80211::IEEE80211_TID_SIZE */
695 	struct ieee80211_sta_rates		*rates;	/* some rcu thing? */
696 	uint8_t					addr[ETH_ALEN];
697 	uint16_t				aid;
698 	bool					wme;
699 	uint8_t					max_sp;
700 	uint8_t					uapsd_queues;
701 	uint16_t				valid_links;
702 
703 	struct ieee80211_link_sta		deflink;
704 	struct ieee80211_link_sta		*link[IEEE80211_MLD_MAX_NUM_LINKS];	/* rcu? */
705 
706 #ifndef __FOR_LATER_DRV_UPDATE
707 	uint16_t				max_rc_amsdu_len;
708 	uint16_t				max_amsdu_len;
709 	uint16_t				max_tid_amsdu_len[IEEE80211_NUM_TIDS];
710 #endif
711 
712 	/* Must stay last. */
713 	uint8_t					drv_priv[0] __aligned(CACHE_LINE_SIZE);
714 };
715 
716 struct ieee80211_tdls_ch_sw_params {
717 	/* TODO FIXME */
718 	int		action_code, ch_sw_tm_ie, status, switch_time, switch_timeout, timestamp;
719 	struct ieee80211_sta			*sta;
720 	struct cfg80211_chan_def		*chandef;
721 	struct sk_buff				*tmpl_skb;
722 };
723 
724 struct ieee80211_tx_control {
725 	/* TODO FIXME */
726 	struct ieee80211_sta			*sta;
727 };
728 
729 struct ieee80211_tx_queue_params {
730 	/* These types are based on iwlwifi FW structs. */
731 	uint16_t	cw_min;
732 	uint16_t	cw_max;
733 	uint16_t	txop;
734 	uint8_t		aifs;
735 
736 	/* TODO FIXME */
737 	int		acm, mu_edca, uapsd;
738 	struct ieee80211_he_mu_edca_param_ac_rec	mu_edca_param_rec;
739 };
740 
741 struct ieee80211_tx_rate {
742 	uint8_t		idx;
743 	uint16_t	count:5,
744 			flags:11;
745 };
746 
747 enum ieee80211_vif_driver_flags {
748 	IEEE80211_VIF_BEACON_FILTER		= BIT(0),
749 	IEEE80211_VIF_SUPPORTS_CQM_RSSI		= BIT(1),
750 	IEEE80211_VIF_SUPPORTS_UAPSD		= BIT(2),
751 	IEEE80211_VIF_DISABLE_SMPS_OVERRIDE	= BIT(3),
752 };
753 
754 #define	IEEE80211_BSS_ARP_ADDR_LIST_LEN		4
755 
756 struct ieee80211_vif_cfg {
757 	uint16_t				aid;
758 	uint16_t				eml_cap;
759 	uint16_t				eml_med_sync_delay;
760 	bool					assoc;
761 	bool					ps;
762 	bool					idle;
763 	bool					ibss_joined;
764 	int					arp_addr_cnt;
765 	size_t					ssid_len;
766 	uint32_t				arp_addr_list[IEEE80211_BSS_ARP_ADDR_LIST_LEN];		/* big endian */
767 	uint8_t					ssid[IEEE80211_NWID_LEN];
768 	uint8_t					ap_addr[ETH_ALEN];
769 };
770 
771 struct ieee80211_vif {
772 	/* TODO FIXME */
773 	enum nl80211_iftype		type;
774 	int		csa_active, mu_mimo_owner;
775 	int		cab_queue;
776 	int     color_change_active, offload_flags;
777 	enum ieee80211_vif_driver_flags	driver_flags;
778 	bool				p2p;
779 	bool				probe_req_reg;
780 	uint8_t				addr[ETH_ALEN];
781 	struct ieee80211_vif_cfg	cfg;
782 	struct ieee80211_chanctx_conf	*chanctx_conf;
783 	struct ieee80211_txq		*txq;
784 	struct ieee80211_bss_conf	bss_conf;
785 	struct ieee80211_bss_conf	*link_conf[IEEE80211_MLD_MAX_NUM_LINKS];	/* rcu? */
786 	uint8_t				hw_queue[IEEE80211_NUM_ACS];
787 	uint16_t			active_links;
788 	uint16_t			valid_links;
789 	struct ieee80211_vif		*mbssid_tx_vif;
790 
791 /* #ifdef CONFIG_MAC80211_DEBUGFS */	/* Do not change structure depending on compile-time option. */
792 	struct dentry			*debugfs_dir;
793 /* #endif */
794 
795 	/* Must stay last. */
796 	uint8_t				drv_priv[0] __aligned(CACHE_LINE_SIZE);
797 };
798 
799 struct ieee80211_vif_chanctx_switch {
800 	struct ieee80211_chanctx_conf	*old_ctx, *new_ctx;
801 	struct ieee80211_vif		*vif;
802 	struct ieee80211_bss_conf	*link_conf;
803 };
804 
805 struct ieee80211_prep_tx_info {
806 	u16				duration;
807 	bool				success;
808 };
809 
810 /* XXX-BZ too big, over-reduce size to u8, and array sizes to minuimum to fit in skb->cb. */
811 /* Also warning: some sizes change by pointer size!  This is 64bit only. */
812 struct ieee80211_tx_info {
813 	enum ieee80211_tx_info_flags		flags;
814 	/* TODO FIXME */
815 	u8		band;
816 	u8		hw_queue;
817 	bool		tx_time_est;
818 	union {
819 		struct {
820 			struct ieee80211_tx_rate	rates[4];
821 			bool				use_rts;
822 			struct ieee80211_vif		*vif;
823 			struct ieee80211_key_conf	*hw_key;
824 			enum ieee80211_tx_control_flags	flags;
825 		} control;
826 		struct {
827 			struct ieee80211_tx_rate	rates[4];
828 			uint32_t			ack_signal;
829 			uint8_t				ampdu_ack_len;
830 			uint8_t				ampdu_len;
831 			uint8_t				antenna;
832 			uint16_t			tx_time;
833 			uint8_t				flags;
834 			void				*status_driver_data[16 / sizeof(void *)];		/* XXX TODO */
835 		} status;
836 #define	IEEE80211_TX_INFO_DRIVER_DATA_SIZE	40
837 		void					*driver_data[IEEE80211_TX_INFO_DRIVER_DATA_SIZE / sizeof(void *)];
838 	};
839 };
840 
841 /* net80211 conflict */
842 struct linuxkpi_ieee80211_tim_ie {
843 	uint8_t				dtim_count;
844 	uint8_t				dtim_period;
845 	uint8_t				bitmap_ctrl;
846 	uint8_t				*virtual_map;
847 };
848 #define	ieee80211_tim_ie	linuxkpi_ieee80211_tim_ie
849 
850 struct survey_info {		/* net80211::struct ieee80211_channel_survey */
851 	/* TODO FIXME */
852 	uint32_t			filled;
853 #define	SURVEY_INFO_TIME		0x0001
854 #define	SURVEY_INFO_TIME_RX		0x0002
855 #define	SURVEY_INFO_TIME_SCAN		0x0004
856 #define	SURVEY_INFO_TIME_TX		0x0008
857 #define	SURVEY_INFO_TIME_BSS_RX		0x0010
858 #define	SURVEY_INFO_TIME_BUSY		0x0020
859 #define	SURVEY_INFO_IN_USE		0x0040
860 #define	SURVEY_INFO_NOISE_DBM		0x0080
861 	uint32_t			noise;
862 	uint64_t			time;
863 	uint64_t			time_bss_rx;
864 	uint64_t			time_busy;
865 	uint64_t			time_rx;
866 	uint64_t			time_scan;
867 	uint64_t			time_tx;
868 	struct ieee80211_channel	*channel;
869 };
870 
871 enum ieee80211_iface_iter {
872 	IEEE80211_IFACE_ITER_NORMAL	= BIT(0),
873 	IEEE80211_IFACE_ITER_RESUME_ALL	= BIT(1),
874 	IEEE80211_IFACE_SKIP_SDATA_NOT_IN_DRIVER = BIT(2),	/* seems to be an iter flag */
875 	IEEE80211_IFACE_ITER_ACTIVE	= BIT(3),
876 
877 	/* Internal flags only. */
878 	IEEE80211_IFACE_ITER__ATOMIC	= BIT(6),
879 	IEEE80211_IFACE_ITER__MTX	= BIT(8),
880 };
881 
882 enum set_key_cmd {
883 	SET_KEY,
884 	DISABLE_KEY,
885 };
886 
887 /* 802.11-2020, 9.4.2.55.2 HT Capability Information field. */
888 enum rx_enc_flags {
889 	RX_ENC_FLAG_SHORTPRE	=	BIT(0),
890 	RX_ENC_FLAG_SHORT_GI	=	BIT(2),
891 	RX_ENC_FLAG_HT_GF	=	BIT(3),
892 	RX_ENC_FLAG_STBC_MASK	=	BIT(4) | BIT(5),
893 #define	RX_ENC_FLAG_STBC_SHIFT		4
894 	RX_ENC_FLAG_LDPC	=	BIT(6),
895 	RX_ENC_FLAG_BF		=	BIT(7),
896 };
897 
898 enum sta_notify_cmd {
899 	STA_NOTIFY_AWAKE,
900 	STA_NOTIFY_SLEEP,
901 };
902 
903 struct ieee80211_low_level_stats {
904 	/* Can we make them uint64_t? */
905 	uint32_t dot11ACKFailureCount;
906 	uint32_t dot11FCSErrorCount;
907 	uint32_t dot11RTSFailureCount;
908 	uint32_t dot11RTSSuccessCount;
909 };
910 
911 enum ieee80211_offload_flags {
912 	IEEE80211_OFFLOAD_ENCAP_4ADDR,
913 	IEEE80211_OFFLOAD_ENCAP_ENABLED,
914 	IEEE80211_OFFLOAD_DECAP_ENABLED,
915 };
916 
917 struct ieee80211_ops {
918 	/* TODO FIXME */
919 	int  (*start)(struct ieee80211_hw *);
920 	void (*stop)(struct ieee80211_hw *);
921 
922 	int  (*config)(struct ieee80211_hw *, u32);
923 	void (*reconfig_complete)(struct ieee80211_hw *, enum ieee80211_reconfig_type);
924 
925 	int  (*add_interface)(struct ieee80211_hw *, struct ieee80211_vif *);
926 	void (*remove_interface)(struct ieee80211_hw *, struct ieee80211_vif *);
927 	int  (*change_interface)(struct ieee80211_hw *, struct ieee80211_vif *, enum nl80211_iftype, bool);
928 
929 	void (*sw_scan_start)(struct ieee80211_hw *, struct ieee80211_vif *, const u8 *);
930 	void (*sw_scan_complete)(struct ieee80211_hw *, struct ieee80211_vif *);
931 	int  (*sched_scan_start)(struct ieee80211_hw *, struct ieee80211_vif *, struct cfg80211_sched_scan_request *, struct ieee80211_scan_ies *);
932 	int  (*sched_scan_stop)(struct ieee80211_hw *, struct ieee80211_vif *);
933 	int  (*hw_scan)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_scan_request *);
934 	void (*cancel_hw_scan)(struct ieee80211_hw *, struct ieee80211_vif *);
935 
936 	int  (*conf_tx)(struct ieee80211_hw *, struct ieee80211_vif *, u32, u16, const struct ieee80211_tx_queue_params *);
937 	void (*tx)(struct ieee80211_hw *, struct ieee80211_tx_control *, struct sk_buff *);
938 	int  (*tx_last_beacon)(struct ieee80211_hw *);
939 	void (*wake_tx_queue)(struct ieee80211_hw *, struct ieee80211_txq *);
940 
941 	void (*mgd_prepare_tx)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_prep_tx_info *);
942 	void (*mgd_complete_tx)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_prep_tx_info *);
943 	void (*mgd_protect_tdls_discover)(struct ieee80211_hw *, struct ieee80211_vif *);
944 
945 	void (*flush)(struct ieee80211_hw *, struct ieee80211_vif *, u32, bool);
946 	void (*flush_sta)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *);
947 
948 	int  (*set_frag_threshold)(struct ieee80211_hw *, u32);
949 
950 	void (*sync_rx_queues)(struct ieee80211_hw *);
951 
952 	void (*allow_buffered_frames)(struct ieee80211_hw *, struct ieee80211_sta *, u16, int, enum ieee80211_frame_release_type, bool);
953 	void (*release_buffered_frames)(struct ieee80211_hw *, struct ieee80211_sta *, u16, int, enum ieee80211_frame_release_type, bool);
954 
955 	int  (*sta_add)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *);
956 	int  (*sta_remove)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *);
957 	int  (*sta_set_txpwr)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *);
958 	void (*sta_statistics)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, struct station_info *);
959 	void (*sta_pre_rcu_remove)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *);
960 	int  (*sta_state)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, enum ieee80211_sta_state, enum ieee80211_sta_state);
961 	void (*sta_notify)(struct ieee80211_hw *, struct ieee80211_vif *, enum sta_notify_cmd, struct ieee80211_sta *);
962 	void (*sta_rc_update)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, u32);
963 	void (*sta_rate_tbl_update)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *);
964 	void (*sta_set_4addr)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, bool);
965 	void (*sta_set_decap_offload)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, bool);
966 
967 	u64  (*prepare_multicast)(struct ieee80211_hw *, struct netdev_hw_addr_list *);
968 
969 	int  (*ampdu_action)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_ampdu_params *);
970 
971 	bool (*can_aggregate_in_amsdu)(struct ieee80211_hw *, struct sk_buff *, struct sk_buff *);
972 
973 	int  (*pre_channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_channel_switch *);
974 	int  (*post_channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *);
975 	void (*channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_channel_switch *);
976 	void (*channel_switch_beacon)(struct ieee80211_hw *, struct ieee80211_vif *, struct cfg80211_chan_def *);
977 	void (*abort_channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *);
978 	void (*channel_switch_rx_beacon)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_channel_switch *);
979 	int  (*tdls_channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, u8, struct cfg80211_chan_def *, struct sk_buff *, u32);
980 	void (*tdls_cancel_channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *);
981 	void (*tdls_recv_channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_tdls_ch_sw_params *);
982 
983 	int  (*add_chanctx)(struct ieee80211_hw *, struct ieee80211_chanctx_conf *);
984 	void (*remove_chanctx)(struct ieee80211_hw *, struct ieee80211_chanctx_conf *);
985 	void (*change_chanctx)(struct ieee80211_hw *, struct ieee80211_chanctx_conf *, u32);
986 	int  (*assign_vif_chanctx)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_bss_conf *, struct ieee80211_chanctx_conf *);
987 	void (*unassign_vif_chanctx)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_bss_conf *, struct ieee80211_chanctx_conf *);
988 	int  (*switch_vif_chanctx)(struct ieee80211_hw *, struct ieee80211_vif_chanctx_switch *, int, enum ieee80211_chanctx_switch_mode);
989 
990 	int  (*get_antenna)(struct ieee80211_hw *, u32 *, u32 *);
991 	int  (*set_antenna)(struct ieee80211_hw *, u32, u32);
992 
993 	int  (*remain_on_channel)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_channel *, int, enum ieee80211_roc_type);
994 	int  (*cancel_remain_on_channel)(struct ieee80211_hw *, struct ieee80211_vif *);
995 
996 	void (*configure_filter)(struct ieee80211_hw *, unsigned int, unsigned int *, u64);
997 	void (*config_iface_filter)(struct ieee80211_hw *, struct ieee80211_vif *, unsigned int, unsigned int);
998 
999 	void (*bss_info_changed)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_bss_conf *, u64);
1000 	int  (*set_rts_threshold)(struct ieee80211_hw *, u32);
1001 	void (*event_callback)(struct ieee80211_hw *, struct ieee80211_vif *, const struct ieee80211_event *);
1002 	int  (*get_survey)(struct ieee80211_hw *, int, struct survey_info *);
1003 	int  (*get_ftm_responder_stats)(struct ieee80211_hw *, struct ieee80211_vif *, struct cfg80211_ftm_responder_stats *);
1004 
1005         uint64_t (*get_tsf)(struct ieee80211_hw *, struct ieee80211_vif *);
1006         void (*set_tsf)(struct ieee80211_hw *, struct ieee80211_vif *, uint64_t);
1007 	void (*offset_tsf)(struct ieee80211_hw *, struct ieee80211_vif *, s64);
1008 
1009 	int  (*set_bitrate_mask)(struct ieee80211_hw *, struct ieee80211_vif *, const struct cfg80211_bitrate_mask *);
1010 	void (*set_coverage_class)(struct ieee80211_hw *, s16);
1011 	int  (*set_tim)(struct ieee80211_hw *, struct ieee80211_sta *, bool);
1012 
1013 	int  (*set_key)(struct ieee80211_hw *, enum set_key_cmd, struct ieee80211_vif *, struct ieee80211_sta *, struct ieee80211_key_conf *);
1014 	void (*set_default_unicast_key)(struct ieee80211_hw *, struct ieee80211_vif *, int);
1015 	void (*update_tkip_key)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_key_conf *, struct ieee80211_sta *, u32, u16 *);
1016 	void (*set_rekey_data)(struct ieee80211_hw *, struct ieee80211_vif *, struct cfg80211_gtk_rekey_data *);
1017 
1018 	int  (*start_pmsr)(struct ieee80211_hw *, struct ieee80211_vif *, struct cfg80211_pmsr_request *);
1019 	void (*abort_pmsr)(struct ieee80211_hw *, struct ieee80211_vif *, struct cfg80211_pmsr_request *);
1020 
1021 	int  (*start_ap)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_bss_conf *link_conf);
1022 	void (*stop_ap)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_bss_conf *link_conf);
1023 	int  (*join_ibss)(struct ieee80211_hw *, struct ieee80211_vif *);
1024 	void (*leave_ibss)(struct ieee80211_hw *, struct ieee80211_vif *);
1025 
1026 	int  (*set_sar_specs)(struct ieee80211_hw *, const struct cfg80211_sar_specs *);
1027 
1028 	int  (*set_tid_config)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, struct cfg80211_tid_config *);
1029 	int  (*reset_tid_config)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, u8);
1030 
1031 	int  (*get_et_sset_count)(struct ieee80211_hw *, struct ieee80211_vif *, int);
1032 	void (*get_et_stats)(struct ieee80211_hw *, struct ieee80211_vif *, struct ethtool_stats *, u64 *);
1033 	void (*get_et_strings)(struct ieee80211_hw *, struct ieee80211_vif *, u32, u8 *);
1034 
1035 	void (*update_vif_offload)(struct ieee80211_hw *, struct ieee80211_vif *);
1036 
1037 	int  (*get_txpower)(struct ieee80211_hw *, struct ieee80211_vif *, int *);
1038 	int  (*get_stats)(struct ieee80211_hw *, struct ieee80211_low_level_stats *);
1039 
1040 	int  (*set_radar_background)(struct ieee80211_hw *, struct cfg80211_chan_def *);
1041 
1042 	void (*add_twt_setup)(struct ieee80211_hw *, struct ieee80211_sta *, struct ieee80211_twt_setup *);
1043 	void (*twt_teardown_request)(struct ieee80211_hw *, struct ieee80211_sta *, u8);
1044 
1045 	int (*set_hw_timestamp)(struct ieee80211_hw *, struct ieee80211_vif *, struct cfg80211_set_hw_timestamp *);
1046 
1047         void (*link_info_changed)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_bss_conf *, u64);
1048         void (*vif_cfg_changed)(struct ieee80211_hw *, struct ieee80211_vif *, u64);
1049 
1050 	int (*change_vif_links)(struct ieee80211_hw *, struct ieee80211_vif *, u16, u16, struct ieee80211_bss_conf *[IEEE80211_MLD_MAX_NUM_LINKS]);
1051 	int (*change_sta_links)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, u16, u16);
1052 
1053 /* #ifdef CONFIG_MAC80211_DEBUGFS */	/* Do not change depending on compile-time option. */
1054 	void (*sta_add_debugfs)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, struct dentry *);
1055 /* #endif */
1056 };
1057 
1058 
1059 /* -------------------------------------------------------------------------- */
1060 
1061 /* linux_80211.c */
1062 extern const struct cfg80211_ops linuxkpi_mac80211cfgops;
1063 
1064 struct ieee80211_hw *linuxkpi_ieee80211_alloc_hw(size_t,
1065     const struct ieee80211_ops *);
1066 void linuxkpi_ieee80211_iffree(struct ieee80211_hw *);
1067 void linuxkpi_set_ieee80211_dev(struct ieee80211_hw *, char *);
1068 int linuxkpi_ieee80211_ifattach(struct ieee80211_hw *);
1069 void linuxkpi_ieee80211_ifdetach(struct ieee80211_hw *);
1070 void linuxkpi_ieee80211_unregister_hw(struct ieee80211_hw *);
1071 struct ieee80211_hw * linuxkpi_wiphy_to_ieee80211_hw(struct wiphy *);
1072 void linuxkpi_ieee80211_restart_hw(struct ieee80211_hw *);
1073 void linuxkpi_ieee80211_iterate_interfaces(
1074     struct ieee80211_hw *hw, enum ieee80211_iface_iter flags,
1075     void(*iterfunc)(void *, uint8_t *, struct ieee80211_vif *),
1076     void *);
1077 void linuxkpi_ieee80211_iterate_keys(struct ieee80211_hw *,
1078     struct ieee80211_vif *,
1079     void(*iterfunc)(struct ieee80211_hw *, struct ieee80211_vif *,
1080         struct ieee80211_sta *, struct ieee80211_key_conf *, void *),
1081     void *);
1082 void linuxkpi_ieee80211_iterate_chan_contexts(struct ieee80211_hw *,
1083     void(*iterfunc)(struct ieee80211_hw *,
1084 	struct ieee80211_chanctx_conf *, void *),
1085     void *);
1086 void linuxkpi_ieee80211_iterate_stations_atomic(struct ieee80211_hw *,
1087    void (*iterfunc)(void *, struct ieee80211_sta *), void *);
1088 void linuxkpi_ieee80211_scan_completed(struct ieee80211_hw *,
1089     struct cfg80211_scan_info *);
1090 void linuxkpi_ieee80211_rx(struct ieee80211_hw *, struct sk_buff *,
1091     struct ieee80211_sta *, struct napi_struct *, struct list_head *);
1092 uint8_t linuxkpi_ieee80211_get_tid(struct ieee80211_hdr *, bool);
1093 struct ieee80211_sta *linuxkpi_ieee80211_find_sta(struct ieee80211_vif *,
1094     const u8 *);
1095 struct ieee80211_sta *linuxkpi_ieee80211_find_sta_by_ifaddr(
1096     struct ieee80211_hw *, const uint8_t *, const uint8_t *);
1097 struct sk_buff *linuxkpi_ieee80211_tx_dequeue(struct ieee80211_hw *,
1098     struct ieee80211_txq *);
1099 bool linuxkpi_ieee80211_is_ie_id_in_ie_buf(const u8, const u8 *, size_t);
1100 bool linuxkpi_ieee80211_ie_advance(size_t *, const u8 *, size_t);
1101 void linuxkpi_ieee80211_free_txskb(struct ieee80211_hw *, struct sk_buff *,
1102     int);
1103 void linuxkpi_ieee80211_queue_delayed_work(struct ieee80211_hw *,
1104     struct delayed_work *, int);
1105 void linuxkpi_ieee80211_queue_work(struct ieee80211_hw *, struct work_struct *);
1106 struct sk_buff *linuxkpi_ieee80211_pspoll_get(struct ieee80211_hw *,
1107     struct ieee80211_vif *);
1108 struct sk_buff *linuxkpi_ieee80211_nullfunc_get(struct ieee80211_hw *,
1109     struct ieee80211_vif *, int, bool);
1110 void linuxkpi_ieee80211_txq_get_depth(struct ieee80211_txq *, unsigned long *,
1111     unsigned long *);
1112 struct wireless_dev *linuxkpi_ieee80211_vif_to_wdev(struct ieee80211_vif *);
1113 void linuxkpi_ieee80211_connection_loss(struct ieee80211_vif *);
1114 void linuxkpi_ieee80211_beacon_loss(struct ieee80211_vif *);
1115 struct sk_buff *linuxkpi_ieee80211_probereq_get(struct ieee80211_hw *,
1116     uint8_t *, uint8_t *, size_t, size_t);
1117 void linuxkpi_ieee80211_tx_status(struct ieee80211_hw *, struct sk_buff *);
1118 void linuxkpi_ieee80211_tx_status_ext(struct ieee80211_hw *,
1119     struct ieee80211_tx_status *);
1120 void linuxkpi_ieee80211_stop_queues(struct ieee80211_hw *);
1121 void linuxkpi_ieee80211_wake_queues(struct ieee80211_hw *);
1122 void linuxkpi_ieee80211_stop_queue(struct ieee80211_hw *, int);
1123 void linuxkpi_ieee80211_wake_queue(struct ieee80211_hw *, int);
1124 void linuxkpi_ieee80211_txq_schedule_start(struct ieee80211_hw *, uint8_t);
1125 struct ieee80211_txq *linuxkpi_ieee80211_next_txq(struct ieee80211_hw *, uint8_t);
1126 void linuxkpi_ieee80211_schedule_txq(struct ieee80211_hw *,
1127     struct ieee80211_txq *, bool);
1128 
1129 /* -------------------------------------------------------------------------- */
1130 
1131 static __inline void
1132 _ieee80211_hw_set(struct ieee80211_hw *hw, enum ieee80211_hw_flags flag)
1133 {
1134 
1135 	set_bit(flag, hw->flags);
1136 }
1137 
1138 static __inline bool
1139 __ieee80211_hw_check(struct ieee80211_hw *hw, enum ieee80211_hw_flags flag)
1140 {
1141 
1142 	return (test_bit(flag, hw->flags));
1143 }
1144 
1145 /* They pass in shortened flag names; how confusingly inconsistent. */
1146 #define	ieee80211_hw_set(_hw, _flag)					\
1147 	_ieee80211_hw_set(_hw, IEEE80211_HW_ ## _flag)
1148 #define	ieee80211_hw_check(_hw, _flag)					\
1149 	__ieee80211_hw_check(_hw, IEEE80211_HW_ ## _flag)
1150 
1151 /* XXX-BZ add CTASSERTS that size of struct is <= sizeof skb->cb. */
1152 CTASSERT(sizeof(struct ieee80211_tx_info) <= sizeof(((struct sk_buff *)0)->cb));
1153 #define	IEEE80211_SKB_CB(_skb)						\
1154 	((struct ieee80211_tx_info *)((_skb)->cb))
1155 
1156 CTASSERT(sizeof(struct ieee80211_rx_status) <= sizeof(((struct sk_buff *)0)->cb));
1157 #define	IEEE80211_SKB_RXCB(_skb)					\
1158 	((struct ieee80211_rx_status *)((_skb)->cb))
1159 
1160 static __inline void
1161 ieee80211_free_hw(struct ieee80211_hw *hw)
1162 {
1163 
1164 	linuxkpi_ieee80211_iffree(hw);
1165 
1166 	if (hw->wiphy != NULL)
1167 		wiphy_free(hw->wiphy);
1168 	/* Note that *hw is not valid any longer after this. */
1169 
1170 	IMPROVE();
1171 }
1172 
1173 static __inline struct ieee80211_hw *
1174 ieee80211_alloc_hw(size_t priv_len, const struct ieee80211_ops *ops)
1175 {
1176 
1177 	return (linuxkpi_ieee80211_alloc_hw(priv_len, ops));
1178 }
1179 
1180 static __inline void
1181 SET_IEEE80211_DEV(struct ieee80211_hw *hw, struct device *dev)
1182 {
1183 
1184 	set_wiphy_dev(hw->wiphy, dev);
1185 	linuxkpi_set_ieee80211_dev(hw, dev_name(dev));
1186 
1187 	IMPROVE();
1188 }
1189 
1190 static __inline int
1191 ieee80211_register_hw(struct ieee80211_hw *hw)
1192 {
1193 	int error;
1194 
1195 	error = wiphy_register(hw->wiphy);
1196 	if (error != 0)
1197 		return (error);
1198 
1199 	/*
1200 	 * At this point the driver has set all the options, flags, bands,
1201 	 * ciphers, hw address(es), ... basically mac80211/cfg80211 hw/wiphy
1202 	 * setup is done.
1203 	 * We need to replicate a lot of information from here into net80211.
1204 	 */
1205 	error = linuxkpi_ieee80211_ifattach(hw);
1206 
1207 	IMPROVE();
1208 
1209 	return (error);
1210 }
1211 
1212 static inline void
1213 ieee80211_unregister_hw(struct ieee80211_hw *hw)
1214 {
1215 
1216 	linuxkpi_ieee80211_unregister_hw(hw);
1217 }
1218 
1219 static __inline struct ieee80211_hw *
1220 wiphy_to_ieee80211_hw(struct wiphy *wiphy)
1221 {
1222 
1223 	return (linuxkpi_wiphy_to_ieee80211_hw(wiphy));
1224 }
1225 
1226 static inline void
1227 ieee80211_restart_hw(struct ieee80211_hw *hw)
1228 {
1229 	linuxkpi_ieee80211_restart_hw(hw);
1230 }
1231 
1232 static inline void
1233 ieee80211_hw_restart_disconnect(struct ieee80211_vif *vif)
1234 {
1235 	TODO();
1236 }
1237 
1238 /* -------------------------------------------------------------------------- */
1239 
1240 #define	link_conf_dereference_check(_vif, _linkid)			\
1241     rcu_dereference_check((_vif)->link_conf[_linkid], true)
1242 
1243 #define	link_conf_dereference_protected(_vif, _linkid)			\
1244     rcu_dereference_protected((_vif)->link_conf[_linkid], true)
1245 
1246 #define	link_sta_dereference_check(_sta, _linkid)			\
1247     rcu_dereference_check((_sta)->link[_linkid], true)
1248 
1249 #define	link_sta_dereference_protected(_sta, _linkid)			\
1250     rcu_dereference_protected((_sta)->link[_linkid], true)
1251 
1252 #define	for_each_vif_active_link(_vif, _link, _linkid)			\
1253     for (_linkid = 0; _linkid < nitems((_vif)->link_conf); _linkid++)	\
1254 	if ( ((_vif)->active_links == 0 /* no MLO */ ||			\
1255 	    ((_vif)->active_links & BIT(_linkid)) != 0) &&		\
1256 	    (_link = rcu_dereference((_vif)->link_conf[_linkid])) )
1257 
1258 #define	for_each_sta_active_link(_vif, _sta, _linksta, _linkid)		\
1259     for (_linkid = 0; _linkid < nitems((_vif)->link_conf); _linkid++)	\
1260 	if ( ((_vif)->active_links == 0 /* no MLO */ ||			\
1261 	    ((_vif)->active_links & BIT(_linkid)) != 0) &&		\
1262 	    (_linksta = link_sta_dereference_protected((_sta), (_linkid))) )
1263 
1264 /* -------------------------------------------------------------------------- */
1265 
1266 static __inline bool
1267 ieee80211_is_action(__le16 fc)
1268 {
1269 	__le16 v;
1270 
1271 	fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK);
1272 	v = htole16(IEEE80211_FC0_SUBTYPE_ACTION | IEEE80211_FC0_TYPE_MGT);
1273 
1274 	return (fc == v);
1275 }
1276 
1277 static __inline bool
1278 ieee80211_is_probe_resp(__le16 fc)
1279 {
1280 	__le16 v;
1281 
1282 	fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK);
1283 	v = htole16(IEEE80211_FC0_SUBTYPE_PROBE_RESP | IEEE80211_FC0_TYPE_MGT);
1284 
1285 	return (fc == v);
1286 }
1287 
1288 static __inline bool
1289 ieee80211_is_auth(__le16 fc)
1290 {
1291 	__le16 v;
1292 
1293 	fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK);
1294 	v = htole16(IEEE80211_FC0_SUBTYPE_AUTH | IEEE80211_FC0_TYPE_MGT);
1295 
1296 	return (fc == v);
1297 }
1298 
1299 static __inline bool
1300 ieee80211_is_assoc_req(__le16 fc)
1301 {
1302 	__le16 v;
1303 
1304 	fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK);
1305 	v = htole16(IEEE80211_FC0_SUBTYPE_ASSOC_REQ | IEEE80211_FC0_TYPE_MGT);
1306 
1307 	return (fc == v);
1308 }
1309 
1310 static __inline bool
1311 ieee80211_is_assoc_resp(__le16 fc)
1312 {
1313 	__le16 v;
1314 
1315 	fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK);
1316 	v = htole16(IEEE80211_FC0_SUBTYPE_ASSOC_RESP | IEEE80211_FC0_TYPE_MGT);
1317 
1318 	return (fc == v);
1319 }
1320 
1321 static __inline bool
1322 ieee80211_is_reassoc_req(__le16 fc)
1323 {
1324 	__le16 v;
1325 
1326 	fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK);
1327 	v = htole16(IEEE80211_FC0_SUBTYPE_REASSOC_REQ | IEEE80211_FC0_TYPE_MGT);
1328 
1329 	return (fc == v);
1330 }
1331 
1332 static __inline bool
1333 ieee80211_is_reassoc_resp(__le16 fc)
1334 {
1335 	__le16 v;
1336 
1337 	fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK);
1338 	v = htole16(IEEE80211_FC0_SUBTYPE_REASSOC_RESP | IEEE80211_FC0_TYPE_MGT);
1339 
1340 	return (fc == v);
1341 }
1342 
1343 static __inline bool
1344 ieee80211_is_disassoc(__le16 fc)
1345 {
1346 	__le16 v;
1347 
1348 	fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK);
1349 	v = htole16(IEEE80211_FC0_SUBTYPE_DISASSOC | IEEE80211_FC0_TYPE_MGT);
1350 
1351 	return (fc == v);
1352 }
1353 
1354 static __inline bool
1355 ieee80211_is_data_present(__le16 fc)
1356 {
1357 	__le16 v;
1358 
1359 	/* If it is a data frame and NODATA is not present. */
1360 	fc &= htole16(IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_NODATA);
1361 	v = htole16(IEEE80211_FC0_TYPE_DATA);
1362 
1363 	return (fc == v);
1364 }
1365 
1366 static __inline bool
1367 ieee80211_is_deauth(__le16 fc)
1368 {
1369 	__le16 v;
1370 
1371 	fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK);
1372 	v = htole16(IEEE80211_FC0_SUBTYPE_DEAUTH | IEEE80211_FC0_TYPE_MGT);
1373 
1374 	return (fc == v);
1375 }
1376 
1377 static __inline bool
1378 ieee80211_is_beacon(__le16 fc)
1379 {
1380 	__le16 v;
1381 
1382 	/*
1383 	 * For as much as I get it this comes in LE and unlike FreeBSD
1384 	 * where we get the entire frame header and u8[], here we get the
1385 	 * 9.2.4.1 Frame Control field only. Mask and compare.
1386 	 */
1387 	fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK);
1388 	v = htole16(IEEE80211_FC0_SUBTYPE_BEACON | IEEE80211_FC0_TYPE_MGT);
1389 
1390 	return (fc == v);
1391 }
1392 
1393 
1394 static __inline bool
1395 ieee80211_is_probe_req(__le16 fc)
1396 {
1397 	__le16 v;
1398 
1399 	fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK);
1400 	v = htole16(IEEE80211_FC0_SUBTYPE_PROBE_REQ | IEEE80211_FC0_TYPE_MGT);
1401 
1402 	return (fc == v);
1403 }
1404 
1405 static __inline bool
1406 ieee80211_has_protected(__le16 fc)
1407 {
1408 
1409 	return (fc & htole16(IEEE80211_FC1_PROTECTED << 8));
1410 }
1411 
1412 static __inline bool
1413 ieee80211_is_back_req(__le16 fc)
1414 {
1415 	__le16 v;
1416 
1417 	fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK);
1418 	v = htole16(IEEE80211_FC0_SUBTYPE_BAR | IEEE80211_FC0_TYPE_CTL);
1419 
1420 	return (fc == v);
1421 }
1422 
1423 static __inline bool
1424 #ifdef __FOR_LATER_DRV_UPDATE
1425 ieee80211_is_bufferable_mmpdu(struct sk_buff *skb)
1426 {
1427 	struct ieee80211_mgmt *mgmt;
1428 	__le16 fc;
1429 
1430 	mgmt = (struct ieee80211_mgmt *)skb->data;
1431 	fc = mgmt->frame_control;
1432 #else
1433 ieee80211_is_bufferable_mmpdu(__le16 fc)
1434 {
1435 #endif
1436 
1437 	/* 11.2.2 Bufferable MMPDUs, 80211-2020. */
1438 	/* XXX we do not care about IBSS yet. */
1439 
1440 	if (!ieee80211_is_mgmt(fc))
1441 		return (false);
1442 	if (ieee80211_is_action(fc))		/* XXX FTM? */
1443 		return (true);			/* XXX false? */
1444 	if (ieee80211_is_disassoc(fc))
1445 		return (true);
1446 	if (ieee80211_is_deauth(fc))
1447 		return (true);
1448 
1449 	TODO();
1450 
1451 	return (false);
1452 }
1453 
1454 static __inline bool
1455 ieee80211_is_nullfunc(__le16 fc)
1456 {
1457 	__le16 v;
1458 
1459 	fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK);
1460 	v = htole16(IEEE80211_FC0_SUBTYPE_NODATA | IEEE80211_FC0_TYPE_DATA);
1461 
1462 	return (fc == v);
1463 }
1464 
1465 static __inline bool
1466 ieee80211_is_qos_nullfunc(__le16 fc)
1467 {
1468 	__le16 v;
1469 
1470 	fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK);
1471 	v = htole16(IEEE80211_FC0_SUBTYPE_QOS_NULL | IEEE80211_FC0_TYPE_DATA);
1472 
1473 	return (fc == v);
1474 }
1475 
1476 static __inline bool
1477 ieee80211_is_any_nullfunc(__le16 fc)
1478 {
1479 
1480 	return (ieee80211_is_nullfunc(fc) || ieee80211_is_qos_nullfunc(fc));
1481 }
1482 
1483 static inline bool
1484 ieee80211_is_pspoll(__le16 fc)
1485 {
1486 	__le16 v;
1487 
1488 	fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK);
1489 	v = htole16(IEEE80211_FC0_SUBTYPE_PS_POLL | IEEE80211_FC0_TYPE_CTL);
1490 
1491 	return (fc == v);
1492 }
1493 
1494 static __inline bool
1495 ieee80211_vif_is_mesh(struct ieee80211_vif *vif)
1496 {
1497 	TODO();
1498 	return (false);
1499 }
1500 
1501 static __inline bool
1502 ieee80211_is_frag(struct ieee80211_hdr *hdr)
1503 {
1504 	TODO();
1505 	return (false);
1506 }
1507 
1508 static __inline bool
1509 ieee80211_is_first_frag(__le16 fc)
1510 {
1511 	TODO();
1512 	return (false);
1513 }
1514 
1515 static __inline bool
1516 ieee80211_is_robust_mgmt_frame(struct sk_buff *skb)
1517 {
1518 	TODO();
1519 	return (false);
1520 }
1521 
1522 static __inline bool
1523 ieee80211_is_ftm(struct sk_buff *skb)
1524 {
1525 	TODO();
1526 	return (false);
1527 }
1528 
1529 static __inline bool
1530 ieee80211_is_timing_measurement(struct sk_buff *skb)
1531 {
1532 	TODO();
1533 	return (false);
1534 }
1535 
1536 static __inline bool
1537 ieee80211_has_pm(__le16 fc)
1538 {
1539 	TODO();
1540 	return (false);
1541 }
1542 
1543 static __inline bool
1544 ieee80211_has_a4(__le16 fc)
1545 {
1546 	__le16 v;
1547 
1548 	fc &= htole16((IEEE80211_FC1_DIR_TODS | IEEE80211_FC1_DIR_FROMDS) << 8);
1549 	v = htole16((IEEE80211_FC1_DIR_TODS | IEEE80211_FC1_DIR_FROMDS) << 8);
1550 
1551 	return (fc == v);
1552 }
1553 
1554 static __inline bool
1555 ieee80211_has_order(__le16 fc)
1556 {
1557 
1558 	return (fc & htole16(IEEE80211_FC1_ORDER << 8));
1559 }
1560 
1561 static __inline bool
1562 ieee80211_has_retry(__le16 fc)
1563 {
1564 
1565 	return (fc & htole16(IEEE80211_FC1_RETRY << 8));
1566 }
1567 
1568 
1569 static __inline bool
1570 ieee80211_has_fromds(__le16 fc)
1571 {
1572 
1573 	return (fc & htole16(IEEE80211_FC1_DIR_FROMDS << 8));
1574 }
1575 
1576 static __inline bool
1577 ieee80211_has_tods(__le16 fc)
1578 {
1579 
1580 	return (fc & htole16(IEEE80211_FC1_DIR_TODS << 8));
1581 }
1582 
1583 static __inline uint8_t *
1584 ieee80211_get_SA(struct ieee80211_hdr *hdr)
1585 {
1586 
1587 	if (ieee80211_has_a4(hdr->frame_control))
1588 		return (hdr->addr4);
1589 	if (ieee80211_has_fromds(hdr->frame_control))
1590 		return (hdr->addr3);
1591 	return (hdr->addr2);
1592 }
1593 
1594 static __inline uint8_t *
1595 ieee80211_get_DA(struct ieee80211_hdr *hdr)
1596 {
1597 
1598 	if (ieee80211_has_tods(hdr->frame_control))
1599 		return (hdr->addr3);
1600 	return (hdr->addr1);
1601 }
1602 
1603 static __inline bool
1604 ieee80211_has_morefrags(__le16 fc)
1605 {
1606 
1607 	fc &= htole16(IEEE80211_FC1_MORE_FRAG << 8);
1608 	return (fc != 0);
1609 }
1610 
1611 static __inline u8 *
1612 ieee80211_get_qos_ctl(struct ieee80211_hdr *hdr)
1613 {
1614         if (ieee80211_has_a4(hdr->frame_control))
1615                 return (u8 *)hdr + 30;
1616         else
1617                 return (u8 *)hdr + 24;
1618 }
1619 
1620 /* -------------------------------------------------------------------------- */
1621 /* Receive functions (air/driver to mac80211/net80211). */
1622 
1623 
1624 static __inline void
1625 ieee80211_rx_napi(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
1626     struct sk_buff *skb, struct napi_struct *napi)
1627 {
1628 
1629 	linuxkpi_ieee80211_rx(hw, skb, sta, napi, NULL);
1630 }
1631 
1632 static __inline void
1633 ieee80211_rx_list(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
1634     struct sk_buff *skb, struct list_head *list)
1635 {
1636 
1637 	linuxkpi_ieee80211_rx(hw, skb, sta, NULL, list);
1638 }
1639 
1640 static __inline void
1641 ieee80211_rx_ni(struct ieee80211_hw *hw, struct sk_buff *skb)
1642 {
1643 
1644 	linuxkpi_ieee80211_rx(hw, skb, NULL, NULL, NULL);
1645 }
1646 
1647 static __inline void
1648 ieee80211_rx_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb)
1649 {
1650 
1651 	linuxkpi_ieee80211_rx(hw, skb, NULL, NULL, NULL);
1652 }
1653 
1654 static __inline void
1655 ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb)
1656 {
1657 
1658 	linuxkpi_ieee80211_rx(hw, skb, NULL, NULL, NULL);
1659 }
1660 
1661 /* -------------------------------------------------------------------------- */
1662 
1663 static inline void
1664 ieee80211_stop_queues(struct ieee80211_hw *hw)
1665 {
1666 	linuxkpi_ieee80211_stop_queues(hw);
1667 }
1668 
1669 static inline void
1670 ieee80211_wake_queues(struct ieee80211_hw *hw)
1671 {
1672 	linuxkpi_ieee80211_wake_queues(hw);
1673 }
1674 
1675 static inline void
1676 ieee80211_stop_queue(struct ieee80211_hw *hw, int qnum)
1677 {
1678 	linuxkpi_ieee80211_stop_queue(hw, qnum);
1679 }
1680 
1681 static inline void
1682 ieee80211_wake_queue(struct ieee80211_hw *hw, int qnum)
1683 {
1684 	linuxkpi_ieee80211_wake_queue(hw, qnum);
1685 }
1686 
1687 static inline void
1688 ieee80211_schedule_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq)
1689 {
1690 	linuxkpi_ieee80211_schedule_txq(hw, txq, true);
1691 }
1692 
1693 static inline void
1694 ieee80211_return_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq,
1695     bool withoutpkts)
1696 {
1697 	linuxkpi_ieee80211_schedule_txq(hw, txq, true);
1698 }
1699 
1700 static inline void
1701 ieee80211_txq_schedule_start(struct ieee80211_hw *hw, uint8_t ac)
1702 {
1703 	linuxkpi_ieee80211_txq_schedule_start(hw, ac);
1704 }
1705 
1706 static inline void
1707 ieee80211_txq_schedule_end(struct ieee80211_hw *hw, uint8_t ac)
1708 {
1709 	/* DO_NADA; */
1710 }
1711 
1712 static inline struct ieee80211_txq *
1713 ieee80211_next_txq(struct ieee80211_hw *hw, uint8_t ac)
1714 {
1715 	return (linuxkpi_ieee80211_next_txq(hw, ac));
1716 }
1717 
1718 static inline void
1719 ieee80211_handle_wake_tx_queue(struct ieee80211_hw *hw,
1720     struct ieee80211_txq *txq)
1721 {
1722 	TODO();
1723 }
1724 
1725 /* -------------------------------------------------------------------------- */
1726 
1727 static __inline uint8_t
1728 ieee80211_get_tid(struct ieee80211_hdr *hdr)
1729 {
1730 
1731 	return (linuxkpi_ieee80211_get_tid(hdr, false));
1732 }
1733 
1734 static __inline struct sk_buff *
1735 ieee80211_beacon_get_tim(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1736     uint16_t *tim_offset, uint16_t *tim_len, uint32_t link_id)
1737 {
1738 
1739 	if (tim_offset != NULL)
1740 		*tim_offset = 0;
1741 	if (tim_len != NULL)
1742 		*tim_len = 0;
1743 	TODO();
1744 	return (NULL);
1745 }
1746 
1747 static __inline void
1748 ieee80211_iterate_active_interfaces_atomic(struct ieee80211_hw *hw,
1749     enum ieee80211_iface_iter flags,
1750     void(*iterfunc)(void *, uint8_t *, struct ieee80211_vif *),
1751     void *arg)
1752 {
1753 
1754 	flags |= IEEE80211_IFACE_ITER__ATOMIC;
1755 	flags |= IEEE80211_IFACE_ITER_ACTIVE;
1756 	linuxkpi_ieee80211_iterate_interfaces(hw, flags, iterfunc, arg);
1757 }
1758 
1759 static __inline void
1760 ieee80211_iterate_active_interfaces(struct ieee80211_hw *hw,
1761     enum ieee80211_iface_iter flags,
1762     void(*iterfunc)(void *, uint8_t *, struct ieee80211_vif *),
1763     void *arg)
1764 {
1765 
1766 	flags |= IEEE80211_IFACE_ITER_ACTIVE;
1767 	linuxkpi_ieee80211_iterate_interfaces(hw, flags, iterfunc, arg);
1768 }
1769 
1770 static __inline void
1771 ieee80211_iterate_active_interfaces_mtx(struct ieee80211_hw *hw,
1772     enum ieee80211_iface_iter flags,
1773     void(*iterfunc)(void *, uint8_t *, struct ieee80211_vif *),
1774     void *arg)
1775 {
1776 	flags |= IEEE80211_IFACE_ITER_ACTIVE;
1777 	flags |= IEEE80211_IFACE_ITER__MTX;
1778 	linuxkpi_ieee80211_iterate_interfaces(hw, flags, iterfunc, arg);
1779 }
1780 
1781 static __inline void
1782 ieee80211_iterate_interfaces(struct ieee80211_hw *hw,
1783    enum ieee80211_iface_iter flags,
1784    void (*iterfunc)(void *, uint8_t *, struct ieee80211_vif *),
1785    void *arg)
1786 {
1787 
1788 	linuxkpi_ieee80211_iterate_interfaces(hw, flags, iterfunc, arg);
1789 }
1790 
1791 static __inline void
1792 ieee80211_iter_keys(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1793     void(*iterfunc)(struct ieee80211_hw *, struct ieee80211_vif *,
1794         struct ieee80211_sta *, struct ieee80211_key_conf *, void *),
1795     void *arg)
1796 {
1797 
1798 	linuxkpi_ieee80211_iterate_keys(hw, vif, iterfunc, arg);
1799 }
1800 
1801 static __inline void
1802 ieee80211_iter_keys_rcu(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1803     void(*iterfunc)(struct ieee80211_hw *, struct ieee80211_vif *,
1804         struct ieee80211_sta *, struct ieee80211_key_conf *, void *),
1805     void *arg)
1806 {
1807 
1808 	IMPROVE();	/* "rcu" */
1809 	linuxkpi_ieee80211_iterate_keys(hw, vif, iterfunc, arg);
1810 }
1811 
1812 static __inline void
1813 ieee80211_iter_chan_contexts_atomic(struct ieee80211_hw *hw,
1814     void(*iterfunc)(struct ieee80211_hw *, struct ieee80211_chanctx_conf *, void *),
1815     void *arg)
1816 {
1817 
1818 	linuxkpi_ieee80211_iterate_chan_contexts(hw, iterfunc, arg);
1819 }
1820 
1821 static __inline void
1822 ieee80211_iterate_stations_atomic(struct ieee80211_hw *hw,
1823    void (*iterfunc)(void *, struct ieee80211_sta *), void *arg)
1824 {
1825 
1826 	linuxkpi_ieee80211_iterate_stations_atomic(hw, iterfunc, arg);
1827 }
1828 
1829 static __inline struct wireless_dev *
1830 ieee80211_vif_to_wdev(struct ieee80211_vif *vif)
1831 {
1832 
1833 	return (linuxkpi_ieee80211_vif_to_wdev(vif));
1834 }
1835 
1836 static __inline struct sk_buff *
1837 ieee80211_beacon_get_template(struct ieee80211_hw *hw,
1838     struct ieee80211_vif *vif, struct ieee80211_mutable_offsets *offs,
1839     uint32_t link_id)
1840 {
1841 	TODO();
1842 	return (NULL);
1843 }
1844 
1845 static __inline void
1846 ieee80211_beacon_loss(struct ieee80211_vif *vif)
1847 {
1848 	linuxkpi_ieee80211_beacon_loss(vif);
1849 }
1850 
1851 static __inline void
1852 ieee80211_chswitch_done(struct ieee80211_vif *vif, bool t)
1853 {
1854 	TODO();
1855 }
1856 
1857 static __inline bool
1858 ieee80211_csa_is_complete(struct ieee80211_vif *vif)
1859 {
1860 	TODO();
1861 	return (false);
1862 }
1863 
1864 static __inline void
1865 ieee80211_csa_set_counter(struct ieee80211_vif *vif, uint8_t counter)
1866 {
1867 	TODO();
1868 }
1869 
1870 static __inline int
1871 ieee80211_csa_update_counter(struct ieee80211_vif *vif)
1872 {
1873 	TODO();
1874 	return (-1);
1875 }
1876 
1877 static __inline void
1878 ieee80211_csa_finish(struct ieee80211_vif *vif)
1879 {
1880 	TODO();
1881 }
1882 
1883 static __inline enum nl80211_iftype
1884 ieee80211_vif_type_p2p(struct ieee80211_vif *vif)
1885 {
1886 
1887 	/* If we are not p2p enabled, just return the type. */
1888 	if (!vif->p2p)
1889 		return (vif->type);
1890 
1891 	/* If we are p2p, depending on side, return type. */
1892 	switch (vif->type) {
1893 	case NL80211_IFTYPE_AP:
1894 		return (NL80211_IFTYPE_P2P_GO);
1895 	case NL80211_IFTYPE_STATION:
1896 		return (NL80211_IFTYPE_P2P_CLIENT);
1897 	default:
1898 		fallthrough;
1899 	}
1900 	return (vif->type);
1901 }
1902 
1903 static __inline unsigned long
1904 ieee80211_tu_to_usec(unsigned long tu)
1905 {
1906 
1907 	return (tu * IEEE80211_DUR_TU);
1908 }
1909 
1910 /*
1911  * Below we assume that the two values from different emums are the same.
1912  * Make sure this does not accidentally change.
1913  */
1914 CTASSERT((int)IEEE80211_ACTION_SM_TPCREP == (int)IEEE80211_ACTION_RADIO_MEASUREMENT_LMREP);
1915 
1916 static __inline bool
1917 ieee80211_action_contains_tpc(struct sk_buff *skb)
1918 {
1919 	struct ieee80211_mgmt *mgmt;
1920 
1921 	mgmt = (struct ieee80211_mgmt *)skb->data;
1922 
1923 	/* Check that this is a mgmt/action frame? */
1924 	if (!ieee80211_is_action(mgmt->frame_control))
1925 		return (false);
1926 
1927 	/*
1928 	 * This is a bit convoluted but according to docs both actions
1929 	 * are checked for this.  Kind-of makes sense for the only consumer
1930 	 * (iwlwifi) I am aware off given the txpower fields are at the
1931 	 * same location so firmware can update the value.
1932 	 */
1933 	/* 80211-2020 9.6.2 Spectrum Management Action frames */
1934 	/* 80211-2020 9.6.2.5 TPC Report frame format */
1935 	/* 80211-2020 9.6.6 Radio Measurement action details */
1936 	/* 80211-2020 9.6.6.4 Link Measurement Report frame format */
1937 	/* Check that it is Spectrum Management or Radio Measurement? */
1938 	if (mgmt->u.action.category != IEEE80211_ACTION_CAT_SM &&
1939 	    mgmt->u.action.category != IEEE80211_ACTION_CAT_RADIO_MEASUREMENT)
1940 		return (false);
1941 
1942 	/*
1943 	 * Check that it is TPC Report or Link Measurement Report?
1944 	 * The values of each are the same (see CTASSERT above function).
1945 	 */
1946 	if (mgmt->u.action.u.tpc_report.spec_mgmt != IEEE80211_ACTION_SM_TPCREP)
1947 		return (false);
1948 
1949 	/* 80211-2020 9.4.2.16 TPC Report element */
1950 	/* Check that the ELEMID and length are correct? */
1951 	if (mgmt->u.action.u.tpc_report.tpc_elem_id != IEEE80211_ELEMID_TPCREP ||
1952 	    mgmt->u.action.u.tpc_report.tpc_elem_length != 4)
1953 		return (false);
1954 
1955 	/* All the right fields in the right place. */
1956 	return (true);
1957 }
1958 
1959 static __inline void
1960 ieee80211_connection_loss(struct ieee80211_vif *vif)
1961 {
1962 
1963 	linuxkpi_ieee80211_connection_loss(vif);
1964 }
1965 
1966 static __inline struct ieee80211_sta *
1967 ieee80211_find_sta(struct ieee80211_vif *vif, const u8 *peer)
1968 {
1969 
1970 	return (linuxkpi_ieee80211_find_sta(vif, peer));
1971 }
1972 
1973 static __inline struct ieee80211_sta *
1974 ieee80211_find_sta_by_ifaddr(struct ieee80211_hw *hw, const uint8_t *addr,
1975     const uint8_t *ourvifaddr)
1976 {
1977 
1978 	return (linuxkpi_ieee80211_find_sta_by_ifaddr(hw, addr, ourvifaddr));
1979 }
1980 
1981 
1982 static __inline void
1983 ieee80211_get_tkip_p2k(struct ieee80211_key_conf *keyconf,
1984     struct sk_buff *skb_frag, u8 *key)
1985 {
1986 	TODO();
1987 }
1988 
1989 static __inline void
1990 ieee80211_get_tkip_rx_p1k(struct ieee80211_key_conf *keyconf,
1991     const u8 *addr, uint32_t iv32, u16 *p1k)
1992 {
1993 
1994 	KASSERT(keyconf != NULL && addr != NULL && p1k != NULL,
1995 	    ("%s: keyconf %p addr %p p1k %p\n", __func__, keyconf, addr, p1k));
1996 
1997 	TODO();
1998 	memset(p1k, 0xfa, 5 * sizeof(*p1k));	/* Just initializing. */
1999 }
2000 
2001 static __inline size_t
2002 ieee80211_ie_split(const u8 *ies, size_t ies_len,
2003     const u8 *ie_ids, size_t ie_ids_len, size_t start)
2004 {
2005 	size_t x;
2006 
2007 	x = start;
2008 
2009 	/* XXX FIXME, we need to deal with "Element ID Extension" */
2010 	while (x < ies_len) {
2011 
2012 		/* Is this IE[s] one of the ie_ids? */
2013 		if (!linuxkpi_ieee80211_is_ie_id_in_ie_buf(ies[x],
2014 		    ie_ids, ie_ids_len))
2015 			break;
2016 
2017 		if (!linuxkpi_ieee80211_ie_advance(&x, ies, ies_len))
2018 			break;
2019 	}
2020 
2021 	return (x);
2022 }
2023 
2024 static __inline void
2025 ieee80211_request_smps(struct ieee80211_vif *vif,
2026 #ifdef __FOR_LATER_DRV_UPDATE
2027     u_int link_id,
2028 #endif
2029     enum ieee80211_smps_mode smps)
2030 {
2031 	static const char *smps_mode_name[] = {
2032 		"SMPS_OFF",
2033 		"SMPS_STATIC",
2034 		"SMPS_DYNAMIC",
2035 		"SMPS_AUTOMATIC",
2036 		"SMPS_NUM_MODES"
2037 	};
2038 
2039 	if (linuxkpi_debug_80211 & D80211_TODO)
2040 		printf("%s:%d: XXX LKPI80211 TODO smps %d %s\n",
2041 		    __func__, __LINE__, smps, smps_mode_name[smps]);
2042 }
2043 
2044 static __inline void
2045 ieee80211_tdls_oper_request(struct ieee80211_vif *vif, uint8_t *addr,
2046     enum nl80211_tdls_operation oper, enum ieee80211_reason_code code,
2047     gfp_t gfp)
2048 {
2049 	TODO();
2050 }
2051 
2052 static __inline void
2053 wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool state)
2054 {
2055 	TODO();
2056 }
2057 
2058 static __inline void
2059 ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb)
2060 {
2061 	IMPROVE();
2062 
2063 	/*
2064 	 * This is called on transmit failure.
2065 	 * Use a not-so-random random high status error so we can distinguish
2066 	 * it from normal low values flying around in net80211 ("ETX").
2067 	 */
2068 	linuxkpi_ieee80211_free_txskb(hw, skb, 0x455458);
2069 }
2070 
2071 static __inline void
2072 ieee80211_ready_on_channel(struct ieee80211_hw *hw)
2073 {
2074 	TODO();
2075 /* XXX-BZ We need to see that. */
2076 }
2077 
2078 static __inline void
2079 ieee80211_remain_on_channel_expired(struct ieee80211_hw *hw)
2080 {
2081 	TODO();
2082 }
2083 
2084 static __inline void
2085 ieee80211_cqm_rssi_notify(struct ieee80211_vif *vif,
2086     enum nl80211_cqm_rssi_threshold_event crte, int sig, gfp_t gfp)
2087 {
2088 	TODO();
2089 }
2090 
2091 static __inline void
2092 ieee80211_mark_rx_ba_filtered_frames(struct ieee80211_sta *sta, uint8_t tid,
2093     uint32_t ssn, uint64_t bitmap, uint16_t received_mpdu)
2094 {
2095 	TODO();
2096 }
2097 
2098 static __inline bool
2099 ieee80211_sn_less(uint16_t sn1, uint16_t sn2)
2100 {
2101 	TODO();
2102 	return (false);
2103 }
2104 
2105 static __inline uint16_t
2106 ieee80211_sn_inc(uint16_t sn)
2107 {
2108 	TODO();
2109 	return (sn + 1);
2110 }
2111 
2112 static __inline uint16_t
2113 ieee80211_sn_add(uint16_t sn, uint16_t a)
2114 {
2115 	TODO();
2116 	return (sn + a);
2117 }
2118 
2119 static __inline void
2120 ieee80211_stop_rx_ba_session(struct ieee80211_vif *vif, uint32_t x, uint8_t *addr)
2121 {
2122 	TODO();
2123 }
2124 
2125 static __inline void
2126 ieee80211_rate_set_vht(struct ieee80211_tx_rate *r, uint32_t f1, uint32_t f2)
2127 {
2128 	TODO();
2129 }
2130 
2131 static __inline uint8_t
2132 ieee80211_rate_get_vht_nss(struct ieee80211_tx_rate *r)
2133 {
2134 	TODO();
2135 	return (0);
2136 }
2137 
2138 static __inline uint8_t
2139 ieee80211_rate_get_vht_mcs(struct ieee80211_tx_rate *r)
2140 {
2141 	TODO();
2142 	return (0);
2143 }
2144 
2145 static __inline void
2146 ieee80211_reserve_tid(struct ieee80211_sta *sta, uint8_t tid)
2147 {
2148 	TODO();
2149 }
2150 
2151 static __inline void
2152 ieee80211_unreserve_tid(struct ieee80211_sta *sta, uint8_t tid)
2153 {
2154 	TODO();
2155 }
2156 
2157 static __inline void
2158 ieee80211_rx_ba_timer_expired(struct ieee80211_vif *vif, uint8_t *addr,
2159     uint8_t tid)
2160 {
2161 	TODO();
2162 }
2163 
2164 static __inline void
2165 ieee80211_send_eosp_nullfunc(struct ieee80211_sta *sta, uint8_t tid)
2166 {
2167 	TODO();
2168 }
2169 
2170 static __inline uint16_t
2171 ieee80211_sn_sub(uint16_t sa, uint16_t sb)
2172 {
2173 
2174 	return ((sa - sb) &
2175 	    (IEEE80211_SEQ_SEQ_MASK >> IEEE80211_SEQ_SEQ_SHIFT));
2176 }
2177 
2178 static __inline void
2179 ieee80211_sta_block_awake(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
2180     bool disable)
2181 {
2182 	TODO();
2183 }
2184 
2185 static __inline void
2186 ieee80211_sta_ps_transition(struct ieee80211_sta *sta, bool sleeping)
2187 {
2188 	TODO();
2189 }
2190 
2191 static __inline void
2192 ieee80211_sta_pspoll(struct ieee80211_sta *sta)
2193 {
2194 	TODO();
2195 }
2196 
2197 static __inline void
2198 ieee80211_sta_recalc_aggregates(struct ieee80211_sta *sta)
2199 {
2200 	TODO();
2201 }
2202 
2203 static __inline void
2204 ieee80211_sta_uapsd_trigger(struct ieee80211_sta *sta, int ntids)
2205 {
2206 	TODO();
2207 }
2208 
2209 static __inline void
2210 ieee80211_tkip_add_iv(u8 *crypto_hdr, struct ieee80211_key_conf *keyconf,
2211     uint64_t pn)
2212 {
2213 	TODO();
2214 }
2215 
2216 static __inline struct sk_buff *
2217 ieee80211_tx_dequeue(struct ieee80211_hw *hw, struct ieee80211_txq *txq)
2218 {
2219 
2220 	return (linuxkpi_ieee80211_tx_dequeue(hw, txq));
2221 }
2222 
2223 static __inline void
2224 ieee80211_update_mu_groups(struct ieee80211_vif *vif,
2225 #ifdef __FOR_LATER_DRV_UPDATE
2226     u_int _i,
2227 #endif
2228     uint8_t *ms, uint8_t *up)
2229 {
2230 	TODO();
2231 }
2232 
2233 static __inline void
2234 ieee80211_sta_set_buffered(struct ieee80211_sta *sta, uint8_t tid, bool t)
2235 {
2236 	TODO();
2237 }
2238 
2239 static __inline void
2240 ieee80211_get_key_rx_seq(struct ieee80211_key_conf *keyconf, uint8_t tid,
2241     struct ieee80211_key_seq *seq)
2242 {
2243 
2244 	KASSERT(keyconf != NULL && seq != NULL, ("%s: keyconf %p seq %p\n",
2245 	    __func__, keyconf, seq));
2246 
2247 	TODO();
2248 	switch (keyconf->cipher) {
2249 	case WLAN_CIPHER_SUITE_CCMP:
2250 	case WLAN_CIPHER_SUITE_CCMP_256:
2251 		memset(seq->ccmp.pn, 0xfa, sizeof(seq->ccmp.pn));	/* XXX TODO */
2252 		break;
2253 	case WLAN_CIPHER_SUITE_AES_CMAC:
2254 		memset(seq->aes_cmac.pn, 0xfa, sizeof(seq->aes_cmac.pn));	/* XXX TODO */
2255 		break;
2256 	case WLAN_CIPHER_SUITE_TKIP:
2257 		seq->tkip.iv32 = 0xfa;		/* XXX TODO */
2258 		seq->tkip.iv16 = 0xfa;		/* XXX TODO */
2259 		break;
2260 	default:
2261 		pr_debug("%s: unsupported cipher suite %d\n", __func__, keyconf->cipher);
2262 		break;
2263 	}
2264 }
2265 
2266 static __inline void
2267 ieee80211_sched_scan_results(struct ieee80211_hw *hw)
2268 {
2269 	TODO();
2270 }
2271 
2272 static __inline void
2273 ieee80211_sta_eosp(struct ieee80211_sta *sta)
2274 {
2275 	TODO();
2276 }
2277 
2278 static __inline int
2279 ieee80211_start_tx_ba_session(struct ieee80211_sta *sta, uint8_t tid, int x)
2280 {
2281 	TODO("rtw8x");
2282 	return (-EINVAL);
2283 }
2284 
2285 static __inline int
2286 ieee80211_stop_tx_ba_session(struct ieee80211_sta *sta, uint8_t tid)
2287 {
2288 	TODO("rtw89");
2289 	return (-EINVAL);
2290 }
2291 
2292 static __inline void
2293 ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, uint8_t *addr,
2294     uint8_t tid)
2295 {
2296 	TODO("iwlwifi");
2297 }
2298 
2299 static __inline void
2300 ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, uint8_t *addr,
2301     uint8_t tid)
2302 {
2303 	TODO("iwlwifi/rtw8x/...");
2304 }
2305 
2306 static __inline void
2307 ieee80211_sched_scan_stopped(struct ieee80211_hw *hw)
2308 {
2309 	TODO();
2310 }
2311 
2312 static __inline void
2313 ieee80211_scan_completed(struct ieee80211_hw *hw,
2314     struct cfg80211_scan_info *info)
2315 {
2316 
2317 	linuxkpi_ieee80211_scan_completed(hw, info);
2318 }
2319 
2320 static __inline struct sk_buff *
2321 ieee80211_beacon_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
2322     uint32_t link_id)
2323 {
2324 	TODO();
2325 	return (NULL);
2326 }
2327 
2328 static __inline struct sk_buff *
2329 ieee80211_pspoll_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
2330 {
2331 
2332 	/* Only STA needs this.  Otherwise return NULL and panic bad drivers. */
2333 	if (vif->type != NL80211_IFTYPE_STATION)
2334 		return (NULL);
2335 
2336 	return (linuxkpi_ieee80211_pspoll_get(hw, vif));
2337 }
2338 
2339 static __inline struct sk_buff *
2340 ieee80211_proberesp_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
2341 {
2342 	TODO();
2343 	return (NULL);
2344 }
2345 
2346 static __inline struct sk_buff *
2347 ieee80211_nullfunc_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
2348 #ifdef __FOR_LATER_DRV_UPDATE
2349     int linkid,
2350 #endif
2351     bool qos)
2352 {
2353 #ifndef __FOR_LATER_DRV_UPDATE
2354 	int linkid = 0;
2355 #endif
2356 
2357 	/* Only STA needs this.  Otherwise return NULL and panic bad drivers. */
2358 	if (vif->type != NL80211_IFTYPE_STATION)
2359 		return (NULL);
2360 
2361 	return (linuxkpi_ieee80211_nullfunc_get(hw, vif, linkid, qos));
2362 }
2363 
2364 static __inline struct sk_buff *
2365 ieee80211_probereq_get(struct ieee80211_hw *hw, uint8_t *addr,
2366     uint8_t *ssid, size_t ssid_len, size_t tailroom)
2367 {
2368 
2369 	return (linuxkpi_ieee80211_probereq_get(hw, addr, ssid, ssid_len,
2370 	    tailroom));
2371 }
2372 
2373 static __inline void
2374 ieee80211_queue_delayed_work(struct ieee80211_hw *hw, struct delayed_work *w,
2375     int delay)
2376 {
2377 
2378 	linuxkpi_ieee80211_queue_delayed_work(hw, w, delay);
2379 }
2380 
2381 static __inline void
2382 ieee80211_queue_work(struct ieee80211_hw *hw, struct work_struct *w)
2383 {
2384 
2385 	linuxkpi_ieee80211_queue_work(hw, w);
2386 }
2387 
2388 static __inline void
2389 ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb)
2390 {
2391 
2392 	linuxkpi_ieee80211_tx_status(hw, skb);
2393 }
2394 
2395 static __inline void
2396 ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb)
2397 {
2398 	IMPROVE();
2399 	ieee80211_tx_status(hw, skb);
2400 }
2401 
2402 static __inline void
2403 ieee80211_tx_status_ni(struct ieee80211_hw *hw, struct sk_buff *skb)
2404 {
2405 	IMPROVE();
2406 	ieee80211_tx_status(hw, skb);
2407 }
2408 
2409 static __inline void
2410 ieee80211_tx_status_ext(struct ieee80211_hw *hw,
2411     struct ieee80211_tx_status *txstat)
2412 {
2413 
2414 	linuxkpi_ieee80211_tx_status_ext(hw, txstat);
2415 }
2416 
2417 static __inline void
2418 ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)
2419 {
2420 	int i;
2421 
2422 	/*
2423 	 * Apparently clearing flags and some other fields is not right.
2424 	 * Given the function is called "status" we work on that part of
2425 	 * the union.
2426 	 */
2427 	for (i = 0; i < nitems(info->status.rates); i++)
2428 		info->status.rates[i].count = 0;
2429 	/*
2430 	 * Unclear if ack_signal should be included or not but we clear the
2431 	 * "valid" bool so this field is no longer valid.
2432 	 */
2433 	memset(&info->status.ack_signal, 0, sizeof(*info) -
2434 	    offsetof(struct ieee80211_tx_info, status.ack_signal));
2435 }
2436 
2437 static __inline void
2438 ieee80211_txq_get_depth(struct ieee80211_txq *txq, unsigned long *frame_cnt,
2439     unsigned long *byte_cnt)
2440 {
2441 
2442 	if (frame_cnt == NULL && byte_cnt == NULL)
2443 		return;
2444 
2445 	linuxkpi_ieee80211_txq_get_depth(txq, frame_cnt, byte_cnt);
2446 }
2447 
2448 static __inline int
2449 rate_lowest_index(struct ieee80211_supported_band *band,
2450     struct ieee80211_sta *sta)
2451 {
2452 	IMPROVE();
2453 	return (0);
2454 }
2455 
2456 
2457 static __inline void
2458 SET_IEEE80211_PERM_ADDR	(struct ieee80211_hw *hw, uint8_t *addr)
2459 {
2460 
2461 	ether_addr_copy(hw->wiphy->perm_addr, addr);
2462 }
2463 
2464 static __inline void
2465 ieee80211_report_low_ack(struct ieee80211_sta *sta, int x)
2466 {
2467 	TODO();
2468 }
2469 
2470 static __inline void
2471 ieee80211_start_rx_ba_session_offl(struct ieee80211_vif *vif, uint8_t *addr,
2472     uint8_t tid)
2473 {
2474 	TODO();
2475 }
2476 
2477 static __inline void
2478 ieee80211_stop_rx_ba_session_offl(struct ieee80211_vif *vif, uint8_t *addr,
2479     uint8_t tid)
2480 {
2481 	TODO();
2482 }
2483 
2484 static __inline struct sk_buff *
2485 ieee80211_tx_dequeue_ni(struct ieee80211_hw *hw, struct ieee80211_txq *txq)
2486 {
2487 	TODO();
2488 	return (NULL);
2489 }
2490 
2491 static __inline void
2492 ieee80211_tx_rate_update(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
2493     struct ieee80211_tx_info *info)
2494 {
2495 	TODO();
2496 }
2497 
2498 static __inline bool
2499 ieee80211_txq_may_transmit(struct ieee80211_hw *hw, struct ieee80211_txq *txq)
2500 {
2501 	TODO();
2502 	return (false);
2503 }
2504 
2505 static __inline void
2506 ieee80211_radar_detected(struct ieee80211_hw *hw)
2507 {
2508 	TODO();
2509 }
2510 
2511 static __inline void
2512 ieee80211_sta_register_airtime(struct ieee80211_sta *sta,
2513     uint8_t tid, uint32_t duration, int x)
2514 {
2515 	TODO();
2516 }
2517 
2518 static __inline void
2519 ieee80211_beacon_set_cntdwn(struct ieee80211_vif *vif, u8 counter)
2520 {
2521 	TODO();
2522 }
2523 
2524 static __inline int
2525 ieee80211_beacon_update_cntdwn(struct ieee80211_vif *vif)
2526 {
2527 	TODO();
2528 	return (-1);
2529 }
2530 
2531 static __inline int
2532 ieee80211_get_vht_max_nss(struct ieee80211_vht_cap *vht_cap, uint32_t chanwidth,
2533     int x, bool t, int nss)
2534 {
2535 	TODO();
2536 	return (-1);
2537 }
2538 
2539 static __inline bool
2540 ieee80211_beacon_cntdwn_is_complete(struct ieee80211_vif *vif)
2541 {
2542 	TODO();
2543 	return (true);
2544 }
2545 
2546 static __inline void
2547 ieee80211_disconnect(struct ieee80211_vif *vif, bool _x)
2548 {
2549 	TODO();
2550 }
2551 
2552 static __inline void
2553 ieee80211_channel_switch_disconnect(struct ieee80211_vif *vif, bool _x)
2554 {
2555 	TODO();
2556 }
2557 
2558 static __inline const struct ieee80211_sta_he_cap *
2559 ieee80211_get_he_iftype_cap(const struct ieee80211_supported_band *band,
2560     enum nl80211_iftype type)
2561 {
2562 	TODO();
2563         return (NULL);
2564 }
2565 
2566 static __inline void
2567 ieee80211_key_mic_failure(struct ieee80211_key_conf *key)
2568 {
2569 	TODO();
2570 }
2571 
2572 static __inline void
2573 ieee80211_key_replay(struct ieee80211_key_conf *key)
2574 {
2575 	TODO();
2576 }
2577 
2578 static __inline uint32_t
2579 ieee80211_calc_rx_airtime(struct ieee80211_hw *hw,
2580     struct ieee80211_rx_status *rxstat, int len)
2581 {
2582 	TODO();
2583 	return (0);
2584 }
2585 
2586 static __inline void
2587 ieee80211_get_tx_rates(struct ieee80211_vif *vif, struct ieee80211_sta *sta,
2588     struct sk_buff *skb, struct ieee80211_tx_rate *txrate, int nrates)
2589 {
2590 	TODO();
2591 }
2592 
2593 static __inline void
2594 ieee80211_color_change_finish(struct ieee80211_vif *vif)
2595 {
2596 	TODO();
2597 }
2598 
2599 static __inline struct sk_buff *
2600 ieee80211_get_fils_discovery_tmpl(struct ieee80211_hw *hw,
2601     struct ieee80211_vif *vif)
2602 {
2603 	TODO();
2604 	return (NULL);
2605 }
2606 
2607 static __inline struct sk_buff *
2608 ieee80211_get_unsol_bcast_probe_resp_tmpl(struct ieee80211_hw *hw,
2609     struct ieee80211_vif *vif)
2610 {
2611 	TODO();
2612 	return (NULL);
2613 }
2614 
2615 static __inline void
2616 linuxkpi_ieee80211_send_bar(struct ieee80211_vif *vif, uint8_t *ra, uint16_t tid,
2617     uint16_t ssn)
2618 {
2619 	TODO();
2620 }
2621 
2622 static __inline void
2623 ieee80211_resume_disconnect(struct ieee80211_vif *vif)
2624 {
2625         TODO();
2626 }
2627 
2628 static __inline int
2629 ieee80211_data_to_8023(struct sk_buff *skb, const uint8_t *addr,
2630      enum nl80211_iftype iftype)
2631 {
2632         TODO();
2633         return (-1);
2634 }
2635 
2636 static __inline void
2637 ieee80211_get_tkip_p1k_iv(struct ieee80211_key_conf *key,
2638     uint32_t iv32, uint16_t *p1k)
2639 {
2640         TODO();
2641 }
2642 
2643 static __inline struct ieee80211_key_conf *
2644 ieee80211_gtk_rekey_add(struct ieee80211_vif *vif,
2645     struct ieee80211_key_conf *key)
2646 {
2647         TODO();
2648         return (NULL);
2649 }
2650 
2651 static __inline void
2652 ieee80211_gtk_rekey_notify(struct ieee80211_vif *vif, const uint8_t *bssid,
2653     const uint8_t *replay_ctr, gfp_t gfp)
2654 {
2655         TODO();
2656 }
2657 
2658 static __inline void
2659 ieee80211_remove_key(struct ieee80211_key_conf *key)
2660 {
2661         TODO();
2662 }
2663 
2664 static __inline void
2665 ieee80211_set_key_rx_seq(struct ieee80211_key_conf *key, int tid,
2666     struct ieee80211_key_seq *seq)
2667 {
2668         TODO();
2669 }
2670 
2671 static __inline void
2672 ieee80211_report_wowlan_wakeup(struct ieee80211_vif *vif,
2673     struct cfg80211_wowlan_wakeup *wakeup, gfp_t gfp)
2674 {
2675         TODO();
2676 }
2677 
2678 static __inline void
2679 ieee80211_obss_color_collision_notify(struct ieee80211_vif *vif,
2680     uint64_t obss_color_bitmap, gfp_t gfp)
2681 {
2682 	TODO();
2683 }
2684 
2685 static __inline void
2686 ieee80211_refresh_tx_agg_session_timer(struct ieee80211_sta *sta,
2687     uint8_t tid)
2688 {
2689 	TODO();
2690 }
2691 
2692 static __inline struct ieee80211_ema_beacons *
2693 ieee80211_beacon_get_template_ema_list(struct ieee80211_hw *hw,
2694     struct ieee80211_vif *vif, uint32_t link_id)
2695 {
2696 	TODO();
2697 	return (NULL);
2698 }
2699 
2700 static __inline void
2701 ieee80211_beacon_free_ema_list(struct ieee80211_ema_beacons *bcns)
2702 {
2703 	TODO();
2704 }
2705 
2706 static inline bool
2707 ieee80211_vif_is_mld(const struct ieee80211_vif *vif)
2708 {
2709 
2710 	/* If valid_links is non-zero, the vif is an MLD. */
2711 	return (vif->valid_links != 0);
2712 }
2713 
2714 static __inline const struct ieee80211_sta_he_cap *
2715 ieee80211_get_he_iftype_cap_vif(const struct ieee80211_supported_band *band,
2716     struct ieee80211_vif *vif)
2717 {
2718 	TODO();
2719 	return (NULL);
2720 }
2721 
2722 static __inline const struct ieee80211_sta_eht_cap *
2723 ieee80211_get_eht_iftype_cap_vif(const struct ieee80211_supported_band *band,
2724     struct ieee80211_vif *vif)
2725 {
2726 	TODO();
2727 	return (NULL);
2728 }
2729 
2730 #define	ieee80211_send_bar(_v, _r, _t, _s)				\
2731     linuxkpi_ieee80211_send_bar(_v, _r, _t, _s)
2732 
2733 #endif	/* _LINUXKPI_NET_MAC80211_H */
2734