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