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
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.
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>
36 struct ieee80211_local
;
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
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
47 /* Required encryption head and tailroom */
48 #define IEEE80211_ENCRYPT_HEADROOM 8
49 #define IEEE80211_ENCRYPT_TAILROOM 18
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
57 /* power level hasn't been configured (or set to automatic) */
58 #define IEEE80211_UNSET_POWER_LEVEL INT_MIN
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
65 * Cisco 4410N originally forced us to enable VO by default only because it
66 * treated non-VO ACs as legacy.
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.
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.
78 #define IEEE80211_DEFAULT_UAPSD_QUEUES 0
80 #define IEEE80211_DEFAULT_MAX_SP_LEN \
81 IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL
83 #define IEEE80211_DEAUTH_FRAME_LEN (24 /* hdr */ + 2 /* reason */)
85 struct ieee80211_fragment_entry
{
86 unsigned long first_frag_time
;
88 unsigned int rx_queue
;
89 unsigned int last_frag
;
90 unsigned int extra_len
;
91 struct sk_buff_head skb_list
;
92 int ccmp
; /* Whether fragments were encrypted with CCMP */
93 u8 last_pn
[6]; /* PN of the last fragment if CCMP was used */
97 struct ieee80211_bss
{
98 u32 device_ts_beacon
, device_ts_presp
;
101 bool uapsd_supported
;
103 #define IEEE80211_MAX_SUPP_RATES 32
104 u8 supp_rates
[IEEE80211_MAX_SUPP_RATES
];
105 size_t supp_rates_len
;
106 struct ieee80211_rate
*beacon_rate
;
109 * During association, we save an ERP value from a probe response so
110 * that we can feed ERP info to the driver when handling the
111 * association completes. these fields probably won't be up-to-date
112 * otherwise, you probably don't want to use them.
117 /* Keep track of the corruption of the last beacon/probe response. */
120 /* Keep track of what bits of information we have valid info for. */
125 * enum ieee80211_corrupt_data_flags - BSS data corruption flags
126 * @IEEE80211_BSS_CORRUPT_BEACON: last beacon frame received was corrupted
127 * @IEEE80211_BSS_CORRUPT_PROBE_RESP: last probe response received was corrupted
129 * These are bss flags that are attached to a bss in the
130 * @corrupt_data field of &struct ieee80211_bss.
132 enum ieee80211_bss_corrupt_data_flags
{
133 IEEE80211_BSS_CORRUPT_BEACON
= BIT(0),
134 IEEE80211_BSS_CORRUPT_PROBE_RESP
= BIT(1)
138 * enum ieee80211_valid_data_flags - BSS valid data flags
139 * @IEEE80211_BSS_VALID_WMM: WMM/UAPSD data was gathered from non-corrupt IE
140 * @IEEE80211_BSS_VALID_RATES: Supported rates were gathered from non-corrupt IE
141 * @IEEE80211_BSS_VALID_ERP: ERP flag was gathered from non-corrupt IE
143 * These are bss flags that are attached to a bss in the
144 * @valid_data field of &struct ieee80211_bss. They show which parts
145 * of the data structure were received as a result of an un-corrupted
146 * beacon/probe response.
148 enum ieee80211_bss_valid_data_flags
{
149 IEEE80211_BSS_VALID_WMM
= BIT(1),
150 IEEE80211_BSS_VALID_RATES
= BIT(2),
151 IEEE80211_BSS_VALID_ERP
= BIT(3)
154 typedef unsigned __bitwise__ ieee80211_tx_result
;
155 #define TX_CONTINUE ((__force ieee80211_tx_result) 0u)
156 #define TX_DROP ((__force ieee80211_tx_result) 1u)
157 #define TX_QUEUED ((__force ieee80211_tx_result) 2u)
159 #define IEEE80211_TX_UNICAST BIT(1)
160 #define IEEE80211_TX_PS_BUFFERED BIT(2)
162 struct ieee80211_tx_data
{
164 struct sk_buff_head skbs
;
165 struct ieee80211_local
*local
;
166 struct ieee80211_sub_if_data
*sdata
;
167 struct sta_info
*sta
;
168 struct ieee80211_key
*key
;
169 struct ieee80211_tx_rate rate
;
175 typedef unsigned __bitwise__ ieee80211_rx_result
;
176 #define RX_CONTINUE ((__force ieee80211_rx_result) 0u)
177 #define RX_DROP_UNUSABLE ((__force ieee80211_rx_result) 1u)
178 #define RX_DROP_MONITOR ((__force ieee80211_rx_result) 2u)
179 #define RX_QUEUED ((__force ieee80211_rx_result) 3u)
182 * enum ieee80211_packet_rx_flags - packet RX flags
183 * @IEEE80211_RX_RA_MATCH: frame is destined to interface currently processed
184 * (incl. multicast frames)
185 * @IEEE80211_RX_FRAGMENTED: fragmented frame
186 * @IEEE80211_RX_AMSDU: a-MSDU packet
187 * @IEEE80211_RX_MALFORMED_ACTION_FRM: action frame is malformed
188 * @IEEE80211_RX_DEFERRED_RELEASE: frame was subjected to receive reordering
190 * These are per-frame flags that are attached to a frame in the
191 * @rx_flags field of &struct ieee80211_rx_status.
193 enum ieee80211_packet_rx_flags
{
194 IEEE80211_RX_RA_MATCH
= BIT(1),
195 IEEE80211_RX_FRAGMENTED
= BIT(2),
196 IEEE80211_RX_AMSDU
= BIT(3),
197 IEEE80211_RX_MALFORMED_ACTION_FRM
= BIT(4),
198 IEEE80211_RX_DEFERRED_RELEASE
= BIT(5),
202 * enum ieee80211_rx_flags - RX data flags
204 * @IEEE80211_RX_CMNTR: received on cooked monitor already
205 * @IEEE80211_RX_BEACON_REPORTED: This frame was already reported
206 * to cfg80211_report_obss_beacon().
208 * These flags are used across handling multiple interfaces
209 * for a single frame.
211 enum ieee80211_rx_flags
{
212 IEEE80211_RX_CMNTR
= BIT(0),
213 IEEE80211_RX_BEACON_REPORTED
= BIT(1),
216 struct ieee80211_rx_data
{
218 struct ieee80211_local
*local
;
219 struct ieee80211_sub_if_data
*sdata
;
220 struct sta_info
*sta
;
221 struct ieee80211_key
*key
;
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.
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.
244 struct ieee80211_csa_settings
{
245 const u16
*counter_offsets_beacon
;
246 const u16
*counter_offsets_presp
;
248 int n_counter_offsets_beacon
;
249 int n_counter_offsets_presp
;
256 int head_len
, tail_len
;
257 struct ieee80211_meshconf_ie
*meshconf
;
258 u16 csa_counter_offsets
[IEEE80211_MAX_CSA_COUNTERS_NUM
];
259 u8 csa_current_counter
;
260 struct rcu_head rcu_head
;
264 struct rcu_head rcu_head
;
266 u16 csa_counter_offsets
[IEEE80211_MAX_CSA_COUNTERS_NUM
];
271 /* yes, this looks ugly, but guarantees that we can later use
273 * NB: don't touch this bitmap, use sta_info_{set,clear}_tim_bit */
274 u8 tim
[sizeof(unsigned long) * BITS_TO_LONGS(IEEE80211_MAX_AID
+ 1)]
275 __aligned(__alignof__(unsigned long));
276 struct sk_buff_head bc_buf
;
277 atomic_t num_sta_ps
; /* number of stations in PS mode */
282 struct ieee80211_if_ap
{
283 struct beacon_data __rcu
*beacon
;
284 struct probe_resp __rcu
*probe_resp
;
286 /* to be used after channel switch. */
287 struct cfg80211_beacon_data
*next_beacon
;
288 struct list_head vlans
; /* write-protected with RTNL and local->mtx */
291 atomic_t num_mcast_sta
; /* number of stations receiving multicast */
292 enum ieee80211_smps_mode req_smps
, /* requested smps mode */
293 driver_smps_mode
; /* smps mode request */
295 struct work_struct request_smps_work
;
298 struct ieee80211_if_wds
{
299 struct sta_info
*sta
;
300 u8 remote_addr
[ETH_ALEN
];
303 struct ieee80211_if_vlan
{
304 struct list_head list
; /* write-protected with RTNL and local->mtx */
306 /* used for all tx if the VLAN is configured to 4-addr mode */
307 struct sta_info __rcu
*sta
;
311 __u32 fwded_mcast
; /* Mesh forwarded multicast frames */
312 __u32 fwded_unicast
; /* Mesh forwarded unicast frames */
313 __u32 fwded_frames
; /* Mesh total forwarded frames */
314 __u32 dropped_frames_ttl
; /* Not transmitted since mesh_ttl == 0*/
315 __u32 dropped_frames_no_route
; /* Not transmitted, no route found */
316 __u32 dropped_frames_congestion
;/* Not forwarded due to congestion */
319 #define PREQ_Q_F_START 0x1
320 #define PREQ_Q_F_REFRESH 0x2
321 struct mesh_preq_queue
{
322 struct list_head list
;
328 #define IEEE80211_ROC_MIN_LEFT 1
330 #define IEEE80211_ROC_MIN_LEFT (HZ/100)
333 struct ieee80211_roc_work
{
334 struct list_head list
;
335 struct list_head dependents
;
337 struct delayed_work work
;
339 struct ieee80211_sub_if_data
*sdata
;
341 struct ieee80211_channel
*chan
;
343 bool started
, abort
, hw_begun
, notified
;
347 unsigned long hw_start_time
;
349 u32 duration
, req_duration
;
350 struct sk_buff
*frame
;
351 u64 cookie
, mgmt_tx_cookie
;
352 enum ieee80211_roc_type type
;
355 /* flags used in struct ieee80211_if_managed.flags */
356 enum ieee80211_sta_flags
{
357 IEEE80211_STA_CONNECTION_POLL
= BIT(1),
358 IEEE80211_STA_CONTROL_PORT
= BIT(2),
359 IEEE80211_STA_DISABLE_HT
= BIT(4),
360 IEEE80211_STA_MFP_ENABLED
= BIT(6),
361 IEEE80211_STA_UAPSD_ENABLED
= BIT(7),
362 IEEE80211_STA_NULLFUNC_ACKED
= BIT(8),
363 IEEE80211_STA_RESET_SIGNAL_AVE
= BIT(9),
364 IEEE80211_STA_DISABLE_40MHZ
= BIT(10),
365 IEEE80211_STA_DISABLE_VHT
= BIT(11),
366 IEEE80211_STA_DISABLE_80P80MHZ
= BIT(12),
367 IEEE80211_STA_DISABLE_160MHZ
= BIT(13),
368 IEEE80211_STA_DISABLE_WMM
= BIT(14),
369 IEEE80211_STA_ENABLE_RRM
= BIT(15),
372 struct ieee80211_mgd_auth_data
{
373 struct cfg80211_bss
*bss
;
374 unsigned long timeout
;
376 u16 algorithm
, expected_transaction
;
378 u8 key
[WLAN_KEY_LEN_WEP104
];
381 bool timeout_started
;
383 u16 sae_trans
, sae_status
;
388 struct ieee80211_mgd_assoc_data
{
389 struct cfg80211_bss
*bss
;
390 const u8
*supp_rates
;
392 unsigned long timeout
;
396 u8 prev_bssid
[ETH_ALEN
];
397 u8 ssid
[IEEE80211_MAX_SSID_LEN
];
403 bool timeout_started
;
407 struct ieee80211_vht_cap ap_vht_cap
;
413 struct ieee80211_sta_tx_tspec
{
414 /* timestamp of the first packet in the time slice */
415 unsigned long time_slice_start
;
417 u32 admitted_time
; /* in usecs, unlike over the air */
419 s8 up
; /* signed to be able to invalidate with -1 during teardown */
421 /* consumed TX time in microseconds in the time slice */
422 u32 consumed_tx_time
;
424 TX_TSPEC_ACTION_NONE
= 0,
425 TX_TSPEC_ACTION_DOWNGRADE
,
426 TX_TSPEC_ACTION_STOP_DOWNGRADE
,
431 struct ieee80211_if_managed
{
432 struct timer_list timer
;
433 struct timer_list conn_mon_timer
;
434 struct timer_list bcn_mon_timer
;
435 struct timer_list chswitch_timer
;
436 struct work_struct monitor_work
;
437 struct work_struct chswitch_work
;
438 struct work_struct beacon_connection_loss_work
;
439 struct work_struct csa_connection_drop_work
;
441 unsigned long beacon_timeout
;
442 unsigned long probe_timeout
;
443 int probe_send_count
;
444 bool nullfunc_failed
;
445 bool connection_loss
;
447 struct cfg80211_bss
*associated
;
448 struct ieee80211_mgd_auth_data
*auth_data
;
449 struct ieee80211_mgd_assoc_data
*assoc_data
;
455 bool powersave
; /* powersave requested for this iface */
456 bool broken_ap
; /* AP is broken -- turn off powersave */
459 enum ieee80211_smps_mode req_smps
, /* requested smps mode */
460 driver_smps_mode
; /* smps mode request */
462 struct work_struct request_smps_work
;
466 bool csa_waiting_bcn
;
467 bool csa_ignored_same_chan
;
469 bool beacon_crc_valid
;
473 bool status_received
;
477 IEEE80211_MFP_DISABLED
,
478 IEEE80211_MFP_OPTIONAL
,
479 IEEE80211_MFP_REQUIRED
480 } mfp
; /* management frame protection */
483 * Bitmask of enabled u-apsd queues,
484 * IEEE80211_WMM_IE_STA_QOSINFO_AC_BE & co. Needs a new association
487 unsigned int uapsd_queues
;
490 * Maximum number of buffered frames AP can deliver during a
491 * service period, IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL or similar.
492 * Needs a new association to take effect.
494 unsigned int uapsd_max_sp_len
;
496 int wmm_last_param_set
;
502 /* Signal strength from the last Beacon frame in the current BSS. */
503 int last_beacon_signal
;
506 * Weighted average of the signal strength from Beacon frames in the
507 * current BSS. This is in units of 1/16 of the signal unit to maintain
508 * accuracy and to speed up calculations, i.e., the value need to be
509 * divided by 16 to get the actual value.
511 int ave_beacon_signal
;
514 * Number of Beacon frames used in ave_beacon_signal. This can be used
515 * to avoid generating less reliable cqm events that would be based
516 * only on couple of received frames.
518 unsigned int count_beacon_signal
;
521 * Last Beacon frame signal strength average (ave_beacon_signal / 16)
522 * that triggered a cqm event. 0 indicates that no event has been
523 * generated for the current association.
525 int last_cqm_event_signal
;
528 * State variables for keeping track of RSSI of the AP currently
529 * connected to and informing driver when RSSI has gone
530 * below/above a certain threshold.
532 int rssi_min_thold
, rssi_max_thold
;
533 int last_ave_beacon_signal
;
535 struct ieee80211_ht_cap ht_capa
; /* configured ht-cap over-rides */
536 struct ieee80211_ht_cap ht_capa_mask
; /* Valid parts of ht_capa */
537 struct ieee80211_vht_cap vht_capa
; /* configured VHT overrides */
538 struct ieee80211_vht_cap vht_capa_mask
; /* Valid parts of vht_capa */
541 u8 tdls_peer
[ETH_ALEN
] __aligned(2);
542 struct delayed_work tdls_peer_del_work
;
543 struct sk_buff
*orig_teardown_skb
; /* The original teardown skb */
544 struct sk_buff
*teardown_skb
; /* A copy to send through the AP */
545 spinlock_t teardown_lock
; /* To lock changing teardown_skb */
546 bool tdls_chan_switch_prohibited
;
548 /* WMM-AC TSPEC support */
549 struct ieee80211_sta_tx_tspec tx_tspec
[IEEE80211_NUM_ACS
];
550 /* Use a separate work struct so that we can do something here
551 * while the sdata->work is flushing the queues, for example.
552 * otherwise, in scenarios where we hardly get any traffic out
553 * on the BE queue, but there's a lot of VO traffic, we might
554 * get stuck in a downgraded situation and flush takes forever.
556 struct delayed_work tx_tspec_wk
;
559 struct ieee80211_if_ibss
{
560 struct timer_list timer
;
561 struct work_struct csa_connection_drop_work
;
563 unsigned long last_scan_completed
;
572 bool userspace_handles_dfs
;
574 u8 bssid
[ETH_ALEN
] __aligned(2);
575 u8 ssid
[IEEE80211_MAX_SSID_LEN
];
578 struct cfg80211_chan_def chandef
;
580 unsigned long ibss_join_req
;
581 /* probe response/beacon for IBSS */
582 struct beacon_data __rcu
*presp
;
584 struct ieee80211_ht_cap ht_capa
; /* configured ht-cap over-rides */
585 struct ieee80211_ht_cap ht_capa_mask
; /* Valid parts of ht_capa */
587 spinlock_t incomplete_lock
;
588 struct list_head incomplete_stations
;
591 IEEE80211_IBSS_MLME_SEARCH
,
592 IEEE80211_IBSS_MLME_JOINED
,
597 * struct ieee80211_if_ocb - OCB mode state
599 * @housekeeping_timer: timer for periodic invocation of a housekeeping task
600 * @wrkq_flags: OCB deferred task action
601 * @incomplete_lock: delayed STA insertion lock
602 * @incomplete_stations: list of STAs waiting for delayed insertion
603 * @joined: indication if the interface is connected to an OCB network
605 struct ieee80211_if_ocb
{
606 struct timer_list housekeeping_timer
;
607 unsigned long wrkq_flags
;
609 spinlock_t incomplete_lock
;
610 struct list_head incomplete_stations
;
616 * struct ieee80211_mesh_sync_ops - Extensible synchronization framework interface
618 * these declarations define the interface, which enables
619 * vendor-specific mesh synchronization
622 struct ieee802_11_elems
;
623 struct ieee80211_mesh_sync_ops
{
624 void (*rx_bcn_presp
)(struct ieee80211_sub_if_data
*sdata
,
626 struct ieee80211_mgmt
*mgmt
,
627 struct ieee802_11_elems
*elems
,
628 struct ieee80211_rx_status
*rx_status
);
630 /* should be called with beacon_data under RCU read lock */
631 void (*adjust_tbtt
)(struct ieee80211_sub_if_data
*sdata
,
632 struct beacon_data
*beacon
);
633 /* add other framework functions here */
636 struct mesh_csa_settings
{
637 struct rcu_head rcu_head
;
638 struct cfg80211_csa_settings settings
;
641 struct ieee80211_if_mesh
{
642 struct timer_list housekeeping_timer
;
643 struct timer_list mesh_path_timer
;
644 struct timer_list mesh_path_root_timer
;
646 unsigned long wrkq_flags
;
647 unsigned long mbss_changed
;
649 u8 mesh_id
[IEEE80211_MAX_MESH_ID_LEN
];
651 /* Active Path Selection Protocol Identifier */
653 /* Active Path Selection Metric Identifier */
655 /* Congestion Control Mode Identifier */
657 /* Synchronization Protocol Identifier */
659 /* Authentication Protocol Identifier */
661 /* Local mesh Sequence Number */
663 /* Last used PREQ ID */
666 /* Timestamp of last SN update */
667 unsigned long last_sn_update
;
668 /* Time when it's ok to send next PERR */
669 unsigned long next_perr
;
670 /* Timestamp of last PREQ sent */
671 unsigned long last_preq
;
672 struct mesh_rmc
*rmc
;
673 spinlock_t mesh_preq_queue_lock
;
674 struct mesh_preq_queue preq_queue
;
676 struct mesh_stats mshstats
;
677 struct mesh_config mshcfg
;
678 atomic_t estab_plinks
;
680 bool accepting_plinks
;
682 struct beacon_data __rcu
*beacon
;
686 IEEE80211_MESH_SEC_NONE
= 0x0,
687 IEEE80211_MESH_SEC_AUTHED
= 0x1,
688 IEEE80211_MESH_SEC_SECURED
= 0x2,
691 /* Extensible Synchronization Framework */
692 const struct ieee80211_mesh_sync_ops
*sync_ops
;
693 s64 sync_offset_clockdrift_max
;
694 spinlock_t sync_offset_lock
;
696 /* mesh power save */
697 enum nl80211_mesh_power_mode nonpeer_pm
;
698 int ps_peers_light_sleep
;
699 int ps_peers_deep_sleep
;
701 /* Channel Switching Support */
702 struct mesh_csa_settings __rcu
*csa
;
704 IEEE80211_MESH_CSA_ROLE_NONE
,
705 IEEE80211_MESH_CSA_ROLE_INIT
,
706 IEEE80211_MESH_CSA_ROLE_REPEATER
,
711 /* offset from skb->data while building IE */
715 #ifdef CONFIG_MAC80211_MESH
716 #define IEEE80211_IFSTA_MESH_CTR_INC(msh, name) \
717 do { (msh)->mshstats.name++; } while (0)
719 #define IEEE80211_IFSTA_MESH_CTR_INC(msh, name) \
724 * enum ieee80211_sub_if_data_flags - virtual interface flags
726 * @IEEE80211_SDATA_ALLMULTI: interface wants all multicast packets
727 * @IEEE80211_SDATA_PROMISC: interface is promisc
728 * @IEEE80211_SDATA_OPERATING_GMODE: operating in G-only mode
729 * @IEEE80211_SDATA_DONT_BRIDGE_PACKETS: bridge packets between
730 * associated stations and deliver multicast frames both
731 * back to wireless media and to the local net stack.
732 * @IEEE80211_SDATA_DISCONNECT_RESUME: Disconnect after resume.
733 * @IEEE80211_SDATA_IN_DRIVER: indicates interface was added to driver
735 enum ieee80211_sub_if_data_flags
{
736 IEEE80211_SDATA_ALLMULTI
= BIT(0),
737 IEEE80211_SDATA_PROMISC
= BIT(1),
738 IEEE80211_SDATA_OPERATING_GMODE
= BIT(2),
739 IEEE80211_SDATA_DONT_BRIDGE_PACKETS
= BIT(3),
740 IEEE80211_SDATA_DISCONNECT_RESUME
= BIT(4),
741 IEEE80211_SDATA_IN_DRIVER
= BIT(5),
745 * enum ieee80211_sdata_state_bits - virtual interface state bits
746 * @SDATA_STATE_RUNNING: virtual interface is up & running; this
747 * mirrors netif_running() but is separate for interface type
748 * change handling while the interface is up
749 * @SDATA_STATE_OFFCHANNEL: This interface is currently in offchannel
750 * mode, so queues are stopped
751 * @SDATA_STATE_OFFCHANNEL_BEACON_STOPPED: Beaconing was stopped due
752 * to offchannel, reset when offchannel returns
754 enum ieee80211_sdata_state_bits
{
756 SDATA_STATE_OFFCHANNEL
,
757 SDATA_STATE_OFFCHANNEL_BEACON_STOPPED
,
761 * enum ieee80211_chanctx_mode - channel context configuration mode
763 * @IEEE80211_CHANCTX_SHARED: channel context may be used by
764 * multiple interfaces
765 * @IEEE80211_CHANCTX_EXCLUSIVE: channel context can be used
766 * only by a single interface. This can be used for example for
767 * non-fixed channel IBSS.
769 enum ieee80211_chanctx_mode
{
770 IEEE80211_CHANCTX_SHARED
,
771 IEEE80211_CHANCTX_EXCLUSIVE
775 * enum ieee80211_chanctx_replace_state - channel context replacement state
777 * This is used for channel context in-place reservations that require channel
778 * context switch/swap.
780 * @IEEE80211_CHANCTX_REPLACE_NONE: no replacement is taking place
781 * @IEEE80211_CHANCTX_WILL_BE_REPLACED: this channel context will be replaced
782 * by a (not yet registered) channel context pointed by %replace_ctx.
783 * @IEEE80211_CHANCTX_REPLACES_OTHER: this (not yet registered) channel context
784 * replaces an existing channel context pointed to by %replace_ctx.
786 enum ieee80211_chanctx_replace_state
{
787 IEEE80211_CHANCTX_REPLACE_NONE
,
788 IEEE80211_CHANCTX_WILL_BE_REPLACED
,
789 IEEE80211_CHANCTX_REPLACES_OTHER
,
792 struct ieee80211_chanctx
{
793 struct list_head list
;
794 struct rcu_head rcu_head
;
796 struct list_head assigned_vifs
;
797 struct list_head reserved_vifs
;
799 enum ieee80211_chanctx_replace_state replace_state
;
800 struct ieee80211_chanctx
*replace_ctx
;
802 enum ieee80211_chanctx_mode mode
;
805 struct ieee80211_chanctx_conf conf
;
808 struct mac80211_qos_map
{
809 struct cfg80211_qos_map qos_map
;
810 struct rcu_head rcu_head
;
813 struct ieee80211_sub_if_data
{
814 struct list_head list
;
816 struct wireless_dev wdev
;
819 struct list_head key_list
;
821 /* count for keys needing tailroom space allocation */
822 int crypto_tx_tailroom_needed_cnt
;
823 int crypto_tx_tailroom_pending_dec
;
824 struct delayed_work dec_tailroom_needed_wk
;
826 struct net_device
*dev
;
827 struct ieee80211_local
*local
;
833 int drop_unencrypted
;
837 /* Fragment table for host-based reassembly */
838 struct ieee80211_fragment_entry fragments
[IEEE80211_FRAGMENT_MAX
];
839 unsigned int fragment_next
;
841 /* TID bitmap for NoAck policy */
844 /* bit field of ACM bits (BIT(802.1D tag)) */
847 struct ieee80211_key __rcu
*keys
[NUM_DEFAULT_KEYS
+ NUM_DEFAULT_MGMT_KEYS
];
848 struct ieee80211_key __rcu
*default_unicast_key
;
849 struct ieee80211_key __rcu
*default_multicast_key
;
850 struct ieee80211_key __rcu
*default_mgmt_key
;
853 __be16 control_port_protocol
;
854 bool control_port_no_encrypt
;
855 int encrypt_headroom
;
857 struct ieee80211_tx_queue_params tx_conf
[IEEE80211_NUM_ACS
];
858 struct mac80211_qos_map __rcu
*qos_map
;
860 struct work_struct csa_finalize_work
;
861 bool csa_block_tx
; /* write-protected by sdata_lock and local->mtx */
862 struct cfg80211_chan_def csa_chandef
;
864 struct list_head assigned_chanctx_list
; /* protected by chanctx_mtx */
865 struct list_head reserved_chanctx_list
; /* protected by chanctx_mtx */
867 /* context reservation -- protected with chanctx_mtx */
868 struct ieee80211_chanctx
*reserved_chanctx
;
869 struct cfg80211_chan_def reserved_chandef
;
870 bool reserved_radar_required
;
873 /* used to reconfigure hardware SM PS */
874 struct work_struct recalc_smps
;
876 struct work_struct work
;
877 struct sk_buff_head skb_queue
;
880 enum ieee80211_smps_mode smps_mode
;
882 int user_power_level
; /* in dBm */
883 int ap_power_level
; /* in dBm */
886 struct delayed_work dfs_cac_timer_work
;
889 * AP this belongs to: self in AP mode and
890 * corresponding AP in VLAN mode, NULL for
891 * all others (might be needed later in IBSS)
893 struct ieee80211_if_ap
*bss
;
895 /* bitmap of allowed (non-MCS) rate indexes for rate control */
896 u32 rc_rateidx_mask
[IEEE80211_NUM_BANDS
];
898 bool rc_has_mcs_mask
[IEEE80211_NUM_BANDS
];
899 u8 rc_rateidx_mcs_mask
[IEEE80211_NUM_BANDS
][IEEE80211_HT_MCS_MASK_LEN
];
902 struct ieee80211_if_ap ap
;
903 struct ieee80211_if_wds wds
;
904 struct ieee80211_if_vlan vlan
;
905 struct ieee80211_if_managed mgd
;
906 struct ieee80211_if_ibss ibss
;
907 struct ieee80211_if_mesh mesh
;
908 struct ieee80211_if_ocb ocb
;
912 #ifdef CONFIG_MAC80211_DEBUGFS
914 struct dentry
*subdir_stations
;
915 struct dentry
*default_unicast_key
;
916 struct dentry
*default_multicast_key
;
917 struct dentry
*default_mgmt_key
;
921 /* must be last, dynamically sized area in this! */
922 struct ieee80211_vif vif
;
926 struct ieee80211_sub_if_data
*vif_to_sdata(struct ieee80211_vif
*p
)
928 return container_of(p
, struct ieee80211_sub_if_data
, vif
);
931 static inline void sdata_lock(struct ieee80211_sub_if_data
*sdata
)
932 __acquires(&sdata
->wdev
.mtx
)
934 mutex_lock(&sdata
->wdev
.mtx
);
935 __acquire(&sdata
->wdev
.mtx
);
938 static inline void sdata_unlock(struct ieee80211_sub_if_data
*sdata
)
939 __releases(&sdata
->wdev
.mtx
)
941 mutex_unlock(&sdata
->wdev
.mtx
);
942 __release(&sdata
->wdev
.mtx
);
945 #define sdata_dereference(p, sdata) \
946 rcu_dereference_protected(p, lockdep_is_held(&sdata->wdev.mtx))
949 sdata_assert_lock(struct ieee80211_sub_if_data
*sdata
)
951 lockdep_assert_held(&sdata
->wdev
.mtx
);
954 static inline enum ieee80211_band
955 ieee80211_get_sdata_band(struct ieee80211_sub_if_data
*sdata
)
957 enum ieee80211_band band
= IEEE80211_BAND_2GHZ
;
958 struct ieee80211_chanctx_conf
*chanctx_conf
;
961 chanctx_conf
= rcu_dereference(sdata
->vif
.chanctx_conf
);
962 if (!WARN_ON(!chanctx_conf
))
963 band
= chanctx_conf
->def
.chan
->band
;
970 ieee80211_chandef_get_shift(struct cfg80211_chan_def
*chandef
)
972 switch (chandef
->width
) {
973 case NL80211_CHAN_WIDTH_5
:
975 case NL80211_CHAN_WIDTH_10
:
983 ieee80211_vif_get_shift(struct ieee80211_vif
*vif
)
985 struct ieee80211_chanctx_conf
*chanctx_conf
;
989 chanctx_conf
= rcu_dereference(vif
->chanctx_conf
);
991 shift
= ieee80211_chandef_get_shift(&chanctx_conf
->def
);
997 struct ieee80211_rx_agg
{
1002 enum sdata_queue_type
{
1003 IEEE80211_SDATA_QUEUE_TYPE_FRAME
= 0,
1004 IEEE80211_SDATA_QUEUE_AGG_START
= 1,
1005 IEEE80211_SDATA_QUEUE_AGG_STOP
= 2,
1006 IEEE80211_SDATA_QUEUE_RX_AGG_START
= 3,
1007 IEEE80211_SDATA_QUEUE_RX_AGG_STOP
= 4,
1008 IEEE80211_SDATA_QUEUE_TDLS_CHSW
= 5,
1012 IEEE80211_RX_MSG
= 1,
1013 IEEE80211_TX_STATUS_MSG
= 2,
1016 enum queue_stop_reason
{
1017 IEEE80211_QUEUE_STOP_REASON_DRIVER
,
1018 IEEE80211_QUEUE_STOP_REASON_PS
,
1019 IEEE80211_QUEUE_STOP_REASON_CSA
,
1020 IEEE80211_QUEUE_STOP_REASON_AGGREGATION
,
1021 IEEE80211_QUEUE_STOP_REASON_SUSPEND
,
1022 IEEE80211_QUEUE_STOP_REASON_SKB_ADD
,
1023 IEEE80211_QUEUE_STOP_REASON_OFFCHANNEL
,
1024 IEEE80211_QUEUE_STOP_REASON_FLUSH
,
1025 IEEE80211_QUEUE_STOP_REASON_TDLS_TEARDOWN
,
1026 IEEE80211_QUEUE_STOP_REASON_RESERVE_TID
,
1028 IEEE80211_QUEUE_STOP_REASONS
,
1031 #ifdef CONFIG_MAC80211_LEDS
1032 struct tpt_led_trigger
{
1033 struct led_trigger trig
;
1035 const struct ieee80211_tpt_blink
*blink_table
;
1036 unsigned int blink_table_len
;
1037 struct timer_list timer
;
1038 unsigned long prev_traffic
;
1039 unsigned long tx_bytes
, rx_bytes
;
1040 unsigned int active
, want
;
1046 * struct ieee80211_tx_latency_bin_ranges - Tx latency statistics bins ranges
1048 * Measuring Tx latency statistics. Counts how many Tx frames transmitted in a
1049 * certain latency range (in Milliseconds). Each station that uses these
1050 * ranges will have bins to count the amount of frames received in that range.
1051 * The user can configure the ranges via debugfs.
1052 * If ranges is NULL then Tx latency statistics bins are disabled for all
1055 * @n_ranges: number of ranges that are taken in account
1056 * @ranges: the ranges that the user requested or NULL if disabled.
1058 struct ieee80211_tx_latency_bin_ranges
{
1064 * mac80211 scan flags - currently active scan mode
1066 * @SCAN_SW_SCANNING: We're currently in the process of scanning but may as
1067 * well be on the operating channel
1068 * @SCAN_HW_SCANNING: The hardware is scanning for us, we have no way to
1069 * determine if we are on the operating channel or not
1070 * @SCAN_ONCHANNEL_SCANNING: Do a software scan on only the current operating
1071 * channel. This should not interrupt normal traffic.
1072 * @SCAN_COMPLETED: Set for our scan work function when the driver reported
1073 * that the scan completed.
1074 * @SCAN_ABORTED: Set for our scan work function when the driver reported
1075 * a scan complete for an aborted scan.
1076 * @SCAN_HW_CANCELLED: Set for our scan work function when the scan is being
1082 SCAN_ONCHANNEL_SCANNING
,
1089 * enum mac80211_scan_state - scan state machine states
1091 * @SCAN_DECISION: Main entry point to the scan state machine, this state
1092 * determines if we should keep on scanning or switch back to the
1094 * @SCAN_SET_CHANNEL: Set the next channel to be scanned
1095 * @SCAN_SEND_PROBE: Send probe requests and wait for probe responses
1096 * @SCAN_SUSPEND: Suspend the scan and go back to operating channel to
1098 * @SCAN_RESUME: Resume the scan and scan the next channel
1099 * @SCAN_ABORT: Abort the scan and go back to operating channel
1101 enum mac80211_scan_state
{
1110 struct ieee80211_local
{
1111 /* embed the driver visible part.
1112 * don't cast (use the static inlines below), but we keep
1113 * it first anyway so they become a no-op */
1114 struct ieee80211_hw hw
;
1116 const struct ieee80211_ops
*ops
;
1119 * private workqueue to mac80211. mac80211 makes this accessible
1120 * via ieee80211_queue_work()
1122 struct workqueue_struct
*workqueue
;
1124 unsigned long queue_stop_reasons
[IEEE80211_MAX_QUEUES
];
1125 int q_stop_reasons
[IEEE80211_MAX_QUEUES
][IEEE80211_QUEUE_STOP_REASONS
];
1126 /* also used to protect ampdu_ac_queue and amdpu_ac_stop_refcnt */
1127 spinlock_t queue_stop_reason_lock
;
1130 int monitors
, cooked_mntrs
;
1131 /* number of interfaces with corresponding FIF_ flags */
1132 int fif_fcsfail
, fif_plcpfail
, fif_control
, fif_other_bss
, fif_pspoll
,
1135 unsigned int filter_flags
; /* FIF_* */
1137 bool wiphy_ciphers_allocated
;
1141 /* protects the aggregated multicast list and filter calls */
1142 spinlock_t filter_lock
;
1144 /* used for uploading changed mc list */
1145 struct work_struct reconfig_filter
;
1147 /* aggregated multicast list */
1148 struct netdev_hw_addr_list mc_list
;
1150 bool tim_in_locked_section
; /* see ieee80211_beacon_get() */
1153 * suspended is true if we finished all the suspend _and_ we have
1154 * not yet come up from resume. This is to be used by mac80211
1155 * to ensure driver sanity during suspend and mac80211's own
1156 * sanity. It can eventually be used for WoW as well.
1161 * Resuming is true while suspended, but when we're reprogramming the
1162 * hardware -- at that time it's allowed to use ieee80211_queue_work()
1163 * again even though some other parts of the stack are still suspended
1164 * and we still drop received frames to avoid waking the stack.
1169 * quiescing is true during the suspend process _only_ to
1170 * ease timer cancelling etc.
1174 /* device is started */
1177 /* device is during a HW reconfig */
1180 /* wowlan is enabled -- don't reconfig on resume */
1183 struct work_struct radar_detected_work
;
1185 /* number of RX chains the hardware has */
1188 int tx_headroom
; /* required headroom for hardware/radiotap */
1190 /* Tasklet and skb queue to process calls from IRQ mode. All frames
1191 * added to skb_queue will be processed, but frames in
1192 * skb_queue_unreliable may be dropped if the total length of these
1193 * queues increases over the limit. */
1194 #define IEEE80211_IRQSAFE_QUEUE_LIMIT 128
1195 struct tasklet_struct tasklet
;
1196 struct sk_buff_head skb_queue
;
1197 struct sk_buff_head skb_queue_unreliable
;
1199 spinlock_t rx_path_lock
;
1203 * The mutex only protects the list, hash table and
1204 * counter, reads are done with RCU.
1206 struct mutex sta_mtx
;
1207 spinlock_t tim_lock
;
1208 unsigned long num_sta
;
1209 struct list_head sta_list
;
1210 struct sta_info __rcu
*sta_hash
[STA_HASH_SIZE
];
1211 struct timer_list sta_cleanup
;
1215 * Tx latency statistics parameters for all stations.
1216 * Can enable via debugfs (NULL when disabled).
1218 struct ieee80211_tx_latency_bin_ranges __rcu
*tx_latency
;
1220 struct sk_buff_head pending
[IEEE80211_MAX_QUEUES
];
1221 struct tasklet_struct tx_pending_tasklet
;
1223 atomic_t agg_queue_stop
[IEEE80211_MAX_QUEUES
];
1225 /* number of interfaces with corresponding IFF_ flags */
1226 atomic_t iff_allmultis
, iff_promiscs
;
1228 struct rate_control_ref
*rate_ctrl
;
1230 struct crypto_cipher
*wep_tx_tfm
;
1231 struct crypto_cipher
*wep_rx_tfm
;
1235 struct list_head interfaces
;
1236 struct mutex iflist_mtx
;
1239 * Key mutex, protects sdata's key_list and sta_info's
1240 * key pointers (write access, they're RCU.)
1242 struct mutex key_mtx
;
1244 /* mutex for scan and work locking */
1247 /* Scanning and BSS list */
1248 unsigned long scanning
;
1249 struct cfg80211_ssid scan_ssid
;
1250 struct cfg80211_scan_request
*int_scan_req
;
1251 struct cfg80211_scan_request __rcu
*scan_req
;
1252 struct ieee80211_scan_request
*hw_scan_req
;
1253 struct cfg80211_chan_def scan_chandef
;
1254 enum ieee80211_band hw_scan_band
;
1255 int scan_channel_idx
;
1257 int hw_scan_ies_bufsize
;
1259 struct work_struct sched_scan_stopped_work
;
1260 struct ieee80211_sub_if_data __rcu
*sched_scan_sdata
;
1261 struct cfg80211_sched_scan_request __rcu
*sched_scan_req
;
1262 u8 scan_addr
[ETH_ALEN
];
1264 unsigned long leave_oper_channel_time
;
1265 enum mac80211_scan_state next_scan_state
;
1266 struct delayed_work scan_work
;
1267 struct ieee80211_sub_if_data __rcu
*scan_sdata
;
1268 /* For backward compatibility only -- do not use */
1269 struct cfg80211_chan_def _oper_chandef
;
1271 /* Temporary remain-on-channel for off-channel operations */
1272 struct ieee80211_channel
*tmp_channel
;
1274 /* channel contexts */
1275 struct list_head chanctx_list
;
1276 struct mutex chanctx_mtx
;
1279 /* dot11CountersTable */
1280 u32 dot11TransmittedFragmentCount
;
1281 u32 dot11MulticastTransmittedFrameCount
;
1282 u32 dot11FailedCount
;
1283 u32 dot11RetryCount
;
1284 u32 dot11MultipleRetryCount
;
1285 u32 dot11FrameDuplicateCount
;
1286 u32 dot11ReceivedFragmentCount
;
1287 u32 dot11MulticastReceivedFrameCount
;
1288 u32 dot11TransmittedFrameCount
;
1290 #ifdef CONFIG_MAC80211_LEDS
1291 struct led_trigger
*tx_led
, *rx_led
, *assoc_led
, *radio_led
;
1292 struct tpt_led_trigger
*tpt_led_trigger
;
1293 char tx_led_name
[32], rx_led_name
[32],
1294 assoc_led_name
[32], radio_led_name
[32];
1297 #ifdef CONFIG_MAC80211_DEBUG_COUNTERS
1298 /* TX/RX handler statistics */
1299 unsigned int tx_handlers_drop
;
1300 unsigned int tx_handlers_queued
;
1301 unsigned int tx_handlers_drop_unencrypted
;
1302 unsigned int tx_handlers_drop_fragment
;
1303 unsigned int tx_handlers_drop_wep
;
1304 unsigned int tx_handlers_drop_not_assoc
;
1305 unsigned int tx_handlers_drop_unauth_port
;
1306 unsigned int rx_handlers_drop
;
1307 unsigned int rx_handlers_queued
;
1308 unsigned int rx_handlers_drop_nullfunc
;
1309 unsigned int rx_handlers_drop_defrag
;
1310 unsigned int rx_handlers_drop_short
;
1311 unsigned int tx_expand_skb_head
;
1312 unsigned int tx_expand_skb_head_cloned
;
1313 unsigned int rx_expand_skb_head
;
1314 unsigned int rx_expand_skb_head2
;
1315 unsigned int rx_handlers_fragments
;
1316 unsigned int tx_status_drop
;
1317 #define I802_DEBUG_INC(c) (c)++
1318 #else /* CONFIG_MAC80211_DEBUG_COUNTERS */
1319 #define I802_DEBUG_INC(c) do { } while (0)
1320 #endif /* CONFIG_MAC80211_DEBUG_COUNTERS */
1323 int total_ps_buffered
; /* total number of all buffered unicast and
1324 * multicast packets for power saving stations
1328 bool offchannel_ps_enabled
;
1330 * PS can only be enabled when we have exactly one managed
1331 * interface (and monitors) in PS, this then points there.
1333 struct ieee80211_sub_if_data
*ps_sdata
;
1334 struct work_struct dynamic_ps_enable_work
;
1335 struct work_struct dynamic_ps_disable_work
;
1336 struct timer_list dynamic_ps_timer
;
1337 struct notifier_block network_latency_notifier
;
1338 struct notifier_block ifa_notifier
;
1339 struct notifier_block ifa6_notifier
;
1342 * The dynamic ps timeout configured from user space via WEXT -
1343 * this will override whatever chosen by mac80211 internally.
1345 int dynamic_ps_forced_timeout
;
1347 int user_power_level
; /* in dBm, for all interfaces */
1349 enum ieee80211_smps_mode smps_mode
;
1351 struct work_struct restart_work
;
1353 #ifdef CONFIG_MAC80211_DEBUGFS
1354 struct local_debugfsdentries
{
1355 struct dentry
*rcdir
;
1356 struct dentry
*keys
;
1361 * Remain-on-channel support
1363 struct list_head roc_list
;
1364 struct work_struct hw_roc_start
, hw_roc_done
;
1365 unsigned long hw_roc_start_time
;
1366 u64 roc_cookie_counter
;
1368 struct idr ack_status_frames
;
1369 spinlock_t ack_status_lock
;
1371 struct ieee80211_sub_if_data __rcu
*p2p_sdata
;
1373 struct napi_struct
*napi
;
1375 /* virtual monitor interface */
1376 struct ieee80211_sub_if_data __rcu
*monitor_sdata
;
1377 struct cfg80211_chan_def monitor_chandef
;
1379 /* extended capabilities provided by mac80211 */
1383 static inline struct ieee80211_sub_if_data
*
1384 IEEE80211_DEV_TO_SUB_IF(struct net_device
*dev
)
1386 return netdev_priv(dev
);
1389 static inline struct ieee80211_sub_if_data
*
1390 IEEE80211_WDEV_TO_SUB_IF(struct wireless_dev
*wdev
)
1392 return container_of(wdev
, struct ieee80211_sub_if_data
, wdev
);
1395 /* this struct represents 802.11n's RA/TID combination */
1396 struct ieee80211_ra_tid
{
1401 /* this struct holds the value parsing from channel switch IE */
1402 struct ieee80211_csa_ie
{
1403 struct cfg80211_chan_def chandef
;
1410 /* Parsed Information Elements */
1411 struct ieee802_11_elems
{
1415 /* pointers to IEs */
1416 const struct ieee80211_tdls_lnkie
*lnk_id
;
1417 const struct ieee80211_ch_switch_timing
*ch_sw_timing
;
1418 const u8
*ext_capab
;
1420 const u8
*supp_rates
;
1421 const u8
*ds_params
;
1422 const struct ieee80211_tim_ie
*tim
;
1423 const u8
*challenge
;
1426 const u8
*ext_supp_rates
;
1428 const u8
*wmm_param
;
1429 const struct ieee80211_ht_cap
*ht_cap_elem
;
1430 const struct ieee80211_ht_operation
*ht_operation
;
1431 const struct ieee80211_vht_cap
*vht_cap_elem
;
1432 const struct ieee80211_vht_operation
*vht_operation
;
1433 const struct ieee80211_meshconf_ie
*mesh_config
;
1436 const __le16
*awake_window
;
1440 const struct ieee80211_rann_ie
*rann
;
1441 const struct ieee80211_channel_sw_ie
*ch_switch_ie
;
1442 const struct ieee80211_ext_chansw_ie
*ext_chansw_ie
;
1443 const struct ieee80211_wide_bw_chansw_ie
*wide_bw_chansw_ie
;
1444 const u8
*country_elem
;
1445 const u8
*pwr_constr_elem
;
1446 const u8
*cisco_dtpc_elem
;
1447 const struct ieee80211_timeout_interval_ie
*timeout_int
;
1448 const u8
*opmode_notif
;
1449 const struct ieee80211_sec_chan_offs_ie
*sec_chan_offs
;
1450 const struct ieee80211_mesh_chansw_params_ie
*mesh_chansw_params_ie
;
1452 /* length of them, respectively */
1459 u8 ext_supp_rates_len
;
1467 u8 country_elem_len
;
1469 /* whether a parse error occurred while retrieving these elements */
1473 static inline struct ieee80211_local
*hw_to_local(
1474 struct ieee80211_hw
*hw
)
1476 return container_of(hw
, struct ieee80211_local
, hw
);
1480 static inline int ieee80211_bssid_match(const u8
*raddr
, const u8
*addr
)
1482 return ether_addr_equal(raddr
, addr
) ||
1483 is_broadcast_ether_addr(raddr
);
1487 ieee80211_have_rx_timestamp(struct ieee80211_rx_status
*status
)
1489 WARN_ON_ONCE(status
->flag
& RX_FLAG_MACTIME_START
&&
1490 status
->flag
& RX_FLAG_MACTIME_END
);
1491 return status
->flag
& (RX_FLAG_MACTIME_START
| RX_FLAG_MACTIME_END
);
1494 u64
ieee80211_calculate_rx_timestamp(struct ieee80211_local
*local
,
1495 struct ieee80211_rx_status
*status
,
1496 unsigned int mpdu_len
,
1497 unsigned int mpdu_offset
);
1498 int ieee80211_hw_config(struct ieee80211_local
*local
, u32 changed
);
1499 void ieee80211_tx_set_protected(struct ieee80211_tx_data
*tx
);
1500 void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data
*sdata
,
1502 void ieee80211_configure_filter(struct ieee80211_local
*local
);
1503 u32
ieee80211_reset_erp_info(struct ieee80211_sub_if_data
*sdata
);
1506 void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data
*sdata
);
1507 int ieee80211_mgd_auth(struct ieee80211_sub_if_data
*sdata
,
1508 struct cfg80211_auth_request
*req
);
1509 int ieee80211_mgd_assoc(struct ieee80211_sub_if_data
*sdata
,
1510 struct cfg80211_assoc_request
*req
);
1511 int ieee80211_mgd_deauth(struct ieee80211_sub_if_data
*sdata
,
1512 struct cfg80211_deauth_request
*req
);
1513 int ieee80211_mgd_disassoc(struct ieee80211_sub_if_data
*sdata
,
1514 struct cfg80211_disassoc_request
*req
);
1515 void ieee80211_send_pspoll(struct ieee80211_local
*local
,
1516 struct ieee80211_sub_if_data
*sdata
);
1517 void ieee80211_recalc_ps(struct ieee80211_local
*local
, s32 latency
);
1518 void ieee80211_recalc_ps_vif(struct ieee80211_sub_if_data
*sdata
);
1519 int ieee80211_max_network_latency(struct notifier_block
*nb
,
1520 unsigned long data
, void *dummy
);
1521 int ieee80211_set_arp_filter(struct ieee80211_sub_if_data
*sdata
);
1522 void ieee80211_sta_work(struct ieee80211_sub_if_data
*sdata
);
1523 void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data
*sdata
,
1524 struct sk_buff
*skb
);
1525 void ieee80211_sta_reset_beacon_monitor(struct ieee80211_sub_if_data
*sdata
);
1526 void ieee80211_sta_reset_conn_monitor(struct ieee80211_sub_if_data
*sdata
);
1527 void ieee80211_mgd_stop(struct ieee80211_sub_if_data
*sdata
);
1528 void ieee80211_mgd_conn_tx_status(struct ieee80211_sub_if_data
*sdata
,
1529 __le16 fc
, bool acked
);
1530 void ieee80211_mgd_quiesce(struct ieee80211_sub_if_data
*sdata
);
1531 void ieee80211_sta_restart(struct ieee80211_sub_if_data
*sdata
);
1532 void ieee80211_sta_handle_tspec_ac_params(struct ieee80211_sub_if_data
*sdata
);
1535 void ieee80211_ibss_notify_scan_completed(struct ieee80211_local
*local
);
1536 void ieee80211_ibss_setup_sdata(struct ieee80211_sub_if_data
*sdata
);
1537 void ieee80211_ibss_rx_no_sta(struct ieee80211_sub_if_data
*sdata
,
1538 const u8
*bssid
, const u8
*addr
, u32 supp_rates
);
1539 int ieee80211_ibss_join(struct ieee80211_sub_if_data
*sdata
,
1540 struct cfg80211_ibss_params
*params
);
1541 int ieee80211_ibss_leave(struct ieee80211_sub_if_data
*sdata
);
1542 void ieee80211_ibss_work(struct ieee80211_sub_if_data
*sdata
);
1543 void ieee80211_ibss_rx_queued_mgmt(struct ieee80211_sub_if_data
*sdata
,
1544 struct sk_buff
*skb
);
1545 int ieee80211_ibss_csa_beacon(struct ieee80211_sub_if_data
*sdata
,
1546 struct cfg80211_csa_settings
*csa_settings
);
1547 int ieee80211_ibss_finish_csa(struct ieee80211_sub_if_data
*sdata
);
1548 void ieee80211_ibss_stop(struct ieee80211_sub_if_data
*sdata
);
1551 void ieee80211_ocb_work(struct ieee80211_sub_if_data
*sdata
);
1552 void ieee80211_ocb_rx_no_sta(struct ieee80211_sub_if_data
*sdata
,
1553 const u8
*bssid
, const u8
*addr
, u32 supp_rates
);
1554 void ieee80211_ocb_setup_sdata(struct ieee80211_sub_if_data
*sdata
);
1555 int ieee80211_ocb_join(struct ieee80211_sub_if_data
*sdata
,
1556 struct ocb_setup
*setup
);
1557 int ieee80211_ocb_leave(struct ieee80211_sub_if_data
*sdata
);
1560 void ieee80211_mesh_work(struct ieee80211_sub_if_data
*sdata
);
1561 void ieee80211_mesh_rx_queued_mgmt(struct ieee80211_sub_if_data
*sdata
,
1562 struct sk_buff
*skb
);
1563 int ieee80211_mesh_csa_beacon(struct ieee80211_sub_if_data
*sdata
,
1564 struct cfg80211_csa_settings
*csa_settings
);
1565 int ieee80211_mesh_finish_csa(struct ieee80211_sub_if_data
*sdata
);
1567 /* scan/BSS handling */
1568 void ieee80211_scan_work(struct work_struct
*work
);
1569 int ieee80211_request_ibss_scan(struct ieee80211_sub_if_data
*sdata
,
1570 const u8
*ssid
, u8 ssid_len
,
1571 struct ieee80211_channel
*chan
,
1572 enum nl80211_bss_scan_width scan_width
);
1573 int ieee80211_request_scan(struct ieee80211_sub_if_data
*sdata
,
1574 struct cfg80211_scan_request
*req
);
1575 void ieee80211_scan_cancel(struct ieee80211_local
*local
);
1576 void ieee80211_run_deferred_scan(struct ieee80211_local
*local
);
1577 void ieee80211_scan_rx(struct ieee80211_local
*local
, struct sk_buff
*skb
);
1579 void ieee80211_mlme_notify_scan_completed(struct ieee80211_local
*local
);
1580 struct ieee80211_bss
*
1581 ieee80211_bss_info_update(struct ieee80211_local
*local
,
1582 struct ieee80211_rx_status
*rx_status
,
1583 struct ieee80211_mgmt
*mgmt
,
1585 struct ieee802_11_elems
*elems
,
1586 struct ieee80211_channel
*channel
);
1587 void ieee80211_rx_bss_put(struct ieee80211_local
*local
,
1588 struct ieee80211_bss
*bss
);
1590 /* scheduled scan handling */
1592 __ieee80211_request_sched_scan_start(struct ieee80211_sub_if_data
*sdata
,
1593 struct cfg80211_sched_scan_request
*req
);
1594 int ieee80211_request_sched_scan_start(struct ieee80211_sub_if_data
*sdata
,
1595 struct cfg80211_sched_scan_request
*req
);
1596 int ieee80211_request_sched_scan_stop(struct ieee80211_sub_if_data
*sdata
);
1597 void ieee80211_sched_scan_end(struct ieee80211_local
*local
);
1598 void ieee80211_sched_scan_stopped_work(struct work_struct
*work
);
1600 /* off-channel helpers */
1601 void ieee80211_offchannel_stop_vifs(struct ieee80211_local
*local
);
1602 void ieee80211_offchannel_return(struct ieee80211_local
*local
);
1603 void ieee80211_roc_setup(struct ieee80211_local
*local
);
1604 void ieee80211_start_next_roc(struct ieee80211_local
*local
);
1605 void ieee80211_roc_purge(struct ieee80211_local
*local
,
1606 struct ieee80211_sub_if_data
*sdata
);
1607 void ieee80211_roc_notify_destroy(struct ieee80211_roc_work
*roc
, bool free
);
1608 void ieee80211_sw_roc_work(struct work_struct
*work
);
1609 void ieee80211_handle_roc_started(struct ieee80211_roc_work
*roc
);
1611 /* channel switch handling */
1612 void ieee80211_csa_finalize_work(struct work_struct
*work
);
1613 int ieee80211_channel_switch(struct wiphy
*wiphy
, struct net_device
*dev
,
1614 struct cfg80211_csa_settings
*params
);
1616 /* interface handling */
1617 int ieee80211_iface_init(void);
1618 void ieee80211_iface_exit(void);
1619 int ieee80211_if_add(struct ieee80211_local
*local
, const char *name
,
1620 struct wireless_dev
**new_wdev
, enum nl80211_iftype type
,
1621 struct vif_params
*params
);
1622 int ieee80211_if_change_type(struct ieee80211_sub_if_data
*sdata
,
1623 enum nl80211_iftype type
);
1624 void ieee80211_if_remove(struct ieee80211_sub_if_data
*sdata
);
1625 void ieee80211_remove_interfaces(struct ieee80211_local
*local
);
1626 u32
ieee80211_idle_off(struct ieee80211_local
*local
);
1627 void ieee80211_recalc_idle(struct ieee80211_local
*local
);
1628 void ieee80211_adjust_monitor_flags(struct ieee80211_sub_if_data
*sdata
,
1630 int ieee80211_do_open(struct wireless_dev
*wdev
, bool coming_up
);
1631 void ieee80211_sdata_stop(struct ieee80211_sub_if_data
*sdata
);
1632 int ieee80211_add_virtual_monitor(struct ieee80211_local
*local
);
1633 void ieee80211_del_virtual_monitor(struct ieee80211_local
*local
);
1635 bool __ieee80211_recalc_txpower(struct ieee80211_sub_if_data
*sdata
);
1636 void ieee80211_recalc_txpower(struct ieee80211_sub_if_data
*sdata
,
1639 static inline bool ieee80211_sdata_running(struct ieee80211_sub_if_data
*sdata
)
1641 return test_bit(SDATA_STATE_RUNNING
, &sdata
->state
);
1645 void ieee80211_clear_tx_pending(struct ieee80211_local
*local
);
1646 void ieee80211_tx_pending(unsigned long data
);
1647 netdev_tx_t
ieee80211_monitor_start_xmit(struct sk_buff
*skb
,
1648 struct net_device
*dev
);
1649 netdev_tx_t
ieee80211_subif_start_xmit(struct sk_buff
*skb
,
1650 struct net_device
*dev
);
1651 void __ieee80211_subif_start_xmit(struct sk_buff
*skb
,
1652 struct net_device
*dev
,
1654 void ieee80211_purge_tx_queue(struct ieee80211_hw
*hw
,
1655 struct sk_buff_head
*skbs
);
1657 ieee80211_build_data_template(struct ieee80211_sub_if_data
*sdata
,
1658 struct sk_buff
*skb
, u32 info_flags
);
1661 void ieee80211_apply_htcap_overrides(struct ieee80211_sub_if_data
*sdata
,
1662 struct ieee80211_sta_ht_cap
*ht_cap
);
1663 bool ieee80211_ht_cap_ie_to_sta_ht_cap(struct ieee80211_sub_if_data
*sdata
,
1664 struct ieee80211_supported_band
*sband
,
1665 const struct ieee80211_ht_cap
*ht_cap_ie
,
1666 struct sta_info
*sta
);
1667 void ieee80211_send_delba(struct ieee80211_sub_if_data
*sdata
,
1668 const u8
*da
, u16 tid
,
1669 u16 initiator
, u16 reason_code
);
1670 int ieee80211_send_smps_action(struct ieee80211_sub_if_data
*sdata
,
1671 enum ieee80211_smps_mode smps
, const u8
*da
,
1673 void ieee80211_request_smps_ap_work(struct work_struct
*work
);
1674 void ieee80211_request_smps_mgd_work(struct work_struct
*work
);
1675 bool ieee80211_smps_is_restrictive(enum ieee80211_smps_mode smps_mode_old
,
1676 enum ieee80211_smps_mode smps_mode_new
);
1678 void ___ieee80211_stop_rx_ba_session(struct sta_info
*sta
, u16 tid
,
1679 u16 initiator
, u16 reason
, bool stop
);
1680 void __ieee80211_stop_rx_ba_session(struct sta_info
*sta
, u16 tid
,
1681 u16 initiator
, u16 reason
, bool stop
);
1682 void __ieee80211_start_rx_ba_session(struct sta_info
*sta
,
1683 u8 dialog_token
, u16 timeout
,
1684 u16 start_seq_num
, u16 ba_policy
, u16 tid
,
1685 u16 buf_size
, bool tx
, bool auto_seq
);
1686 void ieee80211_sta_tear_down_BA_sessions(struct sta_info
*sta
,
1687 enum ieee80211_agg_stop_reason reason
);
1688 void ieee80211_process_delba(struct ieee80211_sub_if_data
*sdata
,
1689 struct sta_info
*sta
,
1690 struct ieee80211_mgmt
*mgmt
, size_t len
);
1691 void ieee80211_process_addba_resp(struct ieee80211_local
*local
,
1692 struct sta_info
*sta
,
1693 struct ieee80211_mgmt
*mgmt
,
1695 void ieee80211_process_addba_request(struct ieee80211_local
*local
,
1696 struct sta_info
*sta
,
1697 struct ieee80211_mgmt
*mgmt
,
1700 int __ieee80211_stop_tx_ba_session(struct sta_info
*sta
, u16 tid
,
1701 enum ieee80211_agg_stop_reason reason
);
1702 int ___ieee80211_stop_tx_ba_session(struct sta_info
*sta
, u16 tid
,
1703 enum ieee80211_agg_stop_reason reason
);
1704 void ieee80211_start_tx_ba_cb(struct ieee80211_vif
*vif
, u8
*ra
, u16 tid
);
1705 void ieee80211_stop_tx_ba_cb(struct ieee80211_vif
*vif
, u8
*ra
, u8 tid
);
1706 void ieee80211_ba_session_work(struct work_struct
*work
);
1707 void ieee80211_tx_ba_session_handle_start(struct sta_info
*sta
, int tid
);
1708 void ieee80211_release_reorder_timeout(struct sta_info
*sta
, int tid
);
1710 u8
ieee80211_mcs_to_chains(const struct ieee80211_mcs_info
*mcs
);
1714 ieee80211_vht_cap_ie_to_sta_vht_cap(struct ieee80211_sub_if_data
*sdata
,
1715 struct ieee80211_supported_band
*sband
,
1716 const struct ieee80211_vht_cap
*vht_cap_ie
,
1717 struct sta_info
*sta
);
1718 enum ieee80211_sta_rx_bandwidth
ieee80211_sta_cap_rx_bw(struct sta_info
*sta
);
1719 enum ieee80211_sta_rx_bandwidth
ieee80211_sta_cur_vht_bw(struct sta_info
*sta
);
1720 void ieee80211_sta_set_rx_nss(struct sta_info
*sta
);
1721 u32
__ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data
*sdata
,
1722 struct sta_info
*sta
, u8 opmode
,
1723 enum ieee80211_band band
, bool nss_only
);
1724 void ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data
*sdata
,
1725 struct sta_info
*sta
, u8 opmode
,
1726 enum ieee80211_band band
, bool nss_only
);
1727 void ieee80211_apply_vhtcap_overrides(struct ieee80211_sub_if_data
*sdata
,
1728 struct ieee80211_sta_vht_cap
*vht_cap
);
1730 /* Spectrum management */
1731 void ieee80211_process_measurement_req(struct ieee80211_sub_if_data
*sdata
,
1732 struct ieee80211_mgmt
*mgmt
,
1735 * ieee80211_parse_ch_switch_ie - parses channel switch IEs
1736 * @sdata: the sdata of the interface which has received the frame
1737 * @elems: parsed 802.11 elements received with the frame
1738 * @current_band: indicates the current band
1739 * @sta_flags: contains information about own capabilities and restrictions
1740 * to decide which channel switch announcements can be accepted. Only the
1741 * following subset of &enum ieee80211_sta_flags are evaluated:
1742 * %IEEE80211_STA_DISABLE_HT, %IEEE80211_STA_DISABLE_VHT,
1743 * %IEEE80211_STA_DISABLE_40MHZ, %IEEE80211_STA_DISABLE_80P80MHZ,
1744 * %IEEE80211_STA_DISABLE_160MHZ.
1745 * @bssid: the currently connected bssid (for reporting)
1746 * @csa_ie: parsed 802.11 csa elements on count, mode, chandef and mesh ttl.
1747 All of them will be filled with if success only.
1748 * Return: 0 on success, <0 on error and >0 if there is nothing to parse.
1750 int ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data
*sdata
,
1751 struct ieee802_11_elems
*elems
,
1752 enum ieee80211_band current_band
,
1753 u32 sta_flags
, u8
*bssid
,
1754 struct ieee80211_csa_ie
*csa_ie
);
1756 /* Suspend/resume and hw reconfiguration */
1757 int ieee80211_reconfig(struct ieee80211_local
*local
);
1758 void ieee80211_stop_device(struct ieee80211_local
*local
);
1760 int __ieee80211_suspend(struct ieee80211_hw
*hw
,
1761 struct cfg80211_wowlan
*wowlan
);
1763 static inline int __ieee80211_resume(struct ieee80211_hw
*hw
)
1765 struct ieee80211_local
*local
= hw_to_local(hw
);
1767 WARN(test_bit(SCAN_HW_SCANNING
, &local
->scanning
) &&
1768 !test_bit(SCAN_COMPLETED
, &local
->scanning
),
1769 "%s: resume with hardware scan still in progress\n",
1770 wiphy_name(hw
->wiphy
));
1772 return ieee80211_reconfig(hw_to_local(hw
));
1775 /* utility functions/constants */
1776 extern const void *const mac80211_wiphy_privid
; /* for wiphy privid */
1777 u8
*ieee80211_get_bssid(struct ieee80211_hdr
*hdr
, size_t len
,
1778 enum nl80211_iftype type
);
1779 int ieee80211_frame_duration(enum ieee80211_band band
, size_t len
,
1780 int rate
, int erp
, int short_preamble
,
1782 void mac80211_ev_michael_mic_failure(struct ieee80211_sub_if_data
*sdata
, int keyidx
,
1783 struct ieee80211_hdr
*hdr
, const u8
*tsc
,
1785 void ieee80211_set_wmm_default(struct ieee80211_sub_if_data
*sdata
,
1787 void ieee80211_xmit(struct ieee80211_sub_if_data
*sdata
, struct sk_buff
*skb
);
1789 void __ieee80211_tx_skb_tid_band(struct ieee80211_sub_if_data
*sdata
,
1790 struct sk_buff
*skb
, int tid
,
1791 enum ieee80211_band band
);
1794 ieee80211_tx_skb_tid_band(struct ieee80211_sub_if_data
*sdata
,
1795 struct sk_buff
*skb
, int tid
,
1796 enum ieee80211_band band
)
1799 __ieee80211_tx_skb_tid_band(sdata
, skb
, tid
, band
);
1803 static inline void ieee80211_tx_skb_tid(struct ieee80211_sub_if_data
*sdata
,
1804 struct sk_buff
*skb
, int tid
)
1806 struct ieee80211_chanctx_conf
*chanctx_conf
;
1809 chanctx_conf
= rcu_dereference(sdata
->vif
.chanctx_conf
);
1810 if (WARN_ON(!chanctx_conf
)) {
1816 __ieee80211_tx_skb_tid_band(sdata
, skb
, tid
,
1817 chanctx_conf
->def
.chan
->band
);
1821 static inline void ieee80211_tx_skb(struct ieee80211_sub_if_data
*sdata
,
1822 struct sk_buff
*skb
)
1824 /* Send all internal mgmt frames on VO. Accordingly set TID to 7. */
1825 ieee80211_tx_skb_tid(sdata
, skb
, 7);
1828 u32
ieee802_11_parse_elems_crc(const u8
*start
, size_t len
, bool action
,
1829 struct ieee802_11_elems
*elems
,
1830 u64 filter
, u32 crc
);
1831 static inline void ieee802_11_parse_elems(const u8
*start
, size_t len
,
1833 struct ieee802_11_elems
*elems
)
1835 ieee802_11_parse_elems_crc(start
, len
, action
, elems
, 0, 0);
1838 static inline bool ieee80211_rx_reorder_ready(struct sk_buff_head
*frames
)
1840 struct sk_buff
*tail
= skb_peek_tail(frames
);
1841 struct ieee80211_rx_status
*status
;
1846 status
= IEEE80211_SKB_RXCB(tail
);
1847 if (status
->flag
& RX_FLAG_AMSDU_MORE
)
1853 extern const int ieee802_1d_to_ac
[8];
1855 static inline int ieee80211_ac_from_tid(int tid
)
1857 return ieee802_1d_to_ac
[tid
& 7];
1860 void ieee80211_dynamic_ps_enable_work(struct work_struct
*work
);
1861 void ieee80211_dynamic_ps_disable_work(struct work_struct
*work
);
1862 void ieee80211_dynamic_ps_timer(unsigned long data
);
1863 void ieee80211_send_nullfunc(struct ieee80211_local
*local
,
1864 struct ieee80211_sub_if_data
*sdata
,
1866 void ieee80211_sta_rx_notify(struct ieee80211_sub_if_data
*sdata
,
1867 struct ieee80211_hdr
*hdr
);
1868 void ieee80211_sta_tx_notify(struct ieee80211_sub_if_data
*sdata
,
1869 struct ieee80211_hdr
*hdr
, bool ack
, u16 tx_time
);
1871 void ieee80211_wake_queues_by_reason(struct ieee80211_hw
*hw
,
1872 unsigned long queues
,
1873 enum queue_stop_reason reason
,
1875 void ieee80211_stop_vif_queues(struct ieee80211_local
*local
,
1876 struct ieee80211_sub_if_data
*sdata
,
1877 enum queue_stop_reason reason
);
1878 void ieee80211_wake_vif_queues(struct ieee80211_local
*local
,
1879 struct ieee80211_sub_if_data
*sdata
,
1880 enum queue_stop_reason reason
);
1881 void ieee80211_stop_queues_by_reason(struct ieee80211_hw
*hw
,
1882 unsigned long queues
,
1883 enum queue_stop_reason reason
,
1885 void ieee80211_wake_queue_by_reason(struct ieee80211_hw
*hw
, int queue
,
1886 enum queue_stop_reason reason
,
1888 void ieee80211_stop_queue_by_reason(struct ieee80211_hw
*hw
, int queue
,
1889 enum queue_stop_reason reason
,
1891 void ieee80211_propagate_queue_wake(struct ieee80211_local
*local
, int queue
);
1892 void ieee80211_add_pending_skb(struct ieee80211_local
*local
,
1893 struct sk_buff
*skb
);
1894 void ieee80211_add_pending_skbs(struct ieee80211_local
*local
,
1895 struct sk_buff_head
*skbs
);
1896 void ieee80211_flush_queues(struct ieee80211_local
*local
,
1897 struct ieee80211_sub_if_data
*sdata
, bool drop
);
1898 void __ieee80211_flush_queues(struct ieee80211_local
*local
,
1899 struct ieee80211_sub_if_data
*sdata
,
1900 unsigned int queues
, bool drop
);
1902 static inline bool ieee80211_can_run_worker(struct ieee80211_local
*local
)
1905 * If quiescing is set, we are racing with __ieee80211_suspend.
1906 * __ieee80211_suspend flushes the workers after setting quiescing,
1907 * and we check quiescing / suspended before enqueing new workers.
1908 * We should abort the worker to avoid the races below.
1910 if (local
->quiescing
)
1914 * We might already be suspended if the following scenario occurs:
1915 * __ieee80211_suspend Control path
1917 * if (local->quiescing)
1919 * local->quiescing = true;
1920 * flush_workqueue();
1922 * local->suspended = true;
1923 * local->quiescing = false;
1924 * worker starts running...
1926 if (local
->suspended
)
1932 void ieee80211_send_auth(struct ieee80211_sub_if_data
*sdata
,
1933 u16 transaction
, u16 auth_alg
, u16 status
,
1934 const u8
*extra
, size_t extra_len
, const u8
*bssid
,
1935 const u8
*da
, const u8
*key
, u8 key_len
, u8 key_idx
,
1937 void ieee80211_send_deauth_disassoc(struct ieee80211_sub_if_data
*sdata
,
1938 const u8
*bssid
, u16 stype
, u16 reason
,
1939 bool send_frame
, u8
*frame_buf
);
1940 int ieee80211_build_preq_ies(struct ieee80211_local
*local
, u8
*buffer
,
1942 struct ieee80211_scan_ies
*ie_desc
,
1943 const u8
*ie
, size_t ie_len
,
1944 u8 bands_used
, u32
*rate_masks
,
1945 struct cfg80211_chan_def
*chandef
);
1946 struct sk_buff
*ieee80211_build_probe_req(struct ieee80211_sub_if_data
*sdata
,
1947 const u8
*src
, const u8
*dst
,
1949 struct ieee80211_channel
*chan
,
1950 const u8
*ssid
, size_t ssid_len
,
1951 const u8
*ie
, size_t ie_len
,
1953 void ieee80211_send_probe_req(struct ieee80211_sub_if_data
*sdata
,
1954 const u8
*src
, const u8
*dst
,
1955 const u8
*ssid
, size_t ssid_len
,
1956 const u8
*ie
, size_t ie_len
,
1957 u32 ratemask
, bool directed
, u32 tx_flags
,
1958 struct ieee80211_channel
*channel
, bool scan
);
1960 u32
ieee80211_sta_get_rates(struct ieee80211_sub_if_data
*sdata
,
1961 struct ieee802_11_elems
*elems
,
1962 enum ieee80211_band band
, u32
*basic_rates
);
1963 int __ieee80211_request_smps_mgd(struct ieee80211_sub_if_data
*sdata
,
1964 enum ieee80211_smps_mode smps_mode
);
1965 int __ieee80211_request_smps_ap(struct ieee80211_sub_if_data
*sdata
,
1966 enum ieee80211_smps_mode smps_mode
);
1967 void ieee80211_recalc_smps(struct ieee80211_sub_if_data
*sdata
);
1968 void ieee80211_recalc_min_chandef(struct ieee80211_sub_if_data
*sdata
);
1970 size_t ieee80211_ie_split_ric(const u8
*ies
, size_t ielen
,
1971 const u8
*ids
, int n_ids
,
1972 const u8
*after_ric
, int n_after_ric
,
1974 size_t ieee80211_ie_split_vendor(const u8
*ies
, size_t ielen
, size_t offset
);
1975 u8
*ieee80211_ie_build_ht_cap(u8
*pos
, struct ieee80211_sta_ht_cap
*ht_cap
,
1977 u8
*ieee80211_ie_build_ht_oper(u8
*pos
, struct ieee80211_sta_ht_cap
*ht_cap
,
1978 const struct cfg80211_chan_def
*chandef
,
1980 u8
*ieee80211_ie_build_vht_cap(u8
*pos
, struct ieee80211_sta_vht_cap
*vht_cap
,
1982 int ieee80211_parse_bitrates(struct cfg80211_chan_def
*chandef
,
1983 const struct ieee80211_supported_band
*sband
,
1984 const u8
*srates
, int srates_len
, u32
*rates
);
1985 int ieee80211_add_srates_ie(struct ieee80211_sub_if_data
*sdata
,
1986 struct sk_buff
*skb
, bool need_basic
,
1987 enum ieee80211_band band
);
1988 int ieee80211_add_ext_srates_ie(struct ieee80211_sub_if_data
*sdata
,
1989 struct sk_buff
*skb
, bool need_basic
,
1990 enum ieee80211_band band
);
1991 u8
*ieee80211_add_wmm_info_ie(u8
*buf
, u8 qosinfo
);
1993 /* channel management */
1994 void ieee80211_ht_oper_to_chandef(struct ieee80211_channel
*control_chan
,
1995 const struct ieee80211_ht_operation
*ht_oper
,
1996 struct cfg80211_chan_def
*chandef
);
1997 u32
ieee80211_chandef_downgrade(struct cfg80211_chan_def
*c
);
2000 ieee80211_vif_use_channel(struct ieee80211_sub_if_data
*sdata
,
2001 const struct cfg80211_chan_def
*chandef
,
2002 enum ieee80211_chanctx_mode mode
);
2004 ieee80211_vif_reserve_chanctx(struct ieee80211_sub_if_data
*sdata
,
2005 const struct cfg80211_chan_def
*chandef
,
2006 enum ieee80211_chanctx_mode mode
,
2007 bool radar_required
);
2009 ieee80211_vif_use_reserved_context(struct ieee80211_sub_if_data
*sdata
);
2010 int ieee80211_vif_unreserve_chanctx(struct ieee80211_sub_if_data
*sdata
);
2013 ieee80211_vif_change_bandwidth(struct ieee80211_sub_if_data
*sdata
,
2014 const struct cfg80211_chan_def
*chandef
,
2016 void ieee80211_vif_release_channel(struct ieee80211_sub_if_data
*sdata
);
2017 void ieee80211_vif_vlan_copy_chanctx(struct ieee80211_sub_if_data
*sdata
);
2018 void ieee80211_vif_copy_chanctx_to_vlans(struct ieee80211_sub_if_data
*sdata
,
2020 int ieee80211_chanctx_refcount(struct ieee80211_local
*local
,
2021 struct ieee80211_chanctx
*ctx
);
2023 void ieee80211_recalc_smps_chanctx(struct ieee80211_local
*local
,
2024 struct ieee80211_chanctx
*chanctx
);
2025 void ieee80211_recalc_chanctx_min_def(struct ieee80211_local
*local
,
2026 struct ieee80211_chanctx
*ctx
);
2027 bool ieee80211_is_radar_required(struct ieee80211_local
*local
);
2029 void ieee80211_dfs_cac_timer(unsigned long data
);
2030 void ieee80211_dfs_cac_timer_work(struct work_struct
*work
);
2031 void ieee80211_dfs_cac_cancel(struct ieee80211_local
*local
);
2032 void ieee80211_dfs_radar_detected_work(struct work_struct
*work
);
2033 int ieee80211_send_action_csa(struct ieee80211_sub_if_data
*sdata
,
2034 struct cfg80211_csa_settings
*csa_settings
);
2036 bool ieee80211_cs_valid(const struct ieee80211_cipher_scheme
*cs
);
2037 bool ieee80211_cs_list_valid(const struct ieee80211_cipher_scheme
*cs
, int n
);
2038 const struct ieee80211_cipher_scheme
*
2039 ieee80211_cs_get(struct ieee80211_local
*local
, u32 cipher
,
2040 enum nl80211_iftype iftype
);
2041 int ieee80211_cs_headroom(struct ieee80211_local
*local
,
2042 struct cfg80211_crypto_settings
*crypto
,
2043 enum nl80211_iftype iftype
);
2044 void ieee80211_recalc_dtim(struct ieee80211_local
*local
,
2045 struct ieee80211_sub_if_data
*sdata
);
2046 int ieee80211_check_combinations(struct ieee80211_sub_if_data
*sdata
,
2047 const struct cfg80211_chan_def
*chandef
,
2048 enum ieee80211_chanctx_mode chanmode
,
2050 int ieee80211_max_num_channels(struct ieee80211_local
*local
);
2053 int ieee80211_tdls_mgmt(struct wiphy
*wiphy
, struct net_device
*dev
,
2054 const u8
*peer
, u8 action_code
, u8 dialog_token
,
2055 u16 status_code
, u32 peer_capability
,
2056 bool initiator
, const u8
*extra_ies
,
2057 size_t extra_ies_len
);
2058 int ieee80211_tdls_oper(struct wiphy
*wiphy
, struct net_device
*dev
,
2059 const u8
*peer
, enum nl80211_tdls_operation oper
);
2060 void ieee80211_tdls_peer_del_work(struct work_struct
*wk
);
2061 int ieee80211_tdls_channel_switch(struct wiphy
*wiphy
, struct net_device
*dev
,
2062 const u8
*addr
, u8 oper_class
,
2063 struct cfg80211_chan_def
*chandef
);
2064 void ieee80211_tdls_cancel_channel_switch(struct wiphy
*wiphy
,
2065 struct net_device
*dev
,
2067 void ieee80211_process_tdls_channel_switch(struct ieee80211_sub_if_data
*sdata
,
2068 struct sk_buff
*skb
);
2070 extern const struct ethtool_ops ieee80211_ethtool_ops
;
2072 #ifdef CONFIG_MAC80211_NOINLINE
2073 #define debug_noinline noinline
2075 #define debug_noinline
2078 #endif /* IEEE80211_I_H */