xref: /openbmc/linux/net/mac80211/ieee80211_i.h (revision f38fd12f)
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>
26fe7a5d5cSJohannes Berg #include <net/ieee80211_radiotap.h>
2793da9cc1Scolin@cozybit.com #include <net/cfg80211.h>
2851cb6db0SDavid S. Miller #include <net/mac80211.h>
292c8dccc7SJohannes Berg #include "key.h"
30f0706e82SJiri Benc #include "sta_info.h"
31f0706e82SJiri Benc 
329cfb0009SJohannes Berg struct ieee80211_local;
33f0706e82SJiri Benc 
34f0706e82SJiri Benc /* Maximum number of broadcast/multicast frames to buffer when some of the
35f0706e82SJiri Benc  * associated stations are using power saving. */
36f0706e82SJiri Benc #define AP_MAX_BC_BUFFER 128
37f0706e82SJiri Benc 
38f0706e82SJiri Benc /* Maximum number of frames buffered to all STAs, including multicast frames.
39f0706e82SJiri Benc  * Note: increasing this limit increases the potential memory requirement. Each
40f0706e82SJiri Benc  * frame can be up to about 2 kB long. */
41f0706e82SJiri Benc #define TOTAL_MAX_TX_BUFFER 512
42f0706e82SJiri Benc 
43f0706e82SJiri Benc /* Required encryption head and tailroom */
44f0706e82SJiri Benc #define IEEE80211_ENCRYPT_HEADROOM 8
45765cb46aSJouni Malinen #define IEEE80211_ENCRYPT_TAILROOM 18
46f0706e82SJiri Benc 
47f0706e82SJiri Benc /* IEEE 802.11 (Ch. 9.5 Defragmentation) requires support for concurrent
48f0706e82SJiri Benc  * reception of at least three fragmented frames. This limit can be increased
49f0706e82SJiri Benc  * by changing this define, at the cost of slower frame reassembly and
50f0706e82SJiri Benc  * increased memory use (about 2 kB of RAM per entry). */
51f0706e82SJiri Benc #define IEEE80211_FRAGMENT_MAX 4
52f0706e82SJiri Benc 
530a51b27eSJohannes Berg /*
540a51b27eSJohannes Berg  * Time after which we ignore scan results and no longer report/use
550a51b27eSJohannes Berg  * them in any way.
560a51b27eSJohannes Berg  */
570a51b27eSJohannes Berg #define IEEE80211_SCAN_RESULT_EXPIRE (10 * HZ)
580a51b27eSJohannes Berg 
5920ad19d0SJohannes Berg #define TU_TO_EXP_TIME(x)	(jiffies + usecs_to_jiffies((x) * 1024))
6020ad19d0SJohannes Berg 
61f0706e82SJiri Benc struct ieee80211_fragment_entry {
62f0706e82SJiri Benc 	unsigned long first_frag_time;
63f0706e82SJiri Benc 	unsigned int seq;
64f0706e82SJiri Benc 	unsigned int rx_queue;
65f0706e82SJiri Benc 	unsigned int last_frag;
66f0706e82SJiri Benc 	unsigned int extra_len;
67f0706e82SJiri Benc 	struct sk_buff_head skb_list;
68f0706e82SJiri Benc 	int ccmp; /* Whether fragments were encrypted with CCMP */
69f0706e82SJiri Benc 	u8 last_pn[6]; /* PN of the last fragment if CCMP was used */
70f0706e82SJiri Benc };
71f0706e82SJiri Benc 
72f0706e82SJiri Benc 
73c2b13452SJohannes Berg struct ieee80211_bss {
7400d3f14cSJohannes Berg 	/* Yes, this is a hack */
7500d3f14cSJohannes Berg 	struct cfg80211_bss cbss;
7600d3f14cSJohannes Berg 
7700d3f14cSJohannes Berg 	/* don't want to look up all the time */
78056cdd59SJohannes Berg 	size_t ssid_len;
79f0706e82SJiri Benc 	u8 ssid[IEEE80211_MAX_SSID_LEN];
8000d3f14cSJohannes Berg 
8198f7dfd8SEmmanuel Grumbach 	u8 dtim_period;
8200d3f14cSJohannes Berg 
8343ac2ca3SJouni Malinen 	bool wmm_used;
8400d3f14cSJohannes Berg 
8500d3f14cSJohannes Berg 	unsigned long last_probe_resp;
8600d3f14cSJohannes Berg 
87ee385855SLuis Carlos Cobo #ifdef CONFIG_MAC80211_MESH
88ee385855SLuis Carlos Cobo 	u8 *mesh_id;
89ee385855SLuis Carlos Cobo 	size_t mesh_id_len;
9024736701SJohn W. Linville 	u8 *mesh_cfg;
91902acc78SJohannes Berg #endif
9200d3f14cSJohannes Berg 
93f0706e82SJiri Benc #define IEEE80211_MAX_SUPP_RATES 32
94f0706e82SJiri Benc 	u8 supp_rates[IEEE80211_MAX_SUPP_RATES];
95f0706e82SJiri Benc 	size_t supp_rates_len;
96f0706e82SJiri Benc 
9700d3f14cSJohannes Berg 	/*
9800d3f14cSJohannes Berg 	 * During assocation, we save an ERP value from a probe response so
995628221cSDaniel Drake 	 * that we can feed ERP info to the driver when handling the
1005628221cSDaniel Drake 	 * association completes. these fields probably won't be up-to-date
10100d3f14cSJohannes Berg 	 * otherwise, you probably don't want to use them.
10200d3f14cSJohannes Berg 	 */
10300d3f14cSJohannes Berg 	bool has_erp_value;
1045628221cSDaniel Drake 	u8 erp_value;
105f0706e82SJiri Benc };
106f0706e82SJiri Benc 
107c2b13452SJohannes Berg static inline u8 *bss_mesh_cfg(struct ieee80211_bss *bss)
108902acc78SJohannes Berg {
109902acc78SJohannes Berg #ifdef CONFIG_MAC80211_MESH
110902acc78SJohannes Berg 	return bss->mesh_cfg;
111902acc78SJohannes Berg #endif
112902acc78SJohannes Berg 	return NULL;
113902acc78SJohannes Berg }
114902acc78SJohannes Berg 
115c2b13452SJohannes Berg static inline u8 *bss_mesh_id(struct ieee80211_bss *bss)
116902acc78SJohannes Berg {
117902acc78SJohannes Berg #ifdef CONFIG_MAC80211_MESH
118902acc78SJohannes Berg 	return bss->mesh_id;
119902acc78SJohannes Berg #endif
120902acc78SJohannes Berg 	return NULL;
121902acc78SJohannes Berg }
122902acc78SJohannes Berg 
123c2b13452SJohannes Berg static inline u8 bss_mesh_id_len(struct ieee80211_bss *bss)
124902acc78SJohannes Berg {
125902acc78SJohannes Berg #ifdef CONFIG_MAC80211_MESH
126902acc78SJohannes Berg 	return bss->mesh_id_len;
127902acc78SJohannes Berg #endif
128902acc78SJohannes Berg 	return 0;
129902acc78SJohannes Berg }
130902acc78SJohannes Berg 
131f0706e82SJiri Benc 
1329ae54c84SJohannes Berg typedef unsigned __bitwise__ ieee80211_tx_result;
1339ae54c84SJohannes Berg #define TX_CONTINUE	((__force ieee80211_tx_result) 0u)
1349ae54c84SJohannes Berg #define TX_DROP		((__force ieee80211_tx_result) 1u)
1359ae54c84SJohannes Berg #define TX_QUEUED	((__force ieee80211_tx_result) 2u)
1369ae54c84SJohannes Berg 
1375cf121c3SJohannes Berg #define IEEE80211_TX_FRAGMENTED		BIT(0)
1385cf121c3SJohannes Berg #define IEEE80211_TX_UNICAST		BIT(1)
1395cf121c3SJohannes Berg #define IEEE80211_TX_PS_BUFFERED	BIT(2)
1409ae54c84SJohannes Berg 
1415cf121c3SJohannes Berg struct ieee80211_tx_data {
142f0706e82SJiri Benc 	struct sk_buff *skb;
143f0706e82SJiri Benc 	struct ieee80211_local *local;
144f0706e82SJiri Benc 	struct ieee80211_sub_if_data *sdata;
145f0706e82SJiri Benc 	struct sta_info *sta;
146f0706e82SJiri Benc 	struct ieee80211_key *key;
1475cf121c3SJohannes Berg 
1488318d78aSJohannes Berg 	struct ieee80211_channel *channel;
149f0706e82SJiri Benc 
150a4b7d7bdSHarvey Harrison 	u16 ethertype;
151056cdd59SJohannes Berg 	unsigned int flags;
1525cf121c3SJohannes Berg };
1535cf121c3SJohannes Berg 
1545cf121c3SJohannes Berg 
1555cf121c3SJohannes Berg typedef unsigned __bitwise__ ieee80211_rx_result;
1565cf121c3SJohannes Berg #define RX_CONTINUE		((__force ieee80211_rx_result) 0u)
1575cf121c3SJohannes Berg #define RX_DROP_UNUSABLE	((__force ieee80211_rx_result) 1u)
1585cf121c3SJohannes Berg #define RX_DROP_MONITOR		((__force ieee80211_rx_result) 2u)
1595cf121c3SJohannes Berg #define RX_QUEUED		((__force ieee80211_rx_result) 3u)
1605cf121c3SJohannes Berg 
1615cf121c3SJohannes Berg #define IEEE80211_RX_IN_SCAN		BIT(0)
1625cf121c3SJohannes Berg /* frame is destined to interface currently processed (incl. multicast frames) */
1635cf121c3SJohannes Berg #define IEEE80211_RX_RA_MATCH		BIT(1)
1645cf121c3SJohannes Berg #define IEEE80211_RX_AMSDU		BIT(2)
1658c0c709eSJohannes Berg #define IEEE80211_RX_FRAGMENTED		BIT(3)
1662569a826SJohannes Berg /* only add flags here that do not change with subframes of an aMPDU */
1675cf121c3SJohannes Berg 
1685cf121c3SJohannes Berg struct ieee80211_rx_data {
1695cf121c3SJohannes Berg 	struct sk_buff *skb;
1705cf121c3SJohannes Berg 	struct ieee80211_local *local;
1715cf121c3SJohannes Berg 	struct ieee80211_sub_if_data *sdata;
1725cf121c3SJohannes Berg 	struct sta_info *sta;
1735cf121c3SJohannes Berg 	struct ieee80211_key *key;
174056cdd59SJohannes Berg 
175056cdd59SJohannes Berg 	unsigned int flags;
176f0706e82SJiri Benc 	int queue;
17750741ae0SJohannes Berg 	u32 tkip_iv32;
17850741ae0SJohannes Berg 	u16 tkip_iv16;
179f0706e82SJiri Benc };
180f0706e82SJiri Benc 
1815dfdaf58SJohannes Berg struct beacon_data {
1825dfdaf58SJohannes Berg 	u8 *head, *tail;
1835dfdaf58SJohannes Berg 	int head_len, tail_len;
1845dfdaf58SJohannes Berg 	int dtim_period;
1855dfdaf58SJohannes Berg };
1865dfdaf58SJohannes Berg 
187f0706e82SJiri Benc struct ieee80211_if_ap {
1885dfdaf58SJohannes Berg 	struct beacon_data *beacon;
189f0706e82SJiri Benc 
1900ec3ca44SJohannes Berg 	struct list_head vlans;
1910ec3ca44SJohannes Berg 
192f0706e82SJiri Benc 	/* yes, this looks ugly, but guarantees that we can later use
193f0706e82SJiri Benc 	 * bitmap_empty :)
194004c872eSJohannes Berg 	 * NB: don't touch this bitmap, use sta_info_{set,clear}_tim_bit */
195f0706e82SJiri Benc 	u8 tim[sizeof(unsigned long) * BITS_TO_LONGS(IEEE80211_MAX_AID + 1)];
196f0706e82SJiri Benc 	struct sk_buff_head ps_bc_buf;
197056cdd59SJohannes Berg 	atomic_t num_sta_ps; /* number of stations in PS mode */
1985dfdaf58SJohannes Berg 	int dtim_count;
199f0706e82SJiri Benc };
200f0706e82SJiri Benc 
201f0706e82SJiri Benc struct ieee80211_if_wds {
202f0706e82SJiri Benc 	struct sta_info *sta;
203056cdd59SJohannes Berg 	u8 remote_addr[ETH_ALEN];
204f0706e82SJiri Benc };
205f0706e82SJiri Benc 
206f0706e82SJiri Benc struct ieee80211_if_vlan {
2070ec3ca44SJohannes Berg 	struct list_head list;
208f14543eeSFelix Fietkau 
209f14543eeSFelix Fietkau 	/* used for all tx if the VLAN is configured to 4-addr mode */
210f14543eeSFelix Fietkau 	struct sta_info *sta;
211f0706e82SJiri Benc };
212f0706e82SJiri Benc 
213ee385855SLuis Carlos Cobo struct mesh_stats {
214c8a61a7dSDaniel Walker 	__u32 fwded_mcast;		/* Mesh forwarded multicast frames */
215c8a61a7dSDaniel Walker 	__u32 fwded_unicast;		/* Mesh forwarded unicast frames */
216c8a61a7dSDaniel Walker 	__u32 fwded_frames;		/* Mesh total forwarded frames */
217ee385855SLuis Carlos Cobo 	__u32 dropped_frames_ttl;	/* Not transmitted since mesh_ttl == 0*/
218ee385855SLuis Carlos Cobo 	__u32 dropped_frames_no_route;	/* Not transmitted, no route found */
219ee385855SLuis Carlos Cobo 	atomic_t estab_plinks;
220ee385855SLuis Carlos Cobo };
221ee385855SLuis Carlos Cobo 
222ee385855SLuis Carlos Cobo #define PREQ_Q_F_START		0x1
223ee385855SLuis Carlos Cobo #define PREQ_Q_F_REFRESH	0x2
224ee385855SLuis Carlos Cobo struct mesh_preq_queue {
225ee385855SLuis Carlos Cobo 	struct list_head list;
226ee385855SLuis Carlos Cobo 	u8 dst[ETH_ALEN];
227ee385855SLuis Carlos Cobo 	u8 flags;
228ee385855SLuis Carlos Cobo };
229ee385855SLuis Carlos Cobo 
23077fdaa12SJohannes Berg enum ieee80211_mgd_state {
23177fdaa12SJohannes Berg 	IEEE80211_MGD_STATE_IDLE,
23277fdaa12SJohannes Berg 	IEEE80211_MGD_STATE_PROBE,
23377fdaa12SJohannes Berg 	IEEE80211_MGD_STATE_AUTH,
23477fdaa12SJohannes Berg 	IEEE80211_MGD_STATE_ASSOC,
23577fdaa12SJohannes Berg };
23677fdaa12SJohannes Berg 
23777fdaa12SJohannes Berg struct ieee80211_mgd_work {
23877fdaa12SJohannes Berg 	struct list_head list;
23977fdaa12SJohannes Berg 	struct ieee80211_bss *bss;
24077fdaa12SJohannes Berg 	int ie_len;
24177fdaa12SJohannes Berg 	u8 prev_bssid[ETH_ALEN];
24277fdaa12SJohannes Berg 	u8 ssid[IEEE80211_MAX_SSID_LEN];
24377fdaa12SJohannes Berg 	u8 ssid_len;
24477fdaa12SJohannes Berg 	unsigned long timeout;
24577fdaa12SJohannes Berg 	enum ieee80211_mgd_state state;
24677fdaa12SJohannes Berg 	u16 auth_alg, auth_transaction;
24777fdaa12SJohannes Berg 
24877fdaa12SJohannes Berg 	int tries;
24977fdaa12SJohannes Berg 
250fffd0934SJohannes Berg 	u8 key[WLAN_KEY_LEN_WEP104];
251fffd0934SJohannes Berg 	u8 key_len, key_idx;
252fffd0934SJohannes Berg 
25377fdaa12SJohannes Berg 	/* must be last */
25477fdaa12SJohannes Berg 	u8 ie[0]; /* for auth or assoc frame, not probe */
25577fdaa12SJohannes Berg };
25677fdaa12SJohannes Berg 
25746900298SJohannes Berg /* flags used in struct ieee80211_if_managed.flags */
258ab1faeadSJohannes Berg enum ieee80211_sta_flags {
259b291ba11SJohannes Berg 	IEEE80211_STA_BEACON_POLL	= BIT(0),
260b291ba11SJohannes Berg 	IEEE80211_STA_CONNECTION_POLL	= BIT(1),
261b291ba11SJohannes Berg 	IEEE80211_STA_CONTROL_PORT	= BIT(2),
262b291ba11SJohannes Berg 	IEEE80211_STA_WMM_ENABLED	= BIT(3),
263b291ba11SJohannes Berg 	IEEE80211_STA_DISABLE_11N	= BIT(4),
264b291ba11SJohannes Berg 	IEEE80211_STA_CSA_RECEIVED	= BIT(5),
265b291ba11SJohannes Berg 	IEEE80211_STA_MFP_ENABLED	= BIT(6),
266ab1faeadSJohannes Berg };
267ab1faeadSJohannes Berg 
26848c2fc59STomas Winkler /* flags for MLME request */
269ab1faeadSJohannes Berg enum ieee80211_sta_request {
270ab1faeadSJohannes Berg 	IEEE80211_STA_REQ_SCAN,
271ab1faeadSJohannes Berg };
27248c2fc59STomas Winkler 
27346900298SJohannes Berg struct ieee80211_if_managed {
274056cdd59SJohannes Berg 	struct timer_list timer;
275b291ba11SJohannes Berg 	struct timer_list conn_mon_timer;
276b291ba11SJohannes Berg 	struct timer_list bcn_mon_timer;
277c481ec97SSujith 	struct timer_list chswitch_timer;
278056cdd59SJohannes Berg 	struct work_struct work;
279b291ba11SJohannes Berg 	struct work_struct monitor_work;
280c481ec97SSujith 	struct work_struct chswitch_work;
28104de8381SKalle Valo 	struct work_struct beacon_loss_work;
28246900298SJohannes Berg 
283b291ba11SJohannes Berg 	unsigned long probe_timeout;
284a43abf29SMaxim Levitsky 	int probe_send_count;
285b291ba11SJohannes Berg 
28677fdaa12SJohannes Berg 	struct mutex mtx;
28777fdaa12SJohannes Berg 	struct ieee80211_bss *associated;
288e21546a2SJohannes Berg 	struct ieee80211_mgd_work *old_associate_work;
28977fdaa12SJohannes Berg 	struct list_head work_list;
29046900298SJohannes Berg 
29177fdaa12SJohannes Berg 	u8 bssid[ETH_ALEN];
29246900298SJohannes Berg 
293f0706e82SJiri Benc 	u16 aid;
294a7c1cfc9SJohannes Berg 	u16 capab;
295f0706e82SJiri Benc 
296056cdd59SJohannes Berg 	struct sk_buff_head skb_queue;
297056cdd59SJohannes Berg 
2985bb644a0SJohannes Berg 	unsigned long timers_running; /* used for quiesce/restart */
299965bedadSJohannes Berg 	bool powersave; /* powersave requested for this iface */
3000f78231bSJohannes Berg 	enum ieee80211_smps_mode req_smps, /* requested smps mode */
3010f78231bSJohannes Berg 				 ap_smps; /* smps mode AP thinks we're in */
302965bedadSJohannes Berg 
303056cdd59SJohannes Berg 	unsigned long request;
304056cdd59SJohannes Berg 
305d6f2da5bSJiri Slaby 	unsigned int flags;
306f0706e82SJiri Benc 
307d91f36dbSJohannes Berg 	u32 beacon_crc;
308d91f36dbSJohannes Berg 
309fdfacf0aSJouni Malinen 	enum {
310fdfacf0aSJouni Malinen 		IEEE80211_MFP_DISABLED,
311fdfacf0aSJouni Malinen 		IEEE80211_MFP_OPTIONAL,
312fdfacf0aSJouni Malinen 		IEEE80211_MFP_REQUIRED
313fdfacf0aSJouni Malinen 	} mfp; /* management frame protection */
314fdfacf0aSJouni Malinen 
315f0706e82SJiri Benc 	int wmm_last_param_set;
3169bc383deSJohannes Berg 
3179bc383deSJohannes Berg 	u8 use_4addr;
318f0706e82SJiri Benc };
319f0706e82SJiri Benc 
32046900298SJohannes Berg enum ieee80211_ibss_request {
32146900298SJohannes Berg 	IEEE80211_IBSS_REQ_RUN	= 0,
32246900298SJohannes Berg };
32346900298SJohannes Berg 
32446900298SJohannes Berg struct ieee80211_if_ibss {
32546900298SJohannes Berg 	struct timer_list timer;
32646900298SJohannes Berg 	struct work_struct work;
32746900298SJohannes Berg 
32846900298SJohannes Berg 	struct sk_buff_head skb_queue;
32946900298SJohannes Berg 
330af8cdcd8SJohannes Berg 	unsigned long request;
331af8cdcd8SJohannes Berg 	unsigned long last_scan_completed;
3325bb644a0SJohannes Berg 
3335bb644a0SJohannes Berg 	bool timer_running;
3345bb644a0SJohannes Berg 
335af8cdcd8SJohannes Berg 	bool fixed_bssid;
336af8cdcd8SJohannes Berg 	bool fixed_channel;
337fffd0934SJohannes Berg 	bool privacy;
33846900298SJohannes Berg 
33946900298SJohannes Berg 	u8 bssid[ETH_ALEN];
340af8cdcd8SJohannes Berg 	u8 ssid[IEEE80211_MAX_SSID_LEN];
341af8cdcd8SJohannes Berg 	u8 ssid_len, ie_len;
342af8cdcd8SJohannes Berg 	u8 *ie;
343af8cdcd8SJohannes Berg 	struct ieee80211_channel *channel;
34446900298SJohannes Berg 
34546900298SJohannes Berg 	unsigned long ibss_join_req;
346af8cdcd8SJohannes Berg 	/* probe response/beacon for IBSS */
347af8cdcd8SJohannes Berg 	struct sk_buff *presp, *skb;
34846900298SJohannes Berg 
34946900298SJohannes Berg 	enum {
35046900298SJohannes Berg 		IEEE80211_IBSS_MLME_SEARCH,
35146900298SJohannes Berg 		IEEE80211_IBSS_MLME_JOINED,
35246900298SJohannes Berg 	} state;
35346900298SJohannes Berg };
35446900298SJohannes Berg 
355472dbc45SJohannes Berg struct ieee80211_if_mesh {
356472dbc45SJohannes Berg 	struct work_struct work;
357472dbc45SJohannes Berg 	struct timer_list housekeeping_timer;
358472dbc45SJohannes Berg 	struct timer_list mesh_path_timer;
359e304bfd3SRui Paulo 	struct timer_list mesh_path_root_timer;
360472dbc45SJohannes Berg 	struct sk_buff_head skb_queue;
361472dbc45SJohannes Berg 
3625bb644a0SJohannes Berg 	unsigned long timers_running;
3635bb644a0SJohannes Berg 
36418889231SJavier Cardona 	unsigned long wrkq_flags;
365472dbc45SJohannes Berg 
366472dbc45SJohannes Berg 	u8 mesh_id[IEEE80211_MAX_MESH_ID_LEN];
367472dbc45SJohannes Berg 	size_t mesh_id_len;
368472dbc45SJohannes Berg 	/* Active Path Selection Protocol Identifier */
3693491707aSRui Paulo 	u8 mesh_pp_id;
370472dbc45SJohannes Berg 	/* Active Path Selection Metric Identifier */
3713491707aSRui Paulo 	u8 mesh_pm_id;
372472dbc45SJohannes Berg 	/* Congestion Control Mode Identifier */
3733491707aSRui Paulo 	u8 mesh_cc_id;
3749e03fdfdSJavier Cardona 	/* Synchronization Protocol Identifier */
3753491707aSRui Paulo 	u8 mesh_sp_id;
3769e03fdfdSJavier Cardona 	/* Authentication Protocol Identifier */
3773491707aSRui Paulo 	u8 mesh_auth_id;
378d19b3bf6SRui Paulo 	/* Local mesh Sequence Number */
379d19b3bf6SRui Paulo 	u32 sn;
380472dbc45SJohannes Berg 	/* Last used PREQ ID */
381472dbc45SJohannes Berg 	u32 preq_id;
382472dbc45SJohannes Berg 	atomic_t mpaths;
383d19b3bf6SRui Paulo 	/* Timestamp of last SN update */
384d19b3bf6SRui Paulo 	unsigned long last_sn_update;
385d19b3bf6SRui Paulo 	/* Timestamp of last SN sent */
386472dbc45SJohannes Berg 	unsigned long last_preq;
387472dbc45SJohannes Berg 	struct mesh_rmc *rmc;
388472dbc45SJohannes Berg 	spinlock_t mesh_preq_queue_lock;
389472dbc45SJohannes Berg 	struct mesh_preq_queue preq_queue;
390472dbc45SJohannes Berg 	int preq_queue_len;
391472dbc45SJohannes Berg 	struct mesh_stats mshstats;
392472dbc45SJohannes Berg 	struct mesh_config mshcfg;
393472dbc45SJohannes Berg 	u32 mesh_seqnum;
394472dbc45SJohannes Berg 	bool accepting_plinks;
395472dbc45SJohannes Berg };
396902acc78SJohannes Berg 
397902acc78SJohannes Berg #ifdef CONFIG_MAC80211_MESH
398472dbc45SJohannes Berg #define IEEE80211_IFSTA_MESH_CTR_INC(msh, name)	\
399472dbc45SJohannes Berg 	do { (msh)->mshstats.name++; } while (0)
400902acc78SJohannes Berg #else
401472dbc45SJohannes Berg #define IEEE80211_IFSTA_MESH_CTR_INC(msh, name) \
402902acc78SJohannes Berg 	do { } while (0)
403902acc78SJohannes Berg #endif
404f0706e82SJiri Benc 
405213cd118SJohannes Berg /**
406213cd118SJohannes Berg  * enum ieee80211_sub_if_data_flags - virtual interface flags
407213cd118SJohannes Berg  *
408213cd118SJohannes Berg  * @IEEE80211_SDATA_ALLMULTI: interface wants all multicast packets
409213cd118SJohannes Berg  * @IEEE80211_SDATA_PROMISC: interface is promisc
410213cd118SJohannes Berg  * @IEEE80211_SDATA_OPERATING_GMODE: operating in G-only mode
411213cd118SJohannes Berg  * @IEEE80211_SDATA_DONT_BRIDGE_PACKETS: bridge packets between
412213cd118SJohannes Berg  *	associated stations and deliver multicast frames both
413213cd118SJohannes Berg  *	back to wireless media and to the local net stack.
414213cd118SJohannes Berg  */
415213cd118SJohannes Berg enum ieee80211_sub_if_data_flags {
416213cd118SJohannes Berg 	IEEE80211_SDATA_ALLMULTI		= BIT(0),
417213cd118SJohannes Berg 	IEEE80211_SDATA_PROMISC			= BIT(1),
4187986cf95SJohannes Berg 	IEEE80211_SDATA_OPERATING_GMODE		= BIT(2),
4197986cf95SJohannes Berg 	IEEE80211_SDATA_DONT_BRIDGE_PACKETS	= BIT(3),
420213cd118SJohannes Berg };
421213cd118SJohannes Berg 
422f0706e82SJiri Benc struct ieee80211_sub_if_data {
423f0706e82SJiri Benc 	struct list_head list;
424f0706e82SJiri Benc 
425f0706e82SJiri Benc 	struct wireless_dev wdev;
426f0706e82SJiri Benc 
42711a843b7SJohannes Berg 	/* keys */
42811a843b7SJohannes Berg 	struct list_head key_list;
42911a843b7SJohannes Berg 
430f0706e82SJiri Benc 	struct net_device *dev;
431f0706e82SJiri Benc 	struct ieee80211_local *local;
432f0706e82SJiri Benc 
43313262ffdSJiri Slaby 	unsigned int flags;
4347e9ed188SDaniel Drake 
435f0706e82SJiri Benc 	int drop_unencrypted;
436f0706e82SJiri Benc 
43747846c9bSJohannes Berg 	char name[IFNAMSIZ];
43847846c9bSJohannes Berg 
439413ad50aSJohannes Berg 	/*
440413ad50aSJohannes Berg 	 * keep track of whether the HT opmode (stored in
441413ad50aSJohannes Berg 	 * vif.bss_info.ht_operation_mode) is valid.
442413ad50aSJohannes Berg 	 */
443413ad50aSJohannes Berg 	bool ht_opmode_valid;
444413ad50aSJohannes Berg 
445f0706e82SJiri Benc 	/* Fragment table for host-based reassembly */
446f0706e82SJiri Benc 	struct ieee80211_fragment_entry	fragments[IEEE80211_FRAGMENT_MAX];
447f0706e82SJiri Benc 	unsigned int fragment_next;
448f0706e82SJiri Benc 
449f0706e82SJiri Benc #define NUM_DEFAULT_KEYS 4
4503cfcf6acSJouni Malinen #define NUM_DEFAULT_MGMT_KEYS 2
4513cfcf6acSJouni Malinen 	struct ieee80211_key *keys[NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS];
452f0706e82SJiri Benc 	struct ieee80211_key *default_key;
4533cfcf6acSJouni Malinen 	struct ieee80211_key *default_mgmt_key;
454f0706e82SJiri Benc 
45594778280SJohannes Berg 	u16 sequence_number;
45694778280SJohannes Berg 
4573e122be0SJohannes Berg 	/*
4583e122be0SJohannes Berg 	 * AP this belongs to: self in AP mode and
4593e122be0SJohannes Berg 	 * corresponding AP in VLAN mode, NULL for
4603e122be0SJohannes Berg 	 * all others (might be needed later in IBSS)
4613e122be0SJohannes Berg 	 */
4623e122be0SJohannes Berg 	struct ieee80211_if_ap *bss;
4633e122be0SJohannes Berg 
4643e122be0SJohannes Berg 	int force_unicast_rateidx; /* forced TX rateidx for unicast frames */
4653e122be0SJohannes Berg 	int max_ratectrl_rateidx; /* max TX rateidx for rate control */
466f0706e82SJiri Benc 
467f0706e82SJiri Benc 	union {
468f0706e82SJiri Benc 		struct ieee80211_if_ap ap;
469f0706e82SJiri Benc 		struct ieee80211_if_wds wds;
470f0706e82SJiri Benc 		struct ieee80211_if_vlan vlan;
47146900298SJohannes Berg 		struct ieee80211_if_managed mgd;
47246900298SJohannes Berg 		struct ieee80211_if_ibss ibss;
473472dbc45SJohannes Berg #ifdef CONFIG_MAC80211_MESH
474472dbc45SJohannes Berg 		struct ieee80211_if_mesh mesh;
475472dbc45SJohannes Berg #endif
4768cc9a739SMichael Wu 		u32 mntr_flags;
477f0706e82SJiri Benc 	} u;
478e9f207f0SJiri Benc 
479e9f207f0SJiri Benc #ifdef CONFIG_MAC80211_DEBUGFS
480e9f207f0SJiri Benc 	struct {
4817bcfaf2fSJohannes Berg 		struct dentry *dir;
4822b58b209SJouni Malinen 		struct dentry *default_key;
4833cfcf6acSJouni Malinen 		struct dentry *default_mgmt_key;
4847bcfaf2fSJohannes Berg 	} debugfs;
485e9f207f0SJiri Benc #endif
48632bfd35dSJohannes Berg 	/* must be last, dynamically sized area in this! */
48732bfd35dSJohannes Berg 	struct ieee80211_vif vif;
488f0706e82SJiri Benc };
489f0706e82SJiri Benc 
49032bfd35dSJohannes Berg static inline
49132bfd35dSJohannes Berg struct ieee80211_sub_if_data *vif_to_sdata(struct ieee80211_vif *p)
49232bfd35dSJohannes Berg {
49332bfd35dSJohannes Berg 	return container_of(p, struct ieee80211_sub_if_data, vif);
49432bfd35dSJohannes Berg }
49532bfd35dSJohannes Berg 
496472dbc45SJohannes Berg static inline void
497472dbc45SJohannes Berg ieee80211_sdata_set_mesh_id(struct ieee80211_sub_if_data *sdata,
498472dbc45SJohannes Berg 			    u8 mesh_id_len, u8 *mesh_id)
499472dbc45SJohannes Berg {
500472dbc45SJohannes Berg #ifdef CONFIG_MAC80211_MESH
501472dbc45SJohannes Berg 	struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
502472dbc45SJohannes Berg 	ifmsh->mesh_id_len = mesh_id_len;
503472dbc45SJohannes Berg 	memcpy(ifmsh->mesh_id, mesh_id, mesh_id_len);
504472dbc45SJohannes Berg #else
505472dbc45SJohannes Berg 	WARN_ON(1);
506472dbc45SJohannes Berg #endif
507472dbc45SJohannes Berg }
508472dbc45SJohannes Berg 
509f0706e82SJiri Benc enum {
510f0706e82SJiri Benc 	IEEE80211_RX_MSG	= 1,
511f0706e82SJiri Benc 	IEEE80211_TX_STATUS_MSG	= 2,
512eadc8d9eSRon Rindjunsky 	IEEE80211_DELBA_MSG	= 3,
513eadc8d9eSRon Rindjunsky 	IEEE80211_ADDBA_MSG	= 4,
514f0706e82SJiri Benc };
515f0706e82SJiri Benc 
516ce7c9111SKalle Valo enum queue_stop_reason {
517ce7c9111SKalle Valo 	IEEE80211_QUEUE_STOP_REASON_DRIVER,
518520eb820SKalle Valo 	IEEE80211_QUEUE_STOP_REASON_PS,
51996f5e66eSJohannes Berg 	IEEE80211_QUEUE_STOP_REASON_CSA,
52096f5e66eSJohannes Berg 	IEEE80211_QUEUE_STOP_REASON_AGGREGATION,
52125420604SJohannes Berg 	IEEE80211_QUEUE_STOP_REASON_SUSPEND,
5228f77f384SJohannes Berg 	IEEE80211_QUEUE_STOP_REASON_SKB_ADD,
523ce7c9111SKalle Valo };
524ce7c9111SKalle Valo 
525142b9f50SHelmut Schaa /**
526142b9f50SHelmut Schaa  * mac80211 scan flags - currently active scan mode
527142b9f50SHelmut Schaa  *
528142b9f50SHelmut Schaa  * @SCAN_SW_SCANNING: We're currently in the process of scanning but may as
529142b9f50SHelmut Schaa  *	well be on the operating channel
530142b9f50SHelmut Schaa  * @SCAN_HW_SCANNING: The hardware is scanning for us, we have no way to
531142b9f50SHelmut Schaa  *	determine if we are on the operating channel or not
532142b9f50SHelmut Schaa  * @SCAN_OFF_CHANNEL: We're off our operating channel for scanning,
533142b9f50SHelmut Schaa  *	gets only set in conjunction with SCAN_SW_SCANNING
534142b9f50SHelmut Schaa  */
535fbe9c429SHelmut Schaa enum {
536fbe9c429SHelmut Schaa 	SCAN_SW_SCANNING,
537142b9f50SHelmut Schaa 	SCAN_HW_SCANNING,
538142b9f50SHelmut Schaa 	SCAN_OFF_CHANNEL,
539142b9f50SHelmut Schaa };
540142b9f50SHelmut Schaa 
541142b9f50SHelmut Schaa /**
542142b9f50SHelmut Schaa  * enum mac80211_scan_state - scan state machine states
543142b9f50SHelmut Schaa  *
544142b9f50SHelmut Schaa  * @SCAN_DECISION: Main entry point to the scan state machine, this state
545142b9f50SHelmut Schaa  *	determines if we should keep on scanning or switch back to the
546142b9f50SHelmut Schaa  *	operating channel
547142b9f50SHelmut Schaa  * @SCAN_SET_CHANNEL: Set the next channel to be scanned
548142b9f50SHelmut Schaa  * @SCAN_SEND_PROBE: Send probe requests and wait for probe responses
549142b9f50SHelmut Schaa  * @SCAN_LEAVE_OPER_CHANNEL: Leave the operating channel, notify the AP
550142b9f50SHelmut Schaa  *	about us leaving the channel and stop all associated STA interfaces
551142b9f50SHelmut Schaa  * @SCAN_ENTER_OPER_CHANNEL: Enter the operating channel again, notify the
552142b9f50SHelmut Schaa  *	AP about us being back and restart all associated STA interfaces
553142b9f50SHelmut Schaa  */
554142b9f50SHelmut Schaa enum mac80211_scan_state {
555142b9f50SHelmut Schaa 	SCAN_DECISION,
556142b9f50SHelmut Schaa 	SCAN_SET_CHANNEL,
557142b9f50SHelmut Schaa 	SCAN_SEND_PROBE,
558142b9f50SHelmut Schaa 	SCAN_LEAVE_OPER_CHANNEL,
559142b9f50SHelmut Schaa 	SCAN_ENTER_OPER_CHANNEL,
560fbe9c429SHelmut Schaa };
561fbe9c429SHelmut Schaa 
562f0706e82SJiri Benc struct ieee80211_local {
563f0706e82SJiri Benc 	/* embed the driver visible part.
564f0706e82SJiri Benc 	 * don't cast (use the static inlines below), but we keep
565f0706e82SJiri Benc 	 * it first anyway so they become a no-op */
566f0706e82SJiri Benc 	struct ieee80211_hw hw;
567f0706e82SJiri Benc 
568f0706e82SJiri Benc 	const struct ieee80211_ops *ops;
569f0706e82SJiri Benc 
57042935ecaSLuis R. Rodriguez 	/*
57142935ecaSLuis R. Rodriguez 	 * private workqueue to mac80211. mac80211 makes this accessible
57242935ecaSLuis R. Rodriguez 	 * via ieee80211_queue_work()
57342935ecaSLuis R. Rodriguez 	 */
57442935ecaSLuis R. Rodriguez 	struct workqueue_struct *workqueue;
57542935ecaSLuis R. Rodriguez 
576e4e72fb4SJohannes Berg 	unsigned long queue_stop_reasons[IEEE80211_MAX_QUEUES];
57796f5e66eSJohannes Berg 	/* also used to protect ampdu_ac_queue and amdpu_ac_stop_refcnt */
578ce7c9111SKalle Valo 	spinlock_t queue_stop_reason_lock;
57996f5e66eSJohannes Berg 
580f0706e82SJiri Benc 	int open_count;
5813d30d949SMichael Wu 	int monitors, cooked_mntrs;
5828cc9a739SMichael Wu 	/* number of interfaces with corresponding FIF_ flags */
583e3b90ca2SIgor Perminov 	int fif_fcsfail, fif_plcpfail, fif_control, fif_other_bss, fif_pspoll;
5844150c572SJohannes Berg 	unsigned int filter_flags; /* FIF_* */
5853b8d81e0SJohannes Berg 
5863b8d81e0SJohannes Berg 	/* protects the aggregated multicast list and filter calls */
5873b8d81e0SJohannes Berg 	spinlock_t filter_lock;
5883b8d81e0SJohannes Berg 
5893ac64beeSJohannes Berg 	/* used for uploading changed mc list */
5903ac64beeSJohannes Berg 	struct work_struct reconfig_filter;
5913ac64beeSJohannes Berg 
5920f78231bSJohannes Berg 	/* used to reconfigure hardware SM PS */
5930f78231bSJohannes Berg 	struct work_struct recalc_smps;
5940f78231bSJohannes Berg 
5953b8d81e0SJohannes Berg 	/* aggregated multicast list */
5963b8d81e0SJohannes Berg 	struct dev_addr_list *mc_list;
5973b8d81e0SJohannes Berg 	int mc_count;
5983b8d81e0SJohannes Berg 
599d0709a65SJohannes Berg 	bool tim_in_locked_section; /* see ieee80211_beacon_get() */
6005bb644a0SJohannes Berg 
6015bb644a0SJohannes Berg 	/*
6025bb644a0SJohannes Berg 	 * suspended is true if we finished all the suspend _and_ we have
6035bb644a0SJohannes Berg 	 * not yet come up from resume. This is to be used by mac80211
6045bb644a0SJohannes Berg 	 * to ensure driver sanity during suspend and mac80211's own
6055bb644a0SJohannes Berg 	 * sanity. It can eventually be used for WoW as well.
6065bb644a0SJohannes Berg 	 */
6075bb644a0SJohannes Berg 	bool suspended;
6085bb644a0SJohannes Berg 
6095bb644a0SJohannes Berg 	/*
610ceb99fe0SJohannes Berg 	 * Resuming is true while suspended, but when we're reprogramming the
611ceb99fe0SJohannes Berg 	 * hardware -- at that time it's allowed to use ieee80211_queue_work()
612ceb99fe0SJohannes Berg 	 * again even though some other parts of the stack are still suspended
613ceb99fe0SJohannes Berg 	 * and we still drop received frames to avoid waking the stack.
614ceb99fe0SJohannes Berg 	 */
615ceb99fe0SJohannes Berg 	bool resuming;
616ceb99fe0SJohannes Berg 
617ceb99fe0SJohannes Berg 	/*
6185bb644a0SJohannes Berg 	 * quiescing is true during the suspend process _only_ to
6195bb644a0SJohannes Berg 	 * ease timer cancelling etc.
6205bb644a0SJohannes Berg 	 */
6215bb644a0SJohannes Berg 	bool quiescing;
6225bb644a0SJohannes Berg 
623ea77f12fSJohannes Berg 	/* device is started */
624ea77f12fSJohannes Berg 	bool started;
625ea77f12fSJohannes Berg 
626b306f453SJohannes Berg 	int tx_headroom; /* required headroom for hardware/radiotap */
627f0706e82SJiri Benc 
628f0706e82SJiri Benc 	/* Tasklet and skb queue to process calls from IRQ mode. All frames
629f0706e82SJiri Benc 	 * added to skb_queue will be processed, but frames in
630f0706e82SJiri Benc 	 * skb_queue_unreliable may be dropped if the total length of these
631f0706e82SJiri Benc 	 * queues increases over the limit. */
632f0706e82SJiri Benc #define IEEE80211_IRQSAFE_QUEUE_LIMIT 128
633f0706e82SJiri Benc 	struct tasklet_struct tasklet;
634f0706e82SJiri Benc 	struct sk_buff_head skb_queue;
635f0706e82SJiri Benc 	struct sk_buff_head skb_queue_unreliable;
636f0706e82SJiri Benc 
637d0709a65SJohannes Berg 	/* Station data */
638d0709a65SJohannes Berg 	/*
639d0709a65SJohannes Berg 	 * The lock only protects the list, hash, timer and counter
640d0709a65SJohannes Berg 	 * against manipulation, reads are done in RCU. Additionally,
641b16bd15cSJohannes Berg 	 * the lock protects each BSS's TIM bitmap.
642d0709a65SJohannes Berg 	 */
643d0709a65SJohannes Berg 	spinlock_t sta_lock;
644d0709a65SJohannes Berg 	unsigned long num_sta;
645f0706e82SJiri Benc 	struct list_head sta_list;
646f0706e82SJiri Benc 	struct sta_info *sta_hash[STA_HASH_SIZE];
647f0706e82SJiri Benc 	struct timer_list sta_cleanup;
648f5ea9120SJohannes Berg 	int sta_generation;
649f0706e82SJiri Benc 
6502a577d98SJohannes Berg 	struct sk_buff_head pending[IEEE80211_MAX_QUEUES];
651f0706e82SJiri Benc 	struct tasklet_struct tx_pending_tasklet;
652f0706e82SJiri Benc 
653cd8ffc80SJohannes Berg 	/*
654cd8ffc80SJohannes Berg 	 * This lock is used to prevent concurrent A-MPDU
655cd8ffc80SJohannes Berg 	 * session start/stop processing, this thus also
656cd8ffc80SJohannes Berg 	 * synchronises the ->ampdu_action() callback to
657cd8ffc80SJohannes Berg 	 * drivers and limits it to one at a time.
658cd8ffc80SJohannes Berg 	 */
659cd8ffc80SJohannes Berg 	spinlock_t ampdu_lock;
660cd8ffc80SJohannes Berg 
661f0706e82SJiri Benc 	/* number of interfaces with corresponding IFF_ flags */
66253918994SJohannes Berg 	atomic_t iff_allmultis, iff_promiscs;
663f0706e82SJiri Benc 
664f0706e82SJiri Benc 	struct rate_control_ref *rate_ctrl;
665f0706e82SJiri Benc 
666f0706e82SJiri Benc 	struct crypto_blkcipher *wep_tx_tfm;
667f0706e82SJiri Benc 	struct crypto_blkcipher *wep_rx_tfm;
668f0706e82SJiri Benc 	u32 wep_iv;
669f0706e82SJiri Benc 
670c771c9d8SJohannes Berg 	/* see iface.c */
67179010420SJohannes Berg 	struct list_head interfaces;
672c771c9d8SJohannes Berg 	struct mutex iflist_mtx;
67379010420SJohannes Berg 
674b16bd15cSJohannes Berg 	/*
675b16bd15cSJohannes Berg 	 * Key lock, protects sdata's key_list and sta_info's
676b16bd15cSJohannes Berg 	 * key pointers (write access, they're RCU.)
677b16bd15cSJohannes Berg 	 */
678b16bd15cSJohannes Berg 	spinlock_t key_lock;
679b16bd15cSJohannes Berg 
680b16bd15cSJohannes Berg 
681c2b13452SJohannes Berg 	/* Scanning and BSS list */
682f3b85252SJohannes Berg 	struct mutex scan_mtx;
683fbe9c429SHelmut Schaa 	unsigned long scanning;
6842a519311SJohannes Berg 	struct cfg80211_ssid scan_ssid;
6855ba63533SJohannes Berg 	struct cfg80211_scan_request *int_scan_req;
6864d36ec58SJohannes Berg 	struct cfg80211_scan_request *scan_req, *hw_scan_req;
6872a519311SJohannes Berg 	struct ieee80211_channel *scan_channel;
6884d36ec58SJohannes Berg 	enum ieee80211_band hw_scan_band;
689f0706e82SJiri Benc 	int scan_channel_idx;
690de95a54bSJohannes Berg 	int scan_ies_len;
6918318d78aSJohannes Berg 
692977923b0SHelmut Schaa 	enum mac80211_scan_state next_scan_state;
693f0706e82SJiri Benc 	struct delayed_work scan_work;
694491775a5SJohannes Berg 	struct ieee80211_sub_if_data *scan_sdata;
695094d05dcSSujith 	enum nl80211_channel_type oper_channel_type;
6962a519311SJohannes Berg 	struct ieee80211_channel *oper_channel, *csa_channel;
697f0706e82SJiri Benc 
698f0706e82SJiri Benc 	/* SNMP counters */
699f0706e82SJiri Benc 	/* dot11CountersTable */
700f0706e82SJiri Benc 	u32 dot11TransmittedFragmentCount;
701f0706e82SJiri Benc 	u32 dot11MulticastTransmittedFrameCount;
702f0706e82SJiri Benc 	u32 dot11FailedCount;
703f0706e82SJiri Benc 	u32 dot11RetryCount;
704f0706e82SJiri Benc 	u32 dot11MultipleRetryCount;
705f0706e82SJiri Benc 	u32 dot11FrameDuplicateCount;
706f0706e82SJiri Benc 	u32 dot11ReceivedFragmentCount;
707f0706e82SJiri Benc 	u32 dot11MulticastReceivedFrameCount;
708f0706e82SJiri Benc 	u32 dot11TransmittedFrameCount;
709f0706e82SJiri Benc 
710f0706e82SJiri Benc #ifdef CONFIG_MAC80211_LEDS
711f0706e82SJiri Benc 	int tx_led_counter, rx_led_counter;
712cdcb006fSIvo van Doorn 	struct led_trigger *tx_led, *rx_led, *assoc_led, *radio_led;
713cdcb006fSIvo van Doorn 	char tx_led_name[32], rx_led_name[32],
714cdcb006fSIvo van Doorn 	     assoc_led_name[32], radio_led_name[32];
715f0706e82SJiri Benc #endif
716f0706e82SJiri Benc 
717e9f207f0SJiri Benc #ifdef CONFIG_MAC80211_DEBUGFS
718e9f207f0SJiri Benc 	struct work_struct sta_debugfs_add;
719e9f207f0SJiri Benc #endif
720e9f207f0SJiri Benc 
721f0706e82SJiri Benc #ifdef CONFIG_MAC80211_DEBUG_COUNTERS
722f0706e82SJiri Benc 	/* TX/RX handler statistics */
723f0706e82SJiri Benc 	unsigned int tx_handlers_drop;
724f0706e82SJiri Benc 	unsigned int tx_handlers_queued;
725f0706e82SJiri Benc 	unsigned int tx_handlers_drop_unencrypted;
726f0706e82SJiri Benc 	unsigned int tx_handlers_drop_fragment;
727f0706e82SJiri Benc 	unsigned int tx_handlers_drop_wep;
728f0706e82SJiri Benc 	unsigned int tx_handlers_drop_not_assoc;
729f0706e82SJiri Benc 	unsigned int tx_handlers_drop_unauth_port;
730f0706e82SJiri Benc 	unsigned int rx_handlers_drop;
731f0706e82SJiri Benc 	unsigned int rx_handlers_queued;
732f0706e82SJiri Benc 	unsigned int rx_handlers_drop_nullfunc;
733f0706e82SJiri Benc 	unsigned int rx_handlers_drop_defrag;
734f0706e82SJiri Benc 	unsigned int rx_handlers_drop_short;
735f0706e82SJiri Benc 	unsigned int rx_handlers_drop_passive_scan;
736f0706e82SJiri Benc 	unsigned int tx_expand_skb_head;
737f0706e82SJiri Benc 	unsigned int tx_expand_skb_head_cloned;
738f0706e82SJiri Benc 	unsigned int rx_expand_skb_head;
739f0706e82SJiri Benc 	unsigned int rx_expand_skb_head2;
740f0706e82SJiri Benc 	unsigned int rx_handlers_fragments;
741f0706e82SJiri Benc 	unsigned int tx_status_drop;
742f0706e82SJiri Benc #define I802_DEBUG_INC(c) (c)++
743f0706e82SJiri Benc #else /* CONFIG_MAC80211_DEBUG_COUNTERS */
744f0706e82SJiri Benc #define I802_DEBUG_INC(c) do { } while (0)
745f0706e82SJiri Benc #endif /* CONFIG_MAC80211_DEBUG_COUNTERS */
746f0706e82SJiri Benc 
747f0706e82SJiri Benc 
748f0706e82SJiri Benc 	int total_ps_buffered; /* total number of all buffered unicast and
749f0706e82SJiri Benc 				* multicast packets for power saving stations
750f0706e82SJiri Benc 				*/
751f0706e82SJiri Benc 	int wifi_wme_noack_test;
752f0706e82SJiri Benc 	unsigned int wmm_acm; /* bit field of ACM bits (BIT(802.1D tag)) */
753520eb820SKalle Valo 
754572e0012SKalle Valo 	bool pspolling;
755965bedadSJohannes Berg 	/*
756965bedadSJohannes Berg 	 * PS can only be enabled when we have exactly one managed
757965bedadSJohannes Berg 	 * interface (and monitors) in PS, this then points there.
758965bedadSJohannes Berg 	 */
759965bedadSJohannes Berg 	struct ieee80211_sub_if_data *ps_sdata;
760520eb820SKalle Valo 	struct work_struct dynamic_ps_enable_work;
761520eb820SKalle Valo 	struct work_struct dynamic_ps_disable_work;
762520eb820SKalle Valo 	struct timer_list dynamic_ps_timer;
76310f644a4SJohannes Berg 	struct notifier_block network_latency_notifier;
764f0706e82SJiri Benc 
7652bf30fabSJohannes Berg 	int user_power_level; /* in dBm */
766a8302de9SVasanthakumar Thiagarajan 	int power_constr_level; /* in dBm */
7672bf30fabSJohannes Berg 
7680f78231bSJohannes Berg 	enum ieee80211_smps_mode smps_mode;
7690f78231bSJohannes Berg 
770f2753ddbSJohannes Berg 	struct work_struct restart_work;
771f2753ddbSJohannes Berg 
772e9f207f0SJiri Benc #ifdef CONFIG_MAC80211_DEBUGFS
773e9f207f0SJiri Benc 	struct local_debugfsdentries {
7744b7679a5SJohannes Berg 		struct dentry *rcdir;
775e9f207f0SJiri Benc 		struct dentry *stations;
776e9f207f0SJiri Benc 		struct dentry *keys;
777e9f207f0SJiri Benc 	} debugfs;
778e9f207f0SJiri Benc #endif
779f0706e82SJiri Benc };
780f0706e82SJiri Benc 
7813e122be0SJohannes Berg static inline struct ieee80211_sub_if_data *
7823e122be0SJohannes Berg IEEE80211_DEV_TO_SUB_IF(struct net_device *dev)
7833e122be0SJohannes Berg {
7843e122be0SJohannes Berg 	return netdev_priv(dev);
7853e122be0SJohannes Berg }
7863e122be0SJohannes Berg 
787c951ad35SJohannes Berg /* this struct represents 802.11n's RA/TID combination along with our vif */
788eadc8d9eSRon Rindjunsky struct ieee80211_ra_tid {
789c951ad35SJohannes Berg 	struct ieee80211_vif *vif;
790eadc8d9eSRon Rindjunsky 	u8 ra[ETH_ALEN];
791eadc8d9eSRon Rindjunsky 	u16 tid;
792eadc8d9eSRon Rindjunsky };
793eadc8d9eSRon Rindjunsky 
794ee385855SLuis Carlos Cobo /* Parsed Information Elements */
795ee385855SLuis Carlos Cobo struct ieee802_11_elems {
79643ac2ca3SJouni Malinen 	u8 *ie_start;
79743ac2ca3SJouni Malinen 	size_t total_len;
79843ac2ca3SJouni Malinen 
799ee385855SLuis Carlos Cobo 	/* pointers to IEs */
800ee385855SLuis Carlos Cobo 	u8 *ssid;
801ee385855SLuis Carlos Cobo 	u8 *supp_rates;
802ee385855SLuis Carlos Cobo 	u8 *fh_params;
803ee385855SLuis Carlos Cobo 	u8 *ds_params;
804ee385855SLuis Carlos Cobo 	u8 *cf_params;
805e7ec86f5SJohannes Berg 	struct ieee80211_tim_ie *tim;
806ee385855SLuis Carlos Cobo 	u8 *ibss_params;
807ee385855SLuis Carlos Cobo 	u8 *challenge;
808ee385855SLuis Carlos Cobo 	u8 *wpa;
809ee385855SLuis Carlos Cobo 	u8 *rsn;
810ee385855SLuis Carlos Cobo 	u8 *erp_info;
811ee385855SLuis Carlos Cobo 	u8 *ext_supp_rates;
812ee385855SLuis Carlos Cobo 	u8 *wmm_info;
813ee385855SLuis Carlos Cobo 	u8 *wmm_param;
81409914813SJohannes Berg 	struct ieee80211_ht_cap *ht_cap_elem;
815d9fe60deSJohannes Berg 	struct ieee80211_ht_info *ht_info_elem;
816136cfa28SRui Paulo 	struct ieee80211_meshconf_ie *mesh_config;
817ee385855SLuis Carlos Cobo 	u8 *mesh_id;
818ee385855SLuis Carlos Cobo 	u8 *peer_link;
819ee385855SLuis Carlos Cobo 	u8 *preq;
820ee385855SLuis Carlos Cobo 	u8 *prep;
821ee385855SLuis Carlos Cobo 	u8 *perr;
82290a5e169SRui Paulo 	struct ieee80211_rann_ie *rann;
823f2df3859SAssaf Krauss 	u8 *ch_switch_elem;
824f2df3859SAssaf Krauss 	u8 *country_elem;
825f2df3859SAssaf Krauss 	u8 *pwr_constr_elem;
826f2df3859SAssaf Krauss 	u8 *quiet_elem; 	/* first quite element */
827f797eb7eSJouni Malinen 	u8 *timeout_int;
828ee385855SLuis Carlos Cobo 
829ee385855SLuis Carlos Cobo 	/* length of them, respectively */
830ee385855SLuis Carlos Cobo 	u8 ssid_len;
831ee385855SLuis Carlos Cobo 	u8 supp_rates_len;
832ee385855SLuis Carlos Cobo 	u8 fh_params_len;
833ee385855SLuis Carlos Cobo 	u8 ds_params_len;
834ee385855SLuis Carlos Cobo 	u8 cf_params_len;
835ee385855SLuis Carlos Cobo 	u8 tim_len;
836ee385855SLuis Carlos Cobo 	u8 ibss_params_len;
837ee385855SLuis Carlos Cobo 	u8 challenge_len;
838ee385855SLuis Carlos Cobo 	u8 wpa_len;
839ee385855SLuis Carlos Cobo 	u8 rsn_len;
840ee385855SLuis Carlos Cobo 	u8 erp_info_len;
841ee385855SLuis Carlos Cobo 	u8 ext_supp_rates_len;
842ee385855SLuis Carlos Cobo 	u8 wmm_info_len;
843ee385855SLuis Carlos Cobo 	u8 wmm_param_len;
844ee385855SLuis Carlos Cobo 	u8 mesh_id_len;
845ee385855SLuis Carlos Cobo 	u8 peer_link_len;
846ee385855SLuis Carlos Cobo 	u8 preq_len;
847ee385855SLuis Carlos Cobo 	u8 prep_len;
848ee385855SLuis Carlos Cobo 	u8 perr_len;
849f2df3859SAssaf Krauss 	u8 ch_switch_elem_len;
850f2df3859SAssaf Krauss 	u8 country_elem_len;
851f2df3859SAssaf Krauss 	u8 pwr_constr_elem_len;
852f2df3859SAssaf Krauss 	u8 quiet_elem_len;
853f2df3859SAssaf Krauss 	u8 num_of_quiet_elem;	/* can be more the one */
854f797eb7eSJouni Malinen 	u8 timeout_int_len;
855ee385855SLuis Carlos Cobo };
856ee385855SLuis Carlos Cobo 
857f0706e82SJiri Benc static inline struct ieee80211_local *hw_to_local(
858f0706e82SJiri Benc 	struct ieee80211_hw *hw)
859f0706e82SJiri Benc {
860f0706e82SJiri Benc 	return container_of(hw, struct ieee80211_local, hw);
861f0706e82SJiri Benc }
862f0706e82SJiri Benc 
863f0706e82SJiri Benc static inline struct ieee80211_hw *local_to_hw(
864f0706e82SJiri Benc 	struct ieee80211_local *local)
865f0706e82SJiri Benc {
866f0706e82SJiri Benc 	return &local->hw;
867f0706e82SJiri Benc }
868f0706e82SJiri Benc 
869f0706e82SJiri Benc 
870571ecf67SJohannes Berg static inline int ieee80211_bssid_match(const u8 *raddr, const u8 *addr)
871571ecf67SJohannes Berg {
872571ecf67SJohannes Berg 	return compare_ether_addr(raddr, addr) == 0 ||
873571ecf67SJohannes Berg 	       is_broadcast_ether_addr(raddr);
874571ecf67SJohannes Berg }
875571ecf67SJohannes Berg 
876571ecf67SJohannes Berg 
877e8975581SJohannes Berg int ieee80211_hw_config(struct ieee80211_local *local, u32 changed);
8785cf121c3SJohannes Berg void ieee80211_tx_set_protected(struct ieee80211_tx_data *tx);
8799c6bd790SJohannes Berg void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata,
8809c6bd790SJohannes Berg 				      u32 changed);
8810d143fe1SJohannes Berg void ieee80211_configure_filter(struct ieee80211_local *local);
88246900298SJohannes Berg u32 ieee80211_reset_erp_info(struct ieee80211_sub_if_data *sdata);
883f0706e82SJiri Benc 
884f38fd12fSJohannes Berg extern bool ieee80211_disable_40mhz_24ghz;
885f38fd12fSJohannes Berg 
88646900298SJohannes Berg /* STA code */
8879c6bd790SJohannes Berg void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata);
88877fdaa12SJohannes Berg int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata,
88977fdaa12SJohannes Berg 		       struct cfg80211_auth_request *req);
89077fdaa12SJohannes Berg int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,
89177fdaa12SJohannes Berg 			struct cfg80211_assoc_request *req);
89277fdaa12SJohannes Berg int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata,
893667503ddSJohannes Berg 			 struct cfg80211_deauth_request *req,
894667503ddSJohannes Berg 			 void *cookie);
89577fdaa12SJohannes Berg int ieee80211_mgd_disassoc(struct ieee80211_sub_if_data *sdata,
896667503ddSJohannes Berg 			   struct cfg80211_disassoc_request *req,
897667503ddSJohannes Berg 			   void *cookie);
89846900298SJohannes Berg ieee80211_rx_result ieee80211_sta_rx_mgmt(struct ieee80211_sub_if_data *sdata,
899f1d58c25SJohannes Berg 					  struct sk_buff *skb);
900572e0012SKalle Valo void ieee80211_send_pspoll(struct ieee80211_local *local,
901572e0012SKalle Valo 			   struct ieee80211_sub_if_data *sdata);
90210f644a4SJohannes Berg void ieee80211_recalc_ps(struct ieee80211_local *local, s32 latency);
90310f644a4SJohannes Berg int ieee80211_max_network_latency(struct notifier_block *nb,
90410f644a4SJohannes Berg 				  unsigned long data, void *dummy);
905cc32abd4SJohannes Berg void ieee80211_sta_process_chanswitch(struct ieee80211_sub_if_data *sdata,
906cc32abd4SJohannes Berg 				      struct ieee80211_channel_sw_ie *sw_elem,
907cc32abd4SJohannes Berg 				      struct ieee80211_bss *bss);
9085bb644a0SJohannes Berg void ieee80211_sta_quiesce(struct ieee80211_sub_if_data *sdata);
9095bb644a0SJohannes Berg void ieee80211_sta_restart(struct ieee80211_sub_if_data *sdata);
9109c6bd790SJohannes Berg 
91146900298SJohannes Berg /* IBSS code */
91246900298SJohannes Berg void ieee80211_ibss_notify_scan_completed(struct ieee80211_local *local);
91346900298SJohannes Berg void ieee80211_ibss_setup_sdata(struct ieee80211_sub_if_data *sdata);
91446900298SJohannes Berg ieee80211_rx_result
915f1d58c25SJohannes Berg ieee80211_ibss_rx_mgmt(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb);
91646900298SJohannes Berg struct sta_info *ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata,
91746900298SJohannes Berg 					u8 *bssid, u8 *addr, u32 supp_rates);
918af8cdcd8SJohannes Berg int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata,
919af8cdcd8SJohannes Berg 			struct cfg80211_ibss_params *params);
920af8cdcd8SJohannes Berg int ieee80211_ibss_leave(struct ieee80211_sub_if_data *sdata);
9215bb644a0SJohannes Berg void ieee80211_ibss_quiesce(struct ieee80211_sub_if_data *sdata);
9225bb644a0SJohannes Berg void ieee80211_ibss_restart(struct ieee80211_sub_if_data *sdata);
92346900298SJohannes Berg 
9249c6bd790SJohannes Berg /* scan/BSS handling */
92546900298SJohannes Berg void ieee80211_scan_work(struct work_struct *work);
926f3b85252SJohannes Berg int ieee80211_request_internal_scan(struct ieee80211_sub_if_data *sdata,
927f3b85252SJohannes Berg 				    const u8 *ssid, u8 ssid_len);
928c2b13452SJohannes Berg int ieee80211_request_scan(struct ieee80211_sub_if_data *sdata,
9292a519311SJohannes Berg 			   struct cfg80211_scan_request *req);
9305bb644a0SJohannes Berg void ieee80211_scan_cancel(struct ieee80211_local *local);
931c2b13452SJohannes Berg ieee80211_rx_result
932f1d58c25SJohannes Berg ieee80211_scan_rx(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb);
9339c6bd790SJohannes Berg 
9340a51b27eSJohannes Berg void ieee80211_mlme_notify_scan_completed(struct ieee80211_local *local);
935c2b13452SJohannes Berg struct ieee80211_bss *
93698c8fccfSJohannes Berg ieee80211_bss_info_update(struct ieee80211_local *local,
93798c8fccfSJohannes Berg 			  struct ieee80211_rx_status *rx_status,
93898c8fccfSJohannes Berg 			  struct ieee80211_mgmt *mgmt,
93998c8fccfSJohannes Berg 			  size_t len,
94098c8fccfSJohannes Berg 			  struct ieee802_11_elems *elems,
9412a519311SJohannes Berg 			  struct ieee80211_channel *channel,
9422a519311SJohannes Berg 			  bool beacon);
943c2b13452SJohannes Berg struct ieee80211_bss *
9445484e237SJohannes Berg ieee80211_rx_bss_get(struct ieee80211_local *local, u8 *bssid, int freq,
9455484e237SJohannes Berg 		     u8 *ssid, u8 ssid_len);
94698c8fccfSJohannes Berg void ieee80211_rx_bss_put(struct ieee80211_local *local,
947c2b13452SJohannes Berg 			  struct ieee80211_bss *bss);
948ee385855SLuis Carlos Cobo 
9493e122be0SJohannes Berg /* interface handling */
95047846c9bSJohannes Berg int ieee80211_iface_init(void);
95147846c9bSJohannes Berg void ieee80211_iface_exit(void);
9523e122be0SJohannes Berg int ieee80211_if_add(struct ieee80211_local *local, const char *name,
95305c914feSJohannes Berg 		     struct net_device **new_dev, enum nl80211_iftype type,
954ee385855SLuis Carlos Cobo 		     struct vif_params *params);
955f3947e2dSJohannes Berg int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata,
95605c914feSJohannes Berg 			     enum nl80211_iftype type);
957f698d856SJasper Bryant-Greene void ieee80211_if_remove(struct ieee80211_sub_if_data *sdata);
95875636525SJohannes Berg void ieee80211_remove_interfaces(struct ieee80211_local *local);
9595cff20e6SJohannes Berg u32 __ieee80211_recalc_idle(struct ieee80211_local *local);
9605cff20e6SJohannes Berg void ieee80211_recalc_idle(struct ieee80211_local *local);
961f0706e82SJiri Benc 
962e2ebc74dSJohannes Berg /* tx handling */
963e2ebc74dSJohannes Berg void ieee80211_clear_tx_pending(struct ieee80211_local *local);
964e2ebc74dSJohannes Berg void ieee80211_tx_pending(unsigned long data);
965d0cf9c0dSStephen Hemminger netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb,
966d0cf9c0dSStephen Hemminger 					 struct net_device *dev);
967d0cf9c0dSStephen Hemminger netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
968d0cf9c0dSStephen Hemminger 				       struct net_device *dev);
969e2ebc74dSJohannes Berg 
970fe7a5d5cSJohannes Berg /*
971fe7a5d5cSJohannes Berg  * radiotap header for status frames
972fe7a5d5cSJohannes Berg  */
973fe7a5d5cSJohannes Berg struct ieee80211_tx_status_rtap_hdr {
974fe7a5d5cSJohannes Berg 	struct ieee80211_radiotap_header hdr;
975fe7a5d5cSJohannes Berg 	u8 rate;
976fe7a5d5cSJohannes Berg 	u8 padding_for_rate;
977fe7a5d5cSJohannes Berg 	__le16 tx_flags;
978fe7a5d5cSJohannes Berg 	u8 data_retries;
979fe7a5d5cSJohannes Berg } __attribute__ ((packed));
980fe7a5d5cSJohannes Berg 
981fe7a5d5cSJohannes Berg 
982de1ede7aSJohannes Berg /* HT */
983ae5eb026SJohannes Berg void ieee80211_ht_cap_ie_to_sta_ht_cap(struct ieee80211_supported_band *sband,
984ae5eb026SJohannes Berg 				       struct ieee80211_ht_cap *ht_cap_ie,
985d9fe60deSJohannes Berg 				       struct ieee80211_sta_ht_cap *ht_cap);
986de1ede7aSJohannes Berg void ieee80211_send_bar(struct ieee80211_sub_if_data *sdata, u8 *ra, u16 tid, u16 ssn);
987b8695a8fSJohannes Berg void ieee80211_send_delba(struct ieee80211_sub_if_data *sdata,
988b8695a8fSJohannes Berg 			  const u8 *da, u16 tid,
989b8695a8fSJohannes Berg 			  u16 initiator, u16 reason_code);
9900f78231bSJohannes Berg int ieee80211_send_smps_action(struct ieee80211_sub_if_data *sdata,
9910f78231bSJohannes Berg 			       enum ieee80211_smps_mode smps, const u8 *da,
9920f78231bSJohannes Berg 			       const u8 *bssid);
993de1ede7aSJohannes Berg 
994de1ede7aSJohannes Berg void ieee80211_sta_stop_rx_ba_session(struct ieee80211_sub_if_data *sdata, u8 *da,
995de1ede7aSJohannes Berg 				u16 tid, u16 initiator, u16 reason);
996849b7967SJohannes Berg void __ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid,
997849b7967SJohannes Berg 				    u16 initiator, u16 reason);
9982dace10eSJohannes Berg void ieee80211_sta_tear_down_BA_sessions(struct sta_info *sta);
999de1ede7aSJohannes Berg void ieee80211_process_delba(struct ieee80211_sub_if_data *sdata,
1000de1ede7aSJohannes Berg 			     struct sta_info *sta,
1001de1ede7aSJohannes Berg 			     struct ieee80211_mgmt *mgmt, size_t len);
1002de1ede7aSJohannes Berg void ieee80211_process_addba_resp(struct ieee80211_local *local,
1003de1ede7aSJohannes Berg 				  struct sta_info *sta,
1004de1ede7aSJohannes Berg 				  struct ieee80211_mgmt *mgmt,
1005de1ede7aSJohannes Berg 				  size_t len);
1006de1ede7aSJohannes Berg void ieee80211_process_addba_request(struct ieee80211_local *local,
1007de1ede7aSJohannes Berg 				     struct sta_info *sta,
1008de1ede7aSJohannes Berg 				     struct ieee80211_mgmt *mgmt,
1009de1ede7aSJohannes Berg 				     size_t len);
1010de1ede7aSJohannes Berg 
1011849b7967SJohannes Berg int __ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
1012849b7967SJohannes Berg 				   enum ieee80211_back_parties initiator);
1013827d42c9SJohannes Berg int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
1014827d42c9SJohannes Berg 				    enum ieee80211_back_parties initiator);
1015849b7967SJohannes Berg 
101639192c0bSJohannes Berg /* Spectrum management */
101739192c0bSJohannes Berg void ieee80211_process_measurement_req(struct ieee80211_sub_if_data *sdata,
101839192c0bSJohannes Berg 				       struct ieee80211_mgmt *mgmt,
101939192c0bSJohannes Berg 				       size_t len);
102039192c0bSJohannes Berg 
1021f2753ddbSJohannes Berg /* Suspend/resume and hw reconfiguration */
1022f2753ddbSJohannes Berg int ieee80211_reconfig(struct ieee80211_local *local);
102384f6a01cSJohannes Berg void ieee80211_stop_device(struct ieee80211_local *local);
1024f2753ddbSJohannes Berg 
1025827b1fb4SJohannes Berg #ifdef CONFIG_PM
1026665af4fcSBob Copeland int __ieee80211_suspend(struct ieee80211_hw *hw);
1027f2753ddbSJohannes Berg 
1028f2753ddbSJohannes Berg static inline int __ieee80211_resume(struct ieee80211_hw *hw)
1029f2753ddbSJohannes Berg {
1030f2753ddbSJohannes Berg 	return ieee80211_reconfig(hw_to_local(hw));
1031f2753ddbSJohannes Berg }
1032827b1fb4SJohannes Berg #else
1033827b1fb4SJohannes Berg static inline int __ieee80211_suspend(struct ieee80211_hw *hw)
1034827b1fb4SJohannes Berg {
1035827b1fb4SJohannes Berg 	return 0;
1036827b1fb4SJohannes Berg }
1037f2753ddbSJohannes Berg 
1038827b1fb4SJohannes Berg static inline int __ieee80211_resume(struct ieee80211_hw *hw)
1039827b1fb4SJohannes Berg {
1040827b1fb4SJohannes Berg 	return 0;
1041827b1fb4SJohannes Berg }
1042827b1fb4SJohannes Berg #endif
1043665af4fcSBob Copeland 
1044c2d1560aSJohannes Berg /* utility functions/constants */
1045c2d1560aSJohannes Berg extern void *mac80211_wiphy_privid; /* for wiphy privid */
104671364716SRon Rindjunsky u8 *ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t len,
104705c914feSJohannes Berg 			enum nl80211_iftype type);
1048c2d1560aSJohannes Berg int ieee80211_frame_duration(struct ieee80211_local *local, size_t len,
1049c2d1560aSJohannes Berg 			     int rate, int erp, int short_preamble);
1050f698d856SJasper Bryant-Greene void mac80211_ev_michael_mic_failure(struct ieee80211_sub_if_data *sdata, int keyidx,
1051e6d6e342SJohannes Berg 				     struct ieee80211_hdr *hdr, const u8 *tsc,
1052e6d6e342SJohannes Berg 				     gfp_t gfp);
10535825fe10SJohannes Berg void ieee80211_set_wmm_default(struct ieee80211_sub_if_data *sdata);
105462ae67beSJohannes Berg void ieee80211_tx_skb(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb);
10559c6bd790SJohannes Berg void ieee802_11_parse_elems(u8 *start, size_t len,
10569c6bd790SJohannes Berg 			    struct ieee802_11_elems *elems);
1057d91f36dbSJohannes Berg u32 ieee802_11_parse_elems_crc(u8 *start, size_t len,
1058d91f36dbSJohannes Berg 			       struct ieee802_11_elems *elems,
1059d91f36dbSJohannes Berg 			       u64 filter, u32 crc);
1060881d948cSJohannes Berg u32 ieee80211_mandatory_rates(struct ieee80211_local *local,
106196dd22acSJohannes Berg 			      enum ieee80211_band band);
1062f0706e82SJiri Benc 
1063520eb820SKalle Valo void ieee80211_dynamic_ps_enable_work(struct work_struct *work);
1064520eb820SKalle Valo void ieee80211_dynamic_ps_disable_work(struct work_struct *work);
1065520eb820SKalle Valo void ieee80211_dynamic_ps_timer(unsigned long data);
1066a97b77b9SVivek Natarajan void ieee80211_send_nullfunc(struct ieee80211_local *local,
1067a97b77b9SVivek Natarajan 			     struct ieee80211_sub_if_data *sdata,
1068a97b77b9SVivek Natarajan 			     int powersave);
10693cf335d5SKalle Valo void ieee80211_sta_rx_notify(struct ieee80211_sub_if_data *sdata,
10703cf335d5SKalle Valo 			     struct ieee80211_hdr *hdr);
107104de8381SKalle Valo void ieee80211_beacon_loss_work(struct work_struct *work);
1072520eb820SKalle Valo 
1073ce7c9111SKalle Valo void ieee80211_wake_queues_by_reason(struct ieee80211_hw *hw,
1074ce7c9111SKalle Valo 				     enum queue_stop_reason reason);
1075ce7c9111SKalle Valo void ieee80211_stop_queues_by_reason(struct ieee80211_hw *hw,
1076ce7c9111SKalle Valo 				     enum queue_stop_reason reason);
107796f5e66eSJohannes Berg void ieee80211_wake_queue_by_reason(struct ieee80211_hw *hw, int queue,
107896f5e66eSJohannes Berg 				    enum queue_stop_reason reason);
107996f5e66eSJohannes Berg void ieee80211_stop_queue_by_reason(struct ieee80211_hw *hw, int queue,
108096f5e66eSJohannes Berg 				    enum queue_stop_reason reason);
10818f77f384SJohannes Berg void ieee80211_add_pending_skb(struct ieee80211_local *local,
10828f77f384SJohannes Berg 			       struct sk_buff *skb);
10838f77f384SJohannes Berg int ieee80211_add_pending_skbs(struct ieee80211_local *local,
10848f77f384SJohannes Berg 			       struct sk_buff_head *skbs);
1085ce7c9111SKalle Valo 
108646900298SJohannes Berg void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata,
108746900298SJohannes Berg 			 u16 transaction, u16 auth_alg,
1088fffd0934SJohannes Berg 			 u8 *extra, size_t extra_len, const u8 *bssid,
1089fffd0934SJohannes Berg 			 const u8 *key, u8 key_len, u8 key_idx);
1090de95a54bSJohannes Berg int ieee80211_build_preq_ies(struct ieee80211_local *local, u8 *buffer,
10914d36ec58SJohannes Berg 			     const u8 *ie, size_t ie_len,
10924d36ec58SJohannes Berg 			     enum ieee80211_band band);
109346900298SJohannes Berg void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst,
1094de95a54bSJohannes Berg 			      const u8 *ssid, size_t ssid_len,
1095de95a54bSJohannes Berg 			      const u8 *ie, size_t ie_len);
109646900298SJohannes Berg 
109746900298SJohannes Berg void ieee80211_sta_def_wmm_params(struct ieee80211_sub_if_data *sdata,
109846900298SJohannes Berg 				  const size_t supp_rates_len,
109946900298SJohannes Berg 				  const u8 *supp_rates);
110046900298SJohannes Berg u32 ieee80211_sta_get_rates(struct ieee80211_local *local,
110146900298SJohannes Berg 			    struct ieee802_11_elems *elems,
110246900298SJohannes Berg 			    enum ieee80211_band band);
11030f78231bSJohannes Berg int __ieee80211_request_smps(struct ieee80211_sub_if_data *sdata,
11040f78231bSJohannes Berg 			     enum ieee80211_smps_mode smps_mode);
11050f78231bSJohannes Berg void ieee80211_recalc_smps(struct ieee80211_local *local,
11060f78231bSJohannes Berg 			   struct ieee80211_sub_if_data *forsdata);
110746900298SJohannes Berg 
1108f4ea83ddSJohannes Berg #ifdef CONFIG_MAC80211_NOINLINE
1109d9e8a70fSJohannes Berg #define debug_noinline noinline
1110d9e8a70fSJohannes Berg #else
1111d9e8a70fSJohannes Berg #define debug_noinline
1112d9e8a70fSJohannes Berg #endif
1113d9e8a70fSJohannes Berg 
1114f0706e82SJiri Benc #endif /* IEEE80211_I_H */
1115