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