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