xref: /linux/include/net/cfg80211.h (revision cb2d956dd329caa11b5ece454dc52253aa038e73)
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>
7d3236553SJohannes Berg  *
8d3236553SJohannes Berg  * This program is free software; you can redistribute it and/or modify
9d3236553SJohannes Berg  * it under the terms of the GNU General Public License version 2 as
10d3236553SJohannes Berg  * published by the Free Software Foundation.
11d3236553SJohannes Berg  */
12704232c2SJohannes Berg 
13d3236553SJohannes Berg #include <linux/netdevice.h>
14d3236553SJohannes Berg #include <linux/debugfs.h>
15d3236553SJohannes Berg #include <linux/list.h>
16187f1882SPaul Gortmaker #include <linux/bug.h>
17704232c2SJohannes Berg #include <linux/netlink.h>
18704232c2SJohannes Berg #include <linux/skbuff.h>
1955682965SJohannes Berg #include <linux/nl80211.h>
202a519311SJohannes Berg #include <linux/if_ether.h>
212a519311SJohannes Berg #include <linux/ieee80211.h>
222a0e047eSJohannes Berg #include <linux/net.h>
23d3236553SJohannes Berg #include <net/regulatory.h>
24d3236553SJohannes Berg 
25d70e9693SJohannes Berg /**
26d70e9693SJohannes Berg  * DOC: Introduction
27d70e9693SJohannes Berg  *
28d70e9693SJohannes Berg  * cfg80211 is the configuration API for 802.11 devices in Linux. It bridges
29d70e9693SJohannes Berg  * userspace and drivers, and offers some utility functionality associated
30d70e9693SJohannes Berg  * with 802.11. cfg80211 must, directly or indirectly via mac80211, be used
31d70e9693SJohannes Berg  * by all modern wireless drivers in Linux, so that they offer a consistent
32d70e9693SJohannes Berg  * API through nl80211. For backward compatibility, cfg80211 also offers
33d70e9693SJohannes Berg  * wireless extensions to userspace, but hides them from drivers completely.
34d70e9693SJohannes Berg  *
35d70e9693SJohannes Berg  * Additionally, cfg80211 contains code to help enforce regulatory spectrum
36d70e9693SJohannes Berg  * use restrictions.
37d70e9693SJohannes Berg  */
38d70e9693SJohannes Berg 
39d70e9693SJohannes Berg 
40d70e9693SJohannes Berg /**
41d70e9693SJohannes Berg  * DOC: Device registration
42d70e9693SJohannes Berg  *
43d70e9693SJohannes Berg  * In order for a driver to use cfg80211, it must register the hardware device
44d70e9693SJohannes Berg  * with cfg80211. This happens through a number of hardware capability structs
45d70e9693SJohannes Berg  * described below.
46d70e9693SJohannes Berg  *
47d70e9693SJohannes Berg  * The fundamental structure for each device is the 'wiphy', of which each
48d70e9693SJohannes Berg  * instance describes a physical wireless device connected to the system. Each
49d70e9693SJohannes Berg  * such wiphy can have zero, one, or many virtual interfaces associated with
50d70e9693SJohannes Berg  * it, which need to be identified as such by pointing the network interface's
51d70e9693SJohannes Berg  * @ieee80211_ptr pointer to a &struct wireless_dev which further describes
52d70e9693SJohannes Berg  * the wireless part of the interface, normally this struct is embedded in the
53d70e9693SJohannes Berg  * network interface's private data area. Drivers can optionally allow creating
54d70e9693SJohannes Berg  * or destroying virtual interfaces on the fly, but without at least one or the
55d70e9693SJohannes Berg  * ability to create some the wireless device isn't useful.
56d70e9693SJohannes Berg  *
57d70e9693SJohannes Berg  * Each wiphy structure contains device capability information, and also has
58d70e9693SJohannes Berg  * a pointer to the various operations the driver offers. The definitions and
59d70e9693SJohannes Berg  * structures here describe these capabilities in detail.
60d70e9693SJohannes Berg  */
61d70e9693SJohannes Berg 
629f5e8f6eSJohannes Berg struct wiphy;
639f5e8f6eSJohannes Berg 
64704232c2SJohannes Berg /*
65d3236553SJohannes Berg  * wireless hardware capability structures
66d3236553SJohannes Berg  */
67d3236553SJohannes Berg 
68d3236553SJohannes Berg /**
69d3236553SJohannes Berg  * enum ieee80211_band - supported frequency bands
70704232c2SJohannes Berg  *
71d3236553SJohannes Berg  * The bands are assigned this way because the supported
72d3236553SJohannes Berg  * bitrates differ in these bands.
73d3236553SJohannes Berg  *
74d3236553SJohannes Berg  * @IEEE80211_BAND_2GHZ: 2.4GHz ISM band
75d3236553SJohannes Berg  * @IEEE80211_BAND_5GHZ: around 5GHz band (4.9-5.7)
763a0c52a6SVladimir Kondratiev  * @IEEE80211_BAND_60GHZ: around 60 GHz band (58.32 - 64.80 GHz)
77abe37c4bSJohannes Berg  * @IEEE80211_NUM_BANDS: number of defined bands
78d3236553SJohannes Berg  */
79d3236553SJohannes Berg enum ieee80211_band {
8013ae75b1SJouni Malinen 	IEEE80211_BAND_2GHZ = NL80211_BAND_2GHZ,
8113ae75b1SJouni Malinen 	IEEE80211_BAND_5GHZ = NL80211_BAND_5GHZ,
823a0c52a6SVladimir Kondratiev 	IEEE80211_BAND_60GHZ = NL80211_BAND_60GHZ,
83d3236553SJohannes Berg 
84d3236553SJohannes Berg 	/* keep last */
85d3236553SJohannes Berg 	IEEE80211_NUM_BANDS
86d3236553SJohannes Berg };
87d3236553SJohannes Berg 
88d3236553SJohannes Berg /**
89d3236553SJohannes Berg  * enum ieee80211_channel_flags - channel flags
90d3236553SJohannes Berg  *
91d3236553SJohannes Berg  * Channel flags set by the regulatory control code.
92d3236553SJohannes Berg  *
93d3236553SJohannes Berg  * @IEEE80211_CHAN_DISABLED: This channel is disabled.
948fe02e16SLuis R. Rodriguez  * @IEEE80211_CHAN_NO_IR: do not initiate radiation, this includes
958fe02e16SLuis R. Rodriguez  * 	sending probe requests or beaconing.
96d3236553SJohannes Berg  * @IEEE80211_CHAN_RADAR: Radar detection is required on this channel.
97689da1b3SLuis R. Rodriguez  * @IEEE80211_CHAN_NO_HT40PLUS: extension channel above this channel
98d3236553SJohannes Berg  * 	is not permitted.
99689da1b3SLuis R. Rodriguez  * @IEEE80211_CHAN_NO_HT40MINUS: extension channel below this channel
100d3236553SJohannes Berg  * 	is not permitted.
10103f6b084SSeth Forshee  * @IEEE80211_CHAN_NO_OFDM: OFDM is not allowed on this channel.
102c7a6ee27SJohannes Berg  * @IEEE80211_CHAN_NO_80MHZ: If the driver supports 80 MHz on the band,
103c7a6ee27SJohannes Berg  *	this flag indicates that an 80 MHz channel cannot use this
104c7a6ee27SJohannes Berg  *	channel as the control or any of the secondary channels.
105c7a6ee27SJohannes Berg  *	This may be due to the driver or due to regulatory bandwidth
106c7a6ee27SJohannes Berg  *	restrictions.
107c7a6ee27SJohannes Berg  * @IEEE80211_CHAN_NO_160MHZ: If the driver supports 160 MHz on the band,
108c7a6ee27SJohannes Berg  *	this flag indicates that an 160 MHz channel cannot use this
109c7a6ee27SJohannes Berg  *	channel as the control or any of the secondary channels.
110c7a6ee27SJohannes Berg  *	This may be due to the driver or due to regulatory bandwidth
111c7a6ee27SJohannes Berg  *	restrictions.
112570dbde1SDavid Spinadel  * @IEEE80211_CHAN_INDOOR_ONLY: see %NL80211_FREQUENCY_ATTR_INDOOR_ONLY
113570dbde1SDavid Spinadel  * @IEEE80211_CHAN_GO_CONCURRENT: see %NL80211_FREQUENCY_ATTR_GO_CONCURRENT
114570dbde1SDavid Spinadel  *
115d3236553SJohannes Berg  */
116d3236553SJohannes Berg enum ieee80211_channel_flags {
117d3236553SJohannes Berg 	IEEE80211_CHAN_DISABLED		= 1<<0,
1188fe02e16SLuis R. Rodriguez 	IEEE80211_CHAN_NO_IR		= 1<<1,
1198fe02e16SLuis R. Rodriguez 	/* hole at 1<<2 */
120d3236553SJohannes Berg 	IEEE80211_CHAN_RADAR		= 1<<3,
121689da1b3SLuis R. Rodriguez 	IEEE80211_CHAN_NO_HT40PLUS	= 1<<4,
122689da1b3SLuis R. Rodriguez 	IEEE80211_CHAN_NO_HT40MINUS	= 1<<5,
12303f6b084SSeth Forshee 	IEEE80211_CHAN_NO_OFDM		= 1<<6,
124c7a6ee27SJohannes Berg 	IEEE80211_CHAN_NO_80MHZ		= 1<<7,
125c7a6ee27SJohannes Berg 	IEEE80211_CHAN_NO_160MHZ	= 1<<8,
126570dbde1SDavid Spinadel 	IEEE80211_CHAN_INDOOR_ONLY	= 1<<9,
127570dbde1SDavid Spinadel 	IEEE80211_CHAN_GO_CONCURRENT	= 1<<10,
128d3236553SJohannes Berg };
129d3236553SJohannes Berg 
130038659e7SLuis R. Rodriguez #define IEEE80211_CHAN_NO_HT40 \
131689da1b3SLuis R. Rodriguez 	(IEEE80211_CHAN_NO_HT40PLUS | IEEE80211_CHAN_NO_HT40MINUS)
132038659e7SLuis R. Rodriguez 
13304f39047SSimon Wunderlich #define IEEE80211_DFS_MIN_CAC_TIME_MS		60000
13404f39047SSimon Wunderlich #define IEEE80211_DFS_MIN_NOP_TIME_MS		(30 * 60 * 1000)
13504f39047SSimon Wunderlich 
136d3236553SJohannes Berg /**
137d3236553SJohannes Berg  * struct ieee80211_channel - channel definition
138d3236553SJohannes Berg  *
139d3236553SJohannes Berg  * This structure describes a single channel for use
140d3236553SJohannes Berg  * with cfg80211.
141d3236553SJohannes Berg  *
142d3236553SJohannes Berg  * @center_freq: center frequency in MHz
143d3236553SJohannes Berg  * @hw_value: hardware-specific value for the channel
144d3236553SJohannes Berg  * @flags: channel flags from &enum ieee80211_channel_flags.
145d3236553SJohannes Berg  * @orig_flags: channel flags at registration time, used by regulatory
146d3236553SJohannes Berg  *	code to support devices with additional restrictions
147d3236553SJohannes Berg  * @band: band this channel belongs to.
148d3236553SJohannes Berg  * @max_antenna_gain: maximum antenna gain in dBi
149d3236553SJohannes Berg  * @max_power: maximum transmission power (in dBm)
150eccc068eSHong Wu  * @max_reg_power: maximum regulatory transmission power (in dBm)
151d3236553SJohannes Berg  * @beacon_found: helper to regulatory code to indicate when a beacon
152d3236553SJohannes Berg  *	has been found on this channel. Use regulatory_hint_found_beacon()
15377c2061dSWalter Goldens  *	to enable this, this is useful only on 5 GHz band.
154d3236553SJohannes Berg  * @orig_mag: internal use
155d3236553SJohannes Berg  * @orig_mpwr: internal use
15604f39047SSimon Wunderlich  * @dfs_state: current state of this channel. Only relevant if radar is required
15704f39047SSimon Wunderlich  *	on this channel.
15804f39047SSimon Wunderlich  * @dfs_state_entered: timestamp (jiffies) when the dfs state was entered.
159089027e5SJanusz Dziedzic  * @dfs_cac_ms: DFS CAC time in milliseconds, this is valid for DFS channels.
160d3236553SJohannes Berg  */
161d3236553SJohannes Berg struct ieee80211_channel {
162d3236553SJohannes Berg 	enum ieee80211_band band;
163d3236553SJohannes Berg 	u16 center_freq;
164d3236553SJohannes Berg 	u16 hw_value;
165d3236553SJohannes Berg 	u32 flags;
166d3236553SJohannes Berg 	int max_antenna_gain;
167d3236553SJohannes Berg 	int max_power;
168eccc068eSHong Wu 	int max_reg_power;
169d3236553SJohannes Berg 	bool beacon_found;
170d3236553SJohannes Berg 	u32 orig_flags;
171d3236553SJohannes Berg 	int orig_mag, orig_mpwr;
17204f39047SSimon Wunderlich 	enum nl80211_dfs_state dfs_state;
17304f39047SSimon Wunderlich 	unsigned long dfs_state_entered;
174089027e5SJanusz Dziedzic 	unsigned int dfs_cac_ms;
175d3236553SJohannes Berg };
176d3236553SJohannes Berg 
177d3236553SJohannes Berg /**
178d3236553SJohannes Berg  * enum ieee80211_rate_flags - rate flags
179d3236553SJohannes Berg  *
180d3236553SJohannes Berg  * Hardware/specification flags for rates. These are structured
181d3236553SJohannes Berg  * in a way that allows using the same bitrate structure for
182d3236553SJohannes Berg  * different bands/PHY modes.
183d3236553SJohannes Berg  *
184d3236553SJohannes Berg  * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short
185d3236553SJohannes Berg  *	preamble on this bitrate; only relevant in 2.4GHz band and
186d3236553SJohannes Berg  *	with CCK rates.
187d3236553SJohannes Berg  * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate
188d3236553SJohannes Berg  *	when used with 802.11a (on the 5 GHz band); filled by the
189d3236553SJohannes Berg  *	core code when registering the wiphy.
190d3236553SJohannes Berg  * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate
191d3236553SJohannes Berg  *	when used with 802.11b (on the 2.4 GHz band); filled by the
192d3236553SJohannes Berg  *	core code when registering the wiphy.
193d3236553SJohannes Berg  * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate
194d3236553SJohannes Berg  *	when used with 802.11g (on the 2.4 GHz band); filled by the
195d3236553SJohannes Berg  *	core code when registering the wiphy.
196d3236553SJohannes Berg  * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode.
19730e74732SSimon Wunderlich  * @IEEE80211_RATE_SUPPORTS_5MHZ: Rate can be used in 5 MHz mode
19830e74732SSimon Wunderlich  * @IEEE80211_RATE_SUPPORTS_10MHZ: Rate can be used in 10 MHz mode
199d3236553SJohannes Berg  */
200d3236553SJohannes Berg enum ieee80211_rate_flags {
201d3236553SJohannes Berg 	IEEE80211_RATE_SHORT_PREAMBLE	= 1<<0,
202d3236553SJohannes Berg 	IEEE80211_RATE_MANDATORY_A	= 1<<1,
203d3236553SJohannes Berg 	IEEE80211_RATE_MANDATORY_B	= 1<<2,
204d3236553SJohannes Berg 	IEEE80211_RATE_MANDATORY_G	= 1<<3,
205d3236553SJohannes Berg 	IEEE80211_RATE_ERP_G		= 1<<4,
20630e74732SSimon Wunderlich 	IEEE80211_RATE_SUPPORTS_5MHZ	= 1<<5,
20730e74732SSimon Wunderlich 	IEEE80211_RATE_SUPPORTS_10MHZ	= 1<<6,
208d3236553SJohannes Berg };
209d3236553SJohannes Berg 
210d3236553SJohannes Berg /**
211d3236553SJohannes Berg  * struct ieee80211_rate - bitrate definition
212d3236553SJohannes Berg  *
213d3236553SJohannes Berg  * This structure describes a bitrate that an 802.11 PHY can
214d3236553SJohannes Berg  * operate with. The two values @hw_value and @hw_value_short
215d3236553SJohannes Berg  * are only for driver use when pointers to this structure are
216d3236553SJohannes Berg  * passed around.
217d3236553SJohannes Berg  *
218d3236553SJohannes Berg  * @flags: rate-specific flags
219d3236553SJohannes Berg  * @bitrate: bitrate in units of 100 Kbps
220d3236553SJohannes Berg  * @hw_value: driver/hardware value for this rate
221d3236553SJohannes Berg  * @hw_value_short: driver/hardware value for this rate when
222d3236553SJohannes Berg  *	short preamble is used
223d3236553SJohannes Berg  */
224d3236553SJohannes Berg struct ieee80211_rate {
225d3236553SJohannes Berg 	u32 flags;
226d3236553SJohannes Berg 	u16 bitrate;
227d3236553SJohannes Berg 	u16 hw_value, hw_value_short;
228d3236553SJohannes Berg };
229d3236553SJohannes Berg 
230d3236553SJohannes Berg /**
231d3236553SJohannes Berg  * struct ieee80211_sta_ht_cap - STA's HT capabilities
232d3236553SJohannes Berg  *
233d3236553SJohannes Berg  * This structure describes most essential parameters needed
234d3236553SJohannes Berg  * to describe 802.11n HT capabilities for an STA.
235d3236553SJohannes Berg  *
236d3236553SJohannes Berg  * @ht_supported: is HT supported by the STA
237d3236553SJohannes Berg  * @cap: HT capabilities map as described in 802.11n spec
238d3236553SJohannes Berg  * @ampdu_factor: Maximum A-MPDU length factor
239d3236553SJohannes Berg  * @ampdu_density: Minimum A-MPDU spacing
240d3236553SJohannes Berg  * @mcs: Supported MCS rates
241d3236553SJohannes Berg  */
242d3236553SJohannes Berg struct ieee80211_sta_ht_cap {
243d3236553SJohannes Berg 	u16 cap; /* use IEEE80211_HT_CAP_ */
244d3236553SJohannes Berg 	bool ht_supported;
245d3236553SJohannes Berg 	u8 ampdu_factor;
246d3236553SJohannes Berg 	u8 ampdu_density;
247d3236553SJohannes Berg 	struct ieee80211_mcs_info mcs;
248d3236553SJohannes Berg };
249d3236553SJohannes Berg 
250d3236553SJohannes Berg /**
251bf0c111eSMahesh Palivela  * struct ieee80211_sta_vht_cap - STA's VHT capabilities
252bf0c111eSMahesh Palivela  *
253bf0c111eSMahesh Palivela  * This structure describes most essential parameters needed
254bf0c111eSMahesh Palivela  * to describe 802.11ac VHT capabilities for an STA.
255bf0c111eSMahesh Palivela  *
256bf0c111eSMahesh Palivela  * @vht_supported: is VHT supported by the STA
257bf0c111eSMahesh Palivela  * @cap: VHT capabilities map as described in 802.11ac spec
258bf0c111eSMahesh Palivela  * @vht_mcs: Supported VHT MCS rates
259bf0c111eSMahesh Palivela  */
260bf0c111eSMahesh Palivela struct ieee80211_sta_vht_cap {
261bf0c111eSMahesh Palivela 	bool vht_supported;
262bf0c111eSMahesh Palivela 	u32 cap; /* use IEEE80211_VHT_CAP_ */
263bf0c111eSMahesh Palivela 	struct ieee80211_vht_mcs_info vht_mcs;
264bf0c111eSMahesh Palivela };
265bf0c111eSMahesh Palivela 
266bf0c111eSMahesh Palivela /**
267d3236553SJohannes Berg  * struct ieee80211_supported_band - frequency band definition
268d3236553SJohannes Berg  *
269d3236553SJohannes Berg  * This structure describes a frequency band a wiphy
270d3236553SJohannes Berg  * is able to operate in.
271d3236553SJohannes Berg  *
272d3236553SJohannes Berg  * @channels: Array of channels the hardware can operate in
273d3236553SJohannes Berg  *	in this band.
274d3236553SJohannes Berg  * @band: the band this structure represents
275d3236553SJohannes Berg  * @n_channels: Number of channels in @channels
276d3236553SJohannes Berg  * @bitrates: Array of bitrates the hardware can operate with
277d3236553SJohannes Berg  *	in this band. Must be sorted to give a valid "supported
278d3236553SJohannes Berg  *	rates" IE, i.e. CCK rates first, then OFDM.
279d3236553SJohannes Berg  * @n_bitrates: Number of bitrates in @bitrates
280abe37c4bSJohannes Berg  * @ht_cap: HT capabilities in this band
281c9a0a302SRobert P. J. Day  * @vht_cap: VHT capabilities in this band
282d3236553SJohannes Berg  */
283d3236553SJohannes Berg struct ieee80211_supported_band {
284d3236553SJohannes Berg 	struct ieee80211_channel *channels;
285d3236553SJohannes Berg 	struct ieee80211_rate *bitrates;
286d3236553SJohannes Berg 	enum ieee80211_band band;
287d3236553SJohannes Berg 	int n_channels;
288d3236553SJohannes Berg 	int n_bitrates;
289d3236553SJohannes Berg 	struct ieee80211_sta_ht_cap ht_cap;
290bf0c111eSMahesh Palivela 	struct ieee80211_sta_vht_cap vht_cap;
291d3236553SJohannes Berg };
292d3236553SJohannes Berg 
293d3236553SJohannes Berg /*
294d3236553SJohannes Berg  * Wireless hardware/device configuration structures and methods
295704232c2SJohannes Berg  */
296704232c2SJohannes Berg 
2972ec600d6SLuis Carlos Cobo /**
298d70e9693SJohannes Berg  * DOC: Actions and configuration
299d70e9693SJohannes Berg  *
300d70e9693SJohannes Berg  * Each wireless device and each virtual interface offer a set of configuration
301d70e9693SJohannes Berg  * operations and other actions that are invoked by userspace. Each of these
302d70e9693SJohannes Berg  * actions is described in the operations structure, and the parameters these
303d70e9693SJohannes Berg  * operations use are described separately.
304d70e9693SJohannes Berg  *
305d70e9693SJohannes Berg  * Additionally, some operations are asynchronous and expect to get status
306d70e9693SJohannes Berg  * information via some functions that drivers need to call.
307d70e9693SJohannes Berg  *
308d70e9693SJohannes Berg  * Scanning and BSS list handling with its associated functionality is described
309d70e9693SJohannes Berg  * in a separate chapter.
310d70e9693SJohannes Berg  */
311d70e9693SJohannes Berg 
312d70e9693SJohannes Berg /**
3132ec600d6SLuis Carlos Cobo  * struct vif_params - describes virtual interface parameters
3148b787643SFelix Fietkau  * @use_4addr: use 4-address frames
3151c18f145SArend van Spriel  * @macaddr: address to use for this virtual interface. This will only
3161c18f145SArend van Spriel  * 	be used for non-netdevice interfaces. If this parameter is set
3171c18f145SArend van Spriel  * 	to zero address the driver may determine the address as needed.
3182ec600d6SLuis Carlos Cobo  */
3192ec600d6SLuis Carlos Cobo struct vif_params {
3208b787643SFelix Fietkau        int use_4addr;
3211c18f145SArend van Spriel        u8 macaddr[ETH_ALEN];
3222ec600d6SLuis Carlos Cobo };
3232ec600d6SLuis Carlos Cobo 
32441ade00fSJohannes Berg /**
32541ade00fSJohannes Berg  * struct key_params - key information
32641ade00fSJohannes Berg  *
32741ade00fSJohannes Berg  * Information about a key
32841ade00fSJohannes Berg  *
32941ade00fSJohannes Berg  * @key: key material
33041ade00fSJohannes Berg  * @key_len: length of key material
33141ade00fSJohannes Berg  * @cipher: cipher suite selector
33241ade00fSJohannes Berg  * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used
33341ade00fSJohannes Berg  *	with the get_key() callback, must be in little endian,
33441ade00fSJohannes Berg  *	length given by @seq_len.
335abe37c4bSJohannes Berg  * @seq_len: length of @seq.
33641ade00fSJohannes Berg  */
33741ade00fSJohannes Berg struct key_params {
33841ade00fSJohannes Berg 	u8 *key;
33941ade00fSJohannes Berg 	u8 *seq;
34041ade00fSJohannes Berg 	int key_len;
34141ade00fSJohannes Berg 	int seq_len;
34241ade00fSJohannes Berg 	u32 cipher;
34341ade00fSJohannes Berg };
34441ade00fSJohannes Berg 
345ed1b6cc7SJohannes Berg /**
346683b6d3bSJohannes Berg  * struct cfg80211_chan_def - channel definition
347683b6d3bSJohannes Berg  * @chan: the (control) channel
3483d9d1d66SJohannes Berg  * @width: channel width
3493d9d1d66SJohannes Berg  * @center_freq1: center frequency of first segment
3503d9d1d66SJohannes Berg  * @center_freq2: center frequency of second segment
3513d9d1d66SJohannes Berg  *	(only with 80+80 MHz)
352683b6d3bSJohannes Berg  */
353683b6d3bSJohannes Berg struct cfg80211_chan_def {
354683b6d3bSJohannes Berg 	struct ieee80211_channel *chan;
3553d9d1d66SJohannes Berg 	enum nl80211_chan_width width;
3563d9d1d66SJohannes Berg 	u32 center_freq1;
3573d9d1d66SJohannes Berg 	u32 center_freq2;
358683b6d3bSJohannes Berg };
359683b6d3bSJohannes Berg 
3603d9d1d66SJohannes Berg /**
3613d9d1d66SJohannes Berg  * cfg80211_get_chandef_type - return old channel type from chandef
3623d9d1d66SJohannes Berg  * @chandef: the channel definition
3633d9d1d66SJohannes Berg  *
3640ae997dcSYacine Belkadi  * Return: The old channel type (NOHT, HT20, HT40+/-) from a given
3653d9d1d66SJohannes Berg  * chandef, which must have a bandwidth allowing this conversion.
3663d9d1d66SJohannes Berg  */
367683b6d3bSJohannes Berg static inline enum nl80211_channel_type
368683b6d3bSJohannes Berg cfg80211_get_chandef_type(const struct cfg80211_chan_def *chandef)
369683b6d3bSJohannes Berg {
3703d9d1d66SJohannes Berg 	switch (chandef->width) {
3713d9d1d66SJohannes Berg 	case NL80211_CHAN_WIDTH_20_NOHT:
3723d9d1d66SJohannes Berg 		return NL80211_CHAN_NO_HT;
3733d9d1d66SJohannes Berg 	case NL80211_CHAN_WIDTH_20:
3743d9d1d66SJohannes Berg 		return NL80211_CHAN_HT20;
3753d9d1d66SJohannes Berg 	case NL80211_CHAN_WIDTH_40:
3763d9d1d66SJohannes Berg 		if (chandef->center_freq1 > chandef->chan->center_freq)
3773d9d1d66SJohannes Berg 			return NL80211_CHAN_HT40PLUS;
3783d9d1d66SJohannes Berg 		return NL80211_CHAN_HT40MINUS;
3793d9d1d66SJohannes Berg 	default:
3803d9d1d66SJohannes Berg 		WARN_ON(1);
3813d9d1d66SJohannes Berg 		return NL80211_CHAN_NO_HT;
382683b6d3bSJohannes Berg 	}
3833d9d1d66SJohannes Berg }
3843d9d1d66SJohannes Berg 
3853d9d1d66SJohannes Berg /**
3863d9d1d66SJohannes Berg  * cfg80211_chandef_create - create channel definition using channel type
3873d9d1d66SJohannes Berg  * @chandef: the channel definition struct to fill
3883d9d1d66SJohannes Berg  * @channel: the control channel
3893d9d1d66SJohannes Berg  * @chantype: the channel type
3903d9d1d66SJohannes Berg  *
3913d9d1d66SJohannes Berg  * Given a channel type, create a channel definition.
3923d9d1d66SJohannes Berg  */
3933d9d1d66SJohannes Berg void cfg80211_chandef_create(struct cfg80211_chan_def *chandef,
3943d9d1d66SJohannes Berg 			     struct ieee80211_channel *channel,
3953d9d1d66SJohannes Berg 			     enum nl80211_channel_type chantype);
3963d9d1d66SJohannes Berg 
3973d9d1d66SJohannes Berg /**
3983d9d1d66SJohannes Berg  * cfg80211_chandef_identical - check if two channel definitions are identical
3993d9d1d66SJohannes Berg  * @chandef1: first channel definition
4003d9d1d66SJohannes Berg  * @chandef2: second channel definition
4013d9d1d66SJohannes Berg  *
4020ae997dcSYacine Belkadi  * Return: %true if the channels defined by the channel definitions are
4033d9d1d66SJohannes Berg  * identical, %false otherwise.
4043d9d1d66SJohannes Berg  */
4053d9d1d66SJohannes Berg static inline bool
4063d9d1d66SJohannes Berg cfg80211_chandef_identical(const struct cfg80211_chan_def *chandef1,
4073d9d1d66SJohannes Berg 			   const struct cfg80211_chan_def *chandef2)
4083d9d1d66SJohannes Berg {
4093d9d1d66SJohannes Berg 	return (chandef1->chan == chandef2->chan &&
4103d9d1d66SJohannes Berg 		chandef1->width == chandef2->width &&
4113d9d1d66SJohannes Berg 		chandef1->center_freq1 == chandef2->center_freq1 &&
4123d9d1d66SJohannes Berg 		chandef1->center_freq2 == chandef2->center_freq2);
4133d9d1d66SJohannes Berg }
4143d9d1d66SJohannes Berg 
4153d9d1d66SJohannes Berg /**
4163d9d1d66SJohannes Berg  * cfg80211_chandef_compatible - check if two channel definitions are compatible
4173d9d1d66SJohannes Berg  * @chandef1: first channel definition
4183d9d1d66SJohannes Berg  * @chandef2: second channel definition
4193d9d1d66SJohannes Berg  *
4200ae997dcSYacine Belkadi  * Return: %NULL if the given channel definitions are incompatible,
4213d9d1d66SJohannes Berg  * chandef1 or chandef2 otherwise.
4223d9d1d66SJohannes Berg  */
4233d9d1d66SJohannes Berg const struct cfg80211_chan_def *
4243d9d1d66SJohannes Berg cfg80211_chandef_compatible(const struct cfg80211_chan_def *chandef1,
4253d9d1d66SJohannes Berg 			    const struct cfg80211_chan_def *chandef2);
426683b6d3bSJohannes Berg 
427683b6d3bSJohannes Berg /**
4289f5e8f6eSJohannes Berg  * cfg80211_chandef_valid - check if a channel definition is valid
4299f5e8f6eSJohannes Berg  * @chandef: the channel definition to check
4300ae997dcSYacine Belkadi  * Return: %true if the channel definition is valid. %false otherwise.
4319f5e8f6eSJohannes Berg  */
4329f5e8f6eSJohannes Berg bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef);
4339f5e8f6eSJohannes Berg 
4349f5e8f6eSJohannes Berg /**
4359f5e8f6eSJohannes Berg  * cfg80211_chandef_usable - check if secondary channels can be used
4369f5e8f6eSJohannes Berg  * @wiphy: the wiphy to validate against
4379f5e8f6eSJohannes Berg  * @chandef: the channel definition to check
4380ae997dcSYacine Belkadi  * @prohibited_flags: the regulatory channel flags that must not be set
4390ae997dcSYacine Belkadi  * Return: %true if secondary channels are usable. %false otherwise.
4409f5e8f6eSJohannes Berg  */
4419f5e8f6eSJohannes Berg bool cfg80211_chandef_usable(struct wiphy *wiphy,
4429f5e8f6eSJohannes Berg 			     const struct cfg80211_chan_def *chandef,
4439f5e8f6eSJohannes Berg 			     u32 prohibited_flags);
4449f5e8f6eSJohannes Berg 
4459f5e8f6eSJohannes Berg /**
446774f0734SSimon Wunderlich  * cfg80211_chandef_dfs_required - checks if radar detection is required
447774f0734SSimon Wunderlich  * @wiphy: the wiphy to validate against
448774f0734SSimon Wunderlich  * @chandef: the channel definition to check
449774f0734SSimon Wunderlich  * Return: 1 if radar detection is required, 0 if it is not, < 0 on error
450774f0734SSimon Wunderlich  */
451774f0734SSimon Wunderlich int cfg80211_chandef_dfs_required(struct wiphy *wiphy,
452774f0734SSimon Wunderlich 				  const struct cfg80211_chan_def *chandef);
453774f0734SSimon Wunderlich 
454774f0734SSimon Wunderlich /**
45530e74732SSimon Wunderlich  * ieee80211_chandef_rate_flags - returns rate flags for a channel
45630e74732SSimon Wunderlich  *
45730e74732SSimon Wunderlich  * In some channel types, not all rates may be used - for example CCK
45830e74732SSimon Wunderlich  * rates may not be used in 5/10 MHz channels.
45930e74732SSimon Wunderlich  *
46030e74732SSimon Wunderlich  * @chandef: channel definition for the channel
46130e74732SSimon Wunderlich  *
46230e74732SSimon Wunderlich  * Returns: rate flags which apply for this channel
46330e74732SSimon Wunderlich  */
46430e74732SSimon Wunderlich static inline enum ieee80211_rate_flags
46530e74732SSimon Wunderlich ieee80211_chandef_rate_flags(struct cfg80211_chan_def *chandef)
46630e74732SSimon Wunderlich {
46730e74732SSimon Wunderlich 	switch (chandef->width) {
46830e74732SSimon Wunderlich 	case NL80211_CHAN_WIDTH_5:
46930e74732SSimon Wunderlich 		return IEEE80211_RATE_SUPPORTS_5MHZ;
47030e74732SSimon Wunderlich 	case NL80211_CHAN_WIDTH_10:
47130e74732SSimon Wunderlich 		return IEEE80211_RATE_SUPPORTS_10MHZ;
47230e74732SSimon Wunderlich 	default:
47330e74732SSimon Wunderlich 		break;
47430e74732SSimon Wunderlich 	}
47530e74732SSimon Wunderlich 	return 0;
47630e74732SSimon Wunderlich }
47730e74732SSimon Wunderlich 
47830e74732SSimon Wunderlich /**
4790430c883SSimon Wunderlich  * ieee80211_chandef_max_power - maximum transmission power for the chandef
4800430c883SSimon Wunderlich  *
4810430c883SSimon Wunderlich  * In some regulations, the transmit power may depend on the configured channel
4820430c883SSimon Wunderlich  * bandwidth which may be defined as dBm/MHz. This function returns the actual
4830430c883SSimon Wunderlich  * max_power for non-standard (20 MHz) channels.
4840430c883SSimon Wunderlich  *
4850430c883SSimon Wunderlich  * @chandef: channel definition for the channel
4860430c883SSimon Wunderlich  *
4870430c883SSimon Wunderlich  * Returns: maximum allowed transmission power in dBm for the chandef
4880430c883SSimon Wunderlich  */
4890430c883SSimon Wunderlich static inline int
4900430c883SSimon Wunderlich ieee80211_chandef_max_power(struct cfg80211_chan_def *chandef)
4910430c883SSimon Wunderlich {
4920430c883SSimon Wunderlich 	switch (chandef->width) {
4930430c883SSimon Wunderlich 	case NL80211_CHAN_WIDTH_5:
4940430c883SSimon Wunderlich 		return min(chandef->chan->max_reg_power - 6,
4950430c883SSimon Wunderlich 			   chandef->chan->max_power);
4960430c883SSimon Wunderlich 	case NL80211_CHAN_WIDTH_10:
4970430c883SSimon Wunderlich 		return min(chandef->chan->max_reg_power - 3,
4980430c883SSimon Wunderlich 			   chandef->chan->max_power);
4990430c883SSimon Wunderlich 	default:
5000430c883SSimon Wunderlich 		break;
5010430c883SSimon Wunderlich 	}
5020430c883SSimon Wunderlich 	return chandef->chan->max_power;
5030430c883SSimon Wunderlich }
5040430c883SSimon Wunderlich 
5050430c883SSimon Wunderlich /**
50661fa713cSHolger Schurig  * enum survey_info_flags - survey information flags
50761fa713cSHolger Schurig  *
508abe37c4bSJohannes Berg  * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in
50917e5a808SFelix Fietkau  * @SURVEY_INFO_IN_USE: channel is currently being used
5108610c29aSFelix Fietkau  * @SURVEY_INFO_CHANNEL_TIME: channel active time (in ms) was filled in
5118610c29aSFelix Fietkau  * @SURVEY_INFO_CHANNEL_TIME_BUSY: channel busy time was filled in
5128610c29aSFelix Fietkau  * @SURVEY_INFO_CHANNEL_TIME_EXT_BUSY: extension channel busy time was filled in
5138610c29aSFelix Fietkau  * @SURVEY_INFO_CHANNEL_TIME_RX: channel receive time was filled in
5148610c29aSFelix Fietkau  * @SURVEY_INFO_CHANNEL_TIME_TX: channel transmit time was filled in
515abe37c4bSJohannes Berg  *
51661fa713cSHolger Schurig  * Used by the driver to indicate which info in &struct survey_info
51761fa713cSHolger Schurig  * it has filled in during the get_survey().
51861fa713cSHolger Schurig  */
51961fa713cSHolger Schurig enum survey_info_flags {
52061fa713cSHolger Schurig 	SURVEY_INFO_NOISE_DBM = 1<<0,
52117e5a808SFelix Fietkau 	SURVEY_INFO_IN_USE = 1<<1,
5228610c29aSFelix Fietkau 	SURVEY_INFO_CHANNEL_TIME = 1<<2,
5238610c29aSFelix Fietkau 	SURVEY_INFO_CHANNEL_TIME_BUSY = 1<<3,
5248610c29aSFelix Fietkau 	SURVEY_INFO_CHANNEL_TIME_EXT_BUSY = 1<<4,
5258610c29aSFelix Fietkau 	SURVEY_INFO_CHANNEL_TIME_RX = 1<<5,
5268610c29aSFelix Fietkau 	SURVEY_INFO_CHANNEL_TIME_TX = 1<<6,
52761fa713cSHolger Schurig };
52861fa713cSHolger Schurig 
52961fa713cSHolger Schurig /**
53061fa713cSHolger Schurig  * struct survey_info - channel survey response
53161fa713cSHolger Schurig  *
53261fa713cSHolger Schurig  * @channel: the channel this survey record reports, mandatory
53361fa713cSHolger Schurig  * @filled: bitflag of flags from &enum survey_info_flags
53461fa713cSHolger Schurig  * @noise: channel noise in dBm. This and all following fields are
53561fa713cSHolger Schurig  *	optional
5368610c29aSFelix Fietkau  * @channel_time: amount of time in ms the radio spent on the channel
5378610c29aSFelix Fietkau  * @channel_time_busy: amount of time the primary channel was sensed busy
5388610c29aSFelix Fietkau  * @channel_time_ext_busy: amount of time the extension channel was sensed busy
5398610c29aSFelix Fietkau  * @channel_time_rx: amount of time the radio spent receiving data
5408610c29aSFelix Fietkau  * @channel_time_tx: amount of time the radio spent transmitting data
54161fa713cSHolger Schurig  *
542abe37c4bSJohannes Berg  * Used by dump_survey() to report back per-channel survey information.
543abe37c4bSJohannes Berg  *
54461fa713cSHolger Schurig  * This structure can later be expanded with things like
54561fa713cSHolger Schurig  * channel duty cycle etc.
54661fa713cSHolger Schurig  */
54761fa713cSHolger Schurig struct survey_info {
54861fa713cSHolger Schurig 	struct ieee80211_channel *channel;
5498610c29aSFelix Fietkau 	u64 channel_time;
5508610c29aSFelix Fietkau 	u64 channel_time_busy;
5518610c29aSFelix Fietkau 	u64 channel_time_ext_busy;
5528610c29aSFelix Fietkau 	u64 channel_time_rx;
5538610c29aSFelix Fietkau 	u64 channel_time_tx;
55461fa713cSHolger Schurig 	u32 filled;
55561fa713cSHolger Schurig 	s8 noise;
55661fa713cSHolger Schurig };
55761fa713cSHolger Schurig 
55861fa713cSHolger Schurig /**
5595fb628e9SJouni Malinen  * struct cfg80211_crypto_settings - Crypto settings
5605fb628e9SJouni Malinen  * @wpa_versions: indicates which, if any, WPA versions are enabled
5615fb628e9SJouni Malinen  *	(from enum nl80211_wpa_versions)
5625fb628e9SJouni Malinen  * @cipher_group: group key cipher suite (or 0 if unset)
5635fb628e9SJouni Malinen  * @n_ciphers_pairwise: number of AP supported unicast ciphers
5645fb628e9SJouni Malinen  * @ciphers_pairwise: unicast key cipher suites
5655fb628e9SJouni Malinen  * @n_akm_suites: number of AKM suites
5665fb628e9SJouni Malinen  * @akm_suites: AKM suites
5675fb628e9SJouni Malinen  * @control_port: Whether user space controls IEEE 802.1X port, i.e.,
5685fb628e9SJouni Malinen  *	sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
5695fb628e9SJouni Malinen  *	required to assume that the port is unauthorized until authorized by
5705fb628e9SJouni Malinen  *	user space. Otherwise, port is marked authorized by default.
5715fb628e9SJouni Malinen  * @control_port_ethertype: the control port protocol that should be
5725fb628e9SJouni Malinen  *	allowed through even on unauthorized ports
5735fb628e9SJouni Malinen  * @control_port_no_encrypt: TRUE to prevent encryption of control port
5745fb628e9SJouni Malinen  *	protocol frames.
5755fb628e9SJouni Malinen  */
5765fb628e9SJouni Malinen struct cfg80211_crypto_settings {
5775fb628e9SJouni Malinen 	u32 wpa_versions;
5785fb628e9SJouni Malinen 	u32 cipher_group;
5795fb628e9SJouni Malinen 	int n_ciphers_pairwise;
5805fb628e9SJouni Malinen 	u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES];
5815fb628e9SJouni Malinen 	int n_akm_suites;
5825fb628e9SJouni Malinen 	u32 akm_suites[NL80211_MAX_NR_AKM_SUITES];
5835fb628e9SJouni Malinen 	bool control_port;
5845fb628e9SJouni Malinen 	__be16 control_port_ethertype;
5855fb628e9SJouni Malinen 	bool control_port_no_encrypt;
5865fb628e9SJouni Malinen };
5875fb628e9SJouni Malinen 
5885fb628e9SJouni Malinen /**
5898860020eSJohannes Berg  * struct cfg80211_beacon_data - beacon data
590ed1b6cc7SJohannes Berg  * @head: head portion of beacon (before TIM IE)
591ed1b6cc7SJohannes Berg  *	or %NULL if not changed
592ed1b6cc7SJohannes Berg  * @tail: tail portion of beacon (after TIM IE)
593ed1b6cc7SJohannes Berg  *	or %NULL if not changed
594ed1b6cc7SJohannes Berg  * @head_len: length of @head
595ed1b6cc7SJohannes Berg  * @tail_len: length of @tail
5969946ecfbSJouni Malinen  * @beacon_ies: extra information element(s) to add into Beacon frames or %NULL
5979946ecfbSJouni Malinen  * @beacon_ies_len: length of beacon_ies in octets
5989946ecfbSJouni Malinen  * @proberesp_ies: extra information element(s) to add into Probe Response
5999946ecfbSJouni Malinen  *	frames or %NULL
6009946ecfbSJouni Malinen  * @proberesp_ies_len: length of proberesp_ies in octets
6019946ecfbSJouni Malinen  * @assocresp_ies: extra information element(s) to add into (Re)Association
6029946ecfbSJouni Malinen  *	Response frames or %NULL
6039946ecfbSJouni Malinen  * @assocresp_ies_len: length of assocresp_ies in octets
60400f740e1SArik Nemtsov  * @probe_resp_len: length of probe response template (@probe_resp)
60500f740e1SArik Nemtsov  * @probe_resp: probe response template (AP mode only)
606ed1b6cc7SJohannes Berg  */
6078860020eSJohannes Berg struct cfg80211_beacon_data {
6088860020eSJohannes Berg 	const u8 *head, *tail;
6098860020eSJohannes Berg 	const u8 *beacon_ies;
6108860020eSJohannes Berg 	const u8 *proberesp_ies;
6118860020eSJohannes Berg 	const u8 *assocresp_ies;
6128860020eSJohannes Berg 	const u8 *probe_resp;
6138860020eSJohannes Berg 
6148860020eSJohannes Berg 	size_t head_len, tail_len;
6158860020eSJohannes Berg 	size_t beacon_ies_len;
6168860020eSJohannes Berg 	size_t proberesp_ies_len;
6178860020eSJohannes Berg 	size_t assocresp_ies_len;
6188860020eSJohannes Berg 	size_t probe_resp_len;
6198860020eSJohannes Berg };
6208860020eSJohannes Berg 
6216d45a74bSVasanthakumar Thiagarajan struct mac_address {
6226d45a74bSVasanthakumar Thiagarajan 	u8 addr[ETH_ALEN];
6236d45a74bSVasanthakumar Thiagarajan };
6246d45a74bSVasanthakumar Thiagarajan 
6258860020eSJohannes Berg /**
62677765eafSVasanthakumar Thiagarajan  * struct cfg80211_acl_data - Access control list data
62777765eafSVasanthakumar Thiagarajan  *
62877765eafSVasanthakumar Thiagarajan  * @acl_policy: ACL policy to be applied on the station's
629077f897aSJohannes Berg  *	entry specified by mac_addr
63077765eafSVasanthakumar Thiagarajan  * @n_acl_entries: Number of MAC address entries passed
63177765eafSVasanthakumar Thiagarajan  * @mac_addrs: List of MAC addresses of stations to be used for ACL
63277765eafSVasanthakumar Thiagarajan  */
63377765eafSVasanthakumar Thiagarajan struct cfg80211_acl_data {
63477765eafSVasanthakumar Thiagarajan 	enum nl80211_acl_policy acl_policy;
63577765eafSVasanthakumar Thiagarajan 	int n_acl_entries;
63677765eafSVasanthakumar Thiagarajan 
63777765eafSVasanthakumar Thiagarajan 	/* Keep it last */
63877765eafSVasanthakumar Thiagarajan 	struct mac_address mac_addrs[];
63977765eafSVasanthakumar Thiagarajan };
64077765eafSVasanthakumar Thiagarajan 
6418860020eSJohannes Berg /**
6428860020eSJohannes Berg  * struct cfg80211_ap_settings - AP configuration
6438860020eSJohannes Berg  *
6448860020eSJohannes Berg  * Used to configure an AP interface.
6458860020eSJohannes Berg  *
646683b6d3bSJohannes Berg  * @chandef: defines the channel to use
6478860020eSJohannes Berg  * @beacon: beacon data
6488860020eSJohannes Berg  * @beacon_interval: beacon interval
6498860020eSJohannes Berg  * @dtim_period: DTIM period
6508860020eSJohannes Berg  * @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from
6518860020eSJohannes Berg  *	user space)
6528860020eSJohannes Berg  * @ssid_len: length of @ssid
6538860020eSJohannes Berg  * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames
6548860020eSJohannes Berg  * @crypto: crypto settings
6558860020eSJohannes Berg  * @privacy: the BSS uses privacy
6568860020eSJohannes Berg  * @auth_type: Authentication type (algorithm)
6571b658f11SVasanthakumar Thiagarajan  * @inactivity_timeout: time in seconds to determine station's inactivity.
65853cabad7SJohannes Berg  * @p2p_ctwindow: P2P CT Window
65953cabad7SJohannes Berg  * @p2p_opp_ps: P2P opportunistic PS
66077765eafSVasanthakumar Thiagarajan  * @acl: ACL configuration used by the drivers which has support for
66177765eafSVasanthakumar Thiagarajan  *	MAC address based access control
66204f39047SSimon Wunderlich  * @radar_required: set if radar detection is required
6638860020eSJohannes Berg  */
6648860020eSJohannes Berg struct cfg80211_ap_settings {
665683b6d3bSJohannes Berg 	struct cfg80211_chan_def chandef;
666aa430da4SJohannes Berg 
6678860020eSJohannes Berg 	struct cfg80211_beacon_data beacon;
6688860020eSJohannes Berg 
6698860020eSJohannes Berg 	int beacon_interval, dtim_period;
67032e9de84SJouni Malinen 	const u8 *ssid;
67132e9de84SJouni Malinen 	size_t ssid_len;
67232e9de84SJouni Malinen 	enum nl80211_hidden_ssid hidden_ssid;
6735fb628e9SJouni Malinen 	struct cfg80211_crypto_settings crypto;
6745fb628e9SJouni Malinen 	bool privacy;
6755fb628e9SJouni Malinen 	enum nl80211_auth_type auth_type;
6761b658f11SVasanthakumar Thiagarajan 	int inactivity_timeout;
67753cabad7SJohannes Berg 	u8 p2p_ctwindow;
67853cabad7SJohannes Berg 	bool p2p_opp_ps;
67977765eafSVasanthakumar Thiagarajan 	const struct cfg80211_acl_data *acl;
68004f39047SSimon Wunderlich 	bool radar_required;
681ed1b6cc7SJohannes Berg };
682ed1b6cc7SJohannes Berg 
6835727ef1bSJohannes Berg /**
68416ef1fe2SSimon Wunderlich  * struct cfg80211_csa_settings - channel switch settings
68516ef1fe2SSimon Wunderlich  *
68616ef1fe2SSimon Wunderlich  * Used for channel switch
68716ef1fe2SSimon Wunderlich  *
68816ef1fe2SSimon Wunderlich  * @chandef: defines the channel to use after the switch
68916ef1fe2SSimon Wunderlich  * @beacon_csa: beacon data while performing the switch
69016ef1fe2SSimon Wunderlich  * @counter_offset_beacon: offset for the counter within the beacon (tail)
69116ef1fe2SSimon Wunderlich  * @counter_offset_presp: offset for the counter within the probe response
69216ef1fe2SSimon Wunderlich  * @beacon_after: beacon data to be used on the new channel
69316ef1fe2SSimon Wunderlich  * @radar_required: whether radar detection is required on the new channel
69416ef1fe2SSimon Wunderlich  * @block_tx: whether transmissions should be blocked while changing
69516ef1fe2SSimon Wunderlich  * @count: number of beacons until switch
69616ef1fe2SSimon Wunderlich  */
69716ef1fe2SSimon Wunderlich struct cfg80211_csa_settings {
69816ef1fe2SSimon Wunderlich 	struct cfg80211_chan_def chandef;
69916ef1fe2SSimon Wunderlich 	struct cfg80211_beacon_data beacon_csa;
70016ef1fe2SSimon Wunderlich 	u16 counter_offset_beacon, counter_offset_presp;
70116ef1fe2SSimon Wunderlich 	struct cfg80211_beacon_data beacon_after;
70216ef1fe2SSimon Wunderlich 	bool radar_required;
70316ef1fe2SSimon Wunderlich 	bool block_tx;
70416ef1fe2SSimon Wunderlich 	u8 count;
70516ef1fe2SSimon Wunderlich };
70616ef1fe2SSimon Wunderlich 
70716ef1fe2SSimon Wunderlich /**
7083b9ce80cSJohannes Berg  * enum station_parameters_apply_mask - station parameter values to apply
7093b9ce80cSJohannes Berg  * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp)
7109d62a986SJouni Malinen  * @STATION_PARAM_APPLY_CAPABILITY: apply new capability
711f8bacc21SJohannes Berg  * @STATION_PARAM_APPLY_PLINK_STATE: apply new plink state
7123b9ce80cSJohannes Berg  *
7133b9ce80cSJohannes Berg  * Not all station parameters have in-band "no change" signalling,
7143b9ce80cSJohannes Berg  * for those that don't these flags will are used.
7153b9ce80cSJohannes Berg  */
7163b9ce80cSJohannes Berg enum station_parameters_apply_mask {
7173b9ce80cSJohannes Berg 	STATION_PARAM_APPLY_UAPSD = BIT(0),
7189d62a986SJouni Malinen 	STATION_PARAM_APPLY_CAPABILITY = BIT(1),
719f8bacc21SJohannes Berg 	STATION_PARAM_APPLY_PLINK_STATE = BIT(2),
7203b9ce80cSJohannes Berg };
7213b9ce80cSJohannes Berg 
7223b9ce80cSJohannes Berg /**
7235727ef1bSJohannes Berg  * struct station_parameters - station parameters
7245727ef1bSJohannes Berg  *
7255727ef1bSJohannes Berg  * Used to change and create a new station.
7265727ef1bSJohannes Berg  *
7275727ef1bSJohannes Berg  * @vlan: vlan interface station should belong to
7285727ef1bSJohannes Berg  * @supported_rates: supported rates in IEEE 802.11 format
7295727ef1bSJohannes Berg  *	(or NULL for no change)
7305727ef1bSJohannes Berg  * @supported_rates_len: number of supported rates
731eccb8e8fSJohannes Berg  * @sta_flags_mask: station flags that changed
732eccb8e8fSJohannes Berg  *	(bitmask of BIT(NL80211_STA_FLAG_...))
733eccb8e8fSJohannes Berg  * @sta_flags_set: station flags values
734eccb8e8fSJohannes Berg  *	(bitmask of BIT(NL80211_STA_FLAG_...))
7355727ef1bSJohannes Berg  * @listen_interval: listen interval or -1 for no change
7365727ef1bSJohannes Berg  * @aid: AID or zero for no change
737abe37c4bSJohannes Berg  * @plink_action: plink action to take
7389c3990aaSJavier Cardona  * @plink_state: set the peer link state for a station
739abe37c4bSJohannes Berg  * @ht_capa: HT capabilities of station
740f461be3eSMahesh Palivela  * @vht_capa: VHT capabilities of station
741910868dbSEliad Peller  * @uapsd_queues: bitmap of queues configured for uapsd. same format
742910868dbSEliad Peller  *	as the AC bitmap in the QoS info field
743910868dbSEliad Peller  * @max_sp: max Service Period. same format as the MAX_SP in the
744910868dbSEliad Peller  *	QoS info field (but already shifted down)
745c26887d2SJohannes Berg  * @sta_modify_mask: bitmap indicating which parameters changed
746c26887d2SJohannes Berg  *	(for those that don't have a natural "no change" value),
747c26887d2SJohannes Berg  *	see &enum station_parameters_apply_mask
7483b1c5a53SMarco Porsch  * @local_pm: local link-specific mesh power save mode (no change when set
7493b1c5a53SMarco Porsch  *	to unknown)
7509d62a986SJouni Malinen  * @capability: station capability
7519d62a986SJouni Malinen  * @ext_capab: extended capabilities of the station
7529d62a986SJouni Malinen  * @ext_capab_len: number of extended capabilities
753c01fc9adSSunil Dutt  * @supported_channels: supported channels in IEEE 802.11 format
754c01fc9adSSunil Dutt  * @supported_channels_len: number of supported channels
755c01fc9adSSunil Dutt  * @supported_oper_classes: supported oper classes in IEEE 802.11 format
756c01fc9adSSunil Dutt  * @supported_oper_classes_len: number of supported operating classes
75760f4a7b1SMarek Kwaczynski  * @opmode_notif: operating mode field from Operating Mode Notification
75860f4a7b1SMarek Kwaczynski  * @opmode_notif_used: information if operating mode field is used
7595727ef1bSJohannes Berg  */
7605727ef1bSJohannes Berg struct station_parameters {
7612c1aabf3SJohannes Berg 	const u8 *supported_rates;
7625727ef1bSJohannes Berg 	struct net_device *vlan;
763eccb8e8fSJohannes Berg 	u32 sta_flags_mask, sta_flags_set;
7643b9ce80cSJohannes Berg 	u32 sta_modify_mask;
7655727ef1bSJohannes Berg 	int listen_interval;
7665727ef1bSJohannes Berg 	u16 aid;
7675727ef1bSJohannes Berg 	u8 supported_rates_len;
7682ec600d6SLuis Carlos Cobo 	u8 plink_action;
7699c3990aaSJavier Cardona 	u8 plink_state;
7702c1aabf3SJohannes Berg 	const struct ieee80211_ht_cap *ht_capa;
7712c1aabf3SJohannes Berg 	const struct ieee80211_vht_cap *vht_capa;
772c75786c9SEliad Peller 	u8 uapsd_queues;
773c75786c9SEliad Peller 	u8 max_sp;
7743b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode local_pm;
7759d62a986SJouni Malinen 	u16 capability;
7762c1aabf3SJohannes Berg 	const u8 *ext_capab;
7779d62a986SJouni Malinen 	u8 ext_capab_len;
778c01fc9adSSunil Dutt 	const u8 *supported_channels;
779c01fc9adSSunil Dutt 	u8 supported_channels_len;
780c01fc9adSSunil Dutt 	const u8 *supported_oper_classes;
781c01fc9adSSunil Dutt 	u8 supported_oper_classes_len;
78260f4a7b1SMarek Kwaczynski 	u8 opmode_notif;
78360f4a7b1SMarek Kwaczynski 	bool opmode_notif_used;
7845727ef1bSJohannes Berg };
7855727ef1bSJohannes Berg 
786fd5b74dcSJohannes Berg /**
78777ee7c89SJohannes Berg  * enum cfg80211_station_type - the type of station being modified
78877ee7c89SJohannes Berg  * @CFG80211_STA_AP_CLIENT: client of an AP interface
78977ee7c89SJohannes Berg  * @CFG80211_STA_AP_MLME_CLIENT: client of an AP interface that has
79077ee7c89SJohannes Berg  *	the AP MLME in the device
79177ee7c89SJohannes Berg  * @CFG80211_STA_AP_STA: AP station on managed interface
79277ee7c89SJohannes Berg  * @CFG80211_STA_IBSS: IBSS station
79377ee7c89SJohannes Berg  * @CFG80211_STA_TDLS_PEER_SETUP: TDLS peer on managed interface (dummy entry
79477ee7c89SJohannes Berg  *	while TDLS setup is in progress, it moves out of this state when
79577ee7c89SJohannes Berg  *	being marked authorized; use this only if TDLS with external setup is
79677ee7c89SJohannes Berg  *	supported/used)
79777ee7c89SJohannes Berg  * @CFG80211_STA_TDLS_PEER_ACTIVE: TDLS peer on managed interface (active
79877ee7c89SJohannes Berg  *	entry that is operating, has been marked authorized by userspace)
799eef941e6SThomas Pedersen  * @CFG80211_STA_MESH_PEER_KERNEL: peer on mesh interface (kernel managed)
800eef941e6SThomas Pedersen  * @CFG80211_STA_MESH_PEER_USER: peer on mesh interface (user managed)
80177ee7c89SJohannes Berg  */
80277ee7c89SJohannes Berg enum cfg80211_station_type {
80377ee7c89SJohannes Berg 	CFG80211_STA_AP_CLIENT,
80477ee7c89SJohannes Berg 	CFG80211_STA_AP_MLME_CLIENT,
80577ee7c89SJohannes Berg 	CFG80211_STA_AP_STA,
80677ee7c89SJohannes Berg 	CFG80211_STA_IBSS,
80777ee7c89SJohannes Berg 	CFG80211_STA_TDLS_PEER_SETUP,
80877ee7c89SJohannes Berg 	CFG80211_STA_TDLS_PEER_ACTIVE,
809eef941e6SThomas Pedersen 	CFG80211_STA_MESH_PEER_KERNEL,
810eef941e6SThomas Pedersen 	CFG80211_STA_MESH_PEER_USER,
81177ee7c89SJohannes Berg };
81277ee7c89SJohannes Berg 
81377ee7c89SJohannes Berg /**
81477ee7c89SJohannes Berg  * cfg80211_check_station_change - validate parameter changes
81577ee7c89SJohannes Berg  * @wiphy: the wiphy this operates on
81677ee7c89SJohannes Berg  * @params: the new parameters for a station
81777ee7c89SJohannes Berg  * @statype: the type of station being modified
81877ee7c89SJohannes Berg  *
81977ee7c89SJohannes Berg  * Utility function for the @change_station driver method. Call this function
82077ee7c89SJohannes Berg  * with the appropriate station type looking up the station (and checking that
82177ee7c89SJohannes Berg  * it exists). It will verify whether the station change is acceptable, and if
82277ee7c89SJohannes Berg  * not will return an error code. Note that it may modify the parameters for
82377ee7c89SJohannes Berg  * backward compatibility reasons, so don't use them before calling this.
82477ee7c89SJohannes Berg  */
82577ee7c89SJohannes Berg int cfg80211_check_station_change(struct wiphy *wiphy,
82677ee7c89SJohannes Berg 				  struct station_parameters *params,
82777ee7c89SJohannes Berg 				  enum cfg80211_station_type statype);
82877ee7c89SJohannes Berg 
82977ee7c89SJohannes Berg /**
8302ec600d6SLuis Carlos Cobo  * enum station_info_flags - station information flags
831fd5b74dcSJohannes Berg  *
8322ec600d6SLuis Carlos Cobo  * Used by the driver to indicate which info in &struct station_info
8332ec600d6SLuis Carlos Cobo  * it has filled in during get_station() or dump_station().
834fd5b74dcSJohannes Berg  *
8352ec600d6SLuis Carlos Cobo  * @STATION_INFO_INACTIVE_TIME: @inactive_time filled
8362ec600d6SLuis Carlos Cobo  * @STATION_INFO_RX_BYTES: @rx_bytes filled
8372ec600d6SLuis Carlos Cobo  * @STATION_INFO_TX_BYTES: @tx_bytes filled
838077f897aSJohannes Berg  * @STATION_INFO_RX_BYTES64: @rx_bytes filled with 64-bit value
839077f897aSJohannes Berg  * @STATION_INFO_TX_BYTES64: @tx_bytes filled with 64-bit value
8402ec600d6SLuis Carlos Cobo  * @STATION_INFO_LLID: @llid filled
8412ec600d6SLuis Carlos Cobo  * @STATION_INFO_PLID: @plid filled
8422ec600d6SLuis Carlos Cobo  * @STATION_INFO_PLINK_STATE: @plink_state filled
843420e7fabSHenning Rogge  * @STATION_INFO_SIGNAL: @signal filled
844c8dcfd8aSFelix Fietkau  * @STATION_INFO_TX_BITRATE: @txrate fields are filled
845420e7fabSHenning Rogge  *	(tx_bitrate, tx_bitrate_flags and tx_bitrate_mcs)
84642745e03SVladimir Kondratiev  * @STATION_INFO_RX_PACKETS: @rx_packets filled with 32-bit value
84742745e03SVladimir Kondratiev  * @STATION_INFO_TX_PACKETS: @tx_packets filled with 32-bit value
848b206b4efSBruno Randolf  * @STATION_INFO_TX_RETRIES: @tx_retries filled
849b206b4efSBruno Randolf  * @STATION_INFO_TX_FAILED: @tx_failed filled
8505a5c731aSBen Greear  * @STATION_INFO_RX_DROP_MISC: @rx_dropped_misc filled
851541a45a1SBruno Randolf  * @STATION_INFO_SIGNAL_AVG: @signal_avg filled
852c8dcfd8aSFelix Fietkau  * @STATION_INFO_RX_BITRATE: @rxrate fields are filled
853f4263c98SPaul Stewart  * @STATION_INFO_BSS_PARAM: @bss_param filled
854ebe27c91SMohammed Shafi Shajakhan  * @STATION_INFO_CONNECTED_TIME: @connected_time filled
855040bdf71SFelix Fietkau  * @STATION_INFO_ASSOC_REQ_IES: @assoc_req_ies filled
856bb6e753eSHelmut Schaa  * @STATION_INFO_STA_FLAGS: @sta_flags filled
857a85e1d55SPaul Stewart  * @STATION_INFO_BEACON_LOSS_COUNT: @beacon_loss_count filled
858d299a1f2SJavier Cardona  * @STATION_INFO_T_OFFSET: @t_offset filled
8593b1c5a53SMarco Porsch  * @STATION_INFO_LOCAL_PM: @local_pm filled
8603b1c5a53SMarco Porsch  * @STATION_INFO_PEER_PM: @peer_pm filled
8613b1c5a53SMarco Porsch  * @STATION_INFO_NONPEER_PM: @nonpeer_pm filled
862119363c7SFelix Fietkau  * @STATION_INFO_CHAIN_SIGNAL: @chain_signal filled
863119363c7SFelix Fietkau  * @STATION_INFO_CHAIN_SIGNAL_AVG: @chain_signal_avg filled
864fd5b74dcSJohannes Berg  */
8652ec600d6SLuis Carlos Cobo enum station_info_flags {
8662ec600d6SLuis Carlos Cobo 	STATION_INFO_INACTIVE_TIME	= 1<<0,
8672ec600d6SLuis Carlos Cobo 	STATION_INFO_RX_BYTES		= 1<<1,
8682ec600d6SLuis Carlos Cobo 	STATION_INFO_TX_BYTES		= 1<<2,
8692ec600d6SLuis Carlos Cobo 	STATION_INFO_LLID		= 1<<3,
8702ec600d6SLuis Carlos Cobo 	STATION_INFO_PLID		= 1<<4,
8712ec600d6SLuis Carlos Cobo 	STATION_INFO_PLINK_STATE	= 1<<5,
872420e7fabSHenning Rogge 	STATION_INFO_SIGNAL		= 1<<6,
873420e7fabSHenning Rogge 	STATION_INFO_TX_BITRATE		= 1<<7,
87498c8a60aSJouni Malinen 	STATION_INFO_RX_PACKETS		= 1<<8,
87598c8a60aSJouni Malinen 	STATION_INFO_TX_PACKETS		= 1<<9,
876b206b4efSBruno Randolf 	STATION_INFO_TX_RETRIES		= 1<<10,
877b206b4efSBruno Randolf 	STATION_INFO_TX_FAILED		= 1<<11,
8785a5c731aSBen Greear 	STATION_INFO_RX_DROP_MISC	= 1<<12,
879541a45a1SBruno Randolf 	STATION_INFO_SIGNAL_AVG		= 1<<13,
880c8dcfd8aSFelix Fietkau 	STATION_INFO_RX_BITRATE		= 1<<14,
881f4263c98SPaul Stewart 	STATION_INFO_BSS_PARAM          = 1<<15,
882040bdf71SFelix Fietkau 	STATION_INFO_CONNECTED_TIME	= 1<<16,
883bb6e753eSHelmut Schaa 	STATION_INFO_ASSOC_REQ_IES	= 1<<17,
884a85e1d55SPaul Stewart 	STATION_INFO_STA_FLAGS		= 1<<18,
885d299a1f2SJavier Cardona 	STATION_INFO_BEACON_LOSS_COUNT	= 1<<19,
886d299a1f2SJavier Cardona 	STATION_INFO_T_OFFSET		= 1<<20,
8873b1c5a53SMarco Porsch 	STATION_INFO_LOCAL_PM		= 1<<21,
8883b1c5a53SMarco Porsch 	STATION_INFO_PEER_PM		= 1<<22,
8893b1c5a53SMarco Porsch 	STATION_INFO_NONPEER_PM		= 1<<23,
89042745e03SVladimir Kondratiev 	STATION_INFO_RX_BYTES64		= 1<<24,
89142745e03SVladimir Kondratiev 	STATION_INFO_TX_BYTES64		= 1<<25,
892119363c7SFelix Fietkau 	STATION_INFO_CHAIN_SIGNAL	= 1<<26,
893119363c7SFelix Fietkau 	STATION_INFO_CHAIN_SIGNAL_AVG	= 1<<27,
894420e7fabSHenning Rogge };
895420e7fabSHenning Rogge 
896420e7fabSHenning Rogge /**
897420e7fabSHenning Rogge  * enum station_info_rate_flags - bitrate info flags
898420e7fabSHenning Rogge  *
899420e7fabSHenning Rogge  * Used by the driver to indicate the specific rate transmission
900420e7fabSHenning Rogge  * type for 802.11n transmissions.
901420e7fabSHenning Rogge  *
902db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_MCS: mcs field filled with HT MCS
903db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_VHT_MCS: mcs field filled with VHT MCS
904db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_40_MHZ_WIDTH: 40 MHz width transmission
905db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_80_MHZ_WIDTH: 80 MHz width transmission
906db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_80P80_MHZ_WIDTH: 80+80 MHz width transmission
907db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_160_MHZ_WIDTH: 160 MHz width transmission
908420e7fabSHenning Rogge  * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval
909db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_60G: 60GHz MCS
910420e7fabSHenning Rogge  */
911420e7fabSHenning Rogge enum rate_info_flags {
912db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_MCS			= BIT(0),
913db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_VHT_MCS			= BIT(1),
914db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_40_MHZ_WIDTH		= BIT(2),
915db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_80_MHZ_WIDTH		= BIT(3),
916db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_80P80_MHZ_WIDTH		= BIT(4),
917db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_160_MHZ_WIDTH		= BIT(5),
918db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_SHORT_GI		= BIT(6),
919db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_60G			= BIT(7),
920420e7fabSHenning Rogge };
921420e7fabSHenning Rogge 
922420e7fabSHenning Rogge /**
923420e7fabSHenning Rogge  * struct rate_info - bitrate information
924420e7fabSHenning Rogge  *
925420e7fabSHenning Rogge  * Information about a receiving or transmitting bitrate
926420e7fabSHenning Rogge  *
927420e7fabSHenning Rogge  * @flags: bitflag of flags from &enum rate_info_flags
928420e7fabSHenning Rogge  * @mcs: mcs index if struct describes a 802.11n bitrate
929420e7fabSHenning Rogge  * @legacy: bitrate in 100kbit/s for 802.11abg
930db9c64cfSJohannes Berg  * @nss: number of streams (VHT only)
931420e7fabSHenning Rogge  */
932420e7fabSHenning Rogge struct rate_info {
933420e7fabSHenning Rogge 	u8 flags;
934420e7fabSHenning Rogge 	u8 mcs;
935420e7fabSHenning Rogge 	u16 legacy;
936db9c64cfSJohannes Berg 	u8 nss;
937fd5b74dcSJohannes Berg };
938fd5b74dcSJohannes Berg 
939fd5b74dcSJohannes Berg /**
940f4263c98SPaul Stewart  * enum station_info_rate_flags - bitrate info flags
941f4263c98SPaul Stewart  *
942f4263c98SPaul Stewart  * Used by the driver to indicate the specific rate transmission
943f4263c98SPaul Stewart  * type for 802.11n transmissions.
944f4263c98SPaul Stewart  *
945f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_CTS_PROT: whether CTS protection is enabled
946f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_SHORT_PREAMBLE: whether short preamble is enabled
947f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_SHORT_SLOT_TIME: whether short slot time is enabled
948f4263c98SPaul Stewart  */
949f4263c98SPaul Stewart enum bss_param_flags {
950f4263c98SPaul Stewart 	BSS_PARAM_FLAGS_CTS_PROT	= 1<<0,
951f4263c98SPaul Stewart 	BSS_PARAM_FLAGS_SHORT_PREAMBLE	= 1<<1,
952f4263c98SPaul Stewart 	BSS_PARAM_FLAGS_SHORT_SLOT_TIME	= 1<<2,
953f4263c98SPaul Stewart };
954f4263c98SPaul Stewart 
955f4263c98SPaul Stewart /**
956f4263c98SPaul Stewart  * struct sta_bss_parameters - BSS parameters for the attached station
957f4263c98SPaul Stewart  *
958f4263c98SPaul Stewart  * Information about the currently associated BSS
959f4263c98SPaul Stewart  *
960f4263c98SPaul Stewart  * @flags: bitflag of flags from &enum bss_param_flags
961f4263c98SPaul Stewart  * @dtim_period: DTIM period for the BSS
962f4263c98SPaul Stewart  * @beacon_interval: beacon interval
963f4263c98SPaul Stewart  */
964f4263c98SPaul Stewart struct sta_bss_parameters {
965f4263c98SPaul Stewart 	u8 flags;
966f4263c98SPaul Stewart 	u8 dtim_period;
967f4263c98SPaul Stewart 	u16 beacon_interval;
968f4263c98SPaul Stewart };
969f4263c98SPaul Stewart 
970119363c7SFelix Fietkau #define IEEE80211_MAX_CHAINS	4
971119363c7SFelix Fietkau 
972f4263c98SPaul Stewart /**
9732ec600d6SLuis Carlos Cobo  * struct station_info - station information
974fd5b74dcSJohannes Berg  *
9752ec600d6SLuis Carlos Cobo  * Station information filled by driver for get_station() and dump_station.
976fd5b74dcSJohannes Berg  *
9772ec600d6SLuis Carlos Cobo  * @filled: bitflag of flags from &enum station_info_flags
978ebe27c91SMohammed Shafi Shajakhan  * @connected_time: time(in secs) since a station is last connected
979fd5b74dcSJohannes Berg  * @inactive_time: time since last station activity (tx/rx) in milliseconds
980fd5b74dcSJohannes Berg  * @rx_bytes: bytes received from this station
981fd5b74dcSJohannes Berg  * @tx_bytes: bytes transmitted to this station
9822ec600d6SLuis Carlos Cobo  * @llid: mesh local link id
9832ec600d6SLuis Carlos Cobo  * @plid: mesh peer link id
9842ec600d6SLuis Carlos Cobo  * @plink_state: mesh peer link state
98573c3df3bSJohannes Berg  * @signal: The signal strength, type depends on the wiphy's signal_type.
98673c3df3bSJohannes Berg  *	For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
98773c3df3bSJohannes Berg  * @signal_avg: Average signal strength, type depends on the wiphy's signal_type.
98873c3df3bSJohannes Berg  *	For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
989119363c7SFelix Fietkau  * @chains: bitmask for filled values in @chain_signal, @chain_signal_avg
990119363c7SFelix Fietkau  * @chain_signal: per-chain signal strength of last received packet in dBm
991119363c7SFelix Fietkau  * @chain_signal_avg: per-chain signal strength average in dBm
992858022aaSRandy Dunlap  * @txrate: current unicast bitrate from this station
993858022aaSRandy Dunlap  * @rxrate: current unicast bitrate to this station
99498c8a60aSJouni Malinen  * @rx_packets: packets received from this station
99598c8a60aSJouni Malinen  * @tx_packets: packets transmitted to this station
996b206b4efSBruno Randolf  * @tx_retries: cumulative retry counts
997b206b4efSBruno Randolf  * @tx_failed: number of failed transmissions (retries exceeded, no ACK)
9985a5c731aSBen Greear  * @rx_dropped_misc:  Dropped for un-specified reason.
9991ba01458SRandy Dunlap  * @bss_param: current BSS parameters
1000f5ea9120SJohannes Berg  * @generation: generation number for nl80211 dumps.
1001f5ea9120SJohannes Berg  *	This number should increase every time the list of stations
1002f5ea9120SJohannes Berg  *	changes, i.e. when a station is added or removed, so that
1003f5ea9120SJohannes Berg  *	userspace can tell whether it got a consistent snapshot.
100450d3dfb7SJouni Malinen  * @assoc_req_ies: IEs from (Re)Association Request.
100550d3dfb7SJouni Malinen  *	This is used only when in AP mode with drivers that do not use
100650d3dfb7SJouni Malinen  *	user space MLME/SME implementation. The information is provided for
100750d3dfb7SJouni Malinen  *	the cfg80211_new_sta() calls to notify user space of the IEs.
100850d3dfb7SJouni Malinen  * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets.
1009c26887d2SJohannes Berg  * @sta_flags: station flags mask & values
1010a85e1d55SPaul Stewart  * @beacon_loss_count: Number of times beacon loss event has triggered.
1011d299a1f2SJavier Cardona  * @t_offset: Time offset of the station relative to this host.
10123b1c5a53SMarco Porsch  * @local_pm: local mesh STA power save mode
10133b1c5a53SMarco Porsch  * @peer_pm: peer mesh STA power save mode
10143b1c5a53SMarco Porsch  * @nonpeer_pm: non-peer mesh STA power save mode
1015fd5b74dcSJohannes Berg  */
10162ec600d6SLuis Carlos Cobo struct station_info {
1017fd5b74dcSJohannes Berg 	u32 filled;
1018ebe27c91SMohammed Shafi Shajakhan 	u32 connected_time;
1019fd5b74dcSJohannes Berg 	u32 inactive_time;
102042745e03SVladimir Kondratiev 	u64 rx_bytes;
102142745e03SVladimir Kondratiev 	u64 tx_bytes;
10222ec600d6SLuis Carlos Cobo 	u16 llid;
10232ec600d6SLuis Carlos Cobo 	u16 plid;
10242ec600d6SLuis Carlos Cobo 	u8 plink_state;
1025420e7fabSHenning Rogge 	s8 signal;
1026541a45a1SBruno Randolf 	s8 signal_avg;
1027119363c7SFelix Fietkau 
1028119363c7SFelix Fietkau 	u8 chains;
1029119363c7SFelix Fietkau 	s8 chain_signal[IEEE80211_MAX_CHAINS];
1030119363c7SFelix Fietkau 	s8 chain_signal_avg[IEEE80211_MAX_CHAINS];
1031119363c7SFelix Fietkau 
1032420e7fabSHenning Rogge 	struct rate_info txrate;
1033c8dcfd8aSFelix Fietkau 	struct rate_info rxrate;
103498c8a60aSJouni Malinen 	u32 rx_packets;
103598c8a60aSJouni Malinen 	u32 tx_packets;
1036b206b4efSBruno Randolf 	u32 tx_retries;
1037b206b4efSBruno Randolf 	u32 tx_failed;
10385a5c731aSBen Greear 	u32 rx_dropped_misc;
1039f4263c98SPaul Stewart 	struct sta_bss_parameters bss_param;
1040bb6e753eSHelmut Schaa 	struct nl80211_sta_flag_update sta_flags;
1041f5ea9120SJohannes Berg 
1042f5ea9120SJohannes Berg 	int generation;
104350d3dfb7SJouni Malinen 
104450d3dfb7SJouni Malinen 	const u8 *assoc_req_ies;
104550d3dfb7SJouni Malinen 	size_t assoc_req_ies_len;
1046f612cedfSJouni Malinen 
1047a85e1d55SPaul Stewart 	u32 beacon_loss_count;
1048d299a1f2SJavier Cardona 	s64 t_offset;
10493b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode local_pm;
10503b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode peer_pm;
10513b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode nonpeer_pm;
1052a85e1d55SPaul Stewart 
1053f612cedfSJouni Malinen 	/*
1054f612cedfSJouni Malinen 	 * Note: Add a new enum station_info_flags value for each new field and
1055f612cedfSJouni Malinen 	 * use it to check which fields are initialized.
1056f612cedfSJouni Malinen 	 */
1057fd5b74dcSJohannes Berg };
1058fd5b74dcSJohannes Berg 
105966f7ac50SMichael Wu /**
106066f7ac50SMichael Wu  * enum monitor_flags - monitor flags
106166f7ac50SMichael Wu  *
106266f7ac50SMichael Wu  * Monitor interface configuration flags. Note that these must be the bits
106366f7ac50SMichael Wu  * according to the nl80211 flags.
106466f7ac50SMichael Wu  *
106566f7ac50SMichael Wu  * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS
106666f7ac50SMichael Wu  * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP
106766f7ac50SMichael Wu  * @MONITOR_FLAG_CONTROL: pass control frames
106866f7ac50SMichael Wu  * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering
106966f7ac50SMichael Wu  * @MONITOR_FLAG_COOK_FRAMES: report frames after processing
1070e057d3c3SFelix Fietkau  * @MONITOR_FLAG_ACTIVE: active monitor, ACKs frames on its MAC address
107166f7ac50SMichael Wu  */
107266f7ac50SMichael Wu enum monitor_flags {
107366f7ac50SMichael Wu 	MONITOR_FLAG_FCSFAIL		= 1<<NL80211_MNTR_FLAG_FCSFAIL,
107466f7ac50SMichael Wu 	MONITOR_FLAG_PLCPFAIL		= 1<<NL80211_MNTR_FLAG_PLCPFAIL,
107566f7ac50SMichael Wu 	MONITOR_FLAG_CONTROL		= 1<<NL80211_MNTR_FLAG_CONTROL,
107666f7ac50SMichael Wu 	MONITOR_FLAG_OTHER_BSS		= 1<<NL80211_MNTR_FLAG_OTHER_BSS,
107766f7ac50SMichael Wu 	MONITOR_FLAG_COOK_FRAMES	= 1<<NL80211_MNTR_FLAG_COOK_FRAMES,
1078e057d3c3SFelix Fietkau 	MONITOR_FLAG_ACTIVE		= 1<<NL80211_MNTR_FLAG_ACTIVE,
107966f7ac50SMichael Wu };
108066f7ac50SMichael Wu 
10812ec600d6SLuis Carlos Cobo /**
10822ec600d6SLuis Carlos Cobo  * enum mpath_info_flags -  mesh path information flags
10832ec600d6SLuis Carlos Cobo  *
10842ec600d6SLuis Carlos Cobo  * Used by the driver to indicate which info in &struct mpath_info it has filled
10852ec600d6SLuis Carlos Cobo  * in during get_station() or dump_station().
10862ec600d6SLuis Carlos Cobo  *
1087abe37c4bSJohannes Berg  * @MPATH_INFO_FRAME_QLEN: @frame_qlen filled
1088abe37c4bSJohannes Berg  * @MPATH_INFO_SN: @sn filled
1089abe37c4bSJohannes Berg  * @MPATH_INFO_METRIC: @metric filled
1090abe37c4bSJohannes Berg  * @MPATH_INFO_EXPTIME: @exptime filled
1091abe37c4bSJohannes Berg  * @MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled
1092abe37c4bSJohannes Berg  * @MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled
1093abe37c4bSJohannes Berg  * @MPATH_INFO_FLAGS: @flags filled
10942ec600d6SLuis Carlos Cobo  */
10952ec600d6SLuis Carlos Cobo enum mpath_info_flags {
10962ec600d6SLuis Carlos Cobo 	MPATH_INFO_FRAME_QLEN		= BIT(0),
1097d19b3bf6SRui Paulo 	MPATH_INFO_SN			= BIT(1),
10982ec600d6SLuis Carlos Cobo 	MPATH_INFO_METRIC		= BIT(2),
10992ec600d6SLuis Carlos Cobo 	MPATH_INFO_EXPTIME		= BIT(3),
11002ec600d6SLuis Carlos Cobo 	MPATH_INFO_DISCOVERY_TIMEOUT	= BIT(4),
11012ec600d6SLuis Carlos Cobo 	MPATH_INFO_DISCOVERY_RETRIES	= BIT(5),
11022ec600d6SLuis Carlos Cobo 	MPATH_INFO_FLAGS		= BIT(6),
11032ec600d6SLuis Carlos Cobo };
11042ec600d6SLuis Carlos Cobo 
11052ec600d6SLuis Carlos Cobo /**
11062ec600d6SLuis Carlos Cobo  * struct mpath_info - mesh path information
11072ec600d6SLuis Carlos Cobo  *
11082ec600d6SLuis Carlos Cobo  * Mesh path information filled by driver for get_mpath() and dump_mpath().
11092ec600d6SLuis Carlos Cobo  *
11102ec600d6SLuis Carlos Cobo  * @filled: bitfield of flags from &enum mpath_info_flags
11112ec600d6SLuis Carlos Cobo  * @frame_qlen: number of queued frames for this destination
1112d19b3bf6SRui Paulo  * @sn: target sequence number
11132ec600d6SLuis Carlos Cobo  * @metric: metric (cost) of this mesh path
11142ec600d6SLuis Carlos Cobo  * @exptime: expiration time for the mesh path from now, in msecs
11152ec600d6SLuis Carlos Cobo  * @flags: mesh path flags
11162ec600d6SLuis Carlos Cobo  * @discovery_timeout: total mesh path discovery timeout, in msecs
11172ec600d6SLuis Carlos Cobo  * @discovery_retries: mesh path discovery retries
1118f5ea9120SJohannes Berg  * @generation: generation number for nl80211 dumps.
1119f5ea9120SJohannes Berg  *	This number should increase every time the list of mesh paths
1120f5ea9120SJohannes Berg  *	changes, i.e. when a station is added or removed, so that
1121f5ea9120SJohannes Berg  *	userspace can tell whether it got a consistent snapshot.
11222ec600d6SLuis Carlos Cobo  */
11232ec600d6SLuis Carlos Cobo struct mpath_info {
11242ec600d6SLuis Carlos Cobo 	u32 filled;
11252ec600d6SLuis Carlos Cobo 	u32 frame_qlen;
1126d19b3bf6SRui Paulo 	u32 sn;
11272ec600d6SLuis Carlos Cobo 	u32 metric;
11282ec600d6SLuis Carlos Cobo 	u32 exptime;
11292ec600d6SLuis Carlos Cobo 	u32 discovery_timeout;
11302ec600d6SLuis Carlos Cobo 	u8 discovery_retries;
11312ec600d6SLuis Carlos Cobo 	u8 flags;
1132f5ea9120SJohannes Berg 
1133f5ea9120SJohannes Berg 	int generation;
11342ec600d6SLuis Carlos Cobo };
11352ec600d6SLuis Carlos Cobo 
11369f1ba906SJouni Malinen /**
11379f1ba906SJouni Malinen  * struct bss_parameters - BSS parameters
11389f1ba906SJouni Malinen  *
11399f1ba906SJouni Malinen  * Used to change BSS parameters (mainly for AP mode).
11409f1ba906SJouni Malinen  *
11419f1ba906SJouni Malinen  * @use_cts_prot: Whether to use CTS protection
11429f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
11439f1ba906SJouni Malinen  * @use_short_preamble: Whether the use of short preambles is allowed
11449f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
11459f1ba906SJouni Malinen  * @use_short_slot_time: Whether the use of short slot time is allowed
11469f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
114790c97a04SJouni Malinen  * @basic_rates: basic rates in IEEE 802.11 format
114890c97a04SJouni Malinen  *	(or NULL for no change)
114990c97a04SJouni Malinen  * @basic_rates_len: number of basic rates
1150fd8aaaf3SFelix Fietkau  * @ap_isolate: do not forward packets between connected stations
115150b12f59SHelmut Schaa  * @ht_opmode: HT Operation mode
115250b12f59SHelmut Schaa  * 	(u16 = opmode, -1 = do not change)
115353cabad7SJohannes Berg  * @p2p_ctwindow: P2P CT Window (-1 = no change)
115453cabad7SJohannes Berg  * @p2p_opp_ps: P2P opportunistic PS (-1 = no change)
11559f1ba906SJouni Malinen  */
11569f1ba906SJouni Malinen struct bss_parameters {
11579f1ba906SJouni Malinen 	int use_cts_prot;
11589f1ba906SJouni Malinen 	int use_short_preamble;
11599f1ba906SJouni Malinen 	int use_short_slot_time;
116090c97a04SJouni Malinen 	u8 *basic_rates;
116190c97a04SJouni Malinen 	u8 basic_rates_len;
1162fd8aaaf3SFelix Fietkau 	int ap_isolate;
116350b12f59SHelmut Schaa 	int ht_opmode;
116453cabad7SJohannes Berg 	s8 p2p_ctwindow, p2p_opp_ps;
11659f1ba906SJouni Malinen };
11662ec600d6SLuis Carlos Cobo 
11673ddd53f3SChun-Yeow Yeoh /**
116829cbe68cSJohannes Berg  * struct mesh_config - 802.11s mesh configuration
116929cbe68cSJohannes Berg  *
117029cbe68cSJohannes Berg  * These parameters can be changed while the mesh is active.
11713ddd53f3SChun-Yeow Yeoh  *
11723ddd53f3SChun-Yeow Yeoh  * @dot11MeshRetryTimeout: the initial retry timeout in millisecond units used
11733ddd53f3SChun-Yeow Yeoh  *	by the Mesh Peering Open message
11743ddd53f3SChun-Yeow Yeoh  * @dot11MeshConfirmTimeout: the initial retry timeout in millisecond units
11753ddd53f3SChun-Yeow Yeoh  *	used by the Mesh Peering Open message
11763ddd53f3SChun-Yeow Yeoh  * @dot11MeshHoldingTimeout: the confirm timeout in millisecond units used by
11773ddd53f3SChun-Yeow Yeoh  *	the mesh peering management to close a mesh peering
11783ddd53f3SChun-Yeow Yeoh  * @dot11MeshMaxPeerLinks: the maximum number of peer links allowed on this
11793ddd53f3SChun-Yeow Yeoh  *	mesh interface
11803ddd53f3SChun-Yeow Yeoh  * @dot11MeshMaxRetries: the maximum number of peer link open retries that can
11813ddd53f3SChun-Yeow Yeoh  *	be sent to establish a new peer link instance in a mesh
11823ddd53f3SChun-Yeow Yeoh  * @dot11MeshTTL: the value of TTL field set at a source mesh STA
11833ddd53f3SChun-Yeow Yeoh  * @element_ttl: the value of TTL field set at a mesh STA for path selection
11843ddd53f3SChun-Yeow Yeoh  *	elements
11853ddd53f3SChun-Yeow Yeoh  * @auto_open_plinks: whether we should automatically open peer links when we
11863ddd53f3SChun-Yeow Yeoh  *	detect compatible mesh peers
11873ddd53f3SChun-Yeow Yeoh  * @dot11MeshNbrOffsetMaxNeighbor: the maximum number of neighbors to
11883ddd53f3SChun-Yeow Yeoh  *	synchronize to for 11s default synchronization method
11893ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPmaxPREQretries: the number of action frames containing a PREQ
11903ddd53f3SChun-Yeow Yeoh  *	that an originator mesh STA can send to a particular path target
11913ddd53f3SChun-Yeow Yeoh  * @path_refresh_time: how frequently to refresh mesh paths in milliseconds
11923ddd53f3SChun-Yeow Yeoh  * @min_discovery_timeout: the minimum length of time to wait until giving up on
11933ddd53f3SChun-Yeow Yeoh  *	a path discovery in milliseconds
11943ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPactivePathTimeout: the time (in TUs) for which mesh STAs
11953ddd53f3SChun-Yeow Yeoh  *	receiving a PREQ shall consider the forwarding information from the
11963ddd53f3SChun-Yeow Yeoh  *	root to be valid. (TU = time unit)
11973ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPpreqMinInterval: the minimum interval of time (in TUs) during
11983ddd53f3SChun-Yeow Yeoh  *	which a mesh STA can send only one action frame containing a PREQ
11993ddd53f3SChun-Yeow Yeoh  *	element
12003ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPperrMinInterval: the minimum interval of time (in TUs) during
12013ddd53f3SChun-Yeow Yeoh  *	which a mesh STA can send only one Action frame containing a PERR
12023ddd53f3SChun-Yeow Yeoh  *	element
12033ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPnetDiameterTraversalTime: the interval of time (in TUs) that
12043ddd53f3SChun-Yeow Yeoh  *	it takes for an HWMP information element to propagate across the mesh
12053ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPRootMode: the configuration of a mesh STA as root mesh STA
12063ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPRannInterval: the interval of time (in TUs) between root
12073ddd53f3SChun-Yeow Yeoh  *	announcements are transmitted
12083ddd53f3SChun-Yeow Yeoh  * @dot11MeshGateAnnouncementProtocol: whether to advertise that this mesh
12093ddd53f3SChun-Yeow Yeoh  *	station has access to a broader network beyond the MBSS. (This is
12103ddd53f3SChun-Yeow Yeoh  *	missnamed in draft 12.0: dot11MeshGateAnnouncementProtocol set to true
12113ddd53f3SChun-Yeow Yeoh  *	only means that the station will announce others it's a mesh gate, but
12123ddd53f3SChun-Yeow Yeoh  *	not necessarily using the gate announcement protocol. Still keeping the
12133ddd53f3SChun-Yeow Yeoh  *	same nomenclature to be in sync with the spec)
12143ddd53f3SChun-Yeow Yeoh  * @dot11MeshForwarding: whether the Mesh STA is forwarding or non-forwarding
12153ddd53f3SChun-Yeow Yeoh  *	entity (default is TRUE - forwarding entity)
12163ddd53f3SChun-Yeow Yeoh  * @rssi_threshold: the threshold for average signal strength of candidate
12173ddd53f3SChun-Yeow Yeoh  *	station to establish a peer link
12183ddd53f3SChun-Yeow Yeoh  * @ht_opmode: mesh HT protection mode
1219ac1073a6SChun-Yeow Yeoh  *
1220ac1073a6SChun-Yeow Yeoh  * @dot11MeshHWMPactivePathToRootTimeout: The time (in TUs) for which mesh STAs
1221ac1073a6SChun-Yeow Yeoh  *	receiving a proactive PREQ shall consider the forwarding information to
1222ac1073a6SChun-Yeow Yeoh  *	the root mesh STA to be valid.
1223ac1073a6SChun-Yeow Yeoh  *
1224ac1073a6SChun-Yeow Yeoh  * @dot11MeshHWMProotInterval: The interval of time (in TUs) between proactive
1225ac1073a6SChun-Yeow Yeoh  *	PREQs are transmitted.
1226728b19e5SChun-Yeow Yeoh  * @dot11MeshHWMPconfirmationInterval: The minimum interval of time (in TUs)
1227728b19e5SChun-Yeow Yeoh  *	during which a mesh STA can send only one Action frame containing
1228728b19e5SChun-Yeow Yeoh  *	a PREQ element for root path confirmation.
12293b1c5a53SMarco Porsch  * @power_mode: The default mesh power save mode which will be the initial
12303b1c5a53SMarco Porsch  *	setting for new peer links.
12313b1c5a53SMarco Porsch  * @dot11MeshAwakeWindowDuration: The duration in TUs the STA will remain awake
12323b1c5a53SMarco Porsch  *	after transmitting its beacon.
12338e7c0538SColleen Twitty  * @plink_timeout: If no tx activity is seen from a STA we've established
12348e7c0538SColleen Twitty  *	peering with for longer than this time (in seconds), then remove it
12358e7c0538SColleen Twitty  *	from the STA's list of peers.  Default is 30 minutes.
123629cbe68cSJohannes Berg  */
123793da9cc1Scolin@cozybit.com struct mesh_config {
123893da9cc1Scolin@cozybit.com 	u16 dot11MeshRetryTimeout;
123993da9cc1Scolin@cozybit.com 	u16 dot11MeshConfirmTimeout;
124093da9cc1Scolin@cozybit.com 	u16 dot11MeshHoldingTimeout;
124193da9cc1Scolin@cozybit.com 	u16 dot11MeshMaxPeerLinks;
124293da9cc1Scolin@cozybit.com 	u8 dot11MeshMaxRetries;
124393da9cc1Scolin@cozybit.com 	u8 dot11MeshTTL;
124445904f21SJavier Cardona 	u8 element_ttl;
124593da9cc1Scolin@cozybit.com 	bool auto_open_plinks;
1246d299a1f2SJavier Cardona 	u32 dot11MeshNbrOffsetMaxNeighbor;
124793da9cc1Scolin@cozybit.com 	u8 dot11MeshHWMPmaxPREQretries;
124893da9cc1Scolin@cozybit.com 	u32 path_refresh_time;
124993da9cc1Scolin@cozybit.com 	u16 min_discovery_timeout;
125093da9cc1Scolin@cozybit.com 	u32 dot11MeshHWMPactivePathTimeout;
125193da9cc1Scolin@cozybit.com 	u16 dot11MeshHWMPpreqMinInterval;
1252dca7e943SThomas Pedersen 	u16 dot11MeshHWMPperrMinInterval;
125393da9cc1Scolin@cozybit.com 	u16 dot11MeshHWMPnetDiameterTraversalTime;
125463c5723bSRui Paulo 	u8 dot11MeshHWMPRootMode;
12550507e159SJavier Cardona 	u16 dot11MeshHWMPRannInterval;
125616dd7267SJavier Cardona 	bool dot11MeshGateAnnouncementProtocol;
125794f90656SChun-Yeow Yeoh 	bool dot11MeshForwarding;
125855335137SAshok Nagarajan 	s32 rssi_threshold;
125970c33eaaSAshok Nagarajan 	u16 ht_opmode;
1260ac1073a6SChun-Yeow Yeoh 	u32 dot11MeshHWMPactivePathToRootTimeout;
1261ac1073a6SChun-Yeow Yeoh 	u16 dot11MeshHWMProotInterval;
1262728b19e5SChun-Yeow Yeoh 	u16 dot11MeshHWMPconfirmationInterval;
12633b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode power_mode;
12643b1c5a53SMarco Porsch 	u16 dot11MeshAwakeWindowDuration;
12658e7c0538SColleen Twitty 	u32 plink_timeout;
126693da9cc1Scolin@cozybit.com };
126793da9cc1Scolin@cozybit.com 
126831888487SJouni Malinen /**
126929cbe68cSJohannes Berg  * struct mesh_setup - 802.11s mesh setup configuration
1270683b6d3bSJohannes Berg  * @chandef: defines the channel to use
127129cbe68cSJohannes Berg  * @mesh_id: the mesh ID
127229cbe68cSJohannes Berg  * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes
1273d299a1f2SJavier Cardona  * @sync_method: which synchronization method to use
1274c80d545dSJavier Cardona  * @path_sel_proto: which path selection protocol to use
1275c80d545dSJavier Cardona  * @path_metric: which metric to use
12766e16d90bSColleen Twitty  * @auth_id: which authentication method this mesh is using
1277581a8b0fSJavier Cardona  * @ie: vendor information elements (optional)
1278581a8b0fSJavier Cardona  * @ie_len: length of vendor information elements
1279b130e5ceSJavier Cardona  * @is_authenticated: this mesh requires authentication
1280b130e5ceSJavier Cardona  * @is_secure: this mesh uses security
1281bb2798d4SThomas Pedersen  * @user_mpm: userspace handles all MPM functions
12829bdbf04dSMarco Porsch  * @dtim_period: DTIM period to use
12839bdbf04dSMarco Porsch  * @beacon_interval: beacon interval to use
12844bb62344SChun-Yeow Yeoh  * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a]
1285ffb3cf30SAshok Nagarajan  * @basic_rates: basic rates to use when creating the mesh
128629cbe68cSJohannes Berg  *
128729cbe68cSJohannes Berg  * These parameters are fixed when the mesh is created.
128829cbe68cSJohannes Berg  */
128929cbe68cSJohannes Berg struct mesh_setup {
1290683b6d3bSJohannes Berg 	struct cfg80211_chan_def chandef;
129129cbe68cSJohannes Berg 	const u8 *mesh_id;
129229cbe68cSJohannes Berg 	u8 mesh_id_len;
1293d299a1f2SJavier Cardona 	u8 sync_method;
1294c80d545dSJavier Cardona 	u8 path_sel_proto;
1295c80d545dSJavier Cardona 	u8 path_metric;
12966e16d90bSColleen Twitty 	u8 auth_id;
1297581a8b0fSJavier Cardona 	const u8 *ie;
1298581a8b0fSJavier Cardona 	u8 ie_len;
1299b130e5ceSJavier Cardona 	bool is_authenticated;
130015d5dda6SJavier Cardona 	bool is_secure;
1301bb2798d4SThomas Pedersen 	bool user_mpm;
13029bdbf04dSMarco Porsch 	u8 dtim_period;
13039bdbf04dSMarco Porsch 	u16 beacon_interval;
13044bb62344SChun-Yeow Yeoh 	int mcast_rate[IEEE80211_NUM_BANDS];
1305ffb3cf30SAshok Nagarajan 	u32 basic_rates;
130629cbe68cSJohannes Berg };
130729cbe68cSJohannes Berg 
130829cbe68cSJohannes Berg /**
130931888487SJouni Malinen  * struct ieee80211_txq_params - TX queue parameters
1310a3304b0aSJohannes Berg  * @ac: AC identifier
131131888487SJouni Malinen  * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled
131231888487SJouni Malinen  * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range
131331888487SJouni Malinen  *	1..32767]
131431888487SJouni Malinen  * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range
131531888487SJouni Malinen  *	1..32767]
131631888487SJouni Malinen  * @aifs: Arbitration interframe space [0..255]
131731888487SJouni Malinen  */
131831888487SJouni Malinen struct ieee80211_txq_params {
1319a3304b0aSJohannes Berg 	enum nl80211_ac ac;
132031888487SJouni Malinen 	u16 txop;
132131888487SJouni Malinen 	u16 cwmin;
132231888487SJouni Malinen 	u16 cwmax;
132331888487SJouni Malinen 	u8 aifs;
132431888487SJouni Malinen };
132531888487SJouni Malinen 
1326d70e9693SJohannes Berg /**
1327d70e9693SJohannes Berg  * DOC: Scanning and BSS list handling
1328d70e9693SJohannes Berg  *
1329d70e9693SJohannes Berg  * The scanning process itself is fairly simple, but cfg80211 offers quite
1330d70e9693SJohannes Berg  * a bit of helper functionality. To start a scan, the scan operation will
1331d70e9693SJohannes Berg  * be invoked with a scan definition. This scan definition contains the
1332d70e9693SJohannes Berg  * channels to scan, and the SSIDs to send probe requests for (including the
1333d70e9693SJohannes Berg  * wildcard, if desired). A passive scan is indicated by having no SSIDs to
1334d70e9693SJohannes Berg  * probe. Additionally, a scan request may contain extra information elements
1335d70e9693SJohannes Berg  * that should be added to the probe request. The IEs are guaranteed to be
1336d70e9693SJohannes Berg  * well-formed, and will not exceed the maximum length the driver advertised
1337d70e9693SJohannes Berg  * in the wiphy structure.
1338d70e9693SJohannes Berg  *
1339d70e9693SJohannes Berg  * When scanning finds a BSS, cfg80211 needs to be notified of that, because
1340d70e9693SJohannes Berg  * it is responsible for maintaining the BSS list; the driver should not
1341d70e9693SJohannes Berg  * maintain a list itself. For this notification, various functions exist.
1342d70e9693SJohannes Berg  *
1343d70e9693SJohannes Berg  * Since drivers do not maintain a BSS list, there are also a number of
1344d70e9693SJohannes Berg  * functions to search for a BSS and obtain information about it from the
1345d70e9693SJohannes Berg  * BSS structure cfg80211 maintains. The BSS list is also made available
1346d70e9693SJohannes Berg  * to userspace.
1347d70e9693SJohannes Berg  */
134872bdcf34SJouni Malinen 
1349704232c2SJohannes Berg /**
13502a519311SJohannes Berg  * struct cfg80211_ssid - SSID description
13512a519311SJohannes Berg  * @ssid: the SSID
13522a519311SJohannes Berg  * @ssid_len: length of the ssid
13532a519311SJohannes Berg  */
13542a519311SJohannes Berg struct cfg80211_ssid {
13552a519311SJohannes Berg 	u8 ssid[IEEE80211_MAX_SSID_LEN];
13562a519311SJohannes Berg 	u8 ssid_len;
13572a519311SJohannes Berg };
13582a519311SJohannes Berg 
13592a519311SJohannes Berg /**
13602a519311SJohannes Berg  * struct cfg80211_scan_request - scan request description
13612a519311SJohannes Berg  *
13622a519311SJohannes Berg  * @ssids: SSIDs to scan for (active scan only)
13632a519311SJohannes Berg  * @n_ssids: number of SSIDs
13642a519311SJohannes Berg  * @channels: channels to scan on.
1365ca3dbc20SHelmut Schaa  * @n_channels: total number of channels to scan
1366dcd6eac1SSimon Wunderlich  * @scan_width: channel width for scanning
136770692ad2SJouni Malinen  * @ie: optional information element(s) to add into Probe Request or %NULL
136870692ad2SJouni Malinen  * @ie_len: length of ie in octets
1369ed473771SSam Leffler  * @flags: bit field of flags controlling operation
137034850ab2SJohannes Berg  * @rates: bitmap of rates to advertise for each band
13712a519311SJohannes Berg  * @wiphy: the wiphy this was for
137215d6030bSSam Leffler  * @scan_start: time (in jiffies) when the scan started
1373fd014284SJohannes Berg  * @wdev: the wireless device to scan for
1374abe37c4bSJohannes Berg  * @aborted: (internal) scan request was notified as aborted
13755fe231e8SJohannes Berg  * @notified: (internal) scan request was notified as done or aborted
1376e9f935e3SRajkumar Manoharan  * @no_cck: used to send probe requests at non CCK rate in 2GHz band
13772a519311SJohannes Berg  */
13782a519311SJohannes Berg struct cfg80211_scan_request {
13792a519311SJohannes Berg 	struct cfg80211_ssid *ssids;
13802a519311SJohannes Berg 	int n_ssids;
13812a519311SJohannes Berg 	u32 n_channels;
1382dcd6eac1SSimon Wunderlich 	enum nl80211_bss_scan_width scan_width;
1383de95a54bSJohannes Berg 	const u8 *ie;
138470692ad2SJouni Malinen 	size_t ie_len;
1385ed473771SSam Leffler 	u32 flags;
13862a519311SJohannes Berg 
138734850ab2SJohannes Berg 	u32 rates[IEEE80211_NUM_BANDS];
138834850ab2SJohannes Berg 
1389fd014284SJohannes Berg 	struct wireless_dev *wdev;
1390fd014284SJohannes Berg 
13912a519311SJohannes Berg 	/* internal */
13922a519311SJohannes Berg 	struct wiphy *wiphy;
139315d6030bSSam Leffler 	unsigned long scan_start;
13945fe231e8SJohannes Berg 	bool aborted, notified;
1395e9f935e3SRajkumar Manoharan 	bool no_cck;
13965ba63533SJohannes Berg 
13975ba63533SJohannes Berg 	/* keep last */
13985ba63533SJohannes Berg 	struct ieee80211_channel *channels[0];
13992a519311SJohannes Berg };
14002a519311SJohannes Berg 
14012a519311SJohannes Berg /**
1402a1f1c21cSLuciano Coelho  * struct cfg80211_match_set - sets of attributes to match
1403a1f1c21cSLuciano Coelho  *
1404ea73cbceSJohannes Berg  * @ssid: SSID to be matched; may be zero-length for no match (RSSI only)
1405ea73cbceSJohannes Berg  * @rssi_thold: don't report scan results below this threshold (in s32 dBm)
1406a1f1c21cSLuciano Coelho  */
1407a1f1c21cSLuciano Coelho struct cfg80211_match_set {
1408a1f1c21cSLuciano Coelho 	struct cfg80211_ssid ssid;
1409ea73cbceSJohannes Berg 	s32 rssi_thold;
1410a1f1c21cSLuciano Coelho };
1411a1f1c21cSLuciano Coelho 
1412a1f1c21cSLuciano Coelho /**
1413807f8a8cSLuciano Coelho  * struct cfg80211_sched_scan_request - scheduled scan request description
1414807f8a8cSLuciano Coelho  *
1415807f8a8cSLuciano Coelho  * @ssids: SSIDs to scan for (passed in the probe_reqs in active scans)
1416807f8a8cSLuciano Coelho  * @n_ssids: number of SSIDs
1417807f8a8cSLuciano Coelho  * @n_channels: total number of channels to scan
1418dcd6eac1SSimon Wunderlich  * @scan_width: channel width for scanning
1419bbe6ad6dSLuciano Coelho  * @interval: interval between each scheduled scan cycle
1420807f8a8cSLuciano Coelho  * @ie: optional information element(s) to add into Probe Request or %NULL
1421807f8a8cSLuciano Coelho  * @ie_len: length of ie in octets
1422ed473771SSam Leffler  * @flags: bit field of flags controlling operation
1423a1f1c21cSLuciano Coelho  * @match_sets: sets of parameters to be matched for a scan result
1424a1f1c21cSLuciano Coelho  * 	entry to be considered valid and to be passed to the host
1425a1f1c21cSLuciano Coelho  * 	(others are filtered out).
1426a1f1c21cSLuciano Coelho  *	If ommited, all results are passed.
1427a1f1c21cSLuciano Coelho  * @n_match_sets: number of match sets
1428807f8a8cSLuciano Coelho  * @wiphy: the wiphy this was for
1429807f8a8cSLuciano Coelho  * @dev: the interface
1430077f897aSJohannes Berg  * @scan_start: start time of the scheduled scan
1431807f8a8cSLuciano Coelho  * @channels: channels to scan
1432ea73cbceSJohannes Berg  * @min_rssi_thold: for drivers only supporting a single threshold, this
1433ea73cbceSJohannes Berg  *	contains the minimum over all matchsets
1434807f8a8cSLuciano Coelho  */
1435807f8a8cSLuciano Coelho struct cfg80211_sched_scan_request {
1436807f8a8cSLuciano Coelho 	struct cfg80211_ssid *ssids;
1437807f8a8cSLuciano Coelho 	int n_ssids;
1438807f8a8cSLuciano Coelho 	u32 n_channels;
1439dcd6eac1SSimon Wunderlich 	enum nl80211_bss_scan_width scan_width;
1440bbe6ad6dSLuciano Coelho 	u32 interval;
1441807f8a8cSLuciano Coelho 	const u8 *ie;
1442807f8a8cSLuciano Coelho 	size_t ie_len;
1443ed473771SSam Leffler 	u32 flags;
1444a1f1c21cSLuciano Coelho 	struct cfg80211_match_set *match_sets;
1445a1f1c21cSLuciano Coelho 	int n_match_sets;
1446ea73cbceSJohannes Berg 	s32 min_rssi_thold;
1447807f8a8cSLuciano Coelho 
1448807f8a8cSLuciano Coelho 	/* internal */
1449807f8a8cSLuciano Coelho 	struct wiphy *wiphy;
1450807f8a8cSLuciano Coelho 	struct net_device *dev;
145115d6030bSSam Leffler 	unsigned long scan_start;
1452807f8a8cSLuciano Coelho 
1453807f8a8cSLuciano Coelho 	/* keep last */
1454807f8a8cSLuciano Coelho 	struct ieee80211_channel *channels[0];
1455807f8a8cSLuciano Coelho };
1456807f8a8cSLuciano Coelho 
1457807f8a8cSLuciano Coelho /**
14582a519311SJohannes Berg  * enum cfg80211_signal_type - signal type
14592a519311SJohannes Berg  *
14602a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available
14612a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm)
14622a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100
14632a519311SJohannes Berg  */
14642a519311SJohannes Berg enum cfg80211_signal_type {
14652a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_NONE,
14662a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_MBM,
14672a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_UNSPEC,
14682a519311SJohannes Berg };
14692a519311SJohannes Berg 
14702a519311SJohannes Berg /**
14719caf0364SJohannes Berg  * struct cfg80211_bss_ie_data - BSS entry IE data
14728cef2c9dSJohannes Berg  * @tsf: TSF contained in the frame that carried these IEs
14739caf0364SJohannes Berg  * @rcu_head: internal use, for freeing
14749caf0364SJohannes Berg  * @len: length of the IEs
14759caf0364SJohannes Berg  * @data: IE data
14769caf0364SJohannes Berg  */
14779caf0364SJohannes Berg struct cfg80211_bss_ies {
14788cef2c9dSJohannes Berg 	u64 tsf;
14799caf0364SJohannes Berg 	struct rcu_head rcu_head;
14809caf0364SJohannes Berg 	int len;
14819caf0364SJohannes Berg 	u8 data[];
14829caf0364SJohannes Berg };
14839caf0364SJohannes Berg 
14849caf0364SJohannes Berg /**
14852a519311SJohannes Berg  * struct cfg80211_bss - BSS description
14862a519311SJohannes Berg  *
14872a519311SJohannes Berg  * This structure describes a BSS (which may also be a mesh network)
14882a519311SJohannes Berg  * for use in scan results and similar.
14892a519311SJohannes Berg  *
1490abe37c4bSJohannes Berg  * @channel: channel this BSS is on
1491dcd6eac1SSimon Wunderlich  * @scan_width: width of the control channel
14922a519311SJohannes Berg  * @bssid: BSSID of the BSS
14932a519311SJohannes Berg  * @beacon_interval: the beacon interval as from the frame
14942a519311SJohannes Berg  * @capability: the capability field in host byte order
149583c7aa1aSJohannes Berg  * @ies: the information elements (Note that there is no guarantee that these
149683c7aa1aSJohannes Berg  *	are well-formed!); this is a pointer to either the beacon_ies or
149783c7aa1aSJohannes Berg  *	proberesp_ies depending on whether Probe Response frame has been
149883c7aa1aSJohannes Berg  *	received. It is always non-%NULL.
149934a6eddbSJouni Malinen  * @beacon_ies: the information elements from the last Beacon frame
1500776b3580SJohannes Berg  *	(implementation note: if @hidden_beacon_bss is set this struct doesn't
1501776b3580SJohannes Berg  *	own the beacon_ies, but they're just pointers to the ones from the
1502776b3580SJohannes Berg  *	@hidden_beacon_bss struct)
150334a6eddbSJouni Malinen  * @proberesp_ies: the information elements from the last Probe Response frame
1504776b3580SJohannes Berg  * @hidden_beacon_bss: in case this BSS struct represents a probe response from
1505776b3580SJohannes Berg  *	a BSS that hides the SSID in its beacon, this points to the BSS struct
1506776b3580SJohannes Berg  *	that holds the beacon data. @beacon_ies is still valid, of course, and
1507776b3580SJohannes Berg  *	points to the same data as hidden_beacon_bss->beacon_ies in that case.
150877965c97SJohannes Berg  * @signal: signal strength value (type depends on the wiphy's signal_type)
15092a519311SJohannes Berg  * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
15102a519311SJohannes Berg  */
15112a519311SJohannes Berg struct cfg80211_bss {
15122a519311SJohannes Berg 	struct ieee80211_channel *channel;
1513dcd6eac1SSimon Wunderlich 	enum nl80211_bss_scan_width scan_width;
15142a519311SJohannes Berg 
15159caf0364SJohannes Berg 	const struct cfg80211_bss_ies __rcu *ies;
15169caf0364SJohannes Berg 	const struct cfg80211_bss_ies __rcu *beacon_ies;
15179caf0364SJohannes Berg 	const struct cfg80211_bss_ies __rcu *proberesp_ies;
15189caf0364SJohannes Berg 
1519776b3580SJohannes Berg 	struct cfg80211_bss *hidden_beacon_bss;
15202a519311SJohannes Berg 
15212a519311SJohannes Berg 	s32 signal;
15222a519311SJohannes Berg 
15239caf0364SJohannes Berg 	u16 beacon_interval;
15249caf0364SJohannes Berg 	u16 capability;
15259caf0364SJohannes Berg 
15269caf0364SJohannes Berg 	u8 bssid[ETH_ALEN];
15279caf0364SJohannes Berg 
15281c06ef98SJohannes Berg 	u8 priv[0] __aligned(sizeof(void *));
15292a519311SJohannes Berg };
15302a519311SJohannes Berg 
15312a519311SJohannes Berg /**
1532517357c6SJohannes Berg  * ieee80211_bss_get_ie - find IE with given ID
1533517357c6SJohannes Berg  * @bss: the bss to search
1534517357c6SJohannes Berg  * @ie: the IE ID
15359caf0364SJohannes Berg  *
15369caf0364SJohannes Berg  * Note that the return value is an RCU-protected pointer, so
15379caf0364SJohannes Berg  * rcu_read_lock() must be held when calling this function.
15380ae997dcSYacine Belkadi  * Return: %NULL if not found.
1539517357c6SJohannes Berg  */
1540517357c6SJohannes Berg const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie);
1541517357c6SJohannes Berg 
1542517357c6SJohannes Berg 
1543517357c6SJohannes Berg /**
1544636a5d36SJouni Malinen  * struct cfg80211_auth_request - Authentication request data
1545636a5d36SJouni Malinen  *
1546636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
1547636a5d36SJouni Malinen  * authentication.
1548636a5d36SJouni Malinen  *
1549959867faSJohannes Berg  * @bss: The BSS to authenticate with, the callee must obtain a reference
1550959867faSJohannes Berg  *	to it if it needs to keep it.
1551636a5d36SJouni Malinen  * @auth_type: Authentication type (algorithm)
1552636a5d36SJouni Malinen  * @ie: Extra IEs to add to Authentication frame or %NULL
1553636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
1554fffd0934SJohannes Berg  * @key_len: length of WEP key for shared key authentication
1555fffd0934SJohannes Berg  * @key_idx: index of WEP key for shared key authentication
1556fffd0934SJohannes Berg  * @key: WEP key for shared key authentication
1557e39e5b5eSJouni Malinen  * @sae_data: Non-IE data to use with SAE or %NULL. This starts with
1558e39e5b5eSJouni Malinen  *	Authentication transaction sequence number field.
1559e39e5b5eSJouni Malinen  * @sae_data_len: Length of sae_data buffer in octets
1560636a5d36SJouni Malinen  */
1561636a5d36SJouni Malinen struct cfg80211_auth_request {
156219957bb3SJohannes Berg 	struct cfg80211_bss *bss;
1563636a5d36SJouni Malinen 	const u8 *ie;
1564636a5d36SJouni Malinen 	size_t ie_len;
156519957bb3SJohannes Berg 	enum nl80211_auth_type auth_type;
1566fffd0934SJohannes Berg 	const u8 *key;
1567fffd0934SJohannes Berg 	u8 key_len, key_idx;
1568e39e5b5eSJouni Malinen 	const u8 *sae_data;
1569e39e5b5eSJouni Malinen 	size_t sae_data_len;
1570636a5d36SJouni Malinen };
1571636a5d36SJouni Malinen 
1572636a5d36SJouni Malinen /**
15737e7c8926SBen Greear  * enum cfg80211_assoc_req_flags - Over-ride default behaviour in association.
15747e7c8926SBen Greear  *
15757e7c8926SBen Greear  * @ASSOC_REQ_DISABLE_HT:  Disable HT (802.11n)
1576ee2aca34SJohannes Berg  * @ASSOC_REQ_DISABLE_VHT:  Disable VHT
15777e7c8926SBen Greear  */
15787e7c8926SBen Greear enum cfg80211_assoc_req_flags {
15797e7c8926SBen Greear 	ASSOC_REQ_DISABLE_HT		= BIT(0),
1580ee2aca34SJohannes Berg 	ASSOC_REQ_DISABLE_VHT		= BIT(1),
15817e7c8926SBen Greear };
15827e7c8926SBen Greear 
15837e7c8926SBen Greear /**
1584636a5d36SJouni Malinen  * struct cfg80211_assoc_request - (Re)Association request data
1585636a5d36SJouni Malinen  *
1586636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
1587636a5d36SJouni Malinen  * (re)association.
1588959867faSJohannes Berg  * @bss: The BSS to associate with. If the call is successful the driver is
1589959867faSJohannes Berg  *	given a reference that it must give back to cfg80211_send_rx_assoc()
1590959867faSJohannes Berg  *	or to cfg80211_assoc_timeout(). To ensure proper refcounting, new
1591959867faSJohannes Berg  *	association requests while already associating must be rejected.
1592636a5d36SJouni Malinen  * @ie: Extra IEs to add to (Re)Association Request frame or %NULL
1593636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
1594dc6382ceSJouni Malinen  * @use_mfp: Use management frame protection (IEEE 802.11w) in this association
1595b23aa676SSamuel Ortiz  * @crypto: crypto settings
15963e5d7649SJohannes Berg  * @prev_bssid: previous BSSID, if not %NULL use reassociate frame
15977e7c8926SBen Greear  * @flags:  See &enum cfg80211_assoc_req_flags
15987e7c8926SBen Greear  * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask
15997e7c8926SBen Greear  *	will be used in ht_capa.  Un-supported values will be ignored.
16007e7c8926SBen Greear  * @ht_capa_mask:  The bits of ht_capa which are to be used.
1601ee2aca34SJohannes Berg  * @vht_capa: VHT capability override
1602ee2aca34SJohannes Berg  * @vht_capa_mask: VHT capability mask indicating which fields to use
1603636a5d36SJouni Malinen  */
1604636a5d36SJouni Malinen struct cfg80211_assoc_request {
160519957bb3SJohannes Berg 	struct cfg80211_bss *bss;
16063e5d7649SJohannes Berg 	const u8 *ie, *prev_bssid;
1607636a5d36SJouni Malinen 	size_t ie_len;
1608b23aa676SSamuel Ortiz 	struct cfg80211_crypto_settings crypto;
160919957bb3SJohannes Berg 	bool use_mfp;
16107e7c8926SBen Greear 	u32 flags;
16117e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa;
16127e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa_mask;
1613ee2aca34SJohannes Berg 	struct ieee80211_vht_cap vht_capa, vht_capa_mask;
1614636a5d36SJouni Malinen };
1615636a5d36SJouni Malinen 
1616636a5d36SJouni Malinen /**
1617636a5d36SJouni Malinen  * struct cfg80211_deauth_request - Deauthentication request data
1618636a5d36SJouni Malinen  *
1619636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
1620636a5d36SJouni Malinen  * deauthentication.
1621636a5d36SJouni Malinen  *
162295de817bSJohannes Berg  * @bssid: the BSSID of the BSS to deauthenticate from
1623636a5d36SJouni Malinen  * @ie: Extra IEs to add to Deauthentication frame or %NULL
1624636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
162519957bb3SJohannes Berg  * @reason_code: The reason code for the deauthentication
1626077f897aSJohannes Berg  * @local_state_change: if set, change local state only and
1627077f897aSJohannes Berg  *	do not set a deauth frame
1628636a5d36SJouni Malinen  */
1629636a5d36SJouni Malinen struct cfg80211_deauth_request {
163095de817bSJohannes Berg 	const u8 *bssid;
1631636a5d36SJouni Malinen 	const u8 *ie;
1632636a5d36SJouni Malinen 	size_t ie_len;
163319957bb3SJohannes Berg 	u16 reason_code;
16346863255bSStanislaw Gruszka 	bool local_state_change;
1635636a5d36SJouni Malinen };
1636636a5d36SJouni Malinen 
1637636a5d36SJouni Malinen /**
1638636a5d36SJouni Malinen  * struct cfg80211_disassoc_request - Disassociation request data
1639636a5d36SJouni Malinen  *
1640636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
1641636a5d36SJouni Malinen  * disassocation.
1642636a5d36SJouni Malinen  *
164319957bb3SJohannes Berg  * @bss: the BSS to disassociate from
1644636a5d36SJouni Malinen  * @ie: Extra IEs to add to Disassociation frame or %NULL
1645636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
164619957bb3SJohannes Berg  * @reason_code: The reason code for the disassociation
1647d5cdfacbSJouni Malinen  * @local_state_change: This is a request for a local state only, i.e., no
1648d5cdfacbSJouni Malinen  *	Disassociation frame is to be transmitted.
1649636a5d36SJouni Malinen  */
1650636a5d36SJouni Malinen struct cfg80211_disassoc_request {
165119957bb3SJohannes Berg 	struct cfg80211_bss *bss;
1652636a5d36SJouni Malinen 	const u8 *ie;
1653636a5d36SJouni Malinen 	size_t ie_len;
165419957bb3SJohannes Berg 	u16 reason_code;
1655d5cdfacbSJouni Malinen 	bool local_state_change;
1656636a5d36SJouni Malinen };
1657636a5d36SJouni Malinen 
1658636a5d36SJouni Malinen /**
165904a773adSJohannes Berg  * struct cfg80211_ibss_params - IBSS parameters
166004a773adSJohannes Berg  *
166104a773adSJohannes Berg  * This structure defines the IBSS parameters for the join_ibss()
166204a773adSJohannes Berg  * method.
166304a773adSJohannes Berg  *
166404a773adSJohannes Berg  * @ssid: The SSID, will always be non-null.
166504a773adSJohannes Berg  * @ssid_len: The length of the SSID, will always be non-zero.
166604a773adSJohannes Berg  * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not
166704a773adSJohannes Berg  *	search for IBSSs with a different BSSID.
1668683b6d3bSJohannes Berg  * @chandef: defines the channel to use if no other IBSS to join can be found
166904a773adSJohannes Berg  * @channel_fixed: The channel should be fixed -- do not search for
167004a773adSJohannes Berg  *	IBSSs to join on other channels.
167104a773adSJohannes Berg  * @ie: information element(s) to include in the beacon
167204a773adSJohannes Berg  * @ie_len: length of that
16738e30bc55SJohannes Berg  * @beacon_interval: beacon interval to use
1674fffd0934SJohannes Berg  * @privacy: this is a protected network, keys will be configured
1675fffd0934SJohannes Berg  *	after joining
1676267335d6SAntonio Quartulli  * @control_port: whether user space controls IEEE 802.1X port, i.e.,
1677267335d6SAntonio Quartulli  *	sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
1678267335d6SAntonio Quartulli  *	required to assume that the port is unauthorized until authorized by
1679267335d6SAntonio Quartulli  *	user space. Otherwise, port is marked authorized by default.
16805336fa88SSimon Wunderlich  * @userspace_handles_dfs: whether user space controls DFS operation, i.e.
16815336fa88SSimon Wunderlich  *	changes the channel when a radar is detected. This is required
16825336fa88SSimon Wunderlich  *	to operate on DFS channels.
1683fbd2c8dcSTeemu Paasikivi  * @basic_rates: bitmap of basic rates to use when creating the IBSS
1684dd5b4cc7SFelix Fietkau  * @mcast_rate: per-band multicast rate index + 1 (0: disabled)
1685803768f5SSimon Wunderlich  * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask
1686803768f5SSimon Wunderlich  *	will be used in ht_capa.  Un-supported values will be ignored.
1687803768f5SSimon Wunderlich  * @ht_capa_mask:  The bits of ht_capa which are to be used.
168804a773adSJohannes Berg  */
168904a773adSJohannes Berg struct cfg80211_ibss_params {
169004a773adSJohannes Berg 	u8 *ssid;
169104a773adSJohannes Berg 	u8 *bssid;
1692683b6d3bSJohannes Berg 	struct cfg80211_chan_def chandef;
169304a773adSJohannes Berg 	u8 *ie;
169404a773adSJohannes Berg 	u8 ssid_len, ie_len;
16958e30bc55SJohannes Berg 	u16 beacon_interval;
1696fbd2c8dcSTeemu Paasikivi 	u32 basic_rates;
169704a773adSJohannes Berg 	bool channel_fixed;
1698fffd0934SJohannes Berg 	bool privacy;
1699267335d6SAntonio Quartulli 	bool control_port;
17005336fa88SSimon Wunderlich 	bool userspace_handles_dfs;
1701dd5b4cc7SFelix Fietkau 	int mcast_rate[IEEE80211_NUM_BANDS];
1702803768f5SSimon Wunderlich 	struct ieee80211_ht_cap ht_capa;
1703803768f5SSimon Wunderlich 	struct ieee80211_ht_cap ht_capa_mask;
170404a773adSJohannes Berg };
170504a773adSJohannes Berg 
170604a773adSJohannes Berg /**
1707b23aa676SSamuel Ortiz  * struct cfg80211_connect_params - Connection parameters
1708b23aa676SSamuel Ortiz  *
1709b23aa676SSamuel Ortiz  * This structure provides information needed to complete IEEE 802.11
1710b23aa676SSamuel Ortiz  * authentication and association.
1711b23aa676SSamuel Ortiz  *
1712b23aa676SSamuel Ortiz  * @channel: The channel to use or %NULL if not specified (auto-select based
1713b23aa676SSamuel Ortiz  *	on scan results)
17141df4a510SJouni Malinen  * @channel_hint: The channel of the recommended BSS for initial connection or
17151df4a510SJouni Malinen  *	%NULL if not specified
1716b23aa676SSamuel Ortiz  * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan
1717b23aa676SSamuel Ortiz  *	results)
17181df4a510SJouni Malinen  * @bssid_hint: The recommended AP BSSID for initial connection to the BSS or
17191df4a510SJouni Malinen  *	%NULL if not specified. Unlike the @bssid parameter, the driver is
17201df4a510SJouni Malinen  *	allowed to ignore this @bssid_hint if it has knowledge of a better BSS
17211df4a510SJouni Malinen  *	to use.
1722b23aa676SSamuel Ortiz  * @ssid: SSID
1723b23aa676SSamuel Ortiz  * @ssid_len: Length of ssid in octets
1724b23aa676SSamuel Ortiz  * @auth_type: Authentication type (algorithm)
1725abe37c4bSJohannes Berg  * @ie: IEs for association request
1726abe37c4bSJohannes Berg  * @ie_len: Length of assoc_ie in octets
1727b23aa676SSamuel Ortiz  * @privacy: indicates whether privacy-enabled APs should be used
1728cee00a95SJouni Malinen  * @mfp: indicate whether management frame protection is used
1729b23aa676SSamuel Ortiz  * @crypto: crypto settings
1730fffd0934SJohannes Berg  * @key_len: length of WEP key for shared key authentication
1731fffd0934SJohannes Berg  * @key_idx: index of WEP key for shared key authentication
1732fffd0934SJohannes Berg  * @key: WEP key for shared key authentication
17337e7c8926SBen Greear  * @flags:  See &enum cfg80211_assoc_req_flags
17344486ea98SBala Shanmugam  * @bg_scan_period:  Background scan period in seconds
17354486ea98SBala Shanmugam  *	or -1 to indicate that default value is to be used.
17367e7c8926SBen Greear  * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask
17377e7c8926SBen Greear  *	will be used in ht_capa.  Un-supported values will be ignored.
17387e7c8926SBen Greear  * @ht_capa_mask:  The bits of ht_capa which are to be used.
1739ee2aca34SJohannes Berg  * @vht_capa:  VHT Capability overrides
1740ee2aca34SJohannes Berg  * @vht_capa_mask: The bits of vht_capa which are to be used.
1741b23aa676SSamuel Ortiz  */
1742b23aa676SSamuel Ortiz struct cfg80211_connect_params {
1743b23aa676SSamuel Ortiz 	struct ieee80211_channel *channel;
17441df4a510SJouni Malinen 	struct ieee80211_channel *channel_hint;
1745664834deSJouni Malinen 	const u8 *bssid;
17461df4a510SJouni Malinen 	const u8 *bssid_hint;
1747664834deSJouni Malinen 	const u8 *ssid;
1748b23aa676SSamuel Ortiz 	size_t ssid_len;
1749b23aa676SSamuel Ortiz 	enum nl80211_auth_type auth_type;
17504b5800feSJohannes Berg 	const u8 *ie;
1751b23aa676SSamuel Ortiz 	size_t ie_len;
1752b23aa676SSamuel Ortiz 	bool privacy;
1753cee00a95SJouni Malinen 	enum nl80211_mfp mfp;
1754b23aa676SSamuel Ortiz 	struct cfg80211_crypto_settings crypto;
1755fffd0934SJohannes Berg 	const u8 *key;
1756fffd0934SJohannes Berg 	u8 key_len, key_idx;
17577e7c8926SBen Greear 	u32 flags;
17584486ea98SBala Shanmugam 	int bg_scan_period;
17597e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa;
17607e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa_mask;
1761ee2aca34SJohannes Berg 	struct ieee80211_vht_cap vht_capa;
1762ee2aca34SJohannes Berg 	struct ieee80211_vht_cap vht_capa_mask;
1763b23aa676SSamuel Ortiz };
1764b23aa676SSamuel Ortiz 
1765b23aa676SSamuel Ortiz /**
1766b9a5f8caSJouni Malinen  * enum wiphy_params_flags - set_wiphy_params bitfield values
1767abe37c4bSJohannes Berg  * @WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed
1768abe37c4bSJohannes Berg  * @WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed
1769abe37c4bSJohannes Berg  * @WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed
1770abe37c4bSJohannes Berg  * @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed
1771abe37c4bSJohannes Berg  * @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed
1772b9a5f8caSJouni Malinen  */
1773b9a5f8caSJouni Malinen enum wiphy_params_flags {
1774b9a5f8caSJouni Malinen 	WIPHY_PARAM_RETRY_SHORT		= 1 << 0,
1775b9a5f8caSJouni Malinen 	WIPHY_PARAM_RETRY_LONG		= 1 << 1,
1776b9a5f8caSJouni Malinen 	WIPHY_PARAM_FRAG_THRESHOLD	= 1 << 2,
1777b9a5f8caSJouni Malinen 	WIPHY_PARAM_RTS_THRESHOLD	= 1 << 3,
177881077e82SLukáš Turek 	WIPHY_PARAM_COVERAGE_CLASS	= 1 << 4,
1779b9a5f8caSJouni Malinen };
1780b9a5f8caSJouni Malinen 
17819930380fSJohannes Berg /*
17829930380fSJohannes Berg  * cfg80211_bitrate_mask - masks for bitrate control
17839930380fSJohannes Berg  */
17849930380fSJohannes Berg struct cfg80211_bitrate_mask {
17859930380fSJohannes Berg 	struct {
17869930380fSJohannes Berg 		u32 legacy;
1787d1e33e65SJanusz Dziedzic 		u8 ht_mcs[IEEE80211_HT_MCS_MASK_LEN];
1788204e35a9SJanusz Dziedzic 		u16 vht_mcs[NL80211_VHT_NSS_MAX];
17890b9323f6SJanusz Dziedzic 		enum nl80211_txrate_gi gi;
17909930380fSJohannes Berg 	} control[IEEE80211_NUM_BANDS];
17919930380fSJohannes Berg };
179267fbb16bSSamuel Ortiz /**
179367fbb16bSSamuel Ortiz  * struct cfg80211_pmksa - PMK Security Association
179467fbb16bSSamuel Ortiz  *
179567fbb16bSSamuel Ortiz  * This structure is passed to the set/del_pmksa() method for PMKSA
179667fbb16bSSamuel Ortiz  * caching.
179767fbb16bSSamuel Ortiz  *
179867fbb16bSSamuel Ortiz  * @bssid: The AP's BSSID.
179967fbb16bSSamuel Ortiz  * @pmkid: The PMK material itself.
180067fbb16bSSamuel Ortiz  */
180167fbb16bSSamuel Ortiz struct cfg80211_pmksa {
180267fbb16bSSamuel Ortiz 	u8 *bssid;
180367fbb16bSSamuel Ortiz 	u8 *pmkid;
180467fbb16bSSamuel Ortiz };
18059930380fSJohannes Berg 
18067643a2c3SJohannes Berg /**
180750ac6607SAmitkumar Karwar  * struct cfg80211_pkt_pattern - packet pattern
1808ff1b6e69SJohannes Berg  * @mask: bitmask where to match pattern and where to ignore bytes,
1809ff1b6e69SJohannes Berg  *	one bit per byte, in same format as nl80211
1810ff1b6e69SJohannes Berg  * @pattern: bytes to match where bitmask is 1
1811ff1b6e69SJohannes Berg  * @pattern_len: length of pattern (in bytes)
1812bb92d199SAmitkumar Karwar  * @pkt_offset: packet offset (in bytes)
1813ff1b6e69SJohannes Berg  *
1814ff1b6e69SJohannes Berg  * Internal note: @mask and @pattern are allocated in one chunk of
1815ff1b6e69SJohannes Berg  * memory, free @mask only!
1816ff1b6e69SJohannes Berg  */
181750ac6607SAmitkumar Karwar struct cfg80211_pkt_pattern {
1818ff1b6e69SJohannes Berg 	u8 *mask, *pattern;
1819ff1b6e69SJohannes Berg 	int pattern_len;
1820bb92d199SAmitkumar Karwar 	int pkt_offset;
1821ff1b6e69SJohannes Berg };
1822ff1b6e69SJohannes Berg 
1823ff1b6e69SJohannes Berg /**
18242a0e047eSJohannes Berg  * struct cfg80211_wowlan_tcp - TCP connection parameters
18252a0e047eSJohannes Berg  *
18262a0e047eSJohannes Berg  * @sock: (internal) socket for source port allocation
18272a0e047eSJohannes Berg  * @src: source IP address
18282a0e047eSJohannes Berg  * @dst: destination IP address
18292a0e047eSJohannes Berg  * @dst_mac: destination MAC address
18302a0e047eSJohannes Berg  * @src_port: source port
18312a0e047eSJohannes Berg  * @dst_port: destination port
18322a0e047eSJohannes Berg  * @payload_len: data payload length
18332a0e047eSJohannes Berg  * @payload: data payload buffer
18342a0e047eSJohannes Berg  * @payload_seq: payload sequence stamping configuration
18352a0e047eSJohannes Berg  * @data_interval: interval at which to send data packets
18362a0e047eSJohannes Berg  * @wake_len: wakeup payload match length
18372a0e047eSJohannes Berg  * @wake_data: wakeup payload match data
18382a0e047eSJohannes Berg  * @wake_mask: wakeup payload match mask
18392a0e047eSJohannes Berg  * @tokens_size: length of the tokens buffer
18402a0e047eSJohannes Berg  * @payload_tok: payload token usage configuration
18412a0e047eSJohannes Berg  */
18422a0e047eSJohannes Berg struct cfg80211_wowlan_tcp {
18432a0e047eSJohannes Berg 	struct socket *sock;
18442a0e047eSJohannes Berg 	__be32 src, dst;
18452a0e047eSJohannes Berg 	u16 src_port, dst_port;
18462a0e047eSJohannes Berg 	u8 dst_mac[ETH_ALEN];
18472a0e047eSJohannes Berg 	int payload_len;
18482a0e047eSJohannes Berg 	const u8 *payload;
18492a0e047eSJohannes Berg 	struct nl80211_wowlan_tcp_data_seq payload_seq;
18502a0e047eSJohannes Berg 	u32 data_interval;
18512a0e047eSJohannes Berg 	u32 wake_len;
18522a0e047eSJohannes Berg 	const u8 *wake_data, *wake_mask;
18532a0e047eSJohannes Berg 	u32 tokens_size;
18542a0e047eSJohannes Berg 	/* must be last, variable member */
18552a0e047eSJohannes Berg 	struct nl80211_wowlan_tcp_data_token payload_tok;
1856ff1b6e69SJohannes Berg };
1857ff1b6e69SJohannes Berg 
1858ff1b6e69SJohannes Berg /**
1859ff1b6e69SJohannes Berg  * struct cfg80211_wowlan - Wake on Wireless-LAN support info
1860ff1b6e69SJohannes Berg  *
1861ff1b6e69SJohannes Berg  * This structure defines the enabled WoWLAN triggers for the device.
1862ff1b6e69SJohannes Berg  * @any: wake up on any activity -- special trigger if device continues
1863ff1b6e69SJohannes Berg  *	operating as normal during suspend
1864ff1b6e69SJohannes Berg  * @disconnect: wake up if getting disconnected
1865ff1b6e69SJohannes Berg  * @magic_pkt: wake up on receiving magic packet
1866ff1b6e69SJohannes Berg  * @patterns: wake up on receiving packet matching a pattern
1867ff1b6e69SJohannes Berg  * @n_patterns: number of patterns
186877dbbb13SJohannes Berg  * @gtk_rekey_failure: wake up on GTK rekey failure
186977dbbb13SJohannes Berg  * @eap_identity_req: wake up on EAP identity request packet
187077dbbb13SJohannes Berg  * @four_way_handshake: wake up on 4-way handshake
187177dbbb13SJohannes Berg  * @rfkill_release: wake up when rfkill is released
18722a0e047eSJohannes Berg  * @tcp: TCP connection establishment/wakeup parameters, see nl80211.h.
18732a0e047eSJohannes Berg  *	NULL if not configured.
1874ff1b6e69SJohannes Berg  */
1875ff1b6e69SJohannes Berg struct cfg80211_wowlan {
187677dbbb13SJohannes Berg 	bool any, disconnect, magic_pkt, gtk_rekey_failure,
187777dbbb13SJohannes Berg 	     eap_identity_req, four_way_handshake,
187877dbbb13SJohannes Berg 	     rfkill_release;
187950ac6607SAmitkumar Karwar 	struct cfg80211_pkt_pattern *patterns;
18802a0e047eSJohannes Berg 	struct cfg80211_wowlan_tcp *tcp;
1881ff1b6e69SJohannes Berg 	int n_patterns;
1882ff1b6e69SJohannes Berg };
1883ff1b6e69SJohannes Berg 
1884ff1b6e69SJohannes Berg /**
1885be29b99aSAmitkumar Karwar  * struct cfg80211_coalesce_rules - Coalesce rule parameters
1886be29b99aSAmitkumar Karwar  *
1887be29b99aSAmitkumar Karwar  * This structure defines coalesce rule for the device.
1888be29b99aSAmitkumar Karwar  * @delay: maximum coalescing delay in msecs.
1889be29b99aSAmitkumar Karwar  * @condition: condition for packet coalescence.
1890be29b99aSAmitkumar Karwar  *	see &enum nl80211_coalesce_condition.
1891be29b99aSAmitkumar Karwar  * @patterns: array of packet patterns
1892be29b99aSAmitkumar Karwar  * @n_patterns: number of patterns
1893be29b99aSAmitkumar Karwar  */
1894be29b99aSAmitkumar Karwar struct cfg80211_coalesce_rules {
1895be29b99aSAmitkumar Karwar 	int delay;
1896be29b99aSAmitkumar Karwar 	enum nl80211_coalesce_condition condition;
1897be29b99aSAmitkumar Karwar 	struct cfg80211_pkt_pattern *patterns;
1898be29b99aSAmitkumar Karwar 	int n_patterns;
1899be29b99aSAmitkumar Karwar };
1900be29b99aSAmitkumar Karwar 
1901be29b99aSAmitkumar Karwar /**
1902be29b99aSAmitkumar Karwar  * struct cfg80211_coalesce - Packet coalescing settings
1903be29b99aSAmitkumar Karwar  *
1904be29b99aSAmitkumar Karwar  * This structure defines coalescing settings.
1905be29b99aSAmitkumar Karwar  * @rules: array of coalesce rules
1906be29b99aSAmitkumar Karwar  * @n_rules: number of rules
1907be29b99aSAmitkumar Karwar  */
1908be29b99aSAmitkumar Karwar struct cfg80211_coalesce {
1909be29b99aSAmitkumar Karwar 	struct cfg80211_coalesce_rules *rules;
1910be29b99aSAmitkumar Karwar 	int n_rules;
1911be29b99aSAmitkumar Karwar };
1912be29b99aSAmitkumar Karwar 
1913be29b99aSAmitkumar Karwar /**
1914cd8f7cb4SJohannes Berg  * struct cfg80211_wowlan_wakeup - wakeup report
1915cd8f7cb4SJohannes Berg  * @disconnect: woke up by getting disconnected
1916cd8f7cb4SJohannes Berg  * @magic_pkt: woke up by receiving magic packet
1917cd8f7cb4SJohannes Berg  * @gtk_rekey_failure: woke up by GTK rekey failure
1918cd8f7cb4SJohannes Berg  * @eap_identity_req: woke up by EAP identity request packet
1919cd8f7cb4SJohannes Berg  * @four_way_handshake: woke up by 4-way handshake
1920cd8f7cb4SJohannes Berg  * @rfkill_release: woke up by rfkill being released
1921cd8f7cb4SJohannes Berg  * @pattern_idx: pattern that caused wakeup, -1 if not due to pattern
1922cd8f7cb4SJohannes Berg  * @packet_present_len: copied wakeup packet data
1923cd8f7cb4SJohannes Berg  * @packet_len: original wakeup packet length
1924cd8f7cb4SJohannes Berg  * @packet: The packet causing the wakeup, if any.
1925cd8f7cb4SJohannes Berg  * @packet_80211:  For pattern match, magic packet and other data
1926cd8f7cb4SJohannes Berg  *	frame triggers an 802.3 frame should be reported, for
1927cd8f7cb4SJohannes Berg  *	disconnect due to deauth 802.11 frame. This indicates which
1928cd8f7cb4SJohannes Berg  *	it is.
19292a0e047eSJohannes Berg  * @tcp_match: TCP wakeup packet received
19302a0e047eSJohannes Berg  * @tcp_connlost: TCP connection lost or failed to establish
19312a0e047eSJohannes Berg  * @tcp_nomoretokens: TCP data ran out of tokens
1932cd8f7cb4SJohannes Berg  */
1933cd8f7cb4SJohannes Berg struct cfg80211_wowlan_wakeup {
1934cd8f7cb4SJohannes Berg 	bool disconnect, magic_pkt, gtk_rekey_failure,
1935cd8f7cb4SJohannes Berg 	     eap_identity_req, four_way_handshake,
19362a0e047eSJohannes Berg 	     rfkill_release, packet_80211,
19372a0e047eSJohannes Berg 	     tcp_match, tcp_connlost, tcp_nomoretokens;
1938cd8f7cb4SJohannes Berg 	s32 pattern_idx;
1939cd8f7cb4SJohannes Berg 	u32 packet_present_len, packet_len;
1940cd8f7cb4SJohannes Berg 	const void *packet;
1941cd8f7cb4SJohannes Berg };
1942cd8f7cb4SJohannes Berg 
1943cd8f7cb4SJohannes Berg /**
1944e5497d76SJohannes Berg  * struct cfg80211_gtk_rekey_data - rekey data
1945e5497d76SJohannes Berg  * @kek: key encryption key
1946e5497d76SJohannes Berg  * @kck: key confirmation key
1947e5497d76SJohannes Berg  * @replay_ctr: replay counter
1948e5497d76SJohannes Berg  */
1949e5497d76SJohannes Berg struct cfg80211_gtk_rekey_data {
1950e5497d76SJohannes Berg 	u8 kek[NL80211_KEK_LEN];
1951e5497d76SJohannes Berg 	u8 kck[NL80211_KCK_LEN];
1952e5497d76SJohannes Berg 	u8 replay_ctr[NL80211_REPLAY_CTR_LEN];
1953e5497d76SJohannes Berg };
1954e5497d76SJohannes Berg 
1955e5497d76SJohannes Berg /**
1956355199e0SJouni Malinen  * struct cfg80211_update_ft_ies_params - FT IE Information
1957355199e0SJouni Malinen  *
1958355199e0SJouni Malinen  * This structure provides information needed to update the fast transition IE
1959355199e0SJouni Malinen  *
1960355199e0SJouni Malinen  * @md: The Mobility Domain ID, 2 Octet value
1961355199e0SJouni Malinen  * @ie: Fast Transition IEs
1962355199e0SJouni Malinen  * @ie_len: Length of ft_ie in octets
1963355199e0SJouni Malinen  */
1964355199e0SJouni Malinen struct cfg80211_update_ft_ies_params {
1965355199e0SJouni Malinen 	u16 md;
1966355199e0SJouni Malinen 	const u8 *ie;
1967355199e0SJouni Malinen 	size_t ie_len;
1968355199e0SJouni Malinen };
1969355199e0SJouni Malinen 
1970355199e0SJouni Malinen /**
1971b176e629SAndrei Otcheretianski  * struct cfg80211_mgmt_tx_params - mgmt tx parameters
1972b176e629SAndrei Otcheretianski  *
1973b176e629SAndrei Otcheretianski  * This structure provides information needed to transmit a mgmt frame
1974b176e629SAndrei Otcheretianski  *
1975b176e629SAndrei Otcheretianski  * @chan: channel to use
1976b176e629SAndrei Otcheretianski  * @offchan: indicates wether off channel operation is required
1977b176e629SAndrei Otcheretianski  * @wait: duration for ROC
1978b176e629SAndrei Otcheretianski  * @buf: buffer to transmit
1979b176e629SAndrei Otcheretianski  * @len: buffer length
1980b176e629SAndrei Otcheretianski  * @no_cck: don't use cck rates for this frame
1981b176e629SAndrei Otcheretianski  * @dont_wait_for_ack: tells the low level not to wait for an ack
1982b176e629SAndrei Otcheretianski  */
1983b176e629SAndrei Otcheretianski struct cfg80211_mgmt_tx_params {
1984b176e629SAndrei Otcheretianski 	struct ieee80211_channel *chan;
1985b176e629SAndrei Otcheretianski 	bool offchan;
1986b176e629SAndrei Otcheretianski 	unsigned int wait;
1987b176e629SAndrei Otcheretianski 	const u8 *buf;
1988b176e629SAndrei Otcheretianski 	size_t len;
1989b176e629SAndrei Otcheretianski 	bool no_cck;
1990b176e629SAndrei Otcheretianski 	bool dont_wait_for_ack;
1991b176e629SAndrei Otcheretianski };
1992b176e629SAndrei Otcheretianski 
1993b176e629SAndrei Otcheretianski /**
1994fa9ffc74SKyeyoon Park  * struct cfg80211_dscp_exception - DSCP exception
1995fa9ffc74SKyeyoon Park  *
1996fa9ffc74SKyeyoon Park  * @dscp: DSCP value that does not adhere to the user priority range definition
1997fa9ffc74SKyeyoon Park  * @up: user priority value to which the corresponding DSCP value belongs
1998fa9ffc74SKyeyoon Park  */
1999fa9ffc74SKyeyoon Park struct cfg80211_dscp_exception {
2000fa9ffc74SKyeyoon Park 	u8 dscp;
2001fa9ffc74SKyeyoon Park 	u8 up;
2002fa9ffc74SKyeyoon Park };
2003fa9ffc74SKyeyoon Park 
2004fa9ffc74SKyeyoon Park /**
2005fa9ffc74SKyeyoon Park  * struct cfg80211_dscp_range - DSCP range definition for user priority
2006fa9ffc74SKyeyoon Park  *
2007fa9ffc74SKyeyoon Park  * @low: lowest DSCP value of this user priority range, inclusive
2008fa9ffc74SKyeyoon Park  * @high: highest DSCP value of this user priority range, inclusive
2009fa9ffc74SKyeyoon Park  */
2010fa9ffc74SKyeyoon Park struct cfg80211_dscp_range {
2011fa9ffc74SKyeyoon Park 	u8 low;
2012fa9ffc74SKyeyoon Park 	u8 high;
2013fa9ffc74SKyeyoon Park };
2014fa9ffc74SKyeyoon Park 
2015fa9ffc74SKyeyoon Park /* QoS Map Set element length defined in IEEE Std 802.11-2012, 8.4.2.97 */
2016fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_MAX_EX	21
2017fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_LEN_MIN	16
2018fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_LEN_MAX \
2019fa9ffc74SKyeyoon Park 	(IEEE80211_QOS_MAP_LEN_MIN + 2 * IEEE80211_QOS_MAP_MAX_EX)
2020fa9ffc74SKyeyoon Park 
2021fa9ffc74SKyeyoon Park /**
2022fa9ffc74SKyeyoon Park  * struct cfg80211_qos_map - QoS Map Information
2023fa9ffc74SKyeyoon Park  *
2024fa9ffc74SKyeyoon Park  * This struct defines the Interworking QoS map setting for DSCP values
2025fa9ffc74SKyeyoon Park  *
2026fa9ffc74SKyeyoon Park  * @num_des: number of DSCP exceptions (0..21)
2027fa9ffc74SKyeyoon Park  * @dscp_exception: optionally up to maximum of 21 DSCP exceptions from
2028fa9ffc74SKyeyoon Park  *	the user priority DSCP range definition
2029fa9ffc74SKyeyoon Park  * @up: DSCP range definition for a particular user priority
2030fa9ffc74SKyeyoon Park  */
2031fa9ffc74SKyeyoon Park struct cfg80211_qos_map {
2032fa9ffc74SKyeyoon Park 	u8 num_des;
2033fa9ffc74SKyeyoon Park 	struct cfg80211_dscp_exception dscp_exception[IEEE80211_QOS_MAP_MAX_EX];
2034fa9ffc74SKyeyoon Park 	struct cfg80211_dscp_range up[8];
2035fa9ffc74SKyeyoon Park };
2036fa9ffc74SKyeyoon Park 
2037fa9ffc74SKyeyoon Park /**
2038704232c2SJohannes Berg  * struct cfg80211_ops - backend description for wireless configuration
2039704232c2SJohannes Berg  *
2040704232c2SJohannes Berg  * This struct is registered by fullmac card drivers and/or wireless stacks
2041704232c2SJohannes Berg  * in order to handle configuration requests on their interfaces.
2042704232c2SJohannes Berg  *
2043704232c2SJohannes Berg  * All callbacks except where otherwise noted should return 0
2044704232c2SJohannes Berg  * on success or a negative error code.
2045704232c2SJohannes Berg  *
204643fb45cbSJohannes Berg  * All operations are currently invoked under rtnl for consistency with the
204743fb45cbSJohannes Berg  * wireless extensions but this is subject to reevaluation as soon as this
204843fb45cbSJohannes Berg  * code is used more widely and we have a first user without wext.
204943fb45cbSJohannes Berg  *
2050ff1b6e69SJohannes Berg  * @suspend: wiphy device needs to be suspended. The variable @wow will
2051ff1b6e69SJohannes Berg  *	be %NULL or contain the enabled Wake-on-Wireless triggers that are
2052ff1b6e69SJohannes Berg  *	configured for the device.
20530378b3f1SJohannes Berg  * @resume: wiphy device needs to be resumed
20546d52563fSJohannes Berg  * @set_wakeup: Called when WoWLAN is enabled/disabled, use this callback
20556d52563fSJohannes Berg  *	to call device_set_wakeup_enable() to enable/disable wakeup from
20566d52563fSJohannes Berg  *	the device.
20570378b3f1SJohannes Berg  *
205860719ffdSJohannes Berg  * @add_virtual_intf: create a new virtual interface with the given name,
2059463d0183SJohannes Berg  *	must set the struct wireless_dev's iftype. Beware: You must create
206084efbb84SJohannes Berg  *	the new netdev in the wiphy's network namespace! Returns the struct
206198104fdeSJohannes Berg  *	wireless_dev, or an ERR_PTR. For P2P device wdevs, the driver must
206298104fdeSJohannes Berg  *	also set the address member in the wdev.
2063704232c2SJohannes Berg  *
206484efbb84SJohannes Berg  * @del_virtual_intf: remove the virtual interface
206555682965SJohannes Berg  *
206660719ffdSJohannes Berg  * @change_virtual_intf: change type/configuration of virtual interface,
206760719ffdSJohannes Berg  *	keep the struct wireless_dev's iftype updated.
206855682965SJohannes Berg  *
206941ade00fSJohannes Berg  * @add_key: add a key with the given parameters. @mac_addr will be %NULL
207041ade00fSJohannes Berg  *	when adding a group key.
207141ade00fSJohannes Berg  *
207241ade00fSJohannes Berg  * @get_key: get information about the key with the given parameters.
207341ade00fSJohannes Berg  *	@mac_addr will be %NULL when requesting information for a group
207441ade00fSJohannes Berg  *	key. All pointers given to the @callback function need not be valid
2075e3da574aSJohannes Berg  *	after it returns. This function should return an error if it is
2076e3da574aSJohannes Berg  *	not possible to retrieve the key, -ENOENT if it doesn't exist.
207741ade00fSJohannes Berg  *
207841ade00fSJohannes Berg  * @del_key: remove a key given the @mac_addr (%NULL for a group key)
2079e3da574aSJohannes Berg  *	and @key_index, return -ENOENT if the key doesn't exist.
208041ade00fSJohannes Berg  *
208141ade00fSJohannes Berg  * @set_default_key: set the default key on an interface
2082ed1b6cc7SJohannes Berg  *
20833cfcf6acSJouni Malinen  * @set_default_mgmt_key: set the default management frame key on an interface
20843cfcf6acSJouni Malinen  *
2085e5497d76SJohannes Berg  * @set_rekey_data: give the data necessary for GTK rekeying to the driver
2086e5497d76SJohannes Berg  *
2087c04a4ff7SJohannes Berg  * @start_ap: Start acting in AP mode defined by the parameters.
2088c04a4ff7SJohannes Berg  * @change_beacon: Change the beacon parameters for an access point mode
2089c04a4ff7SJohannes Berg  *	interface. This should reject the call when AP mode wasn't started.
2090c04a4ff7SJohannes Berg  * @stop_ap: Stop being an AP, including stopping beaconing.
20915727ef1bSJohannes Berg  *
20925727ef1bSJohannes Berg  * @add_station: Add a new station.
20935727ef1bSJohannes Berg  * @del_station: Remove a station; @mac may be NULL to remove all stations.
2094bdd90d5eSJohannes Berg  * @change_station: Modify a given station. Note that flags changes are not much
2095bdd90d5eSJohannes Berg  *	validated in cfg80211, in particular the auth/assoc/authorized flags
2096bdd90d5eSJohannes Berg  *	might come to the driver in invalid combinations -- make sure to check
209777ee7c89SJohannes Berg  *	them, also against the existing state! Drivers must call
209877ee7c89SJohannes Berg  *	cfg80211_check_station_change() to validate the information.
2099abe37c4bSJohannes Berg  * @get_station: get station information for the station identified by @mac
2100abe37c4bSJohannes Berg  * @dump_station: dump station callback -- resume dump at index @idx
2101abe37c4bSJohannes Berg  *
2102abe37c4bSJohannes Berg  * @add_mpath: add a fixed mesh path
2103abe37c4bSJohannes Berg  * @del_mpath: delete a given mesh path
2104abe37c4bSJohannes Berg  * @change_mpath: change a given mesh path
2105abe37c4bSJohannes Berg  * @get_mpath: get a mesh path for the given parameters
2106abe37c4bSJohannes Berg  * @dump_mpath: dump mesh path callback -- resume dump at index @idx
2107f52555a4SJohannes Berg  * @join_mesh: join the mesh network with the specified parameters
21088d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
2109f52555a4SJohannes Berg  * @leave_mesh: leave the current mesh network
21108d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
21112ec600d6SLuis Carlos Cobo  *
211224bdd9f4SJavier Cardona  * @get_mesh_config: Get the current mesh configuration
211393da9cc1Scolin@cozybit.com  *
211424bdd9f4SJavier Cardona  * @update_mesh_config: Update mesh parameters on a running mesh.
211593da9cc1Scolin@cozybit.com  *	The mask is a bitfield which tells us which parameters to
211693da9cc1Scolin@cozybit.com  *	set, and which to leave alone.
211793da9cc1Scolin@cozybit.com  *
21189f1ba906SJouni Malinen  * @change_bss: Modify parameters for a given BSS.
211931888487SJouni Malinen  *
212031888487SJouni Malinen  * @set_txq_params: Set TX queue parameters
212172bdcf34SJouni Malinen  *
2122e8c9bd5bSJohannes Berg  * @libertas_set_mesh_channel: Only for backward compatibility for libertas,
2123e8c9bd5bSJohannes Berg  *	as it doesn't implement join_mesh and needs to set the channel to
2124e8c9bd5bSJohannes Berg  *	join the mesh instead.
2125e8c9bd5bSJohannes Berg  *
2126e8c9bd5bSJohannes Berg  * @set_monitor_channel: Set the monitor mode channel for the device. If other
2127e8c9bd5bSJohannes Berg  *	interfaces are active this callback should reject the configuration.
2128e8c9bd5bSJohannes Berg  *	If no interfaces are active or the device is down, the channel should
2129e8c9bd5bSJohannes Berg  *	be stored for when a monitor interface becomes active.
21309aed3cc1SJouni Malinen  *
21312a519311SJohannes Berg  * @scan: Request to do a scan. If returning zero, the scan request is given
21322a519311SJohannes Berg  *	the driver, and will be valid until passed to cfg80211_scan_done().
21332a519311SJohannes Berg  *	For scan results, call cfg80211_inform_bss(); you can call this outside
21342a519311SJohannes Berg  *	the scan/scan_done bracket too.
2135636a5d36SJouni Malinen  *
2136636a5d36SJouni Malinen  * @auth: Request to authenticate with the specified peer
21378d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
2138636a5d36SJouni Malinen  * @assoc: Request to (re)associate with the specified peer
21398d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
2140636a5d36SJouni Malinen  * @deauth: Request to deauthenticate from the specified peer
21418d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
2142636a5d36SJouni Malinen  * @disassoc: Request to disassociate from the specified peer
21438d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
214404a773adSJohannes Berg  *
2145b23aa676SSamuel Ortiz  * @connect: Connect to the ESS with the specified parameters. When connected,
2146b23aa676SSamuel Ortiz  *	call cfg80211_connect_result() with status code %WLAN_STATUS_SUCCESS.
2147b23aa676SSamuel Ortiz  *	If the connection fails for some reason, call cfg80211_connect_result()
2148b23aa676SSamuel Ortiz  *	with the status from the AP.
21498d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
2150b23aa676SSamuel Ortiz  * @disconnect: Disconnect from the BSS/ESS.
21518d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
2152b23aa676SSamuel Ortiz  *
215304a773adSJohannes Berg  * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call
215404a773adSJohannes Berg  *	cfg80211_ibss_joined(), also call that function when changing BSSID due
215504a773adSJohannes Berg  *	to a merge.
21568d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
215704a773adSJohannes Berg  * @leave_ibss: Leave the IBSS.
21588d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
2159b9a5f8caSJouni Malinen  *
2160f4e583c8SAntonio Quartulli  * @set_mcast_rate: Set the specified multicast rate (only if vif is in ADHOC or
2161f4e583c8SAntonio Quartulli  *	MESH mode)
2162f4e583c8SAntonio Quartulli  *
2163b9a5f8caSJouni Malinen  * @set_wiphy_params: Notify that wiphy parameters have changed;
2164b9a5f8caSJouni Malinen  *	@changed bitfield (see &enum wiphy_params_flags) describes which values
2165b9a5f8caSJouni Malinen  *	have changed. The actual parameter values are available in
2166b9a5f8caSJouni Malinen  *	struct wiphy. If returning an error, no value should be changed.
21677643a2c3SJohannes Berg  *
21681432de07SLuis R. Rodriguez  * @set_tx_power: set the transmit power according to the parameters,
2169c8442118SJohannes Berg  *	the power passed is in mBm, to get dBm use MBM_TO_DBM(). The
2170c8442118SJohannes Berg  *	wdev may be %NULL if power was set for the wiphy, and will
2171c8442118SJohannes Berg  *	always be %NULL unless the driver supports per-vif TX power
2172c8442118SJohannes Berg  *	(as advertised by the nl80211 feature flag.)
21737643a2c3SJohannes Berg  * @get_tx_power: store the current TX power into the dbm variable;
21741f87f7d3SJohannes Berg  *	return 0 if successful
21751f87f7d3SJohannes Berg  *
2176abe37c4bSJohannes Berg  * @set_wds_peer: set the WDS peer for a WDS interface
2177abe37c4bSJohannes Berg  *
21781f87f7d3SJohannes Berg  * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting
21791f87f7d3SJohannes Berg  *	functions to adjust rfkill hw state
2180aff89a9bSJohannes Berg  *
218161fa713cSHolger Schurig  * @dump_survey: get site survey information.
218261fa713cSHolger Schurig  *
21839588bbd5SJouni Malinen  * @remain_on_channel: Request the driver to remain awake on the specified
21849588bbd5SJouni Malinen  *	channel for the specified duration to complete an off-channel
21859588bbd5SJouni Malinen  *	operation (e.g., public action frame exchange). When the driver is
21869588bbd5SJouni Malinen  *	ready on the requested channel, it must indicate this with an event
21879588bbd5SJouni Malinen  *	notification by calling cfg80211_ready_on_channel().
21889588bbd5SJouni Malinen  * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation.
21899588bbd5SJouni Malinen  *	This allows the operation to be terminated prior to timeout based on
21909588bbd5SJouni Malinen  *	the duration value.
2191f7ca38dfSJohannes Berg  * @mgmt_tx: Transmit a management frame.
2192f7ca38dfSJohannes Berg  * @mgmt_tx_cancel_wait: Cancel the wait time from transmitting a management
2193f7ca38dfSJohannes Berg  *	frame on another channel
21949588bbd5SJouni Malinen  *
2195fc73f11fSDavid Spinadel  * @testmode_cmd: run a test mode command; @wdev may be %NULL
219671063f0eSWey-Yi Guy  * @testmode_dump: Implement a test mode dump. The cb->args[2] and up may be
219771063f0eSWey-Yi Guy  *	used by the function, but 0 and 1 must not be touched. Additionally,
219871063f0eSWey-Yi Guy  *	return error codes other than -ENOBUFS and -ENOENT will terminate the
219971063f0eSWey-Yi Guy  *	dump and return to userspace with an error, so be careful. If any data
220071063f0eSWey-Yi Guy  *	was passed in from userspace then the data/len arguments will be present
220171063f0eSWey-Yi Guy  *	and point to the data contained in %NL80211_ATTR_TESTDATA.
220267fbb16bSSamuel Ortiz  *
2203abe37c4bSJohannes Berg  * @set_bitrate_mask: set the bitrate mask configuration
2204abe37c4bSJohannes Berg  *
220567fbb16bSSamuel Ortiz  * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac
220667fbb16bSSamuel Ortiz  *	devices running firmwares capable of generating the (re) association
220767fbb16bSSamuel Ortiz  *	RSN IE. It allows for faster roaming between WPA2 BSSIDs.
220867fbb16bSSamuel Ortiz  * @del_pmksa: Delete a cached PMKID.
220967fbb16bSSamuel Ortiz  * @flush_pmksa: Flush all cached PMKIDs.
22109043f3b8SJuuso Oikarinen  * @set_power_mgmt: Configure WLAN power management. A timeout value of -1
22119043f3b8SJuuso Oikarinen  *	allows the driver to adjust the dynamic ps timeout value.
2212d6dc1a38SJuuso Oikarinen  * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold.
221384f10708SThomas Pedersen  * @set_cqm_txe_config: Configure connection quality monitor TX error
221484f10708SThomas Pedersen  *	thresholds.
2215807f8a8cSLuciano Coelho  * @sched_scan_start: Tell the driver to start a scheduled scan.
2216d9b8396aSJohannes Berg  * @sched_scan_stop: Tell the driver to stop an ongoing scheduled scan. This
2217d9b8396aSJohannes Berg  *	call must stop the scheduled scan and be ready for starting a new one
2218d9b8396aSJohannes Berg  *	before it returns, i.e. @sched_scan_start may be called immediately
2219d9b8396aSJohannes Berg  *	after that again and should not fail in that case. The driver should
2220d9b8396aSJohannes Berg  *	not call cfg80211_sched_scan_stopped() for a requested stop (when this
2221d9b8396aSJohannes Berg  *	method returns 0.)
222267fbb16bSSamuel Ortiz  *
2223271733cfSJohannes Berg  * @mgmt_frame_register: Notify driver that a management frame type was
2224271733cfSJohannes Berg  *	registered. Note that this callback may not sleep, and cannot run
2225271733cfSJohannes Berg  *	concurrently with itself.
2226547025d5SBruno Randolf  *
2227547025d5SBruno Randolf  * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device.
2228547025d5SBruno Randolf  *	Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may
2229547025d5SBruno Randolf  *	reject TX/RX mask combinations they cannot support by returning -EINVAL
2230547025d5SBruno Randolf  *	(also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX).
2231547025d5SBruno Randolf  *
2232547025d5SBruno Randolf  * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant).
22333677713bSJohn W. Linville  *
22343677713bSJohn W. Linville  * @set_ringparam: Set tx and rx ring sizes.
22353677713bSJohn W. Linville  *
22363677713bSJohn W. Linville  * @get_ringparam: Get tx and rx ring current and maximum sizes.
2237109086ceSArik Nemtsov  *
2238109086ceSArik Nemtsov  * @tdls_mgmt: Transmit a TDLS management frame.
2239109086ceSArik Nemtsov  * @tdls_oper: Perform a high-level TDLS operation (e.g. TDLS link setup).
22407f6cf311SJohannes Berg  *
22417f6cf311SJohannes Berg  * @probe_client: probe an associated client, must return a cookie that it
22427f6cf311SJohannes Berg  *	later passes to cfg80211_probe_status().
22431d9d9213SSimon Wunderlich  *
22441d9d9213SSimon Wunderlich  * @set_noack_map: Set the NoAck Map for the TIDs.
2245d6199218SBen Greear  *
2246d6199218SBen Greear  * @get_et_sset_count:  Ethtool API to get string-set count.
2247d6199218SBen Greear  *	See @ethtool_ops.get_sset_count
2248d6199218SBen Greear  *
2249d6199218SBen Greear  * @get_et_stats:  Ethtool API to get a set of u64 stats.
2250d6199218SBen Greear  *	See @ethtool_ops.get_ethtool_stats
2251d6199218SBen Greear  *
2252d6199218SBen Greear  * @get_et_strings:  Ethtool API to get a set of strings to describe stats
2253d6199218SBen Greear  *	and perhaps other supported types of ethtool data-sets.
2254d6199218SBen Greear  *	See @ethtool_ops.get_strings
22555b7ccaf3SJohannes Berg  *
22565b7ccaf3SJohannes Berg  * @get_channel: Get the current operating channel for the virtual interface.
22575b7ccaf3SJohannes Berg  *	For monitor interfaces, it should return %NULL unless there's a single
22585b7ccaf3SJohannes Berg  *	current monitoring channel.
225998104fdeSJohannes Berg  *
226098104fdeSJohannes Berg  * @start_p2p_device: Start the given P2P device.
226198104fdeSJohannes Berg  * @stop_p2p_device: Stop the given P2P device.
226277765eafSVasanthakumar Thiagarajan  *
226377765eafSVasanthakumar Thiagarajan  * @set_mac_acl: Sets MAC address control list in AP and P2P GO mode.
226477765eafSVasanthakumar Thiagarajan  *	Parameters include ACL policy, an array of MAC address of stations
226577765eafSVasanthakumar Thiagarajan  *	and the number of MAC addresses. If there is already a list in driver
226677765eafSVasanthakumar Thiagarajan  *	this new list replaces the existing one. Driver has to clear its ACL
226777765eafSVasanthakumar Thiagarajan  *	when number of MAC addresses entries is passed as 0. Drivers which
226877765eafSVasanthakumar Thiagarajan  *	advertise the support for MAC based ACL have to implement this callback.
226904f39047SSimon Wunderlich  *
227004f39047SSimon Wunderlich  * @start_radar_detection: Start radar detection in the driver.
22718bf24293SJouni Malinen  *
22728bf24293SJouni Malinen  * @update_ft_ies: Provide updated Fast BSS Transition information to the
22738bf24293SJouni Malinen  *	driver. If the SME is in the driver/firmware, this information can be
22748bf24293SJouni Malinen  *	used in building Authentication and Reassociation Request frames.
22755de17984SArend van Spriel  *
22765de17984SArend van Spriel  * @crit_proto_start: Indicates a critical protocol needs more link reliability
22775de17984SArend van Spriel  *	for a given duration (milliseconds). The protocol is provided so the
22785de17984SArend van Spriel  *	driver can take the most appropriate actions.
22795de17984SArend van Spriel  * @crit_proto_stop: Indicates critical protocol no longer needs increased link
22805de17984SArend van Spriel  *	reliability. This operation can not fail.
2281be29b99aSAmitkumar Karwar  * @set_coalesce: Set coalesce parameters.
228216ef1fe2SSimon Wunderlich  *
228316ef1fe2SSimon Wunderlich  * @channel_switch: initiate channel-switch procedure (with CSA)
2284fa9ffc74SKyeyoon Park  *
2285fa9ffc74SKyeyoon Park  * @set_qos_map: Set QoS mapping information to the driver
2286704232c2SJohannes Berg  */
2287704232c2SJohannes Berg struct cfg80211_ops {
2288ff1b6e69SJohannes Berg 	int	(*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
22890378b3f1SJohannes Berg 	int	(*resume)(struct wiphy *wiphy);
22906d52563fSJohannes Berg 	void	(*set_wakeup)(struct wiphy *wiphy, bool enabled);
22910378b3f1SJohannes Berg 
229284efbb84SJohannes Berg 	struct wireless_dev * (*add_virtual_intf)(struct wiphy *wiphy,
2293552bff0cSJohannes Berg 						  const char *name,
2294f9e10ce4SJohannes Berg 						  enum nl80211_iftype type,
2295f9e10ce4SJohannes Berg 						  u32 *flags,
22962ec600d6SLuis Carlos Cobo 						  struct vif_params *params);
229784efbb84SJohannes Berg 	int	(*del_virtual_intf)(struct wiphy *wiphy,
229884efbb84SJohannes Berg 				    struct wireless_dev *wdev);
2299e36d56b6SJohannes Berg 	int	(*change_virtual_intf)(struct wiphy *wiphy,
2300e36d56b6SJohannes Berg 				       struct net_device *dev,
23012ec600d6SLuis Carlos Cobo 				       enum nl80211_iftype type, u32 *flags,
23022ec600d6SLuis Carlos Cobo 				       struct vif_params *params);
230341ade00fSJohannes Berg 
230441ade00fSJohannes Berg 	int	(*add_key)(struct wiphy *wiphy, struct net_device *netdev,
2305e31b8213SJohannes Berg 			   u8 key_index, bool pairwise, const u8 *mac_addr,
230641ade00fSJohannes Berg 			   struct key_params *params);
230741ade00fSJohannes Berg 	int	(*get_key)(struct wiphy *wiphy, struct net_device *netdev,
2308e31b8213SJohannes Berg 			   u8 key_index, bool pairwise, const u8 *mac_addr,
2309e31b8213SJohannes Berg 			   void *cookie,
231041ade00fSJohannes Berg 			   void (*callback)(void *cookie, struct key_params*));
231141ade00fSJohannes Berg 	int	(*del_key)(struct wiphy *wiphy, struct net_device *netdev,
2312e31b8213SJohannes Berg 			   u8 key_index, bool pairwise, const u8 *mac_addr);
231341ade00fSJohannes Berg 	int	(*set_default_key)(struct wiphy *wiphy,
231441ade00fSJohannes Berg 				   struct net_device *netdev,
2315dbd2fd65SJohannes Berg 				   u8 key_index, bool unicast, bool multicast);
23163cfcf6acSJouni Malinen 	int	(*set_default_mgmt_key)(struct wiphy *wiphy,
23173cfcf6acSJouni Malinen 					struct net_device *netdev,
23183cfcf6acSJouni Malinen 					u8 key_index);
2319ed1b6cc7SJohannes Berg 
23208860020eSJohannes Berg 	int	(*start_ap)(struct wiphy *wiphy, struct net_device *dev,
23218860020eSJohannes Berg 			    struct cfg80211_ap_settings *settings);
23228860020eSJohannes Berg 	int	(*change_beacon)(struct wiphy *wiphy, struct net_device *dev,
23238860020eSJohannes Berg 				 struct cfg80211_beacon_data *info);
23248860020eSJohannes Berg 	int	(*stop_ap)(struct wiphy *wiphy, struct net_device *dev);
23255727ef1bSJohannes Berg 
23265727ef1bSJohannes Berg 
23275727ef1bSJohannes Berg 	int	(*add_station)(struct wiphy *wiphy, struct net_device *dev,
23285727ef1bSJohannes Berg 			       u8 *mac, struct station_parameters *params);
23295727ef1bSJohannes Berg 	int	(*del_station)(struct wiphy *wiphy, struct net_device *dev,
23305727ef1bSJohannes Berg 			       u8 *mac);
23315727ef1bSJohannes Berg 	int	(*change_station)(struct wiphy *wiphy, struct net_device *dev,
23325727ef1bSJohannes Berg 				  u8 *mac, struct station_parameters *params);
2333fd5b74dcSJohannes Berg 	int	(*get_station)(struct wiphy *wiphy, struct net_device *dev,
23342ec600d6SLuis Carlos Cobo 			       u8 *mac, struct station_info *sinfo);
23352ec600d6SLuis Carlos Cobo 	int	(*dump_station)(struct wiphy *wiphy, struct net_device *dev,
23362ec600d6SLuis Carlos Cobo 			       int idx, u8 *mac, struct station_info *sinfo);
23372ec600d6SLuis Carlos Cobo 
23382ec600d6SLuis Carlos Cobo 	int	(*add_mpath)(struct wiphy *wiphy, struct net_device *dev,
23392ec600d6SLuis Carlos Cobo 			       u8 *dst, u8 *next_hop);
23402ec600d6SLuis Carlos Cobo 	int	(*del_mpath)(struct wiphy *wiphy, struct net_device *dev,
23412ec600d6SLuis Carlos Cobo 			       u8 *dst);
23422ec600d6SLuis Carlos Cobo 	int	(*change_mpath)(struct wiphy *wiphy, struct net_device *dev,
23432ec600d6SLuis Carlos Cobo 				  u8 *dst, u8 *next_hop);
23442ec600d6SLuis Carlos Cobo 	int	(*get_mpath)(struct wiphy *wiphy, struct net_device *dev,
23452ec600d6SLuis Carlos Cobo 			       u8 *dst, u8 *next_hop,
23462ec600d6SLuis Carlos Cobo 			       struct mpath_info *pinfo);
23472ec600d6SLuis Carlos Cobo 	int	(*dump_mpath)(struct wiphy *wiphy, struct net_device *dev,
23482ec600d6SLuis Carlos Cobo 			       int idx, u8 *dst, u8 *next_hop,
23492ec600d6SLuis Carlos Cobo 			       struct mpath_info *pinfo);
235024bdd9f4SJavier Cardona 	int	(*get_mesh_config)(struct wiphy *wiphy,
235193da9cc1Scolin@cozybit.com 				struct net_device *dev,
235293da9cc1Scolin@cozybit.com 				struct mesh_config *conf);
235324bdd9f4SJavier Cardona 	int	(*update_mesh_config)(struct wiphy *wiphy,
235429cbe68cSJohannes Berg 				      struct net_device *dev, u32 mask,
235529cbe68cSJohannes Berg 				      const struct mesh_config *nconf);
235629cbe68cSJohannes Berg 	int	(*join_mesh)(struct wiphy *wiphy, struct net_device *dev,
235729cbe68cSJohannes Berg 			     const struct mesh_config *conf,
235829cbe68cSJohannes Berg 			     const struct mesh_setup *setup);
235929cbe68cSJohannes Berg 	int	(*leave_mesh)(struct wiphy *wiphy, struct net_device *dev);
236029cbe68cSJohannes Berg 
23619f1ba906SJouni Malinen 	int	(*change_bss)(struct wiphy *wiphy, struct net_device *dev,
23629f1ba906SJouni Malinen 			      struct bss_parameters *params);
236331888487SJouni Malinen 
2364f70f01c2SEliad Peller 	int	(*set_txq_params)(struct wiphy *wiphy, struct net_device *dev,
236531888487SJouni Malinen 				  struct ieee80211_txq_params *params);
236672bdcf34SJouni Malinen 
2367e8c9bd5bSJohannes Berg 	int	(*libertas_set_mesh_channel)(struct wiphy *wiphy,
2368e8c9bd5bSJohannes Berg 					     struct net_device *dev,
2369e8c9bd5bSJohannes Berg 					     struct ieee80211_channel *chan);
2370e8c9bd5bSJohannes Berg 
2371e8c9bd5bSJohannes Berg 	int	(*set_monitor_channel)(struct wiphy *wiphy,
2372683b6d3bSJohannes Berg 				       struct cfg80211_chan_def *chandef);
23739aed3cc1SJouni Malinen 
2374fd014284SJohannes Berg 	int	(*scan)(struct wiphy *wiphy,
23752a519311SJohannes Berg 			struct cfg80211_scan_request *request);
2376636a5d36SJouni Malinen 
2377636a5d36SJouni Malinen 	int	(*auth)(struct wiphy *wiphy, struct net_device *dev,
2378636a5d36SJouni Malinen 			struct cfg80211_auth_request *req);
2379636a5d36SJouni Malinen 	int	(*assoc)(struct wiphy *wiphy, struct net_device *dev,
2380636a5d36SJouni Malinen 			 struct cfg80211_assoc_request *req);
2381636a5d36SJouni Malinen 	int	(*deauth)(struct wiphy *wiphy, struct net_device *dev,
238263c9c5e7SJohannes Berg 			  struct cfg80211_deauth_request *req);
2383636a5d36SJouni Malinen 	int	(*disassoc)(struct wiphy *wiphy, struct net_device *dev,
238463c9c5e7SJohannes Berg 			    struct cfg80211_disassoc_request *req);
238504a773adSJohannes Berg 
2386b23aa676SSamuel Ortiz 	int	(*connect)(struct wiphy *wiphy, struct net_device *dev,
2387b23aa676SSamuel Ortiz 			   struct cfg80211_connect_params *sme);
2388b23aa676SSamuel Ortiz 	int	(*disconnect)(struct wiphy *wiphy, struct net_device *dev,
2389b23aa676SSamuel Ortiz 			      u16 reason_code);
2390b23aa676SSamuel Ortiz 
239104a773adSJohannes Berg 	int	(*join_ibss)(struct wiphy *wiphy, struct net_device *dev,
239204a773adSJohannes Berg 			     struct cfg80211_ibss_params *params);
239304a773adSJohannes Berg 	int	(*leave_ibss)(struct wiphy *wiphy, struct net_device *dev);
2394b9a5f8caSJouni Malinen 
2395f4e583c8SAntonio Quartulli 	int	(*set_mcast_rate)(struct wiphy *wiphy, struct net_device *dev,
2396f4e583c8SAntonio Quartulli 				  int rate[IEEE80211_NUM_BANDS]);
2397f4e583c8SAntonio Quartulli 
2398b9a5f8caSJouni Malinen 	int	(*set_wiphy_params)(struct wiphy *wiphy, u32 changed);
23997643a2c3SJohannes Berg 
2400c8442118SJohannes Berg 	int	(*set_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
2401fa61cf70SJuuso Oikarinen 				enum nl80211_tx_power_setting type, int mbm);
2402c8442118SJohannes Berg 	int	(*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
2403c8442118SJohannes Berg 				int *dbm);
24041f87f7d3SJohannes Berg 
2405ab737a4fSJohannes Berg 	int	(*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev,
2406388ac775SJohannes Berg 				const u8 *addr);
2407ab737a4fSJohannes Berg 
24081f87f7d3SJohannes Berg 	void	(*rfkill_poll)(struct wiphy *wiphy);
2409aff89a9bSJohannes Berg 
2410aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE
2411fc73f11fSDavid Spinadel 	int	(*testmode_cmd)(struct wiphy *wiphy, struct wireless_dev *wdev,
2412fc73f11fSDavid Spinadel 				void *data, int len);
241371063f0eSWey-Yi Guy 	int	(*testmode_dump)(struct wiphy *wiphy, struct sk_buff *skb,
241471063f0eSWey-Yi Guy 				 struct netlink_callback *cb,
241571063f0eSWey-Yi Guy 				 void *data, int len);
2416aff89a9bSJohannes Berg #endif
2417bc92afd9SJohannes Berg 
24189930380fSJohannes Berg 	int	(*set_bitrate_mask)(struct wiphy *wiphy,
24199930380fSJohannes Berg 				    struct net_device *dev,
24209930380fSJohannes Berg 				    const u8 *peer,
24219930380fSJohannes Berg 				    const struct cfg80211_bitrate_mask *mask);
24229930380fSJohannes Berg 
242361fa713cSHolger Schurig 	int	(*dump_survey)(struct wiphy *wiphy, struct net_device *netdev,
242461fa713cSHolger Schurig 			int idx, struct survey_info *info);
242561fa713cSHolger Schurig 
242667fbb16bSSamuel Ortiz 	int	(*set_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
242767fbb16bSSamuel Ortiz 			     struct cfg80211_pmksa *pmksa);
242867fbb16bSSamuel Ortiz 	int	(*del_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
242967fbb16bSSamuel Ortiz 			     struct cfg80211_pmksa *pmksa);
243067fbb16bSSamuel Ortiz 	int	(*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev);
243167fbb16bSSamuel Ortiz 
24329588bbd5SJouni Malinen 	int	(*remain_on_channel)(struct wiphy *wiphy,
243371bbc994SJohannes Berg 				     struct wireless_dev *wdev,
24349588bbd5SJouni Malinen 				     struct ieee80211_channel *chan,
24359588bbd5SJouni Malinen 				     unsigned int duration,
24369588bbd5SJouni Malinen 				     u64 *cookie);
24379588bbd5SJouni Malinen 	int	(*cancel_remain_on_channel)(struct wiphy *wiphy,
243871bbc994SJohannes Berg 					    struct wireless_dev *wdev,
24399588bbd5SJouni Malinen 					    u64 cookie);
24409588bbd5SJouni Malinen 
244171bbc994SJohannes Berg 	int	(*mgmt_tx)(struct wiphy *wiphy, struct wireless_dev *wdev,
2442b176e629SAndrei Otcheretianski 			   struct cfg80211_mgmt_tx_params *params,
2443b176e629SAndrei Otcheretianski 			   u64 *cookie);
2444f7ca38dfSJohannes Berg 	int	(*mgmt_tx_cancel_wait)(struct wiphy *wiphy,
244571bbc994SJohannes Berg 				       struct wireless_dev *wdev,
2446f7ca38dfSJohannes Berg 				       u64 cookie);
2447026331c4SJouni Malinen 
2448bc92afd9SJohannes Berg 	int	(*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev,
2449bc92afd9SJohannes Berg 				  bool enabled, int timeout);
2450d6dc1a38SJuuso Oikarinen 
2451d6dc1a38SJuuso Oikarinen 	int	(*set_cqm_rssi_config)(struct wiphy *wiphy,
2452d6dc1a38SJuuso Oikarinen 				       struct net_device *dev,
2453d6dc1a38SJuuso Oikarinen 				       s32 rssi_thold, u32 rssi_hyst);
2454271733cfSJohannes Berg 
245584f10708SThomas Pedersen 	int	(*set_cqm_txe_config)(struct wiphy *wiphy,
245684f10708SThomas Pedersen 				      struct net_device *dev,
245784f10708SThomas Pedersen 				      u32 rate, u32 pkts, u32 intvl);
245884f10708SThomas Pedersen 
2459271733cfSJohannes Berg 	void	(*mgmt_frame_register)(struct wiphy *wiphy,
246071bbc994SJohannes Berg 				       struct wireless_dev *wdev,
2461271733cfSJohannes Berg 				       u16 frame_type, bool reg);
2462afe0cbf8SBruno Randolf 
2463afe0cbf8SBruno Randolf 	int	(*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant);
2464afe0cbf8SBruno Randolf 	int	(*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant);
24653677713bSJohn W. Linville 
24663677713bSJohn W. Linville 	int	(*set_ringparam)(struct wiphy *wiphy, u32 tx, u32 rx);
24673677713bSJohn W. Linville 	void	(*get_ringparam)(struct wiphy *wiphy,
24683677713bSJohn W. Linville 				 u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max);
2469807f8a8cSLuciano Coelho 
2470807f8a8cSLuciano Coelho 	int	(*sched_scan_start)(struct wiphy *wiphy,
2471807f8a8cSLuciano Coelho 				struct net_device *dev,
2472807f8a8cSLuciano Coelho 				struct cfg80211_sched_scan_request *request);
247385a9994aSLuciano Coelho 	int	(*sched_scan_stop)(struct wiphy *wiphy, struct net_device *dev);
2474e5497d76SJohannes Berg 
2475e5497d76SJohannes Berg 	int	(*set_rekey_data)(struct wiphy *wiphy, struct net_device *dev,
2476e5497d76SJohannes Berg 				  struct cfg80211_gtk_rekey_data *data);
2477109086ceSArik Nemtsov 
2478109086ceSArik Nemtsov 	int	(*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev,
2479109086ceSArik Nemtsov 			     u8 *peer, u8 action_code,  u8 dialog_token,
2480df942e7bSSunil Dutt Undekari 			     u16 status_code, u32 peer_capability,
2481df942e7bSSunil Dutt Undekari 			     const u8 *buf, size_t len);
2482109086ceSArik Nemtsov 	int	(*tdls_oper)(struct wiphy *wiphy, struct net_device *dev,
2483109086ceSArik Nemtsov 			     u8 *peer, enum nl80211_tdls_operation oper);
24847f6cf311SJohannes Berg 
24857f6cf311SJohannes Berg 	int	(*probe_client)(struct wiphy *wiphy, struct net_device *dev,
24867f6cf311SJohannes Berg 				const u8 *peer, u64 *cookie);
2487e999882aSJohannes Berg 
24881d9d9213SSimon Wunderlich 	int	(*set_noack_map)(struct wiphy *wiphy,
24891d9d9213SSimon Wunderlich 				  struct net_device *dev,
24901d9d9213SSimon Wunderlich 				  u16 noack_map);
24911d9d9213SSimon Wunderlich 
2492d6199218SBen Greear 	int	(*get_et_sset_count)(struct wiphy *wiphy,
2493d6199218SBen Greear 				     struct net_device *dev, int sset);
2494d6199218SBen Greear 	void	(*get_et_stats)(struct wiphy *wiphy, struct net_device *dev,
2495d6199218SBen Greear 				struct ethtool_stats *stats, u64 *data);
2496d6199218SBen Greear 	void	(*get_et_strings)(struct wiphy *wiphy, struct net_device *dev,
2497d6199218SBen Greear 				  u32 sset, u8 *data);
2498dbbae26aSMichal Kazior 
2499683b6d3bSJohannes Berg 	int	(*get_channel)(struct wiphy *wiphy,
25005b7ccaf3SJohannes Berg 			       struct wireless_dev *wdev,
2501683b6d3bSJohannes Berg 			       struct cfg80211_chan_def *chandef);
250298104fdeSJohannes Berg 
250398104fdeSJohannes Berg 	int	(*start_p2p_device)(struct wiphy *wiphy,
250498104fdeSJohannes Berg 				    struct wireless_dev *wdev);
250598104fdeSJohannes Berg 	void	(*stop_p2p_device)(struct wiphy *wiphy,
250698104fdeSJohannes Berg 				   struct wireless_dev *wdev);
250777765eafSVasanthakumar Thiagarajan 
250877765eafSVasanthakumar Thiagarajan 	int	(*set_mac_acl)(struct wiphy *wiphy, struct net_device *dev,
250977765eafSVasanthakumar Thiagarajan 			       const struct cfg80211_acl_data *params);
251004f39047SSimon Wunderlich 
251104f39047SSimon Wunderlich 	int	(*start_radar_detection)(struct wiphy *wiphy,
251204f39047SSimon Wunderlich 					 struct net_device *dev,
251331559f35SJanusz Dziedzic 					 struct cfg80211_chan_def *chandef,
251431559f35SJanusz Dziedzic 					 u32 cac_time_ms);
2515355199e0SJouni Malinen 	int	(*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev,
2516355199e0SJouni Malinen 				 struct cfg80211_update_ft_ies_params *ftie);
25175de17984SArend van Spriel 	int	(*crit_proto_start)(struct wiphy *wiphy,
25185de17984SArend van Spriel 				    struct wireless_dev *wdev,
25195de17984SArend van Spriel 				    enum nl80211_crit_proto_id protocol,
25205de17984SArend van Spriel 				    u16 duration);
25215de17984SArend van Spriel 	void	(*crit_proto_stop)(struct wiphy *wiphy,
25225de17984SArend van Spriel 				   struct wireless_dev *wdev);
2523be29b99aSAmitkumar Karwar 	int	(*set_coalesce)(struct wiphy *wiphy,
2524be29b99aSAmitkumar Karwar 				struct cfg80211_coalesce *coalesce);
252516ef1fe2SSimon Wunderlich 
252616ef1fe2SSimon Wunderlich 	int	(*channel_switch)(struct wiphy *wiphy,
252716ef1fe2SSimon Wunderlich 				  struct net_device *dev,
252816ef1fe2SSimon Wunderlich 				  struct cfg80211_csa_settings *params);
2529fa9ffc74SKyeyoon Park 	int     (*set_qos_map)(struct wiphy *wiphy,
2530fa9ffc74SKyeyoon Park 			       struct net_device *dev,
2531fa9ffc74SKyeyoon Park 			       struct cfg80211_qos_map *qos_map);
2532704232c2SJohannes Berg };
2533704232c2SJohannes Berg 
2534d3236553SJohannes Berg /*
2535d3236553SJohannes Berg  * wireless hardware and networking interfaces structures
2536d3236553SJohannes Berg  * and registration/helper functions
2537d3236553SJohannes Berg  */
2538d3236553SJohannes Berg 
2539d3236553SJohannes Berg /**
25405be83de5SJohannes Berg  * enum wiphy_flags - wiphy capability flags
25415be83de5SJohannes Berg  *
25425be83de5SJohannes Berg  * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this
25435be83de5SJohannes Berg  *	wiphy at all
25445be83de5SJohannes Berg  * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled
25455be83de5SJohannes Berg  *	by default -- this flag will be set depending on the kernel's default
25465be83de5SJohannes Berg  *	on wiphy_new(), but can be changed by the driver if it has a good
25475be83de5SJohannes Berg  *	reason to override the default
25489bc383deSJohannes Berg  * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station
25499bc383deSJohannes Berg  *	on a VLAN interface)
25509bc383deSJohannes Berg  * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station
2551c0692b8fSJohannes Berg  * @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the
2552c0692b8fSJohannes Berg  *	control port protocol ethertype. The device also honours the
2553c0692b8fSJohannes Berg  *	control_port_no_encrypt flag.
2554e31b8213SJohannes Berg  * @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN.
255515d5dda6SJavier Cardona  * @WIPHY_FLAG_MESH_AUTH: The device supports mesh authentication by routing
255615d5dda6SJavier Cardona  *	auth frames to userspace. See @NL80211_MESH_SETUP_USERSPACE_AUTH.
25571ba01458SRandy Dunlap  * @WIPHY_FLAG_SUPPORTS_SCHED_SCAN: The device supports scheduled scans.
2558f4b34b55SVivek Natarajan  * @WIPHY_FLAG_SUPPORTS_FW_ROAM: The device supports roaming feature in the
2559f4b34b55SVivek Natarajan  *	firmware.
2560cedb5412SEliad Peller  * @WIPHY_FLAG_AP_UAPSD: The device supports uapsd on AP.
2561109086ceSArik Nemtsov  * @WIPHY_FLAG_SUPPORTS_TDLS: The device supports TDLS (802.11z) operation.
2562109086ceSArik Nemtsov  * @WIPHY_FLAG_TDLS_EXTERNAL_SETUP: The device does not handle TDLS (802.11z)
2563109086ceSArik Nemtsov  *	link setup/discovery operations internally. Setup, discovery and
2564109086ceSArik Nemtsov  *	teardown packets should be sent through the @NL80211_CMD_TDLS_MGMT
2565109086ceSArik Nemtsov  *	command. When this flag is not set, @NL80211_CMD_TDLS_OPER should be
2566109086ceSArik Nemtsov  *	used for asking the driver/firmware to perform a TDLS operation.
2567562a7480SJohannes Berg  * @WIPHY_FLAG_HAVE_AP_SME: device integrates AP SME
25685e760230SJohannes Berg  * @WIPHY_FLAG_REPORTS_OBSS: the device will report beacons from other BSSes
25695e760230SJohannes Berg  *	when there are virtual interfaces in AP mode by calling
25705e760230SJohannes Berg  *	cfg80211_report_obss_beacon().
257187bbbe22SArik Nemtsov  * @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD: When operating as an AP, the device
257287bbbe22SArik Nemtsov  *	responds to probe-requests in hardware.
25737c4ef712SJohannes Berg  * @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX.
25747c4ef712SJohannes Berg  * @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call.
25752f301ab2SSimon Wunderlich  * @WIPHY_FLAG_SUPPORTS_5_10_MHZ: Device supports 5 MHz and 10 MHz channels.
257616ef1fe2SSimon Wunderlich  * @WIPHY_FLAG_HAS_CHANNEL_SWITCH: Device supports channel switch in
257716ef1fe2SSimon Wunderlich  *	beaconing mode (AP, IBSS, Mesh, ...).
25785be83de5SJohannes Berg  */
25795be83de5SJohannes Berg enum wiphy_flags {
2580a2f73b6cSLuis R. Rodriguez 	/* use hole at 0 */
2581a2f73b6cSLuis R. Rodriguez 	/* use hole at 1 */
2582a2f73b6cSLuis R. Rodriguez 	/* use hole at 2 */
25835be83de5SJohannes Berg 	WIPHY_FLAG_NETNS_OK			= BIT(3),
25845be83de5SJohannes Berg 	WIPHY_FLAG_PS_ON_BY_DEFAULT		= BIT(4),
25859bc383deSJohannes Berg 	WIPHY_FLAG_4ADDR_AP			= BIT(5),
25869bc383deSJohannes Berg 	WIPHY_FLAG_4ADDR_STATION		= BIT(6),
2587c0692b8fSJohannes Berg 	WIPHY_FLAG_CONTROL_PORT_PROTOCOL	= BIT(7),
2588309075cfSJussi Kivilinna 	WIPHY_FLAG_IBSS_RSN			= BIT(8),
258915d5dda6SJavier Cardona 	WIPHY_FLAG_MESH_AUTH			= BIT(10),
2590807f8a8cSLuciano Coelho 	WIPHY_FLAG_SUPPORTS_SCHED_SCAN		= BIT(11),
25918e8b41f9SJohannes Berg 	/* use hole at 12 */
2592f4b34b55SVivek Natarajan 	WIPHY_FLAG_SUPPORTS_FW_ROAM		= BIT(13),
2593cedb5412SEliad Peller 	WIPHY_FLAG_AP_UAPSD			= BIT(14),
2594109086ceSArik Nemtsov 	WIPHY_FLAG_SUPPORTS_TDLS		= BIT(15),
2595109086ceSArik Nemtsov 	WIPHY_FLAG_TDLS_EXTERNAL_SETUP		= BIT(16),
2596562a7480SJohannes Berg 	WIPHY_FLAG_HAVE_AP_SME			= BIT(17),
25975e760230SJohannes Berg 	WIPHY_FLAG_REPORTS_OBSS			= BIT(18),
259887bbbe22SArik Nemtsov 	WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD	= BIT(19),
25997c4ef712SJohannes Berg 	WIPHY_FLAG_OFFCHAN_TX			= BIT(20),
26007c4ef712SJohannes Berg 	WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL	= BIT(21),
26012f301ab2SSimon Wunderlich 	WIPHY_FLAG_SUPPORTS_5_10_MHZ		= BIT(22),
260216ef1fe2SSimon Wunderlich 	WIPHY_FLAG_HAS_CHANNEL_SWITCH		= BIT(23),
26037527a782SJohannes Berg };
26047527a782SJohannes Berg 
26057527a782SJohannes Berg /**
26067527a782SJohannes Berg  * struct ieee80211_iface_limit - limit on certain interface types
26077527a782SJohannes Berg  * @max: maximum number of interfaces of these types
26087527a782SJohannes Berg  * @types: interface types (bits)
26097527a782SJohannes Berg  */
26107527a782SJohannes Berg struct ieee80211_iface_limit {
26117527a782SJohannes Berg 	u16 max;
26127527a782SJohannes Berg 	u16 types;
26137527a782SJohannes Berg };
26147527a782SJohannes Berg 
26157527a782SJohannes Berg /**
26167527a782SJohannes Berg  * struct ieee80211_iface_combination - possible interface combination
26177527a782SJohannes Berg  * @limits: limits for the given interface types
26187527a782SJohannes Berg  * @n_limits: number of limitations
26197527a782SJohannes Berg  * @num_different_channels: can use up to this many different channels
26207527a782SJohannes Berg  * @max_interfaces: maximum number of interfaces in total allowed in this
26217527a782SJohannes Berg  *	group
26227527a782SJohannes Berg  * @beacon_int_infra_match: In this combination, the beacon intervals
26237527a782SJohannes Berg  *	between infrastructure and AP types must match. This is required
26247527a782SJohannes Berg  *	only in special cases.
262511c4a075SSimon Wunderlich  * @radar_detect_widths: bitmap of channel widths supported for radar detection
26267527a782SJohannes Berg  *
2627b80edbc1SLuciano Coelho  * With this structure the driver can describe which interface
2628b80edbc1SLuciano Coelho  * combinations it supports concurrently.
26297527a782SJohannes Berg  *
2630b80edbc1SLuciano Coelho  * Examples:
2631b80edbc1SLuciano Coelho  *
2632b80edbc1SLuciano Coelho  * 1. Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total:
26337527a782SJohannes Berg  *
26347527a782SJohannes Berg  *  struct ieee80211_iface_limit limits1[] = {
26357527a782SJohannes Berg  *	{ .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
26367527a782SJohannes Berg  *	{ .max = 1, .types = BIT(NL80211_IFTYPE_AP}, },
26377527a782SJohannes Berg  *  };
26387527a782SJohannes Berg  *  struct ieee80211_iface_combination combination1 = {
26397527a782SJohannes Berg  *	.limits = limits1,
26407527a782SJohannes Berg  *	.n_limits = ARRAY_SIZE(limits1),
26417527a782SJohannes Berg  *	.max_interfaces = 2,
26427527a782SJohannes Berg  *	.beacon_int_infra_match = true,
26437527a782SJohannes Berg  *  };
26447527a782SJohannes Berg  *
26457527a782SJohannes Berg  *
2646b80edbc1SLuciano Coelho  * 2. Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total:
26477527a782SJohannes Berg  *
26487527a782SJohannes Berg  *  struct ieee80211_iface_limit limits2[] = {
26497527a782SJohannes Berg  *	{ .max = 8, .types = BIT(NL80211_IFTYPE_AP) |
26507527a782SJohannes Berg  *			     BIT(NL80211_IFTYPE_P2P_GO), },
26517527a782SJohannes Berg  *  };
26527527a782SJohannes Berg  *  struct ieee80211_iface_combination combination2 = {
26537527a782SJohannes Berg  *	.limits = limits2,
26547527a782SJohannes Berg  *	.n_limits = ARRAY_SIZE(limits2),
26557527a782SJohannes Berg  *	.max_interfaces = 8,
26567527a782SJohannes Berg  *	.num_different_channels = 1,
26577527a782SJohannes Berg  *  };
26587527a782SJohannes Berg  *
26597527a782SJohannes Berg  *
2660b80edbc1SLuciano Coelho  * 3. Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total.
2661b80edbc1SLuciano Coelho  *
26627527a782SJohannes Berg  * This allows for an infrastructure connection and three P2P connections.
26637527a782SJohannes Berg  *
26647527a782SJohannes Berg  *  struct ieee80211_iface_limit limits3[] = {
26657527a782SJohannes Berg  *	{ .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
26667527a782SJohannes Berg  *	{ .max = 3, .types = BIT(NL80211_IFTYPE_P2P_GO) |
26677527a782SJohannes Berg  *			     BIT(NL80211_IFTYPE_P2P_CLIENT), },
26687527a782SJohannes Berg  *  };
26697527a782SJohannes Berg  *  struct ieee80211_iface_combination combination3 = {
26707527a782SJohannes Berg  *	.limits = limits3,
26717527a782SJohannes Berg  *	.n_limits = ARRAY_SIZE(limits3),
26727527a782SJohannes Berg  *	.max_interfaces = 4,
26737527a782SJohannes Berg  *	.num_different_channels = 2,
26747527a782SJohannes Berg  *  };
26757527a782SJohannes Berg  */
26767527a782SJohannes Berg struct ieee80211_iface_combination {
26777527a782SJohannes Berg 	const struct ieee80211_iface_limit *limits;
26787527a782SJohannes Berg 	u32 num_different_channels;
26797527a782SJohannes Berg 	u16 max_interfaces;
26807527a782SJohannes Berg 	u8 n_limits;
26817527a782SJohannes Berg 	bool beacon_int_infra_match;
268211c4a075SSimon Wunderlich 	u8 radar_detect_widths;
26835be83de5SJohannes Berg };
26845be83de5SJohannes Berg 
26852e161f78SJohannes Berg struct ieee80211_txrx_stypes {
26862e161f78SJohannes Berg 	u16 tx, rx;
26872e161f78SJohannes Berg };
26882e161f78SJohannes Berg 
26895be83de5SJohannes Berg /**
2690ff1b6e69SJohannes Berg  * enum wiphy_wowlan_support_flags - WoWLAN support flags
2691ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_ANY: supports wakeup for the special "any"
2692ff1b6e69SJohannes Berg  *	trigger that keeps the device operating as-is and
2693ff1b6e69SJohannes Berg  *	wakes up the host on any activity, for example a
2694ff1b6e69SJohannes Berg  *	received packet that passed filtering; note that the
2695ff1b6e69SJohannes Berg  *	packet should be preserved in that case
2696ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_MAGIC_PKT: supports wakeup on magic packet
2697ff1b6e69SJohannes Berg  *	(see nl80211.h)
2698ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_DISCONNECT: supports wakeup on disconnect
269977dbbb13SJohannes Berg  * @WIPHY_WOWLAN_SUPPORTS_GTK_REKEY: supports GTK rekeying while asleep
270077dbbb13SJohannes Berg  * @WIPHY_WOWLAN_GTK_REKEY_FAILURE: supports wakeup on GTK rekey failure
270177dbbb13SJohannes Berg  * @WIPHY_WOWLAN_EAP_IDENTITY_REQ: supports wakeup on EAP identity request
270277dbbb13SJohannes Berg  * @WIPHY_WOWLAN_4WAY_HANDSHAKE: supports wakeup on 4-way handshake failure
270377dbbb13SJohannes Berg  * @WIPHY_WOWLAN_RFKILL_RELEASE: supports wakeup on RF-kill release
2704ff1b6e69SJohannes Berg  */
2705ff1b6e69SJohannes Berg enum wiphy_wowlan_support_flags {
2706ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_ANY		= BIT(0),
2707ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_MAGIC_PKT		= BIT(1),
2708ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_DISCONNECT		= BIT(2),
270977dbbb13SJohannes Berg 	WIPHY_WOWLAN_SUPPORTS_GTK_REKEY	= BIT(3),
271077dbbb13SJohannes Berg 	WIPHY_WOWLAN_GTK_REKEY_FAILURE	= BIT(4),
271177dbbb13SJohannes Berg 	WIPHY_WOWLAN_EAP_IDENTITY_REQ	= BIT(5),
271277dbbb13SJohannes Berg 	WIPHY_WOWLAN_4WAY_HANDSHAKE	= BIT(6),
271377dbbb13SJohannes Berg 	WIPHY_WOWLAN_RFKILL_RELEASE	= BIT(7),
2714ff1b6e69SJohannes Berg };
2715ff1b6e69SJohannes Berg 
27162a0e047eSJohannes Berg struct wiphy_wowlan_tcp_support {
27172a0e047eSJohannes Berg 	const struct nl80211_wowlan_tcp_data_token_feature *tok;
27182a0e047eSJohannes Berg 	u32 data_payload_max;
27192a0e047eSJohannes Berg 	u32 data_interval_max;
27202a0e047eSJohannes Berg 	u32 wake_payload_max;
27212a0e047eSJohannes Berg 	bool seq;
27222a0e047eSJohannes Berg };
27232a0e047eSJohannes Berg 
2724ff1b6e69SJohannes Berg /**
2725ff1b6e69SJohannes Berg  * struct wiphy_wowlan_support - WoWLAN support data
2726ff1b6e69SJohannes Berg  * @flags: see &enum wiphy_wowlan_support_flags
2727ff1b6e69SJohannes Berg  * @n_patterns: number of supported wakeup patterns
2728ff1b6e69SJohannes Berg  *	(see nl80211.h for the pattern definition)
2729ff1b6e69SJohannes Berg  * @pattern_max_len: maximum length of each pattern
2730ff1b6e69SJohannes Berg  * @pattern_min_len: minimum length of each pattern
2731bb92d199SAmitkumar Karwar  * @max_pkt_offset: maximum Rx packet offset
27322a0e047eSJohannes Berg  * @tcp: TCP wakeup support information
2733ff1b6e69SJohannes Berg  */
2734ff1b6e69SJohannes Berg struct wiphy_wowlan_support {
2735ff1b6e69SJohannes Berg 	u32 flags;
2736ff1b6e69SJohannes Berg 	int n_patterns;
2737ff1b6e69SJohannes Berg 	int pattern_max_len;
2738ff1b6e69SJohannes Berg 	int pattern_min_len;
2739bb92d199SAmitkumar Karwar 	int max_pkt_offset;
27402a0e047eSJohannes Berg 	const struct wiphy_wowlan_tcp_support *tcp;
2741ff1b6e69SJohannes Berg };
2742ff1b6e69SJohannes Berg 
2743ff1b6e69SJohannes Berg /**
2744be29b99aSAmitkumar Karwar  * struct wiphy_coalesce_support - coalesce support data
2745be29b99aSAmitkumar Karwar  * @n_rules: maximum number of coalesce rules
2746be29b99aSAmitkumar Karwar  * @max_delay: maximum supported coalescing delay in msecs
2747be29b99aSAmitkumar Karwar  * @n_patterns: number of supported patterns in a rule
2748be29b99aSAmitkumar Karwar  *	(see nl80211.h for the pattern definition)
2749be29b99aSAmitkumar Karwar  * @pattern_max_len: maximum length of each pattern
2750be29b99aSAmitkumar Karwar  * @pattern_min_len: minimum length of each pattern
2751be29b99aSAmitkumar Karwar  * @max_pkt_offset: maximum Rx packet offset
2752be29b99aSAmitkumar Karwar  */
2753be29b99aSAmitkumar Karwar struct wiphy_coalesce_support {
2754be29b99aSAmitkumar Karwar 	int n_rules;
2755be29b99aSAmitkumar Karwar 	int max_delay;
2756be29b99aSAmitkumar Karwar 	int n_patterns;
2757be29b99aSAmitkumar Karwar 	int pattern_max_len;
2758be29b99aSAmitkumar Karwar 	int pattern_min_len;
2759be29b99aSAmitkumar Karwar 	int max_pkt_offset;
2760be29b99aSAmitkumar Karwar };
2761be29b99aSAmitkumar Karwar 
2762be29b99aSAmitkumar Karwar /**
2763ad7e718cSJohannes Berg  * enum wiphy_vendor_command_flags - validation flags for vendor commands
2764ad7e718cSJohannes Berg  * @WIPHY_VENDOR_CMD_NEED_WDEV: vendor command requires wdev
2765ad7e718cSJohannes Berg  * @WIPHY_VENDOR_CMD_NEED_NETDEV: vendor command requires netdev
2766ad7e718cSJohannes Berg  * @WIPHY_VENDOR_CMD_NEED_RUNNING: interface/wdev must be up & running
2767ad7e718cSJohannes Berg  *	(must be combined with %_WDEV or %_NETDEV)
2768ad7e718cSJohannes Berg  */
2769ad7e718cSJohannes Berg enum wiphy_vendor_command_flags {
2770ad7e718cSJohannes Berg 	WIPHY_VENDOR_CMD_NEED_WDEV = BIT(0),
2771ad7e718cSJohannes Berg 	WIPHY_VENDOR_CMD_NEED_NETDEV = BIT(1),
2772ad7e718cSJohannes Berg 	WIPHY_VENDOR_CMD_NEED_RUNNING = BIT(2),
2773ad7e718cSJohannes Berg };
2774ad7e718cSJohannes Berg 
2775ad7e718cSJohannes Berg /**
2776ad7e718cSJohannes Berg  * struct wiphy_vendor_command - vendor command definition
2777ad7e718cSJohannes Berg  * @info: vendor command identifying information, as used in nl80211
2778ad7e718cSJohannes Berg  * @flags: flags, see &enum wiphy_vendor_command_flags
2779ad7e718cSJohannes Berg  * @doit: callback for the operation, note that wdev is %NULL if the
2780ad7e718cSJohannes Berg  *	flags didn't ask for a wdev and non-%NULL otherwise; the data
2781ad7e718cSJohannes Berg  *	pointer may be %NULL if userspace provided no data at all
2782ad7e718cSJohannes Berg  */
2783ad7e718cSJohannes Berg struct wiphy_vendor_command {
2784ad7e718cSJohannes Berg 	struct nl80211_vendor_cmd_info info;
2785ad7e718cSJohannes Berg 	u32 flags;
2786ad7e718cSJohannes Berg 	int (*doit)(struct wiphy *wiphy, struct wireless_dev *wdev,
2787ad7e718cSJohannes Berg 		    const void *data, int data_len);
2788ad7e718cSJohannes Berg };
2789ad7e718cSJohannes Berg 
2790ad7e718cSJohannes Berg /**
27915be83de5SJohannes Berg  * struct wiphy - wireless hardware description
27922784fe91SLuis R. Rodriguez  * @reg_notifier: the driver's regulatory notification callback,
27932784fe91SLuis R. Rodriguez  *	note that if your driver uses wiphy_apply_custom_regulatory()
27942784fe91SLuis R. Rodriguez  *	the reg_notifier's request can be passed as NULL
2795d3236553SJohannes Berg  * @regd: the driver's regulatory domain, if one was requested via
2796d3236553SJohannes Berg  * 	the regulatory_hint() API. This can be used by the driver
2797d3236553SJohannes Berg  *	on the reg_notifier() if it chooses to ignore future
2798d3236553SJohannes Berg  *	regulatory domain changes caused by other drivers.
2799d3236553SJohannes Berg  * @signal_type: signal type reported in &struct cfg80211_bss.
2800d3236553SJohannes Berg  * @cipher_suites: supported cipher suites
2801d3236553SJohannes Berg  * @n_cipher_suites: number of supported cipher suites
2802b9a5f8caSJouni Malinen  * @retry_short: Retry limit for short frames (dot11ShortRetryLimit)
2803b9a5f8caSJouni Malinen  * @retry_long: Retry limit for long frames (dot11LongRetryLimit)
2804b9a5f8caSJouni Malinen  * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold);
2805b9a5f8caSJouni Malinen  *	-1 = fragmentation disabled, only odd values >= 256 used
2806b9a5f8caSJouni Malinen  * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled
2807abe37c4bSJohannes Berg  * @_net: the network namespace this wiphy currently lives in
2808ef15aac6SJohannes Berg  * @perm_addr: permanent MAC address of this device
2809ef15aac6SJohannes Berg  * @addr_mask: If the device supports multiple MAC addresses by masking,
2810ef15aac6SJohannes Berg  *	set this to a mask with variable bits set to 1, e.g. if the last
28110fcf8ac5SLuciano Coelho  *	four bits are variable then set it to 00-00-00-00-00-0f. The actual
2812ef15aac6SJohannes Berg  *	variable bits shall be determined by the interfaces added, with
2813ef15aac6SJohannes Berg  *	interfaces not matching the mask being rejected to be brought up.
2814ef15aac6SJohannes Berg  * @n_addresses: number of addresses in @addresses.
2815ef15aac6SJohannes Berg  * @addresses: If the device has more than one address, set this pointer
2816ef15aac6SJohannes Berg  *	to a list of addresses (6 bytes each). The first one will be used
2817ef15aac6SJohannes Berg  *	by default for perm_addr. In this case, the mask should be set to
2818ef15aac6SJohannes Berg  *	all-zeroes. In this case it is assumed that the device can handle
2819ef15aac6SJohannes Berg  *	the same number of arbitrary MAC addresses.
2820fd235913SRandy Dunlap  * @registered: protects ->resume and ->suspend sysfs callbacks against
2821fd235913SRandy Dunlap  *	unregister hardware
2822abe37c4bSJohannes Berg  * @debugfsdir: debugfs directory used for this wiphy, will be renamed
2823abe37c4bSJohannes Berg  *	automatically on wiphy renames
2824abe37c4bSJohannes Berg  * @dev: (virtual) struct device for this wiphy
28254a711a85SStanislaw Gruszka  * @registered: helps synchronize suspend/resume with wiphy unregister
2826abe37c4bSJohannes Berg  * @wext: wireless extension handlers
2827abe37c4bSJohannes Berg  * @priv: driver private data (sized according to wiphy_new() parameter)
2828abe37c4bSJohannes Berg  * @interface_modes: bitmask of interfaces types valid for this wiphy,
2829abe37c4bSJohannes Berg  *	must be set by driver
28307527a782SJohannes Berg  * @iface_combinations: Valid interface combinations array, should not
28317527a782SJohannes Berg  *	list single interface types.
28327527a782SJohannes Berg  * @n_iface_combinations: number of entries in @iface_combinations array.
28337527a782SJohannes Berg  * @software_iftypes: bitmask of software interface types, these are not
28347527a782SJohannes Berg  *	subject to any restrictions since they are purely managed in SW.
2835abe37c4bSJohannes Berg  * @flags: wiphy flags, see &enum wiphy_flags
2836a2f73b6cSLuis R. Rodriguez  * @regulatory_flags: wiphy regulatory flags, see
2837a2f73b6cSLuis R. Rodriguez  *	&enum ieee80211_regulatory_flags
28381f074bd8SJohannes Berg  * @features: features advertised to nl80211, see &enum nl80211_feature_flags.
2839abe37c4bSJohannes Berg  * @bss_priv_size: each BSS struct has private data allocated with it,
2840abe37c4bSJohannes Berg  *	this variable determines its size
2841abe37c4bSJohannes Berg  * @max_scan_ssids: maximum number of SSIDs the device can scan for in
2842abe37c4bSJohannes Berg  *	any given scan
284393b6aa69SLuciano Coelho  * @max_sched_scan_ssids: maximum number of SSIDs the device can scan
284493b6aa69SLuciano Coelho  *	for in any given scheduled scan
2845a1f1c21cSLuciano Coelho  * @max_match_sets: maximum number of match sets the device can handle
2846a1f1c21cSLuciano Coelho  *	when performing a scheduled scan, 0 if filtering is not
2847a1f1c21cSLuciano Coelho  *	supported.
2848abe37c4bSJohannes Berg  * @max_scan_ie_len: maximum length of user-controlled IEs device can
2849abe37c4bSJohannes Berg  *	add to probe request frames transmitted during a scan, must not
2850abe37c4bSJohannes Berg  *	include fixed IEs like supported rates
28515a865badSLuciano Coelho  * @max_sched_scan_ie_len: same as max_scan_ie_len, but for scheduled
28525a865badSLuciano Coelho  *	scans
2853abe37c4bSJohannes Berg  * @coverage_class: current coverage class
2854abe37c4bSJohannes Berg  * @fw_version: firmware version for ethtool reporting
2855abe37c4bSJohannes Berg  * @hw_version: hardware version for ethtool reporting
2856abe37c4bSJohannes Berg  * @max_num_pmkids: maximum number of PMKIDs supported by device
2857abe37c4bSJohannes Berg  * @privid: a pointer that drivers can use to identify if an arbitrary
2858abe37c4bSJohannes Berg  *	wiphy is theirs, e.g. in global notifiers
2859abe37c4bSJohannes Berg  * @bands: information about bands/channels supported by this device
28602e161f78SJohannes Berg  *
28612e161f78SJohannes Berg  * @mgmt_stypes: bitmasks of frame subtypes that can be subscribed to or
28622e161f78SJohannes Berg  *	transmitted through nl80211, points to an array indexed by interface
28632e161f78SJohannes Berg  *	type
2864a7ffac95SBruno Randolf  *
28657f531e03SBruno Randolf  * @available_antennas_tx: bitmap of antennas which are available to be
28667f531e03SBruno Randolf  *	configured as TX antennas. Antenna configuration commands will be
28677f531e03SBruno Randolf  *	rejected unless this or @available_antennas_rx is set.
28687f531e03SBruno Randolf  *
28697f531e03SBruno Randolf  * @available_antennas_rx: bitmap of antennas which are available to be
28707f531e03SBruno Randolf  *	configured as RX antennas. Antenna configuration commands will be
28717f531e03SBruno Randolf  *	rejected unless this or @available_antennas_tx is set.
2872a293911dSJohannes Berg  *
287315f0ebc2SRandy Dunlap  * @probe_resp_offload:
287415f0ebc2SRandy Dunlap  *	 Bitmap of supported protocols for probe response offloading.
287515f0ebc2SRandy Dunlap  *	 See &enum nl80211_probe_resp_offload_support_attr. Only valid
287615f0ebc2SRandy Dunlap  *	 when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set.
287715f0ebc2SRandy Dunlap  *
2878a293911dSJohannes Berg  * @max_remain_on_channel_duration: Maximum time a remain-on-channel operation
2879a293911dSJohannes Berg  *	may request, if implemented.
2880ff1b6e69SJohannes Berg  *
2881ff1b6e69SJohannes Berg  * @wowlan: WoWLAN support information
28826abb9cb9SJohannes Berg  * @wowlan_config: current WoWLAN configuration; this should usually not be
28836abb9cb9SJohannes Berg  *	used since access to it is necessarily racy, use the parameter passed
28846abb9cb9SJohannes Berg  *	to the suspend() operation instead.
2885562a7480SJohannes Berg  *
2886562a7480SJohannes Berg  * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features.
28877e7c8926SBen Greear  * @ht_capa_mod_mask:  Specify what ht_cap values can be over-ridden.
28887e7c8926SBen Greear  *	If null, then none can be over-ridden.
2889ee2aca34SJohannes Berg  * @vht_capa_mod_mask:  Specify what VHT capabilities can be over-ridden.
2890ee2aca34SJohannes Berg  *	If null, then none can be over-ridden.
289177765eafSVasanthakumar Thiagarajan  *
289277765eafSVasanthakumar Thiagarajan  * @max_acl_mac_addrs: Maximum number of MAC addresses that the device
289377765eafSVasanthakumar Thiagarajan  *	supports for ACL.
2894a50df0c4SJohannes Berg  *
2895a50df0c4SJohannes Berg  * @extended_capabilities: extended capabilities supported by the driver,
2896a50df0c4SJohannes Berg  *	additional capabilities might be supported by userspace; these are
2897a50df0c4SJohannes Berg  *	the 802.11 extended capabilities ("Extended Capabilities element")
2898a50df0c4SJohannes Berg  *	and are in the same format as in the information element. See
2899a50df0c4SJohannes Berg  *	802.11-2012 8.4.2.29 for the defined fields.
2900a50df0c4SJohannes Berg  * @extended_capabilities_mask: mask of the valid values
2901a50df0c4SJohannes Berg  * @extended_capabilities_len: length of the extended capabilities
2902be29b99aSAmitkumar Karwar  * @coalesce: packet coalescing support information
2903ad7e718cSJohannes Berg  *
2904ad7e718cSJohannes Berg  * @vendor_commands: array of vendor commands supported by the hardware
2905ad7e718cSJohannes Berg  * @n_vendor_commands: number of vendor commands
2906567ffc35SJohannes Berg  * @vendor_events: array of vendor events supported by the hardware
2907567ffc35SJohannes Berg  * @n_vendor_events: number of vendor events
2908b43504cfSJouni Malinen  *
2909b43504cfSJouni Malinen  * @max_ap_assoc_sta: maximum number of associated stations supported in AP mode
2910b43504cfSJouni Malinen  *	(including P2P GO) or 0 to indicate no such limit is advertised. The
2911b43504cfSJouni Malinen  *	driver is allowed to advertise a theoretical limit that it can reach in
2912b43504cfSJouni Malinen  *	some cases, but may not always reach.
2913d3236553SJohannes Berg  */
2914d3236553SJohannes Berg struct wiphy {
2915d3236553SJohannes Berg 	/* assign these fields before you register the wiphy */
2916d3236553SJohannes Berg 
2917ef15aac6SJohannes Berg 	/* permanent MAC address(es) */
2918d3236553SJohannes Berg 	u8 perm_addr[ETH_ALEN];
2919ef15aac6SJohannes Berg 	u8 addr_mask[ETH_ALEN];
2920ef15aac6SJohannes Berg 
2921ef15aac6SJohannes Berg 	struct mac_address *addresses;
2922d3236553SJohannes Berg 
29232e161f78SJohannes Berg 	const struct ieee80211_txrx_stypes *mgmt_stypes;
29242e161f78SJohannes Berg 
29257527a782SJohannes Berg 	const struct ieee80211_iface_combination *iface_combinations;
29267527a782SJohannes Berg 	int n_iface_combinations;
29277527a782SJohannes Berg 	u16 software_iftypes;
29287527a782SJohannes Berg 
29292e161f78SJohannes Berg 	u16 n_addresses;
29302e161f78SJohannes Berg 
2931d3236553SJohannes Berg 	/* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
2932d3236553SJohannes Berg 	u16 interface_modes;
2933d3236553SJohannes Berg 
293477765eafSVasanthakumar Thiagarajan 	u16 max_acl_mac_addrs;
293577765eafSVasanthakumar Thiagarajan 
2936a2f73b6cSLuis R. Rodriguez 	u32 flags, regulatory_flags, features;
2937463d0183SJohannes Berg 
2938562a7480SJohannes Berg 	u32 ap_sme_capa;
2939562a7480SJohannes Berg 
2940d3236553SJohannes Berg 	enum cfg80211_signal_type signal_type;
2941d3236553SJohannes Berg 
2942d3236553SJohannes Berg 	int bss_priv_size;
2943d3236553SJohannes Berg 	u8 max_scan_ssids;
294493b6aa69SLuciano Coelho 	u8 max_sched_scan_ssids;
2945a1f1c21cSLuciano Coelho 	u8 max_match_sets;
2946d3236553SJohannes Berg 	u16 max_scan_ie_len;
29475a865badSLuciano Coelho 	u16 max_sched_scan_ie_len;
2948d3236553SJohannes Berg 
2949d3236553SJohannes Berg 	int n_cipher_suites;
2950d3236553SJohannes Berg 	const u32 *cipher_suites;
2951d3236553SJohannes Berg 
2952b9a5f8caSJouni Malinen 	u8 retry_short;
2953b9a5f8caSJouni Malinen 	u8 retry_long;
2954b9a5f8caSJouni Malinen 	u32 frag_threshold;
2955b9a5f8caSJouni Malinen 	u32 rts_threshold;
295681077e82SLukáš Turek 	u8 coverage_class;
2957b9a5f8caSJouni Malinen 
295881135548SJiri Pirko 	char fw_version[ETHTOOL_FWVERS_LEN];
2959dfce95f5SKalle Valo 	u32 hw_version;
2960dfce95f5SKalle Valo 
2961dfb89c56SJohannes Berg #ifdef CONFIG_PM
2962964dc9e2SJohannes Berg 	const struct wiphy_wowlan_support *wowlan;
29636abb9cb9SJohannes Berg 	struct cfg80211_wowlan *wowlan_config;
2964dfb89c56SJohannes Berg #endif
2965ff1b6e69SJohannes Berg 
2966a293911dSJohannes Berg 	u16 max_remain_on_channel_duration;
2967a293911dSJohannes Berg 
296867fbb16bSSamuel Ortiz 	u8 max_num_pmkids;
296967fbb16bSSamuel Ortiz 
29707f531e03SBruno Randolf 	u32 available_antennas_tx;
29717f531e03SBruno Randolf 	u32 available_antennas_rx;
2972a7ffac95SBruno Randolf 
297387bbbe22SArik Nemtsov 	/*
297487bbbe22SArik Nemtsov 	 * Bitmap of supported protocols for probe response offloading
297587bbbe22SArik Nemtsov 	 * see &enum nl80211_probe_resp_offload_support_attr. Only valid
297687bbbe22SArik Nemtsov 	 * when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set.
297787bbbe22SArik Nemtsov 	 */
297887bbbe22SArik Nemtsov 	u32 probe_resp_offload;
297987bbbe22SArik Nemtsov 
2980a50df0c4SJohannes Berg 	const u8 *extended_capabilities, *extended_capabilities_mask;
2981a50df0c4SJohannes Berg 	u8 extended_capabilities_len;
2982a50df0c4SJohannes Berg 
2983d3236553SJohannes Berg 	/* If multiple wiphys are registered and you're handed e.g.
2984d3236553SJohannes Berg 	 * a regular netdev with assigned ieee80211_ptr, you won't
2985d3236553SJohannes Berg 	 * know whether it points to a wiphy your driver has registered
2986d3236553SJohannes Berg 	 * or not. Assign this to something global to your driver to
2987d3236553SJohannes Berg 	 * help determine whether you own this wiphy or not. */
2988cf5aa2f1SDavid Kilroy 	const void *privid;
2989d3236553SJohannes Berg 
2990d3236553SJohannes Berg 	struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS];
2991d3236553SJohannes Berg 
2992d3236553SJohannes Berg 	/* Lets us get back the wiphy on the callback */
29930c0280bdSLuis R. Rodriguez 	void (*reg_notifier)(struct wiphy *wiphy,
2994d3236553SJohannes Berg 			     struct regulatory_request *request);
2995d3236553SJohannes Berg 
2996d3236553SJohannes Berg 	/* fields below are read-only, assigned by cfg80211 */
2997d3236553SJohannes Berg 
2998458f4f9eSJohannes Berg 	const struct ieee80211_regdomain __rcu *regd;
2999d3236553SJohannes Berg 
3000d3236553SJohannes Berg 	/* the item in /sys/class/ieee80211/ points to this,
3001d3236553SJohannes Berg 	 * you need use set_wiphy_dev() (see below) */
3002d3236553SJohannes Berg 	struct device dev;
3003d3236553SJohannes Berg 
3004ecb44335SStanislaw Gruszka 	/* protects ->resume, ->suspend sysfs callbacks against unregister hw */
3005ecb44335SStanislaw Gruszka 	bool registered;
3006ecb44335SStanislaw Gruszka 
3007d3236553SJohannes Berg 	/* dir in debugfs: ieee80211/<wiphyname> */
3008d3236553SJohannes Berg 	struct dentry *debugfsdir;
3009d3236553SJohannes Berg 
30107e7c8926SBen Greear 	const struct ieee80211_ht_cap *ht_capa_mod_mask;
3011ee2aca34SJohannes Berg 	const struct ieee80211_vht_cap *vht_capa_mod_mask;
30127e7c8926SBen Greear 
3013463d0183SJohannes Berg #ifdef CONFIG_NET_NS
3014463d0183SJohannes Berg 	/* the network namespace this phy lives in currently */
3015463d0183SJohannes Berg 	struct net *_net;
3016463d0183SJohannes Berg #endif
3017463d0183SJohannes Berg 
30183d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT
30193d23e349SJohannes Berg 	const struct iw_handler_def *wext;
30203d23e349SJohannes Berg #endif
30213d23e349SJohannes Berg 
3022be29b99aSAmitkumar Karwar 	const struct wiphy_coalesce_support *coalesce;
3023be29b99aSAmitkumar Karwar 
3024ad7e718cSJohannes Berg 	const struct wiphy_vendor_command *vendor_commands;
3025567ffc35SJohannes Berg 	const struct nl80211_vendor_cmd_info *vendor_events;
3026567ffc35SJohannes Berg 	int n_vendor_commands, n_vendor_events;
3027ad7e718cSJohannes Berg 
3028b43504cfSJouni Malinen 	u16 max_ap_assoc_sta;
3029b43504cfSJouni Malinen 
30301c06ef98SJohannes Berg 	char priv[0] __aligned(NETDEV_ALIGN);
3031d3236553SJohannes Berg };
3032d3236553SJohannes Berg 
3033463d0183SJohannes Berg static inline struct net *wiphy_net(struct wiphy *wiphy)
3034463d0183SJohannes Berg {
3035c2d9ba9bSEric Dumazet 	return read_pnet(&wiphy->_net);
3036463d0183SJohannes Berg }
3037463d0183SJohannes Berg 
3038463d0183SJohannes Berg static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net)
3039463d0183SJohannes Berg {
3040c2d9ba9bSEric Dumazet 	write_pnet(&wiphy->_net, net);
3041463d0183SJohannes Berg }
3042463d0183SJohannes Berg 
3043d3236553SJohannes Berg /**
3044d3236553SJohannes Berg  * wiphy_priv - return priv from wiphy
3045d3236553SJohannes Berg  *
3046d3236553SJohannes Berg  * @wiphy: the wiphy whose priv pointer to return
30470ae997dcSYacine Belkadi  * Return: The priv of @wiphy.
3048d3236553SJohannes Berg  */
3049d3236553SJohannes Berg static inline void *wiphy_priv(struct wiphy *wiphy)
3050d3236553SJohannes Berg {
3051d3236553SJohannes Berg 	BUG_ON(!wiphy);
3052d3236553SJohannes Berg 	return &wiphy->priv;
3053d3236553SJohannes Berg }
3054d3236553SJohannes Berg 
3055d3236553SJohannes Berg /**
3056f1f74825SDavid Kilroy  * priv_to_wiphy - return the wiphy containing the priv
3057f1f74825SDavid Kilroy  *
3058f1f74825SDavid Kilroy  * @priv: a pointer previously returned by wiphy_priv
30590ae997dcSYacine Belkadi  * Return: The wiphy of @priv.
3060f1f74825SDavid Kilroy  */
3061f1f74825SDavid Kilroy static inline struct wiphy *priv_to_wiphy(void *priv)
3062f1f74825SDavid Kilroy {
3063f1f74825SDavid Kilroy 	BUG_ON(!priv);
3064f1f74825SDavid Kilroy 	return container_of(priv, struct wiphy, priv);
3065f1f74825SDavid Kilroy }
3066f1f74825SDavid Kilroy 
3067f1f74825SDavid Kilroy /**
3068d3236553SJohannes Berg  * set_wiphy_dev - set device pointer for wiphy
3069d3236553SJohannes Berg  *
3070d3236553SJohannes Berg  * @wiphy: The wiphy whose device to bind
3071d3236553SJohannes Berg  * @dev: The device to parent it to
3072d3236553SJohannes Berg  */
3073d3236553SJohannes Berg static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev)
3074d3236553SJohannes Berg {
3075d3236553SJohannes Berg 	wiphy->dev.parent = dev;
3076d3236553SJohannes Berg }
3077d3236553SJohannes Berg 
3078d3236553SJohannes Berg /**
3079d3236553SJohannes Berg  * wiphy_dev - get wiphy dev pointer
3080d3236553SJohannes Berg  *
3081d3236553SJohannes Berg  * @wiphy: The wiphy whose device struct to look up
30820ae997dcSYacine Belkadi  * Return: The dev of @wiphy.
3083d3236553SJohannes Berg  */
3084d3236553SJohannes Berg static inline struct device *wiphy_dev(struct wiphy *wiphy)
3085d3236553SJohannes Berg {
3086d3236553SJohannes Berg 	return wiphy->dev.parent;
3087d3236553SJohannes Berg }
3088d3236553SJohannes Berg 
3089d3236553SJohannes Berg /**
3090d3236553SJohannes Berg  * wiphy_name - get wiphy name
3091d3236553SJohannes Berg  *
3092d3236553SJohannes Berg  * @wiphy: The wiphy whose name to return
30930ae997dcSYacine Belkadi  * Return: The name of @wiphy.
3094d3236553SJohannes Berg  */
3095e1db74fcSJoe Perches static inline const char *wiphy_name(const struct wiphy *wiphy)
3096d3236553SJohannes Berg {
3097d3236553SJohannes Berg 	return dev_name(&wiphy->dev);
3098d3236553SJohannes Berg }
3099d3236553SJohannes Berg 
3100d3236553SJohannes Berg /**
3101d3236553SJohannes Berg  * wiphy_new - create a new wiphy for use with cfg80211
3102d3236553SJohannes Berg  *
3103d3236553SJohannes Berg  * @ops: The configuration operations for this device
3104d3236553SJohannes Berg  * @sizeof_priv: The size of the private area to allocate
3105d3236553SJohannes Berg  *
3106d3236553SJohannes Berg  * Create a new wiphy and associate the given operations with it.
3107d3236553SJohannes Berg  * @sizeof_priv bytes are allocated for private use.
3108d3236553SJohannes Berg  *
31090ae997dcSYacine Belkadi  * Return: A pointer to the new wiphy. This pointer must be
31100ae997dcSYacine Belkadi  * assigned to each netdev's ieee80211_ptr for proper operation.
3111d3236553SJohannes Berg  */
31123dcf670bSDavid Kilroy struct wiphy *wiphy_new(const struct cfg80211_ops *ops, int sizeof_priv);
3113d3236553SJohannes Berg 
3114d3236553SJohannes Berg /**
3115d3236553SJohannes Berg  * wiphy_register - register a wiphy with cfg80211
3116d3236553SJohannes Berg  *
3117d3236553SJohannes Berg  * @wiphy: The wiphy to register.
3118d3236553SJohannes Berg  *
31190ae997dcSYacine Belkadi  * Return: A non-negative wiphy index or a negative error code.
3120d3236553SJohannes Berg  */
312110dd9b7cSJoe Perches int wiphy_register(struct wiphy *wiphy);
3122d3236553SJohannes Berg 
3123d3236553SJohannes Berg /**
3124d3236553SJohannes Berg  * wiphy_unregister - deregister a wiphy from cfg80211
3125d3236553SJohannes Berg  *
3126d3236553SJohannes Berg  * @wiphy: The wiphy to unregister.
3127d3236553SJohannes Berg  *
3128d3236553SJohannes Berg  * After this call, no more requests can be made with this priv
3129d3236553SJohannes Berg  * pointer, but the call may sleep to wait for an outstanding
3130d3236553SJohannes Berg  * request that is being handled.
3131d3236553SJohannes Berg  */
313210dd9b7cSJoe Perches void wiphy_unregister(struct wiphy *wiphy);
3133d3236553SJohannes Berg 
3134d3236553SJohannes Berg /**
3135d3236553SJohannes Berg  * wiphy_free - free wiphy
3136d3236553SJohannes Berg  *
3137d3236553SJohannes Berg  * @wiphy: The wiphy to free
3138d3236553SJohannes Berg  */
313910dd9b7cSJoe Perches void wiphy_free(struct wiphy *wiphy);
3140d3236553SJohannes Berg 
3141fffd0934SJohannes Berg /* internal structs */
31426829c878SJohannes Berg struct cfg80211_conn;
314319957bb3SJohannes Berg struct cfg80211_internal_bss;
3144fffd0934SJohannes Berg struct cfg80211_cached_keys;
314519957bb3SJohannes Berg 
3146d3236553SJohannes Berg /**
314789a54e48SJohannes Berg  * struct wireless_dev - wireless device state
3148d3236553SJohannes Berg  *
314989a54e48SJohannes Berg  * For netdevs, this structure must be allocated by the driver
315089a54e48SJohannes Berg  * that uses the ieee80211_ptr field in struct net_device (this
315189a54e48SJohannes Berg  * is intentional so it can be allocated along with the netdev.)
315289a54e48SJohannes Berg  * It need not be registered then as netdev registration will
315389a54e48SJohannes Berg  * be intercepted by cfg80211 to see the new wireless device.
315489a54e48SJohannes Berg  *
315589a54e48SJohannes Berg  * For non-netdev uses, it must also be allocated by the driver
315689a54e48SJohannes Berg  * in response to the cfg80211 callbacks that require it, as
315789a54e48SJohannes Berg  * there's no netdev registration in that case it may not be
315889a54e48SJohannes Berg  * allocated outside of callback operations that return it.
3159d3236553SJohannes Berg  *
3160d3236553SJohannes Berg  * @wiphy: pointer to hardware description
3161d3236553SJohannes Berg  * @iftype: interface type
3162d3236553SJohannes Berg  * @list: (private) Used to collect the interfaces
316389a54e48SJohannes Berg  * @netdev: (private) Used to reference back to the netdev, may be %NULL
316489a54e48SJohannes Berg  * @identifier: (private) Identifier used in nl80211 to identify this
316589a54e48SJohannes Berg  *	wireless device if it has no netdev
3166d3236553SJohannes Berg  * @current_bss: (private) Used by the internal configuration code
31679e0e2961SMichal Kazior  * @chandef: (private) Used by the internal configuration code to track
31689e0e2961SMichal Kazior  *	the user-set channel definition.
3169780b40dfSJohannes Berg  * @preset_chandef: (private) Used by the internal configuration code to
3170aa430da4SJohannes Berg  *	track the channel to be used for AP later
3171d3236553SJohannes Berg  * @bssid: (private) Used by the internal configuration code
3172d3236553SJohannes Berg  * @ssid: (private) Used by the internal configuration code
3173d3236553SJohannes Berg  * @ssid_len: (private) Used by the internal configuration code
317429cbe68cSJohannes Berg  * @mesh_id_len: (private) Used by the internal configuration code
317529cbe68cSJohannes Berg  * @mesh_id_up_len: (private) Used by the internal configuration code
3176d3236553SJohannes Berg  * @wext: (private) Used by the internal wireless extensions compat code
31779bc383deSJohannes Berg  * @use_4addr: indicates 4addr mode is used on this interface, must be
31789bc383deSJohannes Berg  *	set by driver (if supported) on add_interface BEFORE registering the
31799bc383deSJohannes Berg  *	netdev and may otherwise be used by driver read-only, will be update
31809bc383deSJohannes Berg  *	by cfg80211 on change_interface
31812e161f78SJohannes Berg  * @mgmt_registrations: list of registrations for management frames
31822e161f78SJohannes Berg  * @mgmt_registrations_lock: lock for the list
31838d61ffa5SJohannes Berg  * @mtx: mutex used to lock data in this struct, may be used by drivers
31848d61ffa5SJohannes Berg  *	and some API functions require it held
318556d1893dSJohannes Berg  * @beacon_interval: beacon interval used on this device for transmitting
318656d1893dSJohannes Berg  *	beacons, 0 when not valid
318798104fdeSJohannes Berg  * @address: The address for this device, valid only if @netdev is %NULL
318898104fdeSJohannes Berg  * @p2p_started: true if this is a P2P Device that has been started
318904f39047SSimon Wunderlich  * @cac_started: true if DFS channel availability check has been started
319004f39047SSimon Wunderlich  * @cac_start_time: timestamp (jiffies) when the dfs state was entered.
319131559f35SJanusz Dziedzic  * @cac_time_ms: CAC time in ms
3192780b40dfSJohannes Berg  * @ps: powersave mode is enabled
3193780b40dfSJohannes Berg  * @ps_timeout: dynamic powersave timeout
3194780b40dfSJohannes Berg  * @ap_unexpected_nlportid: (private) netlink port ID of application
3195780b40dfSJohannes Berg  *	registered for unexpected class 3 frames (AP mode)
3196780b40dfSJohannes Berg  * @conn: (private) cfg80211 software SME connection state machine data
3197780b40dfSJohannes Berg  * @connect_keys: (private) keys to set after connection is established
3198780b40dfSJohannes Berg  * @ibss_fixed: (private) IBSS is using fixed BSSID
31995336fa88SSimon Wunderlich  * @ibss_dfs_possible: (private) IBSS may change to a DFS channel
3200780b40dfSJohannes Berg  * @event_list: (private) list for internal event processing
3201780b40dfSJohannes Berg  * @event_lock: (private) lock for event list
320278f22b6aSJohannes Berg  * @owner_nlportid: (private) owner socket port ID
3203d3236553SJohannes Berg  */
3204d3236553SJohannes Berg struct wireless_dev {
3205d3236553SJohannes Berg 	struct wiphy *wiphy;
3206d3236553SJohannes Berg 	enum nl80211_iftype iftype;
3207d3236553SJohannes Berg 
3208667503ddSJohannes Berg 	/* the remainder of this struct should be private to cfg80211 */
3209d3236553SJohannes Berg 	struct list_head list;
3210d3236553SJohannes Berg 	struct net_device *netdev;
3211d3236553SJohannes Berg 
321289a54e48SJohannes Berg 	u32 identifier;
321389a54e48SJohannes Berg 
32142e161f78SJohannes Berg 	struct list_head mgmt_registrations;
32152e161f78SJohannes Berg 	spinlock_t mgmt_registrations_lock;
3216026331c4SJouni Malinen 
3217667503ddSJohannes Berg 	struct mutex mtx;
3218667503ddSJohannes Berg 
321998104fdeSJohannes Berg 	bool use_4addr, p2p_started;
322098104fdeSJohannes Berg 
322198104fdeSJohannes Berg 	u8 address[ETH_ALEN] __aligned(sizeof(u16));
32229bc383deSJohannes Berg 
3223b23aa676SSamuel Ortiz 	/* currently used for IBSS and SME - might be rearranged later */
3224d3236553SJohannes Berg 	u8 ssid[IEEE80211_MAX_SSID_LEN];
322529cbe68cSJohannes Berg 	u8 ssid_len, mesh_id_len, mesh_id_up_len;
32266829c878SJohannes Berg 	struct cfg80211_conn *conn;
3227fffd0934SJohannes Berg 	struct cfg80211_cached_keys *connect_keys;
3228d3236553SJohannes Berg 
3229667503ddSJohannes Berg 	struct list_head event_list;
3230667503ddSJohannes Berg 	spinlock_t event_lock;
3231667503ddSJohannes Berg 
323219957bb3SJohannes Berg 	struct cfg80211_internal_bss *current_bss; /* associated / joined */
3233683b6d3bSJohannes Berg 	struct cfg80211_chan_def preset_chandef;
32349e0e2961SMichal Kazior 	struct cfg80211_chan_def chandef;
3235f4489ebeSMichal Kazior 
3236c30a3d38SMichal Kazior 	bool ibss_fixed;
32375336fa88SSimon Wunderlich 	bool ibss_dfs_possible;
3238c30a3d38SMichal Kazior 
3239ffb9eb3dSKalle Valo 	bool ps;
3240ffb9eb3dSKalle Valo 	int ps_timeout;
3241ffb9eb3dSKalle Valo 
324256d1893dSJohannes Berg 	int beacon_interval;
324356d1893dSJohannes Berg 
324415e47304SEric W. Biederman 	u32 ap_unexpected_nlportid;
324528946da7SJohannes Berg 
324604f39047SSimon Wunderlich 	bool cac_started;
324704f39047SSimon Wunderlich 	unsigned long cac_start_time;
324831559f35SJanusz Dziedzic 	unsigned int cac_time_ms;
324904f39047SSimon Wunderlich 
325078f22b6aSJohannes Berg 	u32 owner_nlportid;
325178f22b6aSJohannes Berg 
32523d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT
3253d3236553SJohannes Berg 	/* wext data */
3254cbe8fa9cSJohannes Berg 	struct {
3255cbe8fa9cSJohannes Berg 		struct cfg80211_ibss_params ibss;
3256f2129354SJohannes Berg 		struct cfg80211_connect_params connect;
3257fffd0934SJohannes Berg 		struct cfg80211_cached_keys *keys;
3258f2129354SJohannes Berg 		u8 *ie;
3259f2129354SJohannes Berg 		size_t ie_len;
3260f401a6f7SJohannes Berg 		u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN];
3261f2129354SJohannes Berg 		u8 ssid[IEEE80211_MAX_SSID_LEN];
326208645126SJohannes Berg 		s8 default_key, default_mgmt_key;
3263ffb9eb3dSKalle Valo 		bool prev_bssid_valid;
3264cbe8fa9cSJohannes Berg 	} wext;
3265d3236553SJohannes Berg #endif
3266d3236553SJohannes Berg };
3267d3236553SJohannes Berg 
326898104fdeSJohannes Berg static inline u8 *wdev_address(struct wireless_dev *wdev)
326998104fdeSJohannes Berg {
327098104fdeSJohannes Berg 	if (wdev->netdev)
327198104fdeSJohannes Berg 		return wdev->netdev->dev_addr;
327298104fdeSJohannes Berg 	return wdev->address;
327398104fdeSJohannes Berg }
327498104fdeSJohannes Berg 
3275d3236553SJohannes Berg /**
3276d3236553SJohannes Berg  * wdev_priv - return wiphy priv from wireless_dev
3277d3236553SJohannes Berg  *
3278d3236553SJohannes Berg  * @wdev: The wireless device whose wiphy's priv pointer to return
32790ae997dcSYacine Belkadi  * Return: The wiphy priv of @wdev.
3280d3236553SJohannes Berg  */
3281d3236553SJohannes Berg static inline void *wdev_priv(struct wireless_dev *wdev)
3282d3236553SJohannes Berg {
3283d3236553SJohannes Berg 	BUG_ON(!wdev);
3284d3236553SJohannes Berg 	return wiphy_priv(wdev->wiphy);
3285d3236553SJohannes Berg }
3286d3236553SJohannes Berg 
3287d70e9693SJohannes Berg /**
3288d70e9693SJohannes Berg  * DOC: Utility functions
3289d70e9693SJohannes Berg  *
3290d70e9693SJohannes Berg  * cfg80211 offers a number of utility functions that can be useful.
3291d3236553SJohannes Berg  */
3292d3236553SJohannes Berg 
3293d3236553SJohannes Berg /**
3294d3236553SJohannes Berg  * ieee80211_channel_to_frequency - convert channel number to frequency
3295abe37c4bSJohannes Berg  * @chan: channel number
329659eb21a6SBruno Randolf  * @band: band, necessary due to channel number overlap
32970ae997dcSYacine Belkadi  * Return: The corresponding frequency (in MHz), or 0 if the conversion failed.
3298d3236553SJohannes Berg  */
329910dd9b7cSJoe Perches int ieee80211_channel_to_frequency(int chan, enum ieee80211_band band);
3300d3236553SJohannes Berg 
3301d3236553SJohannes Berg /**
3302d3236553SJohannes Berg  * ieee80211_frequency_to_channel - convert frequency to channel number
3303abe37c4bSJohannes Berg  * @freq: center frequency
33040ae997dcSYacine Belkadi  * Return: The corresponding channel, or 0 if the conversion failed.
3305d3236553SJohannes Berg  */
330610dd9b7cSJoe Perches int ieee80211_frequency_to_channel(int freq);
3307d3236553SJohannes Berg 
3308d3236553SJohannes Berg /*
3309d3236553SJohannes Berg  * Name indirection necessary because the ieee80211 code also has
3310d3236553SJohannes Berg  * a function named "ieee80211_get_channel", so if you include
3311d3236553SJohannes Berg  * cfg80211's header file you get cfg80211's version, if you try
3312d3236553SJohannes Berg  * to include both header files you'll (rightfully!) get a symbol
3313d3236553SJohannes Berg  * clash.
3314d3236553SJohannes Berg  */
331510dd9b7cSJoe Perches struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy,
3316d3236553SJohannes Berg 						  int freq);
3317d3236553SJohannes Berg /**
3318d3236553SJohannes Berg  * ieee80211_get_channel - get channel struct from wiphy for specified frequency
3319abe37c4bSJohannes Berg  * @wiphy: the struct wiphy to get the channel for
3320abe37c4bSJohannes Berg  * @freq: the center frequency of the channel
33210ae997dcSYacine Belkadi  * Return: The channel struct from @wiphy at @freq.
3322d3236553SJohannes Berg  */
3323d3236553SJohannes Berg static inline struct ieee80211_channel *
3324d3236553SJohannes Berg ieee80211_get_channel(struct wiphy *wiphy, int freq)
3325d3236553SJohannes Berg {
3326d3236553SJohannes Berg 	return __ieee80211_get_channel(wiphy, freq);
3327d3236553SJohannes Berg }
3328d3236553SJohannes Berg 
3329d3236553SJohannes Berg /**
3330d3236553SJohannes Berg  * ieee80211_get_response_rate - get basic rate for a given rate
3331d3236553SJohannes Berg  *
3332d3236553SJohannes Berg  * @sband: the band to look for rates in
3333d3236553SJohannes Berg  * @basic_rates: bitmap of basic rates
3334d3236553SJohannes Berg  * @bitrate: the bitrate for which to find the basic rate
3335d3236553SJohannes Berg  *
33360ae997dcSYacine Belkadi  * Return: The basic rate corresponding to a given bitrate, that
33370ae997dcSYacine Belkadi  * is the next lower bitrate contained in the basic rate map,
33380ae997dcSYacine Belkadi  * which is, for this function, given as a bitmap of indices of
33390ae997dcSYacine Belkadi  * rates in the band's bitrate table.
3340d3236553SJohannes Berg  */
3341d3236553SJohannes Berg struct ieee80211_rate *
3342d3236553SJohannes Berg ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
3343d3236553SJohannes Berg 			    u32 basic_rates, int bitrate);
3344d3236553SJohannes Berg 
3345b422c6cdSAshok Nagarajan /**
3346b422c6cdSAshok Nagarajan  * ieee80211_mandatory_rates - get mandatory rates for a given band
3347b422c6cdSAshok Nagarajan  * @sband: the band to look for rates in
334874608acaSSimon Wunderlich  * @scan_width: width of the control channel
3349b422c6cdSAshok Nagarajan  *
3350b422c6cdSAshok Nagarajan  * This function returns a bitmap of the mandatory rates for the given
3351b422c6cdSAshok Nagarajan  * band, bits are set according to the rate position in the bitrates array.
3352b422c6cdSAshok Nagarajan  */
335374608acaSSimon Wunderlich u32 ieee80211_mandatory_rates(struct ieee80211_supported_band *sband,
335474608acaSSimon Wunderlich 			      enum nl80211_bss_scan_width scan_width);
3355b422c6cdSAshok Nagarajan 
3356d3236553SJohannes Berg /*
3357d3236553SJohannes Berg  * Radiotap parsing functions -- for controlled injection support
3358d3236553SJohannes Berg  *
3359d3236553SJohannes Berg  * Implemented in net/wireless/radiotap.c
3360d3236553SJohannes Berg  * Documentation in Documentation/networking/radiotap-headers.txt
3361d3236553SJohannes Berg  */
3362d3236553SJohannes Berg 
336333e5a2f7SJohannes Berg struct radiotap_align_size {
336433e5a2f7SJohannes Berg 	uint8_t align:4, size:4;
336533e5a2f7SJohannes Berg };
336633e5a2f7SJohannes Berg 
336733e5a2f7SJohannes Berg struct ieee80211_radiotap_namespace {
336833e5a2f7SJohannes Berg 	const struct radiotap_align_size *align_size;
336933e5a2f7SJohannes Berg 	int n_bits;
337033e5a2f7SJohannes Berg 	uint32_t oui;
337133e5a2f7SJohannes Berg 	uint8_t subns;
337233e5a2f7SJohannes Berg };
337333e5a2f7SJohannes Berg 
337433e5a2f7SJohannes Berg struct ieee80211_radiotap_vendor_namespaces {
337533e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_namespace *ns;
337633e5a2f7SJohannes Berg 	int n_ns;
337733e5a2f7SJohannes Berg };
337833e5a2f7SJohannes Berg 
3379d3236553SJohannes Berg /**
3380d3236553SJohannes Berg  * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args
338133e5a2f7SJohannes Berg  * @this_arg_index: index of current arg, valid after each successful call
338233e5a2f7SJohannes Berg  *	to ieee80211_radiotap_iterator_next()
338333e5a2f7SJohannes Berg  * @this_arg: pointer to current radiotap arg; it is valid after each
338433e5a2f7SJohannes Berg  *	call to ieee80211_radiotap_iterator_next() but also after
338533e5a2f7SJohannes Berg  *	ieee80211_radiotap_iterator_init() where it will point to
338633e5a2f7SJohannes Berg  *	the beginning of the actual data portion
338733e5a2f7SJohannes Berg  * @this_arg_size: length of the current arg, for convenience
338833e5a2f7SJohannes Berg  * @current_namespace: pointer to the current namespace definition
338933e5a2f7SJohannes Berg  *	(or internally %NULL if the current namespace is unknown)
339033e5a2f7SJohannes Berg  * @is_radiotap_ns: indicates whether the current namespace is the default
339133e5a2f7SJohannes Berg  *	radiotap namespace or not
339233e5a2f7SJohannes Berg  *
339333e5a2f7SJohannes Berg  * @_rtheader: pointer to the radiotap header we are walking through
339433e5a2f7SJohannes Berg  * @_max_length: length of radiotap header in cpu byte ordering
339533e5a2f7SJohannes Berg  * @_arg_index: next argument index
339633e5a2f7SJohannes Berg  * @_arg: next argument pointer
339733e5a2f7SJohannes Berg  * @_next_bitmap: internal pointer to next present u32
339833e5a2f7SJohannes Berg  * @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present
339933e5a2f7SJohannes Berg  * @_vns: vendor namespace definitions
340033e5a2f7SJohannes Berg  * @_next_ns_data: beginning of the next namespace's data
340133e5a2f7SJohannes Berg  * @_reset_on_ext: internal; reset the arg index to 0 when going to the
340233e5a2f7SJohannes Berg  *	next bitmap word
340333e5a2f7SJohannes Berg  *
340433e5a2f7SJohannes Berg  * Describes the radiotap parser state. Fields prefixed with an underscore
340533e5a2f7SJohannes Berg  * must not be used by users of the parser, only by the parser internally.
3406d3236553SJohannes Berg  */
3407d3236553SJohannes Berg 
3408d3236553SJohannes Berg struct ieee80211_radiotap_iterator {
340933e5a2f7SJohannes Berg 	struct ieee80211_radiotap_header *_rtheader;
341033e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_vendor_namespaces *_vns;
341133e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_namespace *current_namespace;
3412d3236553SJohannes Berg 
341333e5a2f7SJohannes Berg 	unsigned char *_arg, *_next_ns_data;
341467272440SJohannes Berg 	__le32 *_next_bitmap;
341533e5a2f7SJohannes Berg 
341633e5a2f7SJohannes Berg 	unsigned char *this_arg;
341733e5a2f7SJohannes Berg 	int this_arg_index;
341833e5a2f7SJohannes Berg 	int this_arg_size;
341933e5a2f7SJohannes Berg 
342033e5a2f7SJohannes Berg 	int is_radiotap_ns;
342133e5a2f7SJohannes Berg 
342233e5a2f7SJohannes Berg 	int _max_length;
342333e5a2f7SJohannes Berg 	int _arg_index;
342433e5a2f7SJohannes Berg 	uint32_t _bitmap_shifter;
342533e5a2f7SJohannes Berg 	int _reset_on_ext;
3426d3236553SJohannes Berg };
3427d3236553SJohannes Berg 
342810dd9b7cSJoe Perches int
342910dd9b7cSJoe Perches ieee80211_radiotap_iterator_init(struct ieee80211_radiotap_iterator *iterator,
3430d3236553SJohannes Berg 				 struct ieee80211_radiotap_header *radiotap_header,
343110dd9b7cSJoe Perches 				 int max_length,
343210dd9b7cSJoe Perches 				 const struct ieee80211_radiotap_vendor_namespaces *vns);
3433d3236553SJohannes Berg 
343410dd9b7cSJoe Perches int
343510dd9b7cSJoe Perches ieee80211_radiotap_iterator_next(struct ieee80211_radiotap_iterator *iterator);
3436d3236553SJohannes Berg 
343733e5a2f7SJohannes Berg 
3438e31a16d6SZhu Yi extern const unsigned char rfc1042_header[6];
3439e31a16d6SZhu Yi extern const unsigned char bridge_tunnel_header[6];
3440e31a16d6SZhu Yi 
3441e31a16d6SZhu Yi /**
3442e31a16d6SZhu Yi  * ieee80211_get_hdrlen_from_skb - get header length from data
3443e31a16d6SZhu Yi  *
3444e31a16d6SZhu Yi  * @skb: the frame
34450ae997dcSYacine Belkadi  *
34460ae997dcSYacine Belkadi  * Given an skb with a raw 802.11 header at the data pointer this function
34470ae997dcSYacine Belkadi  * returns the 802.11 header length.
34480ae997dcSYacine Belkadi  *
34490ae997dcSYacine Belkadi  * Return: The 802.11 header length in bytes (not including encryption
34500ae997dcSYacine Belkadi  * headers). Or 0 if the data in the sk_buff is too short to contain a valid
34510ae997dcSYacine Belkadi  * 802.11 header.
3452e31a16d6SZhu Yi  */
3453e31a16d6SZhu Yi unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb);
3454e31a16d6SZhu Yi 
3455e31a16d6SZhu Yi /**
3456e31a16d6SZhu Yi  * ieee80211_hdrlen - get header length in bytes from frame control
3457e31a16d6SZhu Yi  * @fc: frame control field in little-endian format
34580ae997dcSYacine Belkadi  * Return: The header length in bytes.
3459e31a16d6SZhu Yi  */
3460633adf1aSJohannes Berg unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc);
3461e31a16d6SZhu Yi 
3462e31a16d6SZhu Yi /**
34639b395bc3SJohannes Berg  * ieee80211_get_mesh_hdrlen - get mesh extension header length
34649b395bc3SJohannes Berg  * @meshhdr: the mesh extension header, only the flags field
34659b395bc3SJohannes Berg  *	(first byte) will be accessed
34660ae997dcSYacine Belkadi  * Return: The length of the extension header, which is always at
34679b395bc3SJohannes Berg  * least 6 bytes and at most 18 if address 5 and 6 are present.
34689b395bc3SJohannes Berg  */
34699b395bc3SJohannes Berg unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr);
34709b395bc3SJohannes Berg 
34719b395bc3SJohannes Berg /**
3472d70e9693SJohannes Berg  * DOC: Data path helpers
3473d70e9693SJohannes Berg  *
3474d70e9693SJohannes Berg  * In addition to generic utilities, cfg80211 also offers
3475d70e9693SJohannes Berg  * functions that help implement the data path for devices
3476d70e9693SJohannes Berg  * that do not do the 802.11/802.3 conversion on the device.
3477d70e9693SJohannes Berg  */
3478d70e9693SJohannes Berg 
3479d70e9693SJohannes Berg /**
3480e31a16d6SZhu Yi  * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3
3481e31a16d6SZhu Yi  * @skb: the 802.11 data frame
3482e31a16d6SZhu Yi  * @addr: the device MAC address
3483e31a16d6SZhu Yi  * @iftype: the virtual interface type
34840ae997dcSYacine Belkadi  * Return: 0 on success. Non-zero on error.
3485e31a16d6SZhu Yi  */
3486eaf85ca7SZhu Yi int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
3487e31a16d6SZhu Yi 			   enum nl80211_iftype iftype);
3488e31a16d6SZhu Yi 
3489e31a16d6SZhu Yi /**
3490e31a16d6SZhu Yi  * ieee80211_data_from_8023 - convert an 802.3 frame to 802.11
3491e31a16d6SZhu Yi  * @skb: the 802.3 frame
3492e31a16d6SZhu Yi  * @addr: the device MAC address
3493e31a16d6SZhu Yi  * @iftype: the virtual interface type
3494e31a16d6SZhu Yi  * @bssid: the network bssid (used only for iftype STATION and ADHOC)
3495e31a16d6SZhu Yi  * @qos: build 802.11 QoS data frame
34960ae997dcSYacine Belkadi  * Return: 0 on success, or a negative error code.
3497e31a16d6SZhu Yi  */
3498eaf85ca7SZhu Yi int ieee80211_data_from_8023(struct sk_buff *skb, const u8 *addr,
3499e31a16d6SZhu Yi 			     enum nl80211_iftype iftype, u8 *bssid, bool qos);
3500e31a16d6SZhu Yi 
3501e31a16d6SZhu Yi /**
3502eaf85ca7SZhu Yi  * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame
3503eaf85ca7SZhu Yi  *
3504eaf85ca7SZhu Yi  * Decode an IEEE 802.11n A-MSDU frame and convert it to a list of
3505eaf85ca7SZhu Yi  * 802.3 frames. The @list will be empty if the decode fails. The
3506eaf85ca7SZhu Yi  * @skb is consumed after the function returns.
3507eaf85ca7SZhu Yi  *
3508eaf85ca7SZhu Yi  * @skb: The input IEEE 802.11n A-MSDU frame.
3509eaf85ca7SZhu Yi  * @list: The output list of 802.3 frames. It must be allocated and
3510eaf85ca7SZhu Yi  *	initialized by by the caller.
3511eaf85ca7SZhu Yi  * @addr: The device MAC address.
3512eaf85ca7SZhu Yi  * @iftype: The device interface type.
3513eaf85ca7SZhu Yi  * @extra_headroom: The hardware extra headroom for SKBs in the @list.
35148b3becadSYogesh Ashok Powar  * @has_80211_header: Set it true if SKB is with IEEE 802.11 header.
3515eaf85ca7SZhu Yi  */
3516eaf85ca7SZhu Yi void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,
3517eaf85ca7SZhu Yi 			      const u8 *addr, enum nl80211_iftype iftype,
35188b3becadSYogesh Ashok Powar 			      const unsigned int extra_headroom,
35198b3becadSYogesh Ashok Powar 			      bool has_80211_header);
3520eaf85ca7SZhu Yi 
3521eaf85ca7SZhu Yi /**
3522e31a16d6SZhu Yi  * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame
3523e31a16d6SZhu Yi  * @skb: the data frame
3524fa9ffc74SKyeyoon Park  * @qos_map: Interworking QoS mapping or %NULL if not in use
35250ae997dcSYacine Belkadi  * Return: The 802.1p/1d tag.
3526e31a16d6SZhu Yi  */
3527fa9ffc74SKyeyoon Park unsigned int cfg80211_classify8021d(struct sk_buff *skb,
3528fa9ffc74SKyeyoon Park 				    struct cfg80211_qos_map *qos_map);
3529e31a16d6SZhu Yi 
3530c21dbf92SJohannes Berg /**
3531c21dbf92SJohannes Berg  * cfg80211_find_ie - find information element in data
3532c21dbf92SJohannes Berg  *
3533c21dbf92SJohannes Berg  * @eid: element ID
3534c21dbf92SJohannes Berg  * @ies: data consisting of IEs
3535c21dbf92SJohannes Berg  * @len: length of data
3536c21dbf92SJohannes Berg  *
35370ae997dcSYacine Belkadi  * Return: %NULL if the element ID could not be found or if
35380ae997dcSYacine Belkadi  * the element is invalid (claims to be longer than the given
35390ae997dcSYacine Belkadi  * data), or a pointer to the first byte of the requested
35400ae997dcSYacine Belkadi  * element, that is the byte containing the element ID.
35410ae997dcSYacine Belkadi  *
35420ae997dcSYacine Belkadi  * Note: There are no checks on the element length other than
35430ae997dcSYacine Belkadi  * having to fit into the given data.
3544c21dbf92SJohannes Berg  */
3545c21dbf92SJohannes Berg const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len);
3546c21dbf92SJohannes Berg 
3547d70e9693SJohannes Berg /**
35480c28ec58SEliad Peller  * cfg80211_find_vendor_ie - find vendor specific information element in data
35490c28ec58SEliad Peller  *
35500c28ec58SEliad Peller  * @oui: vendor OUI
35510c28ec58SEliad Peller  * @oui_type: vendor-specific OUI type
35520c28ec58SEliad Peller  * @ies: data consisting of IEs
35530c28ec58SEliad Peller  * @len: length of data
35540c28ec58SEliad Peller  *
35550ae997dcSYacine Belkadi  * Return: %NULL if the vendor specific element ID could not be found or if the
35560ae997dcSYacine Belkadi  * element is invalid (claims to be longer than the given data), or a pointer to
35570ae997dcSYacine Belkadi  * the first byte of the requested element, that is the byte containing the
35580ae997dcSYacine Belkadi  * element ID.
35590ae997dcSYacine Belkadi  *
35600ae997dcSYacine Belkadi  * Note: There are no checks on the element length other than having to fit into
35610ae997dcSYacine Belkadi  * the given data.
35620c28ec58SEliad Peller  */
35630c28ec58SEliad Peller const u8 *cfg80211_find_vendor_ie(unsigned int oui, u8 oui_type,
35640c28ec58SEliad Peller 				  const u8 *ies, int len);
35650c28ec58SEliad Peller 
35660c28ec58SEliad Peller /**
3567d70e9693SJohannes Berg  * DOC: Regulatory enforcement infrastructure
3568d70e9693SJohannes Berg  *
3569d70e9693SJohannes Berg  * TODO
3570d3236553SJohannes Berg  */
3571d3236553SJohannes Berg 
3572d3236553SJohannes Berg /**
3573d3236553SJohannes Berg  * regulatory_hint - driver hint to the wireless core a regulatory domain
3574d3236553SJohannes Berg  * @wiphy: the wireless device giving the hint (used only for reporting
3575d3236553SJohannes Berg  *	conflicts)
3576d3236553SJohannes Berg  * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain
3577d3236553SJohannes Berg  * 	should be in. If @rd is set this should be NULL. Note that if you
3578d3236553SJohannes Berg  * 	set this to NULL you should still set rd->alpha2 to some accepted
3579d3236553SJohannes Berg  * 	alpha2.
3580d3236553SJohannes Berg  *
3581d3236553SJohannes Berg  * Wireless drivers can use this function to hint to the wireless core
3582d3236553SJohannes Berg  * what it believes should be the current regulatory domain by
3583d3236553SJohannes Berg  * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory
3584d3236553SJohannes Berg  * domain should be in or by providing a completely build regulatory domain.
3585d3236553SJohannes Berg  * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried
3586d3236553SJohannes Berg  * for a regulatory domain structure for the respective country.
3587d3236553SJohannes Berg  *
3588d3236553SJohannes Berg  * The wiphy must have been registered to cfg80211 prior to this call.
3589d3236553SJohannes Berg  * For cfg80211 drivers this means you must first use wiphy_register(),
3590d3236553SJohannes Berg  * for mac80211 drivers you must first use ieee80211_register_hw().
3591d3236553SJohannes Berg  *
3592d3236553SJohannes Berg  * Drivers should check the return value, its possible you can get
3593d3236553SJohannes Berg  * an -ENOMEM.
35940ae997dcSYacine Belkadi  *
35950ae997dcSYacine Belkadi  * Return: 0 on success. -ENOMEM.
3596d3236553SJohannes Berg  */
359710dd9b7cSJoe Perches int regulatory_hint(struct wiphy *wiphy, const char *alpha2);
3598d3236553SJohannes Berg 
3599d3236553SJohannes Berg /**
3600d3236553SJohannes Berg  * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain
3601d3236553SJohannes Berg  * @wiphy: the wireless device we want to process the regulatory domain on
3602d3236553SJohannes Berg  * @regd: the custom regulatory domain to use for this wiphy
3603d3236553SJohannes Berg  *
3604d3236553SJohannes Berg  * Drivers can sometimes have custom regulatory domains which do not apply
3605d3236553SJohannes Berg  * to a specific country. Drivers can use this to apply such custom regulatory
3606d3236553SJohannes Berg  * domains. This routine must be called prior to wiphy registration. The
3607d3236553SJohannes Berg  * custom regulatory domain will be trusted completely and as such previous
3608d3236553SJohannes Berg  * default channel settings will be disregarded. If no rule is found for a
3609d3236553SJohannes Berg  * channel on the regulatory domain the channel will be disabled.
3610222ea581SLuis R. Rodriguez  * Drivers using this for a wiphy should also set the wiphy flag
3611222ea581SLuis R. Rodriguez  * WIPHY_FLAG_CUSTOM_REGULATORY or cfg80211 will set it for the wiphy
3612222ea581SLuis R. Rodriguez  * that called this helper.
3613d3236553SJohannes Berg  */
361410dd9b7cSJoe Perches void wiphy_apply_custom_regulatory(struct wiphy *wiphy,
3615d3236553SJohannes Berg 				   const struct ieee80211_regdomain *regd);
3616d3236553SJohannes Berg 
3617d3236553SJohannes Berg /**
3618d3236553SJohannes Berg  * freq_reg_info - get regulatory information for the given frequency
3619d3236553SJohannes Berg  * @wiphy: the wiphy for which we want to process this rule for
3620d3236553SJohannes Berg  * @center_freq: Frequency in KHz for which we want regulatory information for
3621d3236553SJohannes Berg  *
3622d3236553SJohannes Berg  * Use this function to get the regulatory rule for a specific frequency on
3623d3236553SJohannes Berg  * a given wireless device. If the device has a specific regulatory domain
3624d3236553SJohannes Berg  * it wants to follow we respect that unless a country IE has been received
3625d3236553SJohannes Berg  * and processed already.
3626d3236553SJohannes Berg  *
36270ae997dcSYacine Belkadi  * Return: A valid pointer, or, when an error occurs, for example if no rule
36280ae997dcSYacine Belkadi  * can be found, the return value is encoded using ERR_PTR(). Use IS_ERR() to
36290ae997dcSYacine Belkadi  * check and PTR_ERR() to obtain the numeric return value. The numeric return
36300ae997dcSYacine Belkadi  * value will be -ERANGE if we determine the given center_freq does not even
36310ae997dcSYacine Belkadi  * have a regulatory rule for a frequency range in the center_freq's band.
36320ae997dcSYacine Belkadi  * See freq_in_rule_band() for our current definition of a band -- this is
36330ae997dcSYacine Belkadi  * purely subjective and right now it's 802.11 specific.
3634d3236553SJohannes Berg  */
3635361c9c8bSJohannes Berg const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy,
3636361c9c8bSJohannes Berg 					       u32 center_freq);
3637d3236553SJohannes Berg 
3638034c6d6eSLuis R. Rodriguez /**
3639034c6d6eSLuis R. Rodriguez  * reg_initiator_name - map regulatory request initiator enum to name
3640034c6d6eSLuis R. Rodriguez  * @initiator: the regulatory request initiator
3641034c6d6eSLuis R. Rodriguez  *
3642034c6d6eSLuis R. Rodriguez  * You can use this to map the regulatory request initiator enum to a
3643034c6d6eSLuis R. Rodriguez  * proper string representation.
3644034c6d6eSLuis R. Rodriguez  */
3645034c6d6eSLuis R. Rodriguez const char *reg_initiator_name(enum nl80211_reg_initiator initiator);
3646034c6d6eSLuis R. Rodriguez 
3647d3236553SJohannes Berg /*
3648d3236553SJohannes Berg  * callbacks for asynchronous cfg80211 methods, notification
3649d3236553SJohannes Berg  * functions and BSS handling helpers
3650d3236553SJohannes Berg  */
3651d3236553SJohannes Berg 
36522a519311SJohannes Berg /**
36532a519311SJohannes Berg  * cfg80211_scan_done - notify that scan finished
36542a519311SJohannes Berg  *
36552a519311SJohannes Berg  * @request: the corresponding scan request
36562a519311SJohannes Berg  * @aborted: set to true if the scan was aborted for any reason,
36572a519311SJohannes Berg  *	userspace will be notified of that
36582a519311SJohannes Berg  */
36592a519311SJohannes Berg void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted);
36602a519311SJohannes Berg 
36612a519311SJohannes Berg /**
3662807f8a8cSLuciano Coelho  * cfg80211_sched_scan_results - notify that new scan results are available
3663807f8a8cSLuciano Coelho  *
3664807f8a8cSLuciano Coelho  * @wiphy: the wiphy which got scheduled scan results
3665807f8a8cSLuciano Coelho  */
3666807f8a8cSLuciano Coelho void cfg80211_sched_scan_results(struct wiphy *wiphy);
3667807f8a8cSLuciano Coelho 
3668807f8a8cSLuciano Coelho /**
3669807f8a8cSLuciano Coelho  * cfg80211_sched_scan_stopped - notify that the scheduled scan has stopped
3670807f8a8cSLuciano Coelho  *
3671807f8a8cSLuciano Coelho  * @wiphy: the wiphy on which the scheduled scan stopped
3672807f8a8cSLuciano Coelho  *
3673807f8a8cSLuciano Coelho  * The driver can call this function to inform cfg80211 that the
3674807f8a8cSLuciano Coelho  * scheduled scan had to be stopped, for whatever reason.  The driver
3675807f8a8cSLuciano Coelho  * is then called back via the sched_scan_stop operation when done.
3676807f8a8cSLuciano Coelho  */
3677807f8a8cSLuciano Coelho void cfg80211_sched_scan_stopped(struct wiphy *wiphy);
3678807f8a8cSLuciano Coelho 
3679807f8a8cSLuciano Coelho /**
3680dcd6eac1SSimon Wunderlich  * cfg80211_inform_bss_width_frame - inform cfg80211 of a received BSS frame
36812a519311SJohannes Berg  *
36822a519311SJohannes Berg  * @wiphy: the wiphy reporting the BSS
36833afc2167SEmmanuel Grumbach  * @rx_channel: The channel the frame was received on
3684dcd6eac1SSimon Wunderlich  * @scan_width: width of the control channel
3685abe37c4bSJohannes Berg  * @mgmt: the management frame (probe response or beacon)
3686abe37c4bSJohannes Berg  * @len: length of the management frame
368777965c97SJohannes Berg  * @signal: the signal strength, type depends on the wiphy's signal_type
36882a519311SJohannes Berg  * @gfp: context flags
36892a519311SJohannes Berg  *
36902a519311SJohannes Berg  * This informs cfg80211 that BSS information was found and
36912a519311SJohannes Berg  * the BSS should be updated/added.
3692ef100682SJohannes Berg  *
36930ae997dcSYacine Belkadi  * Return: A referenced struct, must be released with cfg80211_put_bss()!
36940ae997dcSYacine Belkadi  * Or %NULL on error.
36952a519311SJohannes Berg  */
3696ef100682SJohannes Berg struct cfg80211_bss * __must_check
3697dcd6eac1SSimon Wunderlich cfg80211_inform_bss_width_frame(struct wiphy *wiphy,
36983afc2167SEmmanuel Grumbach 				struct ieee80211_channel *rx_channel,
3699dcd6eac1SSimon Wunderlich 				enum nl80211_bss_scan_width scan_width,
3700dcd6eac1SSimon Wunderlich 				struct ieee80211_mgmt *mgmt, size_t len,
3701dcd6eac1SSimon Wunderlich 				s32 signal, gfp_t gfp);
3702dcd6eac1SSimon Wunderlich 
3703dcd6eac1SSimon Wunderlich static inline struct cfg80211_bss * __must_check
37042a519311SJohannes Berg cfg80211_inform_bss_frame(struct wiphy *wiphy,
37053afc2167SEmmanuel Grumbach 			  struct ieee80211_channel *rx_channel,
37062a519311SJohannes Berg 			  struct ieee80211_mgmt *mgmt, size_t len,
3707dcd6eac1SSimon Wunderlich 			  s32 signal, gfp_t gfp)
3708dcd6eac1SSimon Wunderlich {
37093afc2167SEmmanuel Grumbach 	return cfg80211_inform_bss_width_frame(wiphy, rx_channel,
3710dcd6eac1SSimon Wunderlich 					       NL80211_BSS_CHAN_WIDTH_20,
3711dcd6eac1SSimon Wunderlich 					       mgmt, len, signal, gfp);
3712dcd6eac1SSimon Wunderlich }
37132a519311SJohannes Berg 
3714abe37c4bSJohannes Berg /**
3715abe37c4bSJohannes Berg  * cfg80211_inform_bss - inform cfg80211 of a new BSS
3716abe37c4bSJohannes Berg  *
3717abe37c4bSJohannes Berg  * @wiphy: the wiphy reporting the BSS
37183afc2167SEmmanuel Grumbach  * @rx_channel: The channel the frame was received on
3719dcd6eac1SSimon Wunderlich  * @scan_width: width of the control channel
3720abe37c4bSJohannes Berg  * @bssid: the BSSID of the BSS
37217b8bcff2SJohannes Berg  * @tsf: the TSF sent by the peer in the beacon/probe response (or 0)
3722abe37c4bSJohannes Berg  * @capability: the capability field sent by the peer
3723abe37c4bSJohannes Berg  * @beacon_interval: the beacon interval announced by the peer
3724abe37c4bSJohannes Berg  * @ie: additional IEs sent by the peer
3725abe37c4bSJohannes Berg  * @ielen: length of the additional IEs
3726abe37c4bSJohannes Berg  * @signal: the signal strength, type depends on the wiphy's signal_type
3727abe37c4bSJohannes Berg  * @gfp: context flags
3728abe37c4bSJohannes Berg  *
3729abe37c4bSJohannes Berg  * This informs cfg80211 that BSS information was found and
3730abe37c4bSJohannes Berg  * the BSS should be updated/added.
3731ef100682SJohannes Berg  *
37320ae997dcSYacine Belkadi  * Return: A referenced struct, must be released with cfg80211_put_bss()!
37330ae997dcSYacine Belkadi  * Or %NULL on error.
3734abe37c4bSJohannes Berg  */
3735ef100682SJohannes Berg struct cfg80211_bss * __must_check
3736dcd6eac1SSimon Wunderlich cfg80211_inform_bss_width(struct wiphy *wiphy,
37373afc2167SEmmanuel Grumbach 			  struct ieee80211_channel *rx_channel,
3738dcd6eac1SSimon Wunderlich 			  enum nl80211_bss_scan_width scan_width,
3739dcd6eac1SSimon Wunderlich 			  const u8 *bssid, u64 tsf, u16 capability,
3740dcd6eac1SSimon Wunderlich 			  u16 beacon_interval, const u8 *ie, size_t ielen,
3741dcd6eac1SSimon Wunderlich 			  s32 signal, gfp_t gfp);
3742dcd6eac1SSimon Wunderlich 
3743dcd6eac1SSimon Wunderlich static inline struct cfg80211_bss * __must_check
374406aa7afaSJussi Kivilinna cfg80211_inform_bss(struct wiphy *wiphy,
37453afc2167SEmmanuel Grumbach 		    struct ieee80211_channel *rx_channel,
37467b8bcff2SJohannes Berg 		    const u8 *bssid, u64 tsf, u16 capability,
37477b8bcff2SJohannes Berg 		    u16 beacon_interval, const u8 *ie, size_t ielen,
3748dcd6eac1SSimon Wunderlich 		    s32 signal, gfp_t gfp)
3749dcd6eac1SSimon Wunderlich {
37503afc2167SEmmanuel Grumbach 	return cfg80211_inform_bss_width(wiphy, rx_channel,
3751dcd6eac1SSimon Wunderlich 					 NL80211_BSS_CHAN_WIDTH_20,
3752dcd6eac1SSimon Wunderlich 					 bssid, tsf, capability,
3753dcd6eac1SSimon Wunderlich 					 beacon_interval, ie, ielen, signal,
3754dcd6eac1SSimon Wunderlich 					 gfp);
3755dcd6eac1SSimon Wunderlich }
375606aa7afaSJussi Kivilinna 
37572a519311SJohannes Berg struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
37582a519311SJohannes Berg 				      struct ieee80211_channel *channel,
37592a519311SJohannes Berg 				      const u8 *bssid,
376079420f09SJohannes Berg 				      const u8 *ssid, size_t ssid_len,
376179420f09SJohannes Berg 				      u16 capa_mask, u16 capa_val);
376279420f09SJohannes Berg static inline struct cfg80211_bss *
376379420f09SJohannes Berg cfg80211_get_ibss(struct wiphy *wiphy,
376479420f09SJohannes Berg 		  struct ieee80211_channel *channel,
376579420f09SJohannes Berg 		  const u8 *ssid, size_t ssid_len)
376679420f09SJohannes Berg {
376779420f09SJohannes Berg 	return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len,
376879420f09SJohannes Berg 				WLAN_CAPABILITY_IBSS, WLAN_CAPABILITY_IBSS);
376979420f09SJohannes Berg }
377079420f09SJohannes Berg 
37714c0c0b75SJohannes Berg /**
37724c0c0b75SJohannes Berg  * cfg80211_ref_bss - reference BSS struct
37735b112d3dSJohannes Berg  * @wiphy: the wiphy this BSS struct belongs to
37744c0c0b75SJohannes Berg  * @bss: the BSS struct to reference
37754c0c0b75SJohannes Berg  *
37764c0c0b75SJohannes Berg  * Increments the refcount of the given BSS struct.
37774c0c0b75SJohannes Berg  */
37785b112d3dSJohannes Berg void cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
37794c0c0b75SJohannes Berg 
37804c0c0b75SJohannes Berg /**
37814c0c0b75SJohannes Berg  * cfg80211_put_bss - unref BSS struct
37825b112d3dSJohannes Berg  * @wiphy: the wiphy this BSS struct belongs to
37834c0c0b75SJohannes Berg  * @bss: the BSS struct
37844c0c0b75SJohannes Berg  *
37854c0c0b75SJohannes Berg  * Decrements the refcount of the given BSS struct.
37864c0c0b75SJohannes Berg  */
37875b112d3dSJohannes Berg void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
3788d3236553SJohannes Berg 
3789d491af19SJohannes Berg /**
3790d491af19SJohannes Berg  * cfg80211_unlink_bss - unlink BSS from internal data structures
3791d491af19SJohannes Berg  * @wiphy: the wiphy
3792d491af19SJohannes Berg  * @bss: the bss to remove
3793d491af19SJohannes Berg  *
3794d491af19SJohannes Berg  * This function removes the given BSS from the internal data structures
3795d491af19SJohannes Berg  * thereby making it no longer show up in scan results etc. Use this
3796d491af19SJohannes Berg  * function when you detect a BSS is gone. Normally BSSes will also time
3797d491af19SJohannes Berg  * out, so it is not necessary to use this function at all.
3798d491af19SJohannes Berg  */
3799d491af19SJohannes Berg void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
3800fee52678SJohannes Berg 
3801dcd6eac1SSimon Wunderlich static inline enum nl80211_bss_scan_width
3802dcd6eac1SSimon Wunderlich cfg80211_chandef_to_scan_width(const struct cfg80211_chan_def *chandef)
3803dcd6eac1SSimon Wunderlich {
3804dcd6eac1SSimon Wunderlich 	switch (chandef->width) {
3805dcd6eac1SSimon Wunderlich 	case NL80211_CHAN_WIDTH_5:
3806dcd6eac1SSimon Wunderlich 		return NL80211_BSS_CHAN_WIDTH_5;
3807dcd6eac1SSimon Wunderlich 	case NL80211_CHAN_WIDTH_10:
3808dcd6eac1SSimon Wunderlich 		return NL80211_BSS_CHAN_WIDTH_10;
3809dcd6eac1SSimon Wunderlich 	default:
3810dcd6eac1SSimon Wunderlich 		return NL80211_BSS_CHAN_WIDTH_20;
3811dcd6eac1SSimon Wunderlich 	}
3812dcd6eac1SSimon Wunderlich }
3813dcd6eac1SSimon Wunderlich 
38146039f6d2SJouni Malinen /**
38156ff57cf8SJohannes Berg  * cfg80211_rx_mlme_mgmt - notification of processed MLME management frame
38166039f6d2SJouni Malinen  * @dev: network device
38176039f6d2SJouni Malinen  * @buf: authentication frame (header + body)
38186039f6d2SJouni Malinen  * @len: length of the frame data
38196039f6d2SJouni Malinen  *
38206ff57cf8SJohannes Berg  * This function is called whenever an authentication, disassociation or
38216ff57cf8SJohannes Berg  * deauthentication frame has been received and processed in station mode.
38226ff57cf8SJohannes Berg  * After being asked to authenticate via cfg80211_ops::auth() the driver must
38236ff57cf8SJohannes Berg  * call either this function or cfg80211_auth_timeout().
38246ff57cf8SJohannes Berg  * After being asked to associate via cfg80211_ops::assoc() the driver must
38256ff57cf8SJohannes Berg  * call either this function or cfg80211_auth_timeout().
38266ff57cf8SJohannes Berg  * While connected, the driver must calls this for received and processed
38276ff57cf8SJohannes Berg  * disassociation and deauthentication frames. If the frame couldn't be used
38286ff57cf8SJohannes Berg  * because it was unprotected, the driver must call the function
38296ff57cf8SJohannes Berg  * cfg80211_rx_unprot_mlme_mgmt() instead.
38306ff57cf8SJohannes Berg  *
38316ff57cf8SJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's mutex.
38326039f6d2SJouni Malinen  */
38336ff57cf8SJohannes Berg void cfg80211_rx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len);
38346039f6d2SJouni Malinen 
38356039f6d2SJouni Malinen /**
38366ff57cf8SJohannes Berg  * cfg80211_auth_timeout - notification of timed out authentication
38371965c853SJouni Malinen  * @dev: network device
38381965c853SJouni Malinen  * @addr: The MAC address of the device with which the authentication timed out
3839cb0b4bebSJohannes Berg  *
38408d61ffa5SJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's
38418d61ffa5SJohannes Berg  * mutex.
38421965c853SJouni Malinen  */
38436ff57cf8SJohannes Berg void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr);
38441965c853SJouni Malinen 
38451965c853SJouni Malinen /**
38466ff57cf8SJohannes Berg  * cfg80211_rx_assoc_resp - notification of processed association response
38476039f6d2SJouni Malinen  * @dev: network device
38486ff57cf8SJohannes Berg  * @bss: the BSS that association was requested with, ownership of the pointer
38496ff57cf8SJohannes Berg  *	moves to cfg80211 in this call
38506ff57cf8SJohannes Berg  * @buf: authentication frame (header + body)
38516039f6d2SJouni Malinen  * @len: length of the frame data
38526039f6d2SJouni Malinen  *
38536ff57cf8SJohannes Berg  * After being asked to associate via cfg80211_ops::assoc() the driver must
38546ff57cf8SJohannes Berg  * call either this function or cfg80211_auth_timeout().
38556ff57cf8SJohannes Berg  *
38566ff57cf8SJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's mutex.
38576039f6d2SJouni Malinen  */
38586ff57cf8SJohannes Berg void cfg80211_rx_assoc_resp(struct net_device *dev,
38596ff57cf8SJohannes Berg 			    struct cfg80211_bss *bss,
386095de817bSJohannes Berg 			    const u8 *buf, size_t len);
38616039f6d2SJouni Malinen 
38626039f6d2SJouni Malinen /**
38636ff57cf8SJohannes Berg  * cfg80211_assoc_timeout - notification of timed out association
38641965c853SJouni Malinen  * @dev: network device
3865959867faSJohannes Berg  * @bss: The BSS entry with which association timed out.
3866cb0b4bebSJohannes Berg  *
38678d61ffa5SJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's mutex.
38681965c853SJouni Malinen  */
3869959867faSJohannes Berg void cfg80211_assoc_timeout(struct net_device *dev, struct cfg80211_bss *bss);
38701965c853SJouni Malinen 
38711965c853SJouni Malinen /**
38726ff57cf8SJohannes Berg  * cfg80211_tx_mlme_mgmt - notification of transmitted deauth/disassoc frame
38736039f6d2SJouni Malinen  * @dev: network device
38746ff57cf8SJohannes Berg  * @buf: 802.11 frame (header + body)
38756039f6d2SJouni Malinen  * @len: length of the frame data
38766039f6d2SJouni Malinen  *
38776039f6d2SJouni Malinen  * This function is called whenever deauthentication has been processed in
387853b46b84SJouni Malinen  * station mode. This includes both received deauthentication frames and
38798d61ffa5SJohannes Berg  * locally generated ones. This function may sleep. The caller must hold the
38808d61ffa5SJohannes Berg  * corresponding wdev's mutex.
38816039f6d2SJouni Malinen  */
38826ff57cf8SJohannes Berg void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len);
3883ce470613SHolger Schurig 
3884ce470613SHolger Schurig /**
38856ff57cf8SJohannes Berg  * cfg80211_rx_unprot_mlme_mgmt - notification of unprotected mlme mgmt frame
3886cf4e594eSJouni Malinen  * @dev: network device
3887cf4e594eSJouni Malinen  * @buf: deauthentication frame (header + body)
3888cf4e594eSJouni Malinen  * @len: length of the frame data
3889cf4e594eSJouni Malinen  *
38906ff57cf8SJohannes Berg  * This function is called whenever a received deauthentication or dissassoc
38916ff57cf8SJohannes Berg  * frame has been dropped in station mode because of MFP being used but the
3892cf4e594eSJouni Malinen  * frame was not protected. This function may sleep.
3893cf4e594eSJouni Malinen  */
38946ff57cf8SJohannes Berg void cfg80211_rx_unprot_mlme_mgmt(struct net_device *dev,
38956ff57cf8SJohannes Berg 				  const u8 *buf, size_t len);
3896cf4e594eSJouni Malinen 
3897cf4e594eSJouni Malinen /**
3898a3b8b056SJouni Malinen  * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP)
3899a3b8b056SJouni Malinen  * @dev: network device
3900a3b8b056SJouni Malinen  * @addr: The source MAC address of the frame
3901a3b8b056SJouni Malinen  * @key_type: The key type that the received frame used
3902a66b98dbSArik Nemtsov  * @key_id: Key identifier (0..3). Can be -1 if missing.
3903a3b8b056SJouni Malinen  * @tsc: The TSC value of the frame that generated the MIC failure (6 octets)
3904e6d6e342SJohannes Berg  * @gfp: allocation flags
3905a3b8b056SJouni Malinen  *
3906a3b8b056SJouni Malinen  * This function is called whenever the local MAC detects a MIC failure in a
3907a3b8b056SJouni Malinen  * received frame. This matches with MLME-MICHAELMICFAILURE.indication()
3908a3b8b056SJouni Malinen  * primitive.
3909a3b8b056SJouni Malinen  */
3910a3b8b056SJouni Malinen void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,
3911a3b8b056SJouni Malinen 				  enum nl80211_key_type key_type, int key_id,
3912e6d6e342SJohannes Berg 				  const u8 *tsc, gfp_t gfp);
3913a3b8b056SJouni Malinen 
391404a773adSJohannes Berg /**
391504a773adSJohannes Berg  * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS
391604a773adSJohannes Berg  *
391704a773adSJohannes Berg  * @dev: network device
391804a773adSJohannes Berg  * @bssid: the BSSID of the IBSS joined
3919fe94f3a4SAntonio Quartulli  * @channel: the channel of the IBSS joined
392004a773adSJohannes Berg  * @gfp: allocation flags
392104a773adSJohannes Berg  *
392204a773adSJohannes Berg  * This function notifies cfg80211 that the device joined an IBSS or
392304a773adSJohannes Berg  * switched to a different BSSID. Before this function can be called,
392404a773adSJohannes Berg  * either a beacon has to have been received from the IBSS, or one of
392504a773adSJohannes Berg  * the cfg80211_inform_bss{,_frame} functions must have been called
392604a773adSJohannes Berg  * with the locally generated beacon -- this guarantees that there is
392704a773adSJohannes Berg  * always a scan result for this IBSS. cfg80211 will handle the rest.
392804a773adSJohannes Berg  */
3929fe94f3a4SAntonio Quartulli void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid,
3930fe94f3a4SAntonio Quartulli 			  struct ieee80211_channel *channel, gfp_t gfp);
393104a773adSJohannes Berg 
39321f87f7d3SJohannes Berg /**
3933c93b5e71SJavier Cardona  * cfg80211_notify_new_candidate - notify cfg80211 of a new mesh peer candidate
3934c93b5e71SJavier Cardona  *
3935c93b5e71SJavier Cardona  * @dev: network device
3936c93b5e71SJavier Cardona  * @macaddr: the MAC address of the new candidate
3937c93b5e71SJavier Cardona  * @ie: information elements advertised by the peer candidate
3938c93b5e71SJavier Cardona  * @ie_len: lenght of the information elements buffer
3939c93b5e71SJavier Cardona  * @gfp: allocation flags
3940c93b5e71SJavier Cardona  *
3941c93b5e71SJavier Cardona  * This function notifies cfg80211 that the mesh peer candidate has been
3942c93b5e71SJavier Cardona  * detected, most likely via a beacon or, less likely, via a probe response.
3943c93b5e71SJavier Cardona  * cfg80211 then sends a notification to userspace.
3944c93b5e71SJavier Cardona  */
3945c93b5e71SJavier Cardona void cfg80211_notify_new_peer_candidate(struct net_device *dev,
3946c93b5e71SJavier Cardona 		const u8 *macaddr, const u8 *ie, u8 ie_len, gfp_t gfp);
3947c93b5e71SJavier Cardona 
3948c93b5e71SJavier Cardona /**
3949d70e9693SJohannes Berg  * DOC: RFkill integration
3950d70e9693SJohannes Berg  *
3951d70e9693SJohannes Berg  * RFkill integration in cfg80211 is almost invisible to drivers,
3952d70e9693SJohannes Berg  * as cfg80211 automatically registers an rfkill instance for each
3953d70e9693SJohannes Berg  * wireless device it knows about. Soft kill is also translated
3954d70e9693SJohannes Berg  * into disconnecting and turning all interfaces off, drivers are
3955d70e9693SJohannes Berg  * expected to turn off the device when all interfaces are down.
3956d70e9693SJohannes Berg  *
3957d70e9693SJohannes Berg  * However, devices may have a hard RFkill line, in which case they
3958d70e9693SJohannes Berg  * also need to interact with the rfkill subsystem, via cfg80211.
3959d70e9693SJohannes Berg  * They can do this with a few helper functions documented here.
3960d70e9693SJohannes Berg  */
3961d70e9693SJohannes Berg 
3962d70e9693SJohannes Berg /**
39631f87f7d3SJohannes Berg  * wiphy_rfkill_set_hw_state - notify cfg80211 about hw block state
39641f87f7d3SJohannes Berg  * @wiphy: the wiphy
39651f87f7d3SJohannes Berg  * @blocked: block status
39661f87f7d3SJohannes Berg  */
39671f87f7d3SJohannes Berg void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked);
39681f87f7d3SJohannes Berg 
39691f87f7d3SJohannes Berg /**
39701f87f7d3SJohannes Berg  * wiphy_rfkill_start_polling - start polling rfkill
39711f87f7d3SJohannes Berg  * @wiphy: the wiphy
39721f87f7d3SJohannes Berg  */
39731f87f7d3SJohannes Berg void wiphy_rfkill_start_polling(struct wiphy *wiphy);
39741f87f7d3SJohannes Berg 
39751f87f7d3SJohannes Berg /**
39761f87f7d3SJohannes Berg  * wiphy_rfkill_stop_polling - stop polling rfkill
39771f87f7d3SJohannes Berg  * @wiphy: the wiphy
39781f87f7d3SJohannes Berg  */
39791f87f7d3SJohannes Berg void wiphy_rfkill_stop_polling(struct wiphy *wiphy);
39801f87f7d3SJohannes Berg 
3981ad7e718cSJohannes Berg /**
3982ad7e718cSJohannes Berg  * DOC: Vendor commands
3983ad7e718cSJohannes Berg  *
3984ad7e718cSJohannes Berg  * Occasionally, there are special protocol or firmware features that
3985ad7e718cSJohannes Berg  * can't be implemented very openly. For this and similar cases, the
3986ad7e718cSJohannes Berg  * vendor command functionality allows implementing the features with
3987ad7e718cSJohannes Berg  * (typically closed-source) userspace and firmware, using nl80211 as
3988ad7e718cSJohannes Berg  * the configuration mechanism.
3989ad7e718cSJohannes Berg  *
3990ad7e718cSJohannes Berg  * A driver supporting vendor commands must register them as an array
3991ad7e718cSJohannes Berg  * in struct wiphy, with handlers for each one, each command has an
3992ad7e718cSJohannes Berg  * OUI and sub command ID to identify it.
3993ad7e718cSJohannes Berg  *
3994ad7e718cSJohannes Berg  * Note that this feature should not be (ab)used to implement protocol
3995ad7e718cSJohannes Berg  * features that could openly be shared across drivers. In particular,
3996ad7e718cSJohannes Berg  * it must never be required to use vendor commands to implement any
3997ad7e718cSJohannes Berg  * "normal" functionality that higher-level userspace like connection
3998ad7e718cSJohannes Berg  * managers etc. need.
3999ad7e718cSJohannes Berg  */
4000ad7e718cSJohannes Berg 
4001ad7e718cSJohannes Berg struct sk_buff *__cfg80211_alloc_reply_skb(struct wiphy *wiphy,
4002ad7e718cSJohannes Berg 					   enum nl80211_commands cmd,
4003ad7e718cSJohannes Berg 					   enum nl80211_attrs attr,
4004ad7e718cSJohannes Berg 					   int approxlen);
4005ad7e718cSJohannes Berg 
4006567ffc35SJohannes Berg struct sk_buff *__cfg80211_alloc_event_skb(struct wiphy *wiphy,
4007567ffc35SJohannes Berg 					   enum nl80211_commands cmd,
4008567ffc35SJohannes Berg 					   enum nl80211_attrs attr,
4009567ffc35SJohannes Berg 					   int vendor_event_idx,
4010567ffc35SJohannes Berg 					   int approxlen, gfp_t gfp);
4011567ffc35SJohannes Berg 
4012567ffc35SJohannes Berg void __cfg80211_send_event_skb(struct sk_buff *skb, gfp_t gfp);
4013567ffc35SJohannes Berg 
4014ad7e718cSJohannes Berg /**
4015ad7e718cSJohannes Berg  * cfg80211_vendor_cmd_alloc_reply_skb - allocate vendor command reply
4016ad7e718cSJohannes Berg  * @wiphy: the wiphy
4017ad7e718cSJohannes Berg  * @approxlen: an upper bound of the length of the data that will
4018ad7e718cSJohannes Berg  *	be put into the skb
4019ad7e718cSJohannes Berg  *
4020ad7e718cSJohannes Berg  * This function allocates and pre-fills an skb for a reply to
4021ad7e718cSJohannes Berg  * a vendor command. Since it is intended for a reply, calling
4022ad7e718cSJohannes Berg  * it outside of a vendor command's doit() operation is invalid.
4023ad7e718cSJohannes Berg  *
4024ad7e718cSJohannes Berg  * The returned skb is pre-filled with some identifying data in
4025ad7e718cSJohannes Berg  * a way that any data that is put into the skb (with skb_put(),
4026ad7e718cSJohannes Berg  * nla_put() or similar) will end up being within the
4027ad7e718cSJohannes Berg  * %NL80211_ATTR_VENDOR_DATA attribute, so all that needs to be done
4028ad7e718cSJohannes Berg  * with the skb is adding data for the corresponding userspace tool
4029ad7e718cSJohannes Berg  * which can then read that data out of the vendor data attribute.
4030ad7e718cSJohannes Berg  * You must not modify the skb in any other way.
4031ad7e718cSJohannes Berg  *
4032ad7e718cSJohannes Berg  * When done, call cfg80211_vendor_cmd_reply() with the skb and return
4033ad7e718cSJohannes Berg  * its error code as the result of the doit() operation.
4034ad7e718cSJohannes Berg  *
4035ad7e718cSJohannes Berg  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
4036ad7e718cSJohannes Berg  */
4037ad7e718cSJohannes Berg static inline struct sk_buff *
4038ad7e718cSJohannes Berg cfg80211_vendor_cmd_alloc_reply_skb(struct wiphy *wiphy, int approxlen)
4039ad7e718cSJohannes Berg {
4040ad7e718cSJohannes Berg 	return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_VENDOR,
4041ad7e718cSJohannes Berg 					  NL80211_ATTR_VENDOR_DATA, approxlen);
4042ad7e718cSJohannes Berg }
4043ad7e718cSJohannes Berg 
4044ad7e718cSJohannes Berg /**
4045ad7e718cSJohannes Berg  * cfg80211_vendor_cmd_reply - send the reply skb
4046ad7e718cSJohannes Berg  * @skb: The skb, must have been allocated with
4047ad7e718cSJohannes Berg  *	cfg80211_vendor_cmd_alloc_reply_skb()
4048ad7e718cSJohannes Berg  *
4049ad7e718cSJohannes Berg  * Since calling this function will usually be the last thing
4050ad7e718cSJohannes Berg  * before returning from the vendor command doit() you should
4051ad7e718cSJohannes Berg  * return the error code.  Note that this function consumes the
4052ad7e718cSJohannes Berg  * skb regardless of the return value.
4053ad7e718cSJohannes Berg  *
4054ad7e718cSJohannes Berg  * Return: An error code or 0 on success.
4055ad7e718cSJohannes Berg  */
4056ad7e718cSJohannes Berg int cfg80211_vendor_cmd_reply(struct sk_buff *skb);
4057ad7e718cSJohannes Berg 
4058567ffc35SJohannes Berg /**
4059567ffc35SJohannes Berg  * cfg80211_vendor_event_alloc - allocate vendor-specific event skb
4060567ffc35SJohannes Berg  * @wiphy: the wiphy
4061567ffc35SJohannes Berg  * @event_idx: index of the vendor event in the wiphy's vendor_events
4062567ffc35SJohannes Berg  * @approxlen: an upper bound of the length of the data that will
4063567ffc35SJohannes Berg  *	be put into the skb
4064567ffc35SJohannes Berg  * @gfp: allocation flags
4065567ffc35SJohannes Berg  *
4066567ffc35SJohannes Berg  * This function allocates and pre-fills an skb for an event on the
4067567ffc35SJohannes Berg  * vendor-specific multicast group.
4068567ffc35SJohannes Berg  *
4069567ffc35SJohannes Berg  * When done filling the skb, call cfg80211_vendor_event() with the
4070567ffc35SJohannes Berg  * skb to send the event.
4071567ffc35SJohannes Berg  *
4072567ffc35SJohannes Berg  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
4073567ffc35SJohannes Berg  */
4074567ffc35SJohannes Berg static inline struct sk_buff *
4075567ffc35SJohannes Berg cfg80211_vendor_event_alloc(struct wiphy *wiphy, int approxlen,
4076567ffc35SJohannes Berg 			    int event_idx, gfp_t gfp)
4077567ffc35SJohannes Berg {
4078567ffc35SJohannes Berg 	return __cfg80211_alloc_event_skb(wiphy, NL80211_CMD_VENDOR,
4079567ffc35SJohannes Berg 					  NL80211_ATTR_VENDOR_DATA,
4080567ffc35SJohannes Berg 					  event_idx, approxlen, gfp);
4081567ffc35SJohannes Berg }
4082567ffc35SJohannes Berg 
4083567ffc35SJohannes Berg /**
4084567ffc35SJohannes Berg  * cfg80211_vendor_event - send the event
4085567ffc35SJohannes Berg  * @skb: The skb, must have been allocated with cfg80211_vendor_event_alloc()
4086567ffc35SJohannes Berg  * @gfp: allocation flags
4087567ffc35SJohannes Berg  *
4088567ffc35SJohannes Berg  * This function sends the given @skb, which must have been allocated
4089567ffc35SJohannes Berg  * by cfg80211_vendor_event_alloc(), as an event. It always consumes it.
4090567ffc35SJohannes Berg  */
4091567ffc35SJohannes Berg static inline void cfg80211_vendor_event(struct sk_buff *skb, gfp_t gfp)
4092567ffc35SJohannes Berg {
4093567ffc35SJohannes Berg 	__cfg80211_send_event_skb(skb, gfp);
4094567ffc35SJohannes Berg }
4095567ffc35SJohannes Berg 
4096aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE
4097aff89a9bSJohannes Berg /**
4098d70e9693SJohannes Berg  * DOC: Test mode
4099d70e9693SJohannes Berg  *
4100d70e9693SJohannes Berg  * Test mode is a set of utility functions to allow drivers to
4101d70e9693SJohannes Berg  * interact with driver-specific tools to aid, for instance,
4102d70e9693SJohannes Berg  * factory programming.
4103d70e9693SJohannes Berg  *
4104d70e9693SJohannes Berg  * This chapter describes how drivers interact with it, for more
4105d70e9693SJohannes Berg  * information see the nl80211 book's chapter on it.
4106d70e9693SJohannes Berg  */
4107d70e9693SJohannes Berg 
4108d70e9693SJohannes Berg /**
4109aff89a9bSJohannes Berg  * cfg80211_testmode_alloc_reply_skb - allocate testmode reply
4110aff89a9bSJohannes Berg  * @wiphy: the wiphy
4111aff89a9bSJohannes Berg  * @approxlen: an upper bound of the length of the data that will
4112aff89a9bSJohannes Berg  *	be put into the skb
4113aff89a9bSJohannes Berg  *
4114aff89a9bSJohannes Berg  * This function allocates and pre-fills an skb for a reply to
4115aff89a9bSJohannes Berg  * the testmode command. Since it is intended for a reply, calling
4116aff89a9bSJohannes Berg  * it outside of the @testmode_cmd operation is invalid.
4117aff89a9bSJohannes Berg  *
41180ae997dcSYacine Belkadi  * The returned skb is pre-filled with the wiphy index and set up in
41190ae997dcSYacine Belkadi  * a way that any data that is put into the skb (with skb_put(),
41200ae997dcSYacine Belkadi  * nla_put() or similar) will end up being within the
41210ae997dcSYacine Belkadi  * %NL80211_ATTR_TESTDATA attribute, so all that needs to be done
41220ae997dcSYacine Belkadi  * with the skb is adding data for the corresponding userspace tool
41230ae997dcSYacine Belkadi  * which can then read that data out of the testdata attribute. You
41240ae997dcSYacine Belkadi  * must not modify the skb in any other way.
4125aff89a9bSJohannes Berg  *
4126aff89a9bSJohannes Berg  * When done, call cfg80211_testmode_reply() with the skb and return
4127aff89a9bSJohannes Berg  * its error code as the result of the @testmode_cmd operation.
41280ae997dcSYacine Belkadi  *
41290ae997dcSYacine Belkadi  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
4130aff89a9bSJohannes Berg  */
4131ad7e718cSJohannes Berg static inline struct sk_buff *
4132ad7e718cSJohannes Berg cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy, int approxlen)
4133ad7e718cSJohannes Berg {
4134ad7e718cSJohannes Berg 	return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_TESTMODE,
4135ad7e718cSJohannes Berg 					  NL80211_ATTR_TESTDATA, approxlen);
4136ad7e718cSJohannes Berg }
4137aff89a9bSJohannes Berg 
4138aff89a9bSJohannes Berg /**
4139aff89a9bSJohannes Berg  * cfg80211_testmode_reply - send the reply skb
4140aff89a9bSJohannes Berg  * @skb: The skb, must have been allocated with
4141aff89a9bSJohannes Berg  *	cfg80211_testmode_alloc_reply_skb()
4142aff89a9bSJohannes Berg  *
41430ae997dcSYacine Belkadi  * Since calling this function will usually be the last thing
41440ae997dcSYacine Belkadi  * before returning from the @testmode_cmd you should return
41450ae997dcSYacine Belkadi  * the error code.  Note that this function consumes the skb
41460ae997dcSYacine Belkadi  * regardless of the return value.
41470ae997dcSYacine Belkadi  *
41480ae997dcSYacine Belkadi  * Return: An error code or 0 on success.
4149aff89a9bSJohannes Berg  */
4150ad7e718cSJohannes Berg static inline int cfg80211_testmode_reply(struct sk_buff *skb)
4151ad7e718cSJohannes Berg {
4152ad7e718cSJohannes Berg 	return cfg80211_vendor_cmd_reply(skb);
4153ad7e718cSJohannes Berg }
4154aff89a9bSJohannes Berg 
4155aff89a9bSJohannes Berg /**
4156aff89a9bSJohannes Berg  * cfg80211_testmode_alloc_event_skb - allocate testmode event
4157aff89a9bSJohannes Berg  * @wiphy: the wiphy
4158aff89a9bSJohannes Berg  * @approxlen: an upper bound of the length of the data that will
4159aff89a9bSJohannes Berg  *	be put into the skb
4160aff89a9bSJohannes Berg  * @gfp: allocation flags
4161aff89a9bSJohannes Berg  *
4162aff89a9bSJohannes Berg  * This function allocates and pre-fills an skb for an event on the
4163aff89a9bSJohannes Berg  * testmode multicast group.
4164aff89a9bSJohannes Berg  *
41650ae997dcSYacine Belkadi  * The returned skb is set up in the same way as with
41660ae997dcSYacine Belkadi  * cfg80211_testmode_alloc_reply_skb() but prepared for an event. As
41670ae997dcSYacine Belkadi  * there, you should simply add data to it that will then end up in the
41680ae997dcSYacine Belkadi  * %NL80211_ATTR_TESTDATA attribute. Again, you must not modify the skb
41690ae997dcSYacine Belkadi  * in any other way.
4170aff89a9bSJohannes Berg  *
4171aff89a9bSJohannes Berg  * When done filling the skb, call cfg80211_testmode_event() with the
4172aff89a9bSJohannes Berg  * skb to send the event.
41730ae997dcSYacine Belkadi  *
41740ae997dcSYacine Belkadi  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
4175aff89a9bSJohannes Berg  */
4176567ffc35SJohannes Berg static inline struct sk_buff *
4177567ffc35SJohannes Berg cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy, int approxlen, gfp_t gfp)
4178567ffc35SJohannes Berg {
4179567ffc35SJohannes Berg 	return __cfg80211_alloc_event_skb(wiphy, NL80211_CMD_TESTMODE,
4180567ffc35SJohannes Berg 					  NL80211_ATTR_TESTDATA, -1,
4181567ffc35SJohannes Berg 					  approxlen, gfp);
4182567ffc35SJohannes Berg }
4183aff89a9bSJohannes Berg 
4184aff89a9bSJohannes Berg /**
4185aff89a9bSJohannes Berg  * cfg80211_testmode_event - send the event
4186aff89a9bSJohannes Berg  * @skb: The skb, must have been allocated with
4187aff89a9bSJohannes Berg  *	cfg80211_testmode_alloc_event_skb()
4188aff89a9bSJohannes Berg  * @gfp: allocation flags
4189aff89a9bSJohannes Berg  *
4190aff89a9bSJohannes Berg  * This function sends the given @skb, which must have been allocated
4191aff89a9bSJohannes Berg  * by cfg80211_testmode_alloc_event_skb(), as an event. It always
4192aff89a9bSJohannes Berg  * consumes it.
4193aff89a9bSJohannes Berg  */
4194567ffc35SJohannes Berg static inline void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp)
4195567ffc35SJohannes Berg {
4196567ffc35SJohannes Berg 	__cfg80211_send_event_skb(skb, gfp);
4197567ffc35SJohannes Berg }
4198aff89a9bSJohannes Berg 
4199aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd)	.testmode_cmd = (cmd),
420071063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd)	.testmode_dump = (cmd),
4201aff89a9bSJohannes Berg #else
4202aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd)
420371063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd)
4204aff89a9bSJohannes Berg #endif
4205aff89a9bSJohannes Berg 
4206b23aa676SSamuel Ortiz /**
4207b23aa676SSamuel Ortiz  * cfg80211_connect_result - notify cfg80211 of connection result
4208b23aa676SSamuel Ortiz  *
4209b23aa676SSamuel Ortiz  * @dev: network device
4210b23aa676SSamuel Ortiz  * @bssid: the BSSID of the AP
4211b23aa676SSamuel Ortiz  * @req_ie: association request IEs (maybe be %NULL)
4212b23aa676SSamuel Ortiz  * @req_ie_len: association request IEs length
4213b23aa676SSamuel Ortiz  * @resp_ie: association response IEs (may be %NULL)
4214b23aa676SSamuel Ortiz  * @resp_ie_len: assoc response IEs length
4215b23aa676SSamuel Ortiz  * @status: status code, 0 for successful connection, use
4216b23aa676SSamuel Ortiz  *	%WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
4217b23aa676SSamuel Ortiz  *	the real status code for failures.
4218b23aa676SSamuel Ortiz  * @gfp: allocation flags
4219b23aa676SSamuel Ortiz  *
4220b23aa676SSamuel Ortiz  * It should be called by the underlying driver whenever connect() has
4221b23aa676SSamuel Ortiz  * succeeded.
4222b23aa676SSamuel Ortiz  */
4223b23aa676SSamuel Ortiz void cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
4224b23aa676SSamuel Ortiz 			     const u8 *req_ie, size_t req_ie_len,
4225b23aa676SSamuel Ortiz 			     const u8 *resp_ie, size_t resp_ie_len,
4226b23aa676SSamuel Ortiz 			     u16 status, gfp_t gfp);
4227b23aa676SSamuel Ortiz 
4228b23aa676SSamuel Ortiz /**
4229b23aa676SSamuel Ortiz  * cfg80211_roamed - notify cfg80211 of roaming
4230b23aa676SSamuel Ortiz  *
4231b23aa676SSamuel Ortiz  * @dev: network device
4232ed9d0102SJouni Malinen  * @channel: the channel of the new AP
4233b23aa676SSamuel Ortiz  * @bssid: the BSSID of the new AP
4234b23aa676SSamuel Ortiz  * @req_ie: association request IEs (maybe be %NULL)
4235b23aa676SSamuel Ortiz  * @req_ie_len: association request IEs length
4236b23aa676SSamuel Ortiz  * @resp_ie: association response IEs (may be %NULL)
4237b23aa676SSamuel Ortiz  * @resp_ie_len: assoc response IEs length
4238b23aa676SSamuel Ortiz  * @gfp: allocation flags
4239b23aa676SSamuel Ortiz  *
4240b23aa676SSamuel Ortiz  * It should be called by the underlying driver whenever it roamed
4241b23aa676SSamuel Ortiz  * from one AP to another while connected.
4242b23aa676SSamuel Ortiz  */
4243ed9d0102SJouni Malinen void cfg80211_roamed(struct net_device *dev,
4244ed9d0102SJouni Malinen 		     struct ieee80211_channel *channel,
4245ed9d0102SJouni Malinen 		     const u8 *bssid,
4246b23aa676SSamuel Ortiz 		     const u8 *req_ie, size_t req_ie_len,
4247b23aa676SSamuel Ortiz 		     const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp);
4248b23aa676SSamuel Ortiz 
4249b23aa676SSamuel Ortiz /**
4250adbde344SVasanthakumar Thiagarajan  * cfg80211_roamed_bss - notify cfg80211 of roaming
4251adbde344SVasanthakumar Thiagarajan  *
4252adbde344SVasanthakumar Thiagarajan  * @dev: network device
4253adbde344SVasanthakumar Thiagarajan  * @bss: entry of bss to which STA got roamed
4254adbde344SVasanthakumar Thiagarajan  * @req_ie: association request IEs (maybe be %NULL)
4255adbde344SVasanthakumar Thiagarajan  * @req_ie_len: association request IEs length
4256adbde344SVasanthakumar Thiagarajan  * @resp_ie: association response IEs (may be %NULL)
4257adbde344SVasanthakumar Thiagarajan  * @resp_ie_len: assoc response IEs length
4258adbde344SVasanthakumar Thiagarajan  * @gfp: allocation flags
4259adbde344SVasanthakumar Thiagarajan  *
4260adbde344SVasanthakumar Thiagarajan  * This is just a wrapper to notify cfg80211 of roaming event with driver
4261adbde344SVasanthakumar Thiagarajan  * passing bss to avoid a race in timeout of the bss entry. It should be
4262adbde344SVasanthakumar Thiagarajan  * called by the underlying driver whenever it roamed from one AP to another
4263adbde344SVasanthakumar Thiagarajan  * while connected. Drivers which have roaming implemented in firmware
4264adbde344SVasanthakumar Thiagarajan  * may use this function to avoid a race in bss entry timeout where the bss
4265adbde344SVasanthakumar Thiagarajan  * entry of the new AP is seen in the driver, but gets timed out by the time
4266adbde344SVasanthakumar Thiagarajan  * it is accessed in __cfg80211_roamed() due to delay in scheduling
4267adbde344SVasanthakumar Thiagarajan  * rdev->event_work. In case of any failures, the reference is released
4268adbde344SVasanthakumar Thiagarajan  * either in cfg80211_roamed_bss() or in __cfg80211_romed(), Otherwise,
4269adbde344SVasanthakumar Thiagarajan  * it will be released while diconneting from the current bss.
4270adbde344SVasanthakumar Thiagarajan  */
4271adbde344SVasanthakumar Thiagarajan void cfg80211_roamed_bss(struct net_device *dev, struct cfg80211_bss *bss,
4272adbde344SVasanthakumar Thiagarajan 			 const u8 *req_ie, size_t req_ie_len,
4273adbde344SVasanthakumar Thiagarajan 			 const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp);
4274adbde344SVasanthakumar Thiagarajan 
4275adbde344SVasanthakumar Thiagarajan /**
4276b23aa676SSamuel Ortiz  * cfg80211_disconnected - notify cfg80211 that connection was dropped
4277b23aa676SSamuel Ortiz  *
4278b23aa676SSamuel Ortiz  * @dev: network device
4279b23aa676SSamuel Ortiz  * @ie: information elements of the deauth/disassoc frame (may be %NULL)
4280b23aa676SSamuel Ortiz  * @ie_len: length of IEs
4281b23aa676SSamuel Ortiz  * @reason: reason code for the disconnection, set it to 0 if unknown
4282b23aa676SSamuel Ortiz  * @gfp: allocation flags
4283b23aa676SSamuel Ortiz  *
4284b23aa676SSamuel Ortiz  * After it calls this function, the driver should enter an idle state
4285b23aa676SSamuel Ortiz  * and not try to connect to any AP any more.
4286b23aa676SSamuel Ortiz  */
4287b23aa676SSamuel Ortiz void cfg80211_disconnected(struct net_device *dev, u16 reason,
4288b23aa676SSamuel Ortiz 			   u8 *ie, size_t ie_len, gfp_t gfp);
4289b23aa676SSamuel Ortiz 
42909588bbd5SJouni Malinen /**
42919588bbd5SJouni Malinen  * cfg80211_ready_on_channel - notification of remain_on_channel start
429271bbc994SJohannes Berg  * @wdev: wireless device
42939588bbd5SJouni Malinen  * @cookie: the request cookie
42949588bbd5SJouni Malinen  * @chan: The current channel (from remain_on_channel request)
42959588bbd5SJouni Malinen  * @duration: Duration in milliseconds that the driver intents to remain on the
42969588bbd5SJouni Malinen  *	channel
42979588bbd5SJouni Malinen  * @gfp: allocation flags
42989588bbd5SJouni Malinen  */
429971bbc994SJohannes Berg void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie,
43009588bbd5SJouni Malinen 			       struct ieee80211_channel *chan,
43019588bbd5SJouni Malinen 			       unsigned int duration, gfp_t gfp);
43029588bbd5SJouni Malinen 
43039588bbd5SJouni Malinen /**
43049588bbd5SJouni Malinen  * cfg80211_remain_on_channel_expired - remain_on_channel duration expired
430571bbc994SJohannes Berg  * @wdev: wireless device
43069588bbd5SJouni Malinen  * @cookie: the request cookie
43079588bbd5SJouni Malinen  * @chan: The current channel (from remain_on_channel request)
43089588bbd5SJouni Malinen  * @gfp: allocation flags
43099588bbd5SJouni Malinen  */
431071bbc994SJohannes Berg void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie,
43119588bbd5SJouni Malinen 					struct ieee80211_channel *chan,
43129588bbd5SJouni Malinen 					gfp_t gfp);
4313b23aa676SSamuel Ortiz 
431498b62183SJohannes Berg 
431598b62183SJohannes Berg /**
431698b62183SJohannes Berg  * cfg80211_new_sta - notify userspace about station
431798b62183SJohannes Berg  *
431898b62183SJohannes Berg  * @dev: the netdev
431998b62183SJohannes Berg  * @mac_addr: the station's address
432098b62183SJohannes Berg  * @sinfo: the station information
432198b62183SJohannes Berg  * @gfp: allocation flags
432298b62183SJohannes Berg  */
432398b62183SJohannes Berg void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr,
432498b62183SJohannes Berg 		      struct station_info *sinfo, gfp_t gfp);
432598b62183SJohannes Berg 
4326026331c4SJouni Malinen /**
4327ec15e68bSJouni Malinen  * cfg80211_del_sta - notify userspace about deletion of a station
4328ec15e68bSJouni Malinen  *
4329ec15e68bSJouni Malinen  * @dev: the netdev
4330ec15e68bSJouni Malinen  * @mac_addr: the station's address
4331ec15e68bSJouni Malinen  * @gfp: allocation flags
4332ec15e68bSJouni Malinen  */
4333ec15e68bSJouni Malinen void cfg80211_del_sta(struct net_device *dev, const u8 *mac_addr, gfp_t gfp);
4334ec15e68bSJouni Malinen 
4335ec15e68bSJouni Malinen /**
4336ed44a951SPandiyarajan Pitchaimuthu  * cfg80211_conn_failed - connection request failed notification
4337ed44a951SPandiyarajan Pitchaimuthu  *
4338ed44a951SPandiyarajan Pitchaimuthu  * @dev: the netdev
4339ed44a951SPandiyarajan Pitchaimuthu  * @mac_addr: the station's address
4340ed44a951SPandiyarajan Pitchaimuthu  * @reason: the reason for connection failure
4341ed44a951SPandiyarajan Pitchaimuthu  * @gfp: allocation flags
4342ed44a951SPandiyarajan Pitchaimuthu  *
4343ed44a951SPandiyarajan Pitchaimuthu  * Whenever a station tries to connect to an AP and if the station
4344ed44a951SPandiyarajan Pitchaimuthu  * could not connect to the AP as the AP has rejected the connection
4345ed44a951SPandiyarajan Pitchaimuthu  * for some reasons, this function is called.
4346ed44a951SPandiyarajan Pitchaimuthu  *
4347ed44a951SPandiyarajan Pitchaimuthu  * The reason for connection failure can be any of the value from
4348ed44a951SPandiyarajan Pitchaimuthu  * nl80211_connect_failed_reason enum
4349ed44a951SPandiyarajan Pitchaimuthu  */
4350ed44a951SPandiyarajan Pitchaimuthu void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr,
4351ed44a951SPandiyarajan Pitchaimuthu 			  enum nl80211_connect_failed_reason reason,
4352ed44a951SPandiyarajan Pitchaimuthu 			  gfp_t gfp);
4353ed44a951SPandiyarajan Pitchaimuthu 
4354ed44a951SPandiyarajan Pitchaimuthu /**
43552e161f78SJohannes Berg  * cfg80211_rx_mgmt - notification of received, unprocessed management frame
435671bbc994SJohannes Berg  * @wdev: wireless device receiving the frame
4357026331c4SJouni Malinen  * @freq: Frequency on which the frame was received in MHz
4358804483e9SJohannes Berg  * @sig_dbm: signal strength in mBm, or 0 if unknown
43592e161f78SJohannes Berg  * @buf: Management frame (header + body)
4360026331c4SJouni Malinen  * @len: length of the frame data
436119504cf5SVladimir Kondratiev  * @flags: flags, as defined in enum nl80211_rxmgmt_flags
4362026331c4SJouni Malinen  * @gfp: context flags
43632e161f78SJohannes Berg  *
43640ae997dcSYacine Belkadi  * This function is called whenever an Action frame is received for a station
43650ae997dcSYacine Belkadi  * mode interface, but is not processed in kernel.
43660ae997dcSYacine Belkadi  *
43670ae997dcSYacine Belkadi  * Return: %true if a user space application has registered for this frame.
43682e161f78SJohannes Berg  * For action frames, that makes it responsible for rejecting unrecognized
43692e161f78SJohannes Berg  * action frames; %false otherwise, in which case for action frames the
43702e161f78SJohannes Berg  * driver is responsible for rejecting the frame.
4371026331c4SJouni Malinen  */
437271bbc994SJohannes Berg bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int sig_dbm,
437319504cf5SVladimir Kondratiev 		      const u8 *buf, size_t len, u32 flags, gfp_t gfp);
4374026331c4SJouni Malinen 
4375026331c4SJouni Malinen /**
43762e161f78SJohannes Berg  * cfg80211_mgmt_tx_status - notification of TX status for management frame
437771bbc994SJohannes Berg  * @wdev: wireless device receiving the frame
43782e161f78SJohannes Berg  * @cookie: Cookie returned by cfg80211_ops::mgmt_tx()
43792e161f78SJohannes Berg  * @buf: Management frame (header + body)
4380026331c4SJouni Malinen  * @len: length of the frame data
4381026331c4SJouni Malinen  * @ack: Whether frame was acknowledged
4382026331c4SJouni Malinen  * @gfp: context flags
4383026331c4SJouni Malinen  *
43842e161f78SJohannes Berg  * This function is called whenever a management frame was requested to be
43852e161f78SJohannes Berg  * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the
4386026331c4SJouni Malinen  * transmission attempt.
4387026331c4SJouni Malinen  */
438871bbc994SJohannes Berg void cfg80211_mgmt_tx_status(struct wireless_dev *wdev, u64 cookie,
4389026331c4SJouni Malinen 			     const u8 *buf, size_t len, bool ack, gfp_t gfp);
4390026331c4SJouni Malinen 
4391d6dc1a38SJuuso Oikarinen 
4392d6dc1a38SJuuso Oikarinen /**
4393d6dc1a38SJuuso Oikarinen  * cfg80211_cqm_rssi_notify - connection quality monitoring rssi event
4394d6dc1a38SJuuso Oikarinen  * @dev: network device
4395d6dc1a38SJuuso Oikarinen  * @rssi_event: the triggered RSSI event
4396d6dc1a38SJuuso Oikarinen  * @gfp: context flags
4397d6dc1a38SJuuso Oikarinen  *
4398d6dc1a38SJuuso Oikarinen  * This function is called when a configured connection quality monitoring
4399d6dc1a38SJuuso Oikarinen  * rssi threshold reached event occurs.
4400d6dc1a38SJuuso Oikarinen  */
4401d6dc1a38SJuuso Oikarinen void cfg80211_cqm_rssi_notify(struct net_device *dev,
4402d6dc1a38SJuuso Oikarinen 			      enum nl80211_cqm_rssi_threshold_event rssi_event,
4403d6dc1a38SJuuso Oikarinen 			      gfp_t gfp);
4404d6dc1a38SJuuso Oikarinen 
4405c063dbf5SJohannes Berg /**
440604f39047SSimon Wunderlich  * cfg80211_radar_event - radar detection event
440704f39047SSimon Wunderlich  * @wiphy: the wiphy
440804f39047SSimon Wunderlich  * @chandef: chandef for the current channel
440904f39047SSimon Wunderlich  * @gfp: context flags
441004f39047SSimon Wunderlich  *
441104f39047SSimon Wunderlich  * This function is called when a radar is detected on the current chanenl.
441204f39047SSimon Wunderlich  */
441304f39047SSimon Wunderlich void cfg80211_radar_event(struct wiphy *wiphy,
441404f39047SSimon Wunderlich 			  struct cfg80211_chan_def *chandef, gfp_t gfp);
441504f39047SSimon Wunderlich 
441604f39047SSimon Wunderlich /**
441704f39047SSimon Wunderlich  * cfg80211_cac_event - Channel availability check (CAC) event
441804f39047SSimon Wunderlich  * @netdev: network device
4419d2859df5SJanusz Dziedzic  * @chandef: chandef for the current channel
442004f39047SSimon Wunderlich  * @event: type of event
442104f39047SSimon Wunderlich  * @gfp: context flags
442204f39047SSimon Wunderlich  *
442304f39047SSimon Wunderlich  * This function is called when a Channel availability check (CAC) is finished
442404f39047SSimon Wunderlich  * or aborted. This must be called to notify the completion of a CAC process,
442504f39047SSimon Wunderlich  * also by full-MAC drivers.
442604f39047SSimon Wunderlich  */
442704f39047SSimon Wunderlich void cfg80211_cac_event(struct net_device *netdev,
4428d2859df5SJanusz Dziedzic 			const struct cfg80211_chan_def *chandef,
442904f39047SSimon Wunderlich 			enum nl80211_radar_event event, gfp_t gfp);
443004f39047SSimon Wunderlich 
443104f39047SSimon Wunderlich 
443204f39047SSimon Wunderlich /**
4433c063dbf5SJohannes Berg  * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer
4434c063dbf5SJohannes Berg  * @dev: network device
4435c063dbf5SJohannes Berg  * @peer: peer's MAC address
4436c063dbf5SJohannes Berg  * @num_packets: how many packets were lost -- should be a fixed threshold
4437c063dbf5SJohannes Berg  *	but probably no less than maybe 50, or maybe a throughput dependent
4438c063dbf5SJohannes Berg  *	threshold (to account for temporary interference)
4439c063dbf5SJohannes Berg  * @gfp: context flags
4440c063dbf5SJohannes Berg  */
4441c063dbf5SJohannes Berg void cfg80211_cqm_pktloss_notify(struct net_device *dev,
4442c063dbf5SJohannes Berg 				 const u8 *peer, u32 num_packets, gfp_t gfp);
4443c063dbf5SJohannes Berg 
4444e5497d76SJohannes Berg /**
444584f10708SThomas Pedersen  * cfg80211_cqm_txe_notify - TX error rate event
444684f10708SThomas Pedersen  * @dev: network device
444784f10708SThomas Pedersen  * @peer: peer's MAC address
444884f10708SThomas Pedersen  * @num_packets: how many packets were lost
444984f10708SThomas Pedersen  * @rate: % of packets which failed transmission
445084f10708SThomas Pedersen  * @intvl: interval (in s) over which the TX failure threshold was breached.
445184f10708SThomas Pedersen  * @gfp: context flags
445284f10708SThomas Pedersen  *
445384f10708SThomas Pedersen  * Notify userspace when configured % TX failures over number of packets in a
445484f10708SThomas Pedersen  * given interval is exceeded.
445584f10708SThomas Pedersen  */
445684f10708SThomas Pedersen void cfg80211_cqm_txe_notify(struct net_device *dev, const u8 *peer,
445784f10708SThomas Pedersen 			     u32 num_packets, u32 rate, u32 intvl, gfp_t gfp);
445884f10708SThomas Pedersen 
445984f10708SThomas Pedersen /**
4460e5497d76SJohannes Berg  * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying
4461e5497d76SJohannes Berg  * @dev: network device
4462e5497d76SJohannes Berg  * @bssid: BSSID of AP (to avoid races)
4463e5497d76SJohannes Berg  * @replay_ctr: new replay counter
4464af71ff85SJohannes Berg  * @gfp: allocation flags
4465e5497d76SJohannes Berg  */
4466e5497d76SJohannes Berg void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid,
4467e5497d76SJohannes Berg 			       const u8 *replay_ctr, gfp_t gfp);
4468e5497d76SJohannes Berg 
4469c9df56b4SJouni Malinen /**
4470c9df56b4SJouni Malinen  * cfg80211_pmksa_candidate_notify - notify about PMKSA caching candidate
4471c9df56b4SJouni Malinen  * @dev: network device
4472c9df56b4SJouni Malinen  * @index: candidate index (the smaller the index, the higher the priority)
4473c9df56b4SJouni Malinen  * @bssid: BSSID of AP
4474c9df56b4SJouni Malinen  * @preauth: Whether AP advertises support for RSN pre-authentication
4475c9df56b4SJouni Malinen  * @gfp: allocation flags
4476c9df56b4SJouni Malinen  */
4477c9df56b4SJouni Malinen void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index,
4478c9df56b4SJouni Malinen 				     const u8 *bssid, bool preauth, gfp_t gfp);
4479c9df56b4SJouni Malinen 
448028946da7SJohannes Berg /**
448128946da7SJohannes Berg  * cfg80211_rx_spurious_frame - inform userspace about a spurious frame
448228946da7SJohannes Berg  * @dev: The device the frame matched to
448328946da7SJohannes Berg  * @addr: the transmitter address
448428946da7SJohannes Berg  * @gfp: context flags
448528946da7SJohannes Berg  *
448628946da7SJohannes Berg  * This function is used in AP mode (only!) to inform userspace that
448728946da7SJohannes Berg  * a spurious class 3 frame was received, to be able to deauth the
448828946da7SJohannes Berg  * sender.
44890ae997dcSYacine Belkadi  * Return: %true if the frame was passed to userspace (or this failed
449028946da7SJohannes Berg  * for a reason other than not having a subscription.)
449128946da7SJohannes Berg  */
449228946da7SJohannes Berg bool cfg80211_rx_spurious_frame(struct net_device *dev,
449328946da7SJohannes Berg 				const u8 *addr, gfp_t gfp);
449428946da7SJohannes Berg 
44957f6cf311SJohannes Berg /**
4496b92ab5d8SJohannes Berg  * cfg80211_rx_unexpected_4addr_frame - inform about unexpected WDS frame
4497b92ab5d8SJohannes Berg  * @dev: The device the frame matched to
4498b92ab5d8SJohannes Berg  * @addr: the transmitter address
4499b92ab5d8SJohannes Berg  * @gfp: context flags
4500b92ab5d8SJohannes Berg  *
4501b92ab5d8SJohannes Berg  * This function is used in AP mode (only!) to inform userspace that
4502b92ab5d8SJohannes Berg  * an associated station sent a 4addr frame but that wasn't expected.
4503b92ab5d8SJohannes Berg  * It is allowed and desirable to send this event only once for each
4504b92ab5d8SJohannes Berg  * station to avoid event flooding.
45050ae997dcSYacine Belkadi  * Return: %true if the frame was passed to userspace (or this failed
4506b92ab5d8SJohannes Berg  * for a reason other than not having a subscription.)
4507b92ab5d8SJohannes Berg  */
4508b92ab5d8SJohannes Berg bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev,
4509b92ab5d8SJohannes Berg 					const u8 *addr, gfp_t gfp);
4510b92ab5d8SJohannes Berg 
4511b92ab5d8SJohannes Berg /**
45127f6cf311SJohannes Berg  * cfg80211_probe_status - notify userspace about probe status
45137f6cf311SJohannes Berg  * @dev: the device the probe was sent on
45147f6cf311SJohannes Berg  * @addr: the address of the peer
45157f6cf311SJohannes Berg  * @cookie: the cookie filled in @probe_client previously
45167f6cf311SJohannes Berg  * @acked: indicates whether probe was acked or not
45177f6cf311SJohannes Berg  * @gfp: allocation flags
45187f6cf311SJohannes Berg  */
45197f6cf311SJohannes Berg void cfg80211_probe_status(struct net_device *dev, const u8 *addr,
45207f6cf311SJohannes Berg 			   u64 cookie, bool acked, gfp_t gfp);
45217f6cf311SJohannes Berg 
45225e760230SJohannes Berg /**
45235e760230SJohannes Berg  * cfg80211_report_obss_beacon - report beacon from other APs
45245e760230SJohannes Berg  * @wiphy: The wiphy that received the beacon
45255e760230SJohannes Berg  * @frame: the frame
45265e760230SJohannes Berg  * @len: length of the frame
45275e760230SJohannes Berg  * @freq: frequency the frame was received on
4528804483e9SJohannes Berg  * @sig_dbm: signal strength in mBm, or 0 if unknown
45295e760230SJohannes Berg  *
45305e760230SJohannes Berg  * Use this function to report to userspace when a beacon was
45315e760230SJohannes Berg  * received. It is not useful to call this when there is no
45325e760230SJohannes Berg  * netdev that is in AP/GO mode.
45335e760230SJohannes Berg  */
45345e760230SJohannes Berg void cfg80211_report_obss_beacon(struct wiphy *wiphy,
45355e760230SJohannes Berg 				 const u8 *frame, size_t len,
453637c73b5fSBen Greear 				 int freq, int sig_dbm);
45375e760230SJohannes Berg 
4538d58e7e37SJohannes Berg /**
4539683b6d3bSJohannes Berg  * cfg80211_reg_can_beacon - check if beaconing is allowed
454054858ee5SAlexander Simon  * @wiphy: the wiphy
4541683b6d3bSJohannes Berg  * @chandef: the channel definition
4542174e0cd2SIlan Peer  * @iftype: interface type
4543d58e7e37SJohannes Berg  *
45440ae997dcSYacine Belkadi  * Return: %true if there is no secondary channel or the secondary channel(s)
45450ae997dcSYacine Belkadi  * can be used for beaconing (i.e. is not a radar channel etc.)
454654858ee5SAlexander Simon  */
4547683b6d3bSJohannes Berg bool cfg80211_reg_can_beacon(struct wiphy *wiphy,
4548174e0cd2SIlan Peer 			     struct cfg80211_chan_def *chandef,
4549174e0cd2SIlan Peer 			     enum nl80211_iftype iftype);
455054858ee5SAlexander Simon 
45518097e149SThomas Pedersen /*
45525314526bSThomas Pedersen  * cfg80211_ch_switch_notify - update wdev channel and notify userspace
45535314526bSThomas Pedersen  * @dev: the device which switched channels
4554683b6d3bSJohannes Berg  * @chandef: the new channel definition
45555314526bSThomas Pedersen  *
4556e487eaebSSimon Wunderlich  * Caller must acquire wdev_lock, therefore must only be called from sleepable
4557e487eaebSSimon Wunderlich  * driver context!
45585314526bSThomas Pedersen  */
4559683b6d3bSJohannes Berg void cfg80211_ch_switch_notify(struct net_device *dev,
4560683b6d3bSJohannes Berg 			       struct cfg80211_chan_def *chandef);
45615314526bSThomas Pedersen 
45621ce3e82bSJohannes Berg /**
45631ce3e82bSJohannes Berg  * ieee80211_operating_class_to_band - convert operating class to band
45641ce3e82bSJohannes Berg  *
45651ce3e82bSJohannes Berg  * @operating_class: the operating class to convert
45661ce3e82bSJohannes Berg  * @band: band pointer to fill
45671ce3e82bSJohannes Berg  *
45681ce3e82bSJohannes Berg  * Returns %true if the conversion was successful, %false otherwise.
45691ce3e82bSJohannes Berg  */
45701ce3e82bSJohannes Berg bool ieee80211_operating_class_to_band(u8 operating_class,
45711ce3e82bSJohannes Berg 				       enum ieee80211_band *band);
45721ce3e82bSJohannes Berg 
45735314526bSThomas Pedersen /*
45743475b094SJouni Malinen  * cfg80211_tdls_oper_request - request userspace to perform TDLS operation
45753475b094SJouni Malinen  * @dev: the device on which the operation is requested
45763475b094SJouni Malinen  * @peer: the MAC address of the peer device
45773475b094SJouni Malinen  * @oper: the requested TDLS operation (NL80211_TDLS_SETUP or
45783475b094SJouni Malinen  *	NL80211_TDLS_TEARDOWN)
45793475b094SJouni Malinen  * @reason_code: the reason code for teardown request
45803475b094SJouni Malinen  * @gfp: allocation flags
45813475b094SJouni Malinen  *
45823475b094SJouni Malinen  * This function is used to request userspace to perform TDLS operation that
45833475b094SJouni Malinen  * requires knowledge of keys, i.e., link setup or teardown when the AP
45843475b094SJouni Malinen  * connection uses encryption. This is optional mechanism for the driver to use
45853475b094SJouni Malinen  * if it can automatically determine when a TDLS link could be useful (e.g.,
45863475b094SJouni Malinen  * based on traffic and signal strength for a peer).
45873475b094SJouni Malinen  */
45883475b094SJouni Malinen void cfg80211_tdls_oper_request(struct net_device *dev, const u8 *peer,
45893475b094SJouni Malinen 				enum nl80211_tdls_operation oper,
45903475b094SJouni Malinen 				u16 reason_code, gfp_t gfp);
45913475b094SJouni Malinen 
45923475b094SJouni Malinen /*
45938097e149SThomas Pedersen  * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units)
45948097e149SThomas Pedersen  * @rate: given rate_info to calculate bitrate from
45958097e149SThomas Pedersen  *
45968097e149SThomas Pedersen  * return 0 if MCS index >= 32
45978097e149SThomas Pedersen  */
45988eb41c8dSVladimir Kondratiev u32 cfg80211_calculate_bitrate(struct rate_info *rate);
45998097e149SThomas Pedersen 
460098104fdeSJohannes Berg /**
460198104fdeSJohannes Berg  * cfg80211_unregister_wdev - remove the given wdev
460298104fdeSJohannes Berg  * @wdev: struct wireless_dev to remove
460398104fdeSJohannes Berg  *
460498104fdeSJohannes Berg  * Call this function only for wdevs that have no netdev assigned,
460598104fdeSJohannes Berg  * e.g. P2P Devices. It removes the device from the list so that
460698104fdeSJohannes Berg  * it can no longer be used. It is necessary to call this function
460798104fdeSJohannes Berg  * even when cfg80211 requests the removal of the interface by
460898104fdeSJohannes Berg  * calling the del_virtual_intf() callback. The function must also
460998104fdeSJohannes Berg  * be called when the driver wishes to unregister the wdev, e.g.
461098104fdeSJohannes Berg  * when the device is unbound from the driver.
461198104fdeSJohannes Berg  *
461298104fdeSJohannes Berg  * Requires the RTNL to be held.
461398104fdeSJohannes Berg  */
461498104fdeSJohannes Berg void cfg80211_unregister_wdev(struct wireless_dev *wdev);
461598104fdeSJohannes Berg 
46160ee45355SJohannes Berg /**
4617355199e0SJouni Malinen  * struct cfg80211_ft_event - FT Information Elements
4618355199e0SJouni Malinen  * @ies: FT IEs
4619355199e0SJouni Malinen  * @ies_len: length of the FT IE in bytes
4620355199e0SJouni Malinen  * @target_ap: target AP's MAC address
4621355199e0SJouni Malinen  * @ric_ies: RIC IE
4622355199e0SJouni Malinen  * @ric_ies_len: length of the RIC IE in bytes
4623355199e0SJouni Malinen  */
4624355199e0SJouni Malinen struct cfg80211_ft_event_params {
4625355199e0SJouni Malinen 	const u8 *ies;
4626355199e0SJouni Malinen 	size_t ies_len;
4627355199e0SJouni Malinen 	const u8 *target_ap;
4628355199e0SJouni Malinen 	const u8 *ric_ies;
4629355199e0SJouni Malinen 	size_t ric_ies_len;
4630355199e0SJouni Malinen };
4631355199e0SJouni Malinen 
4632355199e0SJouni Malinen /**
4633355199e0SJouni Malinen  * cfg80211_ft_event - notify userspace about FT IE and RIC IE
4634355199e0SJouni Malinen  * @netdev: network device
4635355199e0SJouni Malinen  * @ft_event: IE information
4636355199e0SJouni Malinen  */
4637355199e0SJouni Malinen void cfg80211_ft_event(struct net_device *netdev,
4638355199e0SJouni Malinen 		       struct cfg80211_ft_event_params *ft_event);
4639355199e0SJouni Malinen 
4640355199e0SJouni Malinen /**
46410ee45355SJohannes Berg  * cfg80211_get_p2p_attr - find and copy a P2P attribute from IE buffer
46420ee45355SJohannes Berg  * @ies: the input IE buffer
46430ee45355SJohannes Berg  * @len: the input length
46440ee45355SJohannes Berg  * @attr: the attribute ID to find
46450ee45355SJohannes Berg  * @buf: output buffer, can be %NULL if the data isn't needed, e.g.
46460ee45355SJohannes Berg  *	if the function is only called to get the needed buffer size
46470ee45355SJohannes Berg  * @bufsize: size of the output buffer
46480ee45355SJohannes Berg  *
46490ee45355SJohannes Berg  * The function finds a given P2P attribute in the (vendor) IEs and
46500ee45355SJohannes Berg  * copies its contents to the given buffer.
46510ee45355SJohannes Berg  *
46520ae997dcSYacine Belkadi  * Return: A negative error code (-%EILSEQ or -%ENOENT) if the data is
46530ae997dcSYacine Belkadi  * malformed or the attribute can't be found (respectively), or the
46540ae997dcSYacine Belkadi  * length of the found attribute (which can be zero).
46550ee45355SJohannes Berg  */
4656c216e641SArend van Spriel int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len,
4657c216e641SArend van Spriel 			  enum ieee80211_p2p_attr_id attr,
4658c216e641SArend van Spriel 			  u8 *buf, unsigned int bufsize);
46590ee45355SJohannes Berg 
4660cd8f7cb4SJohannes Berg /**
4661cd8f7cb4SJohannes Berg  * cfg80211_report_wowlan_wakeup - report wakeup from WoWLAN
4662cd8f7cb4SJohannes Berg  * @wdev: the wireless device reporting the wakeup
4663cd8f7cb4SJohannes Berg  * @wakeup: the wakeup report
4664cd8f7cb4SJohannes Berg  * @gfp: allocation flags
4665cd8f7cb4SJohannes Berg  *
4666cd8f7cb4SJohannes Berg  * This function reports that the given device woke up. If it
4667cd8f7cb4SJohannes Berg  * caused the wakeup, report the reason(s), otherwise you may
4668cd8f7cb4SJohannes Berg  * pass %NULL as the @wakeup parameter to advertise that something
4669cd8f7cb4SJohannes Berg  * else caused the wakeup.
4670cd8f7cb4SJohannes Berg  */
4671cd8f7cb4SJohannes Berg void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev,
4672cd8f7cb4SJohannes Berg 				   struct cfg80211_wowlan_wakeup *wakeup,
4673cd8f7cb4SJohannes Berg 				   gfp_t gfp);
4674cd8f7cb4SJohannes Berg 
46755de17984SArend van Spriel /**
46765de17984SArend van Spriel  * cfg80211_crit_proto_stopped() - indicate critical protocol stopped by driver.
46775de17984SArend van Spriel  *
46785de17984SArend van Spriel  * @wdev: the wireless device for which critical protocol is stopped.
467903f831a6SRobert P. J. Day  * @gfp: allocation flags
46805de17984SArend van Spriel  *
46815de17984SArend van Spriel  * This function can be called by the driver to indicate it has reverted
46825de17984SArend van Spriel  * operation back to normal. One reason could be that the duration given
46835de17984SArend van Spriel  * by .crit_proto_start() has expired.
46845de17984SArend van Spriel  */
46855de17984SArend van Spriel void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp);
46865de17984SArend van Spriel 
4687bdfbec2dSIlan Peer /**
4688bdfbec2dSIlan Peer  * ieee80211_get_num_supported_channels - get number of channels device has
4689bdfbec2dSIlan Peer  * @wiphy: the wiphy
4690bdfbec2dSIlan Peer  *
4691bdfbec2dSIlan Peer  * Return: the number of channels supported by the device.
4692bdfbec2dSIlan Peer  */
4693bdfbec2dSIlan Peer unsigned int ieee80211_get_num_supported_channels(struct wiphy *wiphy);
4694bdfbec2dSIlan Peer 
4695*cb2d956dSLuciano Coelho /**
4696*cb2d956dSLuciano Coelho  * cfg80211_check_combinations - check interface combinations
4697*cb2d956dSLuciano Coelho  *
4698*cb2d956dSLuciano Coelho  * @wiphy: the wiphy
4699*cb2d956dSLuciano Coelho  * @num_different_channels: the number of different channels we want
4700*cb2d956dSLuciano Coelho  *	to use for verification
4701*cb2d956dSLuciano Coelho  * @radar_detect: a bitmap where each bit corresponds to a channel
4702*cb2d956dSLuciano Coelho  *	width where radar detection is needed, as in the definition of
4703*cb2d956dSLuciano Coelho  *	&struct ieee80211_iface_combination.@radar_detect_widths
4704*cb2d956dSLuciano Coelho  * @iftype_num: array with the numbers of interfaces of each interface
4705*cb2d956dSLuciano Coelho  *	type.  The index is the interface type as specified in &enum
4706*cb2d956dSLuciano Coelho  *	nl80211_iftype.
4707*cb2d956dSLuciano Coelho  *
4708*cb2d956dSLuciano Coelho  * This function can be called by the driver to check whether a
4709*cb2d956dSLuciano Coelho  * combination of interfaces and their types are allowed according to
4710*cb2d956dSLuciano Coelho  * the interface combinations.
4711*cb2d956dSLuciano Coelho  */
4712*cb2d956dSLuciano Coelho int cfg80211_check_combinations(struct wiphy *wiphy,
4713*cb2d956dSLuciano Coelho 				const int num_different_channels,
4714*cb2d956dSLuciano Coelho 				const u8 radar_detect,
4715*cb2d956dSLuciano Coelho 				const int iftype_num[NUM_NL80211_IFTYPES]);
4716*cb2d956dSLuciano Coelho 
4717e1db74fcSJoe Perches /* Logging, debugging and troubleshooting/diagnostic helpers. */
4718e1db74fcSJoe Perches 
4719e1db74fcSJoe Perches /* wiphy_printk helpers, similar to dev_printk */
4720e1db74fcSJoe Perches 
4721e1db74fcSJoe Perches #define wiphy_printk(level, wiphy, format, args...)		\
47229c376639SJoe Perches 	dev_printk(level, &(wiphy)->dev, format, ##args)
4723e1db74fcSJoe Perches #define wiphy_emerg(wiphy, format, args...)			\
47249c376639SJoe Perches 	dev_emerg(&(wiphy)->dev, format, ##args)
4725e1db74fcSJoe Perches #define wiphy_alert(wiphy, format, args...)			\
47269c376639SJoe Perches 	dev_alert(&(wiphy)->dev, format, ##args)
4727e1db74fcSJoe Perches #define wiphy_crit(wiphy, format, args...)			\
47289c376639SJoe Perches 	dev_crit(&(wiphy)->dev, format, ##args)
4729e1db74fcSJoe Perches #define wiphy_err(wiphy, format, args...)			\
47309c376639SJoe Perches 	dev_err(&(wiphy)->dev, format, ##args)
4731e1db74fcSJoe Perches #define wiphy_warn(wiphy, format, args...)			\
47329c376639SJoe Perches 	dev_warn(&(wiphy)->dev, format, ##args)
4733e1db74fcSJoe Perches #define wiphy_notice(wiphy, format, args...)			\
47349c376639SJoe Perches 	dev_notice(&(wiphy)->dev, format, ##args)
4735e1db74fcSJoe Perches #define wiphy_info(wiphy, format, args...)			\
47369c376639SJoe Perches 	dev_info(&(wiphy)->dev, format, ##args)
4737073730d7SJoe Perches 
47389c376639SJoe Perches #define wiphy_debug(wiphy, format, args...)			\
4739e1db74fcSJoe Perches 	wiphy_printk(KERN_DEBUG, wiphy, format, ##args)
47409c376639SJoe Perches 
4741e1db74fcSJoe Perches #define wiphy_dbg(wiphy, format, args...)			\
47429c376639SJoe Perches 	dev_dbg(&(wiphy)->dev, format, ##args)
4743e1db74fcSJoe Perches 
4744e1db74fcSJoe Perches #if defined(VERBOSE_DEBUG)
4745e1db74fcSJoe Perches #define wiphy_vdbg	wiphy_dbg
4746e1db74fcSJoe Perches #else
4747e1db74fcSJoe Perches #define wiphy_vdbg(wiphy, format, args...)				\
4748e1db74fcSJoe Perches ({									\
4749e1db74fcSJoe Perches 	if (0)								\
4750e1db74fcSJoe Perches 		wiphy_printk(KERN_DEBUG, wiphy, format, ##args);	\
4751e1db74fcSJoe Perches 	0;								\
4752e1db74fcSJoe Perches })
4753e1db74fcSJoe Perches #endif
4754e1db74fcSJoe Perches 
4755e1db74fcSJoe Perches /*
4756e1db74fcSJoe Perches  * wiphy_WARN() acts like wiphy_printk(), but with the key difference
4757e1db74fcSJoe Perches  * of using a WARN/WARN_ON to get the message out, including the
4758e1db74fcSJoe Perches  * file/line information and a backtrace.
4759e1db74fcSJoe Perches  */
4760e1db74fcSJoe Perches #define wiphy_WARN(wiphy, format, args...)			\
4761e1db74fcSJoe Perches 	WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args);
4762e1db74fcSJoe Perches 
4763704232c2SJohannes Berg #endif /* __NET_CFG80211_H */
4764