xref: /openbmc/linux/net/mac80211/ieee80211_i.h (revision b2abb6e2)
1f0706e82SJiri Benc /*
2f0706e82SJiri Benc  * Copyright 2002-2005, Instant802 Networks, Inc.
3f0706e82SJiri Benc  * Copyright 2005, Devicescape Software, Inc.
4f0706e82SJiri Benc  * Copyright 2006-2007	Jiri Benc <jbenc@suse.cz>
5026331c4SJouni Malinen  * Copyright 2007-2010	Johannes Berg <johannes@sipsolutions.net>
6f0706e82SJiri Benc  *
7f0706e82SJiri Benc  * This program is free software; you can redistribute it and/or modify
8f0706e82SJiri Benc  * it under the terms of the GNU General Public License version 2 as
9f0706e82SJiri Benc  * published by the Free Software Foundation.
10f0706e82SJiri Benc  */
11f0706e82SJiri Benc 
12f0706e82SJiri Benc #ifndef IEEE80211_I_H
13f0706e82SJiri Benc #define IEEE80211_I_H
14f0706e82SJiri Benc 
15f0706e82SJiri Benc #include <linux/kernel.h>
16f0706e82SJiri Benc #include <linux/device.h>
17f0706e82SJiri Benc #include <linux/if_ether.h>
18f0706e82SJiri Benc #include <linux/interrupt.h>
19f0706e82SJiri Benc #include <linux/list.h>
20f0706e82SJiri Benc #include <linux/netdevice.h>
21f0706e82SJiri Benc #include <linux/skbuff.h>
22f0706e82SJiri Benc #include <linux/workqueue.h>
23f0706e82SJiri Benc #include <linux/types.h>
24f0706e82SJiri Benc #include <linux/spinlock.h>
25571ecf67SJohannes Berg #include <linux/etherdevice.h>
26e1e54068SJohannes Berg #include <linux/leds.h>
27fe7a5d5cSJohannes Berg #include <net/ieee80211_radiotap.h>
2893da9cc1Scolin@cozybit.com #include <net/cfg80211.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 
5420ad19d0SJohannes Berg #define TU_TO_EXP_TIME(x)	(jiffies + usecs_to_jiffies((x) * 1024))
5520ad19d0SJohannes Berg 
56ab13315aSKalle Valo #define IEEE80211_DEFAULT_UAPSD_QUEUES \
57ab13315aSKalle Valo 	(IEEE80211_WMM_IE_STA_QOSINFO_AC_BK |	\
58ab13315aSKalle Valo 	 IEEE80211_WMM_IE_STA_QOSINFO_AC_BE |	\
59ab13315aSKalle Valo 	 IEEE80211_WMM_IE_STA_QOSINFO_AC_VI |	\
60ab13315aSKalle Valo 	 IEEE80211_WMM_IE_STA_QOSINFO_AC_VO)
61ab13315aSKalle Valo 
62ab13315aSKalle Valo #define IEEE80211_DEFAULT_MAX_SP_LEN		\
63ab13315aSKalle Valo 	IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL
64ab13315aSKalle Valo 
65f0706e82SJiri Benc struct ieee80211_fragment_entry {
66f0706e82SJiri Benc 	unsigned long first_frag_time;
67f0706e82SJiri Benc 	unsigned int seq;
68f0706e82SJiri Benc 	unsigned int rx_queue;
69f0706e82SJiri Benc 	unsigned int last_frag;
70f0706e82SJiri Benc 	unsigned int extra_len;
71f0706e82SJiri Benc 	struct sk_buff_head skb_list;
72f0706e82SJiri Benc 	int ccmp; /* Whether fragments were encrypted with CCMP */
73f0706e82SJiri Benc 	u8 last_pn[6]; /* PN of the last fragment if CCMP was used */
74f0706e82SJiri Benc };
75f0706e82SJiri Benc 
76f0706e82SJiri Benc 
77c2b13452SJohannes Berg struct ieee80211_bss {
7800d3f14cSJohannes Berg 	/* don't want to look up all the time */
79056cdd59SJohannes Berg 	size_t ssid_len;
80f0706e82SJiri Benc 	u8 ssid[IEEE80211_MAX_SSID_LEN];
8100d3f14cSJohannes Berg 
8298f7dfd8SEmmanuel Grumbach 	u8 dtim_period;
8300d3f14cSJohannes Berg 
8443ac2ca3SJouni Malinen 	bool wmm_used;
85ab13315aSKalle Valo 	bool uapsd_supported;
8600d3f14cSJohannes Berg 
8700d3f14cSJohannes Berg 	unsigned long last_probe_resp;
8800d3f14cSJohannes Berg 
89ee385855SLuis Carlos Cobo #ifdef CONFIG_MAC80211_MESH
90ee385855SLuis Carlos Cobo 	u8 *mesh_id;
91ee385855SLuis Carlos Cobo 	size_t mesh_id_len;
9224736701SJohn W. Linville 	u8 *mesh_cfg;
93902acc78SJohannes Berg #endif
9400d3f14cSJohannes Berg 
95f0706e82SJiri Benc #define IEEE80211_MAX_SUPP_RATES 32
96f0706e82SJiri Benc 	u8 supp_rates[IEEE80211_MAX_SUPP_RATES];
97f0706e82SJiri Benc 	size_t supp_rates_len;
98f0706e82SJiri Benc 
9900d3f14cSJohannes Berg 	/*
10025985edcSLucas De Marchi 	 * During association, we save an ERP value from a probe response so
1015628221cSDaniel Drake 	 * that we can feed ERP info to the driver when handling the
1025628221cSDaniel Drake 	 * association completes. these fields probably won't be up-to-date
10300d3f14cSJohannes Berg 	 * otherwise, you probably don't want to use them.
10400d3f14cSJohannes Berg 	 */
10500d3f14cSJohannes Berg 	bool has_erp_value;
1065628221cSDaniel Drake 	u8 erp_value;
107f0706e82SJiri Benc };
108f0706e82SJiri Benc 
109c2b13452SJohannes Berg static inline u8 *bss_mesh_cfg(struct ieee80211_bss *bss)
110902acc78SJohannes Berg {
111902acc78SJohannes Berg #ifdef CONFIG_MAC80211_MESH
112902acc78SJohannes Berg 	return bss->mesh_cfg;
113902acc78SJohannes Berg #endif
114902acc78SJohannes Berg 	return NULL;
115902acc78SJohannes Berg }
116902acc78SJohannes Berg 
117c2b13452SJohannes Berg static inline u8 *bss_mesh_id(struct ieee80211_bss *bss)
118902acc78SJohannes Berg {
119902acc78SJohannes Berg #ifdef CONFIG_MAC80211_MESH
120902acc78SJohannes Berg 	return bss->mesh_id;
121902acc78SJohannes Berg #endif
122902acc78SJohannes Berg 	return NULL;
123902acc78SJohannes Berg }
124902acc78SJohannes Berg 
125c2b13452SJohannes Berg static inline u8 bss_mesh_id_len(struct ieee80211_bss *bss)
126902acc78SJohannes Berg {
127902acc78SJohannes Berg #ifdef CONFIG_MAC80211_MESH
128902acc78SJohannes Berg 	return bss->mesh_id_len;
129902acc78SJohannes Berg #endif
130902acc78SJohannes Berg 	return 0;
131902acc78SJohannes Berg }
132902acc78SJohannes Berg 
133f0706e82SJiri Benc 
1349ae54c84SJohannes Berg typedef unsigned __bitwise__ ieee80211_tx_result;
1359ae54c84SJohannes Berg #define TX_CONTINUE	((__force ieee80211_tx_result) 0u)
1369ae54c84SJohannes Berg #define TX_DROP		((__force ieee80211_tx_result) 1u)
1379ae54c84SJohannes Berg #define TX_QUEUED	((__force ieee80211_tx_result) 2u)
1389ae54c84SJohannes Berg 
1395cf121c3SJohannes Berg #define IEEE80211_TX_FRAGMENTED		BIT(0)
1405cf121c3SJohannes Berg #define IEEE80211_TX_UNICAST		BIT(1)
1415cf121c3SJohannes Berg #define IEEE80211_TX_PS_BUFFERED	BIT(2)
1429ae54c84SJohannes Berg 
1435cf121c3SJohannes Berg struct ieee80211_tx_data {
144f0706e82SJiri Benc 	struct sk_buff *skb;
145f0706e82SJiri Benc 	struct ieee80211_local *local;
146f0706e82SJiri Benc 	struct ieee80211_sub_if_data *sdata;
147f0706e82SJiri Benc 	struct sta_info *sta;
148f0706e82SJiri Benc 	struct ieee80211_key *key;
1495cf121c3SJohannes Berg 
1508318d78aSJohannes Berg 	struct ieee80211_channel *channel;
151f0706e82SJiri Benc 
152a4b7d7bdSHarvey Harrison 	u16 ethertype;
153056cdd59SJohannes Berg 	unsigned int flags;
1545cf121c3SJohannes Berg };
1555cf121c3SJohannes Berg 
1565cf121c3SJohannes Berg 
1575cf121c3SJohannes Berg typedef unsigned __bitwise__ ieee80211_rx_result;
1585cf121c3SJohannes Berg #define RX_CONTINUE		((__force ieee80211_rx_result) 0u)
1595cf121c3SJohannes Berg #define RX_DROP_UNUSABLE	((__force ieee80211_rx_result) 1u)
1605cf121c3SJohannes Berg #define RX_DROP_MONITOR		((__force ieee80211_rx_result) 2u)
1615cf121c3SJohannes Berg #define RX_QUEUED		((__force ieee80211_rx_result) 3u)
1625cf121c3SJohannes Berg 
163554891e6SJohannes Berg /**
164554891e6SJohannes Berg  * enum ieee80211_packet_rx_flags - packet RX flags
165554891e6SJohannes Berg  * @IEEE80211_RX_RA_MATCH: frame is destined to interface currently processed
166554891e6SJohannes Berg  *	(incl. multicast frames)
167554891e6SJohannes Berg  * @IEEE80211_RX_IN_SCAN: received while scanning
168554891e6SJohannes Berg  * @IEEE80211_RX_FRAGMENTED: fragmented frame
169554891e6SJohannes Berg  * @IEEE80211_RX_AMSDU: a-MSDU packet
170554891e6SJohannes Berg  * @IEEE80211_RX_MALFORMED_ACTION_FRM: action frame is malformed
1714cfda47bSChristian Lamparter  * @IEEE80211_RX_DEFERRED_RELEASE: frame was subjected to receive reordering
172554891e6SJohannes Berg  *
173554891e6SJohannes Berg  * These are per-frame flags that are attached to a frame in the
174554891e6SJohannes Berg  * @rx_flags field of &struct ieee80211_rx_status.
175554891e6SJohannes Berg  */
176554891e6SJohannes Berg enum ieee80211_packet_rx_flags {
177554891e6SJohannes Berg 	IEEE80211_RX_IN_SCAN			= BIT(0),
178554891e6SJohannes Berg 	IEEE80211_RX_RA_MATCH			= BIT(1),
179554891e6SJohannes Berg 	IEEE80211_RX_FRAGMENTED			= BIT(2),
180554891e6SJohannes Berg 	IEEE80211_RX_AMSDU			= BIT(3),
181554891e6SJohannes Berg 	IEEE80211_RX_MALFORMED_ACTION_FRM	= BIT(4),
1824cfda47bSChristian Lamparter 	IEEE80211_RX_DEFERRED_RELEASE		= BIT(5),
183554891e6SJohannes Berg };
184554891e6SJohannes Berg 
185554891e6SJohannes Berg /**
186554891e6SJohannes Berg  * enum ieee80211_rx_flags - RX data flags
187554891e6SJohannes Berg  *
188554891e6SJohannes Berg  * @IEEE80211_RX_CMNTR: received on cooked monitor already
189554891e6SJohannes Berg  *
190554891e6SJohannes Berg  * These flags are used across handling multiple interfaces
191554891e6SJohannes Berg  * for a single frame.
192554891e6SJohannes Berg  */
193554891e6SJohannes Berg enum ieee80211_rx_flags {
194554891e6SJohannes Berg 	IEEE80211_RX_CMNTR		= BIT(0),
195554891e6SJohannes Berg };
1965cf121c3SJohannes Berg 
1975cf121c3SJohannes Berg struct ieee80211_rx_data {
1985cf121c3SJohannes Berg 	struct sk_buff *skb;
1995cf121c3SJohannes Berg 	struct ieee80211_local *local;
2005cf121c3SJohannes Berg 	struct ieee80211_sub_if_data *sdata;
2015cf121c3SJohannes Berg 	struct sta_info *sta;
2025cf121c3SJohannes Berg 	struct ieee80211_key *key;
203056cdd59SJohannes Berg 
204056cdd59SJohannes Berg 	unsigned int flags;
2059e26297aSJohannes Berg 
2069e26297aSJohannes Berg 	/*
2079e26297aSJohannes Berg 	 * Index into sequence numbers array, 0..16
2089e26297aSJohannes Berg 	 * since the last (16) is used for non-QoS,
2099e26297aSJohannes Berg 	 * will be 16 on non-QoS frames.
2109e26297aSJohannes Berg 	 */
2119e26297aSJohannes Berg 	int seqno_idx;
2129e26297aSJohannes Berg 
2139e26297aSJohannes Berg 	/*
2149e26297aSJohannes Berg 	 * Index into the security IV/PN arrays, 0..16
2159e26297aSJohannes Berg 	 * since the last (16) is used for CCMP-encrypted
2169e26297aSJohannes Berg 	 * management frames, will be set to 16 on mgmt
2179e26297aSJohannes Berg 	 * frames and 0 on non-QoS frames.
2189e26297aSJohannes Berg 	 */
2199e26297aSJohannes Berg 	int security_idx;
2209e26297aSJohannes Berg 
22150741ae0SJohannes Berg 	u32 tkip_iv32;
22250741ae0SJohannes Berg 	u16 tkip_iv16;
223f0706e82SJiri Benc };
224f0706e82SJiri Benc 
2255dfdaf58SJohannes Berg struct beacon_data {
2265dfdaf58SJohannes Berg 	u8 *head, *tail;
2275dfdaf58SJohannes Berg 	int head_len, tail_len;
2285dfdaf58SJohannes Berg 	int dtim_period;
2295dfdaf58SJohannes Berg };
2305dfdaf58SJohannes Berg 
231f0706e82SJiri Benc struct ieee80211_if_ap {
23240b275b6SJohannes Berg 	struct beacon_data __rcu *beacon;
233f0706e82SJiri Benc 
2340ec3ca44SJohannes Berg 	struct list_head vlans;
2350ec3ca44SJohannes Berg 
236f0706e82SJiri Benc 	/* yes, this looks ugly, but guarantees that we can later use
237f0706e82SJiri Benc 	 * bitmap_empty :)
238004c872eSJohannes Berg 	 * NB: don't touch this bitmap, use sta_info_{set,clear}_tim_bit */
239f0706e82SJiri Benc 	u8 tim[sizeof(unsigned long) * BITS_TO_LONGS(IEEE80211_MAX_AID + 1)];
240f0706e82SJiri Benc 	struct sk_buff_head ps_bc_buf;
241056cdd59SJohannes Berg 	atomic_t num_sta_ps; /* number of stations in PS mode */
2425dfdaf58SJohannes Berg 	int dtim_count;
243512119b3SChristian Lamparter 	bool dtim_bc_mc;
244f0706e82SJiri Benc };
245f0706e82SJiri Benc 
246f0706e82SJiri Benc struct ieee80211_if_wds {
247f0706e82SJiri Benc 	struct sta_info *sta;
248056cdd59SJohannes Berg 	u8 remote_addr[ETH_ALEN];
249f0706e82SJiri Benc };
250f0706e82SJiri Benc 
251f0706e82SJiri Benc struct ieee80211_if_vlan {
2520ec3ca44SJohannes Berg 	struct list_head list;
253f14543eeSFelix Fietkau 
254f14543eeSFelix Fietkau 	/* used for all tx if the VLAN is configured to 4-addr mode */
25540b275b6SJohannes Berg 	struct sta_info __rcu *sta;
256f0706e82SJiri Benc };
257f0706e82SJiri Benc 
258ee385855SLuis Carlos Cobo struct mesh_stats {
259c8a61a7dSDaniel Walker 	__u32 fwded_mcast;		/* Mesh forwarded multicast frames */
260c8a61a7dSDaniel Walker 	__u32 fwded_unicast;		/* Mesh forwarded unicast frames */
261c8a61a7dSDaniel Walker 	__u32 fwded_frames;		/* Mesh total forwarded frames */
262ee385855SLuis Carlos Cobo 	__u32 dropped_frames_ttl;	/* Not transmitted since mesh_ttl == 0*/
263ee385855SLuis Carlos Cobo 	__u32 dropped_frames_no_route;	/* Not transmitted, no route found */
264ee385855SLuis Carlos Cobo 	atomic_t estab_plinks;
265ee385855SLuis Carlos Cobo };
266ee385855SLuis Carlos Cobo 
267ee385855SLuis Carlos Cobo #define PREQ_Q_F_START		0x1
268ee385855SLuis Carlos Cobo #define PREQ_Q_F_REFRESH	0x2
269ee385855SLuis Carlos Cobo struct mesh_preq_queue {
270ee385855SLuis Carlos Cobo 	struct list_head list;
271ee385855SLuis Carlos Cobo 	u8 dst[ETH_ALEN];
272ee385855SLuis Carlos Cobo 	u8 flags;
273ee385855SLuis Carlos Cobo };
274ee385855SLuis Carlos Cobo 
275f679f65dSJohannes Berg enum ieee80211_work_type {
276b8bc4b0aSJohannes Berg 	IEEE80211_WORK_ABORT,
277af6b6374SJohannes Berg 	IEEE80211_WORK_DIRECT_PROBE,
278f679f65dSJohannes Berg 	IEEE80211_WORK_AUTH,
279e5b900d2SJohannes Berg 	IEEE80211_WORK_ASSOC_BEACON_WAIT,
280f679f65dSJohannes Berg 	IEEE80211_WORK_ASSOC,
281b8bc4b0aSJohannes Berg 	IEEE80211_WORK_REMAIN_ON_CHANNEL,
282f30221e4SJohannes Berg 	IEEE80211_WORK_OFFCHANNEL_TX,
28377fdaa12SJohannes Berg };
28477fdaa12SJohannes Berg 
285af6b6374SJohannes Berg /**
286af6b6374SJohannes Berg  * enum work_done_result - indicates what to do after work was done
287af6b6374SJohannes Berg  *
288af6b6374SJohannes Berg  * @WORK_DONE_DESTROY: This work item is no longer needed, destroy.
289af6b6374SJohannes Berg  * @WORK_DONE_REQUEUE: This work item was reset to be reused, and
290af6b6374SJohannes Berg  *	should be requeued.
291af6b6374SJohannes Berg  */
292af6b6374SJohannes Berg enum work_done_result {
293af6b6374SJohannes Berg 	WORK_DONE_DESTROY,
294af6b6374SJohannes Berg 	WORK_DONE_REQUEUE,
295af6b6374SJohannes Berg };
296af6b6374SJohannes Berg 
297f679f65dSJohannes Berg struct ieee80211_work {
29877fdaa12SJohannes Berg 	struct list_head list;
299f679f65dSJohannes Berg 
300af6b6374SJohannes Berg 	struct rcu_head rcu_head;
301af6b6374SJohannes Berg 
302af6b6374SJohannes Berg 	struct ieee80211_sub_if_data *sdata;
303af6b6374SJohannes Berg 
304af6b6374SJohannes Berg 	enum work_done_result (*done)(struct ieee80211_work *wk,
305af6b6374SJohannes Berg 				      struct sk_buff *skb);
306af6b6374SJohannes Berg 
307f679f65dSJohannes Berg 	struct ieee80211_channel *chan;
308e4da8c37SJohannes Berg 	enum nl80211_channel_type chan_type;
309af6b6374SJohannes Berg 
310f679f65dSJohannes Berg 	unsigned long timeout;
311f679f65dSJohannes Berg 	enum ieee80211_work_type type;
312f679f65dSJohannes Berg 
313af6b6374SJohannes Berg 	u8 filter_ta[ETH_ALEN];
314af6b6374SJohannes Berg 
315e4da8c37SJohannes Berg 	bool started;
316e4da8c37SJohannes Berg 
317f679f65dSJohannes Berg 	union {
318f679f65dSJohannes Berg 		struct {
319f679f65dSJohannes Berg 			int tries;
320f679f65dSJohannes Berg 			u16 algorithm, transaction;
32177fdaa12SJohannes Berg 			u8 ssid[IEEE80211_MAX_SSID_LEN];
32277fdaa12SJohannes Berg 			u8 ssid_len;
323fffd0934SJohannes Berg 			u8 key[WLAN_KEY_LEN_WEP104];
324fffd0934SJohannes Berg 			u8 key_len, key_idx;
325f679f65dSJohannes Berg 			bool privacy;
326b2abb6e2SJohannes Berg 			bool synced;
327af6b6374SJohannes Berg 		} probe_auth;
328f679f65dSJohannes Berg 		struct {
3290c1ad2caSJohannes Berg 			struct cfg80211_bss *bss;
330f679f65dSJohannes Berg 			const u8 *supp_rates;
331f679f65dSJohannes Berg 			const u8 *ht_information_ie;
332af6b6374SJohannes Berg 			enum ieee80211_smps_mode smps;
333f679f65dSJohannes Berg 			int tries;
334f679f65dSJohannes Berg 			u16 capability;
335af6b6374SJohannes Berg 			u8 prev_bssid[ETH_ALEN];
336f679f65dSJohannes Berg 			u8 ssid[IEEE80211_MAX_SSID_LEN];
337f679f65dSJohannes Berg 			u8 ssid_len;
338f679f65dSJohannes Berg 			u8 supp_rates_len;
339ab13315aSKalle Valo 			bool wmm_used, use_11n, uapsd_used;
340b2abb6e2SJohannes Berg 			bool synced;
341f679f65dSJohannes Berg 		} assoc;
342b8bc4b0aSJohannes Berg 		struct {
343e4da8c37SJohannes Berg 			u32 duration;
344b8bc4b0aSJohannes Berg 		} remain;
345f30221e4SJohannes Berg 		struct {
346f30221e4SJohannes Berg 			struct sk_buff *frame;
347f30221e4SJohannes Berg 			u32 wait;
348f30221e4SJohannes Berg 		} offchan_tx;
349f679f65dSJohannes Berg 	};
350fffd0934SJohannes Berg 
351f679f65dSJohannes Berg 	int ie_len;
35277fdaa12SJohannes Berg 	/* must be last */
353f679f65dSJohannes Berg 	u8 ie[0];
35477fdaa12SJohannes Berg };
35577fdaa12SJohannes Berg 
35646900298SJohannes Berg /* flags used in struct ieee80211_if_managed.flags */
357ab1faeadSJohannes Berg enum ieee80211_sta_flags {
358b291ba11SJohannes Berg 	IEEE80211_STA_BEACON_POLL	= BIT(0),
359b291ba11SJohannes Berg 	IEEE80211_STA_CONNECTION_POLL	= BIT(1),
360b291ba11SJohannes Berg 	IEEE80211_STA_CONTROL_PORT	= BIT(2),
361b291ba11SJohannes Berg 	IEEE80211_STA_DISABLE_11N	= BIT(4),
362b291ba11SJohannes Berg 	IEEE80211_STA_CSA_RECEIVED	= BIT(5),
363b291ba11SJohannes Berg 	IEEE80211_STA_MFP_ENABLED	= BIT(6),
364ab13315aSKalle Valo 	IEEE80211_STA_UAPSD_ENABLED	= BIT(7),
365375177bfSVivek Natarajan 	IEEE80211_STA_NULLFUNC_ACKED	= BIT(8),
36617e4ec14SJouni Malinen 	IEEE80211_STA_RESET_SIGNAL_AVE	= BIT(9),
367ab1faeadSJohannes Berg };
368ab1faeadSJohannes Berg 
36946900298SJohannes Berg struct ieee80211_if_managed {
370056cdd59SJohannes Berg 	struct timer_list timer;
371b291ba11SJohannes Berg 	struct timer_list conn_mon_timer;
372b291ba11SJohannes Berg 	struct timer_list bcn_mon_timer;
373c481ec97SSujith 	struct timer_list chswitch_timer;
374b291ba11SJohannes Berg 	struct work_struct monitor_work;
375c481ec97SSujith 	struct work_struct chswitch_work;
3761e4dcd01SJuuso Oikarinen 	struct work_struct beacon_connection_loss_work;
37746900298SJohannes Berg 
3787ccc8bd7SFelix Fietkau 	unsigned long beacon_timeout;
379b291ba11SJohannes Berg 	unsigned long probe_timeout;
380a43abf29SMaxim Levitsky 	int probe_send_count;
38104ac3c0eSFelix Fietkau 	bool nullfunc_failed;
382b291ba11SJohannes Berg 
38377fdaa12SJohannes Berg 	struct mutex mtx;
3840c1ad2caSJohannes Berg 	struct cfg80211_bss *associated;
38546900298SJohannes Berg 
38677fdaa12SJohannes Berg 	u8 bssid[ETH_ALEN];
38746900298SJohannes Berg 
388f0706e82SJiri Benc 	u16 aid;
389f0706e82SJiri Benc 
3905bb644a0SJohannes Berg 	unsigned long timers_running; /* used for quiesce/restart */
391965bedadSJohannes Berg 	bool powersave; /* powersave requested for this iface */
3920f78231bSJohannes Berg 	enum ieee80211_smps_mode req_smps, /* requested smps mode */
393d1f5b7a3SJohannes Berg 				 ap_smps, /* smps mode AP thinks we're in */
394d1f5b7a3SJohannes Berg 				 driver_smps_mode; /* smps mode request */
395d1f5b7a3SJohannes Berg 
396d1f5b7a3SJohannes Berg 	struct work_struct request_smps_work;
397965bedadSJohannes Berg 
398d6f2da5bSJiri Slaby 	unsigned int flags;
399f0706e82SJiri Benc 
400d8ec4433SJuuso Oikarinen 	bool beacon_crc_valid;
401d91f36dbSJohannes Berg 	u32 beacon_crc;
402d91f36dbSJohannes Berg 
403fdfacf0aSJouni Malinen 	enum {
404fdfacf0aSJouni Malinen 		IEEE80211_MFP_DISABLED,
405fdfacf0aSJouni Malinen 		IEEE80211_MFP_OPTIONAL,
406fdfacf0aSJouni Malinen 		IEEE80211_MFP_REQUIRED
407fdfacf0aSJouni Malinen 	} mfp; /* management frame protection */
408fdfacf0aSJouni Malinen 
409f0706e82SJiri Benc 	int wmm_last_param_set;
4109bc383deSJohannes Berg 
4119bc383deSJohannes Berg 	u8 use_4addr;
41217e4ec14SJouni Malinen 
41317e4ec14SJouni Malinen 	/* Signal strength from the last Beacon frame in the current BSS. */
41417e4ec14SJouni Malinen 	int last_beacon_signal;
41517e4ec14SJouni Malinen 
41617e4ec14SJouni Malinen 	/*
41717e4ec14SJouni Malinen 	 * Weighted average of the signal strength from Beacon frames in the
41817e4ec14SJouni Malinen 	 * current BSS. This is in units of 1/16 of the signal unit to maintain
41917e4ec14SJouni Malinen 	 * accuracy and to speed up calculations, i.e., the value need to be
42017e4ec14SJouni Malinen 	 * divided by 16 to get the actual value.
42117e4ec14SJouni Malinen 	 */
42217e4ec14SJouni Malinen 	int ave_beacon_signal;
42317e4ec14SJouni Malinen 
42417e4ec14SJouni Malinen 	/*
425391a200aSJouni Malinen 	 * Number of Beacon frames used in ave_beacon_signal. This can be used
426391a200aSJouni Malinen 	 * to avoid generating less reliable cqm events that would be based
427391a200aSJouni Malinen 	 * only on couple of received frames.
428391a200aSJouni Malinen 	 */
429391a200aSJouni Malinen 	unsigned int count_beacon_signal;
430391a200aSJouni Malinen 
431391a200aSJouni Malinen 	/*
43217e4ec14SJouni Malinen 	 * Last Beacon frame signal strength average (ave_beacon_signal / 16)
43317e4ec14SJouni Malinen 	 * that triggered a cqm event. 0 indicates that no event has been
43417e4ec14SJouni Malinen 	 * generated for the current association.
43517e4ec14SJouni Malinen 	 */
43617e4ec14SJouni Malinen 	int last_cqm_event_signal;
437615f7b9bSMeenakshi Venkataraman 
438615f7b9bSMeenakshi Venkataraman 	/*
439615f7b9bSMeenakshi Venkataraman 	 * State variables for keeping track of RSSI of the AP currently
440615f7b9bSMeenakshi Venkataraman 	 * connected to and informing driver when RSSI has gone
441615f7b9bSMeenakshi Venkataraman 	 * below/above a certain threshold.
442615f7b9bSMeenakshi Venkataraman 	 */
443615f7b9bSMeenakshi Venkataraman 	int rssi_min_thold, rssi_max_thold;
444615f7b9bSMeenakshi Venkataraman 	int last_ave_beacon_signal;
445f0706e82SJiri Benc };
446f0706e82SJiri Benc 
44746900298SJohannes Berg struct ieee80211_if_ibss {
44846900298SJohannes Berg 	struct timer_list timer;
44946900298SJohannes Berg 
4507a17a33cSJohannes Berg 	struct mutex mtx;
4517a17a33cSJohannes Berg 
452af8cdcd8SJohannes Berg 	unsigned long last_scan_completed;
4535bb644a0SJohannes Berg 
454fbd2c8dcSTeemu Paasikivi 	u32 basic_rates;
455fbd2c8dcSTeemu Paasikivi 
4565bb644a0SJohannes Berg 	bool timer_running;
4575bb644a0SJohannes Berg 
458af8cdcd8SJohannes Berg 	bool fixed_bssid;
459af8cdcd8SJohannes Berg 	bool fixed_channel;
460fffd0934SJohannes Berg 	bool privacy;
46146900298SJohannes Berg 
46246900298SJohannes Berg 	u8 bssid[ETH_ALEN];
463af8cdcd8SJohannes Berg 	u8 ssid[IEEE80211_MAX_SSID_LEN];
464af8cdcd8SJohannes Berg 	u8 ssid_len, ie_len;
465af8cdcd8SJohannes Berg 	u8 *ie;
466af8cdcd8SJohannes Berg 	struct ieee80211_channel *channel;
46746900298SJohannes Berg 
46846900298SJohannes Berg 	unsigned long ibss_join_req;
469af8cdcd8SJohannes Berg 	/* probe response/beacon for IBSS */
47040b275b6SJohannes Berg 	struct sk_buff __rcu *presp;
47140b275b6SJohannes Berg 	struct sk_buff *skb;
47246900298SJohannes Berg 
47346900298SJohannes Berg 	enum {
47446900298SJohannes Berg 		IEEE80211_IBSS_MLME_SEARCH,
47546900298SJohannes Berg 		IEEE80211_IBSS_MLME_JOINED,
47646900298SJohannes Berg 	} state;
47746900298SJohannes Berg };
47846900298SJohannes Berg 
479472dbc45SJohannes Berg struct ieee80211_if_mesh {
480472dbc45SJohannes Berg 	struct timer_list housekeeping_timer;
481472dbc45SJohannes Berg 	struct timer_list mesh_path_timer;
482e304bfd3SRui Paulo 	struct timer_list mesh_path_root_timer;
483472dbc45SJohannes Berg 
4845bb644a0SJohannes Berg 	unsigned long timers_running;
4855bb644a0SJohannes Berg 
48618889231SJavier Cardona 	unsigned long wrkq_flags;
487472dbc45SJohannes Berg 
488472dbc45SJohannes Berg 	u8 mesh_id[IEEE80211_MAX_MESH_ID_LEN];
489472dbc45SJohannes Berg 	size_t mesh_id_len;
490472dbc45SJohannes Berg 	/* Active Path Selection Protocol Identifier */
4913491707aSRui Paulo 	u8 mesh_pp_id;
492472dbc45SJohannes Berg 	/* Active Path Selection Metric Identifier */
4933491707aSRui Paulo 	u8 mesh_pm_id;
494472dbc45SJohannes Berg 	/* Congestion Control Mode Identifier */
4953491707aSRui Paulo 	u8 mesh_cc_id;
4969e03fdfdSJavier Cardona 	/* Synchronization Protocol Identifier */
4973491707aSRui Paulo 	u8 mesh_sp_id;
4989e03fdfdSJavier Cardona 	/* Authentication Protocol Identifier */
4993491707aSRui Paulo 	u8 mesh_auth_id;
500d19b3bf6SRui Paulo 	/* Local mesh Sequence Number */
501d19b3bf6SRui Paulo 	u32 sn;
502472dbc45SJohannes Berg 	/* Last used PREQ ID */
503472dbc45SJohannes Berg 	u32 preq_id;
504472dbc45SJohannes Berg 	atomic_t mpaths;
505d19b3bf6SRui Paulo 	/* Timestamp of last SN update */
506d19b3bf6SRui Paulo 	unsigned long last_sn_update;
507d19b3bf6SRui Paulo 	/* Timestamp of last SN sent */
508472dbc45SJohannes Berg 	unsigned long last_preq;
509472dbc45SJohannes Berg 	struct mesh_rmc *rmc;
510472dbc45SJohannes Berg 	spinlock_t mesh_preq_queue_lock;
511472dbc45SJohannes Berg 	struct mesh_preq_queue preq_queue;
512472dbc45SJohannes Berg 	int preq_queue_len;
513472dbc45SJohannes Berg 	struct mesh_stats mshstats;
514472dbc45SJohannes Berg 	struct mesh_config mshcfg;
515472dbc45SJohannes Berg 	u32 mesh_seqnum;
516472dbc45SJohannes Berg 	bool accepting_plinks;
517581a8b0fSJavier Cardona 	const u8 *ie;
518581a8b0fSJavier Cardona 	u8 ie_len;
519b130e5ceSJavier Cardona 	enum {
520b130e5ceSJavier Cardona 		IEEE80211_MESH_SEC_NONE = 0x0,
521b130e5ceSJavier Cardona 		IEEE80211_MESH_SEC_AUTHED = 0x1,
522b130e5ceSJavier Cardona 		IEEE80211_MESH_SEC_SECURED = 0x2,
523b130e5ceSJavier Cardona 	} security;
524472dbc45SJohannes Berg };
525902acc78SJohannes Berg 
526902acc78SJohannes Berg #ifdef CONFIG_MAC80211_MESH
527472dbc45SJohannes Berg #define IEEE80211_IFSTA_MESH_CTR_INC(msh, name)	\
528472dbc45SJohannes Berg 	do { (msh)->mshstats.name++; } while (0)
529902acc78SJohannes Berg #else
530472dbc45SJohannes Berg #define IEEE80211_IFSTA_MESH_CTR_INC(msh, name) \
531902acc78SJohannes Berg 	do { } while (0)
532902acc78SJohannes Berg #endif
533f0706e82SJiri Benc 
534213cd118SJohannes Berg /**
535213cd118SJohannes Berg  * enum ieee80211_sub_if_data_flags - virtual interface flags
536213cd118SJohannes Berg  *
537213cd118SJohannes Berg  * @IEEE80211_SDATA_ALLMULTI: interface wants all multicast packets
538213cd118SJohannes Berg  * @IEEE80211_SDATA_PROMISC: interface is promisc
539213cd118SJohannes Berg  * @IEEE80211_SDATA_OPERATING_GMODE: operating in G-only mode
540213cd118SJohannes Berg  * @IEEE80211_SDATA_DONT_BRIDGE_PACKETS: bridge packets between
541213cd118SJohannes Berg  *	associated stations and deliver multicast frames both
542213cd118SJohannes Berg  *	back to wireless media and to the local net stack.
54395acac61SJohannes Berg  * @IEEE80211_SDATA_DISCONNECT_RESUME: Disconnect after resume.
544213cd118SJohannes Berg  */
545213cd118SJohannes Berg enum ieee80211_sub_if_data_flags {
546213cd118SJohannes Berg 	IEEE80211_SDATA_ALLMULTI		= BIT(0),
547213cd118SJohannes Berg 	IEEE80211_SDATA_PROMISC			= BIT(1),
5487986cf95SJohannes Berg 	IEEE80211_SDATA_OPERATING_GMODE		= BIT(2),
5497986cf95SJohannes Berg 	IEEE80211_SDATA_DONT_BRIDGE_PACKETS	= BIT(3),
55095acac61SJohannes Berg 	IEEE80211_SDATA_DISCONNECT_RESUME	= BIT(4),
551213cd118SJohannes Berg };
552213cd118SJohannes Berg 
55334d4bc4dSJohannes Berg /**
55434d4bc4dSJohannes Berg  * enum ieee80211_sdata_state_bits - virtual interface state bits
55534d4bc4dSJohannes Berg  * @SDATA_STATE_RUNNING: virtual interface is up & running; this
55634d4bc4dSJohannes Berg  *	mirrors netif_running() but is separate for interface type
55734d4bc4dSJohannes Berg  *	change handling while the interface is up
5585b714c6aSJohannes Berg  * @SDATA_STATE_OFFCHANNEL: This interface is currently in offchannel
5595b714c6aSJohannes Berg  *	mode, so queues are stopped
56034d4bc4dSJohannes Berg  */
56134d4bc4dSJohannes Berg enum ieee80211_sdata_state_bits {
56234d4bc4dSJohannes Berg 	SDATA_STATE_RUNNING,
5635b714c6aSJohannes Berg 	SDATA_STATE_OFFCHANNEL,
56434d4bc4dSJohannes Berg };
56534d4bc4dSJohannes Berg 
566f0706e82SJiri Benc struct ieee80211_sub_if_data {
567f0706e82SJiri Benc 	struct list_head list;
568f0706e82SJiri Benc 
569f0706e82SJiri Benc 	struct wireless_dev wdev;
570f0706e82SJiri Benc 
57111a843b7SJohannes Berg 	/* keys */
57211a843b7SJohannes Berg 	struct list_head key_list;
57311a843b7SJohannes Berg 
5743bff1865SYogesh Ashok Powar 	/* count for keys needing tailroom space allocation */
5753bff1865SYogesh Ashok Powar 	int crypto_tx_tailroom_needed_cnt;
5763bff1865SYogesh Ashok Powar 
577f0706e82SJiri Benc 	struct net_device *dev;
578f0706e82SJiri Benc 	struct ieee80211_local *local;
579f0706e82SJiri Benc 
58013262ffdSJiri Slaby 	unsigned int flags;
5817e9ed188SDaniel Drake 
58234d4bc4dSJohannes Berg 	unsigned long state;
58334d4bc4dSJohannes Berg 
584f0706e82SJiri Benc 	int drop_unencrypted;
585f0706e82SJiri Benc 
58647846c9bSJohannes Berg 	char name[IFNAMSIZ];
58747846c9bSJohannes Berg 
588413ad50aSJohannes Berg 	/*
589413ad50aSJohannes Berg 	 * keep track of whether the HT opmode (stored in
590413ad50aSJohannes Berg 	 * vif.bss_info.ht_operation_mode) is valid.
591413ad50aSJohannes Berg 	 */
592413ad50aSJohannes Berg 	bool ht_opmode_valid;
593413ad50aSJohannes Berg 
5947da7cc1dSJohannes Berg 	/* to detect idle changes */
5957da7cc1dSJohannes Berg 	bool old_idle;
5967da7cc1dSJohannes Berg 
597f0706e82SJiri Benc 	/* Fragment table for host-based reassembly */
598f0706e82SJiri Benc 	struct ieee80211_fragment_entry	fragments[IEEE80211_FRAGMENT_MAX];
599f0706e82SJiri Benc 	unsigned int fragment_next;
600f0706e82SJiri Benc 
60140b275b6SJohannes Berg 	struct ieee80211_key __rcu *keys[NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS];
60240b275b6SJohannes Berg 	struct ieee80211_key __rcu *default_unicast_key;
60340b275b6SJohannes Berg 	struct ieee80211_key __rcu *default_multicast_key;
60440b275b6SJohannes Berg 	struct ieee80211_key __rcu *default_mgmt_key;
605f0706e82SJiri Benc 
60694778280SJohannes Berg 	u16 sequence_number;
607a621fa4dSJohannes Berg 	__be16 control_port_protocol;
608a621fa4dSJohannes Berg 	bool control_port_no_encrypt;
60994778280SJohannes Berg 
61064592c8fSJohannes Berg 	struct work_struct work;
61135f20c14SJohannes Berg 	struct sk_buff_head skb_queue;
61235f20c14SJohannes Berg 
61368542962SJuuso Oikarinen 	bool arp_filter_state;
61468542962SJuuso Oikarinen 
6153e122be0SJohannes Berg 	/*
6163e122be0SJohannes Berg 	 * AP this belongs to: self in AP mode and
6173e122be0SJohannes Berg 	 * corresponding AP in VLAN mode, NULL for
6183e122be0SJohannes Berg 	 * all others (might be needed later in IBSS)
6193e122be0SJohannes Berg 	 */
6203e122be0SJohannes Berg 	struct ieee80211_if_ap *bss;
6213e122be0SJohannes Berg 
62237eb0b16SJouni Malinen 	/* bitmap of allowed (non-MCS) rate indexes for rate control */
62337eb0b16SJouni Malinen 	u32 rc_rateidx_mask[IEEE80211_NUM_BANDS];
624f0706e82SJiri Benc 
625f0706e82SJiri Benc 	union {
626f0706e82SJiri Benc 		struct ieee80211_if_ap ap;
627f0706e82SJiri Benc 		struct ieee80211_if_wds wds;
628f0706e82SJiri Benc 		struct ieee80211_if_vlan vlan;
62946900298SJohannes Berg 		struct ieee80211_if_managed mgd;
63046900298SJohannes Berg 		struct ieee80211_if_ibss ibss;
631472dbc45SJohannes Berg 		struct ieee80211_if_mesh mesh;
6328cc9a739SMichael Wu 		u32 mntr_flags;
633f0706e82SJiri Benc 	} u;
634e9f207f0SJiri Benc 
635e9f207f0SJiri Benc #ifdef CONFIG_MAC80211_DEBUGFS
636e9f207f0SJiri Benc 	struct {
6377bcfaf2fSJohannes Berg 		struct dentry *dir;
638295bafb4SBen Greear 		struct dentry *subdir_stations;
639f7e0104cSJohannes Berg 		struct dentry *default_unicast_key;
640f7e0104cSJohannes Berg 		struct dentry *default_multicast_key;
6413cfcf6acSJouni Malinen 		struct dentry *default_mgmt_key;
6427bcfaf2fSJohannes Berg 	} debugfs;
643e9f207f0SJiri Benc #endif
64432bfd35dSJohannes Berg 	/* must be last, dynamically sized area in this! */
64532bfd35dSJohannes Berg 	struct ieee80211_vif vif;
646f0706e82SJiri Benc };
647f0706e82SJiri Benc 
64832bfd35dSJohannes Berg static inline
64932bfd35dSJohannes Berg struct ieee80211_sub_if_data *vif_to_sdata(struct ieee80211_vif *p)
65032bfd35dSJohannes Berg {
65132bfd35dSJohannes Berg 	return container_of(p, struct ieee80211_sub_if_data, vif);
65232bfd35dSJohannes Berg }
65332bfd35dSJohannes Berg 
654c1475ca9SJohannes Berg enum sdata_queue_type {
655c1475ca9SJohannes Berg 	IEEE80211_SDATA_QUEUE_TYPE_FRAME	= 0,
656c1475ca9SJohannes Berg 	IEEE80211_SDATA_QUEUE_AGG_START		= 1,
657c1475ca9SJohannes Berg 	IEEE80211_SDATA_QUEUE_AGG_STOP		= 2,
658c1475ca9SJohannes Berg };
659c1475ca9SJohannes Berg 
660f0706e82SJiri Benc enum {
661f0706e82SJiri Benc 	IEEE80211_RX_MSG	= 1,
662f0706e82SJiri Benc 	IEEE80211_TX_STATUS_MSG	= 2,
663f0706e82SJiri Benc };
664f0706e82SJiri Benc 
665ce7c9111SKalle Valo enum queue_stop_reason {
666ce7c9111SKalle Valo 	IEEE80211_QUEUE_STOP_REASON_DRIVER,
667520eb820SKalle Valo 	IEEE80211_QUEUE_STOP_REASON_PS,
66896f5e66eSJohannes Berg 	IEEE80211_QUEUE_STOP_REASON_CSA,
66996f5e66eSJohannes Berg 	IEEE80211_QUEUE_STOP_REASON_AGGREGATION,
67025420604SJohannes Berg 	IEEE80211_QUEUE_STOP_REASON_SUSPEND,
6718f77f384SJohannes Berg 	IEEE80211_QUEUE_STOP_REASON_SKB_ADD,
672ce7c9111SKalle Valo };
673ce7c9111SKalle Valo 
67465a6538aSLuciano Coelho #ifdef CONFIG_MAC80211_LEDS
675e1e54068SJohannes Berg struct tpt_led_trigger {
676e1e54068SJohannes Berg 	struct led_trigger trig;
677e1e54068SJohannes Berg 	char name[32];
678e1e54068SJohannes Berg 	const struct ieee80211_tpt_blink *blink_table;
679e1e54068SJohannes Berg 	unsigned int blink_table_len;
680e1e54068SJohannes Berg 	struct timer_list timer;
681e1e54068SJohannes Berg 	unsigned long prev_traffic;
682e1e54068SJohannes Berg 	unsigned long tx_bytes, rx_bytes;
68367408c8cSJohannes Berg 	unsigned int active, want;
68467408c8cSJohannes Berg 	bool running;
685e1e54068SJohannes Berg };
68665a6538aSLuciano Coelho #endif
687e1e54068SJohannes Berg 
688142b9f50SHelmut Schaa /**
689142b9f50SHelmut Schaa  * mac80211 scan flags - currently active scan mode
690142b9f50SHelmut Schaa  *
691142b9f50SHelmut Schaa  * @SCAN_SW_SCANNING: We're currently in the process of scanning but may as
692142b9f50SHelmut Schaa  *	well be on the operating channel
693142b9f50SHelmut Schaa  * @SCAN_HW_SCANNING: The hardware is scanning for us, we have no way to
694142b9f50SHelmut Schaa  *	determine if we are on the operating channel or not
6958789d459SJohannes Berg  * @SCAN_COMPLETED: Set for our scan work function when the driver reported
6968789d459SJohannes Berg  *	that the scan completed.
6978789d459SJohannes Berg  * @SCAN_ABORTED: Set for our scan work function when the driver reported
6988789d459SJohannes Berg  *	a scan complete for an aborted scan.
699142b9f50SHelmut Schaa  */
700fbe9c429SHelmut Schaa enum {
701fbe9c429SHelmut Schaa 	SCAN_SW_SCANNING,
702142b9f50SHelmut Schaa 	SCAN_HW_SCANNING,
7038789d459SJohannes Berg 	SCAN_COMPLETED,
7048789d459SJohannes Berg 	SCAN_ABORTED,
705142b9f50SHelmut Schaa };
706142b9f50SHelmut Schaa 
707142b9f50SHelmut Schaa /**
708142b9f50SHelmut Schaa  * enum mac80211_scan_state - scan state machine states
709142b9f50SHelmut Schaa  *
710142b9f50SHelmut Schaa  * @SCAN_DECISION: Main entry point to the scan state machine, this state
711142b9f50SHelmut Schaa  *	determines if we should keep on scanning or switch back to the
712142b9f50SHelmut Schaa  *	operating channel
713142b9f50SHelmut Schaa  * @SCAN_SET_CHANNEL: Set the next channel to be scanned
714142b9f50SHelmut Schaa  * @SCAN_SEND_PROBE: Send probe requests and wait for probe responses
715142b9f50SHelmut Schaa  * @SCAN_LEAVE_OPER_CHANNEL: Leave the operating channel, notify the AP
716142b9f50SHelmut Schaa  *	about us leaving the channel and stop all associated STA interfaces
717142b9f50SHelmut Schaa  * @SCAN_ENTER_OPER_CHANNEL: Enter the operating channel again, notify the
718142b9f50SHelmut Schaa  *	AP about us being back and restart all associated STA interfaces
719142b9f50SHelmut Schaa  */
720142b9f50SHelmut Schaa enum mac80211_scan_state {
721142b9f50SHelmut Schaa 	SCAN_DECISION,
722142b9f50SHelmut Schaa 	SCAN_SET_CHANNEL,
723142b9f50SHelmut Schaa 	SCAN_SEND_PROBE,
724142b9f50SHelmut Schaa 	SCAN_LEAVE_OPER_CHANNEL,
725142b9f50SHelmut Schaa 	SCAN_ENTER_OPER_CHANNEL,
726fbe9c429SHelmut Schaa };
727fbe9c429SHelmut Schaa 
728f0706e82SJiri Benc struct ieee80211_local {
729f0706e82SJiri Benc 	/* embed the driver visible part.
730f0706e82SJiri Benc 	 * don't cast (use the static inlines below), but we keep
731f0706e82SJiri Benc 	 * it first anyway so they become a no-op */
732f0706e82SJiri Benc 	struct ieee80211_hw hw;
733f0706e82SJiri Benc 
734f0706e82SJiri Benc 	const struct ieee80211_ops *ops;
735f0706e82SJiri Benc 
73642935ecaSLuis R. Rodriguez 	/*
737af6b6374SJohannes Berg 	 * work stuff, potentially off-channel (in the future)
738af6b6374SJohannes Berg 	 */
739af6b6374SJohannes Berg 	struct list_head work_list;
740af6b6374SJohannes Berg 	struct timer_list work_timer;
741af6b6374SJohannes Berg 	struct work_struct work_work;
742af6b6374SJohannes Berg 	struct sk_buff_head work_skb_queue;
743af6b6374SJohannes Berg 
744af6b6374SJohannes Berg 	/*
74542935ecaSLuis R. Rodriguez 	 * private workqueue to mac80211. mac80211 makes this accessible
74642935ecaSLuis R. Rodriguez 	 * via ieee80211_queue_work()
74742935ecaSLuis R. Rodriguez 	 */
74842935ecaSLuis R. Rodriguez 	struct workqueue_struct *workqueue;
74942935ecaSLuis R. Rodriguez 
750e4e72fb4SJohannes Berg 	unsigned long queue_stop_reasons[IEEE80211_MAX_QUEUES];
7512683d65bSEliad Peller 	struct ieee80211_tx_queue_params tx_conf[IEEE80211_MAX_QUEUES];
75296f5e66eSJohannes Berg 	/* also used to protect ampdu_ac_queue and amdpu_ac_stop_refcnt */
753ce7c9111SKalle Valo 	spinlock_t queue_stop_reason_lock;
75496f5e66eSJohannes Berg 
755f0706e82SJiri Benc 	int open_count;
7563d30d949SMichael Wu 	int monitors, cooked_mntrs;
7578cc9a739SMichael Wu 	/* number of interfaces with corresponding FIF_ flags */
7587be5086dSJohannes Berg 	int fif_fcsfail, fif_plcpfail, fif_control, fif_other_bss, fif_pspoll,
7597be5086dSJohannes Berg 	    fif_probe_req;
7607be5086dSJohannes Berg 	int probe_req_reg;
7614150c572SJohannes Berg 	unsigned int filter_flags; /* FIF_* */
7623b8d81e0SJohannes Berg 
7633ffc2a90SJohannes Berg 	bool wiphy_ciphers_allocated;
7643ffc2a90SJohannes Berg 
7653b8d81e0SJohannes Berg 	/* protects the aggregated multicast list and filter calls */
7663b8d81e0SJohannes Berg 	spinlock_t filter_lock;
7673b8d81e0SJohannes Berg 
7683ac64beeSJohannes Berg 	/* used for uploading changed mc list */
7693ac64beeSJohannes Berg 	struct work_struct reconfig_filter;
7703ac64beeSJohannes Berg 
7710f78231bSJohannes Berg 	/* used to reconfigure hardware SM PS */
7720f78231bSJohannes Berg 	struct work_struct recalc_smps;
7730f78231bSJohannes Berg 
7743b8d81e0SJohannes Berg 	/* aggregated multicast list */
77522bedad3SJiri Pirko 	struct netdev_hw_addr_list mc_list;
7763b8d81e0SJohannes Berg 
777d0709a65SJohannes Berg 	bool tim_in_locked_section; /* see ieee80211_beacon_get() */
7785bb644a0SJohannes Berg 
7795bb644a0SJohannes Berg 	/*
7805bb644a0SJohannes Berg 	 * suspended is true if we finished all the suspend _and_ we have
7815bb644a0SJohannes Berg 	 * not yet come up from resume. This is to be used by mac80211
7825bb644a0SJohannes Berg 	 * to ensure driver sanity during suspend and mac80211's own
7835bb644a0SJohannes Berg 	 * sanity. It can eventually be used for WoW as well.
7845bb644a0SJohannes Berg 	 */
7855bb644a0SJohannes Berg 	bool suspended;
7865bb644a0SJohannes Berg 
7875bb644a0SJohannes Berg 	/*
788ceb99fe0SJohannes Berg 	 * Resuming is true while suspended, but when we're reprogramming the
789ceb99fe0SJohannes Berg 	 * hardware -- at that time it's allowed to use ieee80211_queue_work()
790ceb99fe0SJohannes Berg 	 * again even though some other parts of the stack are still suspended
791ceb99fe0SJohannes Berg 	 * and we still drop received frames to avoid waking the stack.
792ceb99fe0SJohannes Berg 	 */
793ceb99fe0SJohannes Berg 	bool resuming;
794ceb99fe0SJohannes Berg 
795ceb99fe0SJohannes Berg 	/*
7965bb644a0SJohannes Berg 	 * quiescing is true during the suspend process _only_ to
7975bb644a0SJohannes Berg 	 * ease timer cancelling etc.
7985bb644a0SJohannes Berg 	 */
7995bb644a0SJohannes Berg 	bool quiescing;
8005bb644a0SJohannes Berg 
801ea77f12fSJohannes Berg 	/* device is started */
802ea77f12fSJohannes Berg 	bool started;
803ea77f12fSJohannes Berg 
804eecc4800SJohannes Berg 	/* wowlan is enabled -- don't reconfig on resume */
805eecc4800SJohannes Berg 	bool wowlan;
806eecc4800SJohannes Berg 
807b306f453SJohannes Berg 	int tx_headroom; /* required headroom for hardware/radiotap */
808f0706e82SJiri Benc 
809f0706e82SJiri Benc 	/* Tasklet and skb queue to process calls from IRQ mode. All frames
810f0706e82SJiri Benc 	 * added to skb_queue will be processed, but frames in
811f0706e82SJiri Benc 	 * skb_queue_unreliable may be dropped if the total length of these
812f0706e82SJiri Benc 	 * queues increases over the limit. */
813f0706e82SJiri Benc #define IEEE80211_IRQSAFE_QUEUE_LIMIT 128
814f0706e82SJiri Benc 	struct tasklet_struct tasklet;
815f0706e82SJiri Benc 	struct sk_buff_head skb_queue;
816f0706e82SJiri Benc 	struct sk_buff_head skb_queue_unreliable;
817f0706e82SJiri Benc 
81824a8fdadSChristian Lamparter 	/*
81924a8fdadSChristian Lamparter 	 * Internal FIFO queue which is shared between multiple rx path
82024a8fdadSChristian Lamparter 	 * stages. Its main task is to provide a serialization mechanism,
82124a8fdadSChristian Lamparter 	 * so all rx handlers can enjoy having exclusive access to their
82224a8fdadSChristian Lamparter 	 * private data structures.
82324a8fdadSChristian Lamparter 	 */
82424a8fdadSChristian Lamparter 	struct sk_buff_head rx_skb_queue;
82524a8fdadSChristian Lamparter 	bool running_rx_handler;	/* protected by rx_skb_queue.lock */
82624a8fdadSChristian Lamparter 
827d0709a65SJohannes Berg 	/* Station data */
828d0709a65SJohannes Berg 	/*
82934e89507SJohannes Berg 	 * The mutex only protects the list and counter,
83034e89507SJohannes Berg 	 * reads are done in RCU.
83134e89507SJohannes Berg 	 * Additionally, the lock protects the hash table,
83234e89507SJohannes Berg 	 * the pending list and each BSS's TIM bitmap.
833d0709a65SJohannes Berg 	 */
83434e89507SJohannes Berg 	struct mutex sta_mtx;
835d0709a65SJohannes Berg 	spinlock_t sta_lock;
836d0709a65SJohannes Berg 	unsigned long num_sta;
83734e89507SJohannes Berg 	struct list_head sta_list, sta_pending_list;
83840b275b6SJohannes Berg 	struct sta_info __rcu *sta_hash[STA_HASH_SIZE];
839f0706e82SJiri Benc 	struct timer_list sta_cleanup;
84034e89507SJohannes Berg 	struct work_struct sta_finish_work;
841f5ea9120SJohannes Berg 	int sta_generation;
842f0706e82SJiri Benc 
8432a577d98SJohannes Berg 	struct sk_buff_head pending[IEEE80211_MAX_QUEUES];
844f0706e82SJiri Benc 	struct tasklet_struct tx_pending_tasklet;
845f0706e82SJiri Benc 
846a6a67db2SJohannes Berg 	atomic_t agg_queue_stop[IEEE80211_MAX_QUEUES];
847cd8ffc80SJohannes Berg 
848f0706e82SJiri Benc 	/* number of interfaces with corresponding IFF_ flags */
84953918994SJohannes Berg 	atomic_t iff_allmultis, iff_promiscs;
850f0706e82SJiri Benc 
851f0706e82SJiri Benc 	struct rate_control_ref *rate_ctrl;
852f0706e82SJiri Benc 
8535f9f1812SFelix Fietkau 	struct crypto_cipher *wep_tx_tfm;
8545f9f1812SFelix Fietkau 	struct crypto_cipher *wep_rx_tfm;
855f0706e82SJiri Benc 	u32 wep_iv;
856f0706e82SJiri Benc 
857c771c9d8SJohannes Berg 	/* see iface.c */
85879010420SJohannes Berg 	struct list_head interfaces;
859c771c9d8SJohannes Berg 	struct mutex iflist_mtx;
86079010420SJohannes Berg 
861b16bd15cSJohannes Berg 	/*
862ad0e2b5aSJohannes Berg 	 * Key mutex, protects sdata's key_list and sta_info's
863b16bd15cSJohannes Berg 	 * key pointers (write access, they're RCU.)
864b16bd15cSJohannes Berg 	 */
865ad0e2b5aSJohannes Berg 	struct mutex key_mtx;
866b16bd15cSJohannes Berg 
867a1699b75SJohannes Berg 	/* mutex for scan and work locking */
868a1699b75SJohannes Berg 	struct mutex mtx;
869b16bd15cSJohannes Berg 
870c2b13452SJohannes Berg 	/* Scanning and BSS list */
871fbe9c429SHelmut Schaa 	unsigned long scanning;
8722a519311SJohannes Berg 	struct cfg80211_ssid scan_ssid;
8735ba63533SJohannes Berg 	struct cfg80211_scan_request *int_scan_req;
8744d36ec58SJohannes Berg 	struct cfg80211_scan_request *scan_req, *hw_scan_req;
8752a519311SJohannes Berg 	struct ieee80211_channel *scan_channel;
8764d36ec58SJohannes Berg 	enum ieee80211_band hw_scan_band;
877f0706e82SJiri Benc 	int scan_channel_idx;
878de95a54bSJohannes Berg 	int scan_ies_len;
8798318d78aSJohannes Berg 
88079f460caSLuciano Coelho 	bool sched_scanning;
88179f460caSLuciano Coelho 	struct ieee80211_sched_scan_ies sched_scan_ies;
88285a9994aSLuciano Coelho 	struct work_struct sched_scan_stopped_work;
88379f460caSLuciano Coelho 
884df13cce5SHelmut Schaa 	unsigned long leave_oper_channel_time;
885977923b0SHelmut Schaa 	enum mac80211_scan_state next_scan_state;
886f0706e82SJiri Benc 	struct delayed_work scan_work;
887491775a5SJohannes Berg 	struct ieee80211_sub_if_data *scan_sdata;
8880aaffa9bSJohannes Berg 	enum nl80211_channel_type _oper_channel_type;
8892a519311SJohannes Berg 	struct ieee80211_channel *oper_channel, *csa_channel;
890f0706e82SJiri Benc 
891b8bc4b0aSJohannes Berg 	/* Temporary remain-on-channel for off-channel operations */
892b8bc4b0aSJohannes Berg 	struct ieee80211_channel *tmp_channel;
893b8bc4b0aSJohannes Berg 	enum nl80211_channel_type tmp_channel_type;
894b8bc4b0aSJohannes Berg 
895f0706e82SJiri Benc 	/* SNMP counters */
896f0706e82SJiri Benc 	/* dot11CountersTable */
897f0706e82SJiri Benc 	u32 dot11TransmittedFragmentCount;
898f0706e82SJiri Benc 	u32 dot11MulticastTransmittedFrameCount;
899f0706e82SJiri Benc 	u32 dot11FailedCount;
900f0706e82SJiri Benc 	u32 dot11RetryCount;
901f0706e82SJiri Benc 	u32 dot11MultipleRetryCount;
902f0706e82SJiri Benc 	u32 dot11FrameDuplicateCount;
903f0706e82SJiri Benc 	u32 dot11ReceivedFragmentCount;
904f0706e82SJiri Benc 	u32 dot11MulticastReceivedFrameCount;
905f0706e82SJiri Benc 	u32 dot11TransmittedFrameCount;
906f0706e82SJiri Benc 
907f0706e82SJiri Benc #ifdef CONFIG_MAC80211_LEDS
908f0706e82SJiri Benc 	int tx_led_counter, rx_led_counter;
909cdcb006fSIvo van Doorn 	struct led_trigger *tx_led, *rx_led, *assoc_led, *radio_led;
910e1e54068SJohannes Berg 	struct tpt_led_trigger *tpt_led_trigger;
911cdcb006fSIvo van Doorn 	char tx_led_name[32], rx_led_name[32],
912cdcb006fSIvo van Doorn 	     assoc_led_name[32], radio_led_name[32];
913f0706e82SJiri Benc #endif
914f0706e82SJiri Benc 
915f0706e82SJiri Benc #ifdef CONFIG_MAC80211_DEBUG_COUNTERS
916f0706e82SJiri Benc 	/* TX/RX handler statistics */
917f0706e82SJiri Benc 	unsigned int tx_handlers_drop;
918f0706e82SJiri Benc 	unsigned int tx_handlers_queued;
919f0706e82SJiri Benc 	unsigned int tx_handlers_drop_unencrypted;
920f0706e82SJiri Benc 	unsigned int tx_handlers_drop_fragment;
921f0706e82SJiri Benc 	unsigned int tx_handlers_drop_wep;
922f0706e82SJiri Benc 	unsigned int tx_handlers_drop_not_assoc;
923f0706e82SJiri Benc 	unsigned int tx_handlers_drop_unauth_port;
924f0706e82SJiri Benc 	unsigned int rx_handlers_drop;
925f0706e82SJiri Benc 	unsigned int rx_handlers_queued;
926f0706e82SJiri Benc 	unsigned int rx_handlers_drop_nullfunc;
927f0706e82SJiri Benc 	unsigned int rx_handlers_drop_defrag;
928f0706e82SJiri Benc 	unsigned int rx_handlers_drop_short;
929f0706e82SJiri Benc 	unsigned int rx_handlers_drop_passive_scan;
930f0706e82SJiri Benc 	unsigned int tx_expand_skb_head;
931f0706e82SJiri Benc 	unsigned int tx_expand_skb_head_cloned;
932f0706e82SJiri Benc 	unsigned int rx_expand_skb_head;
933f0706e82SJiri Benc 	unsigned int rx_expand_skb_head2;
934f0706e82SJiri Benc 	unsigned int rx_handlers_fragments;
935f0706e82SJiri Benc 	unsigned int tx_status_drop;
936f0706e82SJiri Benc #define I802_DEBUG_INC(c) (c)++
937f0706e82SJiri Benc #else /* CONFIG_MAC80211_DEBUG_COUNTERS */
938f0706e82SJiri Benc #define I802_DEBUG_INC(c) do { } while (0)
939f0706e82SJiri Benc #endif /* CONFIG_MAC80211_DEBUG_COUNTERS */
940f0706e82SJiri Benc 
941f0706e82SJiri Benc 
942f0706e82SJiri Benc 	int total_ps_buffered; /* total number of all buffered unicast and
943f0706e82SJiri Benc 				* multicast packets for power saving stations
944f0706e82SJiri Benc 				*/
945f0706e82SJiri Benc 	int wifi_wme_noack_test;
946f0706e82SJiri Benc 	unsigned int wmm_acm; /* bit field of ACM bits (BIT(802.1D tag)) */
947520eb820SKalle Valo 
94850ae0cf1SKalle Valo 	/*
94950ae0cf1SKalle Valo 	 * Bitmask of enabled u-apsd queues,
95050ae0cf1SKalle Valo 	 * IEEE80211_WMM_IE_STA_QOSINFO_AC_BE & co. Needs a new association
95150ae0cf1SKalle Valo 	 * to take effect.
95250ae0cf1SKalle Valo 	 */
95350ae0cf1SKalle Valo 	unsigned int uapsd_queues;
95450ae0cf1SKalle Valo 
95550ae0cf1SKalle Valo 	/*
95650ae0cf1SKalle Valo 	 * Maximum number of buffered frames AP can deliver during a
95750ae0cf1SKalle Valo 	 * service period, IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL or similar.
95850ae0cf1SKalle Valo 	 * Needs a new association to take effect.
95950ae0cf1SKalle Valo 	 */
96050ae0cf1SKalle Valo 	unsigned int uapsd_max_sp_len;
96150ae0cf1SKalle Valo 
962572e0012SKalle Valo 	bool pspolling;
963b203ffc3SJouni Malinen 	bool offchannel_ps_enabled;
964965bedadSJohannes Berg 	/*
965965bedadSJohannes Berg 	 * PS can only be enabled when we have exactly one managed
966965bedadSJohannes Berg 	 * interface (and monitors) in PS, this then points there.
967965bedadSJohannes Berg 	 */
968965bedadSJohannes Berg 	struct ieee80211_sub_if_data *ps_sdata;
969520eb820SKalle Valo 	struct work_struct dynamic_ps_enable_work;
970520eb820SKalle Valo 	struct work_struct dynamic_ps_disable_work;
971520eb820SKalle Valo 	struct timer_list dynamic_ps_timer;
97210f644a4SJohannes Berg 	struct notifier_block network_latency_notifier;
9732b2c009eSJuuso Oikarinen 	struct notifier_block ifa_notifier;
974f0706e82SJiri Benc 
975ff616381SJuuso Oikarinen 	/*
976ff616381SJuuso Oikarinen 	 * The dynamic ps timeout configured from user space via WEXT -
977ff616381SJuuso Oikarinen 	 * this will override whatever chosen by mac80211 internally.
978ff616381SJuuso Oikarinen 	 */
979ff616381SJuuso Oikarinen 	int dynamic_ps_forced_timeout;
980f90754c1SJuuso Oikarinen 	int dynamic_ps_user_timeout;
981f90754c1SJuuso Oikarinen 	bool disable_dynamic_ps;
982ff616381SJuuso Oikarinen 
9832bf30fabSJohannes Berg 	int user_power_level; /* in dBm */
984a8302de9SVasanthakumar Thiagarajan 	int power_constr_level; /* in dBm */
9852bf30fabSJohannes Berg 
9860f78231bSJohannes Berg 	enum ieee80211_smps_mode smps_mode;
9870f78231bSJohannes Berg 
988f2753ddbSJohannes Berg 	struct work_struct restart_work;
989f2753ddbSJohannes Berg 
990e9f207f0SJiri Benc #ifdef CONFIG_MAC80211_DEBUGFS
991e9f207f0SJiri Benc 	struct local_debugfsdentries {
9924b7679a5SJohannes Berg 		struct dentry *rcdir;
993e9f207f0SJiri Benc 		struct dentry *keys;
994e9f207f0SJiri Benc 	} debugfs;
995e9f207f0SJiri Benc #endif
9964e6cbfd0SJohn W. Linville 
99721f83589SJohannes Berg 	struct ieee80211_channel *hw_roc_channel;
99821f83589SJohannes Berg 	struct net_device *hw_roc_dev;
9994334ec85SJohannes Berg 	struct sk_buff *hw_roc_skb, *hw_roc_skb_for_status;
100021f83589SJohannes Berg 	struct work_struct hw_roc_start, hw_roc_done;
100121f83589SJohannes Berg 	enum nl80211_channel_type hw_roc_channel_type;
100221f83589SJohannes Berg 	unsigned int hw_roc_duration;
100321f83589SJohannes Berg 	u32 hw_roc_cookie;
100490fc4b3aSJohannes Berg 	bool hw_roc_for_tx;
10055f16a436SJohannes Berg 	unsigned long hw_offchan_tx_cookie;
100621f83589SJohannes Berg 
10074e6cbfd0SJohn W. Linville 	/* dummy netdev for use w/ NAPI */
10084e6cbfd0SJohn W. Linville 	struct net_device napi_dev;
10094e6cbfd0SJohn W. Linville 
10104e6cbfd0SJohn W. Linville 	struct napi_struct napi;
1011f0706e82SJiri Benc };
1012f0706e82SJiri Benc 
10133e122be0SJohannes Berg static inline struct ieee80211_sub_if_data *
10143e122be0SJohannes Berg IEEE80211_DEV_TO_SUB_IF(struct net_device *dev)
10153e122be0SJohannes Berg {
10163e122be0SJohannes Berg 	return netdev_priv(dev);
10173e122be0SJohannes Berg }
10183e122be0SJohannes Berg 
1019c1475ca9SJohannes Berg /* this struct represents 802.11n's RA/TID combination */
1020eadc8d9eSRon Rindjunsky struct ieee80211_ra_tid {
1021eadc8d9eSRon Rindjunsky 	u8 ra[ETH_ALEN];
1022eadc8d9eSRon Rindjunsky 	u16 tid;
1023eadc8d9eSRon Rindjunsky };
1024eadc8d9eSRon Rindjunsky 
1025ee385855SLuis Carlos Cobo /* Parsed Information Elements */
1026ee385855SLuis Carlos Cobo struct ieee802_11_elems {
102743ac2ca3SJouni Malinen 	u8 *ie_start;
102843ac2ca3SJouni Malinen 	size_t total_len;
102943ac2ca3SJouni Malinen 
1030ee385855SLuis Carlos Cobo 	/* pointers to IEs */
1031ee385855SLuis Carlos Cobo 	u8 *ssid;
1032ee385855SLuis Carlos Cobo 	u8 *supp_rates;
1033ee385855SLuis Carlos Cobo 	u8 *fh_params;
1034ee385855SLuis Carlos Cobo 	u8 *ds_params;
1035ee385855SLuis Carlos Cobo 	u8 *cf_params;
1036e7ec86f5SJohannes Berg 	struct ieee80211_tim_ie *tim;
1037ee385855SLuis Carlos Cobo 	u8 *ibss_params;
1038ee385855SLuis Carlos Cobo 	u8 *challenge;
1039ee385855SLuis Carlos Cobo 	u8 *wpa;
1040ee385855SLuis Carlos Cobo 	u8 *rsn;
1041ee385855SLuis Carlos Cobo 	u8 *erp_info;
1042ee385855SLuis Carlos Cobo 	u8 *ext_supp_rates;
1043ee385855SLuis Carlos Cobo 	u8 *wmm_info;
1044ee385855SLuis Carlos Cobo 	u8 *wmm_param;
104509914813SJohannes Berg 	struct ieee80211_ht_cap *ht_cap_elem;
1046d9fe60deSJohannes Berg 	struct ieee80211_ht_info *ht_info_elem;
1047136cfa28SRui Paulo 	struct ieee80211_meshconf_ie *mesh_config;
1048ee385855SLuis Carlos Cobo 	u8 *mesh_id;
1049ee385855SLuis Carlos Cobo 	u8 *peer_link;
1050ee385855SLuis Carlos Cobo 	u8 *preq;
1051ee385855SLuis Carlos Cobo 	u8 *prep;
1052ee385855SLuis Carlos Cobo 	u8 *perr;
105390a5e169SRui Paulo 	struct ieee80211_rann_ie *rann;
1054f2df3859SAssaf Krauss 	u8 *ch_switch_elem;
1055f2df3859SAssaf Krauss 	u8 *country_elem;
1056f2df3859SAssaf Krauss 	u8 *pwr_constr_elem;
1057f2df3859SAssaf Krauss 	u8 *quiet_elem; 	/* first quite element */
1058f797eb7eSJouni Malinen 	u8 *timeout_int;
1059ee385855SLuis Carlos Cobo 
1060ee385855SLuis Carlos Cobo 	/* length of them, respectively */
1061ee385855SLuis Carlos Cobo 	u8 ssid_len;
1062ee385855SLuis Carlos Cobo 	u8 supp_rates_len;
1063ee385855SLuis Carlos Cobo 	u8 fh_params_len;
1064ee385855SLuis Carlos Cobo 	u8 ds_params_len;
1065ee385855SLuis Carlos Cobo 	u8 cf_params_len;
1066ee385855SLuis Carlos Cobo 	u8 tim_len;
1067ee385855SLuis Carlos Cobo 	u8 ibss_params_len;
1068ee385855SLuis Carlos Cobo 	u8 challenge_len;
1069ee385855SLuis Carlos Cobo 	u8 wpa_len;
1070ee385855SLuis Carlos Cobo 	u8 rsn_len;
1071ee385855SLuis Carlos Cobo 	u8 erp_info_len;
1072ee385855SLuis Carlos Cobo 	u8 ext_supp_rates_len;
1073ee385855SLuis Carlos Cobo 	u8 wmm_info_len;
1074ee385855SLuis Carlos Cobo 	u8 wmm_param_len;
1075ee385855SLuis Carlos Cobo 	u8 mesh_id_len;
1076ee385855SLuis Carlos Cobo 	u8 peer_link_len;
1077ee385855SLuis Carlos Cobo 	u8 preq_len;
1078ee385855SLuis Carlos Cobo 	u8 prep_len;
1079ee385855SLuis Carlos Cobo 	u8 perr_len;
1080f2df3859SAssaf Krauss 	u8 ch_switch_elem_len;
1081f2df3859SAssaf Krauss 	u8 country_elem_len;
1082f2df3859SAssaf Krauss 	u8 pwr_constr_elem_len;
1083f2df3859SAssaf Krauss 	u8 quiet_elem_len;
1084f2df3859SAssaf Krauss 	u8 num_of_quiet_elem;	/* can be more the one */
1085f797eb7eSJouni Malinen 	u8 timeout_int_len;
1086ee385855SLuis Carlos Cobo };
1087ee385855SLuis Carlos Cobo 
1088f0706e82SJiri Benc static inline struct ieee80211_local *hw_to_local(
1089f0706e82SJiri Benc 	struct ieee80211_hw *hw)
1090f0706e82SJiri Benc {
1091f0706e82SJiri Benc 	return container_of(hw, struct ieee80211_local, hw);
1092f0706e82SJiri Benc }
1093f0706e82SJiri Benc 
1094f0706e82SJiri Benc static inline struct ieee80211_hw *local_to_hw(
1095f0706e82SJiri Benc 	struct ieee80211_local *local)
1096f0706e82SJiri Benc {
1097f0706e82SJiri Benc 	return &local->hw;
1098f0706e82SJiri Benc }
1099f0706e82SJiri Benc 
1100f0706e82SJiri Benc 
1101571ecf67SJohannes Berg static inline int ieee80211_bssid_match(const u8 *raddr, const u8 *addr)
1102571ecf67SJohannes Berg {
1103571ecf67SJohannes Berg 	return compare_ether_addr(raddr, addr) == 0 ||
1104571ecf67SJohannes Berg 	       is_broadcast_ether_addr(raddr);
1105571ecf67SJohannes Berg }
1106571ecf67SJohannes Berg 
1107571ecf67SJohannes Berg 
1108e8975581SJohannes Berg int ieee80211_hw_config(struct ieee80211_local *local, u32 changed);
11095cf121c3SJohannes Berg void ieee80211_tx_set_protected(struct ieee80211_tx_data *tx);
11109c6bd790SJohannes Berg void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata,
11119c6bd790SJohannes Berg 				      u32 changed);
11120d143fe1SJohannes Berg void ieee80211_configure_filter(struct ieee80211_local *local);
111346900298SJohannes Berg u32 ieee80211_reset_erp_info(struct ieee80211_sub_if_data *sdata);
1114f0706e82SJiri Benc 
111546900298SJohannes Berg /* STA code */
11169c6bd790SJohannes Berg void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata);
111777fdaa12SJohannes Berg int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata,
111877fdaa12SJohannes Berg 		       struct cfg80211_auth_request *req);
111977fdaa12SJohannes Berg int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,
112077fdaa12SJohannes Berg 			struct cfg80211_assoc_request *req);
112177fdaa12SJohannes Berg int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata,
1122667503ddSJohannes Berg 			 struct cfg80211_deauth_request *req,
1123667503ddSJohannes Berg 			 void *cookie);
112477fdaa12SJohannes Berg int ieee80211_mgd_disassoc(struct ieee80211_sub_if_data *sdata,
1125667503ddSJohannes Berg 			   struct cfg80211_disassoc_request *req,
1126667503ddSJohannes Berg 			   void *cookie);
1127572e0012SKalle Valo void ieee80211_send_pspoll(struct ieee80211_local *local,
1128572e0012SKalle Valo 			   struct ieee80211_sub_if_data *sdata);
112910f644a4SJohannes Berg void ieee80211_recalc_ps(struct ieee80211_local *local, s32 latency);
113010f644a4SJohannes Berg int ieee80211_max_network_latency(struct notifier_block *nb,
113110f644a4SJohannes Berg 				  unsigned long data, void *dummy);
11322b2c009eSJuuso Oikarinen int ieee80211_set_arp_filter(struct ieee80211_sub_if_data *sdata);
1133cc32abd4SJohannes Berg void ieee80211_sta_process_chanswitch(struct ieee80211_sub_if_data *sdata,
1134cc32abd4SJohannes Berg 				      struct ieee80211_channel_sw_ie *sw_elem,
11355ce6e438SJohannes Berg 				      struct ieee80211_bss *bss,
11365ce6e438SJohannes Berg 				      u64 timestamp);
11375bb644a0SJohannes Berg void ieee80211_sta_quiesce(struct ieee80211_sub_if_data *sdata);
11385bb644a0SJohannes Berg void ieee80211_sta_restart(struct ieee80211_sub_if_data *sdata);
11391fa57d01SJohannes Berg void ieee80211_sta_work(struct ieee80211_sub_if_data *sdata);
11401fa57d01SJohannes Berg void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
11411fa57d01SJohannes Berg 				  struct sk_buff *skb);
1142d3a910a8SLuis R. Rodriguez void ieee80211_sta_reset_beacon_monitor(struct ieee80211_sub_if_data *sdata);
1143be099e82SLuis R. Rodriguez void ieee80211_sta_reset_conn_monitor(struct ieee80211_sub_if_data *sdata);
11449c6bd790SJohannes Berg 
114546900298SJohannes Berg /* IBSS code */
114646900298SJohannes Berg void ieee80211_ibss_notify_scan_completed(struct ieee80211_local *local);
114746900298SJohannes Berg void ieee80211_ibss_setup_sdata(struct ieee80211_sub_if_data *sdata);
114846900298SJohannes Berg struct sta_info *ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata,
114934e89507SJohannes Berg 					u8 *bssid, u8 *addr, u32 supp_rates,
115034e89507SJohannes Berg 					gfp_t gfp);
1151af8cdcd8SJohannes Berg int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata,
1152af8cdcd8SJohannes Berg 			struct cfg80211_ibss_params *params);
1153af8cdcd8SJohannes Berg int ieee80211_ibss_leave(struct ieee80211_sub_if_data *sdata);
11545bb644a0SJohannes Berg void ieee80211_ibss_quiesce(struct ieee80211_sub_if_data *sdata);
11555bb644a0SJohannes Berg void ieee80211_ibss_restart(struct ieee80211_sub_if_data *sdata);
11561fa57d01SJohannes Berg void ieee80211_ibss_work(struct ieee80211_sub_if_data *sdata);
11571fa57d01SJohannes Berg void ieee80211_ibss_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
11581fa57d01SJohannes Berg 				   struct sk_buff *skb);
11591fa57d01SJohannes Berg 
11601fa57d01SJohannes Berg /* mesh code */
11611fa57d01SJohannes Berg void ieee80211_mesh_work(struct ieee80211_sub_if_data *sdata);
11621fa57d01SJohannes Berg void ieee80211_mesh_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
11631fa57d01SJohannes Berg 				   struct sk_buff *skb);
116446900298SJohannes Berg 
11659c6bd790SJohannes Berg /* scan/BSS handling */
116646900298SJohannes Berg void ieee80211_scan_work(struct work_struct *work);
1167f3b85252SJohannes Berg int ieee80211_request_internal_scan(struct ieee80211_sub_if_data *sdata,
1168be4a4b6aSJohannes Berg 				    const u8 *ssid, u8 ssid_len,
1169be4a4b6aSJohannes Berg 				    struct ieee80211_channel *chan);
1170c2b13452SJohannes Berg int ieee80211_request_scan(struct ieee80211_sub_if_data *sdata,
11712a519311SJohannes Berg 			   struct cfg80211_scan_request *req);
11725bb644a0SJohannes Berg void ieee80211_scan_cancel(struct ieee80211_local *local);
1173c2b13452SJohannes Berg ieee80211_rx_result
1174f1d58c25SJohannes Berg ieee80211_scan_rx(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb);
11759c6bd790SJohannes Berg 
11760a51b27eSJohannes Berg void ieee80211_mlme_notify_scan_completed(struct ieee80211_local *local);
1177c2b13452SJohannes Berg struct ieee80211_bss *
117898c8fccfSJohannes Berg ieee80211_bss_info_update(struct ieee80211_local *local,
117998c8fccfSJohannes Berg 			  struct ieee80211_rx_status *rx_status,
118098c8fccfSJohannes Berg 			  struct ieee80211_mgmt *mgmt,
118198c8fccfSJohannes Berg 			  size_t len,
118298c8fccfSJohannes Berg 			  struct ieee802_11_elems *elems,
11832a519311SJohannes Berg 			  struct ieee80211_channel *channel,
11842a519311SJohannes Berg 			  bool beacon);
1185c2b13452SJohannes Berg struct ieee80211_bss *
11865484e237SJohannes Berg ieee80211_rx_bss_get(struct ieee80211_local *local, u8 *bssid, int freq,
11875484e237SJohannes Berg 		     u8 *ssid, u8 ssid_len);
118898c8fccfSJohannes Berg void ieee80211_rx_bss_put(struct ieee80211_local *local,
1189c2b13452SJohannes Berg 			  struct ieee80211_bss *bss);
1190ee385855SLuis Carlos Cobo 
119179f460caSLuciano Coelho /* scheduled scan handling */
119279f460caSLuciano Coelho int ieee80211_request_sched_scan_start(struct ieee80211_sub_if_data *sdata,
119379f460caSLuciano Coelho 				       struct cfg80211_sched_scan_request *req);
119485a9994aSLuciano Coelho int ieee80211_request_sched_scan_stop(struct ieee80211_sub_if_data *sdata);
119585a9994aSLuciano Coelho void ieee80211_sched_scan_stopped_work(struct work_struct *work);
119679f460caSLuciano Coelho 
1197b203ffc3SJouni Malinen /* off-channel helpers */
1198b23b025fSBen Greear bool ieee80211_cfg_on_oper_channel(struct ieee80211_local *local);
1199b23b025fSBen Greear void ieee80211_offchannel_enable_all_ps(struct ieee80211_local *local,
1200b23b025fSBen Greear 					bool tell_ap);
1201b23b025fSBen Greear void ieee80211_offchannel_stop_vifs(struct ieee80211_local *local,
1202b23b025fSBen Greear 				    bool offchannel_ps_enable);
1203b203ffc3SJouni Malinen void ieee80211_offchannel_return(struct ieee80211_local *local,
1204b23b025fSBen Greear 				 bool enable_beaconing,
1205b23b025fSBen Greear 				 bool offchannel_ps_disable);
120621f83589SJohannes Berg void ieee80211_hw_roc_setup(struct ieee80211_local *local);
1207b203ffc3SJouni Malinen 
12083e122be0SJohannes Berg /* interface handling */
120947846c9bSJohannes Berg int ieee80211_iface_init(void);
121047846c9bSJohannes Berg void ieee80211_iface_exit(void);
12113e122be0SJohannes Berg int ieee80211_if_add(struct ieee80211_local *local, const char *name,
121205c914feSJohannes Berg 		     struct net_device **new_dev, enum nl80211_iftype type,
1213ee385855SLuis Carlos Cobo 		     struct vif_params *params);
1214f3947e2dSJohannes Berg int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata,
121505c914feSJohannes Berg 			     enum nl80211_iftype type);
1216f698d856SJasper Bryant-Greene void ieee80211_if_remove(struct ieee80211_sub_if_data *sdata);
121775636525SJohannes Berg void ieee80211_remove_interfaces(struct ieee80211_local *local);
12185cff20e6SJohannes Berg u32 __ieee80211_recalc_idle(struct ieee80211_local *local);
12195cff20e6SJohannes Berg void ieee80211_recalc_idle(struct ieee80211_local *local);
122085416a4fSChristian Lamparter void ieee80211_adjust_monitor_flags(struct ieee80211_sub_if_data *sdata,
122185416a4fSChristian Lamparter 				    const int offset);
1222f0706e82SJiri Benc 
12239607e6b6SJohannes Berg static inline bool ieee80211_sdata_running(struct ieee80211_sub_if_data *sdata)
12249607e6b6SJohannes Berg {
122534d4bc4dSJohannes Berg 	return test_bit(SDATA_STATE_RUNNING, &sdata->state);
12269607e6b6SJohannes Berg }
12279607e6b6SJohannes Berg 
1228e2ebc74dSJohannes Berg /* tx handling */
1229e2ebc74dSJohannes Berg void ieee80211_clear_tx_pending(struct ieee80211_local *local);
1230e2ebc74dSJohannes Berg void ieee80211_tx_pending(unsigned long data);
1231d0cf9c0dSStephen Hemminger netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb,
1232d0cf9c0dSStephen Hemminger 					 struct net_device *dev);
1233d0cf9c0dSStephen Hemminger netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
1234d0cf9c0dSStephen Hemminger 				       struct net_device *dev);
1235e2ebc74dSJohannes Berg 
1236fe7a5d5cSJohannes Berg /*
1237fe7a5d5cSJohannes Berg  * radiotap header for status frames
1238fe7a5d5cSJohannes Berg  */
1239fe7a5d5cSJohannes Berg struct ieee80211_tx_status_rtap_hdr {
1240fe7a5d5cSJohannes Berg 	struct ieee80211_radiotap_header hdr;
1241fe7a5d5cSJohannes Berg 	u8 rate;
1242fe7a5d5cSJohannes Berg 	u8 padding_for_rate;
1243fe7a5d5cSJohannes Berg 	__le16 tx_flags;
1244fe7a5d5cSJohannes Berg 	u8 data_retries;
1245bc10502dSEric Dumazet } __packed;
1246fe7a5d5cSJohannes Berg 
1247fe7a5d5cSJohannes Berg 
1248de1ede7aSJohannes Berg /* HT */
1249ae5eb026SJohannes Berg void ieee80211_ht_cap_ie_to_sta_ht_cap(struct ieee80211_supported_band *sband,
1250ae5eb026SJohannes Berg 				       struct ieee80211_ht_cap *ht_cap_ie,
1251d9fe60deSJohannes Berg 				       struct ieee80211_sta_ht_cap *ht_cap);
1252de1ede7aSJohannes Berg void ieee80211_send_bar(struct ieee80211_sub_if_data *sdata, u8 *ra, u16 tid, u16 ssn);
1253b8695a8fSJohannes Berg void ieee80211_send_delba(struct ieee80211_sub_if_data *sdata,
1254b8695a8fSJohannes Berg 			  const u8 *da, u16 tid,
1255b8695a8fSJohannes Berg 			  u16 initiator, u16 reason_code);
12560f78231bSJohannes Berg int ieee80211_send_smps_action(struct ieee80211_sub_if_data *sdata,
12570f78231bSJohannes Berg 			       enum ieee80211_smps_mode smps, const u8 *da,
12580f78231bSJohannes Berg 			       const u8 *bssid);
1259d1f5b7a3SJohannes Berg void ieee80211_request_smps_work(struct work_struct *work);
1260de1ede7aSJohannes Berg 
12617c3b1dd8SJohannes Berg void ___ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid,
126253f73c09SJohannes Berg 				     u16 initiator, u16 reason, bool stop);
1263849b7967SJohannes Berg void __ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid,
126453f73c09SJohannes Berg 				    u16 initiator, u16 reason, bool stop);
126553f73c09SJohannes Berg void ieee80211_sta_tear_down_BA_sessions(struct sta_info *sta, bool tx);
1266de1ede7aSJohannes Berg void ieee80211_process_delba(struct ieee80211_sub_if_data *sdata,
1267de1ede7aSJohannes Berg 			     struct sta_info *sta,
1268de1ede7aSJohannes Berg 			     struct ieee80211_mgmt *mgmt, size_t len);
1269de1ede7aSJohannes Berg void ieee80211_process_addba_resp(struct ieee80211_local *local,
1270de1ede7aSJohannes Berg 				  struct sta_info *sta,
1271de1ede7aSJohannes Berg 				  struct ieee80211_mgmt *mgmt,
1272de1ede7aSJohannes Berg 				  size_t len);
1273de1ede7aSJohannes Berg void ieee80211_process_addba_request(struct ieee80211_local *local,
1274de1ede7aSJohannes Berg 				     struct sta_info *sta,
1275de1ede7aSJohannes Berg 				     struct ieee80211_mgmt *mgmt,
1276de1ede7aSJohannes Berg 				     size_t len);
1277de1ede7aSJohannes Berg 
1278849b7967SJohannes Berg int __ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
127953f73c09SJohannes Berg 				   enum ieee80211_back_parties initiator,
128053f73c09SJohannes Berg 				   bool tx);
128167c282c0SJohannes Berg int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
128253f73c09SJohannes Berg 				    enum ieee80211_back_parties initiator,
128353f73c09SJohannes Berg 				    bool tx);
12845d22c89bSJohannes Berg void ieee80211_start_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u16 tid);
12855d22c89bSJohannes Berg void ieee80211_stop_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u8 tid);
128667c282c0SJohannes Berg void ieee80211_ba_session_work(struct work_struct *work);
128767c282c0SJohannes Berg void ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid);
12882bff8ebfSChristian Lamparter void ieee80211_release_reorder_timeout(struct sta_info *sta, int tid);
1289849b7967SJohannes Berg 
129039192c0bSJohannes Berg /* Spectrum management */
129139192c0bSJohannes Berg void ieee80211_process_measurement_req(struct ieee80211_sub_if_data *sdata,
129239192c0bSJohannes Berg 				       struct ieee80211_mgmt *mgmt,
129339192c0bSJohannes Berg 				       size_t len);
129439192c0bSJohannes Berg 
1295f2753ddbSJohannes Berg /* Suspend/resume and hw reconfiguration */
1296f2753ddbSJohannes Berg int ieee80211_reconfig(struct ieee80211_local *local);
129784f6a01cSJohannes Berg void ieee80211_stop_device(struct ieee80211_local *local);
1298f2753ddbSJohannes Berg 
1299827b1fb4SJohannes Berg #ifdef CONFIG_PM
1300eecc4800SJohannes Berg int __ieee80211_suspend(struct ieee80211_hw *hw,
1301eecc4800SJohannes Berg 			struct cfg80211_wowlan *wowlan);
1302f2753ddbSJohannes Berg 
1303f2753ddbSJohannes Berg static inline int __ieee80211_resume(struct ieee80211_hw *hw)
1304f2753ddbSJohannes Berg {
130585f72bc8SJohn W. Linville 	struct ieee80211_local *local = hw_to_local(hw);
130685f72bc8SJohn W. Linville 
130785f72bc8SJohn W. Linville 	WARN(test_bit(SCAN_HW_SCANNING, &local->scanning),
130885f72bc8SJohn W. Linville 		"%s: resume with hardware scan still in progress\n",
130985f72bc8SJohn W. Linville 		wiphy_name(hw->wiphy));
131085f72bc8SJohn W. Linville 
1311f2753ddbSJohannes Berg 	return ieee80211_reconfig(hw_to_local(hw));
1312f2753ddbSJohannes Berg }
1313827b1fb4SJohannes Berg #else
1314eecc4800SJohannes Berg static inline int __ieee80211_suspend(struct ieee80211_hw *hw,
1315eecc4800SJohannes Berg 				      struct cfg80211_wowlan *wowlan)
1316827b1fb4SJohannes Berg {
1317827b1fb4SJohannes Berg 	return 0;
1318827b1fb4SJohannes Berg }
1319f2753ddbSJohannes Berg 
1320827b1fb4SJohannes Berg static inline int __ieee80211_resume(struct ieee80211_hw *hw)
1321827b1fb4SJohannes Berg {
1322827b1fb4SJohannes Berg 	return 0;
1323827b1fb4SJohannes Berg }
1324827b1fb4SJohannes Berg #endif
1325665af4fcSBob Copeland 
1326c2d1560aSJohannes Berg /* utility functions/constants */
1327c2d1560aSJohannes Berg extern void *mac80211_wiphy_privid; /* for wiphy privid */
132871364716SRon Rindjunsky u8 *ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t len,
132905c914feSJohannes Berg 			enum nl80211_iftype type);
1330c2d1560aSJohannes Berg int ieee80211_frame_duration(struct ieee80211_local *local, size_t len,
1331c2d1560aSJohannes Berg 			     int rate, int erp, int short_preamble);
1332f698d856SJasper Bryant-Greene void mac80211_ev_michael_mic_failure(struct ieee80211_sub_if_data *sdata, int keyidx,
1333e6d6e342SJohannes Berg 				     struct ieee80211_hdr *hdr, const u8 *tsc,
1334e6d6e342SJohannes Berg 				     gfp_t gfp);
13355825fe10SJohannes Berg void ieee80211_set_wmm_default(struct ieee80211_sub_if_data *sdata);
133662ae67beSJohannes Berg void ieee80211_tx_skb(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb);
13379c6bd790SJohannes Berg void ieee802_11_parse_elems(u8 *start, size_t len,
13389c6bd790SJohannes Berg 			    struct ieee802_11_elems *elems);
1339d91f36dbSJohannes Berg u32 ieee802_11_parse_elems_crc(u8 *start, size_t len,
1340d91f36dbSJohannes Berg 			       struct ieee802_11_elems *elems,
1341d91f36dbSJohannes Berg 			       u64 filter, u32 crc);
1342881d948cSJohannes Berg u32 ieee80211_mandatory_rates(struct ieee80211_local *local,
134396dd22acSJohannes Berg 			      enum ieee80211_band band);
1344f0706e82SJiri Benc 
1345520eb820SKalle Valo void ieee80211_dynamic_ps_enable_work(struct work_struct *work);
1346520eb820SKalle Valo void ieee80211_dynamic_ps_disable_work(struct work_struct *work);
1347520eb820SKalle Valo void ieee80211_dynamic_ps_timer(unsigned long data);
1348a97b77b9SVivek Natarajan void ieee80211_send_nullfunc(struct ieee80211_local *local,
1349a97b77b9SVivek Natarajan 			     struct ieee80211_sub_if_data *sdata,
1350a97b77b9SVivek Natarajan 			     int powersave);
13513cf335d5SKalle Valo void ieee80211_sta_rx_notify(struct ieee80211_sub_if_data *sdata,
13523cf335d5SKalle Valo 			     struct ieee80211_hdr *hdr);
13534e5ff376SFelix Fietkau void ieee80211_sta_tx_notify(struct ieee80211_sub_if_data *sdata,
135404ac3c0eSFelix Fietkau 			     struct ieee80211_hdr *hdr, bool ack);
13551e4dcd01SJuuso Oikarinen void ieee80211_beacon_connection_loss_work(struct work_struct *work);
1356520eb820SKalle Valo 
1357ce7c9111SKalle Valo void ieee80211_wake_queues_by_reason(struct ieee80211_hw *hw,
1358ce7c9111SKalle Valo 				     enum queue_stop_reason reason);
1359ce7c9111SKalle Valo void ieee80211_stop_queues_by_reason(struct ieee80211_hw *hw,
1360ce7c9111SKalle Valo 				     enum queue_stop_reason reason);
136196f5e66eSJohannes Berg void ieee80211_wake_queue_by_reason(struct ieee80211_hw *hw, int queue,
136296f5e66eSJohannes Berg 				    enum queue_stop_reason reason);
136396f5e66eSJohannes Berg void ieee80211_stop_queue_by_reason(struct ieee80211_hw *hw, int queue,
136496f5e66eSJohannes Berg 				    enum queue_stop_reason reason);
13658f77f384SJohannes Berg void ieee80211_add_pending_skb(struct ieee80211_local *local,
13668f77f384SJohannes Berg 			       struct sk_buff *skb);
13678f77f384SJohannes Berg int ieee80211_add_pending_skbs(struct ieee80211_local *local,
13688f77f384SJohannes Berg 			       struct sk_buff_head *skbs);
136950a9432dSJohannes Berg int ieee80211_add_pending_skbs_fn(struct ieee80211_local *local,
137050a9432dSJohannes Berg 				  struct sk_buff_head *skbs,
137150a9432dSJohannes Berg 				  void (*fn)(void *data), void *data);
1372ce7c9111SKalle Valo 
137346900298SJohannes Berg void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata,
137446900298SJohannes Berg 			 u16 transaction, u16 auth_alg,
1375fffd0934SJohannes Berg 			 u8 *extra, size_t extra_len, const u8 *bssid,
1376fffd0934SJohannes Berg 			 const u8 *key, u8 key_len, u8 key_idx);
1377de95a54bSJohannes Berg int ieee80211_build_preq_ies(struct ieee80211_local *local, u8 *buffer,
13784d36ec58SJohannes Berg 			     const u8 *ie, size_t ie_len,
1379651b5225SJouni Malinen 			     enum ieee80211_band band, u32 rate_mask,
1380651b5225SJouni Malinen 			     u8 channel);
1381a619a4c0SJuuso Oikarinen struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata,
138285a237feSJohannes Berg 					  u8 *dst, u32 ratemask,
1383a619a4c0SJuuso Oikarinen 					  const u8 *ssid, size_t ssid_len,
1384a806c558SPaul Stewart 					  const u8 *ie, size_t ie_len,
1385a806c558SPaul Stewart 					  bool directed);
138646900298SJohannes Berg void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst,
1387de95a54bSJohannes Berg 			      const u8 *ssid, size_t ssid_len,
1388a806c558SPaul Stewart 			      const u8 *ie, size_t ie_len,
138985a237feSJohannes Berg 			      u32 ratemask, bool directed);
139046900298SJohannes Berg 
139146900298SJohannes Berg void ieee80211_sta_def_wmm_params(struct ieee80211_sub_if_data *sdata,
139246900298SJohannes Berg 				  const size_t supp_rates_len,
139346900298SJohannes Berg 				  const u8 *supp_rates);
139446900298SJohannes Berg u32 ieee80211_sta_get_rates(struct ieee80211_local *local,
139546900298SJohannes Berg 			    struct ieee802_11_elems *elems,
139646900298SJohannes Berg 			    enum ieee80211_band band);
13970f78231bSJohannes Berg int __ieee80211_request_smps(struct ieee80211_sub_if_data *sdata,
13980f78231bSJohannes Berg 			     enum ieee80211_smps_mode smps_mode);
1399025e6be2SJohannes Berg void ieee80211_recalc_smps(struct ieee80211_local *local);
140046900298SJohannes Berg 
14018e664fb3SJohannes Berg size_t ieee80211_ie_split(const u8 *ies, size_t ielen,
14028e664fb3SJohannes Berg 			  const u8 *ids, int n_ids, size_t offset);
14038e664fb3SJohannes Berg size_t ieee80211_ie_split_vendor(const u8 *ies, size_t ielen, size_t offset);
14048e664fb3SJohannes Berg 
1405af6b6374SJohannes Berg /* internal work items */
1406af6b6374SJohannes Berg void ieee80211_work_init(struct ieee80211_local *local);
1407af6b6374SJohannes Berg void ieee80211_add_work(struct ieee80211_work *wk);
1408af6b6374SJohannes Berg void free_work(struct ieee80211_work *wk);
1409af6b6374SJohannes Berg void ieee80211_work_purge(struct ieee80211_sub_if_data *sdata);
1410af6b6374SJohannes Berg ieee80211_rx_result ieee80211_work_rx_mgmt(struct ieee80211_sub_if_data *sdata,
1411af6b6374SJohannes Berg 					   struct sk_buff *skb);
1412b8bc4b0aSJohannes Berg int ieee80211_wk_remain_on_channel(struct ieee80211_sub_if_data *sdata,
1413b8bc4b0aSJohannes Berg 				   struct ieee80211_channel *chan,
1414b8bc4b0aSJohannes Berg 				   enum nl80211_channel_type channel_type,
1415b8bc4b0aSJohannes Berg 				   unsigned int duration, u64 *cookie);
1416b8bc4b0aSJohannes Berg int ieee80211_wk_cancel_remain_on_channel(
1417b8bc4b0aSJohannes Berg 	struct ieee80211_sub_if_data *sdata, u64 cookie);
1418af6b6374SJohannes Berg 
1419f444de05SJohannes Berg /* channel management */
1420f444de05SJohannes Berg enum ieee80211_chan_mode {
1421f444de05SJohannes Berg 	CHAN_MODE_UNDEFINED,
1422f444de05SJohannes Berg 	CHAN_MODE_HOPPING,
1423f444de05SJohannes Berg 	CHAN_MODE_FIXED,
1424f444de05SJohannes Berg };
1425f444de05SJohannes Berg 
1426f444de05SJohannes Berg enum ieee80211_chan_mode
1427f444de05SJohannes Berg ieee80211_get_channel_mode(struct ieee80211_local *local,
1428f444de05SJohannes Berg 			   struct ieee80211_sub_if_data *ignore);
14290aaffa9bSJohannes Berg bool ieee80211_set_channel_type(struct ieee80211_local *local,
14300aaffa9bSJohannes Berg 				struct ieee80211_sub_if_data *sdata,
14310aaffa9bSJohannes Berg 				enum nl80211_channel_type chantype);
1432f444de05SJohannes Berg 
1433f4ea83ddSJohannes Berg #ifdef CONFIG_MAC80211_NOINLINE
1434d9e8a70fSJohannes Berg #define debug_noinline noinline
1435d9e8a70fSJohannes Berg #else
1436d9e8a70fSJohannes Berg #define debug_noinline
1437d9e8a70fSJohannes Berg #endif
1438d9e8a70fSJohannes Berg 
1439f0706e82SJiri Benc #endif /* IEEE80211_I_H */
1440