Merge tag 'pm-6.16-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
[linux-2.6-block.git] / net / mac80211 / ieee80211_i.h
CommitLineData
d2912cb1 1/* SPDX-License-Identifier: GPL-2.0-only */
f0706e82
JB
2/*
3 * Copyright 2002-2005, Instant802 Networks, Inc.
4 * Copyright 2005, Devicescape Software, Inc.
5 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
026331c4 6 * Copyright 2007-2010 Johannes Berg <johannes@sipsolutions.net>
42bd20d9 7 * Copyright 2013-2015 Intel Mobile Communications GmbH
a096a860 8 * Copyright (C) 2018-2025 Intel Corporation
f0706e82
JB
9 */
10
11#ifndef IEEE80211_I_H
12#define IEEE80211_I_H
13
14#include <linux/kernel.h>
15#include <linux/device.h>
16#include <linux/if_ether.h>
17#include <linux/interrupt.h>
18#include <linux/list.h>
19#include <linux/netdevice.h>
20#include <linux/skbuff.h>
21#include <linux/workqueue.h>
22#include <linux/types.h>
23#include <linux/spinlock.h>
571ecf67 24#include <linux/etherdevice.h>
e1e54068 25#include <linux/leds.h>
a729cff8 26#include <linux/idr.h>
7bedd0cf 27#include <linux/rhashtable.h>
779969e3 28#include <linux/rbtree.h>
39dc8b8e 29#include <kunit/visibility.h>
fe7a5d5c 30#include <net/ieee80211_radiotap.h>
93da9cc1 31#include <net/cfg80211.h>
51cb6db0 32#include <net/mac80211.h>
fa962b92 33#include <net/fq.h>
2c8dccc7 34#include "key.h"
f0706e82 35#include "sta_info.h"
bdcbd8e0 36#include "debug.h"
baa951a1 37#include "drop.h"
f0706e82 38
3beea351
JB
39extern const struct cfg80211_ops mac80211_config_ops;
40
9cfb0009 41struct ieee80211_local;
d5edb9ae 42struct ieee80211_mesh_fast_tx;
f0706e82
JB
43
44/* Maximum number of broadcast/multicast frames to buffer when some of the
45 * associated stations are using power saving. */
46#define AP_MAX_BC_BUFFER 128
47
48/* Maximum number of frames buffered to all STAs, including multicast frames.
49 * Note: increasing this limit increases the potential memory requirement. Each
50 * frame can be up to about 2 kB long. */
51#define TOTAL_MAX_TX_BUFFER 512
52
53/* Required encryption head and tailroom */
54#define IEEE80211_ENCRYPT_HEADROOM 8
765cb46a 55#define IEEE80211_ENCRYPT_TAILROOM 18
f0706e82 56
1ea6f9c0
JB
57/* power level hasn't been configured (or set to automatic) */
58#define IEEE80211_UNSET_POWER_LEVEL INT_MIN
59
d6a4ed6f 60/*
aa75ebc2
MK
61 * Some APs experience problems when working with U-APSD. Decreasing the
62 * probability of that happening by using legacy mode for all ACs but VO isn't
63 * enough.
64 *
65 * Cisco 4410N originally forced us to enable VO by default only because it
66 * treated non-VO ACs as legacy.
67 *
68 * However some APs (notably Netgear R7000) silently reclassify packets to
69 * different ACs. Since u-APSD ACs require trigger frames for frame retrieval
70 * clients would never see some frames (e.g. ARP responses) or would fetch them
71 * accidentally after a long time.
72 *
73 * It makes little sense to enable u-APSD queues by default because it needs
74 * userspace applications to be aware of it to actually take advantage of the
75 * possible additional powersavings. Implicitly depending on driver autotrigger
76 * frame support doesn't make much sense.
d6a4ed6f 77 */
aa75ebc2 78#define IEEE80211_DEFAULT_UAPSD_QUEUES 0
ab13315a
KV
79
80#define IEEE80211_DEFAULT_MAX_SP_LEN \
81 IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL
82
f438ceb8
EG
83extern const u8 ieee80211_ac_to_qos_mask[IEEE80211_NUM_ACS];
84
6ae16775
AQ
85#define IEEE80211_DEAUTH_FRAME_LEN (24 /* hdr */ + 2 /* reason */)
86
167e33f4
AB
87#define IEEE80211_MAX_NAN_INSTANCE_ID 255
88
f498f6ab
JB
89enum ieee80211_status_data {
90 IEEE80211_STATUS_TYPE_MASK = 0x00f,
91 IEEE80211_STATUS_TYPE_INVALID = 0,
e3640a82 92 IEEE80211_STATUS_TYPE_SMPS = 1,
a17a58ad 93 IEEE80211_STATUS_TYPE_NEG_TTLM = 2,
21e29016 94 IEEE80211_STATUS_SUBDATA_MASK = 0x1ff0,
f498f6ab 95};
8ccc0702 96
ea855f0b
DA
97static inline bool
98ieee80211_sta_keep_active(struct sta_info *sta, u8 ac)
99{
100 /* Keep a station's queues on the active list for deficit accounting
101 * purposes if it was active or queued during the last 100ms.
102 */
103 return time_before_eq(jiffies, sta->airtime[ac].last_active + HZ / 10);
104}
8ccc0702 105
c2b13452 106struct ieee80211_bss {
ef429dad 107 u32 device_ts_beacon, device_ts_presp;
8c358bcd 108
43ac2ca3 109 bool wmm_used;
ab13315a 110 bool uapsd_supported;
00d3f14c 111
f0706e82
JB
112#define IEEE80211_MAX_SUPP_RATES 32
113 u8 supp_rates[IEEE80211_MAX_SUPP_RATES];
114 size_t supp_rates_len;
817cee76 115 struct ieee80211_rate *beacon_rate;
f0706e82 116
2a333a0d
JB
117 u32 vht_cap_info;
118
00d3f14c 119 /*
25985edc 120 * During association, we save an ERP value from a probe response so
5628221c
DD
121 * that we can feed ERP info to the driver when handling the
122 * association completes. these fields probably won't be up-to-date
00d3f14c
JB
123 * otherwise, you probably don't want to use them.
124 */
125 bool has_erp_value;
5628221c 126 u8 erp_value;
fcff4f10
PS
127
128 /* Keep track of the corruption of the last beacon/probe response. */
129 u8 corrupt_data;
130
131 /* Keep track of what bits of information we have valid info for. */
132 u8 valid_data;
133};
134
135/**
774f8841 136 * enum ieee80211_bss_corrupt_data_flags - BSS data corruption flags
fcff4f10
PS
137 * @IEEE80211_BSS_CORRUPT_BEACON: last beacon frame received was corrupted
138 * @IEEE80211_BSS_CORRUPT_PROBE_RESP: last probe response received was corrupted
139 *
140 * These are bss flags that are attached to a bss in the
141 * @corrupt_data field of &struct ieee80211_bss.
142 */
143enum ieee80211_bss_corrupt_data_flags {
144 IEEE80211_BSS_CORRUPT_BEACON = BIT(0),
145 IEEE80211_BSS_CORRUPT_PROBE_RESP = BIT(1)
146};
147
148/**
774f8841 149 * enum ieee80211_bss_valid_data_flags - BSS valid data flags
fcff4f10
PS
150 * @IEEE80211_BSS_VALID_WMM: WMM/UAPSD data was gathered from non-corrupt IE
151 * @IEEE80211_BSS_VALID_RATES: Supported rates were gathered from non-corrupt IE
152 * @IEEE80211_BSS_VALID_ERP: ERP flag was gathered from non-corrupt IE
153 *
154 * These are bss flags that are attached to a bss in the
155 * @valid_data field of &struct ieee80211_bss. They show which parts
d070f913 156 * of the data structure were received as a result of an un-corrupted
fcff4f10
PS
157 * beacon/probe response.
158 */
159enum ieee80211_bss_valid_data_flags {
fcff4f10
PS
160 IEEE80211_BSS_VALID_WMM = BIT(1),
161 IEEE80211_BSS_VALID_RATES = BIT(2),
162 IEEE80211_BSS_VALID_ERP = BIT(3)
f0706e82
JB
163};
164
9efeccac 165typedef unsigned __bitwise ieee80211_tx_result;
9ae54c84
JB
166#define TX_CONTINUE ((__force ieee80211_tx_result) 0u)
167#define TX_DROP ((__force ieee80211_tx_result) 1u)
168#define TX_QUEUED ((__force ieee80211_tx_result) 2u)
169
5cf121c3
JB
170#define IEEE80211_TX_UNICAST BIT(1)
171#define IEEE80211_TX_PS_BUFFERED BIT(2)
5cf121c3
JB
172
173struct ieee80211_tx_data {
174 struct sk_buff *skb;
252b86c4 175 struct sk_buff_head skbs;
5cf121c3
JB
176 struct ieee80211_local *local;
177 struct ieee80211_sub_if_data *sdata;
178 struct sta_info *sta;
5cf121c3 179 struct ieee80211_key *key;
0d528d85 180 struct ieee80211_tx_rate rate;
5cf121c3 181
056cdd59 182 unsigned int flags;
5cf121c3
JB
183};
184
554891e6
JB
185/**
186 * enum ieee80211_packet_rx_flags - packet RX flags
554891e6
JB
187 * @IEEE80211_RX_AMSDU: a-MSDU packet
188 * @IEEE80211_RX_MALFORMED_ACTION_FRM: action frame is malformed
4cfda47b 189 * @IEEE80211_RX_DEFERRED_RELEASE: frame was subjected to receive reordering
554891e6
JB
190 *
191 * These are per-frame flags that are attached to a frame in the
192 * @rx_flags field of &struct ieee80211_rx_status.
193 */
194enum ieee80211_packet_rx_flags {
554891e6
JB
195 IEEE80211_RX_AMSDU = BIT(3),
196 IEEE80211_RX_MALFORMED_ACTION_FRM = BIT(4),
4cfda47b 197 IEEE80211_RX_DEFERRED_RELEASE = BIT(5),
554891e6
JB
198};
199
200/**
201 * enum ieee80211_rx_flags - RX data flags
202 *
ee971924
JB
203 * @IEEE80211_RX_BEACON_REPORTED: This frame was already reported
204 * to cfg80211_report_obss_beacon().
554891e6
JB
205 *
206 * These flags are used across handling multiple interfaces
207 * for a single frame.
208 */
209enum ieee80211_rx_flags {
286e6967 210 IEEE80211_RX_BEACON_REPORTED = BIT(0),
554891e6 211};
5cf121c3
JB
212
213struct ieee80211_rx_data {
c5d1686b 214 struct list_head *list;
f0706e82 215 struct sk_buff *skb;
f0706e82
JB
216 struct ieee80211_local *local;
217 struct ieee80211_sub_if_data *sdata;
56057da4 218 struct ieee80211_link_data *link;
f0706e82 219 struct sta_info *sta;
ccdde7c7 220 struct link_sta_info *link_sta;
f0706e82 221 struct ieee80211_key *key;
056cdd59 222
056cdd59 223 unsigned int flags;
9e26297a
JB
224
225 /*
226 * Index into sequence numbers array, 0..16
227 * since the last (16) is used for non-QoS,
228 * will be 16 on non-QoS frames.
229 */
230 int seqno_idx;
231
232 /*
233 * Index into the security IV/PN arrays, 0..16
234 * since the last (16) is used for CCMP-encrypted
235 * management frames, will be set to 16 on mgmt
236 * frames and 0 on non-QoS frames.
237 */
238 int security_idx;
239
892b3bce
JB
240 int link_id;
241
bf30ca92
JB
242 union {
243 struct {
244 u32 iv32;
245 u16 iv16;
246 } tkip;
247 struct {
248 u8 pn[IEEE80211_CCMP_PN_LEN];
249 } ccm_gcm;
250 };
f0706e82
JB
251};
252
af296bdb
MK
253struct ieee80211_csa_settings {
254 const u16 *counter_offsets_beacon;
255 const u16 *counter_offsets_presp;
256
257 int n_counter_offsets_beacon;
258 int n_counter_offsets_presp;
259
260 u8 count;
261};
262
5f9404ab
JC
263struct ieee80211_color_change_settings {
264 u16 counter_offset_beacon;
265 u16 counter_offset_presp;
266 u8 count;
267};
268
5dfdaf58
JB
269struct beacon_data {
270 u8 *head, *tail;
271 int head_len, tail_len;
43552be1 272 struct ieee80211_meshconf_ie *meshconf;
8552a434
JC
273 u16 cntdwn_counter_offsets[IEEE80211_MAX_CNTDWN_COUNTERS_NUM];
274 u8 cntdwn_current_counter;
2b3171c6 275 struct cfg80211_mbssid_elems *mbssid_ies;
68b9bea2 276 struct cfg80211_rnr_elems *rnr_ies;
8860020e 277 struct rcu_head rcu_head;
5dfdaf58
JB
278};
279
aa7a0080
ES
280struct probe_resp {
281 struct rcu_head rcu_head;
282 int len;
8552a434 283 u16 cntdwn_counter_offsets[IEEE80211_MAX_CNTDWN_COUNTERS_NUM];
3c23215b 284 u8 data[];
aa7a0080
ES
285};
286
295b02c4
AD
287struct fils_discovery_data {
288 struct rcu_head rcu_head;
289 int len;
290 u8 data[];
291};
292
632189a0
AD
293struct unsol_bcast_probe_resp_data {
294 struct rcu_head rcu_head;
295 int len;
296 u8 data[];
297};
298
d012a605 299struct ps_data {
f0706e82
JB
300 /* yes, this looks ugly, but guarantees that we can later use
301 * bitmap_empty :)
004c872e 302 * NB: don't touch this bitmap, use sta_info_{set,clear}_tim_bit */
5fe2bb86
JP
303 u8 tim[sizeof(unsigned long) * BITS_TO_LONGS(IEEE80211_MAX_AID + 1)]
304 __aligned(__alignof__(unsigned long));
d012a605 305 struct sk_buff_head bc_buf;
056cdd59 306 atomic_t num_sta_ps; /* number of stations in PS mode */
5dfdaf58 307 int dtim_count;
512119b3 308 bool dtim_bc_mc;
f0706e82
JB
309};
310
d012a605 311struct ieee80211_if_ap {
4e141dad 312 struct list_head vlans; /* write-protected with RTNL and local->mtx */
d012a605
MP
313
314 struct ps_data ps;
315 atomic_t num_mcast_sta; /* number of stations receiving multicast */
687da132 316
ebceec86 317 bool multicast_to_unicast;
bfd8403a 318 bool active;
d012a605
MP
319};
320
f0706e82 321struct ieee80211_if_vlan {
4e141dad 322 struct list_head list; /* write-protected with RTNL and local->mtx */
f14543ee
FF
323
324 /* used for all tx if the VLAN is configured to 4-addr mode */
40b275b6 325 struct sta_info __rcu *sta;
72f15d53 326 atomic_t num_mcast_sta; /* number of stations receiving multicast */
f0706e82
JB
327};
328
ee385855 329struct mesh_stats {
c8a61a7d
DW
330 __u32 fwded_mcast; /* Mesh forwarded multicast frames */
331 __u32 fwded_unicast; /* Mesh forwarded unicast frames */
332 __u32 fwded_frames; /* Mesh total forwarded frames */
ee385855
LCC
333 __u32 dropped_frames_ttl; /* Not transmitted since mesh_ttl == 0*/
334 __u32 dropped_frames_no_route; /* Not transmitted, no route found */
ee385855
LCC
335};
336
337#define PREQ_Q_F_START 0x1
338#define PREQ_Q_F_REFRESH 0x2
339struct mesh_preq_queue {
340 struct list_head list;
341 u8 dst[ETH_ALEN];
342 u8 flags;
343};
344
2eb278e0 345struct ieee80211_roc_work {
77fdaa12 346 struct list_head list;
af6b6374
JB
347
348 struct ieee80211_sub_if_data *sdata;
349
f679f65d 350 struct ieee80211_channel *chan;
af6b6374 351
2eb278e0 352 bool started, abort, hw_begun, notified;
b4b177a5 353 bool on_channel;
f679f65d 354
aaa016cc 355 unsigned long start_time;
e4da8c37 356
2eb278e0
JB
357 u32 duration, req_duration;
358 struct sk_buff *frame;
50febf6a 359 u64 cookie, mgmt_tx_cookie;
d339d5ca 360 enum ieee80211_roc_type type;
77fdaa12
JB
361};
362
46900298 363/* flags used in struct ieee80211_if_managed.flags */
ab1faead 364enum ieee80211_sta_flags {
b291ba11
JB
365 IEEE80211_STA_CONNECTION_POLL = BIT(1),
366 IEEE80211_STA_CONTROL_PORT = BIT(2),
b291ba11 367 IEEE80211_STA_MFP_ENABLED = BIT(6),
ab13315a 368 IEEE80211_STA_UAPSD_ENABLED = BIT(7),
375177bf 369 IEEE80211_STA_NULLFUNC_ACKED = BIT(8),
cd2f5dd7 370 IEEE80211_STA_ENABLE_RRM = BIT(15),
ba323e29
JB
371};
372
310c8387
JB
373enum ieee80211_conn_mode {
374 IEEE80211_CONN_MODE_S1G,
375 IEEE80211_CONN_MODE_LEGACY,
376 IEEE80211_CONN_MODE_HT,
377 IEEE80211_CONN_MODE_VHT,
378 IEEE80211_CONN_MODE_HE,
379 IEEE80211_CONN_MODE_EHT,
ab1faead
JB
380};
381
310c8387
JB
382#define IEEE80211_CONN_MODE_HIGHEST IEEE80211_CONN_MODE_EHT
383
384enum ieee80211_conn_bw_limit {
385 IEEE80211_CONN_BW_LIMIT_20,
386 IEEE80211_CONN_BW_LIMIT_40,
387 IEEE80211_CONN_BW_LIMIT_80,
388 IEEE80211_CONN_BW_LIMIT_160, /* also 80+80 */
389 IEEE80211_CONN_BW_LIMIT_320,
390};
391
392struct ieee80211_conn_settings {
393 enum ieee80211_conn_mode mode;
394 enum ieee80211_conn_bw_limit bw_limit;
395};
396
397extern const struct ieee80211_conn_settings ieee80211_conn_settings_unlimited;
398
66e67e41
JB
399struct ieee80211_mgd_auth_data {
400 struct cfg80211_bss *bss;
401 unsigned long timeout;
402 int tries;
403 u16 algorithm, expected_transaction;
404
8ee0b202
BB
405 unsigned long userspace_selectors[BITS_TO_LONGS(128)];
406
66e67e41
JB
407 u8 key[WLAN_KEY_LEN_WEP104];
408 u8 key_len, key_idx;
94d9864c 409 bool done, waiting;
efb543e6 410 bool peer_confirmed;
89afe614 411 bool timeout_started;
85176a3f 412 int link_id;
66e67e41 413
81151ce4
JB
414 u8 ap_addr[ETH_ALEN] __aligned(2);
415
6b8ece3a
JM
416 u16 sae_trans, sae_status;
417 size_t data_len;
418 u8 data[];
66e67e41
JB
419};
420
421struct ieee80211_mgd_assoc_data {
81151ce4
JB
422 struct {
423 struct cfg80211_bss *bss;
424
425 u8 addr[ETH_ALEN] __aligned(2);
426
427 u8 ap_ht_param;
428
429 struct ieee80211_vht_cap ap_vht_cap;
430
431 size_t elems_len;
432 u8 *elems; /* pointing to inside ie[] below */
433
310c8387 434 struct ieee80211_conn_settings conn;
c2d052a3
IP
435
436 u16 status;
6d543b34
IP
437
438 bool disabled;
81151ce4
JB
439 } link[IEEE80211_MLD_MAX_NUM_LINKS];
440
441 u8 ap_addr[ETH_ALEN] __aligned(2);
442
443 /* this is for a workaround, so we use it only for non-MLO */
66e67e41 444 const u8 *supp_rates;
81151ce4 445 u8 supp_rates_len;
66e67e41
JB
446
447 unsigned long timeout;
448 int tries;
449
81151ce4 450 u8 prev_ap_addr[ETH_ALEN];
66e67e41
JB
451 u8 ssid[IEEE80211_MAX_SSID_LEN];
452 u8 ssid_len;
76f0303d 453 bool wmm, uapsd;
989c6505 454 bool need_beacon;
66e67e41 455 bool synced;
89afe614 456 bool timeout_started;
b133fdf0 457 bool comeback; /* whether the AP has requested association comeback */
81151ce4 458 bool s1g;
3b220ed8 459 bool spp_amsdu;
66e67e41 460
c3171bed 461 s8 assoc_link_id;
b08fbbd8 462
96d4311c
JB
463 __le16 ext_mld_capa_ops;
464
39404fee
JM
465 u8 fils_nonces[2 * FILS_NONCE_LEN];
466 u8 fils_kek[FILS_MAX_KEK_LEN];
467 size_t fils_kek_len;
468
66e67e41 469 size_t ie_len;
81151ce4 470 u8 *ie_pos; /* used to fill ie[] with link[].elems */
66e67e41
JB
471 u8 ie[];
472};
473
02219b3a
JB
474struct ieee80211_sta_tx_tspec {
475 /* timestamp of the first packet in the time slice */
476 unsigned long time_slice_start;
477
478 u32 admitted_time; /* in usecs, unlike over the air */
479 u8 tsid;
480 s8 up; /* signed to be able to invalidate with -1 during teardown */
481
482 /* consumed TX time in microseconds in the time slice */
483 u32 consumed_tx_time;
484 enum {
485 TX_TSPEC_ACTION_NONE = 0,
486 TX_TSPEC_ACTION_DOWNGRADE,
487 TX_TSPEC_ACTION_STOP_DOWNGRADE,
488 } action;
489 bool downgraded;
490};
491
702e8047
AB
492/* Advertised TID-to-link mapping info */
493struct ieee80211_adv_ttlm_info {
494 /* time in TUs at which the new mapping is established, or 0 if there is
495 * no planned advertised TID-to-link mapping
496 */
497 u16 switch_time;
498 u32 duration; /* duration of the planned T2L map in TUs */
499 u16 map; /* map of usable links for all TIDs */
500 bool active; /* whether the advertised mapping is active or not */
501};
502
eb1e011a 503DECLARE_EWMA(beacon_signal, 4, 4)
338c17ae 504
46900298 505struct ieee80211_if_managed {
056cdd59 506 struct timer_list timer;
b291ba11
JB
507 struct timer_list conn_mon_timer;
508 struct timer_list bcn_mon_timer;
ac2f7d6f 509 struct wiphy_work monitor_work;
4b8d43f1
JB
510 struct wiphy_work beacon_connection_loss_work;
511 struct wiphy_work csa_connection_drop_work;
46900298 512
7ccc8bd7 513 unsigned long beacon_timeout;
b291ba11 514 unsigned long probe_timeout;
a43abf29 515 int probe_send_count;
04ac3c0e 516 bool nullfunc_failed;
3f8a39ff
JB
517 u8 connection_loss:1,
518 driver_disconnect:1,
5dfad108
JB
519 reconnect:1,
520 associated:1;
b291ba11 521
66e67e41
JB
522 struct ieee80211_mgd_auth_data *auth_data;
523 struct ieee80211_mgd_assoc_data *assoc_data;
46900298 524
80834e7d
JB
525 unsigned long userspace_selectors[BITS_TO_LONGS(128)];
526
965bedad 527 bool powersave; /* powersave requested for this iface */
05cb9108 528 bool broken_ap; /* AP is broken -- turn off powersave */
965bedad 529
d6f2da5b 530 unsigned int flags;
f0706e82 531
67625910
JB
532 u16 mcast_seq_last;
533
1672c0e3
JB
534 bool status_acked;
535 bool status_received;
536 __le16 status_fc;
537
fdfacf0a
JM
538 enum {
539 IEEE80211_MFP_DISABLED,
540 IEEE80211_MFP_OPTIONAL,
541 IEEE80211_MFP_REQUIRED
542 } mfp; /* management frame protection */
543
dc41e4d4
EP
544 /*
545 * Bitmask of enabled u-apsd queues,
546 * IEEE80211_WMM_IE_STA_QOSINFO_AC_BE & co. Needs a new association
547 * to take effect.
548 */
549 unsigned int uapsd_queues;
550
551 /*
552 * Maximum number of buffered frames AP can deliver during a
553 * service period, IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL or similar.
554 * Needs a new association to take effect.
555 */
556 unsigned int uapsd_max_sp_len;
557
9bc383de 558 u8 use_4addr;
17e4ec14 559
615f7b9b
MV
560 /*
561 * State variables for keeping track of RSSI of the AP currently
562 * connected to and informing driver when RSSI has gone
563 * below/above a certain threshold.
564 */
565 int rssi_min_thold, rssi_max_thold;
ef96a842
BG
566
567 struct ieee80211_ht_cap ht_capa; /* configured ht-cap over-rides */
568 struct ieee80211_ht_cap ht_capa_mask; /* Valid parts of ht_capa */
dd5ecfea
JB
569 struct ieee80211_vht_cap vht_capa; /* configured VHT overrides */
570 struct ieee80211_vht_cap vht_capa_mask; /* Valid parts of vht_capa */
7957c6c8
TP
571 struct ieee80211_s1g_cap s1g_capa; /* configured S1G overrides */
572 struct ieee80211_s1g_cap s1g_capa_mask; /* valid s1g_capa bits */
81dd2b88 573
1277b4a9 574 /* TDLS support */
81dd2b88 575 u8 tdls_peer[ETH_ALEN] __aligned(2);
777b2600 576 struct wiphy_delayed_work tdls_peer_del_work;
1277b4a9
LK
577 struct sk_buff *orig_teardown_skb; /* The original teardown skb */
578 struct sk_buff *teardown_skb; /* A copy to send through the AP */
579 spinlock_t teardown_lock; /* To lock changing teardown_skb */
82c0cc90 580 bool tdls_wider_bw_prohibited;
02219b3a
JB
581
582 /* WMM-AC TSPEC support */
583 struct ieee80211_sta_tx_tspec tx_tspec[IEEE80211_NUM_ACS];
584 /* Use a separate work struct so that we can do something here
585 * while the sdata->work is flushing the queues, for example.
586 * otherwise, in scenarios where we hardly get any traffic out
587 * on the BE queue, but there's a lot of VO traffic, we might
588 * get stuck in a downgraded situation and flush takes forever.
589 */
aca40a5f 590 struct wiphy_delayed_work tx_tspec_wk;
4d9ec73d
JM
591
592 /* Information elements from the last transmitted (Re)Association
593 * Request frame.
594 */
595 u8 *assoc_req_ies;
596 size_t assoc_req_ies_len;
8eb8dd2f
IP
597
598 struct wiphy_delayed_work ml_reconf_work;
599 u16 removed_links;
702e8047
AB
600
601 /* TID-to-link mapping support */
602 struct wiphy_delayed_work ttlm_work;
603 struct ieee80211_adv_ttlm_info ttlm_info;
a17a58ad 604 struct wiphy_work teardown_ttlm_work;
f7660b3f
AB
605
606 /* dialog token enumerator for neg TTLM request */
607 u8 dialog_token_alloc;
608 struct wiphy_delayed_work neg_ttlm_timeout_work;
36e05b0b
IP
609
610 /* Locally initiated multi-link reconfiguration */
611 struct {
612 struct ieee80211_mgd_assoc_data *add_links_data;
613 struct wiphy_delayed_work wk;
614 u16 removed_links;
615 u16 added_links;
616 u8 dialog_token;
617 } reconf;
de86c5f6
IP
618
619 /* Support for epcs */
620 struct {
621 bool enabled;
622 u8 dialog_token;
623 } epcs;
f0706e82
JB
624};
625
46900298
JB
626struct ieee80211_if_ibss {
627 struct timer_list timer;
87351d09 628 struct wiphy_work csa_connection_drop_work;
46900298 629
af8cdcd8 630 unsigned long last_scan_completed;
5bb644a0 631
fbd2c8dc
TP
632 u32 basic_rates;
633
af8cdcd8
JB
634 bool fixed_bssid;
635 bool fixed_channel;
fffd0934 636 bool privacy;
46900298 637
267335d6 638 bool control_port;
8e8d347d 639 bool userspace_handles_dfs;
267335d6 640
4d196e4b 641 u8 bssid[ETH_ALEN] __aligned(2);
af8cdcd8
JB
642 u8 ssid[IEEE80211_MAX_SSID_LEN];
643 u8 ssid_len, ie_len;
644 u8 *ie;
3aede78a 645 struct cfg80211_chan_def chandef;
46900298
JB
646
647 unsigned long ibss_join_req;
af8cdcd8 648 /* probe response/beacon for IBSS */
c3ffeab4 649 struct beacon_data __rcu *presp;
46900298 650
822854b0
SW
651 struct ieee80211_ht_cap ht_capa; /* configured ht-cap over-rides */
652 struct ieee80211_ht_cap ht_capa_mask; /* Valid parts of ht_capa */
653
8bf11d8d
JB
654 spinlock_t incomplete_lock;
655 struct list_head incomplete_stations;
656
46900298
JB
657 enum {
658 IEEE80211_IBSS_MLME_SEARCH,
659 IEEE80211_IBSS_MLME_JOINED,
660 } state;
661};
662
239281f8
RL
663/**
664 * struct ieee80211_if_ocb - OCB mode state
665 *
666 * @housekeeping_timer: timer for periodic invocation of a housekeeping task
667 * @wrkq_flags: OCB deferred task action
668 * @incomplete_lock: delayed STA insertion lock
669 * @incomplete_stations: list of STAs waiting for delayed insertion
670 * @joined: indication if the interface is connected to an OCB network
671 */
672struct ieee80211_if_ocb {
673 struct timer_list housekeeping_timer;
674 unsigned long wrkq_flags;
675
676 spinlock_t incomplete_lock;
677 struct list_head incomplete_stations;
678
679 bool joined;
680};
681
dbf498fb
JC
682/**
683 * struct ieee80211_mesh_sync_ops - Extensible synchronization framework interface
684 *
685 * these declarations define the interface, which enables
686 * vendor-specific mesh synchronization
687 *
799f53e2
JB
688 * @rx_bcn_presp: beacon/probe response was received
689 * @adjust_tsf: TSF adjustment method
dbf498fb 690 */
dbf498fb 691struct ieee80211_mesh_sync_ops {
a5b983c6
JB
692 void (*rx_bcn_presp)(struct ieee80211_sub_if_data *sdata, u16 stype,
693 struct ieee80211_mgmt *mgmt, unsigned int len,
694 const struct ieee80211_meshconf_ie *mesh_cfg,
dbf498fb 695 struct ieee80211_rx_status *rx_status);
43552be1
TP
696
697 /* should be called with beacon_data under RCU read lock */
445cd452
MH
698 void (*adjust_tsf)(struct ieee80211_sub_if_data *sdata,
699 struct beacon_data *beacon);
dbf498fb
JC
700 /* add other framework functions here */
701};
702
b8456a14
CYY
703struct mesh_csa_settings {
704 struct rcu_head rcu_head;
705 struct cfg80211_csa_settings settings;
706};
707
8b5cb7e4 708/**
499921d3 709 * struct mesh_table - mesh hash table
8b5cb7e4
PS
710 *
711 * @known_gates: list of known mesh gates and their mpaths by the station. The
712 * gate's mpath may or may not be resolved and active.
713 * @gates_lock: protects updates to known_gates
714 * @rhead: the rhashtable containing struct mesh_paths, keyed by dest addr
715 * @walk_head: linked list containing all mesh_path objects
716 * @walk_lock: lock protecting walk_head
717 * @entries: number of entries in the table
718 */
719struct mesh_table {
720 struct hlist_head known_gates;
721 spinlock_t gates_lock;
722 struct rhashtable rhead;
723 struct hlist_head walk_head;
724 spinlock_t walk_lock;
725 atomic_t entries; /* Up to MAX_MESH_NEIGHBOURS */
726};
727
d5edb9ae
FF
728/**
729 * struct mesh_tx_cache - mesh fast xmit header cache
730 *
731 * @rht: hash table containing struct ieee80211_mesh_fast_tx, using skb DA as key
732 * @walk_head: linked list containing all ieee80211_mesh_fast_tx objects
733 * @walk_lock: lock protecting walk_head and rht
734 */
735struct mesh_tx_cache {
736 struct rhashtable rht;
737 struct hlist_head walk_head;
738 spinlock_t walk_lock;
739};
740
472dbc45 741struct ieee80211_if_mesh {
472dbc45
JB
742 struct timer_list housekeeping_timer;
743 struct timer_list mesh_path_timer;
e304bfd3 744 struct timer_list mesh_path_root_timer;
472dbc45 745
18889231 746 unsigned long wrkq_flags;
6e48ebff 747 unsigned long mbss_changed[64 / BITS_PER_LONG];
472dbc45 748
0ab2e55d
BB
749 bool userspace_handles_dfs;
750
472dbc45
JB
751 u8 mesh_id[IEEE80211_MAX_MESH_ID_LEN];
752 size_t mesh_id_len;
753 /* Active Path Selection Protocol Identifier */
3491707a 754 u8 mesh_pp_id;
472dbc45 755 /* Active Path Selection Metric Identifier */
3491707a 756 u8 mesh_pm_id;
472dbc45 757 /* Congestion Control Mode Identifier */
3491707a 758 u8 mesh_cc_id;
9e03fdfd 759 /* Synchronization Protocol Identifier */
3491707a 760 u8 mesh_sp_id;
9e03fdfd 761 /* Authentication Protocol Identifier */
3491707a 762 u8 mesh_auth_id;
d19b3bf6
RP
763 /* Local mesh Sequence Number */
764 u32 sn;
472dbc45
JB
765 /* Last used PREQ ID */
766 u32 preq_id;
767 atomic_t mpaths;
d19b3bf6
RP
768 /* Timestamp of last SN update */
769 unsigned long last_sn_update;
dca7e943
TP
770 /* Time when it's ok to send next PERR */
771 unsigned long next_perr;
772 /* Timestamp of last PREQ sent */
472dbc45
JB
773 unsigned long last_preq;
774 struct mesh_rmc *rmc;
775 spinlock_t mesh_preq_queue_lock;
776 struct mesh_preq_queue preq_queue;
777 int preq_queue_len;
778 struct mesh_stats mshstats;
779 struct mesh_config mshcfg;
1258d976 780 atomic_t estab_plinks;
e626dad9 781 atomic_t mesh_seqnum;
472dbc45 782 bool accepting_plinks;
5ee68e5b 783 int num_gates;
2b5e1967 784 struct beacon_data __rcu *beacon;
581a8b0f
JC
785 const u8 *ie;
786 u8 ie_len;
b130e5ce
JC
787 enum {
788 IEEE80211_MESH_SEC_NONE = 0x0,
789 IEEE80211_MESH_SEC_AUTHED = 0x1,
790 IEEE80211_MESH_SEC_SECURED = 0x2,
791 } security;
a6dad6a2 792 bool user_mpm;
dbf498fb 793 /* Extensible Synchronization Framework */
8ba7acf3 794 const struct ieee80211_mesh_sync_ops *sync_ops;
dbf498fb
JC
795 s64 sync_offset_clockdrift_max;
796 spinlock_t sync_offset_lock;
3f52b7e3
MP
797 /* mesh power save */
798 enum nl80211_mesh_power_mode nonpeer_pm;
799 int ps_peers_light_sleep;
800 int ps_peers_deep_sleep;
801 struct ps_data ps;
8f2535b9 802 /* Channel Switching Support */
b8456a14 803 struct mesh_csa_settings __rcu *csa;
0cb4d4dc
LC
804 enum {
805 IEEE80211_MESH_CSA_ROLE_NONE,
806 IEEE80211_MESH_CSA_ROLE_INIT,
807 IEEE80211_MESH_CSA_ROLE_REPEATER,
808 } csa_role;
b8456a14 809 u8 chsw_ttl;
8f2535b9 810 u16 pre_value;
43552be1
TP
811
812 /* offset from skb->data while building IE */
813 int meshconf_offset;
2bdaf386 814
8b5cb7e4
PS
815 struct mesh_table mesh_paths;
816 struct mesh_table mpp_paths; /* Store paths for MPP&MAP */
2bdaf386
BC
817 int mesh_paths_generation;
818 int mpp_paths_generation;
d5edb9ae 819 struct mesh_tx_cache tx_cache;
472dbc45 820};
902acc78
JB
821
822#ifdef CONFIG_MAC80211_MESH
472dbc45
JB
823#define IEEE80211_IFSTA_MESH_CTR_INC(msh, name) \
824 do { (msh)->mshstats.name++; } while (0)
902acc78 825#else
472dbc45 826#define IEEE80211_IFSTA_MESH_CTR_INC(msh, name) \
902acc78
JB
827 do { } while (0)
828#endif
f0706e82 829
213cd118
JB
830/**
831 * enum ieee80211_sub_if_data_flags - virtual interface flags
832 *
833 * @IEEE80211_SDATA_ALLMULTI: interface wants all multicast packets
213cd118
JB
834 * @IEEE80211_SDATA_DONT_BRIDGE_PACKETS: bridge packets between
835 * associated stations and deliver multicast frames both
836 * back to wireless media and to the local net stack.
95acac61 837 * @IEEE80211_SDATA_DISCONNECT_RESUME: Disconnect after resume.
7b7eab6f 838 * @IEEE80211_SDATA_IN_DRIVER: indicates interface was added to driver
7d352ccf
YC
839 * @IEEE80211_SDATA_DISCONNECT_HW_RESTART: Disconnect after hardware restart
840 * recovery
213cd118
JB
841 */
842enum ieee80211_sub_if_data_flags {
843 IEEE80211_SDATA_ALLMULTI = BIT(0),
7986cf95 844 IEEE80211_SDATA_DONT_BRIDGE_PACKETS = BIT(3),
95acac61 845 IEEE80211_SDATA_DISCONNECT_RESUME = BIT(4),
7b7eab6f 846 IEEE80211_SDATA_IN_DRIVER = BIT(5),
7d352ccf 847 IEEE80211_SDATA_DISCONNECT_HW_RESTART = BIT(6),
213cd118
JB
848};
849
34d4bc4d
JB
850/**
851 * enum ieee80211_sdata_state_bits - virtual interface state bits
852 * @SDATA_STATE_RUNNING: virtual interface is up & running; this
853 * mirrors netif_running() but is separate for interface type
854 * change handling while the interface is up
5b714c6a
JB
855 * @SDATA_STATE_OFFCHANNEL: This interface is currently in offchannel
856 * mode, so queues are stopped
d6a83228
JB
857 * @SDATA_STATE_OFFCHANNEL_BEACON_STOPPED: Beaconing was stopped due
858 * to offchannel, reset when offchannel returns
34d4bc4d
JB
859 */
860enum ieee80211_sdata_state_bits {
861 SDATA_STATE_RUNNING,
5b714c6a 862 SDATA_STATE_OFFCHANNEL,
d6a83228 863 SDATA_STATE_OFFCHANNEL_BEACON_STOPPED,
34d4bc4d
JB
864};
865
d01a1e65
MK
866/**
867 * enum ieee80211_chanctx_mode - channel context configuration mode
868 *
869 * @IEEE80211_CHANCTX_SHARED: channel context may be used by
870 * multiple interfaces
871 * @IEEE80211_CHANCTX_EXCLUSIVE: channel context can be used
872 * only by a single interface. This can be used for example for
873 * non-fixed channel IBSS.
874 */
875enum ieee80211_chanctx_mode {
876 IEEE80211_CHANCTX_SHARED,
877 IEEE80211_CHANCTX_EXCLUSIVE
878};
879
5bcae31d
MK
880/**
881 * enum ieee80211_chanctx_replace_state - channel context replacement state
882 *
883 * This is used for channel context in-place reservations that require channel
884 * context switch/swap.
885 *
886 * @IEEE80211_CHANCTX_REPLACE_NONE: no replacement is taking place
887 * @IEEE80211_CHANCTX_WILL_BE_REPLACED: this channel context will be replaced
888 * by a (not yet registered) channel context pointed by %replace_ctx.
889 * @IEEE80211_CHANCTX_REPLACES_OTHER: this (not yet registered) channel context
890 * replaces an existing channel context pointed to by %replace_ctx.
891 */
892enum ieee80211_chanctx_replace_state {
893 IEEE80211_CHANCTX_REPLACE_NONE,
894 IEEE80211_CHANCTX_WILL_BE_REPLACED,
895 IEEE80211_CHANCTX_REPLACES_OTHER,
896};
897
d01a1e65
MK
898struct ieee80211_chanctx {
899 struct list_head list;
900 struct rcu_head rcu_head;
901
b4f85443
JB
902 struct list_head assigned_links;
903 struct list_head reserved_links;
484298ad 904
5bcae31d
MK
905 enum ieee80211_chanctx_replace_state replace_state;
906 struct ieee80211_chanctx *replace_ctx;
907
d01a1e65 908 enum ieee80211_chanctx_mode mode;
8a61af65 909 bool driver_present;
d01a1e65 910
6092077a
JB
911 /* temporary data for search algorithm etc. */
912 struct ieee80211_chan_req req;
913
bca8bc03 914 bool radar_detected;
cf44e745
GS
915
916 /* MUST be last - ends in a flexible-array member. */
917 struct ieee80211_chanctx_conf conf;
d01a1e65
MK
918};
919
32db6b54
KP
920struct mac80211_qos_map {
921 struct cfg80211_qos_map qos_map;
922 struct rcu_head rcu_head;
923};
924
ba8c3d6f
FF
925enum txq_info_flags {
926 IEEE80211_TXQ_STOP,
927 IEEE80211_TXQ_AMPDU,
6e0456b5 928 IEEE80211_TXQ_NO_AMSDU,
4444bc21 929 IEEE80211_TXQ_DIRTY,
ba8c3d6f
FF
930};
931
fa962b92
MK
932/**
933 * struct txq_info - per tid queue
934 *
935 * @tin: contains packets split into multiple flows
799f53e2
JB
936 * @def_cvars: codel vars for the @tin's default_flow
937 * @cstats: code statistics for this queue
2433647b 938 * @frags: used to keep fragments created after dequeue
942741da
FF
939 * @schedule_order: used with ieee80211_local->active_txqs
940 * @schedule_round: counter to prevent infinite loops on TXQ scheduling
799f53e2
JB
941 * @flags: TXQ flags from &enum txq_info_flags
942 * @txq: the driver visible part
fa962b92 943 */
ba8c3d6f 944struct txq_info {
fa962b92 945 struct fq_tin tin;
5caa328e 946 struct codel_vars def_cvars;
8d51dbb8 947 struct codel_stats cstats;
942741da
FF
948
949 u16 schedule_round;
950 struct list_head schedule_order;
c74025f4
JB
951
952 struct sk_buff_head frags;
942741da 953
ba8c3d6f
FF
954 unsigned long flags;
955
956 /* keep last! */
957 struct ieee80211_txq txq;
958};
959
d8212184
AE
960struct ieee80211_if_mntr {
961 u32 flags;
42bd20d9 962 u8 mu_follow_addr[ETH_ALEN] __aligned(2);
f64331d5
JB
963
964 struct list_head list;
d8212184
AE
965};
966
5953ff6d
AB
967/**
968 * struct ieee80211_if_nan - NAN state
969 *
970 * @conf: current NAN configuration
799f53e2
JB
971 * @func_lock: lock for @func_inst_ids
972 * @function_inst_ids: a bitmap of available instance_id's
5953ff6d
AB
973 */
974struct ieee80211_if_nan {
975 struct cfg80211_nan_conf conf;
167e33f4
AB
976
977 /* protects function_inst_ids */
978 spinlock_t func_lock;
979 struct idr function_inst_ids;
5953ff6d
AB
980};
981
bfd8403a
JB
982struct ieee80211_link_data_managed {
983 u8 bssid[ETH_ALEN] __aligned(2);
984
985 u8 dtim_period;
986 enum ieee80211_smps_mode req_smps, /* requested smps mode */
987 driver_smps_mode; /* smps mode request */
988
310c8387 989 struct ieee80211_conn_settings conn;
ba323e29 990
bfd8403a
JB
991 s16 p2p_noa_index;
992
ab3a830d
JB
993 bool tdls_chan_switch_prohibited;
994
bfd8403a 995 bool have_beacon;
42ed6748 996 bool tracking_signal_avg;
6359598d 997 bool disable_wmm_tracking;
39eac2de 998 bool operating_11g_mode;
bfd8403a 999
344d18ce
JB
1000 struct {
1001 struct wiphy_delayed_work switch_work;
45405681
JB
1002 struct cfg80211_chan_def ap_chandef;
1003 struct ieee80211_parsed_tpe tpe;
344d18ce
JB
1004 unsigned long time;
1005 bool waiting_bcn;
1006 bool ignored_same_chan;
1007 bool blocked_tx;
1008 } csa;
bfd8403a 1009
1444f589 1010 struct wiphy_work request_smps_work;
e3640a82
JB
1011 /* used to reconfigure hardware SM PS */
1012 struct wiphy_work recalc_smps;
1013
bfd8403a
JB
1014 bool beacon_crc_valid;
1015 u32 beacon_crc;
1016 struct ewma_beacon_signal ave_beacon_signal;
1017 int last_ave_beacon_signal;
1018
1019 /*
1020 * Number of Beacon frames used in ave_beacon_signal. This can be used
1021 * to avoid generating less reliable cqm events that would be based
1022 * only on couple of received frames.
1023 */
1024 unsigned int count_beacon_signal;
1025
1026 /* Number of times beacon loss was invoked. */
1027 unsigned int beacon_loss_count;
1028
1029 /*
1030 * Last Beacon frame signal strength average (ave_beacon_signal / 16)
1031 * that triggered a cqm event. 0 indicates that no event has been
1032 * generated for the current association.
1033 */
1034 int last_cqm_event_signal;
1035
1036 int wmm_last_param_set;
1037 int mu_edca_last_param_set;
bfd8403a
JB
1038};
1039
1040struct ieee80211_link_data_ap {
1041 struct beacon_data __rcu *beacon;
1042 struct probe_resp __rcu *probe_resp;
1043 struct fils_discovery_data __rcu *fils_discovery;
1044 struct unsol_bcast_probe_resp_data __rcu *unsol_bcast_probe_resp;
1045
1046 /* to be used after channel switch. */
1047 struct cfg80211_beacon_data *next_beacon;
1048};
1049
1050struct ieee80211_link_data {
b4f85443
JB
1051 struct ieee80211_sub_if_data *sdata;
1052 unsigned int link_id;
1053
5435af6e
JB
1054 struct list_head assigned_chanctx_list; /* protected by wiphy mutex */
1055 struct list_head reserved_chanctx_list; /* protected by wiphy mutex */
b4f85443 1056
bfd8403a
JB
1057 /* multicast keys only */
1058 struct ieee80211_key __rcu *gtk[NUM_DEFAULT_KEYS +
1059 NUM_DEFAULT_MGMT_KEYS +
1060 NUM_DEFAULT_BEACON_KEYS];
1061 struct ieee80211_key __rcu *default_multicast_key;
1062 struct ieee80211_key __rcu *default_mgmt_key;
1063 struct ieee80211_key __rcu *default_beacon_key;
1064
39eac2de
JB
1065
1066 bool operating_11g_mode;
1067
344d18ce
JB
1068 struct {
1069 struct wiphy_work finalize_work;
1070 struct ieee80211_chan_req chanreq;
1071 } csa;
bfd8403a 1072
b38579ae 1073 struct wiphy_work color_change_finalize_work;
4cc6f3e5 1074 struct wiphy_delayed_work color_collision_detect_work;
92881884 1075 u64 color_bitmap;
bfd8403a 1076
5435af6e 1077 /* context reservation -- protected with wiphy mutex */
bfd8403a 1078 struct ieee80211_chanctx *reserved_chanctx;
6092077a 1079 struct ieee80211_chan_req reserved;
bfd8403a
JB
1080 bool reserved_radar_required;
1081 bool reserved_ready;
1082
1083 u8 needed_rx_chains;
1084 enum ieee80211_smps_mode smps_mode;
1085
1086 int user_power_level; /* in dBm */
1087 int ap_power_level; /* in dBm */
1088
1089 bool radar_required;
6241d79f 1090 struct wiphy_delayed_work dfs_cac_timer_work;
bfd8403a
JB
1091
1092 union {
1093 struct ieee80211_link_data_managed mgd;
1094 struct ieee80211_link_data_ap ap;
1095 } u;
d8675a63 1096
b3e2130b
JB
1097 struct ieee80211_tx_queue_params tx_conf[IEEE80211_NUM_ACS];
1098
d8675a63 1099 struct ieee80211_bss_conf *conf;
170cd6a6
BB
1100
1101#ifdef CONFIG_MAC80211_DEBUGFS
1102 struct dentry *debugfs_dir;
1103#endif
bfd8403a
JB
1104};
1105
f0706e82
JB
1106struct ieee80211_sub_if_data {
1107 struct list_head list;
f0706e82
JB
1108
1109 struct wireless_dev wdev;
1110
11a843b7
JB
1111 /* keys */
1112 struct list_head key_list;
1113
3bff1865
YAP
1114 /* count for keys needing tailroom space allocation */
1115 int crypto_tx_tailroom_needed_cnt;
8d1f7ecd 1116 int crypto_tx_tailroom_pending_dec;
e3208fb7 1117 struct wiphy_delayed_work dec_tailroom_needed_wk;
3bff1865 1118
f0706e82
JB
1119 struct net_device *dev;
1120 struct ieee80211_local *local;
1121
13262ffd 1122 unsigned int flags;
7e9ed188 1123
34d4bc4d
JB
1124 unsigned long state;
1125
47846c9b
JB
1126 char name[IFNAMSIZ];
1127
3a11ce08 1128 struct ieee80211_fragment_cache frags;
f0706e82 1129
b53be792
SW
1130 /* TID bitmap for NoAck policy */
1131 u16 noack_map;
1132
00e96dec
YD
1133 /* bit field of ACM bits (BIT(802.1D tag)) */
1134 u8 wmm_acm;
1135
bfd8403a 1136 struct ieee80211_key __rcu *keys[NUM_DEFAULT_KEYS];
40b275b6 1137 struct ieee80211_key __rcu *default_unicast_key;
f0706e82 1138
94778280 1139 u16 sequence_number;
963d0e8d 1140 u16 mld_mcast_seq;
a621fa4d
JB
1141 __be16 control_port_protocol;
1142 bool control_port_no_encrypt;
7f3f96ce 1143 bool control_port_no_preauth;
018f6fbf 1144 bool control_port_over_nl80211;
94778280 1145
80a83cfc 1146 atomic_t num_tx_queued;
32db6b54 1147 struct mac80211_qos_map __rcu *qos_map;
f6f3def3 1148
16114496 1149 struct wiphy_work work;
35f20c14 1150 struct sk_buff_head skb_queue;
f5a4c24e 1151 struct sk_buff_head status_queue;
35f20c14 1152
471b3efd 1153 /*
3e122be0
JB
1154 * AP this belongs to: self in AP mode and
1155 * corresponding AP in VLAN mode, NULL for
1156 * all others (might be needed later in IBSS)
471b3efd 1157 */
3e122be0
JB
1158 struct ieee80211_if_ap *bss;
1159
37eb0b16 1160 /* bitmap of allowed (non-MCS) rate indexes for rate control */
57fbcce3 1161 u32 rc_rateidx_mask[NUM_NL80211_BANDS];
2ffbe6d3 1162
57fbcce3
JB
1163 bool rc_has_mcs_mask[NUM_NL80211_BANDS];
1164 u8 rc_rateidx_mcs_mask[NUM_NL80211_BANDS][IEEE80211_HT_MCS_MASK_LEN];
f0706e82 1165
57fbcce3
JB
1166 bool rc_has_vht_mcs_mask[NUM_NL80211_BANDS];
1167 u16 rc_rateidx_vht_mcs_mask[NUM_NL80211_BANDS][NL80211_VHT_NSS_MAX];
b119ad6e 1168
08fad438
JM
1169 /* Beacon frame (non-MCS) rate (as a bitmap) */
1170 u32 beacon_rateidx_mask[NUM_NL80211_BANDS];
1171 bool beacon_rate_set;
1172
f0706e82
JB
1173 union {
1174 struct ieee80211_if_ap ap;
f0706e82 1175 struct ieee80211_if_vlan vlan;
46900298
JB
1176 struct ieee80211_if_managed mgd;
1177 struct ieee80211_if_ibss ibss;
472dbc45 1178 struct ieee80211_if_mesh mesh;
239281f8 1179 struct ieee80211_if_ocb ocb;
d8212184 1180 struct ieee80211_if_mntr mntr;
5953ff6d 1181 struct ieee80211_if_nan nan;
f0706e82 1182 } u;
e9f207f0 1183
bfd8403a 1184 struct ieee80211_link_data deflink;
d8675a63 1185 struct ieee80211_link_data __rcu *link[IEEE80211_MLD_MAX_NUM_LINKS];
bfd8403a 1186
3d901102 1187 /* for ieee80211_set_active_links_async() */
7206a948 1188 struct wiphy_work activate_links_work;
3d901102
JB
1189 u16 desired_active_links;
1190
a0b9ecff
JB
1191 u16 restart_active_links;
1192
e9f207f0 1193#ifdef CONFIG_MAC80211_DEBUGFS
2b58b209 1194 struct {
295bafb4 1195 struct dentry *subdir_stations;
f7e0104c
JB
1196 struct dentry *default_unicast_key;
1197 struct dentry *default_multicast_key;
3cfcf6ac 1198 struct dentry *default_mgmt_key;
e5473e80 1199 struct dentry *default_beacon_key;
7bcfaf2f 1200 } debugfs;
e9f207f0 1201#endif
529ba6e9 1202
32bfd35d
JB
1203 /* must be last, dynamically sized area in this! */
1204 struct ieee80211_vif vif;
f0706e82
JB
1205};
1206
32bfd35d
JB
1207static inline
1208struct ieee80211_sub_if_data *vif_to_sdata(struct ieee80211_vif *p)
1209{
1210 return container_of(p, struct ieee80211_sub_if_data, vif);
1211}
1212
7ca133bc 1213#define sdata_dereference(p, sdata) \
076fc877 1214 wiphy_dereference(sdata->local->hw.wiphy, p)
8d61ffa5 1215
d1256c15
JB
1216#define for_each_sdata_link(_local, _link) \
1217 /* outer loop just to define the variables ... */ \
1218 for (struct ieee80211_sub_if_data *___sdata = NULL; \
1219 !___sdata; \
1220 ___sdata = (void *)~0 /* always stop */) \
1221 list_for_each_entry(___sdata, &(_local)->interfaces, list) \
1222 if (ieee80211_sdata_running(___sdata)) \
1223 for (int ___link_id = 0; \
1224 ___link_id < ARRAY_SIZE(___sdata->link); \
1225 ___link_id++) \
1b5b7f3d 1226 if ((_link = wiphy_dereference((_local)->hw.wiphy, \
d1256c15
JB
1227 ___sdata->link[___link_id])))
1228
f61c7b3d
MS
1229#define for_each_link_data(sdata, __link) \
1230 struct ieee80211_sub_if_data *__sdata = sdata; \
1231 for (int __link_id = 0; \
1232 __link_id < ARRAY_SIZE((__sdata)->link); __link_id++) \
1233 if ((!(__sdata)->vif.valid_links || \
1234 (__sdata)->vif.valid_links & BIT(__link_id)) && \
1235 ((__link) = sdata_dereference((__sdata)->link[__link_id], \
1236 (__sdata))))
1237
2b3171c6 1238static inline int
68b9bea2
AD
1239ieee80211_get_mbssid_beacon_len(struct cfg80211_mbssid_elems *elems,
1240 struct cfg80211_rnr_elems *rnr_elems,
1241 u8 i)
2b3171c6 1242{
bd54f3c2 1243 int len = 0;
2b3171c6 1244
bd54f3c2 1245 if (!elems || !elems->cnt || i > elems->cnt)
2b3171c6
LB
1246 return 0;
1247
68b9bea2
AD
1248 if (i < elems->cnt) {
1249 len = elems->elem[i].len;
1250 if (rnr_elems) {
1251 len += rnr_elems->elem[i].len;
1252 for (i = elems->cnt; i < rnr_elems->cnt; i++)
1253 len += rnr_elems->elem[i].len;
1254 }
1255 return len;
1256 }
bd54f3c2
AD
1257
1258 /* i == elems->cnt, calculate total length of all MBSSID elements */
2b3171c6
LB
1259 for (i = 0; i < elems->cnt; i++)
1260 len += elems->elem[i].len;
1261
68b9bea2
AD
1262 if (rnr_elems) {
1263 for (i = 0; i < rnr_elems->cnt; i++)
1264 len += rnr_elems->elem[i].len;
1265 }
1266
2b3171c6
LB
1267 return len;
1268}
1269
f0706e82
JB
1270enum {
1271 IEEE80211_RX_MSG = 1,
1272 IEEE80211_TX_STATUS_MSG = 2,
1273};
1274
ce7c9111
KV
1275enum queue_stop_reason {
1276 IEEE80211_QUEUE_STOP_REASON_DRIVER,
520eb820 1277 IEEE80211_QUEUE_STOP_REASON_PS,
96f5e66e
JB
1278 IEEE80211_QUEUE_STOP_REASON_CSA,
1279 IEEE80211_QUEUE_STOP_REASON_AGGREGATION,
25420604 1280 IEEE80211_QUEUE_STOP_REASON_SUSPEND,
8f77f384 1281 IEEE80211_QUEUE_STOP_REASON_SKB_ADD,
6c17b77b 1282 IEEE80211_QUEUE_STOP_REASON_OFFCHANNEL,
445ea4e8 1283 IEEE80211_QUEUE_STOP_REASON_FLUSH,
db67d661 1284 IEEE80211_QUEUE_STOP_REASON_TDLS_TEARDOWN,
b6da911b 1285 IEEE80211_QUEUE_STOP_REASON_RESERVE_TID,
054c9939 1286 IEEE80211_QUEUE_STOP_REASON_IFTYPE_CHANGE,
cca07b00
LC
1287
1288 IEEE80211_QUEUE_STOP_REASONS,
ce7c9111
KV
1289};
1290
65a6538a 1291#ifdef CONFIG_MAC80211_LEDS
e1e54068 1292struct tpt_led_trigger {
e1e54068
JB
1293 char name[32];
1294 const struct ieee80211_tpt_blink *blink_table;
1295 unsigned int blink_table_len;
1296 struct timer_list timer;
34f11cd3 1297 struct ieee80211_local *local;
e1e54068
JB
1298 unsigned long prev_traffic;
1299 unsigned long tx_bytes, rx_bytes;
67408c8c
JB
1300 unsigned int active, want;
1301 bool running;
e1e54068 1302};
65a6538a 1303#endif
e1e54068 1304
142b9f50 1305/**
799f53e2 1306 * enum mac80211_scan_flags - currently active scan mode
142b9f50
HS
1307 *
1308 * @SCAN_SW_SCANNING: We're currently in the process of scanning but may as
1309 * well be on the operating channel
1310 * @SCAN_HW_SCANNING: The hardware is scanning for us, we have no way to
1311 * determine if we are on the operating channel or not
8a690674
BG
1312 * @SCAN_ONCHANNEL_SCANNING: Do a software scan on only the current operating
1313 * channel. This should not interrupt normal traffic.
8789d459
JB
1314 * @SCAN_COMPLETED: Set for our scan work function when the driver reported
1315 * that the scan completed.
1316 * @SCAN_ABORTED: Set for our scan work function when the driver reported
1317 * a scan complete for an aborted scan.
a754055a
EG
1318 * @SCAN_HW_CANCELLED: Set for our scan work function when the scan is being
1319 * cancelled.
b041b7b9
FF
1320 * @SCAN_BEACON_WAIT: Set whenever we're passive scanning because of radar/no-IR
1321 * and could send a probe request after receiving a beacon.
1322 * @SCAN_BEACON_DONE: Beacon received, we can now send a probe request
142b9f50 1323 */
799f53e2 1324enum mac80211_scan_flags {
fbe9c429 1325 SCAN_SW_SCANNING,
142b9f50 1326 SCAN_HW_SCANNING,
8a690674 1327 SCAN_ONCHANNEL_SCANNING,
8789d459
JB
1328 SCAN_COMPLETED,
1329 SCAN_ABORTED,
a754055a 1330 SCAN_HW_CANCELLED,
b041b7b9
FF
1331 SCAN_BEACON_WAIT,
1332 SCAN_BEACON_DONE,
142b9f50
HS
1333};
1334
1335/**
1336 * enum mac80211_scan_state - scan state machine states
1337 *
1338 * @SCAN_DECISION: Main entry point to the scan state machine, this state
1339 * determines if we should keep on scanning or switch back to the
1340 * operating channel
1341 * @SCAN_SET_CHANNEL: Set the next channel to be scanned
1342 * @SCAN_SEND_PROBE: Send probe requests and wait for probe responses
07ef03ee
JB
1343 * @SCAN_SUSPEND: Suspend the scan and go back to operating channel to
1344 * send out data
1345 * @SCAN_RESUME: Resume the scan and scan the next channel
cd2bb512 1346 * @SCAN_ABORT: Abort the scan and go back to operating channel
142b9f50
HS
1347 */
1348enum mac80211_scan_state {
1349 SCAN_DECISION,
1350 SCAN_SET_CHANNEL,
1351 SCAN_SEND_PROBE,
07ef03ee
JB
1352 SCAN_SUSPEND,
1353 SCAN_RESUME,
cd2bb512 1354 SCAN_ABORT,
fbe9c429
HS
1355};
1356
e908435e
LB
1357DECLARE_STATIC_KEY_FALSE(aql_disable);
1358
f0706e82
JB
1359struct ieee80211_local {
1360 /* embed the driver visible part.
1361 * don't cast (use the static inlines below), but we keep
1362 * it first anyway so they become a no-op */
1363 struct ieee80211_hw hw;
1364
fa962b92 1365 struct fq fq;
5caa328e
MK
1366 struct codel_vars *cvars;
1367 struct codel_params cparams;
fa962b92 1368
18667600 1369 /* protects active_txqs and txqi->schedule_order */
942741da
FF
1370 spinlock_t active_txq_lock[IEEE80211_NUM_ACS];
1371 struct list_head active_txqs[IEEE80211_NUM_ACS];
1372 u16 schedule_round[IEEE80211_NUM_ACS];
1373
007ae9b2
AW
1374 /* serializes ieee80211_handle_wake_tx_queue */
1375 spinlock_t handle_wake_tx_queue_lock;
1376
b4809e94 1377 u16 airtime_flags;
942741da
FF
1378 u32 aql_txq_limit_low[IEEE80211_NUM_ACS];
1379 u32 aql_txq_limit_high[IEEE80211_NUM_ACS];
3ace10f5
KY
1380 u32 aql_threshold;
1381 atomic_t aql_total_pending_airtime;
8e4bac06 1382 atomic_t aql_ac_pending_airtime[IEEE80211_NUM_ACS];
b4809e94 1383
f0706e82
JB
1384 const struct ieee80211_ops *ops;
1385
42935eca
LR
1386 /*
1387 * private workqueue to mac80211. mac80211 makes this accessible
1388 * via ieee80211_queue_work()
1389 */
1390 struct workqueue_struct *workqueue;
1391
e4e72fb4 1392 unsigned long queue_stop_reasons[IEEE80211_MAX_QUEUES];
cca07b00 1393 int q_stop_reasons[IEEE80211_MAX_QUEUES][IEEE80211_QUEUE_STOP_REASONS];
96f5e66e 1394 /* also used to protect ampdu_ac_queue and amdpu_ac_stop_refcnt */
ce7c9111 1395 spinlock_t queue_stop_reason_lock;
96f5e66e 1396
f0706e82 1397 int open_count;
12986004 1398 int monitors, virt_monitors, tx_mntrs;
8cc9a739 1399 /* number of interfaces with corresponding FIF_ flags */
7be5086d
JB
1400 int fif_fcsfail, fif_plcpfail, fif_control, fif_other_bss, fif_pspoll,
1401 fif_probe_req;
6cd536fe 1402 bool probe_req_reg;
873b1cf6 1403 bool rx_mcast_action_reg;
4150c572 1404 unsigned int filter_flags; /* FIF_* */
3b8d81e0 1405
3ffc2a90
JB
1406 bool wiphy_ciphers_allocated;
1407
0a44dfc0
JB
1408 struct cfg80211_chan_def dflt_chandef;
1409 bool emulate_chanctx;
fe57d9f5 1410
3b8d81e0
JB
1411 /* protects the aggregated multicast list and filter calls */
1412 spinlock_t filter_lock;
1413
3ac64bee 1414 /* used for uploading changed mc list */
a6add8be 1415 struct wiphy_work reconfig_filter;
3ac64bee 1416
3b8d81e0 1417 /* aggregated multicast list */
22bedad3 1418 struct netdev_hw_addr_list mc_list;
3b8d81e0 1419
d0709a65 1420 bool tim_in_locked_section; /* see ieee80211_beacon_get() */
5bb644a0
JB
1421
1422 /*
1423 * suspended is true if we finished all the suspend _and_ we have
1424 * not yet come up from resume. This is to be used by mac80211
1425 * to ensure driver sanity during suspend and mac80211's own
1426 * sanity. It can eventually be used for WoW as well.
1427 */
1428 bool suspended;
1429
b33fb28c
LP
1430 /* suspending is true during the whole suspend process */
1431 bool suspending;
1432
ceb99fe0
JB
1433 /*
1434 * Resuming is true while suspended, but when we're reprogramming the
1435 * hardware -- at that time it's allowed to use ieee80211_queue_work()
1436 * again even though some other parts of the stack are still suspended
1437 * and we still drop received frames to avoid waking the stack.
1438 */
1439 bool resuming;
1440
5bb644a0
JB
1441 /*
1442 * quiescing is true during the suspend process _only_ to
1443 * ease timer cancelling etc.
1444 */
1445 bool quiescing;
1446
ea77f12f
JB
1447 /* device is started */
1448 bool started;
1449
04800ada
AN
1450 /* device is during a HW reconfig */
1451 bool in_reconfig;
1452
c4fdb081
JB
1453 /* reconfiguration failed ... suppress some warnings etc. */
1454 bool reconfig_failure;
1455
eecc4800
JB
1456 /* wowlan is enabled -- don't reconfig on resume */
1457 bool wowlan;
1458
228e4f93 1459 struct wiphy_work radar_detected_work;
164eb02d 1460
04ecd257
JB
1461 /* number of RX chains the hardware has */
1462 u8 rx_chains;
1463
09b4a4fa
JB
1464 /* bitmap of which sbands were copied */
1465 u8 sband_allocated;
1466
b306f453 1467 int tx_headroom; /* required headroom for hardware/radiotap */
f0706e82 1468
f0706e82
JB
1469 /* Tasklet and skb queue to process calls from IRQ mode. All frames
1470 * added to skb_queue will be processed, but frames in
1471 * skb_queue_unreliable may be dropped if the total length of these
1472 * queues increases over the limit. */
1473#define IEEE80211_IRQSAFE_QUEUE_LIMIT 128
1474 struct tasklet_struct tasklet;
1475 struct sk_buff_head skb_queue;
1476 struct sk_buff_head skb_queue_unreliable;
1477
f9e124fb 1478 spinlock_t rx_path_lock;
24a8fdad 1479
d0709a65
JB
1480 /* Station data */
1481 /*
4d3acf43
JB
1482 * The list, hash table and counter are protected
1483 * by the wiphy mutex, reads are done with RCU.
d0709a65 1484 */
4d33960b 1485 spinlock_t tim_lock;
d0709a65 1486 unsigned long num_sta;
4d33960b 1487 struct list_head sta_list;
83e7e4ce 1488 struct rhltable sta_hash;
ba6ddab9 1489 struct rhltable link_sta_hash;
f0706e82 1490 struct timer_list sta_cleanup;
f5ea9120 1491 int sta_generation;
f0706e82 1492
2a577d98 1493 struct sk_buff_head pending[IEEE80211_MAX_QUEUES];
f0706e82 1494 struct tasklet_struct tx_pending_tasklet;
21a5d4c3 1495 struct tasklet_struct wake_txqs_tasklet;
f0706e82 1496
a6a67db2 1497 atomic_t agg_queue_stop[IEEE80211_MAX_QUEUES];
cd8ffc80 1498
df140465
JB
1499 /* number of interfaces with allmulti RX */
1500 atomic_t iff_allmultis;
f0706e82
JB
1501
1502 struct rate_control_ref *rate_ctrl;
1503
5fdb3735
AB
1504 struct arc4_ctx wep_tx_ctx;
1505 struct arc4_ctx wep_rx_ctx;
f0706e82 1506 u32 wep_iv;
f0706e82 1507
c771c9d8 1508 /* see iface.c */
79010420 1509 struct list_head interfaces;
286e6967 1510 struct list_head mon_list; /* only that are IFF_UP */
c771c9d8 1511 struct mutex iflist_mtx;
79010420 1512
c2b13452 1513 /* Scanning and BSS list */
fbe9c429 1514 unsigned long scanning;
2a519311 1515 struct cfg80211_ssid scan_ssid;
5ba63533 1516 struct cfg80211_scan_request *int_scan_req;
6ea0a69c 1517 struct cfg80211_scan_request __rcu *scan_req;
c56ef672 1518 struct ieee80211_scan_request *hw_scan_req;
7ca15a0a 1519 struct cfg80211_chan_def scan_chandef;
57fbcce3 1520 enum nl80211_band hw_scan_band;
f0706e82 1521 int scan_channel_idx;
de95a54b 1522 int scan_ies_len;
c604b9f2 1523 int hw_scan_ies_bufsize;
7947d3e0 1524 struct cfg80211_scan_info scan_info;
8318d78a 1525
eadfb547 1526 struct wiphy_work sched_scan_stopped_work;
5260a5b2 1527 struct ieee80211_sub_if_data __rcu *sched_scan_sdata;
6ea0a69c 1528 struct cfg80211_sched_scan_request __rcu *sched_scan_req;
a344d677 1529 u8 scan_addr[ETH_ALEN];
79f460ca 1530
df13cce5 1531 unsigned long leave_oper_channel_time;
977923b0 1532 enum mac80211_scan_state next_scan_state;
20171251 1533 struct wiphy_delayed_work scan_work;
e2fd5dbc 1534 struct ieee80211_sub_if_data __rcu *scan_sdata;
f0706e82 1535
b8bc4b0a
JB
1536 /* Temporary remain-on-channel for off-channel operations */
1537 struct ieee80211_channel *tmp_channel;
b8bc4b0a 1538
d01a1e65
MK
1539 /* channel contexts */
1540 struct list_head chanctx_list;
d01a1e65 1541
c206ca67 1542#ifdef CONFIG_MAC80211_LEDS
8d5c2585
JB
1543 struct led_trigger tx_led, rx_led, assoc_led, radio_led;
1544 struct led_trigger tpt_led;
1545 atomic_t tx_led_active, rx_led_active, assoc_led_active;
1546 atomic_t radio_led_active, tpt_led_active;
c206ca67 1547 struct tpt_led_trigger *tpt_led_trigger;
c206ca67
JB
1548#endif
1549
1550#ifdef CONFIG_MAC80211_DEBUG_COUNTERS
f0706e82
JB
1551 /* SNMP counters */
1552 /* dot11CountersTable */
1553 u32 dot11TransmittedFragmentCount;
1554 u32 dot11MulticastTransmittedFrameCount;
1555 u32 dot11FailedCount;
1556 u32 dot11RetryCount;
1557 u32 dot11MultipleRetryCount;
1558 u32 dot11FrameDuplicateCount;
1559 u32 dot11ReceivedFragmentCount;
1560 u32 dot11MulticastReceivedFrameCount;
1561 u32 dot11TransmittedFrameCount;
f0706e82 1562
f0706e82
JB
1563 /* TX/RX handler statistics */
1564 unsigned int tx_handlers_drop;
1565 unsigned int tx_handlers_queued;
f0706e82
JB
1566 unsigned int tx_handlers_drop_wep;
1567 unsigned int tx_handlers_drop_not_assoc;
1568 unsigned int tx_handlers_drop_unauth_port;
1569 unsigned int rx_handlers_drop;
1570 unsigned int rx_handlers_queued;
1571 unsigned int rx_handlers_drop_nullfunc;
1572 unsigned int rx_handlers_drop_defrag;
f0706e82
JB
1573 unsigned int tx_expand_skb_head;
1574 unsigned int tx_expand_skb_head_cloned;
f1160434 1575 unsigned int rx_expand_skb_head_defrag;
f0706e82
JB
1576 unsigned int rx_handlers_fragments;
1577 unsigned int tx_status_drop;
f0706e82
JB
1578#define I802_DEBUG_INC(c) (c)++
1579#else /* CONFIG_MAC80211_DEBUG_COUNTERS */
1580#define I802_DEBUG_INC(c) do { } while (0)
1581#endif /* CONFIG_MAC80211_DEBUG_COUNTERS */
1582
1583
f0706e82
JB
1584 int total_ps_buffered; /* total number of all buffered unicast and
1585 * multicast packets for power saving stations
1586 */
520eb820 1587
572e0012 1588 bool pspolling;
965bedad
JB
1589 /*
1590 * PS can only be enabled when we have exactly one managed
1591 * interface (and monitors) in PS, this then points there.
1592 */
1593 struct ieee80211_sub_if_data *ps_sdata;
9fa659f9
JB
1594 struct wiphy_work dynamic_ps_enable_work;
1595 struct wiphy_work dynamic_ps_disable_work;
520eb820 1596 struct timer_list dynamic_ps_timer;
2b2c009e 1597 struct notifier_block ifa_notifier;
a65240c1 1598 struct notifier_block ifa6_notifier;
f0706e82 1599
ff616381
JO
1600 /*
1601 * The dynamic ps timeout configured from user space via WEXT -
1602 * this will override whatever chosen by mac80211 internally.
1603 */
1604 int dynamic_ps_forced_timeout;
1605
1ea6f9c0 1606 int user_power_level; /* in dBm, for all interfaces */
2bf30fab 1607
f2753ddb
JB
1608 struct work_struct restart_work;
1609
e9f207f0
JB
1610#ifdef CONFIG_MAC80211_DEBUGFS
1611 struct local_debugfsdentries {
4b7679a5 1612 struct dentry *rcdir;
e9f207f0
JB
1613 struct dentry *keys;
1614 } debugfs;
276d9e82 1615 bool force_tx_status;
e9f207f0 1616#endif
4e6cbfd0 1617
2eb278e0
JB
1618 /*
1619 * Remain-on-channel support
1620 */
97c19e42 1621 struct wiphy_delayed_work roc_work;
2eb278e0 1622 struct list_head roc_list;
97c19e42 1623 struct wiphy_work hw_roc_start, hw_roc_done;
2eb278e0 1624 unsigned long hw_roc_start_time;
50febf6a 1625 u64 roc_cookie_counter;
21f83589 1626
a729cff8
JB
1627 struct idr ack_status_frames;
1628 spinlock_t ack_status_lock;
1629
f142c6b9
JB
1630 struct ieee80211_sub_if_data __rcu *p2p_sdata;
1631
4b6f1dd6
JB
1632 /* virtual monitor interface */
1633 struct ieee80211_sub_if_data __rcu *monitor_sdata;
6092077a 1634 struct ieee80211_chan_req monitor_chanreq;
e9a21949
LC
1635
1636 /* extended capabilities provided by mac80211 */
1637 u8 ext_capa[8];
d34be431
EQ
1638
1639 bool wbrf_supported;
f0706e82
JB
1640};
1641
3e122be0 1642static inline struct ieee80211_sub_if_data *
d787a3e3 1643IEEE80211_DEV_TO_SUB_IF(const struct net_device *dev)
3e122be0 1644{
3e122be0
JB
1645 return netdev_priv(dev);
1646}
1647
71bbc994
JB
1648static inline struct ieee80211_sub_if_data *
1649IEEE80211_WDEV_TO_SUB_IF(struct wireless_dev *wdev)
1650{
1651 return container_of(wdev, struct ieee80211_sub_if_data, wdev);
1652}
1653
21a8e9dd
MSS
1654static inline struct ieee80211_supported_band *
1655ieee80211_get_sband(struct ieee80211_sub_if_data *sdata)
1656{
1657 struct ieee80211_local *local = sdata->local;
1658 struct ieee80211_chanctx_conf *chanctx_conf;
1659 enum nl80211_band band;
1660
f1871abd 1661 WARN_ON(ieee80211_vif_is_mld(&sdata->vif));
1dd0f31c 1662
21a8e9dd 1663 rcu_read_lock();
d0a9123e 1664 chanctx_conf = rcu_dereference(sdata->vif.bss_conf.chanctx_conf);
21a8e9dd 1665
0ee4d555 1666 if (!chanctx_conf) {
21a8e9dd
MSS
1667 rcu_read_unlock();
1668 return NULL;
1669 }
1670
1671 band = chanctx_conf->def.chan->band;
1672 rcu_read_unlock();
1673
1674 return local->hw.wiphy->bands[band];
1675}
1676
f91cb507 1677static inline struct ieee80211_supported_band *
d8675a63 1678ieee80211_get_link_sband(struct ieee80211_link_data *link)
f91cb507 1679{
d8675a63 1680 struct ieee80211_local *local = link->sdata->local;
f91cb507
ST
1681 struct ieee80211_chanctx_conf *chanctx_conf;
1682 enum nl80211_band band;
1683
1684 rcu_read_lock();
d8675a63 1685 chanctx_conf = rcu_dereference(link->conf->chanctx_conf);
f91cb507
ST
1686 if (!chanctx_conf) {
1687 rcu_read_unlock();
1688 return NULL;
1689 }
1690
1691 band = chanctx_conf->def.chan->band;
1692 rcu_read_unlock();
1693
1694 return local->hw.wiphy->bands[band];
1695}
1696
c0f17eb9
CYY
1697/* this struct holds the value parsing from channel switch IE */
1698struct ieee80211_csa_ie {
6092077a 1699 struct ieee80211_chan_req chanreq;
c0f17eb9
CYY
1700 u8 mode;
1701 u8 count;
1702 u8 ttl;
3f718fd8 1703 u16 pre_value;
5d55371b 1704 u16 reason_code;
ee145775 1705 u32 max_switch_time;
c0f17eb9
CYY
1706};
1707
3552a228
JB
1708enum ieee80211_elems_parse_error {
1709 IEEE80211_PARSE_ERR_INVALID_END = BIT(0),
1710 IEEE80211_PARSE_ERR_DUP_ELEM = BIT(1),
1711 IEEE80211_PARSE_ERR_BAD_ELEM_SIZE = BIT(2),
1712 IEEE80211_PARSE_ERR_UNEXPECTED_ELEM = BIT(3),
a57944d1 1713 IEEE80211_PARSE_ERR_DUP_NEST_ML_BASIC = BIT(4),
3552a228
JB
1714};
1715
dd76986b
JB
1716/* Parsed Information Elements */
1717struct ieee802_11_elems {
4a3cb702 1718 const u8 *ie_start;
dd76986b 1719 size_t total_len;
c6e37ed4 1720 u32 crc;
dd76986b
JB
1721
1722 /* pointers to IEs */
53837584
AN
1723 const struct ieee80211_tdls_lnkie *lnk_id;
1724 const struct ieee80211_ch_switch_timing *ch_sw_timing;
9041c1fa 1725 const u8 *ext_capab;
4a3cb702
JB
1726 const u8 *ssid;
1727 const u8 *supp_rates;
4a3cb702 1728 const u8 *ds_params;
4a3cb702 1729 const struct ieee80211_tim_ie *tim;
4a3cb702 1730 const u8 *rsn;
c0058df7 1731 const u8 *rsnx;
4a3cb702
JB
1732 const u8 *erp_info;
1733 const u8 *ext_supp_rates;
1734 const u8 *wmm_info;
1735 const u8 *wmm_param;
1736 const struct ieee80211_ht_cap *ht_cap_elem;
1737 const struct ieee80211_ht_operation *ht_operation;
1738 const struct ieee80211_vht_cap *vht_cap_elem;
1739 const struct ieee80211_vht_operation *vht_operation;
1740 const struct ieee80211_meshconf_ie *mesh_config;
41cbb0f5
LC
1741 const u8 *he_cap;
1742 const struct ieee80211_he_operation *he_operation;
ef11a931 1743 const struct ieee80211_he_spr *he_spr;
41cbb0f5 1744 const struct ieee80211_mu_edca_param_set *mu_edca_param_set;
a6cf28e0 1745 const struct ieee80211_he_6ghz_capa *he_6ghz_capa;
41cbb0f5 1746 const u8 *uora_element;
4a3cb702
JB
1747 const u8 *mesh_id;
1748 const u8 *peering;
1749 const __le16 *awake_window;
1750 const u8 *preq;
1751 const u8 *prep;
1752 const u8 *perr;
1753 const struct ieee80211_rann_ie *rann;
1754 const struct ieee80211_channel_sw_ie *ch_switch_ie;
b4f286a1 1755 const struct ieee80211_ext_chansw_ie *ext_chansw_ie;
b2e506bf 1756 const struct ieee80211_wide_bw_chansw_ie *wide_bw_chansw_ie;
ee145775 1757 const u8 *max_channel_switch_time;
4a3cb702
JB
1758 const u8 *country_elem;
1759 const u8 *pwr_constr_elem;
c8d65917 1760 const u8 *cisco_dtpc_elem;
79ba1d89 1761 const struct ieee80211_timeout_interval_ie *timeout_int;
4a3cb702 1762 const u8 *opmode_notif;
85220d71 1763 const struct ieee80211_sec_chan_offs_ie *sec_chan_offs;
c4de37ee 1764 struct ieee80211_mesh_chansw_params_ie *mesh_chansw_params_ie;
e38a017b 1765 const struct ieee80211_bss_max_idle_period_ie *max_idle_period_ie;
78ac51f8
SS
1766 const struct ieee80211_multiple_bssid_configuration *mbssid_config_ie;
1767 const struct ieee80211_bssid_index *bssid_index;
78ac51f8
SS
1768 u8 max_bssid_indicator;
1769 u8 dtim_count;
1770 u8 dtim_period;
2aa485e1 1771 const struct ieee80211_addba_ext_ie *addba_ext_ie;
cd418ba6
TP
1772 const struct ieee80211_s1g_cap *s1g_capab;
1773 const struct ieee80211_s1g_oper_ie *s1g_oper;
1774 const struct ieee80211_s1g_bcn_compat_ie *s1g_bcn_compat;
1d00ce80 1775 const struct ieee80211_aid_response_ie *aid_resp;
f0e6bea8
IP
1776 const struct ieee80211_eht_cap_elem *eht_cap;
1777 const struct ieee80211_eht_operation *eht_operation;
a286de1a 1778 const struct ieee80211_multi_link_elem *ml_basic;
4d70e9c5 1779 const struct ieee80211_multi_link_elem *ml_reconf;
24711d60 1780 const struct ieee80211_multi_link_elem *ml_epcs;
b3239498 1781 const struct ieee80211_bandwidth_indication *bandwidth_indication;
62e9c64e 1782 const struct ieee80211_ttlm_elem *ttlm[IEEE80211_TTLM_MAX_CNT];
dd76986b 1783
39dc8b8e
JB
1784 /* not the order in the psd values is per element, not per chandef */
1785 struct ieee80211_parsed_tpe tpe;
45405681 1786 struct ieee80211_parsed_tpe csa_tpe;
39dc8b8e 1787
dd76986b 1788 /* length of them, respectively */
9041c1fa 1789 u8 ext_capab_len;
dd76986b
JB
1790 u8 ssid_len;
1791 u8 supp_rates_len;
dd76986b 1792 u8 tim_len;
dd76986b 1793 u8 rsn_len;
c0058df7 1794 u8 rsnx_len;
dd76986b
JB
1795 u8 ext_supp_rates_len;
1796 u8 wmm_info_len;
1797 u8 wmm_param_len;
41cbb0f5 1798 u8 he_cap_len;
dd76986b
JB
1799 u8 mesh_id_len;
1800 u8 peering_len;
1801 u8 preq_len;
1802 u8 prep_len;
1803 u8 perr_len;
dd76986b 1804 u8 country_elem_len;
78ac51f8 1805 u8 bssid_index_len;
f0e6bea8 1806 u8 eht_cap_len;
fcff4f10 1807
45ebac4f 1808 /* mult-link element can be de-fragmented and thus u8 is not sufficient */
a286de1a 1809 size_t ml_basic_len;
4d70e9c5 1810 size_t ml_reconf_len;
24711d60 1811 size_t ml_epcs_len;
a286de1a 1812
62e9c64e
AB
1813 u8 ttlm_num;
1814
45ebac4f
IP
1815 /*
1816 * store the per station profile pointer and length in case that the
1817 * parsing also handled Multi-Link element parsing for a specific link
1818 * ID.
1819 */
1820 struct ieee80211_mle_per_sta_profile *prof;
1821 size_t sta_prof_len;
1822
3552a228
JB
1823 /* whether/which parse error occurred while retrieving these elements */
1824 u8 parse_error;
dd76986b
JB
1825};
1826
f0706e82
JB
1827static inline struct ieee80211_local *hw_to_local(
1828 struct ieee80211_hw *hw)
1829{
1830 return container_of(hw, struct ieee80211_local, hw);
1831}
1832
ba8c3d6f
FF
1833static inline struct txq_info *to_txq_info(struct ieee80211_txq *txq)
1834{
1835 return container_of(txq, struct txq_info, txq);
1836}
f0706e82 1837
bb42f2d1
THJ
1838static inline bool txq_has_queue(struct ieee80211_txq *txq)
1839{
1840 struct txq_info *txqi = to_txq_info(txq);
1841
1842 return !(skb_queue_empty(&txqi->frags) && !txqi->tin.backlog_packets);
1843}
1844
f4bda337
TP
1845static inline bool
1846ieee80211_have_rx_timestamp(struct ieee80211_rx_status *status)
1847{
d5b6f6d5 1848 return status->flag & RX_FLAG_MACTIME;
f4bda337 1849}
571ecf67 1850
72f15d53
MB
1851void ieee80211_vif_inc_num_mcast(struct ieee80211_sub_if_data *sdata);
1852void ieee80211_vif_dec_num_mcast(struct ieee80211_sub_if_data *sdata);
1853
dc494fdc
JB
1854void ieee80211_vif_block_queues_csa(struct ieee80211_sub_if_data *sdata);
1855void ieee80211_vif_unblock_queues_csa(struct ieee80211_sub_if_data *sdata);
1856
72f15d53
MB
1857/* This function returns the number of multicast stations connected to this
1858 * interface. It returns -1 if that number is not tracked, that is for netdevs
1859 * not in AP or AP_VLAN mode or when using 4addr.
1860 */
1861static inline int
1862ieee80211_vif_get_num_mcast_if(struct ieee80211_sub_if_data *sdata)
1863{
1864 if (sdata->vif.type == NL80211_IFTYPE_AP)
1865 return atomic_read(&sdata->u.ap.num_mcast_sta);
1866 if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN && !sdata->u.vlan.sta)
1867 return atomic_read(&sdata->u.vlan.num_mcast_sta);
1868 return -1;
1869}
1870
f4bda337
TP
1871u64 ieee80211_calculate_rx_timestamp(struct ieee80211_local *local,
1872 struct ieee80211_rx_status *status,
1873 unsigned int mpdu_len,
1874 unsigned int mpdu_offset);
e8975581 1875int ieee80211_hw_config(struct ieee80211_local *local, u32 changed);
0a44dfc0
JB
1876int ieee80211_hw_conf_chan(struct ieee80211_local *local);
1877void ieee80211_hw_conf_init(struct ieee80211_local *local);
5cf121c3 1878void ieee80211_tx_set_protected(struct ieee80211_tx_data *tx);
9c6bd790 1879void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata,
7b7090b4
JB
1880 u64 changed);
1881void ieee80211_vif_cfg_change_notify(struct ieee80211_sub_if_data *sdata,
1882 u64 changed);
1883void ieee80211_link_info_change_notify(struct ieee80211_sub_if_data *sdata,
d8675a63
JB
1884 struct ieee80211_link_data *link,
1885 u64 changed);
0d143fe1 1886void ieee80211_configure_filter(struct ieee80211_local *local);
15ddba5f 1887u64 ieee80211_reset_erp_info(struct ieee80211_sub_if_data *sdata);
f0706e82 1888
177c6ae9
JB
1889void ieee80211_handle_queued_frames(struct ieee80211_local *local);
1890
a2fcfccb 1891u64 ieee80211_mgmt_tx_cookie(struct ieee80211_local *local);
5ee00dbd
JB
1892int ieee80211_attach_ack_skb(struct ieee80211_local *local, struct sk_buff *skb,
1893 u64 *cookie, gfp_t gfp);
a2fcfccb 1894
49ddf8e6
JB
1895void ieee80211_check_fast_rx(struct sta_info *sta);
1896void __ieee80211_check_fast_rx_iface(struct ieee80211_sub_if_data *sdata);
1897void ieee80211_check_fast_rx_iface(struct ieee80211_sub_if_data *sdata);
1898void ieee80211_clear_fast_rx(struct sta_info *sta);
1899
0d5891e3
AO
1900bool ieee80211_is_our_addr(struct ieee80211_sub_if_data *sdata,
1901 const u8 *addr, int *out_link_id);
1902
46900298 1903/* STA code */
9c6bd790 1904void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata);
77fdaa12
JB
1905int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata,
1906 struct cfg80211_auth_request *req);
1907int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,
1908 struct cfg80211_assoc_request *req);
1909int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata,
63c9c5e7 1910 struct cfg80211_deauth_request *req);
77fdaa12 1911int ieee80211_mgd_disassoc(struct ieee80211_sub_if_data *sdata,
63c9c5e7 1912 struct cfg80211_disassoc_request *req);
572e0012
KV
1913void ieee80211_send_pspoll(struct ieee80211_local *local,
1914 struct ieee80211_sub_if_data *sdata);
4a733ef1 1915void ieee80211_recalc_ps(struct ieee80211_local *local);
ab095877 1916void ieee80211_recalc_ps_vif(struct ieee80211_sub_if_data *sdata);
1fa57d01
JB
1917void ieee80211_sta_work(struct ieee80211_sub_if_data *sdata);
1918void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
1919 struct sk_buff *skb);
09a740ce
TP
1920void ieee80211_sta_rx_queued_ext(struct ieee80211_sub_if_data *sdata,
1921 struct sk_buff *skb);
d3a910a8 1922void ieee80211_sta_reset_beacon_monitor(struct ieee80211_sub_if_data *sdata);
be099e82 1923void ieee80211_sta_reset_conn_monitor(struct ieee80211_sub_if_data *sdata);
afa762f6 1924void ieee80211_mgd_stop(struct ieee80211_sub_if_data *sdata);
1672c0e3
JB
1925void ieee80211_mgd_conn_tx_status(struct ieee80211_sub_if_data *sdata,
1926 __le16 fc, bool acked);
1a1cb744 1927void ieee80211_mgd_quiesce(struct ieee80211_sub_if_data *sdata);
b8360ab8 1928void ieee80211_sta_restart(struct ieee80211_sub_if_data *sdata);
02219b3a 1929void ieee80211_sta_handle_tspec_ac_params(struct ieee80211_sub_if_data *sdata);
7dd231eb 1930void ieee80211_sta_connection_lost(struct ieee80211_sub_if_data *sdata,
53da4c45 1931 u8 reason, bool tx);
b2e8434f
JB
1932void ieee80211_mgd_setup_link(struct ieee80211_link_data *link);
1933void ieee80211_mgd_stop_link(struct ieee80211_link_data *link);
7e415d0c 1934void ieee80211_mgd_set_link_qos_params(struct ieee80211_link_data *link);
9c6bd790 1935
46900298 1936/* IBSS code */
46900298
JB
1937void ieee80211_ibss_notify_scan_completed(struct ieee80211_local *local);
1938void ieee80211_ibss_setup_sdata(struct ieee80211_sub_if_data *sdata);
8bf11d8d
JB
1939void ieee80211_ibss_rx_no_sta(struct ieee80211_sub_if_data *sdata,
1940 const u8 *bssid, const u8 *addr, u32 supp_rates);
af8cdcd8
JB
1941int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata,
1942 struct cfg80211_ibss_params *params);
1943int ieee80211_ibss_leave(struct ieee80211_sub_if_data *sdata);
1fa57d01
JB
1944void ieee80211_ibss_work(struct ieee80211_sub_if_data *sdata);
1945void ieee80211_ibss_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
1946 struct sk_buff *skb);
cd7760e6 1947int ieee80211_ibss_csa_beacon(struct ieee80211_sub_if_data *sdata,
15ddba5f
A
1948 struct cfg80211_csa_settings *csa_settings,
1949 u64 *changed);
1950int ieee80211_ibss_finish_csa(struct ieee80211_sub_if_data *sdata,
1951 u64 *changed);
cd7760e6 1952void ieee80211_ibss_stop(struct ieee80211_sub_if_data *sdata);
1fa57d01 1953
239281f8
RL
1954/* OCB code */
1955void ieee80211_ocb_work(struct ieee80211_sub_if_data *sdata);
1956void ieee80211_ocb_rx_no_sta(struct ieee80211_sub_if_data *sdata,
1957 const u8 *bssid, const u8 *addr, u32 supp_rates);
1958void ieee80211_ocb_setup_sdata(struct ieee80211_sub_if_data *sdata);
1959int ieee80211_ocb_join(struct ieee80211_sub_if_data *sdata,
1960 struct ocb_setup *setup);
1961int ieee80211_ocb_leave(struct ieee80211_sub_if_data *sdata);
1962
1fa57d01
JB
1963/* mesh code */
1964void ieee80211_mesh_work(struct ieee80211_sub_if_data *sdata);
1965void ieee80211_mesh_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
1966 struct sk_buff *skb);
b8456a14 1967int ieee80211_mesh_csa_beacon(struct ieee80211_sub_if_data *sdata,
15ddba5f
A
1968 struct cfg80211_csa_settings *csa_settings,
1969 u64 *changed);
1970int ieee80211_mesh_finish_csa(struct ieee80211_sub_if_data *sdata,
1971 u64 *changed);
46900298 1972
9c6bd790 1973/* scan/BSS handling */
20171251 1974void ieee80211_scan_work(struct wiphy *wiphy, struct wiphy_work *work);
34bcf715
SG
1975int ieee80211_request_ibss_scan(struct ieee80211_sub_if_data *sdata,
1976 const u8 *ssid, u8 ssid_len,
76bed0f4 1977 struct ieee80211_channel **channels,
5add321c 1978 unsigned int n_channels);
c2b13452 1979int ieee80211_request_scan(struct ieee80211_sub_if_data *sdata,
2a519311 1980 struct cfg80211_scan_request *req);
5bb644a0 1981void ieee80211_scan_cancel(struct ieee80211_local *local);
133d40f9 1982void ieee80211_run_deferred_scan(struct ieee80211_local *local);
d48b2968 1983void ieee80211_scan_rx(struct ieee80211_local *local, struct sk_buff *skb);
9c6bd790 1984
108d2022
BB
1985void ieee80211_inform_bss(struct wiphy *wiphy, struct cfg80211_bss *bss,
1986 const struct cfg80211_bss_ies *ies, void *data);
1987
0a51b27e 1988void ieee80211_mlme_notify_scan_completed(struct ieee80211_local *local);
c2b13452 1989struct ieee80211_bss *
98c8fccf
JB
1990ieee80211_bss_info_update(struct ieee80211_local *local,
1991 struct ieee80211_rx_status *rx_status,
1992 struct ieee80211_mgmt *mgmt,
1993 size_t len,
d45c4172 1994 struct ieee80211_channel *channel);
98c8fccf 1995void ieee80211_rx_bss_put(struct ieee80211_local *local,
c2b13452 1996 struct ieee80211_bss *bss);
ee385855 1997
79f460ca 1998/* scheduled scan handling */
d43c6b6e
DS
1999int
2000__ieee80211_request_sched_scan_start(struct ieee80211_sub_if_data *sdata,
2001 struct cfg80211_sched_scan_request *req);
79f460ca
LC
2002int ieee80211_request_sched_scan_start(struct ieee80211_sub_if_data *sdata,
2003 struct cfg80211_sched_scan_request *req);
0d440ea2 2004int ieee80211_request_sched_scan_stop(struct ieee80211_local *local);
f6837ba8 2005void ieee80211_sched_scan_end(struct ieee80211_local *local);
eadfb547
JB
2006void ieee80211_sched_scan_stopped_work(struct wiphy *wiphy,
2007 struct wiphy_work *work);
79f460ca 2008
a2fcfccb 2009/* off-channel/mgmt-tx */
aacde9ee
SG
2010void ieee80211_offchannel_stop_vifs(struct ieee80211_local *local);
2011void ieee80211_offchannel_return(struct ieee80211_local *local);
2eb278e0
JB
2012void ieee80211_roc_setup(struct ieee80211_local *local);
2013void ieee80211_start_next_roc(struct ieee80211_local *local);
6322e0e7 2014void ieee80211_reconfig_roc(struct ieee80211_local *local);
c8f994ee
JB
2015void ieee80211_roc_purge(struct ieee80211_local *local,
2016 struct ieee80211_sub_if_data *sdata);
a2fcfccb
JB
2017int ieee80211_remain_on_channel(struct wiphy *wiphy, struct wireless_dev *wdev,
2018 struct ieee80211_channel *chan,
2019 unsigned int duration, u64 *cookie);
2020int ieee80211_cancel_remain_on_channel(struct wiphy *wiphy,
2021 struct wireless_dev *wdev, u64 cookie);
2022int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
2023 struct cfg80211_mgmt_tx_params *params, u64 *cookie);
2024int ieee80211_mgmt_tx_cancel_wait(struct wiphy *wiphy,
2025 struct wireless_dev *wdev, u64 cookie);
b203ffc3 2026
73da7d5b 2027/* channel switch handling */
d7074be6 2028void ieee80211_csa_finalize_work(struct wiphy *wiphy, struct wiphy_work *work);
82a8e17d
LC
2029int ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev,
2030 struct cfg80211_csa_settings *params);
73da7d5b 2031
5f9404ab 2032/* color change handling */
b38579ae
JB
2033void ieee80211_color_change_finalize_work(struct wiphy *wiphy,
2034 struct wiphy_work *work);
4cc6f3e5
RP
2035void ieee80211_color_collision_detection_work(struct wiphy *wiphy,
2036 struct wiphy_work *work);
5f9404ab 2037
3e122be0 2038/* interface handling */
07b83d2e
JB
2039#define MAC80211_SUPPORTED_FEATURES_TX (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | \
2040 NETIF_F_HW_CSUM | NETIF_F_SG | \
61587f15
FF
2041 NETIF_F_HIGHDMA | NETIF_F_GSO_SOFTWARE | \
2042 NETIF_F_HW_TC)
07b83d2e
JB
2043#define MAC80211_SUPPORTED_FEATURES_RX (NETIF_F_RXCSUM)
2044#define MAC80211_SUPPORTED_FEATURES (MAC80211_SUPPORTED_FEATURES_TX | \
2045 MAC80211_SUPPORTED_FEATURES_RX)
2046
47846c9b
JB
2047int ieee80211_iface_init(void);
2048void ieee80211_iface_exit(void);
3e122be0 2049int ieee80211_if_add(struct ieee80211_local *local, const char *name,
6bab2e19 2050 unsigned char name_assign_type,
84efbb84 2051 struct wireless_dev **new_wdev, enum nl80211_iftype type,
ee385855 2052 struct vif_params *params);
f3947e2d 2053int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata,
05c914fe 2054 enum nl80211_iftype type);
f698d856 2055void ieee80211_if_remove(struct ieee80211_sub_if_data *sdata);
75636525 2056void ieee80211_remove_interfaces(struct ieee80211_local *local);
382a103b 2057u32 ieee80211_idle_off(struct ieee80211_local *local);
5cff20e6 2058void ieee80211_recalc_idle(struct ieee80211_local *local);
85416a4f
CL
2059void ieee80211_adjust_monitor_flags(struct ieee80211_sub_if_data *sdata,
2060 const int offset);
f142c6b9
JB
2061int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up);
2062void ieee80211_sdata_stop(struct ieee80211_sub_if_data *sdata);
3c3e21e7
JB
2063int ieee80211_add_virtual_monitor(struct ieee80211_local *local);
2064void ieee80211_del_virtual_monitor(struct ieee80211_local *local);
f0706e82 2065
0b7392ee 2066bool __ieee80211_recalc_txpower(struct ieee80211_link_data *link);
9925aa85 2067void ieee80211_recalc_txpower(struct ieee80211_link_data *link,
db82d8a9 2068 bool update_bss);
6aea26ce 2069void ieee80211_recalc_offload(struct ieee80211_local *local);
1ea6f9c0 2070
9607e6b6
JB
2071static inline bool ieee80211_sdata_running(struct ieee80211_sub_if_data *sdata)
2072{
34d4bc4d 2073 return test_bit(SDATA_STATE_RUNNING, &sdata->state);
9607e6b6
JB
2074}
2075
e73b5e51
JB
2076/* link handling */
2077void ieee80211_link_setup(struct ieee80211_link_data *link);
2078void ieee80211_link_init(struct ieee80211_sub_if_data *sdata,
2079 int link_id,
2080 struct ieee80211_link_data *link,
2081 struct ieee80211_bss_conf *link_conf);
2082void ieee80211_link_stop(struct ieee80211_link_data *link);
2083int ieee80211_vif_set_links(struct ieee80211_sub_if_data *sdata,
6d543b34 2084 u16 new_links, u16 dormant_links);
076fc877
JB
2085static inline void ieee80211_vif_clear_links(struct ieee80211_sub_if_data *sdata)
2086{
2087 ieee80211_vif_set_links(sdata, 0, 0);
2088}
e73b5e51 2089
90233b0a
MS
2090void ieee80211_apvlan_link_setup(struct ieee80211_sub_if_data *sdata);
2091void ieee80211_apvlan_link_clear(struct ieee80211_sub_if_data *sdata);
2092
e2ebc74d 2093/* tx handling */
e2ebc74d 2094void ieee80211_clear_tx_pending(struct ieee80211_local *local);
da1cad73 2095void ieee80211_tx_pending(struct tasklet_struct *t);
d0cf9c0d
SH
2096netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb,
2097 struct net_device *dev);
2098netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
2099 struct net_device *dev);
50ff477a
JC
2100netdev_tx_t ieee80211_subif_start_xmit_8023(struct sk_buff *skb,
2101 struct net_device *dev);
24d342c5
LK
2102void __ieee80211_subif_start_xmit(struct sk_buff *skb,
2103 struct net_device *dev,
06016772 2104 u32 info_flags,
a7528198
MT
2105 u32 ctrl_flags,
2106 u64 *cookie);
7528ec57
JB
2107struct sk_buff *
2108ieee80211_build_data_template(struct ieee80211_sub_if_data *sdata,
2109 struct sk_buff *skb, u32 info_flags);
4dc792b8 2110void ieee80211_tx_monitor(struct ieee80211_local *local, struct sk_buff *skb,
286e6967 2111 int retry_count, struct ieee80211_tx_status *status);
e2ebc74d 2112
17c18bf8
JB
2113void ieee80211_check_fast_xmit(struct sta_info *sta);
2114void ieee80211_check_fast_xmit_all(struct ieee80211_local *local);
2115void ieee80211_check_fast_xmit_iface(struct ieee80211_sub_if_data *sdata);
2116void ieee80211_clear_fast_xmit(struct sta_info *sta);
91180649
DK
2117int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev,
2118 const u8 *buf, size_t len,
dca9ca2d 2119 const u8 *dest, __be16 proto, bool unencrypted,
67207bab 2120 int link_id, u64 *cookie);
8828f81a
RM
2121int ieee80211_probe_mesh_link(struct wiphy *wiphy, struct net_device *dev,
2122 const u8 *buf, size_t len);
d5edb9ae
FF
2123void __ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata,
2124 struct sta_info *sta,
2125 struct ieee80211_fast_tx *fast_tx,
2126 struct sk_buff *skb, bool ampdu,
2127 const u8 *da, const u8 *sa);
8b0f5cb6
FF
2128void ieee80211_aggr_check(struct ieee80211_sub_if_data *sdata,
2129 struct sta_info *sta, struct sk_buff *skb);
17c18bf8 2130
de1ede7a 2131/* HT */
ef96a842
BG
2132void ieee80211_apply_htcap_overrides(struct ieee80211_sub_if_data *sdata,
2133 struct ieee80211_sta_ht_cap *ht_cap);
e1a0c6b3 2134bool ieee80211_ht_cap_ie_to_sta_ht_cap(struct ieee80211_sub_if_data *sdata,
ef96a842 2135 struct ieee80211_supported_band *sband,
4a3cb702 2136 const struct ieee80211_ht_cap *ht_cap_ie,
c71420db 2137 struct link_sta_info *link_sta);
b8695a8f
JB
2138void ieee80211_send_delba(struct ieee80211_sub_if_data *sdata,
2139 const u8 *da, u16 tid,
2140 u16 initiator, u16 reason_code);
0f78231b
JB
2141int ieee80211_send_smps_action(struct ieee80211_sub_if_data *sdata,
2142 enum ieee80211_smps_mode smps, const u8 *da,
e665ab9c 2143 const u8 *bssid, int link_id);
406c5548
MC
2144void ieee80211_add_addbaext(struct sk_buff *skb,
2145 const u8 req_addba_ext_data,
2146 u16 buf_size);
2147u8 ieee80211_retrieve_addba_ext_data(struct sta_info *sta,
2148 const void *elem_data, ssize_t elem_len,
2149 u16 *buf_size);
849b7967 2150void __ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid,
53f73c09 2151 u16 initiator, u16 reason, bool stop);
463559b7
JB
2152void __ieee80211_start_rx_ba_session(struct sta_info *sta,
2153 u8 dialog_token, u16 timeout,
2154 u16 start_seq_num, u16 ba_policy, u16 tid,
2155 u16 buf_size, bool tx, bool auto_seq,
406c5548 2156 const u8 addba_ext_data);
c82c4a80
JB
2157void ieee80211_sta_tear_down_BA_sessions(struct sta_info *sta,
2158 enum ieee80211_agg_stop_reason reason);
de1ede7a
JB
2159void ieee80211_process_delba(struct ieee80211_sub_if_data *sdata,
2160 struct sta_info *sta,
2161 struct ieee80211_mgmt *mgmt, size_t len);
2162void ieee80211_process_addba_resp(struct ieee80211_local *local,
2163 struct sta_info *sta,
2164 struct ieee80211_mgmt *mgmt,
2165 size_t len);
2166void ieee80211_process_addba_request(struct ieee80211_local *local,
2167 struct sta_info *sta,
2168 struct ieee80211_mgmt *mgmt,
2169 size_t len);
2170
ea63fb71
DA
2171static inline struct ieee80211_mgmt *
2172ieee80211_mgmt_ba(struct sk_buff *skb, const u8 *da,
2173 struct ieee80211_sub_if_data *sdata)
2174{
2175 struct ieee80211_mgmt *mgmt = skb_put_zero(skb, 24);
2176
2177 ether_addr_copy(mgmt->da, da);
2178 ether_addr_copy(mgmt->sa, sdata->vif.addr);
2179
2180 if (sdata->vif.type == NL80211_IFTYPE_AP ||
2181 sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
2182 sdata->vif.type == NL80211_IFTYPE_MESH_POINT)
2183 ether_addr_copy(mgmt->bssid, sdata->vif.addr);
2184 else if (sdata->vif.type == NL80211_IFTYPE_STATION)
2185 ether_addr_copy(mgmt->bssid, sdata->vif.cfg.ap_addr);
2186 else if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
2187 ether_addr_copy(mgmt->bssid, sdata->u.ibss.bssid);
2188
2189 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
2190 IEEE80211_STYPE_ACTION);
2191 return mgmt;
2192}
2193
849b7967 2194int __ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
c82c4a80 2195 enum ieee80211_agg_stop_reason reason);
7a7c0a64
JB
2196void ieee80211_start_tx_ba_cb(struct sta_info *sta, int tid,
2197 struct tid_ampdu_tx *tid_tx);
2198void ieee80211_stop_tx_ba_cb(struct sta_info *sta, int tid,
2199 struct tid_ampdu_tx *tid_tx);
1b672118 2200void ieee80211_ba_session_work(struct wiphy *wiphy, struct wiphy_work *work);
67c282c0 2201void ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid);
2bff8ebf 2202void ieee80211_release_reorder_timeout(struct sta_info *sta, int tid);
849b7967 2203
04ecd257 2204u8 ieee80211_mcs_to_chains(const struct ieee80211_mcs_info *mcs);
57566b20 2205enum nl80211_smps_mode
2206ieee80211_smps_mode_to_smps_mode(enum ieee80211_smps_mode smps);
04ecd257 2207
818255ea 2208/* VHT */
4a3cb702
JB
2209void
2210ieee80211_vht_cap_ie_to_sta_vht_cap(struct ieee80211_sub_if_data *sdata,
2211 struct ieee80211_supported_band *sband,
2212 const struct ieee80211_vht_cap *vht_cap_ie,
084cf2ae 2213 const struct ieee80211_vht_cap *vht_cap_ie2,
c71420db
JB
2214 struct link_sta_info *link_sta);
2215enum ieee80211_sta_rx_bandwidth
25af8ff5
JB
2216_ieee80211_sta_cap_rx_bw(struct link_sta_info *link_sta,
2217 struct cfg80211_chan_def *chandef);
2218static inline enum ieee80211_sta_rx_bandwidth
2219ieee80211_sta_cap_rx_bw(struct link_sta_info *link_sta)
2220{
2221 return _ieee80211_sta_cap_rx_bw(link_sta, NULL);
2222}
c71420db 2223enum ieee80211_sta_rx_bandwidth
7d2bad82
JB
2224_ieee80211_sta_cur_vht_bw(struct link_sta_info *link_sta,
2225 struct cfg80211_chan_def *chandef);
2226static inline enum ieee80211_sta_rx_bandwidth
2227ieee80211_sta_cur_vht_bw(struct link_sta_info *link_sta)
2228{
2229 return _ieee80211_sta_cur_vht_bw(link_sta, NULL);
2230}
a8bca3e9 2231void ieee80211_sta_init_nss(struct link_sta_info *link_sta);
c71420db
JB
2232enum nl80211_chan_width
2233ieee80211_sta_cap_chan_bw(struct link_sta_info *link_sta);
23a1f8d4 2234void ieee80211_process_mu_groups(struct ieee80211_sub_if_data *sdata,
d8675a63 2235 struct ieee80211_link_data *link,
23a1f8d4 2236 struct ieee80211_mgmt *mgmt);
b1bce14a 2237u32 __ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata,
c71420db 2238 struct link_sta_info *sta,
afe0d181 2239 u8 opmode, enum nl80211_band band);
0af83d3d 2240void ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata,
c71420db 2241 struct link_sta_info *sta,
afe0d181 2242 u8 opmode, enum nl80211_band band);
dd5ecfea
JB
2243void ieee80211_apply_vhtcap_overrides(struct ieee80211_sub_if_data *sdata,
2244 struct ieee80211_sta_vht_cap *vht_cap);
b119ad6e
LB
2245void ieee80211_get_vht_mask_from_cap(__le16 vht_cap,
2246 u16 vht_mask[NL80211_VHT_NSS_MAX]);
97f5f425 2247enum nl80211_chan_width
c71420db 2248ieee80211_sta_rx_bw_to_chan_width(struct link_sta_info *sta);
4a34215e 2249
41cbb0f5
LC
2250/* HE */
2251void
2252ieee80211_he_cap_ie_to_sta_he_cap(struct ieee80211_sub_if_data *sdata,
2253 struct ieee80211_supported_band *sband,
2254 const u8 *he_cap_ie, u8 he_cap_len,
1bb9a8a4 2255 const struct ieee80211_he_6ghz_capa *he_6ghz_capa,
c71420db 2256 struct link_sta_info *link_sta);
1ced169c
JC
2257void
2258ieee80211_he_spr_ie_to_bss_conf(struct ieee80211_vif *vif,
2259 const struct ieee80211_he_spr *he_spr_ie_elem);
41cbb0f5 2260
697f6c50
JC
2261void
2262ieee80211_he_op_ie_to_bss_conf(struct ieee80211_vif *vif,
2263 const struct ieee80211_he_operation *he_op_ie_elem);
2264
12bf8fad
TP
2265/* S1G */
2266void ieee80211_s1g_sta_rate_init(struct sta_info *sta);
f5a4c24e
LB
2267bool ieee80211_s1g_is_twt_setup(struct sk_buff *skb);
2268void ieee80211_s1g_rx_twt_action(struct ieee80211_sub_if_data *sdata,
2269 struct sk_buff *skb);
2270void ieee80211_s1g_status_twt_action(struct ieee80211_sub_if_data *sdata,
2271 struct sk_buff *skb);
12bf8fad 2272
39192c0b
JB
2273/* Spectrum management */
2274void ieee80211_process_measurement_req(struct ieee80211_sub_if_data *sdata,
2275 struct ieee80211_mgmt *mgmt,
2276 size_t len);
e6b7cde4
SW
2277/**
2278 * ieee80211_parse_ch_switch_ie - parses channel switch IEs
2279 * @sdata: the sdata of the interface which has received the frame
2280 * @elems: parsed 802.11 elements received with the frame
e6b7cde4 2281 * @current_band: indicates the current band
2a333a0d 2282 * @vht_cap_info: VHT capabilities of the transmitter
310c8387
JB
2283 * @conn: contains information about own capabilities and restrictions
2284 * to decide which channel switch announcements can be accepted
e6b7cde4 2285 * @bssid: the currently connected bssid (for reporting)
414e090b
JB
2286 * @unprot_action: whether the frame was an unprotected frame or not,
2287 * used for reporting
c0f17eb9 2288 * @csa_ie: parsed 802.11 csa elements on count, mode, chandef and mesh ttl.
799f53e2 2289 * All of them will be filled with if success only.
e6b7cde4
SW
2290 * Return: 0 on success, <0 on error and >0 if there is nothing to parse.
2291 */
2292int ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data *sdata,
84469a45 2293 struct ieee802_11_elems *elems,
57fbcce3 2294 enum nl80211_band current_band,
2a333a0d 2295 u32 vht_cap_info,
310c8387 2296 struct ieee80211_conn_settings *conn,
414e090b 2297 u8 *bssid, bool unprot_action,
c0f17eb9 2298 struct ieee80211_csa_ie *csa_ie);
39192c0b 2299
f2753ddb
JB
2300/* Suspend/resume and hw reconfiguration */
2301int ieee80211_reconfig(struct ieee80211_local *local);
1decf05d 2302void ieee80211_stop_device(struct ieee80211_local *local, bool suspend);
f2753ddb 2303
eecc4800
JB
2304int __ieee80211_suspend(struct ieee80211_hw *hw,
2305 struct cfg80211_wowlan *wowlan);
f2753ddb
JB
2306
2307static inline int __ieee80211_resume(struct ieee80211_hw *hw)
2308{
85f72bc8
JL
2309 struct ieee80211_local *local = hw_to_local(hw);
2310
9120d94e
LC
2311 WARN(test_bit(SCAN_HW_SCANNING, &local->scanning) &&
2312 !test_bit(SCAN_COMPLETED, &local->scanning),
85f72bc8
JL
2313 "%s: resume with hardware scan still in progress\n",
2314 wiphy_name(hw->wiphy));
2315
f2753ddb
JB
2316 return ieee80211_reconfig(hw_to_local(hw));
2317}
665af4fc 2318
c2d1560a 2319/* utility functions/constants */
8a47cea7 2320extern const void *const mac80211_wiphy_privid; /* for wiphy privid */
310c8387
JB
2321const char *ieee80211_conn_mode_str(enum ieee80211_conn_mode mode);
2322enum ieee80211_conn_bw_limit
2323ieee80211_min_bw_limit_from_chandef(struct cfg80211_chan_def *chandef);
57fbcce3 2324int ieee80211_frame_duration(enum nl80211_band band, size_t len,
2400dfe2 2325 int rate, int erp, int short_preamble);
e552af05
HD
2326void ieee80211_regulatory_limit_wmm_params(struct ieee80211_sub_if_data *sdata,
2327 struct ieee80211_tx_queue_params *qparam,
2328 int ac);
39dc8b8e 2329void ieee80211_clear_tpe(struct ieee80211_parsed_tpe *tpe);
b3e2130b 2330void ieee80211_set_wmm_default(struct ieee80211_link_data *link,
cec66283 2331 bool bss_notify, bool enable_qos);
7c10770f 2332void ieee80211_xmit(struct ieee80211_sub_if_data *sdata,
08aca29a 2333 struct sta_info *sta, struct sk_buff *skb);
55de908a
JB
2334
2335void __ieee80211_tx_skb_tid_band(struct ieee80211_sub_if_data *sdata,
e1e68b14 2336 struct sk_buff *skb, int tid, int link_id,
08aca29a 2337 enum nl80211_band band);
55de908a 2338
50ff477a
JC
2339/* sta_out needs to be checked for ERR_PTR() before using */
2340int ieee80211_lookup_ra_sta(struct ieee80211_sub_if_data *sdata,
2341 struct sk_buff *skb,
2342 struct sta_info **sta_out);
2343
55de908a
JB
2344static inline void
2345ieee80211_tx_skb_tid_band(struct ieee80211_sub_if_data *sdata,
2346 struct sk_buff *skb, int tid,
08aca29a 2347 enum nl80211_band band)
55de908a
JB
2348{
2349 rcu_read_lock();
e1e68b14 2350 __ieee80211_tx_skb_tid_band(sdata, skb, tid, -1, band);
55de908a
JB
2351 rcu_read_unlock();
2352}
cf6bb79a 2353
eef25a66 2354void ieee80211_tx_skb_tid(struct ieee80211_sub_if_data *sdata,
e1e68b14 2355 struct sk_buff *skb, int tid, int link_id);
55de908a
JB
2356
2357static inline void ieee80211_tx_skb(struct ieee80211_sub_if_data *sdata,
cf6bb79a
HS
2358 struct sk_buff *skb)
2359{
2360 /* Send all internal mgmt frames on VO. Accordingly set TID to 7. */
e1e68b14 2361 ieee80211_tx_skb_tid(sdata, skb, 7, -1);
cf6bb79a
HS
2362}
2363
fd17bf04
JB
2364/**
2365 * struct ieee80211_elems_parse_params - element parsing parameters
310c8387 2366 * @mode: connection mode for parsing
fd17bf04
JB
2367 * @start: pointer to the elements
2368 * @len: length of the elements
2369 * @action: %true if the elements came from an action frame
2370 * @filter: bitmap of element IDs to filter out while calculating
2371 * the element CRC
2372 * @crc: CRC starting value
38c6aa29
JB
2373 * @bss: the BSS to parse this as, for multi-BSSID cases this can
2374 * represent a non-transmitting BSS in which case the data
2375 * for that non-transmitting BSS is returned
425f4b5f 2376 * @link_id: the link ID to parse elements for, if a STA profile
45ebac4f
IP
2377 * is present in the multi-link element, or -1 to ignore;
2378 * note that the code currently assumes parsing an association
2379 * (or re-association) response frame if this is given
ea5cba26
JB
2380 * @from_ap: frame is received from an AP (currently used only
2381 * for EHT capabilities parsing)
fd17bf04
JB
2382 */
2383struct ieee80211_elems_parse_params {
310c8387 2384 enum ieee80211_conn_mode mode;
fd17bf04
JB
2385 const u8 *start;
2386 size_t len;
2387 bool action;
2388 u64 filter;
2389 u32 crc;
38c6aa29 2390 struct cfg80211_bss *bss;
425f4b5f 2391 int link_id;
ea5cba26 2392 bool from_ap;
fd17bf04
JB
2393};
2394
2395struct ieee802_11_elems *
2396ieee802_11_parse_elems_full(struct ieee80211_elems_parse_params *params);
2397
2398static inline struct ieee802_11_elems *
2399ieee802_11_parse_elems_crc(const u8 *start, size_t len, bool action,
2400 u64 filter, u32 crc,
38c6aa29 2401 struct cfg80211_bss *bss)
fd17bf04
JB
2402{
2403 struct ieee80211_elems_parse_params params = {
310c8387 2404 .mode = IEEE80211_CONN_MODE_HIGHEST,
fd17bf04
JB
2405 .start = start,
2406 .len = len,
2407 .action = action,
2408 .filter = filter,
2409 .crc = crc,
38c6aa29 2410 .bss = bss,
425f4b5f 2411 .link_id = -1,
fd17bf04
JB
2412 };
2413
2414 return ieee802_11_parse_elems_full(&params);
2415}
2416
5d24828d
JB
2417static inline struct ieee802_11_elems *
2418ieee802_11_parse_elems(const u8 *start, size_t len, bool action,
38c6aa29 2419 struct cfg80211_bss *bss)
ddc4db2e 2420{
38c6aa29 2421 return ieee802_11_parse_elems_crc(start, len, action, 0, 0, bss);
ddc4db2e
JB
2422}
2423
02219b3a
JB
2424extern const int ieee802_1d_to_ac[8];
2425
2426static inline int ieee80211_ac_from_tid(int tid)
2427{
2428 return ieee802_1d_to_ac[tid & 7];
2429}
2430
9fa659f9
JB
2431void ieee80211_dynamic_ps_enable_work(struct wiphy *wiphy,
2432 struct wiphy_work *work);
2433void ieee80211_dynamic_ps_disable_work(struct wiphy *wiphy,
2434 struct wiphy_work *work);
34f11cd3 2435void ieee80211_dynamic_ps_timer(struct timer_list *t);
a97b77b9
VN
2436void ieee80211_send_nullfunc(struct ieee80211_local *local,
2437 struct ieee80211_sub_if_data *sdata,
076cdcb1 2438 bool powersave);
a5d3cbdb
FF
2439void ieee80211_send_4addr_nullfunc(struct ieee80211_local *local,
2440 struct ieee80211_sub_if_data *sdata);
4e5ff376 2441void ieee80211_sta_tx_notify(struct ieee80211_sub_if_data *sdata,
02219b3a 2442 struct ieee80211_hdr *hdr, bool ack, u16 tx_time);
11ac0d7c
EG
2443unsigned int
2444ieee80211_get_vif_queues(struct ieee80211_local *local,
2445 struct ieee80211_sub_if_data *sdata);
ce7c9111 2446void ieee80211_wake_queues_by_reason(struct ieee80211_hw *hw,
445ea4e8 2447 unsigned long queues,
cca07b00
LC
2448 enum queue_stop_reason reason,
2449 bool refcounted);
ce7c9111 2450void ieee80211_stop_queues_by_reason(struct ieee80211_hw *hw,
445ea4e8 2451 unsigned long queues,
cca07b00
LC
2452 enum queue_stop_reason reason,
2453 bool refcounted);
96f5e66e 2454void ieee80211_wake_queue_by_reason(struct ieee80211_hw *hw, int queue,
cca07b00
LC
2455 enum queue_stop_reason reason,
2456 bool refcounted);
96f5e66e 2457void ieee80211_stop_queue_by_reason(struct ieee80211_hw *hw, int queue,
cca07b00
LC
2458 enum queue_stop_reason reason,
2459 bool refcounted);
11ac0d7c
EG
2460static inline void
2461ieee80211_stop_vif_queues(struct ieee80211_local *local,
2462 struct ieee80211_sub_if_data *sdata,
2463 enum queue_stop_reason reason)
2464{
2465 ieee80211_stop_queues_by_reason(&local->hw,
2466 ieee80211_get_vif_queues(local, sdata),
2467 reason, true);
2468}
2469
2470static inline void
2471ieee80211_wake_vif_queues(struct ieee80211_local *local,
2472 struct ieee80211_sub_if_data *sdata,
2473 enum queue_stop_reason reason)
2474{
2475 ieee80211_wake_queues_by_reason(&local->hw,
2476 ieee80211_get_vif_queues(local, sdata),
2477 reason, true);
2478}
2479static inline void
2480ieee80211_stop_vif_queues_norefcount(struct ieee80211_local *local,
2481 struct ieee80211_sub_if_data *sdata,
2482 enum queue_stop_reason reason)
2483{
2484 ieee80211_stop_queues_by_reason(&local->hw,
2485 ieee80211_get_vif_queues(local, sdata),
2486 reason, false);
2487}
2488static inline void
2489ieee80211_wake_vif_queues_norefcount(struct ieee80211_local *local,
2490 struct ieee80211_sub_if_data *sdata,
2491 enum queue_stop_reason reason)
2492{
2493 ieee80211_wake_queues_by_reason(&local->hw,
2494 ieee80211_get_vif_queues(local, sdata),
2495 reason, false);
2496}
8f77f384
JB
2497void ieee80211_add_pending_skb(struct ieee80211_local *local,
2498 struct sk_buff *skb);
e3685e03
JB
2499void ieee80211_add_pending_skbs(struct ieee80211_local *local,
2500 struct sk_buff_head *skbs);
39ecc01d 2501void ieee80211_flush_queues(struct ieee80211_local *local,
3b24f4c6 2502 struct ieee80211_sub_if_data *sdata, bool drop);
4f9610d5
LK
2503void __ieee80211_flush_queues(struct ieee80211_local *local,
2504 struct ieee80211_sub_if_data *sdata,
3b24f4c6 2505 unsigned int queues, bool drop);
ce7c9111 2506
4afaff17
EG
2507static inline bool ieee80211_can_run_worker(struct ieee80211_local *local)
2508{
f8891461
NG
2509 /*
2510 * It's unsafe to try to do any work during reconfigure flow.
2511 * When the flow ends the work will be requeued.
2512 */
2513 if (local->in_reconfig)
2514 return false;
2515
4afaff17
EG
2516 /*
2517 * If quiescing is set, we are racing with __ieee80211_suspend.
2518 * __ieee80211_suspend flushes the workers after setting quiescing,
4b482281 2519 * and we check quiescing / suspended before enqueuing new workers.
4afaff17
EG
2520 * We should abort the worker to avoid the races below.
2521 */
2522 if (local->quiescing)
2523 return false;
2524
2525 /*
2526 * We might already be suspended if the following scenario occurs:
2527 * __ieee80211_suspend Control path
2528 *
2529 * if (local->quiescing)
2530 * return;
2531 * local->quiescing = true;
2532 * flush_workqueue();
2533 * queue_work(...);
2534 * local->suspended = true;
2535 * local->quiescing = false;
2536 * worker starts running...
2537 */
2538 if (local->suspended)
2539 return false;
2540
2541 return true;
2542}
2543
fa962b92 2544int ieee80211_txq_setup_flows(struct ieee80211_local *local);
2fe4a29a 2545void ieee80211_txq_set_params(struct ieee80211_local *local);
fa962b92
MK
2546void ieee80211_txq_teardown_flows(struct ieee80211_local *local);
2547void ieee80211_txq_init(struct ieee80211_sub_if_data *sdata,
2548 struct sta_info *sta,
2549 struct txq_info *txq, int tid);
2550void ieee80211_txq_purge(struct ieee80211_local *local,
2551 struct txq_info *txqi);
3831f6d8 2552void ieee80211_purge_sta_txqs(struct sta_info *sta);
2a9e2579
JB
2553void ieee80211_txq_remove_vlan(struct ieee80211_local *local,
2554 struct ieee80211_sub_if_data *sdata);
2fe4a29a
THJ
2555void ieee80211_fill_txq_stats(struct cfg80211_txq_stats *txqstats,
2556 struct txq_info *txqi);
da1cad73 2557void ieee80211_wake_txqs(struct tasklet_struct *t);
46900298 2558void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata,
700e8ea6 2559 u16 transaction, u16 auth_alg, u16 status,
4a3cb702 2560 const u8 *extra, size_t extra_len, const u8 *bssid,
1672c0e3
JB
2561 const u8 *da, const u8 *key, u8 key_len, u8 key_idx,
2562 u32 tx_flags);
6ae16775 2563void ieee80211_send_deauth_disassoc(struct ieee80211_sub_if_data *sdata,
4b08d1b6
JB
2564 const u8 *da, const u8 *bssid,
2565 u16 stype, u16 reason,
6ae16775 2566 bool send_frame, u8 *frame_buf);
00387f32
JB
2567
2568enum {
2569 IEEE80211_PROBE_FLAG_DIRECTED = BIT(0),
b9771d41
JB
2570 IEEE80211_PROBE_FLAG_MIN_CONTENT = BIT(1),
2571 IEEE80211_PROBE_FLAG_RANDOM_SN = BIT(2),
00387f32
JB
2572};
2573
2ad2274c 2574int ieee80211_build_preq_ies(struct ieee80211_sub_if_data *sdata, u8 *buffer,
c56ef672
DS
2575 size_t buffer_len,
2576 struct ieee80211_scan_ies *ie_desc,
2577 const u8 *ie, size_t ie_len,
2578 u8 bands_used, u32 *rate_masks,
00387f32
JB
2579 struct cfg80211_chan_def *chandef,
2580 u32 flags);
a619a4c0 2581struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata,
a344d677
JB
2582 const u8 *src, const u8 *dst,
2583 u32 ratemask,
6b77863b 2584 struct ieee80211_channel *chan,
a619a4c0 2585 const u8 *ssid, size_t ssid_len,
a806c558 2586 const u8 *ie, size_t ie_len,
00387f32 2587 u32 flags);
2103dec1 2588u32 ieee80211_sta_get_rates(struct ieee80211_sub_if_data *sdata,
46900298 2589 struct ieee802_11_elems *elems,
57fbcce3 2590 enum nl80211_band band, u32 *basic_rates);
687da132 2591int __ieee80211_request_smps_mgd(struct ieee80211_sub_if_data *sdata,
d8675a63 2592 struct ieee80211_link_data *link,
687da132 2593 enum ieee80211_smps_mode smps_mode);
e9aac179 2594void ieee80211_recalc_smps(struct ieee80211_sub_if_data *sdata,
d8675a63 2595 struct ieee80211_link_data *link);
0cbf348a
AO
2596void ieee80211_recalc_min_chandef(struct ieee80211_sub_if_data *sdata,
2597 int link_id);
46900298 2598
8e664fb3 2599size_t ieee80211_ie_split_vendor(const u8 *ies, size_t ielen, size_t offset);
ef96a842 2600u8 *ieee80211_ie_build_ht_cap(u8 *pos, struct ieee80211_sta_ht_cap *ht_cap,
42e7aa77 2601 u16 cap);
074d46d1 2602u8 *ieee80211_ie_build_ht_oper(u8 *pos, struct ieee80211_sta_ht_cap *ht_cap,
4bf88530 2603 const struct cfg80211_chan_def *chandef,
57f255f5 2604 u16 prot_mode, bool rifs_mode);
75d627d5
SW
2605void ieee80211_ie_build_wide_bw_cs(u8 *pos,
2606 const struct cfg80211_chan_def *chandef);
ba0afa2f
MP
2607u8 *ieee80211_ie_build_vht_cap(u8 *pos, struct ieee80211_sta_vht_cap *vht_cap,
2608 u32 cap);
fb28ec0c
AN
2609u8 *ieee80211_ie_build_vht_oper(u8 *pos, struct ieee80211_sta_vht_cap *vht_cap,
2610 const struct cfg80211_chan_def *chandef);
90233160 2611u8 ieee80211_ie_len_he_cap(struct ieee80211_sub_if_data *sdata);
2b73e9ab
JJ
2612u8 *ieee80211_ie_build_he_oper(u8 *pos, const struct cfg80211_chan_def *chandef);
2613u8 *ieee80211_ie_build_eht_oper(u8 *pos, const struct cfg80211_chan_def *chandef,
df1875c4 2614 const struct ieee80211_sta_eht_cap *eht_cap);
3dc05935 2615int ieee80211_parse_bitrates(enum nl80211_chan_width width,
2103dec1
SW
2616 const struct ieee80211_supported_band *sband,
2617 const u8 *srates, int srates_len, u32 *rates);
40b861a0 2618u8 *ieee80211_add_wmm_info_ie(u8 *buf, u8 qosinfo);
7957c6c8
TP
2619void ieee80211_add_s1g_capab_ie(struct ieee80211_sub_if_data *sdata,
2620 struct ieee80211_sta_s1g_cap *caps,
2621 struct sk_buff *skb);
1d00ce80
TP
2622void ieee80211_add_aid_request_ie(struct ieee80211_sub_if_data *sdata,
2623 struct sk_buff *skb);
8e664fb3 2624
552a26b3 2625/* element building in SKBs */
147ceae2
JB
2626int ieee80211_put_srates_elem(struct sk_buff *skb,
2627 const struct ieee80211_supported_band *sband,
996c15bd 2628 u32 basic_rates, u32 masked_rates,
147ceae2 2629 u8 element_id);
28aa895b
JB
2630int ieee80211_put_he_cap(struct sk_buff *skb,
2631 struct ieee80211_sub_if_data *sdata,
2632 const struct ieee80211_supported_band *sband,
2633 const struct ieee80211_conn_settings *conn);
07095d16
JB
2634int ieee80211_put_he_6ghz_cap(struct sk_buff *skb,
2635 struct ieee80211_sub_if_data *sdata,
2636 enum ieee80211_smps_mode smps_mode);
ea8af8be
JB
2637int ieee80211_put_eht_cap(struct sk_buff *skb,
2638 struct ieee80211_sub_if_data *sdata,
2639 const struct ieee80211_supported_band *sband,
2640 const struct ieee80211_conn_settings *conn);
552a26b3 2641
f444de05 2642/* channel management */
8ac3c704
JB
2643bool ieee80211_chandef_ht_oper(const struct ieee80211_ht_operation *ht_oper,
2644 struct cfg80211_chan_def *chandef);
2a333a0d 2645bool ieee80211_chandef_vht_oper(struct ieee80211_hw *hw, u32 vht_cap_info,
7eb26df2
JB
2646 const struct ieee80211_vht_operation *oper,
2647 const struct ieee80211_ht_operation *htop,
8ac3c704 2648 struct cfg80211_chan_def *chandef);
b3239498 2649void ieee80211_chandef_eht_oper(const struct ieee80211_eht_operation_info *info,
1e0b3b0b 2650 struct cfg80211_chan_def *chandef);
2d9698dd 2651bool ieee80211_chandef_he_6ghz_oper(struct ieee80211_local *local,
57fa5e85 2652 const struct ieee80211_he_operation *he_oper,
5dca295d 2653 const struct ieee80211_eht_operation *eht_oper,
57fa5e85 2654 struct cfg80211_chan_def *chandef);
1d00ce80
TP
2655bool ieee80211_chandef_s1g_oper(const struct ieee80211_s1g_oper_ie *oper,
2656 struct cfg80211_chan_def *chandef);
310c8387
JB
2657void ieee80211_chandef_downgrade(struct cfg80211_chan_def *chandef,
2658 struct ieee80211_conn_settings *conn);
761748f0
JB
2659static inline void
2660ieee80211_chanreq_downgrade(struct ieee80211_chan_req *chanreq,
2661 struct ieee80211_conn_settings *conn)
2662{
2663 ieee80211_chandef_downgrade(&chanreq->oper, conn);
2664 if (WARN_ON(!conn))
2665 return;
2666 if (conn->mode < IEEE80211_CONN_MODE_EHT)
2667 chanreq->ap.chan = NULL;
2668}
2669
2670bool ieee80211_chanreq_identical(const struct ieee80211_chan_req *a,
2671 const struct ieee80211_chan_req *b);
f444de05 2672
d01a1e65 2673int __must_check
cc3ea42c
BB
2674_ieee80211_link_use_channel(struct ieee80211_link_data *link,
2675 const struct ieee80211_chan_req *req,
2676 enum ieee80211_chanctx_mode mode,
2677 bool assign_on_failure);
2678
2679static inline int __must_check
b4f85443 2680ieee80211_link_use_channel(struct ieee80211_link_data *link,
6092077a 2681 const struct ieee80211_chan_req *req,
cc3ea42c
BB
2682 enum ieee80211_chanctx_mode mode)
2683{
2684 return _ieee80211_link_use_channel(link, req, mode, false);
2685}
2686
11335a55 2687int __must_check
b4f85443 2688ieee80211_link_reserve_chanctx(struct ieee80211_link_data *link,
6092077a 2689 const struct ieee80211_chan_req *req,
b4f85443
JB
2690 enum ieee80211_chanctx_mode mode,
2691 bool radar_required);
11335a55 2692int __must_check
b4f85443
JB
2693ieee80211_link_use_reserved_context(struct ieee80211_link_data *link);
2694int ieee80211_link_unreserve_chanctx(struct ieee80211_link_data *link);
11335a55 2695
2c9b7359 2696int __must_check
6092077a
JB
2697ieee80211_link_change_chanreq(struct ieee80211_link_data *link,
2698 const struct ieee80211_chan_req *req,
2699 u64 *changed);
3c9ff1a1
JB
2700void __ieee80211_link_release_channel(struct ieee80211_link_data *link,
2701 bool skip_idle_recalc);
b4f85443
JB
2702void ieee80211_link_release_channel(struct ieee80211_link_data *link);
2703void ieee80211_link_vlan_copy_chanctx(struct ieee80211_link_data *link);
2704void ieee80211_link_copy_chanctx_to_vlans(struct ieee80211_link_data *link,
2705 bool clear);
c0166da9
MK
2706int ieee80211_chanctx_refcount(struct ieee80211_local *local,
2707 struct ieee80211_chanctx *ctx);
d01a1e65 2708
04ecd257
JB
2709void ieee80211_recalc_smps_chanctx(struct ieee80211_local *local,
2710 struct ieee80211_chanctx *chanctx);
21f659bf 2711void ieee80211_recalc_chanctx_min_def(struct ieee80211_local *local,
b72a455a 2712 struct ieee80211_chanctx *ctx,
dd7b1bdb
JB
2713 struct ieee80211_link_data *rsvd_for,
2714 bool check_reserved);
5cbc95a7 2715bool ieee80211_is_radar_required(struct ieee80211_local *local);
164eb02d 2716
766d2601 2717void ieee80211_dfs_cac_timer_work(struct wiphy *wiphy, struct wiphy_work *work);
bca8bc03
AKS
2718void ieee80211_dfs_cac_cancel(struct ieee80211_local *local,
2719 struct ieee80211_chanctx *chanctx);
228e4f93
JB
2720void ieee80211_dfs_radar_detected_work(struct wiphy *wiphy,
2721 struct wiphy_work *work);
c6da674a
CYY
2722int ieee80211_send_action_csa(struct ieee80211_sub_if_data *sdata,
2723 struct cfg80211_csa_settings *csa_settings);
04ecd257 2724
057d5f4b
TP
2725void ieee80211_recalc_dtim(struct ieee80211_local *local,
2726 struct ieee80211_sub_if_data *sdata);
73de86a3
LC
2727int ieee80211_check_combinations(struct ieee80211_sub_if_data *sdata,
2728 const struct cfg80211_chan_def *chandef,
2729 enum ieee80211_chanctx_mode chanmode,
0874bcd0
FF
2730 u8 radar_detect, int radio_idx);
2731int ieee80211_max_num_channels(struct ieee80211_local *local, int radio_idx);
2732u32 ieee80211_get_radio_mask(struct wiphy *wiphy, struct net_device *dev);
0fabfaaf
AN
2733void ieee80211_recalc_chanctx_chantype(struct ieee80211_local *local,
2734 struct ieee80211_chanctx *ctx);
2475b1cc 2735
95224fe8
AN
2736/* TDLS */
2737int ieee80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev,
c6112046
MS
2738 const u8 *peer, int link_id,
2739 u8 action_code, u8 dialog_token, u16 status_code,
2740 u32 peer_capability, bool initiator,
2741 const u8 *extra_ies, size_t extra_ies_len);
95224fe8 2742int ieee80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev,
3b3a0162 2743 const u8 *peer, enum nl80211_tdls_operation oper);
777b2600 2744void ieee80211_tdls_peer_del_work(struct wiphy *wiphy, struct wiphy_work *wk);
a7a6bdd0
AN
2745int ieee80211_tdls_channel_switch(struct wiphy *wiphy, struct net_device *dev,
2746 const u8 *addr, u8 oper_class,
2747 struct cfg80211_chan_def *chandef);
2748void ieee80211_tdls_cancel_channel_switch(struct wiphy *wiphy,
2749 struct net_device *dev,
2750 const u8 *addr);
85977fc0 2751void ieee80211_teardown_tdls_peers(struct ieee80211_link_data *link);
79c92ca4
YW
2752void ieee80211_tdls_handle_disconnect(struct ieee80211_sub_if_data *sdata,
2753 const u8 *peer, u16 reason);
f057d140
JB
2754void
2755ieee80211_process_tdls_channel_switch(struct ieee80211_sub_if_data *sdata,
2756 struct sk_buff *skb);
2757
2758
79c92ca4 2759const char *ieee80211_get_reason_code_string(u16 reason_code);
05d10957 2760u16 ieee80211_encode_usf(int val);
09a740ce
TP
2761u8 *ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t len,
2762 enum nl80211_iftype type);
95224fe8 2763
b7ffbd7e
JB
2764extern const struct ethtool_ops ieee80211_ethtool_ops;
2765
db3e1c40
THJ
2766u32 ieee80211_calc_expected_tx_airtime(struct ieee80211_hw *hw,
2767 struct ieee80211_vif *vif,
2768 struct ieee80211_sta *pubsta,
3ff901cb 2769 int len, bool ampdu);
f4ea83dd 2770#ifdef CONFIG_MAC80211_NOINLINE
d9e8a70f
JB
2771#define debug_noinline noinline
2772#else
2773#define debug_noinline
2774#endif
2775
3a11ce08
JB
2776void ieee80211_init_frag_cache(struct ieee80211_fragment_cache *cache);
2777void ieee80211_destroy_frag_cache(struct ieee80211_fragment_cache *cache);
2778
90233160 2779u8 ieee80211_ie_len_eht_cap(struct ieee80211_sub_if_data *sdata);
a1de6407
IP
2780
2781void
2782ieee80211_eht_cap_ie_to_sta_eht_cap(struct ieee80211_sub_if_data *sdata,
2783 struct ieee80211_supported_band *sband,
2784 const u8 *he_cap_ie, u8 he_cap_len,
2785 const struct ieee80211_eht_cap_elem *eht_cap_ie_elem,
c71420db
JB
2786 u8 eht_cap_len,
2787 struct link_sta_info *link_sta);
8f500fbc
AB
2788void ieee80211_process_neg_ttlm_req(struct ieee80211_sub_if_data *sdata,
2789 struct ieee80211_mgmt *mgmt, size_t len);
f7660b3f
AB
2790void ieee80211_process_neg_ttlm_res(struct ieee80211_sub_if_data *sdata,
2791 struct ieee80211_mgmt *mgmt, size_t len);
2792int ieee80211_req_neg_ttlm(struct ieee80211_sub_if_data *sdata,
2793 struct cfg80211_ttlm_params *params);
8b8a6731 2794void ieee80211_process_ttlm_teardown(struct ieee80211_sub_if_data *sdata);
d34be431
EQ
2795
2796void ieee80211_check_wbrf_support(struct ieee80211_local *local);
2797void ieee80211_add_wbrf(struct ieee80211_local *local, struct cfg80211_chan_def *chandef);
2798void ieee80211_remove_wbrf(struct ieee80211_local *local, struct cfg80211_chan_def *chandef);
de86c5f6
IP
2799int ieee80211_mgd_set_epcs(struct ieee80211_sub_if_data *sdata, bool enable);
2800void ieee80211_process_epcs_ena_resp(struct ieee80211_sub_if_data *sdata,
2801 struct ieee80211_mgmt *mgmt, size_t len);
2802void ieee80211_process_epcs_teardown(struct ieee80211_sub_if_data *sdata,
2803 struct ieee80211_mgmt *mgmt, size_t len);
d34be431 2804
36e05b0b 2805int ieee80211_mgd_assoc_ml_reconf(struct ieee80211_sub_if_data *sdata,
a096a860 2806 struct cfg80211_ml_reconf_req *req);
36e05b0b
IP
2807
2808void ieee80211_process_ml_reconf_resp(struct ieee80211_sub_if_data *sdata,
2809 struct ieee80211_mgmt *mgmt, size_t len);
f6008327
RS
2810void ieee80211_stop_mbssid(struct ieee80211_sub_if_data *sdata);
2811
0738e55c
JB
2812#if IS_ENABLED(CONFIG_MAC80211_KUNIT_TEST)
2813#define EXPORT_SYMBOL_IF_MAC80211_KUNIT(sym) EXPORT_SYMBOL_IF_KUNIT(sym)
2814#define VISIBLE_IF_MAC80211_KUNIT
2815ieee80211_rx_result
2816ieee80211_drop_unencrypted_mgmt(struct ieee80211_rx_data *rx);
39dc8b8e
JB
2817int ieee80211_calc_chandef_subchan_offset(const struct cfg80211_chan_def *ap,
2818 u8 n_partial_subchans);
2819void ieee80211_rearrange_tpe_psd(struct ieee80211_parsed_tpe_psd *psd,
2820 const struct cfg80211_chan_def *ap,
2821 const struct cfg80211_chan_def *used);
b46524b5
BB
2822struct ieee802_11_elems *
2823ieee80211_determine_chan_mode(struct ieee80211_sub_if_data *sdata,
2824 struct ieee80211_conn_settings *conn,
2825 struct cfg80211_bss *cbss, int link_id,
2826 struct ieee80211_chan_req *chanreq,
2827 struct cfg80211_chan_def *ap_chandef,
2828 unsigned long *userspace_selectors);
0738e55c
JB
2829#else
2830#define EXPORT_SYMBOL_IF_MAC80211_KUNIT(sym)
2831#define VISIBLE_IF_MAC80211_KUNIT static
2832#endif
2833
f0706e82 2834#endif /* IEEE80211_I_H */