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