xref: /openbmc/linux/net/mac80211/ieee80211_i.h (revision ae54c985)
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>
5e039fa4aSJohannes Berg  * Copyright 2007-2008	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>
2693da9cc1Scolin@cozybit.com #include <net/cfg80211.h>
27f0706e82SJiri Benc #include <net/wireless.h>
28ccc58057SDavid S. Miller #include <net/iw_handler.h>
2951cb6db0SDavid S. Miller #include <net/mac80211.h>
302c8dccc7SJohannes Berg #include "key.h"
31f0706e82SJiri Benc #include "sta_info.h"
32f0706e82SJiri Benc 
339cfb0009SJohannes Berg struct ieee80211_local;
34f0706e82SJiri Benc 
35f0706e82SJiri Benc /* Maximum number of broadcast/multicast frames to buffer when some of the
36f0706e82SJiri Benc  * associated stations are using power saving. */
37f0706e82SJiri Benc #define AP_MAX_BC_BUFFER 128
38f0706e82SJiri Benc 
39f0706e82SJiri Benc /* Maximum number of frames buffered to all STAs, including multicast frames.
40f0706e82SJiri Benc  * Note: increasing this limit increases the potential memory requirement. Each
41f0706e82SJiri Benc  * frame can be up to about 2 kB long. */
42f0706e82SJiri Benc #define TOTAL_MAX_TX_BUFFER 512
43f0706e82SJiri Benc 
44f0706e82SJiri Benc /* Required encryption head and tailroom */
45f0706e82SJiri Benc #define IEEE80211_ENCRYPT_HEADROOM 8
46765cb46aSJouni Malinen #define IEEE80211_ENCRYPT_TAILROOM 18
47f0706e82SJiri Benc 
48f0706e82SJiri Benc /* IEEE 802.11 (Ch. 9.5 Defragmentation) requires support for concurrent
49f0706e82SJiri Benc  * reception of at least three fragmented frames. This limit can be increased
50f0706e82SJiri Benc  * by changing this define, at the cost of slower frame reassembly and
51f0706e82SJiri Benc  * increased memory use (about 2 kB of RAM per entry). */
52f0706e82SJiri Benc #define IEEE80211_FRAGMENT_MAX 4
53f0706e82SJiri Benc 
540a51b27eSJohannes Berg /*
550a51b27eSJohannes Berg  * Time after which we ignore scan results and no longer report/use
560a51b27eSJohannes Berg  * them in any way.
570a51b27eSJohannes Berg  */
580a51b27eSJohannes Berg #define IEEE80211_SCAN_RESULT_EXPIRE (10 * HZ)
590a51b27eSJohannes Berg 
60f0706e82SJiri Benc struct ieee80211_fragment_entry {
61f0706e82SJiri Benc 	unsigned long first_frag_time;
62f0706e82SJiri Benc 	unsigned int seq;
63f0706e82SJiri Benc 	unsigned int rx_queue;
64f0706e82SJiri Benc 	unsigned int last_frag;
65f0706e82SJiri Benc 	unsigned int extra_len;
66f0706e82SJiri Benc 	struct sk_buff_head skb_list;
67f0706e82SJiri Benc 	int ccmp; /* Whether fragments were encrypted with CCMP */
68f0706e82SJiri Benc 	u8 last_pn[6]; /* PN of the last fragment if CCMP was used */
69f0706e82SJiri Benc };
70f0706e82SJiri Benc 
71f0706e82SJiri Benc 
72c2b13452SJohannes Berg struct ieee80211_bss {
73f0706e82SJiri Benc 	struct list_head list;
74c2b13452SJohannes Berg 	struct ieee80211_bss *hnext;
75056cdd59SJohannes Berg 	size_t ssid_len;
76056cdd59SJohannes Berg 
77f0706e82SJiri Benc 	atomic_t users;
78f0706e82SJiri Benc 
79f0706e82SJiri Benc 	u8 bssid[ETH_ALEN];
80f0706e82SJiri Benc 	u8 ssid[IEEE80211_MAX_SSID_LEN];
8198f7dfd8SEmmanuel Grumbach 	u8 dtim_period;
82f0706e82SJiri Benc 	u16 capability; /* host byte order */
838318d78aSJohannes Berg 	enum ieee80211_band band;
84f0706e82SJiri Benc 	int freq;
85566bfe5aSBruno Randolf 	int signal, noise, qual;
8643ac2ca3SJouni Malinen 	u8 *ies; /* all information elements from the last Beacon or Probe
8743ac2ca3SJouni Malinen 		  * Response frames; note Beacon frame is not allowed to
8843ac2ca3SJouni Malinen 		  * override values from Probe Response */
8943ac2ca3SJouni Malinen 	size_t ies_len;
9043ac2ca3SJouni Malinen 	bool wmm_used;
91ee385855SLuis Carlos Cobo #ifdef CONFIG_MAC80211_MESH
92ee385855SLuis Carlos Cobo 	u8 *mesh_id;
93ee385855SLuis Carlos Cobo 	size_t mesh_id_len;
9424736701SJohn W. Linville 	u8 *mesh_cfg;
95902acc78SJohannes Berg #endif
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 	u64 timestamp;
100056cdd59SJohannes Berg 	int beacon_int;
101f0706e82SJiri Benc 
1029859b81eSRon Rindjunsky 	unsigned long last_probe_resp;
103f0706e82SJiri Benc 	unsigned long last_update;
104f0706e82SJiri Benc 
1055628221cSDaniel Drake 	/* during assocation, we save an ERP value from a probe response so
1065628221cSDaniel Drake 	 * that we can feed ERP info to the driver when handling the
1075628221cSDaniel Drake 	 * association completes. these fields probably won't be up-to-date
1085628221cSDaniel Drake 	 * otherwise, you probably don't want to use them. */
1095628221cSDaniel Drake 	int has_erp_value;
1105628221cSDaniel Drake 	u8 erp_value;
111f0706e82SJiri Benc };
112f0706e82SJiri Benc 
113c2b13452SJohannes Berg static inline u8 *bss_mesh_cfg(struct ieee80211_bss *bss)
114902acc78SJohannes Berg {
115902acc78SJohannes Berg #ifdef CONFIG_MAC80211_MESH
116902acc78SJohannes Berg 	return bss->mesh_cfg;
117902acc78SJohannes Berg #endif
118902acc78SJohannes Berg 	return NULL;
119902acc78SJohannes Berg }
120902acc78SJohannes Berg 
121c2b13452SJohannes Berg static inline u8 *bss_mesh_id(struct ieee80211_bss *bss)
122902acc78SJohannes Berg {
123902acc78SJohannes Berg #ifdef CONFIG_MAC80211_MESH
124902acc78SJohannes Berg 	return bss->mesh_id;
125902acc78SJohannes Berg #endif
126902acc78SJohannes Berg 	return NULL;
127902acc78SJohannes Berg }
128902acc78SJohannes Berg 
129c2b13452SJohannes Berg static inline u8 bss_mesh_id_len(struct ieee80211_bss *bss)
130902acc78SJohannes Berg {
131902acc78SJohannes Berg #ifdef CONFIG_MAC80211_MESH
132902acc78SJohannes Berg 	return bss->mesh_id_len;
133902acc78SJohannes Berg #endif
134902acc78SJohannes Berg 	return 0;
135902acc78SJohannes Berg }
136902acc78SJohannes Berg 
137f0706e82SJiri Benc 
1389ae54c84SJohannes Berg typedef unsigned __bitwise__ ieee80211_tx_result;
1399ae54c84SJohannes Berg #define TX_CONTINUE	((__force ieee80211_tx_result) 0u)
1409ae54c84SJohannes Berg #define TX_DROP		((__force ieee80211_tx_result) 1u)
1419ae54c84SJohannes Berg #define TX_QUEUED	((__force ieee80211_tx_result) 2u)
1429ae54c84SJohannes Berg 
1435cf121c3SJohannes Berg #define IEEE80211_TX_FRAGMENTED		BIT(0)
1445cf121c3SJohannes Berg #define IEEE80211_TX_UNICAST		BIT(1)
1455cf121c3SJohannes Berg #define IEEE80211_TX_PS_BUFFERED	BIT(2)
1469ae54c84SJohannes Berg 
1475cf121c3SJohannes Berg struct ieee80211_tx_data {
148f0706e82SJiri Benc 	struct sk_buff *skb;
149f0706e82SJiri Benc 	struct net_device *dev;
150f0706e82SJiri Benc 	struct ieee80211_local *local;
151f0706e82SJiri Benc 	struct ieee80211_sub_if_data *sdata;
152f0706e82SJiri Benc 	struct sta_info *sta;
153f0706e82SJiri Benc 	struct ieee80211_key *key;
1545cf121c3SJohannes Berg 
1558318d78aSJohannes Berg 	struct ieee80211_channel *channel;
156f0706e82SJiri Benc 
157f0706e82SJiri Benc 	/* Extra fragments (in addition to the first fragment
158f0706e82SJiri Benc 	 * in skb) */
159f0706e82SJiri Benc 	struct sk_buff **extra_frag;
160056cdd59SJohannes Berg 	int num_extra_frag;
161056cdd59SJohannes Berg 
162a4b7d7bdSHarvey Harrison 	u16 ethertype;
163056cdd59SJohannes Berg 	unsigned int flags;
1645cf121c3SJohannes Berg };
1655cf121c3SJohannes Berg 
1665cf121c3SJohannes Berg 
1675cf121c3SJohannes Berg typedef unsigned __bitwise__ ieee80211_rx_result;
1685cf121c3SJohannes Berg #define RX_CONTINUE		((__force ieee80211_rx_result) 0u)
1695cf121c3SJohannes Berg #define RX_DROP_UNUSABLE	((__force ieee80211_rx_result) 1u)
1705cf121c3SJohannes Berg #define RX_DROP_MONITOR		((__force ieee80211_rx_result) 2u)
1715cf121c3SJohannes Berg #define RX_QUEUED		((__force ieee80211_rx_result) 3u)
1725cf121c3SJohannes Berg 
1735cf121c3SJohannes Berg #define IEEE80211_RX_IN_SCAN		BIT(0)
1745cf121c3SJohannes Berg /* frame is destined to interface currently processed (incl. multicast frames) */
1755cf121c3SJohannes Berg #define IEEE80211_RX_RA_MATCH		BIT(1)
1765cf121c3SJohannes Berg #define IEEE80211_RX_AMSDU		BIT(2)
1775cf121c3SJohannes Berg #define IEEE80211_RX_CMNTR_REPORTED	BIT(3)
1785cf121c3SJohannes Berg #define IEEE80211_RX_FRAGMENTED		BIT(4)
1795cf121c3SJohannes Berg 
1805cf121c3SJohannes Berg struct ieee80211_rx_data {
1815cf121c3SJohannes Berg 	struct sk_buff *skb;
1825cf121c3SJohannes Berg 	struct net_device *dev;
1835cf121c3SJohannes Berg 	struct ieee80211_local *local;
1845cf121c3SJohannes Berg 	struct ieee80211_sub_if_data *sdata;
1855cf121c3SJohannes Berg 	struct sta_info *sta;
1865cf121c3SJohannes Berg 	struct ieee80211_key *key;
187f0706e82SJiri Benc 	struct ieee80211_rx_status *status;
1888318d78aSJohannes Berg 	struct ieee80211_rate *rate;
189056cdd59SJohannes Berg 
190056cdd59SJohannes Berg 	unsigned int flags;
191f0706e82SJiri Benc 	int sent_ps_buffered;
192f0706e82SJiri Benc 	int queue;
19350741ae0SJohannes Berg 	u32 tkip_iv32;
19450741ae0SJohannes Berg 	u16 tkip_iv16;
195f0706e82SJiri Benc };
196f0706e82SJiri Benc 
197f0706e82SJiri Benc struct ieee80211_tx_stored_packet {
198f0706e82SJiri Benc 	struct sk_buff *skb;
199f0706e82SJiri Benc 	struct sk_buff **extra_frag;
200056cdd59SJohannes Berg 	int num_extra_frag;
201f0706e82SJiri Benc };
202f0706e82SJiri Benc 
2035dfdaf58SJohannes Berg struct beacon_data {
2045dfdaf58SJohannes Berg 	u8 *head, *tail;
2055dfdaf58SJohannes Berg 	int head_len, tail_len;
2065dfdaf58SJohannes Berg 	int dtim_period;
2075dfdaf58SJohannes Berg };
2085dfdaf58SJohannes Berg 
209f0706e82SJiri Benc struct ieee80211_if_ap {
2105dfdaf58SJohannes Berg 	struct beacon_data *beacon;
211f0706e82SJiri Benc 
2120ec3ca44SJohannes Berg 	struct list_head vlans;
2130ec3ca44SJohannes Berg 
214f0706e82SJiri Benc 	/* yes, this looks ugly, but guarantees that we can later use
215f0706e82SJiri Benc 	 * bitmap_empty :)
216004c872eSJohannes Berg 	 * NB: don't touch this bitmap, use sta_info_{set,clear}_tim_bit */
217f0706e82SJiri Benc 	u8 tim[sizeof(unsigned long) * BITS_TO_LONGS(IEEE80211_MAX_AID + 1)];
218f0706e82SJiri Benc 	struct sk_buff_head ps_bc_buf;
219056cdd59SJohannes Berg 	atomic_t num_sta_ps; /* number of stations in PS mode */
2205dfdaf58SJohannes Berg 	int dtim_count;
221f0706e82SJiri Benc };
222f0706e82SJiri Benc 
223f0706e82SJiri Benc struct ieee80211_if_wds {
224f0706e82SJiri Benc 	struct sta_info *sta;
225056cdd59SJohannes Berg 	u8 remote_addr[ETH_ALEN];
226f0706e82SJiri Benc };
227f0706e82SJiri Benc 
228f0706e82SJiri Benc struct ieee80211_if_vlan {
2290ec3ca44SJohannes Berg 	struct list_head list;
230f0706e82SJiri Benc };
231f0706e82SJiri Benc 
232ee385855SLuis Carlos Cobo struct mesh_stats {
233ee385855SLuis Carlos Cobo 	__u32 fwded_frames;		/* Mesh forwarded frames */
234ee385855SLuis Carlos Cobo 	__u32 dropped_frames_ttl;	/* Not transmitted since mesh_ttl == 0*/
235ee385855SLuis Carlos Cobo 	__u32 dropped_frames_no_route;	/* Not transmitted, no route found */
236ee385855SLuis Carlos Cobo 	atomic_t estab_plinks;
237ee385855SLuis Carlos Cobo };
238ee385855SLuis Carlos Cobo 
239ee385855SLuis Carlos Cobo #define PREQ_Q_F_START		0x1
240ee385855SLuis Carlos Cobo #define PREQ_Q_F_REFRESH	0x2
241ee385855SLuis Carlos Cobo struct mesh_preq_queue {
242ee385855SLuis Carlos Cobo 	struct list_head list;
243ee385855SLuis Carlos Cobo 	u8 dst[ETH_ALEN];
244ee385855SLuis Carlos Cobo 	u8 flags;
245ee385855SLuis Carlos Cobo };
246ee385855SLuis Carlos Cobo 
247d6f2da5bSJiri Slaby /* flags used in struct ieee80211_if_sta.flags */
248d6f2da5bSJiri Slaby #define IEEE80211_STA_SSID_SET		BIT(0)
249d6f2da5bSJiri Slaby #define IEEE80211_STA_BSSID_SET		BIT(1)
250d6f2da5bSJiri Slaby #define IEEE80211_STA_PREV_BSSID_SET	BIT(2)
251d6f2da5bSJiri Slaby #define IEEE80211_STA_AUTHENTICATED	BIT(3)
252d6f2da5bSJiri Slaby #define IEEE80211_STA_ASSOCIATED	BIT(4)
253d6f2da5bSJiri Slaby #define IEEE80211_STA_PROBEREQ_POLL	BIT(5)
254d6f2da5bSJiri Slaby #define IEEE80211_STA_CREATE_IBSS	BIT(6)
255d6f2da5bSJiri Slaby #define IEEE80211_STA_MIXED_CELL	BIT(7)
256d6f2da5bSJiri Slaby #define IEEE80211_STA_WMM_ENABLED	BIT(8)
257d6f2da5bSJiri Slaby #define IEEE80211_STA_AUTO_SSID_SEL	BIT(10)
258d6f2da5bSJiri Slaby #define IEEE80211_STA_AUTO_BSSID_SEL	BIT(11)
259d6f2da5bSJiri Slaby #define IEEE80211_STA_AUTO_CHANNEL_SEL	BIT(12)
2605b98b1f7SJohannes Berg #define IEEE80211_STA_PRIVACY_INVOKED	BIT(13)
261eb46936bSVasanthakumar Thiagarajan #define IEEE80211_STA_TKIP_WEP_USED	BIT(14)
262c481ec97SSujith #define IEEE80211_STA_CSA_RECEIVED	BIT(15)
2635394af4dSJouni Malinen #define IEEE80211_STA_MFP_ENABLED	BIT(16)
26448c2fc59STomas Winkler /* flags for MLME request */
26548c2fc59STomas Winkler #define IEEE80211_STA_REQ_SCAN 0
2669859b81eSRon Rindjunsky #define IEEE80211_STA_REQ_DIRECT_PROBE 1
2679859b81eSRon Rindjunsky #define IEEE80211_STA_REQ_AUTH 2
2689859b81eSRon Rindjunsky #define IEEE80211_STA_REQ_RUN  3
26948c2fc59STomas Winkler 
270ccd7b362SJohannes Berg /* STA/IBSS MLME states */
27148c2fc59STomas Winkler enum ieee80211_sta_mlme_state {
27248c2fc59STomas Winkler 	IEEE80211_STA_MLME_DISABLED,
2739859b81eSRon Rindjunsky 	IEEE80211_STA_MLME_DIRECT_PROBE,
27448c2fc59STomas Winkler 	IEEE80211_STA_MLME_AUTHENTICATE,
27548c2fc59STomas Winkler 	IEEE80211_STA_MLME_ASSOCIATE,
27648c2fc59STomas Winkler 	IEEE80211_STA_MLME_ASSOCIATED,
27748c2fc59STomas Winkler 	IEEE80211_STA_MLME_IBSS_SEARCH,
27848c2fc59STomas Winkler 	IEEE80211_STA_MLME_IBSS_JOINED,
27948c2fc59STomas Winkler };
28048c2fc59STomas Winkler 
28148c2fc59STomas Winkler /* bitfield of allowed auth algs */
28248c2fc59STomas Winkler #define IEEE80211_AUTH_ALG_OPEN BIT(0)
28348c2fc59STomas Winkler #define IEEE80211_AUTH_ALG_SHARED_KEY BIT(1)
28448c2fc59STomas Winkler #define IEEE80211_AUTH_ALG_LEAP BIT(2)
28548c2fc59STomas Winkler 
286f0706e82SJiri Benc struct ieee80211_if_sta {
287056cdd59SJohannes Berg 	struct timer_list timer;
288c481ec97SSujith 	struct timer_list chswitch_timer;
289056cdd59SJohannes Berg 	struct work_struct work;
290c481ec97SSujith 	struct work_struct chswitch_work;
291056cdd59SJohannes Berg 	u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN];
292056cdd59SJohannes Berg 	u8 ssid[IEEE80211_MAX_SSID_LEN];
29348c2fc59STomas Winkler 	enum ieee80211_sta_mlme_state state;
294f0706e82SJiri Benc 	size_t ssid_len;
295a0af5f14SHelmut Schaa 	u8 scan_ssid[IEEE80211_MAX_SSID_LEN];
296a0af5f14SHelmut Schaa 	size_t scan_ssid_len;
297f0706e82SJiri Benc 	u16 aid;
298f0706e82SJiri Benc 	u16 ap_capab, capab;
299f0706e82SJiri Benc 	u8 *extra_ie; /* to be added to the end of AssocReq */
300f0706e82SJiri Benc 	size_t extra_ie_len;
301f0706e82SJiri Benc 
302f0706e82SJiri Benc 	/* The last AssocReq/Resp IEs */
303f0706e82SJiri Benc 	u8 *assocreq_ies, *assocresp_ies;
304f0706e82SJiri Benc 	size_t assocreq_ies_len, assocresp_ies_len;
305f0706e82SJiri Benc 
306056cdd59SJohannes Berg 	struct sk_buff_head skb_queue;
307056cdd59SJohannes Berg 
3086042a3e3SRon Rindjunsky 	int assoc_scan_tries; /* number of scans done pre-association */
3099859b81eSRon Rindjunsky 	int direct_probe_tries; /* retries for direct probes */
3106042a3e3SRon Rindjunsky 	int auth_tries; /* retries for auth req */
3116042a3e3SRon Rindjunsky 	int assoc_tries; /* retries for assoc req */
312f0706e82SJiri Benc 
313056cdd59SJohannes Berg 	unsigned long request;
314056cdd59SJohannes Berg 
315056cdd59SJohannes Berg 	unsigned long last_probe;
316056cdd59SJohannes Berg 
317d6f2da5bSJiri Slaby 	unsigned int flags;
318f0706e82SJiri Benc 
319f0706e82SJiri Benc 	unsigned int auth_algs; /* bitfield of allowed auth algs */
320f0706e82SJiri Benc 	int auth_alg; /* currently used IEEE 802.11 authentication algorithm */
321f0706e82SJiri Benc 	int auth_transaction;
322f0706e82SJiri Benc 
323fdfacf0aSJouni Malinen 	enum {
324fdfacf0aSJouni Malinen 		IEEE80211_MFP_DISABLED,
325fdfacf0aSJouni Malinen 		IEEE80211_MFP_OPTIONAL,
326fdfacf0aSJouni Malinen 		IEEE80211_MFP_REQUIRED
327fdfacf0aSJouni Malinen 	} mfp; /* management frame protection */
328fdfacf0aSJouni Malinen 
329f0706e82SJiri Benc 	unsigned long ibss_join_req;
330f0706e82SJiri Benc 	struct sk_buff *probe_resp; /* ProbeResp template for IBSS */
3318318d78aSJohannes Berg 	u32 supp_rates_bits[IEEE80211_NUM_BANDS];
332f0706e82SJiri Benc 
333f0706e82SJiri Benc 	int wmm_last_param_set;
3349aed3cc1SJouni Malinen 
3359aed3cc1SJouni Malinen 	/* Extra IE data for management frames */
3369aed3cc1SJouni Malinen 	u8 *ie_probereq;
3379aed3cc1SJouni Malinen 	size_t ie_probereq_len;
3389aed3cc1SJouni Malinen 	u8 *ie_proberesp;
3399aed3cc1SJouni Malinen 	size_t ie_proberesp_len;
3409aed3cc1SJouni Malinen 	u8 *ie_auth;
3419aed3cc1SJouni Malinen 	size_t ie_auth_len;
3429aed3cc1SJouni Malinen 	u8 *ie_assocreq;
3439aed3cc1SJouni Malinen 	size_t ie_assocreq_len;
3449aed3cc1SJouni Malinen 	u8 *ie_reassocreq;
3459aed3cc1SJouni Malinen 	size_t ie_reassocreq_len;
3469aed3cc1SJouni Malinen 	u8 *ie_deauth;
3479aed3cc1SJouni Malinen 	size_t ie_deauth_len;
3489aed3cc1SJouni Malinen 	u8 *ie_disassoc;
3499aed3cc1SJouni Malinen 	size_t ie_disassoc_len;
350f0706e82SJiri Benc };
351f0706e82SJiri Benc 
352472dbc45SJohannes Berg struct ieee80211_if_mesh {
353472dbc45SJohannes Berg 	struct work_struct work;
354472dbc45SJohannes Berg 	struct timer_list housekeeping_timer;
355472dbc45SJohannes Berg 	struct timer_list mesh_path_timer;
356472dbc45SJohannes Berg 	struct sk_buff_head skb_queue;
357472dbc45SJohannes Berg 
358472dbc45SJohannes Berg 	bool housekeeping;
359472dbc45SJohannes Berg 
360472dbc45SJohannes Berg 	u8 mesh_id[IEEE80211_MAX_MESH_ID_LEN];
361472dbc45SJohannes Berg 	size_t mesh_id_len;
362472dbc45SJohannes Berg 	/* Active Path Selection Protocol Identifier */
363472dbc45SJohannes Berg 	u8 mesh_pp_id[4];
364472dbc45SJohannes Berg 	/* Active Path Selection Metric Identifier */
365472dbc45SJohannes Berg 	u8 mesh_pm_id[4];
366472dbc45SJohannes Berg 	/* Congestion Control Mode Identifier */
367472dbc45SJohannes Berg 	u8 mesh_cc_id[4];
368472dbc45SJohannes Berg 	/* Local mesh Destination Sequence Number */
369472dbc45SJohannes Berg 	u32 dsn;
370472dbc45SJohannes Berg 	/* Last used PREQ ID */
371472dbc45SJohannes Berg 	u32 preq_id;
372472dbc45SJohannes Berg 	atomic_t mpaths;
373472dbc45SJohannes Berg 	/* Timestamp of last DSN update */
374472dbc45SJohannes Berg 	unsigned long last_dsn_update;
375472dbc45SJohannes Berg 	/* Timestamp of last DSN sent */
376472dbc45SJohannes Berg 	unsigned long last_preq;
377472dbc45SJohannes Berg 	struct mesh_rmc *rmc;
378472dbc45SJohannes Berg 	spinlock_t mesh_preq_queue_lock;
379472dbc45SJohannes Berg 	struct mesh_preq_queue preq_queue;
380472dbc45SJohannes Berg 	int preq_queue_len;
381472dbc45SJohannes Berg 	struct mesh_stats mshstats;
382472dbc45SJohannes Berg 	struct mesh_config mshcfg;
383472dbc45SJohannes Berg 	u32 mesh_seqnum;
384472dbc45SJohannes Berg 	bool accepting_plinks;
385472dbc45SJohannes Berg };
386902acc78SJohannes Berg 
387902acc78SJohannes Berg #ifdef CONFIG_MAC80211_MESH
388472dbc45SJohannes Berg #define IEEE80211_IFSTA_MESH_CTR_INC(msh, name)	\
389472dbc45SJohannes Berg 	do { (msh)->mshstats.name++; } while (0)
390902acc78SJohannes Berg #else
391472dbc45SJohannes Berg #define IEEE80211_IFSTA_MESH_CTR_INC(msh, name) \
392902acc78SJohannes Berg 	do { } while (0)
393902acc78SJohannes Berg #endif
394f0706e82SJiri Benc 
395213cd118SJohannes Berg /**
396213cd118SJohannes Berg  * enum ieee80211_sub_if_data_flags - virtual interface flags
397213cd118SJohannes Berg  *
398213cd118SJohannes Berg  * @IEEE80211_SDATA_ALLMULTI: interface wants all multicast packets
399213cd118SJohannes Berg  * @IEEE80211_SDATA_PROMISC: interface is promisc
400213cd118SJohannes Berg  * @IEEE80211_SDATA_USERSPACE_MLME: userspace MLME is active
401213cd118SJohannes Berg  * @IEEE80211_SDATA_OPERATING_GMODE: operating in G-only mode
402213cd118SJohannes Berg  * @IEEE80211_SDATA_DONT_BRIDGE_PACKETS: bridge packets between
403213cd118SJohannes Berg  *	associated stations and deliver multicast frames both
404213cd118SJohannes Berg  *	back to wireless media and to the local net stack.
405213cd118SJohannes Berg  */
406213cd118SJohannes Berg enum ieee80211_sub_if_data_flags {
407213cd118SJohannes Berg 	IEEE80211_SDATA_ALLMULTI		= BIT(0),
408213cd118SJohannes Berg 	IEEE80211_SDATA_PROMISC			= BIT(1),
409213cd118SJohannes Berg 	IEEE80211_SDATA_USERSPACE_MLME		= BIT(2),
410213cd118SJohannes Berg 	IEEE80211_SDATA_OPERATING_GMODE		= BIT(3),
411213cd118SJohannes Berg 	IEEE80211_SDATA_DONT_BRIDGE_PACKETS	= BIT(4),
412213cd118SJohannes Berg };
413213cd118SJohannes Berg 
414f0706e82SJiri Benc struct ieee80211_sub_if_data {
415f0706e82SJiri Benc 	struct list_head list;
416f0706e82SJiri Benc 
417f0706e82SJiri Benc 	struct wireless_dev wdev;
418f0706e82SJiri Benc 
41911a843b7SJohannes Berg 	/* keys */
42011a843b7SJohannes Berg 	struct list_head key_list;
42111a843b7SJohannes Berg 
422f0706e82SJiri Benc 	struct net_device *dev;
423f0706e82SJiri Benc 	struct ieee80211_local *local;
424f0706e82SJiri Benc 
42513262ffdSJiri Slaby 	unsigned int flags;
4267e9ed188SDaniel Drake 
427f0706e82SJiri Benc 	int drop_unencrypted;
428f0706e82SJiri Benc 
429f0706e82SJiri Benc 	/* Fragment table for host-based reassembly */
430f0706e82SJiri Benc 	struct ieee80211_fragment_entry	fragments[IEEE80211_FRAGMENT_MAX];
431f0706e82SJiri Benc 	unsigned int fragment_next;
432f0706e82SJiri Benc 
433f0706e82SJiri Benc #define NUM_DEFAULT_KEYS 4
4343cfcf6acSJouni Malinen #define NUM_DEFAULT_MGMT_KEYS 2
4353cfcf6acSJouni Malinen 	struct ieee80211_key *keys[NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS];
436f0706e82SJiri Benc 	struct ieee80211_key *default_key;
4373cfcf6acSJouni Malinen 	struct ieee80211_key *default_mgmt_key;
438f0706e82SJiri Benc 
43994778280SJohannes Berg 	u16 sequence_number;
44094778280SJohannes Berg 
4413e122be0SJohannes Berg 	/*
4423e122be0SJohannes Berg 	 * AP this belongs to: self in AP mode and
4433e122be0SJohannes Berg 	 * corresponding AP in VLAN mode, NULL for
4443e122be0SJohannes Berg 	 * all others (might be needed later in IBSS)
4453e122be0SJohannes Berg 	 */
4463e122be0SJohannes Berg 	struct ieee80211_if_ap *bss;
4473e122be0SJohannes Berg 
4483e122be0SJohannes Berg 	int force_unicast_rateidx; /* forced TX rateidx for unicast frames */
4493e122be0SJohannes Berg 	int max_ratectrl_rateidx; /* max TX rateidx for rate control */
450f0706e82SJiri Benc 
451f0706e82SJiri Benc 	union {
452f0706e82SJiri Benc 		struct ieee80211_if_ap ap;
453f0706e82SJiri Benc 		struct ieee80211_if_wds wds;
454f0706e82SJiri Benc 		struct ieee80211_if_vlan vlan;
455f0706e82SJiri Benc 		struct ieee80211_if_sta sta;
456472dbc45SJohannes Berg #ifdef CONFIG_MAC80211_MESH
457472dbc45SJohannes Berg 		struct ieee80211_if_mesh mesh;
458472dbc45SJohannes Berg #endif
4598cc9a739SMichael Wu 		u32 mntr_flags;
460f0706e82SJiri Benc 	} u;
461e9f207f0SJiri Benc 
462e9f207f0SJiri Benc #ifdef CONFIG_MAC80211_DEBUGFS
463e9f207f0SJiri Benc 	struct dentry *debugfsdir;
464e9f207f0SJiri Benc 	union {
465e9f207f0SJiri Benc 		struct {
466e9f207f0SJiri Benc 			struct dentry *drop_unencrypted;
467e9f207f0SJiri Benc 			struct dentry *state;
468e9f207f0SJiri Benc 			struct dentry *bssid;
469e9f207f0SJiri Benc 			struct dentry *prev_bssid;
470e9f207f0SJiri Benc 			struct dentry *ssid_len;
471e9f207f0SJiri Benc 			struct dentry *aid;
472e9f207f0SJiri Benc 			struct dentry *ap_capab;
473e9f207f0SJiri Benc 			struct dentry *capab;
474e9f207f0SJiri Benc 			struct dentry *extra_ie_len;
475e9f207f0SJiri Benc 			struct dentry *auth_tries;
476e9f207f0SJiri Benc 			struct dentry *assoc_tries;
477e9f207f0SJiri Benc 			struct dentry *auth_algs;
478e9f207f0SJiri Benc 			struct dentry *auth_alg;
479e9f207f0SJiri Benc 			struct dentry *auth_transaction;
480e9f207f0SJiri Benc 			struct dentry *flags;
48193015f0fSJouni Malinen 			struct dentry *force_unicast_rateidx;
48293015f0fSJouni Malinen 			struct dentry *max_ratectrl_rateidx;
483e9f207f0SJiri Benc 		} sta;
484e9f207f0SJiri Benc 		struct {
485e9f207f0SJiri Benc 			struct dentry *drop_unencrypted;
486e9f207f0SJiri Benc 			struct dentry *num_sta_ps;
487e9f207f0SJiri Benc 			struct dentry *dtim_count;
488e9f207f0SJiri Benc 			struct dentry *force_unicast_rateidx;
489e9f207f0SJiri Benc 			struct dentry *max_ratectrl_rateidx;
490e9f207f0SJiri Benc 			struct dentry *num_buffered_multicast;
491e9f207f0SJiri Benc 		} ap;
492e9f207f0SJiri Benc 		struct {
493e9f207f0SJiri Benc 			struct dentry *drop_unencrypted;
494e9f207f0SJiri Benc 			struct dentry *peer;
49593015f0fSJouni Malinen 			struct dentry *force_unicast_rateidx;
49693015f0fSJouni Malinen 			struct dentry *max_ratectrl_rateidx;
497e9f207f0SJiri Benc 		} wds;
498e9f207f0SJiri Benc 		struct {
499e9f207f0SJiri Benc 			struct dentry *drop_unencrypted;
50093015f0fSJouni Malinen 			struct dentry *force_unicast_rateidx;
50193015f0fSJouni Malinen 			struct dentry *max_ratectrl_rateidx;
502e9f207f0SJiri Benc 		} vlan;
503e9f207f0SJiri Benc 		struct {
504e9f207f0SJiri Benc 			struct dentry *mode;
505e9f207f0SJiri Benc 		} monitor;
506e9f207f0SJiri Benc 	} debugfs;
5072b58b209SJouni Malinen 	struct {
5082b58b209SJouni Malinen 		struct dentry *default_key;
5093cfcf6acSJouni Malinen 		struct dentry *default_mgmt_key;
5102b58b209SJouni Malinen 	} common_debugfs;
511ee385855SLuis Carlos Cobo 
512ee385855SLuis Carlos Cobo #ifdef CONFIG_MAC80211_MESH
513ee385855SLuis Carlos Cobo 	struct dentry *mesh_stats_dir;
514ee385855SLuis Carlos Cobo 	struct {
515ee385855SLuis Carlos Cobo 		struct dentry *fwded_frames;
516ee385855SLuis Carlos Cobo 		struct dentry *dropped_frames_ttl;
517ee385855SLuis Carlos Cobo 		struct dentry *dropped_frames_no_route;
518ee385855SLuis Carlos Cobo 		struct dentry *estab_plinks;
519ee385855SLuis Carlos Cobo 		struct timer_list mesh_path_timer;
520ee385855SLuis Carlos Cobo 	} mesh_stats;
521ee385855SLuis Carlos Cobo 
522ee385855SLuis Carlos Cobo 	struct dentry *mesh_config_dir;
523ee385855SLuis Carlos Cobo 	struct {
524ee385855SLuis Carlos Cobo 		struct dentry *dot11MeshRetryTimeout;
525ee385855SLuis Carlos Cobo 		struct dentry *dot11MeshConfirmTimeout;
526ee385855SLuis Carlos Cobo 		struct dentry *dot11MeshHoldingTimeout;
527ee385855SLuis Carlos Cobo 		struct dentry *dot11MeshMaxRetries;
528ee385855SLuis Carlos Cobo 		struct dentry *dot11MeshTTL;
529ee385855SLuis Carlos Cobo 		struct dentry *auto_open_plinks;
530ee385855SLuis Carlos Cobo 		struct dentry *dot11MeshMaxPeerLinks;
531ee385855SLuis Carlos Cobo 		struct dentry *dot11MeshHWMPactivePathTimeout;
532ee385855SLuis Carlos Cobo 		struct dentry *dot11MeshHWMPpreqMinInterval;
533ee385855SLuis Carlos Cobo 		struct dentry *dot11MeshHWMPnetDiameterTraversalTime;
534ee385855SLuis Carlos Cobo 		struct dentry *dot11MeshHWMPmaxPREQretries;
535ee385855SLuis Carlos Cobo 		struct dentry *path_refresh_time;
536ee385855SLuis Carlos Cobo 		struct dentry *min_discovery_timeout;
537ee385855SLuis Carlos Cobo 	} mesh_config;
538ee385855SLuis Carlos Cobo #endif
539ee385855SLuis Carlos Cobo 
540e9f207f0SJiri Benc #endif
54132bfd35dSJohannes Berg 	/* must be last, dynamically sized area in this! */
54232bfd35dSJohannes Berg 	struct ieee80211_vif vif;
543f0706e82SJiri Benc };
544f0706e82SJiri Benc 
54532bfd35dSJohannes Berg static inline
54632bfd35dSJohannes Berg struct ieee80211_sub_if_data *vif_to_sdata(struct ieee80211_vif *p)
54732bfd35dSJohannes Berg {
54832bfd35dSJohannes Berg 	return container_of(p, struct ieee80211_sub_if_data, vif);
54932bfd35dSJohannes Berg }
55032bfd35dSJohannes Berg 
551472dbc45SJohannes Berg static inline void
552472dbc45SJohannes Berg ieee80211_sdata_set_mesh_id(struct ieee80211_sub_if_data *sdata,
553472dbc45SJohannes Berg 			    u8 mesh_id_len, u8 *mesh_id)
554472dbc45SJohannes Berg {
555472dbc45SJohannes Berg #ifdef CONFIG_MAC80211_MESH
556472dbc45SJohannes Berg 	struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
557472dbc45SJohannes Berg 	ifmsh->mesh_id_len = mesh_id_len;
558472dbc45SJohannes Berg 	memcpy(ifmsh->mesh_id, mesh_id, mesh_id_len);
559472dbc45SJohannes Berg #else
560472dbc45SJohannes Berg 	WARN_ON(1);
561472dbc45SJohannes Berg #endif
562472dbc45SJohannes Berg }
563472dbc45SJohannes Berg 
564f0706e82SJiri Benc enum {
565f0706e82SJiri Benc 	IEEE80211_RX_MSG	= 1,
566f0706e82SJiri Benc 	IEEE80211_TX_STATUS_MSG	= 2,
567eadc8d9eSRon Rindjunsky 	IEEE80211_DELBA_MSG	= 3,
568eadc8d9eSRon Rindjunsky 	IEEE80211_ADDBA_MSG	= 4,
569f0706e82SJiri Benc };
570f0706e82SJiri Benc 
571ce7c9111SKalle Valo enum queue_stop_reason {
572ce7c9111SKalle Valo 	IEEE80211_QUEUE_STOP_REASON_DRIVER,
573520eb820SKalle Valo 	IEEE80211_QUEUE_STOP_REASON_PS,
574c481ec97SSujith 	IEEE80211_QUEUE_STOP_REASON_CSA
575ce7c9111SKalle Valo };
576ce7c9111SKalle Valo 
57751cb6db0SDavid S. Miller /* maximum number of hardware queues we support. */
57851cb6db0SDavid S. Miller #define QD_MAX_QUEUES (IEEE80211_MAX_AMPDU_QUEUES + IEEE80211_MAX_QUEUES)
57951cb6db0SDavid S. Miller 
580133b8226SJohannes Berg struct ieee80211_master_priv {
581133b8226SJohannes Berg 	struct ieee80211_local *local;
582133b8226SJohannes Berg };
583133b8226SJohannes Berg 
584f0706e82SJiri Benc struct ieee80211_local {
585f0706e82SJiri Benc 	/* embed the driver visible part.
586f0706e82SJiri Benc 	 * don't cast (use the static inlines below), but we keep
587f0706e82SJiri Benc 	 * it first anyway so they become a no-op */
588f0706e82SJiri Benc 	struct ieee80211_hw hw;
589f0706e82SJiri Benc 
590f0706e82SJiri Benc 	const struct ieee80211_ops *ops;
591f0706e82SJiri Benc 
59251cb6db0SDavid S. Miller 	unsigned long queue_pool[BITS_TO_LONGS(QD_MAX_QUEUES)];
593ce7c9111SKalle Valo 	unsigned long queue_stop_reasons[IEEE80211_MAX_QUEUES];
594ce7c9111SKalle Valo 	spinlock_t queue_stop_reason_lock;
595f0706e82SJiri Benc 	struct net_device *mdev; /* wmaster# - "master" 802.11 device */
596f0706e82SJiri Benc 	int open_count;
5973d30d949SMichael Wu 	int monitors, cooked_mntrs;
5988cc9a739SMichael Wu 	/* number of interfaces with corresponding FIF_ flags */
5998cc9a739SMichael Wu 	int fif_fcsfail, fif_plcpfail, fif_control, fif_other_bss;
6004150c572SJohannes Berg 	unsigned int filter_flags; /* FIF_* */
601f0706e82SJiri Benc 	struct iw_statistics wstats;
602f0706e82SJiri Benc 	u8 wstats_flags;
603d0709a65SJohannes Berg 	bool tim_in_locked_section; /* see ieee80211_beacon_get() */
604b306f453SJohannes Berg 	int tx_headroom; /* required headroom for hardware/radiotap */
605f0706e82SJiri Benc 
606f0706e82SJiri Benc 	/* Tasklet and skb queue to process calls from IRQ mode. All frames
607f0706e82SJiri Benc 	 * added to skb_queue will be processed, but frames in
608f0706e82SJiri Benc 	 * skb_queue_unreliable may be dropped if the total length of these
609f0706e82SJiri Benc 	 * queues increases over the limit. */
610f0706e82SJiri Benc #define IEEE80211_IRQSAFE_QUEUE_LIMIT 128
611f0706e82SJiri Benc 	struct tasklet_struct tasklet;
612f0706e82SJiri Benc 	struct sk_buff_head skb_queue;
613f0706e82SJiri Benc 	struct sk_buff_head skb_queue_unreliable;
614f0706e82SJiri Benc 
615d0709a65SJohannes Berg 	/* Station data */
616d0709a65SJohannes Berg 	/*
617d0709a65SJohannes Berg 	 * The lock only protects the list, hash, timer and counter
618d0709a65SJohannes Berg 	 * against manipulation, reads are done in RCU. Additionally,
619b16bd15cSJohannes Berg 	 * the lock protects each BSS's TIM bitmap.
620d0709a65SJohannes Berg 	 */
621d0709a65SJohannes Berg 	spinlock_t sta_lock;
622d0709a65SJohannes Berg 	unsigned long num_sta;
623f0706e82SJiri Benc 	struct list_head sta_list;
624dc6676b7SJohannes Berg 	struct list_head sta_flush_list;
625dc6676b7SJohannes Berg 	struct work_struct sta_flush_work;
626f0706e82SJiri Benc 	struct sta_info *sta_hash[STA_HASH_SIZE];
627f0706e82SJiri Benc 	struct timer_list sta_cleanup;
628f0706e82SJiri Benc 
629e2530083SJohannes Berg 	unsigned long queues_pending[BITS_TO_LONGS(IEEE80211_MAX_QUEUES)];
630f8e79dddSTomas Winkler 	unsigned long queues_pending_run[BITS_TO_LONGS(IEEE80211_MAX_QUEUES)];
631eefce91aSJohannes Berg 	struct ieee80211_tx_stored_packet pending_packet[IEEE80211_MAX_QUEUES];
632f0706e82SJiri Benc 	struct tasklet_struct tx_pending_tasklet;
633f0706e82SJiri Benc 
634f0706e82SJiri Benc 	/* number of interfaces with corresponding IFF_ flags */
63553918994SJohannes Berg 	atomic_t iff_allmultis, iff_promiscs;
636f0706e82SJiri Benc 
637f0706e82SJiri Benc 	struct rate_control_ref *rate_ctrl;
638f0706e82SJiri Benc 
639f0706e82SJiri Benc 	int rts_threshold;
640f0706e82SJiri Benc 	int fragmentation_threshold;
641f0706e82SJiri Benc 
642f0706e82SJiri Benc 	struct crypto_blkcipher *wep_tx_tfm;
643f0706e82SJiri Benc 	struct crypto_blkcipher *wep_rx_tfm;
644f0706e82SJiri Benc 	u32 wep_iv;
645f0706e82SJiri Benc 
64679010420SJohannes Berg 	struct list_head interfaces;
64779010420SJohannes Berg 
648b16bd15cSJohannes Berg 	/*
649b16bd15cSJohannes Berg 	 * Key lock, protects sdata's key_list and sta_info's
650b16bd15cSJohannes Berg 	 * key pointers (write access, they're RCU.)
651b16bd15cSJohannes Berg 	 */
652b16bd15cSJohannes Berg 	spinlock_t key_lock;
653b16bd15cSJohannes Berg 
654b16bd15cSJohannes Berg 
655c2b13452SJohannes Berg 	/* Scanning and BSS list */
656c2b13452SJohannes Berg 	bool sw_scanning, hw_scanning;
657f0706e82SJiri Benc 	int scan_channel_idx;
6588318d78aSJohannes Berg 	enum ieee80211_band scan_band;
6598318d78aSJohannes Berg 
660f0706e82SJiri Benc 	enum { SCAN_SET_CHANNEL, SCAN_SEND_PROBE } scan_state;
661f0706e82SJiri Benc 	unsigned long last_scan_completed;
662f0706e82SJiri Benc 	struct delayed_work scan_work;
663491775a5SJohannes Berg 	struct ieee80211_sub_if_data *scan_sdata;
664c481ec97SSujith 	struct ieee80211_channel *oper_channel, *scan_channel, *csa_channel;
665094d05dcSSujith 	enum nl80211_channel_type oper_channel_type;
666f0706e82SJiri Benc 	u8 scan_ssid[IEEE80211_MAX_SSID_LEN];
667f0706e82SJiri Benc 	size_t scan_ssid_len;
668c2b13452SJohannes Berg 	struct list_head bss_list;
669c2b13452SJohannes Berg 	struct ieee80211_bss *bss_hash[STA_HASH_SIZE];
670c2b13452SJohannes Berg 	spinlock_t bss_lock;
671f0706e82SJiri Benc 
672f0706e82SJiri Benc 	/* SNMP counters */
673f0706e82SJiri Benc 	/* dot11CountersTable */
674f0706e82SJiri Benc 	u32 dot11TransmittedFragmentCount;
675f0706e82SJiri Benc 	u32 dot11MulticastTransmittedFrameCount;
676f0706e82SJiri Benc 	u32 dot11FailedCount;
677f0706e82SJiri Benc 	u32 dot11RetryCount;
678f0706e82SJiri Benc 	u32 dot11MultipleRetryCount;
679f0706e82SJiri Benc 	u32 dot11FrameDuplicateCount;
680f0706e82SJiri Benc 	u32 dot11ReceivedFragmentCount;
681f0706e82SJiri Benc 	u32 dot11MulticastReceivedFrameCount;
682f0706e82SJiri Benc 	u32 dot11TransmittedFrameCount;
683f0706e82SJiri Benc 
684f0706e82SJiri Benc #ifdef CONFIG_MAC80211_LEDS
685f0706e82SJiri Benc 	int tx_led_counter, rx_led_counter;
686cdcb006fSIvo van Doorn 	struct led_trigger *tx_led, *rx_led, *assoc_led, *radio_led;
687cdcb006fSIvo van Doorn 	char tx_led_name[32], rx_led_name[32],
688cdcb006fSIvo van Doorn 	     assoc_led_name[32], radio_led_name[32];
689f0706e82SJiri Benc #endif
690f0706e82SJiri Benc 
691e9f207f0SJiri Benc #ifdef CONFIG_MAC80211_DEBUGFS
692e9f207f0SJiri Benc 	struct work_struct sta_debugfs_add;
693e9f207f0SJiri Benc #endif
694e9f207f0SJiri Benc 
695f0706e82SJiri Benc #ifdef CONFIG_MAC80211_DEBUG_COUNTERS
696f0706e82SJiri Benc 	/* TX/RX handler statistics */
697f0706e82SJiri Benc 	unsigned int tx_handlers_drop;
698f0706e82SJiri Benc 	unsigned int tx_handlers_queued;
699f0706e82SJiri Benc 	unsigned int tx_handlers_drop_unencrypted;
700f0706e82SJiri Benc 	unsigned int tx_handlers_drop_fragment;
701f0706e82SJiri Benc 	unsigned int tx_handlers_drop_wep;
702f0706e82SJiri Benc 	unsigned int tx_handlers_drop_not_assoc;
703f0706e82SJiri Benc 	unsigned int tx_handlers_drop_unauth_port;
704f0706e82SJiri Benc 	unsigned int rx_handlers_drop;
705f0706e82SJiri Benc 	unsigned int rx_handlers_queued;
706f0706e82SJiri Benc 	unsigned int rx_handlers_drop_nullfunc;
707f0706e82SJiri Benc 	unsigned int rx_handlers_drop_defrag;
708f0706e82SJiri Benc 	unsigned int rx_handlers_drop_short;
709f0706e82SJiri Benc 	unsigned int rx_handlers_drop_passive_scan;
710f0706e82SJiri Benc 	unsigned int tx_expand_skb_head;
711f0706e82SJiri Benc 	unsigned int tx_expand_skb_head_cloned;
712f0706e82SJiri Benc 	unsigned int rx_expand_skb_head;
713f0706e82SJiri Benc 	unsigned int rx_expand_skb_head2;
714f0706e82SJiri Benc 	unsigned int rx_handlers_fragments;
715f0706e82SJiri Benc 	unsigned int tx_status_drop;
716f0706e82SJiri Benc #define I802_DEBUG_INC(c) (c)++
717f0706e82SJiri Benc #else /* CONFIG_MAC80211_DEBUG_COUNTERS */
718f0706e82SJiri Benc #define I802_DEBUG_INC(c) do { } while (0)
719f0706e82SJiri Benc #endif /* CONFIG_MAC80211_DEBUG_COUNTERS */
720f0706e82SJiri Benc 
721f0706e82SJiri Benc 
722f0706e82SJiri Benc 	int total_ps_buffered; /* total number of all buffered unicast and
723f0706e82SJiri Benc 				* multicast packets for power saving stations
724f0706e82SJiri Benc 				*/
725f0706e82SJiri Benc 	int wifi_wme_noack_test;
726f0706e82SJiri Benc 	unsigned int wmm_acm; /* bit field of ACM bits (BIT(802.1D tag)) */
727520eb820SKalle Valo 
728e0cb686fSKalle Valo 	bool powersave;
729520eb820SKalle Valo 	struct work_struct dynamic_ps_enable_work;
730520eb820SKalle Valo 	struct work_struct dynamic_ps_disable_work;
731520eb820SKalle Valo 	struct timer_list dynamic_ps_timer;
732f0706e82SJiri Benc 
7332bf30fabSJohannes Berg 	int user_power_level; /* in dBm */
734a8302de9SVasanthakumar Thiagarajan 	int power_constr_level; /* in dBm */
7352bf30fabSJohannes Berg 
736e9f207f0SJiri Benc #ifdef CONFIG_MAC80211_DEBUGFS
737e9f207f0SJiri Benc 	struct local_debugfsdentries {
7384b7679a5SJohannes Berg 		struct dentry *rcdir;
7394b7679a5SJohannes Berg 		struct dentry *rcname;
740e9f207f0SJiri Benc 		struct dentry *frequency;
741e9f207f0SJiri Benc 		struct dentry *rts_threshold;
742e9f207f0SJiri Benc 		struct dentry *fragmentation_threshold;
743e9f207f0SJiri Benc 		struct dentry *short_retry_limit;
744e9f207f0SJiri Benc 		struct dentry *long_retry_limit;
745e9f207f0SJiri Benc 		struct dentry *total_ps_buffered;
746e9f207f0SJiri Benc 		struct dentry *wep_iv;
747ae54c985SAlina Friedrichsen 		struct dentry *tsf;
748e9f207f0SJiri Benc 		struct dentry *statistics;
749e9f207f0SJiri Benc 		struct local_debugfsdentries_statsdentries {
750e9f207f0SJiri Benc 			struct dentry *transmitted_fragment_count;
751e9f207f0SJiri Benc 			struct dentry *multicast_transmitted_frame_count;
752e9f207f0SJiri Benc 			struct dentry *failed_count;
753e9f207f0SJiri Benc 			struct dentry *retry_count;
754e9f207f0SJiri Benc 			struct dentry *multiple_retry_count;
755e9f207f0SJiri Benc 			struct dentry *frame_duplicate_count;
756e9f207f0SJiri Benc 			struct dentry *received_fragment_count;
757e9f207f0SJiri Benc 			struct dentry *multicast_received_frame_count;
758e9f207f0SJiri Benc 			struct dentry *transmitted_frame_count;
759e9f207f0SJiri Benc 			struct dentry *wep_undecryptable_count;
760e9f207f0SJiri Benc 			struct dentry *num_scans;
761e9f207f0SJiri Benc #ifdef CONFIG_MAC80211_DEBUG_COUNTERS
762e9f207f0SJiri Benc 			struct dentry *tx_handlers_drop;
763e9f207f0SJiri Benc 			struct dentry *tx_handlers_queued;
764e9f207f0SJiri Benc 			struct dentry *tx_handlers_drop_unencrypted;
765e9f207f0SJiri Benc 			struct dentry *tx_handlers_drop_fragment;
766e9f207f0SJiri Benc 			struct dentry *tx_handlers_drop_wep;
767e9f207f0SJiri Benc 			struct dentry *tx_handlers_drop_not_assoc;
768e9f207f0SJiri Benc 			struct dentry *tx_handlers_drop_unauth_port;
769e9f207f0SJiri Benc 			struct dentry *rx_handlers_drop;
770e9f207f0SJiri Benc 			struct dentry *rx_handlers_queued;
771e9f207f0SJiri Benc 			struct dentry *rx_handlers_drop_nullfunc;
772e9f207f0SJiri Benc 			struct dentry *rx_handlers_drop_defrag;
773e9f207f0SJiri Benc 			struct dentry *rx_handlers_drop_short;
774e9f207f0SJiri Benc 			struct dentry *rx_handlers_drop_passive_scan;
775e9f207f0SJiri Benc 			struct dentry *tx_expand_skb_head;
776e9f207f0SJiri Benc 			struct dentry *tx_expand_skb_head_cloned;
777e9f207f0SJiri Benc 			struct dentry *rx_expand_skb_head;
778e9f207f0SJiri Benc 			struct dentry *rx_expand_skb_head2;
779e9f207f0SJiri Benc 			struct dentry *rx_handlers_fragments;
780e9f207f0SJiri Benc 			struct dentry *tx_status_drop;
781e9f207f0SJiri Benc #endif
782e9f207f0SJiri Benc 			struct dentry *dot11ACKFailureCount;
783e9f207f0SJiri Benc 			struct dentry *dot11RTSFailureCount;
784e9f207f0SJiri Benc 			struct dentry *dot11FCSErrorCount;
785e9f207f0SJiri Benc 			struct dentry *dot11RTSSuccessCount;
786e9f207f0SJiri Benc 		} stats;
787e9f207f0SJiri Benc 		struct dentry *stations;
788e9f207f0SJiri Benc 		struct dentry *keys;
789e9f207f0SJiri Benc 	} debugfs;
790e9f207f0SJiri Benc #endif
791f0706e82SJiri Benc };
792f0706e82SJiri Benc 
7933e122be0SJohannes Berg static inline struct ieee80211_sub_if_data *
7943e122be0SJohannes Berg IEEE80211_DEV_TO_SUB_IF(struct net_device *dev)
7953e122be0SJohannes Berg {
7963e122be0SJohannes Berg 	struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
7973e122be0SJohannes Berg 
7983e122be0SJohannes Berg 	BUG_ON(!local || local->mdev == dev);
7993e122be0SJohannes Berg 
8003e122be0SJohannes Berg 	return netdev_priv(dev);
8013e122be0SJohannes Berg }
8023e122be0SJohannes Berg 
803eadc8d9eSRon Rindjunsky /* this struct represents 802.11n's RA/TID combination */
804eadc8d9eSRon Rindjunsky struct ieee80211_ra_tid {
805eadc8d9eSRon Rindjunsky 	u8 ra[ETH_ALEN];
806eadc8d9eSRon Rindjunsky 	u16 tid;
807eadc8d9eSRon Rindjunsky };
808eadc8d9eSRon Rindjunsky 
809ee385855SLuis Carlos Cobo /* Parsed Information Elements */
810ee385855SLuis Carlos Cobo struct ieee802_11_elems {
81143ac2ca3SJouni Malinen 	u8 *ie_start;
81243ac2ca3SJouni Malinen 	size_t total_len;
81343ac2ca3SJouni Malinen 
814ee385855SLuis Carlos Cobo 	/* pointers to IEs */
815ee385855SLuis Carlos Cobo 	u8 *ssid;
816ee385855SLuis Carlos Cobo 	u8 *supp_rates;
817ee385855SLuis Carlos Cobo 	u8 *fh_params;
818ee385855SLuis Carlos Cobo 	u8 *ds_params;
819ee385855SLuis Carlos Cobo 	u8 *cf_params;
820ee385855SLuis Carlos Cobo 	u8 *tim;
821ee385855SLuis Carlos Cobo 	u8 *ibss_params;
822ee385855SLuis Carlos Cobo 	u8 *challenge;
823ee385855SLuis Carlos Cobo 	u8 *wpa;
824ee385855SLuis Carlos Cobo 	u8 *rsn;
825ee385855SLuis Carlos Cobo 	u8 *erp_info;
826ee385855SLuis Carlos Cobo 	u8 *ext_supp_rates;
827ee385855SLuis Carlos Cobo 	u8 *wmm_info;
828ee385855SLuis Carlos Cobo 	u8 *wmm_param;
82909914813SJohannes Berg 	struct ieee80211_ht_cap *ht_cap_elem;
830d9fe60deSJohannes Berg 	struct ieee80211_ht_info *ht_info_elem;
831ee385855SLuis Carlos Cobo 	u8 *mesh_config;
832ee385855SLuis Carlos Cobo 	u8 *mesh_id;
833ee385855SLuis Carlos Cobo 	u8 *peer_link;
834ee385855SLuis Carlos Cobo 	u8 *preq;
835ee385855SLuis Carlos Cobo 	u8 *prep;
836ee385855SLuis Carlos Cobo 	u8 *perr;
837f2df3859SAssaf Krauss 	u8 *ch_switch_elem;
838f2df3859SAssaf Krauss 	u8 *country_elem;
839f2df3859SAssaf Krauss 	u8 *pwr_constr_elem;
840f2df3859SAssaf Krauss 	u8 *quiet_elem; 	/* first quite element */
841f797eb7eSJouni Malinen 	u8 *timeout_int;
842ee385855SLuis Carlos Cobo 
843ee385855SLuis Carlos Cobo 	/* length of them, respectively */
844ee385855SLuis Carlos Cobo 	u8 ssid_len;
845ee385855SLuis Carlos Cobo 	u8 supp_rates_len;
846ee385855SLuis Carlos Cobo 	u8 fh_params_len;
847ee385855SLuis Carlos Cobo 	u8 ds_params_len;
848ee385855SLuis Carlos Cobo 	u8 cf_params_len;
849ee385855SLuis Carlos Cobo 	u8 tim_len;
850ee385855SLuis Carlos Cobo 	u8 ibss_params_len;
851ee385855SLuis Carlos Cobo 	u8 challenge_len;
852ee385855SLuis Carlos Cobo 	u8 wpa_len;
853ee385855SLuis Carlos Cobo 	u8 rsn_len;
854ee385855SLuis Carlos Cobo 	u8 erp_info_len;
855ee385855SLuis Carlos Cobo 	u8 ext_supp_rates_len;
856ee385855SLuis Carlos Cobo 	u8 wmm_info_len;
857ee385855SLuis Carlos Cobo 	u8 wmm_param_len;
858ee385855SLuis Carlos Cobo 	u8 mesh_config_len;
859ee385855SLuis Carlos Cobo 	u8 mesh_id_len;
860ee385855SLuis Carlos Cobo 	u8 peer_link_len;
861ee385855SLuis Carlos Cobo 	u8 preq_len;
862ee385855SLuis Carlos Cobo 	u8 prep_len;
863ee385855SLuis Carlos Cobo 	u8 perr_len;
864f2df3859SAssaf Krauss 	u8 ch_switch_elem_len;
865f2df3859SAssaf Krauss 	u8 country_elem_len;
866f2df3859SAssaf Krauss 	u8 pwr_constr_elem_len;
867f2df3859SAssaf Krauss 	u8 quiet_elem_len;
868f2df3859SAssaf Krauss 	u8 num_of_quiet_elem;	/* can be more the one */
869f797eb7eSJouni Malinen 	u8 timeout_int_len;
870ee385855SLuis Carlos Cobo };
871ee385855SLuis Carlos Cobo 
872f0706e82SJiri Benc static inline struct ieee80211_local *hw_to_local(
873f0706e82SJiri Benc 	struct ieee80211_hw *hw)
874f0706e82SJiri Benc {
875f0706e82SJiri Benc 	return container_of(hw, struct ieee80211_local, hw);
876f0706e82SJiri Benc }
877f0706e82SJiri Benc 
878f0706e82SJiri Benc static inline struct ieee80211_hw *local_to_hw(
879f0706e82SJiri Benc 	struct ieee80211_local *local)
880f0706e82SJiri Benc {
881f0706e82SJiri Benc 	return &local->hw;
882f0706e82SJiri Benc }
883f0706e82SJiri Benc 
884f0706e82SJiri Benc 
885571ecf67SJohannes Berg static inline int ieee80211_bssid_match(const u8 *raddr, const u8 *addr)
886571ecf67SJohannes Berg {
887571ecf67SJohannes Berg 	return compare_ether_addr(raddr, addr) == 0 ||
888571ecf67SJohannes Berg 	       is_broadcast_ether_addr(raddr);
889571ecf67SJohannes Berg }
890571ecf67SJohannes Berg 
891571ecf67SJohannes Berg 
892e8975581SJohannes Berg int ieee80211_hw_config(struct ieee80211_local *local, u32 changed);
8939d139c81SJohannes Berg int ieee80211_if_config(struct ieee80211_sub_if_data *sdata, u32 changed);
8945cf121c3SJohannes Berg void ieee80211_tx_set_protected(struct ieee80211_tx_data *tx);
8959c6bd790SJohannes Berg void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata,
8969c6bd790SJohannes Berg 				      u32 changed);
8970d143fe1SJohannes Berg void ieee80211_configure_filter(struct ieee80211_local *local);
898f0706e82SJiri Benc 
8999c6bd790SJohannes Berg /* wireless extensions */
900f0706e82SJiri Benc extern const struct iw_handler_def ieee80211_iw_handler_def;
90165b53e4cSDavid S. Miller 
9029c6bd790SJohannes Berg /* STA/IBSS code */
9039c6bd790SJohannes Berg void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata);
904c2b13452SJohannes Berg void ieee80211_scan_work(struct work_struct *work);
905f698d856SJasper Bryant-Greene void ieee80211_sta_rx_mgmt(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb,
906f0706e82SJiri Benc 			   struct ieee80211_rx_status *rx_status);
907f698d856SJasper Bryant-Greene int ieee80211_sta_set_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size_t len);
908f698d856SJasper Bryant-Greene int ieee80211_sta_get_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size_t *len);
909f698d856SJasper Bryant-Greene int ieee80211_sta_set_bssid(struct ieee80211_sub_if_data *sdata, u8 *bssid);
910f698d856SJasper Bryant-Greene void ieee80211_sta_req_auth(struct ieee80211_sub_if_data *sdata,
911f0706e82SJiri Benc 			    struct ieee80211_if_sta *ifsta);
9129c6bd790SJohannes Berg struct sta_info *ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata,
913881d948cSJohannes Berg 					u8 *bssid, u8 *addr, u32 supp_rates);
9149c6bd790SJohannes Berg int ieee80211_sta_deauthenticate(struct ieee80211_sub_if_data *sdata, u16 reason);
9159c6bd790SJohannes Berg int ieee80211_sta_disassociate(struct ieee80211_sub_if_data *sdata, u16 reason);
9169c6bd790SJohannes Berg u32 ieee80211_reset_erp_info(struct ieee80211_sub_if_data *sdata);
917881d948cSJohannes Berg u32 ieee80211_sta_get_rates(struct ieee80211_local *local,
9189c6bd790SJohannes Berg 			    struct ieee802_11_elems *elems,
9199c6bd790SJohannes Berg 			    enum ieee80211_band band);
9209c6bd790SJohannes Berg void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst,
9219c6bd790SJohannes Berg 			      u8 *ssid, size_t ssid_len);
9229c6bd790SJohannes Berg 
9239c6bd790SJohannes Berg /* scan/BSS handling */
924c2b13452SJohannes Berg int ieee80211_request_scan(struct ieee80211_sub_if_data *sdata,
925c2b13452SJohannes Berg 			   u8 *ssid, size_t ssid_len);
926c2b13452SJohannes Berg int ieee80211_scan_results(struct ieee80211_local *local,
927ccc58057SDavid S. Miller 			   struct iw_request_info *info,
928ccc58057SDavid S. Miller 			   char *buf, size_t len);
929c2b13452SJohannes Berg ieee80211_rx_result
930c2b13452SJohannes Berg ieee80211_scan_rx(struct ieee80211_sub_if_data *sdata,
931c2b13452SJohannes Berg 		  struct sk_buff *skb,
932f0706e82SJiri Benc 		  struct ieee80211_rx_status *rx_status);
9333e122be0SJohannes Berg void ieee80211_rx_bss_list_init(struct ieee80211_local *local);
9343e122be0SJohannes Berg void ieee80211_rx_bss_list_deinit(struct ieee80211_local *local);
935c2b13452SJohannes Berg int ieee80211_sta_set_extra_ie(struct ieee80211_sub_if_data *sdata,
936c2b13452SJohannes Berg 			       char *ie, size_t len);
9379c6bd790SJohannes Berg 
9380a51b27eSJohannes Berg void ieee80211_mlme_notify_scan_completed(struct ieee80211_local *local);
939c2b13452SJohannes Berg int ieee80211_start_scan(struct ieee80211_sub_if_data *scan_sdata,
9400a51b27eSJohannes Berg 			 u8 *ssid, size_t ssid_len);
941c2b13452SJohannes Berg struct ieee80211_bss *
94298c8fccfSJohannes Berg ieee80211_bss_info_update(struct ieee80211_local *local,
94398c8fccfSJohannes Berg 			  struct ieee80211_rx_status *rx_status,
94498c8fccfSJohannes Berg 			  struct ieee80211_mgmt *mgmt,
94598c8fccfSJohannes Berg 			  size_t len,
94698c8fccfSJohannes Berg 			  struct ieee802_11_elems *elems,
94798c8fccfSJohannes Berg 			  int freq, bool beacon);
948c2b13452SJohannes Berg struct ieee80211_bss *
9495484e237SJohannes Berg ieee80211_rx_bss_add(struct ieee80211_local *local, u8 *bssid, int freq,
9505484e237SJohannes Berg 		     u8 *ssid, u8 ssid_len);
951c2b13452SJohannes Berg struct ieee80211_bss *
9525484e237SJohannes Berg ieee80211_rx_bss_get(struct ieee80211_local *local, u8 *bssid, int freq,
9535484e237SJohannes Berg 		     u8 *ssid, u8 ssid_len);
95498c8fccfSJohannes Berg void ieee80211_rx_bss_put(struct ieee80211_local *local,
955c2b13452SJohannes Berg 			  struct ieee80211_bss *bss);
956ee385855SLuis Carlos Cobo 
9573e122be0SJohannes Berg /* interface handling */
9583e122be0SJohannes Berg int ieee80211_if_add(struct ieee80211_local *local, const char *name,
95905c914feSJohannes Berg 		     struct net_device **new_dev, enum nl80211_iftype type,
960ee385855SLuis Carlos Cobo 		     struct vif_params *params);
961f3947e2dSJohannes Berg int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata,
96205c914feSJohannes Berg 			     enum nl80211_iftype type);
963f698d856SJasper Bryant-Greene void ieee80211_if_remove(struct ieee80211_sub_if_data *sdata);
96475636525SJohannes Berg void ieee80211_remove_interfaces(struct ieee80211_local *local);
965f0706e82SJiri Benc 
966e2ebc74dSJohannes Berg /* tx handling */
967e2ebc74dSJohannes Berg void ieee80211_clear_tx_pending(struct ieee80211_local *local);
968e2ebc74dSJohannes Berg void ieee80211_tx_pending(unsigned long data);
969e2ebc74dSJohannes Berg int ieee80211_master_start_xmit(struct sk_buff *skb, struct net_device *dev);
970e2ebc74dSJohannes Berg int ieee80211_monitor_start_xmit(struct sk_buff *skb, struct net_device *dev);
971e2ebc74dSJohannes Berg int ieee80211_subif_start_xmit(struct sk_buff *skb, struct net_device *dev);
972e2ebc74dSJohannes Berg 
973de1ede7aSJohannes Berg /* HT */
974ae5eb026SJohannes Berg void ieee80211_ht_cap_ie_to_sta_ht_cap(struct ieee80211_supported_band *sband,
975ae5eb026SJohannes Berg 				       struct ieee80211_ht_cap *ht_cap_ie,
976d9fe60deSJohannes Berg 				       struct ieee80211_sta_ht_cap *ht_cap);
977ae5eb026SJohannes Berg u32 ieee80211_enable_ht(struct ieee80211_sub_if_data *sdata,
978ae5eb026SJohannes Berg 			struct ieee80211_ht_info *hti,
979ae5eb026SJohannes Berg 			u16 ap_ht_cap_flags);
980de1ede7aSJohannes Berg void ieee80211_send_bar(struct ieee80211_sub_if_data *sdata, u8 *ra, u16 tid, u16 ssn);
981de1ede7aSJohannes Berg 
982de1ede7aSJohannes Berg void ieee80211_sta_stop_rx_ba_session(struct ieee80211_sub_if_data *sdata, u8 *da,
983de1ede7aSJohannes Berg 				u16 tid, u16 initiator, u16 reason);
984de1ede7aSJohannes Berg void ieee80211_sta_tear_down_BA_sessions(struct ieee80211_sub_if_data *sdata, u8 *addr);
985de1ede7aSJohannes Berg void ieee80211_process_delba(struct ieee80211_sub_if_data *sdata,
986de1ede7aSJohannes Berg 			     struct sta_info *sta,
987de1ede7aSJohannes Berg 			     struct ieee80211_mgmt *mgmt, size_t len);
988de1ede7aSJohannes Berg void ieee80211_process_addba_resp(struct ieee80211_local *local,
989de1ede7aSJohannes Berg 				  struct sta_info *sta,
990de1ede7aSJohannes Berg 				  struct ieee80211_mgmt *mgmt,
991de1ede7aSJohannes Berg 				  size_t len);
992de1ede7aSJohannes Berg void ieee80211_process_addba_request(struct ieee80211_local *local,
993de1ede7aSJohannes Berg 				     struct sta_info *sta,
994de1ede7aSJohannes Berg 				     struct ieee80211_mgmt *mgmt,
995de1ede7aSJohannes Berg 				     size_t len);
996de1ede7aSJohannes Berg 
99739192c0bSJohannes Berg /* Spectrum management */
99839192c0bSJohannes Berg void ieee80211_process_measurement_req(struct ieee80211_sub_if_data *sdata,
99939192c0bSJohannes Berg 				       struct ieee80211_mgmt *mgmt,
100039192c0bSJohannes Berg 				       size_t len);
1001c481ec97SSujith void ieee80211_chswitch_timer(unsigned long data);
1002c481ec97SSujith void ieee80211_chswitch_work(struct work_struct *work);
1003c481ec97SSujith void ieee80211_process_chanswitch(struct ieee80211_sub_if_data *sdata,
1004c481ec97SSujith 				  struct ieee80211_channel_sw_ie *sw_elem,
1005c481ec97SSujith 				  struct ieee80211_bss *bss);
1006a8302de9SVasanthakumar Thiagarajan void ieee80211_handle_pwr_constr(struct ieee80211_sub_if_data *sdata,
1007a8302de9SVasanthakumar Thiagarajan 				 u16 capab_info, u8 *pwr_constr_elem,
1008a8302de9SVasanthakumar Thiagarajan 				 u8 pwr_constr_elem_len);
100939192c0bSJohannes Berg 
1010665af4fcSBob Copeland /* Suspend/resume */
1011665af4fcSBob Copeland int __ieee80211_suspend(struct ieee80211_hw *hw);
1012665af4fcSBob Copeland int __ieee80211_resume(struct ieee80211_hw *hw);
1013665af4fcSBob Copeland 
1014c2d1560aSJohannes Berg /* utility functions/constants */
1015c2d1560aSJohannes Berg extern void *mac80211_wiphy_privid; /* for wiphy privid */
1016c2d1560aSJohannes Berg extern const unsigned char rfc1042_header[6];
1017c2d1560aSJohannes Berg extern const unsigned char bridge_tunnel_header[6];
101871364716SRon Rindjunsky u8 *ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t len,
101905c914feSJohannes Berg 			enum nl80211_iftype type);
1020c2d1560aSJohannes Berg int ieee80211_frame_duration(struct ieee80211_local *local, size_t len,
1021c2d1560aSJohannes Berg 			     int rate, int erp, int short_preamble);
1022f698d856SJasper Bryant-Greene void mac80211_ev_michael_mic_failure(struct ieee80211_sub_if_data *sdata, int keyidx,
1023eb063c17SJohannes Berg 				     struct ieee80211_hdr *hdr);
10245825fe10SJohannes Berg void ieee80211_set_wmm_default(struct ieee80211_sub_if_data *sdata);
1025e50db65cSJohannes Berg void ieee80211_tx_skb(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb,
1026e50db65cSJohannes Berg 		      int encrypt);
10279c6bd790SJohannes Berg void ieee802_11_parse_elems(u8 *start, size_t len,
10289c6bd790SJohannes Berg 			    struct ieee802_11_elems *elems);
1029e16751c3SJohannes Berg int ieee80211_set_freq(struct ieee80211_sub_if_data *sdata, int freq);
1030881d948cSJohannes Berg u32 ieee80211_mandatory_rates(struct ieee80211_local *local,
103196dd22acSJohannes Berg 			      enum ieee80211_band band);
1032f0706e82SJiri Benc 
1033520eb820SKalle Valo void ieee80211_dynamic_ps_enable_work(struct work_struct *work);
1034520eb820SKalle Valo void ieee80211_dynamic_ps_disable_work(struct work_struct *work);
1035520eb820SKalle Valo void ieee80211_dynamic_ps_timer(unsigned long data);
1036a97b77b9SVivek Natarajan void ieee80211_send_nullfunc(struct ieee80211_local *local,
1037a97b77b9SVivek Natarajan 			     struct ieee80211_sub_if_data *sdata,
1038a97b77b9SVivek Natarajan 			     int powersave);
1039520eb820SKalle Valo 
1040ce7c9111SKalle Valo void ieee80211_wake_queues_by_reason(struct ieee80211_hw *hw,
1041ce7c9111SKalle Valo 				     enum queue_stop_reason reason);
1042ce7c9111SKalle Valo void ieee80211_stop_queues_by_reason(struct ieee80211_hw *hw,
1043ce7c9111SKalle Valo 				     enum queue_stop_reason reason);
1044ce7c9111SKalle Valo 
1045f4ea83ddSJohannes Berg #ifdef CONFIG_MAC80211_NOINLINE
1046d9e8a70fSJohannes Berg #define debug_noinline noinline
1047d9e8a70fSJohannes Berg #else
1048d9e8a70fSJohannes Berg #define debug_noinline
1049d9e8a70fSJohannes Berg #endif
1050d9e8a70fSJohannes Berg 
1051f0706e82SJiri Benc #endif /* IEEE80211_I_H */
1052