xref: /linux/include/net/cfg80211.h (revision 0430c883470d0c9a23661ea9f02c56b1d91cf93c)
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.
94d3236553SJohannes Berg  * @IEEE80211_CHAN_PASSIVE_SCAN: Only passive scanning is permitted
95d3236553SJohannes Berg  *	on this channel.
96d3236553SJohannes Berg  * @IEEE80211_CHAN_NO_IBSS: IBSS is not allowed on this channel.
97d3236553SJohannes Berg  * @IEEE80211_CHAN_RADAR: Radar detection is required on this channel.
98689da1b3SLuis R. Rodriguez  * @IEEE80211_CHAN_NO_HT40PLUS: extension channel above this channel
99d3236553SJohannes Berg  * 	is not permitted.
100689da1b3SLuis R. Rodriguez  * @IEEE80211_CHAN_NO_HT40MINUS: extension channel below this channel
101d3236553SJohannes Berg  * 	is not permitted.
10203f6b084SSeth Forshee  * @IEEE80211_CHAN_NO_OFDM: OFDM is not allowed on this channel.
103c7a6ee27SJohannes Berg  * @IEEE80211_CHAN_NO_80MHZ: If the driver supports 80 MHz on the band,
104c7a6ee27SJohannes Berg  *	this flag indicates that an 80 MHz channel cannot use this
105c7a6ee27SJohannes Berg  *	channel as the control or any of the secondary channels.
106c7a6ee27SJohannes Berg  *	This may be due to the driver or due to regulatory bandwidth
107c7a6ee27SJohannes Berg  *	restrictions.
108c7a6ee27SJohannes Berg  * @IEEE80211_CHAN_NO_160MHZ: If the driver supports 160 MHz on the band,
109c7a6ee27SJohannes Berg  *	this flag indicates that an 160 MHz channel cannot use this
110c7a6ee27SJohannes Berg  *	channel as the control or any of the secondary channels.
111c7a6ee27SJohannes Berg  *	This may be due to the driver or due to regulatory bandwidth
112c7a6ee27SJohannes Berg  *	restrictions.
113d3236553SJohannes Berg  */
114d3236553SJohannes Berg enum ieee80211_channel_flags {
115d3236553SJohannes Berg 	IEEE80211_CHAN_DISABLED		= 1<<0,
116d3236553SJohannes Berg 	IEEE80211_CHAN_PASSIVE_SCAN	= 1<<1,
117d3236553SJohannes Berg 	IEEE80211_CHAN_NO_IBSS		= 1<<2,
118d3236553SJohannes Berg 	IEEE80211_CHAN_RADAR		= 1<<3,
119689da1b3SLuis R. Rodriguez 	IEEE80211_CHAN_NO_HT40PLUS	= 1<<4,
120689da1b3SLuis R. Rodriguez 	IEEE80211_CHAN_NO_HT40MINUS	= 1<<5,
12103f6b084SSeth Forshee 	IEEE80211_CHAN_NO_OFDM		= 1<<6,
122c7a6ee27SJohannes Berg 	IEEE80211_CHAN_NO_80MHZ		= 1<<7,
123c7a6ee27SJohannes Berg 	IEEE80211_CHAN_NO_160MHZ	= 1<<8,
124d3236553SJohannes Berg };
125d3236553SJohannes Berg 
126038659e7SLuis R. Rodriguez #define IEEE80211_CHAN_NO_HT40 \
127689da1b3SLuis R. Rodriguez 	(IEEE80211_CHAN_NO_HT40PLUS | IEEE80211_CHAN_NO_HT40MINUS)
128038659e7SLuis R. Rodriguez 
12904f39047SSimon Wunderlich #define IEEE80211_DFS_MIN_CAC_TIME_MS		60000
13004f39047SSimon Wunderlich #define IEEE80211_DFS_MIN_NOP_TIME_MS		(30 * 60 * 1000)
13104f39047SSimon Wunderlich 
132d3236553SJohannes Berg /**
133d3236553SJohannes Berg  * struct ieee80211_channel - channel definition
134d3236553SJohannes Berg  *
135d3236553SJohannes Berg  * This structure describes a single channel for use
136d3236553SJohannes Berg  * with cfg80211.
137d3236553SJohannes Berg  *
138d3236553SJohannes Berg  * @center_freq: center frequency in MHz
139d3236553SJohannes Berg  * @hw_value: hardware-specific value for the channel
140d3236553SJohannes Berg  * @flags: channel flags from &enum ieee80211_channel_flags.
141d3236553SJohannes Berg  * @orig_flags: channel flags at registration time, used by regulatory
142d3236553SJohannes Berg  *	code to support devices with additional restrictions
143d3236553SJohannes Berg  * @band: band this channel belongs to.
144d3236553SJohannes Berg  * @max_antenna_gain: maximum antenna gain in dBi
145d3236553SJohannes Berg  * @max_power: maximum transmission power (in dBm)
146eccc068eSHong Wu  * @max_reg_power: maximum regulatory transmission power (in dBm)
147d3236553SJohannes Berg  * @beacon_found: helper to regulatory code to indicate when a beacon
148d3236553SJohannes Berg  *	has been found on this channel. Use regulatory_hint_found_beacon()
14977c2061dSWalter Goldens  *	to enable this, this is useful only on 5 GHz band.
150d3236553SJohannes Berg  * @orig_mag: internal use
151d3236553SJohannes Berg  * @orig_mpwr: internal use
15204f39047SSimon Wunderlich  * @dfs_state: current state of this channel. Only relevant if radar is required
15304f39047SSimon Wunderlich  *	on this channel.
15404f39047SSimon Wunderlich  * @dfs_state_entered: timestamp (jiffies) when the dfs state was entered.
155d3236553SJohannes Berg  */
156d3236553SJohannes Berg struct ieee80211_channel {
157d3236553SJohannes Berg 	enum ieee80211_band band;
158d3236553SJohannes Berg 	u16 center_freq;
159d3236553SJohannes Berg 	u16 hw_value;
160d3236553SJohannes Berg 	u32 flags;
161d3236553SJohannes Berg 	int max_antenna_gain;
162d3236553SJohannes Berg 	int max_power;
163eccc068eSHong Wu 	int max_reg_power;
164d3236553SJohannes Berg 	bool beacon_found;
165d3236553SJohannes Berg 	u32 orig_flags;
166d3236553SJohannes Berg 	int orig_mag, orig_mpwr;
16704f39047SSimon Wunderlich 	enum nl80211_dfs_state dfs_state;
16804f39047SSimon Wunderlich 	unsigned long dfs_state_entered;
169d3236553SJohannes Berg };
170d3236553SJohannes Berg 
171d3236553SJohannes Berg /**
172d3236553SJohannes Berg  * enum ieee80211_rate_flags - rate flags
173d3236553SJohannes Berg  *
174d3236553SJohannes Berg  * Hardware/specification flags for rates. These are structured
175d3236553SJohannes Berg  * in a way that allows using the same bitrate structure for
176d3236553SJohannes Berg  * different bands/PHY modes.
177d3236553SJohannes Berg  *
178d3236553SJohannes Berg  * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short
179d3236553SJohannes Berg  *	preamble on this bitrate; only relevant in 2.4GHz band and
180d3236553SJohannes Berg  *	with CCK rates.
181d3236553SJohannes Berg  * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate
182d3236553SJohannes Berg  *	when used with 802.11a (on the 5 GHz band); filled by the
183d3236553SJohannes Berg  *	core code when registering the wiphy.
184d3236553SJohannes Berg  * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate
185d3236553SJohannes Berg  *	when used with 802.11b (on the 2.4 GHz band); filled by the
186d3236553SJohannes Berg  *	core code when registering the wiphy.
187d3236553SJohannes Berg  * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate
188d3236553SJohannes Berg  *	when used with 802.11g (on the 2.4 GHz band); filled by the
189d3236553SJohannes Berg  *	core code when registering the wiphy.
190d3236553SJohannes Berg  * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode.
19130e74732SSimon Wunderlich  * @IEEE80211_RATE_SUPPORTS_5MHZ: Rate can be used in 5 MHz mode
19230e74732SSimon Wunderlich  * @IEEE80211_RATE_SUPPORTS_10MHZ: Rate can be used in 10 MHz mode
193d3236553SJohannes Berg  */
194d3236553SJohannes Berg enum ieee80211_rate_flags {
195d3236553SJohannes Berg 	IEEE80211_RATE_SHORT_PREAMBLE	= 1<<0,
196d3236553SJohannes Berg 	IEEE80211_RATE_MANDATORY_A	= 1<<1,
197d3236553SJohannes Berg 	IEEE80211_RATE_MANDATORY_B	= 1<<2,
198d3236553SJohannes Berg 	IEEE80211_RATE_MANDATORY_G	= 1<<3,
199d3236553SJohannes Berg 	IEEE80211_RATE_ERP_G		= 1<<4,
20030e74732SSimon Wunderlich 	IEEE80211_RATE_SUPPORTS_5MHZ	= 1<<5,
20130e74732SSimon Wunderlich 	IEEE80211_RATE_SUPPORTS_10MHZ	= 1<<6,
202d3236553SJohannes Berg };
203d3236553SJohannes Berg 
204d3236553SJohannes Berg /**
205d3236553SJohannes Berg  * struct ieee80211_rate - bitrate definition
206d3236553SJohannes Berg  *
207d3236553SJohannes Berg  * This structure describes a bitrate that an 802.11 PHY can
208d3236553SJohannes Berg  * operate with. The two values @hw_value and @hw_value_short
209d3236553SJohannes Berg  * are only for driver use when pointers to this structure are
210d3236553SJohannes Berg  * passed around.
211d3236553SJohannes Berg  *
212d3236553SJohannes Berg  * @flags: rate-specific flags
213d3236553SJohannes Berg  * @bitrate: bitrate in units of 100 Kbps
214d3236553SJohannes Berg  * @hw_value: driver/hardware value for this rate
215d3236553SJohannes Berg  * @hw_value_short: driver/hardware value for this rate when
216d3236553SJohannes Berg  *	short preamble is used
217d3236553SJohannes Berg  */
218d3236553SJohannes Berg struct ieee80211_rate {
219d3236553SJohannes Berg 	u32 flags;
220d3236553SJohannes Berg 	u16 bitrate;
221d3236553SJohannes Berg 	u16 hw_value, hw_value_short;
222d3236553SJohannes Berg };
223d3236553SJohannes Berg 
224d3236553SJohannes Berg /**
225d3236553SJohannes Berg  * struct ieee80211_sta_ht_cap - STA's HT capabilities
226d3236553SJohannes Berg  *
227d3236553SJohannes Berg  * This structure describes most essential parameters needed
228d3236553SJohannes Berg  * to describe 802.11n HT capabilities for an STA.
229d3236553SJohannes Berg  *
230d3236553SJohannes Berg  * @ht_supported: is HT supported by the STA
231d3236553SJohannes Berg  * @cap: HT capabilities map as described in 802.11n spec
232d3236553SJohannes Berg  * @ampdu_factor: Maximum A-MPDU length factor
233d3236553SJohannes Berg  * @ampdu_density: Minimum A-MPDU spacing
234d3236553SJohannes Berg  * @mcs: Supported MCS rates
235d3236553SJohannes Berg  */
236d3236553SJohannes Berg struct ieee80211_sta_ht_cap {
237d3236553SJohannes Berg 	u16 cap; /* use IEEE80211_HT_CAP_ */
238d3236553SJohannes Berg 	bool ht_supported;
239d3236553SJohannes Berg 	u8 ampdu_factor;
240d3236553SJohannes Berg 	u8 ampdu_density;
241d3236553SJohannes Berg 	struct ieee80211_mcs_info mcs;
242d3236553SJohannes Berg };
243d3236553SJohannes Berg 
244d3236553SJohannes Berg /**
245bf0c111eSMahesh Palivela  * struct ieee80211_sta_vht_cap - STA's VHT capabilities
246bf0c111eSMahesh Palivela  *
247bf0c111eSMahesh Palivela  * This structure describes most essential parameters needed
248bf0c111eSMahesh Palivela  * to describe 802.11ac VHT capabilities for an STA.
249bf0c111eSMahesh Palivela  *
250bf0c111eSMahesh Palivela  * @vht_supported: is VHT supported by the STA
251bf0c111eSMahesh Palivela  * @cap: VHT capabilities map as described in 802.11ac spec
252bf0c111eSMahesh Palivela  * @vht_mcs: Supported VHT MCS rates
253bf0c111eSMahesh Palivela  */
254bf0c111eSMahesh Palivela struct ieee80211_sta_vht_cap {
255bf0c111eSMahesh Palivela 	bool vht_supported;
256bf0c111eSMahesh Palivela 	u32 cap; /* use IEEE80211_VHT_CAP_ */
257bf0c111eSMahesh Palivela 	struct ieee80211_vht_mcs_info vht_mcs;
258bf0c111eSMahesh Palivela };
259bf0c111eSMahesh Palivela 
260bf0c111eSMahesh Palivela /**
261d3236553SJohannes Berg  * struct ieee80211_supported_band - frequency band definition
262d3236553SJohannes Berg  *
263d3236553SJohannes Berg  * This structure describes a frequency band a wiphy
264d3236553SJohannes Berg  * is able to operate in.
265d3236553SJohannes Berg  *
266d3236553SJohannes Berg  * @channels: Array of channels the hardware can operate in
267d3236553SJohannes Berg  *	in this band.
268d3236553SJohannes Berg  * @band: the band this structure represents
269d3236553SJohannes Berg  * @n_channels: Number of channels in @channels
270d3236553SJohannes Berg  * @bitrates: Array of bitrates the hardware can operate with
271d3236553SJohannes Berg  *	in this band. Must be sorted to give a valid "supported
272d3236553SJohannes Berg  *	rates" IE, i.e. CCK rates first, then OFDM.
273d3236553SJohannes Berg  * @n_bitrates: Number of bitrates in @bitrates
274abe37c4bSJohannes Berg  * @ht_cap: HT capabilities in this band
275c9a0a302SRobert P. J. Day  * @vht_cap: VHT capabilities in this band
276d3236553SJohannes Berg  */
277d3236553SJohannes Berg struct ieee80211_supported_band {
278d3236553SJohannes Berg 	struct ieee80211_channel *channels;
279d3236553SJohannes Berg 	struct ieee80211_rate *bitrates;
280d3236553SJohannes Berg 	enum ieee80211_band band;
281d3236553SJohannes Berg 	int n_channels;
282d3236553SJohannes Berg 	int n_bitrates;
283d3236553SJohannes Berg 	struct ieee80211_sta_ht_cap ht_cap;
284bf0c111eSMahesh Palivela 	struct ieee80211_sta_vht_cap vht_cap;
285d3236553SJohannes Berg };
286d3236553SJohannes Berg 
287d3236553SJohannes Berg /*
288d3236553SJohannes Berg  * Wireless hardware/device configuration structures and methods
289704232c2SJohannes Berg  */
290704232c2SJohannes Berg 
2912ec600d6SLuis Carlos Cobo /**
292d70e9693SJohannes Berg  * DOC: Actions and configuration
293d70e9693SJohannes Berg  *
294d70e9693SJohannes Berg  * Each wireless device and each virtual interface offer a set of configuration
295d70e9693SJohannes Berg  * operations and other actions that are invoked by userspace. Each of these
296d70e9693SJohannes Berg  * actions is described in the operations structure, and the parameters these
297d70e9693SJohannes Berg  * operations use are described separately.
298d70e9693SJohannes Berg  *
299d70e9693SJohannes Berg  * Additionally, some operations are asynchronous and expect to get status
300d70e9693SJohannes Berg  * information via some functions that drivers need to call.
301d70e9693SJohannes Berg  *
302d70e9693SJohannes Berg  * Scanning and BSS list handling with its associated functionality is described
303d70e9693SJohannes Berg  * in a separate chapter.
304d70e9693SJohannes Berg  */
305d70e9693SJohannes Berg 
306d70e9693SJohannes Berg /**
3072ec600d6SLuis Carlos Cobo  * struct vif_params - describes virtual interface parameters
3088b787643SFelix Fietkau  * @use_4addr: use 4-address frames
3091c18f145SArend van Spriel  * @macaddr: address to use for this virtual interface. This will only
3101c18f145SArend van Spriel  * 	be used for non-netdevice interfaces. If this parameter is set
3111c18f145SArend van Spriel  * 	to zero address the driver may determine the address as needed.
3122ec600d6SLuis Carlos Cobo  */
3132ec600d6SLuis Carlos Cobo struct vif_params {
3148b787643SFelix Fietkau        int use_4addr;
3151c18f145SArend van Spriel        u8 macaddr[ETH_ALEN];
3162ec600d6SLuis Carlos Cobo };
3172ec600d6SLuis Carlos Cobo 
31841ade00fSJohannes Berg /**
31941ade00fSJohannes Berg  * struct key_params - key information
32041ade00fSJohannes Berg  *
32141ade00fSJohannes Berg  * Information about a key
32241ade00fSJohannes Berg  *
32341ade00fSJohannes Berg  * @key: key material
32441ade00fSJohannes Berg  * @key_len: length of key material
32541ade00fSJohannes Berg  * @cipher: cipher suite selector
32641ade00fSJohannes Berg  * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used
32741ade00fSJohannes Berg  *	with the get_key() callback, must be in little endian,
32841ade00fSJohannes Berg  *	length given by @seq_len.
329abe37c4bSJohannes Berg  * @seq_len: length of @seq.
33041ade00fSJohannes Berg  */
33141ade00fSJohannes Berg struct key_params {
33241ade00fSJohannes Berg 	u8 *key;
33341ade00fSJohannes Berg 	u8 *seq;
33441ade00fSJohannes Berg 	int key_len;
33541ade00fSJohannes Berg 	int seq_len;
33641ade00fSJohannes Berg 	u32 cipher;
33741ade00fSJohannes Berg };
33841ade00fSJohannes Berg 
339ed1b6cc7SJohannes Berg /**
340683b6d3bSJohannes Berg  * struct cfg80211_chan_def - channel definition
341683b6d3bSJohannes Berg  * @chan: the (control) channel
3423d9d1d66SJohannes Berg  * @width: channel width
3433d9d1d66SJohannes Berg  * @center_freq1: center frequency of first segment
3443d9d1d66SJohannes Berg  * @center_freq2: center frequency of second segment
3453d9d1d66SJohannes Berg  *	(only with 80+80 MHz)
346683b6d3bSJohannes Berg  */
347683b6d3bSJohannes Berg struct cfg80211_chan_def {
348683b6d3bSJohannes Berg 	struct ieee80211_channel *chan;
3493d9d1d66SJohannes Berg 	enum nl80211_chan_width width;
3503d9d1d66SJohannes Berg 	u32 center_freq1;
3513d9d1d66SJohannes Berg 	u32 center_freq2;
352683b6d3bSJohannes Berg };
353683b6d3bSJohannes Berg 
3543d9d1d66SJohannes Berg /**
3553d9d1d66SJohannes Berg  * cfg80211_get_chandef_type - return old channel type from chandef
3563d9d1d66SJohannes Berg  * @chandef: the channel definition
3573d9d1d66SJohannes Berg  *
3580ae997dcSYacine Belkadi  * Return: The old channel type (NOHT, HT20, HT40+/-) from a given
3593d9d1d66SJohannes Berg  * chandef, which must have a bandwidth allowing this conversion.
3603d9d1d66SJohannes Berg  */
361683b6d3bSJohannes Berg static inline enum nl80211_channel_type
362683b6d3bSJohannes Berg cfg80211_get_chandef_type(const struct cfg80211_chan_def *chandef)
363683b6d3bSJohannes Berg {
3643d9d1d66SJohannes Berg 	switch (chandef->width) {
3653d9d1d66SJohannes Berg 	case NL80211_CHAN_WIDTH_20_NOHT:
3663d9d1d66SJohannes Berg 		return NL80211_CHAN_NO_HT;
3673d9d1d66SJohannes Berg 	case NL80211_CHAN_WIDTH_20:
3683d9d1d66SJohannes Berg 		return NL80211_CHAN_HT20;
3693d9d1d66SJohannes Berg 	case NL80211_CHAN_WIDTH_40:
3703d9d1d66SJohannes Berg 		if (chandef->center_freq1 > chandef->chan->center_freq)
3713d9d1d66SJohannes Berg 			return NL80211_CHAN_HT40PLUS;
3723d9d1d66SJohannes Berg 		return NL80211_CHAN_HT40MINUS;
3733d9d1d66SJohannes Berg 	default:
3743d9d1d66SJohannes Berg 		WARN_ON(1);
3753d9d1d66SJohannes Berg 		return NL80211_CHAN_NO_HT;
376683b6d3bSJohannes Berg 	}
3773d9d1d66SJohannes Berg }
3783d9d1d66SJohannes Berg 
3793d9d1d66SJohannes Berg /**
3803d9d1d66SJohannes Berg  * cfg80211_chandef_create - create channel definition using channel type
3813d9d1d66SJohannes Berg  * @chandef: the channel definition struct to fill
3823d9d1d66SJohannes Berg  * @channel: the control channel
3833d9d1d66SJohannes Berg  * @chantype: the channel type
3843d9d1d66SJohannes Berg  *
3853d9d1d66SJohannes Berg  * Given a channel type, create a channel definition.
3863d9d1d66SJohannes Berg  */
3873d9d1d66SJohannes Berg void cfg80211_chandef_create(struct cfg80211_chan_def *chandef,
3883d9d1d66SJohannes Berg 			     struct ieee80211_channel *channel,
3893d9d1d66SJohannes Berg 			     enum nl80211_channel_type chantype);
3903d9d1d66SJohannes Berg 
3913d9d1d66SJohannes Berg /**
3923d9d1d66SJohannes Berg  * cfg80211_chandef_identical - check if two channel definitions are identical
3933d9d1d66SJohannes Berg  * @chandef1: first channel definition
3943d9d1d66SJohannes Berg  * @chandef2: second channel definition
3953d9d1d66SJohannes Berg  *
3960ae997dcSYacine Belkadi  * Return: %true if the channels defined by the channel definitions are
3973d9d1d66SJohannes Berg  * identical, %false otherwise.
3983d9d1d66SJohannes Berg  */
3993d9d1d66SJohannes Berg static inline bool
4003d9d1d66SJohannes Berg cfg80211_chandef_identical(const struct cfg80211_chan_def *chandef1,
4013d9d1d66SJohannes Berg 			   const struct cfg80211_chan_def *chandef2)
4023d9d1d66SJohannes Berg {
4033d9d1d66SJohannes Berg 	return (chandef1->chan == chandef2->chan &&
4043d9d1d66SJohannes Berg 		chandef1->width == chandef2->width &&
4053d9d1d66SJohannes Berg 		chandef1->center_freq1 == chandef2->center_freq1 &&
4063d9d1d66SJohannes Berg 		chandef1->center_freq2 == chandef2->center_freq2);
4073d9d1d66SJohannes Berg }
4083d9d1d66SJohannes Berg 
4093d9d1d66SJohannes Berg /**
4103d9d1d66SJohannes Berg  * cfg80211_chandef_compatible - check if two channel definitions are compatible
4113d9d1d66SJohannes Berg  * @chandef1: first channel definition
4123d9d1d66SJohannes Berg  * @chandef2: second channel definition
4133d9d1d66SJohannes Berg  *
4140ae997dcSYacine Belkadi  * Return: %NULL if the given channel definitions are incompatible,
4153d9d1d66SJohannes Berg  * chandef1 or chandef2 otherwise.
4163d9d1d66SJohannes Berg  */
4173d9d1d66SJohannes Berg const struct cfg80211_chan_def *
4183d9d1d66SJohannes Berg cfg80211_chandef_compatible(const struct cfg80211_chan_def *chandef1,
4193d9d1d66SJohannes Berg 			    const struct cfg80211_chan_def *chandef2);
420683b6d3bSJohannes Berg 
421683b6d3bSJohannes Berg /**
4229f5e8f6eSJohannes Berg  * cfg80211_chandef_valid - check if a channel definition is valid
4239f5e8f6eSJohannes Berg  * @chandef: the channel definition to check
4240ae997dcSYacine Belkadi  * Return: %true if the channel definition is valid. %false otherwise.
4259f5e8f6eSJohannes Berg  */
4269f5e8f6eSJohannes Berg bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef);
4279f5e8f6eSJohannes Berg 
4289f5e8f6eSJohannes Berg /**
4299f5e8f6eSJohannes Berg  * cfg80211_chandef_usable - check if secondary channels can be used
4309f5e8f6eSJohannes Berg  * @wiphy: the wiphy to validate against
4319f5e8f6eSJohannes Berg  * @chandef: the channel definition to check
4320ae997dcSYacine Belkadi  * @prohibited_flags: the regulatory channel flags that must not be set
4330ae997dcSYacine Belkadi  * Return: %true if secondary channels are usable. %false otherwise.
4349f5e8f6eSJohannes Berg  */
4359f5e8f6eSJohannes Berg bool cfg80211_chandef_usable(struct wiphy *wiphy,
4369f5e8f6eSJohannes Berg 			     const struct cfg80211_chan_def *chandef,
4379f5e8f6eSJohannes Berg 			     u32 prohibited_flags);
4389f5e8f6eSJohannes Berg 
4399f5e8f6eSJohannes Berg /**
44030e74732SSimon Wunderlich  * ieee80211_chandef_rate_flags - returns rate flags for a channel
44130e74732SSimon Wunderlich  *
44230e74732SSimon Wunderlich  * In some channel types, not all rates may be used - for example CCK
44330e74732SSimon Wunderlich  * rates may not be used in 5/10 MHz channels.
44430e74732SSimon Wunderlich  *
44530e74732SSimon Wunderlich  * @chandef: channel definition for the channel
44630e74732SSimon Wunderlich  *
44730e74732SSimon Wunderlich  * Returns: rate flags which apply for this channel
44830e74732SSimon Wunderlich  */
44930e74732SSimon Wunderlich static inline enum ieee80211_rate_flags
45030e74732SSimon Wunderlich ieee80211_chandef_rate_flags(struct cfg80211_chan_def *chandef)
45130e74732SSimon Wunderlich {
45230e74732SSimon Wunderlich 	switch (chandef->width) {
45330e74732SSimon Wunderlich 	case NL80211_CHAN_WIDTH_5:
45430e74732SSimon Wunderlich 		return IEEE80211_RATE_SUPPORTS_5MHZ;
45530e74732SSimon Wunderlich 	case NL80211_CHAN_WIDTH_10:
45630e74732SSimon Wunderlich 		return IEEE80211_RATE_SUPPORTS_10MHZ;
45730e74732SSimon Wunderlich 	default:
45830e74732SSimon Wunderlich 		break;
45930e74732SSimon Wunderlich 	}
46030e74732SSimon Wunderlich 	return 0;
46130e74732SSimon Wunderlich }
46230e74732SSimon Wunderlich 
46330e74732SSimon Wunderlich /**
464*0430c883SSimon Wunderlich  * ieee80211_chandef_max_power - maximum transmission power for the chandef
465*0430c883SSimon Wunderlich  *
466*0430c883SSimon Wunderlich  * In some regulations, the transmit power may depend on the configured channel
467*0430c883SSimon Wunderlich  * bandwidth which may be defined as dBm/MHz. This function returns the actual
468*0430c883SSimon Wunderlich  * max_power for non-standard (20 MHz) channels.
469*0430c883SSimon Wunderlich  *
470*0430c883SSimon Wunderlich  * @chandef: channel definition for the channel
471*0430c883SSimon Wunderlich  *
472*0430c883SSimon Wunderlich  * Returns: maximum allowed transmission power in dBm for the chandef
473*0430c883SSimon Wunderlich  */
474*0430c883SSimon Wunderlich static inline int
475*0430c883SSimon Wunderlich ieee80211_chandef_max_power(struct cfg80211_chan_def *chandef)
476*0430c883SSimon Wunderlich {
477*0430c883SSimon Wunderlich 	switch (chandef->width) {
478*0430c883SSimon Wunderlich 	case NL80211_CHAN_WIDTH_5:
479*0430c883SSimon Wunderlich 		return min(chandef->chan->max_reg_power - 6,
480*0430c883SSimon Wunderlich 			   chandef->chan->max_power);
481*0430c883SSimon Wunderlich 	case NL80211_CHAN_WIDTH_10:
482*0430c883SSimon Wunderlich 		return min(chandef->chan->max_reg_power - 3,
483*0430c883SSimon Wunderlich 			   chandef->chan->max_power);
484*0430c883SSimon Wunderlich 	default:
485*0430c883SSimon Wunderlich 		break;
486*0430c883SSimon Wunderlich 	}
487*0430c883SSimon Wunderlich 	return chandef->chan->max_power;
488*0430c883SSimon Wunderlich }
489*0430c883SSimon Wunderlich 
490*0430c883SSimon Wunderlich /**
49161fa713cSHolger Schurig  * enum survey_info_flags - survey information flags
49261fa713cSHolger Schurig  *
493abe37c4bSJohannes Berg  * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in
49417e5a808SFelix Fietkau  * @SURVEY_INFO_IN_USE: channel is currently being used
4958610c29aSFelix Fietkau  * @SURVEY_INFO_CHANNEL_TIME: channel active time (in ms) was filled in
4968610c29aSFelix Fietkau  * @SURVEY_INFO_CHANNEL_TIME_BUSY: channel busy time was filled in
4978610c29aSFelix Fietkau  * @SURVEY_INFO_CHANNEL_TIME_EXT_BUSY: extension channel busy time was filled in
4988610c29aSFelix Fietkau  * @SURVEY_INFO_CHANNEL_TIME_RX: channel receive time was filled in
4998610c29aSFelix Fietkau  * @SURVEY_INFO_CHANNEL_TIME_TX: channel transmit time was filled in
500abe37c4bSJohannes Berg  *
50161fa713cSHolger Schurig  * Used by the driver to indicate which info in &struct survey_info
50261fa713cSHolger Schurig  * it has filled in during the get_survey().
50361fa713cSHolger Schurig  */
50461fa713cSHolger Schurig enum survey_info_flags {
50561fa713cSHolger Schurig 	SURVEY_INFO_NOISE_DBM = 1<<0,
50617e5a808SFelix Fietkau 	SURVEY_INFO_IN_USE = 1<<1,
5078610c29aSFelix Fietkau 	SURVEY_INFO_CHANNEL_TIME = 1<<2,
5088610c29aSFelix Fietkau 	SURVEY_INFO_CHANNEL_TIME_BUSY = 1<<3,
5098610c29aSFelix Fietkau 	SURVEY_INFO_CHANNEL_TIME_EXT_BUSY = 1<<4,
5108610c29aSFelix Fietkau 	SURVEY_INFO_CHANNEL_TIME_RX = 1<<5,
5118610c29aSFelix Fietkau 	SURVEY_INFO_CHANNEL_TIME_TX = 1<<6,
51261fa713cSHolger Schurig };
51361fa713cSHolger Schurig 
51461fa713cSHolger Schurig /**
51561fa713cSHolger Schurig  * struct survey_info - channel survey response
51661fa713cSHolger Schurig  *
51761fa713cSHolger Schurig  * @channel: the channel this survey record reports, mandatory
51861fa713cSHolger Schurig  * @filled: bitflag of flags from &enum survey_info_flags
51961fa713cSHolger Schurig  * @noise: channel noise in dBm. This and all following fields are
52061fa713cSHolger Schurig  *	optional
5218610c29aSFelix Fietkau  * @channel_time: amount of time in ms the radio spent on the channel
5228610c29aSFelix Fietkau  * @channel_time_busy: amount of time the primary channel was sensed busy
5238610c29aSFelix Fietkau  * @channel_time_ext_busy: amount of time the extension channel was sensed busy
5248610c29aSFelix Fietkau  * @channel_time_rx: amount of time the radio spent receiving data
5258610c29aSFelix Fietkau  * @channel_time_tx: amount of time the radio spent transmitting data
52661fa713cSHolger Schurig  *
527abe37c4bSJohannes Berg  * Used by dump_survey() to report back per-channel survey information.
528abe37c4bSJohannes Berg  *
52961fa713cSHolger Schurig  * This structure can later be expanded with things like
53061fa713cSHolger Schurig  * channel duty cycle etc.
53161fa713cSHolger Schurig  */
53261fa713cSHolger Schurig struct survey_info {
53361fa713cSHolger Schurig 	struct ieee80211_channel *channel;
5348610c29aSFelix Fietkau 	u64 channel_time;
5358610c29aSFelix Fietkau 	u64 channel_time_busy;
5368610c29aSFelix Fietkau 	u64 channel_time_ext_busy;
5378610c29aSFelix Fietkau 	u64 channel_time_rx;
5388610c29aSFelix Fietkau 	u64 channel_time_tx;
53961fa713cSHolger Schurig 	u32 filled;
54061fa713cSHolger Schurig 	s8 noise;
54161fa713cSHolger Schurig };
54261fa713cSHolger Schurig 
54361fa713cSHolger Schurig /**
5445fb628e9SJouni Malinen  * struct cfg80211_crypto_settings - Crypto settings
5455fb628e9SJouni Malinen  * @wpa_versions: indicates which, if any, WPA versions are enabled
5465fb628e9SJouni Malinen  *	(from enum nl80211_wpa_versions)
5475fb628e9SJouni Malinen  * @cipher_group: group key cipher suite (or 0 if unset)
5485fb628e9SJouni Malinen  * @n_ciphers_pairwise: number of AP supported unicast ciphers
5495fb628e9SJouni Malinen  * @ciphers_pairwise: unicast key cipher suites
5505fb628e9SJouni Malinen  * @n_akm_suites: number of AKM suites
5515fb628e9SJouni Malinen  * @akm_suites: AKM suites
5525fb628e9SJouni Malinen  * @control_port: Whether user space controls IEEE 802.1X port, i.e.,
5535fb628e9SJouni Malinen  *	sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
5545fb628e9SJouni Malinen  *	required to assume that the port is unauthorized until authorized by
5555fb628e9SJouni Malinen  *	user space. Otherwise, port is marked authorized by default.
5565fb628e9SJouni Malinen  * @control_port_ethertype: the control port protocol that should be
5575fb628e9SJouni Malinen  *	allowed through even on unauthorized ports
5585fb628e9SJouni Malinen  * @control_port_no_encrypt: TRUE to prevent encryption of control port
5595fb628e9SJouni Malinen  *	protocol frames.
5605fb628e9SJouni Malinen  */
5615fb628e9SJouni Malinen struct cfg80211_crypto_settings {
5625fb628e9SJouni Malinen 	u32 wpa_versions;
5635fb628e9SJouni Malinen 	u32 cipher_group;
5645fb628e9SJouni Malinen 	int n_ciphers_pairwise;
5655fb628e9SJouni Malinen 	u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES];
5665fb628e9SJouni Malinen 	int n_akm_suites;
5675fb628e9SJouni Malinen 	u32 akm_suites[NL80211_MAX_NR_AKM_SUITES];
5685fb628e9SJouni Malinen 	bool control_port;
5695fb628e9SJouni Malinen 	__be16 control_port_ethertype;
5705fb628e9SJouni Malinen 	bool control_port_no_encrypt;
5715fb628e9SJouni Malinen };
5725fb628e9SJouni Malinen 
5735fb628e9SJouni Malinen /**
5748860020eSJohannes Berg  * struct cfg80211_beacon_data - beacon data
575ed1b6cc7SJohannes Berg  * @head: head portion of beacon (before TIM IE)
576ed1b6cc7SJohannes Berg  *	or %NULL if not changed
577ed1b6cc7SJohannes Berg  * @tail: tail portion of beacon (after TIM IE)
578ed1b6cc7SJohannes Berg  *	or %NULL if not changed
579ed1b6cc7SJohannes Berg  * @head_len: length of @head
580ed1b6cc7SJohannes Berg  * @tail_len: length of @tail
5819946ecfbSJouni Malinen  * @beacon_ies: extra information element(s) to add into Beacon frames or %NULL
5829946ecfbSJouni Malinen  * @beacon_ies_len: length of beacon_ies in octets
5839946ecfbSJouni Malinen  * @proberesp_ies: extra information element(s) to add into Probe Response
5849946ecfbSJouni Malinen  *	frames or %NULL
5859946ecfbSJouni Malinen  * @proberesp_ies_len: length of proberesp_ies in octets
5869946ecfbSJouni Malinen  * @assocresp_ies: extra information element(s) to add into (Re)Association
5879946ecfbSJouni Malinen  *	Response frames or %NULL
5889946ecfbSJouni Malinen  * @assocresp_ies_len: length of assocresp_ies in octets
58900f740e1SArik Nemtsov  * @probe_resp_len: length of probe response template (@probe_resp)
59000f740e1SArik Nemtsov  * @probe_resp: probe response template (AP mode only)
591ed1b6cc7SJohannes Berg  */
5928860020eSJohannes Berg struct cfg80211_beacon_data {
5938860020eSJohannes Berg 	const u8 *head, *tail;
5948860020eSJohannes Berg 	const u8 *beacon_ies;
5958860020eSJohannes Berg 	const u8 *proberesp_ies;
5968860020eSJohannes Berg 	const u8 *assocresp_ies;
5978860020eSJohannes Berg 	const u8 *probe_resp;
5988860020eSJohannes Berg 
5998860020eSJohannes Berg 	size_t head_len, tail_len;
6008860020eSJohannes Berg 	size_t beacon_ies_len;
6018860020eSJohannes Berg 	size_t proberesp_ies_len;
6028860020eSJohannes Berg 	size_t assocresp_ies_len;
6038860020eSJohannes Berg 	size_t probe_resp_len;
6048860020eSJohannes Berg };
6058860020eSJohannes Berg 
6066d45a74bSVasanthakumar Thiagarajan struct mac_address {
6076d45a74bSVasanthakumar Thiagarajan 	u8 addr[ETH_ALEN];
6086d45a74bSVasanthakumar Thiagarajan };
6096d45a74bSVasanthakumar Thiagarajan 
6108860020eSJohannes Berg /**
61177765eafSVasanthakumar Thiagarajan  * struct cfg80211_acl_data - Access control list data
61277765eafSVasanthakumar Thiagarajan  *
61377765eafSVasanthakumar Thiagarajan  * @acl_policy: ACL policy to be applied on the station's
614077f897aSJohannes Berg  *	entry specified by mac_addr
61577765eafSVasanthakumar Thiagarajan  * @n_acl_entries: Number of MAC address entries passed
61677765eafSVasanthakumar Thiagarajan  * @mac_addrs: List of MAC addresses of stations to be used for ACL
61777765eafSVasanthakumar Thiagarajan  */
61877765eafSVasanthakumar Thiagarajan struct cfg80211_acl_data {
61977765eafSVasanthakumar Thiagarajan 	enum nl80211_acl_policy acl_policy;
62077765eafSVasanthakumar Thiagarajan 	int n_acl_entries;
62177765eafSVasanthakumar Thiagarajan 
62277765eafSVasanthakumar Thiagarajan 	/* Keep it last */
62377765eafSVasanthakumar Thiagarajan 	struct mac_address mac_addrs[];
62477765eafSVasanthakumar Thiagarajan };
62577765eafSVasanthakumar Thiagarajan 
6268860020eSJohannes Berg /**
6278860020eSJohannes Berg  * struct cfg80211_ap_settings - AP configuration
6288860020eSJohannes Berg  *
6298860020eSJohannes Berg  * Used to configure an AP interface.
6308860020eSJohannes Berg  *
631683b6d3bSJohannes Berg  * @chandef: defines the channel to use
6328860020eSJohannes Berg  * @beacon: beacon data
6338860020eSJohannes Berg  * @beacon_interval: beacon interval
6348860020eSJohannes Berg  * @dtim_period: DTIM period
6358860020eSJohannes Berg  * @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from
6368860020eSJohannes Berg  *	user space)
6378860020eSJohannes Berg  * @ssid_len: length of @ssid
6388860020eSJohannes Berg  * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames
6398860020eSJohannes Berg  * @crypto: crypto settings
6408860020eSJohannes Berg  * @privacy: the BSS uses privacy
6418860020eSJohannes Berg  * @auth_type: Authentication type (algorithm)
6421b658f11SVasanthakumar Thiagarajan  * @inactivity_timeout: time in seconds to determine station's inactivity.
64353cabad7SJohannes Berg  * @p2p_ctwindow: P2P CT Window
64453cabad7SJohannes Berg  * @p2p_opp_ps: P2P opportunistic PS
64577765eafSVasanthakumar Thiagarajan  * @acl: ACL configuration used by the drivers which has support for
64677765eafSVasanthakumar Thiagarajan  *	MAC address based access control
64704f39047SSimon Wunderlich  * @radar_required: set if radar detection is required
6488860020eSJohannes Berg  */
6498860020eSJohannes Berg struct cfg80211_ap_settings {
650683b6d3bSJohannes Berg 	struct cfg80211_chan_def chandef;
651aa430da4SJohannes Berg 
6528860020eSJohannes Berg 	struct cfg80211_beacon_data beacon;
6538860020eSJohannes Berg 
6548860020eSJohannes Berg 	int beacon_interval, dtim_period;
65532e9de84SJouni Malinen 	const u8 *ssid;
65632e9de84SJouni Malinen 	size_t ssid_len;
65732e9de84SJouni Malinen 	enum nl80211_hidden_ssid hidden_ssid;
6585fb628e9SJouni Malinen 	struct cfg80211_crypto_settings crypto;
6595fb628e9SJouni Malinen 	bool privacy;
6605fb628e9SJouni Malinen 	enum nl80211_auth_type auth_type;
6611b658f11SVasanthakumar Thiagarajan 	int inactivity_timeout;
66253cabad7SJohannes Berg 	u8 p2p_ctwindow;
66353cabad7SJohannes Berg 	bool p2p_opp_ps;
66477765eafSVasanthakumar Thiagarajan 	const struct cfg80211_acl_data *acl;
66504f39047SSimon Wunderlich 	bool radar_required;
666ed1b6cc7SJohannes Berg };
667ed1b6cc7SJohannes Berg 
6685727ef1bSJohannes Berg /**
6693b9ce80cSJohannes Berg  * enum station_parameters_apply_mask - station parameter values to apply
6703b9ce80cSJohannes Berg  * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp)
6719d62a986SJouni Malinen  * @STATION_PARAM_APPLY_CAPABILITY: apply new capability
672f8bacc21SJohannes Berg  * @STATION_PARAM_APPLY_PLINK_STATE: apply new plink state
6733b9ce80cSJohannes Berg  *
6743b9ce80cSJohannes Berg  * Not all station parameters have in-band "no change" signalling,
6753b9ce80cSJohannes Berg  * for those that don't these flags will are used.
6763b9ce80cSJohannes Berg  */
6773b9ce80cSJohannes Berg enum station_parameters_apply_mask {
6783b9ce80cSJohannes Berg 	STATION_PARAM_APPLY_UAPSD = BIT(0),
6799d62a986SJouni Malinen 	STATION_PARAM_APPLY_CAPABILITY = BIT(1),
680f8bacc21SJohannes Berg 	STATION_PARAM_APPLY_PLINK_STATE = BIT(2),
6813b9ce80cSJohannes Berg };
6823b9ce80cSJohannes Berg 
6833b9ce80cSJohannes Berg /**
6845727ef1bSJohannes Berg  * struct station_parameters - station parameters
6855727ef1bSJohannes Berg  *
6865727ef1bSJohannes Berg  * Used to change and create a new station.
6875727ef1bSJohannes Berg  *
6885727ef1bSJohannes Berg  * @vlan: vlan interface station should belong to
6895727ef1bSJohannes Berg  * @supported_rates: supported rates in IEEE 802.11 format
6905727ef1bSJohannes Berg  *	(or NULL for no change)
6915727ef1bSJohannes Berg  * @supported_rates_len: number of supported rates
692eccb8e8fSJohannes Berg  * @sta_flags_mask: station flags that changed
693eccb8e8fSJohannes Berg  *	(bitmask of BIT(NL80211_STA_FLAG_...))
694eccb8e8fSJohannes Berg  * @sta_flags_set: station flags values
695eccb8e8fSJohannes Berg  *	(bitmask of BIT(NL80211_STA_FLAG_...))
6965727ef1bSJohannes Berg  * @listen_interval: listen interval or -1 for no change
6975727ef1bSJohannes Berg  * @aid: AID or zero for no change
698abe37c4bSJohannes Berg  * @plink_action: plink action to take
6999c3990aaSJavier Cardona  * @plink_state: set the peer link state for a station
700abe37c4bSJohannes Berg  * @ht_capa: HT capabilities of station
701f461be3eSMahesh Palivela  * @vht_capa: VHT capabilities of station
702910868dbSEliad Peller  * @uapsd_queues: bitmap of queues configured for uapsd. same format
703910868dbSEliad Peller  *	as the AC bitmap in the QoS info field
704910868dbSEliad Peller  * @max_sp: max Service Period. same format as the MAX_SP in the
705910868dbSEliad Peller  *	QoS info field (but already shifted down)
706c26887d2SJohannes Berg  * @sta_modify_mask: bitmap indicating which parameters changed
707c26887d2SJohannes Berg  *	(for those that don't have a natural "no change" value),
708c26887d2SJohannes Berg  *	see &enum station_parameters_apply_mask
7093b1c5a53SMarco Porsch  * @local_pm: local link-specific mesh power save mode (no change when set
7103b1c5a53SMarco Porsch  *	to unknown)
7119d62a986SJouni Malinen  * @capability: station capability
7129d62a986SJouni Malinen  * @ext_capab: extended capabilities of the station
7139d62a986SJouni Malinen  * @ext_capab_len: number of extended capabilities
7145727ef1bSJohannes Berg  */
7155727ef1bSJohannes Berg struct station_parameters {
7162c1aabf3SJohannes Berg 	const u8 *supported_rates;
7175727ef1bSJohannes Berg 	struct net_device *vlan;
718eccb8e8fSJohannes Berg 	u32 sta_flags_mask, sta_flags_set;
7193b9ce80cSJohannes Berg 	u32 sta_modify_mask;
7205727ef1bSJohannes Berg 	int listen_interval;
7215727ef1bSJohannes Berg 	u16 aid;
7225727ef1bSJohannes Berg 	u8 supported_rates_len;
7232ec600d6SLuis Carlos Cobo 	u8 plink_action;
7249c3990aaSJavier Cardona 	u8 plink_state;
7252c1aabf3SJohannes Berg 	const struct ieee80211_ht_cap *ht_capa;
7262c1aabf3SJohannes Berg 	const struct ieee80211_vht_cap *vht_capa;
727c75786c9SEliad Peller 	u8 uapsd_queues;
728c75786c9SEliad Peller 	u8 max_sp;
7293b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode local_pm;
7309d62a986SJouni Malinen 	u16 capability;
7312c1aabf3SJohannes Berg 	const u8 *ext_capab;
7329d62a986SJouni Malinen 	u8 ext_capab_len;
7335727ef1bSJohannes Berg };
7345727ef1bSJohannes Berg 
735fd5b74dcSJohannes Berg /**
73677ee7c89SJohannes Berg  * enum cfg80211_station_type - the type of station being modified
73777ee7c89SJohannes Berg  * @CFG80211_STA_AP_CLIENT: client of an AP interface
73877ee7c89SJohannes Berg  * @CFG80211_STA_AP_MLME_CLIENT: client of an AP interface that has
73977ee7c89SJohannes Berg  *	the AP MLME in the device
74077ee7c89SJohannes Berg  * @CFG80211_STA_AP_STA: AP station on managed interface
74177ee7c89SJohannes Berg  * @CFG80211_STA_IBSS: IBSS station
74277ee7c89SJohannes Berg  * @CFG80211_STA_TDLS_PEER_SETUP: TDLS peer on managed interface (dummy entry
74377ee7c89SJohannes Berg  *	while TDLS setup is in progress, it moves out of this state when
74477ee7c89SJohannes Berg  *	being marked authorized; use this only if TDLS with external setup is
74577ee7c89SJohannes Berg  *	supported/used)
74677ee7c89SJohannes Berg  * @CFG80211_STA_TDLS_PEER_ACTIVE: TDLS peer on managed interface (active
74777ee7c89SJohannes Berg  *	entry that is operating, has been marked authorized by userspace)
748eef941e6SThomas Pedersen  * @CFG80211_STA_MESH_PEER_KERNEL: peer on mesh interface (kernel managed)
749eef941e6SThomas Pedersen  * @CFG80211_STA_MESH_PEER_USER: peer on mesh interface (user managed)
75077ee7c89SJohannes Berg  */
75177ee7c89SJohannes Berg enum cfg80211_station_type {
75277ee7c89SJohannes Berg 	CFG80211_STA_AP_CLIENT,
75377ee7c89SJohannes Berg 	CFG80211_STA_AP_MLME_CLIENT,
75477ee7c89SJohannes Berg 	CFG80211_STA_AP_STA,
75577ee7c89SJohannes Berg 	CFG80211_STA_IBSS,
75677ee7c89SJohannes Berg 	CFG80211_STA_TDLS_PEER_SETUP,
75777ee7c89SJohannes Berg 	CFG80211_STA_TDLS_PEER_ACTIVE,
758eef941e6SThomas Pedersen 	CFG80211_STA_MESH_PEER_KERNEL,
759eef941e6SThomas Pedersen 	CFG80211_STA_MESH_PEER_USER,
76077ee7c89SJohannes Berg };
76177ee7c89SJohannes Berg 
76277ee7c89SJohannes Berg /**
76377ee7c89SJohannes Berg  * cfg80211_check_station_change - validate parameter changes
76477ee7c89SJohannes Berg  * @wiphy: the wiphy this operates on
76577ee7c89SJohannes Berg  * @params: the new parameters for a station
76677ee7c89SJohannes Berg  * @statype: the type of station being modified
76777ee7c89SJohannes Berg  *
76877ee7c89SJohannes Berg  * Utility function for the @change_station driver method. Call this function
76977ee7c89SJohannes Berg  * with the appropriate station type looking up the station (and checking that
77077ee7c89SJohannes Berg  * it exists). It will verify whether the station change is acceptable, and if
77177ee7c89SJohannes Berg  * not will return an error code. Note that it may modify the parameters for
77277ee7c89SJohannes Berg  * backward compatibility reasons, so don't use them before calling this.
77377ee7c89SJohannes Berg  */
77477ee7c89SJohannes Berg int cfg80211_check_station_change(struct wiphy *wiphy,
77577ee7c89SJohannes Berg 				  struct station_parameters *params,
77677ee7c89SJohannes Berg 				  enum cfg80211_station_type statype);
77777ee7c89SJohannes Berg 
77877ee7c89SJohannes Berg /**
7792ec600d6SLuis Carlos Cobo  * enum station_info_flags - station information flags
780fd5b74dcSJohannes Berg  *
7812ec600d6SLuis Carlos Cobo  * Used by the driver to indicate which info in &struct station_info
7822ec600d6SLuis Carlos Cobo  * it has filled in during get_station() or dump_station().
783fd5b74dcSJohannes Berg  *
7842ec600d6SLuis Carlos Cobo  * @STATION_INFO_INACTIVE_TIME: @inactive_time filled
7852ec600d6SLuis Carlos Cobo  * @STATION_INFO_RX_BYTES: @rx_bytes filled
7862ec600d6SLuis Carlos Cobo  * @STATION_INFO_TX_BYTES: @tx_bytes filled
787077f897aSJohannes Berg  * @STATION_INFO_RX_BYTES64: @rx_bytes filled with 64-bit value
788077f897aSJohannes Berg  * @STATION_INFO_TX_BYTES64: @tx_bytes filled with 64-bit value
7892ec600d6SLuis Carlos Cobo  * @STATION_INFO_LLID: @llid filled
7902ec600d6SLuis Carlos Cobo  * @STATION_INFO_PLID: @plid filled
7912ec600d6SLuis Carlos Cobo  * @STATION_INFO_PLINK_STATE: @plink_state filled
792420e7fabSHenning Rogge  * @STATION_INFO_SIGNAL: @signal filled
793c8dcfd8aSFelix Fietkau  * @STATION_INFO_TX_BITRATE: @txrate fields are filled
794420e7fabSHenning Rogge  *	(tx_bitrate, tx_bitrate_flags and tx_bitrate_mcs)
79542745e03SVladimir Kondratiev  * @STATION_INFO_RX_PACKETS: @rx_packets filled with 32-bit value
79642745e03SVladimir Kondratiev  * @STATION_INFO_TX_PACKETS: @tx_packets filled with 32-bit value
797b206b4efSBruno Randolf  * @STATION_INFO_TX_RETRIES: @tx_retries filled
798b206b4efSBruno Randolf  * @STATION_INFO_TX_FAILED: @tx_failed filled
7995a5c731aSBen Greear  * @STATION_INFO_RX_DROP_MISC: @rx_dropped_misc filled
800541a45a1SBruno Randolf  * @STATION_INFO_SIGNAL_AVG: @signal_avg filled
801c8dcfd8aSFelix Fietkau  * @STATION_INFO_RX_BITRATE: @rxrate fields are filled
802f4263c98SPaul Stewart  * @STATION_INFO_BSS_PARAM: @bss_param filled
803ebe27c91SMohammed Shafi Shajakhan  * @STATION_INFO_CONNECTED_TIME: @connected_time filled
804040bdf71SFelix Fietkau  * @STATION_INFO_ASSOC_REQ_IES: @assoc_req_ies filled
805bb6e753eSHelmut Schaa  * @STATION_INFO_STA_FLAGS: @sta_flags filled
806a85e1d55SPaul Stewart  * @STATION_INFO_BEACON_LOSS_COUNT: @beacon_loss_count filled
807d299a1f2SJavier Cardona  * @STATION_INFO_T_OFFSET: @t_offset filled
8083b1c5a53SMarco Porsch  * @STATION_INFO_LOCAL_PM: @local_pm filled
8093b1c5a53SMarco Porsch  * @STATION_INFO_PEER_PM: @peer_pm filled
8103b1c5a53SMarco Porsch  * @STATION_INFO_NONPEER_PM: @nonpeer_pm filled
811119363c7SFelix Fietkau  * @STATION_INFO_CHAIN_SIGNAL: @chain_signal filled
812119363c7SFelix Fietkau  * @STATION_INFO_CHAIN_SIGNAL_AVG: @chain_signal_avg filled
813fd5b74dcSJohannes Berg  */
8142ec600d6SLuis Carlos Cobo enum station_info_flags {
8152ec600d6SLuis Carlos Cobo 	STATION_INFO_INACTIVE_TIME	= 1<<0,
8162ec600d6SLuis Carlos Cobo 	STATION_INFO_RX_BYTES		= 1<<1,
8172ec600d6SLuis Carlos Cobo 	STATION_INFO_TX_BYTES		= 1<<2,
8182ec600d6SLuis Carlos Cobo 	STATION_INFO_LLID		= 1<<3,
8192ec600d6SLuis Carlos Cobo 	STATION_INFO_PLID		= 1<<4,
8202ec600d6SLuis Carlos Cobo 	STATION_INFO_PLINK_STATE	= 1<<5,
821420e7fabSHenning Rogge 	STATION_INFO_SIGNAL		= 1<<6,
822420e7fabSHenning Rogge 	STATION_INFO_TX_BITRATE		= 1<<7,
82398c8a60aSJouni Malinen 	STATION_INFO_RX_PACKETS		= 1<<8,
82498c8a60aSJouni Malinen 	STATION_INFO_TX_PACKETS		= 1<<9,
825b206b4efSBruno Randolf 	STATION_INFO_TX_RETRIES		= 1<<10,
826b206b4efSBruno Randolf 	STATION_INFO_TX_FAILED		= 1<<11,
8275a5c731aSBen Greear 	STATION_INFO_RX_DROP_MISC	= 1<<12,
828541a45a1SBruno Randolf 	STATION_INFO_SIGNAL_AVG		= 1<<13,
829c8dcfd8aSFelix Fietkau 	STATION_INFO_RX_BITRATE		= 1<<14,
830f4263c98SPaul Stewart 	STATION_INFO_BSS_PARAM          = 1<<15,
831040bdf71SFelix Fietkau 	STATION_INFO_CONNECTED_TIME	= 1<<16,
832bb6e753eSHelmut Schaa 	STATION_INFO_ASSOC_REQ_IES	= 1<<17,
833a85e1d55SPaul Stewart 	STATION_INFO_STA_FLAGS		= 1<<18,
834d299a1f2SJavier Cardona 	STATION_INFO_BEACON_LOSS_COUNT	= 1<<19,
835d299a1f2SJavier Cardona 	STATION_INFO_T_OFFSET		= 1<<20,
8363b1c5a53SMarco Porsch 	STATION_INFO_LOCAL_PM		= 1<<21,
8373b1c5a53SMarco Porsch 	STATION_INFO_PEER_PM		= 1<<22,
8383b1c5a53SMarco Porsch 	STATION_INFO_NONPEER_PM		= 1<<23,
83942745e03SVladimir Kondratiev 	STATION_INFO_RX_BYTES64		= 1<<24,
84042745e03SVladimir Kondratiev 	STATION_INFO_TX_BYTES64		= 1<<25,
841119363c7SFelix Fietkau 	STATION_INFO_CHAIN_SIGNAL	= 1<<26,
842119363c7SFelix Fietkau 	STATION_INFO_CHAIN_SIGNAL_AVG	= 1<<27,
843420e7fabSHenning Rogge };
844420e7fabSHenning Rogge 
845420e7fabSHenning Rogge /**
846420e7fabSHenning Rogge  * enum station_info_rate_flags - bitrate info flags
847420e7fabSHenning Rogge  *
848420e7fabSHenning Rogge  * Used by the driver to indicate the specific rate transmission
849420e7fabSHenning Rogge  * type for 802.11n transmissions.
850420e7fabSHenning Rogge  *
851db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_MCS: mcs field filled with HT MCS
852db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_VHT_MCS: mcs field filled with VHT MCS
853db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_40_MHZ_WIDTH: 40 MHz width transmission
854db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_80_MHZ_WIDTH: 80 MHz width transmission
855db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_80P80_MHZ_WIDTH: 80+80 MHz width transmission
856db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_160_MHZ_WIDTH: 160 MHz width transmission
857420e7fabSHenning Rogge  * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval
858db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_60G: 60GHz MCS
859420e7fabSHenning Rogge  */
860420e7fabSHenning Rogge enum rate_info_flags {
861db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_MCS			= BIT(0),
862db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_VHT_MCS			= BIT(1),
863db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_40_MHZ_WIDTH		= BIT(2),
864db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_80_MHZ_WIDTH		= BIT(3),
865db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_80P80_MHZ_WIDTH		= BIT(4),
866db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_160_MHZ_WIDTH		= BIT(5),
867db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_SHORT_GI		= BIT(6),
868db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_60G			= BIT(7),
869420e7fabSHenning Rogge };
870420e7fabSHenning Rogge 
871420e7fabSHenning Rogge /**
872420e7fabSHenning Rogge  * struct rate_info - bitrate information
873420e7fabSHenning Rogge  *
874420e7fabSHenning Rogge  * Information about a receiving or transmitting bitrate
875420e7fabSHenning Rogge  *
876420e7fabSHenning Rogge  * @flags: bitflag of flags from &enum rate_info_flags
877420e7fabSHenning Rogge  * @mcs: mcs index if struct describes a 802.11n bitrate
878420e7fabSHenning Rogge  * @legacy: bitrate in 100kbit/s for 802.11abg
879db9c64cfSJohannes Berg  * @nss: number of streams (VHT only)
880420e7fabSHenning Rogge  */
881420e7fabSHenning Rogge struct rate_info {
882420e7fabSHenning Rogge 	u8 flags;
883420e7fabSHenning Rogge 	u8 mcs;
884420e7fabSHenning Rogge 	u16 legacy;
885db9c64cfSJohannes Berg 	u8 nss;
886fd5b74dcSJohannes Berg };
887fd5b74dcSJohannes Berg 
888fd5b74dcSJohannes Berg /**
889f4263c98SPaul Stewart  * enum station_info_rate_flags - bitrate info flags
890f4263c98SPaul Stewart  *
891f4263c98SPaul Stewart  * Used by the driver to indicate the specific rate transmission
892f4263c98SPaul Stewart  * type for 802.11n transmissions.
893f4263c98SPaul Stewart  *
894f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_CTS_PROT: whether CTS protection is enabled
895f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_SHORT_PREAMBLE: whether short preamble is enabled
896f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_SHORT_SLOT_TIME: whether short slot time is enabled
897f4263c98SPaul Stewart  */
898f4263c98SPaul Stewart enum bss_param_flags {
899f4263c98SPaul Stewart 	BSS_PARAM_FLAGS_CTS_PROT	= 1<<0,
900f4263c98SPaul Stewart 	BSS_PARAM_FLAGS_SHORT_PREAMBLE	= 1<<1,
901f4263c98SPaul Stewart 	BSS_PARAM_FLAGS_SHORT_SLOT_TIME	= 1<<2,
902f4263c98SPaul Stewart };
903f4263c98SPaul Stewart 
904f4263c98SPaul Stewart /**
905f4263c98SPaul Stewart  * struct sta_bss_parameters - BSS parameters for the attached station
906f4263c98SPaul Stewart  *
907f4263c98SPaul Stewart  * Information about the currently associated BSS
908f4263c98SPaul Stewart  *
909f4263c98SPaul Stewart  * @flags: bitflag of flags from &enum bss_param_flags
910f4263c98SPaul Stewart  * @dtim_period: DTIM period for the BSS
911f4263c98SPaul Stewart  * @beacon_interval: beacon interval
912f4263c98SPaul Stewart  */
913f4263c98SPaul Stewart struct sta_bss_parameters {
914f4263c98SPaul Stewart 	u8 flags;
915f4263c98SPaul Stewart 	u8 dtim_period;
916f4263c98SPaul Stewart 	u16 beacon_interval;
917f4263c98SPaul Stewart };
918f4263c98SPaul Stewart 
919119363c7SFelix Fietkau #define IEEE80211_MAX_CHAINS	4
920119363c7SFelix Fietkau 
921f4263c98SPaul Stewart /**
9222ec600d6SLuis Carlos Cobo  * struct station_info - station information
923fd5b74dcSJohannes Berg  *
9242ec600d6SLuis Carlos Cobo  * Station information filled by driver for get_station() and dump_station.
925fd5b74dcSJohannes Berg  *
9262ec600d6SLuis Carlos Cobo  * @filled: bitflag of flags from &enum station_info_flags
927ebe27c91SMohammed Shafi Shajakhan  * @connected_time: time(in secs) since a station is last connected
928fd5b74dcSJohannes Berg  * @inactive_time: time since last station activity (tx/rx) in milliseconds
929fd5b74dcSJohannes Berg  * @rx_bytes: bytes received from this station
930fd5b74dcSJohannes Berg  * @tx_bytes: bytes transmitted to this station
9312ec600d6SLuis Carlos Cobo  * @llid: mesh local link id
9322ec600d6SLuis Carlos Cobo  * @plid: mesh peer link id
9332ec600d6SLuis Carlos Cobo  * @plink_state: mesh peer link state
93473c3df3bSJohannes Berg  * @signal: The signal strength, type depends on the wiphy's signal_type.
93573c3df3bSJohannes Berg  *	For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
93673c3df3bSJohannes Berg  * @signal_avg: Average signal strength, type depends on the wiphy's signal_type.
93773c3df3bSJohannes Berg  *	For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
938119363c7SFelix Fietkau  * @chains: bitmask for filled values in @chain_signal, @chain_signal_avg
939119363c7SFelix Fietkau  * @chain_signal: per-chain signal strength of last received packet in dBm
940119363c7SFelix Fietkau  * @chain_signal_avg: per-chain signal strength average in dBm
941858022aaSRandy Dunlap  * @txrate: current unicast bitrate from this station
942858022aaSRandy Dunlap  * @rxrate: current unicast bitrate to this station
94398c8a60aSJouni Malinen  * @rx_packets: packets received from this station
94498c8a60aSJouni Malinen  * @tx_packets: packets transmitted to this station
945b206b4efSBruno Randolf  * @tx_retries: cumulative retry counts
946b206b4efSBruno Randolf  * @tx_failed: number of failed transmissions (retries exceeded, no ACK)
9475a5c731aSBen Greear  * @rx_dropped_misc:  Dropped for un-specified reason.
9481ba01458SRandy Dunlap  * @bss_param: current BSS parameters
949f5ea9120SJohannes Berg  * @generation: generation number for nl80211 dumps.
950f5ea9120SJohannes Berg  *	This number should increase every time the list of stations
951f5ea9120SJohannes Berg  *	changes, i.e. when a station is added or removed, so that
952f5ea9120SJohannes Berg  *	userspace can tell whether it got a consistent snapshot.
95350d3dfb7SJouni Malinen  * @assoc_req_ies: IEs from (Re)Association Request.
95450d3dfb7SJouni Malinen  *	This is used only when in AP mode with drivers that do not use
95550d3dfb7SJouni Malinen  *	user space MLME/SME implementation. The information is provided for
95650d3dfb7SJouni Malinen  *	the cfg80211_new_sta() calls to notify user space of the IEs.
95750d3dfb7SJouni Malinen  * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets.
958c26887d2SJohannes Berg  * @sta_flags: station flags mask & values
959a85e1d55SPaul Stewart  * @beacon_loss_count: Number of times beacon loss event has triggered.
960d299a1f2SJavier Cardona  * @t_offset: Time offset of the station relative to this host.
9613b1c5a53SMarco Porsch  * @local_pm: local mesh STA power save mode
9623b1c5a53SMarco Porsch  * @peer_pm: peer mesh STA power save mode
9633b1c5a53SMarco Porsch  * @nonpeer_pm: non-peer mesh STA power save mode
964fd5b74dcSJohannes Berg  */
9652ec600d6SLuis Carlos Cobo struct station_info {
966fd5b74dcSJohannes Berg 	u32 filled;
967ebe27c91SMohammed Shafi Shajakhan 	u32 connected_time;
968fd5b74dcSJohannes Berg 	u32 inactive_time;
96942745e03SVladimir Kondratiev 	u64 rx_bytes;
97042745e03SVladimir Kondratiev 	u64 tx_bytes;
9712ec600d6SLuis Carlos Cobo 	u16 llid;
9722ec600d6SLuis Carlos Cobo 	u16 plid;
9732ec600d6SLuis Carlos Cobo 	u8 plink_state;
974420e7fabSHenning Rogge 	s8 signal;
975541a45a1SBruno Randolf 	s8 signal_avg;
976119363c7SFelix Fietkau 
977119363c7SFelix Fietkau 	u8 chains;
978119363c7SFelix Fietkau 	s8 chain_signal[IEEE80211_MAX_CHAINS];
979119363c7SFelix Fietkau 	s8 chain_signal_avg[IEEE80211_MAX_CHAINS];
980119363c7SFelix Fietkau 
981420e7fabSHenning Rogge 	struct rate_info txrate;
982c8dcfd8aSFelix Fietkau 	struct rate_info rxrate;
98398c8a60aSJouni Malinen 	u32 rx_packets;
98498c8a60aSJouni Malinen 	u32 tx_packets;
985b206b4efSBruno Randolf 	u32 tx_retries;
986b206b4efSBruno Randolf 	u32 tx_failed;
9875a5c731aSBen Greear 	u32 rx_dropped_misc;
988f4263c98SPaul Stewart 	struct sta_bss_parameters bss_param;
989bb6e753eSHelmut Schaa 	struct nl80211_sta_flag_update sta_flags;
990f5ea9120SJohannes Berg 
991f5ea9120SJohannes Berg 	int generation;
99250d3dfb7SJouni Malinen 
99350d3dfb7SJouni Malinen 	const u8 *assoc_req_ies;
99450d3dfb7SJouni Malinen 	size_t assoc_req_ies_len;
995f612cedfSJouni Malinen 
996a85e1d55SPaul Stewart 	u32 beacon_loss_count;
997d299a1f2SJavier Cardona 	s64 t_offset;
9983b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode local_pm;
9993b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode peer_pm;
10003b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode nonpeer_pm;
1001a85e1d55SPaul Stewart 
1002f612cedfSJouni Malinen 	/*
1003f612cedfSJouni Malinen 	 * Note: Add a new enum station_info_flags value for each new field and
1004f612cedfSJouni Malinen 	 * use it to check which fields are initialized.
1005f612cedfSJouni Malinen 	 */
1006fd5b74dcSJohannes Berg };
1007fd5b74dcSJohannes Berg 
100866f7ac50SMichael Wu /**
100966f7ac50SMichael Wu  * enum monitor_flags - monitor flags
101066f7ac50SMichael Wu  *
101166f7ac50SMichael Wu  * Monitor interface configuration flags. Note that these must be the bits
101266f7ac50SMichael Wu  * according to the nl80211 flags.
101366f7ac50SMichael Wu  *
101466f7ac50SMichael Wu  * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS
101566f7ac50SMichael Wu  * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP
101666f7ac50SMichael Wu  * @MONITOR_FLAG_CONTROL: pass control frames
101766f7ac50SMichael Wu  * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering
101866f7ac50SMichael Wu  * @MONITOR_FLAG_COOK_FRAMES: report frames after processing
1019e057d3c3SFelix Fietkau  * @MONITOR_FLAG_ACTIVE: active monitor, ACKs frames on its MAC address
102066f7ac50SMichael Wu  */
102166f7ac50SMichael Wu enum monitor_flags {
102266f7ac50SMichael Wu 	MONITOR_FLAG_FCSFAIL		= 1<<NL80211_MNTR_FLAG_FCSFAIL,
102366f7ac50SMichael Wu 	MONITOR_FLAG_PLCPFAIL		= 1<<NL80211_MNTR_FLAG_PLCPFAIL,
102466f7ac50SMichael Wu 	MONITOR_FLAG_CONTROL		= 1<<NL80211_MNTR_FLAG_CONTROL,
102566f7ac50SMichael Wu 	MONITOR_FLAG_OTHER_BSS		= 1<<NL80211_MNTR_FLAG_OTHER_BSS,
102666f7ac50SMichael Wu 	MONITOR_FLAG_COOK_FRAMES	= 1<<NL80211_MNTR_FLAG_COOK_FRAMES,
1027e057d3c3SFelix Fietkau 	MONITOR_FLAG_ACTIVE		= 1<<NL80211_MNTR_FLAG_ACTIVE,
102866f7ac50SMichael Wu };
102966f7ac50SMichael Wu 
10302ec600d6SLuis Carlos Cobo /**
10312ec600d6SLuis Carlos Cobo  * enum mpath_info_flags -  mesh path information flags
10322ec600d6SLuis Carlos Cobo  *
10332ec600d6SLuis Carlos Cobo  * Used by the driver to indicate which info in &struct mpath_info it has filled
10342ec600d6SLuis Carlos Cobo  * in during get_station() or dump_station().
10352ec600d6SLuis Carlos Cobo  *
1036abe37c4bSJohannes Berg  * @MPATH_INFO_FRAME_QLEN: @frame_qlen filled
1037abe37c4bSJohannes Berg  * @MPATH_INFO_SN: @sn filled
1038abe37c4bSJohannes Berg  * @MPATH_INFO_METRIC: @metric filled
1039abe37c4bSJohannes Berg  * @MPATH_INFO_EXPTIME: @exptime filled
1040abe37c4bSJohannes Berg  * @MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled
1041abe37c4bSJohannes Berg  * @MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled
1042abe37c4bSJohannes Berg  * @MPATH_INFO_FLAGS: @flags filled
10432ec600d6SLuis Carlos Cobo  */
10442ec600d6SLuis Carlos Cobo enum mpath_info_flags {
10452ec600d6SLuis Carlos Cobo 	MPATH_INFO_FRAME_QLEN		= BIT(0),
1046d19b3bf6SRui Paulo 	MPATH_INFO_SN			= BIT(1),
10472ec600d6SLuis Carlos Cobo 	MPATH_INFO_METRIC		= BIT(2),
10482ec600d6SLuis Carlos Cobo 	MPATH_INFO_EXPTIME		= BIT(3),
10492ec600d6SLuis Carlos Cobo 	MPATH_INFO_DISCOVERY_TIMEOUT	= BIT(4),
10502ec600d6SLuis Carlos Cobo 	MPATH_INFO_DISCOVERY_RETRIES	= BIT(5),
10512ec600d6SLuis Carlos Cobo 	MPATH_INFO_FLAGS		= BIT(6),
10522ec600d6SLuis Carlos Cobo };
10532ec600d6SLuis Carlos Cobo 
10542ec600d6SLuis Carlos Cobo /**
10552ec600d6SLuis Carlos Cobo  * struct mpath_info - mesh path information
10562ec600d6SLuis Carlos Cobo  *
10572ec600d6SLuis Carlos Cobo  * Mesh path information filled by driver for get_mpath() and dump_mpath().
10582ec600d6SLuis Carlos Cobo  *
10592ec600d6SLuis Carlos Cobo  * @filled: bitfield of flags from &enum mpath_info_flags
10602ec600d6SLuis Carlos Cobo  * @frame_qlen: number of queued frames for this destination
1061d19b3bf6SRui Paulo  * @sn: target sequence number
10622ec600d6SLuis Carlos Cobo  * @metric: metric (cost) of this mesh path
10632ec600d6SLuis Carlos Cobo  * @exptime: expiration time for the mesh path from now, in msecs
10642ec600d6SLuis Carlos Cobo  * @flags: mesh path flags
10652ec600d6SLuis Carlos Cobo  * @discovery_timeout: total mesh path discovery timeout, in msecs
10662ec600d6SLuis Carlos Cobo  * @discovery_retries: mesh path discovery retries
1067f5ea9120SJohannes Berg  * @generation: generation number for nl80211 dumps.
1068f5ea9120SJohannes Berg  *	This number should increase every time the list of mesh paths
1069f5ea9120SJohannes Berg  *	changes, i.e. when a station is added or removed, so that
1070f5ea9120SJohannes Berg  *	userspace can tell whether it got a consistent snapshot.
10712ec600d6SLuis Carlos Cobo  */
10722ec600d6SLuis Carlos Cobo struct mpath_info {
10732ec600d6SLuis Carlos Cobo 	u32 filled;
10742ec600d6SLuis Carlos Cobo 	u32 frame_qlen;
1075d19b3bf6SRui Paulo 	u32 sn;
10762ec600d6SLuis Carlos Cobo 	u32 metric;
10772ec600d6SLuis Carlos Cobo 	u32 exptime;
10782ec600d6SLuis Carlos Cobo 	u32 discovery_timeout;
10792ec600d6SLuis Carlos Cobo 	u8 discovery_retries;
10802ec600d6SLuis Carlos Cobo 	u8 flags;
1081f5ea9120SJohannes Berg 
1082f5ea9120SJohannes Berg 	int generation;
10832ec600d6SLuis Carlos Cobo };
10842ec600d6SLuis Carlos Cobo 
10859f1ba906SJouni Malinen /**
10869f1ba906SJouni Malinen  * struct bss_parameters - BSS parameters
10879f1ba906SJouni Malinen  *
10889f1ba906SJouni Malinen  * Used to change BSS parameters (mainly for AP mode).
10899f1ba906SJouni Malinen  *
10909f1ba906SJouni Malinen  * @use_cts_prot: Whether to use CTS protection
10919f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
10929f1ba906SJouni Malinen  * @use_short_preamble: Whether the use of short preambles is allowed
10939f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
10949f1ba906SJouni Malinen  * @use_short_slot_time: Whether the use of short slot time is allowed
10959f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
109690c97a04SJouni Malinen  * @basic_rates: basic rates in IEEE 802.11 format
109790c97a04SJouni Malinen  *	(or NULL for no change)
109890c97a04SJouni Malinen  * @basic_rates_len: number of basic rates
1099fd8aaaf3SFelix Fietkau  * @ap_isolate: do not forward packets between connected stations
110050b12f59SHelmut Schaa  * @ht_opmode: HT Operation mode
110150b12f59SHelmut Schaa  * 	(u16 = opmode, -1 = do not change)
110253cabad7SJohannes Berg  * @p2p_ctwindow: P2P CT Window (-1 = no change)
110353cabad7SJohannes Berg  * @p2p_opp_ps: P2P opportunistic PS (-1 = no change)
11049f1ba906SJouni Malinen  */
11059f1ba906SJouni Malinen struct bss_parameters {
11069f1ba906SJouni Malinen 	int use_cts_prot;
11079f1ba906SJouni Malinen 	int use_short_preamble;
11089f1ba906SJouni Malinen 	int use_short_slot_time;
110990c97a04SJouni Malinen 	u8 *basic_rates;
111090c97a04SJouni Malinen 	u8 basic_rates_len;
1111fd8aaaf3SFelix Fietkau 	int ap_isolate;
111250b12f59SHelmut Schaa 	int ht_opmode;
111353cabad7SJohannes Berg 	s8 p2p_ctwindow, p2p_opp_ps;
11149f1ba906SJouni Malinen };
11152ec600d6SLuis Carlos Cobo 
11163ddd53f3SChun-Yeow Yeoh /**
111729cbe68cSJohannes Berg  * struct mesh_config - 802.11s mesh configuration
111829cbe68cSJohannes Berg  *
111929cbe68cSJohannes Berg  * These parameters can be changed while the mesh is active.
11203ddd53f3SChun-Yeow Yeoh  *
11213ddd53f3SChun-Yeow Yeoh  * @dot11MeshRetryTimeout: the initial retry timeout in millisecond units used
11223ddd53f3SChun-Yeow Yeoh  *	by the Mesh Peering Open message
11233ddd53f3SChun-Yeow Yeoh  * @dot11MeshConfirmTimeout: the initial retry timeout in millisecond units
11243ddd53f3SChun-Yeow Yeoh  *	used by the Mesh Peering Open message
11253ddd53f3SChun-Yeow Yeoh  * @dot11MeshHoldingTimeout: the confirm timeout in millisecond units used by
11263ddd53f3SChun-Yeow Yeoh  *	the mesh peering management to close a mesh peering
11273ddd53f3SChun-Yeow Yeoh  * @dot11MeshMaxPeerLinks: the maximum number of peer links allowed on this
11283ddd53f3SChun-Yeow Yeoh  *	mesh interface
11293ddd53f3SChun-Yeow Yeoh  * @dot11MeshMaxRetries: the maximum number of peer link open retries that can
11303ddd53f3SChun-Yeow Yeoh  *	be sent to establish a new peer link instance in a mesh
11313ddd53f3SChun-Yeow Yeoh  * @dot11MeshTTL: the value of TTL field set at a source mesh STA
11323ddd53f3SChun-Yeow Yeoh  * @element_ttl: the value of TTL field set at a mesh STA for path selection
11333ddd53f3SChun-Yeow Yeoh  *	elements
11343ddd53f3SChun-Yeow Yeoh  * @auto_open_plinks: whether we should automatically open peer links when we
11353ddd53f3SChun-Yeow Yeoh  *	detect compatible mesh peers
11363ddd53f3SChun-Yeow Yeoh  * @dot11MeshNbrOffsetMaxNeighbor: the maximum number of neighbors to
11373ddd53f3SChun-Yeow Yeoh  *	synchronize to for 11s default synchronization method
11383ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPmaxPREQretries: the number of action frames containing a PREQ
11393ddd53f3SChun-Yeow Yeoh  *	that an originator mesh STA can send to a particular path target
11403ddd53f3SChun-Yeow Yeoh  * @path_refresh_time: how frequently to refresh mesh paths in milliseconds
11413ddd53f3SChun-Yeow Yeoh  * @min_discovery_timeout: the minimum length of time to wait until giving up on
11423ddd53f3SChun-Yeow Yeoh  *	a path discovery in milliseconds
11433ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPactivePathTimeout: the time (in TUs) for which mesh STAs
11443ddd53f3SChun-Yeow Yeoh  *	receiving a PREQ shall consider the forwarding information from the
11453ddd53f3SChun-Yeow Yeoh  *	root to be valid. (TU = time unit)
11463ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPpreqMinInterval: the minimum interval of time (in TUs) during
11473ddd53f3SChun-Yeow Yeoh  *	which a mesh STA can send only one action frame containing a PREQ
11483ddd53f3SChun-Yeow Yeoh  *	element
11493ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPperrMinInterval: the minimum interval of time (in TUs) during
11503ddd53f3SChun-Yeow Yeoh  *	which a mesh STA can send only one Action frame containing a PERR
11513ddd53f3SChun-Yeow Yeoh  *	element
11523ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPnetDiameterTraversalTime: the interval of time (in TUs) that
11533ddd53f3SChun-Yeow Yeoh  *	it takes for an HWMP information element to propagate across the mesh
11543ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPRootMode: the configuration of a mesh STA as root mesh STA
11553ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPRannInterval: the interval of time (in TUs) between root
11563ddd53f3SChun-Yeow Yeoh  *	announcements are transmitted
11573ddd53f3SChun-Yeow Yeoh  * @dot11MeshGateAnnouncementProtocol: whether to advertise that this mesh
11583ddd53f3SChun-Yeow Yeoh  *	station has access to a broader network beyond the MBSS. (This is
11593ddd53f3SChun-Yeow Yeoh  *	missnamed in draft 12.0: dot11MeshGateAnnouncementProtocol set to true
11603ddd53f3SChun-Yeow Yeoh  *	only means that the station will announce others it's a mesh gate, but
11613ddd53f3SChun-Yeow Yeoh  *	not necessarily using the gate announcement protocol. Still keeping the
11623ddd53f3SChun-Yeow Yeoh  *	same nomenclature to be in sync with the spec)
11633ddd53f3SChun-Yeow Yeoh  * @dot11MeshForwarding: whether the Mesh STA is forwarding or non-forwarding
11643ddd53f3SChun-Yeow Yeoh  *	entity (default is TRUE - forwarding entity)
11653ddd53f3SChun-Yeow Yeoh  * @rssi_threshold: the threshold for average signal strength of candidate
11663ddd53f3SChun-Yeow Yeoh  *	station to establish a peer link
11673ddd53f3SChun-Yeow Yeoh  * @ht_opmode: mesh HT protection mode
1168ac1073a6SChun-Yeow Yeoh  *
1169ac1073a6SChun-Yeow Yeoh  * @dot11MeshHWMPactivePathToRootTimeout: The time (in TUs) for which mesh STAs
1170ac1073a6SChun-Yeow Yeoh  *	receiving a proactive PREQ shall consider the forwarding information to
1171ac1073a6SChun-Yeow Yeoh  *	the root mesh STA to be valid.
1172ac1073a6SChun-Yeow Yeoh  *
1173ac1073a6SChun-Yeow Yeoh  * @dot11MeshHWMProotInterval: The interval of time (in TUs) between proactive
1174ac1073a6SChun-Yeow Yeoh  *	PREQs are transmitted.
1175728b19e5SChun-Yeow Yeoh  * @dot11MeshHWMPconfirmationInterval: The minimum interval of time (in TUs)
1176728b19e5SChun-Yeow Yeoh  *	during which a mesh STA can send only one Action frame containing
1177728b19e5SChun-Yeow Yeoh  *	a PREQ element for root path confirmation.
11783b1c5a53SMarco Porsch  * @power_mode: The default mesh power save mode which will be the initial
11793b1c5a53SMarco Porsch  *	setting for new peer links.
11803b1c5a53SMarco Porsch  * @dot11MeshAwakeWindowDuration: The duration in TUs the STA will remain awake
11813b1c5a53SMarco Porsch  *	after transmitting its beacon.
11828e7c0538SColleen Twitty  * @plink_timeout: If no tx activity is seen from a STA we've established
11838e7c0538SColleen Twitty  *	peering with for longer than this time (in seconds), then remove it
11848e7c0538SColleen Twitty  *	from the STA's list of peers.  Default is 30 minutes.
118529cbe68cSJohannes Berg  */
118693da9cc1Scolin@cozybit.com struct mesh_config {
118793da9cc1Scolin@cozybit.com 	u16 dot11MeshRetryTimeout;
118893da9cc1Scolin@cozybit.com 	u16 dot11MeshConfirmTimeout;
118993da9cc1Scolin@cozybit.com 	u16 dot11MeshHoldingTimeout;
119093da9cc1Scolin@cozybit.com 	u16 dot11MeshMaxPeerLinks;
119193da9cc1Scolin@cozybit.com 	u8 dot11MeshMaxRetries;
119293da9cc1Scolin@cozybit.com 	u8 dot11MeshTTL;
119345904f21SJavier Cardona 	u8 element_ttl;
119493da9cc1Scolin@cozybit.com 	bool auto_open_plinks;
1195d299a1f2SJavier Cardona 	u32 dot11MeshNbrOffsetMaxNeighbor;
119693da9cc1Scolin@cozybit.com 	u8 dot11MeshHWMPmaxPREQretries;
119793da9cc1Scolin@cozybit.com 	u32 path_refresh_time;
119893da9cc1Scolin@cozybit.com 	u16 min_discovery_timeout;
119993da9cc1Scolin@cozybit.com 	u32 dot11MeshHWMPactivePathTimeout;
120093da9cc1Scolin@cozybit.com 	u16 dot11MeshHWMPpreqMinInterval;
1201dca7e943SThomas Pedersen 	u16 dot11MeshHWMPperrMinInterval;
120293da9cc1Scolin@cozybit.com 	u16 dot11MeshHWMPnetDiameterTraversalTime;
120363c5723bSRui Paulo 	u8 dot11MeshHWMPRootMode;
12040507e159SJavier Cardona 	u16 dot11MeshHWMPRannInterval;
120516dd7267SJavier Cardona 	bool dot11MeshGateAnnouncementProtocol;
120694f90656SChun-Yeow Yeoh 	bool dot11MeshForwarding;
120755335137SAshok Nagarajan 	s32 rssi_threshold;
120870c33eaaSAshok Nagarajan 	u16 ht_opmode;
1209ac1073a6SChun-Yeow Yeoh 	u32 dot11MeshHWMPactivePathToRootTimeout;
1210ac1073a6SChun-Yeow Yeoh 	u16 dot11MeshHWMProotInterval;
1211728b19e5SChun-Yeow Yeoh 	u16 dot11MeshHWMPconfirmationInterval;
12123b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode power_mode;
12133b1c5a53SMarco Porsch 	u16 dot11MeshAwakeWindowDuration;
12148e7c0538SColleen Twitty 	u32 plink_timeout;
121593da9cc1Scolin@cozybit.com };
121693da9cc1Scolin@cozybit.com 
121731888487SJouni Malinen /**
121829cbe68cSJohannes Berg  * struct mesh_setup - 802.11s mesh setup configuration
1219683b6d3bSJohannes Berg  * @chandef: defines the channel to use
122029cbe68cSJohannes Berg  * @mesh_id: the mesh ID
122129cbe68cSJohannes Berg  * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes
1222d299a1f2SJavier Cardona  * @sync_method: which synchronization method to use
1223c80d545dSJavier Cardona  * @path_sel_proto: which path selection protocol to use
1224c80d545dSJavier Cardona  * @path_metric: which metric to use
12256e16d90bSColleen Twitty  * @auth_id: which authentication method this mesh is using
1226581a8b0fSJavier Cardona  * @ie: vendor information elements (optional)
1227581a8b0fSJavier Cardona  * @ie_len: length of vendor information elements
1228b130e5ceSJavier Cardona  * @is_authenticated: this mesh requires authentication
1229b130e5ceSJavier Cardona  * @is_secure: this mesh uses security
1230bb2798d4SThomas Pedersen  * @user_mpm: userspace handles all MPM functions
12319bdbf04dSMarco Porsch  * @dtim_period: DTIM period to use
12329bdbf04dSMarco Porsch  * @beacon_interval: beacon interval to use
12334bb62344SChun-Yeow Yeoh  * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a]
1234ffb3cf30SAshok Nagarajan  * @basic_rates: basic rates to use when creating the mesh
123529cbe68cSJohannes Berg  *
123629cbe68cSJohannes Berg  * These parameters are fixed when the mesh is created.
123729cbe68cSJohannes Berg  */
123829cbe68cSJohannes Berg struct mesh_setup {
1239683b6d3bSJohannes Berg 	struct cfg80211_chan_def chandef;
124029cbe68cSJohannes Berg 	const u8 *mesh_id;
124129cbe68cSJohannes Berg 	u8 mesh_id_len;
1242d299a1f2SJavier Cardona 	u8 sync_method;
1243c80d545dSJavier Cardona 	u8 path_sel_proto;
1244c80d545dSJavier Cardona 	u8 path_metric;
12456e16d90bSColleen Twitty 	u8 auth_id;
1246581a8b0fSJavier Cardona 	const u8 *ie;
1247581a8b0fSJavier Cardona 	u8 ie_len;
1248b130e5ceSJavier Cardona 	bool is_authenticated;
124915d5dda6SJavier Cardona 	bool is_secure;
1250bb2798d4SThomas Pedersen 	bool user_mpm;
12519bdbf04dSMarco Porsch 	u8 dtim_period;
12529bdbf04dSMarco Porsch 	u16 beacon_interval;
12534bb62344SChun-Yeow Yeoh 	int mcast_rate[IEEE80211_NUM_BANDS];
1254ffb3cf30SAshok Nagarajan 	u32 basic_rates;
125529cbe68cSJohannes Berg };
125629cbe68cSJohannes Berg 
125729cbe68cSJohannes Berg /**
125831888487SJouni Malinen  * struct ieee80211_txq_params - TX queue parameters
1259a3304b0aSJohannes Berg  * @ac: AC identifier
126031888487SJouni Malinen  * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled
126131888487SJouni Malinen  * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range
126231888487SJouni Malinen  *	1..32767]
126331888487SJouni Malinen  * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range
126431888487SJouni Malinen  *	1..32767]
126531888487SJouni Malinen  * @aifs: Arbitration interframe space [0..255]
126631888487SJouni Malinen  */
126731888487SJouni Malinen struct ieee80211_txq_params {
1268a3304b0aSJohannes Berg 	enum nl80211_ac ac;
126931888487SJouni Malinen 	u16 txop;
127031888487SJouni Malinen 	u16 cwmin;
127131888487SJouni Malinen 	u16 cwmax;
127231888487SJouni Malinen 	u8 aifs;
127331888487SJouni Malinen };
127431888487SJouni Malinen 
1275d70e9693SJohannes Berg /**
1276d70e9693SJohannes Berg  * DOC: Scanning and BSS list handling
1277d70e9693SJohannes Berg  *
1278d70e9693SJohannes Berg  * The scanning process itself is fairly simple, but cfg80211 offers quite
1279d70e9693SJohannes Berg  * a bit of helper functionality. To start a scan, the scan operation will
1280d70e9693SJohannes Berg  * be invoked with a scan definition. This scan definition contains the
1281d70e9693SJohannes Berg  * channels to scan, and the SSIDs to send probe requests for (including the
1282d70e9693SJohannes Berg  * wildcard, if desired). A passive scan is indicated by having no SSIDs to
1283d70e9693SJohannes Berg  * probe. Additionally, a scan request may contain extra information elements
1284d70e9693SJohannes Berg  * that should be added to the probe request. The IEs are guaranteed to be
1285d70e9693SJohannes Berg  * well-formed, and will not exceed the maximum length the driver advertised
1286d70e9693SJohannes Berg  * in the wiphy structure.
1287d70e9693SJohannes Berg  *
1288d70e9693SJohannes Berg  * When scanning finds a BSS, cfg80211 needs to be notified of that, because
1289d70e9693SJohannes Berg  * it is responsible for maintaining the BSS list; the driver should not
1290d70e9693SJohannes Berg  * maintain a list itself. For this notification, various functions exist.
1291d70e9693SJohannes Berg  *
1292d70e9693SJohannes Berg  * Since drivers do not maintain a BSS list, there are also a number of
1293d70e9693SJohannes Berg  * functions to search for a BSS and obtain information about it from the
1294d70e9693SJohannes Berg  * BSS structure cfg80211 maintains. The BSS list is also made available
1295d70e9693SJohannes Berg  * to userspace.
1296d70e9693SJohannes Berg  */
129772bdcf34SJouni Malinen 
1298704232c2SJohannes Berg /**
12992a519311SJohannes Berg  * struct cfg80211_ssid - SSID description
13002a519311SJohannes Berg  * @ssid: the SSID
13012a519311SJohannes Berg  * @ssid_len: length of the ssid
13022a519311SJohannes Berg  */
13032a519311SJohannes Berg struct cfg80211_ssid {
13042a519311SJohannes Berg 	u8 ssid[IEEE80211_MAX_SSID_LEN];
13052a519311SJohannes Berg 	u8 ssid_len;
13062a519311SJohannes Berg };
13072a519311SJohannes Berg 
13082a519311SJohannes Berg /**
13092a519311SJohannes Berg  * struct cfg80211_scan_request - scan request description
13102a519311SJohannes Berg  *
13112a519311SJohannes Berg  * @ssids: SSIDs to scan for (active scan only)
13122a519311SJohannes Berg  * @n_ssids: number of SSIDs
13132a519311SJohannes Berg  * @channels: channels to scan on.
1314ca3dbc20SHelmut Schaa  * @n_channels: total number of channels to scan
1315dcd6eac1SSimon Wunderlich  * @scan_width: channel width for scanning
131670692ad2SJouni Malinen  * @ie: optional information element(s) to add into Probe Request or %NULL
131770692ad2SJouni Malinen  * @ie_len: length of ie in octets
1318ed473771SSam Leffler  * @flags: bit field of flags controlling operation
131934850ab2SJohannes Berg  * @rates: bitmap of rates to advertise for each band
13202a519311SJohannes Berg  * @wiphy: the wiphy this was for
132115d6030bSSam Leffler  * @scan_start: time (in jiffies) when the scan started
1322fd014284SJohannes Berg  * @wdev: the wireless device to scan for
1323abe37c4bSJohannes Berg  * @aborted: (internal) scan request was notified as aborted
13245fe231e8SJohannes Berg  * @notified: (internal) scan request was notified as done or aborted
1325e9f935e3SRajkumar Manoharan  * @no_cck: used to send probe requests at non CCK rate in 2GHz band
13262a519311SJohannes Berg  */
13272a519311SJohannes Berg struct cfg80211_scan_request {
13282a519311SJohannes Berg 	struct cfg80211_ssid *ssids;
13292a519311SJohannes Berg 	int n_ssids;
13302a519311SJohannes Berg 	u32 n_channels;
1331dcd6eac1SSimon Wunderlich 	enum nl80211_bss_scan_width scan_width;
1332de95a54bSJohannes Berg 	const u8 *ie;
133370692ad2SJouni Malinen 	size_t ie_len;
1334ed473771SSam Leffler 	u32 flags;
13352a519311SJohannes Berg 
133634850ab2SJohannes Berg 	u32 rates[IEEE80211_NUM_BANDS];
133734850ab2SJohannes Berg 
1338fd014284SJohannes Berg 	struct wireless_dev *wdev;
1339fd014284SJohannes Berg 
13402a519311SJohannes Berg 	/* internal */
13412a519311SJohannes Berg 	struct wiphy *wiphy;
134215d6030bSSam Leffler 	unsigned long scan_start;
13435fe231e8SJohannes Berg 	bool aborted, notified;
1344e9f935e3SRajkumar Manoharan 	bool no_cck;
13455ba63533SJohannes Berg 
13465ba63533SJohannes Berg 	/* keep last */
13475ba63533SJohannes Berg 	struct ieee80211_channel *channels[0];
13482a519311SJohannes Berg };
13492a519311SJohannes Berg 
13502a519311SJohannes Berg /**
1351a1f1c21cSLuciano Coelho  * struct cfg80211_match_set - sets of attributes to match
1352a1f1c21cSLuciano Coelho  *
1353a1f1c21cSLuciano Coelho  * @ssid: SSID to be matched
1354a1f1c21cSLuciano Coelho  */
1355a1f1c21cSLuciano Coelho struct cfg80211_match_set {
1356a1f1c21cSLuciano Coelho 	struct cfg80211_ssid ssid;
1357a1f1c21cSLuciano Coelho };
1358a1f1c21cSLuciano Coelho 
1359a1f1c21cSLuciano Coelho /**
1360807f8a8cSLuciano Coelho  * struct cfg80211_sched_scan_request - scheduled scan request description
1361807f8a8cSLuciano Coelho  *
1362807f8a8cSLuciano Coelho  * @ssids: SSIDs to scan for (passed in the probe_reqs in active scans)
1363807f8a8cSLuciano Coelho  * @n_ssids: number of SSIDs
1364807f8a8cSLuciano Coelho  * @n_channels: total number of channels to scan
1365dcd6eac1SSimon Wunderlich  * @scan_width: channel width for scanning
1366bbe6ad6dSLuciano Coelho  * @interval: interval between each scheduled scan cycle
1367807f8a8cSLuciano Coelho  * @ie: optional information element(s) to add into Probe Request or %NULL
1368807f8a8cSLuciano Coelho  * @ie_len: length of ie in octets
1369ed473771SSam Leffler  * @flags: bit field of flags controlling operation
1370a1f1c21cSLuciano Coelho  * @match_sets: sets of parameters to be matched for a scan result
1371a1f1c21cSLuciano Coelho  * 	entry to be considered valid and to be passed to the host
1372a1f1c21cSLuciano Coelho  * 	(others are filtered out).
1373a1f1c21cSLuciano Coelho  *	If ommited, all results are passed.
1374a1f1c21cSLuciano Coelho  * @n_match_sets: number of match sets
1375807f8a8cSLuciano Coelho  * @wiphy: the wiphy this was for
1376807f8a8cSLuciano Coelho  * @dev: the interface
1377077f897aSJohannes Berg  * @scan_start: start time of the scheduled scan
1378807f8a8cSLuciano Coelho  * @channels: channels to scan
137988e920b4SThomas Pedersen  * @rssi_thold: don't report scan results below this threshold (in s32 dBm)
1380807f8a8cSLuciano Coelho  */
1381807f8a8cSLuciano Coelho struct cfg80211_sched_scan_request {
1382807f8a8cSLuciano Coelho 	struct cfg80211_ssid *ssids;
1383807f8a8cSLuciano Coelho 	int n_ssids;
1384807f8a8cSLuciano Coelho 	u32 n_channels;
1385dcd6eac1SSimon Wunderlich 	enum nl80211_bss_scan_width scan_width;
1386bbe6ad6dSLuciano Coelho 	u32 interval;
1387807f8a8cSLuciano Coelho 	const u8 *ie;
1388807f8a8cSLuciano Coelho 	size_t ie_len;
1389ed473771SSam Leffler 	u32 flags;
1390a1f1c21cSLuciano Coelho 	struct cfg80211_match_set *match_sets;
1391a1f1c21cSLuciano Coelho 	int n_match_sets;
139288e920b4SThomas Pedersen 	s32 rssi_thold;
1393807f8a8cSLuciano Coelho 
1394807f8a8cSLuciano Coelho 	/* internal */
1395807f8a8cSLuciano Coelho 	struct wiphy *wiphy;
1396807f8a8cSLuciano Coelho 	struct net_device *dev;
139715d6030bSSam Leffler 	unsigned long scan_start;
1398807f8a8cSLuciano Coelho 
1399807f8a8cSLuciano Coelho 	/* keep last */
1400807f8a8cSLuciano Coelho 	struct ieee80211_channel *channels[0];
1401807f8a8cSLuciano Coelho };
1402807f8a8cSLuciano Coelho 
1403807f8a8cSLuciano Coelho /**
14042a519311SJohannes Berg  * enum cfg80211_signal_type - signal type
14052a519311SJohannes Berg  *
14062a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available
14072a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm)
14082a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100
14092a519311SJohannes Berg  */
14102a519311SJohannes Berg enum cfg80211_signal_type {
14112a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_NONE,
14122a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_MBM,
14132a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_UNSPEC,
14142a519311SJohannes Berg };
14152a519311SJohannes Berg 
14162a519311SJohannes Berg /**
14179caf0364SJohannes Berg  * struct cfg80211_bss_ie_data - BSS entry IE data
14188cef2c9dSJohannes Berg  * @tsf: TSF contained in the frame that carried these IEs
14199caf0364SJohannes Berg  * @rcu_head: internal use, for freeing
14209caf0364SJohannes Berg  * @len: length of the IEs
14219caf0364SJohannes Berg  * @data: IE data
14229caf0364SJohannes Berg  */
14239caf0364SJohannes Berg struct cfg80211_bss_ies {
14248cef2c9dSJohannes Berg 	u64 tsf;
14259caf0364SJohannes Berg 	struct rcu_head rcu_head;
14269caf0364SJohannes Berg 	int len;
14279caf0364SJohannes Berg 	u8 data[];
14289caf0364SJohannes Berg };
14299caf0364SJohannes Berg 
14309caf0364SJohannes Berg /**
14312a519311SJohannes Berg  * struct cfg80211_bss - BSS description
14322a519311SJohannes Berg  *
14332a519311SJohannes Berg  * This structure describes a BSS (which may also be a mesh network)
14342a519311SJohannes Berg  * for use in scan results and similar.
14352a519311SJohannes Berg  *
1436abe37c4bSJohannes Berg  * @channel: channel this BSS is on
1437dcd6eac1SSimon Wunderlich  * @scan_width: width of the control channel
14382a519311SJohannes Berg  * @bssid: BSSID of the BSS
14392a519311SJohannes Berg  * @beacon_interval: the beacon interval as from the frame
14402a519311SJohannes Berg  * @capability: the capability field in host byte order
144183c7aa1aSJohannes Berg  * @ies: the information elements (Note that there is no guarantee that these
144283c7aa1aSJohannes Berg  *	are well-formed!); this is a pointer to either the beacon_ies or
144383c7aa1aSJohannes Berg  *	proberesp_ies depending on whether Probe Response frame has been
144483c7aa1aSJohannes Berg  *	received. It is always non-%NULL.
144534a6eddbSJouni Malinen  * @beacon_ies: the information elements from the last Beacon frame
1446776b3580SJohannes Berg  *	(implementation note: if @hidden_beacon_bss is set this struct doesn't
1447776b3580SJohannes Berg  *	own the beacon_ies, but they're just pointers to the ones from the
1448776b3580SJohannes Berg  *	@hidden_beacon_bss struct)
144934a6eddbSJouni Malinen  * @proberesp_ies: the information elements from the last Probe Response frame
1450776b3580SJohannes Berg  * @hidden_beacon_bss: in case this BSS struct represents a probe response from
1451776b3580SJohannes Berg  *	a BSS that hides the SSID in its beacon, this points to the BSS struct
1452776b3580SJohannes Berg  *	that holds the beacon data. @beacon_ies is still valid, of course, and
1453776b3580SJohannes Berg  *	points to the same data as hidden_beacon_bss->beacon_ies in that case.
145477965c97SJohannes Berg  * @signal: signal strength value (type depends on the wiphy's signal_type)
14552a519311SJohannes Berg  * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
14562a519311SJohannes Berg  */
14572a519311SJohannes Berg struct cfg80211_bss {
14582a519311SJohannes Berg 	struct ieee80211_channel *channel;
1459dcd6eac1SSimon Wunderlich 	enum nl80211_bss_scan_width scan_width;
14602a519311SJohannes Berg 
14619caf0364SJohannes Berg 	const struct cfg80211_bss_ies __rcu *ies;
14629caf0364SJohannes Berg 	const struct cfg80211_bss_ies __rcu *beacon_ies;
14639caf0364SJohannes Berg 	const struct cfg80211_bss_ies __rcu *proberesp_ies;
14649caf0364SJohannes Berg 
1465776b3580SJohannes Berg 	struct cfg80211_bss *hidden_beacon_bss;
14662a519311SJohannes Berg 
14672a519311SJohannes Berg 	s32 signal;
14682a519311SJohannes Berg 
14699caf0364SJohannes Berg 	u16 beacon_interval;
14709caf0364SJohannes Berg 	u16 capability;
14719caf0364SJohannes Berg 
14729caf0364SJohannes Berg 	u8 bssid[ETH_ALEN];
14739caf0364SJohannes Berg 
14741c06ef98SJohannes Berg 	u8 priv[0] __aligned(sizeof(void *));
14752a519311SJohannes Berg };
14762a519311SJohannes Berg 
14772a519311SJohannes Berg /**
1478517357c6SJohannes Berg  * ieee80211_bss_get_ie - find IE with given ID
1479517357c6SJohannes Berg  * @bss: the bss to search
1480517357c6SJohannes Berg  * @ie: the IE ID
14819caf0364SJohannes Berg  *
14829caf0364SJohannes Berg  * Note that the return value is an RCU-protected pointer, so
14839caf0364SJohannes Berg  * rcu_read_lock() must be held when calling this function.
14840ae997dcSYacine Belkadi  * Return: %NULL if not found.
1485517357c6SJohannes Berg  */
1486517357c6SJohannes Berg const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie);
1487517357c6SJohannes Berg 
1488517357c6SJohannes Berg 
1489517357c6SJohannes Berg /**
1490636a5d36SJouni Malinen  * struct cfg80211_auth_request - Authentication request data
1491636a5d36SJouni Malinen  *
1492636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
1493636a5d36SJouni Malinen  * authentication.
1494636a5d36SJouni Malinen  *
1495959867faSJohannes Berg  * @bss: The BSS to authenticate with, the callee must obtain a reference
1496959867faSJohannes Berg  *	to it if it needs to keep it.
1497636a5d36SJouni Malinen  * @auth_type: Authentication type (algorithm)
1498636a5d36SJouni Malinen  * @ie: Extra IEs to add to Authentication frame or %NULL
1499636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
1500fffd0934SJohannes Berg  * @key_len: length of WEP key for shared key authentication
1501fffd0934SJohannes Berg  * @key_idx: index of WEP key for shared key authentication
1502fffd0934SJohannes Berg  * @key: WEP key for shared key authentication
1503e39e5b5eSJouni Malinen  * @sae_data: Non-IE data to use with SAE or %NULL. This starts with
1504e39e5b5eSJouni Malinen  *	Authentication transaction sequence number field.
1505e39e5b5eSJouni Malinen  * @sae_data_len: Length of sae_data buffer in octets
1506636a5d36SJouni Malinen  */
1507636a5d36SJouni Malinen struct cfg80211_auth_request {
150819957bb3SJohannes Berg 	struct cfg80211_bss *bss;
1509636a5d36SJouni Malinen 	const u8 *ie;
1510636a5d36SJouni Malinen 	size_t ie_len;
151119957bb3SJohannes Berg 	enum nl80211_auth_type auth_type;
1512fffd0934SJohannes Berg 	const u8 *key;
1513fffd0934SJohannes Berg 	u8 key_len, key_idx;
1514e39e5b5eSJouni Malinen 	const u8 *sae_data;
1515e39e5b5eSJouni Malinen 	size_t sae_data_len;
1516636a5d36SJouni Malinen };
1517636a5d36SJouni Malinen 
1518636a5d36SJouni Malinen /**
15197e7c8926SBen Greear  * enum cfg80211_assoc_req_flags - Over-ride default behaviour in association.
15207e7c8926SBen Greear  *
15217e7c8926SBen Greear  * @ASSOC_REQ_DISABLE_HT:  Disable HT (802.11n)
1522ee2aca34SJohannes Berg  * @ASSOC_REQ_DISABLE_VHT:  Disable VHT
15237e7c8926SBen Greear  */
15247e7c8926SBen Greear enum cfg80211_assoc_req_flags {
15257e7c8926SBen Greear 	ASSOC_REQ_DISABLE_HT		= BIT(0),
1526ee2aca34SJohannes Berg 	ASSOC_REQ_DISABLE_VHT		= BIT(1),
15277e7c8926SBen Greear };
15287e7c8926SBen Greear 
15297e7c8926SBen Greear /**
1530636a5d36SJouni Malinen  * struct cfg80211_assoc_request - (Re)Association request data
1531636a5d36SJouni Malinen  *
1532636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
1533636a5d36SJouni Malinen  * (re)association.
1534959867faSJohannes Berg  * @bss: The BSS to associate with. If the call is successful the driver is
1535959867faSJohannes Berg  *	given a reference that it must give back to cfg80211_send_rx_assoc()
1536959867faSJohannes Berg  *	or to cfg80211_assoc_timeout(). To ensure proper refcounting, new
1537959867faSJohannes Berg  *	association requests while already associating must be rejected.
1538636a5d36SJouni Malinen  * @ie: Extra IEs to add to (Re)Association Request frame or %NULL
1539636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
1540dc6382ceSJouni Malinen  * @use_mfp: Use management frame protection (IEEE 802.11w) in this association
1541b23aa676SSamuel Ortiz  * @crypto: crypto settings
15423e5d7649SJohannes Berg  * @prev_bssid: previous BSSID, if not %NULL use reassociate frame
15437e7c8926SBen Greear  * @flags:  See &enum cfg80211_assoc_req_flags
15447e7c8926SBen Greear  * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask
15457e7c8926SBen Greear  *	will be used in ht_capa.  Un-supported values will be ignored.
15467e7c8926SBen Greear  * @ht_capa_mask:  The bits of ht_capa which are to be used.
1547ee2aca34SJohannes Berg  * @vht_capa: VHT capability override
1548ee2aca34SJohannes Berg  * @vht_capa_mask: VHT capability mask indicating which fields to use
1549636a5d36SJouni Malinen  */
1550636a5d36SJouni Malinen struct cfg80211_assoc_request {
155119957bb3SJohannes Berg 	struct cfg80211_bss *bss;
15523e5d7649SJohannes Berg 	const u8 *ie, *prev_bssid;
1553636a5d36SJouni Malinen 	size_t ie_len;
1554b23aa676SSamuel Ortiz 	struct cfg80211_crypto_settings crypto;
155519957bb3SJohannes Berg 	bool use_mfp;
15567e7c8926SBen Greear 	u32 flags;
15577e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa;
15587e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa_mask;
1559ee2aca34SJohannes Berg 	struct ieee80211_vht_cap vht_capa, vht_capa_mask;
1560636a5d36SJouni Malinen };
1561636a5d36SJouni Malinen 
1562636a5d36SJouni Malinen /**
1563636a5d36SJouni Malinen  * struct cfg80211_deauth_request - Deauthentication request data
1564636a5d36SJouni Malinen  *
1565636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
1566636a5d36SJouni Malinen  * deauthentication.
1567636a5d36SJouni Malinen  *
156895de817bSJohannes Berg  * @bssid: the BSSID of the BSS to deauthenticate from
1569636a5d36SJouni Malinen  * @ie: Extra IEs to add to Deauthentication frame or %NULL
1570636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
157119957bb3SJohannes Berg  * @reason_code: The reason code for the deauthentication
1572077f897aSJohannes Berg  * @local_state_change: if set, change local state only and
1573077f897aSJohannes Berg  *	do not set a deauth frame
1574636a5d36SJouni Malinen  */
1575636a5d36SJouni Malinen struct cfg80211_deauth_request {
157695de817bSJohannes Berg 	const u8 *bssid;
1577636a5d36SJouni Malinen 	const u8 *ie;
1578636a5d36SJouni Malinen 	size_t ie_len;
157919957bb3SJohannes Berg 	u16 reason_code;
15806863255bSStanislaw Gruszka 	bool local_state_change;
1581636a5d36SJouni Malinen };
1582636a5d36SJouni Malinen 
1583636a5d36SJouni Malinen /**
1584636a5d36SJouni Malinen  * struct cfg80211_disassoc_request - Disassociation request data
1585636a5d36SJouni Malinen  *
1586636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
1587636a5d36SJouni Malinen  * disassocation.
1588636a5d36SJouni Malinen  *
158919957bb3SJohannes Berg  * @bss: the BSS to disassociate from
1590636a5d36SJouni Malinen  * @ie: Extra IEs to add to Disassociation frame or %NULL
1591636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
159219957bb3SJohannes Berg  * @reason_code: The reason code for the disassociation
1593d5cdfacbSJouni Malinen  * @local_state_change: This is a request for a local state only, i.e., no
1594d5cdfacbSJouni Malinen  *	Disassociation frame is to be transmitted.
1595636a5d36SJouni Malinen  */
1596636a5d36SJouni Malinen struct cfg80211_disassoc_request {
159719957bb3SJohannes Berg 	struct cfg80211_bss *bss;
1598636a5d36SJouni Malinen 	const u8 *ie;
1599636a5d36SJouni Malinen 	size_t ie_len;
160019957bb3SJohannes Berg 	u16 reason_code;
1601d5cdfacbSJouni Malinen 	bool local_state_change;
1602636a5d36SJouni Malinen };
1603636a5d36SJouni Malinen 
1604636a5d36SJouni Malinen /**
160504a773adSJohannes Berg  * struct cfg80211_ibss_params - IBSS parameters
160604a773adSJohannes Berg  *
160704a773adSJohannes Berg  * This structure defines the IBSS parameters for the join_ibss()
160804a773adSJohannes Berg  * method.
160904a773adSJohannes Berg  *
161004a773adSJohannes Berg  * @ssid: The SSID, will always be non-null.
161104a773adSJohannes Berg  * @ssid_len: The length of the SSID, will always be non-zero.
161204a773adSJohannes Berg  * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not
161304a773adSJohannes Berg  *	search for IBSSs with a different BSSID.
1614683b6d3bSJohannes Berg  * @chandef: defines the channel to use if no other IBSS to join can be found
161504a773adSJohannes Berg  * @channel_fixed: The channel should be fixed -- do not search for
161604a773adSJohannes Berg  *	IBSSs to join on other channels.
161704a773adSJohannes Berg  * @ie: information element(s) to include in the beacon
161804a773adSJohannes Berg  * @ie_len: length of that
16198e30bc55SJohannes Berg  * @beacon_interval: beacon interval to use
1620fffd0934SJohannes Berg  * @privacy: this is a protected network, keys will be configured
1621fffd0934SJohannes Berg  *	after joining
1622267335d6SAntonio Quartulli  * @control_port: whether user space controls IEEE 802.1X port, i.e.,
1623267335d6SAntonio Quartulli  *	sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
1624267335d6SAntonio Quartulli  *	required to assume that the port is unauthorized until authorized by
1625267335d6SAntonio Quartulli  *	user space. Otherwise, port is marked authorized by default.
1626fbd2c8dcSTeemu Paasikivi  * @basic_rates: bitmap of basic rates to use when creating the IBSS
1627dd5b4cc7SFelix Fietkau  * @mcast_rate: per-band multicast rate index + 1 (0: disabled)
1628803768f5SSimon Wunderlich  * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask
1629803768f5SSimon Wunderlich  *	will be used in ht_capa.  Un-supported values will be ignored.
1630803768f5SSimon Wunderlich  * @ht_capa_mask:  The bits of ht_capa which are to be used.
163104a773adSJohannes Berg  */
163204a773adSJohannes Berg struct cfg80211_ibss_params {
163304a773adSJohannes Berg 	u8 *ssid;
163404a773adSJohannes Berg 	u8 *bssid;
1635683b6d3bSJohannes Berg 	struct cfg80211_chan_def chandef;
163604a773adSJohannes Berg 	u8 *ie;
163704a773adSJohannes Berg 	u8 ssid_len, ie_len;
16388e30bc55SJohannes Berg 	u16 beacon_interval;
1639fbd2c8dcSTeemu Paasikivi 	u32 basic_rates;
164004a773adSJohannes Berg 	bool channel_fixed;
1641fffd0934SJohannes Berg 	bool privacy;
1642267335d6SAntonio Quartulli 	bool control_port;
1643dd5b4cc7SFelix Fietkau 	int mcast_rate[IEEE80211_NUM_BANDS];
1644803768f5SSimon Wunderlich 	struct ieee80211_ht_cap ht_capa;
1645803768f5SSimon Wunderlich 	struct ieee80211_ht_cap ht_capa_mask;
164604a773adSJohannes Berg };
164704a773adSJohannes Berg 
164804a773adSJohannes Berg /**
1649b23aa676SSamuel Ortiz  * struct cfg80211_connect_params - Connection parameters
1650b23aa676SSamuel Ortiz  *
1651b23aa676SSamuel Ortiz  * This structure provides information needed to complete IEEE 802.11
1652b23aa676SSamuel Ortiz  * authentication and association.
1653b23aa676SSamuel Ortiz  *
1654b23aa676SSamuel Ortiz  * @channel: The channel to use or %NULL if not specified (auto-select based
1655b23aa676SSamuel Ortiz  *	on scan results)
1656b23aa676SSamuel Ortiz  * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan
1657b23aa676SSamuel Ortiz  *	results)
1658b23aa676SSamuel Ortiz  * @ssid: SSID
1659b23aa676SSamuel Ortiz  * @ssid_len: Length of ssid in octets
1660b23aa676SSamuel Ortiz  * @auth_type: Authentication type (algorithm)
1661abe37c4bSJohannes Berg  * @ie: IEs for association request
1662abe37c4bSJohannes Berg  * @ie_len: Length of assoc_ie in octets
1663b23aa676SSamuel Ortiz  * @privacy: indicates whether privacy-enabled APs should be used
1664cee00a95SJouni Malinen  * @mfp: indicate whether management frame protection is used
1665b23aa676SSamuel Ortiz  * @crypto: crypto settings
1666fffd0934SJohannes Berg  * @key_len: length of WEP key for shared key authentication
1667fffd0934SJohannes Berg  * @key_idx: index of WEP key for shared key authentication
1668fffd0934SJohannes Berg  * @key: WEP key for shared key authentication
16697e7c8926SBen Greear  * @flags:  See &enum cfg80211_assoc_req_flags
16704486ea98SBala Shanmugam  * @bg_scan_period:  Background scan period in seconds
16714486ea98SBala Shanmugam  *	or -1 to indicate that default value is to be used.
16727e7c8926SBen Greear  * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask
16737e7c8926SBen Greear  *	will be used in ht_capa.  Un-supported values will be ignored.
16747e7c8926SBen Greear  * @ht_capa_mask:  The bits of ht_capa which are to be used.
1675ee2aca34SJohannes Berg  * @vht_capa:  VHT Capability overrides
1676ee2aca34SJohannes Berg  * @vht_capa_mask: The bits of vht_capa which are to be used.
1677b23aa676SSamuel Ortiz  */
1678b23aa676SSamuel Ortiz struct cfg80211_connect_params {
1679b23aa676SSamuel Ortiz 	struct ieee80211_channel *channel;
1680b23aa676SSamuel Ortiz 	u8 *bssid;
1681b23aa676SSamuel Ortiz 	u8 *ssid;
1682b23aa676SSamuel Ortiz 	size_t ssid_len;
1683b23aa676SSamuel Ortiz 	enum nl80211_auth_type auth_type;
1684b23aa676SSamuel Ortiz 	u8 *ie;
1685b23aa676SSamuel Ortiz 	size_t ie_len;
1686b23aa676SSamuel Ortiz 	bool privacy;
1687cee00a95SJouni Malinen 	enum nl80211_mfp mfp;
1688b23aa676SSamuel Ortiz 	struct cfg80211_crypto_settings crypto;
1689fffd0934SJohannes Berg 	const u8 *key;
1690fffd0934SJohannes Berg 	u8 key_len, key_idx;
16917e7c8926SBen Greear 	u32 flags;
16924486ea98SBala Shanmugam 	int bg_scan_period;
16937e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa;
16947e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa_mask;
1695ee2aca34SJohannes Berg 	struct ieee80211_vht_cap vht_capa;
1696ee2aca34SJohannes Berg 	struct ieee80211_vht_cap vht_capa_mask;
1697b23aa676SSamuel Ortiz };
1698b23aa676SSamuel Ortiz 
1699b23aa676SSamuel Ortiz /**
1700b9a5f8caSJouni Malinen  * enum wiphy_params_flags - set_wiphy_params bitfield values
1701abe37c4bSJohannes Berg  * @WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed
1702abe37c4bSJohannes Berg  * @WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed
1703abe37c4bSJohannes Berg  * @WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed
1704abe37c4bSJohannes Berg  * @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed
1705abe37c4bSJohannes Berg  * @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed
1706b9a5f8caSJouni Malinen  */
1707b9a5f8caSJouni Malinen enum wiphy_params_flags {
1708b9a5f8caSJouni Malinen 	WIPHY_PARAM_RETRY_SHORT		= 1 << 0,
1709b9a5f8caSJouni Malinen 	WIPHY_PARAM_RETRY_LONG		= 1 << 1,
1710b9a5f8caSJouni Malinen 	WIPHY_PARAM_FRAG_THRESHOLD	= 1 << 2,
1711b9a5f8caSJouni Malinen 	WIPHY_PARAM_RTS_THRESHOLD	= 1 << 3,
171281077e82SLukáš Turek 	WIPHY_PARAM_COVERAGE_CLASS	= 1 << 4,
1713b9a5f8caSJouni Malinen };
1714b9a5f8caSJouni Malinen 
17159930380fSJohannes Berg /*
17169930380fSJohannes Berg  * cfg80211_bitrate_mask - masks for bitrate control
17179930380fSJohannes Berg  */
17189930380fSJohannes Berg struct cfg80211_bitrate_mask {
17199930380fSJohannes Berg 	struct {
17209930380fSJohannes Berg 		u32 legacy;
172124db78c0SSimon Wunderlich 		u8 mcs[IEEE80211_HT_MCS_MASK_LEN];
17229930380fSJohannes Berg 	} control[IEEE80211_NUM_BANDS];
17239930380fSJohannes Berg };
172467fbb16bSSamuel Ortiz /**
172567fbb16bSSamuel Ortiz  * struct cfg80211_pmksa - PMK Security Association
172667fbb16bSSamuel Ortiz  *
172767fbb16bSSamuel Ortiz  * This structure is passed to the set/del_pmksa() method for PMKSA
172867fbb16bSSamuel Ortiz  * caching.
172967fbb16bSSamuel Ortiz  *
173067fbb16bSSamuel Ortiz  * @bssid: The AP's BSSID.
173167fbb16bSSamuel Ortiz  * @pmkid: The PMK material itself.
173267fbb16bSSamuel Ortiz  */
173367fbb16bSSamuel Ortiz struct cfg80211_pmksa {
173467fbb16bSSamuel Ortiz 	u8 *bssid;
173567fbb16bSSamuel Ortiz 	u8 *pmkid;
173667fbb16bSSamuel Ortiz };
17379930380fSJohannes Berg 
17387643a2c3SJohannes Berg /**
173950ac6607SAmitkumar Karwar  * struct cfg80211_pkt_pattern - packet pattern
1740ff1b6e69SJohannes Berg  * @mask: bitmask where to match pattern and where to ignore bytes,
1741ff1b6e69SJohannes Berg  *	one bit per byte, in same format as nl80211
1742ff1b6e69SJohannes Berg  * @pattern: bytes to match where bitmask is 1
1743ff1b6e69SJohannes Berg  * @pattern_len: length of pattern (in bytes)
1744bb92d199SAmitkumar Karwar  * @pkt_offset: packet offset (in bytes)
1745ff1b6e69SJohannes Berg  *
1746ff1b6e69SJohannes Berg  * Internal note: @mask and @pattern are allocated in one chunk of
1747ff1b6e69SJohannes Berg  * memory, free @mask only!
1748ff1b6e69SJohannes Berg  */
174950ac6607SAmitkumar Karwar struct cfg80211_pkt_pattern {
1750ff1b6e69SJohannes Berg 	u8 *mask, *pattern;
1751ff1b6e69SJohannes Berg 	int pattern_len;
1752bb92d199SAmitkumar Karwar 	int pkt_offset;
1753ff1b6e69SJohannes Berg };
1754ff1b6e69SJohannes Berg 
1755ff1b6e69SJohannes Berg /**
17562a0e047eSJohannes Berg  * struct cfg80211_wowlan_tcp - TCP connection parameters
17572a0e047eSJohannes Berg  *
17582a0e047eSJohannes Berg  * @sock: (internal) socket for source port allocation
17592a0e047eSJohannes Berg  * @src: source IP address
17602a0e047eSJohannes Berg  * @dst: destination IP address
17612a0e047eSJohannes Berg  * @dst_mac: destination MAC address
17622a0e047eSJohannes Berg  * @src_port: source port
17632a0e047eSJohannes Berg  * @dst_port: destination port
17642a0e047eSJohannes Berg  * @payload_len: data payload length
17652a0e047eSJohannes Berg  * @payload: data payload buffer
17662a0e047eSJohannes Berg  * @payload_seq: payload sequence stamping configuration
17672a0e047eSJohannes Berg  * @data_interval: interval at which to send data packets
17682a0e047eSJohannes Berg  * @wake_len: wakeup payload match length
17692a0e047eSJohannes Berg  * @wake_data: wakeup payload match data
17702a0e047eSJohannes Berg  * @wake_mask: wakeup payload match mask
17712a0e047eSJohannes Berg  * @tokens_size: length of the tokens buffer
17722a0e047eSJohannes Berg  * @payload_tok: payload token usage configuration
17732a0e047eSJohannes Berg  */
17742a0e047eSJohannes Berg struct cfg80211_wowlan_tcp {
17752a0e047eSJohannes Berg 	struct socket *sock;
17762a0e047eSJohannes Berg 	__be32 src, dst;
17772a0e047eSJohannes Berg 	u16 src_port, dst_port;
17782a0e047eSJohannes Berg 	u8 dst_mac[ETH_ALEN];
17792a0e047eSJohannes Berg 	int payload_len;
17802a0e047eSJohannes Berg 	const u8 *payload;
17812a0e047eSJohannes Berg 	struct nl80211_wowlan_tcp_data_seq payload_seq;
17822a0e047eSJohannes Berg 	u32 data_interval;
17832a0e047eSJohannes Berg 	u32 wake_len;
17842a0e047eSJohannes Berg 	const u8 *wake_data, *wake_mask;
17852a0e047eSJohannes Berg 	u32 tokens_size;
17862a0e047eSJohannes Berg 	/* must be last, variable member */
17872a0e047eSJohannes Berg 	struct nl80211_wowlan_tcp_data_token payload_tok;
1788ff1b6e69SJohannes Berg };
1789ff1b6e69SJohannes Berg 
1790ff1b6e69SJohannes Berg /**
1791ff1b6e69SJohannes Berg  * struct cfg80211_wowlan - Wake on Wireless-LAN support info
1792ff1b6e69SJohannes Berg  *
1793ff1b6e69SJohannes Berg  * This structure defines the enabled WoWLAN triggers for the device.
1794ff1b6e69SJohannes Berg  * @any: wake up on any activity -- special trigger if device continues
1795ff1b6e69SJohannes Berg  *	operating as normal during suspend
1796ff1b6e69SJohannes Berg  * @disconnect: wake up if getting disconnected
1797ff1b6e69SJohannes Berg  * @magic_pkt: wake up on receiving magic packet
1798ff1b6e69SJohannes Berg  * @patterns: wake up on receiving packet matching a pattern
1799ff1b6e69SJohannes Berg  * @n_patterns: number of patterns
180077dbbb13SJohannes Berg  * @gtk_rekey_failure: wake up on GTK rekey failure
180177dbbb13SJohannes Berg  * @eap_identity_req: wake up on EAP identity request packet
180277dbbb13SJohannes Berg  * @four_way_handshake: wake up on 4-way handshake
180377dbbb13SJohannes Berg  * @rfkill_release: wake up when rfkill is released
18042a0e047eSJohannes Berg  * @tcp: TCP connection establishment/wakeup parameters, see nl80211.h.
18052a0e047eSJohannes Berg  *	NULL if not configured.
1806ff1b6e69SJohannes Berg  */
1807ff1b6e69SJohannes Berg struct cfg80211_wowlan {
180877dbbb13SJohannes Berg 	bool any, disconnect, magic_pkt, gtk_rekey_failure,
180977dbbb13SJohannes Berg 	     eap_identity_req, four_way_handshake,
181077dbbb13SJohannes Berg 	     rfkill_release;
181150ac6607SAmitkumar Karwar 	struct cfg80211_pkt_pattern *patterns;
18122a0e047eSJohannes Berg 	struct cfg80211_wowlan_tcp *tcp;
1813ff1b6e69SJohannes Berg 	int n_patterns;
1814ff1b6e69SJohannes Berg };
1815ff1b6e69SJohannes Berg 
1816ff1b6e69SJohannes Berg /**
1817be29b99aSAmitkumar Karwar  * struct cfg80211_coalesce_rules - Coalesce rule parameters
1818be29b99aSAmitkumar Karwar  *
1819be29b99aSAmitkumar Karwar  * This structure defines coalesce rule for the device.
1820be29b99aSAmitkumar Karwar  * @delay: maximum coalescing delay in msecs.
1821be29b99aSAmitkumar Karwar  * @condition: condition for packet coalescence.
1822be29b99aSAmitkumar Karwar  *	see &enum nl80211_coalesce_condition.
1823be29b99aSAmitkumar Karwar  * @patterns: array of packet patterns
1824be29b99aSAmitkumar Karwar  * @n_patterns: number of patterns
1825be29b99aSAmitkumar Karwar  */
1826be29b99aSAmitkumar Karwar struct cfg80211_coalesce_rules {
1827be29b99aSAmitkumar Karwar 	int delay;
1828be29b99aSAmitkumar Karwar 	enum nl80211_coalesce_condition condition;
1829be29b99aSAmitkumar Karwar 	struct cfg80211_pkt_pattern *patterns;
1830be29b99aSAmitkumar Karwar 	int n_patterns;
1831be29b99aSAmitkumar Karwar };
1832be29b99aSAmitkumar Karwar 
1833be29b99aSAmitkumar Karwar /**
1834be29b99aSAmitkumar Karwar  * struct cfg80211_coalesce - Packet coalescing settings
1835be29b99aSAmitkumar Karwar  *
1836be29b99aSAmitkumar Karwar  * This structure defines coalescing settings.
1837be29b99aSAmitkumar Karwar  * @rules: array of coalesce rules
1838be29b99aSAmitkumar Karwar  * @n_rules: number of rules
1839be29b99aSAmitkumar Karwar  */
1840be29b99aSAmitkumar Karwar struct cfg80211_coalesce {
1841be29b99aSAmitkumar Karwar 	struct cfg80211_coalesce_rules *rules;
1842be29b99aSAmitkumar Karwar 	int n_rules;
1843be29b99aSAmitkumar Karwar };
1844be29b99aSAmitkumar Karwar 
1845be29b99aSAmitkumar Karwar /**
1846cd8f7cb4SJohannes Berg  * struct cfg80211_wowlan_wakeup - wakeup report
1847cd8f7cb4SJohannes Berg  * @disconnect: woke up by getting disconnected
1848cd8f7cb4SJohannes Berg  * @magic_pkt: woke up by receiving magic packet
1849cd8f7cb4SJohannes Berg  * @gtk_rekey_failure: woke up by GTK rekey failure
1850cd8f7cb4SJohannes Berg  * @eap_identity_req: woke up by EAP identity request packet
1851cd8f7cb4SJohannes Berg  * @four_way_handshake: woke up by 4-way handshake
1852cd8f7cb4SJohannes Berg  * @rfkill_release: woke up by rfkill being released
1853cd8f7cb4SJohannes Berg  * @pattern_idx: pattern that caused wakeup, -1 if not due to pattern
1854cd8f7cb4SJohannes Berg  * @packet_present_len: copied wakeup packet data
1855cd8f7cb4SJohannes Berg  * @packet_len: original wakeup packet length
1856cd8f7cb4SJohannes Berg  * @packet: The packet causing the wakeup, if any.
1857cd8f7cb4SJohannes Berg  * @packet_80211:  For pattern match, magic packet and other data
1858cd8f7cb4SJohannes Berg  *	frame triggers an 802.3 frame should be reported, for
1859cd8f7cb4SJohannes Berg  *	disconnect due to deauth 802.11 frame. This indicates which
1860cd8f7cb4SJohannes Berg  *	it is.
18612a0e047eSJohannes Berg  * @tcp_match: TCP wakeup packet received
18622a0e047eSJohannes Berg  * @tcp_connlost: TCP connection lost or failed to establish
18632a0e047eSJohannes Berg  * @tcp_nomoretokens: TCP data ran out of tokens
1864cd8f7cb4SJohannes Berg  */
1865cd8f7cb4SJohannes Berg struct cfg80211_wowlan_wakeup {
1866cd8f7cb4SJohannes Berg 	bool disconnect, magic_pkt, gtk_rekey_failure,
1867cd8f7cb4SJohannes Berg 	     eap_identity_req, four_way_handshake,
18682a0e047eSJohannes Berg 	     rfkill_release, packet_80211,
18692a0e047eSJohannes Berg 	     tcp_match, tcp_connlost, tcp_nomoretokens;
1870cd8f7cb4SJohannes Berg 	s32 pattern_idx;
1871cd8f7cb4SJohannes Berg 	u32 packet_present_len, packet_len;
1872cd8f7cb4SJohannes Berg 	const void *packet;
1873cd8f7cb4SJohannes Berg };
1874cd8f7cb4SJohannes Berg 
1875cd8f7cb4SJohannes Berg /**
1876e5497d76SJohannes Berg  * struct cfg80211_gtk_rekey_data - rekey data
1877e5497d76SJohannes Berg  * @kek: key encryption key
1878e5497d76SJohannes Berg  * @kck: key confirmation key
1879e5497d76SJohannes Berg  * @replay_ctr: replay counter
1880e5497d76SJohannes Berg  */
1881e5497d76SJohannes Berg struct cfg80211_gtk_rekey_data {
1882e5497d76SJohannes Berg 	u8 kek[NL80211_KEK_LEN];
1883e5497d76SJohannes Berg 	u8 kck[NL80211_KCK_LEN];
1884e5497d76SJohannes Berg 	u8 replay_ctr[NL80211_REPLAY_CTR_LEN];
1885e5497d76SJohannes Berg };
1886e5497d76SJohannes Berg 
1887e5497d76SJohannes Berg /**
1888355199e0SJouni Malinen  * struct cfg80211_update_ft_ies_params - FT IE Information
1889355199e0SJouni Malinen  *
1890355199e0SJouni Malinen  * This structure provides information needed to update the fast transition IE
1891355199e0SJouni Malinen  *
1892355199e0SJouni Malinen  * @md: The Mobility Domain ID, 2 Octet value
1893355199e0SJouni Malinen  * @ie: Fast Transition IEs
1894355199e0SJouni Malinen  * @ie_len: Length of ft_ie in octets
1895355199e0SJouni Malinen  */
1896355199e0SJouni Malinen struct cfg80211_update_ft_ies_params {
1897355199e0SJouni Malinen 	u16 md;
1898355199e0SJouni Malinen 	const u8 *ie;
1899355199e0SJouni Malinen 	size_t ie_len;
1900355199e0SJouni Malinen };
1901355199e0SJouni Malinen 
1902355199e0SJouni Malinen /**
1903704232c2SJohannes Berg  * struct cfg80211_ops - backend description for wireless configuration
1904704232c2SJohannes Berg  *
1905704232c2SJohannes Berg  * This struct is registered by fullmac card drivers and/or wireless stacks
1906704232c2SJohannes Berg  * in order to handle configuration requests on their interfaces.
1907704232c2SJohannes Berg  *
1908704232c2SJohannes Berg  * All callbacks except where otherwise noted should return 0
1909704232c2SJohannes Berg  * on success or a negative error code.
1910704232c2SJohannes Berg  *
191143fb45cbSJohannes Berg  * All operations are currently invoked under rtnl for consistency with the
191243fb45cbSJohannes Berg  * wireless extensions but this is subject to reevaluation as soon as this
191343fb45cbSJohannes Berg  * code is used more widely and we have a first user without wext.
191443fb45cbSJohannes Berg  *
1915ff1b6e69SJohannes Berg  * @suspend: wiphy device needs to be suspended. The variable @wow will
1916ff1b6e69SJohannes Berg  *	be %NULL or contain the enabled Wake-on-Wireless triggers that are
1917ff1b6e69SJohannes Berg  *	configured for the device.
19180378b3f1SJohannes Berg  * @resume: wiphy device needs to be resumed
19196d52563fSJohannes Berg  * @set_wakeup: Called when WoWLAN is enabled/disabled, use this callback
19206d52563fSJohannes Berg  *	to call device_set_wakeup_enable() to enable/disable wakeup from
19216d52563fSJohannes Berg  *	the device.
19220378b3f1SJohannes Berg  *
192360719ffdSJohannes Berg  * @add_virtual_intf: create a new virtual interface with the given name,
1924463d0183SJohannes Berg  *	must set the struct wireless_dev's iftype. Beware: You must create
192584efbb84SJohannes Berg  *	the new netdev in the wiphy's network namespace! Returns the struct
192698104fdeSJohannes Berg  *	wireless_dev, or an ERR_PTR. For P2P device wdevs, the driver must
192798104fdeSJohannes Berg  *	also set the address member in the wdev.
1928704232c2SJohannes Berg  *
192984efbb84SJohannes Berg  * @del_virtual_intf: remove the virtual interface
193055682965SJohannes Berg  *
193160719ffdSJohannes Berg  * @change_virtual_intf: change type/configuration of virtual interface,
193260719ffdSJohannes Berg  *	keep the struct wireless_dev's iftype updated.
193355682965SJohannes Berg  *
193441ade00fSJohannes Berg  * @add_key: add a key with the given parameters. @mac_addr will be %NULL
193541ade00fSJohannes Berg  *	when adding a group key.
193641ade00fSJohannes Berg  *
193741ade00fSJohannes Berg  * @get_key: get information about the key with the given parameters.
193841ade00fSJohannes Berg  *	@mac_addr will be %NULL when requesting information for a group
193941ade00fSJohannes Berg  *	key. All pointers given to the @callback function need not be valid
1940e3da574aSJohannes Berg  *	after it returns. This function should return an error if it is
1941e3da574aSJohannes Berg  *	not possible to retrieve the key, -ENOENT if it doesn't exist.
194241ade00fSJohannes Berg  *
194341ade00fSJohannes Berg  * @del_key: remove a key given the @mac_addr (%NULL for a group key)
1944e3da574aSJohannes Berg  *	and @key_index, return -ENOENT if the key doesn't exist.
194541ade00fSJohannes Berg  *
194641ade00fSJohannes Berg  * @set_default_key: set the default key on an interface
1947ed1b6cc7SJohannes Berg  *
19483cfcf6acSJouni Malinen  * @set_default_mgmt_key: set the default management frame key on an interface
19493cfcf6acSJouni Malinen  *
1950e5497d76SJohannes Berg  * @set_rekey_data: give the data necessary for GTK rekeying to the driver
1951e5497d76SJohannes Berg  *
1952c04a4ff7SJohannes Berg  * @start_ap: Start acting in AP mode defined by the parameters.
1953c04a4ff7SJohannes Berg  * @change_beacon: Change the beacon parameters for an access point mode
1954c04a4ff7SJohannes Berg  *	interface. This should reject the call when AP mode wasn't started.
1955c04a4ff7SJohannes Berg  * @stop_ap: Stop being an AP, including stopping beaconing.
19565727ef1bSJohannes Berg  *
19575727ef1bSJohannes Berg  * @add_station: Add a new station.
19585727ef1bSJohannes Berg  * @del_station: Remove a station; @mac may be NULL to remove all stations.
1959bdd90d5eSJohannes Berg  * @change_station: Modify a given station. Note that flags changes are not much
1960bdd90d5eSJohannes Berg  *	validated in cfg80211, in particular the auth/assoc/authorized flags
1961bdd90d5eSJohannes Berg  *	might come to the driver in invalid combinations -- make sure to check
196277ee7c89SJohannes Berg  *	them, also against the existing state! Drivers must call
196377ee7c89SJohannes Berg  *	cfg80211_check_station_change() to validate the information.
1964abe37c4bSJohannes Berg  * @get_station: get station information for the station identified by @mac
1965abe37c4bSJohannes Berg  * @dump_station: dump station callback -- resume dump at index @idx
1966abe37c4bSJohannes Berg  *
1967abe37c4bSJohannes Berg  * @add_mpath: add a fixed mesh path
1968abe37c4bSJohannes Berg  * @del_mpath: delete a given mesh path
1969abe37c4bSJohannes Berg  * @change_mpath: change a given mesh path
1970abe37c4bSJohannes Berg  * @get_mpath: get a mesh path for the given parameters
1971abe37c4bSJohannes Berg  * @dump_mpath: dump mesh path callback -- resume dump at index @idx
1972f52555a4SJohannes Berg  * @join_mesh: join the mesh network with the specified parameters
19738d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
1974f52555a4SJohannes Berg  * @leave_mesh: leave the current mesh network
19758d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
19762ec600d6SLuis Carlos Cobo  *
197724bdd9f4SJavier Cardona  * @get_mesh_config: Get the current mesh configuration
197893da9cc1Scolin@cozybit.com  *
197924bdd9f4SJavier Cardona  * @update_mesh_config: Update mesh parameters on a running mesh.
198093da9cc1Scolin@cozybit.com  *	The mask is a bitfield which tells us which parameters to
198193da9cc1Scolin@cozybit.com  *	set, and which to leave alone.
198293da9cc1Scolin@cozybit.com  *
19839f1ba906SJouni Malinen  * @change_bss: Modify parameters for a given BSS.
198431888487SJouni Malinen  *
198531888487SJouni Malinen  * @set_txq_params: Set TX queue parameters
198672bdcf34SJouni Malinen  *
1987e8c9bd5bSJohannes Berg  * @libertas_set_mesh_channel: Only for backward compatibility for libertas,
1988e8c9bd5bSJohannes Berg  *	as it doesn't implement join_mesh and needs to set the channel to
1989e8c9bd5bSJohannes Berg  *	join the mesh instead.
1990e8c9bd5bSJohannes Berg  *
1991e8c9bd5bSJohannes Berg  * @set_monitor_channel: Set the monitor mode channel for the device. If other
1992e8c9bd5bSJohannes Berg  *	interfaces are active this callback should reject the configuration.
1993e8c9bd5bSJohannes Berg  *	If no interfaces are active or the device is down, the channel should
1994e8c9bd5bSJohannes Berg  *	be stored for when a monitor interface becomes active.
19959aed3cc1SJouni Malinen  *
19962a519311SJohannes Berg  * @scan: Request to do a scan. If returning zero, the scan request is given
19972a519311SJohannes Berg  *	the driver, and will be valid until passed to cfg80211_scan_done().
19982a519311SJohannes Berg  *	For scan results, call cfg80211_inform_bss(); you can call this outside
19992a519311SJohannes Berg  *	the scan/scan_done bracket too.
2000636a5d36SJouni Malinen  *
2001636a5d36SJouni Malinen  * @auth: Request to authenticate with the specified peer
20028d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
2003636a5d36SJouni Malinen  * @assoc: Request to (re)associate with the specified peer
20048d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
2005636a5d36SJouni Malinen  * @deauth: Request to deauthenticate from the specified peer
20068d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
2007636a5d36SJouni Malinen  * @disassoc: Request to disassociate from the specified peer
20088d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
200904a773adSJohannes Berg  *
2010b23aa676SSamuel Ortiz  * @connect: Connect to the ESS with the specified parameters. When connected,
2011b23aa676SSamuel Ortiz  *	call cfg80211_connect_result() with status code %WLAN_STATUS_SUCCESS.
2012b23aa676SSamuel Ortiz  *	If the connection fails for some reason, call cfg80211_connect_result()
2013b23aa676SSamuel Ortiz  *	with the status from the AP.
20148d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
2015b23aa676SSamuel Ortiz  * @disconnect: Disconnect from the BSS/ESS.
20168d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
2017b23aa676SSamuel Ortiz  *
201804a773adSJohannes Berg  * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call
201904a773adSJohannes Berg  *	cfg80211_ibss_joined(), also call that function when changing BSSID due
202004a773adSJohannes Berg  *	to a merge.
20218d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
202204a773adSJohannes Berg  * @leave_ibss: Leave the IBSS.
20238d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
2024b9a5f8caSJouni Malinen  *
2025f4e583c8SAntonio Quartulli  * @set_mcast_rate: Set the specified multicast rate (only if vif is in ADHOC or
2026f4e583c8SAntonio Quartulli  *	MESH mode)
2027f4e583c8SAntonio Quartulli  *
2028b9a5f8caSJouni Malinen  * @set_wiphy_params: Notify that wiphy parameters have changed;
2029b9a5f8caSJouni Malinen  *	@changed bitfield (see &enum wiphy_params_flags) describes which values
2030b9a5f8caSJouni Malinen  *	have changed. The actual parameter values are available in
2031b9a5f8caSJouni Malinen  *	struct wiphy. If returning an error, no value should be changed.
20327643a2c3SJohannes Berg  *
20331432de07SLuis R. Rodriguez  * @set_tx_power: set the transmit power according to the parameters,
2034c8442118SJohannes Berg  *	the power passed is in mBm, to get dBm use MBM_TO_DBM(). The
2035c8442118SJohannes Berg  *	wdev may be %NULL if power was set for the wiphy, and will
2036c8442118SJohannes Berg  *	always be %NULL unless the driver supports per-vif TX power
2037c8442118SJohannes Berg  *	(as advertised by the nl80211 feature flag.)
20387643a2c3SJohannes Berg  * @get_tx_power: store the current TX power into the dbm variable;
20391f87f7d3SJohannes Berg  *	return 0 if successful
20401f87f7d3SJohannes Berg  *
2041abe37c4bSJohannes Berg  * @set_wds_peer: set the WDS peer for a WDS interface
2042abe37c4bSJohannes Berg  *
20431f87f7d3SJohannes Berg  * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting
20441f87f7d3SJohannes Berg  *	functions to adjust rfkill hw state
2045aff89a9bSJohannes Berg  *
204661fa713cSHolger Schurig  * @dump_survey: get site survey information.
204761fa713cSHolger Schurig  *
20489588bbd5SJouni Malinen  * @remain_on_channel: Request the driver to remain awake on the specified
20499588bbd5SJouni Malinen  *	channel for the specified duration to complete an off-channel
20509588bbd5SJouni Malinen  *	operation (e.g., public action frame exchange). When the driver is
20519588bbd5SJouni Malinen  *	ready on the requested channel, it must indicate this with an event
20529588bbd5SJouni Malinen  *	notification by calling cfg80211_ready_on_channel().
20539588bbd5SJouni Malinen  * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation.
20549588bbd5SJouni Malinen  *	This allows the operation to be terminated prior to timeout based on
20559588bbd5SJouni Malinen  *	the duration value.
2056f7ca38dfSJohannes Berg  * @mgmt_tx: Transmit a management frame.
2057f7ca38dfSJohannes Berg  * @mgmt_tx_cancel_wait: Cancel the wait time from transmitting a management
2058f7ca38dfSJohannes Berg  *	frame on another channel
20599588bbd5SJouni Malinen  *
2060aff89a9bSJohannes Berg  * @testmode_cmd: run a test mode command
206171063f0eSWey-Yi Guy  * @testmode_dump: Implement a test mode dump. The cb->args[2] and up may be
206271063f0eSWey-Yi Guy  *	used by the function, but 0 and 1 must not be touched. Additionally,
206371063f0eSWey-Yi Guy  *	return error codes other than -ENOBUFS and -ENOENT will terminate the
206471063f0eSWey-Yi Guy  *	dump and return to userspace with an error, so be careful. If any data
206571063f0eSWey-Yi Guy  *	was passed in from userspace then the data/len arguments will be present
206671063f0eSWey-Yi Guy  *	and point to the data contained in %NL80211_ATTR_TESTDATA.
206767fbb16bSSamuel Ortiz  *
2068abe37c4bSJohannes Berg  * @set_bitrate_mask: set the bitrate mask configuration
2069abe37c4bSJohannes Berg  *
207067fbb16bSSamuel Ortiz  * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac
207167fbb16bSSamuel Ortiz  *	devices running firmwares capable of generating the (re) association
207267fbb16bSSamuel Ortiz  *	RSN IE. It allows for faster roaming between WPA2 BSSIDs.
207367fbb16bSSamuel Ortiz  * @del_pmksa: Delete a cached PMKID.
207467fbb16bSSamuel Ortiz  * @flush_pmksa: Flush all cached PMKIDs.
20759043f3b8SJuuso Oikarinen  * @set_power_mgmt: Configure WLAN power management. A timeout value of -1
20769043f3b8SJuuso Oikarinen  *	allows the driver to adjust the dynamic ps timeout value.
2077d6dc1a38SJuuso Oikarinen  * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold.
207884f10708SThomas Pedersen  * @set_cqm_txe_config: Configure connection quality monitor TX error
207984f10708SThomas Pedersen  *	thresholds.
2080807f8a8cSLuciano Coelho  * @sched_scan_start: Tell the driver to start a scheduled scan.
208130d08a46SArend van Spriel  * @sched_scan_stop: Tell the driver to stop an ongoing scheduled scan.
208267fbb16bSSamuel Ortiz  *
2083271733cfSJohannes Berg  * @mgmt_frame_register: Notify driver that a management frame type was
2084271733cfSJohannes Berg  *	registered. Note that this callback may not sleep, and cannot run
2085271733cfSJohannes Berg  *	concurrently with itself.
2086547025d5SBruno Randolf  *
2087547025d5SBruno Randolf  * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device.
2088547025d5SBruno Randolf  *	Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may
2089547025d5SBruno Randolf  *	reject TX/RX mask combinations they cannot support by returning -EINVAL
2090547025d5SBruno Randolf  *	(also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX).
2091547025d5SBruno Randolf  *
2092547025d5SBruno Randolf  * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant).
20933677713bSJohn W. Linville  *
20943677713bSJohn W. Linville  * @set_ringparam: Set tx and rx ring sizes.
20953677713bSJohn W. Linville  *
20963677713bSJohn W. Linville  * @get_ringparam: Get tx and rx ring current and maximum sizes.
2097109086ceSArik Nemtsov  *
2098109086ceSArik Nemtsov  * @tdls_mgmt: Transmit a TDLS management frame.
2099109086ceSArik Nemtsov  * @tdls_oper: Perform a high-level TDLS operation (e.g. TDLS link setup).
21007f6cf311SJohannes Berg  *
21017f6cf311SJohannes Berg  * @probe_client: probe an associated client, must return a cookie that it
21027f6cf311SJohannes Berg  *	later passes to cfg80211_probe_status().
21031d9d9213SSimon Wunderlich  *
21041d9d9213SSimon Wunderlich  * @set_noack_map: Set the NoAck Map for the TIDs.
2105d6199218SBen Greear  *
2106d6199218SBen Greear  * @get_et_sset_count:  Ethtool API to get string-set count.
2107d6199218SBen Greear  *	See @ethtool_ops.get_sset_count
2108d6199218SBen Greear  *
2109d6199218SBen Greear  * @get_et_stats:  Ethtool API to get a set of u64 stats.
2110d6199218SBen Greear  *	See @ethtool_ops.get_ethtool_stats
2111d6199218SBen Greear  *
2112d6199218SBen Greear  * @get_et_strings:  Ethtool API to get a set of strings to describe stats
2113d6199218SBen Greear  *	and perhaps other supported types of ethtool data-sets.
2114d6199218SBen Greear  *	See @ethtool_ops.get_strings
21155b7ccaf3SJohannes Berg  *
21165b7ccaf3SJohannes Berg  * @get_channel: Get the current operating channel for the virtual interface.
21175b7ccaf3SJohannes Berg  *	For monitor interfaces, it should return %NULL unless there's a single
21185b7ccaf3SJohannes Berg  *	current monitoring channel.
211998104fdeSJohannes Berg  *
212098104fdeSJohannes Berg  * @start_p2p_device: Start the given P2P device.
212198104fdeSJohannes Berg  * @stop_p2p_device: Stop the given P2P device.
212277765eafSVasanthakumar Thiagarajan  *
212377765eafSVasanthakumar Thiagarajan  * @set_mac_acl: Sets MAC address control list in AP and P2P GO mode.
212477765eafSVasanthakumar Thiagarajan  *	Parameters include ACL policy, an array of MAC address of stations
212577765eafSVasanthakumar Thiagarajan  *	and the number of MAC addresses. If there is already a list in driver
212677765eafSVasanthakumar Thiagarajan  *	this new list replaces the existing one. Driver has to clear its ACL
212777765eafSVasanthakumar Thiagarajan  *	when number of MAC addresses entries is passed as 0. Drivers which
212877765eafSVasanthakumar Thiagarajan  *	advertise the support for MAC based ACL have to implement this callback.
212904f39047SSimon Wunderlich  *
213004f39047SSimon Wunderlich  * @start_radar_detection: Start radar detection in the driver.
21318bf24293SJouni Malinen  *
21328bf24293SJouni Malinen  * @update_ft_ies: Provide updated Fast BSS Transition information to the
21338bf24293SJouni Malinen  *	driver. If the SME is in the driver/firmware, this information can be
21348bf24293SJouni Malinen  *	used in building Authentication and Reassociation Request frames.
21355de17984SArend van Spriel  *
21365de17984SArend van Spriel  * @crit_proto_start: Indicates a critical protocol needs more link reliability
21375de17984SArend van Spriel  *	for a given duration (milliseconds). The protocol is provided so the
21385de17984SArend van Spriel  *	driver can take the most appropriate actions.
21395de17984SArend van Spriel  * @crit_proto_stop: Indicates critical protocol no longer needs increased link
21405de17984SArend van Spriel  *	reliability. This operation can not fail.
2141be29b99aSAmitkumar Karwar  * @set_coalesce: Set coalesce parameters.
2142704232c2SJohannes Berg  */
2143704232c2SJohannes Berg struct cfg80211_ops {
2144ff1b6e69SJohannes Berg 	int	(*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
21450378b3f1SJohannes Berg 	int	(*resume)(struct wiphy *wiphy);
21466d52563fSJohannes Berg 	void	(*set_wakeup)(struct wiphy *wiphy, bool enabled);
21470378b3f1SJohannes Berg 
214884efbb84SJohannes Berg 	struct wireless_dev * (*add_virtual_intf)(struct wiphy *wiphy,
2149552bff0cSJohannes Berg 						  const char *name,
2150f9e10ce4SJohannes Berg 						  enum nl80211_iftype type,
2151f9e10ce4SJohannes Berg 						  u32 *flags,
21522ec600d6SLuis Carlos Cobo 						  struct vif_params *params);
215384efbb84SJohannes Berg 	int	(*del_virtual_intf)(struct wiphy *wiphy,
215484efbb84SJohannes Berg 				    struct wireless_dev *wdev);
2155e36d56b6SJohannes Berg 	int	(*change_virtual_intf)(struct wiphy *wiphy,
2156e36d56b6SJohannes Berg 				       struct net_device *dev,
21572ec600d6SLuis Carlos Cobo 				       enum nl80211_iftype type, u32 *flags,
21582ec600d6SLuis Carlos Cobo 				       struct vif_params *params);
215941ade00fSJohannes Berg 
216041ade00fSJohannes Berg 	int	(*add_key)(struct wiphy *wiphy, struct net_device *netdev,
2161e31b8213SJohannes Berg 			   u8 key_index, bool pairwise, const u8 *mac_addr,
216241ade00fSJohannes Berg 			   struct key_params *params);
216341ade00fSJohannes Berg 	int	(*get_key)(struct wiphy *wiphy, struct net_device *netdev,
2164e31b8213SJohannes Berg 			   u8 key_index, bool pairwise, const u8 *mac_addr,
2165e31b8213SJohannes Berg 			   void *cookie,
216641ade00fSJohannes Berg 			   void (*callback)(void *cookie, struct key_params*));
216741ade00fSJohannes Berg 	int	(*del_key)(struct wiphy *wiphy, struct net_device *netdev,
2168e31b8213SJohannes Berg 			   u8 key_index, bool pairwise, const u8 *mac_addr);
216941ade00fSJohannes Berg 	int	(*set_default_key)(struct wiphy *wiphy,
217041ade00fSJohannes Berg 				   struct net_device *netdev,
2171dbd2fd65SJohannes Berg 				   u8 key_index, bool unicast, bool multicast);
21723cfcf6acSJouni Malinen 	int	(*set_default_mgmt_key)(struct wiphy *wiphy,
21733cfcf6acSJouni Malinen 					struct net_device *netdev,
21743cfcf6acSJouni Malinen 					u8 key_index);
2175ed1b6cc7SJohannes Berg 
21768860020eSJohannes Berg 	int	(*start_ap)(struct wiphy *wiphy, struct net_device *dev,
21778860020eSJohannes Berg 			    struct cfg80211_ap_settings *settings);
21788860020eSJohannes Berg 	int	(*change_beacon)(struct wiphy *wiphy, struct net_device *dev,
21798860020eSJohannes Berg 				 struct cfg80211_beacon_data *info);
21808860020eSJohannes Berg 	int	(*stop_ap)(struct wiphy *wiphy, struct net_device *dev);
21815727ef1bSJohannes Berg 
21825727ef1bSJohannes Berg 
21835727ef1bSJohannes Berg 	int	(*add_station)(struct wiphy *wiphy, struct net_device *dev,
21845727ef1bSJohannes Berg 			       u8 *mac, struct station_parameters *params);
21855727ef1bSJohannes Berg 	int	(*del_station)(struct wiphy *wiphy, struct net_device *dev,
21865727ef1bSJohannes Berg 			       u8 *mac);
21875727ef1bSJohannes Berg 	int	(*change_station)(struct wiphy *wiphy, struct net_device *dev,
21885727ef1bSJohannes Berg 				  u8 *mac, struct station_parameters *params);
2189fd5b74dcSJohannes Berg 	int	(*get_station)(struct wiphy *wiphy, struct net_device *dev,
21902ec600d6SLuis Carlos Cobo 			       u8 *mac, struct station_info *sinfo);
21912ec600d6SLuis Carlos Cobo 	int	(*dump_station)(struct wiphy *wiphy, struct net_device *dev,
21922ec600d6SLuis Carlos Cobo 			       int idx, u8 *mac, struct station_info *sinfo);
21932ec600d6SLuis Carlos Cobo 
21942ec600d6SLuis Carlos Cobo 	int	(*add_mpath)(struct wiphy *wiphy, struct net_device *dev,
21952ec600d6SLuis Carlos Cobo 			       u8 *dst, u8 *next_hop);
21962ec600d6SLuis Carlos Cobo 	int	(*del_mpath)(struct wiphy *wiphy, struct net_device *dev,
21972ec600d6SLuis Carlos Cobo 			       u8 *dst);
21982ec600d6SLuis Carlos Cobo 	int	(*change_mpath)(struct wiphy *wiphy, struct net_device *dev,
21992ec600d6SLuis Carlos Cobo 				  u8 *dst, u8 *next_hop);
22002ec600d6SLuis Carlos Cobo 	int	(*get_mpath)(struct wiphy *wiphy, struct net_device *dev,
22012ec600d6SLuis Carlos Cobo 			       u8 *dst, u8 *next_hop,
22022ec600d6SLuis Carlos Cobo 			       struct mpath_info *pinfo);
22032ec600d6SLuis Carlos Cobo 	int	(*dump_mpath)(struct wiphy *wiphy, struct net_device *dev,
22042ec600d6SLuis Carlos Cobo 			       int idx, u8 *dst, u8 *next_hop,
22052ec600d6SLuis Carlos Cobo 			       struct mpath_info *pinfo);
220624bdd9f4SJavier Cardona 	int	(*get_mesh_config)(struct wiphy *wiphy,
220793da9cc1Scolin@cozybit.com 				struct net_device *dev,
220893da9cc1Scolin@cozybit.com 				struct mesh_config *conf);
220924bdd9f4SJavier Cardona 	int	(*update_mesh_config)(struct wiphy *wiphy,
221029cbe68cSJohannes Berg 				      struct net_device *dev, u32 mask,
221129cbe68cSJohannes Berg 				      const struct mesh_config *nconf);
221229cbe68cSJohannes Berg 	int	(*join_mesh)(struct wiphy *wiphy, struct net_device *dev,
221329cbe68cSJohannes Berg 			     const struct mesh_config *conf,
221429cbe68cSJohannes Berg 			     const struct mesh_setup *setup);
221529cbe68cSJohannes Berg 	int	(*leave_mesh)(struct wiphy *wiphy, struct net_device *dev);
221629cbe68cSJohannes Berg 
22179f1ba906SJouni Malinen 	int	(*change_bss)(struct wiphy *wiphy, struct net_device *dev,
22189f1ba906SJouni Malinen 			      struct bss_parameters *params);
221931888487SJouni Malinen 
2220f70f01c2SEliad Peller 	int	(*set_txq_params)(struct wiphy *wiphy, struct net_device *dev,
222131888487SJouni Malinen 				  struct ieee80211_txq_params *params);
222272bdcf34SJouni Malinen 
2223e8c9bd5bSJohannes Berg 	int	(*libertas_set_mesh_channel)(struct wiphy *wiphy,
2224e8c9bd5bSJohannes Berg 					     struct net_device *dev,
2225e8c9bd5bSJohannes Berg 					     struct ieee80211_channel *chan);
2226e8c9bd5bSJohannes Berg 
2227e8c9bd5bSJohannes Berg 	int	(*set_monitor_channel)(struct wiphy *wiphy,
2228683b6d3bSJohannes Berg 				       struct cfg80211_chan_def *chandef);
22299aed3cc1SJouni Malinen 
2230fd014284SJohannes Berg 	int	(*scan)(struct wiphy *wiphy,
22312a519311SJohannes Berg 			struct cfg80211_scan_request *request);
2232636a5d36SJouni Malinen 
2233636a5d36SJouni Malinen 	int	(*auth)(struct wiphy *wiphy, struct net_device *dev,
2234636a5d36SJouni Malinen 			struct cfg80211_auth_request *req);
2235636a5d36SJouni Malinen 	int	(*assoc)(struct wiphy *wiphy, struct net_device *dev,
2236636a5d36SJouni Malinen 			 struct cfg80211_assoc_request *req);
2237636a5d36SJouni Malinen 	int	(*deauth)(struct wiphy *wiphy, struct net_device *dev,
223863c9c5e7SJohannes Berg 			  struct cfg80211_deauth_request *req);
2239636a5d36SJouni Malinen 	int	(*disassoc)(struct wiphy *wiphy, struct net_device *dev,
224063c9c5e7SJohannes Berg 			    struct cfg80211_disassoc_request *req);
224104a773adSJohannes Berg 
2242b23aa676SSamuel Ortiz 	int	(*connect)(struct wiphy *wiphy, struct net_device *dev,
2243b23aa676SSamuel Ortiz 			   struct cfg80211_connect_params *sme);
2244b23aa676SSamuel Ortiz 	int	(*disconnect)(struct wiphy *wiphy, struct net_device *dev,
2245b23aa676SSamuel Ortiz 			      u16 reason_code);
2246b23aa676SSamuel Ortiz 
224704a773adSJohannes Berg 	int	(*join_ibss)(struct wiphy *wiphy, struct net_device *dev,
224804a773adSJohannes Berg 			     struct cfg80211_ibss_params *params);
224904a773adSJohannes Berg 	int	(*leave_ibss)(struct wiphy *wiphy, struct net_device *dev);
2250b9a5f8caSJouni Malinen 
2251f4e583c8SAntonio Quartulli 	int	(*set_mcast_rate)(struct wiphy *wiphy, struct net_device *dev,
2252f4e583c8SAntonio Quartulli 				  int rate[IEEE80211_NUM_BANDS]);
2253f4e583c8SAntonio Quartulli 
2254b9a5f8caSJouni Malinen 	int	(*set_wiphy_params)(struct wiphy *wiphy, u32 changed);
22557643a2c3SJohannes Berg 
2256c8442118SJohannes Berg 	int	(*set_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
2257fa61cf70SJuuso Oikarinen 				enum nl80211_tx_power_setting type, int mbm);
2258c8442118SJohannes Berg 	int	(*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
2259c8442118SJohannes Berg 				int *dbm);
22601f87f7d3SJohannes Berg 
2261ab737a4fSJohannes Berg 	int	(*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev,
2262388ac775SJohannes Berg 				const u8 *addr);
2263ab737a4fSJohannes Berg 
22641f87f7d3SJohannes Berg 	void	(*rfkill_poll)(struct wiphy *wiphy);
2265aff89a9bSJohannes Berg 
2266aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE
2267aff89a9bSJohannes Berg 	int	(*testmode_cmd)(struct wiphy *wiphy, void *data, int len);
226871063f0eSWey-Yi Guy 	int	(*testmode_dump)(struct wiphy *wiphy, struct sk_buff *skb,
226971063f0eSWey-Yi Guy 				 struct netlink_callback *cb,
227071063f0eSWey-Yi Guy 				 void *data, int len);
2271aff89a9bSJohannes Berg #endif
2272bc92afd9SJohannes Berg 
22739930380fSJohannes Berg 	int	(*set_bitrate_mask)(struct wiphy *wiphy,
22749930380fSJohannes Berg 				    struct net_device *dev,
22759930380fSJohannes Berg 				    const u8 *peer,
22769930380fSJohannes Berg 				    const struct cfg80211_bitrate_mask *mask);
22779930380fSJohannes Berg 
227861fa713cSHolger Schurig 	int	(*dump_survey)(struct wiphy *wiphy, struct net_device *netdev,
227961fa713cSHolger Schurig 			int idx, struct survey_info *info);
228061fa713cSHolger Schurig 
228167fbb16bSSamuel Ortiz 	int	(*set_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
228267fbb16bSSamuel Ortiz 			     struct cfg80211_pmksa *pmksa);
228367fbb16bSSamuel Ortiz 	int	(*del_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
228467fbb16bSSamuel Ortiz 			     struct cfg80211_pmksa *pmksa);
228567fbb16bSSamuel Ortiz 	int	(*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev);
228667fbb16bSSamuel Ortiz 
22879588bbd5SJouni Malinen 	int	(*remain_on_channel)(struct wiphy *wiphy,
228871bbc994SJohannes Berg 				     struct wireless_dev *wdev,
22899588bbd5SJouni Malinen 				     struct ieee80211_channel *chan,
22909588bbd5SJouni Malinen 				     unsigned int duration,
22919588bbd5SJouni Malinen 				     u64 *cookie);
22929588bbd5SJouni Malinen 	int	(*cancel_remain_on_channel)(struct wiphy *wiphy,
229371bbc994SJohannes Berg 					    struct wireless_dev *wdev,
22949588bbd5SJouni Malinen 					    u64 cookie);
22959588bbd5SJouni Malinen 
229671bbc994SJohannes Berg 	int	(*mgmt_tx)(struct wiphy *wiphy, struct wireless_dev *wdev,
2297f7ca38dfSJohannes Berg 			  struct ieee80211_channel *chan, bool offchan,
229842d97a59SJohannes Berg 			  unsigned int wait, const u8 *buf, size_t len,
229942d97a59SJohannes Berg 			  bool no_cck, bool dont_wait_for_ack, u64 *cookie);
2300f7ca38dfSJohannes Berg 	int	(*mgmt_tx_cancel_wait)(struct wiphy *wiphy,
230171bbc994SJohannes Berg 				       struct wireless_dev *wdev,
2302f7ca38dfSJohannes Berg 				       u64 cookie);
2303026331c4SJouni Malinen 
2304bc92afd9SJohannes Berg 	int	(*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev,
2305bc92afd9SJohannes Berg 				  bool enabled, int timeout);
2306d6dc1a38SJuuso Oikarinen 
2307d6dc1a38SJuuso Oikarinen 	int	(*set_cqm_rssi_config)(struct wiphy *wiphy,
2308d6dc1a38SJuuso Oikarinen 				       struct net_device *dev,
2309d6dc1a38SJuuso Oikarinen 				       s32 rssi_thold, u32 rssi_hyst);
2310271733cfSJohannes Berg 
231184f10708SThomas Pedersen 	int	(*set_cqm_txe_config)(struct wiphy *wiphy,
231284f10708SThomas Pedersen 				      struct net_device *dev,
231384f10708SThomas Pedersen 				      u32 rate, u32 pkts, u32 intvl);
231484f10708SThomas Pedersen 
2315271733cfSJohannes Berg 	void	(*mgmt_frame_register)(struct wiphy *wiphy,
231671bbc994SJohannes Berg 				       struct wireless_dev *wdev,
2317271733cfSJohannes Berg 				       u16 frame_type, bool reg);
2318afe0cbf8SBruno Randolf 
2319afe0cbf8SBruno Randolf 	int	(*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant);
2320afe0cbf8SBruno Randolf 	int	(*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant);
23213677713bSJohn W. Linville 
23223677713bSJohn W. Linville 	int	(*set_ringparam)(struct wiphy *wiphy, u32 tx, u32 rx);
23233677713bSJohn W. Linville 	void	(*get_ringparam)(struct wiphy *wiphy,
23243677713bSJohn W. Linville 				 u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max);
2325807f8a8cSLuciano Coelho 
2326807f8a8cSLuciano Coelho 	int	(*sched_scan_start)(struct wiphy *wiphy,
2327807f8a8cSLuciano Coelho 				struct net_device *dev,
2328807f8a8cSLuciano Coelho 				struct cfg80211_sched_scan_request *request);
232985a9994aSLuciano Coelho 	int	(*sched_scan_stop)(struct wiphy *wiphy, struct net_device *dev);
2330e5497d76SJohannes Berg 
2331e5497d76SJohannes Berg 	int	(*set_rekey_data)(struct wiphy *wiphy, struct net_device *dev,
2332e5497d76SJohannes Berg 				  struct cfg80211_gtk_rekey_data *data);
2333109086ceSArik Nemtsov 
2334109086ceSArik Nemtsov 	int	(*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev,
2335109086ceSArik Nemtsov 			     u8 *peer, u8 action_code,  u8 dialog_token,
2336109086ceSArik Nemtsov 			     u16 status_code, const u8 *buf, size_t len);
2337109086ceSArik Nemtsov 	int	(*tdls_oper)(struct wiphy *wiphy, struct net_device *dev,
2338109086ceSArik Nemtsov 			     u8 *peer, enum nl80211_tdls_operation oper);
23397f6cf311SJohannes Berg 
23407f6cf311SJohannes Berg 	int	(*probe_client)(struct wiphy *wiphy, struct net_device *dev,
23417f6cf311SJohannes Berg 				const u8 *peer, u64 *cookie);
2342e999882aSJohannes Berg 
23431d9d9213SSimon Wunderlich 	int	(*set_noack_map)(struct wiphy *wiphy,
23441d9d9213SSimon Wunderlich 				  struct net_device *dev,
23451d9d9213SSimon Wunderlich 				  u16 noack_map);
23461d9d9213SSimon Wunderlich 
2347d6199218SBen Greear 	int	(*get_et_sset_count)(struct wiphy *wiphy,
2348d6199218SBen Greear 				     struct net_device *dev, int sset);
2349d6199218SBen Greear 	void	(*get_et_stats)(struct wiphy *wiphy, struct net_device *dev,
2350d6199218SBen Greear 				struct ethtool_stats *stats, u64 *data);
2351d6199218SBen Greear 	void	(*get_et_strings)(struct wiphy *wiphy, struct net_device *dev,
2352d6199218SBen Greear 				  u32 sset, u8 *data);
2353dbbae26aSMichal Kazior 
2354683b6d3bSJohannes Berg 	int	(*get_channel)(struct wiphy *wiphy,
23555b7ccaf3SJohannes Berg 			       struct wireless_dev *wdev,
2356683b6d3bSJohannes Berg 			       struct cfg80211_chan_def *chandef);
235798104fdeSJohannes Berg 
235898104fdeSJohannes Berg 	int	(*start_p2p_device)(struct wiphy *wiphy,
235998104fdeSJohannes Berg 				    struct wireless_dev *wdev);
236098104fdeSJohannes Berg 	void	(*stop_p2p_device)(struct wiphy *wiphy,
236198104fdeSJohannes Berg 				   struct wireless_dev *wdev);
236277765eafSVasanthakumar Thiagarajan 
236377765eafSVasanthakumar Thiagarajan 	int	(*set_mac_acl)(struct wiphy *wiphy, struct net_device *dev,
236477765eafSVasanthakumar Thiagarajan 			       const struct cfg80211_acl_data *params);
236504f39047SSimon Wunderlich 
236604f39047SSimon Wunderlich 	int	(*start_radar_detection)(struct wiphy *wiphy,
236704f39047SSimon Wunderlich 					 struct net_device *dev,
236804f39047SSimon Wunderlich 					 struct cfg80211_chan_def *chandef);
2369355199e0SJouni Malinen 	int	(*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev,
2370355199e0SJouni Malinen 				 struct cfg80211_update_ft_ies_params *ftie);
23715de17984SArend van Spriel 	int	(*crit_proto_start)(struct wiphy *wiphy,
23725de17984SArend van Spriel 				    struct wireless_dev *wdev,
23735de17984SArend van Spriel 				    enum nl80211_crit_proto_id protocol,
23745de17984SArend van Spriel 				    u16 duration);
23755de17984SArend van Spriel 	void	(*crit_proto_stop)(struct wiphy *wiphy,
23765de17984SArend van Spriel 				   struct wireless_dev *wdev);
2377be29b99aSAmitkumar Karwar 	int	(*set_coalesce)(struct wiphy *wiphy,
2378be29b99aSAmitkumar Karwar 				struct cfg80211_coalesce *coalesce);
2379704232c2SJohannes Berg };
2380704232c2SJohannes Berg 
2381d3236553SJohannes Berg /*
2382d3236553SJohannes Berg  * wireless hardware and networking interfaces structures
2383d3236553SJohannes Berg  * and registration/helper functions
2384d3236553SJohannes Berg  */
2385d3236553SJohannes Berg 
2386d3236553SJohannes Berg /**
23875be83de5SJohannes Berg  * enum wiphy_flags - wiphy capability flags
23885be83de5SJohannes Berg  *
23895be83de5SJohannes Berg  * @WIPHY_FLAG_CUSTOM_REGULATORY:  tells us the driver for this device
2390d3236553SJohannes Berg  * 	has its own custom regulatory domain and cannot identify the
2391d3236553SJohannes Berg  * 	ISO / IEC 3166 alpha2 it belongs to. When this is enabled
2392d3236553SJohannes Berg  * 	we will disregard the first regulatory hint (when the
2393d3236553SJohannes Berg  * 	initiator is %REGDOM_SET_BY_CORE).
23945be83de5SJohannes Berg  * @WIPHY_FLAG_STRICT_REGULATORY: tells us the driver for this device will
23955be83de5SJohannes Berg  *	ignore regulatory domain settings until it gets its own regulatory
2396749b527bSLuis R. Rodriguez  *	domain via its regulatory_hint() unless the regulatory hint is
2397749b527bSLuis R. Rodriguez  *	from a country IE. After its gets its own regulatory domain it will
2398749b527bSLuis R. Rodriguez  *	only allow further regulatory domain settings to further enhance
2399749b527bSLuis R. Rodriguez  *	compliance. For example if channel 13 and 14 are disabled by this
2400749b527bSLuis R. Rodriguez  *	regulatory domain no user regulatory domain can enable these channels
2401749b527bSLuis R. Rodriguez  *	at a later time. This can be used for devices which do not have
2402749b527bSLuis R. Rodriguez  *	calibration information guaranteed for frequencies or settings
2403061acaaeSLuis R. Rodriguez  *	outside of its regulatory domain. If used in combination with
2404061acaaeSLuis R. Rodriguez  *	WIPHY_FLAG_CUSTOM_REGULATORY the inspected country IE power settings
2405061acaaeSLuis R. Rodriguez  *	will be followed.
24065be83de5SJohannes Berg  * @WIPHY_FLAG_DISABLE_BEACON_HINTS: enable this if your driver needs to ensure
24075be83de5SJohannes Berg  *	that passive scan flags and beaconing flags may not be lifted by
24085be83de5SJohannes Berg  *	cfg80211 due to regulatory beacon hints. For more information on beacon
240937184244SLuis R. Rodriguez  *	hints read the documenation for regulatory_hint_found_beacon()
24105be83de5SJohannes Berg  * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this
24115be83de5SJohannes Berg  *	wiphy at all
24125be83de5SJohannes Berg  * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled
24135be83de5SJohannes Berg  *	by default -- this flag will be set depending on the kernel's default
24145be83de5SJohannes Berg  *	on wiphy_new(), but can be changed by the driver if it has a good
24155be83de5SJohannes Berg  *	reason to override the default
24169bc383deSJohannes Berg  * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station
24179bc383deSJohannes Berg  *	on a VLAN interface)
24189bc383deSJohannes Berg  * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station
2419c0692b8fSJohannes Berg  * @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the
2420c0692b8fSJohannes Berg  *	control port protocol ethertype. The device also honours the
2421c0692b8fSJohannes Berg  *	control_port_no_encrypt flag.
2422e31b8213SJohannes Berg  * @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN.
242315d5dda6SJavier Cardona  * @WIPHY_FLAG_MESH_AUTH: The device supports mesh authentication by routing
242415d5dda6SJavier Cardona  *	auth frames to userspace. See @NL80211_MESH_SETUP_USERSPACE_AUTH.
24251ba01458SRandy Dunlap  * @WIPHY_FLAG_SUPPORTS_SCHED_SCAN: The device supports scheduled scans.
2426f4b34b55SVivek Natarajan  * @WIPHY_FLAG_SUPPORTS_FW_ROAM: The device supports roaming feature in the
2427f4b34b55SVivek Natarajan  *	firmware.
2428cedb5412SEliad Peller  * @WIPHY_FLAG_AP_UAPSD: The device supports uapsd on AP.
2429109086ceSArik Nemtsov  * @WIPHY_FLAG_SUPPORTS_TDLS: The device supports TDLS (802.11z) operation.
2430109086ceSArik Nemtsov  * @WIPHY_FLAG_TDLS_EXTERNAL_SETUP: The device does not handle TDLS (802.11z)
2431109086ceSArik Nemtsov  *	link setup/discovery operations internally. Setup, discovery and
2432109086ceSArik Nemtsov  *	teardown packets should be sent through the @NL80211_CMD_TDLS_MGMT
2433109086ceSArik Nemtsov  *	command. When this flag is not set, @NL80211_CMD_TDLS_OPER should be
2434109086ceSArik Nemtsov  *	used for asking the driver/firmware to perform a TDLS operation.
2435562a7480SJohannes Berg  * @WIPHY_FLAG_HAVE_AP_SME: device integrates AP SME
24365e760230SJohannes Berg  * @WIPHY_FLAG_REPORTS_OBSS: the device will report beacons from other BSSes
24375e760230SJohannes Berg  *	when there are virtual interfaces in AP mode by calling
24385e760230SJohannes Berg  *	cfg80211_report_obss_beacon().
243987bbbe22SArik Nemtsov  * @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD: When operating as an AP, the device
244087bbbe22SArik Nemtsov  *	responds to probe-requests in hardware.
24417c4ef712SJohannes Berg  * @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX.
24427c4ef712SJohannes Berg  * @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call.
24432f301ab2SSimon Wunderlich  * @WIPHY_FLAG_SUPPORTS_5_10_MHZ: Device supports 5 MHz and 10 MHz channels.
24445be83de5SJohannes Berg  */
24455be83de5SJohannes Berg enum wiphy_flags {
24465be83de5SJohannes Berg 	WIPHY_FLAG_CUSTOM_REGULATORY		= BIT(0),
24475be83de5SJohannes Berg 	WIPHY_FLAG_STRICT_REGULATORY		= BIT(1),
24485be83de5SJohannes Berg 	WIPHY_FLAG_DISABLE_BEACON_HINTS		= BIT(2),
24495be83de5SJohannes Berg 	WIPHY_FLAG_NETNS_OK			= BIT(3),
24505be83de5SJohannes Berg 	WIPHY_FLAG_PS_ON_BY_DEFAULT		= BIT(4),
24519bc383deSJohannes Berg 	WIPHY_FLAG_4ADDR_AP			= BIT(5),
24529bc383deSJohannes Berg 	WIPHY_FLAG_4ADDR_STATION		= BIT(6),
2453c0692b8fSJohannes Berg 	WIPHY_FLAG_CONTROL_PORT_PROTOCOL	= BIT(7),
2454309075cfSJussi Kivilinna 	WIPHY_FLAG_IBSS_RSN			= BIT(8),
245515d5dda6SJavier Cardona 	WIPHY_FLAG_MESH_AUTH			= BIT(10),
2456807f8a8cSLuciano Coelho 	WIPHY_FLAG_SUPPORTS_SCHED_SCAN		= BIT(11),
24578e8b41f9SJohannes Berg 	/* use hole at 12 */
2458f4b34b55SVivek Natarajan 	WIPHY_FLAG_SUPPORTS_FW_ROAM		= BIT(13),
2459cedb5412SEliad Peller 	WIPHY_FLAG_AP_UAPSD			= BIT(14),
2460109086ceSArik Nemtsov 	WIPHY_FLAG_SUPPORTS_TDLS		= BIT(15),
2461109086ceSArik Nemtsov 	WIPHY_FLAG_TDLS_EXTERNAL_SETUP		= BIT(16),
2462562a7480SJohannes Berg 	WIPHY_FLAG_HAVE_AP_SME			= BIT(17),
24635e760230SJohannes Berg 	WIPHY_FLAG_REPORTS_OBSS			= BIT(18),
246487bbbe22SArik Nemtsov 	WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD	= BIT(19),
24657c4ef712SJohannes Berg 	WIPHY_FLAG_OFFCHAN_TX			= BIT(20),
24667c4ef712SJohannes Berg 	WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL	= BIT(21),
24672f301ab2SSimon Wunderlich 	WIPHY_FLAG_SUPPORTS_5_10_MHZ		= BIT(22),
24687527a782SJohannes Berg };
24697527a782SJohannes Berg 
24707527a782SJohannes Berg /**
24717527a782SJohannes Berg  * struct ieee80211_iface_limit - limit on certain interface types
24727527a782SJohannes Berg  * @max: maximum number of interfaces of these types
24737527a782SJohannes Berg  * @types: interface types (bits)
24747527a782SJohannes Berg  */
24757527a782SJohannes Berg struct ieee80211_iface_limit {
24767527a782SJohannes Berg 	u16 max;
24777527a782SJohannes Berg 	u16 types;
24787527a782SJohannes Berg };
24797527a782SJohannes Berg 
24807527a782SJohannes Berg /**
24817527a782SJohannes Berg  * struct ieee80211_iface_combination - possible interface combination
24827527a782SJohannes Berg  * @limits: limits for the given interface types
24837527a782SJohannes Berg  * @n_limits: number of limitations
24847527a782SJohannes Berg  * @num_different_channels: can use up to this many different channels
24857527a782SJohannes Berg  * @max_interfaces: maximum number of interfaces in total allowed in this
24867527a782SJohannes Berg  *	group
24877527a782SJohannes Berg  * @beacon_int_infra_match: In this combination, the beacon intervals
24887527a782SJohannes Berg  *	between infrastructure and AP types must match. This is required
24897527a782SJohannes Berg  *	only in special cases.
249011c4a075SSimon Wunderlich  * @radar_detect_widths: bitmap of channel widths supported for radar detection
24917527a782SJohannes Berg  *
24927527a782SJohannes Berg  * These examples can be expressed as follows:
24937527a782SJohannes Berg  *
24947527a782SJohannes Berg  * Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total:
24957527a782SJohannes Berg  *
24967527a782SJohannes Berg  *  struct ieee80211_iface_limit limits1[] = {
24977527a782SJohannes Berg  *	{ .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
24987527a782SJohannes Berg  *	{ .max = 1, .types = BIT(NL80211_IFTYPE_AP}, },
24997527a782SJohannes Berg  *  };
25007527a782SJohannes Berg  *  struct ieee80211_iface_combination combination1 = {
25017527a782SJohannes Berg  *	.limits = limits1,
25027527a782SJohannes Berg  *	.n_limits = ARRAY_SIZE(limits1),
25037527a782SJohannes Berg  *	.max_interfaces = 2,
25047527a782SJohannes Berg  *	.beacon_int_infra_match = true,
25057527a782SJohannes Berg  *  };
25067527a782SJohannes Berg  *
25077527a782SJohannes Berg  *
25087527a782SJohannes Berg  * Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total:
25097527a782SJohannes Berg  *
25107527a782SJohannes Berg  *  struct ieee80211_iface_limit limits2[] = {
25117527a782SJohannes Berg  *	{ .max = 8, .types = BIT(NL80211_IFTYPE_AP) |
25127527a782SJohannes Berg  *			     BIT(NL80211_IFTYPE_P2P_GO), },
25137527a782SJohannes Berg  *  };
25147527a782SJohannes Berg  *  struct ieee80211_iface_combination combination2 = {
25157527a782SJohannes Berg  *	.limits = limits2,
25167527a782SJohannes Berg  *	.n_limits = ARRAY_SIZE(limits2),
25177527a782SJohannes Berg  *	.max_interfaces = 8,
25187527a782SJohannes Berg  *	.num_different_channels = 1,
25197527a782SJohannes Berg  *  };
25207527a782SJohannes Berg  *
25217527a782SJohannes Berg  *
25227527a782SJohannes Berg  * Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total.
25237527a782SJohannes Berg  * This allows for an infrastructure connection and three P2P connections.
25247527a782SJohannes Berg  *
25257527a782SJohannes Berg  *  struct ieee80211_iface_limit limits3[] = {
25267527a782SJohannes Berg  *	{ .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
25277527a782SJohannes Berg  *	{ .max = 3, .types = BIT(NL80211_IFTYPE_P2P_GO) |
25287527a782SJohannes Berg  *			     BIT(NL80211_IFTYPE_P2P_CLIENT), },
25297527a782SJohannes Berg  *  };
25307527a782SJohannes Berg  *  struct ieee80211_iface_combination combination3 = {
25317527a782SJohannes Berg  *	.limits = limits3,
25327527a782SJohannes Berg  *	.n_limits = ARRAY_SIZE(limits3),
25337527a782SJohannes Berg  *	.max_interfaces = 4,
25347527a782SJohannes Berg  *	.num_different_channels = 2,
25357527a782SJohannes Berg  *  };
25367527a782SJohannes Berg  */
25377527a782SJohannes Berg struct ieee80211_iface_combination {
25387527a782SJohannes Berg 	const struct ieee80211_iface_limit *limits;
25397527a782SJohannes Berg 	u32 num_different_channels;
25407527a782SJohannes Berg 	u16 max_interfaces;
25417527a782SJohannes Berg 	u8 n_limits;
25427527a782SJohannes Berg 	bool beacon_int_infra_match;
254311c4a075SSimon Wunderlich 	u8 radar_detect_widths;
25445be83de5SJohannes Berg };
25455be83de5SJohannes Berg 
25462e161f78SJohannes Berg struct ieee80211_txrx_stypes {
25472e161f78SJohannes Berg 	u16 tx, rx;
25482e161f78SJohannes Berg };
25492e161f78SJohannes Berg 
25505be83de5SJohannes Berg /**
2551ff1b6e69SJohannes Berg  * enum wiphy_wowlan_support_flags - WoWLAN support flags
2552ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_ANY: supports wakeup for the special "any"
2553ff1b6e69SJohannes Berg  *	trigger that keeps the device operating as-is and
2554ff1b6e69SJohannes Berg  *	wakes up the host on any activity, for example a
2555ff1b6e69SJohannes Berg  *	received packet that passed filtering; note that the
2556ff1b6e69SJohannes Berg  *	packet should be preserved in that case
2557ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_MAGIC_PKT: supports wakeup on magic packet
2558ff1b6e69SJohannes Berg  *	(see nl80211.h)
2559ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_DISCONNECT: supports wakeup on disconnect
256077dbbb13SJohannes Berg  * @WIPHY_WOWLAN_SUPPORTS_GTK_REKEY: supports GTK rekeying while asleep
256177dbbb13SJohannes Berg  * @WIPHY_WOWLAN_GTK_REKEY_FAILURE: supports wakeup on GTK rekey failure
256277dbbb13SJohannes Berg  * @WIPHY_WOWLAN_EAP_IDENTITY_REQ: supports wakeup on EAP identity request
256377dbbb13SJohannes Berg  * @WIPHY_WOWLAN_4WAY_HANDSHAKE: supports wakeup on 4-way handshake failure
256477dbbb13SJohannes Berg  * @WIPHY_WOWLAN_RFKILL_RELEASE: supports wakeup on RF-kill release
2565ff1b6e69SJohannes Berg  */
2566ff1b6e69SJohannes Berg enum wiphy_wowlan_support_flags {
2567ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_ANY		= BIT(0),
2568ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_MAGIC_PKT		= BIT(1),
2569ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_DISCONNECT		= BIT(2),
257077dbbb13SJohannes Berg 	WIPHY_WOWLAN_SUPPORTS_GTK_REKEY	= BIT(3),
257177dbbb13SJohannes Berg 	WIPHY_WOWLAN_GTK_REKEY_FAILURE	= BIT(4),
257277dbbb13SJohannes Berg 	WIPHY_WOWLAN_EAP_IDENTITY_REQ	= BIT(5),
257377dbbb13SJohannes Berg 	WIPHY_WOWLAN_4WAY_HANDSHAKE	= BIT(6),
257477dbbb13SJohannes Berg 	WIPHY_WOWLAN_RFKILL_RELEASE	= BIT(7),
2575ff1b6e69SJohannes Berg };
2576ff1b6e69SJohannes Berg 
25772a0e047eSJohannes Berg struct wiphy_wowlan_tcp_support {
25782a0e047eSJohannes Berg 	const struct nl80211_wowlan_tcp_data_token_feature *tok;
25792a0e047eSJohannes Berg 	u32 data_payload_max;
25802a0e047eSJohannes Berg 	u32 data_interval_max;
25812a0e047eSJohannes Berg 	u32 wake_payload_max;
25822a0e047eSJohannes Berg 	bool seq;
25832a0e047eSJohannes Berg };
25842a0e047eSJohannes Berg 
2585ff1b6e69SJohannes Berg /**
2586ff1b6e69SJohannes Berg  * struct wiphy_wowlan_support - WoWLAN support data
2587ff1b6e69SJohannes Berg  * @flags: see &enum wiphy_wowlan_support_flags
2588ff1b6e69SJohannes Berg  * @n_patterns: number of supported wakeup patterns
2589ff1b6e69SJohannes Berg  *	(see nl80211.h for the pattern definition)
2590ff1b6e69SJohannes Berg  * @pattern_max_len: maximum length of each pattern
2591ff1b6e69SJohannes Berg  * @pattern_min_len: minimum length of each pattern
2592bb92d199SAmitkumar Karwar  * @max_pkt_offset: maximum Rx packet offset
25932a0e047eSJohannes Berg  * @tcp: TCP wakeup support information
2594ff1b6e69SJohannes Berg  */
2595ff1b6e69SJohannes Berg struct wiphy_wowlan_support {
2596ff1b6e69SJohannes Berg 	u32 flags;
2597ff1b6e69SJohannes Berg 	int n_patterns;
2598ff1b6e69SJohannes Berg 	int pattern_max_len;
2599ff1b6e69SJohannes Berg 	int pattern_min_len;
2600bb92d199SAmitkumar Karwar 	int max_pkt_offset;
26012a0e047eSJohannes Berg 	const struct wiphy_wowlan_tcp_support *tcp;
2602ff1b6e69SJohannes Berg };
2603ff1b6e69SJohannes Berg 
2604ff1b6e69SJohannes Berg /**
2605be29b99aSAmitkumar Karwar  * struct wiphy_coalesce_support - coalesce support data
2606be29b99aSAmitkumar Karwar  * @n_rules: maximum number of coalesce rules
2607be29b99aSAmitkumar Karwar  * @max_delay: maximum supported coalescing delay in msecs
2608be29b99aSAmitkumar Karwar  * @n_patterns: number of supported patterns in a rule
2609be29b99aSAmitkumar Karwar  *	(see nl80211.h for the pattern definition)
2610be29b99aSAmitkumar Karwar  * @pattern_max_len: maximum length of each pattern
2611be29b99aSAmitkumar Karwar  * @pattern_min_len: minimum length of each pattern
2612be29b99aSAmitkumar Karwar  * @max_pkt_offset: maximum Rx packet offset
2613be29b99aSAmitkumar Karwar  */
2614be29b99aSAmitkumar Karwar struct wiphy_coalesce_support {
2615be29b99aSAmitkumar Karwar 	int n_rules;
2616be29b99aSAmitkumar Karwar 	int max_delay;
2617be29b99aSAmitkumar Karwar 	int n_patterns;
2618be29b99aSAmitkumar Karwar 	int pattern_max_len;
2619be29b99aSAmitkumar Karwar 	int pattern_min_len;
2620be29b99aSAmitkumar Karwar 	int max_pkt_offset;
2621be29b99aSAmitkumar Karwar };
2622be29b99aSAmitkumar Karwar 
2623be29b99aSAmitkumar Karwar /**
26245be83de5SJohannes Berg  * struct wiphy - wireless hardware description
26252784fe91SLuis R. Rodriguez  * @reg_notifier: the driver's regulatory notification callback,
26262784fe91SLuis R. Rodriguez  *	note that if your driver uses wiphy_apply_custom_regulatory()
26272784fe91SLuis R. Rodriguez  *	the reg_notifier's request can be passed as NULL
2628d3236553SJohannes Berg  * @regd: the driver's regulatory domain, if one was requested via
2629d3236553SJohannes Berg  * 	the regulatory_hint() API. This can be used by the driver
2630d3236553SJohannes Berg  *	on the reg_notifier() if it chooses to ignore future
2631d3236553SJohannes Berg  *	regulatory domain changes caused by other drivers.
2632d3236553SJohannes Berg  * @signal_type: signal type reported in &struct cfg80211_bss.
2633d3236553SJohannes Berg  * @cipher_suites: supported cipher suites
2634d3236553SJohannes Berg  * @n_cipher_suites: number of supported cipher suites
2635b9a5f8caSJouni Malinen  * @retry_short: Retry limit for short frames (dot11ShortRetryLimit)
2636b9a5f8caSJouni Malinen  * @retry_long: Retry limit for long frames (dot11LongRetryLimit)
2637b9a5f8caSJouni Malinen  * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold);
2638b9a5f8caSJouni Malinen  *	-1 = fragmentation disabled, only odd values >= 256 used
2639b9a5f8caSJouni Malinen  * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled
2640abe37c4bSJohannes Berg  * @_net: the network namespace this wiphy currently lives in
2641ef15aac6SJohannes Berg  * @perm_addr: permanent MAC address of this device
2642ef15aac6SJohannes Berg  * @addr_mask: If the device supports multiple MAC addresses by masking,
2643ef15aac6SJohannes Berg  *	set this to a mask with variable bits set to 1, e.g. if the last
2644ef15aac6SJohannes Berg  *	four bits are variable then set it to 00:...:00:0f. The actual
2645ef15aac6SJohannes Berg  *	variable bits shall be determined by the interfaces added, with
2646ef15aac6SJohannes Berg  *	interfaces not matching the mask being rejected to be brought up.
2647ef15aac6SJohannes Berg  * @n_addresses: number of addresses in @addresses.
2648ef15aac6SJohannes Berg  * @addresses: If the device has more than one address, set this pointer
2649ef15aac6SJohannes Berg  *	to a list of addresses (6 bytes each). The first one will be used
2650ef15aac6SJohannes Berg  *	by default for perm_addr. In this case, the mask should be set to
2651ef15aac6SJohannes Berg  *	all-zeroes. In this case it is assumed that the device can handle
2652ef15aac6SJohannes Berg  *	the same number of arbitrary MAC addresses.
2653fd235913SRandy Dunlap  * @registered: protects ->resume and ->suspend sysfs callbacks against
2654fd235913SRandy Dunlap  *	unregister hardware
2655abe37c4bSJohannes Berg  * @debugfsdir: debugfs directory used for this wiphy, will be renamed
2656abe37c4bSJohannes Berg  *	automatically on wiphy renames
2657abe37c4bSJohannes Berg  * @dev: (virtual) struct device for this wiphy
26584a711a85SStanislaw Gruszka  * @registered: helps synchronize suspend/resume with wiphy unregister
2659abe37c4bSJohannes Berg  * @wext: wireless extension handlers
2660abe37c4bSJohannes Berg  * @priv: driver private data (sized according to wiphy_new() parameter)
2661abe37c4bSJohannes Berg  * @interface_modes: bitmask of interfaces types valid for this wiphy,
2662abe37c4bSJohannes Berg  *	must be set by driver
26637527a782SJohannes Berg  * @iface_combinations: Valid interface combinations array, should not
26647527a782SJohannes Berg  *	list single interface types.
26657527a782SJohannes Berg  * @n_iface_combinations: number of entries in @iface_combinations array.
26667527a782SJohannes Berg  * @software_iftypes: bitmask of software interface types, these are not
26677527a782SJohannes Berg  *	subject to any restrictions since they are purely managed in SW.
2668abe37c4bSJohannes Berg  * @flags: wiphy flags, see &enum wiphy_flags
26691f074bd8SJohannes Berg  * @features: features advertised to nl80211, see &enum nl80211_feature_flags.
2670abe37c4bSJohannes Berg  * @bss_priv_size: each BSS struct has private data allocated with it,
2671abe37c4bSJohannes Berg  *	this variable determines its size
2672abe37c4bSJohannes Berg  * @max_scan_ssids: maximum number of SSIDs the device can scan for in
2673abe37c4bSJohannes Berg  *	any given scan
267493b6aa69SLuciano Coelho  * @max_sched_scan_ssids: maximum number of SSIDs the device can scan
267593b6aa69SLuciano Coelho  *	for in any given scheduled scan
2676a1f1c21cSLuciano Coelho  * @max_match_sets: maximum number of match sets the device can handle
2677a1f1c21cSLuciano Coelho  *	when performing a scheduled scan, 0 if filtering is not
2678a1f1c21cSLuciano Coelho  *	supported.
2679abe37c4bSJohannes Berg  * @max_scan_ie_len: maximum length of user-controlled IEs device can
2680abe37c4bSJohannes Berg  *	add to probe request frames transmitted during a scan, must not
2681abe37c4bSJohannes Berg  *	include fixed IEs like supported rates
26825a865badSLuciano Coelho  * @max_sched_scan_ie_len: same as max_scan_ie_len, but for scheduled
26835a865badSLuciano Coelho  *	scans
2684abe37c4bSJohannes Berg  * @coverage_class: current coverage class
2685abe37c4bSJohannes Berg  * @fw_version: firmware version for ethtool reporting
2686abe37c4bSJohannes Berg  * @hw_version: hardware version for ethtool reporting
2687abe37c4bSJohannes Berg  * @max_num_pmkids: maximum number of PMKIDs supported by device
2688abe37c4bSJohannes Berg  * @privid: a pointer that drivers can use to identify if an arbitrary
2689abe37c4bSJohannes Berg  *	wiphy is theirs, e.g. in global notifiers
2690abe37c4bSJohannes Berg  * @bands: information about bands/channels supported by this device
26912e161f78SJohannes Berg  *
26922e161f78SJohannes Berg  * @mgmt_stypes: bitmasks of frame subtypes that can be subscribed to or
26932e161f78SJohannes Berg  *	transmitted through nl80211, points to an array indexed by interface
26942e161f78SJohannes Berg  *	type
2695a7ffac95SBruno Randolf  *
26967f531e03SBruno Randolf  * @available_antennas_tx: bitmap of antennas which are available to be
26977f531e03SBruno Randolf  *	configured as TX antennas. Antenna configuration commands will be
26987f531e03SBruno Randolf  *	rejected unless this or @available_antennas_rx is set.
26997f531e03SBruno Randolf  *
27007f531e03SBruno Randolf  * @available_antennas_rx: bitmap of antennas which are available to be
27017f531e03SBruno Randolf  *	configured as RX antennas. Antenna configuration commands will be
27027f531e03SBruno Randolf  *	rejected unless this or @available_antennas_tx is set.
2703a293911dSJohannes Berg  *
270415f0ebc2SRandy Dunlap  * @probe_resp_offload:
270515f0ebc2SRandy Dunlap  *	 Bitmap of supported protocols for probe response offloading.
270615f0ebc2SRandy Dunlap  *	 See &enum nl80211_probe_resp_offload_support_attr. Only valid
270715f0ebc2SRandy Dunlap  *	 when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set.
270815f0ebc2SRandy Dunlap  *
2709a293911dSJohannes Berg  * @max_remain_on_channel_duration: Maximum time a remain-on-channel operation
2710a293911dSJohannes Berg  *	may request, if implemented.
2711ff1b6e69SJohannes Berg  *
2712ff1b6e69SJohannes Berg  * @wowlan: WoWLAN support information
27136abb9cb9SJohannes Berg  * @wowlan_config: current WoWLAN configuration; this should usually not be
27146abb9cb9SJohannes Berg  *	used since access to it is necessarily racy, use the parameter passed
27156abb9cb9SJohannes Berg  *	to the suspend() operation instead.
2716562a7480SJohannes Berg  *
2717562a7480SJohannes Berg  * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features.
27187e7c8926SBen Greear  * @ht_capa_mod_mask:  Specify what ht_cap values can be over-ridden.
27197e7c8926SBen Greear  *	If null, then none can be over-ridden.
2720ee2aca34SJohannes Berg  * @vht_capa_mod_mask:  Specify what VHT capabilities can be over-ridden.
2721ee2aca34SJohannes Berg  *	If null, then none can be over-ridden.
272277765eafSVasanthakumar Thiagarajan  *
272377765eafSVasanthakumar Thiagarajan  * @max_acl_mac_addrs: Maximum number of MAC addresses that the device
272477765eafSVasanthakumar Thiagarajan  *	supports for ACL.
2725a50df0c4SJohannes Berg  *
2726a50df0c4SJohannes Berg  * @extended_capabilities: extended capabilities supported by the driver,
2727a50df0c4SJohannes Berg  *	additional capabilities might be supported by userspace; these are
2728a50df0c4SJohannes Berg  *	the 802.11 extended capabilities ("Extended Capabilities element")
2729a50df0c4SJohannes Berg  *	and are in the same format as in the information element. See
2730a50df0c4SJohannes Berg  *	802.11-2012 8.4.2.29 for the defined fields.
2731a50df0c4SJohannes Berg  * @extended_capabilities_mask: mask of the valid values
2732a50df0c4SJohannes Berg  * @extended_capabilities_len: length of the extended capabilities
2733be29b99aSAmitkumar Karwar  * @coalesce: packet coalescing support information
2734d3236553SJohannes Berg  */
2735d3236553SJohannes Berg struct wiphy {
2736d3236553SJohannes Berg 	/* assign these fields before you register the wiphy */
2737d3236553SJohannes Berg 
2738ef15aac6SJohannes Berg 	/* permanent MAC address(es) */
2739d3236553SJohannes Berg 	u8 perm_addr[ETH_ALEN];
2740ef15aac6SJohannes Berg 	u8 addr_mask[ETH_ALEN];
2741ef15aac6SJohannes Berg 
2742ef15aac6SJohannes Berg 	struct mac_address *addresses;
2743d3236553SJohannes Berg 
27442e161f78SJohannes Berg 	const struct ieee80211_txrx_stypes *mgmt_stypes;
27452e161f78SJohannes Berg 
27467527a782SJohannes Berg 	const struct ieee80211_iface_combination *iface_combinations;
27477527a782SJohannes Berg 	int n_iface_combinations;
27487527a782SJohannes Berg 	u16 software_iftypes;
27497527a782SJohannes Berg 
27502e161f78SJohannes Berg 	u16 n_addresses;
27512e161f78SJohannes Berg 
2752d3236553SJohannes Berg 	/* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
2753d3236553SJohannes Berg 	u16 interface_modes;
2754d3236553SJohannes Berg 
275577765eafSVasanthakumar Thiagarajan 	u16 max_acl_mac_addrs;
275677765eafSVasanthakumar Thiagarajan 
27571f074bd8SJohannes Berg 	u32 flags, features;
2758463d0183SJohannes Berg 
2759562a7480SJohannes Berg 	u32 ap_sme_capa;
2760562a7480SJohannes Berg 
2761d3236553SJohannes Berg 	enum cfg80211_signal_type signal_type;
2762d3236553SJohannes Berg 
2763d3236553SJohannes Berg 	int bss_priv_size;
2764d3236553SJohannes Berg 	u8 max_scan_ssids;
276593b6aa69SLuciano Coelho 	u8 max_sched_scan_ssids;
2766a1f1c21cSLuciano Coelho 	u8 max_match_sets;
2767d3236553SJohannes Berg 	u16 max_scan_ie_len;
27685a865badSLuciano Coelho 	u16 max_sched_scan_ie_len;
2769d3236553SJohannes Berg 
2770d3236553SJohannes Berg 	int n_cipher_suites;
2771d3236553SJohannes Berg 	const u32 *cipher_suites;
2772d3236553SJohannes Berg 
2773b9a5f8caSJouni Malinen 	u8 retry_short;
2774b9a5f8caSJouni Malinen 	u8 retry_long;
2775b9a5f8caSJouni Malinen 	u32 frag_threshold;
2776b9a5f8caSJouni Malinen 	u32 rts_threshold;
277781077e82SLukáš Turek 	u8 coverage_class;
2778b9a5f8caSJouni Malinen 
277981135548SJiri Pirko 	char fw_version[ETHTOOL_FWVERS_LEN];
2780dfce95f5SKalle Valo 	u32 hw_version;
2781dfce95f5SKalle Valo 
2782dfb89c56SJohannes Berg #ifdef CONFIG_PM
2783964dc9e2SJohannes Berg 	const struct wiphy_wowlan_support *wowlan;
27846abb9cb9SJohannes Berg 	struct cfg80211_wowlan *wowlan_config;
2785dfb89c56SJohannes Berg #endif
2786ff1b6e69SJohannes Berg 
2787a293911dSJohannes Berg 	u16 max_remain_on_channel_duration;
2788a293911dSJohannes Berg 
278967fbb16bSSamuel Ortiz 	u8 max_num_pmkids;
279067fbb16bSSamuel Ortiz 
27917f531e03SBruno Randolf 	u32 available_antennas_tx;
27927f531e03SBruno Randolf 	u32 available_antennas_rx;
2793a7ffac95SBruno Randolf 
279487bbbe22SArik Nemtsov 	/*
279587bbbe22SArik Nemtsov 	 * Bitmap of supported protocols for probe response offloading
279687bbbe22SArik Nemtsov 	 * see &enum nl80211_probe_resp_offload_support_attr. Only valid
279787bbbe22SArik Nemtsov 	 * when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set.
279887bbbe22SArik Nemtsov 	 */
279987bbbe22SArik Nemtsov 	u32 probe_resp_offload;
280087bbbe22SArik Nemtsov 
2801a50df0c4SJohannes Berg 	const u8 *extended_capabilities, *extended_capabilities_mask;
2802a50df0c4SJohannes Berg 	u8 extended_capabilities_len;
2803a50df0c4SJohannes Berg 
2804d3236553SJohannes Berg 	/* If multiple wiphys are registered and you're handed e.g.
2805d3236553SJohannes Berg 	 * a regular netdev with assigned ieee80211_ptr, you won't
2806d3236553SJohannes Berg 	 * know whether it points to a wiphy your driver has registered
2807d3236553SJohannes Berg 	 * or not. Assign this to something global to your driver to
2808d3236553SJohannes Berg 	 * help determine whether you own this wiphy or not. */
2809cf5aa2f1SDavid Kilroy 	const void *privid;
2810d3236553SJohannes Berg 
2811d3236553SJohannes Berg 	struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS];
2812d3236553SJohannes Berg 
2813d3236553SJohannes Berg 	/* Lets us get back the wiphy on the callback */
28140c0280bdSLuis R. Rodriguez 	void (*reg_notifier)(struct wiphy *wiphy,
2815d3236553SJohannes Berg 			     struct regulatory_request *request);
2816d3236553SJohannes Berg 
2817d3236553SJohannes Berg 	/* fields below are read-only, assigned by cfg80211 */
2818d3236553SJohannes Berg 
2819458f4f9eSJohannes Berg 	const struct ieee80211_regdomain __rcu *regd;
2820d3236553SJohannes Berg 
2821d3236553SJohannes Berg 	/* the item in /sys/class/ieee80211/ points to this,
2822d3236553SJohannes Berg 	 * you need use set_wiphy_dev() (see below) */
2823d3236553SJohannes Berg 	struct device dev;
2824d3236553SJohannes Berg 
2825ecb44335SStanislaw Gruszka 	/* protects ->resume, ->suspend sysfs callbacks against unregister hw */
2826ecb44335SStanislaw Gruszka 	bool registered;
2827ecb44335SStanislaw Gruszka 
2828d3236553SJohannes Berg 	/* dir in debugfs: ieee80211/<wiphyname> */
2829d3236553SJohannes Berg 	struct dentry *debugfsdir;
2830d3236553SJohannes Berg 
28317e7c8926SBen Greear 	const struct ieee80211_ht_cap *ht_capa_mod_mask;
2832ee2aca34SJohannes Berg 	const struct ieee80211_vht_cap *vht_capa_mod_mask;
28337e7c8926SBen Greear 
2834463d0183SJohannes Berg #ifdef CONFIG_NET_NS
2835463d0183SJohannes Berg 	/* the network namespace this phy lives in currently */
2836463d0183SJohannes Berg 	struct net *_net;
2837463d0183SJohannes Berg #endif
2838463d0183SJohannes Berg 
28393d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT
28403d23e349SJohannes Berg 	const struct iw_handler_def *wext;
28413d23e349SJohannes Berg #endif
28423d23e349SJohannes Berg 
2843be29b99aSAmitkumar Karwar 	const struct wiphy_coalesce_support *coalesce;
2844be29b99aSAmitkumar Karwar 
28451c06ef98SJohannes Berg 	char priv[0] __aligned(NETDEV_ALIGN);
2846d3236553SJohannes Berg };
2847d3236553SJohannes Berg 
2848463d0183SJohannes Berg static inline struct net *wiphy_net(struct wiphy *wiphy)
2849463d0183SJohannes Berg {
2850c2d9ba9bSEric Dumazet 	return read_pnet(&wiphy->_net);
2851463d0183SJohannes Berg }
2852463d0183SJohannes Berg 
2853463d0183SJohannes Berg static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net)
2854463d0183SJohannes Berg {
2855c2d9ba9bSEric Dumazet 	write_pnet(&wiphy->_net, net);
2856463d0183SJohannes Berg }
2857463d0183SJohannes Berg 
2858d3236553SJohannes Berg /**
2859d3236553SJohannes Berg  * wiphy_priv - return priv from wiphy
2860d3236553SJohannes Berg  *
2861d3236553SJohannes Berg  * @wiphy: the wiphy whose priv pointer to return
28620ae997dcSYacine Belkadi  * Return: The priv of @wiphy.
2863d3236553SJohannes Berg  */
2864d3236553SJohannes Berg static inline void *wiphy_priv(struct wiphy *wiphy)
2865d3236553SJohannes Berg {
2866d3236553SJohannes Berg 	BUG_ON(!wiphy);
2867d3236553SJohannes Berg 	return &wiphy->priv;
2868d3236553SJohannes Berg }
2869d3236553SJohannes Berg 
2870d3236553SJohannes Berg /**
2871f1f74825SDavid Kilroy  * priv_to_wiphy - return the wiphy containing the priv
2872f1f74825SDavid Kilroy  *
2873f1f74825SDavid Kilroy  * @priv: a pointer previously returned by wiphy_priv
28740ae997dcSYacine Belkadi  * Return: The wiphy of @priv.
2875f1f74825SDavid Kilroy  */
2876f1f74825SDavid Kilroy static inline struct wiphy *priv_to_wiphy(void *priv)
2877f1f74825SDavid Kilroy {
2878f1f74825SDavid Kilroy 	BUG_ON(!priv);
2879f1f74825SDavid Kilroy 	return container_of(priv, struct wiphy, priv);
2880f1f74825SDavid Kilroy }
2881f1f74825SDavid Kilroy 
2882f1f74825SDavid Kilroy /**
2883d3236553SJohannes Berg  * set_wiphy_dev - set device pointer for wiphy
2884d3236553SJohannes Berg  *
2885d3236553SJohannes Berg  * @wiphy: The wiphy whose device to bind
2886d3236553SJohannes Berg  * @dev: The device to parent it to
2887d3236553SJohannes Berg  */
2888d3236553SJohannes Berg static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev)
2889d3236553SJohannes Berg {
2890d3236553SJohannes Berg 	wiphy->dev.parent = dev;
2891d3236553SJohannes Berg }
2892d3236553SJohannes Berg 
2893d3236553SJohannes Berg /**
2894d3236553SJohannes Berg  * wiphy_dev - get wiphy dev pointer
2895d3236553SJohannes Berg  *
2896d3236553SJohannes Berg  * @wiphy: The wiphy whose device struct to look up
28970ae997dcSYacine Belkadi  * Return: The dev of @wiphy.
2898d3236553SJohannes Berg  */
2899d3236553SJohannes Berg static inline struct device *wiphy_dev(struct wiphy *wiphy)
2900d3236553SJohannes Berg {
2901d3236553SJohannes Berg 	return wiphy->dev.parent;
2902d3236553SJohannes Berg }
2903d3236553SJohannes Berg 
2904d3236553SJohannes Berg /**
2905d3236553SJohannes Berg  * wiphy_name - get wiphy name
2906d3236553SJohannes Berg  *
2907d3236553SJohannes Berg  * @wiphy: The wiphy whose name to return
29080ae997dcSYacine Belkadi  * Return: The name of @wiphy.
2909d3236553SJohannes Berg  */
2910e1db74fcSJoe Perches static inline const char *wiphy_name(const struct wiphy *wiphy)
2911d3236553SJohannes Berg {
2912d3236553SJohannes Berg 	return dev_name(&wiphy->dev);
2913d3236553SJohannes Berg }
2914d3236553SJohannes Berg 
2915d3236553SJohannes Berg /**
2916d3236553SJohannes Berg  * wiphy_new - create a new wiphy for use with cfg80211
2917d3236553SJohannes Berg  *
2918d3236553SJohannes Berg  * @ops: The configuration operations for this device
2919d3236553SJohannes Berg  * @sizeof_priv: The size of the private area to allocate
2920d3236553SJohannes Berg  *
2921d3236553SJohannes Berg  * Create a new wiphy and associate the given operations with it.
2922d3236553SJohannes Berg  * @sizeof_priv bytes are allocated for private use.
2923d3236553SJohannes Berg  *
29240ae997dcSYacine Belkadi  * Return: A pointer to the new wiphy. This pointer must be
29250ae997dcSYacine Belkadi  * assigned to each netdev's ieee80211_ptr for proper operation.
2926d3236553SJohannes Berg  */
29273dcf670bSDavid Kilroy struct wiphy *wiphy_new(const struct cfg80211_ops *ops, int sizeof_priv);
2928d3236553SJohannes Berg 
2929d3236553SJohannes Berg /**
2930d3236553SJohannes Berg  * wiphy_register - register a wiphy with cfg80211
2931d3236553SJohannes Berg  *
2932d3236553SJohannes Berg  * @wiphy: The wiphy to register.
2933d3236553SJohannes Berg  *
29340ae997dcSYacine Belkadi  * Return: A non-negative wiphy index or a negative error code.
2935d3236553SJohannes Berg  */
2936d3236553SJohannes Berg extern int wiphy_register(struct wiphy *wiphy);
2937d3236553SJohannes Berg 
2938d3236553SJohannes Berg /**
2939d3236553SJohannes Berg  * wiphy_unregister - deregister a wiphy from cfg80211
2940d3236553SJohannes Berg  *
2941d3236553SJohannes Berg  * @wiphy: The wiphy to unregister.
2942d3236553SJohannes Berg  *
2943d3236553SJohannes Berg  * After this call, no more requests can be made with this priv
2944d3236553SJohannes Berg  * pointer, but the call may sleep to wait for an outstanding
2945d3236553SJohannes Berg  * request that is being handled.
2946d3236553SJohannes Berg  */
2947d3236553SJohannes Berg extern void wiphy_unregister(struct wiphy *wiphy);
2948d3236553SJohannes Berg 
2949d3236553SJohannes Berg /**
2950d3236553SJohannes Berg  * wiphy_free - free wiphy
2951d3236553SJohannes Berg  *
2952d3236553SJohannes Berg  * @wiphy: The wiphy to free
2953d3236553SJohannes Berg  */
2954d3236553SJohannes Berg extern void wiphy_free(struct wiphy *wiphy);
2955d3236553SJohannes Berg 
2956fffd0934SJohannes Berg /* internal structs */
29576829c878SJohannes Berg struct cfg80211_conn;
295819957bb3SJohannes Berg struct cfg80211_internal_bss;
2959fffd0934SJohannes Berg struct cfg80211_cached_keys;
296019957bb3SJohannes Berg 
2961d3236553SJohannes Berg /**
296289a54e48SJohannes Berg  * struct wireless_dev - wireless device state
2963d3236553SJohannes Berg  *
296489a54e48SJohannes Berg  * For netdevs, this structure must be allocated by the driver
296589a54e48SJohannes Berg  * that uses the ieee80211_ptr field in struct net_device (this
296689a54e48SJohannes Berg  * is intentional so it can be allocated along with the netdev.)
296789a54e48SJohannes Berg  * It need not be registered then as netdev registration will
296889a54e48SJohannes Berg  * be intercepted by cfg80211 to see the new wireless device.
296989a54e48SJohannes Berg  *
297089a54e48SJohannes Berg  * For non-netdev uses, it must also be allocated by the driver
297189a54e48SJohannes Berg  * in response to the cfg80211 callbacks that require it, as
297289a54e48SJohannes Berg  * there's no netdev registration in that case it may not be
297389a54e48SJohannes Berg  * allocated outside of callback operations that return it.
2974d3236553SJohannes Berg  *
2975d3236553SJohannes Berg  * @wiphy: pointer to hardware description
2976d3236553SJohannes Berg  * @iftype: interface type
2977d3236553SJohannes Berg  * @list: (private) Used to collect the interfaces
297889a54e48SJohannes Berg  * @netdev: (private) Used to reference back to the netdev, may be %NULL
297989a54e48SJohannes Berg  * @identifier: (private) Identifier used in nl80211 to identify this
298089a54e48SJohannes Berg  *	wireless device if it has no netdev
2981d3236553SJohannes Berg  * @current_bss: (private) Used by the internal configuration code
2982f444de05SJohannes Berg  * @channel: (private) Used by the internal configuration code to track
2983aa430da4SJohannes Berg  *	the user-set AP, monitor and WDS channel
2984780b40dfSJohannes Berg  * @preset_chandef: (private) Used by the internal configuration code to
2985aa430da4SJohannes Berg  *	track the channel to be used for AP later
2986d3236553SJohannes Berg  * @bssid: (private) Used by the internal configuration code
2987d3236553SJohannes Berg  * @ssid: (private) Used by the internal configuration code
2988d3236553SJohannes Berg  * @ssid_len: (private) Used by the internal configuration code
298929cbe68cSJohannes Berg  * @mesh_id_len: (private) Used by the internal configuration code
299029cbe68cSJohannes Berg  * @mesh_id_up_len: (private) Used by the internal configuration code
2991d3236553SJohannes Berg  * @wext: (private) Used by the internal wireless extensions compat code
29929bc383deSJohannes Berg  * @use_4addr: indicates 4addr mode is used on this interface, must be
29939bc383deSJohannes Berg  *	set by driver (if supported) on add_interface BEFORE registering the
29949bc383deSJohannes Berg  *	netdev and may otherwise be used by driver read-only, will be update
29959bc383deSJohannes Berg  *	by cfg80211 on change_interface
29962e161f78SJohannes Berg  * @mgmt_registrations: list of registrations for management frames
29972e161f78SJohannes Berg  * @mgmt_registrations_lock: lock for the list
29988d61ffa5SJohannes Berg  * @mtx: mutex used to lock data in this struct, may be used by drivers
29998d61ffa5SJohannes Berg  *	and some API functions require it held
300056d1893dSJohannes Berg  * @beacon_interval: beacon interval used on this device for transmitting
300156d1893dSJohannes Berg  *	beacons, 0 when not valid
300298104fdeSJohannes Berg  * @address: The address for this device, valid only if @netdev is %NULL
300398104fdeSJohannes Berg  * @p2p_started: true if this is a P2P Device that has been started
300404f39047SSimon Wunderlich  * @cac_started: true if DFS channel availability check has been started
300504f39047SSimon Wunderlich  * @cac_start_time: timestamp (jiffies) when the dfs state was entered.
3006780b40dfSJohannes Berg  * @ps: powersave mode is enabled
3007780b40dfSJohannes Berg  * @ps_timeout: dynamic powersave timeout
3008780b40dfSJohannes Berg  * @ap_unexpected_nlportid: (private) netlink port ID of application
3009780b40dfSJohannes Berg  *	registered for unexpected class 3 frames (AP mode)
3010780b40dfSJohannes Berg  * @conn: (private) cfg80211 software SME connection state machine data
3011780b40dfSJohannes Berg  * @connect_keys: (private) keys to set after connection is established
3012780b40dfSJohannes Berg  * @ibss_fixed: (private) IBSS is using fixed BSSID
3013780b40dfSJohannes Berg  * @event_list: (private) list for internal event processing
3014780b40dfSJohannes Berg  * @event_lock: (private) lock for event list
3015d3236553SJohannes Berg  */
3016d3236553SJohannes Berg struct wireless_dev {
3017d3236553SJohannes Berg 	struct wiphy *wiphy;
3018d3236553SJohannes Berg 	enum nl80211_iftype iftype;
3019d3236553SJohannes Berg 
3020667503ddSJohannes Berg 	/* the remainder of this struct should be private to cfg80211 */
3021d3236553SJohannes Berg 	struct list_head list;
3022d3236553SJohannes Berg 	struct net_device *netdev;
3023d3236553SJohannes Berg 
302489a54e48SJohannes Berg 	u32 identifier;
302589a54e48SJohannes Berg 
30262e161f78SJohannes Berg 	struct list_head mgmt_registrations;
30272e161f78SJohannes Berg 	spinlock_t mgmt_registrations_lock;
3028026331c4SJouni Malinen 
3029667503ddSJohannes Berg 	struct mutex mtx;
3030667503ddSJohannes Berg 
303198104fdeSJohannes Berg 	bool use_4addr, p2p_started;
303298104fdeSJohannes Berg 
303398104fdeSJohannes Berg 	u8 address[ETH_ALEN] __aligned(sizeof(u16));
30349bc383deSJohannes Berg 
3035b23aa676SSamuel Ortiz 	/* currently used for IBSS and SME - might be rearranged later */
3036d3236553SJohannes Berg 	u8 ssid[IEEE80211_MAX_SSID_LEN];
303729cbe68cSJohannes Berg 	u8 ssid_len, mesh_id_len, mesh_id_up_len;
30386829c878SJohannes Berg 	struct cfg80211_conn *conn;
3039fffd0934SJohannes Berg 	struct cfg80211_cached_keys *connect_keys;
3040d3236553SJohannes Berg 
3041667503ddSJohannes Berg 	struct list_head event_list;
3042667503ddSJohannes Berg 	spinlock_t event_lock;
3043667503ddSJohannes Berg 
304419957bb3SJohannes Berg 	struct cfg80211_internal_bss *current_bss; /* associated / joined */
3045683b6d3bSJohannes Berg 	struct cfg80211_chan_def preset_chandef;
304619957bb3SJohannes Berg 
3047f4489ebeSMichal Kazior 	/* for AP and mesh channel tracking */
3048f4489ebeSMichal Kazior 	struct ieee80211_channel *channel;
3049f4489ebeSMichal Kazior 
3050c30a3d38SMichal Kazior 	bool ibss_fixed;
3051c30a3d38SMichal Kazior 
3052ffb9eb3dSKalle Valo 	bool ps;
3053ffb9eb3dSKalle Valo 	int ps_timeout;
3054ffb9eb3dSKalle Valo 
305556d1893dSJohannes Berg 	int beacon_interval;
305656d1893dSJohannes Berg 
305715e47304SEric W. Biederman 	u32 ap_unexpected_nlportid;
305828946da7SJohannes Berg 
305904f39047SSimon Wunderlich 	bool cac_started;
306004f39047SSimon Wunderlich 	unsigned long cac_start_time;
306104f39047SSimon Wunderlich 
30623d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT
3063d3236553SJohannes Berg 	/* wext data */
3064cbe8fa9cSJohannes Berg 	struct {
3065cbe8fa9cSJohannes Berg 		struct cfg80211_ibss_params ibss;
3066f2129354SJohannes Berg 		struct cfg80211_connect_params connect;
3067fffd0934SJohannes Berg 		struct cfg80211_cached_keys *keys;
3068f2129354SJohannes Berg 		u8 *ie;
3069f2129354SJohannes Berg 		size_t ie_len;
3070f401a6f7SJohannes Berg 		u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN];
3071f2129354SJohannes Berg 		u8 ssid[IEEE80211_MAX_SSID_LEN];
307208645126SJohannes Berg 		s8 default_key, default_mgmt_key;
3073ffb9eb3dSKalle Valo 		bool prev_bssid_valid;
3074cbe8fa9cSJohannes Berg 	} wext;
3075d3236553SJohannes Berg #endif
3076d3236553SJohannes Berg };
3077d3236553SJohannes Berg 
307898104fdeSJohannes Berg static inline u8 *wdev_address(struct wireless_dev *wdev)
307998104fdeSJohannes Berg {
308098104fdeSJohannes Berg 	if (wdev->netdev)
308198104fdeSJohannes Berg 		return wdev->netdev->dev_addr;
308298104fdeSJohannes Berg 	return wdev->address;
308398104fdeSJohannes Berg }
308498104fdeSJohannes Berg 
3085d3236553SJohannes Berg /**
3086d3236553SJohannes Berg  * wdev_priv - return wiphy priv from wireless_dev
3087d3236553SJohannes Berg  *
3088d3236553SJohannes Berg  * @wdev: The wireless device whose wiphy's priv pointer to return
30890ae997dcSYacine Belkadi  * Return: The wiphy priv of @wdev.
3090d3236553SJohannes Berg  */
3091d3236553SJohannes Berg static inline void *wdev_priv(struct wireless_dev *wdev)
3092d3236553SJohannes Berg {
3093d3236553SJohannes Berg 	BUG_ON(!wdev);
3094d3236553SJohannes Berg 	return wiphy_priv(wdev->wiphy);
3095d3236553SJohannes Berg }
3096d3236553SJohannes Berg 
3097d70e9693SJohannes Berg /**
3098d70e9693SJohannes Berg  * DOC: Utility functions
3099d70e9693SJohannes Berg  *
3100d70e9693SJohannes Berg  * cfg80211 offers a number of utility functions that can be useful.
3101d3236553SJohannes Berg  */
3102d3236553SJohannes Berg 
3103d3236553SJohannes Berg /**
3104d3236553SJohannes Berg  * ieee80211_channel_to_frequency - convert channel number to frequency
3105abe37c4bSJohannes Berg  * @chan: channel number
310659eb21a6SBruno Randolf  * @band: band, necessary due to channel number overlap
31070ae997dcSYacine Belkadi  * Return: The corresponding frequency (in MHz), or 0 if the conversion failed.
3108d3236553SJohannes Berg  */
310959eb21a6SBruno Randolf extern int ieee80211_channel_to_frequency(int chan, enum ieee80211_band band);
3110d3236553SJohannes Berg 
3111d3236553SJohannes Berg /**
3112d3236553SJohannes Berg  * ieee80211_frequency_to_channel - convert frequency to channel number
3113abe37c4bSJohannes Berg  * @freq: center frequency
31140ae997dcSYacine Belkadi  * Return: The corresponding channel, or 0 if the conversion failed.
3115d3236553SJohannes Berg  */
3116d3236553SJohannes Berg extern int ieee80211_frequency_to_channel(int freq);
3117d3236553SJohannes Berg 
3118d3236553SJohannes Berg /*
3119d3236553SJohannes Berg  * Name indirection necessary because the ieee80211 code also has
3120d3236553SJohannes Berg  * a function named "ieee80211_get_channel", so if you include
3121d3236553SJohannes Berg  * cfg80211's header file you get cfg80211's version, if you try
3122d3236553SJohannes Berg  * to include both header files you'll (rightfully!) get a symbol
3123d3236553SJohannes Berg  * clash.
3124d3236553SJohannes Berg  */
3125d3236553SJohannes Berg extern struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy,
3126d3236553SJohannes Berg 							 int freq);
3127d3236553SJohannes Berg /**
3128d3236553SJohannes Berg  * ieee80211_get_channel - get channel struct from wiphy for specified frequency
3129abe37c4bSJohannes Berg  * @wiphy: the struct wiphy to get the channel for
3130abe37c4bSJohannes Berg  * @freq: the center frequency of the channel
31310ae997dcSYacine Belkadi  * Return: The channel struct from @wiphy at @freq.
3132d3236553SJohannes Berg  */
3133d3236553SJohannes Berg static inline struct ieee80211_channel *
3134d3236553SJohannes Berg ieee80211_get_channel(struct wiphy *wiphy, int freq)
3135d3236553SJohannes Berg {
3136d3236553SJohannes Berg 	return __ieee80211_get_channel(wiphy, freq);
3137d3236553SJohannes Berg }
3138d3236553SJohannes Berg 
3139d3236553SJohannes Berg /**
3140d3236553SJohannes Berg  * ieee80211_get_response_rate - get basic rate for a given rate
3141d3236553SJohannes Berg  *
3142d3236553SJohannes Berg  * @sband: the band to look for rates in
3143d3236553SJohannes Berg  * @basic_rates: bitmap of basic rates
3144d3236553SJohannes Berg  * @bitrate: the bitrate for which to find the basic rate
3145d3236553SJohannes Berg  *
31460ae997dcSYacine Belkadi  * Return: The basic rate corresponding to a given bitrate, that
31470ae997dcSYacine Belkadi  * is the next lower bitrate contained in the basic rate map,
31480ae997dcSYacine Belkadi  * which is, for this function, given as a bitmap of indices of
31490ae997dcSYacine Belkadi  * rates in the band's bitrate table.
3150d3236553SJohannes Berg  */
3151d3236553SJohannes Berg struct ieee80211_rate *
3152d3236553SJohannes Berg ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
3153d3236553SJohannes Berg 			    u32 basic_rates, int bitrate);
3154d3236553SJohannes Berg 
3155b422c6cdSAshok Nagarajan /**
3156b422c6cdSAshok Nagarajan  * ieee80211_mandatory_rates - get mandatory rates for a given band
3157b422c6cdSAshok Nagarajan  * @sband: the band to look for rates in
315874608acaSSimon Wunderlich  * @scan_width: width of the control channel
3159b422c6cdSAshok Nagarajan  *
3160b422c6cdSAshok Nagarajan  * This function returns a bitmap of the mandatory rates for the given
3161b422c6cdSAshok Nagarajan  * band, bits are set according to the rate position in the bitrates array.
3162b422c6cdSAshok Nagarajan  */
316374608acaSSimon Wunderlich u32 ieee80211_mandatory_rates(struct ieee80211_supported_band *sband,
316474608acaSSimon Wunderlich 			      enum nl80211_bss_scan_width scan_width);
3165b422c6cdSAshok Nagarajan 
3166d3236553SJohannes Berg /*
3167d3236553SJohannes Berg  * Radiotap parsing functions -- for controlled injection support
3168d3236553SJohannes Berg  *
3169d3236553SJohannes Berg  * Implemented in net/wireless/radiotap.c
3170d3236553SJohannes Berg  * Documentation in Documentation/networking/radiotap-headers.txt
3171d3236553SJohannes Berg  */
3172d3236553SJohannes Berg 
317333e5a2f7SJohannes Berg struct radiotap_align_size {
317433e5a2f7SJohannes Berg 	uint8_t align:4, size:4;
317533e5a2f7SJohannes Berg };
317633e5a2f7SJohannes Berg 
317733e5a2f7SJohannes Berg struct ieee80211_radiotap_namespace {
317833e5a2f7SJohannes Berg 	const struct radiotap_align_size *align_size;
317933e5a2f7SJohannes Berg 	int n_bits;
318033e5a2f7SJohannes Berg 	uint32_t oui;
318133e5a2f7SJohannes Berg 	uint8_t subns;
318233e5a2f7SJohannes Berg };
318333e5a2f7SJohannes Berg 
318433e5a2f7SJohannes Berg struct ieee80211_radiotap_vendor_namespaces {
318533e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_namespace *ns;
318633e5a2f7SJohannes Berg 	int n_ns;
318733e5a2f7SJohannes Berg };
318833e5a2f7SJohannes Berg 
3189d3236553SJohannes Berg /**
3190d3236553SJohannes Berg  * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args
319133e5a2f7SJohannes Berg  * @this_arg_index: index of current arg, valid after each successful call
319233e5a2f7SJohannes Berg  *	to ieee80211_radiotap_iterator_next()
319333e5a2f7SJohannes Berg  * @this_arg: pointer to current radiotap arg; it is valid after each
319433e5a2f7SJohannes Berg  *	call to ieee80211_radiotap_iterator_next() but also after
319533e5a2f7SJohannes Berg  *	ieee80211_radiotap_iterator_init() where it will point to
319633e5a2f7SJohannes Berg  *	the beginning of the actual data portion
319733e5a2f7SJohannes Berg  * @this_arg_size: length of the current arg, for convenience
319833e5a2f7SJohannes Berg  * @current_namespace: pointer to the current namespace definition
319933e5a2f7SJohannes Berg  *	(or internally %NULL if the current namespace is unknown)
320033e5a2f7SJohannes Berg  * @is_radiotap_ns: indicates whether the current namespace is the default
320133e5a2f7SJohannes Berg  *	radiotap namespace or not
320233e5a2f7SJohannes Berg  *
320333e5a2f7SJohannes Berg  * @_rtheader: pointer to the radiotap header we are walking through
320433e5a2f7SJohannes Berg  * @_max_length: length of radiotap header in cpu byte ordering
320533e5a2f7SJohannes Berg  * @_arg_index: next argument index
320633e5a2f7SJohannes Berg  * @_arg: next argument pointer
320733e5a2f7SJohannes Berg  * @_next_bitmap: internal pointer to next present u32
320833e5a2f7SJohannes Berg  * @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present
320933e5a2f7SJohannes Berg  * @_vns: vendor namespace definitions
321033e5a2f7SJohannes Berg  * @_next_ns_data: beginning of the next namespace's data
321133e5a2f7SJohannes Berg  * @_reset_on_ext: internal; reset the arg index to 0 when going to the
321233e5a2f7SJohannes Berg  *	next bitmap word
321333e5a2f7SJohannes Berg  *
321433e5a2f7SJohannes Berg  * Describes the radiotap parser state. Fields prefixed with an underscore
321533e5a2f7SJohannes Berg  * must not be used by users of the parser, only by the parser internally.
3216d3236553SJohannes Berg  */
3217d3236553SJohannes Berg 
3218d3236553SJohannes Berg struct ieee80211_radiotap_iterator {
321933e5a2f7SJohannes Berg 	struct ieee80211_radiotap_header *_rtheader;
322033e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_vendor_namespaces *_vns;
322133e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_namespace *current_namespace;
3222d3236553SJohannes Berg 
322333e5a2f7SJohannes Berg 	unsigned char *_arg, *_next_ns_data;
322467272440SJohannes Berg 	__le32 *_next_bitmap;
322533e5a2f7SJohannes Berg 
322633e5a2f7SJohannes Berg 	unsigned char *this_arg;
322733e5a2f7SJohannes Berg 	int this_arg_index;
322833e5a2f7SJohannes Berg 	int this_arg_size;
322933e5a2f7SJohannes Berg 
323033e5a2f7SJohannes Berg 	int is_radiotap_ns;
323133e5a2f7SJohannes Berg 
323233e5a2f7SJohannes Berg 	int _max_length;
323333e5a2f7SJohannes Berg 	int _arg_index;
323433e5a2f7SJohannes Berg 	uint32_t _bitmap_shifter;
323533e5a2f7SJohannes Berg 	int _reset_on_ext;
3236d3236553SJohannes Berg };
3237d3236553SJohannes Berg 
3238d3236553SJohannes Berg extern int ieee80211_radiotap_iterator_init(
3239d3236553SJohannes Berg 	struct ieee80211_radiotap_iterator *iterator,
3240d3236553SJohannes Berg 	struct ieee80211_radiotap_header *radiotap_header,
324133e5a2f7SJohannes Berg 	int max_length, const struct ieee80211_radiotap_vendor_namespaces *vns);
3242d3236553SJohannes Berg 
3243d3236553SJohannes Berg extern int ieee80211_radiotap_iterator_next(
3244d3236553SJohannes Berg 	struct ieee80211_radiotap_iterator *iterator);
3245d3236553SJohannes Berg 
324633e5a2f7SJohannes Berg 
3247e31a16d6SZhu Yi extern const unsigned char rfc1042_header[6];
3248e31a16d6SZhu Yi extern const unsigned char bridge_tunnel_header[6];
3249e31a16d6SZhu Yi 
3250e31a16d6SZhu Yi /**
3251e31a16d6SZhu Yi  * ieee80211_get_hdrlen_from_skb - get header length from data
3252e31a16d6SZhu Yi  *
3253e31a16d6SZhu Yi  * @skb: the frame
32540ae997dcSYacine Belkadi  *
32550ae997dcSYacine Belkadi  * Given an skb with a raw 802.11 header at the data pointer this function
32560ae997dcSYacine Belkadi  * returns the 802.11 header length.
32570ae997dcSYacine Belkadi  *
32580ae997dcSYacine Belkadi  * Return: The 802.11 header length in bytes (not including encryption
32590ae997dcSYacine Belkadi  * headers). Or 0 if the data in the sk_buff is too short to contain a valid
32600ae997dcSYacine Belkadi  * 802.11 header.
3261e31a16d6SZhu Yi  */
3262e31a16d6SZhu Yi unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb);
3263e31a16d6SZhu Yi 
3264e31a16d6SZhu Yi /**
3265e31a16d6SZhu Yi  * ieee80211_hdrlen - get header length in bytes from frame control
3266e31a16d6SZhu Yi  * @fc: frame control field in little-endian format
32670ae997dcSYacine Belkadi  * Return: The header length in bytes.
3268e31a16d6SZhu Yi  */
3269633adf1aSJohannes Berg unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc);
3270e31a16d6SZhu Yi 
3271e31a16d6SZhu Yi /**
32729b395bc3SJohannes Berg  * ieee80211_get_mesh_hdrlen - get mesh extension header length
32739b395bc3SJohannes Berg  * @meshhdr: the mesh extension header, only the flags field
32749b395bc3SJohannes Berg  *	(first byte) will be accessed
32750ae997dcSYacine Belkadi  * Return: The length of the extension header, which is always at
32769b395bc3SJohannes Berg  * least 6 bytes and at most 18 if address 5 and 6 are present.
32779b395bc3SJohannes Berg  */
32789b395bc3SJohannes Berg unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr);
32799b395bc3SJohannes Berg 
32809b395bc3SJohannes Berg /**
3281d70e9693SJohannes Berg  * DOC: Data path helpers
3282d70e9693SJohannes Berg  *
3283d70e9693SJohannes Berg  * In addition to generic utilities, cfg80211 also offers
3284d70e9693SJohannes Berg  * functions that help implement the data path for devices
3285d70e9693SJohannes Berg  * that do not do the 802.11/802.3 conversion on the device.
3286d70e9693SJohannes Berg  */
3287d70e9693SJohannes Berg 
3288d70e9693SJohannes Berg /**
3289e31a16d6SZhu Yi  * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3
3290e31a16d6SZhu Yi  * @skb: the 802.11 data frame
3291e31a16d6SZhu Yi  * @addr: the device MAC address
3292e31a16d6SZhu Yi  * @iftype: the virtual interface type
32930ae997dcSYacine Belkadi  * Return: 0 on success. Non-zero on error.
3294e31a16d6SZhu Yi  */
3295eaf85ca7SZhu Yi int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
3296e31a16d6SZhu Yi 			   enum nl80211_iftype iftype);
3297e31a16d6SZhu Yi 
3298e31a16d6SZhu Yi /**
3299e31a16d6SZhu Yi  * ieee80211_data_from_8023 - convert an 802.3 frame to 802.11
3300e31a16d6SZhu Yi  * @skb: the 802.3 frame
3301e31a16d6SZhu Yi  * @addr: the device MAC address
3302e31a16d6SZhu Yi  * @iftype: the virtual interface type
3303e31a16d6SZhu Yi  * @bssid: the network bssid (used only for iftype STATION and ADHOC)
3304e31a16d6SZhu Yi  * @qos: build 802.11 QoS data frame
33050ae997dcSYacine Belkadi  * Return: 0 on success, or a negative error code.
3306e31a16d6SZhu Yi  */
3307eaf85ca7SZhu Yi int ieee80211_data_from_8023(struct sk_buff *skb, const u8 *addr,
3308e31a16d6SZhu Yi 			     enum nl80211_iftype iftype, u8 *bssid, bool qos);
3309e31a16d6SZhu Yi 
3310e31a16d6SZhu Yi /**
3311eaf85ca7SZhu Yi  * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame
3312eaf85ca7SZhu Yi  *
3313eaf85ca7SZhu Yi  * Decode an IEEE 802.11n A-MSDU frame and convert it to a list of
3314eaf85ca7SZhu Yi  * 802.3 frames. The @list will be empty if the decode fails. The
3315eaf85ca7SZhu Yi  * @skb is consumed after the function returns.
3316eaf85ca7SZhu Yi  *
3317eaf85ca7SZhu Yi  * @skb: The input IEEE 802.11n A-MSDU frame.
3318eaf85ca7SZhu Yi  * @list: The output list of 802.3 frames. It must be allocated and
3319eaf85ca7SZhu Yi  *	initialized by by the caller.
3320eaf85ca7SZhu Yi  * @addr: The device MAC address.
3321eaf85ca7SZhu Yi  * @iftype: The device interface type.
3322eaf85ca7SZhu Yi  * @extra_headroom: The hardware extra headroom for SKBs in the @list.
33238b3becadSYogesh Ashok Powar  * @has_80211_header: Set it true if SKB is with IEEE 802.11 header.
3324eaf85ca7SZhu Yi  */
3325eaf85ca7SZhu Yi void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,
3326eaf85ca7SZhu Yi 			      const u8 *addr, enum nl80211_iftype iftype,
33278b3becadSYogesh Ashok Powar 			      const unsigned int extra_headroom,
33288b3becadSYogesh Ashok Powar 			      bool has_80211_header);
3329eaf85ca7SZhu Yi 
3330eaf85ca7SZhu Yi /**
3331e31a16d6SZhu Yi  * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame
3332e31a16d6SZhu Yi  * @skb: the data frame
33330ae997dcSYacine Belkadi  * Return: The 802.1p/1d tag.
3334e31a16d6SZhu Yi  */
3335e31a16d6SZhu Yi unsigned int cfg80211_classify8021d(struct sk_buff *skb);
3336e31a16d6SZhu Yi 
3337c21dbf92SJohannes Berg /**
3338c21dbf92SJohannes Berg  * cfg80211_find_ie - find information element in data
3339c21dbf92SJohannes Berg  *
3340c21dbf92SJohannes Berg  * @eid: element ID
3341c21dbf92SJohannes Berg  * @ies: data consisting of IEs
3342c21dbf92SJohannes Berg  * @len: length of data
3343c21dbf92SJohannes Berg  *
33440ae997dcSYacine Belkadi  * Return: %NULL if the element ID could not be found or if
33450ae997dcSYacine Belkadi  * the element is invalid (claims to be longer than the given
33460ae997dcSYacine Belkadi  * data), or a pointer to the first byte of the requested
33470ae997dcSYacine Belkadi  * element, that is the byte containing the element ID.
33480ae997dcSYacine Belkadi  *
33490ae997dcSYacine Belkadi  * Note: There are no checks on the element length other than
33500ae997dcSYacine Belkadi  * having to fit into the given data.
3351c21dbf92SJohannes Berg  */
3352c21dbf92SJohannes Berg const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len);
3353c21dbf92SJohannes Berg 
3354d70e9693SJohannes Berg /**
33550c28ec58SEliad Peller  * cfg80211_find_vendor_ie - find vendor specific information element in data
33560c28ec58SEliad Peller  *
33570c28ec58SEliad Peller  * @oui: vendor OUI
33580c28ec58SEliad Peller  * @oui_type: vendor-specific OUI type
33590c28ec58SEliad Peller  * @ies: data consisting of IEs
33600c28ec58SEliad Peller  * @len: length of data
33610c28ec58SEliad Peller  *
33620ae997dcSYacine Belkadi  * Return: %NULL if the vendor specific element ID could not be found or if the
33630ae997dcSYacine Belkadi  * element is invalid (claims to be longer than the given data), or a pointer to
33640ae997dcSYacine Belkadi  * the first byte of the requested element, that is the byte containing the
33650ae997dcSYacine Belkadi  * element ID.
33660ae997dcSYacine Belkadi  *
33670ae997dcSYacine Belkadi  * Note: There are no checks on the element length other than having to fit into
33680ae997dcSYacine Belkadi  * the given data.
33690c28ec58SEliad Peller  */
33700c28ec58SEliad Peller const u8 *cfg80211_find_vendor_ie(unsigned int oui, u8 oui_type,
33710c28ec58SEliad Peller 				  const u8 *ies, int len);
33720c28ec58SEliad Peller 
33730c28ec58SEliad Peller /**
3374d70e9693SJohannes Berg  * DOC: Regulatory enforcement infrastructure
3375d70e9693SJohannes Berg  *
3376d70e9693SJohannes Berg  * TODO
3377d3236553SJohannes Berg  */
3378d3236553SJohannes Berg 
3379d3236553SJohannes Berg /**
3380d3236553SJohannes Berg  * regulatory_hint - driver hint to the wireless core a regulatory domain
3381d3236553SJohannes Berg  * @wiphy: the wireless device giving the hint (used only for reporting
3382d3236553SJohannes Berg  *	conflicts)
3383d3236553SJohannes Berg  * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain
3384d3236553SJohannes Berg  * 	should be in. If @rd is set this should be NULL. Note that if you
3385d3236553SJohannes Berg  * 	set this to NULL you should still set rd->alpha2 to some accepted
3386d3236553SJohannes Berg  * 	alpha2.
3387d3236553SJohannes Berg  *
3388d3236553SJohannes Berg  * Wireless drivers can use this function to hint to the wireless core
3389d3236553SJohannes Berg  * what it believes should be the current regulatory domain by
3390d3236553SJohannes Berg  * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory
3391d3236553SJohannes Berg  * domain should be in or by providing a completely build regulatory domain.
3392d3236553SJohannes Berg  * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried
3393d3236553SJohannes Berg  * for a regulatory domain structure for the respective country.
3394d3236553SJohannes Berg  *
3395d3236553SJohannes Berg  * The wiphy must have been registered to cfg80211 prior to this call.
3396d3236553SJohannes Berg  * For cfg80211 drivers this means you must first use wiphy_register(),
3397d3236553SJohannes Berg  * for mac80211 drivers you must first use ieee80211_register_hw().
3398d3236553SJohannes Berg  *
3399d3236553SJohannes Berg  * Drivers should check the return value, its possible you can get
3400d3236553SJohannes Berg  * an -ENOMEM.
34010ae997dcSYacine Belkadi  *
34020ae997dcSYacine Belkadi  * Return: 0 on success. -ENOMEM.
3403d3236553SJohannes Berg  */
3404d3236553SJohannes Berg extern int regulatory_hint(struct wiphy *wiphy, const char *alpha2);
3405d3236553SJohannes Berg 
3406d3236553SJohannes Berg /**
3407d3236553SJohannes Berg  * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain
3408d3236553SJohannes Berg  * @wiphy: the wireless device we want to process the regulatory domain on
3409d3236553SJohannes Berg  * @regd: the custom regulatory domain to use for this wiphy
3410d3236553SJohannes Berg  *
3411d3236553SJohannes Berg  * Drivers can sometimes have custom regulatory domains which do not apply
3412d3236553SJohannes Berg  * to a specific country. Drivers can use this to apply such custom regulatory
3413d3236553SJohannes Berg  * domains. This routine must be called prior to wiphy registration. The
3414d3236553SJohannes Berg  * custom regulatory domain will be trusted completely and as such previous
3415d3236553SJohannes Berg  * default channel settings will be disregarded. If no rule is found for a
3416d3236553SJohannes Berg  * channel on the regulatory domain the channel will be disabled.
3417d3236553SJohannes Berg  */
3418d3236553SJohannes Berg extern void wiphy_apply_custom_regulatory(
3419d3236553SJohannes Berg 	struct wiphy *wiphy,
3420d3236553SJohannes Berg 	const struct ieee80211_regdomain *regd);
3421d3236553SJohannes Berg 
3422d3236553SJohannes Berg /**
3423d3236553SJohannes Berg  * freq_reg_info - get regulatory information for the given frequency
3424d3236553SJohannes Berg  * @wiphy: the wiphy for which we want to process this rule for
3425d3236553SJohannes Berg  * @center_freq: Frequency in KHz for which we want regulatory information for
3426d3236553SJohannes Berg  *
3427d3236553SJohannes Berg  * Use this function to get the regulatory rule for a specific frequency on
3428d3236553SJohannes Berg  * a given wireless device. If the device has a specific regulatory domain
3429d3236553SJohannes Berg  * it wants to follow we respect that unless a country IE has been received
3430d3236553SJohannes Berg  * and processed already.
3431d3236553SJohannes Berg  *
34320ae997dcSYacine Belkadi  * Return: A valid pointer, or, when an error occurs, for example if no rule
34330ae997dcSYacine Belkadi  * can be found, the return value is encoded using ERR_PTR(). Use IS_ERR() to
34340ae997dcSYacine Belkadi  * check and PTR_ERR() to obtain the numeric return value. The numeric return
34350ae997dcSYacine Belkadi  * value will be -ERANGE if we determine the given center_freq does not even
34360ae997dcSYacine Belkadi  * have a regulatory rule for a frequency range in the center_freq's band.
34370ae997dcSYacine Belkadi  * See freq_in_rule_band() for our current definition of a band -- this is
34380ae997dcSYacine Belkadi  * purely subjective and right now it's 802.11 specific.
3439d3236553SJohannes Berg  */
3440361c9c8bSJohannes Berg const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy,
3441361c9c8bSJohannes Berg 					       u32 center_freq);
3442d3236553SJohannes Berg 
3443d3236553SJohannes Berg /*
3444d3236553SJohannes Berg  * callbacks for asynchronous cfg80211 methods, notification
3445d3236553SJohannes Berg  * functions and BSS handling helpers
3446d3236553SJohannes Berg  */
3447d3236553SJohannes Berg 
34482a519311SJohannes Berg /**
34492a519311SJohannes Berg  * cfg80211_scan_done - notify that scan finished
34502a519311SJohannes Berg  *
34512a519311SJohannes Berg  * @request: the corresponding scan request
34522a519311SJohannes Berg  * @aborted: set to true if the scan was aborted for any reason,
34532a519311SJohannes Berg  *	userspace will be notified of that
34542a519311SJohannes Berg  */
34552a519311SJohannes Berg void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted);
34562a519311SJohannes Berg 
34572a519311SJohannes Berg /**
3458807f8a8cSLuciano Coelho  * cfg80211_sched_scan_results - notify that new scan results are available
3459807f8a8cSLuciano Coelho  *
3460807f8a8cSLuciano Coelho  * @wiphy: the wiphy which got scheduled scan results
3461807f8a8cSLuciano Coelho  */
3462807f8a8cSLuciano Coelho void cfg80211_sched_scan_results(struct wiphy *wiphy);
3463807f8a8cSLuciano Coelho 
3464807f8a8cSLuciano Coelho /**
3465807f8a8cSLuciano Coelho  * cfg80211_sched_scan_stopped - notify that the scheduled scan has stopped
3466807f8a8cSLuciano Coelho  *
3467807f8a8cSLuciano Coelho  * @wiphy: the wiphy on which the scheduled scan stopped
3468807f8a8cSLuciano Coelho  *
3469807f8a8cSLuciano Coelho  * The driver can call this function to inform cfg80211 that the
3470807f8a8cSLuciano Coelho  * scheduled scan had to be stopped, for whatever reason.  The driver
3471807f8a8cSLuciano Coelho  * is then called back via the sched_scan_stop operation when done.
3472807f8a8cSLuciano Coelho  */
3473807f8a8cSLuciano Coelho void cfg80211_sched_scan_stopped(struct wiphy *wiphy);
3474807f8a8cSLuciano Coelho 
3475807f8a8cSLuciano Coelho /**
3476dcd6eac1SSimon Wunderlich  * cfg80211_inform_bss_width_frame - inform cfg80211 of a received BSS frame
34772a519311SJohannes Berg  *
34782a519311SJohannes Berg  * @wiphy: the wiphy reporting the BSS
3479abe37c4bSJohannes Berg  * @channel: The channel the frame was received on
3480dcd6eac1SSimon Wunderlich  * @scan_width: width of the control channel
3481abe37c4bSJohannes Berg  * @mgmt: the management frame (probe response or beacon)
3482abe37c4bSJohannes Berg  * @len: length of the management frame
348377965c97SJohannes Berg  * @signal: the signal strength, type depends on the wiphy's signal_type
34842a519311SJohannes Berg  * @gfp: context flags
34852a519311SJohannes Berg  *
34862a519311SJohannes Berg  * This informs cfg80211 that BSS information was found and
34872a519311SJohannes Berg  * the BSS should be updated/added.
3488ef100682SJohannes Berg  *
34890ae997dcSYacine Belkadi  * Return: A referenced struct, must be released with cfg80211_put_bss()!
34900ae997dcSYacine Belkadi  * Or %NULL on error.
34912a519311SJohannes Berg  */
3492ef100682SJohannes Berg struct cfg80211_bss * __must_check
3493dcd6eac1SSimon Wunderlich cfg80211_inform_bss_width_frame(struct wiphy *wiphy,
3494dcd6eac1SSimon Wunderlich 				struct ieee80211_channel *channel,
3495dcd6eac1SSimon Wunderlich 				enum nl80211_bss_scan_width scan_width,
3496dcd6eac1SSimon Wunderlich 				struct ieee80211_mgmt *mgmt, size_t len,
3497dcd6eac1SSimon Wunderlich 				s32 signal, gfp_t gfp);
3498dcd6eac1SSimon Wunderlich 
3499dcd6eac1SSimon Wunderlich static inline struct cfg80211_bss * __must_check
35002a519311SJohannes Berg cfg80211_inform_bss_frame(struct wiphy *wiphy,
35012a519311SJohannes Berg 			  struct ieee80211_channel *channel,
35022a519311SJohannes Berg 			  struct ieee80211_mgmt *mgmt, size_t len,
3503dcd6eac1SSimon Wunderlich 			  s32 signal, gfp_t gfp)
3504dcd6eac1SSimon Wunderlich {
3505dcd6eac1SSimon Wunderlich 	return cfg80211_inform_bss_width_frame(wiphy, channel,
3506dcd6eac1SSimon Wunderlich 					       NL80211_BSS_CHAN_WIDTH_20,
3507dcd6eac1SSimon Wunderlich 					       mgmt, len, signal, gfp);
3508dcd6eac1SSimon Wunderlich }
35092a519311SJohannes Berg 
3510abe37c4bSJohannes Berg /**
3511abe37c4bSJohannes Berg  * cfg80211_inform_bss - inform cfg80211 of a new BSS
3512abe37c4bSJohannes Berg  *
3513abe37c4bSJohannes Berg  * @wiphy: the wiphy reporting the BSS
3514abe37c4bSJohannes Berg  * @channel: The channel the frame was received on
3515dcd6eac1SSimon Wunderlich  * @scan_width: width of the control channel
3516abe37c4bSJohannes Berg  * @bssid: the BSSID of the BSS
35177b8bcff2SJohannes Berg  * @tsf: the TSF sent by the peer in the beacon/probe response (or 0)
3518abe37c4bSJohannes Berg  * @capability: the capability field sent by the peer
3519abe37c4bSJohannes Berg  * @beacon_interval: the beacon interval announced by the peer
3520abe37c4bSJohannes Berg  * @ie: additional IEs sent by the peer
3521abe37c4bSJohannes Berg  * @ielen: length of the additional IEs
3522abe37c4bSJohannes Berg  * @signal: the signal strength, type depends on the wiphy's signal_type
3523abe37c4bSJohannes Berg  * @gfp: context flags
3524abe37c4bSJohannes Berg  *
3525abe37c4bSJohannes Berg  * This informs cfg80211 that BSS information was found and
3526abe37c4bSJohannes Berg  * the BSS should be updated/added.
3527ef100682SJohannes Berg  *
35280ae997dcSYacine Belkadi  * Return: A referenced struct, must be released with cfg80211_put_bss()!
35290ae997dcSYacine Belkadi  * Or %NULL on error.
3530abe37c4bSJohannes Berg  */
3531ef100682SJohannes Berg struct cfg80211_bss * __must_check
3532dcd6eac1SSimon Wunderlich cfg80211_inform_bss_width(struct wiphy *wiphy,
3533dcd6eac1SSimon Wunderlich 			  struct ieee80211_channel *channel,
3534dcd6eac1SSimon Wunderlich 			  enum nl80211_bss_scan_width scan_width,
3535dcd6eac1SSimon Wunderlich 			  const u8 *bssid, u64 tsf, u16 capability,
3536dcd6eac1SSimon Wunderlich 			  u16 beacon_interval, const u8 *ie, size_t ielen,
3537dcd6eac1SSimon Wunderlich 			  s32 signal, gfp_t gfp);
3538dcd6eac1SSimon Wunderlich 
3539dcd6eac1SSimon Wunderlich static inline struct cfg80211_bss * __must_check
354006aa7afaSJussi Kivilinna cfg80211_inform_bss(struct wiphy *wiphy,
354106aa7afaSJussi Kivilinna 		    struct ieee80211_channel *channel,
35427b8bcff2SJohannes Berg 		    const u8 *bssid, u64 tsf, u16 capability,
35437b8bcff2SJohannes Berg 		    u16 beacon_interval, const u8 *ie, size_t ielen,
3544dcd6eac1SSimon Wunderlich 		    s32 signal, gfp_t gfp)
3545dcd6eac1SSimon Wunderlich {
3546dcd6eac1SSimon Wunderlich 	return cfg80211_inform_bss_width(wiphy, channel,
3547dcd6eac1SSimon Wunderlich 					 NL80211_BSS_CHAN_WIDTH_20,
3548dcd6eac1SSimon Wunderlich 					 bssid, tsf, capability,
3549dcd6eac1SSimon Wunderlich 					 beacon_interval, ie, ielen, signal,
3550dcd6eac1SSimon Wunderlich 					 gfp);
3551dcd6eac1SSimon Wunderlich }
355206aa7afaSJussi Kivilinna 
35532a519311SJohannes Berg struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
35542a519311SJohannes Berg 				      struct ieee80211_channel *channel,
35552a519311SJohannes Berg 				      const u8 *bssid,
355679420f09SJohannes Berg 				      const u8 *ssid, size_t ssid_len,
355779420f09SJohannes Berg 				      u16 capa_mask, u16 capa_val);
355879420f09SJohannes Berg static inline struct cfg80211_bss *
355979420f09SJohannes Berg cfg80211_get_ibss(struct wiphy *wiphy,
356079420f09SJohannes Berg 		  struct ieee80211_channel *channel,
356179420f09SJohannes Berg 		  const u8 *ssid, size_t ssid_len)
356279420f09SJohannes Berg {
356379420f09SJohannes Berg 	return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len,
356479420f09SJohannes Berg 				WLAN_CAPABILITY_IBSS, WLAN_CAPABILITY_IBSS);
356579420f09SJohannes Berg }
356679420f09SJohannes Berg 
35674c0c0b75SJohannes Berg /**
35684c0c0b75SJohannes Berg  * cfg80211_ref_bss - reference BSS struct
35695b112d3dSJohannes Berg  * @wiphy: the wiphy this BSS struct belongs to
35704c0c0b75SJohannes Berg  * @bss: the BSS struct to reference
35714c0c0b75SJohannes Berg  *
35724c0c0b75SJohannes Berg  * Increments the refcount of the given BSS struct.
35734c0c0b75SJohannes Berg  */
35745b112d3dSJohannes Berg void cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
35754c0c0b75SJohannes Berg 
35764c0c0b75SJohannes Berg /**
35774c0c0b75SJohannes Berg  * cfg80211_put_bss - unref BSS struct
35785b112d3dSJohannes Berg  * @wiphy: the wiphy this BSS struct belongs to
35794c0c0b75SJohannes Berg  * @bss: the BSS struct
35804c0c0b75SJohannes Berg  *
35814c0c0b75SJohannes Berg  * Decrements the refcount of the given BSS struct.
35824c0c0b75SJohannes Berg  */
35835b112d3dSJohannes Berg void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
3584d3236553SJohannes Berg 
3585d491af19SJohannes Berg /**
3586d491af19SJohannes Berg  * cfg80211_unlink_bss - unlink BSS from internal data structures
3587d491af19SJohannes Berg  * @wiphy: the wiphy
3588d491af19SJohannes Berg  * @bss: the bss to remove
3589d491af19SJohannes Berg  *
3590d491af19SJohannes Berg  * This function removes the given BSS from the internal data structures
3591d491af19SJohannes Berg  * thereby making it no longer show up in scan results etc. Use this
3592d491af19SJohannes Berg  * function when you detect a BSS is gone. Normally BSSes will also time
3593d491af19SJohannes Berg  * out, so it is not necessary to use this function at all.
3594d491af19SJohannes Berg  */
3595d491af19SJohannes Berg void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
3596fee52678SJohannes Berg 
3597dcd6eac1SSimon Wunderlich static inline enum nl80211_bss_scan_width
3598dcd6eac1SSimon Wunderlich cfg80211_chandef_to_scan_width(const struct cfg80211_chan_def *chandef)
3599dcd6eac1SSimon Wunderlich {
3600dcd6eac1SSimon Wunderlich 	switch (chandef->width) {
3601dcd6eac1SSimon Wunderlich 	case NL80211_CHAN_WIDTH_5:
3602dcd6eac1SSimon Wunderlich 		return NL80211_BSS_CHAN_WIDTH_5;
3603dcd6eac1SSimon Wunderlich 	case NL80211_CHAN_WIDTH_10:
3604dcd6eac1SSimon Wunderlich 		return NL80211_BSS_CHAN_WIDTH_10;
3605dcd6eac1SSimon Wunderlich 	default:
3606dcd6eac1SSimon Wunderlich 		return NL80211_BSS_CHAN_WIDTH_20;
3607dcd6eac1SSimon Wunderlich 	}
3608dcd6eac1SSimon Wunderlich }
3609dcd6eac1SSimon Wunderlich 
36106039f6d2SJouni Malinen /**
36116ff57cf8SJohannes Berg  * cfg80211_rx_mlme_mgmt - notification of processed MLME management frame
36126039f6d2SJouni Malinen  * @dev: network device
36136039f6d2SJouni Malinen  * @buf: authentication frame (header + body)
36146039f6d2SJouni Malinen  * @len: length of the frame data
36156039f6d2SJouni Malinen  *
36166ff57cf8SJohannes Berg  * This function is called whenever an authentication, disassociation or
36176ff57cf8SJohannes Berg  * deauthentication frame has been received and processed in station mode.
36186ff57cf8SJohannes Berg  * After being asked to authenticate via cfg80211_ops::auth() the driver must
36196ff57cf8SJohannes Berg  * call either this function or cfg80211_auth_timeout().
36206ff57cf8SJohannes Berg  * After being asked to associate via cfg80211_ops::assoc() the driver must
36216ff57cf8SJohannes Berg  * call either this function or cfg80211_auth_timeout().
36226ff57cf8SJohannes Berg  * While connected, the driver must calls this for received and processed
36236ff57cf8SJohannes Berg  * disassociation and deauthentication frames. If the frame couldn't be used
36246ff57cf8SJohannes Berg  * because it was unprotected, the driver must call the function
36256ff57cf8SJohannes Berg  * cfg80211_rx_unprot_mlme_mgmt() instead.
36266ff57cf8SJohannes Berg  *
36276ff57cf8SJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's mutex.
36286039f6d2SJouni Malinen  */
36296ff57cf8SJohannes Berg void cfg80211_rx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len);
36306039f6d2SJouni Malinen 
36316039f6d2SJouni Malinen /**
36326ff57cf8SJohannes Berg  * cfg80211_auth_timeout - notification of timed out authentication
36331965c853SJouni Malinen  * @dev: network device
36341965c853SJouni Malinen  * @addr: The MAC address of the device with which the authentication timed out
3635cb0b4bebSJohannes Berg  *
36368d61ffa5SJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's
36378d61ffa5SJohannes Berg  * mutex.
36381965c853SJouni Malinen  */
36396ff57cf8SJohannes Berg void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr);
36401965c853SJouni Malinen 
36411965c853SJouni Malinen /**
36426ff57cf8SJohannes Berg  * cfg80211_rx_assoc_resp - notification of processed association response
36436039f6d2SJouni Malinen  * @dev: network device
36446ff57cf8SJohannes Berg  * @bss: the BSS that association was requested with, ownership of the pointer
36456ff57cf8SJohannes Berg  *	moves to cfg80211 in this call
36466ff57cf8SJohannes Berg  * @buf: authentication frame (header + body)
36476039f6d2SJouni Malinen  * @len: length of the frame data
36486039f6d2SJouni Malinen  *
36496ff57cf8SJohannes Berg  * After being asked to associate via cfg80211_ops::assoc() the driver must
36506ff57cf8SJohannes Berg  * call either this function or cfg80211_auth_timeout().
36516ff57cf8SJohannes Berg  *
36526ff57cf8SJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's mutex.
36536039f6d2SJouni Malinen  */
36546ff57cf8SJohannes Berg void cfg80211_rx_assoc_resp(struct net_device *dev,
36556ff57cf8SJohannes Berg 			    struct cfg80211_bss *bss,
365695de817bSJohannes Berg 			    const u8 *buf, size_t len);
36576039f6d2SJouni Malinen 
36586039f6d2SJouni Malinen /**
36596ff57cf8SJohannes Berg  * cfg80211_assoc_timeout - notification of timed out association
36601965c853SJouni Malinen  * @dev: network device
3661959867faSJohannes Berg  * @bss: The BSS entry with which association timed out.
3662cb0b4bebSJohannes Berg  *
36638d61ffa5SJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's mutex.
36641965c853SJouni Malinen  */
3665959867faSJohannes Berg void cfg80211_assoc_timeout(struct net_device *dev, struct cfg80211_bss *bss);
36661965c853SJouni Malinen 
36671965c853SJouni Malinen /**
36686ff57cf8SJohannes Berg  * cfg80211_tx_mlme_mgmt - notification of transmitted deauth/disassoc frame
36696039f6d2SJouni Malinen  * @dev: network device
36706ff57cf8SJohannes Berg  * @buf: 802.11 frame (header + body)
36716039f6d2SJouni Malinen  * @len: length of the frame data
36726039f6d2SJouni Malinen  *
36736039f6d2SJouni Malinen  * This function is called whenever deauthentication has been processed in
367453b46b84SJouni Malinen  * station mode. This includes both received deauthentication frames and
36758d61ffa5SJohannes Berg  * locally generated ones. This function may sleep. The caller must hold the
36768d61ffa5SJohannes Berg  * corresponding wdev's mutex.
36776039f6d2SJouni Malinen  */
36786ff57cf8SJohannes Berg void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len);
3679ce470613SHolger Schurig 
3680ce470613SHolger Schurig /**
36816ff57cf8SJohannes Berg  * cfg80211_rx_unprot_mlme_mgmt - notification of unprotected mlme mgmt frame
3682cf4e594eSJouni Malinen  * @dev: network device
3683cf4e594eSJouni Malinen  * @buf: deauthentication frame (header + body)
3684cf4e594eSJouni Malinen  * @len: length of the frame data
3685cf4e594eSJouni Malinen  *
36866ff57cf8SJohannes Berg  * This function is called whenever a received deauthentication or dissassoc
36876ff57cf8SJohannes Berg  * frame has been dropped in station mode because of MFP being used but the
3688cf4e594eSJouni Malinen  * frame was not protected. This function may sleep.
3689cf4e594eSJouni Malinen  */
36906ff57cf8SJohannes Berg void cfg80211_rx_unprot_mlme_mgmt(struct net_device *dev,
36916ff57cf8SJohannes Berg 				  const u8 *buf, size_t len);
3692cf4e594eSJouni Malinen 
3693cf4e594eSJouni Malinen /**
3694a3b8b056SJouni Malinen  * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP)
3695a3b8b056SJouni Malinen  * @dev: network device
3696a3b8b056SJouni Malinen  * @addr: The source MAC address of the frame
3697a3b8b056SJouni Malinen  * @key_type: The key type that the received frame used
3698a66b98dbSArik Nemtsov  * @key_id: Key identifier (0..3). Can be -1 if missing.
3699a3b8b056SJouni Malinen  * @tsc: The TSC value of the frame that generated the MIC failure (6 octets)
3700e6d6e342SJohannes Berg  * @gfp: allocation flags
3701a3b8b056SJouni Malinen  *
3702a3b8b056SJouni Malinen  * This function is called whenever the local MAC detects a MIC failure in a
3703a3b8b056SJouni Malinen  * received frame. This matches with MLME-MICHAELMICFAILURE.indication()
3704a3b8b056SJouni Malinen  * primitive.
3705a3b8b056SJouni Malinen  */
3706a3b8b056SJouni Malinen void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,
3707a3b8b056SJouni Malinen 				  enum nl80211_key_type key_type, int key_id,
3708e6d6e342SJohannes Berg 				  const u8 *tsc, gfp_t gfp);
3709a3b8b056SJouni Malinen 
371004a773adSJohannes Berg /**
371104a773adSJohannes Berg  * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS
371204a773adSJohannes Berg  *
371304a773adSJohannes Berg  * @dev: network device
371404a773adSJohannes Berg  * @bssid: the BSSID of the IBSS joined
371504a773adSJohannes Berg  * @gfp: allocation flags
371604a773adSJohannes Berg  *
371704a773adSJohannes Berg  * This function notifies cfg80211 that the device joined an IBSS or
371804a773adSJohannes Berg  * switched to a different BSSID. Before this function can be called,
371904a773adSJohannes Berg  * either a beacon has to have been received from the IBSS, or one of
372004a773adSJohannes Berg  * the cfg80211_inform_bss{,_frame} functions must have been called
372104a773adSJohannes Berg  * with the locally generated beacon -- this guarantees that there is
372204a773adSJohannes Berg  * always a scan result for this IBSS. cfg80211 will handle the rest.
372304a773adSJohannes Berg  */
372404a773adSJohannes Berg void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, gfp_t gfp);
372504a773adSJohannes Berg 
37261f87f7d3SJohannes Berg /**
3727c93b5e71SJavier Cardona  * cfg80211_notify_new_candidate - notify cfg80211 of a new mesh peer candidate
3728c93b5e71SJavier Cardona  *
3729c93b5e71SJavier Cardona  * @dev: network device
3730c93b5e71SJavier Cardona  * @macaddr: the MAC address of the new candidate
3731c93b5e71SJavier Cardona  * @ie: information elements advertised by the peer candidate
3732c93b5e71SJavier Cardona  * @ie_len: lenght of the information elements buffer
3733c93b5e71SJavier Cardona  * @gfp: allocation flags
3734c93b5e71SJavier Cardona  *
3735c93b5e71SJavier Cardona  * This function notifies cfg80211 that the mesh peer candidate has been
3736c93b5e71SJavier Cardona  * detected, most likely via a beacon or, less likely, via a probe response.
3737c93b5e71SJavier Cardona  * cfg80211 then sends a notification to userspace.
3738c93b5e71SJavier Cardona  */
3739c93b5e71SJavier Cardona void cfg80211_notify_new_peer_candidate(struct net_device *dev,
3740c93b5e71SJavier Cardona 		const u8 *macaddr, const u8 *ie, u8 ie_len, gfp_t gfp);
3741c93b5e71SJavier Cardona 
3742c93b5e71SJavier Cardona /**
3743d70e9693SJohannes Berg  * DOC: RFkill integration
3744d70e9693SJohannes Berg  *
3745d70e9693SJohannes Berg  * RFkill integration in cfg80211 is almost invisible to drivers,
3746d70e9693SJohannes Berg  * as cfg80211 automatically registers an rfkill instance for each
3747d70e9693SJohannes Berg  * wireless device it knows about. Soft kill is also translated
3748d70e9693SJohannes Berg  * into disconnecting and turning all interfaces off, drivers are
3749d70e9693SJohannes Berg  * expected to turn off the device when all interfaces are down.
3750d70e9693SJohannes Berg  *
3751d70e9693SJohannes Berg  * However, devices may have a hard RFkill line, in which case they
3752d70e9693SJohannes Berg  * also need to interact with the rfkill subsystem, via cfg80211.
3753d70e9693SJohannes Berg  * They can do this with a few helper functions documented here.
3754d70e9693SJohannes Berg  */
3755d70e9693SJohannes Berg 
3756d70e9693SJohannes Berg /**
37571f87f7d3SJohannes Berg  * wiphy_rfkill_set_hw_state - notify cfg80211 about hw block state
37581f87f7d3SJohannes Berg  * @wiphy: the wiphy
37591f87f7d3SJohannes Berg  * @blocked: block status
37601f87f7d3SJohannes Berg  */
37611f87f7d3SJohannes Berg void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked);
37621f87f7d3SJohannes Berg 
37631f87f7d3SJohannes Berg /**
37641f87f7d3SJohannes Berg  * wiphy_rfkill_start_polling - start polling rfkill
37651f87f7d3SJohannes Berg  * @wiphy: the wiphy
37661f87f7d3SJohannes Berg  */
37671f87f7d3SJohannes Berg void wiphy_rfkill_start_polling(struct wiphy *wiphy);
37681f87f7d3SJohannes Berg 
37691f87f7d3SJohannes Berg /**
37701f87f7d3SJohannes Berg  * wiphy_rfkill_stop_polling - stop polling rfkill
37711f87f7d3SJohannes Berg  * @wiphy: the wiphy
37721f87f7d3SJohannes Berg  */
37731f87f7d3SJohannes Berg void wiphy_rfkill_stop_polling(struct wiphy *wiphy);
37741f87f7d3SJohannes Berg 
3775aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE
3776aff89a9bSJohannes Berg /**
3777d70e9693SJohannes Berg  * DOC: Test mode
3778d70e9693SJohannes Berg  *
3779d70e9693SJohannes Berg  * Test mode is a set of utility functions to allow drivers to
3780d70e9693SJohannes Berg  * interact with driver-specific tools to aid, for instance,
3781d70e9693SJohannes Berg  * factory programming.
3782d70e9693SJohannes Berg  *
3783d70e9693SJohannes Berg  * This chapter describes how drivers interact with it, for more
3784d70e9693SJohannes Berg  * information see the nl80211 book's chapter on it.
3785d70e9693SJohannes Berg  */
3786d70e9693SJohannes Berg 
3787d70e9693SJohannes Berg /**
3788aff89a9bSJohannes Berg  * cfg80211_testmode_alloc_reply_skb - allocate testmode reply
3789aff89a9bSJohannes Berg  * @wiphy: the wiphy
3790aff89a9bSJohannes Berg  * @approxlen: an upper bound of the length of the data that will
3791aff89a9bSJohannes Berg  *	be put into the skb
3792aff89a9bSJohannes Berg  *
3793aff89a9bSJohannes Berg  * This function allocates and pre-fills an skb for a reply to
3794aff89a9bSJohannes Berg  * the testmode command. Since it is intended for a reply, calling
3795aff89a9bSJohannes Berg  * it outside of the @testmode_cmd operation is invalid.
3796aff89a9bSJohannes Berg  *
37970ae997dcSYacine Belkadi  * The returned skb is pre-filled with the wiphy index and set up in
37980ae997dcSYacine Belkadi  * a way that any data that is put into the skb (with skb_put(),
37990ae997dcSYacine Belkadi  * nla_put() or similar) will end up being within the
38000ae997dcSYacine Belkadi  * %NL80211_ATTR_TESTDATA attribute, so all that needs to be done
38010ae997dcSYacine Belkadi  * with the skb is adding data for the corresponding userspace tool
38020ae997dcSYacine Belkadi  * which can then read that data out of the testdata attribute. You
38030ae997dcSYacine Belkadi  * must not modify the skb in any other way.
3804aff89a9bSJohannes Berg  *
3805aff89a9bSJohannes Berg  * When done, call cfg80211_testmode_reply() with the skb and return
3806aff89a9bSJohannes Berg  * its error code as the result of the @testmode_cmd operation.
38070ae997dcSYacine Belkadi  *
38080ae997dcSYacine Belkadi  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
3809aff89a9bSJohannes Berg  */
3810aff89a9bSJohannes Berg struct sk_buff *cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy,
3811aff89a9bSJohannes Berg 						  int approxlen);
3812aff89a9bSJohannes Berg 
3813aff89a9bSJohannes Berg /**
3814aff89a9bSJohannes Berg  * cfg80211_testmode_reply - send the reply skb
3815aff89a9bSJohannes Berg  * @skb: The skb, must have been allocated with
3816aff89a9bSJohannes Berg  *	cfg80211_testmode_alloc_reply_skb()
3817aff89a9bSJohannes Berg  *
38180ae997dcSYacine Belkadi  * Since calling this function will usually be the last thing
38190ae997dcSYacine Belkadi  * before returning from the @testmode_cmd you should return
38200ae997dcSYacine Belkadi  * the error code.  Note that this function consumes the skb
38210ae997dcSYacine Belkadi  * regardless of the return value.
38220ae997dcSYacine Belkadi  *
38230ae997dcSYacine Belkadi  * Return: An error code or 0 on success.
3824aff89a9bSJohannes Berg  */
3825aff89a9bSJohannes Berg int cfg80211_testmode_reply(struct sk_buff *skb);
3826aff89a9bSJohannes Berg 
3827aff89a9bSJohannes Berg /**
3828aff89a9bSJohannes Berg  * cfg80211_testmode_alloc_event_skb - allocate testmode event
3829aff89a9bSJohannes Berg  * @wiphy: the wiphy
3830aff89a9bSJohannes Berg  * @approxlen: an upper bound of the length of the data that will
3831aff89a9bSJohannes Berg  *	be put into the skb
3832aff89a9bSJohannes Berg  * @gfp: allocation flags
3833aff89a9bSJohannes Berg  *
3834aff89a9bSJohannes Berg  * This function allocates and pre-fills an skb for an event on the
3835aff89a9bSJohannes Berg  * testmode multicast group.
3836aff89a9bSJohannes Berg  *
38370ae997dcSYacine Belkadi  * The returned skb is set up in the same way as with
38380ae997dcSYacine Belkadi  * cfg80211_testmode_alloc_reply_skb() but prepared for an event. As
38390ae997dcSYacine Belkadi  * there, you should simply add data to it that will then end up in the
38400ae997dcSYacine Belkadi  * %NL80211_ATTR_TESTDATA attribute. Again, you must not modify the skb
38410ae997dcSYacine Belkadi  * in any other way.
3842aff89a9bSJohannes Berg  *
3843aff89a9bSJohannes Berg  * When done filling the skb, call cfg80211_testmode_event() with the
3844aff89a9bSJohannes Berg  * skb to send the event.
38450ae997dcSYacine Belkadi  *
38460ae997dcSYacine Belkadi  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
3847aff89a9bSJohannes Berg  */
3848aff89a9bSJohannes Berg struct sk_buff *cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy,
3849aff89a9bSJohannes Berg 						  int approxlen, gfp_t gfp);
3850aff89a9bSJohannes Berg 
3851aff89a9bSJohannes Berg /**
3852aff89a9bSJohannes Berg  * cfg80211_testmode_event - send the event
3853aff89a9bSJohannes Berg  * @skb: The skb, must have been allocated with
3854aff89a9bSJohannes Berg  *	cfg80211_testmode_alloc_event_skb()
3855aff89a9bSJohannes Berg  * @gfp: allocation flags
3856aff89a9bSJohannes Berg  *
3857aff89a9bSJohannes Berg  * This function sends the given @skb, which must have been allocated
3858aff89a9bSJohannes Berg  * by cfg80211_testmode_alloc_event_skb(), as an event. It always
3859aff89a9bSJohannes Berg  * consumes it.
3860aff89a9bSJohannes Berg  */
3861aff89a9bSJohannes Berg void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp);
3862aff89a9bSJohannes Berg 
3863aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd)	.testmode_cmd = (cmd),
386471063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd)	.testmode_dump = (cmd),
3865aff89a9bSJohannes Berg #else
3866aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd)
386771063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd)
3868aff89a9bSJohannes Berg #endif
3869aff89a9bSJohannes Berg 
3870b23aa676SSamuel Ortiz /**
3871b23aa676SSamuel Ortiz  * cfg80211_connect_result - notify cfg80211 of connection result
3872b23aa676SSamuel Ortiz  *
3873b23aa676SSamuel Ortiz  * @dev: network device
3874b23aa676SSamuel Ortiz  * @bssid: the BSSID of the AP
3875b23aa676SSamuel Ortiz  * @req_ie: association request IEs (maybe be %NULL)
3876b23aa676SSamuel Ortiz  * @req_ie_len: association request IEs length
3877b23aa676SSamuel Ortiz  * @resp_ie: association response IEs (may be %NULL)
3878b23aa676SSamuel Ortiz  * @resp_ie_len: assoc response IEs length
3879b23aa676SSamuel Ortiz  * @status: status code, 0 for successful connection, use
3880b23aa676SSamuel Ortiz  *	%WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
3881b23aa676SSamuel Ortiz  *	the real status code for failures.
3882b23aa676SSamuel Ortiz  * @gfp: allocation flags
3883b23aa676SSamuel Ortiz  *
3884b23aa676SSamuel Ortiz  * It should be called by the underlying driver whenever connect() has
3885b23aa676SSamuel Ortiz  * succeeded.
3886b23aa676SSamuel Ortiz  */
3887b23aa676SSamuel Ortiz void cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
3888b23aa676SSamuel Ortiz 			     const u8 *req_ie, size_t req_ie_len,
3889b23aa676SSamuel Ortiz 			     const u8 *resp_ie, size_t resp_ie_len,
3890b23aa676SSamuel Ortiz 			     u16 status, gfp_t gfp);
3891b23aa676SSamuel Ortiz 
3892b23aa676SSamuel Ortiz /**
3893b23aa676SSamuel Ortiz  * cfg80211_roamed - notify cfg80211 of roaming
3894b23aa676SSamuel Ortiz  *
3895b23aa676SSamuel Ortiz  * @dev: network device
3896ed9d0102SJouni Malinen  * @channel: the channel of the new AP
3897b23aa676SSamuel Ortiz  * @bssid: the BSSID of the new AP
3898b23aa676SSamuel Ortiz  * @req_ie: association request IEs (maybe be %NULL)
3899b23aa676SSamuel Ortiz  * @req_ie_len: association request IEs length
3900b23aa676SSamuel Ortiz  * @resp_ie: association response IEs (may be %NULL)
3901b23aa676SSamuel Ortiz  * @resp_ie_len: assoc response IEs length
3902b23aa676SSamuel Ortiz  * @gfp: allocation flags
3903b23aa676SSamuel Ortiz  *
3904b23aa676SSamuel Ortiz  * It should be called by the underlying driver whenever it roamed
3905b23aa676SSamuel Ortiz  * from one AP to another while connected.
3906b23aa676SSamuel Ortiz  */
3907ed9d0102SJouni Malinen void cfg80211_roamed(struct net_device *dev,
3908ed9d0102SJouni Malinen 		     struct ieee80211_channel *channel,
3909ed9d0102SJouni Malinen 		     const u8 *bssid,
3910b23aa676SSamuel Ortiz 		     const u8 *req_ie, size_t req_ie_len,
3911b23aa676SSamuel Ortiz 		     const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp);
3912b23aa676SSamuel Ortiz 
3913b23aa676SSamuel Ortiz /**
3914adbde344SVasanthakumar Thiagarajan  * cfg80211_roamed_bss - notify cfg80211 of roaming
3915adbde344SVasanthakumar Thiagarajan  *
3916adbde344SVasanthakumar Thiagarajan  * @dev: network device
3917adbde344SVasanthakumar Thiagarajan  * @bss: entry of bss to which STA got roamed
3918adbde344SVasanthakumar Thiagarajan  * @req_ie: association request IEs (maybe be %NULL)
3919adbde344SVasanthakumar Thiagarajan  * @req_ie_len: association request IEs length
3920adbde344SVasanthakumar Thiagarajan  * @resp_ie: association response IEs (may be %NULL)
3921adbde344SVasanthakumar Thiagarajan  * @resp_ie_len: assoc response IEs length
3922adbde344SVasanthakumar Thiagarajan  * @gfp: allocation flags
3923adbde344SVasanthakumar Thiagarajan  *
3924adbde344SVasanthakumar Thiagarajan  * This is just a wrapper to notify cfg80211 of roaming event with driver
3925adbde344SVasanthakumar Thiagarajan  * passing bss to avoid a race in timeout of the bss entry. It should be
3926adbde344SVasanthakumar Thiagarajan  * called by the underlying driver whenever it roamed from one AP to another
3927adbde344SVasanthakumar Thiagarajan  * while connected. Drivers which have roaming implemented in firmware
3928adbde344SVasanthakumar Thiagarajan  * may use this function to avoid a race in bss entry timeout where the bss
3929adbde344SVasanthakumar Thiagarajan  * entry of the new AP is seen in the driver, but gets timed out by the time
3930adbde344SVasanthakumar Thiagarajan  * it is accessed in __cfg80211_roamed() due to delay in scheduling
3931adbde344SVasanthakumar Thiagarajan  * rdev->event_work. In case of any failures, the reference is released
3932adbde344SVasanthakumar Thiagarajan  * either in cfg80211_roamed_bss() or in __cfg80211_romed(), Otherwise,
3933adbde344SVasanthakumar Thiagarajan  * it will be released while diconneting from the current bss.
3934adbde344SVasanthakumar Thiagarajan  */
3935adbde344SVasanthakumar Thiagarajan void cfg80211_roamed_bss(struct net_device *dev, struct cfg80211_bss *bss,
3936adbde344SVasanthakumar Thiagarajan 			 const u8 *req_ie, size_t req_ie_len,
3937adbde344SVasanthakumar Thiagarajan 			 const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp);
3938adbde344SVasanthakumar Thiagarajan 
3939adbde344SVasanthakumar Thiagarajan /**
3940b23aa676SSamuel Ortiz  * cfg80211_disconnected - notify cfg80211 that connection was dropped
3941b23aa676SSamuel Ortiz  *
3942b23aa676SSamuel Ortiz  * @dev: network device
3943b23aa676SSamuel Ortiz  * @ie: information elements of the deauth/disassoc frame (may be %NULL)
3944b23aa676SSamuel Ortiz  * @ie_len: length of IEs
3945b23aa676SSamuel Ortiz  * @reason: reason code for the disconnection, set it to 0 if unknown
3946b23aa676SSamuel Ortiz  * @gfp: allocation flags
3947b23aa676SSamuel Ortiz  *
3948b23aa676SSamuel Ortiz  * After it calls this function, the driver should enter an idle state
3949b23aa676SSamuel Ortiz  * and not try to connect to any AP any more.
3950b23aa676SSamuel Ortiz  */
3951b23aa676SSamuel Ortiz void cfg80211_disconnected(struct net_device *dev, u16 reason,
3952b23aa676SSamuel Ortiz 			   u8 *ie, size_t ie_len, gfp_t gfp);
3953b23aa676SSamuel Ortiz 
39549588bbd5SJouni Malinen /**
39559588bbd5SJouni Malinen  * cfg80211_ready_on_channel - notification of remain_on_channel start
395671bbc994SJohannes Berg  * @wdev: wireless device
39579588bbd5SJouni Malinen  * @cookie: the request cookie
39589588bbd5SJouni Malinen  * @chan: The current channel (from remain_on_channel request)
39599588bbd5SJouni Malinen  * @duration: Duration in milliseconds that the driver intents to remain on the
39609588bbd5SJouni Malinen  *	channel
39619588bbd5SJouni Malinen  * @gfp: allocation flags
39629588bbd5SJouni Malinen  */
396371bbc994SJohannes Berg void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie,
39649588bbd5SJouni Malinen 			       struct ieee80211_channel *chan,
39659588bbd5SJouni Malinen 			       unsigned int duration, gfp_t gfp);
39669588bbd5SJouni Malinen 
39679588bbd5SJouni Malinen /**
39689588bbd5SJouni Malinen  * cfg80211_remain_on_channel_expired - remain_on_channel duration expired
396971bbc994SJohannes Berg  * @wdev: wireless device
39709588bbd5SJouni Malinen  * @cookie: the request cookie
39719588bbd5SJouni Malinen  * @chan: The current channel (from remain_on_channel request)
39729588bbd5SJouni Malinen  * @gfp: allocation flags
39739588bbd5SJouni Malinen  */
397471bbc994SJohannes Berg void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie,
39759588bbd5SJouni Malinen 					struct ieee80211_channel *chan,
39769588bbd5SJouni Malinen 					gfp_t gfp);
3977b23aa676SSamuel Ortiz 
397898b62183SJohannes Berg 
397998b62183SJohannes Berg /**
398098b62183SJohannes Berg  * cfg80211_new_sta - notify userspace about station
398198b62183SJohannes Berg  *
398298b62183SJohannes Berg  * @dev: the netdev
398398b62183SJohannes Berg  * @mac_addr: the station's address
398498b62183SJohannes Berg  * @sinfo: the station information
398598b62183SJohannes Berg  * @gfp: allocation flags
398698b62183SJohannes Berg  */
398798b62183SJohannes Berg void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr,
398898b62183SJohannes Berg 		      struct station_info *sinfo, gfp_t gfp);
398998b62183SJohannes Berg 
3990026331c4SJouni Malinen /**
3991ec15e68bSJouni Malinen  * cfg80211_del_sta - notify userspace about deletion of a station
3992ec15e68bSJouni Malinen  *
3993ec15e68bSJouni Malinen  * @dev: the netdev
3994ec15e68bSJouni Malinen  * @mac_addr: the station's address
3995ec15e68bSJouni Malinen  * @gfp: allocation flags
3996ec15e68bSJouni Malinen  */
3997ec15e68bSJouni Malinen void cfg80211_del_sta(struct net_device *dev, const u8 *mac_addr, gfp_t gfp);
3998ec15e68bSJouni Malinen 
3999ec15e68bSJouni Malinen /**
4000ed44a951SPandiyarajan Pitchaimuthu  * cfg80211_conn_failed - connection request failed notification
4001ed44a951SPandiyarajan Pitchaimuthu  *
4002ed44a951SPandiyarajan Pitchaimuthu  * @dev: the netdev
4003ed44a951SPandiyarajan Pitchaimuthu  * @mac_addr: the station's address
4004ed44a951SPandiyarajan Pitchaimuthu  * @reason: the reason for connection failure
4005ed44a951SPandiyarajan Pitchaimuthu  * @gfp: allocation flags
4006ed44a951SPandiyarajan Pitchaimuthu  *
4007ed44a951SPandiyarajan Pitchaimuthu  * Whenever a station tries to connect to an AP and if the station
4008ed44a951SPandiyarajan Pitchaimuthu  * could not connect to the AP as the AP has rejected the connection
4009ed44a951SPandiyarajan Pitchaimuthu  * for some reasons, this function is called.
4010ed44a951SPandiyarajan Pitchaimuthu  *
4011ed44a951SPandiyarajan Pitchaimuthu  * The reason for connection failure can be any of the value from
4012ed44a951SPandiyarajan Pitchaimuthu  * nl80211_connect_failed_reason enum
4013ed44a951SPandiyarajan Pitchaimuthu  */
4014ed44a951SPandiyarajan Pitchaimuthu void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr,
4015ed44a951SPandiyarajan Pitchaimuthu 			  enum nl80211_connect_failed_reason reason,
4016ed44a951SPandiyarajan Pitchaimuthu 			  gfp_t gfp);
4017ed44a951SPandiyarajan Pitchaimuthu 
4018ed44a951SPandiyarajan Pitchaimuthu /**
40192e161f78SJohannes Berg  * cfg80211_rx_mgmt - notification of received, unprocessed management frame
402071bbc994SJohannes Berg  * @wdev: wireless device receiving the frame
4021026331c4SJouni Malinen  * @freq: Frequency on which the frame was received in MHz
4022804483e9SJohannes Berg  * @sig_dbm: signal strength in mBm, or 0 if unknown
40232e161f78SJohannes Berg  * @buf: Management frame (header + body)
4024026331c4SJouni Malinen  * @len: length of the frame data
4025026331c4SJouni Malinen  * @gfp: context flags
40262e161f78SJohannes Berg  *
40270ae997dcSYacine Belkadi  * This function is called whenever an Action frame is received for a station
40280ae997dcSYacine Belkadi  * mode interface, but is not processed in kernel.
40290ae997dcSYacine Belkadi  *
40300ae997dcSYacine Belkadi  * Return: %true if a user space application has registered for this frame.
40312e161f78SJohannes Berg  * For action frames, that makes it responsible for rejecting unrecognized
40322e161f78SJohannes Berg  * action frames; %false otherwise, in which case for action frames the
40332e161f78SJohannes Berg  * driver is responsible for rejecting the frame.
4034026331c4SJouni Malinen  */
403571bbc994SJohannes Berg bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int sig_dbm,
4036804483e9SJohannes Berg 		      const u8 *buf, size_t len, gfp_t gfp);
4037026331c4SJouni Malinen 
4038026331c4SJouni Malinen /**
40392e161f78SJohannes Berg  * cfg80211_mgmt_tx_status - notification of TX status for management frame
404071bbc994SJohannes Berg  * @wdev: wireless device receiving the frame
40412e161f78SJohannes Berg  * @cookie: Cookie returned by cfg80211_ops::mgmt_tx()
40422e161f78SJohannes Berg  * @buf: Management frame (header + body)
4043026331c4SJouni Malinen  * @len: length of the frame data
4044026331c4SJouni Malinen  * @ack: Whether frame was acknowledged
4045026331c4SJouni Malinen  * @gfp: context flags
4046026331c4SJouni Malinen  *
40472e161f78SJohannes Berg  * This function is called whenever a management frame was requested to be
40482e161f78SJohannes Berg  * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the
4049026331c4SJouni Malinen  * transmission attempt.
4050026331c4SJouni Malinen  */
405171bbc994SJohannes Berg void cfg80211_mgmt_tx_status(struct wireless_dev *wdev, u64 cookie,
4052026331c4SJouni Malinen 			     const u8 *buf, size_t len, bool ack, gfp_t gfp);
4053026331c4SJouni Malinen 
4054d6dc1a38SJuuso Oikarinen 
4055d6dc1a38SJuuso Oikarinen /**
4056d6dc1a38SJuuso Oikarinen  * cfg80211_cqm_rssi_notify - connection quality monitoring rssi event
4057d6dc1a38SJuuso Oikarinen  * @dev: network device
4058d6dc1a38SJuuso Oikarinen  * @rssi_event: the triggered RSSI event
4059d6dc1a38SJuuso Oikarinen  * @gfp: context flags
4060d6dc1a38SJuuso Oikarinen  *
4061d6dc1a38SJuuso Oikarinen  * This function is called when a configured connection quality monitoring
4062d6dc1a38SJuuso Oikarinen  * rssi threshold reached event occurs.
4063d6dc1a38SJuuso Oikarinen  */
4064d6dc1a38SJuuso Oikarinen void cfg80211_cqm_rssi_notify(struct net_device *dev,
4065d6dc1a38SJuuso Oikarinen 			      enum nl80211_cqm_rssi_threshold_event rssi_event,
4066d6dc1a38SJuuso Oikarinen 			      gfp_t gfp);
4067d6dc1a38SJuuso Oikarinen 
4068c063dbf5SJohannes Berg /**
406904f39047SSimon Wunderlich  * cfg80211_radar_event - radar detection event
407004f39047SSimon Wunderlich  * @wiphy: the wiphy
407104f39047SSimon Wunderlich  * @chandef: chandef for the current channel
407204f39047SSimon Wunderlich  * @gfp: context flags
407304f39047SSimon Wunderlich  *
407404f39047SSimon Wunderlich  * This function is called when a radar is detected on the current chanenl.
407504f39047SSimon Wunderlich  */
407604f39047SSimon Wunderlich void cfg80211_radar_event(struct wiphy *wiphy,
407704f39047SSimon Wunderlich 			  struct cfg80211_chan_def *chandef, gfp_t gfp);
407804f39047SSimon Wunderlich 
407904f39047SSimon Wunderlich /**
408004f39047SSimon Wunderlich  * cfg80211_cac_event - Channel availability check (CAC) event
408104f39047SSimon Wunderlich  * @netdev: network device
408204f39047SSimon Wunderlich  * @event: type of event
408304f39047SSimon Wunderlich  * @gfp: context flags
408404f39047SSimon Wunderlich  *
408504f39047SSimon Wunderlich  * This function is called when a Channel availability check (CAC) is finished
408604f39047SSimon Wunderlich  * or aborted. This must be called to notify the completion of a CAC process,
408704f39047SSimon Wunderlich  * also by full-MAC drivers.
408804f39047SSimon Wunderlich  */
408904f39047SSimon Wunderlich void cfg80211_cac_event(struct net_device *netdev,
409004f39047SSimon Wunderlich 			enum nl80211_radar_event event, gfp_t gfp);
409104f39047SSimon Wunderlich 
409204f39047SSimon Wunderlich 
409304f39047SSimon Wunderlich /**
4094c063dbf5SJohannes Berg  * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer
4095c063dbf5SJohannes Berg  * @dev: network device
4096c063dbf5SJohannes Berg  * @peer: peer's MAC address
4097c063dbf5SJohannes Berg  * @num_packets: how many packets were lost -- should be a fixed threshold
4098c063dbf5SJohannes Berg  *	but probably no less than maybe 50, or maybe a throughput dependent
4099c063dbf5SJohannes Berg  *	threshold (to account for temporary interference)
4100c063dbf5SJohannes Berg  * @gfp: context flags
4101c063dbf5SJohannes Berg  */
4102c063dbf5SJohannes Berg void cfg80211_cqm_pktloss_notify(struct net_device *dev,
4103c063dbf5SJohannes Berg 				 const u8 *peer, u32 num_packets, gfp_t gfp);
4104c063dbf5SJohannes Berg 
4105e5497d76SJohannes Berg /**
410684f10708SThomas Pedersen  * cfg80211_cqm_txe_notify - TX error rate event
410784f10708SThomas Pedersen  * @dev: network device
410884f10708SThomas Pedersen  * @peer: peer's MAC address
410984f10708SThomas Pedersen  * @num_packets: how many packets were lost
411084f10708SThomas Pedersen  * @rate: % of packets which failed transmission
411184f10708SThomas Pedersen  * @intvl: interval (in s) over which the TX failure threshold was breached.
411284f10708SThomas Pedersen  * @gfp: context flags
411384f10708SThomas Pedersen  *
411484f10708SThomas Pedersen  * Notify userspace when configured % TX failures over number of packets in a
411584f10708SThomas Pedersen  * given interval is exceeded.
411684f10708SThomas Pedersen  */
411784f10708SThomas Pedersen void cfg80211_cqm_txe_notify(struct net_device *dev, const u8 *peer,
411884f10708SThomas Pedersen 			     u32 num_packets, u32 rate, u32 intvl, gfp_t gfp);
411984f10708SThomas Pedersen 
412084f10708SThomas Pedersen /**
4121e5497d76SJohannes Berg  * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying
4122e5497d76SJohannes Berg  * @dev: network device
4123e5497d76SJohannes Berg  * @bssid: BSSID of AP (to avoid races)
4124e5497d76SJohannes Berg  * @replay_ctr: new replay counter
4125af71ff85SJohannes Berg  * @gfp: allocation flags
4126e5497d76SJohannes Berg  */
4127e5497d76SJohannes Berg void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid,
4128e5497d76SJohannes Berg 			       const u8 *replay_ctr, gfp_t gfp);
4129e5497d76SJohannes Berg 
4130c9df56b4SJouni Malinen /**
4131c9df56b4SJouni Malinen  * cfg80211_pmksa_candidate_notify - notify about PMKSA caching candidate
4132c9df56b4SJouni Malinen  * @dev: network device
4133c9df56b4SJouni Malinen  * @index: candidate index (the smaller the index, the higher the priority)
4134c9df56b4SJouni Malinen  * @bssid: BSSID of AP
4135c9df56b4SJouni Malinen  * @preauth: Whether AP advertises support for RSN pre-authentication
4136c9df56b4SJouni Malinen  * @gfp: allocation flags
4137c9df56b4SJouni Malinen  */
4138c9df56b4SJouni Malinen void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index,
4139c9df56b4SJouni Malinen 				     const u8 *bssid, bool preauth, gfp_t gfp);
4140c9df56b4SJouni Malinen 
414128946da7SJohannes Berg /**
414228946da7SJohannes Berg  * cfg80211_rx_spurious_frame - inform userspace about a spurious frame
414328946da7SJohannes Berg  * @dev: The device the frame matched to
414428946da7SJohannes Berg  * @addr: the transmitter address
414528946da7SJohannes Berg  * @gfp: context flags
414628946da7SJohannes Berg  *
414728946da7SJohannes Berg  * This function is used in AP mode (only!) to inform userspace that
414828946da7SJohannes Berg  * a spurious class 3 frame was received, to be able to deauth the
414928946da7SJohannes Berg  * sender.
41500ae997dcSYacine Belkadi  * Return: %true if the frame was passed to userspace (or this failed
415128946da7SJohannes Berg  * for a reason other than not having a subscription.)
415228946da7SJohannes Berg  */
415328946da7SJohannes Berg bool cfg80211_rx_spurious_frame(struct net_device *dev,
415428946da7SJohannes Berg 				const u8 *addr, gfp_t gfp);
415528946da7SJohannes Berg 
41567f6cf311SJohannes Berg /**
4157b92ab5d8SJohannes Berg  * cfg80211_rx_unexpected_4addr_frame - inform about unexpected WDS frame
4158b92ab5d8SJohannes Berg  * @dev: The device the frame matched to
4159b92ab5d8SJohannes Berg  * @addr: the transmitter address
4160b92ab5d8SJohannes Berg  * @gfp: context flags
4161b92ab5d8SJohannes Berg  *
4162b92ab5d8SJohannes Berg  * This function is used in AP mode (only!) to inform userspace that
4163b92ab5d8SJohannes Berg  * an associated station sent a 4addr frame but that wasn't expected.
4164b92ab5d8SJohannes Berg  * It is allowed and desirable to send this event only once for each
4165b92ab5d8SJohannes Berg  * station to avoid event flooding.
41660ae997dcSYacine Belkadi  * Return: %true if the frame was passed to userspace (or this failed
4167b92ab5d8SJohannes Berg  * for a reason other than not having a subscription.)
4168b92ab5d8SJohannes Berg  */
4169b92ab5d8SJohannes Berg bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev,
4170b92ab5d8SJohannes Berg 					const u8 *addr, gfp_t gfp);
4171b92ab5d8SJohannes Berg 
4172b92ab5d8SJohannes Berg /**
41737f6cf311SJohannes Berg  * cfg80211_probe_status - notify userspace about probe status
41747f6cf311SJohannes Berg  * @dev: the device the probe was sent on
41757f6cf311SJohannes Berg  * @addr: the address of the peer
41767f6cf311SJohannes Berg  * @cookie: the cookie filled in @probe_client previously
41777f6cf311SJohannes Berg  * @acked: indicates whether probe was acked or not
41787f6cf311SJohannes Berg  * @gfp: allocation flags
41797f6cf311SJohannes Berg  */
41807f6cf311SJohannes Berg void cfg80211_probe_status(struct net_device *dev, const u8 *addr,
41817f6cf311SJohannes Berg 			   u64 cookie, bool acked, gfp_t gfp);
41827f6cf311SJohannes Berg 
41835e760230SJohannes Berg /**
41845e760230SJohannes Berg  * cfg80211_report_obss_beacon - report beacon from other APs
41855e760230SJohannes Berg  * @wiphy: The wiphy that received the beacon
41865e760230SJohannes Berg  * @frame: the frame
41875e760230SJohannes Berg  * @len: length of the frame
41885e760230SJohannes Berg  * @freq: frequency the frame was received on
4189804483e9SJohannes Berg  * @sig_dbm: signal strength in mBm, or 0 if unknown
41905e760230SJohannes Berg  *
41915e760230SJohannes Berg  * Use this function to report to userspace when a beacon was
41925e760230SJohannes Berg  * received. It is not useful to call this when there is no
41935e760230SJohannes Berg  * netdev that is in AP/GO mode.
41945e760230SJohannes Berg  */
41955e760230SJohannes Berg void cfg80211_report_obss_beacon(struct wiphy *wiphy,
41965e760230SJohannes Berg 				 const u8 *frame, size_t len,
419737c73b5fSBen Greear 				 int freq, int sig_dbm);
41985e760230SJohannes Berg 
4199d58e7e37SJohannes Berg /**
4200683b6d3bSJohannes Berg  * cfg80211_reg_can_beacon - check if beaconing is allowed
420154858ee5SAlexander Simon  * @wiphy: the wiphy
4202683b6d3bSJohannes Berg  * @chandef: the channel definition
4203d58e7e37SJohannes Berg  *
42040ae997dcSYacine Belkadi  * Return: %true if there is no secondary channel or the secondary channel(s)
42050ae997dcSYacine Belkadi  * can be used for beaconing (i.e. is not a radar channel etc.)
420654858ee5SAlexander Simon  */
4207683b6d3bSJohannes Berg bool cfg80211_reg_can_beacon(struct wiphy *wiphy,
4208683b6d3bSJohannes Berg 			     struct cfg80211_chan_def *chandef);
420954858ee5SAlexander Simon 
42108097e149SThomas Pedersen /*
42115314526bSThomas Pedersen  * cfg80211_ch_switch_notify - update wdev channel and notify userspace
42125314526bSThomas Pedersen  * @dev: the device which switched channels
4213683b6d3bSJohannes Berg  * @chandef: the new channel definition
42145314526bSThomas Pedersen  *
42155314526bSThomas Pedersen  * Acquires wdev_lock, so must only be called from sleepable driver context!
42165314526bSThomas Pedersen  */
4217683b6d3bSJohannes Berg void cfg80211_ch_switch_notify(struct net_device *dev,
4218683b6d3bSJohannes Berg 			       struct cfg80211_chan_def *chandef);
42195314526bSThomas Pedersen 
42201ce3e82bSJohannes Berg /**
42211ce3e82bSJohannes Berg  * ieee80211_operating_class_to_band - convert operating class to band
42221ce3e82bSJohannes Berg  *
42231ce3e82bSJohannes Berg  * @operating_class: the operating class to convert
42241ce3e82bSJohannes Berg  * @band: band pointer to fill
42251ce3e82bSJohannes Berg  *
42261ce3e82bSJohannes Berg  * Returns %true if the conversion was successful, %false otherwise.
42271ce3e82bSJohannes Berg  */
42281ce3e82bSJohannes Berg bool ieee80211_operating_class_to_band(u8 operating_class,
42291ce3e82bSJohannes Berg 				       enum ieee80211_band *band);
42301ce3e82bSJohannes Berg 
42315314526bSThomas Pedersen /*
42323475b094SJouni Malinen  * cfg80211_tdls_oper_request - request userspace to perform TDLS operation
42333475b094SJouni Malinen  * @dev: the device on which the operation is requested
42343475b094SJouni Malinen  * @peer: the MAC address of the peer device
42353475b094SJouni Malinen  * @oper: the requested TDLS operation (NL80211_TDLS_SETUP or
42363475b094SJouni Malinen  *	NL80211_TDLS_TEARDOWN)
42373475b094SJouni Malinen  * @reason_code: the reason code for teardown request
42383475b094SJouni Malinen  * @gfp: allocation flags
42393475b094SJouni Malinen  *
42403475b094SJouni Malinen  * This function is used to request userspace to perform TDLS operation that
42413475b094SJouni Malinen  * requires knowledge of keys, i.e., link setup or teardown when the AP
42423475b094SJouni Malinen  * connection uses encryption. This is optional mechanism for the driver to use
42433475b094SJouni Malinen  * if it can automatically determine when a TDLS link could be useful (e.g.,
42443475b094SJouni Malinen  * based on traffic and signal strength for a peer).
42453475b094SJouni Malinen  */
42463475b094SJouni Malinen void cfg80211_tdls_oper_request(struct net_device *dev, const u8 *peer,
42473475b094SJouni Malinen 				enum nl80211_tdls_operation oper,
42483475b094SJouni Malinen 				u16 reason_code, gfp_t gfp);
42493475b094SJouni Malinen 
42503475b094SJouni Malinen /*
42518097e149SThomas Pedersen  * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units)
42528097e149SThomas Pedersen  * @rate: given rate_info to calculate bitrate from
42538097e149SThomas Pedersen  *
42548097e149SThomas Pedersen  * return 0 if MCS index >= 32
42558097e149SThomas Pedersen  */
42568eb41c8dSVladimir Kondratiev u32 cfg80211_calculate_bitrate(struct rate_info *rate);
42578097e149SThomas Pedersen 
425898104fdeSJohannes Berg /**
425998104fdeSJohannes Berg  * cfg80211_unregister_wdev - remove the given wdev
426098104fdeSJohannes Berg  * @wdev: struct wireless_dev to remove
426198104fdeSJohannes Berg  *
426298104fdeSJohannes Berg  * Call this function only for wdevs that have no netdev assigned,
426398104fdeSJohannes Berg  * e.g. P2P Devices. It removes the device from the list so that
426498104fdeSJohannes Berg  * it can no longer be used. It is necessary to call this function
426598104fdeSJohannes Berg  * even when cfg80211 requests the removal of the interface by
426698104fdeSJohannes Berg  * calling the del_virtual_intf() callback. The function must also
426798104fdeSJohannes Berg  * be called when the driver wishes to unregister the wdev, e.g.
426898104fdeSJohannes Berg  * when the device is unbound from the driver.
426998104fdeSJohannes Berg  *
427098104fdeSJohannes Berg  * Requires the RTNL to be held.
427198104fdeSJohannes Berg  */
427298104fdeSJohannes Berg void cfg80211_unregister_wdev(struct wireless_dev *wdev);
427398104fdeSJohannes Berg 
42740ee45355SJohannes Berg /**
4275355199e0SJouni Malinen  * struct cfg80211_ft_event - FT Information Elements
4276355199e0SJouni Malinen  * @ies: FT IEs
4277355199e0SJouni Malinen  * @ies_len: length of the FT IE in bytes
4278355199e0SJouni Malinen  * @target_ap: target AP's MAC address
4279355199e0SJouni Malinen  * @ric_ies: RIC IE
4280355199e0SJouni Malinen  * @ric_ies_len: length of the RIC IE in bytes
4281355199e0SJouni Malinen  */
4282355199e0SJouni Malinen struct cfg80211_ft_event_params {
4283355199e0SJouni Malinen 	const u8 *ies;
4284355199e0SJouni Malinen 	size_t ies_len;
4285355199e0SJouni Malinen 	const u8 *target_ap;
4286355199e0SJouni Malinen 	const u8 *ric_ies;
4287355199e0SJouni Malinen 	size_t ric_ies_len;
4288355199e0SJouni Malinen };
4289355199e0SJouni Malinen 
4290355199e0SJouni Malinen /**
4291355199e0SJouni Malinen  * cfg80211_ft_event - notify userspace about FT IE and RIC IE
4292355199e0SJouni Malinen  * @netdev: network device
4293355199e0SJouni Malinen  * @ft_event: IE information
4294355199e0SJouni Malinen  */
4295355199e0SJouni Malinen void cfg80211_ft_event(struct net_device *netdev,
4296355199e0SJouni Malinen 		       struct cfg80211_ft_event_params *ft_event);
4297355199e0SJouni Malinen 
4298355199e0SJouni Malinen /**
42990ee45355SJohannes Berg  * cfg80211_get_p2p_attr - find and copy a P2P attribute from IE buffer
43000ee45355SJohannes Berg  * @ies: the input IE buffer
43010ee45355SJohannes Berg  * @len: the input length
43020ee45355SJohannes Berg  * @attr: the attribute ID to find
43030ee45355SJohannes Berg  * @buf: output buffer, can be %NULL if the data isn't needed, e.g.
43040ee45355SJohannes Berg  *	if the function is only called to get the needed buffer size
43050ee45355SJohannes Berg  * @bufsize: size of the output buffer
43060ee45355SJohannes Berg  *
43070ee45355SJohannes Berg  * The function finds a given P2P attribute in the (vendor) IEs and
43080ee45355SJohannes Berg  * copies its contents to the given buffer.
43090ee45355SJohannes Berg  *
43100ae997dcSYacine Belkadi  * Return: A negative error code (-%EILSEQ or -%ENOENT) if the data is
43110ae997dcSYacine Belkadi  * malformed or the attribute can't be found (respectively), or the
43120ae997dcSYacine Belkadi  * length of the found attribute (which can be zero).
43130ee45355SJohannes Berg  */
4314c216e641SArend van Spriel int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len,
4315c216e641SArend van Spriel 			  enum ieee80211_p2p_attr_id attr,
4316c216e641SArend van Spriel 			  u8 *buf, unsigned int bufsize);
43170ee45355SJohannes Berg 
4318cd8f7cb4SJohannes Berg /**
4319cd8f7cb4SJohannes Berg  * cfg80211_report_wowlan_wakeup - report wakeup from WoWLAN
4320cd8f7cb4SJohannes Berg  * @wdev: the wireless device reporting the wakeup
4321cd8f7cb4SJohannes Berg  * @wakeup: the wakeup report
4322cd8f7cb4SJohannes Berg  * @gfp: allocation flags
4323cd8f7cb4SJohannes Berg  *
4324cd8f7cb4SJohannes Berg  * This function reports that the given device woke up. If it
4325cd8f7cb4SJohannes Berg  * caused the wakeup, report the reason(s), otherwise you may
4326cd8f7cb4SJohannes Berg  * pass %NULL as the @wakeup parameter to advertise that something
4327cd8f7cb4SJohannes Berg  * else caused the wakeup.
4328cd8f7cb4SJohannes Berg  */
4329cd8f7cb4SJohannes Berg void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev,
4330cd8f7cb4SJohannes Berg 				   struct cfg80211_wowlan_wakeup *wakeup,
4331cd8f7cb4SJohannes Berg 				   gfp_t gfp);
4332cd8f7cb4SJohannes Berg 
43335de17984SArend van Spriel /**
43345de17984SArend van Spriel  * cfg80211_crit_proto_stopped() - indicate critical protocol stopped by driver.
43355de17984SArend van Spriel  *
43365de17984SArend van Spriel  * @wdev: the wireless device for which critical protocol is stopped.
433703f831a6SRobert P. J. Day  * @gfp: allocation flags
43385de17984SArend van Spriel  *
43395de17984SArend van Spriel  * This function can be called by the driver to indicate it has reverted
43405de17984SArend van Spriel  * operation back to normal. One reason could be that the duration given
43415de17984SArend van Spriel  * by .crit_proto_start() has expired.
43425de17984SArend van Spriel  */
43435de17984SArend van Spriel void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp);
43445de17984SArend van Spriel 
4345e1db74fcSJoe Perches /* Logging, debugging and troubleshooting/diagnostic helpers. */
4346e1db74fcSJoe Perches 
4347e1db74fcSJoe Perches /* wiphy_printk helpers, similar to dev_printk */
4348e1db74fcSJoe Perches 
4349e1db74fcSJoe Perches #define wiphy_printk(level, wiphy, format, args...)		\
43509c376639SJoe Perches 	dev_printk(level, &(wiphy)->dev, format, ##args)
4351e1db74fcSJoe Perches #define wiphy_emerg(wiphy, format, args...)			\
43529c376639SJoe Perches 	dev_emerg(&(wiphy)->dev, format, ##args)
4353e1db74fcSJoe Perches #define wiphy_alert(wiphy, format, args...)			\
43549c376639SJoe Perches 	dev_alert(&(wiphy)->dev, format, ##args)
4355e1db74fcSJoe Perches #define wiphy_crit(wiphy, format, args...)			\
43569c376639SJoe Perches 	dev_crit(&(wiphy)->dev, format, ##args)
4357e1db74fcSJoe Perches #define wiphy_err(wiphy, format, args...)			\
43589c376639SJoe Perches 	dev_err(&(wiphy)->dev, format, ##args)
4359e1db74fcSJoe Perches #define wiphy_warn(wiphy, format, args...)			\
43609c376639SJoe Perches 	dev_warn(&(wiphy)->dev, format, ##args)
4361e1db74fcSJoe Perches #define wiphy_notice(wiphy, format, args...)			\
43629c376639SJoe Perches 	dev_notice(&(wiphy)->dev, format, ##args)
4363e1db74fcSJoe Perches #define wiphy_info(wiphy, format, args...)			\
43649c376639SJoe Perches 	dev_info(&(wiphy)->dev, format, ##args)
4365073730d7SJoe Perches 
43669c376639SJoe Perches #define wiphy_debug(wiphy, format, args...)			\
4367e1db74fcSJoe Perches 	wiphy_printk(KERN_DEBUG, wiphy, format, ##args)
43689c376639SJoe Perches 
4369e1db74fcSJoe Perches #define wiphy_dbg(wiphy, format, args...)			\
43709c376639SJoe Perches 	dev_dbg(&(wiphy)->dev, format, ##args)
4371e1db74fcSJoe Perches 
4372e1db74fcSJoe Perches #if defined(VERBOSE_DEBUG)
4373e1db74fcSJoe Perches #define wiphy_vdbg	wiphy_dbg
4374e1db74fcSJoe Perches #else
4375e1db74fcSJoe Perches #define wiphy_vdbg(wiphy, format, args...)				\
4376e1db74fcSJoe Perches ({									\
4377e1db74fcSJoe Perches 	if (0)								\
4378e1db74fcSJoe Perches 		wiphy_printk(KERN_DEBUG, wiphy, format, ##args);	\
4379e1db74fcSJoe Perches 	0;								\
4380e1db74fcSJoe Perches })
4381e1db74fcSJoe Perches #endif
4382e1db74fcSJoe Perches 
4383e1db74fcSJoe Perches /*
4384e1db74fcSJoe Perches  * wiphy_WARN() acts like wiphy_printk(), but with the key difference
4385e1db74fcSJoe Perches  * of using a WARN/WARN_ON to get the message out, including the
4386e1db74fcSJoe Perches  * file/line information and a backtrace.
4387e1db74fcSJoe Perches  */
4388e1db74fcSJoe Perches #define wiphy_WARN(wiphy, format, args...)			\
4389e1db74fcSJoe Perches 	WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args);
4390e1db74fcSJoe Perches 
4391704232c2SJohannes Berg #endif /* __NET_CFG80211_H */
4392