xref: /linux/include/net/cfg80211.h (revision 8fe02e167efa8ed4a4503a5eedc0f49fcb7e3eb9)
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.
94*8fe02e16SLuis R. Rodriguez  * @IEEE80211_CHAN_NO_IR: do not initiate radiation, this includes
95*8fe02e16SLuis R. Rodriguez  * 	sending probe requests or beaconing.
96d3236553SJohannes Berg  * @IEEE80211_CHAN_RADAR: Radar detection is required on this channel.
97689da1b3SLuis R. Rodriguez  * @IEEE80211_CHAN_NO_HT40PLUS: extension channel above this channel
98d3236553SJohannes Berg  * 	is not permitted.
99689da1b3SLuis R. Rodriguez  * @IEEE80211_CHAN_NO_HT40MINUS: extension channel below this channel
100d3236553SJohannes Berg  * 	is not permitted.
10103f6b084SSeth Forshee  * @IEEE80211_CHAN_NO_OFDM: OFDM is not allowed on this channel.
102c7a6ee27SJohannes Berg  * @IEEE80211_CHAN_NO_80MHZ: If the driver supports 80 MHz on the band,
103c7a6ee27SJohannes Berg  *	this flag indicates that an 80 MHz channel cannot use this
104c7a6ee27SJohannes Berg  *	channel as the control or any of the secondary channels.
105c7a6ee27SJohannes Berg  *	This may be due to the driver or due to regulatory bandwidth
106c7a6ee27SJohannes Berg  *	restrictions.
107c7a6ee27SJohannes Berg  * @IEEE80211_CHAN_NO_160MHZ: If the driver supports 160 MHz on the band,
108c7a6ee27SJohannes Berg  *	this flag indicates that an 160 MHz channel cannot use this
109c7a6ee27SJohannes Berg  *	channel as the control or any of the secondary channels.
110c7a6ee27SJohannes Berg  *	This may be due to the driver or due to regulatory bandwidth
111c7a6ee27SJohannes Berg  *	restrictions.
112d3236553SJohannes Berg  */
113d3236553SJohannes Berg enum ieee80211_channel_flags {
114d3236553SJohannes Berg 	IEEE80211_CHAN_DISABLED		= 1<<0,
115*8fe02e16SLuis R. Rodriguez 	IEEE80211_CHAN_NO_IR		= 1<<1,
116*8fe02e16SLuis R. Rodriguez 	/* hole at 1<<2 */
117d3236553SJohannes Berg 	IEEE80211_CHAN_RADAR		= 1<<3,
118689da1b3SLuis R. Rodriguez 	IEEE80211_CHAN_NO_HT40PLUS	= 1<<4,
119689da1b3SLuis R. Rodriguez 	IEEE80211_CHAN_NO_HT40MINUS	= 1<<5,
12003f6b084SSeth Forshee 	IEEE80211_CHAN_NO_OFDM		= 1<<6,
121c7a6ee27SJohannes Berg 	IEEE80211_CHAN_NO_80MHZ		= 1<<7,
122c7a6ee27SJohannes Berg 	IEEE80211_CHAN_NO_160MHZ	= 1<<8,
123d3236553SJohannes Berg };
124d3236553SJohannes Berg 
125038659e7SLuis R. Rodriguez #define IEEE80211_CHAN_NO_HT40 \
126689da1b3SLuis R. Rodriguez 	(IEEE80211_CHAN_NO_HT40PLUS | IEEE80211_CHAN_NO_HT40MINUS)
127038659e7SLuis R. Rodriguez 
12804f39047SSimon Wunderlich #define IEEE80211_DFS_MIN_CAC_TIME_MS		60000
12904f39047SSimon Wunderlich #define IEEE80211_DFS_MIN_NOP_TIME_MS		(30 * 60 * 1000)
13004f39047SSimon Wunderlich 
131d3236553SJohannes Berg /**
132d3236553SJohannes Berg  * struct ieee80211_channel - channel definition
133d3236553SJohannes Berg  *
134d3236553SJohannes Berg  * This structure describes a single channel for use
135d3236553SJohannes Berg  * with cfg80211.
136d3236553SJohannes Berg  *
137d3236553SJohannes Berg  * @center_freq: center frequency in MHz
138d3236553SJohannes Berg  * @hw_value: hardware-specific value for the channel
139d3236553SJohannes Berg  * @flags: channel flags from &enum ieee80211_channel_flags.
140d3236553SJohannes Berg  * @orig_flags: channel flags at registration time, used by regulatory
141d3236553SJohannes Berg  *	code to support devices with additional restrictions
142d3236553SJohannes Berg  * @band: band this channel belongs to.
143d3236553SJohannes Berg  * @max_antenna_gain: maximum antenna gain in dBi
144d3236553SJohannes Berg  * @max_power: maximum transmission power (in dBm)
145eccc068eSHong Wu  * @max_reg_power: maximum regulatory transmission power (in dBm)
146d3236553SJohannes Berg  * @beacon_found: helper to regulatory code to indicate when a beacon
147d3236553SJohannes Berg  *	has been found on this channel. Use regulatory_hint_found_beacon()
14877c2061dSWalter Goldens  *	to enable this, this is useful only on 5 GHz band.
149d3236553SJohannes Berg  * @orig_mag: internal use
150d3236553SJohannes Berg  * @orig_mpwr: internal use
15104f39047SSimon Wunderlich  * @dfs_state: current state of this channel. Only relevant if radar is required
15204f39047SSimon Wunderlich  *	on this channel.
15304f39047SSimon Wunderlich  * @dfs_state_entered: timestamp (jiffies) when the dfs state was entered.
154d3236553SJohannes Berg  */
155d3236553SJohannes Berg struct ieee80211_channel {
156d3236553SJohannes Berg 	enum ieee80211_band band;
157d3236553SJohannes Berg 	u16 center_freq;
158d3236553SJohannes Berg 	u16 hw_value;
159d3236553SJohannes Berg 	u32 flags;
160d3236553SJohannes Berg 	int max_antenna_gain;
161d3236553SJohannes Berg 	int max_power;
162eccc068eSHong Wu 	int max_reg_power;
163d3236553SJohannes Berg 	bool beacon_found;
164d3236553SJohannes Berg 	u32 orig_flags;
165d3236553SJohannes Berg 	int orig_mag, orig_mpwr;
16604f39047SSimon Wunderlich 	enum nl80211_dfs_state dfs_state;
16704f39047SSimon Wunderlich 	unsigned long dfs_state_entered;
168d3236553SJohannes Berg };
169d3236553SJohannes Berg 
170d3236553SJohannes Berg /**
171d3236553SJohannes Berg  * enum ieee80211_rate_flags - rate flags
172d3236553SJohannes Berg  *
173d3236553SJohannes Berg  * Hardware/specification flags for rates. These are structured
174d3236553SJohannes Berg  * in a way that allows using the same bitrate structure for
175d3236553SJohannes Berg  * different bands/PHY modes.
176d3236553SJohannes Berg  *
177d3236553SJohannes Berg  * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short
178d3236553SJohannes Berg  *	preamble on this bitrate; only relevant in 2.4GHz band and
179d3236553SJohannes Berg  *	with CCK rates.
180d3236553SJohannes Berg  * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate
181d3236553SJohannes Berg  *	when used with 802.11a (on the 5 GHz band); filled by the
182d3236553SJohannes Berg  *	core code when registering the wiphy.
183d3236553SJohannes Berg  * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate
184d3236553SJohannes Berg  *	when used with 802.11b (on the 2.4 GHz band); filled by the
185d3236553SJohannes Berg  *	core code when registering the wiphy.
186d3236553SJohannes Berg  * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate
187d3236553SJohannes Berg  *	when used with 802.11g (on the 2.4 GHz band); filled by the
188d3236553SJohannes Berg  *	core code when registering the wiphy.
189d3236553SJohannes Berg  * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode.
19030e74732SSimon Wunderlich  * @IEEE80211_RATE_SUPPORTS_5MHZ: Rate can be used in 5 MHz mode
19130e74732SSimon Wunderlich  * @IEEE80211_RATE_SUPPORTS_10MHZ: Rate can be used in 10 MHz mode
192d3236553SJohannes Berg  */
193d3236553SJohannes Berg enum ieee80211_rate_flags {
194d3236553SJohannes Berg 	IEEE80211_RATE_SHORT_PREAMBLE	= 1<<0,
195d3236553SJohannes Berg 	IEEE80211_RATE_MANDATORY_A	= 1<<1,
196d3236553SJohannes Berg 	IEEE80211_RATE_MANDATORY_B	= 1<<2,
197d3236553SJohannes Berg 	IEEE80211_RATE_MANDATORY_G	= 1<<3,
198d3236553SJohannes Berg 	IEEE80211_RATE_ERP_G		= 1<<4,
19930e74732SSimon Wunderlich 	IEEE80211_RATE_SUPPORTS_5MHZ	= 1<<5,
20030e74732SSimon Wunderlich 	IEEE80211_RATE_SUPPORTS_10MHZ	= 1<<6,
201d3236553SJohannes Berg };
202d3236553SJohannes Berg 
203d3236553SJohannes Berg /**
204d3236553SJohannes Berg  * struct ieee80211_rate - bitrate definition
205d3236553SJohannes Berg  *
206d3236553SJohannes Berg  * This structure describes a bitrate that an 802.11 PHY can
207d3236553SJohannes Berg  * operate with. The two values @hw_value and @hw_value_short
208d3236553SJohannes Berg  * are only for driver use when pointers to this structure are
209d3236553SJohannes Berg  * passed around.
210d3236553SJohannes Berg  *
211d3236553SJohannes Berg  * @flags: rate-specific flags
212d3236553SJohannes Berg  * @bitrate: bitrate in units of 100 Kbps
213d3236553SJohannes Berg  * @hw_value: driver/hardware value for this rate
214d3236553SJohannes Berg  * @hw_value_short: driver/hardware value for this rate when
215d3236553SJohannes Berg  *	short preamble is used
216d3236553SJohannes Berg  */
217d3236553SJohannes Berg struct ieee80211_rate {
218d3236553SJohannes Berg 	u32 flags;
219d3236553SJohannes Berg 	u16 bitrate;
220d3236553SJohannes Berg 	u16 hw_value, hw_value_short;
221d3236553SJohannes Berg };
222d3236553SJohannes Berg 
223d3236553SJohannes Berg /**
224d3236553SJohannes Berg  * struct ieee80211_sta_ht_cap - STA's HT capabilities
225d3236553SJohannes Berg  *
226d3236553SJohannes Berg  * This structure describes most essential parameters needed
227d3236553SJohannes Berg  * to describe 802.11n HT capabilities for an STA.
228d3236553SJohannes Berg  *
229d3236553SJohannes Berg  * @ht_supported: is HT supported by the STA
230d3236553SJohannes Berg  * @cap: HT capabilities map as described in 802.11n spec
231d3236553SJohannes Berg  * @ampdu_factor: Maximum A-MPDU length factor
232d3236553SJohannes Berg  * @ampdu_density: Minimum A-MPDU spacing
233d3236553SJohannes Berg  * @mcs: Supported MCS rates
234d3236553SJohannes Berg  */
235d3236553SJohannes Berg struct ieee80211_sta_ht_cap {
236d3236553SJohannes Berg 	u16 cap; /* use IEEE80211_HT_CAP_ */
237d3236553SJohannes Berg 	bool ht_supported;
238d3236553SJohannes Berg 	u8 ampdu_factor;
239d3236553SJohannes Berg 	u8 ampdu_density;
240d3236553SJohannes Berg 	struct ieee80211_mcs_info mcs;
241d3236553SJohannes Berg };
242d3236553SJohannes Berg 
243d3236553SJohannes Berg /**
244bf0c111eSMahesh Palivela  * struct ieee80211_sta_vht_cap - STA's VHT capabilities
245bf0c111eSMahesh Palivela  *
246bf0c111eSMahesh Palivela  * This structure describes most essential parameters needed
247bf0c111eSMahesh Palivela  * to describe 802.11ac VHT capabilities for an STA.
248bf0c111eSMahesh Palivela  *
249bf0c111eSMahesh Palivela  * @vht_supported: is VHT supported by the STA
250bf0c111eSMahesh Palivela  * @cap: VHT capabilities map as described in 802.11ac spec
251bf0c111eSMahesh Palivela  * @vht_mcs: Supported VHT MCS rates
252bf0c111eSMahesh Palivela  */
253bf0c111eSMahesh Palivela struct ieee80211_sta_vht_cap {
254bf0c111eSMahesh Palivela 	bool vht_supported;
255bf0c111eSMahesh Palivela 	u32 cap; /* use IEEE80211_VHT_CAP_ */
256bf0c111eSMahesh Palivela 	struct ieee80211_vht_mcs_info vht_mcs;
257bf0c111eSMahesh Palivela };
258bf0c111eSMahesh Palivela 
259bf0c111eSMahesh Palivela /**
260d3236553SJohannes Berg  * struct ieee80211_supported_band - frequency band definition
261d3236553SJohannes Berg  *
262d3236553SJohannes Berg  * This structure describes a frequency band a wiphy
263d3236553SJohannes Berg  * is able to operate in.
264d3236553SJohannes Berg  *
265d3236553SJohannes Berg  * @channels: Array of channels the hardware can operate in
266d3236553SJohannes Berg  *	in this band.
267d3236553SJohannes Berg  * @band: the band this structure represents
268d3236553SJohannes Berg  * @n_channels: Number of channels in @channels
269d3236553SJohannes Berg  * @bitrates: Array of bitrates the hardware can operate with
270d3236553SJohannes Berg  *	in this band. Must be sorted to give a valid "supported
271d3236553SJohannes Berg  *	rates" IE, i.e. CCK rates first, then OFDM.
272d3236553SJohannes Berg  * @n_bitrates: Number of bitrates in @bitrates
273abe37c4bSJohannes Berg  * @ht_cap: HT capabilities in this band
274c9a0a302SRobert P. J. Day  * @vht_cap: VHT capabilities in this band
275d3236553SJohannes Berg  */
276d3236553SJohannes Berg struct ieee80211_supported_band {
277d3236553SJohannes Berg 	struct ieee80211_channel *channels;
278d3236553SJohannes Berg 	struct ieee80211_rate *bitrates;
279d3236553SJohannes Berg 	enum ieee80211_band band;
280d3236553SJohannes Berg 	int n_channels;
281d3236553SJohannes Berg 	int n_bitrates;
282d3236553SJohannes Berg 	struct ieee80211_sta_ht_cap ht_cap;
283bf0c111eSMahesh Palivela 	struct ieee80211_sta_vht_cap vht_cap;
284d3236553SJohannes Berg };
285d3236553SJohannes Berg 
286d3236553SJohannes Berg /*
287d3236553SJohannes Berg  * Wireless hardware/device configuration structures and methods
288704232c2SJohannes Berg  */
289704232c2SJohannes Berg 
2902ec600d6SLuis Carlos Cobo /**
291d70e9693SJohannes Berg  * DOC: Actions and configuration
292d70e9693SJohannes Berg  *
293d70e9693SJohannes Berg  * Each wireless device and each virtual interface offer a set of configuration
294d70e9693SJohannes Berg  * operations and other actions that are invoked by userspace. Each of these
295d70e9693SJohannes Berg  * actions is described in the operations structure, and the parameters these
296d70e9693SJohannes Berg  * operations use are described separately.
297d70e9693SJohannes Berg  *
298d70e9693SJohannes Berg  * Additionally, some operations are asynchronous and expect to get status
299d70e9693SJohannes Berg  * information via some functions that drivers need to call.
300d70e9693SJohannes Berg  *
301d70e9693SJohannes Berg  * Scanning and BSS list handling with its associated functionality is described
302d70e9693SJohannes Berg  * in a separate chapter.
303d70e9693SJohannes Berg  */
304d70e9693SJohannes Berg 
305d70e9693SJohannes Berg /**
3062ec600d6SLuis Carlos Cobo  * struct vif_params - describes virtual interface parameters
3078b787643SFelix Fietkau  * @use_4addr: use 4-address frames
3081c18f145SArend van Spriel  * @macaddr: address to use for this virtual interface. This will only
3091c18f145SArend van Spriel  * 	be used for non-netdevice interfaces. If this parameter is set
3101c18f145SArend van Spriel  * 	to zero address the driver may determine the address as needed.
3112ec600d6SLuis Carlos Cobo  */
3122ec600d6SLuis Carlos Cobo struct vif_params {
3138b787643SFelix Fietkau        int use_4addr;
3141c18f145SArend van Spriel        u8 macaddr[ETH_ALEN];
3152ec600d6SLuis Carlos Cobo };
3162ec600d6SLuis Carlos Cobo 
31741ade00fSJohannes Berg /**
31841ade00fSJohannes Berg  * struct key_params - key information
31941ade00fSJohannes Berg  *
32041ade00fSJohannes Berg  * Information about a key
32141ade00fSJohannes Berg  *
32241ade00fSJohannes Berg  * @key: key material
32341ade00fSJohannes Berg  * @key_len: length of key material
32441ade00fSJohannes Berg  * @cipher: cipher suite selector
32541ade00fSJohannes Berg  * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used
32641ade00fSJohannes Berg  *	with the get_key() callback, must be in little endian,
32741ade00fSJohannes Berg  *	length given by @seq_len.
328abe37c4bSJohannes Berg  * @seq_len: length of @seq.
32941ade00fSJohannes Berg  */
33041ade00fSJohannes Berg struct key_params {
33141ade00fSJohannes Berg 	u8 *key;
33241ade00fSJohannes Berg 	u8 *seq;
33341ade00fSJohannes Berg 	int key_len;
33441ade00fSJohannes Berg 	int seq_len;
33541ade00fSJohannes Berg 	u32 cipher;
33641ade00fSJohannes Berg };
33741ade00fSJohannes Berg 
338ed1b6cc7SJohannes Berg /**
339683b6d3bSJohannes Berg  * struct cfg80211_chan_def - channel definition
340683b6d3bSJohannes Berg  * @chan: the (control) channel
3413d9d1d66SJohannes Berg  * @width: channel width
3423d9d1d66SJohannes Berg  * @center_freq1: center frequency of first segment
3433d9d1d66SJohannes Berg  * @center_freq2: center frequency of second segment
3443d9d1d66SJohannes Berg  *	(only with 80+80 MHz)
345683b6d3bSJohannes Berg  */
346683b6d3bSJohannes Berg struct cfg80211_chan_def {
347683b6d3bSJohannes Berg 	struct ieee80211_channel *chan;
3483d9d1d66SJohannes Berg 	enum nl80211_chan_width width;
3493d9d1d66SJohannes Berg 	u32 center_freq1;
3503d9d1d66SJohannes Berg 	u32 center_freq2;
351683b6d3bSJohannes Berg };
352683b6d3bSJohannes Berg 
3533d9d1d66SJohannes Berg /**
3543d9d1d66SJohannes Berg  * cfg80211_get_chandef_type - return old channel type from chandef
3553d9d1d66SJohannes Berg  * @chandef: the channel definition
3563d9d1d66SJohannes Berg  *
3570ae997dcSYacine Belkadi  * Return: The old channel type (NOHT, HT20, HT40+/-) from a given
3583d9d1d66SJohannes Berg  * chandef, which must have a bandwidth allowing this conversion.
3593d9d1d66SJohannes Berg  */
360683b6d3bSJohannes Berg static inline enum nl80211_channel_type
361683b6d3bSJohannes Berg cfg80211_get_chandef_type(const struct cfg80211_chan_def *chandef)
362683b6d3bSJohannes Berg {
3633d9d1d66SJohannes Berg 	switch (chandef->width) {
3643d9d1d66SJohannes Berg 	case NL80211_CHAN_WIDTH_20_NOHT:
3653d9d1d66SJohannes Berg 		return NL80211_CHAN_NO_HT;
3663d9d1d66SJohannes Berg 	case NL80211_CHAN_WIDTH_20:
3673d9d1d66SJohannes Berg 		return NL80211_CHAN_HT20;
3683d9d1d66SJohannes Berg 	case NL80211_CHAN_WIDTH_40:
3693d9d1d66SJohannes Berg 		if (chandef->center_freq1 > chandef->chan->center_freq)
3703d9d1d66SJohannes Berg 			return NL80211_CHAN_HT40PLUS;
3713d9d1d66SJohannes Berg 		return NL80211_CHAN_HT40MINUS;
3723d9d1d66SJohannes Berg 	default:
3733d9d1d66SJohannes Berg 		WARN_ON(1);
3743d9d1d66SJohannes Berg 		return NL80211_CHAN_NO_HT;
375683b6d3bSJohannes Berg 	}
3763d9d1d66SJohannes Berg }
3773d9d1d66SJohannes Berg 
3783d9d1d66SJohannes Berg /**
3793d9d1d66SJohannes Berg  * cfg80211_chandef_create - create channel definition using channel type
3803d9d1d66SJohannes Berg  * @chandef: the channel definition struct to fill
3813d9d1d66SJohannes Berg  * @channel: the control channel
3823d9d1d66SJohannes Berg  * @chantype: the channel type
3833d9d1d66SJohannes Berg  *
3843d9d1d66SJohannes Berg  * Given a channel type, create a channel definition.
3853d9d1d66SJohannes Berg  */
3863d9d1d66SJohannes Berg void cfg80211_chandef_create(struct cfg80211_chan_def *chandef,
3873d9d1d66SJohannes Berg 			     struct ieee80211_channel *channel,
3883d9d1d66SJohannes Berg 			     enum nl80211_channel_type chantype);
3893d9d1d66SJohannes Berg 
3903d9d1d66SJohannes Berg /**
3913d9d1d66SJohannes Berg  * cfg80211_chandef_identical - check if two channel definitions are identical
3923d9d1d66SJohannes Berg  * @chandef1: first channel definition
3933d9d1d66SJohannes Berg  * @chandef2: second channel definition
3943d9d1d66SJohannes Berg  *
3950ae997dcSYacine Belkadi  * Return: %true if the channels defined by the channel definitions are
3963d9d1d66SJohannes Berg  * identical, %false otherwise.
3973d9d1d66SJohannes Berg  */
3983d9d1d66SJohannes Berg static inline bool
3993d9d1d66SJohannes Berg cfg80211_chandef_identical(const struct cfg80211_chan_def *chandef1,
4003d9d1d66SJohannes Berg 			   const struct cfg80211_chan_def *chandef2)
4013d9d1d66SJohannes Berg {
4023d9d1d66SJohannes Berg 	return (chandef1->chan == chandef2->chan &&
4033d9d1d66SJohannes Berg 		chandef1->width == chandef2->width &&
4043d9d1d66SJohannes Berg 		chandef1->center_freq1 == chandef2->center_freq1 &&
4053d9d1d66SJohannes Berg 		chandef1->center_freq2 == chandef2->center_freq2);
4063d9d1d66SJohannes Berg }
4073d9d1d66SJohannes Berg 
4083d9d1d66SJohannes Berg /**
4093d9d1d66SJohannes Berg  * cfg80211_chandef_compatible - check if two channel definitions are compatible
4103d9d1d66SJohannes Berg  * @chandef1: first channel definition
4113d9d1d66SJohannes Berg  * @chandef2: second channel definition
4123d9d1d66SJohannes Berg  *
4130ae997dcSYacine Belkadi  * Return: %NULL if the given channel definitions are incompatible,
4143d9d1d66SJohannes Berg  * chandef1 or chandef2 otherwise.
4153d9d1d66SJohannes Berg  */
4163d9d1d66SJohannes Berg const struct cfg80211_chan_def *
4173d9d1d66SJohannes Berg cfg80211_chandef_compatible(const struct cfg80211_chan_def *chandef1,
4183d9d1d66SJohannes Berg 			    const struct cfg80211_chan_def *chandef2);
419683b6d3bSJohannes Berg 
420683b6d3bSJohannes Berg /**
4219f5e8f6eSJohannes Berg  * cfg80211_chandef_valid - check if a channel definition is valid
4229f5e8f6eSJohannes Berg  * @chandef: the channel definition to check
4230ae997dcSYacine Belkadi  * Return: %true if the channel definition is valid. %false otherwise.
4249f5e8f6eSJohannes Berg  */
4259f5e8f6eSJohannes Berg bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef);
4269f5e8f6eSJohannes Berg 
4279f5e8f6eSJohannes Berg /**
4289f5e8f6eSJohannes Berg  * cfg80211_chandef_usable - check if secondary channels can be used
4299f5e8f6eSJohannes Berg  * @wiphy: the wiphy to validate against
4309f5e8f6eSJohannes Berg  * @chandef: the channel definition to check
4310ae997dcSYacine Belkadi  * @prohibited_flags: the regulatory channel flags that must not be set
4320ae997dcSYacine Belkadi  * Return: %true if secondary channels are usable. %false otherwise.
4339f5e8f6eSJohannes Berg  */
4349f5e8f6eSJohannes Berg bool cfg80211_chandef_usable(struct wiphy *wiphy,
4359f5e8f6eSJohannes Berg 			     const struct cfg80211_chan_def *chandef,
4369f5e8f6eSJohannes Berg 			     u32 prohibited_flags);
4379f5e8f6eSJohannes Berg 
4389f5e8f6eSJohannes Berg /**
439774f0734SSimon Wunderlich  * cfg80211_chandef_dfs_required - checks if radar detection is required
440774f0734SSimon Wunderlich  * @wiphy: the wiphy to validate against
441774f0734SSimon Wunderlich  * @chandef: the channel definition to check
442774f0734SSimon Wunderlich  * Return: 1 if radar detection is required, 0 if it is not, < 0 on error
443774f0734SSimon Wunderlich  */
444774f0734SSimon Wunderlich int cfg80211_chandef_dfs_required(struct wiphy *wiphy,
445774f0734SSimon Wunderlich 				  const struct cfg80211_chan_def *chandef);
446774f0734SSimon Wunderlich 
447774f0734SSimon Wunderlich /**
44830e74732SSimon Wunderlich  * ieee80211_chandef_rate_flags - returns rate flags for a channel
44930e74732SSimon Wunderlich  *
45030e74732SSimon Wunderlich  * In some channel types, not all rates may be used - for example CCK
45130e74732SSimon Wunderlich  * rates may not be used in 5/10 MHz channels.
45230e74732SSimon Wunderlich  *
45330e74732SSimon Wunderlich  * @chandef: channel definition for the channel
45430e74732SSimon Wunderlich  *
45530e74732SSimon Wunderlich  * Returns: rate flags which apply for this channel
45630e74732SSimon Wunderlich  */
45730e74732SSimon Wunderlich static inline enum ieee80211_rate_flags
45830e74732SSimon Wunderlich ieee80211_chandef_rate_flags(struct cfg80211_chan_def *chandef)
45930e74732SSimon Wunderlich {
46030e74732SSimon Wunderlich 	switch (chandef->width) {
46130e74732SSimon Wunderlich 	case NL80211_CHAN_WIDTH_5:
46230e74732SSimon Wunderlich 		return IEEE80211_RATE_SUPPORTS_5MHZ;
46330e74732SSimon Wunderlich 	case NL80211_CHAN_WIDTH_10:
46430e74732SSimon Wunderlich 		return IEEE80211_RATE_SUPPORTS_10MHZ;
46530e74732SSimon Wunderlich 	default:
46630e74732SSimon Wunderlich 		break;
46730e74732SSimon Wunderlich 	}
46830e74732SSimon Wunderlich 	return 0;
46930e74732SSimon Wunderlich }
47030e74732SSimon Wunderlich 
47130e74732SSimon Wunderlich /**
4720430c883SSimon Wunderlich  * ieee80211_chandef_max_power - maximum transmission power for the chandef
4730430c883SSimon Wunderlich  *
4740430c883SSimon Wunderlich  * In some regulations, the transmit power may depend on the configured channel
4750430c883SSimon Wunderlich  * bandwidth which may be defined as dBm/MHz. This function returns the actual
4760430c883SSimon Wunderlich  * max_power for non-standard (20 MHz) channels.
4770430c883SSimon Wunderlich  *
4780430c883SSimon Wunderlich  * @chandef: channel definition for the channel
4790430c883SSimon Wunderlich  *
4800430c883SSimon Wunderlich  * Returns: maximum allowed transmission power in dBm for the chandef
4810430c883SSimon Wunderlich  */
4820430c883SSimon Wunderlich static inline int
4830430c883SSimon Wunderlich ieee80211_chandef_max_power(struct cfg80211_chan_def *chandef)
4840430c883SSimon Wunderlich {
4850430c883SSimon Wunderlich 	switch (chandef->width) {
4860430c883SSimon Wunderlich 	case NL80211_CHAN_WIDTH_5:
4870430c883SSimon Wunderlich 		return min(chandef->chan->max_reg_power - 6,
4880430c883SSimon Wunderlich 			   chandef->chan->max_power);
4890430c883SSimon Wunderlich 	case NL80211_CHAN_WIDTH_10:
4900430c883SSimon Wunderlich 		return min(chandef->chan->max_reg_power - 3,
4910430c883SSimon Wunderlich 			   chandef->chan->max_power);
4920430c883SSimon Wunderlich 	default:
4930430c883SSimon Wunderlich 		break;
4940430c883SSimon Wunderlich 	}
4950430c883SSimon Wunderlich 	return chandef->chan->max_power;
4960430c883SSimon Wunderlich }
4970430c883SSimon Wunderlich 
4980430c883SSimon Wunderlich /**
49961fa713cSHolger Schurig  * enum survey_info_flags - survey information flags
50061fa713cSHolger Schurig  *
501abe37c4bSJohannes Berg  * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in
50217e5a808SFelix Fietkau  * @SURVEY_INFO_IN_USE: channel is currently being used
5038610c29aSFelix Fietkau  * @SURVEY_INFO_CHANNEL_TIME: channel active time (in ms) was filled in
5048610c29aSFelix Fietkau  * @SURVEY_INFO_CHANNEL_TIME_BUSY: channel busy time was filled in
5058610c29aSFelix Fietkau  * @SURVEY_INFO_CHANNEL_TIME_EXT_BUSY: extension channel busy time was filled in
5068610c29aSFelix Fietkau  * @SURVEY_INFO_CHANNEL_TIME_RX: channel receive time was filled in
5078610c29aSFelix Fietkau  * @SURVEY_INFO_CHANNEL_TIME_TX: channel transmit time was filled in
508abe37c4bSJohannes Berg  *
50961fa713cSHolger Schurig  * Used by the driver to indicate which info in &struct survey_info
51061fa713cSHolger Schurig  * it has filled in during the get_survey().
51161fa713cSHolger Schurig  */
51261fa713cSHolger Schurig enum survey_info_flags {
51361fa713cSHolger Schurig 	SURVEY_INFO_NOISE_DBM = 1<<0,
51417e5a808SFelix Fietkau 	SURVEY_INFO_IN_USE = 1<<1,
5158610c29aSFelix Fietkau 	SURVEY_INFO_CHANNEL_TIME = 1<<2,
5168610c29aSFelix Fietkau 	SURVEY_INFO_CHANNEL_TIME_BUSY = 1<<3,
5178610c29aSFelix Fietkau 	SURVEY_INFO_CHANNEL_TIME_EXT_BUSY = 1<<4,
5188610c29aSFelix Fietkau 	SURVEY_INFO_CHANNEL_TIME_RX = 1<<5,
5198610c29aSFelix Fietkau 	SURVEY_INFO_CHANNEL_TIME_TX = 1<<6,
52061fa713cSHolger Schurig };
52161fa713cSHolger Schurig 
52261fa713cSHolger Schurig /**
52361fa713cSHolger Schurig  * struct survey_info - channel survey response
52461fa713cSHolger Schurig  *
52561fa713cSHolger Schurig  * @channel: the channel this survey record reports, mandatory
52661fa713cSHolger Schurig  * @filled: bitflag of flags from &enum survey_info_flags
52761fa713cSHolger Schurig  * @noise: channel noise in dBm. This and all following fields are
52861fa713cSHolger Schurig  *	optional
5298610c29aSFelix Fietkau  * @channel_time: amount of time in ms the radio spent on the channel
5308610c29aSFelix Fietkau  * @channel_time_busy: amount of time the primary channel was sensed busy
5318610c29aSFelix Fietkau  * @channel_time_ext_busy: amount of time the extension channel was sensed busy
5328610c29aSFelix Fietkau  * @channel_time_rx: amount of time the radio spent receiving data
5338610c29aSFelix Fietkau  * @channel_time_tx: amount of time the radio spent transmitting data
53461fa713cSHolger Schurig  *
535abe37c4bSJohannes Berg  * Used by dump_survey() to report back per-channel survey information.
536abe37c4bSJohannes Berg  *
53761fa713cSHolger Schurig  * This structure can later be expanded with things like
53861fa713cSHolger Schurig  * channel duty cycle etc.
53961fa713cSHolger Schurig  */
54061fa713cSHolger Schurig struct survey_info {
54161fa713cSHolger Schurig 	struct ieee80211_channel *channel;
5428610c29aSFelix Fietkau 	u64 channel_time;
5438610c29aSFelix Fietkau 	u64 channel_time_busy;
5448610c29aSFelix Fietkau 	u64 channel_time_ext_busy;
5458610c29aSFelix Fietkau 	u64 channel_time_rx;
5468610c29aSFelix Fietkau 	u64 channel_time_tx;
54761fa713cSHolger Schurig 	u32 filled;
54861fa713cSHolger Schurig 	s8 noise;
54961fa713cSHolger Schurig };
55061fa713cSHolger Schurig 
55161fa713cSHolger Schurig /**
5525fb628e9SJouni Malinen  * struct cfg80211_crypto_settings - Crypto settings
5535fb628e9SJouni Malinen  * @wpa_versions: indicates which, if any, WPA versions are enabled
5545fb628e9SJouni Malinen  *	(from enum nl80211_wpa_versions)
5555fb628e9SJouni Malinen  * @cipher_group: group key cipher suite (or 0 if unset)
5565fb628e9SJouni Malinen  * @n_ciphers_pairwise: number of AP supported unicast ciphers
5575fb628e9SJouni Malinen  * @ciphers_pairwise: unicast key cipher suites
5585fb628e9SJouni Malinen  * @n_akm_suites: number of AKM suites
5595fb628e9SJouni Malinen  * @akm_suites: AKM suites
5605fb628e9SJouni Malinen  * @control_port: Whether user space controls IEEE 802.1X port, i.e.,
5615fb628e9SJouni Malinen  *	sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
5625fb628e9SJouni Malinen  *	required to assume that the port is unauthorized until authorized by
5635fb628e9SJouni Malinen  *	user space. Otherwise, port is marked authorized by default.
5645fb628e9SJouni Malinen  * @control_port_ethertype: the control port protocol that should be
5655fb628e9SJouni Malinen  *	allowed through even on unauthorized ports
5665fb628e9SJouni Malinen  * @control_port_no_encrypt: TRUE to prevent encryption of control port
5675fb628e9SJouni Malinen  *	protocol frames.
5685fb628e9SJouni Malinen  */
5695fb628e9SJouni Malinen struct cfg80211_crypto_settings {
5705fb628e9SJouni Malinen 	u32 wpa_versions;
5715fb628e9SJouni Malinen 	u32 cipher_group;
5725fb628e9SJouni Malinen 	int n_ciphers_pairwise;
5735fb628e9SJouni Malinen 	u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES];
5745fb628e9SJouni Malinen 	int n_akm_suites;
5755fb628e9SJouni Malinen 	u32 akm_suites[NL80211_MAX_NR_AKM_SUITES];
5765fb628e9SJouni Malinen 	bool control_port;
5775fb628e9SJouni Malinen 	__be16 control_port_ethertype;
5785fb628e9SJouni Malinen 	bool control_port_no_encrypt;
5795fb628e9SJouni Malinen };
5805fb628e9SJouni Malinen 
5815fb628e9SJouni Malinen /**
5828860020eSJohannes Berg  * struct cfg80211_beacon_data - beacon data
583ed1b6cc7SJohannes Berg  * @head: head portion of beacon (before TIM IE)
584ed1b6cc7SJohannes Berg  *	or %NULL if not changed
585ed1b6cc7SJohannes Berg  * @tail: tail portion of beacon (after TIM IE)
586ed1b6cc7SJohannes Berg  *	or %NULL if not changed
587ed1b6cc7SJohannes Berg  * @head_len: length of @head
588ed1b6cc7SJohannes Berg  * @tail_len: length of @tail
5899946ecfbSJouni Malinen  * @beacon_ies: extra information element(s) to add into Beacon frames or %NULL
5909946ecfbSJouni Malinen  * @beacon_ies_len: length of beacon_ies in octets
5919946ecfbSJouni Malinen  * @proberesp_ies: extra information element(s) to add into Probe Response
5929946ecfbSJouni Malinen  *	frames or %NULL
5939946ecfbSJouni Malinen  * @proberesp_ies_len: length of proberesp_ies in octets
5949946ecfbSJouni Malinen  * @assocresp_ies: extra information element(s) to add into (Re)Association
5959946ecfbSJouni Malinen  *	Response frames or %NULL
5969946ecfbSJouni Malinen  * @assocresp_ies_len: length of assocresp_ies in octets
59700f740e1SArik Nemtsov  * @probe_resp_len: length of probe response template (@probe_resp)
59800f740e1SArik Nemtsov  * @probe_resp: probe response template (AP mode only)
599ed1b6cc7SJohannes Berg  */
6008860020eSJohannes Berg struct cfg80211_beacon_data {
6018860020eSJohannes Berg 	const u8 *head, *tail;
6028860020eSJohannes Berg 	const u8 *beacon_ies;
6038860020eSJohannes Berg 	const u8 *proberesp_ies;
6048860020eSJohannes Berg 	const u8 *assocresp_ies;
6058860020eSJohannes Berg 	const u8 *probe_resp;
6068860020eSJohannes Berg 
6078860020eSJohannes Berg 	size_t head_len, tail_len;
6088860020eSJohannes Berg 	size_t beacon_ies_len;
6098860020eSJohannes Berg 	size_t proberesp_ies_len;
6108860020eSJohannes Berg 	size_t assocresp_ies_len;
6118860020eSJohannes Berg 	size_t probe_resp_len;
6128860020eSJohannes Berg };
6138860020eSJohannes Berg 
6146d45a74bSVasanthakumar Thiagarajan struct mac_address {
6156d45a74bSVasanthakumar Thiagarajan 	u8 addr[ETH_ALEN];
6166d45a74bSVasanthakumar Thiagarajan };
6176d45a74bSVasanthakumar Thiagarajan 
6188860020eSJohannes Berg /**
61977765eafSVasanthakumar Thiagarajan  * struct cfg80211_acl_data - Access control list data
62077765eafSVasanthakumar Thiagarajan  *
62177765eafSVasanthakumar Thiagarajan  * @acl_policy: ACL policy to be applied on the station's
622077f897aSJohannes Berg  *	entry specified by mac_addr
62377765eafSVasanthakumar Thiagarajan  * @n_acl_entries: Number of MAC address entries passed
62477765eafSVasanthakumar Thiagarajan  * @mac_addrs: List of MAC addresses of stations to be used for ACL
62577765eafSVasanthakumar Thiagarajan  */
62677765eafSVasanthakumar Thiagarajan struct cfg80211_acl_data {
62777765eafSVasanthakumar Thiagarajan 	enum nl80211_acl_policy acl_policy;
62877765eafSVasanthakumar Thiagarajan 	int n_acl_entries;
62977765eafSVasanthakumar Thiagarajan 
63077765eafSVasanthakumar Thiagarajan 	/* Keep it last */
63177765eafSVasanthakumar Thiagarajan 	struct mac_address mac_addrs[];
63277765eafSVasanthakumar Thiagarajan };
63377765eafSVasanthakumar Thiagarajan 
6348860020eSJohannes Berg /**
6358860020eSJohannes Berg  * struct cfg80211_ap_settings - AP configuration
6368860020eSJohannes Berg  *
6378860020eSJohannes Berg  * Used to configure an AP interface.
6388860020eSJohannes Berg  *
639683b6d3bSJohannes Berg  * @chandef: defines the channel to use
6408860020eSJohannes Berg  * @beacon: beacon data
6418860020eSJohannes Berg  * @beacon_interval: beacon interval
6428860020eSJohannes Berg  * @dtim_period: DTIM period
6438860020eSJohannes Berg  * @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from
6448860020eSJohannes Berg  *	user space)
6458860020eSJohannes Berg  * @ssid_len: length of @ssid
6468860020eSJohannes Berg  * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames
6478860020eSJohannes Berg  * @crypto: crypto settings
6488860020eSJohannes Berg  * @privacy: the BSS uses privacy
6498860020eSJohannes Berg  * @auth_type: Authentication type (algorithm)
6501b658f11SVasanthakumar Thiagarajan  * @inactivity_timeout: time in seconds to determine station's inactivity.
65153cabad7SJohannes Berg  * @p2p_ctwindow: P2P CT Window
65253cabad7SJohannes Berg  * @p2p_opp_ps: P2P opportunistic PS
65377765eafSVasanthakumar Thiagarajan  * @acl: ACL configuration used by the drivers which has support for
65477765eafSVasanthakumar Thiagarajan  *	MAC address based access control
65504f39047SSimon Wunderlich  * @radar_required: set if radar detection is required
6568860020eSJohannes Berg  */
6578860020eSJohannes Berg struct cfg80211_ap_settings {
658683b6d3bSJohannes Berg 	struct cfg80211_chan_def chandef;
659aa430da4SJohannes Berg 
6608860020eSJohannes Berg 	struct cfg80211_beacon_data beacon;
6618860020eSJohannes Berg 
6628860020eSJohannes Berg 	int beacon_interval, dtim_period;
66332e9de84SJouni Malinen 	const u8 *ssid;
66432e9de84SJouni Malinen 	size_t ssid_len;
66532e9de84SJouni Malinen 	enum nl80211_hidden_ssid hidden_ssid;
6665fb628e9SJouni Malinen 	struct cfg80211_crypto_settings crypto;
6675fb628e9SJouni Malinen 	bool privacy;
6685fb628e9SJouni Malinen 	enum nl80211_auth_type auth_type;
6691b658f11SVasanthakumar Thiagarajan 	int inactivity_timeout;
67053cabad7SJohannes Berg 	u8 p2p_ctwindow;
67153cabad7SJohannes Berg 	bool p2p_opp_ps;
67277765eafSVasanthakumar Thiagarajan 	const struct cfg80211_acl_data *acl;
67304f39047SSimon Wunderlich 	bool radar_required;
674ed1b6cc7SJohannes Berg };
675ed1b6cc7SJohannes Berg 
6765727ef1bSJohannes Berg /**
67716ef1fe2SSimon Wunderlich  * struct cfg80211_csa_settings - channel switch settings
67816ef1fe2SSimon Wunderlich  *
67916ef1fe2SSimon Wunderlich  * Used for channel switch
68016ef1fe2SSimon Wunderlich  *
68116ef1fe2SSimon Wunderlich  * @chandef: defines the channel to use after the switch
68216ef1fe2SSimon Wunderlich  * @beacon_csa: beacon data while performing the switch
68316ef1fe2SSimon Wunderlich  * @counter_offset_beacon: offset for the counter within the beacon (tail)
68416ef1fe2SSimon Wunderlich  * @counter_offset_presp: offset for the counter within the probe response
68516ef1fe2SSimon Wunderlich  * @beacon_after: beacon data to be used on the new channel
68616ef1fe2SSimon Wunderlich  * @radar_required: whether radar detection is required on the new channel
68716ef1fe2SSimon Wunderlich  * @block_tx: whether transmissions should be blocked while changing
68816ef1fe2SSimon Wunderlich  * @count: number of beacons until switch
68916ef1fe2SSimon Wunderlich  */
69016ef1fe2SSimon Wunderlich struct cfg80211_csa_settings {
69116ef1fe2SSimon Wunderlich 	struct cfg80211_chan_def chandef;
69216ef1fe2SSimon Wunderlich 	struct cfg80211_beacon_data beacon_csa;
69316ef1fe2SSimon Wunderlich 	u16 counter_offset_beacon, counter_offset_presp;
69416ef1fe2SSimon Wunderlich 	struct cfg80211_beacon_data beacon_after;
69516ef1fe2SSimon Wunderlich 	bool radar_required;
69616ef1fe2SSimon Wunderlich 	bool block_tx;
69716ef1fe2SSimon Wunderlich 	u8 count;
69816ef1fe2SSimon Wunderlich };
69916ef1fe2SSimon Wunderlich 
70016ef1fe2SSimon Wunderlich /**
7013b9ce80cSJohannes Berg  * enum station_parameters_apply_mask - station parameter values to apply
7023b9ce80cSJohannes Berg  * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp)
7039d62a986SJouni Malinen  * @STATION_PARAM_APPLY_CAPABILITY: apply new capability
704f8bacc21SJohannes Berg  * @STATION_PARAM_APPLY_PLINK_STATE: apply new plink state
7053b9ce80cSJohannes Berg  *
7063b9ce80cSJohannes Berg  * Not all station parameters have in-band "no change" signalling,
7073b9ce80cSJohannes Berg  * for those that don't these flags will are used.
7083b9ce80cSJohannes Berg  */
7093b9ce80cSJohannes Berg enum station_parameters_apply_mask {
7103b9ce80cSJohannes Berg 	STATION_PARAM_APPLY_UAPSD = BIT(0),
7119d62a986SJouni Malinen 	STATION_PARAM_APPLY_CAPABILITY = BIT(1),
712f8bacc21SJohannes Berg 	STATION_PARAM_APPLY_PLINK_STATE = BIT(2),
7133b9ce80cSJohannes Berg };
7143b9ce80cSJohannes Berg 
7153b9ce80cSJohannes Berg /**
7165727ef1bSJohannes Berg  * struct station_parameters - station parameters
7175727ef1bSJohannes Berg  *
7185727ef1bSJohannes Berg  * Used to change and create a new station.
7195727ef1bSJohannes Berg  *
7205727ef1bSJohannes Berg  * @vlan: vlan interface station should belong to
7215727ef1bSJohannes Berg  * @supported_rates: supported rates in IEEE 802.11 format
7225727ef1bSJohannes Berg  *	(or NULL for no change)
7235727ef1bSJohannes Berg  * @supported_rates_len: number of supported rates
724eccb8e8fSJohannes Berg  * @sta_flags_mask: station flags that changed
725eccb8e8fSJohannes Berg  *	(bitmask of BIT(NL80211_STA_FLAG_...))
726eccb8e8fSJohannes Berg  * @sta_flags_set: station flags values
727eccb8e8fSJohannes Berg  *	(bitmask of BIT(NL80211_STA_FLAG_...))
7285727ef1bSJohannes Berg  * @listen_interval: listen interval or -1 for no change
7295727ef1bSJohannes Berg  * @aid: AID or zero for no change
730abe37c4bSJohannes Berg  * @plink_action: plink action to take
7319c3990aaSJavier Cardona  * @plink_state: set the peer link state for a station
732abe37c4bSJohannes Berg  * @ht_capa: HT capabilities of station
733f461be3eSMahesh Palivela  * @vht_capa: VHT capabilities of station
734910868dbSEliad Peller  * @uapsd_queues: bitmap of queues configured for uapsd. same format
735910868dbSEliad Peller  *	as the AC bitmap in the QoS info field
736910868dbSEliad Peller  * @max_sp: max Service Period. same format as the MAX_SP in the
737910868dbSEliad Peller  *	QoS info field (but already shifted down)
738c26887d2SJohannes Berg  * @sta_modify_mask: bitmap indicating which parameters changed
739c26887d2SJohannes Berg  *	(for those that don't have a natural "no change" value),
740c26887d2SJohannes Berg  *	see &enum station_parameters_apply_mask
7413b1c5a53SMarco Porsch  * @local_pm: local link-specific mesh power save mode (no change when set
7423b1c5a53SMarco Porsch  *	to unknown)
7439d62a986SJouni Malinen  * @capability: station capability
7449d62a986SJouni Malinen  * @ext_capab: extended capabilities of the station
7459d62a986SJouni Malinen  * @ext_capab_len: number of extended capabilities
746c01fc9adSSunil Dutt  * @supported_channels: supported channels in IEEE 802.11 format
747c01fc9adSSunil Dutt  * @supported_channels_len: number of supported channels
748c01fc9adSSunil Dutt  * @supported_oper_classes: supported oper classes in IEEE 802.11 format
749c01fc9adSSunil Dutt  * @supported_oper_classes_len: number of supported operating classes
7505727ef1bSJohannes Berg  */
7515727ef1bSJohannes Berg struct station_parameters {
7522c1aabf3SJohannes Berg 	const u8 *supported_rates;
7535727ef1bSJohannes Berg 	struct net_device *vlan;
754eccb8e8fSJohannes Berg 	u32 sta_flags_mask, sta_flags_set;
7553b9ce80cSJohannes Berg 	u32 sta_modify_mask;
7565727ef1bSJohannes Berg 	int listen_interval;
7575727ef1bSJohannes Berg 	u16 aid;
7585727ef1bSJohannes Berg 	u8 supported_rates_len;
7592ec600d6SLuis Carlos Cobo 	u8 plink_action;
7609c3990aaSJavier Cardona 	u8 plink_state;
7612c1aabf3SJohannes Berg 	const struct ieee80211_ht_cap *ht_capa;
7622c1aabf3SJohannes Berg 	const struct ieee80211_vht_cap *vht_capa;
763c75786c9SEliad Peller 	u8 uapsd_queues;
764c75786c9SEliad Peller 	u8 max_sp;
7653b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode local_pm;
7669d62a986SJouni Malinen 	u16 capability;
7672c1aabf3SJohannes Berg 	const u8 *ext_capab;
7689d62a986SJouni Malinen 	u8 ext_capab_len;
769c01fc9adSSunil Dutt 	const u8 *supported_channels;
770c01fc9adSSunil Dutt 	u8 supported_channels_len;
771c01fc9adSSunil Dutt 	const u8 *supported_oper_classes;
772c01fc9adSSunil Dutt 	u8 supported_oper_classes_len;
7735727ef1bSJohannes Berg };
7745727ef1bSJohannes Berg 
775fd5b74dcSJohannes Berg /**
77677ee7c89SJohannes Berg  * enum cfg80211_station_type - the type of station being modified
77777ee7c89SJohannes Berg  * @CFG80211_STA_AP_CLIENT: client of an AP interface
77877ee7c89SJohannes Berg  * @CFG80211_STA_AP_MLME_CLIENT: client of an AP interface that has
77977ee7c89SJohannes Berg  *	the AP MLME in the device
78077ee7c89SJohannes Berg  * @CFG80211_STA_AP_STA: AP station on managed interface
78177ee7c89SJohannes Berg  * @CFG80211_STA_IBSS: IBSS station
78277ee7c89SJohannes Berg  * @CFG80211_STA_TDLS_PEER_SETUP: TDLS peer on managed interface (dummy entry
78377ee7c89SJohannes Berg  *	while TDLS setup is in progress, it moves out of this state when
78477ee7c89SJohannes Berg  *	being marked authorized; use this only if TDLS with external setup is
78577ee7c89SJohannes Berg  *	supported/used)
78677ee7c89SJohannes Berg  * @CFG80211_STA_TDLS_PEER_ACTIVE: TDLS peer on managed interface (active
78777ee7c89SJohannes Berg  *	entry that is operating, has been marked authorized by userspace)
788eef941e6SThomas Pedersen  * @CFG80211_STA_MESH_PEER_KERNEL: peer on mesh interface (kernel managed)
789eef941e6SThomas Pedersen  * @CFG80211_STA_MESH_PEER_USER: peer on mesh interface (user managed)
79077ee7c89SJohannes Berg  */
79177ee7c89SJohannes Berg enum cfg80211_station_type {
79277ee7c89SJohannes Berg 	CFG80211_STA_AP_CLIENT,
79377ee7c89SJohannes Berg 	CFG80211_STA_AP_MLME_CLIENT,
79477ee7c89SJohannes Berg 	CFG80211_STA_AP_STA,
79577ee7c89SJohannes Berg 	CFG80211_STA_IBSS,
79677ee7c89SJohannes Berg 	CFG80211_STA_TDLS_PEER_SETUP,
79777ee7c89SJohannes Berg 	CFG80211_STA_TDLS_PEER_ACTIVE,
798eef941e6SThomas Pedersen 	CFG80211_STA_MESH_PEER_KERNEL,
799eef941e6SThomas Pedersen 	CFG80211_STA_MESH_PEER_USER,
80077ee7c89SJohannes Berg };
80177ee7c89SJohannes Berg 
80277ee7c89SJohannes Berg /**
80377ee7c89SJohannes Berg  * cfg80211_check_station_change - validate parameter changes
80477ee7c89SJohannes Berg  * @wiphy: the wiphy this operates on
80577ee7c89SJohannes Berg  * @params: the new parameters for a station
80677ee7c89SJohannes Berg  * @statype: the type of station being modified
80777ee7c89SJohannes Berg  *
80877ee7c89SJohannes Berg  * Utility function for the @change_station driver method. Call this function
80977ee7c89SJohannes Berg  * with the appropriate station type looking up the station (and checking that
81077ee7c89SJohannes Berg  * it exists). It will verify whether the station change is acceptable, and if
81177ee7c89SJohannes Berg  * not will return an error code. Note that it may modify the parameters for
81277ee7c89SJohannes Berg  * backward compatibility reasons, so don't use them before calling this.
81377ee7c89SJohannes Berg  */
81477ee7c89SJohannes Berg int cfg80211_check_station_change(struct wiphy *wiphy,
81577ee7c89SJohannes Berg 				  struct station_parameters *params,
81677ee7c89SJohannes Berg 				  enum cfg80211_station_type statype);
81777ee7c89SJohannes Berg 
81877ee7c89SJohannes Berg /**
8192ec600d6SLuis Carlos Cobo  * enum station_info_flags - station information flags
820fd5b74dcSJohannes Berg  *
8212ec600d6SLuis Carlos Cobo  * Used by the driver to indicate which info in &struct station_info
8222ec600d6SLuis Carlos Cobo  * it has filled in during get_station() or dump_station().
823fd5b74dcSJohannes Berg  *
8242ec600d6SLuis Carlos Cobo  * @STATION_INFO_INACTIVE_TIME: @inactive_time filled
8252ec600d6SLuis Carlos Cobo  * @STATION_INFO_RX_BYTES: @rx_bytes filled
8262ec600d6SLuis Carlos Cobo  * @STATION_INFO_TX_BYTES: @tx_bytes filled
827077f897aSJohannes Berg  * @STATION_INFO_RX_BYTES64: @rx_bytes filled with 64-bit value
828077f897aSJohannes Berg  * @STATION_INFO_TX_BYTES64: @tx_bytes filled with 64-bit value
8292ec600d6SLuis Carlos Cobo  * @STATION_INFO_LLID: @llid filled
8302ec600d6SLuis Carlos Cobo  * @STATION_INFO_PLID: @plid filled
8312ec600d6SLuis Carlos Cobo  * @STATION_INFO_PLINK_STATE: @plink_state filled
832420e7fabSHenning Rogge  * @STATION_INFO_SIGNAL: @signal filled
833c8dcfd8aSFelix Fietkau  * @STATION_INFO_TX_BITRATE: @txrate fields are filled
834420e7fabSHenning Rogge  *	(tx_bitrate, tx_bitrate_flags and tx_bitrate_mcs)
83542745e03SVladimir Kondratiev  * @STATION_INFO_RX_PACKETS: @rx_packets filled with 32-bit value
83642745e03SVladimir Kondratiev  * @STATION_INFO_TX_PACKETS: @tx_packets filled with 32-bit value
837b206b4efSBruno Randolf  * @STATION_INFO_TX_RETRIES: @tx_retries filled
838b206b4efSBruno Randolf  * @STATION_INFO_TX_FAILED: @tx_failed filled
8395a5c731aSBen Greear  * @STATION_INFO_RX_DROP_MISC: @rx_dropped_misc filled
840541a45a1SBruno Randolf  * @STATION_INFO_SIGNAL_AVG: @signal_avg filled
841c8dcfd8aSFelix Fietkau  * @STATION_INFO_RX_BITRATE: @rxrate fields are filled
842f4263c98SPaul Stewart  * @STATION_INFO_BSS_PARAM: @bss_param filled
843ebe27c91SMohammed Shafi Shajakhan  * @STATION_INFO_CONNECTED_TIME: @connected_time filled
844040bdf71SFelix Fietkau  * @STATION_INFO_ASSOC_REQ_IES: @assoc_req_ies filled
845bb6e753eSHelmut Schaa  * @STATION_INFO_STA_FLAGS: @sta_flags filled
846a85e1d55SPaul Stewart  * @STATION_INFO_BEACON_LOSS_COUNT: @beacon_loss_count filled
847d299a1f2SJavier Cardona  * @STATION_INFO_T_OFFSET: @t_offset filled
8483b1c5a53SMarco Porsch  * @STATION_INFO_LOCAL_PM: @local_pm filled
8493b1c5a53SMarco Porsch  * @STATION_INFO_PEER_PM: @peer_pm filled
8503b1c5a53SMarco Porsch  * @STATION_INFO_NONPEER_PM: @nonpeer_pm filled
851119363c7SFelix Fietkau  * @STATION_INFO_CHAIN_SIGNAL: @chain_signal filled
852119363c7SFelix Fietkau  * @STATION_INFO_CHAIN_SIGNAL_AVG: @chain_signal_avg filled
853fd5b74dcSJohannes Berg  */
8542ec600d6SLuis Carlos Cobo enum station_info_flags {
8552ec600d6SLuis Carlos Cobo 	STATION_INFO_INACTIVE_TIME	= 1<<0,
8562ec600d6SLuis Carlos Cobo 	STATION_INFO_RX_BYTES		= 1<<1,
8572ec600d6SLuis Carlos Cobo 	STATION_INFO_TX_BYTES		= 1<<2,
8582ec600d6SLuis Carlos Cobo 	STATION_INFO_LLID		= 1<<3,
8592ec600d6SLuis Carlos Cobo 	STATION_INFO_PLID		= 1<<4,
8602ec600d6SLuis Carlos Cobo 	STATION_INFO_PLINK_STATE	= 1<<5,
861420e7fabSHenning Rogge 	STATION_INFO_SIGNAL		= 1<<6,
862420e7fabSHenning Rogge 	STATION_INFO_TX_BITRATE		= 1<<7,
86398c8a60aSJouni Malinen 	STATION_INFO_RX_PACKETS		= 1<<8,
86498c8a60aSJouni Malinen 	STATION_INFO_TX_PACKETS		= 1<<9,
865b206b4efSBruno Randolf 	STATION_INFO_TX_RETRIES		= 1<<10,
866b206b4efSBruno Randolf 	STATION_INFO_TX_FAILED		= 1<<11,
8675a5c731aSBen Greear 	STATION_INFO_RX_DROP_MISC	= 1<<12,
868541a45a1SBruno Randolf 	STATION_INFO_SIGNAL_AVG		= 1<<13,
869c8dcfd8aSFelix Fietkau 	STATION_INFO_RX_BITRATE		= 1<<14,
870f4263c98SPaul Stewart 	STATION_INFO_BSS_PARAM          = 1<<15,
871040bdf71SFelix Fietkau 	STATION_INFO_CONNECTED_TIME	= 1<<16,
872bb6e753eSHelmut Schaa 	STATION_INFO_ASSOC_REQ_IES	= 1<<17,
873a85e1d55SPaul Stewart 	STATION_INFO_STA_FLAGS		= 1<<18,
874d299a1f2SJavier Cardona 	STATION_INFO_BEACON_LOSS_COUNT	= 1<<19,
875d299a1f2SJavier Cardona 	STATION_INFO_T_OFFSET		= 1<<20,
8763b1c5a53SMarco Porsch 	STATION_INFO_LOCAL_PM		= 1<<21,
8773b1c5a53SMarco Porsch 	STATION_INFO_PEER_PM		= 1<<22,
8783b1c5a53SMarco Porsch 	STATION_INFO_NONPEER_PM		= 1<<23,
87942745e03SVladimir Kondratiev 	STATION_INFO_RX_BYTES64		= 1<<24,
88042745e03SVladimir Kondratiev 	STATION_INFO_TX_BYTES64		= 1<<25,
881119363c7SFelix Fietkau 	STATION_INFO_CHAIN_SIGNAL	= 1<<26,
882119363c7SFelix Fietkau 	STATION_INFO_CHAIN_SIGNAL_AVG	= 1<<27,
883420e7fabSHenning Rogge };
884420e7fabSHenning Rogge 
885420e7fabSHenning Rogge /**
886420e7fabSHenning Rogge  * enum station_info_rate_flags - bitrate info flags
887420e7fabSHenning Rogge  *
888420e7fabSHenning Rogge  * Used by the driver to indicate the specific rate transmission
889420e7fabSHenning Rogge  * type for 802.11n transmissions.
890420e7fabSHenning Rogge  *
891db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_MCS: mcs field filled with HT MCS
892db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_VHT_MCS: mcs field filled with VHT MCS
893db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_40_MHZ_WIDTH: 40 MHz width transmission
894db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_80_MHZ_WIDTH: 80 MHz width transmission
895db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_80P80_MHZ_WIDTH: 80+80 MHz width transmission
896db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_160_MHZ_WIDTH: 160 MHz width transmission
897420e7fabSHenning Rogge  * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval
898db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_60G: 60GHz MCS
899420e7fabSHenning Rogge  */
900420e7fabSHenning Rogge enum rate_info_flags {
901db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_MCS			= BIT(0),
902db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_VHT_MCS			= BIT(1),
903db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_40_MHZ_WIDTH		= BIT(2),
904db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_80_MHZ_WIDTH		= BIT(3),
905db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_80P80_MHZ_WIDTH		= BIT(4),
906db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_160_MHZ_WIDTH		= BIT(5),
907db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_SHORT_GI		= BIT(6),
908db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_60G			= BIT(7),
909420e7fabSHenning Rogge };
910420e7fabSHenning Rogge 
911420e7fabSHenning Rogge /**
912420e7fabSHenning Rogge  * struct rate_info - bitrate information
913420e7fabSHenning Rogge  *
914420e7fabSHenning Rogge  * Information about a receiving or transmitting bitrate
915420e7fabSHenning Rogge  *
916420e7fabSHenning Rogge  * @flags: bitflag of flags from &enum rate_info_flags
917420e7fabSHenning Rogge  * @mcs: mcs index if struct describes a 802.11n bitrate
918420e7fabSHenning Rogge  * @legacy: bitrate in 100kbit/s for 802.11abg
919db9c64cfSJohannes Berg  * @nss: number of streams (VHT only)
920420e7fabSHenning Rogge  */
921420e7fabSHenning Rogge struct rate_info {
922420e7fabSHenning Rogge 	u8 flags;
923420e7fabSHenning Rogge 	u8 mcs;
924420e7fabSHenning Rogge 	u16 legacy;
925db9c64cfSJohannes Berg 	u8 nss;
926fd5b74dcSJohannes Berg };
927fd5b74dcSJohannes Berg 
928fd5b74dcSJohannes Berg /**
929f4263c98SPaul Stewart  * enum station_info_rate_flags - bitrate info flags
930f4263c98SPaul Stewart  *
931f4263c98SPaul Stewart  * Used by the driver to indicate the specific rate transmission
932f4263c98SPaul Stewart  * type for 802.11n transmissions.
933f4263c98SPaul Stewart  *
934f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_CTS_PROT: whether CTS protection is enabled
935f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_SHORT_PREAMBLE: whether short preamble is enabled
936f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_SHORT_SLOT_TIME: whether short slot time is enabled
937f4263c98SPaul Stewart  */
938f4263c98SPaul Stewart enum bss_param_flags {
939f4263c98SPaul Stewart 	BSS_PARAM_FLAGS_CTS_PROT	= 1<<0,
940f4263c98SPaul Stewart 	BSS_PARAM_FLAGS_SHORT_PREAMBLE	= 1<<1,
941f4263c98SPaul Stewart 	BSS_PARAM_FLAGS_SHORT_SLOT_TIME	= 1<<2,
942f4263c98SPaul Stewart };
943f4263c98SPaul Stewart 
944f4263c98SPaul Stewart /**
945f4263c98SPaul Stewart  * struct sta_bss_parameters - BSS parameters for the attached station
946f4263c98SPaul Stewart  *
947f4263c98SPaul Stewart  * Information about the currently associated BSS
948f4263c98SPaul Stewart  *
949f4263c98SPaul Stewart  * @flags: bitflag of flags from &enum bss_param_flags
950f4263c98SPaul Stewart  * @dtim_period: DTIM period for the BSS
951f4263c98SPaul Stewart  * @beacon_interval: beacon interval
952f4263c98SPaul Stewart  */
953f4263c98SPaul Stewart struct sta_bss_parameters {
954f4263c98SPaul Stewart 	u8 flags;
955f4263c98SPaul Stewart 	u8 dtim_period;
956f4263c98SPaul Stewart 	u16 beacon_interval;
957f4263c98SPaul Stewart };
958f4263c98SPaul Stewart 
959119363c7SFelix Fietkau #define IEEE80211_MAX_CHAINS	4
960119363c7SFelix Fietkau 
961f4263c98SPaul Stewart /**
9622ec600d6SLuis Carlos Cobo  * struct station_info - station information
963fd5b74dcSJohannes Berg  *
9642ec600d6SLuis Carlos Cobo  * Station information filled by driver for get_station() and dump_station.
965fd5b74dcSJohannes Berg  *
9662ec600d6SLuis Carlos Cobo  * @filled: bitflag of flags from &enum station_info_flags
967ebe27c91SMohammed Shafi Shajakhan  * @connected_time: time(in secs) since a station is last connected
968fd5b74dcSJohannes Berg  * @inactive_time: time since last station activity (tx/rx) in milliseconds
969fd5b74dcSJohannes Berg  * @rx_bytes: bytes received from this station
970fd5b74dcSJohannes Berg  * @tx_bytes: bytes transmitted to this station
9712ec600d6SLuis Carlos Cobo  * @llid: mesh local link id
9722ec600d6SLuis Carlos Cobo  * @plid: mesh peer link id
9732ec600d6SLuis Carlos Cobo  * @plink_state: mesh peer link state
97473c3df3bSJohannes Berg  * @signal: The signal strength, type depends on the wiphy's signal_type.
97573c3df3bSJohannes Berg  *	For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
97673c3df3bSJohannes Berg  * @signal_avg: Average signal strength, type depends on the wiphy's signal_type.
97773c3df3bSJohannes Berg  *	For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
978119363c7SFelix Fietkau  * @chains: bitmask for filled values in @chain_signal, @chain_signal_avg
979119363c7SFelix Fietkau  * @chain_signal: per-chain signal strength of last received packet in dBm
980119363c7SFelix Fietkau  * @chain_signal_avg: per-chain signal strength average in dBm
981858022aaSRandy Dunlap  * @txrate: current unicast bitrate from this station
982858022aaSRandy Dunlap  * @rxrate: current unicast bitrate to this station
98398c8a60aSJouni Malinen  * @rx_packets: packets received from this station
98498c8a60aSJouni Malinen  * @tx_packets: packets transmitted to this station
985b206b4efSBruno Randolf  * @tx_retries: cumulative retry counts
986b206b4efSBruno Randolf  * @tx_failed: number of failed transmissions (retries exceeded, no ACK)
9875a5c731aSBen Greear  * @rx_dropped_misc:  Dropped for un-specified reason.
9881ba01458SRandy Dunlap  * @bss_param: current BSS parameters
989f5ea9120SJohannes Berg  * @generation: generation number for nl80211 dumps.
990f5ea9120SJohannes Berg  *	This number should increase every time the list of stations
991f5ea9120SJohannes Berg  *	changes, i.e. when a station is added or removed, so that
992f5ea9120SJohannes Berg  *	userspace can tell whether it got a consistent snapshot.
99350d3dfb7SJouni Malinen  * @assoc_req_ies: IEs from (Re)Association Request.
99450d3dfb7SJouni Malinen  *	This is used only when in AP mode with drivers that do not use
99550d3dfb7SJouni Malinen  *	user space MLME/SME implementation. The information is provided for
99650d3dfb7SJouni Malinen  *	the cfg80211_new_sta() calls to notify user space of the IEs.
99750d3dfb7SJouni Malinen  * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets.
998c26887d2SJohannes Berg  * @sta_flags: station flags mask & values
999a85e1d55SPaul Stewart  * @beacon_loss_count: Number of times beacon loss event has triggered.
1000d299a1f2SJavier Cardona  * @t_offset: Time offset of the station relative to this host.
10013b1c5a53SMarco Porsch  * @local_pm: local mesh STA power save mode
10023b1c5a53SMarco Porsch  * @peer_pm: peer mesh STA power save mode
10033b1c5a53SMarco Porsch  * @nonpeer_pm: non-peer mesh STA power save mode
1004fd5b74dcSJohannes Berg  */
10052ec600d6SLuis Carlos Cobo struct station_info {
1006fd5b74dcSJohannes Berg 	u32 filled;
1007ebe27c91SMohammed Shafi Shajakhan 	u32 connected_time;
1008fd5b74dcSJohannes Berg 	u32 inactive_time;
100942745e03SVladimir Kondratiev 	u64 rx_bytes;
101042745e03SVladimir Kondratiev 	u64 tx_bytes;
10112ec600d6SLuis Carlos Cobo 	u16 llid;
10122ec600d6SLuis Carlos Cobo 	u16 plid;
10132ec600d6SLuis Carlos Cobo 	u8 plink_state;
1014420e7fabSHenning Rogge 	s8 signal;
1015541a45a1SBruno Randolf 	s8 signal_avg;
1016119363c7SFelix Fietkau 
1017119363c7SFelix Fietkau 	u8 chains;
1018119363c7SFelix Fietkau 	s8 chain_signal[IEEE80211_MAX_CHAINS];
1019119363c7SFelix Fietkau 	s8 chain_signal_avg[IEEE80211_MAX_CHAINS];
1020119363c7SFelix Fietkau 
1021420e7fabSHenning Rogge 	struct rate_info txrate;
1022c8dcfd8aSFelix Fietkau 	struct rate_info rxrate;
102398c8a60aSJouni Malinen 	u32 rx_packets;
102498c8a60aSJouni Malinen 	u32 tx_packets;
1025b206b4efSBruno Randolf 	u32 tx_retries;
1026b206b4efSBruno Randolf 	u32 tx_failed;
10275a5c731aSBen Greear 	u32 rx_dropped_misc;
1028f4263c98SPaul Stewart 	struct sta_bss_parameters bss_param;
1029bb6e753eSHelmut Schaa 	struct nl80211_sta_flag_update sta_flags;
1030f5ea9120SJohannes Berg 
1031f5ea9120SJohannes Berg 	int generation;
103250d3dfb7SJouni Malinen 
103350d3dfb7SJouni Malinen 	const u8 *assoc_req_ies;
103450d3dfb7SJouni Malinen 	size_t assoc_req_ies_len;
1035f612cedfSJouni Malinen 
1036a85e1d55SPaul Stewart 	u32 beacon_loss_count;
1037d299a1f2SJavier Cardona 	s64 t_offset;
10383b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode local_pm;
10393b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode peer_pm;
10403b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode nonpeer_pm;
1041a85e1d55SPaul Stewart 
1042f612cedfSJouni Malinen 	/*
1043f612cedfSJouni Malinen 	 * Note: Add a new enum station_info_flags value for each new field and
1044f612cedfSJouni Malinen 	 * use it to check which fields are initialized.
1045f612cedfSJouni Malinen 	 */
1046fd5b74dcSJohannes Berg };
1047fd5b74dcSJohannes Berg 
104866f7ac50SMichael Wu /**
104966f7ac50SMichael Wu  * enum monitor_flags - monitor flags
105066f7ac50SMichael Wu  *
105166f7ac50SMichael Wu  * Monitor interface configuration flags. Note that these must be the bits
105266f7ac50SMichael Wu  * according to the nl80211 flags.
105366f7ac50SMichael Wu  *
105466f7ac50SMichael Wu  * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS
105566f7ac50SMichael Wu  * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP
105666f7ac50SMichael Wu  * @MONITOR_FLAG_CONTROL: pass control frames
105766f7ac50SMichael Wu  * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering
105866f7ac50SMichael Wu  * @MONITOR_FLAG_COOK_FRAMES: report frames after processing
1059e057d3c3SFelix Fietkau  * @MONITOR_FLAG_ACTIVE: active monitor, ACKs frames on its MAC address
106066f7ac50SMichael Wu  */
106166f7ac50SMichael Wu enum monitor_flags {
106266f7ac50SMichael Wu 	MONITOR_FLAG_FCSFAIL		= 1<<NL80211_MNTR_FLAG_FCSFAIL,
106366f7ac50SMichael Wu 	MONITOR_FLAG_PLCPFAIL		= 1<<NL80211_MNTR_FLAG_PLCPFAIL,
106466f7ac50SMichael Wu 	MONITOR_FLAG_CONTROL		= 1<<NL80211_MNTR_FLAG_CONTROL,
106566f7ac50SMichael Wu 	MONITOR_FLAG_OTHER_BSS		= 1<<NL80211_MNTR_FLAG_OTHER_BSS,
106666f7ac50SMichael Wu 	MONITOR_FLAG_COOK_FRAMES	= 1<<NL80211_MNTR_FLAG_COOK_FRAMES,
1067e057d3c3SFelix Fietkau 	MONITOR_FLAG_ACTIVE		= 1<<NL80211_MNTR_FLAG_ACTIVE,
106866f7ac50SMichael Wu };
106966f7ac50SMichael Wu 
10702ec600d6SLuis Carlos Cobo /**
10712ec600d6SLuis Carlos Cobo  * enum mpath_info_flags -  mesh path information flags
10722ec600d6SLuis Carlos Cobo  *
10732ec600d6SLuis Carlos Cobo  * Used by the driver to indicate which info in &struct mpath_info it has filled
10742ec600d6SLuis Carlos Cobo  * in during get_station() or dump_station().
10752ec600d6SLuis Carlos Cobo  *
1076abe37c4bSJohannes Berg  * @MPATH_INFO_FRAME_QLEN: @frame_qlen filled
1077abe37c4bSJohannes Berg  * @MPATH_INFO_SN: @sn filled
1078abe37c4bSJohannes Berg  * @MPATH_INFO_METRIC: @metric filled
1079abe37c4bSJohannes Berg  * @MPATH_INFO_EXPTIME: @exptime filled
1080abe37c4bSJohannes Berg  * @MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled
1081abe37c4bSJohannes Berg  * @MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled
1082abe37c4bSJohannes Berg  * @MPATH_INFO_FLAGS: @flags filled
10832ec600d6SLuis Carlos Cobo  */
10842ec600d6SLuis Carlos Cobo enum mpath_info_flags {
10852ec600d6SLuis Carlos Cobo 	MPATH_INFO_FRAME_QLEN		= BIT(0),
1086d19b3bf6SRui Paulo 	MPATH_INFO_SN			= BIT(1),
10872ec600d6SLuis Carlos Cobo 	MPATH_INFO_METRIC		= BIT(2),
10882ec600d6SLuis Carlos Cobo 	MPATH_INFO_EXPTIME		= BIT(3),
10892ec600d6SLuis Carlos Cobo 	MPATH_INFO_DISCOVERY_TIMEOUT	= BIT(4),
10902ec600d6SLuis Carlos Cobo 	MPATH_INFO_DISCOVERY_RETRIES	= BIT(5),
10912ec600d6SLuis Carlos Cobo 	MPATH_INFO_FLAGS		= BIT(6),
10922ec600d6SLuis Carlos Cobo };
10932ec600d6SLuis Carlos Cobo 
10942ec600d6SLuis Carlos Cobo /**
10952ec600d6SLuis Carlos Cobo  * struct mpath_info - mesh path information
10962ec600d6SLuis Carlos Cobo  *
10972ec600d6SLuis Carlos Cobo  * Mesh path information filled by driver for get_mpath() and dump_mpath().
10982ec600d6SLuis Carlos Cobo  *
10992ec600d6SLuis Carlos Cobo  * @filled: bitfield of flags from &enum mpath_info_flags
11002ec600d6SLuis Carlos Cobo  * @frame_qlen: number of queued frames for this destination
1101d19b3bf6SRui Paulo  * @sn: target sequence number
11022ec600d6SLuis Carlos Cobo  * @metric: metric (cost) of this mesh path
11032ec600d6SLuis Carlos Cobo  * @exptime: expiration time for the mesh path from now, in msecs
11042ec600d6SLuis Carlos Cobo  * @flags: mesh path flags
11052ec600d6SLuis Carlos Cobo  * @discovery_timeout: total mesh path discovery timeout, in msecs
11062ec600d6SLuis Carlos Cobo  * @discovery_retries: mesh path discovery retries
1107f5ea9120SJohannes Berg  * @generation: generation number for nl80211 dumps.
1108f5ea9120SJohannes Berg  *	This number should increase every time the list of mesh paths
1109f5ea9120SJohannes Berg  *	changes, i.e. when a station is added or removed, so that
1110f5ea9120SJohannes Berg  *	userspace can tell whether it got a consistent snapshot.
11112ec600d6SLuis Carlos Cobo  */
11122ec600d6SLuis Carlos Cobo struct mpath_info {
11132ec600d6SLuis Carlos Cobo 	u32 filled;
11142ec600d6SLuis Carlos Cobo 	u32 frame_qlen;
1115d19b3bf6SRui Paulo 	u32 sn;
11162ec600d6SLuis Carlos Cobo 	u32 metric;
11172ec600d6SLuis Carlos Cobo 	u32 exptime;
11182ec600d6SLuis Carlos Cobo 	u32 discovery_timeout;
11192ec600d6SLuis Carlos Cobo 	u8 discovery_retries;
11202ec600d6SLuis Carlos Cobo 	u8 flags;
1121f5ea9120SJohannes Berg 
1122f5ea9120SJohannes Berg 	int generation;
11232ec600d6SLuis Carlos Cobo };
11242ec600d6SLuis Carlos Cobo 
11259f1ba906SJouni Malinen /**
11269f1ba906SJouni Malinen  * struct bss_parameters - BSS parameters
11279f1ba906SJouni Malinen  *
11289f1ba906SJouni Malinen  * Used to change BSS parameters (mainly for AP mode).
11299f1ba906SJouni Malinen  *
11309f1ba906SJouni Malinen  * @use_cts_prot: Whether to use CTS protection
11319f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
11329f1ba906SJouni Malinen  * @use_short_preamble: Whether the use of short preambles is allowed
11339f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
11349f1ba906SJouni Malinen  * @use_short_slot_time: Whether the use of short slot time is allowed
11359f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
113690c97a04SJouni Malinen  * @basic_rates: basic rates in IEEE 802.11 format
113790c97a04SJouni Malinen  *	(or NULL for no change)
113890c97a04SJouni Malinen  * @basic_rates_len: number of basic rates
1139fd8aaaf3SFelix Fietkau  * @ap_isolate: do not forward packets between connected stations
114050b12f59SHelmut Schaa  * @ht_opmode: HT Operation mode
114150b12f59SHelmut Schaa  * 	(u16 = opmode, -1 = do not change)
114253cabad7SJohannes Berg  * @p2p_ctwindow: P2P CT Window (-1 = no change)
114353cabad7SJohannes Berg  * @p2p_opp_ps: P2P opportunistic PS (-1 = no change)
11449f1ba906SJouni Malinen  */
11459f1ba906SJouni Malinen struct bss_parameters {
11469f1ba906SJouni Malinen 	int use_cts_prot;
11479f1ba906SJouni Malinen 	int use_short_preamble;
11489f1ba906SJouni Malinen 	int use_short_slot_time;
114990c97a04SJouni Malinen 	u8 *basic_rates;
115090c97a04SJouni Malinen 	u8 basic_rates_len;
1151fd8aaaf3SFelix Fietkau 	int ap_isolate;
115250b12f59SHelmut Schaa 	int ht_opmode;
115353cabad7SJohannes Berg 	s8 p2p_ctwindow, p2p_opp_ps;
11549f1ba906SJouni Malinen };
11552ec600d6SLuis Carlos Cobo 
11563ddd53f3SChun-Yeow Yeoh /**
115729cbe68cSJohannes Berg  * struct mesh_config - 802.11s mesh configuration
115829cbe68cSJohannes Berg  *
115929cbe68cSJohannes Berg  * These parameters can be changed while the mesh is active.
11603ddd53f3SChun-Yeow Yeoh  *
11613ddd53f3SChun-Yeow Yeoh  * @dot11MeshRetryTimeout: the initial retry timeout in millisecond units used
11623ddd53f3SChun-Yeow Yeoh  *	by the Mesh Peering Open message
11633ddd53f3SChun-Yeow Yeoh  * @dot11MeshConfirmTimeout: the initial retry timeout in millisecond units
11643ddd53f3SChun-Yeow Yeoh  *	used by the Mesh Peering Open message
11653ddd53f3SChun-Yeow Yeoh  * @dot11MeshHoldingTimeout: the confirm timeout in millisecond units used by
11663ddd53f3SChun-Yeow Yeoh  *	the mesh peering management to close a mesh peering
11673ddd53f3SChun-Yeow Yeoh  * @dot11MeshMaxPeerLinks: the maximum number of peer links allowed on this
11683ddd53f3SChun-Yeow Yeoh  *	mesh interface
11693ddd53f3SChun-Yeow Yeoh  * @dot11MeshMaxRetries: the maximum number of peer link open retries that can
11703ddd53f3SChun-Yeow Yeoh  *	be sent to establish a new peer link instance in a mesh
11713ddd53f3SChun-Yeow Yeoh  * @dot11MeshTTL: the value of TTL field set at a source mesh STA
11723ddd53f3SChun-Yeow Yeoh  * @element_ttl: the value of TTL field set at a mesh STA for path selection
11733ddd53f3SChun-Yeow Yeoh  *	elements
11743ddd53f3SChun-Yeow Yeoh  * @auto_open_plinks: whether we should automatically open peer links when we
11753ddd53f3SChun-Yeow Yeoh  *	detect compatible mesh peers
11763ddd53f3SChun-Yeow Yeoh  * @dot11MeshNbrOffsetMaxNeighbor: the maximum number of neighbors to
11773ddd53f3SChun-Yeow Yeoh  *	synchronize to for 11s default synchronization method
11783ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPmaxPREQretries: the number of action frames containing a PREQ
11793ddd53f3SChun-Yeow Yeoh  *	that an originator mesh STA can send to a particular path target
11803ddd53f3SChun-Yeow Yeoh  * @path_refresh_time: how frequently to refresh mesh paths in milliseconds
11813ddd53f3SChun-Yeow Yeoh  * @min_discovery_timeout: the minimum length of time to wait until giving up on
11823ddd53f3SChun-Yeow Yeoh  *	a path discovery in milliseconds
11833ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPactivePathTimeout: the time (in TUs) for which mesh STAs
11843ddd53f3SChun-Yeow Yeoh  *	receiving a PREQ shall consider the forwarding information from the
11853ddd53f3SChun-Yeow Yeoh  *	root to be valid. (TU = time unit)
11863ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPpreqMinInterval: the minimum interval of time (in TUs) during
11873ddd53f3SChun-Yeow Yeoh  *	which a mesh STA can send only one action frame containing a PREQ
11883ddd53f3SChun-Yeow Yeoh  *	element
11893ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPperrMinInterval: the minimum interval of time (in TUs) during
11903ddd53f3SChun-Yeow Yeoh  *	which a mesh STA can send only one Action frame containing a PERR
11913ddd53f3SChun-Yeow Yeoh  *	element
11923ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPnetDiameterTraversalTime: the interval of time (in TUs) that
11933ddd53f3SChun-Yeow Yeoh  *	it takes for an HWMP information element to propagate across the mesh
11943ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPRootMode: the configuration of a mesh STA as root mesh STA
11953ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPRannInterval: the interval of time (in TUs) between root
11963ddd53f3SChun-Yeow Yeoh  *	announcements are transmitted
11973ddd53f3SChun-Yeow Yeoh  * @dot11MeshGateAnnouncementProtocol: whether to advertise that this mesh
11983ddd53f3SChun-Yeow Yeoh  *	station has access to a broader network beyond the MBSS. (This is
11993ddd53f3SChun-Yeow Yeoh  *	missnamed in draft 12.0: dot11MeshGateAnnouncementProtocol set to true
12003ddd53f3SChun-Yeow Yeoh  *	only means that the station will announce others it's a mesh gate, but
12013ddd53f3SChun-Yeow Yeoh  *	not necessarily using the gate announcement protocol. Still keeping the
12023ddd53f3SChun-Yeow Yeoh  *	same nomenclature to be in sync with the spec)
12033ddd53f3SChun-Yeow Yeoh  * @dot11MeshForwarding: whether the Mesh STA is forwarding or non-forwarding
12043ddd53f3SChun-Yeow Yeoh  *	entity (default is TRUE - forwarding entity)
12053ddd53f3SChun-Yeow Yeoh  * @rssi_threshold: the threshold for average signal strength of candidate
12063ddd53f3SChun-Yeow Yeoh  *	station to establish a peer link
12073ddd53f3SChun-Yeow Yeoh  * @ht_opmode: mesh HT protection mode
1208ac1073a6SChun-Yeow Yeoh  *
1209ac1073a6SChun-Yeow Yeoh  * @dot11MeshHWMPactivePathToRootTimeout: The time (in TUs) for which mesh STAs
1210ac1073a6SChun-Yeow Yeoh  *	receiving a proactive PREQ shall consider the forwarding information to
1211ac1073a6SChun-Yeow Yeoh  *	the root mesh STA to be valid.
1212ac1073a6SChun-Yeow Yeoh  *
1213ac1073a6SChun-Yeow Yeoh  * @dot11MeshHWMProotInterval: The interval of time (in TUs) between proactive
1214ac1073a6SChun-Yeow Yeoh  *	PREQs are transmitted.
1215728b19e5SChun-Yeow Yeoh  * @dot11MeshHWMPconfirmationInterval: The minimum interval of time (in TUs)
1216728b19e5SChun-Yeow Yeoh  *	during which a mesh STA can send only one Action frame containing
1217728b19e5SChun-Yeow Yeoh  *	a PREQ element for root path confirmation.
12183b1c5a53SMarco Porsch  * @power_mode: The default mesh power save mode which will be the initial
12193b1c5a53SMarco Porsch  *	setting for new peer links.
12203b1c5a53SMarco Porsch  * @dot11MeshAwakeWindowDuration: The duration in TUs the STA will remain awake
12213b1c5a53SMarco Porsch  *	after transmitting its beacon.
12228e7c0538SColleen Twitty  * @plink_timeout: If no tx activity is seen from a STA we've established
12238e7c0538SColleen Twitty  *	peering with for longer than this time (in seconds), then remove it
12248e7c0538SColleen Twitty  *	from the STA's list of peers.  Default is 30 minutes.
122529cbe68cSJohannes Berg  */
122693da9cc1Scolin@cozybit.com struct mesh_config {
122793da9cc1Scolin@cozybit.com 	u16 dot11MeshRetryTimeout;
122893da9cc1Scolin@cozybit.com 	u16 dot11MeshConfirmTimeout;
122993da9cc1Scolin@cozybit.com 	u16 dot11MeshHoldingTimeout;
123093da9cc1Scolin@cozybit.com 	u16 dot11MeshMaxPeerLinks;
123193da9cc1Scolin@cozybit.com 	u8 dot11MeshMaxRetries;
123293da9cc1Scolin@cozybit.com 	u8 dot11MeshTTL;
123345904f21SJavier Cardona 	u8 element_ttl;
123493da9cc1Scolin@cozybit.com 	bool auto_open_plinks;
1235d299a1f2SJavier Cardona 	u32 dot11MeshNbrOffsetMaxNeighbor;
123693da9cc1Scolin@cozybit.com 	u8 dot11MeshHWMPmaxPREQretries;
123793da9cc1Scolin@cozybit.com 	u32 path_refresh_time;
123893da9cc1Scolin@cozybit.com 	u16 min_discovery_timeout;
123993da9cc1Scolin@cozybit.com 	u32 dot11MeshHWMPactivePathTimeout;
124093da9cc1Scolin@cozybit.com 	u16 dot11MeshHWMPpreqMinInterval;
1241dca7e943SThomas Pedersen 	u16 dot11MeshHWMPperrMinInterval;
124293da9cc1Scolin@cozybit.com 	u16 dot11MeshHWMPnetDiameterTraversalTime;
124363c5723bSRui Paulo 	u8 dot11MeshHWMPRootMode;
12440507e159SJavier Cardona 	u16 dot11MeshHWMPRannInterval;
124516dd7267SJavier Cardona 	bool dot11MeshGateAnnouncementProtocol;
124694f90656SChun-Yeow Yeoh 	bool dot11MeshForwarding;
124755335137SAshok Nagarajan 	s32 rssi_threshold;
124870c33eaaSAshok Nagarajan 	u16 ht_opmode;
1249ac1073a6SChun-Yeow Yeoh 	u32 dot11MeshHWMPactivePathToRootTimeout;
1250ac1073a6SChun-Yeow Yeoh 	u16 dot11MeshHWMProotInterval;
1251728b19e5SChun-Yeow Yeoh 	u16 dot11MeshHWMPconfirmationInterval;
12523b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode power_mode;
12533b1c5a53SMarco Porsch 	u16 dot11MeshAwakeWindowDuration;
12548e7c0538SColleen Twitty 	u32 plink_timeout;
125593da9cc1Scolin@cozybit.com };
125693da9cc1Scolin@cozybit.com 
125731888487SJouni Malinen /**
125829cbe68cSJohannes Berg  * struct mesh_setup - 802.11s mesh setup configuration
1259683b6d3bSJohannes Berg  * @chandef: defines the channel to use
126029cbe68cSJohannes Berg  * @mesh_id: the mesh ID
126129cbe68cSJohannes Berg  * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes
1262d299a1f2SJavier Cardona  * @sync_method: which synchronization method to use
1263c80d545dSJavier Cardona  * @path_sel_proto: which path selection protocol to use
1264c80d545dSJavier Cardona  * @path_metric: which metric to use
12656e16d90bSColleen Twitty  * @auth_id: which authentication method this mesh is using
1266581a8b0fSJavier Cardona  * @ie: vendor information elements (optional)
1267581a8b0fSJavier Cardona  * @ie_len: length of vendor information elements
1268b130e5ceSJavier Cardona  * @is_authenticated: this mesh requires authentication
1269b130e5ceSJavier Cardona  * @is_secure: this mesh uses security
1270bb2798d4SThomas Pedersen  * @user_mpm: userspace handles all MPM functions
12719bdbf04dSMarco Porsch  * @dtim_period: DTIM period to use
12729bdbf04dSMarco Porsch  * @beacon_interval: beacon interval to use
12734bb62344SChun-Yeow Yeoh  * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a]
1274ffb3cf30SAshok Nagarajan  * @basic_rates: basic rates to use when creating the mesh
127529cbe68cSJohannes Berg  *
127629cbe68cSJohannes Berg  * These parameters are fixed when the mesh is created.
127729cbe68cSJohannes Berg  */
127829cbe68cSJohannes Berg struct mesh_setup {
1279683b6d3bSJohannes Berg 	struct cfg80211_chan_def chandef;
128029cbe68cSJohannes Berg 	const u8 *mesh_id;
128129cbe68cSJohannes Berg 	u8 mesh_id_len;
1282d299a1f2SJavier Cardona 	u8 sync_method;
1283c80d545dSJavier Cardona 	u8 path_sel_proto;
1284c80d545dSJavier Cardona 	u8 path_metric;
12856e16d90bSColleen Twitty 	u8 auth_id;
1286581a8b0fSJavier Cardona 	const u8 *ie;
1287581a8b0fSJavier Cardona 	u8 ie_len;
1288b130e5ceSJavier Cardona 	bool is_authenticated;
128915d5dda6SJavier Cardona 	bool is_secure;
1290bb2798d4SThomas Pedersen 	bool user_mpm;
12919bdbf04dSMarco Porsch 	u8 dtim_period;
12929bdbf04dSMarco Porsch 	u16 beacon_interval;
12934bb62344SChun-Yeow Yeoh 	int mcast_rate[IEEE80211_NUM_BANDS];
1294ffb3cf30SAshok Nagarajan 	u32 basic_rates;
129529cbe68cSJohannes Berg };
129629cbe68cSJohannes Berg 
129729cbe68cSJohannes Berg /**
129831888487SJouni Malinen  * struct ieee80211_txq_params - TX queue parameters
1299a3304b0aSJohannes Berg  * @ac: AC identifier
130031888487SJouni Malinen  * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled
130131888487SJouni Malinen  * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range
130231888487SJouni Malinen  *	1..32767]
130331888487SJouni Malinen  * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range
130431888487SJouni Malinen  *	1..32767]
130531888487SJouni Malinen  * @aifs: Arbitration interframe space [0..255]
130631888487SJouni Malinen  */
130731888487SJouni Malinen struct ieee80211_txq_params {
1308a3304b0aSJohannes Berg 	enum nl80211_ac ac;
130931888487SJouni Malinen 	u16 txop;
131031888487SJouni Malinen 	u16 cwmin;
131131888487SJouni Malinen 	u16 cwmax;
131231888487SJouni Malinen 	u8 aifs;
131331888487SJouni Malinen };
131431888487SJouni Malinen 
1315d70e9693SJohannes Berg /**
1316d70e9693SJohannes Berg  * DOC: Scanning and BSS list handling
1317d70e9693SJohannes Berg  *
1318d70e9693SJohannes Berg  * The scanning process itself is fairly simple, but cfg80211 offers quite
1319d70e9693SJohannes Berg  * a bit of helper functionality. To start a scan, the scan operation will
1320d70e9693SJohannes Berg  * be invoked with a scan definition. This scan definition contains the
1321d70e9693SJohannes Berg  * channels to scan, and the SSIDs to send probe requests for (including the
1322d70e9693SJohannes Berg  * wildcard, if desired). A passive scan is indicated by having no SSIDs to
1323d70e9693SJohannes Berg  * probe. Additionally, a scan request may contain extra information elements
1324d70e9693SJohannes Berg  * that should be added to the probe request. The IEs are guaranteed to be
1325d70e9693SJohannes Berg  * well-formed, and will not exceed the maximum length the driver advertised
1326d70e9693SJohannes Berg  * in the wiphy structure.
1327d70e9693SJohannes Berg  *
1328d70e9693SJohannes Berg  * When scanning finds a BSS, cfg80211 needs to be notified of that, because
1329d70e9693SJohannes Berg  * it is responsible for maintaining the BSS list; the driver should not
1330d70e9693SJohannes Berg  * maintain a list itself. For this notification, various functions exist.
1331d70e9693SJohannes Berg  *
1332d70e9693SJohannes Berg  * Since drivers do not maintain a BSS list, there are also a number of
1333d70e9693SJohannes Berg  * functions to search for a BSS and obtain information about it from the
1334d70e9693SJohannes Berg  * BSS structure cfg80211 maintains. The BSS list is also made available
1335d70e9693SJohannes Berg  * to userspace.
1336d70e9693SJohannes Berg  */
133772bdcf34SJouni Malinen 
1338704232c2SJohannes Berg /**
13392a519311SJohannes Berg  * struct cfg80211_ssid - SSID description
13402a519311SJohannes Berg  * @ssid: the SSID
13412a519311SJohannes Berg  * @ssid_len: length of the ssid
13422a519311SJohannes Berg  */
13432a519311SJohannes Berg struct cfg80211_ssid {
13442a519311SJohannes Berg 	u8 ssid[IEEE80211_MAX_SSID_LEN];
13452a519311SJohannes Berg 	u8 ssid_len;
13462a519311SJohannes Berg };
13472a519311SJohannes Berg 
13482a519311SJohannes Berg /**
13492a519311SJohannes Berg  * struct cfg80211_scan_request - scan request description
13502a519311SJohannes Berg  *
13512a519311SJohannes Berg  * @ssids: SSIDs to scan for (active scan only)
13522a519311SJohannes Berg  * @n_ssids: number of SSIDs
13532a519311SJohannes Berg  * @channels: channels to scan on.
1354ca3dbc20SHelmut Schaa  * @n_channels: total number of channels to scan
1355dcd6eac1SSimon Wunderlich  * @scan_width: channel width for scanning
135670692ad2SJouni Malinen  * @ie: optional information element(s) to add into Probe Request or %NULL
135770692ad2SJouni Malinen  * @ie_len: length of ie in octets
1358ed473771SSam Leffler  * @flags: bit field of flags controlling operation
135934850ab2SJohannes Berg  * @rates: bitmap of rates to advertise for each band
13602a519311SJohannes Berg  * @wiphy: the wiphy this was for
136115d6030bSSam Leffler  * @scan_start: time (in jiffies) when the scan started
1362fd014284SJohannes Berg  * @wdev: the wireless device to scan for
1363abe37c4bSJohannes Berg  * @aborted: (internal) scan request was notified as aborted
13645fe231e8SJohannes Berg  * @notified: (internal) scan request was notified as done or aborted
1365e9f935e3SRajkumar Manoharan  * @no_cck: used to send probe requests at non CCK rate in 2GHz band
13662a519311SJohannes Berg  */
13672a519311SJohannes Berg struct cfg80211_scan_request {
13682a519311SJohannes Berg 	struct cfg80211_ssid *ssids;
13692a519311SJohannes Berg 	int n_ssids;
13702a519311SJohannes Berg 	u32 n_channels;
1371dcd6eac1SSimon Wunderlich 	enum nl80211_bss_scan_width scan_width;
1372de95a54bSJohannes Berg 	const u8 *ie;
137370692ad2SJouni Malinen 	size_t ie_len;
1374ed473771SSam Leffler 	u32 flags;
13752a519311SJohannes Berg 
137634850ab2SJohannes Berg 	u32 rates[IEEE80211_NUM_BANDS];
137734850ab2SJohannes Berg 
1378fd014284SJohannes Berg 	struct wireless_dev *wdev;
1379fd014284SJohannes Berg 
13802a519311SJohannes Berg 	/* internal */
13812a519311SJohannes Berg 	struct wiphy *wiphy;
138215d6030bSSam Leffler 	unsigned long scan_start;
13835fe231e8SJohannes Berg 	bool aborted, notified;
1384e9f935e3SRajkumar Manoharan 	bool no_cck;
13855ba63533SJohannes Berg 
13865ba63533SJohannes Berg 	/* keep last */
13875ba63533SJohannes Berg 	struct ieee80211_channel *channels[0];
13882a519311SJohannes Berg };
13892a519311SJohannes Berg 
13902a519311SJohannes Berg /**
1391a1f1c21cSLuciano Coelho  * struct cfg80211_match_set - sets of attributes to match
1392a1f1c21cSLuciano Coelho  *
1393a1f1c21cSLuciano Coelho  * @ssid: SSID to be matched
1394a1f1c21cSLuciano Coelho  */
1395a1f1c21cSLuciano Coelho struct cfg80211_match_set {
1396a1f1c21cSLuciano Coelho 	struct cfg80211_ssid ssid;
1397a1f1c21cSLuciano Coelho };
1398a1f1c21cSLuciano Coelho 
1399a1f1c21cSLuciano Coelho /**
1400807f8a8cSLuciano Coelho  * struct cfg80211_sched_scan_request - scheduled scan request description
1401807f8a8cSLuciano Coelho  *
1402807f8a8cSLuciano Coelho  * @ssids: SSIDs to scan for (passed in the probe_reqs in active scans)
1403807f8a8cSLuciano Coelho  * @n_ssids: number of SSIDs
1404807f8a8cSLuciano Coelho  * @n_channels: total number of channels to scan
1405dcd6eac1SSimon Wunderlich  * @scan_width: channel width for scanning
1406bbe6ad6dSLuciano Coelho  * @interval: interval between each scheduled scan cycle
1407807f8a8cSLuciano Coelho  * @ie: optional information element(s) to add into Probe Request or %NULL
1408807f8a8cSLuciano Coelho  * @ie_len: length of ie in octets
1409ed473771SSam Leffler  * @flags: bit field of flags controlling operation
1410a1f1c21cSLuciano Coelho  * @match_sets: sets of parameters to be matched for a scan result
1411a1f1c21cSLuciano Coelho  * 	entry to be considered valid and to be passed to the host
1412a1f1c21cSLuciano Coelho  * 	(others are filtered out).
1413a1f1c21cSLuciano Coelho  *	If ommited, all results are passed.
1414a1f1c21cSLuciano Coelho  * @n_match_sets: number of match sets
1415807f8a8cSLuciano Coelho  * @wiphy: the wiphy this was for
1416807f8a8cSLuciano Coelho  * @dev: the interface
1417077f897aSJohannes Berg  * @scan_start: start time of the scheduled scan
1418807f8a8cSLuciano Coelho  * @channels: channels to scan
141988e920b4SThomas Pedersen  * @rssi_thold: don't report scan results below this threshold (in s32 dBm)
1420807f8a8cSLuciano Coelho  */
1421807f8a8cSLuciano Coelho struct cfg80211_sched_scan_request {
1422807f8a8cSLuciano Coelho 	struct cfg80211_ssid *ssids;
1423807f8a8cSLuciano Coelho 	int n_ssids;
1424807f8a8cSLuciano Coelho 	u32 n_channels;
1425dcd6eac1SSimon Wunderlich 	enum nl80211_bss_scan_width scan_width;
1426bbe6ad6dSLuciano Coelho 	u32 interval;
1427807f8a8cSLuciano Coelho 	const u8 *ie;
1428807f8a8cSLuciano Coelho 	size_t ie_len;
1429ed473771SSam Leffler 	u32 flags;
1430a1f1c21cSLuciano Coelho 	struct cfg80211_match_set *match_sets;
1431a1f1c21cSLuciano Coelho 	int n_match_sets;
143288e920b4SThomas Pedersen 	s32 rssi_thold;
1433807f8a8cSLuciano Coelho 
1434807f8a8cSLuciano Coelho 	/* internal */
1435807f8a8cSLuciano Coelho 	struct wiphy *wiphy;
1436807f8a8cSLuciano Coelho 	struct net_device *dev;
143715d6030bSSam Leffler 	unsigned long scan_start;
1438807f8a8cSLuciano Coelho 
1439807f8a8cSLuciano Coelho 	/* keep last */
1440807f8a8cSLuciano Coelho 	struct ieee80211_channel *channels[0];
1441807f8a8cSLuciano Coelho };
1442807f8a8cSLuciano Coelho 
1443807f8a8cSLuciano Coelho /**
14442a519311SJohannes Berg  * enum cfg80211_signal_type - signal type
14452a519311SJohannes Berg  *
14462a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available
14472a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm)
14482a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100
14492a519311SJohannes Berg  */
14502a519311SJohannes Berg enum cfg80211_signal_type {
14512a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_NONE,
14522a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_MBM,
14532a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_UNSPEC,
14542a519311SJohannes Berg };
14552a519311SJohannes Berg 
14562a519311SJohannes Berg /**
14579caf0364SJohannes Berg  * struct cfg80211_bss_ie_data - BSS entry IE data
14588cef2c9dSJohannes Berg  * @tsf: TSF contained in the frame that carried these IEs
14599caf0364SJohannes Berg  * @rcu_head: internal use, for freeing
14609caf0364SJohannes Berg  * @len: length of the IEs
14619caf0364SJohannes Berg  * @data: IE data
14629caf0364SJohannes Berg  */
14639caf0364SJohannes Berg struct cfg80211_bss_ies {
14648cef2c9dSJohannes Berg 	u64 tsf;
14659caf0364SJohannes Berg 	struct rcu_head rcu_head;
14669caf0364SJohannes Berg 	int len;
14679caf0364SJohannes Berg 	u8 data[];
14689caf0364SJohannes Berg };
14699caf0364SJohannes Berg 
14709caf0364SJohannes Berg /**
14712a519311SJohannes Berg  * struct cfg80211_bss - BSS description
14722a519311SJohannes Berg  *
14732a519311SJohannes Berg  * This structure describes a BSS (which may also be a mesh network)
14742a519311SJohannes Berg  * for use in scan results and similar.
14752a519311SJohannes Berg  *
1476abe37c4bSJohannes Berg  * @channel: channel this BSS is on
1477dcd6eac1SSimon Wunderlich  * @scan_width: width of the control channel
14782a519311SJohannes Berg  * @bssid: BSSID of the BSS
14792a519311SJohannes Berg  * @beacon_interval: the beacon interval as from the frame
14802a519311SJohannes Berg  * @capability: the capability field in host byte order
148183c7aa1aSJohannes Berg  * @ies: the information elements (Note that there is no guarantee that these
148283c7aa1aSJohannes Berg  *	are well-formed!); this is a pointer to either the beacon_ies or
148383c7aa1aSJohannes Berg  *	proberesp_ies depending on whether Probe Response frame has been
148483c7aa1aSJohannes Berg  *	received. It is always non-%NULL.
148534a6eddbSJouni Malinen  * @beacon_ies: the information elements from the last Beacon frame
1486776b3580SJohannes Berg  *	(implementation note: if @hidden_beacon_bss is set this struct doesn't
1487776b3580SJohannes Berg  *	own the beacon_ies, but they're just pointers to the ones from the
1488776b3580SJohannes Berg  *	@hidden_beacon_bss struct)
148934a6eddbSJouni Malinen  * @proberesp_ies: the information elements from the last Probe Response frame
1490776b3580SJohannes Berg  * @hidden_beacon_bss: in case this BSS struct represents a probe response from
1491776b3580SJohannes Berg  *	a BSS that hides the SSID in its beacon, this points to the BSS struct
1492776b3580SJohannes Berg  *	that holds the beacon data. @beacon_ies is still valid, of course, and
1493776b3580SJohannes Berg  *	points to the same data as hidden_beacon_bss->beacon_ies in that case.
149477965c97SJohannes Berg  * @signal: signal strength value (type depends on the wiphy's signal_type)
14952a519311SJohannes Berg  * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
14962a519311SJohannes Berg  */
14972a519311SJohannes Berg struct cfg80211_bss {
14982a519311SJohannes Berg 	struct ieee80211_channel *channel;
1499dcd6eac1SSimon Wunderlich 	enum nl80211_bss_scan_width scan_width;
15002a519311SJohannes Berg 
15019caf0364SJohannes Berg 	const struct cfg80211_bss_ies __rcu *ies;
15029caf0364SJohannes Berg 	const struct cfg80211_bss_ies __rcu *beacon_ies;
15039caf0364SJohannes Berg 	const struct cfg80211_bss_ies __rcu *proberesp_ies;
15049caf0364SJohannes Berg 
1505776b3580SJohannes Berg 	struct cfg80211_bss *hidden_beacon_bss;
15062a519311SJohannes Berg 
15072a519311SJohannes Berg 	s32 signal;
15082a519311SJohannes Berg 
15099caf0364SJohannes Berg 	u16 beacon_interval;
15109caf0364SJohannes Berg 	u16 capability;
15119caf0364SJohannes Berg 
15129caf0364SJohannes Berg 	u8 bssid[ETH_ALEN];
15139caf0364SJohannes Berg 
15141c06ef98SJohannes Berg 	u8 priv[0] __aligned(sizeof(void *));
15152a519311SJohannes Berg };
15162a519311SJohannes Berg 
15172a519311SJohannes Berg /**
1518517357c6SJohannes Berg  * ieee80211_bss_get_ie - find IE with given ID
1519517357c6SJohannes Berg  * @bss: the bss to search
1520517357c6SJohannes Berg  * @ie: the IE ID
15219caf0364SJohannes Berg  *
15229caf0364SJohannes Berg  * Note that the return value is an RCU-protected pointer, so
15239caf0364SJohannes Berg  * rcu_read_lock() must be held when calling this function.
15240ae997dcSYacine Belkadi  * Return: %NULL if not found.
1525517357c6SJohannes Berg  */
1526517357c6SJohannes Berg const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie);
1527517357c6SJohannes Berg 
1528517357c6SJohannes Berg 
1529517357c6SJohannes Berg /**
1530636a5d36SJouni Malinen  * struct cfg80211_auth_request - Authentication request data
1531636a5d36SJouni Malinen  *
1532636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
1533636a5d36SJouni Malinen  * authentication.
1534636a5d36SJouni Malinen  *
1535959867faSJohannes Berg  * @bss: The BSS to authenticate with, the callee must obtain a reference
1536959867faSJohannes Berg  *	to it if it needs to keep it.
1537636a5d36SJouni Malinen  * @auth_type: Authentication type (algorithm)
1538636a5d36SJouni Malinen  * @ie: Extra IEs to add to Authentication frame or %NULL
1539636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
1540fffd0934SJohannes Berg  * @key_len: length of WEP key for shared key authentication
1541fffd0934SJohannes Berg  * @key_idx: index of WEP key for shared key authentication
1542fffd0934SJohannes Berg  * @key: WEP key for shared key authentication
1543e39e5b5eSJouni Malinen  * @sae_data: Non-IE data to use with SAE or %NULL. This starts with
1544e39e5b5eSJouni Malinen  *	Authentication transaction sequence number field.
1545e39e5b5eSJouni Malinen  * @sae_data_len: Length of sae_data buffer in octets
1546636a5d36SJouni Malinen  */
1547636a5d36SJouni Malinen struct cfg80211_auth_request {
154819957bb3SJohannes Berg 	struct cfg80211_bss *bss;
1549636a5d36SJouni Malinen 	const u8 *ie;
1550636a5d36SJouni Malinen 	size_t ie_len;
155119957bb3SJohannes Berg 	enum nl80211_auth_type auth_type;
1552fffd0934SJohannes Berg 	const u8 *key;
1553fffd0934SJohannes Berg 	u8 key_len, key_idx;
1554e39e5b5eSJouni Malinen 	const u8 *sae_data;
1555e39e5b5eSJouni Malinen 	size_t sae_data_len;
1556636a5d36SJouni Malinen };
1557636a5d36SJouni Malinen 
1558636a5d36SJouni Malinen /**
15597e7c8926SBen Greear  * enum cfg80211_assoc_req_flags - Over-ride default behaviour in association.
15607e7c8926SBen Greear  *
15617e7c8926SBen Greear  * @ASSOC_REQ_DISABLE_HT:  Disable HT (802.11n)
1562ee2aca34SJohannes Berg  * @ASSOC_REQ_DISABLE_VHT:  Disable VHT
15637e7c8926SBen Greear  */
15647e7c8926SBen Greear enum cfg80211_assoc_req_flags {
15657e7c8926SBen Greear 	ASSOC_REQ_DISABLE_HT		= BIT(0),
1566ee2aca34SJohannes Berg 	ASSOC_REQ_DISABLE_VHT		= BIT(1),
15677e7c8926SBen Greear };
15687e7c8926SBen Greear 
15697e7c8926SBen Greear /**
1570636a5d36SJouni Malinen  * struct cfg80211_assoc_request - (Re)Association request data
1571636a5d36SJouni Malinen  *
1572636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
1573636a5d36SJouni Malinen  * (re)association.
1574959867faSJohannes Berg  * @bss: The BSS to associate with. If the call is successful the driver is
1575959867faSJohannes Berg  *	given a reference that it must give back to cfg80211_send_rx_assoc()
1576959867faSJohannes Berg  *	or to cfg80211_assoc_timeout(). To ensure proper refcounting, new
1577959867faSJohannes Berg  *	association requests while already associating must be rejected.
1578636a5d36SJouni Malinen  * @ie: Extra IEs to add to (Re)Association Request frame or %NULL
1579636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
1580dc6382ceSJouni Malinen  * @use_mfp: Use management frame protection (IEEE 802.11w) in this association
1581b23aa676SSamuel Ortiz  * @crypto: crypto settings
15823e5d7649SJohannes Berg  * @prev_bssid: previous BSSID, if not %NULL use reassociate frame
15837e7c8926SBen Greear  * @flags:  See &enum cfg80211_assoc_req_flags
15847e7c8926SBen Greear  * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask
15857e7c8926SBen Greear  *	will be used in ht_capa.  Un-supported values will be ignored.
15867e7c8926SBen Greear  * @ht_capa_mask:  The bits of ht_capa which are to be used.
1587ee2aca34SJohannes Berg  * @vht_capa: VHT capability override
1588ee2aca34SJohannes Berg  * @vht_capa_mask: VHT capability mask indicating which fields to use
1589636a5d36SJouni Malinen  */
1590636a5d36SJouni Malinen struct cfg80211_assoc_request {
159119957bb3SJohannes Berg 	struct cfg80211_bss *bss;
15923e5d7649SJohannes Berg 	const u8 *ie, *prev_bssid;
1593636a5d36SJouni Malinen 	size_t ie_len;
1594b23aa676SSamuel Ortiz 	struct cfg80211_crypto_settings crypto;
159519957bb3SJohannes Berg 	bool use_mfp;
15967e7c8926SBen Greear 	u32 flags;
15977e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa;
15987e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa_mask;
1599ee2aca34SJohannes Berg 	struct ieee80211_vht_cap vht_capa, vht_capa_mask;
1600636a5d36SJouni Malinen };
1601636a5d36SJouni Malinen 
1602636a5d36SJouni Malinen /**
1603636a5d36SJouni Malinen  * struct cfg80211_deauth_request - Deauthentication request data
1604636a5d36SJouni Malinen  *
1605636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
1606636a5d36SJouni Malinen  * deauthentication.
1607636a5d36SJouni Malinen  *
160895de817bSJohannes Berg  * @bssid: the BSSID of the BSS to deauthenticate from
1609636a5d36SJouni Malinen  * @ie: Extra IEs to add to Deauthentication frame or %NULL
1610636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
161119957bb3SJohannes Berg  * @reason_code: The reason code for the deauthentication
1612077f897aSJohannes Berg  * @local_state_change: if set, change local state only and
1613077f897aSJohannes Berg  *	do not set a deauth frame
1614636a5d36SJouni Malinen  */
1615636a5d36SJouni Malinen struct cfg80211_deauth_request {
161695de817bSJohannes Berg 	const u8 *bssid;
1617636a5d36SJouni Malinen 	const u8 *ie;
1618636a5d36SJouni Malinen 	size_t ie_len;
161919957bb3SJohannes Berg 	u16 reason_code;
16206863255bSStanislaw Gruszka 	bool local_state_change;
1621636a5d36SJouni Malinen };
1622636a5d36SJouni Malinen 
1623636a5d36SJouni Malinen /**
1624636a5d36SJouni Malinen  * struct cfg80211_disassoc_request - Disassociation request data
1625636a5d36SJouni Malinen  *
1626636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
1627636a5d36SJouni Malinen  * disassocation.
1628636a5d36SJouni Malinen  *
162919957bb3SJohannes Berg  * @bss: the BSS to disassociate from
1630636a5d36SJouni Malinen  * @ie: Extra IEs to add to Disassociation frame or %NULL
1631636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
163219957bb3SJohannes Berg  * @reason_code: The reason code for the disassociation
1633d5cdfacbSJouni Malinen  * @local_state_change: This is a request for a local state only, i.e., no
1634d5cdfacbSJouni Malinen  *	Disassociation frame is to be transmitted.
1635636a5d36SJouni Malinen  */
1636636a5d36SJouni Malinen struct cfg80211_disassoc_request {
163719957bb3SJohannes Berg 	struct cfg80211_bss *bss;
1638636a5d36SJouni Malinen 	const u8 *ie;
1639636a5d36SJouni Malinen 	size_t ie_len;
164019957bb3SJohannes Berg 	u16 reason_code;
1641d5cdfacbSJouni Malinen 	bool local_state_change;
1642636a5d36SJouni Malinen };
1643636a5d36SJouni Malinen 
1644636a5d36SJouni Malinen /**
164504a773adSJohannes Berg  * struct cfg80211_ibss_params - IBSS parameters
164604a773adSJohannes Berg  *
164704a773adSJohannes Berg  * This structure defines the IBSS parameters for the join_ibss()
164804a773adSJohannes Berg  * method.
164904a773adSJohannes Berg  *
165004a773adSJohannes Berg  * @ssid: The SSID, will always be non-null.
165104a773adSJohannes Berg  * @ssid_len: The length of the SSID, will always be non-zero.
165204a773adSJohannes Berg  * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not
165304a773adSJohannes Berg  *	search for IBSSs with a different BSSID.
1654683b6d3bSJohannes Berg  * @chandef: defines the channel to use if no other IBSS to join can be found
165504a773adSJohannes Berg  * @channel_fixed: The channel should be fixed -- do not search for
165604a773adSJohannes Berg  *	IBSSs to join on other channels.
165704a773adSJohannes Berg  * @ie: information element(s) to include in the beacon
165804a773adSJohannes Berg  * @ie_len: length of that
16598e30bc55SJohannes Berg  * @beacon_interval: beacon interval to use
1660fffd0934SJohannes Berg  * @privacy: this is a protected network, keys will be configured
1661fffd0934SJohannes Berg  *	after joining
1662267335d6SAntonio Quartulli  * @control_port: whether user space controls IEEE 802.1X port, i.e.,
1663267335d6SAntonio Quartulli  *	sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
1664267335d6SAntonio Quartulli  *	required to assume that the port is unauthorized until authorized by
1665267335d6SAntonio Quartulli  *	user space. Otherwise, port is marked authorized by default.
16665336fa88SSimon Wunderlich  * @userspace_handles_dfs: whether user space controls DFS operation, i.e.
16675336fa88SSimon Wunderlich  *	changes the channel when a radar is detected. This is required
16685336fa88SSimon Wunderlich  *	to operate on DFS channels.
1669fbd2c8dcSTeemu Paasikivi  * @basic_rates: bitmap of basic rates to use when creating the IBSS
1670dd5b4cc7SFelix Fietkau  * @mcast_rate: per-band multicast rate index + 1 (0: disabled)
1671803768f5SSimon Wunderlich  * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask
1672803768f5SSimon Wunderlich  *	will be used in ht_capa.  Un-supported values will be ignored.
1673803768f5SSimon Wunderlich  * @ht_capa_mask:  The bits of ht_capa which are to be used.
167404a773adSJohannes Berg  */
167504a773adSJohannes Berg struct cfg80211_ibss_params {
167604a773adSJohannes Berg 	u8 *ssid;
167704a773adSJohannes Berg 	u8 *bssid;
1678683b6d3bSJohannes Berg 	struct cfg80211_chan_def chandef;
167904a773adSJohannes Berg 	u8 *ie;
168004a773adSJohannes Berg 	u8 ssid_len, ie_len;
16818e30bc55SJohannes Berg 	u16 beacon_interval;
1682fbd2c8dcSTeemu Paasikivi 	u32 basic_rates;
168304a773adSJohannes Berg 	bool channel_fixed;
1684fffd0934SJohannes Berg 	bool privacy;
1685267335d6SAntonio Quartulli 	bool control_port;
16865336fa88SSimon Wunderlich 	bool userspace_handles_dfs;
1687dd5b4cc7SFelix Fietkau 	int mcast_rate[IEEE80211_NUM_BANDS];
1688803768f5SSimon Wunderlich 	struct ieee80211_ht_cap ht_capa;
1689803768f5SSimon Wunderlich 	struct ieee80211_ht_cap ht_capa_mask;
169004a773adSJohannes Berg };
169104a773adSJohannes Berg 
169204a773adSJohannes Berg /**
1693b23aa676SSamuel Ortiz  * struct cfg80211_connect_params - Connection parameters
1694b23aa676SSamuel Ortiz  *
1695b23aa676SSamuel Ortiz  * This structure provides information needed to complete IEEE 802.11
1696b23aa676SSamuel Ortiz  * authentication and association.
1697b23aa676SSamuel Ortiz  *
1698b23aa676SSamuel Ortiz  * @channel: The channel to use or %NULL if not specified (auto-select based
1699b23aa676SSamuel Ortiz  *	on scan results)
1700b23aa676SSamuel Ortiz  * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan
1701b23aa676SSamuel Ortiz  *	results)
1702b23aa676SSamuel Ortiz  * @ssid: SSID
1703b23aa676SSamuel Ortiz  * @ssid_len: Length of ssid in octets
1704b23aa676SSamuel Ortiz  * @auth_type: Authentication type (algorithm)
1705abe37c4bSJohannes Berg  * @ie: IEs for association request
1706abe37c4bSJohannes Berg  * @ie_len: Length of assoc_ie in octets
1707b23aa676SSamuel Ortiz  * @privacy: indicates whether privacy-enabled APs should be used
1708cee00a95SJouni Malinen  * @mfp: indicate whether management frame protection is used
1709b23aa676SSamuel Ortiz  * @crypto: crypto settings
1710fffd0934SJohannes Berg  * @key_len: length of WEP key for shared key authentication
1711fffd0934SJohannes Berg  * @key_idx: index of WEP key for shared key authentication
1712fffd0934SJohannes Berg  * @key: WEP key for shared key authentication
17137e7c8926SBen Greear  * @flags:  See &enum cfg80211_assoc_req_flags
17144486ea98SBala Shanmugam  * @bg_scan_period:  Background scan period in seconds
17154486ea98SBala Shanmugam  *	or -1 to indicate that default value is to be used.
17167e7c8926SBen Greear  * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask
17177e7c8926SBen Greear  *	will be used in ht_capa.  Un-supported values will be ignored.
17187e7c8926SBen Greear  * @ht_capa_mask:  The bits of ht_capa which are to be used.
1719ee2aca34SJohannes Berg  * @vht_capa:  VHT Capability overrides
1720ee2aca34SJohannes Berg  * @vht_capa_mask: The bits of vht_capa which are to be used.
1721b23aa676SSamuel Ortiz  */
1722b23aa676SSamuel Ortiz struct cfg80211_connect_params {
1723b23aa676SSamuel Ortiz 	struct ieee80211_channel *channel;
1724b23aa676SSamuel Ortiz 	u8 *bssid;
1725b23aa676SSamuel Ortiz 	u8 *ssid;
1726b23aa676SSamuel Ortiz 	size_t ssid_len;
1727b23aa676SSamuel Ortiz 	enum nl80211_auth_type auth_type;
1728b23aa676SSamuel Ortiz 	u8 *ie;
1729b23aa676SSamuel Ortiz 	size_t ie_len;
1730b23aa676SSamuel Ortiz 	bool privacy;
1731cee00a95SJouni Malinen 	enum nl80211_mfp mfp;
1732b23aa676SSamuel Ortiz 	struct cfg80211_crypto_settings crypto;
1733fffd0934SJohannes Berg 	const u8 *key;
1734fffd0934SJohannes Berg 	u8 key_len, key_idx;
17357e7c8926SBen Greear 	u32 flags;
17364486ea98SBala Shanmugam 	int bg_scan_period;
17377e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa;
17387e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa_mask;
1739ee2aca34SJohannes Berg 	struct ieee80211_vht_cap vht_capa;
1740ee2aca34SJohannes Berg 	struct ieee80211_vht_cap vht_capa_mask;
1741b23aa676SSamuel Ortiz };
1742b23aa676SSamuel Ortiz 
1743b23aa676SSamuel Ortiz /**
1744b9a5f8caSJouni Malinen  * enum wiphy_params_flags - set_wiphy_params bitfield values
1745abe37c4bSJohannes Berg  * @WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed
1746abe37c4bSJohannes Berg  * @WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed
1747abe37c4bSJohannes Berg  * @WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed
1748abe37c4bSJohannes Berg  * @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed
1749abe37c4bSJohannes Berg  * @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed
1750b9a5f8caSJouni Malinen  */
1751b9a5f8caSJouni Malinen enum wiphy_params_flags {
1752b9a5f8caSJouni Malinen 	WIPHY_PARAM_RETRY_SHORT		= 1 << 0,
1753b9a5f8caSJouni Malinen 	WIPHY_PARAM_RETRY_LONG		= 1 << 1,
1754b9a5f8caSJouni Malinen 	WIPHY_PARAM_FRAG_THRESHOLD	= 1 << 2,
1755b9a5f8caSJouni Malinen 	WIPHY_PARAM_RTS_THRESHOLD	= 1 << 3,
175681077e82SLukáš Turek 	WIPHY_PARAM_COVERAGE_CLASS	= 1 << 4,
1757b9a5f8caSJouni Malinen };
1758b9a5f8caSJouni Malinen 
17599930380fSJohannes Berg /*
17609930380fSJohannes Berg  * cfg80211_bitrate_mask - masks for bitrate control
17619930380fSJohannes Berg  */
17629930380fSJohannes Berg struct cfg80211_bitrate_mask {
17639930380fSJohannes Berg 	struct {
17649930380fSJohannes Berg 		u32 legacy;
176524db78c0SSimon Wunderlich 		u8 mcs[IEEE80211_HT_MCS_MASK_LEN];
17669930380fSJohannes Berg 	} control[IEEE80211_NUM_BANDS];
17679930380fSJohannes Berg };
176867fbb16bSSamuel Ortiz /**
176967fbb16bSSamuel Ortiz  * struct cfg80211_pmksa - PMK Security Association
177067fbb16bSSamuel Ortiz  *
177167fbb16bSSamuel Ortiz  * This structure is passed to the set/del_pmksa() method for PMKSA
177267fbb16bSSamuel Ortiz  * caching.
177367fbb16bSSamuel Ortiz  *
177467fbb16bSSamuel Ortiz  * @bssid: The AP's BSSID.
177567fbb16bSSamuel Ortiz  * @pmkid: The PMK material itself.
177667fbb16bSSamuel Ortiz  */
177767fbb16bSSamuel Ortiz struct cfg80211_pmksa {
177867fbb16bSSamuel Ortiz 	u8 *bssid;
177967fbb16bSSamuel Ortiz 	u8 *pmkid;
178067fbb16bSSamuel Ortiz };
17819930380fSJohannes Berg 
17827643a2c3SJohannes Berg /**
178350ac6607SAmitkumar Karwar  * struct cfg80211_pkt_pattern - packet pattern
1784ff1b6e69SJohannes Berg  * @mask: bitmask where to match pattern and where to ignore bytes,
1785ff1b6e69SJohannes Berg  *	one bit per byte, in same format as nl80211
1786ff1b6e69SJohannes Berg  * @pattern: bytes to match where bitmask is 1
1787ff1b6e69SJohannes Berg  * @pattern_len: length of pattern (in bytes)
1788bb92d199SAmitkumar Karwar  * @pkt_offset: packet offset (in bytes)
1789ff1b6e69SJohannes Berg  *
1790ff1b6e69SJohannes Berg  * Internal note: @mask and @pattern are allocated in one chunk of
1791ff1b6e69SJohannes Berg  * memory, free @mask only!
1792ff1b6e69SJohannes Berg  */
179350ac6607SAmitkumar Karwar struct cfg80211_pkt_pattern {
1794ff1b6e69SJohannes Berg 	u8 *mask, *pattern;
1795ff1b6e69SJohannes Berg 	int pattern_len;
1796bb92d199SAmitkumar Karwar 	int pkt_offset;
1797ff1b6e69SJohannes Berg };
1798ff1b6e69SJohannes Berg 
1799ff1b6e69SJohannes Berg /**
18002a0e047eSJohannes Berg  * struct cfg80211_wowlan_tcp - TCP connection parameters
18012a0e047eSJohannes Berg  *
18022a0e047eSJohannes Berg  * @sock: (internal) socket for source port allocation
18032a0e047eSJohannes Berg  * @src: source IP address
18042a0e047eSJohannes Berg  * @dst: destination IP address
18052a0e047eSJohannes Berg  * @dst_mac: destination MAC address
18062a0e047eSJohannes Berg  * @src_port: source port
18072a0e047eSJohannes Berg  * @dst_port: destination port
18082a0e047eSJohannes Berg  * @payload_len: data payload length
18092a0e047eSJohannes Berg  * @payload: data payload buffer
18102a0e047eSJohannes Berg  * @payload_seq: payload sequence stamping configuration
18112a0e047eSJohannes Berg  * @data_interval: interval at which to send data packets
18122a0e047eSJohannes Berg  * @wake_len: wakeup payload match length
18132a0e047eSJohannes Berg  * @wake_data: wakeup payload match data
18142a0e047eSJohannes Berg  * @wake_mask: wakeup payload match mask
18152a0e047eSJohannes Berg  * @tokens_size: length of the tokens buffer
18162a0e047eSJohannes Berg  * @payload_tok: payload token usage configuration
18172a0e047eSJohannes Berg  */
18182a0e047eSJohannes Berg struct cfg80211_wowlan_tcp {
18192a0e047eSJohannes Berg 	struct socket *sock;
18202a0e047eSJohannes Berg 	__be32 src, dst;
18212a0e047eSJohannes Berg 	u16 src_port, dst_port;
18222a0e047eSJohannes Berg 	u8 dst_mac[ETH_ALEN];
18232a0e047eSJohannes Berg 	int payload_len;
18242a0e047eSJohannes Berg 	const u8 *payload;
18252a0e047eSJohannes Berg 	struct nl80211_wowlan_tcp_data_seq payload_seq;
18262a0e047eSJohannes Berg 	u32 data_interval;
18272a0e047eSJohannes Berg 	u32 wake_len;
18282a0e047eSJohannes Berg 	const u8 *wake_data, *wake_mask;
18292a0e047eSJohannes Berg 	u32 tokens_size;
18302a0e047eSJohannes Berg 	/* must be last, variable member */
18312a0e047eSJohannes Berg 	struct nl80211_wowlan_tcp_data_token payload_tok;
1832ff1b6e69SJohannes Berg };
1833ff1b6e69SJohannes Berg 
1834ff1b6e69SJohannes Berg /**
1835ff1b6e69SJohannes Berg  * struct cfg80211_wowlan - Wake on Wireless-LAN support info
1836ff1b6e69SJohannes Berg  *
1837ff1b6e69SJohannes Berg  * This structure defines the enabled WoWLAN triggers for the device.
1838ff1b6e69SJohannes Berg  * @any: wake up on any activity -- special trigger if device continues
1839ff1b6e69SJohannes Berg  *	operating as normal during suspend
1840ff1b6e69SJohannes Berg  * @disconnect: wake up if getting disconnected
1841ff1b6e69SJohannes Berg  * @magic_pkt: wake up on receiving magic packet
1842ff1b6e69SJohannes Berg  * @patterns: wake up on receiving packet matching a pattern
1843ff1b6e69SJohannes Berg  * @n_patterns: number of patterns
184477dbbb13SJohannes Berg  * @gtk_rekey_failure: wake up on GTK rekey failure
184577dbbb13SJohannes Berg  * @eap_identity_req: wake up on EAP identity request packet
184677dbbb13SJohannes Berg  * @four_way_handshake: wake up on 4-way handshake
184777dbbb13SJohannes Berg  * @rfkill_release: wake up when rfkill is released
18482a0e047eSJohannes Berg  * @tcp: TCP connection establishment/wakeup parameters, see nl80211.h.
18492a0e047eSJohannes Berg  *	NULL if not configured.
1850ff1b6e69SJohannes Berg  */
1851ff1b6e69SJohannes Berg struct cfg80211_wowlan {
185277dbbb13SJohannes Berg 	bool any, disconnect, magic_pkt, gtk_rekey_failure,
185377dbbb13SJohannes Berg 	     eap_identity_req, four_way_handshake,
185477dbbb13SJohannes Berg 	     rfkill_release;
185550ac6607SAmitkumar Karwar 	struct cfg80211_pkt_pattern *patterns;
18562a0e047eSJohannes Berg 	struct cfg80211_wowlan_tcp *tcp;
1857ff1b6e69SJohannes Berg 	int n_patterns;
1858ff1b6e69SJohannes Berg };
1859ff1b6e69SJohannes Berg 
1860ff1b6e69SJohannes Berg /**
1861be29b99aSAmitkumar Karwar  * struct cfg80211_coalesce_rules - Coalesce rule parameters
1862be29b99aSAmitkumar Karwar  *
1863be29b99aSAmitkumar Karwar  * This structure defines coalesce rule for the device.
1864be29b99aSAmitkumar Karwar  * @delay: maximum coalescing delay in msecs.
1865be29b99aSAmitkumar Karwar  * @condition: condition for packet coalescence.
1866be29b99aSAmitkumar Karwar  *	see &enum nl80211_coalesce_condition.
1867be29b99aSAmitkumar Karwar  * @patterns: array of packet patterns
1868be29b99aSAmitkumar Karwar  * @n_patterns: number of patterns
1869be29b99aSAmitkumar Karwar  */
1870be29b99aSAmitkumar Karwar struct cfg80211_coalesce_rules {
1871be29b99aSAmitkumar Karwar 	int delay;
1872be29b99aSAmitkumar Karwar 	enum nl80211_coalesce_condition condition;
1873be29b99aSAmitkumar Karwar 	struct cfg80211_pkt_pattern *patterns;
1874be29b99aSAmitkumar Karwar 	int n_patterns;
1875be29b99aSAmitkumar Karwar };
1876be29b99aSAmitkumar Karwar 
1877be29b99aSAmitkumar Karwar /**
1878be29b99aSAmitkumar Karwar  * struct cfg80211_coalesce - Packet coalescing settings
1879be29b99aSAmitkumar Karwar  *
1880be29b99aSAmitkumar Karwar  * This structure defines coalescing settings.
1881be29b99aSAmitkumar Karwar  * @rules: array of coalesce rules
1882be29b99aSAmitkumar Karwar  * @n_rules: number of rules
1883be29b99aSAmitkumar Karwar  */
1884be29b99aSAmitkumar Karwar struct cfg80211_coalesce {
1885be29b99aSAmitkumar Karwar 	struct cfg80211_coalesce_rules *rules;
1886be29b99aSAmitkumar Karwar 	int n_rules;
1887be29b99aSAmitkumar Karwar };
1888be29b99aSAmitkumar Karwar 
1889be29b99aSAmitkumar Karwar /**
1890cd8f7cb4SJohannes Berg  * struct cfg80211_wowlan_wakeup - wakeup report
1891cd8f7cb4SJohannes Berg  * @disconnect: woke up by getting disconnected
1892cd8f7cb4SJohannes Berg  * @magic_pkt: woke up by receiving magic packet
1893cd8f7cb4SJohannes Berg  * @gtk_rekey_failure: woke up by GTK rekey failure
1894cd8f7cb4SJohannes Berg  * @eap_identity_req: woke up by EAP identity request packet
1895cd8f7cb4SJohannes Berg  * @four_way_handshake: woke up by 4-way handshake
1896cd8f7cb4SJohannes Berg  * @rfkill_release: woke up by rfkill being released
1897cd8f7cb4SJohannes Berg  * @pattern_idx: pattern that caused wakeup, -1 if not due to pattern
1898cd8f7cb4SJohannes Berg  * @packet_present_len: copied wakeup packet data
1899cd8f7cb4SJohannes Berg  * @packet_len: original wakeup packet length
1900cd8f7cb4SJohannes Berg  * @packet: The packet causing the wakeup, if any.
1901cd8f7cb4SJohannes Berg  * @packet_80211:  For pattern match, magic packet and other data
1902cd8f7cb4SJohannes Berg  *	frame triggers an 802.3 frame should be reported, for
1903cd8f7cb4SJohannes Berg  *	disconnect due to deauth 802.11 frame. This indicates which
1904cd8f7cb4SJohannes Berg  *	it is.
19052a0e047eSJohannes Berg  * @tcp_match: TCP wakeup packet received
19062a0e047eSJohannes Berg  * @tcp_connlost: TCP connection lost or failed to establish
19072a0e047eSJohannes Berg  * @tcp_nomoretokens: TCP data ran out of tokens
1908cd8f7cb4SJohannes Berg  */
1909cd8f7cb4SJohannes Berg struct cfg80211_wowlan_wakeup {
1910cd8f7cb4SJohannes Berg 	bool disconnect, magic_pkt, gtk_rekey_failure,
1911cd8f7cb4SJohannes Berg 	     eap_identity_req, four_way_handshake,
19122a0e047eSJohannes Berg 	     rfkill_release, packet_80211,
19132a0e047eSJohannes Berg 	     tcp_match, tcp_connlost, tcp_nomoretokens;
1914cd8f7cb4SJohannes Berg 	s32 pattern_idx;
1915cd8f7cb4SJohannes Berg 	u32 packet_present_len, packet_len;
1916cd8f7cb4SJohannes Berg 	const void *packet;
1917cd8f7cb4SJohannes Berg };
1918cd8f7cb4SJohannes Berg 
1919cd8f7cb4SJohannes Berg /**
1920e5497d76SJohannes Berg  * struct cfg80211_gtk_rekey_data - rekey data
1921e5497d76SJohannes Berg  * @kek: key encryption key
1922e5497d76SJohannes Berg  * @kck: key confirmation key
1923e5497d76SJohannes Berg  * @replay_ctr: replay counter
1924e5497d76SJohannes Berg  */
1925e5497d76SJohannes Berg struct cfg80211_gtk_rekey_data {
1926e5497d76SJohannes Berg 	u8 kek[NL80211_KEK_LEN];
1927e5497d76SJohannes Berg 	u8 kck[NL80211_KCK_LEN];
1928e5497d76SJohannes Berg 	u8 replay_ctr[NL80211_REPLAY_CTR_LEN];
1929e5497d76SJohannes Berg };
1930e5497d76SJohannes Berg 
1931e5497d76SJohannes Berg /**
1932355199e0SJouni Malinen  * struct cfg80211_update_ft_ies_params - FT IE Information
1933355199e0SJouni Malinen  *
1934355199e0SJouni Malinen  * This structure provides information needed to update the fast transition IE
1935355199e0SJouni Malinen  *
1936355199e0SJouni Malinen  * @md: The Mobility Domain ID, 2 Octet value
1937355199e0SJouni Malinen  * @ie: Fast Transition IEs
1938355199e0SJouni Malinen  * @ie_len: Length of ft_ie in octets
1939355199e0SJouni Malinen  */
1940355199e0SJouni Malinen struct cfg80211_update_ft_ies_params {
1941355199e0SJouni Malinen 	u16 md;
1942355199e0SJouni Malinen 	const u8 *ie;
1943355199e0SJouni Malinen 	size_t ie_len;
1944355199e0SJouni Malinen };
1945355199e0SJouni Malinen 
1946355199e0SJouni Malinen /**
1947704232c2SJohannes Berg  * struct cfg80211_ops - backend description for wireless configuration
1948704232c2SJohannes Berg  *
1949704232c2SJohannes Berg  * This struct is registered by fullmac card drivers and/or wireless stacks
1950704232c2SJohannes Berg  * in order to handle configuration requests on their interfaces.
1951704232c2SJohannes Berg  *
1952704232c2SJohannes Berg  * All callbacks except where otherwise noted should return 0
1953704232c2SJohannes Berg  * on success or a negative error code.
1954704232c2SJohannes Berg  *
195543fb45cbSJohannes Berg  * All operations are currently invoked under rtnl for consistency with the
195643fb45cbSJohannes Berg  * wireless extensions but this is subject to reevaluation as soon as this
195743fb45cbSJohannes Berg  * code is used more widely and we have a first user without wext.
195843fb45cbSJohannes Berg  *
1959ff1b6e69SJohannes Berg  * @suspend: wiphy device needs to be suspended. The variable @wow will
1960ff1b6e69SJohannes Berg  *	be %NULL or contain the enabled Wake-on-Wireless triggers that are
1961ff1b6e69SJohannes Berg  *	configured for the device.
19620378b3f1SJohannes Berg  * @resume: wiphy device needs to be resumed
19636d52563fSJohannes Berg  * @set_wakeup: Called when WoWLAN is enabled/disabled, use this callback
19646d52563fSJohannes Berg  *	to call device_set_wakeup_enable() to enable/disable wakeup from
19656d52563fSJohannes Berg  *	the device.
19660378b3f1SJohannes Berg  *
196760719ffdSJohannes Berg  * @add_virtual_intf: create a new virtual interface with the given name,
1968463d0183SJohannes Berg  *	must set the struct wireless_dev's iftype. Beware: You must create
196984efbb84SJohannes Berg  *	the new netdev in the wiphy's network namespace! Returns the struct
197098104fdeSJohannes Berg  *	wireless_dev, or an ERR_PTR. For P2P device wdevs, the driver must
197198104fdeSJohannes Berg  *	also set the address member in the wdev.
1972704232c2SJohannes Berg  *
197384efbb84SJohannes Berg  * @del_virtual_intf: remove the virtual interface
197455682965SJohannes Berg  *
197560719ffdSJohannes Berg  * @change_virtual_intf: change type/configuration of virtual interface,
197660719ffdSJohannes Berg  *	keep the struct wireless_dev's iftype updated.
197755682965SJohannes Berg  *
197841ade00fSJohannes Berg  * @add_key: add a key with the given parameters. @mac_addr will be %NULL
197941ade00fSJohannes Berg  *	when adding a group key.
198041ade00fSJohannes Berg  *
198141ade00fSJohannes Berg  * @get_key: get information about the key with the given parameters.
198241ade00fSJohannes Berg  *	@mac_addr will be %NULL when requesting information for a group
198341ade00fSJohannes Berg  *	key. All pointers given to the @callback function need not be valid
1984e3da574aSJohannes Berg  *	after it returns. This function should return an error if it is
1985e3da574aSJohannes Berg  *	not possible to retrieve the key, -ENOENT if it doesn't exist.
198641ade00fSJohannes Berg  *
198741ade00fSJohannes Berg  * @del_key: remove a key given the @mac_addr (%NULL for a group key)
1988e3da574aSJohannes Berg  *	and @key_index, return -ENOENT if the key doesn't exist.
198941ade00fSJohannes Berg  *
199041ade00fSJohannes Berg  * @set_default_key: set the default key on an interface
1991ed1b6cc7SJohannes Berg  *
19923cfcf6acSJouni Malinen  * @set_default_mgmt_key: set the default management frame key on an interface
19933cfcf6acSJouni Malinen  *
1994e5497d76SJohannes Berg  * @set_rekey_data: give the data necessary for GTK rekeying to the driver
1995e5497d76SJohannes Berg  *
1996c04a4ff7SJohannes Berg  * @start_ap: Start acting in AP mode defined by the parameters.
1997c04a4ff7SJohannes Berg  * @change_beacon: Change the beacon parameters for an access point mode
1998c04a4ff7SJohannes Berg  *	interface. This should reject the call when AP mode wasn't started.
1999c04a4ff7SJohannes Berg  * @stop_ap: Stop being an AP, including stopping beaconing.
20005727ef1bSJohannes Berg  *
20015727ef1bSJohannes Berg  * @add_station: Add a new station.
20025727ef1bSJohannes Berg  * @del_station: Remove a station; @mac may be NULL to remove all stations.
2003bdd90d5eSJohannes Berg  * @change_station: Modify a given station. Note that flags changes are not much
2004bdd90d5eSJohannes Berg  *	validated in cfg80211, in particular the auth/assoc/authorized flags
2005bdd90d5eSJohannes Berg  *	might come to the driver in invalid combinations -- make sure to check
200677ee7c89SJohannes Berg  *	them, also against the existing state! Drivers must call
200777ee7c89SJohannes Berg  *	cfg80211_check_station_change() to validate the information.
2008abe37c4bSJohannes Berg  * @get_station: get station information for the station identified by @mac
2009abe37c4bSJohannes Berg  * @dump_station: dump station callback -- resume dump at index @idx
2010abe37c4bSJohannes Berg  *
2011abe37c4bSJohannes Berg  * @add_mpath: add a fixed mesh path
2012abe37c4bSJohannes Berg  * @del_mpath: delete a given mesh path
2013abe37c4bSJohannes Berg  * @change_mpath: change a given mesh path
2014abe37c4bSJohannes Berg  * @get_mpath: get a mesh path for the given parameters
2015abe37c4bSJohannes Berg  * @dump_mpath: dump mesh path callback -- resume dump at index @idx
2016f52555a4SJohannes Berg  * @join_mesh: join the mesh network with the specified parameters
20178d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
2018f52555a4SJohannes Berg  * @leave_mesh: leave the current mesh network
20198d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
20202ec600d6SLuis Carlos Cobo  *
202124bdd9f4SJavier Cardona  * @get_mesh_config: Get the current mesh configuration
202293da9cc1Scolin@cozybit.com  *
202324bdd9f4SJavier Cardona  * @update_mesh_config: Update mesh parameters on a running mesh.
202493da9cc1Scolin@cozybit.com  *	The mask is a bitfield which tells us which parameters to
202593da9cc1Scolin@cozybit.com  *	set, and which to leave alone.
202693da9cc1Scolin@cozybit.com  *
20279f1ba906SJouni Malinen  * @change_bss: Modify parameters for a given BSS.
202831888487SJouni Malinen  *
202931888487SJouni Malinen  * @set_txq_params: Set TX queue parameters
203072bdcf34SJouni Malinen  *
2031e8c9bd5bSJohannes Berg  * @libertas_set_mesh_channel: Only for backward compatibility for libertas,
2032e8c9bd5bSJohannes Berg  *	as it doesn't implement join_mesh and needs to set the channel to
2033e8c9bd5bSJohannes Berg  *	join the mesh instead.
2034e8c9bd5bSJohannes Berg  *
2035e8c9bd5bSJohannes Berg  * @set_monitor_channel: Set the monitor mode channel for the device. If other
2036e8c9bd5bSJohannes Berg  *	interfaces are active this callback should reject the configuration.
2037e8c9bd5bSJohannes Berg  *	If no interfaces are active or the device is down, the channel should
2038e8c9bd5bSJohannes Berg  *	be stored for when a monitor interface becomes active.
20399aed3cc1SJouni Malinen  *
20402a519311SJohannes Berg  * @scan: Request to do a scan. If returning zero, the scan request is given
20412a519311SJohannes Berg  *	the driver, and will be valid until passed to cfg80211_scan_done().
20422a519311SJohannes Berg  *	For scan results, call cfg80211_inform_bss(); you can call this outside
20432a519311SJohannes Berg  *	the scan/scan_done bracket too.
2044636a5d36SJouni Malinen  *
2045636a5d36SJouni Malinen  * @auth: Request to authenticate with the specified peer
20468d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
2047636a5d36SJouni Malinen  * @assoc: Request to (re)associate with the specified peer
20488d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
2049636a5d36SJouni Malinen  * @deauth: Request to deauthenticate from the specified peer
20508d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
2051636a5d36SJouni Malinen  * @disassoc: Request to disassociate from the specified peer
20528d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
205304a773adSJohannes Berg  *
2054b23aa676SSamuel Ortiz  * @connect: Connect to the ESS with the specified parameters. When connected,
2055b23aa676SSamuel Ortiz  *	call cfg80211_connect_result() with status code %WLAN_STATUS_SUCCESS.
2056b23aa676SSamuel Ortiz  *	If the connection fails for some reason, call cfg80211_connect_result()
2057b23aa676SSamuel Ortiz  *	with the status from the AP.
20588d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
2059b23aa676SSamuel Ortiz  * @disconnect: Disconnect from the BSS/ESS.
20608d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
2061b23aa676SSamuel Ortiz  *
206204a773adSJohannes Berg  * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call
206304a773adSJohannes Berg  *	cfg80211_ibss_joined(), also call that function when changing BSSID due
206404a773adSJohannes Berg  *	to a merge.
20658d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
206604a773adSJohannes Berg  * @leave_ibss: Leave the IBSS.
20678d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
2068b9a5f8caSJouni Malinen  *
2069f4e583c8SAntonio Quartulli  * @set_mcast_rate: Set the specified multicast rate (only if vif is in ADHOC or
2070f4e583c8SAntonio Quartulli  *	MESH mode)
2071f4e583c8SAntonio Quartulli  *
2072b9a5f8caSJouni Malinen  * @set_wiphy_params: Notify that wiphy parameters have changed;
2073b9a5f8caSJouni Malinen  *	@changed bitfield (see &enum wiphy_params_flags) describes which values
2074b9a5f8caSJouni Malinen  *	have changed. The actual parameter values are available in
2075b9a5f8caSJouni Malinen  *	struct wiphy. If returning an error, no value should be changed.
20767643a2c3SJohannes Berg  *
20771432de07SLuis R. Rodriguez  * @set_tx_power: set the transmit power according to the parameters,
2078c8442118SJohannes Berg  *	the power passed is in mBm, to get dBm use MBM_TO_DBM(). The
2079c8442118SJohannes Berg  *	wdev may be %NULL if power was set for the wiphy, and will
2080c8442118SJohannes Berg  *	always be %NULL unless the driver supports per-vif TX power
2081c8442118SJohannes Berg  *	(as advertised by the nl80211 feature flag.)
20827643a2c3SJohannes Berg  * @get_tx_power: store the current TX power into the dbm variable;
20831f87f7d3SJohannes Berg  *	return 0 if successful
20841f87f7d3SJohannes Berg  *
2085abe37c4bSJohannes Berg  * @set_wds_peer: set the WDS peer for a WDS interface
2086abe37c4bSJohannes Berg  *
20871f87f7d3SJohannes Berg  * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting
20881f87f7d3SJohannes Berg  *	functions to adjust rfkill hw state
2089aff89a9bSJohannes Berg  *
209061fa713cSHolger Schurig  * @dump_survey: get site survey information.
209161fa713cSHolger Schurig  *
20929588bbd5SJouni Malinen  * @remain_on_channel: Request the driver to remain awake on the specified
20939588bbd5SJouni Malinen  *	channel for the specified duration to complete an off-channel
20949588bbd5SJouni Malinen  *	operation (e.g., public action frame exchange). When the driver is
20959588bbd5SJouni Malinen  *	ready on the requested channel, it must indicate this with an event
20969588bbd5SJouni Malinen  *	notification by calling cfg80211_ready_on_channel().
20979588bbd5SJouni Malinen  * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation.
20989588bbd5SJouni Malinen  *	This allows the operation to be terminated prior to timeout based on
20999588bbd5SJouni Malinen  *	the duration value.
2100f7ca38dfSJohannes Berg  * @mgmt_tx: Transmit a management frame.
2101f7ca38dfSJohannes Berg  * @mgmt_tx_cancel_wait: Cancel the wait time from transmitting a management
2102f7ca38dfSJohannes Berg  *	frame on another channel
21039588bbd5SJouni Malinen  *
2104fc73f11fSDavid Spinadel  * @testmode_cmd: run a test mode command; @wdev may be %NULL
210571063f0eSWey-Yi Guy  * @testmode_dump: Implement a test mode dump. The cb->args[2] and up may be
210671063f0eSWey-Yi Guy  *	used by the function, but 0 and 1 must not be touched. Additionally,
210771063f0eSWey-Yi Guy  *	return error codes other than -ENOBUFS and -ENOENT will terminate the
210871063f0eSWey-Yi Guy  *	dump and return to userspace with an error, so be careful. If any data
210971063f0eSWey-Yi Guy  *	was passed in from userspace then the data/len arguments will be present
211071063f0eSWey-Yi Guy  *	and point to the data contained in %NL80211_ATTR_TESTDATA.
211167fbb16bSSamuel Ortiz  *
2112abe37c4bSJohannes Berg  * @set_bitrate_mask: set the bitrate mask configuration
2113abe37c4bSJohannes Berg  *
211467fbb16bSSamuel Ortiz  * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac
211567fbb16bSSamuel Ortiz  *	devices running firmwares capable of generating the (re) association
211667fbb16bSSamuel Ortiz  *	RSN IE. It allows for faster roaming between WPA2 BSSIDs.
211767fbb16bSSamuel Ortiz  * @del_pmksa: Delete a cached PMKID.
211867fbb16bSSamuel Ortiz  * @flush_pmksa: Flush all cached PMKIDs.
21199043f3b8SJuuso Oikarinen  * @set_power_mgmt: Configure WLAN power management. A timeout value of -1
21209043f3b8SJuuso Oikarinen  *	allows the driver to adjust the dynamic ps timeout value.
2121d6dc1a38SJuuso Oikarinen  * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold.
212284f10708SThomas Pedersen  * @set_cqm_txe_config: Configure connection quality monitor TX error
212384f10708SThomas Pedersen  *	thresholds.
2124807f8a8cSLuciano Coelho  * @sched_scan_start: Tell the driver to start a scheduled scan.
212530d08a46SArend van Spriel  * @sched_scan_stop: Tell the driver to stop an ongoing scheduled scan.
212667fbb16bSSamuel Ortiz  *
2127271733cfSJohannes Berg  * @mgmt_frame_register: Notify driver that a management frame type was
2128271733cfSJohannes Berg  *	registered. Note that this callback may not sleep, and cannot run
2129271733cfSJohannes Berg  *	concurrently with itself.
2130547025d5SBruno Randolf  *
2131547025d5SBruno Randolf  * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device.
2132547025d5SBruno Randolf  *	Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may
2133547025d5SBruno Randolf  *	reject TX/RX mask combinations they cannot support by returning -EINVAL
2134547025d5SBruno Randolf  *	(also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX).
2135547025d5SBruno Randolf  *
2136547025d5SBruno Randolf  * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant).
21373677713bSJohn W. Linville  *
21383677713bSJohn W. Linville  * @set_ringparam: Set tx and rx ring sizes.
21393677713bSJohn W. Linville  *
21403677713bSJohn W. Linville  * @get_ringparam: Get tx and rx ring current and maximum sizes.
2141109086ceSArik Nemtsov  *
2142109086ceSArik Nemtsov  * @tdls_mgmt: Transmit a TDLS management frame.
2143109086ceSArik Nemtsov  * @tdls_oper: Perform a high-level TDLS operation (e.g. TDLS link setup).
21447f6cf311SJohannes Berg  *
21457f6cf311SJohannes Berg  * @probe_client: probe an associated client, must return a cookie that it
21467f6cf311SJohannes Berg  *	later passes to cfg80211_probe_status().
21471d9d9213SSimon Wunderlich  *
21481d9d9213SSimon Wunderlich  * @set_noack_map: Set the NoAck Map for the TIDs.
2149d6199218SBen Greear  *
2150d6199218SBen Greear  * @get_et_sset_count:  Ethtool API to get string-set count.
2151d6199218SBen Greear  *	See @ethtool_ops.get_sset_count
2152d6199218SBen Greear  *
2153d6199218SBen Greear  * @get_et_stats:  Ethtool API to get a set of u64 stats.
2154d6199218SBen Greear  *	See @ethtool_ops.get_ethtool_stats
2155d6199218SBen Greear  *
2156d6199218SBen Greear  * @get_et_strings:  Ethtool API to get a set of strings to describe stats
2157d6199218SBen Greear  *	and perhaps other supported types of ethtool data-sets.
2158d6199218SBen Greear  *	See @ethtool_ops.get_strings
21595b7ccaf3SJohannes Berg  *
21605b7ccaf3SJohannes Berg  * @get_channel: Get the current operating channel for the virtual interface.
21615b7ccaf3SJohannes Berg  *	For monitor interfaces, it should return %NULL unless there's a single
21625b7ccaf3SJohannes Berg  *	current monitoring channel.
216398104fdeSJohannes Berg  *
216498104fdeSJohannes Berg  * @start_p2p_device: Start the given P2P device.
216598104fdeSJohannes Berg  * @stop_p2p_device: Stop the given P2P device.
216677765eafSVasanthakumar Thiagarajan  *
216777765eafSVasanthakumar Thiagarajan  * @set_mac_acl: Sets MAC address control list in AP and P2P GO mode.
216877765eafSVasanthakumar Thiagarajan  *	Parameters include ACL policy, an array of MAC address of stations
216977765eafSVasanthakumar Thiagarajan  *	and the number of MAC addresses. If there is already a list in driver
217077765eafSVasanthakumar Thiagarajan  *	this new list replaces the existing one. Driver has to clear its ACL
217177765eafSVasanthakumar Thiagarajan  *	when number of MAC addresses entries is passed as 0. Drivers which
217277765eafSVasanthakumar Thiagarajan  *	advertise the support for MAC based ACL have to implement this callback.
217304f39047SSimon Wunderlich  *
217404f39047SSimon Wunderlich  * @start_radar_detection: Start radar detection in the driver.
21758bf24293SJouni Malinen  *
21768bf24293SJouni Malinen  * @update_ft_ies: Provide updated Fast BSS Transition information to the
21778bf24293SJouni Malinen  *	driver. If the SME is in the driver/firmware, this information can be
21788bf24293SJouni Malinen  *	used in building Authentication and Reassociation Request frames.
21795de17984SArend van Spriel  *
21805de17984SArend van Spriel  * @crit_proto_start: Indicates a critical protocol needs more link reliability
21815de17984SArend van Spriel  *	for a given duration (milliseconds). The protocol is provided so the
21825de17984SArend van Spriel  *	driver can take the most appropriate actions.
21835de17984SArend van Spriel  * @crit_proto_stop: Indicates critical protocol no longer needs increased link
21845de17984SArend van Spriel  *	reliability. This operation can not fail.
2185be29b99aSAmitkumar Karwar  * @set_coalesce: Set coalesce parameters.
218616ef1fe2SSimon Wunderlich  *
218716ef1fe2SSimon Wunderlich  * @channel_switch: initiate channel-switch procedure (with CSA)
2188704232c2SJohannes Berg  */
2189704232c2SJohannes Berg struct cfg80211_ops {
2190ff1b6e69SJohannes Berg 	int	(*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
21910378b3f1SJohannes Berg 	int	(*resume)(struct wiphy *wiphy);
21926d52563fSJohannes Berg 	void	(*set_wakeup)(struct wiphy *wiphy, bool enabled);
21930378b3f1SJohannes Berg 
219484efbb84SJohannes Berg 	struct wireless_dev * (*add_virtual_intf)(struct wiphy *wiphy,
2195552bff0cSJohannes Berg 						  const char *name,
2196f9e10ce4SJohannes Berg 						  enum nl80211_iftype type,
2197f9e10ce4SJohannes Berg 						  u32 *flags,
21982ec600d6SLuis Carlos Cobo 						  struct vif_params *params);
219984efbb84SJohannes Berg 	int	(*del_virtual_intf)(struct wiphy *wiphy,
220084efbb84SJohannes Berg 				    struct wireless_dev *wdev);
2201e36d56b6SJohannes Berg 	int	(*change_virtual_intf)(struct wiphy *wiphy,
2202e36d56b6SJohannes Berg 				       struct net_device *dev,
22032ec600d6SLuis Carlos Cobo 				       enum nl80211_iftype type, u32 *flags,
22042ec600d6SLuis Carlos Cobo 				       struct vif_params *params);
220541ade00fSJohannes Berg 
220641ade00fSJohannes Berg 	int	(*add_key)(struct wiphy *wiphy, struct net_device *netdev,
2207e31b8213SJohannes Berg 			   u8 key_index, bool pairwise, const u8 *mac_addr,
220841ade00fSJohannes Berg 			   struct key_params *params);
220941ade00fSJohannes Berg 	int	(*get_key)(struct wiphy *wiphy, struct net_device *netdev,
2210e31b8213SJohannes Berg 			   u8 key_index, bool pairwise, const u8 *mac_addr,
2211e31b8213SJohannes Berg 			   void *cookie,
221241ade00fSJohannes Berg 			   void (*callback)(void *cookie, struct key_params*));
221341ade00fSJohannes Berg 	int	(*del_key)(struct wiphy *wiphy, struct net_device *netdev,
2214e31b8213SJohannes Berg 			   u8 key_index, bool pairwise, const u8 *mac_addr);
221541ade00fSJohannes Berg 	int	(*set_default_key)(struct wiphy *wiphy,
221641ade00fSJohannes Berg 				   struct net_device *netdev,
2217dbd2fd65SJohannes Berg 				   u8 key_index, bool unicast, bool multicast);
22183cfcf6acSJouni Malinen 	int	(*set_default_mgmt_key)(struct wiphy *wiphy,
22193cfcf6acSJouni Malinen 					struct net_device *netdev,
22203cfcf6acSJouni Malinen 					u8 key_index);
2221ed1b6cc7SJohannes Berg 
22228860020eSJohannes Berg 	int	(*start_ap)(struct wiphy *wiphy, struct net_device *dev,
22238860020eSJohannes Berg 			    struct cfg80211_ap_settings *settings);
22248860020eSJohannes Berg 	int	(*change_beacon)(struct wiphy *wiphy, struct net_device *dev,
22258860020eSJohannes Berg 				 struct cfg80211_beacon_data *info);
22268860020eSJohannes Berg 	int	(*stop_ap)(struct wiphy *wiphy, struct net_device *dev);
22275727ef1bSJohannes Berg 
22285727ef1bSJohannes Berg 
22295727ef1bSJohannes Berg 	int	(*add_station)(struct wiphy *wiphy, struct net_device *dev,
22305727ef1bSJohannes Berg 			       u8 *mac, struct station_parameters *params);
22315727ef1bSJohannes Berg 	int	(*del_station)(struct wiphy *wiphy, struct net_device *dev,
22325727ef1bSJohannes Berg 			       u8 *mac);
22335727ef1bSJohannes Berg 	int	(*change_station)(struct wiphy *wiphy, struct net_device *dev,
22345727ef1bSJohannes Berg 				  u8 *mac, struct station_parameters *params);
2235fd5b74dcSJohannes Berg 	int	(*get_station)(struct wiphy *wiphy, struct net_device *dev,
22362ec600d6SLuis Carlos Cobo 			       u8 *mac, struct station_info *sinfo);
22372ec600d6SLuis Carlos Cobo 	int	(*dump_station)(struct wiphy *wiphy, struct net_device *dev,
22382ec600d6SLuis Carlos Cobo 			       int idx, u8 *mac, struct station_info *sinfo);
22392ec600d6SLuis Carlos Cobo 
22402ec600d6SLuis Carlos Cobo 	int	(*add_mpath)(struct wiphy *wiphy, struct net_device *dev,
22412ec600d6SLuis Carlos Cobo 			       u8 *dst, u8 *next_hop);
22422ec600d6SLuis Carlos Cobo 	int	(*del_mpath)(struct wiphy *wiphy, struct net_device *dev,
22432ec600d6SLuis Carlos Cobo 			       u8 *dst);
22442ec600d6SLuis Carlos Cobo 	int	(*change_mpath)(struct wiphy *wiphy, struct net_device *dev,
22452ec600d6SLuis Carlos Cobo 				  u8 *dst, u8 *next_hop);
22462ec600d6SLuis Carlos Cobo 	int	(*get_mpath)(struct wiphy *wiphy, struct net_device *dev,
22472ec600d6SLuis Carlos Cobo 			       u8 *dst, u8 *next_hop,
22482ec600d6SLuis Carlos Cobo 			       struct mpath_info *pinfo);
22492ec600d6SLuis Carlos Cobo 	int	(*dump_mpath)(struct wiphy *wiphy, struct net_device *dev,
22502ec600d6SLuis Carlos Cobo 			       int idx, u8 *dst, u8 *next_hop,
22512ec600d6SLuis Carlos Cobo 			       struct mpath_info *pinfo);
225224bdd9f4SJavier Cardona 	int	(*get_mesh_config)(struct wiphy *wiphy,
225393da9cc1Scolin@cozybit.com 				struct net_device *dev,
225493da9cc1Scolin@cozybit.com 				struct mesh_config *conf);
225524bdd9f4SJavier Cardona 	int	(*update_mesh_config)(struct wiphy *wiphy,
225629cbe68cSJohannes Berg 				      struct net_device *dev, u32 mask,
225729cbe68cSJohannes Berg 				      const struct mesh_config *nconf);
225829cbe68cSJohannes Berg 	int	(*join_mesh)(struct wiphy *wiphy, struct net_device *dev,
225929cbe68cSJohannes Berg 			     const struct mesh_config *conf,
226029cbe68cSJohannes Berg 			     const struct mesh_setup *setup);
226129cbe68cSJohannes Berg 	int	(*leave_mesh)(struct wiphy *wiphy, struct net_device *dev);
226229cbe68cSJohannes Berg 
22639f1ba906SJouni Malinen 	int	(*change_bss)(struct wiphy *wiphy, struct net_device *dev,
22649f1ba906SJouni Malinen 			      struct bss_parameters *params);
226531888487SJouni Malinen 
2266f70f01c2SEliad Peller 	int	(*set_txq_params)(struct wiphy *wiphy, struct net_device *dev,
226731888487SJouni Malinen 				  struct ieee80211_txq_params *params);
226872bdcf34SJouni Malinen 
2269e8c9bd5bSJohannes Berg 	int	(*libertas_set_mesh_channel)(struct wiphy *wiphy,
2270e8c9bd5bSJohannes Berg 					     struct net_device *dev,
2271e8c9bd5bSJohannes Berg 					     struct ieee80211_channel *chan);
2272e8c9bd5bSJohannes Berg 
2273e8c9bd5bSJohannes Berg 	int	(*set_monitor_channel)(struct wiphy *wiphy,
2274683b6d3bSJohannes Berg 				       struct cfg80211_chan_def *chandef);
22759aed3cc1SJouni Malinen 
2276fd014284SJohannes Berg 	int	(*scan)(struct wiphy *wiphy,
22772a519311SJohannes Berg 			struct cfg80211_scan_request *request);
2278636a5d36SJouni Malinen 
2279636a5d36SJouni Malinen 	int	(*auth)(struct wiphy *wiphy, struct net_device *dev,
2280636a5d36SJouni Malinen 			struct cfg80211_auth_request *req);
2281636a5d36SJouni Malinen 	int	(*assoc)(struct wiphy *wiphy, struct net_device *dev,
2282636a5d36SJouni Malinen 			 struct cfg80211_assoc_request *req);
2283636a5d36SJouni Malinen 	int	(*deauth)(struct wiphy *wiphy, struct net_device *dev,
228463c9c5e7SJohannes Berg 			  struct cfg80211_deauth_request *req);
2285636a5d36SJouni Malinen 	int	(*disassoc)(struct wiphy *wiphy, struct net_device *dev,
228663c9c5e7SJohannes Berg 			    struct cfg80211_disassoc_request *req);
228704a773adSJohannes Berg 
2288b23aa676SSamuel Ortiz 	int	(*connect)(struct wiphy *wiphy, struct net_device *dev,
2289b23aa676SSamuel Ortiz 			   struct cfg80211_connect_params *sme);
2290b23aa676SSamuel Ortiz 	int	(*disconnect)(struct wiphy *wiphy, struct net_device *dev,
2291b23aa676SSamuel Ortiz 			      u16 reason_code);
2292b23aa676SSamuel Ortiz 
229304a773adSJohannes Berg 	int	(*join_ibss)(struct wiphy *wiphy, struct net_device *dev,
229404a773adSJohannes Berg 			     struct cfg80211_ibss_params *params);
229504a773adSJohannes Berg 	int	(*leave_ibss)(struct wiphy *wiphy, struct net_device *dev);
2296b9a5f8caSJouni Malinen 
2297f4e583c8SAntonio Quartulli 	int	(*set_mcast_rate)(struct wiphy *wiphy, struct net_device *dev,
2298f4e583c8SAntonio Quartulli 				  int rate[IEEE80211_NUM_BANDS]);
2299f4e583c8SAntonio Quartulli 
2300b9a5f8caSJouni Malinen 	int	(*set_wiphy_params)(struct wiphy *wiphy, u32 changed);
23017643a2c3SJohannes Berg 
2302c8442118SJohannes Berg 	int	(*set_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
2303fa61cf70SJuuso Oikarinen 				enum nl80211_tx_power_setting type, int mbm);
2304c8442118SJohannes Berg 	int	(*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
2305c8442118SJohannes Berg 				int *dbm);
23061f87f7d3SJohannes Berg 
2307ab737a4fSJohannes Berg 	int	(*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev,
2308388ac775SJohannes Berg 				const u8 *addr);
2309ab737a4fSJohannes Berg 
23101f87f7d3SJohannes Berg 	void	(*rfkill_poll)(struct wiphy *wiphy);
2311aff89a9bSJohannes Berg 
2312aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE
2313fc73f11fSDavid Spinadel 	int	(*testmode_cmd)(struct wiphy *wiphy, struct wireless_dev *wdev,
2314fc73f11fSDavid Spinadel 				void *data, int len);
231571063f0eSWey-Yi Guy 	int	(*testmode_dump)(struct wiphy *wiphy, struct sk_buff *skb,
231671063f0eSWey-Yi Guy 				 struct netlink_callback *cb,
231771063f0eSWey-Yi Guy 				 void *data, int len);
2318aff89a9bSJohannes Berg #endif
2319bc92afd9SJohannes Berg 
23209930380fSJohannes Berg 	int	(*set_bitrate_mask)(struct wiphy *wiphy,
23219930380fSJohannes Berg 				    struct net_device *dev,
23229930380fSJohannes Berg 				    const u8 *peer,
23239930380fSJohannes Berg 				    const struct cfg80211_bitrate_mask *mask);
23249930380fSJohannes Berg 
232561fa713cSHolger Schurig 	int	(*dump_survey)(struct wiphy *wiphy, struct net_device *netdev,
232661fa713cSHolger Schurig 			int idx, struct survey_info *info);
232761fa713cSHolger Schurig 
232867fbb16bSSamuel Ortiz 	int	(*set_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
232967fbb16bSSamuel Ortiz 			     struct cfg80211_pmksa *pmksa);
233067fbb16bSSamuel Ortiz 	int	(*del_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
233167fbb16bSSamuel Ortiz 			     struct cfg80211_pmksa *pmksa);
233267fbb16bSSamuel Ortiz 	int	(*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev);
233367fbb16bSSamuel Ortiz 
23349588bbd5SJouni Malinen 	int	(*remain_on_channel)(struct wiphy *wiphy,
233571bbc994SJohannes Berg 				     struct wireless_dev *wdev,
23369588bbd5SJouni Malinen 				     struct ieee80211_channel *chan,
23379588bbd5SJouni Malinen 				     unsigned int duration,
23389588bbd5SJouni Malinen 				     u64 *cookie);
23399588bbd5SJouni Malinen 	int	(*cancel_remain_on_channel)(struct wiphy *wiphy,
234071bbc994SJohannes Berg 					    struct wireless_dev *wdev,
23419588bbd5SJouni Malinen 					    u64 cookie);
23429588bbd5SJouni Malinen 
234371bbc994SJohannes Berg 	int	(*mgmt_tx)(struct wiphy *wiphy, struct wireless_dev *wdev,
2344f7ca38dfSJohannes Berg 			  struct ieee80211_channel *chan, bool offchan,
234542d97a59SJohannes Berg 			  unsigned int wait, const u8 *buf, size_t len,
234642d97a59SJohannes Berg 			  bool no_cck, bool dont_wait_for_ack, u64 *cookie);
2347f7ca38dfSJohannes Berg 	int	(*mgmt_tx_cancel_wait)(struct wiphy *wiphy,
234871bbc994SJohannes Berg 				       struct wireless_dev *wdev,
2349f7ca38dfSJohannes Berg 				       u64 cookie);
2350026331c4SJouni Malinen 
2351bc92afd9SJohannes Berg 	int	(*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev,
2352bc92afd9SJohannes Berg 				  bool enabled, int timeout);
2353d6dc1a38SJuuso Oikarinen 
2354d6dc1a38SJuuso Oikarinen 	int	(*set_cqm_rssi_config)(struct wiphy *wiphy,
2355d6dc1a38SJuuso Oikarinen 				       struct net_device *dev,
2356d6dc1a38SJuuso Oikarinen 				       s32 rssi_thold, u32 rssi_hyst);
2357271733cfSJohannes Berg 
235884f10708SThomas Pedersen 	int	(*set_cqm_txe_config)(struct wiphy *wiphy,
235984f10708SThomas Pedersen 				      struct net_device *dev,
236084f10708SThomas Pedersen 				      u32 rate, u32 pkts, u32 intvl);
236184f10708SThomas Pedersen 
2362271733cfSJohannes Berg 	void	(*mgmt_frame_register)(struct wiphy *wiphy,
236371bbc994SJohannes Berg 				       struct wireless_dev *wdev,
2364271733cfSJohannes Berg 				       u16 frame_type, bool reg);
2365afe0cbf8SBruno Randolf 
2366afe0cbf8SBruno Randolf 	int	(*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant);
2367afe0cbf8SBruno Randolf 	int	(*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant);
23683677713bSJohn W. Linville 
23693677713bSJohn W. Linville 	int	(*set_ringparam)(struct wiphy *wiphy, u32 tx, u32 rx);
23703677713bSJohn W. Linville 	void	(*get_ringparam)(struct wiphy *wiphy,
23713677713bSJohn W. Linville 				 u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max);
2372807f8a8cSLuciano Coelho 
2373807f8a8cSLuciano Coelho 	int	(*sched_scan_start)(struct wiphy *wiphy,
2374807f8a8cSLuciano Coelho 				struct net_device *dev,
2375807f8a8cSLuciano Coelho 				struct cfg80211_sched_scan_request *request);
237685a9994aSLuciano Coelho 	int	(*sched_scan_stop)(struct wiphy *wiphy, struct net_device *dev);
2377e5497d76SJohannes Berg 
2378e5497d76SJohannes Berg 	int	(*set_rekey_data)(struct wiphy *wiphy, struct net_device *dev,
2379e5497d76SJohannes Berg 				  struct cfg80211_gtk_rekey_data *data);
2380109086ceSArik Nemtsov 
2381109086ceSArik Nemtsov 	int	(*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev,
2382109086ceSArik Nemtsov 			     u8 *peer, u8 action_code,  u8 dialog_token,
2383109086ceSArik Nemtsov 			     u16 status_code, const u8 *buf, size_t len);
2384109086ceSArik Nemtsov 	int	(*tdls_oper)(struct wiphy *wiphy, struct net_device *dev,
2385109086ceSArik Nemtsov 			     u8 *peer, enum nl80211_tdls_operation oper);
23867f6cf311SJohannes Berg 
23877f6cf311SJohannes Berg 	int	(*probe_client)(struct wiphy *wiphy, struct net_device *dev,
23887f6cf311SJohannes Berg 				const u8 *peer, u64 *cookie);
2389e999882aSJohannes Berg 
23901d9d9213SSimon Wunderlich 	int	(*set_noack_map)(struct wiphy *wiphy,
23911d9d9213SSimon Wunderlich 				  struct net_device *dev,
23921d9d9213SSimon Wunderlich 				  u16 noack_map);
23931d9d9213SSimon Wunderlich 
2394d6199218SBen Greear 	int	(*get_et_sset_count)(struct wiphy *wiphy,
2395d6199218SBen Greear 				     struct net_device *dev, int sset);
2396d6199218SBen Greear 	void	(*get_et_stats)(struct wiphy *wiphy, struct net_device *dev,
2397d6199218SBen Greear 				struct ethtool_stats *stats, u64 *data);
2398d6199218SBen Greear 	void	(*get_et_strings)(struct wiphy *wiphy, struct net_device *dev,
2399d6199218SBen Greear 				  u32 sset, u8 *data);
2400dbbae26aSMichal Kazior 
2401683b6d3bSJohannes Berg 	int	(*get_channel)(struct wiphy *wiphy,
24025b7ccaf3SJohannes Berg 			       struct wireless_dev *wdev,
2403683b6d3bSJohannes Berg 			       struct cfg80211_chan_def *chandef);
240498104fdeSJohannes Berg 
240598104fdeSJohannes Berg 	int	(*start_p2p_device)(struct wiphy *wiphy,
240698104fdeSJohannes Berg 				    struct wireless_dev *wdev);
240798104fdeSJohannes Berg 	void	(*stop_p2p_device)(struct wiphy *wiphy,
240898104fdeSJohannes Berg 				   struct wireless_dev *wdev);
240977765eafSVasanthakumar Thiagarajan 
241077765eafSVasanthakumar Thiagarajan 	int	(*set_mac_acl)(struct wiphy *wiphy, struct net_device *dev,
241177765eafSVasanthakumar Thiagarajan 			       const struct cfg80211_acl_data *params);
241204f39047SSimon Wunderlich 
241304f39047SSimon Wunderlich 	int	(*start_radar_detection)(struct wiphy *wiphy,
241404f39047SSimon Wunderlich 					 struct net_device *dev,
241504f39047SSimon Wunderlich 					 struct cfg80211_chan_def *chandef);
2416355199e0SJouni Malinen 	int	(*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev,
2417355199e0SJouni Malinen 				 struct cfg80211_update_ft_ies_params *ftie);
24185de17984SArend van Spriel 	int	(*crit_proto_start)(struct wiphy *wiphy,
24195de17984SArend van Spriel 				    struct wireless_dev *wdev,
24205de17984SArend van Spriel 				    enum nl80211_crit_proto_id protocol,
24215de17984SArend van Spriel 				    u16 duration);
24225de17984SArend van Spriel 	void	(*crit_proto_stop)(struct wiphy *wiphy,
24235de17984SArend van Spriel 				   struct wireless_dev *wdev);
2424be29b99aSAmitkumar Karwar 	int	(*set_coalesce)(struct wiphy *wiphy,
2425be29b99aSAmitkumar Karwar 				struct cfg80211_coalesce *coalesce);
242616ef1fe2SSimon Wunderlich 
242716ef1fe2SSimon Wunderlich 	int	(*channel_switch)(struct wiphy *wiphy,
242816ef1fe2SSimon Wunderlich 				  struct net_device *dev,
242916ef1fe2SSimon Wunderlich 				  struct cfg80211_csa_settings *params);
2430704232c2SJohannes Berg };
2431704232c2SJohannes Berg 
2432d3236553SJohannes Berg /*
2433d3236553SJohannes Berg  * wireless hardware and networking interfaces structures
2434d3236553SJohannes Berg  * and registration/helper functions
2435d3236553SJohannes Berg  */
2436d3236553SJohannes Berg 
2437d3236553SJohannes Berg /**
24385be83de5SJohannes Berg  * enum wiphy_flags - wiphy capability flags
24395be83de5SJohannes Berg  *
24405be83de5SJohannes Berg  * @WIPHY_FLAG_CUSTOM_REGULATORY:  tells us the driver for this device
2441d3236553SJohannes Berg  * 	has its own custom regulatory domain and cannot identify the
2442d3236553SJohannes Berg  * 	ISO / IEC 3166 alpha2 it belongs to. When this is enabled
2443d3236553SJohannes Berg  * 	we will disregard the first regulatory hint (when the
2444d3236553SJohannes Berg  * 	initiator is %REGDOM_SET_BY_CORE).
24455be83de5SJohannes Berg  * @WIPHY_FLAG_STRICT_REGULATORY: tells us the driver for this device will
24465be83de5SJohannes Berg  *	ignore regulatory domain settings until it gets its own regulatory
2447749b527bSLuis R. Rodriguez  *	domain via its regulatory_hint() unless the regulatory hint is
2448749b527bSLuis R. Rodriguez  *	from a country IE. After its gets its own regulatory domain it will
2449749b527bSLuis R. Rodriguez  *	only allow further regulatory domain settings to further enhance
2450749b527bSLuis R. Rodriguez  *	compliance. For example if channel 13 and 14 are disabled by this
2451749b527bSLuis R. Rodriguez  *	regulatory domain no user regulatory domain can enable these channels
2452749b527bSLuis R. Rodriguez  *	at a later time. This can be used for devices which do not have
2453749b527bSLuis R. Rodriguez  *	calibration information guaranteed for frequencies or settings
2454061acaaeSLuis R. Rodriguez  *	outside of its regulatory domain. If used in combination with
2455061acaaeSLuis R. Rodriguez  *	WIPHY_FLAG_CUSTOM_REGULATORY the inspected country IE power settings
2456061acaaeSLuis R. Rodriguez  *	will be followed.
24575be83de5SJohannes Berg  * @WIPHY_FLAG_DISABLE_BEACON_HINTS: enable this if your driver needs to ensure
24585be83de5SJohannes Berg  *	that passive scan flags and beaconing flags may not be lifted by
24595be83de5SJohannes Berg  *	cfg80211 due to regulatory beacon hints. For more information on beacon
246037184244SLuis R. Rodriguez  *	hints read the documenation for regulatory_hint_found_beacon()
24615be83de5SJohannes Berg  * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this
24625be83de5SJohannes Berg  *	wiphy at all
24635be83de5SJohannes Berg  * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled
24645be83de5SJohannes Berg  *	by default -- this flag will be set depending on the kernel's default
24655be83de5SJohannes Berg  *	on wiphy_new(), but can be changed by the driver if it has a good
24665be83de5SJohannes Berg  *	reason to override the default
24679bc383deSJohannes Berg  * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station
24689bc383deSJohannes Berg  *	on a VLAN interface)
24699bc383deSJohannes Berg  * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station
2470c0692b8fSJohannes Berg  * @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the
2471c0692b8fSJohannes Berg  *	control port protocol ethertype. The device also honours the
2472c0692b8fSJohannes Berg  *	control_port_no_encrypt flag.
2473e31b8213SJohannes Berg  * @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN.
247415d5dda6SJavier Cardona  * @WIPHY_FLAG_MESH_AUTH: The device supports mesh authentication by routing
247515d5dda6SJavier Cardona  *	auth frames to userspace. See @NL80211_MESH_SETUP_USERSPACE_AUTH.
24761ba01458SRandy Dunlap  * @WIPHY_FLAG_SUPPORTS_SCHED_SCAN: The device supports scheduled scans.
2477f4b34b55SVivek Natarajan  * @WIPHY_FLAG_SUPPORTS_FW_ROAM: The device supports roaming feature in the
2478f4b34b55SVivek Natarajan  *	firmware.
2479cedb5412SEliad Peller  * @WIPHY_FLAG_AP_UAPSD: The device supports uapsd on AP.
2480109086ceSArik Nemtsov  * @WIPHY_FLAG_SUPPORTS_TDLS: The device supports TDLS (802.11z) operation.
2481109086ceSArik Nemtsov  * @WIPHY_FLAG_TDLS_EXTERNAL_SETUP: The device does not handle TDLS (802.11z)
2482109086ceSArik Nemtsov  *	link setup/discovery operations internally. Setup, discovery and
2483109086ceSArik Nemtsov  *	teardown packets should be sent through the @NL80211_CMD_TDLS_MGMT
2484109086ceSArik Nemtsov  *	command. When this flag is not set, @NL80211_CMD_TDLS_OPER should be
2485109086ceSArik Nemtsov  *	used for asking the driver/firmware to perform a TDLS operation.
2486562a7480SJohannes Berg  * @WIPHY_FLAG_HAVE_AP_SME: device integrates AP SME
24875e760230SJohannes Berg  * @WIPHY_FLAG_REPORTS_OBSS: the device will report beacons from other BSSes
24885e760230SJohannes Berg  *	when there are virtual interfaces in AP mode by calling
24895e760230SJohannes Berg  *	cfg80211_report_obss_beacon().
249087bbbe22SArik Nemtsov  * @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD: When operating as an AP, the device
249187bbbe22SArik Nemtsov  *	responds to probe-requests in hardware.
24927c4ef712SJohannes Berg  * @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX.
24937c4ef712SJohannes Berg  * @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call.
24942f301ab2SSimon Wunderlich  * @WIPHY_FLAG_SUPPORTS_5_10_MHZ: Device supports 5 MHz and 10 MHz channels.
249516ef1fe2SSimon Wunderlich  * @WIPHY_FLAG_HAS_CHANNEL_SWITCH: Device supports channel switch in
249616ef1fe2SSimon Wunderlich  *	beaconing mode (AP, IBSS, Mesh, ...).
24975be83de5SJohannes Berg  */
24985be83de5SJohannes Berg enum wiphy_flags {
24995be83de5SJohannes Berg 	WIPHY_FLAG_CUSTOM_REGULATORY		= BIT(0),
25005be83de5SJohannes Berg 	WIPHY_FLAG_STRICT_REGULATORY		= BIT(1),
25015be83de5SJohannes Berg 	WIPHY_FLAG_DISABLE_BEACON_HINTS		= BIT(2),
25025be83de5SJohannes Berg 	WIPHY_FLAG_NETNS_OK			= BIT(3),
25035be83de5SJohannes Berg 	WIPHY_FLAG_PS_ON_BY_DEFAULT		= BIT(4),
25049bc383deSJohannes Berg 	WIPHY_FLAG_4ADDR_AP			= BIT(5),
25059bc383deSJohannes Berg 	WIPHY_FLAG_4ADDR_STATION		= BIT(6),
2506c0692b8fSJohannes Berg 	WIPHY_FLAG_CONTROL_PORT_PROTOCOL	= BIT(7),
2507309075cfSJussi Kivilinna 	WIPHY_FLAG_IBSS_RSN			= BIT(8),
250815d5dda6SJavier Cardona 	WIPHY_FLAG_MESH_AUTH			= BIT(10),
2509807f8a8cSLuciano Coelho 	WIPHY_FLAG_SUPPORTS_SCHED_SCAN		= BIT(11),
25108e8b41f9SJohannes Berg 	/* use hole at 12 */
2511f4b34b55SVivek Natarajan 	WIPHY_FLAG_SUPPORTS_FW_ROAM		= BIT(13),
2512cedb5412SEliad Peller 	WIPHY_FLAG_AP_UAPSD			= BIT(14),
2513109086ceSArik Nemtsov 	WIPHY_FLAG_SUPPORTS_TDLS		= BIT(15),
2514109086ceSArik Nemtsov 	WIPHY_FLAG_TDLS_EXTERNAL_SETUP		= BIT(16),
2515562a7480SJohannes Berg 	WIPHY_FLAG_HAVE_AP_SME			= BIT(17),
25165e760230SJohannes Berg 	WIPHY_FLAG_REPORTS_OBSS			= BIT(18),
251787bbbe22SArik Nemtsov 	WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD	= BIT(19),
25187c4ef712SJohannes Berg 	WIPHY_FLAG_OFFCHAN_TX			= BIT(20),
25197c4ef712SJohannes Berg 	WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL	= BIT(21),
25202f301ab2SSimon Wunderlich 	WIPHY_FLAG_SUPPORTS_5_10_MHZ		= BIT(22),
252116ef1fe2SSimon Wunderlich 	WIPHY_FLAG_HAS_CHANNEL_SWITCH		= BIT(23),
25227527a782SJohannes Berg };
25237527a782SJohannes Berg 
25247527a782SJohannes Berg /**
25257527a782SJohannes Berg  * struct ieee80211_iface_limit - limit on certain interface types
25267527a782SJohannes Berg  * @max: maximum number of interfaces of these types
25277527a782SJohannes Berg  * @types: interface types (bits)
25287527a782SJohannes Berg  */
25297527a782SJohannes Berg struct ieee80211_iface_limit {
25307527a782SJohannes Berg 	u16 max;
25317527a782SJohannes Berg 	u16 types;
25327527a782SJohannes Berg };
25337527a782SJohannes Berg 
25347527a782SJohannes Berg /**
25357527a782SJohannes Berg  * struct ieee80211_iface_combination - possible interface combination
25367527a782SJohannes Berg  * @limits: limits for the given interface types
25377527a782SJohannes Berg  * @n_limits: number of limitations
25387527a782SJohannes Berg  * @num_different_channels: can use up to this many different channels
25397527a782SJohannes Berg  * @max_interfaces: maximum number of interfaces in total allowed in this
25407527a782SJohannes Berg  *	group
25417527a782SJohannes Berg  * @beacon_int_infra_match: In this combination, the beacon intervals
25427527a782SJohannes Berg  *	between infrastructure and AP types must match. This is required
25437527a782SJohannes Berg  *	only in special cases.
254411c4a075SSimon Wunderlich  * @radar_detect_widths: bitmap of channel widths supported for radar detection
25457527a782SJohannes Berg  *
25467527a782SJohannes Berg  * These examples can be expressed as follows:
25477527a782SJohannes Berg  *
25487527a782SJohannes Berg  * Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total:
25497527a782SJohannes Berg  *
25507527a782SJohannes Berg  *  struct ieee80211_iface_limit limits1[] = {
25517527a782SJohannes Berg  *	{ .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
25527527a782SJohannes Berg  *	{ .max = 1, .types = BIT(NL80211_IFTYPE_AP}, },
25537527a782SJohannes Berg  *  };
25547527a782SJohannes Berg  *  struct ieee80211_iface_combination combination1 = {
25557527a782SJohannes Berg  *	.limits = limits1,
25567527a782SJohannes Berg  *	.n_limits = ARRAY_SIZE(limits1),
25577527a782SJohannes Berg  *	.max_interfaces = 2,
25587527a782SJohannes Berg  *	.beacon_int_infra_match = true,
25597527a782SJohannes Berg  *  };
25607527a782SJohannes Berg  *
25617527a782SJohannes Berg  *
25627527a782SJohannes Berg  * Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total:
25637527a782SJohannes Berg  *
25647527a782SJohannes Berg  *  struct ieee80211_iface_limit limits2[] = {
25657527a782SJohannes Berg  *	{ .max = 8, .types = BIT(NL80211_IFTYPE_AP) |
25667527a782SJohannes Berg  *			     BIT(NL80211_IFTYPE_P2P_GO), },
25677527a782SJohannes Berg  *  };
25687527a782SJohannes Berg  *  struct ieee80211_iface_combination combination2 = {
25697527a782SJohannes Berg  *	.limits = limits2,
25707527a782SJohannes Berg  *	.n_limits = ARRAY_SIZE(limits2),
25717527a782SJohannes Berg  *	.max_interfaces = 8,
25727527a782SJohannes Berg  *	.num_different_channels = 1,
25737527a782SJohannes Berg  *  };
25747527a782SJohannes Berg  *
25757527a782SJohannes Berg  *
25767527a782SJohannes Berg  * Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total.
25777527a782SJohannes Berg  * This allows for an infrastructure connection and three P2P connections.
25787527a782SJohannes Berg  *
25797527a782SJohannes Berg  *  struct ieee80211_iface_limit limits3[] = {
25807527a782SJohannes Berg  *	{ .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
25817527a782SJohannes Berg  *	{ .max = 3, .types = BIT(NL80211_IFTYPE_P2P_GO) |
25827527a782SJohannes Berg  *			     BIT(NL80211_IFTYPE_P2P_CLIENT), },
25837527a782SJohannes Berg  *  };
25847527a782SJohannes Berg  *  struct ieee80211_iface_combination combination3 = {
25857527a782SJohannes Berg  *	.limits = limits3,
25867527a782SJohannes Berg  *	.n_limits = ARRAY_SIZE(limits3),
25877527a782SJohannes Berg  *	.max_interfaces = 4,
25887527a782SJohannes Berg  *	.num_different_channels = 2,
25897527a782SJohannes Berg  *  };
25907527a782SJohannes Berg  */
25917527a782SJohannes Berg struct ieee80211_iface_combination {
25927527a782SJohannes Berg 	const struct ieee80211_iface_limit *limits;
25937527a782SJohannes Berg 	u32 num_different_channels;
25947527a782SJohannes Berg 	u16 max_interfaces;
25957527a782SJohannes Berg 	u8 n_limits;
25967527a782SJohannes Berg 	bool beacon_int_infra_match;
259711c4a075SSimon Wunderlich 	u8 radar_detect_widths;
25985be83de5SJohannes Berg };
25995be83de5SJohannes Berg 
26002e161f78SJohannes Berg struct ieee80211_txrx_stypes {
26012e161f78SJohannes Berg 	u16 tx, rx;
26022e161f78SJohannes Berg };
26032e161f78SJohannes Berg 
26045be83de5SJohannes Berg /**
2605ff1b6e69SJohannes Berg  * enum wiphy_wowlan_support_flags - WoWLAN support flags
2606ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_ANY: supports wakeup for the special "any"
2607ff1b6e69SJohannes Berg  *	trigger that keeps the device operating as-is and
2608ff1b6e69SJohannes Berg  *	wakes up the host on any activity, for example a
2609ff1b6e69SJohannes Berg  *	received packet that passed filtering; note that the
2610ff1b6e69SJohannes Berg  *	packet should be preserved in that case
2611ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_MAGIC_PKT: supports wakeup on magic packet
2612ff1b6e69SJohannes Berg  *	(see nl80211.h)
2613ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_DISCONNECT: supports wakeup on disconnect
261477dbbb13SJohannes Berg  * @WIPHY_WOWLAN_SUPPORTS_GTK_REKEY: supports GTK rekeying while asleep
261577dbbb13SJohannes Berg  * @WIPHY_WOWLAN_GTK_REKEY_FAILURE: supports wakeup on GTK rekey failure
261677dbbb13SJohannes Berg  * @WIPHY_WOWLAN_EAP_IDENTITY_REQ: supports wakeup on EAP identity request
261777dbbb13SJohannes Berg  * @WIPHY_WOWLAN_4WAY_HANDSHAKE: supports wakeup on 4-way handshake failure
261877dbbb13SJohannes Berg  * @WIPHY_WOWLAN_RFKILL_RELEASE: supports wakeup on RF-kill release
2619ff1b6e69SJohannes Berg  */
2620ff1b6e69SJohannes Berg enum wiphy_wowlan_support_flags {
2621ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_ANY		= BIT(0),
2622ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_MAGIC_PKT		= BIT(1),
2623ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_DISCONNECT		= BIT(2),
262477dbbb13SJohannes Berg 	WIPHY_WOWLAN_SUPPORTS_GTK_REKEY	= BIT(3),
262577dbbb13SJohannes Berg 	WIPHY_WOWLAN_GTK_REKEY_FAILURE	= BIT(4),
262677dbbb13SJohannes Berg 	WIPHY_WOWLAN_EAP_IDENTITY_REQ	= BIT(5),
262777dbbb13SJohannes Berg 	WIPHY_WOWLAN_4WAY_HANDSHAKE	= BIT(6),
262877dbbb13SJohannes Berg 	WIPHY_WOWLAN_RFKILL_RELEASE	= BIT(7),
2629ff1b6e69SJohannes Berg };
2630ff1b6e69SJohannes Berg 
26312a0e047eSJohannes Berg struct wiphy_wowlan_tcp_support {
26322a0e047eSJohannes Berg 	const struct nl80211_wowlan_tcp_data_token_feature *tok;
26332a0e047eSJohannes Berg 	u32 data_payload_max;
26342a0e047eSJohannes Berg 	u32 data_interval_max;
26352a0e047eSJohannes Berg 	u32 wake_payload_max;
26362a0e047eSJohannes Berg 	bool seq;
26372a0e047eSJohannes Berg };
26382a0e047eSJohannes Berg 
2639ff1b6e69SJohannes Berg /**
2640ff1b6e69SJohannes Berg  * struct wiphy_wowlan_support - WoWLAN support data
2641ff1b6e69SJohannes Berg  * @flags: see &enum wiphy_wowlan_support_flags
2642ff1b6e69SJohannes Berg  * @n_patterns: number of supported wakeup patterns
2643ff1b6e69SJohannes Berg  *	(see nl80211.h for the pattern definition)
2644ff1b6e69SJohannes Berg  * @pattern_max_len: maximum length of each pattern
2645ff1b6e69SJohannes Berg  * @pattern_min_len: minimum length of each pattern
2646bb92d199SAmitkumar Karwar  * @max_pkt_offset: maximum Rx packet offset
26472a0e047eSJohannes Berg  * @tcp: TCP wakeup support information
2648ff1b6e69SJohannes Berg  */
2649ff1b6e69SJohannes Berg struct wiphy_wowlan_support {
2650ff1b6e69SJohannes Berg 	u32 flags;
2651ff1b6e69SJohannes Berg 	int n_patterns;
2652ff1b6e69SJohannes Berg 	int pattern_max_len;
2653ff1b6e69SJohannes Berg 	int pattern_min_len;
2654bb92d199SAmitkumar Karwar 	int max_pkt_offset;
26552a0e047eSJohannes Berg 	const struct wiphy_wowlan_tcp_support *tcp;
2656ff1b6e69SJohannes Berg };
2657ff1b6e69SJohannes Berg 
2658ff1b6e69SJohannes Berg /**
2659be29b99aSAmitkumar Karwar  * struct wiphy_coalesce_support - coalesce support data
2660be29b99aSAmitkumar Karwar  * @n_rules: maximum number of coalesce rules
2661be29b99aSAmitkumar Karwar  * @max_delay: maximum supported coalescing delay in msecs
2662be29b99aSAmitkumar Karwar  * @n_patterns: number of supported patterns in a rule
2663be29b99aSAmitkumar Karwar  *	(see nl80211.h for the pattern definition)
2664be29b99aSAmitkumar Karwar  * @pattern_max_len: maximum length of each pattern
2665be29b99aSAmitkumar Karwar  * @pattern_min_len: minimum length of each pattern
2666be29b99aSAmitkumar Karwar  * @max_pkt_offset: maximum Rx packet offset
2667be29b99aSAmitkumar Karwar  */
2668be29b99aSAmitkumar Karwar struct wiphy_coalesce_support {
2669be29b99aSAmitkumar Karwar 	int n_rules;
2670be29b99aSAmitkumar Karwar 	int max_delay;
2671be29b99aSAmitkumar Karwar 	int n_patterns;
2672be29b99aSAmitkumar Karwar 	int pattern_max_len;
2673be29b99aSAmitkumar Karwar 	int pattern_min_len;
2674be29b99aSAmitkumar Karwar 	int max_pkt_offset;
2675be29b99aSAmitkumar Karwar };
2676be29b99aSAmitkumar Karwar 
2677be29b99aSAmitkumar Karwar /**
26785be83de5SJohannes Berg  * struct wiphy - wireless hardware description
26792784fe91SLuis R. Rodriguez  * @reg_notifier: the driver's regulatory notification callback,
26802784fe91SLuis R. Rodriguez  *	note that if your driver uses wiphy_apply_custom_regulatory()
26812784fe91SLuis R. Rodriguez  *	the reg_notifier's request can be passed as NULL
2682d3236553SJohannes Berg  * @regd: the driver's regulatory domain, if one was requested via
2683d3236553SJohannes Berg  * 	the regulatory_hint() API. This can be used by the driver
2684d3236553SJohannes Berg  *	on the reg_notifier() if it chooses to ignore future
2685d3236553SJohannes Berg  *	regulatory domain changes caused by other drivers.
2686d3236553SJohannes Berg  * @signal_type: signal type reported in &struct cfg80211_bss.
2687d3236553SJohannes Berg  * @cipher_suites: supported cipher suites
2688d3236553SJohannes Berg  * @n_cipher_suites: number of supported cipher suites
2689b9a5f8caSJouni Malinen  * @retry_short: Retry limit for short frames (dot11ShortRetryLimit)
2690b9a5f8caSJouni Malinen  * @retry_long: Retry limit for long frames (dot11LongRetryLimit)
2691b9a5f8caSJouni Malinen  * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold);
2692b9a5f8caSJouni Malinen  *	-1 = fragmentation disabled, only odd values >= 256 used
2693b9a5f8caSJouni Malinen  * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled
2694abe37c4bSJohannes Berg  * @_net: the network namespace this wiphy currently lives in
2695ef15aac6SJohannes Berg  * @perm_addr: permanent MAC address of this device
2696ef15aac6SJohannes Berg  * @addr_mask: If the device supports multiple MAC addresses by masking,
2697ef15aac6SJohannes Berg  *	set this to a mask with variable bits set to 1, e.g. if the last
2698ef15aac6SJohannes Berg  *	four bits are variable then set it to 00:...:00:0f. The actual
2699ef15aac6SJohannes Berg  *	variable bits shall be determined by the interfaces added, with
2700ef15aac6SJohannes Berg  *	interfaces not matching the mask being rejected to be brought up.
2701ef15aac6SJohannes Berg  * @n_addresses: number of addresses in @addresses.
2702ef15aac6SJohannes Berg  * @addresses: If the device has more than one address, set this pointer
2703ef15aac6SJohannes Berg  *	to a list of addresses (6 bytes each). The first one will be used
2704ef15aac6SJohannes Berg  *	by default for perm_addr. In this case, the mask should be set to
2705ef15aac6SJohannes Berg  *	all-zeroes. In this case it is assumed that the device can handle
2706ef15aac6SJohannes Berg  *	the same number of arbitrary MAC addresses.
2707fd235913SRandy Dunlap  * @registered: protects ->resume and ->suspend sysfs callbacks against
2708fd235913SRandy Dunlap  *	unregister hardware
2709abe37c4bSJohannes Berg  * @debugfsdir: debugfs directory used for this wiphy, will be renamed
2710abe37c4bSJohannes Berg  *	automatically on wiphy renames
2711abe37c4bSJohannes Berg  * @dev: (virtual) struct device for this wiphy
27124a711a85SStanislaw Gruszka  * @registered: helps synchronize suspend/resume with wiphy unregister
2713abe37c4bSJohannes Berg  * @wext: wireless extension handlers
2714abe37c4bSJohannes Berg  * @priv: driver private data (sized according to wiphy_new() parameter)
2715abe37c4bSJohannes Berg  * @interface_modes: bitmask of interfaces types valid for this wiphy,
2716abe37c4bSJohannes Berg  *	must be set by driver
27177527a782SJohannes Berg  * @iface_combinations: Valid interface combinations array, should not
27187527a782SJohannes Berg  *	list single interface types.
27197527a782SJohannes Berg  * @n_iface_combinations: number of entries in @iface_combinations array.
27207527a782SJohannes Berg  * @software_iftypes: bitmask of software interface types, these are not
27217527a782SJohannes Berg  *	subject to any restrictions since they are purely managed in SW.
2722abe37c4bSJohannes Berg  * @flags: wiphy flags, see &enum wiphy_flags
27231f074bd8SJohannes Berg  * @features: features advertised to nl80211, see &enum nl80211_feature_flags.
2724abe37c4bSJohannes Berg  * @bss_priv_size: each BSS struct has private data allocated with it,
2725abe37c4bSJohannes Berg  *	this variable determines its size
2726abe37c4bSJohannes Berg  * @max_scan_ssids: maximum number of SSIDs the device can scan for in
2727abe37c4bSJohannes Berg  *	any given scan
272893b6aa69SLuciano Coelho  * @max_sched_scan_ssids: maximum number of SSIDs the device can scan
272993b6aa69SLuciano Coelho  *	for in any given scheduled scan
2730a1f1c21cSLuciano Coelho  * @max_match_sets: maximum number of match sets the device can handle
2731a1f1c21cSLuciano Coelho  *	when performing a scheduled scan, 0 if filtering is not
2732a1f1c21cSLuciano Coelho  *	supported.
2733abe37c4bSJohannes Berg  * @max_scan_ie_len: maximum length of user-controlled IEs device can
2734abe37c4bSJohannes Berg  *	add to probe request frames transmitted during a scan, must not
2735abe37c4bSJohannes Berg  *	include fixed IEs like supported rates
27365a865badSLuciano Coelho  * @max_sched_scan_ie_len: same as max_scan_ie_len, but for scheduled
27375a865badSLuciano Coelho  *	scans
2738abe37c4bSJohannes Berg  * @coverage_class: current coverage class
2739abe37c4bSJohannes Berg  * @fw_version: firmware version for ethtool reporting
2740abe37c4bSJohannes Berg  * @hw_version: hardware version for ethtool reporting
2741abe37c4bSJohannes Berg  * @max_num_pmkids: maximum number of PMKIDs supported by device
2742abe37c4bSJohannes Berg  * @privid: a pointer that drivers can use to identify if an arbitrary
2743abe37c4bSJohannes Berg  *	wiphy is theirs, e.g. in global notifiers
2744abe37c4bSJohannes Berg  * @bands: information about bands/channels supported by this device
27452e161f78SJohannes Berg  *
27462e161f78SJohannes Berg  * @mgmt_stypes: bitmasks of frame subtypes that can be subscribed to or
27472e161f78SJohannes Berg  *	transmitted through nl80211, points to an array indexed by interface
27482e161f78SJohannes Berg  *	type
2749a7ffac95SBruno Randolf  *
27507f531e03SBruno Randolf  * @available_antennas_tx: bitmap of antennas which are available to be
27517f531e03SBruno Randolf  *	configured as TX antennas. Antenna configuration commands will be
27527f531e03SBruno Randolf  *	rejected unless this or @available_antennas_rx is set.
27537f531e03SBruno Randolf  *
27547f531e03SBruno Randolf  * @available_antennas_rx: bitmap of antennas which are available to be
27557f531e03SBruno Randolf  *	configured as RX antennas. Antenna configuration commands will be
27567f531e03SBruno Randolf  *	rejected unless this or @available_antennas_tx is set.
2757a293911dSJohannes Berg  *
275815f0ebc2SRandy Dunlap  * @probe_resp_offload:
275915f0ebc2SRandy Dunlap  *	 Bitmap of supported protocols for probe response offloading.
276015f0ebc2SRandy Dunlap  *	 See &enum nl80211_probe_resp_offload_support_attr. Only valid
276115f0ebc2SRandy Dunlap  *	 when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set.
276215f0ebc2SRandy Dunlap  *
2763a293911dSJohannes Berg  * @max_remain_on_channel_duration: Maximum time a remain-on-channel operation
2764a293911dSJohannes Berg  *	may request, if implemented.
2765ff1b6e69SJohannes Berg  *
2766ff1b6e69SJohannes Berg  * @wowlan: WoWLAN support information
27676abb9cb9SJohannes Berg  * @wowlan_config: current WoWLAN configuration; this should usually not be
27686abb9cb9SJohannes Berg  *	used since access to it is necessarily racy, use the parameter passed
27696abb9cb9SJohannes Berg  *	to the suspend() operation instead.
2770562a7480SJohannes Berg  *
2771562a7480SJohannes Berg  * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features.
27727e7c8926SBen Greear  * @ht_capa_mod_mask:  Specify what ht_cap values can be over-ridden.
27737e7c8926SBen Greear  *	If null, then none can be over-ridden.
2774ee2aca34SJohannes Berg  * @vht_capa_mod_mask:  Specify what VHT capabilities can be over-ridden.
2775ee2aca34SJohannes Berg  *	If null, then none can be over-ridden.
277677765eafSVasanthakumar Thiagarajan  *
277777765eafSVasanthakumar Thiagarajan  * @max_acl_mac_addrs: Maximum number of MAC addresses that the device
277877765eafSVasanthakumar Thiagarajan  *	supports for ACL.
2779a50df0c4SJohannes Berg  *
2780a50df0c4SJohannes Berg  * @extended_capabilities: extended capabilities supported by the driver,
2781a50df0c4SJohannes Berg  *	additional capabilities might be supported by userspace; these are
2782a50df0c4SJohannes Berg  *	the 802.11 extended capabilities ("Extended Capabilities element")
2783a50df0c4SJohannes Berg  *	and are in the same format as in the information element. See
2784a50df0c4SJohannes Berg  *	802.11-2012 8.4.2.29 for the defined fields.
2785a50df0c4SJohannes Berg  * @extended_capabilities_mask: mask of the valid values
2786a50df0c4SJohannes Berg  * @extended_capabilities_len: length of the extended capabilities
2787be29b99aSAmitkumar Karwar  * @coalesce: packet coalescing support information
2788d3236553SJohannes Berg  */
2789d3236553SJohannes Berg struct wiphy {
2790d3236553SJohannes Berg 	/* assign these fields before you register the wiphy */
2791d3236553SJohannes Berg 
2792ef15aac6SJohannes Berg 	/* permanent MAC address(es) */
2793d3236553SJohannes Berg 	u8 perm_addr[ETH_ALEN];
2794ef15aac6SJohannes Berg 	u8 addr_mask[ETH_ALEN];
2795ef15aac6SJohannes Berg 
2796ef15aac6SJohannes Berg 	struct mac_address *addresses;
2797d3236553SJohannes Berg 
27982e161f78SJohannes Berg 	const struct ieee80211_txrx_stypes *mgmt_stypes;
27992e161f78SJohannes Berg 
28007527a782SJohannes Berg 	const struct ieee80211_iface_combination *iface_combinations;
28017527a782SJohannes Berg 	int n_iface_combinations;
28027527a782SJohannes Berg 	u16 software_iftypes;
28037527a782SJohannes Berg 
28042e161f78SJohannes Berg 	u16 n_addresses;
28052e161f78SJohannes Berg 
2806d3236553SJohannes Berg 	/* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
2807d3236553SJohannes Berg 	u16 interface_modes;
2808d3236553SJohannes Berg 
280977765eafSVasanthakumar Thiagarajan 	u16 max_acl_mac_addrs;
281077765eafSVasanthakumar Thiagarajan 
28111f074bd8SJohannes Berg 	u32 flags, features;
2812463d0183SJohannes Berg 
2813562a7480SJohannes Berg 	u32 ap_sme_capa;
2814562a7480SJohannes Berg 
2815d3236553SJohannes Berg 	enum cfg80211_signal_type signal_type;
2816d3236553SJohannes Berg 
2817d3236553SJohannes Berg 	int bss_priv_size;
2818d3236553SJohannes Berg 	u8 max_scan_ssids;
281993b6aa69SLuciano Coelho 	u8 max_sched_scan_ssids;
2820a1f1c21cSLuciano Coelho 	u8 max_match_sets;
2821d3236553SJohannes Berg 	u16 max_scan_ie_len;
28225a865badSLuciano Coelho 	u16 max_sched_scan_ie_len;
2823d3236553SJohannes Berg 
2824d3236553SJohannes Berg 	int n_cipher_suites;
2825d3236553SJohannes Berg 	const u32 *cipher_suites;
2826d3236553SJohannes Berg 
2827b9a5f8caSJouni Malinen 	u8 retry_short;
2828b9a5f8caSJouni Malinen 	u8 retry_long;
2829b9a5f8caSJouni Malinen 	u32 frag_threshold;
2830b9a5f8caSJouni Malinen 	u32 rts_threshold;
283181077e82SLukáš Turek 	u8 coverage_class;
2832b9a5f8caSJouni Malinen 
283381135548SJiri Pirko 	char fw_version[ETHTOOL_FWVERS_LEN];
2834dfce95f5SKalle Valo 	u32 hw_version;
2835dfce95f5SKalle Valo 
2836dfb89c56SJohannes Berg #ifdef CONFIG_PM
2837964dc9e2SJohannes Berg 	const struct wiphy_wowlan_support *wowlan;
28386abb9cb9SJohannes Berg 	struct cfg80211_wowlan *wowlan_config;
2839dfb89c56SJohannes Berg #endif
2840ff1b6e69SJohannes Berg 
2841a293911dSJohannes Berg 	u16 max_remain_on_channel_duration;
2842a293911dSJohannes Berg 
284367fbb16bSSamuel Ortiz 	u8 max_num_pmkids;
284467fbb16bSSamuel Ortiz 
28457f531e03SBruno Randolf 	u32 available_antennas_tx;
28467f531e03SBruno Randolf 	u32 available_antennas_rx;
2847a7ffac95SBruno Randolf 
284887bbbe22SArik Nemtsov 	/*
284987bbbe22SArik Nemtsov 	 * Bitmap of supported protocols for probe response offloading
285087bbbe22SArik Nemtsov 	 * see &enum nl80211_probe_resp_offload_support_attr. Only valid
285187bbbe22SArik Nemtsov 	 * when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set.
285287bbbe22SArik Nemtsov 	 */
285387bbbe22SArik Nemtsov 	u32 probe_resp_offload;
285487bbbe22SArik Nemtsov 
2855a50df0c4SJohannes Berg 	const u8 *extended_capabilities, *extended_capabilities_mask;
2856a50df0c4SJohannes Berg 	u8 extended_capabilities_len;
2857a50df0c4SJohannes Berg 
2858d3236553SJohannes Berg 	/* If multiple wiphys are registered and you're handed e.g.
2859d3236553SJohannes Berg 	 * a regular netdev with assigned ieee80211_ptr, you won't
2860d3236553SJohannes Berg 	 * know whether it points to a wiphy your driver has registered
2861d3236553SJohannes Berg 	 * or not. Assign this to something global to your driver to
2862d3236553SJohannes Berg 	 * help determine whether you own this wiphy or not. */
2863cf5aa2f1SDavid Kilroy 	const void *privid;
2864d3236553SJohannes Berg 
2865d3236553SJohannes Berg 	struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS];
2866d3236553SJohannes Berg 
2867d3236553SJohannes Berg 	/* Lets us get back the wiphy on the callback */
28680c0280bdSLuis R. Rodriguez 	void (*reg_notifier)(struct wiphy *wiphy,
2869d3236553SJohannes Berg 			     struct regulatory_request *request);
2870d3236553SJohannes Berg 
2871d3236553SJohannes Berg 	/* fields below are read-only, assigned by cfg80211 */
2872d3236553SJohannes Berg 
2873458f4f9eSJohannes Berg 	const struct ieee80211_regdomain __rcu *regd;
2874d3236553SJohannes Berg 
2875d3236553SJohannes Berg 	/* the item in /sys/class/ieee80211/ points to this,
2876d3236553SJohannes Berg 	 * you need use set_wiphy_dev() (see below) */
2877d3236553SJohannes Berg 	struct device dev;
2878d3236553SJohannes Berg 
2879ecb44335SStanislaw Gruszka 	/* protects ->resume, ->suspend sysfs callbacks against unregister hw */
2880ecb44335SStanislaw Gruszka 	bool registered;
2881ecb44335SStanislaw Gruszka 
2882d3236553SJohannes Berg 	/* dir in debugfs: ieee80211/<wiphyname> */
2883d3236553SJohannes Berg 	struct dentry *debugfsdir;
2884d3236553SJohannes Berg 
28857e7c8926SBen Greear 	const struct ieee80211_ht_cap *ht_capa_mod_mask;
2886ee2aca34SJohannes Berg 	const struct ieee80211_vht_cap *vht_capa_mod_mask;
28877e7c8926SBen Greear 
2888463d0183SJohannes Berg #ifdef CONFIG_NET_NS
2889463d0183SJohannes Berg 	/* the network namespace this phy lives in currently */
2890463d0183SJohannes Berg 	struct net *_net;
2891463d0183SJohannes Berg #endif
2892463d0183SJohannes Berg 
28933d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT
28943d23e349SJohannes Berg 	const struct iw_handler_def *wext;
28953d23e349SJohannes Berg #endif
28963d23e349SJohannes Berg 
2897be29b99aSAmitkumar Karwar 	const struct wiphy_coalesce_support *coalesce;
2898be29b99aSAmitkumar Karwar 
28991c06ef98SJohannes Berg 	char priv[0] __aligned(NETDEV_ALIGN);
2900d3236553SJohannes Berg };
2901d3236553SJohannes Berg 
2902463d0183SJohannes Berg static inline struct net *wiphy_net(struct wiphy *wiphy)
2903463d0183SJohannes Berg {
2904c2d9ba9bSEric Dumazet 	return read_pnet(&wiphy->_net);
2905463d0183SJohannes Berg }
2906463d0183SJohannes Berg 
2907463d0183SJohannes Berg static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net)
2908463d0183SJohannes Berg {
2909c2d9ba9bSEric Dumazet 	write_pnet(&wiphy->_net, net);
2910463d0183SJohannes Berg }
2911463d0183SJohannes Berg 
2912d3236553SJohannes Berg /**
2913d3236553SJohannes Berg  * wiphy_priv - return priv from wiphy
2914d3236553SJohannes Berg  *
2915d3236553SJohannes Berg  * @wiphy: the wiphy whose priv pointer to return
29160ae997dcSYacine Belkadi  * Return: The priv of @wiphy.
2917d3236553SJohannes Berg  */
2918d3236553SJohannes Berg static inline void *wiphy_priv(struct wiphy *wiphy)
2919d3236553SJohannes Berg {
2920d3236553SJohannes Berg 	BUG_ON(!wiphy);
2921d3236553SJohannes Berg 	return &wiphy->priv;
2922d3236553SJohannes Berg }
2923d3236553SJohannes Berg 
2924d3236553SJohannes Berg /**
2925f1f74825SDavid Kilroy  * priv_to_wiphy - return the wiphy containing the priv
2926f1f74825SDavid Kilroy  *
2927f1f74825SDavid Kilroy  * @priv: a pointer previously returned by wiphy_priv
29280ae997dcSYacine Belkadi  * Return: The wiphy of @priv.
2929f1f74825SDavid Kilroy  */
2930f1f74825SDavid Kilroy static inline struct wiphy *priv_to_wiphy(void *priv)
2931f1f74825SDavid Kilroy {
2932f1f74825SDavid Kilroy 	BUG_ON(!priv);
2933f1f74825SDavid Kilroy 	return container_of(priv, struct wiphy, priv);
2934f1f74825SDavid Kilroy }
2935f1f74825SDavid Kilroy 
2936f1f74825SDavid Kilroy /**
2937d3236553SJohannes Berg  * set_wiphy_dev - set device pointer for wiphy
2938d3236553SJohannes Berg  *
2939d3236553SJohannes Berg  * @wiphy: The wiphy whose device to bind
2940d3236553SJohannes Berg  * @dev: The device to parent it to
2941d3236553SJohannes Berg  */
2942d3236553SJohannes Berg static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev)
2943d3236553SJohannes Berg {
2944d3236553SJohannes Berg 	wiphy->dev.parent = dev;
2945d3236553SJohannes Berg }
2946d3236553SJohannes Berg 
2947d3236553SJohannes Berg /**
2948d3236553SJohannes Berg  * wiphy_dev - get wiphy dev pointer
2949d3236553SJohannes Berg  *
2950d3236553SJohannes Berg  * @wiphy: The wiphy whose device struct to look up
29510ae997dcSYacine Belkadi  * Return: The dev of @wiphy.
2952d3236553SJohannes Berg  */
2953d3236553SJohannes Berg static inline struct device *wiphy_dev(struct wiphy *wiphy)
2954d3236553SJohannes Berg {
2955d3236553SJohannes Berg 	return wiphy->dev.parent;
2956d3236553SJohannes Berg }
2957d3236553SJohannes Berg 
2958d3236553SJohannes Berg /**
2959d3236553SJohannes Berg  * wiphy_name - get wiphy name
2960d3236553SJohannes Berg  *
2961d3236553SJohannes Berg  * @wiphy: The wiphy whose name to return
29620ae997dcSYacine Belkadi  * Return: The name of @wiphy.
2963d3236553SJohannes Berg  */
2964e1db74fcSJoe Perches static inline const char *wiphy_name(const struct wiphy *wiphy)
2965d3236553SJohannes Berg {
2966d3236553SJohannes Berg 	return dev_name(&wiphy->dev);
2967d3236553SJohannes Berg }
2968d3236553SJohannes Berg 
2969d3236553SJohannes Berg /**
2970d3236553SJohannes Berg  * wiphy_new - create a new wiphy for use with cfg80211
2971d3236553SJohannes Berg  *
2972d3236553SJohannes Berg  * @ops: The configuration operations for this device
2973d3236553SJohannes Berg  * @sizeof_priv: The size of the private area to allocate
2974d3236553SJohannes Berg  *
2975d3236553SJohannes Berg  * Create a new wiphy and associate the given operations with it.
2976d3236553SJohannes Berg  * @sizeof_priv bytes are allocated for private use.
2977d3236553SJohannes Berg  *
29780ae997dcSYacine Belkadi  * Return: A pointer to the new wiphy. This pointer must be
29790ae997dcSYacine Belkadi  * assigned to each netdev's ieee80211_ptr for proper operation.
2980d3236553SJohannes Berg  */
29813dcf670bSDavid Kilroy struct wiphy *wiphy_new(const struct cfg80211_ops *ops, int sizeof_priv);
2982d3236553SJohannes Berg 
2983d3236553SJohannes Berg /**
2984d3236553SJohannes Berg  * wiphy_register - register a wiphy with cfg80211
2985d3236553SJohannes Berg  *
2986d3236553SJohannes Berg  * @wiphy: The wiphy to register.
2987d3236553SJohannes Berg  *
29880ae997dcSYacine Belkadi  * Return: A non-negative wiphy index or a negative error code.
2989d3236553SJohannes Berg  */
299010dd9b7cSJoe Perches int wiphy_register(struct wiphy *wiphy);
2991d3236553SJohannes Berg 
2992d3236553SJohannes Berg /**
2993d3236553SJohannes Berg  * wiphy_unregister - deregister a wiphy from cfg80211
2994d3236553SJohannes Berg  *
2995d3236553SJohannes Berg  * @wiphy: The wiphy to unregister.
2996d3236553SJohannes Berg  *
2997d3236553SJohannes Berg  * After this call, no more requests can be made with this priv
2998d3236553SJohannes Berg  * pointer, but the call may sleep to wait for an outstanding
2999d3236553SJohannes Berg  * request that is being handled.
3000d3236553SJohannes Berg  */
300110dd9b7cSJoe Perches void wiphy_unregister(struct wiphy *wiphy);
3002d3236553SJohannes Berg 
3003d3236553SJohannes Berg /**
3004d3236553SJohannes Berg  * wiphy_free - free wiphy
3005d3236553SJohannes Berg  *
3006d3236553SJohannes Berg  * @wiphy: The wiphy to free
3007d3236553SJohannes Berg  */
300810dd9b7cSJoe Perches void wiphy_free(struct wiphy *wiphy);
3009d3236553SJohannes Berg 
3010fffd0934SJohannes Berg /* internal structs */
30116829c878SJohannes Berg struct cfg80211_conn;
301219957bb3SJohannes Berg struct cfg80211_internal_bss;
3013fffd0934SJohannes Berg struct cfg80211_cached_keys;
301419957bb3SJohannes Berg 
3015d3236553SJohannes Berg /**
301689a54e48SJohannes Berg  * struct wireless_dev - wireless device state
3017d3236553SJohannes Berg  *
301889a54e48SJohannes Berg  * For netdevs, this structure must be allocated by the driver
301989a54e48SJohannes Berg  * that uses the ieee80211_ptr field in struct net_device (this
302089a54e48SJohannes Berg  * is intentional so it can be allocated along with the netdev.)
302189a54e48SJohannes Berg  * It need not be registered then as netdev registration will
302289a54e48SJohannes Berg  * be intercepted by cfg80211 to see the new wireless device.
302389a54e48SJohannes Berg  *
302489a54e48SJohannes Berg  * For non-netdev uses, it must also be allocated by the driver
302589a54e48SJohannes Berg  * in response to the cfg80211 callbacks that require it, as
302689a54e48SJohannes Berg  * there's no netdev registration in that case it may not be
302789a54e48SJohannes Berg  * allocated outside of callback operations that return it.
3028d3236553SJohannes Berg  *
3029d3236553SJohannes Berg  * @wiphy: pointer to hardware description
3030d3236553SJohannes Berg  * @iftype: interface type
3031d3236553SJohannes Berg  * @list: (private) Used to collect the interfaces
303289a54e48SJohannes Berg  * @netdev: (private) Used to reference back to the netdev, may be %NULL
303389a54e48SJohannes Berg  * @identifier: (private) Identifier used in nl80211 to identify this
303489a54e48SJohannes Berg  *	wireless device if it has no netdev
3035d3236553SJohannes Berg  * @current_bss: (private) Used by the internal configuration code
3036f444de05SJohannes Berg  * @channel: (private) Used by the internal configuration code to track
3037aa430da4SJohannes Berg  *	the user-set AP, monitor and WDS channel
3038780b40dfSJohannes Berg  * @preset_chandef: (private) Used by the internal configuration code to
3039aa430da4SJohannes Berg  *	track the channel to be used for AP later
3040d3236553SJohannes Berg  * @bssid: (private) Used by the internal configuration code
3041d3236553SJohannes Berg  * @ssid: (private) Used by the internal configuration code
3042d3236553SJohannes Berg  * @ssid_len: (private) Used by the internal configuration code
304329cbe68cSJohannes Berg  * @mesh_id_len: (private) Used by the internal configuration code
304429cbe68cSJohannes Berg  * @mesh_id_up_len: (private) Used by the internal configuration code
3045d3236553SJohannes Berg  * @wext: (private) Used by the internal wireless extensions compat code
30469bc383deSJohannes Berg  * @use_4addr: indicates 4addr mode is used on this interface, must be
30479bc383deSJohannes Berg  *	set by driver (if supported) on add_interface BEFORE registering the
30489bc383deSJohannes Berg  *	netdev and may otherwise be used by driver read-only, will be update
30499bc383deSJohannes Berg  *	by cfg80211 on change_interface
30502e161f78SJohannes Berg  * @mgmt_registrations: list of registrations for management frames
30512e161f78SJohannes Berg  * @mgmt_registrations_lock: lock for the list
30528d61ffa5SJohannes Berg  * @mtx: mutex used to lock data in this struct, may be used by drivers
30538d61ffa5SJohannes Berg  *	and some API functions require it held
305456d1893dSJohannes Berg  * @beacon_interval: beacon interval used on this device for transmitting
305556d1893dSJohannes Berg  *	beacons, 0 when not valid
305698104fdeSJohannes Berg  * @address: The address for this device, valid only if @netdev is %NULL
305798104fdeSJohannes Berg  * @p2p_started: true if this is a P2P Device that has been started
305804f39047SSimon Wunderlich  * @cac_started: true if DFS channel availability check has been started
305904f39047SSimon Wunderlich  * @cac_start_time: timestamp (jiffies) when the dfs state was entered.
3060780b40dfSJohannes Berg  * @ps: powersave mode is enabled
3061780b40dfSJohannes Berg  * @ps_timeout: dynamic powersave timeout
3062780b40dfSJohannes Berg  * @ap_unexpected_nlportid: (private) netlink port ID of application
3063780b40dfSJohannes Berg  *	registered for unexpected class 3 frames (AP mode)
3064780b40dfSJohannes Berg  * @conn: (private) cfg80211 software SME connection state machine data
3065780b40dfSJohannes Berg  * @connect_keys: (private) keys to set after connection is established
3066780b40dfSJohannes Berg  * @ibss_fixed: (private) IBSS is using fixed BSSID
30675336fa88SSimon Wunderlich  * @ibss_dfs_possible: (private) IBSS may change to a DFS channel
3068780b40dfSJohannes Berg  * @event_list: (private) list for internal event processing
3069780b40dfSJohannes Berg  * @event_lock: (private) lock for event list
3070d3236553SJohannes Berg  */
3071d3236553SJohannes Berg struct wireless_dev {
3072d3236553SJohannes Berg 	struct wiphy *wiphy;
3073d3236553SJohannes Berg 	enum nl80211_iftype iftype;
3074d3236553SJohannes Berg 
3075667503ddSJohannes Berg 	/* the remainder of this struct should be private to cfg80211 */
3076d3236553SJohannes Berg 	struct list_head list;
3077d3236553SJohannes Berg 	struct net_device *netdev;
3078d3236553SJohannes Berg 
307989a54e48SJohannes Berg 	u32 identifier;
308089a54e48SJohannes Berg 
30812e161f78SJohannes Berg 	struct list_head mgmt_registrations;
30822e161f78SJohannes Berg 	spinlock_t mgmt_registrations_lock;
3083026331c4SJouni Malinen 
3084667503ddSJohannes Berg 	struct mutex mtx;
3085667503ddSJohannes Berg 
308698104fdeSJohannes Berg 	bool use_4addr, p2p_started;
308798104fdeSJohannes Berg 
308898104fdeSJohannes Berg 	u8 address[ETH_ALEN] __aligned(sizeof(u16));
30899bc383deSJohannes Berg 
3090b23aa676SSamuel Ortiz 	/* currently used for IBSS and SME - might be rearranged later */
3091d3236553SJohannes Berg 	u8 ssid[IEEE80211_MAX_SSID_LEN];
309229cbe68cSJohannes Berg 	u8 ssid_len, mesh_id_len, mesh_id_up_len;
30936829c878SJohannes Berg 	struct cfg80211_conn *conn;
3094fffd0934SJohannes Berg 	struct cfg80211_cached_keys *connect_keys;
3095d3236553SJohannes Berg 
3096667503ddSJohannes Berg 	struct list_head event_list;
3097667503ddSJohannes Berg 	spinlock_t event_lock;
3098667503ddSJohannes Berg 
309919957bb3SJohannes Berg 	struct cfg80211_internal_bss *current_bss; /* associated / joined */
3100683b6d3bSJohannes Berg 	struct cfg80211_chan_def preset_chandef;
310119957bb3SJohannes Berg 
3102f4489ebeSMichal Kazior 	/* for AP and mesh channel tracking */
3103f4489ebeSMichal Kazior 	struct ieee80211_channel *channel;
3104f4489ebeSMichal Kazior 
3105c30a3d38SMichal Kazior 	bool ibss_fixed;
31065336fa88SSimon Wunderlich 	bool ibss_dfs_possible;
3107c30a3d38SMichal Kazior 
3108ffb9eb3dSKalle Valo 	bool ps;
3109ffb9eb3dSKalle Valo 	int ps_timeout;
3110ffb9eb3dSKalle Valo 
311156d1893dSJohannes Berg 	int beacon_interval;
311256d1893dSJohannes Berg 
311315e47304SEric W. Biederman 	u32 ap_unexpected_nlportid;
311428946da7SJohannes Berg 
311504f39047SSimon Wunderlich 	bool cac_started;
311604f39047SSimon Wunderlich 	unsigned long cac_start_time;
311704f39047SSimon Wunderlich 
31183d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT
3119d3236553SJohannes Berg 	/* wext data */
3120cbe8fa9cSJohannes Berg 	struct {
3121cbe8fa9cSJohannes Berg 		struct cfg80211_ibss_params ibss;
3122f2129354SJohannes Berg 		struct cfg80211_connect_params connect;
3123fffd0934SJohannes Berg 		struct cfg80211_cached_keys *keys;
3124f2129354SJohannes Berg 		u8 *ie;
3125f2129354SJohannes Berg 		size_t ie_len;
3126f401a6f7SJohannes Berg 		u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN];
3127f2129354SJohannes Berg 		u8 ssid[IEEE80211_MAX_SSID_LEN];
312808645126SJohannes Berg 		s8 default_key, default_mgmt_key;
3129ffb9eb3dSKalle Valo 		bool prev_bssid_valid;
3130cbe8fa9cSJohannes Berg 	} wext;
3131d3236553SJohannes Berg #endif
3132d3236553SJohannes Berg };
3133d3236553SJohannes Berg 
313498104fdeSJohannes Berg static inline u8 *wdev_address(struct wireless_dev *wdev)
313598104fdeSJohannes Berg {
313698104fdeSJohannes Berg 	if (wdev->netdev)
313798104fdeSJohannes Berg 		return wdev->netdev->dev_addr;
313898104fdeSJohannes Berg 	return wdev->address;
313998104fdeSJohannes Berg }
314098104fdeSJohannes Berg 
3141d3236553SJohannes Berg /**
3142d3236553SJohannes Berg  * wdev_priv - return wiphy priv from wireless_dev
3143d3236553SJohannes Berg  *
3144d3236553SJohannes Berg  * @wdev: The wireless device whose wiphy's priv pointer to return
31450ae997dcSYacine Belkadi  * Return: The wiphy priv of @wdev.
3146d3236553SJohannes Berg  */
3147d3236553SJohannes Berg static inline void *wdev_priv(struct wireless_dev *wdev)
3148d3236553SJohannes Berg {
3149d3236553SJohannes Berg 	BUG_ON(!wdev);
3150d3236553SJohannes Berg 	return wiphy_priv(wdev->wiphy);
3151d3236553SJohannes Berg }
3152d3236553SJohannes Berg 
3153d70e9693SJohannes Berg /**
3154d70e9693SJohannes Berg  * DOC: Utility functions
3155d70e9693SJohannes Berg  *
3156d70e9693SJohannes Berg  * cfg80211 offers a number of utility functions that can be useful.
3157d3236553SJohannes Berg  */
3158d3236553SJohannes Berg 
3159d3236553SJohannes Berg /**
3160d3236553SJohannes Berg  * ieee80211_channel_to_frequency - convert channel number to frequency
3161abe37c4bSJohannes Berg  * @chan: channel number
316259eb21a6SBruno Randolf  * @band: band, necessary due to channel number overlap
31630ae997dcSYacine Belkadi  * Return: The corresponding frequency (in MHz), or 0 if the conversion failed.
3164d3236553SJohannes Berg  */
316510dd9b7cSJoe Perches int ieee80211_channel_to_frequency(int chan, enum ieee80211_band band);
3166d3236553SJohannes Berg 
3167d3236553SJohannes Berg /**
3168d3236553SJohannes Berg  * ieee80211_frequency_to_channel - convert frequency to channel number
3169abe37c4bSJohannes Berg  * @freq: center frequency
31700ae997dcSYacine Belkadi  * Return: The corresponding channel, or 0 if the conversion failed.
3171d3236553SJohannes Berg  */
317210dd9b7cSJoe Perches int ieee80211_frequency_to_channel(int freq);
3173d3236553SJohannes Berg 
3174d3236553SJohannes Berg /*
3175d3236553SJohannes Berg  * Name indirection necessary because the ieee80211 code also has
3176d3236553SJohannes Berg  * a function named "ieee80211_get_channel", so if you include
3177d3236553SJohannes Berg  * cfg80211's header file you get cfg80211's version, if you try
3178d3236553SJohannes Berg  * to include both header files you'll (rightfully!) get a symbol
3179d3236553SJohannes Berg  * clash.
3180d3236553SJohannes Berg  */
318110dd9b7cSJoe Perches struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy,
3182d3236553SJohannes Berg 						  int freq);
3183d3236553SJohannes Berg /**
3184d3236553SJohannes Berg  * ieee80211_get_channel - get channel struct from wiphy for specified frequency
3185abe37c4bSJohannes Berg  * @wiphy: the struct wiphy to get the channel for
3186abe37c4bSJohannes Berg  * @freq: the center frequency of the channel
31870ae997dcSYacine Belkadi  * Return: The channel struct from @wiphy at @freq.
3188d3236553SJohannes Berg  */
3189d3236553SJohannes Berg static inline struct ieee80211_channel *
3190d3236553SJohannes Berg ieee80211_get_channel(struct wiphy *wiphy, int freq)
3191d3236553SJohannes Berg {
3192d3236553SJohannes Berg 	return __ieee80211_get_channel(wiphy, freq);
3193d3236553SJohannes Berg }
3194d3236553SJohannes Berg 
3195d3236553SJohannes Berg /**
3196d3236553SJohannes Berg  * ieee80211_get_response_rate - get basic rate for a given rate
3197d3236553SJohannes Berg  *
3198d3236553SJohannes Berg  * @sband: the band to look for rates in
3199d3236553SJohannes Berg  * @basic_rates: bitmap of basic rates
3200d3236553SJohannes Berg  * @bitrate: the bitrate for which to find the basic rate
3201d3236553SJohannes Berg  *
32020ae997dcSYacine Belkadi  * Return: The basic rate corresponding to a given bitrate, that
32030ae997dcSYacine Belkadi  * is the next lower bitrate contained in the basic rate map,
32040ae997dcSYacine Belkadi  * which is, for this function, given as a bitmap of indices of
32050ae997dcSYacine Belkadi  * rates in the band's bitrate table.
3206d3236553SJohannes Berg  */
3207d3236553SJohannes Berg struct ieee80211_rate *
3208d3236553SJohannes Berg ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
3209d3236553SJohannes Berg 			    u32 basic_rates, int bitrate);
3210d3236553SJohannes Berg 
3211b422c6cdSAshok Nagarajan /**
3212b422c6cdSAshok Nagarajan  * ieee80211_mandatory_rates - get mandatory rates for a given band
3213b422c6cdSAshok Nagarajan  * @sband: the band to look for rates in
321474608acaSSimon Wunderlich  * @scan_width: width of the control channel
3215b422c6cdSAshok Nagarajan  *
3216b422c6cdSAshok Nagarajan  * This function returns a bitmap of the mandatory rates for the given
3217b422c6cdSAshok Nagarajan  * band, bits are set according to the rate position in the bitrates array.
3218b422c6cdSAshok Nagarajan  */
321974608acaSSimon Wunderlich u32 ieee80211_mandatory_rates(struct ieee80211_supported_band *sband,
322074608acaSSimon Wunderlich 			      enum nl80211_bss_scan_width scan_width);
3221b422c6cdSAshok Nagarajan 
3222d3236553SJohannes Berg /*
3223d3236553SJohannes Berg  * Radiotap parsing functions -- for controlled injection support
3224d3236553SJohannes Berg  *
3225d3236553SJohannes Berg  * Implemented in net/wireless/radiotap.c
3226d3236553SJohannes Berg  * Documentation in Documentation/networking/radiotap-headers.txt
3227d3236553SJohannes Berg  */
3228d3236553SJohannes Berg 
322933e5a2f7SJohannes Berg struct radiotap_align_size {
323033e5a2f7SJohannes Berg 	uint8_t align:4, size:4;
323133e5a2f7SJohannes Berg };
323233e5a2f7SJohannes Berg 
323333e5a2f7SJohannes Berg struct ieee80211_radiotap_namespace {
323433e5a2f7SJohannes Berg 	const struct radiotap_align_size *align_size;
323533e5a2f7SJohannes Berg 	int n_bits;
323633e5a2f7SJohannes Berg 	uint32_t oui;
323733e5a2f7SJohannes Berg 	uint8_t subns;
323833e5a2f7SJohannes Berg };
323933e5a2f7SJohannes Berg 
324033e5a2f7SJohannes Berg struct ieee80211_radiotap_vendor_namespaces {
324133e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_namespace *ns;
324233e5a2f7SJohannes Berg 	int n_ns;
324333e5a2f7SJohannes Berg };
324433e5a2f7SJohannes Berg 
3245d3236553SJohannes Berg /**
3246d3236553SJohannes Berg  * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args
324733e5a2f7SJohannes Berg  * @this_arg_index: index of current arg, valid after each successful call
324833e5a2f7SJohannes Berg  *	to ieee80211_radiotap_iterator_next()
324933e5a2f7SJohannes Berg  * @this_arg: pointer to current radiotap arg; it is valid after each
325033e5a2f7SJohannes Berg  *	call to ieee80211_radiotap_iterator_next() but also after
325133e5a2f7SJohannes Berg  *	ieee80211_radiotap_iterator_init() where it will point to
325233e5a2f7SJohannes Berg  *	the beginning of the actual data portion
325333e5a2f7SJohannes Berg  * @this_arg_size: length of the current arg, for convenience
325433e5a2f7SJohannes Berg  * @current_namespace: pointer to the current namespace definition
325533e5a2f7SJohannes Berg  *	(or internally %NULL if the current namespace is unknown)
325633e5a2f7SJohannes Berg  * @is_radiotap_ns: indicates whether the current namespace is the default
325733e5a2f7SJohannes Berg  *	radiotap namespace or not
325833e5a2f7SJohannes Berg  *
325933e5a2f7SJohannes Berg  * @_rtheader: pointer to the radiotap header we are walking through
326033e5a2f7SJohannes Berg  * @_max_length: length of radiotap header in cpu byte ordering
326133e5a2f7SJohannes Berg  * @_arg_index: next argument index
326233e5a2f7SJohannes Berg  * @_arg: next argument pointer
326333e5a2f7SJohannes Berg  * @_next_bitmap: internal pointer to next present u32
326433e5a2f7SJohannes Berg  * @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present
326533e5a2f7SJohannes Berg  * @_vns: vendor namespace definitions
326633e5a2f7SJohannes Berg  * @_next_ns_data: beginning of the next namespace's data
326733e5a2f7SJohannes Berg  * @_reset_on_ext: internal; reset the arg index to 0 when going to the
326833e5a2f7SJohannes Berg  *	next bitmap word
326933e5a2f7SJohannes Berg  *
327033e5a2f7SJohannes Berg  * Describes the radiotap parser state. Fields prefixed with an underscore
327133e5a2f7SJohannes Berg  * must not be used by users of the parser, only by the parser internally.
3272d3236553SJohannes Berg  */
3273d3236553SJohannes Berg 
3274d3236553SJohannes Berg struct ieee80211_radiotap_iterator {
327533e5a2f7SJohannes Berg 	struct ieee80211_radiotap_header *_rtheader;
327633e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_vendor_namespaces *_vns;
327733e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_namespace *current_namespace;
3278d3236553SJohannes Berg 
327933e5a2f7SJohannes Berg 	unsigned char *_arg, *_next_ns_data;
328067272440SJohannes Berg 	__le32 *_next_bitmap;
328133e5a2f7SJohannes Berg 
328233e5a2f7SJohannes Berg 	unsigned char *this_arg;
328333e5a2f7SJohannes Berg 	int this_arg_index;
328433e5a2f7SJohannes Berg 	int this_arg_size;
328533e5a2f7SJohannes Berg 
328633e5a2f7SJohannes Berg 	int is_radiotap_ns;
328733e5a2f7SJohannes Berg 
328833e5a2f7SJohannes Berg 	int _max_length;
328933e5a2f7SJohannes Berg 	int _arg_index;
329033e5a2f7SJohannes Berg 	uint32_t _bitmap_shifter;
329133e5a2f7SJohannes Berg 	int _reset_on_ext;
3292d3236553SJohannes Berg };
3293d3236553SJohannes Berg 
329410dd9b7cSJoe Perches int
329510dd9b7cSJoe Perches ieee80211_radiotap_iterator_init(struct ieee80211_radiotap_iterator *iterator,
3296d3236553SJohannes Berg 				 struct ieee80211_radiotap_header *radiotap_header,
329710dd9b7cSJoe Perches 				 int max_length,
329810dd9b7cSJoe Perches 				 const struct ieee80211_radiotap_vendor_namespaces *vns);
3299d3236553SJohannes Berg 
330010dd9b7cSJoe Perches int
330110dd9b7cSJoe Perches ieee80211_radiotap_iterator_next(struct ieee80211_radiotap_iterator *iterator);
3302d3236553SJohannes Berg 
330333e5a2f7SJohannes Berg 
3304e31a16d6SZhu Yi extern const unsigned char rfc1042_header[6];
3305e31a16d6SZhu Yi extern const unsigned char bridge_tunnel_header[6];
3306e31a16d6SZhu Yi 
3307e31a16d6SZhu Yi /**
3308e31a16d6SZhu Yi  * ieee80211_get_hdrlen_from_skb - get header length from data
3309e31a16d6SZhu Yi  *
3310e31a16d6SZhu Yi  * @skb: the frame
33110ae997dcSYacine Belkadi  *
33120ae997dcSYacine Belkadi  * Given an skb with a raw 802.11 header at the data pointer this function
33130ae997dcSYacine Belkadi  * returns the 802.11 header length.
33140ae997dcSYacine Belkadi  *
33150ae997dcSYacine Belkadi  * Return: The 802.11 header length in bytes (not including encryption
33160ae997dcSYacine Belkadi  * headers). Or 0 if the data in the sk_buff is too short to contain a valid
33170ae997dcSYacine Belkadi  * 802.11 header.
3318e31a16d6SZhu Yi  */
3319e31a16d6SZhu Yi unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb);
3320e31a16d6SZhu Yi 
3321e31a16d6SZhu Yi /**
3322e31a16d6SZhu Yi  * ieee80211_hdrlen - get header length in bytes from frame control
3323e31a16d6SZhu Yi  * @fc: frame control field in little-endian format
33240ae997dcSYacine Belkadi  * Return: The header length in bytes.
3325e31a16d6SZhu Yi  */
3326633adf1aSJohannes Berg unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc);
3327e31a16d6SZhu Yi 
3328e31a16d6SZhu Yi /**
33299b395bc3SJohannes Berg  * ieee80211_get_mesh_hdrlen - get mesh extension header length
33309b395bc3SJohannes Berg  * @meshhdr: the mesh extension header, only the flags field
33319b395bc3SJohannes Berg  *	(first byte) will be accessed
33320ae997dcSYacine Belkadi  * Return: The length of the extension header, which is always at
33339b395bc3SJohannes Berg  * least 6 bytes and at most 18 if address 5 and 6 are present.
33349b395bc3SJohannes Berg  */
33359b395bc3SJohannes Berg unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr);
33369b395bc3SJohannes Berg 
33379b395bc3SJohannes Berg /**
3338d70e9693SJohannes Berg  * DOC: Data path helpers
3339d70e9693SJohannes Berg  *
3340d70e9693SJohannes Berg  * In addition to generic utilities, cfg80211 also offers
3341d70e9693SJohannes Berg  * functions that help implement the data path for devices
3342d70e9693SJohannes Berg  * that do not do the 802.11/802.3 conversion on the device.
3343d70e9693SJohannes Berg  */
3344d70e9693SJohannes Berg 
3345d70e9693SJohannes Berg /**
3346e31a16d6SZhu Yi  * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3
3347e31a16d6SZhu Yi  * @skb: the 802.11 data frame
3348e31a16d6SZhu Yi  * @addr: the device MAC address
3349e31a16d6SZhu Yi  * @iftype: the virtual interface type
33500ae997dcSYacine Belkadi  * Return: 0 on success. Non-zero on error.
3351e31a16d6SZhu Yi  */
3352eaf85ca7SZhu Yi int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
3353e31a16d6SZhu Yi 			   enum nl80211_iftype iftype);
3354e31a16d6SZhu Yi 
3355e31a16d6SZhu Yi /**
3356e31a16d6SZhu Yi  * ieee80211_data_from_8023 - convert an 802.3 frame to 802.11
3357e31a16d6SZhu Yi  * @skb: the 802.3 frame
3358e31a16d6SZhu Yi  * @addr: the device MAC address
3359e31a16d6SZhu Yi  * @iftype: the virtual interface type
3360e31a16d6SZhu Yi  * @bssid: the network bssid (used only for iftype STATION and ADHOC)
3361e31a16d6SZhu Yi  * @qos: build 802.11 QoS data frame
33620ae997dcSYacine Belkadi  * Return: 0 on success, or a negative error code.
3363e31a16d6SZhu Yi  */
3364eaf85ca7SZhu Yi int ieee80211_data_from_8023(struct sk_buff *skb, const u8 *addr,
3365e31a16d6SZhu Yi 			     enum nl80211_iftype iftype, u8 *bssid, bool qos);
3366e31a16d6SZhu Yi 
3367e31a16d6SZhu Yi /**
3368eaf85ca7SZhu Yi  * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame
3369eaf85ca7SZhu Yi  *
3370eaf85ca7SZhu Yi  * Decode an IEEE 802.11n A-MSDU frame and convert it to a list of
3371eaf85ca7SZhu Yi  * 802.3 frames. The @list will be empty if the decode fails. The
3372eaf85ca7SZhu Yi  * @skb is consumed after the function returns.
3373eaf85ca7SZhu Yi  *
3374eaf85ca7SZhu Yi  * @skb: The input IEEE 802.11n A-MSDU frame.
3375eaf85ca7SZhu Yi  * @list: The output list of 802.3 frames. It must be allocated and
3376eaf85ca7SZhu Yi  *	initialized by by the caller.
3377eaf85ca7SZhu Yi  * @addr: The device MAC address.
3378eaf85ca7SZhu Yi  * @iftype: The device interface type.
3379eaf85ca7SZhu Yi  * @extra_headroom: The hardware extra headroom for SKBs in the @list.
33808b3becadSYogesh Ashok Powar  * @has_80211_header: Set it true if SKB is with IEEE 802.11 header.
3381eaf85ca7SZhu Yi  */
3382eaf85ca7SZhu Yi void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,
3383eaf85ca7SZhu Yi 			      const u8 *addr, enum nl80211_iftype iftype,
33848b3becadSYogesh Ashok Powar 			      const unsigned int extra_headroom,
33858b3becadSYogesh Ashok Powar 			      bool has_80211_header);
3386eaf85ca7SZhu Yi 
3387eaf85ca7SZhu Yi /**
3388e31a16d6SZhu Yi  * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame
3389e31a16d6SZhu Yi  * @skb: the data frame
33900ae997dcSYacine Belkadi  * Return: The 802.1p/1d tag.
3391e31a16d6SZhu Yi  */
3392e31a16d6SZhu Yi unsigned int cfg80211_classify8021d(struct sk_buff *skb);
3393e31a16d6SZhu Yi 
3394c21dbf92SJohannes Berg /**
3395c21dbf92SJohannes Berg  * cfg80211_find_ie - find information element in data
3396c21dbf92SJohannes Berg  *
3397c21dbf92SJohannes Berg  * @eid: element ID
3398c21dbf92SJohannes Berg  * @ies: data consisting of IEs
3399c21dbf92SJohannes Berg  * @len: length of data
3400c21dbf92SJohannes Berg  *
34010ae997dcSYacine Belkadi  * Return: %NULL if the element ID could not be found or if
34020ae997dcSYacine Belkadi  * the element is invalid (claims to be longer than the given
34030ae997dcSYacine Belkadi  * data), or a pointer to the first byte of the requested
34040ae997dcSYacine Belkadi  * element, that is the byte containing the element ID.
34050ae997dcSYacine Belkadi  *
34060ae997dcSYacine Belkadi  * Note: There are no checks on the element length other than
34070ae997dcSYacine Belkadi  * having to fit into the given data.
3408c21dbf92SJohannes Berg  */
3409c21dbf92SJohannes Berg const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len);
3410c21dbf92SJohannes Berg 
3411d70e9693SJohannes Berg /**
34120c28ec58SEliad Peller  * cfg80211_find_vendor_ie - find vendor specific information element in data
34130c28ec58SEliad Peller  *
34140c28ec58SEliad Peller  * @oui: vendor OUI
34150c28ec58SEliad Peller  * @oui_type: vendor-specific OUI type
34160c28ec58SEliad Peller  * @ies: data consisting of IEs
34170c28ec58SEliad Peller  * @len: length of data
34180c28ec58SEliad Peller  *
34190ae997dcSYacine Belkadi  * Return: %NULL if the vendor specific element ID could not be found or if the
34200ae997dcSYacine Belkadi  * element is invalid (claims to be longer than the given data), or a pointer to
34210ae997dcSYacine Belkadi  * the first byte of the requested element, that is the byte containing the
34220ae997dcSYacine Belkadi  * element ID.
34230ae997dcSYacine Belkadi  *
34240ae997dcSYacine Belkadi  * Note: There are no checks on the element length other than having to fit into
34250ae997dcSYacine Belkadi  * the given data.
34260c28ec58SEliad Peller  */
34270c28ec58SEliad Peller const u8 *cfg80211_find_vendor_ie(unsigned int oui, u8 oui_type,
34280c28ec58SEliad Peller 				  const u8 *ies, int len);
34290c28ec58SEliad Peller 
34300c28ec58SEliad Peller /**
3431d70e9693SJohannes Berg  * DOC: Regulatory enforcement infrastructure
3432d70e9693SJohannes Berg  *
3433d70e9693SJohannes Berg  * TODO
3434d3236553SJohannes Berg  */
3435d3236553SJohannes Berg 
3436d3236553SJohannes Berg /**
3437d3236553SJohannes Berg  * regulatory_hint - driver hint to the wireless core a regulatory domain
3438d3236553SJohannes Berg  * @wiphy: the wireless device giving the hint (used only for reporting
3439d3236553SJohannes Berg  *	conflicts)
3440d3236553SJohannes Berg  * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain
3441d3236553SJohannes Berg  * 	should be in. If @rd is set this should be NULL. Note that if you
3442d3236553SJohannes Berg  * 	set this to NULL you should still set rd->alpha2 to some accepted
3443d3236553SJohannes Berg  * 	alpha2.
3444d3236553SJohannes Berg  *
3445d3236553SJohannes Berg  * Wireless drivers can use this function to hint to the wireless core
3446d3236553SJohannes Berg  * what it believes should be the current regulatory domain by
3447d3236553SJohannes Berg  * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory
3448d3236553SJohannes Berg  * domain should be in or by providing a completely build regulatory domain.
3449d3236553SJohannes Berg  * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried
3450d3236553SJohannes Berg  * for a regulatory domain structure for the respective country.
3451d3236553SJohannes Berg  *
3452d3236553SJohannes Berg  * The wiphy must have been registered to cfg80211 prior to this call.
3453d3236553SJohannes Berg  * For cfg80211 drivers this means you must first use wiphy_register(),
3454d3236553SJohannes Berg  * for mac80211 drivers you must first use ieee80211_register_hw().
3455d3236553SJohannes Berg  *
3456d3236553SJohannes Berg  * Drivers should check the return value, its possible you can get
3457d3236553SJohannes Berg  * an -ENOMEM.
34580ae997dcSYacine Belkadi  *
34590ae997dcSYacine Belkadi  * Return: 0 on success. -ENOMEM.
3460d3236553SJohannes Berg  */
346110dd9b7cSJoe Perches int regulatory_hint(struct wiphy *wiphy, const char *alpha2);
3462d3236553SJohannes Berg 
3463d3236553SJohannes Berg /**
3464d3236553SJohannes Berg  * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain
3465d3236553SJohannes Berg  * @wiphy: the wireless device we want to process the regulatory domain on
3466d3236553SJohannes Berg  * @regd: the custom regulatory domain to use for this wiphy
3467d3236553SJohannes Berg  *
3468d3236553SJohannes Berg  * Drivers can sometimes have custom regulatory domains which do not apply
3469d3236553SJohannes Berg  * to a specific country. Drivers can use this to apply such custom regulatory
3470d3236553SJohannes Berg  * domains. This routine must be called prior to wiphy registration. The
3471d3236553SJohannes Berg  * custom regulatory domain will be trusted completely and as such previous
3472d3236553SJohannes Berg  * default channel settings will be disregarded. If no rule is found for a
3473d3236553SJohannes Berg  * channel on the regulatory domain the channel will be disabled.
3474d3236553SJohannes Berg  */
347510dd9b7cSJoe Perches void wiphy_apply_custom_regulatory(struct wiphy *wiphy,
3476d3236553SJohannes Berg 				   const struct ieee80211_regdomain *regd);
3477d3236553SJohannes Berg 
3478d3236553SJohannes Berg /**
3479d3236553SJohannes Berg  * freq_reg_info - get regulatory information for the given frequency
3480d3236553SJohannes Berg  * @wiphy: the wiphy for which we want to process this rule for
3481d3236553SJohannes Berg  * @center_freq: Frequency in KHz for which we want regulatory information for
3482d3236553SJohannes Berg  *
3483d3236553SJohannes Berg  * Use this function to get the regulatory rule for a specific frequency on
3484d3236553SJohannes Berg  * a given wireless device. If the device has a specific regulatory domain
3485d3236553SJohannes Berg  * it wants to follow we respect that unless a country IE has been received
3486d3236553SJohannes Berg  * and processed already.
3487d3236553SJohannes Berg  *
34880ae997dcSYacine Belkadi  * Return: A valid pointer, or, when an error occurs, for example if no rule
34890ae997dcSYacine Belkadi  * can be found, the return value is encoded using ERR_PTR(). Use IS_ERR() to
34900ae997dcSYacine Belkadi  * check and PTR_ERR() to obtain the numeric return value. The numeric return
34910ae997dcSYacine Belkadi  * value will be -ERANGE if we determine the given center_freq does not even
34920ae997dcSYacine Belkadi  * have a regulatory rule for a frequency range in the center_freq's band.
34930ae997dcSYacine Belkadi  * See freq_in_rule_band() for our current definition of a band -- this is
34940ae997dcSYacine Belkadi  * purely subjective and right now it's 802.11 specific.
3495d3236553SJohannes Berg  */
3496361c9c8bSJohannes Berg const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy,
3497361c9c8bSJohannes Berg 					       u32 center_freq);
3498d3236553SJohannes Berg 
3499034c6d6eSLuis R. Rodriguez /**
3500034c6d6eSLuis R. Rodriguez  * reg_initiator_name - map regulatory request initiator enum to name
3501034c6d6eSLuis R. Rodriguez  * @initiator: the regulatory request initiator
3502034c6d6eSLuis R. Rodriguez  *
3503034c6d6eSLuis R. Rodriguez  * You can use this to map the regulatory request initiator enum to a
3504034c6d6eSLuis R. Rodriguez  * proper string representation.
3505034c6d6eSLuis R. Rodriguez  */
3506034c6d6eSLuis R. Rodriguez const char *reg_initiator_name(enum nl80211_reg_initiator initiator);
3507034c6d6eSLuis R. Rodriguez 
3508d3236553SJohannes Berg /*
3509d3236553SJohannes Berg  * callbacks for asynchronous cfg80211 methods, notification
3510d3236553SJohannes Berg  * functions and BSS handling helpers
3511d3236553SJohannes Berg  */
3512d3236553SJohannes Berg 
35132a519311SJohannes Berg /**
35142a519311SJohannes Berg  * cfg80211_scan_done - notify that scan finished
35152a519311SJohannes Berg  *
35162a519311SJohannes Berg  * @request: the corresponding scan request
35172a519311SJohannes Berg  * @aborted: set to true if the scan was aborted for any reason,
35182a519311SJohannes Berg  *	userspace will be notified of that
35192a519311SJohannes Berg  */
35202a519311SJohannes Berg void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted);
35212a519311SJohannes Berg 
35222a519311SJohannes Berg /**
3523807f8a8cSLuciano Coelho  * cfg80211_sched_scan_results - notify that new scan results are available
3524807f8a8cSLuciano Coelho  *
3525807f8a8cSLuciano Coelho  * @wiphy: the wiphy which got scheduled scan results
3526807f8a8cSLuciano Coelho  */
3527807f8a8cSLuciano Coelho void cfg80211_sched_scan_results(struct wiphy *wiphy);
3528807f8a8cSLuciano Coelho 
3529807f8a8cSLuciano Coelho /**
3530807f8a8cSLuciano Coelho  * cfg80211_sched_scan_stopped - notify that the scheduled scan has stopped
3531807f8a8cSLuciano Coelho  *
3532807f8a8cSLuciano Coelho  * @wiphy: the wiphy on which the scheduled scan stopped
3533807f8a8cSLuciano Coelho  *
3534807f8a8cSLuciano Coelho  * The driver can call this function to inform cfg80211 that the
3535807f8a8cSLuciano Coelho  * scheduled scan had to be stopped, for whatever reason.  The driver
3536807f8a8cSLuciano Coelho  * is then called back via the sched_scan_stop operation when done.
3537807f8a8cSLuciano Coelho  */
3538807f8a8cSLuciano Coelho void cfg80211_sched_scan_stopped(struct wiphy *wiphy);
3539807f8a8cSLuciano Coelho 
3540807f8a8cSLuciano Coelho /**
3541dcd6eac1SSimon Wunderlich  * cfg80211_inform_bss_width_frame - inform cfg80211 of a received BSS frame
35422a519311SJohannes Berg  *
35432a519311SJohannes Berg  * @wiphy: the wiphy reporting the BSS
3544abe37c4bSJohannes Berg  * @channel: The channel the frame was received on
3545dcd6eac1SSimon Wunderlich  * @scan_width: width of the control channel
3546abe37c4bSJohannes Berg  * @mgmt: the management frame (probe response or beacon)
3547abe37c4bSJohannes Berg  * @len: length of the management frame
354877965c97SJohannes Berg  * @signal: the signal strength, type depends on the wiphy's signal_type
35492a519311SJohannes Berg  * @gfp: context flags
35502a519311SJohannes Berg  *
35512a519311SJohannes Berg  * This informs cfg80211 that BSS information was found and
35522a519311SJohannes Berg  * the BSS should be updated/added.
3553ef100682SJohannes Berg  *
35540ae997dcSYacine Belkadi  * Return: A referenced struct, must be released with cfg80211_put_bss()!
35550ae997dcSYacine Belkadi  * Or %NULL on error.
35562a519311SJohannes Berg  */
3557ef100682SJohannes Berg struct cfg80211_bss * __must_check
3558dcd6eac1SSimon Wunderlich cfg80211_inform_bss_width_frame(struct wiphy *wiphy,
3559dcd6eac1SSimon Wunderlich 				struct ieee80211_channel *channel,
3560dcd6eac1SSimon Wunderlich 				enum nl80211_bss_scan_width scan_width,
3561dcd6eac1SSimon Wunderlich 				struct ieee80211_mgmt *mgmt, size_t len,
3562dcd6eac1SSimon Wunderlich 				s32 signal, gfp_t gfp);
3563dcd6eac1SSimon Wunderlich 
3564dcd6eac1SSimon Wunderlich static inline struct cfg80211_bss * __must_check
35652a519311SJohannes Berg cfg80211_inform_bss_frame(struct wiphy *wiphy,
35662a519311SJohannes Berg 			  struct ieee80211_channel *channel,
35672a519311SJohannes Berg 			  struct ieee80211_mgmt *mgmt, size_t len,
3568dcd6eac1SSimon Wunderlich 			  s32 signal, gfp_t gfp)
3569dcd6eac1SSimon Wunderlich {
3570dcd6eac1SSimon Wunderlich 	return cfg80211_inform_bss_width_frame(wiphy, channel,
3571dcd6eac1SSimon Wunderlich 					       NL80211_BSS_CHAN_WIDTH_20,
3572dcd6eac1SSimon Wunderlich 					       mgmt, len, signal, gfp);
3573dcd6eac1SSimon Wunderlich }
35742a519311SJohannes Berg 
3575abe37c4bSJohannes Berg /**
3576abe37c4bSJohannes Berg  * cfg80211_inform_bss - inform cfg80211 of a new BSS
3577abe37c4bSJohannes Berg  *
3578abe37c4bSJohannes Berg  * @wiphy: the wiphy reporting the BSS
3579abe37c4bSJohannes Berg  * @channel: The channel the frame was received on
3580dcd6eac1SSimon Wunderlich  * @scan_width: width of the control channel
3581abe37c4bSJohannes Berg  * @bssid: the BSSID of the BSS
35827b8bcff2SJohannes Berg  * @tsf: the TSF sent by the peer in the beacon/probe response (or 0)
3583abe37c4bSJohannes Berg  * @capability: the capability field sent by the peer
3584abe37c4bSJohannes Berg  * @beacon_interval: the beacon interval announced by the peer
3585abe37c4bSJohannes Berg  * @ie: additional IEs sent by the peer
3586abe37c4bSJohannes Berg  * @ielen: length of the additional IEs
3587abe37c4bSJohannes Berg  * @signal: the signal strength, type depends on the wiphy's signal_type
3588abe37c4bSJohannes Berg  * @gfp: context flags
3589abe37c4bSJohannes Berg  *
3590abe37c4bSJohannes Berg  * This informs cfg80211 that BSS information was found and
3591abe37c4bSJohannes Berg  * the BSS should be updated/added.
3592ef100682SJohannes Berg  *
35930ae997dcSYacine Belkadi  * Return: A referenced struct, must be released with cfg80211_put_bss()!
35940ae997dcSYacine Belkadi  * Or %NULL on error.
3595abe37c4bSJohannes Berg  */
3596ef100682SJohannes Berg struct cfg80211_bss * __must_check
3597dcd6eac1SSimon Wunderlich cfg80211_inform_bss_width(struct wiphy *wiphy,
3598dcd6eac1SSimon Wunderlich 			  struct ieee80211_channel *channel,
3599dcd6eac1SSimon Wunderlich 			  enum nl80211_bss_scan_width scan_width,
3600dcd6eac1SSimon Wunderlich 			  const u8 *bssid, u64 tsf, u16 capability,
3601dcd6eac1SSimon Wunderlich 			  u16 beacon_interval, const u8 *ie, size_t ielen,
3602dcd6eac1SSimon Wunderlich 			  s32 signal, gfp_t gfp);
3603dcd6eac1SSimon Wunderlich 
3604dcd6eac1SSimon Wunderlich static inline struct cfg80211_bss * __must_check
360506aa7afaSJussi Kivilinna cfg80211_inform_bss(struct wiphy *wiphy,
360606aa7afaSJussi Kivilinna 		    struct ieee80211_channel *channel,
36077b8bcff2SJohannes Berg 		    const u8 *bssid, u64 tsf, u16 capability,
36087b8bcff2SJohannes Berg 		    u16 beacon_interval, const u8 *ie, size_t ielen,
3609dcd6eac1SSimon Wunderlich 		    s32 signal, gfp_t gfp)
3610dcd6eac1SSimon Wunderlich {
3611dcd6eac1SSimon Wunderlich 	return cfg80211_inform_bss_width(wiphy, channel,
3612dcd6eac1SSimon Wunderlich 					 NL80211_BSS_CHAN_WIDTH_20,
3613dcd6eac1SSimon Wunderlich 					 bssid, tsf, capability,
3614dcd6eac1SSimon Wunderlich 					 beacon_interval, ie, ielen, signal,
3615dcd6eac1SSimon Wunderlich 					 gfp);
3616dcd6eac1SSimon Wunderlich }
361706aa7afaSJussi Kivilinna 
36182a519311SJohannes Berg struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
36192a519311SJohannes Berg 				      struct ieee80211_channel *channel,
36202a519311SJohannes Berg 				      const u8 *bssid,
362179420f09SJohannes Berg 				      const u8 *ssid, size_t ssid_len,
362279420f09SJohannes Berg 				      u16 capa_mask, u16 capa_val);
362379420f09SJohannes Berg static inline struct cfg80211_bss *
362479420f09SJohannes Berg cfg80211_get_ibss(struct wiphy *wiphy,
362579420f09SJohannes Berg 		  struct ieee80211_channel *channel,
362679420f09SJohannes Berg 		  const u8 *ssid, size_t ssid_len)
362779420f09SJohannes Berg {
362879420f09SJohannes Berg 	return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len,
362979420f09SJohannes Berg 				WLAN_CAPABILITY_IBSS, WLAN_CAPABILITY_IBSS);
363079420f09SJohannes Berg }
363179420f09SJohannes Berg 
36324c0c0b75SJohannes Berg /**
36334c0c0b75SJohannes Berg  * cfg80211_ref_bss - reference BSS struct
36345b112d3dSJohannes Berg  * @wiphy: the wiphy this BSS struct belongs to
36354c0c0b75SJohannes Berg  * @bss: the BSS struct to reference
36364c0c0b75SJohannes Berg  *
36374c0c0b75SJohannes Berg  * Increments the refcount of the given BSS struct.
36384c0c0b75SJohannes Berg  */
36395b112d3dSJohannes Berg void cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
36404c0c0b75SJohannes Berg 
36414c0c0b75SJohannes Berg /**
36424c0c0b75SJohannes Berg  * cfg80211_put_bss - unref BSS struct
36435b112d3dSJohannes Berg  * @wiphy: the wiphy this BSS struct belongs to
36444c0c0b75SJohannes Berg  * @bss: the BSS struct
36454c0c0b75SJohannes Berg  *
36464c0c0b75SJohannes Berg  * Decrements the refcount of the given BSS struct.
36474c0c0b75SJohannes Berg  */
36485b112d3dSJohannes Berg void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
3649d3236553SJohannes Berg 
3650d491af19SJohannes Berg /**
3651d491af19SJohannes Berg  * cfg80211_unlink_bss - unlink BSS from internal data structures
3652d491af19SJohannes Berg  * @wiphy: the wiphy
3653d491af19SJohannes Berg  * @bss: the bss to remove
3654d491af19SJohannes Berg  *
3655d491af19SJohannes Berg  * This function removes the given BSS from the internal data structures
3656d491af19SJohannes Berg  * thereby making it no longer show up in scan results etc. Use this
3657d491af19SJohannes Berg  * function when you detect a BSS is gone. Normally BSSes will also time
3658d491af19SJohannes Berg  * out, so it is not necessary to use this function at all.
3659d491af19SJohannes Berg  */
3660d491af19SJohannes Berg void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
3661fee52678SJohannes Berg 
3662dcd6eac1SSimon Wunderlich static inline enum nl80211_bss_scan_width
3663dcd6eac1SSimon Wunderlich cfg80211_chandef_to_scan_width(const struct cfg80211_chan_def *chandef)
3664dcd6eac1SSimon Wunderlich {
3665dcd6eac1SSimon Wunderlich 	switch (chandef->width) {
3666dcd6eac1SSimon Wunderlich 	case NL80211_CHAN_WIDTH_5:
3667dcd6eac1SSimon Wunderlich 		return NL80211_BSS_CHAN_WIDTH_5;
3668dcd6eac1SSimon Wunderlich 	case NL80211_CHAN_WIDTH_10:
3669dcd6eac1SSimon Wunderlich 		return NL80211_BSS_CHAN_WIDTH_10;
3670dcd6eac1SSimon Wunderlich 	default:
3671dcd6eac1SSimon Wunderlich 		return NL80211_BSS_CHAN_WIDTH_20;
3672dcd6eac1SSimon Wunderlich 	}
3673dcd6eac1SSimon Wunderlich }
3674dcd6eac1SSimon Wunderlich 
36756039f6d2SJouni Malinen /**
36766ff57cf8SJohannes Berg  * cfg80211_rx_mlme_mgmt - notification of processed MLME management frame
36776039f6d2SJouni Malinen  * @dev: network device
36786039f6d2SJouni Malinen  * @buf: authentication frame (header + body)
36796039f6d2SJouni Malinen  * @len: length of the frame data
36806039f6d2SJouni Malinen  *
36816ff57cf8SJohannes Berg  * This function is called whenever an authentication, disassociation or
36826ff57cf8SJohannes Berg  * deauthentication frame has been received and processed in station mode.
36836ff57cf8SJohannes Berg  * After being asked to authenticate via cfg80211_ops::auth() the driver must
36846ff57cf8SJohannes Berg  * call either this function or cfg80211_auth_timeout().
36856ff57cf8SJohannes Berg  * After being asked to associate via cfg80211_ops::assoc() the driver must
36866ff57cf8SJohannes Berg  * call either this function or cfg80211_auth_timeout().
36876ff57cf8SJohannes Berg  * While connected, the driver must calls this for received and processed
36886ff57cf8SJohannes Berg  * disassociation and deauthentication frames. If the frame couldn't be used
36896ff57cf8SJohannes Berg  * because it was unprotected, the driver must call the function
36906ff57cf8SJohannes Berg  * cfg80211_rx_unprot_mlme_mgmt() instead.
36916ff57cf8SJohannes Berg  *
36926ff57cf8SJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's mutex.
36936039f6d2SJouni Malinen  */
36946ff57cf8SJohannes Berg void cfg80211_rx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len);
36956039f6d2SJouni Malinen 
36966039f6d2SJouni Malinen /**
36976ff57cf8SJohannes Berg  * cfg80211_auth_timeout - notification of timed out authentication
36981965c853SJouni Malinen  * @dev: network device
36991965c853SJouni Malinen  * @addr: The MAC address of the device with which the authentication timed out
3700cb0b4bebSJohannes Berg  *
37018d61ffa5SJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's
37028d61ffa5SJohannes Berg  * mutex.
37031965c853SJouni Malinen  */
37046ff57cf8SJohannes Berg void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr);
37051965c853SJouni Malinen 
37061965c853SJouni Malinen /**
37076ff57cf8SJohannes Berg  * cfg80211_rx_assoc_resp - notification of processed association response
37086039f6d2SJouni Malinen  * @dev: network device
37096ff57cf8SJohannes Berg  * @bss: the BSS that association was requested with, ownership of the pointer
37106ff57cf8SJohannes Berg  *	moves to cfg80211 in this call
37116ff57cf8SJohannes Berg  * @buf: authentication frame (header + body)
37126039f6d2SJouni Malinen  * @len: length of the frame data
37136039f6d2SJouni Malinen  *
37146ff57cf8SJohannes Berg  * After being asked to associate via cfg80211_ops::assoc() the driver must
37156ff57cf8SJohannes Berg  * call either this function or cfg80211_auth_timeout().
37166ff57cf8SJohannes Berg  *
37176ff57cf8SJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's mutex.
37186039f6d2SJouni Malinen  */
37196ff57cf8SJohannes Berg void cfg80211_rx_assoc_resp(struct net_device *dev,
37206ff57cf8SJohannes Berg 			    struct cfg80211_bss *bss,
372195de817bSJohannes Berg 			    const u8 *buf, size_t len);
37226039f6d2SJouni Malinen 
37236039f6d2SJouni Malinen /**
37246ff57cf8SJohannes Berg  * cfg80211_assoc_timeout - notification of timed out association
37251965c853SJouni Malinen  * @dev: network device
3726959867faSJohannes Berg  * @bss: The BSS entry with which association timed out.
3727cb0b4bebSJohannes Berg  *
37288d61ffa5SJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's mutex.
37291965c853SJouni Malinen  */
3730959867faSJohannes Berg void cfg80211_assoc_timeout(struct net_device *dev, struct cfg80211_bss *bss);
37311965c853SJouni Malinen 
37321965c853SJouni Malinen /**
37336ff57cf8SJohannes Berg  * cfg80211_tx_mlme_mgmt - notification of transmitted deauth/disassoc frame
37346039f6d2SJouni Malinen  * @dev: network device
37356ff57cf8SJohannes Berg  * @buf: 802.11 frame (header + body)
37366039f6d2SJouni Malinen  * @len: length of the frame data
37376039f6d2SJouni Malinen  *
37386039f6d2SJouni Malinen  * This function is called whenever deauthentication has been processed in
373953b46b84SJouni Malinen  * station mode. This includes both received deauthentication frames and
37408d61ffa5SJohannes Berg  * locally generated ones. This function may sleep. The caller must hold the
37418d61ffa5SJohannes Berg  * corresponding wdev's mutex.
37426039f6d2SJouni Malinen  */
37436ff57cf8SJohannes Berg void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len);
3744ce470613SHolger Schurig 
3745ce470613SHolger Schurig /**
37466ff57cf8SJohannes Berg  * cfg80211_rx_unprot_mlme_mgmt - notification of unprotected mlme mgmt frame
3747cf4e594eSJouni Malinen  * @dev: network device
3748cf4e594eSJouni Malinen  * @buf: deauthentication frame (header + body)
3749cf4e594eSJouni Malinen  * @len: length of the frame data
3750cf4e594eSJouni Malinen  *
37516ff57cf8SJohannes Berg  * This function is called whenever a received deauthentication or dissassoc
37526ff57cf8SJohannes Berg  * frame has been dropped in station mode because of MFP being used but the
3753cf4e594eSJouni Malinen  * frame was not protected. This function may sleep.
3754cf4e594eSJouni Malinen  */
37556ff57cf8SJohannes Berg void cfg80211_rx_unprot_mlme_mgmt(struct net_device *dev,
37566ff57cf8SJohannes Berg 				  const u8 *buf, size_t len);
3757cf4e594eSJouni Malinen 
3758cf4e594eSJouni Malinen /**
3759a3b8b056SJouni Malinen  * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP)
3760a3b8b056SJouni Malinen  * @dev: network device
3761a3b8b056SJouni Malinen  * @addr: The source MAC address of the frame
3762a3b8b056SJouni Malinen  * @key_type: The key type that the received frame used
3763a66b98dbSArik Nemtsov  * @key_id: Key identifier (0..3). Can be -1 if missing.
3764a3b8b056SJouni Malinen  * @tsc: The TSC value of the frame that generated the MIC failure (6 octets)
3765e6d6e342SJohannes Berg  * @gfp: allocation flags
3766a3b8b056SJouni Malinen  *
3767a3b8b056SJouni Malinen  * This function is called whenever the local MAC detects a MIC failure in a
3768a3b8b056SJouni Malinen  * received frame. This matches with MLME-MICHAELMICFAILURE.indication()
3769a3b8b056SJouni Malinen  * primitive.
3770a3b8b056SJouni Malinen  */
3771a3b8b056SJouni Malinen void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,
3772a3b8b056SJouni Malinen 				  enum nl80211_key_type key_type, int key_id,
3773e6d6e342SJohannes Berg 				  const u8 *tsc, gfp_t gfp);
3774a3b8b056SJouni Malinen 
377504a773adSJohannes Berg /**
377604a773adSJohannes Berg  * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS
377704a773adSJohannes Berg  *
377804a773adSJohannes Berg  * @dev: network device
377904a773adSJohannes Berg  * @bssid: the BSSID of the IBSS joined
378004a773adSJohannes Berg  * @gfp: allocation flags
378104a773adSJohannes Berg  *
378204a773adSJohannes Berg  * This function notifies cfg80211 that the device joined an IBSS or
378304a773adSJohannes Berg  * switched to a different BSSID. Before this function can be called,
378404a773adSJohannes Berg  * either a beacon has to have been received from the IBSS, or one of
378504a773adSJohannes Berg  * the cfg80211_inform_bss{,_frame} functions must have been called
378604a773adSJohannes Berg  * with the locally generated beacon -- this guarantees that there is
378704a773adSJohannes Berg  * always a scan result for this IBSS. cfg80211 will handle the rest.
378804a773adSJohannes Berg  */
378904a773adSJohannes Berg void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, gfp_t gfp);
379004a773adSJohannes Berg 
37911f87f7d3SJohannes Berg /**
3792c93b5e71SJavier Cardona  * cfg80211_notify_new_candidate - notify cfg80211 of a new mesh peer candidate
3793c93b5e71SJavier Cardona  *
3794c93b5e71SJavier Cardona  * @dev: network device
3795c93b5e71SJavier Cardona  * @macaddr: the MAC address of the new candidate
3796c93b5e71SJavier Cardona  * @ie: information elements advertised by the peer candidate
3797c93b5e71SJavier Cardona  * @ie_len: lenght of the information elements buffer
3798c93b5e71SJavier Cardona  * @gfp: allocation flags
3799c93b5e71SJavier Cardona  *
3800c93b5e71SJavier Cardona  * This function notifies cfg80211 that the mesh peer candidate has been
3801c93b5e71SJavier Cardona  * detected, most likely via a beacon or, less likely, via a probe response.
3802c93b5e71SJavier Cardona  * cfg80211 then sends a notification to userspace.
3803c93b5e71SJavier Cardona  */
3804c93b5e71SJavier Cardona void cfg80211_notify_new_peer_candidate(struct net_device *dev,
3805c93b5e71SJavier Cardona 		const u8 *macaddr, const u8 *ie, u8 ie_len, gfp_t gfp);
3806c93b5e71SJavier Cardona 
3807c93b5e71SJavier Cardona /**
3808d70e9693SJohannes Berg  * DOC: RFkill integration
3809d70e9693SJohannes Berg  *
3810d70e9693SJohannes Berg  * RFkill integration in cfg80211 is almost invisible to drivers,
3811d70e9693SJohannes Berg  * as cfg80211 automatically registers an rfkill instance for each
3812d70e9693SJohannes Berg  * wireless device it knows about. Soft kill is also translated
3813d70e9693SJohannes Berg  * into disconnecting and turning all interfaces off, drivers are
3814d70e9693SJohannes Berg  * expected to turn off the device when all interfaces are down.
3815d70e9693SJohannes Berg  *
3816d70e9693SJohannes Berg  * However, devices may have a hard RFkill line, in which case they
3817d70e9693SJohannes Berg  * also need to interact with the rfkill subsystem, via cfg80211.
3818d70e9693SJohannes Berg  * They can do this with a few helper functions documented here.
3819d70e9693SJohannes Berg  */
3820d70e9693SJohannes Berg 
3821d70e9693SJohannes Berg /**
38221f87f7d3SJohannes Berg  * wiphy_rfkill_set_hw_state - notify cfg80211 about hw block state
38231f87f7d3SJohannes Berg  * @wiphy: the wiphy
38241f87f7d3SJohannes Berg  * @blocked: block status
38251f87f7d3SJohannes Berg  */
38261f87f7d3SJohannes Berg void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked);
38271f87f7d3SJohannes Berg 
38281f87f7d3SJohannes Berg /**
38291f87f7d3SJohannes Berg  * wiphy_rfkill_start_polling - start polling rfkill
38301f87f7d3SJohannes Berg  * @wiphy: the wiphy
38311f87f7d3SJohannes Berg  */
38321f87f7d3SJohannes Berg void wiphy_rfkill_start_polling(struct wiphy *wiphy);
38331f87f7d3SJohannes Berg 
38341f87f7d3SJohannes Berg /**
38351f87f7d3SJohannes Berg  * wiphy_rfkill_stop_polling - stop polling rfkill
38361f87f7d3SJohannes Berg  * @wiphy: the wiphy
38371f87f7d3SJohannes Berg  */
38381f87f7d3SJohannes Berg void wiphy_rfkill_stop_polling(struct wiphy *wiphy);
38391f87f7d3SJohannes Berg 
3840aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE
3841aff89a9bSJohannes Berg /**
3842d70e9693SJohannes Berg  * DOC: Test mode
3843d70e9693SJohannes Berg  *
3844d70e9693SJohannes Berg  * Test mode is a set of utility functions to allow drivers to
3845d70e9693SJohannes Berg  * interact with driver-specific tools to aid, for instance,
3846d70e9693SJohannes Berg  * factory programming.
3847d70e9693SJohannes Berg  *
3848d70e9693SJohannes Berg  * This chapter describes how drivers interact with it, for more
3849d70e9693SJohannes Berg  * information see the nl80211 book's chapter on it.
3850d70e9693SJohannes Berg  */
3851d70e9693SJohannes Berg 
3852d70e9693SJohannes Berg /**
3853aff89a9bSJohannes Berg  * cfg80211_testmode_alloc_reply_skb - allocate testmode reply
3854aff89a9bSJohannes Berg  * @wiphy: the wiphy
3855aff89a9bSJohannes Berg  * @approxlen: an upper bound of the length of the data that will
3856aff89a9bSJohannes Berg  *	be put into the skb
3857aff89a9bSJohannes Berg  *
3858aff89a9bSJohannes Berg  * This function allocates and pre-fills an skb for a reply to
3859aff89a9bSJohannes Berg  * the testmode command. Since it is intended for a reply, calling
3860aff89a9bSJohannes Berg  * it outside of the @testmode_cmd operation is invalid.
3861aff89a9bSJohannes Berg  *
38620ae997dcSYacine Belkadi  * The returned skb is pre-filled with the wiphy index and set up in
38630ae997dcSYacine Belkadi  * a way that any data that is put into the skb (with skb_put(),
38640ae997dcSYacine Belkadi  * nla_put() or similar) will end up being within the
38650ae997dcSYacine Belkadi  * %NL80211_ATTR_TESTDATA attribute, so all that needs to be done
38660ae997dcSYacine Belkadi  * with the skb is adding data for the corresponding userspace tool
38670ae997dcSYacine Belkadi  * which can then read that data out of the testdata attribute. You
38680ae997dcSYacine Belkadi  * must not modify the skb in any other way.
3869aff89a9bSJohannes Berg  *
3870aff89a9bSJohannes Berg  * When done, call cfg80211_testmode_reply() with the skb and return
3871aff89a9bSJohannes Berg  * its error code as the result of the @testmode_cmd operation.
38720ae997dcSYacine Belkadi  *
38730ae997dcSYacine Belkadi  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
3874aff89a9bSJohannes Berg  */
3875aff89a9bSJohannes Berg struct sk_buff *cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy,
3876aff89a9bSJohannes Berg 						  int approxlen);
3877aff89a9bSJohannes Berg 
3878aff89a9bSJohannes Berg /**
3879aff89a9bSJohannes Berg  * cfg80211_testmode_reply - send the reply skb
3880aff89a9bSJohannes Berg  * @skb: The skb, must have been allocated with
3881aff89a9bSJohannes Berg  *	cfg80211_testmode_alloc_reply_skb()
3882aff89a9bSJohannes Berg  *
38830ae997dcSYacine Belkadi  * Since calling this function will usually be the last thing
38840ae997dcSYacine Belkadi  * before returning from the @testmode_cmd you should return
38850ae997dcSYacine Belkadi  * the error code.  Note that this function consumes the skb
38860ae997dcSYacine Belkadi  * regardless of the return value.
38870ae997dcSYacine Belkadi  *
38880ae997dcSYacine Belkadi  * Return: An error code or 0 on success.
3889aff89a9bSJohannes Berg  */
3890aff89a9bSJohannes Berg int cfg80211_testmode_reply(struct sk_buff *skb);
3891aff89a9bSJohannes Berg 
3892aff89a9bSJohannes Berg /**
3893aff89a9bSJohannes Berg  * cfg80211_testmode_alloc_event_skb - allocate testmode event
3894aff89a9bSJohannes Berg  * @wiphy: the wiphy
3895aff89a9bSJohannes Berg  * @approxlen: an upper bound of the length of the data that will
3896aff89a9bSJohannes Berg  *	be put into the skb
3897aff89a9bSJohannes Berg  * @gfp: allocation flags
3898aff89a9bSJohannes Berg  *
3899aff89a9bSJohannes Berg  * This function allocates and pre-fills an skb for an event on the
3900aff89a9bSJohannes Berg  * testmode multicast group.
3901aff89a9bSJohannes Berg  *
39020ae997dcSYacine Belkadi  * The returned skb is set up in the same way as with
39030ae997dcSYacine Belkadi  * cfg80211_testmode_alloc_reply_skb() but prepared for an event. As
39040ae997dcSYacine Belkadi  * there, you should simply add data to it that will then end up in the
39050ae997dcSYacine Belkadi  * %NL80211_ATTR_TESTDATA attribute. Again, you must not modify the skb
39060ae997dcSYacine Belkadi  * in any other way.
3907aff89a9bSJohannes Berg  *
3908aff89a9bSJohannes Berg  * When done filling the skb, call cfg80211_testmode_event() with the
3909aff89a9bSJohannes Berg  * skb to send the event.
39100ae997dcSYacine Belkadi  *
39110ae997dcSYacine Belkadi  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
3912aff89a9bSJohannes Berg  */
3913aff89a9bSJohannes Berg struct sk_buff *cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy,
3914aff89a9bSJohannes Berg 						  int approxlen, gfp_t gfp);
3915aff89a9bSJohannes Berg 
3916aff89a9bSJohannes Berg /**
3917aff89a9bSJohannes Berg  * cfg80211_testmode_event - send the event
3918aff89a9bSJohannes Berg  * @skb: The skb, must have been allocated with
3919aff89a9bSJohannes Berg  *	cfg80211_testmode_alloc_event_skb()
3920aff89a9bSJohannes Berg  * @gfp: allocation flags
3921aff89a9bSJohannes Berg  *
3922aff89a9bSJohannes Berg  * This function sends the given @skb, which must have been allocated
3923aff89a9bSJohannes Berg  * by cfg80211_testmode_alloc_event_skb(), as an event. It always
3924aff89a9bSJohannes Berg  * consumes it.
3925aff89a9bSJohannes Berg  */
3926aff89a9bSJohannes Berg void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp);
3927aff89a9bSJohannes Berg 
3928aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd)	.testmode_cmd = (cmd),
392971063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd)	.testmode_dump = (cmd),
3930aff89a9bSJohannes Berg #else
3931aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd)
393271063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd)
3933aff89a9bSJohannes Berg #endif
3934aff89a9bSJohannes Berg 
3935b23aa676SSamuel Ortiz /**
3936b23aa676SSamuel Ortiz  * cfg80211_connect_result - notify cfg80211 of connection result
3937b23aa676SSamuel Ortiz  *
3938b23aa676SSamuel Ortiz  * @dev: network device
3939b23aa676SSamuel Ortiz  * @bssid: the BSSID of the AP
3940b23aa676SSamuel Ortiz  * @req_ie: association request IEs (maybe be %NULL)
3941b23aa676SSamuel Ortiz  * @req_ie_len: association request IEs length
3942b23aa676SSamuel Ortiz  * @resp_ie: association response IEs (may be %NULL)
3943b23aa676SSamuel Ortiz  * @resp_ie_len: assoc response IEs length
3944b23aa676SSamuel Ortiz  * @status: status code, 0 for successful connection, use
3945b23aa676SSamuel Ortiz  *	%WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
3946b23aa676SSamuel Ortiz  *	the real status code for failures.
3947b23aa676SSamuel Ortiz  * @gfp: allocation flags
3948b23aa676SSamuel Ortiz  *
3949b23aa676SSamuel Ortiz  * It should be called by the underlying driver whenever connect() has
3950b23aa676SSamuel Ortiz  * succeeded.
3951b23aa676SSamuel Ortiz  */
3952b23aa676SSamuel Ortiz void cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
3953b23aa676SSamuel Ortiz 			     const u8 *req_ie, size_t req_ie_len,
3954b23aa676SSamuel Ortiz 			     const u8 *resp_ie, size_t resp_ie_len,
3955b23aa676SSamuel Ortiz 			     u16 status, gfp_t gfp);
3956b23aa676SSamuel Ortiz 
3957b23aa676SSamuel Ortiz /**
3958b23aa676SSamuel Ortiz  * cfg80211_roamed - notify cfg80211 of roaming
3959b23aa676SSamuel Ortiz  *
3960b23aa676SSamuel Ortiz  * @dev: network device
3961ed9d0102SJouni Malinen  * @channel: the channel of the new AP
3962b23aa676SSamuel Ortiz  * @bssid: the BSSID of the new AP
3963b23aa676SSamuel Ortiz  * @req_ie: association request IEs (maybe be %NULL)
3964b23aa676SSamuel Ortiz  * @req_ie_len: association request IEs length
3965b23aa676SSamuel Ortiz  * @resp_ie: association response IEs (may be %NULL)
3966b23aa676SSamuel Ortiz  * @resp_ie_len: assoc response IEs length
3967b23aa676SSamuel Ortiz  * @gfp: allocation flags
3968b23aa676SSamuel Ortiz  *
3969b23aa676SSamuel Ortiz  * It should be called by the underlying driver whenever it roamed
3970b23aa676SSamuel Ortiz  * from one AP to another while connected.
3971b23aa676SSamuel Ortiz  */
3972ed9d0102SJouni Malinen void cfg80211_roamed(struct net_device *dev,
3973ed9d0102SJouni Malinen 		     struct ieee80211_channel *channel,
3974ed9d0102SJouni Malinen 		     const u8 *bssid,
3975b23aa676SSamuel Ortiz 		     const u8 *req_ie, size_t req_ie_len,
3976b23aa676SSamuel Ortiz 		     const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp);
3977b23aa676SSamuel Ortiz 
3978b23aa676SSamuel Ortiz /**
3979adbde344SVasanthakumar Thiagarajan  * cfg80211_roamed_bss - notify cfg80211 of roaming
3980adbde344SVasanthakumar Thiagarajan  *
3981adbde344SVasanthakumar Thiagarajan  * @dev: network device
3982adbde344SVasanthakumar Thiagarajan  * @bss: entry of bss to which STA got roamed
3983adbde344SVasanthakumar Thiagarajan  * @req_ie: association request IEs (maybe be %NULL)
3984adbde344SVasanthakumar Thiagarajan  * @req_ie_len: association request IEs length
3985adbde344SVasanthakumar Thiagarajan  * @resp_ie: association response IEs (may be %NULL)
3986adbde344SVasanthakumar Thiagarajan  * @resp_ie_len: assoc response IEs length
3987adbde344SVasanthakumar Thiagarajan  * @gfp: allocation flags
3988adbde344SVasanthakumar Thiagarajan  *
3989adbde344SVasanthakumar Thiagarajan  * This is just a wrapper to notify cfg80211 of roaming event with driver
3990adbde344SVasanthakumar Thiagarajan  * passing bss to avoid a race in timeout of the bss entry. It should be
3991adbde344SVasanthakumar Thiagarajan  * called by the underlying driver whenever it roamed from one AP to another
3992adbde344SVasanthakumar Thiagarajan  * while connected. Drivers which have roaming implemented in firmware
3993adbde344SVasanthakumar Thiagarajan  * may use this function to avoid a race in bss entry timeout where the bss
3994adbde344SVasanthakumar Thiagarajan  * entry of the new AP is seen in the driver, but gets timed out by the time
3995adbde344SVasanthakumar Thiagarajan  * it is accessed in __cfg80211_roamed() due to delay in scheduling
3996adbde344SVasanthakumar Thiagarajan  * rdev->event_work. In case of any failures, the reference is released
3997adbde344SVasanthakumar Thiagarajan  * either in cfg80211_roamed_bss() or in __cfg80211_romed(), Otherwise,
3998adbde344SVasanthakumar Thiagarajan  * it will be released while diconneting from the current bss.
3999adbde344SVasanthakumar Thiagarajan  */
4000adbde344SVasanthakumar Thiagarajan void cfg80211_roamed_bss(struct net_device *dev, struct cfg80211_bss *bss,
4001adbde344SVasanthakumar Thiagarajan 			 const u8 *req_ie, size_t req_ie_len,
4002adbde344SVasanthakumar Thiagarajan 			 const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp);
4003adbde344SVasanthakumar Thiagarajan 
4004adbde344SVasanthakumar Thiagarajan /**
4005b23aa676SSamuel Ortiz  * cfg80211_disconnected - notify cfg80211 that connection was dropped
4006b23aa676SSamuel Ortiz  *
4007b23aa676SSamuel Ortiz  * @dev: network device
4008b23aa676SSamuel Ortiz  * @ie: information elements of the deauth/disassoc frame (may be %NULL)
4009b23aa676SSamuel Ortiz  * @ie_len: length of IEs
4010b23aa676SSamuel Ortiz  * @reason: reason code for the disconnection, set it to 0 if unknown
4011b23aa676SSamuel Ortiz  * @gfp: allocation flags
4012b23aa676SSamuel Ortiz  *
4013b23aa676SSamuel Ortiz  * After it calls this function, the driver should enter an idle state
4014b23aa676SSamuel Ortiz  * and not try to connect to any AP any more.
4015b23aa676SSamuel Ortiz  */
4016b23aa676SSamuel Ortiz void cfg80211_disconnected(struct net_device *dev, u16 reason,
4017b23aa676SSamuel Ortiz 			   u8 *ie, size_t ie_len, gfp_t gfp);
4018b23aa676SSamuel Ortiz 
40199588bbd5SJouni Malinen /**
40209588bbd5SJouni Malinen  * cfg80211_ready_on_channel - notification of remain_on_channel start
402171bbc994SJohannes Berg  * @wdev: wireless device
40229588bbd5SJouni Malinen  * @cookie: the request cookie
40239588bbd5SJouni Malinen  * @chan: The current channel (from remain_on_channel request)
40249588bbd5SJouni Malinen  * @duration: Duration in milliseconds that the driver intents to remain on the
40259588bbd5SJouni Malinen  *	channel
40269588bbd5SJouni Malinen  * @gfp: allocation flags
40279588bbd5SJouni Malinen  */
402871bbc994SJohannes Berg void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie,
40299588bbd5SJouni Malinen 			       struct ieee80211_channel *chan,
40309588bbd5SJouni Malinen 			       unsigned int duration, gfp_t gfp);
40319588bbd5SJouni Malinen 
40329588bbd5SJouni Malinen /**
40339588bbd5SJouni Malinen  * cfg80211_remain_on_channel_expired - remain_on_channel duration expired
403471bbc994SJohannes Berg  * @wdev: wireless device
40359588bbd5SJouni Malinen  * @cookie: the request cookie
40369588bbd5SJouni Malinen  * @chan: The current channel (from remain_on_channel request)
40379588bbd5SJouni Malinen  * @gfp: allocation flags
40389588bbd5SJouni Malinen  */
403971bbc994SJohannes Berg void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie,
40409588bbd5SJouni Malinen 					struct ieee80211_channel *chan,
40419588bbd5SJouni Malinen 					gfp_t gfp);
4042b23aa676SSamuel Ortiz 
404398b62183SJohannes Berg 
404498b62183SJohannes Berg /**
404598b62183SJohannes Berg  * cfg80211_new_sta - notify userspace about station
404698b62183SJohannes Berg  *
404798b62183SJohannes Berg  * @dev: the netdev
404898b62183SJohannes Berg  * @mac_addr: the station's address
404998b62183SJohannes Berg  * @sinfo: the station information
405098b62183SJohannes Berg  * @gfp: allocation flags
405198b62183SJohannes Berg  */
405298b62183SJohannes Berg void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr,
405398b62183SJohannes Berg 		      struct station_info *sinfo, gfp_t gfp);
405498b62183SJohannes Berg 
4055026331c4SJouni Malinen /**
4056ec15e68bSJouni Malinen  * cfg80211_del_sta - notify userspace about deletion of a station
4057ec15e68bSJouni Malinen  *
4058ec15e68bSJouni Malinen  * @dev: the netdev
4059ec15e68bSJouni Malinen  * @mac_addr: the station's address
4060ec15e68bSJouni Malinen  * @gfp: allocation flags
4061ec15e68bSJouni Malinen  */
4062ec15e68bSJouni Malinen void cfg80211_del_sta(struct net_device *dev, const u8 *mac_addr, gfp_t gfp);
4063ec15e68bSJouni Malinen 
4064ec15e68bSJouni Malinen /**
4065ed44a951SPandiyarajan Pitchaimuthu  * cfg80211_conn_failed - connection request failed notification
4066ed44a951SPandiyarajan Pitchaimuthu  *
4067ed44a951SPandiyarajan Pitchaimuthu  * @dev: the netdev
4068ed44a951SPandiyarajan Pitchaimuthu  * @mac_addr: the station's address
4069ed44a951SPandiyarajan Pitchaimuthu  * @reason: the reason for connection failure
4070ed44a951SPandiyarajan Pitchaimuthu  * @gfp: allocation flags
4071ed44a951SPandiyarajan Pitchaimuthu  *
4072ed44a951SPandiyarajan Pitchaimuthu  * Whenever a station tries to connect to an AP and if the station
4073ed44a951SPandiyarajan Pitchaimuthu  * could not connect to the AP as the AP has rejected the connection
4074ed44a951SPandiyarajan Pitchaimuthu  * for some reasons, this function is called.
4075ed44a951SPandiyarajan Pitchaimuthu  *
4076ed44a951SPandiyarajan Pitchaimuthu  * The reason for connection failure can be any of the value from
4077ed44a951SPandiyarajan Pitchaimuthu  * nl80211_connect_failed_reason enum
4078ed44a951SPandiyarajan Pitchaimuthu  */
4079ed44a951SPandiyarajan Pitchaimuthu void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr,
4080ed44a951SPandiyarajan Pitchaimuthu 			  enum nl80211_connect_failed_reason reason,
4081ed44a951SPandiyarajan Pitchaimuthu 			  gfp_t gfp);
4082ed44a951SPandiyarajan Pitchaimuthu 
4083ed44a951SPandiyarajan Pitchaimuthu /**
40842e161f78SJohannes Berg  * cfg80211_rx_mgmt - notification of received, unprocessed management frame
408571bbc994SJohannes Berg  * @wdev: wireless device receiving the frame
4086026331c4SJouni Malinen  * @freq: Frequency on which the frame was received in MHz
4087804483e9SJohannes Berg  * @sig_dbm: signal strength in mBm, or 0 if unknown
40882e161f78SJohannes Berg  * @buf: Management frame (header + body)
4089026331c4SJouni Malinen  * @len: length of the frame data
409019504cf5SVladimir Kondratiev  * @flags: flags, as defined in enum nl80211_rxmgmt_flags
4091026331c4SJouni Malinen  * @gfp: context flags
40922e161f78SJohannes Berg  *
40930ae997dcSYacine Belkadi  * This function is called whenever an Action frame is received for a station
40940ae997dcSYacine Belkadi  * mode interface, but is not processed in kernel.
40950ae997dcSYacine Belkadi  *
40960ae997dcSYacine Belkadi  * Return: %true if a user space application has registered for this frame.
40972e161f78SJohannes Berg  * For action frames, that makes it responsible for rejecting unrecognized
40982e161f78SJohannes Berg  * action frames; %false otherwise, in which case for action frames the
40992e161f78SJohannes Berg  * driver is responsible for rejecting the frame.
4100026331c4SJouni Malinen  */
410171bbc994SJohannes Berg bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int sig_dbm,
410219504cf5SVladimir Kondratiev 		      const u8 *buf, size_t len, u32 flags, gfp_t gfp);
4103026331c4SJouni Malinen 
4104026331c4SJouni Malinen /**
41052e161f78SJohannes Berg  * cfg80211_mgmt_tx_status - notification of TX status for management frame
410671bbc994SJohannes Berg  * @wdev: wireless device receiving the frame
41072e161f78SJohannes Berg  * @cookie: Cookie returned by cfg80211_ops::mgmt_tx()
41082e161f78SJohannes Berg  * @buf: Management frame (header + body)
4109026331c4SJouni Malinen  * @len: length of the frame data
4110026331c4SJouni Malinen  * @ack: Whether frame was acknowledged
4111026331c4SJouni Malinen  * @gfp: context flags
4112026331c4SJouni Malinen  *
41132e161f78SJohannes Berg  * This function is called whenever a management frame was requested to be
41142e161f78SJohannes Berg  * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the
4115026331c4SJouni Malinen  * transmission attempt.
4116026331c4SJouni Malinen  */
411771bbc994SJohannes Berg void cfg80211_mgmt_tx_status(struct wireless_dev *wdev, u64 cookie,
4118026331c4SJouni Malinen 			     const u8 *buf, size_t len, bool ack, gfp_t gfp);
4119026331c4SJouni Malinen 
4120d6dc1a38SJuuso Oikarinen 
4121d6dc1a38SJuuso Oikarinen /**
4122d6dc1a38SJuuso Oikarinen  * cfg80211_cqm_rssi_notify - connection quality monitoring rssi event
4123d6dc1a38SJuuso Oikarinen  * @dev: network device
4124d6dc1a38SJuuso Oikarinen  * @rssi_event: the triggered RSSI event
4125d6dc1a38SJuuso Oikarinen  * @gfp: context flags
4126d6dc1a38SJuuso Oikarinen  *
4127d6dc1a38SJuuso Oikarinen  * This function is called when a configured connection quality monitoring
4128d6dc1a38SJuuso Oikarinen  * rssi threshold reached event occurs.
4129d6dc1a38SJuuso Oikarinen  */
4130d6dc1a38SJuuso Oikarinen void cfg80211_cqm_rssi_notify(struct net_device *dev,
4131d6dc1a38SJuuso Oikarinen 			      enum nl80211_cqm_rssi_threshold_event rssi_event,
4132d6dc1a38SJuuso Oikarinen 			      gfp_t gfp);
4133d6dc1a38SJuuso Oikarinen 
4134c063dbf5SJohannes Berg /**
413504f39047SSimon Wunderlich  * cfg80211_radar_event - radar detection event
413604f39047SSimon Wunderlich  * @wiphy: the wiphy
413704f39047SSimon Wunderlich  * @chandef: chandef for the current channel
413804f39047SSimon Wunderlich  * @gfp: context flags
413904f39047SSimon Wunderlich  *
414004f39047SSimon Wunderlich  * This function is called when a radar is detected on the current chanenl.
414104f39047SSimon Wunderlich  */
414204f39047SSimon Wunderlich void cfg80211_radar_event(struct wiphy *wiphy,
414304f39047SSimon Wunderlich 			  struct cfg80211_chan_def *chandef, gfp_t gfp);
414404f39047SSimon Wunderlich 
414504f39047SSimon Wunderlich /**
414604f39047SSimon Wunderlich  * cfg80211_cac_event - Channel availability check (CAC) event
414704f39047SSimon Wunderlich  * @netdev: network device
414804f39047SSimon Wunderlich  * @event: type of event
414904f39047SSimon Wunderlich  * @gfp: context flags
415004f39047SSimon Wunderlich  *
415104f39047SSimon Wunderlich  * This function is called when a Channel availability check (CAC) is finished
415204f39047SSimon Wunderlich  * or aborted. This must be called to notify the completion of a CAC process,
415304f39047SSimon Wunderlich  * also by full-MAC drivers.
415404f39047SSimon Wunderlich  */
415504f39047SSimon Wunderlich void cfg80211_cac_event(struct net_device *netdev,
415604f39047SSimon Wunderlich 			enum nl80211_radar_event event, gfp_t gfp);
415704f39047SSimon Wunderlich 
415804f39047SSimon Wunderlich 
415904f39047SSimon Wunderlich /**
4160c063dbf5SJohannes Berg  * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer
4161c063dbf5SJohannes Berg  * @dev: network device
4162c063dbf5SJohannes Berg  * @peer: peer's MAC address
4163c063dbf5SJohannes Berg  * @num_packets: how many packets were lost -- should be a fixed threshold
4164c063dbf5SJohannes Berg  *	but probably no less than maybe 50, or maybe a throughput dependent
4165c063dbf5SJohannes Berg  *	threshold (to account for temporary interference)
4166c063dbf5SJohannes Berg  * @gfp: context flags
4167c063dbf5SJohannes Berg  */
4168c063dbf5SJohannes Berg void cfg80211_cqm_pktloss_notify(struct net_device *dev,
4169c063dbf5SJohannes Berg 				 const u8 *peer, u32 num_packets, gfp_t gfp);
4170c063dbf5SJohannes Berg 
4171e5497d76SJohannes Berg /**
417284f10708SThomas Pedersen  * cfg80211_cqm_txe_notify - TX error rate event
417384f10708SThomas Pedersen  * @dev: network device
417484f10708SThomas Pedersen  * @peer: peer's MAC address
417584f10708SThomas Pedersen  * @num_packets: how many packets were lost
417684f10708SThomas Pedersen  * @rate: % of packets which failed transmission
417784f10708SThomas Pedersen  * @intvl: interval (in s) over which the TX failure threshold was breached.
417884f10708SThomas Pedersen  * @gfp: context flags
417984f10708SThomas Pedersen  *
418084f10708SThomas Pedersen  * Notify userspace when configured % TX failures over number of packets in a
418184f10708SThomas Pedersen  * given interval is exceeded.
418284f10708SThomas Pedersen  */
418384f10708SThomas Pedersen void cfg80211_cqm_txe_notify(struct net_device *dev, const u8 *peer,
418484f10708SThomas Pedersen 			     u32 num_packets, u32 rate, u32 intvl, gfp_t gfp);
418584f10708SThomas Pedersen 
418684f10708SThomas Pedersen /**
4187e5497d76SJohannes Berg  * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying
4188e5497d76SJohannes Berg  * @dev: network device
4189e5497d76SJohannes Berg  * @bssid: BSSID of AP (to avoid races)
4190e5497d76SJohannes Berg  * @replay_ctr: new replay counter
4191af71ff85SJohannes Berg  * @gfp: allocation flags
4192e5497d76SJohannes Berg  */
4193e5497d76SJohannes Berg void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid,
4194e5497d76SJohannes Berg 			       const u8 *replay_ctr, gfp_t gfp);
4195e5497d76SJohannes Berg 
4196c9df56b4SJouni Malinen /**
4197c9df56b4SJouni Malinen  * cfg80211_pmksa_candidate_notify - notify about PMKSA caching candidate
4198c9df56b4SJouni Malinen  * @dev: network device
4199c9df56b4SJouni Malinen  * @index: candidate index (the smaller the index, the higher the priority)
4200c9df56b4SJouni Malinen  * @bssid: BSSID of AP
4201c9df56b4SJouni Malinen  * @preauth: Whether AP advertises support for RSN pre-authentication
4202c9df56b4SJouni Malinen  * @gfp: allocation flags
4203c9df56b4SJouni Malinen  */
4204c9df56b4SJouni Malinen void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index,
4205c9df56b4SJouni Malinen 				     const u8 *bssid, bool preauth, gfp_t gfp);
4206c9df56b4SJouni Malinen 
420728946da7SJohannes Berg /**
420828946da7SJohannes Berg  * cfg80211_rx_spurious_frame - inform userspace about a spurious frame
420928946da7SJohannes Berg  * @dev: The device the frame matched to
421028946da7SJohannes Berg  * @addr: the transmitter address
421128946da7SJohannes Berg  * @gfp: context flags
421228946da7SJohannes Berg  *
421328946da7SJohannes Berg  * This function is used in AP mode (only!) to inform userspace that
421428946da7SJohannes Berg  * a spurious class 3 frame was received, to be able to deauth the
421528946da7SJohannes Berg  * sender.
42160ae997dcSYacine Belkadi  * Return: %true if the frame was passed to userspace (or this failed
421728946da7SJohannes Berg  * for a reason other than not having a subscription.)
421828946da7SJohannes Berg  */
421928946da7SJohannes Berg bool cfg80211_rx_spurious_frame(struct net_device *dev,
422028946da7SJohannes Berg 				const u8 *addr, gfp_t gfp);
422128946da7SJohannes Berg 
42227f6cf311SJohannes Berg /**
4223b92ab5d8SJohannes Berg  * cfg80211_rx_unexpected_4addr_frame - inform about unexpected WDS frame
4224b92ab5d8SJohannes Berg  * @dev: The device the frame matched to
4225b92ab5d8SJohannes Berg  * @addr: the transmitter address
4226b92ab5d8SJohannes Berg  * @gfp: context flags
4227b92ab5d8SJohannes Berg  *
4228b92ab5d8SJohannes Berg  * This function is used in AP mode (only!) to inform userspace that
4229b92ab5d8SJohannes Berg  * an associated station sent a 4addr frame but that wasn't expected.
4230b92ab5d8SJohannes Berg  * It is allowed and desirable to send this event only once for each
4231b92ab5d8SJohannes Berg  * station to avoid event flooding.
42320ae997dcSYacine Belkadi  * Return: %true if the frame was passed to userspace (or this failed
4233b92ab5d8SJohannes Berg  * for a reason other than not having a subscription.)
4234b92ab5d8SJohannes Berg  */
4235b92ab5d8SJohannes Berg bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev,
4236b92ab5d8SJohannes Berg 					const u8 *addr, gfp_t gfp);
4237b92ab5d8SJohannes Berg 
4238b92ab5d8SJohannes Berg /**
42397f6cf311SJohannes Berg  * cfg80211_probe_status - notify userspace about probe status
42407f6cf311SJohannes Berg  * @dev: the device the probe was sent on
42417f6cf311SJohannes Berg  * @addr: the address of the peer
42427f6cf311SJohannes Berg  * @cookie: the cookie filled in @probe_client previously
42437f6cf311SJohannes Berg  * @acked: indicates whether probe was acked or not
42447f6cf311SJohannes Berg  * @gfp: allocation flags
42457f6cf311SJohannes Berg  */
42467f6cf311SJohannes Berg void cfg80211_probe_status(struct net_device *dev, const u8 *addr,
42477f6cf311SJohannes Berg 			   u64 cookie, bool acked, gfp_t gfp);
42487f6cf311SJohannes Berg 
42495e760230SJohannes Berg /**
42505e760230SJohannes Berg  * cfg80211_report_obss_beacon - report beacon from other APs
42515e760230SJohannes Berg  * @wiphy: The wiphy that received the beacon
42525e760230SJohannes Berg  * @frame: the frame
42535e760230SJohannes Berg  * @len: length of the frame
42545e760230SJohannes Berg  * @freq: frequency the frame was received on
4255804483e9SJohannes Berg  * @sig_dbm: signal strength in mBm, or 0 if unknown
42565e760230SJohannes Berg  *
42575e760230SJohannes Berg  * Use this function to report to userspace when a beacon was
42585e760230SJohannes Berg  * received. It is not useful to call this when there is no
42595e760230SJohannes Berg  * netdev that is in AP/GO mode.
42605e760230SJohannes Berg  */
42615e760230SJohannes Berg void cfg80211_report_obss_beacon(struct wiphy *wiphy,
42625e760230SJohannes Berg 				 const u8 *frame, size_t len,
426337c73b5fSBen Greear 				 int freq, int sig_dbm);
42645e760230SJohannes Berg 
4265d58e7e37SJohannes Berg /**
4266683b6d3bSJohannes Berg  * cfg80211_reg_can_beacon - check if beaconing is allowed
426754858ee5SAlexander Simon  * @wiphy: the wiphy
4268683b6d3bSJohannes Berg  * @chandef: the channel definition
4269d58e7e37SJohannes Berg  *
42700ae997dcSYacine Belkadi  * Return: %true if there is no secondary channel or the secondary channel(s)
42710ae997dcSYacine Belkadi  * can be used for beaconing (i.e. is not a radar channel etc.)
427254858ee5SAlexander Simon  */
4273683b6d3bSJohannes Berg bool cfg80211_reg_can_beacon(struct wiphy *wiphy,
4274683b6d3bSJohannes Berg 			     struct cfg80211_chan_def *chandef);
427554858ee5SAlexander Simon 
42768097e149SThomas Pedersen /*
42775314526bSThomas Pedersen  * cfg80211_ch_switch_notify - update wdev channel and notify userspace
42785314526bSThomas Pedersen  * @dev: the device which switched channels
4279683b6d3bSJohannes Berg  * @chandef: the new channel definition
42805314526bSThomas Pedersen  *
42815314526bSThomas Pedersen  * Acquires wdev_lock, so must only be called from sleepable driver context!
42825314526bSThomas Pedersen  */
4283683b6d3bSJohannes Berg void cfg80211_ch_switch_notify(struct net_device *dev,
4284683b6d3bSJohannes Berg 			       struct cfg80211_chan_def *chandef);
42855314526bSThomas Pedersen 
42861ce3e82bSJohannes Berg /**
42871ce3e82bSJohannes Berg  * ieee80211_operating_class_to_band - convert operating class to band
42881ce3e82bSJohannes Berg  *
42891ce3e82bSJohannes Berg  * @operating_class: the operating class to convert
42901ce3e82bSJohannes Berg  * @band: band pointer to fill
42911ce3e82bSJohannes Berg  *
42921ce3e82bSJohannes Berg  * Returns %true if the conversion was successful, %false otherwise.
42931ce3e82bSJohannes Berg  */
42941ce3e82bSJohannes Berg bool ieee80211_operating_class_to_band(u8 operating_class,
42951ce3e82bSJohannes Berg 				       enum ieee80211_band *band);
42961ce3e82bSJohannes Berg 
42975314526bSThomas Pedersen /*
42983475b094SJouni Malinen  * cfg80211_tdls_oper_request - request userspace to perform TDLS operation
42993475b094SJouni Malinen  * @dev: the device on which the operation is requested
43003475b094SJouni Malinen  * @peer: the MAC address of the peer device
43013475b094SJouni Malinen  * @oper: the requested TDLS operation (NL80211_TDLS_SETUP or
43023475b094SJouni Malinen  *	NL80211_TDLS_TEARDOWN)
43033475b094SJouni Malinen  * @reason_code: the reason code for teardown request
43043475b094SJouni Malinen  * @gfp: allocation flags
43053475b094SJouni Malinen  *
43063475b094SJouni Malinen  * This function is used to request userspace to perform TDLS operation that
43073475b094SJouni Malinen  * requires knowledge of keys, i.e., link setup or teardown when the AP
43083475b094SJouni Malinen  * connection uses encryption. This is optional mechanism for the driver to use
43093475b094SJouni Malinen  * if it can automatically determine when a TDLS link could be useful (e.g.,
43103475b094SJouni Malinen  * based on traffic and signal strength for a peer).
43113475b094SJouni Malinen  */
43123475b094SJouni Malinen void cfg80211_tdls_oper_request(struct net_device *dev, const u8 *peer,
43133475b094SJouni Malinen 				enum nl80211_tdls_operation oper,
43143475b094SJouni Malinen 				u16 reason_code, gfp_t gfp);
43153475b094SJouni Malinen 
43163475b094SJouni Malinen /*
43178097e149SThomas Pedersen  * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units)
43188097e149SThomas Pedersen  * @rate: given rate_info to calculate bitrate from
43198097e149SThomas Pedersen  *
43208097e149SThomas Pedersen  * return 0 if MCS index >= 32
43218097e149SThomas Pedersen  */
43228eb41c8dSVladimir Kondratiev u32 cfg80211_calculate_bitrate(struct rate_info *rate);
43238097e149SThomas Pedersen 
432498104fdeSJohannes Berg /**
432598104fdeSJohannes Berg  * cfg80211_unregister_wdev - remove the given wdev
432698104fdeSJohannes Berg  * @wdev: struct wireless_dev to remove
432798104fdeSJohannes Berg  *
432898104fdeSJohannes Berg  * Call this function only for wdevs that have no netdev assigned,
432998104fdeSJohannes Berg  * e.g. P2P Devices. It removes the device from the list so that
433098104fdeSJohannes Berg  * it can no longer be used. It is necessary to call this function
433198104fdeSJohannes Berg  * even when cfg80211 requests the removal of the interface by
433298104fdeSJohannes Berg  * calling the del_virtual_intf() callback. The function must also
433398104fdeSJohannes Berg  * be called when the driver wishes to unregister the wdev, e.g.
433498104fdeSJohannes Berg  * when the device is unbound from the driver.
433598104fdeSJohannes Berg  *
433698104fdeSJohannes Berg  * Requires the RTNL to be held.
433798104fdeSJohannes Berg  */
433898104fdeSJohannes Berg void cfg80211_unregister_wdev(struct wireless_dev *wdev);
433998104fdeSJohannes Berg 
43400ee45355SJohannes Berg /**
4341355199e0SJouni Malinen  * struct cfg80211_ft_event - FT Information Elements
4342355199e0SJouni Malinen  * @ies: FT IEs
4343355199e0SJouni Malinen  * @ies_len: length of the FT IE in bytes
4344355199e0SJouni Malinen  * @target_ap: target AP's MAC address
4345355199e0SJouni Malinen  * @ric_ies: RIC IE
4346355199e0SJouni Malinen  * @ric_ies_len: length of the RIC IE in bytes
4347355199e0SJouni Malinen  */
4348355199e0SJouni Malinen struct cfg80211_ft_event_params {
4349355199e0SJouni Malinen 	const u8 *ies;
4350355199e0SJouni Malinen 	size_t ies_len;
4351355199e0SJouni Malinen 	const u8 *target_ap;
4352355199e0SJouni Malinen 	const u8 *ric_ies;
4353355199e0SJouni Malinen 	size_t ric_ies_len;
4354355199e0SJouni Malinen };
4355355199e0SJouni Malinen 
4356355199e0SJouni Malinen /**
4357355199e0SJouni Malinen  * cfg80211_ft_event - notify userspace about FT IE and RIC IE
4358355199e0SJouni Malinen  * @netdev: network device
4359355199e0SJouni Malinen  * @ft_event: IE information
4360355199e0SJouni Malinen  */
4361355199e0SJouni Malinen void cfg80211_ft_event(struct net_device *netdev,
4362355199e0SJouni Malinen 		       struct cfg80211_ft_event_params *ft_event);
4363355199e0SJouni Malinen 
4364355199e0SJouni Malinen /**
43650ee45355SJohannes Berg  * cfg80211_get_p2p_attr - find and copy a P2P attribute from IE buffer
43660ee45355SJohannes Berg  * @ies: the input IE buffer
43670ee45355SJohannes Berg  * @len: the input length
43680ee45355SJohannes Berg  * @attr: the attribute ID to find
43690ee45355SJohannes Berg  * @buf: output buffer, can be %NULL if the data isn't needed, e.g.
43700ee45355SJohannes Berg  *	if the function is only called to get the needed buffer size
43710ee45355SJohannes Berg  * @bufsize: size of the output buffer
43720ee45355SJohannes Berg  *
43730ee45355SJohannes Berg  * The function finds a given P2P attribute in the (vendor) IEs and
43740ee45355SJohannes Berg  * copies its contents to the given buffer.
43750ee45355SJohannes Berg  *
43760ae997dcSYacine Belkadi  * Return: A negative error code (-%EILSEQ or -%ENOENT) if the data is
43770ae997dcSYacine Belkadi  * malformed or the attribute can't be found (respectively), or the
43780ae997dcSYacine Belkadi  * length of the found attribute (which can be zero).
43790ee45355SJohannes Berg  */
4380c216e641SArend van Spriel int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len,
4381c216e641SArend van Spriel 			  enum ieee80211_p2p_attr_id attr,
4382c216e641SArend van Spriel 			  u8 *buf, unsigned int bufsize);
43830ee45355SJohannes Berg 
4384cd8f7cb4SJohannes Berg /**
4385cd8f7cb4SJohannes Berg  * cfg80211_report_wowlan_wakeup - report wakeup from WoWLAN
4386cd8f7cb4SJohannes Berg  * @wdev: the wireless device reporting the wakeup
4387cd8f7cb4SJohannes Berg  * @wakeup: the wakeup report
4388cd8f7cb4SJohannes Berg  * @gfp: allocation flags
4389cd8f7cb4SJohannes Berg  *
4390cd8f7cb4SJohannes Berg  * This function reports that the given device woke up. If it
4391cd8f7cb4SJohannes Berg  * caused the wakeup, report the reason(s), otherwise you may
4392cd8f7cb4SJohannes Berg  * pass %NULL as the @wakeup parameter to advertise that something
4393cd8f7cb4SJohannes Berg  * else caused the wakeup.
4394cd8f7cb4SJohannes Berg  */
4395cd8f7cb4SJohannes Berg void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev,
4396cd8f7cb4SJohannes Berg 				   struct cfg80211_wowlan_wakeup *wakeup,
4397cd8f7cb4SJohannes Berg 				   gfp_t gfp);
4398cd8f7cb4SJohannes Berg 
43995de17984SArend van Spriel /**
44005de17984SArend van Spriel  * cfg80211_crit_proto_stopped() - indicate critical protocol stopped by driver.
44015de17984SArend van Spriel  *
44025de17984SArend van Spriel  * @wdev: the wireless device for which critical protocol is stopped.
440303f831a6SRobert P. J. Day  * @gfp: allocation flags
44045de17984SArend van Spriel  *
44055de17984SArend van Spriel  * This function can be called by the driver to indicate it has reverted
44065de17984SArend van Spriel  * operation back to normal. One reason could be that the duration given
44075de17984SArend van Spriel  * by .crit_proto_start() has expired.
44085de17984SArend van Spriel  */
44095de17984SArend van Spriel void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp);
44105de17984SArend van Spriel 
4411e1db74fcSJoe Perches /* Logging, debugging and troubleshooting/diagnostic helpers. */
4412e1db74fcSJoe Perches 
4413e1db74fcSJoe Perches /* wiphy_printk helpers, similar to dev_printk */
4414e1db74fcSJoe Perches 
4415e1db74fcSJoe Perches #define wiphy_printk(level, wiphy, format, args...)		\
44169c376639SJoe Perches 	dev_printk(level, &(wiphy)->dev, format, ##args)
4417e1db74fcSJoe Perches #define wiphy_emerg(wiphy, format, args...)			\
44189c376639SJoe Perches 	dev_emerg(&(wiphy)->dev, format, ##args)
4419e1db74fcSJoe Perches #define wiphy_alert(wiphy, format, args...)			\
44209c376639SJoe Perches 	dev_alert(&(wiphy)->dev, format, ##args)
4421e1db74fcSJoe Perches #define wiphy_crit(wiphy, format, args...)			\
44229c376639SJoe Perches 	dev_crit(&(wiphy)->dev, format, ##args)
4423e1db74fcSJoe Perches #define wiphy_err(wiphy, format, args...)			\
44249c376639SJoe Perches 	dev_err(&(wiphy)->dev, format, ##args)
4425e1db74fcSJoe Perches #define wiphy_warn(wiphy, format, args...)			\
44269c376639SJoe Perches 	dev_warn(&(wiphy)->dev, format, ##args)
4427e1db74fcSJoe Perches #define wiphy_notice(wiphy, format, args...)			\
44289c376639SJoe Perches 	dev_notice(&(wiphy)->dev, format, ##args)
4429e1db74fcSJoe Perches #define wiphy_info(wiphy, format, args...)			\
44309c376639SJoe Perches 	dev_info(&(wiphy)->dev, format, ##args)
4431073730d7SJoe Perches 
44329c376639SJoe Perches #define wiphy_debug(wiphy, format, args...)			\
4433e1db74fcSJoe Perches 	wiphy_printk(KERN_DEBUG, wiphy, format, ##args)
44349c376639SJoe Perches 
4435e1db74fcSJoe Perches #define wiphy_dbg(wiphy, format, args...)			\
44369c376639SJoe Perches 	dev_dbg(&(wiphy)->dev, format, ##args)
4437e1db74fcSJoe Perches 
4438e1db74fcSJoe Perches #if defined(VERBOSE_DEBUG)
4439e1db74fcSJoe Perches #define wiphy_vdbg	wiphy_dbg
4440e1db74fcSJoe Perches #else
4441e1db74fcSJoe Perches #define wiphy_vdbg(wiphy, format, args...)				\
4442e1db74fcSJoe Perches ({									\
4443e1db74fcSJoe Perches 	if (0)								\
4444e1db74fcSJoe Perches 		wiphy_printk(KERN_DEBUG, wiphy, format, ##args);	\
4445e1db74fcSJoe Perches 	0;								\
4446e1db74fcSJoe Perches })
4447e1db74fcSJoe Perches #endif
4448e1db74fcSJoe Perches 
4449e1db74fcSJoe Perches /*
4450e1db74fcSJoe Perches  * wiphy_WARN() acts like wiphy_printk(), but with the key difference
4451e1db74fcSJoe Perches  * of using a WARN/WARN_ON to get the message out, including the
4452e1db74fcSJoe Perches  * file/line information and a backtrace.
4453e1db74fcSJoe Perches  */
4454e1db74fcSJoe Perches #define wiphy_WARN(wiphy, format, args...)			\
4455e1db74fcSJoe Perches 	WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args);
4456e1db74fcSJoe Perches 
4457704232c2SJohannes Berg #endif /* __NET_CFG80211_H */
4458