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