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 ieee80211_chanreq chanreq;
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 #define IEEE80211_RX_STATUS_FLAGS_BITS \
629 "\20\1ALLOW_SAME_PN\2AMPDU_DETAILS\3AMPDU_EOF_BIT\4AMPDU_EOF_BIT_KNOWN" \
630 "\5DECRYPTED\6DUP_VALIDATED\7FAILED_FCS_CRC\10ICV_STRIPPED" \
631 "\11MACTIME_PLCP_START\12MACTIME_START\13MIC_STRIPPED" \
632 "\14MMIC_ERROR\15MMIC_STRIPPED\16NO_PSDU\17PN_VALIDATED" \
633 "\20RADIOTAP_HE\21RADIOTAP_HE_MU\22RADIOTAP_LSIG\23RADIOTAP_VENDOR_DATA" \
634 "\24NO_SIGNAL_VAL\25IV_STRIPPED\26AMPDU_IS_LAST\27AMPDU_LAST_KNOWN" \
635 "\30AMSDU_MORE\31MACTIME_END\32ONLY_MONITOR\33SKIP_MONITOR" \
636 "\348023\35RADIOTAP_TLV_AT_END\36MACTIME\37MACTIME_IS_RTAP_TS64" \
637 "\40FAILED_PLCP_CRC"
638
639 enum mac80211_rx_encoding {
640 RX_ENC_LEGACY = 0,
641 RX_ENC_HT,
642 RX_ENC_VHT,
643 RX_ENC_HE,
644 RX_ENC_EHT,
645 };
646
647 struct ieee80211_rx_status {
648 /* TODO FIXME, this is too large. Over-reduce types to u8 where possible. */
649 union {
650 uint64_t boottime_ns;
651 int64_t ack_tx_hwtstamp;
652 };
653 uint64_t mactime;
654 uint32_t device_timestamp;
655 enum ieee80211_rx_status_flags flag;
656 uint16_t freq;
657 uint8_t encoding:3, bw:4; /* enum mac80211_rx_encoding, rate_info_bw */ /* See mt76.h */
658 uint8_t ampdu_reference;
659 uint8_t band;
660 uint8_t chains;
661 int8_t chain_signal[IEEE80211_MAX_CHAINS];
662 int8_t signal;
663 uint8_t enc_flags;
664 union {
665 struct {
666 uint8_t he_ru:3; /* nl80211::enum nl80211_he_ru_alloc */
667 uint8_t he_gi:2; /* nl80211::enum nl80211_he_gi */
668 uint8_t he_dcm:1;
669 };
670 struct {
671 uint8_t ru:4; /* nl80211::enum nl80211_eht_ru_alloc */
672 uint8_t gi:2; /* nl80211::enum nl80211_eht_gi */
673 } eht;
674 };
675 bool link_valid;
676 uint8_t link_id; /* very incosistent sizes? */
677 uint8_t zero_length_psdu_type;
678 uint8_t nss;
679 uint8_t rate_idx;
680 };
681
682 struct ieee80211_tx_status {
683 struct ieee80211_sta *sta;
684 struct ieee80211_tx_info *info;
685 int64_t ack_hwtstamp;
686
687 u8 n_rates;
688 struct ieee80211_rate_status *rates;
689
690 struct sk_buff *skb;
691 struct list_head *free_list;
692 };
693
694 struct ieee80211_scan_ies {
695 /* TODO FIXME */
696 int common_ie_len;
697 int len[NUM_NL80211_BANDS];
698 uint8_t *common_ies;
699 uint8_t *ies[NUM_NL80211_BANDS];
700 };
701
702 struct ieee80211_scan_request {
703 struct ieee80211_scan_ies ies;
704 struct cfg80211_scan_request req;
705 };
706
707 struct ieee80211_txq {
708 struct ieee80211_sta *sta;
709 struct ieee80211_vif *vif;
710 int ac;
711 uint8_t tid;
712
713 /* Must stay last. */
714 uint8_t drv_priv[0] __aligned(CACHE_LINE_SIZE);
715 };
716
717 struct ieee80211_sta_rates {
718 /* XXX TODO */
719 /* XXX some _rcu thing */
720 struct {
721 int idx;
722 int flags;
723 } rate[1]; /* XXX what is the real number? */
724 };
725
726 struct ieee80211_sta_txpwr {
727 /* XXX TODO */
728 enum nl80211_tx_power_setting type;
729 short power;
730 };
731
732 #define IEEE80211_NUM_TIDS 16 /* net80211::WME_NUM_TID */
733 struct ieee80211_sta_agg {
734 uint16_t max_amsdu_len;
735 uint16_t max_rc_amsdu_len;
736 uint16_t max_tid_amsdu_len[IEEE80211_NUM_TIDS];
737 };
738
739 struct ieee80211_link_sta {
740 struct ieee80211_sta *sta;
741 uint8_t addr[ETH_ALEN];
742 uint8_t link_id;
743 uint32_t supp_rates[NUM_NL80211_BANDS];
744 struct ieee80211_sta_ht_cap ht_cap;
745 struct ieee80211_sta_vht_cap vht_cap;
746 struct ieee80211_sta_he_cap he_cap;
747 struct ieee80211_sta_he_6ghz_capa he_6ghz_capa;
748 struct ieee80211_sta_eht_cap eht_cap;
749 uint8_t rx_nss;
750 enum ieee80211_sta_rx_bw bandwidth;
751 enum ieee80211_smps_mode smps_mode;
752 struct ieee80211_sta_agg agg;
753 struct ieee80211_sta_txpwr txpwr;
754 };
755
756 struct ieee80211_sta {
757 /* TODO FIXME */
758 int max_amsdu_subframes;
759 int mfp, smps_mode, tdls, tdls_initiator;
760 struct ieee80211_txq *txq[IEEE80211_NUM_TIDS + 1]; /* iwlwifi: 8 and adds +1 to tid_data, net80211::IEEE80211_TID_SIZE */
761 struct ieee80211_sta_rates *rates; /* some rcu thing? */
762 uint8_t addr[ETH_ALEN];
763 uint16_t aid;
764 bool wme;
765 uint8_t max_sp;
766 uint8_t uapsd_queues;
767 uint16_t valid_links;
768
769 struct ieee80211_link_sta deflink;
770 struct ieee80211_link_sta *link[IEEE80211_MLD_MAX_NUM_LINKS]; /* rcu? */
771
772 /* Must stay last. */
773 uint8_t drv_priv[0] __aligned(CACHE_LINE_SIZE);
774 };
775
776 struct ieee80211_tdls_ch_sw_params {
777 /* TODO FIXME */
778 int action_code, ch_sw_tm_ie, status, switch_time, switch_timeout, timestamp;
779 struct ieee80211_sta *sta;
780 struct cfg80211_chan_def *chandef;
781 struct sk_buff *tmpl_skb;
782 };
783
784 struct ieee80211_tx_control {
785 /* TODO FIXME */
786 struct ieee80211_sta *sta;
787 };
788
789 struct ieee80211_tx_queue_params {
790 /* These types are based on iwlwifi FW structs. */
791 uint16_t cw_min;
792 uint16_t cw_max;
793 uint16_t txop;
794 uint8_t aifs;
795
796 /* TODO FIXME */
797 int acm, mu_edca, uapsd;
798 struct ieee80211_he_mu_edca_param_ac_rec mu_edca_param_rec;
799 };
800
801 struct ieee80211_tx_rate {
802 uint8_t idx;
803 uint16_t count:5,
804 flags:11;
805 };
806
807 enum ieee80211_vif_driver_flags {
808 IEEE80211_VIF_BEACON_FILTER = BIT(0),
809 IEEE80211_VIF_SUPPORTS_CQM_RSSI = BIT(1),
810 IEEE80211_VIF_SUPPORTS_UAPSD = BIT(2),
811 #if defined(LINUXKPI_VERSION) && (LINUXKPI_VERSION < 60600) /* v6.6 */
812 IEEE80211_VIF_DISABLE_SMPS_OVERRIDE = BIT(3), /* Renamed to IEEE80211_VIF_EML_ACTIVE. */
813 #endif
814 IEEE80211_VIF_EML_ACTIVE = BIT(4),
815 IEEE80211_VIF_IGNORE_OFDMA_WIDER_BW = BIT(5),
816 };
817
818 #define IEEE80211_BSS_ARP_ADDR_LIST_LEN 4
819
820 struct ieee80211_vif_cfg {
821 uint16_t aid;
822 uint16_t eml_cap;
823 uint16_t eml_med_sync_delay;
824 bool assoc;
825 bool ps;
826 bool idle;
827 bool ibss_joined;
828 int arp_addr_cnt;
829 size_t ssid_len;
830 uint32_t arp_addr_list[IEEE80211_BSS_ARP_ADDR_LIST_LEN]; /* big endian */
831 uint8_t ssid[IEEE80211_NWID_LEN];
832 uint8_t ap_addr[ETH_ALEN];
833 };
834
835 struct ieee80211_vif {
836 /* TODO FIXME */
837 enum nl80211_iftype type;
838 int csa_active, mu_mimo_owner;
839 int cab_queue;
840 int color_change_active, offload_flags;
841 enum ieee80211_vif_driver_flags driver_flags;
842 bool p2p;
843 bool probe_req_reg;
844 uint8_t addr[ETH_ALEN];
845 struct ieee80211_vif_cfg cfg;
846 struct ieee80211_chanctx_conf *chanctx_conf;
847 struct ieee80211_txq *txq;
848 struct ieee80211_bss_conf bss_conf;
849 struct ieee80211_bss_conf *link_conf[IEEE80211_MLD_MAX_NUM_LINKS]; /* rcu? */
850 uint8_t hw_queue[IEEE80211_NUM_ACS];
851 uint16_t active_links;
852 uint16_t valid_links;
853 struct ieee80211_vif *mbssid_tx_vif;
854
855 /* #ifdef CONFIG_MAC80211_DEBUGFS */ /* Do not change structure depending on compile-time option. */
856 struct dentry *debugfs_dir;
857 /* #endif */
858
859 /* Must stay last. */
860 uint8_t drv_priv[0] __aligned(CACHE_LINE_SIZE);
861 };
862
863 struct ieee80211_vif_chanctx_switch {
864 struct ieee80211_chanctx_conf *old_ctx, *new_ctx;
865 struct ieee80211_vif *vif;
866 struct ieee80211_bss_conf *link_conf;
867 };
868
869 struct ieee80211_prep_tx_info {
870 u16 duration;
871 bool success;
872 bool was_assoc;
873 int link_id;
874 };
875
876 /* XXX-BZ too big, over-reduce size to u8, and array sizes to minuimum to fit in skb->cb. */
877 /* Also warning: some sizes change by pointer size! This is 64bit only. */
878 struct ieee80211_tx_info {
879 enum ieee80211_tx_info_flags flags;
880 /* TODO FIXME */
881 u8 band;
882 u8 hw_queue;
883 bool tx_time_est;
884 union {
885 struct {
886 struct ieee80211_tx_rate rates[4];
887 bool use_rts;
888 uint8_t antennas:2;
889 struct ieee80211_vif *vif;
890 struct ieee80211_key_conf *hw_key;
891 enum ieee80211_tx_control_flags flags;
892 } control;
893 struct {
894 struct ieee80211_tx_rate rates[4];
895 uint32_t ack_signal;
896 uint8_t ampdu_ack_len;
897 uint8_t ampdu_len;
898 uint8_t antenna;
899 uint16_t tx_time;
900 uint8_t flags;
901 void *status_driver_data[16 / sizeof(void *)]; /* XXX TODO */
902 } status;
903 #define IEEE80211_TX_INFO_DRIVER_DATA_SIZE 40
904 void *driver_data[IEEE80211_TX_INFO_DRIVER_DATA_SIZE / sizeof(void *)];
905 };
906 };
907
908 /* net80211 conflict */
909 struct linuxkpi_ieee80211_tim_ie {
910 uint8_t dtim_count;
911 uint8_t dtim_period;
912 uint8_t bitmap_ctrl;
913 uint8_t *virtual_map;
914 };
915 #define ieee80211_tim_ie linuxkpi_ieee80211_tim_ie
916
917 struct survey_info { /* net80211::struct ieee80211_channel_survey */
918 /* TODO FIXME */
919 uint32_t filled;
920 #define SURVEY_INFO_TIME 0x0001
921 #define SURVEY_INFO_TIME_RX 0x0002
922 #define SURVEY_INFO_TIME_SCAN 0x0004
923 #define SURVEY_INFO_TIME_TX 0x0008
924 #define SURVEY_INFO_TIME_BSS_RX 0x0010
925 #define SURVEY_INFO_TIME_BUSY 0x0020
926 #define SURVEY_INFO_IN_USE 0x0040
927 #define SURVEY_INFO_NOISE_DBM 0x0080
928 uint32_t noise;
929 uint64_t time;
930 uint64_t time_bss_rx;
931 uint64_t time_busy;
932 uint64_t time_rx;
933 uint64_t time_scan;
934 uint64_t time_tx;
935 struct ieee80211_channel *channel;
936 };
937
938 enum ieee80211_iface_iter {
939 IEEE80211_IFACE_ITER_NORMAL = BIT(0),
940 IEEE80211_IFACE_ITER_RESUME_ALL = BIT(1),
941 IEEE80211_IFACE_SKIP_SDATA_NOT_IN_DRIVER = BIT(2), /* seems to be an iter flag */
942 IEEE80211_IFACE_ITER_ACTIVE = BIT(3),
943
944 /* Internal flags only. */
945 IEEE80211_IFACE_ITER__ATOMIC = BIT(6),
946 IEEE80211_IFACE_ITER__MTX = BIT(8),
947 };
948
949 enum set_key_cmd {
950 SET_KEY,
951 DISABLE_KEY,
952 };
953
954 /* 802.11-2020, 9.4.2.55.2 HT Capability Information field. */
955 enum rx_enc_flags {
956 RX_ENC_FLAG_SHORTPRE = BIT(0),
957 RX_ENC_FLAG_SHORT_GI = BIT(2),
958 RX_ENC_FLAG_HT_GF = BIT(3),
959 RX_ENC_FLAG_STBC_MASK = BIT(4) | BIT(5),
960 #define RX_ENC_FLAG_STBC_SHIFT 4
961 RX_ENC_FLAG_LDPC = BIT(6),
962 RX_ENC_FLAG_BF = BIT(7),
963 };
964
965 enum sta_notify_cmd {
966 STA_NOTIFY_AWAKE,
967 STA_NOTIFY_SLEEP,
968 };
969
970 struct ieee80211_low_level_stats {
971 /* Can we make them uint64_t? */
972 uint32_t dot11ACKFailureCount;
973 uint32_t dot11FCSErrorCount;
974 uint32_t dot11RTSFailureCount;
975 uint32_t dot11RTSSuccessCount;
976 };
977
978 enum ieee80211_offload_flags {
979 IEEE80211_OFFLOAD_ENCAP_4ADDR,
980 IEEE80211_OFFLOAD_ENCAP_ENABLED,
981 IEEE80211_OFFLOAD_DECAP_ENABLED,
982 };
983
984 struct ieee80211_ops {
985 /* TODO FIXME */
986 int (*start)(struct ieee80211_hw *);
987 void (*stop)(struct ieee80211_hw *, bool);
988
989 int (*config)(struct ieee80211_hw *, u32);
990 void (*reconfig_complete)(struct ieee80211_hw *, enum ieee80211_reconfig_type);
991
992 int (*add_interface)(struct ieee80211_hw *, struct ieee80211_vif *);
993 void (*remove_interface)(struct ieee80211_hw *, struct ieee80211_vif *);
994 int (*change_interface)(struct ieee80211_hw *, struct ieee80211_vif *, enum nl80211_iftype, bool);
995
996 void (*sw_scan_start)(struct ieee80211_hw *, struct ieee80211_vif *, const u8 *);
997 void (*sw_scan_complete)(struct ieee80211_hw *, struct ieee80211_vif *);
998 int (*sched_scan_start)(struct ieee80211_hw *, struct ieee80211_vif *, struct cfg80211_sched_scan_request *, struct ieee80211_scan_ies *);
999 int (*sched_scan_stop)(struct ieee80211_hw *, struct ieee80211_vif *);
1000 int (*hw_scan)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_scan_request *);
1001 void (*cancel_hw_scan)(struct ieee80211_hw *, struct ieee80211_vif *);
1002
1003 int (*conf_tx)(struct ieee80211_hw *, struct ieee80211_vif *, u32, u16, const struct ieee80211_tx_queue_params *);
1004 void (*tx)(struct ieee80211_hw *, struct ieee80211_tx_control *, struct sk_buff *);
1005 int (*tx_last_beacon)(struct ieee80211_hw *);
1006 void (*wake_tx_queue)(struct ieee80211_hw *, struct ieee80211_txq *);
1007
1008 void (*mgd_prepare_tx)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_prep_tx_info *);
1009 void (*mgd_complete_tx)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_prep_tx_info *);
1010 void (*mgd_protect_tdls_discover)(struct ieee80211_hw *, struct ieee80211_vif *, unsigned int);
1011
1012 void (*flush)(struct ieee80211_hw *, struct ieee80211_vif *, u32, bool);
1013 void (*flush_sta)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *);
1014
1015 int (*set_frag_threshold)(struct ieee80211_hw *, u32);
1016
1017 void (*sync_rx_queues)(struct ieee80211_hw *);
1018
1019 void (*allow_buffered_frames)(struct ieee80211_hw *, struct ieee80211_sta *, u16, int, enum ieee80211_frame_release_type, bool);
1020 void (*release_buffered_frames)(struct ieee80211_hw *, struct ieee80211_sta *, u16, int, enum ieee80211_frame_release_type, bool);
1021
1022 int (*sta_add)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *);
1023 int (*sta_remove)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *);
1024 int (*sta_set_txpwr)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *);
1025 void (*sta_statistics)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, struct station_info *);
1026 void (*sta_pre_rcu_remove)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *);
1027 int (*sta_state)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, enum ieee80211_sta_state, enum ieee80211_sta_state);
1028 void (*sta_notify)(struct ieee80211_hw *, struct ieee80211_vif *, enum sta_notify_cmd, struct ieee80211_sta *);
1029 void (*sta_rc_update)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, u32);
1030 void (*sta_rate_tbl_update)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *);
1031 void (*sta_set_4addr)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, bool);
1032 void (*sta_set_decap_offload)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, bool);
1033
1034 u64 (*prepare_multicast)(struct ieee80211_hw *, struct netdev_hw_addr_list *);
1035
1036 int (*ampdu_action)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_ampdu_params *);
1037
1038 bool (*can_aggregate_in_amsdu)(struct ieee80211_hw *, struct sk_buff *, struct sk_buff *);
1039
1040 int (*pre_channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_channel_switch *);
1041 int (*post_channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_bss_conf *);
1042 void (*channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_channel_switch *);
1043 void (*channel_switch_beacon)(struct ieee80211_hw *, struct ieee80211_vif *, struct cfg80211_chan_def *);
1044 void (*abort_channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_bss_conf *);
1045 void (*channel_switch_rx_beacon)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_channel_switch *);
1046 int (*tdls_channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, u8, struct cfg80211_chan_def *, struct sk_buff *, u32);
1047 void (*tdls_cancel_channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *);
1048 void (*tdls_recv_channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_tdls_ch_sw_params *);
1049
1050 int (*add_chanctx)(struct ieee80211_hw *, struct ieee80211_chanctx_conf *);
1051 void (*remove_chanctx)(struct ieee80211_hw *, struct ieee80211_chanctx_conf *);
1052 void (*change_chanctx)(struct ieee80211_hw *, struct ieee80211_chanctx_conf *, u32);
1053 int (*assign_vif_chanctx)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_bss_conf *, struct ieee80211_chanctx_conf *);
1054 void (*unassign_vif_chanctx)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_bss_conf *, struct ieee80211_chanctx_conf *);
1055 int (*switch_vif_chanctx)(struct ieee80211_hw *, struct ieee80211_vif_chanctx_switch *, int, enum ieee80211_chanctx_switch_mode);
1056
1057 int (*get_antenna)(struct ieee80211_hw *, u32 *, u32 *);
1058 int (*set_antenna)(struct ieee80211_hw *, u32, u32);
1059
1060 int (*remain_on_channel)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_channel *, int, enum ieee80211_roc_type);
1061 int (*cancel_remain_on_channel)(struct ieee80211_hw *, struct ieee80211_vif *);
1062
1063 void (*configure_filter)(struct ieee80211_hw *, unsigned int, unsigned int *, u64);
1064 void (*config_iface_filter)(struct ieee80211_hw *, struct ieee80211_vif *, unsigned int, unsigned int);
1065
1066 void (*bss_info_changed)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_bss_conf *, u64);
1067 void (*link_info_changed)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_bss_conf *, u64);
1068
1069 int (*set_rts_threshold)(struct ieee80211_hw *, u32);
1070 void (*event_callback)(struct ieee80211_hw *, struct ieee80211_vif *, const struct ieee80211_event *);
1071 int (*get_survey)(struct ieee80211_hw *, int, struct survey_info *);
1072 int (*get_ftm_responder_stats)(struct ieee80211_hw *, struct ieee80211_vif *, struct cfg80211_ftm_responder_stats *);
1073
1074 uint64_t (*get_tsf)(struct ieee80211_hw *, struct ieee80211_vif *);
1075 void (*set_tsf)(struct ieee80211_hw *, struct ieee80211_vif *, uint64_t);
1076 void (*offset_tsf)(struct ieee80211_hw *, struct ieee80211_vif *, s64);
1077
1078 int (*set_bitrate_mask)(struct ieee80211_hw *, struct ieee80211_vif *, const struct cfg80211_bitrate_mask *);
1079 void (*set_coverage_class)(struct ieee80211_hw *, s16);
1080 int (*set_tim)(struct ieee80211_hw *, struct ieee80211_sta *, bool);
1081
1082 int (*set_key)(struct ieee80211_hw *, enum set_key_cmd, struct ieee80211_vif *, struct ieee80211_sta *, struct ieee80211_key_conf *);
1083 void (*set_default_unicast_key)(struct ieee80211_hw *, struct ieee80211_vif *, int);
1084 void (*update_tkip_key)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_key_conf *, struct ieee80211_sta *, u32, u16 *);
1085 void (*set_rekey_data)(struct ieee80211_hw *, struct ieee80211_vif *, struct cfg80211_gtk_rekey_data *);
1086
1087 int (*start_pmsr)(struct ieee80211_hw *, struct ieee80211_vif *, struct cfg80211_pmsr_request *);
1088 void (*abort_pmsr)(struct ieee80211_hw *, struct ieee80211_vif *, struct cfg80211_pmsr_request *);
1089
1090 int (*start_ap)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_bss_conf *link_conf);
1091 void (*stop_ap)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_bss_conf *link_conf);
1092 int (*join_ibss)(struct ieee80211_hw *, struct ieee80211_vif *);
1093 void (*leave_ibss)(struct ieee80211_hw *, struct ieee80211_vif *);
1094
1095 int (*set_sar_specs)(struct ieee80211_hw *, const struct cfg80211_sar_specs *);
1096
1097 int (*set_tid_config)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, struct cfg80211_tid_config *);
1098 int (*reset_tid_config)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, u8);
1099
1100 int (*get_et_sset_count)(struct ieee80211_hw *, struct ieee80211_vif *, int);
1101 void (*get_et_stats)(struct ieee80211_hw *, struct ieee80211_vif *, struct ethtool_stats *, u64 *);
1102 void (*get_et_strings)(struct ieee80211_hw *, struct ieee80211_vif *, u32, u8 *);
1103
1104 void (*update_vif_offload)(struct ieee80211_hw *, struct ieee80211_vif *);
1105
1106 int (*get_txpower)(struct ieee80211_hw *, struct ieee80211_vif *, int *);
1107 int (*get_stats)(struct ieee80211_hw *, struct ieee80211_low_level_stats *);
1108
1109 int (*set_radar_background)(struct ieee80211_hw *, struct cfg80211_chan_def *);
1110
1111 void (*add_twt_setup)(struct ieee80211_hw *, struct ieee80211_sta *, struct ieee80211_twt_setup *);
1112 void (*twt_teardown_request)(struct ieee80211_hw *, struct ieee80211_sta *, u8);
1113
1114 int (*set_hw_timestamp)(struct ieee80211_hw *, struct ieee80211_vif *, struct cfg80211_set_hw_timestamp *);
1115
1116 void (*vif_cfg_changed)(struct ieee80211_hw *, struct ieee80211_vif *, u64);
1117
1118 int (*change_vif_links)(struct ieee80211_hw *, struct ieee80211_vif *, u16, u16, struct ieee80211_bss_conf *[IEEE80211_MLD_MAX_NUM_LINKS]);
1119 int (*change_sta_links)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, u16, u16);
1120 bool (*can_activate_links)(struct ieee80211_hw *, struct ieee80211_vif *, u16);
1121 enum ieee80211_neg_ttlm_res (*can_neg_ttlm)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_neg_ttlm *);
1122
1123 /* #ifdef CONFIG_MAC80211_DEBUGFS */ /* Do not change depending on compile-time option. */
1124 void (*sta_add_debugfs)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, struct dentry *);
1125 void (*vif_add_debugfs)(struct ieee80211_hw *, struct ieee80211_vif *);
1126 void (*link_sta_add_debugfs)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_link_sta *, struct dentry *);
1127 void (*link_add_debugfs)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_bss_conf *, struct dentry *);
1128 /* #endif */
1129 };
1130
1131
1132 /* -------------------------------------------------------------------------- */
1133
1134 /* linux_80211.c */
1135 extern const struct cfg80211_ops linuxkpi_mac80211cfgops;
1136
1137 struct ieee80211_hw *linuxkpi_ieee80211_alloc_hw(size_t,
1138 const struct ieee80211_ops *);
1139 void linuxkpi_ieee80211_iffree(struct ieee80211_hw *);
1140 void linuxkpi_set_ieee80211_dev(struct ieee80211_hw *, char *);
1141 int linuxkpi_ieee80211_ifattach(struct ieee80211_hw *);
1142 void linuxkpi_ieee80211_ifdetach(struct ieee80211_hw *);
1143 void linuxkpi_ieee80211_unregister_hw(struct ieee80211_hw *);
1144 struct ieee80211_hw * linuxkpi_wiphy_to_ieee80211_hw(struct wiphy *);
1145 void linuxkpi_ieee80211_restart_hw(struct ieee80211_hw *);
1146 void linuxkpi_ieee80211_iterate_interfaces(
1147 struct ieee80211_hw *hw, enum ieee80211_iface_iter flags,
1148 void(*iterfunc)(void *, uint8_t *, struct ieee80211_vif *),
1149 void *);
1150 void linuxkpi_ieee80211_iterate_keys(struct ieee80211_hw *,
1151 struct ieee80211_vif *,
1152 void(*iterfunc)(struct ieee80211_hw *, struct ieee80211_vif *,
1153 struct ieee80211_sta *, struct ieee80211_key_conf *, void *),
1154 void *);
1155 void linuxkpi_ieee80211_iterate_chan_contexts(struct ieee80211_hw *,
1156 void(*iterfunc)(struct ieee80211_hw *,
1157 struct ieee80211_chanctx_conf *, void *),
1158 void *);
1159 void linuxkpi_ieee80211_iterate_stations_atomic(struct ieee80211_hw *,
1160 void (*iterfunc)(void *, struct ieee80211_sta *), void *);
1161 void linuxkpi_ieee80211_scan_completed(struct ieee80211_hw *,
1162 struct cfg80211_scan_info *);
1163 void linuxkpi_ieee80211_rx(struct ieee80211_hw *, struct sk_buff *,
1164 struct ieee80211_sta *, struct napi_struct *, struct list_head *);
1165 uint8_t linuxkpi_ieee80211_get_tid(struct ieee80211_hdr *, bool);
1166 struct ieee80211_sta *linuxkpi_ieee80211_find_sta(struct ieee80211_vif *,
1167 const u8 *);
1168 struct ieee80211_sta *linuxkpi_ieee80211_find_sta_by_ifaddr(
1169 struct ieee80211_hw *, const uint8_t *, const uint8_t *);
1170 struct sk_buff *linuxkpi_ieee80211_tx_dequeue(struct ieee80211_hw *,
1171 struct ieee80211_txq *);
1172 bool linuxkpi_ieee80211_is_ie_id_in_ie_buf(const u8, const u8 *, size_t);
1173 bool linuxkpi_ieee80211_ie_advance(size_t *, const u8 *, size_t);
1174 void linuxkpi_ieee80211_free_txskb(struct ieee80211_hw *, struct sk_buff *,
1175 int);
1176 void linuxkpi_ieee80211_queue_delayed_work(struct ieee80211_hw *,
1177 struct delayed_work *, int);
1178 void linuxkpi_ieee80211_queue_work(struct ieee80211_hw *, struct work_struct *);
1179 struct sk_buff *linuxkpi_ieee80211_pspoll_get(struct ieee80211_hw *,
1180 struct ieee80211_vif *);
1181 struct sk_buff *linuxkpi_ieee80211_nullfunc_get(struct ieee80211_hw *,
1182 struct ieee80211_vif *, int, bool);
1183 void linuxkpi_ieee80211_txq_get_depth(struct ieee80211_txq *, unsigned long *,
1184 unsigned long *);
1185 struct wireless_dev *linuxkpi_ieee80211_vif_to_wdev(struct ieee80211_vif *);
1186 void linuxkpi_ieee80211_connection_loss(struct ieee80211_vif *);
1187 void linuxkpi_ieee80211_beacon_loss(struct ieee80211_vif *);
1188 struct sk_buff *linuxkpi_ieee80211_probereq_get(struct ieee80211_hw *,
1189 uint8_t *, uint8_t *, size_t, size_t);
1190 void linuxkpi_ieee80211_tx_status(struct ieee80211_hw *, struct sk_buff *);
1191 void linuxkpi_ieee80211_tx_status_ext(struct ieee80211_hw *,
1192 struct ieee80211_tx_status *);
1193 void linuxkpi_ieee80211_stop_queues(struct ieee80211_hw *);
1194 void linuxkpi_ieee80211_wake_queues(struct ieee80211_hw *);
1195 void linuxkpi_ieee80211_stop_queue(struct ieee80211_hw *, int);
1196 void linuxkpi_ieee80211_wake_queue(struct ieee80211_hw *, int);
1197 void linuxkpi_ieee80211_txq_schedule_start(struct ieee80211_hw *, uint8_t);
1198 struct ieee80211_txq *linuxkpi_ieee80211_next_txq(struct ieee80211_hw *, uint8_t);
1199 void linuxkpi_ieee80211_schedule_txq(struct ieee80211_hw *,
1200 struct ieee80211_txq *, bool);
1201 void linuxkpi_ieee80211_handle_wake_tx_queue(struct ieee80211_hw *,
1202 struct ieee80211_txq *);
1203
1204 /* -------------------------------------------------------------------------- */
1205
1206 static __inline void
_ieee80211_hw_set(struct ieee80211_hw * hw,enum ieee80211_hw_flags flag)1207 _ieee80211_hw_set(struct ieee80211_hw *hw, enum ieee80211_hw_flags flag)
1208 {
1209
1210 set_bit(flag, hw->flags);
1211 }
1212
1213 static __inline bool
__ieee80211_hw_check(struct ieee80211_hw * hw,enum ieee80211_hw_flags flag)1214 __ieee80211_hw_check(struct ieee80211_hw *hw, enum ieee80211_hw_flags flag)
1215 {
1216
1217 return (test_bit(flag, hw->flags));
1218 }
1219
1220 /* They pass in shortened flag names; how confusingly inconsistent. */
1221 #define ieee80211_hw_set(_hw, _flag) \
1222 _ieee80211_hw_set(_hw, IEEE80211_HW_ ## _flag)
1223 #define ieee80211_hw_check(_hw, _flag) \
1224 __ieee80211_hw_check(_hw, IEEE80211_HW_ ## _flag)
1225
1226 /* XXX-BZ add CTASSERTS that size of struct is <= sizeof skb->cb. */
1227 CTASSERT(sizeof(struct ieee80211_tx_info) <= sizeof(((struct sk_buff *)0)->cb));
1228 #define IEEE80211_SKB_CB(_skb) \
1229 ((struct ieee80211_tx_info *)((_skb)->cb))
1230
1231 CTASSERT(sizeof(struct ieee80211_rx_status) <= sizeof(((struct sk_buff *)0)->cb));
1232 #define IEEE80211_SKB_RXCB(_skb) \
1233 ((struct ieee80211_rx_status *)((_skb)->cb))
1234
1235 static __inline void
ieee80211_free_hw(struct ieee80211_hw * hw)1236 ieee80211_free_hw(struct ieee80211_hw *hw)
1237 {
1238
1239 linuxkpi_ieee80211_iffree(hw);
1240
1241 if (hw->wiphy != NULL)
1242 wiphy_free(hw->wiphy);
1243 /* Note that *hw is not valid any longer after this. */
1244
1245 IMPROVE();
1246 }
1247
1248 static __inline struct ieee80211_hw *
ieee80211_alloc_hw(size_t priv_len,const struct ieee80211_ops * ops)1249 ieee80211_alloc_hw(size_t priv_len, const struct ieee80211_ops *ops)
1250 {
1251
1252 return (linuxkpi_ieee80211_alloc_hw(priv_len, ops));
1253 }
1254
1255 static __inline void
SET_IEEE80211_DEV(struct ieee80211_hw * hw,struct device * dev)1256 SET_IEEE80211_DEV(struct ieee80211_hw *hw, struct device *dev)
1257 {
1258
1259 set_wiphy_dev(hw->wiphy, dev);
1260 linuxkpi_set_ieee80211_dev(hw, dev_name(dev));
1261
1262 IMPROVE();
1263 }
1264
1265 static __inline int
ieee80211_register_hw(struct ieee80211_hw * hw)1266 ieee80211_register_hw(struct ieee80211_hw *hw)
1267 {
1268 int error;
1269
1270 error = wiphy_register(hw->wiphy);
1271 if (error != 0)
1272 return (error);
1273
1274 /*
1275 * At this point the driver has set all the options, flags, bands,
1276 * ciphers, hw address(es), ... basically mac80211/cfg80211 hw/wiphy
1277 * setup is done.
1278 * We need to replicate a lot of information from here into net80211.
1279 */
1280 error = linuxkpi_ieee80211_ifattach(hw);
1281
1282 IMPROVE();
1283
1284 return (error);
1285 }
1286
1287 static inline void
ieee80211_unregister_hw(struct ieee80211_hw * hw)1288 ieee80211_unregister_hw(struct ieee80211_hw *hw)
1289 {
1290
1291 linuxkpi_ieee80211_unregister_hw(hw);
1292 }
1293
1294 static __inline struct ieee80211_hw *
wiphy_to_ieee80211_hw(struct wiphy * wiphy)1295 wiphy_to_ieee80211_hw(struct wiphy *wiphy)
1296 {
1297
1298 return (linuxkpi_wiphy_to_ieee80211_hw(wiphy));
1299 }
1300
1301 static inline void
ieee80211_restart_hw(struct ieee80211_hw * hw)1302 ieee80211_restart_hw(struct ieee80211_hw *hw)
1303 {
1304 linuxkpi_ieee80211_restart_hw(hw);
1305 }
1306
1307 static inline void
ieee80211_hw_restart_disconnect(struct ieee80211_vif * vif)1308 ieee80211_hw_restart_disconnect(struct ieee80211_vif *vif)
1309 {
1310 TODO();
1311 }
1312
1313 /* -------------------------------------------------------------------------- */
1314
1315 #define link_conf_dereference_check(_vif, _linkid) \
1316 rcu_dereference_check((_vif)->link_conf[_linkid], true)
1317
1318 #define link_conf_dereference_protected(_vif, _linkid) \
1319 rcu_dereference_protected((_vif)->link_conf[_linkid], true)
1320
1321 #define link_sta_dereference_check(_sta, _linkid) \
1322 rcu_dereference_check((_sta)->link[_linkid], true)
1323
1324 #define link_sta_dereference_protected(_sta, _linkid) \
1325 rcu_dereference_protected((_sta)->link[_linkid], true)
1326
1327 #define for_each_vif_active_link(_vif, _link, _linkid) \
1328 for (_linkid = 0; _linkid < nitems((_vif)->link_conf); _linkid++) \
1329 if ( ((_vif)->active_links == 0 /* no MLO */ || \
1330 ((_vif)->active_links & BIT(_linkid)) != 0) && \
1331 (_link = rcu_dereference((_vif)->link_conf[_linkid])) )
1332
1333 #define for_each_sta_active_link(_vif, _sta, _linksta, _linkid) \
1334 for (_linkid = 0; _linkid < nitems((_sta)->link); _linkid++) \
1335 if ( ((_vif)->active_links == 0 /* no MLO */ || \
1336 ((_vif)->active_links & BIT(_linkid)) != 0) && \
1337 (_linksta = link_sta_dereference_protected((_sta), (_linkid))) )
1338
1339 /* -------------------------------------------------------------------------- */
1340
1341 static __inline bool
ieee80211_vif_is_mesh(struct ieee80211_vif * vif)1342 ieee80211_vif_is_mesh(struct ieee80211_vif *vif)
1343 {
1344 TODO();
1345 return (false);
1346 }
1347
1348
1349 /* -------------------------------------------------------------------------- */
1350 /* Receive functions (air/driver to mac80211/net80211). */
1351
1352
1353 static __inline void
ieee80211_rx_napi(struct ieee80211_hw * hw,struct ieee80211_sta * sta,struct sk_buff * skb,struct napi_struct * napi)1354 ieee80211_rx_napi(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
1355 struct sk_buff *skb, struct napi_struct *napi)
1356 {
1357
1358 linuxkpi_ieee80211_rx(hw, skb, sta, napi, NULL);
1359 }
1360
1361 static __inline void
ieee80211_rx_list(struct ieee80211_hw * hw,struct ieee80211_sta * sta,struct sk_buff * skb,struct list_head * list)1362 ieee80211_rx_list(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
1363 struct sk_buff *skb, struct list_head *list)
1364 {
1365
1366 linuxkpi_ieee80211_rx(hw, skb, sta, NULL, list);
1367 }
1368
1369 static __inline void
ieee80211_rx_ni(struct ieee80211_hw * hw,struct sk_buff * skb)1370 ieee80211_rx_ni(struct ieee80211_hw *hw, struct sk_buff *skb)
1371 {
1372
1373 linuxkpi_ieee80211_rx(hw, skb, NULL, NULL, NULL);
1374 }
1375
1376 static __inline void
ieee80211_rx_irqsafe(struct ieee80211_hw * hw,struct sk_buff * skb)1377 ieee80211_rx_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb)
1378 {
1379
1380 linuxkpi_ieee80211_rx(hw, skb, NULL, NULL, NULL);
1381 }
1382
1383 static __inline void
ieee80211_rx(struct ieee80211_hw * hw,struct sk_buff * skb)1384 ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb)
1385 {
1386
1387 linuxkpi_ieee80211_rx(hw, skb, NULL, NULL, NULL);
1388 }
1389
1390 /* -------------------------------------------------------------------------- */
1391
1392 static inline void
ieee80211_stop_queues(struct ieee80211_hw * hw)1393 ieee80211_stop_queues(struct ieee80211_hw *hw)
1394 {
1395 linuxkpi_ieee80211_stop_queues(hw);
1396 }
1397
1398 static inline void
ieee80211_wake_queues(struct ieee80211_hw * hw)1399 ieee80211_wake_queues(struct ieee80211_hw *hw)
1400 {
1401 linuxkpi_ieee80211_wake_queues(hw);
1402 }
1403
1404 static inline void
ieee80211_stop_queue(struct ieee80211_hw * hw,int qnum)1405 ieee80211_stop_queue(struct ieee80211_hw *hw, int qnum)
1406 {
1407 linuxkpi_ieee80211_stop_queue(hw, qnum);
1408 }
1409
1410 static inline void
ieee80211_wake_queue(struct ieee80211_hw * hw,int qnum)1411 ieee80211_wake_queue(struct ieee80211_hw *hw, int qnum)
1412 {
1413 linuxkpi_ieee80211_wake_queue(hw, qnum);
1414 }
1415
1416 static inline void
ieee80211_schedule_txq(struct ieee80211_hw * hw,struct ieee80211_txq * txq)1417 ieee80211_schedule_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq)
1418 {
1419 linuxkpi_ieee80211_schedule_txq(hw, txq, true);
1420 }
1421
1422 static inline void
ieee80211_return_txq(struct ieee80211_hw * hw,struct ieee80211_txq * txq,bool withoutpkts)1423 ieee80211_return_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq,
1424 bool withoutpkts)
1425 {
1426 linuxkpi_ieee80211_schedule_txq(hw, txq, withoutpkts);
1427 }
1428
1429 static inline void
ieee80211_txq_schedule_start(struct ieee80211_hw * hw,uint8_t ac)1430 ieee80211_txq_schedule_start(struct ieee80211_hw *hw, uint8_t ac)
1431 {
1432 linuxkpi_ieee80211_txq_schedule_start(hw, ac);
1433 }
1434
1435 static inline void
ieee80211_txq_schedule_end(struct ieee80211_hw * hw,uint8_t ac)1436 ieee80211_txq_schedule_end(struct ieee80211_hw *hw, uint8_t ac)
1437 {
1438 /* DO_NADA; */
1439 }
1440
1441 static inline struct ieee80211_txq *
ieee80211_next_txq(struct ieee80211_hw * hw,uint8_t ac)1442 ieee80211_next_txq(struct ieee80211_hw *hw, uint8_t ac)
1443 {
1444 return (linuxkpi_ieee80211_next_txq(hw, ac));
1445 }
1446
1447 static inline void
ieee80211_handle_wake_tx_queue(struct ieee80211_hw * hw,struct ieee80211_txq * txq)1448 ieee80211_handle_wake_tx_queue(struct ieee80211_hw *hw,
1449 struct ieee80211_txq *txq)
1450 {
1451 linuxkpi_ieee80211_handle_wake_tx_queue(hw, txq);
1452 }
1453
1454 /* -------------------------------------------------------------------------- */
1455
1456 static __inline uint8_t
ieee80211_get_tid(struct ieee80211_hdr * hdr)1457 ieee80211_get_tid(struct ieee80211_hdr *hdr)
1458 {
1459
1460 return (linuxkpi_ieee80211_get_tid(hdr, false));
1461 }
1462
1463 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)1464 ieee80211_beacon_get_tim(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1465 uint16_t *tim_offset, uint16_t *tim_len, uint32_t link_id)
1466 {
1467
1468 if (tim_offset != NULL)
1469 *tim_offset = 0;
1470 if (tim_len != NULL)
1471 *tim_len = 0;
1472 TODO();
1473 return (NULL);
1474 }
1475
1476 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)1477 ieee80211_iterate_active_interfaces_atomic(struct ieee80211_hw *hw,
1478 enum ieee80211_iface_iter flags,
1479 void(*iterfunc)(void *, uint8_t *, struct ieee80211_vif *),
1480 void *arg)
1481 {
1482
1483 flags |= IEEE80211_IFACE_ITER__ATOMIC;
1484 flags |= IEEE80211_IFACE_ITER_ACTIVE;
1485 linuxkpi_ieee80211_iterate_interfaces(hw, flags, iterfunc, arg);
1486 }
1487
1488 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)1489 ieee80211_iterate_active_interfaces(struct ieee80211_hw *hw,
1490 enum ieee80211_iface_iter flags,
1491 void(*iterfunc)(void *, uint8_t *, struct ieee80211_vif *),
1492 void *arg)
1493 {
1494
1495 flags |= IEEE80211_IFACE_ITER_ACTIVE;
1496 linuxkpi_ieee80211_iterate_interfaces(hw, flags, iterfunc, arg);
1497 }
1498
1499 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)1500 ieee80211_iterate_active_interfaces_mtx(struct ieee80211_hw *hw,
1501 enum ieee80211_iface_iter flags,
1502 void(*iterfunc)(void *, uint8_t *, struct ieee80211_vif *),
1503 void *arg)
1504 {
1505 flags |= IEEE80211_IFACE_ITER_ACTIVE;
1506 flags |= IEEE80211_IFACE_ITER__MTX;
1507 linuxkpi_ieee80211_iterate_interfaces(hw, flags, iterfunc, arg);
1508 }
1509
1510 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)1511 ieee80211_iterate_interfaces(struct ieee80211_hw *hw,
1512 enum ieee80211_iface_iter flags,
1513 void (*iterfunc)(void *, uint8_t *, struct ieee80211_vif *),
1514 void *arg)
1515 {
1516
1517 linuxkpi_ieee80211_iterate_interfaces(hw, flags, iterfunc, arg);
1518 }
1519
1520 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)1521 ieee80211_iter_keys(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1522 void(*iterfunc)(struct ieee80211_hw *, struct ieee80211_vif *,
1523 struct ieee80211_sta *, struct ieee80211_key_conf *, void *),
1524 void *arg)
1525 {
1526
1527 linuxkpi_ieee80211_iterate_keys(hw, vif, iterfunc, arg);
1528 }
1529
1530 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)1531 ieee80211_iter_keys_rcu(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1532 void(*iterfunc)(struct ieee80211_hw *, struct ieee80211_vif *,
1533 struct ieee80211_sta *, struct ieee80211_key_conf *, void *),
1534 void *arg)
1535 {
1536
1537 IMPROVE(); /* "rcu" */
1538 linuxkpi_ieee80211_iterate_keys(hw, vif, iterfunc, arg);
1539 }
1540
1541 static __inline void
ieee80211_iter_chan_contexts_atomic(struct ieee80211_hw * hw,void (* iterfunc)(struct ieee80211_hw *,struct ieee80211_chanctx_conf *,void *),void * arg)1542 ieee80211_iter_chan_contexts_atomic(struct ieee80211_hw *hw,
1543 void(*iterfunc)(struct ieee80211_hw *, struct ieee80211_chanctx_conf *, void *),
1544 void *arg)
1545 {
1546
1547 linuxkpi_ieee80211_iterate_chan_contexts(hw, iterfunc, arg);
1548 }
1549
1550 static __inline void
ieee80211_iterate_stations_atomic(struct ieee80211_hw * hw,void (* iterfunc)(void *,struct ieee80211_sta *),void * arg)1551 ieee80211_iterate_stations_atomic(struct ieee80211_hw *hw,
1552 void (*iterfunc)(void *, struct ieee80211_sta *), void *arg)
1553 {
1554
1555 linuxkpi_ieee80211_iterate_stations_atomic(hw, iterfunc, arg);
1556 }
1557
1558 static __inline struct wireless_dev *
ieee80211_vif_to_wdev(struct ieee80211_vif * vif)1559 ieee80211_vif_to_wdev(struct ieee80211_vif *vif)
1560 {
1561
1562 return (linuxkpi_ieee80211_vif_to_wdev(vif));
1563 }
1564
1565 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)1566 ieee80211_beacon_get_template(struct ieee80211_hw *hw,
1567 struct ieee80211_vif *vif, struct ieee80211_mutable_offsets *offs,
1568 uint32_t link_id)
1569 {
1570 TODO();
1571 return (NULL);
1572 }
1573
1574 static __inline void
ieee80211_beacon_loss(struct ieee80211_vif * vif)1575 ieee80211_beacon_loss(struct ieee80211_vif *vif)
1576 {
1577 linuxkpi_ieee80211_beacon_loss(vif);
1578 }
1579
1580 static __inline void
ieee80211_chswitch_done(struct ieee80211_vif * vif,bool t,uint32_t link_id)1581 ieee80211_chswitch_done(struct ieee80211_vif *vif, bool t, uint32_t link_id)
1582 {
1583 TODO();
1584 }
1585
1586 static __inline bool
ieee80211_csa_is_complete(struct ieee80211_vif * vif)1587 ieee80211_csa_is_complete(struct ieee80211_vif *vif)
1588 {
1589 TODO();
1590 return (false);
1591 }
1592
1593 static __inline void
ieee80211_csa_set_counter(struct ieee80211_vif * vif,uint8_t counter)1594 ieee80211_csa_set_counter(struct ieee80211_vif *vif, uint8_t counter)
1595 {
1596 TODO();
1597 }
1598
1599 static __inline int
ieee80211_csa_update_counter(struct ieee80211_vif * vif)1600 ieee80211_csa_update_counter(struct ieee80211_vif *vif)
1601 {
1602 TODO();
1603 return (-1);
1604 }
1605
1606 static __inline void
ieee80211_csa_finish(struct ieee80211_vif * vif,uint32_t link_id)1607 ieee80211_csa_finish(struct ieee80211_vif *vif, uint32_t link_id)
1608 {
1609 TODO();
1610 }
1611
1612 static __inline enum nl80211_iftype
ieee80211_vif_type_p2p(struct ieee80211_vif * vif)1613 ieee80211_vif_type_p2p(struct ieee80211_vif *vif)
1614 {
1615
1616 /* If we are not p2p enabled, just return the type. */
1617 if (!vif->p2p)
1618 return (vif->type);
1619
1620 /* If we are p2p, depending on side, return type. */
1621 switch (vif->type) {
1622 case NL80211_IFTYPE_AP:
1623 return (NL80211_IFTYPE_P2P_GO);
1624 case NL80211_IFTYPE_STATION:
1625 return (NL80211_IFTYPE_P2P_CLIENT);
1626 default:
1627 fallthrough;
1628 }
1629 return (vif->type);
1630 }
1631
1632 static __inline unsigned long
ieee80211_tu_to_usec(unsigned long tu)1633 ieee80211_tu_to_usec(unsigned long tu)
1634 {
1635
1636 return (tu * IEEE80211_DUR_TU);
1637 }
1638
1639 /*
1640 * Below we assume that the two values from different emums are the same.
1641 * Make sure this does not accidentally change.
1642 */
1643 CTASSERT((int)IEEE80211_ACTION_SM_TPCREP == (int)IEEE80211_ACTION_RADIO_MEASUREMENT_LMREP);
1644
1645 static __inline bool
ieee80211_action_contains_tpc(struct sk_buff * skb)1646 ieee80211_action_contains_tpc(struct sk_buff *skb)
1647 {
1648 struct ieee80211_mgmt *mgmt;
1649
1650 mgmt = (struct ieee80211_mgmt *)skb->data;
1651
1652 /* Check that this is a mgmt/action frame? */
1653 if (!ieee80211_is_action(mgmt->frame_control))
1654 return (false);
1655
1656 /*
1657 * This is a bit convoluted but according to docs both actions
1658 * are checked for this. Kind-of makes sense for the only consumer
1659 * (iwlwifi) I am aware off given the txpower fields are at the
1660 * same location so firmware can update the value.
1661 */
1662 /* 80211-2020 9.6.2 Spectrum Management Action frames */
1663 /* 80211-2020 9.6.2.5 TPC Report frame format */
1664 /* 80211-2020 9.6.6 Radio Measurement action details */
1665 /* 80211-2020 9.6.6.4 Link Measurement Report frame format */
1666 /* Check that it is Spectrum Management or Radio Measurement? */
1667 if (mgmt->u.action.category != IEEE80211_ACTION_CAT_SM &&
1668 mgmt->u.action.category != IEEE80211_ACTION_CAT_RADIO_MEASUREMENT)
1669 return (false);
1670
1671 /*
1672 * Check that it is TPC Report or Link Measurement Report?
1673 * The values of each are the same (see CTASSERT above function).
1674 */
1675 if (mgmt->u.action.u.tpc_report.spec_mgmt != IEEE80211_ACTION_SM_TPCREP)
1676 return (false);
1677
1678 /* 80211-2020 9.4.2.16 TPC Report element */
1679 /* Check that the ELEMID and length are correct? */
1680 if (mgmt->u.action.u.tpc_report.tpc_elem_id != IEEE80211_ELEMID_TPCREP ||
1681 mgmt->u.action.u.tpc_report.tpc_elem_length != 4)
1682 return (false);
1683
1684 /* All the right fields in the right place. */
1685 return (true);
1686 }
1687
1688 static __inline void
ieee80211_connection_loss(struct ieee80211_vif * vif)1689 ieee80211_connection_loss(struct ieee80211_vif *vif)
1690 {
1691
1692 linuxkpi_ieee80211_connection_loss(vif);
1693 }
1694
1695 static __inline struct ieee80211_sta *
ieee80211_find_sta(struct ieee80211_vif * vif,const u8 * peer)1696 ieee80211_find_sta(struct ieee80211_vif *vif, const u8 *peer)
1697 {
1698
1699 return (linuxkpi_ieee80211_find_sta(vif, peer));
1700 }
1701
1702 static __inline struct ieee80211_sta *
ieee80211_find_sta_by_ifaddr(struct ieee80211_hw * hw,const uint8_t * addr,const uint8_t * ourvifaddr)1703 ieee80211_find_sta_by_ifaddr(struct ieee80211_hw *hw, const uint8_t *addr,
1704 const uint8_t *ourvifaddr)
1705 {
1706
1707 return (linuxkpi_ieee80211_find_sta_by_ifaddr(hw, addr, ourvifaddr));
1708 }
1709
1710
1711 static __inline void
ieee80211_get_tkip_p2k(struct ieee80211_key_conf * keyconf,struct sk_buff * skb_frag,u8 * key)1712 ieee80211_get_tkip_p2k(struct ieee80211_key_conf *keyconf,
1713 struct sk_buff *skb_frag, u8 *key)
1714 {
1715 TODO();
1716 }
1717
1718 static __inline void
ieee80211_get_tkip_rx_p1k(struct ieee80211_key_conf * keyconf,const u8 * addr,uint32_t iv32,u16 * p1k)1719 ieee80211_get_tkip_rx_p1k(struct ieee80211_key_conf *keyconf,
1720 const u8 *addr, uint32_t iv32, u16 *p1k)
1721 {
1722
1723 KASSERT(keyconf != NULL && addr != NULL && p1k != NULL,
1724 ("%s: keyconf %p addr %p p1k %p\n", __func__, keyconf, addr, p1k));
1725
1726 TODO();
1727 memset(p1k, 0xfa, 5 * sizeof(*p1k)); /* Just initializing. */
1728 }
1729
1730 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)1731 ieee80211_ie_split(const u8 *ies, size_t ies_len,
1732 const u8 *ie_ids, size_t ie_ids_len, size_t start)
1733 {
1734 size_t x;
1735
1736 x = start;
1737
1738 /* XXX FIXME, we need to deal with "Element ID Extension" */
1739 while (x < ies_len) {
1740
1741 /* Is this IE[s] one of the ie_ids? */
1742 if (!linuxkpi_ieee80211_is_ie_id_in_ie_buf(ies[x],
1743 ie_ids, ie_ids_len))
1744 break;
1745
1746 if (!linuxkpi_ieee80211_ie_advance(&x, ies, ies_len))
1747 break;
1748 }
1749
1750 return (x);
1751 }
1752
1753 static __inline void
ieee80211_request_smps(struct ieee80211_vif * vif,u_int link_id,enum ieee80211_smps_mode smps)1754 ieee80211_request_smps(struct ieee80211_vif *vif, u_int link_id,
1755 enum ieee80211_smps_mode smps)
1756 {
1757 static const char *smps_mode_name[] = {
1758 "SMPS_OFF",
1759 "SMPS_STATIC",
1760 "SMPS_DYNAMIC",
1761 "SMPS_AUTOMATIC",
1762 "SMPS_NUM_MODES"
1763 };
1764
1765 if (linuxkpi_debug_80211 & D80211_TODO)
1766 printf("%s:%d: XXX LKPI80211 TODO smps %d %s\n",
1767 __func__, __LINE__, smps, smps_mode_name[smps]);
1768 }
1769
1770 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)1771 ieee80211_tdls_oper_request(struct ieee80211_vif *vif, uint8_t *addr,
1772 enum nl80211_tdls_operation oper, enum ieee80211_reason_code code,
1773 gfp_t gfp)
1774 {
1775 TODO();
1776 }
1777
1778 static __inline void
wiphy_rfkill_set_hw_state(struct wiphy * wiphy,bool state)1779 wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool state)
1780 {
1781 TODO();
1782 }
1783
1784 static __inline void
ieee80211_free_txskb(struct ieee80211_hw * hw,struct sk_buff * skb)1785 ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb)
1786 {
1787 IMPROVE();
1788
1789 /*
1790 * This is called on transmit failure.
1791 * Use a not-so-random random high status error so we can distinguish
1792 * it from normal low values flying around in net80211 ("ETX").
1793 */
1794 linuxkpi_ieee80211_free_txskb(hw, skb, 0x455458);
1795 }
1796
1797 static __inline void
ieee80211_ready_on_channel(struct ieee80211_hw * hw)1798 ieee80211_ready_on_channel(struct ieee80211_hw *hw)
1799 {
1800 TODO();
1801 /* XXX-BZ We need to see that. */
1802 }
1803
1804 static __inline void
ieee80211_remain_on_channel_expired(struct ieee80211_hw * hw)1805 ieee80211_remain_on_channel_expired(struct ieee80211_hw *hw)
1806 {
1807 TODO();
1808 }
1809
1810 static __inline void
ieee80211_cqm_rssi_notify(struct ieee80211_vif * vif,enum nl80211_cqm_rssi_threshold_event crte,int sig,gfp_t gfp)1811 ieee80211_cqm_rssi_notify(struct ieee80211_vif *vif,
1812 enum nl80211_cqm_rssi_threshold_event crte, int sig, gfp_t gfp)
1813 {
1814 TODO();
1815 }
1816
1817 /* -------------------------------------------------------------------------- */
1818
1819 static inline bool
ieee80211_sn_less(uint16_t sn1,uint16_t sn2)1820 ieee80211_sn_less(uint16_t sn1, uint16_t sn2)
1821 {
1822 return (IEEE80211_SEQ_BA_BEFORE(sn1, sn2));
1823 }
1824
1825 static inline uint16_t
ieee80211_sn_inc(uint16_t sn)1826 ieee80211_sn_inc(uint16_t sn)
1827 {
1828 return (IEEE80211_SEQ_INC(sn));
1829 }
1830
1831 static inline uint16_t
ieee80211_sn_add(uint16_t sn,uint16_t a)1832 ieee80211_sn_add(uint16_t sn, uint16_t a)
1833 {
1834 return (IEEE80211_SEQ_ADD(sn, a));
1835 }
1836
1837 static inline uint16_t
ieee80211_sn_sub(uint16_t sa,uint16_t sb)1838 ieee80211_sn_sub(uint16_t sa, uint16_t sb)
1839 {
1840 return (IEEE80211_SEQ_SUB(sa, sb));
1841 }
1842
1843 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)1844 ieee80211_mark_rx_ba_filtered_frames(struct ieee80211_sta *sta, uint8_t tid,
1845 uint32_t ssn, uint64_t bitmap, uint16_t received_mpdu)
1846 {
1847 TODO();
1848 }
1849
1850 static __inline void
ieee80211_stop_rx_ba_session(struct ieee80211_vif * vif,uint32_t x,uint8_t * addr)1851 ieee80211_stop_rx_ba_session(struct ieee80211_vif *vif, uint32_t x, uint8_t *addr)
1852 {
1853 TODO();
1854 }
1855
1856 static __inline void
ieee80211_rx_ba_timer_expired(struct ieee80211_vif * vif,uint8_t * addr,uint8_t tid)1857 ieee80211_rx_ba_timer_expired(struct ieee80211_vif *vif, uint8_t *addr,
1858 uint8_t tid)
1859 {
1860 TODO();
1861 }
1862
1863 static __inline void
ieee80211_start_rx_ba_session_offl(struct ieee80211_vif * vif,uint8_t * addr,uint8_t tid)1864 ieee80211_start_rx_ba_session_offl(struct ieee80211_vif *vif, uint8_t *addr,
1865 uint8_t tid)
1866 {
1867 TODO();
1868 }
1869
1870 static __inline void
ieee80211_stop_rx_ba_session_offl(struct ieee80211_vif * vif,uint8_t * addr,uint8_t tid)1871 ieee80211_stop_rx_ba_session_offl(struct ieee80211_vif *vif, uint8_t *addr,
1872 uint8_t tid)
1873 {
1874 TODO();
1875 }
1876
1877 /* -------------------------------------------------------------------------- */
1878
1879 static __inline void
ieee80211_rate_set_vht(struct ieee80211_tx_rate * r,uint32_t f1,uint32_t f2)1880 ieee80211_rate_set_vht(struct ieee80211_tx_rate *r, uint32_t f1, uint32_t f2)
1881 {
1882 TODO();
1883 }
1884
1885 static __inline uint8_t
ieee80211_rate_get_vht_nss(struct ieee80211_tx_rate * r)1886 ieee80211_rate_get_vht_nss(struct ieee80211_tx_rate *r)
1887 {
1888 TODO();
1889 return (0);
1890 }
1891
1892 static __inline uint8_t
ieee80211_rate_get_vht_mcs(struct ieee80211_tx_rate * r)1893 ieee80211_rate_get_vht_mcs(struct ieee80211_tx_rate *r)
1894 {
1895 TODO();
1896 return (0);
1897 }
1898
1899 static __inline void
ieee80211_reserve_tid(struct ieee80211_sta * sta,uint8_t tid)1900 ieee80211_reserve_tid(struct ieee80211_sta *sta, uint8_t tid)
1901 {
1902 TODO();
1903 }
1904
1905 static __inline void
ieee80211_unreserve_tid(struct ieee80211_sta * sta,uint8_t tid)1906 ieee80211_unreserve_tid(struct ieee80211_sta *sta, uint8_t tid)
1907 {
1908 TODO();
1909 }
1910
1911 static __inline void
ieee80211_send_eosp_nullfunc(struct ieee80211_sta * sta,uint8_t tid)1912 ieee80211_send_eosp_nullfunc(struct ieee80211_sta *sta, uint8_t tid)
1913 {
1914 TODO();
1915 }
1916
1917 static __inline void
ieee80211_sta_block_awake(struct ieee80211_hw * hw,struct ieee80211_sta * sta,bool disable)1918 ieee80211_sta_block_awake(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
1919 bool disable)
1920 {
1921 TODO();
1922 }
1923
1924 static __inline void
ieee80211_sta_ps_transition(struct ieee80211_sta * sta,bool sleeping)1925 ieee80211_sta_ps_transition(struct ieee80211_sta *sta, bool sleeping)
1926 {
1927 TODO();
1928 }
1929
1930 static __inline void
ieee80211_sta_pspoll(struct ieee80211_sta * sta)1931 ieee80211_sta_pspoll(struct ieee80211_sta *sta)
1932 {
1933 TODO();
1934 }
1935
1936 static __inline void
ieee80211_sta_recalc_aggregates(struct ieee80211_sta * sta)1937 ieee80211_sta_recalc_aggregates(struct ieee80211_sta *sta)
1938 {
1939 TODO();
1940 }
1941
1942 static __inline void
ieee80211_sta_uapsd_trigger(struct ieee80211_sta * sta,int ntids)1943 ieee80211_sta_uapsd_trigger(struct ieee80211_sta *sta, int ntids)
1944 {
1945 TODO();
1946 }
1947
1948 static __inline void
ieee80211_tkip_add_iv(u8 * crypto_hdr,struct ieee80211_key_conf * keyconf,uint64_t pn)1949 ieee80211_tkip_add_iv(u8 *crypto_hdr, struct ieee80211_key_conf *keyconf,
1950 uint64_t pn)
1951 {
1952 TODO();
1953 }
1954
1955 static inline struct sk_buff *
ieee80211_tx_dequeue(struct ieee80211_hw * hw,struct ieee80211_txq * txq)1956 ieee80211_tx_dequeue(struct ieee80211_hw *hw, struct ieee80211_txq *txq)
1957 {
1958
1959 return (linuxkpi_ieee80211_tx_dequeue(hw, txq));
1960 }
1961
1962 static inline struct sk_buff *
ieee80211_tx_dequeue_ni(struct ieee80211_hw * hw,struct ieee80211_txq * txq)1963 ieee80211_tx_dequeue_ni(struct ieee80211_hw *hw, struct ieee80211_txq *txq)
1964 {
1965 struct sk_buff *skb;
1966
1967 local_bh_disable();
1968 skb = linuxkpi_ieee80211_tx_dequeue(hw, txq);
1969 local_bh_enable();
1970
1971 return (skb);
1972 }
1973
1974 static __inline void
ieee80211_update_mu_groups(struct ieee80211_vif * vif,u_int _i,uint8_t * ms,uint8_t * up)1975 ieee80211_update_mu_groups(struct ieee80211_vif *vif,
1976 u_int _i, uint8_t *ms, uint8_t *up)
1977 {
1978 TODO();
1979 }
1980
1981 static __inline void
ieee80211_sta_set_buffered(struct ieee80211_sta * sta,uint8_t tid,bool t)1982 ieee80211_sta_set_buffered(struct ieee80211_sta *sta, uint8_t tid, bool t)
1983 {
1984 TODO();
1985 }
1986
1987 static __inline void
ieee80211_get_key_rx_seq(struct ieee80211_key_conf * keyconf,uint8_t tid,struct ieee80211_key_seq * seq)1988 ieee80211_get_key_rx_seq(struct ieee80211_key_conf *keyconf, uint8_t tid,
1989 struct ieee80211_key_seq *seq)
1990 {
1991
1992 KASSERT(keyconf != NULL && seq != NULL, ("%s: keyconf %p seq %p\n",
1993 __func__, keyconf, seq));
1994
1995 TODO();
1996 switch (keyconf->cipher) {
1997 case WLAN_CIPHER_SUITE_CCMP:
1998 case WLAN_CIPHER_SUITE_CCMP_256:
1999 memset(seq->ccmp.pn, 0xfa, sizeof(seq->ccmp.pn)); /* XXX TODO */
2000 break;
2001 case WLAN_CIPHER_SUITE_AES_CMAC:
2002 memset(seq->aes_cmac.pn, 0xfa, sizeof(seq->aes_cmac.pn)); /* XXX TODO */
2003 break;
2004 case WLAN_CIPHER_SUITE_TKIP:
2005 seq->tkip.iv32 = 0xfa; /* XXX TODO */
2006 seq->tkip.iv16 = 0xfa; /* XXX TODO */
2007 break;
2008 default:
2009 pr_debug("%s: unsupported cipher suite %d\n", __func__, keyconf->cipher);
2010 break;
2011 }
2012 }
2013
2014 static __inline void
ieee80211_sched_scan_results(struct ieee80211_hw * hw)2015 ieee80211_sched_scan_results(struct ieee80211_hw *hw)
2016 {
2017 TODO();
2018 }
2019
2020 static __inline void
ieee80211_sta_eosp(struct ieee80211_sta * sta)2021 ieee80211_sta_eosp(struct ieee80211_sta *sta)
2022 {
2023 TODO();
2024 }
2025
2026 static __inline int
ieee80211_start_tx_ba_session(struct ieee80211_sta * sta,uint8_t tid,int x)2027 ieee80211_start_tx_ba_session(struct ieee80211_sta *sta, uint8_t tid, int x)
2028 {
2029 TODO("rtw8x");
2030 return (-EINVAL);
2031 }
2032
2033 static __inline int
ieee80211_stop_tx_ba_session(struct ieee80211_sta * sta,uint8_t tid)2034 ieee80211_stop_tx_ba_session(struct ieee80211_sta *sta, uint8_t tid)
2035 {
2036 TODO("rtw89");
2037 return (-EINVAL);
2038 }
2039
2040 static __inline void
ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_vif * vif,uint8_t * addr,uint8_t tid)2041 ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, uint8_t *addr,
2042 uint8_t tid)
2043 {
2044 TODO("iwlwifi");
2045 }
2046
2047 static __inline void
ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_vif * vif,uint8_t * addr,uint8_t tid)2048 ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, uint8_t *addr,
2049 uint8_t tid)
2050 {
2051 TODO("iwlwifi/rtw8x/...");
2052 }
2053
2054 static __inline void
ieee80211_sched_scan_stopped(struct ieee80211_hw * hw)2055 ieee80211_sched_scan_stopped(struct ieee80211_hw *hw)
2056 {
2057 TODO();
2058 }
2059
2060 static __inline void
ieee80211_scan_completed(struct ieee80211_hw * hw,struct cfg80211_scan_info * info)2061 ieee80211_scan_completed(struct ieee80211_hw *hw,
2062 struct cfg80211_scan_info *info)
2063 {
2064
2065 linuxkpi_ieee80211_scan_completed(hw, info);
2066 }
2067
2068 static __inline struct sk_buff *
ieee80211_beacon_get(struct ieee80211_hw * hw,struct ieee80211_vif * vif,uint32_t link_id)2069 ieee80211_beacon_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
2070 uint32_t link_id)
2071 {
2072 TODO();
2073 return (NULL);
2074 }
2075
2076 static __inline struct sk_buff *
ieee80211_pspoll_get(struct ieee80211_hw * hw,struct ieee80211_vif * vif)2077 ieee80211_pspoll_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
2078 {
2079
2080 /* Only STA needs this. Otherwise return NULL and panic bad drivers. */
2081 if (vif->type != NL80211_IFTYPE_STATION)
2082 return (NULL);
2083
2084 return (linuxkpi_ieee80211_pspoll_get(hw, vif));
2085 }
2086
2087 static __inline struct sk_buff *
ieee80211_proberesp_get(struct ieee80211_hw * hw,struct ieee80211_vif * vif)2088 ieee80211_proberesp_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
2089 {
2090 TODO();
2091 return (NULL);
2092 }
2093
2094 static __inline struct sk_buff *
ieee80211_nullfunc_get(struct ieee80211_hw * hw,struct ieee80211_vif * vif,int linkid,bool qos)2095 ieee80211_nullfunc_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
2096 int linkid, bool qos)
2097 {
2098
2099 /* Only STA needs this. Otherwise return NULL and panic bad drivers. */
2100 if (vif->type != NL80211_IFTYPE_STATION)
2101 return (NULL);
2102
2103 return (linuxkpi_ieee80211_nullfunc_get(hw, vif, linkid, qos));
2104 }
2105
2106 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)2107 ieee80211_probereq_get(struct ieee80211_hw *hw, uint8_t *addr,
2108 uint8_t *ssid, size_t ssid_len, size_t tailroom)
2109 {
2110
2111 return (linuxkpi_ieee80211_probereq_get(hw, addr, ssid, ssid_len,
2112 tailroom));
2113 }
2114
2115 static __inline void
ieee80211_queue_delayed_work(struct ieee80211_hw * hw,struct delayed_work * w,int delay)2116 ieee80211_queue_delayed_work(struct ieee80211_hw *hw, struct delayed_work *w,
2117 int delay)
2118 {
2119
2120 linuxkpi_ieee80211_queue_delayed_work(hw, w, delay);
2121 }
2122
2123 static __inline void
ieee80211_queue_work(struct ieee80211_hw * hw,struct work_struct * w)2124 ieee80211_queue_work(struct ieee80211_hw *hw, struct work_struct *w)
2125 {
2126
2127 linuxkpi_ieee80211_queue_work(hw, w);
2128 }
2129
2130 static __inline void
ieee80211_tx_status_skb(struct ieee80211_hw * hw,struct sk_buff * skb)2131 ieee80211_tx_status_skb(struct ieee80211_hw *hw, struct sk_buff *skb)
2132 {
2133 linuxkpi_ieee80211_tx_status(hw, skb);
2134 }
2135
2136 static __inline void
ieee80211_tx_status_irqsafe(struct ieee80211_hw * hw,struct sk_buff * skb)2137 ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb)
2138 {
2139 IMPROVE();
2140 linuxkpi_ieee80211_tx_status(hw, skb);
2141 }
2142
2143 static __inline void
ieee80211_tx_status_ni(struct ieee80211_hw * hw,struct sk_buff * skb)2144 ieee80211_tx_status_ni(struct ieee80211_hw *hw, struct sk_buff *skb)
2145 {
2146 IMPROVE();
2147 linuxkpi_ieee80211_tx_status(hw, skb);
2148 }
2149
2150 static __inline void
ieee80211_tx_status_ext(struct ieee80211_hw * hw,struct ieee80211_tx_status * txstat)2151 ieee80211_tx_status_ext(struct ieee80211_hw *hw,
2152 struct ieee80211_tx_status *txstat)
2153 {
2154
2155 linuxkpi_ieee80211_tx_status_ext(hw, txstat);
2156 }
2157
2158 static __inline void
ieee80211_tx_info_clear_status(struct ieee80211_tx_info * info)2159 ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)
2160 {
2161 int i;
2162
2163 /*
2164 * Apparently clearing flags and some other fields is not right.
2165 * Given the function is called "status" we work on that part of
2166 * the union.
2167 */
2168 for (i = 0; i < nitems(info->status.rates); i++)
2169 info->status.rates[i].count = 0;
2170 /*
2171 * Unclear if ack_signal should be included or not but we clear the
2172 * "valid" bool so this field is no longer valid.
2173 */
2174 memset(&info->status.ack_signal, 0, sizeof(*info) -
2175 offsetof(struct ieee80211_tx_info, status.ack_signal));
2176 }
2177
2178 static __inline void
ieee80211_txq_get_depth(struct ieee80211_txq * txq,unsigned long * frame_cnt,unsigned long * byte_cnt)2179 ieee80211_txq_get_depth(struct ieee80211_txq *txq, unsigned long *frame_cnt,
2180 unsigned long *byte_cnt)
2181 {
2182
2183 if (frame_cnt == NULL && byte_cnt == NULL)
2184 return;
2185
2186 linuxkpi_ieee80211_txq_get_depth(txq, frame_cnt, byte_cnt);
2187 }
2188
2189 static __inline int
rate_lowest_index(struct ieee80211_supported_band * band,struct ieee80211_sta * sta)2190 rate_lowest_index(struct ieee80211_supported_band *band,
2191 struct ieee80211_sta *sta)
2192 {
2193 IMPROVE();
2194 return (0);
2195 }
2196
2197
2198 static __inline void
SET_IEEE80211_PERM_ADDR(struct ieee80211_hw * hw,uint8_t * addr)2199 SET_IEEE80211_PERM_ADDR (struct ieee80211_hw *hw, uint8_t *addr)
2200 {
2201
2202 ether_addr_copy(hw->wiphy->perm_addr, addr);
2203 }
2204
2205 static __inline void
ieee80211_report_low_ack(struct ieee80211_sta * sta,int x)2206 ieee80211_report_low_ack(struct ieee80211_sta *sta, int x)
2207 {
2208 TODO();
2209 }
2210
2211 static __inline void
ieee80211_tx_rate_update(struct ieee80211_hw * hw,struct ieee80211_sta * sta,struct ieee80211_tx_info * info)2212 ieee80211_tx_rate_update(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
2213 struct ieee80211_tx_info *info)
2214 {
2215 TODO();
2216 }
2217
2218 static __inline bool
ieee80211_txq_may_transmit(struct ieee80211_hw * hw,struct ieee80211_txq * txq)2219 ieee80211_txq_may_transmit(struct ieee80211_hw *hw, struct ieee80211_txq *txq)
2220 {
2221 TODO();
2222 return (false);
2223 }
2224
2225 static __inline void
ieee80211_radar_detected(struct ieee80211_hw * hw)2226 ieee80211_radar_detected(struct ieee80211_hw *hw)
2227 {
2228 TODO();
2229 }
2230
2231 static __inline void
ieee80211_sta_register_airtime(struct ieee80211_sta * sta,uint8_t tid,uint32_t duration,int x)2232 ieee80211_sta_register_airtime(struct ieee80211_sta *sta,
2233 uint8_t tid, uint32_t duration, int x)
2234 {
2235 TODO();
2236 }
2237
2238 static __inline void
ieee80211_beacon_set_cntdwn(struct ieee80211_vif * vif,u8 counter)2239 ieee80211_beacon_set_cntdwn(struct ieee80211_vif *vif, u8 counter)
2240 {
2241 TODO();
2242 }
2243
2244 static __inline int
ieee80211_beacon_update_cntdwn(struct ieee80211_vif * vif,uint32_t link_id)2245 ieee80211_beacon_update_cntdwn(struct ieee80211_vif *vif, uint32_t link_id)
2246 {
2247 TODO();
2248 return (-1);
2249 }
2250
2251 static __inline int
ieee80211_get_vht_max_nss(struct ieee80211_vht_cap * vht_cap,uint32_t chanwidth,int x,bool t,int nss)2252 ieee80211_get_vht_max_nss(struct ieee80211_vht_cap *vht_cap, uint32_t chanwidth,
2253 int x, bool t, int nss)
2254 {
2255 TODO();
2256 return (-1);
2257 }
2258
2259 static __inline bool
ieee80211_beacon_cntdwn_is_complete(struct ieee80211_vif * vif,uint32_t link_id)2260 ieee80211_beacon_cntdwn_is_complete(struct ieee80211_vif *vif, uint32_t link_id)
2261 {
2262 TODO();
2263 return (true);
2264 }
2265
2266 static __inline void
ieee80211_disconnect(struct ieee80211_vif * vif,bool _x)2267 ieee80211_disconnect(struct ieee80211_vif *vif, bool _x)
2268 {
2269 TODO();
2270 }
2271
2272 static __inline void
ieee80211_channel_switch_disconnect(struct ieee80211_vif * vif,bool _x)2273 ieee80211_channel_switch_disconnect(struct ieee80211_vif *vif, bool _x)
2274 {
2275 TODO();
2276 }
2277
2278 static __inline const struct ieee80211_sta_he_cap *
ieee80211_get_he_iftype_cap(const struct ieee80211_supported_band * band,enum nl80211_iftype type)2279 ieee80211_get_he_iftype_cap(const struct ieee80211_supported_band *band,
2280 enum nl80211_iftype type)
2281 {
2282 TODO();
2283 return (NULL);
2284 }
2285
2286 static __inline void
ieee80211_key_mic_failure(struct ieee80211_key_conf * key)2287 ieee80211_key_mic_failure(struct ieee80211_key_conf *key)
2288 {
2289 TODO();
2290 }
2291
2292 static __inline void
ieee80211_key_replay(struct ieee80211_key_conf * key)2293 ieee80211_key_replay(struct ieee80211_key_conf *key)
2294 {
2295 TODO();
2296 }
2297
2298 static __inline uint32_t
ieee80211_calc_rx_airtime(struct ieee80211_hw * hw,struct ieee80211_rx_status * rxstat,int len)2299 ieee80211_calc_rx_airtime(struct ieee80211_hw *hw,
2300 struct ieee80211_rx_status *rxstat, int len)
2301 {
2302 TODO();
2303 return (0);
2304 }
2305
2306 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)2307 ieee80211_get_tx_rates(struct ieee80211_vif *vif, struct ieee80211_sta *sta,
2308 struct sk_buff *skb, struct ieee80211_tx_rate *txrate, int nrates)
2309 {
2310 TODO();
2311 }
2312
2313 static __inline void
ieee80211_color_change_finish(struct ieee80211_vif * vif)2314 ieee80211_color_change_finish(struct ieee80211_vif *vif)
2315 {
2316 TODO();
2317 }
2318
2319 static __inline struct sk_buff *
ieee80211_get_fils_discovery_tmpl(struct ieee80211_hw * hw,struct ieee80211_vif * vif)2320 ieee80211_get_fils_discovery_tmpl(struct ieee80211_hw *hw,
2321 struct ieee80211_vif *vif)
2322 {
2323 TODO();
2324 return (NULL);
2325 }
2326
2327 static __inline struct sk_buff *
ieee80211_get_unsol_bcast_probe_resp_tmpl(struct ieee80211_hw * hw,struct ieee80211_vif * vif)2328 ieee80211_get_unsol_bcast_probe_resp_tmpl(struct ieee80211_hw *hw,
2329 struct ieee80211_vif *vif)
2330 {
2331 TODO();
2332 return (NULL);
2333 }
2334
2335 static __inline void
linuxkpi_ieee80211_send_bar(struct ieee80211_vif * vif,uint8_t * ra,uint16_t tid,uint16_t ssn)2336 linuxkpi_ieee80211_send_bar(struct ieee80211_vif *vif, uint8_t *ra, uint16_t tid,
2337 uint16_t ssn)
2338 {
2339 TODO();
2340 }
2341
2342 static __inline void
ieee80211_resume_disconnect(struct ieee80211_vif * vif)2343 ieee80211_resume_disconnect(struct ieee80211_vif *vif)
2344 {
2345 TODO();
2346 }
2347
2348 static __inline int
ieee80211_data_to_8023(struct sk_buff * skb,const uint8_t * addr,enum nl80211_iftype iftype)2349 ieee80211_data_to_8023(struct sk_buff *skb, const uint8_t *addr,
2350 enum nl80211_iftype iftype)
2351 {
2352 TODO();
2353 return (-1);
2354 }
2355
2356 static __inline void
ieee80211_get_tkip_p1k_iv(struct ieee80211_key_conf * key,uint32_t iv32,uint16_t * p1k)2357 ieee80211_get_tkip_p1k_iv(struct ieee80211_key_conf *key,
2358 uint32_t iv32, uint16_t *p1k)
2359 {
2360 TODO();
2361 }
2362
2363 static __inline struct ieee80211_key_conf *
ieee80211_gtk_rekey_add(struct ieee80211_vif * vif,struct ieee80211_key_conf * key)2364 ieee80211_gtk_rekey_add(struct ieee80211_vif *vif,
2365 struct ieee80211_key_conf *key)
2366 {
2367 TODO();
2368 return (NULL);
2369 }
2370
2371 static __inline void
ieee80211_gtk_rekey_notify(struct ieee80211_vif * vif,const uint8_t * bssid,const uint8_t * replay_ctr,gfp_t gfp)2372 ieee80211_gtk_rekey_notify(struct ieee80211_vif *vif, const uint8_t *bssid,
2373 const uint8_t *replay_ctr, gfp_t gfp)
2374 {
2375 TODO();
2376 }
2377
2378 static __inline void
ieee80211_remove_key(struct ieee80211_key_conf * key)2379 ieee80211_remove_key(struct ieee80211_key_conf *key)
2380 {
2381 TODO();
2382 }
2383
2384 static __inline void
ieee80211_set_key_rx_seq(struct ieee80211_key_conf * key,int tid,struct ieee80211_key_seq * seq)2385 ieee80211_set_key_rx_seq(struct ieee80211_key_conf *key, int tid,
2386 struct ieee80211_key_seq *seq)
2387 {
2388 TODO();
2389 }
2390
2391 static __inline void
ieee80211_report_wowlan_wakeup(struct ieee80211_vif * vif,struct cfg80211_wowlan_wakeup * wakeup,gfp_t gfp)2392 ieee80211_report_wowlan_wakeup(struct ieee80211_vif *vif,
2393 struct cfg80211_wowlan_wakeup *wakeup, gfp_t gfp)
2394 {
2395 TODO();
2396 }
2397
2398 static __inline void
ieee80211_obss_color_collision_notify(struct ieee80211_vif * vif,uint64_t obss_color_bitmap,gfp_t gfp)2399 ieee80211_obss_color_collision_notify(struct ieee80211_vif *vif,
2400 uint64_t obss_color_bitmap, gfp_t gfp)
2401 {
2402 TODO();
2403 }
2404
2405 static __inline void
ieee80211_refresh_tx_agg_session_timer(struct ieee80211_sta * sta,uint8_t tid)2406 ieee80211_refresh_tx_agg_session_timer(struct ieee80211_sta *sta,
2407 uint8_t tid)
2408 {
2409 TODO();
2410 }
2411
2412 static __inline struct ieee80211_ema_beacons *
ieee80211_beacon_get_template_ema_list(struct ieee80211_hw * hw,struct ieee80211_vif * vif,uint32_t link_id)2413 ieee80211_beacon_get_template_ema_list(struct ieee80211_hw *hw,
2414 struct ieee80211_vif *vif, uint32_t link_id)
2415 {
2416 TODO();
2417 return (NULL);
2418 }
2419
2420 static __inline void
ieee80211_beacon_free_ema_list(struct ieee80211_ema_beacons * bcns)2421 ieee80211_beacon_free_ema_list(struct ieee80211_ema_beacons *bcns)
2422 {
2423 TODO();
2424 }
2425
2426 static inline bool
ieee80211_vif_is_mld(const struct ieee80211_vif * vif)2427 ieee80211_vif_is_mld(const struct ieee80211_vif *vif)
2428 {
2429
2430 /* If valid_links is non-zero, the vif is an MLD. */
2431 return (vif->valid_links != 0);
2432 }
2433
2434 static __inline const struct ieee80211_sta_he_cap *
ieee80211_get_he_iftype_cap_vif(const struct ieee80211_supported_band * band,struct ieee80211_vif * vif)2435 ieee80211_get_he_iftype_cap_vif(const struct ieee80211_supported_band *band,
2436 struct ieee80211_vif *vif)
2437 {
2438 TODO();
2439 return (NULL);
2440 }
2441
2442 static __inline const struct ieee80211_sta_eht_cap *
ieee80211_get_eht_iftype_cap_vif(const struct ieee80211_supported_band * band,struct ieee80211_vif * vif)2443 ieee80211_get_eht_iftype_cap_vif(const struct ieee80211_supported_band *band,
2444 struct ieee80211_vif *vif)
2445 {
2446 TODO();
2447 return (NULL);
2448 }
2449
2450 static inline uint32_t
ieee80211_vif_usable_links(const struct ieee80211_vif * vif)2451 ieee80211_vif_usable_links(const struct ieee80211_vif *vif)
2452 {
2453 TODO();
2454 return (1);
2455 }
2456
2457 static inline bool
ieee80211_vif_link_active(const struct ieee80211_vif * vif,uint8_t link_id)2458 ieee80211_vif_link_active(const struct ieee80211_vif *vif, uint8_t link_id)
2459 {
2460 if (ieee80211_vif_is_mld(vif))
2461 return (vif->active_links & BIT(link_id));
2462 return (link_id == 0);
2463 }
2464
2465 static inline void
ieee80211_set_active_links_async(struct ieee80211_vif * vif,uint32_t new_active_links)2466 ieee80211_set_active_links_async(struct ieee80211_vif *vif,
2467 uint32_t new_active_links)
2468 {
2469 TODO();
2470 }
2471
2472 static inline int
ieee80211_set_active_links(struct ieee80211_vif * vif,uint32_t active_links)2473 ieee80211_set_active_links(struct ieee80211_vif *vif,
2474 uint32_t active_links)
2475 {
2476 TODO();
2477 return (-ENXIO);
2478 }
2479
2480 static inline void
ieee80211_cqm_beacon_loss_notify(struct ieee80211_vif * vif,gfp_t gfp __unused)2481 ieee80211_cqm_beacon_loss_notify(struct ieee80211_vif *vif, gfp_t gfp __unused)
2482 {
2483 IMPROVE("we notify user space by a vap state change eventually");
2484 linuxkpi_ieee80211_beacon_loss(vif);
2485 }
2486
2487 #define ieee80211_send_bar(_v, _r, _t, _s) \
2488 linuxkpi_ieee80211_send_bar(_v, _r, _t, _s)
2489
2490 /* -------------------------------------------------------------------------- */
2491
2492 int lkpi_80211_update_chandef(struct ieee80211_hw *,
2493 struct ieee80211_chanctx_conf *);
2494
2495 static inline int
ieee80211_emulate_add_chanctx(struct ieee80211_hw * hw,struct ieee80211_chanctx_conf * chanctx_conf)2496 ieee80211_emulate_add_chanctx(struct ieee80211_hw *hw,
2497 struct ieee80211_chanctx_conf *chanctx_conf)
2498 {
2499 int error;
2500
2501 hw->conf.radar_enabled = chanctx_conf->radar_enabled;
2502 error = lkpi_80211_update_chandef(hw, chanctx_conf);
2503 return (error);
2504 }
2505
2506 static inline void
ieee80211_emulate_remove_chanctx(struct ieee80211_hw * hw,struct ieee80211_chanctx_conf * chanctx_conf __unused)2507 ieee80211_emulate_remove_chanctx(struct ieee80211_hw *hw,
2508 struct ieee80211_chanctx_conf *chanctx_conf __unused)
2509 {
2510 hw->conf.radar_enabled = false;
2511 lkpi_80211_update_chandef(hw, NULL);
2512 }
2513
2514 static inline void
ieee80211_emulate_change_chanctx(struct ieee80211_hw * hw,struct ieee80211_chanctx_conf * chanctx_conf,uint32_t changed __unused)2515 ieee80211_emulate_change_chanctx(struct ieee80211_hw *hw,
2516 struct ieee80211_chanctx_conf *chanctx_conf, uint32_t changed __unused)
2517 {
2518 hw->conf.radar_enabled = chanctx_conf->radar_enabled;
2519 lkpi_80211_update_chandef(hw, chanctx_conf);
2520 }
2521
2522 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)2523 ieee80211_emulate_switch_vif_chanctx(struct ieee80211_hw *hw,
2524 struct ieee80211_vif_chanctx_switch *vifs, int n_vifs,
2525 enum ieee80211_chanctx_switch_mode mode __unused)
2526 {
2527 struct ieee80211_chanctx_conf *chanctx_conf;
2528 int error;
2529
2530 /* Sanity check. */
2531 if (n_vifs <= 0)
2532 return (-EINVAL);
2533 if (vifs == NULL || vifs[0].new_ctx == NULL)
2534 return (-EINVAL);
2535
2536 /*
2537 * What to do if n_vifs > 1?
2538 * Does that make sense for drivers not supporting chanctx?
2539 */
2540 hw->conf.radar_enabled = vifs[0].new_ctx->radar_enabled;
2541 chanctx_conf = vifs[0].new_ctx;
2542 error = lkpi_80211_update_chandef(hw, chanctx_conf);
2543 return (error);
2544 }
2545
2546 /* -------------------------------------------------------------------------- */
2547
2548 #endif /* _LINUXKPI_NET_MAC80211_H */
2549