]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blob - net/mac80211/ieee80211_i.h
mac80211: add Intel Mobile Communications copyright
[mirror_ubuntu-jammy-kernel.git] / net / mac80211 / ieee80211_i.h
1 /*
2 * Copyright 2002-2005, Instant802 Networks, Inc.
3 * Copyright 2005, Devicescape Software, Inc.
4 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
5 * Copyright 2007-2010 Johannes Berg <johannes@sipsolutions.net>
6 * Copyright 2013-2014 Intel Mobile Communications GmbH
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13 #ifndef IEEE80211_I_H
14 #define IEEE80211_I_H
15
16 #include <linux/kernel.h>
17 #include <linux/device.h>
18 #include <linux/if_ether.h>
19 #include <linux/interrupt.h>
20 #include <linux/list.h>
21 #include <linux/netdevice.h>
22 #include <linux/skbuff.h>
23 #include <linux/workqueue.h>
24 #include <linux/types.h>
25 #include <linux/spinlock.h>
26 #include <linux/etherdevice.h>
27 #include <linux/leds.h>
28 #include <linux/idr.h>
29 #include <net/ieee80211_radiotap.h>
30 #include <net/cfg80211.h>
31 #include <net/mac80211.h>
32 #include "key.h"
33 #include "sta_info.h"
34 #include "debug.h"
35
36 struct ieee80211_local;
37
38 /* Maximum number of broadcast/multicast frames to buffer when some of the
39 * associated stations are using power saving. */
40 #define AP_MAX_BC_BUFFER 128
41
42 /* Maximum number of frames buffered to all STAs, including multicast frames.
43 * Note: increasing this limit increases the potential memory requirement. Each
44 * frame can be up to about 2 kB long. */
45 #define TOTAL_MAX_TX_BUFFER 512
46
47 /* Required encryption head and tailroom */
48 #define IEEE80211_ENCRYPT_HEADROOM 8
49 #define IEEE80211_ENCRYPT_TAILROOM 18
50
51 /* IEEE 802.11 (Ch. 9.5 Defragmentation) requires support for concurrent
52 * reception of at least three fragmented frames. This limit can be increased
53 * by changing this define, at the cost of slower frame reassembly and
54 * increased memory use (about 2 kB of RAM per entry). */
55 #define IEEE80211_FRAGMENT_MAX 4
56
57 /* power level hasn't been configured (or set to automatic) */
58 #define IEEE80211_UNSET_POWER_LEVEL INT_MIN
59
60 /*
61 * Some APs experience problems when working with U-APSD. Decrease the
62 * probability of that happening by using legacy mode for all ACs but VO.
63 * The AP that caused us trouble was a Cisco 4410N. It ignores our
64 * setting, and always treats non-VO ACs as legacy.
65 */
66 #define IEEE80211_DEFAULT_UAPSD_QUEUES \
67 IEEE80211_WMM_IE_STA_QOSINFO_AC_VO
68
69 #define IEEE80211_DEFAULT_MAX_SP_LEN \
70 IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL
71
72 #define IEEE80211_DEAUTH_FRAME_LEN (24 /* hdr */ + 2 /* reason */)
73
74 struct ieee80211_fragment_entry {
75 unsigned long first_frag_time;
76 unsigned int seq;
77 unsigned int rx_queue;
78 unsigned int last_frag;
79 unsigned int extra_len;
80 struct sk_buff_head skb_list;
81 int ccmp; /* Whether fragments were encrypted with CCMP */
82 u8 last_pn[6]; /* PN of the last fragment if CCMP was used */
83 };
84
85
86 struct ieee80211_bss {
87 u32 device_ts_beacon, device_ts_presp;
88
89 bool wmm_used;
90 bool uapsd_supported;
91
92 #define IEEE80211_MAX_SUPP_RATES 32
93 u8 supp_rates[IEEE80211_MAX_SUPP_RATES];
94 size_t supp_rates_len;
95 struct ieee80211_rate *beacon_rate;
96
97 /*
98 * During association, we save an ERP value from a probe response so
99 * that we can feed ERP info to the driver when handling the
100 * association completes. these fields probably won't be up-to-date
101 * otherwise, you probably don't want to use them.
102 */
103 bool has_erp_value;
104 u8 erp_value;
105
106 /* Keep track of the corruption of the last beacon/probe response. */
107 u8 corrupt_data;
108
109 /* Keep track of what bits of information we have valid info for. */
110 u8 valid_data;
111 };
112
113 /**
114 * enum ieee80211_corrupt_data_flags - BSS data corruption flags
115 * @IEEE80211_BSS_CORRUPT_BEACON: last beacon frame received was corrupted
116 * @IEEE80211_BSS_CORRUPT_PROBE_RESP: last probe response received was corrupted
117 *
118 * These are bss flags that are attached to a bss in the
119 * @corrupt_data field of &struct ieee80211_bss.
120 */
121 enum ieee80211_bss_corrupt_data_flags {
122 IEEE80211_BSS_CORRUPT_BEACON = BIT(0),
123 IEEE80211_BSS_CORRUPT_PROBE_RESP = BIT(1)
124 };
125
126 /**
127 * enum ieee80211_valid_data_flags - BSS valid data flags
128 * @IEEE80211_BSS_VALID_WMM: WMM/UAPSD data was gathered from non-corrupt IE
129 * @IEEE80211_BSS_VALID_RATES: Supported rates were gathered from non-corrupt IE
130 * @IEEE80211_BSS_VALID_ERP: ERP flag was gathered from non-corrupt IE
131 *
132 * These are bss flags that are attached to a bss in the
133 * @valid_data field of &struct ieee80211_bss. They show which parts
134 * of the data structure were recieved as a result of an un-corrupted
135 * beacon/probe response.
136 */
137 enum ieee80211_bss_valid_data_flags {
138 IEEE80211_BSS_VALID_WMM = BIT(1),
139 IEEE80211_BSS_VALID_RATES = BIT(2),
140 IEEE80211_BSS_VALID_ERP = BIT(3)
141 };
142
143 typedef unsigned __bitwise__ ieee80211_tx_result;
144 #define TX_CONTINUE ((__force ieee80211_tx_result) 0u)
145 #define TX_DROP ((__force ieee80211_tx_result) 1u)
146 #define TX_QUEUED ((__force ieee80211_tx_result) 2u)
147
148 #define IEEE80211_TX_UNICAST BIT(1)
149 #define IEEE80211_TX_PS_BUFFERED BIT(2)
150
151 struct ieee80211_tx_data {
152 struct sk_buff *skb;
153 struct sk_buff_head skbs;
154 struct ieee80211_local *local;
155 struct ieee80211_sub_if_data *sdata;
156 struct sta_info *sta;
157 struct ieee80211_key *key;
158 struct ieee80211_tx_rate rate;
159
160 unsigned int flags;
161 };
162
163
164 typedef unsigned __bitwise__ ieee80211_rx_result;
165 #define RX_CONTINUE ((__force ieee80211_rx_result) 0u)
166 #define RX_DROP_UNUSABLE ((__force ieee80211_rx_result) 1u)
167 #define RX_DROP_MONITOR ((__force ieee80211_rx_result) 2u)
168 #define RX_QUEUED ((__force ieee80211_rx_result) 3u)
169
170 /**
171 * enum ieee80211_packet_rx_flags - packet RX flags
172 * @IEEE80211_RX_RA_MATCH: frame is destined to interface currently processed
173 * (incl. multicast frames)
174 * @IEEE80211_RX_FRAGMENTED: fragmented frame
175 * @IEEE80211_RX_AMSDU: a-MSDU packet
176 * @IEEE80211_RX_MALFORMED_ACTION_FRM: action frame is malformed
177 * @IEEE80211_RX_DEFERRED_RELEASE: frame was subjected to receive reordering
178 *
179 * These are per-frame flags that are attached to a frame in the
180 * @rx_flags field of &struct ieee80211_rx_status.
181 */
182 enum ieee80211_packet_rx_flags {
183 IEEE80211_RX_RA_MATCH = BIT(1),
184 IEEE80211_RX_FRAGMENTED = BIT(2),
185 IEEE80211_RX_AMSDU = BIT(3),
186 IEEE80211_RX_MALFORMED_ACTION_FRM = BIT(4),
187 IEEE80211_RX_DEFERRED_RELEASE = BIT(5),
188 };
189
190 /**
191 * enum ieee80211_rx_flags - RX data flags
192 *
193 * @IEEE80211_RX_CMNTR: received on cooked monitor already
194 * @IEEE80211_RX_BEACON_REPORTED: This frame was already reported
195 * to cfg80211_report_obss_beacon().
196 *
197 * These flags are used across handling multiple interfaces
198 * for a single frame.
199 */
200 enum ieee80211_rx_flags {
201 IEEE80211_RX_CMNTR = BIT(0),
202 IEEE80211_RX_BEACON_REPORTED = BIT(1),
203 };
204
205 struct ieee80211_rx_data {
206 struct sk_buff *skb;
207 struct ieee80211_local *local;
208 struct ieee80211_sub_if_data *sdata;
209 struct sta_info *sta;
210 struct ieee80211_key *key;
211
212 unsigned int flags;
213
214 /*
215 * Index into sequence numbers array, 0..16
216 * since the last (16) is used for non-QoS,
217 * will be 16 on non-QoS frames.
218 */
219 int seqno_idx;
220
221 /*
222 * Index into the security IV/PN arrays, 0..16
223 * since the last (16) is used for CCMP-encrypted
224 * management frames, will be set to 16 on mgmt
225 * frames and 0 on non-QoS frames.
226 */
227 int security_idx;
228
229 u32 tkip_iv32;
230 u16 tkip_iv16;
231 };
232
233 struct ieee80211_csa_settings {
234 const u16 *counter_offsets_beacon;
235 const u16 *counter_offsets_presp;
236
237 int n_counter_offsets_beacon;
238 int n_counter_offsets_presp;
239
240 u8 count;
241 };
242
243 struct beacon_data {
244 u8 *head, *tail;
245 int head_len, tail_len;
246 struct ieee80211_meshconf_ie *meshconf;
247 u16 csa_counter_offsets[IEEE80211_MAX_CSA_COUNTERS_NUM];
248 u8 csa_current_counter;
249 struct rcu_head rcu_head;
250 };
251
252 struct probe_resp {
253 struct rcu_head rcu_head;
254 int len;
255 u16 csa_counter_offsets[IEEE80211_MAX_CSA_COUNTERS_NUM];
256 u8 data[0];
257 };
258
259 struct ps_data {
260 /* yes, this looks ugly, but guarantees that we can later use
261 * bitmap_empty :)
262 * NB: don't touch this bitmap, use sta_info_{set,clear}_tim_bit */
263 u8 tim[sizeof(unsigned long) * BITS_TO_LONGS(IEEE80211_MAX_AID + 1)]
264 __aligned(__alignof__(unsigned long));
265 struct sk_buff_head bc_buf;
266 atomic_t num_sta_ps; /* number of stations in PS mode */
267 int dtim_count;
268 bool dtim_bc_mc;
269 };
270
271 struct ieee80211_if_ap {
272 struct beacon_data __rcu *beacon;
273 struct probe_resp __rcu *probe_resp;
274
275 /* to be used after channel switch. */
276 struct cfg80211_beacon_data *next_beacon;
277 struct list_head vlans; /* write-protected with RTNL and local->mtx */
278
279 struct ps_data ps;
280 atomic_t num_mcast_sta; /* number of stations receiving multicast */
281 enum ieee80211_smps_mode req_smps, /* requested smps mode */
282 driver_smps_mode; /* smps mode request */
283
284 struct work_struct request_smps_work;
285 };
286
287 struct ieee80211_if_wds {
288 struct sta_info *sta;
289 u8 remote_addr[ETH_ALEN];
290 };
291
292 struct ieee80211_if_vlan {
293 struct list_head list; /* write-protected with RTNL and local->mtx */
294
295 /* used for all tx if the VLAN is configured to 4-addr mode */
296 struct sta_info __rcu *sta;
297 };
298
299 struct mesh_stats {
300 __u32 fwded_mcast; /* Mesh forwarded multicast frames */
301 __u32 fwded_unicast; /* Mesh forwarded unicast frames */
302 __u32 fwded_frames; /* Mesh total forwarded frames */
303 __u32 dropped_frames_ttl; /* Not transmitted since mesh_ttl == 0*/
304 __u32 dropped_frames_no_route; /* Not transmitted, no route found */
305 __u32 dropped_frames_congestion;/* Not forwarded due to congestion */
306 };
307
308 #define PREQ_Q_F_START 0x1
309 #define PREQ_Q_F_REFRESH 0x2
310 struct mesh_preq_queue {
311 struct list_head list;
312 u8 dst[ETH_ALEN];
313 u8 flags;
314 };
315
316 #if HZ/100 == 0
317 #define IEEE80211_ROC_MIN_LEFT 1
318 #else
319 #define IEEE80211_ROC_MIN_LEFT (HZ/100)
320 #endif
321
322 struct ieee80211_roc_work {
323 struct list_head list;
324 struct list_head dependents;
325
326 struct delayed_work work;
327
328 struct ieee80211_sub_if_data *sdata;
329
330 struct ieee80211_channel *chan;
331
332 bool started, abort, hw_begun, notified;
333 bool to_be_freed;
334 bool on_channel;
335
336 unsigned long hw_start_time;
337
338 u32 duration, req_duration;
339 struct sk_buff *frame;
340 u64 cookie, mgmt_tx_cookie;
341 enum ieee80211_roc_type type;
342 };
343
344 /* flags used in struct ieee80211_if_managed.flags */
345 enum ieee80211_sta_flags {
346 IEEE80211_STA_CONNECTION_POLL = BIT(1),
347 IEEE80211_STA_CONTROL_PORT = BIT(2),
348 IEEE80211_STA_DISABLE_HT = BIT(4),
349 IEEE80211_STA_MFP_ENABLED = BIT(6),
350 IEEE80211_STA_UAPSD_ENABLED = BIT(7),
351 IEEE80211_STA_NULLFUNC_ACKED = BIT(8),
352 IEEE80211_STA_RESET_SIGNAL_AVE = BIT(9),
353 IEEE80211_STA_DISABLE_40MHZ = BIT(10),
354 IEEE80211_STA_DISABLE_VHT = BIT(11),
355 IEEE80211_STA_DISABLE_80P80MHZ = BIT(12),
356 IEEE80211_STA_DISABLE_160MHZ = BIT(13),
357 IEEE80211_STA_DISABLE_WMM = BIT(14),
358 };
359
360 struct ieee80211_mgd_auth_data {
361 struct cfg80211_bss *bss;
362 unsigned long timeout;
363 int tries;
364 u16 algorithm, expected_transaction;
365
366 u8 key[WLAN_KEY_LEN_WEP104];
367 u8 key_len, key_idx;
368 bool done;
369 bool timeout_started;
370
371 u16 sae_trans, sae_status;
372 size_t data_len;
373 u8 data[];
374 };
375
376 struct ieee80211_mgd_assoc_data {
377 struct cfg80211_bss *bss;
378 const u8 *supp_rates;
379
380 unsigned long timeout;
381 int tries;
382
383 u16 capability;
384 u8 prev_bssid[ETH_ALEN];
385 u8 ssid[IEEE80211_MAX_SSID_LEN];
386 u8 ssid_len;
387 u8 supp_rates_len;
388 bool wmm, uapsd;
389 bool need_beacon;
390 bool synced;
391 bool timeout_started;
392
393 u8 ap_ht_param;
394
395 struct ieee80211_vht_cap ap_vht_cap;
396
397 size_t ie_len;
398 u8 ie[];
399 };
400
401 struct ieee80211_if_managed {
402 struct timer_list timer;
403 struct timer_list conn_mon_timer;
404 struct timer_list bcn_mon_timer;
405 struct timer_list chswitch_timer;
406 struct work_struct monitor_work;
407 struct work_struct chswitch_work;
408 struct work_struct beacon_connection_loss_work;
409 struct work_struct csa_connection_drop_work;
410
411 unsigned long beacon_timeout;
412 unsigned long probe_timeout;
413 int probe_send_count;
414 bool nullfunc_failed;
415 bool connection_loss;
416
417 struct cfg80211_bss *associated;
418 struct ieee80211_mgd_auth_data *auth_data;
419 struct ieee80211_mgd_assoc_data *assoc_data;
420
421 u8 bssid[ETH_ALEN];
422
423 u16 aid;
424
425 bool powersave; /* powersave requested for this iface */
426 bool broken_ap; /* AP is broken -- turn off powersave */
427 bool have_beacon;
428 u8 dtim_period;
429 enum ieee80211_smps_mode req_smps, /* requested smps mode */
430 driver_smps_mode; /* smps mode request */
431
432 struct work_struct request_smps_work;
433
434 unsigned int flags;
435
436 bool beacon_crc_valid;
437 u32 beacon_crc;
438
439 bool status_acked;
440 bool status_received;
441 __le16 status_fc;
442
443 enum {
444 IEEE80211_MFP_DISABLED,
445 IEEE80211_MFP_OPTIONAL,
446 IEEE80211_MFP_REQUIRED
447 } mfp; /* management frame protection */
448
449 /*
450 * Bitmask of enabled u-apsd queues,
451 * IEEE80211_WMM_IE_STA_QOSINFO_AC_BE & co. Needs a new association
452 * to take effect.
453 */
454 unsigned int uapsd_queues;
455
456 /*
457 * Maximum number of buffered frames AP can deliver during a
458 * service period, IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL or similar.
459 * Needs a new association to take effect.
460 */
461 unsigned int uapsd_max_sp_len;
462
463 int wmm_last_param_set;
464
465 u8 use_4addr;
466
467 s16 p2p_noa_index;
468
469 /* Signal strength from the last Beacon frame in the current BSS. */
470 int last_beacon_signal;
471
472 /*
473 * Weighted average of the signal strength from Beacon frames in the
474 * current BSS. This is in units of 1/16 of the signal unit to maintain
475 * accuracy and to speed up calculations, i.e., the value need to be
476 * divided by 16 to get the actual value.
477 */
478 int ave_beacon_signal;
479
480 /*
481 * Number of Beacon frames used in ave_beacon_signal. This can be used
482 * to avoid generating less reliable cqm events that would be based
483 * only on couple of received frames.
484 */
485 unsigned int count_beacon_signal;
486
487 /*
488 * Last Beacon frame signal strength average (ave_beacon_signal / 16)
489 * that triggered a cqm event. 0 indicates that no event has been
490 * generated for the current association.
491 */
492 int last_cqm_event_signal;
493
494 /*
495 * State variables for keeping track of RSSI of the AP currently
496 * connected to and informing driver when RSSI has gone
497 * below/above a certain threshold.
498 */
499 int rssi_min_thold, rssi_max_thold;
500 int last_ave_beacon_signal;
501
502 struct ieee80211_ht_cap ht_capa; /* configured ht-cap over-rides */
503 struct ieee80211_ht_cap ht_capa_mask; /* Valid parts of ht_capa */
504 struct ieee80211_vht_cap vht_capa; /* configured VHT overrides */
505 struct ieee80211_vht_cap vht_capa_mask; /* Valid parts of vht_capa */
506
507 u8 tdls_peer[ETH_ALEN] __aligned(2);
508 struct delayed_work tdls_peer_del_work;
509 };
510
511 struct ieee80211_if_ibss {
512 struct timer_list timer;
513 struct work_struct csa_connection_drop_work;
514
515 unsigned long last_scan_completed;
516
517 u32 basic_rates;
518
519 bool fixed_bssid;
520 bool fixed_channel;
521 bool privacy;
522
523 bool control_port;
524 bool userspace_handles_dfs;
525
526 u8 bssid[ETH_ALEN] __aligned(2);
527 u8 ssid[IEEE80211_MAX_SSID_LEN];
528 u8 ssid_len, ie_len;
529 u8 *ie;
530 struct cfg80211_chan_def chandef;
531
532 unsigned long ibss_join_req;
533 /* probe response/beacon for IBSS */
534 struct beacon_data __rcu *presp;
535
536 struct ieee80211_ht_cap ht_capa; /* configured ht-cap over-rides */
537 struct ieee80211_ht_cap ht_capa_mask; /* Valid parts of ht_capa */
538
539 spinlock_t incomplete_lock;
540 struct list_head incomplete_stations;
541
542 enum {
543 IEEE80211_IBSS_MLME_SEARCH,
544 IEEE80211_IBSS_MLME_JOINED,
545 } state;
546 };
547
548 /**
549 * struct ieee80211_mesh_sync_ops - Extensible synchronization framework interface
550 *
551 * these declarations define the interface, which enables
552 * vendor-specific mesh synchronization
553 *
554 */
555 struct ieee802_11_elems;
556 struct ieee80211_mesh_sync_ops {
557 void (*rx_bcn_presp)(struct ieee80211_sub_if_data *sdata,
558 u16 stype,
559 struct ieee80211_mgmt *mgmt,
560 struct ieee802_11_elems *elems,
561 struct ieee80211_rx_status *rx_status);
562
563 /* should be called with beacon_data under RCU read lock */
564 void (*adjust_tbtt)(struct ieee80211_sub_if_data *sdata,
565 struct beacon_data *beacon);
566 /* add other framework functions here */
567 };
568
569 struct mesh_csa_settings {
570 struct rcu_head rcu_head;
571 struct cfg80211_csa_settings settings;
572 };
573
574 struct ieee80211_if_mesh {
575 struct timer_list housekeeping_timer;
576 struct timer_list mesh_path_timer;
577 struct timer_list mesh_path_root_timer;
578
579 unsigned long wrkq_flags;
580 unsigned long mbss_changed;
581
582 u8 mesh_id[IEEE80211_MAX_MESH_ID_LEN];
583 size_t mesh_id_len;
584 /* Active Path Selection Protocol Identifier */
585 u8 mesh_pp_id;
586 /* Active Path Selection Metric Identifier */
587 u8 mesh_pm_id;
588 /* Congestion Control Mode Identifier */
589 u8 mesh_cc_id;
590 /* Synchronization Protocol Identifier */
591 u8 mesh_sp_id;
592 /* Authentication Protocol Identifier */
593 u8 mesh_auth_id;
594 /* Local mesh Sequence Number */
595 u32 sn;
596 /* Last used PREQ ID */
597 u32 preq_id;
598 atomic_t mpaths;
599 /* Timestamp of last SN update */
600 unsigned long last_sn_update;
601 /* Time when it's ok to send next PERR */
602 unsigned long next_perr;
603 /* Timestamp of last PREQ sent */
604 unsigned long last_preq;
605 struct mesh_rmc *rmc;
606 spinlock_t mesh_preq_queue_lock;
607 struct mesh_preq_queue preq_queue;
608 int preq_queue_len;
609 struct mesh_stats mshstats;
610 struct mesh_config mshcfg;
611 atomic_t estab_plinks;
612 u32 mesh_seqnum;
613 bool accepting_plinks;
614 int num_gates;
615 struct beacon_data __rcu *beacon;
616 const u8 *ie;
617 u8 ie_len;
618 enum {
619 IEEE80211_MESH_SEC_NONE = 0x0,
620 IEEE80211_MESH_SEC_AUTHED = 0x1,
621 IEEE80211_MESH_SEC_SECURED = 0x2,
622 } security;
623 bool user_mpm;
624 /* Extensible Synchronization Framework */
625 const struct ieee80211_mesh_sync_ops *sync_ops;
626 s64 sync_offset_clockdrift_max;
627 spinlock_t sync_offset_lock;
628 bool adjusting_tbtt;
629 /* mesh power save */
630 enum nl80211_mesh_power_mode nonpeer_pm;
631 int ps_peers_light_sleep;
632 int ps_peers_deep_sleep;
633 struct ps_data ps;
634 /* Channel Switching Support */
635 struct mesh_csa_settings __rcu *csa;
636 enum {
637 IEEE80211_MESH_CSA_ROLE_NONE,
638 IEEE80211_MESH_CSA_ROLE_INIT,
639 IEEE80211_MESH_CSA_ROLE_REPEATER,
640 } csa_role;
641 u8 chsw_ttl;
642 u16 pre_value;
643
644 /* offset from skb->data while building IE */
645 int meshconf_offset;
646 };
647
648 #ifdef CONFIG_MAC80211_MESH
649 #define IEEE80211_IFSTA_MESH_CTR_INC(msh, name) \
650 do { (msh)->mshstats.name++; } while (0)
651 #else
652 #define IEEE80211_IFSTA_MESH_CTR_INC(msh, name) \
653 do { } while (0)
654 #endif
655
656 /**
657 * enum ieee80211_sub_if_data_flags - virtual interface flags
658 *
659 * @IEEE80211_SDATA_ALLMULTI: interface wants all multicast packets
660 * @IEEE80211_SDATA_PROMISC: interface is promisc
661 * @IEEE80211_SDATA_OPERATING_GMODE: operating in G-only mode
662 * @IEEE80211_SDATA_DONT_BRIDGE_PACKETS: bridge packets between
663 * associated stations and deliver multicast frames both
664 * back to wireless media and to the local net stack.
665 * @IEEE80211_SDATA_DISCONNECT_RESUME: Disconnect after resume.
666 * @IEEE80211_SDATA_IN_DRIVER: indicates interface was added to driver
667 */
668 enum ieee80211_sub_if_data_flags {
669 IEEE80211_SDATA_ALLMULTI = BIT(0),
670 IEEE80211_SDATA_PROMISC = BIT(1),
671 IEEE80211_SDATA_OPERATING_GMODE = BIT(2),
672 IEEE80211_SDATA_DONT_BRIDGE_PACKETS = BIT(3),
673 IEEE80211_SDATA_DISCONNECT_RESUME = BIT(4),
674 IEEE80211_SDATA_IN_DRIVER = BIT(5),
675 };
676
677 /**
678 * enum ieee80211_sdata_state_bits - virtual interface state bits
679 * @SDATA_STATE_RUNNING: virtual interface is up & running; this
680 * mirrors netif_running() but is separate for interface type
681 * change handling while the interface is up
682 * @SDATA_STATE_OFFCHANNEL: This interface is currently in offchannel
683 * mode, so queues are stopped
684 * @SDATA_STATE_OFFCHANNEL_BEACON_STOPPED: Beaconing was stopped due
685 * to offchannel, reset when offchannel returns
686 */
687 enum ieee80211_sdata_state_bits {
688 SDATA_STATE_RUNNING,
689 SDATA_STATE_OFFCHANNEL,
690 SDATA_STATE_OFFCHANNEL_BEACON_STOPPED,
691 };
692
693 /**
694 * enum ieee80211_chanctx_mode - channel context configuration mode
695 *
696 * @IEEE80211_CHANCTX_SHARED: channel context may be used by
697 * multiple interfaces
698 * @IEEE80211_CHANCTX_EXCLUSIVE: channel context can be used
699 * only by a single interface. This can be used for example for
700 * non-fixed channel IBSS.
701 */
702 enum ieee80211_chanctx_mode {
703 IEEE80211_CHANCTX_SHARED,
704 IEEE80211_CHANCTX_EXCLUSIVE
705 };
706
707 /**
708 * enum ieee80211_chanctx_replace_state - channel context replacement state
709 *
710 * This is used for channel context in-place reservations that require channel
711 * context switch/swap.
712 *
713 * @IEEE80211_CHANCTX_REPLACE_NONE: no replacement is taking place
714 * @IEEE80211_CHANCTX_WILL_BE_REPLACED: this channel context will be replaced
715 * by a (not yet registered) channel context pointed by %replace_ctx.
716 * @IEEE80211_CHANCTX_REPLACES_OTHER: this (not yet registered) channel context
717 * replaces an existing channel context pointed to by %replace_ctx.
718 */
719 enum ieee80211_chanctx_replace_state {
720 IEEE80211_CHANCTX_REPLACE_NONE,
721 IEEE80211_CHANCTX_WILL_BE_REPLACED,
722 IEEE80211_CHANCTX_REPLACES_OTHER,
723 };
724
725 struct ieee80211_chanctx {
726 struct list_head list;
727 struct rcu_head rcu_head;
728
729 struct list_head assigned_vifs;
730 struct list_head reserved_vifs;
731
732 enum ieee80211_chanctx_replace_state replace_state;
733 struct ieee80211_chanctx *replace_ctx;
734
735 enum ieee80211_chanctx_mode mode;
736 bool driver_present;
737
738 struct ieee80211_chanctx_conf conf;
739 };
740
741 struct mac80211_qos_map {
742 struct cfg80211_qos_map qos_map;
743 struct rcu_head rcu_head;
744 };
745
746 struct ieee80211_sub_if_data {
747 struct list_head list;
748
749 struct wireless_dev wdev;
750
751 /* keys */
752 struct list_head key_list;
753
754 /* count for keys needing tailroom space allocation */
755 int crypto_tx_tailroom_needed_cnt;
756 int crypto_tx_tailroom_pending_dec;
757 struct delayed_work dec_tailroom_needed_wk;
758
759 struct net_device *dev;
760 struct ieee80211_local *local;
761
762 unsigned int flags;
763
764 unsigned long state;
765
766 int drop_unencrypted;
767
768 char name[IFNAMSIZ];
769
770 /* Fragment table for host-based reassembly */
771 struct ieee80211_fragment_entry fragments[IEEE80211_FRAGMENT_MAX];
772 unsigned int fragment_next;
773
774 /* TID bitmap for NoAck policy */
775 u16 noack_map;
776
777 /* bit field of ACM bits (BIT(802.1D tag)) */
778 u8 wmm_acm;
779
780 struct ieee80211_key __rcu *keys[NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS];
781 struct ieee80211_key __rcu *default_unicast_key;
782 struct ieee80211_key __rcu *default_multicast_key;
783 struct ieee80211_key __rcu *default_mgmt_key;
784
785 u16 sequence_number;
786 __be16 control_port_protocol;
787 bool control_port_no_encrypt;
788 int encrypt_headroom;
789
790 struct ieee80211_tx_queue_params tx_conf[IEEE80211_NUM_ACS];
791 struct mac80211_qos_map __rcu *qos_map;
792
793 struct work_struct csa_finalize_work;
794 bool csa_block_tx; /* write-protected by sdata_lock and local->mtx */
795 struct cfg80211_chan_def csa_chandef;
796
797 struct list_head assigned_chanctx_list; /* protected by chanctx_mtx */
798 struct list_head reserved_chanctx_list; /* protected by chanctx_mtx */
799
800 /* context reservation -- protected with chanctx_mtx */
801 struct ieee80211_chanctx *reserved_chanctx;
802 struct cfg80211_chan_def reserved_chandef;
803 bool reserved_radar_required;
804 bool reserved_ready;
805
806 /* used to reconfigure hardware SM PS */
807 struct work_struct recalc_smps;
808
809 struct work_struct work;
810 struct sk_buff_head skb_queue;
811
812 u8 needed_rx_chains;
813 enum ieee80211_smps_mode smps_mode;
814
815 int user_power_level; /* in dBm */
816 int ap_power_level; /* in dBm */
817
818 bool radar_required;
819 struct delayed_work dfs_cac_timer_work;
820
821 /*
822 * AP this belongs to: self in AP mode and
823 * corresponding AP in VLAN mode, NULL for
824 * all others (might be needed later in IBSS)
825 */
826 struct ieee80211_if_ap *bss;
827
828 /* bitmap of allowed (non-MCS) rate indexes for rate control */
829 u32 rc_rateidx_mask[IEEE80211_NUM_BANDS];
830
831 bool rc_has_mcs_mask[IEEE80211_NUM_BANDS];
832 u8 rc_rateidx_mcs_mask[IEEE80211_NUM_BANDS][IEEE80211_HT_MCS_MASK_LEN];
833
834 union {
835 struct ieee80211_if_ap ap;
836 struct ieee80211_if_wds wds;
837 struct ieee80211_if_vlan vlan;
838 struct ieee80211_if_managed mgd;
839 struct ieee80211_if_ibss ibss;
840 struct ieee80211_if_mesh mesh;
841 u32 mntr_flags;
842 } u;
843
844 #ifdef CONFIG_MAC80211_DEBUGFS
845 struct {
846 struct dentry *subdir_stations;
847 struct dentry *default_unicast_key;
848 struct dentry *default_multicast_key;
849 struct dentry *default_mgmt_key;
850 } debugfs;
851 #endif
852
853 /* must be last, dynamically sized area in this! */
854 struct ieee80211_vif vif;
855 };
856
857 static inline
858 struct ieee80211_sub_if_data *vif_to_sdata(struct ieee80211_vif *p)
859 {
860 return container_of(p, struct ieee80211_sub_if_data, vif);
861 }
862
863 static inline void sdata_lock(struct ieee80211_sub_if_data *sdata)
864 __acquires(&sdata->wdev.mtx)
865 {
866 mutex_lock(&sdata->wdev.mtx);
867 __acquire(&sdata->wdev.mtx);
868 }
869
870 static inline void sdata_unlock(struct ieee80211_sub_if_data *sdata)
871 __releases(&sdata->wdev.mtx)
872 {
873 mutex_unlock(&sdata->wdev.mtx);
874 __release(&sdata->wdev.mtx);
875 }
876
877 #define sdata_dereference(p, sdata) \
878 rcu_dereference_protected(p, lockdep_is_held(&sdata->wdev.mtx))
879
880 static inline void
881 sdata_assert_lock(struct ieee80211_sub_if_data *sdata)
882 {
883 lockdep_assert_held(&sdata->wdev.mtx);
884 }
885
886 static inline enum ieee80211_band
887 ieee80211_get_sdata_band(struct ieee80211_sub_if_data *sdata)
888 {
889 enum ieee80211_band band = IEEE80211_BAND_2GHZ;
890 struct ieee80211_chanctx_conf *chanctx_conf;
891
892 rcu_read_lock();
893 chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
894 if (!WARN_ON(!chanctx_conf))
895 band = chanctx_conf->def.chan->band;
896 rcu_read_unlock();
897
898 return band;
899 }
900
901 static inline int
902 ieee80211_chandef_get_shift(struct cfg80211_chan_def *chandef)
903 {
904 switch (chandef->width) {
905 case NL80211_CHAN_WIDTH_5:
906 return 2;
907 case NL80211_CHAN_WIDTH_10:
908 return 1;
909 default:
910 return 0;
911 }
912 }
913
914 static inline int
915 ieee80211_vif_get_shift(struct ieee80211_vif *vif)
916 {
917 struct ieee80211_chanctx_conf *chanctx_conf;
918 int shift = 0;
919
920 rcu_read_lock();
921 chanctx_conf = rcu_dereference(vif->chanctx_conf);
922 if (chanctx_conf)
923 shift = ieee80211_chandef_get_shift(&chanctx_conf->def);
924 rcu_read_unlock();
925
926 return shift;
927 }
928
929 struct ieee80211_rx_agg {
930 u8 addr[ETH_ALEN];
931 u16 tid;
932 };
933
934 enum sdata_queue_type {
935 IEEE80211_SDATA_QUEUE_TYPE_FRAME = 0,
936 IEEE80211_SDATA_QUEUE_AGG_START = 1,
937 IEEE80211_SDATA_QUEUE_AGG_STOP = 2,
938 IEEE80211_SDATA_QUEUE_RX_AGG_START = 3,
939 IEEE80211_SDATA_QUEUE_RX_AGG_STOP = 4,
940 };
941
942 enum {
943 IEEE80211_RX_MSG = 1,
944 IEEE80211_TX_STATUS_MSG = 2,
945 };
946
947 enum queue_stop_reason {
948 IEEE80211_QUEUE_STOP_REASON_DRIVER,
949 IEEE80211_QUEUE_STOP_REASON_PS,
950 IEEE80211_QUEUE_STOP_REASON_CSA,
951 IEEE80211_QUEUE_STOP_REASON_AGGREGATION,
952 IEEE80211_QUEUE_STOP_REASON_SUSPEND,
953 IEEE80211_QUEUE_STOP_REASON_SKB_ADD,
954 IEEE80211_QUEUE_STOP_REASON_OFFCHANNEL,
955 IEEE80211_QUEUE_STOP_REASON_FLUSH,
956 IEEE80211_QUEUE_STOP_REASON_TDLS_TEARDOWN,
957
958 IEEE80211_QUEUE_STOP_REASONS,
959 };
960
961 #ifdef CONFIG_MAC80211_LEDS
962 struct tpt_led_trigger {
963 struct led_trigger trig;
964 char name[32];
965 const struct ieee80211_tpt_blink *blink_table;
966 unsigned int blink_table_len;
967 struct timer_list timer;
968 unsigned long prev_traffic;
969 unsigned long tx_bytes, rx_bytes;
970 unsigned int active, want;
971 bool running;
972 };
973 #endif
974
975 /*
976 * struct ieee80211_tx_latency_bin_ranges - Tx latency statistics bins ranges
977 *
978 * Measuring Tx latency statistics. Counts how many Tx frames transmitted in a
979 * certain latency range (in Milliseconds). Each station that uses these
980 * ranges will have bins to count the amount of frames received in that range.
981 * The user can configure the ranges via debugfs.
982 * If ranges is NULL then Tx latency statistics bins are disabled for all
983 * stations.
984 *
985 * @n_ranges: number of ranges that are taken in account
986 * @ranges: the ranges that the user requested or NULL if disabled.
987 */
988 struct ieee80211_tx_latency_bin_ranges {
989 int n_ranges;
990 u32 ranges[];
991 };
992
993 /**
994 * mac80211 scan flags - currently active scan mode
995 *
996 * @SCAN_SW_SCANNING: We're currently in the process of scanning but may as
997 * well be on the operating channel
998 * @SCAN_HW_SCANNING: The hardware is scanning for us, we have no way to
999 * determine if we are on the operating channel or not
1000 * @SCAN_ONCHANNEL_SCANNING: Do a software scan on only the current operating
1001 * channel. This should not interrupt normal traffic.
1002 * @SCAN_COMPLETED: Set for our scan work function when the driver reported
1003 * that the scan completed.
1004 * @SCAN_ABORTED: Set for our scan work function when the driver reported
1005 * a scan complete for an aborted scan.
1006 * @SCAN_HW_CANCELLED: Set for our scan work function when the scan is being
1007 * cancelled.
1008 */
1009 enum {
1010 SCAN_SW_SCANNING,
1011 SCAN_HW_SCANNING,
1012 SCAN_ONCHANNEL_SCANNING,
1013 SCAN_COMPLETED,
1014 SCAN_ABORTED,
1015 SCAN_HW_CANCELLED,
1016 };
1017
1018 /**
1019 * enum mac80211_scan_state - scan state machine states
1020 *
1021 * @SCAN_DECISION: Main entry point to the scan state machine, this state
1022 * determines if we should keep on scanning or switch back to the
1023 * operating channel
1024 * @SCAN_SET_CHANNEL: Set the next channel to be scanned
1025 * @SCAN_SEND_PROBE: Send probe requests and wait for probe responses
1026 * @SCAN_SUSPEND: Suspend the scan and go back to operating channel to
1027 * send out data
1028 * @SCAN_RESUME: Resume the scan and scan the next channel
1029 * @SCAN_ABORT: Abort the scan and go back to operating channel
1030 */
1031 enum mac80211_scan_state {
1032 SCAN_DECISION,
1033 SCAN_SET_CHANNEL,
1034 SCAN_SEND_PROBE,
1035 SCAN_SUSPEND,
1036 SCAN_RESUME,
1037 SCAN_ABORT,
1038 };
1039
1040 struct ieee80211_local {
1041 /* embed the driver visible part.
1042 * don't cast (use the static inlines below), but we keep
1043 * it first anyway so they become a no-op */
1044 struct ieee80211_hw hw;
1045
1046 const struct ieee80211_ops *ops;
1047
1048 /*
1049 * private workqueue to mac80211. mac80211 makes this accessible
1050 * via ieee80211_queue_work()
1051 */
1052 struct workqueue_struct *workqueue;
1053
1054 unsigned long queue_stop_reasons[IEEE80211_MAX_QUEUES];
1055 int q_stop_reasons[IEEE80211_MAX_QUEUES][IEEE80211_QUEUE_STOP_REASONS];
1056 /* also used to protect ampdu_ac_queue and amdpu_ac_stop_refcnt */
1057 spinlock_t queue_stop_reason_lock;
1058
1059 int open_count;
1060 int monitors, cooked_mntrs;
1061 /* number of interfaces with corresponding FIF_ flags */
1062 int fif_fcsfail, fif_plcpfail, fif_control, fif_other_bss, fif_pspoll,
1063 fif_probe_req;
1064 int probe_req_reg;
1065 unsigned int filter_flags; /* FIF_* */
1066
1067 bool wiphy_ciphers_allocated;
1068
1069 bool use_chanctx;
1070
1071 /* protects the aggregated multicast list and filter calls */
1072 spinlock_t filter_lock;
1073
1074 /* used for uploading changed mc list */
1075 struct work_struct reconfig_filter;
1076
1077 /* aggregated multicast list */
1078 struct netdev_hw_addr_list mc_list;
1079
1080 bool tim_in_locked_section; /* see ieee80211_beacon_get() */
1081
1082 /*
1083 * suspended is true if we finished all the suspend _and_ we have
1084 * not yet come up from resume. This is to be used by mac80211
1085 * to ensure driver sanity during suspend and mac80211's own
1086 * sanity. It can eventually be used for WoW as well.
1087 */
1088 bool suspended;
1089
1090 /*
1091 * Resuming is true while suspended, but when we're reprogramming the
1092 * hardware -- at that time it's allowed to use ieee80211_queue_work()
1093 * again even though some other parts of the stack are still suspended
1094 * and we still drop received frames to avoid waking the stack.
1095 */
1096 bool resuming;
1097
1098 /*
1099 * quiescing is true during the suspend process _only_ to
1100 * ease timer cancelling etc.
1101 */
1102 bool quiescing;
1103
1104 /* device is started */
1105 bool started;
1106
1107 /* device is during a HW reconfig */
1108 bool in_reconfig;
1109
1110 /* wowlan is enabled -- don't reconfig on resume */
1111 bool wowlan;
1112
1113 /* DFS/radar detection is enabled */
1114 bool radar_detect_enabled;
1115 struct work_struct radar_detected_work;
1116
1117 /* number of RX chains the hardware has */
1118 u8 rx_chains;
1119
1120 int tx_headroom; /* required headroom for hardware/radiotap */
1121
1122 /* Tasklet and skb queue to process calls from IRQ mode. All frames
1123 * added to skb_queue will be processed, but frames in
1124 * skb_queue_unreliable may be dropped if the total length of these
1125 * queues increases over the limit. */
1126 #define IEEE80211_IRQSAFE_QUEUE_LIMIT 128
1127 struct tasklet_struct tasklet;
1128 struct sk_buff_head skb_queue;
1129 struct sk_buff_head skb_queue_unreliable;
1130
1131 spinlock_t rx_path_lock;
1132
1133 /* Station data */
1134 /*
1135 * The mutex only protects the list, hash table and
1136 * counter, reads are done with RCU.
1137 */
1138 struct mutex sta_mtx;
1139 spinlock_t tim_lock;
1140 unsigned long num_sta;
1141 struct list_head sta_list;
1142 struct sta_info __rcu *sta_hash[STA_HASH_SIZE];
1143 struct timer_list sta_cleanup;
1144 int sta_generation;
1145
1146 /*
1147 * Tx latency statistics parameters for all stations.
1148 * Can enable via debugfs (NULL when disabled).
1149 */
1150 struct ieee80211_tx_latency_bin_ranges __rcu *tx_latency;
1151
1152 struct sk_buff_head pending[IEEE80211_MAX_QUEUES];
1153 struct tasklet_struct tx_pending_tasklet;
1154
1155 atomic_t agg_queue_stop[IEEE80211_MAX_QUEUES];
1156
1157 /* number of interfaces with corresponding IFF_ flags */
1158 atomic_t iff_allmultis, iff_promiscs;
1159
1160 struct rate_control_ref *rate_ctrl;
1161
1162 struct crypto_cipher *wep_tx_tfm;
1163 struct crypto_cipher *wep_rx_tfm;
1164 u32 wep_iv;
1165
1166 /* see iface.c */
1167 struct list_head interfaces;
1168 struct mutex iflist_mtx;
1169
1170 /*
1171 * Key mutex, protects sdata's key_list and sta_info's
1172 * key pointers (write access, they're RCU.)
1173 */
1174 struct mutex key_mtx;
1175
1176 /* mutex for scan and work locking */
1177 struct mutex mtx;
1178
1179 /* Scanning and BSS list */
1180 unsigned long scanning;
1181 struct cfg80211_ssid scan_ssid;
1182 struct cfg80211_scan_request *int_scan_req;
1183 struct cfg80211_scan_request *scan_req;
1184 struct ieee80211_scan_request *hw_scan_req;
1185 struct cfg80211_chan_def scan_chandef;
1186 enum ieee80211_band hw_scan_band;
1187 int scan_channel_idx;
1188 int scan_ies_len;
1189 int hw_scan_ies_bufsize;
1190
1191 struct work_struct sched_scan_stopped_work;
1192 struct ieee80211_sub_if_data __rcu *sched_scan_sdata;
1193 struct cfg80211_sched_scan_request *sched_scan_req;
1194
1195 unsigned long leave_oper_channel_time;
1196 enum mac80211_scan_state next_scan_state;
1197 struct delayed_work scan_work;
1198 struct ieee80211_sub_if_data __rcu *scan_sdata;
1199 /* For backward compatibility only -- do not use */
1200 struct cfg80211_chan_def _oper_chandef;
1201
1202 /* Temporary remain-on-channel for off-channel operations */
1203 struct ieee80211_channel *tmp_channel;
1204
1205 /* channel contexts */
1206 struct list_head chanctx_list;
1207 struct mutex chanctx_mtx;
1208
1209 /* SNMP counters */
1210 /* dot11CountersTable */
1211 u32 dot11TransmittedFragmentCount;
1212 u32 dot11MulticastTransmittedFrameCount;
1213 u32 dot11FailedCount;
1214 u32 dot11RetryCount;
1215 u32 dot11MultipleRetryCount;
1216 u32 dot11FrameDuplicateCount;
1217 u32 dot11ReceivedFragmentCount;
1218 u32 dot11MulticastReceivedFrameCount;
1219 u32 dot11TransmittedFrameCount;
1220
1221 #ifdef CONFIG_MAC80211_LEDS
1222 struct led_trigger *tx_led, *rx_led, *assoc_led, *radio_led;
1223 struct tpt_led_trigger *tpt_led_trigger;
1224 char tx_led_name[32], rx_led_name[32],
1225 assoc_led_name[32], radio_led_name[32];
1226 #endif
1227
1228 #ifdef CONFIG_MAC80211_DEBUG_COUNTERS
1229 /* TX/RX handler statistics */
1230 unsigned int tx_handlers_drop;
1231 unsigned int tx_handlers_queued;
1232 unsigned int tx_handlers_drop_unencrypted;
1233 unsigned int tx_handlers_drop_fragment;
1234 unsigned int tx_handlers_drop_wep;
1235 unsigned int tx_handlers_drop_not_assoc;
1236 unsigned int tx_handlers_drop_unauth_port;
1237 unsigned int rx_handlers_drop;
1238 unsigned int rx_handlers_queued;
1239 unsigned int rx_handlers_drop_nullfunc;
1240 unsigned int rx_handlers_drop_defrag;
1241 unsigned int rx_handlers_drop_short;
1242 unsigned int tx_expand_skb_head;
1243 unsigned int tx_expand_skb_head_cloned;
1244 unsigned int rx_expand_skb_head;
1245 unsigned int rx_expand_skb_head2;
1246 unsigned int rx_handlers_fragments;
1247 unsigned int tx_status_drop;
1248 #define I802_DEBUG_INC(c) (c)++
1249 #else /* CONFIG_MAC80211_DEBUG_COUNTERS */
1250 #define I802_DEBUG_INC(c) do { } while (0)
1251 #endif /* CONFIG_MAC80211_DEBUG_COUNTERS */
1252
1253
1254 int total_ps_buffered; /* total number of all buffered unicast and
1255 * multicast packets for power saving stations
1256 */
1257
1258 bool pspolling;
1259 bool offchannel_ps_enabled;
1260 /*
1261 * PS can only be enabled when we have exactly one managed
1262 * interface (and monitors) in PS, this then points there.
1263 */
1264 struct ieee80211_sub_if_data *ps_sdata;
1265 struct work_struct dynamic_ps_enable_work;
1266 struct work_struct dynamic_ps_disable_work;
1267 struct timer_list dynamic_ps_timer;
1268 struct notifier_block network_latency_notifier;
1269 struct notifier_block ifa_notifier;
1270 struct notifier_block ifa6_notifier;
1271
1272 /*
1273 * The dynamic ps timeout configured from user space via WEXT -
1274 * this will override whatever chosen by mac80211 internally.
1275 */
1276 int dynamic_ps_forced_timeout;
1277
1278 int user_power_level; /* in dBm, for all interfaces */
1279
1280 enum ieee80211_smps_mode smps_mode;
1281
1282 struct work_struct restart_work;
1283
1284 #ifdef CONFIG_MAC80211_DEBUGFS
1285 struct local_debugfsdentries {
1286 struct dentry *rcdir;
1287 struct dentry *keys;
1288 } debugfs;
1289 #endif
1290
1291 /*
1292 * Remain-on-channel support
1293 */
1294 struct list_head roc_list;
1295 struct work_struct hw_roc_start, hw_roc_done;
1296 unsigned long hw_roc_start_time;
1297 u64 roc_cookie_counter;
1298
1299 struct idr ack_status_frames;
1300 spinlock_t ack_status_lock;
1301
1302 struct ieee80211_sub_if_data __rcu *p2p_sdata;
1303
1304 struct napi_struct *napi;
1305
1306 /* virtual monitor interface */
1307 struct ieee80211_sub_if_data __rcu *monitor_sdata;
1308 struct cfg80211_chan_def monitor_chandef;
1309 };
1310
1311 static inline struct ieee80211_sub_if_data *
1312 IEEE80211_DEV_TO_SUB_IF(struct net_device *dev)
1313 {
1314 return netdev_priv(dev);
1315 }
1316
1317 static inline struct ieee80211_sub_if_data *
1318 IEEE80211_WDEV_TO_SUB_IF(struct wireless_dev *wdev)
1319 {
1320 return container_of(wdev, struct ieee80211_sub_if_data, wdev);
1321 }
1322
1323 /* this struct represents 802.11n's RA/TID combination */
1324 struct ieee80211_ra_tid {
1325 u8 ra[ETH_ALEN];
1326 u16 tid;
1327 };
1328
1329 /* this struct holds the value parsing from channel switch IE */
1330 struct ieee80211_csa_ie {
1331 struct cfg80211_chan_def chandef;
1332 u8 mode;
1333 u8 count;
1334 u8 ttl;
1335 u16 pre_value;
1336 };
1337
1338 /* Parsed Information Elements */
1339 struct ieee802_11_elems {
1340 const u8 *ie_start;
1341 size_t total_len;
1342
1343 /* pointers to IEs */
1344 const u8 *ssid;
1345 const u8 *supp_rates;
1346 const u8 *ds_params;
1347 const struct ieee80211_tim_ie *tim;
1348 const u8 *challenge;
1349 const u8 *rsn;
1350 const u8 *erp_info;
1351 const u8 *ext_supp_rates;
1352 const u8 *wmm_info;
1353 const u8 *wmm_param;
1354 const struct ieee80211_ht_cap *ht_cap_elem;
1355 const struct ieee80211_ht_operation *ht_operation;
1356 const struct ieee80211_vht_cap *vht_cap_elem;
1357 const struct ieee80211_vht_operation *vht_operation;
1358 const struct ieee80211_meshconf_ie *mesh_config;
1359 const u8 *mesh_id;
1360 const u8 *peering;
1361 const __le16 *awake_window;
1362 const u8 *preq;
1363 const u8 *prep;
1364 const u8 *perr;
1365 const struct ieee80211_rann_ie *rann;
1366 const struct ieee80211_channel_sw_ie *ch_switch_ie;
1367 const struct ieee80211_ext_chansw_ie *ext_chansw_ie;
1368 const struct ieee80211_wide_bw_chansw_ie *wide_bw_chansw_ie;
1369 const u8 *country_elem;
1370 const u8 *pwr_constr_elem;
1371 const struct ieee80211_timeout_interval_ie *timeout_int;
1372 const u8 *opmode_notif;
1373 const struct ieee80211_sec_chan_offs_ie *sec_chan_offs;
1374 const struct ieee80211_mesh_chansw_params_ie *mesh_chansw_params_ie;
1375
1376 /* length of them, respectively */
1377 u8 ssid_len;
1378 u8 supp_rates_len;
1379 u8 tim_len;
1380 u8 challenge_len;
1381 u8 rsn_len;
1382 u8 ext_supp_rates_len;
1383 u8 wmm_info_len;
1384 u8 wmm_param_len;
1385 u8 mesh_id_len;
1386 u8 peering_len;
1387 u8 preq_len;
1388 u8 prep_len;
1389 u8 perr_len;
1390 u8 country_elem_len;
1391
1392 /* whether a parse error occurred while retrieving these elements */
1393 bool parse_error;
1394 };
1395
1396 static inline struct ieee80211_local *hw_to_local(
1397 struct ieee80211_hw *hw)
1398 {
1399 return container_of(hw, struct ieee80211_local, hw);
1400 }
1401
1402
1403 static inline int ieee80211_bssid_match(const u8 *raddr, const u8 *addr)
1404 {
1405 return ether_addr_equal(raddr, addr) ||
1406 is_broadcast_ether_addr(raddr);
1407 }
1408
1409 static inline bool
1410 ieee80211_have_rx_timestamp(struct ieee80211_rx_status *status)
1411 {
1412 WARN_ON_ONCE(status->flag & RX_FLAG_MACTIME_START &&
1413 status->flag & RX_FLAG_MACTIME_END);
1414 return status->flag & (RX_FLAG_MACTIME_START | RX_FLAG_MACTIME_END);
1415 }
1416
1417 u64 ieee80211_calculate_rx_timestamp(struct ieee80211_local *local,
1418 struct ieee80211_rx_status *status,
1419 unsigned int mpdu_len,
1420 unsigned int mpdu_offset);
1421 int ieee80211_hw_config(struct ieee80211_local *local, u32 changed);
1422 void ieee80211_tx_set_protected(struct ieee80211_tx_data *tx);
1423 void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata,
1424 u32 changed);
1425 void ieee80211_configure_filter(struct ieee80211_local *local);
1426 u32 ieee80211_reset_erp_info(struct ieee80211_sub_if_data *sdata);
1427
1428 /* STA code */
1429 void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata);
1430 int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata,
1431 struct cfg80211_auth_request *req);
1432 int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,
1433 struct cfg80211_assoc_request *req);
1434 int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata,
1435 struct cfg80211_deauth_request *req);
1436 int ieee80211_mgd_disassoc(struct ieee80211_sub_if_data *sdata,
1437 struct cfg80211_disassoc_request *req);
1438 void ieee80211_send_pspoll(struct ieee80211_local *local,
1439 struct ieee80211_sub_if_data *sdata);
1440 void ieee80211_recalc_ps(struct ieee80211_local *local, s32 latency);
1441 void ieee80211_recalc_ps_vif(struct ieee80211_sub_if_data *sdata);
1442 int ieee80211_max_network_latency(struct notifier_block *nb,
1443 unsigned long data, void *dummy);
1444 int ieee80211_set_arp_filter(struct ieee80211_sub_if_data *sdata);
1445 void ieee80211_sta_work(struct ieee80211_sub_if_data *sdata);
1446 void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
1447 struct sk_buff *skb);
1448 void ieee80211_sta_reset_beacon_monitor(struct ieee80211_sub_if_data *sdata);
1449 void ieee80211_sta_reset_conn_monitor(struct ieee80211_sub_if_data *sdata);
1450 void ieee80211_mgd_stop(struct ieee80211_sub_if_data *sdata);
1451 void ieee80211_mgd_conn_tx_status(struct ieee80211_sub_if_data *sdata,
1452 __le16 fc, bool acked);
1453 void ieee80211_mgd_quiesce(struct ieee80211_sub_if_data *sdata);
1454 void ieee80211_sta_restart(struct ieee80211_sub_if_data *sdata);
1455
1456 /* IBSS code */
1457 void ieee80211_ibss_notify_scan_completed(struct ieee80211_local *local);
1458 void ieee80211_ibss_setup_sdata(struct ieee80211_sub_if_data *sdata);
1459 void ieee80211_ibss_rx_no_sta(struct ieee80211_sub_if_data *sdata,
1460 const u8 *bssid, const u8 *addr, u32 supp_rates);
1461 int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata,
1462 struct cfg80211_ibss_params *params);
1463 int ieee80211_ibss_leave(struct ieee80211_sub_if_data *sdata);
1464 void ieee80211_ibss_work(struct ieee80211_sub_if_data *sdata);
1465 void ieee80211_ibss_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
1466 struct sk_buff *skb);
1467 int ieee80211_ibss_csa_beacon(struct ieee80211_sub_if_data *sdata,
1468 struct cfg80211_csa_settings *csa_settings);
1469 int ieee80211_ibss_finish_csa(struct ieee80211_sub_if_data *sdata);
1470 void ieee80211_ibss_stop(struct ieee80211_sub_if_data *sdata);
1471
1472 /* mesh code */
1473 void ieee80211_mesh_work(struct ieee80211_sub_if_data *sdata);
1474 void ieee80211_mesh_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
1475 struct sk_buff *skb);
1476 int ieee80211_mesh_csa_beacon(struct ieee80211_sub_if_data *sdata,
1477 struct cfg80211_csa_settings *csa_settings);
1478 int ieee80211_mesh_finish_csa(struct ieee80211_sub_if_data *sdata);
1479
1480 /* scan/BSS handling */
1481 void ieee80211_scan_work(struct work_struct *work);
1482 int ieee80211_request_ibss_scan(struct ieee80211_sub_if_data *sdata,
1483 const u8 *ssid, u8 ssid_len,
1484 struct ieee80211_channel *chan,
1485 enum nl80211_bss_scan_width scan_width);
1486 int ieee80211_request_scan(struct ieee80211_sub_if_data *sdata,
1487 struct cfg80211_scan_request *req);
1488 void ieee80211_scan_cancel(struct ieee80211_local *local);
1489 void ieee80211_run_deferred_scan(struct ieee80211_local *local);
1490 void ieee80211_scan_rx(struct ieee80211_local *local, struct sk_buff *skb);
1491
1492 void ieee80211_mlme_notify_scan_completed(struct ieee80211_local *local);
1493 struct ieee80211_bss *
1494 ieee80211_bss_info_update(struct ieee80211_local *local,
1495 struct ieee80211_rx_status *rx_status,
1496 struct ieee80211_mgmt *mgmt,
1497 size_t len,
1498 struct ieee802_11_elems *elems,
1499 struct ieee80211_channel *channel);
1500 void ieee80211_rx_bss_put(struct ieee80211_local *local,
1501 struct ieee80211_bss *bss);
1502
1503 /* scheduled scan handling */
1504 int
1505 __ieee80211_request_sched_scan_start(struct ieee80211_sub_if_data *sdata,
1506 struct cfg80211_sched_scan_request *req);
1507 int ieee80211_request_sched_scan_start(struct ieee80211_sub_if_data *sdata,
1508 struct cfg80211_sched_scan_request *req);
1509 int ieee80211_request_sched_scan_stop(struct ieee80211_sub_if_data *sdata);
1510 void ieee80211_sched_scan_end(struct ieee80211_local *local);
1511 void ieee80211_sched_scan_stopped_work(struct work_struct *work);
1512
1513 /* off-channel helpers */
1514 void ieee80211_offchannel_stop_vifs(struct ieee80211_local *local);
1515 void ieee80211_offchannel_return(struct ieee80211_local *local);
1516 void ieee80211_roc_setup(struct ieee80211_local *local);
1517 void ieee80211_start_next_roc(struct ieee80211_local *local);
1518 void ieee80211_roc_purge(struct ieee80211_local *local,
1519 struct ieee80211_sub_if_data *sdata);
1520 void ieee80211_roc_notify_destroy(struct ieee80211_roc_work *roc, bool free);
1521 void ieee80211_sw_roc_work(struct work_struct *work);
1522 void ieee80211_handle_roc_started(struct ieee80211_roc_work *roc);
1523
1524 /* channel switch handling */
1525 void ieee80211_csa_finalize_work(struct work_struct *work);
1526 int ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev,
1527 struct cfg80211_csa_settings *params);
1528
1529 /* interface handling */
1530 int ieee80211_iface_init(void);
1531 void ieee80211_iface_exit(void);
1532 int ieee80211_if_add(struct ieee80211_local *local, const char *name,
1533 struct wireless_dev **new_wdev, enum nl80211_iftype type,
1534 struct vif_params *params);
1535 int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata,
1536 enum nl80211_iftype type);
1537 void ieee80211_if_remove(struct ieee80211_sub_if_data *sdata);
1538 void ieee80211_remove_interfaces(struct ieee80211_local *local);
1539 u32 ieee80211_idle_off(struct ieee80211_local *local);
1540 void ieee80211_recalc_idle(struct ieee80211_local *local);
1541 void ieee80211_adjust_monitor_flags(struct ieee80211_sub_if_data *sdata,
1542 const int offset);
1543 int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up);
1544 void ieee80211_sdata_stop(struct ieee80211_sub_if_data *sdata);
1545 int ieee80211_add_virtual_monitor(struct ieee80211_local *local);
1546 void ieee80211_del_virtual_monitor(struct ieee80211_local *local);
1547
1548 bool __ieee80211_recalc_txpower(struct ieee80211_sub_if_data *sdata);
1549 void ieee80211_recalc_txpower(struct ieee80211_sub_if_data *sdata);
1550
1551 static inline bool ieee80211_sdata_running(struct ieee80211_sub_if_data *sdata)
1552 {
1553 return test_bit(SDATA_STATE_RUNNING, &sdata->state);
1554 }
1555
1556 /* tx handling */
1557 void ieee80211_clear_tx_pending(struct ieee80211_local *local);
1558 void ieee80211_tx_pending(unsigned long data);
1559 netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb,
1560 struct net_device *dev);
1561 netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
1562 struct net_device *dev);
1563 void ieee80211_purge_tx_queue(struct ieee80211_hw *hw,
1564 struct sk_buff_head *skbs);
1565
1566 /* HT */
1567 void ieee80211_apply_htcap_overrides(struct ieee80211_sub_if_data *sdata,
1568 struct ieee80211_sta_ht_cap *ht_cap);
1569 bool ieee80211_ht_cap_ie_to_sta_ht_cap(struct ieee80211_sub_if_data *sdata,
1570 struct ieee80211_supported_band *sband,
1571 const struct ieee80211_ht_cap *ht_cap_ie,
1572 struct sta_info *sta);
1573 void ieee80211_send_delba(struct ieee80211_sub_if_data *sdata,
1574 const u8 *da, u16 tid,
1575 u16 initiator, u16 reason_code);
1576 int ieee80211_send_smps_action(struct ieee80211_sub_if_data *sdata,
1577 enum ieee80211_smps_mode smps, const u8 *da,
1578 const u8 *bssid);
1579 void ieee80211_request_smps_ap_work(struct work_struct *work);
1580 void ieee80211_request_smps_mgd_work(struct work_struct *work);
1581 bool ieee80211_smps_is_restrictive(enum ieee80211_smps_mode smps_mode_old,
1582 enum ieee80211_smps_mode smps_mode_new);
1583
1584 void ___ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid,
1585 u16 initiator, u16 reason, bool stop);
1586 void __ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid,
1587 u16 initiator, u16 reason, bool stop);
1588 void __ieee80211_start_rx_ba_session(struct sta_info *sta,
1589 u8 dialog_token, u16 timeout,
1590 u16 start_seq_num, u16 ba_policy, u16 tid,
1591 u16 buf_size, bool tx, bool auto_seq);
1592 void ieee80211_sta_tear_down_BA_sessions(struct sta_info *sta,
1593 enum ieee80211_agg_stop_reason reason);
1594 void ieee80211_process_delba(struct ieee80211_sub_if_data *sdata,
1595 struct sta_info *sta,
1596 struct ieee80211_mgmt *mgmt, size_t len);
1597 void ieee80211_process_addba_resp(struct ieee80211_local *local,
1598 struct sta_info *sta,
1599 struct ieee80211_mgmt *mgmt,
1600 size_t len);
1601 void ieee80211_process_addba_request(struct ieee80211_local *local,
1602 struct sta_info *sta,
1603 struct ieee80211_mgmt *mgmt,
1604 size_t len);
1605
1606 int __ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
1607 enum ieee80211_agg_stop_reason reason);
1608 int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
1609 enum ieee80211_agg_stop_reason reason);
1610 void ieee80211_start_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u16 tid);
1611 void ieee80211_stop_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u8 tid);
1612 void ieee80211_ba_session_work(struct work_struct *work);
1613 void ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid);
1614 void ieee80211_release_reorder_timeout(struct sta_info *sta, int tid);
1615
1616 u8 ieee80211_mcs_to_chains(const struct ieee80211_mcs_info *mcs);
1617
1618 /* VHT */
1619 void
1620 ieee80211_vht_cap_ie_to_sta_vht_cap(struct ieee80211_sub_if_data *sdata,
1621 struct ieee80211_supported_band *sband,
1622 const struct ieee80211_vht_cap *vht_cap_ie,
1623 struct sta_info *sta);
1624 enum ieee80211_sta_rx_bandwidth ieee80211_sta_cur_vht_bw(struct sta_info *sta);
1625 void ieee80211_sta_set_rx_nss(struct sta_info *sta);
1626 u32 __ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata,
1627 struct sta_info *sta, u8 opmode,
1628 enum ieee80211_band band, bool nss_only);
1629 void ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata,
1630 struct sta_info *sta, u8 opmode,
1631 enum ieee80211_band band, bool nss_only);
1632 void ieee80211_apply_vhtcap_overrides(struct ieee80211_sub_if_data *sdata,
1633 struct ieee80211_sta_vht_cap *vht_cap);
1634
1635 /* Spectrum management */
1636 void ieee80211_process_measurement_req(struct ieee80211_sub_if_data *sdata,
1637 struct ieee80211_mgmt *mgmt,
1638 size_t len);
1639 /**
1640 * ieee80211_parse_ch_switch_ie - parses channel switch IEs
1641 * @sdata: the sdata of the interface which has received the frame
1642 * @elems: parsed 802.11 elements received with the frame
1643 * @beacon: indicates if the frame was a beacon or probe response
1644 * @current_band: indicates the current band
1645 * @sta_flags: contains information about own capabilities and restrictions
1646 * to decide which channel switch announcements can be accepted. Only the
1647 * following subset of &enum ieee80211_sta_flags are evaluated:
1648 * %IEEE80211_STA_DISABLE_HT, %IEEE80211_STA_DISABLE_VHT,
1649 * %IEEE80211_STA_DISABLE_40MHZ, %IEEE80211_STA_DISABLE_80P80MHZ,
1650 * %IEEE80211_STA_DISABLE_160MHZ.
1651 * @bssid: the currently connected bssid (for reporting)
1652 * @csa_ie: parsed 802.11 csa elements on count, mode, chandef and mesh ttl.
1653 All of them will be filled with if success only.
1654 * Return: 0 on success, <0 on error and >0 if there is nothing to parse.
1655 */
1656 int ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data *sdata,
1657 struct ieee802_11_elems *elems, bool beacon,
1658 enum ieee80211_band current_band,
1659 u32 sta_flags, u8 *bssid,
1660 struct ieee80211_csa_ie *csa_ie);
1661
1662 /* Suspend/resume and hw reconfiguration */
1663 int ieee80211_reconfig(struct ieee80211_local *local);
1664 void ieee80211_stop_device(struct ieee80211_local *local);
1665
1666 int __ieee80211_suspend(struct ieee80211_hw *hw,
1667 struct cfg80211_wowlan *wowlan);
1668
1669 static inline int __ieee80211_resume(struct ieee80211_hw *hw)
1670 {
1671 struct ieee80211_local *local = hw_to_local(hw);
1672
1673 WARN(test_bit(SCAN_HW_SCANNING, &local->scanning),
1674 "%s: resume with hardware scan still in progress\n",
1675 wiphy_name(hw->wiphy));
1676
1677 return ieee80211_reconfig(hw_to_local(hw));
1678 }
1679
1680 /* utility functions/constants */
1681 extern const void *const mac80211_wiphy_privid; /* for wiphy privid */
1682 u8 *ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t len,
1683 enum nl80211_iftype type);
1684 int ieee80211_frame_duration(enum ieee80211_band band, size_t len,
1685 int rate, int erp, int short_preamble,
1686 int shift);
1687 void mac80211_ev_michael_mic_failure(struct ieee80211_sub_if_data *sdata, int keyidx,
1688 struct ieee80211_hdr *hdr, const u8 *tsc,
1689 gfp_t gfp);
1690 void ieee80211_set_wmm_default(struct ieee80211_sub_if_data *sdata,
1691 bool bss_notify);
1692 void ieee80211_xmit(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb,
1693 enum ieee80211_band band);
1694
1695 void __ieee80211_tx_skb_tid_band(struct ieee80211_sub_if_data *sdata,
1696 struct sk_buff *skb, int tid,
1697 enum ieee80211_band band);
1698
1699 static inline void
1700 ieee80211_tx_skb_tid_band(struct ieee80211_sub_if_data *sdata,
1701 struct sk_buff *skb, int tid,
1702 enum ieee80211_band band)
1703 {
1704 rcu_read_lock();
1705 __ieee80211_tx_skb_tid_band(sdata, skb, tid, band);
1706 rcu_read_unlock();
1707 }
1708
1709 static inline void ieee80211_tx_skb_tid(struct ieee80211_sub_if_data *sdata,
1710 struct sk_buff *skb, int tid)
1711 {
1712 struct ieee80211_chanctx_conf *chanctx_conf;
1713
1714 rcu_read_lock();
1715 chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
1716 if (WARN_ON(!chanctx_conf)) {
1717 rcu_read_unlock();
1718 kfree_skb(skb);
1719 return;
1720 }
1721
1722 __ieee80211_tx_skb_tid_band(sdata, skb, tid,
1723 chanctx_conf->def.chan->band);
1724 rcu_read_unlock();
1725 }
1726
1727 static inline void ieee80211_tx_skb(struct ieee80211_sub_if_data *sdata,
1728 struct sk_buff *skb)
1729 {
1730 /* Send all internal mgmt frames on VO. Accordingly set TID to 7. */
1731 ieee80211_tx_skb_tid(sdata, skb, 7);
1732 }
1733
1734 u32 ieee802_11_parse_elems_crc(const u8 *start, size_t len, bool action,
1735 struct ieee802_11_elems *elems,
1736 u64 filter, u32 crc);
1737 static inline void ieee802_11_parse_elems(const u8 *start, size_t len,
1738 bool action,
1739 struct ieee802_11_elems *elems)
1740 {
1741 ieee802_11_parse_elems_crc(start, len, action, elems, 0, 0);
1742 }
1743
1744 static inline bool ieee80211_rx_reorder_ready(struct sk_buff_head *frames)
1745 {
1746 struct sk_buff *tail = skb_peek_tail(frames);
1747 struct ieee80211_rx_status *status;
1748
1749 if (!tail)
1750 return false;
1751
1752 status = IEEE80211_SKB_RXCB(tail);
1753 if (status->flag & RX_FLAG_AMSDU_MORE)
1754 return false;
1755
1756 return true;
1757 }
1758
1759 void ieee80211_dynamic_ps_enable_work(struct work_struct *work);
1760 void ieee80211_dynamic_ps_disable_work(struct work_struct *work);
1761 void ieee80211_dynamic_ps_timer(unsigned long data);
1762 void ieee80211_send_nullfunc(struct ieee80211_local *local,
1763 struct ieee80211_sub_if_data *sdata,
1764 int powersave);
1765 void ieee80211_sta_rx_notify(struct ieee80211_sub_if_data *sdata,
1766 struct ieee80211_hdr *hdr);
1767 void ieee80211_sta_tx_notify(struct ieee80211_sub_if_data *sdata,
1768 struct ieee80211_hdr *hdr, bool ack);
1769
1770 void ieee80211_wake_queues_by_reason(struct ieee80211_hw *hw,
1771 unsigned long queues,
1772 enum queue_stop_reason reason,
1773 bool refcounted);
1774 void ieee80211_stop_vif_queues(struct ieee80211_local *local,
1775 struct ieee80211_sub_if_data *sdata,
1776 enum queue_stop_reason reason);
1777 void ieee80211_wake_vif_queues(struct ieee80211_local *local,
1778 struct ieee80211_sub_if_data *sdata,
1779 enum queue_stop_reason reason);
1780 void ieee80211_stop_queues_by_reason(struct ieee80211_hw *hw,
1781 unsigned long queues,
1782 enum queue_stop_reason reason,
1783 bool refcounted);
1784 void ieee80211_wake_queue_by_reason(struct ieee80211_hw *hw, int queue,
1785 enum queue_stop_reason reason,
1786 bool refcounted);
1787 void ieee80211_stop_queue_by_reason(struct ieee80211_hw *hw, int queue,
1788 enum queue_stop_reason reason,
1789 bool refcounted);
1790 void ieee80211_propagate_queue_wake(struct ieee80211_local *local, int queue);
1791 void ieee80211_add_pending_skb(struct ieee80211_local *local,
1792 struct sk_buff *skb);
1793 void ieee80211_add_pending_skbs(struct ieee80211_local *local,
1794 struct sk_buff_head *skbs);
1795 void ieee80211_flush_queues(struct ieee80211_local *local,
1796 struct ieee80211_sub_if_data *sdata);
1797
1798 void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata,
1799 u16 transaction, u16 auth_alg, u16 status,
1800 const u8 *extra, size_t extra_len, const u8 *bssid,
1801 const u8 *da, const u8 *key, u8 key_len, u8 key_idx,
1802 u32 tx_flags);
1803 void ieee80211_send_deauth_disassoc(struct ieee80211_sub_if_data *sdata,
1804 const u8 *bssid, u16 stype, u16 reason,
1805 bool send_frame, u8 *frame_buf);
1806 int ieee80211_build_preq_ies(struct ieee80211_local *local, u8 *buffer,
1807 size_t buffer_len,
1808 struct ieee80211_scan_ies *ie_desc,
1809 const u8 *ie, size_t ie_len,
1810 u8 bands_used, u32 *rate_masks,
1811 struct cfg80211_chan_def *chandef);
1812 struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata,
1813 u8 *dst, u32 ratemask,
1814 struct ieee80211_channel *chan,
1815 const u8 *ssid, size_t ssid_len,
1816 const u8 *ie, size_t ie_len,
1817 bool directed);
1818 void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst,
1819 const u8 *ssid, size_t ssid_len,
1820 const u8 *ie, size_t ie_len,
1821 u32 ratemask, bool directed, u32 tx_flags,
1822 struct ieee80211_channel *channel, bool scan);
1823
1824 u32 ieee80211_sta_get_rates(struct ieee80211_sub_if_data *sdata,
1825 struct ieee802_11_elems *elems,
1826 enum ieee80211_band band, u32 *basic_rates);
1827 int __ieee80211_request_smps_mgd(struct ieee80211_sub_if_data *sdata,
1828 enum ieee80211_smps_mode smps_mode);
1829 int __ieee80211_request_smps_ap(struct ieee80211_sub_if_data *sdata,
1830 enum ieee80211_smps_mode smps_mode);
1831 void ieee80211_recalc_smps(struct ieee80211_sub_if_data *sdata);
1832 void ieee80211_recalc_min_chandef(struct ieee80211_sub_if_data *sdata);
1833
1834 size_t ieee80211_ie_split(const u8 *ies, size_t ielen,
1835 const u8 *ids, int n_ids, size_t offset);
1836 size_t ieee80211_ie_split_vendor(const u8 *ies, size_t ielen, size_t offset);
1837 u8 *ieee80211_ie_build_ht_cap(u8 *pos, struct ieee80211_sta_ht_cap *ht_cap,
1838 u16 cap);
1839 u8 *ieee80211_ie_build_ht_oper(u8 *pos, struct ieee80211_sta_ht_cap *ht_cap,
1840 const struct cfg80211_chan_def *chandef,
1841 u16 prot_mode);
1842 u8 *ieee80211_ie_build_vht_cap(u8 *pos, struct ieee80211_sta_vht_cap *vht_cap,
1843 u32 cap);
1844 int ieee80211_parse_bitrates(struct cfg80211_chan_def *chandef,
1845 const struct ieee80211_supported_band *sband,
1846 const u8 *srates, int srates_len, u32 *rates);
1847 int ieee80211_add_srates_ie(struct ieee80211_sub_if_data *sdata,
1848 struct sk_buff *skb, bool need_basic,
1849 enum ieee80211_band band);
1850 int ieee80211_add_ext_srates_ie(struct ieee80211_sub_if_data *sdata,
1851 struct sk_buff *skb, bool need_basic,
1852 enum ieee80211_band band);
1853 u8 *ieee80211_add_wmm_info_ie(u8 *buf, u8 qosinfo);
1854
1855 /* channel management */
1856 void ieee80211_ht_oper_to_chandef(struct ieee80211_channel *control_chan,
1857 const struct ieee80211_ht_operation *ht_oper,
1858 struct cfg80211_chan_def *chandef);
1859 u32 ieee80211_chandef_downgrade(struct cfg80211_chan_def *c);
1860
1861 int __must_check
1862 ieee80211_vif_use_channel(struct ieee80211_sub_if_data *sdata,
1863 const struct cfg80211_chan_def *chandef,
1864 enum ieee80211_chanctx_mode mode);
1865 int __must_check
1866 ieee80211_vif_reserve_chanctx(struct ieee80211_sub_if_data *sdata,
1867 const struct cfg80211_chan_def *chandef,
1868 enum ieee80211_chanctx_mode mode,
1869 bool radar_required);
1870 int __must_check
1871 ieee80211_vif_use_reserved_context(struct ieee80211_sub_if_data *sdata);
1872 int ieee80211_vif_unreserve_chanctx(struct ieee80211_sub_if_data *sdata);
1873
1874 int __must_check
1875 ieee80211_vif_change_bandwidth(struct ieee80211_sub_if_data *sdata,
1876 const struct cfg80211_chan_def *chandef,
1877 u32 *changed);
1878 void ieee80211_vif_release_channel(struct ieee80211_sub_if_data *sdata);
1879 void ieee80211_vif_vlan_copy_chanctx(struct ieee80211_sub_if_data *sdata);
1880 void ieee80211_vif_copy_chanctx_to_vlans(struct ieee80211_sub_if_data *sdata,
1881 bool clear);
1882 int ieee80211_chanctx_refcount(struct ieee80211_local *local,
1883 struct ieee80211_chanctx *ctx);
1884
1885 void ieee80211_recalc_smps_chanctx(struct ieee80211_local *local,
1886 struct ieee80211_chanctx *chanctx);
1887 void ieee80211_recalc_chanctx_min_def(struct ieee80211_local *local,
1888 struct ieee80211_chanctx *ctx);
1889
1890 void ieee80211_dfs_cac_timer(unsigned long data);
1891 void ieee80211_dfs_cac_timer_work(struct work_struct *work);
1892 void ieee80211_dfs_cac_cancel(struct ieee80211_local *local);
1893 void ieee80211_dfs_radar_detected_work(struct work_struct *work);
1894 int ieee80211_send_action_csa(struct ieee80211_sub_if_data *sdata,
1895 struct cfg80211_csa_settings *csa_settings);
1896
1897 bool ieee80211_cs_valid(const struct ieee80211_cipher_scheme *cs);
1898 bool ieee80211_cs_list_valid(const struct ieee80211_cipher_scheme *cs, int n);
1899 const struct ieee80211_cipher_scheme *
1900 ieee80211_cs_get(struct ieee80211_local *local, u32 cipher,
1901 enum nl80211_iftype iftype);
1902 int ieee80211_cs_headroom(struct ieee80211_local *local,
1903 struct cfg80211_crypto_settings *crypto,
1904 enum nl80211_iftype iftype);
1905 void ieee80211_recalc_dtim(struct ieee80211_local *local,
1906 struct ieee80211_sub_if_data *sdata);
1907 int ieee80211_check_combinations(struct ieee80211_sub_if_data *sdata,
1908 const struct cfg80211_chan_def *chandef,
1909 enum ieee80211_chanctx_mode chanmode,
1910 u8 radar_detect);
1911 int ieee80211_max_num_channels(struct ieee80211_local *local);
1912
1913 /* TDLS */
1914 int ieee80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev,
1915 const u8 *peer, u8 action_code, u8 dialog_token,
1916 u16 status_code, u32 peer_capability,
1917 bool initiator, const u8 *extra_ies,
1918 size_t extra_ies_len);
1919 int ieee80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev,
1920 const u8 *peer, enum nl80211_tdls_operation oper);
1921 void ieee80211_tdls_peer_del_work(struct work_struct *wk);
1922
1923 extern const struct ethtool_ops ieee80211_ethtool_ops;
1924
1925 #ifdef CONFIG_MAC80211_NOINLINE
1926 #define debug_noinline noinline
1927 #else
1928 #define debug_noinline
1929 #endif
1930
1931 #endif /* IEEE80211_I_H */