xref: /linux/include/net/cfg80211.h (revision 47edb11b522561658fe719e56aa69a3c3098a3fe)
1704232c2SJohannes Berg #ifndef __NET_CFG80211_H
2704232c2SJohannes Berg #define __NET_CFG80211_H
3d3236553SJohannes Berg /*
4d3236553SJohannes Berg  * 802.11 device and configuration interface
5d3236553SJohannes Berg  *
6026331c4SJouni Malinen  * Copyright 2006-2010	Johannes Berg <johannes@sipsolutions.net>
72740f0cfSJohannes Berg  * Copyright 2013-2014 Intel Mobile Communications GmbH
8d3236553SJohannes Berg  *
9d3236553SJohannes Berg  * This program is free software; you can redistribute it and/or modify
10d3236553SJohannes Berg  * it under the terms of the GNU General Public License version 2 as
11d3236553SJohannes Berg  * published by the Free Software Foundation.
12d3236553SJohannes Berg  */
13704232c2SJohannes Berg 
14d3236553SJohannes Berg #include <linux/netdevice.h>
15d3236553SJohannes Berg #include <linux/debugfs.h>
16d3236553SJohannes Berg #include <linux/list.h>
17187f1882SPaul Gortmaker #include <linux/bug.h>
18704232c2SJohannes Berg #include <linux/netlink.h>
19704232c2SJohannes Berg #include <linux/skbuff.h>
2055682965SJohannes Berg #include <linux/nl80211.h>
212a519311SJohannes Berg #include <linux/if_ether.h>
222a519311SJohannes Berg #include <linux/ieee80211.h>
232a0e047eSJohannes Berg #include <linux/net.h>
24d3236553SJohannes Berg #include <net/regulatory.h>
25d3236553SJohannes Berg 
26d70e9693SJohannes Berg /**
27d70e9693SJohannes Berg  * DOC: Introduction
28d70e9693SJohannes Berg  *
29d70e9693SJohannes Berg  * cfg80211 is the configuration API for 802.11 devices in Linux. It bridges
30d70e9693SJohannes Berg  * userspace and drivers, and offers some utility functionality associated
31d70e9693SJohannes Berg  * with 802.11. cfg80211 must, directly or indirectly via mac80211, be used
32d70e9693SJohannes Berg  * by all modern wireless drivers in Linux, so that they offer a consistent
33d70e9693SJohannes Berg  * API through nl80211. For backward compatibility, cfg80211 also offers
34d70e9693SJohannes Berg  * wireless extensions to userspace, but hides them from drivers completely.
35d70e9693SJohannes Berg  *
36d70e9693SJohannes Berg  * Additionally, cfg80211 contains code to help enforce regulatory spectrum
37d70e9693SJohannes Berg  * use restrictions.
38d70e9693SJohannes Berg  */
39d70e9693SJohannes Berg 
40d70e9693SJohannes Berg 
41d70e9693SJohannes Berg /**
42d70e9693SJohannes Berg  * DOC: Device registration
43d70e9693SJohannes Berg  *
44d70e9693SJohannes Berg  * In order for a driver to use cfg80211, it must register the hardware device
45d70e9693SJohannes Berg  * with cfg80211. This happens through a number of hardware capability structs
46d70e9693SJohannes Berg  * described below.
47d70e9693SJohannes Berg  *
48d70e9693SJohannes Berg  * The fundamental structure for each device is the 'wiphy', of which each
49d70e9693SJohannes Berg  * instance describes a physical wireless device connected to the system. Each
50d70e9693SJohannes Berg  * such wiphy can have zero, one, or many virtual interfaces associated with
51d70e9693SJohannes Berg  * it, which need to be identified as such by pointing the network interface's
52d70e9693SJohannes Berg  * @ieee80211_ptr pointer to a &struct wireless_dev which further describes
53d70e9693SJohannes Berg  * the wireless part of the interface, normally this struct is embedded in the
54d70e9693SJohannes Berg  * network interface's private data area. Drivers can optionally allow creating
55d70e9693SJohannes Berg  * or destroying virtual interfaces on the fly, but without at least one or the
56d70e9693SJohannes Berg  * ability to create some the wireless device isn't useful.
57d70e9693SJohannes Berg  *
58d70e9693SJohannes Berg  * Each wiphy structure contains device capability information, and also has
59d70e9693SJohannes Berg  * a pointer to the various operations the driver offers. The definitions and
60d70e9693SJohannes Berg  * structures here describe these capabilities in detail.
61d70e9693SJohannes Berg  */
62d70e9693SJohannes Berg 
639f5e8f6eSJohannes Berg struct wiphy;
649f5e8f6eSJohannes Berg 
65704232c2SJohannes Berg /*
66d3236553SJohannes Berg  * wireless hardware capability structures
67d3236553SJohannes Berg  */
68d3236553SJohannes Berg 
69d3236553SJohannes Berg /**
70d3236553SJohannes Berg  * enum ieee80211_band - supported frequency bands
71704232c2SJohannes Berg  *
72d3236553SJohannes Berg  * The bands are assigned this way because the supported
73d3236553SJohannes Berg  * bitrates differ in these bands.
74d3236553SJohannes Berg  *
75d3236553SJohannes Berg  * @IEEE80211_BAND_2GHZ: 2.4GHz ISM band
76d3236553SJohannes Berg  * @IEEE80211_BAND_5GHZ: around 5GHz band (4.9-5.7)
773a0c52a6SVladimir Kondratiev  * @IEEE80211_BAND_60GHZ: around 60 GHz band (58.32 - 64.80 GHz)
78abe37c4bSJohannes Berg  * @IEEE80211_NUM_BANDS: number of defined bands
79d3236553SJohannes Berg  */
80d3236553SJohannes Berg enum ieee80211_band {
8113ae75b1SJouni Malinen 	IEEE80211_BAND_2GHZ = NL80211_BAND_2GHZ,
8213ae75b1SJouni Malinen 	IEEE80211_BAND_5GHZ = NL80211_BAND_5GHZ,
833a0c52a6SVladimir Kondratiev 	IEEE80211_BAND_60GHZ = NL80211_BAND_60GHZ,
84d3236553SJohannes Berg 
85d3236553SJohannes Berg 	/* keep last */
86d3236553SJohannes Berg 	IEEE80211_NUM_BANDS
87d3236553SJohannes Berg };
88d3236553SJohannes Berg 
89d3236553SJohannes Berg /**
90d3236553SJohannes Berg  * enum ieee80211_channel_flags - channel flags
91d3236553SJohannes Berg  *
92d3236553SJohannes Berg  * Channel flags set by the regulatory control code.
93d3236553SJohannes Berg  *
94d3236553SJohannes Berg  * @IEEE80211_CHAN_DISABLED: This channel is disabled.
958fe02e16SLuis R. Rodriguez  * @IEEE80211_CHAN_NO_IR: do not initiate radiation, this includes
968fe02e16SLuis R. Rodriguez  * 	sending probe requests or beaconing.
97d3236553SJohannes Berg  * @IEEE80211_CHAN_RADAR: Radar detection is required on this channel.
98689da1b3SLuis R. Rodriguez  * @IEEE80211_CHAN_NO_HT40PLUS: extension channel above this channel
99d3236553SJohannes Berg  * 	is not permitted.
100689da1b3SLuis R. Rodriguez  * @IEEE80211_CHAN_NO_HT40MINUS: extension channel below this channel
101d3236553SJohannes Berg  * 	is not permitted.
10203f6b084SSeth Forshee  * @IEEE80211_CHAN_NO_OFDM: OFDM is not allowed on this channel.
103c7a6ee27SJohannes Berg  * @IEEE80211_CHAN_NO_80MHZ: If the driver supports 80 MHz on the band,
104c7a6ee27SJohannes Berg  *	this flag indicates that an 80 MHz channel cannot use this
105c7a6ee27SJohannes Berg  *	channel as the control or any of the secondary channels.
106c7a6ee27SJohannes Berg  *	This may be due to the driver or due to regulatory bandwidth
107c7a6ee27SJohannes Berg  *	restrictions.
108c7a6ee27SJohannes Berg  * @IEEE80211_CHAN_NO_160MHZ: If the driver supports 160 MHz on the band,
109c7a6ee27SJohannes Berg  *	this flag indicates that an 160 MHz channel cannot use this
110c7a6ee27SJohannes Berg  *	channel as the control or any of the secondary channels.
111c7a6ee27SJohannes Berg  *	This may be due to the driver or due to regulatory bandwidth
112c7a6ee27SJohannes Berg  *	restrictions.
113570dbde1SDavid Spinadel  * @IEEE80211_CHAN_INDOOR_ONLY: see %NL80211_FREQUENCY_ATTR_INDOOR_ONLY
11406f207fcSArik Nemtsov  * @IEEE80211_CHAN_IR_CONCURRENT: see %NL80211_FREQUENCY_ATTR_IR_CONCURRENT
115ea077c1cSRostislav Lisovy  * @IEEE80211_CHAN_NO_20MHZ: 20 MHz bandwidth is not permitted
116ea077c1cSRostislav Lisovy  *	on this channel.
117ea077c1cSRostislav Lisovy  * @IEEE80211_CHAN_NO_10MHZ: 10 MHz bandwidth is not permitted
118ea077c1cSRostislav Lisovy  *	on this channel.
119570dbde1SDavid Spinadel  *
120d3236553SJohannes Berg  */
121d3236553SJohannes Berg enum ieee80211_channel_flags {
122d3236553SJohannes Berg 	IEEE80211_CHAN_DISABLED		= 1<<0,
1238fe02e16SLuis R. Rodriguez 	IEEE80211_CHAN_NO_IR		= 1<<1,
1248fe02e16SLuis R. Rodriguez 	/* hole at 1<<2 */
125d3236553SJohannes Berg 	IEEE80211_CHAN_RADAR		= 1<<3,
126689da1b3SLuis R. Rodriguez 	IEEE80211_CHAN_NO_HT40PLUS	= 1<<4,
127689da1b3SLuis R. Rodriguez 	IEEE80211_CHAN_NO_HT40MINUS	= 1<<5,
12803f6b084SSeth Forshee 	IEEE80211_CHAN_NO_OFDM		= 1<<6,
129c7a6ee27SJohannes Berg 	IEEE80211_CHAN_NO_80MHZ		= 1<<7,
130c7a6ee27SJohannes Berg 	IEEE80211_CHAN_NO_160MHZ	= 1<<8,
131570dbde1SDavid Spinadel 	IEEE80211_CHAN_INDOOR_ONLY	= 1<<9,
13206f207fcSArik Nemtsov 	IEEE80211_CHAN_IR_CONCURRENT	= 1<<10,
133ea077c1cSRostislav Lisovy 	IEEE80211_CHAN_NO_20MHZ		= 1<<11,
134ea077c1cSRostislav Lisovy 	IEEE80211_CHAN_NO_10MHZ		= 1<<12,
135d3236553SJohannes Berg };
136d3236553SJohannes Berg 
137038659e7SLuis R. Rodriguez #define IEEE80211_CHAN_NO_HT40 \
138689da1b3SLuis R. Rodriguez 	(IEEE80211_CHAN_NO_HT40PLUS | IEEE80211_CHAN_NO_HT40MINUS)
139038659e7SLuis R. Rodriguez 
14004f39047SSimon Wunderlich #define IEEE80211_DFS_MIN_CAC_TIME_MS		60000
14104f39047SSimon Wunderlich #define IEEE80211_DFS_MIN_NOP_TIME_MS		(30 * 60 * 1000)
14204f39047SSimon Wunderlich 
143d3236553SJohannes Berg /**
144d3236553SJohannes Berg  * struct ieee80211_channel - channel definition
145d3236553SJohannes Berg  *
146d3236553SJohannes Berg  * This structure describes a single channel for use
147d3236553SJohannes Berg  * with cfg80211.
148d3236553SJohannes Berg  *
149d3236553SJohannes Berg  * @center_freq: center frequency in MHz
150d3236553SJohannes Berg  * @hw_value: hardware-specific value for the channel
151d3236553SJohannes Berg  * @flags: channel flags from &enum ieee80211_channel_flags.
152d3236553SJohannes Berg  * @orig_flags: channel flags at registration time, used by regulatory
153d3236553SJohannes Berg  *	code to support devices with additional restrictions
154d3236553SJohannes Berg  * @band: band this channel belongs to.
155d3236553SJohannes Berg  * @max_antenna_gain: maximum antenna gain in dBi
156d3236553SJohannes Berg  * @max_power: maximum transmission power (in dBm)
157eccc068eSHong Wu  * @max_reg_power: maximum regulatory transmission power (in dBm)
158d3236553SJohannes Berg  * @beacon_found: helper to regulatory code to indicate when a beacon
159d3236553SJohannes Berg  *	has been found on this channel. Use regulatory_hint_found_beacon()
16077c2061dSWalter Goldens  *	to enable this, this is useful only on 5 GHz band.
161d3236553SJohannes Berg  * @orig_mag: internal use
162d3236553SJohannes Berg  * @orig_mpwr: internal use
16304f39047SSimon Wunderlich  * @dfs_state: current state of this channel. Only relevant if radar is required
16404f39047SSimon Wunderlich  *	on this channel.
16504f39047SSimon Wunderlich  * @dfs_state_entered: timestamp (jiffies) when the dfs state was entered.
166089027e5SJanusz Dziedzic  * @dfs_cac_ms: DFS CAC time in milliseconds, this is valid for DFS channels.
167d3236553SJohannes Berg  */
168d3236553SJohannes Berg struct ieee80211_channel {
169d3236553SJohannes Berg 	enum ieee80211_band band;
170d3236553SJohannes Berg 	u16 center_freq;
171d3236553SJohannes Berg 	u16 hw_value;
172d3236553SJohannes Berg 	u32 flags;
173d3236553SJohannes Berg 	int max_antenna_gain;
174d3236553SJohannes Berg 	int max_power;
175eccc068eSHong Wu 	int max_reg_power;
176d3236553SJohannes Berg 	bool beacon_found;
177d3236553SJohannes Berg 	u32 orig_flags;
178d3236553SJohannes Berg 	int orig_mag, orig_mpwr;
17904f39047SSimon Wunderlich 	enum nl80211_dfs_state dfs_state;
18004f39047SSimon Wunderlich 	unsigned long dfs_state_entered;
181089027e5SJanusz Dziedzic 	unsigned int dfs_cac_ms;
182d3236553SJohannes Berg };
183d3236553SJohannes Berg 
184d3236553SJohannes Berg /**
185d3236553SJohannes Berg  * enum ieee80211_rate_flags - rate flags
186d3236553SJohannes Berg  *
187d3236553SJohannes Berg  * Hardware/specification flags for rates. These are structured
188d3236553SJohannes Berg  * in a way that allows using the same bitrate structure for
189d3236553SJohannes Berg  * different bands/PHY modes.
190d3236553SJohannes Berg  *
191d3236553SJohannes Berg  * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short
192d3236553SJohannes Berg  *	preamble on this bitrate; only relevant in 2.4GHz band and
193d3236553SJohannes Berg  *	with CCK rates.
194d3236553SJohannes Berg  * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate
195d3236553SJohannes Berg  *	when used with 802.11a (on the 5 GHz band); filled by the
196d3236553SJohannes Berg  *	core code when registering the wiphy.
197d3236553SJohannes Berg  * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate
198d3236553SJohannes Berg  *	when used with 802.11b (on the 2.4 GHz band); filled by the
199d3236553SJohannes Berg  *	core code when registering the wiphy.
200d3236553SJohannes Berg  * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate
201d3236553SJohannes Berg  *	when used with 802.11g (on the 2.4 GHz band); filled by the
202d3236553SJohannes Berg  *	core code when registering the wiphy.
203d3236553SJohannes Berg  * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode.
20430e74732SSimon Wunderlich  * @IEEE80211_RATE_SUPPORTS_5MHZ: Rate can be used in 5 MHz mode
20530e74732SSimon Wunderlich  * @IEEE80211_RATE_SUPPORTS_10MHZ: Rate can be used in 10 MHz mode
206d3236553SJohannes Berg  */
207d3236553SJohannes Berg enum ieee80211_rate_flags {
208d3236553SJohannes Berg 	IEEE80211_RATE_SHORT_PREAMBLE	= 1<<0,
209d3236553SJohannes Berg 	IEEE80211_RATE_MANDATORY_A	= 1<<1,
210d3236553SJohannes Berg 	IEEE80211_RATE_MANDATORY_B	= 1<<2,
211d3236553SJohannes Berg 	IEEE80211_RATE_MANDATORY_G	= 1<<3,
212d3236553SJohannes Berg 	IEEE80211_RATE_ERP_G		= 1<<4,
21330e74732SSimon Wunderlich 	IEEE80211_RATE_SUPPORTS_5MHZ	= 1<<5,
21430e74732SSimon Wunderlich 	IEEE80211_RATE_SUPPORTS_10MHZ	= 1<<6,
215d3236553SJohannes Berg };
216d3236553SJohannes Berg 
217d3236553SJohannes Berg /**
2186eb18137SDedy Lansky  * enum ieee80211_bss_type - BSS type filter
2196eb18137SDedy Lansky  *
2206eb18137SDedy Lansky  * @IEEE80211_BSS_TYPE_ESS: Infrastructure BSS
2216eb18137SDedy Lansky  * @IEEE80211_BSS_TYPE_PBSS: Personal BSS
2226eb18137SDedy Lansky  * @IEEE80211_BSS_TYPE_IBSS: Independent BSS
2236eb18137SDedy Lansky  * @IEEE80211_BSS_TYPE_MBSS: Mesh BSS
2246eb18137SDedy Lansky  * @IEEE80211_BSS_TYPE_ANY: Wildcard value for matching any BSS type
2256eb18137SDedy Lansky  */
2266eb18137SDedy Lansky enum ieee80211_bss_type {
2276eb18137SDedy Lansky 	IEEE80211_BSS_TYPE_ESS,
2286eb18137SDedy Lansky 	IEEE80211_BSS_TYPE_PBSS,
2296eb18137SDedy Lansky 	IEEE80211_BSS_TYPE_IBSS,
2306eb18137SDedy Lansky 	IEEE80211_BSS_TYPE_MBSS,
2316eb18137SDedy Lansky 	IEEE80211_BSS_TYPE_ANY
2326eb18137SDedy Lansky };
2336eb18137SDedy Lansky 
2346eb18137SDedy Lansky /**
2356eb18137SDedy Lansky  * enum ieee80211_privacy - BSS privacy filter
2366eb18137SDedy Lansky  *
2376eb18137SDedy Lansky  * @IEEE80211_PRIVACY_ON: privacy bit set
2386eb18137SDedy Lansky  * @IEEE80211_PRIVACY_OFF: privacy bit clear
2396eb18137SDedy Lansky  * @IEEE80211_PRIVACY_ANY: Wildcard value for matching any privacy setting
2406eb18137SDedy Lansky  */
2416eb18137SDedy Lansky enum ieee80211_privacy {
2426eb18137SDedy Lansky 	IEEE80211_PRIVACY_ON,
2436eb18137SDedy Lansky 	IEEE80211_PRIVACY_OFF,
2446eb18137SDedy Lansky 	IEEE80211_PRIVACY_ANY
2456eb18137SDedy Lansky };
2466eb18137SDedy Lansky 
2476eb18137SDedy Lansky #define IEEE80211_PRIVACY(x)	\
2486eb18137SDedy Lansky 	((x) ? IEEE80211_PRIVACY_ON : IEEE80211_PRIVACY_OFF)
2496eb18137SDedy Lansky 
2506eb18137SDedy Lansky /**
251d3236553SJohannes Berg  * struct ieee80211_rate - bitrate definition
252d3236553SJohannes Berg  *
253d3236553SJohannes Berg  * This structure describes a bitrate that an 802.11 PHY can
254d3236553SJohannes Berg  * operate with. The two values @hw_value and @hw_value_short
255d3236553SJohannes Berg  * are only for driver use when pointers to this structure are
256d3236553SJohannes Berg  * passed around.
257d3236553SJohannes Berg  *
258d3236553SJohannes Berg  * @flags: rate-specific flags
259d3236553SJohannes Berg  * @bitrate: bitrate in units of 100 Kbps
260d3236553SJohannes Berg  * @hw_value: driver/hardware value for this rate
261d3236553SJohannes Berg  * @hw_value_short: driver/hardware value for this rate when
262d3236553SJohannes Berg  *	short preamble is used
263d3236553SJohannes Berg  */
264d3236553SJohannes Berg struct ieee80211_rate {
265d3236553SJohannes Berg 	u32 flags;
266d3236553SJohannes Berg 	u16 bitrate;
267d3236553SJohannes Berg 	u16 hw_value, hw_value_short;
268d3236553SJohannes Berg };
269d3236553SJohannes Berg 
270d3236553SJohannes Berg /**
271d3236553SJohannes Berg  * struct ieee80211_sta_ht_cap - STA's HT capabilities
272d3236553SJohannes Berg  *
273d3236553SJohannes Berg  * This structure describes most essential parameters needed
274d3236553SJohannes Berg  * to describe 802.11n HT capabilities for an STA.
275d3236553SJohannes Berg  *
276d3236553SJohannes Berg  * @ht_supported: is HT supported by the STA
277d3236553SJohannes Berg  * @cap: HT capabilities map as described in 802.11n spec
278d3236553SJohannes Berg  * @ampdu_factor: Maximum A-MPDU length factor
279d3236553SJohannes Berg  * @ampdu_density: Minimum A-MPDU spacing
280d3236553SJohannes Berg  * @mcs: Supported MCS rates
281d3236553SJohannes Berg  */
282d3236553SJohannes Berg struct ieee80211_sta_ht_cap {
283d3236553SJohannes Berg 	u16 cap; /* use IEEE80211_HT_CAP_ */
284d3236553SJohannes Berg 	bool ht_supported;
285d3236553SJohannes Berg 	u8 ampdu_factor;
286d3236553SJohannes Berg 	u8 ampdu_density;
287d3236553SJohannes Berg 	struct ieee80211_mcs_info mcs;
288d3236553SJohannes Berg };
289d3236553SJohannes Berg 
290d3236553SJohannes Berg /**
291bf0c111eSMahesh Palivela  * struct ieee80211_sta_vht_cap - STA's VHT capabilities
292bf0c111eSMahesh Palivela  *
293bf0c111eSMahesh Palivela  * This structure describes most essential parameters needed
294bf0c111eSMahesh Palivela  * to describe 802.11ac VHT capabilities for an STA.
295bf0c111eSMahesh Palivela  *
296bf0c111eSMahesh Palivela  * @vht_supported: is VHT supported by the STA
297bf0c111eSMahesh Palivela  * @cap: VHT capabilities map as described in 802.11ac spec
298bf0c111eSMahesh Palivela  * @vht_mcs: Supported VHT MCS rates
299bf0c111eSMahesh Palivela  */
300bf0c111eSMahesh Palivela struct ieee80211_sta_vht_cap {
301bf0c111eSMahesh Palivela 	bool vht_supported;
302bf0c111eSMahesh Palivela 	u32 cap; /* use IEEE80211_VHT_CAP_ */
303bf0c111eSMahesh Palivela 	struct ieee80211_vht_mcs_info vht_mcs;
304bf0c111eSMahesh Palivela };
305bf0c111eSMahesh Palivela 
306bf0c111eSMahesh Palivela /**
307d3236553SJohannes Berg  * struct ieee80211_supported_band - frequency band definition
308d3236553SJohannes Berg  *
309d3236553SJohannes Berg  * This structure describes a frequency band a wiphy
310d3236553SJohannes Berg  * is able to operate in.
311d3236553SJohannes Berg  *
312d3236553SJohannes Berg  * @channels: Array of channels the hardware can operate in
313d3236553SJohannes Berg  *	in this band.
314d3236553SJohannes Berg  * @band: the band this structure represents
315d3236553SJohannes Berg  * @n_channels: Number of channels in @channels
316d3236553SJohannes Berg  * @bitrates: Array of bitrates the hardware can operate with
317d3236553SJohannes Berg  *	in this band. Must be sorted to give a valid "supported
318d3236553SJohannes Berg  *	rates" IE, i.e. CCK rates first, then OFDM.
319d3236553SJohannes Berg  * @n_bitrates: Number of bitrates in @bitrates
320abe37c4bSJohannes Berg  * @ht_cap: HT capabilities in this band
321c9a0a302SRobert P. J. Day  * @vht_cap: VHT capabilities in this band
322d3236553SJohannes Berg  */
323d3236553SJohannes Berg struct ieee80211_supported_band {
324d3236553SJohannes Berg 	struct ieee80211_channel *channels;
325d3236553SJohannes Berg 	struct ieee80211_rate *bitrates;
326d3236553SJohannes Berg 	enum ieee80211_band band;
327d3236553SJohannes Berg 	int n_channels;
328d3236553SJohannes Berg 	int n_bitrates;
329d3236553SJohannes Berg 	struct ieee80211_sta_ht_cap ht_cap;
330bf0c111eSMahesh Palivela 	struct ieee80211_sta_vht_cap vht_cap;
331d3236553SJohannes Berg };
332d3236553SJohannes Berg 
333d3236553SJohannes Berg /*
334d3236553SJohannes Berg  * Wireless hardware/device configuration structures and methods
335704232c2SJohannes Berg  */
336704232c2SJohannes Berg 
3372ec600d6SLuis Carlos Cobo /**
338d70e9693SJohannes Berg  * DOC: Actions and configuration
339d70e9693SJohannes Berg  *
340d70e9693SJohannes Berg  * Each wireless device and each virtual interface offer a set of configuration
341d70e9693SJohannes Berg  * operations and other actions that are invoked by userspace. Each of these
342d70e9693SJohannes Berg  * actions is described in the operations structure, and the parameters these
343d70e9693SJohannes Berg  * operations use are described separately.
344d70e9693SJohannes Berg  *
345d70e9693SJohannes Berg  * Additionally, some operations are asynchronous and expect to get status
346d70e9693SJohannes Berg  * information via some functions that drivers need to call.
347d70e9693SJohannes Berg  *
348d70e9693SJohannes Berg  * Scanning and BSS list handling with its associated functionality is described
349d70e9693SJohannes Berg  * in a separate chapter.
350d70e9693SJohannes Berg  */
351d70e9693SJohannes Berg 
352d70e9693SJohannes Berg /**
3532ec600d6SLuis Carlos Cobo  * struct vif_params - describes virtual interface parameters
3548b787643SFelix Fietkau  * @use_4addr: use 4-address frames
355e8f479b1SBen Greear  * @macaddr: address to use for this virtual interface.
356e8f479b1SBen Greear  *	If this parameter is set to zero address the driver may
357e8f479b1SBen Greear  *	determine the address as needed.
358e8f479b1SBen Greear  *	This feature is only fully supported by drivers that enable the
359e8f479b1SBen Greear  *	%NL80211_FEATURE_MAC_ON_CREATE flag.  Others may support creating
360e8f479b1SBen Greear  **	only p2p devices with specified MAC.
3612ec600d6SLuis Carlos Cobo  */
3622ec600d6SLuis Carlos Cobo struct vif_params {
3638b787643SFelix Fietkau        int use_4addr;
3641c18f145SArend van Spriel        u8 macaddr[ETH_ALEN];
3652ec600d6SLuis Carlos Cobo };
3662ec600d6SLuis Carlos Cobo 
36741ade00fSJohannes Berg /**
36841ade00fSJohannes Berg  * struct key_params - key information
36941ade00fSJohannes Berg  *
37041ade00fSJohannes Berg  * Information about a key
37141ade00fSJohannes Berg  *
37241ade00fSJohannes Berg  * @key: key material
37341ade00fSJohannes Berg  * @key_len: length of key material
37441ade00fSJohannes Berg  * @cipher: cipher suite selector
37541ade00fSJohannes Berg  * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used
37641ade00fSJohannes Berg  *	with the get_key() callback, must be in little endian,
37741ade00fSJohannes Berg  *	length given by @seq_len.
378abe37c4bSJohannes Berg  * @seq_len: length of @seq.
37941ade00fSJohannes Berg  */
38041ade00fSJohannes Berg struct key_params {
381c1e5f471SJohannes Berg 	const u8 *key;
382c1e5f471SJohannes Berg 	const u8 *seq;
38341ade00fSJohannes Berg 	int key_len;
38441ade00fSJohannes Berg 	int seq_len;
38541ade00fSJohannes Berg 	u32 cipher;
38641ade00fSJohannes Berg };
38741ade00fSJohannes Berg 
388ed1b6cc7SJohannes Berg /**
389683b6d3bSJohannes Berg  * struct cfg80211_chan_def - channel definition
390683b6d3bSJohannes Berg  * @chan: the (control) channel
3913d9d1d66SJohannes Berg  * @width: channel width
3923d9d1d66SJohannes Berg  * @center_freq1: center frequency of first segment
3933d9d1d66SJohannes Berg  * @center_freq2: center frequency of second segment
3943d9d1d66SJohannes Berg  *	(only with 80+80 MHz)
395683b6d3bSJohannes Berg  */
396683b6d3bSJohannes Berg struct cfg80211_chan_def {
397683b6d3bSJohannes Berg 	struct ieee80211_channel *chan;
3983d9d1d66SJohannes Berg 	enum nl80211_chan_width width;
3993d9d1d66SJohannes Berg 	u32 center_freq1;
4003d9d1d66SJohannes Berg 	u32 center_freq2;
401683b6d3bSJohannes Berg };
402683b6d3bSJohannes Berg 
4033d9d1d66SJohannes Berg /**
4043d9d1d66SJohannes Berg  * cfg80211_get_chandef_type - return old channel type from chandef
4053d9d1d66SJohannes Berg  * @chandef: the channel definition
4063d9d1d66SJohannes Berg  *
4070ae997dcSYacine Belkadi  * Return: The old channel type (NOHT, HT20, HT40+/-) from a given
4083d9d1d66SJohannes Berg  * chandef, which must have a bandwidth allowing this conversion.
4093d9d1d66SJohannes Berg  */
410683b6d3bSJohannes Berg static inline enum nl80211_channel_type
411683b6d3bSJohannes Berg cfg80211_get_chandef_type(const struct cfg80211_chan_def *chandef)
412683b6d3bSJohannes Berg {
4133d9d1d66SJohannes Berg 	switch (chandef->width) {
4143d9d1d66SJohannes Berg 	case NL80211_CHAN_WIDTH_20_NOHT:
4153d9d1d66SJohannes Berg 		return NL80211_CHAN_NO_HT;
4163d9d1d66SJohannes Berg 	case NL80211_CHAN_WIDTH_20:
4173d9d1d66SJohannes Berg 		return NL80211_CHAN_HT20;
4183d9d1d66SJohannes Berg 	case NL80211_CHAN_WIDTH_40:
4193d9d1d66SJohannes Berg 		if (chandef->center_freq1 > chandef->chan->center_freq)
4203d9d1d66SJohannes Berg 			return NL80211_CHAN_HT40PLUS;
4213d9d1d66SJohannes Berg 		return NL80211_CHAN_HT40MINUS;
4223d9d1d66SJohannes Berg 	default:
4233d9d1d66SJohannes Berg 		WARN_ON(1);
4243d9d1d66SJohannes Berg 		return NL80211_CHAN_NO_HT;
425683b6d3bSJohannes Berg 	}
4263d9d1d66SJohannes Berg }
4273d9d1d66SJohannes Berg 
4283d9d1d66SJohannes Berg /**
4293d9d1d66SJohannes Berg  * cfg80211_chandef_create - create channel definition using channel type
4303d9d1d66SJohannes Berg  * @chandef: the channel definition struct to fill
4313d9d1d66SJohannes Berg  * @channel: the control channel
4323d9d1d66SJohannes Berg  * @chantype: the channel type
4333d9d1d66SJohannes Berg  *
4343d9d1d66SJohannes Berg  * Given a channel type, create a channel definition.
4353d9d1d66SJohannes Berg  */
4363d9d1d66SJohannes Berg void cfg80211_chandef_create(struct cfg80211_chan_def *chandef,
4373d9d1d66SJohannes Berg 			     struct ieee80211_channel *channel,
4383d9d1d66SJohannes Berg 			     enum nl80211_channel_type chantype);
4393d9d1d66SJohannes Berg 
4403d9d1d66SJohannes Berg /**
4413d9d1d66SJohannes Berg  * cfg80211_chandef_identical - check if two channel definitions are identical
4423d9d1d66SJohannes Berg  * @chandef1: first channel definition
4433d9d1d66SJohannes Berg  * @chandef2: second channel definition
4443d9d1d66SJohannes Berg  *
4450ae997dcSYacine Belkadi  * Return: %true if the channels defined by the channel definitions are
4463d9d1d66SJohannes Berg  * identical, %false otherwise.
4473d9d1d66SJohannes Berg  */
4483d9d1d66SJohannes Berg static inline bool
4493d9d1d66SJohannes Berg cfg80211_chandef_identical(const struct cfg80211_chan_def *chandef1,
4503d9d1d66SJohannes Berg 			   const struct cfg80211_chan_def *chandef2)
4513d9d1d66SJohannes Berg {
4523d9d1d66SJohannes Berg 	return (chandef1->chan == chandef2->chan &&
4533d9d1d66SJohannes Berg 		chandef1->width == chandef2->width &&
4543d9d1d66SJohannes Berg 		chandef1->center_freq1 == chandef2->center_freq1 &&
4553d9d1d66SJohannes Berg 		chandef1->center_freq2 == chandef2->center_freq2);
4563d9d1d66SJohannes Berg }
4573d9d1d66SJohannes Berg 
4583d9d1d66SJohannes Berg /**
4593d9d1d66SJohannes Berg  * cfg80211_chandef_compatible - check if two channel definitions are compatible
4603d9d1d66SJohannes Berg  * @chandef1: first channel definition
4613d9d1d66SJohannes Berg  * @chandef2: second channel definition
4623d9d1d66SJohannes Berg  *
4630ae997dcSYacine Belkadi  * Return: %NULL if the given channel definitions are incompatible,
4643d9d1d66SJohannes Berg  * chandef1 or chandef2 otherwise.
4653d9d1d66SJohannes Berg  */
4663d9d1d66SJohannes Berg const struct cfg80211_chan_def *
4673d9d1d66SJohannes Berg cfg80211_chandef_compatible(const struct cfg80211_chan_def *chandef1,
4683d9d1d66SJohannes Berg 			    const struct cfg80211_chan_def *chandef2);
469683b6d3bSJohannes Berg 
470683b6d3bSJohannes Berg /**
4719f5e8f6eSJohannes Berg  * cfg80211_chandef_valid - check if a channel definition is valid
4729f5e8f6eSJohannes Berg  * @chandef: the channel definition to check
4730ae997dcSYacine Belkadi  * Return: %true if the channel definition is valid. %false otherwise.
4749f5e8f6eSJohannes Berg  */
4759f5e8f6eSJohannes Berg bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef);
4769f5e8f6eSJohannes Berg 
4779f5e8f6eSJohannes Berg /**
4789f5e8f6eSJohannes Berg  * cfg80211_chandef_usable - check if secondary channels can be used
4799f5e8f6eSJohannes Berg  * @wiphy: the wiphy to validate against
4809f5e8f6eSJohannes Berg  * @chandef: the channel definition to check
4810ae997dcSYacine Belkadi  * @prohibited_flags: the regulatory channel flags that must not be set
4820ae997dcSYacine Belkadi  * Return: %true if secondary channels are usable. %false otherwise.
4839f5e8f6eSJohannes Berg  */
4849f5e8f6eSJohannes Berg bool cfg80211_chandef_usable(struct wiphy *wiphy,
4859f5e8f6eSJohannes Berg 			     const struct cfg80211_chan_def *chandef,
4869f5e8f6eSJohannes Berg 			     u32 prohibited_flags);
4879f5e8f6eSJohannes Berg 
4889f5e8f6eSJohannes Berg /**
489774f0734SSimon Wunderlich  * cfg80211_chandef_dfs_required - checks if radar detection is required
490774f0734SSimon Wunderlich  * @wiphy: the wiphy to validate against
491774f0734SSimon Wunderlich  * @chandef: the channel definition to check
4922beb6dabSLuciano Coelho  * @iftype: the interface type as specified in &enum nl80211_iftype
4932beb6dabSLuciano Coelho  * Returns:
4942beb6dabSLuciano Coelho  *	1 if radar detection is required, 0 if it is not, < 0 on error
495774f0734SSimon Wunderlich  */
496774f0734SSimon Wunderlich int cfg80211_chandef_dfs_required(struct wiphy *wiphy,
4972beb6dabSLuciano Coelho 				  const struct cfg80211_chan_def *chandef,
498c3d62036SLuciano Coelho 				  enum nl80211_iftype iftype);
499774f0734SSimon Wunderlich 
500774f0734SSimon Wunderlich /**
50130e74732SSimon Wunderlich  * ieee80211_chandef_rate_flags - returns rate flags for a channel
50230e74732SSimon Wunderlich  *
50330e74732SSimon Wunderlich  * In some channel types, not all rates may be used - for example CCK
50430e74732SSimon Wunderlich  * rates may not be used in 5/10 MHz channels.
50530e74732SSimon Wunderlich  *
50630e74732SSimon Wunderlich  * @chandef: channel definition for the channel
50730e74732SSimon Wunderlich  *
50830e74732SSimon Wunderlich  * Returns: rate flags which apply for this channel
50930e74732SSimon Wunderlich  */
51030e74732SSimon Wunderlich static inline enum ieee80211_rate_flags
51130e74732SSimon Wunderlich ieee80211_chandef_rate_flags(struct cfg80211_chan_def *chandef)
51230e74732SSimon Wunderlich {
51330e74732SSimon Wunderlich 	switch (chandef->width) {
51430e74732SSimon Wunderlich 	case NL80211_CHAN_WIDTH_5:
51530e74732SSimon Wunderlich 		return IEEE80211_RATE_SUPPORTS_5MHZ;
51630e74732SSimon Wunderlich 	case NL80211_CHAN_WIDTH_10:
51730e74732SSimon Wunderlich 		return IEEE80211_RATE_SUPPORTS_10MHZ;
51830e74732SSimon Wunderlich 	default:
51930e74732SSimon Wunderlich 		break;
52030e74732SSimon Wunderlich 	}
52130e74732SSimon Wunderlich 	return 0;
52230e74732SSimon Wunderlich }
52330e74732SSimon Wunderlich 
52430e74732SSimon Wunderlich /**
5250430c883SSimon Wunderlich  * ieee80211_chandef_max_power - maximum transmission power for the chandef
5260430c883SSimon Wunderlich  *
5270430c883SSimon Wunderlich  * In some regulations, the transmit power may depend on the configured channel
5280430c883SSimon Wunderlich  * bandwidth which may be defined as dBm/MHz. This function returns the actual
5290430c883SSimon Wunderlich  * max_power for non-standard (20 MHz) channels.
5300430c883SSimon Wunderlich  *
5310430c883SSimon Wunderlich  * @chandef: channel definition for the channel
5320430c883SSimon Wunderlich  *
5330430c883SSimon Wunderlich  * Returns: maximum allowed transmission power in dBm for the chandef
5340430c883SSimon Wunderlich  */
5350430c883SSimon Wunderlich static inline int
5360430c883SSimon Wunderlich ieee80211_chandef_max_power(struct cfg80211_chan_def *chandef)
5370430c883SSimon Wunderlich {
5380430c883SSimon Wunderlich 	switch (chandef->width) {
5390430c883SSimon Wunderlich 	case NL80211_CHAN_WIDTH_5:
5400430c883SSimon Wunderlich 		return min(chandef->chan->max_reg_power - 6,
5410430c883SSimon Wunderlich 			   chandef->chan->max_power);
5420430c883SSimon Wunderlich 	case NL80211_CHAN_WIDTH_10:
5430430c883SSimon Wunderlich 		return min(chandef->chan->max_reg_power - 3,
5440430c883SSimon Wunderlich 			   chandef->chan->max_power);
5450430c883SSimon Wunderlich 	default:
5460430c883SSimon Wunderlich 		break;
5470430c883SSimon Wunderlich 	}
5480430c883SSimon Wunderlich 	return chandef->chan->max_power;
5490430c883SSimon Wunderlich }
5500430c883SSimon Wunderlich 
5510430c883SSimon Wunderlich /**
55261fa713cSHolger Schurig  * enum survey_info_flags - survey information flags
55361fa713cSHolger Schurig  *
554abe37c4bSJohannes Berg  * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in
55517e5a808SFelix Fietkau  * @SURVEY_INFO_IN_USE: channel is currently being used
5564ed20bebSJohannes Berg  * @SURVEY_INFO_TIME: active time (in ms) was filled in
5574ed20bebSJohannes Berg  * @SURVEY_INFO_TIME_BUSY: busy time was filled in
5584ed20bebSJohannes Berg  * @SURVEY_INFO_TIME_EXT_BUSY: extension channel busy time was filled in
5594ed20bebSJohannes Berg  * @SURVEY_INFO_TIME_RX: receive time was filled in
5604ed20bebSJohannes Berg  * @SURVEY_INFO_TIME_TX: transmit time was filled in
561052536abSJohannes Berg  * @SURVEY_INFO_TIME_SCAN: scan time was filled in
562abe37c4bSJohannes Berg  *
56361fa713cSHolger Schurig  * Used by the driver to indicate which info in &struct survey_info
56461fa713cSHolger Schurig  * it has filled in during the get_survey().
56561fa713cSHolger Schurig  */
56661fa713cSHolger Schurig enum survey_info_flags {
5674ed20bebSJohannes Berg 	SURVEY_INFO_NOISE_DBM		= BIT(0),
5684ed20bebSJohannes Berg 	SURVEY_INFO_IN_USE		= BIT(1),
5694ed20bebSJohannes Berg 	SURVEY_INFO_TIME		= BIT(2),
5704ed20bebSJohannes Berg 	SURVEY_INFO_TIME_BUSY		= BIT(3),
5714ed20bebSJohannes Berg 	SURVEY_INFO_TIME_EXT_BUSY	= BIT(4),
5724ed20bebSJohannes Berg 	SURVEY_INFO_TIME_RX		= BIT(5),
5734ed20bebSJohannes Berg 	SURVEY_INFO_TIME_TX		= BIT(6),
574052536abSJohannes Berg 	SURVEY_INFO_TIME_SCAN		= BIT(7),
57561fa713cSHolger Schurig };
57661fa713cSHolger Schurig 
57761fa713cSHolger Schurig /**
57861fa713cSHolger Schurig  * struct survey_info - channel survey response
57961fa713cSHolger Schurig  *
58011f78ac3SJohannes Berg  * @channel: the channel this survey record reports, may be %NULL for a single
58111f78ac3SJohannes Berg  *	record to report global statistics
58261fa713cSHolger Schurig  * @filled: bitflag of flags from &enum survey_info_flags
58361fa713cSHolger Schurig  * @noise: channel noise in dBm. This and all following fields are
58461fa713cSHolger Schurig  *	optional
5854ed20bebSJohannes Berg  * @time: amount of time in ms the radio was turn on (on the channel)
5864ed20bebSJohannes Berg  * @time_busy: amount of time the primary channel was sensed busy
5874ed20bebSJohannes Berg  * @time_ext_busy: amount of time the extension channel was sensed busy
5884ed20bebSJohannes Berg  * @time_rx: amount of time the radio spent receiving data
5894ed20bebSJohannes Berg  * @time_tx: amount of time the radio spent transmitting data
590052536abSJohannes Berg  * @time_scan: amount of time the radio spent for scanning
59161fa713cSHolger Schurig  *
592abe37c4bSJohannes Berg  * Used by dump_survey() to report back per-channel survey information.
593abe37c4bSJohannes Berg  *
59461fa713cSHolger Schurig  * This structure can later be expanded with things like
59561fa713cSHolger Schurig  * channel duty cycle etc.
59661fa713cSHolger Schurig  */
59761fa713cSHolger Schurig struct survey_info {
59861fa713cSHolger Schurig 	struct ieee80211_channel *channel;
5994ed20bebSJohannes Berg 	u64 time;
6004ed20bebSJohannes Berg 	u64 time_busy;
6014ed20bebSJohannes Berg 	u64 time_ext_busy;
6024ed20bebSJohannes Berg 	u64 time_rx;
6034ed20bebSJohannes Berg 	u64 time_tx;
604052536abSJohannes Berg 	u64 time_scan;
60561fa713cSHolger Schurig 	u32 filled;
60661fa713cSHolger Schurig 	s8 noise;
60761fa713cSHolger Schurig };
60861fa713cSHolger Schurig 
60961fa713cSHolger Schurig /**
6105fb628e9SJouni Malinen  * struct cfg80211_crypto_settings - Crypto settings
6115fb628e9SJouni Malinen  * @wpa_versions: indicates which, if any, WPA versions are enabled
6125fb628e9SJouni Malinen  *	(from enum nl80211_wpa_versions)
6135fb628e9SJouni Malinen  * @cipher_group: group key cipher suite (or 0 if unset)
6145fb628e9SJouni Malinen  * @n_ciphers_pairwise: number of AP supported unicast ciphers
6155fb628e9SJouni Malinen  * @ciphers_pairwise: unicast key cipher suites
6165fb628e9SJouni Malinen  * @n_akm_suites: number of AKM suites
6175fb628e9SJouni Malinen  * @akm_suites: AKM suites
6185fb628e9SJouni Malinen  * @control_port: Whether user space controls IEEE 802.1X port, i.e.,
6195fb628e9SJouni Malinen  *	sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
6205fb628e9SJouni Malinen  *	required to assume that the port is unauthorized until authorized by
6215fb628e9SJouni Malinen  *	user space. Otherwise, port is marked authorized by default.
6225fb628e9SJouni Malinen  * @control_port_ethertype: the control port protocol that should be
6235fb628e9SJouni Malinen  *	allowed through even on unauthorized ports
6245fb628e9SJouni Malinen  * @control_port_no_encrypt: TRUE to prevent encryption of control port
6255fb628e9SJouni Malinen  *	protocol frames.
6265fb628e9SJouni Malinen  */
6275fb628e9SJouni Malinen struct cfg80211_crypto_settings {
6285fb628e9SJouni Malinen 	u32 wpa_versions;
6295fb628e9SJouni Malinen 	u32 cipher_group;
6305fb628e9SJouni Malinen 	int n_ciphers_pairwise;
6315fb628e9SJouni Malinen 	u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES];
6325fb628e9SJouni Malinen 	int n_akm_suites;
6335fb628e9SJouni Malinen 	u32 akm_suites[NL80211_MAX_NR_AKM_SUITES];
6345fb628e9SJouni Malinen 	bool control_port;
6355fb628e9SJouni Malinen 	__be16 control_port_ethertype;
6365fb628e9SJouni Malinen 	bool control_port_no_encrypt;
6375fb628e9SJouni Malinen };
6385fb628e9SJouni Malinen 
6395fb628e9SJouni Malinen /**
6408860020eSJohannes Berg  * struct cfg80211_beacon_data - beacon data
641ed1b6cc7SJohannes Berg  * @head: head portion of beacon (before TIM IE)
642ed1b6cc7SJohannes Berg  *	or %NULL if not changed
643ed1b6cc7SJohannes Berg  * @tail: tail portion of beacon (after TIM IE)
644ed1b6cc7SJohannes Berg  *	or %NULL if not changed
645ed1b6cc7SJohannes Berg  * @head_len: length of @head
646ed1b6cc7SJohannes Berg  * @tail_len: length of @tail
6479946ecfbSJouni Malinen  * @beacon_ies: extra information element(s) to add into Beacon frames or %NULL
6489946ecfbSJouni Malinen  * @beacon_ies_len: length of beacon_ies in octets
6499946ecfbSJouni Malinen  * @proberesp_ies: extra information element(s) to add into Probe Response
6509946ecfbSJouni Malinen  *	frames or %NULL
6519946ecfbSJouni Malinen  * @proberesp_ies_len: length of proberesp_ies in octets
6529946ecfbSJouni Malinen  * @assocresp_ies: extra information element(s) to add into (Re)Association
6539946ecfbSJouni Malinen  *	Response frames or %NULL
6549946ecfbSJouni Malinen  * @assocresp_ies_len: length of assocresp_ies in octets
65500f740e1SArik Nemtsov  * @probe_resp_len: length of probe response template (@probe_resp)
65600f740e1SArik Nemtsov  * @probe_resp: probe response template (AP mode only)
657ed1b6cc7SJohannes Berg  */
6588860020eSJohannes Berg struct cfg80211_beacon_data {
6598860020eSJohannes Berg 	const u8 *head, *tail;
6608860020eSJohannes Berg 	const u8 *beacon_ies;
6618860020eSJohannes Berg 	const u8 *proberesp_ies;
6628860020eSJohannes Berg 	const u8 *assocresp_ies;
6638860020eSJohannes Berg 	const u8 *probe_resp;
6648860020eSJohannes Berg 
6658860020eSJohannes Berg 	size_t head_len, tail_len;
6668860020eSJohannes Berg 	size_t beacon_ies_len;
6678860020eSJohannes Berg 	size_t proberesp_ies_len;
6688860020eSJohannes Berg 	size_t assocresp_ies_len;
6698860020eSJohannes Berg 	size_t probe_resp_len;
6708860020eSJohannes Berg };
6718860020eSJohannes Berg 
6726d45a74bSVasanthakumar Thiagarajan struct mac_address {
6736d45a74bSVasanthakumar Thiagarajan 	u8 addr[ETH_ALEN];
6746d45a74bSVasanthakumar Thiagarajan };
6756d45a74bSVasanthakumar Thiagarajan 
6768860020eSJohannes Berg /**
67777765eafSVasanthakumar Thiagarajan  * struct cfg80211_acl_data - Access control list data
67877765eafSVasanthakumar Thiagarajan  *
67977765eafSVasanthakumar Thiagarajan  * @acl_policy: ACL policy to be applied on the station's
680077f897aSJohannes Berg  *	entry specified by mac_addr
68177765eafSVasanthakumar Thiagarajan  * @n_acl_entries: Number of MAC address entries passed
68277765eafSVasanthakumar Thiagarajan  * @mac_addrs: List of MAC addresses of stations to be used for ACL
68377765eafSVasanthakumar Thiagarajan  */
68477765eafSVasanthakumar Thiagarajan struct cfg80211_acl_data {
68577765eafSVasanthakumar Thiagarajan 	enum nl80211_acl_policy acl_policy;
68677765eafSVasanthakumar Thiagarajan 	int n_acl_entries;
68777765eafSVasanthakumar Thiagarajan 
68877765eafSVasanthakumar Thiagarajan 	/* Keep it last */
68977765eafSVasanthakumar Thiagarajan 	struct mac_address mac_addrs[];
69077765eafSVasanthakumar Thiagarajan };
69177765eafSVasanthakumar Thiagarajan 
6928860020eSJohannes Berg /**
6938860020eSJohannes Berg  * struct cfg80211_ap_settings - AP configuration
6948860020eSJohannes Berg  *
6958860020eSJohannes Berg  * Used to configure an AP interface.
6968860020eSJohannes Berg  *
697683b6d3bSJohannes Berg  * @chandef: defines the channel to use
6988860020eSJohannes Berg  * @beacon: beacon data
6998860020eSJohannes Berg  * @beacon_interval: beacon interval
7008860020eSJohannes Berg  * @dtim_period: DTIM period
7018860020eSJohannes Berg  * @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from
7028860020eSJohannes Berg  *	user space)
7038860020eSJohannes Berg  * @ssid_len: length of @ssid
7048860020eSJohannes Berg  * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames
7058860020eSJohannes Berg  * @crypto: crypto settings
7068860020eSJohannes Berg  * @privacy: the BSS uses privacy
7078860020eSJohannes Berg  * @auth_type: Authentication type (algorithm)
70818998c38SEliad Peller  * @smps_mode: SMPS mode
7091b658f11SVasanthakumar Thiagarajan  * @inactivity_timeout: time in seconds to determine station's inactivity.
71053cabad7SJohannes Berg  * @p2p_ctwindow: P2P CT Window
71153cabad7SJohannes Berg  * @p2p_opp_ps: P2P opportunistic PS
71277765eafSVasanthakumar Thiagarajan  * @acl: ACL configuration used by the drivers which has support for
71377765eafSVasanthakumar Thiagarajan  *	MAC address based access control
7148860020eSJohannes Berg  */
7158860020eSJohannes Berg struct cfg80211_ap_settings {
716683b6d3bSJohannes Berg 	struct cfg80211_chan_def chandef;
717aa430da4SJohannes Berg 
7188860020eSJohannes Berg 	struct cfg80211_beacon_data beacon;
7198860020eSJohannes Berg 
7208860020eSJohannes Berg 	int beacon_interval, dtim_period;
72132e9de84SJouni Malinen 	const u8 *ssid;
72232e9de84SJouni Malinen 	size_t ssid_len;
72332e9de84SJouni Malinen 	enum nl80211_hidden_ssid hidden_ssid;
7245fb628e9SJouni Malinen 	struct cfg80211_crypto_settings crypto;
7255fb628e9SJouni Malinen 	bool privacy;
7265fb628e9SJouni Malinen 	enum nl80211_auth_type auth_type;
72718998c38SEliad Peller 	enum nl80211_smps_mode smps_mode;
7281b658f11SVasanthakumar Thiagarajan 	int inactivity_timeout;
72953cabad7SJohannes Berg 	u8 p2p_ctwindow;
73053cabad7SJohannes Berg 	bool p2p_opp_ps;
73177765eafSVasanthakumar Thiagarajan 	const struct cfg80211_acl_data *acl;
732ed1b6cc7SJohannes Berg };
733ed1b6cc7SJohannes Berg 
7345727ef1bSJohannes Berg /**
73516ef1fe2SSimon Wunderlich  * struct cfg80211_csa_settings - channel switch settings
73616ef1fe2SSimon Wunderlich  *
73716ef1fe2SSimon Wunderlich  * Used for channel switch
73816ef1fe2SSimon Wunderlich  *
73916ef1fe2SSimon Wunderlich  * @chandef: defines the channel to use after the switch
74016ef1fe2SSimon Wunderlich  * @beacon_csa: beacon data while performing the switch
7419a774c78SAndrei Otcheretianski  * @counter_offsets_beacon: offsets of the counters within the beacon (tail)
7429a774c78SAndrei Otcheretianski  * @counter_offsets_presp: offsets of the counters within the probe response
7439a774c78SAndrei Otcheretianski  * @n_counter_offsets_beacon: number of csa counters the beacon (tail)
7449a774c78SAndrei Otcheretianski  * @n_counter_offsets_presp: number of csa counters in the probe response
74516ef1fe2SSimon Wunderlich  * @beacon_after: beacon data to be used on the new channel
74616ef1fe2SSimon Wunderlich  * @radar_required: whether radar detection is required on the new channel
74716ef1fe2SSimon Wunderlich  * @block_tx: whether transmissions should be blocked while changing
74816ef1fe2SSimon Wunderlich  * @count: number of beacons until switch
74916ef1fe2SSimon Wunderlich  */
75016ef1fe2SSimon Wunderlich struct cfg80211_csa_settings {
75116ef1fe2SSimon Wunderlich 	struct cfg80211_chan_def chandef;
75216ef1fe2SSimon Wunderlich 	struct cfg80211_beacon_data beacon_csa;
7539a774c78SAndrei Otcheretianski 	const u16 *counter_offsets_beacon;
7549a774c78SAndrei Otcheretianski 	const u16 *counter_offsets_presp;
7559a774c78SAndrei Otcheretianski 	unsigned int n_counter_offsets_beacon;
7569a774c78SAndrei Otcheretianski 	unsigned int n_counter_offsets_presp;
75716ef1fe2SSimon Wunderlich 	struct cfg80211_beacon_data beacon_after;
75816ef1fe2SSimon Wunderlich 	bool radar_required;
75916ef1fe2SSimon Wunderlich 	bool block_tx;
76016ef1fe2SSimon Wunderlich 	u8 count;
76116ef1fe2SSimon Wunderlich };
76216ef1fe2SSimon Wunderlich 
76316ef1fe2SSimon Wunderlich /**
7643b9ce80cSJohannes Berg  * enum station_parameters_apply_mask - station parameter values to apply
7653b9ce80cSJohannes Berg  * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp)
7669d62a986SJouni Malinen  * @STATION_PARAM_APPLY_CAPABILITY: apply new capability
767f8bacc21SJohannes Berg  * @STATION_PARAM_APPLY_PLINK_STATE: apply new plink state
7683b9ce80cSJohannes Berg  *
7693b9ce80cSJohannes Berg  * Not all station parameters have in-band "no change" signalling,
7703b9ce80cSJohannes Berg  * for those that don't these flags will are used.
7713b9ce80cSJohannes Berg  */
7723b9ce80cSJohannes Berg enum station_parameters_apply_mask {
7733b9ce80cSJohannes Berg 	STATION_PARAM_APPLY_UAPSD = BIT(0),
7749d62a986SJouni Malinen 	STATION_PARAM_APPLY_CAPABILITY = BIT(1),
775f8bacc21SJohannes Berg 	STATION_PARAM_APPLY_PLINK_STATE = BIT(2),
7763b9ce80cSJohannes Berg };
7773b9ce80cSJohannes Berg 
7783b9ce80cSJohannes Berg /**
7795727ef1bSJohannes Berg  * struct station_parameters - station parameters
7805727ef1bSJohannes Berg  *
7815727ef1bSJohannes Berg  * Used to change and create a new station.
7825727ef1bSJohannes Berg  *
7835727ef1bSJohannes Berg  * @vlan: vlan interface station should belong to
7845727ef1bSJohannes Berg  * @supported_rates: supported rates in IEEE 802.11 format
7855727ef1bSJohannes Berg  *	(or NULL for no change)
7865727ef1bSJohannes Berg  * @supported_rates_len: number of supported rates
787eccb8e8fSJohannes Berg  * @sta_flags_mask: station flags that changed
788eccb8e8fSJohannes Berg  *	(bitmask of BIT(NL80211_STA_FLAG_...))
789eccb8e8fSJohannes Berg  * @sta_flags_set: station flags values
790eccb8e8fSJohannes Berg  *	(bitmask of BIT(NL80211_STA_FLAG_...))
7915727ef1bSJohannes Berg  * @listen_interval: listen interval or -1 for no change
7925727ef1bSJohannes Berg  * @aid: AID or zero for no change
793abe37c4bSJohannes Berg  * @plink_action: plink action to take
7949c3990aaSJavier Cardona  * @plink_state: set the peer link state for a station
795abe37c4bSJohannes Berg  * @ht_capa: HT capabilities of station
796f461be3eSMahesh Palivela  * @vht_capa: VHT capabilities of station
797910868dbSEliad Peller  * @uapsd_queues: bitmap of queues configured for uapsd. same format
798910868dbSEliad Peller  *	as the AC bitmap in the QoS info field
799910868dbSEliad Peller  * @max_sp: max Service Period. same format as the MAX_SP in the
800910868dbSEliad Peller  *	QoS info field (but already shifted down)
801c26887d2SJohannes Berg  * @sta_modify_mask: bitmap indicating which parameters changed
802c26887d2SJohannes Berg  *	(for those that don't have a natural "no change" value),
803c26887d2SJohannes Berg  *	see &enum station_parameters_apply_mask
8043b1c5a53SMarco Porsch  * @local_pm: local link-specific mesh power save mode (no change when set
8053b1c5a53SMarco Porsch  *	to unknown)
8069d62a986SJouni Malinen  * @capability: station capability
8079d62a986SJouni Malinen  * @ext_capab: extended capabilities of the station
8089d62a986SJouni Malinen  * @ext_capab_len: number of extended capabilities
809c01fc9adSSunil Dutt  * @supported_channels: supported channels in IEEE 802.11 format
810c01fc9adSSunil Dutt  * @supported_channels_len: number of supported channels
811c01fc9adSSunil Dutt  * @supported_oper_classes: supported oper classes in IEEE 802.11 format
812c01fc9adSSunil Dutt  * @supported_oper_classes_len: number of supported operating classes
81360f4a7b1SMarek Kwaczynski  * @opmode_notif: operating mode field from Operating Mode Notification
81460f4a7b1SMarek Kwaczynski  * @opmode_notif_used: information if operating mode field is used
8155727ef1bSJohannes Berg  */
8165727ef1bSJohannes Berg struct station_parameters {
8172c1aabf3SJohannes Berg 	const u8 *supported_rates;
8185727ef1bSJohannes Berg 	struct net_device *vlan;
819eccb8e8fSJohannes Berg 	u32 sta_flags_mask, sta_flags_set;
8203b9ce80cSJohannes Berg 	u32 sta_modify_mask;
8215727ef1bSJohannes Berg 	int listen_interval;
8225727ef1bSJohannes Berg 	u16 aid;
8235727ef1bSJohannes Berg 	u8 supported_rates_len;
8242ec600d6SLuis Carlos Cobo 	u8 plink_action;
8259c3990aaSJavier Cardona 	u8 plink_state;
8262c1aabf3SJohannes Berg 	const struct ieee80211_ht_cap *ht_capa;
8272c1aabf3SJohannes Berg 	const struct ieee80211_vht_cap *vht_capa;
828c75786c9SEliad Peller 	u8 uapsd_queues;
829c75786c9SEliad Peller 	u8 max_sp;
8303b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode local_pm;
8319d62a986SJouni Malinen 	u16 capability;
8322c1aabf3SJohannes Berg 	const u8 *ext_capab;
8339d62a986SJouni Malinen 	u8 ext_capab_len;
834c01fc9adSSunil Dutt 	const u8 *supported_channels;
835c01fc9adSSunil Dutt 	u8 supported_channels_len;
836c01fc9adSSunil Dutt 	const u8 *supported_oper_classes;
837c01fc9adSSunil Dutt 	u8 supported_oper_classes_len;
83860f4a7b1SMarek Kwaczynski 	u8 opmode_notif;
83960f4a7b1SMarek Kwaczynski 	bool opmode_notif_used;
8405727ef1bSJohannes Berg };
8415727ef1bSJohannes Berg 
842fd5b74dcSJohannes Berg /**
84389c771e5SJouni Malinen  * struct station_del_parameters - station deletion parameters
84489c771e5SJouni Malinen  *
84589c771e5SJouni Malinen  * Used to delete a station entry (or all stations).
84689c771e5SJouni Malinen  *
84789c771e5SJouni Malinen  * @mac: MAC address of the station to remove or NULL to remove all stations
84898856866SJouni Malinen  * @subtype: Management frame subtype to use for indicating removal
84998856866SJouni Malinen  *	(10 = Disassociation, 12 = Deauthentication)
85098856866SJouni Malinen  * @reason_code: Reason code for the Disassociation/Deauthentication frame
85189c771e5SJouni Malinen  */
85289c771e5SJouni Malinen struct station_del_parameters {
85389c771e5SJouni Malinen 	const u8 *mac;
85498856866SJouni Malinen 	u8 subtype;
85598856866SJouni Malinen 	u16 reason_code;
85689c771e5SJouni Malinen };
85789c771e5SJouni Malinen 
85889c771e5SJouni Malinen /**
85977ee7c89SJohannes Berg  * enum cfg80211_station_type - the type of station being modified
86077ee7c89SJohannes Berg  * @CFG80211_STA_AP_CLIENT: client of an AP interface
861*47edb11bSAyala Beker  * @CFG80211_STA_AP_CLIENT_UNASSOC: client of an AP interface that is still
862*47edb11bSAyala Beker  *	unassociated (update properties for this type of client is permitted)
86377ee7c89SJohannes Berg  * @CFG80211_STA_AP_MLME_CLIENT: client of an AP interface that has
86477ee7c89SJohannes Berg  *	the AP MLME in the device
86577ee7c89SJohannes Berg  * @CFG80211_STA_AP_STA: AP station on managed interface
86677ee7c89SJohannes Berg  * @CFG80211_STA_IBSS: IBSS station
86777ee7c89SJohannes Berg  * @CFG80211_STA_TDLS_PEER_SETUP: TDLS peer on managed interface (dummy entry
86877ee7c89SJohannes Berg  *	while TDLS setup is in progress, it moves out of this state when
86977ee7c89SJohannes Berg  *	being marked authorized; use this only if TDLS with external setup is
87077ee7c89SJohannes Berg  *	supported/used)
87177ee7c89SJohannes Berg  * @CFG80211_STA_TDLS_PEER_ACTIVE: TDLS peer on managed interface (active
87277ee7c89SJohannes Berg  *	entry that is operating, has been marked authorized by userspace)
873eef941e6SThomas Pedersen  * @CFG80211_STA_MESH_PEER_KERNEL: peer on mesh interface (kernel managed)
874eef941e6SThomas Pedersen  * @CFG80211_STA_MESH_PEER_USER: peer on mesh interface (user managed)
87577ee7c89SJohannes Berg  */
87677ee7c89SJohannes Berg enum cfg80211_station_type {
87777ee7c89SJohannes Berg 	CFG80211_STA_AP_CLIENT,
878*47edb11bSAyala Beker 	CFG80211_STA_AP_CLIENT_UNASSOC,
87977ee7c89SJohannes Berg 	CFG80211_STA_AP_MLME_CLIENT,
88077ee7c89SJohannes Berg 	CFG80211_STA_AP_STA,
88177ee7c89SJohannes Berg 	CFG80211_STA_IBSS,
88277ee7c89SJohannes Berg 	CFG80211_STA_TDLS_PEER_SETUP,
88377ee7c89SJohannes Berg 	CFG80211_STA_TDLS_PEER_ACTIVE,
884eef941e6SThomas Pedersen 	CFG80211_STA_MESH_PEER_KERNEL,
885eef941e6SThomas Pedersen 	CFG80211_STA_MESH_PEER_USER,
88677ee7c89SJohannes Berg };
88777ee7c89SJohannes Berg 
88877ee7c89SJohannes Berg /**
88977ee7c89SJohannes Berg  * cfg80211_check_station_change - validate parameter changes
89077ee7c89SJohannes Berg  * @wiphy: the wiphy this operates on
89177ee7c89SJohannes Berg  * @params: the new parameters for a station
89277ee7c89SJohannes Berg  * @statype: the type of station being modified
89377ee7c89SJohannes Berg  *
89477ee7c89SJohannes Berg  * Utility function for the @change_station driver method. Call this function
89577ee7c89SJohannes Berg  * with the appropriate station type looking up the station (and checking that
89677ee7c89SJohannes Berg  * it exists). It will verify whether the station change is acceptable, and if
89777ee7c89SJohannes Berg  * not will return an error code. Note that it may modify the parameters for
89877ee7c89SJohannes Berg  * backward compatibility reasons, so don't use them before calling this.
89977ee7c89SJohannes Berg  */
90077ee7c89SJohannes Berg int cfg80211_check_station_change(struct wiphy *wiphy,
90177ee7c89SJohannes Berg 				  struct station_parameters *params,
90277ee7c89SJohannes Berg 				  enum cfg80211_station_type statype);
90377ee7c89SJohannes Berg 
90477ee7c89SJohannes Berg /**
905420e7fabSHenning Rogge  * enum station_info_rate_flags - bitrate info flags
906420e7fabSHenning Rogge  *
907420e7fabSHenning Rogge  * Used by the driver to indicate the specific rate transmission
908420e7fabSHenning Rogge  * type for 802.11n transmissions.
909420e7fabSHenning Rogge  *
910db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_MCS: mcs field filled with HT MCS
911db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_VHT_MCS: mcs field filled with VHT MCS
912420e7fabSHenning Rogge  * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval
913db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_60G: 60GHz MCS
914420e7fabSHenning Rogge  */
915420e7fabSHenning Rogge enum rate_info_flags {
916db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_MCS			= BIT(0),
917db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_VHT_MCS			= BIT(1),
918b51f3beeSJohannes Berg 	RATE_INFO_FLAGS_SHORT_GI		= BIT(2),
919b51f3beeSJohannes Berg 	RATE_INFO_FLAGS_60G			= BIT(3),
920b51f3beeSJohannes Berg };
921b51f3beeSJohannes Berg 
922b51f3beeSJohannes Berg /**
923b51f3beeSJohannes Berg  * enum rate_info_bw - rate bandwidth information
924b51f3beeSJohannes Berg  *
925b51f3beeSJohannes Berg  * Used by the driver to indicate the rate bandwidth.
926b51f3beeSJohannes Berg  *
927b51f3beeSJohannes Berg  * @RATE_INFO_BW_5: 5 MHz bandwidth
928b51f3beeSJohannes Berg  * @RATE_INFO_BW_10: 10 MHz bandwidth
929b51f3beeSJohannes Berg  * @RATE_INFO_BW_20: 20 MHz bandwidth
930b51f3beeSJohannes Berg  * @RATE_INFO_BW_40: 40 MHz bandwidth
931b51f3beeSJohannes Berg  * @RATE_INFO_BW_80: 80 MHz bandwidth
932b51f3beeSJohannes Berg  * @RATE_INFO_BW_160: 160 MHz bandwidth
933b51f3beeSJohannes Berg  */
934b51f3beeSJohannes Berg enum rate_info_bw {
935b51f3beeSJohannes Berg 	RATE_INFO_BW_5,
936b51f3beeSJohannes Berg 	RATE_INFO_BW_10,
937b51f3beeSJohannes Berg 	RATE_INFO_BW_20,
938b51f3beeSJohannes Berg 	RATE_INFO_BW_40,
939b51f3beeSJohannes Berg 	RATE_INFO_BW_80,
940b51f3beeSJohannes Berg 	RATE_INFO_BW_160,
941420e7fabSHenning Rogge };
942420e7fabSHenning Rogge 
943420e7fabSHenning Rogge /**
944420e7fabSHenning Rogge  * struct rate_info - bitrate information
945420e7fabSHenning Rogge  *
946420e7fabSHenning Rogge  * Information about a receiving or transmitting bitrate
947420e7fabSHenning Rogge  *
948420e7fabSHenning Rogge  * @flags: bitflag of flags from &enum rate_info_flags
949420e7fabSHenning Rogge  * @mcs: mcs index if struct describes a 802.11n bitrate
950420e7fabSHenning Rogge  * @legacy: bitrate in 100kbit/s for 802.11abg
951db9c64cfSJohannes Berg  * @nss: number of streams (VHT only)
952b51f3beeSJohannes Berg  * @bw: bandwidth (from &enum rate_info_bw)
953420e7fabSHenning Rogge  */
954420e7fabSHenning Rogge struct rate_info {
955420e7fabSHenning Rogge 	u8 flags;
956420e7fabSHenning Rogge 	u8 mcs;
957420e7fabSHenning Rogge 	u16 legacy;
958db9c64cfSJohannes Berg 	u8 nss;
959b51f3beeSJohannes Berg 	u8 bw;
960fd5b74dcSJohannes Berg };
961fd5b74dcSJohannes Berg 
962fd5b74dcSJohannes Berg /**
963f4263c98SPaul Stewart  * enum station_info_rate_flags - bitrate info flags
964f4263c98SPaul Stewart  *
965f4263c98SPaul Stewart  * Used by the driver to indicate the specific rate transmission
966f4263c98SPaul Stewart  * type for 802.11n transmissions.
967f4263c98SPaul Stewart  *
968f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_CTS_PROT: whether CTS protection is enabled
969f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_SHORT_PREAMBLE: whether short preamble is enabled
970f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_SHORT_SLOT_TIME: whether short slot time is enabled
971f4263c98SPaul Stewart  */
972f4263c98SPaul Stewart enum bss_param_flags {
973f4263c98SPaul Stewart 	BSS_PARAM_FLAGS_CTS_PROT	= 1<<0,
974f4263c98SPaul Stewart 	BSS_PARAM_FLAGS_SHORT_PREAMBLE	= 1<<1,
975f4263c98SPaul Stewart 	BSS_PARAM_FLAGS_SHORT_SLOT_TIME	= 1<<2,
976f4263c98SPaul Stewart };
977f4263c98SPaul Stewart 
978f4263c98SPaul Stewart /**
979f4263c98SPaul Stewart  * struct sta_bss_parameters - BSS parameters for the attached station
980f4263c98SPaul Stewart  *
981f4263c98SPaul Stewart  * Information about the currently associated BSS
982f4263c98SPaul Stewart  *
983f4263c98SPaul Stewart  * @flags: bitflag of flags from &enum bss_param_flags
984f4263c98SPaul Stewart  * @dtim_period: DTIM period for the BSS
985f4263c98SPaul Stewart  * @beacon_interval: beacon interval
986f4263c98SPaul Stewart  */
987f4263c98SPaul Stewart struct sta_bss_parameters {
988f4263c98SPaul Stewart 	u8 flags;
989f4263c98SPaul Stewart 	u8 dtim_period;
990f4263c98SPaul Stewart 	u16 beacon_interval;
991f4263c98SPaul Stewart };
992f4263c98SPaul Stewart 
9936de39808SJohannes Berg /**
9946de39808SJohannes Berg  * struct cfg80211_tid_stats - per-TID statistics
9956de39808SJohannes Berg  * @filled: bitmap of flags using the bits of &enum nl80211_tid_stats to
9966de39808SJohannes Berg  *	indicate the relevant values in this struct are filled
9976de39808SJohannes Berg  * @rx_msdu: number of received MSDUs
9986de39808SJohannes Berg  * @tx_msdu: number of (attempted) transmitted MSDUs
9996de39808SJohannes Berg  * @tx_msdu_retries: number of retries (not counting the first) for
10006de39808SJohannes Berg  *	transmitted MSDUs
10016de39808SJohannes Berg  * @tx_msdu_failed: number of failed transmitted MSDUs
10026de39808SJohannes Berg  */
10036de39808SJohannes Berg struct cfg80211_tid_stats {
10046de39808SJohannes Berg 	u32 filled;
10056de39808SJohannes Berg 	u64 rx_msdu;
10066de39808SJohannes Berg 	u64 tx_msdu;
10076de39808SJohannes Berg 	u64 tx_msdu_retries;
10086de39808SJohannes Berg 	u64 tx_msdu_failed;
10096de39808SJohannes Berg };
10106de39808SJohannes Berg 
1011119363c7SFelix Fietkau #define IEEE80211_MAX_CHAINS	4
1012119363c7SFelix Fietkau 
1013f4263c98SPaul Stewart /**
10142ec600d6SLuis Carlos Cobo  * struct station_info - station information
1015fd5b74dcSJohannes Berg  *
10162ec600d6SLuis Carlos Cobo  * Station information filled by driver for get_station() and dump_station.
1017fd5b74dcSJohannes Berg  *
1018319090bfSJohannes Berg  * @filled: bitflag of flags using the bits of &enum nl80211_sta_info to
1019319090bfSJohannes Berg  *	indicate the relevant values in this struct for them
1020ebe27c91SMohammed Shafi Shajakhan  * @connected_time: time(in secs) since a station is last connected
1021fd5b74dcSJohannes Berg  * @inactive_time: time since last station activity (tx/rx) in milliseconds
10228d791361SJohannes Berg  * @rx_bytes: bytes (size of MPDUs) received from this station
10238d791361SJohannes Berg  * @tx_bytes: bytes (size of MPDUs) transmitted to this station
10242ec600d6SLuis Carlos Cobo  * @llid: mesh local link id
10252ec600d6SLuis Carlos Cobo  * @plid: mesh peer link id
10262ec600d6SLuis Carlos Cobo  * @plink_state: mesh peer link state
102773c3df3bSJohannes Berg  * @signal: The signal strength, type depends on the wiphy's signal_type.
102873c3df3bSJohannes Berg  *	For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
102973c3df3bSJohannes Berg  * @signal_avg: Average signal strength, type depends on the wiphy's signal_type.
103073c3df3bSJohannes Berg  *	For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
1031119363c7SFelix Fietkau  * @chains: bitmask for filled values in @chain_signal, @chain_signal_avg
1032119363c7SFelix Fietkau  * @chain_signal: per-chain signal strength of last received packet in dBm
1033119363c7SFelix Fietkau  * @chain_signal_avg: per-chain signal strength average in dBm
1034858022aaSRandy Dunlap  * @txrate: current unicast bitrate from this station
1035858022aaSRandy Dunlap  * @rxrate: current unicast bitrate to this station
10368d791361SJohannes Berg  * @rx_packets: packets (MSDUs & MMPDUs) received from this station
10378d791361SJohannes Berg  * @tx_packets: packets (MSDUs & MMPDUs) transmitted to this station
10388d791361SJohannes Berg  * @tx_retries: cumulative retry counts (MPDUs)
10398d791361SJohannes Berg  * @tx_failed: number of failed transmissions (MPDUs) (retries exceeded, no ACK)
10405a5c731aSBen Greear  * @rx_dropped_misc:  Dropped for un-specified reason.
10411ba01458SRandy Dunlap  * @bss_param: current BSS parameters
1042f5ea9120SJohannes Berg  * @generation: generation number for nl80211 dumps.
1043f5ea9120SJohannes Berg  *	This number should increase every time the list of stations
1044f5ea9120SJohannes Berg  *	changes, i.e. when a station is added or removed, so that
1045f5ea9120SJohannes Berg  *	userspace can tell whether it got a consistent snapshot.
104650d3dfb7SJouni Malinen  * @assoc_req_ies: IEs from (Re)Association Request.
104750d3dfb7SJouni Malinen  *	This is used only when in AP mode with drivers that do not use
104850d3dfb7SJouni Malinen  *	user space MLME/SME implementation. The information is provided for
104950d3dfb7SJouni Malinen  *	the cfg80211_new_sta() calls to notify user space of the IEs.
105050d3dfb7SJouni Malinen  * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets.
1051c26887d2SJohannes Berg  * @sta_flags: station flags mask & values
1052a85e1d55SPaul Stewart  * @beacon_loss_count: Number of times beacon loss event has triggered.
1053d299a1f2SJavier Cardona  * @t_offset: Time offset of the station relative to this host.
10543b1c5a53SMarco Porsch  * @local_pm: local mesh STA power save mode
10553b1c5a53SMarco Porsch  * @peer_pm: peer mesh STA power save mode
10563b1c5a53SMarco Porsch  * @nonpeer_pm: non-peer mesh STA power save mode
1057867d849fSAntonio Quartulli  * @expected_throughput: expected throughput in kbps (including 802.11 headers)
1058867d849fSAntonio Quartulli  *	towards this station.
1059a76b1942SJohannes Berg  * @rx_beacon: number of beacons received from this peer
1060a76b1942SJohannes Berg  * @rx_beacon_signal_avg: signal strength average (in dBm) for beacons received
1061a76b1942SJohannes Berg  *	from this peer
10626de39808SJohannes Berg  * @pertid: per-TID statistics, see &struct cfg80211_tid_stats, using the last
10636de39808SJohannes Berg  *	(IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs.
1064fd5b74dcSJohannes Berg  */
10652ec600d6SLuis Carlos Cobo struct station_info {
1066fd5b74dcSJohannes Berg 	u32 filled;
1067ebe27c91SMohammed Shafi Shajakhan 	u32 connected_time;
1068fd5b74dcSJohannes Berg 	u32 inactive_time;
106942745e03SVladimir Kondratiev 	u64 rx_bytes;
107042745e03SVladimir Kondratiev 	u64 tx_bytes;
10712ec600d6SLuis Carlos Cobo 	u16 llid;
10722ec600d6SLuis Carlos Cobo 	u16 plid;
10732ec600d6SLuis Carlos Cobo 	u8 plink_state;
1074420e7fabSHenning Rogge 	s8 signal;
1075541a45a1SBruno Randolf 	s8 signal_avg;
1076119363c7SFelix Fietkau 
1077119363c7SFelix Fietkau 	u8 chains;
1078119363c7SFelix Fietkau 	s8 chain_signal[IEEE80211_MAX_CHAINS];
1079119363c7SFelix Fietkau 	s8 chain_signal_avg[IEEE80211_MAX_CHAINS];
1080119363c7SFelix Fietkau 
1081420e7fabSHenning Rogge 	struct rate_info txrate;
1082c8dcfd8aSFelix Fietkau 	struct rate_info rxrate;
108398c8a60aSJouni Malinen 	u32 rx_packets;
108498c8a60aSJouni Malinen 	u32 tx_packets;
1085b206b4efSBruno Randolf 	u32 tx_retries;
1086b206b4efSBruno Randolf 	u32 tx_failed;
10875a5c731aSBen Greear 	u32 rx_dropped_misc;
1088f4263c98SPaul Stewart 	struct sta_bss_parameters bss_param;
1089bb6e753eSHelmut Schaa 	struct nl80211_sta_flag_update sta_flags;
1090f5ea9120SJohannes Berg 
1091f5ea9120SJohannes Berg 	int generation;
109250d3dfb7SJouni Malinen 
109350d3dfb7SJouni Malinen 	const u8 *assoc_req_ies;
109450d3dfb7SJouni Malinen 	size_t assoc_req_ies_len;
1095f612cedfSJouni Malinen 
1096a85e1d55SPaul Stewart 	u32 beacon_loss_count;
1097d299a1f2SJavier Cardona 	s64 t_offset;
10983b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode local_pm;
10993b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode peer_pm;
11003b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode nonpeer_pm;
1101a85e1d55SPaul Stewart 
1102867d849fSAntonio Quartulli 	u32 expected_throughput;
1103a76b1942SJohannes Berg 
1104a76b1942SJohannes Berg 	u64 rx_beacon;
1105a76b1942SJohannes Berg 	u8 rx_beacon_signal_avg;
11066de39808SJohannes Berg 	struct cfg80211_tid_stats pertid[IEEE80211_NUM_TIDS + 1];
1107fd5b74dcSJohannes Berg };
1108fd5b74dcSJohannes Berg 
110966f7ac50SMichael Wu /**
11107406353dSAntonio Quartulli  * cfg80211_get_station - retrieve information about a given station
11117406353dSAntonio Quartulli  * @dev: the device where the station is supposed to be connected to
11127406353dSAntonio Quartulli  * @mac_addr: the mac address of the station of interest
11137406353dSAntonio Quartulli  * @sinfo: pointer to the structure to fill with the information
11147406353dSAntonio Quartulli  *
11157406353dSAntonio Quartulli  * Returns 0 on success and sinfo is filled with the available information
11167406353dSAntonio Quartulli  * otherwise returns a negative error code and the content of sinfo has to be
11177406353dSAntonio Quartulli  * considered undefined.
11187406353dSAntonio Quartulli  */
11197406353dSAntonio Quartulli int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr,
11207406353dSAntonio Quartulli 			 struct station_info *sinfo);
11217406353dSAntonio Quartulli 
11227406353dSAntonio Quartulli /**
112366f7ac50SMichael Wu  * enum monitor_flags - monitor flags
112466f7ac50SMichael Wu  *
112566f7ac50SMichael Wu  * Monitor interface configuration flags. Note that these must be the bits
112666f7ac50SMichael Wu  * according to the nl80211 flags.
112766f7ac50SMichael Wu  *
112866f7ac50SMichael Wu  * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS
112966f7ac50SMichael Wu  * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP
113066f7ac50SMichael Wu  * @MONITOR_FLAG_CONTROL: pass control frames
113166f7ac50SMichael Wu  * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering
113266f7ac50SMichael Wu  * @MONITOR_FLAG_COOK_FRAMES: report frames after processing
1133e057d3c3SFelix Fietkau  * @MONITOR_FLAG_ACTIVE: active monitor, ACKs frames on its MAC address
113466f7ac50SMichael Wu  */
113566f7ac50SMichael Wu enum monitor_flags {
113666f7ac50SMichael Wu 	MONITOR_FLAG_FCSFAIL		= 1<<NL80211_MNTR_FLAG_FCSFAIL,
113766f7ac50SMichael Wu 	MONITOR_FLAG_PLCPFAIL		= 1<<NL80211_MNTR_FLAG_PLCPFAIL,
113866f7ac50SMichael Wu 	MONITOR_FLAG_CONTROL		= 1<<NL80211_MNTR_FLAG_CONTROL,
113966f7ac50SMichael Wu 	MONITOR_FLAG_OTHER_BSS		= 1<<NL80211_MNTR_FLAG_OTHER_BSS,
114066f7ac50SMichael Wu 	MONITOR_FLAG_COOK_FRAMES	= 1<<NL80211_MNTR_FLAG_COOK_FRAMES,
1141e057d3c3SFelix Fietkau 	MONITOR_FLAG_ACTIVE		= 1<<NL80211_MNTR_FLAG_ACTIVE,
114266f7ac50SMichael Wu };
114366f7ac50SMichael Wu 
11442ec600d6SLuis Carlos Cobo /**
11452ec600d6SLuis Carlos Cobo  * enum mpath_info_flags -  mesh path information flags
11462ec600d6SLuis Carlos Cobo  *
11472ec600d6SLuis Carlos Cobo  * Used by the driver to indicate which info in &struct mpath_info it has filled
11482ec600d6SLuis Carlos Cobo  * in during get_station() or dump_station().
11492ec600d6SLuis Carlos Cobo  *
1150abe37c4bSJohannes Berg  * @MPATH_INFO_FRAME_QLEN: @frame_qlen filled
1151abe37c4bSJohannes Berg  * @MPATH_INFO_SN: @sn filled
1152abe37c4bSJohannes Berg  * @MPATH_INFO_METRIC: @metric filled
1153abe37c4bSJohannes Berg  * @MPATH_INFO_EXPTIME: @exptime filled
1154abe37c4bSJohannes Berg  * @MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled
1155abe37c4bSJohannes Berg  * @MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled
1156abe37c4bSJohannes Berg  * @MPATH_INFO_FLAGS: @flags filled
11572ec600d6SLuis Carlos Cobo  */
11582ec600d6SLuis Carlos Cobo enum mpath_info_flags {
11592ec600d6SLuis Carlos Cobo 	MPATH_INFO_FRAME_QLEN		= BIT(0),
1160d19b3bf6SRui Paulo 	MPATH_INFO_SN			= BIT(1),
11612ec600d6SLuis Carlos Cobo 	MPATH_INFO_METRIC		= BIT(2),
11622ec600d6SLuis Carlos Cobo 	MPATH_INFO_EXPTIME		= BIT(3),
11632ec600d6SLuis Carlos Cobo 	MPATH_INFO_DISCOVERY_TIMEOUT	= BIT(4),
11642ec600d6SLuis Carlos Cobo 	MPATH_INFO_DISCOVERY_RETRIES	= BIT(5),
11652ec600d6SLuis Carlos Cobo 	MPATH_INFO_FLAGS		= BIT(6),
11662ec600d6SLuis Carlos Cobo };
11672ec600d6SLuis Carlos Cobo 
11682ec600d6SLuis Carlos Cobo /**
11692ec600d6SLuis Carlos Cobo  * struct mpath_info - mesh path information
11702ec600d6SLuis Carlos Cobo  *
11712ec600d6SLuis Carlos Cobo  * Mesh path information filled by driver for get_mpath() and dump_mpath().
11722ec600d6SLuis Carlos Cobo  *
11732ec600d6SLuis Carlos Cobo  * @filled: bitfield of flags from &enum mpath_info_flags
11742ec600d6SLuis Carlos Cobo  * @frame_qlen: number of queued frames for this destination
1175d19b3bf6SRui Paulo  * @sn: target sequence number
11762ec600d6SLuis Carlos Cobo  * @metric: metric (cost) of this mesh path
11772ec600d6SLuis Carlos Cobo  * @exptime: expiration time for the mesh path from now, in msecs
11782ec600d6SLuis Carlos Cobo  * @flags: mesh path flags
11792ec600d6SLuis Carlos Cobo  * @discovery_timeout: total mesh path discovery timeout, in msecs
11802ec600d6SLuis Carlos Cobo  * @discovery_retries: mesh path discovery retries
1181f5ea9120SJohannes Berg  * @generation: generation number for nl80211 dumps.
1182f5ea9120SJohannes Berg  *	This number should increase every time the list of mesh paths
1183f5ea9120SJohannes Berg  *	changes, i.e. when a station is added or removed, so that
1184f5ea9120SJohannes Berg  *	userspace can tell whether it got a consistent snapshot.
11852ec600d6SLuis Carlos Cobo  */
11862ec600d6SLuis Carlos Cobo struct mpath_info {
11872ec600d6SLuis Carlos Cobo 	u32 filled;
11882ec600d6SLuis Carlos Cobo 	u32 frame_qlen;
1189d19b3bf6SRui Paulo 	u32 sn;
11902ec600d6SLuis Carlos Cobo 	u32 metric;
11912ec600d6SLuis Carlos Cobo 	u32 exptime;
11922ec600d6SLuis Carlos Cobo 	u32 discovery_timeout;
11932ec600d6SLuis Carlos Cobo 	u8 discovery_retries;
11942ec600d6SLuis Carlos Cobo 	u8 flags;
1195f5ea9120SJohannes Berg 
1196f5ea9120SJohannes Berg 	int generation;
11972ec600d6SLuis Carlos Cobo };
11982ec600d6SLuis Carlos Cobo 
11999f1ba906SJouni Malinen /**
12009f1ba906SJouni Malinen  * struct bss_parameters - BSS parameters
12019f1ba906SJouni Malinen  *
12029f1ba906SJouni Malinen  * Used to change BSS parameters (mainly for AP mode).
12039f1ba906SJouni Malinen  *
12049f1ba906SJouni Malinen  * @use_cts_prot: Whether to use CTS protection
12059f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
12069f1ba906SJouni Malinen  * @use_short_preamble: Whether the use of short preambles is allowed
12079f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
12089f1ba906SJouni Malinen  * @use_short_slot_time: Whether the use of short slot time is allowed
12099f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
121090c97a04SJouni Malinen  * @basic_rates: basic rates in IEEE 802.11 format
121190c97a04SJouni Malinen  *	(or NULL for no change)
121290c97a04SJouni Malinen  * @basic_rates_len: number of basic rates
1213fd8aaaf3SFelix Fietkau  * @ap_isolate: do not forward packets between connected stations
121450b12f59SHelmut Schaa  * @ht_opmode: HT Operation mode
121550b12f59SHelmut Schaa  * 	(u16 = opmode, -1 = do not change)
121653cabad7SJohannes Berg  * @p2p_ctwindow: P2P CT Window (-1 = no change)
121753cabad7SJohannes Berg  * @p2p_opp_ps: P2P opportunistic PS (-1 = no change)
12189f1ba906SJouni Malinen  */
12199f1ba906SJouni Malinen struct bss_parameters {
12209f1ba906SJouni Malinen 	int use_cts_prot;
12219f1ba906SJouni Malinen 	int use_short_preamble;
12229f1ba906SJouni Malinen 	int use_short_slot_time;
1223c1e5f471SJohannes Berg 	const u8 *basic_rates;
122490c97a04SJouni Malinen 	u8 basic_rates_len;
1225fd8aaaf3SFelix Fietkau 	int ap_isolate;
122650b12f59SHelmut Schaa 	int ht_opmode;
122753cabad7SJohannes Berg 	s8 p2p_ctwindow, p2p_opp_ps;
12289f1ba906SJouni Malinen };
12292ec600d6SLuis Carlos Cobo 
12303ddd53f3SChun-Yeow Yeoh /**
123129cbe68cSJohannes Berg  * struct mesh_config - 802.11s mesh configuration
123229cbe68cSJohannes Berg  *
123329cbe68cSJohannes Berg  * These parameters can be changed while the mesh is active.
12343ddd53f3SChun-Yeow Yeoh  *
12353ddd53f3SChun-Yeow Yeoh  * @dot11MeshRetryTimeout: the initial retry timeout in millisecond units used
12363ddd53f3SChun-Yeow Yeoh  *	by the Mesh Peering Open message
12373ddd53f3SChun-Yeow Yeoh  * @dot11MeshConfirmTimeout: the initial retry timeout in millisecond units
12383ddd53f3SChun-Yeow Yeoh  *	used by the Mesh Peering Open message
12393ddd53f3SChun-Yeow Yeoh  * @dot11MeshHoldingTimeout: the confirm timeout in millisecond units used by
12403ddd53f3SChun-Yeow Yeoh  *	the mesh peering management to close a mesh peering
12413ddd53f3SChun-Yeow Yeoh  * @dot11MeshMaxPeerLinks: the maximum number of peer links allowed on this
12423ddd53f3SChun-Yeow Yeoh  *	mesh interface
12433ddd53f3SChun-Yeow Yeoh  * @dot11MeshMaxRetries: the maximum number of peer link open retries that can
12443ddd53f3SChun-Yeow Yeoh  *	be sent to establish a new peer link instance in a mesh
12453ddd53f3SChun-Yeow Yeoh  * @dot11MeshTTL: the value of TTL field set at a source mesh STA
12463ddd53f3SChun-Yeow Yeoh  * @element_ttl: the value of TTL field set at a mesh STA for path selection
12473ddd53f3SChun-Yeow Yeoh  *	elements
12483ddd53f3SChun-Yeow Yeoh  * @auto_open_plinks: whether we should automatically open peer links when we
12493ddd53f3SChun-Yeow Yeoh  *	detect compatible mesh peers
12503ddd53f3SChun-Yeow Yeoh  * @dot11MeshNbrOffsetMaxNeighbor: the maximum number of neighbors to
12513ddd53f3SChun-Yeow Yeoh  *	synchronize to for 11s default synchronization method
12523ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPmaxPREQretries: the number of action frames containing a PREQ
12533ddd53f3SChun-Yeow Yeoh  *	that an originator mesh STA can send to a particular path target
12543ddd53f3SChun-Yeow Yeoh  * @path_refresh_time: how frequently to refresh mesh paths in milliseconds
12553ddd53f3SChun-Yeow Yeoh  * @min_discovery_timeout: the minimum length of time to wait until giving up on
12563ddd53f3SChun-Yeow Yeoh  *	a path discovery in milliseconds
12573ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPactivePathTimeout: the time (in TUs) for which mesh STAs
12583ddd53f3SChun-Yeow Yeoh  *	receiving a PREQ shall consider the forwarding information from the
12593ddd53f3SChun-Yeow Yeoh  *	root to be valid. (TU = time unit)
12603ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPpreqMinInterval: the minimum interval of time (in TUs) during
12613ddd53f3SChun-Yeow Yeoh  *	which a mesh STA can send only one action frame containing a PREQ
12623ddd53f3SChun-Yeow Yeoh  *	element
12633ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPperrMinInterval: the minimum interval of time (in TUs) during
12643ddd53f3SChun-Yeow Yeoh  *	which a mesh STA can send only one Action frame containing a PERR
12653ddd53f3SChun-Yeow Yeoh  *	element
12663ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPnetDiameterTraversalTime: the interval of time (in TUs) that
12673ddd53f3SChun-Yeow Yeoh  *	it takes for an HWMP information element to propagate across the mesh
12683ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPRootMode: the configuration of a mesh STA as root mesh STA
12693ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPRannInterval: the interval of time (in TUs) between root
12703ddd53f3SChun-Yeow Yeoh  *	announcements are transmitted
12713ddd53f3SChun-Yeow Yeoh  * @dot11MeshGateAnnouncementProtocol: whether to advertise that this mesh
12723ddd53f3SChun-Yeow Yeoh  *	station has access to a broader network beyond the MBSS. (This is
12733ddd53f3SChun-Yeow Yeoh  *	missnamed in draft 12.0: dot11MeshGateAnnouncementProtocol set to true
12743ddd53f3SChun-Yeow Yeoh  *	only means that the station will announce others it's a mesh gate, but
12753ddd53f3SChun-Yeow Yeoh  *	not necessarily using the gate announcement protocol. Still keeping the
12763ddd53f3SChun-Yeow Yeoh  *	same nomenclature to be in sync with the spec)
12773ddd53f3SChun-Yeow Yeoh  * @dot11MeshForwarding: whether the Mesh STA is forwarding or non-forwarding
12783ddd53f3SChun-Yeow Yeoh  *	entity (default is TRUE - forwarding entity)
12793ddd53f3SChun-Yeow Yeoh  * @rssi_threshold: the threshold for average signal strength of candidate
12803ddd53f3SChun-Yeow Yeoh  *	station to establish a peer link
12813ddd53f3SChun-Yeow Yeoh  * @ht_opmode: mesh HT protection mode
1282ac1073a6SChun-Yeow Yeoh  *
1283ac1073a6SChun-Yeow Yeoh  * @dot11MeshHWMPactivePathToRootTimeout: The time (in TUs) for which mesh STAs
1284ac1073a6SChun-Yeow Yeoh  *	receiving a proactive PREQ shall consider the forwarding information to
1285ac1073a6SChun-Yeow Yeoh  *	the root mesh STA to be valid.
1286ac1073a6SChun-Yeow Yeoh  *
1287ac1073a6SChun-Yeow Yeoh  * @dot11MeshHWMProotInterval: The interval of time (in TUs) between proactive
1288ac1073a6SChun-Yeow Yeoh  *	PREQs are transmitted.
1289728b19e5SChun-Yeow Yeoh  * @dot11MeshHWMPconfirmationInterval: The minimum interval of time (in TUs)
1290728b19e5SChun-Yeow Yeoh  *	during which a mesh STA can send only one Action frame containing
1291728b19e5SChun-Yeow Yeoh  *	a PREQ element for root path confirmation.
12923b1c5a53SMarco Porsch  * @power_mode: The default mesh power save mode which will be the initial
12933b1c5a53SMarco Porsch  *	setting for new peer links.
12943b1c5a53SMarco Porsch  * @dot11MeshAwakeWindowDuration: The duration in TUs the STA will remain awake
12953b1c5a53SMarco Porsch  *	after transmitting its beacon.
12968e7c0538SColleen Twitty  * @plink_timeout: If no tx activity is seen from a STA we've established
12978e7c0538SColleen Twitty  *	peering with for longer than this time (in seconds), then remove it
12988e7c0538SColleen Twitty  *	from the STA's list of peers.  Default is 30 minutes.
129929cbe68cSJohannes Berg  */
130093da9cc1Scolin@cozybit.com struct mesh_config {
130193da9cc1Scolin@cozybit.com 	u16 dot11MeshRetryTimeout;
130293da9cc1Scolin@cozybit.com 	u16 dot11MeshConfirmTimeout;
130393da9cc1Scolin@cozybit.com 	u16 dot11MeshHoldingTimeout;
130493da9cc1Scolin@cozybit.com 	u16 dot11MeshMaxPeerLinks;
130593da9cc1Scolin@cozybit.com 	u8 dot11MeshMaxRetries;
130693da9cc1Scolin@cozybit.com 	u8 dot11MeshTTL;
130745904f21SJavier Cardona 	u8 element_ttl;
130893da9cc1Scolin@cozybit.com 	bool auto_open_plinks;
1309d299a1f2SJavier Cardona 	u32 dot11MeshNbrOffsetMaxNeighbor;
131093da9cc1Scolin@cozybit.com 	u8 dot11MeshHWMPmaxPREQretries;
131193da9cc1Scolin@cozybit.com 	u32 path_refresh_time;
131293da9cc1Scolin@cozybit.com 	u16 min_discovery_timeout;
131393da9cc1Scolin@cozybit.com 	u32 dot11MeshHWMPactivePathTimeout;
131493da9cc1Scolin@cozybit.com 	u16 dot11MeshHWMPpreqMinInterval;
1315dca7e943SThomas Pedersen 	u16 dot11MeshHWMPperrMinInterval;
131693da9cc1Scolin@cozybit.com 	u16 dot11MeshHWMPnetDiameterTraversalTime;
131763c5723bSRui Paulo 	u8 dot11MeshHWMPRootMode;
13180507e159SJavier Cardona 	u16 dot11MeshHWMPRannInterval;
131916dd7267SJavier Cardona 	bool dot11MeshGateAnnouncementProtocol;
132094f90656SChun-Yeow Yeoh 	bool dot11MeshForwarding;
132155335137SAshok Nagarajan 	s32 rssi_threshold;
132270c33eaaSAshok Nagarajan 	u16 ht_opmode;
1323ac1073a6SChun-Yeow Yeoh 	u32 dot11MeshHWMPactivePathToRootTimeout;
1324ac1073a6SChun-Yeow Yeoh 	u16 dot11MeshHWMProotInterval;
1325728b19e5SChun-Yeow Yeoh 	u16 dot11MeshHWMPconfirmationInterval;
13263b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode power_mode;
13273b1c5a53SMarco Porsch 	u16 dot11MeshAwakeWindowDuration;
13288e7c0538SColleen Twitty 	u32 plink_timeout;
132993da9cc1Scolin@cozybit.com };
133093da9cc1Scolin@cozybit.com 
133131888487SJouni Malinen /**
133229cbe68cSJohannes Berg  * struct mesh_setup - 802.11s mesh setup configuration
1333683b6d3bSJohannes Berg  * @chandef: defines the channel to use
133429cbe68cSJohannes Berg  * @mesh_id: the mesh ID
133529cbe68cSJohannes Berg  * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes
1336d299a1f2SJavier Cardona  * @sync_method: which synchronization method to use
1337c80d545dSJavier Cardona  * @path_sel_proto: which path selection protocol to use
1338c80d545dSJavier Cardona  * @path_metric: which metric to use
13396e16d90bSColleen Twitty  * @auth_id: which authentication method this mesh is using
1340581a8b0fSJavier Cardona  * @ie: vendor information elements (optional)
1341581a8b0fSJavier Cardona  * @ie_len: length of vendor information elements
1342b130e5ceSJavier Cardona  * @is_authenticated: this mesh requires authentication
1343b130e5ceSJavier Cardona  * @is_secure: this mesh uses security
1344bb2798d4SThomas Pedersen  * @user_mpm: userspace handles all MPM functions
13459bdbf04dSMarco Porsch  * @dtim_period: DTIM period to use
13469bdbf04dSMarco Porsch  * @beacon_interval: beacon interval to use
13474bb62344SChun-Yeow Yeoh  * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a]
1348ffb3cf30SAshok Nagarajan  * @basic_rates: basic rates to use when creating the mesh
134929cbe68cSJohannes Berg  *
135029cbe68cSJohannes Berg  * These parameters are fixed when the mesh is created.
135129cbe68cSJohannes Berg  */
135229cbe68cSJohannes Berg struct mesh_setup {
1353683b6d3bSJohannes Berg 	struct cfg80211_chan_def chandef;
135429cbe68cSJohannes Berg 	const u8 *mesh_id;
135529cbe68cSJohannes Berg 	u8 mesh_id_len;
1356d299a1f2SJavier Cardona 	u8 sync_method;
1357c80d545dSJavier Cardona 	u8 path_sel_proto;
1358c80d545dSJavier Cardona 	u8 path_metric;
13596e16d90bSColleen Twitty 	u8 auth_id;
1360581a8b0fSJavier Cardona 	const u8 *ie;
1361581a8b0fSJavier Cardona 	u8 ie_len;
1362b130e5ceSJavier Cardona 	bool is_authenticated;
136315d5dda6SJavier Cardona 	bool is_secure;
1364bb2798d4SThomas Pedersen 	bool user_mpm;
13659bdbf04dSMarco Porsch 	u8 dtim_period;
13669bdbf04dSMarco Porsch 	u16 beacon_interval;
13674bb62344SChun-Yeow Yeoh 	int mcast_rate[IEEE80211_NUM_BANDS];
1368ffb3cf30SAshok Nagarajan 	u32 basic_rates;
136929cbe68cSJohannes Berg };
137029cbe68cSJohannes Berg 
137129cbe68cSJohannes Berg /**
13726e0bd6c3SRostislav Lisovy  * struct ocb_setup - 802.11p OCB mode setup configuration
13736e0bd6c3SRostislav Lisovy  * @chandef: defines the channel to use
13746e0bd6c3SRostislav Lisovy  *
13756e0bd6c3SRostislav Lisovy  * These parameters are fixed when connecting to the network
13766e0bd6c3SRostislav Lisovy  */
13776e0bd6c3SRostislav Lisovy struct ocb_setup {
13786e0bd6c3SRostislav Lisovy 	struct cfg80211_chan_def chandef;
13796e0bd6c3SRostislav Lisovy };
13806e0bd6c3SRostislav Lisovy 
13816e0bd6c3SRostislav Lisovy /**
138231888487SJouni Malinen  * struct ieee80211_txq_params - TX queue parameters
1383a3304b0aSJohannes Berg  * @ac: AC identifier
138431888487SJouni Malinen  * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled
138531888487SJouni Malinen  * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range
138631888487SJouni Malinen  *	1..32767]
138731888487SJouni Malinen  * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range
138831888487SJouni Malinen  *	1..32767]
138931888487SJouni Malinen  * @aifs: Arbitration interframe space [0..255]
139031888487SJouni Malinen  */
139131888487SJouni Malinen struct ieee80211_txq_params {
1392a3304b0aSJohannes Berg 	enum nl80211_ac ac;
139331888487SJouni Malinen 	u16 txop;
139431888487SJouni Malinen 	u16 cwmin;
139531888487SJouni Malinen 	u16 cwmax;
139631888487SJouni Malinen 	u8 aifs;
139731888487SJouni Malinen };
139831888487SJouni Malinen 
1399d70e9693SJohannes Berg /**
1400d70e9693SJohannes Berg  * DOC: Scanning and BSS list handling
1401d70e9693SJohannes Berg  *
1402d70e9693SJohannes Berg  * The scanning process itself is fairly simple, but cfg80211 offers quite
1403d70e9693SJohannes Berg  * a bit of helper functionality. To start a scan, the scan operation will
1404d70e9693SJohannes Berg  * be invoked with a scan definition. This scan definition contains the
1405d70e9693SJohannes Berg  * channels to scan, and the SSIDs to send probe requests for (including the
1406d70e9693SJohannes Berg  * wildcard, if desired). A passive scan is indicated by having no SSIDs to
1407d70e9693SJohannes Berg  * probe. Additionally, a scan request may contain extra information elements
1408d70e9693SJohannes Berg  * that should be added to the probe request. The IEs are guaranteed to be
1409d70e9693SJohannes Berg  * well-formed, and will not exceed the maximum length the driver advertised
1410d70e9693SJohannes Berg  * in the wiphy structure.
1411d70e9693SJohannes Berg  *
1412d70e9693SJohannes Berg  * When scanning finds a BSS, cfg80211 needs to be notified of that, because
1413d70e9693SJohannes Berg  * it is responsible for maintaining the BSS list; the driver should not
1414d70e9693SJohannes Berg  * maintain a list itself. For this notification, various functions exist.
1415d70e9693SJohannes Berg  *
1416d70e9693SJohannes Berg  * Since drivers do not maintain a BSS list, there are also a number of
1417d70e9693SJohannes Berg  * functions to search for a BSS and obtain information about it from the
1418d70e9693SJohannes Berg  * BSS structure cfg80211 maintains. The BSS list is also made available
1419d70e9693SJohannes Berg  * to userspace.
1420d70e9693SJohannes Berg  */
142172bdcf34SJouni Malinen 
1422704232c2SJohannes Berg /**
14232a519311SJohannes Berg  * struct cfg80211_ssid - SSID description
14242a519311SJohannes Berg  * @ssid: the SSID
14252a519311SJohannes Berg  * @ssid_len: length of the ssid
14262a519311SJohannes Berg  */
14272a519311SJohannes Berg struct cfg80211_ssid {
14282a519311SJohannes Berg 	u8 ssid[IEEE80211_MAX_SSID_LEN];
14292a519311SJohannes Berg 	u8 ssid_len;
14302a519311SJohannes Berg };
14312a519311SJohannes Berg 
14322a519311SJohannes Berg /**
14332a519311SJohannes Berg  * struct cfg80211_scan_request - scan request description
14342a519311SJohannes Berg  *
14352a519311SJohannes Berg  * @ssids: SSIDs to scan for (active scan only)
14362a519311SJohannes Berg  * @n_ssids: number of SSIDs
14372a519311SJohannes Berg  * @channels: channels to scan on.
1438ca3dbc20SHelmut Schaa  * @n_channels: total number of channels to scan
1439dcd6eac1SSimon Wunderlich  * @scan_width: channel width for scanning
144070692ad2SJouni Malinen  * @ie: optional information element(s) to add into Probe Request or %NULL
144170692ad2SJouni Malinen  * @ie_len: length of ie in octets
1442ed473771SSam Leffler  * @flags: bit field of flags controlling operation
144334850ab2SJohannes Berg  * @rates: bitmap of rates to advertise for each band
14442a519311SJohannes Berg  * @wiphy: the wiphy this was for
144515d6030bSSam Leffler  * @scan_start: time (in jiffies) when the scan started
1446fd014284SJohannes Berg  * @wdev: the wireless device to scan for
1447abe37c4bSJohannes Berg  * @aborted: (internal) scan request was notified as aborted
14485fe231e8SJohannes Berg  * @notified: (internal) scan request was notified as done or aborted
1449e9f935e3SRajkumar Manoharan  * @no_cck: used to send probe requests at non CCK rate in 2GHz band
1450ad2b26abSJohannes Berg  * @mac_addr: MAC address used with randomisation
1451ad2b26abSJohannes Berg  * @mac_addr_mask: MAC address mask used with randomisation, bits that
1452ad2b26abSJohannes Berg  *	are 0 in the mask should be randomised, bits that are 1 should
1453ad2b26abSJohannes Berg  *	be taken from the @mac_addr
14542a519311SJohannes Berg  */
14552a519311SJohannes Berg struct cfg80211_scan_request {
14562a519311SJohannes Berg 	struct cfg80211_ssid *ssids;
14572a519311SJohannes Berg 	int n_ssids;
14582a519311SJohannes Berg 	u32 n_channels;
1459dcd6eac1SSimon Wunderlich 	enum nl80211_bss_scan_width scan_width;
1460de95a54bSJohannes Berg 	const u8 *ie;
146170692ad2SJouni Malinen 	size_t ie_len;
1462ed473771SSam Leffler 	u32 flags;
14632a519311SJohannes Berg 
146434850ab2SJohannes Berg 	u32 rates[IEEE80211_NUM_BANDS];
146534850ab2SJohannes Berg 
1466fd014284SJohannes Berg 	struct wireless_dev *wdev;
1467fd014284SJohannes Berg 
1468ad2b26abSJohannes Berg 	u8 mac_addr[ETH_ALEN] __aligned(2);
1469ad2b26abSJohannes Berg 	u8 mac_addr_mask[ETH_ALEN] __aligned(2);
1470ad2b26abSJohannes Berg 
14712a519311SJohannes Berg 	/* internal */
14722a519311SJohannes Berg 	struct wiphy *wiphy;
147315d6030bSSam Leffler 	unsigned long scan_start;
14745fe231e8SJohannes Berg 	bool aborted, notified;
1475e9f935e3SRajkumar Manoharan 	bool no_cck;
14765ba63533SJohannes Berg 
14775ba63533SJohannes Berg 	/* keep last */
14785ba63533SJohannes Berg 	struct ieee80211_channel *channels[0];
14792a519311SJohannes Berg };
14802a519311SJohannes Berg 
1481ad2b26abSJohannes Berg static inline void get_random_mask_addr(u8 *buf, const u8 *addr, const u8 *mask)
1482ad2b26abSJohannes Berg {
1483ad2b26abSJohannes Berg 	int i;
1484ad2b26abSJohannes Berg 
1485ad2b26abSJohannes Berg 	get_random_bytes(buf, ETH_ALEN);
1486ad2b26abSJohannes Berg 	for (i = 0; i < ETH_ALEN; i++) {
1487ad2b26abSJohannes Berg 		buf[i] &= ~mask[i];
1488ad2b26abSJohannes Berg 		buf[i] |= addr[i] & mask[i];
1489ad2b26abSJohannes Berg 	}
1490ad2b26abSJohannes Berg }
1491ad2b26abSJohannes Berg 
14922a519311SJohannes Berg /**
1493a1f1c21cSLuciano Coelho  * struct cfg80211_match_set - sets of attributes to match
1494a1f1c21cSLuciano Coelho  *
1495ea73cbceSJohannes Berg  * @ssid: SSID to be matched; may be zero-length for no match (RSSI only)
1496ea73cbceSJohannes Berg  * @rssi_thold: don't report scan results below this threshold (in s32 dBm)
1497a1f1c21cSLuciano Coelho  */
1498a1f1c21cSLuciano Coelho struct cfg80211_match_set {
1499a1f1c21cSLuciano Coelho 	struct cfg80211_ssid ssid;
1500ea73cbceSJohannes Berg 	s32 rssi_thold;
1501a1f1c21cSLuciano Coelho };
1502a1f1c21cSLuciano Coelho 
1503a1f1c21cSLuciano Coelho /**
1504807f8a8cSLuciano Coelho  * struct cfg80211_sched_scan_request - scheduled scan request description
1505807f8a8cSLuciano Coelho  *
1506807f8a8cSLuciano Coelho  * @ssids: SSIDs to scan for (passed in the probe_reqs in active scans)
1507807f8a8cSLuciano Coelho  * @n_ssids: number of SSIDs
1508807f8a8cSLuciano Coelho  * @n_channels: total number of channels to scan
1509dcd6eac1SSimon Wunderlich  * @scan_width: channel width for scanning
1510bbe6ad6dSLuciano Coelho  * @interval: interval between each scheduled scan cycle
1511807f8a8cSLuciano Coelho  * @ie: optional information element(s) to add into Probe Request or %NULL
1512807f8a8cSLuciano Coelho  * @ie_len: length of ie in octets
1513ed473771SSam Leffler  * @flags: bit field of flags controlling operation
1514a1f1c21cSLuciano Coelho  * @match_sets: sets of parameters to be matched for a scan result
1515a1f1c21cSLuciano Coelho  * 	entry to be considered valid and to be passed to the host
1516a1f1c21cSLuciano Coelho  * 	(others are filtered out).
1517a1f1c21cSLuciano Coelho  *	If ommited, all results are passed.
1518a1f1c21cSLuciano Coelho  * @n_match_sets: number of match sets
1519807f8a8cSLuciano Coelho  * @wiphy: the wiphy this was for
1520807f8a8cSLuciano Coelho  * @dev: the interface
1521077f897aSJohannes Berg  * @scan_start: start time of the scheduled scan
1522807f8a8cSLuciano Coelho  * @channels: channels to scan
1523ea73cbceSJohannes Berg  * @min_rssi_thold: for drivers only supporting a single threshold, this
1524ea73cbceSJohannes Berg  *	contains the minimum over all matchsets
1525ad2b26abSJohannes Berg  * @mac_addr: MAC address used with randomisation
1526ad2b26abSJohannes Berg  * @mac_addr_mask: MAC address mask used with randomisation, bits that
1527ad2b26abSJohannes Berg  *	are 0 in the mask should be randomised, bits that are 1 should
1528ad2b26abSJohannes Berg  *	be taken from the @mac_addr
152931a60ed1SJukka Rissanen  * @rcu_head: RCU callback used to free the struct
153093a1e86cSJukka Rissanen  * @owner_nlportid: netlink portid of owner (if this should is a request
153193a1e86cSJukka Rissanen  *	owned by a particular socket)
15329c748934SLuciano Coelho  * @delay: delay in seconds to use before starting the first scan
15339c748934SLuciano Coelho  *	cycle.  The driver may ignore this parameter and start
15349c748934SLuciano Coelho  *	immediately (or at any other time), if this feature is not
15359c748934SLuciano Coelho  *	supported.
1536807f8a8cSLuciano Coelho  */
1537807f8a8cSLuciano Coelho struct cfg80211_sched_scan_request {
1538807f8a8cSLuciano Coelho 	struct cfg80211_ssid *ssids;
1539807f8a8cSLuciano Coelho 	int n_ssids;
1540807f8a8cSLuciano Coelho 	u32 n_channels;
1541dcd6eac1SSimon Wunderlich 	enum nl80211_bss_scan_width scan_width;
1542bbe6ad6dSLuciano Coelho 	u32 interval;
1543807f8a8cSLuciano Coelho 	const u8 *ie;
1544807f8a8cSLuciano Coelho 	size_t ie_len;
1545ed473771SSam Leffler 	u32 flags;
1546a1f1c21cSLuciano Coelho 	struct cfg80211_match_set *match_sets;
1547a1f1c21cSLuciano Coelho 	int n_match_sets;
1548ea73cbceSJohannes Berg 	s32 min_rssi_thold;
15499c748934SLuciano Coelho 	u32 delay;
1550807f8a8cSLuciano Coelho 
1551ad2b26abSJohannes Berg 	u8 mac_addr[ETH_ALEN] __aligned(2);
1552ad2b26abSJohannes Berg 	u8 mac_addr_mask[ETH_ALEN] __aligned(2);
1553ad2b26abSJohannes Berg 
1554807f8a8cSLuciano Coelho 	/* internal */
1555807f8a8cSLuciano Coelho 	struct wiphy *wiphy;
1556807f8a8cSLuciano Coelho 	struct net_device *dev;
155715d6030bSSam Leffler 	unsigned long scan_start;
155831a60ed1SJukka Rissanen 	struct rcu_head rcu_head;
155993a1e86cSJukka Rissanen 	u32 owner_nlportid;
1560807f8a8cSLuciano Coelho 
1561807f8a8cSLuciano Coelho 	/* keep last */
1562807f8a8cSLuciano Coelho 	struct ieee80211_channel *channels[0];
1563807f8a8cSLuciano Coelho };
1564807f8a8cSLuciano Coelho 
1565807f8a8cSLuciano Coelho /**
15662a519311SJohannes Berg  * enum cfg80211_signal_type - signal type
15672a519311SJohannes Berg  *
15682a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available
15692a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm)
15702a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100
15712a519311SJohannes Berg  */
15722a519311SJohannes Berg enum cfg80211_signal_type {
15732a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_NONE,
15742a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_MBM,
15752a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_UNSPEC,
15762a519311SJohannes Berg };
15772a519311SJohannes Berg 
15782a519311SJohannes Berg /**
15799caf0364SJohannes Berg  * struct cfg80211_bss_ie_data - BSS entry IE data
15808cef2c9dSJohannes Berg  * @tsf: TSF contained in the frame that carried these IEs
15819caf0364SJohannes Berg  * @rcu_head: internal use, for freeing
15829caf0364SJohannes Berg  * @len: length of the IEs
15830e227084SJohannes Berg  * @from_beacon: these IEs are known to come from a beacon
15849caf0364SJohannes Berg  * @data: IE data
15859caf0364SJohannes Berg  */
15869caf0364SJohannes Berg struct cfg80211_bss_ies {
15878cef2c9dSJohannes Berg 	u64 tsf;
15889caf0364SJohannes Berg 	struct rcu_head rcu_head;
15899caf0364SJohannes Berg 	int len;
15900e227084SJohannes Berg 	bool from_beacon;
15919caf0364SJohannes Berg 	u8 data[];
15929caf0364SJohannes Berg };
15939caf0364SJohannes Berg 
15949caf0364SJohannes Berg /**
15952a519311SJohannes Berg  * struct cfg80211_bss - BSS description
15962a519311SJohannes Berg  *
15972a519311SJohannes Berg  * This structure describes a BSS (which may also be a mesh network)
15982a519311SJohannes Berg  * for use in scan results and similar.
15992a519311SJohannes Berg  *
1600abe37c4bSJohannes Berg  * @channel: channel this BSS is on
1601dcd6eac1SSimon Wunderlich  * @scan_width: width of the control channel
16022a519311SJohannes Berg  * @bssid: BSSID of the BSS
16032a519311SJohannes Berg  * @beacon_interval: the beacon interval as from the frame
16042a519311SJohannes Berg  * @capability: the capability field in host byte order
160583c7aa1aSJohannes Berg  * @ies: the information elements (Note that there is no guarantee that these
160683c7aa1aSJohannes Berg  *	are well-formed!); this is a pointer to either the beacon_ies or
160783c7aa1aSJohannes Berg  *	proberesp_ies depending on whether Probe Response frame has been
160883c7aa1aSJohannes Berg  *	received. It is always non-%NULL.
160934a6eddbSJouni Malinen  * @beacon_ies: the information elements from the last Beacon frame
1610776b3580SJohannes Berg  *	(implementation note: if @hidden_beacon_bss is set this struct doesn't
1611776b3580SJohannes Berg  *	own the beacon_ies, but they're just pointers to the ones from the
1612776b3580SJohannes Berg  *	@hidden_beacon_bss struct)
161334a6eddbSJouni Malinen  * @proberesp_ies: the information elements from the last Probe Response frame
1614776b3580SJohannes Berg  * @hidden_beacon_bss: in case this BSS struct represents a probe response from
1615776b3580SJohannes Berg  *	a BSS that hides the SSID in its beacon, this points to the BSS struct
1616776b3580SJohannes Berg  *	that holds the beacon data. @beacon_ies is still valid, of course, and
1617776b3580SJohannes Berg  *	points to the same data as hidden_beacon_bss->beacon_ies in that case.
161877965c97SJohannes Berg  * @signal: signal strength value (type depends on the wiphy's signal_type)
16192a519311SJohannes Berg  * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
16202a519311SJohannes Berg  */
16212a519311SJohannes Berg struct cfg80211_bss {
16222a519311SJohannes Berg 	struct ieee80211_channel *channel;
1623dcd6eac1SSimon Wunderlich 	enum nl80211_bss_scan_width scan_width;
16242a519311SJohannes Berg 
16259caf0364SJohannes Berg 	const struct cfg80211_bss_ies __rcu *ies;
16269caf0364SJohannes Berg 	const struct cfg80211_bss_ies __rcu *beacon_ies;
16279caf0364SJohannes Berg 	const struct cfg80211_bss_ies __rcu *proberesp_ies;
16289caf0364SJohannes Berg 
1629776b3580SJohannes Berg 	struct cfg80211_bss *hidden_beacon_bss;
16302a519311SJohannes Berg 
16312a519311SJohannes Berg 	s32 signal;
16322a519311SJohannes Berg 
16339caf0364SJohannes Berg 	u16 beacon_interval;
16349caf0364SJohannes Berg 	u16 capability;
16359caf0364SJohannes Berg 
16369caf0364SJohannes Berg 	u8 bssid[ETH_ALEN];
16379caf0364SJohannes Berg 
16381c06ef98SJohannes Berg 	u8 priv[0] __aligned(sizeof(void *));
16392a519311SJohannes Berg };
16402a519311SJohannes Berg 
16412a519311SJohannes Berg /**
1642517357c6SJohannes Berg  * ieee80211_bss_get_ie - find IE with given ID
1643517357c6SJohannes Berg  * @bss: the bss to search
1644517357c6SJohannes Berg  * @ie: the IE ID
16459caf0364SJohannes Berg  *
16469caf0364SJohannes Berg  * Note that the return value is an RCU-protected pointer, so
16479caf0364SJohannes Berg  * rcu_read_lock() must be held when calling this function.
16480ae997dcSYacine Belkadi  * Return: %NULL if not found.
1649517357c6SJohannes Berg  */
1650517357c6SJohannes Berg const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie);
1651517357c6SJohannes Berg 
1652517357c6SJohannes Berg 
1653517357c6SJohannes Berg /**
1654636a5d36SJouni Malinen  * struct cfg80211_auth_request - Authentication request data
1655636a5d36SJouni Malinen  *
1656636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
1657636a5d36SJouni Malinen  * authentication.
1658636a5d36SJouni Malinen  *
1659959867faSJohannes Berg  * @bss: The BSS to authenticate with, the callee must obtain a reference
1660959867faSJohannes Berg  *	to it if it needs to keep it.
1661636a5d36SJouni Malinen  * @auth_type: Authentication type (algorithm)
1662636a5d36SJouni Malinen  * @ie: Extra IEs to add to Authentication frame or %NULL
1663636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
1664fffd0934SJohannes Berg  * @key_len: length of WEP key for shared key authentication
1665fffd0934SJohannes Berg  * @key_idx: index of WEP key for shared key authentication
1666fffd0934SJohannes Berg  * @key: WEP key for shared key authentication
1667e39e5b5eSJouni Malinen  * @sae_data: Non-IE data to use with SAE or %NULL. This starts with
1668e39e5b5eSJouni Malinen  *	Authentication transaction sequence number field.
1669e39e5b5eSJouni Malinen  * @sae_data_len: Length of sae_data buffer in octets
1670636a5d36SJouni Malinen  */
1671636a5d36SJouni Malinen struct cfg80211_auth_request {
167219957bb3SJohannes Berg 	struct cfg80211_bss *bss;
1673636a5d36SJouni Malinen 	const u8 *ie;
1674636a5d36SJouni Malinen 	size_t ie_len;
167519957bb3SJohannes Berg 	enum nl80211_auth_type auth_type;
1676fffd0934SJohannes Berg 	const u8 *key;
1677fffd0934SJohannes Berg 	u8 key_len, key_idx;
1678e39e5b5eSJouni Malinen 	const u8 *sae_data;
1679e39e5b5eSJouni Malinen 	size_t sae_data_len;
1680636a5d36SJouni Malinen };
1681636a5d36SJouni Malinen 
1682636a5d36SJouni Malinen /**
16837e7c8926SBen Greear  * enum cfg80211_assoc_req_flags - Over-ride default behaviour in association.
16847e7c8926SBen Greear  *
16857e7c8926SBen Greear  * @ASSOC_REQ_DISABLE_HT:  Disable HT (802.11n)
1686ee2aca34SJohannes Berg  * @ASSOC_REQ_DISABLE_VHT:  Disable VHT
1687bab5ab7dSAssaf Krauss  * @ASSOC_REQ_USE_RRM: Declare RRM capability in this association
16887e7c8926SBen Greear  */
16897e7c8926SBen Greear enum cfg80211_assoc_req_flags {
16907e7c8926SBen Greear 	ASSOC_REQ_DISABLE_HT		= BIT(0),
1691ee2aca34SJohannes Berg 	ASSOC_REQ_DISABLE_VHT		= BIT(1),
1692bab5ab7dSAssaf Krauss 	ASSOC_REQ_USE_RRM		= BIT(2),
16937e7c8926SBen Greear };
16947e7c8926SBen Greear 
16957e7c8926SBen Greear /**
1696636a5d36SJouni Malinen  * struct cfg80211_assoc_request - (Re)Association request data
1697636a5d36SJouni Malinen  *
1698636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
1699636a5d36SJouni Malinen  * (re)association.
1700959867faSJohannes Berg  * @bss: The BSS to associate with. If the call is successful the driver is
1701959867faSJohannes Berg  *	given a reference that it must give back to cfg80211_send_rx_assoc()
1702959867faSJohannes Berg  *	or to cfg80211_assoc_timeout(). To ensure proper refcounting, new
1703959867faSJohannes Berg  *	association requests while already associating must be rejected.
1704636a5d36SJouni Malinen  * @ie: Extra IEs to add to (Re)Association Request frame or %NULL
1705636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
1706dc6382ceSJouni Malinen  * @use_mfp: Use management frame protection (IEEE 802.11w) in this association
1707b23aa676SSamuel Ortiz  * @crypto: crypto settings
17083e5d7649SJohannes Berg  * @prev_bssid: previous BSSID, if not %NULL use reassociate frame
17097e7c8926SBen Greear  * @flags:  See &enum cfg80211_assoc_req_flags
17107e7c8926SBen Greear  * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask
17117e7c8926SBen Greear  *	will be used in ht_capa.  Un-supported values will be ignored.
17127e7c8926SBen Greear  * @ht_capa_mask:  The bits of ht_capa which are to be used.
1713ee2aca34SJohannes Berg  * @vht_capa: VHT capability override
1714ee2aca34SJohannes Berg  * @vht_capa_mask: VHT capability mask indicating which fields to use
1715636a5d36SJouni Malinen  */
1716636a5d36SJouni Malinen struct cfg80211_assoc_request {
171719957bb3SJohannes Berg 	struct cfg80211_bss *bss;
17183e5d7649SJohannes Berg 	const u8 *ie, *prev_bssid;
1719636a5d36SJouni Malinen 	size_t ie_len;
1720b23aa676SSamuel Ortiz 	struct cfg80211_crypto_settings crypto;
172119957bb3SJohannes Berg 	bool use_mfp;
17227e7c8926SBen Greear 	u32 flags;
17237e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa;
17247e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa_mask;
1725ee2aca34SJohannes Berg 	struct ieee80211_vht_cap vht_capa, vht_capa_mask;
1726636a5d36SJouni Malinen };
1727636a5d36SJouni Malinen 
1728636a5d36SJouni Malinen /**
1729636a5d36SJouni Malinen  * struct cfg80211_deauth_request - Deauthentication request data
1730636a5d36SJouni Malinen  *
1731636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
1732636a5d36SJouni Malinen  * deauthentication.
1733636a5d36SJouni Malinen  *
173495de817bSJohannes Berg  * @bssid: the BSSID of the BSS to deauthenticate from
1735636a5d36SJouni Malinen  * @ie: Extra IEs to add to Deauthentication frame or %NULL
1736636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
173719957bb3SJohannes Berg  * @reason_code: The reason code for the deauthentication
1738077f897aSJohannes Berg  * @local_state_change: if set, change local state only and
1739077f897aSJohannes Berg  *	do not set a deauth frame
1740636a5d36SJouni Malinen  */
1741636a5d36SJouni Malinen struct cfg80211_deauth_request {
174295de817bSJohannes Berg 	const u8 *bssid;
1743636a5d36SJouni Malinen 	const u8 *ie;
1744636a5d36SJouni Malinen 	size_t ie_len;
174519957bb3SJohannes Berg 	u16 reason_code;
17466863255bSStanislaw Gruszka 	bool local_state_change;
1747636a5d36SJouni Malinen };
1748636a5d36SJouni Malinen 
1749636a5d36SJouni Malinen /**
1750636a5d36SJouni Malinen  * struct cfg80211_disassoc_request - Disassociation request data
1751636a5d36SJouni Malinen  *
1752636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
1753636a5d36SJouni Malinen  * disassocation.
1754636a5d36SJouni Malinen  *
175519957bb3SJohannes Berg  * @bss: the BSS to disassociate from
1756636a5d36SJouni Malinen  * @ie: Extra IEs to add to Disassociation frame or %NULL
1757636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
175819957bb3SJohannes Berg  * @reason_code: The reason code for the disassociation
1759d5cdfacbSJouni Malinen  * @local_state_change: This is a request for a local state only, i.e., no
1760d5cdfacbSJouni Malinen  *	Disassociation frame is to be transmitted.
1761636a5d36SJouni Malinen  */
1762636a5d36SJouni Malinen struct cfg80211_disassoc_request {
176319957bb3SJohannes Berg 	struct cfg80211_bss *bss;
1764636a5d36SJouni Malinen 	const u8 *ie;
1765636a5d36SJouni Malinen 	size_t ie_len;
176619957bb3SJohannes Berg 	u16 reason_code;
1767d5cdfacbSJouni Malinen 	bool local_state_change;
1768636a5d36SJouni Malinen };
1769636a5d36SJouni Malinen 
1770636a5d36SJouni Malinen /**
177104a773adSJohannes Berg  * struct cfg80211_ibss_params - IBSS parameters
177204a773adSJohannes Berg  *
177304a773adSJohannes Berg  * This structure defines the IBSS parameters for the join_ibss()
177404a773adSJohannes Berg  * method.
177504a773adSJohannes Berg  *
177604a773adSJohannes Berg  * @ssid: The SSID, will always be non-null.
177704a773adSJohannes Berg  * @ssid_len: The length of the SSID, will always be non-zero.
177804a773adSJohannes Berg  * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not
177904a773adSJohannes Berg  *	search for IBSSs with a different BSSID.
1780683b6d3bSJohannes Berg  * @chandef: defines the channel to use if no other IBSS to join can be found
178104a773adSJohannes Berg  * @channel_fixed: The channel should be fixed -- do not search for
178204a773adSJohannes Berg  *	IBSSs to join on other channels.
178304a773adSJohannes Berg  * @ie: information element(s) to include in the beacon
178404a773adSJohannes Berg  * @ie_len: length of that
17858e30bc55SJohannes Berg  * @beacon_interval: beacon interval to use
1786fffd0934SJohannes Berg  * @privacy: this is a protected network, keys will be configured
1787fffd0934SJohannes Berg  *	after joining
1788267335d6SAntonio Quartulli  * @control_port: whether user space controls IEEE 802.1X port, i.e.,
1789267335d6SAntonio Quartulli  *	sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
1790267335d6SAntonio Quartulli  *	required to assume that the port is unauthorized until authorized by
1791267335d6SAntonio Quartulli  *	user space. Otherwise, port is marked authorized by default.
17925336fa88SSimon Wunderlich  * @userspace_handles_dfs: whether user space controls DFS operation, i.e.
17935336fa88SSimon Wunderlich  *	changes the channel when a radar is detected. This is required
17945336fa88SSimon Wunderlich  *	to operate on DFS channels.
1795fbd2c8dcSTeemu Paasikivi  * @basic_rates: bitmap of basic rates to use when creating the IBSS
1796dd5b4cc7SFelix Fietkau  * @mcast_rate: per-band multicast rate index + 1 (0: disabled)
1797803768f5SSimon Wunderlich  * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask
1798803768f5SSimon Wunderlich  *	will be used in ht_capa.  Un-supported values will be ignored.
1799803768f5SSimon Wunderlich  * @ht_capa_mask:  The bits of ht_capa which are to be used.
180004a773adSJohannes Berg  */
180104a773adSJohannes Berg struct cfg80211_ibss_params {
1802c1e5f471SJohannes Berg 	const u8 *ssid;
1803c1e5f471SJohannes Berg 	const u8 *bssid;
1804683b6d3bSJohannes Berg 	struct cfg80211_chan_def chandef;
1805c1e5f471SJohannes Berg 	const u8 *ie;
180604a773adSJohannes Berg 	u8 ssid_len, ie_len;
18078e30bc55SJohannes Berg 	u16 beacon_interval;
1808fbd2c8dcSTeemu Paasikivi 	u32 basic_rates;
180904a773adSJohannes Berg 	bool channel_fixed;
1810fffd0934SJohannes Berg 	bool privacy;
1811267335d6SAntonio Quartulli 	bool control_port;
18125336fa88SSimon Wunderlich 	bool userspace_handles_dfs;
1813dd5b4cc7SFelix Fietkau 	int mcast_rate[IEEE80211_NUM_BANDS];
1814803768f5SSimon Wunderlich 	struct ieee80211_ht_cap ht_capa;
1815803768f5SSimon Wunderlich 	struct ieee80211_ht_cap ht_capa_mask;
181604a773adSJohannes Berg };
181704a773adSJohannes Berg 
181804a773adSJohannes Berg /**
1819b23aa676SSamuel Ortiz  * struct cfg80211_connect_params - Connection parameters
1820b23aa676SSamuel Ortiz  *
1821b23aa676SSamuel Ortiz  * This structure provides information needed to complete IEEE 802.11
1822b23aa676SSamuel Ortiz  * authentication and association.
1823b23aa676SSamuel Ortiz  *
1824b23aa676SSamuel Ortiz  * @channel: The channel to use or %NULL if not specified (auto-select based
1825b23aa676SSamuel Ortiz  *	on scan results)
18261df4a510SJouni Malinen  * @channel_hint: The channel of the recommended BSS for initial connection or
18271df4a510SJouni Malinen  *	%NULL if not specified
1828b23aa676SSamuel Ortiz  * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan
1829b23aa676SSamuel Ortiz  *	results)
18301df4a510SJouni Malinen  * @bssid_hint: The recommended AP BSSID for initial connection to the BSS or
18311df4a510SJouni Malinen  *	%NULL if not specified. Unlike the @bssid parameter, the driver is
18321df4a510SJouni Malinen  *	allowed to ignore this @bssid_hint if it has knowledge of a better BSS
18331df4a510SJouni Malinen  *	to use.
1834b23aa676SSamuel Ortiz  * @ssid: SSID
1835b23aa676SSamuel Ortiz  * @ssid_len: Length of ssid in octets
1836b23aa676SSamuel Ortiz  * @auth_type: Authentication type (algorithm)
1837abe37c4bSJohannes Berg  * @ie: IEs for association request
1838abe37c4bSJohannes Berg  * @ie_len: Length of assoc_ie in octets
1839b23aa676SSamuel Ortiz  * @privacy: indicates whether privacy-enabled APs should be used
1840cee00a95SJouni Malinen  * @mfp: indicate whether management frame protection is used
1841b23aa676SSamuel Ortiz  * @crypto: crypto settings
1842fffd0934SJohannes Berg  * @key_len: length of WEP key for shared key authentication
1843fffd0934SJohannes Berg  * @key_idx: index of WEP key for shared key authentication
1844fffd0934SJohannes Berg  * @key: WEP key for shared key authentication
18457e7c8926SBen Greear  * @flags:  See &enum cfg80211_assoc_req_flags
18464486ea98SBala Shanmugam  * @bg_scan_period:  Background scan period in seconds
18474486ea98SBala Shanmugam  *	or -1 to indicate that default value is to be used.
18487e7c8926SBen Greear  * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask
18497e7c8926SBen Greear  *	will be used in ht_capa.  Un-supported values will be ignored.
18507e7c8926SBen Greear  * @ht_capa_mask:  The bits of ht_capa which are to be used.
1851ee2aca34SJohannes Berg  * @vht_capa:  VHT Capability overrides
1852ee2aca34SJohannes Berg  * @vht_capa_mask: The bits of vht_capa which are to be used.
1853b23aa676SSamuel Ortiz  */
1854b23aa676SSamuel Ortiz struct cfg80211_connect_params {
1855b23aa676SSamuel Ortiz 	struct ieee80211_channel *channel;
18561df4a510SJouni Malinen 	struct ieee80211_channel *channel_hint;
1857664834deSJouni Malinen 	const u8 *bssid;
18581df4a510SJouni Malinen 	const u8 *bssid_hint;
1859664834deSJouni Malinen 	const u8 *ssid;
1860b23aa676SSamuel Ortiz 	size_t ssid_len;
1861b23aa676SSamuel Ortiz 	enum nl80211_auth_type auth_type;
18624b5800feSJohannes Berg 	const u8 *ie;
1863b23aa676SSamuel Ortiz 	size_t ie_len;
1864b23aa676SSamuel Ortiz 	bool privacy;
1865cee00a95SJouni Malinen 	enum nl80211_mfp mfp;
1866b23aa676SSamuel Ortiz 	struct cfg80211_crypto_settings crypto;
1867fffd0934SJohannes Berg 	const u8 *key;
1868fffd0934SJohannes Berg 	u8 key_len, key_idx;
18697e7c8926SBen Greear 	u32 flags;
18704486ea98SBala Shanmugam 	int bg_scan_period;
18717e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa;
18727e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa_mask;
1873ee2aca34SJohannes Berg 	struct ieee80211_vht_cap vht_capa;
1874ee2aca34SJohannes Berg 	struct ieee80211_vht_cap vht_capa_mask;
1875b23aa676SSamuel Ortiz };
1876b23aa676SSamuel Ortiz 
1877b23aa676SSamuel Ortiz /**
1878b9a5f8caSJouni Malinen  * enum wiphy_params_flags - set_wiphy_params bitfield values
1879abe37c4bSJohannes Berg  * @WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed
1880abe37c4bSJohannes Berg  * @WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed
1881abe37c4bSJohannes Berg  * @WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed
1882abe37c4bSJohannes Berg  * @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed
1883abe37c4bSJohannes Berg  * @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed
18843057dbfdSLorenzo Bianconi  * @WIPHY_PARAM_DYN_ACK: dynack has been enabled
1885b9a5f8caSJouni Malinen  */
1886b9a5f8caSJouni Malinen enum wiphy_params_flags {
1887b9a5f8caSJouni Malinen 	WIPHY_PARAM_RETRY_SHORT		= 1 << 0,
1888b9a5f8caSJouni Malinen 	WIPHY_PARAM_RETRY_LONG		= 1 << 1,
1889b9a5f8caSJouni Malinen 	WIPHY_PARAM_FRAG_THRESHOLD	= 1 << 2,
1890b9a5f8caSJouni Malinen 	WIPHY_PARAM_RTS_THRESHOLD	= 1 << 3,
189181077e82SLukáš Turek 	WIPHY_PARAM_COVERAGE_CLASS	= 1 << 4,
18923057dbfdSLorenzo Bianconi 	WIPHY_PARAM_DYN_ACK		= 1 << 5,
1893b9a5f8caSJouni Malinen };
1894b9a5f8caSJouni Malinen 
18959930380fSJohannes Berg /*
18969930380fSJohannes Berg  * cfg80211_bitrate_mask - masks for bitrate control
18979930380fSJohannes Berg  */
18989930380fSJohannes Berg struct cfg80211_bitrate_mask {
18999930380fSJohannes Berg 	struct {
19009930380fSJohannes Berg 		u32 legacy;
1901d1e33e65SJanusz Dziedzic 		u8 ht_mcs[IEEE80211_HT_MCS_MASK_LEN];
1902204e35a9SJanusz Dziedzic 		u16 vht_mcs[NL80211_VHT_NSS_MAX];
19030b9323f6SJanusz Dziedzic 		enum nl80211_txrate_gi gi;
19049930380fSJohannes Berg 	} control[IEEE80211_NUM_BANDS];
19059930380fSJohannes Berg };
190667fbb16bSSamuel Ortiz /**
190767fbb16bSSamuel Ortiz  * struct cfg80211_pmksa - PMK Security Association
190867fbb16bSSamuel Ortiz  *
190967fbb16bSSamuel Ortiz  * This structure is passed to the set/del_pmksa() method for PMKSA
191067fbb16bSSamuel Ortiz  * caching.
191167fbb16bSSamuel Ortiz  *
191267fbb16bSSamuel Ortiz  * @bssid: The AP's BSSID.
191367fbb16bSSamuel Ortiz  * @pmkid: The PMK material itself.
191467fbb16bSSamuel Ortiz  */
191567fbb16bSSamuel Ortiz struct cfg80211_pmksa {
1916c1e5f471SJohannes Berg 	const u8 *bssid;
1917c1e5f471SJohannes Berg 	const u8 *pmkid;
191867fbb16bSSamuel Ortiz };
19199930380fSJohannes Berg 
19207643a2c3SJohannes Berg /**
192150ac6607SAmitkumar Karwar  * struct cfg80211_pkt_pattern - packet pattern
1922ff1b6e69SJohannes Berg  * @mask: bitmask where to match pattern and where to ignore bytes,
1923ff1b6e69SJohannes Berg  *	one bit per byte, in same format as nl80211
1924ff1b6e69SJohannes Berg  * @pattern: bytes to match where bitmask is 1
1925ff1b6e69SJohannes Berg  * @pattern_len: length of pattern (in bytes)
1926bb92d199SAmitkumar Karwar  * @pkt_offset: packet offset (in bytes)
1927ff1b6e69SJohannes Berg  *
1928ff1b6e69SJohannes Berg  * Internal note: @mask and @pattern are allocated in one chunk of
1929ff1b6e69SJohannes Berg  * memory, free @mask only!
1930ff1b6e69SJohannes Berg  */
193150ac6607SAmitkumar Karwar struct cfg80211_pkt_pattern {
1932922bd80fSJohannes Berg 	const u8 *mask, *pattern;
1933ff1b6e69SJohannes Berg 	int pattern_len;
1934bb92d199SAmitkumar Karwar 	int pkt_offset;
1935ff1b6e69SJohannes Berg };
1936ff1b6e69SJohannes Berg 
1937ff1b6e69SJohannes Berg /**
19382a0e047eSJohannes Berg  * struct cfg80211_wowlan_tcp - TCP connection parameters
19392a0e047eSJohannes Berg  *
19402a0e047eSJohannes Berg  * @sock: (internal) socket for source port allocation
19412a0e047eSJohannes Berg  * @src: source IP address
19422a0e047eSJohannes Berg  * @dst: destination IP address
19432a0e047eSJohannes Berg  * @dst_mac: destination MAC address
19442a0e047eSJohannes Berg  * @src_port: source port
19452a0e047eSJohannes Berg  * @dst_port: destination port
19462a0e047eSJohannes Berg  * @payload_len: data payload length
19472a0e047eSJohannes Berg  * @payload: data payload buffer
19482a0e047eSJohannes Berg  * @payload_seq: payload sequence stamping configuration
19492a0e047eSJohannes Berg  * @data_interval: interval at which to send data packets
19502a0e047eSJohannes Berg  * @wake_len: wakeup payload match length
19512a0e047eSJohannes Berg  * @wake_data: wakeup payload match data
19522a0e047eSJohannes Berg  * @wake_mask: wakeup payload match mask
19532a0e047eSJohannes Berg  * @tokens_size: length of the tokens buffer
19542a0e047eSJohannes Berg  * @payload_tok: payload token usage configuration
19552a0e047eSJohannes Berg  */
19562a0e047eSJohannes Berg struct cfg80211_wowlan_tcp {
19572a0e047eSJohannes Berg 	struct socket *sock;
19582a0e047eSJohannes Berg 	__be32 src, dst;
19592a0e047eSJohannes Berg 	u16 src_port, dst_port;
19602a0e047eSJohannes Berg 	u8 dst_mac[ETH_ALEN];
19612a0e047eSJohannes Berg 	int payload_len;
19622a0e047eSJohannes Berg 	const u8 *payload;
19632a0e047eSJohannes Berg 	struct nl80211_wowlan_tcp_data_seq payload_seq;
19642a0e047eSJohannes Berg 	u32 data_interval;
19652a0e047eSJohannes Berg 	u32 wake_len;
19662a0e047eSJohannes Berg 	const u8 *wake_data, *wake_mask;
19672a0e047eSJohannes Berg 	u32 tokens_size;
19682a0e047eSJohannes Berg 	/* must be last, variable member */
19692a0e047eSJohannes Berg 	struct nl80211_wowlan_tcp_data_token payload_tok;
1970ff1b6e69SJohannes Berg };
1971ff1b6e69SJohannes Berg 
1972ff1b6e69SJohannes Berg /**
1973ff1b6e69SJohannes Berg  * struct cfg80211_wowlan - Wake on Wireless-LAN support info
1974ff1b6e69SJohannes Berg  *
1975ff1b6e69SJohannes Berg  * This structure defines the enabled WoWLAN triggers for the device.
1976ff1b6e69SJohannes Berg  * @any: wake up on any activity -- special trigger if device continues
1977ff1b6e69SJohannes Berg  *	operating as normal during suspend
1978ff1b6e69SJohannes Berg  * @disconnect: wake up if getting disconnected
1979ff1b6e69SJohannes Berg  * @magic_pkt: wake up on receiving magic packet
1980ff1b6e69SJohannes Berg  * @patterns: wake up on receiving packet matching a pattern
1981ff1b6e69SJohannes Berg  * @n_patterns: number of patterns
198277dbbb13SJohannes Berg  * @gtk_rekey_failure: wake up on GTK rekey failure
198377dbbb13SJohannes Berg  * @eap_identity_req: wake up on EAP identity request packet
198477dbbb13SJohannes Berg  * @four_way_handshake: wake up on 4-way handshake
198577dbbb13SJohannes Berg  * @rfkill_release: wake up when rfkill is released
19862a0e047eSJohannes Berg  * @tcp: TCP connection establishment/wakeup parameters, see nl80211.h.
19872a0e047eSJohannes Berg  *	NULL if not configured.
19888cd4d456SLuciano Coelho  * @nd_config: configuration for the scan to be used for net detect wake.
1989ff1b6e69SJohannes Berg  */
1990ff1b6e69SJohannes Berg struct cfg80211_wowlan {
199177dbbb13SJohannes Berg 	bool any, disconnect, magic_pkt, gtk_rekey_failure,
199277dbbb13SJohannes Berg 	     eap_identity_req, four_way_handshake,
199377dbbb13SJohannes Berg 	     rfkill_release;
199450ac6607SAmitkumar Karwar 	struct cfg80211_pkt_pattern *patterns;
19952a0e047eSJohannes Berg 	struct cfg80211_wowlan_tcp *tcp;
1996ff1b6e69SJohannes Berg 	int n_patterns;
19978cd4d456SLuciano Coelho 	struct cfg80211_sched_scan_request *nd_config;
1998ff1b6e69SJohannes Berg };
1999ff1b6e69SJohannes Berg 
2000ff1b6e69SJohannes Berg /**
2001be29b99aSAmitkumar Karwar  * struct cfg80211_coalesce_rules - Coalesce rule parameters
2002be29b99aSAmitkumar Karwar  *
2003be29b99aSAmitkumar Karwar  * This structure defines coalesce rule for the device.
2004be29b99aSAmitkumar Karwar  * @delay: maximum coalescing delay in msecs.
2005be29b99aSAmitkumar Karwar  * @condition: condition for packet coalescence.
2006be29b99aSAmitkumar Karwar  *	see &enum nl80211_coalesce_condition.
2007be29b99aSAmitkumar Karwar  * @patterns: array of packet patterns
2008be29b99aSAmitkumar Karwar  * @n_patterns: number of patterns
2009be29b99aSAmitkumar Karwar  */
2010be29b99aSAmitkumar Karwar struct cfg80211_coalesce_rules {
2011be29b99aSAmitkumar Karwar 	int delay;
2012be29b99aSAmitkumar Karwar 	enum nl80211_coalesce_condition condition;
2013be29b99aSAmitkumar Karwar 	struct cfg80211_pkt_pattern *patterns;
2014be29b99aSAmitkumar Karwar 	int n_patterns;
2015be29b99aSAmitkumar Karwar };
2016be29b99aSAmitkumar Karwar 
2017be29b99aSAmitkumar Karwar /**
2018be29b99aSAmitkumar Karwar  * struct cfg80211_coalesce - Packet coalescing settings
2019be29b99aSAmitkumar Karwar  *
2020be29b99aSAmitkumar Karwar  * This structure defines coalescing settings.
2021be29b99aSAmitkumar Karwar  * @rules: array of coalesce rules
2022be29b99aSAmitkumar Karwar  * @n_rules: number of rules
2023be29b99aSAmitkumar Karwar  */
2024be29b99aSAmitkumar Karwar struct cfg80211_coalesce {
2025be29b99aSAmitkumar Karwar 	struct cfg80211_coalesce_rules *rules;
2026be29b99aSAmitkumar Karwar 	int n_rules;
2027be29b99aSAmitkumar Karwar };
2028be29b99aSAmitkumar Karwar 
2029be29b99aSAmitkumar Karwar /**
20308cd4d456SLuciano Coelho  * struct cfg80211_wowlan_nd_match - information about the match
20318cd4d456SLuciano Coelho  *
20328cd4d456SLuciano Coelho  * @ssid: SSID of the match that triggered the wake up
20338cd4d456SLuciano Coelho  * @n_channels: Number of channels where the match occurred.  This
20348cd4d456SLuciano Coelho  *	value may be zero if the driver can't report the channels.
20358cd4d456SLuciano Coelho  * @channels: center frequencies of the channels where a match
20368cd4d456SLuciano Coelho  *	occurred (in MHz)
20378cd4d456SLuciano Coelho  */
20388cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_match {
20398cd4d456SLuciano Coelho 	struct cfg80211_ssid ssid;
20408cd4d456SLuciano Coelho 	int n_channels;
20418cd4d456SLuciano Coelho 	u32 channels[];
20428cd4d456SLuciano Coelho };
20438cd4d456SLuciano Coelho 
20448cd4d456SLuciano Coelho /**
20458cd4d456SLuciano Coelho  * struct cfg80211_wowlan_nd_info - net detect wake up information
20468cd4d456SLuciano Coelho  *
20478cd4d456SLuciano Coelho  * @n_matches: Number of match information instances provided in
20488cd4d456SLuciano Coelho  *	@matches.  This value may be zero if the driver can't provide
20498cd4d456SLuciano Coelho  *	match information.
20508cd4d456SLuciano Coelho  * @matches: Array of pointers to matches containing information about
20518cd4d456SLuciano Coelho  *	the matches that triggered the wake up.
20528cd4d456SLuciano Coelho  */
20538cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_info {
20548cd4d456SLuciano Coelho 	int n_matches;
20558cd4d456SLuciano Coelho 	struct cfg80211_wowlan_nd_match *matches[];
20568cd4d456SLuciano Coelho };
20578cd4d456SLuciano Coelho 
20588cd4d456SLuciano Coelho /**
2059cd8f7cb4SJohannes Berg  * struct cfg80211_wowlan_wakeup - wakeup report
2060cd8f7cb4SJohannes Berg  * @disconnect: woke up by getting disconnected
2061cd8f7cb4SJohannes Berg  * @magic_pkt: woke up by receiving magic packet
2062cd8f7cb4SJohannes Berg  * @gtk_rekey_failure: woke up by GTK rekey failure
2063cd8f7cb4SJohannes Berg  * @eap_identity_req: woke up by EAP identity request packet
2064cd8f7cb4SJohannes Berg  * @four_way_handshake: woke up by 4-way handshake
2065cd8f7cb4SJohannes Berg  * @rfkill_release: woke up by rfkill being released
2066cd8f7cb4SJohannes Berg  * @pattern_idx: pattern that caused wakeup, -1 if not due to pattern
2067cd8f7cb4SJohannes Berg  * @packet_present_len: copied wakeup packet data
2068cd8f7cb4SJohannes Berg  * @packet_len: original wakeup packet length
2069cd8f7cb4SJohannes Berg  * @packet: The packet causing the wakeup, if any.
2070cd8f7cb4SJohannes Berg  * @packet_80211:  For pattern match, magic packet and other data
2071cd8f7cb4SJohannes Berg  *	frame triggers an 802.3 frame should be reported, for
2072cd8f7cb4SJohannes Berg  *	disconnect due to deauth 802.11 frame. This indicates which
2073cd8f7cb4SJohannes Berg  *	it is.
20742a0e047eSJohannes Berg  * @tcp_match: TCP wakeup packet received
20752a0e047eSJohannes Berg  * @tcp_connlost: TCP connection lost or failed to establish
20762a0e047eSJohannes Berg  * @tcp_nomoretokens: TCP data ran out of tokens
20778cd4d456SLuciano Coelho  * @net_detect: if not %NULL, woke up because of net detect
2078cd8f7cb4SJohannes Berg  */
2079cd8f7cb4SJohannes Berg struct cfg80211_wowlan_wakeup {
2080cd8f7cb4SJohannes Berg 	bool disconnect, magic_pkt, gtk_rekey_failure,
2081cd8f7cb4SJohannes Berg 	     eap_identity_req, four_way_handshake,
20822a0e047eSJohannes Berg 	     rfkill_release, packet_80211,
20832a0e047eSJohannes Berg 	     tcp_match, tcp_connlost, tcp_nomoretokens;
2084cd8f7cb4SJohannes Berg 	s32 pattern_idx;
2085cd8f7cb4SJohannes Berg 	u32 packet_present_len, packet_len;
2086cd8f7cb4SJohannes Berg 	const void *packet;
20878cd4d456SLuciano Coelho 	struct cfg80211_wowlan_nd_info *net_detect;
2088cd8f7cb4SJohannes Berg };
2089cd8f7cb4SJohannes Berg 
2090cd8f7cb4SJohannes Berg /**
2091e5497d76SJohannes Berg  * struct cfg80211_gtk_rekey_data - rekey data
209278f686caSJohannes Berg  * @kek: key encryption key (NL80211_KEK_LEN bytes)
209378f686caSJohannes Berg  * @kck: key confirmation key (NL80211_KCK_LEN bytes)
209478f686caSJohannes Berg  * @replay_ctr: replay counter (NL80211_REPLAY_CTR_LEN bytes)
2095e5497d76SJohannes Berg  */
2096e5497d76SJohannes Berg struct cfg80211_gtk_rekey_data {
209778f686caSJohannes Berg 	const u8 *kek, *kck, *replay_ctr;
2098e5497d76SJohannes Berg };
2099e5497d76SJohannes Berg 
2100e5497d76SJohannes Berg /**
2101355199e0SJouni Malinen  * struct cfg80211_update_ft_ies_params - FT IE Information
2102355199e0SJouni Malinen  *
2103355199e0SJouni Malinen  * This structure provides information needed to update the fast transition IE
2104355199e0SJouni Malinen  *
2105355199e0SJouni Malinen  * @md: The Mobility Domain ID, 2 Octet value
2106355199e0SJouni Malinen  * @ie: Fast Transition IEs
2107355199e0SJouni Malinen  * @ie_len: Length of ft_ie in octets
2108355199e0SJouni Malinen  */
2109355199e0SJouni Malinen struct cfg80211_update_ft_ies_params {
2110355199e0SJouni Malinen 	u16 md;
2111355199e0SJouni Malinen 	const u8 *ie;
2112355199e0SJouni Malinen 	size_t ie_len;
2113355199e0SJouni Malinen };
2114355199e0SJouni Malinen 
2115355199e0SJouni Malinen /**
2116b176e629SAndrei Otcheretianski  * struct cfg80211_mgmt_tx_params - mgmt tx parameters
2117b176e629SAndrei Otcheretianski  *
2118b176e629SAndrei Otcheretianski  * This structure provides information needed to transmit a mgmt frame
2119b176e629SAndrei Otcheretianski  *
2120b176e629SAndrei Otcheretianski  * @chan: channel to use
2121b176e629SAndrei Otcheretianski  * @offchan: indicates wether off channel operation is required
2122b176e629SAndrei Otcheretianski  * @wait: duration for ROC
2123b176e629SAndrei Otcheretianski  * @buf: buffer to transmit
2124b176e629SAndrei Otcheretianski  * @len: buffer length
2125b176e629SAndrei Otcheretianski  * @no_cck: don't use cck rates for this frame
2126b176e629SAndrei Otcheretianski  * @dont_wait_for_ack: tells the low level not to wait for an ack
212734d22ce2SAndrei Otcheretianski  * @n_csa_offsets: length of csa_offsets array
212834d22ce2SAndrei Otcheretianski  * @csa_offsets: array of all the csa offsets in the frame
2129b176e629SAndrei Otcheretianski  */
2130b176e629SAndrei Otcheretianski struct cfg80211_mgmt_tx_params {
2131b176e629SAndrei Otcheretianski 	struct ieee80211_channel *chan;
2132b176e629SAndrei Otcheretianski 	bool offchan;
2133b176e629SAndrei Otcheretianski 	unsigned int wait;
2134b176e629SAndrei Otcheretianski 	const u8 *buf;
2135b176e629SAndrei Otcheretianski 	size_t len;
2136b176e629SAndrei Otcheretianski 	bool no_cck;
2137b176e629SAndrei Otcheretianski 	bool dont_wait_for_ack;
213834d22ce2SAndrei Otcheretianski 	int n_csa_offsets;
213934d22ce2SAndrei Otcheretianski 	const u16 *csa_offsets;
2140b176e629SAndrei Otcheretianski };
2141b176e629SAndrei Otcheretianski 
2142b176e629SAndrei Otcheretianski /**
2143fa9ffc74SKyeyoon Park  * struct cfg80211_dscp_exception - DSCP exception
2144fa9ffc74SKyeyoon Park  *
2145fa9ffc74SKyeyoon Park  * @dscp: DSCP value that does not adhere to the user priority range definition
2146fa9ffc74SKyeyoon Park  * @up: user priority value to which the corresponding DSCP value belongs
2147fa9ffc74SKyeyoon Park  */
2148fa9ffc74SKyeyoon Park struct cfg80211_dscp_exception {
2149fa9ffc74SKyeyoon Park 	u8 dscp;
2150fa9ffc74SKyeyoon Park 	u8 up;
2151fa9ffc74SKyeyoon Park };
2152fa9ffc74SKyeyoon Park 
2153fa9ffc74SKyeyoon Park /**
2154fa9ffc74SKyeyoon Park  * struct cfg80211_dscp_range - DSCP range definition for user priority
2155fa9ffc74SKyeyoon Park  *
2156fa9ffc74SKyeyoon Park  * @low: lowest DSCP value of this user priority range, inclusive
2157fa9ffc74SKyeyoon Park  * @high: highest DSCP value of this user priority range, inclusive
2158fa9ffc74SKyeyoon Park  */
2159fa9ffc74SKyeyoon Park struct cfg80211_dscp_range {
2160fa9ffc74SKyeyoon Park 	u8 low;
2161fa9ffc74SKyeyoon Park 	u8 high;
2162fa9ffc74SKyeyoon Park };
2163fa9ffc74SKyeyoon Park 
2164fa9ffc74SKyeyoon Park /* QoS Map Set element length defined in IEEE Std 802.11-2012, 8.4.2.97 */
2165fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_MAX_EX	21
2166fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_LEN_MIN	16
2167fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_LEN_MAX \
2168fa9ffc74SKyeyoon Park 	(IEEE80211_QOS_MAP_LEN_MIN + 2 * IEEE80211_QOS_MAP_MAX_EX)
2169fa9ffc74SKyeyoon Park 
2170fa9ffc74SKyeyoon Park /**
2171fa9ffc74SKyeyoon Park  * struct cfg80211_qos_map - QoS Map Information
2172fa9ffc74SKyeyoon Park  *
2173fa9ffc74SKyeyoon Park  * This struct defines the Interworking QoS map setting for DSCP values
2174fa9ffc74SKyeyoon Park  *
2175fa9ffc74SKyeyoon Park  * @num_des: number of DSCP exceptions (0..21)
2176fa9ffc74SKyeyoon Park  * @dscp_exception: optionally up to maximum of 21 DSCP exceptions from
2177fa9ffc74SKyeyoon Park  *	the user priority DSCP range definition
2178fa9ffc74SKyeyoon Park  * @up: DSCP range definition for a particular user priority
2179fa9ffc74SKyeyoon Park  */
2180fa9ffc74SKyeyoon Park struct cfg80211_qos_map {
2181fa9ffc74SKyeyoon Park 	u8 num_des;
2182fa9ffc74SKyeyoon Park 	struct cfg80211_dscp_exception dscp_exception[IEEE80211_QOS_MAP_MAX_EX];
2183fa9ffc74SKyeyoon Park 	struct cfg80211_dscp_range up[8];
2184fa9ffc74SKyeyoon Park };
2185fa9ffc74SKyeyoon Park 
2186fa9ffc74SKyeyoon Park /**
2187704232c2SJohannes Berg  * struct cfg80211_ops - backend description for wireless configuration
2188704232c2SJohannes Berg  *
2189704232c2SJohannes Berg  * This struct is registered by fullmac card drivers and/or wireless stacks
2190704232c2SJohannes Berg  * in order to handle configuration requests on their interfaces.
2191704232c2SJohannes Berg  *
2192704232c2SJohannes Berg  * All callbacks except where otherwise noted should return 0
2193704232c2SJohannes Berg  * on success or a negative error code.
2194704232c2SJohannes Berg  *
219543fb45cbSJohannes Berg  * All operations are currently invoked under rtnl for consistency with the
219643fb45cbSJohannes Berg  * wireless extensions but this is subject to reevaluation as soon as this
219743fb45cbSJohannes Berg  * code is used more widely and we have a first user without wext.
219843fb45cbSJohannes Berg  *
2199ff1b6e69SJohannes Berg  * @suspend: wiphy device needs to be suspended. The variable @wow will
2200ff1b6e69SJohannes Berg  *	be %NULL or contain the enabled Wake-on-Wireless triggers that are
2201ff1b6e69SJohannes Berg  *	configured for the device.
22020378b3f1SJohannes Berg  * @resume: wiphy device needs to be resumed
22036d52563fSJohannes Berg  * @set_wakeup: Called when WoWLAN is enabled/disabled, use this callback
22046d52563fSJohannes Berg  *	to call device_set_wakeup_enable() to enable/disable wakeup from
22056d52563fSJohannes Berg  *	the device.
22060378b3f1SJohannes Berg  *
220760719ffdSJohannes Berg  * @add_virtual_intf: create a new virtual interface with the given name,
2208463d0183SJohannes Berg  *	must set the struct wireless_dev's iftype. Beware: You must create
220984efbb84SJohannes Berg  *	the new netdev in the wiphy's network namespace! Returns the struct
221098104fdeSJohannes Berg  *	wireless_dev, or an ERR_PTR. For P2P device wdevs, the driver must
221198104fdeSJohannes Berg  *	also set the address member in the wdev.
2212704232c2SJohannes Berg  *
221384efbb84SJohannes Berg  * @del_virtual_intf: remove the virtual interface
221455682965SJohannes Berg  *
221560719ffdSJohannes Berg  * @change_virtual_intf: change type/configuration of virtual interface,
221660719ffdSJohannes Berg  *	keep the struct wireless_dev's iftype updated.
221755682965SJohannes Berg  *
221841ade00fSJohannes Berg  * @add_key: add a key with the given parameters. @mac_addr will be %NULL
221941ade00fSJohannes Berg  *	when adding a group key.
222041ade00fSJohannes Berg  *
222141ade00fSJohannes Berg  * @get_key: get information about the key with the given parameters.
222241ade00fSJohannes Berg  *	@mac_addr will be %NULL when requesting information for a group
222341ade00fSJohannes Berg  *	key. All pointers given to the @callback function need not be valid
2224e3da574aSJohannes Berg  *	after it returns. This function should return an error if it is
2225e3da574aSJohannes Berg  *	not possible to retrieve the key, -ENOENT if it doesn't exist.
222641ade00fSJohannes Berg  *
222741ade00fSJohannes Berg  * @del_key: remove a key given the @mac_addr (%NULL for a group key)
2228e3da574aSJohannes Berg  *	and @key_index, return -ENOENT if the key doesn't exist.
222941ade00fSJohannes Berg  *
223041ade00fSJohannes Berg  * @set_default_key: set the default key on an interface
2231ed1b6cc7SJohannes Berg  *
22323cfcf6acSJouni Malinen  * @set_default_mgmt_key: set the default management frame key on an interface
22333cfcf6acSJouni Malinen  *
2234e5497d76SJohannes Berg  * @set_rekey_data: give the data necessary for GTK rekeying to the driver
2235e5497d76SJohannes Berg  *
2236c04a4ff7SJohannes Berg  * @start_ap: Start acting in AP mode defined by the parameters.
2237c04a4ff7SJohannes Berg  * @change_beacon: Change the beacon parameters for an access point mode
2238c04a4ff7SJohannes Berg  *	interface. This should reject the call when AP mode wasn't started.
2239c04a4ff7SJohannes Berg  * @stop_ap: Stop being an AP, including stopping beaconing.
22405727ef1bSJohannes Berg  *
22415727ef1bSJohannes Berg  * @add_station: Add a new station.
224289c771e5SJouni Malinen  * @del_station: Remove a station
2243bdd90d5eSJohannes Berg  * @change_station: Modify a given station. Note that flags changes are not much
2244bdd90d5eSJohannes Berg  *	validated in cfg80211, in particular the auth/assoc/authorized flags
2245bdd90d5eSJohannes Berg  *	might come to the driver in invalid combinations -- make sure to check
224677ee7c89SJohannes Berg  *	them, also against the existing state! Drivers must call
224777ee7c89SJohannes Berg  *	cfg80211_check_station_change() to validate the information.
2248abe37c4bSJohannes Berg  * @get_station: get station information for the station identified by @mac
2249abe37c4bSJohannes Berg  * @dump_station: dump station callback -- resume dump at index @idx
2250abe37c4bSJohannes Berg  *
2251abe37c4bSJohannes Berg  * @add_mpath: add a fixed mesh path
2252abe37c4bSJohannes Berg  * @del_mpath: delete a given mesh path
2253abe37c4bSJohannes Berg  * @change_mpath: change a given mesh path
2254abe37c4bSJohannes Berg  * @get_mpath: get a mesh path for the given parameters
2255abe37c4bSJohannes Berg  * @dump_mpath: dump mesh path callback -- resume dump at index @idx
225666be7d2bSHenning Rogge  * @get_mpp: get a mesh proxy path for the given parameters
225766be7d2bSHenning Rogge  * @dump_mpp: dump mesh proxy path callback -- resume dump at index @idx
2258f52555a4SJohannes Berg  * @join_mesh: join the mesh network with the specified parameters
22598d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
2260f52555a4SJohannes Berg  * @leave_mesh: leave the current mesh network
22618d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
22622ec600d6SLuis Carlos Cobo  *
226324bdd9f4SJavier Cardona  * @get_mesh_config: Get the current mesh configuration
226493da9cc1Scolin@cozybit.com  *
226524bdd9f4SJavier Cardona  * @update_mesh_config: Update mesh parameters on a running mesh.
226693da9cc1Scolin@cozybit.com  *	The mask is a bitfield which tells us which parameters to
226793da9cc1Scolin@cozybit.com  *	set, and which to leave alone.
226893da9cc1Scolin@cozybit.com  *
22699f1ba906SJouni Malinen  * @change_bss: Modify parameters for a given BSS.
227031888487SJouni Malinen  *
227131888487SJouni Malinen  * @set_txq_params: Set TX queue parameters
227272bdcf34SJouni Malinen  *
2273e8c9bd5bSJohannes Berg  * @libertas_set_mesh_channel: Only for backward compatibility for libertas,
2274e8c9bd5bSJohannes Berg  *	as it doesn't implement join_mesh and needs to set the channel to
2275e8c9bd5bSJohannes Berg  *	join the mesh instead.
2276e8c9bd5bSJohannes Berg  *
2277e8c9bd5bSJohannes Berg  * @set_monitor_channel: Set the monitor mode channel for the device. If other
2278e8c9bd5bSJohannes Berg  *	interfaces are active this callback should reject the configuration.
2279e8c9bd5bSJohannes Berg  *	If no interfaces are active or the device is down, the channel should
2280e8c9bd5bSJohannes Berg  *	be stored for when a monitor interface becomes active.
22819aed3cc1SJouni Malinen  *
22822a519311SJohannes Berg  * @scan: Request to do a scan. If returning zero, the scan request is given
22832a519311SJohannes Berg  *	the driver, and will be valid until passed to cfg80211_scan_done().
22842a519311SJohannes Berg  *	For scan results, call cfg80211_inform_bss(); you can call this outside
22852a519311SJohannes Berg  *	the scan/scan_done bracket too.
2286636a5d36SJouni Malinen  *
2287636a5d36SJouni Malinen  * @auth: Request to authenticate with the specified peer
22888d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
2289636a5d36SJouni Malinen  * @assoc: Request to (re)associate with the specified peer
22908d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
2291636a5d36SJouni Malinen  * @deauth: Request to deauthenticate from the specified peer
22928d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
2293636a5d36SJouni Malinen  * @disassoc: Request to disassociate from the specified peer
22948d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
229504a773adSJohannes Berg  *
2296b23aa676SSamuel Ortiz  * @connect: Connect to the ESS with the specified parameters. When connected,
2297b23aa676SSamuel Ortiz  *	call cfg80211_connect_result() with status code %WLAN_STATUS_SUCCESS.
2298b23aa676SSamuel Ortiz  *	If the connection fails for some reason, call cfg80211_connect_result()
2299b23aa676SSamuel Ortiz  *	with the status from the AP.
23008d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
2301b23aa676SSamuel Ortiz  * @disconnect: Disconnect from the BSS/ESS.
23028d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
2303b23aa676SSamuel Ortiz  *
230404a773adSJohannes Berg  * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call
230504a773adSJohannes Berg  *	cfg80211_ibss_joined(), also call that function when changing BSSID due
230604a773adSJohannes Berg  *	to a merge.
23078d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
230804a773adSJohannes Berg  * @leave_ibss: Leave the IBSS.
23098d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
2310b9a5f8caSJouni Malinen  *
2311f4e583c8SAntonio Quartulli  * @set_mcast_rate: Set the specified multicast rate (only if vif is in ADHOC or
2312f4e583c8SAntonio Quartulli  *	MESH mode)
2313f4e583c8SAntonio Quartulli  *
2314b9a5f8caSJouni Malinen  * @set_wiphy_params: Notify that wiphy parameters have changed;
2315b9a5f8caSJouni Malinen  *	@changed bitfield (see &enum wiphy_params_flags) describes which values
2316b9a5f8caSJouni Malinen  *	have changed. The actual parameter values are available in
2317b9a5f8caSJouni Malinen  *	struct wiphy. If returning an error, no value should be changed.
23187643a2c3SJohannes Berg  *
23191432de07SLuis R. Rodriguez  * @set_tx_power: set the transmit power according to the parameters,
2320c8442118SJohannes Berg  *	the power passed is in mBm, to get dBm use MBM_TO_DBM(). The
2321c8442118SJohannes Berg  *	wdev may be %NULL if power was set for the wiphy, and will
2322c8442118SJohannes Berg  *	always be %NULL unless the driver supports per-vif TX power
2323c8442118SJohannes Berg  *	(as advertised by the nl80211 feature flag.)
23247643a2c3SJohannes Berg  * @get_tx_power: store the current TX power into the dbm variable;
23251f87f7d3SJohannes Berg  *	return 0 if successful
23261f87f7d3SJohannes Berg  *
2327abe37c4bSJohannes Berg  * @set_wds_peer: set the WDS peer for a WDS interface
2328abe37c4bSJohannes Berg  *
23291f87f7d3SJohannes Berg  * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting
23301f87f7d3SJohannes Berg  *	functions to adjust rfkill hw state
2331aff89a9bSJohannes Berg  *
233261fa713cSHolger Schurig  * @dump_survey: get site survey information.
233361fa713cSHolger Schurig  *
23349588bbd5SJouni Malinen  * @remain_on_channel: Request the driver to remain awake on the specified
23359588bbd5SJouni Malinen  *	channel for the specified duration to complete an off-channel
23369588bbd5SJouni Malinen  *	operation (e.g., public action frame exchange). When the driver is
23379588bbd5SJouni Malinen  *	ready on the requested channel, it must indicate this with an event
23389588bbd5SJouni Malinen  *	notification by calling cfg80211_ready_on_channel().
23399588bbd5SJouni Malinen  * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation.
23409588bbd5SJouni Malinen  *	This allows the operation to be terminated prior to timeout based on
23419588bbd5SJouni Malinen  *	the duration value.
2342f7ca38dfSJohannes Berg  * @mgmt_tx: Transmit a management frame.
2343f7ca38dfSJohannes Berg  * @mgmt_tx_cancel_wait: Cancel the wait time from transmitting a management
2344f7ca38dfSJohannes Berg  *	frame on another channel
23459588bbd5SJouni Malinen  *
2346fc73f11fSDavid Spinadel  * @testmode_cmd: run a test mode command; @wdev may be %NULL
234771063f0eSWey-Yi Guy  * @testmode_dump: Implement a test mode dump. The cb->args[2] and up may be
234871063f0eSWey-Yi Guy  *	used by the function, but 0 and 1 must not be touched. Additionally,
234971063f0eSWey-Yi Guy  *	return error codes other than -ENOBUFS and -ENOENT will terminate the
235071063f0eSWey-Yi Guy  *	dump and return to userspace with an error, so be careful. If any data
235171063f0eSWey-Yi Guy  *	was passed in from userspace then the data/len arguments will be present
235271063f0eSWey-Yi Guy  *	and point to the data contained in %NL80211_ATTR_TESTDATA.
235367fbb16bSSamuel Ortiz  *
2354abe37c4bSJohannes Berg  * @set_bitrate_mask: set the bitrate mask configuration
2355abe37c4bSJohannes Berg  *
235667fbb16bSSamuel Ortiz  * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac
235767fbb16bSSamuel Ortiz  *	devices running firmwares capable of generating the (re) association
235867fbb16bSSamuel Ortiz  *	RSN IE. It allows for faster roaming between WPA2 BSSIDs.
235967fbb16bSSamuel Ortiz  * @del_pmksa: Delete a cached PMKID.
236067fbb16bSSamuel Ortiz  * @flush_pmksa: Flush all cached PMKIDs.
23619043f3b8SJuuso Oikarinen  * @set_power_mgmt: Configure WLAN power management. A timeout value of -1
23629043f3b8SJuuso Oikarinen  *	allows the driver to adjust the dynamic ps timeout value.
2363d6dc1a38SJuuso Oikarinen  * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold.
236484f10708SThomas Pedersen  * @set_cqm_txe_config: Configure connection quality monitor TX error
236584f10708SThomas Pedersen  *	thresholds.
2366807f8a8cSLuciano Coelho  * @sched_scan_start: Tell the driver to start a scheduled scan.
2367d9b8396aSJohannes Berg  * @sched_scan_stop: Tell the driver to stop an ongoing scheduled scan. This
2368d9b8396aSJohannes Berg  *	call must stop the scheduled scan and be ready for starting a new one
2369d9b8396aSJohannes Berg  *	before it returns, i.e. @sched_scan_start may be called immediately
2370d9b8396aSJohannes Berg  *	after that again and should not fail in that case. The driver should
2371d9b8396aSJohannes Berg  *	not call cfg80211_sched_scan_stopped() for a requested stop (when this
2372d9b8396aSJohannes Berg  *	method returns 0.)
237367fbb16bSSamuel Ortiz  *
2374271733cfSJohannes Berg  * @mgmt_frame_register: Notify driver that a management frame type was
237533d8783cSJohannes Berg  *	registered. The callback is allowed to sleep.
2376547025d5SBruno Randolf  *
2377547025d5SBruno Randolf  * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device.
2378547025d5SBruno Randolf  *	Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may
2379547025d5SBruno Randolf  *	reject TX/RX mask combinations they cannot support by returning -EINVAL
2380547025d5SBruno Randolf  *	(also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX).
2381547025d5SBruno Randolf  *
2382547025d5SBruno Randolf  * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant).
23833677713bSJohn W. Linville  *
2384109086ceSArik Nemtsov  * @tdls_mgmt: Transmit a TDLS management frame.
2385109086ceSArik Nemtsov  * @tdls_oper: Perform a high-level TDLS operation (e.g. TDLS link setup).
23867f6cf311SJohannes Berg  *
23877f6cf311SJohannes Berg  * @probe_client: probe an associated client, must return a cookie that it
23887f6cf311SJohannes Berg  *	later passes to cfg80211_probe_status().
23891d9d9213SSimon Wunderlich  *
23901d9d9213SSimon Wunderlich  * @set_noack_map: Set the NoAck Map for the TIDs.
2391d6199218SBen Greear  *
23925b7ccaf3SJohannes Berg  * @get_channel: Get the current operating channel for the virtual interface.
23935b7ccaf3SJohannes Berg  *	For monitor interfaces, it should return %NULL unless there's a single
23945b7ccaf3SJohannes Berg  *	current monitoring channel.
239598104fdeSJohannes Berg  *
239698104fdeSJohannes Berg  * @start_p2p_device: Start the given P2P device.
239798104fdeSJohannes Berg  * @stop_p2p_device: Stop the given P2P device.
239877765eafSVasanthakumar Thiagarajan  *
239977765eafSVasanthakumar Thiagarajan  * @set_mac_acl: Sets MAC address control list in AP and P2P GO mode.
240077765eafSVasanthakumar Thiagarajan  *	Parameters include ACL policy, an array of MAC address of stations
240177765eafSVasanthakumar Thiagarajan  *	and the number of MAC addresses. If there is already a list in driver
240277765eafSVasanthakumar Thiagarajan  *	this new list replaces the existing one. Driver has to clear its ACL
240377765eafSVasanthakumar Thiagarajan  *	when number of MAC addresses entries is passed as 0. Drivers which
240477765eafSVasanthakumar Thiagarajan  *	advertise the support for MAC based ACL have to implement this callback.
240504f39047SSimon Wunderlich  *
240604f39047SSimon Wunderlich  * @start_radar_detection: Start radar detection in the driver.
24078bf24293SJouni Malinen  *
24088bf24293SJouni Malinen  * @update_ft_ies: Provide updated Fast BSS Transition information to the
24098bf24293SJouni Malinen  *	driver. If the SME is in the driver/firmware, this information can be
24108bf24293SJouni Malinen  *	used in building Authentication and Reassociation Request frames.
24115de17984SArend van Spriel  *
24125de17984SArend van Spriel  * @crit_proto_start: Indicates a critical protocol needs more link reliability
24135de17984SArend van Spriel  *	for a given duration (milliseconds). The protocol is provided so the
24145de17984SArend van Spriel  *	driver can take the most appropriate actions.
24155de17984SArend van Spriel  * @crit_proto_stop: Indicates critical protocol no longer needs increased link
24165de17984SArend van Spriel  *	reliability. This operation can not fail.
2417be29b99aSAmitkumar Karwar  * @set_coalesce: Set coalesce parameters.
241816ef1fe2SSimon Wunderlich  *
241997dc94f1SMichal Kazior  * @channel_switch: initiate channel-switch procedure (with CSA). Driver is
242097dc94f1SMichal Kazior  *	responsible for veryfing if the switch is possible. Since this is
242197dc94f1SMichal Kazior  *	inherently tricky driver may decide to disconnect an interface later
242297dc94f1SMichal Kazior  *	with cfg80211_stop_iface(). This doesn't mean driver can accept
242397dc94f1SMichal Kazior  *	everything. It should do it's best to verify requests and reject them
242497dc94f1SMichal Kazior  *	as soon as possible.
2425fa9ffc74SKyeyoon Park  *
2426fa9ffc74SKyeyoon Park  * @set_qos_map: Set QoS mapping information to the driver
2427e16821bcSJouni Malinen  *
2428e16821bcSJouni Malinen  * @set_ap_chanwidth: Set the AP (including P2P GO) mode channel width for the
2429e16821bcSJouni Malinen  *	given interface This is used e.g. for dynamic HT 20/40 MHz channel width
2430e16821bcSJouni Malinen  *	changes during the lifetime of the BSS.
2431960d01acSJohannes Berg  *
2432960d01acSJohannes Berg  * @add_tx_ts: validate (if admitted_time is 0) or add a TX TS to the device
2433960d01acSJohannes Berg  *	with the given parameters; action frame exchange has been handled by
2434960d01acSJohannes Berg  *	userspace so this just has to modify the TX path to take the TS into
2435960d01acSJohannes Berg  *	account.
2436960d01acSJohannes Berg  *	If the admitted time is 0 just validate the parameters to make sure
2437960d01acSJohannes Berg  *	the session can be created at all; it is valid to just always return
2438960d01acSJohannes Berg  *	success for that but that may result in inefficient behaviour (handshake
2439960d01acSJohannes Berg  *	with the peer followed by immediate teardown when the addition is later
2440960d01acSJohannes Berg  *	rejected)
2441960d01acSJohannes Berg  * @del_tx_ts: remove an existing TX TS
24426e0bd6c3SRostislav Lisovy  *
24436e0bd6c3SRostislav Lisovy  * @join_ocb: join the OCB network with the specified parameters
24446e0bd6c3SRostislav Lisovy  *	(invoked with the wireless_dev mutex held)
24456e0bd6c3SRostislav Lisovy  * @leave_ocb: leave the current OCB network
24466e0bd6c3SRostislav Lisovy  *	(invoked with the wireless_dev mutex held)
24471057d35eSArik Nemtsov  *
24481057d35eSArik Nemtsov  * @tdls_channel_switch: Start channel-switching with a TDLS peer. The driver
24491057d35eSArik Nemtsov  *	is responsible for continually initiating channel-switching operations
24501057d35eSArik Nemtsov  *	and returning to the base channel for communication with the AP.
24511057d35eSArik Nemtsov  * @tdls_cancel_channel_switch: Stop channel-switching with a TDLS peer. Both
24521057d35eSArik Nemtsov  *	peers must be on the base channel when the call completes.
2453704232c2SJohannes Berg  */
2454704232c2SJohannes Berg struct cfg80211_ops {
2455ff1b6e69SJohannes Berg 	int	(*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
24560378b3f1SJohannes Berg 	int	(*resume)(struct wiphy *wiphy);
24576d52563fSJohannes Berg 	void	(*set_wakeup)(struct wiphy *wiphy, bool enabled);
24580378b3f1SJohannes Berg 
245984efbb84SJohannes Berg 	struct wireless_dev * (*add_virtual_intf)(struct wiphy *wiphy,
2460552bff0cSJohannes Berg 						  const char *name,
24616bab2e19STom Gundersen 						  unsigned char name_assign_type,
2462f9e10ce4SJohannes Berg 						  enum nl80211_iftype type,
2463f9e10ce4SJohannes Berg 						  u32 *flags,
24642ec600d6SLuis Carlos Cobo 						  struct vif_params *params);
246584efbb84SJohannes Berg 	int	(*del_virtual_intf)(struct wiphy *wiphy,
246684efbb84SJohannes Berg 				    struct wireless_dev *wdev);
2467e36d56b6SJohannes Berg 	int	(*change_virtual_intf)(struct wiphy *wiphy,
2468e36d56b6SJohannes Berg 				       struct net_device *dev,
24692ec600d6SLuis Carlos Cobo 				       enum nl80211_iftype type, u32 *flags,
24702ec600d6SLuis Carlos Cobo 				       struct vif_params *params);
247141ade00fSJohannes Berg 
247241ade00fSJohannes Berg 	int	(*add_key)(struct wiphy *wiphy, struct net_device *netdev,
2473e31b8213SJohannes Berg 			   u8 key_index, bool pairwise, const u8 *mac_addr,
247441ade00fSJohannes Berg 			   struct key_params *params);
247541ade00fSJohannes Berg 	int	(*get_key)(struct wiphy *wiphy, struct net_device *netdev,
2476e31b8213SJohannes Berg 			   u8 key_index, bool pairwise, const u8 *mac_addr,
2477e31b8213SJohannes Berg 			   void *cookie,
247841ade00fSJohannes Berg 			   void (*callback)(void *cookie, struct key_params*));
247941ade00fSJohannes Berg 	int	(*del_key)(struct wiphy *wiphy, struct net_device *netdev,
2480e31b8213SJohannes Berg 			   u8 key_index, bool pairwise, const u8 *mac_addr);
248141ade00fSJohannes Berg 	int	(*set_default_key)(struct wiphy *wiphy,
248241ade00fSJohannes Berg 				   struct net_device *netdev,
2483dbd2fd65SJohannes Berg 				   u8 key_index, bool unicast, bool multicast);
24843cfcf6acSJouni Malinen 	int	(*set_default_mgmt_key)(struct wiphy *wiphy,
24853cfcf6acSJouni Malinen 					struct net_device *netdev,
24863cfcf6acSJouni Malinen 					u8 key_index);
2487ed1b6cc7SJohannes Berg 
24888860020eSJohannes Berg 	int	(*start_ap)(struct wiphy *wiphy, struct net_device *dev,
24898860020eSJohannes Berg 			    struct cfg80211_ap_settings *settings);
24908860020eSJohannes Berg 	int	(*change_beacon)(struct wiphy *wiphy, struct net_device *dev,
24918860020eSJohannes Berg 				 struct cfg80211_beacon_data *info);
24928860020eSJohannes Berg 	int	(*stop_ap)(struct wiphy *wiphy, struct net_device *dev);
24935727ef1bSJohannes Berg 
24945727ef1bSJohannes Berg 
24955727ef1bSJohannes Berg 	int	(*add_station)(struct wiphy *wiphy, struct net_device *dev,
24963b3a0162SJohannes Berg 			       const u8 *mac,
24973b3a0162SJohannes Berg 			       struct station_parameters *params);
24985727ef1bSJohannes Berg 	int	(*del_station)(struct wiphy *wiphy, struct net_device *dev,
249989c771e5SJouni Malinen 			       struct station_del_parameters *params);
25005727ef1bSJohannes Berg 	int	(*change_station)(struct wiphy *wiphy, struct net_device *dev,
25013b3a0162SJohannes Berg 				  const u8 *mac,
25023b3a0162SJohannes Berg 				  struct station_parameters *params);
2503fd5b74dcSJohannes Berg 	int	(*get_station)(struct wiphy *wiphy, struct net_device *dev,
25043b3a0162SJohannes Berg 			       const u8 *mac, struct station_info *sinfo);
25052ec600d6SLuis Carlos Cobo 	int	(*dump_station)(struct wiphy *wiphy, struct net_device *dev,
25062ec600d6SLuis Carlos Cobo 				int idx, u8 *mac, struct station_info *sinfo);
25072ec600d6SLuis Carlos Cobo 
25082ec600d6SLuis Carlos Cobo 	int	(*add_mpath)(struct wiphy *wiphy, struct net_device *dev,
25093b3a0162SJohannes Berg 			       const u8 *dst, const u8 *next_hop);
25102ec600d6SLuis Carlos Cobo 	int	(*del_mpath)(struct wiphy *wiphy, struct net_device *dev,
25113b3a0162SJohannes Berg 			       const u8 *dst);
25122ec600d6SLuis Carlos Cobo 	int	(*change_mpath)(struct wiphy *wiphy, struct net_device *dev,
25133b3a0162SJohannes Berg 				  const u8 *dst, const u8 *next_hop);
25142ec600d6SLuis Carlos Cobo 	int	(*get_mpath)(struct wiphy *wiphy, struct net_device *dev,
25153b3a0162SJohannes Berg 			     u8 *dst, u8 *next_hop, struct mpath_info *pinfo);
25162ec600d6SLuis Carlos Cobo 	int	(*dump_mpath)(struct wiphy *wiphy, struct net_device *dev,
25172ec600d6SLuis Carlos Cobo 			      int idx, u8 *dst, u8 *next_hop,
25182ec600d6SLuis Carlos Cobo 			      struct mpath_info *pinfo);
251966be7d2bSHenning Rogge 	int	(*get_mpp)(struct wiphy *wiphy, struct net_device *dev,
252066be7d2bSHenning Rogge 			   u8 *dst, u8 *mpp, struct mpath_info *pinfo);
252166be7d2bSHenning Rogge 	int	(*dump_mpp)(struct wiphy *wiphy, struct net_device *dev,
252266be7d2bSHenning Rogge 			    int idx, u8 *dst, u8 *mpp,
252366be7d2bSHenning Rogge 			    struct mpath_info *pinfo);
252424bdd9f4SJavier Cardona 	int	(*get_mesh_config)(struct wiphy *wiphy,
252593da9cc1Scolin@cozybit.com 				struct net_device *dev,
252693da9cc1Scolin@cozybit.com 				struct mesh_config *conf);
252724bdd9f4SJavier Cardona 	int	(*update_mesh_config)(struct wiphy *wiphy,
252829cbe68cSJohannes Berg 				      struct net_device *dev, u32 mask,
252929cbe68cSJohannes Berg 				      const struct mesh_config *nconf);
253029cbe68cSJohannes Berg 	int	(*join_mesh)(struct wiphy *wiphy, struct net_device *dev,
253129cbe68cSJohannes Berg 			     const struct mesh_config *conf,
253229cbe68cSJohannes Berg 			     const struct mesh_setup *setup);
253329cbe68cSJohannes Berg 	int	(*leave_mesh)(struct wiphy *wiphy, struct net_device *dev);
253429cbe68cSJohannes Berg 
25356e0bd6c3SRostislav Lisovy 	int	(*join_ocb)(struct wiphy *wiphy, struct net_device *dev,
25366e0bd6c3SRostislav Lisovy 			    struct ocb_setup *setup);
25376e0bd6c3SRostislav Lisovy 	int	(*leave_ocb)(struct wiphy *wiphy, struct net_device *dev);
25386e0bd6c3SRostislav Lisovy 
25399f1ba906SJouni Malinen 	int	(*change_bss)(struct wiphy *wiphy, struct net_device *dev,
25409f1ba906SJouni Malinen 			      struct bss_parameters *params);
254131888487SJouni Malinen 
2542f70f01c2SEliad Peller 	int	(*set_txq_params)(struct wiphy *wiphy, struct net_device *dev,
254331888487SJouni Malinen 				  struct ieee80211_txq_params *params);
254472bdcf34SJouni Malinen 
2545e8c9bd5bSJohannes Berg 	int	(*libertas_set_mesh_channel)(struct wiphy *wiphy,
2546e8c9bd5bSJohannes Berg 					     struct net_device *dev,
2547e8c9bd5bSJohannes Berg 					     struct ieee80211_channel *chan);
2548e8c9bd5bSJohannes Berg 
2549e8c9bd5bSJohannes Berg 	int	(*set_monitor_channel)(struct wiphy *wiphy,
2550683b6d3bSJohannes Berg 				       struct cfg80211_chan_def *chandef);
25519aed3cc1SJouni Malinen 
2552fd014284SJohannes Berg 	int	(*scan)(struct wiphy *wiphy,
25532a519311SJohannes Berg 			struct cfg80211_scan_request *request);
2554636a5d36SJouni Malinen 
2555636a5d36SJouni Malinen 	int	(*auth)(struct wiphy *wiphy, struct net_device *dev,
2556636a5d36SJouni Malinen 			struct cfg80211_auth_request *req);
2557636a5d36SJouni Malinen 	int	(*assoc)(struct wiphy *wiphy, struct net_device *dev,
2558636a5d36SJouni Malinen 			 struct cfg80211_assoc_request *req);
2559636a5d36SJouni Malinen 	int	(*deauth)(struct wiphy *wiphy, struct net_device *dev,
256063c9c5e7SJohannes Berg 			  struct cfg80211_deauth_request *req);
2561636a5d36SJouni Malinen 	int	(*disassoc)(struct wiphy *wiphy, struct net_device *dev,
256263c9c5e7SJohannes Berg 			    struct cfg80211_disassoc_request *req);
256304a773adSJohannes Berg 
2564b23aa676SSamuel Ortiz 	int	(*connect)(struct wiphy *wiphy, struct net_device *dev,
2565b23aa676SSamuel Ortiz 			   struct cfg80211_connect_params *sme);
2566b23aa676SSamuel Ortiz 	int	(*disconnect)(struct wiphy *wiphy, struct net_device *dev,
2567b23aa676SSamuel Ortiz 			      u16 reason_code);
2568b23aa676SSamuel Ortiz 
256904a773adSJohannes Berg 	int	(*join_ibss)(struct wiphy *wiphy, struct net_device *dev,
257004a773adSJohannes Berg 			     struct cfg80211_ibss_params *params);
257104a773adSJohannes Berg 	int	(*leave_ibss)(struct wiphy *wiphy, struct net_device *dev);
2572b9a5f8caSJouni Malinen 
2573f4e583c8SAntonio Quartulli 	int	(*set_mcast_rate)(struct wiphy *wiphy, struct net_device *dev,
2574f4e583c8SAntonio Quartulli 				  int rate[IEEE80211_NUM_BANDS]);
2575f4e583c8SAntonio Quartulli 
2576b9a5f8caSJouni Malinen 	int	(*set_wiphy_params)(struct wiphy *wiphy, u32 changed);
25777643a2c3SJohannes Berg 
2578c8442118SJohannes Berg 	int	(*set_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
2579fa61cf70SJuuso Oikarinen 				enum nl80211_tx_power_setting type, int mbm);
2580c8442118SJohannes Berg 	int	(*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
2581c8442118SJohannes Berg 				int *dbm);
25821f87f7d3SJohannes Berg 
2583ab737a4fSJohannes Berg 	int	(*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev,
2584388ac775SJohannes Berg 				const u8 *addr);
2585ab737a4fSJohannes Berg 
25861f87f7d3SJohannes Berg 	void	(*rfkill_poll)(struct wiphy *wiphy);
2587aff89a9bSJohannes Berg 
2588aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE
2589fc73f11fSDavid Spinadel 	int	(*testmode_cmd)(struct wiphy *wiphy, struct wireless_dev *wdev,
2590fc73f11fSDavid Spinadel 				void *data, int len);
259171063f0eSWey-Yi Guy 	int	(*testmode_dump)(struct wiphy *wiphy, struct sk_buff *skb,
259271063f0eSWey-Yi Guy 				 struct netlink_callback *cb,
259371063f0eSWey-Yi Guy 				 void *data, int len);
2594aff89a9bSJohannes Berg #endif
2595bc92afd9SJohannes Berg 
25969930380fSJohannes Berg 	int	(*set_bitrate_mask)(struct wiphy *wiphy,
25979930380fSJohannes Berg 				    struct net_device *dev,
25989930380fSJohannes Berg 				    const u8 *peer,
25999930380fSJohannes Berg 				    const struct cfg80211_bitrate_mask *mask);
26009930380fSJohannes Berg 
260161fa713cSHolger Schurig 	int	(*dump_survey)(struct wiphy *wiphy, struct net_device *netdev,
260261fa713cSHolger Schurig 			int idx, struct survey_info *info);
260361fa713cSHolger Schurig 
260467fbb16bSSamuel Ortiz 	int	(*set_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
260567fbb16bSSamuel Ortiz 			     struct cfg80211_pmksa *pmksa);
260667fbb16bSSamuel Ortiz 	int	(*del_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
260767fbb16bSSamuel Ortiz 			     struct cfg80211_pmksa *pmksa);
260867fbb16bSSamuel Ortiz 	int	(*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev);
260967fbb16bSSamuel Ortiz 
26109588bbd5SJouni Malinen 	int	(*remain_on_channel)(struct wiphy *wiphy,
261171bbc994SJohannes Berg 				     struct wireless_dev *wdev,
26129588bbd5SJouni Malinen 				     struct ieee80211_channel *chan,
26139588bbd5SJouni Malinen 				     unsigned int duration,
26149588bbd5SJouni Malinen 				     u64 *cookie);
26159588bbd5SJouni Malinen 	int	(*cancel_remain_on_channel)(struct wiphy *wiphy,
261671bbc994SJohannes Berg 					    struct wireless_dev *wdev,
26179588bbd5SJouni Malinen 					    u64 cookie);
26189588bbd5SJouni Malinen 
261971bbc994SJohannes Berg 	int	(*mgmt_tx)(struct wiphy *wiphy, struct wireless_dev *wdev,
2620b176e629SAndrei Otcheretianski 			   struct cfg80211_mgmt_tx_params *params,
2621b176e629SAndrei Otcheretianski 			   u64 *cookie);
2622f7ca38dfSJohannes Berg 	int	(*mgmt_tx_cancel_wait)(struct wiphy *wiphy,
262371bbc994SJohannes Berg 				       struct wireless_dev *wdev,
2624f7ca38dfSJohannes Berg 				       u64 cookie);
2625026331c4SJouni Malinen 
2626bc92afd9SJohannes Berg 	int	(*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev,
2627bc92afd9SJohannes Berg 				  bool enabled, int timeout);
2628d6dc1a38SJuuso Oikarinen 
2629d6dc1a38SJuuso Oikarinen 	int	(*set_cqm_rssi_config)(struct wiphy *wiphy,
2630d6dc1a38SJuuso Oikarinen 				       struct net_device *dev,
2631d6dc1a38SJuuso Oikarinen 				       s32 rssi_thold, u32 rssi_hyst);
2632271733cfSJohannes Berg 
263384f10708SThomas Pedersen 	int	(*set_cqm_txe_config)(struct wiphy *wiphy,
263484f10708SThomas Pedersen 				      struct net_device *dev,
263584f10708SThomas Pedersen 				      u32 rate, u32 pkts, u32 intvl);
263684f10708SThomas Pedersen 
2637271733cfSJohannes Berg 	void	(*mgmt_frame_register)(struct wiphy *wiphy,
263871bbc994SJohannes Berg 				       struct wireless_dev *wdev,
2639271733cfSJohannes Berg 				       u16 frame_type, bool reg);
2640afe0cbf8SBruno Randolf 
2641afe0cbf8SBruno Randolf 	int	(*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant);
2642afe0cbf8SBruno Randolf 	int	(*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant);
26433677713bSJohn W. Linville 
2644807f8a8cSLuciano Coelho 	int	(*sched_scan_start)(struct wiphy *wiphy,
2645807f8a8cSLuciano Coelho 				struct net_device *dev,
2646807f8a8cSLuciano Coelho 				struct cfg80211_sched_scan_request *request);
264785a9994aSLuciano Coelho 	int	(*sched_scan_stop)(struct wiphy *wiphy, struct net_device *dev);
2648e5497d76SJohannes Berg 
2649e5497d76SJohannes Berg 	int	(*set_rekey_data)(struct wiphy *wiphy, struct net_device *dev,
2650e5497d76SJohannes Berg 				  struct cfg80211_gtk_rekey_data *data);
2651109086ceSArik Nemtsov 
2652109086ceSArik Nemtsov 	int	(*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev,
26533b3a0162SJohannes Berg 			     const u8 *peer, u8 action_code,  u8 dialog_token,
2654df942e7bSSunil Dutt Undekari 			     u16 status_code, u32 peer_capability,
265531fa97c5SArik Nemtsov 			     bool initiator, const u8 *buf, size_t len);
2656109086ceSArik Nemtsov 	int	(*tdls_oper)(struct wiphy *wiphy, struct net_device *dev,
26573b3a0162SJohannes Berg 			     const u8 *peer, enum nl80211_tdls_operation oper);
26587f6cf311SJohannes Berg 
26597f6cf311SJohannes Berg 	int	(*probe_client)(struct wiphy *wiphy, struct net_device *dev,
26607f6cf311SJohannes Berg 				const u8 *peer, u64 *cookie);
2661e999882aSJohannes Berg 
26621d9d9213SSimon Wunderlich 	int	(*set_noack_map)(struct wiphy *wiphy,
26631d9d9213SSimon Wunderlich 				  struct net_device *dev,
26641d9d9213SSimon Wunderlich 				  u16 noack_map);
26651d9d9213SSimon Wunderlich 
2666683b6d3bSJohannes Berg 	int	(*get_channel)(struct wiphy *wiphy,
26675b7ccaf3SJohannes Berg 			       struct wireless_dev *wdev,
2668683b6d3bSJohannes Berg 			       struct cfg80211_chan_def *chandef);
266998104fdeSJohannes Berg 
267098104fdeSJohannes Berg 	int	(*start_p2p_device)(struct wiphy *wiphy,
267198104fdeSJohannes Berg 				    struct wireless_dev *wdev);
267298104fdeSJohannes Berg 	void	(*stop_p2p_device)(struct wiphy *wiphy,
267398104fdeSJohannes Berg 				   struct wireless_dev *wdev);
267477765eafSVasanthakumar Thiagarajan 
267577765eafSVasanthakumar Thiagarajan 	int	(*set_mac_acl)(struct wiphy *wiphy, struct net_device *dev,
267677765eafSVasanthakumar Thiagarajan 			       const struct cfg80211_acl_data *params);
267704f39047SSimon Wunderlich 
267804f39047SSimon Wunderlich 	int	(*start_radar_detection)(struct wiphy *wiphy,
267904f39047SSimon Wunderlich 					 struct net_device *dev,
268031559f35SJanusz Dziedzic 					 struct cfg80211_chan_def *chandef,
268131559f35SJanusz Dziedzic 					 u32 cac_time_ms);
2682355199e0SJouni Malinen 	int	(*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev,
2683355199e0SJouni Malinen 				 struct cfg80211_update_ft_ies_params *ftie);
26845de17984SArend van Spriel 	int	(*crit_proto_start)(struct wiphy *wiphy,
26855de17984SArend van Spriel 				    struct wireless_dev *wdev,
26865de17984SArend van Spriel 				    enum nl80211_crit_proto_id protocol,
26875de17984SArend van Spriel 				    u16 duration);
26885de17984SArend van Spriel 	void	(*crit_proto_stop)(struct wiphy *wiphy,
26895de17984SArend van Spriel 				   struct wireless_dev *wdev);
2690be29b99aSAmitkumar Karwar 	int	(*set_coalesce)(struct wiphy *wiphy,
2691be29b99aSAmitkumar Karwar 				struct cfg80211_coalesce *coalesce);
269216ef1fe2SSimon Wunderlich 
269316ef1fe2SSimon Wunderlich 	int	(*channel_switch)(struct wiphy *wiphy,
269416ef1fe2SSimon Wunderlich 				  struct net_device *dev,
269516ef1fe2SSimon Wunderlich 				  struct cfg80211_csa_settings *params);
2696e16821bcSJouni Malinen 
2697fa9ffc74SKyeyoon Park 	int     (*set_qos_map)(struct wiphy *wiphy,
2698fa9ffc74SKyeyoon Park 			       struct net_device *dev,
2699fa9ffc74SKyeyoon Park 			       struct cfg80211_qos_map *qos_map);
2700e16821bcSJouni Malinen 
2701e16821bcSJouni Malinen 	int	(*set_ap_chanwidth)(struct wiphy *wiphy, struct net_device *dev,
2702e16821bcSJouni Malinen 				    struct cfg80211_chan_def *chandef);
2703960d01acSJohannes Berg 
2704960d01acSJohannes Berg 	int	(*add_tx_ts)(struct wiphy *wiphy, struct net_device *dev,
2705960d01acSJohannes Berg 			     u8 tsid, const u8 *peer, u8 user_prio,
2706960d01acSJohannes Berg 			     u16 admitted_time);
2707960d01acSJohannes Berg 	int	(*del_tx_ts)(struct wiphy *wiphy, struct net_device *dev,
2708960d01acSJohannes Berg 			     u8 tsid, const u8 *peer);
27091057d35eSArik Nemtsov 
27101057d35eSArik Nemtsov 	int	(*tdls_channel_switch)(struct wiphy *wiphy,
27111057d35eSArik Nemtsov 				       struct net_device *dev,
27121057d35eSArik Nemtsov 				       const u8 *addr, u8 oper_class,
27131057d35eSArik Nemtsov 				       struct cfg80211_chan_def *chandef);
27141057d35eSArik Nemtsov 	void	(*tdls_cancel_channel_switch)(struct wiphy *wiphy,
27151057d35eSArik Nemtsov 					      struct net_device *dev,
27161057d35eSArik Nemtsov 					      const u8 *addr);
2717704232c2SJohannes Berg };
2718704232c2SJohannes Berg 
2719d3236553SJohannes Berg /*
2720d3236553SJohannes Berg  * wireless hardware and networking interfaces structures
2721d3236553SJohannes Berg  * and registration/helper functions
2722d3236553SJohannes Berg  */
2723d3236553SJohannes Berg 
2724d3236553SJohannes Berg /**
27255be83de5SJohannes Berg  * enum wiphy_flags - wiphy capability flags
27265be83de5SJohannes Berg  *
27275be83de5SJohannes Berg  * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this
27285be83de5SJohannes Berg  *	wiphy at all
27295be83de5SJohannes Berg  * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled
27305be83de5SJohannes Berg  *	by default -- this flag will be set depending on the kernel's default
27315be83de5SJohannes Berg  *	on wiphy_new(), but can be changed by the driver if it has a good
27325be83de5SJohannes Berg  *	reason to override the default
27339bc383deSJohannes Berg  * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station
27349bc383deSJohannes Berg  *	on a VLAN interface)
27359bc383deSJohannes Berg  * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station
2736c0692b8fSJohannes Berg  * @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the
2737c0692b8fSJohannes Berg  *	control port protocol ethertype. The device also honours the
2738c0692b8fSJohannes Berg  *	control_port_no_encrypt flag.
2739e31b8213SJohannes Berg  * @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN.
274015d5dda6SJavier Cardona  * @WIPHY_FLAG_MESH_AUTH: The device supports mesh authentication by routing
274115d5dda6SJavier Cardona  *	auth frames to userspace. See @NL80211_MESH_SETUP_USERSPACE_AUTH.
27421ba01458SRandy Dunlap  * @WIPHY_FLAG_SUPPORTS_SCHED_SCAN: The device supports scheduled scans.
2743f4b34b55SVivek Natarajan  * @WIPHY_FLAG_SUPPORTS_FW_ROAM: The device supports roaming feature in the
2744f4b34b55SVivek Natarajan  *	firmware.
2745cedb5412SEliad Peller  * @WIPHY_FLAG_AP_UAPSD: The device supports uapsd on AP.
2746109086ceSArik Nemtsov  * @WIPHY_FLAG_SUPPORTS_TDLS: The device supports TDLS (802.11z) operation.
2747109086ceSArik Nemtsov  * @WIPHY_FLAG_TDLS_EXTERNAL_SETUP: The device does not handle TDLS (802.11z)
2748109086ceSArik Nemtsov  *	link setup/discovery operations internally. Setup, discovery and
2749109086ceSArik Nemtsov  *	teardown packets should be sent through the @NL80211_CMD_TDLS_MGMT
2750109086ceSArik Nemtsov  *	command. When this flag is not set, @NL80211_CMD_TDLS_OPER should be
2751109086ceSArik Nemtsov  *	used for asking the driver/firmware to perform a TDLS operation.
2752562a7480SJohannes Berg  * @WIPHY_FLAG_HAVE_AP_SME: device integrates AP SME
27535e760230SJohannes Berg  * @WIPHY_FLAG_REPORTS_OBSS: the device will report beacons from other BSSes
27545e760230SJohannes Berg  *	when there are virtual interfaces in AP mode by calling
27555e760230SJohannes Berg  *	cfg80211_report_obss_beacon().
275687bbbe22SArik Nemtsov  * @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD: When operating as an AP, the device
275787bbbe22SArik Nemtsov  *	responds to probe-requests in hardware.
27587c4ef712SJohannes Berg  * @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX.
27597c4ef712SJohannes Berg  * @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call.
27602f301ab2SSimon Wunderlich  * @WIPHY_FLAG_SUPPORTS_5_10_MHZ: Device supports 5 MHz and 10 MHz channels.
276116ef1fe2SSimon Wunderlich  * @WIPHY_FLAG_HAS_CHANNEL_SWITCH: Device supports channel switch in
276216ef1fe2SSimon Wunderlich  *	beaconing mode (AP, IBSS, Mesh, ...).
27635be83de5SJohannes Berg  */
27645be83de5SJohannes Berg enum wiphy_flags {
2765723e73acSJohannes Berg 	/* use hole at 0 */
2766a2f73b6cSLuis R. Rodriguez 	/* use hole at 1 */
2767a2f73b6cSLuis R. Rodriguez 	/* use hole at 2 */
27685be83de5SJohannes Berg 	WIPHY_FLAG_NETNS_OK			= BIT(3),
27695be83de5SJohannes Berg 	WIPHY_FLAG_PS_ON_BY_DEFAULT		= BIT(4),
27709bc383deSJohannes Berg 	WIPHY_FLAG_4ADDR_AP			= BIT(5),
27719bc383deSJohannes Berg 	WIPHY_FLAG_4ADDR_STATION		= BIT(6),
2772c0692b8fSJohannes Berg 	WIPHY_FLAG_CONTROL_PORT_PROTOCOL	= BIT(7),
2773309075cfSJussi Kivilinna 	WIPHY_FLAG_IBSS_RSN			= BIT(8),
277415d5dda6SJavier Cardona 	WIPHY_FLAG_MESH_AUTH			= BIT(10),
2775807f8a8cSLuciano Coelho 	WIPHY_FLAG_SUPPORTS_SCHED_SCAN		= BIT(11),
27768e8b41f9SJohannes Berg 	/* use hole at 12 */
2777f4b34b55SVivek Natarajan 	WIPHY_FLAG_SUPPORTS_FW_ROAM		= BIT(13),
2778cedb5412SEliad Peller 	WIPHY_FLAG_AP_UAPSD			= BIT(14),
2779109086ceSArik Nemtsov 	WIPHY_FLAG_SUPPORTS_TDLS		= BIT(15),
2780109086ceSArik Nemtsov 	WIPHY_FLAG_TDLS_EXTERNAL_SETUP		= BIT(16),
2781562a7480SJohannes Berg 	WIPHY_FLAG_HAVE_AP_SME			= BIT(17),
27825e760230SJohannes Berg 	WIPHY_FLAG_REPORTS_OBSS			= BIT(18),
278387bbbe22SArik Nemtsov 	WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD	= BIT(19),
27847c4ef712SJohannes Berg 	WIPHY_FLAG_OFFCHAN_TX			= BIT(20),
27857c4ef712SJohannes Berg 	WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL	= BIT(21),
27862f301ab2SSimon Wunderlich 	WIPHY_FLAG_SUPPORTS_5_10_MHZ		= BIT(22),
278716ef1fe2SSimon Wunderlich 	WIPHY_FLAG_HAS_CHANNEL_SWITCH		= BIT(23),
27887527a782SJohannes Berg };
27897527a782SJohannes Berg 
27907527a782SJohannes Berg /**
27917527a782SJohannes Berg  * struct ieee80211_iface_limit - limit on certain interface types
27927527a782SJohannes Berg  * @max: maximum number of interfaces of these types
27937527a782SJohannes Berg  * @types: interface types (bits)
27947527a782SJohannes Berg  */
27957527a782SJohannes Berg struct ieee80211_iface_limit {
27967527a782SJohannes Berg 	u16 max;
27977527a782SJohannes Berg 	u16 types;
27987527a782SJohannes Berg };
27997527a782SJohannes Berg 
28007527a782SJohannes Berg /**
28017527a782SJohannes Berg  * struct ieee80211_iface_combination - possible interface combination
28027527a782SJohannes Berg  * @limits: limits for the given interface types
28037527a782SJohannes Berg  * @n_limits: number of limitations
28047527a782SJohannes Berg  * @num_different_channels: can use up to this many different channels
28057527a782SJohannes Berg  * @max_interfaces: maximum number of interfaces in total allowed in this
28067527a782SJohannes Berg  *	group
28077527a782SJohannes Berg  * @beacon_int_infra_match: In this combination, the beacon intervals
28087527a782SJohannes Berg  *	between infrastructure and AP types must match. This is required
28097527a782SJohannes Berg  *	only in special cases.
281011c4a075SSimon Wunderlich  * @radar_detect_widths: bitmap of channel widths supported for radar detection
28118c48b50aSFelix Fietkau  * @radar_detect_regions: bitmap of regions supported for radar detection
28127527a782SJohannes Berg  *
2813b80edbc1SLuciano Coelho  * With this structure the driver can describe which interface
2814b80edbc1SLuciano Coelho  * combinations it supports concurrently.
28157527a782SJohannes Berg  *
2816b80edbc1SLuciano Coelho  * Examples:
2817b80edbc1SLuciano Coelho  *
2818b80edbc1SLuciano Coelho  * 1. Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total:
28197527a782SJohannes Berg  *
28207527a782SJohannes Berg  *  struct ieee80211_iface_limit limits1[] = {
28217527a782SJohannes Berg  *	{ .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
28227527a782SJohannes Berg  *	{ .max = 1, .types = BIT(NL80211_IFTYPE_AP}, },
28237527a782SJohannes Berg  *  };
28247527a782SJohannes Berg  *  struct ieee80211_iface_combination combination1 = {
28257527a782SJohannes Berg  *	.limits = limits1,
28267527a782SJohannes Berg  *	.n_limits = ARRAY_SIZE(limits1),
28277527a782SJohannes Berg  *	.max_interfaces = 2,
28287527a782SJohannes Berg  *	.beacon_int_infra_match = true,
28297527a782SJohannes Berg  *  };
28307527a782SJohannes Berg  *
28317527a782SJohannes Berg  *
2832b80edbc1SLuciano Coelho  * 2. Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total:
28337527a782SJohannes Berg  *
28347527a782SJohannes Berg  *  struct ieee80211_iface_limit limits2[] = {
28357527a782SJohannes Berg  *	{ .max = 8, .types = BIT(NL80211_IFTYPE_AP) |
28367527a782SJohannes Berg  *			     BIT(NL80211_IFTYPE_P2P_GO), },
28377527a782SJohannes Berg  *  };
28387527a782SJohannes Berg  *  struct ieee80211_iface_combination combination2 = {
28397527a782SJohannes Berg  *	.limits = limits2,
28407527a782SJohannes Berg  *	.n_limits = ARRAY_SIZE(limits2),
28417527a782SJohannes Berg  *	.max_interfaces = 8,
28427527a782SJohannes Berg  *	.num_different_channels = 1,
28437527a782SJohannes Berg  *  };
28447527a782SJohannes Berg  *
28457527a782SJohannes Berg  *
2846b80edbc1SLuciano Coelho  * 3. Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total.
2847b80edbc1SLuciano Coelho  *
28487527a782SJohannes Berg  * This allows for an infrastructure connection and three P2P connections.
28497527a782SJohannes Berg  *
28507527a782SJohannes Berg  *  struct ieee80211_iface_limit limits3[] = {
28517527a782SJohannes Berg  *	{ .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
28527527a782SJohannes Berg  *	{ .max = 3, .types = BIT(NL80211_IFTYPE_P2P_GO) |
28537527a782SJohannes Berg  *			     BIT(NL80211_IFTYPE_P2P_CLIENT), },
28547527a782SJohannes Berg  *  };
28557527a782SJohannes Berg  *  struct ieee80211_iface_combination combination3 = {
28567527a782SJohannes Berg  *	.limits = limits3,
28577527a782SJohannes Berg  *	.n_limits = ARRAY_SIZE(limits3),
28587527a782SJohannes Berg  *	.max_interfaces = 4,
28597527a782SJohannes Berg  *	.num_different_channels = 2,
28607527a782SJohannes Berg  *  };
28617527a782SJohannes Berg  */
28627527a782SJohannes Berg struct ieee80211_iface_combination {
28637527a782SJohannes Berg 	const struct ieee80211_iface_limit *limits;
28647527a782SJohannes Berg 	u32 num_different_channels;
28657527a782SJohannes Berg 	u16 max_interfaces;
28667527a782SJohannes Berg 	u8 n_limits;
28677527a782SJohannes Berg 	bool beacon_int_infra_match;
286811c4a075SSimon Wunderlich 	u8 radar_detect_widths;
28698c48b50aSFelix Fietkau 	u8 radar_detect_regions;
28705be83de5SJohannes Berg };
28715be83de5SJohannes Berg 
28722e161f78SJohannes Berg struct ieee80211_txrx_stypes {
28732e161f78SJohannes Berg 	u16 tx, rx;
28742e161f78SJohannes Berg };
28752e161f78SJohannes Berg 
28765be83de5SJohannes Berg /**
2877ff1b6e69SJohannes Berg  * enum wiphy_wowlan_support_flags - WoWLAN support flags
2878ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_ANY: supports wakeup for the special "any"
2879ff1b6e69SJohannes Berg  *	trigger that keeps the device operating as-is and
2880ff1b6e69SJohannes Berg  *	wakes up the host on any activity, for example a
2881ff1b6e69SJohannes Berg  *	received packet that passed filtering; note that the
2882ff1b6e69SJohannes Berg  *	packet should be preserved in that case
2883ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_MAGIC_PKT: supports wakeup on magic packet
2884ff1b6e69SJohannes Berg  *	(see nl80211.h)
2885ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_DISCONNECT: supports wakeup on disconnect
288677dbbb13SJohannes Berg  * @WIPHY_WOWLAN_SUPPORTS_GTK_REKEY: supports GTK rekeying while asleep
288777dbbb13SJohannes Berg  * @WIPHY_WOWLAN_GTK_REKEY_FAILURE: supports wakeup on GTK rekey failure
288877dbbb13SJohannes Berg  * @WIPHY_WOWLAN_EAP_IDENTITY_REQ: supports wakeup on EAP identity request
288977dbbb13SJohannes Berg  * @WIPHY_WOWLAN_4WAY_HANDSHAKE: supports wakeup on 4-way handshake failure
289077dbbb13SJohannes Berg  * @WIPHY_WOWLAN_RFKILL_RELEASE: supports wakeup on RF-kill release
28918cd4d456SLuciano Coelho  * @WIPHY_WOWLAN_NET_DETECT: supports wakeup on network detection
2892ff1b6e69SJohannes Berg  */
2893ff1b6e69SJohannes Berg enum wiphy_wowlan_support_flags {
2894ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_ANY		= BIT(0),
2895ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_MAGIC_PKT		= BIT(1),
2896ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_DISCONNECT		= BIT(2),
289777dbbb13SJohannes Berg 	WIPHY_WOWLAN_SUPPORTS_GTK_REKEY	= BIT(3),
289877dbbb13SJohannes Berg 	WIPHY_WOWLAN_GTK_REKEY_FAILURE	= BIT(4),
289977dbbb13SJohannes Berg 	WIPHY_WOWLAN_EAP_IDENTITY_REQ	= BIT(5),
290077dbbb13SJohannes Berg 	WIPHY_WOWLAN_4WAY_HANDSHAKE	= BIT(6),
290177dbbb13SJohannes Berg 	WIPHY_WOWLAN_RFKILL_RELEASE	= BIT(7),
29028cd4d456SLuciano Coelho 	WIPHY_WOWLAN_NET_DETECT		= BIT(8),
2903ff1b6e69SJohannes Berg };
2904ff1b6e69SJohannes Berg 
29052a0e047eSJohannes Berg struct wiphy_wowlan_tcp_support {
29062a0e047eSJohannes Berg 	const struct nl80211_wowlan_tcp_data_token_feature *tok;
29072a0e047eSJohannes Berg 	u32 data_payload_max;
29082a0e047eSJohannes Berg 	u32 data_interval_max;
29092a0e047eSJohannes Berg 	u32 wake_payload_max;
29102a0e047eSJohannes Berg 	bool seq;
29112a0e047eSJohannes Berg };
29122a0e047eSJohannes Berg 
2913ff1b6e69SJohannes Berg /**
2914ff1b6e69SJohannes Berg  * struct wiphy_wowlan_support - WoWLAN support data
2915ff1b6e69SJohannes Berg  * @flags: see &enum wiphy_wowlan_support_flags
2916ff1b6e69SJohannes Berg  * @n_patterns: number of supported wakeup patterns
2917ff1b6e69SJohannes Berg  *	(see nl80211.h for the pattern definition)
2918ff1b6e69SJohannes Berg  * @pattern_max_len: maximum length of each pattern
2919ff1b6e69SJohannes Berg  * @pattern_min_len: minimum length of each pattern
2920bb92d199SAmitkumar Karwar  * @max_pkt_offset: maximum Rx packet offset
29218cd4d456SLuciano Coelho  * @max_nd_match_sets: maximum number of matchsets for net-detect,
29228cd4d456SLuciano Coelho  *	similar, but not necessarily identical, to max_match_sets for
29238cd4d456SLuciano Coelho  *	scheduled scans.
29248cd4d456SLuciano Coelho  *	See &struct cfg80211_sched_scan_request.@match_sets for more
29258cd4d456SLuciano Coelho  *	details.
29262a0e047eSJohannes Berg  * @tcp: TCP wakeup support information
2927ff1b6e69SJohannes Berg  */
2928ff1b6e69SJohannes Berg struct wiphy_wowlan_support {
2929ff1b6e69SJohannes Berg 	u32 flags;
2930ff1b6e69SJohannes Berg 	int n_patterns;
2931ff1b6e69SJohannes Berg 	int pattern_max_len;
2932ff1b6e69SJohannes Berg 	int pattern_min_len;
2933bb92d199SAmitkumar Karwar 	int max_pkt_offset;
29348cd4d456SLuciano Coelho 	int max_nd_match_sets;
29352a0e047eSJohannes Berg 	const struct wiphy_wowlan_tcp_support *tcp;
2936ff1b6e69SJohannes Berg };
2937ff1b6e69SJohannes Berg 
2938ff1b6e69SJohannes Berg /**
2939be29b99aSAmitkumar Karwar  * struct wiphy_coalesce_support - coalesce support data
2940be29b99aSAmitkumar Karwar  * @n_rules: maximum number of coalesce rules
2941be29b99aSAmitkumar Karwar  * @max_delay: maximum supported coalescing delay in msecs
2942be29b99aSAmitkumar Karwar  * @n_patterns: number of supported patterns in a rule
2943be29b99aSAmitkumar Karwar  *	(see nl80211.h for the pattern definition)
2944be29b99aSAmitkumar Karwar  * @pattern_max_len: maximum length of each pattern
2945be29b99aSAmitkumar Karwar  * @pattern_min_len: minimum length of each pattern
2946be29b99aSAmitkumar Karwar  * @max_pkt_offset: maximum Rx packet offset
2947be29b99aSAmitkumar Karwar  */
2948be29b99aSAmitkumar Karwar struct wiphy_coalesce_support {
2949be29b99aSAmitkumar Karwar 	int n_rules;
2950be29b99aSAmitkumar Karwar 	int max_delay;
2951be29b99aSAmitkumar Karwar 	int n_patterns;
2952be29b99aSAmitkumar Karwar 	int pattern_max_len;
2953be29b99aSAmitkumar Karwar 	int pattern_min_len;
2954be29b99aSAmitkumar Karwar 	int max_pkt_offset;
2955be29b99aSAmitkumar Karwar };
2956be29b99aSAmitkumar Karwar 
2957be29b99aSAmitkumar Karwar /**
2958ad7e718cSJohannes Berg  * enum wiphy_vendor_command_flags - validation flags for vendor commands
2959ad7e718cSJohannes Berg  * @WIPHY_VENDOR_CMD_NEED_WDEV: vendor command requires wdev
2960ad7e718cSJohannes Berg  * @WIPHY_VENDOR_CMD_NEED_NETDEV: vendor command requires netdev
2961ad7e718cSJohannes Berg  * @WIPHY_VENDOR_CMD_NEED_RUNNING: interface/wdev must be up & running
2962ad7e718cSJohannes Berg  *	(must be combined with %_WDEV or %_NETDEV)
2963ad7e718cSJohannes Berg  */
2964ad7e718cSJohannes Berg enum wiphy_vendor_command_flags {
2965ad7e718cSJohannes Berg 	WIPHY_VENDOR_CMD_NEED_WDEV = BIT(0),
2966ad7e718cSJohannes Berg 	WIPHY_VENDOR_CMD_NEED_NETDEV = BIT(1),
2967ad7e718cSJohannes Berg 	WIPHY_VENDOR_CMD_NEED_RUNNING = BIT(2),
2968ad7e718cSJohannes Berg };
2969ad7e718cSJohannes Berg 
2970ad7e718cSJohannes Berg /**
2971ad7e718cSJohannes Berg  * struct wiphy_vendor_command - vendor command definition
2972ad7e718cSJohannes Berg  * @info: vendor command identifying information, as used in nl80211
2973ad7e718cSJohannes Berg  * @flags: flags, see &enum wiphy_vendor_command_flags
2974ad7e718cSJohannes Berg  * @doit: callback for the operation, note that wdev is %NULL if the
2975ad7e718cSJohannes Berg  *	flags didn't ask for a wdev and non-%NULL otherwise; the data
2976ad7e718cSJohannes Berg  *	pointer may be %NULL if userspace provided no data at all
29777bdbe400SJohannes Berg  * @dumpit: dump callback, for transferring bigger/multiple items. The
29787bdbe400SJohannes Berg  *	@storage points to cb->args[5], ie. is preserved over the multiple
29797bdbe400SJohannes Berg  *	dumpit calls.
29807bdbe400SJohannes Berg  * It's recommended to not have the same sub command with both @doit and
29817bdbe400SJohannes Berg  * @dumpit, so that userspace can assume certain ones are get and others
29827bdbe400SJohannes Berg  * are used with dump requests.
2983ad7e718cSJohannes Berg  */
2984ad7e718cSJohannes Berg struct wiphy_vendor_command {
2985ad7e718cSJohannes Berg 	struct nl80211_vendor_cmd_info info;
2986ad7e718cSJohannes Berg 	u32 flags;
2987ad7e718cSJohannes Berg 	int (*doit)(struct wiphy *wiphy, struct wireless_dev *wdev,
2988ad7e718cSJohannes Berg 		    const void *data, int data_len);
29897bdbe400SJohannes Berg 	int (*dumpit)(struct wiphy *wiphy, struct wireless_dev *wdev,
29907bdbe400SJohannes Berg 		      struct sk_buff *skb, const void *data, int data_len,
29917bdbe400SJohannes Berg 		      unsigned long *storage);
2992ad7e718cSJohannes Berg };
2993ad7e718cSJohannes Berg 
2994ad7e718cSJohannes Berg /**
29955be83de5SJohannes Berg  * struct wiphy - wireless hardware description
29962784fe91SLuis R. Rodriguez  * @reg_notifier: the driver's regulatory notification callback,
29972784fe91SLuis R. Rodriguez  *	note that if your driver uses wiphy_apply_custom_regulatory()
29982784fe91SLuis R. Rodriguez  *	the reg_notifier's request can be passed as NULL
2999d3236553SJohannes Berg  * @regd: the driver's regulatory domain, if one was requested via
3000d3236553SJohannes Berg  * 	the regulatory_hint() API. This can be used by the driver
3001d3236553SJohannes Berg  *	on the reg_notifier() if it chooses to ignore future
3002d3236553SJohannes Berg  *	regulatory domain changes caused by other drivers.
3003d3236553SJohannes Berg  * @signal_type: signal type reported in &struct cfg80211_bss.
3004d3236553SJohannes Berg  * @cipher_suites: supported cipher suites
3005d3236553SJohannes Berg  * @n_cipher_suites: number of supported cipher suites
3006b9a5f8caSJouni Malinen  * @retry_short: Retry limit for short frames (dot11ShortRetryLimit)
3007b9a5f8caSJouni Malinen  * @retry_long: Retry limit for long frames (dot11LongRetryLimit)
3008b9a5f8caSJouni Malinen  * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold);
3009b9a5f8caSJouni Malinen  *	-1 = fragmentation disabled, only odd values >= 256 used
3010b9a5f8caSJouni Malinen  * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled
3011abe37c4bSJohannes Berg  * @_net: the network namespace this wiphy currently lives in
3012ef15aac6SJohannes Berg  * @perm_addr: permanent MAC address of this device
3013ef15aac6SJohannes Berg  * @addr_mask: If the device supports multiple MAC addresses by masking,
3014ef15aac6SJohannes Berg  *	set this to a mask with variable bits set to 1, e.g. if the last
30150fcf8ac5SLuciano Coelho  *	four bits are variable then set it to 00-00-00-00-00-0f. The actual
3016ef15aac6SJohannes Berg  *	variable bits shall be determined by the interfaces added, with
3017ef15aac6SJohannes Berg  *	interfaces not matching the mask being rejected to be brought up.
3018ef15aac6SJohannes Berg  * @n_addresses: number of addresses in @addresses.
3019ef15aac6SJohannes Berg  * @addresses: If the device has more than one address, set this pointer
3020ef15aac6SJohannes Berg  *	to a list of addresses (6 bytes each). The first one will be used
3021ef15aac6SJohannes Berg  *	by default for perm_addr. In this case, the mask should be set to
3022ef15aac6SJohannes Berg  *	all-zeroes. In this case it is assumed that the device can handle
3023ef15aac6SJohannes Berg  *	the same number of arbitrary MAC addresses.
3024fd235913SRandy Dunlap  * @registered: protects ->resume and ->suspend sysfs callbacks against
3025fd235913SRandy Dunlap  *	unregister hardware
3026abe37c4bSJohannes Berg  * @debugfsdir: debugfs directory used for this wiphy, will be renamed
3027abe37c4bSJohannes Berg  *	automatically on wiphy renames
3028abe37c4bSJohannes Berg  * @dev: (virtual) struct device for this wiphy
30294a711a85SStanislaw Gruszka  * @registered: helps synchronize suspend/resume with wiphy unregister
3030abe37c4bSJohannes Berg  * @wext: wireless extension handlers
3031abe37c4bSJohannes Berg  * @priv: driver private data (sized according to wiphy_new() parameter)
3032abe37c4bSJohannes Berg  * @interface_modes: bitmask of interfaces types valid for this wiphy,
3033abe37c4bSJohannes Berg  *	must be set by driver
30347527a782SJohannes Berg  * @iface_combinations: Valid interface combinations array, should not
30357527a782SJohannes Berg  *	list single interface types.
30367527a782SJohannes Berg  * @n_iface_combinations: number of entries in @iface_combinations array.
30377527a782SJohannes Berg  * @software_iftypes: bitmask of software interface types, these are not
30387527a782SJohannes Berg  *	subject to any restrictions since they are purely managed in SW.
3039abe37c4bSJohannes Berg  * @flags: wiphy flags, see &enum wiphy_flags
3040a2f73b6cSLuis R. Rodriguez  * @regulatory_flags: wiphy regulatory flags, see
3041a2f73b6cSLuis R. Rodriguez  *	&enum ieee80211_regulatory_flags
30421f074bd8SJohannes Berg  * @features: features advertised to nl80211, see &enum nl80211_feature_flags.
3043d75bb06bSGautam Kumar Shukla  * @ext_features: extended features advertised to nl80211, see
3044d75bb06bSGautam Kumar Shukla  *	&enum nl80211_ext_feature_index.
3045abe37c4bSJohannes Berg  * @bss_priv_size: each BSS struct has private data allocated with it,
3046abe37c4bSJohannes Berg  *	this variable determines its size
3047abe37c4bSJohannes Berg  * @max_scan_ssids: maximum number of SSIDs the device can scan for in
3048abe37c4bSJohannes Berg  *	any given scan
304993b6aa69SLuciano Coelho  * @max_sched_scan_ssids: maximum number of SSIDs the device can scan
305093b6aa69SLuciano Coelho  *	for in any given scheduled scan
3051a1f1c21cSLuciano Coelho  * @max_match_sets: maximum number of match sets the device can handle
3052a1f1c21cSLuciano Coelho  *	when performing a scheduled scan, 0 if filtering is not
3053a1f1c21cSLuciano Coelho  *	supported.
3054abe37c4bSJohannes Berg  * @max_scan_ie_len: maximum length of user-controlled IEs device can
3055abe37c4bSJohannes Berg  *	add to probe request frames transmitted during a scan, must not
3056abe37c4bSJohannes Berg  *	include fixed IEs like supported rates
30575a865badSLuciano Coelho  * @max_sched_scan_ie_len: same as max_scan_ie_len, but for scheduled
30585a865badSLuciano Coelho  *	scans
3059abe37c4bSJohannes Berg  * @coverage_class: current coverage class
3060abe37c4bSJohannes Berg  * @fw_version: firmware version for ethtool reporting
3061abe37c4bSJohannes Berg  * @hw_version: hardware version for ethtool reporting
3062abe37c4bSJohannes Berg  * @max_num_pmkids: maximum number of PMKIDs supported by device
3063abe37c4bSJohannes Berg  * @privid: a pointer that drivers can use to identify if an arbitrary
3064abe37c4bSJohannes Berg  *	wiphy is theirs, e.g. in global notifiers
3065abe37c4bSJohannes Berg  * @bands: information about bands/channels supported by this device
30662e161f78SJohannes Berg  *
30672e161f78SJohannes Berg  * @mgmt_stypes: bitmasks of frame subtypes that can be subscribed to or
30682e161f78SJohannes Berg  *	transmitted through nl80211, points to an array indexed by interface
30692e161f78SJohannes Berg  *	type
3070a7ffac95SBruno Randolf  *
30717f531e03SBruno Randolf  * @available_antennas_tx: bitmap of antennas which are available to be
30727f531e03SBruno Randolf  *	configured as TX antennas. Antenna configuration commands will be
30737f531e03SBruno Randolf  *	rejected unless this or @available_antennas_rx is set.
30747f531e03SBruno Randolf  *
30757f531e03SBruno Randolf  * @available_antennas_rx: bitmap of antennas which are available to be
30767f531e03SBruno Randolf  *	configured as RX antennas. Antenna configuration commands will be
30777f531e03SBruno Randolf  *	rejected unless this or @available_antennas_tx is set.
3078a293911dSJohannes Berg  *
307915f0ebc2SRandy Dunlap  * @probe_resp_offload:
308015f0ebc2SRandy Dunlap  *	 Bitmap of supported protocols for probe response offloading.
308115f0ebc2SRandy Dunlap  *	 See &enum nl80211_probe_resp_offload_support_attr. Only valid
308215f0ebc2SRandy Dunlap  *	 when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set.
308315f0ebc2SRandy Dunlap  *
3084a293911dSJohannes Berg  * @max_remain_on_channel_duration: Maximum time a remain-on-channel operation
3085a293911dSJohannes Berg  *	may request, if implemented.
3086ff1b6e69SJohannes Berg  *
3087ff1b6e69SJohannes Berg  * @wowlan: WoWLAN support information
30886abb9cb9SJohannes Berg  * @wowlan_config: current WoWLAN configuration; this should usually not be
30896abb9cb9SJohannes Berg  *	used since access to it is necessarily racy, use the parameter passed
30906abb9cb9SJohannes Berg  *	to the suspend() operation instead.
3091562a7480SJohannes Berg  *
3092562a7480SJohannes Berg  * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features.
30937e7c8926SBen Greear  * @ht_capa_mod_mask:  Specify what ht_cap values can be over-ridden.
30947e7c8926SBen Greear  *	If null, then none can be over-ridden.
3095ee2aca34SJohannes Berg  * @vht_capa_mod_mask:  Specify what VHT capabilities can be over-ridden.
3096ee2aca34SJohannes Berg  *	If null, then none can be over-ridden.
309777765eafSVasanthakumar Thiagarajan  *
309877765eafSVasanthakumar Thiagarajan  * @max_acl_mac_addrs: Maximum number of MAC addresses that the device
309977765eafSVasanthakumar Thiagarajan  *	supports for ACL.
3100a50df0c4SJohannes Berg  *
3101a50df0c4SJohannes Berg  * @extended_capabilities: extended capabilities supported by the driver,
3102a50df0c4SJohannes Berg  *	additional capabilities might be supported by userspace; these are
3103a50df0c4SJohannes Berg  *	the 802.11 extended capabilities ("Extended Capabilities element")
3104a50df0c4SJohannes Berg  *	and are in the same format as in the information element. See
3105a50df0c4SJohannes Berg  *	802.11-2012 8.4.2.29 for the defined fields.
3106a50df0c4SJohannes Berg  * @extended_capabilities_mask: mask of the valid values
3107a50df0c4SJohannes Berg  * @extended_capabilities_len: length of the extended capabilities
3108be29b99aSAmitkumar Karwar  * @coalesce: packet coalescing support information
3109ad7e718cSJohannes Berg  *
3110ad7e718cSJohannes Berg  * @vendor_commands: array of vendor commands supported by the hardware
3111ad7e718cSJohannes Berg  * @n_vendor_commands: number of vendor commands
3112567ffc35SJohannes Berg  * @vendor_events: array of vendor events supported by the hardware
3113567ffc35SJohannes Berg  * @n_vendor_events: number of vendor events
3114b43504cfSJouni Malinen  *
3115b43504cfSJouni Malinen  * @max_ap_assoc_sta: maximum number of associated stations supported in AP mode
3116b43504cfSJouni Malinen  *	(including P2P GO) or 0 to indicate no such limit is advertised. The
3117b43504cfSJouni Malinen  *	driver is allowed to advertise a theoretical limit that it can reach in
3118b43504cfSJouni Malinen  *	some cases, but may not always reach.
3119c2e4323bSLuciano Coelho  *
3120c2e4323bSLuciano Coelho  * @max_num_csa_counters: Number of supported csa_counters in beacons
3121c2e4323bSLuciano Coelho  *	and probe responses.  This value should be set if the driver
3122c2e4323bSLuciano Coelho  *	wishes to limit the number of csa counters. Default (0) means
3123c2e4323bSLuciano Coelho  *	infinite.
312467af9811SEmmanuel Grumbach  * @max_adj_channel_rssi_comp: max offset of between the channel on which the
312567af9811SEmmanuel Grumbach  *	frame was sent and the channel on which the frame was heard for which
312667af9811SEmmanuel Grumbach  *	the reported rssi is still valid. If a driver is able to compensate the
312767af9811SEmmanuel Grumbach  *	low rssi when a frame is heard on different channel, then it should set
312867af9811SEmmanuel Grumbach  *	this variable to the maximal offset for which it can compensate.
312967af9811SEmmanuel Grumbach  *	This value should be set in MHz.
3130d3236553SJohannes Berg  */
3131d3236553SJohannes Berg struct wiphy {
3132d3236553SJohannes Berg 	/* assign these fields before you register the wiphy */
3133d3236553SJohannes Berg 
3134ef15aac6SJohannes Berg 	/* permanent MAC address(es) */
3135d3236553SJohannes Berg 	u8 perm_addr[ETH_ALEN];
3136ef15aac6SJohannes Berg 	u8 addr_mask[ETH_ALEN];
3137ef15aac6SJohannes Berg 
3138ef15aac6SJohannes Berg 	struct mac_address *addresses;
3139d3236553SJohannes Berg 
31402e161f78SJohannes Berg 	const struct ieee80211_txrx_stypes *mgmt_stypes;
31412e161f78SJohannes Berg 
31427527a782SJohannes Berg 	const struct ieee80211_iface_combination *iface_combinations;
31437527a782SJohannes Berg 	int n_iface_combinations;
31447527a782SJohannes Berg 	u16 software_iftypes;
31457527a782SJohannes Berg 
31462e161f78SJohannes Berg 	u16 n_addresses;
31472e161f78SJohannes Berg 
3148d3236553SJohannes Berg 	/* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
3149d3236553SJohannes Berg 	u16 interface_modes;
3150d3236553SJohannes Berg 
315177765eafSVasanthakumar Thiagarajan 	u16 max_acl_mac_addrs;
315277765eafSVasanthakumar Thiagarajan 
3153a2f73b6cSLuis R. Rodriguez 	u32 flags, regulatory_flags, features;
3154d75bb06bSGautam Kumar Shukla 	u8 ext_features[DIV_ROUND_UP(NUM_NL80211_EXT_FEATURES, 8)];
3155463d0183SJohannes Berg 
3156562a7480SJohannes Berg 	u32 ap_sme_capa;
3157562a7480SJohannes Berg 
3158d3236553SJohannes Berg 	enum cfg80211_signal_type signal_type;
3159d3236553SJohannes Berg 
3160d3236553SJohannes Berg 	int bss_priv_size;
3161d3236553SJohannes Berg 	u8 max_scan_ssids;
316293b6aa69SLuciano Coelho 	u8 max_sched_scan_ssids;
3163a1f1c21cSLuciano Coelho 	u8 max_match_sets;
3164d3236553SJohannes Berg 	u16 max_scan_ie_len;
31655a865badSLuciano Coelho 	u16 max_sched_scan_ie_len;
3166d3236553SJohannes Berg 
3167d3236553SJohannes Berg 	int n_cipher_suites;
3168d3236553SJohannes Berg 	const u32 *cipher_suites;
3169d3236553SJohannes Berg 
3170b9a5f8caSJouni Malinen 	u8 retry_short;
3171b9a5f8caSJouni Malinen 	u8 retry_long;
3172b9a5f8caSJouni Malinen 	u32 frag_threshold;
3173b9a5f8caSJouni Malinen 	u32 rts_threshold;
317481077e82SLukáš Turek 	u8 coverage_class;
3175b9a5f8caSJouni Malinen 
317681135548SJiri Pirko 	char fw_version[ETHTOOL_FWVERS_LEN];
3177dfce95f5SKalle Valo 	u32 hw_version;
3178dfce95f5SKalle Valo 
3179dfb89c56SJohannes Berg #ifdef CONFIG_PM
3180964dc9e2SJohannes Berg 	const struct wiphy_wowlan_support *wowlan;
31816abb9cb9SJohannes Berg 	struct cfg80211_wowlan *wowlan_config;
3182dfb89c56SJohannes Berg #endif
3183ff1b6e69SJohannes Berg 
3184a293911dSJohannes Berg 	u16 max_remain_on_channel_duration;
3185a293911dSJohannes Berg 
318667fbb16bSSamuel Ortiz 	u8 max_num_pmkids;
318767fbb16bSSamuel Ortiz 
31887f531e03SBruno Randolf 	u32 available_antennas_tx;
31897f531e03SBruno Randolf 	u32 available_antennas_rx;
3190a7ffac95SBruno Randolf 
319187bbbe22SArik Nemtsov 	/*
319287bbbe22SArik Nemtsov 	 * Bitmap of supported protocols for probe response offloading
319387bbbe22SArik Nemtsov 	 * see &enum nl80211_probe_resp_offload_support_attr. Only valid
319487bbbe22SArik Nemtsov 	 * when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set.
319587bbbe22SArik Nemtsov 	 */
319687bbbe22SArik Nemtsov 	u32 probe_resp_offload;
319787bbbe22SArik Nemtsov 
3198a50df0c4SJohannes Berg 	const u8 *extended_capabilities, *extended_capabilities_mask;
3199a50df0c4SJohannes Berg 	u8 extended_capabilities_len;
3200a50df0c4SJohannes Berg 
3201d3236553SJohannes Berg 	/* If multiple wiphys are registered and you're handed e.g.
3202d3236553SJohannes Berg 	 * a regular netdev with assigned ieee80211_ptr, you won't
3203d3236553SJohannes Berg 	 * know whether it points to a wiphy your driver has registered
3204d3236553SJohannes Berg 	 * or not. Assign this to something global to your driver to
3205d3236553SJohannes Berg 	 * help determine whether you own this wiphy or not. */
3206cf5aa2f1SDavid Kilroy 	const void *privid;
3207d3236553SJohannes Berg 
3208d3236553SJohannes Berg 	struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS];
3209d3236553SJohannes Berg 
3210d3236553SJohannes Berg 	/* Lets us get back the wiphy on the callback */
32110c0280bdSLuis R. Rodriguez 	void (*reg_notifier)(struct wiphy *wiphy,
3212d3236553SJohannes Berg 			     struct regulatory_request *request);
3213d3236553SJohannes Berg 
3214d3236553SJohannes Berg 	/* fields below are read-only, assigned by cfg80211 */
3215d3236553SJohannes Berg 
3216458f4f9eSJohannes Berg 	const struct ieee80211_regdomain __rcu *regd;
3217d3236553SJohannes Berg 
3218d3236553SJohannes Berg 	/* the item in /sys/class/ieee80211/ points to this,
3219d3236553SJohannes Berg 	 * you need use set_wiphy_dev() (see below) */
3220d3236553SJohannes Berg 	struct device dev;
3221d3236553SJohannes Berg 
3222ecb44335SStanislaw Gruszka 	/* protects ->resume, ->suspend sysfs callbacks against unregister hw */
3223ecb44335SStanislaw Gruszka 	bool registered;
3224ecb44335SStanislaw Gruszka 
3225d3236553SJohannes Berg 	/* dir in debugfs: ieee80211/<wiphyname> */
3226d3236553SJohannes Berg 	struct dentry *debugfsdir;
3227d3236553SJohannes Berg 
32287e7c8926SBen Greear 	const struct ieee80211_ht_cap *ht_capa_mod_mask;
3229ee2aca34SJohannes Berg 	const struct ieee80211_vht_cap *vht_capa_mod_mask;
32307e7c8926SBen Greear 
3231463d0183SJohannes Berg 	/* the network namespace this phy lives in currently */
32320c5c9fb5SEric W. Biederman 	possible_net_t _net;
3233463d0183SJohannes Berg 
32343d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT
32353d23e349SJohannes Berg 	const struct iw_handler_def *wext;
32363d23e349SJohannes Berg #endif
32373d23e349SJohannes Berg 
3238be29b99aSAmitkumar Karwar 	const struct wiphy_coalesce_support *coalesce;
3239be29b99aSAmitkumar Karwar 
3240ad7e718cSJohannes Berg 	const struct wiphy_vendor_command *vendor_commands;
3241567ffc35SJohannes Berg 	const struct nl80211_vendor_cmd_info *vendor_events;
3242567ffc35SJohannes Berg 	int n_vendor_commands, n_vendor_events;
3243ad7e718cSJohannes Berg 
3244b43504cfSJouni Malinen 	u16 max_ap_assoc_sta;
3245b43504cfSJouni Malinen 
32469a774c78SAndrei Otcheretianski 	u8 max_num_csa_counters;
324767af9811SEmmanuel Grumbach 	u8 max_adj_channel_rssi_comp;
32489a774c78SAndrei Otcheretianski 
32491c06ef98SJohannes Berg 	char priv[0] __aligned(NETDEV_ALIGN);
3250d3236553SJohannes Berg };
3251d3236553SJohannes Berg 
3252463d0183SJohannes Berg static inline struct net *wiphy_net(struct wiphy *wiphy)
3253463d0183SJohannes Berg {
3254c2d9ba9bSEric Dumazet 	return read_pnet(&wiphy->_net);
3255463d0183SJohannes Berg }
3256463d0183SJohannes Berg 
3257463d0183SJohannes Berg static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net)
3258463d0183SJohannes Berg {
3259c2d9ba9bSEric Dumazet 	write_pnet(&wiphy->_net, net);
3260463d0183SJohannes Berg }
3261463d0183SJohannes Berg 
3262d3236553SJohannes Berg /**
3263d3236553SJohannes Berg  * wiphy_priv - return priv from wiphy
3264d3236553SJohannes Berg  *
3265d3236553SJohannes Berg  * @wiphy: the wiphy whose priv pointer to return
32660ae997dcSYacine Belkadi  * Return: The priv of @wiphy.
3267d3236553SJohannes Berg  */
3268d3236553SJohannes Berg static inline void *wiphy_priv(struct wiphy *wiphy)
3269d3236553SJohannes Berg {
3270d3236553SJohannes Berg 	BUG_ON(!wiphy);
3271d3236553SJohannes Berg 	return &wiphy->priv;
3272d3236553SJohannes Berg }
3273d3236553SJohannes Berg 
3274d3236553SJohannes Berg /**
3275f1f74825SDavid Kilroy  * priv_to_wiphy - return the wiphy containing the priv
3276f1f74825SDavid Kilroy  *
3277f1f74825SDavid Kilroy  * @priv: a pointer previously returned by wiphy_priv
32780ae997dcSYacine Belkadi  * Return: The wiphy of @priv.
3279f1f74825SDavid Kilroy  */
3280f1f74825SDavid Kilroy static inline struct wiphy *priv_to_wiphy(void *priv)
3281f1f74825SDavid Kilroy {
3282f1f74825SDavid Kilroy 	BUG_ON(!priv);
3283f1f74825SDavid Kilroy 	return container_of(priv, struct wiphy, priv);
3284f1f74825SDavid Kilroy }
3285f1f74825SDavid Kilroy 
3286f1f74825SDavid Kilroy /**
3287d3236553SJohannes Berg  * set_wiphy_dev - set device pointer for wiphy
3288d3236553SJohannes Berg  *
3289d3236553SJohannes Berg  * @wiphy: The wiphy whose device to bind
3290d3236553SJohannes Berg  * @dev: The device to parent it to
3291d3236553SJohannes Berg  */
3292d3236553SJohannes Berg static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev)
3293d3236553SJohannes Berg {
3294d3236553SJohannes Berg 	wiphy->dev.parent = dev;
3295d3236553SJohannes Berg }
3296d3236553SJohannes Berg 
3297d3236553SJohannes Berg /**
3298d3236553SJohannes Berg  * wiphy_dev - get wiphy dev pointer
3299d3236553SJohannes Berg  *
3300d3236553SJohannes Berg  * @wiphy: The wiphy whose device struct to look up
33010ae997dcSYacine Belkadi  * Return: The dev of @wiphy.
3302d3236553SJohannes Berg  */
3303d3236553SJohannes Berg static inline struct device *wiphy_dev(struct wiphy *wiphy)
3304d3236553SJohannes Berg {
3305d3236553SJohannes Berg 	return wiphy->dev.parent;
3306d3236553SJohannes Berg }
3307d3236553SJohannes Berg 
3308d3236553SJohannes Berg /**
3309d3236553SJohannes Berg  * wiphy_name - get wiphy name
3310d3236553SJohannes Berg  *
3311d3236553SJohannes Berg  * @wiphy: The wiphy whose name to return
33120ae997dcSYacine Belkadi  * Return: The name of @wiphy.
3313d3236553SJohannes Berg  */
3314e1db74fcSJoe Perches static inline const char *wiphy_name(const struct wiphy *wiphy)
3315d3236553SJohannes Berg {
3316d3236553SJohannes Berg 	return dev_name(&wiphy->dev);
3317d3236553SJohannes Berg }
3318d3236553SJohannes Berg 
3319d3236553SJohannes Berg /**
33201998d90aSBen Greear  * wiphy_new_nm - create a new wiphy for use with cfg80211
33211998d90aSBen Greear  *
33221998d90aSBen Greear  * @ops: The configuration operations for this device
33231998d90aSBen Greear  * @sizeof_priv: The size of the private area to allocate
33241998d90aSBen Greear  * @requested_name: Request a particular name.
33251998d90aSBen Greear  *	NULL is valid value, and means use the default phy%d naming.
33261998d90aSBen Greear  *
33271998d90aSBen Greear  * Create a new wiphy and associate the given operations with it.
33281998d90aSBen Greear  * @sizeof_priv bytes are allocated for private use.
33291998d90aSBen Greear  *
33301998d90aSBen Greear  * Return: A pointer to the new wiphy. This pointer must be
33311998d90aSBen Greear  * assigned to each netdev's ieee80211_ptr for proper operation.
33321998d90aSBen Greear  */
33331998d90aSBen Greear struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv,
33341998d90aSBen Greear 			   const char *requested_name);
33351998d90aSBen Greear 
33361998d90aSBen Greear /**
3337d3236553SJohannes Berg  * wiphy_new - create a new wiphy for use with cfg80211
3338d3236553SJohannes Berg  *
3339d3236553SJohannes Berg  * @ops: The configuration operations for this device
3340d3236553SJohannes Berg  * @sizeof_priv: The size of the private area to allocate
3341d3236553SJohannes Berg  *
3342d3236553SJohannes Berg  * Create a new wiphy and associate the given operations with it.
3343d3236553SJohannes Berg  * @sizeof_priv bytes are allocated for private use.
3344d3236553SJohannes Berg  *
33450ae997dcSYacine Belkadi  * Return: A pointer to the new wiphy. This pointer must be
33460ae997dcSYacine Belkadi  * assigned to each netdev's ieee80211_ptr for proper operation.
3347d3236553SJohannes Berg  */
33481998d90aSBen Greear static inline struct wiphy *wiphy_new(const struct cfg80211_ops *ops,
33491998d90aSBen Greear 				      int sizeof_priv)
33501998d90aSBen Greear {
33511998d90aSBen Greear 	return wiphy_new_nm(ops, sizeof_priv, NULL);
33521998d90aSBen Greear }
3353d3236553SJohannes Berg 
3354d3236553SJohannes Berg /**
3355d3236553SJohannes Berg  * wiphy_register - register a wiphy with cfg80211
3356d3236553SJohannes Berg  *
3357d3236553SJohannes Berg  * @wiphy: The wiphy to register.
3358d3236553SJohannes Berg  *
33590ae997dcSYacine Belkadi  * Return: A non-negative wiphy index or a negative error code.
3360d3236553SJohannes Berg  */
336110dd9b7cSJoe Perches int wiphy_register(struct wiphy *wiphy);
3362d3236553SJohannes Berg 
3363d3236553SJohannes Berg /**
3364d3236553SJohannes Berg  * wiphy_unregister - deregister a wiphy from cfg80211
3365d3236553SJohannes Berg  *
3366d3236553SJohannes Berg  * @wiphy: The wiphy to unregister.
3367d3236553SJohannes Berg  *
3368d3236553SJohannes Berg  * After this call, no more requests can be made with this priv
3369d3236553SJohannes Berg  * pointer, but the call may sleep to wait for an outstanding
3370d3236553SJohannes Berg  * request that is being handled.
3371d3236553SJohannes Berg  */
337210dd9b7cSJoe Perches void wiphy_unregister(struct wiphy *wiphy);
3373d3236553SJohannes Berg 
3374d3236553SJohannes Berg /**
3375d3236553SJohannes Berg  * wiphy_free - free wiphy
3376d3236553SJohannes Berg  *
3377d3236553SJohannes Berg  * @wiphy: The wiphy to free
3378d3236553SJohannes Berg  */
337910dd9b7cSJoe Perches void wiphy_free(struct wiphy *wiphy);
3380d3236553SJohannes Berg 
3381fffd0934SJohannes Berg /* internal structs */
33826829c878SJohannes Berg struct cfg80211_conn;
338319957bb3SJohannes Berg struct cfg80211_internal_bss;
3384fffd0934SJohannes Berg struct cfg80211_cached_keys;
338519957bb3SJohannes Berg 
3386d3236553SJohannes Berg /**
338789a54e48SJohannes Berg  * struct wireless_dev - wireless device state
3388d3236553SJohannes Berg  *
338989a54e48SJohannes Berg  * For netdevs, this structure must be allocated by the driver
339089a54e48SJohannes Berg  * that uses the ieee80211_ptr field in struct net_device (this
339189a54e48SJohannes Berg  * is intentional so it can be allocated along with the netdev.)
339289a54e48SJohannes Berg  * It need not be registered then as netdev registration will
339389a54e48SJohannes Berg  * be intercepted by cfg80211 to see the new wireless device.
339489a54e48SJohannes Berg  *
339589a54e48SJohannes Berg  * For non-netdev uses, it must also be allocated by the driver
339689a54e48SJohannes Berg  * in response to the cfg80211 callbacks that require it, as
339789a54e48SJohannes Berg  * there's no netdev registration in that case it may not be
339889a54e48SJohannes Berg  * allocated outside of callback operations that return it.
3399d3236553SJohannes Berg  *
3400d3236553SJohannes Berg  * @wiphy: pointer to hardware description
3401d3236553SJohannes Berg  * @iftype: interface type
3402d3236553SJohannes Berg  * @list: (private) Used to collect the interfaces
340389a54e48SJohannes Berg  * @netdev: (private) Used to reference back to the netdev, may be %NULL
340489a54e48SJohannes Berg  * @identifier: (private) Identifier used in nl80211 to identify this
340589a54e48SJohannes Berg  *	wireless device if it has no netdev
3406d3236553SJohannes Berg  * @current_bss: (private) Used by the internal configuration code
34079e0e2961SMichal Kazior  * @chandef: (private) Used by the internal configuration code to track
34089e0e2961SMichal Kazior  *	the user-set channel definition.
3409780b40dfSJohannes Berg  * @preset_chandef: (private) Used by the internal configuration code to
3410aa430da4SJohannes Berg  *	track the channel to be used for AP later
3411d3236553SJohannes Berg  * @bssid: (private) Used by the internal configuration code
3412d3236553SJohannes Berg  * @ssid: (private) Used by the internal configuration code
3413d3236553SJohannes Berg  * @ssid_len: (private) Used by the internal configuration code
341429cbe68cSJohannes Berg  * @mesh_id_len: (private) Used by the internal configuration code
341529cbe68cSJohannes Berg  * @mesh_id_up_len: (private) Used by the internal configuration code
3416d3236553SJohannes Berg  * @wext: (private) Used by the internal wireless extensions compat code
34179bc383deSJohannes Berg  * @use_4addr: indicates 4addr mode is used on this interface, must be
34189bc383deSJohannes Berg  *	set by driver (if supported) on add_interface BEFORE registering the
34199bc383deSJohannes Berg  *	netdev and may otherwise be used by driver read-only, will be update
34209bc383deSJohannes Berg  *	by cfg80211 on change_interface
34212e161f78SJohannes Berg  * @mgmt_registrations: list of registrations for management frames
34222e161f78SJohannes Berg  * @mgmt_registrations_lock: lock for the list
34238d61ffa5SJohannes Berg  * @mtx: mutex used to lock data in this struct, may be used by drivers
34248d61ffa5SJohannes Berg  *	and some API functions require it held
342556d1893dSJohannes Berg  * @beacon_interval: beacon interval used on this device for transmitting
342656d1893dSJohannes Berg  *	beacons, 0 when not valid
342798104fdeSJohannes Berg  * @address: The address for this device, valid only if @netdev is %NULL
342898104fdeSJohannes Berg  * @p2p_started: true if this is a P2P Device that has been started
342904f39047SSimon Wunderlich  * @cac_started: true if DFS channel availability check has been started
343004f39047SSimon Wunderlich  * @cac_start_time: timestamp (jiffies) when the dfs state was entered.
343131559f35SJanusz Dziedzic  * @cac_time_ms: CAC time in ms
3432780b40dfSJohannes Berg  * @ps: powersave mode is enabled
3433780b40dfSJohannes Berg  * @ps_timeout: dynamic powersave timeout
3434780b40dfSJohannes Berg  * @ap_unexpected_nlportid: (private) netlink port ID of application
3435780b40dfSJohannes Berg  *	registered for unexpected class 3 frames (AP mode)
3436780b40dfSJohannes Berg  * @conn: (private) cfg80211 software SME connection state machine data
3437780b40dfSJohannes Berg  * @connect_keys: (private) keys to set after connection is established
3438780b40dfSJohannes Berg  * @ibss_fixed: (private) IBSS is using fixed BSSID
34395336fa88SSimon Wunderlich  * @ibss_dfs_possible: (private) IBSS may change to a DFS channel
3440780b40dfSJohannes Berg  * @event_list: (private) list for internal event processing
3441780b40dfSJohannes Berg  * @event_lock: (private) lock for event list
344278f22b6aSJohannes Berg  * @owner_nlportid: (private) owner socket port ID
3443d3236553SJohannes Berg  */
3444d3236553SJohannes Berg struct wireless_dev {
3445d3236553SJohannes Berg 	struct wiphy *wiphy;
3446d3236553SJohannes Berg 	enum nl80211_iftype iftype;
3447d3236553SJohannes Berg 
3448667503ddSJohannes Berg 	/* the remainder of this struct should be private to cfg80211 */
3449d3236553SJohannes Berg 	struct list_head list;
3450d3236553SJohannes Berg 	struct net_device *netdev;
3451d3236553SJohannes Berg 
345289a54e48SJohannes Berg 	u32 identifier;
345389a54e48SJohannes Berg 
34542e161f78SJohannes Berg 	struct list_head mgmt_registrations;
34552e161f78SJohannes Berg 	spinlock_t mgmt_registrations_lock;
3456026331c4SJouni Malinen 
3457667503ddSJohannes Berg 	struct mutex mtx;
3458667503ddSJohannes Berg 
345998104fdeSJohannes Berg 	bool use_4addr, p2p_started;
346098104fdeSJohannes Berg 
346198104fdeSJohannes Berg 	u8 address[ETH_ALEN] __aligned(sizeof(u16));
34629bc383deSJohannes Berg 
3463b23aa676SSamuel Ortiz 	/* currently used for IBSS and SME - might be rearranged later */
3464d3236553SJohannes Berg 	u8 ssid[IEEE80211_MAX_SSID_LEN];
346529cbe68cSJohannes Berg 	u8 ssid_len, mesh_id_len, mesh_id_up_len;
34666829c878SJohannes Berg 	struct cfg80211_conn *conn;
3467fffd0934SJohannes Berg 	struct cfg80211_cached_keys *connect_keys;
3468d3236553SJohannes Berg 
3469667503ddSJohannes Berg 	struct list_head event_list;
3470667503ddSJohannes Berg 	spinlock_t event_lock;
3471667503ddSJohannes Berg 
347219957bb3SJohannes Berg 	struct cfg80211_internal_bss *current_bss; /* associated / joined */
3473683b6d3bSJohannes Berg 	struct cfg80211_chan_def preset_chandef;
34749e0e2961SMichal Kazior 	struct cfg80211_chan_def chandef;
3475f4489ebeSMichal Kazior 
3476c30a3d38SMichal Kazior 	bool ibss_fixed;
34775336fa88SSimon Wunderlich 	bool ibss_dfs_possible;
3478c30a3d38SMichal Kazior 
3479ffb9eb3dSKalle Valo 	bool ps;
3480ffb9eb3dSKalle Valo 	int ps_timeout;
3481ffb9eb3dSKalle Valo 
348256d1893dSJohannes Berg 	int beacon_interval;
348356d1893dSJohannes Berg 
348415e47304SEric W. Biederman 	u32 ap_unexpected_nlportid;
348528946da7SJohannes Berg 
348604f39047SSimon Wunderlich 	bool cac_started;
348704f39047SSimon Wunderlich 	unsigned long cac_start_time;
348831559f35SJanusz Dziedzic 	unsigned int cac_time_ms;
348904f39047SSimon Wunderlich 
349078f22b6aSJohannes Berg 	u32 owner_nlportid;
349178f22b6aSJohannes Berg 
34923d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT
3493d3236553SJohannes Berg 	/* wext data */
3494cbe8fa9cSJohannes Berg 	struct {
3495cbe8fa9cSJohannes Berg 		struct cfg80211_ibss_params ibss;
3496f2129354SJohannes Berg 		struct cfg80211_connect_params connect;
3497fffd0934SJohannes Berg 		struct cfg80211_cached_keys *keys;
3498c1e5f471SJohannes Berg 		const u8 *ie;
3499f2129354SJohannes Berg 		size_t ie_len;
3500f401a6f7SJohannes Berg 		u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN];
3501f2129354SJohannes Berg 		u8 ssid[IEEE80211_MAX_SSID_LEN];
350208645126SJohannes Berg 		s8 default_key, default_mgmt_key;
3503ffb9eb3dSKalle Valo 		bool prev_bssid_valid;
3504cbe8fa9cSJohannes Berg 	} wext;
3505d3236553SJohannes Berg #endif
3506d3236553SJohannes Berg };
3507d3236553SJohannes Berg 
350898104fdeSJohannes Berg static inline u8 *wdev_address(struct wireless_dev *wdev)
350998104fdeSJohannes Berg {
351098104fdeSJohannes Berg 	if (wdev->netdev)
351198104fdeSJohannes Berg 		return wdev->netdev->dev_addr;
351298104fdeSJohannes Berg 	return wdev->address;
351398104fdeSJohannes Berg }
351498104fdeSJohannes Berg 
3515d3236553SJohannes Berg /**
3516d3236553SJohannes Berg  * wdev_priv - return wiphy priv from wireless_dev
3517d3236553SJohannes Berg  *
3518d3236553SJohannes Berg  * @wdev: The wireless device whose wiphy's priv pointer to return
35190ae997dcSYacine Belkadi  * Return: The wiphy priv of @wdev.
3520d3236553SJohannes Berg  */
3521d3236553SJohannes Berg static inline void *wdev_priv(struct wireless_dev *wdev)
3522d3236553SJohannes Berg {
3523d3236553SJohannes Berg 	BUG_ON(!wdev);
3524d3236553SJohannes Berg 	return wiphy_priv(wdev->wiphy);
3525d3236553SJohannes Berg }
3526d3236553SJohannes Berg 
3527d70e9693SJohannes Berg /**
3528d70e9693SJohannes Berg  * DOC: Utility functions
3529d70e9693SJohannes Berg  *
3530d70e9693SJohannes Berg  * cfg80211 offers a number of utility functions that can be useful.
3531d3236553SJohannes Berg  */
3532d3236553SJohannes Berg 
3533d3236553SJohannes Berg /**
3534d3236553SJohannes Berg  * ieee80211_channel_to_frequency - convert channel number to frequency
3535abe37c4bSJohannes Berg  * @chan: channel number
353659eb21a6SBruno Randolf  * @band: band, necessary due to channel number overlap
35370ae997dcSYacine Belkadi  * Return: The corresponding frequency (in MHz), or 0 if the conversion failed.
3538d3236553SJohannes Berg  */
353910dd9b7cSJoe Perches int ieee80211_channel_to_frequency(int chan, enum ieee80211_band band);
3540d3236553SJohannes Berg 
3541d3236553SJohannes Berg /**
3542d3236553SJohannes Berg  * ieee80211_frequency_to_channel - convert frequency to channel number
3543abe37c4bSJohannes Berg  * @freq: center frequency
35440ae997dcSYacine Belkadi  * Return: The corresponding channel, or 0 if the conversion failed.
3545d3236553SJohannes Berg  */
354610dd9b7cSJoe Perches int ieee80211_frequency_to_channel(int freq);
3547d3236553SJohannes Berg 
3548d3236553SJohannes Berg /*
3549d3236553SJohannes Berg  * Name indirection necessary because the ieee80211 code also has
3550d3236553SJohannes Berg  * a function named "ieee80211_get_channel", so if you include
3551d3236553SJohannes Berg  * cfg80211's header file you get cfg80211's version, if you try
3552d3236553SJohannes Berg  * to include both header files you'll (rightfully!) get a symbol
3553d3236553SJohannes Berg  * clash.
3554d3236553SJohannes Berg  */
355510dd9b7cSJoe Perches struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy,
3556d3236553SJohannes Berg 						  int freq);
3557d3236553SJohannes Berg /**
3558d3236553SJohannes Berg  * ieee80211_get_channel - get channel struct from wiphy for specified frequency
3559abe37c4bSJohannes Berg  * @wiphy: the struct wiphy to get the channel for
3560abe37c4bSJohannes Berg  * @freq: the center frequency of the channel
35610ae997dcSYacine Belkadi  * Return: The channel struct from @wiphy at @freq.
3562d3236553SJohannes Berg  */
3563d3236553SJohannes Berg static inline struct ieee80211_channel *
3564d3236553SJohannes Berg ieee80211_get_channel(struct wiphy *wiphy, int freq)
3565d3236553SJohannes Berg {
3566d3236553SJohannes Berg 	return __ieee80211_get_channel(wiphy, freq);
3567d3236553SJohannes Berg }
3568d3236553SJohannes Berg 
3569d3236553SJohannes Berg /**
3570d3236553SJohannes Berg  * ieee80211_get_response_rate - get basic rate for a given rate
3571d3236553SJohannes Berg  *
3572d3236553SJohannes Berg  * @sband: the band to look for rates in
3573d3236553SJohannes Berg  * @basic_rates: bitmap of basic rates
3574d3236553SJohannes Berg  * @bitrate: the bitrate for which to find the basic rate
3575d3236553SJohannes Berg  *
35760ae997dcSYacine Belkadi  * Return: The basic rate corresponding to a given bitrate, that
35770ae997dcSYacine Belkadi  * is the next lower bitrate contained in the basic rate map,
35780ae997dcSYacine Belkadi  * which is, for this function, given as a bitmap of indices of
35790ae997dcSYacine Belkadi  * rates in the band's bitrate table.
3580d3236553SJohannes Berg  */
3581d3236553SJohannes Berg struct ieee80211_rate *
3582d3236553SJohannes Berg ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
3583d3236553SJohannes Berg 			    u32 basic_rates, int bitrate);
3584d3236553SJohannes Berg 
3585b422c6cdSAshok Nagarajan /**
3586b422c6cdSAshok Nagarajan  * ieee80211_mandatory_rates - get mandatory rates for a given band
3587b422c6cdSAshok Nagarajan  * @sband: the band to look for rates in
358874608acaSSimon Wunderlich  * @scan_width: width of the control channel
3589b422c6cdSAshok Nagarajan  *
3590b422c6cdSAshok Nagarajan  * This function returns a bitmap of the mandatory rates for the given
3591b422c6cdSAshok Nagarajan  * band, bits are set according to the rate position in the bitrates array.
3592b422c6cdSAshok Nagarajan  */
359374608acaSSimon Wunderlich u32 ieee80211_mandatory_rates(struct ieee80211_supported_band *sband,
359474608acaSSimon Wunderlich 			      enum nl80211_bss_scan_width scan_width);
3595b422c6cdSAshok Nagarajan 
3596d3236553SJohannes Berg /*
3597d3236553SJohannes Berg  * Radiotap parsing functions -- for controlled injection support
3598d3236553SJohannes Berg  *
3599d3236553SJohannes Berg  * Implemented in net/wireless/radiotap.c
3600d3236553SJohannes Berg  * Documentation in Documentation/networking/radiotap-headers.txt
3601d3236553SJohannes Berg  */
3602d3236553SJohannes Berg 
360333e5a2f7SJohannes Berg struct radiotap_align_size {
360433e5a2f7SJohannes Berg 	uint8_t align:4, size:4;
360533e5a2f7SJohannes Berg };
360633e5a2f7SJohannes Berg 
360733e5a2f7SJohannes Berg struct ieee80211_radiotap_namespace {
360833e5a2f7SJohannes Berg 	const struct radiotap_align_size *align_size;
360933e5a2f7SJohannes Berg 	int n_bits;
361033e5a2f7SJohannes Berg 	uint32_t oui;
361133e5a2f7SJohannes Berg 	uint8_t subns;
361233e5a2f7SJohannes Berg };
361333e5a2f7SJohannes Berg 
361433e5a2f7SJohannes Berg struct ieee80211_radiotap_vendor_namespaces {
361533e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_namespace *ns;
361633e5a2f7SJohannes Berg 	int n_ns;
361733e5a2f7SJohannes Berg };
361833e5a2f7SJohannes Berg 
3619d3236553SJohannes Berg /**
3620d3236553SJohannes Berg  * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args
362133e5a2f7SJohannes Berg  * @this_arg_index: index of current arg, valid after each successful call
362233e5a2f7SJohannes Berg  *	to ieee80211_radiotap_iterator_next()
362333e5a2f7SJohannes Berg  * @this_arg: pointer to current radiotap arg; it is valid after each
362433e5a2f7SJohannes Berg  *	call to ieee80211_radiotap_iterator_next() but also after
362533e5a2f7SJohannes Berg  *	ieee80211_radiotap_iterator_init() where it will point to
362633e5a2f7SJohannes Berg  *	the beginning of the actual data portion
362733e5a2f7SJohannes Berg  * @this_arg_size: length of the current arg, for convenience
362833e5a2f7SJohannes Berg  * @current_namespace: pointer to the current namespace definition
362933e5a2f7SJohannes Berg  *	(or internally %NULL if the current namespace is unknown)
363033e5a2f7SJohannes Berg  * @is_radiotap_ns: indicates whether the current namespace is the default
363133e5a2f7SJohannes Berg  *	radiotap namespace or not
363233e5a2f7SJohannes Berg  *
363333e5a2f7SJohannes Berg  * @_rtheader: pointer to the radiotap header we are walking through
363433e5a2f7SJohannes Berg  * @_max_length: length of radiotap header in cpu byte ordering
363533e5a2f7SJohannes Berg  * @_arg_index: next argument index
363633e5a2f7SJohannes Berg  * @_arg: next argument pointer
363733e5a2f7SJohannes Berg  * @_next_bitmap: internal pointer to next present u32
363833e5a2f7SJohannes Berg  * @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present
363933e5a2f7SJohannes Berg  * @_vns: vendor namespace definitions
364033e5a2f7SJohannes Berg  * @_next_ns_data: beginning of the next namespace's data
364133e5a2f7SJohannes Berg  * @_reset_on_ext: internal; reset the arg index to 0 when going to the
364233e5a2f7SJohannes Berg  *	next bitmap word
364333e5a2f7SJohannes Berg  *
364433e5a2f7SJohannes Berg  * Describes the radiotap parser state. Fields prefixed with an underscore
364533e5a2f7SJohannes Berg  * must not be used by users of the parser, only by the parser internally.
3646d3236553SJohannes Berg  */
3647d3236553SJohannes Berg 
3648d3236553SJohannes Berg struct ieee80211_radiotap_iterator {
364933e5a2f7SJohannes Berg 	struct ieee80211_radiotap_header *_rtheader;
365033e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_vendor_namespaces *_vns;
365133e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_namespace *current_namespace;
3652d3236553SJohannes Berg 
365333e5a2f7SJohannes Berg 	unsigned char *_arg, *_next_ns_data;
365467272440SJohannes Berg 	__le32 *_next_bitmap;
365533e5a2f7SJohannes Berg 
365633e5a2f7SJohannes Berg 	unsigned char *this_arg;
365733e5a2f7SJohannes Berg 	int this_arg_index;
365833e5a2f7SJohannes Berg 	int this_arg_size;
365933e5a2f7SJohannes Berg 
366033e5a2f7SJohannes Berg 	int is_radiotap_ns;
366133e5a2f7SJohannes Berg 
366233e5a2f7SJohannes Berg 	int _max_length;
366333e5a2f7SJohannes Berg 	int _arg_index;
366433e5a2f7SJohannes Berg 	uint32_t _bitmap_shifter;
366533e5a2f7SJohannes Berg 	int _reset_on_ext;
3666d3236553SJohannes Berg };
3667d3236553SJohannes Berg 
366810dd9b7cSJoe Perches int
366910dd9b7cSJoe Perches ieee80211_radiotap_iterator_init(struct ieee80211_radiotap_iterator *iterator,
3670d3236553SJohannes Berg 				 struct ieee80211_radiotap_header *radiotap_header,
367110dd9b7cSJoe Perches 				 int max_length,
367210dd9b7cSJoe Perches 				 const struct ieee80211_radiotap_vendor_namespaces *vns);
3673d3236553SJohannes Berg 
367410dd9b7cSJoe Perches int
367510dd9b7cSJoe Perches ieee80211_radiotap_iterator_next(struct ieee80211_radiotap_iterator *iterator);
3676d3236553SJohannes Berg 
367733e5a2f7SJohannes Berg 
3678e31a16d6SZhu Yi extern const unsigned char rfc1042_header[6];
3679e31a16d6SZhu Yi extern const unsigned char bridge_tunnel_header[6];
3680e31a16d6SZhu Yi 
3681e31a16d6SZhu Yi /**
3682e31a16d6SZhu Yi  * ieee80211_get_hdrlen_from_skb - get header length from data
3683e31a16d6SZhu Yi  *
3684e31a16d6SZhu Yi  * @skb: the frame
36850ae997dcSYacine Belkadi  *
36860ae997dcSYacine Belkadi  * Given an skb with a raw 802.11 header at the data pointer this function
36870ae997dcSYacine Belkadi  * returns the 802.11 header length.
36880ae997dcSYacine Belkadi  *
36890ae997dcSYacine Belkadi  * Return: The 802.11 header length in bytes (not including encryption
36900ae997dcSYacine Belkadi  * headers). Or 0 if the data in the sk_buff is too short to contain a valid
36910ae997dcSYacine Belkadi  * 802.11 header.
3692e31a16d6SZhu Yi  */
3693e31a16d6SZhu Yi unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb);
3694e31a16d6SZhu Yi 
3695e31a16d6SZhu Yi /**
3696e31a16d6SZhu Yi  * ieee80211_hdrlen - get header length in bytes from frame control
3697e31a16d6SZhu Yi  * @fc: frame control field in little-endian format
36980ae997dcSYacine Belkadi  * Return: The header length in bytes.
3699e31a16d6SZhu Yi  */
3700633adf1aSJohannes Berg unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc);
3701e31a16d6SZhu Yi 
3702e31a16d6SZhu Yi /**
37039b395bc3SJohannes Berg  * ieee80211_get_mesh_hdrlen - get mesh extension header length
37049b395bc3SJohannes Berg  * @meshhdr: the mesh extension header, only the flags field
37059b395bc3SJohannes Berg  *	(first byte) will be accessed
37060ae997dcSYacine Belkadi  * Return: The length of the extension header, which is always at
37079b395bc3SJohannes Berg  * least 6 bytes and at most 18 if address 5 and 6 are present.
37089b395bc3SJohannes Berg  */
37099b395bc3SJohannes Berg unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr);
37109b395bc3SJohannes Berg 
37119b395bc3SJohannes Berg /**
3712d70e9693SJohannes Berg  * DOC: Data path helpers
3713d70e9693SJohannes Berg  *
3714d70e9693SJohannes Berg  * In addition to generic utilities, cfg80211 also offers
3715d70e9693SJohannes Berg  * functions that help implement the data path for devices
3716d70e9693SJohannes Berg  * that do not do the 802.11/802.3 conversion on the device.
3717d70e9693SJohannes Berg  */
3718d70e9693SJohannes Berg 
3719d70e9693SJohannes Berg /**
3720e31a16d6SZhu Yi  * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3
3721e31a16d6SZhu Yi  * @skb: the 802.11 data frame
3722e31a16d6SZhu Yi  * @addr: the device MAC address
3723e31a16d6SZhu Yi  * @iftype: the virtual interface type
37240ae997dcSYacine Belkadi  * Return: 0 on success. Non-zero on error.
3725e31a16d6SZhu Yi  */
3726eaf85ca7SZhu Yi int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
3727e31a16d6SZhu Yi 			   enum nl80211_iftype iftype);
3728e31a16d6SZhu Yi 
3729e31a16d6SZhu Yi /**
3730e31a16d6SZhu Yi  * ieee80211_data_from_8023 - convert an 802.3 frame to 802.11
3731e31a16d6SZhu Yi  * @skb: the 802.3 frame
3732e31a16d6SZhu Yi  * @addr: the device MAC address
3733e31a16d6SZhu Yi  * @iftype: the virtual interface type
3734e31a16d6SZhu Yi  * @bssid: the network bssid (used only for iftype STATION and ADHOC)
3735e31a16d6SZhu Yi  * @qos: build 802.11 QoS data frame
37360ae997dcSYacine Belkadi  * Return: 0 on success, or a negative error code.
3737e31a16d6SZhu Yi  */
3738eaf85ca7SZhu Yi int ieee80211_data_from_8023(struct sk_buff *skb, const u8 *addr,
3739c1e5f471SJohannes Berg 			     enum nl80211_iftype iftype, const u8 *bssid,
3740c1e5f471SJohannes Berg 			     bool qos);
3741e31a16d6SZhu Yi 
3742e31a16d6SZhu Yi /**
3743eaf85ca7SZhu Yi  * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame
3744eaf85ca7SZhu Yi  *
3745eaf85ca7SZhu Yi  * Decode an IEEE 802.11n A-MSDU frame and convert it to a list of
3746eaf85ca7SZhu Yi  * 802.3 frames. The @list will be empty if the decode fails. The
3747eaf85ca7SZhu Yi  * @skb is consumed after the function returns.
3748eaf85ca7SZhu Yi  *
3749eaf85ca7SZhu Yi  * @skb: The input IEEE 802.11n A-MSDU frame.
3750eaf85ca7SZhu Yi  * @list: The output list of 802.3 frames. It must be allocated and
3751eaf85ca7SZhu Yi  *	initialized by by the caller.
3752eaf85ca7SZhu Yi  * @addr: The device MAC address.
3753eaf85ca7SZhu Yi  * @iftype: The device interface type.
3754eaf85ca7SZhu Yi  * @extra_headroom: The hardware extra headroom for SKBs in the @list.
37558b3becadSYogesh Ashok Powar  * @has_80211_header: Set it true if SKB is with IEEE 802.11 header.
3756eaf85ca7SZhu Yi  */
3757eaf85ca7SZhu Yi void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,
3758eaf85ca7SZhu Yi 			      const u8 *addr, enum nl80211_iftype iftype,
37598b3becadSYogesh Ashok Powar 			      const unsigned int extra_headroom,
37608b3becadSYogesh Ashok Powar 			      bool has_80211_header);
3761eaf85ca7SZhu Yi 
3762eaf85ca7SZhu Yi /**
3763e31a16d6SZhu Yi  * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame
3764e31a16d6SZhu Yi  * @skb: the data frame
3765fa9ffc74SKyeyoon Park  * @qos_map: Interworking QoS mapping or %NULL if not in use
37660ae997dcSYacine Belkadi  * Return: The 802.1p/1d tag.
3767e31a16d6SZhu Yi  */
3768fa9ffc74SKyeyoon Park unsigned int cfg80211_classify8021d(struct sk_buff *skb,
3769fa9ffc74SKyeyoon Park 				    struct cfg80211_qos_map *qos_map);
3770e31a16d6SZhu Yi 
3771c21dbf92SJohannes Berg /**
3772c21dbf92SJohannes Berg  * cfg80211_find_ie - find information element in data
3773c21dbf92SJohannes Berg  *
3774c21dbf92SJohannes Berg  * @eid: element ID
3775c21dbf92SJohannes Berg  * @ies: data consisting of IEs
3776c21dbf92SJohannes Berg  * @len: length of data
3777c21dbf92SJohannes Berg  *
37780ae997dcSYacine Belkadi  * Return: %NULL if the element ID could not be found or if
37790ae997dcSYacine Belkadi  * the element is invalid (claims to be longer than the given
37800ae997dcSYacine Belkadi  * data), or a pointer to the first byte of the requested
37810ae997dcSYacine Belkadi  * element, that is the byte containing the element ID.
37820ae997dcSYacine Belkadi  *
37830ae997dcSYacine Belkadi  * Note: There are no checks on the element length other than
37840ae997dcSYacine Belkadi  * having to fit into the given data.
3785c21dbf92SJohannes Berg  */
3786c21dbf92SJohannes Berg const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len);
3787c21dbf92SJohannes Berg 
3788d70e9693SJohannes Berg /**
37890c28ec58SEliad Peller  * cfg80211_find_vendor_ie - find vendor specific information element in data
37900c28ec58SEliad Peller  *
37910c28ec58SEliad Peller  * @oui: vendor OUI
37920c28ec58SEliad Peller  * @oui_type: vendor-specific OUI type
37930c28ec58SEliad Peller  * @ies: data consisting of IEs
37940c28ec58SEliad Peller  * @len: length of data
37950c28ec58SEliad Peller  *
37960ae997dcSYacine Belkadi  * Return: %NULL if the vendor specific element ID could not be found or if the
37970ae997dcSYacine Belkadi  * element is invalid (claims to be longer than the given data), or a pointer to
37980ae997dcSYacine Belkadi  * the first byte of the requested element, that is the byte containing the
37990ae997dcSYacine Belkadi  * element ID.
38000ae997dcSYacine Belkadi  *
38010ae997dcSYacine Belkadi  * Note: There are no checks on the element length other than having to fit into
38020ae997dcSYacine Belkadi  * the given data.
38030c28ec58SEliad Peller  */
38040c28ec58SEliad Peller const u8 *cfg80211_find_vendor_ie(unsigned int oui, u8 oui_type,
38050c28ec58SEliad Peller 				  const u8 *ies, int len);
38060c28ec58SEliad Peller 
38070c28ec58SEliad Peller /**
3808d70e9693SJohannes Berg  * DOC: Regulatory enforcement infrastructure
3809d70e9693SJohannes Berg  *
3810d70e9693SJohannes Berg  * TODO
3811d3236553SJohannes Berg  */
3812d3236553SJohannes Berg 
3813d3236553SJohannes Berg /**
3814d3236553SJohannes Berg  * regulatory_hint - driver hint to the wireless core a regulatory domain
3815d3236553SJohannes Berg  * @wiphy: the wireless device giving the hint (used only for reporting
3816d3236553SJohannes Berg  *	conflicts)
3817d3236553SJohannes Berg  * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain
3818d3236553SJohannes Berg  * 	should be in. If @rd is set this should be NULL. Note that if you
3819d3236553SJohannes Berg  * 	set this to NULL you should still set rd->alpha2 to some accepted
3820d3236553SJohannes Berg  * 	alpha2.
3821d3236553SJohannes Berg  *
3822d3236553SJohannes Berg  * Wireless drivers can use this function to hint to the wireless core
3823d3236553SJohannes Berg  * what it believes should be the current regulatory domain by
3824d3236553SJohannes Berg  * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory
3825d3236553SJohannes Berg  * domain should be in or by providing a completely build regulatory domain.
3826d3236553SJohannes Berg  * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried
3827d3236553SJohannes Berg  * for a regulatory domain structure for the respective country.
3828d3236553SJohannes Berg  *
3829d3236553SJohannes Berg  * The wiphy must have been registered to cfg80211 prior to this call.
3830d3236553SJohannes Berg  * For cfg80211 drivers this means you must first use wiphy_register(),
3831d3236553SJohannes Berg  * for mac80211 drivers you must first use ieee80211_register_hw().
3832d3236553SJohannes Berg  *
3833d3236553SJohannes Berg  * Drivers should check the return value, its possible you can get
3834d3236553SJohannes Berg  * an -ENOMEM.
38350ae997dcSYacine Belkadi  *
38360ae997dcSYacine Belkadi  * Return: 0 on success. -ENOMEM.
3837d3236553SJohannes Berg  */
383810dd9b7cSJoe Perches int regulatory_hint(struct wiphy *wiphy, const char *alpha2);
3839d3236553SJohannes Berg 
3840d3236553SJohannes Berg /**
3841b0d7aa59SJonathan Doron  * regulatory_set_wiphy_regd - set regdom info for self managed drivers
3842b0d7aa59SJonathan Doron  * @wiphy: the wireless device we want to process the regulatory domain on
3843b0d7aa59SJonathan Doron  * @rd: the regulatory domain informatoin to use for this wiphy
3844b0d7aa59SJonathan Doron  *
3845b0d7aa59SJonathan Doron  * Set the regulatory domain information for self-managed wiphys, only they
3846b0d7aa59SJonathan Doron  * may use this function. See %REGULATORY_WIPHY_SELF_MANAGED for more
3847b0d7aa59SJonathan Doron  * information.
3848b0d7aa59SJonathan Doron  *
3849b0d7aa59SJonathan Doron  * Return: 0 on success. -EINVAL, -EPERM
3850b0d7aa59SJonathan Doron  */
3851b0d7aa59SJonathan Doron int regulatory_set_wiphy_regd(struct wiphy *wiphy,
3852b0d7aa59SJonathan Doron 			      struct ieee80211_regdomain *rd);
3853b0d7aa59SJonathan Doron 
3854b0d7aa59SJonathan Doron /**
38552c3e861cSArik Nemtsov  * regulatory_set_wiphy_regd_sync_rtnl - set regdom for self-managed drivers
38562c3e861cSArik Nemtsov  * @wiphy: the wireless device we want to process the regulatory domain on
38572c3e861cSArik Nemtsov  * @rd: the regulatory domain information to use for this wiphy
38582c3e861cSArik Nemtsov  *
38592c3e861cSArik Nemtsov  * This functions requires the RTNL to be held and applies the new regdomain
38602c3e861cSArik Nemtsov  * synchronously to this wiphy. For more details see
38612c3e861cSArik Nemtsov  * regulatory_set_wiphy_regd().
38622c3e861cSArik Nemtsov  *
38632c3e861cSArik Nemtsov  * Return: 0 on success. -EINVAL, -EPERM
38642c3e861cSArik Nemtsov  */
38652c3e861cSArik Nemtsov int regulatory_set_wiphy_regd_sync_rtnl(struct wiphy *wiphy,
38662c3e861cSArik Nemtsov 					struct ieee80211_regdomain *rd);
38672c3e861cSArik Nemtsov 
38682c3e861cSArik Nemtsov /**
3869d3236553SJohannes Berg  * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain
3870d3236553SJohannes Berg  * @wiphy: the wireless device we want to process the regulatory domain on
3871d3236553SJohannes Berg  * @regd: the custom regulatory domain to use for this wiphy
3872d3236553SJohannes Berg  *
3873d3236553SJohannes Berg  * Drivers can sometimes have custom regulatory domains which do not apply
3874d3236553SJohannes Berg  * to a specific country. Drivers can use this to apply such custom regulatory
3875d3236553SJohannes Berg  * domains. This routine must be called prior to wiphy registration. The
3876d3236553SJohannes Berg  * custom regulatory domain will be trusted completely and as such previous
3877d3236553SJohannes Berg  * default channel settings will be disregarded. If no rule is found for a
3878d3236553SJohannes Berg  * channel on the regulatory domain the channel will be disabled.
3879222ea581SLuis R. Rodriguez  * Drivers using this for a wiphy should also set the wiphy flag
3880ce26151bSKalle Valo  * REGULATORY_CUSTOM_REG or cfg80211 will set it for the wiphy
3881222ea581SLuis R. Rodriguez  * that called this helper.
3882d3236553SJohannes Berg  */
388310dd9b7cSJoe Perches void wiphy_apply_custom_regulatory(struct wiphy *wiphy,
3884d3236553SJohannes Berg 				   const struct ieee80211_regdomain *regd);
3885d3236553SJohannes Berg 
3886d3236553SJohannes Berg /**
3887d3236553SJohannes Berg  * freq_reg_info - get regulatory information for the given frequency
3888d3236553SJohannes Berg  * @wiphy: the wiphy for which we want to process this rule for
3889d3236553SJohannes Berg  * @center_freq: Frequency in KHz for which we want regulatory information for
3890d3236553SJohannes Berg  *
3891d3236553SJohannes Berg  * Use this function to get the regulatory rule for a specific frequency on
3892d3236553SJohannes Berg  * a given wireless device. If the device has a specific regulatory domain
3893d3236553SJohannes Berg  * it wants to follow we respect that unless a country IE has been received
3894d3236553SJohannes Berg  * and processed already.
3895d3236553SJohannes Berg  *
38960ae997dcSYacine Belkadi  * Return: A valid pointer, or, when an error occurs, for example if no rule
38970ae997dcSYacine Belkadi  * can be found, the return value is encoded using ERR_PTR(). Use IS_ERR() to
38980ae997dcSYacine Belkadi  * check and PTR_ERR() to obtain the numeric return value. The numeric return
38990ae997dcSYacine Belkadi  * value will be -ERANGE if we determine the given center_freq does not even
39000ae997dcSYacine Belkadi  * have a regulatory rule for a frequency range in the center_freq's band.
39010ae997dcSYacine Belkadi  * See freq_in_rule_band() for our current definition of a band -- this is
39020ae997dcSYacine Belkadi  * purely subjective and right now it's 802.11 specific.
3903d3236553SJohannes Berg  */
3904361c9c8bSJohannes Berg const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy,
3905361c9c8bSJohannes Berg 					       u32 center_freq);
3906d3236553SJohannes Berg 
3907034c6d6eSLuis R. Rodriguez /**
3908034c6d6eSLuis R. Rodriguez  * reg_initiator_name - map regulatory request initiator enum to name
3909034c6d6eSLuis R. Rodriguez  * @initiator: the regulatory request initiator
3910034c6d6eSLuis R. Rodriguez  *
3911034c6d6eSLuis R. Rodriguez  * You can use this to map the regulatory request initiator enum to a
3912034c6d6eSLuis R. Rodriguez  * proper string representation.
3913034c6d6eSLuis R. Rodriguez  */
3914034c6d6eSLuis R. Rodriguez const char *reg_initiator_name(enum nl80211_reg_initiator initiator);
3915034c6d6eSLuis R. Rodriguez 
3916d3236553SJohannes Berg /*
3917d3236553SJohannes Berg  * callbacks for asynchronous cfg80211 methods, notification
3918d3236553SJohannes Berg  * functions and BSS handling helpers
3919d3236553SJohannes Berg  */
3920d3236553SJohannes Berg 
39212a519311SJohannes Berg /**
39222a519311SJohannes Berg  * cfg80211_scan_done - notify that scan finished
39232a519311SJohannes Berg  *
39242a519311SJohannes Berg  * @request: the corresponding scan request
39252a519311SJohannes Berg  * @aborted: set to true if the scan was aborted for any reason,
39262a519311SJohannes Berg  *	userspace will be notified of that
39272a519311SJohannes Berg  */
39282a519311SJohannes Berg void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted);
39292a519311SJohannes Berg 
39302a519311SJohannes Berg /**
3931807f8a8cSLuciano Coelho  * cfg80211_sched_scan_results - notify that new scan results are available
3932807f8a8cSLuciano Coelho  *
3933807f8a8cSLuciano Coelho  * @wiphy: the wiphy which got scheduled scan results
3934807f8a8cSLuciano Coelho  */
3935807f8a8cSLuciano Coelho void cfg80211_sched_scan_results(struct wiphy *wiphy);
3936807f8a8cSLuciano Coelho 
3937807f8a8cSLuciano Coelho /**
3938807f8a8cSLuciano Coelho  * cfg80211_sched_scan_stopped - notify that the scheduled scan has stopped
3939807f8a8cSLuciano Coelho  *
3940807f8a8cSLuciano Coelho  * @wiphy: the wiphy on which the scheduled scan stopped
3941807f8a8cSLuciano Coelho  *
3942807f8a8cSLuciano Coelho  * The driver can call this function to inform cfg80211 that the
3943807f8a8cSLuciano Coelho  * scheduled scan had to be stopped, for whatever reason.  The driver
3944807f8a8cSLuciano Coelho  * is then called back via the sched_scan_stop operation when done.
3945807f8a8cSLuciano Coelho  */
3946807f8a8cSLuciano Coelho void cfg80211_sched_scan_stopped(struct wiphy *wiphy);
3947807f8a8cSLuciano Coelho 
3948807f8a8cSLuciano Coelho /**
3949792e6aa7SEliad Peller  * cfg80211_sched_scan_stopped_rtnl - notify that the scheduled scan has stopped
3950792e6aa7SEliad Peller  *
3951792e6aa7SEliad Peller  * @wiphy: the wiphy on which the scheduled scan stopped
3952792e6aa7SEliad Peller  *
3953792e6aa7SEliad Peller  * The driver can call this function to inform cfg80211 that the
3954792e6aa7SEliad Peller  * scheduled scan had to be stopped, for whatever reason.  The driver
3955792e6aa7SEliad Peller  * is then called back via the sched_scan_stop operation when done.
3956792e6aa7SEliad Peller  * This function should be called with rtnl locked.
3957792e6aa7SEliad Peller  */
3958792e6aa7SEliad Peller void cfg80211_sched_scan_stopped_rtnl(struct wiphy *wiphy);
3959792e6aa7SEliad Peller 
3960792e6aa7SEliad Peller /**
3961dcd6eac1SSimon Wunderlich  * cfg80211_inform_bss_width_frame - inform cfg80211 of a received BSS frame
39622a519311SJohannes Berg  *
39632a519311SJohannes Berg  * @wiphy: the wiphy reporting the BSS
39643afc2167SEmmanuel Grumbach  * @rx_channel: The channel the frame was received on
3965dcd6eac1SSimon Wunderlich  * @scan_width: width of the control channel
3966abe37c4bSJohannes Berg  * @mgmt: the management frame (probe response or beacon)
3967abe37c4bSJohannes Berg  * @len: length of the management frame
396877965c97SJohannes Berg  * @signal: the signal strength, type depends on the wiphy's signal_type
39692a519311SJohannes Berg  * @gfp: context flags
39702a519311SJohannes Berg  *
39712a519311SJohannes Berg  * This informs cfg80211 that BSS information was found and
39722a519311SJohannes Berg  * the BSS should be updated/added.
3973ef100682SJohannes Berg  *
39740ae997dcSYacine Belkadi  * Return: A referenced struct, must be released with cfg80211_put_bss()!
39750ae997dcSYacine Belkadi  * Or %NULL on error.
39762a519311SJohannes Berg  */
3977ef100682SJohannes Berg struct cfg80211_bss * __must_check
3978dcd6eac1SSimon Wunderlich cfg80211_inform_bss_width_frame(struct wiphy *wiphy,
39793afc2167SEmmanuel Grumbach 				struct ieee80211_channel *rx_channel,
3980dcd6eac1SSimon Wunderlich 				enum nl80211_bss_scan_width scan_width,
3981dcd6eac1SSimon Wunderlich 				struct ieee80211_mgmt *mgmt, size_t len,
3982dcd6eac1SSimon Wunderlich 				s32 signal, gfp_t gfp);
3983dcd6eac1SSimon Wunderlich 
3984dcd6eac1SSimon Wunderlich static inline struct cfg80211_bss * __must_check
39852a519311SJohannes Berg cfg80211_inform_bss_frame(struct wiphy *wiphy,
39863afc2167SEmmanuel Grumbach 			  struct ieee80211_channel *rx_channel,
39872a519311SJohannes Berg 			  struct ieee80211_mgmt *mgmt, size_t len,
3988dcd6eac1SSimon Wunderlich 			  s32 signal, gfp_t gfp)
3989dcd6eac1SSimon Wunderlich {
39903afc2167SEmmanuel Grumbach 	return cfg80211_inform_bss_width_frame(wiphy, rx_channel,
3991dcd6eac1SSimon Wunderlich 					       NL80211_BSS_CHAN_WIDTH_20,
3992dcd6eac1SSimon Wunderlich 					       mgmt, len, signal, gfp);
3993dcd6eac1SSimon Wunderlich }
39942a519311SJohannes Berg 
3995abe37c4bSJohannes Berg /**
39965bc8c1f2SJohannes Berg  * enum cfg80211_bss_frame_type - frame type that the BSS data came from
39975bc8c1f2SJohannes Berg  * @CFG80211_BSS_FTYPE_UNKNOWN: driver doesn't know whether the data is
39985bc8c1f2SJohannes Berg  *	from a beacon or probe response
39995bc8c1f2SJohannes Berg  * @CFG80211_BSS_FTYPE_BEACON: data comes from a beacon
40005bc8c1f2SJohannes Berg  * @CFG80211_BSS_FTYPE_PRESP: data comes from a probe response
40015bc8c1f2SJohannes Berg  */
40025bc8c1f2SJohannes Berg enum cfg80211_bss_frame_type {
40035bc8c1f2SJohannes Berg 	CFG80211_BSS_FTYPE_UNKNOWN,
40045bc8c1f2SJohannes Berg 	CFG80211_BSS_FTYPE_BEACON,
40055bc8c1f2SJohannes Berg 	CFG80211_BSS_FTYPE_PRESP,
40065bc8c1f2SJohannes Berg };
40075bc8c1f2SJohannes Berg 
40085bc8c1f2SJohannes Berg /**
40095bc8c1f2SJohannes Berg  * cfg80211_inform_bss_width - inform cfg80211 of a new BSS
4010abe37c4bSJohannes Berg  *
4011abe37c4bSJohannes Berg  * @wiphy: the wiphy reporting the BSS
40123afc2167SEmmanuel Grumbach  * @rx_channel: The channel the frame was received on
4013dcd6eac1SSimon Wunderlich  * @scan_width: width of the control channel
40145bc8c1f2SJohannes Berg  * @ftype: frame type (if known)
4015abe37c4bSJohannes Berg  * @bssid: the BSSID of the BSS
40167b8bcff2SJohannes Berg  * @tsf: the TSF sent by the peer in the beacon/probe response (or 0)
4017abe37c4bSJohannes Berg  * @capability: the capability field sent by the peer
4018abe37c4bSJohannes Berg  * @beacon_interval: the beacon interval announced by the peer
4019abe37c4bSJohannes Berg  * @ie: additional IEs sent by the peer
4020abe37c4bSJohannes Berg  * @ielen: length of the additional IEs
4021abe37c4bSJohannes Berg  * @signal: the signal strength, type depends on the wiphy's signal_type
4022abe37c4bSJohannes Berg  * @gfp: context flags
4023abe37c4bSJohannes Berg  *
4024abe37c4bSJohannes Berg  * This informs cfg80211 that BSS information was found and
4025abe37c4bSJohannes Berg  * the BSS should be updated/added.
4026ef100682SJohannes Berg  *
40270ae997dcSYacine Belkadi  * Return: A referenced struct, must be released with cfg80211_put_bss()!
40280ae997dcSYacine Belkadi  * Or %NULL on error.
4029abe37c4bSJohannes Berg  */
4030ef100682SJohannes Berg struct cfg80211_bss * __must_check
4031dcd6eac1SSimon Wunderlich cfg80211_inform_bss_width(struct wiphy *wiphy,
40323afc2167SEmmanuel Grumbach 			  struct ieee80211_channel *rx_channel,
4033dcd6eac1SSimon Wunderlich 			  enum nl80211_bss_scan_width scan_width,
40345bc8c1f2SJohannes Berg 			  enum cfg80211_bss_frame_type ftype,
4035dcd6eac1SSimon Wunderlich 			  const u8 *bssid, u64 tsf, u16 capability,
4036dcd6eac1SSimon Wunderlich 			  u16 beacon_interval, const u8 *ie, size_t ielen,
4037dcd6eac1SSimon Wunderlich 			  s32 signal, gfp_t gfp);
4038dcd6eac1SSimon Wunderlich 
4039dcd6eac1SSimon Wunderlich static inline struct cfg80211_bss * __must_check
404006aa7afaSJussi Kivilinna cfg80211_inform_bss(struct wiphy *wiphy,
40413afc2167SEmmanuel Grumbach 		    struct ieee80211_channel *rx_channel,
40425bc8c1f2SJohannes Berg 		    enum cfg80211_bss_frame_type ftype,
40437b8bcff2SJohannes Berg 		    const u8 *bssid, u64 tsf, u16 capability,
40447b8bcff2SJohannes Berg 		    u16 beacon_interval, const u8 *ie, size_t ielen,
4045dcd6eac1SSimon Wunderlich 		    s32 signal, gfp_t gfp)
4046dcd6eac1SSimon Wunderlich {
40473afc2167SEmmanuel Grumbach 	return cfg80211_inform_bss_width(wiphy, rx_channel,
40485bc8c1f2SJohannes Berg 					 NL80211_BSS_CHAN_WIDTH_20, ftype,
4049dcd6eac1SSimon Wunderlich 					 bssid, tsf, capability,
4050dcd6eac1SSimon Wunderlich 					 beacon_interval, ie, ielen, signal,
4051dcd6eac1SSimon Wunderlich 					 gfp);
4052dcd6eac1SSimon Wunderlich }
405306aa7afaSJussi Kivilinna 
40542a519311SJohannes Berg struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
40552a519311SJohannes Berg 				      struct ieee80211_channel *channel,
40562a519311SJohannes Berg 				      const u8 *bssid,
405779420f09SJohannes Berg 				      const u8 *ssid, size_t ssid_len,
40586eb18137SDedy Lansky 				      enum ieee80211_bss_type bss_type,
40596eb18137SDedy Lansky 				      enum ieee80211_privacy);
406079420f09SJohannes Berg static inline struct cfg80211_bss *
406179420f09SJohannes Berg cfg80211_get_ibss(struct wiphy *wiphy,
406279420f09SJohannes Berg 		  struct ieee80211_channel *channel,
406379420f09SJohannes Berg 		  const u8 *ssid, size_t ssid_len)
406479420f09SJohannes Berg {
406579420f09SJohannes Berg 	return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len,
40666eb18137SDedy Lansky 				IEEE80211_BSS_TYPE_IBSS,
40676eb18137SDedy Lansky 				IEEE80211_PRIVACY_ANY);
406879420f09SJohannes Berg }
406979420f09SJohannes Berg 
40704c0c0b75SJohannes Berg /**
40714c0c0b75SJohannes Berg  * cfg80211_ref_bss - reference BSS struct
40725b112d3dSJohannes Berg  * @wiphy: the wiphy this BSS struct belongs to
40734c0c0b75SJohannes Berg  * @bss: the BSS struct to reference
40744c0c0b75SJohannes Berg  *
40754c0c0b75SJohannes Berg  * Increments the refcount of the given BSS struct.
40764c0c0b75SJohannes Berg  */
40775b112d3dSJohannes Berg void cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
40784c0c0b75SJohannes Berg 
40794c0c0b75SJohannes Berg /**
40804c0c0b75SJohannes Berg  * cfg80211_put_bss - unref BSS struct
40815b112d3dSJohannes Berg  * @wiphy: the wiphy this BSS struct belongs to
40824c0c0b75SJohannes Berg  * @bss: the BSS struct
40834c0c0b75SJohannes Berg  *
40844c0c0b75SJohannes Berg  * Decrements the refcount of the given BSS struct.
40854c0c0b75SJohannes Berg  */
40865b112d3dSJohannes Berg void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
4087d3236553SJohannes Berg 
4088d491af19SJohannes Berg /**
4089d491af19SJohannes Berg  * cfg80211_unlink_bss - unlink BSS from internal data structures
4090d491af19SJohannes Berg  * @wiphy: the wiphy
4091d491af19SJohannes Berg  * @bss: the bss to remove
4092d491af19SJohannes Berg  *
4093d491af19SJohannes Berg  * This function removes the given BSS from the internal data structures
4094d491af19SJohannes Berg  * thereby making it no longer show up in scan results etc. Use this
4095d491af19SJohannes Berg  * function when you detect a BSS is gone. Normally BSSes will also time
4096d491af19SJohannes Berg  * out, so it is not necessary to use this function at all.
4097d491af19SJohannes Berg  */
4098d491af19SJohannes Berg void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
4099fee52678SJohannes Berg 
4100dcd6eac1SSimon Wunderlich static inline enum nl80211_bss_scan_width
4101dcd6eac1SSimon Wunderlich cfg80211_chandef_to_scan_width(const struct cfg80211_chan_def *chandef)
4102dcd6eac1SSimon Wunderlich {
4103dcd6eac1SSimon Wunderlich 	switch (chandef->width) {
4104dcd6eac1SSimon Wunderlich 	case NL80211_CHAN_WIDTH_5:
4105dcd6eac1SSimon Wunderlich 		return NL80211_BSS_CHAN_WIDTH_5;
4106dcd6eac1SSimon Wunderlich 	case NL80211_CHAN_WIDTH_10:
4107dcd6eac1SSimon Wunderlich 		return NL80211_BSS_CHAN_WIDTH_10;
4108dcd6eac1SSimon Wunderlich 	default:
4109dcd6eac1SSimon Wunderlich 		return NL80211_BSS_CHAN_WIDTH_20;
4110dcd6eac1SSimon Wunderlich 	}
4111dcd6eac1SSimon Wunderlich }
4112dcd6eac1SSimon Wunderlich 
41136039f6d2SJouni Malinen /**
41146ff57cf8SJohannes Berg  * cfg80211_rx_mlme_mgmt - notification of processed MLME management frame
41156039f6d2SJouni Malinen  * @dev: network device
41166039f6d2SJouni Malinen  * @buf: authentication frame (header + body)
41176039f6d2SJouni Malinen  * @len: length of the frame data
41186039f6d2SJouni Malinen  *
41196ff57cf8SJohannes Berg  * This function is called whenever an authentication, disassociation or
41206ff57cf8SJohannes Berg  * deauthentication frame has been received and processed in station mode.
41216ff57cf8SJohannes Berg  * After being asked to authenticate via cfg80211_ops::auth() the driver must
41226ff57cf8SJohannes Berg  * call either this function or cfg80211_auth_timeout().
41236ff57cf8SJohannes Berg  * After being asked to associate via cfg80211_ops::assoc() the driver must
41246ff57cf8SJohannes Berg  * call either this function or cfg80211_auth_timeout().
41256ff57cf8SJohannes Berg  * While connected, the driver must calls this for received and processed
41266ff57cf8SJohannes Berg  * disassociation and deauthentication frames. If the frame couldn't be used
41276ff57cf8SJohannes Berg  * because it was unprotected, the driver must call the function
41286ff57cf8SJohannes Berg  * cfg80211_rx_unprot_mlme_mgmt() instead.
41296ff57cf8SJohannes Berg  *
41306ff57cf8SJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's mutex.
41316039f6d2SJouni Malinen  */
41326ff57cf8SJohannes Berg void cfg80211_rx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len);
41336039f6d2SJouni Malinen 
41346039f6d2SJouni Malinen /**
41356ff57cf8SJohannes Berg  * cfg80211_auth_timeout - notification of timed out authentication
41361965c853SJouni Malinen  * @dev: network device
41371965c853SJouni Malinen  * @addr: The MAC address of the device with which the authentication timed out
4138cb0b4bebSJohannes Berg  *
41398d61ffa5SJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's
41408d61ffa5SJohannes Berg  * mutex.
41411965c853SJouni Malinen  */
41426ff57cf8SJohannes Berg void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr);
41431965c853SJouni Malinen 
41441965c853SJouni Malinen /**
41456ff57cf8SJohannes Berg  * cfg80211_rx_assoc_resp - notification of processed association response
41466039f6d2SJouni Malinen  * @dev: network device
41476ff57cf8SJohannes Berg  * @bss: the BSS that association was requested with, ownership of the pointer
41486ff57cf8SJohannes Berg  *	moves to cfg80211 in this call
41496ff57cf8SJohannes Berg  * @buf: authentication frame (header + body)
41506039f6d2SJouni Malinen  * @len: length of the frame data
4151b0b6aa2cSEliad Peller  * @uapsd_queues: bitmap of ACs configured to uapsd. -1 if n/a.
41526039f6d2SJouni Malinen  *
41536ff57cf8SJohannes Berg  * After being asked to associate via cfg80211_ops::assoc() the driver must
41546ff57cf8SJohannes Berg  * call either this function or cfg80211_auth_timeout().
41556ff57cf8SJohannes Berg  *
41566ff57cf8SJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's mutex.
41576039f6d2SJouni Malinen  */
41586ff57cf8SJohannes Berg void cfg80211_rx_assoc_resp(struct net_device *dev,
41596ff57cf8SJohannes Berg 			    struct cfg80211_bss *bss,
4160b0b6aa2cSEliad Peller 			    const u8 *buf, size_t len,
4161b0b6aa2cSEliad Peller 			    int uapsd_queues);
41626039f6d2SJouni Malinen 
41636039f6d2SJouni Malinen /**
41646ff57cf8SJohannes Berg  * cfg80211_assoc_timeout - notification of timed out association
41651965c853SJouni Malinen  * @dev: network device
4166959867faSJohannes Berg  * @bss: The BSS entry with which association timed out.
4167cb0b4bebSJohannes Berg  *
41688d61ffa5SJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's mutex.
41691965c853SJouni Malinen  */
4170959867faSJohannes Berg void cfg80211_assoc_timeout(struct net_device *dev, struct cfg80211_bss *bss);
41711965c853SJouni Malinen 
41721965c853SJouni Malinen /**
41736ff57cf8SJohannes Berg  * cfg80211_tx_mlme_mgmt - notification of transmitted deauth/disassoc frame
41746039f6d2SJouni Malinen  * @dev: network device
41756ff57cf8SJohannes Berg  * @buf: 802.11 frame (header + body)
41766039f6d2SJouni Malinen  * @len: length of the frame data
41776039f6d2SJouni Malinen  *
41786039f6d2SJouni Malinen  * This function is called whenever deauthentication has been processed in
417953b46b84SJouni Malinen  * station mode. This includes both received deauthentication frames and
41808d61ffa5SJohannes Berg  * locally generated ones. This function may sleep. The caller must hold the
41818d61ffa5SJohannes Berg  * corresponding wdev's mutex.
41826039f6d2SJouni Malinen  */
41836ff57cf8SJohannes Berg void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len);
4184ce470613SHolger Schurig 
4185ce470613SHolger Schurig /**
41866ff57cf8SJohannes Berg  * cfg80211_rx_unprot_mlme_mgmt - notification of unprotected mlme mgmt frame
4187cf4e594eSJouni Malinen  * @dev: network device
4188cf4e594eSJouni Malinen  * @buf: deauthentication frame (header + body)
4189cf4e594eSJouni Malinen  * @len: length of the frame data
4190cf4e594eSJouni Malinen  *
41916ff57cf8SJohannes Berg  * This function is called whenever a received deauthentication or dissassoc
41926ff57cf8SJohannes Berg  * frame has been dropped in station mode because of MFP being used but the
4193cf4e594eSJouni Malinen  * frame was not protected. This function may sleep.
4194cf4e594eSJouni Malinen  */
41956ff57cf8SJohannes Berg void cfg80211_rx_unprot_mlme_mgmt(struct net_device *dev,
41966ff57cf8SJohannes Berg 				  const u8 *buf, size_t len);
4197cf4e594eSJouni Malinen 
4198cf4e594eSJouni Malinen /**
4199a3b8b056SJouni Malinen  * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP)
4200a3b8b056SJouni Malinen  * @dev: network device
4201a3b8b056SJouni Malinen  * @addr: The source MAC address of the frame
4202a3b8b056SJouni Malinen  * @key_type: The key type that the received frame used
4203a66b98dbSArik Nemtsov  * @key_id: Key identifier (0..3). Can be -1 if missing.
4204a3b8b056SJouni Malinen  * @tsc: The TSC value of the frame that generated the MIC failure (6 octets)
4205e6d6e342SJohannes Berg  * @gfp: allocation flags
4206a3b8b056SJouni Malinen  *
4207a3b8b056SJouni Malinen  * This function is called whenever the local MAC detects a MIC failure in a
4208a3b8b056SJouni Malinen  * received frame. This matches with MLME-MICHAELMICFAILURE.indication()
4209a3b8b056SJouni Malinen  * primitive.
4210a3b8b056SJouni Malinen  */
4211a3b8b056SJouni Malinen void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,
4212a3b8b056SJouni Malinen 				  enum nl80211_key_type key_type, int key_id,
4213e6d6e342SJohannes Berg 				  const u8 *tsc, gfp_t gfp);
4214a3b8b056SJouni Malinen 
421504a773adSJohannes Berg /**
421604a773adSJohannes Berg  * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS
421704a773adSJohannes Berg  *
421804a773adSJohannes Berg  * @dev: network device
421904a773adSJohannes Berg  * @bssid: the BSSID of the IBSS joined
4220fe94f3a4SAntonio Quartulli  * @channel: the channel of the IBSS joined
422104a773adSJohannes Berg  * @gfp: allocation flags
422204a773adSJohannes Berg  *
422304a773adSJohannes Berg  * This function notifies cfg80211 that the device joined an IBSS or
422404a773adSJohannes Berg  * switched to a different BSSID. Before this function can be called,
422504a773adSJohannes Berg  * either a beacon has to have been received from the IBSS, or one of
422604a773adSJohannes Berg  * the cfg80211_inform_bss{,_frame} functions must have been called
422704a773adSJohannes Berg  * with the locally generated beacon -- this guarantees that there is
422804a773adSJohannes Berg  * always a scan result for this IBSS. cfg80211 will handle the rest.
422904a773adSJohannes Berg  */
4230fe94f3a4SAntonio Quartulli void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid,
4231fe94f3a4SAntonio Quartulli 			  struct ieee80211_channel *channel, gfp_t gfp);
423204a773adSJohannes Berg 
42331f87f7d3SJohannes Berg /**
4234c93b5e71SJavier Cardona  * cfg80211_notify_new_candidate - notify cfg80211 of a new mesh peer candidate
4235c93b5e71SJavier Cardona  *
4236c93b5e71SJavier Cardona  * @dev: network device
4237c93b5e71SJavier Cardona  * @macaddr: the MAC address of the new candidate
4238c93b5e71SJavier Cardona  * @ie: information elements advertised by the peer candidate
4239c93b5e71SJavier Cardona  * @ie_len: lenght of the information elements buffer
4240c93b5e71SJavier Cardona  * @gfp: allocation flags
4241c93b5e71SJavier Cardona  *
4242c93b5e71SJavier Cardona  * This function notifies cfg80211 that the mesh peer candidate has been
4243c93b5e71SJavier Cardona  * detected, most likely via a beacon or, less likely, via a probe response.
4244c93b5e71SJavier Cardona  * cfg80211 then sends a notification to userspace.
4245c93b5e71SJavier Cardona  */
4246c93b5e71SJavier Cardona void cfg80211_notify_new_peer_candidate(struct net_device *dev,
4247c93b5e71SJavier Cardona 		const u8 *macaddr, const u8 *ie, u8 ie_len, gfp_t gfp);
4248c93b5e71SJavier Cardona 
4249c93b5e71SJavier Cardona /**
4250d70e9693SJohannes Berg  * DOC: RFkill integration
4251d70e9693SJohannes Berg  *
4252d70e9693SJohannes Berg  * RFkill integration in cfg80211 is almost invisible to drivers,
4253d70e9693SJohannes Berg  * as cfg80211 automatically registers an rfkill instance for each
4254d70e9693SJohannes Berg  * wireless device it knows about. Soft kill is also translated
4255d70e9693SJohannes Berg  * into disconnecting and turning all interfaces off, drivers are
4256d70e9693SJohannes Berg  * expected to turn off the device when all interfaces are down.
4257d70e9693SJohannes Berg  *
4258d70e9693SJohannes Berg  * However, devices may have a hard RFkill line, in which case they
4259d70e9693SJohannes Berg  * also need to interact with the rfkill subsystem, via cfg80211.
4260d70e9693SJohannes Berg  * They can do this with a few helper functions documented here.
4261d70e9693SJohannes Berg  */
4262d70e9693SJohannes Berg 
4263d70e9693SJohannes Berg /**
42641f87f7d3SJohannes Berg  * wiphy_rfkill_set_hw_state - notify cfg80211 about hw block state
42651f87f7d3SJohannes Berg  * @wiphy: the wiphy
42661f87f7d3SJohannes Berg  * @blocked: block status
42671f87f7d3SJohannes Berg  */
42681f87f7d3SJohannes Berg void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked);
42691f87f7d3SJohannes Berg 
42701f87f7d3SJohannes Berg /**
42711f87f7d3SJohannes Berg  * wiphy_rfkill_start_polling - start polling rfkill
42721f87f7d3SJohannes Berg  * @wiphy: the wiphy
42731f87f7d3SJohannes Berg  */
42741f87f7d3SJohannes Berg void wiphy_rfkill_start_polling(struct wiphy *wiphy);
42751f87f7d3SJohannes Berg 
42761f87f7d3SJohannes Berg /**
42771f87f7d3SJohannes Berg  * wiphy_rfkill_stop_polling - stop polling rfkill
42781f87f7d3SJohannes Berg  * @wiphy: the wiphy
42791f87f7d3SJohannes Berg  */
42801f87f7d3SJohannes Berg void wiphy_rfkill_stop_polling(struct wiphy *wiphy);
42811f87f7d3SJohannes Berg 
4282ad7e718cSJohannes Berg /**
4283ad7e718cSJohannes Berg  * DOC: Vendor commands
4284ad7e718cSJohannes Berg  *
4285ad7e718cSJohannes Berg  * Occasionally, there are special protocol or firmware features that
4286ad7e718cSJohannes Berg  * can't be implemented very openly. For this and similar cases, the
4287ad7e718cSJohannes Berg  * vendor command functionality allows implementing the features with
4288ad7e718cSJohannes Berg  * (typically closed-source) userspace and firmware, using nl80211 as
4289ad7e718cSJohannes Berg  * the configuration mechanism.
4290ad7e718cSJohannes Berg  *
4291ad7e718cSJohannes Berg  * A driver supporting vendor commands must register them as an array
4292ad7e718cSJohannes Berg  * in struct wiphy, with handlers for each one, each command has an
4293ad7e718cSJohannes Berg  * OUI and sub command ID to identify it.
4294ad7e718cSJohannes Berg  *
4295ad7e718cSJohannes Berg  * Note that this feature should not be (ab)used to implement protocol
4296ad7e718cSJohannes Berg  * features that could openly be shared across drivers. In particular,
4297ad7e718cSJohannes Berg  * it must never be required to use vendor commands to implement any
4298ad7e718cSJohannes Berg  * "normal" functionality that higher-level userspace like connection
4299ad7e718cSJohannes Berg  * managers etc. need.
4300ad7e718cSJohannes Berg  */
4301ad7e718cSJohannes Berg 
4302ad7e718cSJohannes Berg struct sk_buff *__cfg80211_alloc_reply_skb(struct wiphy *wiphy,
4303ad7e718cSJohannes Berg 					   enum nl80211_commands cmd,
4304ad7e718cSJohannes Berg 					   enum nl80211_attrs attr,
4305ad7e718cSJohannes Berg 					   int approxlen);
4306ad7e718cSJohannes Berg 
4307567ffc35SJohannes Berg struct sk_buff *__cfg80211_alloc_event_skb(struct wiphy *wiphy,
43086c09e791SAhmad Kholaif 					   struct wireless_dev *wdev,
4309567ffc35SJohannes Berg 					   enum nl80211_commands cmd,
4310567ffc35SJohannes Berg 					   enum nl80211_attrs attr,
4311567ffc35SJohannes Berg 					   int vendor_event_idx,
4312567ffc35SJohannes Berg 					   int approxlen, gfp_t gfp);
4313567ffc35SJohannes Berg 
4314567ffc35SJohannes Berg void __cfg80211_send_event_skb(struct sk_buff *skb, gfp_t gfp);
4315567ffc35SJohannes Berg 
4316ad7e718cSJohannes Berg /**
4317ad7e718cSJohannes Berg  * cfg80211_vendor_cmd_alloc_reply_skb - allocate vendor command reply
4318ad7e718cSJohannes Berg  * @wiphy: the wiphy
4319ad7e718cSJohannes Berg  * @approxlen: an upper bound of the length of the data that will
4320ad7e718cSJohannes Berg  *	be put into the skb
4321ad7e718cSJohannes Berg  *
4322ad7e718cSJohannes Berg  * This function allocates and pre-fills an skb for a reply to
4323ad7e718cSJohannes Berg  * a vendor command. Since it is intended for a reply, calling
4324ad7e718cSJohannes Berg  * it outside of a vendor command's doit() operation is invalid.
4325ad7e718cSJohannes Berg  *
4326ad7e718cSJohannes Berg  * The returned skb is pre-filled with some identifying data in
4327ad7e718cSJohannes Berg  * a way that any data that is put into the skb (with skb_put(),
4328ad7e718cSJohannes Berg  * nla_put() or similar) will end up being within the
4329ad7e718cSJohannes Berg  * %NL80211_ATTR_VENDOR_DATA attribute, so all that needs to be done
4330ad7e718cSJohannes Berg  * with the skb is adding data for the corresponding userspace tool
4331ad7e718cSJohannes Berg  * which can then read that data out of the vendor data attribute.
4332ad7e718cSJohannes Berg  * You must not modify the skb in any other way.
4333ad7e718cSJohannes Berg  *
4334ad7e718cSJohannes Berg  * When done, call cfg80211_vendor_cmd_reply() with the skb and return
4335ad7e718cSJohannes Berg  * its error code as the result of the doit() operation.
4336ad7e718cSJohannes Berg  *
4337ad7e718cSJohannes Berg  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
4338ad7e718cSJohannes Berg  */
4339ad7e718cSJohannes Berg static inline struct sk_buff *
4340ad7e718cSJohannes Berg cfg80211_vendor_cmd_alloc_reply_skb(struct wiphy *wiphy, int approxlen)
4341ad7e718cSJohannes Berg {
4342ad7e718cSJohannes Berg 	return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_VENDOR,
4343ad7e718cSJohannes Berg 					  NL80211_ATTR_VENDOR_DATA, approxlen);
4344ad7e718cSJohannes Berg }
4345ad7e718cSJohannes Berg 
4346ad7e718cSJohannes Berg /**
4347ad7e718cSJohannes Berg  * cfg80211_vendor_cmd_reply - send the reply skb
4348ad7e718cSJohannes Berg  * @skb: The skb, must have been allocated with
4349ad7e718cSJohannes Berg  *	cfg80211_vendor_cmd_alloc_reply_skb()
4350ad7e718cSJohannes Berg  *
4351ad7e718cSJohannes Berg  * Since calling this function will usually be the last thing
4352ad7e718cSJohannes Berg  * before returning from the vendor command doit() you should
4353ad7e718cSJohannes Berg  * return the error code.  Note that this function consumes the
4354ad7e718cSJohannes Berg  * skb regardless of the return value.
4355ad7e718cSJohannes Berg  *
4356ad7e718cSJohannes Berg  * Return: An error code or 0 on success.
4357ad7e718cSJohannes Berg  */
4358ad7e718cSJohannes Berg int cfg80211_vendor_cmd_reply(struct sk_buff *skb);
4359ad7e718cSJohannes Berg 
4360567ffc35SJohannes Berg /**
4361567ffc35SJohannes Berg  * cfg80211_vendor_event_alloc - allocate vendor-specific event skb
4362567ffc35SJohannes Berg  * @wiphy: the wiphy
43636c09e791SAhmad Kholaif  * @wdev: the wireless device
4364567ffc35SJohannes Berg  * @event_idx: index of the vendor event in the wiphy's vendor_events
4365567ffc35SJohannes Berg  * @approxlen: an upper bound of the length of the data that will
4366567ffc35SJohannes Berg  *	be put into the skb
4367567ffc35SJohannes Berg  * @gfp: allocation flags
4368567ffc35SJohannes Berg  *
4369567ffc35SJohannes Berg  * This function allocates and pre-fills an skb for an event on the
4370567ffc35SJohannes Berg  * vendor-specific multicast group.
4371567ffc35SJohannes Berg  *
43726c09e791SAhmad Kholaif  * If wdev != NULL, both the ifindex and identifier of the specified
43736c09e791SAhmad Kholaif  * wireless device are added to the event message before the vendor data
43746c09e791SAhmad Kholaif  * attribute.
43756c09e791SAhmad Kholaif  *
4376567ffc35SJohannes Berg  * When done filling the skb, call cfg80211_vendor_event() with the
4377567ffc35SJohannes Berg  * skb to send the event.
4378567ffc35SJohannes Berg  *
4379567ffc35SJohannes Berg  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
4380567ffc35SJohannes Berg  */
4381567ffc35SJohannes Berg static inline struct sk_buff *
43826c09e791SAhmad Kholaif cfg80211_vendor_event_alloc(struct wiphy *wiphy, struct wireless_dev *wdev,
43836c09e791SAhmad Kholaif 			     int approxlen, int event_idx, gfp_t gfp)
4384567ffc35SJohannes Berg {
43856c09e791SAhmad Kholaif 	return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR,
4386567ffc35SJohannes Berg 					  NL80211_ATTR_VENDOR_DATA,
4387567ffc35SJohannes Berg 					  event_idx, approxlen, gfp);
4388567ffc35SJohannes Berg }
4389567ffc35SJohannes Berg 
4390567ffc35SJohannes Berg /**
4391567ffc35SJohannes Berg  * cfg80211_vendor_event - send the event
4392567ffc35SJohannes Berg  * @skb: The skb, must have been allocated with cfg80211_vendor_event_alloc()
4393567ffc35SJohannes Berg  * @gfp: allocation flags
4394567ffc35SJohannes Berg  *
4395567ffc35SJohannes Berg  * This function sends the given @skb, which must have been allocated
4396567ffc35SJohannes Berg  * by cfg80211_vendor_event_alloc(), as an event. It always consumes it.
4397567ffc35SJohannes Berg  */
4398567ffc35SJohannes Berg static inline void cfg80211_vendor_event(struct sk_buff *skb, gfp_t gfp)
4399567ffc35SJohannes Berg {
4400567ffc35SJohannes Berg 	__cfg80211_send_event_skb(skb, gfp);
4401567ffc35SJohannes Berg }
4402567ffc35SJohannes Berg 
4403aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE
4404aff89a9bSJohannes Berg /**
4405d70e9693SJohannes Berg  * DOC: Test mode
4406d70e9693SJohannes Berg  *
4407d70e9693SJohannes Berg  * Test mode is a set of utility functions to allow drivers to
4408d70e9693SJohannes Berg  * interact with driver-specific tools to aid, for instance,
4409d70e9693SJohannes Berg  * factory programming.
4410d70e9693SJohannes Berg  *
4411d70e9693SJohannes Berg  * This chapter describes how drivers interact with it, for more
4412d70e9693SJohannes Berg  * information see the nl80211 book's chapter on it.
4413d70e9693SJohannes Berg  */
4414d70e9693SJohannes Berg 
4415d70e9693SJohannes Berg /**
4416aff89a9bSJohannes Berg  * cfg80211_testmode_alloc_reply_skb - allocate testmode reply
4417aff89a9bSJohannes Berg  * @wiphy: the wiphy
4418aff89a9bSJohannes Berg  * @approxlen: an upper bound of the length of the data that will
4419aff89a9bSJohannes Berg  *	be put into the skb
4420aff89a9bSJohannes Berg  *
4421aff89a9bSJohannes Berg  * This function allocates and pre-fills an skb for a reply to
4422aff89a9bSJohannes Berg  * the testmode command. Since it is intended for a reply, calling
4423aff89a9bSJohannes Berg  * it outside of the @testmode_cmd operation is invalid.
4424aff89a9bSJohannes Berg  *
44250ae997dcSYacine Belkadi  * The returned skb is pre-filled with the wiphy index and set up in
44260ae997dcSYacine Belkadi  * a way that any data that is put into the skb (with skb_put(),
44270ae997dcSYacine Belkadi  * nla_put() or similar) will end up being within the
44280ae997dcSYacine Belkadi  * %NL80211_ATTR_TESTDATA attribute, so all that needs to be done
44290ae997dcSYacine Belkadi  * with the skb is adding data for the corresponding userspace tool
44300ae997dcSYacine Belkadi  * which can then read that data out of the testdata attribute. You
44310ae997dcSYacine Belkadi  * must not modify the skb in any other way.
4432aff89a9bSJohannes Berg  *
4433aff89a9bSJohannes Berg  * When done, call cfg80211_testmode_reply() with the skb and return
4434aff89a9bSJohannes Berg  * its error code as the result of the @testmode_cmd operation.
44350ae997dcSYacine Belkadi  *
44360ae997dcSYacine Belkadi  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
4437aff89a9bSJohannes Berg  */
4438ad7e718cSJohannes Berg static inline struct sk_buff *
4439ad7e718cSJohannes Berg cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy, int approxlen)
4440ad7e718cSJohannes Berg {
4441ad7e718cSJohannes Berg 	return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_TESTMODE,
4442ad7e718cSJohannes Berg 					  NL80211_ATTR_TESTDATA, approxlen);
4443ad7e718cSJohannes Berg }
4444aff89a9bSJohannes Berg 
4445aff89a9bSJohannes Berg /**
4446aff89a9bSJohannes Berg  * cfg80211_testmode_reply - send the reply skb
4447aff89a9bSJohannes Berg  * @skb: The skb, must have been allocated with
4448aff89a9bSJohannes Berg  *	cfg80211_testmode_alloc_reply_skb()
4449aff89a9bSJohannes Berg  *
44500ae997dcSYacine Belkadi  * Since calling this function will usually be the last thing
44510ae997dcSYacine Belkadi  * before returning from the @testmode_cmd you should return
44520ae997dcSYacine Belkadi  * the error code.  Note that this function consumes the skb
44530ae997dcSYacine Belkadi  * regardless of the return value.
44540ae997dcSYacine Belkadi  *
44550ae997dcSYacine Belkadi  * Return: An error code or 0 on success.
4456aff89a9bSJohannes Berg  */
4457ad7e718cSJohannes Berg static inline int cfg80211_testmode_reply(struct sk_buff *skb)
4458ad7e718cSJohannes Berg {
4459ad7e718cSJohannes Berg 	return cfg80211_vendor_cmd_reply(skb);
4460ad7e718cSJohannes Berg }
4461aff89a9bSJohannes Berg 
4462aff89a9bSJohannes Berg /**
4463aff89a9bSJohannes Berg  * cfg80211_testmode_alloc_event_skb - allocate testmode event
4464aff89a9bSJohannes Berg  * @wiphy: the wiphy
4465aff89a9bSJohannes Berg  * @approxlen: an upper bound of the length of the data that will
4466aff89a9bSJohannes Berg  *	be put into the skb
4467aff89a9bSJohannes Berg  * @gfp: allocation flags
4468aff89a9bSJohannes Berg  *
4469aff89a9bSJohannes Berg  * This function allocates and pre-fills an skb for an event on the
4470aff89a9bSJohannes Berg  * testmode multicast group.
4471aff89a9bSJohannes Berg  *
44720ae997dcSYacine Belkadi  * The returned skb is set up in the same way as with
44730ae997dcSYacine Belkadi  * cfg80211_testmode_alloc_reply_skb() but prepared for an event. As
44740ae997dcSYacine Belkadi  * there, you should simply add data to it that will then end up in the
44750ae997dcSYacine Belkadi  * %NL80211_ATTR_TESTDATA attribute. Again, you must not modify the skb
44760ae997dcSYacine Belkadi  * in any other way.
4477aff89a9bSJohannes Berg  *
4478aff89a9bSJohannes Berg  * When done filling the skb, call cfg80211_testmode_event() with the
4479aff89a9bSJohannes Berg  * skb to send the event.
44800ae997dcSYacine Belkadi  *
44810ae997dcSYacine Belkadi  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
4482aff89a9bSJohannes Berg  */
4483567ffc35SJohannes Berg static inline struct sk_buff *
4484567ffc35SJohannes Berg cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy, int approxlen, gfp_t gfp)
4485567ffc35SJohannes Berg {
44866c09e791SAhmad Kholaif 	return __cfg80211_alloc_event_skb(wiphy, NULL, NL80211_CMD_TESTMODE,
4487567ffc35SJohannes Berg 					  NL80211_ATTR_TESTDATA, -1,
4488567ffc35SJohannes Berg 					  approxlen, gfp);
4489567ffc35SJohannes Berg }
4490aff89a9bSJohannes Berg 
4491aff89a9bSJohannes Berg /**
4492aff89a9bSJohannes Berg  * cfg80211_testmode_event - send the event
4493aff89a9bSJohannes Berg  * @skb: The skb, must have been allocated with
4494aff89a9bSJohannes Berg  *	cfg80211_testmode_alloc_event_skb()
4495aff89a9bSJohannes Berg  * @gfp: allocation flags
4496aff89a9bSJohannes Berg  *
4497aff89a9bSJohannes Berg  * This function sends the given @skb, which must have been allocated
4498aff89a9bSJohannes Berg  * by cfg80211_testmode_alloc_event_skb(), as an event. It always
4499aff89a9bSJohannes Berg  * consumes it.
4500aff89a9bSJohannes Berg  */
4501567ffc35SJohannes Berg static inline void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp)
4502567ffc35SJohannes Berg {
4503567ffc35SJohannes Berg 	__cfg80211_send_event_skb(skb, gfp);
4504567ffc35SJohannes Berg }
4505aff89a9bSJohannes Berg 
4506aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd)	.testmode_cmd = (cmd),
450771063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd)	.testmode_dump = (cmd),
4508aff89a9bSJohannes Berg #else
4509aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd)
451071063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd)
4511aff89a9bSJohannes Berg #endif
4512aff89a9bSJohannes Berg 
4513b23aa676SSamuel Ortiz /**
4514b23aa676SSamuel Ortiz  * cfg80211_connect_result - notify cfg80211 of connection result
4515b23aa676SSamuel Ortiz  *
4516b23aa676SSamuel Ortiz  * @dev: network device
4517b23aa676SSamuel Ortiz  * @bssid: the BSSID of the AP
4518b23aa676SSamuel Ortiz  * @req_ie: association request IEs (maybe be %NULL)
4519b23aa676SSamuel Ortiz  * @req_ie_len: association request IEs length
4520b23aa676SSamuel Ortiz  * @resp_ie: association response IEs (may be %NULL)
4521b23aa676SSamuel Ortiz  * @resp_ie_len: assoc response IEs length
4522b23aa676SSamuel Ortiz  * @status: status code, 0 for successful connection, use
4523b23aa676SSamuel Ortiz  *	%WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
4524b23aa676SSamuel Ortiz  *	the real status code for failures.
4525b23aa676SSamuel Ortiz  * @gfp: allocation flags
4526b23aa676SSamuel Ortiz  *
4527b23aa676SSamuel Ortiz  * It should be called by the underlying driver whenever connect() has
4528b23aa676SSamuel Ortiz  * succeeded.
4529b23aa676SSamuel Ortiz  */
4530b23aa676SSamuel Ortiz void cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
4531b23aa676SSamuel Ortiz 			     const u8 *req_ie, size_t req_ie_len,
4532b23aa676SSamuel Ortiz 			     const u8 *resp_ie, size_t resp_ie_len,
4533b23aa676SSamuel Ortiz 			     u16 status, gfp_t gfp);
4534b23aa676SSamuel Ortiz 
4535b23aa676SSamuel Ortiz /**
4536b23aa676SSamuel Ortiz  * cfg80211_roamed - notify cfg80211 of roaming
4537b23aa676SSamuel Ortiz  *
4538b23aa676SSamuel Ortiz  * @dev: network device
4539ed9d0102SJouni Malinen  * @channel: the channel of the new AP
4540b23aa676SSamuel Ortiz  * @bssid: the BSSID of the new AP
4541b23aa676SSamuel Ortiz  * @req_ie: association request IEs (maybe be %NULL)
4542b23aa676SSamuel Ortiz  * @req_ie_len: association request IEs length
4543b23aa676SSamuel Ortiz  * @resp_ie: association response IEs (may be %NULL)
4544b23aa676SSamuel Ortiz  * @resp_ie_len: assoc response IEs length
4545b23aa676SSamuel Ortiz  * @gfp: allocation flags
4546b23aa676SSamuel Ortiz  *
4547b23aa676SSamuel Ortiz  * It should be called by the underlying driver whenever it roamed
4548b23aa676SSamuel Ortiz  * from one AP to another while connected.
4549b23aa676SSamuel Ortiz  */
4550ed9d0102SJouni Malinen void cfg80211_roamed(struct net_device *dev,
4551ed9d0102SJouni Malinen 		     struct ieee80211_channel *channel,
4552ed9d0102SJouni Malinen 		     const u8 *bssid,
4553b23aa676SSamuel Ortiz 		     const u8 *req_ie, size_t req_ie_len,
4554b23aa676SSamuel Ortiz 		     const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp);
4555b23aa676SSamuel Ortiz 
4556b23aa676SSamuel Ortiz /**
4557adbde344SVasanthakumar Thiagarajan  * cfg80211_roamed_bss - notify cfg80211 of roaming
4558adbde344SVasanthakumar Thiagarajan  *
4559adbde344SVasanthakumar Thiagarajan  * @dev: network device
4560adbde344SVasanthakumar Thiagarajan  * @bss: entry of bss to which STA got roamed
4561adbde344SVasanthakumar Thiagarajan  * @req_ie: association request IEs (maybe be %NULL)
4562adbde344SVasanthakumar Thiagarajan  * @req_ie_len: association request IEs length
4563adbde344SVasanthakumar Thiagarajan  * @resp_ie: association response IEs (may be %NULL)
4564adbde344SVasanthakumar Thiagarajan  * @resp_ie_len: assoc response IEs length
4565adbde344SVasanthakumar Thiagarajan  * @gfp: allocation flags
4566adbde344SVasanthakumar Thiagarajan  *
4567adbde344SVasanthakumar Thiagarajan  * This is just a wrapper to notify cfg80211 of roaming event with driver
4568adbde344SVasanthakumar Thiagarajan  * passing bss to avoid a race in timeout of the bss entry. It should be
4569adbde344SVasanthakumar Thiagarajan  * called by the underlying driver whenever it roamed from one AP to another
4570adbde344SVasanthakumar Thiagarajan  * while connected. Drivers which have roaming implemented in firmware
4571adbde344SVasanthakumar Thiagarajan  * may use this function to avoid a race in bss entry timeout where the bss
4572adbde344SVasanthakumar Thiagarajan  * entry of the new AP is seen in the driver, but gets timed out by the time
4573adbde344SVasanthakumar Thiagarajan  * it is accessed in __cfg80211_roamed() due to delay in scheduling
4574adbde344SVasanthakumar Thiagarajan  * rdev->event_work. In case of any failures, the reference is released
4575adbde344SVasanthakumar Thiagarajan  * either in cfg80211_roamed_bss() or in __cfg80211_romed(), Otherwise,
4576adbde344SVasanthakumar Thiagarajan  * it will be released while diconneting from the current bss.
4577adbde344SVasanthakumar Thiagarajan  */
4578adbde344SVasanthakumar Thiagarajan void cfg80211_roamed_bss(struct net_device *dev, struct cfg80211_bss *bss,
4579adbde344SVasanthakumar Thiagarajan 			 const u8 *req_ie, size_t req_ie_len,
4580adbde344SVasanthakumar Thiagarajan 			 const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp);
4581adbde344SVasanthakumar Thiagarajan 
4582adbde344SVasanthakumar Thiagarajan /**
4583b23aa676SSamuel Ortiz  * cfg80211_disconnected - notify cfg80211 that connection was dropped
4584b23aa676SSamuel Ortiz  *
4585b23aa676SSamuel Ortiz  * @dev: network device
4586b23aa676SSamuel Ortiz  * @ie: information elements of the deauth/disassoc frame (may be %NULL)
4587b23aa676SSamuel Ortiz  * @ie_len: length of IEs
4588b23aa676SSamuel Ortiz  * @reason: reason code for the disconnection, set it to 0 if unknown
458980279fb7SJohannes Berg  * @locally_generated: disconnection was requested locally
4590b23aa676SSamuel Ortiz  * @gfp: allocation flags
4591b23aa676SSamuel Ortiz  *
4592b23aa676SSamuel Ortiz  * After it calls this function, the driver should enter an idle state
4593b23aa676SSamuel Ortiz  * and not try to connect to any AP any more.
4594b23aa676SSamuel Ortiz  */
4595b23aa676SSamuel Ortiz void cfg80211_disconnected(struct net_device *dev, u16 reason,
459680279fb7SJohannes Berg 			   const u8 *ie, size_t ie_len,
459780279fb7SJohannes Berg 			   bool locally_generated, gfp_t gfp);
4598b23aa676SSamuel Ortiz 
45999588bbd5SJouni Malinen /**
46009588bbd5SJouni Malinen  * cfg80211_ready_on_channel - notification of remain_on_channel start
460171bbc994SJohannes Berg  * @wdev: wireless device
46029588bbd5SJouni Malinen  * @cookie: the request cookie
46039588bbd5SJouni Malinen  * @chan: The current channel (from remain_on_channel request)
46049588bbd5SJouni Malinen  * @duration: Duration in milliseconds that the driver intents to remain on the
46059588bbd5SJouni Malinen  *	channel
46069588bbd5SJouni Malinen  * @gfp: allocation flags
46079588bbd5SJouni Malinen  */
460871bbc994SJohannes Berg void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie,
46099588bbd5SJouni Malinen 			       struct ieee80211_channel *chan,
46109588bbd5SJouni Malinen 			       unsigned int duration, gfp_t gfp);
46119588bbd5SJouni Malinen 
46129588bbd5SJouni Malinen /**
46139588bbd5SJouni Malinen  * cfg80211_remain_on_channel_expired - remain_on_channel duration expired
461471bbc994SJohannes Berg  * @wdev: wireless device
46159588bbd5SJouni Malinen  * @cookie: the request cookie
46169588bbd5SJouni Malinen  * @chan: The current channel (from remain_on_channel request)
46179588bbd5SJouni Malinen  * @gfp: allocation flags
46189588bbd5SJouni Malinen  */
461971bbc994SJohannes Berg void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie,
46209588bbd5SJouni Malinen 					struct ieee80211_channel *chan,
46219588bbd5SJouni Malinen 					gfp_t gfp);
4622b23aa676SSamuel Ortiz 
462398b62183SJohannes Berg 
462498b62183SJohannes Berg /**
462598b62183SJohannes Berg  * cfg80211_new_sta - notify userspace about station
462698b62183SJohannes Berg  *
462798b62183SJohannes Berg  * @dev: the netdev
462898b62183SJohannes Berg  * @mac_addr: the station's address
462998b62183SJohannes Berg  * @sinfo: the station information
463098b62183SJohannes Berg  * @gfp: allocation flags
463198b62183SJohannes Berg  */
463298b62183SJohannes Berg void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr,
463398b62183SJohannes Berg 		      struct station_info *sinfo, gfp_t gfp);
463498b62183SJohannes Berg 
4635026331c4SJouni Malinen /**
4636cf5ead82SJohannes Berg  * cfg80211_del_sta_sinfo - notify userspace about deletion of a station
4637cf5ead82SJohannes Berg  * @dev: the netdev
4638cf5ead82SJohannes Berg  * @mac_addr: the station's address
4639cf5ead82SJohannes Berg  * @sinfo: the station information/statistics
4640cf5ead82SJohannes Berg  * @gfp: allocation flags
4641cf5ead82SJohannes Berg  */
4642cf5ead82SJohannes Berg void cfg80211_del_sta_sinfo(struct net_device *dev, const u8 *mac_addr,
4643cf5ead82SJohannes Berg 			    struct station_info *sinfo, gfp_t gfp);
4644cf5ead82SJohannes Berg 
4645cf5ead82SJohannes Berg /**
4646ec15e68bSJouni Malinen  * cfg80211_del_sta - notify userspace about deletion of a station
4647ec15e68bSJouni Malinen  *
4648ec15e68bSJouni Malinen  * @dev: the netdev
4649ec15e68bSJouni Malinen  * @mac_addr: the station's address
4650ec15e68bSJouni Malinen  * @gfp: allocation flags
4651ec15e68bSJouni Malinen  */
4652cf5ead82SJohannes Berg static inline void cfg80211_del_sta(struct net_device *dev,
4653cf5ead82SJohannes Berg 				    const u8 *mac_addr, gfp_t gfp)
4654cf5ead82SJohannes Berg {
4655cf5ead82SJohannes Berg 	cfg80211_del_sta_sinfo(dev, mac_addr, NULL, gfp);
4656cf5ead82SJohannes Berg }
4657ec15e68bSJouni Malinen 
4658ec15e68bSJouni Malinen /**
4659ed44a951SPandiyarajan Pitchaimuthu  * cfg80211_conn_failed - connection request failed notification
4660ed44a951SPandiyarajan Pitchaimuthu  *
4661ed44a951SPandiyarajan Pitchaimuthu  * @dev: the netdev
4662ed44a951SPandiyarajan Pitchaimuthu  * @mac_addr: the station's address
4663ed44a951SPandiyarajan Pitchaimuthu  * @reason: the reason for connection failure
4664ed44a951SPandiyarajan Pitchaimuthu  * @gfp: allocation flags
4665ed44a951SPandiyarajan Pitchaimuthu  *
4666ed44a951SPandiyarajan Pitchaimuthu  * Whenever a station tries to connect to an AP and if the station
4667ed44a951SPandiyarajan Pitchaimuthu  * could not connect to the AP as the AP has rejected the connection
4668ed44a951SPandiyarajan Pitchaimuthu  * for some reasons, this function is called.
4669ed44a951SPandiyarajan Pitchaimuthu  *
4670ed44a951SPandiyarajan Pitchaimuthu  * The reason for connection failure can be any of the value from
4671ed44a951SPandiyarajan Pitchaimuthu  * nl80211_connect_failed_reason enum
4672ed44a951SPandiyarajan Pitchaimuthu  */
4673ed44a951SPandiyarajan Pitchaimuthu void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr,
4674ed44a951SPandiyarajan Pitchaimuthu 			  enum nl80211_connect_failed_reason reason,
4675ed44a951SPandiyarajan Pitchaimuthu 			  gfp_t gfp);
4676ed44a951SPandiyarajan Pitchaimuthu 
4677ed44a951SPandiyarajan Pitchaimuthu /**
46782e161f78SJohannes Berg  * cfg80211_rx_mgmt - notification of received, unprocessed management frame
467971bbc994SJohannes Berg  * @wdev: wireless device receiving the frame
4680026331c4SJouni Malinen  * @freq: Frequency on which the frame was received in MHz
4681804483e9SJohannes Berg  * @sig_dbm: signal strength in mBm, or 0 if unknown
46822e161f78SJohannes Berg  * @buf: Management frame (header + body)
4683026331c4SJouni Malinen  * @len: length of the frame data
468419504cf5SVladimir Kondratiev  * @flags: flags, as defined in enum nl80211_rxmgmt_flags
46852e161f78SJohannes Berg  *
46860ae997dcSYacine Belkadi  * This function is called whenever an Action frame is received for a station
46870ae997dcSYacine Belkadi  * mode interface, but is not processed in kernel.
46880ae997dcSYacine Belkadi  *
46890ae997dcSYacine Belkadi  * Return: %true if a user space application has registered for this frame.
46902e161f78SJohannes Berg  * For action frames, that makes it responsible for rejecting unrecognized
46912e161f78SJohannes Berg  * action frames; %false otherwise, in which case for action frames the
46922e161f78SJohannes Berg  * driver is responsible for rejecting the frame.
4693026331c4SJouni Malinen  */
469471bbc994SJohannes Berg bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int sig_dbm,
4695970fdfa8SVladimir Kondratiev 		      const u8 *buf, size_t len, u32 flags);
4696026331c4SJouni Malinen 
4697026331c4SJouni Malinen /**
46982e161f78SJohannes Berg  * cfg80211_mgmt_tx_status - notification of TX status for management frame
469971bbc994SJohannes Berg  * @wdev: wireless device receiving the frame
47002e161f78SJohannes Berg  * @cookie: Cookie returned by cfg80211_ops::mgmt_tx()
47012e161f78SJohannes Berg  * @buf: Management frame (header + body)
4702026331c4SJouni Malinen  * @len: length of the frame data
4703026331c4SJouni Malinen  * @ack: Whether frame was acknowledged
4704026331c4SJouni Malinen  * @gfp: context flags
4705026331c4SJouni Malinen  *
47062e161f78SJohannes Berg  * This function is called whenever a management frame was requested to be
47072e161f78SJohannes Berg  * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the
4708026331c4SJouni Malinen  * transmission attempt.
4709026331c4SJouni Malinen  */
471071bbc994SJohannes Berg void cfg80211_mgmt_tx_status(struct wireless_dev *wdev, u64 cookie,
4711026331c4SJouni Malinen 			     const u8 *buf, size_t len, bool ack, gfp_t gfp);
4712026331c4SJouni Malinen 
4713d6dc1a38SJuuso Oikarinen 
4714d6dc1a38SJuuso Oikarinen /**
4715d6dc1a38SJuuso Oikarinen  * cfg80211_cqm_rssi_notify - connection quality monitoring rssi event
4716d6dc1a38SJuuso Oikarinen  * @dev: network device
4717d6dc1a38SJuuso Oikarinen  * @rssi_event: the triggered RSSI event
4718d6dc1a38SJuuso Oikarinen  * @gfp: context flags
4719d6dc1a38SJuuso Oikarinen  *
4720d6dc1a38SJuuso Oikarinen  * This function is called when a configured connection quality monitoring
4721d6dc1a38SJuuso Oikarinen  * rssi threshold reached event occurs.
4722d6dc1a38SJuuso Oikarinen  */
4723d6dc1a38SJuuso Oikarinen void cfg80211_cqm_rssi_notify(struct net_device *dev,
4724d6dc1a38SJuuso Oikarinen 			      enum nl80211_cqm_rssi_threshold_event rssi_event,
4725d6dc1a38SJuuso Oikarinen 			      gfp_t gfp);
4726d6dc1a38SJuuso Oikarinen 
4727c063dbf5SJohannes Berg /**
4728c063dbf5SJohannes Berg  * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer
4729c063dbf5SJohannes Berg  * @dev: network device
4730c063dbf5SJohannes Berg  * @peer: peer's MAC address
4731c063dbf5SJohannes Berg  * @num_packets: how many packets were lost -- should be a fixed threshold
4732c063dbf5SJohannes Berg  *	but probably no less than maybe 50, or maybe a throughput dependent
4733c063dbf5SJohannes Berg  *	threshold (to account for temporary interference)
4734c063dbf5SJohannes Berg  * @gfp: context flags
4735c063dbf5SJohannes Berg  */
4736c063dbf5SJohannes Berg void cfg80211_cqm_pktloss_notify(struct net_device *dev,
4737c063dbf5SJohannes Berg 				 const u8 *peer, u32 num_packets, gfp_t gfp);
4738c063dbf5SJohannes Berg 
4739e5497d76SJohannes Berg /**
474084f10708SThomas Pedersen  * cfg80211_cqm_txe_notify - TX error rate event
474184f10708SThomas Pedersen  * @dev: network device
474284f10708SThomas Pedersen  * @peer: peer's MAC address
474384f10708SThomas Pedersen  * @num_packets: how many packets were lost
474484f10708SThomas Pedersen  * @rate: % of packets which failed transmission
474584f10708SThomas Pedersen  * @intvl: interval (in s) over which the TX failure threshold was breached.
474684f10708SThomas Pedersen  * @gfp: context flags
474784f10708SThomas Pedersen  *
474884f10708SThomas Pedersen  * Notify userspace when configured % TX failures over number of packets in a
474984f10708SThomas Pedersen  * given interval is exceeded.
475084f10708SThomas Pedersen  */
475184f10708SThomas Pedersen void cfg80211_cqm_txe_notify(struct net_device *dev, const u8 *peer,
475284f10708SThomas Pedersen 			     u32 num_packets, u32 rate, u32 intvl, gfp_t gfp);
475384f10708SThomas Pedersen 
475484f10708SThomas Pedersen /**
475598f03342SJohannes Berg  * cfg80211_cqm_beacon_loss_notify - beacon loss event
475698f03342SJohannes Berg  * @dev: network device
475798f03342SJohannes Berg  * @gfp: context flags
475898f03342SJohannes Berg  *
475998f03342SJohannes Berg  * Notify userspace about beacon loss from the connected AP.
476098f03342SJohannes Berg  */
476198f03342SJohannes Berg void cfg80211_cqm_beacon_loss_notify(struct net_device *dev, gfp_t gfp);
476298f03342SJohannes Berg 
476398f03342SJohannes Berg /**
47645b97f49dSJohannes Berg  * cfg80211_radar_event - radar detection event
47655b97f49dSJohannes Berg  * @wiphy: the wiphy
47665b97f49dSJohannes Berg  * @chandef: chandef for the current channel
47675b97f49dSJohannes Berg  * @gfp: context flags
47685b97f49dSJohannes Berg  *
47695b97f49dSJohannes Berg  * This function is called when a radar is detected on the current chanenl.
47705b97f49dSJohannes Berg  */
47715b97f49dSJohannes Berg void cfg80211_radar_event(struct wiphy *wiphy,
47725b97f49dSJohannes Berg 			  struct cfg80211_chan_def *chandef, gfp_t gfp);
47735b97f49dSJohannes Berg 
47745b97f49dSJohannes Berg /**
47755b97f49dSJohannes Berg  * cfg80211_cac_event - Channel availability check (CAC) event
47765b97f49dSJohannes Berg  * @netdev: network device
47775b97f49dSJohannes Berg  * @chandef: chandef for the current channel
47785b97f49dSJohannes Berg  * @event: type of event
47795b97f49dSJohannes Berg  * @gfp: context flags
47805b97f49dSJohannes Berg  *
47815b97f49dSJohannes Berg  * This function is called when a Channel availability check (CAC) is finished
47825b97f49dSJohannes Berg  * or aborted. This must be called to notify the completion of a CAC process,
47835b97f49dSJohannes Berg  * also by full-MAC drivers.
47845b97f49dSJohannes Berg  */
47855b97f49dSJohannes Berg void cfg80211_cac_event(struct net_device *netdev,
47865b97f49dSJohannes Berg 			const struct cfg80211_chan_def *chandef,
47875b97f49dSJohannes Berg 			enum nl80211_radar_event event, gfp_t gfp);
47885b97f49dSJohannes Berg 
47895b97f49dSJohannes Berg 
47905b97f49dSJohannes Berg /**
4791e5497d76SJohannes Berg  * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying
4792e5497d76SJohannes Berg  * @dev: network device
4793e5497d76SJohannes Berg  * @bssid: BSSID of AP (to avoid races)
4794e5497d76SJohannes Berg  * @replay_ctr: new replay counter
4795af71ff85SJohannes Berg  * @gfp: allocation flags
4796e5497d76SJohannes Berg  */
4797e5497d76SJohannes Berg void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid,
4798e5497d76SJohannes Berg 			       const u8 *replay_ctr, gfp_t gfp);
4799e5497d76SJohannes Berg 
4800c9df56b4SJouni Malinen /**
4801c9df56b4SJouni Malinen  * cfg80211_pmksa_candidate_notify - notify about PMKSA caching candidate
4802c9df56b4SJouni Malinen  * @dev: network device
4803c9df56b4SJouni Malinen  * @index: candidate index (the smaller the index, the higher the priority)
4804c9df56b4SJouni Malinen  * @bssid: BSSID of AP
4805c9df56b4SJouni Malinen  * @preauth: Whether AP advertises support for RSN pre-authentication
4806c9df56b4SJouni Malinen  * @gfp: allocation flags
4807c9df56b4SJouni Malinen  */
4808c9df56b4SJouni Malinen void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index,
4809c9df56b4SJouni Malinen 				     const u8 *bssid, bool preauth, gfp_t gfp);
4810c9df56b4SJouni Malinen 
481128946da7SJohannes Berg /**
481228946da7SJohannes Berg  * cfg80211_rx_spurious_frame - inform userspace about a spurious frame
481328946da7SJohannes Berg  * @dev: The device the frame matched to
481428946da7SJohannes Berg  * @addr: the transmitter address
481528946da7SJohannes Berg  * @gfp: context flags
481628946da7SJohannes Berg  *
481728946da7SJohannes Berg  * This function is used in AP mode (only!) to inform userspace that
481828946da7SJohannes Berg  * a spurious class 3 frame was received, to be able to deauth the
481928946da7SJohannes Berg  * sender.
48200ae997dcSYacine Belkadi  * Return: %true if the frame was passed to userspace (or this failed
482128946da7SJohannes Berg  * for a reason other than not having a subscription.)
482228946da7SJohannes Berg  */
482328946da7SJohannes Berg bool cfg80211_rx_spurious_frame(struct net_device *dev,
482428946da7SJohannes Berg 				const u8 *addr, gfp_t gfp);
482528946da7SJohannes Berg 
48267f6cf311SJohannes Berg /**
4827b92ab5d8SJohannes Berg  * cfg80211_rx_unexpected_4addr_frame - inform about unexpected WDS frame
4828b92ab5d8SJohannes Berg  * @dev: The device the frame matched to
4829b92ab5d8SJohannes Berg  * @addr: the transmitter address
4830b92ab5d8SJohannes Berg  * @gfp: context flags
4831b92ab5d8SJohannes Berg  *
4832b92ab5d8SJohannes Berg  * This function is used in AP mode (only!) to inform userspace that
4833b92ab5d8SJohannes Berg  * an associated station sent a 4addr frame but that wasn't expected.
4834b92ab5d8SJohannes Berg  * It is allowed and desirable to send this event only once for each
4835b92ab5d8SJohannes Berg  * station to avoid event flooding.
48360ae997dcSYacine Belkadi  * Return: %true if the frame was passed to userspace (or this failed
4837b92ab5d8SJohannes Berg  * for a reason other than not having a subscription.)
4838b92ab5d8SJohannes Berg  */
4839b92ab5d8SJohannes Berg bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev,
4840b92ab5d8SJohannes Berg 					const u8 *addr, gfp_t gfp);
4841b92ab5d8SJohannes Berg 
4842b92ab5d8SJohannes Berg /**
48437f6cf311SJohannes Berg  * cfg80211_probe_status - notify userspace about probe status
48447f6cf311SJohannes Berg  * @dev: the device the probe was sent on
48457f6cf311SJohannes Berg  * @addr: the address of the peer
48467f6cf311SJohannes Berg  * @cookie: the cookie filled in @probe_client previously
48477f6cf311SJohannes Berg  * @acked: indicates whether probe was acked or not
48487f6cf311SJohannes Berg  * @gfp: allocation flags
48497f6cf311SJohannes Berg  */
48507f6cf311SJohannes Berg void cfg80211_probe_status(struct net_device *dev, const u8 *addr,
48517f6cf311SJohannes Berg 			   u64 cookie, bool acked, gfp_t gfp);
48527f6cf311SJohannes Berg 
48535e760230SJohannes Berg /**
48545e760230SJohannes Berg  * cfg80211_report_obss_beacon - report beacon from other APs
48555e760230SJohannes Berg  * @wiphy: The wiphy that received the beacon
48565e760230SJohannes Berg  * @frame: the frame
48575e760230SJohannes Berg  * @len: length of the frame
48585e760230SJohannes Berg  * @freq: frequency the frame was received on
4859804483e9SJohannes Berg  * @sig_dbm: signal strength in mBm, or 0 if unknown
48605e760230SJohannes Berg  *
48615e760230SJohannes Berg  * Use this function to report to userspace when a beacon was
48625e760230SJohannes Berg  * received. It is not useful to call this when there is no
48635e760230SJohannes Berg  * netdev that is in AP/GO mode.
48645e760230SJohannes Berg  */
48655e760230SJohannes Berg void cfg80211_report_obss_beacon(struct wiphy *wiphy,
48665e760230SJohannes Berg 				 const u8 *frame, size_t len,
486737c73b5fSBen Greear 				 int freq, int sig_dbm);
48685e760230SJohannes Berg 
4869d58e7e37SJohannes Berg /**
4870683b6d3bSJohannes Berg  * cfg80211_reg_can_beacon - check if beaconing is allowed
487154858ee5SAlexander Simon  * @wiphy: the wiphy
4872683b6d3bSJohannes Berg  * @chandef: the channel definition
4873174e0cd2SIlan Peer  * @iftype: interface type
4874d58e7e37SJohannes Berg  *
48750ae997dcSYacine Belkadi  * Return: %true if there is no secondary channel or the secondary channel(s)
48760ae997dcSYacine Belkadi  * can be used for beaconing (i.e. is not a radar channel etc.)
487754858ee5SAlexander Simon  */
4878683b6d3bSJohannes Berg bool cfg80211_reg_can_beacon(struct wiphy *wiphy,
4879174e0cd2SIlan Peer 			     struct cfg80211_chan_def *chandef,
4880174e0cd2SIlan Peer 			     enum nl80211_iftype iftype);
488154858ee5SAlexander Simon 
4882923b352fSArik Nemtsov /**
4883923b352fSArik Nemtsov  * cfg80211_reg_can_beacon_relax - check if beaconing is allowed with relaxation
4884923b352fSArik Nemtsov  * @wiphy: the wiphy
4885923b352fSArik Nemtsov  * @chandef: the channel definition
4886923b352fSArik Nemtsov  * @iftype: interface type
4887923b352fSArik Nemtsov  *
4888923b352fSArik Nemtsov  * Return: %true if there is no secondary channel or the secondary channel(s)
4889923b352fSArik Nemtsov  * can be used for beaconing (i.e. is not a radar channel etc.). This version
4890923b352fSArik Nemtsov  * also checks if IR-relaxation conditions apply, to allow beaconing under
4891923b352fSArik Nemtsov  * more permissive conditions.
4892923b352fSArik Nemtsov  *
4893923b352fSArik Nemtsov  * Requires the RTNL to be held.
4894923b352fSArik Nemtsov  */
4895923b352fSArik Nemtsov bool cfg80211_reg_can_beacon_relax(struct wiphy *wiphy,
4896923b352fSArik Nemtsov 				   struct cfg80211_chan_def *chandef,
4897923b352fSArik Nemtsov 				   enum nl80211_iftype iftype);
4898923b352fSArik Nemtsov 
48998097e149SThomas Pedersen /*
49005314526bSThomas Pedersen  * cfg80211_ch_switch_notify - update wdev channel and notify userspace
49015314526bSThomas Pedersen  * @dev: the device which switched channels
4902683b6d3bSJohannes Berg  * @chandef: the new channel definition
49035314526bSThomas Pedersen  *
4904e487eaebSSimon Wunderlich  * Caller must acquire wdev_lock, therefore must only be called from sleepable
4905e487eaebSSimon Wunderlich  * driver context!
49065314526bSThomas Pedersen  */
4907683b6d3bSJohannes Berg void cfg80211_ch_switch_notify(struct net_device *dev,
4908683b6d3bSJohannes Berg 			       struct cfg80211_chan_def *chandef);
49095314526bSThomas Pedersen 
4910f8d7552eSLuciano Coelho /*
4911f8d7552eSLuciano Coelho  * cfg80211_ch_switch_started_notify - notify channel switch start
4912f8d7552eSLuciano Coelho  * @dev: the device on which the channel switch started
4913f8d7552eSLuciano Coelho  * @chandef: the future channel definition
4914f8d7552eSLuciano Coelho  * @count: the number of TBTTs until the channel switch happens
4915f8d7552eSLuciano Coelho  *
4916f8d7552eSLuciano Coelho  * Inform the userspace about the channel switch that has just
4917f8d7552eSLuciano Coelho  * started, so that it can take appropriate actions (eg. starting
4918f8d7552eSLuciano Coelho  * channel switch on other vifs), if necessary.
4919f8d7552eSLuciano Coelho  */
4920f8d7552eSLuciano Coelho void cfg80211_ch_switch_started_notify(struct net_device *dev,
4921f8d7552eSLuciano Coelho 				       struct cfg80211_chan_def *chandef,
4922f8d7552eSLuciano Coelho 				       u8 count);
4923f8d7552eSLuciano Coelho 
49241ce3e82bSJohannes Berg /**
49251ce3e82bSJohannes Berg  * ieee80211_operating_class_to_band - convert operating class to band
49261ce3e82bSJohannes Berg  *
49271ce3e82bSJohannes Berg  * @operating_class: the operating class to convert
49281ce3e82bSJohannes Berg  * @band: band pointer to fill
49291ce3e82bSJohannes Berg  *
49301ce3e82bSJohannes Berg  * Returns %true if the conversion was successful, %false otherwise.
49311ce3e82bSJohannes Berg  */
49321ce3e82bSJohannes Berg bool ieee80211_operating_class_to_band(u8 operating_class,
49331ce3e82bSJohannes Berg 				       enum ieee80211_band *band);
49341ce3e82bSJohannes Berg 
4935a38700ddSArik Nemtsov /**
4936a38700ddSArik Nemtsov  * ieee80211_chandef_to_operating_class - convert chandef to operation class
4937a38700ddSArik Nemtsov  *
4938a38700ddSArik Nemtsov  * @chandef: the chandef to convert
4939a38700ddSArik Nemtsov  * @op_class: a pointer to the resulting operating class
4940a38700ddSArik Nemtsov  *
4941a38700ddSArik Nemtsov  * Returns %true if the conversion was successful, %false otherwise.
4942a38700ddSArik Nemtsov  */
4943a38700ddSArik Nemtsov bool ieee80211_chandef_to_operating_class(struct cfg80211_chan_def *chandef,
4944a38700ddSArik Nemtsov 					  u8 *op_class);
4945a38700ddSArik Nemtsov 
49465314526bSThomas Pedersen /*
49473475b094SJouni Malinen  * cfg80211_tdls_oper_request - request userspace to perform TDLS operation
49483475b094SJouni Malinen  * @dev: the device on which the operation is requested
49493475b094SJouni Malinen  * @peer: the MAC address of the peer device
49503475b094SJouni Malinen  * @oper: the requested TDLS operation (NL80211_TDLS_SETUP or
49513475b094SJouni Malinen  *	NL80211_TDLS_TEARDOWN)
49523475b094SJouni Malinen  * @reason_code: the reason code for teardown request
49533475b094SJouni Malinen  * @gfp: allocation flags
49543475b094SJouni Malinen  *
49553475b094SJouni Malinen  * This function is used to request userspace to perform TDLS operation that
49563475b094SJouni Malinen  * requires knowledge of keys, i.e., link setup or teardown when the AP
49573475b094SJouni Malinen  * connection uses encryption. This is optional mechanism for the driver to use
49583475b094SJouni Malinen  * if it can automatically determine when a TDLS link could be useful (e.g.,
49593475b094SJouni Malinen  * based on traffic and signal strength for a peer).
49603475b094SJouni Malinen  */
49613475b094SJouni Malinen void cfg80211_tdls_oper_request(struct net_device *dev, const u8 *peer,
49623475b094SJouni Malinen 				enum nl80211_tdls_operation oper,
49633475b094SJouni Malinen 				u16 reason_code, gfp_t gfp);
49643475b094SJouni Malinen 
49653475b094SJouni Malinen /*
49668097e149SThomas Pedersen  * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units)
49678097e149SThomas Pedersen  * @rate: given rate_info to calculate bitrate from
49688097e149SThomas Pedersen  *
49698097e149SThomas Pedersen  * return 0 if MCS index >= 32
49708097e149SThomas Pedersen  */
49718eb41c8dSVladimir Kondratiev u32 cfg80211_calculate_bitrate(struct rate_info *rate);
49728097e149SThomas Pedersen 
497398104fdeSJohannes Berg /**
497498104fdeSJohannes Berg  * cfg80211_unregister_wdev - remove the given wdev
497598104fdeSJohannes Berg  * @wdev: struct wireless_dev to remove
497698104fdeSJohannes Berg  *
497798104fdeSJohannes Berg  * Call this function only for wdevs that have no netdev assigned,
497898104fdeSJohannes Berg  * e.g. P2P Devices. It removes the device from the list so that
497998104fdeSJohannes Berg  * it can no longer be used. It is necessary to call this function
498098104fdeSJohannes Berg  * even when cfg80211 requests the removal of the interface by
498198104fdeSJohannes Berg  * calling the del_virtual_intf() callback. The function must also
498298104fdeSJohannes Berg  * be called when the driver wishes to unregister the wdev, e.g.
498398104fdeSJohannes Berg  * when the device is unbound from the driver.
498498104fdeSJohannes Berg  *
498598104fdeSJohannes Berg  * Requires the RTNL to be held.
498698104fdeSJohannes Berg  */
498798104fdeSJohannes Berg void cfg80211_unregister_wdev(struct wireless_dev *wdev);
498898104fdeSJohannes Berg 
49890ee45355SJohannes Berg /**
4990355199e0SJouni Malinen  * struct cfg80211_ft_event - FT Information Elements
4991355199e0SJouni Malinen  * @ies: FT IEs
4992355199e0SJouni Malinen  * @ies_len: length of the FT IE in bytes
4993355199e0SJouni Malinen  * @target_ap: target AP's MAC address
4994355199e0SJouni Malinen  * @ric_ies: RIC IE
4995355199e0SJouni Malinen  * @ric_ies_len: length of the RIC IE in bytes
4996355199e0SJouni Malinen  */
4997355199e0SJouni Malinen struct cfg80211_ft_event_params {
4998355199e0SJouni Malinen 	const u8 *ies;
4999355199e0SJouni Malinen 	size_t ies_len;
5000355199e0SJouni Malinen 	const u8 *target_ap;
5001355199e0SJouni Malinen 	const u8 *ric_ies;
5002355199e0SJouni Malinen 	size_t ric_ies_len;
5003355199e0SJouni Malinen };
5004355199e0SJouni Malinen 
5005355199e0SJouni Malinen /**
5006355199e0SJouni Malinen  * cfg80211_ft_event - notify userspace about FT IE and RIC IE
5007355199e0SJouni Malinen  * @netdev: network device
5008355199e0SJouni Malinen  * @ft_event: IE information
5009355199e0SJouni Malinen  */
5010355199e0SJouni Malinen void cfg80211_ft_event(struct net_device *netdev,
5011355199e0SJouni Malinen 		       struct cfg80211_ft_event_params *ft_event);
5012355199e0SJouni Malinen 
5013355199e0SJouni Malinen /**
50140ee45355SJohannes Berg  * cfg80211_get_p2p_attr - find and copy a P2P attribute from IE buffer
50150ee45355SJohannes Berg  * @ies: the input IE buffer
50160ee45355SJohannes Berg  * @len: the input length
50170ee45355SJohannes Berg  * @attr: the attribute ID to find
50180ee45355SJohannes Berg  * @buf: output buffer, can be %NULL if the data isn't needed, e.g.
50190ee45355SJohannes Berg  *	if the function is only called to get the needed buffer size
50200ee45355SJohannes Berg  * @bufsize: size of the output buffer
50210ee45355SJohannes Berg  *
50220ee45355SJohannes Berg  * The function finds a given P2P attribute in the (vendor) IEs and
50230ee45355SJohannes Berg  * copies its contents to the given buffer.
50240ee45355SJohannes Berg  *
50250ae997dcSYacine Belkadi  * Return: A negative error code (-%EILSEQ or -%ENOENT) if the data is
50260ae997dcSYacine Belkadi  * malformed or the attribute can't be found (respectively), or the
50270ae997dcSYacine Belkadi  * length of the found attribute (which can be zero).
50280ee45355SJohannes Berg  */
5029c216e641SArend van Spriel int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len,
5030c216e641SArend van Spriel 			  enum ieee80211_p2p_attr_id attr,
5031c216e641SArend van Spriel 			  u8 *buf, unsigned int bufsize);
50320ee45355SJohannes Berg 
5033cd8f7cb4SJohannes Berg /**
503429464cccSJohannes Berg  * ieee80211_ie_split_ric - split an IE buffer according to ordering (with RIC)
503529464cccSJohannes Berg  * @ies: the IE buffer
503629464cccSJohannes Berg  * @ielen: the length of the IE buffer
503729464cccSJohannes Berg  * @ids: an array with element IDs that are allowed before
503829464cccSJohannes Berg  *	the split
503929464cccSJohannes Berg  * @n_ids: the size of the element ID array
504029464cccSJohannes Berg  * @after_ric: array IE types that come after the RIC element
504129464cccSJohannes Berg  * @n_after_ric: size of the @after_ric array
504229464cccSJohannes Berg  * @offset: offset where to start splitting in the buffer
504329464cccSJohannes Berg  *
504429464cccSJohannes Berg  * This function splits an IE buffer by updating the @offset
504529464cccSJohannes Berg  * variable to point to the location where the buffer should be
504629464cccSJohannes Berg  * split.
504729464cccSJohannes Berg  *
504829464cccSJohannes Berg  * It assumes that the given IE buffer is well-formed, this
504929464cccSJohannes Berg  * has to be guaranteed by the caller!
505029464cccSJohannes Berg  *
505129464cccSJohannes Berg  * It also assumes that the IEs in the buffer are ordered
505229464cccSJohannes Berg  * correctly, if not the result of using this function will not
505329464cccSJohannes Berg  * be ordered correctly either, i.e. it does no reordering.
505429464cccSJohannes Berg  *
505529464cccSJohannes Berg  * The function returns the offset where the next part of the
505629464cccSJohannes Berg  * buffer starts, which may be @ielen if the entire (remainder)
505729464cccSJohannes Berg  * of the buffer should be used.
505829464cccSJohannes Berg  */
505929464cccSJohannes Berg size_t ieee80211_ie_split_ric(const u8 *ies, size_t ielen,
506029464cccSJohannes Berg 			      const u8 *ids, int n_ids,
506129464cccSJohannes Berg 			      const u8 *after_ric, int n_after_ric,
506229464cccSJohannes Berg 			      size_t offset);
506329464cccSJohannes Berg 
506429464cccSJohannes Berg /**
506529464cccSJohannes Berg  * ieee80211_ie_split - split an IE buffer according to ordering
506629464cccSJohannes Berg  * @ies: the IE buffer
506729464cccSJohannes Berg  * @ielen: the length of the IE buffer
506829464cccSJohannes Berg  * @ids: an array with element IDs that are allowed before
506929464cccSJohannes Berg  *	the split
507029464cccSJohannes Berg  * @n_ids: the size of the element ID array
507129464cccSJohannes Berg  * @offset: offset where to start splitting in the buffer
507229464cccSJohannes Berg  *
507329464cccSJohannes Berg  * This function splits an IE buffer by updating the @offset
507429464cccSJohannes Berg  * variable to point to the location where the buffer should be
507529464cccSJohannes Berg  * split.
507629464cccSJohannes Berg  *
507729464cccSJohannes Berg  * It assumes that the given IE buffer is well-formed, this
507829464cccSJohannes Berg  * has to be guaranteed by the caller!
507929464cccSJohannes Berg  *
508029464cccSJohannes Berg  * It also assumes that the IEs in the buffer are ordered
508129464cccSJohannes Berg  * correctly, if not the result of using this function will not
508229464cccSJohannes Berg  * be ordered correctly either, i.e. it does no reordering.
508329464cccSJohannes Berg  *
508429464cccSJohannes Berg  * The function returns the offset where the next part of the
508529464cccSJohannes Berg  * buffer starts, which may be @ielen if the entire (remainder)
508629464cccSJohannes Berg  * of the buffer should be used.
508729464cccSJohannes Berg  */
508829464cccSJohannes Berg size_t ieee80211_ie_split(const u8 *ies, size_t ielen,
508929464cccSJohannes Berg 			  const u8 *ids, int n_ids, size_t offset);
509029464cccSJohannes Berg 
509129464cccSJohannes Berg /**
5092cd8f7cb4SJohannes Berg  * cfg80211_report_wowlan_wakeup - report wakeup from WoWLAN
5093cd8f7cb4SJohannes Berg  * @wdev: the wireless device reporting the wakeup
5094cd8f7cb4SJohannes Berg  * @wakeup: the wakeup report
5095cd8f7cb4SJohannes Berg  * @gfp: allocation flags
5096cd8f7cb4SJohannes Berg  *
5097cd8f7cb4SJohannes Berg  * This function reports that the given device woke up. If it
5098cd8f7cb4SJohannes Berg  * caused the wakeup, report the reason(s), otherwise you may
5099cd8f7cb4SJohannes Berg  * pass %NULL as the @wakeup parameter to advertise that something
5100cd8f7cb4SJohannes Berg  * else caused the wakeup.
5101cd8f7cb4SJohannes Berg  */
5102cd8f7cb4SJohannes Berg void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev,
5103cd8f7cb4SJohannes Berg 				   struct cfg80211_wowlan_wakeup *wakeup,
5104cd8f7cb4SJohannes Berg 				   gfp_t gfp);
5105cd8f7cb4SJohannes Berg 
51065de17984SArend van Spriel /**
51075de17984SArend van Spriel  * cfg80211_crit_proto_stopped() - indicate critical protocol stopped by driver.
51085de17984SArend van Spriel  *
51095de17984SArend van Spriel  * @wdev: the wireless device for which critical protocol is stopped.
511003f831a6SRobert P. J. Day  * @gfp: allocation flags
51115de17984SArend van Spriel  *
51125de17984SArend van Spriel  * This function can be called by the driver to indicate it has reverted
51135de17984SArend van Spriel  * operation back to normal. One reason could be that the duration given
51145de17984SArend van Spriel  * by .crit_proto_start() has expired.
51155de17984SArend van Spriel  */
51165de17984SArend van Spriel void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp);
51175de17984SArend van Spriel 
5118bdfbec2dSIlan Peer /**
5119bdfbec2dSIlan Peer  * ieee80211_get_num_supported_channels - get number of channels device has
5120bdfbec2dSIlan Peer  * @wiphy: the wiphy
5121bdfbec2dSIlan Peer  *
5122bdfbec2dSIlan Peer  * Return: the number of channels supported by the device.
5123bdfbec2dSIlan Peer  */
5124bdfbec2dSIlan Peer unsigned int ieee80211_get_num_supported_channels(struct wiphy *wiphy);
5125bdfbec2dSIlan Peer 
5126cb2d956dSLuciano Coelho /**
5127cb2d956dSLuciano Coelho  * cfg80211_check_combinations - check interface combinations
5128cb2d956dSLuciano Coelho  *
5129cb2d956dSLuciano Coelho  * @wiphy: the wiphy
5130cb2d956dSLuciano Coelho  * @num_different_channels: the number of different channels we want
5131cb2d956dSLuciano Coelho  *	to use for verification
5132cb2d956dSLuciano Coelho  * @radar_detect: a bitmap where each bit corresponds to a channel
5133cb2d956dSLuciano Coelho  *	width where radar detection is needed, as in the definition of
5134cb2d956dSLuciano Coelho  *	&struct ieee80211_iface_combination.@radar_detect_widths
5135cb2d956dSLuciano Coelho  * @iftype_num: array with the numbers of interfaces of each interface
5136cb2d956dSLuciano Coelho  *	type.  The index is the interface type as specified in &enum
5137cb2d956dSLuciano Coelho  *	nl80211_iftype.
5138cb2d956dSLuciano Coelho  *
5139cb2d956dSLuciano Coelho  * This function can be called by the driver to check whether a
5140cb2d956dSLuciano Coelho  * combination of interfaces and their types are allowed according to
5141cb2d956dSLuciano Coelho  * the interface combinations.
5142cb2d956dSLuciano Coelho  */
5143cb2d956dSLuciano Coelho int cfg80211_check_combinations(struct wiphy *wiphy,
5144cb2d956dSLuciano Coelho 				const int num_different_channels,
5145cb2d956dSLuciano Coelho 				const u8 radar_detect,
5146cb2d956dSLuciano Coelho 				const int iftype_num[NUM_NL80211_IFTYPES]);
5147cb2d956dSLuciano Coelho 
514865a124ddSMichal Kazior /**
514965a124ddSMichal Kazior  * cfg80211_iter_combinations - iterate over matching combinations
515065a124ddSMichal Kazior  *
515165a124ddSMichal Kazior  * @wiphy: the wiphy
515265a124ddSMichal Kazior  * @num_different_channels: the number of different channels we want
515365a124ddSMichal Kazior  *	to use for verification
515465a124ddSMichal Kazior  * @radar_detect: a bitmap where each bit corresponds to a channel
515565a124ddSMichal Kazior  *	width where radar detection is needed, as in the definition of
515665a124ddSMichal Kazior  *	&struct ieee80211_iface_combination.@radar_detect_widths
515765a124ddSMichal Kazior  * @iftype_num: array with the numbers of interfaces of each interface
515865a124ddSMichal Kazior  *	type.  The index is the interface type as specified in &enum
515965a124ddSMichal Kazior  *	nl80211_iftype.
516065a124ddSMichal Kazior  * @iter: function to call for each matching combination
516165a124ddSMichal Kazior  * @data: pointer to pass to iter function
516265a124ddSMichal Kazior  *
516365a124ddSMichal Kazior  * This function can be called by the driver to check what possible
516465a124ddSMichal Kazior  * combinations it fits in at a given moment, e.g. for channel switching
516565a124ddSMichal Kazior  * purposes.
516665a124ddSMichal Kazior  */
516765a124ddSMichal Kazior int cfg80211_iter_combinations(struct wiphy *wiphy,
516865a124ddSMichal Kazior 			       const int num_different_channels,
516965a124ddSMichal Kazior 			       const u8 radar_detect,
517065a124ddSMichal Kazior 			       const int iftype_num[NUM_NL80211_IFTYPES],
517165a124ddSMichal Kazior 			       void (*iter)(const struct ieee80211_iface_combination *c,
517265a124ddSMichal Kazior 					    void *data),
517365a124ddSMichal Kazior 			       void *data);
517465a124ddSMichal Kazior 
5175f04c2203SMichal Kazior /*
5176f04c2203SMichal Kazior  * cfg80211_stop_iface - trigger interface disconnection
5177f04c2203SMichal Kazior  *
5178f04c2203SMichal Kazior  * @wiphy: the wiphy
5179f04c2203SMichal Kazior  * @wdev: wireless device
5180f04c2203SMichal Kazior  * @gfp: context flags
5181f04c2203SMichal Kazior  *
5182f04c2203SMichal Kazior  * Trigger interface to be stopped as if AP was stopped, IBSS/mesh left, STA
5183f04c2203SMichal Kazior  * disconnected.
5184f04c2203SMichal Kazior  *
5185f04c2203SMichal Kazior  * Note: This doesn't need any locks and is asynchronous.
5186f04c2203SMichal Kazior  */
5187f04c2203SMichal Kazior void cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev,
5188f04c2203SMichal Kazior 			 gfp_t gfp);
5189f04c2203SMichal Kazior 
5190f6837ba8SJohannes Berg /**
5191f6837ba8SJohannes Berg  * cfg80211_shutdown_all_interfaces - shut down all interfaces for a wiphy
5192f6837ba8SJohannes Berg  * @wiphy: the wiphy to shut down
5193f6837ba8SJohannes Berg  *
5194f6837ba8SJohannes Berg  * This function shuts down all interfaces belonging to this wiphy by
5195f6837ba8SJohannes Berg  * calling dev_close() (and treating non-netdev interfaces as needed).
5196f6837ba8SJohannes Berg  * It shouldn't really be used unless there are some fatal device errors
5197f6837ba8SJohannes Berg  * that really can't be recovered in any other way.
5198f6837ba8SJohannes Berg  *
5199f6837ba8SJohannes Berg  * Callers must hold the RTNL and be able to deal with callbacks into
5200f6837ba8SJohannes Berg  * the driver while the function is running.
5201f6837ba8SJohannes Berg  */
5202f6837ba8SJohannes Berg void cfg80211_shutdown_all_interfaces(struct wiphy *wiphy);
5203f6837ba8SJohannes Berg 
5204d75bb06bSGautam Kumar Shukla /**
5205d75bb06bSGautam Kumar Shukla  * wiphy_ext_feature_set - set the extended feature flag
5206d75bb06bSGautam Kumar Shukla  *
5207d75bb06bSGautam Kumar Shukla  * @wiphy: the wiphy to modify.
5208d75bb06bSGautam Kumar Shukla  * @ftidx: extended feature bit index.
5209d75bb06bSGautam Kumar Shukla  *
5210d75bb06bSGautam Kumar Shukla  * The extended features are flagged in multiple bytes (see
5211d75bb06bSGautam Kumar Shukla  * &struct wiphy.@ext_features)
5212d75bb06bSGautam Kumar Shukla  */
5213d75bb06bSGautam Kumar Shukla static inline void wiphy_ext_feature_set(struct wiphy *wiphy,
5214d75bb06bSGautam Kumar Shukla 					 enum nl80211_ext_feature_index ftidx)
5215d75bb06bSGautam Kumar Shukla {
5216d75bb06bSGautam Kumar Shukla 	u8 *ft_byte;
5217d75bb06bSGautam Kumar Shukla 
5218d75bb06bSGautam Kumar Shukla 	ft_byte = &wiphy->ext_features[ftidx / 8];
5219d75bb06bSGautam Kumar Shukla 	*ft_byte |= BIT(ftidx % 8);
5220d75bb06bSGautam Kumar Shukla }
5221d75bb06bSGautam Kumar Shukla 
5222d75bb06bSGautam Kumar Shukla /**
5223d75bb06bSGautam Kumar Shukla  * wiphy_ext_feature_isset - check the extended feature flag
5224d75bb06bSGautam Kumar Shukla  *
5225d75bb06bSGautam Kumar Shukla  * @wiphy: the wiphy to modify.
5226d75bb06bSGautam Kumar Shukla  * @ftidx: extended feature bit index.
5227d75bb06bSGautam Kumar Shukla  *
5228d75bb06bSGautam Kumar Shukla  * The extended features are flagged in multiple bytes (see
5229d75bb06bSGautam Kumar Shukla  * &struct wiphy.@ext_features)
5230d75bb06bSGautam Kumar Shukla  */
5231d75bb06bSGautam Kumar Shukla static inline bool
5232d75bb06bSGautam Kumar Shukla wiphy_ext_feature_isset(struct wiphy *wiphy,
5233d75bb06bSGautam Kumar Shukla 			enum nl80211_ext_feature_index ftidx)
5234d75bb06bSGautam Kumar Shukla {
5235d75bb06bSGautam Kumar Shukla 	u8 ft_byte;
5236d75bb06bSGautam Kumar Shukla 
5237d75bb06bSGautam Kumar Shukla 	ft_byte = wiphy->ext_features[ftidx / 8];
5238d75bb06bSGautam Kumar Shukla 	return (ft_byte & BIT(ftidx % 8)) != 0;
5239d75bb06bSGautam Kumar Shukla }
5240b7ffbd7eSJohannes Berg 
5241b7ffbd7eSJohannes Berg /* ethtool helper */
5242b7ffbd7eSJohannes Berg void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info);
5243b7ffbd7eSJohannes Berg 
5244e1db74fcSJoe Perches /* Logging, debugging and troubleshooting/diagnostic helpers. */
5245e1db74fcSJoe Perches 
5246e1db74fcSJoe Perches /* wiphy_printk helpers, similar to dev_printk */
5247e1db74fcSJoe Perches 
5248e1db74fcSJoe Perches #define wiphy_printk(level, wiphy, format, args...)		\
52499c376639SJoe Perches 	dev_printk(level, &(wiphy)->dev, format, ##args)
5250e1db74fcSJoe Perches #define wiphy_emerg(wiphy, format, args...)			\
52519c376639SJoe Perches 	dev_emerg(&(wiphy)->dev, format, ##args)
5252e1db74fcSJoe Perches #define wiphy_alert(wiphy, format, args...)			\
52539c376639SJoe Perches 	dev_alert(&(wiphy)->dev, format, ##args)
5254e1db74fcSJoe Perches #define wiphy_crit(wiphy, format, args...)			\
52559c376639SJoe Perches 	dev_crit(&(wiphy)->dev, format, ##args)
5256e1db74fcSJoe Perches #define wiphy_err(wiphy, format, args...)			\
52579c376639SJoe Perches 	dev_err(&(wiphy)->dev, format, ##args)
5258e1db74fcSJoe Perches #define wiphy_warn(wiphy, format, args...)			\
52599c376639SJoe Perches 	dev_warn(&(wiphy)->dev, format, ##args)
5260e1db74fcSJoe Perches #define wiphy_notice(wiphy, format, args...)			\
52619c376639SJoe Perches 	dev_notice(&(wiphy)->dev, format, ##args)
5262e1db74fcSJoe Perches #define wiphy_info(wiphy, format, args...)			\
52639c376639SJoe Perches 	dev_info(&(wiphy)->dev, format, ##args)
5264073730d7SJoe Perches 
52659c376639SJoe Perches #define wiphy_debug(wiphy, format, args...)			\
5266e1db74fcSJoe Perches 	wiphy_printk(KERN_DEBUG, wiphy, format, ##args)
52679c376639SJoe Perches 
5268e1db74fcSJoe Perches #define wiphy_dbg(wiphy, format, args...)			\
52699c376639SJoe Perches 	dev_dbg(&(wiphy)->dev, format, ##args)
5270e1db74fcSJoe Perches 
5271e1db74fcSJoe Perches #if defined(VERBOSE_DEBUG)
5272e1db74fcSJoe Perches #define wiphy_vdbg	wiphy_dbg
5273e1db74fcSJoe Perches #else
5274e1db74fcSJoe Perches #define wiphy_vdbg(wiphy, format, args...)				\
5275e1db74fcSJoe Perches ({									\
5276e1db74fcSJoe Perches 	if (0)								\
5277e1db74fcSJoe Perches 		wiphy_printk(KERN_DEBUG, wiphy, format, ##args);	\
5278e1db74fcSJoe Perches 	0;								\
5279e1db74fcSJoe Perches })
5280e1db74fcSJoe Perches #endif
5281e1db74fcSJoe Perches 
5282e1db74fcSJoe Perches /*
5283e1db74fcSJoe Perches  * wiphy_WARN() acts like wiphy_printk(), but with the key difference
5284e1db74fcSJoe Perches  * of using a WARN/WARN_ON to get the message out, including the
5285e1db74fcSJoe Perches  * file/line information and a backtrace.
5286e1db74fcSJoe Perches  */
5287e1db74fcSJoe Perches #define wiphy_WARN(wiphy, format, args...)			\
5288e1db74fcSJoe Perches 	WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args);
5289e1db74fcSJoe Perches 
5290704232c2SJohannes Berg #endif /* __NET_CFG80211_H */
5291