xref: /linux/include/net/cfg80211.h (revision e6f4051123fd33901e9655a675b22aefcdc5d277)
1d2912cb1SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
2704232c2SJohannes Berg #ifndef __NET_CFG80211_H
3704232c2SJohannes Berg #define __NET_CFG80211_H
4d3236553SJohannes Berg /*
5d3236553SJohannes Berg  * 802.11 device and configuration interface
6d3236553SJohannes Berg  *
7026331c4SJouni Malinen  * Copyright 2006-2010	Johannes Berg <johannes@sipsolutions.net>
82740f0cfSJohannes Berg  * Copyright 2013-2014 Intel Mobile Communications GmbH
98585989dSLuca Coelho  * Copyright 2015-2017	Intel Deutschland GmbH
107011ba58SSara Sharon  * Copyright (C) 2018-2019 Intel Corporation
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_channel_flags - channel flags
70d3236553SJohannes Berg  *
71d3236553SJohannes Berg  * Channel flags set by the regulatory control code.
72d3236553SJohannes Berg  *
73d3236553SJohannes Berg  * @IEEE80211_CHAN_DISABLED: This channel is disabled.
748fe02e16SLuis R. Rodriguez  * @IEEE80211_CHAN_NO_IR: do not initiate radiation, this includes
758fe02e16SLuis R. Rodriguez  * 	sending probe requests or beaconing.
76d3236553SJohannes Berg  * @IEEE80211_CHAN_RADAR: Radar detection is required on this channel.
77689da1b3SLuis R. Rodriguez  * @IEEE80211_CHAN_NO_HT40PLUS: extension channel above this channel
78d3236553SJohannes Berg  * 	is not permitted.
79689da1b3SLuis R. Rodriguez  * @IEEE80211_CHAN_NO_HT40MINUS: extension channel below this channel
80d3236553SJohannes Berg  * 	is not permitted.
8103f6b084SSeth Forshee  * @IEEE80211_CHAN_NO_OFDM: OFDM is not allowed on this channel.
82c7a6ee27SJohannes Berg  * @IEEE80211_CHAN_NO_80MHZ: If the driver supports 80 MHz on the band,
83c7a6ee27SJohannes Berg  *	this flag indicates that an 80 MHz channel cannot use this
84c7a6ee27SJohannes Berg  *	channel as the control or any of the secondary channels.
85c7a6ee27SJohannes Berg  *	This may be due to the driver or due to regulatory bandwidth
86c7a6ee27SJohannes Berg  *	restrictions.
87c7a6ee27SJohannes Berg  * @IEEE80211_CHAN_NO_160MHZ: If the driver supports 160 MHz on the band,
88c7a6ee27SJohannes Berg  *	this flag indicates that an 160 MHz channel cannot use this
89c7a6ee27SJohannes Berg  *	channel as the control or any of the secondary channels.
90c7a6ee27SJohannes Berg  *	This may be due to the driver or due to regulatory bandwidth
91c7a6ee27SJohannes Berg  *	restrictions.
92570dbde1SDavid Spinadel  * @IEEE80211_CHAN_INDOOR_ONLY: see %NL80211_FREQUENCY_ATTR_INDOOR_ONLY
9306f207fcSArik Nemtsov  * @IEEE80211_CHAN_IR_CONCURRENT: see %NL80211_FREQUENCY_ATTR_IR_CONCURRENT
94ea077c1cSRostislav Lisovy  * @IEEE80211_CHAN_NO_20MHZ: 20 MHz bandwidth is not permitted
95ea077c1cSRostislav Lisovy  *	on this channel.
96ea077c1cSRostislav Lisovy  * @IEEE80211_CHAN_NO_10MHZ: 10 MHz bandwidth is not permitted
97ea077c1cSRostislav Lisovy  *	on this channel.
98570dbde1SDavid Spinadel  *
99d3236553SJohannes Berg  */
100d3236553SJohannes Berg enum ieee80211_channel_flags {
101d3236553SJohannes Berg 	IEEE80211_CHAN_DISABLED		= 1<<0,
1028fe02e16SLuis R. Rodriguez 	IEEE80211_CHAN_NO_IR		= 1<<1,
1038fe02e16SLuis R. Rodriguez 	/* hole at 1<<2 */
104d3236553SJohannes Berg 	IEEE80211_CHAN_RADAR		= 1<<3,
105689da1b3SLuis R. Rodriguez 	IEEE80211_CHAN_NO_HT40PLUS	= 1<<4,
106689da1b3SLuis R. Rodriguez 	IEEE80211_CHAN_NO_HT40MINUS	= 1<<5,
10703f6b084SSeth Forshee 	IEEE80211_CHAN_NO_OFDM		= 1<<6,
108c7a6ee27SJohannes Berg 	IEEE80211_CHAN_NO_80MHZ		= 1<<7,
109c7a6ee27SJohannes Berg 	IEEE80211_CHAN_NO_160MHZ	= 1<<8,
110570dbde1SDavid Spinadel 	IEEE80211_CHAN_INDOOR_ONLY	= 1<<9,
11106f207fcSArik Nemtsov 	IEEE80211_CHAN_IR_CONCURRENT	= 1<<10,
112ea077c1cSRostislav Lisovy 	IEEE80211_CHAN_NO_20MHZ		= 1<<11,
113ea077c1cSRostislav Lisovy 	IEEE80211_CHAN_NO_10MHZ		= 1<<12,
114d3236553SJohannes Berg };
115d3236553SJohannes Berg 
116038659e7SLuis R. Rodriguez #define IEEE80211_CHAN_NO_HT40 \
117689da1b3SLuis R. Rodriguez 	(IEEE80211_CHAN_NO_HT40PLUS | IEEE80211_CHAN_NO_HT40MINUS)
118038659e7SLuis R. Rodriguez 
11904f39047SSimon Wunderlich #define IEEE80211_DFS_MIN_CAC_TIME_MS		60000
12004f39047SSimon Wunderlich #define IEEE80211_DFS_MIN_NOP_TIME_MS		(30 * 60 * 1000)
12104f39047SSimon Wunderlich 
122d3236553SJohannes Berg /**
123d3236553SJohannes Berg  * struct ieee80211_channel - channel definition
124d3236553SJohannes Berg  *
125d3236553SJohannes Berg  * This structure describes a single channel for use
126d3236553SJohannes Berg  * with cfg80211.
127d3236553SJohannes Berg  *
128d3236553SJohannes Berg  * @center_freq: center frequency in MHz
129d3236553SJohannes Berg  * @hw_value: hardware-specific value for the channel
130d3236553SJohannes Berg  * @flags: channel flags from &enum ieee80211_channel_flags.
131d3236553SJohannes Berg  * @orig_flags: channel flags at registration time, used by regulatory
132d3236553SJohannes Berg  *	code to support devices with additional restrictions
133d3236553SJohannes Berg  * @band: band this channel belongs to.
134d3236553SJohannes Berg  * @max_antenna_gain: maximum antenna gain in dBi
135d3236553SJohannes Berg  * @max_power: maximum transmission power (in dBm)
136eccc068eSHong Wu  * @max_reg_power: maximum regulatory transmission power (in dBm)
137d3236553SJohannes Berg  * @beacon_found: helper to regulatory code to indicate when a beacon
138d3236553SJohannes Berg  *	has been found on this channel. Use regulatory_hint_found_beacon()
13977c2061dSWalter Goldens  *	to enable this, this is useful only on 5 GHz band.
140d3236553SJohannes Berg  * @orig_mag: internal use
141d3236553SJohannes Berg  * @orig_mpwr: internal use
14204f39047SSimon Wunderlich  * @dfs_state: current state of this channel. Only relevant if radar is required
14304f39047SSimon Wunderlich  *	on this channel.
14404f39047SSimon Wunderlich  * @dfs_state_entered: timestamp (jiffies) when the dfs state was entered.
145089027e5SJanusz Dziedzic  * @dfs_cac_ms: DFS CAC time in milliseconds, this is valid for DFS channels.
146d3236553SJohannes Berg  */
147d3236553SJohannes Berg struct ieee80211_channel {
14857fbcce3SJohannes Berg 	enum nl80211_band band;
1499cf0a0b4SAlexei Avshalom Lazar 	u32 center_freq;
150d3236553SJohannes Berg 	u16 hw_value;
151d3236553SJohannes Berg 	u32 flags;
152d3236553SJohannes Berg 	int max_antenna_gain;
153d3236553SJohannes Berg 	int max_power;
154eccc068eSHong Wu 	int max_reg_power;
155d3236553SJohannes Berg 	bool beacon_found;
156d3236553SJohannes Berg 	u32 orig_flags;
157d3236553SJohannes Berg 	int orig_mag, orig_mpwr;
15804f39047SSimon Wunderlich 	enum nl80211_dfs_state dfs_state;
15904f39047SSimon Wunderlich 	unsigned long dfs_state_entered;
160089027e5SJanusz Dziedzic 	unsigned int dfs_cac_ms;
161d3236553SJohannes Berg };
162d3236553SJohannes Berg 
163d3236553SJohannes Berg /**
164d3236553SJohannes Berg  * enum ieee80211_rate_flags - rate flags
165d3236553SJohannes Berg  *
166d3236553SJohannes Berg  * Hardware/specification flags for rates. These are structured
167d3236553SJohannes Berg  * in a way that allows using the same bitrate structure for
168d3236553SJohannes Berg  * different bands/PHY modes.
169d3236553SJohannes Berg  *
170d3236553SJohannes Berg  * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short
171d3236553SJohannes Berg  *	preamble on this bitrate; only relevant in 2.4GHz band and
172d3236553SJohannes Berg  *	with CCK rates.
173d3236553SJohannes Berg  * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate
174d3236553SJohannes Berg  *	when used with 802.11a (on the 5 GHz band); filled by the
175d3236553SJohannes Berg  *	core code when registering the wiphy.
176d3236553SJohannes Berg  * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate
177d3236553SJohannes Berg  *	when used with 802.11b (on the 2.4 GHz band); filled by the
178d3236553SJohannes Berg  *	core code when registering the wiphy.
179d3236553SJohannes Berg  * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate
180d3236553SJohannes Berg  *	when used with 802.11g (on the 2.4 GHz band); filled by the
181d3236553SJohannes Berg  *	core code when registering the wiphy.
182d3236553SJohannes Berg  * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode.
18330e74732SSimon Wunderlich  * @IEEE80211_RATE_SUPPORTS_5MHZ: Rate can be used in 5 MHz mode
18430e74732SSimon Wunderlich  * @IEEE80211_RATE_SUPPORTS_10MHZ: Rate can be used in 10 MHz mode
185d3236553SJohannes Berg  */
186d3236553SJohannes Berg enum ieee80211_rate_flags {
187d3236553SJohannes Berg 	IEEE80211_RATE_SHORT_PREAMBLE	= 1<<0,
188d3236553SJohannes Berg 	IEEE80211_RATE_MANDATORY_A	= 1<<1,
189d3236553SJohannes Berg 	IEEE80211_RATE_MANDATORY_B	= 1<<2,
190d3236553SJohannes Berg 	IEEE80211_RATE_MANDATORY_G	= 1<<3,
191d3236553SJohannes Berg 	IEEE80211_RATE_ERP_G		= 1<<4,
19230e74732SSimon Wunderlich 	IEEE80211_RATE_SUPPORTS_5MHZ	= 1<<5,
19330e74732SSimon Wunderlich 	IEEE80211_RATE_SUPPORTS_10MHZ	= 1<<6,
194d3236553SJohannes Berg };
195d3236553SJohannes Berg 
196d3236553SJohannes Berg /**
1976eb18137SDedy Lansky  * enum ieee80211_bss_type - BSS type filter
1986eb18137SDedy Lansky  *
1996eb18137SDedy Lansky  * @IEEE80211_BSS_TYPE_ESS: Infrastructure BSS
2006eb18137SDedy Lansky  * @IEEE80211_BSS_TYPE_PBSS: Personal BSS
2016eb18137SDedy Lansky  * @IEEE80211_BSS_TYPE_IBSS: Independent BSS
2026eb18137SDedy Lansky  * @IEEE80211_BSS_TYPE_MBSS: Mesh BSS
2036eb18137SDedy Lansky  * @IEEE80211_BSS_TYPE_ANY: Wildcard value for matching any BSS type
2046eb18137SDedy Lansky  */
2056eb18137SDedy Lansky enum ieee80211_bss_type {
2066eb18137SDedy Lansky 	IEEE80211_BSS_TYPE_ESS,
2076eb18137SDedy Lansky 	IEEE80211_BSS_TYPE_PBSS,
2086eb18137SDedy Lansky 	IEEE80211_BSS_TYPE_IBSS,
2096eb18137SDedy Lansky 	IEEE80211_BSS_TYPE_MBSS,
2106eb18137SDedy Lansky 	IEEE80211_BSS_TYPE_ANY
2116eb18137SDedy Lansky };
2126eb18137SDedy Lansky 
2136eb18137SDedy Lansky /**
2146eb18137SDedy Lansky  * enum ieee80211_privacy - BSS privacy filter
2156eb18137SDedy Lansky  *
2166eb18137SDedy Lansky  * @IEEE80211_PRIVACY_ON: privacy bit set
2176eb18137SDedy Lansky  * @IEEE80211_PRIVACY_OFF: privacy bit clear
2186eb18137SDedy Lansky  * @IEEE80211_PRIVACY_ANY: Wildcard value for matching any privacy setting
2196eb18137SDedy Lansky  */
2206eb18137SDedy Lansky enum ieee80211_privacy {
2216eb18137SDedy Lansky 	IEEE80211_PRIVACY_ON,
2226eb18137SDedy Lansky 	IEEE80211_PRIVACY_OFF,
2236eb18137SDedy Lansky 	IEEE80211_PRIVACY_ANY
2246eb18137SDedy Lansky };
2256eb18137SDedy Lansky 
2266eb18137SDedy Lansky #define IEEE80211_PRIVACY(x)	\
2276eb18137SDedy Lansky 	((x) ? IEEE80211_PRIVACY_ON : IEEE80211_PRIVACY_OFF)
2286eb18137SDedy Lansky 
2296eb18137SDedy Lansky /**
230d3236553SJohannes Berg  * struct ieee80211_rate - bitrate definition
231d3236553SJohannes Berg  *
232d3236553SJohannes Berg  * This structure describes a bitrate that an 802.11 PHY can
233d3236553SJohannes Berg  * operate with. The two values @hw_value and @hw_value_short
234d3236553SJohannes Berg  * are only for driver use when pointers to this structure are
235d3236553SJohannes Berg  * passed around.
236d3236553SJohannes Berg  *
237d3236553SJohannes Berg  * @flags: rate-specific flags
238d3236553SJohannes Berg  * @bitrate: bitrate in units of 100 Kbps
239d3236553SJohannes Berg  * @hw_value: driver/hardware value for this rate
240d3236553SJohannes Berg  * @hw_value_short: driver/hardware value for this rate when
241d3236553SJohannes Berg  *	short preamble is used
242d3236553SJohannes Berg  */
243d3236553SJohannes Berg struct ieee80211_rate {
244d3236553SJohannes Berg 	u32 flags;
245d3236553SJohannes Berg 	u16 bitrate;
246d3236553SJohannes Berg 	u16 hw_value, hw_value_short;
247d3236553SJohannes Berg };
248d3236553SJohannes Berg 
249d3236553SJohannes Berg /**
250d3236553SJohannes Berg  * struct ieee80211_sta_ht_cap - STA's HT capabilities
251d3236553SJohannes Berg  *
252d3236553SJohannes Berg  * This structure describes most essential parameters needed
253d3236553SJohannes Berg  * to describe 802.11n HT capabilities for an STA.
254d3236553SJohannes Berg  *
255d3236553SJohannes Berg  * @ht_supported: is HT supported by the STA
256d3236553SJohannes Berg  * @cap: HT capabilities map as described in 802.11n spec
257d3236553SJohannes Berg  * @ampdu_factor: Maximum A-MPDU length factor
258d3236553SJohannes Berg  * @ampdu_density: Minimum A-MPDU spacing
259d3236553SJohannes Berg  * @mcs: Supported MCS rates
260d3236553SJohannes Berg  */
261d3236553SJohannes Berg struct ieee80211_sta_ht_cap {
262d3236553SJohannes Berg 	u16 cap; /* use IEEE80211_HT_CAP_ */
263d3236553SJohannes Berg 	bool ht_supported;
264d3236553SJohannes Berg 	u8 ampdu_factor;
265d3236553SJohannes Berg 	u8 ampdu_density;
266d3236553SJohannes Berg 	struct ieee80211_mcs_info mcs;
267d3236553SJohannes Berg };
268d3236553SJohannes Berg 
269d3236553SJohannes Berg /**
270bf0c111eSMahesh Palivela  * struct ieee80211_sta_vht_cap - STA's VHT capabilities
271bf0c111eSMahesh Palivela  *
272bf0c111eSMahesh Palivela  * This structure describes most essential parameters needed
273bf0c111eSMahesh Palivela  * to describe 802.11ac VHT capabilities for an STA.
274bf0c111eSMahesh Palivela  *
275bf0c111eSMahesh Palivela  * @vht_supported: is VHT supported by the STA
276bf0c111eSMahesh Palivela  * @cap: VHT capabilities map as described in 802.11ac spec
277bf0c111eSMahesh Palivela  * @vht_mcs: Supported VHT MCS rates
278bf0c111eSMahesh Palivela  */
279bf0c111eSMahesh Palivela struct ieee80211_sta_vht_cap {
280bf0c111eSMahesh Palivela 	bool vht_supported;
281bf0c111eSMahesh Palivela 	u32 cap; /* use IEEE80211_VHT_CAP_ */
282bf0c111eSMahesh Palivela 	struct ieee80211_vht_mcs_info vht_mcs;
283bf0c111eSMahesh Palivela };
284bf0c111eSMahesh Palivela 
285c4cbaf79SLuca Coelho #define IEEE80211_HE_PPE_THRES_MAX_LEN		25
286c4cbaf79SLuca Coelho 
287c4cbaf79SLuca Coelho /**
288c4cbaf79SLuca Coelho  * struct ieee80211_sta_he_cap - STA's HE capabilities
289c4cbaf79SLuca Coelho  *
290c4cbaf79SLuca Coelho  * This structure describes most essential parameters needed
291c4cbaf79SLuca Coelho  * to describe 802.11ax HE capabilities for a STA.
292c4cbaf79SLuca Coelho  *
293c4cbaf79SLuca Coelho  * @has_he: true iff HE data is valid.
294c4cbaf79SLuca Coelho  * @he_cap_elem: Fixed portion of the HE capabilities element.
295c4cbaf79SLuca Coelho  * @he_mcs_nss_supp: The supported NSS/MCS combinations.
296c4cbaf79SLuca Coelho  * @ppe_thres: Holds the PPE Thresholds data.
297c4cbaf79SLuca Coelho  */
298c4cbaf79SLuca Coelho struct ieee80211_sta_he_cap {
299c4cbaf79SLuca Coelho 	bool has_he;
300c4cbaf79SLuca Coelho 	struct ieee80211_he_cap_elem he_cap_elem;
301c4cbaf79SLuca Coelho 	struct ieee80211_he_mcs_nss_supp he_mcs_nss_supp;
302c4cbaf79SLuca Coelho 	u8 ppe_thres[IEEE80211_HE_PPE_THRES_MAX_LEN];
303c4cbaf79SLuca Coelho };
304c4cbaf79SLuca Coelho 
305c4cbaf79SLuca Coelho /**
306c4cbaf79SLuca Coelho  * struct ieee80211_sband_iftype_data
307c4cbaf79SLuca Coelho  *
308c4cbaf79SLuca Coelho  * This structure encapsulates sband data that is relevant for the
309c4cbaf79SLuca Coelho  * interface types defined in @types_mask.  Each type in the
310c4cbaf79SLuca Coelho  * @types_mask must be unique across all instances of iftype_data.
311c4cbaf79SLuca Coelho  *
312c4cbaf79SLuca Coelho  * @types_mask: interface types mask
313c4cbaf79SLuca Coelho  * @he_cap: holds the HE capabilities
314c4cbaf79SLuca Coelho  */
315c4cbaf79SLuca Coelho struct ieee80211_sband_iftype_data {
316c4cbaf79SLuca Coelho 	u16 types_mask;
317c4cbaf79SLuca Coelho 	struct ieee80211_sta_he_cap he_cap;
318c4cbaf79SLuca Coelho };
319c4cbaf79SLuca Coelho 
320bf0c111eSMahesh Palivela /**
321d3236553SJohannes Berg  * struct ieee80211_supported_band - frequency band definition
322d3236553SJohannes Berg  *
323d3236553SJohannes Berg  * This structure describes a frequency band a wiphy
324d3236553SJohannes Berg  * is able to operate in.
325d3236553SJohannes Berg  *
326d3236553SJohannes Berg  * @channels: Array of channels the hardware can operate in
327d3236553SJohannes Berg  *	in this band.
328d3236553SJohannes Berg  * @band: the band this structure represents
329d3236553SJohannes Berg  * @n_channels: Number of channels in @channels
330d3236553SJohannes Berg  * @bitrates: Array of bitrates the hardware can operate with
331d3236553SJohannes Berg  *	in this band. Must be sorted to give a valid "supported
332d3236553SJohannes Berg  *	rates" IE, i.e. CCK rates first, then OFDM.
333d3236553SJohannes Berg  * @n_bitrates: Number of bitrates in @bitrates
334abe37c4bSJohannes Berg  * @ht_cap: HT capabilities in this band
335c9a0a302SRobert P. J. Day  * @vht_cap: VHT capabilities in this band
336c4cbaf79SLuca Coelho  * @n_iftype_data: number of iftype data entries
337c4cbaf79SLuca Coelho  * @iftype_data: interface type data entries.  Note that the bits in
338c4cbaf79SLuca Coelho  *	@types_mask inside this structure cannot overlap (i.e. only
339c4cbaf79SLuca Coelho  *	one occurrence of each type is allowed across all instances of
340c4cbaf79SLuca Coelho  *	iftype_data).
341d3236553SJohannes Berg  */
342d3236553SJohannes Berg struct ieee80211_supported_band {
343d3236553SJohannes Berg 	struct ieee80211_channel *channels;
344d3236553SJohannes Berg 	struct ieee80211_rate *bitrates;
34557fbcce3SJohannes Berg 	enum nl80211_band band;
346d3236553SJohannes Berg 	int n_channels;
347d3236553SJohannes Berg 	int n_bitrates;
348d3236553SJohannes Berg 	struct ieee80211_sta_ht_cap ht_cap;
349bf0c111eSMahesh Palivela 	struct ieee80211_sta_vht_cap vht_cap;
350c4cbaf79SLuca Coelho 	u16 n_iftype_data;
351c4cbaf79SLuca Coelho 	const struct ieee80211_sband_iftype_data *iftype_data;
352d3236553SJohannes Berg };
353d3236553SJohannes Berg 
354e691ac2fSRafał Miłecki /**
355c4cbaf79SLuca Coelho  * ieee80211_get_sband_iftype_data - return sband data for a given iftype
356c4cbaf79SLuca Coelho  * @sband: the sband to search for the STA on
357c4cbaf79SLuca Coelho  * @iftype: enum nl80211_iftype
358c4cbaf79SLuca Coelho  *
359c4cbaf79SLuca Coelho  * Return: pointer to struct ieee80211_sband_iftype_data, or NULL is none found
360c4cbaf79SLuca Coelho  */
361c4cbaf79SLuca Coelho static inline const struct ieee80211_sband_iftype_data *
362c4cbaf79SLuca Coelho ieee80211_get_sband_iftype_data(const struct ieee80211_supported_band *sband,
363c4cbaf79SLuca Coelho 				u8 iftype)
364c4cbaf79SLuca Coelho {
365c4cbaf79SLuca Coelho 	int i;
366c4cbaf79SLuca Coelho 
367c4cbaf79SLuca Coelho 	if (WARN_ON(iftype >= NL80211_IFTYPE_MAX))
368c4cbaf79SLuca Coelho 		return NULL;
369c4cbaf79SLuca Coelho 
370c4cbaf79SLuca Coelho 	for (i = 0; i < sband->n_iftype_data; i++)  {
371c4cbaf79SLuca Coelho 		const struct ieee80211_sband_iftype_data *data =
372c4cbaf79SLuca Coelho 			&sband->iftype_data[i];
373c4cbaf79SLuca Coelho 
374c4cbaf79SLuca Coelho 		if (data->types_mask & BIT(iftype))
375c4cbaf79SLuca Coelho 			return data;
376c4cbaf79SLuca Coelho 	}
377c4cbaf79SLuca Coelho 
378c4cbaf79SLuca Coelho 	return NULL;
379c4cbaf79SLuca Coelho }
380c4cbaf79SLuca Coelho 
381c4cbaf79SLuca Coelho /**
382d7edf40cSJohn Crispin  * ieee80211_get_he_iftype_cap - return HE capabilities for an sband's iftype
383d7edf40cSJohn Crispin  * @sband: the sband to search for the iftype on
384d7edf40cSJohn Crispin  * @iftype: enum nl80211_iftype
385d7edf40cSJohn Crispin  *
386d7edf40cSJohn Crispin  * Return: pointer to the struct ieee80211_sta_he_cap, or NULL is none found
387d7edf40cSJohn Crispin  */
388d7edf40cSJohn Crispin static inline const struct ieee80211_sta_he_cap *
389d7edf40cSJohn Crispin ieee80211_get_he_iftype_cap(const struct ieee80211_supported_band *sband,
390d7edf40cSJohn Crispin 			    u8 iftype)
391d7edf40cSJohn Crispin {
392d7edf40cSJohn Crispin 	const struct ieee80211_sband_iftype_data *data =
393d7edf40cSJohn Crispin 		ieee80211_get_sband_iftype_data(sband, iftype);
394d7edf40cSJohn Crispin 
395d7edf40cSJohn Crispin 	if (data && data->he_cap.has_he)
396d7edf40cSJohn Crispin 		return &data->he_cap;
397d7edf40cSJohn Crispin 
398d7edf40cSJohn Crispin 	return NULL;
399d7edf40cSJohn Crispin }
400d7edf40cSJohn Crispin 
401d7edf40cSJohn Crispin /**
402c4cbaf79SLuca Coelho  * ieee80211_get_he_sta_cap - return HE capabilities for an sband's STA
403c4cbaf79SLuca Coelho  * @sband: the sband to search for the STA on
404c4cbaf79SLuca Coelho  *
405c4cbaf79SLuca Coelho  * Return: pointer to the struct ieee80211_sta_he_cap, or NULL is none found
406c4cbaf79SLuca Coelho  */
407c4cbaf79SLuca Coelho static inline const struct ieee80211_sta_he_cap *
408c4cbaf79SLuca Coelho ieee80211_get_he_sta_cap(const struct ieee80211_supported_band *sband)
409c4cbaf79SLuca Coelho {
410d7edf40cSJohn Crispin 	return ieee80211_get_he_iftype_cap(sband, NL80211_IFTYPE_STATION);
411c4cbaf79SLuca Coelho }
412c4cbaf79SLuca Coelho 
413c4cbaf79SLuca Coelho /**
414e691ac2fSRafał Miłecki  * wiphy_read_of_freq_limits - read frequency limits from device tree
415e691ac2fSRafał Miłecki  *
416e691ac2fSRafał Miłecki  * @wiphy: the wireless device to get extra limits for
417e691ac2fSRafał Miłecki  *
418e691ac2fSRafał Miłecki  * Some devices may have extra limitations specified in DT. This may be useful
419e691ac2fSRafał Miłecki  * for chipsets that normally support more bands but are limited due to board
420e691ac2fSRafał Miłecki  * design (e.g. by antennas or external power amplifier).
421e691ac2fSRafał Miłecki  *
422e691ac2fSRafał Miłecki  * This function reads info from DT and uses it to *modify* channels (disable
423e691ac2fSRafał Miłecki  * unavailable ones). It's usually a *bad* idea to use it in drivers with
424e691ac2fSRafał Miłecki  * shared channel data as DT limitations are device specific. You should make
425e691ac2fSRafał Miłecki  * sure to call it only if channels in wiphy are copied and can be modified
426e691ac2fSRafał Miłecki  * without affecting other devices.
427e691ac2fSRafał Miłecki  *
428e691ac2fSRafał Miłecki  * As this function access device node it has to be called after set_wiphy_dev.
429e691ac2fSRafał Miłecki  * It also modifies channels so they have to be set first.
430e691ac2fSRafał Miłecki  * If using this helper, call it before wiphy_register().
431e691ac2fSRafał Miłecki  */
432e691ac2fSRafał Miłecki #ifdef CONFIG_OF
433e691ac2fSRafał Miłecki void wiphy_read_of_freq_limits(struct wiphy *wiphy);
434e691ac2fSRafał Miłecki #else /* CONFIG_OF */
435e691ac2fSRafał Miłecki static inline void wiphy_read_of_freq_limits(struct wiphy *wiphy)
436e691ac2fSRafał Miłecki {
437e691ac2fSRafał Miłecki }
438e691ac2fSRafał Miłecki #endif /* !CONFIG_OF */
439e691ac2fSRafał Miłecki 
440e691ac2fSRafał Miłecki 
441d3236553SJohannes Berg /*
442d3236553SJohannes Berg  * Wireless hardware/device configuration structures and methods
443704232c2SJohannes Berg  */
444704232c2SJohannes Berg 
4452ec600d6SLuis Carlos Cobo /**
446d70e9693SJohannes Berg  * DOC: Actions and configuration
447d70e9693SJohannes Berg  *
448d70e9693SJohannes Berg  * Each wireless device and each virtual interface offer a set of configuration
449d70e9693SJohannes Berg  * operations and other actions that are invoked by userspace. Each of these
450d70e9693SJohannes Berg  * actions is described in the operations structure, and the parameters these
451d70e9693SJohannes Berg  * operations use are described separately.
452d70e9693SJohannes Berg  *
453d70e9693SJohannes Berg  * Additionally, some operations are asynchronous and expect to get status
454d70e9693SJohannes Berg  * information via some functions that drivers need to call.
455d70e9693SJohannes Berg  *
456d70e9693SJohannes Berg  * Scanning and BSS list handling with its associated functionality is described
457d70e9693SJohannes Berg  * in a separate chapter.
458d70e9693SJohannes Berg  */
459d70e9693SJohannes Berg 
460c6e6a0c8SAviya Erenfeld #define VHT_MUMIMO_GROUPS_DATA_LEN (WLAN_MEMBERSHIP_LEN +\
461c6e6a0c8SAviya Erenfeld 				    WLAN_USER_POSITION_LEN)
462c6e6a0c8SAviya Erenfeld 
463d70e9693SJohannes Berg /**
4642ec600d6SLuis Carlos Cobo  * struct vif_params - describes virtual interface parameters
465818a986eSJohannes Berg  * @flags: monitor interface flags, unchanged if 0, otherwise
466818a986eSJohannes Berg  *	%MONITOR_FLAG_CHANGED will be set
4678b787643SFelix Fietkau  * @use_4addr: use 4-address frames
468e8f479b1SBen Greear  * @macaddr: address to use for this virtual interface.
469e8f479b1SBen Greear  *	If this parameter is set to zero address the driver may
470e8f479b1SBen Greear  *	determine the address as needed.
471e8f479b1SBen Greear  *	This feature is only fully supported by drivers that enable the
472e8f479b1SBen Greear  *	%NL80211_FEATURE_MAC_ON_CREATE flag.  Others may support creating
473e8f479b1SBen Greear  **	only p2p devices with specified MAC.
474b0265024SJohannes Berg  * @vht_mumimo_groups: MU-MIMO groupID, used for monitoring MU-MIMO packets
475b0265024SJohannes Berg  *	belonging to that MU-MIMO groupID; %NULL if not changed
476b0265024SJohannes Berg  * @vht_mumimo_follow_addr: MU-MIMO follow address, used for monitoring
477b0265024SJohannes Berg  *	MU-MIMO packets going to the specified station; %NULL if not changed
4782ec600d6SLuis Carlos Cobo  */
4792ec600d6SLuis Carlos Cobo struct vif_params {
480818a986eSJohannes Berg 	u32 flags;
4818b787643SFelix Fietkau 	int use_4addr;
4821c18f145SArend van Spriel 	u8 macaddr[ETH_ALEN];
483b0265024SJohannes Berg 	const u8 *vht_mumimo_groups;
484b0265024SJohannes Berg 	const u8 *vht_mumimo_follow_addr;
4852ec600d6SLuis Carlos Cobo };
4862ec600d6SLuis Carlos Cobo 
48741ade00fSJohannes Berg /**
48841ade00fSJohannes Berg  * struct key_params - key information
48941ade00fSJohannes Berg  *
49041ade00fSJohannes Berg  * Information about a key
49141ade00fSJohannes Berg  *
49241ade00fSJohannes Berg  * @key: key material
49341ade00fSJohannes Berg  * @key_len: length of key material
49441ade00fSJohannes Berg  * @cipher: cipher suite selector
49541ade00fSJohannes Berg  * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used
49641ade00fSJohannes Berg  *	with the get_key() callback, must be in little endian,
49741ade00fSJohannes Berg  *	length given by @seq_len.
498abe37c4bSJohannes Berg  * @seq_len: length of @seq.
4996cdd3979SAlexander Wetzel  * @mode: key install mode (RX_TX, NO_TX or SET_TX)
50041ade00fSJohannes Berg  */
50141ade00fSJohannes Berg struct key_params {
502c1e5f471SJohannes Berg 	const u8 *key;
503c1e5f471SJohannes Berg 	const u8 *seq;
50441ade00fSJohannes Berg 	int key_len;
50541ade00fSJohannes Berg 	int seq_len;
50641ade00fSJohannes Berg 	u32 cipher;
5076cdd3979SAlexander Wetzel 	enum nl80211_key_mode mode;
50841ade00fSJohannes Berg };
50941ade00fSJohannes Berg 
510ed1b6cc7SJohannes Berg /**
511683b6d3bSJohannes Berg  * struct cfg80211_chan_def - channel definition
512683b6d3bSJohannes Berg  * @chan: the (control) channel
5133d9d1d66SJohannes Berg  * @width: channel width
5143d9d1d66SJohannes Berg  * @center_freq1: center frequency of first segment
5153d9d1d66SJohannes Berg  * @center_freq2: center frequency of second segment
5163d9d1d66SJohannes Berg  *	(only with 80+80 MHz)
517683b6d3bSJohannes Berg  */
518683b6d3bSJohannes Berg struct cfg80211_chan_def {
519683b6d3bSJohannes Berg 	struct ieee80211_channel *chan;
5203d9d1d66SJohannes Berg 	enum nl80211_chan_width width;
5213d9d1d66SJohannes Berg 	u32 center_freq1;
5223d9d1d66SJohannes Berg 	u32 center_freq2;
523683b6d3bSJohannes Berg };
524683b6d3bSJohannes Berg 
5253d9d1d66SJohannes Berg /**
5263d9d1d66SJohannes Berg  * cfg80211_get_chandef_type - return old channel type from chandef
5273d9d1d66SJohannes Berg  * @chandef: the channel definition
5283d9d1d66SJohannes Berg  *
5290ae997dcSYacine Belkadi  * Return: The old channel type (NOHT, HT20, HT40+/-) from a given
5303d9d1d66SJohannes Berg  * chandef, which must have a bandwidth allowing this conversion.
5313d9d1d66SJohannes Berg  */
532683b6d3bSJohannes Berg static inline enum nl80211_channel_type
533683b6d3bSJohannes Berg cfg80211_get_chandef_type(const struct cfg80211_chan_def *chandef)
534683b6d3bSJohannes Berg {
5353d9d1d66SJohannes Berg 	switch (chandef->width) {
5363d9d1d66SJohannes Berg 	case NL80211_CHAN_WIDTH_20_NOHT:
5373d9d1d66SJohannes Berg 		return NL80211_CHAN_NO_HT;
5383d9d1d66SJohannes Berg 	case NL80211_CHAN_WIDTH_20:
5393d9d1d66SJohannes Berg 		return NL80211_CHAN_HT20;
5403d9d1d66SJohannes Berg 	case NL80211_CHAN_WIDTH_40:
5413d9d1d66SJohannes Berg 		if (chandef->center_freq1 > chandef->chan->center_freq)
5423d9d1d66SJohannes Berg 			return NL80211_CHAN_HT40PLUS;
5433d9d1d66SJohannes Berg 		return NL80211_CHAN_HT40MINUS;
5443d9d1d66SJohannes Berg 	default:
5453d9d1d66SJohannes Berg 		WARN_ON(1);
5463d9d1d66SJohannes Berg 		return NL80211_CHAN_NO_HT;
547683b6d3bSJohannes Berg 	}
5483d9d1d66SJohannes Berg }
5493d9d1d66SJohannes Berg 
5503d9d1d66SJohannes Berg /**
5513d9d1d66SJohannes Berg  * cfg80211_chandef_create - create channel definition using channel type
5523d9d1d66SJohannes Berg  * @chandef: the channel definition struct to fill
5533d9d1d66SJohannes Berg  * @channel: the control channel
5543d9d1d66SJohannes Berg  * @chantype: the channel type
5553d9d1d66SJohannes Berg  *
5563d9d1d66SJohannes Berg  * Given a channel type, create a channel definition.
5573d9d1d66SJohannes Berg  */
5583d9d1d66SJohannes Berg void cfg80211_chandef_create(struct cfg80211_chan_def *chandef,
5593d9d1d66SJohannes Berg 			     struct ieee80211_channel *channel,
5603d9d1d66SJohannes Berg 			     enum nl80211_channel_type chantype);
5613d9d1d66SJohannes Berg 
5623d9d1d66SJohannes Berg /**
5633d9d1d66SJohannes Berg  * cfg80211_chandef_identical - check if two channel definitions are identical
5643d9d1d66SJohannes Berg  * @chandef1: first channel definition
5653d9d1d66SJohannes Berg  * @chandef2: second channel definition
5663d9d1d66SJohannes Berg  *
5670ae997dcSYacine Belkadi  * Return: %true if the channels defined by the channel definitions are
5683d9d1d66SJohannes Berg  * identical, %false otherwise.
5693d9d1d66SJohannes Berg  */
5703d9d1d66SJohannes Berg static inline bool
5713d9d1d66SJohannes Berg cfg80211_chandef_identical(const struct cfg80211_chan_def *chandef1,
5723d9d1d66SJohannes Berg 			   const struct cfg80211_chan_def *chandef2)
5733d9d1d66SJohannes Berg {
5743d9d1d66SJohannes Berg 	return (chandef1->chan == chandef2->chan &&
5753d9d1d66SJohannes Berg 		chandef1->width == chandef2->width &&
5763d9d1d66SJohannes Berg 		chandef1->center_freq1 == chandef2->center_freq1 &&
5773d9d1d66SJohannes Berg 		chandef1->center_freq2 == chandef2->center_freq2);
5783d9d1d66SJohannes Berg }
5793d9d1d66SJohannes Berg 
5803d9d1d66SJohannes Berg /**
5813d9d1d66SJohannes Berg  * cfg80211_chandef_compatible - check if two channel definitions are compatible
5823d9d1d66SJohannes Berg  * @chandef1: first channel definition
5833d9d1d66SJohannes Berg  * @chandef2: second channel definition
5843d9d1d66SJohannes Berg  *
5850ae997dcSYacine Belkadi  * Return: %NULL if the given channel definitions are incompatible,
5863d9d1d66SJohannes Berg  * chandef1 or chandef2 otherwise.
5873d9d1d66SJohannes Berg  */
5883d9d1d66SJohannes Berg const struct cfg80211_chan_def *
5893d9d1d66SJohannes Berg cfg80211_chandef_compatible(const struct cfg80211_chan_def *chandef1,
5903d9d1d66SJohannes Berg 			    const struct cfg80211_chan_def *chandef2);
591683b6d3bSJohannes Berg 
592683b6d3bSJohannes Berg /**
5939f5e8f6eSJohannes Berg  * cfg80211_chandef_valid - check if a channel definition is valid
5949f5e8f6eSJohannes Berg  * @chandef: the channel definition to check
5950ae997dcSYacine Belkadi  * Return: %true if the channel definition is valid. %false otherwise.
5969f5e8f6eSJohannes Berg  */
5979f5e8f6eSJohannes Berg bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef);
5989f5e8f6eSJohannes Berg 
5999f5e8f6eSJohannes Berg /**
6009f5e8f6eSJohannes Berg  * cfg80211_chandef_usable - check if secondary channels can be used
6019f5e8f6eSJohannes Berg  * @wiphy: the wiphy to validate against
6029f5e8f6eSJohannes Berg  * @chandef: the channel definition to check
6030ae997dcSYacine Belkadi  * @prohibited_flags: the regulatory channel flags that must not be set
6040ae997dcSYacine Belkadi  * Return: %true if secondary channels are usable. %false otherwise.
6059f5e8f6eSJohannes Berg  */
6069f5e8f6eSJohannes Berg bool cfg80211_chandef_usable(struct wiphy *wiphy,
6079f5e8f6eSJohannes Berg 			     const struct cfg80211_chan_def *chandef,
6089f5e8f6eSJohannes Berg 			     u32 prohibited_flags);
6099f5e8f6eSJohannes Berg 
6109f5e8f6eSJohannes Berg /**
611774f0734SSimon Wunderlich  * cfg80211_chandef_dfs_required - checks if radar detection is required
612774f0734SSimon Wunderlich  * @wiphy: the wiphy to validate against
613774f0734SSimon Wunderlich  * @chandef: the channel definition to check
6142beb6dabSLuciano Coelho  * @iftype: the interface type as specified in &enum nl80211_iftype
6152beb6dabSLuciano Coelho  * Returns:
6162beb6dabSLuciano Coelho  *	1 if radar detection is required, 0 if it is not, < 0 on error
617774f0734SSimon Wunderlich  */
618774f0734SSimon Wunderlich int cfg80211_chandef_dfs_required(struct wiphy *wiphy,
6192beb6dabSLuciano Coelho 				  const struct cfg80211_chan_def *chandef,
620c3d62036SLuciano Coelho 				  enum nl80211_iftype iftype);
621774f0734SSimon Wunderlich 
622774f0734SSimon Wunderlich /**
62330e74732SSimon Wunderlich  * ieee80211_chandef_rate_flags - returns rate flags for a channel
62430e74732SSimon Wunderlich  *
62530e74732SSimon Wunderlich  * In some channel types, not all rates may be used - for example CCK
62630e74732SSimon Wunderlich  * rates may not be used in 5/10 MHz channels.
62730e74732SSimon Wunderlich  *
62830e74732SSimon Wunderlich  * @chandef: channel definition for the channel
62930e74732SSimon Wunderlich  *
63030e74732SSimon Wunderlich  * Returns: rate flags which apply for this channel
63130e74732SSimon Wunderlich  */
63230e74732SSimon Wunderlich static inline enum ieee80211_rate_flags
63330e74732SSimon Wunderlich ieee80211_chandef_rate_flags(struct cfg80211_chan_def *chandef)
63430e74732SSimon Wunderlich {
63530e74732SSimon Wunderlich 	switch (chandef->width) {
63630e74732SSimon Wunderlich 	case NL80211_CHAN_WIDTH_5:
63730e74732SSimon Wunderlich 		return IEEE80211_RATE_SUPPORTS_5MHZ;
63830e74732SSimon Wunderlich 	case NL80211_CHAN_WIDTH_10:
63930e74732SSimon Wunderlich 		return IEEE80211_RATE_SUPPORTS_10MHZ;
64030e74732SSimon Wunderlich 	default:
64130e74732SSimon Wunderlich 		break;
64230e74732SSimon Wunderlich 	}
64330e74732SSimon Wunderlich 	return 0;
64430e74732SSimon Wunderlich }
64530e74732SSimon Wunderlich 
64630e74732SSimon Wunderlich /**
6470430c883SSimon Wunderlich  * ieee80211_chandef_max_power - maximum transmission power for the chandef
6480430c883SSimon Wunderlich  *
6490430c883SSimon Wunderlich  * In some regulations, the transmit power may depend on the configured channel
6500430c883SSimon Wunderlich  * bandwidth which may be defined as dBm/MHz. This function returns the actual
6510430c883SSimon Wunderlich  * max_power for non-standard (20 MHz) channels.
6520430c883SSimon Wunderlich  *
6530430c883SSimon Wunderlich  * @chandef: channel definition for the channel
6540430c883SSimon Wunderlich  *
6550430c883SSimon Wunderlich  * Returns: maximum allowed transmission power in dBm for the chandef
6560430c883SSimon Wunderlich  */
6570430c883SSimon Wunderlich static inline int
6580430c883SSimon Wunderlich ieee80211_chandef_max_power(struct cfg80211_chan_def *chandef)
6590430c883SSimon Wunderlich {
6600430c883SSimon Wunderlich 	switch (chandef->width) {
6610430c883SSimon Wunderlich 	case NL80211_CHAN_WIDTH_5:
6620430c883SSimon Wunderlich 		return min(chandef->chan->max_reg_power - 6,
6630430c883SSimon Wunderlich 			   chandef->chan->max_power);
6640430c883SSimon Wunderlich 	case NL80211_CHAN_WIDTH_10:
6650430c883SSimon Wunderlich 		return min(chandef->chan->max_reg_power - 3,
6660430c883SSimon Wunderlich 			   chandef->chan->max_power);
6670430c883SSimon Wunderlich 	default:
6680430c883SSimon Wunderlich 		break;
6690430c883SSimon Wunderlich 	}
6700430c883SSimon Wunderlich 	return chandef->chan->max_power;
6710430c883SSimon Wunderlich }
6720430c883SSimon Wunderlich 
6730430c883SSimon Wunderlich /**
67461fa713cSHolger Schurig  * enum survey_info_flags - survey information flags
67561fa713cSHolger Schurig  *
676abe37c4bSJohannes Berg  * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in
67717e5a808SFelix Fietkau  * @SURVEY_INFO_IN_USE: channel is currently being used
6784ed20bebSJohannes Berg  * @SURVEY_INFO_TIME: active time (in ms) was filled in
6794ed20bebSJohannes Berg  * @SURVEY_INFO_TIME_BUSY: busy time was filled in
6804ed20bebSJohannes Berg  * @SURVEY_INFO_TIME_EXT_BUSY: extension channel busy time was filled in
6814ed20bebSJohannes Berg  * @SURVEY_INFO_TIME_RX: receive time was filled in
6824ed20bebSJohannes Berg  * @SURVEY_INFO_TIME_TX: transmit time was filled in
683052536abSJohannes Berg  * @SURVEY_INFO_TIME_SCAN: scan time was filled in
684abe37c4bSJohannes Berg  *
68561fa713cSHolger Schurig  * Used by the driver to indicate which info in &struct survey_info
68661fa713cSHolger Schurig  * it has filled in during the get_survey().
68761fa713cSHolger Schurig  */
68861fa713cSHolger Schurig enum survey_info_flags {
6894ed20bebSJohannes Berg 	SURVEY_INFO_NOISE_DBM		= BIT(0),
6904ed20bebSJohannes Berg 	SURVEY_INFO_IN_USE		= BIT(1),
6914ed20bebSJohannes Berg 	SURVEY_INFO_TIME		= BIT(2),
6924ed20bebSJohannes Berg 	SURVEY_INFO_TIME_BUSY		= BIT(3),
6934ed20bebSJohannes Berg 	SURVEY_INFO_TIME_EXT_BUSY	= BIT(4),
6944ed20bebSJohannes Berg 	SURVEY_INFO_TIME_RX		= BIT(5),
6954ed20bebSJohannes Berg 	SURVEY_INFO_TIME_TX		= BIT(6),
696052536abSJohannes Berg 	SURVEY_INFO_TIME_SCAN		= BIT(7),
69761fa713cSHolger Schurig };
69861fa713cSHolger Schurig 
69961fa713cSHolger Schurig /**
70061fa713cSHolger Schurig  * struct survey_info - channel survey response
70161fa713cSHolger Schurig  *
70211f78ac3SJohannes Berg  * @channel: the channel this survey record reports, may be %NULL for a single
70311f78ac3SJohannes Berg  *	record to report global statistics
70461fa713cSHolger Schurig  * @filled: bitflag of flags from &enum survey_info_flags
70561fa713cSHolger Schurig  * @noise: channel noise in dBm. This and all following fields are
70661fa713cSHolger Schurig  *	optional
7074ed20bebSJohannes Berg  * @time: amount of time in ms the radio was turn on (on the channel)
7084ed20bebSJohannes Berg  * @time_busy: amount of time the primary channel was sensed busy
7094ed20bebSJohannes Berg  * @time_ext_busy: amount of time the extension channel was sensed busy
7104ed20bebSJohannes Berg  * @time_rx: amount of time the radio spent receiving data
7114ed20bebSJohannes Berg  * @time_tx: amount of time the radio spent transmitting data
712052536abSJohannes Berg  * @time_scan: amount of time the radio spent for scanning
71361fa713cSHolger Schurig  *
714abe37c4bSJohannes Berg  * Used by dump_survey() to report back per-channel survey information.
715abe37c4bSJohannes Berg  *
71661fa713cSHolger Schurig  * This structure can later be expanded with things like
71761fa713cSHolger Schurig  * channel duty cycle etc.
71861fa713cSHolger Schurig  */
71961fa713cSHolger Schurig struct survey_info {
72061fa713cSHolger Schurig 	struct ieee80211_channel *channel;
7214ed20bebSJohannes Berg 	u64 time;
7224ed20bebSJohannes Berg 	u64 time_busy;
7234ed20bebSJohannes Berg 	u64 time_ext_busy;
7244ed20bebSJohannes Berg 	u64 time_rx;
7254ed20bebSJohannes Berg 	u64 time_tx;
726052536abSJohannes Berg 	u64 time_scan;
72761fa713cSHolger Schurig 	u32 filled;
72861fa713cSHolger Schurig 	s8 noise;
72961fa713cSHolger Schurig };
73061fa713cSHolger Schurig 
731b8676221SDavid Spinadel #define CFG80211_MAX_WEP_KEYS	4
732b8676221SDavid Spinadel 
73361fa713cSHolger Schurig /**
7345fb628e9SJouni Malinen  * struct cfg80211_crypto_settings - Crypto settings
7355fb628e9SJouni Malinen  * @wpa_versions: indicates which, if any, WPA versions are enabled
7365fb628e9SJouni Malinen  *	(from enum nl80211_wpa_versions)
7375fb628e9SJouni Malinen  * @cipher_group: group key cipher suite (or 0 if unset)
7385fb628e9SJouni Malinen  * @n_ciphers_pairwise: number of AP supported unicast ciphers
7395fb628e9SJouni Malinen  * @ciphers_pairwise: unicast key cipher suites
7405fb628e9SJouni Malinen  * @n_akm_suites: number of AKM suites
7415fb628e9SJouni Malinen  * @akm_suites: AKM suites
7425fb628e9SJouni Malinen  * @control_port: Whether user space controls IEEE 802.1X port, i.e.,
7435fb628e9SJouni Malinen  *	sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
7445fb628e9SJouni Malinen  *	required to assume that the port is unauthorized until authorized by
7455fb628e9SJouni Malinen  *	user space. Otherwise, port is marked authorized by default.
7465fb628e9SJouni Malinen  * @control_port_ethertype: the control port protocol that should be
7475fb628e9SJouni Malinen  *	allowed through even on unauthorized ports
7485fb628e9SJouni Malinen  * @control_port_no_encrypt: TRUE to prevent encryption of control port
7495fb628e9SJouni Malinen  *	protocol frames.
75064bf3d4bSDenis Kenzior  * @control_port_over_nl80211: TRUE if userspace expects to exchange control
75164bf3d4bSDenis Kenzior  *	port frames over NL80211 instead of the network interface.
752b8676221SDavid Spinadel  * @wep_keys: static WEP keys, if not NULL points to an array of
753b8676221SDavid Spinadel  *	CFG80211_MAX_WEP_KEYS WEP keys
754b8676221SDavid Spinadel  * @wep_tx_key: key index (0..3) of the default TX static WEP key
75591b5ab62SEliad Peller  * @psk: PSK (for devices supporting 4-way-handshake offload)
75626f7044eSChung-Hsien Hsu  * @sae_pwd: password for SAE authentication (for devices supporting SAE
75726f7044eSChung-Hsien Hsu  *	offload)
75826f7044eSChung-Hsien Hsu  * @sae_pwd_len: length of SAE password (for devices supporting SAE offload)
7595fb628e9SJouni Malinen  */
7605fb628e9SJouni Malinen struct cfg80211_crypto_settings {
7615fb628e9SJouni Malinen 	u32 wpa_versions;
7625fb628e9SJouni Malinen 	u32 cipher_group;
7635fb628e9SJouni Malinen 	int n_ciphers_pairwise;
7645fb628e9SJouni Malinen 	u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES];
7655fb628e9SJouni Malinen 	int n_akm_suites;
7665fb628e9SJouni Malinen 	u32 akm_suites[NL80211_MAX_NR_AKM_SUITES];
7675fb628e9SJouni Malinen 	bool control_port;
7685fb628e9SJouni Malinen 	__be16 control_port_ethertype;
7695fb628e9SJouni Malinen 	bool control_port_no_encrypt;
77064bf3d4bSDenis Kenzior 	bool control_port_over_nl80211;
771b8676221SDavid Spinadel 	struct key_params *wep_keys;
772b8676221SDavid Spinadel 	int wep_tx_key;
77391b5ab62SEliad Peller 	const u8 *psk;
77426f7044eSChung-Hsien Hsu 	const u8 *sae_pwd;
77526f7044eSChung-Hsien Hsu 	u8 sae_pwd_len;
7765fb628e9SJouni Malinen };
7775fb628e9SJouni Malinen 
7785fb628e9SJouni Malinen /**
7798860020eSJohannes Berg  * struct cfg80211_beacon_data - beacon data
780ed1b6cc7SJohannes Berg  * @head: head portion of beacon (before TIM IE)
781ed1b6cc7SJohannes Berg  *	or %NULL if not changed
782ed1b6cc7SJohannes Berg  * @tail: tail portion of beacon (after TIM IE)
783ed1b6cc7SJohannes Berg  *	or %NULL if not changed
784ed1b6cc7SJohannes Berg  * @head_len: length of @head
785ed1b6cc7SJohannes Berg  * @tail_len: length of @tail
7869946ecfbSJouni Malinen  * @beacon_ies: extra information element(s) to add into Beacon frames or %NULL
7879946ecfbSJouni Malinen  * @beacon_ies_len: length of beacon_ies in octets
7889946ecfbSJouni Malinen  * @proberesp_ies: extra information element(s) to add into Probe Response
7899946ecfbSJouni Malinen  *	frames or %NULL
7909946ecfbSJouni Malinen  * @proberesp_ies_len: length of proberesp_ies in octets
7919946ecfbSJouni Malinen  * @assocresp_ies: extra information element(s) to add into (Re)Association
7929946ecfbSJouni Malinen  *	Response frames or %NULL
7939946ecfbSJouni Malinen  * @assocresp_ies_len: length of assocresp_ies in octets
79400f740e1SArik Nemtsov  * @probe_resp_len: length of probe response template (@probe_resp)
79500f740e1SArik Nemtsov  * @probe_resp: probe response template (AP mode only)
79681e54d08SPradeep Kumar Chitrapu  * @ftm_responder: enable FTM responder functionality; -1 for no change
79781e54d08SPradeep Kumar Chitrapu  *	(which also implies no change in LCI/civic location data)
79830db641eSJohannes Berg  * @lci: Measurement Report element content, starting with Measurement Token
79930db641eSJohannes Berg  *	(measurement type 8)
80030db641eSJohannes Berg  * @civicloc: Measurement Report element content, starting with Measurement
80130db641eSJohannes Berg  *	Token (measurement type 11)
80281e54d08SPradeep Kumar Chitrapu  * @lci_len: LCI data length
80381e54d08SPradeep Kumar Chitrapu  * @civicloc_len: Civic location data length
804ed1b6cc7SJohannes Berg  */
8058860020eSJohannes Berg struct cfg80211_beacon_data {
8068860020eSJohannes Berg 	const u8 *head, *tail;
8078860020eSJohannes Berg 	const u8 *beacon_ies;
8088860020eSJohannes Berg 	const u8 *proberesp_ies;
8098860020eSJohannes Berg 	const u8 *assocresp_ies;
8108860020eSJohannes Berg 	const u8 *probe_resp;
81181e54d08SPradeep Kumar Chitrapu 	const u8 *lci;
81281e54d08SPradeep Kumar Chitrapu 	const u8 *civicloc;
81381e54d08SPradeep Kumar Chitrapu 	s8 ftm_responder;
8148860020eSJohannes Berg 
8158860020eSJohannes Berg 	size_t head_len, tail_len;
8168860020eSJohannes Berg 	size_t beacon_ies_len;
8178860020eSJohannes Berg 	size_t proberesp_ies_len;
8188860020eSJohannes Berg 	size_t assocresp_ies_len;
8198860020eSJohannes Berg 	size_t probe_resp_len;
82081e54d08SPradeep Kumar Chitrapu 	size_t lci_len;
82181e54d08SPradeep Kumar Chitrapu 	size_t civicloc_len;
8228860020eSJohannes Berg };
8238860020eSJohannes Berg 
8246d45a74bSVasanthakumar Thiagarajan struct mac_address {
8256d45a74bSVasanthakumar Thiagarajan 	u8 addr[ETH_ALEN];
8266d45a74bSVasanthakumar Thiagarajan };
8276d45a74bSVasanthakumar Thiagarajan 
8288860020eSJohannes Berg /**
82977765eafSVasanthakumar Thiagarajan  * struct cfg80211_acl_data - Access control list data
83077765eafSVasanthakumar Thiagarajan  *
83177765eafSVasanthakumar Thiagarajan  * @acl_policy: ACL policy to be applied on the station's
832077f897aSJohannes Berg  *	entry specified by mac_addr
83377765eafSVasanthakumar Thiagarajan  * @n_acl_entries: Number of MAC address entries passed
83477765eafSVasanthakumar Thiagarajan  * @mac_addrs: List of MAC addresses of stations to be used for ACL
83577765eafSVasanthakumar Thiagarajan  */
83677765eafSVasanthakumar Thiagarajan struct cfg80211_acl_data {
83777765eafSVasanthakumar Thiagarajan 	enum nl80211_acl_policy acl_policy;
83877765eafSVasanthakumar Thiagarajan 	int n_acl_entries;
83977765eafSVasanthakumar Thiagarajan 
84077765eafSVasanthakumar Thiagarajan 	/* Keep it last */
84177765eafSVasanthakumar Thiagarajan 	struct mac_address mac_addrs[];
84277765eafSVasanthakumar Thiagarajan };
84377765eafSVasanthakumar Thiagarajan 
844a7c7fbffSPurushottam Kushwaha /*
845a7c7fbffSPurushottam Kushwaha  * cfg80211_bitrate_mask - masks for bitrate control
846a7c7fbffSPurushottam Kushwaha  */
847a7c7fbffSPurushottam Kushwaha struct cfg80211_bitrate_mask {
848a7c7fbffSPurushottam Kushwaha 	struct {
849a7c7fbffSPurushottam Kushwaha 		u32 legacy;
850a7c7fbffSPurushottam Kushwaha 		u8 ht_mcs[IEEE80211_HT_MCS_MASK_LEN];
851a7c7fbffSPurushottam Kushwaha 		u16 vht_mcs[NL80211_VHT_NSS_MAX];
852a7c7fbffSPurushottam Kushwaha 		enum nl80211_txrate_gi gi;
853a7c7fbffSPurushottam Kushwaha 	} control[NUM_NL80211_BANDS];
854a7c7fbffSPurushottam Kushwaha };
855a7c7fbffSPurushottam Kushwaha 
8568860020eSJohannes Berg /**
857fe494370SSrinivas Dasari  * enum cfg80211_ap_settings_flags - AP settings flags
858fe494370SSrinivas Dasari  *
859fe494370SSrinivas Dasari  * Used by cfg80211_ap_settings
860fe494370SSrinivas Dasari  *
861fe494370SSrinivas Dasari  * @AP_SETTINGS_EXTERNAL_AUTH_SUPPORT: AP supports external authentication
862fe494370SSrinivas Dasari  */
863fe494370SSrinivas Dasari enum cfg80211_ap_settings_flags {
864fe494370SSrinivas Dasari 	AP_SETTINGS_EXTERNAL_AUTH_SUPPORT = BIT(0),
865fe494370SSrinivas Dasari };
866fe494370SSrinivas Dasari 
867fe494370SSrinivas Dasari /**
8688860020eSJohannes Berg  * struct cfg80211_ap_settings - AP configuration
8698860020eSJohannes Berg  *
8708860020eSJohannes Berg  * Used to configure an AP interface.
8718860020eSJohannes Berg  *
872683b6d3bSJohannes Berg  * @chandef: defines the channel to use
8738860020eSJohannes Berg  * @beacon: beacon data
8748860020eSJohannes Berg  * @beacon_interval: beacon interval
8758860020eSJohannes Berg  * @dtim_period: DTIM period
8768860020eSJohannes Berg  * @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from
8778860020eSJohannes Berg  *	user space)
8788860020eSJohannes Berg  * @ssid_len: length of @ssid
8798860020eSJohannes Berg  * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames
8808860020eSJohannes Berg  * @crypto: crypto settings
8818860020eSJohannes Berg  * @privacy: the BSS uses privacy
8828860020eSJohannes Berg  * @auth_type: Authentication type (algorithm)
88318998c38SEliad Peller  * @smps_mode: SMPS mode
8841b658f11SVasanthakumar Thiagarajan  * @inactivity_timeout: time in seconds to determine station's inactivity.
88553cabad7SJohannes Berg  * @p2p_ctwindow: P2P CT Window
88653cabad7SJohannes Berg  * @p2p_opp_ps: P2P opportunistic PS
88777765eafSVasanthakumar Thiagarajan  * @acl: ACL configuration used by the drivers which has support for
88877765eafSVasanthakumar Thiagarajan  *	MAC address based access control
88934d50519SLior David  * @pbss: If set, start as a PCP instead of AP. Relevant for DMG
89034d50519SLior David  *	networks.
8918564e382SJohannes Berg  * @beacon_rate: bitrate to be used for beacons
89266cd794eSJohannes Berg  * @ht_cap: HT capabilities (or %NULL if HT isn't enabled)
89366cd794eSJohannes Berg  * @vht_cap: VHT capabilities (or %NULL if VHT isn't enabled)
894244eb9aeSShaul Triebitz  * @he_cap: HE capabilities (or %NULL if HE isn't enabled)
89566cd794eSJohannes Berg  * @ht_required: stations must support HT
89666cd794eSJohannes Berg  * @vht_required: stations must support VHT
897a0de1ca3SJohn Crispin  * @twt_responder: Enable Target Wait Time
898fe494370SSrinivas Dasari  * @flags: flags, as defined in enum cfg80211_ap_settings_flags
8998860020eSJohannes Berg  */
9008860020eSJohannes Berg struct cfg80211_ap_settings {
901683b6d3bSJohannes Berg 	struct cfg80211_chan_def chandef;
902aa430da4SJohannes Berg 
9038860020eSJohannes Berg 	struct cfg80211_beacon_data beacon;
9048860020eSJohannes Berg 
9058860020eSJohannes Berg 	int beacon_interval, dtim_period;
90632e9de84SJouni Malinen 	const u8 *ssid;
90732e9de84SJouni Malinen 	size_t ssid_len;
90832e9de84SJouni Malinen 	enum nl80211_hidden_ssid hidden_ssid;
9095fb628e9SJouni Malinen 	struct cfg80211_crypto_settings crypto;
9105fb628e9SJouni Malinen 	bool privacy;
9115fb628e9SJouni Malinen 	enum nl80211_auth_type auth_type;
91218998c38SEliad Peller 	enum nl80211_smps_mode smps_mode;
9131b658f11SVasanthakumar Thiagarajan 	int inactivity_timeout;
91453cabad7SJohannes Berg 	u8 p2p_ctwindow;
91553cabad7SJohannes Berg 	bool p2p_opp_ps;
91677765eafSVasanthakumar Thiagarajan 	const struct cfg80211_acl_data *acl;
91734d50519SLior David 	bool pbss;
918a7c7fbffSPurushottam Kushwaha 	struct cfg80211_bitrate_mask beacon_rate;
91966cd794eSJohannes Berg 
92066cd794eSJohannes Berg 	const struct ieee80211_ht_cap *ht_cap;
92166cd794eSJohannes Berg 	const struct ieee80211_vht_cap *vht_cap;
922244eb9aeSShaul Triebitz 	const struct ieee80211_he_cap_elem *he_cap;
92366cd794eSJohannes Berg 	bool ht_required, vht_required;
924a0de1ca3SJohn Crispin 	bool twt_responder;
925fe494370SSrinivas Dasari 	u32 flags;
926ed1b6cc7SJohannes Berg };
927ed1b6cc7SJohannes Berg 
9285727ef1bSJohannes Berg /**
92916ef1fe2SSimon Wunderlich  * struct cfg80211_csa_settings - channel switch settings
93016ef1fe2SSimon Wunderlich  *
93116ef1fe2SSimon Wunderlich  * Used for channel switch
93216ef1fe2SSimon Wunderlich  *
93316ef1fe2SSimon Wunderlich  * @chandef: defines the channel to use after the switch
93416ef1fe2SSimon Wunderlich  * @beacon_csa: beacon data while performing the switch
9359a774c78SAndrei Otcheretianski  * @counter_offsets_beacon: offsets of the counters within the beacon (tail)
9369a774c78SAndrei Otcheretianski  * @counter_offsets_presp: offsets of the counters within the probe response
9379a774c78SAndrei Otcheretianski  * @n_counter_offsets_beacon: number of csa counters the beacon (tail)
9389a774c78SAndrei Otcheretianski  * @n_counter_offsets_presp: number of csa counters in the probe response
93916ef1fe2SSimon Wunderlich  * @beacon_after: beacon data to be used on the new channel
94016ef1fe2SSimon Wunderlich  * @radar_required: whether radar detection is required on the new channel
94116ef1fe2SSimon Wunderlich  * @block_tx: whether transmissions should be blocked while changing
94216ef1fe2SSimon Wunderlich  * @count: number of beacons until switch
94316ef1fe2SSimon Wunderlich  */
94416ef1fe2SSimon Wunderlich struct cfg80211_csa_settings {
94516ef1fe2SSimon Wunderlich 	struct cfg80211_chan_def chandef;
94616ef1fe2SSimon Wunderlich 	struct cfg80211_beacon_data beacon_csa;
9479a774c78SAndrei Otcheretianski 	const u16 *counter_offsets_beacon;
9489a774c78SAndrei Otcheretianski 	const u16 *counter_offsets_presp;
9499a774c78SAndrei Otcheretianski 	unsigned int n_counter_offsets_beacon;
9509a774c78SAndrei Otcheretianski 	unsigned int n_counter_offsets_presp;
95116ef1fe2SSimon Wunderlich 	struct cfg80211_beacon_data beacon_after;
95216ef1fe2SSimon Wunderlich 	bool radar_required;
95316ef1fe2SSimon Wunderlich 	bool block_tx;
95416ef1fe2SSimon Wunderlich 	u8 count;
95516ef1fe2SSimon Wunderlich };
95616ef1fe2SSimon Wunderlich 
95751a1aaa6SJohannes Berg #define CFG80211_MAX_NUM_DIFFERENT_CHANNELS 10
95851a1aaa6SJohannes Berg 
95916ef1fe2SSimon Wunderlich /**
960e227300cSPurushottam Kushwaha  * struct iface_combination_params - input parameters for interface combinations
961e227300cSPurushottam Kushwaha  *
962e227300cSPurushottam Kushwaha  * Used to pass interface combination parameters
963e227300cSPurushottam Kushwaha  *
964e227300cSPurushottam Kushwaha  * @num_different_channels: the number of different channels we want
965e227300cSPurushottam Kushwaha  *	to use for verification
966e227300cSPurushottam Kushwaha  * @radar_detect: a bitmap where each bit corresponds to a channel
967e227300cSPurushottam Kushwaha  *	width where radar detection is needed, as in the definition of
968e227300cSPurushottam Kushwaha  *	&struct ieee80211_iface_combination.@radar_detect_widths
969e227300cSPurushottam Kushwaha  * @iftype_num: array with the number of interfaces of each interface
970e227300cSPurushottam Kushwaha  *	type.  The index is the interface type as specified in &enum
971e227300cSPurushottam Kushwaha  *	nl80211_iftype.
9724c8dea63SJohannes Berg  * @new_beacon_int: set this to the beacon interval of a new interface
9734c8dea63SJohannes Berg  *	that's not operating yet, if such is to be checked as part of
9744c8dea63SJohannes Berg  *	the verification
975e227300cSPurushottam Kushwaha  */
976e227300cSPurushottam Kushwaha struct iface_combination_params {
977e227300cSPurushottam Kushwaha 	int num_different_channels;
978e227300cSPurushottam Kushwaha 	u8 radar_detect;
979e227300cSPurushottam Kushwaha 	int iftype_num[NUM_NL80211_IFTYPES];
9804c8dea63SJohannes Berg 	u32 new_beacon_int;
981e227300cSPurushottam Kushwaha };
982e227300cSPurushottam Kushwaha 
983e227300cSPurushottam Kushwaha /**
9843b9ce80cSJohannes Berg  * enum station_parameters_apply_mask - station parameter values to apply
9853b9ce80cSJohannes Berg  * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp)
9869d62a986SJouni Malinen  * @STATION_PARAM_APPLY_CAPABILITY: apply new capability
987f8bacc21SJohannes Berg  * @STATION_PARAM_APPLY_PLINK_STATE: apply new plink state
9883b9ce80cSJohannes Berg  *
9893b9ce80cSJohannes Berg  * Not all station parameters have in-band "no change" signalling,
9903b9ce80cSJohannes Berg  * for those that don't these flags will are used.
9913b9ce80cSJohannes Berg  */
9923b9ce80cSJohannes Berg enum station_parameters_apply_mask {
9933b9ce80cSJohannes Berg 	STATION_PARAM_APPLY_UAPSD = BIT(0),
9949d62a986SJouni Malinen 	STATION_PARAM_APPLY_CAPABILITY = BIT(1),
995f8bacc21SJohannes Berg 	STATION_PARAM_APPLY_PLINK_STATE = BIT(2),
996e96d1cd2SAshok Raj Nagarajan 	STATION_PARAM_APPLY_STA_TXPOWER = BIT(3),
997e96d1cd2SAshok Raj Nagarajan };
998e96d1cd2SAshok Raj Nagarajan 
999e96d1cd2SAshok Raj Nagarajan /**
1000e96d1cd2SAshok Raj Nagarajan  * struct sta_txpwr - station txpower configuration
1001e96d1cd2SAshok Raj Nagarajan  *
1002e96d1cd2SAshok Raj Nagarajan  * Used to configure txpower for station.
1003e96d1cd2SAshok Raj Nagarajan  *
1004e96d1cd2SAshok Raj Nagarajan  * @power: tx power (in dBm) to be used for sending data traffic. If tx power
1005e96d1cd2SAshok Raj Nagarajan  *	is not provided, the default per-interface tx power setting will be
1006e96d1cd2SAshok Raj Nagarajan  *	overriding. Driver should be picking up the lowest tx power, either tx
1007e96d1cd2SAshok Raj Nagarajan  *	power per-interface or per-station.
1008e96d1cd2SAshok Raj Nagarajan  * @type: In particular if TPC %type is NL80211_TX_POWER_LIMITED then tx power
1009e96d1cd2SAshok Raj Nagarajan  *	will be less than or equal to specified from userspace, whereas if TPC
1010e96d1cd2SAshok Raj Nagarajan  *	%type is NL80211_TX_POWER_AUTOMATIC then it indicates default tx power.
1011e96d1cd2SAshok Raj Nagarajan  *	NL80211_TX_POWER_FIXED is not a valid configuration option for
1012e96d1cd2SAshok Raj Nagarajan  *	per peer TPC.
1013e96d1cd2SAshok Raj Nagarajan  */
1014e96d1cd2SAshok Raj Nagarajan struct sta_txpwr {
1015e96d1cd2SAshok Raj Nagarajan 	s16 power;
1016e96d1cd2SAshok Raj Nagarajan 	enum nl80211_tx_power_setting type;
10173b9ce80cSJohannes Berg };
10183b9ce80cSJohannes Berg 
10193b9ce80cSJohannes Berg /**
10205727ef1bSJohannes Berg  * struct station_parameters - station parameters
10215727ef1bSJohannes Berg  *
10225727ef1bSJohannes Berg  * Used to change and create a new station.
10235727ef1bSJohannes Berg  *
10245727ef1bSJohannes Berg  * @vlan: vlan interface station should belong to
10255727ef1bSJohannes Berg  * @supported_rates: supported rates in IEEE 802.11 format
10265727ef1bSJohannes Berg  *	(or NULL for no change)
10275727ef1bSJohannes Berg  * @supported_rates_len: number of supported rates
1028eccb8e8fSJohannes Berg  * @sta_flags_mask: station flags that changed
1029819bf593SJohannes Berg  *	(bitmask of BIT(%NL80211_STA_FLAG_...))
1030eccb8e8fSJohannes Berg  * @sta_flags_set: station flags values
1031819bf593SJohannes Berg  *	(bitmask of BIT(%NL80211_STA_FLAG_...))
10325727ef1bSJohannes Berg  * @listen_interval: listen interval or -1 for no change
10335727ef1bSJohannes Berg  * @aid: AID or zero for no change
10347d27a0baSMasashi Honma  * @peer_aid: mesh peer AID or zero for no change
1035abe37c4bSJohannes Berg  * @plink_action: plink action to take
10369c3990aaSJavier Cardona  * @plink_state: set the peer link state for a station
1037abe37c4bSJohannes Berg  * @ht_capa: HT capabilities of station
1038f461be3eSMahesh Palivela  * @vht_capa: VHT capabilities of station
1039910868dbSEliad Peller  * @uapsd_queues: bitmap of queues configured for uapsd. same format
1040910868dbSEliad Peller  *	as the AC bitmap in the QoS info field
1041910868dbSEliad Peller  * @max_sp: max Service Period. same format as the MAX_SP in the
1042910868dbSEliad Peller  *	QoS info field (but already shifted down)
1043c26887d2SJohannes Berg  * @sta_modify_mask: bitmap indicating which parameters changed
1044c26887d2SJohannes Berg  *	(for those that don't have a natural "no change" value),
1045c26887d2SJohannes Berg  *	see &enum station_parameters_apply_mask
10463b1c5a53SMarco Porsch  * @local_pm: local link-specific mesh power save mode (no change when set
10473b1c5a53SMarco Porsch  *	to unknown)
10489d62a986SJouni Malinen  * @capability: station capability
10499d62a986SJouni Malinen  * @ext_capab: extended capabilities of the station
10509d62a986SJouni Malinen  * @ext_capab_len: number of extended capabilities
1051c01fc9adSSunil Dutt  * @supported_channels: supported channels in IEEE 802.11 format
1052c01fc9adSSunil Dutt  * @supported_channels_len: number of supported channels
1053c01fc9adSSunil Dutt  * @supported_oper_classes: supported oper classes in IEEE 802.11 format
1054c01fc9adSSunil Dutt  * @supported_oper_classes_len: number of supported operating classes
105560f4a7b1SMarek Kwaczynski  * @opmode_notif: operating mode field from Operating Mode Notification
105660f4a7b1SMarek Kwaczynski  * @opmode_notif_used: information if operating mode field is used
105717b94247SAyala Beker  * @support_p2p_ps: information if station supports P2P PS mechanism
1058c4cbaf79SLuca Coelho  * @he_capa: HE capabilities of station
1059c4cbaf79SLuca Coelho  * @he_capa_len: the length of the HE capabilities
106036647055SToke Høiland-Jørgensen  * @airtime_weight: airtime scheduler weight for this station
10615727ef1bSJohannes Berg  */
10625727ef1bSJohannes Berg struct station_parameters {
10632c1aabf3SJohannes Berg 	const u8 *supported_rates;
10645727ef1bSJohannes Berg 	struct net_device *vlan;
1065eccb8e8fSJohannes Berg 	u32 sta_flags_mask, sta_flags_set;
10663b9ce80cSJohannes Berg 	u32 sta_modify_mask;
10675727ef1bSJohannes Berg 	int listen_interval;
10685727ef1bSJohannes Berg 	u16 aid;
10697d27a0baSMasashi Honma 	u16 peer_aid;
10705727ef1bSJohannes Berg 	u8 supported_rates_len;
10712ec600d6SLuis Carlos Cobo 	u8 plink_action;
10729c3990aaSJavier Cardona 	u8 plink_state;
10732c1aabf3SJohannes Berg 	const struct ieee80211_ht_cap *ht_capa;
10742c1aabf3SJohannes Berg 	const struct ieee80211_vht_cap *vht_capa;
1075c75786c9SEliad Peller 	u8 uapsd_queues;
1076c75786c9SEliad Peller 	u8 max_sp;
10773b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode local_pm;
10789d62a986SJouni Malinen 	u16 capability;
10792c1aabf3SJohannes Berg 	const u8 *ext_capab;
10809d62a986SJouni Malinen 	u8 ext_capab_len;
1081c01fc9adSSunil Dutt 	const u8 *supported_channels;
1082c01fc9adSSunil Dutt 	u8 supported_channels_len;
1083c01fc9adSSunil Dutt 	const u8 *supported_oper_classes;
1084c01fc9adSSunil Dutt 	u8 supported_oper_classes_len;
108560f4a7b1SMarek Kwaczynski 	u8 opmode_notif;
108660f4a7b1SMarek Kwaczynski 	bool opmode_notif_used;
108717b94247SAyala Beker 	int support_p2p_ps;
1088c4cbaf79SLuca Coelho 	const struct ieee80211_he_cap_elem *he_capa;
1089c4cbaf79SLuca Coelho 	u8 he_capa_len;
109036647055SToke Høiland-Jørgensen 	u16 airtime_weight;
1091e96d1cd2SAshok Raj Nagarajan 	struct sta_txpwr txpwr;
10925727ef1bSJohannes Berg };
10935727ef1bSJohannes Berg 
1094fd5b74dcSJohannes Berg /**
109589c771e5SJouni Malinen  * struct station_del_parameters - station deletion parameters
109689c771e5SJouni Malinen  *
109789c771e5SJouni Malinen  * Used to delete a station entry (or all stations).
109889c771e5SJouni Malinen  *
109989c771e5SJouni Malinen  * @mac: MAC address of the station to remove or NULL to remove all stations
110098856866SJouni Malinen  * @subtype: Management frame subtype to use for indicating removal
110198856866SJouni Malinen  *	(10 = Disassociation, 12 = Deauthentication)
110298856866SJouni Malinen  * @reason_code: Reason code for the Disassociation/Deauthentication frame
110389c771e5SJouni Malinen  */
110489c771e5SJouni Malinen struct station_del_parameters {
110589c771e5SJouni Malinen 	const u8 *mac;
110698856866SJouni Malinen 	u8 subtype;
110798856866SJouni Malinen 	u16 reason_code;
110889c771e5SJouni Malinen };
110989c771e5SJouni Malinen 
111089c771e5SJouni Malinen /**
111177ee7c89SJohannes Berg  * enum cfg80211_station_type - the type of station being modified
111277ee7c89SJohannes Berg  * @CFG80211_STA_AP_CLIENT: client of an AP interface
111347edb11bSAyala Beker  * @CFG80211_STA_AP_CLIENT_UNASSOC: client of an AP interface that is still
111447edb11bSAyala Beker  *	unassociated (update properties for this type of client is permitted)
111577ee7c89SJohannes Berg  * @CFG80211_STA_AP_MLME_CLIENT: client of an AP interface that has
111677ee7c89SJohannes Berg  *	the AP MLME in the device
111777ee7c89SJohannes Berg  * @CFG80211_STA_AP_STA: AP station on managed interface
111877ee7c89SJohannes Berg  * @CFG80211_STA_IBSS: IBSS station
111977ee7c89SJohannes Berg  * @CFG80211_STA_TDLS_PEER_SETUP: TDLS peer on managed interface (dummy entry
112077ee7c89SJohannes Berg  *	while TDLS setup is in progress, it moves out of this state when
112177ee7c89SJohannes Berg  *	being marked authorized; use this only if TDLS with external setup is
112277ee7c89SJohannes Berg  *	supported/used)
112377ee7c89SJohannes Berg  * @CFG80211_STA_TDLS_PEER_ACTIVE: TDLS peer on managed interface (active
112477ee7c89SJohannes Berg  *	entry that is operating, has been marked authorized by userspace)
1125eef941e6SThomas Pedersen  * @CFG80211_STA_MESH_PEER_KERNEL: peer on mesh interface (kernel managed)
1126eef941e6SThomas Pedersen  * @CFG80211_STA_MESH_PEER_USER: peer on mesh interface (user managed)
112777ee7c89SJohannes Berg  */
112877ee7c89SJohannes Berg enum cfg80211_station_type {
112977ee7c89SJohannes Berg 	CFG80211_STA_AP_CLIENT,
113047edb11bSAyala Beker 	CFG80211_STA_AP_CLIENT_UNASSOC,
113177ee7c89SJohannes Berg 	CFG80211_STA_AP_MLME_CLIENT,
113277ee7c89SJohannes Berg 	CFG80211_STA_AP_STA,
113377ee7c89SJohannes Berg 	CFG80211_STA_IBSS,
113477ee7c89SJohannes Berg 	CFG80211_STA_TDLS_PEER_SETUP,
113577ee7c89SJohannes Berg 	CFG80211_STA_TDLS_PEER_ACTIVE,
1136eef941e6SThomas Pedersen 	CFG80211_STA_MESH_PEER_KERNEL,
1137eef941e6SThomas Pedersen 	CFG80211_STA_MESH_PEER_USER,
113877ee7c89SJohannes Berg };
113977ee7c89SJohannes Berg 
114077ee7c89SJohannes Berg /**
114177ee7c89SJohannes Berg  * cfg80211_check_station_change - validate parameter changes
114277ee7c89SJohannes Berg  * @wiphy: the wiphy this operates on
114377ee7c89SJohannes Berg  * @params: the new parameters for a station
114477ee7c89SJohannes Berg  * @statype: the type of station being modified
114577ee7c89SJohannes Berg  *
114677ee7c89SJohannes Berg  * Utility function for the @change_station driver method. Call this function
114777ee7c89SJohannes Berg  * with the appropriate station type looking up the station (and checking that
114877ee7c89SJohannes Berg  * it exists). It will verify whether the station change is acceptable, and if
114977ee7c89SJohannes Berg  * not will return an error code. Note that it may modify the parameters for
115077ee7c89SJohannes Berg  * backward compatibility reasons, so don't use them before calling this.
115177ee7c89SJohannes Berg  */
115277ee7c89SJohannes Berg int cfg80211_check_station_change(struct wiphy *wiphy,
115377ee7c89SJohannes Berg 				  struct station_parameters *params,
115477ee7c89SJohannes Berg 				  enum cfg80211_station_type statype);
115577ee7c89SJohannes Berg 
115677ee7c89SJohannes Berg /**
1157420e7fabSHenning Rogge  * enum station_info_rate_flags - bitrate info flags
1158420e7fabSHenning Rogge  *
1159420e7fabSHenning Rogge  * Used by the driver to indicate the specific rate transmission
1160420e7fabSHenning Rogge  * type for 802.11n transmissions.
1161420e7fabSHenning Rogge  *
1162db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_MCS: mcs field filled with HT MCS
1163db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_VHT_MCS: mcs field filled with VHT MCS
1164420e7fabSHenning Rogge  * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval
1165db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_60G: 60GHz MCS
1166c4cbaf79SLuca Coelho  * @RATE_INFO_FLAGS_HE_MCS: HE MCS information
1167420e7fabSHenning Rogge  */
1168420e7fabSHenning Rogge enum rate_info_flags {
1169db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_MCS			= BIT(0),
1170db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_VHT_MCS			= BIT(1),
1171b51f3beeSJohannes Berg 	RATE_INFO_FLAGS_SHORT_GI		= BIT(2),
1172b51f3beeSJohannes Berg 	RATE_INFO_FLAGS_60G			= BIT(3),
1173c4cbaf79SLuca Coelho 	RATE_INFO_FLAGS_HE_MCS			= BIT(4),
1174b51f3beeSJohannes Berg };
1175b51f3beeSJohannes Berg 
1176b51f3beeSJohannes Berg /**
1177b51f3beeSJohannes Berg  * enum rate_info_bw - rate bandwidth information
1178b51f3beeSJohannes Berg  *
1179b51f3beeSJohannes Berg  * Used by the driver to indicate the rate bandwidth.
1180b51f3beeSJohannes Berg  *
1181b51f3beeSJohannes Berg  * @RATE_INFO_BW_5: 5 MHz bandwidth
1182b51f3beeSJohannes Berg  * @RATE_INFO_BW_10: 10 MHz bandwidth
1183b51f3beeSJohannes Berg  * @RATE_INFO_BW_20: 20 MHz bandwidth
1184b51f3beeSJohannes Berg  * @RATE_INFO_BW_40: 40 MHz bandwidth
1185b51f3beeSJohannes Berg  * @RATE_INFO_BW_80: 80 MHz bandwidth
1186b51f3beeSJohannes Berg  * @RATE_INFO_BW_160: 160 MHz bandwidth
1187c4cbaf79SLuca Coelho  * @RATE_INFO_BW_HE_RU: bandwidth determined by HE RU allocation
1188b51f3beeSJohannes Berg  */
1189b51f3beeSJohannes Berg enum rate_info_bw {
1190842be75cSJohannes Berg 	RATE_INFO_BW_20 = 0,
1191b51f3beeSJohannes Berg 	RATE_INFO_BW_5,
1192b51f3beeSJohannes Berg 	RATE_INFO_BW_10,
1193b51f3beeSJohannes Berg 	RATE_INFO_BW_40,
1194b51f3beeSJohannes Berg 	RATE_INFO_BW_80,
1195b51f3beeSJohannes Berg 	RATE_INFO_BW_160,
1196c4cbaf79SLuca Coelho 	RATE_INFO_BW_HE_RU,
1197420e7fabSHenning Rogge };
1198420e7fabSHenning Rogge 
1199420e7fabSHenning Rogge /**
1200420e7fabSHenning Rogge  * struct rate_info - bitrate information
1201420e7fabSHenning Rogge  *
1202420e7fabSHenning Rogge  * Information about a receiving or transmitting bitrate
1203420e7fabSHenning Rogge  *
1204420e7fabSHenning Rogge  * @flags: bitflag of flags from &enum rate_info_flags
1205c4cbaf79SLuca Coelho  * @mcs: mcs index if struct describes an HT/VHT/HE rate
1206420e7fabSHenning Rogge  * @legacy: bitrate in 100kbit/s for 802.11abg
1207c4cbaf79SLuca Coelho  * @nss: number of streams (VHT & HE only)
1208b51f3beeSJohannes Berg  * @bw: bandwidth (from &enum rate_info_bw)
1209c4cbaf79SLuca Coelho  * @he_gi: HE guard interval (from &enum nl80211_he_gi)
1210c4cbaf79SLuca Coelho  * @he_dcm: HE DCM value
1211c4cbaf79SLuca Coelho  * @he_ru_alloc: HE RU allocation (from &enum nl80211_he_ru_alloc,
1212c4cbaf79SLuca Coelho  *	only valid if bw is %RATE_INFO_BW_HE_RU)
1213420e7fabSHenning Rogge  */
1214420e7fabSHenning Rogge struct rate_info {
1215420e7fabSHenning Rogge 	u8 flags;
1216420e7fabSHenning Rogge 	u8 mcs;
1217420e7fabSHenning Rogge 	u16 legacy;
1218db9c64cfSJohannes Berg 	u8 nss;
1219b51f3beeSJohannes Berg 	u8 bw;
1220c4cbaf79SLuca Coelho 	u8 he_gi;
1221c4cbaf79SLuca Coelho 	u8 he_dcm;
1222c4cbaf79SLuca Coelho 	u8 he_ru_alloc;
1223fd5b74dcSJohannes Berg };
1224fd5b74dcSJohannes Berg 
1225fd5b74dcSJohannes Berg /**
1226f4263c98SPaul Stewart  * enum station_info_rate_flags - bitrate info flags
1227f4263c98SPaul Stewart  *
1228f4263c98SPaul Stewart  * Used by the driver to indicate the specific rate transmission
1229f4263c98SPaul Stewart  * type for 802.11n transmissions.
1230f4263c98SPaul Stewart  *
1231f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_CTS_PROT: whether CTS protection is enabled
1232f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_SHORT_PREAMBLE: whether short preamble is enabled
1233f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_SHORT_SLOT_TIME: whether short slot time is enabled
1234f4263c98SPaul Stewart  */
1235f4263c98SPaul Stewart enum bss_param_flags {
1236f4263c98SPaul Stewart 	BSS_PARAM_FLAGS_CTS_PROT	= 1<<0,
1237f4263c98SPaul Stewart 	BSS_PARAM_FLAGS_SHORT_PREAMBLE	= 1<<1,
1238f4263c98SPaul Stewart 	BSS_PARAM_FLAGS_SHORT_SLOT_TIME	= 1<<2,
1239f4263c98SPaul Stewart };
1240f4263c98SPaul Stewart 
1241f4263c98SPaul Stewart /**
1242f4263c98SPaul Stewart  * struct sta_bss_parameters - BSS parameters for the attached station
1243f4263c98SPaul Stewart  *
1244f4263c98SPaul Stewart  * Information about the currently associated BSS
1245f4263c98SPaul Stewart  *
1246f4263c98SPaul Stewart  * @flags: bitflag of flags from &enum bss_param_flags
1247f4263c98SPaul Stewart  * @dtim_period: DTIM period for the BSS
1248f4263c98SPaul Stewart  * @beacon_interval: beacon interval
1249f4263c98SPaul Stewart  */
1250f4263c98SPaul Stewart struct sta_bss_parameters {
1251f4263c98SPaul Stewart 	u8 flags;
1252f4263c98SPaul Stewart 	u8 dtim_period;
1253f4263c98SPaul Stewart 	u16 beacon_interval;
1254f4263c98SPaul Stewart };
1255f4263c98SPaul Stewart 
12566de39808SJohannes Berg /**
125752539ca8SToke Høiland-Jørgensen  * struct cfg80211_txq_stats - TXQ statistics for this TID
125852539ca8SToke Høiland-Jørgensen  * @filled: bitmap of flags using the bits of &enum nl80211_txq_stats to
125952539ca8SToke Høiland-Jørgensen  *	indicate the relevant values in this struct are filled
126052539ca8SToke Høiland-Jørgensen  * @backlog_bytes: total number of bytes currently backlogged
126152539ca8SToke Høiland-Jørgensen  * @backlog_packets: total number of packets currently backlogged
126252539ca8SToke Høiland-Jørgensen  * @flows: number of new flows seen
126352539ca8SToke Høiland-Jørgensen  * @drops: total number of packets dropped
126452539ca8SToke Høiland-Jørgensen  * @ecn_marks: total number of packets marked with ECN CE
126552539ca8SToke Høiland-Jørgensen  * @overlimit: number of drops due to queue space overflow
126652539ca8SToke Høiland-Jørgensen  * @overmemory: number of drops due to memory limit overflow
126752539ca8SToke Høiland-Jørgensen  * @collisions: number of hash collisions
126852539ca8SToke Høiland-Jørgensen  * @tx_bytes: total number of bytes dequeued
126952539ca8SToke Høiland-Jørgensen  * @tx_packets: total number of packets dequeued
127052539ca8SToke Høiland-Jørgensen  * @max_flows: maximum number of flows supported
127152539ca8SToke Høiland-Jørgensen  */
127252539ca8SToke Høiland-Jørgensen struct cfg80211_txq_stats {
127352539ca8SToke Høiland-Jørgensen 	u32 filled;
127452539ca8SToke Høiland-Jørgensen 	u32 backlog_bytes;
127552539ca8SToke Høiland-Jørgensen 	u32 backlog_packets;
127652539ca8SToke Høiland-Jørgensen 	u32 flows;
127752539ca8SToke Høiland-Jørgensen 	u32 drops;
127852539ca8SToke Høiland-Jørgensen 	u32 ecn_marks;
127952539ca8SToke Høiland-Jørgensen 	u32 overlimit;
128052539ca8SToke Høiland-Jørgensen 	u32 overmemory;
128152539ca8SToke Høiland-Jørgensen 	u32 collisions;
128252539ca8SToke Høiland-Jørgensen 	u32 tx_bytes;
128352539ca8SToke Høiland-Jørgensen 	u32 tx_packets;
128452539ca8SToke Høiland-Jørgensen 	u32 max_flows;
128552539ca8SToke Høiland-Jørgensen };
128652539ca8SToke Høiland-Jørgensen 
128752539ca8SToke Høiland-Jørgensen /**
12886de39808SJohannes Berg  * struct cfg80211_tid_stats - per-TID statistics
12896de39808SJohannes Berg  * @filled: bitmap of flags using the bits of &enum nl80211_tid_stats to
12906de39808SJohannes Berg  *	indicate the relevant values in this struct are filled
12916de39808SJohannes Berg  * @rx_msdu: number of received MSDUs
12926de39808SJohannes Berg  * @tx_msdu: number of (attempted) transmitted MSDUs
12936de39808SJohannes Berg  * @tx_msdu_retries: number of retries (not counting the first) for
12946de39808SJohannes Berg  *	transmitted MSDUs
12956de39808SJohannes Berg  * @tx_msdu_failed: number of failed transmitted MSDUs
129652539ca8SToke Høiland-Jørgensen  * @txq_stats: TXQ statistics
12976de39808SJohannes Berg  */
12986de39808SJohannes Berg struct cfg80211_tid_stats {
12996de39808SJohannes Berg 	u32 filled;
13006de39808SJohannes Berg 	u64 rx_msdu;
13016de39808SJohannes Berg 	u64 tx_msdu;
13026de39808SJohannes Berg 	u64 tx_msdu_retries;
13036de39808SJohannes Berg 	u64 tx_msdu_failed;
130452539ca8SToke Høiland-Jørgensen 	struct cfg80211_txq_stats txq_stats;
13056de39808SJohannes Berg };
13066de39808SJohannes Berg 
1307119363c7SFelix Fietkau #define IEEE80211_MAX_CHAINS	4
1308119363c7SFelix Fietkau 
1309f4263c98SPaul Stewart /**
13102ec600d6SLuis Carlos Cobo  * struct station_info - station information
1311fd5b74dcSJohannes Berg  *
13122ec600d6SLuis Carlos Cobo  * Station information filled by driver for get_station() and dump_station.
1313fd5b74dcSJohannes Berg  *
1314319090bfSJohannes Berg  * @filled: bitflag of flags using the bits of &enum nl80211_sta_info to
1315319090bfSJohannes Berg  *	indicate the relevant values in this struct for them
1316ebe27c91SMohammed Shafi Shajakhan  * @connected_time: time(in secs) since a station is last connected
1317fd5b74dcSJohannes Berg  * @inactive_time: time since last station activity (tx/rx) in milliseconds
13188d791361SJohannes Berg  * @rx_bytes: bytes (size of MPDUs) received from this station
13198d791361SJohannes Berg  * @tx_bytes: bytes (size of MPDUs) transmitted to this station
13202ec600d6SLuis Carlos Cobo  * @llid: mesh local link id
13212ec600d6SLuis Carlos Cobo  * @plid: mesh peer link id
13222ec600d6SLuis Carlos Cobo  * @plink_state: mesh peer link state
132373c3df3bSJohannes Berg  * @signal: The signal strength, type depends on the wiphy's signal_type.
132473c3df3bSJohannes Berg  *	For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
132573c3df3bSJohannes Berg  * @signal_avg: Average signal strength, type depends on the wiphy's signal_type.
132673c3df3bSJohannes Berg  *	For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
1327119363c7SFelix Fietkau  * @chains: bitmask for filled values in @chain_signal, @chain_signal_avg
1328119363c7SFelix Fietkau  * @chain_signal: per-chain signal strength of last received packet in dBm
1329119363c7SFelix Fietkau  * @chain_signal_avg: per-chain signal strength average in dBm
1330858022aaSRandy Dunlap  * @txrate: current unicast bitrate from this station
1331858022aaSRandy Dunlap  * @rxrate: current unicast bitrate to this station
13328d791361SJohannes Berg  * @rx_packets: packets (MSDUs & MMPDUs) received from this station
13338d791361SJohannes Berg  * @tx_packets: packets (MSDUs & MMPDUs) transmitted to this station
13348d791361SJohannes Berg  * @tx_retries: cumulative retry counts (MPDUs)
13358d791361SJohannes Berg  * @tx_failed: number of failed transmissions (MPDUs) (retries exceeded, no ACK)
13365a5c731aSBen Greear  * @rx_dropped_misc:  Dropped for un-specified reason.
13371ba01458SRandy Dunlap  * @bss_param: current BSS parameters
1338f5ea9120SJohannes Berg  * @generation: generation number for nl80211 dumps.
1339f5ea9120SJohannes Berg  *	This number should increase every time the list of stations
1340f5ea9120SJohannes Berg  *	changes, i.e. when a station is added or removed, so that
1341f5ea9120SJohannes Berg  *	userspace can tell whether it got a consistent snapshot.
134250d3dfb7SJouni Malinen  * @assoc_req_ies: IEs from (Re)Association Request.
134350d3dfb7SJouni Malinen  *	This is used only when in AP mode with drivers that do not use
134450d3dfb7SJouni Malinen  *	user space MLME/SME implementation. The information is provided for
134550d3dfb7SJouni Malinen  *	the cfg80211_new_sta() calls to notify user space of the IEs.
134650d3dfb7SJouni Malinen  * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets.
1347c26887d2SJohannes Berg  * @sta_flags: station flags mask & values
1348a85e1d55SPaul Stewart  * @beacon_loss_count: Number of times beacon loss event has triggered.
1349d299a1f2SJavier Cardona  * @t_offset: Time offset of the station relative to this host.
13503b1c5a53SMarco Porsch  * @local_pm: local mesh STA power save mode
13513b1c5a53SMarco Porsch  * @peer_pm: peer mesh STA power save mode
13523b1c5a53SMarco Porsch  * @nonpeer_pm: non-peer mesh STA power save mode
1353867d849fSAntonio Quartulli  * @expected_throughput: expected throughput in kbps (including 802.11 headers)
1354867d849fSAntonio Quartulli  *	towards this station.
1355a76b1942SJohannes Berg  * @rx_beacon: number of beacons received from this peer
1356a76b1942SJohannes Berg  * @rx_beacon_signal_avg: signal strength average (in dBm) for beacons received
1357a76b1942SJohannes Berg  *	from this peer
1358dbdaee7aSBob Copeland  * @connected_to_gate: true if mesh STA has a path to mesh gate
1359739960f1SMohammed Shafi Shajakhan  * @rx_duration: aggregate PPDU duration(usecs) for all the frames from a peer
136036647055SToke Høiland-Jørgensen  * @tx_duration: aggregate PPDU duration(usecs) for all the frames to a peer
136136647055SToke Høiland-Jørgensen  * @airtime_weight: current airtime scheduling weight
13626de39808SJohannes Berg  * @pertid: per-TID statistics, see &struct cfg80211_tid_stats, using the last
13636de39808SJohannes Berg  *	(IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs.
13648689c051SArend van Spriel  *	Note that this doesn't use the @filled bit, but is used if non-NULL.
1365c4b50cd3SVenkateswara Naralasetty  * @ack_signal: signal strength (in dBm) of the last ACK frame.
136681d5439dSBalaji Pothunoori  * @avg_ack_signal: average rssi value of ack packet for the no of msdu's has
136781d5439dSBalaji Pothunoori  *	been sent.
13680d4e14a3SAnkita Bajaj  * @rx_mpdu_count: number of MPDUs received from this station
13690d4e14a3SAnkita Bajaj  * @fcs_err_count: number of packets (MPDUs) received from this station with
13700d4e14a3SAnkita Bajaj  *	an FCS error. This counter should be incremented only when TA of the
13710d4e14a3SAnkita Bajaj  *	received packet with an FCS error matches the peer MAC address.
1372ab60633cSNarayanraddi Masti  * @airtime_link_metric: mesh airtime link metric.
1373fd5b74dcSJohannes Berg  */
13742ec600d6SLuis Carlos Cobo struct station_info {
1375739960f1SMohammed Shafi Shajakhan 	u64 filled;
1376ebe27c91SMohammed Shafi Shajakhan 	u32 connected_time;
1377fd5b74dcSJohannes Berg 	u32 inactive_time;
137842745e03SVladimir Kondratiev 	u64 rx_bytes;
137942745e03SVladimir Kondratiev 	u64 tx_bytes;
13802ec600d6SLuis Carlos Cobo 	u16 llid;
13812ec600d6SLuis Carlos Cobo 	u16 plid;
13822ec600d6SLuis Carlos Cobo 	u8 plink_state;
1383420e7fabSHenning Rogge 	s8 signal;
1384541a45a1SBruno Randolf 	s8 signal_avg;
1385119363c7SFelix Fietkau 
1386119363c7SFelix Fietkau 	u8 chains;
1387119363c7SFelix Fietkau 	s8 chain_signal[IEEE80211_MAX_CHAINS];
1388119363c7SFelix Fietkau 	s8 chain_signal_avg[IEEE80211_MAX_CHAINS];
1389119363c7SFelix Fietkau 
1390420e7fabSHenning Rogge 	struct rate_info txrate;
1391c8dcfd8aSFelix Fietkau 	struct rate_info rxrate;
139298c8a60aSJouni Malinen 	u32 rx_packets;
139398c8a60aSJouni Malinen 	u32 tx_packets;
1394b206b4efSBruno Randolf 	u32 tx_retries;
1395b206b4efSBruno Randolf 	u32 tx_failed;
13965a5c731aSBen Greear 	u32 rx_dropped_misc;
1397f4263c98SPaul Stewart 	struct sta_bss_parameters bss_param;
1398bb6e753eSHelmut Schaa 	struct nl80211_sta_flag_update sta_flags;
1399f5ea9120SJohannes Berg 
1400f5ea9120SJohannes Berg 	int generation;
140150d3dfb7SJouni Malinen 
140250d3dfb7SJouni Malinen 	const u8 *assoc_req_ies;
140350d3dfb7SJouni Malinen 	size_t assoc_req_ies_len;
1404f612cedfSJouni Malinen 
1405a85e1d55SPaul Stewart 	u32 beacon_loss_count;
1406d299a1f2SJavier Cardona 	s64 t_offset;
14073b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode local_pm;
14083b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode peer_pm;
14093b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode nonpeer_pm;
1410a85e1d55SPaul Stewart 
1411867d849fSAntonio Quartulli 	u32 expected_throughput;
1412a76b1942SJohannes Berg 
141336647055SToke Høiland-Jørgensen 	u64 tx_duration;
1414739960f1SMohammed Shafi Shajakhan 	u64 rx_duration;
141536647055SToke Høiland-Jørgensen 	u64 rx_beacon;
1416a76b1942SJohannes Berg 	u8 rx_beacon_signal_avg;
1417dbdaee7aSBob Copeland 	u8 connected_to_gate;
1418dbdaee7aSBob Copeland 
14198689c051SArend van Spriel 	struct cfg80211_tid_stats *pertid;
1420c4b50cd3SVenkateswara Naralasetty 	s8 ack_signal;
142181d5439dSBalaji Pothunoori 	s8 avg_ack_signal;
14220d4e14a3SAnkita Bajaj 
142336647055SToke Høiland-Jørgensen 	u16 airtime_weight;
142436647055SToke Høiland-Jørgensen 
14250d4e14a3SAnkita Bajaj 	u32 rx_mpdu_count;
14260d4e14a3SAnkita Bajaj 	u32 fcs_err_count;
1427ab60633cSNarayanraddi Masti 
1428ab60633cSNarayanraddi Masti 	u32 airtime_link_metric;
1429fd5b74dcSJohannes Berg };
1430fd5b74dcSJohannes Berg 
143161aaa0e8SLinus Lüssing #if IS_ENABLED(CONFIG_CFG80211)
143266f7ac50SMichael Wu /**
14337406353dSAntonio Quartulli  * cfg80211_get_station - retrieve information about a given station
14347406353dSAntonio Quartulli  * @dev: the device where the station is supposed to be connected to
14357406353dSAntonio Quartulli  * @mac_addr: the mac address of the station of interest
14367406353dSAntonio Quartulli  * @sinfo: pointer to the structure to fill with the information
14377406353dSAntonio Quartulli  *
14387406353dSAntonio Quartulli  * Returns 0 on success and sinfo is filled with the available information
14397406353dSAntonio Quartulli  * otherwise returns a negative error code and the content of sinfo has to be
14407406353dSAntonio Quartulli  * considered undefined.
14417406353dSAntonio Quartulli  */
14427406353dSAntonio Quartulli int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr,
14437406353dSAntonio Quartulli 			 struct station_info *sinfo);
144461aaa0e8SLinus Lüssing #else
144561aaa0e8SLinus Lüssing static inline int cfg80211_get_station(struct net_device *dev,
144661aaa0e8SLinus Lüssing 				       const u8 *mac_addr,
144761aaa0e8SLinus Lüssing 				       struct station_info *sinfo)
144861aaa0e8SLinus Lüssing {
144961aaa0e8SLinus Lüssing 	return -ENOENT;
145061aaa0e8SLinus Lüssing }
145161aaa0e8SLinus Lüssing #endif
14527406353dSAntonio Quartulli 
14537406353dSAntonio Quartulli /**
145466f7ac50SMichael Wu  * enum monitor_flags - monitor flags
145566f7ac50SMichael Wu  *
145666f7ac50SMichael Wu  * Monitor interface configuration flags. Note that these must be the bits
145766f7ac50SMichael Wu  * according to the nl80211 flags.
145866f7ac50SMichael Wu  *
1459818a986eSJohannes Berg  * @MONITOR_FLAG_CHANGED: set if the flags were changed
146066f7ac50SMichael Wu  * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS
146166f7ac50SMichael Wu  * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP
146266f7ac50SMichael Wu  * @MONITOR_FLAG_CONTROL: pass control frames
146366f7ac50SMichael Wu  * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering
146466f7ac50SMichael Wu  * @MONITOR_FLAG_COOK_FRAMES: report frames after processing
1465e057d3c3SFelix Fietkau  * @MONITOR_FLAG_ACTIVE: active monitor, ACKs frames on its MAC address
146666f7ac50SMichael Wu  */
146766f7ac50SMichael Wu enum monitor_flags {
1468818a986eSJohannes Berg 	MONITOR_FLAG_CHANGED		= 1<<__NL80211_MNTR_FLAG_INVALID,
146966f7ac50SMichael Wu 	MONITOR_FLAG_FCSFAIL		= 1<<NL80211_MNTR_FLAG_FCSFAIL,
147066f7ac50SMichael Wu 	MONITOR_FLAG_PLCPFAIL		= 1<<NL80211_MNTR_FLAG_PLCPFAIL,
147166f7ac50SMichael Wu 	MONITOR_FLAG_CONTROL		= 1<<NL80211_MNTR_FLAG_CONTROL,
147266f7ac50SMichael Wu 	MONITOR_FLAG_OTHER_BSS		= 1<<NL80211_MNTR_FLAG_OTHER_BSS,
147366f7ac50SMichael Wu 	MONITOR_FLAG_COOK_FRAMES	= 1<<NL80211_MNTR_FLAG_COOK_FRAMES,
1474e057d3c3SFelix Fietkau 	MONITOR_FLAG_ACTIVE		= 1<<NL80211_MNTR_FLAG_ACTIVE,
147566f7ac50SMichael Wu };
147666f7ac50SMichael Wu 
14772ec600d6SLuis Carlos Cobo /**
14782ec600d6SLuis Carlos Cobo  * enum mpath_info_flags -  mesh path information flags
14792ec600d6SLuis Carlos Cobo  *
14802ec600d6SLuis Carlos Cobo  * Used by the driver to indicate which info in &struct mpath_info it has filled
14812ec600d6SLuis Carlos Cobo  * in during get_station() or dump_station().
14822ec600d6SLuis Carlos Cobo  *
1483abe37c4bSJohannes Berg  * @MPATH_INFO_FRAME_QLEN: @frame_qlen filled
1484abe37c4bSJohannes Berg  * @MPATH_INFO_SN: @sn filled
1485abe37c4bSJohannes Berg  * @MPATH_INFO_METRIC: @metric filled
1486abe37c4bSJohannes Berg  * @MPATH_INFO_EXPTIME: @exptime filled
1487abe37c4bSJohannes Berg  * @MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled
1488abe37c4bSJohannes Berg  * @MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled
1489abe37c4bSJohannes Berg  * @MPATH_INFO_FLAGS: @flags filled
1490cc241636SJulan Hsu  * @MPATH_INFO_HOP_COUNT: @hop_count filled
14919874b71fSJohannes Berg  * @MPATH_INFO_PATH_CHANGE: @path_change_count filled
14922ec600d6SLuis Carlos Cobo  */
14932ec600d6SLuis Carlos Cobo enum mpath_info_flags {
14942ec600d6SLuis Carlos Cobo 	MPATH_INFO_FRAME_QLEN		= BIT(0),
1495d19b3bf6SRui Paulo 	MPATH_INFO_SN			= BIT(1),
14962ec600d6SLuis Carlos Cobo 	MPATH_INFO_METRIC		= BIT(2),
14972ec600d6SLuis Carlos Cobo 	MPATH_INFO_EXPTIME		= BIT(3),
14982ec600d6SLuis Carlos Cobo 	MPATH_INFO_DISCOVERY_TIMEOUT	= BIT(4),
14992ec600d6SLuis Carlos Cobo 	MPATH_INFO_DISCOVERY_RETRIES	= BIT(5),
15002ec600d6SLuis Carlos Cobo 	MPATH_INFO_FLAGS		= BIT(6),
1501540bbcb9SJulan Hsu 	MPATH_INFO_HOP_COUNT		= BIT(7),
1502540bbcb9SJulan Hsu 	MPATH_INFO_PATH_CHANGE		= BIT(8),
15032ec600d6SLuis Carlos Cobo };
15042ec600d6SLuis Carlos Cobo 
15052ec600d6SLuis Carlos Cobo /**
15062ec600d6SLuis Carlos Cobo  * struct mpath_info - mesh path information
15072ec600d6SLuis Carlos Cobo  *
15082ec600d6SLuis Carlos Cobo  * Mesh path information filled by driver for get_mpath() and dump_mpath().
15092ec600d6SLuis Carlos Cobo  *
15102ec600d6SLuis Carlos Cobo  * @filled: bitfield of flags from &enum mpath_info_flags
15112ec600d6SLuis Carlos Cobo  * @frame_qlen: number of queued frames for this destination
1512d19b3bf6SRui Paulo  * @sn: target sequence number
15132ec600d6SLuis Carlos Cobo  * @metric: metric (cost) of this mesh path
15142ec600d6SLuis Carlos Cobo  * @exptime: expiration time for the mesh path from now, in msecs
15152ec600d6SLuis Carlos Cobo  * @flags: mesh path flags
15162ec600d6SLuis Carlos Cobo  * @discovery_timeout: total mesh path discovery timeout, in msecs
15172ec600d6SLuis Carlos Cobo  * @discovery_retries: mesh path discovery retries
1518f5ea9120SJohannes Berg  * @generation: generation number for nl80211 dumps.
1519f5ea9120SJohannes Berg  *	This number should increase every time the list of mesh paths
1520f5ea9120SJohannes Berg  *	changes, i.e. when a station is added or removed, so that
1521f5ea9120SJohannes Berg  *	userspace can tell whether it got a consistent snapshot.
1522cc241636SJulan Hsu  * @hop_count: hops to destination
1523540bbcb9SJulan Hsu  * @path_change_count: total number of path changes to destination
15242ec600d6SLuis Carlos Cobo  */
15252ec600d6SLuis Carlos Cobo struct mpath_info {
15262ec600d6SLuis Carlos Cobo 	u32 filled;
15272ec600d6SLuis Carlos Cobo 	u32 frame_qlen;
1528d19b3bf6SRui Paulo 	u32 sn;
15292ec600d6SLuis Carlos Cobo 	u32 metric;
15302ec600d6SLuis Carlos Cobo 	u32 exptime;
15312ec600d6SLuis Carlos Cobo 	u32 discovery_timeout;
15322ec600d6SLuis Carlos Cobo 	u8 discovery_retries;
15332ec600d6SLuis Carlos Cobo 	u8 flags;
1534cc241636SJulan Hsu 	u8 hop_count;
1535540bbcb9SJulan Hsu 	u32 path_change_count;
1536f5ea9120SJohannes Berg 
1537f5ea9120SJohannes Berg 	int generation;
15382ec600d6SLuis Carlos Cobo };
15392ec600d6SLuis Carlos Cobo 
15409f1ba906SJouni Malinen /**
15419f1ba906SJouni Malinen  * struct bss_parameters - BSS parameters
15429f1ba906SJouni Malinen  *
15439f1ba906SJouni Malinen  * Used to change BSS parameters (mainly for AP mode).
15449f1ba906SJouni Malinen  *
15459f1ba906SJouni Malinen  * @use_cts_prot: Whether to use CTS protection
15469f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
15479f1ba906SJouni Malinen  * @use_short_preamble: Whether the use of short preambles is allowed
15489f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
15499f1ba906SJouni Malinen  * @use_short_slot_time: Whether the use of short slot time is allowed
15509f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
155190c97a04SJouni Malinen  * @basic_rates: basic rates in IEEE 802.11 format
155290c97a04SJouni Malinen  *	(or NULL for no change)
155390c97a04SJouni Malinen  * @basic_rates_len: number of basic rates
1554fd8aaaf3SFelix Fietkau  * @ap_isolate: do not forward packets between connected stations
155550b12f59SHelmut Schaa  * @ht_opmode: HT Operation mode
155650b12f59SHelmut Schaa  * 	(u16 = opmode, -1 = do not change)
155753cabad7SJohannes Berg  * @p2p_ctwindow: P2P CT Window (-1 = no change)
155853cabad7SJohannes Berg  * @p2p_opp_ps: P2P opportunistic PS (-1 = no change)
15599f1ba906SJouni Malinen  */
15609f1ba906SJouni Malinen struct bss_parameters {
15619f1ba906SJouni Malinen 	int use_cts_prot;
15629f1ba906SJouni Malinen 	int use_short_preamble;
15639f1ba906SJouni Malinen 	int use_short_slot_time;
1564c1e5f471SJohannes Berg 	const u8 *basic_rates;
156590c97a04SJouni Malinen 	u8 basic_rates_len;
1566fd8aaaf3SFelix Fietkau 	int ap_isolate;
156750b12f59SHelmut Schaa 	int ht_opmode;
156853cabad7SJohannes Berg 	s8 p2p_ctwindow, p2p_opp_ps;
15699f1ba906SJouni Malinen };
15702ec600d6SLuis Carlos Cobo 
15713ddd53f3SChun-Yeow Yeoh /**
157229cbe68cSJohannes Berg  * struct mesh_config - 802.11s mesh configuration
157329cbe68cSJohannes Berg  *
157429cbe68cSJohannes Berg  * These parameters can be changed while the mesh is active.
15753ddd53f3SChun-Yeow Yeoh  *
15763ddd53f3SChun-Yeow Yeoh  * @dot11MeshRetryTimeout: the initial retry timeout in millisecond units used
15773ddd53f3SChun-Yeow Yeoh  *	by the Mesh Peering Open message
15783ddd53f3SChun-Yeow Yeoh  * @dot11MeshConfirmTimeout: the initial retry timeout in millisecond units
15793ddd53f3SChun-Yeow Yeoh  *	used by the Mesh Peering Open message
15803ddd53f3SChun-Yeow Yeoh  * @dot11MeshHoldingTimeout: the confirm timeout in millisecond units used by
15813ddd53f3SChun-Yeow Yeoh  *	the mesh peering management to close a mesh peering
15823ddd53f3SChun-Yeow Yeoh  * @dot11MeshMaxPeerLinks: the maximum number of peer links allowed on this
15833ddd53f3SChun-Yeow Yeoh  *	mesh interface
15843ddd53f3SChun-Yeow Yeoh  * @dot11MeshMaxRetries: the maximum number of peer link open retries that can
15853ddd53f3SChun-Yeow Yeoh  *	be sent to establish a new peer link instance in a mesh
15863ddd53f3SChun-Yeow Yeoh  * @dot11MeshTTL: the value of TTL field set at a source mesh STA
15873ddd53f3SChun-Yeow Yeoh  * @element_ttl: the value of TTL field set at a mesh STA for path selection
15883ddd53f3SChun-Yeow Yeoh  *	elements
15893ddd53f3SChun-Yeow Yeoh  * @auto_open_plinks: whether we should automatically open peer links when we
15903ddd53f3SChun-Yeow Yeoh  *	detect compatible mesh peers
15913ddd53f3SChun-Yeow Yeoh  * @dot11MeshNbrOffsetMaxNeighbor: the maximum number of neighbors to
15923ddd53f3SChun-Yeow Yeoh  *	synchronize to for 11s default synchronization method
15933ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPmaxPREQretries: the number of action frames containing a PREQ
15943ddd53f3SChun-Yeow Yeoh  *	that an originator mesh STA can send to a particular path target
15953ddd53f3SChun-Yeow Yeoh  * @path_refresh_time: how frequently to refresh mesh paths in milliseconds
15963ddd53f3SChun-Yeow Yeoh  * @min_discovery_timeout: the minimum length of time to wait until giving up on
15973ddd53f3SChun-Yeow Yeoh  *	a path discovery in milliseconds
15983ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPactivePathTimeout: the time (in TUs) for which mesh STAs
15993ddd53f3SChun-Yeow Yeoh  *	receiving a PREQ shall consider the forwarding information from the
16003ddd53f3SChun-Yeow Yeoh  *	root to be valid. (TU = time unit)
16013ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPpreqMinInterval: the minimum interval of time (in TUs) during
16023ddd53f3SChun-Yeow Yeoh  *	which a mesh STA can send only one action frame containing a PREQ
16033ddd53f3SChun-Yeow Yeoh  *	element
16043ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPperrMinInterval: the minimum interval of time (in TUs) during
16053ddd53f3SChun-Yeow Yeoh  *	which a mesh STA can send only one Action frame containing a PERR
16063ddd53f3SChun-Yeow Yeoh  *	element
16073ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPnetDiameterTraversalTime: the interval of time (in TUs) that
16083ddd53f3SChun-Yeow Yeoh  *	it takes for an HWMP information element to propagate across the mesh
16093ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPRootMode: the configuration of a mesh STA as root mesh STA
16103ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPRannInterval: the interval of time (in TUs) between root
16113ddd53f3SChun-Yeow Yeoh  *	announcements are transmitted
16123ddd53f3SChun-Yeow Yeoh  * @dot11MeshGateAnnouncementProtocol: whether to advertise that this mesh
16133ddd53f3SChun-Yeow Yeoh  *	station has access to a broader network beyond the MBSS. (This is
16143ddd53f3SChun-Yeow Yeoh  *	missnamed in draft 12.0: dot11MeshGateAnnouncementProtocol set to true
16153ddd53f3SChun-Yeow Yeoh  *	only means that the station will announce others it's a mesh gate, but
16163ddd53f3SChun-Yeow Yeoh  *	not necessarily using the gate announcement protocol. Still keeping the
16173ddd53f3SChun-Yeow Yeoh  *	same nomenclature to be in sync with the spec)
16183ddd53f3SChun-Yeow Yeoh  * @dot11MeshForwarding: whether the Mesh STA is forwarding or non-forwarding
16193ddd53f3SChun-Yeow Yeoh  *	entity (default is TRUE - forwarding entity)
16203ddd53f3SChun-Yeow Yeoh  * @rssi_threshold: the threshold for average signal strength of candidate
16213ddd53f3SChun-Yeow Yeoh  *	station to establish a peer link
16223ddd53f3SChun-Yeow Yeoh  * @ht_opmode: mesh HT protection mode
1623ac1073a6SChun-Yeow Yeoh  *
1624ac1073a6SChun-Yeow Yeoh  * @dot11MeshHWMPactivePathToRootTimeout: The time (in TUs) for which mesh STAs
1625ac1073a6SChun-Yeow Yeoh  *	receiving a proactive PREQ shall consider the forwarding information to
1626ac1073a6SChun-Yeow Yeoh  *	the root mesh STA to be valid.
1627ac1073a6SChun-Yeow Yeoh  *
1628ac1073a6SChun-Yeow Yeoh  * @dot11MeshHWMProotInterval: The interval of time (in TUs) between proactive
1629ac1073a6SChun-Yeow Yeoh  *	PREQs are transmitted.
1630728b19e5SChun-Yeow Yeoh  * @dot11MeshHWMPconfirmationInterval: The minimum interval of time (in TUs)
1631728b19e5SChun-Yeow Yeoh  *	during which a mesh STA can send only one Action frame containing
1632728b19e5SChun-Yeow Yeoh  *	a PREQ element for root path confirmation.
16333b1c5a53SMarco Porsch  * @power_mode: The default mesh power save mode which will be the initial
16343b1c5a53SMarco Porsch  *	setting for new peer links.
16353b1c5a53SMarco Porsch  * @dot11MeshAwakeWindowDuration: The duration in TUs the STA will remain awake
16363b1c5a53SMarco Porsch  *	after transmitting its beacon.
16378e7c0538SColleen Twitty  * @plink_timeout: If no tx activity is seen from a STA we've established
16388e7c0538SColleen Twitty  *	peering with for longer than this time (in seconds), then remove it
16398e7c0538SColleen Twitty  *	from the STA's list of peers.  Default is 30 minutes.
164001d66fbdSBob Copeland  * @dot11MeshConnectedToMeshGate: if set to true, advertise that this STA is
164101d66fbdSBob Copeland  *      connected to a mesh gate in mesh formation info.  If false, the
164201d66fbdSBob Copeland  *      value in mesh formation is determined by the presence of root paths
164301d66fbdSBob Copeland  *      in the mesh path table
164429cbe68cSJohannes Berg  */
164593da9cc1Scolin@cozybit.com struct mesh_config {
164693da9cc1Scolin@cozybit.com 	u16 dot11MeshRetryTimeout;
164793da9cc1Scolin@cozybit.com 	u16 dot11MeshConfirmTimeout;
164893da9cc1Scolin@cozybit.com 	u16 dot11MeshHoldingTimeout;
164993da9cc1Scolin@cozybit.com 	u16 dot11MeshMaxPeerLinks;
165093da9cc1Scolin@cozybit.com 	u8 dot11MeshMaxRetries;
165193da9cc1Scolin@cozybit.com 	u8 dot11MeshTTL;
165245904f21SJavier Cardona 	u8 element_ttl;
165393da9cc1Scolin@cozybit.com 	bool auto_open_plinks;
1654d299a1f2SJavier Cardona 	u32 dot11MeshNbrOffsetMaxNeighbor;
165593da9cc1Scolin@cozybit.com 	u8 dot11MeshHWMPmaxPREQretries;
165693da9cc1Scolin@cozybit.com 	u32 path_refresh_time;
165793da9cc1Scolin@cozybit.com 	u16 min_discovery_timeout;
165893da9cc1Scolin@cozybit.com 	u32 dot11MeshHWMPactivePathTimeout;
165993da9cc1Scolin@cozybit.com 	u16 dot11MeshHWMPpreqMinInterval;
1660dca7e943SThomas Pedersen 	u16 dot11MeshHWMPperrMinInterval;
166193da9cc1Scolin@cozybit.com 	u16 dot11MeshHWMPnetDiameterTraversalTime;
166263c5723bSRui Paulo 	u8 dot11MeshHWMPRootMode;
166301d66fbdSBob Copeland 	bool dot11MeshConnectedToMeshGate;
16640507e159SJavier Cardona 	u16 dot11MeshHWMPRannInterval;
166516dd7267SJavier Cardona 	bool dot11MeshGateAnnouncementProtocol;
166694f90656SChun-Yeow Yeoh 	bool dot11MeshForwarding;
166755335137SAshok Nagarajan 	s32 rssi_threshold;
166870c33eaaSAshok Nagarajan 	u16 ht_opmode;
1669ac1073a6SChun-Yeow Yeoh 	u32 dot11MeshHWMPactivePathToRootTimeout;
1670ac1073a6SChun-Yeow Yeoh 	u16 dot11MeshHWMProotInterval;
1671728b19e5SChun-Yeow Yeoh 	u16 dot11MeshHWMPconfirmationInterval;
16723b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode power_mode;
16733b1c5a53SMarco Porsch 	u16 dot11MeshAwakeWindowDuration;
16748e7c0538SColleen Twitty 	u32 plink_timeout;
167593da9cc1Scolin@cozybit.com };
167693da9cc1Scolin@cozybit.com 
167731888487SJouni Malinen /**
167829cbe68cSJohannes Berg  * struct mesh_setup - 802.11s mesh setup configuration
1679683b6d3bSJohannes Berg  * @chandef: defines the channel to use
168029cbe68cSJohannes Berg  * @mesh_id: the mesh ID
168129cbe68cSJohannes Berg  * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes
1682d299a1f2SJavier Cardona  * @sync_method: which synchronization method to use
1683c80d545dSJavier Cardona  * @path_sel_proto: which path selection protocol to use
1684c80d545dSJavier Cardona  * @path_metric: which metric to use
16856e16d90bSColleen Twitty  * @auth_id: which authentication method this mesh is using
1686581a8b0fSJavier Cardona  * @ie: vendor information elements (optional)
1687581a8b0fSJavier Cardona  * @ie_len: length of vendor information elements
1688b130e5ceSJavier Cardona  * @is_authenticated: this mesh requires authentication
1689b130e5ceSJavier Cardona  * @is_secure: this mesh uses security
1690bb2798d4SThomas Pedersen  * @user_mpm: userspace handles all MPM functions
16919bdbf04dSMarco Porsch  * @dtim_period: DTIM period to use
16929bdbf04dSMarco Porsch  * @beacon_interval: beacon interval to use
16934bb62344SChun-Yeow Yeoh  * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a]
1694ffb3cf30SAshok Nagarajan  * @basic_rates: basic rates to use when creating the mesh
16958564e382SJohannes Berg  * @beacon_rate: bitrate to be used for beacons
1696d37d49c2SBenjamin Berg  * @userspace_handles_dfs: whether user space controls DFS operation, i.e.
1697d37d49c2SBenjamin Berg  *	changes the channel when a radar is detected. This is required
1698d37d49c2SBenjamin Berg  *	to operate on DFS channels.
16991224f583SDenis Kenzior  * @control_port_over_nl80211: TRUE if userspace expects to exchange control
17001224f583SDenis Kenzior  *	port frames over NL80211 instead of the network interface.
170129cbe68cSJohannes Berg  *
170229cbe68cSJohannes Berg  * These parameters are fixed when the mesh is created.
170329cbe68cSJohannes Berg  */
170429cbe68cSJohannes Berg struct mesh_setup {
1705683b6d3bSJohannes Berg 	struct cfg80211_chan_def chandef;
170629cbe68cSJohannes Berg 	const u8 *mesh_id;
170729cbe68cSJohannes Berg 	u8 mesh_id_len;
1708d299a1f2SJavier Cardona 	u8 sync_method;
1709c80d545dSJavier Cardona 	u8 path_sel_proto;
1710c80d545dSJavier Cardona 	u8 path_metric;
17116e16d90bSColleen Twitty 	u8 auth_id;
1712581a8b0fSJavier Cardona 	const u8 *ie;
1713581a8b0fSJavier Cardona 	u8 ie_len;
1714b130e5ceSJavier Cardona 	bool is_authenticated;
171515d5dda6SJavier Cardona 	bool is_secure;
1716bb2798d4SThomas Pedersen 	bool user_mpm;
17179bdbf04dSMarco Porsch 	u8 dtim_period;
17189bdbf04dSMarco Porsch 	u16 beacon_interval;
171957fbcce3SJohannes Berg 	int mcast_rate[NUM_NL80211_BANDS];
1720ffb3cf30SAshok Nagarajan 	u32 basic_rates;
17218564e382SJohannes Berg 	struct cfg80211_bitrate_mask beacon_rate;
1722d37d49c2SBenjamin Berg 	bool userspace_handles_dfs;
17231224f583SDenis Kenzior 	bool control_port_over_nl80211;
172429cbe68cSJohannes Berg };
172529cbe68cSJohannes Berg 
172629cbe68cSJohannes Berg /**
17276e0bd6c3SRostislav Lisovy  * struct ocb_setup - 802.11p OCB mode setup configuration
17286e0bd6c3SRostislav Lisovy  * @chandef: defines the channel to use
17296e0bd6c3SRostislav Lisovy  *
17306e0bd6c3SRostislav Lisovy  * These parameters are fixed when connecting to the network
17316e0bd6c3SRostislav Lisovy  */
17326e0bd6c3SRostislav Lisovy struct ocb_setup {
17336e0bd6c3SRostislav Lisovy 	struct cfg80211_chan_def chandef;
17346e0bd6c3SRostislav Lisovy };
17356e0bd6c3SRostislav Lisovy 
17366e0bd6c3SRostislav Lisovy /**
173731888487SJouni Malinen  * struct ieee80211_txq_params - TX queue parameters
1738a3304b0aSJohannes Berg  * @ac: AC identifier
173931888487SJouni Malinen  * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled
174031888487SJouni Malinen  * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range
174131888487SJouni Malinen  *	1..32767]
174231888487SJouni Malinen  * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range
174331888487SJouni Malinen  *	1..32767]
174431888487SJouni Malinen  * @aifs: Arbitration interframe space [0..255]
174531888487SJouni Malinen  */
174631888487SJouni Malinen struct ieee80211_txq_params {
1747a3304b0aSJohannes Berg 	enum nl80211_ac ac;
174831888487SJouni Malinen 	u16 txop;
174931888487SJouni Malinen 	u16 cwmin;
175031888487SJouni Malinen 	u16 cwmax;
175131888487SJouni Malinen 	u8 aifs;
175231888487SJouni Malinen };
175331888487SJouni Malinen 
1754d70e9693SJohannes Berg /**
1755d70e9693SJohannes Berg  * DOC: Scanning and BSS list handling
1756d70e9693SJohannes Berg  *
1757d70e9693SJohannes Berg  * The scanning process itself is fairly simple, but cfg80211 offers quite
1758d70e9693SJohannes Berg  * a bit of helper functionality. To start a scan, the scan operation will
1759d70e9693SJohannes Berg  * be invoked with a scan definition. This scan definition contains the
1760d70e9693SJohannes Berg  * channels to scan, and the SSIDs to send probe requests for (including the
1761d70e9693SJohannes Berg  * wildcard, if desired). A passive scan is indicated by having no SSIDs to
1762d70e9693SJohannes Berg  * probe. Additionally, a scan request may contain extra information elements
1763d70e9693SJohannes Berg  * that should be added to the probe request. The IEs are guaranteed to be
1764d70e9693SJohannes Berg  * well-formed, and will not exceed the maximum length the driver advertised
1765d70e9693SJohannes Berg  * in the wiphy structure.
1766d70e9693SJohannes Berg  *
1767d70e9693SJohannes Berg  * When scanning finds a BSS, cfg80211 needs to be notified of that, because
1768d70e9693SJohannes Berg  * it is responsible for maintaining the BSS list; the driver should not
1769d70e9693SJohannes Berg  * maintain a list itself. For this notification, various functions exist.
1770d70e9693SJohannes Berg  *
1771d70e9693SJohannes Berg  * Since drivers do not maintain a BSS list, there are also a number of
1772d70e9693SJohannes Berg  * functions to search for a BSS and obtain information about it from the
1773d70e9693SJohannes Berg  * BSS structure cfg80211 maintains. The BSS list is also made available
1774d70e9693SJohannes Berg  * to userspace.
1775d70e9693SJohannes Berg  */
177672bdcf34SJouni Malinen 
1777704232c2SJohannes Berg /**
17782a519311SJohannes Berg  * struct cfg80211_ssid - SSID description
17792a519311SJohannes Berg  * @ssid: the SSID
17802a519311SJohannes Berg  * @ssid_len: length of the ssid
17812a519311SJohannes Berg  */
17822a519311SJohannes Berg struct cfg80211_ssid {
17832a519311SJohannes Berg 	u8 ssid[IEEE80211_MAX_SSID_LEN];
17842a519311SJohannes Berg 	u8 ssid_len;
17852a519311SJohannes Berg };
17862a519311SJohannes Berg 
17872a519311SJohannes Berg /**
17881d76250bSAvraham Stern  * struct cfg80211_scan_info - information about completed scan
17891d76250bSAvraham Stern  * @scan_start_tsf: scan start time in terms of the TSF of the BSS that the
17901d76250bSAvraham Stern  *	wireless device that requested the scan is connected to. If this
17911d76250bSAvraham Stern  *	information is not available, this field is left zero.
17921d76250bSAvraham Stern  * @tsf_bssid: the BSSID according to which %scan_start_tsf is set.
17931d76250bSAvraham Stern  * @aborted: set to true if the scan was aborted for any reason,
17941d76250bSAvraham Stern  *	userspace will be notified of that
17951d76250bSAvraham Stern  */
17961d76250bSAvraham Stern struct cfg80211_scan_info {
17971d76250bSAvraham Stern 	u64 scan_start_tsf;
17981d76250bSAvraham Stern 	u8 tsf_bssid[ETH_ALEN] __aligned(2);
17991d76250bSAvraham Stern 	bool aborted;
18001d76250bSAvraham Stern };
18011d76250bSAvraham Stern 
18021d76250bSAvraham Stern /**
18032a519311SJohannes Berg  * struct cfg80211_scan_request - scan request description
18042a519311SJohannes Berg  *
18052a519311SJohannes Berg  * @ssids: SSIDs to scan for (active scan only)
18062a519311SJohannes Berg  * @n_ssids: number of SSIDs
18072a519311SJohannes Berg  * @channels: channels to scan on.
1808ca3dbc20SHelmut Schaa  * @n_channels: total number of channels to scan
1809dcd6eac1SSimon Wunderlich  * @scan_width: channel width for scanning
181070692ad2SJouni Malinen  * @ie: optional information element(s) to add into Probe Request or %NULL
181170692ad2SJouni Malinen  * @ie_len: length of ie in octets
18121d76250bSAvraham Stern  * @duration: how long to listen on each channel, in TUs. If
18131d76250bSAvraham Stern  *	%duration_mandatory is not set, this is the maximum dwell time and
18141d76250bSAvraham Stern  *	the actual dwell time may be shorter.
18151d76250bSAvraham Stern  * @duration_mandatory: if set, the scan duration must be as specified by the
18161d76250bSAvraham Stern  *	%duration field.
1817ed473771SSam Leffler  * @flags: bit field of flags controlling operation
181834850ab2SJohannes Berg  * @rates: bitmap of rates to advertise for each band
18192a519311SJohannes Berg  * @wiphy: the wiphy this was for
182015d6030bSSam Leffler  * @scan_start: time (in jiffies) when the scan started
1821fd014284SJohannes Berg  * @wdev: the wireless device to scan for
18221d76250bSAvraham Stern  * @info: (internal) information about completed scan
18235fe231e8SJohannes Berg  * @notified: (internal) scan request was notified as done or aborted
1824e9f935e3SRajkumar Manoharan  * @no_cck: used to send probe requests at non CCK rate in 2GHz band
1825ad2b26abSJohannes Berg  * @mac_addr: MAC address used with randomisation
1826ad2b26abSJohannes Berg  * @mac_addr_mask: MAC address mask used with randomisation, bits that
1827ad2b26abSJohannes Berg  *	are 0 in the mask should be randomised, bits that are 1 should
1828ad2b26abSJohannes Berg  *	be taken from the @mac_addr
1829818965d3SJouni Malinen  * @bssid: BSSID to scan for (most commonly, the wildcard BSSID)
18302a519311SJohannes Berg  */
18312a519311SJohannes Berg struct cfg80211_scan_request {
18322a519311SJohannes Berg 	struct cfg80211_ssid *ssids;
18332a519311SJohannes Berg 	int n_ssids;
18342a519311SJohannes Berg 	u32 n_channels;
1835dcd6eac1SSimon Wunderlich 	enum nl80211_bss_scan_width scan_width;
1836de95a54bSJohannes Berg 	const u8 *ie;
183770692ad2SJouni Malinen 	size_t ie_len;
18381d76250bSAvraham Stern 	u16 duration;
18391d76250bSAvraham Stern 	bool duration_mandatory;
1840ed473771SSam Leffler 	u32 flags;
18412a519311SJohannes Berg 
184257fbcce3SJohannes Berg 	u32 rates[NUM_NL80211_BANDS];
184334850ab2SJohannes Berg 
1844fd014284SJohannes Berg 	struct wireless_dev *wdev;
1845fd014284SJohannes Berg 
1846ad2b26abSJohannes Berg 	u8 mac_addr[ETH_ALEN] __aligned(2);
1847ad2b26abSJohannes Berg 	u8 mac_addr_mask[ETH_ALEN] __aligned(2);
1848818965d3SJouni Malinen 	u8 bssid[ETH_ALEN] __aligned(2);
1849ad2b26abSJohannes Berg 
18502a519311SJohannes Berg 	/* internal */
18512a519311SJohannes Berg 	struct wiphy *wiphy;
185215d6030bSSam Leffler 	unsigned long scan_start;
18531d76250bSAvraham Stern 	struct cfg80211_scan_info info;
18541d76250bSAvraham Stern 	bool notified;
1855e9f935e3SRajkumar Manoharan 	bool no_cck;
18565ba63533SJohannes Berg 
18575ba63533SJohannes Berg 	/* keep last */
18585ba63533SJohannes Berg 	struct ieee80211_channel *channels[0];
18592a519311SJohannes Berg };
18602a519311SJohannes Berg 
1861ad2b26abSJohannes Berg static inline void get_random_mask_addr(u8 *buf, const u8 *addr, const u8 *mask)
1862ad2b26abSJohannes Berg {
1863ad2b26abSJohannes Berg 	int i;
1864ad2b26abSJohannes Berg 
1865ad2b26abSJohannes Berg 	get_random_bytes(buf, ETH_ALEN);
1866ad2b26abSJohannes Berg 	for (i = 0; i < ETH_ALEN; i++) {
1867ad2b26abSJohannes Berg 		buf[i] &= ~mask[i];
1868ad2b26abSJohannes Berg 		buf[i] |= addr[i] & mask[i];
1869ad2b26abSJohannes Berg 	}
1870ad2b26abSJohannes Berg }
1871ad2b26abSJohannes Berg 
18722a519311SJohannes Berg /**
1873a1f1c21cSLuciano Coelho  * struct cfg80211_match_set - sets of attributes to match
1874a1f1c21cSLuciano Coelho  *
18753007e352SArend Van Spriel  * @ssid: SSID to be matched; may be zero-length in case of BSSID match
18763007e352SArend Van Spriel  *	or no match (RSSI only)
18773007e352SArend Van Spriel  * @bssid: BSSID to be matched; may be all-zero BSSID in case of SSID match
18783007e352SArend Van Spriel  *	or no match (RSSI only)
1879ea73cbceSJohannes Berg  * @rssi_thold: don't report scan results below this threshold (in s32 dBm)
18801e1b11b6Svamsi krishna  * @per_band_rssi_thold: Minimum rssi threshold for each band to be applied
18811e1b11b6Svamsi krishna  *	for filtering out scan results received. Drivers advertize this support
18821e1b11b6Svamsi krishna  *	of band specific rssi based filtering through the feature capability
18831e1b11b6Svamsi krishna  *	%NL80211_EXT_FEATURE_SCHED_SCAN_BAND_SPECIFIC_RSSI_THOLD. These band
18841e1b11b6Svamsi krishna  *	specific rssi thresholds take precedence over rssi_thold, if specified.
18851e1b11b6Svamsi krishna  *	If not specified for any band, it will be assigned with rssi_thold of
18861e1b11b6Svamsi krishna  *	corresponding matchset.
1887a1f1c21cSLuciano Coelho  */
1888a1f1c21cSLuciano Coelho struct cfg80211_match_set {
1889a1f1c21cSLuciano Coelho 	struct cfg80211_ssid ssid;
18903007e352SArend Van Spriel 	u8 bssid[ETH_ALEN];
1891ea73cbceSJohannes Berg 	s32 rssi_thold;
18921e1b11b6Svamsi krishna 	s32 per_band_rssi_thold[NUM_NL80211_BANDS];
1893a1f1c21cSLuciano Coelho };
1894a1f1c21cSLuciano Coelho 
1895a1f1c21cSLuciano Coelho /**
18963b06d277SAvraham Stern  * struct cfg80211_sched_scan_plan - scan plan for scheduled scan
18973b06d277SAvraham Stern  *
18983b06d277SAvraham Stern  * @interval: interval between scheduled scan iterations. In seconds.
18993b06d277SAvraham Stern  * @iterations: number of scan iterations in this scan plan. Zero means
19003b06d277SAvraham Stern  *	infinite loop.
19013b06d277SAvraham Stern  *	The last scan plan will always have this parameter set to zero,
19023b06d277SAvraham Stern  *	all other scan plans will have a finite number of iterations.
19033b06d277SAvraham Stern  */
19043b06d277SAvraham Stern struct cfg80211_sched_scan_plan {
19053b06d277SAvraham Stern 	u32 interval;
19063b06d277SAvraham Stern 	u32 iterations;
19073b06d277SAvraham Stern };
19083b06d277SAvraham Stern 
19093b06d277SAvraham Stern /**
1910bf95ecdbSvamsi krishna  * struct cfg80211_bss_select_adjust - BSS selection with RSSI adjustment.
1911bf95ecdbSvamsi krishna  *
1912bf95ecdbSvamsi krishna  * @band: band of BSS which should match for RSSI level adjustment.
1913bf95ecdbSvamsi krishna  * @delta: value of RSSI level adjustment.
1914bf95ecdbSvamsi krishna  */
1915bf95ecdbSvamsi krishna struct cfg80211_bss_select_adjust {
1916bf95ecdbSvamsi krishna 	enum nl80211_band band;
1917bf95ecdbSvamsi krishna 	s8 delta;
1918bf95ecdbSvamsi krishna };
1919bf95ecdbSvamsi krishna 
1920bf95ecdbSvamsi krishna /**
1921807f8a8cSLuciano Coelho  * struct cfg80211_sched_scan_request - scheduled scan request description
1922807f8a8cSLuciano Coelho  *
192396b08fd6SArend Van Spriel  * @reqid: identifies this request.
1924807f8a8cSLuciano Coelho  * @ssids: SSIDs to scan for (passed in the probe_reqs in active scans)
1925807f8a8cSLuciano Coelho  * @n_ssids: number of SSIDs
1926807f8a8cSLuciano Coelho  * @n_channels: total number of channels to scan
1927dcd6eac1SSimon Wunderlich  * @scan_width: channel width for scanning
1928807f8a8cSLuciano Coelho  * @ie: optional information element(s) to add into Probe Request or %NULL
1929807f8a8cSLuciano Coelho  * @ie_len: length of ie in octets
1930ed473771SSam Leffler  * @flags: bit field of flags controlling operation
1931a1f1c21cSLuciano Coelho  * @match_sets: sets of parameters to be matched for a scan result
1932a1f1c21cSLuciano Coelho  * 	entry to be considered valid and to be passed to the host
1933a1f1c21cSLuciano Coelho  * 	(others are filtered out).
1934a1f1c21cSLuciano Coelho  *	If ommited, all results are passed.
1935a1f1c21cSLuciano Coelho  * @n_match_sets: number of match sets
19366406c919SJohannes Berg  * @report_results: indicates that results were reported for this request
1937807f8a8cSLuciano Coelho  * @wiphy: the wiphy this was for
1938807f8a8cSLuciano Coelho  * @dev: the interface
1939077f897aSJohannes Berg  * @scan_start: start time of the scheduled scan
1940807f8a8cSLuciano Coelho  * @channels: channels to scan
1941ea73cbceSJohannes Berg  * @min_rssi_thold: for drivers only supporting a single threshold, this
1942ea73cbceSJohannes Berg  *	contains the minimum over all matchsets
1943ad2b26abSJohannes Berg  * @mac_addr: MAC address used with randomisation
1944ad2b26abSJohannes Berg  * @mac_addr_mask: MAC address mask used with randomisation, bits that
1945ad2b26abSJohannes Berg  *	are 0 in the mask should be randomised, bits that are 1 should
1946ad2b26abSJohannes Berg  *	be taken from the @mac_addr
19473b06d277SAvraham Stern  * @scan_plans: scan plans to be executed in this scheduled scan. Lowest
19483b06d277SAvraham Stern  *	index must be executed first.
19493b06d277SAvraham Stern  * @n_scan_plans: number of scan plans, at least 1.
195031a60ed1SJukka Rissanen  * @rcu_head: RCU callback used to free the struct
195193a1e86cSJukka Rissanen  * @owner_nlportid: netlink portid of owner (if this should is a request
195293a1e86cSJukka Rissanen  *	owned by a particular socket)
1953ca986ad9SArend Van Spriel  * @nl_owner_dead: netlink owner socket was closed - this request be freed
1954ca986ad9SArend Van Spriel  * @list: for keeping list of requests.
19559c748934SLuciano Coelho  * @delay: delay in seconds to use before starting the first scan
19569c748934SLuciano Coelho  *	cycle.  The driver may ignore this parameter and start
19579c748934SLuciano Coelho  *	immediately (or at any other time), if this feature is not
19589c748934SLuciano Coelho  *	supported.
1959bf95ecdbSvamsi krishna  * @relative_rssi_set: Indicates whether @relative_rssi is set or not.
1960bf95ecdbSvamsi krishna  * @relative_rssi: Relative RSSI threshold in dB to restrict scan result
1961bf95ecdbSvamsi krishna  *	reporting in connected state to cases where a matching BSS is determined
1962bf95ecdbSvamsi krishna  *	to have better or slightly worse RSSI than the current connected BSS.
1963bf95ecdbSvamsi krishna  *	The relative RSSI threshold values are ignored in disconnected state.
1964bf95ecdbSvamsi krishna  * @rssi_adjust: delta dB of RSSI preference to be given to the BSSs that belong
1965bf95ecdbSvamsi krishna  *	to the specified band while deciding whether a better BSS is reported
1966bf95ecdbSvamsi krishna  *	using @relative_rssi. If delta is a negative number, the BSSs that
1967bf95ecdbSvamsi krishna  *	belong to the specified band will be penalized by delta dB in relative
1968bf95ecdbSvamsi krishna  *	comparisions.
1969807f8a8cSLuciano Coelho  */
1970807f8a8cSLuciano Coelho struct cfg80211_sched_scan_request {
197196b08fd6SArend Van Spriel 	u64 reqid;
1972807f8a8cSLuciano Coelho 	struct cfg80211_ssid *ssids;
1973807f8a8cSLuciano Coelho 	int n_ssids;
1974807f8a8cSLuciano Coelho 	u32 n_channels;
1975dcd6eac1SSimon Wunderlich 	enum nl80211_bss_scan_width scan_width;
1976807f8a8cSLuciano Coelho 	const u8 *ie;
1977807f8a8cSLuciano Coelho 	size_t ie_len;
1978ed473771SSam Leffler 	u32 flags;
1979a1f1c21cSLuciano Coelho 	struct cfg80211_match_set *match_sets;
1980a1f1c21cSLuciano Coelho 	int n_match_sets;
1981ea73cbceSJohannes Berg 	s32 min_rssi_thold;
19829c748934SLuciano Coelho 	u32 delay;
19833b06d277SAvraham Stern 	struct cfg80211_sched_scan_plan *scan_plans;
19843b06d277SAvraham Stern 	int n_scan_plans;
1985807f8a8cSLuciano Coelho 
1986ad2b26abSJohannes Berg 	u8 mac_addr[ETH_ALEN] __aligned(2);
1987ad2b26abSJohannes Berg 	u8 mac_addr_mask[ETH_ALEN] __aligned(2);
1988ad2b26abSJohannes Berg 
1989bf95ecdbSvamsi krishna 	bool relative_rssi_set;
1990bf95ecdbSvamsi krishna 	s8 relative_rssi;
1991bf95ecdbSvamsi krishna 	struct cfg80211_bss_select_adjust rssi_adjust;
1992bf95ecdbSvamsi krishna 
1993807f8a8cSLuciano Coelho 	/* internal */
1994807f8a8cSLuciano Coelho 	struct wiphy *wiphy;
1995807f8a8cSLuciano Coelho 	struct net_device *dev;
199615d6030bSSam Leffler 	unsigned long scan_start;
1997b34939b9SArend Van Spriel 	bool report_results;
199831a60ed1SJukka Rissanen 	struct rcu_head rcu_head;
199993a1e86cSJukka Rissanen 	u32 owner_nlportid;
2000ca986ad9SArend Van Spriel 	bool nl_owner_dead;
2001ca986ad9SArend Van Spriel 	struct list_head list;
2002807f8a8cSLuciano Coelho 
2003807f8a8cSLuciano Coelho 	/* keep last */
2004807f8a8cSLuciano Coelho 	struct ieee80211_channel *channels[0];
2005807f8a8cSLuciano Coelho };
2006807f8a8cSLuciano Coelho 
2007807f8a8cSLuciano Coelho /**
20082a519311SJohannes Berg  * enum cfg80211_signal_type - signal type
20092a519311SJohannes Berg  *
20102a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available
20112a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm)
20122a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100
20132a519311SJohannes Berg  */
20142a519311SJohannes Berg enum cfg80211_signal_type {
20152a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_NONE,
20162a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_MBM,
20172a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_UNSPEC,
20182a519311SJohannes Berg };
20192a519311SJohannes Berg 
20202a519311SJohannes Berg /**
20216e19bc4bSDmitry Shmidt  * struct cfg80211_inform_bss - BSS inform data
20226e19bc4bSDmitry Shmidt  * @chan: channel the frame was received on
20236e19bc4bSDmitry Shmidt  * @scan_width: scan width that was used
20246e19bc4bSDmitry Shmidt  * @signal: signal strength value, according to the wiphy's
20256e19bc4bSDmitry Shmidt  *	signal type
20266e19bc4bSDmitry Shmidt  * @boottime_ns: timestamp (CLOCK_BOOTTIME) when the information was
20276e19bc4bSDmitry Shmidt  *	received; should match the time when the frame was actually
20286e19bc4bSDmitry Shmidt  *	received by the device (not just by the host, in case it was
20296e19bc4bSDmitry Shmidt  *	buffered on the device) and be accurate to about 10ms.
20306e19bc4bSDmitry Shmidt  *	If the frame isn't buffered, just passing the return value of
20319285ec4cSJason A. Donenfeld  *	ktime_get_boottime_ns() is likely appropriate.
20321d76250bSAvraham Stern  * @parent_tsf: the time at the start of reception of the first octet of the
20331d76250bSAvraham Stern  *	timestamp field of the frame. The time is the TSF of the BSS specified
20341d76250bSAvraham Stern  *	by %parent_bssid.
20351d76250bSAvraham Stern  * @parent_bssid: the BSS according to which %parent_tsf is set. This is set to
20361d76250bSAvraham Stern  *	the BSS that requested the scan in which the beacon/probe was received.
2037983dafaaSSunil Dutt  * @chains: bitmask for filled values in @chain_signal.
2038983dafaaSSunil Dutt  * @chain_signal: per-chain signal strength of last received BSS in dBm.
20396e19bc4bSDmitry Shmidt  */
20406e19bc4bSDmitry Shmidt struct cfg80211_inform_bss {
20416e19bc4bSDmitry Shmidt 	struct ieee80211_channel *chan;
20426e19bc4bSDmitry Shmidt 	enum nl80211_bss_scan_width scan_width;
20436e19bc4bSDmitry Shmidt 	s32 signal;
20446e19bc4bSDmitry Shmidt 	u64 boottime_ns;
20451d76250bSAvraham Stern 	u64 parent_tsf;
20461d76250bSAvraham Stern 	u8 parent_bssid[ETH_ALEN] __aligned(2);
2047983dafaaSSunil Dutt 	u8 chains;
2048983dafaaSSunil Dutt 	s8 chain_signal[IEEE80211_MAX_CHAINS];
20496e19bc4bSDmitry Shmidt };
20506e19bc4bSDmitry Shmidt 
20516e19bc4bSDmitry Shmidt /**
20522aa4d456SAkira Moroo  * struct cfg80211_bss_ies - BSS entry IE data
20538cef2c9dSJohannes Berg  * @tsf: TSF contained in the frame that carried these IEs
20549caf0364SJohannes Berg  * @rcu_head: internal use, for freeing
20559caf0364SJohannes Berg  * @len: length of the IEs
20560e227084SJohannes Berg  * @from_beacon: these IEs are known to come from a beacon
20579caf0364SJohannes Berg  * @data: IE data
20589caf0364SJohannes Berg  */
20599caf0364SJohannes Berg struct cfg80211_bss_ies {
20608cef2c9dSJohannes Berg 	u64 tsf;
20619caf0364SJohannes Berg 	struct rcu_head rcu_head;
20629caf0364SJohannes Berg 	int len;
20630e227084SJohannes Berg 	bool from_beacon;
20649caf0364SJohannes Berg 	u8 data[];
20659caf0364SJohannes Berg };
20669caf0364SJohannes Berg 
20679caf0364SJohannes Berg /**
20682a519311SJohannes Berg  * struct cfg80211_bss - BSS description
20692a519311SJohannes Berg  *
20702a519311SJohannes Berg  * This structure describes a BSS (which may also be a mesh network)
20712a519311SJohannes Berg  * for use in scan results and similar.
20722a519311SJohannes Berg  *
2073abe37c4bSJohannes Berg  * @channel: channel this BSS is on
2074dcd6eac1SSimon Wunderlich  * @scan_width: width of the control channel
20752a519311SJohannes Berg  * @bssid: BSSID of the BSS
20762a519311SJohannes Berg  * @beacon_interval: the beacon interval as from the frame
20772a519311SJohannes Berg  * @capability: the capability field in host byte order
207883c7aa1aSJohannes Berg  * @ies: the information elements (Note that there is no guarantee that these
207983c7aa1aSJohannes Berg  *	are well-formed!); this is a pointer to either the beacon_ies or
208083c7aa1aSJohannes Berg  *	proberesp_ies depending on whether Probe Response frame has been
208183c7aa1aSJohannes Berg  *	received. It is always non-%NULL.
208234a6eddbSJouni Malinen  * @beacon_ies: the information elements from the last Beacon frame
2083776b3580SJohannes Berg  *	(implementation note: if @hidden_beacon_bss is set this struct doesn't
2084776b3580SJohannes Berg  *	own the beacon_ies, but they're just pointers to the ones from the
2085776b3580SJohannes Berg  *	@hidden_beacon_bss struct)
208634a6eddbSJouni Malinen  * @proberesp_ies: the information elements from the last Probe Response frame
2087776b3580SJohannes Berg  * @hidden_beacon_bss: in case this BSS struct represents a probe response from
2088776b3580SJohannes Berg  *	a BSS that hides the SSID in its beacon, this points to the BSS struct
2089776b3580SJohannes Berg  *	that holds the beacon data. @beacon_ies is still valid, of course, and
2090776b3580SJohannes Berg  *	points to the same data as hidden_beacon_bss->beacon_ies in that case.
2091851ae31dSJohannes Berg  * @transmitted_bss: pointer to the transmitted BSS, if this is a
2092851ae31dSJohannes Berg  *	non-transmitted one (multi-BSSID support)
2093851ae31dSJohannes Berg  * @nontrans_list: list of non-transmitted BSS, if this is a transmitted one
2094851ae31dSJohannes Berg  *	(multi-BSSID support)
209577965c97SJohannes Berg  * @signal: signal strength value (type depends on the wiphy's signal_type)
2096983dafaaSSunil Dutt  * @chains: bitmask for filled values in @chain_signal.
2097983dafaaSSunil Dutt  * @chain_signal: per-chain signal strength of last received BSS in dBm.
20980cd01efbSSara Sharon  * @bssid_index: index in the multiple BSS set
20990cd01efbSSara Sharon  * @max_bssid_indicator: max number of members in the BSS set
21002a519311SJohannes Berg  * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
21012a519311SJohannes Berg  */
21022a519311SJohannes Berg struct cfg80211_bss {
21032a519311SJohannes Berg 	struct ieee80211_channel *channel;
2104dcd6eac1SSimon Wunderlich 	enum nl80211_bss_scan_width scan_width;
21052a519311SJohannes Berg 
21069caf0364SJohannes Berg 	const struct cfg80211_bss_ies __rcu *ies;
21079caf0364SJohannes Berg 	const struct cfg80211_bss_ies __rcu *beacon_ies;
21089caf0364SJohannes Berg 	const struct cfg80211_bss_ies __rcu *proberesp_ies;
21099caf0364SJohannes Berg 
2110776b3580SJohannes Berg 	struct cfg80211_bss *hidden_beacon_bss;
21117011ba58SSara Sharon 	struct cfg80211_bss *transmitted_bss;
21127011ba58SSara Sharon 	struct list_head nontrans_list;
21132a519311SJohannes Berg 
21142a519311SJohannes Berg 	s32 signal;
21152a519311SJohannes Berg 
21169caf0364SJohannes Berg 	u16 beacon_interval;
21179caf0364SJohannes Berg 	u16 capability;
21189caf0364SJohannes Berg 
21199caf0364SJohannes Berg 	u8 bssid[ETH_ALEN];
2120983dafaaSSunil Dutt 	u8 chains;
2121983dafaaSSunil Dutt 	s8 chain_signal[IEEE80211_MAX_CHAINS];
21229caf0364SJohannes Berg 
21230cd01efbSSara Sharon 	u8 bssid_index;
21240cd01efbSSara Sharon 	u8 max_bssid_indicator;
21250cd01efbSSara Sharon 
21261c06ef98SJohannes Berg 	u8 priv[0] __aligned(sizeof(void *));
21272a519311SJohannes Berg };
21282a519311SJohannes Berg 
21292a519311SJohannes Berg /**
213049a68e0dSJohannes Berg  * ieee80211_bss_get_elem - find element with given ID
2131517357c6SJohannes Berg  * @bss: the bss to search
213249a68e0dSJohannes Berg  * @id: the element ID
21339caf0364SJohannes Berg  *
21349caf0364SJohannes Berg  * Note that the return value is an RCU-protected pointer, so
21359caf0364SJohannes Berg  * rcu_read_lock() must be held when calling this function.
21360ae997dcSYacine Belkadi  * Return: %NULL if not found.
2137517357c6SJohannes Berg  */
213849a68e0dSJohannes Berg const struct element *ieee80211_bss_get_elem(struct cfg80211_bss *bss, u8 id);
213949a68e0dSJohannes Berg 
214049a68e0dSJohannes Berg /**
214149a68e0dSJohannes Berg  * ieee80211_bss_get_ie - find IE with given ID
214249a68e0dSJohannes Berg  * @bss: the bss to search
214349a68e0dSJohannes Berg  * @id: the element ID
214449a68e0dSJohannes Berg  *
214549a68e0dSJohannes Berg  * Note that the return value is an RCU-protected pointer, so
214649a68e0dSJohannes Berg  * rcu_read_lock() must be held when calling this function.
214749a68e0dSJohannes Berg  * Return: %NULL if not found.
214849a68e0dSJohannes Berg  */
214949a68e0dSJohannes Berg static inline const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 id)
215049a68e0dSJohannes Berg {
215149a68e0dSJohannes Berg 	return (void *)ieee80211_bss_get_elem(bss, id);
215249a68e0dSJohannes Berg }
2153517357c6SJohannes Berg 
2154517357c6SJohannes Berg 
2155517357c6SJohannes Berg /**
2156636a5d36SJouni Malinen  * struct cfg80211_auth_request - Authentication request data
2157636a5d36SJouni Malinen  *
2158636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
2159636a5d36SJouni Malinen  * authentication.
2160636a5d36SJouni Malinen  *
2161959867faSJohannes Berg  * @bss: The BSS to authenticate with, the callee must obtain a reference
2162959867faSJohannes Berg  *	to it if it needs to keep it.
2163636a5d36SJouni Malinen  * @auth_type: Authentication type (algorithm)
2164636a5d36SJouni Malinen  * @ie: Extra IEs to add to Authentication frame or %NULL
2165636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
2166fffd0934SJohannes Berg  * @key_len: length of WEP key for shared key authentication
2167fffd0934SJohannes Berg  * @key_idx: index of WEP key for shared key authentication
2168fffd0934SJohannes Berg  * @key: WEP key for shared key authentication
216911b6b5a4SJouni Malinen  * @auth_data: Fields and elements in Authentication frames. This contains
217011b6b5a4SJouni Malinen  *	the authentication frame body (non-IE and IE data), excluding the
217111b6b5a4SJouni Malinen  *	Authentication algorithm number, i.e., starting at the Authentication
217211b6b5a4SJouni Malinen  *	transaction sequence number field.
217311b6b5a4SJouni Malinen  * @auth_data_len: Length of auth_data buffer in octets
2174636a5d36SJouni Malinen  */
2175636a5d36SJouni Malinen struct cfg80211_auth_request {
217619957bb3SJohannes Berg 	struct cfg80211_bss *bss;
2177636a5d36SJouni Malinen 	const u8 *ie;
2178636a5d36SJouni Malinen 	size_t ie_len;
217919957bb3SJohannes Berg 	enum nl80211_auth_type auth_type;
2180fffd0934SJohannes Berg 	const u8 *key;
2181fffd0934SJohannes Berg 	u8 key_len, key_idx;
218211b6b5a4SJouni Malinen 	const u8 *auth_data;
218311b6b5a4SJouni Malinen 	size_t auth_data_len;
2184636a5d36SJouni Malinen };
2185636a5d36SJouni Malinen 
2186636a5d36SJouni Malinen /**
21877e7c8926SBen Greear  * enum cfg80211_assoc_req_flags - Over-ride default behaviour in association.
21887e7c8926SBen Greear  *
21897e7c8926SBen Greear  * @ASSOC_REQ_DISABLE_HT:  Disable HT (802.11n)
2190ee2aca34SJohannes Berg  * @ASSOC_REQ_DISABLE_VHT:  Disable VHT
2191bab5ab7dSAssaf Krauss  * @ASSOC_REQ_USE_RRM: Declare RRM capability in this association
219240cbfa90SSrinivas Dasari  * @CONNECT_REQ_EXTERNAL_AUTH_SUPPORT: User space indicates external
219340cbfa90SSrinivas Dasari  *	authentication capability. Drivers can offload authentication to
219440cbfa90SSrinivas Dasari  *	userspace if this flag is set. Only applicable for cfg80211_connect()
219540cbfa90SSrinivas Dasari  *	request (connect callback).
21967e7c8926SBen Greear  */
21977e7c8926SBen Greear enum cfg80211_assoc_req_flags {
21987e7c8926SBen Greear 	ASSOC_REQ_DISABLE_HT			= BIT(0),
2199ee2aca34SJohannes Berg 	ASSOC_REQ_DISABLE_VHT			= BIT(1),
2200bab5ab7dSAssaf Krauss 	ASSOC_REQ_USE_RRM			= BIT(2),
220140cbfa90SSrinivas Dasari 	CONNECT_REQ_EXTERNAL_AUTH_SUPPORT	= BIT(3),
22027e7c8926SBen Greear };
22037e7c8926SBen Greear 
22047e7c8926SBen Greear /**
2205636a5d36SJouni Malinen  * struct cfg80211_assoc_request - (Re)Association request data
2206636a5d36SJouni Malinen  *
2207636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
2208636a5d36SJouni Malinen  * (re)association.
2209959867faSJohannes Berg  * @bss: The BSS to associate with. If the call is successful the driver is
2210959867faSJohannes Berg  *	given a reference that it must give back to cfg80211_send_rx_assoc()
2211959867faSJohannes Berg  *	or to cfg80211_assoc_timeout(). To ensure proper refcounting, new
2212959867faSJohannes Berg  *	association requests while already associating must be rejected.
2213636a5d36SJouni Malinen  * @ie: Extra IEs to add to (Re)Association Request frame or %NULL
2214636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
2215dc6382ceSJouni Malinen  * @use_mfp: Use management frame protection (IEEE 802.11w) in this association
2216b23aa676SSamuel Ortiz  * @crypto: crypto settings
221735eb8f7bSJouni Malinen  * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used
221835eb8f7bSJouni Malinen  *	to indicate a request to reassociate within the ESS instead of a request
221935eb8f7bSJouni Malinen  *	do the initial association with the ESS. When included, this is set to
222035eb8f7bSJouni Malinen  *	the BSSID of the current association, i.e., to the value that is
222135eb8f7bSJouni Malinen  *	included in the Current AP address field of the Reassociation Request
222235eb8f7bSJouni Malinen  *	frame.
22237e7c8926SBen Greear  * @flags:  See &enum cfg80211_assoc_req_flags
22247e7c8926SBen Greear  * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask
22257e7c8926SBen Greear  *	will be used in ht_capa.  Un-supported values will be ignored.
22267e7c8926SBen Greear  * @ht_capa_mask:  The bits of ht_capa which are to be used.
2227ee2aca34SJohannes Berg  * @vht_capa: VHT capability override
2228ee2aca34SJohannes Berg  * @vht_capa_mask: VHT capability mask indicating which fields to use
2229348bd456SJouni Malinen  * @fils_kek: FILS KEK for protecting (Re)Association Request/Response frame or
2230348bd456SJouni Malinen  *	%NULL if FILS is not used.
2231348bd456SJouni Malinen  * @fils_kek_len: Length of fils_kek in octets
2232348bd456SJouni Malinen  * @fils_nonces: FILS nonces (part of AAD) for protecting (Re)Association
2233348bd456SJouni Malinen  *	Request/Response frame or %NULL if FILS is not used. This field starts
2234348bd456SJouni Malinen  *	with 16 octets of STA Nonce followed by 16 octets of AP Nonce.
2235636a5d36SJouni Malinen  */
2236636a5d36SJouni Malinen struct cfg80211_assoc_request {
223719957bb3SJohannes Berg 	struct cfg80211_bss *bss;
22383e5d7649SJohannes Berg 	const u8 *ie, *prev_bssid;
2239636a5d36SJouni Malinen 	size_t ie_len;
2240b23aa676SSamuel Ortiz 	struct cfg80211_crypto_settings crypto;
224119957bb3SJohannes Berg 	bool use_mfp;
22427e7c8926SBen Greear 	u32 flags;
22437e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa;
22447e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa_mask;
2245ee2aca34SJohannes Berg 	struct ieee80211_vht_cap vht_capa, vht_capa_mask;
2246348bd456SJouni Malinen 	const u8 *fils_kek;
2247348bd456SJouni Malinen 	size_t fils_kek_len;
2248348bd456SJouni Malinen 	const u8 *fils_nonces;
2249636a5d36SJouni Malinen };
2250636a5d36SJouni Malinen 
2251636a5d36SJouni Malinen /**
2252636a5d36SJouni Malinen  * struct cfg80211_deauth_request - Deauthentication request data
2253636a5d36SJouni Malinen  *
2254636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
2255636a5d36SJouni Malinen  * deauthentication.
2256636a5d36SJouni Malinen  *
225795de817bSJohannes Berg  * @bssid: the BSSID of the BSS to deauthenticate from
2258636a5d36SJouni Malinen  * @ie: Extra IEs to add to Deauthentication frame or %NULL
2259636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
226019957bb3SJohannes Berg  * @reason_code: The reason code for the deauthentication
2261077f897aSJohannes Berg  * @local_state_change: if set, change local state only and
2262077f897aSJohannes Berg  *	do not set a deauth frame
2263636a5d36SJouni Malinen  */
2264636a5d36SJouni Malinen struct cfg80211_deauth_request {
226595de817bSJohannes Berg 	const u8 *bssid;
2266636a5d36SJouni Malinen 	const u8 *ie;
2267636a5d36SJouni Malinen 	size_t ie_len;
226819957bb3SJohannes Berg 	u16 reason_code;
22696863255bSStanislaw Gruszka 	bool local_state_change;
2270636a5d36SJouni Malinen };
2271636a5d36SJouni Malinen 
2272636a5d36SJouni Malinen /**
2273636a5d36SJouni Malinen  * struct cfg80211_disassoc_request - Disassociation request data
2274636a5d36SJouni Malinen  *
2275636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
227666f00449SMasahiro Yamada  * disassociation.
2277636a5d36SJouni Malinen  *
227819957bb3SJohannes Berg  * @bss: the BSS to disassociate from
2279636a5d36SJouni Malinen  * @ie: Extra IEs to add to Disassociation frame or %NULL
2280636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
228119957bb3SJohannes Berg  * @reason_code: The reason code for the disassociation
2282d5cdfacbSJouni Malinen  * @local_state_change: This is a request for a local state only, i.e., no
2283d5cdfacbSJouni Malinen  *	Disassociation frame is to be transmitted.
2284636a5d36SJouni Malinen  */
2285636a5d36SJouni Malinen struct cfg80211_disassoc_request {
228619957bb3SJohannes Berg 	struct cfg80211_bss *bss;
2287636a5d36SJouni Malinen 	const u8 *ie;
2288636a5d36SJouni Malinen 	size_t ie_len;
228919957bb3SJohannes Berg 	u16 reason_code;
2290d5cdfacbSJouni Malinen 	bool local_state_change;
2291636a5d36SJouni Malinen };
2292636a5d36SJouni Malinen 
2293636a5d36SJouni Malinen /**
229404a773adSJohannes Berg  * struct cfg80211_ibss_params - IBSS parameters
229504a773adSJohannes Berg  *
229604a773adSJohannes Berg  * This structure defines the IBSS parameters for the join_ibss()
229704a773adSJohannes Berg  * method.
229804a773adSJohannes Berg  *
229904a773adSJohannes Berg  * @ssid: The SSID, will always be non-null.
230004a773adSJohannes Berg  * @ssid_len: The length of the SSID, will always be non-zero.
230104a773adSJohannes Berg  * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not
230204a773adSJohannes Berg  *	search for IBSSs with a different BSSID.
2303683b6d3bSJohannes Berg  * @chandef: defines the channel to use if no other IBSS to join can be found
230404a773adSJohannes Berg  * @channel_fixed: The channel should be fixed -- do not search for
230504a773adSJohannes Berg  *	IBSSs to join on other channels.
230604a773adSJohannes Berg  * @ie: information element(s) to include in the beacon
230704a773adSJohannes Berg  * @ie_len: length of that
23088e30bc55SJohannes Berg  * @beacon_interval: beacon interval to use
2309fffd0934SJohannes Berg  * @privacy: this is a protected network, keys will be configured
2310fffd0934SJohannes Berg  *	after joining
2311267335d6SAntonio Quartulli  * @control_port: whether user space controls IEEE 802.1X port, i.e.,
2312267335d6SAntonio Quartulli  *	sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
2313267335d6SAntonio Quartulli  *	required to assume that the port is unauthorized until authorized by
2314267335d6SAntonio Quartulli  *	user space. Otherwise, port is marked authorized by default.
2315c3bfe1f6SDenis Kenzior  * @control_port_over_nl80211: TRUE if userspace expects to exchange control
2316c3bfe1f6SDenis Kenzior  *	port frames over NL80211 instead of the network interface.
23175336fa88SSimon Wunderlich  * @userspace_handles_dfs: whether user space controls DFS operation, i.e.
23185336fa88SSimon Wunderlich  *	changes the channel when a radar is detected. This is required
23195336fa88SSimon Wunderlich  *	to operate on DFS channels.
2320fbd2c8dcSTeemu Paasikivi  * @basic_rates: bitmap of basic rates to use when creating the IBSS
2321dd5b4cc7SFelix Fietkau  * @mcast_rate: per-band multicast rate index + 1 (0: disabled)
2322803768f5SSimon Wunderlich  * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask
2323803768f5SSimon Wunderlich  *	will be used in ht_capa.  Un-supported values will be ignored.
2324803768f5SSimon Wunderlich  * @ht_capa_mask:  The bits of ht_capa which are to be used.
23259ae3b172STova Mussai  * @wep_keys: static WEP keys, if not NULL points to an array of
23269ae3b172STova Mussai  * 	CFG80211_MAX_WEP_KEYS WEP keys
23279ae3b172STova Mussai  * @wep_tx_key: key index (0..3) of the default TX static WEP key
232804a773adSJohannes Berg  */
232904a773adSJohannes Berg struct cfg80211_ibss_params {
2330c1e5f471SJohannes Berg 	const u8 *ssid;
2331c1e5f471SJohannes Berg 	const u8 *bssid;
2332683b6d3bSJohannes Berg 	struct cfg80211_chan_def chandef;
2333c1e5f471SJohannes Berg 	const u8 *ie;
233404a773adSJohannes Berg 	u8 ssid_len, ie_len;
23358e30bc55SJohannes Berg 	u16 beacon_interval;
2336fbd2c8dcSTeemu Paasikivi 	u32 basic_rates;
233704a773adSJohannes Berg 	bool channel_fixed;
2338fffd0934SJohannes Berg 	bool privacy;
2339267335d6SAntonio Quartulli 	bool control_port;
2340c3bfe1f6SDenis Kenzior 	bool control_port_over_nl80211;
23415336fa88SSimon Wunderlich 	bool userspace_handles_dfs;
234257fbcce3SJohannes Berg 	int mcast_rate[NUM_NL80211_BANDS];
2343803768f5SSimon Wunderlich 	struct ieee80211_ht_cap ht_capa;
2344803768f5SSimon Wunderlich 	struct ieee80211_ht_cap ht_capa_mask;
23459ae3b172STova Mussai 	struct key_params *wep_keys;
23469ae3b172STova Mussai 	int wep_tx_key;
234704a773adSJohannes Berg };
234804a773adSJohannes Berg 
234904a773adSJohannes Berg /**
235038de03d2SArend van Spriel  * struct cfg80211_bss_selection - connection parameters for BSS selection.
235138de03d2SArend van Spriel  *
235238de03d2SArend van Spriel  * @behaviour: requested BSS selection behaviour.
235338de03d2SArend van Spriel  * @param: parameters for requestion behaviour.
235438de03d2SArend van Spriel  * @band_pref: preferred band for %NL80211_BSS_SELECT_ATTR_BAND_PREF.
235538de03d2SArend van Spriel  * @adjust: parameters for %NL80211_BSS_SELECT_ATTR_RSSI_ADJUST.
235638de03d2SArend van Spriel  */
235738de03d2SArend van Spriel struct cfg80211_bss_selection {
235838de03d2SArend van Spriel 	enum nl80211_bss_select_attr behaviour;
235938de03d2SArend van Spriel 	union {
236057fbcce3SJohannes Berg 		enum nl80211_band band_pref;
236138de03d2SArend van Spriel 		struct cfg80211_bss_select_adjust adjust;
236238de03d2SArend van Spriel 	} param;
236338de03d2SArend van Spriel };
236438de03d2SArend van Spriel 
236538de03d2SArend van Spriel /**
2366b23aa676SSamuel Ortiz  * struct cfg80211_connect_params - Connection parameters
2367b23aa676SSamuel Ortiz  *
2368b23aa676SSamuel Ortiz  * This structure provides information needed to complete IEEE 802.11
2369b23aa676SSamuel Ortiz  * authentication and association.
2370b23aa676SSamuel Ortiz  *
2371b23aa676SSamuel Ortiz  * @channel: The channel to use or %NULL if not specified (auto-select based
2372b23aa676SSamuel Ortiz  *	on scan results)
23731df4a510SJouni Malinen  * @channel_hint: The channel of the recommended BSS for initial connection or
23741df4a510SJouni Malinen  *	%NULL if not specified
2375b23aa676SSamuel Ortiz  * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan
2376b23aa676SSamuel Ortiz  *	results)
23771df4a510SJouni Malinen  * @bssid_hint: The recommended AP BSSID for initial connection to the BSS or
23781df4a510SJouni Malinen  *	%NULL if not specified. Unlike the @bssid parameter, the driver is
23791df4a510SJouni Malinen  *	allowed to ignore this @bssid_hint if it has knowledge of a better BSS
23801df4a510SJouni Malinen  *	to use.
2381b23aa676SSamuel Ortiz  * @ssid: SSID
2382b23aa676SSamuel Ortiz  * @ssid_len: Length of ssid in octets
2383b23aa676SSamuel Ortiz  * @auth_type: Authentication type (algorithm)
2384abe37c4bSJohannes Berg  * @ie: IEs for association request
2385abe37c4bSJohannes Berg  * @ie_len: Length of assoc_ie in octets
2386b23aa676SSamuel Ortiz  * @privacy: indicates whether privacy-enabled APs should be used
2387cee00a95SJouni Malinen  * @mfp: indicate whether management frame protection is used
2388b23aa676SSamuel Ortiz  * @crypto: crypto settings
2389fffd0934SJohannes Berg  * @key_len: length of WEP key for shared key authentication
2390fffd0934SJohannes Berg  * @key_idx: index of WEP key for shared key authentication
2391fffd0934SJohannes Berg  * @key: WEP key for shared key authentication
23927e7c8926SBen Greear  * @flags:  See &enum cfg80211_assoc_req_flags
23934486ea98SBala Shanmugam  * @bg_scan_period:  Background scan period in seconds
23944486ea98SBala Shanmugam  *	or -1 to indicate that default value is to be used.
23957e7c8926SBen Greear  * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask
23967e7c8926SBen Greear  *	will be used in ht_capa.  Un-supported values will be ignored.
23977e7c8926SBen Greear  * @ht_capa_mask:  The bits of ht_capa which are to be used.
2398ee2aca34SJohannes Berg  * @vht_capa:  VHT Capability overrides
2399ee2aca34SJohannes Berg  * @vht_capa_mask: The bits of vht_capa which are to be used.
240034d50519SLior David  * @pbss: if set, connect to a PCP instead of AP. Valid for DMG
240134d50519SLior David  *	networks.
240238de03d2SArend van Spriel  * @bss_select: criteria to be used for BSS selection.
240335eb8f7bSJouni Malinen  * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used
240435eb8f7bSJouni Malinen  *	to indicate a request to reassociate within the ESS instead of a request
240535eb8f7bSJouni Malinen  *	do the initial association with the ESS. When included, this is set to
240635eb8f7bSJouni Malinen  *	the BSSID of the current association, i.e., to the value that is
240735eb8f7bSJouni Malinen  *	included in the Current AP address field of the Reassociation Request
240835eb8f7bSJouni Malinen  *	frame.
2409a3caf744SVidyullatha Kanchanapally  * @fils_erp_username: EAP re-authentication protocol (ERP) username part of the
2410a3caf744SVidyullatha Kanchanapally  *	NAI or %NULL if not specified. This is used to construct FILS wrapped
2411a3caf744SVidyullatha Kanchanapally  *	data IE.
2412a3caf744SVidyullatha Kanchanapally  * @fils_erp_username_len: Length of @fils_erp_username in octets.
2413a3caf744SVidyullatha Kanchanapally  * @fils_erp_realm: EAP re-authentication protocol (ERP) realm part of NAI or
2414a3caf744SVidyullatha Kanchanapally  *	%NULL if not specified. This specifies the domain name of ER server and
2415a3caf744SVidyullatha Kanchanapally  *	is used to construct FILS wrapped data IE.
2416a3caf744SVidyullatha Kanchanapally  * @fils_erp_realm_len: Length of @fils_erp_realm in octets.
2417a3caf744SVidyullatha Kanchanapally  * @fils_erp_next_seq_num: The next sequence number to use in the FILS ERP
2418a3caf744SVidyullatha Kanchanapally  *	messages. This is also used to construct FILS wrapped data IE.
2419a3caf744SVidyullatha Kanchanapally  * @fils_erp_rrk: ERP re-authentication Root Key (rRK) used to derive additional
2420a3caf744SVidyullatha Kanchanapally  *	keys in FILS or %NULL if not specified.
2421a3caf744SVidyullatha Kanchanapally  * @fils_erp_rrk_len: Length of @fils_erp_rrk in octets.
24223a00df57SAvraham Stern  * @want_1x: indicates user-space supports and wants to use 802.1X driver
24233a00df57SAvraham Stern  *	offload of 4-way handshake.
2424b23aa676SSamuel Ortiz  */
2425b23aa676SSamuel Ortiz struct cfg80211_connect_params {
2426b23aa676SSamuel Ortiz 	struct ieee80211_channel *channel;
24271df4a510SJouni Malinen 	struct ieee80211_channel *channel_hint;
2428664834deSJouni Malinen 	const u8 *bssid;
24291df4a510SJouni Malinen 	const u8 *bssid_hint;
2430664834deSJouni Malinen 	const u8 *ssid;
2431b23aa676SSamuel Ortiz 	size_t ssid_len;
2432b23aa676SSamuel Ortiz 	enum nl80211_auth_type auth_type;
24334b5800feSJohannes Berg 	const u8 *ie;
2434b23aa676SSamuel Ortiz 	size_t ie_len;
2435b23aa676SSamuel Ortiz 	bool privacy;
2436cee00a95SJouni Malinen 	enum nl80211_mfp mfp;
2437b23aa676SSamuel Ortiz 	struct cfg80211_crypto_settings crypto;
2438fffd0934SJohannes Berg 	const u8 *key;
2439fffd0934SJohannes Berg 	u8 key_len, key_idx;
24407e7c8926SBen Greear 	u32 flags;
24414486ea98SBala Shanmugam 	int bg_scan_period;
24427e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa;
24437e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa_mask;
2444ee2aca34SJohannes Berg 	struct ieee80211_vht_cap vht_capa;
2445ee2aca34SJohannes Berg 	struct ieee80211_vht_cap vht_capa_mask;
244634d50519SLior David 	bool pbss;
244738de03d2SArend van Spriel 	struct cfg80211_bss_selection bss_select;
2448ba6fbacfSJouni Malinen 	const u8 *prev_bssid;
2449a3caf744SVidyullatha Kanchanapally 	const u8 *fils_erp_username;
2450a3caf744SVidyullatha Kanchanapally 	size_t fils_erp_username_len;
2451a3caf744SVidyullatha Kanchanapally 	const u8 *fils_erp_realm;
2452a3caf744SVidyullatha Kanchanapally 	size_t fils_erp_realm_len;
2453a3caf744SVidyullatha Kanchanapally 	u16 fils_erp_next_seq_num;
2454a3caf744SVidyullatha Kanchanapally 	const u8 *fils_erp_rrk;
2455a3caf744SVidyullatha Kanchanapally 	size_t fils_erp_rrk_len;
24563a00df57SAvraham Stern 	bool want_1x;
2457b23aa676SSamuel Ortiz };
2458b23aa676SSamuel Ortiz 
2459b23aa676SSamuel Ortiz /**
2460088e8df8Svamsi krishna  * enum cfg80211_connect_params_changed - Connection parameters being updated
2461088e8df8Svamsi krishna  *
2462088e8df8Svamsi krishna  * This enum provides information of all connect parameters that
2463088e8df8Svamsi krishna  * have to be updated as part of update_connect_params() call.
2464088e8df8Svamsi krishna  *
2465088e8df8Svamsi krishna  * @UPDATE_ASSOC_IES: Indicates whether association request IEs are updated
24667f9a3e15SVidyullatha Kanchanapally  * @UPDATE_FILS_ERP_INFO: Indicates that FILS connection parameters (realm,
24677f9a3e15SVidyullatha Kanchanapally  *	username, erp sequence number and rrk) are updated
24687f9a3e15SVidyullatha Kanchanapally  * @UPDATE_AUTH_TYPE: Indicates that authentication type is updated
2469088e8df8Svamsi krishna  */
2470088e8df8Svamsi krishna enum cfg80211_connect_params_changed {
2471088e8df8Svamsi krishna 	UPDATE_ASSOC_IES		= BIT(0),
24727f9a3e15SVidyullatha Kanchanapally 	UPDATE_FILS_ERP_INFO		= BIT(1),
24737f9a3e15SVidyullatha Kanchanapally 	UPDATE_AUTH_TYPE		= BIT(2),
2474088e8df8Svamsi krishna };
2475088e8df8Svamsi krishna 
2476088e8df8Svamsi krishna /**
2477b9a5f8caSJouni Malinen  * enum wiphy_params_flags - set_wiphy_params bitfield values
2478abe37c4bSJohannes Berg  * @WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed
2479abe37c4bSJohannes Berg  * @WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed
2480abe37c4bSJohannes Berg  * @WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed
2481abe37c4bSJohannes Berg  * @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed
2482abe37c4bSJohannes Berg  * @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed
24833057dbfdSLorenzo Bianconi  * @WIPHY_PARAM_DYN_ACK: dynack has been enabled
248452539ca8SToke Høiland-Jørgensen  * @WIPHY_PARAM_TXQ_LIMIT: TXQ packet limit has been changed
248552539ca8SToke Høiland-Jørgensen  * @WIPHY_PARAM_TXQ_MEMORY_LIMIT: TXQ memory limit has been changed
248652539ca8SToke Høiland-Jørgensen  * @WIPHY_PARAM_TXQ_QUANTUM: TXQ scheduler quantum
2487b9a5f8caSJouni Malinen  */
2488b9a5f8caSJouni Malinen enum wiphy_params_flags {
2489b9a5f8caSJouni Malinen 	WIPHY_PARAM_RETRY_SHORT		= 1 << 0,
2490b9a5f8caSJouni Malinen 	WIPHY_PARAM_RETRY_LONG		= 1 << 1,
2491b9a5f8caSJouni Malinen 	WIPHY_PARAM_FRAG_THRESHOLD	= 1 << 2,
2492b9a5f8caSJouni Malinen 	WIPHY_PARAM_RTS_THRESHOLD	= 1 << 3,
249381077e82SLukáš Turek 	WIPHY_PARAM_COVERAGE_CLASS	= 1 << 4,
24943057dbfdSLorenzo Bianconi 	WIPHY_PARAM_DYN_ACK		= 1 << 5,
249552539ca8SToke Høiland-Jørgensen 	WIPHY_PARAM_TXQ_LIMIT		= 1 << 6,
249652539ca8SToke Høiland-Jørgensen 	WIPHY_PARAM_TXQ_MEMORY_LIMIT	= 1 << 7,
249752539ca8SToke Høiland-Jørgensen 	WIPHY_PARAM_TXQ_QUANTUM		= 1 << 8,
2498b9a5f8caSJouni Malinen };
2499b9a5f8caSJouni Malinen 
250036647055SToke Høiland-Jørgensen #define IEEE80211_DEFAULT_AIRTIME_WEIGHT	256
250136647055SToke Høiland-Jørgensen 
250267fbb16bSSamuel Ortiz /**
250367fbb16bSSamuel Ortiz  * struct cfg80211_pmksa - PMK Security Association
250467fbb16bSSamuel Ortiz  *
250567fbb16bSSamuel Ortiz  * This structure is passed to the set/del_pmksa() method for PMKSA
250667fbb16bSSamuel Ortiz  * caching.
250767fbb16bSSamuel Ortiz  *
2508a3caf744SVidyullatha Kanchanapally  * @bssid: The AP's BSSID (may be %NULL).
2509a3caf744SVidyullatha Kanchanapally  * @pmkid: The identifier to refer a PMKSA.
2510a3caf744SVidyullatha Kanchanapally  * @pmk: The PMK for the PMKSA identified by @pmkid. This is used for key
2511a3caf744SVidyullatha Kanchanapally  *	derivation by a FILS STA. Otherwise, %NULL.
2512a3caf744SVidyullatha Kanchanapally  * @pmk_len: Length of the @pmk. The length of @pmk can differ depending on
2513a3caf744SVidyullatha Kanchanapally  *	the hash algorithm used to generate this.
2514a3caf744SVidyullatha Kanchanapally  * @ssid: SSID to specify the ESS within which a PMKSA is valid when using FILS
2515a3caf744SVidyullatha Kanchanapally  *	cache identifier (may be %NULL).
2516a3caf744SVidyullatha Kanchanapally  * @ssid_len: Length of the @ssid in octets.
2517a3caf744SVidyullatha Kanchanapally  * @cache_id: 2-octet cache identifier advertized by a FILS AP identifying the
2518a3caf744SVidyullatha Kanchanapally  *	scope of PMKSA. This is valid only if @ssid_len is non-zero (may be
2519a3caf744SVidyullatha Kanchanapally  *	%NULL).
252067fbb16bSSamuel Ortiz  */
252167fbb16bSSamuel Ortiz struct cfg80211_pmksa {
2522c1e5f471SJohannes Berg 	const u8 *bssid;
2523c1e5f471SJohannes Berg 	const u8 *pmkid;
2524a3caf744SVidyullatha Kanchanapally 	const u8 *pmk;
2525a3caf744SVidyullatha Kanchanapally 	size_t pmk_len;
2526a3caf744SVidyullatha Kanchanapally 	const u8 *ssid;
2527a3caf744SVidyullatha Kanchanapally 	size_t ssid_len;
2528a3caf744SVidyullatha Kanchanapally 	const u8 *cache_id;
252967fbb16bSSamuel Ortiz };
25309930380fSJohannes Berg 
25317643a2c3SJohannes Berg /**
253250ac6607SAmitkumar Karwar  * struct cfg80211_pkt_pattern - packet pattern
2533ff1b6e69SJohannes Berg  * @mask: bitmask where to match pattern and where to ignore bytes,
2534ff1b6e69SJohannes Berg  *	one bit per byte, in same format as nl80211
2535ff1b6e69SJohannes Berg  * @pattern: bytes to match where bitmask is 1
2536ff1b6e69SJohannes Berg  * @pattern_len: length of pattern (in bytes)
2537bb92d199SAmitkumar Karwar  * @pkt_offset: packet offset (in bytes)
2538ff1b6e69SJohannes Berg  *
2539ff1b6e69SJohannes Berg  * Internal note: @mask and @pattern are allocated in one chunk of
2540ff1b6e69SJohannes Berg  * memory, free @mask only!
2541ff1b6e69SJohannes Berg  */
254250ac6607SAmitkumar Karwar struct cfg80211_pkt_pattern {
2543922bd80fSJohannes Berg 	const u8 *mask, *pattern;
2544ff1b6e69SJohannes Berg 	int pattern_len;
2545bb92d199SAmitkumar Karwar 	int pkt_offset;
2546ff1b6e69SJohannes Berg };
2547ff1b6e69SJohannes Berg 
2548ff1b6e69SJohannes Berg /**
25492a0e047eSJohannes Berg  * struct cfg80211_wowlan_tcp - TCP connection parameters
25502a0e047eSJohannes Berg  *
25512a0e047eSJohannes Berg  * @sock: (internal) socket for source port allocation
25522a0e047eSJohannes Berg  * @src: source IP address
25532a0e047eSJohannes Berg  * @dst: destination IP address
25542a0e047eSJohannes Berg  * @dst_mac: destination MAC address
25552a0e047eSJohannes Berg  * @src_port: source port
25562a0e047eSJohannes Berg  * @dst_port: destination port
25572a0e047eSJohannes Berg  * @payload_len: data payload length
25582a0e047eSJohannes Berg  * @payload: data payload buffer
25592a0e047eSJohannes Berg  * @payload_seq: payload sequence stamping configuration
25602a0e047eSJohannes Berg  * @data_interval: interval at which to send data packets
25612a0e047eSJohannes Berg  * @wake_len: wakeup payload match length
25622a0e047eSJohannes Berg  * @wake_data: wakeup payload match data
25632a0e047eSJohannes Berg  * @wake_mask: wakeup payload match mask
25642a0e047eSJohannes Berg  * @tokens_size: length of the tokens buffer
25652a0e047eSJohannes Berg  * @payload_tok: payload token usage configuration
25662a0e047eSJohannes Berg  */
25672a0e047eSJohannes Berg struct cfg80211_wowlan_tcp {
25682a0e047eSJohannes Berg 	struct socket *sock;
25692a0e047eSJohannes Berg 	__be32 src, dst;
25702a0e047eSJohannes Berg 	u16 src_port, dst_port;
25712a0e047eSJohannes Berg 	u8 dst_mac[ETH_ALEN];
25722a0e047eSJohannes Berg 	int payload_len;
25732a0e047eSJohannes Berg 	const u8 *payload;
25742a0e047eSJohannes Berg 	struct nl80211_wowlan_tcp_data_seq payload_seq;
25752a0e047eSJohannes Berg 	u32 data_interval;
25762a0e047eSJohannes Berg 	u32 wake_len;
25772a0e047eSJohannes Berg 	const u8 *wake_data, *wake_mask;
25782a0e047eSJohannes Berg 	u32 tokens_size;
25792a0e047eSJohannes Berg 	/* must be last, variable member */
25802a0e047eSJohannes Berg 	struct nl80211_wowlan_tcp_data_token payload_tok;
2581ff1b6e69SJohannes Berg };
2582ff1b6e69SJohannes Berg 
2583ff1b6e69SJohannes Berg /**
2584ff1b6e69SJohannes Berg  * struct cfg80211_wowlan - Wake on Wireless-LAN support info
2585ff1b6e69SJohannes Berg  *
2586ff1b6e69SJohannes Berg  * This structure defines the enabled WoWLAN triggers for the device.
2587ff1b6e69SJohannes Berg  * @any: wake up on any activity -- special trigger if device continues
2588ff1b6e69SJohannes Berg  *	operating as normal during suspend
2589ff1b6e69SJohannes Berg  * @disconnect: wake up if getting disconnected
2590ff1b6e69SJohannes Berg  * @magic_pkt: wake up on receiving magic packet
2591ff1b6e69SJohannes Berg  * @patterns: wake up on receiving packet matching a pattern
2592ff1b6e69SJohannes Berg  * @n_patterns: number of patterns
259377dbbb13SJohannes Berg  * @gtk_rekey_failure: wake up on GTK rekey failure
259477dbbb13SJohannes Berg  * @eap_identity_req: wake up on EAP identity request packet
259577dbbb13SJohannes Berg  * @four_way_handshake: wake up on 4-way handshake
259677dbbb13SJohannes Berg  * @rfkill_release: wake up when rfkill is released
25972a0e047eSJohannes Berg  * @tcp: TCP connection establishment/wakeup parameters, see nl80211.h.
25982a0e047eSJohannes Berg  *	NULL if not configured.
25998cd4d456SLuciano Coelho  * @nd_config: configuration for the scan to be used for net detect wake.
2600ff1b6e69SJohannes Berg  */
2601ff1b6e69SJohannes Berg struct cfg80211_wowlan {
260277dbbb13SJohannes Berg 	bool any, disconnect, magic_pkt, gtk_rekey_failure,
260377dbbb13SJohannes Berg 	     eap_identity_req, four_way_handshake,
260477dbbb13SJohannes Berg 	     rfkill_release;
260550ac6607SAmitkumar Karwar 	struct cfg80211_pkt_pattern *patterns;
26062a0e047eSJohannes Berg 	struct cfg80211_wowlan_tcp *tcp;
2607ff1b6e69SJohannes Berg 	int n_patterns;
26088cd4d456SLuciano Coelho 	struct cfg80211_sched_scan_request *nd_config;
2609ff1b6e69SJohannes Berg };
2610ff1b6e69SJohannes Berg 
2611ff1b6e69SJohannes Berg /**
2612be29b99aSAmitkumar Karwar  * struct cfg80211_coalesce_rules - Coalesce rule parameters
2613be29b99aSAmitkumar Karwar  *
2614be29b99aSAmitkumar Karwar  * This structure defines coalesce rule for the device.
2615be29b99aSAmitkumar Karwar  * @delay: maximum coalescing delay in msecs.
2616be29b99aSAmitkumar Karwar  * @condition: condition for packet coalescence.
2617be29b99aSAmitkumar Karwar  *	see &enum nl80211_coalesce_condition.
2618be29b99aSAmitkumar Karwar  * @patterns: array of packet patterns
2619be29b99aSAmitkumar Karwar  * @n_patterns: number of patterns
2620be29b99aSAmitkumar Karwar  */
2621be29b99aSAmitkumar Karwar struct cfg80211_coalesce_rules {
2622be29b99aSAmitkumar Karwar 	int delay;
2623be29b99aSAmitkumar Karwar 	enum nl80211_coalesce_condition condition;
2624be29b99aSAmitkumar Karwar 	struct cfg80211_pkt_pattern *patterns;
2625be29b99aSAmitkumar Karwar 	int n_patterns;
2626be29b99aSAmitkumar Karwar };
2627be29b99aSAmitkumar Karwar 
2628be29b99aSAmitkumar Karwar /**
2629be29b99aSAmitkumar Karwar  * struct cfg80211_coalesce - Packet coalescing settings
2630be29b99aSAmitkumar Karwar  *
2631be29b99aSAmitkumar Karwar  * This structure defines coalescing settings.
2632be29b99aSAmitkumar Karwar  * @rules: array of coalesce rules
2633be29b99aSAmitkumar Karwar  * @n_rules: number of rules
2634be29b99aSAmitkumar Karwar  */
2635be29b99aSAmitkumar Karwar struct cfg80211_coalesce {
2636be29b99aSAmitkumar Karwar 	struct cfg80211_coalesce_rules *rules;
2637be29b99aSAmitkumar Karwar 	int n_rules;
2638be29b99aSAmitkumar Karwar };
2639be29b99aSAmitkumar Karwar 
2640be29b99aSAmitkumar Karwar /**
26418cd4d456SLuciano Coelho  * struct cfg80211_wowlan_nd_match - information about the match
26428cd4d456SLuciano Coelho  *
26438cd4d456SLuciano Coelho  * @ssid: SSID of the match that triggered the wake up
26448cd4d456SLuciano Coelho  * @n_channels: Number of channels where the match occurred.  This
26458cd4d456SLuciano Coelho  *	value may be zero if the driver can't report the channels.
26468cd4d456SLuciano Coelho  * @channels: center frequencies of the channels where a match
26478cd4d456SLuciano Coelho  *	occurred (in MHz)
26488cd4d456SLuciano Coelho  */
26498cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_match {
26508cd4d456SLuciano Coelho 	struct cfg80211_ssid ssid;
26518cd4d456SLuciano Coelho 	int n_channels;
26528cd4d456SLuciano Coelho 	u32 channels[];
26538cd4d456SLuciano Coelho };
26548cd4d456SLuciano Coelho 
26558cd4d456SLuciano Coelho /**
26568cd4d456SLuciano Coelho  * struct cfg80211_wowlan_nd_info - net detect wake up information
26578cd4d456SLuciano Coelho  *
26588cd4d456SLuciano Coelho  * @n_matches: Number of match information instances provided in
26598cd4d456SLuciano Coelho  *	@matches.  This value may be zero if the driver can't provide
26608cd4d456SLuciano Coelho  *	match information.
26618cd4d456SLuciano Coelho  * @matches: Array of pointers to matches containing information about
26628cd4d456SLuciano Coelho  *	the matches that triggered the wake up.
26638cd4d456SLuciano Coelho  */
26648cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_info {
26658cd4d456SLuciano Coelho 	int n_matches;
26668cd4d456SLuciano Coelho 	struct cfg80211_wowlan_nd_match *matches[];
26678cd4d456SLuciano Coelho };
26688cd4d456SLuciano Coelho 
26698cd4d456SLuciano Coelho /**
2670cd8f7cb4SJohannes Berg  * struct cfg80211_wowlan_wakeup - wakeup report
2671cd8f7cb4SJohannes Berg  * @disconnect: woke up by getting disconnected
2672cd8f7cb4SJohannes Berg  * @magic_pkt: woke up by receiving magic packet
2673cd8f7cb4SJohannes Berg  * @gtk_rekey_failure: woke up by GTK rekey failure
2674cd8f7cb4SJohannes Berg  * @eap_identity_req: woke up by EAP identity request packet
2675cd8f7cb4SJohannes Berg  * @four_way_handshake: woke up by 4-way handshake
2676cd8f7cb4SJohannes Berg  * @rfkill_release: woke up by rfkill being released
2677cd8f7cb4SJohannes Berg  * @pattern_idx: pattern that caused wakeup, -1 if not due to pattern
2678cd8f7cb4SJohannes Berg  * @packet_present_len: copied wakeup packet data
2679cd8f7cb4SJohannes Berg  * @packet_len: original wakeup packet length
2680cd8f7cb4SJohannes Berg  * @packet: The packet causing the wakeup, if any.
2681cd8f7cb4SJohannes Berg  * @packet_80211:  For pattern match, magic packet and other data
2682cd8f7cb4SJohannes Berg  *	frame triggers an 802.3 frame should be reported, for
2683cd8f7cb4SJohannes Berg  *	disconnect due to deauth 802.11 frame. This indicates which
2684cd8f7cb4SJohannes Berg  *	it is.
26852a0e047eSJohannes Berg  * @tcp_match: TCP wakeup packet received
26862a0e047eSJohannes Berg  * @tcp_connlost: TCP connection lost or failed to establish
26872a0e047eSJohannes Berg  * @tcp_nomoretokens: TCP data ran out of tokens
26888cd4d456SLuciano Coelho  * @net_detect: if not %NULL, woke up because of net detect
2689cd8f7cb4SJohannes Berg  */
2690cd8f7cb4SJohannes Berg struct cfg80211_wowlan_wakeup {
2691cd8f7cb4SJohannes Berg 	bool disconnect, magic_pkt, gtk_rekey_failure,
2692cd8f7cb4SJohannes Berg 	     eap_identity_req, four_way_handshake,
26932a0e047eSJohannes Berg 	     rfkill_release, packet_80211,
26942a0e047eSJohannes Berg 	     tcp_match, tcp_connlost, tcp_nomoretokens;
2695cd8f7cb4SJohannes Berg 	s32 pattern_idx;
2696cd8f7cb4SJohannes Berg 	u32 packet_present_len, packet_len;
2697cd8f7cb4SJohannes Berg 	const void *packet;
26988cd4d456SLuciano Coelho 	struct cfg80211_wowlan_nd_info *net_detect;
2699cd8f7cb4SJohannes Berg };
2700cd8f7cb4SJohannes Berg 
2701cd8f7cb4SJohannes Berg /**
2702e5497d76SJohannes Berg  * struct cfg80211_gtk_rekey_data - rekey data
270378f686caSJohannes Berg  * @kek: key encryption key (NL80211_KEK_LEN bytes)
270478f686caSJohannes Berg  * @kck: key confirmation key (NL80211_KCK_LEN bytes)
270578f686caSJohannes Berg  * @replay_ctr: replay counter (NL80211_REPLAY_CTR_LEN bytes)
2706e5497d76SJohannes Berg  */
2707e5497d76SJohannes Berg struct cfg80211_gtk_rekey_data {
270878f686caSJohannes Berg 	const u8 *kek, *kck, *replay_ctr;
2709e5497d76SJohannes Berg };
2710e5497d76SJohannes Berg 
2711e5497d76SJohannes Berg /**
2712355199e0SJouni Malinen  * struct cfg80211_update_ft_ies_params - FT IE Information
2713355199e0SJouni Malinen  *
2714355199e0SJouni Malinen  * This structure provides information needed to update the fast transition IE
2715355199e0SJouni Malinen  *
2716355199e0SJouni Malinen  * @md: The Mobility Domain ID, 2 Octet value
2717355199e0SJouni Malinen  * @ie: Fast Transition IEs
2718355199e0SJouni Malinen  * @ie_len: Length of ft_ie in octets
2719355199e0SJouni Malinen  */
2720355199e0SJouni Malinen struct cfg80211_update_ft_ies_params {
2721355199e0SJouni Malinen 	u16 md;
2722355199e0SJouni Malinen 	const u8 *ie;
2723355199e0SJouni Malinen 	size_t ie_len;
2724355199e0SJouni Malinen };
2725355199e0SJouni Malinen 
2726355199e0SJouni Malinen /**
2727b176e629SAndrei Otcheretianski  * struct cfg80211_mgmt_tx_params - mgmt tx parameters
2728b176e629SAndrei Otcheretianski  *
2729b176e629SAndrei Otcheretianski  * This structure provides information needed to transmit a mgmt frame
2730b176e629SAndrei Otcheretianski  *
2731b176e629SAndrei Otcheretianski  * @chan: channel to use
2732b176e629SAndrei Otcheretianski  * @offchan: indicates wether off channel operation is required
2733b176e629SAndrei Otcheretianski  * @wait: duration for ROC
2734b176e629SAndrei Otcheretianski  * @buf: buffer to transmit
2735b176e629SAndrei Otcheretianski  * @len: buffer length
2736b176e629SAndrei Otcheretianski  * @no_cck: don't use cck rates for this frame
2737b176e629SAndrei Otcheretianski  * @dont_wait_for_ack: tells the low level not to wait for an ack
273834d22ce2SAndrei Otcheretianski  * @n_csa_offsets: length of csa_offsets array
273934d22ce2SAndrei Otcheretianski  * @csa_offsets: array of all the csa offsets in the frame
2740b176e629SAndrei Otcheretianski  */
2741b176e629SAndrei Otcheretianski struct cfg80211_mgmt_tx_params {
2742b176e629SAndrei Otcheretianski 	struct ieee80211_channel *chan;
2743b176e629SAndrei Otcheretianski 	bool offchan;
2744b176e629SAndrei Otcheretianski 	unsigned int wait;
2745b176e629SAndrei Otcheretianski 	const u8 *buf;
2746b176e629SAndrei Otcheretianski 	size_t len;
2747b176e629SAndrei Otcheretianski 	bool no_cck;
2748b176e629SAndrei Otcheretianski 	bool dont_wait_for_ack;
274934d22ce2SAndrei Otcheretianski 	int n_csa_offsets;
275034d22ce2SAndrei Otcheretianski 	const u16 *csa_offsets;
2751b176e629SAndrei Otcheretianski };
2752b176e629SAndrei Otcheretianski 
2753b176e629SAndrei Otcheretianski /**
2754fa9ffc74SKyeyoon Park  * struct cfg80211_dscp_exception - DSCP exception
2755fa9ffc74SKyeyoon Park  *
2756fa9ffc74SKyeyoon Park  * @dscp: DSCP value that does not adhere to the user priority range definition
2757fa9ffc74SKyeyoon Park  * @up: user priority value to which the corresponding DSCP value belongs
2758fa9ffc74SKyeyoon Park  */
2759fa9ffc74SKyeyoon Park struct cfg80211_dscp_exception {
2760fa9ffc74SKyeyoon Park 	u8 dscp;
2761fa9ffc74SKyeyoon Park 	u8 up;
2762fa9ffc74SKyeyoon Park };
2763fa9ffc74SKyeyoon Park 
2764fa9ffc74SKyeyoon Park /**
2765fa9ffc74SKyeyoon Park  * struct cfg80211_dscp_range - DSCP range definition for user priority
2766fa9ffc74SKyeyoon Park  *
2767fa9ffc74SKyeyoon Park  * @low: lowest DSCP value of this user priority range, inclusive
2768fa9ffc74SKyeyoon Park  * @high: highest DSCP value of this user priority range, inclusive
2769fa9ffc74SKyeyoon Park  */
2770fa9ffc74SKyeyoon Park struct cfg80211_dscp_range {
2771fa9ffc74SKyeyoon Park 	u8 low;
2772fa9ffc74SKyeyoon Park 	u8 high;
2773fa9ffc74SKyeyoon Park };
2774fa9ffc74SKyeyoon Park 
2775fa9ffc74SKyeyoon Park /* QoS Map Set element length defined in IEEE Std 802.11-2012, 8.4.2.97 */
2776fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_MAX_EX	21
2777fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_LEN_MIN	16
2778fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_LEN_MAX \
2779fa9ffc74SKyeyoon Park 	(IEEE80211_QOS_MAP_LEN_MIN + 2 * IEEE80211_QOS_MAP_MAX_EX)
2780fa9ffc74SKyeyoon Park 
2781fa9ffc74SKyeyoon Park /**
2782fa9ffc74SKyeyoon Park  * struct cfg80211_qos_map - QoS Map Information
2783fa9ffc74SKyeyoon Park  *
2784fa9ffc74SKyeyoon Park  * This struct defines the Interworking QoS map setting for DSCP values
2785fa9ffc74SKyeyoon Park  *
2786fa9ffc74SKyeyoon Park  * @num_des: number of DSCP exceptions (0..21)
2787fa9ffc74SKyeyoon Park  * @dscp_exception: optionally up to maximum of 21 DSCP exceptions from
2788fa9ffc74SKyeyoon Park  *	the user priority DSCP range definition
2789fa9ffc74SKyeyoon Park  * @up: DSCP range definition for a particular user priority
2790fa9ffc74SKyeyoon Park  */
2791fa9ffc74SKyeyoon Park struct cfg80211_qos_map {
2792fa9ffc74SKyeyoon Park 	u8 num_des;
2793fa9ffc74SKyeyoon Park 	struct cfg80211_dscp_exception dscp_exception[IEEE80211_QOS_MAP_MAX_EX];
2794fa9ffc74SKyeyoon Park 	struct cfg80211_dscp_range up[8];
2795fa9ffc74SKyeyoon Park };
2796fa9ffc74SKyeyoon Park 
2797fa9ffc74SKyeyoon Park /**
2798cb3b7d87SAyala Beker  * struct cfg80211_nan_conf - NAN configuration
2799cb3b7d87SAyala Beker  *
2800cb3b7d87SAyala Beker  * This struct defines NAN configuration parameters
2801cb3b7d87SAyala Beker  *
2802cb3b7d87SAyala Beker  * @master_pref: master preference (1 - 255)
28038585989dSLuca Coelho  * @bands: operating bands, a bitmap of &enum nl80211_band values.
28048585989dSLuca Coelho  *	For instance, for NL80211_BAND_2GHZ, bit 0 would be set
28058585989dSLuca Coelho  *	(i.e. BIT(NL80211_BAND_2GHZ)).
2806cb3b7d87SAyala Beker  */
2807cb3b7d87SAyala Beker struct cfg80211_nan_conf {
2808cb3b7d87SAyala Beker 	u8 master_pref;
28098585989dSLuca Coelho 	u8 bands;
2810cb3b7d87SAyala Beker };
2811cb3b7d87SAyala Beker 
2812cb3b7d87SAyala Beker /**
2813a5a9dcf2SAyala Beker  * enum cfg80211_nan_conf_changes - indicates changed fields in NAN
2814a5a9dcf2SAyala Beker  * configuration
2815a5a9dcf2SAyala Beker  *
2816a5a9dcf2SAyala Beker  * @CFG80211_NAN_CONF_CHANGED_PREF: master preference
28178585989dSLuca Coelho  * @CFG80211_NAN_CONF_CHANGED_BANDS: operating bands
2818a5a9dcf2SAyala Beker  */
2819a5a9dcf2SAyala Beker enum cfg80211_nan_conf_changes {
2820a5a9dcf2SAyala Beker 	CFG80211_NAN_CONF_CHANGED_PREF = BIT(0),
28218585989dSLuca Coelho 	CFG80211_NAN_CONF_CHANGED_BANDS = BIT(1),
2822a5a9dcf2SAyala Beker };
2823a5a9dcf2SAyala Beker 
2824a5a9dcf2SAyala Beker /**
2825a442b761SAyala Beker  * struct cfg80211_nan_func_filter - a NAN function Rx / Tx filter
2826a442b761SAyala Beker  *
2827a442b761SAyala Beker  * @filter: the content of the filter
2828a442b761SAyala Beker  * @len: the length of the filter
2829a442b761SAyala Beker  */
2830a442b761SAyala Beker struct cfg80211_nan_func_filter {
2831a442b761SAyala Beker 	const u8 *filter;
2832a442b761SAyala Beker 	u8 len;
2833a442b761SAyala Beker };
2834a442b761SAyala Beker 
2835a442b761SAyala Beker /**
2836a442b761SAyala Beker  * struct cfg80211_nan_func - a NAN function
2837a442b761SAyala Beker  *
2838a442b761SAyala Beker  * @type: &enum nl80211_nan_function_type
2839a442b761SAyala Beker  * @service_id: the service ID of the function
2840a442b761SAyala Beker  * @publish_type: &nl80211_nan_publish_type
2841a442b761SAyala Beker  * @close_range: if true, the range should be limited. Threshold is
2842a442b761SAyala Beker  *	implementation specific.
2843a442b761SAyala Beker  * @publish_bcast: if true, the solicited publish should be broadcasted
2844a442b761SAyala Beker  * @subscribe_active: if true, the subscribe is active
2845a442b761SAyala Beker  * @followup_id: the instance ID for follow up
2846a442b761SAyala Beker  * @followup_reqid: the requestor instance ID for follow up
2847a442b761SAyala Beker  * @followup_dest: MAC address of the recipient of the follow up
2848a442b761SAyala Beker  * @ttl: time to live counter in DW.
2849a442b761SAyala Beker  * @serv_spec_info: Service Specific Info
2850a442b761SAyala Beker  * @serv_spec_info_len: Service Specific Info length
2851a442b761SAyala Beker  * @srf_include: if true, SRF is inclusive
2852a442b761SAyala Beker  * @srf_bf: Bloom Filter
2853a442b761SAyala Beker  * @srf_bf_len: Bloom Filter length
2854a442b761SAyala Beker  * @srf_bf_idx: Bloom Filter index
2855a442b761SAyala Beker  * @srf_macs: SRF MAC addresses
2856a442b761SAyala Beker  * @srf_num_macs: number of MAC addresses in SRF
2857a442b761SAyala Beker  * @rx_filters: rx filters that are matched with corresponding peer's tx_filter
2858a442b761SAyala Beker  * @tx_filters: filters that should be transmitted in the SDF.
2859a442b761SAyala Beker  * @num_rx_filters: length of &rx_filters.
2860a442b761SAyala Beker  * @num_tx_filters: length of &tx_filters.
2861a442b761SAyala Beker  * @instance_id: driver allocated id of the function.
2862a442b761SAyala Beker  * @cookie: unique NAN function identifier.
2863a442b761SAyala Beker  */
2864a442b761SAyala Beker struct cfg80211_nan_func {
2865a442b761SAyala Beker 	enum nl80211_nan_function_type type;
2866a442b761SAyala Beker 	u8 service_id[NL80211_NAN_FUNC_SERVICE_ID_LEN];
2867a442b761SAyala Beker 	u8 publish_type;
2868a442b761SAyala Beker 	bool close_range;
2869a442b761SAyala Beker 	bool publish_bcast;
2870a442b761SAyala Beker 	bool subscribe_active;
2871a442b761SAyala Beker 	u8 followup_id;
2872a442b761SAyala Beker 	u8 followup_reqid;
2873a442b761SAyala Beker 	struct mac_address followup_dest;
2874a442b761SAyala Beker 	u32 ttl;
2875a442b761SAyala Beker 	const u8 *serv_spec_info;
2876a442b761SAyala Beker 	u8 serv_spec_info_len;
2877a442b761SAyala Beker 	bool srf_include;
2878a442b761SAyala Beker 	const u8 *srf_bf;
2879a442b761SAyala Beker 	u8 srf_bf_len;
2880a442b761SAyala Beker 	u8 srf_bf_idx;
2881a442b761SAyala Beker 	struct mac_address *srf_macs;
2882a442b761SAyala Beker 	int srf_num_macs;
2883a442b761SAyala Beker 	struct cfg80211_nan_func_filter *rx_filters;
2884a442b761SAyala Beker 	struct cfg80211_nan_func_filter *tx_filters;
2885a442b761SAyala Beker 	u8 num_tx_filters;
2886a442b761SAyala Beker 	u8 num_rx_filters;
2887a442b761SAyala Beker 	u8 instance_id;
2888a442b761SAyala Beker 	u64 cookie;
2889a442b761SAyala Beker };
2890a442b761SAyala Beker 
2891a442b761SAyala Beker /**
28923a00df57SAvraham Stern  * struct cfg80211_pmk_conf - PMK configuration
28933a00df57SAvraham Stern  *
28943a00df57SAvraham Stern  * @aa: authenticator address
28953a00df57SAvraham Stern  * @pmk_len: PMK length in bytes.
28963a00df57SAvraham Stern  * @pmk: the PMK material
28973a00df57SAvraham Stern  * @pmk_r0_name: PMK-R0 Name. NULL if not applicable (i.e., the PMK
28983a00df57SAvraham Stern  *	is not PMK-R0). When pmk_r0_name is not NULL, the pmk field
28993a00df57SAvraham Stern  *	holds PMK-R0.
29003a00df57SAvraham Stern  */
29013a00df57SAvraham Stern struct cfg80211_pmk_conf {
29023a00df57SAvraham Stern 	const u8 *aa;
29033a00df57SAvraham Stern 	u8 pmk_len;
29043a00df57SAvraham Stern 	const u8 *pmk;
29053a00df57SAvraham Stern 	const u8 *pmk_r0_name;
29063a00df57SAvraham Stern };
29073a00df57SAvraham Stern 
29083a00df57SAvraham Stern /**
290940cbfa90SSrinivas Dasari  * struct cfg80211_external_auth_params - Trigger External authentication.
291040cbfa90SSrinivas Dasari  *
291140cbfa90SSrinivas Dasari  * Commonly used across the external auth request and event interfaces.
291240cbfa90SSrinivas Dasari  *
291340cbfa90SSrinivas Dasari  * @action: action type / trigger for external authentication. Only significant
291440cbfa90SSrinivas Dasari  *	for the authentication request event interface (driver to user space).
291540cbfa90SSrinivas Dasari  * @bssid: BSSID of the peer with which the authentication has
291640cbfa90SSrinivas Dasari  *	to happen. Used by both the authentication request event and
291740cbfa90SSrinivas Dasari  *	authentication response command interface.
291840cbfa90SSrinivas Dasari  * @ssid: SSID of the AP.  Used by both the authentication request event and
291940cbfa90SSrinivas Dasari  *	authentication response command interface.
292040cbfa90SSrinivas Dasari  * @key_mgmt_suite: AKM suite of the respective authentication. Used by the
292140cbfa90SSrinivas Dasari  *	authentication request event interface.
292240cbfa90SSrinivas Dasari  * @status: status code, %WLAN_STATUS_SUCCESS for successful authentication,
292340cbfa90SSrinivas Dasari  *	use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space cannot give you
292440cbfa90SSrinivas Dasari  *	the real status code for failures. Used only for the authentication
292540cbfa90SSrinivas Dasari  *	response command interface (user space to driver).
2926fe494370SSrinivas Dasari  * @pmkid: The identifier to refer a PMKSA.
292740cbfa90SSrinivas Dasari  */
292840cbfa90SSrinivas Dasari struct cfg80211_external_auth_params {
292940cbfa90SSrinivas Dasari 	enum nl80211_external_auth_action action;
293040cbfa90SSrinivas Dasari 	u8 bssid[ETH_ALEN] __aligned(2);
293140cbfa90SSrinivas Dasari 	struct cfg80211_ssid ssid;
293240cbfa90SSrinivas Dasari 	unsigned int key_mgmt_suite;
293340cbfa90SSrinivas Dasari 	u16 status;
2934fe494370SSrinivas Dasari 	const u8 *pmkid;
293540cbfa90SSrinivas Dasari };
293640cbfa90SSrinivas Dasari 
293740cbfa90SSrinivas Dasari /**
29383453de98SRandy Dunlap  * struct cfg80211_ftm_responder_stats - FTM responder statistics
293981e54d08SPradeep Kumar Chitrapu  *
294081e54d08SPradeep Kumar Chitrapu  * @filled: bitflag of flags using the bits of &enum nl80211_ftm_stats to
294181e54d08SPradeep Kumar Chitrapu  *	indicate the relevant values in this struct for them
294281e54d08SPradeep Kumar Chitrapu  * @success_num: number of FTM sessions in which all frames were successfully
294381e54d08SPradeep Kumar Chitrapu  *	answered
294481e54d08SPradeep Kumar Chitrapu  * @partial_num: number of FTM sessions in which part of frames were
294581e54d08SPradeep Kumar Chitrapu  *	successfully answered
294681e54d08SPradeep Kumar Chitrapu  * @failed_num: number of failed FTM sessions
294781e54d08SPradeep Kumar Chitrapu  * @asap_num: number of ASAP FTM sessions
294881e54d08SPradeep Kumar Chitrapu  * @non_asap_num: number of  non-ASAP FTM sessions
294981e54d08SPradeep Kumar Chitrapu  * @total_duration_ms: total sessions durations - gives an indication
295081e54d08SPradeep Kumar Chitrapu  *	of how much time the responder was busy
295181e54d08SPradeep Kumar Chitrapu  * @unknown_triggers_num: number of unknown FTM triggers - triggers from
295281e54d08SPradeep Kumar Chitrapu  *	initiators that didn't finish successfully the negotiation phase with
295381e54d08SPradeep Kumar Chitrapu  *	the responder
295481e54d08SPradeep Kumar Chitrapu  * @reschedule_requests_num: number of FTM reschedule requests - initiator asks
295581e54d08SPradeep Kumar Chitrapu  *	for a new scheduling although it already has scheduled FTM slot
295681e54d08SPradeep Kumar Chitrapu  * @out_of_window_triggers_num: total FTM triggers out of scheduled window
295781e54d08SPradeep Kumar Chitrapu  */
295881e54d08SPradeep Kumar Chitrapu struct cfg80211_ftm_responder_stats {
295981e54d08SPradeep Kumar Chitrapu 	u32 filled;
296081e54d08SPradeep Kumar Chitrapu 	u32 success_num;
296181e54d08SPradeep Kumar Chitrapu 	u32 partial_num;
296281e54d08SPradeep Kumar Chitrapu 	u32 failed_num;
296381e54d08SPradeep Kumar Chitrapu 	u32 asap_num;
296481e54d08SPradeep Kumar Chitrapu 	u32 non_asap_num;
296581e54d08SPradeep Kumar Chitrapu 	u64 total_duration_ms;
296681e54d08SPradeep Kumar Chitrapu 	u32 unknown_triggers_num;
296781e54d08SPradeep Kumar Chitrapu 	u32 reschedule_requests_num;
296881e54d08SPradeep Kumar Chitrapu 	u32 out_of_window_triggers_num;
296981e54d08SPradeep Kumar Chitrapu };
297081e54d08SPradeep Kumar Chitrapu 
297181e54d08SPradeep Kumar Chitrapu /**
29729bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_ftm_result - FTM result
29739bb7e0f2SJohannes Berg  * @failure_reason: if this measurement failed (PMSR status is
29749bb7e0f2SJohannes Berg  *	%NL80211_PMSR_STATUS_FAILURE), this gives a more precise
29759bb7e0f2SJohannes Berg  *	reason than just "failure"
29769bb7e0f2SJohannes Berg  * @burst_index: if reporting partial results, this is the index
29779bb7e0f2SJohannes Berg  *	in [0 .. num_bursts-1] of the burst that's being reported
29789bb7e0f2SJohannes Berg  * @num_ftmr_attempts: number of FTM request frames transmitted
29799bb7e0f2SJohannes Berg  * @num_ftmr_successes: number of FTM request frames acked
29809bb7e0f2SJohannes Berg  * @busy_retry_time: if failure_reason is %NL80211_PMSR_FTM_FAILURE_PEER_BUSY,
29819bb7e0f2SJohannes Berg  *	fill this to indicate in how many seconds a retry is deemed possible
29829bb7e0f2SJohannes Berg  *	by the responder
29839bb7e0f2SJohannes Berg  * @num_bursts_exp: actual number of bursts exponent negotiated
29849bb7e0f2SJohannes Berg  * @burst_duration: actual burst duration negotiated
29859bb7e0f2SJohannes Berg  * @ftms_per_burst: actual FTMs per burst negotiated
29869bb7e0f2SJohannes Berg  * @lci_len: length of LCI information (if present)
29879bb7e0f2SJohannes Berg  * @civicloc_len: length of civic location information (if present)
29889bb7e0f2SJohannes Berg  * @lci: LCI data (may be %NULL)
29899bb7e0f2SJohannes Berg  * @civicloc: civic location data (may be %NULL)
29909bb7e0f2SJohannes Berg  * @rssi_avg: average RSSI over FTM action frames reported
29919bb7e0f2SJohannes Berg  * @rssi_spread: spread of the RSSI over FTM action frames reported
29929bb7e0f2SJohannes Berg  * @tx_rate: bitrate for transmitted FTM action frame response
29939bb7e0f2SJohannes Berg  * @rx_rate: bitrate of received FTM action frame
29949bb7e0f2SJohannes Berg  * @rtt_avg: average of RTTs measured (must have either this or @dist_avg)
29959bb7e0f2SJohannes Berg  * @rtt_variance: variance of RTTs measured (note that standard deviation is
29969bb7e0f2SJohannes Berg  *	the square root of the variance)
29979bb7e0f2SJohannes Berg  * @rtt_spread: spread of the RTTs measured
29989bb7e0f2SJohannes Berg  * @dist_avg: average of distances (mm) measured
29999bb7e0f2SJohannes Berg  *	(must have either this or @rtt_avg)
30009bb7e0f2SJohannes Berg  * @dist_variance: variance of distances measured (see also @rtt_variance)
30019bb7e0f2SJohannes Berg  * @dist_spread: spread of distances measured (see also @rtt_spread)
30029bb7e0f2SJohannes Berg  * @num_ftmr_attempts_valid: @num_ftmr_attempts is valid
30039bb7e0f2SJohannes Berg  * @num_ftmr_successes_valid: @num_ftmr_successes is valid
30049bb7e0f2SJohannes Berg  * @rssi_avg_valid: @rssi_avg is valid
30059bb7e0f2SJohannes Berg  * @rssi_spread_valid: @rssi_spread is valid
30069bb7e0f2SJohannes Berg  * @tx_rate_valid: @tx_rate is valid
30079bb7e0f2SJohannes Berg  * @rx_rate_valid: @rx_rate is valid
30089bb7e0f2SJohannes Berg  * @rtt_avg_valid: @rtt_avg is valid
30099bb7e0f2SJohannes Berg  * @rtt_variance_valid: @rtt_variance is valid
30109bb7e0f2SJohannes Berg  * @rtt_spread_valid: @rtt_spread is valid
30119bb7e0f2SJohannes Berg  * @dist_avg_valid: @dist_avg is valid
30129bb7e0f2SJohannes Berg  * @dist_variance_valid: @dist_variance is valid
30139bb7e0f2SJohannes Berg  * @dist_spread_valid: @dist_spread is valid
30149bb7e0f2SJohannes Berg  */
30159bb7e0f2SJohannes Berg struct cfg80211_pmsr_ftm_result {
30169bb7e0f2SJohannes Berg 	const u8 *lci;
30179bb7e0f2SJohannes Berg 	const u8 *civicloc;
30189bb7e0f2SJohannes Berg 	unsigned int lci_len;
30199bb7e0f2SJohannes Berg 	unsigned int civicloc_len;
30209bb7e0f2SJohannes Berg 	enum nl80211_peer_measurement_ftm_failure_reasons failure_reason;
30219bb7e0f2SJohannes Berg 	u32 num_ftmr_attempts, num_ftmr_successes;
30229bb7e0f2SJohannes Berg 	s16 burst_index;
30239bb7e0f2SJohannes Berg 	u8 busy_retry_time;
30249bb7e0f2SJohannes Berg 	u8 num_bursts_exp;
30259bb7e0f2SJohannes Berg 	u8 burst_duration;
30269bb7e0f2SJohannes Berg 	u8 ftms_per_burst;
30279bb7e0f2SJohannes Berg 	s32 rssi_avg;
30289bb7e0f2SJohannes Berg 	s32 rssi_spread;
30299bb7e0f2SJohannes Berg 	struct rate_info tx_rate, rx_rate;
30309bb7e0f2SJohannes Berg 	s64 rtt_avg;
30319bb7e0f2SJohannes Berg 	s64 rtt_variance;
30329bb7e0f2SJohannes Berg 	s64 rtt_spread;
30339bb7e0f2SJohannes Berg 	s64 dist_avg;
30349bb7e0f2SJohannes Berg 	s64 dist_variance;
30359bb7e0f2SJohannes Berg 	s64 dist_spread;
30369bb7e0f2SJohannes Berg 
30379bb7e0f2SJohannes Berg 	u16 num_ftmr_attempts_valid:1,
30389bb7e0f2SJohannes Berg 	    num_ftmr_successes_valid:1,
30399bb7e0f2SJohannes Berg 	    rssi_avg_valid:1,
30409bb7e0f2SJohannes Berg 	    rssi_spread_valid:1,
30419bb7e0f2SJohannes Berg 	    tx_rate_valid:1,
30429bb7e0f2SJohannes Berg 	    rx_rate_valid:1,
30439bb7e0f2SJohannes Berg 	    rtt_avg_valid:1,
30449bb7e0f2SJohannes Berg 	    rtt_variance_valid:1,
30459bb7e0f2SJohannes Berg 	    rtt_spread_valid:1,
30469bb7e0f2SJohannes Berg 	    dist_avg_valid:1,
30479bb7e0f2SJohannes Berg 	    dist_variance_valid:1,
30489bb7e0f2SJohannes Berg 	    dist_spread_valid:1;
30499bb7e0f2SJohannes Berg };
30509bb7e0f2SJohannes Berg 
30519bb7e0f2SJohannes Berg /**
30529bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_result - peer measurement result
30539bb7e0f2SJohannes Berg  * @addr: address of the peer
30549bb7e0f2SJohannes Berg  * @host_time: host time (use ktime_get_boottime() adjust to the time when the
30559bb7e0f2SJohannes Berg  *	measurement was made)
30569bb7e0f2SJohannes Berg  * @ap_tsf: AP's TSF at measurement time
30579bb7e0f2SJohannes Berg  * @status: status of the measurement
30589bb7e0f2SJohannes Berg  * @final: if reporting partial results, mark this as the last one; if not
30599bb7e0f2SJohannes Berg  *	reporting partial results always set this flag
30609bb7e0f2SJohannes Berg  * @ap_tsf_valid: indicates the @ap_tsf value is valid
30619bb7e0f2SJohannes Berg  * @type: type of the measurement reported, note that we only support reporting
30629bb7e0f2SJohannes Berg  *	one type at a time, but you can report multiple results separately and
30639bb7e0f2SJohannes Berg  *	they're all aggregated for userspace.
30649bb7e0f2SJohannes Berg  */
30659bb7e0f2SJohannes Berg struct cfg80211_pmsr_result {
30669bb7e0f2SJohannes Berg 	u64 host_time, ap_tsf;
30679bb7e0f2SJohannes Berg 	enum nl80211_peer_measurement_status status;
30689bb7e0f2SJohannes Berg 
30699bb7e0f2SJohannes Berg 	u8 addr[ETH_ALEN];
30709bb7e0f2SJohannes Berg 
30719bb7e0f2SJohannes Berg 	u8 final:1,
30729bb7e0f2SJohannes Berg 	   ap_tsf_valid:1;
30739bb7e0f2SJohannes Berg 
30749bb7e0f2SJohannes Berg 	enum nl80211_peer_measurement_type type;
30759bb7e0f2SJohannes Berg 
30769bb7e0f2SJohannes Berg 	union {
30779bb7e0f2SJohannes Berg 		struct cfg80211_pmsr_ftm_result ftm;
30789bb7e0f2SJohannes Berg 	};
30799bb7e0f2SJohannes Berg };
30809bb7e0f2SJohannes Berg 
30819bb7e0f2SJohannes Berg /**
30829bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_ftm_request_peer - FTM request data
30839bb7e0f2SJohannes Berg  * @requested: indicates FTM is requested
30849bb7e0f2SJohannes Berg  * @preamble: frame preamble to use
30859bb7e0f2SJohannes Berg  * @burst_period: burst period to use
30869bb7e0f2SJohannes Berg  * @asap: indicates to use ASAP mode
30879bb7e0f2SJohannes Berg  * @num_bursts_exp: number of bursts exponent
30889bb7e0f2SJohannes Berg  * @burst_duration: burst duration
30899bb7e0f2SJohannes Berg  * @ftms_per_burst: number of FTMs per burst
30909bb7e0f2SJohannes Berg  * @ftmr_retries: number of retries for FTM request
30919bb7e0f2SJohannes Berg  * @request_lci: request LCI information
30929bb7e0f2SJohannes Berg  * @request_civicloc: request civic location information
30939bb7e0f2SJohannes Berg  *
30949bb7e0f2SJohannes Berg  * See also nl80211 for the respective attribute documentation.
30959bb7e0f2SJohannes Berg  */
30969bb7e0f2SJohannes Berg struct cfg80211_pmsr_ftm_request_peer {
30979bb7e0f2SJohannes Berg 	enum nl80211_preamble preamble;
30989bb7e0f2SJohannes Berg 	u16 burst_period;
30999bb7e0f2SJohannes Berg 	u8 requested:1,
31009bb7e0f2SJohannes Berg 	   asap:1,
31019bb7e0f2SJohannes Berg 	   request_lci:1,
31029bb7e0f2SJohannes Berg 	   request_civicloc:1;
31039bb7e0f2SJohannes Berg 	u8 num_bursts_exp;
31049bb7e0f2SJohannes Berg 	u8 burst_duration;
31059bb7e0f2SJohannes Berg 	u8 ftms_per_burst;
31069bb7e0f2SJohannes Berg 	u8 ftmr_retries;
31079bb7e0f2SJohannes Berg };
31089bb7e0f2SJohannes Berg 
31099bb7e0f2SJohannes Berg /**
31109bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_request_peer - peer data for a peer measurement request
31119bb7e0f2SJohannes Berg  * @addr: MAC address
31129bb7e0f2SJohannes Berg  * @chandef: channel to use
31139bb7e0f2SJohannes Berg  * @report_ap_tsf: report the associated AP's TSF
31149bb7e0f2SJohannes Berg  * @ftm: FTM data, see &struct cfg80211_pmsr_ftm_request_peer
31159bb7e0f2SJohannes Berg  */
31169bb7e0f2SJohannes Berg struct cfg80211_pmsr_request_peer {
31179bb7e0f2SJohannes Berg 	u8 addr[ETH_ALEN];
31189bb7e0f2SJohannes Berg 	struct cfg80211_chan_def chandef;
31199bb7e0f2SJohannes Berg 	u8 report_ap_tsf:1;
31209bb7e0f2SJohannes Berg 	struct cfg80211_pmsr_ftm_request_peer ftm;
31219bb7e0f2SJohannes Berg };
31229bb7e0f2SJohannes Berg 
31239bb7e0f2SJohannes Berg /**
31249bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_request - peer measurement request
31259bb7e0f2SJohannes Berg  * @cookie: cookie, set by cfg80211
31269bb7e0f2SJohannes Berg  * @nl_portid: netlink portid - used by cfg80211
31279bb7e0f2SJohannes Berg  * @drv_data: driver data for this request, if required for aborting,
31289bb7e0f2SJohannes Berg  *	not otherwise freed or anything by cfg80211
31299bb7e0f2SJohannes Berg  * @mac_addr: MAC address used for (randomised) request
31309bb7e0f2SJohannes Berg  * @mac_addr_mask: MAC address mask used for randomisation, bits that
31319bb7e0f2SJohannes Berg  *	are 0 in the mask should be randomised, bits that are 1 should
31329bb7e0f2SJohannes Berg  *	be taken from the @mac_addr
31339bb7e0f2SJohannes Berg  * @list: used by cfg80211 to hold on to the request
31349bb7e0f2SJohannes Berg  * @timeout: timeout (in milliseconds) for the whole operation, if
31359bb7e0f2SJohannes Berg  *	zero it means there's no timeout
31369bb7e0f2SJohannes Berg  * @n_peers: number of peers to do measurements with
31379bb7e0f2SJohannes Berg  * @peers: per-peer measurement request data
31389bb7e0f2SJohannes Berg  */
31399bb7e0f2SJohannes Berg struct cfg80211_pmsr_request {
31409bb7e0f2SJohannes Berg 	u64 cookie;
31419bb7e0f2SJohannes Berg 	void *drv_data;
31429bb7e0f2SJohannes Berg 	u32 n_peers;
31439bb7e0f2SJohannes Berg 	u32 nl_portid;
31449bb7e0f2SJohannes Berg 
31459bb7e0f2SJohannes Berg 	u32 timeout;
31469bb7e0f2SJohannes Berg 
31479bb7e0f2SJohannes Berg 	u8 mac_addr[ETH_ALEN] __aligned(2);
31489bb7e0f2SJohannes Berg 	u8 mac_addr_mask[ETH_ALEN] __aligned(2);
31499bb7e0f2SJohannes Berg 
31509bb7e0f2SJohannes Berg 	struct list_head list;
31519bb7e0f2SJohannes Berg 
31529bb7e0f2SJohannes Berg 	struct cfg80211_pmsr_request_peer peers[];
31539bb7e0f2SJohannes Berg };
31549bb7e0f2SJohannes Berg 
31559bb7e0f2SJohannes Berg /**
3156cb74e977SSunil Dutt  * struct cfg80211_update_owe_info - OWE Information
3157cb74e977SSunil Dutt  *
3158cb74e977SSunil Dutt  * This structure provides information needed for the drivers to offload OWE
3159cb74e977SSunil Dutt  * (Opportunistic Wireless Encryption) processing to the user space.
3160cb74e977SSunil Dutt  *
3161cb74e977SSunil Dutt  * Commonly used across update_owe_info request and event interfaces.
3162cb74e977SSunil Dutt  *
3163cb74e977SSunil Dutt  * @peer: MAC address of the peer device for which the OWE processing
3164cb74e977SSunil Dutt  *	has to be done.
3165cb74e977SSunil Dutt  * @status: status code, %WLAN_STATUS_SUCCESS for successful OWE info
3166cb74e977SSunil Dutt  *	processing, use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space
3167cb74e977SSunil Dutt  *	cannot give you the real status code for failures. Used only for
3168cb74e977SSunil Dutt  *	OWE update request command interface (user space to driver).
3169cb74e977SSunil Dutt  * @ie: IEs obtained from the peer or constructed by the user space. These are
3170cb74e977SSunil Dutt  *	the IEs of the remote peer in the event from the host driver and
3171cb74e977SSunil Dutt  *	the constructed IEs by the user space in the request interface.
3172cb74e977SSunil Dutt  * @ie_len: Length of IEs in octets.
3173cb74e977SSunil Dutt  */
3174cb74e977SSunil Dutt struct cfg80211_update_owe_info {
3175cb74e977SSunil Dutt 	u8 peer[ETH_ALEN] __aligned(2);
3176cb74e977SSunil Dutt 	u16 status;
3177cb74e977SSunil Dutt 	const u8 *ie;
3178cb74e977SSunil Dutt 	size_t ie_len;
3179cb74e977SSunil Dutt };
3180cb74e977SSunil Dutt 
3181cb74e977SSunil Dutt /**
3182704232c2SJohannes Berg  * struct cfg80211_ops - backend description for wireless configuration
3183704232c2SJohannes Berg  *
3184704232c2SJohannes Berg  * This struct is registered by fullmac card drivers and/or wireless stacks
3185704232c2SJohannes Berg  * in order to handle configuration requests on their interfaces.
3186704232c2SJohannes Berg  *
3187704232c2SJohannes Berg  * All callbacks except where otherwise noted should return 0
3188704232c2SJohannes Berg  * on success or a negative error code.
3189704232c2SJohannes Berg  *
319043fb45cbSJohannes Berg  * All operations are currently invoked under rtnl for consistency with the
319143fb45cbSJohannes Berg  * wireless extensions but this is subject to reevaluation as soon as this
319243fb45cbSJohannes Berg  * code is used more widely and we have a first user without wext.
319343fb45cbSJohannes Berg  *
3194ff1b6e69SJohannes Berg  * @suspend: wiphy device needs to be suspended. The variable @wow will
3195ff1b6e69SJohannes Berg  *	be %NULL or contain the enabled Wake-on-Wireless triggers that are
3196ff1b6e69SJohannes Berg  *	configured for the device.
31970378b3f1SJohannes Berg  * @resume: wiphy device needs to be resumed
31986d52563fSJohannes Berg  * @set_wakeup: Called when WoWLAN is enabled/disabled, use this callback
31996d52563fSJohannes Berg  *	to call device_set_wakeup_enable() to enable/disable wakeup from
32006d52563fSJohannes Berg  *	the device.
32010378b3f1SJohannes Berg  *
320260719ffdSJohannes Berg  * @add_virtual_intf: create a new virtual interface with the given name,
3203463d0183SJohannes Berg  *	must set the struct wireless_dev's iftype. Beware: You must create
320484efbb84SJohannes Berg  *	the new netdev in the wiphy's network namespace! Returns the struct
320598104fdeSJohannes Berg  *	wireless_dev, or an ERR_PTR. For P2P device wdevs, the driver must
320698104fdeSJohannes Berg  *	also set the address member in the wdev.
3207704232c2SJohannes Berg  *
320884efbb84SJohannes Berg  * @del_virtual_intf: remove the virtual interface
320955682965SJohannes Berg  *
321060719ffdSJohannes Berg  * @change_virtual_intf: change type/configuration of virtual interface,
321160719ffdSJohannes Berg  *	keep the struct wireless_dev's iftype updated.
321255682965SJohannes Berg  *
321341ade00fSJohannes Berg  * @add_key: add a key with the given parameters. @mac_addr will be %NULL
321441ade00fSJohannes Berg  *	when adding a group key.
321541ade00fSJohannes Berg  *
321641ade00fSJohannes Berg  * @get_key: get information about the key with the given parameters.
321741ade00fSJohannes Berg  *	@mac_addr will be %NULL when requesting information for a group
321841ade00fSJohannes Berg  *	key. All pointers given to the @callback function need not be valid
3219e3da574aSJohannes Berg  *	after it returns. This function should return an error if it is
3220e3da574aSJohannes Berg  *	not possible to retrieve the key, -ENOENT if it doesn't exist.
322141ade00fSJohannes Berg  *
322241ade00fSJohannes Berg  * @del_key: remove a key given the @mac_addr (%NULL for a group key)
3223e3da574aSJohannes Berg  *	and @key_index, return -ENOENT if the key doesn't exist.
322441ade00fSJohannes Berg  *
322541ade00fSJohannes Berg  * @set_default_key: set the default key on an interface
3226ed1b6cc7SJohannes Berg  *
32273cfcf6acSJouni Malinen  * @set_default_mgmt_key: set the default management frame key on an interface
32283cfcf6acSJouni Malinen  *
3229e5497d76SJohannes Berg  * @set_rekey_data: give the data necessary for GTK rekeying to the driver
3230e5497d76SJohannes Berg  *
3231c04a4ff7SJohannes Berg  * @start_ap: Start acting in AP mode defined by the parameters.
3232c04a4ff7SJohannes Berg  * @change_beacon: Change the beacon parameters for an access point mode
3233c04a4ff7SJohannes Berg  *	interface. This should reject the call when AP mode wasn't started.
3234c04a4ff7SJohannes Berg  * @stop_ap: Stop being an AP, including stopping beaconing.
32355727ef1bSJohannes Berg  *
32365727ef1bSJohannes Berg  * @add_station: Add a new station.
323789c771e5SJouni Malinen  * @del_station: Remove a station
3238bdd90d5eSJohannes Berg  * @change_station: Modify a given station. Note that flags changes are not much
3239bdd90d5eSJohannes Berg  *	validated in cfg80211, in particular the auth/assoc/authorized flags
3240bdd90d5eSJohannes Berg  *	might come to the driver in invalid combinations -- make sure to check
324177ee7c89SJohannes Berg  *	them, also against the existing state! Drivers must call
324277ee7c89SJohannes Berg  *	cfg80211_check_station_change() to validate the information.
3243abe37c4bSJohannes Berg  * @get_station: get station information for the station identified by @mac
3244abe37c4bSJohannes Berg  * @dump_station: dump station callback -- resume dump at index @idx
3245abe37c4bSJohannes Berg  *
3246abe37c4bSJohannes Berg  * @add_mpath: add a fixed mesh path
3247abe37c4bSJohannes Berg  * @del_mpath: delete a given mesh path
3248abe37c4bSJohannes Berg  * @change_mpath: change a given mesh path
3249abe37c4bSJohannes Berg  * @get_mpath: get a mesh path for the given parameters
3250abe37c4bSJohannes Berg  * @dump_mpath: dump mesh path callback -- resume dump at index @idx
325166be7d2bSHenning Rogge  * @get_mpp: get a mesh proxy path for the given parameters
325266be7d2bSHenning Rogge  * @dump_mpp: dump mesh proxy path callback -- resume dump at index @idx
3253f52555a4SJohannes Berg  * @join_mesh: join the mesh network with the specified parameters
32548d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
3255f52555a4SJohannes Berg  * @leave_mesh: leave the current mesh network
32568d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
32572ec600d6SLuis Carlos Cobo  *
325824bdd9f4SJavier Cardona  * @get_mesh_config: Get the current mesh configuration
325993da9cc1Scolin@cozybit.com  *
326024bdd9f4SJavier Cardona  * @update_mesh_config: Update mesh parameters on a running mesh.
326193da9cc1Scolin@cozybit.com  *	The mask is a bitfield which tells us which parameters to
326293da9cc1Scolin@cozybit.com  *	set, and which to leave alone.
326393da9cc1Scolin@cozybit.com  *
32649f1ba906SJouni Malinen  * @change_bss: Modify parameters for a given BSS.
326531888487SJouni Malinen  *
326631888487SJouni Malinen  * @set_txq_params: Set TX queue parameters
326772bdcf34SJouni Malinen  *
3268e8c9bd5bSJohannes Berg  * @libertas_set_mesh_channel: Only for backward compatibility for libertas,
3269e8c9bd5bSJohannes Berg  *	as it doesn't implement join_mesh and needs to set the channel to
3270e8c9bd5bSJohannes Berg  *	join the mesh instead.
3271e8c9bd5bSJohannes Berg  *
3272e8c9bd5bSJohannes Berg  * @set_monitor_channel: Set the monitor mode channel for the device. If other
3273e8c9bd5bSJohannes Berg  *	interfaces are active this callback should reject the configuration.
3274e8c9bd5bSJohannes Berg  *	If no interfaces are active or the device is down, the channel should
3275e8c9bd5bSJohannes Berg  *	be stored for when a monitor interface becomes active.
32769aed3cc1SJouni Malinen  *
32772a519311SJohannes Berg  * @scan: Request to do a scan. If returning zero, the scan request is given
32782a519311SJohannes Berg  *	the driver, and will be valid until passed to cfg80211_scan_done().
32792a519311SJohannes Berg  *	For scan results, call cfg80211_inform_bss(); you can call this outside
32802a519311SJohannes Berg  *	the scan/scan_done bracket too.
328191d3ab46SVidyullatha Kanchanapally  * @abort_scan: Tell the driver to abort an ongoing scan. The driver shall
328291d3ab46SVidyullatha Kanchanapally  *	indicate the status of the scan through cfg80211_scan_done().
3283636a5d36SJouni Malinen  *
3284636a5d36SJouni Malinen  * @auth: Request to authenticate with the specified peer
32858d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
3286636a5d36SJouni Malinen  * @assoc: Request to (re)associate with the specified peer
32878d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
3288636a5d36SJouni Malinen  * @deauth: Request to deauthenticate from the specified peer
32898d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
3290636a5d36SJouni Malinen  * @disassoc: Request to disassociate from the specified peer
32918d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
329204a773adSJohannes Berg  *
3293b23aa676SSamuel Ortiz  * @connect: Connect to the ESS with the specified parameters. When connected,
3294bf1ecd21SJouni Malinen  *	call cfg80211_connect_result()/cfg80211_connect_bss() with status code
3295bf1ecd21SJouni Malinen  *	%WLAN_STATUS_SUCCESS. If the connection fails for some reason, call
3296bf1ecd21SJouni Malinen  *	cfg80211_connect_result()/cfg80211_connect_bss() with the status code
3297bf1ecd21SJouni Malinen  *	from the AP or cfg80211_connect_timeout() if no frame with status code
3298bf1ecd21SJouni Malinen  *	was received.
3299bf1ecd21SJouni Malinen  *	The driver is allowed to roam to other BSSes within the ESS when the
3300bf1ecd21SJouni Malinen  *	other BSS matches the connect parameters. When such roaming is initiated
3301bf1ecd21SJouni Malinen  *	by the driver, the driver is expected to verify that the target matches
3302bf1ecd21SJouni Malinen  *	the configured security parameters and to use Reassociation Request
3303bf1ecd21SJouni Malinen  *	frame instead of Association Request frame.
3304bf1ecd21SJouni Malinen  *	The connect function can also be used to request the driver to perform a
3305bf1ecd21SJouni Malinen  *	specific roam when connected to an ESS. In that case, the prev_bssid
330635eb8f7bSJouni Malinen  *	parameter is set to the BSSID of the currently associated BSS as an
3307bf1ecd21SJouni Malinen  *	indication of requesting reassociation.
3308bf1ecd21SJouni Malinen  *	In both the driver-initiated and new connect() call initiated roaming
3309bf1ecd21SJouni Malinen  *	cases, the result of roaming is indicated with a call to
331029ce6ecbSAvraham Stern  *	cfg80211_roamed(). (invoked with the wireless_dev mutex held)
3311088e8df8Svamsi krishna  * @update_connect_params: Update the connect parameters while connected to a
3312088e8df8Svamsi krishna  *	BSS. The updated parameters can be used by driver/firmware for
3313088e8df8Svamsi krishna  *	subsequent BSS selection (roaming) decisions and to form the
3314088e8df8Svamsi krishna  *	Authentication/(Re)Association Request frames. This call does not
3315088e8df8Svamsi krishna  *	request an immediate disassociation or reassociation with the current
3316088e8df8Svamsi krishna  *	BSS, i.e., this impacts only subsequent (re)associations. The bits in
3317088e8df8Svamsi krishna  *	changed are defined in &enum cfg80211_connect_params_changed.
3318088e8df8Svamsi krishna  *	(invoked with the wireless_dev mutex held)
33190711d638SIlan Peer  * @disconnect: Disconnect from the BSS/ESS or stop connection attempts if
33200711d638SIlan Peer  *      connection is in progress. Once done, call cfg80211_disconnected() in
33210711d638SIlan Peer  *      case connection was already established (invoked with the
33220711d638SIlan Peer  *      wireless_dev mutex held), otherwise call cfg80211_connect_timeout().
3323b23aa676SSamuel Ortiz  *
332404a773adSJohannes Berg  * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call
332504a773adSJohannes Berg  *	cfg80211_ibss_joined(), also call that function when changing BSSID due
332604a773adSJohannes Berg  *	to a merge.
33278d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
332804a773adSJohannes Berg  * @leave_ibss: Leave the IBSS.
33298d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
3330b9a5f8caSJouni Malinen  *
3331f4e583c8SAntonio Quartulli  * @set_mcast_rate: Set the specified multicast rate (only if vif is in ADHOC or
3332f4e583c8SAntonio Quartulli  *	MESH mode)
3333f4e583c8SAntonio Quartulli  *
3334b9a5f8caSJouni Malinen  * @set_wiphy_params: Notify that wiphy parameters have changed;
3335b9a5f8caSJouni Malinen  *	@changed bitfield (see &enum wiphy_params_flags) describes which values
3336b9a5f8caSJouni Malinen  *	have changed. The actual parameter values are available in
3337b9a5f8caSJouni Malinen  *	struct wiphy. If returning an error, no value should be changed.
33387643a2c3SJohannes Berg  *
33391432de07SLuis R. Rodriguez  * @set_tx_power: set the transmit power according to the parameters,
3340c8442118SJohannes Berg  *	the power passed is in mBm, to get dBm use MBM_TO_DBM(). The
3341c8442118SJohannes Berg  *	wdev may be %NULL if power was set for the wiphy, and will
3342c8442118SJohannes Berg  *	always be %NULL unless the driver supports per-vif TX power
3343c8442118SJohannes Berg  *	(as advertised by the nl80211 feature flag.)
33447643a2c3SJohannes Berg  * @get_tx_power: store the current TX power into the dbm variable;
33451f87f7d3SJohannes Berg  *	return 0 if successful
33461f87f7d3SJohannes Berg  *
3347abe37c4bSJohannes Berg  * @set_wds_peer: set the WDS peer for a WDS interface
3348abe37c4bSJohannes Berg  *
33491f87f7d3SJohannes Berg  * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting
33501f87f7d3SJohannes Berg  *	functions to adjust rfkill hw state
3351aff89a9bSJohannes Berg  *
335261fa713cSHolger Schurig  * @dump_survey: get site survey information.
335361fa713cSHolger Schurig  *
33549588bbd5SJouni Malinen  * @remain_on_channel: Request the driver to remain awake on the specified
33559588bbd5SJouni Malinen  *	channel for the specified duration to complete an off-channel
33569588bbd5SJouni Malinen  *	operation (e.g., public action frame exchange). When the driver is
33579588bbd5SJouni Malinen  *	ready on the requested channel, it must indicate this with an event
33589588bbd5SJouni Malinen  *	notification by calling cfg80211_ready_on_channel().
33599588bbd5SJouni Malinen  * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation.
33609588bbd5SJouni Malinen  *	This allows the operation to be terminated prior to timeout based on
33619588bbd5SJouni Malinen  *	the duration value.
3362f7ca38dfSJohannes Berg  * @mgmt_tx: Transmit a management frame.
3363f7ca38dfSJohannes Berg  * @mgmt_tx_cancel_wait: Cancel the wait time from transmitting a management
3364f7ca38dfSJohannes Berg  *	frame on another channel
33659588bbd5SJouni Malinen  *
3366fc73f11fSDavid Spinadel  * @testmode_cmd: run a test mode command; @wdev may be %NULL
336771063f0eSWey-Yi Guy  * @testmode_dump: Implement a test mode dump. The cb->args[2] and up may be
336871063f0eSWey-Yi Guy  *	used by the function, but 0 and 1 must not be touched. Additionally,
336971063f0eSWey-Yi Guy  *	return error codes other than -ENOBUFS and -ENOENT will terminate the
337071063f0eSWey-Yi Guy  *	dump and return to userspace with an error, so be careful. If any data
337171063f0eSWey-Yi Guy  *	was passed in from userspace then the data/len arguments will be present
337271063f0eSWey-Yi Guy  *	and point to the data contained in %NL80211_ATTR_TESTDATA.
337367fbb16bSSamuel Ortiz  *
3374abe37c4bSJohannes Berg  * @set_bitrate_mask: set the bitrate mask configuration
3375abe37c4bSJohannes Berg  *
337667fbb16bSSamuel Ortiz  * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac
337767fbb16bSSamuel Ortiz  *	devices running firmwares capable of generating the (re) association
337867fbb16bSSamuel Ortiz  *	RSN IE. It allows for faster roaming between WPA2 BSSIDs.
337967fbb16bSSamuel Ortiz  * @del_pmksa: Delete a cached PMKID.
338067fbb16bSSamuel Ortiz  * @flush_pmksa: Flush all cached PMKIDs.
33819043f3b8SJuuso Oikarinen  * @set_power_mgmt: Configure WLAN power management. A timeout value of -1
33829043f3b8SJuuso Oikarinen  *	allows the driver to adjust the dynamic ps timeout value.
3383d6dc1a38SJuuso Oikarinen  * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold.
3384e86abc68SJohannes Berg  *	After configuration, the driver should (soon) send an event indicating
3385e86abc68SJohannes Berg  *	the current level is above/below the configured threshold; this may
3386e86abc68SJohannes Berg  *	need some care when the configuration is changed (without first being
3387e86abc68SJohannes Berg  *	disabled.)
33884a4b8169SAndrew Zaborowski  * @set_cqm_rssi_range_config: Configure two RSSI thresholds in the
33894a4b8169SAndrew Zaborowski  *	connection quality monitor.  An event is to be sent only when the
33904a4b8169SAndrew Zaborowski  *	signal level is found to be outside the two values.  The driver should
33914a4b8169SAndrew Zaborowski  *	set %NL80211_EXT_FEATURE_CQM_RSSI_LIST if this method is implemented.
33924a4b8169SAndrew Zaborowski  *	If it is provided then there's no point providing @set_cqm_rssi_config.
339384f10708SThomas Pedersen  * @set_cqm_txe_config: Configure connection quality monitor TX error
339484f10708SThomas Pedersen  *	thresholds.
3395807f8a8cSLuciano Coelho  * @sched_scan_start: Tell the driver to start a scheduled scan.
33963a3ecf1dSArend Van Spriel  * @sched_scan_stop: Tell the driver to stop an ongoing scheduled scan with
33973a3ecf1dSArend Van Spriel  *	given request id. This call must stop the scheduled scan and be ready
33983a3ecf1dSArend Van Spriel  *	for starting a new one before it returns, i.e. @sched_scan_start may be
33993a3ecf1dSArend Van Spriel  *	called immediately after that again and should not fail in that case.
34003a3ecf1dSArend Van Spriel  *	The driver should not call cfg80211_sched_scan_stopped() for a requested
34013a3ecf1dSArend Van Spriel  *	stop (when this method returns 0).
340267fbb16bSSamuel Ortiz  *
3403271733cfSJohannes Berg  * @mgmt_frame_register: Notify driver that a management frame type was
340433d8783cSJohannes Berg  *	registered. The callback is allowed to sleep.
3405547025d5SBruno Randolf  *
3406547025d5SBruno Randolf  * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device.
3407547025d5SBruno Randolf  *	Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may
3408547025d5SBruno Randolf  *	reject TX/RX mask combinations they cannot support by returning -EINVAL
3409547025d5SBruno Randolf  *	(also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX).
3410547025d5SBruno Randolf  *
3411547025d5SBruno Randolf  * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant).
34123677713bSJohn W. Linville  *
3413109086ceSArik Nemtsov  * @tdls_mgmt: Transmit a TDLS management frame.
3414109086ceSArik Nemtsov  * @tdls_oper: Perform a high-level TDLS operation (e.g. TDLS link setup).
34157f6cf311SJohannes Berg  *
34167f6cf311SJohannes Berg  * @probe_client: probe an associated client, must return a cookie that it
34177f6cf311SJohannes Berg  *	later passes to cfg80211_probe_status().
34181d9d9213SSimon Wunderlich  *
34191d9d9213SSimon Wunderlich  * @set_noack_map: Set the NoAck Map for the TIDs.
3420d6199218SBen Greear  *
34215b7ccaf3SJohannes Berg  * @get_channel: Get the current operating channel for the virtual interface.
34225b7ccaf3SJohannes Berg  *	For monitor interfaces, it should return %NULL unless there's a single
34235b7ccaf3SJohannes Berg  *	current monitoring channel.
342498104fdeSJohannes Berg  *
342598104fdeSJohannes Berg  * @start_p2p_device: Start the given P2P device.
342698104fdeSJohannes Berg  * @stop_p2p_device: Stop the given P2P device.
342777765eafSVasanthakumar Thiagarajan  *
342877765eafSVasanthakumar Thiagarajan  * @set_mac_acl: Sets MAC address control list in AP and P2P GO mode.
342977765eafSVasanthakumar Thiagarajan  *	Parameters include ACL policy, an array of MAC address of stations
343077765eafSVasanthakumar Thiagarajan  *	and the number of MAC addresses. If there is already a list in driver
343177765eafSVasanthakumar Thiagarajan  *	this new list replaces the existing one. Driver has to clear its ACL
343277765eafSVasanthakumar Thiagarajan  *	when number of MAC addresses entries is passed as 0. Drivers which
343377765eafSVasanthakumar Thiagarajan  *	advertise the support for MAC based ACL have to implement this callback.
343404f39047SSimon Wunderlich  *
343504f39047SSimon Wunderlich  * @start_radar_detection: Start radar detection in the driver.
34368bf24293SJouni Malinen  *
34378bf24293SJouni Malinen  * @update_ft_ies: Provide updated Fast BSS Transition information to the
34388bf24293SJouni Malinen  *	driver. If the SME is in the driver/firmware, this information can be
34398bf24293SJouni Malinen  *	used in building Authentication and Reassociation Request frames.
34405de17984SArend van Spriel  *
34415de17984SArend van Spriel  * @crit_proto_start: Indicates a critical protocol needs more link reliability
34425de17984SArend van Spriel  *	for a given duration (milliseconds). The protocol is provided so the
34435de17984SArend van Spriel  *	driver can take the most appropriate actions.
34445de17984SArend van Spriel  * @crit_proto_stop: Indicates critical protocol no longer needs increased link
34455de17984SArend van Spriel  *	reliability. This operation can not fail.
3446be29b99aSAmitkumar Karwar  * @set_coalesce: Set coalesce parameters.
344716ef1fe2SSimon Wunderlich  *
344897dc94f1SMichal Kazior  * @channel_switch: initiate channel-switch procedure (with CSA). Driver is
344997dc94f1SMichal Kazior  *	responsible for veryfing if the switch is possible. Since this is
345097dc94f1SMichal Kazior  *	inherently tricky driver may decide to disconnect an interface later
345197dc94f1SMichal Kazior  *	with cfg80211_stop_iface(). This doesn't mean driver can accept
345297dc94f1SMichal Kazior  *	everything. It should do it's best to verify requests and reject them
345397dc94f1SMichal Kazior  *	as soon as possible.
3454fa9ffc74SKyeyoon Park  *
3455fa9ffc74SKyeyoon Park  * @set_qos_map: Set QoS mapping information to the driver
3456e16821bcSJouni Malinen  *
3457e16821bcSJouni Malinen  * @set_ap_chanwidth: Set the AP (including P2P GO) mode channel width for the
3458e16821bcSJouni Malinen  *	given interface This is used e.g. for dynamic HT 20/40 MHz channel width
3459e16821bcSJouni Malinen  *	changes during the lifetime of the BSS.
3460960d01acSJohannes Berg  *
3461960d01acSJohannes Berg  * @add_tx_ts: validate (if admitted_time is 0) or add a TX TS to the device
3462960d01acSJohannes Berg  *	with the given parameters; action frame exchange has been handled by
3463960d01acSJohannes Berg  *	userspace so this just has to modify the TX path to take the TS into
3464960d01acSJohannes Berg  *	account.
3465960d01acSJohannes Berg  *	If the admitted time is 0 just validate the parameters to make sure
3466960d01acSJohannes Berg  *	the session can be created at all; it is valid to just always return
3467960d01acSJohannes Berg  *	success for that but that may result in inefficient behaviour (handshake
3468960d01acSJohannes Berg  *	with the peer followed by immediate teardown when the addition is later
3469960d01acSJohannes Berg  *	rejected)
3470960d01acSJohannes Berg  * @del_tx_ts: remove an existing TX TS
34716e0bd6c3SRostislav Lisovy  *
34726e0bd6c3SRostislav Lisovy  * @join_ocb: join the OCB network with the specified parameters
34736e0bd6c3SRostislav Lisovy  *	(invoked with the wireless_dev mutex held)
34746e0bd6c3SRostislav Lisovy  * @leave_ocb: leave the current OCB network
34756e0bd6c3SRostislav Lisovy  *	(invoked with the wireless_dev mutex held)
34761057d35eSArik Nemtsov  *
34771057d35eSArik Nemtsov  * @tdls_channel_switch: Start channel-switching with a TDLS peer. The driver
34781057d35eSArik Nemtsov  *	is responsible for continually initiating channel-switching operations
34791057d35eSArik Nemtsov  *	and returning to the base channel for communication with the AP.
34801057d35eSArik Nemtsov  * @tdls_cancel_channel_switch: Stop channel-switching with a TDLS peer. Both
34811057d35eSArik Nemtsov  *	peers must be on the base channel when the call completes.
3482cb3b7d87SAyala Beker  * @start_nan: Start the NAN interface.
3483cb3b7d87SAyala Beker  * @stop_nan: Stop the NAN interface.
3484a442b761SAyala Beker  * @add_nan_func: Add a NAN function. Returns negative value on failure.
3485a442b761SAyala Beker  *	On success @nan_func ownership is transferred to the driver and
3486a442b761SAyala Beker  *	it may access it outside of the scope of this function. The driver
3487a442b761SAyala Beker  *	should free the @nan_func when no longer needed by calling
3488a442b761SAyala Beker  *	cfg80211_free_nan_func().
3489a442b761SAyala Beker  *	On success the driver should assign an instance_id in the
3490a442b761SAyala Beker  *	provided @nan_func.
3491a442b761SAyala Beker  * @del_nan_func: Delete a NAN function.
3492a5a9dcf2SAyala Beker  * @nan_change_conf: changes NAN configuration. The changed parameters must
3493a5a9dcf2SAyala Beker  *	be specified in @changes (using &enum cfg80211_nan_conf_changes);
3494a5a9dcf2SAyala Beker  *	All other parameters must be ignored.
3495ce0ce13aSMichael Braun  *
3496ce0ce13aSMichael Braun  * @set_multicast_to_unicast: configure multicast to unicast conversion for BSS
34973a00df57SAvraham Stern  *
349852539ca8SToke Høiland-Jørgensen  * @get_txq_stats: Get TXQ stats for interface or phy. If wdev is %NULL, this
349952539ca8SToke Høiland-Jørgensen  *      function should return phy stats, and interface stats otherwise.
350052539ca8SToke Høiland-Jørgensen  *
35013a00df57SAvraham Stern  * @set_pmk: configure the PMK to be used for offloaded 802.1X 4-Way handshake.
35023a00df57SAvraham Stern  *	If not deleted through @del_pmk the PMK remains valid until disconnect
35033a00df57SAvraham Stern  *	upon which the driver should clear it.
35043a00df57SAvraham Stern  *	(invoked with the wireless_dev mutex held)
35053a00df57SAvraham Stern  * @del_pmk: delete the previously configured PMK for the given authenticator.
35063a00df57SAvraham Stern  *	(invoked with the wireless_dev mutex held)
350740cbfa90SSrinivas Dasari  *
350840cbfa90SSrinivas Dasari  * @external_auth: indicates result of offloaded authentication processing from
350940cbfa90SSrinivas Dasari  *     user space
35102576a9acSDenis Kenzior  *
35112576a9acSDenis Kenzior  * @tx_control_port: TX a control port frame (EAPoL).  The noencrypt parameter
35122576a9acSDenis Kenzior  *	tells the driver that the frame should not be encrypted.
351381e54d08SPradeep Kumar Chitrapu  *
351481e54d08SPradeep Kumar Chitrapu  * @get_ftm_responder_stats: Retrieve FTM responder statistics, if available.
351581e54d08SPradeep Kumar Chitrapu  *	Statistics should be cumulative, currently no way to reset is provided.
35169bb7e0f2SJohannes Berg  * @start_pmsr: start peer measurement (e.g. FTM)
35179bb7e0f2SJohannes Berg  * @abort_pmsr: abort peer measurement
3518cb74e977SSunil Dutt  *
3519cb74e977SSunil Dutt  * @update_owe_info: Provide updated OWE info to driver. Driver implementing SME
3520cb74e977SSunil Dutt  *	but offloading OWE processing to the user space will get the updated
3521cb74e977SSunil Dutt  *	DH IE through this interface.
35225ab92e7fSRajkumar Manoharan  *
35235ab92e7fSRajkumar Manoharan  * @probe_mesh_link: Probe direct Mesh peer's link quality by sending data frame
35245ab92e7fSRajkumar Manoharan  *	and overrule HWMP path selection algorithm.
3525704232c2SJohannes Berg  */
3526704232c2SJohannes Berg struct cfg80211_ops {
3527ff1b6e69SJohannes Berg 	int	(*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
35280378b3f1SJohannes Berg 	int	(*resume)(struct wiphy *wiphy);
35296d52563fSJohannes Berg 	void	(*set_wakeup)(struct wiphy *wiphy, bool enabled);
35300378b3f1SJohannes Berg 
353184efbb84SJohannes Berg 	struct wireless_dev * (*add_virtual_intf)(struct wiphy *wiphy,
3532552bff0cSJohannes Berg 						  const char *name,
35336bab2e19STom Gundersen 						  unsigned char name_assign_type,
3534f9e10ce4SJohannes Berg 						  enum nl80211_iftype type,
35352ec600d6SLuis Carlos Cobo 						  struct vif_params *params);
353684efbb84SJohannes Berg 	int	(*del_virtual_intf)(struct wiphy *wiphy,
353784efbb84SJohannes Berg 				    struct wireless_dev *wdev);
3538e36d56b6SJohannes Berg 	int	(*change_virtual_intf)(struct wiphy *wiphy,
3539e36d56b6SJohannes Berg 				       struct net_device *dev,
3540818a986eSJohannes Berg 				       enum nl80211_iftype type,
35412ec600d6SLuis Carlos Cobo 				       struct vif_params *params);
354241ade00fSJohannes Berg 
354341ade00fSJohannes Berg 	int	(*add_key)(struct wiphy *wiphy, struct net_device *netdev,
3544e31b8213SJohannes Berg 			   u8 key_index, bool pairwise, const u8 *mac_addr,
354541ade00fSJohannes Berg 			   struct key_params *params);
354641ade00fSJohannes Berg 	int	(*get_key)(struct wiphy *wiphy, struct net_device *netdev,
3547e31b8213SJohannes Berg 			   u8 key_index, bool pairwise, const u8 *mac_addr,
3548e31b8213SJohannes Berg 			   void *cookie,
354941ade00fSJohannes Berg 			   void (*callback)(void *cookie, struct key_params*));
355041ade00fSJohannes Berg 	int	(*del_key)(struct wiphy *wiphy, struct net_device *netdev,
3551e31b8213SJohannes Berg 			   u8 key_index, bool pairwise, const u8 *mac_addr);
355241ade00fSJohannes Berg 	int	(*set_default_key)(struct wiphy *wiphy,
355341ade00fSJohannes Berg 				   struct net_device *netdev,
3554dbd2fd65SJohannes Berg 				   u8 key_index, bool unicast, bool multicast);
35553cfcf6acSJouni Malinen 	int	(*set_default_mgmt_key)(struct wiphy *wiphy,
35563cfcf6acSJouni Malinen 					struct net_device *netdev,
35573cfcf6acSJouni Malinen 					u8 key_index);
3558ed1b6cc7SJohannes Berg 
35598860020eSJohannes Berg 	int	(*start_ap)(struct wiphy *wiphy, struct net_device *dev,
35608860020eSJohannes Berg 			    struct cfg80211_ap_settings *settings);
35618860020eSJohannes Berg 	int	(*change_beacon)(struct wiphy *wiphy, struct net_device *dev,
35628860020eSJohannes Berg 				 struct cfg80211_beacon_data *info);
35638860020eSJohannes Berg 	int	(*stop_ap)(struct wiphy *wiphy, struct net_device *dev);
35645727ef1bSJohannes Berg 
35655727ef1bSJohannes Berg 
35665727ef1bSJohannes Berg 	int	(*add_station)(struct wiphy *wiphy, struct net_device *dev,
35673b3a0162SJohannes Berg 			       const u8 *mac,
35683b3a0162SJohannes Berg 			       struct station_parameters *params);
35695727ef1bSJohannes Berg 	int	(*del_station)(struct wiphy *wiphy, struct net_device *dev,
357089c771e5SJouni Malinen 			       struct station_del_parameters *params);
35715727ef1bSJohannes Berg 	int	(*change_station)(struct wiphy *wiphy, struct net_device *dev,
35723b3a0162SJohannes Berg 				  const u8 *mac,
35733b3a0162SJohannes Berg 				  struct station_parameters *params);
3574fd5b74dcSJohannes Berg 	int	(*get_station)(struct wiphy *wiphy, struct net_device *dev,
35753b3a0162SJohannes Berg 			       const u8 *mac, struct station_info *sinfo);
35762ec600d6SLuis Carlos Cobo 	int	(*dump_station)(struct wiphy *wiphy, struct net_device *dev,
35772ec600d6SLuis Carlos Cobo 				int idx, u8 *mac, struct station_info *sinfo);
35782ec600d6SLuis Carlos Cobo 
35792ec600d6SLuis Carlos Cobo 	int	(*add_mpath)(struct wiphy *wiphy, struct net_device *dev,
35803b3a0162SJohannes Berg 			       const u8 *dst, const u8 *next_hop);
35812ec600d6SLuis Carlos Cobo 	int	(*del_mpath)(struct wiphy *wiphy, struct net_device *dev,
35823b3a0162SJohannes Berg 			       const u8 *dst);
35832ec600d6SLuis Carlos Cobo 	int	(*change_mpath)(struct wiphy *wiphy, struct net_device *dev,
35843b3a0162SJohannes Berg 				  const u8 *dst, const u8 *next_hop);
35852ec600d6SLuis Carlos Cobo 	int	(*get_mpath)(struct wiphy *wiphy, struct net_device *dev,
35863b3a0162SJohannes Berg 			     u8 *dst, u8 *next_hop, struct mpath_info *pinfo);
35872ec600d6SLuis Carlos Cobo 	int	(*dump_mpath)(struct wiphy *wiphy, struct net_device *dev,
35882ec600d6SLuis Carlos Cobo 			      int idx, u8 *dst, u8 *next_hop,
35892ec600d6SLuis Carlos Cobo 			      struct mpath_info *pinfo);
359066be7d2bSHenning Rogge 	int	(*get_mpp)(struct wiphy *wiphy, struct net_device *dev,
359166be7d2bSHenning Rogge 			   u8 *dst, u8 *mpp, struct mpath_info *pinfo);
359266be7d2bSHenning Rogge 	int	(*dump_mpp)(struct wiphy *wiphy, struct net_device *dev,
359366be7d2bSHenning Rogge 			    int idx, u8 *dst, u8 *mpp,
359466be7d2bSHenning Rogge 			    struct mpath_info *pinfo);
359524bdd9f4SJavier Cardona 	int	(*get_mesh_config)(struct wiphy *wiphy,
359693da9cc1Scolin@cozybit.com 				struct net_device *dev,
359793da9cc1Scolin@cozybit.com 				struct mesh_config *conf);
359824bdd9f4SJavier Cardona 	int	(*update_mesh_config)(struct wiphy *wiphy,
359929cbe68cSJohannes Berg 				      struct net_device *dev, u32 mask,
360029cbe68cSJohannes Berg 				      const struct mesh_config *nconf);
360129cbe68cSJohannes Berg 	int	(*join_mesh)(struct wiphy *wiphy, struct net_device *dev,
360229cbe68cSJohannes Berg 			     const struct mesh_config *conf,
360329cbe68cSJohannes Berg 			     const struct mesh_setup *setup);
360429cbe68cSJohannes Berg 	int	(*leave_mesh)(struct wiphy *wiphy, struct net_device *dev);
360529cbe68cSJohannes Berg 
36066e0bd6c3SRostislav Lisovy 	int	(*join_ocb)(struct wiphy *wiphy, struct net_device *dev,
36076e0bd6c3SRostislav Lisovy 			    struct ocb_setup *setup);
36086e0bd6c3SRostislav Lisovy 	int	(*leave_ocb)(struct wiphy *wiphy, struct net_device *dev);
36096e0bd6c3SRostislav Lisovy 
36109f1ba906SJouni Malinen 	int	(*change_bss)(struct wiphy *wiphy, struct net_device *dev,
36119f1ba906SJouni Malinen 			      struct bss_parameters *params);
361231888487SJouni Malinen 
3613f70f01c2SEliad Peller 	int	(*set_txq_params)(struct wiphy *wiphy, struct net_device *dev,
361431888487SJouni Malinen 				  struct ieee80211_txq_params *params);
361572bdcf34SJouni Malinen 
3616e8c9bd5bSJohannes Berg 	int	(*libertas_set_mesh_channel)(struct wiphy *wiphy,
3617e8c9bd5bSJohannes Berg 					     struct net_device *dev,
3618e8c9bd5bSJohannes Berg 					     struct ieee80211_channel *chan);
3619e8c9bd5bSJohannes Berg 
3620e8c9bd5bSJohannes Berg 	int	(*set_monitor_channel)(struct wiphy *wiphy,
3621683b6d3bSJohannes Berg 				       struct cfg80211_chan_def *chandef);
36229aed3cc1SJouni Malinen 
3623fd014284SJohannes Berg 	int	(*scan)(struct wiphy *wiphy,
36242a519311SJohannes Berg 			struct cfg80211_scan_request *request);
362591d3ab46SVidyullatha Kanchanapally 	void	(*abort_scan)(struct wiphy *wiphy, struct wireless_dev *wdev);
3626636a5d36SJouni Malinen 
3627636a5d36SJouni Malinen 	int	(*auth)(struct wiphy *wiphy, struct net_device *dev,
3628636a5d36SJouni Malinen 			struct cfg80211_auth_request *req);
3629636a5d36SJouni Malinen 	int	(*assoc)(struct wiphy *wiphy, struct net_device *dev,
3630636a5d36SJouni Malinen 			 struct cfg80211_assoc_request *req);
3631636a5d36SJouni Malinen 	int	(*deauth)(struct wiphy *wiphy, struct net_device *dev,
363263c9c5e7SJohannes Berg 			  struct cfg80211_deauth_request *req);
3633636a5d36SJouni Malinen 	int	(*disassoc)(struct wiphy *wiphy, struct net_device *dev,
363463c9c5e7SJohannes Berg 			    struct cfg80211_disassoc_request *req);
363504a773adSJohannes Berg 
3636b23aa676SSamuel Ortiz 	int	(*connect)(struct wiphy *wiphy, struct net_device *dev,
3637b23aa676SSamuel Ortiz 			   struct cfg80211_connect_params *sme);
3638088e8df8Svamsi krishna 	int	(*update_connect_params)(struct wiphy *wiphy,
3639088e8df8Svamsi krishna 					 struct net_device *dev,
3640088e8df8Svamsi krishna 					 struct cfg80211_connect_params *sme,
3641088e8df8Svamsi krishna 					 u32 changed);
3642b23aa676SSamuel Ortiz 	int	(*disconnect)(struct wiphy *wiphy, struct net_device *dev,
3643b23aa676SSamuel Ortiz 			      u16 reason_code);
3644b23aa676SSamuel Ortiz 
364504a773adSJohannes Berg 	int	(*join_ibss)(struct wiphy *wiphy, struct net_device *dev,
364604a773adSJohannes Berg 			     struct cfg80211_ibss_params *params);
364704a773adSJohannes Berg 	int	(*leave_ibss)(struct wiphy *wiphy, struct net_device *dev);
3648b9a5f8caSJouni Malinen 
3649f4e583c8SAntonio Quartulli 	int	(*set_mcast_rate)(struct wiphy *wiphy, struct net_device *dev,
365057fbcce3SJohannes Berg 				  int rate[NUM_NL80211_BANDS]);
3651f4e583c8SAntonio Quartulli 
3652b9a5f8caSJouni Malinen 	int	(*set_wiphy_params)(struct wiphy *wiphy, u32 changed);
36537643a2c3SJohannes Berg 
3654c8442118SJohannes Berg 	int	(*set_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
3655fa61cf70SJuuso Oikarinen 				enum nl80211_tx_power_setting type, int mbm);
3656c8442118SJohannes Berg 	int	(*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
3657c8442118SJohannes Berg 				int *dbm);
36581f87f7d3SJohannes Berg 
3659ab737a4fSJohannes Berg 	int	(*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev,
3660388ac775SJohannes Berg 				const u8 *addr);
3661ab737a4fSJohannes Berg 
36621f87f7d3SJohannes Berg 	void	(*rfkill_poll)(struct wiphy *wiphy);
3663aff89a9bSJohannes Berg 
3664aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE
3665fc73f11fSDavid Spinadel 	int	(*testmode_cmd)(struct wiphy *wiphy, struct wireless_dev *wdev,
3666fc73f11fSDavid Spinadel 				void *data, int len);
366771063f0eSWey-Yi Guy 	int	(*testmode_dump)(struct wiphy *wiphy, struct sk_buff *skb,
366871063f0eSWey-Yi Guy 				 struct netlink_callback *cb,
366971063f0eSWey-Yi Guy 				 void *data, int len);
3670aff89a9bSJohannes Berg #endif
3671bc92afd9SJohannes Berg 
36729930380fSJohannes Berg 	int	(*set_bitrate_mask)(struct wiphy *wiphy,
36739930380fSJohannes Berg 				    struct net_device *dev,
36749930380fSJohannes Berg 				    const u8 *peer,
36759930380fSJohannes Berg 				    const struct cfg80211_bitrate_mask *mask);
36769930380fSJohannes Berg 
367761fa713cSHolger Schurig 	int	(*dump_survey)(struct wiphy *wiphy, struct net_device *netdev,
367861fa713cSHolger Schurig 			int idx, struct survey_info *info);
367961fa713cSHolger Schurig 
368067fbb16bSSamuel Ortiz 	int	(*set_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
368167fbb16bSSamuel Ortiz 			     struct cfg80211_pmksa *pmksa);
368267fbb16bSSamuel Ortiz 	int	(*del_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
368367fbb16bSSamuel Ortiz 			     struct cfg80211_pmksa *pmksa);
368467fbb16bSSamuel Ortiz 	int	(*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev);
368567fbb16bSSamuel Ortiz 
36869588bbd5SJouni Malinen 	int	(*remain_on_channel)(struct wiphy *wiphy,
368771bbc994SJohannes Berg 				     struct wireless_dev *wdev,
36889588bbd5SJouni Malinen 				     struct ieee80211_channel *chan,
36899588bbd5SJouni Malinen 				     unsigned int duration,
36909588bbd5SJouni Malinen 				     u64 *cookie);
36919588bbd5SJouni Malinen 	int	(*cancel_remain_on_channel)(struct wiphy *wiphy,
369271bbc994SJohannes Berg 					    struct wireless_dev *wdev,
36939588bbd5SJouni Malinen 					    u64 cookie);
36949588bbd5SJouni Malinen 
369571bbc994SJohannes Berg 	int	(*mgmt_tx)(struct wiphy *wiphy, struct wireless_dev *wdev,
3696b176e629SAndrei Otcheretianski 			   struct cfg80211_mgmt_tx_params *params,
3697b176e629SAndrei Otcheretianski 			   u64 *cookie);
3698f7ca38dfSJohannes Berg 	int	(*mgmt_tx_cancel_wait)(struct wiphy *wiphy,
369971bbc994SJohannes Berg 				       struct wireless_dev *wdev,
3700f7ca38dfSJohannes Berg 				       u64 cookie);
3701026331c4SJouni Malinen 
3702bc92afd9SJohannes Berg 	int	(*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev,
3703bc92afd9SJohannes Berg 				  bool enabled, int timeout);
3704d6dc1a38SJuuso Oikarinen 
3705d6dc1a38SJuuso Oikarinen 	int	(*set_cqm_rssi_config)(struct wiphy *wiphy,
3706d6dc1a38SJuuso Oikarinen 				       struct net_device *dev,
3707d6dc1a38SJuuso Oikarinen 				       s32 rssi_thold, u32 rssi_hyst);
3708271733cfSJohannes Berg 
37094a4b8169SAndrew Zaborowski 	int	(*set_cqm_rssi_range_config)(struct wiphy *wiphy,
37104a4b8169SAndrew Zaborowski 					     struct net_device *dev,
37114a4b8169SAndrew Zaborowski 					     s32 rssi_low, s32 rssi_high);
37124a4b8169SAndrew Zaborowski 
371384f10708SThomas Pedersen 	int	(*set_cqm_txe_config)(struct wiphy *wiphy,
371484f10708SThomas Pedersen 				      struct net_device *dev,
371584f10708SThomas Pedersen 				      u32 rate, u32 pkts, u32 intvl);
371684f10708SThomas Pedersen 
3717271733cfSJohannes Berg 	void	(*mgmt_frame_register)(struct wiphy *wiphy,
371871bbc994SJohannes Berg 				       struct wireless_dev *wdev,
3719271733cfSJohannes Berg 				       u16 frame_type, bool reg);
3720afe0cbf8SBruno Randolf 
3721afe0cbf8SBruno Randolf 	int	(*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant);
3722afe0cbf8SBruno Randolf 	int	(*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant);
37233677713bSJohn W. Linville 
3724807f8a8cSLuciano Coelho 	int	(*sched_scan_start)(struct wiphy *wiphy,
3725807f8a8cSLuciano Coelho 				struct net_device *dev,
3726807f8a8cSLuciano Coelho 				struct cfg80211_sched_scan_request *request);
37273a3ecf1dSArend Van Spriel 	int	(*sched_scan_stop)(struct wiphy *wiphy, struct net_device *dev,
37283a3ecf1dSArend Van Spriel 				   u64 reqid);
3729e5497d76SJohannes Berg 
3730e5497d76SJohannes Berg 	int	(*set_rekey_data)(struct wiphy *wiphy, struct net_device *dev,
3731e5497d76SJohannes Berg 				  struct cfg80211_gtk_rekey_data *data);
3732109086ceSArik Nemtsov 
3733109086ceSArik Nemtsov 	int	(*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev,
37343b3a0162SJohannes Berg 			     const u8 *peer, u8 action_code,  u8 dialog_token,
3735df942e7bSSunil Dutt Undekari 			     u16 status_code, u32 peer_capability,
373631fa97c5SArik Nemtsov 			     bool initiator, const u8 *buf, size_t len);
3737109086ceSArik Nemtsov 	int	(*tdls_oper)(struct wiphy *wiphy, struct net_device *dev,
37383b3a0162SJohannes Berg 			     const u8 *peer, enum nl80211_tdls_operation oper);
37397f6cf311SJohannes Berg 
37407f6cf311SJohannes Berg 	int	(*probe_client)(struct wiphy *wiphy, struct net_device *dev,
37417f6cf311SJohannes Berg 				const u8 *peer, u64 *cookie);
3742e999882aSJohannes Berg 
37431d9d9213SSimon Wunderlich 	int	(*set_noack_map)(struct wiphy *wiphy,
37441d9d9213SSimon Wunderlich 				  struct net_device *dev,
37451d9d9213SSimon Wunderlich 				  u16 noack_map);
37461d9d9213SSimon Wunderlich 
3747683b6d3bSJohannes Berg 	int	(*get_channel)(struct wiphy *wiphy,
37485b7ccaf3SJohannes Berg 			       struct wireless_dev *wdev,
3749683b6d3bSJohannes Berg 			       struct cfg80211_chan_def *chandef);
375098104fdeSJohannes Berg 
375198104fdeSJohannes Berg 	int	(*start_p2p_device)(struct wiphy *wiphy,
375298104fdeSJohannes Berg 				    struct wireless_dev *wdev);
375398104fdeSJohannes Berg 	void	(*stop_p2p_device)(struct wiphy *wiphy,
375498104fdeSJohannes Berg 				   struct wireless_dev *wdev);
375577765eafSVasanthakumar Thiagarajan 
375677765eafSVasanthakumar Thiagarajan 	int	(*set_mac_acl)(struct wiphy *wiphy, struct net_device *dev,
375777765eafSVasanthakumar Thiagarajan 			       const struct cfg80211_acl_data *params);
375804f39047SSimon Wunderlich 
375904f39047SSimon Wunderlich 	int	(*start_radar_detection)(struct wiphy *wiphy,
376004f39047SSimon Wunderlich 					 struct net_device *dev,
376131559f35SJanusz Dziedzic 					 struct cfg80211_chan_def *chandef,
376231559f35SJanusz Dziedzic 					 u32 cac_time_ms);
3763355199e0SJouni Malinen 	int	(*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev,
3764355199e0SJouni Malinen 				 struct cfg80211_update_ft_ies_params *ftie);
37655de17984SArend van Spriel 	int	(*crit_proto_start)(struct wiphy *wiphy,
37665de17984SArend van Spriel 				    struct wireless_dev *wdev,
37675de17984SArend van Spriel 				    enum nl80211_crit_proto_id protocol,
37685de17984SArend van Spriel 				    u16 duration);
37695de17984SArend van Spriel 	void	(*crit_proto_stop)(struct wiphy *wiphy,
37705de17984SArend van Spriel 				   struct wireless_dev *wdev);
3771be29b99aSAmitkumar Karwar 	int	(*set_coalesce)(struct wiphy *wiphy,
3772be29b99aSAmitkumar Karwar 				struct cfg80211_coalesce *coalesce);
377316ef1fe2SSimon Wunderlich 
377416ef1fe2SSimon Wunderlich 	int	(*channel_switch)(struct wiphy *wiphy,
377516ef1fe2SSimon Wunderlich 				  struct net_device *dev,
377616ef1fe2SSimon Wunderlich 				  struct cfg80211_csa_settings *params);
3777e16821bcSJouni Malinen 
3778fa9ffc74SKyeyoon Park 	int     (*set_qos_map)(struct wiphy *wiphy,
3779fa9ffc74SKyeyoon Park 			       struct net_device *dev,
3780fa9ffc74SKyeyoon Park 			       struct cfg80211_qos_map *qos_map);
3781e16821bcSJouni Malinen 
3782e16821bcSJouni Malinen 	int	(*set_ap_chanwidth)(struct wiphy *wiphy, struct net_device *dev,
3783e16821bcSJouni Malinen 				    struct cfg80211_chan_def *chandef);
3784960d01acSJohannes Berg 
3785960d01acSJohannes Berg 	int	(*add_tx_ts)(struct wiphy *wiphy, struct net_device *dev,
3786960d01acSJohannes Berg 			     u8 tsid, const u8 *peer, u8 user_prio,
3787960d01acSJohannes Berg 			     u16 admitted_time);
3788960d01acSJohannes Berg 	int	(*del_tx_ts)(struct wiphy *wiphy, struct net_device *dev,
3789960d01acSJohannes Berg 			     u8 tsid, const u8 *peer);
37901057d35eSArik Nemtsov 
37911057d35eSArik Nemtsov 	int	(*tdls_channel_switch)(struct wiphy *wiphy,
37921057d35eSArik Nemtsov 				       struct net_device *dev,
37931057d35eSArik Nemtsov 				       const u8 *addr, u8 oper_class,
37941057d35eSArik Nemtsov 				       struct cfg80211_chan_def *chandef);
37951057d35eSArik Nemtsov 	void	(*tdls_cancel_channel_switch)(struct wiphy *wiphy,
37961057d35eSArik Nemtsov 					      struct net_device *dev,
37971057d35eSArik Nemtsov 					      const u8 *addr);
3798cb3b7d87SAyala Beker 	int	(*start_nan)(struct wiphy *wiphy, struct wireless_dev *wdev,
3799cb3b7d87SAyala Beker 			     struct cfg80211_nan_conf *conf);
3800cb3b7d87SAyala Beker 	void	(*stop_nan)(struct wiphy *wiphy, struct wireless_dev *wdev);
3801a442b761SAyala Beker 	int	(*add_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev,
3802a442b761SAyala Beker 				struct cfg80211_nan_func *nan_func);
3803a442b761SAyala Beker 	void	(*del_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev,
3804a442b761SAyala Beker 			       u64 cookie);
3805a5a9dcf2SAyala Beker 	int	(*nan_change_conf)(struct wiphy *wiphy,
3806a5a9dcf2SAyala Beker 				   struct wireless_dev *wdev,
3807a5a9dcf2SAyala Beker 				   struct cfg80211_nan_conf *conf,
3808a5a9dcf2SAyala Beker 				   u32 changes);
3809ce0ce13aSMichael Braun 
3810ce0ce13aSMichael Braun 	int	(*set_multicast_to_unicast)(struct wiphy *wiphy,
3811ce0ce13aSMichael Braun 					    struct net_device *dev,
3812ce0ce13aSMichael Braun 					    const bool enabled);
38133a00df57SAvraham Stern 
381452539ca8SToke Høiland-Jørgensen 	int	(*get_txq_stats)(struct wiphy *wiphy,
381552539ca8SToke Høiland-Jørgensen 				 struct wireless_dev *wdev,
381652539ca8SToke Høiland-Jørgensen 				 struct cfg80211_txq_stats *txqstats);
381752539ca8SToke Høiland-Jørgensen 
38183a00df57SAvraham Stern 	int	(*set_pmk)(struct wiphy *wiphy, struct net_device *dev,
38193a00df57SAvraham Stern 			   const struct cfg80211_pmk_conf *conf);
38203a00df57SAvraham Stern 	int	(*del_pmk)(struct wiphy *wiphy, struct net_device *dev,
38213a00df57SAvraham Stern 			   const u8 *aa);
382240cbfa90SSrinivas Dasari 	int     (*external_auth)(struct wiphy *wiphy, struct net_device *dev,
382340cbfa90SSrinivas Dasari 				 struct cfg80211_external_auth_params *params);
38242576a9acSDenis Kenzior 
38252576a9acSDenis Kenzior 	int	(*tx_control_port)(struct wiphy *wiphy,
38262576a9acSDenis Kenzior 				   struct net_device *dev,
38272576a9acSDenis Kenzior 				   const u8 *buf, size_t len,
38282576a9acSDenis Kenzior 				   const u8 *dest, const __be16 proto,
38292576a9acSDenis Kenzior 				   const bool noencrypt);
383081e54d08SPradeep Kumar Chitrapu 
383181e54d08SPradeep Kumar Chitrapu 	int	(*get_ftm_responder_stats)(struct wiphy *wiphy,
383281e54d08SPradeep Kumar Chitrapu 				struct net_device *dev,
383381e54d08SPradeep Kumar Chitrapu 				struct cfg80211_ftm_responder_stats *ftm_stats);
38349bb7e0f2SJohannes Berg 
38359bb7e0f2SJohannes Berg 	int	(*start_pmsr)(struct wiphy *wiphy, struct wireless_dev *wdev,
38369bb7e0f2SJohannes Berg 			      struct cfg80211_pmsr_request *request);
38379bb7e0f2SJohannes Berg 	void	(*abort_pmsr)(struct wiphy *wiphy, struct wireless_dev *wdev,
38389bb7e0f2SJohannes Berg 			      struct cfg80211_pmsr_request *request);
3839cb74e977SSunil Dutt 	int	(*update_owe_info)(struct wiphy *wiphy, struct net_device *dev,
3840cb74e977SSunil Dutt 				   struct cfg80211_update_owe_info *owe_info);
38415ab92e7fSRajkumar Manoharan 	int	(*probe_mesh_link)(struct wiphy *wiphy, struct net_device *dev,
38425ab92e7fSRajkumar Manoharan 				   const u8 *buf, size_t len);
3843704232c2SJohannes Berg };
3844704232c2SJohannes Berg 
3845d3236553SJohannes Berg /*
3846d3236553SJohannes Berg  * wireless hardware and networking interfaces structures
3847d3236553SJohannes Berg  * and registration/helper functions
3848d3236553SJohannes Berg  */
3849d3236553SJohannes Berg 
3850d3236553SJohannes Berg /**
38515be83de5SJohannes Berg  * enum wiphy_flags - wiphy capability flags
38525be83de5SJohannes Berg  *
38535be83de5SJohannes Berg  * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this
38545be83de5SJohannes Berg  *	wiphy at all
38555be83de5SJohannes Berg  * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled
38565be83de5SJohannes Berg  *	by default -- this flag will be set depending on the kernel's default
38575be83de5SJohannes Berg  *	on wiphy_new(), but can be changed by the driver if it has a good
38585be83de5SJohannes Berg  *	reason to override the default
38599bc383deSJohannes Berg  * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station
386033d915d9SManikanta Pubbisetty  *	on a VLAN interface). This flag also serves an extra purpose of
386133d915d9SManikanta Pubbisetty  *	supporting 4ADDR AP mode on devices which do not support AP/VLAN iftype.
38629bc383deSJohannes Berg  * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station
3863c0692b8fSJohannes Berg  * @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the
3864c0692b8fSJohannes Berg  *	control port protocol ethertype. The device also honours the
3865c0692b8fSJohannes Berg  *	control_port_no_encrypt flag.
3866e31b8213SJohannes Berg  * @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN.
386715d5dda6SJavier Cardona  * @WIPHY_FLAG_MESH_AUTH: The device supports mesh authentication by routing
386815d5dda6SJavier Cardona  *	auth frames to userspace. See @NL80211_MESH_SETUP_USERSPACE_AUTH.
3869f4b34b55SVivek Natarajan  * @WIPHY_FLAG_SUPPORTS_FW_ROAM: The device supports roaming feature in the
3870f4b34b55SVivek Natarajan  *	firmware.
3871cedb5412SEliad Peller  * @WIPHY_FLAG_AP_UAPSD: The device supports uapsd on AP.
3872109086ceSArik Nemtsov  * @WIPHY_FLAG_SUPPORTS_TDLS: The device supports TDLS (802.11z) operation.
3873109086ceSArik Nemtsov  * @WIPHY_FLAG_TDLS_EXTERNAL_SETUP: The device does not handle TDLS (802.11z)
3874109086ceSArik Nemtsov  *	link setup/discovery operations internally. Setup, discovery and
3875109086ceSArik Nemtsov  *	teardown packets should be sent through the @NL80211_CMD_TDLS_MGMT
3876109086ceSArik Nemtsov  *	command. When this flag is not set, @NL80211_CMD_TDLS_OPER should be
3877109086ceSArik Nemtsov  *	used for asking the driver/firmware to perform a TDLS operation.
3878562a7480SJohannes Berg  * @WIPHY_FLAG_HAVE_AP_SME: device integrates AP SME
38795e760230SJohannes Berg  * @WIPHY_FLAG_REPORTS_OBSS: the device will report beacons from other BSSes
38805e760230SJohannes Berg  *	when there are virtual interfaces in AP mode by calling
38815e760230SJohannes Berg  *	cfg80211_report_obss_beacon().
388287bbbe22SArik Nemtsov  * @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD: When operating as an AP, the device
388387bbbe22SArik Nemtsov  *	responds to probe-requests in hardware.
38847c4ef712SJohannes Berg  * @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX.
38857c4ef712SJohannes Berg  * @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call.
38862f301ab2SSimon Wunderlich  * @WIPHY_FLAG_SUPPORTS_5_10_MHZ: Device supports 5 MHz and 10 MHz channels.
388716ef1fe2SSimon Wunderlich  * @WIPHY_FLAG_HAS_CHANNEL_SWITCH: Device supports channel switch in
388816ef1fe2SSimon Wunderlich  *	beaconing mode (AP, IBSS, Mesh, ...).
3889b8676221SDavid Spinadel  * @WIPHY_FLAG_HAS_STATIC_WEP: The device supports static WEP key installation
3890b8676221SDavid Spinadel  *	before connection.
38915be83de5SJohannes Berg  */
38925be83de5SJohannes Berg enum wiphy_flags {
3893723e73acSJohannes Berg 	/* use hole at 0 */
3894a2f73b6cSLuis R. Rodriguez 	/* use hole at 1 */
3895a2f73b6cSLuis R. Rodriguez 	/* use hole at 2 */
38965be83de5SJohannes Berg 	WIPHY_FLAG_NETNS_OK			= BIT(3),
38975be83de5SJohannes Berg 	WIPHY_FLAG_PS_ON_BY_DEFAULT		= BIT(4),
38989bc383deSJohannes Berg 	WIPHY_FLAG_4ADDR_AP			= BIT(5),
38999bc383deSJohannes Berg 	WIPHY_FLAG_4ADDR_STATION		= BIT(6),
3900c0692b8fSJohannes Berg 	WIPHY_FLAG_CONTROL_PORT_PROTOCOL	= BIT(7),
3901309075cfSJussi Kivilinna 	WIPHY_FLAG_IBSS_RSN			= BIT(8),
390215d5dda6SJavier Cardona 	WIPHY_FLAG_MESH_AUTH			= BIT(10),
3903ca986ad9SArend Van Spriel 	/* use hole at 11 */
39048e8b41f9SJohannes Berg 	/* use hole at 12 */
3905f4b34b55SVivek Natarajan 	WIPHY_FLAG_SUPPORTS_FW_ROAM		= BIT(13),
3906cedb5412SEliad Peller 	WIPHY_FLAG_AP_UAPSD			= BIT(14),
3907109086ceSArik Nemtsov 	WIPHY_FLAG_SUPPORTS_TDLS		= BIT(15),
3908109086ceSArik Nemtsov 	WIPHY_FLAG_TDLS_EXTERNAL_SETUP		= BIT(16),
3909562a7480SJohannes Berg 	WIPHY_FLAG_HAVE_AP_SME			= BIT(17),
39105e760230SJohannes Berg 	WIPHY_FLAG_REPORTS_OBSS			= BIT(18),
391187bbbe22SArik Nemtsov 	WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD	= BIT(19),
39127c4ef712SJohannes Berg 	WIPHY_FLAG_OFFCHAN_TX			= BIT(20),
39137c4ef712SJohannes Berg 	WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL	= BIT(21),
39142f301ab2SSimon Wunderlich 	WIPHY_FLAG_SUPPORTS_5_10_MHZ		= BIT(22),
391516ef1fe2SSimon Wunderlich 	WIPHY_FLAG_HAS_CHANNEL_SWITCH		= BIT(23),
3916b8676221SDavid Spinadel 	WIPHY_FLAG_HAS_STATIC_WEP		= BIT(24),
39177527a782SJohannes Berg };
39187527a782SJohannes Berg 
39197527a782SJohannes Berg /**
39207527a782SJohannes Berg  * struct ieee80211_iface_limit - limit on certain interface types
39217527a782SJohannes Berg  * @max: maximum number of interfaces of these types
39227527a782SJohannes Berg  * @types: interface types (bits)
39237527a782SJohannes Berg  */
39247527a782SJohannes Berg struct ieee80211_iface_limit {
39257527a782SJohannes Berg 	u16 max;
39267527a782SJohannes Berg 	u16 types;
39277527a782SJohannes Berg };
39287527a782SJohannes Berg 
39297527a782SJohannes Berg /**
39307527a782SJohannes Berg  * struct ieee80211_iface_combination - possible interface combination
39317527a782SJohannes Berg  *
3932b80edbc1SLuciano Coelho  * With this structure the driver can describe which interface
3933b80edbc1SLuciano Coelho  * combinations it supports concurrently.
39347527a782SJohannes Berg  *
3935b80edbc1SLuciano Coelho  * Examples:
3936b80edbc1SLuciano Coelho  *
3937b80edbc1SLuciano Coelho  * 1. Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total:
39387527a782SJohannes Berg  *
3939819bf593SJohannes Berg  *    .. code-block:: c
3940819bf593SJohannes Berg  *
39417527a782SJohannes Berg  *	struct ieee80211_iface_limit limits1[] = {
39427527a782SJohannes Berg  *		{ .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
39437527a782SJohannes Berg  *		{ .max = 1, .types = BIT(NL80211_IFTYPE_AP}, },
39447527a782SJohannes Berg  *	};
39457527a782SJohannes Berg  *	struct ieee80211_iface_combination combination1 = {
39467527a782SJohannes Berg  *		.limits = limits1,
39477527a782SJohannes Berg  *		.n_limits = ARRAY_SIZE(limits1),
39487527a782SJohannes Berg  *		.max_interfaces = 2,
39497527a782SJohannes Berg  *		.beacon_int_infra_match = true,
39507527a782SJohannes Berg  *	};
39517527a782SJohannes Berg  *
39527527a782SJohannes Berg  *
3953b80edbc1SLuciano Coelho  * 2. Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total:
39547527a782SJohannes Berg  *
3955819bf593SJohannes Berg  *    .. code-block:: c
3956819bf593SJohannes Berg  *
39577527a782SJohannes Berg  *	struct ieee80211_iface_limit limits2[] = {
39587527a782SJohannes Berg  *		{ .max = 8, .types = BIT(NL80211_IFTYPE_AP) |
39597527a782SJohannes Berg  *				     BIT(NL80211_IFTYPE_P2P_GO), },
39607527a782SJohannes Berg  *	};
39617527a782SJohannes Berg  *	struct ieee80211_iface_combination combination2 = {
39627527a782SJohannes Berg  *		.limits = limits2,
39637527a782SJohannes Berg  *		.n_limits = ARRAY_SIZE(limits2),
39647527a782SJohannes Berg  *		.max_interfaces = 8,
39657527a782SJohannes Berg  *		.num_different_channels = 1,
39667527a782SJohannes Berg  *	};
39677527a782SJohannes Berg  *
39687527a782SJohannes Berg  *
3969b80edbc1SLuciano Coelho  * 3. Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total.
3970b80edbc1SLuciano Coelho  *
39717527a782SJohannes Berg  *    This allows for an infrastructure connection and three P2P connections.
39727527a782SJohannes Berg  *
3973819bf593SJohannes Berg  *    .. code-block:: c
3974819bf593SJohannes Berg  *
39757527a782SJohannes Berg  *	struct ieee80211_iface_limit limits3[] = {
39767527a782SJohannes Berg  *		{ .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
39777527a782SJohannes Berg  *		{ .max = 3, .types = BIT(NL80211_IFTYPE_P2P_GO) |
39787527a782SJohannes Berg  *				     BIT(NL80211_IFTYPE_P2P_CLIENT), },
39797527a782SJohannes Berg  *	};
39807527a782SJohannes Berg  *	struct ieee80211_iface_combination combination3 = {
39817527a782SJohannes Berg  *		.limits = limits3,
39827527a782SJohannes Berg  *		.n_limits = ARRAY_SIZE(limits3),
39837527a782SJohannes Berg  *		.max_interfaces = 4,
39847527a782SJohannes Berg  *		.num_different_channels = 2,
39857527a782SJohannes Berg  *	};
3986819bf593SJohannes Berg  *
39877527a782SJohannes Berg  */
39887527a782SJohannes Berg struct ieee80211_iface_combination {
3989c6c94aeaSJohannes Berg 	/**
3990c6c94aeaSJohannes Berg 	 * @limits:
3991c6c94aeaSJohannes Berg 	 * limits for the given interface types
3992c6c94aeaSJohannes Berg 	 */
39937527a782SJohannes Berg 	const struct ieee80211_iface_limit *limits;
3994c6c94aeaSJohannes Berg 
3995c6c94aeaSJohannes Berg 	/**
3996c6c94aeaSJohannes Berg 	 * @num_different_channels:
3997c6c94aeaSJohannes Berg 	 * can use up to this many different channels
3998c6c94aeaSJohannes Berg 	 */
39997527a782SJohannes Berg 	u32 num_different_channels;
4000c6c94aeaSJohannes Berg 
4001c6c94aeaSJohannes Berg 	/**
4002c6c94aeaSJohannes Berg 	 * @max_interfaces:
4003c6c94aeaSJohannes Berg 	 * maximum number of interfaces in total allowed in this group
4004c6c94aeaSJohannes Berg 	 */
40057527a782SJohannes Berg 	u16 max_interfaces;
4006c6c94aeaSJohannes Berg 
4007c6c94aeaSJohannes Berg 	/**
4008c6c94aeaSJohannes Berg 	 * @n_limits:
4009c6c94aeaSJohannes Berg 	 * number of limitations
4010c6c94aeaSJohannes Berg 	 */
40117527a782SJohannes Berg 	u8 n_limits;
4012c6c94aeaSJohannes Berg 
4013c6c94aeaSJohannes Berg 	/**
4014c6c94aeaSJohannes Berg 	 * @beacon_int_infra_match:
4015c6c94aeaSJohannes Berg 	 * In this combination, the beacon intervals between infrastructure
4016c6c94aeaSJohannes Berg 	 * and AP types must match. This is required only in special cases.
4017c6c94aeaSJohannes Berg 	 */
40187527a782SJohannes Berg 	bool beacon_int_infra_match;
4019c6c94aeaSJohannes Berg 
4020c6c94aeaSJohannes Berg 	/**
4021c6c94aeaSJohannes Berg 	 * @radar_detect_widths:
4022c6c94aeaSJohannes Berg 	 * bitmap of channel widths supported for radar detection
4023c6c94aeaSJohannes Berg 	 */
402411c4a075SSimon Wunderlich 	u8 radar_detect_widths;
4025c6c94aeaSJohannes Berg 
4026c6c94aeaSJohannes Berg 	/**
4027c6c94aeaSJohannes Berg 	 * @radar_detect_regions:
4028c6c94aeaSJohannes Berg 	 * bitmap of regions supported for radar detection
4029c6c94aeaSJohannes Berg 	 */
40308c48b50aSFelix Fietkau 	u8 radar_detect_regions;
4031c6c94aeaSJohannes Berg 
4032c6c94aeaSJohannes Berg 	/**
4033c6c94aeaSJohannes Berg 	 * @beacon_int_min_gcd:
4034c6c94aeaSJohannes Berg 	 * This interface combination supports different beacon intervals.
4035c6c94aeaSJohannes Berg 	 *
4036c6c94aeaSJohannes Berg 	 * = 0
4037c6c94aeaSJohannes Berg 	 *   all beacon intervals for different interface must be same.
4038c6c94aeaSJohannes Berg 	 * > 0
4039c6c94aeaSJohannes Berg 	 *   any beacon interval for the interface part of this combination AND
4040c6c94aeaSJohannes Berg 	 *   GCD of all beacon intervals from beaconing interfaces of this
4041c6c94aeaSJohannes Berg 	 *   combination must be greater or equal to this value.
4042c6c94aeaSJohannes Berg 	 */
40430c317a02SPurushottam Kushwaha 	u32 beacon_int_min_gcd;
40445be83de5SJohannes Berg };
40455be83de5SJohannes Berg 
40462e161f78SJohannes Berg struct ieee80211_txrx_stypes {
40472e161f78SJohannes Berg 	u16 tx, rx;
40482e161f78SJohannes Berg };
40492e161f78SJohannes Berg 
40505be83de5SJohannes Berg /**
4051ff1b6e69SJohannes Berg  * enum wiphy_wowlan_support_flags - WoWLAN support flags
4052ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_ANY: supports wakeup for the special "any"
4053ff1b6e69SJohannes Berg  *	trigger that keeps the device operating as-is and
4054ff1b6e69SJohannes Berg  *	wakes up the host on any activity, for example a
4055ff1b6e69SJohannes Berg  *	received packet that passed filtering; note that the
4056ff1b6e69SJohannes Berg  *	packet should be preserved in that case
4057ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_MAGIC_PKT: supports wakeup on magic packet
4058ff1b6e69SJohannes Berg  *	(see nl80211.h)
4059ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_DISCONNECT: supports wakeup on disconnect
406077dbbb13SJohannes Berg  * @WIPHY_WOWLAN_SUPPORTS_GTK_REKEY: supports GTK rekeying while asleep
406177dbbb13SJohannes Berg  * @WIPHY_WOWLAN_GTK_REKEY_FAILURE: supports wakeup on GTK rekey failure
406277dbbb13SJohannes Berg  * @WIPHY_WOWLAN_EAP_IDENTITY_REQ: supports wakeup on EAP identity request
406377dbbb13SJohannes Berg  * @WIPHY_WOWLAN_4WAY_HANDSHAKE: supports wakeup on 4-way handshake failure
406477dbbb13SJohannes Berg  * @WIPHY_WOWLAN_RFKILL_RELEASE: supports wakeup on RF-kill release
40658cd4d456SLuciano Coelho  * @WIPHY_WOWLAN_NET_DETECT: supports wakeup on network detection
4066ff1b6e69SJohannes Berg  */
4067ff1b6e69SJohannes Berg enum wiphy_wowlan_support_flags {
4068ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_ANY		= BIT(0),
4069ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_MAGIC_PKT		= BIT(1),
4070ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_DISCONNECT		= BIT(2),
407177dbbb13SJohannes Berg 	WIPHY_WOWLAN_SUPPORTS_GTK_REKEY	= BIT(3),
407277dbbb13SJohannes Berg 	WIPHY_WOWLAN_GTK_REKEY_FAILURE	= BIT(4),
407377dbbb13SJohannes Berg 	WIPHY_WOWLAN_EAP_IDENTITY_REQ	= BIT(5),
407477dbbb13SJohannes Berg 	WIPHY_WOWLAN_4WAY_HANDSHAKE	= BIT(6),
407577dbbb13SJohannes Berg 	WIPHY_WOWLAN_RFKILL_RELEASE	= BIT(7),
40768cd4d456SLuciano Coelho 	WIPHY_WOWLAN_NET_DETECT		= BIT(8),
4077ff1b6e69SJohannes Berg };
4078ff1b6e69SJohannes Berg 
40792a0e047eSJohannes Berg struct wiphy_wowlan_tcp_support {
40802a0e047eSJohannes Berg 	const struct nl80211_wowlan_tcp_data_token_feature *tok;
40812a0e047eSJohannes Berg 	u32 data_payload_max;
40822a0e047eSJohannes Berg 	u32 data_interval_max;
40832a0e047eSJohannes Berg 	u32 wake_payload_max;
40842a0e047eSJohannes Berg 	bool seq;
40852a0e047eSJohannes Berg };
40862a0e047eSJohannes Berg 
4087ff1b6e69SJohannes Berg /**
4088ff1b6e69SJohannes Berg  * struct wiphy_wowlan_support - WoWLAN support data
4089ff1b6e69SJohannes Berg  * @flags: see &enum wiphy_wowlan_support_flags
4090ff1b6e69SJohannes Berg  * @n_patterns: number of supported wakeup patterns
4091ff1b6e69SJohannes Berg  *	(see nl80211.h for the pattern definition)
4092ff1b6e69SJohannes Berg  * @pattern_max_len: maximum length of each pattern
4093ff1b6e69SJohannes Berg  * @pattern_min_len: minimum length of each pattern
4094bb92d199SAmitkumar Karwar  * @max_pkt_offset: maximum Rx packet offset
40958cd4d456SLuciano Coelho  * @max_nd_match_sets: maximum number of matchsets for net-detect,
40968cd4d456SLuciano Coelho  *	similar, but not necessarily identical, to max_match_sets for
40978cd4d456SLuciano Coelho  *	scheduled scans.
40988cd4d456SLuciano Coelho  *	See &struct cfg80211_sched_scan_request.@match_sets for more
40998cd4d456SLuciano Coelho  *	details.
41002a0e047eSJohannes Berg  * @tcp: TCP wakeup support information
4101ff1b6e69SJohannes Berg  */
4102ff1b6e69SJohannes Berg struct wiphy_wowlan_support {
4103ff1b6e69SJohannes Berg 	u32 flags;
4104ff1b6e69SJohannes Berg 	int n_patterns;
4105ff1b6e69SJohannes Berg 	int pattern_max_len;
4106ff1b6e69SJohannes Berg 	int pattern_min_len;
4107bb92d199SAmitkumar Karwar 	int max_pkt_offset;
41088cd4d456SLuciano Coelho 	int max_nd_match_sets;
41092a0e047eSJohannes Berg 	const struct wiphy_wowlan_tcp_support *tcp;
4110ff1b6e69SJohannes Berg };
4111ff1b6e69SJohannes Berg 
4112ff1b6e69SJohannes Berg /**
4113be29b99aSAmitkumar Karwar  * struct wiphy_coalesce_support - coalesce support data
4114be29b99aSAmitkumar Karwar  * @n_rules: maximum number of coalesce rules
4115be29b99aSAmitkumar Karwar  * @max_delay: maximum supported coalescing delay in msecs
4116be29b99aSAmitkumar Karwar  * @n_patterns: number of supported patterns in a rule
4117be29b99aSAmitkumar Karwar  *	(see nl80211.h for the pattern definition)
4118be29b99aSAmitkumar Karwar  * @pattern_max_len: maximum length of each pattern
4119be29b99aSAmitkumar Karwar  * @pattern_min_len: minimum length of each pattern
4120be29b99aSAmitkumar Karwar  * @max_pkt_offset: maximum Rx packet offset
4121be29b99aSAmitkumar Karwar  */
4122be29b99aSAmitkumar Karwar struct wiphy_coalesce_support {
4123be29b99aSAmitkumar Karwar 	int n_rules;
4124be29b99aSAmitkumar Karwar 	int max_delay;
4125be29b99aSAmitkumar Karwar 	int n_patterns;
4126be29b99aSAmitkumar Karwar 	int pattern_max_len;
4127be29b99aSAmitkumar Karwar 	int pattern_min_len;
4128be29b99aSAmitkumar Karwar 	int max_pkt_offset;
4129be29b99aSAmitkumar Karwar };
4130be29b99aSAmitkumar Karwar 
4131be29b99aSAmitkumar Karwar /**
4132ad7e718cSJohannes Berg  * enum wiphy_vendor_command_flags - validation flags for vendor commands
4133ad7e718cSJohannes Berg  * @WIPHY_VENDOR_CMD_NEED_WDEV: vendor command requires wdev
4134ad7e718cSJohannes Berg  * @WIPHY_VENDOR_CMD_NEED_NETDEV: vendor command requires netdev
4135ad7e718cSJohannes Berg  * @WIPHY_VENDOR_CMD_NEED_RUNNING: interface/wdev must be up & running
4136ad7e718cSJohannes Berg  *	(must be combined with %_WDEV or %_NETDEV)
4137ad7e718cSJohannes Berg  */
4138ad7e718cSJohannes Berg enum wiphy_vendor_command_flags {
4139ad7e718cSJohannes Berg 	WIPHY_VENDOR_CMD_NEED_WDEV = BIT(0),
4140ad7e718cSJohannes Berg 	WIPHY_VENDOR_CMD_NEED_NETDEV = BIT(1),
4141ad7e718cSJohannes Berg 	WIPHY_VENDOR_CMD_NEED_RUNNING = BIT(2),
4142ad7e718cSJohannes Berg };
4143ad7e718cSJohannes Berg 
4144ad7e718cSJohannes Berg /**
4145466b9936Stamizhr@codeaurora.org  * enum wiphy_opmode_flag - Station's ht/vht operation mode information flags
4146466b9936Stamizhr@codeaurora.org  *
4147466b9936Stamizhr@codeaurora.org  * @STA_OPMODE_MAX_BW_CHANGED: Max Bandwidth changed
4148466b9936Stamizhr@codeaurora.org  * @STA_OPMODE_SMPS_MODE_CHANGED: SMPS mode changed
4149466b9936Stamizhr@codeaurora.org  * @STA_OPMODE_N_SS_CHANGED: max N_SS (number of spatial streams) changed
4150466b9936Stamizhr@codeaurora.org  *
4151466b9936Stamizhr@codeaurora.org  */
4152466b9936Stamizhr@codeaurora.org enum wiphy_opmode_flag {
4153466b9936Stamizhr@codeaurora.org 	STA_OPMODE_MAX_BW_CHANGED	= BIT(0),
4154466b9936Stamizhr@codeaurora.org 	STA_OPMODE_SMPS_MODE_CHANGED	= BIT(1),
4155466b9936Stamizhr@codeaurora.org 	STA_OPMODE_N_SS_CHANGED		= BIT(2),
4156466b9936Stamizhr@codeaurora.org };
4157466b9936Stamizhr@codeaurora.org 
4158466b9936Stamizhr@codeaurora.org /**
4159466b9936Stamizhr@codeaurora.org  * struct sta_opmode_info - Station's ht/vht operation mode information
4160466b9936Stamizhr@codeaurora.org  * @changed: contains value from &enum wiphy_opmode_flag
41615e78abd0Stamizhr@codeaurora.org  * @smps_mode: New SMPS mode value from &enum nl80211_smps_mode of a station
41625e78abd0Stamizhr@codeaurora.org  * @bw: new max bandwidth value from &enum nl80211_chan_width of a station
4163466b9936Stamizhr@codeaurora.org  * @rx_nss: new rx_nss value of a station
4164466b9936Stamizhr@codeaurora.org  */
4165466b9936Stamizhr@codeaurora.org 
4166466b9936Stamizhr@codeaurora.org struct sta_opmode_info {
4167466b9936Stamizhr@codeaurora.org 	u32 changed;
41685e78abd0Stamizhr@codeaurora.org 	enum nl80211_smps_mode smps_mode;
41695e78abd0Stamizhr@codeaurora.org 	enum nl80211_chan_width bw;
4170466b9936Stamizhr@codeaurora.org 	u8 rx_nss;
4171466b9936Stamizhr@codeaurora.org };
4172466b9936Stamizhr@codeaurora.org 
417391046d63SJohannes Berg #define VENDOR_CMD_RAW_DATA ((const struct nla_policy *)(long)(-ENODATA))
4174901bb989SJohannes Berg 
4175466b9936Stamizhr@codeaurora.org /**
4176ad7e718cSJohannes Berg  * struct wiphy_vendor_command - vendor command definition
4177ad7e718cSJohannes Berg  * @info: vendor command identifying information, as used in nl80211
4178ad7e718cSJohannes Berg  * @flags: flags, see &enum wiphy_vendor_command_flags
4179ad7e718cSJohannes Berg  * @doit: callback for the operation, note that wdev is %NULL if the
4180ad7e718cSJohannes Berg  *	flags didn't ask for a wdev and non-%NULL otherwise; the data
4181ad7e718cSJohannes Berg  *	pointer may be %NULL if userspace provided no data at all
41827bdbe400SJohannes Berg  * @dumpit: dump callback, for transferring bigger/multiple items. The
41837bdbe400SJohannes Berg  *	@storage points to cb->args[5], ie. is preserved over the multiple
41847bdbe400SJohannes Berg  *	dumpit calls.
4185901bb989SJohannes Berg  * @policy: policy pointer for attributes within %NL80211_ATTR_VENDOR_DATA.
4186901bb989SJohannes Berg  *	Set this to %VENDOR_CMD_RAW_DATA if no policy can be given and the
4187901bb989SJohannes Berg  *	attribute is just raw data (e.g. a firmware command).
4188901bb989SJohannes Berg  * @maxattr: highest attribute number in policy
41897bdbe400SJohannes Berg  * It's recommended to not have the same sub command with both @doit and
41907bdbe400SJohannes Berg  * @dumpit, so that userspace can assume certain ones are get and others
41917bdbe400SJohannes Berg  * are used with dump requests.
4192ad7e718cSJohannes Berg  */
4193ad7e718cSJohannes Berg struct wiphy_vendor_command {
4194ad7e718cSJohannes Berg 	struct nl80211_vendor_cmd_info info;
4195ad7e718cSJohannes Berg 	u32 flags;
4196ad7e718cSJohannes Berg 	int (*doit)(struct wiphy *wiphy, struct wireless_dev *wdev,
4197ad7e718cSJohannes Berg 		    const void *data, int data_len);
41987bdbe400SJohannes Berg 	int (*dumpit)(struct wiphy *wiphy, struct wireless_dev *wdev,
41997bdbe400SJohannes Berg 		      struct sk_buff *skb, const void *data, int data_len,
42007bdbe400SJohannes Berg 		      unsigned long *storage);
4201901bb989SJohannes Berg 	const struct nla_policy *policy;
4202901bb989SJohannes Berg 	unsigned int maxattr;
4203ad7e718cSJohannes Berg };
4204ad7e718cSJohannes Berg 
4205ad7e718cSJohannes Berg /**
4206019ae3a9SKanchanapally, Vidyullatha  * struct wiphy_iftype_ext_capab - extended capabilities per interface type
4207019ae3a9SKanchanapally, Vidyullatha  * @iftype: interface type
4208019ae3a9SKanchanapally, Vidyullatha  * @extended_capabilities: extended capabilities supported by the driver,
4209019ae3a9SKanchanapally, Vidyullatha  *	additional capabilities might be supported by userspace; these are the
4210019ae3a9SKanchanapally, Vidyullatha  *	802.11 extended capabilities ("Extended Capabilities element") and are
4211019ae3a9SKanchanapally, Vidyullatha  *	in the same format as in the information element. See IEEE Std
4212019ae3a9SKanchanapally, Vidyullatha  *	802.11-2012 8.4.2.29 for the defined fields.
4213019ae3a9SKanchanapally, Vidyullatha  * @extended_capabilities_mask: mask of the valid values
4214019ae3a9SKanchanapally, Vidyullatha  * @extended_capabilities_len: length of the extended capabilities
4215019ae3a9SKanchanapally, Vidyullatha  */
4216019ae3a9SKanchanapally, Vidyullatha struct wiphy_iftype_ext_capab {
4217019ae3a9SKanchanapally, Vidyullatha 	enum nl80211_iftype iftype;
4218019ae3a9SKanchanapally, Vidyullatha 	const u8 *extended_capabilities;
4219019ae3a9SKanchanapally, Vidyullatha 	const u8 *extended_capabilities_mask;
4220019ae3a9SKanchanapally, Vidyullatha 	u8 extended_capabilities_len;
4221019ae3a9SKanchanapally, Vidyullatha };
4222019ae3a9SKanchanapally, Vidyullatha 
4223019ae3a9SKanchanapally, Vidyullatha /**
42249bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_capabilities - cfg80211 peer measurement capabilities
42259bb7e0f2SJohannes Berg  * @max_peers: maximum number of peers in a single measurement
42269bb7e0f2SJohannes Berg  * @report_ap_tsf: can report assoc AP's TSF for radio resource measurement
42279bb7e0f2SJohannes Berg  * @randomize_mac_addr: can randomize MAC address for measurement
42289bb7e0f2SJohannes Berg  * @ftm.supported: FTM measurement is supported
42299bb7e0f2SJohannes Berg  * @ftm.asap: ASAP-mode is supported
42309bb7e0f2SJohannes Berg  * @ftm.non_asap: non-ASAP-mode is supported
42319bb7e0f2SJohannes Berg  * @ftm.request_lci: can request LCI data
42329bb7e0f2SJohannes Berg  * @ftm.request_civicloc: can request civic location data
42339bb7e0f2SJohannes Berg  * @ftm.preambles: bitmap of preambles supported (&enum nl80211_preamble)
42349bb7e0f2SJohannes Berg  * @ftm.bandwidths: bitmap of bandwidths supported (&enum nl80211_chan_width)
42359bb7e0f2SJohannes Berg  * @ftm.max_bursts_exponent: maximum burst exponent supported
42369bb7e0f2SJohannes Berg  *	(set to -1 if not limited; note that setting this will necessarily
42379bb7e0f2SJohannes Berg  *	forbid using the value 15 to let the responder pick)
42389bb7e0f2SJohannes Berg  * @ftm.max_ftms_per_burst: maximum FTMs per burst supported (set to 0 if
42399bb7e0f2SJohannes Berg  *	not limited)
42409bb7e0f2SJohannes Berg  */
42419bb7e0f2SJohannes Berg struct cfg80211_pmsr_capabilities {
42429bb7e0f2SJohannes Berg 	unsigned int max_peers;
42439bb7e0f2SJohannes Berg 	u8 report_ap_tsf:1,
42449bb7e0f2SJohannes Berg 	   randomize_mac_addr:1;
42459bb7e0f2SJohannes Berg 
42469bb7e0f2SJohannes Berg 	struct {
42479bb7e0f2SJohannes Berg 		u32 preambles;
42489bb7e0f2SJohannes Berg 		u32 bandwidths;
42499bb7e0f2SJohannes Berg 		s8 max_bursts_exponent;
42509bb7e0f2SJohannes Berg 		u8 max_ftms_per_burst;
42519bb7e0f2SJohannes Berg 		u8 supported:1,
42529bb7e0f2SJohannes Berg 		   asap:1,
42539bb7e0f2SJohannes Berg 		   non_asap:1,
42549bb7e0f2SJohannes Berg 		   request_lci:1,
42559bb7e0f2SJohannes Berg 		   request_civicloc:1;
42569bb7e0f2SJohannes Berg 	} ftm;
42579bb7e0f2SJohannes Berg };
42589bb7e0f2SJohannes Berg 
42599bb7e0f2SJohannes Berg /**
42605be83de5SJohannes Berg  * struct wiphy - wireless hardware description
42612784fe91SLuis R. Rodriguez  * @reg_notifier: the driver's regulatory notification callback,
42622784fe91SLuis R. Rodriguez  *	note that if your driver uses wiphy_apply_custom_regulatory()
42632784fe91SLuis R. Rodriguez  *	the reg_notifier's request can be passed as NULL
4264d3236553SJohannes Berg  * @regd: the driver's regulatory domain, if one was requested via
4265d3236553SJohannes Berg  * 	the regulatory_hint() API. This can be used by the driver
4266d3236553SJohannes Berg  *	on the reg_notifier() if it chooses to ignore future
4267d3236553SJohannes Berg  *	regulatory domain changes caused by other drivers.
4268d3236553SJohannes Berg  * @signal_type: signal type reported in &struct cfg80211_bss.
4269d3236553SJohannes Berg  * @cipher_suites: supported cipher suites
4270d3236553SJohannes Berg  * @n_cipher_suites: number of supported cipher suites
4271ab4dfa20SVeerendranath Jakkam  * @akm_suites: supported AKM suites
4272ab4dfa20SVeerendranath Jakkam  * @n_akm_suites: number of supported AKM suites
4273b9a5f8caSJouni Malinen  * @retry_short: Retry limit for short frames (dot11ShortRetryLimit)
4274b9a5f8caSJouni Malinen  * @retry_long: Retry limit for long frames (dot11LongRetryLimit)
4275b9a5f8caSJouni Malinen  * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold);
4276b9a5f8caSJouni Malinen  *	-1 = fragmentation disabled, only odd values >= 256 used
4277b9a5f8caSJouni Malinen  * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled
4278abe37c4bSJohannes Berg  * @_net: the network namespace this wiphy currently lives in
4279ef15aac6SJohannes Berg  * @perm_addr: permanent MAC address of this device
4280ef15aac6SJohannes Berg  * @addr_mask: If the device supports multiple MAC addresses by masking,
4281ef15aac6SJohannes Berg  *	set this to a mask with variable bits set to 1, e.g. if the last
42820fcf8ac5SLuciano Coelho  *	four bits are variable then set it to 00-00-00-00-00-0f. The actual
4283ef15aac6SJohannes Berg  *	variable bits shall be determined by the interfaces added, with
4284ef15aac6SJohannes Berg  *	interfaces not matching the mask being rejected to be brought up.
4285ef15aac6SJohannes Berg  * @n_addresses: number of addresses in @addresses.
4286ef15aac6SJohannes Berg  * @addresses: If the device has more than one address, set this pointer
4287ef15aac6SJohannes Berg  *	to a list of addresses (6 bytes each). The first one will be used
4288ef15aac6SJohannes Berg  *	by default for perm_addr. In this case, the mask should be set to
4289ef15aac6SJohannes Berg  *	all-zeroes. In this case it is assumed that the device can handle
4290ef15aac6SJohannes Berg  *	the same number of arbitrary MAC addresses.
4291fd235913SRandy Dunlap  * @registered: protects ->resume and ->suspend sysfs callbacks against
4292fd235913SRandy Dunlap  *	unregister hardware
4293abe37c4bSJohannes Berg  * @debugfsdir: debugfs directory used for this wiphy, will be renamed
4294abe37c4bSJohannes Berg  *	automatically on wiphy renames
4295abe37c4bSJohannes Berg  * @dev: (virtual) struct device for this wiphy
42964a711a85SStanislaw Gruszka  * @registered: helps synchronize suspend/resume with wiphy unregister
4297abe37c4bSJohannes Berg  * @wext: wireless extension handlers
4298abe37c4bSJohannes Berg  * @priv: driver private data (sized according to wiphy_new() parameter)
4299abe37c4bSJohannes Berg  * @interface_modes: bitmask of interfaces types valid for this wiphy,
4300abe37c4bSJohannes Berg  *	must be set by driver
43017527a782SJohannes Berg  * @iface_combinations: Valid interface combinations array, should not
43027527a782SJohannes Berg  *	list single interface types.
43037527a782SJohannes Berg  * @n_iface_combinations: number of entries in @iface_combinations array.
43047527a782SJohannes Berg  * @software_iftypes: bitmask of software interface types, these are not
43057527a782SJohannes Berg  *	subject to any restrictions since they are purely managed in SW.
4306abe37c4bSJohannes Berg  * @flags: wiphy flags, see &enum wiphy_flags
4307a2f73b6cSLuis R. Rodriguez  * @regulatory_flags: wiphy regulatory flags, see
4308a2f73b6cSLuis R. Rodriguez  *	&enum ieee80211_regulatory_flags
43091f074bd8SJohannes Berg  * @features: features advertised to nl80211, see &enum nl80211_feature_flags.
4310d75bb06bSGautam Kumar Shukla  * @ext_features: extended features advertised to nl80211, see
4311d75bb06bSGautam Kumar Shukla  *	&enum nl80211_ext_feature_index.
4312abe37c4bSJohannes Berg  * @bss_priv_size: each BSS struct has private data allocated with it,
4313abe37c4bSJohannes Berg  *	this variable determines its size
4314abe37c4bSJohannes Berg  * @max_scan_ssids: maximum number of SSIDs the device can scan for in
4315abe37c4bSJohannes Berg  *	any given scan
4316ca986ad9SArend Van Spriel  * @max_sched_scan_reqs: maximum number of scheduled scan requests that
4317ca986ad9SArend Van Spriel  *	the device can run concurrently.
431893b6aa69SLuciano Coelho  * @max_sched_scan_ssids: maximum number of SSIDs the device can scan
431993b6aa69SLuciano Coelho  *	for in any given scheduled scan
4320a1f1c21cSLuciano Coelho  * @max_match_sets: maximum number of match sets the device can handle
4321a1f1c21cSLuciano Coelho  *	when performing a scheduled scan, 0 if filtering is not
4322a1f1c21cSLuciano Coelho  *	supported.
4323abe37c4bSJohannes Berg  * @max_scan_ie_len: maximum length of user-controlled IEs device can
4324abe37c4bSJohannes Berg  *	add to probe request frames transmitted during a scan, must not
4325abe37c4bSJohannes Berg  *	include fixed IEs like supported rates
43265a865badSLuciano Coelho  * @max_sched_scan_ie_len: same as max_scan_ie_len, but for scheduled
43275a865badSLuciano Coelho  *	scans
43283b06d277SAvraham Stern  * @max_sched_scan_plans: maximum number of scan plans (scan interval and number
43293b06d277SAvraham Stern  *	of iterations) for scheduled scan supported by the device.
43303b06d277SAvraham Stern  * @max_sched_scan_plan_interval: maximum interval (in seconds) for a
43313b06d277SAvraham Stern  *	single scan plan supported by the device.
43323b06d277SAvraham Stern  * @max_sched_scan_plan_iterations: maximum number of iterations for a single
43333b06d277SAvraham Stern  *	scan plan supported by the device.
4334abe37c4bSJohannes Berg  * @coverage_class: current coverage class
4335abe37c4bSJohannes Berg  * @fw_version: firmware version for ethtool reporting
4336abe37c4bSJohannes Berg  * @hw_version: hardware version for ethtool reporting
4337abe37c4bSJohannes Berg  * @max_num_pmkids: maximum number of PMKIDs supported by device
4338abe37c4bSJohannes Berg  * @privid: a pointer that drivers can use to identify if an arbitrary
4339abe37c4bSJohannes Berg  *	wiphy is theirs, e.g. in global notifiers
4340abe37c4bSJohannes Berg  * @bands: information about bands/channels supported by this device
43412e161f78SJohannes Berg  *
43422e161f78SJohannes Berg  * @mgmt_stypes: bitmasks of frame subtypes that can be subscribed to or
43432e161f78SJohannes Berg  *	transmitted through nl80211, points to an array indexed by interface
43442e161f78SJohannes Berg  *	type
4345a7ffac95SBruno Randolf  *
43467f531e03SBruno Randolf  * @available_antennas_tx: bitmap of antennas which are available to be
43477f531e03SBruno Randolf  *	configured as TX antennas. Antenna configuration commands will be
43487f531e03SBruno Randolf  *	rejected unless this or @available_antennas_rx is set.
43497f531e03SBruno Randolf  *
43507f531e03SBruno Randolf  * @available_antennas_rx: bitmap of antennas which are available to be
43517f531e03SBruno Randolf  *	configured as RX antennas. Antenna configuration commands will be
43527f531e03SBruno Randolf  *	rejected unless this or @available_antennas_tx is set.
4353a293911dSJohannes Berg  *
435415f0ebc2SRandy Dunlap  * @probe_resp_offload:
435515f0ebc2SRandy Dunlap  *	 Bitmap of supported protocols for probe response offloading.
435615f0ebc2SRandy Dunlap  *	 See &enum nl80211_probe_resp_offload_support_attr. Only valid
435715f0ebc2SRandy Dunlap  *	 when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set.
435815f0ebc2SRandy Dunlap  *
4359a293911dSJohannes Berg  * @max_remain_on_channel_duration: Maximum time a remain-on-channel operation
4360a293911dSJohannes Berg  *	may request, if implemented.
4361ff1b6e69SJohannes Berg  *
4362ff1b6e69SJohannes Berg  * @wowlan: WoWLAN support information
43636abb9cb9SJohannes Berg  * @wowlan_config: current WoWLAN configuration; this should usually not be
43646abb9cb9SJohannes Berg  *	used since access to it is necessarily racy, use the parameter passed
43656abb9cb9SJohannes Berg  *	to the suspend() operation instead.
4366562a7480SJohannes Berg  *
4367562a7480SJohannes Berg  * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features.
43687e7c8926SBen Greear  * @ht_capa_mod_mask:  Specify what ht_cap values can be over-ridden.
43697e7c8926SBen Greear  *	If null, then none can be over-ridden.
4370ee2aca34SJohannes Berg  * @vht_capa_mod_mask:  Specify what VHT capabilities can be over-ridden.
4371ee2aca34SJohannes Berg  *	If null, then none can be over-ridden.
437277765eafSVasanthakumar Thiagarajan  *
437353873f13SJohannes Berg  * @wdev_list: the list of associated (virtual) interfaces; this list must
437453873f13SJohannes Berg  *	not be modified by the driver, but can be read with RTNL/RCU protection.
437553873f13SJohannes Berg  *
437677765eafSVasanthakumar Thiagarajan  * @max_acl_mac_addrs: Maximum number of MAC addresses that the device
437777765eafSVasanthakumar Thiagarajan  *	supports for ACL.
4378a50df0c4SJohannes Berg  *
4379a50df0c4SJohannes Berg  * @extended_capabilities: extended capabilities supported by the driver,
4380a50df0c4SJohannes Berg  *	additional capabilities might be supported by userspace; these are
4381a50df0c4SJohannes Berg  *	the 802.11 extended capabilities ("Extended Capabilities element")
4382a50df0c4SJohannes Berg  *	and are in the same format as in the information element. See
4383019ae3a9SKanchanapally, Vidyullatha  *	802.11-2012 8.4.2.29 for the defined fields. These are the default
4384019ae3a9SKanchanapally, Vidyullatha  *	extended capabilities to be used if the capabilities are not specified
4385019ae3a9SKanchanapally, Vidyullatha  *	for a specific interface type in iftype_ext_capab.
4386a50df0c4SJohannes Berg  * @extended_capabilities_mask: mask of the valid values
4387a50df0c4SJohannes Berg  * @extended_capabilities_len: length of the extended capabilities
4388019ae3a9SKanchanapally, Vidyullatha  * @iftype_ext_capab: array of extended capabilities per interface type
4389019ae3a9SKanchanapally, Vidyullatha  * @num_iftype_ext_capab: number of interface types for which extended
4390019ae3a9SKanchanapally, Vidyullatha  *	capabilities are specified separately.
4391be29b99aSAmitkumar Karwar  * @coalesce: packet coalescing support information
4392ad7e718cSJohannes Berg  *
4393ad7e718cSJohannes Berg  * @vendor_commands: array of vendor commands supported by the hardware
4394ad7e718cSJohannes Berg  * @n_vendor_commands: number of vendor commands
4395567ffc35SJohannes Berg  * @vendor_events: array of vendor events supported by the hardware
4396567ffc35SJohannes Berg  * @n_vendor_events: number of vendor events
4397b43504cfSJouni Malinen  *
4398b43504cfSJouni Malinen  * @max_ap_assoc_sta: maximum number of associated stations supported in AP mode
4399b43504cfSJouni Malinen  *	(including P2P GO) or 0 to indicate no such limit is advertised. The
4400b43504cfSJouni Malinen  *	driver is allowed to advertise a theoretical limit that it can reach in
4401b43504cfSJouni Malinen  *	some cases, but may not always reach.
4402c2e4323bSLuciano Coelho  *
4403c2e4323bSLuciano Coelho  * @max_num_csa_counters: Number of supported csa_counters in beacons
4404c2e4323bSLuciano Coelho  *	and probe responses.  This value should be set if the driver
4405c2e4323bSLuciano Coelho  *	wishes to limit the number of csa counters. Default (0) means
4406c2e4323bSLuciano Coelho  *	infinite.
440767af9811SEmmanuel Grumbach  * @max_adj_channel_rssi_comp: max offset of between the channel on which the
440867af9811SEmmanuel Grumbach  *	frame was sent and the channel on which the frame was heard for which
440967af9811SEmmanuel Grumbach  *	the reported rssi is still valid. If a driver is able to compensate the
441067af9811SEmmanuel Grumbach  *	low rssi when a frame is heard on different channel, then it should set
441167af9811SEmmanuel Grumbach  *	this variable to the maximal offset for which it can compensate.
441267af9811SEmmanuel Grumbach  *	This value should be set in MHz.
441338de03d2SArend van Spriel  * @bss_select_support: bitmask indicating the BSS selection criteria supported
441438de03d2SArend van Spriel  *	by the driver in the .connect() callback. The bit position maps to the
441538de03d2SArend van Spriel  *	attribute indices defined in &enum nl80211_bss_select_attr.
4416a442b761SAyala Beker  *
44178585989dSLuca Coelho  * @nan_supported_bands: bands supported by the device in NAN mode, a
44188585989dSLuca Coelho  *	bitmap of &enum nl80211_band values.  For instance, for
44198585989dSLuca Coelho  *	NL80211_BAND_2GHZ, bit 0 would be set
44208585989dSLuca Coelho  *	(i.e. BIT(NL80211_BAND_2GHZ)).
4421f3a7ca64SJohannes Berg  *
4422f3a7ca64SJohannes Berg  * @txq_limit: configuration of internal TX queue frame limit
4423f3a7ca64SJohannes Berg  * @txq_memory_limit: configuration internal TX queue memory limit
4424f3a7ca64SJohannes Berg  * @txq_quantum: configuration of internal TX queue scheduler quantum
44259bb7e0f2SJohannes Berg  *
4426213ed579SSara Sharon  * @support_mbssid: can HW support association with nontransmitted AP
4427213ed579SSara Sharon  * @support_only_he_mbssid: don't parse MBSSID elements if it is not
4428213ed579SSara Sharon  *	HE AP, in order to avoid compatibility issues.
4429213ed579SSara Sharon  *	@support_mbssid must be set for this to have any effect.
4430213ed579SSara Sharon  *
44319bb7e0f2SJohannes Berg  * @pmsr_capa: peer measurement capabilities
4432d3236553SJohannes Berg  */
4433d3236553SJohannes Berg struct wiphy {
4434d3236553SJohannes Berg 	/* assign these fields before you register the wiphy */
4435d3236553SJohannes Berg 
4436ef15aac6SJohannes Berg 	/* permanent MAC address(es) */
4437d3236553SJohannes Berg 	u8 perm_addr[ETH_ALEN];
4438ef15aac6SJohannes Berg 	u8 addr_mask[ETH_ALEN];
4439ef15aac6SJohannes Berg 
4440ef15aac6SJohannes Berg 	struct mac_address *addresses;
4441d3236553SJohannes Berg 
44422e161f78SJohannes Berg 	const struct ieee80211_txrx_stypes *mgmt_stypes;
44432e161f78SJohannes Berg 
44447527a782SJohannes Berg 	const struct ieee80211_iface_combination *iface_combinations;
44457527a782SJohannes Berg 	int n_iface_combinations;
44467527a782SJohannes Berg 	u16 software_iftypes;
44477527a782SJohannes Berg 
44482e161f78SJohannes Berg 	u16 n_addresses;
44492e161f78SJohannes Berg 
4450d3236553SJohannes Berg 	/* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
4451d3236553SJohannes Berg 	u16 interface_modes;
4452d3236553SJohannes Berg 
445377765eafSVasanthakumar Thiagarajan 	u16 max_acl_mac_addrs;
445477765eafSVasanthakumar Thiagarajan 
4455a2f73b6cSLuis R. Rodriguez 	u32 flags, regulatory_flags, features;
4456d75bb06bSGautam Kumar Shukla 	u8 ext_features[DIV_ROUND_UP(NUM_NL80211_EXT_FEATURES, 8)];
4457463d0183SJohannes Berg 
4458562a7480SJohannes Berg 	u32 ap_sme_capa;
4459562a7480SJohannes Berg 
4460d3236553SJohannes Berg 	enum cfg80211_signal_type signal_type;
4461d3236553SJohannes Berg 
4462d3236553SJohannes Berg 	int bss_priv_size;
4463d3236553SJohannes Berg 	u8 max_scan_ssids;
4464ca986ad9SArend Van Spriel 	u8 max_sched_scan_reqs;
446593b6aa69SLuciano Coelho 	u8 max_sched_scan_ssids;
4466a1f1c21cSLuciano Coelho 	u8 max_match_sets;
4467d3236553SJohannes Berg 	u16 max_scan_ie_len;
44685a865badSLuciano Coelho 	u16 max_sched_scan_ie_len;
44693b06d277SAvraham Stern 	u32 max_sched_scan_plans;
44703b06d277SAvraham Stern 	u32 max_sched_scan_plan_interval;
44713b06d277SAvraham Stern 	u32 max_sched_scan_plan_iterations;
4472d3236553SJohannes Berg 
4473d3236553SJohannes Berg 	int n_cipher_suites;
4474d3236553SJohannes Berg 	const u32 *cipher_suites;
4475d3236553SJohannes Berg 
4476ab4dfa20SVeerendranath Jakkam 	int n_akm_suites;
4477ab4dfa20SVeerendranath Jakkam 	const u32 *akm_suites;
4478ab4dfa20SVeerendranath Jakkam 
4479b9a5f8caSJouni Malinen 	u8 retry_short;
4480b9a5f8caSJouni Malinen 	u8 retry_long;
4481b9a5f8caSJouni Malinen 	u32 frag_threshold;
4482b9a5f8caSJouni Malinen 	u32 rts_threshold;
448381077e82SLukáš Turek 	u8 coverage_class;
4484b9a5f8caSJouni Malinen 
448581135548SJiri Pirko 	char fw_version[ETHTOOL_FWVERS_LEN];
4486dfce95f5SKalle Valo 	u32 hw_version;
4487dfce95f5SKalle Valo 
4488dfb89c56SJohannes Berg #ifdef CONFIG_PM
4489964dc9e2SJohannes Berg 	const struct wiphy_wowlan_support *wowlan;
44906abb9cb9SJohannes Berg 	struct cfg80211_wowlan *wowlan_config;
4491dfb89c56SJohannes Berg #endif
4492ff1b6e69SJohannes Berg 
4493a293911dSJohannes Berg 	u16 max_remain_on_channel_duration;
4494a293911dSJohannes Berg 
449567fbb16bSSamuel Ortiz 	u8 max_num_pmkids;
449667fbb16bSSamuel Ortiz 
44977f531e03SBruno Randolf 	u32 available_antennas_tx;
44987f531e03SBruno Randolf 	u32 available_antennas_rx;
4499a7ffac95SBruno Randolf 
450087bbbe22SArik Nemtsov 	/*
450187bbbe22SArik Nemtsov 	 * Bitmap of supported protocols for probe response offloading
450287bbbe22SArik Nemtsov 	 * see &enum nl80211_probe_resp_offload_support_attr. Only valid
450387bbbe22SArik Nemtsov 	 * when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set.
450487bbbe22SArik Nemtsov 	 */
450587bbbe22SArik Nemtsov 	u32 probe_resp_offload;
450687bbbe22SArik Nemtsov 
4507a50df0c4SJohannes Berg 	const u8 *extended_capabilities, *extended_capabilities_mask;
4508a50df0c4SJohannes Berg 	u8 extended_capabilities_len;
4509a50df0c4SJohannes Berg 
4510019ae3a9SKanchanapally, Vidyullatha 	const struct wiphy_iftype_ext_capab *iftype_ext_capab;
4511019ae3a9SKanchanapally, Vidyullatha 	unsigned int num_iftype_ext_capab;
4512019ae3a9SKanchanapally, Vidyullatha 
4513d3236553SJohannes Berg 	/* If multiple wiphys are registered and you're handed e.g.
4514d3236553SJohannes Berg 	 * a regular netdev with assigned ieee80211_ptr, you won't
4515d3236553SJohannes Berg 	 * know whether it points to a wiphy your driver has registered
4516d3236553SJohannes Berg 	 * or not. Assign this to something global to your driver to
4517d3236553SJohannes Berg 	 * help determine whether you own this wiphy or not. */
4518cf5aa2f1SDavid Kilroy 	const void *privid;
4519d3236553SJohannes Berg 
452057fbcce3SJohannes Berg 	struct ieee80211_supported_band *bands[NUM_NL80211_BANDS];
4521d3236553SJohannes Berg 
4522d3236553SJohannes Berg 	/* Lets us get back the wiphy on the callback */
45230c0280bdSLuis R. Rodriguez 	void (*reg_notifier)(struct wiphy *wiphy,
4524d3236553SJohannes Berg 			     struct regulatory_request *request);
4525d3236553SJohannes Berg 
4526d3236553SJohannes Berg 	/* fields below are read-only, assigned by cfg80211 */
4527d3236553SJohannes Berg 
4528458f4f9eSJohannes Berg 	const struct ieee80211_regdomain __rcu *regd;
4529d3236553SJohannes Berg 
4530d3236553SJohannes Berg 	/* the item in /sys/class/ieee80211/ points to this,
4531d3236553SJohannes Berg 	 * you need use set_wiphy_dev() (see below) */
4532d3236553SJohannes Berg 	struct device dev;
4533d3236553SJohannes Berg 
4534ecb44335SStanislaw Gruszka 	/* protects ->resume, ->suspend sysfs callbacks against unregister hw */
4535ecb44335SStanislaw Gruszka 	bool registered;
4536ecb44335SStanislaw Gruszka 
4537d3236553SJohannes Berg 	/* dir in debugfs: ieee80211/<wiphyname> */
4538d3236553SJohannes Berg 	struct dentry *debugfsdir;
4539d3236553SJohannes Berg 
45407e7c8926SBen Greear 	const struct ieee80211_ht_cap *ht_capa_mod_mask;
4541ee2aca34SJohannes Berg 	const struct ieee80211_vht_cap *vht_capa_mod_mask;
45427e7c8926SBen Greear 
454353873f13SJohannes Berg 	struct list_head wdev_list;
454453873f13SJohannes Berg 
4545463d0183SJohannes Berg 	/* the network namespace this phy lives in currently */
45460c5c9fb5SEric W. Biederman 	possible_net_t _net;
4547463d0183SJohannes Berg 
45483d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT
45493d23e349SJohannes Berg 	const struct iw_handler_def *wext;
45503d23e349SJohannes Berg #endif
45513d23e349SJohannes Berg 
4552be29b99aSAmitkumar Karwar 	const struct wiphy_coalesce_support *coalesce;
4553be29b99aSAmitkumar Karwar 
4554ad7e718cSJohannes Berg 	const struct wiphy_vendor_command *vendor_commands;
4555567ffc35SJohannes Berg 	const struct nl80211_vendor_cmd_info *vendor_events;
4556567ffc35SJohannes Berg 	int n_vendor_commands, n_vendor_events;
4557ad7e718cSJohannes Berg 
4558b43504cfSJouni Malinen 	u16 max_ap_assoc_sta;
4559b43504cfSJouni Malinen 
45609a774c78SAndrei Otcheretianski 	u8 max_num_csa_counters;
456167af9811SEmmanuel Grumbach 	u8 max_adj_channel_rssi_comp;
45629a774c78SAndrei Otcheretianski 
456338de03d2SArend van Spriel 	u32 bss_select_support;
456438de03d2SArend van Spriel 
45658585989dSLuca Coelho 	u8 nan_supported_bands;
45668585989dSLuca Coelho 
456752539ca8SToke Høiland-Jørgensen 	u32 txq_limit;
456852539ca8SToke Høiland-Jørgensen 	u32 txq_memory_limit;
456952539ca8SToke Høiland-Jørgensen 	u32 txq_quantum;
457052539ca8SToke Høiland-Jørgensen 
4571213ed579SSara Sharon 	u8 support_mbssid:1,
4572213ed579SSara Sharon 	   support_only_he_mbssid:1;
4573213ed579SSara Sharon 
45749bb7e0f2SJohannes Berg 	const struct cfg80211_pmsr_capabilities *pmsr_capa;
45759bb7e0f2SJohannes Berg 
45761c06ef98SJohannes Berg 	char priv[0] __aligned(NETDEV_ALIGN);
4577d3236553SJohannes Berg };
4578d3236553SJohannes Berg 
4579463d0183SJohannes Berg static inline struct net *wiphy_net(struct wiphy *wiphy)
4580463d0183SJohannes Berg {
4581c2d9ba9bSEric Dumazet 	return read_pnet(&wiphy->_net);
4582463d0183SJohannes Berg }
4583463d0183SJohannes Berg 
4584463d0183SJohannes Berg static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net)
4585463d0183SJohannes Berg {
4586c2d9ba9bSEric Dumazet 	write_pnet(&wiphy->_net, net);
4587463d0183SJohannes Berg }
4588463d0183SJohannes Berg 
4589d3236553SJohannes Berg /**
4590d3236553SJohannes Berg  * wiphy_priv - return priv from wiphy
4591d3236553SJohannes Berg  *
4592d3236553SJohannes Berg  * @wiphy: the wiphy whose priv pointer to return
45930ae997dcSYacine Belkadi  * Return: The priv of @wiphy.
4594d3236553SJohannes Berg  */
4595d3236553SJohannes Berg static inline void *wiphy_priv(struct wiphy *wiphy)
4596d3236553SJohannes Berg {
4597d3236553SJohannes Berg 	BUG_ON(!wiphy);
4598d3236553SJohannes Berg 	return &wiphy->priv;
4599d3236553SJohannes Berg }
4600d3236553SJohannes Berg 
4601d3236553SJohannes Berg /**
4602f1f74825SDavid Kilroy  * priv_to_wiphy - return the wiphy containing the priv
4603f1f74825SDavid Kilroy  *
4604f1f74825SDavid Kilroy  * @priv: a pointer previously returned by wiphy_priv
46050ae997dcSYacine Belkadi  * Return: The wiphy of @priv.
4606f1f74825SDavid Kilroy  */
4607f1f74825SDavid Kilroy static inline struct wiphy *priv_to_wiphy(void *priv)
4608f1f74825SDavid Kilroy {
4609f1f74825SDavid Kilroy 	BUG_ON(!priv);
4610f1f74825SDavid Kilroy 	return container_of(priv, struct wiphy, priv);
4611f1f74825SDavid Kilroy }
4612f1f74825SDavid Kilroy 
4613f1f74825SDavid Kilroy /**
4614d3236553SJohannes Berg  * set_wiphy_dev - set device pointer for wiphy
4615d3236553SJohannes Berg  *
4616d3236553SJohannes Berg  * @wiphy: The wiphy whose device to bind
4617d3236553SJohannes Berg  * @dev: The device to parent it to
4618d3236553SJohannes Berg  */
4619d3236553SJohannes Berg static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev)
4620d3236553SJohannes Berg {
4621d3236553SJohannes Berg 	wiphy->dev.parent = dev;
4622d3236553SJohannes Berg }
4623d3236553SJohannes Berg 
4624d3236553SJohannes Berg /**
4625d3236553SJohannes Berg  * wiphy_dev - get wiphy dev pointer
4626d3236553SJohannes Berg  *
4627d3236553SJohannes Berg  * @wiphy: The wiphy whose device struct to look up
46280ae997dcSYacine Belkadi  * Return: The dev of @wiphy.
4629d3236553SJohannes Berg  */
4630d3236553SJohannes Berg static inline struct device *wiphy_dev(struct wiphy *wiphy)
4631d3236553SJohannes Berg {
4632d3236553SJohannes Berg 	return wiphy->dev.parent;
4633d3236553SJohannes Berg }
4634d3236553SJohannes Berg 
4635d3236553SJohannes Berg /**
4636d3236553SJohannes Berg  * wiphy_name - get wiphy name
4637d3236553SJohannes Berg  *
4638d3236553SJohannes Berg  * @wiphy: The wiphy whose name to return
46390ae997dcSYacine Belkadi  * Return: The name of @wiphy.
4640d3236553SJohannes Berg  */
4641e1db74fcSJoe Perches static inline const char *wiphy_name(const struct wiphy *wiphy)
4642d3236553SJohannes Berg {
4643d3236553SJohannes Berg 	return dev_name(&wiphy->dev);
4644d3236553SJohannes Berg }
4645d3236553SJohannes Berg 
4646d3236553SJohannes Berg /**
46471998d90aSBen Greear  * wiphy_new_nm - create a new wiphy for use with cfg80211
46481998d90aSBen Greear  *
46491998d90aSBen Greear  * @ops: The configuration operations for this device
46501998d90aSBen Greear  * @sizeof_priv: The size of the private area to allocate
46511998d90aSBen Greear  * @requested_name: Request a particular name.
46521998d90aSBen Greear  *	NULL is valid value, and means use the default phy%d naming.
46531998d90aSBen Greear  *
46541998d90aSBen Greear  * Create a new wiphy and associate the given operations with it.
46551998d90aSBen Greear  * @sizeof_priv bytes are allocated for private use.
46561998d90aSBen Greear  *
46571998d90aSBen Greear  * Return: A pointer to the new wiphy. This pointer must be
46581998d90aSBen Greear  * assigned to each netdev's ieee80211_ptr for proper operation.
46591998d90aSBen Greear  */
46601998d90aSBen Greear struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv,
46611998d90aSBen Greear 			   const char *requested_name);
46621998d90aSBen Greear 
46631998d90aSBen Greear /**
4664d3236553SJohannes Berg  * wiphy_new - create a new wiphy for use with cfg80211
4665d3236553SJohannes Berg  *
4666d3236553SJohannes Berg  * @ops: The configuration operations for this device
4667d3236553SJohannes Berg  * @sizeof_priv: The size of the private area to allocate
4668d3236553SJohannes Berg  *
4669d3236553SJohannes Berg  * Create a new wiphy and associate the given operations with it.
4670d3236553SJohannes Berg  * @sizeof_priv bytes are allocated for private use.
4671d3236553SJohannes Berg  *
46720ae997dcSYacine Belkadi  * Return: A pointer to the new wiphy. This pointer must be
46730ae997dcSYacine Belkadi  * assigned to each netdev's ieee80211_ptr for proper operation.
4674d3236553SJohannes Berg  */
46751998d90aSBen Greear static inline struct wiphy *wiphy_new(const struct cfg80211_ops *ops,
46761998d90aSBen Greear 				      int sizeof_priv)
46771998d90aSBen Greear {
46781998d90aSBen Greear 	return wiphy_new_nm(ops, sizeof_priv, NULL);
46791998d90aSBen Greear }
4680d3236553SJohannes Berg 
4681d3236553SJohannes Berg /**
4682d3236553SJohannes Berg  * wiphy_register - register a wiphy with cfg80211
4683d3236553SJohannes Berg  *
4684d3236553SJohannes Berg  * @wiphy: The wiphy to register.
4685d3236553SJohannes Berg  *
46860ae997dcSYacine Belkadi  * Return: A non-negative wiphy index or a negative error code.
4687d3236553SJohannes Berg  */
468810dd9b7cSJoe Perches int wiphy_register(struct wiphy *wiphy);
4689d3236553SJohannes Berg 
4690d3236553SJohannes Berg /**
4691d3236553SJohannes Berg  * wiphy_unregister - deregister a wiphy from cfg80211
4692d3236553SJohannes Berg  *
4693d3236553SJohannes Berg  * @wiphy: The wiphy to unregister.
4694d3236553SJohannes Berg  *
4695d3236553SJohannes Berg  * After this call, no more requests can be made with this priv
4696d3236553SJohannes Berg  * pointer, but the call may sleep to wait for an outstanding
4697d3236553SJohannes Berg  * request that is being handled.
4698d3236553SJohannes Berg  */
469910dd9b7cSJoe Perches void wiphy_unregister(struct wiphy *wiphy);
4700d3236553SJohannes Berg 
4701d3236553SJohannes Berg /**
4702d3236553SJohannes Berg  * wiphy_free - free wiphy
4703d3236553SJohannes Berg  *
4704d3236553SJohannes Berg  * @wiphy: The wiphy to free
4705d3236553SJohannes Berg  */
470610dd9b7cSJoe Perches void wiphy_free(struct wiphy *wiphy);
4707d3236553SJohannes Berg 
4708fffd0934SJohannes Berg /* internal structs */
47096829c878SJohannes Berg struct cfg80211_conn;
471019957bb3SJohannes Berg struct cfg80211_internal_bss;
4711fffd0934SJohannes Berg struct cfg80211_cached_keys;
47124a4b8169SAndrew Zaborowski struct cfg80211_cqm_config;
471319957bb3SJohannes Berg 
4714d3236553SJohannes Berg /**
471589a54e48SJohannes Berg  * struct wireless_dev - wireless device state
4716d3236553SJohannes Berg  *
471789a54e48SJohannes Berg  * For netdevs, this structure must be allocated by the driver
471889a54e48SJohannes Berg  * that uses the ieee80211_ptr field in struct net_device (this
471989a54e48SJohannes Berg  * is intentional so it can be allocated along with the netdev.)
472089a54e48SJohannes Berg  * It need not be registered then as netdev registration will
472189a54e48SJohannes Berg  * be intercepted by cfg80211 to see the new wireless device.
472289a54e48SJohannes Berg  *
472389a54e48SJohannes Berg  * For non-netdev uses, it must also be allocated by the driver
472489a54e48SJohannes Berg  * in response to the cfg80211 callbacks that require it, as
472589a54e48SJohannes Berg  * there's no netdev registration in that case it may not be
472689a54e48SJohannes Berg  * allocated outside of callback operations that return it.
4727d3236553SJohannes Berg  *
4728d3236553SJohannes Berg  * @wiphy: pointer to hardware description
4729d3236553SJohannes Berg  * @iftype: interface type
4730d3236553SJohannes Berg  * @list: (private) Used to collect the interfaces
473189a54e48SJohannes Berg  * @netdev: (private) Used to reference back to the netdev, may be %NULL
473289a54e48SJohannes Berg  * @identifier: (private) Identifier used in nl80211 to identify this
473389a54e48SJohannes Berg  *	wireless device if it has no netdev
4734d3236553SJohannes Berg  * @current_bss: (private) Used by the internal configuration code
47359e0e2961SMichal Kazior  * @chandef: (private) Used by the internal configuration code to track
47369e0e2961SMichal Kazior  *	the user-set channel definition.
4737780b40dfSJohannes Berg  * @preset_chandef: (private) Used by the internal configuration code to
4738aa430da4SJohannes Berg  *	track the channel to be used for AP later
4739d3236553SJohannes Berg  * @bssid: (private) Used by the internal configuration code
4740d3236553SJohannes Berg  * @ssid: (private) Used by the internal configuration code
4741d3236553SJohannes Berg  * @ssid_len: (private) Used by the internal configuration code
474229cbe68cSJohannes Berg  * @mesh_id_len: (private) Used by the internal configuration code
474329cbe68cSJohannes Berg  * @mesh_id_up_len: (private) Used by the internal configuration code
4744d3236553SJohannes Berg  * @wext: (private) Used by the internal wireless extensions compat code
47459874b71fSJohannes Berg  * @wext.ibss: (private) IBSS data part of wext handling
47469874b71fSJohannes Berg  * @wext.connect: (private) connection handling data
47479874b71fSJohannes Berg  * @wext.keys: (private) (WEP) key data
47489874b71fSJohannes Berg  * @wext.ie: (private) extra elements for association
47499874b71fSJohannes Berg  * @wext.ie_len: (private) length of extra elements
47509874b71fSJohannes Berg  * @wext.bssid: (private) selected network BSSID
47519874b71fSJohannes Berg  * @wext.ssid: (private) selected network SSID
47529874b71fSJohannes Berg  * @wext.default_key: (private) selected default key index
47539874b71fSJohannes Berg  * @wext.default_mgmt_key: (private) selected default management key index
47549874b71fSJohannes Berg  * @wext.prev_bssid: (private) previous BSSID for reassociation
47559874b71fSJohannes Berg  * @wext.prev_bssid_valid: (private) previous BSSID validity
47569bc383deSJohannes Berg  * @use_4addr: indicates 4addr mode is used on this interface, must be
47579bc383deSJohannes Berg  *	set by driver (if supported) on add_interface BEFORE registering the
47589bc383deSJohannes Berg  *	netdev and may otherwise be used by driver read-only, will be update
47599bc383deSJohannes Berg  *	by cfg80211 on change_interface
47602e161f78SJohannes Berg  * @mgmt_registrations: list of registrations for management frames
47612e161f78SJohannes Berg  * @mgmt_registrations_lock: lock for the list
47628d61ffa5SJohannes Berg  * @mtx: mutex used to lock data in this struct, may be used by drivers
47638d61ffa5SJohannes Berg  *	and some API functions require it held
476456d1893dSJohannes Berg  * @beacon_interval: beacon interval used on this device for transmitting
476556d1893dSJohannes Berg  *	beacons, 0 when not valid
476698104fdeSJohannes Berg  * @address: The address for this device, valid only if @netdev is %NULL
476773c7da3dSArend Van Spriel  * @is_running: true if this is a non-netdev device that has been started, e.g.
476873c7da3dSArend Van Spriel  *	the P2P Device.
476904f39047SSimon Wunderlich  * @cac_started: true if DFS channel availability check has been started
477004f39047SSimon Wunderlich  * @cac_start_time: timestamp (jiffies) when the dfs state was entered.
477131559f35SJanusz Dziedzic  * @cac_time_ms: CAC time in ms
4772780b40dfSJohannes Berg  * @ps: powersave mode is enabled
4773780b40dfSJohannes Berg  * @ps_timeout: dynamic powersave timeout
4774780b40dfSJohannes Berg  * @ap_unexpected_nlportid: (private) netlink port ID of application
4775780b40dfSJohannes Berg  *	registered for unexpected class 3 frames (AP mode)
4776780b40dfSJohannes Berg  * @conn: (private) cfg80211 software SME connection state machine data
4777780b40dfSJohannes Berg  * @connect_keys: (private) keys to set after connection is established
477834d50519SLior David  * @conn_bss_type: connecting/connected BSS type
4779bd2522b1SAndrzej Zaborowski  * @conn_owner_nlportid: (private) connection owner socket port ID
4780bd2522b1SAndrzej Zaborowski  * @disconnect_wk: (private) auto-disconnect work
4781bd2522b1SAndrzej Zaborowski  * @disconnect_bssid: (private) the BSSID to use for auto-disconnect
4782780b40dfSJohannes Berg  * @ibss_fixed: (private) IBSS is using fixed BSSID
47835336fa88SSimon Wunderlich  * @ibss_dfs_possible: (private) IBSS may change to a DFS channel
4784780b40dfSJohannes Berg  * @event_list: (private) list for internal event processing
4785780b40dfSJohannes Berg  * @event_lock: (private) lock for event list
478678f22b6aSJohannes Berg  * @owner_nlportid: (private) owner socket port ID
4787ab81007aSJohannes Berg  * @nl_owner_dead: (private) owner socket went away
47884a4b8169SAndrew Zaborowski  * @cqm_config: (private) nl80211 RSSI monitor state
47899bb7e0f2SJohannes Berg  * @pmsr_list: (private) peer measurement requests
47909bb7e0f2SJohannes Berg  * @pmsr_lock: (private) peer measurements requests/results lock
47919bb7e0f2SJohannes Berg  * @pmsr_free_wk: (private) peer measurements cleanup work
4792d3236553SJohannes Berg  */
4793d3236553SJohannes Berg struct wireless_dev {
4794d3236553SJohannes Berg 	struct wiphy *wiphy;
4795d3236553SJohannes Berg 	enum nl80211_iftype iftype;
4796d3236553SJohannes Berg 
4797667503ddSJohannes Berg 	/* the remainder of this struct should be private to cfg80211 */
4798d3236553SJohannes Berg 	struct list_head list;
4799d3236553SJohannes Berg 	struct net_device *netdev;
4800d3236553SJohannes Berg 
480189a54e48SJohannes Berg 	u32 identifier;
480289a54e48SJohannes Berg 
48032e161f78SJohannes Berg 	struct list_head mgmt_registrations;
48042e161f78SJohannes Berg 	spinlock_t mgmt_registrations_lock;
4805026331c4SJouni Malinen 
4806667503ddSJohannes Berg 	struct mutex mtx;
4807667503ddSJohannes Berg 
480873c7da3dSArend Van Spriel 	bool use_4addr, is_running;
480998104fdeSJohannes Berg 
481098104fdeSJohannes Berg 	u8 address[ETH_ALEN] __aligned(sizeof(u16));
48119bc383deSJohannes Berg 
4812b23aa676SSamuel Ortiz 	/* currently used for IBSS and SME - might be rearranged later */
4813d3236553SJohannes Berg 	u8 ssid[IEEE80211_MAX_SSID_LEN];
481429cbe68cSJohannes Berg 	u8 ssid_len, mesh_id_len, mesh_id_up_len;
48156829c878SJohannes Berg 	struct cfg80211_conn *conn;
4816fffd0934SJohannes Berg 	struct cfg80211_cached_keys *connect_keys;
481734d50519SLior David 	enum ieee80211_bss_type conn_bss_type;
4818bd2522b1SAndrzej Zaborowski 	u32 conn_owner_nlportid;
4819bd2522b1SAndrzej Zaborowski 
4820bd2522b1SAndrzej Zaborowski 	struct work_struct disconnect_wk;
4821bd2522b1SAndrzej Zaborowski 	u8 disconnect_bssid[ETH_ALEN];
4822d3236553SJohannes Berg 
4823667503ddSJohannes Berg 	struct list_head event_list;
4824667503ddSJohannes Berg 	spinlock_t event_lock;
4825667503ddSJohannes Berg 
482619957bb3SJohannes Berg 	struct cfg80211_internal_bss *current_bss; /* associated / joined */
4827683b6d3bSJohannes Berg 	struct cfg80211_chan_def preset_chandef;
48289e0e2961SMichal Kazior 	struct cfg80211_chan_def chandef;
4829f4489ebeSMichal Kazior 
4830c30a3d38SMichal Kazior 	bool ibss_fixed;
48315336fa88SSimon Wunderlich 	bool ibss_dfs_possible;
4832c30a3d38SMichal Kazior 
4833ffb9eb3dSKalle Valo 	bool ps;
4834ffb9eb3dSKalle Valo 	int ps_timeout;
4835ffb9eb3dSKalle Valo 
483656d1893dSJohannes Berg 	int beacon_interval;
483756d1893dSJohannes Berg 
483815e47304SEric W. Biederman 	u32 ap_unexpected_nlportid;
483928946da7SJohannes Berg 
4840ab81007aSJohannes Berg 	u32 owner_nlportid;
4841ab81007aSJohannes Berg 	bool nl_owner_dead;
4842ab81007aSJohannes Berg 
484304f39047SSimon Wunderlich 	bool cac_started;
484404f39047SSimon Wunderlich 	unsigned long cac_start_time;
484531559f35SJanusz Dziedzic 	unsigned int cac_time_ms;
484604f39047SSimon Wunderlich 
48473d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT
4848d3236553SJohannes Berg 	/* wext data */
4849cbe8fa9cSJohannes Berg 	struct {
4850cbe8fa9cSJohannes Berg 		struct cfg80211_ibss_params ibss;
4851f2129354SJohannes Berg 		struct cfg80211_connect_params connect;
4852fffd0934SJohannes Berg 		struct cfg80211_cached_keys *keys;
4853c1e5f471SJohannes Berg 		const u8 *ie;
4854f2129354SJohannes Berg 		size_t ie_len;
48559874b71fSJohannes Berg 		u8 bssid[ETH_ALEN];
48569874b71fSJohannes Berg 		u8 prev_bssid[ETH_ALEN];
4857f2129354SJohannes Berg 		u8 ssid[IEEE80211_MAX_SSID_LEN];
485808645126SJohannes Berg 		s8 default_key, default_mgmt_key;
4859ffb9eb3dSKalle Valo 		bool prev_bssid_valid;
4860cbe8fa9cSJohannes Berg 	} wext;
4861d3236553SJohannes Berg #endif
48624a4b8169SAndrew Zaborowski 
48634a4b8169SAndrew Zaborowski 	struct cfg80211_cqm_config *cqm_config;
48649bb7e0f2SJohannes Berg 
48659bb7e0f2SJohannes Berg 	struct list_head pmsr_list;
48669bb7e0f2SJohannes Berg 	spinlock_t pmsr_lock;
48679bb7e0f2SJohannes Berg 	struct work_struct pmsr_free_wk;
4868d3236553SJohannes Berg };
4869d3236553SJohannes Berg 
487098104fdeSJohannes Berg static inline u8 *wdev_address(struct wireless_dev *wdev)
487198104fdeSJohannes Berg {
487298104fdeSJohannes Berg 	if (wdev->netdev)
487398104fdeSJohannes Berg 		return wdev->netdev->dev_addr;
487498104fdeSJohannes Berg 	return wdev->address;
487598104fdeSJohannes Berg }
487698104fdeSJohannes Berg 
487773c7da3dSArend Van Spriel static inline bool wdev_running(struct wireless_dev *wdev)
487873c7da3dSArend Van Spriel {
487973c7da3dSArend Van Spriel 	if (wdev->netdev)
488073c7da3dSArend Van Spriel 		return netif_running(wdev->netdev);
488173c7da3dSArend Van Spriel 	return wdev->is_running;
488273c7da3dSArend Van Spriel }
488373c7da3dSArend Van Spriel 
4884d3236553SJohannes Berg /**
4885d3236553SJohannes Berg  * wdev_priv - return wiphy priv from wireless_dev
4886d3236553SJohannes Berg  *
4887d3236553SJohannes Berg  * @wdev: The wireless device whose wiphy's priv pointer to return
48880ae997dcSYacine Belkadi  * Return: The wiphy priv of @wdev.
4889d3236553SJohannes Berg  */
4890d3236553SJohannes Berg static inline void *wdev_priv(struct wireless_dev *wdev)
4891d3236553SJohannes Berg {
4892d3236553SJohannes Berg 	BUG_ON(!wdev);
4893d3236553SJohannes Berg 	return wiphy_priv(wdev->wiphy);
4894d3236553SJohannes Berg }
4895d3236553SJohannes Berg 
4896d70e9693SJohannes Berg /**
4897d70e9693SJohannes Berg  * DOC: Utility functions
4898d70e9693SJohannes Berg  *
4899d70e9693SJohannes Berg  * cfg80211 offers a number of utility functions that can be useful.
4900d3236553SJohannes Berg  */
4901d3236553SJohannes Berg 
4902d3236553SJohannes Berg /**
4903d3236553SJohannes Berg  * ieee80211_channel_to_frequency - convert channel number to frequency
4904abe37c4bSJohannes Berg  * @chan: channel number
490559eb21a6SBruno Randolf  * @band: band, necessary due to channel number overlap
49060ae997dcSYacine Belkadi  * Return: The corresponding frequency (in MHz), or 0 if the conversion failed.
4907d3236553SJohannes Berg  */
490857fbcce3SJohannes Berg int ieee80211_channel_to_frequency(int chan, enum nl80211_band band);
4909d3236553SJohannes Berg 
4910d3236553SJohannes Berg /**
4911d3236553SJohannes Berg  * ieee80211_frequency_to_channel - convert frequency to channel number
4912abe37c4bSJohannes Berg  * @freq: center frequency
49130ae997dcSYacine Belkadi  * Return: The corresponding channel, or 0 if the conversion failed.
4914d3236553SJohannes Berg  */
491510dd9b7cSJoe Perches int ieee80211_frequency_to_channel(int freq);
4916d3236553SJohannes Berg 
4917d3236553SJohannes Berg /**
4918d3236553SJohannes Berg  * ieee80211_get_channel - get channel struct from wiphy for specified frequency
4919543b921bSArend Van Spriel  *
4920abe37c4bSJohannes Berg  * @wiphy: the struct wiphy to get the channel for
4921abe37c4bSJohannes Berg  * @freq: the center frequency of the channel
4922543b921bSArend Van Spriel  *
49230ae997dcSYacine Belkadi  * Return: The channel struct from @wiphy at @freq.
4924d3236553SJohannes Berg  */
4925543b921bSArend Van Spriel struct ieee80211_channel *ieee80211_get_channel(struct wiphy *wiphy, int freq);
4926d3236553SJohannes Berg 
4927d3236553SJohannes Berg /**
4928d3236553SJohannes Berg  * ieee80211_get_response_rate - get basic rate for a given rate
4929d3236553SJohannes Berg  *
4930d3236553SJohannes Berg  * @sband: the band to look for rates in
4931d3236553SJohannes Berg  * @basic_rates: bitmap of basic rates
4932d3236553SJohannes Berg  * @bitrate: the bitrate for which to find the basic rate
4933d3236553SJohannes Berg  *
49340ae997dcSYacine Belkadi  * Return: The basic rate corresponding to a given bitrate, that
49350ae997dcSYacine Belkadi  * is the next lower bitrate contained in the basic rate map,
49360ae997dcSYacine Belkadi  * which is, for this function, given as a bitmap of indices of
49370ae997dcSYacine Belkadi  * rates in the band's bitrate table.
4938d3236553SJohannes Berg  */
4939d3236553SJohannes Berg struct ieee80211_rate *
4940d3236553SJohannes Berg ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
4941d3236553SJohannes Berg 			    u32 basic_rates, int bitrate);
4942d3236553SJohannes Berg 
4943b422c6cdSAshok Nagarajan /**
4944b422c6cdSAshok Nagarajan  * ieee80211_mandatory_rates - get mandatory rates for a given band
4945b422c6cdSAshok Nagarajan  * @sband: the band to look for rates in
494674608acaSSimon Wunderlich  * @scan_width: width of the control channel
4947b422c6cdSAshok Nagarajan  *
4948b422c6cdSAshok Nagarajan  * This function returns a bitmap of the mandatory rates for the given
4949b422c6cdSAshok Nagarajan  * band, bits are set according to the rate position in the bitrates array.
4950b422c6cdSAshok Nagarajan  */
495174608acaSSimon Wunderlich u32 ieee80211_mandatory_rates(struct ieee80211_supported_band *sband,
495274608acaSSimon Wunderlich 			      enum nl80211_bss_scan_width scan_width);
4953b422c6cdSAshok Nagarajan 
4954d3236553SJohannes Berg /*
4955d3236553SJohannes Berg  * Radiotap parsing functions -- for controlled injection support
4956d3236553SJohannes Berg  *
4957d3236553SJohannes Berg  * Implemented in net/wireless/radiotap.c
4958d3236553SJohannes Berg  * Documentation in Documentation/networking/radiotap-headers.txt
4959d3236553SJohannes Berg  */
4960d3236553SJohannes Berg 
496133e5a2f7SJohannes Berg struct radiotap_align_size {
496233e5a2f7SJohannes Berg 	uint8_t align:4, size:4;
496333e5a2f7SJohannes Berg };
496433e5a2f7SJohannes Berg 
496533e5a2f7SJohannes Berg struct ieee80211_radiotap_namespace {
496633e5a2f7SJohannes Berg 	const struct radiotap_align_size *align_size;
496733e5a2f7SJohannes Berg 	int n_bits;
496833e5a2f7SJohannes Berg 	uint32_t oui;
496933e5a2f7SJohannes Berg 	uint8_t subns;
497033e5a2f7SJohannes Berg };
497133e5a2f7SJohannes Berg 
497233e5a2f7SJohannes Berg struct ieee80211_radiotap_vendor_namespaces {
497333e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_namespace *ns;
497433e5a2f7SJohannes Berg 	int n_ns;
497533e5a2f7SJohannes Berg };
497633e5a2f7SJohannes Berg 
4977d3236553SJohannes Berg /**
4978d3236553SJohannes Berg  * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args
497933e5a2f7SJohannes Berg  * @this_arg_index: index of current arg, valid after each successful call
498033e5a2f7SJohannes Berg  *	to ieee80211_radiotap_iterator_next()
498133e5a2f7SJohannes Berg  * @this_arg: pointer to current radiotap arg; it is valid after each
498233e5a2f7SJohannes Berg  *	call to ieee80211_radiotap_iterator_next() but also after
498333e5a2f7SJohannes Berg  *	ieee80211_radiotap_iterator_init() where it will point to
498433e5a2f7SJohannes Berg  *	the beginning of the actual data portion
498533e5a2f7SJohannes Berg  * @this_arg_size: length of the current arg, for convenience
498633e5a2f7SJohannes Berg  * @current_namespace: pointer to the current namespace definition
498733e5a2f7SJohannes Berg  *	(or internally %NULL if the current namespace is unknown)
498833e5a2f7SJohannes Berg  * @is_radiotap_ns: indicates whether the current namespace is the default
498933e5a2f7SJohannes Berg  *	radiotap namespace or not
499033e5a2f7SJohannes Berg  *
499133e5a2f7SJohannes Berg  * @_rtheader: pointer to the radiotap header we are walking through
499233e5a2f7SJohannes Berg  * @_max_length: length of radiotap header in cpu byte ordering
499333e5a2f7SJohannes Berg  * @_arg_index: next argument index
499433e5a2f7SJohannes Berg  * @_arg: next argument pointer
499533e5a2f7SJohannes Berg  * @_next_bitmap: internal pointer to next present u32
499633e5a2f7SJohannes Berg  * @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present
499733e5a2f7SJohannes Berg  * @_vns: vendor namespace definitions
499833e5a2f7SJohannes Berg  * @_next_ns_data: beginning of the next namespace's data
499933e5a2f7SJohannes Berg  * @_reset_on_ext: internal; reset the arg index to 0 when going to the
500033e5a2f7SJohannes Berg  *	next bitmap word
500133e5a2f7SJohannes Berg  *
500233e5a2f7SJohannes Berg  * Describes the radiotap parser state. Fields prefixed with an underscore
500333e5a2f7SJohannes Berg  * must not be used by users of the parser, only by the parser internally.
5004d3236553SJohannes Berg  */
5005d3236553SJohannes Berg 
5006d3236553SJohannes Berg struct ieee80211_radiotap_iterator {
500733e5a2f7SJohannes Berg 	struct ieee80211_radiotap_header *_rtheader;
500833e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_vendor_namespaces *_vns;
500933e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_namespace *current_namespace;
5010d3236553SJohannes Berg 
501133e5a2f7SJohannes Berg 	unsigned char *_arg, *_next_ns_data;
501267272440SJohannes Berg 	__le32 *_next_bitmap;
501333e5a2f7SJohannes Berg 
501433e5a2f7SJohannes Berg 	unsigned char *this_arg;
501533e5a2f7SJohannes Berg 	int this_arg_index;
501633e5a2f7SJohannes Berg 	int this_arg_size;
501733e5a2f7SJohannes Berg 
501833e5a2f7SJohannes Berg 	int is_radiotap_ns;
501933e5a2f7SJohannes Berg 
502033e5a2f7SJohannes Berg 	int _max_length;
502133e5a2f7SJohannes Berg 	int _arg_index;
502233e5a2f7SJohannes Berg 	uint32_t _bitmap_shifter;
502333e5a2f7SJohannes Berg 	int _reset_on_ext;
5024d3236553SJohannes Berg };
5025d3236553SJohannes Berg 
502610dd9b7cSJoe Perches int
502710dd9b7cSJoe Perches ieee80211_radiotap_iterator_init(struct ieee80211_radiotap_iterator *iterator,
5028d3236553SJohannes Berg 				 struct ieee80211_radiotap_header *radiotap_header,
502910dd9b7cSJoe Perches 				 int max_length,
503010dd9b7cSJoe Perches 				 const struct ieee80211_radiotap_vendor_namespaces *vns);
5031d3236553SJohannes Berg 
503210dd9b7cSJoe Perches int
503310dd9b7cSJoe Perches ieee80211_radiotap_iterator_next(struct ieee80211_radiotap_iterator *iterator);
5034d3236553SJohannes Berg 
503533e5a2f7SJohannes Berg 
5036e31a16d6SZhu Yi extern const unsigned char rfc1042_header[6];
5037e31a16d6SZhu Yi extern const unsigned char bridge_tunnel_header[6];
5038e31a16d6SZhu Yi 
5039e31a16d6SZhu Yi /**
5040e31a16d6SZhu Yi  * ieee80211_get_hdrlen_from_skb - get header length from data
5041e31a16d6SZhu Yi  *
5042e31a16d6SZhu Yi  * @skb: the frame
50430ae997dcSYacine Belkadi  *
50440ae997dcSYacine Belkadi  * Given an skb with a raw 802.11 header at the data pointer this function
50450ae997dcSYacine Belkadi  * returns the 802.11 header length.
50460ae997dcSYacine Belkadi  *
50470ae997dcSYacine Belkadi  * Return: The 802.11 header length in bytes (not including encryption
50480ae997dcSYacine Belkadi  * headers). Or 0 if the data in the sk_buff is too short to contain a valid
50490ae997dcSYacine Belkadi  * 802.11 header.
5050e31a16d6SZhu Yi  */
5051e31a16d6SZhu Yi unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb);
5052e31a16d6SZhu Yi 
5053e31a16d6SZhu Yi /**
5054e31a16d6SZhu Yi  * ieee80211_hdrlen - get header length in bytes from frame control
5055e31a16d6SZhu Yi  * @fc: frame control field in little-endian format
50560ae997dcSYacine Belkadi  * Return: The header length in bytes.
5057e31a16d6SZhu Yi  */
5058633adf1aSJohannes Berg unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc);
5059e31a16d6SZhu Yi 
5060e31a16d6SZhu Yi /**
50619b395bc3SJohannes Berg  * ieee80211_get_mesh_hdrlen - get mesh extension header length
50629b395bc3SJohannes Berg  * @meshhdr: the mesh extension header, only the flags field
50639b395bc3SJohannes Berg  *	(first byte) will be accessed
50640ae997dcSYacine Belkadi  * Return: The length of the extension header, which is always at
50659b395bc3SJohannes Berg  * least 6 bytes and at most 18 if address 5 and 6 are present.
50669b395bc3SJohannes Berg  */
50679b395bc3SJohannes Berg unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr);
50689b395bc3SJohannes Berg 
50699b395bc3SJohannes Berg /**
5070d70e9693SJohannes Berg  * DOC: Data path helpers
5071d70e9693SJohannes Berg  *
5072d70e9693SJohannes Berg  * In addition to generic utilities, cfg80211 also offers
5073d70e9693SJohannes Berg  * functions that help implement the data path for devices
5074d70e9693SJohannes Berg  * that do not do the 802.11/802.3 conversion on the device.
5075d70e9693SJohannes Berg  */
5076d70e9693SJohannes Berg 
5077d70e9693SJohannes Berg /**
50787f6990c8SJohannes Berg  * ieee80211_data_to_8023_exthdr - convert an 802.11 data frame to 802.3
50797f6990c8SJohannes Berg  * @skb: the 802.11 data frame
50807f6990c8SJohannes Berg  * @ehdr: pointer to a &struct ethhdr that will get the header, instead
50817f6990c8SJohannes Berg  *	of it being pushed into the SKB
50827f6990c8SJohannes Berg  * @addr: the device MAC address
50837f6990c8SJohannes Berg  * @iftype: the virtual interface type
508424bba078SFelix Fietkau  * @data_offset: offset of payload after the 802.11 header
50857f6990c8SJohannes Berg  * Return: 0 on success. Non-zero on error.
50867f6990c8SJohannes Berg  */
50877f6990c8SJohannes Berg int ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr,
508824bba078SFelix Fietkau 				  const u8 *addr, enum nl80211_iftype iftype,
508924bba078SFelix Fietkau 				  u8 data_offset);
50907f6990c8SJohannes Berg 
50917f6990c8SJohannes Berg /**
5092e31a16d6SZhu Yi  * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3
5093e31a16d6SZhu Yi  * @skb: the 802.11 data frame
5094e31a16d6SZhu Yi  * @addr: the device MAC address
5095e31a16d6SZhu Yi  * @iftype: the virtual interface type
50960ae997dcSYacine Belkadi  * Return: 0 on success. Non-zero on error.
5097e31a16d6SZhu Yi  */
50987f6990c8SJohannes Berg static inline int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
50997f6990c8SJohannes Berg 					 enum nl80211_iftype iftype)
51007f6990c8SJohannes Berg {
510124bba078SFelix Fietkau 	return ieee80211_data_to_8023_exthdr(skb, NULL, addr, iftype, 0);
51027f6990c8SJohannes Berg }
5103e31a16d6SZhu Yi 
5104e31a16d6SZhu Yi /**
5105eaf85ca7SZhu Yi  * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame
5106eaf85ca7SZhu Yi  *
51077f6990c8SJohannes Berg  * Decode an IEEE 802.11 A-MSDU and convert it to a list of 802.3 frames.
51087f6990c8SJohannes Berg  * The @list will be empty if the decode fails. The @skb must be fully
51097f6990c8SJohannes Berg  * header-less before being passed in here; it is freed in this function.
5110eaf85ca7SZhu Yi  *
51117f6990c8SJohannes Berg  * @skb: The input A-MSDU frame without any headers.
5112eaf85ca7SZhu Yi  * @list: The output list of 802.3 frames. It must be allocated and
5113eaf85ca7SZhu Yi  *	initialized by by the caller.
5114eaf85ca7SZhu Yi  * @addr: The device MAC address.
5115eaf85ca7SZhu Yi  * @iftype: The device interface type.
5116eaf85ca7SZhu Yi  * @extra_headroom: The hardware extra headroom for SKBs in the @list.
51178b935ee2SJohannes Berg  * @check_da: DA to check in the inner ethernet header, or NULL
51188b935ee2SJohannes Berg  * @check_sa: SA to check in the inner ethernet header, or NULL
5119eaf85ca7SZhu Yi  */
5120eaf85ca7SZhu Yi void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,
5121eaf85ca7SZhu Yi 			      const u8 *addr, enum nl80211_iftype iftype,
51228b3becadSYogesh Ashok Powar 			      const unsigned int extra_headroom,
51238b935ee2SJohannes Berg 			      const u8 *check_da, const u8 *check_sa);
5124eaf85ca7SZhu Yi 
5125eaf85ca7SZhu Yi /**
5126e31a16d6SZhu Yi  * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame
5127e31a16d6SZhu Yi  * @skb: the data frame
5128fa9ffc74SKyeyoon Park  * @qos_map: Interworking QoS mapping or %NULL if not in use
51290ae997dcSYacine Belkadi  * Return: The 802.1p/1d tag.
5130e31a16d6SZhu Yi  */
5131fa9ffc74SKyeyoon Park unsigned int cfg80211_classify8021d(struct sk_buff *skb,
5132fa9ffc74SKyeyoon Park 				    struct cfg80211_qos_map *qos_map);
5133e31a16d6SZhu Yi 
5134c21dbf92SJohannes Berg /**
513549a68e0dSJohannes Berg  * cfg80211_find_elem_match - match information element and byte array in data
513649a68e0dSJohannes Berg  *
513749a68e0dSJohannes Berg  * @eid: element ID
513849a68e0dSJohannes Berg  * @ies: data consisting of IEs
513949a68e0dSJohannes Berg  * @len: length of data
514049a68e0dSJohannes Berg  * @match: byte array to match
514149a68e0dSJohannes Berg  * @match_len: number of bytes in the match array
514249a68e0dSJohannes Berg  * @match_offset: offset in the IE data where the byte array should match.
514349a68e0dSJohannes Berg  *	Note the difference to cfg80211_find_ie_match() which considers
514449a68e0dSJohannes Berg  *	the offset to start from the element ID byte, but here we take
514549a68e0dSJohannes Berg  *	the data portion instead.
514649a68e0dSJohannes Berg  *
514749a68e0dSJohannes Berg  * Return: %NULL if the element ID could not be found or if
514849a68e0dSJohannes Berg  * the element is invalid (claims to be longer than the given
514949a68e0dSJohannes Berg  * data) or if the byte array doesn't match; otherwise return the
515049a68e0dSJohannes Berg  * requested element struct.
515149a68e0dSJohannes Berg  *
515249a68e0dSJohannes Berg  * Note: There are no checks on the element length other than
515349a68e0dSJohannes Berg  * having to fit into the given data and being large enough for the
515449a68e0dSJohannes Berg  * byte array to match.
515549a68e0dSJohannes Berg  */
515649a68e0dSJohannes Berg const struct element *
515749a68e0dSJohannes Berg cfg80211_find_elem_match(u8 eid, const u8 *ies, unsigned int len,
515849a68e0dSJohannes Berg 			 const u8 *match, unsigned int match_len,
515949a68e0dSJohannes Berg 			 unsigned int match_offset);
516049a68e0dSJohannes Berg 
516149a68e0dSJohannes Berg /**
5162fbd05e4aSLuca Coelho  * cfg80211_find_ie_match - match information element and byte array in data
5163fbd05e4aSLuca Coelho  *
5164fbd05e4aSLuca Coelho  * @eid: element ID
5165fbd05e4aSLuca Coelho  * @ies: data consisting of IEs
5166fbd05e4aSLuca Coelho  * @len: length of data
5167fbd05e4aSLuca Coelho  * @match: byte array to match
5168fbd05e4aSLuca Coelho  * @match_len: number of bytes in the match array
5169fbd05e4aSLuca Coelho  * @match_offset: offset in the IE where the byte array should match.
5170fbd05e4aSLuca Coelho  *	If match_len is zero, this must also be set to zero.
5171fbd05e4aSLuca Coelho  *	Otherwise this must be set to 2 or more, because the first
5172fbd05e4aSLuca Coelho  *	byte is the element id, which is already compared to eid, and
5173fbd05e4aSLuca Coelho  *	the second byte is the IE length.
5174fbd05e4aSLuca Coelho  *
5175fbd05e4aSLuca Coelho  * Return: %NULL if the element ID could not be found or if
5176fbd05e4aSLuca Coelho  * the element is invalid (claims to be longer than the given
5177fbd05e4aSLuca Coelho  * data) or if the byte array doesn't match, or a pointer to the first
5178fbd05e4aSLuca Coelho  * byte of the requested element, that is the byte containing the
5179fbd05e4aSLuca Coelho  * element ID.
5180fbd05e4aSLuca Coelho  *
5181fbd05e4aSLuca Coelho  * Note: There are no checks on the element length other than
5182fbd05e4aSLuca Coelho  * having to fit into the given data and being large enough for the
5183fbd05e4aSLuca Coelho  * byte array to match.
5184fbd05e4aSLuca Coelho  */
518549a68e0dSJohannes Berg static inline const u8 *
518649a68e0dSJohannes Berg cfg80211_find_ie_match(u8 eid, const u8 *ies, unsigned int len,
518749a68e0dSJohannes Berg 		       const u8 *match, unsigned int match_len,
518849a68e0dSJohannes Berg 		       unsigned int match_offset)
518949a68e0dSJohannes Berg {
519049a68e0dSJohannes Berg 	/* match_offset can't be smaller than 2, unless match_len is
519149a68e0dSJohannes Berg 	 * zero, in which case match_offset must be zero as well.
519249a68e0dSJohannes Berg 	 */
519349a68e0dSJohannes Berg 	if (WARN_ON((match_len && match_offset < 2) ||
519449a68e0dSJohannes Berg 		    (!match_len && match_offset)))
519549a68e0dSJohannes Berg 		return NULL;
519649a68e0dSJohannes Berg 
519749a68e0dSJohannes Berg 	return (void *)cfg80211_find_elem_match(eid, ies, len,
519849a68e0dSJohannes Berg 						match, match_len,
519949a68e0dSJohannes Berg 						match_offset ?
520049a68e0dSJohannes Berg 							match_offset - 2 : 0);
520149a68e0dSJohannes Berg }
520249a68e0dSJohannes Berg 
520349a68e0dSJohannes Berg /**
520449a68e0dSJohannes Berg  * cfg80211_find_elem - find information element in data
520549a68e0dSJohannes Berg  *
520649a68e0dSJohannes Berg  * @eid: element ID
520749a68e0dSJohannes Berg  * @ies: data consisting of IEs
520849a68e0dSJohannes Berg  * @len: length of data
520949a68e0dSJohannes Berg  *
521049a68e0dSJohannes Berg  * Return: %NULL if the element ID could not be found or if
521149a68e0dSJohannes Berg  * the element is invalid (claims to be longer than the given
521249a68e0dSJohannes Berg  * data) or if the byte array doesn't match; otherwise return the
521349a68e0dSJohannes Berg  * requested element struct.
521449a68e0dSJohannes Berg  *
521549a68e0dSJohannes Berg  * Note: There are no checks on the element length other than
521649a68e0dSJohannes Berg  * having to fit into the given data.
521749a68e0dSJohannes Berg  */
521849a68e0dSJohannes Berg static inline const struct element *
521949a68e0dSJohannes Berg cfg80211_find_elem(u8 eid, const u8 *ies, int len)
522049a68e0dSJohannes Berg {
522149a68e0dSJohannes Berg 	return cfg80211_find_elem_match(eid, ies, len, NULL, 0, 0);
522249a68e0dSJohannes Berg }
5223fbd05e4aSLuca Coelho 
5224fbd05e4aSLuca Coelho /**
5225c21dbf92SJohannes Berg  * cfg80211_find_ie - find information element in data
5226c21dbf92SJohannes Berg  *
5227c21dbf92SJohannes Berg  * @eid: element ID
5228c21dbf92SJohannes Berg  * @ies: data consisting of IEs
5229c21dbf92SJohannes Berg  * @len: length of data
5230c21dbf92SJohannes Berg  *
52310ae997dcSYacine Belkadi  * Return: %NULL if the element ID could not be found or if
52320ae997dcSYacine Belkadi  * the element is invalid (claims to be longer than the given
52330ae997dcSYacine Belkadi  * data), or a pointer to the first byte of the requested
52340ae997dcSYacine Belkadi  * element, that is the byte containing the element ID.
52350ae997dcSYacine Belkadi  *
52360ae997dcSYacine Belkadi  * Note: There are no checks on the element length other than
52370ae997dcSYacine Belkadi  * having to fit into the given data.
5238c21dbf92SJohannes Berg  */
5239fbd05e4aSLuca Coelho static inline const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len)
5240fbd05e4aSLuca Coelho {
5241fbd05e4aSLuca Coelho 	return cfg80211_find_ie_match(eid, ies, len, NULL, 0, 0);
5242fbd05e4aSLuca Coelho }
5243c21dbf92SJohannes Berg 
5244d70e9693SJohannes Berg /**
524549a68e0dSJohannes Berg  * cfg80211_find_ext_elem - find information element with EID Extension in data
524649a68e0dSJohannes Berg  *
524749a68e0dSJohannes Berg  * @ext_eid: element ID Extension
524849a68e0dSJohannes Berg  * @ies: data consisting of IEs
524949a68e0dSJohannes Berg  * @len: length of data
525049a68e0dSJohannes Berg  *
525149a68e0dSJohannes Berg  * Return: %NULL if the etended element could not be found or if
525249a68e0dSJohannes Berg  * the element is invalid (claims to be longer than the given
525349a68e0dSJohannes Berg  * data) or if the byte array doesn't match; otherwise return the
525449a68e0dSJohannes Berg  * requested element struct.
525549a68e0dSJohannes Berg  *
525649a68e0dSJohannes Berg  * Note: There are no checks on the element length other than
525749a68e0dSJohannes Berg  * having to fit into the given data.
525849a68e0dSJohannes Berg  */
525949a68e0dSJohannes Berg static inline const struct element *
526049a68e0dSJohannes Berg cfg80211_find_ext_elem(u8 ext_eid, const u8 *ies, int len)
526149a68e0dSJohannes Berg {
526249a68e0dSJohannes Berg 	return cfg80211_find_elem_match(WLAN_EID_EXTENSION, ies, len,
526349a68e0dSJohannes Berg 					&ext_eid, 1, 0);
526449a68e0dSJohannes Berg }
526549a68e0dSJohannes Berg 
526649a68e0dSJohannes Berg /**
52673f817fe7SJouni Malinen  * cfg80211_find_ext_ie - find information element with EID Extension in data
52683f817fe7SJouni Malinen  *
52693f817fe7SJouni Malinen  * @ext_eid: element ID Extension
52703f817fe7SJouni Malinen  * @ies: data consisting of IEs
52713f817fe7SJouni Malinen  * @len: length of data
52723f817fe7SJouni Malinen  *
52733f817fe7SJouni Malinen  * Return: %NULL if the extended element ID could not be found or if
52743f817fe7SJouni Malinen  * the element is invalid (claims to be longer than the given
52753f817fe7SJouni Malinen  * data), or a pointer to the first byte of the requested
52763f817fe7SJouni Malinen  * element, that is the byte containing the element ID.
52773f817fe7SJouni Malinen  *
52783f817fe7SJouni Malinen  * Note: There are no checks on the element length other than
52793f817fe7SJouni Malinen  * having to fit into the given data.
52803f817fe7SJouni Malinen  */
52813f817fe7SJouni Malinen static inline const u8 *cfg80211_find_ext_ie(u8 ext_eid, const u8 *ies, int len)
52823f817fe7SJouni Malinen {
52833f817fe7SJouni Malinen 	return cfg80211_find_ie_match(WLAN_EID_EXTENSION, ies, len,
52843f817fe7SJouni Malinen 				      &ext_eid, 1, 2);
52853f817fe7SJouni Malinen }
52863f817fe7SJouni Malinen 
52873f817fe7SJouni Malinen /**
528849a68e0dSJohannes Berg  * cfg80211_find_vendor_elem - find vendor specific information element in data
528949a68e0dSJohannes Berg  *
529049a68e0dSJohannes Berg  * @oui: vendor OUI
529149a68e0dSJohannes Berg  * @oui_type: vendor-specific OUI type (must be < 0xff), negative means any
529249a68e0dSJohannes Berg  * @ies: data consisting of IEs
529349a68e0dSJohannes Berg  * @len: length of data
529449a68e0dSJohannes Berg  *
529549a68e0dSJohannes Berg  * Return: %NULL if the vendor specific element ID could not be found or if the
529649a68e0dSJohannes Berg  * element is invalid (claims to be longer than the given data); otherwise
529749a68e0dSJohannes Berg  * return the element structure for the requested element.
529849a68e0dSJohannes Berg  *
529949a68e0dSJohannes Berg  * Note: There are no checks on the element length other than having to fit into
530049a68e0dSJohannes Berg  * the given data.
530149a68e0dSJohannes Berg  */
530249a68e0dSJohannes Berg const struct element *cfg80211_find_vendor_elem(unsigned int oui, int oui_type,
530349a68e0dSJohannes Berg 						const u8 *ies,
530449a68e0dSJohannes Berg 						unsigned int len);
530549a68e0dSJohannes Berg 
530649a68e0dSJohannes Berg /**
53070c28ec58SEliad Peller  * cfg80211_find_vendor_ie - find vendor specific information element in data
53080c28ec58SEliad Peller  *
53090c28ec58SEliad Peller  * @oui: vendor OUI
53109e9ea439SEmmanuel Grumbach  * @oui_type: vendor-specific OUI type (must be < 0xff), negative means any
53110c28ec58SEliad Peller  * @ies: data consisting of IEs
53120c28ec58SEliad Peller  * @len: length of data
53130c28ec58SEliad Peller  *
53140ae997dcSYacine Belkadi  * Return: %NULL if the vendor specific element ID could not be found or if the
53150ae997dcSYacine Belkadi  * element is invalid (claims to be longer than the given data), or a pointer to
53160ae997dcSYacine Belkadi  * the first byte of the requested element, that is the byte containing the
53170ae997dcSYacine Belkadi  * element ID.
53180ae997dcSYacine Belkadi  *
53190ae997dcSYacine Belkadi  * Note: There are no checks on the element length other than having to fit into
53200ae997dcSYacine Belkadi  * the given data.
53210c28ec58SEliad Peller  */
532249a68e0dSJohannes Berg static inline const u8 *
532349a68e0dSJohannes Berg cfg80211_find_vendor_ie(unsigned int oui, int oui_type,
532449a68e0dSJohannes Berg 			const u8 *ies, unsigned int len)
532549a68e0dSJohannes Berg {
532649a68e0dSJohannes Berg 	return (void *)cfg80211_find_vendor_elem(oui, oui_type, ies, len);
532749a68e0dSJohannes Berg }
53280c28ec58SEliad Peller 
53290c28ec58SEliad Peller /**
533030ca1aa5SDedy Lansky  * cfg80211_send_layer2_update - send layer 2 update frame
533130ca1aa5SDedy Lansky  *
533230ca1aa5SDedy Lansky  * @dev: network device
533330ca1aa5SDedy Lansky  * @addr: STA MAC address
533430ca1aa5SDedy Lansky  *
533530ca1aa5SDedy Lansky  * Wireless drivers can use this function to update forwarding tables in bridge
533630ca1aa5SDedy Lansky  * devices upon STA association.
533730ca1aa5SDedy Lansky  */
533830ca1aa5SDedy Lansky void cfg80211_send_layer2_update(struct net_device *dev, const u8 *addr);
533930ca1aa5SDedy Lansky 
534030ca1aa5SDedy Lansky /**
5341d70e9693SJohannes Berg  * DOC: Regulatory enforcement infrastructure
5342d70e9693SJohannes Berg  *
5343d70e9693SJohannes Berg  * TODO
5344d3236553SJohannes Berg  */
5345d3236553SJohannes Berg 
5346d3236553SJohannes Berg /**
5347d3236553SJohannes Berg  * regulatory_hint - driver hint to the wireless core a regulatory domain
5348d3236553SJohannes Berg  * @wiphy: the wireless device giving the hint (used only for reporting
5349d3236553SJohannes Berg  *	conflicts)
5350d3236553SJohannes Berg  * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain
5351d3236553SJohannes Berg  * 	should be in. If @rd is set this should be NULL. Note that if you
5352d3236553SJohannes Berg  * 	set this to NULL you should still set rd->alpha2 to some accepted
5353d3236553SJohannes Berg  * 	alpha2.
5354d3236553SJohannes Berg  *
5355d3236553SJohannes Berg  * Wireless drivers can use this function to hint to the wireless core
5356d3236553SJohannes Berg  * what it believes should be the current regulatory domain by
5357d3236553SJohannes Berg  * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory
5358d3236553SJohannes Berg  * domain should be in or by providing a completely build regulatory domain.
5359d3236553SJohannes Berg  * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried
5360d3236553SJohannes Berg  * for a regulatory domain structure for the respective country.
5361d3236553SJohannes Berg  *
5362d3236553SJohannes Berg  * The wiphy must have been registered to cfg80211 prior to this call.
5363d3236553SJohannes Berg  * For cfg80211 drivers this means you must first use wiphy_register(),
5364d3236553SJohannes Berg  * for mac80211 drivers you must first use ieee80211_register_hw().
5365d3236553SJohannes Berg  *
5366d3236553SJohannes Berg  * Drivers should check the return value, its possible you can get
5367d3236553SJohannes Berg  * an -ENOMEM.
53680ae997dcSYacine Belkadi  *
53690ae997dcSYacine Belkadi  * Return: 0 on success. -ENOMEM.
5370d3236553SJohannes Berg  */
537110dd9b7cSJoe Perches int regulatory_hint(struct wiphy *wiphy, const char *alpha2);
5372d3236553SJohannes Berg 
5373d3236553SJohannes Berg /**
5374b0d7aa59SJonathan Doron  * regulatory_set_wiphy_regd - set regdom info for self managed drivers
5375b0d7aa59SJonathan Doron  * @wiphy: the wireless device we want to process the regulatory domain on
5376b0d7aa59SJonathan Doron  * @rd: the regulatory domain informatoin to use for this wiphy
5377b0d7aa59SJonathan Doron  *
5378b0d7aa59SJonathan Doron  * Set the regulatory domain information for self-managed wiphys, only they
5379b0d7aa59SJonathan Doron  * may use this function. See %REGULATORY_WIPHY_SELF_MANAGED for more
5380b0d7aa59SJonathan Doron  * information.
5381b0d7aa59SJonathan Doron  *
5382b0d7aa59SJonathan Doron  * Return: 0 on success. -EINVAL, -EPERM
5383b0d7aa59SJonathan Doron  */
5384b0d7aa59SJonathan Doron int regulatory_set_wiphy_regd(struct wiphy *wiphy,
5385b0d7aa59SJonathan Doron 			      struct ieee80211_regdomain *rd);
5386b0d7aa59SJonathan Doron 
5387b0d7aa59SJonathan Doron /**
53882c3e861cSArik Nemtsov  * regulatory_set_wiphy_regd_sync_rtnl - set regdom for self-managed drivers
53892c3e861cSArik Nemtsov  * @wiphy: the wireless device we want to process the regulatory domain on
53902c3e861cSArik Nemtsov  * @rd: the regulatory domain information to use for this wiphy
53912c3e861cSArik Nemtsov  *
53922c3e861cSArik Nemtsov  * This functions requires the RTNL to be held and applies the new regdomain
53932c3e861cSArik Nemtsov  * synchronously to this wiphy. For more details see
53942c3e861cSArik Nemtsov  * regulatory_set_wiphy_regd().
53952c3e861cSArik Nemtsov  *
53962c3e861cSArik Nemtsov  * Return: 0 on success. -EINVAL, -EPERM
53972c3e861cSArik Nemtsov  */
53982c3e861cSArik Nemtsov int regulatory_set_wiphy_regd_sync_rtnl(struct wiphy *wiphy,
53992c3e861cSArik Nemtsov 					struct ieee80211_regdomain *rd);
54002c3e861cSArik Nemtsov 
54012c3e861cSArik Nemtsov /**
5402d3236553SJohannes Berg  * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain
5403d3236553SJohannes Berg  * @wiphy: the wireless device we want to process the regulatory domain on
5404d3236553SJohannes Berg  * @regd: the custom regulatory domain to use for this wiphy
5405d3236553SJohannes Berg  *
5406d3236553SJohannes Berg  * Drivers can sometimes have custom regulatory domains which do not apply
5407d3236553SJohannes Berg  * to a specific country. Drivers can use this to apply such custom regulatory
5408d3236553SJohannes Berg  * domains. This routine must be called prior to wiphy registration. The
5409d3236553SJohannes Berg  * custom regulatory domain will be trusted completely and as such previous
5410d3236553SJohannes Berg  * default channel settings will be disregarded. If no rule is found for a
5411d3236553SJohannes Berg  * channel on the regulatory domain the channel will be disabled.
5412222ea581SLuis R. Rodriguez  * Drivers using this for a wiphy should also set the wiphy flag
5413ce26151bSKalle Valo  * REGULATORY_CUSTOM_REG or cfg80211 will set it for the wiphy
5414222ea581SLuis R. Rodriguez  * that called this helper.
5415d3236553SJohannes Berg  */
541610dd9b7cSJoe Perches void wiphy_apply_custom_regulatory(struct wiphy *wiphy,
5417d3236553SJohannes Berg 				   const struct ieee80211_regdomain *regd);
5418d3236553SJohannes Berg 
5419d3236553SJohannes Berg /**
5420d3236553SJohannes Berg  * freq_reg_info - get regulatory information for the given frequency
5421d3236553SJohannes Berg  * @wiphy: the wiphy for which we want to process this rule for
5422d3236553SJohannes Berg  * @center_freq: Frequency in KHz for which we want regulatory information for
5423d3236553SJohannes Berg  *
5424d3236553SJohannes Berg  * Use this function to get the regulatory rule for a specific frequency on
5425d3236553SJohannes Berg  * a given wireless device. If the device has a specific regulatory domain
5426d3236553SJohannes Berg  * it wants to follow we respect that unless a country IE has been received
5427d3236553SJohannes Berg  * and processed already.
5428d3236553SJohannes Berg  *
54290ae997dcSYacine Belkadi  * Return: A valid pointer, or, when an error occurs, for example if no rule
54300ae997dcSYacine Belkadi  * can be found, the return value is encoded using ERR_PTR(). Use IS_ERR() to
54310ae997dcSYacine Belkadi  * check and PTR_ERR() to obtain the numeric return value. The numeric return
54320ae997dcSYacine Belkadi  * value will be -ERANGE if we determine the given center_freq does not even
54330ae997dcSYacine Belkadi  * have a regulatory rule for a frequency range in the center_freq's band.
54340ae997dcSYacine Belkadi  * See freq_in_rule_band() for our current definition of a band -- this is
54350ae997dcSYacine Belkadi  * purely subjective and right now it's 802.11 specific.
5436d3236553SJohannes Berg  */
5437361c9c8bSJohannes Berg const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy,
5438361c9c8bSJohannes Berg 					       u32 center_freq);
5439d3236553SJohannes Berg 
5440034c6d6eSLuis R. Rodriguez /**
5441034c6d6eSLuis R. Rodriguez  * reg_initiator_name - map regulatory request initiator enum to name
5442034c6d6eSLuis R. Rodriguez  * @initiator: the regulatory request initiator
5443034c6d6eSLuis R. Rodriguez  *
5444034c6d6eSLuis R. Rodriguez  * You can use this to map the regulatory request initiator enum to a
5445034c6d6eSLuis R. Rodriguez  * proper string representation.
5446034c6d6eSLuis R. Rodriguez  */
5447034c6d6eSLuis R. Rodriguez const char *reg_initiator_name(enum nl80211_reg_initiator initiator);
5448034c6d6eSLuis R. Rodriguez 
544919d3577eSHaim Dreyfuss /**
545019d3577eSHaim Dreyfuss  * DOC: Internal regulatory db functions
545119d3577eSHaim Dreyfuss  *
545219d3577eSHaim Dreyfuss  */
545319d3577eSHaim Dreyfuss 
545419d3577eSHaim Dreyfuss /**
545519d3577eSHaim Dreyfuss  * reg_query_regdb_wmm -  Query internal regulatory db for wmm rule
545619d3577eSHaim Dreyfuss  * Regulatory self-managed driver can use it to proactively
545719d3577eSHaim Dreyfuss  *
545819d3577eSHaim Dreyfuss  * @alpha2: the ISO/IEC 3166 alpha2 wmm rule to be queried.
545919d3577eSHaim Dreyfuss  * @freq: the freqency(in MHz) to be queried.
546019d3577eSHaim Dreyfuss  * @rule: pointer to store the wmm rule from the regulatory db.
546119d3577eSHaim Dreyfuss  *
546219d3577eSHaim Dreyfuss  * Self-managed wireless drivers can use this function to  query
546319d3577eSHaim Dreyfuss  * the internal regulatory database to check whether the given
546419d3577eSHaim Dreyfuss  * ISO/IEC 3166 alpha2 country and freq have wmm rule limitations.
546519d3577eSHaim Dreyfuss  *
546619d3577eSHaim Dreyfuss  * Drivers should check the return value, its possible you can get
546719d3577eSHaim Dreyfuss  * an -ENODATA.
546819d3577eSHaim Dreyfuss  *
546919d3577eSHaim Dreyfuss  * Return: 0 on success. -ENODATA.
547019d3577eSHaim Dreyfuss  */
547138cb87eeSStanislaw Gruszka int reg_query_regdb_wmm(char *alpha2, int freq,
547238cb87eeSStanislaw Gruszka 			struct ieee80211_reg_rule *rule);
547319d3577eSHaim Dreyfuss 
5474d3236553SJohannes Berg /*
5475d3236553SJohannes Berg  * callbacks for asynchronous cfg80211 methods, notification
5476d3236553SJohannes Berg  * functions and BSS handling helpers
5477d3236553SJohannes Berg  */
5478d3236553SJohannes Berg 
54792a519311SJohannes Berg /**
54802a519311SJohannes Berg  * cfg80211_scan_done - notify that scan finished
54812a519311SJohannes Berg  *
54822a519311SJohannes Berg  * @request: the corresponding scan request
54831d76250bSAvraham Stern  * @info: information about the completed scan
54842a519311SJohannes Berg  */
54851d76250bSAvraham Stern void cfg80211_scan_done(struct cfg80211_scan_request *request,
54861d76250bSAvraham Stern 			struct cfg80211_scan_info *info);
54872a519311SJohannes Berg 
54882a519311SJohannes Berg /**
5489807f8a8cSLuciano Coelho  * cfg80211_sched_scan_results - notify that new scan results are available
5490807f8a8cSLuciano Coelho  *
5491807f8a8cSLuciano Coelho  * @wiphy: the wiphy which got scheduled scan results
5492b34939b9SArend Van Spriel  * @reqid: identifier for the related scheduled scan request
5493807f8a8cSLuciano Coelho  */
5494b34939b9SArend Van Spriel void cfg80211_sched_scan_results(struct wiphy *wiphy, u64 reqid);
5495807f8a8cSLuciano Coelho 
5496807f8a8cSLuciano Coelho /**
5497807f8a8cSLuciano Coelho  * cfg80211_sched_scan_stopped - notify that the scheduled scan has stopped
5498807f8a8cSLuciano Coelho  *
5499807f8a8cSLuciano Coelho  * @wiphy: the wiphy on which the scheduled scan stopped
5500b34939b9SArend Van Spriel  * @reqid: identifier for the related scheduled scan request
5501807f8a8cSLuciano Coelho  *
5502807f8a8cSLuciano Coelho  * The driver can call this function to inform cfg80211 that the
5503807f8a8cSLuciano Coelho  * scheduled scan had to be stopped, for whatever reason.  The driver
5504807f8a8cSLuciano Coelho  * is then called back via the sched_scan_stop operation when done.
5505807f8a8cSLuciano Coelho  */
5506b34939b9SArend Van Spriel void cfg80211_sched_scan_stopped(struct wiphy *wiphy, u64 reqid);
5507807f8a8cSLuciano Coelho 
5508807f8a8cSLuciano Coelho /**
5509792e6aa7SEliad Peller  * cfg80211_sched_scan_stopped_rtnl - notify that the scheduled scan has stopped
5510792e6aa7SEliad Peller  *
5511792e6aa7SEliad Peller  * @wiphy: the wiphy on which the scheduled scan stopped
5512b34939b9SArend Van Spriel  * @reqid: identifier for the related scheduled scan request
5513792e6aa7SEliad Peller  *
5514792e6aa7SEliad Peller  * The driver can call this function to inform cfg80211 that the
5515792e6aa7SEliad Peller  * scheduled scan had to be stopped, for whatever reason.  The driver
5516792e6aa7SEliad Peller  * is then called back via the sched_scan_stop operation when done.
5517792e6aa7SEliad Peller  * This function should be called with rtnl locked.
5518792e6aa7SEliad Peller  */
5519b34939b9SArend Van Spriel void cfg80211_sched_scan_stopped_rtnl(struct wiphy *wiphy, u64 reqid);
5520792e6aa7SEliad Peller 
5521792e6aa7SEliad Peller /**
55226e19bc4bSDmitry Shmidt  * cfg80211_inform_bss_frame_data - inform cfg80211 of a received BSS frame
55232a519311SJohannes Berg  * @wiphy: the wiphy reporting the BSS
55246e19bc4bSDmitry Shmidt  * @data: the BSS metadata
5525abe37c4bSJohannes Berg  * @mgmt: the management frame (probe response or beacon)
5526abe37c4bSJohannes Berg  * @len: length of the management frame
55272a519311SJohannes Berg  * @gfp: context flags
55282a519311SJohannes Berg  *
55292a519311SJohannes Berg  * This informs cfg80211 that BSS information was found and
55302a519311SJohannes Berg  * the BSS should be updated/added.
5531ef100682SJohannes Berg  *
55320ae997dcSYacine Belkadi  * Return: A referenced struct, must be released with cfg80211_put_bss()!
55330ae997dcSYacine Belkadi  * Or %NULL on error.
55342a519311SJohannes Berg  */
5535ef100682SJohannes Berg struct cfg80211_bss * __must_check
55366e19bc4bSDmitry Shmidt cfg80211_inform_bss_frame_data(struct wiphy *wiphy,
55376e19bc4bSDmitry Shmidt 			       struct cfg80211_inform_bss *data,
55386e19bc4bSDmitry Shmidt 			       struct ieee80211_mgmt *mgmt, size_t len,
55396e19bc4bSDmitry Shmidt 			       gfp_t gfp);
55406e19bc4bSDmitry Shmidt 
55416e19bc4bSDmitry Shmidt static inline struct cfg80211_bss * __must_check
5542dcd6eac1SSimon Wunderlich cfg80211_inform_bss_width_frame(struct wiphy *wiphy,
55433afc2167SEmmanuel Grumbach 				struct ieee80211_channel *rx_channel,
5544dcd6eac1SSimon Wunderlich 				enum nl80211_bss_scan_width scan_width,
5545dcd6eac1SSimon Wunderlich 				struct ieee80211_mgmt *mgmt, size_t len,
55466e19bc4bSDmitry Shmidt 				s32 signal, gfp_t gfp)
55476e19bc4bSDmitry Shmidt {
55486e19bc4bSDmitry Shmidt 	struct cfg80211_inform_bss data = {
55496e19bc4bSDmitry Shmidt 		.chan = rx_channel,
55506e19bc4bSDmitry Shmidt 		.scan_width = scan_width,
55516e19bc4bSDmitry Shmidt 		.signal = signal,
55526e19bc4bSDmitry Shmidt 	};
55536e19bc4bSDmitry Shmidt 
55546e19bc4bSDmitry Shmidt 	return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp);
55556e19bc4bSDmitry Shmidt }
5556dcd6eac1SSimon Wunderlich 
5557dcd6eac1SSimon Wunderlich static inline struct cfg80211_bss * __must_check
55582a519311SJohannes Berg cfg80211_inform_bss_frame(struct wiphy *wiphy,
55593afc2167SEmmanuel Grumbach 			  struct ieee80211_channel *rx_channel,
55602a519311SJohannes Berg 			  struct ieee80211_mgmt *mgmt, size_t len,
5561dcd6eac1SSimon Wunderlich 			  s32 signal, gfp_t gfp)
5562dcd6eac1SSimon Wunderlich {
55636e19bc4bSDmitry Shmidt 	struct cfg80211_inform_bss data = {
55646e19bc4bSDmitry Shmidt 		.chan = rx_channel,
55656e19bc4bSDmitry Shmidt 		.scan_width = NL80211_BSS_CHAN_WIDTH_20,
55666e19bc4bSDmitry Shmidt 		.signal = signal,
55676e19bc4bSDmitry Shmidt 	};
55686e19bc4bSDmitry Shmidt 
55696e19bc4bSDmitry Shmidt 	return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp);
5570dcd6eac1SSimon Wunderlich }
55712a519311SJohannes Berg 
5572abe37c4bSJohannes Berg /**
55737ece9c37SSara Sharon  * cfg80211_gen_new_bssid - generate a nontransmitted BSSID for multi-BSSID
55747ece9c37SSara Sharon  * @bssid: transmitter BSSID
55757ece9c37SSara Sharon  * @max_bssid: max BSSID indicator, taken from Multiple BSSID element
55767ece9c37SSara Sharon  * @mbssid_index: BSSID index, taken from Multiple BSSID index element
55775d4071abSJohannes Berg  * @new_bssid: calculated nontransmitted BSSID
55787ece9c37SSara Sharon  */
55797ece9c37SSara Sharon static inline void cfg80211_gen_new_bssid(const u8 *bssid, u8 max_bssid,
55805d4071abSJohannes Berg 					  u8 mbssid_index, u8 *new_bssid)
55817ece9c37SSara Sharon {
55825d4071abSJohannes Berg 	u64 bssid_u64 = ether_addr_to_u64(bssid);
55835d4071abSJohannes Berg 	u64 mask = GENMASK_ULL(max_bssid - 1, 0);
55845d4071abSJohannes Berg 	u64 new_bssid_u64;
55857ece9c37SSara Sharon 
55865d4071abSJohannes Berg 	new_bssid_u64 = bssid_u64 & ~mask;
55877ece9c37SSara Sharon 
55885d4071abSJohannes Berg 	new_bssid_u64 |= ((bssid_u64 & mask) + mbssid_index) & mask;
55897ece9c37SSara Sharon 
55905d4071abSJohannes Berg 	u64_to_ether_addr(new_bssid_u64, new_bssid);
55917ece9c37SSara Sharon }
55927ece9c37SSara Sharon 
55937ece9c37SSara Sharon /**
5594f7dacfb1SSara Sharon  * cfg80211_is_element_inherited - returns if element ID should be inherited
5595f7dacfb1SSara Sharon  * @element: element to check
5596f7dacfb1SSara Sharon  * @non_inherit_element: non inheritance element
5597f7dacfb1SSara Sharon  */
5598f7dacfb1SSara Sharon bool cfg80211_is_element_inherited(const struct element *element,
5599f7dacfb1SSara Sharon 				   const struct element *non_inherit_element);
5600f7dacfb1SSara Sharon 
5601f7dacfb1SSara Sharon /**
5602fe806e49SSara Sharon  * cfg80211_merge_profile - merges a MBSSID profile if it is split between IEs
5603fe806e49SSara Sharon  * @ie: ies
5604fe806e49SSara Sharon  * @ielen: length of IEs
5605fe806e49SSara Sharon  * @mbssid_elem: current MBSSID element
5606fe806e49SSara Sharon  * @sub_elem: current MBSSID subelement (profile)
5607fe806e49SSara Sharon  * @merged_ie: location of the merged profile
5608fe806e49SSara Sharon  * @max_copy_len: max merged profile length
5609fe806e49SSara Sharon  */
5610fe806e49SSara Sharon size_t cfg80211_merge_profile(const u8 *ie, size_t ielen,
5611fe806e49SSara Sharon 			      const struct element *mbssid_elem,
5612fe806e49SSara Sharon 			      const struct element *sub_elem,
56135809a5d5SDan Carpenter 			      u8 *merged_ie, size_t max_copy_len);
5614fe806e49SSara Sharon 
5615fe806e49SSara Sharon /**
56165bc8c1f2SJohannes Berg  * enum cfg80211_bss_frame_type - frame type that the BSS data came from
56175bc8c1f2SJohannes Berg  * @CFG80211_BSS_FTYPE_UNKNOWN: driver doesn't know whether the data is
56185bc8c1f2SJohannes Berg  *	from a beacon or probe response
56195bc8c1f2SJohannes Berg  * @CFG80211_BSS_FTYPE_BEACON: data comes from a beacon
56205bc8c1f2SJohannes Berg  * @CFG80211_BSS_FTYPE_PRESP: data comes from a probe response
56215bc8c1f2SJohannes Berg  */
56225bc8c1f2SJohannes Berg enum cfg80211_bss_frame_type {
56235bc8c1f2SJohannes Berg 	CFG80211_BSS_FTYPE_UNKNOWN,
56245bc8c1f2SJohannes Berg 	CFG80211_BSS_FTYPE_BEACON,
56255bc8c1f2SJohannes Berg 	CFG80211_BSS_FTYPE_PRESP,
56265bc8c1f2SJohannes Berg };
56275bc8c1f2SJohannes Berg 
56285bc8c1f2SJohannes Berg /**
56296e19bc4bSDmitry Shmidt  * cfg80211_inform_bss_data - inform cfg80211 of a new BSS
5630abe37c4bSJohannes Berg  *
5631abe37c4bSJohannes Berg  * @wiphy: the wiphy reporting the BSS
56326e19bc4bSDmitry Shmidt  * @data: the BSS metadata
56335bc8c1f2SJohannes Berg  * @ftype: frame type (if known)
5634abe37c4bSJohannes Berg  * @bssid: the BSSID of the BSS
56357b8bcff2SJohannes Berg  * @tsf: the TSF sent by the peer in the beacon/probe response (or 0)
5636abe37c4bSJohannes Berg  * @capability: the capability field sent by the peer
5637abe37c4bSJohannes Berg  * @beacon_interval: the beacon interval announced by the peer
5638abe37c4bSJohannes Berg  * @ie: additional IEs sent by the peer
5639abe37c4bSJohannes Berg  * @ielen: length of the additional IEs
5640abe37c4bSJohannes Berg  * @gfp: context flags
5641abe37c4bSJohannes Berg  *
5642abe37c4bSJohannes Berg  * This informs cfg80211 that BSS information was found and
5643abe37c4bSJohannes Berg  * the BSS should be updated/added.
5644ef100682SJohannes Berg  *
56450ae997dcSYacine Belkadi  * Return: A referenced struct, must be released with cfg80211_put_bss()!
56460ae997dcSYacine Belkadi  * Or %NULL on error.
5647abe37c4bSJohannes Berg  */
5648ef100682SJohannes Berg struct cfg80211_bss * __must_check
56496e19bc4bSDmitry Shmidt cfg80211_inform_bss_data(struct wiphy *wiphy,
56506e19bc4bSDmitry Shmidt 			 struct cfg80211_inform_bss *data,
56516e19bc4bSDmitry Shmidt 			 enum cfg80211_bss_frame_type ftype,
56526e19bc4bSDmitry Shmidt 			 const u8 *bssid, u64 tsf, u16 capability,
56536e19bc4bSDmitry Shmidt 			 u16 beacon_interval, const u8 *ie, size_t ielen,
56546e19bc4bSDmitry Shmidt 			 gfp_t gfp);
56556e19bc4bSDmitry Shmidt 
56566e19bc4bSDmitry Shmidt static inline struct cfg80211_bss * __must_check
5657dcd6eac1SSimon Wunderlich cfg80211_inform_bss_width(struct wiphy *wiphy,
56583afc2167SEmmanuel Grumbach 			  struct ieee80211_channel *rx_channel,
5659dcd6eac1SSimon Wunderlich 			  enum nl80211_bss_scan_width scan_width,
56605bc8c1f2SJohannes Berg 			  enum cfg80211_bss_frame_type ftype,
5661dcd6eac1SSimon Wunderlich 			  const u8 *bssid, u64 tsf, u16 capability,
5662dcd6eac1SSimon Wunderlich 			  u16 beacon_interval, const u8 *ie, size_t ielen,
56636e19bc4bSDmitry Shmidt 			  s32 signal, gfp_t gfp)
56646e19bc4bSDmitry Shmidt {
56656e19bc4bSDmitry Shmidt 	struct cfg80211_inform_bss data = {
56666e19bc4bSDmitry Shmidt 		.chan = rx_channel,
56676e19bc4bSDmitry Shmidt 		.scan_width = scan_width,
56686e19bc4bSDmitry Shmidt 		.signal = signal,
56696e19bc4bSDmitry Shmidt 	};
56706e19bc4bSDmitry Shmidt 
56716e19bc4bSDmitry Shmidt 	return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf,
56726e19bc4bSDmitry Shmidt 					capability, beacon_interval, ie, ielen,
56736e19bc4bSDmitry Shmidt 					gfp);
56746e19bc4bSDmitry Shmidt }
5675dcd6eac1SSimon Wunderlich 
5676dcd6eac1SSimon Wunderlich static inline struct cfg80211_bss * __must_check
567706aa7afaSJussi Kivilinna cfg80211_inform_bss(struct wiphy *wiphy,
56783afc2167SEmmanuel Grumbach 		    struct ieee80211_channel *rx_channel,
56795bc8c1f2SJohannes Berg 		    enum cfg80211_bss_frame_type ftype,
56807b8bcff2SJohannes Berg 		    const u8 *bssid, u64 tsf, u16 capability,
56817b8bcff2SJohannes Berg 		    u16 beacon_interval, const u8 *ie, size_t ielen,
5682dcd6eac1SSimon Wunderlich 		    s32 signal, gfp_t gfp)
5683dcd6eac1SSimon Wunderlich {
56846e19bc4bSDmitry Shmidt 	struct cfg80211_inform_bss data = {
56856e19bc4bSDmitry Shmidt 		.chan = rx_channel,
56866e19bc4bSDmitry Shmidt 		.scan_width = NL80211_BSS_CHAN_WIDTH_20,
56876e19bc4bSDmitry Shmidt 		.signal = signal,
56886e19bc4bSDmitry Shmidt 	};
56896e19bc4bSDmitry Shmidt 
56906e19bc4bSDmitry Shmidt 	return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf,
56916e19bc4bSDmitry Shmidt 					capability, beacon_interval, ie, ielen,
5692dcd6eac1SSimon Wunderlich 					gfp);
5693dcd6eac1SSimon Wunderlich }
569406aa7afaSJussi Kivilinna 
569527548677SJohannes Berg /**
569627548677SJohannes Berg  * cfg80211_get_bss - get a BSS reference
569727548677SJohannes Berg  * @wiphy: the wiphy this BSS struct belongs to
569827548677SJohannes Berg  * @channel: the channel to search on (or %NULL)
569927548677SJohannes Berg  * @bssid: the desired BSSID (or %NULL)
570027548677SJohannes Berg  * @ssid: the desired SSID (or %NULL)
570127548677SJohannes Berg  * @ssid_len: length of the SSID (or 0)
570227548677SJohannes Berg  * @bss_type: type of BSS, see &enum ieee80211_bss_type
570327548677SJohannes Berg  * @privacy: privacy filter, see &enum ieee80211_privacy
570427548677SJohannes Berg  */
57052a519311SJohannes Berg struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
57062a519311SJohannes Berg 				      struct ieee80211_channel *channel,
57072a519311SJohannes Berg 				      const u8 *bssid,
570879420f09SJohannes Berg 				      const u8 *ssid, size_t ssid_len,
57096eb18137SDedy Lansky 				      enum ieee80211_bss_type bss_type,
571027548677SJohannes Berg 				      enum ieee80211_privacy privacy);
571179420f09SJohannes Berg static inline struct cfg80211_bss *
571279420f09SJohannes Berg cfg80211_get_ibss(struct wiphy *wiphy,
571379420f09SJohannes Berg 		  struct ieee80211_channel *channel,
571479420f09SJohannes Berg 		  const u8 *ssid, size_t ssid_len)
571579420f09SJohannes Berg {
571679420f09SJohannes Berg 	return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len,
57176eb18137SDedy Lansky 				IEEE80211_BSS_TYPE_IBSS,
57186eb18137SDedy Lansky 				IEEE80211_PRIVACY_ANY);
571979420f09SJohannes Berg }
572079420f09SJohannes Berg 
57214c0c0b75SJohannes Berg /**
57224c0c0b75SJohannes Berg  * cfg80211_ref_bss - reference BSS struct
57235b112d3dSJohannes Berg  * @wiphy: the wiphy this BSS struct belongs to
57244c0c0b75SJohannes Berg  * @bss: the BSS struct to reference
57254c0c0b75SJohannes Berg  *
57264c0c0b75SJohannes Berg  * Increments the refcount of the given BSS struct.
57274c0c0b75SJohannes Berg  */
57285b112d3dSJohannes Berg void cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
57294c0c0b75SJohannes Berg 
57304c0c0b75SJohannes Berg /**
57314c0c0b75SJohannes Berg  * cfg80211_put_bss - unref BSS struct
57325b112d3dSJohannes Berg  * @wiphy: the wiphy this BSS struct belongs to
57334c0c0b75SJohannes Berg  * @bss: the BSS struct
57344c0c0b75SJohannes Berg  *
57354c0c0b75SJohannes Berg  * Decrements the refcount of the given BSS struct.
57364c0c0b75SJohannes Berg  */
57375b112d3dSJohannes Berg void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
5738d3236553SJohannes Berg 
5739d491af19SJohannes Berg /**
5740d491af19SJohannes Berg  * cfg80211_unlink_bss - unlink BSS from internal data structures
5741d491af19SJohannes Berg  * @wiphy: the wiphy
5742d491af19SJohannes Berg  * @bss: the bss to remove
5743d491af19SJohannes Berg  *
5744d491af19SJohannes Berg  * This function removes the given BSS from the internal data structures
5745d491af19SJohannes Berg  * thereby making it no longer show up in scan results etc. Use this
5746d491af19SJohannes Berg  * function when you detect a BSS is gone. Normally BSSes will also time
5747d491af19SJohannes Berg  * out, so it is not necessary to use this function at all.
5748d491af19SJohannes Berg  */
5749d491af19SJohannes Berg void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
5750fee52678SJohannes Berg 
57514770c8f9SIlan Peer /**
57524770c8f9SIlan Peer  * cfg80211_bss_iter - iterate all BSS entries
57534770c8f9SIlan Peer  *
57544770c8f9SIlan Peer  * This function iterates over the BSS entries associated with the given wiphy
57554770c8f9SIlan Peer  * and calls the callback for the iterated BSS. The iterator function is not
57564770c8f9SIlan Peer  * allowed to call functions that might modify the internal state of the BSS DB.
57574770c8f9SIlan Peer  *
57584770c8f9SIlan Peer  * @wiphy: the wiphy
57594770c8f9SIlan Peer  * @chandef: if given, the iterator function will be called only if the channel
57604770c8f9SIlan Peer  *     of the currently iterated BSS is a subset of the given channel.
57614770c8f9SIlan Peer  * @iter: the iterator function to call
57624770c8f9SIlan Peer  * @iter_data: an argument to the iterator function
57634770c8f9SIlan Peer  */
57644770c8f9SIlan Peer void cfg80211_bss_iter(struct wiphy *wiphy,
57654770c8f9SIlan Peer 		       struct cfg80211_chan_def *chandef,
57664770c8f9SIlan Peer 		       void (*iter)(struct wiphy *wiphy,
57674770c8f9SIlan Peer 				    struct cfg80211_bss *bss,
57684770c8f9SIlan Peer 				    void *data),
57694770c8f9SIlan Peer 		       void *iter_data);
57704770c8f9SIlan Peer 
5771dcd6eac1SSimon Wunderlich static inline enum nl80211_bss_scan_width
5772dcd6eac1SSimon Wunderlich cfg80211_chandef_to_scan_width(const struct cfg80211_chan_def *chandef)
5773dcd6eac1SSimon Wunderlich {
5774dcd6eac1SSimon Wunderlich 	switch (chandef->width) {
5775dcd6eac1SSimon Wunderlich 	case NL80211_CHAN_WIDTH_5:
5776dcd6eac1SSimon Wunderlich 		return NL80211_BSS_CHAN_WIDTH_5;
5777dcd6eac1SSimon Wunderlich 	case NL80211_CHAN_WIDTH_10:
5778dcd6eac1SSimon Wunderlich 		return NL80211_BSS_CHAN_WIDTH_10;
5779dcd6eac1SSimon Wunderlich 	default:
5780dcd6eac1SSimon Wunderlich 		return NL80211_BSS_CHAN_WIDTH_20;
5781dcd6eac1SSimon Wunderlich 	}
5782dcd6eac1SSimon Wunderlich }
5783dcd6eac1SSimon Wunderlich 
57846039f6d2SJouni Malinen /**
57856ff57cf8SJohannes Berg  * cfg80211_rx_mlme_mgmt - notification of processed MLME management frame
57866039f6d2SJouni Malinen  * @dev: network device
57876039f6d2SJouni Malinen  * @buf: authentication frame (header + body)
57886039f6d2SJouni Malinen  * @len: length of the frame data
57896039f6d2SJouni Malinen  *
57906ff57cf8SJohannes Berg  * This function is called whenever an authentication, disassociation or
57916ff57cf8SJohannes Berg  * deauthentication frame has been received and processed in station mode.
57926ff57cf8SJohannes Berg  * After being asked to authenticate via cfg80211_ops::auth() the driver must
57936ff57cf8SJohannes Berg  * call either this function or cfg80211_auth_timeout().
57946ff57cf8SJohannes Berg  * After being asked to associate via cfg80211_ops::assoc() the driver must
57956ff57cf8SJohannes Berg  * call either this function or cfg80211_auth_timeout().
57966ff57cf8SJohannes Berg  * While connected, the driver must calls this for received and processed
57976ff57cf8SJohannes Berg  * disassociation and deauthentication frames. If the frame couldn't be used
57986ff57cf8SJohannes Berg  * because it was unprotected, the driver must call the function
57996ff57cf8SJohannes Berg  * cfg80211_rx_unprot_mlme_mgmt() instead.
58006ff57cf8SJohannes Berg  *
58016ff57cf8SJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's mutex.
58026039f6d2SJouni Malinen  */
58036ff57cf8SJohannes Berg void cfg80211_rx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len);
58046039f6d2SJouni Malinen 
58056039f6d2SJouni Malinen /**
58066ff57cf8SJohannes Berg  * cfg80211_auth_timeout - notification of timed out authentication
58071965c853SJouni Malinen  * @dev: network device
58081965c853SJouni Malinen  * @addr: The MAC address of the device with which the authentication timed out
5809cb0b4bebSJohannes Berg  *
58108d61ffa5SJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's
58118d61ffa5SJohannes Berg  * mutex.
58121965c853SJouni Malinen  */
58136ff57cf8SJohannes Berg void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr);
58141965c853SJouni Malinen 
58151965c853SJouni Malinen /**
58166ff57cf8SJohannes Berg  * cfg80211_rx_assoc_resp - notification of processed association response
58176039f6d2SJouni Malinen  * @dev: network device
58186ff57cf8SJohannes Berg  * @bss: the BSS that association was requested with, ownership of the pointer
58196ff57cf8SJohannes Berg  *	moves to cfg80211 in this call
58204d9ec73dSJouni Malinen  * @buf: (Re)Association Response frame (header + body)
58216039f6d2SJouni Malinen  * @len: length of the frame data
5822f438ceb8SEmmanuel Grumbach  * @uapsd_queues: bitmap of queues configured for uapsd. Same format
5823f438ceb8SEmmanuel Grumbach  *	as the AC bitmap in the QoS info field
58244d9ec73dSJouni Malinen  * @req_ies: information elements from the (Re)Association Request frame
58254d9ec73dSJouni Malinen  * @req_ies_len: length of req_ies data
58266039f6d2SJouni Malinen  *
58276ff57cf8SJohannes Berg  * After being asked to associate via cfg80211_ops::assoc() the driver must
58286ff57cf8SJohannes Berg  * call either this function or cfg80211_auth_timeout().
58296ff57cf8SJohannes Berg  *
58306ff57cf8SJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's mutex.
58316039f6d2SJouni Malinen  */
58326ff57cf8SJohannes Berg void cfg80211_rx_assoc_resp(struct net_device *dev,
58336ff57cf8SJohannes Berg 			    struct cfg80211_bss *bss,
5834b0b6aa2cSEliad Peller 			    const u8 *buf, size_t len,
58354d9ec73dSJouni Malinen 			    int uapsd_queues,
58364d9ec73dSJouni Malinen 			    const u8 *req_ies, size_t req_ies_len);
58376039f6d2SJouni Malinen 
58386039f6d2SJouni Malinen /**
58396ff57cf8SJohannes Berg  * cfg80211_assoc_timeout - notification of timed out association
58401965c853SJouni Malinen  * @dev: network device
5841959867faSJohannes Berg  * @bss: The BSS entry with which association timed out.
5842cb0b4bebSJohannes Berg  *
58438d61ffa5SJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's mutex.
58441965c853SJouni Malinen  */
5845959867faSJohannes Berg void cfg80211_assoc_timeout(struct net_device *dev, struct cfg80211_bss *bss);
58461965c853SJouni Malinen 
58471965c853SJouni Malinen /**
5848e6f462dfSJohannes Berg  * cfg80211_abandon_assoc - notify cfg80211 of abandoned association attempt
5849e6f462dfSJohannes Berg  * @dev: network device
5850e6f462dfSJohannes Berg  * @bss: The BSS entry with which association was abandoned.
5851e6f462dfSJohannes Berg  *
5852e6f462dfSJohannes Berg  * Call this whenever - for reasons reported through other API, like deauth RX,
5853e6f462dfSJohannes Berg  * an association attempt was abandoned.
5854e6f462dfSJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's mutex.
5855e6f462dfSJohannes Berg  */
5856e6f462dfSJohannes Berg void cfg80211_abandon_assoc(struct net_device *dev, struct cfg80211_bss *bss);
5857e6f462dfSJohannes Berg 
5858e6f462dfSJohannes Berg /**
58596ff57cf8SJohannes Berg  * cfg80211_tx_mlme_mgmt - notification of transmitted deauth/disassoc frame
58606039f6d2SJouni Malinen  * @dev: network device
58616ff57cf8SJohannes Berg  * @buf: 802.11 frame (header + body)
58626039f6d2SJouni Malinen  * @len: length of the frame data
58636039f6d2SJouni Malinen  *
58646039f6d2SJouni Malinen  * This function is called whenever deauthentication has been processed in
586553b46b84SJouni Malinen  * station mode. This includes both received deauthentication frames and
58668d61ffa5SJohannes Berg  * locally generated ones. This function may sleep. The caller must hold the
58678d61ffa5SJohannes Berg  * corresponding wdev's mutex.
58686039f6d2SJouni Malinen  */
58696ff57cf8SJohannes Berg void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len);
5870ce470613SHolger Schurig 
5871ce470613SHolger Schurig /**
58726ff57cf8SJohannes Berg  * cfg80211_rx_unprot_mlme_mgmt - notification of unprotected mlme mgmt frame
5873cf4e594eSJouni Malinen  * @dev: network device
5874cf4e594eSJouni Malinen  * @buf: deauthentication frame (header + body)
5875cf4e594eSJouni Malinen  * @len: length of the frame data
5876cf4e594eSJouni Malinen  *
58776ff57cf8SJohannes Berg  * This function is called whenever a received deauthentication or dissassoc
58786ff57cf8SJohannes Berg  * frame has been dropped in station mode because of MFP being used but the
5879cf4e594eSJouni Malinen  * frame was not protected. This function may sleep.
5880cf4e594eSJouni Malinen  */
58816ff57cf8SJohannes Berg void cfg80211_rx_unprot_mlme_mgmt(struct net_device *dev,
58826ff57cf8SJohannes Berg 				  const u8 *buf, size_t len);
5883cf4e594eSJouni Malinen 
5884cf4e594eSJouni Malinen /**
5885a3b8b056SJouni Malinen  * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP)
5886a3b8b056SJouni Malinen  * @dev: network device
5887a3b8b056SJouni Malinen  * @addr: The source MAC address of the frame
5888a3b8b056SJouni Malinen  * @key_type: The key type that the received frame used
5889a66b98dbSArik Nemtsov  * @key_id: Key identifier (0..3). Can be -1 if missing.
5890a3b8b056SJouni Malinen  * @tsc: The TSC value of the frame that generated the MIC failure (6 octets)
5891e6d6e342SJohannes Berg  * @gfp: allocation flags
5892a3b8b056SJouni Malinen  *
5893a3b8b056SJouni Malinen  * This function is called whenever the local MAC detects a MIC failure in a
5894a3b8b056SJouni Malinen  * received frame. This matches with MLME-MICHAELMICFAILURE.indication()
5895a3b8b056SJouni Malinen  * primitive.
5896a3b8b056SJouni Malinen  */
5897a3b8b056SJouni Malinen void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,
5898a3b8b056SJouni Malinen 				  enum nl80211_key_type key_type, int key_id,
5899e6d6e342SJohannes Berg 				  const u8 *tsc, gfp_t gfp);
5900a3b8b056SJouni Malinen 
590104a773adSJohannes Berg /**
590204a773adSJohannes Berg  * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS
590304a773adSJohannes Berg  *
590404a773adSJohannes Berg  * @dev: network device
590504a773adSJohannes Berg  * @bssid: the BSSID of the IBSS joined
5906fe94f3a4SAntonio Quartulli  * @channel: the channel of the IBSS joined
590704a773adSJohannes Berg  * @gfp: allocation flags
590804a773adSJohannes Berg  *
590904a773adSJohannes Berg  * This function notifies cfg80211 that the device joined an IBSS or
591004a773adSJohannes Berg  * switched to a different BSSID. Before this function can be called,
591104a773adSJohannes Berg  * either a beacon has to have been received from the IBSS, or one of
591204a773adSJohannes Berg  * the cfg80211_inform_bss{,_frame} functions must have been called
591304a773adSJohannes Berg  * with the locally generated beacon -- this guarantees that there is
591404a773adSJohannes Berg  * always a scan result for this IBSS. cfg80211 will handle the rest.
591504a773adSJohannes Berg  */
5916fe94f3a4SAntonio Quartulli void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid,
5917fe94f3a4SAntonio Quartulli 			  struct ieee80211_channel *channel, gfp_t gfp);
591804a773adSJohannes Berg 
59191f87f7d3SJohannes Berg /**
5920c93b5e71SJavier Cardona  * cfg80211_notify_new_candidate - notify cfg80211 of a new mesh peer candidate
5921c93b5e71SJavier Cardona  *
5922c93b5e71SJavier Cardona  * @dev: network device
5923c93b5e71SJavier Cardona  * @macaddr: the MAC address of the new candidate
5924c93b5e71SJavier Cardona  * @ie: information elements advertised by the peer candidate
59255ac4a12dSMatteo Croce  * @ie_len: length of the information elements buffer
5926c93b5e71SJavier Cardona  * @gfp: allocation flags
5927c93b5e71SJavier Cardona  *
5928c93b5e71SJavier Cardona  * This function notifies cfg80211 that the mesh peer candidate has been
5929c93b5e71SJavier Cardona  * detected, most likely via a beacon or, less likely, via a probe response.
5930c93b5e71SJavier Cardona  * cfg80211 then sends a notification to userspace.
5931c93b5e71SJavier Cardona  */
5932c93b5e71SJavier Cardona void cfg80211_notify_new_peer_candidate(struct net_device *dev,
5933ecbc12adSBob Copeland 		const u8 *macaddr, const u8 *ie, u8 ie_len,
5934ecbc12adSBob Copeland 		int sig_dbm, gfp_t gfp);
5935c93b5e71SJavier Cardona 
5936c93b5e71SJavier Cardona /**
5937d70e9693SJohannes Berg  * DOC: RFkill integration
5938d70e9693SJohannes Berg  *
5939d70e9693SJohannes Berg  * RFkill integration in cfg80211 is almost invisible to drivers,
5940d70e9693SJohannes Berg  * as cfg80211 automatically registers an rfkill instance for each
5941d70e9693SJohannes Berg  * wireless device it knows about. Soft kill is also translated
5942d70e9693SJohannes Berg  * into disconnecting and turning all interfaces off, drivers are
5943d70e9693SJohannes Berg  * expected to turn off the device when all interfaces are down.
5944d70e9693SJohannes Berg  *
5945d70e9693SJohannes Berg  * However, devices may have a hard RFkill line, in which case they
5946d70e9693SJohannes Berg  * also need to interact with the rfkill subsystem, via cfg80211.
5947d70e9693SJohannes Berg  * They can do this with a few helper functions documented here.
5948d70e9693SJohannes Berg  */
5949d70e9693SJohannes Berg 
5950d70e9693SJohannes Berg /**
59511f87f7d3SJohannes Berg  * wiphy_rfkill_set_hw_state - notify cfg80211 about hw block state
59521f87f7d3SJohannes Berg  * @wiphy: the wiphy
59531f87f7d3SJohannes Berg  * @blocked: block status
59541f87f7d3SJohannes Berg  */
59551f87f7d3SJohannes Berg void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked);
59561f87f7d3SJohannes Berg 
59571f87f7d3SJohannes Berg /**
59581f87f7d3SJohannes Berg  * wiphy_rfkill_start_polling - start polling rfkill
59591f87f7d3SJohannes Berg  * @wiphy: the wiphy
59601f87f7d3SJohannes Berg  */
59611f87f7d3SJohannes Berg void wiphy_rfkill_start_polling(struct wiphy *wiphy);
59621f87f7d3SJohannes Berg 
59631f87f7d3SJohannes Berg /**
59641f87f7d3SJohannes Berg  * wiphy_rfkill_stop_polling - stop polling rfkill
59651f87f7d3SJohannes Berg  * @wiphy: the wiphy
59661f87f7d3SJohannes Berg  */
59671f87f7d3SJohannes Berg void wiphy_rfkill_stop_polling(struct wiphy *wiphy);
59681f87f7d3SJohannes Berg 
5969ad7e718cSJohannes Berg /**
5970ad7e718cSJohannes Berg  * DOC: Vendor commands
5971ad7e718cSJohannes Berg  *
5972ad7e718cSJohannes Berg  * Occasionally, there are special protocol or firmware features that
5973ad7e718cSJohannes Berg  * can't be implemented very openly. For this and similar cases, the
5974ad7e718cSJohannes Berg  * vendor command functionality allows implementing the features with
5975ad7e718cSJohannes Berg  * (typically closed-source) userspace and firmware, using nl80211 as
5976ad7e718cSJohannes Berg  * the configuration mechanism.
5977ad7e718cSJohannes Berg  *
5978ad7e718cSJohannes Berg  * A driver supporting vendor commands must register them as an array
5979ad7e718cSJohannes Berg  * in struct wiphy, with handlers for each one, each command has an
5980ad7e718cSJohannes Berg  * OUI and sub command ID to identify it.
5981ad7e718cSJohannes Berg  *
5982ad7e718cSJohannes Berg  * Note that this feature should not be (ab)used to implement protocol
5983ad7e718cSJohannes Berg  * features that could openly be shared across drivers. In particular,
5984ad7e718cSJohannes Berg  * it must never be required to use vendor commands to implement any
5985ad7e718cSJohannes Berg  * "normal" functionality that higher-level userspace like connection
5986ad7e718cSJohannes Berg  * managers etc. need.
5987ad7e718cSJohannes Berg  */
5988ad7e718cSJohannes Berg 
5989ad7e718cSJohannes Berg struct sk_buff *__cfg80211_alloc_reply_skb(struct wiphy *wiphy,
5990ad7e718cSJohannes Berg 					   enum nl80211_commands cmd,
5991ad7e718cSJohannes Berg 					   enum nl80211_attrs attr,
5992ad7e718cSJohannes Berg 					   int approxlen);
5993ad7e718cSJohannes Berg 
5994567ffc35SJohannes Berg struct sk_buff *__cfg80211_alloc_event_skb(struct wiphy *wiphy,
59956c09e791SAhmad Kholaif 					   struct wireless_dev *wdev,
5996567ffc35SJohannes Berg 					   enum nl80211_commands cmd,
5997567ffc35SJohannes Berg 					   enum nl80211_attrs attr,
599855c1fdf0SJohannes Berg 					   unsigned int portid,
5999567ffc35SJohannes Berg 					   int vendor_event_idx,
6000567ffc35SJohannes Berg 					   int approxlen, gfp_t gfp);
6001567ffc35SJohannes Berg 
6002567ffc35SJohannes Berg void __cfg80211_send_event_skb(struct sk_buff *skb, gfp_t gfp);
6003567ffc35SJohannes Berg 
6004ad7e718cSJohannes Berg /**
6005ad7e718cSJohannes Berg  * cfg80211_vendor_cmd_alloc_reply_skb - allocate vendor command reply
6006ad7e718cSJohannes Berg  * @wiphy: the wiphy
6007ad7e718cSJohannes Berg  * @approxlen: an upper bound of the length of the data that will
6008ad7e718cSJohannes Berg  *	be put into the skb
6009ad7e718cSJohannes Berg  *
6010ad7e718cSJohannes Berg  * This function allocates and pre-fills an skb for a reply to
6011ad7e718cSJohannes Berg  * a vendor command. Since it is intended for a reply, calling
6012ad7e718cSJohannes Berg  * it outside of a vendor command's doit() operation is invalid.
6013ad7e718cSJohannes Berg  *
6014ad7e718cSJohannes Berg  * The returned skb is pre-filled with some identifying data in
6015ad7e718cSJohannes Berg  * a way that any data that is put into the skb (with skb_put(),
6016ad7e718cSJohannes Berg  * nla_put() or similar) will end up being within the
6017ad7e718cSJohannes Berg  * %NL80211_ATTR_VENDOR_DATA attribute, so all that needs to be done
6018ad7e718cSJohannes Berg  * with the skb is adding data for the corresponding userspace tool
6019ad7e718cSJohannes Berg  * which can then read that data out of the vendor data attribute.
6020ad7e718cSJohannes Berg  * You must not modify the skb in any other way.
6021ad7e718cSJohannes Berg  *
6022ad7e718cSJohannes Berg  * When done, call cfg80211_vendor_cmd_reply() with the skb and return
6023ad7e718cSJohannes Berg  * its error code as the result of the doit() operation.
6024ad7e718cSJohannes Berg  *
6025ad7e718cSJohannes Berg  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
6026ad7e718cSJohannes Berg  */
6027ad7e718cSJohannes Berg static inline struct sk_buff *
6028ad7e718cSJohannes Berg cfg80211_vendor_cmd_alloc_reply_skb(struct wiphy *wiphy, int approxlen)
6029ad7e718cSJohannes Berg {
6030ad7e718cSJohannes Berg 	return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_VENDOR,
6031ad7e718cSJohannes Berg 					  NL80211_ATTR_VENDOR_DATA, approxlen);
6032ad7e718cSJohannes Berg }
6033ad7e718cSJohannes Berg 
6034ad7e718cSJohannes Berg /**
6035ad7e718cSJohannes Berg  * cfg80211_vendor_cmd_reply - send the reply skb
6036ad7e718cSJohannes Berg  * @skb: The skb, must have been allocated with
6037ad7e718cSJohannes Berg  *	cfg80211_vendor_cmd_alloc_reply_skb()
6038ad7e718cSJohannes Berg  *
6039ad7e718cSJohannes Berg  * Since calling this function will usually be the last thing
6040ad7e718cSJohannes Berg  * before returning from the vendor command doit() you should
6041ad7e718cSJohannes Berg  * return the error code.  Note that this function consumes the
6042ad7e718cSJohannes Berg  * skb regardless of the return value.
6043ad7e718cSJohannes Berg  *
6044ad7e718cSJohannes Berg  * Return: An error code or 0 on success.
6045ad7e718cSJohannes Berg  */
6046ad7e718cSJohannes Berg int cfg80211_vendor_cmd_reply(struct sk_buff *skb);
6047ad7e718cSJohannes Berg 
6048567ffc35SJohannes Berg /**
604955c1fdf0SJohannes Berg  * cfg80211_vendor_cmd_get_sender
605055c1fdf0SJohannes Berg  * @wiphy: the wiphy
605155c1fdf0SJohannes Berg  *
605255c1fdf0SJohannes Berg  * Return the current netlink port ID in a vendor command handler.
605355c1fdf0SJohannes Berg  * Valid to call only there.
605455c1fdf0SJohannes Berg  */
605555c1fdf0SJohannes Berg unsigned int cfg80211_vendor_cmd_get_sender(struct wiphy *wiphy);
605655c1fdf0SJohannes Berg 
605755c1fdf0SJohannes Berg /**
6058567ffc35SJohannes Berg  * cfg80211_vendor_event_alloc - allocate vendor-specific event skb
6059567ffc35SJohannes Berg  * @wiphy: the wiphy
60606c09e791SAhmad Kholaif  * @wdev: the wireless device
6061567ffc35SJohannes Berg  * @event_idx: index of the vendor event in the wiphy's vendor_events
6062567ffc35SJohannes Berg  * @approxlen: an upper bound of the length of the data that will
6063567ffc35SJohannes Berg  *	be put into the skb
6064567ffc35SJohannes Berg  * @gfp: allocation flags
6065567ffc35SJohannes Berg  *
6066567ffc35SJohannes Berg  * This function allocates and pre-fills an skb for an event on the
6067567ffc35SJohannes Berg  * vendor-specific multicast group.
6068567ffc35SJohannes Berg  *
60696c09e791SAhmad Kholaif  * If wdev != NULL, both the ifindex and identifier of the specified
60706c09e791SAhmad Kholaif  * wireless device are added to the event message before the vendor data
60716c09e791SAhmad Kholaif  * attribute.
60726c09e791SAhmad Kholaif  *
6073567ffc35SJohannes Berg  * When done filling the skb, call cfg80211_vendor_event() with the
6074567ffc35SJohannes Berg  * skb to send the event.
6075567ffc35SJohannes Berg  *
6076567ffc35SJohannes Berg  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
6077567ffc35SJohannes Berg  */
6078567ffc35SJohannes Berg static inline struct sk_buff *
60796c09e791SAhmad Kholaif cfg80211_vendor_event_alloc(struct wiphy *wiphy, struct wireless_dev *wdev,
60806c09e791SAhmad Kholaif 			     int approxlen, int event_idx, gfp_t gfp)
6081567ffc35SJohannes Berg {
60826c09e791SAhmad Kholaif 	return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR,
6083567ffc35SJohannes Berg 					  NL80211_ATTR_VENDOR_DATA,
608455c1fdf0SJohannes Berg 					  0, event_idx, approxlen, gfp);
608555c1fdf0SJohannes Berg }
608655c1fdf0SJohannes Berg 
608755c1fdf0SJohannes Berg /**
608855c1fdf0SJohannes Berg  * cfg80211_vendor_event_alloc_ucast - alloc unicast vendor-specific event skb
608955c1fdf0SJohannes Berg  * @wiphy: the wiphy
609055c1fdf0SJohannes Berg  * @wdev: the wireless device
609155c1fdf0SJohannes Berg  * @event_idx: index of the vendor event in the wiphy's vendor_events
609255c1fdf0SJohannes Berg  * @portid: port ID of the receiver
609355c1fdf0SJohannes Berg  * @approxlen: an upper bound of the length of the data that will
609455c1fdf0SJohannes Berg  *	be put into the skb
609555c1fdf0SJohannes Berg  * @gfp: allocation flags
609655c1fdf0SJohannes Berg  *
609755c1fdf0SJohannes Berg  * This function allocates and pre-fills an skb for an event to send to
609855c1fdf0SJohannes Berg  * a specific (userland) socket. This socket would previously have been
609955c1fdf0SJohannes Berg  * obtained by cfg80211_vendor_cmd_get_sender(), and the caller MUST take
610055c1fdf0SJohannes Berg  * care to register a netlink notifier to see when the socket closes.
610155c1fdf0SJohannes Berg  *
610255c1fdf0SJohannes Berg  * If wdev != NULL, both the ifindex and identifier of the specified
610355c1fdf0SJohannes Berg  * wireless device are added to the event message before the vendor data
610455c1fdf0SJohannes Berg  * attribute.
610555c1fdf0SJohannes Berg  *
610655c1fdf0SJohannes Berg  * When done filling the skb, call cfg80211_vendor_event() with the
610755c1fdf0SJohannes Berg  * skb to send the event.
610855c1fdf0SJohannes Berg  *
610955c1fdf0SJohannes Berg  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
611055c1fdf0SJohannes Berg  */
611155c1fdf0SJohannes Berg static inline struct sk_buff *
611255c1fdf0SJohannes Berg cfg80211_vendor_event_alloc_ucast(struct wiphy *wiphy,
611355c1fdf0SJohannes Berg 				  struct wireless_dev *wdev,
611455c1fdf0SJohannes Berg 				  unsigned int portid, int approxlen,
611555c1fdf0SJohannes Berg 				  int event_idx, gfp_t gfp)
611655c1fdf0SJohannes Berg {
611755c1fdf0SJohannes Berg 	return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR,
611855c1fdf0SJohannes Berg 					  NL80211_ATTR_VENDOR_DATA,
611955c1fdf0SJohannes Berg 					  portid, event_idx, approxlen, gfp);
6120567ffc35SJohannes Berg }
6121567ffc35SJohannes Berg 
6122567ffc35SJohannes Berg /**
6123567ffc35SJohannes Berg  * cfg80211_vendor_event - send the event
6124567ffc35SJohannes Berg  * @skb: The skb, must have been allocated with cfg80211_vendor_event_alloc()
6125567ffc35SJohannes Berg  * @gfp: allocation flags
6126567ffc35SJohannes Berg  *
6127567ffc35SJohannes Berg  * This function sends the given @skb, which must have been allocated
6128567ffc35SJohannes Berg  * by cfg80211_vendor_event_alloc(), as an event. It always consumes it.
6129567ffc35SJohannes Berg  */
6130567ffc35SJohannes Berg static inline void cfg80211_vendor_event(struct sk_buff *skb, gfp_t gfp)
6131567ffc35SJohannes Berg {
6132567ffc35SJohannes Berg 	__cfg80211_send_event_skb(skb, gfp);
6133567ffc35SJohannes Berg }
6134567ffc35SJohannes Berg 
6135aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE
6136aff89a9bSJohannes Berg /**
6137d70e9693SJohannes Berg  * DOC: Test mode
6138d70e9693SJohannes Berg  *
6139d70e9693SJohannes Berg  * Test mode is a set of utility functions to allow drivers to
6140d70e9693SJohannes Berg  * interact with driver-specific tools to aid, for instance,
6141d70e9693SJohannes Berg  * factory programming.
6142d70e9693SJohannes Berg  *
6143d70e9693SJohannes Berg  * This chapter describes how drivers interact with it, for more
6144d70e9693SJohannes Berg  * information see the nl80211 book's chapter on it.
6145d70e9693SJohannes Berg  */
6146d70e9693SJohannes Berg 
6147d70e9693SJohannes Berg /**
6148aff89a9bSJohannes Berg  * cfg80211_testmode_alloc_reply_skb - allocate testmode reply
6149aff89a9bSJohannes Berg  * @wiphy: the wiphy
6150aff89a9bSJohannes Berg  * @approxlen: an upper bound of the length of the data that will
6151aff89a9bSJohannes Berg  *	be put into the skb
6152aff89a9bSJohannes Berg  *
6153aff89a9bSJohannes Berg  * This function allocates and pre-fills an skb for a reply to
6154aff89a9bSJohannes Berg  * the testmode command. Since it is intended for a reply, calling
6155aff89a9bSJohannes Berg  * it outside of the @testmode_cmd operation is invalid.
6156aff89a9bSJohannes Berg  *
61570ae997dcSYacine Belkadi  * The returned skb is pre-filled with the wiphy index and set up in
61580ae997dcSYacine Belkadi  * a way that any data that is put into the skb (with skb_put(),
61590ae997dcSYacine Belkadi  * nla_put() or similar) will end up being within the
61600ae997dcSYacine Belkadi  * %NL80211_ATTR_TESTDATA attribute, so all that needs to be done
61610ae997dcSYacine Belkadi  * with the skb is adding data for the corresponding userspace tool
61620ae997dcSYacine Belkadi  * which can then read that data out of the testdata attribute. You
61630ae997dcSYacine Belkadi  * must not modify the skb in any other way.
6164aff89a9bSJohannes Berg  *
6165aff89a9bSJohannes Berg  * When done, call cfg80211_testmode_reply() with the skb and return
6166aff89a9bSJohannes Berg  * its error code as the result of the @testmode_cmd operation.
61670ae997dcSYacine Belkadi  *
61680ae997dcSYacine Belkadi  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
6169aff89a9bSJohannes Berg  */
6170ad7e718cSJohannes Berg static inline struct sk_buff *
6171ad7e718cSJohannes Berg cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy, int approxlen)
6172ad7e718cSJohannes Berg {
6173ad7e718cSJohannes Berg 	return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_TESTMODE,
6174ad7e718cSJohannes Berg 					  NL80211_ATTR_TESTDATA, approxlen);
6175ad7e718cSJohannes Berg }
6176aff89a9bSJohannes Berg 
6177aff89a9bSJohannes Berg /**
6178aff89a9bSJohannes Berg  * cfg80211_testmode_reply - send the reply skb
6179aff89a9bSJohannes Berg  * @skb: The skb, must have been allocated with
6180aff89a9bSJohannes Berg  *	cfg80211_testmode_alloc_reply_skb()
6181aff89a9bSJohannes Berg  *
61820ae997dcSYacine Belkadi  * Since calling this function will usually be the last thing
61830ae997dcSYacine Belkadi  * before returning from the @testmode_cmd you should return
61840ae997dcSYacine Belkadi  * the error code.  Note that this function consumes the skb
61850ae997dcSYacine Belkadi  * regardless of the return value.
61860ae997dcSYacine Belkadi  *
61870ae997dcSYacine Belkadi  * Return: An error code or 0 on success.
6188aff89a9bSJohannes Berg  */
6189ad7e718cSJohannes Berg static inline int cfg80211_testmode_reply(struct sk_buff *skb)
6190ad7e718cSJohannes Berg {
6191ad7e718cSJohannes Berg 	return cfg80211_vendor_cmd_reply(skb);
6192ad7e718cSJohannes Berg }
6193aff89a9bSJohannes Berg 
6194aff89a9bSJohannes Berg /**
6195aff89a9bSJohannes Berg  * cfg80211_testmode_alloc_event_skb - allocate testmode event
6196aff89a9bSJohannes Berg  * @wiphy: the wiphy
6197aff89a9bSJohannes Berg  * @approxlen: an upper bound of the length of the data that will
6198aff89a9bSJohannes Berg  *	be put into the skb
6199aff89a9bSJohannes Berg  * @gfp: allocation flags
6200aff89a9bSJohannes Berg  *
6201aff89a9bSJohannes Berg  * This function allocates and pre-fills an skb for an event on the
6202aff89a9bSJohannes Berg  * testmode multicast group.
6203aff89a9bSJohannes Berg  *
62040ae997dcSYacine Belkadi  * The returned skb is set up in the same way as with
62050ae997dcSYacine Belkadi  * cfg80211_testmode_alloc_reply_skb() but prepared for an event. As
62060ae997dcSYacine Belkadi  * there, you should simply add data to it that will then end up in the
62070ae997dcSYacine Belkadi  * %NL80211_ATTR_TESTDATA attribute. Again, you must not modify the skb
62080ae997dcSYacine Belkadi  * in any other way.
6209aff89a9bSJohannes Berg  *
6210aff89a9bSJohannes Berg  * When done filling the skb, call cfg80211_testmode_event() with the
6211aff89a9bSJohannes Berg  * skb to send the event.
62120ae997dcSYacine Belkadi  *
62130ae997dcSYacine Belkadi  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
6214aff89a9bSJohannes Berg  */
6215567ffc35SJohannes Berg static inline struct sk_buff *
6216567ffc35SJohannes Berg cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy, int approxlen, gfp_t gfp)
6217567ffc35SJohannes Berg {
62186c09e791SAhmad Kholaif 	return __cfg80211_alloc_event_skb(wiphy, NULL, NL80211_CMD_TESTMODE,
621955c1fdf0SJohannes Berg 					  NL80211_ATTR_TESTDATA, 0, -1,
6220567ffc35SJohannes Berg 					  approxlen, gfp);
6221567ffc35SJohannes Berg }
6222aff89a9bSJohannes Berg 
6223aff89a9bSJohannes Berg /**
6224aff89a9bSJohannes Berg  * cfg80211_testmode_event - send the event
6225aff89a9bSJohannes Berg  * @skb: The skb, must have been allocated with
6226aff89a9bSJohannes Berg  *	cfg80211_testmode_alloc_event_skb()
6227aff89a9bSJohannes Berg  * @gfp: allocation flags
6228aff89a9bSJohannes Berg  *
6229aff89a9bSJohannes Berg  * This function sends the given @skb, which must have been allocated
6230aff89a9bSJohannes Berg  * by cfg80211_testmode_alloc_event_skb(), as an event. It always
6231aff89a9bSJohannes Berg  * consumes it.
6232aff89a9bSJohannes Berg  */
6233567ffc35SJohannes Berg static inline void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp)
6234567ffc35SJohannes Berg {
6235567ffc35SJohannes Berg 	__cfg80211_send_event_skb(skb, gfp);
6236567ffc35SJohannes Berg }
6237aff89a9bSJohannes Berg 
6238aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd)	.testmode_cmd = (cmd),
623971063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd)	.testmode_dump = (cmd),
6240aff89a9bSJohannes Berg #else
6241aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd)
624271063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd)
6243aff89a9bSJohannes Berg #endif
6244aff89a9bSJohannes Berg 
6245b23aa676SSamuel Ortiz /**
624676804d28SArend Van Spriel  * struct cfg80211_fils_resp_params - FILS connection response params
624776804d28SArend Van Spriel  * @kek: KEK derived from a successful FILS connection (may be %NULL)
624876804d28SArend Van Spriel  * @kek_len: Length of @fils_kek in octets
624976804d28SArend Van Spriel  * @update_erp_next_seq_num: Boolean value to specify whether the value in
625076804d28SArend Van Spriel  *	@erp_next_seq_num is valid.
625176804d28SArend Van Spriel  * @erp_next_seq_num: The next sequence number to use in ERP message in
625276804d28SArend Van Spriel  *	FILS Authentication. This value should be specified irrespective of the
625376804d28SArend Van Spriel  *	status for a FILS connection.
625476804d28SArend Van Spriel  * @pmk: A new PMK if derived from a successful FILS connection (may be %NULL).
625576804d28SArend Van Spriel  * @pmk_len: Length of @pmk in octets
625676804d28SArend Van Spriel  * @pmkid: A new PMKID if derived from a successful FILS connection or the PMKID
625776804d28SArend Van Spriel  *	used for this FILS connection (may be %NULL).
625876804d28SArend Van Spriel  */
625976804d28SArend Van Spriel struct cfg80211_fils_resp_params {
626076804d28SArend Van Spriel 	const u8 *kek;
626176804d28SArend Van Spriel 	size_t kek_len;
626276804d28SArend Van Spriel 	bool update_erp_next_seq_num;
626376804d28SArend Van Spriel 	u16 erp_next_seq_num;
626476804d28SArend Van Spriel 	const u8 *pmk;
626576804d28SArend Van Spriel 	size_t pmk_len;
626676804d28SArend Van Spriel 	const u8 *pmkid;
626776804d28SArend Van Spriel };
626876804d28SArend Van Spriel 
626976804d28SArend Van Spriel /**
62705349a0f7SVidyullatha Kanchanapally  * struct cfg80211_connect_resp_params - Connection response params
62715349a0f7SVidyullatha Kanchanapally  * @status: Status code, %WLAN_STATUS_SUCCESS for successful connection, use
62725349a0f7SVidyullatha Kanchanapally  *	%WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
62735349a0f7SVidyullatha Kanchanapally  *	the real status code for failures. If this call is used to report a
62745349a0f7SVidyullatha Kanchanapally  *	failure due to a timeout (e.g., not receiving an Authentication frame
62755349a0f7SVidyullatha Kanchanapally  *	from the AP) instead of an explicit rejection by the AP, -1 is used to
62765349a0f7SVidyullatha Kanchanapally  *	indicate that this is a failure, but without a status code.
62775349a0f7SVidyullatha Kanchanapally  *	@timeout_reason is used to report the reason for the timeout in that
62785349a0f7SVidyullatha Kanchanapally  *	case.
62795349a0f7SVidyullatha Kanchanapally  * @bssid: The BSSID of the AP (may be %NULL)
62805349a0f7SVidyullatha Kanchanapally  * @bss: Entry of bss to which STA got connected to, can be obtained through
6281a3ce17d1SChaitanya Tata  *	cfg80211_get_bss() (may be %NULL). But it is recommended to store the
6282a3ce17d1SChaitanya Tata  *	bss from the connect_request and hold a reference to it and return
6283a3ce17d1SChaitanya Tata  *	through this param to avoid a warning if the bss is expired during the
6284a3ce17d1SChaitanya Tata  *	connection, esp. for those drivers implementing connect op.
6285a3ce17d1SChaitanya Tata  *	Only one parameter among @bssid and @bss needs to be specified.
62865349a0f7SVidyullatha Kanchanapally  * @req_ie: Association request IEs (may be %NULL)
62875349a0f7SVidyullatha Kanchanapally  * @req_ie_len: Association request IEs length
62885349a0f7SVidyullatha Kanchanapally  * @resp_ie: Association response IEs (may be %NULL)
62895349a0f7SVidyullatha Kanchanapally  * @resp_ie_len: Association response IEs length
629076804d28SArend Van Spriel  * @fils: FILS connection response parameters.
62915349a0f7SVidyullatha Kanchanapally  * @timeout_reason: Reason for connection timeout. This is used when the
62925349a0f7SVidyullatha Kanchanapally  *	connection fails due to a timeout instead of an explicit rejection from
62935349a0f7SVidyullatha Kanchanapally  *	the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is
62945349a0f7SVidyullatha Kanchanapally  *	not known. This value is used only if @status < 0 to indicate that the
62955349a0f7SVidyullatha Kanchanapally  *	failure is due to a timeout and not due to explicit rejection by the AP.
62965349a0f7SVidyullatha Kanchanapally  *	This value is ignored in other cases (@status >= 0).
62975349a0f7SVidyullatha Kanchanapally  */
62985349a0f7SVidyullatha Kanchanapally struct cfg80211_connect_resp_params {
62995349a0f7SVidyullatha Kanchanapally 	int status;
63005349a0f7SVidyullatha Kanchanapally 	const u8 *bssid;
63015349a0f7SVidyullatha Kanchanapally 	struct cfg80211_bss *bss;
63025349a0f7SVidyullatha Kanchanapally 	const u8 *req_ie;
63035349a0f7SVidyullatha Kanchanapally 	size_t req_ie_len;
63045349a0f7SVidyullatha Kanchanapally 	const u8 *resp_ie;
63055349a0f7SVidyullatha Kanchanapally 	size_t resp_ie_len;
630676804d28SArend Van Spriel 	struct cfg80211_fils_resp_params fils;
63075349a0f7SVidyullatha Kanchanapally 	enum nl80211_timeout_reason timeout_reason;
63085349a0f7SVidyullatha Kanchanapally };
63095349a0f7SVidyullatha Kanchanapally 
63105349a0f7SVidyullatha Kanchanapally /**
63115349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_done - notify cfg80211 of connection result
63125349a0f7SVidyullatha Kanchanapally  *
63135349a0f7SVidyullatha Kanchanapally  * @dev: network device
63145349a0f7SVidyullatha Kanchanapally  * @params: connection response parameters
63155349a0f7SVidyullatha Kanchanapally  * @gfp: allocation flags
63165349a0f7SVidyullatha Kanchanapally  *
63175349a0f7SVidyullatha Kanchanapally  * It should be called by the underlying driver once execution of the connection
63185349a0f7SVidyullatha Kanchanapally  * request from connect() has been completed. This is similar to
63195349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_bss(), but takes a structure pointer for connection response
63205349a0f7SVidyullatha Kanchanapally  * parameters. Only one of the functions among cfg80211_connect_bss(),
63215349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_result(), cfg80211_connect_timeout(),
63225349a0f7SVidyullatha Kanchanapally  * and cfg80211_connect_done() should be called.
63235349a0f7SVidyullatha Kanchanapally  */
63245349a0f7SVidyullatha Kanchanapally void cfg80211_connect_done(struct net_device *dev,
63255349a0f7SVidyullatha Kanchanapally 			   struct cfg80211_connect_resp_params *params,
63265349a0f7SVidyullatha Kanchanapally 			   gfp_t gfp);
63275349a0f7SVidyullatha Kanchanapally 
63285349a0f7SVidyullatha Kanchanapally /**
6329e7054989SKanchanapally, Vidyullatha  * cfg80211_connect_bss - notify cfg80211 of connection result
6330e7054989SKanchanapally, Vidyullatha  *
6331e7054989SKanchanapally, Vidyullatha  * @dev: network device
6332e7054989SKanchanapally, Vidyullatha  * @bssid: the BSSID of the AP
6333a3ce17d1SChaitanya Tata  * @bss: Entry of bss to which STA got connected to, can be obtained through
6334a3ce17d1SChaitanya Tata  *	cfg80211_get_bss() (may be %NULL). But it is recommended to store the
6335a3ce17d1SChaitanya Tata  *	bss from the connect_request and hold a reference to it and return
6336a3ce17d1SChaitanya Tata  *	through this param to avoid a warning if the bss is expired during the
6337a3ce17d1SChaitanya Tata  *	connection, esp. for those drivers implementing connect op.
6338a3ce17d1SChaitanya Tata  *	Only one parameter among @bssid and @bss needs to be specified.
6339e7054989SKanchanapally, Vidyullatha  * @req_ie: association request IEs (maybe be %NULL)
6340e7054989SKanchanapally, Vidyullatha  * @req_ie_len: association request IEs length
6341e7054989SKanchanapally, Vidyullatha  * @resp_ie: association response IEs (may be %NULL)
6342e7054989SKanchanapally, Vidyullatha  * @resp_ie_len: assoc response IEs length
6343c88215d7SJouni Malinen  * @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use
6344e7054989SKanchanapally, Vidyullatha  *	%WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
6345c88215d7SJouni Malinen  *	the real status code for failures. If this call is used to report a
6346c88215d7SJouni Malinen  *	failure due to a timeout (e.g., not receiving an Authentication frame
6347c88215d7SJouni Malinen  *	from the AP) instead of an explicit rejection by the AP, -1 is used to
6348c88215d7SJouni Malinen  *	indicate that this is a failure, but without a status code.
6349c88215d7SJouni Malinen  *	@timeout_reason is used to report the reason for the timeout in that
6350c88215d7SJouni Malinen  *	case.
6351e7054989SKanchanapally, Vidyullatha  * @gfp: allocation flags
63523093ebbeSPurushottam Kushwaha  * @timeout_reason: reason for connection timeout. This is used when the
63533093ebbeSPurushottam Kushwaha  *	connection fails due to a timeout instead of an explicit rejection from
63543093ebbeSPurushottam Kushwaha  *	the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is
63553093ebbeSPurushottam Kushwaha  *	not known. This value is used only if @status < 0 to indicate that the
63563093ebbeSPurushottam Kushwaha  *	failure is due to a timeout and not due to explicit rejection by the AP.
63573093ebbeSPurushottam Kushwaha  *	This value is ignored in other cases (@status >= 0).
6358e7054989SKanchanapally, Vidyullatha  *
6359c88215d7SJouni Malinen  * It should be called by the underlying driver once execution of the connection
6360c88215d7SJouni Malinen  * request from connect() has been completed. This is similar to
6361c88215d7SJouni Malinen  * cfg80211_connect_result(), but with the option of identifying the exact bss
63625349a0f7SVidyullatha Kanchanapally  * entry for the connection. Only one of the functions among
63635349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_bss(), cfg80211_connect_result(),
63645349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
6365e7054989SKanchanapally, Vidyullatha  */
63665349a0f7SVidyullatha Kanchanapally static inline void
63675349a0f7SVidyullatha Kanchanapally cfg80211_connect_bss(struct net_device *dev, const u8 *bssid,
6368e7054989SKanchanapally, Vidyullatha 		     struct cfg80211_bss *bss, const u8 *req_ie,
6369e7054989SKanchanapally, Vidyullatha 		     size_t req_ie_len, const u8 *resp_ie,
63703093ebbeSPurushottam Kushwaha 		     size_t resp_ie_len, int status, gfp_t gfp,
63715349a0f7SVidyullatha Kanchanapally 		     enum nl80211_timeout_reason timeout_reason)
63725349a0f7SVidyullatha Kanchanapally {
63735349a0f7SVidyullatha Kanchanapally 	struct cfg80211_connect_resp_params params;
63745349a0f7SVidyullatha Kanchanapally 
63755349a0f7SVidyullatha Kanchanapally 	memset(&params, 0, sizeof(params));
63765349a0f7SVidyullatha Kanchanapally 	params.status = status;
63775349a0f7SVidyullatha Kanchanapally 	params.bssid = bssid;
63785349a0f7SVidyullatha Kanchanapally 	params.bss = bss;
63795349a0f7SVidyullatha Kanchanapally 	params.req_ie = req_ie;
63805349a0f7SVidyullatha Kanchanapally 	params.req_ie_len = req_ie_len;
63815349a0f7SVidyullatha Kanchanapally 	params.resp_ie = resp_ie;
63825349a0f7SVidyullatha Kanchanapally 	params.resp_ie_len = resp_ie_len;
63835349a0f7SVidyullatha Kanchanapally 	params.timeout_reason = timeout_reason;
63845349a0f7SVidyullatha Kanchanapally 
63855349a0f7SVidyullatha Kanchanapally 	cfg80211_connect_done(dev, &params, gfp);
63865349a0f7SVidyullatha Kanchanapally }
6387e7054989SKanchanapally, Vidyullatha 
6388e7054989SKanchanapally, Vidyullatha /**
6389b23aa676SSamuel Ortiz  * cfg80211_connect_result - notify cfg80211 of connection result
6390b23aa676SSamuel Ortiz  *
6391b23aa676SSamuel Ortiz  * @dev: network device
6392b23aa676SSamuel Ortiz  * @bssid: the BSSID of the AP
6393b23aa676SSamuel Ortiz  * @req_ie: association request IEs (maybe be %NULL)
6394b23aa676SSamuel Ortiz  * @req_ie_len: association request IEs length
6395b23aa676SSamuel Ortiz  * @resp_ie: association response IEs (may be %NULL)
6396b23aa676SSamuel Ortiz  * @resp_ie_len: assoc response IEs length
6397c88215d7SJouni Malinen  * @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use
6398b23aa676SSamuel Ortiz  *	%WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
6399b23aa676SSamuel Ortiz  *	the real status code for failures.
6400b23aa676SSamuel Ortiz  * @gfp: allocation flags
6401b23aa676SSamuel Ortiz  *
6402c88215d7SJouni Malinen  * It should be called by the underlying driver once execution of the connection
6403c88215d7SJouni Malinen  * request from connect() has been completed. This is similar to
6404c88215d7SJouni Malinen  * cfg80211_connect_bss() which allows the exact bss entry to be specified. Only
64055349a0f7SVidyullatha Kanchanapally  * one of the functions among cfg80211_connect_bss(), cfg80211_connect_result(),
64065349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
6407b23aa676SSamuel Ortiz  */
6408e7054989SKanchanapally, Vidyullatha static inline void
6409e7054989SKanchanapally, Vidyullatha cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
6410b23aa676SSamuel Ortiz 			const u8 *req_ie, size_t req_ie_len,
6411b23aa676SSamuel Ortiz 			const u8 *resp_ie, size_t resp_ie_len,
6412e7054989SKanchanapally, Vidyullatha 			u16 status, gfp_t gfp)
6413e7054989SKanchanapally, Vidyullatha {
6414e7054989SKanchanapally, Vidyullatha 	cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, resp_ie,
64153093ebbeSPurushottam Kushwaha 			     resp_ie_len, status, gfp,
64163093ebbeSPurushottam Kushwaha 			     NL80211_TIMEOUT_UNSPECIFIED);
6417e7054989SKanchanapally, Vidyullatha }
6418b23aa676SSamuel Ortiz 
6419b23aa676SSamuel Ortiz /**
6420bf1ecd21SJouni Malinen  * cfg80211_connect_timeout - notify cfg80211 of connection timeout
6421bf1ecd21SJouni Malinen  *
6422bf1ecd21SJouni Malinen  * @dev: network device
6423bf1ecd21SJouni Malinen  * @bssid: the BSSID of the AP
6424bf1ecd21SJouni Malinen  * @req_ie: association request IEs (maybe be %NULL)
6425bf1ecd21SJouni Malinen  * @req_ie_len: association request IEs length
6426bf1ecd21SJouni Malinen  * @gfp: allocation flags
64273093ebbeSPurushottam Kushwaha  * @timeout_reason: reason for connection timeout.
6428bf1ecd21SJouni Malinen  *
6429bf1ecd21SJouni Malinen  * It should be called by the underlying driver whenever connect() has failed
6430bf1ecd21SJouni Malinen  * in a sequence where no explicit authentication/association rejection was
6431bf1ecd21SJouni Malinen  * received from the AP. This could happen, e.g., due to not being able to send
6432bf1ecd21SJouni Malinen  * out the Authentication or Association Request frame or timing out while
64335349a0f7SVidyullatha Kanchanapally  * waiting for the response. Only one of the functions among
64345349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_bss(), cfg80211_connect_result(),
64355349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
6436bf1ecd21SJouni Malinen  */
6437bf1ecd21SJouni Malinen static inline void
6438bf1ecd21SJouni Malinen cfg80211_connect_timeout(struct net_device *dev, const u8 *bssid,
64393093ebbeSPurushottam Kushwaha 			 const u8 *req_ie, size_t req_ie_len, gfp_t gfp,
64403093ebbeSPurushottam Kushwaha 			 enum nl80211_timeout_reason timeout_reason)
6441bf1ecd21SJouni Malinen {
6442bf1ecd21SJouni Malinen 	cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, NULL, 0, -1,
64433093ebbeSPurushottam Kushwaha 			     gfp, timeout_reason);
6444bf1ecd21SJouni Malinen }
6445bf1ecd21SJouni Malinen 
6446bf1ecd21SJouni Malinen /**
644729ce6ecbSAvraham Stern  * struct cfg80211_roam_info - driver initiated roaming information
644829ce6ecbSAvraham Stern  *
644929ce6ecbSAvraham Stern  * @channel: the channel of the new AP
645029ce6ecbSAvraham Stern  * @bss: entry of bss to which STA got roamed (may be %NULL if %bssid is set)
645129ce6ecbSAvraham Stern  * @bssid: the BSSID of the new AP (may be %NULL if %bss is set)
645229ce6ecbSAvraham Stern  * @req_ie: association request IEs (maybe be %NULL)
645329ce6ecbSAvraham Stern  * @req_ie_len: association request IEs length
645429ce6ecbSAvraham Stern  * @resp_ie: association response IEs (may be %NULL)
645529ce6ecbSAvraham Stern  * @resp_ie_len: assoc response IEs length
6456e841b7b1SArend Van Spriel  * @fils: FILS related roaming information.
645729ce6ecbSAvraham Stern  */
645829ce6ecbSAvraham Stern struct cfg80211_roam_info {
645929ce6ecbSAvraham Stern 	struct ieee80211_channel *channel;
646029ce6ecbSAvraham Stern 	struct cfg80211_bss *bss;
646129ce6ecbSAvraham Stern 	const u8 *bssid;
646229ce6ecbSAvraham Stern 	const u8 *req_ie;
646329ce6ecbSAvraham Stern 	size_t req_ie_len;
646429ce6ecbSAvraham Stern 	const u8 *resp_ie;
646529ce6ecbSAvraham Stern 	size_t resp_ie_len;
6466e841b7b1SArend Van Spriel 	struct cfg80211_fils_resp_params fils;
646729ce6ecbSAvraham Stern };
646829ce6ecbSAvraham Stern 
646929ce6ecbSAvraham Stern /**
6470b23aa676SSamuel Ortiz  * cfg80211_roamed - notify cfg80211 of roaming
6471b23aa676SSamuel Ortiz  *
6472b23aa676SSamuel Ortiz  * @dev: network device
647329ce6ecbSAvraham Stern  * @info: information about the new BSS. struct &cfg80211_roam_info.
6474b23aa676SSamuel Ortiz  * @gfp: allocation flags
6475b23aa676SSamuel Ortiz  *
647629ce6ecbSAvraham Stern  * This function may be called with the driver passing either the BSSID of the
647729ce6ecbSAvraham Stern  * new AP or passing the bss entry to avoid a race in timeout of the bss entry.
647829ce6ecbSAvraham Stern  * It should be called by the underlying driver whenever it roamed from one AP
647929ce6ecbSAvraham Stern  * to another while connected. Drivers which have roaming implemented in
648029ce6ecbSAvraham Stern  * firmware should pass the bss entry to avoid a race in bss entry timeout where
648129ce6ecbSAvraham Stern  * the bss entry of the new AP is seen in the driver, but gets timed out by the
648229ce6ecbSAvraham Stern  * time it is accessed in __cfg80211_roamed() due to delay in scheduling
6483adbde344SVasanthakumar Thiagarajan  * rdev->event_work. In case of any failures, the reference is released
648429ce6ecbSAvraham Stern  * either in cfg80211_roamed() or in __cfg80211_romed(), Otherwise, it will be
648529ce6ecbSAvraham Stern  * released while diconneting from the current bss.
6486adbde344SVasanthakumar Thiagarajan  */
648729ce6ecbSAvraham Stern void cfg80211_roamed(struct net_device *dev, struct cfg80211_roam_info *info,
648829ce6ecbSAvraham Stern 		     gfp_t gfp);
6489adbde344SVasanthakumar Thiagarajan 
6490adbde344SVasanthakumar Thiagarajan /**
6491503c1fb9SAvraham Stern  * cfg80211_port_authorized - notify cfg80211 of successful security association
6492503c1fb9SAvraham Stern  *
6493503c1fb9SAvraham Stern  * @dev: network device
6494503c1fb9SAvraham Stern  * @bssid: the BSSID of the AP
6495503c1fb9SAvraham Stern  * @gfp: allocation flags
6496503c1fb9SAvraham Stern  *
6497503c1fb9SAvraham Stern  * This function should be called by a driver that supports 4 way handshake
6498503c1fb9SAvraham Stern  * offload after a security association was successfully established (i.e.,
6499503c1fb9SAvraham Stern  * the 4 way handshake was completed successfully). The call to this function
6500503c1fb9SAvraham Stern  * should be preceded with a call to cfg80211_connect_result(),
6501503c1fb9SAvraham Stern  * cfg80211_connect_done(), cfg80211_connect_bss() or cfg80211_roamed() to
6502503c1fb9SAvraham Stern  * indicate the 802.11 association.
6503503c1fb9SAvraham Stern  */
6504503c1fb9SAvraham Stern void cfg80211_port_authorized(struct net_device *dev, const u8 *bssid,
6505503c1fb9SAvraham Stern 			      gfp_t gfp);
6506503c1fb9SAvraham Stern 
6507503c1fb9SAvraham Stern /**
6508b23aa676SSamuel Ortiz  * cfg80211_disconnected - notify cfg80211 that connection was dropped
6509b23aa676SSamuel Ortiz  *
6510b23aa676SSamuel Ortiz  * @dev: network device
6511b23aa676SSamuel Ortiz  * @ie: information elements of the deauth/disassoc frame (may be %NULL)
6512b23aa676SSamuel Ortiz  * @ie_len: length of IEs
6513b23aa676SSamuel Ortiz  * @reason: reason code for the disconnection, set it to 0 if unknown
651480279fb7SJohannes Berg  * @locally_generated: disconnection was requested locally
6515b23aa676SSamuel Ortiz  * @gfp: allocation flags
6516b23aa676SSamuel Ortiz  *
6517b23aa676SSamuel Ortiz  * After it calls this function, the driver should enter an idle state
6518b23aa676SSamuel Ortiz  * and not try to connect to any AP any more.
6519b23aa676SSamuel Ortiz  */
6520b23aa676SSamuel Ortiz void cfg80211_disconnected(struct net_device *dev, u16 reason,
652180279fb7SJohannes Berg 			   const u8 *ie, size_t ie_len,
652280279fb7SJohannes Berg 			   bool locally_generated, gfp_t gfp);
6523b23aa676SSamuel Ortiz 
65249588bbd5SJouni Malinen /**
65259588bbd5SJouni Malinen  * cfg80211_ready_on_channel - notification of remain_on_channel start
652671bbc994SJohannes Berg  * @wdev: wireless device
65279588bbd5SJouni Malinen  * @cookie: the request cookie
65289588bbd5SJouni Malinen  * @chan: The current channel (from remain_on_channel request)
65299588bbd5SJouni Malinen  * @duration: Duration in milliseconds that the driver intents to remain on the
65309588bbd5SJouni Malinen  *	channel
65319588bbd5SJouni Malinen  * @gfp: allocation flags
65329588bbd5SJouni Malinen  */
653371bbc994SJohannes Berg void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie,
65349588bbd5SJouni Malinen 			       struct ieee80211_channel *chan,
65359588bbd5SJouni Malinen 			       unsigned int duration, gfp_t gfp);
65369588bbd5SJouni Malinen 
65379588bbd5SJouni Malinen /**
65389588bbd5SJouni Malinen  * cfg80211_remain_on_channel_expired - remain_on_channel duration expired
653971bbc994SJohannes Berg  * @wdev: wireless device
65409588bbd5SJouni Malinen  * @cookie: the request cookie
65419588bbd5SJouni Malinen  * @chan: The current channel (from remain_on_channel request)
65429588bbd5SJouni Malinen  * @gfp: allocation flags
65439588bbd5SJouni Malinen  */
654471bbc994SJohannes Berg void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie,
65459588bbd5SJouni Malinen 					struct ieee80211_channel *chan,
65469588bbd5SJouni Malinen 					gfp_t gfp);
6547b23aa676SSamuel Ortiz 
65488689c051SArend van Spriel /**
65491c38c7f2SJames Prestwood  * cfg80211_tx_mgmt_expired - tx_mgmt duration expired
65501c38c7f2SJames Prestwood  * @wdev: wireless device
65511c38c7f2SJames Prestwood  * @cookie: the requested cookie
65521c38c7f2SJames Prestwood  * @chan: The current channel (from tx_mgmt request)
65531c38c7f2SJames Prestwood  * @gfp: allocation flags
65541c38c7f2SJames Prestwood  */
65551c38c7f2SJames Prestwood void cfg80211_tx_mgmt_expired(struct wireless_dev *wdev, u64 cookie,
65561c38c7f2SJames Prestwood 			      struct ieee80211_channel *chan, gfp_t gfp);
65571c38c7f2SJames Prestwood 
65581c38c7f2SJames Prestwood /**
65598689c051SArend van Spriel  * cfg80211_sinfo_alloc_tid_stats - allocate per-tid statistics.
65608689c051SArend van Spriel  *
65618689c051SArend van Spriel  * @sinfo: the station information
65628689c051SArend van Spriel  * @gfp: allocation flags
65638689c051SArend van Spriel  */
65648689c051SArend van Spriel int cfg80211_sinfo_alloc_tid_stats(struct station_info *sinfo, gfp_t gfp);
656598b62183SJohannes Berg 
656698b62183SJohannes Berg /**
65677ea3e110SJohannes Berg  * cfg80211_sinfo_release_content - release contents of station info
65687ea3e110SJohannes Berg  * @sinfo: the station information
65697ea3e110SJohannes Berg  *
65707ea3e110SJohannes Berg  * Releases any potentially allocated sub-information of the station
65717ea3e110SJohannes Berg  * information, but not the struct itself (since it's typically on
65727ea3e110SJohannes Berg  * the stack.)
65737ea3e110SJohannes Berg  */
65747ea3e110SJohannes Berg static inline void cfg80211_sinfo_release_content(struct station_info *sinfo)
65757ea3e110SJohannes Berg {
65767ea3e110SJohannes Berg 	kfree(sinfo->pertid);
65777ea3e110SJohannes Berg }
65787ea3e110SJohannes Berg 
65797ea3e110SJohannes Berg /**
658098b62183SJohannes Berg  * cfg80211_new_sta - notify userspace about station
658198b62183SJohannes Berg  *
658298b62183SJohannes Berg  * @dev: the netdev
658398b62183SJohannes Berg  * @mac_addr: the station's address
658498b62183SJohannes Berg  * @sinfo: the station information
658598b62183SJohannes Berg  * @gfp: allocation flags
658698b62183SJohannes Berg  */
658798b62183SJohannes Berg void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr,
658898b62183SJohannes Berg 		      struct station_info *sinfo, gfp_t gfp);
658998b62183SJohannes Berg 
6590026331c4SJouni Malinen /**
6591cf5ead82SJohannes Berg  * cfg80211_del_sta_sinfo - notify userspace about deletion of a station
6592cf5ead82SJohannes Berg  * @dev: the netdev
6593cf5ead82SJohannes Berg  * @mac_addr: the station's address
6594cf5ead82SJohannes Berg  * @sinfo: the station information/statistics
6595cf5ead82SJohannes Berg  * @gfp: allocation flags
6596cf5ead82SJohannes Berg  */
6597cf5ead82SJohannes Berg void cfg80211_del_sta_sinfo(struct net_device *dev, const u8 *mac_addr,
6598cf5ead82SJohannes Berg 			    struct station_info *sinfo, gfp_t gfp);
6599cf5ead82SJohannes Berg 
6600cf5ead82SJohannes Berg /**
6601ec15e68bSJouni Malinen  * cfg80211_del_sta - notify userspace about deletion of a station
6602ec15e68bSJouni Malinen  *
6603ec15e68bSJouni Malinen  * @dev: the netdev
6604ec15e68bSJouni Malinen  * @mac_addr: the station's address
6605ec15e68bSJouni Malinen  * @gfp: allocation flags
6606ec15e68bSJouni Malinen  */
6607cf5ead82SJohannes Berg static inline void cfg80211_del_sta(struct net_device *dev,
6608cf5ead82SJohannes Berg 				    const u8 *mac_addr, gfp_t gfp)
6609cf5ead82SJohannes Berg {
6610cf5ead82SJohannes Berg 	cfg80211_del_sta_sinfo(dev, mac_addr, NULL, gfp);
6611cf5ead82SJohannes Berg }
6612ec15e68bSJouni Malinen 
6613ec15e68bSJouni Malinen /**
6614ed44a951SPandiyarajan Pitchaimuthu  * cfg80211_conn_failed - connection request failed notification
6615ed44a951SPandiyarajan Pitchaimuthu  *
6616ed44a951SPandiyarajan Pitchaimuthu  * @dev: the netdev
6617ed44a951SPandiyarajan Pitchaimuthu  * @mac_addr: the station's address
6618ed44a951SPandiyarajan Pitchaimuthu  * @reason: the reason for connection failure
6619ed44a951SPandiyarajan Pitchaimuthu  * @gfp: allocation flags
6620ed44a951SPandiyarajan Pitchaimuthu  *
6621ed44a951SPandiyarajan Pitchaimuthu  * Whenever a station tries to connect to an AP and if the station
6622ed44a951SPandiyarajan Pitchaimuthu  * could not connect to the AP as the AP has rejected the connection
6623ed44a951SPandiyarajan Pitchaimuthu  * for some reasons, this function is called.
6624ed44a951SPandiyarajan Pitchaimuthu  *
6625ed44a951SPandiyarajan Pitchaimuthu  * The reason for connection failure can be any of the value from
6626ed44a951SPandiyarajan Pitchaimuthu  * nl80211_connect_failed_reason enum
6627ed44a951SPandiyarajan Pitchaimuthu  */
6628ed44a951SPandiyarajan Pitchaimuthu void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr,
6629ed44a951SPandiyarajan Pitchaimuthu 			  enum nl80211_connect_failed_reason reason,
6630ed44a951SPandiyarajan Pitchaimuthu 			  gfp_t gfp);
6631ed44a951SPandiyarajan Pitchaimuthu 
6632ed44a951SPandiyarajan Pitchaimuthu /**
66332e161f78SJohannes Berg  * cfg80211_rx_mgmt - notification of received, unprocessed management frame
663471bbc994SJohannes Berg  * @wdev: wireless device receiving the frame
6635026331c4SJouni Malinen  * @freq: Frequency on which the frame was received in MHz
66366c2fb1e6SSergey Matyukevich  * @sig_dbm: signal strength in dBm, or 0 if unknown
66372e161f78SJohannes Berg  * @buf: Management frame (header + body)
6638026331c4SJouni Malinen  * @len: length of the frame data
663919504cf5SVladimir Kondratiev  * @flags: flags, as defined in enum nl80211_rxmgmt_flags
66402e161f78SJohannes Berg  *
66410ae997dcSYacine Belkadi  * This function is called whenever an Action frame is received for a station
66420ae997dcSYacine Belkadi  * mode interface, but is not processed in kernel.
66430ae997dcSYacine Belkadi  *
66440ae997dcSYacine Belkadi  * Return: %true if a user space application has registered for this frame.
66452e161f78SJohannes Berg  * For action frames, that makes it responsible for rejecting unrecognized
66462e161f78SJohannes Berg  * action frames; %false otherwise, in which case for action frames the
66472e161f78SJohannes Berg  * driver is responsible for rejecting the frame.
6648026331c4SJouni Malinen  */
664971bbc994SJohannes Berg bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int sig_dbm,
6650970fdfa8SVladimir Kondratiev 		      const u8 *buf, size_t len, u32 flags);
6651026331c4SJouni Malinen 
6652026331c4SJouni Malinen /**
66532e161f78SJohannes Berg  * cfg80211_mgmt_tx_status - notification of TX status for management frame
665471bbc994SJohannes Berg  * @wdev: wireless device receiving the frame
66552e161f78SJohannes Berg  * @cookie: Cookie returned by cfg80211_ops::mgmt_tx()
66562e161f78SJohannes Berg  * @buf: Management frame (header + body)
6657026331c4SJouni Malinen  * @len: length of the frame data
6658026331c4SJouni Malinen  * @ack: Whether frame was acknowledged
6659026331c4SJouni Malinen  * @gfp: context flags
6660026331c4SJouni Malinen  *
66612e161f78SJohannes Berg  * This function is called whenever a management frame was requested to be
66622e161f78SJohannes Berg  * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the
6663026331c4SJouni Malinen  * transmission attempt.
6664026331c4SJouni Malinen  */
666571bbc994SJohannes Berg void cfg80211_mgmt_tx_status(struct wireless_dev *wdev, u64 cookie,
6666026331c4SJouni Malinen 			     const u8 *buf, size_t len, bool ack, gfp_t gfp);
6667026331c4SJouni Malinen 
6668d6dc1a38SJuuso Oikarinen 
6669d6dc1a38SJuuso Oikarinen /**
66706a671a50SDenis Kenzior  * cfg80211_rx_control_port - notification about a received control port frame
66716a671a50SDenis Kenzior  * @dev: The device the frame matched to
6672a948f713SDenis Kenzior  * @skb: The skbuf with the control port frame.  It is assumed that the skbuf
6673a948f713SDenis Kenzior  *	is 802.3 formatted (with 802.3 header).  The skb can be non-linear.
6674a948f713SDenis Kenzior  *	This function does not take ownership of the skb, so the caller is
6675a948f713SDenis Kenzior  *	responsible for any cleanup.  The caller must also ensure that
6676a948f713SDenis Kenzior  *	skb->protocol is set appropriately.
66776a671a50SDenis Kenzior  * @unencrypted: Whether the frame was received unencrypted
66786a671a50SDenis Kenzior  *
66796a671a50SDenis Kenzior  * This function is used to inform userspace about a received control port
66806a671a50SDenis Kenzior  * frame.  It should only be used if userspace indicated it wants to receive
66816a671a50SDenis Kenzior  * control port frames over nl80211.
66826a671a50SDenis Kenzior  *
66836a671a50SDenis Kenzior  * The frame is the data portion of the 802.3 or 802.11 data frame with all
66846a671a50SDenis Kenzior  * network layer headers removed (e.g. the raw EAPoL frame).
66856a671a50SDenis Kenzior  *
66866a671a50SDenis Kenzior  * Return: %true if the frame was passed to userspace
66876a671a50SDenis Kenzior  */
66886a671a50SDenis Kenzior bool cfg80211_rx_control_port(struct net_device *dev,
6689a948f713SDenis Kenzior 			      struct sk_buff *skb, bool unencrypted);
66906a671a50SDenis Kenzior 
66916a671a50SDenis Kenzior /**
6692d6dc1a38SJuuso Oikarinen  * cfg80211_cqm_rssi_notify - connection quality monitoring rssi event
6693d6dc1a38SJuuso Oikarinen  * @dev: network device
6694d6dc1a38SJuuso Oikarinen  * @rssi_event: the triggered RSSI event
6695bee427b8SAndrzej Zaborowski  * @rssi_level: new RSSI level value or 0 if not available
6696d6dc1a38SJuuso Oikarinen  * @gfp: context flags
6697d6dc1a38SJuuso Oikarinen  *
6698d6dc1a38SJuuso Oikarinen  * This function is called when a configured connection quality monitoring
6699d6dc1a38SJuuso Oikarinen  * rssi threshold reached event occurs.
6700d6dc1a38SJuuso Oikarinen  */
6701d6dc1a38SJuuso Oikarinen void cfg80211_cqm_rssi_notify(struct net_device *dev,
6702d6dc1a38SJuuso Oikarinen 			      enum nl80211_cqm_rssi_threshold_event rssi_event,
6703bee427b8SAndrzej Zaborowski 			      s32 rssi_level, gfp_t gfp);
6704d6dc1a38SJuuso Oikarinen 
6705c063dbf5SJohannes Berg /**
6706c063dbf5SJohannes Berg  * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer
6707c063dbf5SJohannes Berg  * @dev: network device
6708c063dbf5SJohannes Berg  * @peer: peer's MAC address
6709c063dbf5SJohannes Berg  * @num_packets: how many packets were lost -- should be a fixed threshold
6710c063dbf5SJohannes Berg  *	but probably no less than maybe 50, or maybe a throughput dependent
6711c063dbf5SJohannes Berg  *	threshold (to account for temporary interference)
6712c063dbf5SJohannes Berg  * @gfp: context flags
6713c063dbf5SJohannes Berg  */
6714c063dbf5SJohannes Berg void cfg80211_cqm_pktloss_notify(struct net_device *dev,
6715c063dbf5SJohannes Berg 				 const u8 *peer, u32 num_packets, gfp_t gfp);
6716c063dbf5SJohannes Berg 
6717e5497d76SJohannes Berg /**
671884f10708SThomas Pedersen  * cfg80211_cqm_txe_notify - TX error rate event
671984f10708SThomas Pedersen  * @dev: network device
672084f10708SThomas Pedersen  * @peer: peer's MAC address
672184f10708SThomas Pedersen  * @num_packets: how many packets were lost
672284f10708SThomas Pedersen  * @rate: % of packets which failed transmission
672384f10708SThomas Pedersen  * @intvl: interval (in s) over which the TX failure threshold was breached.
672484f10708SThomas Pedersen  * @gfp: context flags
672584f10708SThomas Pedersen  *
672684f10708SThomas Pedersen  * Notify userspace when configured % TX failures over number of packets in a
672784f10708SThomas Pedersen  * given interval is exceeded.
672884f10708SThomas Pedersen  */
672984f10708SThomas Pedersen void cfg80211_cqm_txe_notify(struct net_device *dev, const u8 *peer,
673084f10708SThomas Pedersen 			     u32 num_packets, u32 rate, u32 intvl, gfp_t gfp);
673184f10708SThomas Pedersen 
673284f10708SThomas Pedersen /**
673398f03342SJohannes Berg  * cfg80211_cqm_beacon_loss_notify - beacon loss event
673498f03342SJohannes Berg  * @dev: network device
673598f03342SJohannes Berg  * @gfp: context flags
673698f03342SJohannes Berg  *
673798f03342SJohannes Berg  * Notify userspace about beacon loss from the connected AP.
673898f03342SJohannes Berg  */
673998f03342SJohannes Berg void cfg80211_cqm_beacon_loss_notify(struct net_device *dev, gfp_t gfp);
674098f03342SJohannes Berg 
674198f03342SJohannes Berg /**
67425b97f49dSJohannes Berg  * cfg80211_radar_event - radar detection event
67435b97f49dSJohannes Berg  * @wiphy: the wiphy
67445b97f49dSJohannes Berg  * @chandef: chandef for the current channel
67455b97f49dSJohannes Berg  * @gfp: context flags
67465b97f49dSJohannes Berg  *
67475b97f49dSJohannes Berg  * This function is called when a radar is detected on the current chanenl.
67485b97f49dSJohannes Berg  */
67495b97f49dSJohannes Berg void cfg80211_radar_event(struct wiphy *wiphy,
67505b97f49dSJohannes Berg 			  struct cfg80211_chan_def *chandef, gfp_t gfp);
67515b97f49dSJohannes Berg 
67525b97f49dSJohannes Berg /**
6753466b9936Stamizhr@codeaurora.org  * cfg80211_sta_opmode_change_notify - STA's ht/vht operation mode change event
6754466b9936Stamizhr@codeaurora.org  * @dev: network device
6755466b9936Stamizhr@codeaurora.org  * @mac: MAC address of a station which opmode got modified
6756466b9936Stamizhr@codeaurora.org  * @sta_opmode: station's current opmode value
6757466b9936Stamizhr@codeaurora.org  * @gfp: context flags
6758466b9936Stamizhr@codeaurora.org  *
6759466b9936Stamizhr@codeaurora.org  * Driver should call this function when station's opmode modified via action
6760466b9936Stamizhr@codeaurora.org  * frame.
6761466b9936Stamizhr@codeaurora.org  */
6762466b9936Stamizhr@codeaurora.org void cfg80211_sta_opmode_change_notify(struct net_device *dev, const u8 *mac,
6763466b9936Stamizhr@codeaurora.org 				       struct sta_opmode_info *sta_opmode,
6764466b9936Stamizhr@codeaurora.org 				       gfp_t gfp);
6765466b9936Stamizhr@codeaurora.org 
6766466b9936Stamizhr@codeaurora.org /**
67675b97f49dSJohannes Berg  * cfg80211_cac_event - Channel availability check (CAC) event
67685b97f49dSJohannes Berg  * @netdev: network device
67695b97f49dSJohannes Berg  * @chandef: chandef for the current channel
67705b97f49dSJohannes Berg  * @event: type of event
67715b97f49dSJohannes Berg  * @gfp: context flags
67725b97f49dSJohannes Berg  *
67735b97f49dSJohannes Berg  * This function is called when a Channel availability check (CAC) is finished
67745b97f49dSJohannes Berg  * or aborted. This must be called to notify the completion of a CAC process,
67755b97f49dSJohannes Berg  * also by full-MAC drivers.
67765b97f49dSJohannes Berg  */
67775b97f49dSJohannes Berg void cfg80211_cac_event(struct net_device *netdev,
67785b97f49dSJohannes Berg 			const struct cfg80211_chan_def *chandef,
67795b97f49dSJohannes Berg 			enum nl80211_radar_event event, gfp_t gfp);
67805b97f49dSJohannes Berg 
67815b97f49dSJohannes Berg 
67825b97f49dSJohannes Berg /**
6783e5497d76SJohannes Berg  * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying
6784e5497d76SJohannes Berg  * @dev: network device
6785e5497d76SJohannes Berg  * @bssid: BSSID of AP (to avoid races)
6786e5497d76SJohannes Berg  * @replay_ctr: new replay counter
6787af71ff85SJohannes Berg  * @gfp: allocation flags
6788e5497d76SJohannes Berg  */
6789e5497d76SJohannes Berg void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid,
6790e5497d76SJohannes Berg 			       const u8 *replay_ctr, gfp_t gfp);
6791e5497d76SJohannes Berg 
6792c9df56b4SJouni Malinen /**
6793c9df56b4SJouni Malinen  * cfg80211_pmksa_candidate_notify - notify about PMKSA caching candidate
6794c9df56b4SJouni Malinen  * @dev: network device
6795c9df56b4SJouni Malinen  * @index: candidate index (the smaller the index, the higher the priority)
6796c9df56b4SJouni Malinen  * @bssid: BSSID of AP
6797c9df56b4SJouni Malinen  * @preauth: Whether AP advertises support for RSN pre-authentication
6798c9df56b4SJouni Malinen  * @gfp: allocation flags
6799c9df56b4SJouni Malinen  */
6800c9df56b4SJouni Malinen void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index,
6801c9df56b4SJouni Malinen 				     const u8 *bssid, bool preauth, gfp_t gfp);
6802c9df56b4SJouni Malinen 
680328946da7SJohannes Berg /**
680428946da7SJohannes Berg  * cfg80211_rx_spurious_frame - inform userspace about a spurious frame
680528946da7SJohannes Berg  * @dev: The device the frame matched to
680628946da7SJohannes Berg  * @addr: the transmitter address
680728946da7SJohannes Berg  * @gfp: context flags
680828946da7SJohannes Berg  *
680928946da7SJohannes Berg  * This function is used in AP mode (only!) to inform userspace that
681028946da7SJohannes Berg  * a spurious class 3 frame was received, to be able to deauth the
681128946da7SJohannes Berg  * sender.
68120ae997dcSYacine Belkadi  * Return: %true if the frame was passed to userspace (or this failed
681328946da7SJohannes Berg  * for a reason other than not having a subscription.)
681428946da7SJohannes Berg  */
681528946da7SJohannes Berg bool cfg80211_rx_spurious_frame(struct net_device *dev,
681628946da7SJohannes Berg 				const u8 *addr, gfp_t gfp);
681728946da7SJohannes Berg 
68187f6cf311SJohannes Berg /**
6819b92ab5d8SJohannes Berg  * cfg80211_rx_unexpected_4addr_frame - inform about unexpected WDS frame
6820b92ab5d8SJohannes Berg  * @dev: The device the frame matched to
6821b92ab5d8SJohannes Berg  * @addr: the transmitter address
6822b92ab5d8SJohannes Berg  * @gfp: context flags
6823b92ab5d8SJohannes Berg  *
6824b92ab5d8SJohannes Berg  * This function is used in AP mode (only!) to inform userspace that
6825b92ab5d8SJohannes Berg  * an associated station sent a 4addr frame but that wasn't expected.
6826b92ab5d8SJohannes Berg  * It is allowed and desirable to send this event only once for each
6827b92ab5d8SJohannes Berg  * station to avoid event flooding.
68280ae997dcSYacine Belkadi  * Return: %true if the frame was passed to userspace (or this failed
6829b92ab5d8SJohannes Berg  * for a reason other than not having a subscription.)
6830b92ab5d8SJohannes Berg  */
6831b92ab5d8SJohannes Berg bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev,
6832b92ab5d8SJohannes Berg 					const u8 *addr, gfp_t gfp);
6833b92ab5d8SJohannes Berg 
6834b92ab5d8SJohannes Berg /**
68357f6cf311SJohannes Berg  * cfg80211_probe_status - notify userspace about probe status
68367f6cf311SJohannes Berg  * @dev: the device the probe was sent on
68377f6cf311SJohannes Berg  * @addr: the address of the peer
68387f6cf311SJohannes Berg  * @cookie: the cookie filled in @probe_client previously
68397f6cf311SJohannes Berg  * @acked: indicates whether probe was acked or not
6840c4b50cd3SVenkateswara Naralasetty  * @ack_signal: signal strength (in dBm) of the ACK frame.
6841c4b50cd3SVenkateswara Naralasetty  * @is_valid_ack_signal: indicates the ack_signal is valid or not.
68427f6cf311SJohannes Berg  * @gfp: allocation flags
68437f6cf311SJohannes Berg  */
68447f6cf311SJohannes Berg void cfg80211_probe_status(struct net_device *dev, const u8 *addr,
6845c4b50cd3SVenkateswara Naralasetty 			   u64 cookie, bool acked, s32 ack_signal,
6846c4b50cd3SVenkateswara Naralasetty 			   bool is_valid_ack_signal, gfp_t gfp);
68477f6cf311SJohannes Berg 
68485e760230SJohannes Berg /**
68495e760230SJohannes Berg  * cfg80211_report_obss_beacon - report beacon from other APs
68505e760230SJohannes Berg  * @wiphy: The wiphy that received the beacon
68515e760230SJohannes Berg  * @frame: the frame
68525e760230SJohannes Berg  * @len: length of the frame
68535e760230SJohannes Berg  * @freq: frequency the frame was received on
68546c2fb1e6SSergey Matyukevich  * @sig_dbm: signal strength in dBm, or 0 if unknown
68555e760230SJohannes Berg  *
68565e760230SJohannes Berg  * Use this function to report to userspace when a beacon was
68575e760230SJohannes Berg  * received. It is not useful to call this when there is no
68585e760230SJohannes Berg  * netdev that is in AP/GO mode.
68595e760230SJohannes Berg  */
68605e760230SJohannes Berg void cfg80211_report_obss_beacon(struct wiphy *wiphy,
68615e760230SJohannes Berg 				 const u8 *frame, size_t len,
686237c73b5fSBen Greear 				 int freq, int sig_dbm);
68635e760230SJohannes Berg 
6864d58e7e37SJohannes Berg /**
6865683b6d3bSJohannes Berg  * cfg80211_reg_can_beacon - check if beaconing is allowed
686654858ee5SAlexander Simon  * @wiphy: the wiphy
6867683b6d3bSJohannes Berg  * @chandef: the channel definition
6868174e0cd2SIlan Peer  * @iftype: interface type
6869d58e7e37SJohannes Berg  *
68700ae997dcSYacine Belkadi  * Return: %true if there is no secondary channel or the secondary channel(s)
68710ae997dcSYacine Belkadi  * can be used for beaconing (i.e. is not a radar channel etc.)
687254858ee5SAlexander Simon  */
6873683b6d3bSJohannes Berg bool cfg80211_reg_can_beacon(struct wiphy *wiphy,
6874174e0cd2SIlan Peer 			     struct cfg80211_chan_def *chandef,
6875174e0cd2SIlan Peer 			     enum nl80211_iftype iftype);
687654858ee5SAlexander Simon 
6877923b352fSArik Nemtsov /**
6878923b352fSArik Nemtsov  * cfg80211_reg_can_beacon_relax - check if beaconing is allowed with relaxation
6879923b352fSArik Nemtsov  * @wiphy: the wiphy
6880923b352fSArik Nemtsov  * @chandef: the channel definition
6881923b352fSArik Nemtsov  * @iftype: interface type
6882923b352fSArik Nemtsov  *
6883923b352fSArik Nemtsov  * Return: %true if there is no secondary channel or the secondary channel(s)
6884923b352fSArik Nemtsov  * can be used for beaconing (i.e. is not a radar channel etc.). This version
6885923b352fSArik Nemtsov  * also checks if IR-relaxation conditions apply, to allow beaconing under
6886923b352fSArik Nemtsov  * more permissive conditions.
6887923b352fSArik Nemtsov  *
6888923b352fSArik Nemtsov  * Requires the RTNL to be held.
6889923b352fSArik Nemtsov  */
6890923b352fSArik Nemtsov bool cfg80211_reg_can_beacon_relax(struct wiphy *wiphy,
6891923b352fSArik Nemtsov 				   struct cfg80211_chan_def *chandef,
6892923b352fSArik Nemtsov 				   enum nl80211_iftype iftype);
6893923b352fSArik Nemtsov 
68948097e149SThomas Pedersen /*
68955314526bSThomas Pedersen  * cfg80211_ch_switch_notify - update wdev channel and notify userspace
68965314526bSThomas Pedersen  * @dev: the device which switched channels
6897683b6d3bSJohannes Berg  * @chandef: the new channel definition
68985314526bSThomas Pedersen  *
6899e487eaebSSimon Wunderlich  * Caller must acquire wdev_lock, therefore must only be called from sleepable
6900e487eaebSSimon Wunderlich  * driver context!
69015314526bSThomas Pedersen  */
6902683b6d3bSJohannes Berg void cfg80211_ch_switch_notify(struct net_device *dev,
6903683b6d3bSJohannes Berg 			       struct cfg80211_chan_def *chandef);
69045314526bSThomas Pedersen 
6905f8d7552eSLuciano Coelho /*
6906f8d7552eSLuciano Coelho  * cfg80211_ch_switch_started_notify - notify channel switch start
6907f8d7552eSLuciano Coelho  * @dev: the device on which the channel switch started
6908f8d7552eSLuciano Coelho  * @chandef: the future channel definition
6909f8d7552eSLuciano Coelho  * @count: the number of TBTTs until the channel switch happens
6910f8d7552eSLuciano Coelho  *
6911f8d7552eSLuciano Coelho  * Inform the userspace about the channel switch that has just
6912f8d7552eSLuciano Coelho  * started, so that it can take appropriate actions (eg. starting
6913f8d7552eSLuciano Coelho  * channel switch on other vifs), if necessary.
6914f8d7552eSLuciano Coelho  */
6915f8d7552eSLuciano Coelho void cfg80211_ch_switch_started_notify(struct net_device *dev,
6916f8d7552eSLuciano Coelho 				       struct cfg80211_chan_def *chandef,
6917f8d7552eSLuciano Coelho 				       u8 count);
6918f8d7552eSLuciano Coelho 
69191ce3e82bSJohannes Berg /**
69201ce3e82bSJohannes Berg  * ieee80211_operating_class_to_band - convert operating class to band
69211ce3e82bSJohannes Berg  *
69221ce3e82bSJohannes Berg  * @operating_class: the operating class to convert
69231ce3e82bSJohannes Berg  * @band: band pointer to fill
69241ce3e82bSJohannes Berg  *
69251ce3e82bSJohannes Berg  * Returns %true if the conversion was successful, %false otherwise.
69261ce3e82bSJohannes Berg  */
69271ce3e82bSJohannes Berg bool ieee80211_operating_class_to_band(u8 operating_class,
692857fbcce3SJohannes Berg 				       enum nl80211_band *band);
69291ce3e82bSJohannes Berg 
6930a38700ddSArik Nemtsov /**
6931a38700ddSArik Nemtsov  * ieee80211_chandef_to_operating_class - convert chandef to operation class
6932a38700ddSArik Nemtsov  *
6933a38700ddSArik Nemtsov  * @chandef: the chandef to convert
6934a38700ddSArik Nemtsov  * @op_class: a pointer to the resulting operating class
6935a38700ddSArik Nemtsov  *
6936a38700ddSArik Nemtsov  * Returns %true if the conversion was successful, %false otherwise.
6937a38700ddSArik Nemtsov  */
6938a38700ddSArik Nemtsov bool ieee80211_chandef_to_operating_class(struct cfg80211_chan_def *chandef,
6939a38700ddSArik Nemtsov 					  u8 *op_class);
6940a38700ddSArik Nemtsov 
69415314526bSThomas Pedersen /*
69423475b094SJouni Malinen  * cfg80211_tdls_oper_request - request userspace to perform TDLS operation
69433475b094SJouni Malinen  * @dev: the device on which the operation is requested
69443475b094SJouni Malinen  * @peer: the MAC address of the peer device
69453475b094SJouni Malinen  * @oper: the requested TDLS operation (NL80211_TDLS_SETUP or
69463475b094SJouni Malinen  *	NL80211_TDLS_TEARDOWN)
69473475b094SJouni Malinen  * @reason_code: the reason code for teardown request
69483475b094SJouni Malinen  * @gfp: allocation flags
69493475b094SJouni Malinen  *
69503475b094SJouni Malinen  * This function is used to request userspace to perform TDLS operation that
69513475b094SJouni Malinen  * requires knowledge of keys, i.e., link setup or teardown when the AP
69523475b094SJouni Malinen  * connection uses encryption. This is optional mechanism for the driver to use
69533475b094SJouni Malinen  * if it can automatically determine when a TDLS link could be useful (e.g.,
69543475b094SJouni Malinen  * based on traffic and signal strength for a peer).
69553475b094SJouni Malinen  */
69563475b094SJouni Malinen void cfg80211_tdls_oper_request(struct net_device *dev, const u8 *peer,
69573475b094SJouni Malinen 				enum nl80211_tdls_operation oper,
69583475b094SJouni Malinen 				u16 reason_code, gfp_t gfp);
69593475b094SJouni Malinen 
69603475b094SJouni Malinen /*
69618097e149SThomas Pedersen  * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units)
69628097e149SThomas Pedersen  * @rate: given rate_info to calculate bitrate from
69638097e149SThomas Pedersen  *
69648097e149SThomas Pedersen  * return 0 if MCS index >= 32
69658097e149SThomas Pedersen  */
69668eb41c8dSVladimir Kondratiev u32 cfg80211_calculate_bitrate(struct rate_info *rate);
69678097e149SThomas Pedersen 
696898104fdeSJohannes Berg /**
696998104fdeSJohannes Berg  * cfg80211_unregister_wdev - remove the given wdev
697098104fdeSJohannes Berg  * @wdev: struct wireless_dev to remove
697198104fdeSJohannes Berg  *
697298104fdeSJohannes Berg  * Call this function only for wdevs that have no netdev assigned,
697398104fdeSJohannes Berg  * e.g. P2P Devices. It removes the device from the list so that
697498104fdeSJohannes Berg  * it can no longer be used. It is necessary to call this function
697598104fdeSJohannes Berg  * even when cfg80211 requests the removal of the interface by
697698104fdeSJohannes Berg  * calling the del_virtual_intf() callback. The function must also
697798104fdeSJohannes Berg  * be called when the driver wishes to unregister the wdev, e.g.
697898104fdeSJohannes Berg  * when the device is unbound from the driver.
697998104fdeSJohannes Berg  *
698098104fdeSJohannes Berg  * Requires the RTNL to be held.
698198104fdeSJohannes Berg  */
698298104fdeSJohannes Berg void cfg80211_unregister_wdev(struct wireless_dev *wdev);
698398104fdeSJohannes Berg 
69840ee45355SJohannes Berg /**
6985355199e0SJouni Malinen  * struct cfg80211_ft_event - FT Information Elements
6986355199e0SJouni Malinen  * @ies: FT IEs
6987355199e0SJouni Malinen  * @ies_len: length of the FT IE in bytes
6988355199e0SJouni Malinen  * @target_ap: target AP's MAC address
6989355199e0SJouni Malinen  * @ric_ies: RIC IE
6990355199e0SJouni Malinen  * @ric_ies_len: length of the RIC IE in bytes
6991355199e0SJouni Malinen  */
6992355199e0SJouni Malinen struct cfg80211_ft_event_params {
6993355199e0SJouni Malinen 	const u8 *ies;
6994355199e0SJouni Malinen 	size_t ies_len;
6995355199e0SJouni Malinen 	const u8 *target_ap;
6996355199e0SJouni Malinen 	const u8 *ric_ies;
6997355199e0SJouni Malinen 	size_t ric_ies_len;
6998355199e0SJouni Malinen };
6999355199e0SJouni Malinen 
7000355199e0SJouni Malinen /**
7001355199e0SJouni Malinen  * cfg80211_ft_event - notify userspace about FT IE and RIC IE
7002355199e0SJouni Malinen  * @netdev: network device
7003355199e0SJouni Malinen  * @ft_event: IE information
7004355199e0SJouni Malinen  */
7005355199e0SJouni Malinen void cfg80211_ft_event(struct net_device *netdev,
7006355199e0SJouni Malinen 		       struct cfg80211_ft_event_params *ft_event);
7007355199e0SJouni Malinen 
7008355199e0SJouni Malinen /**
70090ee45355SJohannes Berg  * cfg80211_get_p2p_attr - find and copy a P2P attribute from IE buffer
70100ee45355SJohannes Berg  * @ies: the input IE buffer
70110ee45355SJohannes Berg  * @len: the input length
70120ee45355SJohannes Berg  * @attr: the attribute ID to find
70130ee45355SJohannes Berg  * @buf: output buffer, can be %NULL if the data isn't needed, e.g.
70140ee45355SJohannes Berg  *	if the function is only called to get the needed buffer size
70150ee45355SJohannes Berg  * @bufsize: size of the output buffer
70160ee45355SJohannes Berg  *
70170ee45355SJohannes Berg  * The function finds a given P2P attribute in the (vendor) IEs and
70180ee45355SJohannes Berg  * copies its contents to the given buffer.
70190ee45355SJohannes Berg  *
70200ae997dcSYacine Belkadi  * Return: A negative error code (-%EILSEQ or -%ENOENT) if the data is
70210ae997dcSYacine Belkadi  * malformed or the attribute can't be found (respectively), or the
70220ae997dcSYacine Belkadi  * length of the found attribute (which can be zero).
70230ee45355SJohannes Berg  */
7024c216e641SArend van Spriel int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len,
7025c216e641SArend van Spriel 			  enum ieee80211_p2p_attr_id attr,
7026c216e641SArend van Spriel 			  u8 *buf, unsigned int bufsize);
70270ee45355SJohannes Berg 
7028cd8f7cb4SJohannes Berg /**
702929464cccSJohannes Berg  * ieee80211_ie_split_ric - split an IE buffer according to ordering (with RIC)
703029464cccSJohannes Berg  * @ies: the IE buffer
703129464cccSJohannes Berg  * @ielen: the length of the IE buffer
703229464cccSJohannes Berg  * @ids: an array with element IDs that are allowed before
70332512b1b1SLiad Kaufman  *	the split. A WLAN_EID_EXTENSION value means that the next
70342512b1b1SLiad Kaufman  *	EID in the list is a sub-element of the EXTENSION IE.
703529464cccSJohannes Berg  * @n_ids: the size of the element ID array
703629464cccSJohannes Berg  * @after_ric: array IE types that come after the RIC element
703729464cccSJohannes Berg  * @n_after_ric: size of the @after_ric array
703829464cccSJohannes Berg  * @offset: offset where to start splitting in the buffer
703929464cccSJohannes Berg  *
704029464cccSJohannes Berg  * This function splits an IE buffer by updating the @offset
704129464cccSJohannes Berg  * variable to point to the location where the buffer should be
704229464cccSJohannes Berg  * split.
704329464cccSJohannes Berg  *
704429464cccSJohannes Berg  * It assumes that the given IE buffer is well-formed, this
704529464cccSJohannes Berg  * has to be guaranteed by the caller!
704629464cccSJohannes Berg  *
704729464cccSJohannes Berg  * It also assumes that the IEs in the buffer are ordered
704829464cccSJohannes Berg  * correctly, if not the result of using this function will not
704929464cccSJohannes Berg  * be ordered correctly either, i.e. it does no reordering.
705029464cccSJohannes Berg  *
705129464cccSJohannes Berg  * The function returns the offset where the next part of the
705229464cccSJohannes Berg  * buffer starts, which may be @ielen if the entire (remainder)
705329464cccSJohannes Berg  * of the buffer should be used.
705429464cccSJohannes Berg  */
705529464cccSJohannes Berg size_t ieee80211_ie_split_ric(const u8 *ies, size_t ielen,
705629464cccSJohannes Berg 			      const u8 *ids, int n_ids,
705729464cccSJohannes Berg 			      const u8 *after_ric, int n_after_ric,
705829464cccSJohannes Berg 			      size_t offset);
705929464cccSJohannes Berg 
706029464cccSJohannes Berg /**
706129464cccSJohannes Berg  * ieee80211_ie_split - split an IE buffer according to ordering
706229464cccSJohannes Berg  * @ies: the IE buffer
706329464cccSJohannes Berg  * @ielen: the length of the IE buffer
706429464cccSJohannes Berg  * @ids: an array with element IDs that are allowed before
70652512b1b1SLiad Kaufman  *	the split. A WLAN_EID_EXTENSION value means that the next
70662512b1b1SLiad Kaufman  *	EID in the list is a sub-element of the EXTENSION IE.
706729464cccSJohannes Berg  * @n_ids: the size of the element ID array
706829464cccSJohannes Berg  * @offset: offset where to start splitting in the buffer
706929464cccSJohannes Berg  *
707029464cccSJohannes Berg  * This function splits an IE buffer by updating the @offset
707129464cccSJohannes Berg  * variable to point to the location where the buffer should be
707229464cccSJohannes Berg  * split.
707329464cccSJohannes Berg  *
707429464cccSJohannes Berg  * It assumes that the given IE buffer is well-formed, this
707529464cccSJohannes Berg  * has to be guaranteed by the caller!
707629464cccSJohannes Berg  *
707729464cccSJohannes Berg  * It also assumes that the IEs in the buffer are ordered
707829464cccSJohannes Berg  * correctly, if not the result of using this function will not
707929464cccSJohannes Berg  * be ordered correctly either, i.e. it does no reordering.
708029464cccSJohannes Berg  *
708129464cccSJohannes Berg  * The function returns the offset where the next part of the
708229464cccSJohannes Berg  * buffer starts, which may be @ielen if the entire (remainder)
708329464cccSJohannes Berg  * of the buffer should be used.
708429464cccSJohannes Berg  */
70850483eeacSJohannes Berg static inline size_t ieee80211_ie_split(const u8 *ies, size_t ielen,
70860483eeacSJohannes Berg 					const u8 *ids, int n_ids, size_t offset)
70870483eeacSJohannes Berg {
70880483eeacSJohannes Berg 	return ieee80211_ie_split_ric(ies, ielen, ids, n_ids, NULL, 0, offset);
70890483eeacSJohannes Berg }
709029464cccSJohannes Berg 
709129464cccSJohannes Berg /**
7092cd8f7cb4SJohannes Berg  * cfg80211_report_wowlan_wakeup - report wakeup from WoWLAN
7093cd8f7cb4SJohannes Berg  * @wdev: the wireless device reporting the wakeup
7094cd8f7cb4SJohannes Berg  * @wakeup: the wakeup report
7095cd8f7cb4SJohannes Berg  * @gfp: allocation flags
7096cd8f7cb4SJohannes Berg  *
7097cd8f7cb4SJohannes Berg  * This function reports that the given device woke up. If it
7098cd8f7cb4SJohannes Berg  * caused the wakeup, report the reason(s), otherwise you may
7099cd8f7cb4SJohannes Berg  * pass %NULL as the @wakeup parameter to advertise that something
7100cd8f7cb4SJohannes Berg  * else caused the wakeup.
7101cd8f7cb4SJohannes Berg  */
7102cd8f7cb4SJohannes Berg void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev,
7103cd8f7cb4SJohannes Berg 				   struct cfg80211_wowlan_wakeup *wakeup,
7104cd8f7cb4SJohannes Berg 				   gfp_t gfp);
7105cd8f7cb4SJohannes Berg 
71065de17984SArend van Spriel /**
71075de17984SArend van Spriel  * cfg80211_crit_proto_stopped() - indicate critical protocol stopped by driver.
71085de17984SArend van Spriel  *
71095de17984SArend van Spriel  * @wdev: the wireless device for which critical protocol is stopped.
711003f831a6SRobert P. J. Day  * @gfp: allocation flags
71115de17984SArend van Spriel  *
71125de17984SArend van Spriel  * This function can be called by the driver to indicate it has reverted
71135de17984SArend van Spriel  * operation back to normal. One reason could be that the duration given
71145de17984SArend van Spriel  * by .crit_proto_start() has expired.
71155de17984SArend van Spriel  */
71165de17984SArend van Spriel void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp);
71175de17984SArend van Spriel 
7118bdfbec2dSIlan Peer /**
7119bdfbec2dSIlan Peer  * ieee80211_get_num_supported_channels - get number of channels device has
7120bdfbec2dSIlan Peer  * @wiphy: the wiphy
7121bdfbec2dSIlan Peer  *
7122bdfbec2dSIlan Peer  * Return: the number of channels supported by the device.
7123bdfbec2dSIlan Peer  */
7124bdfbec2dSIlan Peer unsigned int ieee80211_get_num_supported_channels(struct wiphy *wiphy);
7125bdfbec2dSIlan Peer 
7126cb2d956dSLuciano Coelho /**
7127cb2d956dSLuciano Coelho  * cfg80211_check_combinations - check interface combinations
7128cb2d956dSLuciano Coelho  *
7129cb2d956dSLuciano Coelho  * @wiphy: the wiphy
7130e227300cSPurushottam Kushwaha  * @params: the interface combinations parameter
7131cb2d956dSLuciano Coelho  *
7132cb2d956dSLuciano Coelho  * This function can be called by the driver to check whether a
7133cb2d956dSLuciano Coelho  * combination of interfaces and their types are allowed according to
7134cb2d956dSLuciano Coelho  * the interface combinations.
7135cb2d956dSLuciano Coelho  */
7136cb2d956dSLuciano Coelho int cfg80211_check_combinations(struct wiphy *wiphy,
7137e227300cSPurushottam Kushwaha 				struct iface_combination_params *params);
7138cb2d956dSLuciano Coelho 
713965a124ddSMichal Kazior /**
714065a124ddSMichal Kazior  * cfg80211_iter_combinations - iterate over matching combinations
714165a124ddSMichal Kazior  *
714265a124ddSMichal Kazior  * @wiphy: the wiphy
7143e227300cSPurushottam Kushwaha  * @params: the interface combinations parameter
714465a124ddSMichal Kazior  * @iter: function to call for each matching combination
714565a124ddSMichal Kazior  * @data: pointer to pass to iter function
714665a124ddSMichal Kazior  *
714765a124ddSMichal Kazior  * This function can be called by the driver to check what possible
714865a124ddSMichal Kazior  * combinations it fits in at a given moment, e.g. for channel switching
714965a124ddSMichal Kazior  * purposes.
715065a124ddSMichal Kazior  */
715165a124ddSMichal Kazior int cfg80211_iter_combinations(struct wiphy *wiphy,
7152e227300cSPurushottam Kushwaha 			       struct iface_combination_params *params,
715365a124ddSMichal Kazior 			       void (*iter)(const struct ieee80211_iface_combination *c,
715465a124ddSMichal Kazior 					    void *data),
715565a124ddSMichal Kazior 			       void *data);
715665a124ddSMichal Kazior 
7157f04c2203SMichal Kazior /*
7158f04c2203SMichal Kazior  * cfg80211_stop_iface - trigger interface disconnection
7159f04c2203SMichal Kazior  *
7160f04c2203SMichal Kazior  * @wiphy: the wiphy
7161f04c2203SMichal Kazior  * @wdev: wireless device
7162f04c2203SMichal Kazior  * @gfp: context flags
7163f04c2203SMichal Kazior  *
7164f04c2203SMichal Kazior  * Trigger interface to be stopped as if AP was stopped, IBSS/mesh left, STA
7165f04c2203SMichal Kazior  * disconnected.
7166f04c2203SMichal Kazior  *
7167f04c2203SMichal Kazior  * Note: This doesn't need any locks and is asynchronous.
7168f04c2203SMichal Kazior  */
7169f04c2203SMichal Kazior void cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev,
7170f04c2203SMichal Kazior 			 gfp_t gfp);
7171f04c2203SMichal Kazior 
7172f6837ba8SJohannes Berg /**
7173f6837ba8SJohannes Berg  * cfg80211_shutdown_all_interfaces - shut down all interfaces for a wiphy
7174f6837ba8SJohannes Berg  * @wiphy: the wiphy to shut down
7175f6837ba8SJohannes Berg  *
7176f6837ba8SJohannes Berg  * This function shuts down all interfaces belonging to this wiphy by
7177f6837ba8SJohannes Berg  * calling dev_close() (and treating non-netdev interfaces as needed).
7178f6837ba8SJohannes Berg  * It shouldn't really be used unless there are some fatal device errors
7179f6837ba8SJohannes Berg  * that really can't be recovered in any other way.
7180f6837ba8SJohannes Berg  *
7181f6837ba8SJohannes Berg  * Callers must hold the RTNL and be able to deal with callbacks into
7182f6837ba8SJohannes Berg  * the driver while the function is running.
7183f6837ba8SJohannes Berg  */
7184f6837ba8SJohannes Berg void cfg80211_shutdown_all_interfaces(struct wiphy *wiphy);
7185f6837ba8SJohannes Berg 
7186d75bb06bSGautam Kumar Shukla /**
7187d75bb06bSGautam Kumar Shukla  * wiphy_ext_feature_set - set the extended feature flag
7188d75bb06bSGautam Kumar Shukla  *
7189d75bb06bSGautam Kumar Shukla  * @wiphy: the wiphy to modify.
7190d75bb06bSGautam Kumar Shukla  * @ftidx: extended feature bit index.
7191d75bb06bSGautam Kumar Shukla  *
7192d75bb06bSGautam Kumar Shukla  * The extended features are flagged in multiple bytes (see
7193d75bb06bSGautam Kumar Shukla  * &struct wiphy.@ext_features)
7194d75bb06bSGautam Kumar Shukla  */
7195d75bb06bSGautam Kumar Shukla static inline void wiphy_ext_feature_set(struct wiphy *wiphy,
7196d75bb06bSGautam Kumar Shukla 					 enum nl80211_ext_feature_index ftidx)
7197d75bb06bSGautam Kumar Shukla {
7198d75bb06bSGautam Kumar Shukla 	u8 *ft_byte;
7199d75bb06bSGautam Kumar Shukla 
7200d75bb06bSGautam Kumar Shukla 	ft_byte = &wiphy->ext_features[ftidx / 8];
7201d75bb06bSGautam Kumar Shukla 	*ft_byte |= BIT(ftidx % 8);
7202d75bb06bSGautam Kumar Shukla }
7203d75bb06bSGautam Kumar Shukla 
7204d75bb06bSGautam Kumar Shukla /**
7205d75bb06bSGautam Kumar Shukla  * wiphy_ext_feature_isset - check the extended feature flag
7206d75bb06bSGautam Kumar Shukla  *
7207d75bb06bSGautam Kumar Shukla  * @wiphy: the wiphy to modify.
7208d75bb06bSGautam Kumar Shukla  * @ftidx: extended feature bit index.
7209d75bb06bSGautam Kumar Shukla  *
7210d75bb06bSGautam Kumar Shukla  * The extended features are flagged in multiple bytes (see
7211d75bb06bSGautam Kumar Shukla  * &struct wiphy.@ext_features)
7212d75bb06bSGautam Kumar Shukla  */
7213d75bb06bSGautam Kumar Shukla static inline bool
7214d75bb06bSGautam Kumar Shukla wiphy_ext_feature_isset(struct wiphy *wiphy,
7215d75bb06bSGautam Kumar Shukla 			enum nl80211_ext_feature_index ftidx)
7216d75bb06bSGautam Kumar Shukla {
7217d75bb06bSGautam Kumar Shukla 	u8 ft_byte;
7218d75bb06bSGautam Kumar Shukla 
7219d75bb06bSGautam Kumar Shukla 	ft_byte = wiphy->ext_features[ftidx / 8];
7220d75bb06bSGautam Kumar Shukla 	return (ft_byte & BIT(ftidx % 8)) != 0;
7221d75bb06bSGautam Kumar Shukla }
7222b7ffbd7eSJohannes Berg 
7223a442b761SAyala Beker /**
7224a442b761SAyala Beker  * cfg80211_free_nan_func - free NAN function
7225a442b761SAyala Beker  * @f: NAN function that should be freed
7226a442b761SAyala Beker  *
7227a442b761SAyala Beker  * Frees all the NAN function and all it's allocated members.
7228a442b761SAyala Beker  */
7229a442b761SAyala Beker void cfg80211_free_nan_func(struct cfg80211_nan_func *f);
7230a442b761SAyala Beker 
723150bcd31dSAyala Beker /**
723250bcd31dSAyala Beker  * struct cfg80211_nan_match_params - NAN match parameters
723350bcd31dSAyala Beker  * @type: the type of the function that triggered a match. If it is
723450bcd31dSAyala Beker  *	 %NL80211_NAN_FUNC_SUBSCRIBE it means that we replied to a subscriber.
723550bcd31dSAyala Beker  *	 If it is %NL80211_NAN_FUNC_PUBLISH, it means that we got a discovery
723650bcd31dSAyala Beker  *	 result.
723750bcd31dSAyala Beker  *	 If it is %NL80211_NAN_FUNC_FOLLOW_UP, we received a follow up.
723850bcd31dSAyala Beker  * @inst_id: the local instance id
723950bcd31dSAyala Beker  * @peer_inst_id: the instance id of the peer's function
724050bcd31dSAyala Beker  * @addr: the MAC address of the peer
724150bcd31dSAyala Beker  * @info_len: the length of the &info
724250bcd31dSAyala Beker  * @info: the Service Specific Info from the peer (if any)
724350bcd31dSAyala Beker  * @cookie: unique identifier of the corresponding function
724450bcd31dSAyala Beker  */
724550bcd31dSAyala Beker struct cfg80211_nan_match_params {
724650bcd31dSAyala Beker 	enum nl80211_nan_function_type type;
724750bcd31dSAyala Beker 	u8 inst_id;
724850bcd31dSAyala Beker 	u8 peer_inst_id;
724950bcd31dSAyala Beker 	const u8 *addr;
725050bcd31dSAyala Beker 	u8 info_len;
725150bcd31dSAyala Beker 	const u8 *info;
725250bcd31dSAyala Beker 	u64 cookie;
725350bcd31dSAyala Beker };
725450bcd31dSAyala Beker 
725550bcd31dSAyala Beker /**
725650bcd31dSAyala Beker  * cfg80211_nan_match - report a match for a NAN function.
725750bcd31dSAyala Beker  * @wdev: the wireless device reporting the match
725850bcd31dSAyala Beker  * @match: match notification parameters
725950bcd31dSAyala Beker  * @gfp: allocation flags
726050bcd31dSAyala Beker  *
726150bcd31dSAyala Beker  * This function reports that the a NAN function had a match. This
726250bcd31dSAyala Beker  * can be a subscribe that had a match or a solicited publish that
726350bcd31dSAyala Beker  * was sent. It can also be a follow up that was received.
726450bcd31dSAyala Beker  */
726550bcd31dSAyala Beker void cfg80211_nan_match(struct wireless_dev *wdev,
726650bcd31dSAyala Beker 			struct cfg80211_nan_match_params *match, gfp_t gfp);
726750bcd31dSAyala Beker 
7268368e5a7bSAyala Beker /**
7269368e5a7bSAyala Beker  * cfg80211_nan_func_terminated - notify about NAN function termination.
7270368e5a7bSAyala Beker  *
7271368e5a7bSAyala Beker  * @wdev: the wireless device reporting the match
7272368e5a7bSAyala Beker  * @inst_id: the local instance id
7273368e5a7bSAyala Beker  * @reason: termination reason (one of the NL80211_NAN_FUNC_TERM_REASON_*)
7274368e5a7bSAyala Beker  * @cookie: unique NAN function identifier
7275368e5a7bSAyala Beker  * @gfp: allocation flags
7276368e5a7bSAyala Beker  *
7277368e5a7bSAyala Beker  * This function reports that the a NAN function is terminated.
7278368e5a7bSAyala Beker  */
7279368e5a7bSAyala Beker void cfg80211_nan_func_terminated(struct wireless_dev *wdev,
7280368e5a7bSAyala Beker 				  u8 inst_id,
7281368e5a7bSAyala Beker 				  enum nl80211_nan_func_term_reason reason,
7282368e5a7bSAyala Beker 				  u64 cookie, gfp_t gfp);
7283368e5a7bSAyala Beker 
7284b7ffbd7eSJohannes Berg /* ethtool helper */
7285b7ffbd7eSJohannes Berg void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info);
7286b7ffbd7eSJohannes Berg 
728740cbfa90SSrinivas Dasari /**
728840cbfa90SSrinivas Dasari  * cfg80211_external_auth_request - userspace request for authentication
728940cbfa90SSrinivas Dasari  * @netdev: network device
729040cbfa90SSrinivas Dasari  * @params: External authentication parameters
729140cbfa90SSrinivas Dasari  * @gfp: allocation flags
729240cbfa90SSrinivas Dasari  * Returns: 0 on success, < 0 on error
729340cbfa90SSrinivas Dasari  */
729440cbfa90SSrinivas Dasari int cfg80211_external_auth_request(struct net_device *netdev,
729540cbfa90SSrinivas Dasari 				   struct cfg80211_external_auth_params *params,
729640cbfa90SSrinivas Dasari 				   gfp_t gfp);
729740cbfa90SSrinivas Dasari 
72989bb7e0f2SJohannes Berg /**
72999bb7e0f2SJohannes Berg  * cfg80211_pmsr_report - report peer measurement result data
73009bb7e0f2SJohannes Berg  * @wdev: the wireless device reporting the measurement
73019bb7e0f2SJohannes Berg  * @req: the original measurement request
73029bb7e0f2SJohannes Berg  * @result: the result data
73039bb7e0f2SJohannes Berg  * @gfp: allocation flags
73049bb7e0f2SJohannes Berg  */
73059bb7e0f2SJohannes Berg void cfg80211_pmsr_report(struct wireless_dev *wdev,
73069bb7e0f2SJohannes Berg 			  struct cfg80211_pmsr_request *req,
73079bb7e0f2SJohannes Berg 			  struct cfg80211_pmsr_result *result,
73089bb7e0f2SJohannes Berg 			  gfp_t gfp);
73099bb7e0f2SJohannes Berg 
73109bb7e0f2SJohannes Berg /**
73119bb7e0f2SJohannes Berg  * cfg80211_pmsr_complete - report peer measurement completed
73129bb7e0f2SJohannes Berg  * @wdev: the wireless device reporting the measurement
73139bb7e0f2SJohannes Berg  * @req: the original measurement request
73149bb7e0f2SJohannes Berg  * @gfp: allocation flags
73159bb7e0f2SJohannes Berg  *
73169bb7e0f2SJohannes Berg  * Report that the entire measurement completed, after this
73179bb7e0f2SJohannes Berg  * the request pointer will no longer be valid.
73189bb7e0f2SJohannes Berg  */
73199bb7e0f2SJohannes Berg void cfg80211_pmsr_complete(struct wireless_dev *wdev,
73209bb7e0f2SJohannes Berg 			    struct cfg80211_pmsr_request *req,
73219bb7e0f2SJohannes Berg 			    gfp_t gfp);
73229bb7e0f2SJohannes Berg 
7323*e6f40511SManikanta Pubbisetty /**
7324*e6f40511SManikanta Pubbisetty  * cfg80211_iftype_allowed - check whether the interface can be allowed
7325*e6f40511SManikanta Pubbisetty  * @wiphy: the wiphy
7326*e6f40511SManikanta Pubbisetty  * @iftype: interface type
7327*e6f40511SManikanta Pubbisetty  * @is_4addr: use_4addr flag, must be '0' when check_swif is '1'
7328*e6f40511SManikanta Pubbisetty  * @check_swif: check iftype against software interfaces
7329*e6f40511SManikanta Pubbisetty  *
7330*e6f40511SManikanta Pubbisetty  * Check whether the interface is allowed to operate; additionally, this API
7331*e6f40511SManikanta Pubbisetty  * can be used to check iftype against the software interfaces when
7332*e6f40511SManikanta Pubbisetty  * check_swif is '1'.
7333*e6f40511SManikanta Pubbisetty  */
7334*e6f40511SManikanta Pubbisetty bool cfg80211_iftype_allowed(struct wiphy *wiphy, enum nl80211_iftype iftype,
7335*e6f40511SManikanta Pubbisetty 			     bool is_4addr, u8 check_swif);
7336*e6f40511SManikanta Pubbisetty 
7337*e6f40511SManikanta Pubbisetty 
7338e1db74fcSJoe Perches /* Logging, debugging and troubleshooting/diagnostic helpers. */
7339e1db74fcSJoe Perches 
7340e1db74fcSJoe Perches /* wiphy_printk helpers, similar to dev_printk */
7341e1db74fcSJoe Perches 
7342e1db74fcSJoe Perches #define wiphy_printk(level, wiphy, format, args...)		\
73439c376639SJoe Perches 	dev_printk(level, &(wiphy)->dev, format, ##args)
7344e1db74fcSJoe Perches #define wiphy_emerg(wiphy, format, args...)			\
73459c376639SJoe Perches 	dev_emerg(&(wiphy)->dev, format, ##args)
7346e1db74fcSJoe Perches #define wiphy_alert(wiphy, format, args...)			\
73479c376639SJoe Perches 	dev_alert(&(wiphy)->dev, format, ##args)
7348e1db74fcSJoe Perches #define wiphy_crit(wiphy, format, args...)			\
73499c376639SJoe Perches 	dev_crit(&(wiphy)->dev, format, ##args)
7350e1db74fcSJoe Perches #define wiphy_err(wiphy, format, args...)			\
73519c376639SJoe Perches 	dev_err(&(wiphy)->dev, format, ##args)
7352e1db74fcSJoe Perches #define wiphy_warn(wiphy, format, args...)			\
73539c376639SJoe Perches 	dev_warn(&(wiphy)->dev, format, ##args)
7354e1db74fcSJoe Perches #define wiphy_notice(wiphy, format, args...)			\
73559c376639SJoe Perches 	dev_notice(&(wiphy)->dev, format, ##args)
7356e1db74fcSJoe Perches #define wiphy_info(wiphy, format, args...)			\
73579c376639SJoe Perches 	dev_info(&(wiphy)->dev, format, ##args)
7358073730d7SJoe Perches 
7359a58d7525SStanislaw Gruszka #define wiphy_err_ratelimited(wiphy, format, args...)		\
7360a58d7525SStanislaw Gruszka 	dev_err_ratelimited(&(wiphy)->dev, format, ##args)
7361a58d7525SStanislaw Gruszka #define wiphy_warn_ratelimited(wiphy, format, args...)		\
7362a58d7525SStanislaw Gruszka 	dev_warn_ratelimited(&(wiphy)->dev, format, ##args)
7363a58d7525SStanislaw Gruszka 
73649c376639SJoe Perches #define wiphy_debug(wiphy, format, args...)			\
7365e1db74fcSJoe Perches 	wiphy_printk(KERN_DEBUG, wiphy, format, ##args)
73669c376639SJoe Perches 
7367e1db74fcSJoe Perches #define wiphy_dbg(wiphy, format, args...)			\
73689c376639SJoe Perches 	dev_dbg(&(wiphy)->dev, format, ##args)
7369e1db74fcSJoe Perches 
7370e1db74fcSJoe Perches #if defined(VERBOSE_DEBUG)
7371e1db74fcSJoe Perches #define wiphy_vdbg	wiphy_dbg
7372e1db74fcSJoe Perches #else
7373e1db74fcSJoe Perches #define wiphy_vdbg(wiphy, format, args...)				\
7374e1db74fcSJoe Perches ({									\
7375e1db74fcSJoe Perches 	if (0)								\
7376e1db74fcSJoe Perches 		wiphy_printk(KERN_DEBUG, wiphy, format, ##args);	\
7377e1db74fcSJoe Perches 	0;								\
7378e1db74fcSJoe Perches })
7379e1db74fcSJoe Perches #endif
7380e1db74fcSJoe Perches 
7381e1db74fcSJoe Perches /*
7382e1db74fcSJoe Perches  * wiphy_WARN() acts like wiphy_printk(), but with the key difference
7383e1db74fcSJoe Perches  * of using a WARN/WARN_ON to get the message out, including the
7384e1db74fcSJoe Perches  * file/line information and a backtrace.
7385e1db74fcSJoe Perches  */
7386e1db74fcSJoe Perches #define wiphy_WARN(wiphy, format, args...)			\
7387e1db74fcSJoe Perches 	WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args);
7388e1db74fcSJoe Perches 
7389cb74e977SSunil Dutt /**
7390cb74e977SSunil Dutt  * cfg80211_update_owe_info_event - Notify the peer's OWE info to user space
7391cb74e977SSunil Dutt  * @netdev: network device
7392cb74e977SSunil Dutt  * @owe_info: peer's owe info
7393cb74e977SSunil Dutt  * @gfp: allocation flags
7394cb74e977SSunil Dutt  */
7395cb74e977SSunil Dutt void cfg80211_update_owe_info_event(struct net_device *netdev,
7396cb74e977SSunil Dutt 				    struct cfg80211_update_owe_info *owe_info,
7397cb74e977SSunil Dutt 				    gfp_t gfp);
7398cb74e977SSunil Dutt 
7399704232c2SJohannes Berg #endif /* __NET_CFG80211_H */
7400