1 /*-
2 * Copyright (c) 2020-2025 The FreeBSD Foundation
3 * Copyright (c) 2021-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_CFG80211_H
31 #define _LINUXKPI_NET_CFG80211_H
32
33 #include <linux/types.h>
34 #include <linux/nl80211.h>
35 #include <linux/ieee80211.h>
36 #include <linux/mutex.h>
37 #include <linux/if_ether.h>
38 #include <linux/ethtool.h>
39 #include <linux/debugfs.h>
40 #include <linux/device.h>
41 #include <linux/netdevice.h>
42 #include <linux/random.h>
43 #include <linux/skbuff.h>
44 #include <linux/timer.h>
45 #include <linux/workqueue.h>
46 #include <net/regulatory.h>
47
48 #include <net80211/ieee80211.h>
49
50 /* linux_80211.c */
51 extern int linuxkpi_debug_80211;
52 #ifndef D80211_TODO
53 #define D80211_TODO 0x1
54 #endif
55 #ifndef D80211_IMPROVE
56 #define D80211_IMPROVE 0x2
57 #endif
58 #define TODO(fmt, ...) if (linuxkpi_debug_80211 & D80211_TODO) \
59 printf("%s:%d: XXX LKPI80211 TODO " fmt "\n", __func__, __LINE__, ##__VA_ARGS__)
60 #define IMPROVE(fmt, ...) if (linuxkpi_debug_80211 & D80211_IMPROVE) \
61 printf("%s:%d: XXX LKPI80211 IMPROVE " fmt "\n", __func__, __LINE__, ##__VA_ARGS__)
62
63 enum rfkill_hard_block_reasons {
64 RFKILL_HARD_BLOCK_NOT_OWNER = BIT(0),
65 };
66
67 #define WIPHY_PARAM_FRAG_THRESHOLD __LINE__ /* TODO FIXME brcmfmac */
68 #define WIPHY_PARAM_RETRY_LONG __LINE__ /* TODO FIXME brcmfmac */
69 #define WIPHY_PARAM_RETRY_SHORT __LINE__ /* TODO FIXME brcmfmac */
70 #define WIPHY_PARAM_RTS_THRESHOLD __LINE__ /* TODO FIXME brcmfmac */
71
72 #define CFG80211_SIGNAL_TYPE_MBM __LINE__ /* TODO FIXME brcmfmac */
73
74 #define UPDATE_ASSOC_IES 1
75
76 #define IEEE80211_MAX_CHAINS 4 /* net80211: IEEE80211_MAX_CHAINS copied */
77
78 enum cfg80211_rate_info_flags {
79 RATE_INFO_FLAGS_MCS = BIT(0),
80 RATE_INFO_FLAGS_VHT_MCS = BIT(1),
81 RATE_INFO_FLAGS_SHORT_GI = BIT(2),
82 RATE_INFO_FLAGS_HE_MCS = BIT(4),
83 RATE_INFO_FLAGS_EHT_MCS = BIT(7),
84 /* Max 8 bits as used in struct rate_info. */
85 };
86
87 #define CFG80211_RATE_INFO_FLAGS_BITS \
88 "\20\1MCS\2VHT_MCS\3SGI\5HE_MCS\10EHT_MCS"
89
90 extern const uint8_t rfc1042_header[6];
91 extern const uint8_t bridge_tunnel_header[6];
92
93 enum ieee80211_privacy {
94 IEEE80211_PRIVACY_ANY,
95 };
96
97 enum ieee80211_bss_type {
98 IEEE80211_BSS_TYPE_ANY,
99 };
100
101 enum cfg80211_bss_frame_type {
102 CFG80211_BSS_FTYPE_UNKNOWN,
103 CFG80211_BSS_FTYPE_BEACON,
104 CFG80211_BSS_FTYPE_PRESP,
105 };
106
107 enum ieee80211_channel_flags {
108 IEEE80211_CHAN_DISABLED = BIT(0),
109 IEEE80211_CHAN_INDOOR_ONLY = BIT(1),
110 IEEE80211_CHAN_IR_CONCURRENT = BIT(2),
111 IEEE80211_CHAN_RADAR = BIT(3),
112 IEEE80211_CHAN_NO_IR = BIT(4),
113 IEEE80211_CHAN_NO_HT40MINUS = BIT(5),
114 IEEE80211_CHAN_NO_HT40PLUS = BIT(6),
115 IEEE80211_CHAN_NO_80MHZ = BIT(7),
116 IEEE80211_CHAN_NO_160MHZ = BIT(8),
117 IEEE80211_CHAN_NO_OFDM = BIT(9),
118 IEEE80211_CHAN_NO_6GHZ_VLP_CLIENT = BIT(10),
119 IEEE80211_CHAN_NO_6GHZ_AFC_CLIENT = BIT(11),
120 IEEE80211_CHAN_PSD = BIT(12),
121 IEEE80211_CHAN_ALLOW_6GHZ_VLP_AP = BIT(13),
122 IEEE80211_CHAN_CAN_MONITOR = BIT(14),
123 };
124 #define IEEE80211_CHAN_NO_HT40 (IEEE80211_CHAN_NO_HT40MINUS|IEEE80211_CHAN_NO_HT40PLUS)
125
126 struct ieee80211_txrx_stypes {
127 uint16_t tx;
128 uint16_t rx;
129 };
130
131 /*
132 * net80211 has an ieee80211_channel as well; we use the linuxkpi_ version
133 * interally in LinuxKPI and re-define ieee80211_channel for the drivers
134 * at the end of the file.
135 */
136 struct linuxkpi_ieee80211_channel {
137 uint32_t center_freq;
138 uint16_t hw_value;
139 enum ieee80211_channel_flags flags;
140 enum nl80211_band band;
141 bool beacon_found;
142 enum nl80211_dfs_state dfs_state;
143 unsigned int dfs_cac_ms;
144 int max_antenna_gain;
145 int max_power;
146 int max_reg_power;
147 uint32_t orig_flags;
148 int orig_mpwr;
149 };
150
151 struct cfg80211_bitrate_mask {
152 /* TODO FIXME */
153 struct {
154 uint32_t legacy;
155 uint8_t ht_mcs[IEEE80211_HT_MCS_MASK_LEN];
156 uint16_t vht_mcs[8];
157 uint16_t he_mcs[8];
158 enum nl80211_txrate_gi gi;
159 enum nl80211_he_gi he_gi;
160 uint8_t he_ltf; /* XXX enum? */
161 } control[NUM_NL80211_BANDS];
162 };
163
164 enum rate_info_bw {
165 RATE_INFO_BW_20 = 0,
166 RATE_INFO_BW_5,
167 RATE_INFO_BW_10,
168 RATE_INFO_BW_40,
169 RATE_INFO_BW_80,
170 RATE_INFO_BW_160,
171 RATE_INFO_BW_HE_RU,
172 RATE_INFO_BW_320,
173 RATE_INFO_BW_EHT_RU,
174 };
175
176 struct rate_info {
177 uint8_t flags; /* enum cfg80211_rate_info_flags */
178 uint8_t bw; /* enum rate_info_bw */
179 uint16_t legacy;
180 uint8_t mcs;
181 uint8_t nss;
182 uint8_t he_dcm;
183 uint8_t he_gi;
184 uint8_t he_ru_alloc;
185 uint8_t eht_gi;
186 };
187
188 struct ieee80211_rate {
189 uint32_t flags; /* enum ieee80211_rate_flags */
190 uint16_t bitrate;
191 uint16_t hw_value;
192 uint16_t hw_value_short;
193 };
194
195 struct ieee80211_sta_ht_cap {
196 bool ht_supported;
197 uint8_t ampdu_density;
198 uint8_t ampdu_factor;
199 uint16_t cap;
200 struct ieee80211_mcs_info mcs;
201 };
202
203 /* XXX net80211 calls these IEEE80211_VHTCAP_* */
204 #define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_3895 0x00000000 /* IEEE80211_VHTCAP_MAX_MPDU_LENGTH_3895 */
205 #define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_7991 0x00000001 /* IEEE80211_VHTCAP_MAX_MPDU_LENGTH_7991 */
206 #define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 0x00000002 /* IEEE80211_VHTCAP_MAX_MPDU_LENGTH_11454 */
207 #define IEEE80211_VHT_CAP_MAX_MPDU_MASK 0x00000003 /* IEEE80211_VHTCAP_MAX_MPDU_MASK */
208
209 #define IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ (IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_160MHZ << IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_MASK_S)
210 #define IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ (IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_160_80P80MHZ << IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_MASK_S)
211 #define IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_MASK
212
213 #define IEEE80211_VHT_CAP_RXLDPC 0x00000010 /* IEEE80211_VHTCAP_RXLDPC */
214
215 #define IEEE80211_VHT_CAP_SHORT_GI_80 0x00000020 /* IEEE80211_VHTCAP_SHORT_GI_80 */
216 #define IEEE80211_VHT_CAP_SHORT_GI_160 0x00000040 /* IEEE80211_VHTCAP_SHORT_GI_160 */
217
218 #define IEEE80211_VHT_CAP_TXSTBC 0x00000080 /* IEEE80211_VHTCAP_TXSTBC */
219
220 #define IEEE80211_VHT_CAP_RXSTBC_1 0x00000100 /* IEEE80211_VHTCAP_RXSTBC_1 */
221 #define IEEE80211_VHT_CAP_RXSTBC_MASK 0x00000700 /* IEEE80211_VHTCAP_RXSTBC_MASK */
222
223 #define IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE 0x00000800 /* IEEE80211_VHTCAP_SU_BEAMFORMER_CAPABLE */
224
225 #define IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE 0x00001000 /* IEEE80211_VHTCAP_SU_BEAMFORMEE_CAPABLE */
226
227 #define IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE 0x00080000 /* IEEE80211_VHTCAP_MU_BEAMFORMER_CAPABLE */
228
229 #define IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE 0x00100000 /* IEEE80211_VHTCAP_MU_BEAMFORMEE_CAPABLE */
230
231 #define IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT 13 /* IEEE80211_VHTCAP_BEAMFORMEE_STS_SHIFT */
232 #define IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK (7 << IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT) /* IEEE80211_VHTCAP_BEAMFORMEE_STS_MASK */
233
234 #define IEEE80211_VHT_CAP_HTC_VHT 0x00400000 /* IEEE80211_VHTCAP_HTC_VHT */
235
236 #define IEEE80211_VHT_CAP_RX_ANTENNA_PATTERN 0x10000000 /* IEEE80211_VHTCAP_RX_ANTENNA_PATTERN */
237 #define IEEE80211_VHT_CAP_TX_ANTENNA_PATTERN 0x20000000 /* IEEE80211_VHTCAP_TX_ANTENNA_PATTERN */
238
239 #define IEEE80211_VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB 0x0c000000 /* IEEE80211_VHTCAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB */
240
241 #define IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_SHIFT 16 /* IEEE80211_VHTCAP_SOUNDING_DIMENSIONS_SHIFT */
242 #define IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MASK \
243 (7 << IEEE80211_VHTCAP_SOUNDING_DIMENSIONS_SHIFT) /* IEEE80211_VHTCAP_SOUNDING_DIMENSIONS_MASK */
244
245 #define IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT 23 /* IEEE80211_VHTCAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT */
246 #define IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK \
247 (7 << IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT) /* IEEE80211_VHTCAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK */
248
249 #define IEEE80211_VHT_CAP_EXT_NSS_BW_MASK IEEE80211_VHTCAP_EXT_NSS_BW
250 #define IEEE80211_VHT_CAP_EXT_NSS_BW_SHIFT IEEE80211_VHTCAP_EXT_NSS_BW_S
251
252 struct ieee80211_sta_vht_cap {
253 /* TODO FIXME */
254 bool vht_supported;
255 uint32_t cap;
256 struct ieee80211_vht_mcs_info vht_mcs;
257 };
258
259 enum ieee80211_vht_opmode {
260 IEEE80211_OPMODE_NOTIF_RX_NSS_SHIFT = 4,
261 };
262
263 struct cfg80211_bss_ies {
264 uint8_t *data;
265 size_t len;
266 };
267
268 struct cfg80211_bss {
269 /* XXX TODO */
270 struct cfg80211_bss_ies *ies;
271 struct cfg80211_bss_ies *beacon_ies;
272 uint64_t ts_boottime;
273 int32_t signal;
274 };
275
276 struct cfg80211_connect_resp_params {
277 /* XXX TODO */
278 uint8_t *bssid;
279 const uint8_t *req_ie;
280 const uint8_t *resp_ie;
281 uint32_t req_ie_len;
282 uint32_t resp_ie_len;
283 int status;
284 struct {
285 const uint8_t *addr;
286 const uint8_t *bssid;
287 struct cfg80211_bss *bss;
288 uint16_t status;
289 } links[IEEE80211_MLD_MAX_NUM_LINKS];
290 };
291
292 struct cfg80211_inform_bss {
293 /* XXX TODO */
294 int boottime_ns, scan_width, signal;
295 struct linuxkpi_ieee80211_channel *chan;
296 };
297
298 struct cfg80211_roam_info {
299 /* XXX TODO */
300 uint8_t *bssid;
301 const uint8_t *req_ie;
302 const uint8_t *resp_ie;
303 uint32_t req_ie_len;
304 uint32_t resp_ie_len;
305 struct linuxkpi_ieee80211_channel *channel;
306 struct {
307 const uint8_t *addr;
308 const uint8_t *bssid;
309 struct cfg80211_bss *bss;
310 struct linuxkpi_ieee80211_channel *channel;
311 } links[IEEE80211_MLD_MAX_NUM_LINKS];
312 };
313
314 struct cfg80211_chan_def {
315 /* XXX TODO */
316 struct linuxkpi_ieee80211_channel *chan;
317 enum nl80211_chan_width width;
318 uint32_t center_freq1;
319 uint32_t center_freq2;
320 uint16_t punctured;
321 };
322
323 struct cfg80211_ftm_responder_stats {
324 /* XXX TODO */
325 int asap_num, failed_num, filled, non_asap_num, out_of_window_triggers_num, partial_num, reschedule_requests_num, success_num, total_duration_ms, unknown_triggers_num;
326 };
327
328 struct cfg80211_pmsr_capabilities {
329 /* XXX TODO */
330 int max_peers, randomize_mac_addr, report_ap_tsf;
331 struct {
332 int asap, bandwidths, max_bursts_exponent, max_ftms_per_burst, non_asap, non_trigger_based, preambles, request_civicloc, request_lci, supported, trigger_based;
333 } ftm;
334 };
335
336 struct cfg80211_pmsr_ftm_request {
337 /* XXX TODO */
338 int asap, burst_period, ftmr_retries, ftms_per_burst, non_trigger_based, num_bursts_exp, request_civicloc, request_lci, trigger_based;
339 uint8_t bss_color;
340 bool lmr_feedback;
341 };
342
343 struct cfg80211_pmsr_request_peer {
344 /* XXX TODO */
345 struct cfg80211_chan_def chandef;
346 struct cfg80211_pmsr_ftm_request ftm;
347 uint8_t addr[ETH_ALEN];
348 int report_ap_tsf;
349 };
350
351 struct cfg80211_pmsr_request {
352 /* XXX TODO */
353 int cookie, n_peers, timeout;
354 uint8_t mac_addr[ETH_ALEN], mac_addr_mask[ETH_ALEN];
355 struct cfg80211_pmsr_request_peer peers[];
356 };
357
358 struct cfg80211_pmsr_ftm_result {
359 /* XXX TODO */
360 int burst_index, busy_retry_time, failure_reason;
361 int num_ftmr_successes, rssi_avg, rssi_avg_valid, rssi_spread, rssi_spread_valid, rtt_avg, rtt_avg_valid, rtt_spread, rtt_spread_valid, rtt_variance, rtt_variance_valid;
362 uint8_t *lci;
363 uint8_t *civicloc;
364 int lci_len;
365 int civicloc_len;
366 };
367
368 struct cfg80211_pmsr_result {
369 /* XXX TODO */
370 int ap_tsf, ap_tsf_valid, final, host_time, status, type;
371 uint8_t addr[ETH_ALEN];
372 struct cfg80211_pmsr_ftm_result ftm;
373 };
374
375 struct cfg80211_sar_freq_ranges {
376 uint32_t start_freq;
377 uint32_t end_freq;
378 };
379
380 struct cfg80211_sar_sub_specs {
381 uint32_t freq_range_index;
382 int power;
383 };
384
385 struct cfg80211_sar_specs {
386 enum nl80211_sar_type type;
387 uint32_t num_sub_specs;
388 struct cfg80211_sar_sub_specs sub_specs[];
389 };
390
391 struct cfg80211_sar_capa {
392 enum nl80211_sar_type type;
393 uint32_t num_freq_ranges;
394 const struct cfg80211_sar_freq_ranges *freq_ranges;
395 };
396
397 struct cfg80211_ssid {
398 int ssid_len;
399 uint8_t ssid[IEEE80211_MAX_SSID_LEN];
400 };
401
402 struct cfg80211_scan_6ghz_params {
403 /* XXX TODO */
404 uint8_t *bssid;
405 int channel_idx, psc_no_listen, short_ssid, short_ssid_valid, unsolicited_probe, psd_20;
406 };
407
408 struct cfg80211_match_set {
409 uint8_t bssid[ETH_ALEN];
410 struct cfg80211_ssid ssid;
411 int rssi_thold;
412 };
413
414 struct cfg80211_scan_request {
415 /* XXX TODO */
416 bool no_cck;
417 bool scan_6ghz;
418 bool duration_mandatory;
419 bool first_part;
420 int8_t tsf_report_link_id;
421 uint16_t duration;
422 uint32_t flags;
423 struct wireless_dev *wdev;
424 struct wiphy *wiphy;
425 uint64_t scan_start;
426 uint32_t rates[NUM_NL80211_BANDS];
427 int ie_len;
428 uint8_t *ie;
429 uint8_t mac_addr[ETH_ALEN], mac_addr_mask[ETH_ALEN];
430 uint8_t bssid[ETH_ALEN];
431 int n_ssids;
432 int n_6ghz_params;
433 int n_channels;
434 struct cfg80211_ssid *ssids;
435 struct cfg80211_scan_6ghz_params *scan_6ghz_params;
436 struct linuxkpi_ieee80211_channel *channels[0];
437 };
438
439 struct cfg80211_sched_scan_plan {
440 /* XXX TODO */
441 int interval, iterations;
442 };
443
444 struct cfg80211_sched_scan_request {
445 /* XXX TODO */
446 int delay, flags;
447 uint8_t mac_addr[ETH_ALEN], mac_addr_mask[ETH_ALEN];
448 uint64_t reqid;
449 int n_match_sets;
450 int n_scan_plans;
451 int n_ssids;
452 int n_channels;
453 int ie_len;
454 uint8_t *ie;
455 struct cfg80211_match_set *match_sets;
456 struct cfg80211_sched_scan_plan *scan_plans;
457 struct cfg80211_ssid *ssids;
458 struct linuxkpi_ieee80211_channel *channels[0];
459 };
460
461 struct cfg80211_scan_info {
462 uint64_t scan_start_tsf;
463 uint8_t tsf_bssid[ETH_ALEN];
464 bool aborted;
465 };
466
467 struct cfg80211_beacon_data {
468 /* XXX TODO */
469 const uint8_t *head;
470 const uint8_t *tail;
471 uint32_t head_len;
472 uint32_t tail_len;
473 const uint8_t *proberesp_ies;
474 const uint8_t *assocresp_ies;
475 uint32_t proberesp_ies_len;
476 uint32_t assocresp_ies_len;
477 };
478
479 struct cfg80211_ap_update {
480 /* XXX TODO */
481 struct cfg80211_beacon_data beacon;
482 };
483
484 struct cfg80211_crypto_settings {
485 /* XXX TODO */
486 enum nl80211_wpa_versions wpa_versions;
487 uint32_t cipher_group; /* WLAN_CIPHER_SUITE_* */
488 uint32_t *akm_suites;
489 uint32_t *ciphers_pairwise;
490 const uint8_t *sae_pwd;
491 const uint8_t *psk;
492 int n_akm_suites;
493 int n_ciphers_pairwise;
494 int sae_pwd_len;
495 };
496
497 struct cfg80211_ap_settings {
498 /* XXX TODO */
499 int auth_type, beacon_interval, dtim_period, hidden_ssid, inactivity_timeout;
500 const uint8_t *ssid;
501 size_t ssid_len;
502 struct cfg80211_beacon_data beacon;
503 struct cfg80211_chan_def chandef;
504 struct cfg80211_crypto_settings crypto;
505 };
506
507 struct cfg80211_bss_selection {
508 /* XXX TODO */
509 enum nl80211_bss_select_attr behaviour;
510 union {
511 enum nl80211_band band_pref;
512 struct {
513 enum nl80211_band band;
514 uint8_t delta;
515 } adjust;
516 } param;
517 };
518
519 struct cfg80211_connect_params {
520 /* XXX TODO */
521 struct linuxkpi_ieee80211_channel *channel;
522 struct linuxkpi_ieee80211_channel *channel_hint;
523 uint8_t *bssid;
524 uint8_t *bssid_hint;
525 const uint8_t *ie;
526 const uint8_t *ssid;
527 uint32_t ie_len;
528 uint32_t ssid_len;
529 const void *key;
530 uint32_t key_len;
531 int auth_type, key_idx, privacy, want_1x;
532 struct cfg80211_bss_selection bss_select;
533 struct cfg80211_crypto_settings crypto;
534 };
535
536 enum bss_param_flags { /* Used as bitflags. XXX FIXME values? */
537 BSS_PARAM_FLAGS_CTS_PROT = 0x01,
538 BSS_PARAM_FLAGS_SHORT_PREAMBLE = 0x02,
539 BSS_PARAM_FLAGS_SHORT_SLOT_TIME = 0x04,
540 };
541
542 struct cfg80211_ibss_params {
543 /* XXX TODO */
544 int basic_rates, beacon_interval;
545 int channel_fixed, ie, ie_len, privacy;
546 int dtim_period;
547 uint8_t *ssid;
548 uint8_t *bssid;
549 int ssid_len;
550 struct cfg80211_chan_def chandef;
551 enum bss_param_flags flags;
552 };
553
554 struct cfg80211_mgmt_tx_params {
555 /* XXX TODO */
556 struct linuxkpi_ieee80211_channel *chan;
557 const uint8_t *buf;
558 size_t len;
559 int wait;
560 };
561
562 struct cfg80211_external_auth_params {
563 uint8_t bssid[ETH_ALEN];
564 uint16_t status;
565 enum nl80211_external_auth_action action;
566 unsigned int key_mgmt_suite;
567 struct cfg80211_ssid ssid;
568 };
569
570 struct cfg80211_pmk_conf {
571 /* XXX TODO */
572 const uint8_t *pmk;
573 uint8_t pmk_len;
574 };
575
576 struct cfg80211_pmksa {
577 /* XXX TODO */
578 const uint8_t *bssid;
579 const uint8_t *pmkid;
580 const uint8_t *ssid;
581 size_t ssid_len;
582 };
583
584 struct station_del_parameters {
585 /* XXX TODO */
586 const uint8_t *mac;
587 uint32_t reason_code; /* elsewhere uint16_t? */
588 };
589
590 struct station_info {
591 uint64_t filled; /* enum nl80211_sta_info */
592 uint32_t connected_time;
593 uint32_t inactive_time;
594
595 uint64_t rx_bytes;
596 uint32_t rx_packets;
597 uint32_t rx_dropped_misc;
598
599 uint64_t rx_duration;
600 uint32_t rx_beacon;
601 uint8_t rx_beacon_signal_avg;
602
603 int8_t signal;
604 int8_t signal_avg;
605 int8_t ack_signal;
606 int8_t avg_ack_signal;
607
608 /* gap */
609 int generation;
610
611 uint64_t tx_bytes;
612 uint32_t tx_packets;
613 uint32_t tx_failed;
614 uint64_t tx_duration;
615 uint32_t tx_retries;
616
617 int chains;
618 uint8_t chain_signal[IEEE80211_MAX_CHAINS];
619 uint8_t chain_signal_avg[IEEE80211_MAX_CHAINS];
620
621 uint8_t *assoc_req_ies;
622 size_t assoc_req_ies_len;
623
624 struct rate_info rxrate;
625 struct rate_info txrate;
626 struct cfg80211_ibss_params bss_param;
627 struct nl80211_sta_flag_update sta_flags;
628 };
629
630 struct station_parameters {
631 /* XXX TODO */
632 int sta_flags_mask, sta_flags_set;
633 };
634
635 struct key_params {
636 /* XXX TODO */
637 const uint8_t *key;
638 const uint8_t *seq;
639 int key_len;
640 int seq_len;
641 uint32_t cipher; /* WLAN_CIPHER_SUITE_* */
642 };
643
644 struct mgmt_frame_regs {
645 /* XXX TODO */
646 int interface_stypes;
647 };
648
649 struct vif_params {
650 /* XXX TODO */
651 uint8_t macaddr[ETH_ALEN];
652 };
653
654 /* That the world needs so many different structs for this is amazing. */
655 struct mac_address {
656 uint8_t addr[ETH_ALEN];
657 };
658
659 struct ieee80211_reg_rule {
660 /* TODO FIXME */
661 uint32_t flags;
662 int dfs_cac_ms;
663 struct freq_range {
664 int start_freq_khz;
665 int end_freq_khz;
666 int max_bandwidth_khz;
667 } freq_range;
668 struct power_rule {
669 int max_antenna_gain;
670 int max_eirp;
671 } power_rule;
672 };
673
674 struct linuxkpi_ieee80211_regdomain {
675 /* TODO FIXME */
676 uint8_t alpha2[2];
677 int dfs_region;
678 int n_reg_rules;
679 struct ieee80211_reg_rule reg_rules[];
680 };
681
682 #define IEEE80211_EHT_MAC_CAP0_EPCS_PRIO_ACCESS 0x01
683 #define IEEE80211_EHT_MAC_CAP0_MAX_MPDU_LEN_11454 0x02
684 #define IEEE80211_EHT_MAC_CAP0_MAX_MPDU_LEN_MASK 0x03
685 #define IEEE80211_EHT_MAC_CAP0_OM_CONTROL 0x04
686 #define IEEE80211_EHT_MAC_CAP0_TRIG_TXOP_SHARING_MODE1 0x05
687 #define IEEE80211_EHT_MAC_CAP0_TRIG_TXOP_SHARING_MODE2 0x06
688 #define IEEE80211_EHT_MAC_CAP0_MAX_MPDU_LEN_7991 0x07
689 #define IEEE80211_EHT_MAC_CAP0_SCS_TRAFFIC_DESC 0x08
690
691 #define IEEE80211_EHT_MAC_CAP1_MAX_AMPDU_LEN_MASK 0x01
692
693 #define IEEE80211_EHT_MCS_NSS_RX 0x01
694 #define IEEE80211_EHT_MCS_NSS_TX 0x02
695
696 #define IEEE80211_EHT_PHY_CAP0_242_TONE_RU_GT20MHZ 0x01
697 #define IEEE80211_EHT_PHY_CAP0_320MHZ_IN_6GHZ 0x02
698 #define IEEE80211_EHT_PHY_CAP0_BEAMFORMEE_SS_80MHZ_MASK 0x03
699 #define IEEE80211_EHT_PHY_CAP0_NDP_4_EHT_LFT_32_GI 0x04
700 #define IEEE80211_EHT_PHY_CAP0_PARTIAL_BW_UL_MU_MIMO 0x05
701 #define IEEE80211_EHT_PHY_CAP0_SU_BEAMFORMEE 0x06
702 #define IEEE80211_EHT_PHY_CAP0_SU_BEAMFORMER 0x07
703
704 #define IEEE80211_EHT_PHY_CAP1_BEAMFORMEE_SS_160MHZ_MASK 0x01
705 #define IEEE80211_EHT_PHY_CAP1_BEAMFORMEE_SS_320MHZ_MASK 0x02
706 #define IEEE80211_EHT_PHY_CAP1_BEAMFORMEE_SS_80MHZ_MASK 0x03
707
708 #define IEEE80211_EHT_PHY_CAP2_SOUNDING_DIM_80MHZ_MASK 0x01
709 #define IEEE80211_EHT_PHY_CAP2_SOUNDING_DIM_160MHZ_MASK 0x02
710 #define IEEE80211_EHT_PHY_CAP2_SOUNDING_DIM_320MHZ_MASK 0x03
711
712 #define IEEE80211_EHT_PHY_CAP3_CODEBOOK_4_2_SU_FDBK 0x01
713 #define IEEE80211_EHT_PHY_CAP3_CODEBOOK_7_5_MU_FDBK 0x02
714 #define IEEE80211_EHT_PHY_CAP3_NG_16_MU_FEEDBACK 0x03
715 #define IEEE80211_EHT_PHY_CAP3_NG_16_SU_FEEDBACK 0x04
716 #define IEEE80211_EHT_PHY_CAP3_TRIG_CQI_FDBK 0x05
717 #define IEEE80211_EHT_PHY_CAP3_TRIG_MU_BF_PART_BW_FDBK 0x06
718 #define IEEE80211_EHT_PHY_CAP3_TRIG_SU_BF_FDBK 0x07
719 #define IEEE80211_EHT_PHY_CAP3_SOUNDING_DIM_320MHZ_MASK 0x08
720
721 #define IEEE80211_EHT_PHY_CAP4_EHT_MU_PPDU_4_EHT_LTF_08_GI 0x01
722 #define IEEE80211_EHT_PHY_CAP4_PART_BW_DL_MU_MIMO 0x02
723 #define IEEE80211_EHT_PHY_CAP4_POWER_BOOST_FACT_SUPP 0x03
724 #define IEEE80211_EHT_PHY_CAP4_MAX_NC_MASK 0x04
725
726 #define IEEE80211_EHT_PHY_CAP5_COMMON_NOMINAL_PKT_PAD_0US 0x01
727 #define IEEE80211_EHT_PHY_CAP5_COMMON_NOMINAL_PKT_PAD_16US 0x02
728 #define IEEE80211_EHT_PHY_CAP5_COMMON_NOMINAL_PKT_PAD_20US 0x03
729 #define IEEE80211_EHT_PHY_CAP5_COMMON_NOMINAL_PKT_PAD_8US 0x04
730 #define IEEE80211_EHT_PHY_CAP5_COMMON_NOMINAL_PKT_PAD_MASK 0x05
731 #define IEEE80211_EHT_PHY_CAP5_NON_TRIG_CQI_FEEDBACK 0x06
732 #define IEEE80211_EHT_PHY_CAP5_PPE_THRESHOLD_PRESENT 0x07
733 #define IEEE80211_EHT_PHY_CAP5_RX_LESS_242_TONE_RU_SUPP 0x08
734 #define IEEE80211_EHT_PHY_CAP5_TX_LESS_242_TONE_RU_SUPP 0x09
735 #define IEEE80211_EHT_PHY_CAP5_MAX_NUM_SUPP_EHT_LTF_MASK 0x0a
736 #define IEEE80211_EHT_PHY_CAP5_SUPP_EXTRA_EHT_LTF 0x0b
737
738 #define IEEE80211_EHT_PHY_CAP6_EHT_DUP_6GHZ_SUPP 0x01
739 #define IEEE80211_EHT_PHY_CAP6_MCS15_SUPP_MASK 0x02
740 #define IEEE80211_EHT_PHY_CAP6_MAX_NUM_SUPP_EHT_LTF_MASK 0x03
741
742 #define IEEE80211_EHT_PHY_CAP7_MU_BEAMFORMER_80MHZ 0x01
743 #define IEEE80211_EHT_PHY_CAP7_MU_BEAMFORMER_160MHZ 0x02
744 #define IEEE80211_EHT_PHY_CAP7_MU_BEAMFORMER_320MHZ 0x03
745 #define IEEE80211_EHT_PHY_CAP7_NON_OFDMA_UL_MU_MIMO_80MHZ 0x04
746 #define IEEE80211_EHT_PHY_CAP7_NON_OFDMA_UL_MU_MIMO_160MHZ 0x05
747 #define IEEE80211_EHT_PHY_CAP7_NON_OFDMA_UL_MU_MIMO_320MHZ 0x06
748
749 #define IEEE80211_EHT_PHY_CAP8_RX_1024QAM_WIDER_BW_DL_OFDMA 0x01
750 #define IEEE80211_EHT_PHY_CAP8_RX_4096QAM_WIDER_BW_DL_OFDMA 0x02
751
752 #define IEEE80211_EHT_PPE_THRES_INFO_HEADER_SIZE 0x01
753 #define IEEE80211_EHT_PPE_THRES_NSS_MASK 0x02
754 #define IEEE80211_EHT_PPE_THRES_RU_INDEX_BITMASK_MASK 0x03
755 #define IEEE80211_EHT_PPE_THRES_INFO_PPET_SIZE 0x04
756
757 #define IEEE80211_EML_CAP_EMLSR_SUPP 0x01
758 #define IEEE80211_EML_CAP_TRANSITION_TIMEOUT 0x02
759 #define IEEE80211_EML_CAP_TRANSITION_TIMEOUT_128TU 0x04
760 #define IEEE80211_EML_CAP_EMLSR_PADDING_DELAY 0x08
761 #define IEEE80211_EML_CAP_EMLSR_PADDING_DELAY_32US 0x10
762 #define IEEE80211_EML_CAP_EMLSR_PADDING_DELAY_256US 0x10
763 #define IEEE80211_EML_CAP_EMLSR_TRANSITION_DELAY 0x20
764 #define IEEE80211_EML_CAP_EMLSR_TRANSITION_DELAY_64US 0x40
765 #define IEEE80211_EML_CAP_EMLSR_TRANSITION_DELAY_256US 0x40
766
767 #define VENDOR_CMD_RAW_DATA (void *)(uintptr_t)(-ENOENT)
768
769 /* net80211::net80211_he_cap */
770 struct ieee80211_sta_he_cap {
771 bool has_he;
772 struct ieee80211_he_cap_elem he_cap_elem;
773 struct ieee80211_he_mcs_nss_supp he_mcs_nss_supp;
774 uint8_t ppe_thres[IEEE80211_HE_CAP_PPE_THRES_MAX];
775 };
776
777 struct cfg80211_he_bss_color {
778 int color, enabled;
779 };
780
781 struct ieee80211_he_obss_pd {
782 bool enable;
783 uint8_t min_offset;
784 uint8_t max_offset;
785 uint8_t non_srg_max_offset;
786 uint8_t sr_ctrl;
787 uint8_t bss_color_bitmap[8];
788 uint8_t partial_bssid_bitmap[8];
789 };
790
791 struct ieee80211_eht_mcs_nss_supp_20mhz_only {
792 union {
793 struct {
794 uint8_t rx_tx_mcs7_max_nss;
795 uint8_t rx_tx_mcs9_max_nss;
796 uint8_t rx_tx_mcs11_max_nss;
797 uint8_t rx_tx_mcs13_max_nss;
798 };
799 uint8_t rx_tx_max_nss[4];
800 };
801 };
802
803 struct ieee80211_eht_mcs_nss_supp_bw {
804 union {
805 struct {
806 uint8_t rx_tx_mcs9_max_nss;
807 uint8_t rx_tx_mcs11_max_nss;
808 uint8_t rx_tx_mcs13_max_nss;
809 };
810 uint8_t rx_tx_max_nss[3];
811 };
812 };
813
814 struct ieee80211_eht_cap_elem_fixed {
815 uint8_t mac_cap_info[2];
816 uint8_t phy_cap_info[9];
817 };
818
819 struct ieee80211_eht_mcs_nss_supp {
820 /* TODO FIXME */
821 /* Can only have either or... */
822 union {
823 struct ieee80211_eht_mcs_nss_supp_20mhz_only only_20mhz;
824 struct {
825 struct ieee80211_eht_mcs_nss_supp_bw _80;
826 struct ieee80211_eht_mcs_nss_supp_bw _160;
827 struct ieee80211_eht_mcs_nss_supp_bw _320;
828 } bw;
829 };
830 };
831
832 #define IEEE80211_STA_EHT_PPE_THRES_MAX 32
833 struct ieee80211_sta_eht_cap {
834 bool has_eht;
835 struct ieee80211_eht_cap_elem_fixed eht_cap_elem;
836 struct ieee80211_eht_mcs_nss_supp eht_mcs_nss_supp;
837 uint8_t eht_ppe_thres[IEEE80211_STA_EHT_PPE_THRES_MAX];
838 };
839
840 struct ieee80211_sband_iftype_data {
841 /* TODO FIXME */
842 enum nl80211_iftype types_mask;
843 struct ieee80211_sta_he_cap he_cap;
844 struct ieee80211_he_6ghz_capa he_6ghz_capa;
845 struct ieee80211_sta_eht_cap eht_cap;
846 struct {
847 const uint8_t *data;
848 size_t len;
849 } vendor_elems;
850 };
851
852 struct ieee80211_supported_band {
853 /* TODO FIXME */
854 struct linuxkpi_ieee80211_channel *channels;
855 struct ieee80211_rate *bitrates;
856 struct ieee80211_sband_iftype_data *iftype_data;
857 int n_channels;
858 int n_bitrates;
859 int n_iftype_data;
860 enum nl80211_band band;
861 struct ieee80211_sta_ht_cap ht_cap;
862 struct ieee80211_sta_vht_cap vht_cap;
863 };
864
865 struct cfg80211_pkt_pattern {
866 /* XXX TODO */
867 uint8_t *mask;
868 uint8_t *pattern;
869 int pattern_len;
870 int pkt_offset;
871 };
872
873 struct cfg80211_wowlan_nd_match {
874 /* XXX TODO */
875 struct cfg80211_ssid ssid;
876 int n_channels;
877 uint32_t channels[0]; /* freq! = ieee80211_channel_to_frequency() */
878 };
879
880 struct cfg80211_wowlan_nd_info {
881 /* XXX TODO */
882 int n_matches;
883 struct cfg80211_wowlan_nd_match *matches[0];
884 };
885
886 enum wiphy_wowlan_support_flags {
887 WIPHY_WOWLAN_DISCONNECT,
888 WIPHY_WOWLAN_MAGIC_PKT,
889 WIPHY_WOWLAN_SUPPORTS_GTK_REKEY,
890 WIPHY_WOWLAN_GTK_REKEY_FAILURE,
891 WIPHY_WOWLAN_EAP_IDENTITY_REQ,
892 WIPHY_WOWLAN_4WAY_HANDSHAKE,
893 WIPHY_WOWLAN_RFKILL_RELEASE,
894 WIPHY_WOWLAN_NET_DETECT,
895 };
896
897 struct wiphy_wowlan_support {
898 /* XXX TODO */
899 enum wiphy_wowlan_support_flags flags;
900 int max_nd_match_sets, max_pkt_offset, n_patterns, pattern_max_len, pattern_min_len;
901 };
902
903 struct cfg80211_wowlan_wakeup {
904 /* XXX TODO */
905 uint16_t pattern_idx;
906 bool disconnect;
907 bool unprot_deauth_disassoc;
908 bool eap_identity_req;
909 bool four_way_handshake;
910 bool gtk_rekey_failure;
911 bool magic_pkt;
912 bool rfkill_release;
913 bool tcp_connlost;
914 bool tcp_nomoretokens;
915 bool tcp_match;
916 bool packet_80211;
917 struct cfg80211_wowlan_nd_info *net_detect;
918 uint8_t *packet;
919 uint16_t packet_len;
920 uint16_t packet_present_len;
921 };
922
923 struct cfg80211_wowlan {
924 /* XXX TODO */
925 bool any;
926 bool disconnect;
927 bool magic_pkt;
928 bool gtk_rekey_failure;
929 bool eap_identity_req;
930 bool four_way_handshake;
931 bool rfkill_release;
932
933 /* Magic packet patterns. */
934 int n_patterns;
935 struct cfg80211_pkt_pattern *patterns;
936
937 /* netdetect? if not assoc? */
938 struct cfg80211_sched_scan_request *nd_config;
939
940 void *tcp; /* XXX ? */
941 };
942
943 struct cfg80211_gtk_rekey_data {
944 /* XXX TODO */
945 const uint8_t *kck, *kek, *replay_ctr;
946 uint32_t akm;
947 uint8_t kck_len, kek_len;
948 };
949
950 struct cfg80211_tid_cfg {
951 /* XXX TODO */
952 int mask, noack, retry_long, rtscts, tids, amsdu, ampdu;
953 enum nl80211_tx_rate_setting txrate_type;
954 struct cfg80211_bitrate_mask txrate_mask;
955 };
956
957 struct cfg80211_tid_config {
958 /* XXX TODO */
959 int n_tid_conf;
960 struct cfg80211_tid_cfg tid_conf[0];
961 };
962
963 struct ieee80211_iface_limit {
964 /* TODO FIXME */
965 int max, types;
966 };
967
968 struct ieee80211_iface_combination {
969 /* TODO FIXME */
970 const struct ieee80211_iface_limit *limits;
971 int n_limits;
972 int max_interfaces, num_different_channels;
973 int beacon_int_infra_match, beacon_int_min_gcd;
974 int radar_detect_widths;
975 };
976
977 struct iface_combination_params {
978 int num_different_channels;
979 int iftype_num[NUM_NL80211_IFTYPES];
980 };
981
982 struct regulatory_request {
983 /* XXX TODO */
984 uint8_t alpha2[2];
985 enum environment_cap country_ie_env;
986 int initiator, dfs_region;
987 int user_reg_hint_type;
988 };
989
990 struct cfg80211_set_hw_timestamp {
991 const uint8_t *macaddr;
992 bool enable;
993 };
994
995 struct survey_info { /* net80211::struct ieee80211_channel_survey */
996 /* TODO FIXME */
997 uint32_t filled;
998 #define SURVEY_INFO_TIME 0x0001
999 #define SURVEY_INFO_TIME_RX 0x0002
1000 #define SURVEY_INFO_TIME_SCAN 0x0004
1001 #define SURVEY_INFO_TIME_TX 0x0008
1002 #define SURVEY_INFO_TIME_BSS_RX 0x0010
1003 #define SURVEY_INFO_TIME_BUSY 0x0020
1004 #define SURVEY_INFO_IN_USE 0x0040
1005 #define SURVEY_INFO_NOISE_DBM 0x0080
1006 uint32_t noise;
1007 uint64_t time;
1008 uint64_t time_bss_rx;
1009 uint64_t time_busy;
1010 uint64_t time_rx;
1011 uint64_t time_scan;
1012 uint64_t time_tx;
1013 struct linuxkpi_ieee80211_channel *channel;
1014 };
1015
1016 enum wiphy_vendor_cmd_need_flags {
1017 WIPHY_VENDOR_CMD_NEED_NETDEV = 0x01,
1018 WIPHY_VENDOR_CMD_NEED_RUNNING = 0x02,
1019 WIPHY_VENDOR_CMD_NEED_WDEV = 0x04,
1020 };
1021
1022 struct wiphy_vendor_command {
1023 struct {
1024 uint32_t vendor_id;
1025 uint32_t subcmd;
1026 };
1027 uint32_t flags;
1028 void *policy;
1029 int (*doit)(struct wiphy *, struct wireless_dev *, const void *, int);
1030 };
1031
1032 struct wiphy_iftype_ext_capab {
1033 /* TODO FIXME */
1034 enum nl80211_iftype iftype;
1035 const uint8_t *extended_capabilities;
1036 const uint8_t *extended_capabilities_mask;
1037 uint8_t extended_capabilities_len;
1038 uint16_t eml_capabilities;
1039 uint16_t mld_capa_and_ops;
1040 };
1041
1042 struct tid_config_support {
1043 /* TODO FIXME */
1044 uint64_t vif; /* enum nl80211_tid_cfg_attr */
1045 uint64_t peer; /* enum nl80211_tid_cfg_attr */
1046 };
1047
1048 enum cfg80211_regulatory {
1049 REGULATORY_CUSTOM_REG = BIT(0),
1050 REGULATORY_STRICT_REG = BIT(1),
1051 REGULATORY_DISABLE_BEACON_HINTS = BIT(2),
1052 REGULATORY_ENABLE_RELAX_NO_IR = BIT(3),
1053 REGULATORY_WIPHY_SELF_MANAGED = BIT(4),
1054 REGULATORY_COUNTRY_IE_IGNORE = BIT(5),
1055 REGULATORY_COUNTRY_IE_FOLLOW_POWER = BIT(6),
1056 };
1057
1058 struct wiphy_radio_freq_range {
1059 uint32_t start_freq;
1060 uint32_t end_freq;
1061 };
1062
1063 struct wiphy_radio {
1064 int n_freq_range;
1065 int n_iface_combinations;
1066 const struct wiphy_radio_freq_range *freq_range;
1067 const struct ieee80211_iface_combination *iface_combinations;
1068 };
1069
1070 enum wiphy_flags {
1071 WIPHY_FLAG_AP_UAPSD = BIT(0),
1072 WIPHY_FLAG_HAS_CHANNEL_SWITCH = BIT(1),
1073 WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL = BIT(2),
1074 WIPHY_FLAG_HAVE_AP_SME = BIT(3),
1075 WIPHY_FLAG_IBSS_RSN = BIT(4),
1076 WIPHY_FLAG_NETNS_OK = BIT(5),
1077 WIPHY_FLAG_OFFCHAN_TX = BIT(6),
1078 WIPHY_FLAG_PS_ON_BY_DEFAULT = BIT(7),
1079 WIPHY_FLAG_SPLIT_SCAN_6GHZ = BIT(8),
1080 WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK = BIT(9),
1081 WIPHY_FLAG_SUPPORTS_FW_ROAM = BIT(10),
1082 WIPHY_FLAG_SUPPORTS_TDLS = BIT(11),
1083 WIPHY_FLAG_TDLS_EXTERNAL_SETUP = BIT(12),
1084 WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD = BIT(13),
1085 WIPHY_FLAG_4ADDR_AP = BIT(14),
1086 WIPHY_FLAG_4ADDR_STATION = BIT(15),
1087 WIPHY_FLAG_SUPPORTS_MLO = BIT(16),
1088 WIPHY_FLAG_DISABLE_WEXT = BIT(17),
1089 };
1090
1091 struct wiphy_work;
1092 typedef void (*wiphy_work_fn)(struct wiphy *, struct wiphy_work *);
1093 struct wiphy_work {
1094 struct list_head entry;
1095 wiphy_work_fn fn;
1096 };
1097 struct wiphy_delayed_work {
1098 struct wiphy_work work;
1099 struct wiphy *wiphy;
1100 struct timer_list timer;
1101 };
1102
1103 struct wiphy {
1104 struct mutex mtx;
1105 struct device *dev;
1106 struct mac_address *addresses;
1107 int n_addresses;
1108 uint32_t flags;
1109 struct ieee80211_supported_band *bands[NUM_NL80211_BANDS];
1110 uint8_t perm_addr[ETH_ALEN];
1111 uint16_t max_scan_ie_len;
1112
1113 /* XXX TODO */
1114 const struct cfg80211_pmsr_capabilities *pmsr_capa;
1115 const struct cfg80211_sar_capa *sar_capa;
1116 const struct wiphy_iftype_ext_capab *iftype_ext_capab;
1117 const struct linuxkpi_ieee80211_regdomain *regd;
1118 char fw_version[ETHTOOL_FWVERS_LEN];
1119 const struct ieee80211_iface_combination *iface_combinations;
1120 const uint32_t *cipher_suites;
1121 int n_iface_combinations;
1122 int n_cipher_suites;
1123 void(*reg_notifier)(struct wiphy *, struct regulatory_request *);
1124 enum cfg80211_regulatory regulatory_flags;
1125 int n_vendor_commands;
1126 const struct wiphy_vendor_command *vendor_commands;
1127 const struct ieee80211_txrx_stypes *mgmt_stypes;
1128 uint32_t rts_threshold;
1129 uint32_t frag_threshold;
1130 struct tid_config_support tid_config_support;
1131 uint8_t available_antennas_rx;
1132 uint8_t available_antennas_tx;
1133
1134 int n_radio;
1135 const struct wiphy_radio *radio;
1136
1137 int features, hw_version;
1138 int interface_modes, max_match_sets, max_remain_on_channel_duration, max_scan_ssids, max_sched_scan_ie_len, max_sched_scan_plan_interval, max_sched_scan_plan_iterations, max_sched_scan_plans, max_sched_scan_reqs, max_sched_scan_ssids;
1139 int num_iftype_ext_capab;
1140 int max_ap_assoc_sta, probe_resp_offload, software_iftypes;
1141 int bss_select_support, max_num_pmkids, retry_long, retry_short, signal_type;
1142 int max_data_retry_count;
1143 int tx_queue_len, rfkill;
1144 int mbssid_max_interfaces;
1145 int hw_timestamp_max_peers;
1146 int ema_max_profile_periodicity;
1147
1148 unsigned long ext_features[BITS_TO_LONGS(NUM_NL80211_EXT_FEATURES)];
1149 struct dentry *debugfsdir;
1150
1151 const struct wiphy_wowlan_support *wowlan;
1152 struct cfg80211_wowlan *wowlan_config;
1153 /* Lower layer (driver/mac80211) specific data. */
1154 /* Must stay last. */
1155 uint8_t priv[0] __aligned(CACHE_LINE_SIZE);
1156 };
1157
1158 #define lockdep_assert_wiphy(wiphy) \
1159 lockdep_assert_held(&(wiphy)->mtx)
1160
1161 struct wireless_dev {
1162 /* XXX TODO, like ic? */
1163 enum nl80211_iftype iftype;
1164 uint32_t radio_mask;
1165 uint8_t address[ETH_ALEN];
1166 struct net_device *netdev;
1167 struct wiphy *wiphy;
1168 };
1169
1170 struct cfg80211_ops {
1171 /* XXX TODO */
1172 struct wireless_dev *(*add_virtual_intf)(struct wiphy *, const char *, unsigned char, enum nl80211_iftype, struct vif_params *);
1173 int (*del_virtual_intf)(struct wiphy *, struct wireless_dev *);
1174 int (*change_virtual_intf)(struct wiphy *, struct net_device *, enum nl80211_iftype, struct vif_params *);
1175 int (*scan)(struct wiphy *, struct cfg80211_scan_request *);
1176 int (*set_wiphy_params)(struct wiphy *, int, uint32_t);
1177 int (*join_ibss)(struct wiphy *, struct net_device *, struct cfg80211_ibss_params *);
1178 int (*leave_ibss)(struct wiphy *, struct net_device *);
1179 int (*get_station)(struct wiphy *, struct net_device *, const uint8_t *, struct station_info *);
1180 int (*dump_station)(struct wiphy *, struct net_device *, int, uint8_t *, struct station_info *);
1181 int (*set_tx_power)(struct wiphy *, struct wireless_dev *, int, enum nl80211_tx_power_setting, int);
1182 int (*get_tx_power)(struct wiphy *, struct wireless_dev *, int, unsigned int, int *);
1183 int (*add_key)(struct wiphy *, struct net_device *, int, uint8_t, bool, const uint8_t *, struct key_params *);
1184 int (*del_key)(struct wiphy *, struct net_device *, int, uint8_t, bool, const uint8_t *);
1185 int (*get_key)(struct wiphy *, struct net_device *, int, uint8_t, bool, const uint8_t *, void *, void(*)(void *, struct key_params *));
1186 int (*set_default_key)(struct wiphy *, struct net_device *, int, uint8_t, bool, bool);
1187 int (*set_default_mgmt_key)(struct wiphy *, struct net_device *, int, uint8_t);
1188 int (*set_power_mgmt)(struct wiphy *, struct net_device *, bool, int);
1189 int (*connect)(struct wiphy *, struct net_device *, struct cfg80211_connect_params *);
1190 int (*disconnect)(struct wiphy *, struct net_device *, uint16_t);
1191 int (*suspend)(struct wiphy *, struct cfg80211_wowlan *);
1192 int (*resume)(struct wiphy *);
1193 int (*set_pmksa)(struct wiphy *, struct net_device *, struct cfg80211_pmksa *);
1194 int (*del_pmksa)(struct wiphy *, struct net_device *, struct cfg80211_pmksa *);
1195 int (*flush_pmksa)(struct wiphy *, struct net_device *);
1196 int (*start_ap)(struct wiphy *, struct net_device *, struct cfg80211_ap_settings *);
1197 int (*stop_ap)(struct wiphy *, struct net_device *, unsigned int);
1198 int (*change_beacon)(struct wiphy *, struct net_device *, struct cfg80211_ap_update *);
1199 int (*del_station)(struct wiphy *, struct net_device *, struct station_del_parameters *);
1200 int (*change_station)(struct wiphy *, struct net_device *, const uint8_t *, struct station_parameters *);
1201 int (*sched_scan_start)(struct wiphy *, struct net_device *, struct cfg80211_sched_scan_request *);
1202 int (*sched_scan_stop)(struct wiphy *, struct net_device *, uint64_t);
1203 void (*update_mgmt_frame_registrations)(struct wiphy *, struct wireless_dev *, struct mgmt_frame_regs *);
1204 int (*mgmt_tx)(struct wiphy *, struct wireless_dev *, struct cfg80211_mgmt_tx_params *, uint64_t *);
1205 int (*cancel_remain_on_channel)(struct wiphy *, struct wireless_dev *, uint64_t);
1206 int (*get_channel)(struct wiphy *, struct wireless_dev *, unsigned int, struct cfg80211_chan_def *);
1207 int (*crit_proto_start)(struct wiphy *, struct wireless_dev *, enum nl80211_crit_proto_id, uint16_t);
1208 void (*crit_proto_stop)(struct wiphy *, struct wireless_dev *);
1209 int (*tdls_oper)(struct wiphy *, struct net_device *, const uint8_t *, enum nl80211_tdls_operation);
1210 int (*update_connect_params)(struct wiphy *, struct net_device *, struct cfg80211_connect_params *, uint32_t);
1211 int (*set_pmk)(struct wiphy *, struct net_device *, const struct cfg80211_pmk_conf *);
1212 int (*del_pmk)(struct wiphy *, struct net_device *, const uint8_t *);
1213 int (*remain_on_channel)(struct wiphy *, struct wireless_dev *, struct linuxkpi_ieee80211_channel *, unsigned int, uint64_t *);
1214 int (*start_p2p_device)(struct wiphy *, struct wireless_dev *);
1215 void (*stop_p2p_device)(struct wiphy *, struct wireless_dev *);
1216 int (*dump_survey)(struct wiphy *, struct net_device *, int, struct survey_info *);
1217 int (*external_auth)(struct wiphy *, struct net_device *, struct cfg80211_external_auth_params *);
1218 int (*set_cqm_rssi_range_config)(struct wiphy *, struct net_device *, int, int);
1219
1220 };
1221
1222
1223 /* -------------------------------------------------------------------------- */
1224
1225 /* linux_80211.c */
1226
1227 struct wiphy *linuxkpi_wiphy_new(const struct cfg80211_ops *, size_t);
1228 void linuxkpi_wiphy_free(struct wiphy *wiphy);
1229
1230 void linuxkpi_wiphy_work_queue(struct wiphy *, struct wiphy_work *);
1231 void linuxkpi_wiphy_work_cancel(struct wiphy *, struct wiphy_work *);
1232 void linuxkpi_wiphy_work_flush(struct wiphy *, struct wiphy_work *);
1233 void lkpi_wiphy_delayed_work_timer(struct timer_list *);
1234 void linuxkpi_wiphy_delayed_work_queue(struct wiphy *,
1235 struct wiphy_delayed_work *, unsigned long);
1236 void linuxkpi_wiphy_delayed_work_cancel(struct wiphy *,
1237 struct wiphy_delayed_work *);
1238 void linuxkpi_wiphy_delayed_work_flush(struct wiphy *,
1239 struct wiphy_delayed_work *);
1240
1241 int linuxkpi_regulatory_set_wiphy_regd_sync(struct wiphy *wiphy,
1242 struct linuxkpi_ieee80211_regdomain *regd);
1243 uint32_t linuxkpi_cfg80211_calculate_bitrate(struct rate_info *);
1244 uint32_t linuxkpi_ieee80211_channel_to_frequency(uint32_t, enum nl80211_band);
1245 uint32_t linuxkpi_ieee80211_frequency_to_channel(uint32_t, uint32_t);
1246 struct linuxkpi_ieee80211_channel *
1247 linuxkpi_ieee80211_get_channel(struct wiphy *, uint32_t);
1248 struct cfg80211_bss *linuxkpi_cfg80211_get_bss(struct wiphy *,
1249 struct linuxkpi_ieee80211_channel *, const uint8_t *,
1250 const uint8_t *, size_t, enum ieee80211_bss_type, enum ieee80211_privacy);
1251 void linuxkpi_cfg80211_put_bss(struct wiphy *, struct cfg80211_bss *);
1252 void linuxkpi_cfg80211_bss_flush(struct wiphy *);
1253 struct linuxkpi_ieee80211_regdomain *
1254 lkpi_get_linuxkpi_ieee80211_regdomain(size_t);
1255
1256 /* -------------------------------------------------------------------------- */
1257
1258 static __inline struct wiphy *
wiphy_new(const struct cfg80211_ops * ops,size_t priv_len)1259 wiphy_new(const struct cfg80211_ops *ops, size_t priv_len)
1260 {
1261
1262 return (linuxkpi_wiphy_new(ops, priv_len));
1263 }
1264
1265 static __inline void
wiphy_free(struct wiphy * wiphy)1266 wiphy_free(struct wiphy *wiphy)
1267 {
1268
1269 linuxkpi_wiphy_free(wiphy);
1270 }
1271
1272 static __inline void *
wiphy_priv(struct wiphy * wiphy)1273 wiphy_priv(struct wiphy *wiphy)
1274 {
1275
1276 return (wiphy->priv);
1277 }
1278
1279 static __inline void
set_wiphy_dev(struct wiphy * wiphy,struct device * dev)1280 set_wiphy_dev(struct wiphy *wiphy, struct device *dev)
1281 {
1282
1283 wiphy->dev = dev;
1284 }
1285
1286 static __inline struct device *
wiphy_dev(struct wiphy * wiphy)1287 wiphy_dev(struct wiphy *wiphy)
1288 {
1289
1290 return (wiphy->dev);
1291 }
1292
1293 #define wiphy_dereference(_w, p) \
1294 rcu_dereference_check(p, lockdep_is_held(&(_w)->mtx))
1295
1296 #define wiphy_lock(_w) mutex_lock(&(_w)->mtx)
1297 #define wiphy_unlock(_w) mutex_unlock(&(_w)->mtx)
1298
1299 static __inline void
wiphy_rfkill_set_hw_state_reason(struct wiphy * wiphy,bool blocked,enum rfkill_hard_block_reasons reason)1300 wiphy_rfkill_set_hw_state_reason(struct wiphy *wiphy, bool blocked,
1301 enum rfkill_hard_block_reasons reason)
1302 {
1303 TODO();
1304 }
1305
1306 /* -------------------------------------------------------------------------- */
1307
1308 static inline int
cfg80211_register_netdevice(struct net_device * ndev)1309 cfg80211_register_netdevice(struct net_device *ndev)
1310 {
1311 TODO();
1312 return (-ENXIO);
1313 }
1314
1315 static inline void
cfg80211_unregister_netdevice(struct net_device * ndev)1316 cfg80211_unregister_netdevice(struct net_device *ndev)
1317 {
1318 TODO();
1319 }
1320
1321 /* -------------------------------------------------------------------------- */
1322
1323 static inline struct cfg80211_bss *
cfg80211_get_bss(struct wiphy * wiphy,struct linuxkpi_ieee80211_channel * chan,const uint8_t * bssid,const uint8_t * ssid,size_t ssid_len,enum ieee80211_bss_type bss_type,enum ieee80211_privacy privacy)1324 cfg80211_get_bss(struct wiphy *wiphy, struct linuxkpi_ieee80211_channel *chan,
1325 const uint8_t *bssid, const uint8_t *ssid, size_t ssid_len,
1326 enum ieee80211_bss_type bss_type, enum ieee80211_privacy privacy)
1327 {
1328
1329 return (linuxkpi_cfg80211_get_bss(wiphy, chan, bssid, ssid, ssid_len,
1330 bss_type, privacy));
1331 }
1332
1333 static inline void
cfg80211_put_bss(struct wiphy * wiphy,struct cfg80211_bss * bss)1334 cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss)
1335 {
1336
1337 linuxkpi_cfg80211_put_bss(wiphy, bss);
1338 }
1339
1340 static inline void
cfg80211_bss_flush(struct wiphy * wiphy)1341 cfg80211_bss_flush(struct wiphy *wiphy)
1342 {
1343
1344 linuxkpi_cfg80211_bss_flush(wiphy);
1345 }
1346
1347 /* -------------------------------------------------------------------------- */
1348
1349 static __inline bool
rfkill_blocked(int rfkill)1350 rfkill_blocked(int rfkill) /* argument type? */
1351 {
1352 TODO();
1353 return (false);
1354 }
1355
1356 static __inline bool
rfkill_soft_blocked(int rfkill)1357 rfkill_soft_blocked(int rfkill)
1358 {
1359 TODO();
1360 return (false);
1361 }
1362
1363 static __inline void
wiphy_rfkill_start_polling(struct wiphy * wiphy)1364 wiphy_rfkill_start_polling(struct wiphy *wiphy)
1365 {
1366 TODO();
1367 }
1368
1369 static __inline void
wiphy_rfkill_stop_polling(struct wiphy * wiphy)1370 wiphy_rfkill_stop_polling(struct wiphy *wiphy)
1371 {
1372 TODO();
1373 }
1374
1375 static __inline int
reg_query_regdb_wmm(uint8_t * alpha2,uint32_t center_freq,struct ieee80211_reg_rule * rule)1376 reg_query_regdb_wmm(uint8_t *alpha2, uint32_t center_freq,
1377 struct ieee80211_reg_rule *rule)
1378 {
1379
1380 IMPROVE("regdomain.xml needs to grow wmm information for at least ETSI");
1381
1382 return (-ENODATA);
1383 }
1384
1385 static __inline const uint8_t *
cfg80211_find_ie_match(uint32_t f,const uint8_t * ies,size_t ies_len,const uint8_t * match,int x,int y)1386 cfg80211_find_ie_match(uint32_t f, const uint8_t *ies, size_t ies_len,
1387 const uint8_t *match, int x, int y)
1388 {
1389 TODO();
1390 return (NULL);
1391 }
1392
1393 static __inline const uint8_t *
cfg80211_find_ie(uint8_t eid,const uint8_t * ie,uint32_t ielen)1394 cfg80211_find_ie(uint8_t eid, const uint8_t *ie, uint32_t ielen)
1395 {
1396 TODO();
1397 return (NULL);
1398 }
1399
1400 static __inline void
cfg80211_pmsr_complete(struct wireless_dev * wdev,struct cfg80211_pmsr_request * req,gfp_t gfp)1401 cfg80211_pmsr_complete(struct wireless_dev *wdev,
1402 struct cfg80211_pmsr_request *req, gfp_t gfp)
1403 {
1404 TODO();
1405 }
1406
1407 static __inline void
cfg80211_pmsr_report(struct wireless_dev * wdev,struct cfg80211_pmsr_request * req,struct cfg80211_pmsr_result * result,gfp_t gfp)1408 cfg80211_pmsr_report(struct wireless_dev *wdev,
1409 struct cfg80211_pmsr_request *req,
1410 struct cfg80211_pmsr_result *result, gfp_t gfp)
1411 {
1412 TODO();
1413 }
1414
1415 static inline int
nl80211_chan_width_to_mhz(enum nl80211_chan_width width)1416 nl80211_chan_width_to_mhz(enum nl80211_chan_width width)
1417 {
1418 switch (width) {
1419 case NL80211_CHAN_WIDTH_5:
1420 return (5);
1421 break;
1422 case NL80211_CHAN_WIDTH_10:
1423 return (10);
1424 break;
1425 case NL80211_CHAN_WIDTH_20_NOHT:
1426 case NL80211_CHAN_WIDTH_20:
1427 return (20);
1428 break;
1429 case NL80211_CHAN_WIDTH_40:
1430 return (40);
1431 break;
1432 case NL80211_CHAN_WIDTH_80:
1433 case NL80211_CHAN_WIDTH_80P80:
1434 return (80);
1435 break;
1436 case NL80211_CHAN_WIDTH_160:
1437 return (160);
1438 break;
1439 case NL80211_CHAN_WIDTH_320:
1440 return (320);
1441 break;
1442 }
1443 }
1444
1445 static inline void
cfg80211_chandef_create(struct cfg80211_chan_def * chandef,struct linuxkpi_ieee80211_channel * chan,enum nl80211_channel_type chan_type)1446 cfg80211_chandef_create(struct cfg80211_chan_def *chandef,
1447 struct linuxkpi_ieee80211_channel *chan, enum nl80211_channel_type chan_type)
1448 {
1449
1450 KASSERT(chandef != NULL, ("%s: chandef is NULL\n", __func__));
1451 KASSERT(chan != NULL, ("%s: chan is NULL\n", __func__));
1452
1453 /* memset(chandef, 0, sizeof(*chandef)); */
1454 chandef->chan = chan;
1455 chandef->center_freq1 = chan->center_freq;
1456 /* chandef->width, center_freq2, punctured */
1457
1458 switch (chan_type) {
1459 case NL80211_CHAN_NO_HT:
1460 chandef->width = NL80211_CHAN_WIDTH_20_NOHT;
1461 break;
1462 case NL80211_CHAN_HT20:
1463 chandef->width = NL80211_CHAN_WIDTH_20;
1464 break;
1465 case NL80211_CHAN_HT40MINUS:
1466 chandef->width = NL80211_CHAN_WIDTH_40;
1467 chandef->center_freq1 -= 10;
1468 break;
1469 case NL80211_CHAN_HT40PLUS:
1470 chandef->width = NL80211_CHAN_WIDTH_40;
1471 chandef->center_freq1 += 10;
1472 break;
1473 };
1474 }
1475
1476 static __inline bool
cfg80211_chandef_valid(const struct cfg80211_chan_def * chandef)1477 cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef)
1478 {
1479 TODO();
1480 return (false);
1481 }
1482
1483 static inline int
cfg80211_chandef_get_width(const struct cfg80211_chan_def * chandef)1484 cfg80211_chandef_get_width(const struct cfg80211_chan_def *chandef)
1485 {
1486 return (nl80211_chan_width_to_mhz(chandef->width));
1487 }
1488
1489 static __inline bool
cfg80211_chandef_dfs_usable(struct wiphy * wiphy,const struct cfg80211_chan_def * chandef)1490 cfg80211_chandef_dfs_usable(struct wiphy *wiphy, const struct cfg80211_chan_def *chandef)
1491 {
1492 TODO();
1493 return (false);
1494 }
1495
1496 static __inline unsigned int
cfg80211_chandef_dfs_cac_time(struct wiphy * wiphy,const struct cfg80211_chan_def * chandef)1497 cfg80211_chandef_dfs_cac_time(struct wiphy *wiphy, const struct cfg80211_chan_def *chandef)
1498 {
1499 TODO();
1500 return (0);
1501 }
1502
1503 static __inline bool
cfg80211_chandef_identical(const struct cfg80211_chan_def * chandef_1,const struct cfg80211_chan_def * chandef_2)1504 cfg80211_chandef_identical(const struct cfg80211_chan_def *chandef_1,
1505 const struct cfg80211_chan_def *chandef_2)
1506 {
1507 TODO();
1508 return (false);
1509 }
1510
1511 static __inline bool
cfg80211_chandef_usable(struct wiphy * wiphy,const struct cfg80211_chan_def * chandef,uint32_t flags)1512 cfg80211_chandef_usable(struct wiphy *wiphy,
1513 const struct cfg80211_chan_def *chandef, uint32_t flags)
1514 {
1515 TODO();
1516 return (false);
1517 }
1518
1519 static __inline void
cfg80211_bss_iter(struct wiphy * wiphy,struct cfg80211_chan_def * chandef,void (* iterfunc)(struct wiphy *,struct cfg80211_bss *,void *),void * data)1520 cfg80211_bss_iter(struct wiphy *wiphy, struct cfg80211_chan_def *chandef,
1521 void (*iterfunc)(struct wiphy *, struct cfg80211_bss *, void *), void *data)
1522 {
1523 TODO();
1524 }
1525
1526 struct element {
1527 uint8_t id;
1528 uint8_t datalen;
1529 uint8_t data[0];
1530 } __packed;
1531
1532 static inline const struct element *
lkpi_cfg80211_find_elem_pattern(enum ieee80211_eid eid,const uint8_t * data,size_t len,uint8_t * pattern,size_t plen)1533 lkpi_cfg80211_find_elem_pattern(enum ieee80211_eid eid,
1534 const uint8_t *data, size_t len, uint8_t *pattern, size_t plen)
1535 {
1536 const struct element *elem;
1537 const uint8_t *p;
1538 size_t ielen;
1539
1540 p = data;
1541 elem = (const struct element *)p;
1542 ielen = len;
1543 while (elem != NULL && ielen > 1) {
1544 if ((2 + elem->datalen) > ielen)
1545 /* Element overruns our memory. */
1546 return (NULL);
1547 if (elem->id == eid) {
1548 if (pattern == NULL)
1549 return (elem);
1550 if (elem->datalen >= plen &&
1551 memcmp(elem->data, pattern, plen) == 0)
1552 return (elem);
1553 }
1554 ielen -= 2 + elem->datalen;
1555 p += 2 + elem->datalen;
1556 elem = (const struct element *)p;
1557 }
1558
1559 return (NULL);
1560 }
1561
1562 static inline const struct element *
cfg80211_find_elem(enum ieee80211_eid eid,const uint8_t * data,size_t len)1563 cfg80211_find_elem(enum ieee80211_eid eid, const uint8_t *data, size_t len)
1564 {
1565
1566 return (lkpi_cfg80211_find_elem_pattern(eid, data, len, NULL, 0));
1567 }
1568
1569 static inline const struct element *
ieee80211_bss_get_elem(struct cfg80211_bss * bss,uint32_t eid)1570 ieee80211_bss_get_elem(struct cfg80211_bss *bss, uint32_t eid)
1571 {
1572
1573 if (bss->ies == NULL)
1574 return (NULL);
1575 return (cfg80211_find_elem(eid, bss->ies->data, bss->ies->len));
1576 }
1577
1578 static inline const uint8_t *
ieee80211_bss_get_ie(struct cfg80211_bss * bss,uint32_t eid)1579 ieee80211_bss_get_ie(struct cfg80211_bss *bss, uint32_t eid)
1580 {
1581
1582 return ((const uint8_t *)ieee80211_bss_get_elem(bss, eid));
1583 }
1584
1585 static inline uint8_t *
cfg80211_find_vendor_ie(unsigned int oui,int oui_type,uint8_t * data,size_t len)1586 cfg80211_find_vendor_ie(unsigned int oui, int oui_type,
1587 uint8_t *data, size_t len)
1588 {
1589 const struct element *elem;
1590 uint8_t pattern[4] = { oui << 16, oui << 8, oui, oui_type };
1591 uint8_t plen = 4; /* >= 3? oui_type always part of this? */
1592 IMPROVE("plen currently always incl. oui_type");
1593
1594 elem = lkpi_cfg80211_find_elem_pattern(IEEE80211_ELEMID_VENDOR,
1595 data, len, pattern, plen);
1596 if (elem == NULL)
1597 return (NULL);
1598 return (__DECONST(uint8_t *, elem));
1599 }
1600
1601 static inline uint32_t
cfg80211_calculate_bitrate(struct rate_info * rate)1602 cfg80211_calculate_bitrate(struct rate_info *rate)
1603 {
1604 return (linuxkpi_cfg80211_calculate_bitrate(rate));
1605 }
1606
1607 static __inline uint32_t
ieee80211_channel_to_frequency(uint32_t channel,enum nl80211_band band)1608 ieee80211_channel_to_frequency(uint32_t channel, enum nl80211_band band)
1609 {
1610
1611 return (linuxkpi_ieee80211_channel_to_frequency(channel, band));
1612 }
1613
1614 static __inline uint32_t
ieee80211_frequency_to_channel(uint32_t freq)1615 ieee80211_frequency_to_channel(uint32_t freq)
1616 {
1617
1618 return (linuxkpi_ieee80211_frequency_to_channel(freq, 0));
1619 }
1620
1621 static __inline int
regulatory_set_wiphy_regd_sync(struct wiphy * wiphy,struct linuxkpi_ieee80211_regdomain * regd)1622 regulatory_set_wiphy_regd_sync(struct wiphy *wiphy,
1623 struct linuxkpi_ieee80211_regdomain *regd)
1624 {
1625 IMPROVE();
1626 return (linuxkpi_regulatory_set_wiphy_regd_sync(wiphy, regd));
1627 }
1628
1629 static __inline int
regulatory_set_wiphy_regd_sync_rtnl(struct wiphy * wiphy,struct linuxkpi_ieee80211_regdomain * regd)1630 regulatory_set_wiphy_regd_sync_rtnl(struct wiphy *wiphy,
1631 struct linuxkpi_ieee80211_regdomain *regd)
1632 {
1633
1634 IMPROVE();
1635 return (linuxkpi_regulatory_set_wiphy_regd_sync(wiphy, regd));
1636 }
1637
1638 static __inline int
regulatory_set_wiphy_regd(struct wiphy * wiphy,struct linuxkpi_ieee80211_regdomain * regd)1639 regulatory_set_wiphy_regd(struct wiphy *wiphy,
1640 struct linuxkpi_ieee80211_regdomain *regd)
1641 {
1642
1643 IMPROVE();
1644 if (regd == NULL)
1645 return (EINVAL);
1646
1647 /* XXX-BZ wild guessing here based on brcmfmac. */
1648 if (wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED)
1649 wiphy->regd = regd;
1650 else
1651 return (EPERM);
1652
1653 /* XXX FIXME, do we have to do anything with reg_notifier? */
1654 return (0);
1655 }
1656
1657 static __inline int
regulatory_hint(struct wiphy * wiphy,const uint8_t * alpha2)1658 regulatory_hint(struct wiphy *wiphy, const uint8_t *alpha2)
1659 {
1660 struct linuxkpi_ieee80211_regdomain *regd;
1661
1662 if (wiphy->regd != NULL)
1663 return (-EBUSY);
1664
1665 regd = lkpi_get_linuxkpi_ieee80211_regdomain(0);
1666 if (regd == NULL)
1667 return (-ENOMEM);
1668
1669 regd->alpha2[0] = alpha2[0];
1670 regd->alpha2[1] = alpha2[1];
1671 wiphy->regd = regd;
1672
1673 IMPROVE("are there flags who is managing? update net8011?");
1674
1675 return (0);
1676 }
1677
1678 static __inline const char *
reg_initiator_name(enum nl80211_reg_initiator initiator)1679 reg_initiator_name(enum nl80211_reg_initiator initiator)
1680 {
1681 TODO();
1682 return (NULL);
1683 }
1684
1685 static __inline struct linuxkpi_ieee80211_regdomain *
rtnl_dereference(const struct linuxkpi_ieee80211_regdomain * regd)1686 rtnl_dereference(const struct linuxkpi_ieee80211_regdomain *regd)
1687 {
1688 TODO();
1689 return (NULL);
1690 }
1691
1692 static __inline struct ieee80211_reg_rule *
freq_reg_info(struct wiphy * wiphy,uint32_t center_freq)1693 freq_reg_info(struct wiphy *wiphy, uint32_t center_freq)
1694 {
1695 TODO();
1696 return (NULL);
1697 }
1698
1699 static __inline void
wiphy_apply_custom_regulatory(struct wiphy * wiphy,const struct linuxkpi_ieee80211_regdomain * regd)1700 wiphy_apply_custom_regulatory(struct wiphy *wiphy,
1701 const struct linuxkpi_ieee80211_regdomain *regd)
1702 {
1703 TODO();
1704 }
1705
1706 static __inline char *
wiphy_name(struct wiphy * wiphy)1707 wiphy_name(struct wiphy *wiphy)
1708 {
1709 if (wiphy != NULL && wiphy->dev != NULL)
1710 return dev_name(wiphy->dev);
1711 else {
1712 IMPROVE("wlanNA");
1713 return ("wlanNA");
1714 }
1715 }
1716
1717 static __inline void
wiphy_read_of_freq_limits(struct wiphy * wiphy)1718 wiphy_read_of_freq_limits(struct wiphy *wiphy)
1719 {
1720 #ifdef FDT
1721 TODO();
1722 #endif
1723 }
1724
1725 static __inline void
wiphy_ext_feature_set(struct wiphy * wiphy,enum nl80211_ext_feature ef)1726 wiphy_ext_feature_set(struct wiphy *wiphy, enum nl80211_ext_feature ef)
1727 {
1728
1729 set_bit(ef, wiphy->ext_features);
1730 }
1731
1732 static inline bool
wiphy_ext_feature_isset(struct wiphy * wiphy,enum nl80211_ext_feature ef)1733 wiphy_ext_feature_isset(struct wiphy *wiphy, enum nl80211_ext_feature ef)
1734 {
1735 return (test_bit(ef, wiphy->ext_features));
1736 }
1737
1738 static __inline void *
wiphy_net(struct wiphy * wiphy)1739 wiphy_net(struct wiphy *wiphy)
1740 {
1741 TODO();
1742 return (NULL); /* XXX passed to dev_net_set() */
1743 }
1744
1745 static __inline int
wiphy_register(struct wiphy * wiphy)1746 wiphy_register(struct wiphy *wiphy)
1747 {
1748 TODO();
1749 return (0);
1750 }
1751
1752 static __inline void
wiphy_unregister(struct wiphy * wiphy)1753 wiphy_unregister(struct wiphy *wiphy)
1754 {
1755 TODO();
1756 }
1757
1758 static __inline void
wiphy_warn(struct wiphy * wiphy,const char * fmt,...)1759 wiphy_warn(struct wiphy *wiphy, const char *fmt, ...)
1760 {
1761 TODO();
1762 }
1763
1764 static __inline int
cfg80211_check_combinations(struct wiphy * wiphy,struct iface_combination_params * params)1765 cfg80211_check_combinations(struct wiphy *wiphy,
1766 struct iface_combination_params *params)
1767 {
1768 TODO();
1769 return (-ENOENT);
1770 }
1771
1772 static __inline uint8_t
cfg80211_classify8021d(struct sk_buff * skb,void * p)1773 cfg80211_classify8021d(struct sk_buff *skb, void *p)
1774 {
1775 TODO();
1776 return (0);
1777 }
1778
1779 static __inline void
cfg80211_connect_done(struct net_device * ndev,struct cfg80211_connect_resp_params * conn_params,gfp_t gfp)1780 cfg80211_connect_done(struct net_device *ndev,
1781 struct cfg80211_connect_resp_params *conn_params, gfp_t gfp)
1782 {
1783 TODO();
1784 }
1785
1786 static __inline void
cfg80211_crit_proto_stopped(struct wireless_dev * wdev,gfp_t gfp)1787 cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp)
1788 {
1789 TODO();
1790 }
1791
1792 static __inline void
cfg80211_disconnected(struct net_device * ndev,uint16_t reason,void * p,int x,bool locally_generated,gfp_t gfp)1793 cfg80211_disconnected(struct net_device *ndev, uint16_t reason,
1794 void *p, int x, bool locally_generated, gfp_t gfp)
1795 {
1796 TODO();
1797 }
1798
1799 static __inline int
cfg80211_get_p2p_attr(const uint8_t * ie,uint32_t ie_len,enum ieee80211_p2p_attr_ids attr,uint8_t * p,size_t p_len)1800 cfg80211_get_p2p_attr(const uint8_t *ie, uint32_t ie_len,
1801 enum ieee80211_p2p_attr_ids attr, uint8_t *p, size_t p_len)
1802 {
1803 TODO();
1804 return (-1);
1805 }
1806
1807 static __inline void
cfg80211_ibss_joined(struct net_device * ndev,const uint8_t * addr,struct linuxkpi_ieee80211_channel * chan,gfp_t gfp)1808 cfg80211_ibss_joined(struct net_device *ndev, const uint8_t *addr,
1809 struct linuxkpi_ieee80211_channel *chan, gfp_t gfp)
1810 {
1811 TODO();
1812 }
1813
1814 static __inline struct cfg80211_bss *
cfg80211_inform_bss(struct wiphy * wiphy,struct linuxkpi_ieee80211_channel * channel,enum cfg80211_bss_frame_type bss_ftype,const uint8_t * bss,int _x,uint16_t cap,uint16_t intvl,const uint8_t * ie,size_t ie_len,int signal,gfp_t gfp)1815 cfg80211_inform_bss(struct wiphy *wiphy,
1816 struct linuxkpi_ieee80211_channel *channel,
1817 enum cfg80211_bss_frame_type bss_ftype, const uint8_t *bss, int _x,
1818 uint16_t cap, uint16_t intvl, const uint8_t *ie, size_t ie_len,
1819 int signal, gfp_t gfp)
1820 {
1821 TODO();
1822 return (NULL);
1823 }
1824
1825 static __inline struct cfg80211_bss *
cfg80211_inform_bss_data(struct wiphy * wiphy,struct cfg80211_inform_bss * bss_data,enum cfg80211_bss_frame_type bss_ftype,const uint8_t * bss,int _x,uint16_t cap,uint16_t intvl,const uint8_t * ie,size_t ie_len,gfp_t gfp)1826 cfg80211_inform_bss_data(struct wiphy *wiphy,
1827 struct cfg80211_inform_bss *bss_data,
1828 enum cfg80211_bss_frame_type bss_ftype, const uint8_t *bss, int _x,
1829 uint16_t cap, uint16_t intvl, const uint8_t *ie, size_t ie_len, gfp_t gfp)
1830 {
1831 TODO();
1832 return (NULL);
1833 }
1834
1835 static __inline void
cfg80211_mgmt_tx_status(struct wireless_dev * wdev,uint64_t cookie,const uint8_t * buf,size_t len,bool ack,gfp_t gfp)1836 cfg80211_mgmt_tx_status(struct wireless_dev *wdev, uint64_t cookie,
1837 const uint8_t *buf, size_t len, bool ack, gfp_t gfp)
1838 {
1839 TODO();
1840 }
1841
1842 static __inline void
cfg80211_michael_mic_failure(struct net_device * ndev,const uint8_t addr[ETH_ALEN],enum nl80211_key_type key_type,int _x,void * p,gfp_t gfp)1843 cfg80211_michael_mic_failure(struct net_device *ndev, const uint8_t addr[ETH_ALEN],
1844 enum nl80211_key_type key_type, int _x, void *p, gfp_t gfp)
1845 {
1846 TODO();
1847 }
1848
1849 static __inline void
cfg80211_new_sta(struct net_device * ndev,const uint8_t * addr,struct station_info * sinfo,gfp_t gfp)1850 cfg80211_new_sta(struct net_device *ndev, const uint8_t *addr,
1851 struct station_info *sinfo, gfp_t gfp)
1852 {
1853 TODO();
1854 }
1855
1856 static __inline void
cfg80211_del_sta(struct net_device * ndev,const uint8_t * addr,gfp_t gfp)1857 cfg80211_del_sta(struct net_device *ndev, const uint8_t *addr, gfp_t gfp)
1858 {
1859 TODO();
1860 }
1861
1862 static __inline void
cfg80211_port_authorized(struct net_device * ndev,const uint8_t * addr,const uint8_t * bitmap,uint8_t len,gfp_t gfp)1863 cfg80211_port_authorized(struct net_device *ndev, const uint8_t *addr,
1864 const uint8_t *bitmap, uint8_t len, gfp_t gfp)
1865 {
1866 TODO();
1867 }
1868
1869 static __inline void
cfg80211_ready_on_channel(struct wireless_dev * wdev,uint64_t cookie,struct linuxkpi_ieee80211_channel * channel,unsigned int duration,gfp_t gfp)1870 cfg80211_ready_on_channel(struct wireless_dev *wdev, uint64_t cookie,
1871 struct linuxkpi_ieee80211_channel *channel, unsigned int duration,
1872 gfp_t gfp)
1873 {
1874 TODO();
1875 }
1876
1877 static __inline void
cfg80211_remain_on_channel_expired(struct wireless_dev * wdev,uint64_t cookie,struct linuxkpi_ieee80211_channel * channel,gfp_t gfp)1878 cfg80211_remain_on_channel_expired(struct wireless_dev *wdev,
1879 uint64_t cookie, struct linuxkpi_ieee80211_channel *channel, gfp_t gfp)
1880 {
1881 TODO();
1882 }
1883
1884 static __inline void
cfg80211_report_wowlan_wakeup(void)1885 cfg80211_report_wowlan_wakeup(void)
1886 {
1887 TODO();
1888 }
1889
1890 static __inline void
cfg80211_roamed(struct net_device * ndev,struct cfg80211_roam_info * roam_info,gfp_t gfp)1891 cfg80211_roamed(struct net_device *ndev, struct cfg80211_roam_info *roam_info,
1892 gfp_t gfp)
1893 {
1894 TODO();
1895 }
1896
1897 static __inline void
cfg80211_rx_mgmt(struct wireless_dev * wdev,int freq,int _x,uint8_t * p,size_t p_len,int _x2)1898 cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int _x,
1899 uint8_t *p, size_t p_len, int _x2)
1900 {
1901 TODO();
1902 }
1903
1904 static __inline void
cfg80211_scan_done(struct cfg80211_scan_request * scan_request,struct cfg80211_scan_info * info)1905 cfg80211_scan_done(struct cfg80211_scan_request *scan_request,
1906 struct cfg80211_scan_info *info)
1907 {
1908 TODO();
1909 }
1910
1911 static __inline void
cfg80211_sched_scan_results(struct wiphy * wiphy,uint64_t reqid)1912 cfg80211_sched_scan_results(struct wiphy *wiphy, uint64_t reqid)
1913 {
1914 TODO();
1915 }
1916
1917 static __inline void
cfg80211_sched_scan_stopped(struct wiphy * wiphy,int _x)1918 cfg80211_sched_scan_stopped(struct wiphy *wiphy, int _x)
1919 {
1920 TODO();
1921 }
1922
1923 static __inline void
cfg80211_unregister_wdev(struct wireless_dev * wdev)1924 cfg80211_unregister_wdev(struct wireless_dev *wdev)
1925 {
1926 TODO();
1927 }
1928
1929 static __inline struct sk_buff *
cfg80211_vendor_cmd_alloc_reply_skb(struct wiphy * wiphy,unsigned int len)1930 cfg80211_vendor_cmd_alloc_reply_skb(struct wiphy *wiphy, unsigned int len)
1931 {
1932 TODO();
1933 return (NULL);
1934 }
1935
1936 static __inline int
cfg80211_vendor_cmd_reply(struct sk_buff * skb)1937 cfg80211_vendor_cmd_reply(struct sk_buff *skb)
1938 {
1939 TODO();
1940 return (-ENXIO);
1941 }
1942
1943 static __inline struct linuxkpi_ieee80211_channel *
ieee80211_get_channel(struct wiphy * wiphy,uint32_t freq)1944 ieee80211_get_channel(struct wiphy *wiphy, uint32_t freq)
1945 {
1946
1947 return (linuxkpi_ieee80211_get_channel(wiphy, freq));
1948 }
1949
1950 static inline size_t
ieee80211_get_hdrlen_from_skb(struct sk_buff * skb)1951 ieee80211_get_hdrlen_from_skb(struct sk_buff *skb)
1952 {
1953 const struct ieee80211_hdr *hdr;
1954 size_t len;
1955
1956 if (skb->len < 10) /* sizeof(ieee80211_frame_[ack,cts]) */
1957 return (0);
1958
1959 hdr = (const struct ieee80211_hdr *)skb->data;
1960 len = ieee80211_hdrlen(hdr->frame_control);
1961
1962 /* If larger than what is in the skb return. */
1963 if (len > skb->len)
1964 return (0);
1965
1966 return (len);
1967 }
1968
1969 static __inline bool
cfg80211_channel_is_psc(struct linuxkpi_ieee80211_channel * channel)1970 cfg80211_channel_is_psc(struct linuxkpi_ieee80211_channel *channel)
1971 {
1972
1973 /* Only 6Ghz. */
1974 if (channel->band != NL80211_BAND_6GHZ)
1975 return (false);
1976
1977 TODO();
1978 return (false);
1979 }
1980
1981 static inline int
cfg80211_get_ies_channel_number(const uint8_t * ie,size_t len,enum nl80211_band band)1982 cfg80211_get_ies_channel_number(const uint8_t *ie, size_t len,
1983 enum nl80211_band band)
1984 {
1985 const struct element *elem;
1986
1987 switch (band) {
1988 case NL80211_BAND_6GHZ:
1989 TODO();
1990 break;
1991 case NL80211_BAND_5GHZ:
1992 case NL80211_BAND_2GHZ:
1993 /* DSPARAMS has the channel number. */
1994 elem = cfg80211_find_elem(IEEE80211_ELEMID_DSPARMS, ie, len);
1995 if (elem != NULL && elem->datalen == 1)
1996 return (elem->data[0]);
1997 /* HTINFO has the primary center channel. */
1998 elem = cfg80211_find_elem(IEEE80211_ELEMID_HTINFO, ie, len);
1999 if (elem != NULL &&
2000 elem->datalen >= (sizeof(struct ieee80211_ie_htinfo) - 2)) {
2001 const struct ieee80211_ie_htinfo *htinfo;
2002 htinfo = (const struct ieee80211_ie_htinfo *)elem;
2003 return (htinfo->hi_ctrlchannel);
2004 }
2005 /* What else? */
2006 break;
2007 default:
2008 IMPROVE("Unsupported");
2009 break;
2010 }
2011 return (-1);
2012 }
2013
2014 /* Used for scanning at least. */
2015 static __inline void
get_random_mask_addr(uint8_t * dst,const uint8_t * addr,const uint8_t * mask)2016 get_random_mask_addr(uint8_t *dst, const uint8_t *addr, const uint8_t *mask)
2017 {
2018 int i;
2019
2020 /* Get a completely random address and then overlay what we want. */
2021 get_random_bytes(dst, ETH_ALEN);
2022 for (i = 0; i < ETH_ALEN; i++)
2023 dst[i] = (dst[i] & ~(mask[i])) | (addr[i] & mask[i]);
2024 }
2025
2026 static __inline void
cfg80211_shutdown_all_interfaces(struct wiphy * wiphy)2027 cfg80211_shutdown_all_interfaces(struct wiphy *wiphy)
2028 {
2029 TODO();
2030 }
2031
2032 static __inline bool
cfg80211_reg_can_beacon(struct wiphy * wiphy,struct cfg80211_chan_def * chandef,enum nl80211_iftype iftype)2033 cfg80211_reg_can_beacon(struct wiphy *wiphy, struct cfg80211_chan_def *chandef,
2034 enum nl80211_iftype iftype)
2035 {
2036 TODO();
2037 return (false);
2038 }
2039
2040 static __inline void
cfg80211_background_radar_event(struct wiphy * wiphy,struct cfg80211_chan_def * chandef,gfp_t gfp)2041 cfg80211_background_radar_event(struct wiphy *wiphy,
2042 struct cfg80211_chan_def *chandef, gfp_t gfp)
2043 {
2044 TODO();
2045 }
2046
2047 static __inline const uint8_t *
cfg80211_find_ext_ie(uint8_t eid,const uint8_t * p,size_t len)2048 cfg80211_find_ext_ie(uint8_t eid, const uint8_t *p, size_t len)
2049 {
2050 TODO();
2051 return (NULL);
2052 }
2053
2054 static inline void
_ieee80211_set_sband_iftype_data(struct ieee80211_supported_band * band,struct ieee80211_sband_iftype_data * iftype_data,size_t nitems)2055 _ieee80211_set_sband_iftype_data(struct ieee80211_supported_band *band,
2056 struct ieee80211_sband_iftype_data *iftype_data, size_t nitems)
2057 {
2058 band->iftype_data = iftype_data;
2059 band->n_iftype_data = nitems;
2060 }
2061
2062 static inline const struct ieee80211_sband_iftype_data *
ieee80211_get_sband_iftype_data(const struct ieee80211_supported_band * band,enum nl80211_iftype iftype)2063 ieee80211_get_sband_iftype_data(const struct ieee80211_supported_band *band,
2064 enum nl80211_iftype iftype)
2065 {
2066 const struct ieee80211_sband_iftype_data *iftype_data;
2067 int i;
2068
2069 for (i = 0; i < band->n_iftype_data; i++) {
2070 iftype_data = (const void *)&band->iftype_data[i];
2071 if (iftype_data->types_mask & BIT(iftype))
2072 return (iftype_data);
2073 }
2074
2075 return (NULL);
2076 }
2077
2078 static inline const struct ieee80211_sta_he_cap *
ieee80211_get_he_iftype_cap(const struct ieee80211_supported_band * band,enum nl80211_iftype iftype)2079 ieee80211_get_he_iftype_cap(const struct ieee80211_supported_band *band,
2080 enum nl80211_iftype iftype)
2081 {
2082 const struct ieee80211_sband_iftype_data *iftype_data;
2083 const struct ieee80211_sta_he_cap *he_cap;
2084
2085 iftype_data = ieee80211_get_sband_iftype_data(band, iftype);
2086 if (iftype_data == NULL)
2087 return (NULL);
2088
2089 he_cap = NULL;
2090 if (iftype_data->he_cap.has_he)
2091 he_cap = &iftype_data->he_cap;
2092
2093 return (he_cap);
2094 }
2095
2096 static inline const struct ieee80211_sta_eht_cap *
ieee80211_get_eht_iftype_cap(const struct ieee80211_supported_band * band,enum nl80211_iftype iftype)2097 ieee80211_get_eht_iftype_cap(const struct ieee80211_supported_band *band,
2098 enum nl80211_iftype iftype)
2099 {
2100 const struct ieee80211_sband_iftype_data *iftype_data;
2101 const struct ieee80211_sta_eht_cap *eht_cap;
2102
2103 iftype_data = ieee80211_get_sband_iftype_data(band, iftype);
2104 if (iftype_data == NULL)
2105 return (NULL);
2106
2107 eht_cap = NULL;
2108 if (iftype_data->eht_cap.has_eht)
2109 eht_cap = &iftype_data->eht_cap;
2110
2111 return (eht_cap);
2112 }
2113
2114 static inline bool
cfg80211_ssid_eq(struct cfg80211_ssid * ssid1,struct cfg80211_ssid * ssid2)2115 cfg80211_ssid_eq(struct cfg80211_ssid *ssid1, struct cfg80211_ssid *ssid2)
2116 {
2117 int error;
2118
2119 if (ssid1 == NULL || ssid2 == NULL) /* Can we KASSERT this? */
2120 return (false);
2121
2122 if (ssid1->ssid_len != ssid2->ssid_len)
2123 return (false);
2124 error = memcmp(ssid1->ssid, ssid2->ssid, ssid2->ssid_len);
2125 if (error != 0)
2126 return (false);
2127 return (true);
2128 }
2129
2130 static inline void
cfg80211_rx_unprot_mlme_mgmt(struct net_device * ndev,const uint8_t * hdr,uint32_t len)2131 cfg80211_rx_unprot_mlme_mgmt(struct net_device *ndev, const uint8_t *hdr,
2132 uint32_t len)
2133 {
2134 TODO();
2135 }
2136
2137 static inline const struct wiphy_iftype_ext_capab *
cfg80211_get_iftype_ext_capa(struct wiphy * wiphy,enum nl80211_iftype iftype)2138 cfg80211_get_iftype_ext_capa(struct wiphy *wiphy, enum nl80211_iftype iftype)
2139 {
2140
2141 TODO();
2142 return (NULL);
2143 }
2144
2145 static inline int
cfg80211_external_auth_request(struct net_device * ndev,struct cfg80211_external_auth_params * params,gfp_t gfp)2146 cfg80211_external_auth_request(struct net_device *ndev,
2147 struct cfg80211_external_auth_params *params, gfp_t gfp)
2148 {
2149 TODO();
2150 return (-ENXIO);
2151 }
2152
2153 static inline uint16_t
ieee80211_get_he_6ghz_capa(const struct ieee80211_supported_band * sband,enum nl80211_iftype iftype)2154 ieee80211_get_he_6ghz_capa(const struct ieee80211_supported_band *sband,
2155 enum nl80211_iftype iftype)
2156 {
2157 TODO();
2158 return (0);
2159 }
2160
2161 static __inline ssize_t
wiphy_locked_debugfs_read(struct wiphy * wiphy,struct file * file,char * buf,size_t bufsize,const char __user * userbuf,size_t count,loff_t * ppos,ssize_t (* handler)(struct wiphy *,struct file *,char *,size_t,void *),void * data)2162 wiphy_locked_debugfs_read(struct wiphy *wiphy, struct file *file,
2163 char *buf, size_t bufsize, const char __user *userbuf, size_t count,
2164 loff_t *ppos,
2165 ssize_t (*handler)(struct wiphy *, struct file *, char *, size_t, void *),
2166 void *data)
2167 {
2168 TODO();
2169 return (-ENXIO);
2170 }
2171
2172
2173 static __inline ssize_t
wiphy_locked_debugfs_write(struct wiphy * wiphy,struct file * file,char * buf,size_t bufsize,const char __user * userbuf,size_t count,ssize_t (* handler)(struct wiphy *,struct file *,char *,size_t,void *),void * data)2174 wiphy_locked_debugfs_write(struct wiphy *wiphy, struct file *file,
2175 char *buf, size_t bufsize, const char __user *userbuf, size_t count,
2176 ssize_t (*handler)(struct wiphy *, struct file *, char *, size_t, void *),
2177 void *data)
2178 {
2179 TODO();
2180 return (-ENXIO);
2181 }
2182
2183 static inline void
cfg80211_cqm_rssi_notify(struct net_device * dev,enum nl80211_cqm_rssi_threshold_event rssi_te,int32_t rssi,gfp_t gfp)2184 cfg80211_cqm_rssi_notify(struct net_device *dev,
2185 enum nl80211_cqm_rssi_threshold_event rssi_te, int32_t rssi, gfp_t gfp)
2186 {
2187 TODO();
2188 }
2189
2190 /* -------------------------------------------------------------------------- */
2191
2192 static inline void
wiphy_work_init(struct wiphy_work * wwk,wiphy_work_fn fn)2193 wiphy_work_init(struct wiphy_work *wwk, wiphy_work_fn fn)
2194 {
2195 INIT_LIST_HEAD(&wwk->entry);
2196 wwk->fn = fn;
2197 }
2198
2199 static inline void
wiphy_work_queue(struct wiphy * wiphy,struct wiphy_work * wwk)2200 wiphy_work_queue(struct wiphy *wiphy, struct wiphy_work *wwk)
2201 {
2202 linuxkpi_wiphy_work_queue(wiphy, wwk);
2203 }
2204
2205 static inline void
wiphy_work_cancel(struct wiphy * wiphy,struct wiphy_work * wwk)2206 wiphy_work_cancel(struct wiphy *wiphy, struct wiphy_work *wwk)
2207 {
2208 linuxkpi_wiphy_work_cancel(wiphy, wwk);
2209 }
2210
2211 static inline void
wiphy_work_flush(struct wiphy * wiphy,struct wiphy_work * wwk)2212 wiphy_work_flush(struct wiphy *wiphy, struct wiphy_work *wwk)
2213 {
2214 linuxkpi_wiphy_work_flush(wiphy, wwk);
2215 }
2216
2217 static inline void
wiphy_delayed_work_init(struct wiphy_delayed_work * wdwk,wiphy_work_fn fn)2218 wiphy_delayed_work_init(struct wiphy_delayed_work *wdwk, wiphy_work_fn fn)
2219 {
2220 wiphy_work_init(&wdwk->work, fn);
2221 timer_setup(&wdwk->timer, lkpi_wiphy_delayed_work_timer, 0);
2222 }
2223
2224 static inline void
wiphy_delayed_work_queue(struct wiphy * wiphy,struct wiphy_delayed_work * wdwk,unsigned long delay)2225 wiphy_delayed_work_queue(struct wiphy *wiphy, struct wiphy_delayed_work *wdwk,
2226 unsigned long delay)
2227 {
2228 linuxkpi_wiphy_delayed_work_queue(wiphy, wdwk, delay);
2229 }
2230
2231 static inline void
wiphy_delayed_work_cancel(struct wiphy * wiphy,struct wiphy_delayed_work * wdwk)2232 wiphy_delayed_work_cancel(struct wiphy *wiphy, struct wiphy_delayed_work *wdwk)
2233 {
2234 linuxkpi_wiphy_delayed_work_cancel(wiphy, wdwk);
2235 }
2236
2237 static inline void
wiphy_delayed_work_flush(struct wiphy * wiphy,struct wiphy_delayed_work * wdwk)2238 wiphy_delayed_work_flush(struct wiphy *wiphy, struct wiphy_delayed_work *wdwk)
2239 {
2240 linuxkpi_wiphy_delayed_work_flush(wiphy, wdwk);
2241 }
2242
2243 /* -------------------------------------------------------------------------- */
2244
2245 #define wiphy_err(_wiphy, _fmt, ...) \
2246 dev_err((_wiphy)->dev, _fmt, __VA_ARGS__)
2247 #define wiphy_info(wiphy, fmt, ...) \
2248 dev_info((wiphy)->dev, fmt, ##__VA_ARGS__)
2249 #define wiphy_info_once(wiphy, fmt, ...) \
2250 dev_info_once((wiphy)->dev, fmt, ##__VA_ARGS__)
2251
2252 #ifndef LINUXKPI_NET80211
2253 #define ieee80211_channel linuxkpi_ieee80211_channel
2254 #define ieee80211_regdomain linuxkpi_ieee80211_regdomain
2255 #endif
2256
2257 #include <net/mac80211.h>
2258
2259 #endif /* _LINUXKPI_NET_CFG80211_H */
2260