xref: /openbmc/linux/net/mac80211/ieee80211_i.h (revision 02945821)
1f0706e82SJiri Benc /*
2f0706e82SJiri Benc  * Copyright 2002-2005, Instant802 Networks, Inc.
3f0706e82SJiri Benc  * Copyright 2005, Devicescape Software, Inc.
4f0706e82SJiri Benc  * Copyright 2006-2007	Jiri Benc <jbenc@suse.cz>
5026331c4SJouni Malinen  * Copyright 2007-2010	Johannes Berg <johannes@sipsolutions.net>
6f0706e82SJiri Benc  *
7f0706e82SJiri Benc  * This program is free software; you can redistribute it and/or modify
8f0706e82SJiri Benc  * it under the terms of the GNU General Public License version 2 as
9f0706e82SJiri Benc  * published by the Free Software Foundation.
10f0706e82SJiri Benc  */
11f0706e82SJiri Benc 
12f0706e82SJiri Benc #ifndef IEEE80211_I_H
13f0706e82SJiri Benc #define IEEE80211_I_H
14f0706e82SJiri Benc 
15f0706e82SJiri Benc #include <linux/kernel.h>
16f0706e82SJiri Benc #include <linux/device.h>
17f0706e82SJiri Benc #include <linux/if_ether.h>
18f0706e82SJiri Benc #include <linux/interrupt.h>
19f0706e82SJiri Benc #include <linux/list.h>
20f0706e82SJiri Benc #include <linux/netdevice.h>
21f0706e82SJiri Benc #include <linux/skbuff.h>
22f0706e82SJiri Benc #include <linux/workqueue.h>
23f0706e82SJiri Benc #include <linux/types.h>
24f0706e82SJiri Benc #include <linux/spinlock.h>
25571ecf67SJohannes Berg #include <linux/etherdevice.h>
26e1e54068SJohannes Berg #include <linux/leds.h>
27a729cff8SJohannes Berg #include <linux/idr.h>
28fe7a5d5cSJohannes Berg #include <net/ieee80211_radiotap.h>
2993da9cc1Scolin@cozybit.com #include <net/cfg80211.h>
3051cb6db0SDavid S. Miller #include <net/mac80211.h>
312c8dccc7SJohannes Berg #include "key.h"
32f0706e82SJiri Benc #include "sta_info.h"
33f0706e82SJiri Benc 
349cfb0009SJohannes Berg struct ieee80211_local;
35f0706e82SJiri Benc 
36f0706e82SJiri Benc /* Maximum number of broadcast/multicast frames to buffer when some of the
37f0706e82SJiri Benc  * associated stations are using power saving. */
38f0706e82SJiri Benc #define AP_MAX_BC_BUFFER 128
39f0706e82SJiri Benc 
40f0706e82SJiri Benc /* Maximum number of frames buffered to all STAs, including multicast frames.
41f0706e82SJiri Benc  * Note: increasing this limit increases the potential memory requirement. Each
42f0706e82SJiri Benc  * frame can be up to about 2 kB long. */
43f0706e82SJiri Benc #define TOTAL_MAX_TX_BUFFER 512
44f0706e82SJiri Benc 
45f0706e82SJiri Benc /* Required encryption head and tailroom */
46f0706e82SJiri Benc #define IEEE80211_ENCRYPT_HEADROOM 8
47765cb46aSJouni Malinen #define IEEE80211_ENCRYPT_TAILROOM 18
48f0706e82SJiri Benc 
49f0706e82SJiri Benc /* IEEE 802.11 (Ch. 9.5 Defragmentation) requires support for concurrent
50f0706e82SJiri Benc  * reception of at least three fragmented frames. This limit can be increased
51f0706e82SJiri Benc  * by changing this define, at the cost of slower frame reassembly and
52f0706e82SJiri Benc  * increased memory use (about 2 kB of RAM per entry). */
53f0706e82SJiri Benc #define IEEE80211_FRAGMENT_MAX 4
54f0706e82SJiri Benc 
5520ad19d0SJohannes Berg #define TU_TO_EXP_TIME(x)	(jiffies + usecs_to_jiffies((x) * 1024))
5620ad19d0SJohannes Berg 
57ab13315aSKalle Valo #define IEEE80211_DEFAULT_UAPSD_QUEUES \
58ab13315aSKalle Valo 	(IEEE80211_WMM_IE_STA_QOSINFO_AC_BK |	\
59ab13315aSKalle Valo 	 IEEE80211_WMM_IE_STA_QOSINFO_AC_BE |	\
60ab13315aSKalle Valo 	 IEEE80211_WMM_IE_STA_QOSINFO_AC_VI |	\
61ab13315aSKalle Valo 	 IEEE80211_WMM_IE_STA_QOSINFO_AC_VO)
62ab13315aSKalle Valo 
63ab13315aSKalle Valo #define IEEE80211_DEFAULT_MAX_SP_LEN		\
64ab13315aSKalle Valo 	IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL
65ab13315aSKalle Valo 
66f0706e82SJiri Benc struct ieee80211_fragment_entry {
67f0706e82SJiri Benc 	unsigned long first_frag_time;
68f0706e82SJiri Benc 	unsigned int seq;
69f0706e82SJiri Benc 	unsigned int rx_queue;
70f0706e82SJiri Benc 	unsigned int last_frag;
71f0706e82SJiri Benc 	unsigned int extra_len;
72f0706e82SJiri Benc 	struct sk_buff_head skb_list;
73f0706e82SJiri Benc 	int ccmp; /* Whether fragments were encrypted with CCMP */
74f0706e82SJiri Benc 	u8 last_pn[6]; /* PN of the last fragment if CCMP was used */
75f0706e82SJiri Benc };
76f0706e82SJiri Benc 
77f0706e82SJiri Benc 
78c2b13452SJohannes Berg struct ieee80211_bss {
7900d3f14cSJohannes Berg 	/* don't want to look up all the time */
80056cdd59SJohannes Berg 	size_t ssid_len;
81f0706e82SJiri Benc 	u8 ssid[IEEE80211_MAX_SSID_LEN];
8200d3f14cSJohannes Berg 
8398f7dfd8SEmmanuel Grumbach 	u8 dtim_period;
8400d3f14cSJohannes Berg 
8543ac2ca3SJouni Malinen 	bool wmm_used;
86ab13315aSKalle Valo 	bool uapsd_supported;
8700d3f14cSJohannes Berg 
8800d3f14cSJohannes Berg 	unsigned long last_probe_resp;
8900d3f14cSJohannes Berg 
90ee385855SLuis Carlos Cobo #ifdef CONFIG_MAC80211_MESH
91ee385855SLuis Carlos Cobo 	u8 *mesh_id;
92ee385855SLuis Carlos Cobo 	size_t mesh_id_len;
9324736701SJohn W. Linville 	u8 *mesh_cfg;
94902acc78SJohannes Berg #endif
9500d3f14cSJohannes Berg 
96f0706e82SJiri Benc #define IEEE80211_MAX_SUPP_RATES 32
97f0706e82SJiri Benc 	u8 supp_rates[IEEE80211_MAX_SUPP_RATES];
98f0706e82SJiri Benc 	size_t supp_rates_len;
99f0706e82SJiri Benc 
10000d3f14cSJohannes Berg 	/*
10125985edcSLucas De Marchi 	 * During association, we save an ERP value from a probe response so
1025628221cSDaniel Drake 	 * that we can feed ERP info to the driver when handling the
1035628221cSDaniel Drake 	 * association completes. these fields probably won't be up-to-date
10400d3f14cSJohannes Berg 	 * otherwise, you probably don't want to use them.
10500d3f14cSJohannes Berg 	 */
10600d3f14cSJohannes Berg 	bool has_erp_value;
1075628221cSDaniel Drake 	u8 erp_value;
108f0706e82SJiri Benc };
109f0706e82SJiri Benc 
110c2b13452SJohannes Berg static inline u8 *bss_mesh_cfg(struct ieee80211_bss *bss)
111902acc78SJohannes Berg {
112902acc78SJohannes Berg #ifdef CONFIG_MAC80211_MESH
113902acc78SJohannes Berg 	return bss->mesh_cfg;
114902acc78SJohannes Berg #endif
115902acc78SJohannes Berg 	return NULL;
116902acc78SJohannes Berg }
117902acc78SJohannes Berg 
118c2b13452SJohannes Berg static inline u8 *bss_mesh_id(struct ieee80211_bss *bss)
119902acc78SJohannes Berg {
120902acc78SJohannes Berg #ifdef CONFIG_MAC80211_MESH
121902acc78SJohannes Berg 	return bss->mesh_id;
122902acc78SJohannes Berg #endif
123902acc78SJohannes Berg 	return NULL;
124902acc78SJohannes Berg }
125902acc78SJohannes Berg 
126c2b13452SJohannes Berg static inline u8 bss_mesh_id_len(struct ieee80211_bss *bss)
127902acc78SJohannes Berg {
128902acc78SJohannes Berg #ifdef CONFIG_MAC80211_MESH
129902acc78SJohannes Berg 	return bss->mesh_id_len;
130902acc78SJohannes Berg #endif
131902acc78SJohannes Berg 	return 0;
132902acc78SJohannes Berg }
133902acc78SJohannes Berg 
134f0706e82SJiri Benc 
1359ae54c84SJohannes Berg typedef unsigned __bitwise__ ieee80211_tx_result;
1369ae54c84SJohannes Berg #define TX_CONTINUE	((__force ieee80211_tx_result) 0u)
1379ae54c84SJohannes Berg #define TX_DROP		((__force ieee80211_tx_result) 1u)
1389ae54c84SJohannes Berg #define TX_QUEUED	((__force ieee80211_tx_result) 2u)
1399ae54c84SJohannes Berg 
1405cf121c3SJohannes Berg #define IEEE80211_TX_UNICAST		BIT(1)
1415cf121c3SJohannes Berg #define IEEE80211_TX_PS_BUFFERED	BIT(2)
1429ae54c84SJohannes Berg 
1435cf121c3SJohannes Berg struct ieee80211_tx_data {
144f0706e82SJiri Benc 	struct sk_buff *skb;
145f0706e82SJiri Benc 	struct ieee80211_local *local;
146f0706e82SJiri Benc 	struct ieee80211_sub_if_data *sdata;
147f0706e82SJiri Benc 	struct sta_info *sta;
148f0706e82SJiri Benc 	struct ieee80211_key *key;
1495cf121c3SJohannes Berg 
1508318d78aSJohannes Berg 	struct ieee80211_channel *channel;
151f0706e82SJiri Benc 
152056cdd59SJohannes Berg 	unsigned int flags;
1535cf121c3SJohannes Berg };
1545cf121c3SJohannes Berg 
1555cf121c3SJohannes Berg 
1565cf121c3SJohannes Berg typedef unsigned __bitwise__ ieee80211_rx_result;
1575cf121c3SJohannes Berg #define RX_CONTINUE		((__force ieee80211_rx_result) 0u)
1585cf121c3SJohannes Berg #define RX_DROP_UNUSABLE	((__force ieee80211_rx_result) 1u)
1595cf121c3SJohannes Berg #define RX_DROP_MONITOR		((__force ieee80211_rx_result) 2u)
1605cf121c3SJohannes Berg #define RX_QUEUED		((__force ieee80211_rx_result) 3u)
1615cf121c3SJohannes Berg 
162554891e6SJohannes Berg /**
163554891e6SJohannes Berg  * enum ieee80211_packet_rx_flags - packet RX flags
164554891e6SJohannes Berg  * @IEEE80211_RX_RA_MATCH: frame is destined to interface currently processed
165554891e6SJohannes Berg  *	(incl. multicast frames)
166554891e6SJohannes Berg  * @IEEE80211_RX_IN_SCAN: received while scanning
167554891e6SJohannes Berg  * @IEEE80211_RX_FRAGMENTED: fragmented frame
168554891e6SJohannes Berg  * @IEEE80211_RX_AMSDU: a-MSDU packet
169554891e6SJohannes Berg  * @IEEE80211_RX_MALFORMED_ACTION_FRM: action frame is malformed
1704cfda47bSChristian Lamparter  * @IEEE80211_RX_DEFERRED_RELEASE: frame was subjected to receive reordering
171554891e6SJohannes Berg  *
172554891e6SJohannes Berg  * These are per-frame flags that are attached to a frame in the
173554891e6SJohannes Berg  * @rx_flags field of &struct ieee80211_rx_status.
174554891e6SJohannes Berg  */
175554891e6SJohannes Berg enum ieee80211_packet_rx_flags {
176554891e6SJohannes Berg 	IEEE80211_RX_IN_SCAN			= BIT(0),
177554891e6SJohannes Berg 	IEEE80211_RX_RA_MATCH			= BIT(1),
178554891e6SJohannes Berg 	IEEE80211_RX_FRAGMENTED			= BIT(2),
179554891e6SJohannes Berg 	IEEE80211_RX_AMSDU			= BIT(3),
180554891e6SJohannes Berg 	IEEE80211_RX_MALFORMED_ACTION_FRM	= BIT(4),
1814cfda47bSChristian Lamparter 	IEEE80211_RX_DEFERRED_RELEASE		= BIT(5),
182554891e6SJohannes Berg };
183554891e6SJohannes Berg 
184554891e6SJohannes Berg /**
185554891e6SJohannes Berg  * enum ieee80211_rx_flags - RX data flags
186554891e6SJohannes Berg  *
187554891e6SJohannes Berg  * @IEEE80211_RX_CMNTR: received on cooked monitor already
188ee971924SJohannes Berg  * @IEEE80211_RX_BEACON_REPORTED: This frame was already reported
189ee971924SJohannes Berg  *	to cfg80211_report_obss_beacon().
190554891e6SJohannes Berg  *
191554891e6SJohannes Berg  * These flags are used across handling multiple interfaces
192554891e6SJohannes Berg  * for a single frame.
193554891e6SJohannes Berg  */
194554891e6SJohannes Berg enum ieee80211_rx_flags {
195554891e6SJohannes Berg 	IEEE80211_RX_CMNTR		= BIT(0),
196ee971924SJohannes Berg 	IEEE80211_RX_BEACON_REPORTED	= BIT(1),
197554891e6SJohannes Berg };
1985cf121c3SJohannes Berg 
1995cf121c3SJohannes Berg struct ieee80211_rx_data {
2005cf121c3SJohannes Berg 	struct sk_buff *skb;
2015cf121c3SJohannes Berg 	struct ieee80211_local *local;
2025cf121c3SJohannes Berg 	struct ieee80211_sub_if_data *sdata;
2035cf121c3SJohannes Berg 	struct sta_info *sta;
2045cf121c3SJohannes Berg 	struct ieee80211_key *key;
205056cdd59SJohannes Berg 
206056cdd59SJohannes Berg 	unsigned int flags;
2079e26297aSJohannes Berg 
2089e26297aSJohannes Berg 	/*
2099e26297aSJohannes Berg 	 * Index into sequence numbers array, 0..16
2109e26297aSJohannes Berg 	 * since the last (16) is used for non-QoS,
2119e26297aSJohannes Berg 	 * will be 16 on non-QoS frames.
2129e26297aSJohannes Berg 	 */
2139e26297aSJohannes Berg 	int seqno_idx;
2149e26297aSJohannes Berg 
2159e26297aSJohannes Berg 	/*
2169e26297aSJohannes Berg 	 * Index into the security IV/PN arrays, 0..16
2179e26297aSJohannes Berg 	 * since the last (16) is used for CCMP-encrypted
2189e26297aSJohannes Berg 	 * management frames, will be set to 16 on mgmt
2199e26297aSJohannes Berg 	 * frames and 0 on non-QoS frames.
2209e26297aSJohannes Berg 	 */
2219e26297aSJohannes Berg 	int security_idx;
2229e26297aSJohannes Berg 
22350741ae0SJohannes Berg 	u32 tkip_iv32;
22450741ae0SJohannes Berg 	u16 tkip_iv16;
225f0706e82SJiri Benc };
226f0706e82SJiri Benc 
2275dfdaf58SJohannes Berg struct beacon_data {
2285dfdaf58SJohannes Berg 	u8 *head, *tail;
2295dfdaf58SJohannes Berg 	int head_len, tail_len;
2305dfdaf58SJohannes Berg 	int dtim_period;
2315dfdaf58SJohannes Berg };
2325dfdaf58SJohannes Berg 
233f0706e82SJiri Benc struct ieee80211_if_ap {
23440b275b6SJohannes Berg 	struct beacon_data __rcu *beacon;
23502945821SArik Nemtsov 	struct sk_buff __rcu *probe_resp;
236f0706e82SJiri Benc 
2370ec3ca44SJohannes Berg 	struct list_head vlans;
2380ec3ca44SJohannes Berg 
239f0706e82SJiri Benc 	/* yes, this looks ugly, but guarantees that we can later use
240f0706e82SJiri Benc 	 * bitmap_empty :)
241004c872eSJohannes Berg 	 * NB: don't touch this bitmap, use sta_info_{set,clear}_tim_bit */
242f0706e82SJiri Benc 	u8 tim[sizeof(unsigned long) * BITS_TO_LONGS(IEEE80211_MAX_AID + 1)];
243f0706e82SJiri Benc 	struct sk_buff_head ps_bc_buf;
244056cdd59SJohannes Berg 	atomic_t num_sta_ps; /* number of stations in PS mode */
2455dfdaf58SJohannes Berg 	int dtim_count;
246512119b3SChristian Lamparter 	bool dtim_bc_mc;
247f0706e82SJiri Benc };
248f0706e82SJiri Benc 
249f0706e82SJiri Benc struct ieee80211_if_wds {
250f0706e82SJiri Benc 	struct sta_info *sta;
251056cdd59SJohannes Berg 	u8 remote_addr[ETH_ALEN];
252f0706e82SJiri Benc };
253f0706e82SJiri Benc 
254f0706e82SJiri Benc struct ieee80211_if_vlan {
2550ec3ca44SJohannes Berg 	struct list_head list;
256f14543eeSFelix Fietkau 
257f14543eeSFelix Fietkau 	/* used for all tx if the VLAN is configured to 4-addr mode */
25840b275b6SJohannes Berg 	struct sta_info __rcu *sta;
259f0706e82SJiri Benc };
260f0706e82SJiri Benc 
261ee385855SLuis Carlos Cobo struct mesh_stats {
262c8a61a7dSDaniel Walker 	__u32 fwded_mcast;		/* Mesh forwarded multicast frames */
263c8a61a7dSDaniel Walker 	__u32 fwded_unicast;		/* Mesh forwarded unicast frames */
264c8a61a7dSDaniel Walker 	__u32 fwded_frames;		/* Mesh total forwarded frames */
265ee385855SLuis Carlos Cobo 	__u32 dropped_frames_ttl;	/* Not transmitted since mesh_ttl == 0*/
266ee385855SLuis Carlos Cobo 	__u32 dropped_frames_no_route;	/* Not transmitted, no route found */
267cfee66b0SJavier Cardona 	__u32 dropped_frames_congestion;/* Not forwarded due to congestion */
268ee385855SLuis Carlos Cobo 	atomic_t estab_plinks;
269ee385855SLuis Carlos Cobo };
270ee385855SLuis Carlos Cobo 
271ee385855SLuis Carlos Cobo #define PREQ_Q_F_START		0x1
272ee385855SLuis Carlos Cobo #define PREQ_Q_F_REFRESH	0x2
273ee385855SLuis Carlos Cobo struct mesh_preq_queue {
274ee385855SLuis Carlos Cobo 	struct list_head list;
275ee385855SLuis Carlos Cobo 	u8 dst[ETH_ALEN];
276ee385855SLuis Carlos Cobo 	u8 flags;
277ee385855SLuis Carlos Cobo };
278ee385855SLuis Carlos Cobo 
279f679f65dSJohannes Berg enum ieee80211_work_type {
280b8bc4b0aSJohannes Berg 	IEEE80211_WORK_ABORT,
281af6b6374SJohannes Berg 	IEEE80211_WORK_DIRECT_PROBE,
282f679f65dSJohannes Berg 	IEEE80211_WORK_AUTH,
283e5b900d2SJohannes Berg 	IEEE80211_WORK_ASSOC_BEACON_WAIT,
284f679f65dSJohannes Berg 	IEEE80211_WORK_ASSOC,
285b8bc4b0aSJohannes Berg 	IEEE80211_WORK_REMAIN_ON_CHANNEL,
286f30221e4SJohannes Berg 	IEEE80211_WORK_OFFCHANNEL_TX,
28777fdaa12SJohannes Berg };
28877fdaa12SJohannes Berg 
289af6b6374SJohannes Berg /**
290af6b6374SJohannes Berg  * enum work_done_result - indicates what to do after work was done
291af6b6374SJohannes Berg  *
292af6b6374SJohannes Berg  * @WORK_DONE_DESTROY: This work item is no longer needed, destroy.
293af6b6374SJohannes Berg  * @WORK_DONE_REQUEUE: This work item was reset to be reused, and
294af6b6374SJohannes Berg  *	should be requeued.
295af6b6374SJohannes Berg  */
296af6b6374SJohannes Berg enum work_done_result {
297af6b6374SJohannes Berg 	WORK_DONE_DESTROY,
298af6b6374SJohannes Berg 	WORK_DONE_REQUEUE,
299af6b6374SJohannes Berg };
300af6b6374SJohannes Berg 
301f679f65dSJohannes Berg struct ieee80211_work {
30277fdaa12SJohannes Berg 	struct list_head list;
303f679f65dSJohannes Berg 
304af6b6374SJohannes Berg 	struct rcu_head rcu_head;
305af6b6374SJohannes Berg 
306af6b6374SJohannes Berg 	struct ieee80211_sub_if_data *sdata;
307af6b6374SJohannes Berg 
308af6b6374SJohannes Berg 	enum work_done_result (*done)(struct ieee80211_work *wk,
309af6b6374SJohannes Berg 				      struct sk_buff *skb);
310af6b6374SJohannes Berg 
311f679f65dSJohannes Berg 	struct ieee80211_channel *chan;
312e4da8c37SJohannes Berg 	enum nl80211_channel_type chan_type;
313af6b6374SJohannes Berg 
314f679f65dSJohannes Berg 	unsigned long timeout;
315f679f65dSJohannes Berg 	enum ieee80211_work_type type;
316f679f65dSJohannes Berg 
317af6b6374SJohannes Berg 	u8 filter_ta[ETH_ALEN];
318af6b6374SJohannes Berg 
319e4da8c37SJohannes Berg 	bool started;
320e4da8c37SJohannes Berg 
321f679f65dSJohannes Berg 	union {
322f679f65dSJohannes Berg 		struct {
323f679f65dSJohannes Berg 			int tries;
324f679f65dSJohannes Berg 			u16 algorithm, transaction;
32577fdaa12SJohannes Berg 			u8 ssid[IEEE80211_MAX_SSID_LEN];
32677fdaa12SJohannes Berg 			u8 ssid_len;
327fffd0934SJohannes Berg 			u8 key[WLAN_KEY_LEN_WEP104];
328fffd0934SJohannes Berg 			u8 key_len, key_idx;
329f679f65dSJohannes Berg 			bool privacy;
330b2abb6e2SJohannes Berg 			bool synced;
331af6b6374SJohannes Berg 		} probe_auth;
332f679f65dSJohannes Berg 		struct {
3330c1ad2caSJohannes Berg 			struct cfg80211_bss *bss;
334f679f65dSJohannes Berg 			const u8 *supp_rates;
335f679f65dSJohannes Berg 			const u8 *ht_information_ie;
336af6b6374SJohannes Berg 			enum ieee80211_smps_mode smps;
337f679f65dSJohannes Berg 			int tries;
338f679f65dSJohannes Berg 			u16 capability;
339af6b6374SJohannes Berg 			u8 prev_bssid[ETH_ALEN];
340f679f65dSJohannes Berg 			u8 ssid[IEEE80211_MAX_SSID_LEN];
341f679f65dSJohannes Berg 			u8 ssid_len;
342f679f65dSJohannes Berg 			u8 supp_rates_len;
343ab13315aSKalle Valo 			bool wmm_used, use_11n, uapsd_used;
344b2abb6e2SJohannes Berg 			bool synced;
345f679f65dSJohannes Berg 		} assoc;
346b8bc4b0aSJohannes Berg 		struct {
347e4da8c37SJohannes Berg 			u32 duration;
348b8bc4b0aSJohannes Berg 		} remain;
349f30221e4SJohannes Berg 		struct {
350f30221e4SJohannes Berg 			struct sk_buff *frame;
351f30221e4SJohannes Berg 			u32 wait;
35228a1bcdbSJohannes Berg 			bool status;
353f30221e4SJohannes Berg 		} offchan_tx;
354f679f65dSJohannes Berg 	};
355fffd0934SJohannes Berg 
356f679f65dSJohannes Berg 	int ie_len;
35777fdaa12SJohannes Berg 	/* must be last */
358f679f65dSJohannes Berg 	u8 ie[0];
35977fdaa12SJohannes Berg };
36077fdaa12SJohannes Berg 
36146900298SJohannes Berg /* flags used in struct ieee80211_if_managed.flags */
362ab1faeadSJohannes Berg enum ieee80211_sta_flags {
363b291ba11SJohannes Berg 	IEEE80211_STA_BEACON_POLL	= BIT(0),
364b291ba11SJohannes Berg 	IEEE80211_STA_CONNECTION_POLL	= BIT(1),
365b291ba11SJohannes Berg 	IEEE80211_STA_CONTROL_PORT	= BIT(2),
366b291ba11SJohannes Berg 	IEEE80211_STA_DISABLE_11N	= BIT(4),
367b291ba11SJohannes Berg 	IEEE80211_STA_CSA_RECEIVED	= BIT(5),
368b291ba11SJohannes Berg 	IEEE80211_STA_MFP_ENABLED	= BIT(6),
369ab13315aSKalle Valo 	IEEE80211_STA_UAPSD_ENABLED	= BIT(7),
370375177bfSVivek Natarajan 	IEEE80211_STA_NULLFUNC_ACKED	= BIT(8),
37117e4ec14SJouni Malinen 	IEEE80211_STA_RESET_SIGNAL_AVE	= BIT(9),
372ab1faeadSJohannes Berg };
373ab1faeadSJohannes Berg 
37446900298SJohannes Berg struct ieee80211_if_managed {
375056cdd59SJohannes Berg 	struct timer_list timer;
376b291ba11SJohannes Berg 	struct timer_list conn_mon_timer;
377b291ba11SJohannes Berg 	struct timer_list bcn_mon_timer;
378c481ec97SSujith 	struct timer_list chswitch_timer;
379b291ba11SJohannes Berg 	struct work_struct monitor_work;
380c481ec97SSujith 	struct work_struct chswitch_work;
3811e4dcd01SJuuso Oikarinen 	struct work_struct beacon_connection_loss_work;
38246900298SJohannes Berg 
3837ccc8bd7SFelix Fietkau 	unsigned long beacon_timeout;
384b291ba11SJohannes Berg 	unsigned long probe_timeout;
385a43abf29SMaxim Levitsky 	int probe_send_count;
38604ac3c0eSFelix Fietkau 	bool nullfunc_failed;
387b291ba11SJohannes Berg 
38877fdaa12SJohannes Berg 	struct mutex mtx;
3890c1ad2caSJohannes Berg 	struct cfg80211_bss *associated;
39046900298SJohannes Berg 
39177fdaa12SJohannes Berg 	u8 bssid[ETH_ALEN];
39246900298SJohannes Berg 
393f0706e82SJiri Benc 	u16 aid;
394f0706e82SJiri Benc 
3955bb644a0SJohannes Berg 	unsigned long timers_running; /* used for quiesce/restart */
396965bedadSJohannes Berg 	bool powersave; /* powersave requested for this iface */
39705cb9108SJohannes Berg 	bool broken_ap; /* AP is broken -- turn off powersave */
3980f78231bSJohannes Berg 	enum ieee80211_smps_mode req_smps, /* requested smps mode */
399d1f5b7a3SJohannes Berg 				 ap_smps, /* smps mode AP thinks we're in */
400d1f5b7a3SJohannes Berg 				 driver_smps_mode; /* smps mode request */
401d1f5b7a3SJohannes Berg 
402d1f5b7a3SJohannes Berg 	struct work_struct request_smps_work;
403965bedadSJohannes Berg 
404d6f2da5bSJiri Slaby 	unsigned int flags;
405f0706e82SJiri Benc 
406d8ec4433SJuuso Oikarinen 	bool beacon_crc_valid;
407d91f36dbSJohannes Berg 	u32 beacon_crc;
408d91f36dbSJohannes Berg 
409fdfacf0aSJouni Malinen 	enum {
410fdfacf0aSJouni Malinen 		IEEE80211_MFP_DISABLED,
411fdfacf0aSJouni Malinen 		IEEE80211_MFP_OPTIONAL,
412fdfacf0aSJouni Malinen 		IEEE80211_MFP_REQUIRED
413fdfacf0aSJouni Malinen 	} mfp; /* management frame protection */
414fdfacf0aSJouni Malinen 
415f0706e82SJiri Benc 	int wmm_last_param_set;
4169bc383deSJohannes Berg 
4179bc383deSJohannes Berg 	u8 use_4addr;
41817e4ec14SJouni Malinen 
41917e4ec14SJouni Malinen 	/* Signal strength from the last Beacon frame in the current BSS. */
42017e4ec14SJouni Malinen 	int last_beacon_signal;
42117e4ec14SJouni Malinen 
42217e4ec14SJouni Malinen 	/*
42317e4ec14SJouni Malinen 	 * Weighted average of the signal strength from Beacon frames in the
42417e4ec14SJouni Malinen 	 * current BSS. This is in units of 1/16 of the signal unit to maintain
42517e4ec14SJouni Malinen 	 * accuracy and to speed up calculations, i.e., the value need to be
42617e4ec14SJouni Malinen 	 * divided by 16 to get the actual value.
42717e4ec14SJouni Malinen 	 */
42817e4ec14SJouni Malinen 	int ave_beacon_signal;
42917e4ec14SJouni Malinen 
43017e4ec14SJouni Malinen 	/*
431391a200aSJouni Malinen 	 * Number of Beacon frames used in ave_beacon_signal. This can be used
432391a200aSJouni Malinen 	 * to avoid generating less reliable cqm events that would be based
433391a200aSJouni Malinen 	 * only on couple of received frames.
434391a200aSJouni Malinen 	 */
435391a200aSJouni Malinen 	unsigned int count_beacon_signal;
436391a200aSJouni Malinen 
437391a200aSJouni Malinen 	/*
43817e4ec14SJouni Malinen 	 * Last Beacon frame signal strength average (ave_beacon_signal / 16)
43917e4ec14SJouni Malinen 	 * that triggered a cqm event. 0 indicates that no event has been
44017e4ec14SJouni Malinen 	 * generated for the current association.
44117e4ec14SJouni Malinen 	 */
44217e4ec14SJouni Malinen 	int last_cqm_event_signal;
443615f7b9bSMeenakshi Venkataraman 
444615f7b9bSMeenakshi Venkataraman 	/*
445615f7b9bSMeenakshi Venkataraman 	 * State variables for keeping track of RSSI of the AP currently
446615f7b9bSMeenakshi Venkataraman 	 * connected to and informing driver when RSSI has gone
447615f7b9bSMeenakshi Venkataraman 	 * below/above a certain threshold.
448615f7b9bSMeenakshi Venkataraman 	 */
449615f7b9bSMeenakshi Venkataraman 	int rssi_min_thold, rssi_max_thold;
450615f7b9bSMeenakshi Venkataraman 	int last_ave_beacon_signal;
451f0706e82SJiri Benc };
452f0706e82SJiri Benc 
45346900298SJohannes Berg struct ieee80211_if_ibss {
45446900298SJohannes Berg 	struct timer_list timer;
45546900298SJohannes Berg 
4567a17a33cSJohannes Berg 	struct mutex mtx;
4577a17a33cSJohannes Berg 
458af8cdcd8SJohannes Berg 	unsigned long last_scan_completed;
4595bb644a0SJohannes Berg 
460fbd2c8dcSTeemu Paasikivi 	u32 basic_rates;
461fbd2c8dcSTeemu Paasikivi 
4625bb644a0SJohannes Berg 	bool timer_running;
4635bb644a0SJohannes Berg 
464af8cdcd8SJohannes Berg 	bool fixed_bssid;
465af8cdcd8SJohannes Berg 	bool fixed_channel;
466fffd0934SJohannes Berg 	bool privacy;
46746900298SJohannes Berg 
46846900298SJohannes Berg 	u8 bssid[ETH_ALEN];
469af8cdcd8SJohannes Berg 	u8 ssid[IEEE80211_MAX_SSID_LEN];
470af8cdcd8SJohannes Berg 	u8 ssid_len, ie_len;
471af8cdcd8SJohannes Berg 	u8 *ie;
472af8cdcd8SJohannes Berg 	struct ieee80211_channel *channel;
47346900298SJohannes Berg 
47446900298SJohannes Berg 	unsigned long ibss_join_req;
475af8cdcd8SJohannes Berg 	/* probe response/beacon for IBSS */
47640b275b6SJohannes Berg 	struct sk_buff __rcu *presp;
47740b275b6SJohannes Berg 	struct sk_buff *skb;
47846900298SJohannes Berg 
47946900298SJohannes Berg 	enum {
48046900298SJohannes Berg 		IEEE80211_IBSS_MLME_SEARCH,
48146900298SJohannes Berg 		IEEE80211_IBSS_MLME_JOINED,
48246900298SJohannes Berg 	} state;
48346900298SJohannes Berg };
48446900298SJohannes Berg 
485472dbc45SJohannes Berg struct ieee80211_if_mesh {
486472dbc45SJohannes Berg 	struct timer_list housekeeping_timer;
487472dbc45SJohannes Berg 	struct timer_list mesh_path_timer;
488e304bfd3SRui Paulo 	struct timer_list mesh_path_root_timer;
489472dbc45SJohannes Berg 
4905bb644a0SJohannes Berg 	unsigned long timers_running;
4915bb644a0SJohannes Berg 
49218889231SJavier Cardona 	unsigned long wrkq_flags;
493472dbc45SJohannes Berg 
494472dbc45SJohannes Berg 	u8 mesh_id[IEEE80211_MAX_MESH_ID_LEN];
495472dbc45SJohannes Berg 	size_t mesh_id_len;
496472dbc45SJohannes Berg 	/* Active Path Selection Protocol Identifier */
4973491707aSRui Paulo 	u8 mesh_pp_id;
498472dbc45SJohannes Berg 	/* Active Path Selection Metric Identifier */
4993491707aSRui Paulo 	u8 mesh_pm_id;
500472dbc45SJohannes Berg 	/* Congestion Control Mode Identifier */
5013491707aSRui Paulo 	u8 mesh_cc_id;
5029e03fdfdSJavier Cardona 	/* Synchronization Protocol Identifier */
5033491707aSRui Paulo 	u8 mesh_sp_id;
5049e03fdfdSJavier Cardona 	/* Authentication Protocol Identifier */
5053491707aSRui Paulo 	u8 mesh_auth_id;
506d19b3bf6SRui Paulo 	/* Local mesh Sequence Number */
507d19b3bf6SRui Paulo 	u32 sn;
508472dbc45SJohannes Berg 	/* Last used PREQ ID */
509472dbc45SJohannes Berg 	u32 preq_id;
510472dbc45SJohannes Berg 	atomic_t mpaths;
511d19b3bf6SRui Paulo 	/* Timestamp of last SN update */
512d19b3bf6SRui Paulo 	unsigned long last_sn_update;
513d19b3bf6SRui Paulo 	/* Timestamp of last SN sent */
514472dbc45SJohannes Berg 	unsigned long last_preq;
515472dbc45SJohannes Berg 	struct mesh_rmc *rmc;
516472dbc45SJohannes Berg 	spinlock_t mesh_preq_queue_lock;
517472dbc45SJohannes Berg 	struct mesh_preq_queue preq_queue;
518472dbc45SJohannes Berg 	int preq_queue_len;
519472dbc45SJohannes Berg 	struct mesh_stats mshstats;
520472dbc45SJohannes Berg 	struct mesh_config mshcfg;
521472dbc45SJohannes Berg 	u32 mesh_seqnum;
522472dbc45SJohannes Berg 	bool accepting_plinks;
5235ee68e5bSJavier Cardona 	int num_gates;
524581a8b0fSJavier Cardona 	const u8 *ie;
525581a8b0fSJavier Cardona 	u8 ie_len;
526b130e5ceSJavier Cardona 	enum {
527b130e5ceSJavier Cardona 		IEEE80211_MESH_SEC_NONE = 0x0,
528b130e5ceSJavier Cardona 		IEEE80211_MESH_SEC_AUTHED = 0x1,
529b130e5ceSJavier Cardona 		IEEE80211_MESH_SEC_SECURED = 0x2,
530b130e5ceSJavier Cardona 	} security;
531472dbc45SJohannes Berg };
532902acc78SJohannes Berg 
533902acc78SJohannes Berg #ifdef CONFIG_MAC80211_MESH
534472dbc45SJohannes Berg #define IEEE80211_IFSTA_MESH_CTR_INC(msh, name)	\
535472dbc45SJohannes Berg 	do { (msh)->mshstats.name++; } while (0)
536902acc78SJohannes Berg #else
537472dbc45SJohannes Berg #define IEEE80211_IFSTA_MESH_CTR_INC(msh, name) \
538902acc78SJohannes Berg 	do { } while (0)
539902acc78SJohannes Berg #endif
540f0706e82SJiri Benc 
541213cd118SJohannes Berg /**
542213cd118SJohannes Berg  * enum ieee80211_sub_if_data_flags - virtual interface flags
543213cd118SJohannes Berg  *
544213cd118SJohannes Berg  * @IEEE80211_SDATA_ALLMULTI: interface wants all multicast packets
545213cd118SJohannes Berg  * @IEEE80211_SDATA_PROMISC: interface is promisc
546213cd118SJohannes Berg  * @IEEE80211_SDATA_OPERATING_GMODE: operating in G-only mode
547213cd118SJohannes Berg  * @IEEE80211_SDATA_DONT_BRIDGE_PACKETS: bridge packets between
548213cd118SJohannes Berg  *	associated stations and deliver multicast frames both
549213cd118SJohannes Berg  *	back to wireless media and to the local net stack.
55095acac61SJohannes Berg  * @IEEE80211_SDATA_DISCONNECT_RESUME: Disconnect after resume.
5517b7eab6fSJohannes Berg  * @IEEE80211_SDATA_IN_DRIVER: indicates interface was added to driver
552213cd118SJohannes Berg  */
553213cd118SJohannes Berg enum ieee80211_sub_if_data_flags {
554213cd118SJohannes Berg 	IEEE80211_SDATA_ALLMULTI		= BIT(0),
555213cd118SJohannes Berg 	IEEE80211_SDATA_PROMISC			= BIT(1),
5567986cf95SJohannes Berg 	IEEE80211_SDATA_OPERATING_GMODE		= BIT(2),
5577986cf95SJohannes Berg 	IEEE80211_SDATA_DONT_BRIDGE_PACKETS	= BIT(3),
55895acac61SJohannes Berg 	IEEE80211_SDATA_DISCONNECT_RESUME	= BIT(4),
5597b7eab6fSJohannes Berg 	IEEE80211_SDATA_IN_DRIVER		= BIT(5),
560213cd118SJohannes Berg };
561213cd118SJohannes Berg 
56234d4bc4dSJohannes Berg /**
56334d4bc4dSJohannes Berg  * enum ieee80211_sdata_state_bits - virtual interface state bits
56434d4bc4dSJohannes Berg  * @SDATA_STATE_RUNNING: virtual interface is up & running; this
56534d4bc4dSJohannes Berg  *	mirrors netif_running() but is separate for interface type
56634d4bc4dSJohannes Berg  *	change handling while the interface is up
5675b714c6aSJohannes Berg  * @SDATA_STATE_OFFCHANNEL: This interface is currently in offchannel
5685b714c6aSJohannes Berg  *	mode, so queues are stopped
56934d4bc4dSJohannes Berg  */
57034d4bc4dSJohannes Berg enum ieee80211_sdata_state_bits {
57134d4bc4dSJohannes Berg 	SDATA_STATE_RUNNING,
5725b714c6aSJohannes Berg 	SDATA_STATE_OFFCHANNEL,
57334d4bc4dSJohannes Berg };
57434d4bc4dSJohannes Berg 
575f0706e82SJiri Benc struct ieee80211_sub_if_data {
576f0706e82SJiri Benc 	struct list_head list;
577f0706e82SJiri Benc 
578f0706e82SJiri Benc 	struct wireless_dev wdev;
579f0706e82SJiri Benc 
58011a843b7SJohannes Berg 	/* keys */
58111a843b7SJohannes Berg 	struct list_head key_list;
58211a843b7SJohannes Berg 
5833bff1865SYogesh Ashok Powar 	/* count for keys needing tailroom space allocation */
5843bff1865SYogesh Ashok Powar 	int crypto_tx_tailroom_needed_cnt;
5853bff1865SYogesh Ashok Powar 
586f0706e82SJiri Benc 	struct net_device *dev;
587f0706e82SJiri Benc 	struct ieee80211_local *local;
588f0706e82SJiri Benc 
58913262ffdSJiri Slaby 	unsigned int flags;
5907e9ed188SDaniel Drake 
59134d4bc4dSJohannes Berg 	unsigned long state;
59234d4bc4dSJohannes Berg 
593f0706e82SJiri Benc 	int drop_unencrypted;
594f0706e82SJiri Benc 
59547846c9bSJohannes Berg 	char name[IFNAMSIZ];
59647846c9bSJohannes Berg 
597413ad50aSJohannes Berg 	/*
598413ad50aSJohannes Berg 	 * keep track of whether the HT opmode (stored in
599413ad50aSJohannes Berg 	 * vif.bss_info.ht_operation_mode) is valid.
600413ad50aSJohannes Berg 	 */
601413ad50aSJohannes Berg 	bool ht_opmode_valid;
602413ad50aSJohannes Berg 
6037da7cc1dSJohannes Berg 	/* to detect idle changes */
6047da7cc1dSJohannes Berg 	bool old_idle;
6057da7cc1dSJohannes Berg 
606f0706e82SJiri Benc 	/* Fragment table for host-based reassembly */
607f0706e82SJiri Benc 	struct ieee80211_fragment_entry	fragments[IEEE80211_FRAGMENT_MAX];
608f0706e82SJiri Benc 	unsigned int fragment_next;
609f0706e82SJiri Benc 
61040b275b6SJohannes Berg 	struct ieee80211_key __rcu *keys[NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS];
61140b275b6SJohannes Berg 	struct ieee80211_key __rcu *default_unicast_key;
61240b275b6SJohannes Berg 	struct ieee80211_key __rcu *default_multicast_key;
61340b275b6SJohannes Berg 	struct ieee80211_key __rcu *default_mgmt_key;
614f0706e82SJiri Benc 
61594778280SJohannes Berg 	u16 sequence_number;
616a621fa4dSJohannes Berg 	__be16 control_port_protocol;
617a621fa4dSJohannes Berg 	bool control_port_no_encrypt;
61894778280SJohannes Berg 
619f6f3def3SEliad Peller 	struct ieee80211_tx_queue_params tx_conf[IEEE80211_MAX_QUEUES];
620f6f3def3SEliad Peller 
62164592c8fSJohannes Berg 	struct work_struct work;
62235f20c14SJohannes Berg 	struct sk_buff_head skb_queue;
62335f20c14SJohannes Berg 
62468542962SJuuso Oikarinen 	bool arp_filter_state;
62568542962SJuuso Oikarinen 
6263e122be0SJohannes Berg 	/*
6273e122be0SJohannes Berg 	 * AP this belongs to: self in AP mode and
6283e122be0SJohannes Berg 	 * corresponding AP in VLAN mode, NULL for
6293e122be0SJohannes Berg 	 * all others (might be needed later in IBSS)
6303e122be0SJohannes Berg 	 */
6313e122be0SJohannes Berg 	struct ieee80211_if_ap *bss;
6323e122be0SJohannes Berg 
63337eb0b16SJouni Malinen 	/* bitmap of allowed (non-MCS) rate indexes for rate control */
63437eb0b16SJouni Malinen 	u32 rc_rateidx_mask[IEEE80211_NUM_BANDS];
635f0706e82SJiri Benc 
636f0706e82SJiri Benc 	union {
637f0706e82SJiri Benc 		struct ieee80211_if_ap ap;
638f0706e82SJiri Benc 		struct ieee80211_if_wds wds;
639f0706e82SJiri Benc 		struct ieee80211_if_vlan vlan;
64046900298SJohannes Berg 		struct ieee80211_if_managed mgd;
64146900298SJohannes Berg 		struct ieee80211_if_ibss ibss;
642472dbc45SJohannes Berg 		struct ieee80211_if_mesh mesh;
6438cc9a739SMichael Wu 		u32 mntr_flags;
644f0706e82SJiri Benc 	} u;
645e9f207f0SJiri Benc 
646e9f207f0SJiri Benc #ifdef CONFIG_MAC80211_DEBUGFS
647e9f207f0SJiri Benc 	struct {
6487bcfaf2fSJohannes Berg 		struct dentry *dir;
649295bafb4SBen Greear 		struct dentry *subdir_stations;
650f7e0104cSJohannes Berg 		struct dentry *default_unicast_key;
651f7e0104cSJohannes Berg 		struct dentry *default_multicast_key;
6523cfcf6acSJouni Malinen 		struct dentry *default_mgmt_key;
6537bcfaf2fSJohannes Berg 	} debugfs;
654e9f207f0SJiri Benc #endif
65532bfd35dSJohannes Berg 	/* must be last, dynamically sized area in this! */
65632bfd35dSJohannes Berg 	struct ieee80211_vif vif;
657f0706e82SJiri Benc };
658f0706e82SJiri Benc 
65932bfd35dSJohannes Berg static inline
66032bfd35dSJohannes Berg struct ieee80211_sub_if_data *vif_to_sdata(struct ieee80211_vif *p)
66132bfd35dSJohannes Berg {
66232bfd35dSJohannes Berg 	return container_of(p, struct ieee80211_sub_if_data, vif);
66332bfd35dSJohannes Berg }
66432bfd35dSJohannes Berg 
665c1475ca9SJohannes Berg enum sdata_queue_type {
666c1475ca9SJohannes Berg 	IEEE80211_SDATA_QUEUE_TYPE_FRAME	= 0,
667c1475ca9SJohannes Berg 	IEEE80211_SDATA_QUEUE_AGG_START		= 1,
668c1475ca9SJohannes Berg 	IEEE80211_SDATA_QUEUE_AGG_STOP		= 2,
669c1475ca9SJohannes Berg };
670c1475ca9SJohannes Berg 
671f0706e82SJiri Benc enum {
672f0706e82SJiri Benc 	IEEE80211_RX_MSG	= 1,
673f0706e82SJiri Benc 	IEEE80211_TX_STATUS_MSG	= 2,
67437fbd908SJohannes Berg 	IEEE80211_EOSP_MSG	= 3,
67537fbd908SJohannes Berg };
67637fbd908SJohannes Berg 
67737fbd908SJohannes Berg struct skb_eosp_msg_data {
67837fbd908SJohannes Berg 	u8 sta[ETH_ALEN], iface[ETH_ALEN];
679f0706e82SJiri Benc };
680f0706e82SJiri Benc 
681ce7c9111SKalle Valo enum queue_stop_reason {
682ce7c9111SKalle Valo 	IEEE80211_QUEUE_STOP_REASON_DRIVER,
683520eb820SKalle Valo 	IEEE80211_QUEUE_STOP_REASON_PS,
68496f5e66eSJohannes Berg 	IEEE80211_QUEUE_STOP_REASON_CSA,
68596f5e66eSJohannes Berg 	IEEE80211_QUEUE_STOP_REASON_AGGREGATION,
68625420604SJohannes Berg 	IEEE80211_QUEUE_STOP_REASON_SUSPEND,
6878f77f384SJohannes Berg 	IEEE80211_QUEUE_STOP_REASON_SKB_ADD,
688693828feSRajkumar Manoharan 	IEEE80211_QUEUE_STOP_REASON_CHTYPE_CHANGE,
689ce7c9111SKalle Valo };
690ce7c9111SKalle Valo 
69165a6538aSLuciano Coelho #ifdef CONFIG_MAC80211_LEDS
692e1e54068SJohannes Berg struct tpt_led_trigger {
693e1e54068SJohannes Berg 	struct led_trigger trig;
694e1e54068SJohannes Berg 	char name[32];
695e1e54068SJohannes Berg 	const struct ieee80211_tpt_blink *blink_table;
696e1e54068SJohannes Berg 	unsigned int blink_table_len;
697e1e54068SJohannes Berg 	struct timer_list timer;
698e1e54068SJohannes Berg 	unsigned long prev_traffic;
699e1e54068SJohannes Berg 	unsigned long tx_bytes, rx_bytes;
70067408c8cSJohannes Berg 	unsigned int active, want;
70167408c8cSJohannes Berg 	bool running;
702e1e54068SJohannes Berg };
70365a6538aSLuciano Coelho #endif
704e1e54068SJohannes Berg 
705142b9f50SHelmut Schaa /**
706142b9f50SHelmut Schaa  * mac80211 scan flags - currently active scan mode
707142b9f50SHelmut Schaa  *
708142b9f50SHelmut Schaa  * @SCAN_SW_SCANNING: We're currently in the process of scanning but may as
709142b9f50SHelmut Schaa  *	well be on the operating channel
710142b9f50SHelmut Schaa  * @SCAN_HW_SCANNING: The hardware is scanning for us, we have no way to
711142b9f50SHelmut Schaa  *	determine if we are on the operating channel or not
7128789d459SJohannes Berg  * @SCAN_COMPLETED: Set for our scan work function when the driver reported
7138789d459SJohannes Berg  *	that the scan completed.
7148789d459SJohannes Berg  * @SCAN_ABORTED: Set for our scan work function when the driver reported
7158789d459SJohannes Berg  *	a scan complete for an aborted scan.
716142b9f50SHelmut Schaa  */
717fbe9c429SHelmut Schaa enum {
718fbe9c429SHelmut Schaa 	SCAN_SW_SCANNING,
719142b9f50SHelmut Schaa 	SCAN_HW_SCANNING,
7208789d459SJohannes Berg 	SCAN_COMPLETED,
7218789d459SJohannes Berg 	SCAN_ABORTED,
722142b9f50SHelmut Schaa };
723142b9f50SHelmut Schaa 
724142b9f50SHelmut Schaa /**
725142b9f50SHelmut Schaa  * enum mac80211_scan_state - scan state machine states
726142b9f50SHelmut Schaa  *
727142b9f50SHelmut Schaa  * @SCAN_DECISION: Main entry point to the scan state machine, this state
728142b9f50SHelmut Schaa  *	determines if we should keep on scanning or switch back to the
729142b9f50SHelmut Schaa  *	operating channel
730142b9f50SHelmut Schaa  * @SCAN_SET_CHANNEL: Set the next channel to be scanned
731142b9f50SHelmut Schaa  * @SCAN_SEND_PROBE: Send probe requests and wait for probe responses
73207ef03eeSJohannes Berg  * @SCAN_SUSPEND: Suspend the scan and go back to operating channel to
73307ef03eeSJohannes Berg  *	send out data
73407ef03eeSJohannes Berg  * @SCAN_RESUME: Resume the scan and scan the next channel
735142b9f50SHelmut Schaa  */
736142b9f50SHelmut Schaa enum mac80211_scan_state {
737142b9f50SHelmut Schaa 	SCAN_DECISION,
738142b9f50SHelmut Schaa 	SCAN_SET_CHANNEL,
739142b9f50SHelmut Schaa 	SCAN_SEND_PROBE,
74007ef03eeSJohannes Berg 	SCAN_SUSPEND,
74107ef03eeSJohannes Berg 	SCAN_RESUME,
742fbe9c429SHelmut Schaa };
743fbe9c429SHelmut Schaa 
744f0706e82SJiri Benc struct ieee80211_local {
745f0706e82SJiri Benc 	/* embed the driver visible part.
746f0706e82SJiri Benc 	 * don't cast (use the static inlines below), but we keep
747f0706e82SJiri Benc 	 * it first anyway so they become a no-op */
748f0706e82SJiri Benc 	struct ieee80211_hw hw;
749f0706e82SJiri Benc 
750f0706e82SJiri Benc 	const struct ieee80211_ops *ops;
751f0706e82SJiri Benc 
75242935ecaSLuis R. Rodriguez 	/*
753af6b6374SJohannes Berg 	 * work stuff, potentially off-channel (in the future)
754af6b6374SJohannes Berg 	 */
755af6b6374SJohannes Berg 	struct list_head work_list;
756af6b6374SJohannes Berg 	struct timer_list work_timer;
757af6b6374SJohannes Berg 	struct work_struct work_work;
758af6b6374SJohannes Berg 	struct sk_buff_head work_skb_queue;
759af6b6374SJohannes Berg 
760af6b6374SJohannes Berg 	/*
76142935ecaSLuis R. Rodriguez 	 * private workqueue to mac80211. mac80211 makes this accessible
76242935ecaSLuis R. Rodriguez 	 * via ieee80211_queue_work()
76342935ecaSLuis R. Rodriguez 	 */
76442935ecaSLuis R. Rodriguez 	struct workqueue_struct *workqueue;
76542935ecaSLuis R. Rodriguez 
766e4e72fb4SJohannes Berg 	unsigned long queue_stop_reasons[IEEE80211_MAX_QUEUES];
76796f5e66eSJohannes Berg 	/* also used to protect ampdu_ac_queue and amdpu_ac_stop_refcnt */
768ce7c9111SKalle Valo 	spinlock_t queue_stop_reason_lock;
76996f5e66eSJohannes Berg 
770f0706e82SJiri Benc 	int open_count;
7713d30d949SMichael Wu 	int monitors, cooked_mntrs;
7728cc9a739SMichael Wu 	/* number of interfaces with corresponding FIF_ flags */
7737be5086dSJohannes Berg 	int fif_fcsfail, fif_plcpfail, fif_control, fif_other_bss, fif_pspoll,
7747be5086dSJohannes Berg 	    fif_probe_req;
7757be5086dSJohannes Berg 	int probe_req_reg;
7764150c572SJohannes Berg 	unsigned int filter_flags; /* FIF_* */
7773b8d81e0SJohannes Berg 
7783ffc2a90SJohannes Berg 	bool wiphy_ciphers_allocated;
7793ffc2a90SJohannes Berg 
7803b8d81e0SJohannes Berg 	/* protects the aggregated multicast list and filter calls */
7813b8d81e0SJohannes Berg 	spinlock_t filter_lock;
7823b8d81e0SJohannes Berg 
7833ac64beeSJohannes Berg 	/* used for uploading changed mc list */
7843ac64beeSJohannes Berg 	struct work_struct reconfig_filter;
7853ac64beeSJohannes Berg 
7860f78231bSJohannes Berg 	/* used to reconfigure hardware SM PS */
7870f78231bSJohannes Berg 	struct work_struct recalc_smps;
7880f78231bSJohannes Berg 
7893b8d81e0SJohannes Berg 	/* aggregated multicast list */
79022bedad3SJiri Pirko 	struct netdev_hw_addr_list mc_list;
7913b8d81e0SJohannes Berg 
792d0709a65SJohannes Berg 	bool tim_in_locked_section; /* see ieee80211_beacon_get() */
7935bb644a0SJohannes Berg 
7945bb644a0SJohannes Berg 	/*
7955bb644a0SJohannes Berg 	 * suspended is true if we finished all the suspend _and_ we have
7965bb644a0SJohannes Berg 	 * not yet come up from resume. This is to be used by mac80211
7975bb644a0SJohannes Berg 	 * to ensure driver sanity during suspend and mac80211's own
7985bb644a0SJohannes Berg 	 * sanity. It can eventually be used for WoW as well.
7995bb644a0SJohannes Berg 	 */
8005bb644a0SJohannes Berg 	bool suspended;
8015bb644a0SJohannes Berg 
8025bb644a0SJohannes Berg 	/*
803ceb99fe0SJohannes Berg 	 * Resuming is true while suspended, but when we're reprogramming the
804ceb99fe0SJohannes Berg 	 * hardware -- at that time it's allowed to use ieee80211_queue_work()
805ceb99fe0SJohannes Berg 	 * again even though some other parts of the stack are still suspended
806ceb99fe0SJohannes Berg 	 * and we still drop received frames to avoid waking the stack.
807ceb99fe0SJohannes Berg 	 */
808ceb99fe0SJohannes Berg 	bool resuming;
809ceb99fe0SJohannes Berg 
810ceb99fe0SJohannes Berg 	/*
8115bb644a0SJohannes Berg 	 * quiescing is true during the suspend process _only_ to
8125bb644a0SJohannes Berg 	 * ease timer cancelling etc.
8135bb644a0SJohannes Berg 	 */
8145bb644a0SJohannes Berg 	bool quiescing;
8155bb644a0SJohannes Berg 
816ea77f12fSJohannes Berg 	/* device is started */
817ea77f12fSJohannes Berg 	bool started;
818ea77f12fSJohannes Berg 
819eecc4800SJohannes Berg 	/* wowlan is enabled -- don't reconfig on resume */
820eecc4800SJohannes Berg 	bool wowlan;
821eecc4800SJohannes Berg 
822b306f453SJohannes Berg 	int tx_headroom; /* required headroom for hardware/radiotap */
823f0706e82SJiri Benc 
824f0706e82SJiri Benc 	/* Tasklet and skb queue to process calls from IRQ mode. All frames
825f0706e82SJiri Benc 	 * added to skb_queue will be processed, but frames in
826f0706e82SJiri Benc 	 * skb_queue_unreliable may be dropped if the total length of these
827f0706e82SJiri Benc 	 * queues increases over the limit. */
828f0706e82SJiri Benc #define IEEE80211_IRQSAFE_QUEUE_LIMIT 128
829f0706e82SJiri Benc 	struct tasklet_struct tasklet;
830f0706e82SJiri Benc 	struct sk_buff_head skb_queue;
831f0706e82SJiri Benc 	struct sk_buff_head skb_queue_unreliable;
832f0706e82SJiri Benc 
83324a8fdadSChristian Lamparter 	/*
83424a8fdadSChristian Lamparter 	 * Internal FIFO queue which is shared between multiple rx path
83524a8fdadSChristian Lamparter 	 * stages. Its main task is to provide a serialization mechanism,
83624a8fdadSChristian Lamparter 	 * so all rx handlers can enjoy having exclusive access to their
83724a8fdadSChristian Lamparter 	 * private data structures.
83824a8fdadSChristian Lamparter 	 */
83924a8fdadSChristian Lamparter 	struct sk_buff_head rx_skb_queue;
84024a8fdadSChristian Lamparter 	bool running_rx_handler;	/* protected by rx_skb_queue.lock */
84124a8fdadSChristian Lamparter 
842d0709a65SJohannes Berg 	/* Station data */
843d0709a65SJohannes Berg 	/*
84434e89507SJohannes Berg 	 * The mutex only protects the list and counter,
84534e89507SJohannes Berg 	 * reads are done in RCU.
84634e89507SJohannes Berg 	 * Additionally, the lock protects the hash table,
84734e89507SJohannes Berg 	 * the pending list and each BSS's TIM bitmap.
848d0709a65SJohannes Berg 	 */
84934e89507SJohannes Berg 	struct mutex sta_mtx;
850d0709a65SJohannes Berg 	spinlock_t sta_lock;
851d0709a65SJohannes Berg 	unsigned long num_sta;
85234e89507SJohannes Berg 	struct list_head sta_list, sta_pending_list;
85340b275b6SJohannes Berg 	struct sta_info __rcu *sta_hash[STA_HASH_SIZE];
854f0706e82SJiri Benc 	struct timer_list sta_cleanup;
85534e89507SJohannes Berg 	struct work_struct sta_finish_work;
856f5ea9120SJohannes Berg 	int sta_generation;
857f0706e82SJiri Benc 
8582a577d98SJohannes Berg 	struct sk_buff_head pending[IEEE80211_MAX_QUEUES];
859f0706e82SJiri Benc 	struct tasklet_struct tx_pending_tasklet;
860f0706e82SJiri Benc 
861a6a67db2SJohannes Berg 	atomic_t agg_queue_stop[IEEE80211_MAX_QUEUES];
862cd8ffc80SJohannes Berg 
863f0706e82SJiri Benc 	/* number of interfaces with corresponding IFF_ flags */
86453918994SJohannes Berg 	atomic_t iff_allmultis, iff_promiscs;
865f0706e82SJiri Benc 
866f0706e82SJiri Benc 	struct rate_control_ref *rate_ctrl;
867f0706e82SJiri Benc 
8685f9f1812SFelix Fietkau 	struct crypto_cipher *wep_tx_tfm;
8695f9f1812SFelix Fietkau 	struct crypto_cipher *wep_rx_tfm;
870f0706e82SJiri Benc 	u32 wep_iv;
871f0706e82SJiri Benc 
872c771c9d8SJohannes Berg 	/* see iface.c */
87379010420SJohannes Berg 	struct list_head interfaces;
874c771c9d8SJohannes Berg 	struct mutex iflist_mtx;
87579010420SJohannes Berg 
876b16bd15cSJohannes Berg 	/*
877ad0e2b5aSJohannes Berg 	 * Key mutex, protects sdata's key_list and sta_info's
878b16bd15cSJohannes Berg 	 * key pointers (write access, they're RCU.)
879b16bd15cSJohannes Berg 	 */
880ad0e2b5aSJohannes Berg 	struct mutex key_mtx;
881b16bd15cSJohannes Berg 
882a1699b75SJohannes Berg 	/* mutex for scan and work locking */
883a1699b75SJohannes Berg 	struct mutex mtx;
884b16bd15cSJohannes Berg 
885c2b13452SJohannes Berg 	/* Scanning and BSS list */
886fbe9c429SHelmut Schaa 	unsigned long scanning;
8872a519311SJohannes Berg 	struct cfg80211_ssid scan_ssid;
8885ba63533SJohannes Berg 	struct cfg80211_scan_request *int_scan_req;
8894d36ec58SJohannes Berg 	struct cfg80211_scan_request *scan_req, *hw_scan_req;
8902a519311SJohannes Berg 	struct ieee80211_channel *scan_channel;
8914d36ec58SJohannes Berg 	enum ieee80211_band hw_scan_band;
892f0706e82SJiri Benc 	int scan_channel_idx;
893de95a54bSJohannes Berg 	int scan_ies_len;
8948318d78aSJohannes Berg 
89579f460caSLuciano Coelho 	bool sched_scanning;
89679f460caSLuciano Coelho 	struct ieee80211_sched_scan_ies sched_scan_ies;
89785a9994aSLuciano Coelho 	struct work_struct sched_scan_stopped_work;
89879f460caSLuciano Coelho 
899df13cce5SHelmut Schaa 	unsigned long leave_oper_channel_time;
900977923b0SHelmut Schaa 	enum mac80211_scan_state next_scan_state;
901f0706e82SJiri Benc 	struct delayed_work scan_work;
902491775a5SJohannes Berg 	struct ieee80211_sub_if_data *scan_sdata;
9030aaffa9bSJohannes Berg 	enum nl80211_channel_type _oper_channel_type;
9042a519311SJohannes Berg 	struct ieee80211_channel *oper_channel, *csa_channel;
905f0706e82SJiri Benc 
906b8bc4b0aSJohannes Berg 	/* Temporary remain-on-channel for off-channel operations */
907b8bc4b0aSJohannes Berg 	struct ieee80211_channel *tmp_channel;
908b8bc4b0aSJohannes Berg 	enum nl80211_channel_type tmp_channel_type;
909b8bc4b0aSJohannes Berg 
910f0706e82SJiri Benc 	/* SNMP counters */
911f0706e82SJiri Benc 	/* dot11CountersTable */
912f0706e82SJiri Benc 	u32 dot11TransmittedFragmentCount;
913f0706e82SJiri Benc 	u32 dot11MulticastTransmittedFrameCount;
914f0706e82SJiri Benc 	u32 dot11FailedCount;
915f0706e82SJiri Benc 	u32 dot11RetryCount;
916f0706e82SJiri Benc 	u32 dot11MultipleRetryCount;
917f0706e82SJiri Benc 	u32 dot11FrameDuplicateCount;
918f0706e82SJiri Benc 	u32 dot11ReceivedFragmentCount;
919f0706e82SJiri Benc 	u32 dot11MulticastReceivedFrameCount;
920f0706e82SJiri Benc 	u32 dot11TransmittedFrameCount;
921f0706e82SJiri Benc 
922f0706e82SJiri Benc #ifdef CONFIG_MAC80211_LEDS
923f0706e82SJiri Benc 	int tx_led_counter, rx_led_counter;
924cdcb006fSIvo van Doorn 	struct led_trigger *tx_led, *rx_led, *assoc_led, *radio_led;
925e1e54068SJohannes Berg 	struct tpt_led_trigger *tpt_led_trigger;
926cdcb006fSIvo van Doorn 	char tx_led_name[32], rx_led_name[32],
927cdcb006fSIvo van Doorn 	     assoc_led_name[32], radio_led_name[32];
928f0706e82SJiri Benc #endif
929f0706e82SJiri Benc 
930f0706e82SJiri Benc #ifdef CONFIG_MAC80211_DEBUG_COUNTERS
931f0706e82SJiri Benc 	/* TX/RX handler statistics */
932f0706e82SJiri Benc 	unsigned int tx_handlers_drop;
933f0706e82SJiri Benc 	unsigned int tx_handlers_queued;
934f0706e82SJiri Benc 	unsigned int tx_handlers_drop_unencrypted;
935f0706e82SJiri Benc 	unsigned int tx_handlers_drop_fragment;
936f0706e82SJiri Benc 	unsigned int tx_handlers_drop_wep;
937f0706e82SJiri Benc 	unsigned int tx_handlers_drop_not_assoc;
938f0706e82SJiri Benc 	unsigned int tx_handlers_drop_unauth_port;
939f0706e82SJiri Benc 	unsigned int rx_handlers_drop;
940f0706e82SJiri Benc 	unsigned int rx_handlers_queued;
941f0706e82SJiri Benc 	unsigned int rx_handlers_drop_nullfunc;
942f0706e82SJiri Benc 	unsigned int rx_handlers_drop_defrag;
943f0706e82SJiri Benc 	unsigned int rx_handlers_drop_short;
944f0706e82SJiri Benc 	unsigned int rx_handlers_drop_passive_scan;
945f0706e82SJiri Benc 	unsigned int tx_expand_skb_head;
946f0706e82SJiri Benc 	unsigned int tx_expand_skb_head_cloned;
947f0706e82SJiri Benc 	unsigned int rx_expand_skb_head;
948f0706e82SJiri Benc 	unsigned int rx_expand_skb_head2;
949f0706e82SJiri Benc 	unsigned int rx_handlers_fragments;
950f0706e82SJiri Benc 	unsigned int tx_status_drop;
951f0706e82SJiri Benc #define I802_DEBUG_INC(c) (c)++
952f0706e82SJiri Benc #else /* CONFIG_MAC80211_DEBUG_COUNTERS */
953f0706e82SJiri Benc #define I802_DEBUG_INC(c) do { } while (0)
954f0706e82SJiri Benc #endif /* CONFIG_MAC80211_DEBUG_COUNTERS */
955f0706e82SJiri Benc 
956f0706e82SJiri Benc 
957f0706e82SJiri Benc 	int total_ps_buffered; /* total number of all buffered unicast and
958f0706e82SJiri Benc 				* multicast packets for power saving stations
959f0706e82SJiri Benc 				*/
960f0706e82SJiri Benc 	int wifi_wme_noack_test;
961f0706e82SJiri Benc 	unsigned int wmm_acm; /* bit field of ACM bits (BIT(802.1D tag)) */
962520eb820SKalle Valo 
96350ae0cf1SKalle Valo 	/*
96450ae0cf1SKalle Valo 	 * Bitmask of enabled u-apsd queues,
96550ae0cf1SKalle Valo 	 * IEEE80211_WMM_IE_STA_QOSINFO_AC_BE & co. Needs a new association
96650ae0cf1SKalle Valo 	 * to take effect.
96750ae0cf1SKalle Valo 	 */
96850ae0cf1SKalle Valo 	unsigned int uapsd_queues;
96950ae0cf1SKalle Valo 
97050ae0cf1SKalle Valo 	/*
97150ae0cf1SKalle Valo 	 * Maximum number of buffered frames AP can deliver during a
97250ae0cf1SKalle Valo 	 * service period, IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL or similar.
97350ae0cf1SKalle Valo 	 * Needs a new association to take effect.
97450ae0cf1SKalle Valo 	 */
97550ae0cf1SKalle Valo 	unsigned int uapsd_max_sp_len;
97650ae0cf1SKalle Valo 
977572e0012SKalle Valo 	bool pspolling;
978b203ffc3SJouni Malinen 	bool offchannel_ps_enabled;
979965bedadSJohannes Berg 	/*
980965bedadSJohannes Berg 	 * PS can only be enabled when we have exactly one managed
981965bedadSJohannes Berg 	 * interface (and monitors) in PS, this then points there.
982965bedadSJohannes Berg 	 */
983965bedadSJohannes Berg 	struct ieee80211_sub_if_data *ps_sdata;
984520eb820SKalle Valo 	struct work_struct dynamic_ps_enable_work;
985520eb820SKalle Valo 	struct work_struct dynamic_ps_disable_work;
986520eb820SKalle Valo 	struct timer_list dynamic_ps_timer;
98710f644a4SJohannes Berg 	struct notifier_block network_latency_notifier;
9882b2c009eSJuuso Oikarinen 	struct notifier_block ifa_notifier;
989f0706e82SJiri Benc 
990ff616381SJuuso Oikarinen 	/*
991ff616381SJuuso Oikarinen 	 * The dynamic ps timeout configured from user space via WEXT -
992ff616381SJuuso Oikarinen 	 * this will override whatever chosen by mac80211 internally.
993ff616381SJuuso Oikarinen 	 */
994ff616381SJuuso Oikarinen 	int dynamic_ps_forced_timeout;
995f90754c1SJuuso Oikarinen 	int dynamic_ps_user_timeout;
996f90754c1SJuuso Oikarinen 	bool disable_dynamic_ps;
997ff616381SJuuso Oikarinen 
9982bf30fabSJohannes Berg 	int user_power_level; /* in dBm */
999a8302de9SVasanthakumar Thiagarajan 	int power_constr_level; /* in dBm */
10002bf30fabSJohannes Berg 
10010f78231bSJohannes Berg 	enum ieee80211_smps_mode smps_mode;
10020f78231bSJohannes Berg 
1003f2753ddbSJohannes Berg 	struct work_struct restart_work;
1004f2753ddbSJohannes Berg 
1005e9f207f0SJiri Benc #ifdef CONFIG_MAC80211_DEBUGFS
1006e9f207f0SJiri Benc 	struct local_debugfsdentries {
10074b7679a5SJohannes Berg 		struct dentry *rcdir;
1008e9f207f0SJiri Benc 		struct dentry *keys;
1009e9f207f0SJiri Benc 	} debugfs;
1010e9f207f0SJiri Benc #endif
10114e6cbfd0SJohn W. Linville 
101221f83589SJohannes Berg 	struct ieee80211_channel *hw_roc_channel;
101321f83589SJohannes Berg 	struct net_device *hw_roc_dev;
10144334ec85SJohannes Berg 	struct sk_buff *hw_roc_skb, *hw_roc_skb_for_status;
101521f83589SJohannes Berg 	struct work_struct hw_roc_start, hw_roc_done;
101621f83589SJohannes Berg 	enum nl80211_channel_type hw_roc_channel_type;
101721f83589SJohannes Berg 	unsigned int hw_roc_duration;
101821f83589SJohannes Berg 	u32 hw_roc_cookie;
101990fc4b3aSJohannes Berg 	bool hw_roc_for_tx;
102021f83589SJohannes Berg 
1021a729cff8SJohannes Berg 	struct idr ack_status_frames;
1022a729cff8SJohannes Berg 	spinlock_t ack_status_lock;
1023a729cff8SJohannes Berg 
10244e6cbfd0SJohn W. Linville 	/* dummy netdev for use w/ NAPI */
10254e6cbfd0SJohn W. Linville 	struct net_device napi_dev;
10264e6cbfd0SJohn W. Linville 
10274e6cbfd0SJohn W. Linville 	struct napi_struct napi;
1028f0706e82SJiri Benc };
1029f0706e82SJiri Benc 
10303e122be0SJohannes Berg static inline struct ieee80211_sub_if_data *
10313e122be0SJohannes Berg IEEE80211_DEV_TO_SUB_IF(struct net_device *dev)
10323e122be0SJohannes Berg {
10333e122be0SJohannes Berg 	return netdev_priv(dev);
10343e122be0SJohannes Berg }
10353e122be0SJohannes Berg 
1036c1475ca9SJohannes Berg /* this struct represents 802.11n's RA/TID combination */
1037eadc8d9eSRon Rindjunsky struct ieee80211_ra_tid {
1038eadc8d9eSRon Rindjunsky 	u8 ra[ETH_ALEN];
1039eadc8d9eSRon Rindjunsky 	u16 tid;
1040eadc8d9eSRon Rindjunsky };
1041eadc8d9eSRon Rindjunsky 
1042f0706e82SJiri Benc static inline struct ieee80211_local *hw_to_local(
1043f0706e82SJiri Benc 	struct ieee80211_hw *hw)
1044f0706e82SJiri Benc {
1045f0706e82SJiri Benc 	return container_of(hw, struct ieee80211_local, hw);
1046f0706e82SJiri Benc }
1047f0706e82SJiri Benc 
1048f0706e82SJiri Benc static inline struct ieee80211_hw *local_to_hw(
1049f0706e82SJiri Benc 	struct ieee80211_local *local)
1050f0706e82SJiri Benc {
1051f0706e82SJiri Benc 	return &local->hw;
1052f0706e82SJiri Benc }
1053f0706e82SJiri Benc 
1054f0706e82SJiri Benc 
1055571ecf67SJohannes Berg static inline int ieee80211_bssid_match(const u8 *raddr, const u8 *addr)
1056571ecf67SJohannes Berg {
1057571ecf67SJohannes Berg 	return compare_ether_addr(raddr, addr) == 0 ||
1058571ecf67SJohannes Berg 	       is_broadcast_ether_addr(raddr);
1059571ecf67SJohannes Berg }
1060571ecf67SJohannes Berg 
1061571ecf67SJohannes Berg 
1062e8975581SJohannes Berg int ieee80211_hw_config(struct ieee80211_local *local, u32 changed);
10635cf121c3SJohannes Berg void ieee80211_tx_set_protected(struct ieee80211_tx_data *tx);
10649c6bd790SJohannes Berg void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata,
10659c6bd790SJohannes Berg 				      u32 changed);
10660d143fe1SJohannes Berg void ieee80211_configure_filter(struct ieee80211_local *local);
106746900298SJohannes Berg u32 ieee80211_reset_erp_info(struct ieee80211_sub_if_data *sdata);
1068f0706e82SJiri Benc 
106946900298SJohannes Berg /* STA code */
10709c6bd790SJohannes Berg void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata);
107177fdaa12SJohannes Berg int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata,
107277fdaa12SJohannes Berg 		       struct cfg80211_auth_request *req);
107377fdaa12SJohannes Berg int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,
107477fdaa12SJohannes Berg 			struct cfg80211_assoc_request *req);
107577fdaa12SJohannes Berg int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata,
1076667503ddSJohannes Berg 			 struct cfg80211_deauth_request *req,
1077667503ddSJohannes Berg 			 void *cookie);
107877fdaa12SJohannes Berg int ieee80211_mgd_disassoc(struct ieee80211_sub_if_data *sdata,
1079667503ddSJohannes Berg 			   struct cfg80211_disassoc_request *req,
1080667503ddSJohannes Berg 			   void *cookie);
1081572e0012SKalle Valo void ieee80211_send_pspoll(struct ieee80211_local *local,
1082572e0012SKalle Valo 			   struct ieee80211_sub_if_data *sdata);
108310f644a4SJohannes Berg void ieee80211_recalc_ps(struct ieee80211_local *local, s32 latency);
108410f644a4SJohannes Berg int ieee80211_max_network_latency(struct notifier_block *nb,
108510f644a4SJohannes Berg 				  unsigned long data, void *dummy);
10862b2c009eSJuuso Oikarinen int ieee80211_set_arp_filter(struct ieee80211_sub_if_data *sdata);
1087cc32abd4SJohannes Berg void ieee80211_sta_process_chanswitch(struct ieee80211_sub_if_data *sdata,
1088cc32abd4SJohannes Berg 				      struct ieee80211_channel_sw_ie *sw_elem,
10895ce6e438SJohannes Berg 				      struct ieee80211_bss *bss,
10905ce6e438SJohannes Berg 				      u64 timestamp);
10915bb644a0SJohannes Berg void ieee80211_sta_quiesce(struct ieee80211_sub_if_data *sdata);
10925bb644a0SJohannes Berg void ieee80211_sta_restart(struct ieee80211_sub_if_data *sdata);
10931fa57d01SJohannes Berg void ieee80211_sta_work(struct ieee80211_sub_if_data *sdata);
10941fa57d01SJohannes Berg void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
10951fa57d01SJohannes Berg 				  struct sk_buff *skb);
1096d3a910a8SLuis R. Rodriguez void ieee80211_sta_reset_beacon_monitor(struct ieee80211_sub_if_data *sdata);
1097be099e82SLuis R. Rodriguez void ieee80211_sta_reset_conn_monitor(struct ieee80211_sub_if_data *sdata);
10989c6bd790SJohannes Berg 
109946900298SJohannes Berg /* IBSS code */
110046900298SJohannes Berg void ieee80211_ibss_notify_scan_completed(struct ieee80211_local *local);
110146900298SJohannes Berg void ieee80211_ibss_setup_sdata(struct ieee80211_sub_if_data *sdata);
110246900298SJohannes Berg struct sta_info *ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata,
110334e89507SJohannes Berg 					u8 *bssid, u8 *addr, u32 supp_rates,
110434e89507SJohannes Berg 					gfp_t gfp);
1105af8cdcd8SJohannes Berg int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata,
1106af8cdcd8SJohannes Berg 			struct cfg80211_ibss_params *params);
1107af8cdcd8SJohannes Berg int ieee80211_ibss_leave(struct ieee80211_sub_if_data *sdata);
11085bb644a0SJohannes Berg void ieee80211_ibss_quiesce(struct ieee80211_sub_if_data *sdata);
11095bb644a0SJohannes Berg void ieee80211_ibss_restart(struct ieee80211_sub_if_data *sdata);
11101fa57d01SJohannes Berg void ieee80211_ibss_work(struct ieee80211_sub_if_data *sdata);
11111fa57d01SJohannes Berg void ieee80211_ibss_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
11121fa57d01SJohannes Berg 				   struct sk_buff *skb);
11131fa57d01SJohannes Berg 
11141fa57d01SJohannes Berg /* mesh code */
11151fa57d01SJohannes Berg void ieee80211_mesh_work(struct ieee80211_sub_if_data *sdata);
11161fa57d01SJohannes Berg void ieee80211_mesh_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
11171fa57d01SJohannes Berg 				   struct sk_buff *skb);
111846900298SJohannes Berg 
11199c6bd790SJohannes Berg /* scan/BSS handling */
112046900298SJohannes Berg void ieee80211_scan_work(struct work_struct *work);
1121f3b85252SJohannes Berg int ieee80211_request_internal_scan(struct ieee80211_sub_if_data *sdata,
1122be4a4b6aSJohannes Berg 				    const u8 *ssid, u8 ssid_len,
1123be4a4b6aSJohannes Berg 				    struct ieee80211_channel *chan);
1124c2b13452SJohannes Berg int ieee80211_request_scan(struct ieee80211_sub_if_data *sdata,
11252a519311SJohannes Berg 			   struct cfg80211_scan_request *req);
11265bb644a0SJohannes Berg void ieee80211_scan_cancel(struct ieee80211_local *local);
1127c2b13452SJohannes Berg ieee80211_rx_result
1128f1d58c25SJohannes Berg ieee80211_scan_rx(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb);
11299c6bd790SJohannes Berg 
11300a51b27eSJohannes Berg void ieee80211_mlme_notify_scan_completed(struct ieee80211_local *local);
1131c2b13452SJohannes Berg struct ieee80211_bss *
113298c8fccfSJohannes Berg ieee80211_bss_info_update(struct ieee80211_local *local,
113398c8fccfSJohannes Berg 			  struct ieee80211_rx_status *rx_status,
113498c8fccfSJohannes Berg 			  struct ieee80211_mgmt *mgmt,
113598c8fccfSJohannes Berg 			  size_t len,
113698c8fccfSJohannes Berg 			  struct ieee802_11_elems *elems,
11372a519311SJohannes Berg 			  struct ieee80211_channel *channel,
11382a519311SJohannes Berg 			  bool beacon);
1139c2b13452SJohannes Berg struct ieee80211_bss *
11405484e237SJohannes Berg ieee80211_rx_bss_get(struct ieee80211_local *local, u8 *bssid, int freq,
11415484e237SJohannes Berg 		     u8 *ssid, u8 ssid_len);
114298c8fccfSJohannes Berg void ieee80211_rx_bss_put(struct ieee80211_local *local,
1143c2b13452SJohannes Berg 			  struct ieee80211_bss *bss);
1144ee385855SLuis Carlos Cobo 
114579f460caSLuciano Coelho /* scheduled scan handling */
114679f460caSLuciano Coelho int ieee80211_request_sched_scan_start(struct ieee80211_sub_if_data *sdata,
114779f460caSLuciano Coelho 				       struct cfg80211_sched_scan_request *req);
114885a9994aSLuciano Coelho int ieee80211_request_sched_scan_stop(struct ieee80211_sub_if_data *sdata);
114985a9994aSLuciano Coelho void ieee80211_sched_scan_stopped_work(struct work_struct *work);
115079f460caSLuciano Coelho 
1151b203ffc3SJouni Malinen /* off-channel helpers */
1152b23b025fSBen Greear bool ieee80211_cfg_on_oper_channel(struct ieee80211_local *local);
1153b23b025fSBen Greear void ieee80211_offchannel_enable_all_ps(struct ieee80211_local *local,
1154b23b025fSBen Greear 					bool tell_ap);
1155b23b025fSBen Greear void ieee80211_offchannel_stop_vifs(struct ieee80211_local *local,
1156b23b025fSBen Greear 				    bool offchannel_ps_enable);
1157b203ffc3SJouni Malinen void ieee80211_offchannel_return(struct ieee80211_local *local,
1158b23b025fSBen Greear 				 bool enable_beaconing,
1159b23b025fSBen Greear 				 bool offchannel_ps_disable);
116021f83589SJohannes Berg void ieee80211_hw_roc_setup(struct ieee80211_local *local);
1161b203ffc3SJouni Malinen 
11623e122be0SJohannes Berg /* interface handling */
116347846c9bSJohannes Berg int ieee80211_iface_init(void);
116447846c9bSJohannes Berg void ieee80211_iface_exit(void);
11653e122be0SJohannes Berg int ieee80211_if_add(struct ieee80211_local *local, const char *name,
116605c914feSJohannes Berg 		     struct net_device **new_dev, enum nl80211_iftype type,
1167ee385855SLuis Carlos Cobo 		     struct vif_params *params);
1168f3947e2dSJohannes Berg int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata,
116905c914feSJohannes Berg 			     enum nl80211_iftype type);
1170f698d856SJasper Bryant-Greene void ieee80211_if_remove(struct ieee80211_sub_if_data *sdata);
117175636525SJohannes Berg void ieee80211_remove_interfaces(struct ieee80211_local *local);
11725cff20e6SJohannes Berg u32 __ieee80211_recalc_idle(struct ieee80211_local *local);
11735cff20e6SJohannes Berg void ieee80211_recalc_idle(struct ieee80211_local *local);
117485416a4fSChristian Lamparter void ieee80211_adjust_monitor_flags(struct ieee80211_sub_if_data *sdata,
117585416a4fSChristian Lamparter 				    const int offset);
1176f0706e82SJiri Benc 
11779607e6b6SJohannes Berg static inline bool ieee80211_sdata_running(struct ieee80211_sub_if_data *sdata)
11789607e6b6SJohannes Berg {
117934d4bc4dSJohannes Berg 	return test_bit(SDATA_STATE_RUNNING, &sdata->state);
11809607e6b6SJohannes Berg }
11819607e6b6SJohannes Berg 
1182e2ebc74dSJohannes Berg /* tx handling */
1183e2ebc74dSJohannes Berg void ieee80211_clear_tx_pending(struct ieee80211_local *local);
1184e2ebc74dSJohannes Berg void ieee80211_tx_pending(unsigned long data);
1185d0cf9c0dSStephen Hemminger netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb,
1186d0cf9c0dSStephen Hemminger 					 struct net_device *dev);
1187d0cf9c0dSStephen Hemminger netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
1188d0cf9c0dSStephen Hemminger 				       struct net_device *dev);
1189e2ebc74dSJohannes Berg 
1190de1ede7aSJohannes Berg /* HT */
1191ae5eb026SJohannes Berg void ieee80211_ht_cap_ie_to_sta_ht_cap(struct ieee80211_supported_band *sband,
1192ae5eb026SJohannes Berg 				       struct ieee80211_ht_cap *ht_cap_ie,
1193d9fe60deSJohannes Berg 				       struct ieee80211_sta_ht_cap *ht_cap);
1194b8695a8fSJohannes Berg void ieee80211_send_delba(struct ieee80211_sub_if_data *sdata,
1195b8695a8fSJohannes Berg 			  const u8 *da, u16 tid,
1196b8695a8fSJohannes Berg 			  u16 initiator, u16 reason_code);
11970f78231bSJohannes Berg int ieee80211_send_smps_action(struct ieee80211_sub_if_data *sdata,
11980f78231bSJohannes Berg 			       enum ieee80211_smps_mode smps, const u8 *da,
11990f78231bSJohannes Berg 			       const u8 *bssid);
1200d1f5b7a3SJohannes Berg void ieee80211_request_smps_work(struct work_struct *work);
1201de1ede7aSJohannes Berg 
12027c3b1dd8SJohannes Berg void ___ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid,
120353f73c09SJohannes Berg 				     u16 initiator, u16 reason, bool stop);
1204849b7967SJohannes Berg void __ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid,
120553f73c09SJohannes Berg 				    u16 initiator, u16 reason, bool stop);
120653f73c09SJohannes Berg void ieee80211_sta_tear_down_BA_sessions(struct sta_info *sta, bool tx);
1207de1ede7aSJohannes Berg void ieee80211_process_delba(struct ieee80211_sub_if_data *sdata,
1208de1ede7aSJohannes Berg 			     struct sta_info *sta,
1209de1ede7aSJohannes Berg 			     struct ieee80211_mgmt *mgmt, size_t len);
1210de1ede7aSJohannes Berg void ieee80211_process_addba_resp(struct ieee80211_local *local,
1211de1ede7aSJohannes Berg 				  struct sta_info *sta,
1212de1ede7aSJohannes Berg 				  struct ieee80211_mgmt *mgmt,
1213de1ede7aSJohannes Berg 				  size_t len);
1214de1ede7aSJohannes Berg void ieee80211_process_addba_request(struct ieee80211_local *local,
1215de1ede7aSJohannes Berg 				     struct sta_info *sta,
1216de1ede7aSJohannes Berg 				     struct ieee80211_mgmt *mgmt,
1217de1ede7aSJohannes Berg 				     size_t len);
1218de1ede7aSJohannes Berg 
1219849b7967SJohannes Berg int __ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
122053f73c09SJohannes Berg 				   enum ieee80211_back_parties initiator,
122153f73c09SJohannes Berg 				   bool tx);
122267c282c0SJohannes Berg int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
122353f73c09SJohannes Berg 				    enum ieee80211_back_parties initiator,
122453f73c09SJohannes Berg 				    bool tx);
12255d22c89bSJohannes Berg void ieee80211_start_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u16 tid);
12265d22c89bSJohannes Berg void ieee80211_stop_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u8 tid);
122767c282c0SJohannes Berg void ieee80211_ba_session_work(struct work_struct *work);
122867c282c0SJohannes Berg void ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid);
12292bff8ebfSChristian Lamparter void ieee80211_release_reorder_timeout(struct sta_info *sta, int tid);
1230849b7967SJohannes Berg 
123139192c0bSJohannes Berg /* Spectrum management */
123239192c0bSJohannes Berg void ieee80211_process_measurement_req(struct ieee80211_sub_if_data *sdata,
123339192c0bSJohannes Berg 				       struct ieee80211_mgmt *mgmt,
123439192c0bSJohannes Berg 				       size_t len);
123539192c0bSJohannes Berg 
1236f2753ddbSJohannes Berg /* Suspend/resume and hw reconfiguration */
1237f2753ddbSJohannes Berg int ieee80211_reconfig(struct ieee80211_local *local);
123884f6a01cSJohannes Berg void ieee80211_stop_device(struct ieee80211_local *local);
1239f2753ddbSJohannes Berg 
1240827b1fb4SJohannes Berg #ifdef CONFIG_PM
1241eecc4800SJohannes Berg int __ieee80211_suspend(struct ieee80211_hw *hw,
1242eecc4800SJohannes Berg 			struct cfg80211_wowlan *wowlan);
1243f2753ddbSJohannes Berg 
1244f2753ddbSJohannes Berg static inline int __ieee80211_resume(struct ieee80211_hw *hw)
1245f2753ddbSJohannes Berg {
124685f72bc8SJohn W. Linville 	struct ieee80211_local *local = hw_to_local(hw);
124785f72bc8SJohn W. Linville 
124885f72bc8SJohn W. Linville 	WARN(test_bit(SCAN_HW_SCANNING, &local->scanning),
124985f72bc8SJohn W. Linville 		"%s: resume with hardware scan still in progress\n",
125085f72bc8SJohn W. Linville 		wiphy_name(hw->wiphy));
125185f72bc8SJohn W. Linville 
1252f2753ddbSJohannes Berg 	return ieee80211_reconfig(hw_to_local(hw));
1253f2753ddbSJohannes Berg }
1254827b1fb4SJohannes Berg #else
1255eecc4800SJohannes Berg static inline int __ieee80211_suspend(struct ieee80211_hw *hw,
1256eecc4800SJohannes Berg 				      struct cfg80211_wowlan *wowlan)
1257827b1fb4SJohannes Berg {
1258827b1fb4SJohannes Berg 	return 0;
1259827b1fb4SJohannes Berg }
1260f2753ddbSJohannes Berg 
1261827b1fb4SJohannes Berg static inline int __ieee80211_resume(struct ieee80211_hw *hw)
1262827b1fb4SJohannes Berg {
1263827b1fb4SJohannes Berg 	return 0;
1264827b1fb4SJohannes Berg }
1265827b1fb4SJohannes Berg #endif
1266665af4fcSBob Copeland 
1267c2d1560aSJohannes Berg /* utility functions/constants */
1268c2d1560aSJohannes Berg extern void *mac80211_wiphy_privid; /* for wiphy privid */
126971364716SRon Rindjunsky u8 *ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t len,
127005c914feSJohannes Berg 			enum nl80211_iftype type);
1271c2d1560aSJohannes Berg int ieee80211_frame_duration(struct ieee80211_local *local, size_t len,
1272c2d1560aSJohannes Berg 			     int rate, int erp, int short_preamble);
1273f698d856SJasper Bryant-Greene void mac80211_ev_michael_mic_failure(struct ieee80211_sub_if_data *sdata, int keyidx,
1274e6d6e342SJohannes Berg 				     struct ieee80211_hdr *hdr, const u8 *tsc,
1275e6d6e342SJohannes Berg 				     gfp_t gfp);
12765825fe10SJohannes Berg void ieee80211_set_wmm_default(struct ieee80211_sub_if_data *sdata);
1277ce662b44SJohannes Berg void ieee80211_xmit(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb);
127862ae67beSJohannes Berg void ieee80211_tx_skb(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb);
12799c6bd790SJohannes Berg void ieee802_11_parse_elems(u8 *start, size_t len,
12809c6bd790SJohannes Berg 			    struct ieee802_11_elems *elems);
1281d91f36dbSJohannes Berg u32 ieee802_11_parse_elems_crc(u8 *start, size_t len,
1282d91f36dbSJohannes Berg 			       struct ieee802_11_elems *elems,
1283d91f36dbSJohannes Berg 			       u64 filter, u32 crc);
1284881d948cSJohannes Berg u32 ieee80211_mandatory_rates(struct ieee80211_local *local,
128596dd22acSJohannes Berg 			      enum ieee80211_band band);
1286f0706e82SJiri Benc 
1287520eb820SKalle Valo void ieee80211_dynamic_ps_enable_work(struct work_struct *work);
1288520eb820SKalle Valo void ieee80211_dynamic_ps_disable_work(struct work_struct *work);
1289520eb820SKalle Valo void ieee80211_dynamic_ps_timer(unsigned long data);
1290a97b77b9SVivek Natarajan void ieee80211_send_nullfunc(struct ieee80211_local *local,
1291a97b77b9SVivek Natarajan 			     struct ieee80211_sub_if_data *sdata,
1292a97b77b9SVivek Natarajan 			     int powersave);
12933cf335d5SKalle Valo void ieee80211_sta_rx_notify(struct ieee80211_sub_if_data *sdata,
12943cf335d5SKalle Valo 			     struct ieee80211_hdr *hdr);
12954e5ff376SFelix Fietkau void ieee80211_sta_tx_notify(struct ieee80211_sub_if_data *sdata,
129604ac3c0eSFelix Fietkau 			     struct ieee80211_hdr *hdr, bool ack);
12971e4dcd01SJuuso Oikarinen void ieee80211_beacon_connection_loss_work(struct work_struct *work);
1298520eb820SKalle Valo 
1299ce7c9111SKalle Valo void ieee80211_wake_queues_by_reason(struct ieee80211_hw *hw,
1300ce7c9111SKalle Valo 				     enum queue_stop_reason reason);
1301ce7c9111SKalle Valo void ieee80211_stop_queues_by_reason(struct ieee80211_hw *hw,
1302ce7c9111SKalle Valo 				     enum queue_stop_reason reason);
130396f5e66eSJohannes Berg void ieee80211_wake_queue_by_reason(struct ieee80211_hw *hw, int queue,
130496f5e66eSJohannes Berg 				    enum queue_stop_reason reason);
130596f5e66eSJohannes Berg void ieee80211_stop_queue_by_reason(struct ieee80211_hw *hw, int queue,
130696f5e66eSJohannes Berg 				    enum queue_stop_reason reason);
13078f77f384SJohannes Berg void ieee80211_add_pending_skb(struct ieee80211_local *local,
13088f77f384SJohannes Berg 			       struct sk_buff *skb);
1309b0b97a8aSJohannes Berg void ieee80211_add_pending_skbs(struct ieee80211_local *local,
13108f77f384SJohannes Berg 				struct sk_buff_head *skbs);
1311b0b97a8aSJohannes Berg void ieee80211_add_pending_skbs_fn(struct ieee80211_local *local,
131250a9432dSJohannes Berg 				   struct sk_buff_head *skbs,
131350a9432dSJohannes Berg 				   void (*fn)(void *data), void *data);
1314ce7c9111SKalle Valo 
131546900298SJohannes Berg void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata,
131646900298SJohannes Berg 			 u16 transaction, u16 auth_alg,
1317fffd0934SJohannes Berg 			 u8 *extra, size_t extra_len, const u8 *bssid,
1318fffd0934SJohannes Berg 			 const u8 *key, u8 key_len, u8 key_idx);
1319de95a54bSJohannes Berg int ieee80211_build_preq_ies(struct ieee80211_local *local, u8 *buffer,
13204d36ec58SJohannes Berg 			     const u8 *ie, size_t ie_len,
1321651b5225SJouni Malinen 			     enum ieee80211_band band, u32 rate_mask,
1322651b5225SJouni Malinen 			     u8 channel);
1323a619a4c0SJuuso Oikarinen struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata,
132485a237feSJohannes Berg 					  u8 *dst, u32 ratemask,
1325a619a4c0SJuuso Oikarinen 					  const u8 *ssid, size_t ssid_len,
1326a806c558SPaul Stewart 					  const u8 *ie, size_t ie_len,
1327a806c558SPaul Stewart 					  bool directed);
132846900298SJohannes Berg void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst,
1329de95a54bSJohannes Berg 			      const u8 *ssid, size_t ssid_len,
1330a806c558SPaul Stewart 			      const u8 *ie, size_t ie_len,
1331aad14cebSRajkumar Manoharan 			      u32 ratemask, bool directed, bool no_cck);
133246900298SJohannes Berg 
133346900298SJohannes Berg void ieee80211_sta_def_wmm_params(struct ieee80211_sub_if_data *sdata,
133446900298SJohannes Berg 				  const size_t supp_rates_len,
133546900298SJohannes Berg 				  const u8 *supp_rates);
133646900298SJohannes Berg u32 ieee80211_sta_get_rates(struct ieee80211_local *local,
133746900298SJohannes Berg 			    struct ieee802_11_elems *elems,
133846900298SJohannes Berg 			    enum ieee80211_band band);
13390f78231bSJohannes Berg int __ieee80211_request_smps(struct ieee80211_sub_if_data *sdata,
13400f78231bSJohannes Berg 			     enum ieee80211_smps_mode smps_mode);
1341025e6be2SJohannes Berg void ieee80211_recalc_smps(struct ieee80211_local *local);
134246900298SJohannes Berg 
13438e664fb3SJohannes Berg size_t ieee80211_ie_split(const u8 *ies, size_t ielen,
13448e664fb3SJohannes Berg 			  const u8 *ids, int n_ids, size_t offset);
13458e664fb3SJohannes Berg size_t ieee80211_ie_split_vendor(const u8 *ies, size_t ielen, size_t offset);
134642e7aa77SAlexander Simon u8 *ieee80211_ie_build_ht_cap(u8 *pos, struct ieee80211_supported_band *sband,
134742e7aa77SAlexander Simon 			      u16 cap);
134842e7aa77SAlexander Simon u8 *ieee80211_ie_build_ht_info(u8 *pos,
134942e7aa77SAlexander Simon 				struct ieee80211_sta_ht_cap *ht_cap,
135042e7aa77SAlexander Simon 				struct ieee80211_channel *channel,
135142e7aa77SAlexander Simon 				enum nl80211_channel_type channel_type);
13528e664fb3SJohannes Berg 
1353af6b6374SJohannes Berg /* internal work items */
1354af6b6374SJohannes Berg void ieee80211_work_init(struct ieee80211_local *local);
1355af6b6374SJohannes Berg void ieee80211_add_work(struct ieee80211_work *wk);
1356af6b6374SJohannes Berg void free_work(struct ieee80211_work *wk);
1357af6b6374SJohannes Berg void ieee80211_work_purge(struct ieee80211_sub_if_data *sdata);
1358af6b6374SJohannes Berg ieee80211_rx_result ieee80211_work_rx_mgmt(struct ieee80211_sub_if_data *sdata,
1359af6b6374SJohannes Berg 					   struct sk_buff *skb);
1360b8bc4b0aSJohannes Berg int ieee80211_wk_remain_on_channel(struct ieee80211_sub_if_data *sdata,
1361b8bc4b0aSJohannes Berg 				   struct ieee80211_channel *chan,
1362b8bc4b0aSJohannes Berg 				   enum nl80211_channel_type channel_type,
1363b8bc4b0aSJohannes Berg 				   unsigned int duration, u64 *cookie);
1364b8bc4b0aSJohannes Berg int ieee80211_wk_cancel_remain_on_channel(
1365b8bc4b0aSJohannes Berg 	struct ieee80211_sub_if_data *sdata, u64 cookie);
1366af6b6374SJohannes Berg 
1367f444de05SJohannes Berg /* channel management */
1368f444de05SJohannes Berg enum ieee80211_chan_mode {
1369f444de05SJohannes Berg 	CHAN_MODE_UNDEFINED,
1370f444de05SJohannes Berg 	CHAN_MODE_HOPPING,
1371f444de05SJohannes Berg 	CHAN_MODE_FIXED,
1372f444de05SJohannes Berg };
1373f444de05SJohannes Berg 
1374f444de05SJohannes Berg enum ieee80211_chan_mode
1375f444de05SJohannes Berg ieee80211_get_channel_mode(struct ieee80211_local *local,
1376f444de05SJohannes Berg 			   struct ieee80211_sub_if_data *ignore);
13770aaffa9bSJohannes Berg bool ieee80211_set_channel_type(struct ieee80211_local *local,
13780aaffa9bSJohannes Berg 				struct ieee80211_sub_if_data *sdata,
13790aaffa9bSJohannes Berg 				enum nl80211_channel_type chantype);
138042e7aa77SAlexander Simon enum nl80211_channel_type
138142e7aa77SAlexander Simon ieee80211_ht_info_to_channel_type(struct ieee80211_ht_info *ht_info);
1382f444de05SJohannes Berg 
1383f4ea83ddSJohannes Berg #ifdef CONFIG_MAC80211_NOINLINE
1384d9e8a70fSJohannes Berg #define debug_noinline noinline
1385d9e8a70fSJohannes Berg #else
1386d9e8a70fSJohannes Berg #define debug_noinline
1387d9e8a70fSJohannes Berg #endif
1388d9e8a70fSJohannes Berg 
1389f0706e82SJiri Benc #endif /* IEEE80211_I_H */
1390