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