xref: /freebsd/sys/compat/linuxkpi/common/include/net/mac80211.h (revision 4cc76d90ea259df205fec14d6bed1bfb7b0ef23e)
1 /*-
2  * Copyright (c) 2020-2021 The FreeBSD Foundation
3  * Copyright (c) 2020-2021 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/netdevice.h>
41 #include <linux/skbuff.h>
42 #include <linux/workqueue.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_TPC		(8)
49 #define	WLAN_OUI_TYPE_WFA_P2P			(9)
50 #define	WLAN_OUI_WFA				(0x506F9A)
51 
52 /* hw->conf.flags */
53 enum ieee80211_hw_conf_flags {
54 	IEEE80211_CONF_IDLE			= BIT(0),
55 	IEEE80211_CONF_PS			= BIT(1),
56 };
57 
58 /* (*ops->config()) */
59 enum ieee80211_hw_conf_changed_flags {
60 	IEEE80211_CONF_CHANGE_CHANNEL		= BIT(0),
61 	IEEE80211_CONF_CHANGE_IDLE		= BIT(1),
62 	IEEE80211_CONF_CHANGE_PS		= BIT(2),
63 };
64 
65 #define	CFG80211_TESTMODE_CMD(_x)	/* XXX TODO */
66 
67 #define	FCS_LEN				4
68 
69 /* ops.configure_filter() */
70 enum mcast_filter_flags {
71 	FIF_ALLMULTI			= BIT(0),
72 	FIF_PROBE_REQ			= BIT(1),
73 	FIF_BCN_PRBRESP_PROMISC		= BIT(2),
74 	FIF_FCSFAIL			= BIT(3),
75 	FIF_OTHER_BSS			= BIT(4),
76 };
77 
78 enum ieee80211_bss_changed {
79 	BSS_CHANGED_ARP_FILTER		= BIT(0),
80 	BSS_CHANGED_ASSOC		= BIT(1),
81 	BSS_CHANGED_BANDWIDTH		= BIT(2),
82 	BSS_CHANGED_BEACON		= BIT(3),
83 	BSS_CHANGED_BEACON_ENABLED	= BIT(4),
84 	BSS_CHANGED_BEACON_INFO		= BIT(5),
85 	BSS_CHANGED_BEACON_INT		= BIT(6),
86 	BSS_CHANGED_BSSID		= BIT(7),
87 	BSS_CHANGED_CQM			= BIT(8),
88 	BSS_CHANGED_ERP_CTS_PROT	= BIT(9),
89 	BSS_CHANGED_ERP_SLOT		= BIT(10),
90 	BSS_CHANGED_FTM_RESPONDER	= BIT(11),
91 	BSS_CHANGED_HT			= BIT(12),
92 	BSS_CHANGED_IDLE		= BIT(13),
93 	BSS_CHANGED_MU_GROUPS		= BIT(14),
94 	BSS_CHANGED_P2P_PS		= BIT(15),
95 	BSS_CHANGED_PS			= BIT(16),
96 	BSS_CHANGED_QOS			= BIT(17),
97 	BSS_CHANGED_TXPOWER		= BIT(18),
98 };
99 
100 /* 802.11 Figure 9-256 Suite selector format. [OUI(3), SUITE TYPE(1)] */
101 #define	WLAN_CIPHER_SUITE_OUI(_oui, _x)	((_oui) << 8 | (_x) & 0xff)
102 
103 /* 802.11 Table 9-131 Cipher suite selectors. */
104 /* 802.1x suite B			11 */
105 #define	WLAN_CIPHER_SUITE(_x)		WLAN_CIPHER_SUITE_OUI(0x000fac, _x)
106 /* Use group				0 */
107 #define	WLAN_CIPHER_SUITE_WEP40		WLAN_CIPHER_SUITE(1)
108 #define	WLAN_CIPHER_SUITE_TKIP		WLAN_CIPHER_SUITE(2)
109 /* Reserved				3 */
110 #define	WLAN_CIPHER_SUITE_CCMP		WLAN_CIPHER_SUITE(4)	/* CCMP-128 */
111 #define	WLAN_CIPHER_SUITE_WEP104	WLAN_CIPHER_SUITE(5)
112 #define	WLAN_CIPHER_SUITE_AES_CMAC	WLAN_CIPHER_SUITE(6)	/* BIP-CMAC-128 */
113 /* Group addressed traffic not allowed	7 */
114 #define	WLAN_CIPHER_SUITE_GCMP		WLAN_CIPHER_SUITE(8)
115 #define	WLAN_CIPHER_SUITE_GCMP_256	WLAN_CIPHER_SUITE(9)
116 #define	WLAN_CIPHER_SUITE_CCMP_256	WLAN_CIPHER_SUITE(10)
117 #define	WLAN_CIPHER_SUITE_BIP_GMAC_128	WLAN_CIPHER_SUITE(11)
118 #define	WLAN_CIPHER_SUITE_BIP_GMAC_256	WLAN_CIPHER_SUITE(12)
119 #define	WLAN_CIPHER_SUITE_BIP_CMAC_256	WLAN_CIPHER_SUITE(13)
120 /* Reserved				14-255 */
121 
122 
123 /* 802.11 Table 9-133 AKM suite selectors. */
124 #define	WLAN_AKM_SUITE(_x)		WLAN_CIPHER_SUITE_OUI(0x000fac, _x)
125 /* Reserved				0 */
126 #define	WLAN_AKM_SUITE_8021X		WLAN_AKM_SUITE(1)
127 #define	WLAN_AKM_SUITE_PSK		WLAN_AKM_SUITE(2)
128 #define	WLAN_AKM_SUITE_FT_8021X		WLAN_AKM_SUITE(3)
129 #define	WLAN_AKM_SUITE_FT_PSK		WLAN_AKM_SUITE(4)
130 #define	WLAN_AKM_SUITE_8021X_SHA256	WLAN_AKM_SUITE(5)
131 #define	WLAN_AKM_SUITE_PSK_SHA256	WLAN_AKM_SUITE(6)
132 /* TDLS					7 */
133 #define	WLAN_AKM_SUITE_SAE		WLAN_AKM_SUITE(8)
134 /* FToSAE				9 */
135 /* AP peer key				10 */
136 /* 802.1x suite B			11 */
137 /* 802.1x suite B 384			12 */
138 /* FTo802.1x 384			13 */
139 /* Reserved				14-255 */
140 /* Apparently 11ax defines more. Seen (19,20) mentioned. */
141 
142 
143 struct ieee80211_sta;
144 
145 struct ieee80211_ampdu_params {
146 	/* TODO FIXME */
147 	struct ieee80211_sta			*sta;
148 	uint8_t					tid;
149 	uint16_t				ssn;
150 	int		action, amsdu, buf_size, timeout;
151 };
152 
153 struct ieee80211_bar {
154 	/* TODO FIXME */
155 	int		control, start_seq_num;
156 	uint8_t		*ra;
157 	uint16_t	frame_control;
158 };
159 
160 struct ieee80211_p2p_noa_attr {
161 	/* TODO FIXME */
162 	int		oppps_ctwindow;
163 	int     desc, index;
164 };
165 
166 #define	WLAN_MEMBERSHIP_LEN			(8)
167 #define	WLAN_USER_POSITION_LEN			(16)
168 
169 struct ieee80211_bss_conf {
170 	/* TODO FIXME */
171 	uint8_t					bssid[ETH_ALEN];
172 	uint8_t					transmitter_bssid[ETH_ALEN];
173 	struct ieee80211_ftm_responder_params	*ftmr_params;
174 	struct ieee80211_p2p_noa_attr		p2p_noa_attr;
175 	struct cfg80211_chan_def		chandef;
176 	__be32					arp_addr_list[1];	/* XXX TODO */
177 	struct ieee80211_rate			*beacon_rate;
178 	struct {
179 		uint8_t membership[WLAN_MEMBERSHIP_LEN];
180 		uint8_t position[WLAN_USER_POSITION_LEN];
181 	}  mu_group;
182 	struct {
183 		int color;
184 	} he_bss_color;
185 	size_t					ssid_len;
186 	uint8_t					ssid[IEEE80211_NWID_LEN];
187 	uint16_t				aid;
188 	uint16_t				beacon_int;
189 	uint16_t				ht_operation_mode;
190 	int					arp_addr_cnt;
191 	uint8_t					dtim_period;
192 	bool					assoc;
193 	bool					idle;
194 	bool					qos;
195 	bool					ps;
196 	bool					twt_broadcast;
197 	bool					use_cts_prot;
198 	bool					use_short_preamble;
199 	bool					use_short_slot;
200 
201 	int		txpower;
202 	int		ack_enabled, bssid_index, bssid_indicator, cqm_rssi_hyst, cqm_rssi_thold, ema_ap, frame_time_rts_th, ftm_responder;
203 	int		htc_trig_based_pkt_ext;
204 	int		multi_sta_back_32bit, nontransmitted;
205 	int		profile_periodicity, sync_device_ts, sync_dtim_count, sync_tsf;
206 	int		twt_requester, uora_exists, uora_ocw_range;
207 	int		assoc_capability, enable_beacon, hidden_ssid, ibss_joined, mcast_rate, twt_protected;
208 	unsigned long	basic_rates;
209 	bool		he_support;
210 };
211 
212 struct ieee80211_chanctx_conf {
213 	/* TODO FIXME */
214 	int		rx_chains_dynamic, rx_chains_static;
215 	bool					radar_enabled;
216 	struct cfg80211_chan_def		def;
217 	struct cfg80211_chan_def		min_def;
218 
219 	/* Must stay last. */
220 	uint8_t					drv_priv[0] __aligned(CACHE_LINE_SIZE);
221 };
222 
223 struct ieee80211_channel_switch {
224 	/* TODO FIXME */
225 	int		block_tx, count, delay, device_timestamp, timestamp;
226 	struct cfg80211_chan_def		chandef;
227 };
228 
229 struct ieee80211_cipher_scheme {
230 	uint32_t	cipher;
231 	uint8_t		iftype;		/* We do not know the size of this. */
232 	uint8_t		hdr_len;
233 	uint8_t		pn_len;
234 	uint8_t		pn_off;
235 	uint8_t		key_idx_off;
236 	uint8_t		key_idx_mask;
237 	uint8_t		key_idx_shift;
238 	uint8_t		mic_len;
239 };
240 
241 enum ieee80211_event_type {
242 	BA_FRAME_TIMEOUT,
243 	BAR_RX_EVENT,
244 	MLME_EVENT,
245 	RSSI_EVENT,
246 };
247 
248 enum ieee80211_rssi_event_data {
249 	RSSI_EVENT_LOW,
250 	RSSI_EVENT_HIGH,
251 };
252 
253 enum ieee80211_mlme_event_data {
254 	ASSOC_EVENT,
255 	AUTH_EVENT,
256 	DEAUTH_RX_EVENT,
257 	DEAUTH_TX_EVENT,
258 };
259 
260 enum ieee80211_mlme_event_status {
261 	MLME_DENIED,
262 	MLME_TIMEOUT,
263 };
264 
265 struct ieee80211_mlme_event {
266 	enum ieee80211_mlme_event_data		data;
267 	enum ieee80211_mlme_event_status	status;
268 	int					reason;
269 };
270 
271 struct ieee80211_event {
272 	/* TODO FIXME */
273 	enum ieee80211_event_type		type;
274 	union {
275 		struct {
276 			int     ssn;
277 			struct ieee80211_sta	*sta;
278 			uint8_t		 	tid;
279 		} ba;
280 		struct ieee80211_mlme_event	mlme;
281 	} u;
282 };
283 
284 struct ieee80211_ftm_responder_params {
285 	/* TODO FIXME */
286 	uint8_t					*lci;
287 	uint8_t					*civicloc;
288 	int					lci_len;
289 	int					civicloc_len;
290 };
291 
292 struct ieee80211_he_mu_edca_param_ac_rec {
293 	/* TODO FIXME */
294 	int		aifsn, ecw_min_max, mu_edca_timer;
295 };
296 
297 enum ieee80211_hw_flags {
298 	IEEE80211_HW_AMPDU_AGGREGATION,
299 	IEEE80211_HW_AP_LINK_PS,
300 	IEEE80211_HW_BUFF_MMPDU_TXQ,
301 	IEEE80211_HW_CHANCTX_STA_CSA,
302 	IEEE80211_HW_CONNECTION_MONITOR,
303 	IEEE80211_HW_DEAUTH_NEED_MGD_TX_PREP,
304 	IEEE80211_HW_HAS_RATE_CONTROL,
305 	IEEE80211_HW_MFP_CAPABLE,
306 	IEEE80211_HW_NEEDS_UNIQUE_STA_ADDR,
307 	IEEE80211_HW_REPORTS_TX_ACK_STATUS,
308 	IEEE80211_HW_RX_INCLUDES_FCS,
309 	IEEE80211_HW_SIGNAL_DBM,
310 	IEEE80211_HW_SINGLE_SCAN_ON_ALL_BANDS,
311 	IEEE80211_HW_SPECTRUM_MGMT,
312 	IEEE80211_HW_STA_MMPDU_TXQ,
313 	IEEE80211_HW_SUPPORTS_AMSDU_IN_AMPDU,
314 	IEEE80211_HW_SUPPORTS_CLONED_SKBS,
315 	IEEE80211_HW_SUPPORTS_DYNAMIC_PS,
316 	IEEE80211_HW_SUPPORTS_MULTI_BSSID,
317 	IEEE80211_HW_SUPPORTS_ONLY_HE_MULTI_BSSID,
318 	IEEE80211_HW_SUPPORTS_PS,
319 	IEEE80211_HW_SUPPORTS_REORDERING_BUFFER,
320 	IEEE80211_HW_SUPPORTS_VHT_EXT_NSS_BW,
321 	IEEE80211_HW_SUPPORT_FAST_XMIT,
322 	IEEE80211_HW_TDLS_WIDER_BW,
323 	IEEE80211_HW_TIMING_BEACON_ONLY,
324 	IEEE80211_HW_TX_AMPDU_SETUP_IN_HW,
325 	IEEE80211_HW_TX_AMSDU,
326 	IEEE80211_HW_TX_FRAG_LIST,
327 	IEEE80211_HW_USES_RSS,
328 	IEEE80211_HW_WANT_MONITOR_VIF,
329 
330 	/* Keep last. */
331 	NUM_IEEE80211_HW_FLAGS
332 };
333 
334 struct ieee80211_hw {
335 
336 	struct wiphy			*wiphy;
337 
338 	/* TODO FIXME */
339 	int		max_rx_aggregation_subframes, max_tx_aggregation_subframes;
340 	int		extra_tx_headroom, weight_multiplier;
341 	int		max_rate_tries, max_rates, max_report_rates;
342 	struct ieee80211_cipher_scheme	*cipher_schemes;
343 	int				n_cipher_schemes;
344 	const char			*rate_control_algorithm;
345 	struct {
346 		uint16_t units_pos;	/* radiotap "spec" is .. inconsistent. */
347 		uint16_t accuracy;
348 	} radiotap_timestamp;
349 	size_t				sta_data_size;
350 	size_t				vif_data_size;
351 	size_t				chanctx_data_size;
352 	size_t				txq_data_size;
353 	uint16_t			radiotap_mcs_details;
354 	uint16_t			radiotap_vht_details;
355 	uint16_t			queues;
356 	uint16_t			offchannel_tx_hw_queue;
357 	uint16_t			uapsd_max_sp_len;
358 	uint16_t			uapsd_queues;
359 	uint16_t			max_tx_fragments;
360 	uint16_t			max_listen_interval;
361 	netdev_features_t		netdev_features;
362 	unsigned long			flags[BITS_TO_LONGS(NUM_IEEE80211_HW_FLAGS)];
363 	struct {
364 		uint32_t			listen_interval;
365 		enum ieee80211_hw_conf_flags	flags;
366 		struct cfg80211_chan_def	chandef;
367 	} conf;
368 
369 #if 0	/* leave here for documentation purposes.  This does NOT work. */
370 	/* Must stay last. */
371 	uint8_t				priv[0] __aligned(CACHE_LINE_SIZE);
372 #else
373 	void				*priv;
374 #endif
375 };
376 
377 enum ieee802111_key_flag {
378 	IEEE80211_KEY_FLAG_GENERATE_IV		= BIT(0),
379 	IEEE80211_KEY_FLAG_GENERATE_MMIC	= BIT(1),
380 	IEEE80211_KEY_FLAG_PAIRWISE		= BIT(2),
381 	IEEE80211_KEY_FLAG_PUT_IV_SPACE		= BIT(3),
382 	IEEE80211_KEY_FLAG_PUT_MIC_SPACE	= BIT(4),
383 	IEEE80211_KEY_FLAG_SW_MGMT_TX		= BIT(5),
384 };
385 
386 struct ieee80211_key_conf {
387 	atomic64_t			tx_pn;
388 	uint32_t			cipher;
389 	uint8_t				icv_len;	/* __unused nowadays? */
390 	uint8_t				iv_len;
391 	uint8_t				hw_key_idx;	/* Set by drv. */
392 	uint8_t				keyidx;
393 	uint16_t			flags;
394 	uint8_t				keylen;
395 	uint8_t				key[0];
396 };
397 
398 struct ieee80211_key_seq {
399 	/* TODO FIXME */
400 	union {
401 		struct {
402 			uint8_t		seq[IEEE80211_MAX_PN_LEN];
403 			uint8_t		seq_len;
404 		} hw;
405 		struct {
406 			uint8_t		pn[IEEE80211_CCMP_PN_LEN];
407 		} ccmp;
408 		struct {
409 			uint8_t		pn[IEEE80211_CCMP_PN_LEN];
410 		} aes_cmac;
411 		struct {
412 			uint32_t	iv32;
413 			uint16_t	iv16;
414 		} tkip;
415 	};
416 };
417 
418 
419 struct ieee80211_p2p_noa_desc {
420 	/* TODO FIXME */
421 };
422 
423 enum ieee80211_rx_status_flags {
424 	RX_FLAG_ALLOW_SAME_PN		= BIT(0),
425 	RX_FLAG_AMPDU_DETAILS		= BIT(1),
426 	RX_FLAG_AMPDU_EOF_BIT		= BIT(2),
427 	RX_FLAG_AMPDU_EOF_BIT_KNOWN	= BIT(3),
428 	RX_FLAG_DECRYPTED		= BIT(4),
429 	RX_FLAG_DUP_VALIDATED		= BIT(5),
430 	RX_FLAG_FAILED_FCS_CRC		= BIT(6),
431 	RX_FLAG_ICV_STRIPPED		= BIT(7),
432 	RX_FLAG_MACTIME_PLCP_START	= BIT(8),
433 	RX_FLAG_MACTIME_START		= BIT(9),
434 	RX_FLAG_MIC_STRIPPED		= BIT(10),
435 	RX_FLAG_MMIC_ERROR		= BIT(11),
436 	RX_FLAG_MMIC_STRIPPED		= BIT(12),
437 	RX_FLAG_NO_PSDU			= BIT(13),
438 	RX_FLAG_PN_VALIDATED		= BIT(14),
439 	RX_FLAG_RADIOTAP_HE		= BIT(15),
440 	RX_FLAG_RADIOTAP_HE_MU		= BIT(16),
441 	RX_FLAG_RADIOTAP_LSIG		= BIT(17),
442 	RX_FLAG_RADIOTAP_VENDOR_DATA	= BIT(18),
443 	RX_FLAG_NO_SIGNAL_VAL		= BIT(19),
444 };
445 
446 struct ieee80211_rx_status {
447 	/* TODO FIXME, this is too large. Over-reduce types to u8 where possible. */
448 	u8	boottime_ns;
449 	u8	mactime;
450 	u8	device_timestamp;
451 	enum ieee80211_rx_status_flags	flag;
452 	u16	freq;
453 	u8	bw;
454 #define	RATE_INFO_BW_20		0x01
455 #define	RATE_INFO_BW_40		0x02
456 #define	RATE_INFO_BW_80		0x04
457 #define	RATE_INFO_BW_160	0x08
458 #define	RATE_INFO_BW_HE_RU	0x10
459 	u8	encoding;
460 #define	RX_ENC_HE		0x01
461 #define	RX_ENC_HT		0x02
462 #define	RX_ENC_VHT		0x04
463 	u8	ampdu_reference;
464 	u8	band;
465 	u8	chains;
466 	u8	chain_signal[3];
467 	u8	signal;
468 	u8	enc_flags;
469 	u8	he_dcm;
470 	u8	he_gi;
471 	u8	he_ru;
472 	u8	zero_length_psdu_type;
473 	uint8_t		nss;
474 	uint8_t		rate_idx;
475 };
476 
477 struct ieee80211_scan_ies {
478 	/* TODO FIXME */
479 	int		common_ie_len;
480 	int		len[NUM_NL80211_BANDS];
481 	uint8_t		*common_ies;
482 	uint8_t		*ies[NUM_NL80211_BANDS];
483 };
484 
485 struct ieee80211_scan_request {
486 	struct ieee80211_scan_ies	ies;
487 	struct cfg80211_scan_request	req;
488 };
489 
490 struct ieee80211_txq {
491 	struct ieee80211_sta		*sta;
492 	struct ieee80211_vif		*vif;
493 	int				ac;
494 	uint8_t				tid;
495 
496 	/* Must stay last. */
497 	uint8_t				drv_priv[0] __aligned(CACHE_LINE_SIZE);
498 };
499 
500 struct ieee80211_sta_rates {
501 	/* XXX TODO */
502 	/* XXX some _rcu thing */
503 	struct {
504 		int	idx;
505 		int	flags;
506 	} rate[1];		/* XXX what is the real number? */
507 };
508 
509 #define	IEEE80211_NUM_TIDS			16	/* net80211::WME_NUM_TID */
510 struct ieee80211_sta {
511 	/* TODO FIXME */
512 	int		max_amsdu_len, max_amsdu_subframes, max_rc_amsdu_len, max_sp;
513 	int		mfp, rx_nss, smps_mode, tdls, tdls_initiator, uapsd_queues, wme, txpwr;
514 	enum ieee80211_sta_rx_bw		bandwidth;
515 	struct ieee80211_sta_ht_cap		ht_cap;
516 	struct ieee80211_sta_vht_cap		vht_cap;
517 	struct ieee80211_sta_he_cap		he_cap;
518 	struct ieee80211_sta_he_6ghz_capa	he_6ghz_capa;
519 	struct ieee80211_txq			*txq[IEEE80211_NUM_TIDS + 1];	/* iwlwifi: 8 and adds +1 to tid_data, net80211::IEEE80211_TID_SIZE */
520 	struct ieee80211_sta_rates		*rates;	/* some rcu thing? */
521 	uint32_t				max_tid_amsdu_len[IEEE80211_NUM_TIDS];
522 	uint32_t				supp_rates[NUM_NL80211_BANDS];
523 	uint8_t					addr[ETH_ALEN];
524 	uint16_t				aid;
525 
526 	/* Must stay last. */
527 	uint8_t					drv_priv[0] __aligned(CACHE_LINE_SIZE);
528 };
529 
530 struct ieee80211_tdls_ch_sw_params {
531 	/* TODO FIXME */
532 	int		action_code, ch_sw_tm_ie, status, switch_time, switch_timeout, timestamp;
533 	struct ieee80211_sta			*sta;
534 	struct cfg80211_chan_def		*chandef;
535 	struct sk_buff				*tmpl_skb;
536 };
537 
538 struct ieee80211_tx_control {
539 	/* TODO FIXME */
540 	struct ieee80211_sta			*sta;
541 };
542 
543 struct ieee80211_tx_queue_params {
544 	/* These types are based on iwlwifi FW structs. */
545 	uint16_t	cw_min;
546 	uint16_t	cw_max;
547 	uint16_t	txop;
548 	uint8_t		aifs;
549 
550 	/* TODO FIXME */
551 	int		acm, mu_edca, uapsd;
552 	struct ieee80211_he_mu_edca_param_ac_rec	mu_edca_param_rec;
553 };
554 
555 struct ieee80211_tx_rate {
556 	uint8_t		idx;
557 	uint16_t	count:5,
558 			flags:11;
559 };
560 
561 enum ieee80211_vif_driver_flags {
562 	IEEE80211_VIF_BEACON_FILTER		= BIT(0),
563 	IEEE80211_VIF_SUPPORTS_CQM_RSSI		= BIT(1),
564 	IEEE80211_VIF_SUPPORTS_UAPSD		= BIT(2),
565 };
566 
567 struct ieee80211_vif {
568 	/* TODO FIXME */
569 	enum nl80211_iftype		type;
570 	int		csa_active, mu_mimo_owner;
571 	int		cab_queue, hw_queue;
572 	enum ieee80211_vif_driver_flags	driver_flags;
573 	bool				p2p;
574 	bool				probe_req_reg;
575 	uint8_t				addr[ETH_ALEN];
576 	struct ieee80211_chanctx_conf	*chanctx_conf;
577 	struct ieee80211_txq		*txq;
578 	struct ieee80211_bss_conf	bss_conf;
579 
580 	/* Must stay last. */
581 	uint8_t				drv_priv[0] __aligned(CACHE_LINE_SIZE);
582 };
583 
584 struct ieee80211_vif_chanctx_switch {
585 	struct ieee80211_chanctx_conf	*old_ctx, *new_ctx;
586 	struct ieee80211_vif		*vif;
587 };
588 
589 struct ieee80211_prep_tx_info {
590 	u16				duration;
591 	bool				success;
592 };
593 
594 /* XXX-BZ too big, over-reduce size to u8, and array sizes to minuimum to fit in skb->cb. */
595 /* Also warning: some sizes change by pointer size!  This is 64bit only. */
596 struct ieee80211_tx_info {
597 	enum ieee80211_tx_info_flags		flags;
598 	/* TODO FIXME */
599 	u8		band;
600 	u8		hw_queue;
601 	bool		tx_time_est;
602 	union {
603 		struct {
604 			struct ieee80211_tx_rate	rates[4];
605 			bool				use_rts;
606 			struct ieee80211_vif		*vif;
607 			struct ieee80211_key_conf	*hw_key;
608 			enum ieee80211_tx_control_flags	flags;
609 		} control;
610 		struct {
611 			struct ieee80211_tx_rate	rates[4];
612 			uint32_t			ack_signal;
613 			uint8_t				ampdu_ack_len;
614 			uint8_t				ampdu_len;
615 			uint8_t				antenna;
616 			uint16_t			tx_time;
617 			bool				is_valid_ack_signal;
618 			void				*status_driver_data[2];		/* XXX TODO */
619 		} status;
620 		void					*driver_data[5];		/* XXX TODO */
621 	};
622 };
623 
624 /* net80211 conflict */
625 #ifdef FIXME_TODO
626 struct ieee80211_tim_ie {
627 	/* TODO FIXME */
628 	uint8_t				dtim_count;
629 	uint8_t				dtim_period;
630 	uint8_t				bitmap_ctrl;
631 	uint8_t				virtual_map;
632 };
633 #endif
634 
635 struct survey_info {		/* net80211::struct ieee80211_channel_survey */
636 	/* TODO FIXME */
637 	uint32_t			filled;
638 #define	SURVEY_INFO_TIME		0x0001
639 #define	SURVEY_INFO_TIME_RX		0x0002
640 #define	SURVEY_INFO_TIME_SCAN		0x0004
641 #define	SURVEY_INFO_TIME_TX		0x0008
642 #define	SURVEY_INFO_TIME_BSS_RX		0x0010
643 #define	SURVEY_INFO_TIME_BUSY		0x0020
644 #define	SURVEY_INFO_IN_USE		0x0040
645 #define	SURVEY_INFO_NOISE_DBM		0x0080
646 	uint32_t			noise;
647 	uint64_t			time;
648 	uint64_t			time_bss_rx;
649 	uint64_t			time_busy;
650 	uint64_t			time_rx;
651 	uint64_t			time_scan;
652 	uint64_t			time_tx;
653 	struct ieee80211_channel	*channel;
654 };
655 
656 enum ieee80211_iface_iter {
657 	IEEE80211_IFACE_ITER_NORMAL	= BIT(0),
658 	IEEE80211_IFACE_ITER_RESUME_ALL	= BIT(1),
659 
660 	/* Internal flags only. */
661 	/* ieee80211_iterate_active_interfaces*(). */
662 	IEEE80211_IFACE_ITER__ATOMIC	= BIT(6),
663 	IEEE80211_IFACE_ITER__ACTIVE	= BIT(7),
664 };
665 
666 enum set_key_cmd {
667 	SET_KEY,
668 	DISABLE_KEY,
669 };
670 
671 enum rx_enc_flags {
672 	RX_ENC_FLAG_SHORTPRE	=	BIT(0),
673 	RX_ENC_FLAG_SHORT_GI	=	BIT(1),
674 	RX_ENC_FLAG_HT_GF	=	BIT(2),
675 	RX_ENC_FLAG_LDPC	=	BIT(3),
676 	RX_ENC_FLAG_BF		=	BIT(4),
677 #define	RX_ENC_FLAG_STBC_SHIFT		6
678 };
679 
680 enum sta_notify_cmd {
681 	STA_NOTIFY_AWAKE,
682 	STA_NOTIFY_SLEEP,
683 };
684 
685 struct ieee80211_ops {
686 	/* TODO FIXME */
687 	int  (*start)(struct ieee80211_hw *);
688 	void (*stop)(struct ieee80211_hw *);
689 
690 	int  (*config)(struct ieee80211_hw *, u32);
691 	void (*reconfig_complete)(struct ieee80211_hw *, enum ieee80211_reconfig_type);
692 
693 	int  (*add_interface)(struct ieee80211_hw *, struct ieee80211_vif *);
694 	void (*remove_interface)(struct ieee80211_hw *, struct ieee80211_vif *);
695 	int  (*change_interface)(struct ieee80211_hw *, struct ieee80211_vif *, enum nl80211_iftype, bool);
696 
697 	void (*sw_scan_start)(struct ieee80211_hw *, struct ieee80211_vif *, const u8 *);
698 	void (*sw_scan_complete)(struct ieee80211_hw *, struct ieee80211_vif *);
699 	int  (*sched_scan_start)(struct ieee80211_hw *, struct ieee80211_vif *, struct cfg80211_sched_scan_request *, struct ieee80211_scan_ies *);
700 	int  (*sched_scan_stop)(struct ieee80211_hw *, struct ieee80211_vif *);
701 	int  (*hw_scan)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_scan_request *);
702 	void (*cancel_hw_scan)(struct ieee80211_hw *, struct ieee80211_vif *);
703 
704 	int  (*conf_tx)(struct ieee80211_hw *, struct ieee80211_vif *, u16, const struct ieee80211_tx_queue_params *);
705 	void (*tx)(struct ieee80211_hw *, struct ieee80211_tx_control *, struct sk_buff *);
706 	int  (*tx_last_beacon)(struct ieee80211_hw *);
707 	void (*wake_tx_queue)(struct ieee80211_hw *, struct ieee80211_txq *);
708 
709 	void (*mgd_prepare_tx)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_prep_tx_info *);
710 	void (*mgd_complete_tx)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_prep_tx_info *);
711 	void (*mgd_protect_tdls_discover)(struct ieee80211_hw *, struct ieee80211_vif *);
712 
713 	void (*flush)(struct ieee80211_hw *, struct ieee80211_vif *, u32, bool);
714 
715 	int  (*set_frag_threshold)(struct ieee80211_hw *, u32);
716 
717 	void (*sync_rx_queues)(struct ieee80211_hw *);
718 
719 	void (*allow_buffered_frames)(struct ieee80211_hw *, struct ieee80211_sta *, u16, int, enum ieee80211_frame_release_type, bool);
720 	void (*release_buffered_frames)(struct ieee80211_hw *, struct ieee80211_sta *, u16, int, enum ieee80211_frame_release_type, bool);
721 
722 	int  (*sta_add)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *);
723 	int  (*sta_remove)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *);
724 	int  (*sta_set_txpwr)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *);
725 	void (*sta_statistics)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, struct station_info *);
726 	void (*sta_pre_rcu_remove)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *);
727 	int  (*sta_state)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, enum ieee80211_sta_state, enum ieee80211_sta_state);
728 	void (*sta_notify)(struct ieee80211_hw *, struct ieee80211_vif *, enum sta_notify_cmd, struct ieee80211_sta *);
729 	void (*sta_rc_update)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, u32);
730 	void (*sta_rate_tbl_update)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *);
731 
732 	u64  (*prepare_multicast)(struct ieee80211_hw *, struct netdev_hw_addr_list *);
733 
734 	int  (*ampdu_action)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_ampdu_params *);
735 
736 	bool (*can_aggregate_in_amsdu)(struct ieee80211_hw *, struct sk_buff *, struct sk_buff *);
737 
738 	int  (*pre_channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_channel_switch *);
739 	int  (*post_channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *);
740 	void (*channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_channel_switch *);
741 	void (*abort_channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *);
742 	void (*channel_switch_rx_beacon)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_channel_switch *);
743 	int  (*tdls_channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, u8, struct cfg80211_chan_def *, struct sk_buff *, u32);
744 	void (*tdls_cancel_channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *);
745 	void (*tdls_recv_channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_tdls_ch_sw_params *);
746 
747 	int  (*add_chanctx)(struct ieee80211_hw *, struct ieee80211_chanctx_conf *);
748 	void (*remove_chanctx)(struct ieee80211_hw *, struct ieee80211_chanctx_conf *);
749 	void (*change_chanctx)(struct ieee80211_hw *, struct ieee80211_chanctx_conf *, u32);
750 	int  (*assign_vif_chanctx)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_chanctx_conf *);
751 	void (*unassign_vif_chanctx)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_chanctx_conf *);
752 	int  (*switch_vif_chanctx)(struct ieee80211_hw *, struct ieee80211_vif_chanctx_switch *, int, enum ieee80211_chanctx_switch_mode);
753 
754 	int  (*get_antenna)(struct ieee80211_hw *, u32 *, u32 *);
755 	int  (*set_antenna)(struct ieee80211_hw *, u32, u32);
756 
757 	int  (*remain_on_channel)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_channel *, int, enum ieee80211_roc_type);
758 	int  (*cancel_remain_on_channel)(struct ieee80211_hw *, struct ieee80211_vif *);
759 
760 	void (*configure_filter)(struct ieee80211_hw *, unsigned int, unsigned int *, u64);
761 	void (*config_iface_filter)(struct ieee80211_hw *, struct ieee80211_vif *, unsigned int, unsigned int);
762 
763 	void (*bss_info_changed)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_bss_conf *, u32);
764 	int  (*set_rts_threshold)(struct ieee80211_hw *, u32);
765 	void (*event_callback)(struct ieee80211_hw *, struct ieee80211_vif *, const struct ieee80211_event *);
766 	int  (*get_survey)(struct ieee80211_hw *, int, struct survey_info *);
767 	int  (*get_ftm_responder_stats)(struct ieee80211_hw *, struct ieee80211_vif *, struct cfg80211_ftm_responder_stats *);
768 	void (*offset_tsf)(struct ieee80211_hw *, struct ieee80211_vif *, s64);
769 	int  (*set_bitrate_mask)(struct ieee80211_hw *, struct ieee80211_vif *, const struct cfg80211_bitrate_mask *);
770 	void (*set_coverage_class)(struct ieee80211_hw *, s16);
771 	int  (*set_tim)(struct ieee80211_hw *, struct ieee80211_sta *, bool);
772 
773 	int  (*set_key)(struct ieee80211_hw *, enum set_key_cmd, struct ieee80211_vif *, struct ieee80211_sta *, struct ieee80211_key_conf *);
774 	void (*set_default_unicast_key)(struct ieee80211_hw *, struct ieee80211_vif *, int);
775 	void (*update_tkip_key)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_key_conf *, struct ieee80211_sta *, u32, u16 *);
776 
777 	int  (*start_pmsr)(struct ieee80211_hw *, struct ieee80211_vif *, struct cfg80211_pmsr_request *);
778 	void (*abort_pmsr)(struct ieee80211_hw *, struct ieee80211_vif *, struct cfg80211_pmsr_request *);
779 
780 	int  (*start_ap)(struct ieee80211_hw *, struct ieee80211_vif *);
781 	void (*stop_ap)(struct ieee80211_hw *, struct ieee80211_vif *);
782 	int  (*join_ibss)(struct ieee80211_hw *, struct ieee80211_vif *);
783 	void (*leave_ibss)(struct ieee80211_hw *, struct ieee80211_vif *);
784 
785 	/* XXX TODO: get_et_sset_count, get_et_stats, get_et_strings */
786 };
787 
788 
789 /* -------------------------------------------------------------------------- */
790 
791 /* linux_80211.c */
792 extern const struct cfg80211_ops linuxkpi_mac80211cfgops;
793 
794 struct ieee80211_hw *linuxkpi_ieee80211_alloc_hw(size_t,
795     const struct ieee80211_ops *);
796 void linuxkpi_ieee80211_iffree(struct ieee80211_hw *);
797 void linuxkpi_set_ieee80211_dev(struct ieee80211_hw *, char *);
798 void linuxkpi_ieee80211_ifattach(struct ieee80211_hw *);
799 void linuxkpi_ieee80211_ifdetach(struct ieee80211_hw *);
800 struct ieee80211_hw * linuxkpi_wiphy_to_ieee80211_hw(struct wiphy *);
801 void linuxkpi_ieee80211_iterate_interfaces(
802     struct ieee80211_hw *hw, enum ieee80211_iface_iter flags,
803     void(*iterfunc)(void *, uint8_t *, struct ieee80211_vif *),
804     void *);
805 void linuxkpi_ieee80211_iterate_keys(struct ieee80211_hw *,
806     struct ieee80211_vif *,
807     void(*iterfunc)(struct ieee80211_hw *, struct ieee80211_vif *,
808         struct ieee80211_sta *, struct ieee80211_key_conf *, void *),
809     void *);
810 void linuxkpi_ieee80211_iterate_chan_contexts(struct ieee80211_hw *,
811     void(*iterfunc)(struct ieee80211_hw *,
812 	struct ieee80211_chanctx_conf *, void *),
813     void *);
814 void linuxkpi_ieee80211_iterate_stations_atomic(struct ieee80211_hw *,
815    void (*iterfunc)(void *, struct ieee80211_sta *), void *);
816 void linuxkpi_ieee80211_scan_completed(struct ieee80211_hw *,
817     struct cfg80211_scan_info *);
818 void linuxkpi_ieee80211_rx(struct ieee80211_hw *, struct sk_buff *,
819     struct ieee80211_sta *, struct napi_struct *);
820 uint8_t linuxkpi_ieee80211_get_tid(struct ieee80211_hdr *);
821 struct ieee80211_sta *linuxkpi_ieee80211_find_sta(struct ieee80211_vif *,
822     const u8 *);
823 struct ieee80211_sta *linuxkpi_ieee80211_find_sta_by_ifaddr(
824     struct ieee80211_hw *, uint8_t *, uint8_t *);
825 struct sk_buff *linuxkpi_ieee80211_tx_dequeue(struct ieee80211_hw *,
826     struct ieee80211_txq *);
827 bool linuxkpi_ieee80211_is_ie_id_in_ie_buf(const u8, const u8 *, size_t);
828 bool linuxkpi_ieee80211_ie_advance(size_t *, const u8 *, size_t);
829 void linuxkpi_ieee80211_free_txskb(struct ieee80211_hw *, struct sk_buff *,
830     int);
831 void linuxkpi_ieee80211_queue_delayed_work(struct ieee80211_hw *,
832     struct delayed_work *, int);
833 void linuxkpi_ieee80211_queue_work(struct ieee80211_hw *, struct work_struct *);
834 struct sk_buff *linuxkpi_ieee80211_pspoll_get(struct ieee80211_hw *,
835     struct ieee80211_vif *);
836 struct sk_buff *linuxkpi_ieee80211_nullfunc_get(struct ieee80211_hw *,
837     struct ieee80211_vif *, bool);
838 void linuxkpi_ieee80211_txq_get_depth(struct ieee80211_txq *, uint64_t *,
839     uint64_t *);
840 struct wireless_dev *linuxkpi_ieee80211_vif_to_wdev(struct ieee80211_vif *);
841 void linuxkpi_ieee80211_connection_loss(struct ieee80211_vif *);
842 
843 /* -------------------------------------------------------------------------- */
844 
845 static __inline void
846 _ieee80211_hw_set(struct ieee80211_hw *hw, enum ieee80211_hw_flags flag)
847 {
848 
849 	set_bit(flag, hw->flags);
850 }
851 
852 static __inline bool
853 __ieee80211_hw_check(struct ieee80211_hw *hw, enum ieee80211_hw_flags flag)
854 {
855 
856 	return (test_bit(flag, hw->flags));
857 }
858 
859 /* They pass in shortened flag names; how confusingly inconsistent. */
860 #define	ieee80211_hw_set(_hw, _flag)					\
861 	_ieee80211_hw_set(_hw, IEEE80211_HW_ ## _flag)
862 #define	ieee80211_hw_check(_hw, _flag)					\
863 	__ieee80211_hw_check(_hw, IEEE80211_HW_ ## _flag)
864 
865 /* XXX-BZ add CTASSERTS that size of struct is <= sizeof skb->cb. */
866 CTASSERT(sizeof(struct ieee80211_tx_info) <= sizeof(((struct sk_buff *)0)->cb));
867 #define	IEEE80211_SKB_CB(_skb)						\
868 	((struct ieee80211_tx_info *)((_skb)->cb))
869 
870 CTASSERT(sizeof(struct ieee80211_rx_status) <= sizeof(((struct sk_buff *)0)->cb));
871 #define	IEEE80211_SKB_RXCB(_skb)					\
872 	((struct ieee80211_rx_status *)((_skb)->cb))
873 
874 static __inline void
875 ieee80211_free_hw(struct ieee80211_hw *hw)
876 {
877 
878 	linuxkpi_ieee80211_iffree(hw);
879 
880 	if (hw->wiphy != NULL)
881 		wiphy_free(hw->wiphy);
882 	/* Note that *hw is not valid any longer after this. */
883 
884 	IMPROVE();
885 }
886 
887 static __inline struct ieee80211_hw *
888 ieee80211_alloc_hw(size_t priv_len, const struct ieee80211_ops *ops)
889 {
890 
891 	return (linuxkpi_ieee80211_alloc_hw(priv_len, ops));
892 }
893 
894 static __inline void
895 SET_IEEE80211_DEV(struct ieee80211_hw *hw, struct device *dev)
896 {
897 
898 	set_wiphy_dev(hw->wiphy, dev);
899 	linuxkpi_set_ieee80211_dev(hw, dev_name(dev));
900 
901 	IMPROVE();
902 }
903 
904 static __inline int
905 ieee80211_register_hw(struct ieee80211_hw *hw)
906 {
907 	int error;
908 
909 	error = wiphy_register(hw->wiphy);
910 	if (error != 0)
911 		return (error);
912 
913 	/*
914 	 * At this point the driver has set all the options, flags, bands,
915 	 * ciphers, hw address(es), ... basically mac80211/cfg80211 hw/wiphy
916 	 * setup is done.
917 	 * We need to replicate a lot of information from here into net80211.
918 	 */
919 	linuxkpi_ieee80211_ifattach(hw);
920 
921 	IMPROVE();
922 
923 	return (0);
924 }
925 
926 static __inline void
927 ieee80211_unregister_hw(struct ieee80211_hw *hw)
928 {
929 
930 	wiphy_unregister(hw->wiphy);
931 	linuxkpi_ieee80211_ifdetach(hw);
932 
933 	IMPROVE();
934 }
935 
936 static __inline struct ieee80211_hw *
937 wiphy_to_ieee80211_hw(struct wiphy *wiphy)
938 {
939 
940 	return (linuxkpi_wiphy_to_ieee80211_hw(wiphy));
941 }
942 
943 /* -------------------------------------------------------------------------- */
944 
945 static __inline bool
946 ieee80211_is_action(__le16 fc)
947 {
948 	__le16 v;
949 
950 	fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK);
951 	v = htole16(IEEE80211_FC0_SUBTYPE_ACTION | IEEE80211_FC0_TYPE_MGT);
952 
953 	return (fc == v);
954 }
955 
956 static __inline bool
957 ieee80211_is_probe_resp(__le16 fc)
958 {
959 	__le16 v;
960 
961 	fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK);
962 	v = htole16(IEEE80211_FC0_SUBTYPE_PROBE_RESP | IEEE80211_FC0_TYPE_MGT);
963 
964 	return (fc == v);
965 }
966 
967 static __inline bool
968 ieee80211_is_auth(__le16 fc)
969 {
970 	__le16 v;
971 
972 	fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK);
973 	v = htole16(IEEE80211_FC0_SUBTYPE_AUTH | IEEE80211_FC0_TYPE_MGT);
974 
975 	return (fc == v);
976 }
977 
978 static __inline bool
979 ieee80211_is_assoc_req(__le16 fc)
980 {
981 	__le16 v;
982 
983 	fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK);
984 	v = htole16(IEEE80211_FC0_SUBTYPE_ASSOC_REQ | IEEE80211_FC0_TYPE_MGT);
985 
986 	return (fc == v);
987 }
988 
989 static __inline bool
990 ieee80211_is_assoc_resp(__le16 fc)
991 {
992 	__le16 v;
993 
994 	fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK);
995 	v = htole16(IEEE80211_FC0_SUBTYPE_ASSOC_RESP | IEEE80211_FC0_TYPE_MGT);
996 
997 	return (fc == v);
998 }
999 
1000 static __inline bool
1001 ieee80211_is_reassoc_req(__le16 fc)
1002 {
1003 	__le16 v;
1004 
1005 	fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK);
1006 	v = htole16(IEEE80211_FC0_SUBTYPE_REASSOC_REQ | IEEE80211_FC0_TYPE_MGT);
1007 
1008 	return (fc == v);
1009 }
1010 
1011 static __inline bool
1012 ieee80211_is_reassoc_resp(__le16 fc)
1013 {
1014 	__le16 v;
1015 
1016 	fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK);
1017 	v = htole16(IEEE80211_FC0_SUBTYPE_REASSOC_RESP | IEEE80211_FC0_TYPE_MGT);
1018 
1019 	return (fc == v);
1020 }
1021 
1022 static __inline bool
1023 ieee80211_is_disassoc(__le16 fc)
1024 {
1025 	__le16 v;
1026 
1027 	fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK);
1028 	v = htole16(IEEE80211_FC0_SUBTYPE_DISASSOC | IEEE80211_FC0_TYPE_MGT);
1029 
1030 	return (fc == v);
1031 }
1032 
1033 static __inline bool
1034 ieee80211_is_data_present(__le16 fc)
1035 {
1036 	TODO();
1037 	return (false);
1038 }
1039 
1040 static __inline bool
1041 ieee80211_is_deauth(__le16 fc)
1042 {
1043 	__le16 v;
1044 
1045 	fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK);
1046 	v = htole16(IEEE80211_FC0_SUBTYPE_DEAUTH | IEEE80211_FC0_TYPE_MGT);
1047 
1048 	return (fc == v);
1049 }
1050 
1051 static __inline bool
1052 ieee80211_is_beacon(__le16 fc)
1053 {
1054 	__le16 v;
1055 
1056 	/*
1057 	 * For as much as I get it this comes in LE and unlike FreeBSD
1058 	 * where we get the entire frame header and u8[], here we get the
1059 	 * 9.2.4.1 Frame Control field only. Mask and compare.
1060 	 */
1061 	fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK);
1062 	v = htole16(IEEE80211_FC0_SUBTYPE_BEACON | IEEE80211_FC0_TYPE_MGT);
1063 
1064 	return (fc == v);
1065 }
1066 
1067 
1068 static __inline bool
1069 ieee80211_is_probe_req(__le16 fc)
1070 {
1071 	__le16 v;
1072 
1073 	fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK);
1074 	v = htole16(IEEE80211_FC0_SUBTYPE_PROBE_REQ | IEEE80211_FC0_TYPE_MGT);
1075 
1076 	return (fc == v);
1077 }
1078 
1079 static __inline bool
1080 ieee80211_has_protected(__le16 fc)
1081 {
1082 
1083 	return (fc & htole16(IEEE80211_FC1_PROTECTED << 8));
1084 }
1085 
1086 static __inline bool
1087 ieee80211_is_back_req(__le16 fc)
1088 {
1089 	__le16 v;
1090 
1091 	fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK);
1092 	v = htole16(IEEE80211_FC0_SUBTYPE_BAR | IEEE80211_FC0_TYPE_CTL);
1093 
1094 	return (fc == v);
1095 }
1096 
1097 static __inline bool
1098 ieee80211_is_bufferable_mmpdu(__le16 fc)
1099 {
1100 	TODO();
1101 	return (false);
1102 }
1103 
1104 static __inline bool
1105 ieee80211_is_nullfunc(__le16 fc)
1106 {
1107 	__le16 v;
1108 
1109 	fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK);
1110 	v = htole16(IEEE80211_FC0_SUBTYPE_NODATA | IEEE80211_FC0_TYPE_DATA);
1111 
1112 	return (fc == v);
1113 }
1114 
1115 static __inline bool
1116 ieee80211_is_qos_nullfunc(__le16 fc)
1117 {
1118 	__le16 v;
1119 
1120 	fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK);
1121 	v = htole16(IEEE80211_FC0_SUBTYPE_QOS_NULL | IEEE80211_FC0_TYPE_DATA);
1122 
1123 	return (fc == v);
1124 }
1125 
1126 static __inline bool
1127 ieee80211_is_any_nullfunc(__le16 fc)
1128 {
1129 
1130 	return (ieee80211_is_nullfunc(fc) || ieee80211_is_qos_nullfunc(fc));
1131 }
1132 
1133 static __inline bool
1134 ieee80211_vif_is_mesh(struct ieee80211_vif *vif)
1135 {
1136 	TODO();
1137 	return (false);
1138 }
1139 
1140 static __inline bool
1141 ieee80211_has_a4(__le16 fc)
1142 {
1143 	__le16 v;
1144 
1145 	fc &= htole16((IEEE80211_FC1_DIR_TODS | IEEE80211_FC1_DIR_FROMDS) << 8);
1146 	v = htole16((IEEE80211_FC1_DIR_TODS | IEEE80211_FC1_DIR_FROMDS) << 8);
1147 
1148 	return (fc == v);
1149 }
1150 
1151 static __inline bool
1152 ieee80211_has_order(__le16 fc)
1153 {
1154 
1155 	return (fc & htole16(IEEE80211_FC1_ORDER << 8));
1156 }
1157 
1158 static __inline bool
1159 ieee80211_has_retry(__le16 fc)
1160 {
1161 
1162 	return (fc & htole16(IEEE80211_FC1_RETRY << 8));
1163 }
1164 
1165 
1166 static __inline bool
1167 ieee80211_has_fromds(__le16 fc)
1168 {
1169 
1170 	return (fc & htole16(IEEE80211_FC1_DIR_FROMDS << 8));
1171 }
1172 
1173 static __inline bool
1174 ieee80211_has_tods(__le16 fc)
1175 {
1176 
1177 	return (fc & htole16(IEEE80211_FC1_DIR_TODS << 8));
1178 }
1179 
1180 static __inline uint8_t *
1181 ieee80211_get_SA(struct ieee80211_hdr *hdr)
1182 {
1183 
1184 	if (ieee80211_has_a4(hdr->frame_control))
1185 		return (hdr->addr4);
1186 	if (ieee80211_has_fromds(hdr->frame_control))
1187 		return (hdr->addr3);
1188 	return (hdr->addr2);
1189 }
1190 
1191 static __inline uint8_t *
1192 ieee80211_get_DA(struct ieee80211_hdr *hdr)
1193 {
1194 
1195 	if (ieee80211_has_tods(hdr->frame_control))
1196 		return (hdr->addr3);
1197 	return (hdr->addr1);
1198 }
1199 
1200 static __inline bool
1201 ieee80211_has_morefrags(__le16 fc)
1202 {
1203 
1204 	fc &= htole16(IEEE80211_FC1_MORE_FRAG << 8);
1205 	return (fc != 0);
1206 }
1207 
1208 static __inline u8 *
1209 ieee80211_get_qos_ctl(struct ieee80211_hdr *hdr)
1210 {
1211         if (ieee80211_has_a4(hdr->frame_control))
1212                 return (u8 *)hdr + 30;
1213         else
1214                 return (u8 *)hdr + 24;
1215 }
1216 
1217 /* -------------------------------------------------------------------------- */
1218 /* Receive functions (air/driver to mac80211/net80211). */
1219 
1220 
1221 static __inline void
1222 ieee80211_rx_napi(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
1223     struct sk_buff *skb, struct napi_struct *napi)
1224 {
1225 
1226 	linuxkpi_ieee80211_rx(hw, skb, sta, napi);
1227 }
1228 
1229 static __inline void
1230 ieee80211_rx_ni(struct ieee80211_hw *hw, struct sk_buff *skb)
1231 {
1232 
1233 	linuxkpi_ieee80211_rx(hw, skb, NULL, NULL);
1234 }
1235 
1236 static __inline void
1237 ieee80211_rx_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb)
1238 {
1239 
1240 	linuxkpi_ieee80211_rx(hw, skb, NULL, NULL);
1241 }
1242 
1243 /* -------------------------------------------------------------------------- */
1244 
1245 static __inline uint8_t
1246 ieee80211_get_tid(struct ieee80211_hdr *hdr)
1247 {
1248 
1249 	return (linuxkpi_ieee80211_get_tid(hdr));
1250 }
1251 
1252 static __inline void
1253 ieee80211_iterate_active_interfaces_atomic(struct ieee80211_hw *hw,
1254     enum ieee80211_iface_iter flags,
1255     void(*iterfunc)(void *, uint8_t *, struct ieee80211_vif *),
1256     void *arg)
1257 {
1258 
1259 	flags |= IEEE80211_IFACE_ITER__ATOMIC;
1260 	flags |= IEEE80211_IFACE_ITER__ACTIVE;
1261 	linuxkpi_ieee80211_iterate_interfaces(hw, flags, iterfunc, arg);
1262 }
1263 
1264 static __inline void
1265 ieee80211_iterate_active_interfaces(struct ieee80211_hw *hw,
1266     enum ieee80211_iface_iter flags,
1267     void(*iterfunc)(void *, uint8_t *, struct ieee80211_vif *),
1268     void *arg)
1269 {
1270 
1271 	flags |= IEEE80211_IFACE_ITER__ACTIVE;
1272 	linuxkpi_ieee80211_iterate_interfaces(hw, flags, iterfunc, arg);
1273 }
1274 
1275 static __inline void
1276 ieee80211_iterate_interfaces(struct ieee80211_hw *hw,
1277    enum ieee80211_iface_iter flags,
1278    void (*iterfunc)(void *, uint8_t *, struct ieee80211_vif *),
1279    void *arg)
1280 {
1281 
1282 	linuxkpi_ieee80211_iterate_interfaces(hw, flags, iterfunc, arg);
1283 }
1284 
1285 static __inline void
1286 ieee80211_iter_keys(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1287     void(*iterfunc)(struct ieee80211_hw *, struct ieee80211_vif *,
1288         struct ieee80211_sta *, struct ieee80211_key_conf *, void *),
1289     void *arg)
1290 {
1291 
1292 	linuxkpi_ieee80211_iterate_keys(hw, vif, iterfunc, arg);
1293 }
1294 
1295 static __inline void
1296 ieee80211_iter_keys_rcu(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1297     void(*iterfunc)(struct ieee80211_hw *, struct ieee80211_vif *,
1298         struct ieee80211_sta *, struct ieee80211_key_conf *, void *),
1299     void *arg)
1300 {
1301 
1302 	IMPROVE();	/* "rcu" */
1303 	linuxkpi_ieee80211_iterate_keys(hw, vif, iterfunc, arg);
1304 }
1305 
1306 static __inline void
1307 ieee80211_iter_chan_contexts_atomic(struct ieee80211_hw *hw,
1308     void(*iterfunc)(struct ieee80211_hw *, struct ieee80211_chanctx_conf *, void *),
1309     void *arg)
1310 {
1311 
1312 	linuxkpi_ieee80211_iterate_chan_contexts(hw, iterfunc, arg);
1313 }
1314 
1315 static __inline void
1316 ieee80211_iterate_stations_atomic(struct ieee80211_hw *hw,
1317    void (*iterfunc)(void *, struct ieee80211_sta *), void *arg)
1318 {
1319 
1320 	linuxkpi_ieee80211_iterate_stations_atomic(hw, iterfunc, arg);
1321 }
1322 
1323 static __inline struct wireless_dev *
1324 ieee80211_vif_to_wdev(struct ieee80211_vif *vif)
1325 {
1326 
1327 	return (linuxkpi_ieee80211_vif_to_wdev(vif));
1328 }
1329 
1330 static __inline struct sk_buff *
1331 ieee80211_beacon_get_template(struct ieee80211_hw *hw,
1332     struct ieee80211_vif *vif, void *p /* XXX TODO */)
1333 {
1334 	TODO();
1335 	return (NULL);
1336 }
1337 
1338 static __inline void
1339 ieee80211_beacon_loss(struct ieee80211_vif *vif)
1340 {
1341 	TODO();
1342 }
1343 
1344 static __inline void
1345 ieee80211_chswitch_done(struct ieee80211_vif *vif, bool t)
1346 {
1347 	TODO();
1348 }
1349 
1350 static __inline bool
1351 ieee80211_csa_is_complete(struct ieee80211_vif *vif)
1352 {
1353 	TODO();
1354 	return (false);
1355 }
1356 
1357 static __inline void
1358 ieee80211_csa_set_counter(struct ieee80211_vif *vif, uint8_t counter)
1359 {
1360 	TODO();
1361 }
1362 
1363 static __inline int
1364 ieee80211_csa_update_counter(struct ieee80211_vif *vif)
1365 {
1366 	TODO();
1367 	return (-1);
1368 }
1369 
1370 static __inline void
1371 ieee80211_csa_finish(struct ieee80211_vif *vif)
1372 {
1373 	TODO();
1374 }
1375 
1376 static __inline enum nl80211_iftype
1377 ieee80211_vif_type_p2p(struct ieee80211_vif *vif)
1378 {
1379 
1380 	/* If we are not p2p enabled, just return the type. */
1381 	if (!vif->p2p)
1382 		return (vif->type);
1383 
1384 	/* If we are p2p, depending on side, return type. */
1385 	switch (vif->type) {
1386 	case NL80211_IFTYPE_AP:
1387 		return (NL80211_IFTYPE_P2P_GO);
1388 	case NL80211_IFTYPE_STATION:
1389 		return (NL80211_IFTYPE_P2P_CLIENT);
1390 	default:
1391 		fallthrough;
1392 	}
1393 	return (vif->type);
1394 }
1395 
1396 static __inline unsigned long
1397 ieee80211_tu_to_usec(unsigned long tu)
1398 {
1399 
1400 	return (tu * IEEE80211_DUR_TU);
1401 }
1402 
1403 
1404 static __inline int
1405 ieee80211_action_contains_tpc(struct sk_buff *skb)
1406 {
1407 	TODO();
1408 	return (0);
1409 }
1410 
1411 static __inline void
1412 ieee80211_connection_loss(struct ieee80211_vif *vif)
1413 {
1414 
1415 	linuxkpi_ieee80211_connection_loss(vif);
1416 }
1417 
1418 static __inline struct ieee80211_sta *
1419 ieee80211_find_sta(struct ieee80211_vif *vif, const u8 *peer)
1420 {
1421 
1422 	return (linuxkpi_ieee80211_find_sta(vif, peer));
1423 }
1424 
1425 static __inline struct ieee80211_sta *
1426 ieee80211_find_sta_by_ifaddr(struct ieee80211_hw *hw, uint8_t *addr,
1427     uint8_t *ourvifaddr)
1428 {
1429 
1430 	return (linuxkpi_ieee80211_find_sta_by_ifaddr(hw, addr, ourvifaddr));
1431 }
1432 
1433 
1434 static __inline void
1435 ieee80211_get_tkip_p2k(struct ieee80211_key_conf *keyconf,
1436     struct sk_buff *skb_frag, u8 *key)
1437 {
1438 	TODO();
1439 }
1440 
1441 static __inline void
1442 ieee80211_get_tkip_rx_p1k(struct ieee80211_key_conf *keyconf,
1443     const u8 *addr, uint32_t iv32, u16 *p1k)
1444 {
1445 	TODO();
1446 }
1447 
1448 static __inline size_t
1449 ieee80211_ie_split(const u8 *ies, size_t ies_len,
1450     const u8 *ie_ids, size_t ie_ids_len, size_t start)
1451 {
1452 	size_t x;
1453 
1454 	x = start;
1455 
1456 	/* XXX FIXME, we need to deal with "Element ID Extension" */
1457 	while (x < ies_len) {
1458 
1459 		/* Is this IE[s] one of the ie_ids? */
1460 		if (!linuxkpi_ieee80211_is_ie_id_in_ie_buf(ies[x],
1461 		    ie_ids, ie_ids_len))
1462 			break;
1463 
1464 		if (!linuxkpi_ieee80211_ie_advance(&x, ies, ies_len))
1465 			break;
1466 	}
1467 
1468 	return (x);
1469 }
1470 
1471 static __inline void
1472 ieee80211_request_smps(struct ieee80211_vif *vif, enum ieee80211_smps_mode smps)
1473 {
1474 
1475 	TODO();
1476 }
1477 
1478 static __inline void
1479 ieee80211_tdls_oper_request(struct ieee80211_vif *vif, uint8_t *addr,
1480     enum nl80211_tdls_operation oper, enum ieee80211_reason_code code,
1481     gfp_t gfp)
1482 {
1483 	TODO();
1484 }
1485 
1486 static __inline void
1487 ieee80211_stop_queues(struct ieee80211_hw *hw)
1488 {
1489 	TODO();
1490 }
1491 
1492 static __inline void
1493 ieee80211_wake_queues(struct ieee80211_hw *hw)
1494 {
1495 	TODO();
1496 }
1497 
1498 static __inline void
1499 wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool state)
1500 {
1501 	TODO();
1502 }
1503 
1504 static __inline void
1505 ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb)
1506 {
1507 	IMPROVE();
1508 
1509 	/*
1510 	 * This is called on transmit failure.
1511 	 * Use a not-so-random random high status error so we can distinguish
1512 	 * it from normal low values flying around in net80211 ("ETX").
1513 	 */
1514 	linuxkpi_ieee80211_free_txskb(hw, skb, 0x455458);
1515 }
1516 
1517 static __inline void
1518 ieee80211_restart_hw(struct ieee80211_hw *hw)
1519 {
1520 	TODO();
1521 }
1522 
1523 static __inline void
1524 ieee80211_ready_on_channel(struct ieee80211_hw *hw)
1525 {
1526 	TODO();
1527 /* XXX-BZ We need to see that. */
1528 }
1529 
1530 static __inline void
1531 ieee80211_remain_on_channel_expired(struct ieee80211_hw *hw)
1532 {
1533 	TODO();
1534 }
1535 
1536 static __inline void
1537 ieee80211_cqm_rssi_notify(struct ieee80211_vif *vif,
1538     enum nl80211_cqm_rssi_threshold_event crte, int sig, gfp_t gfp)
1539 {
1540 	TODO();
1541 }
1542 
1543 static __inline void
1544 ieee80211_mark_rx_ba_filtered_frames(struct ieee80211_sta *sta, uint8_t tid,
1545     uint32_t ssn, uint64_t bitmap, uint16_t received_mpdu)
1546 {
1547 	TODO();
1548 }
1549 
1550 static __inline bool
1551 ieee80211_sn_less(uint16_t sn1, uint16_t sn2)
1552 {
1553 	TODO();
1554 	return (false);
1555 }
1556 
1557 static __inline uint16_t
1558 ieee80211_sn_inc(uint16_t sn)
1559 {
1560 	TODO();
1561 	return (sn + 1);
1562 }
1563 
1564 static __inline uint16_t
1565 ieee80211_sn_add(uint16_t sn, uint16_t a)
1566 {
1567 	TODO();
1568 	return (sn + a);
1569 }
1570 
1571 static __inline void
1572 ieee80211_stop_rx_ba_session(struct ieee80211_vif *vif, uint32_t x, uint8_t *addr)
1573 {
1574 	TODO();
1575 }
1576 
1577 static __inline void
1578 ieee80211_rate_set_vht(struct ieee80211_tx_rate *r, uint32_t f1, uint32_t f2)
1579 {
1580 	TODO();
1581 }
1582 
1583 static __inline void
1584 ieee80211_reserve_tid(struct ieee80211_sta *sta, uint8_t tid)
1585 {
1586 	TODO();
1587 }
1588 
1589 static __inline void
1590 ieee80211_unreserve_tid(struct ieee80211_sta *sta, uint8_t tid)
1591 {
1592 	TODO();
1593 }
1594 
1595 static __inline void
1596 ieee80211_rx_ba_timer_expired(struct ieee80211_vif *vif, uint8_t *addr,
1597     uint8_t tid)
1598 {
1599 	TODO();
1600 }
1601 
1602 static __inline void
1603 ieee80211_send_eosp_nullfunc(struct ieee80211_sta *sta, uint8_t tid)
1604 {
1605 	TODO();
1606 }
1607 
1608 static __inline uint16_t
1609 ieee80211_sn_sub(uint16_t sn, uint16_t n)
1610 {
1611 	TODO();
1612 
1613 	return (0);
1614 }
1615 
1616 static __inline void
1617 ieee80211_sta_block_awake(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
1618     bool disable)
1619 {
1620 	TODO();
1621 }
1622 
1623 static __inline void
1624 ieee80211_sta_ps_transition(struct ieee80211_sta *sta, bool sleeping)
1625 {
1626 	TODO();
1627 }
1628 
1629 static __inline void
1630 ieee80211_sta_pspoll(struct ieee80211_sta *sta)
1631 {
1632 	TODO();
1633 }
1634 
1635 static __inline void
1636 ieee80211_sta_uapsd_trigger(struct ieee80211_sta *sta, int ntids)
1637 {
1638 	TODO();
1639 }
1640 
1641 static __inline void
1642 ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, uint8_t *addr,
1643     uint8_t tid)
1644 {
1645 	TODO();
1646 }
1647 
1648 static __inline void
1649 ieee80211_tkip_add_iv(u8 *crypto_hdr, struct ieee80211_key_conf *keyconf,
1650     uint64_t pn)
1651 {
1652 	TODO();
1653 }
1654 
1655 static __inline struct sk_buff *
1656 ieee80211_tx_dequeue(struct ieee80211_hw *hw, struct ieee80211_txq *txq)
1657 {
1658 
1659 	return (linuxkpi_ieee80211_tx_dequeue(hw, txq));
1660 }
1661 
1662 static __inline void
1663 ieee80211_update_mu_groups(struct ieee80211_vif *vif, uint8_t *ms, uint8_t *up)
1664 {
1665 	TODO();
1666 }
1667 
1668 static __inline void
1669 ieee80211_sta_set_buffered(struct ieee80211_sta *sta, uint8_t tid, bool t)
1670 {
1671 	TODO();
1672 }
1673 
1674 static __inline void
1675 ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb)
1676 {
1677 	struct ieee80211_tx_info *info;
1678 	int status;
1679 
1680 	info = IEEE80211_SKB_CB(skb);
1681 
1682 	/* XXX-BZ this check is probably over-simplified? */
1683 	/* XXX-BZ but then we have no full feedback in net80211 yet. */
1684 	if (info->flags & IEEE80211_TX_STAT_ACK)
1685 		status = 0;	/* No error. */
1686 	else
1687 		status = 1;
1688 #if 0
1689 	printf("XXX-BZ: %s: hw %p skb %p status %d : flags %#x "
1690 	    "band %u hw_queue %u tx_time_est %d : "
1691 	    "rates [ %u %u %#x, %u %u %#x, %u %u %#x, %u %u %#x ] "
1692 	    "ack_signal %u ampdu_ack_len %u ampdu_len %u antenna %u tx_time %u "
1693 	    "is_valid_ack_signal %u status_driver_data [ %p %p ]\n",
1694 	    __func__, hw, skb, status, info->flags,
1695 	    info->band, info->hw_queue, info->tx_time_est,
1696 	    info->status.rates[0].idx, info->status.rates[0].count,
1697 	    info->status.rates[0].flags,
1698 	    info->status.rates[1].idx, info->status.rates[1].count,
1699 	    info->status.rates[1].flags,
1700 	    info->status.rates[2].idx, info->status.rates[2].count,
1701 	    info->status.rates[2].flags,
1702 	    info->status.rates[3].idx, info->status.rates[3].count,
1703 	    info->status.rates[3].flags,
1704 	    info->status.ack_signal, info->status.ampdu_ack_len,
1705 	    info->status.ampdu_len, info->status.antenna,
1706 	    info->status.tx_time, info->status.is_valid_ack_signal,
1707 	    info->status.status_driver_data[0],
1708 	    info->status.status_driver_data[1]);
1709 #endif
1710 	IMPROVE();
1711 	linuxkpi_ieee80211_free_txskb(hw, skb, status);
1712 }
1713 
1714 static __inline void
1715 ieee80211_get_key_rx_seq(struct ieee80211_key_conf *keyconf, uint8_t tid,
1716     struct ieee80211_key_seq *seq)
1717 {
1718 	TODO();
1719 }
1720 
1721 static __inline void
1722 ieee80211_sched_scan_results(struct ieee80211_hw *hw)
1723 {
1724 	TODO();
1725 }
1726 
1727 static __inline void
1728 ieee80211_sta_eosp(struct ieee80211_sta *sta)
1729 {
1730 	TODO();
1731 }
1732 
1733 static __inline void
1734 ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, uint8_t *addr,
1735     uint8_t tid)
1736 {
1737 	TODO();
1738 }
1739 
1740 static __inline void
1741 ieee80211_sched_scan_stopped(struct ieee80211_hw *hw)
1742 {
1743 	TODO();
1744 }
1745 
1746 static __inline void
1747 ieee80211_scan_completed(struct ieee80211_hw *hw,
1748     struct cfg80211_scan_info *info)
1749 {
1750 
1751 	linuxkpi_ieee80211_scan_completed(hw, info);
1752 }
1753 
1754 static __inline struct sk_buff *
1755 ieee80211_beacon_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
1756 {
1757 	TODO();
1758 	return (NULL);
1759 }
1760 
1761 static __inline struct sk_buff *
1762 ieee80211_pspoll_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
1763 {
1764 
1765 	/* Only STA needs this.  Otherwise return NULL and panic bad drivers. */
1766 	if (vif->type != NL80211_IFTYPE_STATION)
1767 		return (NULL);
1768 
1769 	return (linuxkpi_ieee80211_pspoll_get(hw, vif));
1770 }
1771 
1772 static __inline struct sk_buff *
1773 ieee80211_proberesp_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
1774 {
1775 	TODO();
1776 	return (NULL);
1777 }
1778 
1779 static __inline struct sk_buff *
1780 ieee80211_nullfunc_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1781     bool qos)
1782 {
1783 
1784 	/* Only STA needs this.  Otherwise return NULL and panic bad drivers. */
1785 	if (vif->type != NL80211_IFTYPE_STATION)
1786 		return (NULL);
1787 
1788 	return (linuxkpi_ieee80211_nullfunc_get(hw, vif, qos));
1789 }
1790 
1791 static __inline struct sk_buff *
1792 ieee80211_probereq_get(struct ieee80211_hw *hw, uint8_t *addr,
1793     uint8_t *ssid, size_t ssid_len, int _x)
1794 {
1795 	TODO();
1796 	return (NULL);
1797 }
1798 
1799 static __inline void
1800 ieee80211_queue_delayed_work(struct ieee80211_hw *hw, struct delayed_work *w,
1801     int delay)
1802 {
1803 
1804 	linuxkpi_ieee80211_queue_delayed_work(hw, w, delay);
1805 }
1806 
1807 static __inline void
1808 ieee80211_queue_work(struct ieee80211_hw *hw, struct work_struct *w)
1809 {
1810 
1811 	linuxkpi_ieee80211_queue_work(hw, w);
1812 }
1813 
1814 static __inline void
1815 ieee80211_stop_queue(struct ieee80211_hw *hw, uint16_t q)
1816 {
1817 	TODO();
1818 }
1819 
1820 static __inline void
1821 ieee80211_wake_queue(struct ieee80211_hw *hw, uint16_t q)
1822 {
1823 	TODO();
1824 }
1825 
1826 static __inline void
1827 ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb)
1828 {
1829 	IMPROVE();
1830 	ieee80211_tx_status(hw, skb);
1831 }
1832 
1833 static __inline int
1834 ieee80211_start_tx_ba_session(struct ieee80211_sta *sta, uint8_t tid, int x)
1835 {
1836 	TODO();
1837 	return (ENXIO);
1838 }
1839 
1840 static __inline void
1841 ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)
1842 {
1843 	int i;
1844 
1845 	/*
1846 	 * Apparently clearing flags and some other fields is not right.
1847 	 * Given the function is called "status" we work on that part of
1848 	 * the union.
1849 	 */
1850 	for (i = 0; i < nitems(info->status.rates); i++)
1851 		info->status.rates[i].count = 0;
1852 	/*
1853 	 * Unclear if ack_signal should be included or not but we clear the
1854 	 * "valid" bool so this field is no longer valid.
1855 	 */
1856 	memset(&info->status.ack_signal, 0, sizeof(*info) -
1857 	    offsetof(struct ieee80211_tx_info, status.ack_signal));
1858 }
1859 
1860 static __inline void
1861 ieee80211_txq_get_depth(struct ieee80211_txq *txq, uint64_t *frame_cnt, uint64_t *byte_cnt)
1862 {
1863 
1864 	if (frame_cnt == NULL && byte_cnt == NULL)
1865 		return;
1866 
1867 	linuxkpi_ieee80211_txq_get_depth(txq, frame_cnt, byte_cnt);
1868 }
1869 
1870 static __inline int
1871 rate_lowest_index(struct ieee80211_supported_band *band,
1872     struct ieee80211_sta *sta)
1873 {
1874 	IMPROVE();
1875 	return (0);
1876 }
1877 
1878 
1879 static __inline void
1880 SET_IEEE80211_PERM_ADDR	(struct ieee80211_hw *hw, uint8_t *addr)
1881 {
1882 
1883 	ether_addr_copy(hw->wiphy->perm_addr, addr);
1884 }
1885 
1886 static __inline uint8_t *
1887 ieee80211_bss_get_ie(struct cfg80211_bss *bss, uint32_t x)
1888 {
1889 	TODO();
1890 	return (NULL);
1891 }
1892 
1893 static __inline void
1894 ieee80211_report_low_ack(struct ieee80211_sta *sta, int x)
1895 {
1896 	TODO();
1897 }
1898 
1899 static __inline void
1900 ieee80211_start_rx_ba_session_offl(struct ieee80211_vif *vif, uint8_t *addr,
1901     uint8_t tid)
1902 {
1903 	TODO();
1904 }
1905 
1906 static __inline void
1907 ieee80211_stop_rx_ba_session_offl(struct ieee80211_vif *vif, uint8_t *addr,
1908     uint8_t tid)
1909 {
1910 	TODO();
1911 }
1912 
1913 static __inline struct sk_buff *
1914 ieee80211_tx_dequeue_ni(struct ieee80211_hw *hw, struct ieee80211_txq *txq)
1915 {
1916 	TODO();
1917 	return (NULL);
1918 }
1919 
1920 static __inline void
1921 ieee80211_tx_rate_update(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
1922     struct ieee80211_tx_info *info)
1923 {
1924 	TODO();
1925 }
1926 
1927 static __inline bool
1928 ieee80211_txq_may_transmit(struct ieee80211_hw *hw, struct ieee80211_txq *txq)
1929 {
1930 	TODO();
1931 	return (false);
1932 }
1933 
1934 static __inline struct ieee80211_txq *
1935 ieee80211_next_txq(struct ieee80211_hw *hw, uint32_t ac)
1936 {
1937 	TODO();
1938 	return (NULL);
1939 }
1940 
1941 static __inline void
1942 ieee80211_radar_detected(struct ieee80211_hw *hw)
1943 {
1944 	TODO();
1945 }
1946 
1947 static __inline void
1948 ieee80211_sta_register_airtime(struct ieee80211_sta *sta,
1949     uint8_t tid, uint32_t duration, int x)
1950 {
1951 	TODO();
1952 }
1953 
1954 
1955 static __inline void
1956 ieee80211_return_txq(struct ieee80211_hw *hw,
1957     struct ieee80211_txq *txq, bool _t)
1958 {
1959 	TODO();
1960 }
1961 
1962 static __inline void
1963 ieee80211_txq_schedule_end(struct ieee80211_hw *hw, uint32_t ac)
1964 {
1965 	TODO();
1966 }
1967 
1968 static __inline void
1969 ieee80211_txq_schedule_start(struct ieee80211_hw *hw, uint32_t ac)
1970 {
1971 	TODO();
1972 }
1973 
1974 static __inline void
1975 ieee80211_beacon_set_cntdwn(struct ieee80211_vif *vif, u8 counter)
1976 {
1977 	TODO();
1978 }
1979 
1980 static __inline int
1981 ieee80211_beacon_update_cntdwn(struct ieee80211_vif *vif)
1982 {
1983 	TODO();
1984 	return (-1);
1985 }
1986 
1987 static __inline int
1988 ieee80211_get_vht_max_nss(struct ieee80211_vht_cap *vht_cap, uint32_t chanwidth,
1989     int x, bool t, int nss)
1990 {
1991 	TODO();
1992 	return (-1);
1993 }
1994 
1995 static __inline bool
1996 ieee80211_beacon_cntdwn_is_complete(struct ieee80211_vif *vif)
1997 {
1998 	TODO();
1999 	return (true);
2000 }
2001 
2002 static __inline void
2003 ieee80211_disconnect(struct ieee80211_vif *vif, bool _x)
2004 {
2005 	TODO();
2006 }
2007 
2008 static __inline const struct ieee80211_sta_he_cap *
2009 ieee80211_get_he_iftype_cap(const struct ieee80211_supported_band *band,
2010     enum nl80211_iftype type)
2011 {
2012 	TODO();
2013         return (NULL);
2014 }
2015 
2016 static __inline void
2017 ieee80211_key_mic_failure(struct ieee80211_key_conf *key)
2018 {
2019 	TODO();
2020 }
2021 
2022 static __inline void
2023 ieee80211_key_replay(struct ieee80211_key_conf *key)
2024 {
2025 	TODO();
2026 }
2027 
2028 #endif	/* _LINUXKPI_NET_MAC80211_H */
2029