xref: /linux/include/net/cfg80211.h (revision 26ec17a1dc5ecdd8d91aba63ead6f8b5ad5dea0d)
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 /**
250796e90f4SJohn Crispin  * struct ieee80211_he_obss_pd - AP settings for spatial reuse
251796e90f4SJohn Crispin  *
252796e90f4SJohn Crispin  * @enable: is the feature enabled.
253796e90f4SJohn Crispin  * @min_offset: minimal tx power offset an associated station shall use
254796e90f4SJohn Crispin  * @max_offset: maximum tx power offset an associated station shall use
255796e90f4SJohn Crispin  */
256796e90f4SJohn Crispin struct ieee80211_he_obss_pd {
257796e90f4SJohn Crispin 	bool enable;
258796e90f4SJohn Crispin 	u8 min_offset;
259796e90f4SJohn Crispin 	u8 max_offset;
260796e90f4SJohn Crispin };
261796e90f4SJohn Crispin 
262796e90f4SJohn Crispin /**
263d3236553SJohannes Berg  * struct ieee80211_sta_ht_cap - STA's HT capabilities
264d3236553SJohannes Berg  *
265d3236553SJohannes Berg  * This structure describes most essential parameters needed
266d3236553SJohannes Berg  * to describe 802.11n HT capabilities for an STA.
267d3236553SJohannes Berg  *
268d3236553SJohannes Berg  * @ht_supported: is HT supported by the STA
269d3236553SJohannes Berg  * @cap: HT capabilities map as described in 802.11n spec
270d3236553SJohannes Berg  * @ampdu_factor: Maximum A-MPDU length factor
271d3236553SJohannes Berg  * @ampdu_density: Minimum A-MPDU spacing
272d3236553SJohannes Berg  * @mcs: Supported MCS rates
273d3236553SJohannes Berg  */
274d3236553SJohannes Berg struct ieee80211_sta_ht_cap {
275d3236553SJohannes Berg 	u16 cap; /* use IEEE80211_HT_CAP_ */
276d3236553SJohannes Berg 	bool ht_supported;
277d3236553SJohannes Berg 	u8 ampdu_factor;
278d3236553SJohannes Berg 	u8 ampdu_density;
279d3236553SJohannes Berg 	struct ieee80211_mcs_info mcs;
280d3236553SJohannes Berg };
281d3236553SJohannes Berg 
282d3236553SJohannes Berg /**
283bf0c111eSMahesh Palivela  * struct ieee80211_sta_vht_cap - STA's VHT capabilities
284bf0c111eSMahesh Palivela  *
285bf0c111eSMahesh Palivela  * This structure describes most essential parameters needed
286bf0c111eSMahesh Palivela  * to describe 802.11ac VHT capabilities for an STA.
287bf0c111eSMahesh Palivela  *
288bf0c111eSMahesh Palivela  * @vht_supported: is VHT supported by the STA
289bf0c111eSMahesh Palivela  * @cap: VHT capabilities map as described in 802.11ac spec
290bf0c111eSMahesh Palivela  * @vht_mcs: Supported VHT MCS rates
291bf0c111eSMahesh Palivela  */
292bf0c111eSMahesh Palivela struct ieee80211_sta_vht_cap {
293bf0c111eSMahesh Palivela 	bool vht_supported;
294bf0c111eSMahesh Palivela 	u32 cap; /* use IEEE80211_VHT_CAP_ */
295bf0c111eSMahesh Palivela 	struct ieee80211_vht_mcs_info vht_mcs;
296bf0c111eSMahesh Palivela };
297bf0c111eSMahesh Palivela 
298c4cbaf79SLuca Coelho #define IEEE80211_HE_PPE_THRES_MAX_LEN		25
299c4cbaf79SLuca Coelho 
300c4cbaf79SLuca Coelho /**
301c4cbaf79SLuca Coelho  * struct ieee80211_sta_he_cap - STA's HE capabilities
302c4cbaf79SLuca Coelho  *
303c4cbaf79SLuca Coelho  * This structure describes most essential parameters needed
304c4cbaf79SLuca Coelho  * to describe 802.11ax HE capabilities for a STA.
305c4cbaf79SLuca Coelho  *
306c4cbaf79SLuca Coelho  * @has_he: true iff HE data is valid.
307c4cbaf79SLuca Coelho  * @he_cap_elem: Fixed portion of the HE capabilities element.
308c4cbaf79SLuca Coelho  * @he_mcs_nss_supp: The supported NSS/MCS combinations.
309c4cbaf79SLuca Coelho  * @ppe_thres: Holds the PPE Thresholds data.
310c4cbaf79SLuca Coelho  */
311c4cbaf79SLuca Coelho struct ieee80211_sta_he_cap {
312c4cbaf79SLuca Coelho 	bool has_he;
313c4cbaf79SLuca Coelho 	struct ieee80211_he_cap_elem he_cap_elem;
314c4cbaf79SLuca Coelho 	struct ieee80211_he_mcs_nss_supp he_mcs_nss_supp;
315c4cbaf79SLuca Coelho 	u8 ppe_thres[IEEE80211_HE_PPE_THRES_MAX_LEN];
316c4cbaf79SLuca Coelho };
317c4cbaf79SLuca Coelho 
318c4cbaf79SLuca Coelho /**
319c4cbaf79SLuca Coelho  * struct ieee80211_sband_iftype_data
320c4cbaf79SLuca Coelho  *
321c4cbaf79SLuca Coelho  * This structure encapsulates sband data that is relevant for the
322c4cbaf79SLuca Coelho  * interface types defined in @types_mask.  Each type in the
323c4cbaf79SLuca Coelho  * @types_mask must be unique across all instances of iftype_data.
324c4cbaf79SLuca Coelho  *
325c4cbaf79SLuca Coelho  * @types_mask: interface types mask
326c4cbaf79SLuca Coelho  * @he_cap: holds the HE capabilities
327c4cbaf79SLuca Coelho  */
328c4cbaf79SLuca Coelho struct ieee80211_sband_iftype_data {
329c4cbaf79SLuca Coelho 	u16 types_mask;
330c4cbaf79SLuca Coelho 	struct ieee80211_sta_he_cap he_cap;
331c4cbaf79SLuca Coelho };
332c4cbaf79SLuca Coelho 
333bf0c111eSMahesh Palivela /**
3342a38075cSAlexei Avshalom Lazar  * enum ieee80211_edmg_bw_config - allowed channel bandwidth configurations
3352a38075cSAlexei Avshalom Lazar  *
3362a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_4: 2.16GHz
3372a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_5: 2.16GHz and 4.32GHz
3382a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_6: 2.16GHz, 4.32GHz and 6.48GHz
3392a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_7: 2.16GHz, 4.32GHz, 6.48GHz and 8.64GHz
3402a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_8: 2.16GHz and 2.16GHz + 2.16GHz
3412a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_9: 2.16GHz, 4.32GHz and 2.16GHz + 2.16GHz
3422a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_10: 2.16GHz, 4.32GHz, 6.48GHz and 2.16GHz+2.16GHz
3432a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_11: 2.16GHz, 4.32GHz, 6.48GHz, 8.64GHz and
3442a38075cSAlexei Avshalom Lazar  *	2.16GHz+2.16GHz
3452a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_12: 2.16GHz, 2.16GHz + 2.16GHz and
3462a38075cSAlexei Avshalom Lazar  *	4.32GHz + 4.32GHz
3472a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_13: 2.16GHz, 4.32GHz, 2.16GHz + 2.16GHz and
3482a38075cSAlexei Avshalom Lazar  *	4.32GHz + 4.32GHz
3492a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_14: 2.16GHz, 4.32GHz, 6.48GHz, 2.16GHz + 2.16GHz
3502a38075cSAlexei Avshalom Lazar  *	and 4.32GHz + 4.32GHz
3512a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_15: 2.16GHz, 4.32GHz, 6.48GHz, 8.64GHz,
3522a38075cSAlexei Avshalom Lazar  *	2.16GHz + 2.16GHz and 4.32GHz + 4.32GHz
3532a38075cSAlexei Avshalom Lazar  */
3542a38075cSAlexei Avshalom Lazar enum ieee80211_edmg_bw_config {
3552a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_4	= 4,
3562a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_5	= 5,
3572a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_6	= 6,
3582a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_7	= 7,
3592a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_8	= 8,
3602a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_9	= 9,
3612a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_10	= 10,
3622a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_11	= 11,
3632a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_12	= 12,
3642a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_13	= 13,
3652a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_14	= 14,
3662a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_15	= 15,
3672a38075cSAlexei Avshalom Lazar };
3682a38075cSAlexei Avshalom Lazar 
3692a38075cSAlexei Avshalom Lazar /**
3702a38075cSAlexei Avshalom Lazar  * struct ieee80211_edmg - EDMG configuration
3712a38075cSAlexei Avshalom Lazar  *
3722a38075cSAlexei Avshalom Lazar  * This structure describes most essential parameters needed
3732a38075cSAlexei Avshalom Lazar  * to describe 802.11ay EDMG configuration
3742a38075cSAlexei Avshalom Lazar  *
3752a38075cSAlexei Avshalom Lazar  * @channels: bitmap that indicates the 2.16 GHz channel(s)
3762a38075cSAlexei Avshalom Lazar  *	that are allowed to be used for transmissions.
3772a38075cSAlexei Avshalom Lazar  *	Bit 0 indicates channel 1, bit 1 indicates channel 2, etc.
3782a38075cSAlexei Avshalom Lazar  *	Set to 0 indicate EDMG not supported.
3792a38075cSAlexei Avshalom Lazar  * @bw_config: Channel BW Configuration subfield encodes
3802a38075cSAlexei Avshalom Lazar  *	the allowed channel bandwidth configurations
3812a38075cSAlexei Avshalom Lazar  */
3822a38075cSAlexei Avshalom Lazar struct ieee80211_edmg {
3832a38075cSAlexei Avshalom Lazar 	u8 channels;
3842a38075cSAlexei Avshalom Lazar 	enum ieee80211_edmg_bw_config bw_config;
3852a38075cSAlexei Avshalom Lazar };
3862a38075cSAlexei Avshalom Lazar 
3872a38075cSAlexei Avshalom Lazar /**
388d3236553SJohannes Berg  * struct ieee80211_supported_band - frequency band definition
389d3236553SJohannes Berg  *
390d3236553SJohannes Berg  * This structure describes a frequency band a wiphy
391d3236553SJohannes Berg  * is able to operate in.
392d3236553SJohannes Berg  *
393d3236553SJohannes Berg  * @channels: Array of channels the hardware can operate in
394d3236553SJohannes Berg  *	in this band.
395d3236553SJohannes Berg  * @band: the band this structure represents
396d3236553SJohannes Berg  * @n_channels: Number of channels in @channels
397d3236553SJohannes Berg  * @bitrates: Array of bitrates the hardware can operate with
398d3236553SJohannes Berg  *	in this band. Must be sorted to give a valid "supported
399d3236553SJohannes Berg  *	rates" IE, i.e. CCK rates first, then OFDM.
400d3236553SJohannes Berg  * @n_bitrates: Number of bitrates in @bitrates
401abe37c4bSJohannes Berg  * @ht_cap: HT capabilities in this band
402c9a0a302SRobert P. J. Day  * @vht_cap: VHT capabilities in this band
4032a38075cSAlexei Avshalom Lazar  * @edmg_cap: EDMG capabilities in this band
404c4cbaf79SLuca Coelho  * @n_iftype_data: number of iftype data entries
405c4cbaf79SLuca Coelho  * @iftype_data: interface type data entries.  Note that the bits in
406c4cbaf79SLuca Coelho  *	@types_mask inside this structure cannot overlap (i.e. only
407c4cbaf79SLuca Coelho  *	one occurrence of each type is allowed across all instances of
408c4cbaf79SLuca Coelho  *	iftype_data).
409d3236553SJohannes Berg  */
410d3236553SJohannes Berg struct ieee80211_supported_band {
411d3236553SJohannes Berg 	struct ieee80211_channel *channels;
412d3236553SJohannes Berg 	struct ieee80211_rate *bitrates;
41357fbcce3SJohannes Berg 	enum nl80211_band band;
414d3236553SJohannes Berg 	int n_channels;
415d3236553SJohannes Berg 	int n_bitrates;
416d3236553SJohannes Berg 	struct ieee80211_sta_ht_cap ht_cap;
417bf0c111eSMahesh Palivela 	struct ieee80211_sta_vht_cap vht_cap;
4182a38075cSAlexei Avshalom Lazar 	struct ieee80211_edmg edmg_cap;
419c4cbaf79SLuca Coelho 	u16 n_iftype_data;
420c4cbaf79SLuca Coelho 	const struct ieee80211_sband_iftype_data *iftype_data;
421d3236553SJohannes Berg };
422d3236553SJohannes Berg 
423e691ac2fSRafał Miłecki /**
424c4cbaf79SLuca Coelho  * ieee80211_get_sband_iftype_data - return sband data for a given iftype
425c4cbaf79SLuca Coelho  * @sband: the sband to search for the STA on
426c4cbaf79SLuca Coelho  * @iftype: enum nl80211_iftype
427c4cbaf79SLuca Coelho  *
428c4cbaf79SLuca Coelho  * Return: pointer to struct ieee80211_sband_iftype_data, or NULL is none found
429c4cbaf79SLuca Coelho  */
430c4cbaf79SLuca Coelho static inline const struct ieee80211_sband_iftype_data *
431c4cbaf79SLuca Coelho ieee80211_get_sband_iftype_data(const struct ieee80211_supported_band *sband,
432c4cbaf79SLuca Coelho 				u8 iftype)
433c4cbaf79SLuca Coelho {
434c4cbaf79SLuca Coelho 	int i;
435c4cbaf79SLuca Coelho 
436c4cbaf79SLuca Coelho 	if (WARN_ON(iftype >= NL80211_IFTYPE_MAX))
437c4cbaf79SLuca Coelho 		return NULL;
438c4cbaf79SLuca Coelho 
439c4cbaf79SLuca Coelho 	for (i = 0; i < sband->n_iftype_data; i++)  {
440c4cbaf79SLuca Coelho 		const struct ieee80211_sband_iftype_data *data =
441c4cbaf79SLuca Coelho 			&sband->iftype_data[i];
442c4cbaf79SLuca Coelho 
443c4cbaf79SLuca Coelho 		if (data->types_mask & BIT(iftype))
444c4cbaf79SLuca Coelho 			return data;
445c4cbaf79SLuca Coelho 	}
446c4cbaf79SLuca Coelho 
447c4cbaf79SLuca Coelho 	return NULL;
448c4cbaf79SLuca Coelho }
449c4cbaf79SLuca Coelho 
450c4cbaf79SLuca Coelho /**
451d7edf40cSJohn Crispin  * ieee80211_get_he_iftype_cap - return HE capabilities for an sband's iftype
452d7edf40cSJohn Crispin  * @sband: the sband to search for the iftype on
453d7edf40cSJohn Crispin  * @iftype: enum nl80211_iftype
454d7edf40cSJohn Crispin  *
455d7edf40cSJohn Crispin  * Return: pointer to the struct ieee80211_sta_he_cap, or NULL is none found
456d7edf40cSJohn Crispin  */
457d7edf40cSJohn Crispin static inline const struct ieee80211_sta_he_cap *
458d7edf40cSJohn Crispin ieee80211_get_he_iftype_cap(const struct ieee80211_supported_band *sband,
459d7edf40cSJohn Crispin 			    u8 iftype)
460d7edf40cSJohn Crispin {
461d7edf40cSJohn Crispin 	const struct ieee80211_sband_iftype_data *data =
462d7edf40cSJohn Crispin 		ieee80211_get_sband_iftype_data(sband, iftype);
463d7edf40cSJohn Crispin 
464d7edf40cSJohn Crispin 	if (data && data->he_cap.has_he)
465d7edf40cSJohn Crispin 		return &data->he_cap;
466d7edf40cSJohn Crispin 
467d7edf40cSJohn Crispin 	return NULL;
468d7edf40cSJohn Crispin }
469d7edf40cSJohn Crispin 
470d7edf40cSJohn Crispin /**
471c4cbaf79SLuca Coelho  * ieee80211_get_he_sta_cap - return HE capabilities for an sband's STA
472c4cbaf79SLuca Coelho  * @sband: the sband to search for the STA on
473c4cbaf79SLuca Coelho  *
474c4cbaf79SLuca Coelho  * Return: pointer to the struct ieee80211_sta_he_cap, or NULL is none found
475c4cbaf79SLuca Coelho  */
476c4cbaf79SLuca Coelho static inline const struct ieee80211_sta_he_cap *
477c4cbaf79SLuca Coelho ieee80211_get_he_sta_cap(const struct ieee80211_supported_band *sband)
478c4cbaf79SLuca Coelho {
479d7edf40cSJohn Crispin 	return ieee80211_get_he_iftype_cap(sband, NL80211_IFTYPE_STATION);
480c4cbaf79SLuca Coelho }
481c4cbaf79SLuca Coelho 
482c4cbaf79SLuca Coelho /**
483e691ac2fSRafał Miłecki  * wiphy_read_of_freq_limits - read frequency limits from device tree
484e691ac2fSRafał Miłecki  *
485e691ac2fSRafał Miłecki  * @wiphy: the wireless device to get extra limits for
486e691ac2fSRafał Miłecki  *
487e691ac2fSRafał Miłecki  * Some devices may have extra limitations specified in DT. This may be useful
488e691ac2fSRafał Miłecki  * for chipsets that normally support more bands but are limited due to board
489e691ac2fSRafał Miłecki  * design (e.g. by antennas or external power amplifier).
490e691ac2fSRafał Miłecki  *
491e691ac2fSRafał Miłecki  * This function reads info from DT and uses it to *modify* channels (disable
492e691ac2fSRafał Miłecki  * unavailable ones). It's usually a *bad* idea to use it in drivers with
493e691ac2fSRafał Miłecki  * shared channel data as DT limitations are device specific. You should make
494e691ac2fSRafał Miłecki  * sure to call it only if channels in wiphy are copied and can be modified
495e691ac2fSRafał Miłecki  * without affecting other devices.
496e691ac2fSRafał Miłecki  *
497e691ac2fSRafał Miłecki  * As this function access device node it has to be called after set_wiphy_dev.
498e691ac2fSRafał Miłecki  * It also modifies channels so they have to be set first.
499e691ac2fSRafał Miłecki  * If using this helper, call it before wiphy_register().
500e691ac2fSRafał Miłecki  */
501e691ac2fSRafał Miłecki #ifdef CONFIG_OF
502e691ac2fSRafał Miłecki void wiphy_read_of_freq_limits(struct wiphy *wiphy);
503e691ac2fSRafał Miłecki #else /* CONFIG_OF */
504e691ac2fSRafał Miłecki static inline void wiphy_read_of_freq_limits(struct wiphy *wiphy)
505e691ac2fSRafał Miłecki {
506e691ac2fSRafał Miłecki }
507e691ac2fSRafał Miłecki #endif /* !CONFIG_OF */
508e691ac2fSRafał Miłecki 
509e691ac2fSRafał Miłecki 
510d3236553SJohannes Berg /*
511d3236553SJohannes Berg  * Wireless hardware/device configuration structures and methods
512704232c2SJohannes Berg  */
513704232c2SJohannes Berg 
5142ec600d6SLuis Carlos Cobo /**
515d70e9693SJohannes Berg  * DOC: Actions and configuration
516d70e9693SJohannes Berg  *
517d70e9693SJohannes Berg  * Each wireless device and each virtual interface offer a set of configuration
518d70e9693SJohannes Berg  * operations and other actions that are invoked by userspace. Each of these
519d70e9693SJohannes Berg  * actions is described in the operations structure, and the parameters these
520d70e9693SJohannes Berg  * operations use are described separately.
521d70e9693SJohannes Berg  *
522d70e9693SJohannes Berg  * Additionally, some operations are asynchronous and expect to get status
523d70e9693SJohannes Berg  * information via some functions that drivers need to call.
524d70e9693SJohannes Berg  *
525d70e9693SJohannes Berg  * Scanning and BSS list handling with its associated functionality is described
526d70e9693SJohannes Berg  * in a separate chapter.
527d70e9693SJohannes Berg  */
528d70e9693SJohannes Berg 
529c6e6a0c8SAviya Erenfeld #define VHT_MUMIMO_GROUPS_DATA_LEN (WLAN_MEMBERSHIP_LEN +\
530c6e6a0c8SAviya Erenfeld 				    WLAN_USER_POSITION_LEN)
531c6e6a0c8SAviya Erenfeld 
532d70e9693SJohannes Berg /**
5332ec600d6SLuis Carlos Cobo  * struct vif_params - describes virtual interface parameters
534818a986eSJohannes Berg  * @flags: monitor interface flags, unchanged if 0, otherwise
535818a986eSJohannes Berg  *	%MONITOR_FLAG_CHANGED will be set
5368b787643SFelix Fietkau  * @use_4addr: use 4-address frames
537e8f479b1SBen Greear  * @macaddr: address to use for this virtual interface.
538e8f479b1SBen Greear  *	If this parameter is set to zero address the driver may
539e8f479b1SBen Greear  *	determine the address as needed.
540e8f479b1SBen Greear  *	This feature is only fully supported by drivers that enable the
541e8f479b1SBen Greear  *	%NL80211_FEATURE_MAC_ON_CREATE flag.  Others may support creating
542e8f479b1SBen Greear  **	only p2p devices with specified MAC.
543b0265024SJohannes Berg  * @vht_mumimo_groups: MU-MIMO groupID, used for monitoring MU-MIMO packets
544b0265024SJohannes Berg  *	belonging to that MU-MIMO groupID; %NULL if not changed
545b0265024SJohannes Berg  * @vht_mumimo_follow_addr: MU-MIMO follow address, used for monitoring
546b0265024SJohannes Berg  *	MU-MIMO packets going to the specified station; %NULL if not changed
5472ec600d6SLuis Carlos Cobo  */
5482ec600d6SLuis Carlos Cobo struct vif_params {
549818a986eSJohannes Berg 	u32 flags;
5508b787643SFelix Fietkau 	int use_4addr;
5511c18f145SArend van Spriel 	u8 macaddr[ETH_ALEN];
552b0265024SJohannes Berg 	const u8 *vht_mumimo_groups;
553b0265024SJohannes Berg 	const u8 *vht_mumimo_follow_addr;
5542ec600d6SLuis Carlos Cobo };
5552ec600d6SLuis Carlos Cobo 
55641ade00fSJohannes Berg /**
55741ade00fSJohannes Berg  * struct key_params - key information
55841ade00fSJohannes Berg  *
55941ade00fSJohannes Berg  * Information about a key
56041ade00fSJohannes Berg  *
56141ade00fSJohannes Berg  * @key: key material
56241ade00fSJohannes Berg  * @key_len: length of key material
56341ade00fSJohannes Berg  * @cipher: cipher suite selector
56441ade00fSJohannes Berg  * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used
56541ade00fSJohannes Berg  *	with the get_key() callback, must be in little endian,
56641ade00fSJohannes Berg  *	length given by @seq_len.
567abe37c4bSJohannes Berg  * @seq_len: length of @seq.
56814f34e36SGurumoorthi Gnanasambandhan  * @vlan_id: vlan_id for VLAN group key (if nonzero)
5696cdd3979SAlexander Wetzel  * @mode: key install mode (RX_TX, NO_TX or SET_TX)
57041ade00fSJohannes Berg  */
57141ade00fSJohannes Berg struct key_params {
572c1e5f471SJohannes Berg 	const u8 *key;
573c1e5f471SJohannes Berg 	const u8 *seq;
57441ade00fSJohannes Berg 	int key_len;
57541ade00fSJohannes Berg 	int seq_len;
57614f34e36SGurumoorthi Gnanasambandhan 	u16 vlan_id;
57741ade00fSJohannes Berg 	u32 cipher;
5786cdd3979SAlexander Wetzel 	enum nl80211_key_mode mode;
57941ade00fSJohannes Berg };
58041ade00fSJohannes Berg 
581ed1b6cc7SJohannes Berg /**
582683b6d3bSJohannes Berg  * struct cfg80211_chan_def - channel definition
583683b6d3bSJohannes Berg  * @chan: the (control) channel
5843d9d1d66SJohannes Berg  * @width: channel width
5853d9d1d66SJohannes Berg  * @center_freq1: center frequency of first segment
5863d9d1d66SJohannes Berg  * @center_freq2: center frequency of second segment
5873d9d1d66SJohannes Berg  *	(only with 80+80 MHz)
5882a38075cSAlexei Avshalom Lazar  * @edmg: define the EDMG channels configuration.
5892a38075cSAlexei Avshalom Lazar  *	If edmg is requested (i.e. the .channels member is non-zero),
5902a38075cSAlexei Avshalom Lazar  *	chan will define the primary channel and all other
5912a38075cSAlexei Avshalom Lazar  *	parameters are ignored.
592683b6d3bSJohannes Berg  */
593683b6d3bSJohannes Berg struct cfg80211_chan_def {
594683b6d3bSJohannes Berg 	struct ieee80211_channel *chan;
5953d9d1d66SJohannes Berg 	enum nl80211_chan_width width;
5963d9d1d66SJohannes Berg 	u32 center_freq1;
5973d9d1d66SJohannes Berg 	u32 center_freq2;
5982a38075cSAlexei Avshalom Lazar 	struct ieee80211_edmg edmg;
599683b6d3bSJohannes Berg };
600683b6d3bSJohannes Berg 
6013d9d1d66SJohannes Berg /**
6023d9d1d66SJohannes Berg  * cfg80211_get_chandef_type - return old channel type from chandef
6033d9d1d66SJohannes Berg  * @chandef: the channel definition
6043d9d1d66SJohannes Berg  *
6050ae997dcSYacine Belkadi  * Return: The old channel type (NOHT, HT20, HT40+/-) from a given
6063d9d1d66SJohannes Berg  * chandef, which must have a bandwidth allowing this conversion.
6073d9d1d66SJohannes Berg  */
608683b6d3bSJohannes Berg static inline enum nl80211_channel_type
609683b6d3bSJohannes Berg cfg80211_get_chandef_type(const struct cfg80211_chan_def *chandef)
610683b6d3bSJohannes Berg {
6113d9d1d66SJohannes Berg 	switch (chandef->width) {
6123d9d1d66SJohannes Berg 	case NL80211_CHAN_WIDTH_20_NOHT:
6133d9d1d66SJohannes Berg 		return NL80211_CHAN_NO_HT;
6143d9d1d66SJohannes Berg 	case NL80211_CHAN_WIDTH_20:
6153d9d1d66SJohannes Berg 		return NL80211_CHAN_HT20;
6163d9d1d66SJohannes Berg 	case NL80211_CHAN_WIDTH_40:
6173d9d1d66SJohannes Berg 		if (chandef->center_freq1 > chandef->chan->center_freq)
6183d9d1d66SJohannes Berg 			return NL80211_CHAN_HT40PLUS;
6193d9d1d66SJohannes Berg 		return NL80211_CHAN_HT40MINUS;
6203d9d1d66SJohannes Berg 	default:
6213d9d1d66SJohannes Berg 		WARN_ON(1);
6223d9d1d66SJohannes Berg 		return NL80211_CHAN_NO_HT;
623683b6d3bSJohannes Berg 	}
6243d9d1d66SJohannes Berg }
6253d9d1d66SJohannes Berg 
6263d9d1d66SJohannes Berg /**
6273d9d1d66SJohannes Berg  * cfg80211_chandef_create - create channel definition using channel type
6283d9d1d66SJohannes Berg  * @chandef: the channel definition struct to fill
6293d9d1d66SJohannes Berg  * @channel: the control channel
6303d9d1d66SJohannes Berg  * @chantype: the channel type
6313d9d1d66SJohannes Berg  *
6323d9d1d66SJohannes Berg  * Given a channel type, create a channel definition.
6333d9d1d66SJohannes Berg  */
6343d9d1d66SJohannes Berg void cfg80211_chandef_create(struct cfg80211_chan_def *chandef,
6353d9d1d66SJohannes Berg 			     struct ieee80211_channel *channel,
6363d9d1d66SJohannes Berg 			     enum nl80211_channel_type chantype);
6373d9d1d66SJohannes Berg 
6383d9d1d66SJohannes Berg /**
6393d9d1d66SJohannes Berg  * cfg80211_chandef_identical - check if two channel definitions are identical
6403d9d1d66SJohannes Berg  * @chandef1: first channel definition
6413d9d1d66SJohannes Berg  * @chandef2: second channel definition
6423d9d1d66SJohannes Berg  *
6430ae997dcSYacine Belkadi  * Return: %true if the channels defined by the channel definitions are
6443d9d1d66SJohannes Berg  * identical, %false otherwise.
6453d9d1d66SJohannes Berg  */
6463d9d1d66SJohannes Berg static inline bool
6473d9d1d66SJohannes Berg cfg80211_chandef_identical(const struct cfg80211_chan_def *chandef1,
6483d9d1d66SJohannes Berg 			   const struct cfg80211_chan_def *chandef2)
6493d9d1d66SJohannes Berg {
6503d9d1d66SJohannes Berg 	return (chandef1->chan == chandef2->chan &&
6513d9d1d66SJohannes Berg 		chandef1->width == chandef2->width &&
6523d9d1d66SJohannes Berg 		chandef1->center_freq1 == chandef2->center_freq1 &&
6533d9d1d66SJohannes Berg 		chandef1->center_freq2 == chandef2->center_freq2);
6543d9d1d66SJohannes Berg }
6553d9d1d66SJohannes Berg 
6563d9d1d66SJohannes Berg /**
6572a38075cSAlexei Avshalom Lazar  * cfg80211_chandef_is_edmg - check if chandef represents an EDMG channel
6582a38075cSAlexei Avshalom Lazar  *
6592a38075cSAlexei Avshalom Lazar  * @chandef: the channel definition
6602a38075cSAlexei Avshalom Lazar  *
6612a38075cSAlexei Avshalom Lazar  * Return: %true if EDMG defined, %false otherwise.
6622a38075cSAlexei Avshalom Lazar  */
6632a38075cSAlexei Avshalom Lazar static inline bool
6642a38075cSAlexei Avshalom Lazar cfg80211_chandef_is_edmg(const struct cfg80211_chan_def *chandef)
6652a38075cSAlexei Avshalom Lazar {
6662a38075cSAlexei Avshalom Lazar 	return chandef->edmg.channels || chandef->edmg.bw_config;
6672a38075cSAlexei Avshalom Lazar }
6682a38075cSAlexei Avshalom Lazar 
6692a38075cSAlexei Avshalom Lazar /**
6703d9d1d66SJohannes Berg  * cfg80211_chandef_compatible - check if two channel definitions are compatible
6713d9d1d66SJohannes Berg  * @chandef1: first channel definition
6723d9d1d66SJohannes Berg  * @chandef2: second channel definition
6733d9d1d66SJohannes Berg  *
6740ae997dcSYacine Belkadi  * Return: %NULL if the given channel definitions are incompatible,
6753d9d1d66SJohannes Berg  * chandef1 or chandef2 otherwise.
6763d9d1d66SJohannes Berg  */
6773d9d1d66SJohannes Berg const struct cfg80211_chan_def *
6783d9d1d66SJohannes Berg cfg80211_chandef_compatible(const struct cfg80211_chan_def *chandef1,
6793d9d1d66SJohannes Berg 			    const struct cfg80211_chan_def *chandef2);
680683b6d3bSJohannes Berg 
681683b6d3bSJohannes Berg /**
6829f5e8f6eSJohannes Berg  * cfg80211_chandef_valid - check if a channel definition is valid
6839f5e8f6eSJohannes Berg  * @chandef: the channel definition to check
6840ae997dcSYacine Belkadi  * Return: %true if the channel definition is valid. %false otherwise.
6859f5e8f6eSJohannes Berg  */
6869f5e8f6eSJohannes Berg bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef);
6879f5e8f6eSJohannes Berg 
6889f5e8f6eSJohannes Berg /**
6899f5e8f6eSJohannes Berg  * cfg80211_chandef_usable - check if secondary channels can be used
6909f5e8f6eSJohannes Berg  * @wiphy: the wiphy to validate against
6919f5e8f6eSJohannes Berg  * @chandef: the channel definition to check
6920ae997dcSYacine Belkadi  * @prohibited_flags: the regulatory channel flags that must not be set
6930ae997dcSYacine Belkadi  * Return: %true if secondary channels are usable. %false otherwise.
6949f5e8f6eSJohannes Berg  */
6959f5e8f6eSJohannes Berg bool cfg80211_chandef_usable(struct wiphy *wiphy,
6969f5e8f6eSJohannes Berg 			     const struct cfg80211_chan_def *chandef,
6979f5e8f6eSJohannes Berg 			     u32 prohibited_flags);
6989f5e8f6eSJohannes Berg 
6999f5e8f6eSJohannes Berg /**
700774f0734SSimon Wunderlich  * cfg80211_chandef_dfs_required - checks if radar detection is required
701774f0734SSimon Wunderlich  * @wiphy: the wiphy to validate against
702774f0734SSimon Wunderlich  * @chandef: the channel definition to check
7032beb6dabSLuciano Coelho  * @iftype: the interface type as specified in &enum nl80211_iftype
7042beb6dabSLuciano Coelho  * Returns:
7052beb6dabSLuciano Coelho  *	1 if radar detection is required, 0 if it is not, < 0 on error
706774f0734SSimon Wunderlich  */
707774f0734SSimon Wunderlich int cfg80211_chandef_dfs_required(struct wiphy *wiphy,
7082beb6dabSLuciano Coelho 				  const struct cfg80211_chan_def *chandef,
709c3d62036SLuciano Coelho 				  enum nl80211_iftype iftype);
710774f0734SSimon Wunderlich 
711774f0734SSimon Wunderlich /**
71230e74732SSimon Wunderlich  * ieee80211_chandef_rate_flags - returns rate flags for a channel
71330e74732SSimon Wunderlich  *
71430e74732SSimon Wunderlich  * In some channel types, not all rates may be used - for example CCK
71530e74732SSimon Wunderlich  * rates may not be used in 5/10 MHz channels.
71630e74732SSimon Wunderlich  *
71730e74732SSimon Wunderlich  * @chandef: channel definition for the channel
71830e74732SSimon Wunderlich  *
71930e74732SSimon Wunderlich  * Returns: rate flags which apply for this channel
72030e74732SSimon Wunderlich  */
72130e74732SSimon Wunderlich static inline enum ieee80211_rate_flags
72230e74732SSimon Wunderlich ieee80211_chandef_rate_flags(struct cfg80211_chan_def *chandef)
72330e74732SSimon Wunderlich {
72430e74732SSimon Wunderlich 	switch (chandef->width) {
72530e74732SSimon Wunderlich 	case NL80211_CHAN_WIDTH_5:
72630e74732SSimon Wunderlich 		return IEEE80211_RATE_SUPPORTS_5MHZ;
72730e74732SSimon Wunderlich 	case NL80211_CHAN_WIDTH_10:
72830e74732SSimon Wunderlich 		return IEEE80211_RATE_SUPPORTS_10MHZ;
72930e74732SSimon Wunderlich 	default:
73030e74732SSimon Wunderlich 		break;
73130e74732SSimon Wunderlich 	}
73230e74732SSimon Wunderlich 	return 0;
73330e74732SSimon Wunderlich }
73430e74732SSimon Wunderlich 
73530e74732SSimon Wunderlich /**
7360430c883SSimon Wunderlich  * ieee80211_chandef_max_power - maximum transmission power for the chandef
7370430c883SSimon Wunderlich  *
7380430c883SSimon Wunderlich  * In some regulations, the transmit power may depend on the configured channel
7390430c883SSimon Wunderlich  * bandwidth which may be defined as dBm/MHz. This function returns the actual
7400430c883SSimon Wunderlich  * max_power for non-standard (20 MHz) channels.
7410430c883SSimon Wunderlich  *
7420430c883SSimon Wunderlich  * @chandef: channel definition for the channel
7430430c883SSimon Wunderlich  *
7440430c883SSimon Wunderlich  * Returns: maximum allowed transmission power in dBm for the chandef
7450430c883SSimon Wunderlich  */
7460430c883SSimon Wunderlich static inline int
7470430c883SSimon Wunderlich ieee80211_chandef_max_power(struct cfg80211_chan_def *chandef)
7480430c883SSimon Wunderlich {
7490430c883SSimon Wunderlich 	switch (chandef->width) {
7500430c883SSimon Wunderlich 	case NL80211_CHAN_WIDTH_5:
7510430c883SSimon Wunderlich 		return min(chandef->chan->max_reg_power - 6,
7520430c883SSimon Wunderlich 			   chandef->chan->max_power);
7530430c883SSimon Wunderlich 	case NL80211_CHAN_WIDTH_10:
7540430c883SSimon Wunderlich 		return min(chandef->chan->max_reg_power - 3,
7550430c883SSimon Wunderlich 			   chandef->chan->max_power);
7560430c883SSimon Wunderlich 	default:
7570430c883SSimon Wunderlich 		break;
7580430c883SSimon Wunderlich 	}
7590430c883SSimon Wunderlich 	return chandef->chan->max_power;
7600430c883SSimon Wunderlich }
7610430c883SSimon Wunderlich 
7620430c883SSimon Wunderlich /**
76361fa713cSHolger Schurig  * enum survey_info_flags - survey information flags
76461fa713cSHolger Schurig  *
765abe37c4bSJohannes Berg  * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in
76617e5a808SFelix Fietkau  * @SURVEY_INFO_IN_USE: channel is currently being used
7674ed20bebSJohannes Berg  * @SURVEY_INFO_TIME: active time (in ms) was filled in
7684ed20bebSJohannes Berg  * @SURVEY_INFO_TIME_BUSY: busy time was filled in
7694ed20bebSJohannes Berg  * @SURVEY_INFO_TIME_EXT_BUSY: extension channel busy time was filled in
7704ed20bebSJohannes Berg  * @SURVEY_INFO_TIME_RX: receive time was filled in
7714ed20bebSJohannes Berg  * @SURVEY_INFO_TIME_TX: transmit time was filled in
772052536abSJohannes Berg  * @SURVEY_INFO_TIME_SCAN: scan time was filled in
773c8cd6e7fSFelix Fietkau  * @SURVEY_INFO_TIME_BSS_RX: local BSS receive time was filled in
774abe37c4bSJohannes Berg  *
77561fa713cSHolger Schurig  * Used by the driver to indicate which info in &struct survey_info
77661fa713cSHolger Schurig  * it has filled in during the get_survey().
77761fa713cSHolger Schurig  */
77861fa713cSHolger Schurig enum survey_info_flags {
7794ed20bebSJohannes Berg 	SURVEY_INFO_NOISE_DBM		= BIT(0),
7804ed20bebSJohannes Berg 	SURVEY_INFO_IN_USE		= BIT(1),
7814ed20bebSJohannes Berg 	SURVEY_INFO_TIME		= BIT(2),
7824ed20bebSJohannes Berg 	SURVEY_INFO_TIME_BUSY		= BIT(3),
7834ed20bebSJohannes Berg 	SURVEY_INFO_TIME_EXT_BUSY	= BIT(4),
7844ed20bebSJohannes Berg 	SURVEY_INFO_TIME_RX		= BIT(5),
7854ed20bebSJohannes Berg 	SURVEY_INFO_TIME_TX		= BIT(6),
786052536abSJohannes Berg 	SURVEY_INFO_TIME_SCAN		= BIT(7),
787c8cd6e7fSFelix Fietkau 	SURVEY_INFO_TIME_BSS_RX		= BIT(8),
78861fa713cSHolger Schurig };
78961fa713cSHolger Schurig 
79061fa713cSHolger Schurig /**
79161fa713cSHolger Schurig  * struct survey_info - channel survey response
79261fa713cSHolger Schurig  *
79311f78ac3SJohannes Berg  * @channel: the channel this survey record reports, may be %NULL for a single
79411f78ac3SJohannes Berg  *	record to report global statistics
79561fa713cSHolger Schurig  * @filled: bitflag of flags from &enum survey_info_flags
79661fa713cSHolger Schurig  * @noise: channel noise in dBm. This and all following fields are
79761fa713cSHolger Schurig  *	optional
7984ed20bebSJohannes Berg  * @time: amount of time in ms the radio was turn on (on the channel)
7994ed20bebSJohannes Berg  * @time_busy: amount of time the primary channel was sensed busy
8004ed20bebSJohannes Berg  * @time_ext_busy: amount of time the extension channel was sensed busy
8014ed20bebSJohannes Berg  * @time_rx: amount of time the radio spent receiving data
8024ed20bebSJohannes Berg  * @time_tx: amount of time the radio spent transmitting data
803052536abSJohannes Berg  * @time_scan: amount of time the radio spent for scanning
804c8cd6e7fSFelix Fietkau  * @time_bss_rx: amount of time the radio spent receiving data on a local BSS
80561fa713cSHolger Schurig  *
806abe37c4bSJohannes Berg  * Used by dump_survey() to report back per-channel survey information.
807abe37c4bSJohannes Berg  *
80861fa713cSHolger Schurig  * This structure can later be expanded with things like
80961fa713cSHolger Schurig  * channel duty cycle etc.
81061fa713cSHolger Schurig  */
81161fa713cSHolger Schurig struct survey_info {
81261fa713cSHolger Schurig 	struct ieee80211_channel *channel;
8134ed20bebSJohannes Berg 	u64 time;
8144ed20bebSJohannes Berg 	u64 time_busy;
8154ed20bebSJohannes Berg 	u64 time_ext_busy;
8164ed20bebSJohannes Berg 	u64 time_rx;
8174ed20bebSJohannes Berg 	u64 time_tx;
818052536abSJohannes Berg 	u64 time_scan;
819c8cd6e7fSFelix Fietkau 	u64 time_bss_rx;
82061fa713cSHolger Schurig 	u32 filled;
82161fa713cSHolger Schurig 	s8 noise;
82261fa713cSHolger Schurig };
82361fa713cSHolger Schurig 
824b8676221SDavid Spinadel #define CFG80211_MAX_WEP_KEYS	4
825b8676221SDavid Spinadel 
82661fa713cSHolger Schurig /**
8275fb628e9SJouni Malinen  * struct cfg80211_crypto_settings - Crypto settings
8285fb628e9SJouni Malinen  * @wpa_versions: indicates which, if any, WPA versions are enabled
8295fb628e9SJouni Malinen  *	(from enum nl80211_wpa_versions)
8305fb628e9SJouni Malinen  * @cipher_group: group key cipher suite (or 0 if unset)
8315fb628e9SJouni Malinen  * @n_ciphers_pairwise: number of AP supported unicast ciphers
8325fb628e9SJouni Malinen  * @ciphers_pairwise: unicast key cipher suites
8335fb628e9SJouni Malinen  * @n_akm_suites: number of AKM suites
8345fb628e9SJouni Malinen  * @akm_suites: AKM suites
8355fb628e9SJouni Malinen  * @control_port: Whether user space controls IEEE 802.1X port, i.e.,
8365fb628e9SJouni Malinen  *	sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
8375fb628e9SJouni Malinen  *	required to assume that the port is unauthorized until authorized by
8385fb628e9SJouni Malinen  *	user space. Otherwise, port is marked authorized by default.
8395fb628e9SJouni Malinen  * @control_port_ethertype: the control port protocol that should be
8405fb628e9SJouni Malinen  *	allowed through even on unauthorized ports
8415fb628e9SJouni Malinen  * @control_port_no_encrypt: TRUE to prevent encryption of control port
8425fb628e9SJouni Malinen  *	protocol frames.
84364bf3d4bSDenis Kenzior  * @control_port_over_nl80211: TRUE if userspace expects to exchange control
84464bf3d4bSDenis Kenzior  *	port frames over NL80211 instead of the network interface.
845b8676221SDavid Spinadel  * @wep_keys: static WEP keys, if not NULL points to an array of
846b8676221SDavid Spinadel  *	CFG80211_MAX_WEP_KEYS WEP keys
847b8676221SDavid Spinadel  * @wep_tx_key: key index (0..3) of the default TX static WEP key
84891b5ab62SEliad Peller  * @psk: PSK (for devices supporting 4-way-handshake offload)
84926f7044eSChung-Hsien Hsu  * @sae_pwd: password for SAE authentication (for devices supporting SAE
85026f7044eSChung-Hsien Hsu  *	offload)
85126f7044eSChung-Hsien Hsu  * @sae_pwd_len: length of SAE password (for devices supporting SAE offload)
8525fb628e9SJouni Malinen  */
8535fb628e9SJouni Malinen struct cfg80211_crypto_settings {
8545fb628e9SJouni Malinen 	u32 wpa_versions;
8555fb628e9SJouni Malinen 	u32 cipher_group;
8565fb628e9SJouni Malinen 	int n_ciphers_pairwise;
8575fb628e9SJouni Malinen 	u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES];
8585fb628e9SJouni Malinen 	int n_akm_suites;
8595fb628e9SJouni Malinen 	u32 akm_suites[NL80211_MAX_NR_AKM_SUITES];
8605fb628e9SJouni Malinen 	bool control_port;
8615fb628e9SJouni Malinen 	__be16 control_port_ethertype;
8625fb628e9SJouni Malinen 	bool control_port_no_encrypt;
86364bf3d4bSDenis Kenzior 	bool control_port_over_nl80211;
864b8676221SDavid Spinadel 	struct key_params *wep_keys;
865b8676221SDavid Spinadel 	int wep_tx_key;
86691b5ab62SEliad Peller 	const u8 *psk;
86726f7044eSChung-Hsien Hsu 	const u8 *sae_pwd;
86826f7044eSChung-Hsien Hsu 	u8 sae_pwd_len;
8695fb628e9SJouni Malinen };
8705fb628e9SJouni Malinen 
8715fb628e9SJouni Malinen /**
8728860020eSJohannes Berg  * struct cfg80211_beacon_data - beacon data
873ed1b6cc7SJohannes Berg  * @head: head portion of beacon (before TIM IE)
874ed1b6cc7SJohannes Berg  *	or %NULL if not changed
875ed1b6cc7SJohannes Berg  * @tail: tail portion of beacon (after TIM IE)
876ed1b6cc7SJohannes Berg  *	or %NULL if not changed
877ed1b6cc7SJohannes Berg  * @head_len: length of @head
878ed1b6cc7SJohannes Berg  * @tail_len: length of @tail
8799946ecfbSJouni Malinen  * @beacon_ies: extra information element(s) to add into Beacon frames or %NULL
8809946ecfbSJouni Malinen  * @beacon_ies_len: length of beacon_ies in octets
8819946ecfbSJouni Malinen  * @proberesp_ies: extra information element(s) to add into Probe Response
8829946ecfbSJouni Malinen  *	frames or %NULL
8839946ecfbSJouni Malinen  * @proberesp_ies_len: length of proberesp_ies in octets
8849946ecfbSJouni Malinen  * @assocresp_ies: extra information element(s) to add into (Re)Association
8859946ecfbSJouni Malinen  *	Response frames or %NULL
8869946ecfbSJouni Malinen  * @assocresp_ies_len: length of assocresp_ies in octets
88700f740e1SArik Nemtsov  * @probe_resp_len: length of probe response template (@probe_resp)
88800f740e1SArik Nemtsov  * @probe_resp: probe response template (AP mode only)
88981e54d08SPradeep Kumar Chitrapu  * @ftm_responder: enable FTM responder functionality; -1 for no change
89081e54d08SPradeep Kumar Chitrapu  *	(which also implies no change in LCI/civic location data)
89130db641eSJohannes Berg  * @lci: Measurement Report element content, starting with Measurement Token
89230db641eSJohannes Berg  *	(measurement type 8)
89330db641eSJohannes Berg  * @civicloc: Measurement Report element content, starting with Measurement
89430db641eSJohannes Berg  *	Token (measurement type 11)
89581e54d08SPradeep Kumar Chitrapu  * @lci_len: LCI data length
89681e54d08SPradeep Kumar Chitrapu  * @civicloc_len: Civic location data length
897ed1b6cc7SJohannes Berg  */
8988860020eSJohannes Berg struct cfg80211_beacon_data {
8998860020eSJohannes Berg 	const u8 *head, *tail;
9008860020eSJohannes Berg 	const u8 *beacon_ies;
9018860020eSJohannes Berg 	const u8 *proberesp_ies;
9028860020eSJohannes Berg 	const u8 *assocresp_ies;
9038860020eSJohannes Berg 	const u8 *probe_resp;
90481e54d08SPradeep Kumar Chitrapu 	const u8 *lci;
90581e54d08SPradeep Kumar Chitrapu 	const u8 *civicloc;
90681e54d08SPradeep Kumar Chitrapu 	s8 ftm_responder;
9078860020eSJohannes Berg 
9088860020eSJohannes Berg 	size_t head_len, tail_len;
9098860020eSJohannes Berg 	size_t beacon_ies_len;
9108860020eSJohannes Berg 	size_t proberesp_ies_len;
9118860020eSJohannes Berg 	size_t assocresp_ies_len;
9128860020eSJohannes Berg 	size_t probe_resp_len;
91381e54d08SPradeep Kumar Chitrapu 	size_t lci_len;
91481e54d08SPradeep Kumar Chitrapu 	size_t civicloc_len;
9158860020eSJohannes Berg };
9168860020eSJohannes Berg 
9176d45a74bSVasanthakumar Thiagarajan struct mac_address {
9186d45a74bSVasanthakumar Thiagarajan 	u8 addr[ETH_ALEN];
9196d45a74bSVasanthakumar Thiagarajan };
9206d45a74bSVasanthakumar Thiagarajan 
9218860020eSJohannes Berg /**
92277765eafSVasanthakumar Thiagarajan  * struct cfg80211_acl_data - Access control list data
92377765eafSVasanthakumar Thiagarajan  *
92477765eafSVasanthakumar Thiagarajan  * @acl_policy: ACL policy to be applied on the station's
925077f897aSJohannes Berg  *	entry specified by mac_addr
92677765eafSVasanthakumar Thiagarajan  * @n_acl_entries: Number of MAC address entries passed
92777765eafSVasanthakumar Thiagarajan  * @mac_addrs: List of MAC addresses of stations to be used for ACL
92877765eafSVasanthakumar Thiagarajan  */
92977765eafSVasanthakumar Thiagarajan struct cfg80211_acl_data {
93077765eafSVasanthakumar Thiagarajan 	enum nl80211_acl_policy acl_policy;
93177765eafSVasanthakumar Thiagarajan 	int n_acl_entries;
93277765eafSVasanthakumar Thiagarajan 
93377765eafSVasanthakumar Thiagarajan 	/* Keep it last */
93477765eafSVasanthakumar Thiagarajan 	struct mac_address mac_addrs[];
93577765eafSVasanthakumar Thiagarajan };
93677765eafSVasanthakumar Thiagarajan 
937a7c7fbffSPurushottam Kushwaha /*
938a7c7fbffSPurushottam Kushwaha  * cfg80211_bitrate_mask - masks for bitrate control
939a7c7fbffSPurushottam Kushwaha  */
940a7c7fbffSPurushottam Kushwaha struct cfg80211_bitrate_mask {
941a7c7fbffSPurushottam Kushwaha 	struct {
942a7c7fbffSPurushottam Kushwaha 		u32 legacy;
943a7c7fbffSPurushottam Kushwaha 		u8 ht_mcs[IEEE80211_HT_MCS_MASK_LEN];
944a7c7fbffSPurushottam Kushwaha 		u16 vht_mcs[NL80211_VHT_NSS_MAX];
945a7c7fbffSPurushottam Kushwaha 		enum nl80211_txrate_gi gi;
946a7c7fbffSPurushottam Kushwaha 	} control[NUM_NL80211_BANDS];
947a7c7fbffSPurushottam Kushwaha };
948a7c7fbffSPurushottam Kushwaha 
9498860020eSJohannes Berg /**
950fe494370SSrinivas Dasari  * enum cfg80211_ap_settings_flags - AP settings flags
951fe494370SSrinivas Dasari  *
952fe494370SSrinivas Dasari  * Used by cfg80211_ap_settings
953fe494370SSrinivas Dasari  *
954fe494370SSrinivas Dasari  * @AP_SETTINGS_EXTERNAL_AUTH_SUPPORT: AP supports external authentication
955fe494370SSrinivas Dasari  */
956fe494370SSrinivas Dasari enum cfg80211_ap_settings_flags {
957fe494370SSrinivas Dasari 	AP_SETTINGS_EXTERNAL_AUTH_SUPPORT = BIT(0),
958fe494370SSrinivas Dasari };
959fe494370SSrinivas Dasari 
960fe494370SSrinivas Dasari /**
9618860020eSJohannes Berg  * struct cfg80211_ap_settings - AP configuration
9628860020eSJohannes Berg  *
9638860020eSJohannes Berg  * Used to configure an AP interface.
9648860020eSJohannes Berg  *
965683b6d3bSJohannes Berg  * @chandef: defines the channel to use
9668860020eSJohannes Berg  * @beacon: beacon data
9678860020eSJohannes Berg  * @beacon_interval: beacon interval
9688860020eSJohannes Berg  * @dtim_period: DTIM period
9698860020eSJohannes Berg  * @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from
9708860020eSJohannes Berg  *	user space)
9718860020eSJohannes Berg  * @ssid_len: length of @ssid
9728860020eSJohannes Berg  * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames
9738860020eSJohannes Berg  * @crypto: crypto settings
9748860020eSJohannes Berg  * @privacy: the BSS uses privacy
9758860020eSJohannes Berg  * @auth_type: Authentication type (algorithm)
97618998c38SEliad Peller  * @smps_mode: SMPS mode
9771b658f11SVasanthakumar Thiagarajan  * @inactivity_timeout: time in seconds to determine station's inactivity.
97853cabad7SJohannes Berg  * @p2p_ctwindow: P2P CT Window
97953cabad7SJohannes Berg  * @p2p_opp_ps: P2P opportunistic PS
98077765eafSVasanthakumar Thiagarajan  * @acl: ACL configuration used by the drivers which has support for
98177765eafSVasanthakumar Thiagarajan  *	MAC address based access control
98234d50519SLior David  * @pbss: If set, start as a PCP instead of AP. Relevant for DMG
98334d50519SLior David  *	networks.
9848564e382SJohannes Berg  * @beacon_rate: bitrate to be used for beacons
98566cd794eSJohannes Berg  * @ht_cap: HT capabilities (or %NULL if HT isn't enabled)
98666cd794eSJohannes Berg  * @vht_cap: VHT capabilities (or %NULL if VHT isn't enabled)
987244eb9aeSShaul Triebitz  * @he_cap: HE capabilities (or %NULL if HE isn't enabled)
98866cd794eSJohannes Berg  * @ht_required: stations must support HT
98966cd794eSJohannes Berg  * @vht_required: stations must support VHT
990a0de1ca3SJohn Crispin  * @twt_responder: Enable Target Wait Time
991fe494370SSrinivas Dasari  * @flags: flags, as defined in enum cfg80211_ap_settings_flags
992796e90f4SJohn Crispin  * @he_obss_pd: OBSS Packet Detection settings
9938860020eSJohannes Berg  */
9948860020eSJohannes Berg struct cfg80211_ap_settings {
995683b6d3bSJohannes Berg 	struct cfg80211_chan_def chandef;
996aa430da4SJohannes Berg 
9978860020eSJohannes Berg 	struct cfg80211_beacon_data beacon;
9988860020eSJohannes Berg 
9998860020eSJohannes Berg 	int beacon_interval, dtim_period;
100032e9de84SJouni Malinen 	const u8 *ssid;
100132e9de84SJouni Malinen 	size_t ssid_len;
100232e9de84SJouni Malinen 	enum nl80211_hidden_ssid hidden_ssid;
10035fb628e9SJouni Malinen 	struct cfg80211_crypto_settings crypto;
10045fb628e9SJouni Malinen 	bool privacy;
10055fb628e9SJouni Malinen 	enum nl80211_auth_type auth_type;
100618998c38SEliad Peller 	enum nl80211_smps_mode smps_mode;
10071b658f11SVasanthakumar Thiagarajan 	int inactivity_timeout;
100853cabad7SJohannes Berg 	u8 p2p_ctwindow;
100953cabad7SJohannes Berg 	bool p2p_opp_ps;
101077765eafSVasanthakumar Thiagarajan 	const struct cfg80211_acl_data *acl;
101134d50519SLior David 	bool pbss;
1012a7c7fbffSPurushottam Kushwaha 	struct cfg80211_bitrate_mask beacon_rate;
101366cd794eSJohannes Berg 
101466cd794eSJohannes Berg 	const struct ieee80211_ht_cap *ht_cap;
101566cd794eSJohannes Berg 	const struct ieee80211_vht_cap *vht_cap;
1016244eb9aeSShaul Triebitz 	const struct ieee80211_he_cap_elem *he_cap;
101766cd794eSJohannes Berg 	bool ht_required, vht_required;
1018a0de1ca3SJohn Crispin 	bool twt_responder;
1019fe494370SSrinivas Dasari 	u32 flags;
1020796e90f4SJohn Crispin 	struct ieee80211_he_obss_pd he_obss_pd;
1021ed1b6cc7SJohannes Berg };
1022ed1b6cc7SJohannes Berg 
10235727ef1bSJohannes Berg /**
102416ef1fe2SSimon Wunderlich  * struct cfg80211_csa_settings - channel switch settings
102516ef1fe2SSimon Wunderlich  *
102616ef1fe2SSimon Wunderlich  * Used for channel switch
102716ef1fe2SSimon Wunderlich  *
102816ef1fe2SSimon Wunderlich  * @chandef: defines the channel to use after the switch
102916ef1fe2SSimon Wunderlich  * @beacon_csa: beacon data while performing the switch
10309a774c78SAndrei Otcheretianski  * @counter_offsets_beacon: offsets of the counters within the beacon (tail)
10319a774c78SAndrei Otcheretianski  * @counter_offsets_presp: offsets of the counters within the probe response
10329a774c78SAndrei Otcheretianski  * @n_counter_offsets_beacon: number of csa counters the beacon (tail)
10339a774c78SAndrei Otcheretianski  * @n_counter_offsets_presp: number of csa counters in the probe response
103416ef1fe2SSimon Wunderlich  * @beacon_after: beacon data to be used on the new channel
103516ef1fe2SSimon Wunderlich  * @radar_required: whether radar detection is required on the new channel
103616ef1fe2SSimon Wunderlich  * @block_tx: whether transmissions should be blocked while changing
103716ef1fe2SSimon Wunderlich  * @count: number of beacons until switch
103816ef1fe2SSimon Wunderlich  */
103916ef1fe2SSimon Wunderlich struct cfg80211_csa_settings {
104016ef1fe2SSimon Wunderlich 	struct cfg80211_chan_def chandef;
104116ef1fe2SSimon Wunderlich 	struct cfg80211_beacon_data beacon_csa;
10429a774c78SAndrei Otcheretianski 	const u16 *counter_offsets_beacon;
10439a774c78SAndrei Otcheretianski 	const u16 *counter_offsets_presp;
10449a774c78SAndrei Otcheretianski 	unsigned int n_counter_offsets_beacon;
10459a774c78SAndrei Otcheretianski 	unsigned int n_counter_offsets_presp;
104616ef1fe2SSimon Wunderlich 	struct cfg80211_beacon_data beacon_after;
104716ef1fe2SSimon Wunderlich 	bool radar_required;
104816ef1fe2SSimon Wunderlich 	bool block_tx;
104916ef1fe2SSimon Wunderlich 	u8 count;
105016ef1fe2SSimon Wunderlich };
105116ef1fe2SSimon Wunderlich 
105251a1aaa6SJohannes Berg #define CFG80211_MAX_NUM_DIFFERENT_CHANNELS 10
105351a1aaa6SJohannes Berg 
105416ef1fe2SSimon Wunderlich /**
1055e227300cSPurushottam Kushwaha  * struct iface_combination_params - input parameters for interface combinations
1056e227300cSPurushottam Kushwaha  *
1057e227300cSPurushottam Kushwaha  * Used to pass interface combination parameters
1058e227300cSPurushottam Kushwaha  *
1059e227300cSPurushottam Kushwaha  * @num_different_channels: the number of different channels we want
1060e227300cSPurushottam Kushwaha  *	to use for verification
1061e227300cSPurushottam Kushwaha  * @radar_detect: a bitmap where each bit corresponds to a channel
1062e227300cSPurushottam Kushwaha  *	width where radar detection is needed, as in the definition of
1063e227300cSPurushottam Kushwaha  *	&struct ieee80211_iface_combination.@radar_detect_widths
1064e227300cSPurushottam Kushwaha  * @iftype_num: array with the number of interfaces of each interface
1065e227300cSPurushottam Kushwaha  *	type.  The index is the interface type as specified in &enum
1066e227300cSPurushottam Kushwaha  *	nl80211_iftype.
10674c8dea63SJohannes Berg  * @new_beacon_int: set this to the beacon interval of a new interface
10684c8dea63SJohannes Berg  *	that's not operating yet, if such is to be checked as part of
10694c8dea63SJohannes Berg  *	the verification
1070e227300cSPurushottam Kushwaha  */
1071e227300cSPurushottam Kushwaha struct iface_combination_params {
1072e227300cSPurushottam Kushwaha 	int num_different_channels;
1073e227300cSPurushottam Kushwaha 	u8 radar_detect;
1074e227300cSPurushottam Kushwaha 	int iftype_num[NUM_NL80211_IFTYPES];
10754c8dea63SJohannes Berg 	u32 new_beacon_int;
1076e227300cSPurushottam Kushwaha };
1077e227300cSPurushottam Kushwaha 
1078e227300cSPurushottam Kushwaha /**
10793b9ce80cSJohannes Berg  * enum station_parameters_apply_mask - station parameter values to apply
10803b9ce80cSJohannes Berg  * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp)
10819d62a986SJouni Malinen  * @STATION_PARAM_APPLY_CAPABILITY: apply new capability
1082f8bacc21SJohannes Berg  * @STATION_PARAM_APPLY_PLINK_STATE: apply new plink state
10833b9ce80cSJohannes Berg  *
10843b9ce80cSJohannes Berg  * Not all station parameters have in-band "no change" signalling,
10853b9ce80cSJohannes Berg  * for those that don't these flags will are used.
10863b9ce80cSJohannes Berg  */
10873b9ce80cSJohannes Berg enum station_parameters_apply_mask {
10883b9ce80cSJohannes Berg 	STATION_PARAM_APPLY_UAPSD = BIT(0),
10899d62a986SJouni Malinen 	STATION_PARAM_APPLY_CAPABILITY = BIT(1),
1090f8bacc21SJohannes Berg 	STATION_PARAM_APPLY_PLINK_STATE = BIT(2),
1091e96d1cd2SAshok Raj Nagarajan 	STATION_PARAM_APPLY_STA_TXPOWER = BIT(3),
1092e96d1cd2SAshok Raj Nagarajan };
1093e96d1cd2SAshok Raj Nagarajan 
1094e96d1cd2SAshok Raj Nagarajan /**
1095e96d1cd2SAshok Raj Nagarajan  * struct sta_txpwr - station txpower configuration
1096e96d1cd2SAshok Raj Nagarajan  *
1097e96d1cd2SAshok Raj Nagarajan  * Used to configure txpower for station.
1098e96d1cd2SAshok Raj Nagarajan  *
1099e96d1cd2SAshok Raj Nagarajan  * @power: tx power (in dBm) to be used for sending data traffic. If tx power
1100e96d1cd2SAshok Raj Nagarajan  *	is not provided, the default per-interface tx power setting will be
1101e96d1cd2SAshok Raj Nagarajan  *	overriding. Driver should be picking up the lowest tx power, either tx
1102e96d1cd2SAshok Raj Nagarajan  *	power per-interface or per-station.
1103e96d1cd2SAshok Raj Nagarajan  * @type: In particular if TPC %type is NL80211_TX_POWER_LIMITED then tx power
1104e96d1cd2SAshok Raj Nagarajan  *	will be less than or equal to specified from userspace, whereas if TPC
1105e96d1cd2SAshok Raj Nagarajan  *	%type is NL80211_TX_POWER_AUTOMATIC then it indicates default tx power.
1106e96d1cd2SAshok Raj Nagarajan  *	NL80211_TX_POWER_FIXED is not a valid configuration option for
1107e96d1cd2SAshok Raj Nagarajan  *	per peer TPC.
1108e96d1cd2SAshok Raj Nagarajan  */
1109e96d1cd2SAshok Raj Nagarajan struct sta_txpwr {
1110e96d1cd2SAshok Raj Nagarajan 	s16 power;
1111e96d1cd2SAshok Raj Nagarajan 	enum nl80211_tx_power_setting type;
11123b9ce80cSJohannes Berg };
11133b9ce80cSJohannes Berg 
11143b9ce80cSJohannes Berg /**
11155727ef1bSJohannes Berg  * struct station_parameters - station parameters
11165727ef1bSJohannes Berg  *
11175727ef1bSJohannes Berg  * Used to change and create a new station.
11185727ef1bSJohannes Berg  *
11195727ef1bSJohannes Berg  * @vlan: vlan interface station should belong to
11205727ef1bSJohannes Berg  * @supported_rates: supported rates in IEEE 802.11 format
11215727ef1bSJohannes Berg  *	(or NULL for no change)
11225727ef1bSJohannes Berg  * @supported_rates_len: number of supported rates
1123eccb8e8fSJohannes Berg  * @sta_flags_mask: station flags that changed
1124819bf593SJohannes Berg  *	(bitmask of BIT(%NL80211_STA_FLAG_...))
1125eccb8e8fSJohannes Berg  * @sta_flags_set: station flags values
1126819bf593SJohannes Berg  *	(bitmask of BIT(%NL80211_STA_FLAG_...))
11275727ef1bSJohannes Berg  * @listen_interval: listen interval or -1 for no change
11285727ef1bSJohannes Berg  * @aid: AID or zero for no change
112914f34e36SGurumoorthi Gnanasambandhan  * @vlan_id: VLAN ID for station (if nonzero)
11307d27a0baSMasashi Honma  * @peer_aid: mesh peer AID or zero for no change
1131abe37c4bSJohannes Berg  * @plink_action: plink action to take
11329c3990aaSJavier Cardona  * @plink_state: set the peer link state for a station
1133abe37c4bSJohannes Berg  * @ht_capa: HT capabilities of station
1134f461be3eSMahesh Palivela  * @vht_capa: VHT capabilities of station
1135910868dbSEliad Peller  * @uapsd_queues: bitmap of queues configured for uapsd. same format
1136910868dbSEliad Peller  *	as the AC bitmap in the QoS info field
1137910868dbSEliad Peller  * @max_sp: max Service Period. same format as the MAX_SP in the
1138910868dbSEliad Peller  *	QoS info field (but already shifted down)
1139c26887d2SJohannes Berg  * @sta_modify_mask: bitmap indicating which parameters changed
1140c26887d2SJohannes Berg  *	(for those that don't have a natural "no change" value),
1141c26887d2SJohannes Berg  *	see &enum station_parameters_apply_mask
11423b1c5a53SMarco Porsch  * @local_pm: local link-specific mesh power save mode (no change when set
11433b1c5a53SMarco Porsch  *	to unknown)
11449d62a986SJouni Malinen  * @capability: station capability
11459d62a986SJouni Malinen  * @ext_capab: extended capabilities of the station
11469d62a986SJouni Malinen  * @ext_capab_len: number of extended capabilities
1147c01fc9adSSunil Dutt  * @supported_channels: supported channels in IEEE 802.11 format
1148c01fc9adSSunil Dutt  * @supported_channels_len: number of supported channels
1149c01fc9adSSunil Dutt  * @supported_oper_classes: supported oper classes in IEEE 802.11 format
1150c01fc9adSSunil Dutt  * @supported_oper_classes_len: number of supported operating classes
115160f4a7b1SMarek Kwaczynski  * @opmode_notif: operating mode field from Operating Mode Notification
115260f4a7b1SMarek Kwaczynski  * @opmode_notif_used: information if operating mode field is used
115317b94247SAyala Beker  * @support_p2p_ps: information if station supports P2P PS mechanism
1154c4cbaf79SLuca Coelho  * @he_capa: HE capabilities of station
1155c4cbaf79SLuca Coelho  * @he_capa_len: the length of the HE capabilities
115636647055SToke Høiland-Jørgensen  * @airtime_weight: airtime scheduler weight for this station
11575727ef1bSJohannes Berg  */
11585727ef1bSJohannes Berg struct station_parameters {
11592c1aabf3SJohannes Berg 	const u8 *supported_rates;
11605727ef1bSJohannes Berg 	struct net_device *vlan;
1161eccb8e8fSJohannes Berg 	u32 sta_flags_mask, sta_flags_set;
11623b9ce80cSJohannes Berg 	u32 sta_modify_mask;
11635727ef1bSJohannes Berg 	int listen_interval;
11645727ef1bSJohannes Berg 	u16 aid;
116514f34e36SGurumoorthi Gnanasambandhan 	u16 vlan_id;
11667d27a0baSMasashi Honma 	u16 peer_aid;
11675727ef1bSJohannes Berg 	u8 supported_rates_len;
11682ec600d6SLuis Carlos Cobo 	u8 plink_action;
11699c3990aaSJavier Cardona 	u8 plink_state;
11702c1aabf3SJohannes Berg 	const struct ieee80211_ht_cap *ht_capa;
11712c1aabf3SJohannes Berg 	const struct ieee80211_vht_cap *vht_capa;
1172c75786c9SEliad Peller 	u8 uapsd_queues;
1173c75786c9SEliad Peller 	u8 max_sp;
11743b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode local_pm;
11759d62a986SJouni Malinen 	u16 capability;
11762c1aabf3SJohannes Berg 	const u8 *ext_capab;
11779d62a986SJouni Malinen 	u8 ext_capab_len;
1178c01fc9adSSunil Dutt 	const u8 *supported_channels;
1179c01fc9adSSunil Dutt 	u8 supported_channels_len;
1180c01fc9adSSunil Dutt 	const u8 *supported_oper_classes;
1181c01fc9adSSunil Dutt 	u8 supported_oper_classes_len;
118260f4a7b1SMarek Kwaczynski 	u8 opmode_notif;
118360f4a7b1SMarek Kwaczynski 	bool opmode_notif_used;
118417b94247SAyala Beker 	int support_p2p_ps;
1185c4cbaf79SLuca Coelho 	const struct ieee80211_he_cap_elem *he_capa;
1186c4cbaf79SLuca Coelho 	u8 he_capa_len;
118736647055SToke Høiland-Jørgensen 	u16 airtime_weight;
1188e96d1cd2SAshok Raj Nagarajan 	struct sta_txpwr txpwr;
11895727ef1bSJohannes Berg };
11905727ef1bSJohannes Berg 
1191fd5b74dcSJohannes Berg /**
119289c771e5SJouni Malinen  * struct station_del_parameters - station deletion parameters
119389c771e5SJouni Malinen  *
119489c771e5SJouni Malinen  * Used to delete a station entry (or all stations).
119589c771e5SJouni Malinen  *
119689c771e5SJouni Malinen  * @mac: MAC address of the station to remove or NULL to remove all stations
119798856866SJouni Malinen  * @subtype: Management frame subtype to use for indicating removal
119898856866SJouni Malinen  *	(10 = Disassociation, 12 = Deauthentication)
119998856866SJouni Malinen  * @reason_code: Reason code for the Disassociation/Deauthentication frame
120089c771e5SJouni Malinen  */
120189c771e5SJouni Malinen struct station_del_parameters {
120289c771e5SJouni Malinen 	const u8 *mac;
120398856866SJouni Malinen 	u8 subtype;
120498856866SJouni Malinen 	u16 reason_code;
120589c771e5SJouni Malinen };
120689c771e5SJouni Malinen 
120789c771e5SJouni Malinen /**
120877ee7c89SJohannes Berg  * enum cfg80211_station_type - the type of station being modified
120977ee7c89SJohannes Berg  * @CFG80211_STA_AP_CLIENT: client of an AP interface
121047edb11bSAyala Beker  * @CFG80211_STA_AP_CLIENT_UNASSOC: client of an AP interface that is still
121147edb11bSAyala Beker  *	unassociated (update properties for this type of client is permitted)
121277ee7c89SJohannes Berg  * @CFG80211_STA_AP_MLME_CLIENT: client of an AP interface that has
121377ee7c89SJohannes Berg  *	the AP MLME in the device
121477ee7c89SJohannes Berg  * @CFG80211_STA_AP_STA: AP station on managed interface
121577ee7c89SJohannes Berg  * @CFG80211_STA_IBSS: IBSS station
121677ee7c89SJohannes Berg  * @CFG80211_STA_TDLS_PEER_SETUP: TDLS peer on managed interface (dummy entry
121777ee7c89SJohannes Berg  *	while TDLS setup is in progress, it moves out of this state when
121877ee7c89SJohannes Berg  *	being marked authorized; use this only if TDLS with external setup is
121977ee7c89SJohannes Berg  *	supported/used)
122077ee7c89SJohannes Berg  * @CFG80211_STA_TDLS_PEER_ACTIVE: TDLS peer on managed interface (active
122177ee7c89SJohannes Berg  *	entry that is operating, has been marked authorized by userspace)
1222eef941e6SThomas Pedersen  * @CFG80211_STA_MESH_PEER_KERNEL: peer on mesh interface (kernel managed)
1223eef941e6SThomas Pedersen  * @CFG80211_STA_MESH_PEER_USER: peer on mesh interface (user managed)
122477ee7c89SJohannes Berg  */
122577ee7c89SJohannes Berg enum cfg80211_station_type {
122677ee7c89SJohannes Berg 	CFG80211_STA_AP_CLIENT,
122747edb11bSAyala Beker 	CFG80211_STA_AP_CLIENT_UNASSOC,
122877ee7c89SJohannes Berg 	CFG80211_STA_AP_MLME_CLIENT,
122977ee7c89SJohannes Berg 	CFG80211_STA_AP_STA,
123077ee7c89SJohannes Berg 	CFG80211_STA_IBSS,
123177ee7c89SJohannes Berg 	CFG80211_STA_TDLS_PEER_SETUP,
123277ee7c89SJohannes Berg 	CFG80211_STA_TDLS_PEER_ACTIVE,
1233eef941e6SThomas Pedersen 	CFG80211_STA_MESH_PEER_KERNEL,
1234eef941e6SThomas Pedersen 	CFG80211_STA_MESH_PEER_USER,
123577ee7c89SJohannes Berg };
123677ee7c89SJohannes Berg 
123777ee7c89SJohannes Berg /**
123877ee7c89SJohannes Berg  * cfg80211_check_station_change - validate parameter changes
123977ee7c89SJohannes Berg  * @wiphy: the wiphy this operates on
124077ee7c89SJohannes Berg  * @params: the new parameters for a station
124177ee7c89SJohannes Berg  * @statype: the type of station being modified
124277ee7c89SJohannes Berg  *
124377ee7c89SJohannes Berg  * Utility function for the @change_station driver method. Call this function
124477ee7c89SJohannes Berg  * with the appropriate station type looking up the station (and checking that
124577ee7c89SJohannes Berg  * it exists). It will verify whether the station change is acceptable, and if
124677ee7c89SJohannes Berg  * not will return an error code. Note that it may modify the parameters for
124777ee7c89SJohannes Berg  * backward compatibility reasons, so don't use them before calling this.
124877ee7c89SJohannes Berg  */
124977ee7c89SJohannes Berg int cfg80211_check_station_change(struct wiphy *wiphy,
125077ee7c89SJohannes Berg 				  struct station_parameters *params,
125177ee7c89SJohannes Berg 				  enum cfg80211_station_type statype);
125277ee7c89SJohannes Berg 
125377ee7c89SJohannes Berg /**
1254420e7fabSHenning Rogge  * enum station_info_rate_flags - bitrate info flags
1255420e7fabSHenning Rogge  *
1256420e7fabSHenning Rogge  * Used by the driver to indicate the specific rate transmission
1257420e7fabSHenning Rogge  * type for 802.11n transmissions.
1258420e7fabSHenning Rogge  *
1259db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_MCS: mcs field filled with HT MCS
1260db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_VHT_MCS: mcs field filled with VHT MCS
1261420e7fabSHenning Rogge  * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval
12622a38075cSAlexei Avshalom Lazar  * @RATE_INFO_FLAGS_DMG: 60GHz MCS
1263c4cbaf79SLuca Coelho  * @RATE_INFO_FLAGS_HE_MCS: HE MCS information
12642a38075cSAlexei Avshalom Lazar  * @RATE_INFO_FLAGS_EDMG: 60GHz MCS in EDMG mode
1265420e7fabSHenning Rogge  */
1266420e7fabSHenning Rogge enum rate_info_flags {
1267db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_MCS			= BIT(0),
1268db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_VHT_MCS			= BIT(1),
1269b51f3beeSJohannes Berg 	RATE_INFO_FLAGS_SHORT_GI		= BIT(2),
12702a38075cSAlexei Avshalom Lazar 	RATE_INFO_FLAGS_DMG			= BIT(3),
1271c4cbaf79SLuca Coelho 	RATE_INFO_FLAGS_HE_MCS			= BIT(4),
12722a38075cSAlexei Avshalom Lazar 	RATE_INFO_FLAGS_EDMG			= BIT(5),
1273b51f3beeSJohannes Berg };
1274b51f3beeSJohannes Berg 
1275b51f3beeSJohannes Berg /**
1276b51f3beeSJohannes Berg  * enum rate_info_bw - rate bandwidth information
1277b51f3beeSJohannes Berg  *
1278b51f3beeSJohannes Berg  * Used by the driver to indicate the rate bandwidth.
1279b51f3beeSJohannes Berg  *
1280b51f3beeSJohannes Berg  * @RATE_INFO_BW_5: 5 MHz bandwidth
1281b51f3beeSJohannes Berg  * @RATE_INFO_BW_10: 10 MHz bandwidth
1282b51f3beeSJohannes Berg  * @RATE_INFO_BW_20: 20 MHz bandwidth
1283b51f3beeSJohannes Berg  * @RATE_INFO_BW_40: 40 MHz bandwidth
1284b51f3beeSJohannes Berg  * @RATE_INFO_BW_80: 80 MHz bandwidth
1285b51f3beeSJohannes Berg  * @RATE_INFO_BW_160: 160 MHz bandwidth
1286c4cbaf79SLuca Coelho  * @RATE_INFO_BW_HE_RU: bandwidth determined by HE RU allocation
1287b51f3beeSJohannes Berg  */
1288b51f3beeSJohannes Berg enum rate_info_bw {
1289842be75cSJohannes Berg 	RATE_INFO_BW_20 = 0,
1290b51f3beeSJohannes Berg 	RATE_INFO_BW_5,
1291b51f3beeSJohannes Berg 	RATE_INFO_BW_10,
1292b51f3beeSJohannes Berg 	RATE_INFO_BW_40,
1293b51f3beeSJohannes Berg 	RATE_INFO_BW_80,
1294b51f3beeSJohannes Berg 	RATE_INFO_BW_160,
1295c4cbaf79SLuca Coelho 	RATE_INFO_BW_HE_RU,
1296420e7fabSHenning Rogge };
1297420e7fabSHenning Rogge 
1298420e7fabSHenning Rogge /**
1299420e7fabSHenning Rogge  * struct rate_info - bitrate information
1300420e7fabSHenning Rogge  *
1301420e7fabSHenning Rogge  * Information about a receiving or transmitting bitrate
1302420e7fabSHenning Rogge  *
1303420e7fabSHenning Rogge  * @flags: bitflag of flags from &enum rate_info_flags
1304c4cbaf79SLuca Coelho  * @mcs: mcs index if struct describes an HT/VHT/HE rate
1305420e7fabSHenning Rogge  * @legacy: bitrate in 100kbit/s for 802.11abg
1306c4cbaf79SLuca Coelho  * @nss: number of streams (VHT & HE only)
1307b51f3beeSJohannes Berg  * @bw: bandwidth (from &enum rate_info_bw)
1308c4cbaf79SLuca Coelho  * @he_gi: HE guard interval (from &enum nl80211_he_gi)
1309c4cbaf79SLuca Coelho  * @he_dcm: HE DCM value
1310c4cbaf79SLuca Coelho  * @he_ru_alloc: HE RU allocation (from &enum nl80211_he_ru_alloc,
1311c4cbaf79SLuca Coelho  *	only valid if bw is %RATE_INFO_BW_HE_RU)
13122a38075cSAlexei Avshalom Lazar  * @n_bonded_ch: In case of EDMG the number of bonded channels (1-4)
1313420e7fabSHenning Rogge  */
1314420e7fabSHenning Rogge struct rate_info {
1315420e7fabSHenning Rogge 	u8 flags;
1316420e7fabSHenning Rogge 	u8 mcs;
1317420e7fabSHenning Rogge 	u16 legacy;
1318db9c64cfSJohannes Berg 	u8 nss;
1319b51f3beeSJohannes Berg 	u8 bw;
1320c4cbaf79SLuca Coelho 	u8 he_gi;
1321c4cbaf79SLuca Coelho 	u8 he_dcm;
1322c4cbaf79SLuca Coelho 	u8 he_ru_alloc;
13232a38075cSAlexei Avshalom Lazar 	u8 n_bonded_ch;
1324fd5b74dcSJohannes Berg };
1325fd5b74dcSJohannes Berg 
1326fd5b74dcSJohannes Berg /**
1327f4263c98SPaul Stewart  * enum station_info_rate_flags - bitrate info flags
1328f4263c98SPaul Stewart  *
1329f4263c98SPaul Stewart  * Used by the driver to indicate the specific rate transmission
1330f4263c98SPaul Stewart  * type for 802.11n transmissions.
1331f4263c98SPaul Stewart  *
1332f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_CTS_PROT: whether CTS protection is enabled
1333f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_SHORT_PREAMBLE: whether short preamble is enabled
1334f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_SHORT_SLOT_TIME: whether short slot time is enabled
1335f4263c98SPaul Stewart  */
1336f4263c98SPaul Stewart enum bss_param_flags {
1337f4263c98SPaul Stewart 	BSS_PARAM_FLAGS_CTS_PROT	= 1<<0,
1338f4263c98SPaul Stewart 	BSS_PARAM_FLAGS_SHORT_PREAMBLE	= 1<<1,
1339f4263c98SPaul Stewart 	BSS_PARAM_FLAGS_SHORT_SLOT_TIME	= 1<<2,
1340f4263c98SPaul Stewart };
1341f4263c98SPaul Stewart 
1342f4263c98SPaul Stewart /**
1343f4263c98SPaul Stewart  * struct sta_bss_parameters - BSS parameters for the attached station
1344f4263c98SPaul Stewart  *
1345f4263c98SPaul Stewart  * Information about the currently associated BSS
1346f4263c98SPaul Stewart  *
1347f4263c98SPaul Stewart  * @flags: bitflag of flags from &enum bss_param_flags
1348f4263c98SPaul Stewart  * @dtim_period: DTIM period for the BSS
1349f4263c98SPaul Stewart  * @beacon_interval: beacon interval
1350f4263c98SPaul Stewart  */
1351f4263c98SPaul Stewart struct sta_bss_parameters {
1352f4263c98SPaul Stewart 	u8 flags;
1353f4263c98SPaul Stewart 	u8 dtim_period;
1354f4263c98SPaul Stewart 	u16 beacon_interval;
1355f4263c98SPaul Stewart };
1356f4263c98SPaul Stewart 
13576de39808SJohannes Berg /**
135852539ca8SToke Høiland-Jørgensen  * struct cfg80211_txq_stats - TXQ statistics for this TID
135952539ca8SToke Høiland-Jørgensen  * @filled: bitmap of flags using the bits of &enum nl80211_txq_stats to
136052539ca8SToke Høiland-Jørgensen  *	indicate the relevant values in this struct are filled
136152539ca8SToke Høiland-Jørgensen  * @backlog_bytes: total number of bytes currently backlogged
136252539ca8SToke Høiland-Jørgensen  * @backlog_packets: total number of packets currently backlogged
136352539ca8SToke Høiland-Jørgensen  * @flows: number of new flows seen
136452539ca8SToke Høiland-Jørgensen  * @drops: total number of packets dropped
136552539ca8SToke Høiland-Jørgensen  * @ecn_marks: total number of packets marked with ECN CE
136652539ca8SToke Høiland-Jørgensen  * @overlimit: number of drops due to queue space overflow
136752539ca8SToke Høiland-Jørgensen  * @overmemory: number of drops due to memory limit overflow
136852539ca8SToke Høiland-Jørgensen  * @collisions: number of hash collisions
136952539ca8SToke Høiland-Jørgensen  * @tx_bytes: total number of bytes dequeued
137052539ca8SToke Høiland-Jørgensen  * @tx_packets: total number of packets dequeued
137152539ca8SToke Høiland-Jørgensen  * @max_flows: maximum number of flows supported
137252539ca8SToke Høiland-Jørgensen  */
137352539ca8SToke Høiland-Jørgensen struct cfg80211_txq_stats {
137452539ca8SToke Høiland-Jørgensen 	u32 filled;
137552539ca8SToke Høiland-Jørgensen 	u32 backlog_bytes;
137652539ca8SToke Høiland-Jørgensen 	u32 backlog_packets;
137752539ca8SToke Høiland-Jørgensen 	u32 flows;
137852539ca8SToke Høiland-Jørgensen 	u32 drops;
137952539ca8SToke Høiland-Jørgensen 	u32 ecn_marks;
138052539ca8SToke Høiland-Jørgensen 	u32 overlimit;
138152539ca8SToke Høiland-Jørgensen 	u32 overmemory;
138252539ca8SToke Høiland-Jørgensen 	u32 collisions;
138352539ca8SToke Høiland-Jørgensen 	u32 tx_bytes;
138452539ca8SToke Høiland-Jørgensen 	u32 tx_packets;
138552539ca8SToke Høiland-Jørgensen 	u32 max_flows;
138652539ca8SToke Høiland-Jørgensen };
138752539ca8SToke Høiland-Jørgensen 
138852539ca8SToke Høiland-Jørgensen /**
13896de39808SJohannes Berg  * struct cfg80211_tid_stats - per-TID statistics
13906de39808SJohannes Berg  * @filled: bitmap of flags using the bits of &enum nl80211_tid_stats to
13916de39808SJohannes Berg  *	indicate the relevant values in this struct are filled
13926de39808SJohannes Berg  * @rx_msdu: number of received MSDUs
13936de39808SJohannes Berg  * @tx_msdu: number of (attempted) transmitted MSDUs
13946de39808SJohannes Berg  * @tx_msdu_retries: number of retries (not counting the first) for
13956de39808SJohannes Berg  *	transmitted MSDUs
13966de39808SJohannes Berg  * @tx_msdu_failed: number of failed transmitted MSDUs
139752539ca8SToke Høiland-Jørgensen  * @txq_stats: TXQ statistics
13986de39808SJohannes Berg  */
13996de39808SJohannes Berg struct cfg80211_tid_stats {
14006de39808SJohannes Berg 	u32 filled;
14016de39808SJohannes Berg 	u64 rx_msdu;
14026de39808SJohannes Berg 	u64 tx_msdu;
14036de39808SJohannes Berg 	u64 tx_msdu_retries;
14046de39808SJohannes Berg 	u64 tx_msdu_failed;
140552539ca8SToke Høiland-Jørgensen 	struct cfg80211_txq_stats txq_stats;
14066de39808SJohannes Berg };
14076de39808SJohannes Berg 
1408119363c7SFelix Fietkau #define IEEE80211_MAX_CHAINS	4
1409119363c7SFelix Fietkau 
1410f4263c98SPaul Stewart /**
14112ec600d6SLuis Carlos Cobo  * struct station_info - station information
1412fd5b74dcSJohannes Berg  *
14132ec600d6SLuis Carlos Cobo  * Station information filled by driver for get_station() and dump_station.
1414fd5b74dcSJohannes Berg  *
1415319090bfSJohannes Berg  * @filled: bitflag of flags using the bits of &enum nl80211_sta_info to
1416319090bfSJohannes Berg  *	indicate the relevant values in this struct for them
1417ebe27c91SMohammed Shafi Shajakhan  * @connected_time: time(in secs) since a station is last connected
1418fd5b74dcSJohannes Berg  * @inactive_time: time since last station activity (tx/rx) in milliseconds
14196c7a0033SBen Greear  * @assoc_at: bootime (ns) of the last association
14208d791361SJohannes Berg  * @rx_bytes: bytes (size of MPDUs) received from this station
14218d791361SJohannes Berg  * @tx_bytes: bytes (size of MPDUs) transmitted to this station
14222ec600d6SLuis Carlos Cobo  * @llid: mesh local link id
14232ec600d6SLuis Carlos Cobo  * @plid: mesh peer link id
14242ec600d6SLuis Carlos Cobo  * @plink_state: mesh peer link state
142573c3df3bSJohannes Berg  * @signal: The signal strength, type depends on the wiphy's signal_type.
142673c3df3bSJohannes Berg  *	For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
142773c3df3bSJohannes Berg  * @signal_avg: Average signal strength, type depends on the wiphy's signal_type.
142873c3df3bSJohannes Berg  *	For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
1429119363c7SFelix Fietkau  * @chains: bitmask for filled values in @chain_signal, @chain_signal_avg
1430119363c7SFelix Fietkau  * @chain_signal: per-chain signal strength of last received packet in dBm
1431119363c7SFelix Fietkau  * @chain_signal_avg: per-chain signal strength average in dBm
1432858022aaSRandy Dunlap  * @txrate: current unicast bitrate from this station
1433858022aaSRandy Dunlap  * @rxrate: current unicast bitrate to this station
14348d791361SJohannes Berg  * @rx_packets: packets (MSDUs & MMPDUs) received from this station
14358d791361SJohannes Berg  * @tx_packets: packets (MSDUs & MMPDUs) transmitted to this station
14368d791361SJohannes Berg  * @tx_retries: cumulative retry counts (MPDUs)
14378d791361SJohannes Berg  * @tx_failed: number of failed transmissions (MPDUs) (retries exceeded, no ACK)
14385a5c731aSBen Greear  * @rx_dropped_misc:  Dropped for un-specified reason.
14391ba01458SRandy Dunlap  * @bss_param: current BSS parameters
1440f5ea9120SJohannes Berg  * @generation: generation number for nl80211 dumps.
1441f5ea9120SJohannes Berg  *	This number should increase every time the list of stations
1442f5ea9120SJohannes Berg  *	changes, i.e. when a station is added or removed, so that
1443f5ea9120SJohannes Berg  *	userspace can tell whether it got a consistent snapshot.
144450d3dfb7SJouni Malinen  * @assoc_req_ies: IEs from (Re)Association Request.
144550d3dfb7SJouni Malinen  *	This is used only when in AP mode with drivers that do not use
144650d3dfb7SJouni Malinen  *	user space MLME/SME implementation. The information is provided for
144750d3dfb7SJouni Malinen  *	the cfg80211_new_sta() calls to notify user space of the IEs.
144850d3dfb7SJouni Malinen  * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets.
1449c26887d2SJohannes Berg  * @sta_flags: station flags mask & values
1450a85e1d55SPaul Stewart  * @beacon_loss_count: Number of times beacon loss event has triggered.
1451d299a1f2SJavier Cardona  * @t_offset: Time offset of the station relative to this host.
14523b1c5a53SMarco Porsch  * @local_pm: local mesh STA power save mode
14533b1c5a53SMarco Porsch  * @peer_pm: peer mesh STA power save mode
14543b1c5a53SMarco Porsch  * @nonpeer_pm: non-peer mesh STA power save mode
1455867d849fSAntonio Quartulli  * @expected_throughput: expected throughput in kbps (including 802.11 headers)
1456867d849fSAntonio Quartulli  *	towards this station.
1457a76b1942SJohannes Berg  * @rx_beacon: number of beacons received from this peer
1458a76b1942SJohannes Berg  * @rx_beacon_signal_avg: signal strength average (in dBm) for beacons received
1459a76b1942SJohannes Berg  *	from this peer
1460dbdaee7aSBob Copeland  * @connected_to_gate: true if mesh STA has a path to mesh gate
1461739960f1SMohammed Shafi Shajakhan  * @rx_duration: aggregate PPDU duration(usecs) for all the frames from a peer
146236647055SToke Høiland-Jørgensen  * @tx_duration: aggregate PPDU duration(usecs) for all the frames to a peer
146336647055SToke Høiland-Jørgensen  * @airtime_weight: current airtime scheduling weight
14646de39808SJohannes Berg  * @pertid: per-TID statistics, see &struct cfg80211_tid_stats, using the last
14656de39808SJohannes Berg  *	(IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs.
14668689c051SArend van Spriel  *	Note that this doesn't use the @filled bit, but is used if non-NULL.
1467c4b50cd3SVenkateswara Naralasetty  * @ack_signal: signal strength (in dBm) of the last ACK frame.
146881d5439dSBalaji Pothunoori  * @avg_ack_signal: average rssi value of ack packet for the no of msdu's has
146981d5439dSBalaji Pothunoori  *	been sent.
14700d4e14a3SAnkita Bajaj  * @rx_mpdu_count: number of MPDUs received from this station
14710d4e14a3SAnkita Bajaj  * @fcs_err_count: number of packets (MPDUs) received from this station with
14720d4e14a3SAnkita Bajaj  *	an FCS error. This counter should be incremented only when TA of the
14730d4e14a3SAnkita Bajaj  *	received packet with an FCS error matches the peer MAC address.
1474ab60633cSNarayanraddi Masti  * @airtime_link_metric: mesh airtime link metric.
1475fd5b74dcSJohannes Berg  */
14762ec600d6SLuis Carlos Cobo struct station_info {
1477739960f1SMohammed Shafi Shajakhan 	u64 filled;
1478ebe27c91SMohammed Shafi Shajakhan 	u32 connected_time;
1479fd5b74dcSJohannes Berg 	u32 inactive_time;
14806c7a0033SBen Greear 	u64 assoc_at;
148142745e03SVladimir Kondratiev 	u64 rx_bytes;
148242745e03SVladimir Kondratiev 	u64 tx_bytes;
14832ec600d6SLuis Carlos Cobo 	u16 llid;
14842ec600d6SLuis Carlos Cobo 	u16 plid;
14852ec600d6SLuis Carlos Cobo 	u8 plink_state;
1486420e7fabSHenning Rogge 	s8 signal;
1487541a45a1SBruno Randolf 	s8 signal_avg;
1488119363c7SFelix Fietkau 
1489119363c7SFelix Fietkau 	u8 chains;
1490119363c7SFelix Fietkau 	s8 chain_signal[IEEE80211_MAX_CHAINS];
1491119363c7SFelix Fietkau 	s8 chain_signal_avg[IEEE80211_MAX_CHAINS];
1492119363c7SFelix Fietkau 
1493420e7fabSHenning Rogge 	struct rate_info txrate;
1494c8dcfd8aSFelix Fietkau 	struct rate_info rxrate;
149598c8a60aSJouni Malinen 	u32 rx_packets;
149698c8a60aSJouni Malinen 	u32 tx_packets;
1497b206b4efSBruno Randolf 	u32 tx_retries;
1498b206b4efSBruno Randolf 	u32 tx_failed;
14995a5c731aSBen Greear 	u32 rx_dropped_misc;
1500f4263c98SPaul Stewart 	struct sta_bss_parameters bss_param;
1501bb6e753eSHelmut Schaa 	struct nl80211_sta_flag_update sta_flags;
1502f5ea9120SJohannes Berg 
1503f5ea9120SJohannes Berg 	int generation;
150450d3dfb7SJouni Malinen 
150550d3dfb7SJouni Malinen 	const u8 *assoc_req_ies;
150650d3dfb7SJouni Malinen 	size_t assoc_req_ies_len;
1507f612cedfSJouni Malinen 
1508a85e1d55SPaul Stewart 	u32 beacon_loss_count;
1509d299a1f2SJavier Cardona 	s64 t_offset;
15103b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode local_pm;
15113b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode peer_pm;
15123b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode nonpeer_pm;
1513a85e1d55SPaul Stewart 
1514867d849fSAntonio Quartulli 	u32 expected_throughput;
1515a76b1942SJohannes Berg 
151636647055SToke Høiland-Jørgensen 	u64 tx_duration;
1517739960f1SMohammed Shafi Shajakhan 	u64 rx_duration;
151836647055SToke Høiland-Jørgensen 	u64 rx_beacon;
1519a76b1942SJohannes Berg 	u8 rx_beacon_signal_avg;
1520dbdaee7aSBob Copeland 	u8 connected_to_gate;
1521dbdaee7aSBob Copeland 
15228689c051SArend van Spriel 	struct cfg80211_tid_stats *pertid;
1523c4b50cd3SVenkateswara Naralasetty 	s8 ack_signal;
152481d5439dSBalaji Pothunoori 	s8 avg_ack_signal;
15250d4e14a3SAnkita Bajaj 
152636647055SToke Høiland-Jørgensen 	u16 airtime_weight;
152736647055SToke Høiland-Jørgensen 
15280d4e14a3SAnkita Bajaj 	u32 rx_mpdu_count;
15290d4e14a3SAnkita Bajaj 	u32 fcs_err_count;
1530ab60633cSNarayanraddi Masti 
1531ab60633cSNarayanraddi Masti 	u32 airtime_link_metric;
1532fd5b74dcSJohannes Berg };
1533fd5b74dcSJohannes Berg 
153461aaa0e8SLinus Lüssing #if IS_ENABLED(CONFIG_CFG80211)
153566f7ac50SMichael Wu /**
15367406353dSAntonio Quartulli  * cfg80211_get_station - retrieve information about a given station
15377406353dSAntonio Quartulli  * @dev: the device where the station is supposed to be connected to
15387406353dSAntonio Quartulli  * @mac_addr: the mac address of the station of interest
15397406353dSAntonio Quartulli  * @sinfo: pointer to the structure to fill with the information
15407406353dSAntonio Quartulli  *
15417406353dSAntonio Quartulli  * Returns 0 on success and sinfo is filled with the available information
15427406353dSAntonio Quartulli  * otherwise returns a negative error code and the content of sinfo has to be
15437406353dSAntonio Quartulli  * considered undefined.
15447406353dSAntonio Quartulli  */
15457406353dSAntonio Quartulli int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr,
15467406353dSAntonio Quartulli 			 struct station_info *sinfo);
154761aaa0e8SLinus Lüssing #else
154861aaa0e8SLinus Lüssing static inline int cfg80211_get_station(struct net_device *dev,
154961aaa0e8SLinus Lüssing 				       const u8 *mac_addr,
155061aaa0e8SLinus Lüssing 				       struct station_info *sinfo)
155161aaa0e8SLinus Lüssing {
155261aaa0e8SLinus Lüssing 	return -ENOENT;
155361aaa0e8SLinus Lüssing }
155461aaa0e8SLinus Lüssing #endif
15557406353dSAntonio Quartulli 
15567406353dSAntonio Quartulli /**
155766f7ac50SMichael Wu  * enum monitor_flags - monitor flags
155866f7ac50SMichael Wu  *
155966f7ac50SMichael Wu  * Monitor interface configuration flags. Note that these must be the bits
156066f7ac50SMichael Wu  * according to the nl80211 flags.
156166f7ac50SMichael Wu  *
1562818a986eSJohannes Berg  * @MONITOR_FLAG_CHANGED: set if the flags were changed
156366f7ac50SMichael Wu  * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS
156466f7ac50SMichael Wu  * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP
156566f7ac50SMichael Wu  * @MONITOR_FLAG_CONTROL: pass control frames
156666f7ac50SMichael Wu  * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering
156766f7ac50SMichael Wu  * @MONITOR_FLAG_COOK_FRAMES: report frames after processing
1568e057d3c3SFelix Fietkau  * @MONITOR_FLAG_ACTIVE: active monitor, ACKs frames on its MAC address
156966f7ac50SMichael Wu  */
157066f7ac50SMichael Wu enum monitor_flags {
1571818a986eSJohannes Berg 	MONITOR_FLAG_CHANGED		= 1<<__NL80211_MNTR_FLAG_INVALID,
157266f7ac50SMichael Wu 	MONITOR_FLAG_FCSFAIL		= 1<<NL80211_MNTR_FLAG_FCSFAIL,
157366f7ac50SMichael Wu 	MONITOR_FLAG_PLCPFAIL		= 1<<NL80211_MNTR_FLAG_PLCPFAIL,
157466f7ac50SMichael Wu 	MONITOR_FLAG_CONTROL		= 1<<NL80211_MNTR_FLAG_CONTROL,
157566f7ac50SMichael Wu 	MONITOR_FLAG_OTHER_BSS		= 1<<NL80211_MNTR_FLAG_OTHER_BSS,
157666f7ac50SMichael Wu 	MONITOR_FLAG_COOK_FRAMES	= 1<<NL80211_MNTR_FLAG_COOK_FRAMES,
1577e057d3c3SFelix Fietkau 	MONITOR_FLAG_ACTIVE		= 1<<NL80211_MNTR_FLAG_ACTIVE,
157866f7ac50SMichael Wu };
157966f7ac50SMichael Wu 
15802ec600d6SLuis Carlos Cobo /**
15812ec600d6SLuis Carlos Cobo  * enum mpath_info_flags -  mesh path information flags
15822ec600d6SLuis Carlos Cobo  *
15832ec600d6SLuis Carlos Cobo  * Used by the driver to indicate which info in &struct mpath_info it has filled
15842ec600d6SLuis Carlos Cobo  * in during get_station() or dump_station().
15852ec600d6SLuis Carlos Cobo  *
1586abe37c4bSJohannes Berg  * @MPATH_INFO_FRAME_QLEN: @frame_qlen filled
1587abe37c4bSJohannes Berg  * @MPATH_INFO_SN: @sn filled
1588abe37c4bSJohannes Berg  * @MPATH_INFO_METRIC: @metric filled
1589abe37c4bSJohannes Berg  * @MPATH_INFO_EXPTIME: @exptime filled
1590abe37c4bSJohannes Berg  * @MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled
1591abe37c4bSJohannes Berg  * @MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled
1592abe37c4bSJohannes Berg  * @MPATH_INFO_FLAGS: @flags filled
1593cc241636SJulan Hsu  * @MPATH_INFO_HOP_COUNT: @hop_count filled
15949874b71fSJohannes Berg  * @MPATH_INFO_PATH_CHANGE: @path_change_count filled
15952ec600d6SLuis Carlos Cobo  */
15962ec600d6SLuis Carlos Cobo enum mpath_info_flags {
15972ec600d6SLuis Carlos Cobo 	MPATH_INFO_FRAME_QLEN		= BIT(0),
1598d19b3bf6SRui Paulo 	MPATH_INFO_SN			= BIT(1),
15992ec600d6SLuis Carlos Cobo 	MPATH_INFO_METRIC		= BIT(2),
16002ec600d6SLuis Carlos Cobo 	MPATH_INFO_EXPTIME		= BIT(3),
16012ec600d6SLuis Carlos Cobo 	MPATH_INFO_DISCOVERY_TIMEOUT	= BIT(4),
16022ec600d6SLuis Carlos Cobo 	MPATH_INFO_DISCOVERY_RETRIES	= BIT(5),
16032ec600d6SLuis Carlos Cobo 	MPATH_INFO_FLAGS		= BIT(6),
1604540bbcb9SJulan Hsu 	MPATH_INFO_HOP_COUNT		= BIT(7),
1605540bbcb9SJulan Hsu 	MPATH_INFO_PATH_CHANGE		= BIT(8),
16062ec600d6SLuis Carlos Cobo };
16072ec600d6SLuis Carlos Cobo 
16082ec600d6SLuis Carlos Cobo /**
16092ec600d6SLuis Carlos Cobo  * struct mpath_info - mesh path information
16102ec600d6SLuis Carlos Cobo  *
16112ec600d6SLuis Carlos Cobo  * Mesh path information filled by driver for get_mpath() and dump_mpath().
16122ec600d6SLuis Carlos Cobo  *
16132ec600d6SLuis Carlos Cobo  * @filled: bitfield of flags from &enum mpath_info_flags
16142ec600d6SLuis Carlos Cobo  * @frame_qlen: number of queued frames for this destination
1615d19b3bf6SRui Paulo  * @sn: target sequence number
16162ec600d6SLuis Carlos Cobo  * @metric: metric (cost) of this mesh path
16172ec600d6SLuis Carlos Cobo  * @exptime: expiration time for the mesh path from now, in msecs
16182ec600d6SLuis Carlos Cobo  * @flags: mesh path flags
16192ec600d6SLuis Carlos Cobo  * @discovery_timeout: total mesh path discovery timeout, in msecs
16202ec600d6SLuis Carlos Cobo  * @discovery_retries: mesh path discovery retries
1621f5ea9120SJohannes Berg  * @generation: generation number for nl80211 dumps.
1622f5ea9120SJohannes Berg  *	This number should increase every time the list of mesh paths
1623f5ea9120SJohannes Berg  *	changes, i.e. when a station is added or removed, so that
1624f5ea9120SJohannes Berg  *	userspace can tell whether it got a consistent snapshot.
1625cc241636SJulan Hsu  * @hop_count: hops to destination
1626540bbcb9SJulan Hsu  * @path_change_count: total number of path changes to destination
16272ec600d6SLuis Carlos Cobo  */
16282ec600d6SLuis Carlos Cobo struct mpath_info {
16292ec600d6SLuis Carlos Cobo 	u32 filled;
16302ec600d6SLuis Carlos Cobo 	u32 frame_qlen;
1631d19b3bf6SRui Paulo 	u32 sn;
16322ec600d6SLuis Carlos Cobo 	u32 metric;
16332ec600d6SLuis Carlos Cobo 	u32 exptime;
16342ec600d6SLuis Carlos Cobo 	u32 discovery_timeout;
16352ec600d6SLuis Carlos Cobo 	u8 discovery_retries;
16362ec600d6SLuis Carlos Cobo 	u8 flags;
1637cc241636SJulan Hsu 	u8 hop_count;
1638540bbcb9SJulan Hsu 	u32 path_change_count;
1639f5ea9120SJohannes Berg 
1640f5ea9120SJohannes Berg 	int generation;
16412ec600d6SLuis Carlos Cobo };
16422ec600d6SLuis Carlos Cobo 
16439f1ba906SJouni Malinen /**
16449f1ba906SJouni Malinen  * struct bss_parameters - BSS parameters
16459f1ba906SJouni Malinen  *
16469f1ba906SJouni Malinen  * Used to change BSS parameters (mainly for AP mode).
16479f1ba906SJouni Malinen  *
16489f1ba906SJouni Malinen  * @use_cts_prot: Whether to use CTS protection
16499f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
16509f1ba906SJouni Malinen  * @use_short_preamble: Whether the use of short preambles is allowed
16519f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
16529f1ba906SJouni Malinen  * @use_short_slot_time: Whether the use of short slot time is allowed
16539f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
165490c97a04SJouni Malinen  * @basic_rates: basic rates in IEEE 802.11 format
165590c97a04SJouni Malinen  *	(or NULL for no change)
165690c97a04SJouni Malinen  * @basic_rates_len: number of basic rates
1657fd8aaaf3SFelix Fietkau  * @ap_isolate: do not forward packets between connected stations
165850b12f59SHelmut Schaa  * @ht_opmode: HT Operation mode
165950b12f59SHelmut Schaa  * 	(u16 = opmode, -1 = do not change)
166053cabad7SJohannes Berg  * @p2p_ctwindow: P2P CT Window (-1 = no change)
166153cabad7SJohannes Berg  * @p2p_opp_ps: P2P opportunistic PS (-1 = no change)
16629f1ba906SJouni Malinen  */
16639f1ba906SJouni Malinen struct bss_parameters {
16649f1ba906SJouni Malinen 	int use_cts_prot;
16659f1ba906SJouni Malinen 	int use_short_preamble;
16669f1ba906SJouni Malinen 	int use_short_slot_time;
1667c1e5f471SJohannes Berg 	const u8 *basic_rates;
166890c97a04SJouni Malinen 	u8 basic_rates_len;
1669fd8aaaf3SFelix Fietkau 	int ap_isolate;
167050b12f59SHelmut Schaa 	int ht_opmode;
167153cabad7SJohannes Berg 	s8 p2p_ctwindow, p2p_opp_ps;
16729f1ba906SJouni Malinen };
16732ec600d6SLuis Carlos Cobo 
16743ddd53f3SChun-Yeow Yeoh /**
167529cbe68cSJohannes Berg  * struct mesh_config - 802.11s mesh configuration
167629cbe68cSJohannes Berg  *
167729cbe68cSJohannes Berg  * These parameters can be changed while the mesh is active.
16783ddd53f3SChun-Yeow Yeoh  *
16793ddd53f3SChun-Yeow Yeoh  * @dot11MeshRetryTimeout: the initial retry timeout in millisecond units used
16803ddd53f3SChun-Yeow Yeoh  *	by the Mesh Peering Open message
16813ddd53f3SChun-Yeow Yeoh  * @dot11MeshConfirmTimeout: the initial retry timeout in millisecond units
16823ddd53f3SChun-Yeow Yeoh  *	used by the Mesh Peering Open message
16833ddd53f3SChun-Yeow Yeoh  * @dot11MeshHoldingTimeout: the confirm timeout in millisecond units used by
16843ddd53f3SChun-Yeow Yeoh  *	the mesh peering management to close a mesh peering
16853ddd53f3SChun-Yeow Yeoh  * @dot11MeshMaxPeerLinks: the maximum number of peer links allowed on this
16863ddd53f3SChun-Yeow Yeoh  *	mesh interface
16873ddd53f3SChun-Yeow Yeoh  * @dot11MeshMaxRetries: the maximum number of peer link open retries that can
16883ddd53f3SChun-Yeow Yeoh  *	be sent to establish a new peer link instance in a mesh
16893ddd53f3SChun-Yeow Yeoh  * @dot11MeshTTL: the value of TTL field set at a source mesh STA
16903ddd53f3SChun-Yeow Yeoh  * @element_ttl: the value of TTL field set at a mesh STA for path selection
16913ddd53f3SChun-Yeow Yeoh  *	elements
16923ddd53f3SChun-Yeow Yeoh  * @auto_open_plinks: whether we should automatically open peer links when we
16933ddd53f3SChun-Yeow Yeoh  *	detect compatible mesh peers
16943ddd53f3SChun-Yeow Yeoh  * @dot11MeshNbrOffsetMaxNeighbor: the maximum number of neighbors to
16953ddd53f3SChun-Yeow Yeoh  *	synchronize to for 11s default synchronization method
16963ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPmaxPREQretries: the number of action frames containing a PREQ
16973ddd53f3SChun-Yeow Yeoh  *	that an originator mesh STA can send to a particular path target
16983ddd53f3SChun-Yeow Yeoh  * @path_refresh_time: how frequently to refresh mesh paths in milliseconds
16993ddd53f3SChun-Yeow Yeoh  * @min_discovery_timeout: the minimum length of time to wait until giving up on
17003ddd53f3SChun-Yeow Yeoh  *	a path discovery in milliseconds
17013ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPactivePathTimeout: the time (in TUs) for which mesh STAs
17023ddd53f3SChun-Yeow Yeoh  *	receiving a PREQ shall consider the forwarding information from the
17033ddd53f3SChun-Yeow Yeoh  *	root to be valid. (TU = time unit)
17043ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPpreqMinInterval: the minimum interval of time (in TUs) during
17053ddd53f3SChun-Yeow Yeoh  *	which a mesh STA can send only one action frame containing a PREQ
17063ddd53f3SChun-Yeow Yeoh  *	element
17073ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPperrMinInterval: the minimum interval of time (in TUs) during
17083ddd53f3SChun-Yeow Yeoh  *	which a mesh STA can send only one Action frame containing a PERR
17093ddd53f3SChun-Yeow Yeoh  *	element
17103ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPnetDiameterTraversalTime: the interval of time (in TUs) that
17113ddd53f3SChun-Yeow Yeoh  *	it takes for an HWMP information element to propagate across the mesh
17123ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPRootMode: the configuration of a mesh STA as root mesh STA
17133ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPRannInterval: the interval of time (in TUs) between root
17143ddd53f3SChun-Yeow Yeoh  *	announcements are transmitted
17153ddd53f3SChun-Yeow Yeoh  * @dot11MeshGateAnnouncementProtocol: whether to advertise that this mesh
17163ddd53f3SChun-Yeow Yeoh  *	station has access to a broader network beyond the MBSS. (This is
17173ddd53f3SChun-Yeow Yeoh  *	missnamed in draft 12.0: dot11MeshGateAnnouncementProtocol set to true
17183ddd53f3SChun-Yeow Yeoh  *	only means that the station will announce others it's a mesh gate, but
17193ddd53f3SChun-Yeow Yeoh  *	not necessarily using the gate announcement protocol. Still keeping the
17203ddd53f3SChun-Yeow Yeoh  *	same nomenclature to be in sync with the spec)
17213ddd53f3SChun-Yeow Yeoh  * @dot11MeshForwarding: whether the Mesh STA is forwarding or non-forwarding
17223ddd53f3SChun-Yeow Yeoh  *	entity (default is TRUE - forwarding entity)
17233ddd53f3SChun-Yeow Yeoh  * @rssi_threshold: the threshold for average signal strength of candidate
17243ddd53f3SChun-Yeow Yeoh  *	station to establish a peer link
17253ddd53f3SChun-Yeow Yeoh  * @ht_opmode: mesh HT protection mode
1726ac1073a6SChun-Yeow Yeoh  *
1727ac1073a6SChun-Yeow Yeoh  * @dot11MeshHWMPactivePathToRootTimeout: The time (in TUs) for which mesh STAs
1728ac1073a6SChun-Yeow Yeoh  *	receiving a proactive PREQ shall consider the forwarding information to
1729ac1073a6SChun-Yeow Yeoh  *	the root mesh STA to be valid.
1730ac1073a6SChun-Yeow Yeoh  *
1731ac1073a6SChun-Yeow Yeoh  * @dot11MeshHWMProotInterval: The interval of time (in TUs) between proactive
1732ac1073a6SChun-Yeow Yeoh  *	PREQs are transmitted.
1733728b19e5SChun-Yeow Yeoh  * @dot11MeshHWMPconfirmationInterval: The minimum interval of time (in TUs)
1734728b19e5SChun-Yeow Yeoh  *	during which a mesh STA can send only one Action frame containing
1735728b19e5SChun-Yeow Yeoh  *	a PREQ element for root path confirmation.
17363b1c5a53SMarco Porsch  * @power_mode: The default mesh power save mode which will be the initial
17373b1c5a53SMarco Porsch  *	setting for new peer links.
17383b1c5a53SMarco Porsch  * @dot11MeshAwakeWindowDuration: The duration in TUs the STA will remain awake
17393b1c5a53SMarco Porsch  *	after transmitting its beacon.
17408e7c0538SColleen Twitty  * @plink_timeout: If no tx activity is seen from a STA we've established
17418e7c0538SColleen Twitty  *	peering with for longer than this time (in seconds), then remove it
17428e7c0538SColleen Twitty  *	from the STA's list of peers.  Default is 30 minutes.
174301d66fbdSBob Copeland  * @dot11MeshConnectedToMeshGate: if set to true, advertise that this STA is
174401d66fbdSBob Copeland  *      connected to a mesh gate in mesh formation info.  If false, the
174501d66fbdSBob Copeland  *      value in mesh formation is determined by the presence of root paths
174601d66fbdSBob Copeland  *      in the mesh path table
174729cbe68cSJohannes Berg  */
174893da9cc1Scolin@cozybit.com struct mesh_config {
174993da9cc1Scolin@cozybit.com 	u16 dot11MeshRetryTimeout;
175093da9cc1Scolin@cozybit.com 	u16 dot11MeshConfirmTimeout;
175193da9cc1Scolin@cozybit.com 	u16 dot11MeshHoldingTimeout;
175293da9cc1Scolin@cozybit.com 	u16 dot11MeshMaxPeerLinks;
175393da9cc1Scolin@cozybit.com 	u8 dot11MeshMaxRetries;
175493da9cc1Scolin@cozybit.com 	u8 dot11MeshTTL;
175545904f21SJavier Cardona 	u8 element_ttl;
175693da9cc1Scolin@cozybit.com 	bool auto_open_plinks;
1757d299a1f2SJavier Cardona 	u32 dot11MeshNbrOffsetMaxNeighbor;
175893da9cc1Scolin@cozybit.com 	u8 dot11MeshHWMPmaxPREQretries;
175993da9cc1Scolin@cozybit.com 	u32 path_refresh_time;
176093da9cc1Scolin@cozybit.com 	u16 min_discovery_timeout;
176193da9cc1Scolin@cozybit.com 	u32 dot11MeshHWMPactivePathTimeout;
176293da9cc1Scolin@cozybit.com 	u16 dot11MeshHWMPpreqMinInterval;
1763dca7e943SThomas Pedersen 	u16 dot11MeshHWMPperrMinInterval;
176493da9cc1Scolin@cozybit.com 	u16 dot11MeshHWMPnetDiameterTraversalTime;
176563c5723bSRui Paulo 	u8 dot11MeshHWMPRootMode;
176601d66fbdSBob Copeland 	bool dot11MeshConnectedToMeshGate;
17670507e159SJavier Cardona 	u16 dot11MeshHWMPRannInterval;
176816dd7267SJavier Cardona 	bool dot11MeshGateAnnouncementProtocol;
176994f90656SChun-Yeow Yeoh 	bool dot11MeshForwarding;
177055335137SAshok Nagarajan 	s32 rssi_threshold;
177170c33eaaSAshok Nagarajan 	u16 ht_opmode;
1772ac1073a6SChun-Yeow Yeoh 	u32 dot11MeshHWMPactivePathToRootTimeout;
1773ac1073a6SChun-Yeow Yeoh 	u16 dot11MeshHWMProotInterval;
1774728b19e5SChun-Yeow Yeoh 	u16 dot11MeshHWMPconfirmationInterval;
17753b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode power_mode;
17763b1c5a53SMarco Porsch 	u16 dot11MeshAwakeWindowDuration;
17778e7c0538SColleen Twitty 	u32 plink_timeout;
177893da9cc1Scolin@cozybit.com };
177993da9cc1Scolin@cozybit.com 
178031888487SJouni Malinen /**
178129cbe68cSJohannes Berg  * struct mesh_setup - 802.11s mesh setup configuration
1782683b6d3bSJohannes Berg  * @chandef: defines the channel to use
178329cbe68cSJohannes Berg  * @mesh_id: the mesh ID
178429cbe68cSJohannes Berg  * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes
1785d299a1f2SJavier Cardona  * @sync_method: which synchronization method to use
1786c80d545dSJavier Cardona  * @path_sel_proto: which path selection protocol to use
1787c80d545dSJavier Cardona  * @path_metric: which metric to use
17886e16d90bSColleen Twitty  * @auth_id: which authentication method this mesh is using
1789581a8b0fSJavier Cardona  * @ie: vendor information elements (optional)
1790581a8b0fSJavier Cardona  * @ie_len: length of vendor information elements
1791b130e5ceSJavier Cardona  * @is_authenticated: this mesh requires authentication
1792b130e5ceSJavier Cardona  * @is_secure: this mesh uses security
1793bb2798d4SThomas Pedersen  * @user_mpm: userspace handles all MPM functions
17949bdbf04dSMarco Porsch  * @dtim_period: DTIM period to use
17959bdbf04dSMarco Porsch  * @beacon_interval: beacon interval to use
17964bb62344SChun-Yeow Yeoh  * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a]
1797ffb3cf30SAshok Nagarajan  * @basic_rates: basic rates to use when creating the mesh
17988564e382SJohannes Berg  * @beacon_rate: bitrate to be used for beacons
1799d37d49c2SBenjamin Berg  * @userspace_handles_dfs: whether user space controls DFS operation, i.e.
1800d37d49c2SBenjamin Berg  *	changes the channel when a radar is detected. This is required
1801d37d49c2SBenjamin Berg  *	to operate on DFS channels.
18021224f583SDenis Kenzior  * @control_port_over_nl80211: TRUE if userspace expects to exchange control
18031224f583SDenis Kenzior  *	port frames over NL80211 instead of the network interface.
180429cbe68cSJohannes Berg  *
180529cbe68cSJohannes Berg  * These parameters are fixed when the mesh is created.
180629cbe68cSJohannes Berg  */
180729cbe68cSJohannes Berg struct mesh_setup {
1808683b6d3bSJohannes Berg 	struct cfg80211_chan_def chandef;
180929cbe68cSJohannes Berg 	const u8 *mesh_id;
181029cbe68cSJohannes Berg 	u8 mesh_id_len;
1811d299a1f2SJavier Cardona 	u8 sync_method;
1812c80d545dSJavier Cardona 	u8 path_sel_proto;
1813c80d545dSJavier Cardona 	u8 path_metric;
18146e16d90bSColleen Twitty 	u8 auth_id;
1815581a8b0fSJavier Cardona 	const u8 *ie;
1816581a8b0fSJavier Cardona 	u8 ie_len;
1817b130e5ceSJavier Cardona 	bool is_authenticated;
181815d5dda6SJavier Cardona 	bool is_secure;
1819bb2798d4SThomas Pedersen 	bool user_mpm;
18209bdbf04dSMarco Porsch 	u8 dtim_period;
18219bdbf04dSMarco Porsch 	u16 beacon_interval;
182257fbcce3SJohannes Berg 	int mcast_rate[NUM_NL80211_BANDS];
1823ffb3cf30SAshok Nagarajan 	u32 basic_rates;
18248564e382SJohannes Berg 	struct cfg80211_bitrate_mask beacon_rate;
1825d37d49c2SBenjamin Berg 	bool userspace_handles_dfs;
18261224f583SDenis Kenzior 	bool control_port_over_nl80211;
182729cbe68cSJohannes Berg };
182829cbe68cSJohannes Berg 
182929cbe68cSJohannes Berg /**
18306e0bd6c3SRostislav Lisovy  * struct ocb_setup - 802.11p OCB mode setup configuration
18316e0bd6c3SRostislav Lisovy  * @chandef: defines the channel to use
18326e0bd6c3SRostislav Lisovy  *
18336e0bd6c3SRostislav Lisovy  * These parameters are fixed when connecting to the network
18346e0bd6c3SRostislav Lisovy  */
18356e0bd6c3SRostislav Lisovy struct ocb_setup {
18366e0bd6c3SRostislav Lisovy 	struct cfg80211_chan_def chandef;
18376e0bd6c3SRostislav Lisovy };
18386e0bd6c3SRostislav Lisovy 
18396e0bd6c3SRostislav Lisovy /**
184031888487SJouni Malinen  * struct ieee80211_txq_params - TX queue parameters
1841a3304b0aSJohannes Berg  * @ac: AC identifier
184231888487SJouni Malinen  * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled
184331888487SJouni Malinen  * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range
184431888487SJouni Malinen  *	1..32767]
184531888487SJouni Malinen  * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range
184631888487SJouni Malinen  *	1..32767]
184731888487SJouni Malinen  * @aifs: Arbitration interframe space [0..255]
184831888487SJouni Malinen  */
184931888487SJouni Malinen struct ieee80211_txq_params {
1850a3304b0aSJohannes Berg 	enum nl80211_ac ac;
185131888487SJouni Malinen 	u16 txop;
185231888487SJouni Malinen 	u16 cwmin;
185331888487SJouni Malinen 	u16 cwmax;
185431888487SJouni Malinen 	u8 aifs;
185531888487SJouni Malinen };
185631888487SJouni Malinen 
1857d70e9693SJohannes Berg /**
1858d70e9693SJohannes Berg  * DOC: Scanning and BSS list handling
1859d70e9693SJohannes Berg  *
1860d70e9693SJohannes Berg  * The scanning process itself is fairly simple, but cfg80211 offers quite
1861d70e9693SJohannes Berg  * a bit of helper functionality. To start a scan, the scan operation will
1862d70e9693SJohannes Berg  * be invoked with a scan definition. This scan definition contains the
1863d70e9693SJohannes Berg  * channels to scan, and the SSIDs to send probe requests for (including the
1864d70e9693SJohannes Berg  * wildcard, if desired). A passive scan is indicated by having no SSIDs to
1865d70e9693SJohannes Berg  * probe. Additionally, a scan request may contain extra information elements
1866d70e9693SJohannes Berg  * that should be added to the probe request. The IEs are guaranteed to be
1867d70e9693SJohannes Berg  * well-formed, and will not exceed the maximum length the driver advertised
1868d70e9693SJohannes Berg  * in the wiphy structure.
1869d70e9693SJohannes Berg  *
1870d70e9693SJohannes Berg  * When scanning finds a BSS, cfg80211 needs to be notified of that, because
1871d70e9693SJohannes Berg  * it is responsible for maintaining the BSS list; the driver should not
1872d70e9693SJohannes Berg  * maintain a list itself. For this notification, various functions exist.
1873d70e9693SJohannes Berg  *
1874d70e9693SJohannes Berg  * Since drivers do not maintain a BSS list, there are also a number of
1875d70e9693SJohannes Berg  * functions to search for a BSS and obtain information about it from the
1876d70e9693SJohannes Berg  * BSS structure cfg80211 maintains. The BSS list is also made available
1877d70e9693SJohannes Berg  * to userspace.
1878d70e9693SJohannes Berg  */
187972bdcf34SJouni Malinen 
1880704232c2SJohannes Berg /**
18812a519311SJohannes Berg  * struct cfg80211_ssid - SSID description
18822a519311SJohannes Berg  * @ssid: the SSID
18832a519311SJohannes Berg  * @ssid_len: length of the ssid
18842a519311SJohannes Berg  */
18852a519311SJohannes Berg struct cfg80211_ssid {
18862a519311SJohannes Berg 	u8 ssid[IEEE80211_MAX_SSID_LEN];
18872a519311SJohannes Berg 	u8 ssid_len;
18882a519311SJohannes Berg };
18892a519311SJohannes Berg 
18902a519311SJohannes Berg /**
18911d76250bSAvraham Stern  * struct cfg80211_scan_info - information about completed scan
18921d76250bSAvraham Stern  * @scan_start_tsf: scan start time in terms of the TSF of the BSS that the
18931d76250bSAvraham Stern  *	wireless device that requested the scan is connected to. If this
18941d76250bSAvraham Stern  *	information is not available, this field is left zero.
18951d76250bSAvraham Stern  * @tsf_bssid: the BSSID according to which %scan_start_tsf is set.
18961d76250bSAvraham Stern  * @aborted: set to true if the scan was aborted for any reason,
18971d76250bSAvraham Stern  *	userspace will be notified of that
18981d76250bSAvraham Stern  */
18991d76250bSAvraham Stern struct cfg80211_scan_info {
19001d76250bSAvraham Stern 	u64 scan_start_tsf;
19011d76250bSAvraham Stern 	u8 tsf_bssid[ETH_ALEN] __aligned(2);
19021d76250bSAvraham Stern 	bool aborted;
19031d76250bSAvraham Stern };
19041d76250bSAvraham Stern 
19051d76250bSAvraham Stern /**
19062a519311SJohannes Berg  * struct cfg80211_scan_request - scan request description
19072a519311SJohannes Berg  *
19082a519311SJohannes Berg  * @ssids: SSIDs to scan for (active scan only)
19092a519311SJohannes Berg  * @n_ssids: number of SSIDs
19102a519311SJohannes Berg  * @channels: channels to scan on.
1911ca3dbc20SHelmut Schaa  * @n_channels: total number of channels to scan
1912dcd6eac1SSimon Wunderlich  * @scan_width: channel width for scanning
191370692ad2SJouni Malinen  * @ie: optional information element(s) to add into Probe Request or %NULL
191470692ad2SJouni Malinen  * @ie_len: length of ie in octets
19151d76250bSAvraham Stern  * @duration: how long to listen on each channel, in TUs. If
19161d76250bSAvraham Stern  *	%duration_mandatory is not set, this is the maximum dwell time and
19171d76250bSAvraham Stern  *	the actual dwell time may be shorter.
19181d76250bSAvraham Stern  * @duration_mandatory: if set, the scan duration must be as specified by the
19191d76250bSAvraham Stern  *	%duration field.
1920ed473771SSam Leffler  * @flags: bit field of flags controlling operation
192134850ab2SJohannes Berg  * @rates: bitmap of rates to advertise for each band
19222a519311SJohannes Berg  * @wiphy: the wiphy this was for
192315d6030bSSam Leffler  * @scan_start: time (in jiffies) when the scan started
1924fd014284SJohannes Berg  * @wdev: the wireless device to scan for
19251d76250bSAvraham Stern  * @info: (internal) information about completed scan
19265fe231e8SJohannes Berg  * @notified: (internal) scan request was notified as done or aborted
1927e9f935e3SRajkumar Manoharan  * @no_cck: used to send probe requests at non CCK rate in 2GHz band
1928ad2b26abSJohannes Berg  * @mac_addr: MAC address used with randomisation
1929ad2b26abSJohannes Berg  * @mac_addr_mask: MAC address mask used with randomisation, bits that
1930ad2b26abSJohannes Berg  *	are 0 in the mask should be randomised, bits that are 1 should
1931ad2b26abSJohannes Berg  *	be taken from the @mac_addr
1932818965d3SJouni Malinen  * @bssid: BSSID to scan for (most commonly, the wildcard BSSID)
19332a519311SJohannes Berg  */
19342a519311SJohannes Berg struct cfg80211_scan_request {
19352a519311SJohannes Berg 	struct cfg80211_ssid *ssids;
19362a519311SJohannes Berg 	int n_ssids;
19372a519311SJohannes Berg 	u32 n_channels;
1938dcd6eac1SSimon Wunderlich 	enum nl80211_bss_scan_width scan_width;
1939de95a54bSJohannes Berg 	const u8 *ie;
194070692ad2SJouni Malinen 	size_t ie_len;
19411d76250bSAvraham Stern 	u16 duration;
19421d76250bSAvraham Stern 	bool duration_mandatory;
1943ed473771SSam Leffler 	u32 flags;
19442a519311SJohannes Berg 
194557fbcce3SJohannes Berg 	u32 rates[NUM_NL80211_BANDS];
194634850ab2SJohannes Berg 
1947fd014284SJohannes Berg 	struct wireless_dev *wdev;
1948fd014284SJohannes Berg 
1949ad2b26abSJohannes Berg 	u8 mac_addr[ETH_ALEN] __aligned(2);
1950ad2b26abSJohannes Berg 	u8 mac_addr_mask[ETH_ALEN] __aligned(2);
1951818965d3SJouni Malinen 	u8 bssid[ETH_ALEN] __aligned(2);
1952ad2b26abSJohannes Berg 
19532a519311SJohannes Berg 	/* internal */
19542a519311SJohannes Berg 	struct wiphy *wiphy;
195515d6030bSSam Leffler 	unsigned long scan_start;
19561d76250bSAvraham Stern 	struct cfg80211_scan_info info;
19571d76250bSAvraham Stern 	bool notified;
1958e9f935e3SRajkumar Manoharan 	bool no_cck;
19595ba63533SJohannes Berg 
19605ba63533SJohannes Berg 	/* keep last */
19615ba63533SJohannes Berg 	struct ieee80211_channel *channels[0];
19622a519311SJohannes Berg };
19632a519311SJohannes Berg 
1964ad2b26abSJohannes Berg static inline void get_random_mask_addr(u8 *buf, const u8 *addr, const u8 *mask)
1965ad2b26abSJohannes Berg {
1966ad2b26abSJohannes Berg 	int i;
1967ad2b26abSJohannes Berg 
1968ad2b26abSJohannes Berg 	get_random_bytes(buf, ETH_ALEN);
1969ad2b26abSJohannes Berg 	for (i = 0; i < ETH_ALEN; i++) {
1970ad2b26abSJohannes Berg 		buf[i] &= ~mask[i];
1971ad2b26abSJohannes Berg 		buf[i] |= addr[i] & mask[i];
1972ad2b26abSJohannes Berg 	}
1973ad2b26abSJohannes Berg }
1974ad2b26abSJohannes Berg 
19752a519311SJohannes Berg /**
1976a1f1c21cSLuciano Coelho  * struct cfg80211_match_set - sets of attributes to match
1977a1f1c21cSLuciano Coelho  *
19783007e352SArend Van Spriel  * @ssid: SSID to be matched; may be zero-length in case of BSSID match
19793007e352SArend Van Spriel  *	or no match (RSSI only)
19803007e352SArend Van Spriel  * @bssid: BSSID to be matched; may be all-zero BSSID in case of SSID match
19813007e352SArend Van Spriel  *	or no match (RSSI only)
1982ea73cbceSJohannes Berg  * @rssi_thold: don't report scan results below this threshold (in s32 dBm)
19831e1b11b6Svamsi krishna  * @per_band_rssi_thold: Minimum rssi threshold for each band to be applied
19841e1b11b6Svamsi krishna  *	for filtering out scan results received. Drivers advertize this support
19851e1b11b6Svamsi krishna  *	of band specific rssi based filtering through the feature capability
19861e1b11b6Svamsi krishna  *	%NL80211_EXT_FEATURE_SCHED_SCAN_BAND_SPECIFIC_RSSI_THOLD. These band
19871e1b11b6Svamsi krishna  *	specific rssi thresholds take precedence over rssi_thold, if specified.
19881e1b11b6Svamsi krishna  *	If not specified for any band, it will be assigned with rssi_thold of
19891e1b11b6Svamsi krishna  *	corresponding matchset.
1990a1f1c21cSLuciano Coelho  */
1991a1f1c21cSLuciano Coelho struct cfg80211_match_set {
1992a1f1c21cSLuciano Coelho 	struct cfg80211_ssid ssid;
19933007e352SArend Van Spriel 	u8 bssid[ETH_ALEN];
1994ea73cbceSJohannes Berg 	s32 rssi_thold;
19951e1b11b6Svamsi krishna 	s32 per_band_rssi_thold[NUM_NL80211_BANDS];
1996a1f1c21cSLuciano Coelho };
1997a1f1c21cSLuciano Coelho 
1998a1f1c21cSLuciano Coelho /**
19993b06d277SAvraham Stern  * struct cfg80211_sched_scan_plan - scan plan for scheduled scan
20003b06d277SAvraham Stern  *
20013b06d277SAvraham Stern  * @interval: interval between scheduled scan iterations. In seconds.
20023b06d277SAvraham Stern  * @iterations: number of scan iterations in this scan plan. Zero means
20033b06d277SAvraham Stern  *	infinite loop.
20043b06d277SAvraham Stern  *	The last scan plan will always have this parameter set to zero,
20053b06d277SAvraham Stern  *	all other scan plans will have a finite number of iterations.
20063b06d277SAvraham Stern  */
20073b06d277SAvraham Stern struct cfg80211_sched_scan_plan {
20083b06d277SAvraham Stern 	u32 interval;
20093b06d277SAvraham Stern 	u32 iterations;
20103b06d277SAvraham Stern };
20113b06d277SAvraham Stern 
20123b06d277SAvraham Stern /**
2013bf95ecdbSvamsi krishna  * struct cfg80211_bss_select_adjust - BSS selection with RSSI adjustment.
2014bf95ecdbSvamsi krishna  *
2015bf95ecdbSvamsi krishna  * @band: band of BSS which should match for RSSI level adjustment.
2016bf95ecdbSvamsi krishna  * @delta: value of RSSI level adjustment.
2017bf95ecdbSvamsi krishna  */
2018bf95ecdbSvamsi krishna struct cfg80211_bss_select_adjust {
2019bf95ecdbSvamsi krishna 	enum nl80211_band band;
2020bf95ecdbSvamsi krishna 	s8 delta;
2021bf95ecdbSvamsi krishna };
2022bf95ecdbSvamsi krishna 
2023bf95ecdbSvamsi krishna /**
2024807f8a8cSLuciano Coelho  * struct cfg80211_sched_scan_request - scheduled scan request description
2025807f8a8cSLuciano Coelho  *
202696b08fd6SArend Van Spriel  * @reqid: identifies this request.
2027807f8a8cSLuciano Coelho  * @ssids: SSIDs to scan for (passed in the probe_reqs in active scans)
2028807f8a8cSLuciano Coelho  * @n_ssids: number of SSIDs
2029807f8a8cSLuciano Coelho  * @n_channels: total number of channels to scan
2030dcd6eac1SSimon Wunderlich  * @scan_width: channel width for scanning
2031807f8a8cSLuciano Coelho  * @ie: optional information element(s) to add into Probe Request or %NULL
2032807f8a8cSLuciano Coelho  * @ie_len: length of ie in octets
2033ed473771SSam Leffler  * @flags: bit field of flags controlling operation
2034a1f1c21cSLuciano Coelho  * @match_sets: sets of parameters to be matched for a scan result
2035a1f1c21cSLuciano Coelho  * 	entry to be considered valid and to be passed to the host
2036a1f1c21cSLuciano Coelho  * 	(others are filtered out).
2037a1f1c21cSLuciano Coelho  *	If ommited, all results are passed.
2038a1f1c21cSLuciano Coelho  * @n_match_sets: number of match sets
20396406c919SJohannes Berg  * @report_results: indicates that results were reported for this request
2040807f8a8cSLuciano Coelho  * @wiphy: the wiphy this was for
2041807f8a8cSLuciano Coelho  * @dev: the interface
2042077f897aSJohannes Berg  * @scan_start: start time of the scheduled scan
2043807f8a8cSLuciano Coelho  * @channels: channels to scan
2044ea73cbceSJohannes Berg  * @min_rssi_thold: for drivers only supporting a single threshold, this
2045ea73cbceSJohannes Berg  *	contains the minimum over all matchsets
2046ad2b26abSJohannes Berg  * @mac_addr: MAC address used with randomisation
2047ad2b26abSJohannes Berg  * @mac_addr_mask: MAC address mask used with randomisation, bits that
2048ad2b26abSJohannes Berg  *	are 0 in the mask should be randomised, bits that are 1 should
2049ad2b26abSJohannes Berg  *	be taken from the @mac_addr
20503b06d277SAvraham Stern  * @scan_plans: scan plans to be executed in this scheduled scan. Lowest
20513b06d277SAvraham Stern  *	index must be executed first.
20523b06d277SAvraham Stern  * @n_scan_plans: number of scan plans, at least 1.
205331a60ed1SJukka Rissanen  * @rcu_head: RCU callback used to free the struct
205493a1e86cSJukka Rissanen  * @owner_nlportid: netlink portid of owner (if this should is a request
205593a1e86cSJukka Rissanen  *	owned by a particular socket)
2056ca986ad9SArend Van Spriel  * @nl_owner_dead: netlink owner socket was closed - this request be freed
2057ca986ad9SArend Van Spriel  * @list: for keeping list of requests.
20589c748934SLuciano Coelho  * @delay: delay in seconds to use before starting the first scan
20599c748934SLuciano Coelho  *	cycle.  The driver may ignore this parameter and start
20609c748934SLuciano Coelho  *	immediately (or at any other time), if this feature is not
20619c748934SLuciano Coelho  *	supported.
2062bf95ecdbSvamsi krishna  * @relative_rssi_set: Indicates whether @relative_rssi is set or not.
2063bf95ecdbSvamsi krishna  * @relative_rssi: Relative RSSI threshold in dB to restrict scan result
2064bf95ecdbSvamsi krishna  *	reporting in connected state to cases where a matching BSS is determined
2065bf95ecdbSvamsi krishna  *	to have better or slightly worse RSSI than the current connected BSS.
2066bf95ecdbSvamsi krishna  *	The relative RSSI threshold values are ignored in disconnected state.
2067bf95ecdbSvamsi krishna  * @rssi_adjust: delta dB of RSSI preference to be given to the BSSs that belong
2068bf95ecdbSvamsi krishna  *	to the specified band while deciding whether a better BSS is reported
2069bf95ecdbSvamsi krishna  *	using @relative_rssi. If delta is a negative number, the BSSs that
2070bf95ecdbSvamsi krishna  *	belong to the specified band will be penalized by delta dB in relative
2071bf95ecdbSvamsi krishna  *	comparisions.
2072807f8a8cSLuciano Coelho  */
2073807f8a8cSLuciano Coelho struct cfg80211_sched_scan_request {
207496b08fd6SArend Van Spriel 	u64 reqid;
2075807f8a8cSLuciano Coelho 	struct cfg80211_ssid *ssids;
2076807f8a8cSLuciano Coelho 	int n_ssids;
2077807f8a8cSLuciano Coelho 	u32 n_channels;
2078dcd6eac1SSimon Wunderlich 	enum nl80211_bss_scan_width scan_width;
2079807f8a8cSLuciano Coelho 	const u8 *ie;
2080807f8a8cSLuciano Coelho 	size_t ie_len;
2081ed473771SSam Leffler 	u32 flags;
2082a1f1c21cSLuciano Coelho 	struct cfg80211_match_set *match_sets;
2083a1f1c21cSLuciano Coelho 	int n_match_sets;
2084ea73cbceSJohannes Berg 	s32 min_rssi_thold;
20859c748934SLuciano Coelho 	u32 delay;
20863b06d277SAvraham Stern 	struct cfg80211_sched_scan_plan *scan_plans;
20873b06d277SAvraham Stern 	int n_scan_plans;
2088807f8a8cSLuciano Coelho 
2089ad2b26abSJohannes Berg 	u8 mac_addr[ETH_ALEN] __aligned(2);
2090ad2b26abSJohannes Berg 	u8 mac_addr_mask[ETH_ALEN] __aligned(2);
2091ad2b26abSJohannes Berg 
2092bf95ecdbSvamsi krishna 	bool relative_rssi_set;
2093bf95ecdbSvamsi krishna 	s8 relative_rssi;
2094bf95ecdbSvamsi krishna 	struct cfg80211_bss_select_adjust rssi_adjust;
2095bf95ecdbSvamsi krishna 
2096807f8a8cSLuciano Coelho 	/* internal */
2097807f8a8cSLuciano Coelho 	struct wiphy *wiphy;
2098807f8a8cSLuciano Coelho 	struct net_device *dev;
209915d6030bSSam Leffler 	unsigned long scan_start;
2100b34939b9SArend Van Spriel 	bool report_results;
210131a60ed1SJukka Rissanen 	struct rcu_head rcu_head;
210293a1e86cSJukka Rissanen 	u32 owner_nlportid;
2103ca986ad9SArend Van Spriel 	bool nl_owner_dead;
2104ca986ad9SArend Van Spriel 	struct list_head list;
2105807f8a8cSLuciano Coelho 
2106807f8a8cSLuciano Coelho 	/* keep last */
2107807f8a8cSLuciano Coelho 	struct ieee80211_channel *channels[0];
2108807f8a8cSLuciano Coelho };
2109807f8a8cSLuciano Coelho 
2110807f8a8cSLuciano Coelho /**
21112a519311SJohannes Berg  * enum cfg80211_signal_type - signal type
21122a519311SJohannes Berg  *
21132a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available
21142a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm)
21152a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100
21162a519311SJohannes Berg  */
21172a519311SJohannes Berg enum cfg80211_signal_type {
21182a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_NONE,
21192a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_MBM,
21202a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_UNSPEC,
21212a519311SJohannes Berg };
21222a519311SJohannes Berg 
21232a519311SJohannes Berg /**
21246e19bc4bSDmitry Shmidt  * struct cfg80211_inform_bss - BSS inform data
21256e19bc4bSDmitry Shmidt  * @chan: channel the frame was received on
21266e19bc4bSDmitry Shmidt  * @scan_width: scan width that was used
21276e19bc4bSDmitry Shmidt  * @signal: signal strength value, according to the wiphy's
21286e19bc4bSDmitry Shmidt  *	signal type
21296e19bc4bSDmitry Shmidt  * @boottime_ns: timestamp (CLOCK_BOOTTIME) when the information was
21306e19bc4bSDmitry Shmidt  *	received; should match the time when the frame was actually
21316e19bc4bSDmitry Shmidt  *	received by the device (not just by the host, in case it was
21326e19bc4bSDmitry Shmidt  *	buffered on the device) and be accurate to about 10ms.
21336e19bc4bSDmitry Shmidt  *	If the frame isn't buffered, just passing the return value of
21349285ec4cSJason A. Donenfeld  *	ktime_get_boottime_ns() is likely appropriate.
21351d76250bSAvraham Stern  * @parent_tsf: the time at the start of reception of the first octet of the
21361d76250bSAvraham Stern  *	timestamp field of the frame. The time is the TSF of the BSS specified
21371d76250bSAvraham Stern  *	by %parent_bssid.
21381d76250bSAvraham Stern  * @parent_bssid: the BSS according to which %parent_tsf is set. This is set to
21391d76250bSAvraham Stern  *	the BSS that requested the scan in which the beacon/probe was received.
2140983dafaaSSunil Dutt  * @chains: bitmask for filled values in @chain_signal.
2141983dafaaSSunil Dutt  * @chain_signal: per-chain signal strength of last received BSS in dBm.
21426e19bc4bSDmitry Shmidt  */
21436e19bc4bSDmitry Shmidt struct cfg80211_inform_bss {
21446e19bc4bSDmitry Shmidt 	struct ieee80211_channel *chan;
21456e19bc4bSDmitry Shmidt 	enum nl80211_bss_scan_width scan_width;
21466e19bc4bSDmitry Shmidt 	s32 signal;
21476e19bc4bSDmitry Shmidt 	u64 boottime_ns;
21481d76250bSAvraham Stern 	u64 parent_tsf;
21491d76250bSAvraham Stern 	u8 parent_bssid[ETH_ALEN] __aligned(2);
2150983dafaaSSunil Dutt 	u8 chains;
2151983dafaaSSunil Dutt 	s8 chain_signal[IEEE80211_MAX_CHAINS];
21526e19bc4bSDmitry Shmidt };
21536e19bc4bSDmitry Shmidt 
21546e19bc4bSDmitry Shmidt /**
21552aa4d456SAkira Moroo  * struct cfg80211_bss_ies - BSS entry IE data
21568cef2c9dSJohannes Berg  * @tsf: TSF contained in the frame that carried these IEs
21579caf0364SJohannes Berg  * @rcu_head: internal use, for freeing
21589caf0364SJohannes Berg  * @len: length of the IEs
21590e227084SJohannes Berg  * @from_beacon: these IEs are known to come from a beacon
21609caf0364SJohannes Berg  * @data: IE data
21619caf0364SJohannes Berg  */
21629caf0364SJohannes Berg struct cfg80211_bss_ies {
21638cef2c9dSJohannes Berg 	u64 tsf;
21649caf0364SJohannes Berg 	struct rcu_head rcu_head;
21659caf0364SJohannes Berg 	int len;
21660e227084SJohannes Berg 	bool from_beacon;
21679caf0364SJohannes Berg 	u8 data[];
21689caf0364SJohannes Berg };
21699caf0364SJohannes Berg 
21709caf0364SJohannes Berg /**
21712a519311SJohannes Berg  * struct cfg80211_bss - BSS description
21722a519311SJohannes Berg  *
21732a519311SJohannes Berg  * This structure describes a BSS (which may also be a mesh network)
21742a519311SJohannes Berg  * for use in scan results and similar.
21752a519311SJohannes Berg  *
2176abe37c4bSJohannes Berg  * @channel: channel this BSS is on
2177dcd6eac1SSimon Wunderlich  * @scan_width: width of the control channel
21782a519311SJohannes Berg  * @bssid: BSSID of the BSS
21792a519311SJohannes Berg  * @beacon_interval: the beacon interval as from the frame
21802a519311SJohannes Berg  * @capability: the capability field in host byte order
218183c7aa1aSJohannes Berg  * @ies: the information elements (Note that there is no guarantee that these
218283c7aa1aSJohannes Berg  *	are well-formed!); this is a pointer to either the beacon_ies or
218383c7aa1aSJohannes Berg  *	proberesp_ies depending on whether Probe Response frame has been
218483c7aa1aSJohannes Berg  *	received. It is always non-%NULL.
218534a6eddbSJouni Malinen  * @beacon_ies: the information elements from the last Beacon frame
2186776b3580SJohannes Berg  *	(implementation note: if @hidden_beacon_bss is set this struct doesn't
2187776b3580SJohannes Berg  *	own the beacon_ies, but they're just pointers to the ones from the
2188776b3580SJohannes Berg  *	@hidden_beacon_bss struct)
218934a6eddbSJouni Malinen  * @proberesp_ies: the information elements from the last Probe Response frame
2190776b3580SJohannes Berg  * @hidden_beacon_bss: in case this BSS struct represents a probe response from
2191776b3580SJohannes Berg  *	a BSS that hides the SSID in its beacon, this points to the BSS struct
2192776b3580SJohannes Berg  *	that holds the beacon data. @beacon_ies is still valid, of course, and
2193776b3580SJohannes Berg  *	points to the same data as hidden_beacon_bss->beacon_ies in that case.
2194851ae31dSJohannes Berg  * @transmitted_bss: pointer to the transmitted BSS, if this is a
2195851ae31dSJohannes Berg  *	non-transmitted one (multi-BSSID support)
2196851ae31dSJohannes Berg  * @nontrans_list: list of non-transmitted BSS, if this is a transmitted one
2197851ae31dSJohannes Berg  *	(multi-BSSID support)
219877965c97SJohannes Berg  * @signal: signal strength value (type depends on the wiphy's signal_type)
2199983dafaaSSunil Dutt  * @chains: bitmask for filled values in @chain_signal.
2200983dafaaSSunil Dutt  * @chain_signal: per-chain signal strength of last received BSS in dBm.
22010cd01efbSSara Sharon  * @bssid_index: index in the multiple BSS set
22020cd01efbSSara Sharon  * @max_bssid_indicator: max number of members in the BSS set
22032a519311SJohannes Berg  * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
22042a519311SJohannes Berg  */
22052a519311SJohannes Berg struct cfg80211_bss {
22062a519311SJohannes Berg 	struct ieee80211_channel *channel;
2207dcd6eac1SSimon Wunderlich 	enum nl80211_bss_scan_width scan_width;
22082a519311SJohannes Berg 
22099caf0364SJohannes Berg 	const struct cfg80211_bss_ies __rcu *ies;
22109caf0364SJohannes Berg 	const struct cfg80211_bss_ies __rcu *beacon_ies;
22119caf0364SJohannes Berg 	const struct cfg80211_bss_ies __rcu *proberesp_ies;
22129caf0364SJohannes Berg 
2213776b3580SJohannes Berg 	struct cfg80211_bss *hidden_beacon_bss;
22147011ba58SSara Sharon 	struct cfg80211_bss *transmitted_bss;
22157011ba58SSara Sharon 	struct list_head nontrans_list;
22162a519311SJohannes Berg 
22172a519311SJohannes Berg 	s32 signal;
22182a519311SJohannes Berg 
22199caf0364SJohannes Berg 	u16 beacon_interval;
22209caf0364SJohannes Berg 	u16 capability;
22219caf0364SJohannes Berg 
22229caf0364SJohannes Berg 	u8 bssid[ETH_ALEN];
2223983dafaaSSunil Dutt 	u8 chains;
2224983dafaaSSunil Dutt 	s8 chain_signal[IEEE80211_MAX_CHAINS];
22259caf0364SJohannes Berg 
22260cd01efbSSara Sharon 	u8 bssid_index;
22270cd01efbSSara Sharon 	u8 max_bssid_indicator;
22280cd01efbSSara Sharon 
22291c06ef98SJohannes Berg 	u8 priv[0] __aligned(sizeof(void *));
22302a519311SJohannes Berg };
22312a519311SJohannes Berg 
22322a519311SJohannes Berg /**
223349a68e0dSJohannes Berg  * ieee80211_bss_get_elem - find element with given ID
2234517357c6SJohannes Berg  * @bss: the bss to search
223549a68e0dSJohannes Berg  * @id: the element ID
22369caf0364SJohannes Berg  *
22379caf0364SJohannes Berg  * Note that the return value is an RCU-protected pointer, so
22389caf0364SJohannes Berg  * rcu_read_lock() must be held when calling this function.
22390ae997dcSYacine Belkadi  * Return: %NULL if not found.
2240517357c6SJohannes Berg  */
224149a68e0dSJohannes Berg const struct element *ieee80211_bss_get_elem(struct cfg80211_bss *bss, u8 id);
224249a68e0dSJohannes Berg 
224349a68e0dSJohannes Berg /**
224449a68e0dSJohannes Berg  * ieee80211_bss_get_ie - find IE with given ID
224549a68e0dSJohannes Berg  * @bss: the bss to search
224649a68e0dSJohannes Berg  * @id: the element ID
224749a68e0dSJohannes Berg  *
224849a68e0dSJohannes Berg  * Note that the return value is an RCU-protected pointer, so
224949a68e0dSJohannes Berg  * rcu_read_lock() must be held when calling this function.
225049a68e0dSJohannes Berg  * Return: %NULL if not found.
225149a68e0dSJohannes Berg  */
225249a68e0dSJohannes Berg static inline const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 id)
225349a68e0dSJohannes Berg {
225449a68e0dSJohannes Berg 	return (void *)ieee80211_bss_get_elem(bss, id);
225549a68e0dSJohannes Berg }
2256517357c6SJohannes Berg 
2257517357c6SJohannes Berg 
2258517357c6SJohannes Berg /**
2259636a5d36SJouni Malinen  * struct cfg80211_auth_request - Authentication request data
2260636a5d36SJouni Malinen  *
2261636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
2262636a5d36SJouni Malinen  * authentication.
2263636a5d36SJouni Malinen  *
2264959867faSJohannes Berg  * @bss: The BSS to authenticate with, the callee must obtain a reference
2265959867faSJohannes Berg  *	to it if it needs to keep it.
2266636a5d36SJouni Malinen  * @auth_type: Authentication type (algorithm)
2267636a5d36SJouni Malinen  * @ie: Extra IEs to add to Authentication frame or %NULL
2268636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
2269fffd0934SJohannes Berg  * @key_len: length of WEP key for shared key authentication
2270fffd0934SJohannes Berg  * @key_idx: index of WEP key for shared key authentication
2271fffd0934SJohannes Berg  * @key: WEP key for shared key authentication
227211b6b5a4SJouni Malinen  * @auth_data: Fields and elements in Authentication frames. This contains
227311b6b5a4SJouni Malinen  *	the authentication frame body (non-IE and IE data), excluding the
227411b6b5a4SJouni Malinen  *	Authentication algorithm number, i.e., starting at the Authentication
227511b6b5a4SJouni Malinen  *	transaction sequence number field.
227611b6b5a4SJouni Malinen  * @auth_data_len: Length of auth_data buffer in octets
2277636a5d36SJouni Malinen  */
2278636a5d36SJouni Malinen struct cfg80211_auth_request {
227919957bb3SJohannes Berg 	struct cfg80211_bss *bss;
2280636a5d36SJouni Malinen 	const u8 *ie;
2281636a5d36SJouni Malinen 	size_t ie_len;
228219957bb3SJohannes Berg 	enum nl80211_auth_type auth_type;
2283fffd0934SJohannes Berg 	const u8 *key;
2284fffd0934SJohannes Berg 	u8 key_len, key_idx;
228511b6b5a4SJouni Malinen 	const u8 *auth_data;
228611b6b5a4SJouni Malinen 	size_t auth_data_len;
2287636a5d36SJouni Malinen };
2288636a5d36SJouni Malinen 
2289636a5d36SJouni Malinen /**
22907e7c8926SBen Greear  * enum cfg80211_assoc_req_flags - Over-ride default behaviour in association.
22917e7c8926SBen Greear  *
22927e7c8926SBen Greear  * @ASSOC_REQ_DISABLE_HT:  Disable HT (802.11n)
2293ee2aca34SJohannes Berg  * @ASSOC_REQ_DISABLE_VHT:  Disable VHT
2294bab5ab7dSAssaf Krauss  * @ASSOC_REQ_USE_RRM: Declare RRM capability in this association
229540cbfa90SSrinivas Dasari  * @CONNECT_REQ_EXTERNAL_AUTH_SUPPORT: User space indicates external
229640cbfa90SSrinivas Dasari  *	authentication capability. Drivers can offload authentication to
229740cbfa90SSrinivas Dasari  *	userspace if this flag is set. Only applicable for cfg80211_connect()
229840cbfa90SSrinivas Dasari  *	request (connect callback).
22997e7c8926SBen Greear  */
23007e7c8926SBen Greear enum cfg80211_assoc_req_flags {
23017e7c8926SBen Greear 	ASSOC_REQ_DISABLE_HT			= BIT(0),
2302ee2aca34SJohannes Berg 	ASSOC_REQ_DISABLE_VHT			= BIT(1),
2303bab5ab7dSAssaf Krauss 	ASSOC_REQ_USE_RRM			= BIT(2),
230440cbfa90SSrinivas Dasari 	CONNECT_REQ_EXTERNAL_AUTH_SUPPORT	= BIT(3),
23057e7c8926SBen Greear };
23067e7c8926SBen Greear 
23077e7c8926SBen Greear /**
2308636a5d36SJouni Malinen  * struct cfg80211_assoc_request - (Re)Association request data
2309636a5d36SJouni Malinen  *
2310636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
2311636a5d36SJouni Malinen  * (re)association.
2312959867faSJohannes Berg  * @bss: The BSS to associate with. If the call is successful the driver is
2313959867faSJohannes Berg  *	given a reference that it must give back to cfg80211_send_rx_assoc()
2314959867faSJohannes Berg  *	or to cfg80211_assoc_timeout(). To ensure proper refcounting, new
2315959867faSJohannes Berg  *	association requests while already associating must be rejected.
2316636a5d36SJouni Malinen  * @ie: Extra IEs to add to (Re)Association Request frame or %NULL
2317636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
2318dc6382ceSJouni Malinen  * @use_mfp: Use management frame protection (IEEE 802.11w) in this association
2319b23aa676SSamuel Ortiz  * @crypto: crypto settings
232035eb8f7bSJouni Malinen  * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used
232135eb8f7bSJouni Malinen  *	to indicate a request to reassociate within the ESS instead of a request
232235eb8f7bSJouni Malinen  *	do the initial association with the ESS. When included, this is set to
232335eb8f7bSJouni Malinen  *	the BSSID of the current association, i.e., to the value that is
232435eb8f7bSJouni Malinen  *	included in the Current AP address field of the Reassociation Request
232535eb8f7bSJouni Malinen  *	frame.
23267e7c8926SBen Greear  * @flags:  See &enum cfg80211_assoc_req_flags
23277e7c8926SBen Greear  * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask
23287e7c8926SBen Greear  *	will be used in ht_capa.  Un-supported values will be ignored.
23297e7c8926SBen Greear  * @ht_capa_mask:  The bits of ht_capa which are to be used.
2330ee2aca34SJohannes Berg  * @vht_capa: VHT capability override
2331ee2aca34SJohannes Berg  * @vht_capa_mask: VHT capability mask indicating which fields to use
2332348bd456SJouni Malinen  * @fils_kek: FILS KEK for protecting (Re)Association Request/Response frame or
2333348bd456SJouni Malinen  *	%NULL if FILS is not used.
2334348bd456SJouni Malinen  * @fils_kek_len: Length of fils_kek in octets
2335348bd456SJouni Malinen  * @fils_nonces: FILS nonces (part of AAD) for protecting (Re)Association
2336348bd456SJouni Malinen  *	Request/Response frame or %NULL if FILS is not used. This field starts
2337348bd456SJouni Malinen  *	with 16 octets of STA Nonce followed by 16 octets of AP Nonce.
2338636a5d36SJouni Malinen  */
2339636a5d36SJouni Malinen struct cfg80211_assoc_request {
234019957bb3SJohannes Berg 	struct cfg80211_bss *bss;
23413e5d7649SJohannes Berg 	const u8 *ie, *prev_bssid;
2342636a5d36SJouni Malinen 	size_t ie_len;
2343b23aa676SSamuel Ortiz 	struct cfg80211_crypto_settings crypto;
234419957bb3SJohannes Berg 	bool use_mfp;
23457e7c8926SBen Greear 	u32 flags;
23467e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa;
23477e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa_mask;
2348ee2aca34SJohannes Berg 	struct ieee80211_vht_cap vht_capa, vht_capa_mask;
2349348bd456SJouni Malinen 	const u8 *fils_kek;
2350348bd456SJouni Malinen 	size_t fils_kek_len;
2351348bd456SJouni Malinen 	const u8 *fils_nonces;
2352636a5d36SJouni Malinen };
2353636a5d36SJouni Malinen 
2354636a5d36SJouni Malinen /**
2355636a5d36SJouni Malinen  * struct cfg80211_deauth_request - Deauthentication request data
2356636a5d36SJouni Malinen  *
2357636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
2358636a5d36SJouni Malinen  * deauthentication.
2359636a5d36SJouni Malinen  *
236095de817bSJohannes Berg  * @bssid: the BSSID of the BSS to deauthenticate from
2361636a5d36SJouni Malinen  * @ie: Extra IEs to add to Deauthentication frame or %NULL
2362636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
236319957bb3SJohannes Berg  * @reason_code: The reason code for the deauthentication
2364077f897aSJohannes Berg  * @local_state_change: if set, change local state only and
2365077f897aSJohannes Berg  *	do not set a deauth frame
2366636a5d36SJouni Malinen  */
2367636a5d36SJouni Malinen struct cfg80211_deauth_request {
236895de817bSJohannes Berg 	const u8 *bssid;
2369636a5d36SJouni Malinen 	const u8 *ie;
2370636a5d36SJouni Malinen 	size_t ie_len;
237119957bb3SJohannes Berg 	u16 reason_code;
23726863255bSStanislaw Gruszka 	bool local_state_change;
2373636a5d36SJouni Malinen };
2374636a5d36SJouni Malinen 
2375636a5d36SJouni Malinen /**
2376636a5d36SJouni Malinen  * struct cfg80211_disassoc_request - Disassociation request data
2377636a5d36SJouni Malinen  *
2378636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
237966f00449SMasahiro Yamada  * disassociation.
2380636a5d36SJouni Malinen  *
238119957bb3SJohannes Berg  * @bss: the BSS to disassociate from
2382636a5d36SJouni Malinen  * @ie: Extra IEs to add to Disassociation frame or %NULL
2383636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
238419957bb3SJohannes Berg  * @reason_code: The reason code for the disassociation
2385d5cdfacbSJouni Malinen  * @local_state_change: This is a request for a local state only, i.e., no
2386d5cdfacbSJouni Malinen  *	Disassociation frame is to be transmitted.
2387636a5d36SJouni Malinen  */
2388636a5d36SJouni Malinen struct cfg80211_disassoc_request {
238919957bb3SJohannes Berg 	struct cfg80211_bss *bss;
2390636a5d36SJouni Malinen 	const u8 *ie;
2391636a5d36SJouni Malinen 	size_t ie_len;
239219957bb3SJohannes Berg 	u16 reason_code;
2393d5cdfacbSJouni Malinen 	bool local_state_change;
2394636a5d36SJouni Malinen };
2395636a5d36SJouni Malinen 
2396636a5d36SJouni Malinen /**
239704a773adSJohannes Berg  * struct cfg80211_ibss_params - IBSS parameters
239804a773adSJohannes Berg  *
239904a773adSJohannes Berg  * This structure defines the IBSS parameters for the join_ibss()
240004a773adSJohannes Berg  * method.
240104a773adSJohannes Berg  *
240204a773adSJohannes Berg  * @ssid: The SSID, will always be non-null.
240304a773adSJohannes Berg  * @ssid_len: The length of the SSID, will always be non-zero.
240404a773adSJohannes Berg  * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not
240504a773adSJohannes Berg  *	search for IBSSs with a different BSSID.
2406683b6d3bSJohannes Berg  * @chandef: defines the channel to use if no other IBSS to join can be found
240704a773adSJohannes Berg  * @channel_fixed: The channel should be fixed -- do not search for
240804a773adSJohannes Berg  *	IBSSs to join on other channels.
240904a773adSJohannes Berg  * @ie: information element(s) to include in the beacon
241004a773adSJohannes Berg  * @ie_len: length of that
24118e30bc55SJohannes Berg  * @beacon_interval: beacon interval to use
2412fffd0934SJohannes Berg  * @privacy: this is a protected network, keys will be configured
2413fffd0934SJohannes Berg  *	after joining
2414267335d6SAntonio Quartulli  * @control_port: whether user space controls IEEE 802.1X port, i.e.,
2415267335d6SAntonio Quartulli  *	sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
2416267335d6SAntonio Quartulli  *	required to assume that the port is unauthorized until authorized by
2417267335d6SAntonio Quartulli  *	user space. Otherwise, port is marked authorized by default.
2418c3bfe1f6SDenis Kenzior  * @control_port_over_nl80211: TRUE if userspace expects to exchange control
2419c3bfe1f6SDenis Kenzior  *	port frames over NL80211 instead of the network interface.
24205336fa88SSimon Wunderlich  * @userspace_handles_dfs: whether user space controls DFS operation, i.e.
24215336fa88SSimon Wunderlich  *	changes the channel when a radar is detected. This is required
24225336fa88SSimon Wunderlich  *	to operate on DFS channels.
2423fbd2c8dcSTeemu Paasikivi  * @basic_rates: bitmap of basic rates to use when creating the IBSS
2424dd5b4cc7SFelix Fietkau  * @mcast_rate: per-band multicast rate index + 1 (0: disabled)
2425803768f5SSimon Wunderlich  * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask
2426803768f5SSimon Wunderlich  *	will be used in ht_capa.  Un-supported values will be ignored.
2427803768f5SSimon Wunderlich  * @ht_capa_mask:  The bits of ht_capa which are to be used.
24289ae3b172STova Mussai  * @wep_keys: static WEP keys, if not NULL points to an array of
24299ae3b172STova Mussai  * 	CFG80211_MAX_WEP_KEYS WEP keys
24309ae3b172STova Mussai  * @wep_tx_key: key index (0..3) of the default TX static WEP key
243104a773adSJohannes Berg  */
243204a773adSJohannes Berg struct cfg80211_ibss_params {
2433c1e5f471SJohannes Berg 	const u8 *ssid;
2434c1e5f471SJohannes Berg 	const u8 *bssid;
2435683b6d3bSJohannes Berg 	struct cfg80211_chan_def chandef;
2436c1e5f471SJohannes Berg 	const u8 *ie;
243704a773adSJohannes Berg 	u8 ssid_len, ie_len;
24388e30bc55SJohannes Berg 	u16 beacon_interval;
2439fbd2c8dcSTeemu Paasikivi 	u32 basic_rates;
244004a773adSJohannes Berg 	bool channel_fixed;
2441fffd0934SJohannes Berg 	bool privacy;
2442267335d6SAntonio Quartulli 	bool control_port;
2443c3bfe1f6SDenis Kenzior 	bool control_port_over_nl80211;
24445336fa88SSimon Wunderlich 	bool userspace_handles_dfs;
244557fbcce3SJohannes Berg 	int mcast_rate[NUM_NL80211_BANDS];
2446803768f5SSimon Wunderlich 	struct ieee80211_ht_cap ht_capa;
2447803768f5SSimon Wunderlich 	struct ieee80211_ht_cap ht_capa_mask;
24489ae3b172STova Mussai 	struct key_params *wep_keys;
24499ae3b172STova Mussai 	int wep_tx_key;
245004a773adSJohannes Berg };
245104a773adSJohannes Berg 
245204a773adSJohannes Berg /**
245338de03d2SArend van Spriel  * struct cfg80211_bss_selection - connection parameters for BSS selection.
245438de03d2SArend van Spriel  *
245538de03d2SArend van Spriel  * @behaviour: requested BSS selection behaviour.
245638de03d2SArend van Spriel  * @param: parameters for requestion behaviour.
245738de03d2SArend van Spriel  * @band_pref: preferred band for %NL80211_BSS_SELECT_ATTR_BAND_PREF.
245838de03d2SArend van Spriel  * @adjust: parameters for %NL80211_BSS_SELECT_ATTR_RSSI_ADJUST.
245938de03d2SArend van Spriel  */
246038de03d2SArend van Spriel struct cfg80211_bss_selection {
246138de03d2SArend van Spriel 	enum nl80211_bss_select_attr behaviour;
246238de03d2SArend van Spriel 	union {
246357fbcce3SJohannes Berg 		enum nl80211_band band_pref;
246438de03d2SArend van Spriel 		struct cfg80211_bss_select_adjust adjust;
246538de03d2SArend van Spriel 	} param;
246638de03d2SArend van Spriel };
246738de03d2SArend van Spriel 
246838de03d2SArend van Spriel /**
2469b23aa676SSamuel Ortiz  * struct cfg80211_connect_params - Connection parameters
2470b23aa676SSamuel Ortiz  *
2471b23aa676SSamuel Ortiz  * This structure provides information needed to complete IEEE 802.11
2472b23aa676SSamuel Ortiz  * authentication and association.
2473b23aa676SSamuel Ortiz  *
2474b23aa676SSamuel Ortiz  * @channel: The channel to use or %NULL if not specified (auto-select based
2475b23aa676SSamuel Ortiz  *	on scan results)
24761df4a510SJouni Malinen  * @channel_hint: The channel of the recommended BSS for initial connection or
24771df4a510SJouni Malinen  *	%NULL if not specified
2478b23aa676SSamuel Ortiz  * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan
2479b23aa676SSamuel Ortiz  *	results)
24801df4a510SJouni Malinen  * @bssid_hint: The recommended AP BSSID for initial connection to the BSS or
24811df4a510SJouni Malinen  *	%NULL if not specified. Unlike the @bssid parameter, the driver is
24821df4a510SJouni Malinen  *	allowed to ignore this @bssid_hint if it has knowledge of a better BSS
24831df4a510SJouni Malinen  *	to use.
2484b23aa676SSamuel Ortiz  * @ssid: SSID
2485b23aa676SSamuel Ortiz  * @ssid_len: Length of ssid in octets
2486b23aa676SSamuel Ortiz  * @auth_type: Authentication type (algorithm)
2487abe37c4bSJohannes Berg  * @ie: IEs for association request
2488abe37c4bSJohannes Berg  * @ie_len: Length of assoc_ie in octets
2489b23aa676SSamuel Ortiz  * @privacy: indicates whether privacy-enabled APs should be used
2490cee00a95SJouni Malinen  * @mfp: indicate whether management frame protection is used
2491b23aa676SSamuel Ortiz  * @crypto: crypto settings
2492fffd0934SJohannes Berg  * @key_len: length of WEP key for shared key authentication
2493fffd0934SJohannes Berg  * @key_idx: index of WEP key for shared key authentication
2494fffd0934SJohannes Berg  * @key: WEP key for shared key authentication
24957e7c8926SBen Greear  * @flags:  See &enum cfg80211_assoc_req_flags
24964486ea98SBala Shanmugam  * @bg_scan_period:  Background scan period in seconds
24974486ea98SBala Shanmugam  *	or -1 to indicate that default value is to be used.
24987e7c8926SBen Greear  * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask
24997e7c8926SBen Greear  *	will be used in ht_capa.  Un-supported values will be ignored.
25007e7c8926SBen Greear  * @ht_capa_mask:  The bits of ht_capa which are to be used.
2501ee2aca34SJohannes Berg  * @vht_capa:  VHT Capability overrides
2502ee2aca34SJohannes Berg  * @vht_capa_mask: The bits of vht_capa which are to be used.
250334d50519SLior David  * @pbss: if set, connect to a PCP instead of AP. Valid for DMG
250434d50519SLior David  *	networks.
250538de03d2SArend van Spriel  * @bss_select: criteria to be used for BSS selection.
250635eb8f7bSJouni Malinen  * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used
250735eb8f7bSJouni Malinen  *	to indicate a request to reassociate within the ESS instead of a request
250835eb8f7bSJouni Malinen  *	do the initial association with the ESS. When included, this is set to
250935eb8f7bSJouni Malinen  *	the BSSID of the current association, i.e., to the value that is
251035eb8f7bSJouni Malinen  *	included in the Current AP address field of the Reassociation Request
251135eb8f7bSJouni Malinen  *	frame.
2512a3caf744SVidyullatha Kanchanapally  * @fils_erp_username: EAP re-authentication protocol (ERP) username part of the
2513a3caf744SVidyullatha Kanchanapally  *	NAI or %NULL if not specified. This is used to construct FILS wrapped
2514a3caf744SVidyullatha Kanchanapally  *	data IE.
2515a3caf744SVidyullatha Kanchanapally  * @fils_erp_username_len: Length of @fils_erp_username in octets.
2516a3caf744SVidyullatha Kanchanapally  * @fils_erp_realm: EAP re-authentication protocol (ERP) realm part of NAI or
2517a3caf744SVidyullatha Kanchanapally  *	%NULL if not specified. This specifies the domain name of ER server and
2518a3caf744SVidyullatha Kanchanapally  *	is used to construct FILS wrapped data IE.
2519a3caf744SVidyullatha Kanchanapally  * @fils_erp_realm_len: Length of @fils_erp_realm in octets.
2520a3caf744SVidyullatha Kanchanapally  * @fils_erp_next_seq_num: The next sequence number to use in the FILS ERP
2521a3caf744SVidyullatha Kanchanapally  *	messages. This is also used to construct FILS wrapped data IE.
2522a3caf744SVidyullatha Kanchanapally  * @fils_erp_rrk: ERP re-authentication Root Key (rRK) used to derive additional
2523a3caf744SVidyullatha Kanchanapally  *	keys in FILS or %NULL if not specified.
2524a3caf744SVidyullatha Kanchanapally  * @fils_erp_rrk_len: Length of @fils_erp_rrk in octets.
25253a00df57SAvraham Stern  * @want_1x: indicates user-space supports and wants to use 802.1X driver
25263a00df57SAvraham Stern  *	offload of 4-way handshake.
25272a38075cSAlexei Avshalom Lazar  * @edmg: define the EDMG channels.
25282a38075cSAlexei Avshalom Lazar  *	This may specify multiple channels and bonding options for the driver
25292a38075cSAlexei Avshalom Lazar  *	to choose from, based on BSS configuration.
2530b23aa676SSamuel Ortiz  */
2531b23aa676SSamuel Ortiz struct cfg80211_connect_params {
2532b23aa676SSamuel Ortiz 	struct ieee80211_channel *channel;
25331df4a510SJouni Malinen 	struct ieee80211_channel *channel_hint;
2534664834deSJouni Malinen 	const u8 *bssid;
25351df4a510SJouni Malinen 	const u8 *bssid_hint;
2536664834deSJouni Malinen 	const u8 *ssid;
2537b23aa676SSamuel Ortiz 	size_t ssid_len;
2538b23aa676SSamuel Ortiz 	enum nl80211_auth_type auth_type;
25394b5800feSJohannes Berg 	const u8 *ie;
2540b23aa676SSamuel Ortiz 	size_t ie_len;
2541b23aa676SSamuel Ortiz 	bool privacy;
2542cee00a95SJouni Malinen 	enum nl80211_mfp mfp;
2543b23aa676SSamuel Ortiz 	struct cfg80211_crypto_settings crypto;
2544fffd0934SJohannes Berg 	const u8 *key;
2545fffd0934SJohannes Berg 	u8 key_len, key_idx;
25467e7c8926SBen Greear 	u32 flags;
25474486ea98SBala Shanmugam 	int bg_scan_period;
25487e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa;
25497e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa_mask;
2550ee2aca34SJohannes Berg 	struct ieee80211_vht_cap vht_capa;
2551ee2aca34SJohannes Berg 	struct ieee80211_vht_cap vht_capa_mask;
255234d50519SLior David 	bool pbss;
255338de03d2SArend van Spriel 	struct cfg80211_bss_selection bss_select;
2554ba6fbacfSJouni Malinen 	const u8 *prev_bssid;
2555a3caf744SVidyullatha Kanchanapally 	const u8 *fils_erp_username;
2556a3caf744SVidyullatha Kanchanapally 	size_t fils_erp_username_len;
2557a3caf744SVidyullatha Kanchanapally 	const u8 *fils_erp_realm;
2558a3caf744SVidyullatha Kanchanapally 	size_t fils_erp_realm_len;
2559a3caf744SVidyullatha Kanchanapally 	u16 fils_erp_next_seq_num;
2560a3caf744SVidyullatha Kanchanapally 	const u8 *fils_erp_rrk;
2561a3caf744SVidyullatha Kanchanapally 	size_t fils_erp_rrk_len;
25623a00df57SAvraham Stern 	bool want_1x;
25632a38075cSAlexei Avshalom Lazar 	struct ieee80211_edmg edmg;
2564b23aa676SSamuel Ortiz };
2565b23aa676SSamuel Ortiz 
2566b23aa676SSamuel Ortiz /**
2567088e8df8Svamsi krishna  * enum cfg80211_connect_params_changed - Connection parameters being updated
2568088e8df8Svamsi krishna  *
2569088e8df8Svamsi krishna  * This enum provides information of all connect parameters that
2570088e8df8Svamsi krishna  * have to be updated as part of update_connect_params() call.
2571088e8df8Svamsi krishna  *
2572088e8df8Svamsi krishna  * @UPDATE_ASSOC_IES: Indicates whether association request IEs are updated
25737f9a3e15SVidyullatha Kanchanapally  * @UPDATE_FILS_ERP_INFO: Indicates that FILS connection parameters (realm,
25747f9a3e15SVidyullatha Kanchanapally  *	username, erp sequence number and rrk) are updated
25757f9a3e15SVidyullatha Kanchanapally  * @UPDATE_AUTH_TYPE: Indicates that authentication type is updated
2576088e8df8Svamsi krishna  */
2577088e8df8Svamsi krishna enum cfg80211_connect_params_changed {
2578088e8df8Svamsi krishna 	UPDATE_ASSOC_IES		= BIT(0),
25797f9a3e15SVidyullatha Kanchanapally 	UPDATE_FILS_ERP_INFO		= BIT(1),
25807f9a3e15SVidyullatha Kanchanapally 	UPDATE_AUTH_TYPE		= BIT(2),
2581088e8df8Svamsi krishna };
2582088e8df8Svamsi krishna 
2583088e8df8Svamsi krishna /**
2584b9a5f8caSJouni Malinen  * enum wiphy_params_flags - set_wiphy_params bitfield values
2585abe37c4bSJohannes Berg  * @WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed
2586abe37c4bSJohannes Berg  * @WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed
2587abe37c4bSJohannes Berg  * @WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed
2588abe37c4bSJohannes Berg  * @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed
2589abe37c4bSJohannes Berg  * @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed
25903057dbfdSLorenzo Bianconi  * @WIPHY_PARAM_DYN_ACK: dynack has been enabled
259152539ca8SToke Høiland-Jørgensen  * @WIPHY_PARAM_TXQ_LIMIT: TXQ packet limit has been changed
259252539ca8SToke Høiland-Jørgensen  * @WIPHY_PARAM_TXQ_MEMORY_LIMIT: TXQ memory limit has been changed
259352539ca8SToke Høiland-Jørgensen  * @WIPHY_PARAM_TXQ_QUANTUM: TXQ scheduler quantum
2594b9a5f8caSJouni Malinen  */
2595b9a5f8caSJouni Malinen enum wiphy_params_flags {
2596b9a5f8caSJouni Malinen 	WIPHY_PARAM_RETRY_SHORT		= 1 << 0,
2597b9a5f8caSJouni Malinen 	WIPHY_PARAM_RETRY_LONG		= 1 << 1,
2598b9a5f8caSJouni Malinen 	WIPHY_PARAM_FRAG_THRESHOLD	= 1 << 2,
2599b9a5f8caSJouni Malinen 	WIPHY_PARAM_RTS_THRESHOLD	= 1 << 3,
260081077e82SLukáš Turek 	WIPHY_PARAM_COVERAGE_CLASS	= 1 << 4,
26013057dbfdSLorenzo Bianconi 	WIPHY_PARAM_DYN_ACK		= 1 << 5,
260252539ca8SToke Høiland-Jørgensen 	WIPHY_PARAM_TXQ_LIMIT		= 1 << 6,
260352539ca8SToke Høiland-Jørgensen 	WIPHY_PARAM_TXQ_MEMORY_LIMIT	= 1 << 7,
260452539ca8SToke Høiland-Jørgensen 	WIPHY_PARAM_TXQ_QUANTUM		= 1 << 8,
2605b9a5f8caSJouni Malinen };
2606b9a5f8caSJouni Malinen 
260736647055SToke Høiland-Jørgensen #define IEEE80211_DEFAULT_AIRTIME_WEIGHT	256
260836647055SToke Høiland-Jørgensen 
26093ace10f5SKan Yan /* The per TXQ device queue limit in airtime */
26103ace10f5SKan Yan #define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_L	5000
26113ace10f5SKan Yan #define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_H	12000
26123ace10f5SKan Yan 
26133ace10f5SKan Yan /* The per interface airtime threshold to switch to lower queue limit */
26143ace10f5SKan Yan #define IEEE80211_AQL_THRESHOLD			24000
26153ace10f5SKan Yan 
261667fbb16bSSamuel Ortiz /**
261767fbb16bSSamuel Ortiz  * struct cfg80211_pmksa - PMK Security Association
261867fbb16bSSamuel Ortiz  *
261967fbb16bSSamuel Ortiz  * This structure is passed to the set/del_pmksa() method for PMKSA
262067fbb16bSSamuel Ortiz  * caching.
262167fbb16bSSamuel Ortiz  *
2622a3caf744SVidyullatha Kanchanapally  * @bssid: The AP's BSSID (may be %NULL).
2623a3caf744SVidyullatha Kanchanapally  * @pmkid: The identifier to refer a PMKSA.
2624a3caf744SVidyullatha Kanchanapally  * @pmk: The PMK for the PMKSA identified by @pmkid. This is used for key
2625a3caf744SVidyullatha Kanchanapally  *	derivation by a FILS STA. Otherwise, %NULL.
2626a3caf744SVidyullatha Kanchanapally  * @pmk_len: Length of the @pmk. The length of @pmk can differ depending on
2627a3caf744SVidyullatha Kanchanapally  *	the hash algorithm used to generate this.
2628a3caf744SVidyullatha Kanchanapally  * @ssid: SSID to specify the ESS within which a PMKSA is valid when using FILS
2629a3caf744SVidyullatha Kanchanapally  *	cache identifier (may be %NULL).
2630a3caf744SVidyullatha Kanchanapally  * @ssid_len: Length of the @ssid in octets.
2631a3caf744SVidyullatha Kanchanapally  * @cache_id: 2-octet cache identifier advertized by a FILS AP identifying the
2632a3caf744SVidyullatha Kanchanapally  *	scope of PMKSA. This is valid only if @ssid_len is non-zero (may be
2633a3caf744SVidyullatha Kanchanapally  *	%NULL).
263467fbb16bSSamuel Ortiz  */
263567fbb16bSSamuel Ortiz struct cfg80211_pmksa {
2636c1e5f471SJohannes Berg 	const u8 *bssid;
2637c1e5f471SJohannes Berg 	const u8 *pmkid;
2638a3caf744SVidyullatha Kanchanapally 	const u8 *pmk;
2639a3caf744SVidyullatha Kanchanapally 	size_t pmk_len;
2640a3caf744SVidyullatha Kanchanapally 	const u8 *ssid;
2641a3caf744SVidyullatha Kanchanapally 	size_t ssid_len;
2642a3caf744SVidyullatha Kanchanapally 	const u8 *cache_id;
264367fbb16bSSamuel Ortiz };
26449930380fSJohannes Berg 
26457643a2c3SJohannes Berg /**
264650ac6607SAmitkumar Karwar  * struct cfg80211_pkt_pattern - packet pattern
2647ff1b6e69SJohannes Berg  * @mask: bitmask where to match pattern and where to ignore bytes,
2648ff1b6e69SJohannes Berg  *	one bit per byte, in same format as nl80211
2649ff1b6e69SJohannes Berg  * @pattern: bytes to match where bitmask is 1
2650ff1b6e69SJohannes Berg  * @pattern_len: length of pattern (in bytes)
2651bb92d199SAmitkumar Karwar  * @pkt_offset: packet offset (in bytes)
2652ff1b6e69SJohannes Berg  *
2653ff1b6e69SJohannes Berg  * Internal note: @mask and @pattern are allocated in one chunk of
2654ff1b6e69SJohannes Berg  * memory, free @mask only!
2655ff1b6e69SJohannes Berg  */
265650ac6607SAmitkumar Karwar struct cfg80211_pkt_pattern {
2657922bd80fSJohannes Berg 	const u8 *mask, *pattern;
2658ff1b6e69SJohannes Berg 	int pattern_len;
2659bb92d199SAmitkumar Karwar 	int pkt_offset;
2660ff1b6e69SJohannes Berg };
2661ff1b6e69SJohannes Berg 
2662ff1b6e69SJohannes Berg /**
26632a0e047eSJohannes Berg  * struct cfg80211_wowlan_tcp - TCP connection parameters
26642a0e047eSJohannes Berg  *
26652a0e047eSJohannes Berg  * @sock: (internal) socket for source port allocation
26662a0e047eSJohannes Berg  * @src: source IP address
26672a0e047eSJohannes Berg  * @dst: destination IP address
26682a0e047eSJohannes Berg  * @dst_mac: destination MAC address
26692a0e047eSJohannes Berg  * @src_port: source port
26702a0e047eSJohannes Berg  * @dst_port: destination port
26712a0e047eSJohannes Berg  * @payload_len: data payload length
26722a0e047eSJohannes Berg  * @payload: data payload buffer
26732a0e047eSJohannes Berg  * @payload_seq: payload sequence stamping configuration
26742a0e047eSJohannes Berg  * @data_interval: interval at which to send data packets
26752a0e047eSJohannes Berg  * @wake_len: wakeup payload match length
26762a0e047eSJohannes Berg  * @wake_data: wakeup payload match data
26772a0e047eSJohannes Berg  * @wake_mask: wakeup payload match mask
26782a0e047eSJohannes Berg  * @tokens_size: length of the tokens buffer
26792a0e047eSJohannes Berg  * @payload_tok: payload token usage configuration
26802a0e047eSJohannes Berg  */
26812a0e047eSJohannes Berg struct cfg80211_wowlan_tcp {
26822a0e047eSJohannes Berg 	struct socket *sock;
26832a0e047eSJohannes Berg 	__be32 src, dst;
26842a0e047eSJohannes Berg 	u16 src_port, dst_port;
26852a0e047eSJohannes Berg 	u8 dst_mac[ETH_ALEN];
26862a0e047eSJohannes Berg 	int payload_len;
26872a0e047eSJohannes Berg 	const u8 *payload;
26882a0e047eSJohannes Berg 	struct nl80211_wowlan_tcp_data_seq payload_seq;
26892a0e047eSJohannes Berg 	u32 data_interval;
26902a0e047eSJohannes Berg 	u32 wake_len;
26912a0e047eSJohannes Berg 	const u8 *wake_data, *wake_mask;
26922a0e047eSJohannes Berg 	u32 tokens_size;
26932a0e047eSJohannes Berg 	/* must be last, variable member */
26942a0e047eSJohannes Berg 	struct nl80211_wowlan_tcp_data_token payload_tok;
2695ff1b6e69SJohannes Berg };
2696ff1b6e69SJohannes Berg 
2697ff1b6e69SJohannes Berg /**
2698ff1b6e69SJohannes Berg  * struct cfg80211_wowlan - Wake on Wireless-LAN support info
2699ff1b6e69SJohannes Berg  *
2700ff1b6e69SJohannes Berg  * This structure defines the enabled WoWLAN triggers for the device.
2701ff1b6e69SJohannes Berg  * @any: wake up on any activity -- special trigger if device continues
2702ff1b6e69SJohannes Berg  *	operating as normal during suspend
2703ff1b6e69SJohannes Berg  * @disconnect: wake up if getting disconnected
2704ff1b6e69SJohannes Berg  * @magic_pkt: wake up on receiving magic packet
2705ff1b6e69SJohannes Berg  * @patterns: wake up on receiving packet matching a pattern
2706ff1b6e69SJohannes Berg  * @n_patterns: number of patterns
270777dbbb13SJohannes Berg  * @gtk_rekey_failure: wake up on GTK rekey failure
270877dbbb13SJohannes Berg  * @eap_identity_req: wake up on EAP identity request packet
270977dbbb13SJohannes Berg  * @four_way_handshake: wake up on 4-way handshake
271077dbbb13SJohannes Berg  * @rfkill_release: wake up when rfkill is released
27112a0e047eSJohannes Berg  * @tcp: TCP connection establishment/wakeup parameters, see nl80211.h.
27122a0e047eSJohannes Berg  *	NULL if not configured.
27138cd4d456SLuciano Coelho  * @nd_config: configuration for the scan to be used for net detect wake.
2714ff1b6e69SJohannes Berg  */
2715ff1b6e69SJohannes Berg struct cfg80211_wowlan {
271677dbbb13SJohannes Berg 	bool any, disconnect, magic_pkt, gtk_rekey_failure,
271777dbbb13SJohannes Berg 	     eap_identity_req, four_way_handshake,
271877dbbb13SJohannes Berg 	     rfkill_release;
271950ac6607SAmitkumar Karwar 	struct cfg80211_pkt_pattern *patterns;
27202a0e047eSJohannes Berg 	struct cfg80211_wowlan_tcp *tcp;
2721ff1b6e69SJohannes Berg 	int n_patterns;
27228cd4d456SLuciano Coelho 	struct cfg80211_sched_scan_request *nd_config;
2723ff1b6e69SJohannes Berg };
2724ff1b6e69SJohannes Berg 
2725ff1b6e69SJohannes Berg /**
2726be29b99aSAmitkumar Karwar  * struct cfg80211_coalesce_rules - Coalesce rule parameters
2727be29b99aSAmitkumar Karwar  *
2728be29b99aSAmitkumar Karwar  * This structure defines coalesce rule for the device.
2729be29b99aSAmitkumar Karwar  * @delay: maximum coalescing delay in msecs.
2730be29b99aSAmitkumar Karwar  * @condition: condition for packet coalescence.
2731be29b99aSAmitkumar Karwar  *	see &enum nl80211_coalesce_condition.
2732be29b99aSAmitkumar Karwar  * @patterns: array of packet patterns
2733be29b99aSAmitkumar Karwar  * @n_patterns: number of patterns
2734be29b99aSAmitkumar Karwar  */
2735be29b99aSAmitkumar Karwar struct cfg80211_coalesce_rules {
2736be29b99aSAmitkumar Karwar 	int delay;
2737be29b99aSAmitkumar Karwar 	enum nl80211_coalesce_condition condition;
2738be29b99aSAmitkumar Karwar 	struct cfg80211_pkt_pattern *patterns;
2739be29b99aSAmitkumar Karwar 	int n_patterns;
2740be29b99aSAmitkumar Karwar };
2741be29b99aSAmitkumar Karwar 
2742be29b99aSAmitkumar Karwar /**
2743be29b99aSAmitkumar Karwar  * struct cfg80211_coalesce - Packet coalescing settings
2744be29b99aSAmitkumar Karwar  *
2745be29b99aSAmitkumar Karwar  * This structure defines coalescing settings.
2746be29b99aSAmitkumar Karwar  * @rules: array of coalesce rules
2747be29b99aSAmitkumar Karwar  * @n_rules: number of rules
2748be29b99aSAmitkumar Karwar  */
2749be29b99aSAmitkumar Karwar struct cfg80211_coalesce {
2750be29b99aSAmitkumar Karwar 	struct cfg80211_coalesce_rules *rules;
2751be29b99aSAmitkumar Karwar 	int n_rules;
2752be29b99aSAmitkumar Karwar };
2753be29b99aSAmitkumar Karwar 
2754be29b99aSAmitkumar Karwar /**
27558cd4d456SLuciano Coelho  * struct cfg80211_wowlan_nd_match - information about the match
27568cd4d456SLuciano Coelho  *
27578cd4d456SLuciano Coelho  * @ssid: SSID of the match that triggered the wake up
27588cd4d456SLuciano Coelho  * @n_channels: Number of channels where the match occurred.  This
27598cd4d456SLuciano Coelho  *	value may be zero if the driver can't report the channels.
27608cd4d456SLuciano Coelho  * @channels: center frequencies of the channels where a match
27618cd4d456SLuciano Coelho  *	occurred (in MHz)
27628cd4d456SLuciano Coelho  */
27638cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_match {
27648cd4d456SLuciano Coelho 	struct cfg80211_ssid ssid;
27658cd4d456SLuciano Coelho 	int n_channels;
27668cd4d456SLuciano Coelho 	u32 channels[];
27678cd4d456SLuciano Coelho };
27688cd4d456SLuciano Coelho 
27698cd4d456SLuciano Coelho /**
27708cd4d456SLuciano Coelho  * struct cfg80211_wowlan_nd_info - net detect wake up information
27718cd4d456SLuciano Coelho  *
27728cd4d456SLuciano Coelho  * @n_matches: Number of match information instances provided in
27738cd4d456SLuciano Coelho  *	@matches.  This value may be zero if the driver can't provide
27748cd4d456SLuciano Coelho  *	match information.
27758cd4d456SLuciano Coelho  * @matches: Array of pointers to matches containing information about
27768cd4d456SLuciano Coelho  *	the matches that triggered the wake up.
27778cd4d456SLuciano Coelho  */
27788cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_info {
27798cd4d456SLuciano Coelho 	int n_matches;
27808cd4d456SLuciano Coelho 	struct cfg80211_wowlan_nd_match *matches[];
27818cd4d456SLuciano Coelho };
27828cd4d456SLuciano Coelho 
27838cd4d456SLuciano Coelho /**
2784cd8f7cb4SJohannes Berg  * struct cfg80211_wowlan_wakeup - wakeup report
2785cd8f7cb4SJohannes Berg  * @disconnect: woke up by getting disconnected
2786cd8f7cb4SJohannes Berg  * @magic_pkt: woke up by receiving magic packet
2787cd8f7cb4SJohannes Berg  * @gtk_rekey_failure: woke up by GTK rekey failure
2788cd8f7cb4SJohannes Berg  * @eap_identity_req: woke up by EAP identity request packet
2789cd8f7cb4SJohannes Berg  * @four_way_handshake: woke up by 4-way handshake
2790cd8f7cb4SJohannes Berg  * @rfkill_release: woke up by rfkill being released
2791cd8f7cb4SJohannes Berg  * @pattern_idx: pattern that caused wakeup, -1 if not due to pattern
2792cd8f7cb4SJohannes Berg  * @packet_present_len: copied wakeup packet data
2793cd8f7cb4SJohannes Berg  * @packet_len: original wakeup packet length
2794cd8f7cb4SJohannes Berg  * @packet: The packet causing the wakeup, if any.
2795cd8f7cb4SJohannes Berg  * @packet_80211:  For pattern match, magic packet and other data
2796cd8f7cb4SJohannes Berg  *	frame triggers an 802.3 frame should be reported, for
2797cd8f7cb4SJohannes Berg  *	disconnect due to deauth 802.11 frame. This indicates which
2798cd8f7cb4SJohannes Berg  *	it is.
27992a0e047eSJohannes Berg  * @tcp_match: TCP wakeup packet received
28002a0e047eSJohannes Berg  * @tcp_connlost: TCP connection lost or failed to establish
28012a0e047eSJohannes Berg  * @tcp_nomoretokens: TCP data ran out of tokens
28028cd4d456SLuciano Coelho  * @net_detect: if not %NULL, woke up because of net detect
2803cd8f7cb4SJohannes Berg  */
2804cd8f7cb4SJohannes Berg struct cfg80211_wowlan_wakeup {
2805cd8f7cb4SJohannes Berg 	bool disconnect, magic_pkt, gtk_rekey_failure,
2806cd8f7cb4SJohannes Berg 	     eap_identity_req, four_way_handshake,
28072a0e047eSJohannes Berg 	     rfkill_release, packet_80211,
28082a0e047eSJohannes Berg 	     tcp_match, tcp_connlost, tcp_nomoretokens;
2809cd8f7cb4SJohannes Berg 	s32 pattern_idx;
2810cd8f7cb4SJohannes Berg 	u32 packet_present_len, packet_len;
2811cd8f7cb4SJohannes Berg 	const void *packet;
28128cd4d456SLuciano Coelho 	struct cfg80211_wowlan_nd_info *net_detect;
2813cd8f7cb4SJohannes Berg };
2814cd8f7cb4SJohannes Berg 
2815cd8f7cb4SJohannes Berg /**
2816e5497d76SJohannes Berg  * struct cfg80211_gtk_rekey_data - rekey data
281778f686caSJohannes Berg  * @kek: key encryption key (NL80211_KEK_LEN bytes)
281878f686caSJohannes Berg  * @kck: key confirmation key (NL80211_KCK_LEN bytes)
281978f686caSJohannes Berg  * @replay_ctr: replay counter (NL80211_REPLAY_CTR_LEN bytes)
2820e5497d76SJohannes Berg  */
2821e5497d76SJohannes Berg struct cfg80211_gtk_rekey_data {
282278f686caSJohannes Berg 	const u8 *kek, *kck, *replay_ctr;
2823e5497d76SJohannes Berg };
2824e5497d76SJohannes Berg 
2825e5497d76SJohannes Berg /**
2826355199e0SJouni Malinen  * struct cfg80211_update_ft_ies_params - FT IE Information
2827355199e0SJouni Malinen  *
2828355199e0SJouni Malinen  * This structure provides information needed to update the fast transition IE
2829355199e0SJouni Malinen  *
2830355199e0SJouni Malinen  * @md: The Mobility Domain ID, 2 Octet value
2831355199e0SJouni Malinen  * @ie: Fast Transition IEs
2832355199e0SJouni Malinen  * @ie_len: Length of ft_ie in octets
2833355199e0SJouni Malinen  */
2834355199e0SJouni Malinen struct cfg80211_update_ft_ies_params {
2835355199e0SJouni Malinen 	u16 md;
2836355199e0SJouni Malinen 	const u8 *ie;
2837355199e0SJouni Malinen 	size_t ie_len;
2838355199e0SJouni Malinen };
2839355199e0SJouni Malinen 
2840355199e0SJouni Malinen /**
2841b176e629SAndrei Otcheretianski  * struct cfg80211_mgmt_tx_params - mgmt tx parameters
2842b176e629SAndrei Otcheretianski  *
2843b176e629SAndrei Otcheretianski  * This structure provides information needed to transmit a mgmt frame
2844b176e629SAndrei Otcheretianski  *
2845b176e629SAndrei Otcheretianski  * @chan: channel to use
2846b176e629SAndrei Otcheretianski  * @offchan: indicates wether off channel operation is required
2847b176e629SAndrei Otcheretianski  * @wait: duration for ROC
2848b176e629SAndrei Otcheretianski  * @buf: buffer to transmit
2849b176e629SAndrei Otcheretianski  * @len: buffer length
2850b176e629SAndrei Otcheretianski  * @no_cck: don't use cck rates for this frame
2851b176e629SAndrei Otcheretianski  * @dont_wait_for_ack: tells the low level not to wait for an ack
285234d22ce2SAndrei Otcheretianski  * @n_csa_offsets: length of csa_offsets array
285334d22ce2SAndrei Otcheretianski  * @csa_offsets: array of all the csa offsets in the frame
2854b176e629SAndrei Otcheretianski  */
2855b176e629SAndrei Otcheretianski struct cfg80211_mgmt_tx_params {
2856b176e629SAndrei Otcheretianski 	struct ieee80211_channel *chan;
2857b176e629SAndrei Otcheretianski 	bool offchan;
2858b176e629SAndrei Otcheretianski 	unsigned int wait;
2859b176e629SAndrei Otcheretianski 	const u8 *buf;
2860b176e629SAndrei Otcheretianski 	size_t len;
2861b176e629SAndrei Otcheretianski 	bool no_cck;
2862b176e629SAndrei Otcheretianski 	bool dont_wait_for_ack;
286334d22ce2SAndrei Otcheretianski 	int n_csa_offsets;
286434d22ce2SAndrei Otcheretianski 	const u16 *csa_offsets;
2865b176e629SAndrei Otcheretianski };
2866b176e629SAndrei Otcheretianski 
2867b176e629SAndrei Otcheretianski /**
2868fa9ffc74SKyeyoon Park  * struct cfg80211_dscp_exception - DSCP exception
2869fa9ffc74SKyeyoon Park  *
2870fa9ffc74SKyeyoon Park  * @dscp: DSCP value that does not adhere to the user priority range definition
2871fa9ffc74SKyeyoon Park  * @up: user priority value to which the corresponding DSCP value belongs
2872fa9ffc74SKyeyoon Park  */
2873fa9ffc74SKyeyoon Park struct cfg80211_dscp_exception {
2874fa9ffc74SKyeyoon Park 	u8 dscp;
2875fa9ffc74SKyeyoon Park 	u8 up;
2876fa9ffc74SKyeyoon Park };
2877fa9ffc74SKyeyoon Park 
2878fa9ffc74SKyeyoon Park /**
2879fa9ffc74SKyeyoon Park  * struct cfg80211_dscp_range - DSCP range definition for user priority
2880fa9ffc74SKyeyoon Park  *
2881fa9ffc74SKyeyoon Park  * @low: lowest DSCP value of this user priority range, inclusive
2882fa9ffc74SKyeyoon Park  * @high: highest DSCP value of this user priority range, inclusive
2883fa9ffc74SKyeyoon Park  */
2884fa9ffc74SKyeyoon Park struct cfg80211_dscp_range {
2885fa9ffc74SKyeyoon Park 	u8 low;
2886fa9ffc74SKyeyoon Park 	u8 high;
2887fa9ffc74SKyeyoon Park };
2888fa9ffc74SKyeyoon Park 
2889fa9ffc74SKyeyoon Park /* QoS Map Set element length defined in IEEE Std 802.11-2012, 8.4.2.97 */
2890fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_MAX_EX	21
2891fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_LEN_MIN	16
2892fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_LEN_MAX \
2893fa9ffc74SKyeyoon Park 	(IEEE80211_QOS_MAP_LEN_MIN + 2 * IEEE80211_QOS_MAP_MAX_EX)
2894fa9ffc74SKyeyoon Park 
2895fa9ffc74SKyeyoon Park /**
2896fa9ffc74SKyeyoon Park  * struct cfg80211_qos_map - QoS Map Information
2897fa9ffc74SKyeyoon Park  *
2898fa9ffc74SKyeyoon Park  * This struct defines the Interworking QoS map setting for DSCP values
2899fa9ffc74SKyeyoon Park  *
2900fa9ffc74SKyeyoon Park  * @num_des: number of DSCP exceptions (0..21)
2901fa9ffc74SKyeyoon Park  * @dscp_exception: optionally up to maximum of 21 DSCP exceptions from
2902fa9ffc74SKyeyoon Park  *	the user priority DSCP range definition
2903fa9ffc74SKyeyoon Park  * @up: DSCP range definition for a particular user priority
2904fa9ffc74SKyeyoon Park  */
2905fa9ffc74SKyeyoon Park struct cfg80211_qos_map {
2906fa9ffc74SKyeyoon Park 	u8 num_des;
2907fa9ffc74SKyeyoon Park 	struct cfg80211_dscp_exception dscp_exception[IEEE80211_QOS_MAP_MAX_EX];
2908fa9ffc74SKyeyoon Park 	struct cfg80211_dscp_range up[8];
2909fa9ffc74SKyeyoon Park };
2910fa9ffc74SKyeyoon Park 
2911fa9ffc74SKyeyoon Park /**
2912cb3b7d87SAyala Beker  * struct cfg80211_nan_conf - NAN configuration
2913cb3b7d87SAyala Beker  *
2914cb3b7d87SAyala Beker  * This struct defines NAN configuration parameters
2915cb3b7d87SAyala Beker  *
2916cb3b7d87SAyala Beker  * @master_pref: master preference (1 - 255)
29178585989dSLuca Coelho  * @bands: operating bands, a bitmap of &enum nl80211_band values.
29188585989dSLuca Coelho  *	For instance, for NL80211_BAND_2GHZ, bit 0 would be set
29198585989dSLuca Coelho  *	(i.e. BIT(NL80211_BAND_2GHZ)).
2920cb3b7d87SAyala Beker  */
2921cb3b7d87SAyala Beker struct cfg80211_nan_conf {
2922cb3b7d87SAyala Beker 	u8 master_pref;
29238585989dSLuca Coelho 	u8 bands;
2924cb3b7d87SAyala Beker };
2925cb3b7d87SAyala Beker 
2926cb3b7d87SAyala Beker /**
2927a5a9dcf2SAyala Beker  * enum cfg80211_nan_conf_changes - indicates changed fields in NAN
2928a5a9dcf2SAyala Beker  * configuration
2929a5a9dcf2SAyala Beker  *
2930a5a9dcf2SAyala Beker  * @CFG80211_NAN_CONF_CHANGED_PREF: master preference
29318585989dSLuca Coelho  * @CFG80211_NAN_CONF_CHANGED_BANDS: operating bands
2932a5a9dcf2SAyala Beker  */
2933a5a9dcf2SAyala Beker enum cfg80211_nan_conf_changes {
2934a5a9dcf2SAyala Beker 	CFG80211_NAN_CONF_CHANGED_PREF = BIT(0),
29358585989dSLuca Coelho 	CFG80211_NAN_CONF_CHANGED_BANDS = BIT(1),
2936a5a9dcf2SAyala Beker };
2937a5a9dcf2SAyala Beker 
2938a5a9dcf2SAyala Beker /**
2939a442b761SAyala Beker  * struct cfg80211_nan_func_filter - a NAN function Rx / Tx filter
2940a442b761SAyala Beker  *
2941a442b761SAyala Beker  * @filter: the content of the filter
2942a442b761SAyala Beker  * @len: the length of the filter
2943a442b761SAyala Beker  */
2944a442b761SAyala Beker struct cfg80211_nan_func_filter {
2945a442b761SAyala Beker 	const u8 *filter;
2946a442b761SAyala Beker 	u8 len;
2947a442b761SAyala Beker };
2948a442b761SAyala Beker 
2949a442b761SAyala Beker /**
2950a442b761SAyala Beker  * struct cfg80211_nan_func - a NAN function
2951a442b761SAyala Beker  *
2952a442b761SAyala Beker  * @type: &enum nl80211_nan_function_type
2953a442b761SAyala Beker  * @service_id: the service ID of the function
2954a442b761SAyala Beker  * @publish_type: &nl80211_nan_publish_type
2955a442b761SAyala Beker  * @close_range: if true, the range should be limited. Threshold is
2956a442b761SAyala Beker  *	implementation specific.
2957a442b761SAyala Beker  * @publish_bcast: if true, the solicited publish should be broadcasted
2958a442b761SAyala Beker  * @subscribe_active: if true, the subscribe is active
2959a442b761SAyala Beker  * @followup_id: the instance ID for follow up
2960a442b761SAyala Beker  * @followup_reqid: the requestor instance ID for follow up
2961a442b761SAyala Beker  * @followup_dest: MAC address of the recipient of the follow up
2962a442b761SAyala Beker  * @ttl: time to live counter in DW.
2963a442b761SAyala Beker  * @serv_spec_info: Service Specific Info
2964a442b761SAyala Beker  * @serv_spec_info_len: Service Specific Info length
2965a442b761SAyala Beker  * @srf_include: if true, SRF is inclusive
2966a442b761SAyala Beker  * @srf_bf: Bloom Filter
2967a442b761SAyala Beker  * @srf_bf_len: Bloom Filter length
2968a442b761SAyala Beker  * @srf_bf_idx: Bloom Filter index
2969a442b761SAyala Beker  * @srf_macs: SRF MAC addresses
2970a442b761SAyala Beker  * @srf_num_macs: number of MAC addresses in SRF
2971a442b761SAyala Beker  * @rx_filters: rx filters that are matched with corresponding peer's tx_filter
2972a442b761SAyala Beker  * @tx_filters: filters that should be transmitted in the SDF.
2973a442b761SAyala Beker  * @num_rx_filters: length of &rx_filters.
2974a442b761SAyala Beker  * @num_tx_filters: length of &tx_filters.
2975a442b761SAyala Beker  * @instance_id: driver allocated id of the function.
2976a442b761SAyala Beker  * @cookie: unique NAN function identifier.
2977a442b761SAyala Beker  */
2978a442b761SAyala Beker struct cfg80211_nan_func {
2979a442b761SAyala Beker 	enum nl80211_nan_function_type type;
2980a442b761SAyala Beker 	u8 service_id[NL80211_NAN_FUNC_SERVICE_ID_LEN];
2981a442b761SAyala Beker 	u8 publish_type;
2982a442b761SAyala Beker 	bool close_range;
2983a442b761SAyala Beker 	bool publish_bcast;
2984a442b761SAyala Beker 	bool subscribe_active;
2985a442b761SAyala Beker 	u8 followup_id;
2986a442b761SAyala Beker 	u8 followup_reqid;
2987a442b761SAyala Beker 	struct mac_address followup_dest;
2988a442b761SAyala Beker 	u32 ttl;
2989a442b761SAyala Beker 	const u8 *serv_spec_info;
2990a442b761SAyala Beker 	u8 serv_spec_info_len;
2991a442b761SAyala Beker 	bool srf_include;
2992a442b761SAyala Beker 	const u8 *srf_bf;
2993a442b761SAyala Beker 	u8 srf_bf_len;
2994a442b761SAyala Beker 	u8 srf_bf_idx;
2995a442b761SAyala Beker 	struct mac_address *srf_macs;
2996a442b761SAyala Beker 	int srf_num_macs;
2997a442b761SAyala Beker 	struct cfg80211_nan_func_filter *rx_filters;
2998a442b761SAyala Beker 	struct cfg80211_nan_func_filter *tx_filters;
2999a442b761SAyala Beker 	u8 num_tx_filters;
3000a442b761SAyala Beker 	u8 num_rx_filters;
3001a442b761SAyala Beker 	u8 instance_id;
3002a442b761SAyala Beker 	u64 cookie;
3003a442b761SAyala Beker };
3004a442b761SAyala Beker 
3005a442b761SAyala Beker /**
30063a00df57SAvraham Stern  * struct cfg80211_pmk_conf - PMK configuration
30073a00df57SAvraham Stern  *
30083a00df57SAvraham Stern  * @aa: authenticator address
30093a00df57SAvraham Stern  * @pmk_len: PMK length in bytes.
30103a00df57SAvraham Stern  * @pmk: the PMK material
30113a00df57SAvraham Stern  * @pmk_r0_name: PMK-R0 Name. NULL if not applicable (i.e., the PMK
30123a00df57SAvraham Stern  *	is not PMK-R0). When pmk_r0_name is not NULL, the pmk field
30133a00df57SAvraham Stern  *	holds PMK-R0.
30143a00df57SAvraham Stern  */
30153a00df57SAvraham Stern struct cfg80211_pmk_conf {
30163a00df57SAvraham Stern 	const u8 *aa;
30173a00df57SAvraham Stern 	u8 pmk_len;
30183a00df57SAvraham Stern 	const u8 *pmk;
30193a00df57SAvraham Stern 	const u8 *pmk_r0_name;
30203a00df57SAvraham Stern };
30213a00df57SAvraham Stern 
30223a00df57SAvraham Stern /**
302340cbfa90SSrinivas Dasari  * struct cfg80211_external_auth_params - Trigger External authentication.
302440cbfa90SSrinivas Dasari  *
302540cbfa90SSrinivas Dasari  * Commonly used across the external auth request and event interfaces.
302640cbfa90SSrinivas Dasari  *
302740cbfa90SSrinivas Dasari  * @action: action type / trigger for external authentication. Only significant
302840cbfa90SSrinivas Dasari  *	for the authentication request event interface (driver to user space).
302940cbfa90SSrinivas Dasari  * @bssid: BSSID of the peer with which the authentication has
303040cbfa90SSrinivas Dasari  *	to happen. Used by both the authentication request event and
303140cbfa90SSrinivas Dasari  *	authentication response command interface.
303240cbfa90SSrinivas Dasari  * @ssid: SSID of the AP.  Used by both the authentication request event and
303340cbfa90SSrinivas Dasari  *	authentication response command interface.
303440cbfa90SSrinivas Dasari  * @key_mgmt_suite: AKM suite of the respective authentication. Used by the
303540cbfa90SSrinivas Dasari  *	authentication request event interface.
303640cbfa90SSrinivas Dasari  * @status: status code, %WLAN_STATUS_SUCCESS for successful authentication,
303740cbfa90SSrinivas Dasari  *	use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space cannot give you
303840cbfa90SSrinivas Dasari  *	the real status code for failures. Used only for the authentication
303940cbfa90SSrinivas Dasari  *	response command interface (user space to driver).
3040fe494370SSrinivas Dasari  * @pmkid: The identifier to refer a PMKSA.
304140cbfa90SSrinivas Dasari  */
304240cbfa90SSrinivas Dasari struct cfg80211_external_auth_params {
304340cbfa90SSrinivas Dasari 	enum nl80211_external_auth_action action;
304440cbfa90SSrinivas Dasari 	u8 bssid[ETH_ALEN] __aligned(2);
304540cbfa90SSrinivas Dasari 	struct cfg80211_ssid ssid;
304640cbfa90SSrinivas Dasari 	unsigned int key_mgmt_suite;
304740cbfa90SSrinivas Dasari 	u16 status;
3048fe494370SSrinivas Dasari 	const u8 *pmkid;
304940cbfa90SSrinivas Dasari };
305040cbfa90SSrinivas Dasari 
305140cbfa90SSrinivas Dasari /**
30523453de98SRandy Dunlap  * struct cfg80211_ftm_responder_stats - FTM responder statistics
305381e54d08SPradeep Kumar Chitrapu  *
305481e54d08SPradeep Kumar Chitrapu  * @filled: bitflag of flags using the bits of &enum nl80211_ftm_stats to
305581e54d08SPradeep Kumar Chitrapu  *	indicate the relevant values in this struct for them
305681e54d08SPradeep Kumar Chitrapu  * @success_num: number of FTM sessions in which all frames were successfully
305781e54d08SPradeep Kumar Chitrapu  *	answered
305881e54d08SPradeep Kumar Chitrapu  * @partial_num: number of FTM sessions in which part of frames were
305981e54d08SPradeep Kumar Chitrapu  *	successfully answered
306081e54d08SPradeep Kumar Chitrapu  * @failed_num: number of failed FTM sessions
306181e54d08SPradeep Kumar Chitrapu  * @asap_num: number of ASAP FTM sessions
306281e54d08SPradeep Kumar Chitrapu  * @non_asap_num: number of  non-ASAP FTM sessions
306381e54d08SPradeep Kumar Chitrapu  * @total_duration_ms: total sessions durations - gives an indication
306481e54d08SPradeep Kumar Chitrapu  *	of how much time the responder was busy
306581e54d08SPradeep Kumar Chitrapu  * @unknown_triggers_num: number of unknown FTM triggers - triggers from
306681e54d08SPradeep Kumar Chitrapu  *	initiators that didn't finish successfully the negotiation phase with
306781e54d08SPradeep Kumar Chitrapu  *	the responder
306881e54d08SPradeep Kumar Chitrapu  * @reschedule_requests_num: number of FTM reschedule requests - initiator asks
306981e54d08SPradeep Kumar Chitrapu  *	for a new scheduling although it already has scheduled FTM slot
307081e54d08SPradeep Kumar Chitrapu  * @out_of_window_triggers_num: total FTM triggers out of scheduled window
307181e54d08SPradeep Kumar Chitrapu  */
307281e54d08SPradeep Kumar Chitrapu struct cfg80211_ftm_responder_stats {
307381e54d08SPradeep Kumar Chitrapu 	u32 filled;
307481e54d08SPradeep Kumar Chitrapu 	u32 success_num;
307581e54d08SPradeep Kumar Chitrapu 	u32 partial_num;
307681e54d08SPradeep Kumar Chitrapu 	u32 failed_num;
307781e54d08SPradeep Kumar Chitrapu 	u32 asap_num;
307881e54d08SPradeep Kumar Chitrapu 	u32 non_asap_num;
307981e54d08SPradeep Kumar Chitrapu 	u64 total_duration_ms;
308081e54d08SPradeep Kumar Chitrapu 	u32 unknown_triggers_num;
308181e54d08SPradeep Kumar Chitrapu 	u32 reschedule_requests_num;
308281e54d08SPradeep Kumar Chitrapu 	u32 out_of_window_triggers_num;
308381e54d08SPradeep Kumar Chitrapu };
308481e54d08SPradeep Kumar Chitrapu 
308581e54d08SPradeep Kumar Chitrapu /**
30869bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_ftm_result - FTM result
30879bb7e0f2SJohannes Berg  * @failure_reason: if this measurement failed (PMSR status is
30889bb7e0f2SJohannes Berg  *	%NL80211_PMSR_STATUS_FAILURE), this gives a more precise
30899bb7e0f2SJohannes Berg  *	reason than just "failure"
30909bb7e0f2SJohannes Berg  * @burst_index: if reporting partial results, this is the index
30919bb7e0f2SJohannes Berg  *	in [0 .. num_bursts-1] of the burst that's being reported
30929bb7e0f2SJohannes Berg  * @num_ftmr_attempts: number of FTM request frames transmitted
30939bb7e0f2SJohannes Berg  * @num_ftmr_successes: number of FTM request frames acked
30949bb7e0f2SJohannes Berg  * @busy_retry_time: if failure_reason is %NL80211_PMSR_FTM_FAILURE_PEER_BUSY,
30959bb7e0f2SJohannes Berg  *	fill this to indicate in how many seconds a retry is deemed possible
30969bb7e0f2SJohannes Berg  *	by the responder
30979bb7e0f2SJohannes Berg  * @num_bursts_exp: actual number of bursts exponent negotiated
30989bb7e0f2SJohannes Berg  * @burst_duration: actual burst duration negotiated
30999bb7e0f2SJohannes Berg  * @ftms_per_burst: actual FTMs per burst negotiated
31009bb7e0f2SJohannes Berg  * @lci_len: length of LCI information (if present)
31019bb7e0f2SJohannes Berg  * @civicloc_len: length of civic location information (if present)
31029bb7e0f2SJohannes Berg  * @lci: LCI data (may be %NULL)
31039bb7e0f2SJohannes Berg  * @civicloc: civic location data (may be %NULL)
31049bb7e0f2SJohannes Berg  * @rssi_avg: average RSSI over FTM action frames reported
31059bb7e0f2SJohannes Berg  * @rssi_spread: spread of the RSSI over FTM action frames reported
31069bb7e0f2SJohannes Berg  * @tx_rate: bitrate for transmitted FTM action frame response
31079bb7e0f2SJohannes Berg  * @rx_rate: bitrate of received FTM action frame
31089bb7e0f2SJohannes Berg  * @rtt_avg: average of RTTs measured (must have either this or @dist_avg)
31099bb7e0f2SJohannes Berg  * @rtt_variance: variance of RTTs measured (note that standard deviation is
31109bb7e0f2SJohannes Berg  *	the square root of the variance)
31119bb7e0f2SJohannes Berg  * @rtt_spread: spread of the RTTs measured
31129bb7e0f2SJohannes Berg  * @dist_avg: average of distances (mm) measured
31139bb7e0f2SJohannes Berg  *	(must have either this or @rtt_avg)
31149bb7e0f2SJohannes Berg  * @dist_variance: variance of distances measured (see also @rtt_variance)
31159bb7e0f2SJohannes Berg  * @dist_spread: spread of distances measured (see also @rtt_spread)
31169bb7e0f2SJohannes Berg  * @num_ftmr_attempts_valid: @num_ftmr_attempts is valid
31179bb7e0f2SJohannes Berg  * @num_ftmr_successes_valid: @num_ftmr_successes is valid
31189bb7e0f2SJohannes Berg  * @rssi_avg_valid: @rssi_avg is valid
31199bb7e0f2SJohannes Berg  * @rssi_spread_valid: @rssi_spread is valid
31209bb7e0f2SJohannes Berg  * @tx_rate_valid: @tx_rate is valid
31219bb7e0f2SJohannes Berg  * @rx_rate_valid: @rx_rate is valid
31229bb7e0f2SJohannes Berg  * @rtt_avg_valid: @rtt_avg is valid
31239bb7e0f2SJohannes Berg  * @rtt_variance_valid: @rtt_variance is valid
31249bb7e0f2SJohannes Berg  * @rtt_spread_valid: @rtt_spread is valid
31259bb7e0f2SJohannes Berg  * @dist_avg_valid: @dist_avg is valid
31269bb7e0f2SJohannes Berg  * @dist_variance_valid: @dist_variance is valid
31279bb7e0f2SJohannes Berg  * @dist_spread_valid: @dist_spread is valid
31289bb7e0f2SJohannes Berg  */
31299bb7e0f2SJohannes Berg struct cfg80211_pmsr_ftm_result {
31309bb7e0f2SJohannes Berg 	const u8 *lci;
31319bb7e0f2SJohannes Berg 	const u8 *civicloc;
31329bb7e0f2SJohannes Berg 	unsigned int lci_len;
31339bb7e0f2SJohannes Berg 	unsigned int civicloc_len;
31349bb7e0f2SJohannes Berg 	enum nl80211_peer_measurement_ftm_failure_reasons failure_reason;
31359bb7e0f2SJohannes Berg 	u32 num_ftmr_attempts, num_ftmr_successes;
31369bb7e0f2SJohannes Berg 	s16 burst_index;
31379bb7e0f2SJohannes Berg 	u8 busy_retry_time;
31389bb7e0f2SJohannes Berg 	u8 num_bursts_exp;
31399bb7e0f2SJohannes Berg 	u8 burst_duration;
31409bb7e0f2SJohannes Berg 	u8 ftms_per_burst;
31419bb7e0f2SJohannes Berg 	s32 rssi_avg;
31429bb7e0f2SJohannes Berg 	s32 rssi_spread;
31439bb7e0f2SJohannes Berg 	struct rate_info tx_rate, rx_rate;
31449bb7e0f2SJohannes Berg 	s64 rtt_avg;
31459bb7e0f2SJohannes Berg 	s64 rtt_variance;
31469bb7e0f2SJohannes Berg 	s64 rtt_spread;
31479bb7e0f2SJohannes Berg 	s64 dist_avg;
31489bb7e0f2SJohannes Berg 	s64 dist_variance;
31499bb7e0f2SJohannes Berg 	s64 dist_spread;
31509bb7e0f2SJohannes Berg 
31519bb7e0f2SJohannes Berg 	u16 num_ftmr_attempts_valid:1,
31529bb7e0f2SJohannes Berg 	    num_ftmr_successes_valid:1,
31539bb7e0f2SJohannes Berg 	    rssi_avg_valid:1,
31549bb7e0f2SJohannes Berg 	    rssi_spread_valid:1,
31559bb7e0f2SJohannes Berg 	    tx_rate_valid:1,
31569bb7e0f2SJohannes Berg 	    rx_rate_valid:1,
31579bb7e0f2SJohannes Berg 	    rtt_avg_valid:1,
31589bb7e0f2SJohannes Berg 	    rtt_variance_valid:1,
31599bb7e0f2SJohannes Berg 	    rtt_spread_valid:1,
31609bb7e0f2SJohannes Berg 	    dist_avg_valid:1,
31619bb7e0f2SJohannes Berg 	    dist_variance_valid:1,
31629bb7e0f2SJohannes Berg 	    dist_spread_valid:1;
31639bb7e0f2SJohannes Berg };
31649bb7e0f2SJohannes Berg 
31659bb7e0f2SJohannes Berg /**
31669bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_result - peer measurement result
31679bb7e0f2SJohannes Berg  * @addr: address of the peer
31689bb7e0f2SJohannes Berg  * @host_time: host time (use ktime_get_boottime() adjust to the time when the
31699bb7e0f2SJohannes Berg  *	measurement was made)
31709bb7e0f2SJohannes Berg  * @ap_tsf: AP's TSF at measurement time
31719bb7e0f2SJohannes Berg  * @status: status of the measurement
31729bb7e0f2SJohannes Berg  * @final: if reporting partial results, mark this as the last one; if not
31739bb7e0f2SJohannes Berg  *	reporting partial results always set this flag
31749bb7e0f2SJohannes Berg  * @ap_tsf_valid: indicates the @ap_tsf value is valid
31759bb7e0f2SJohannes Berg  * @type: type of the measurement reported, note that we only support reporting
31769bb7e0f2SJohannes Berg  *	one type at a time, but you can report multiple results separately and
31779bb7e0f2SJohannes Berg  *	they're all aggregated for userspace.
31789bb7e0f2SJohannes Berg  */
31799bb7e0f2SJohannes Berg struct cfg80211_pmsr_result {
31809bb7e0f2SJohannes Berg 	u64 host_time, ap_tsf;
31819bb7e0f2SJohannes Berg 	enum nl80211_peer_measurement_status status;
31829bb7e0f2SJohannes Berg 
31839bb7e0f2SJohannes Berg 	u8 addr[ETH_ALEN];
31849bb7e0f2SJohannes Berg 
31859bb7e0f2SJohannes Berg 	u8 final:1,
31869bb7e0f2SJohannes Berg 	   ap_tsf_valid:1;
31879bb7e0f2SJohannes Berg 
31889bb7e0f2SJohannes Berg 	enum nl80211_peer_measurement_type type;
31899bb7e0f2SJohannes Berg 
31909bb7e0f2SJohannes Berg 	union {
31919bb7e0f2SJohannes Berg 		struct cfg80211_pmsr_ftm_result ftm;
31929bb7e0f2SJohannes Berg 	};
31939bb7e0f2SJohannes Berg };
31949bb7e0f2SJohannes Berg 
31959bb7e0f2SJohannes Berg /**
31969bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_ftm_request_peer - FTM request data
31979bb7e0f2SJohannes Berg  * @requested: indicates FTM is requested
31989bb7e0f2SJohannes Berg  * @preamble: frame preamble to use
31999bb7e0f2SJohannes Berg  * @burst_period: burst period to use
32009bb7e0f2SJohannes Berg  * @asap: indicates to use ASAP mode
32019bb7e0f2SJohannes Berg  * @num_bursts_exp: number of bursts exponent
32029bb7e0f2SJohannes Berg  * @burst_duration: burst duration
32039bb7e0f2SJohannes Berg  * @ftms_per_burst: number of FTMs per burst
32049bb7e0f2SJohannes Berg  * @ftmr_retries: number of retries for FTM request
32059bb7e0f2SJohannes Berg  * @request_lci: request LCI information
32069bb7e0f2SJohannes Berg  * @request_civicloc: request civic location information
32079bb7e0f2SJohannes Berg  *
32089bb7e0f2SJohannes Berg  * See also nl80211 for the respective attribute documentation.
32099bb7e0f2SJohannes Berg  */
32109bb7e0f2SJohannes Berg struct cfg80211_pmsr_ftm_request_peer {
32119bb7e0f2SJohannes Berg 	enum nl80211_preamble preamble;
32129bb7e0f2SJohannes Berg 	u16 burst_period;
32139bb7e0f2SJohannes Berg 	u8 requested:1,
32149bb7e0f2SJohannes Berg 	   asap:1,
32159bb7e0f2SJohannes Berg 	   request_lci:1,
32169bb7e0f2SJohannes Berg 	   request_civicloc:1;
32179bb7e0f2SJohannes Berg 	u8 num_bursts_exp;
32189bb7e0f2SJohannes Berg 	u8 burst_duration;
32199bb7e0f2SJohannes Berg 	u8 ftms_per_burst;
32209bb7e0f2SJohannes Berg 	u8 ftmr_retries;
32219bb7e0f2SJohannes Berg };
32229bb7e0f2SJohannes Berg 
32239bb7e0f2SJohannes Berg /**
32249bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_request_peer - peer data for a peer measurement request
32259bb7e0f2SJohannes Berg  * @addr: MAC address
32269bb7e0f2SJohannes Berg  * @chandef: channel to use
32279bb7e0f2SJohannes Berg  * @report_ap_tsf: report the associated AP's TSF
32289bb7e0f2SJohannes Berg  * @ftm: FTM data, see &struct cfg80211_pmsr_ftm_request_peer
32299bb7e0f2SJohannes Berg  */
32309bb7e0f2SJohannes Berg struct cfg80211_pmsr_request_peer {
32319bb7e0f2SJohannes Berg 	u8 addr[ETH_ALEN];
32329bb7e0f2SJohannes Berg 	struct cfg80211_chan_def chandef;
32339bb7e0f2SJohannes Berg 	u8 report_ap_tsf:1;
32349bb7e0f2SJohannes Berg 	struct cfg80211_pmsr_ftm_request_peer ftm;
32359bb7e0f2SJohannes Berg };
32369bb7e0f2SJohannes Berg 
32379bb7e0f2SJohannes Berg /**
32389bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_request - peer measurement request
32399bb7e0f2SJohannes Berg  * @cookie: cookie, set by cfg80211
32409bb7e0f2SJohannes Berg  * @nl_portid: netlink portid - used by cfg80211
32419bb7e0f2SJohannes Berg  * @drv_data: driver data for this request, if required for aborting,
32429bb7e0f2SJohannes Berg  *	not otherwise freed or anything by cfg80211
32439bb7e0f2SJohannes Berg  * @mac_addr: MAC address used for (randomised) request
32449bb7e0f2SJohannes Berg  * @mac_addr_mask: MAC address mask used for randomisation, bits that
32459bb7e0f2SJohannes Berg  *	are 0 in the mask should be randomised, bits that are 1 should
32469bb7e0f2SJohannes Berg  *	be taken from the @mac_addr
32479bb7e0f2SJohannes Berg  * @list: used by cfg80211 to hold on to the request
32489bb7e0f2SJohannes Berg  * @timeout: timeout (in milliseconds) for the whole operation, if
32499bb7e0f2SJohannes Berg  *	zero it means there's no timeout
32509bb7e0f2SJohannes Berg  * @n_peers: number of peers to do measurements with
32519bb7e0f2SJohannes Berg  * @peers: per-peer measurement request data
32529bb7e0f2SJohannes Berg  */
32539bb7e0f2SJohannes Berg struct cfg80211_pmsr_request {
32549bb7e0f2SJohannes Berg 	u64 cookie;
32559bb7e0f2SJohannes Berg 	void *drv_data;
32569bb7e0f2SJohannes Berg 	u32 n_peers;
32579bb7e0f2SJohannes Berg 	u32 nl_portid;
32589bb7e0f2SJohannes Berg 
32599bb7e0f2SJohannes Berg 	u32 timeout;
32609bb7e0f2SJohannes Berg 
32619bb7e0f2SJohannes Berg 	u8 mac_addr[ETH_ALEN] __aligned(2);
32629bb7e0f2SJohannes Berg 	u8 mac_addr_mask[ETH_ALEN] __aligned(2);
32639bb7e0f2SJohannes Berg 
32649bb7e0f2SJohannes Berg 	struct list_head list;
32659bb7e0f2SJohannes Berg 
32669bb7e0f2SJohannes Berg 	struct cfg80211_pmsr_request_peer peers[];
32679bb7e0f2SJohannes Berg };
32689bb7e0f2SJohannes Berg 
32699bb7e0f2SJohannes Berg /**
3270cb74e977SSunil Dutt  * struct cfg80211_update_owe_info - OWE Information
3271cb74e977SSunil Dutt  *
3272cb74e977SSunil Dutt  * This structure provides information needed for the drivers to offload OWE
3273cb74e977SSunil Dutt  * (Opportunistic Wireless Encryption) processing to the user space.
3274cb74e977SSunil Dutt  *
3275cb74e977SSunil Dutt  * Commonly used across update_owe_info request and event interfaces.
3276cb74e977SSunil Dutt  *
3277cb74e977SSunil Dutt  * @peer: MAC address of the peer device for which the OWE processing
3278cb74e977SSunil Dutt  *	has to be done.
3279cb74e977SSunil Dutt  * @status: status code, %WLAN_STATUS_SUCCESS for successful OWE info
3280cb74e977SSunil Dutt  *	processing, use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space
3281cb74e977SSunil Dutt  *	cannot give you the real status code for failures. Used only for
3282cb74e977SSunil Dutt  *	OWE update request command interface (user space to driver).
3283cb74e977SSunil Dutt  * @ie: IEs obtained from the peer or constructed by the user space. These are
3284cb74e977SSunil Dutt  *	the IEs of the remote peer in the event from the host driver and
3285cb74e977SSunil Dutt  *	the constructed IEs by the user space in the request interface.
3286cb74e977SSunil Dutt  * @ie_len: Length of IEs in octets.
3287cb74e977SSunil Dutt  */
3288cb74e977SSunil Dutt struct cfg80211_update_owe_info {
3289cb74e977SSunil Dutt 	u8 peer[ETH_ALEN] __aligned(2);
3290cb74e977SSunil Dutt 	u16 status;
3291cb74e977SSunil Dutt 	const u8 *ie;
3292cb74e977SSunil Dutt 	size_t ie_len;
3293cb74e977SSunil Dutt };
3294cb74e977SSunil Dutt 
3295cb74e977SSunil Dutt /**
3296704232c2SJohannes Berg  * struct cfg80211_ops - backend description for wireless configuration
3297704232c2SJohannes Berg  *
3298704232c2SJohannes Berg  * This struct is registered by fullmac card drivers and/or wireless stacks
3299704232c2SJohannes Berg  * in order to handle configuration requests on their interfaces.
3300704232c2SJohannes Berg  *
3301704232c2SJohannes Berg  * All callbacks except where otherwise noted should return 0
3302704232c2SJohannes Berg  * on success or a negative error code.
3303704232c2SJohannes Berg  *
330443fb45cbSJohannes Berg  * All operations are currently invoked under rtnl for consistency with the
330543fb45cbSJohannes Berg  * wireless extensions but this is subject to reevaluation as soon as this
330643fb45cbSJohannes Berg  * code is used more widely and we have a first user without wext.
330743fb45cbSJohannes Berg  *
3308ff1b6e69SJohannes Berg  * @suspend: wiphy device needs to be suspended. The variable @wow will
3309ff1b6e69SJohannes Berg  *	be %NULL or contain the enabled Wake-on-Wireless triggers that are
3310ff1b6e69SJohannes Berg  *	configured for the device.
33110378b3f1SJohannes Berg  * @resume: wiphy device needs to be resumed
33126d52563fSJohannes Berg  * @set_wakeup: Called when WoWLAN is enabled/disabled, use this callback
33136d52563fSJohannes Berg  *	to call device_set_wakeup_enable() to enable/disable wakeup from
33146d52563fSJohannes Berg  *	the device.
33150378b3f1SJohannes Berg  *
331660719ffdSJohannes Berg  * @add_virtual_intf: create a new virtual interface with the given name,
3317463d0183SJohannes Berg  *	must set the struct wireless_dev's iftype. Beware: You must create
331884efbb84SJohannes Berg  *	the new netdev in the wiphy's network namespace! Returns the struct
331998104fdeSJohannes Berg  *	wireless_dev, or an ERR_PTR. For P2P device wdevs, the driver must
332098104fdeSJohannes Berg  *	also set the address member in the wdev.
3321704232c2SJohannes Berg  *
332284efbb84SJohannes Berg  * @del_virtual_intf: remove the virtual interface
332355682965SJohannes Berg  *
332460719ffdSJohannes Berg  * @change_virtual_intf: change type/configuration of virtual interface,
332560719ffdSJohannes Berg  *	keep the struct wireless_dev's iftype updated.
332655682965SJohannes Berg  *
332741ade00fSJohannes Berg  * @add_key: add a key with the given parameters. @mac_addr will be %NULL
332841ade00fSJohannes Berg  *	when adding a group key.
332941ade00fSJohannes Berg  *
333041ade00fSJohannes Berg  * @get_key: get information about the key with the given parameters.
333141ade00fSJohannes Berg  *	@mac_addr will be %NULL when requesting information for a group
333241ade00fSJohannes Berg  *	key. All pointers given to the @callback function need not be valid
3333e3da574aSJohannes Berg  *	after it returns. This function should return an error if it is
3334e3da574aSJohannes Berg  *	not possible to retrieve the key, -ENOENT if it doesn't exist.
333541ade00fSJohannes Berg  *
333641ade00fSJohannes Berg  * @del_key: remove a key given the @mac_addr (%NULL for a group key)
3337e3da574aSJohannes Berg  *	and @key_index, return -ENOENT if the key doesn't exist.
333841ade00fSJohannes Berg  *
333941ade00fSJohannes Berg  * @set_default_key: set the default key on an interface
3340ed1b6cc7SJohannes Berg  *
33413cfcf6acSJouni Malinen  * @set_default_mgmt_key: set the default management frame key on an interface
33423cfcf6acSJouni Malinen  *
3343e5497d76SJohannes Berg  * @set_rekey_data: give the data necessary for GTK rekeying to the driver
3344e5497d76SJohannes Berg  *
3345c04a4ff7SJohannes Berg  * @start_ap: Start acting in AP mode defined by the parameters.
3346c04a4ff7SJohannes Berg  * @change_beacon: Change the beacon parameters for an access point mode
3347c04a4ff7SJohannes Berg  *	interface. This should reject the call when AP mode wasn't started.
3348c04a4ff7SJohannes Berg  * @stop_ap: Stop being an AP, including stopping beaconing.
33495727ef1bSJohannes Berg  *
33505727ef1bSJohannes Berg  * @add_station: Add a new station.
335189c771e5SJouni Malinen  * @del_station: Remove a station
3352bdd90d5eSJohannes Berg  * @change_station: Modify a given station. Note that flags changes are not much
3353bdd90d5eSJohannes Berg  *	validated in cfg80211, in particular the auth/assoc/authorized flags
3354bdd90d5eSJohannes Berg  *	might come to the driver in invalid combinations -- make sure to check
335577ee7c89SJohannes Berg  *	them, also against the existing state! Drivers must call
335677ee7c89SJohannes Berg  *	cfg80211_check_station_change() to validate the information.
3357abe37c4bSJohannes Berg  * @get_station: get station information for the station identified by @mac
3358abe37c4bSJohannes Berg  * @dump_station: dump station callback -- resume dump at index @idx
3359abe37c4bSJohannes Berg  *
3360abe37c4bSJohannes Berg  * @add_mpath: add a fixed mesh path
3361abe37c4bSJohannes Berg  * @del_mpath: delete a given mesh path
3362abe37c4bSJohannes Berg  * @change_mpath: change a given mesh path
3363abe37c4bSJohannes Berg  * @get_mpath: get a mesh path for the given parameters
3364abe37c4bSJohannes Berg  * @dump_mpath: dump mesh path callback -- resume dump at index @idx
336566be7d2bSHenning Rogge  * @get_mpp: get a mesh proxy path for the given parameters
336666be7d2bSHenning Rogge  * @dump_mpp: dump mesh proxy path callback -- resume dump at index @idx
3367f52555a4SJohannes Berg  * @join_mesh: join the mesh network with the specified parameters
33688d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
3369f52555a4SJohannes Berg  * @leave_mesh: leave the current mesh network
33708d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
33712ec600d6SLuis Carlos Cobo  *
337224bdd9f4SJavier Cardona  * @get_mesh_config: Get the current mesh configuration
337393da9cc1Scolin@cozybit.com  *
337424bdd9f4SJavier Cardona  * @update_mesh_config: Update mesh parameters on a running mesh.
337593da9cc1Scolin@cozybit.com  *	The mask is a bitfield which tells us which parameters to
337693da9cc1Scolin@cozybit.com  *	set, and which to leave alone.
337793da9cc1Scolin@cozybit.com  *
33789f1ba906SJouni Malinen  * @change_bss: Modify parameters for a given BSS.
337931888487SJouni Malinen  *
338031888487SJouni Malinen  * @set_txq_params: Set TX queue parameters
338172bdcf34SJouni Malinen  *
3382e8c9bd5bSJohannes Berg  * @libertas_set_mesh_channel: Only for backward compatibility for libertas,
3383e8c9bd5bSJohannes Berg  *	as it doesn't implement join_mesh and needs to set the channel to
3384e8c9bd5bSJohannes Berg  *	join the mesh instead.
3385e8c9bd5bSJohannes Berg  *
3386e8c9bd5bSJohannes Berg  * @set_monitor_channel: Set the monitor mode channel for the device. If other
3387e8c9bd5bSJohannes Berg  *	interfaces are active this callback should reject the configuration.
3388e8c9bd5bSJohannes Berg  *	If no interfaces are active or the device is down, the channel should
3389e8c9bd5bSJohannes Berg  *	be stored for when a monitor interface becomes active.
33909aed3cc1SJouni Malinen  *
33912a519311SJohannes Berg  * @scan: Request to do a scan. If returning zero, the scan request is given
33922a519311SJohannes Berg  *	the driver, and will be valid until passed to cfg80211_scan_done().
33932a519311SJohannes Berg  *	For scan results, call cfg80211_inform_bss(); you can call this outside
33942a519311SJohannes Berg  *	the scan/scan_done bracket too.
339591d3ab46SVidyullatha Kanchanapally  * @abort_scan: Tell the driver to abort an ongoing scan. The driver shall
339691d3ab46SVidyullatha Kanchanapally  *	indicate the status of the scan through cfg80211_scan_done().
3397636a5d36SJouni Malinen  *
3398636a5d36SJouni Malinen  * @auth: Request to authenticate with the specified peer
33998d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
3400636a5d36SJouni Malinen  * @assoc: Request to (re)associate with the specified peer
34018d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
3402636a5d36SJouni Malinen  * @deauth: Request to deauthenticate from the specified peer
34038d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
3404636a5d36SJouni Malinen  * @disassoc: Request to disassociate from the specified peer
34058d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
340604a773adSJohannes Berg  *
3407b23aa676SSamuel Ortiz  * @connect: Connect to the ESS with the specified parameters. When connected,
3408bf1ecd21SJouni Malinen  *	call cfg80211_connect_result()/cfg80211_connect_bss() with status code
3409bf1ecd21SJouni Malinen  *	%WLAN_STATUS_SUCCESS. If the connection fails for some reason, call
3410bf1ecd21SJouni Malinen  *	cfg80211_connect_result()/cfg80211_connect_bss() with the status code
3411bf1ecd21SJouni Malinen  *	from the AP or cfg80211_connect_timeout() if no frame with status code
3412bf1ecd21SJouni Malinen  *	was received.
3413bf1ecd21SJouni Malinen  *	The driver is allowed to roam to other BSSes within the ESS when the
3414bf1ecd21SJouni Malinen  *	other BSS matches the connect parameters. When such roaming is initiated
3415bf1ecd21SJouni Malinen  *	by the driver, the driver is expected to verify that the target matches
3416bf1ecd21SJouni Malinen  *	the configured security parameters and to use Reassociation Request
3417bf1ecd21SJouni Malinen  *	frame instead of Association Request frame.
3418bf1ecd21SJouni Malinen  *	The connect function can also be used to request the driver to perform a
3419bf1ecd21SJouni Malinen  *	specific roam when connected to an ESS. In that case, the prev_bssid
342035eb8f7bSJouni Malinen  *	parameter is set to the BSSID of the currently associated BSS as an
3421bf1ecd21SJouni Malinen  *	indication of requesting reassociation.
3422bf1ecd21SJouni Malinen  *	In both the driver-initiated and new connect() call initiated roaming
3423bf1ecd21SJouni Malinen  *	cases, the result of roaming is indicated with a call to
342429ce6ecbSAvraham Stern  *	cfg80211_roamed(). (invoked with the wireless_dev mutex held)
3425088e8df8Svamsi krishna  * @update_connect_params: Update the connect parameters while connected to a
3426088e8df8Svamsi krishna  *	BSS. The updated parameters can be used by driver/firmware for
3427088e8df8Svamsi krishna  *	subsequent BSS selection (roaming) decisions and to form the
3428088e8df8Svamsi krishna  *	Authentication/(Re)Association Request frames. This call does not
3429088e8df8Svamsi krishna  *	request an immediate disassociation or reassociation with the current
3430088e8df8Svamsi krishna  *	BSS, i.e., this impacts only subsequent (re)associations. The bits in
3431088e8df8Svamsi krishna  *	changed are defined in &enum cfg80211_connect_params_changed.
3432088e8df8Svamsi krishna  *	(invoked with the wireless_dev mutex held)
34330711d638SIlan Peer  * @disconnect: Disconnect from the BSS/ESS or stop connection attempts if
34340711d638SIlan Peer  *      connection is in progress. Once done, call cfg80211_disconnected() in
34350711d638SIlan Peer  *      case connection was already established (invoked with the
34360711d638SIlan Peer  *      wireless_dev mutex held), otherwise call cfg80211_connect_timeout().
3437b23aa676SSamuel Ortiz  *
343804a773adSJohannes Berg  * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call
343904a773adSJohannes Berg  *	cfg80211_ibss_joined(), also call that function when changing BSSID due
344004a773adSJohannes Berg  *	to a merge.
34418d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
344204a773adSJohannes Berg  * @leave_ibss: Leave the IBSS.
34438d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
3444b9a5f8caSJouni Malinen  *
3445f4e583c8SAntonio Quartulli  * @set_mcast_rate: Set the specified multicast rate (only if vif is in ADHOC or
3446f4e583c8SAntonio Quartulli  *	MESH mode)
3447f4e583c8SAntonio Quartulli  *
3448b9a5f8caSJouni Malinen  * @set_wiphy_params: Notify that wiphy parameters have changed;
3449b9a5f8caSJouni Malinen  *	@changed bitfield (see &enum wiphy_params_flags) describes which values
3450b9a5f8caSJouni Malinen  *	have changed. The actual parameter values are available in
3451b9a5f8caSJouni Malinen  *	struct wiphy. If returning an error, no value should be changed.
34527643a2c3SJohannes Berg  *
34531432de07SLuis R. Rodriguez  * @set_tx_power: set the transmit power according to the parameters,
3454c8442118SJohannes Berg  *	the power passed is in mBm, to get dBm use MBM_TO_DBM(). The
3455c8442118SJohannes Berg  *	wdev may be %NULL if power was set for the wiphy, and will
3456c8442118SJohannes Berg  *	always be %NULL unless the driver supports per-vif TX power
3457c8442118SJohannes Berg  *	(as advertised by the nl80211 feature flag.)
34587643a2c3SJohannes Berg  * @get_tx_power: store the current TX power into the dbm variable;
34591f87f7d3SJohannes Berg  *	return 0 if successful
34601f87f7d3SJohannes Berg  *
3461abe37c4bSJohannes Berg  * @set_wds_peer: set the WDS peer for a WDS interface
3462abe37c4bSJohannes Berg  *
34631f87f7d3SJohannes Berg  * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting
34641f87f7d3SJohannes Berg  *	functions to adjust rfkill hw state
3465aff89a9bSJohannes Berg  *
346661fa713cSHolger Schurig  * @dump_survey: get site survey information.
346761fa713cSHolger Schurig  *
34689588bbd5SJouni Malinen  * @remain_on_channel: Request the driver to remain awake on the specified
34699588bbd5SJouni Malinen  *	channel for the specified duration to complete an off-channel
34709588bbd5SJouni Malinen  *	operation (e.g., public action frame exchange). When the driver is
34719588bbd5SJouni Malinen  *	ready on the requested channel, it must indicate this with an event
34729588bbd5SJouni Malinen  *	notification by calling cfg80211_ready_on_channel().
34739588bbd5SJouni Malinen  * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation.
34749588bbd5SJouni Malinen  *	This allows the operation to be terminated prior to timeout based on
34759588bbd5SJouni Malinen  *	the duration value.
3476f7ca38dfSJohannes Berg  * @mgmt_tx: Transmit a management frame.
3477f7ca38dfSJohannes Berg  * @mgmt_tx_cancel_wait: Cancel the wait time from transmitting a management
3478f7ca38dfSJohannes Berg  *	frame on another channel
34799588bbd5SJouni Malinen  *
3480fc73f11fSDavid Spinadel  * @testmode_cmd: run a test mode command; @wdev may be %NULL
348171063f0eSWey-Yi Guy  * @testmode_dump: Implement a test mode dump. The cb->args[2] and up may be
348271063f0eSWey-Yi Guy  *	used by the function, but 0 and 1 must not be touched. Additionally,
348371063f0eSWey-Yi Guy  *	return error codes other than -ENOBUFS and -ENOENT will terminate the
348471063f0eSWey-Yi Guy  *	dump and return to userspace with an error, so be careful. If any data
348571063f0eSWey-Yi Guy  *	was passed in from userspace then the data/len arguments will be present
348671063f0eSWey-Yi Guy  *	and point to the data contained in %NL80211_ATTR_TESTDATA.
348767fbb16bSSamuel Ortiz  *
3488abe37c4bSJohannes Berg  * @set_bitrate_mask: set the bitrate mask configuration
3489abe37c4bSJohannes Berg  *
349067fbb16bSSamuel Ortiz  * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac
349167fbb16bSSamuel Ortiz  *	devices running firmwares capable of generating the (re) association
349267fbb16bSSamuel Ortiz  *	RSN IE. It allows for faster roaming between WPA2 BSSIDs.
349367fbb16bSSamuel Ortiz  * @del_pmksa: Delete a cached PMKID.
349467fbb16bSSamuel Ortiz  * @flush_pmksa: Flush all cached PMKIDs.
34959043f3b8SJuuso Oikarinen  * @set_power_mgmt: Configure WLAN power management. A timeout value of -1
34969043f3b8SJuuso Oikarinen  *	allows the driver to adjust the dynamic ps timeout value.
3497d6dc1a38SJuuso Oikarinen  * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold.
3498e86abc68SJohannes Berg  *	After configuration, the driver should (soon) send an event indicating
3499e86abc68SJohannes Berg  *	the current level is above/below the configured threshold; this may
3500e86abc68SJohannes Berg  *	need some care when the configuration is changed (without first being
3501e86abc68SJohannes Berg  *	disabled.)
35024a4b8169SAndrew Zaborowski  * @set_cqm_rssi_range_config: Configure two RSSI thresholds in the
35034a4b8169SAndrew Zaborowski  *	connection quality monitor.  An event is to be sent only when the
35044a4b8169SAndrew Zaborowski  *	signal level is found to be outside the two values.  The driver should
35054a4b8169SAndrew Zaborowski  *	set %NL80211_EXT_FEATURE_CQM_RSSI_LIST if this method is implemented.
35064a4b8169SAndrew Zaborowski  *	If it is provided then there's no point providing @set_cqm_rssi_config.
350784f10708SThomas Pedersen  * @set_cqm_txe_config: Configure connection quality monitor TX error
350884f10708SThomas Pedersen  *	thresholds.
3509807f8a8cSLuciano Coelho  * @sched_scan_start: Tell the driver to start a scheduled scan.
35103a3ecf1dSArend Van Spriel  * @sched_scan_stop: Tell the driver to stop an ongoing scheduled scan with
35113a3ecf1dSArend Van Spriel  *	given request id. This call must stop the scheduled scan and be ready
35123a3ecf1dSArend Van Spriel  *	for starting a new one before it returns, i.e. @sched_scan_start may be
35133a3ecf1dSArend Van Spriel  *	called immediately after that again and should not fail in that case.
35143a3ecf1dSArend Van Spriel  *	The driver should not call cfg80211_sched_scan_stopped() for a requested
35153a3ecf1dSArend Van Spriel  *	stop (when this method returns 0).
351667fbb16bSSamuel Ortiz  *
3517271733cfSJohannes Berg  * @mgmt_frame_register: Notify driver that a management frame type was
351833d8783cSJohannes Berg  *	registered. The callback is allowed to sleep.
3519547025d5SBruno Randolf  *
3520547025d5SBruno Randolf  * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device.
3521547025d5SBruno Randolf  *	Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may
3522547025d5SBruno Randolf  *	reject TX/RX mask combinations they cannot support by returning -EINVAL
3523547025d5SBruno Randolf  *	(also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX).
3524547025d5SBruno Randolf  *
3525547025d5SBruno Randolf  * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant).
35263677713bSJohn W. Linville  *
3527109086ceSArik Nemtsov  * @tdls_mgmt: Transmit a TDLS management frame.
3528109086ceSArik Nemtsov  * @tdls_oper: Perform a high-level TDLS operation (e.g. TDLS link setup).
35297f6cf311SJohannes Berg  *
35307f6cf311SJohannes Berg  * @probe_client: probe an associated client, must return a cookie that it
35317f6cf311SJohannes Berg  *	later passes to cfg80211_probe_status().
35321d9d9213SSimon Wunderlich  *
35331d9d9213SSimon Wunderlich  * @set_noack_map: Set the NoAck Map for the TIDs.
3534d6199218SBen Greear  *
35355b7ccaf3SJohannes Berg  * @get_channel: Get the current operating channel for the virtual interface.
35365b7ccaf3SJohannes Berg  *	For monitor interfaces, it should return %NULL unless there's a single
35375b7ccaf3SJohannes Berg  *	current monitoring channel.
353898104fdeSJohannes Berg  *
353998104fdeSJohannes Berg  * @start_p2p_device: Start the given P2P device.
354098104fdeSJohannes Berg  * @stop_p2p_device: Stop the given P2P device.
354177765eafSVasanthakumar Thiagarajan  *
354277765eafSVasanthakumar Thiagarajan  * @set_mac_acl: Sets MAC address control list in AP and P2P GO mode.
354377765eafSVasanthakumar Thiagarajan  *	Parameters include ACL policy, an array of MAC address of stations
354477765eafSVasanthakumar Thiagarajan  *	and the number of MAC addresses. If there is already a list in driver
354577765eafSVasanthakumar Thiagarajan  *	this new list replaces the existing one. Driver has to clear its ACL
354677765eafSVasanthakumar Thiagarajan  *	when number of MAC addresses entries is passed as 0. Drivers which
354777765eafSVasanthakumar Thiagarajan  *	advertise the support for MAC based ACL have to implement this callback.
354804f39047SSimon Wunderlich  *
354904f39047SSimon Wunderlich  * @start_radar_detection: Start radar detection in the driver.
35508bf24293SJouni Malinen  *
3551*26ec17a1SOrr Mazor  * @end_cac: End running CAC, probably because a related CAC
3552*26ec17a1SOrr Mazor  *	was finished on another phy.
3553*26ec17a1SOrr Mazor  *
35548bf24293SJouni Malinen  * @update_ft_ies: Provide updated Fast BSS Transition information to the
35558bf24293SJouni Malinen  *	driver. If the SME is in the driver/firmware, this information can be
35568bf24293SJouni Malinen  *	used in building Authentication and Reassociation Request frames.
35575de17984SArend van Spriel  *
35585de17984SArend van Spriel  * @crit_proto_start: Indicates a critical protocol needs more link reliability
35595de17984SArend van Spriel  *	for a given duration (milliseconds). The protocol is provided so the
35605de17984SArend van Spriel  *	driver can take the most appropriate actions.
35615de17984SArend van Spriel  * @crit_proto_stop: Indicates critical protocol no longer needs increased link
35625de17984SArend van Spriel  *	reliability. This operation can not fail.
3563be29b99aSAmitkumar Karwar  * @set_coalesce: Set coalesce parameters.
356416ef1fe2SSimon Wunderlich  *
356597dc94f1SMichal Kazior  * @channel_switch: initiate channel-switch procedure (with CSA). Driver is
356697dc94f1SMichal Kazior  *	responsible for veryfing if the switch is possible. Since this is
356797dc94f1SMichal Kazior  *	inherently tricky driver may decide to disconnect an interface later
356897dc94f1SMichal Kazior  *	with cfg80211_stop_iface(). This doesn't mean driver can accept
356997dc94f1SMichal Kazior  *	everything. It should do it's best to verify requests and reject them
357097dc94f1SMichal Kazior  *	as soon as possible.
3571fa9ffc74SKyeyoon Park  *
3572fa9ffc74SKyeyoon Park  * @set_qos_map: Set QoS mapping information to the driver
3573e16821bcSJouni Malinen  *
3574e16821bcSJouni Malinen  * @set_ap_chanwidth: Set the AP (including P2P GO) mode channel width for the
3575e16821bcSJouni Malinen  *	given interface This is used e.g. for dynamic HT 20/40 MHz channel width
3576e16821bcSJouni Malinen  *	changes during the lifetime of the BSS.
3577960d01acSJohannes Berg  *
3578960d01acSJohannes Berg  * @add_tx_ts: validate (if admitted_time is 0) or add a TX TS to the device
3579960d01acSJohannes Berg  *	with the given parameters; action frame exchange has been handled by
3580960d01acSJohannes Berg  *	userspace so this just has to modify the TX path to take the TS into
3581960d01acSJohannes Berg  *	account.
3582960d01acSJohannes Berg  *	If the admitted time is 0 just validate the parameters to make sure
3583960d01acSJohannes Berg  *	the session can be created at all; it is valid to just always return
3584960d01acSJohannes Berg  *	success for that but that may result in inefficient behaviour (handshake
3585960d01acSJohannes Berg  *	with the peer followed by immediate teardown when the addition is later
3586960d01acSJohannes Berg  *	rejected)
3587960d01acSJohannes Berg  * @del_tx_ts: remove an existing TX TS
35886e0bd6c3SRostislav Lisovy  *
35896e0bd6c3SRostislav Lisovy  * @join_ocb: join the OCB network with the specified parameters
35906e0bd6c3SRostislav Lisovy  *	(invoked with the wireless_dev mutex held)
35916e0bd6c3SRostislav Lisovy  * @leave_ocb: leave the current OCB network
35926e0bd6c3SRostislav Lisovy  *	(invoked with the wireless_dev mutex held)
35931057d35eSArik Nemtsov  *
35941057d35eSArik Nemtsov  * @tdls_channel_switch: Start channel-switching with a TDLS peer. The driver
35951057d35eSArik Nemtsov  *	is responsible for continually initiating channel-switching operations
35961057d35eSArik Nemtsov  *	and returning to the base channel for communication with the AP.
35971057d35eSArik Nemtsov  * @tdls_cancel_channel_switch: Stop channel-switching with a TDLS peer. Both
35981057d35eSArik Nemtsov  *	peers must be on the base channel when the call completes.
3599cb3b7d87SAyala Beker  * @start_nan: Start the NAN interface.
3600cb3b7d87SAyala Beker  * @stop_nan: Stop the NAN interface.
3601a442b761SAyala Beker  * @add_nan_func: Add a NAN function. Returns negative value on failure.
3602a442b761SAyala Beker  *	On success @nan_func ownership is transferred to the driver and
3603a442b761SAyala Beker  *	it may access it outside of the scope of this function. The driver
3604a442b761SAyala Beker  *	should free the @nan_func when no longer needed by calling
3605a442b761SAyala Beker  *	cfg80211_free_nan_func().
3606a442b761SAyala Beker  *	On success the driver should assign an instance_id in the
3607a442b761SAyala Beker  *	provided @nan_func.
3608a442b761SAyala Beker  * @del_nan_func: Delete a NAN function.
3609a5a9dcf2SAyala Beker  * @nan_change_conf: changes NAN configuration. The changed parameters must
3610a5a9dcf2SAyala Beker  *	be specified in @changes (using &enum cfg80211_nan_conf_changes);
3611a5a9dcf2SAyala Beker  *	All other parameters must be ignored.
3612ce0ce13aSMichael Braun  *
3613ce0ce13aSMichael Braun  * @set_multicast_to_unicast: configure multicast to unicast conversion for BSS
36143a00df57SAvraham Stern  *
361552539ca8SToke Høiland-Jørgensen  * @get_txq_stats: Get TXQ stats for interface or phy. If wdev is %NULL, this
361652539ca8SToke Høiland-Jørgensen  *      function should return phy stats, and interface stats otherwise.
361752539ca8SToke Høiland-Jørgensen  *
36183a00df57SAvraham Stern  * @set_pmk: configure the PMK to be used for offloaded 802.1X 4-Way handshake.
36193a00df57SAvraham Stern  *	If not deleted through @del_pmk the PMK remains valid until disconnect
36203a00df57SAvraham Stern  *	upon which the driver should clear it.
36213a00df57SAvraham Stern  *	(invoked with the wireless_dev mutex held)
36223a00df57SAvraham Stern  * @del_pmk: delete the previously configured PMK for the given authenticator.
36233a00df57SAvraham Stern  *	(invoked with the wireless_dev mutex held)
362440cbfa90SSrinivas Dasari  *
362540cbfa90SSrinivas Dasari  * @external_auth: indicates result of offloaded authentication processing from
362640cbfa90SSrinivas Dasari  *     user space
36272576a9acSDenis Kenzior  *
36282576a9acSDenis Kenzior  * @tx_control_port: TX a control port frame (EAPoL).  The noencrypt parameter
36292576a9acSDenis Kenzior  *	tells the driver that the frame should not be encrypted.
363081e54d08SPradeep Kumar Chitrapu  *
363181e54d08SPradeep Kumar Chitrapu  * @get_ftm_responder_stats: Retrieve FTM responder statistics, if available.
363281e54d08SPradeep Kumar Chitrapu  *	Statistics should be cumulative, currently no way to reset is provided.
36339bb7e0f2SJohannes Berg  * @start_pmsr: start peer measurement (e.g. FTM)
36349bb7e0f2SJohannes Berg  * @abort_pmsr: abort peer measurement
3635cb74e977SSunil Dutt  *
3636cb74e977SSunil Dutt  * @update_owe_info: Provide updated OWE info to driver. Driver implementing SME
3637cb74e977SSunil Dutt  *	but offloading OWE processing to the user space will get the updated
3638cb74e977SSunil Dutt  *	DH IE through this interface.
36395ab92e7fSRajkumar Manoharan  *
36405ab92e7fSRajkumar Manoharan  * @probe_mesh_link: Probe direct Mesh peer's link quality by sending data frame
36415ab92e7fSRajkumar Manoharan  *	and overrule HWMP path selection algorithm.
3642704232c2SJohannes Berg  */
3643704232c2SJohannes Berg struct cfg80211_ops {
3644ff1b6e69SJohannes Berg 	int	(*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
36450378b3f1SJohannes Berg 	int	(*resume)(struct wiphy *wiphy);
36466d52563fSJohannes Berg 	void	(*set_wakeup)(struct wiphy *wiphy, bool enabled);
36470378b3f1SJohannes Berg 
364884efbb84SJohannes Berg 	struct wireless_dev * (*add_virtual_intf)(struct wiphy *wiphy,
3649552bff0cSJohannes Berg 						  const char *name,
36506bab2e19STom Gundersen 						  unsigned char name_assign_type,
3651f9e10ce4SJohannes Berg 						  enum nl80211_iftype type,
36522ec600d6SLuis Carlos Cobo 						  struct vif_params *params);
365384efbb84SJohannes Berg 	int	(*del_virtual_intf)(struct wiphy *wiphy,
365484efbb84SJohannes Berg 				    struct wireless_dev *wdev);
3655e36d56b6SJohannes Berg 	int	(*change_virtual_intf)(struct wiphy *wiphy,
3656e36d56b6SJohannes Berg 				       struct net_device *dev,
3657818a986eSJohannes Berg 				       enum nl80211_iftype type,
36582ec600d6SLuis Carlos Cobo 				       struct vif_params *params);
365941ade00fSJohannes Berg 
366041ade00fSJohannes Berg 	int	(*add_key)(struct wiphy *wiphy, struct net_device *netdev,
3661e31b8213SJohannes Berg 			   u8 key_index, bool pairwise, const u8 *mac_addr,
366241ade00fSJohannes Berg 			   struct key_params *params);
366341ade00fSJohannes Berg 	int	(*get_key)(struct wiphy *wiphy, struct net_device *netdev,
3664e31b8213SJohannes Berg 			   u8 key_index, bool pairwise, const u8 *mac_addr,
3665e31b8213SJohannes Berg 			   void *cookie,
366641ade00fSJohannes Berg 			   void (*callback)(void *cookie, struct key_params*));
366741ade00fSJohannes Berg 	int	(*del_key)(struct wiphy *wiphy, struct net_device *netdev,
3668e31b8213SJohannes Berg 			   u8 key_index, bool pairwise, const u8 *mac_addr);
366941ade00fSJohannes Berg 	int	(*set_default_key)(struct wiphy *wiphy,
367041ade00fSJohannes Berg 				   struct net_device *netdev,
3671dbd2fd65SJohannes Berg 				   u8 key_index, bool unicast, bool multicast);
36723cfcf6acSJouni Malinen 	int	(*set_default_mgmt_key)(struct wiphy *wiphy,
36733cfcf6acSJouni Malinen 					struct net_device *netdev,
36743cfcf6acSJouni Malinen 					u8 key_index);
3675ed1b6cc7SJohannes Berg 
36768860020eSJohannes Berg 	int	(*start_ap)(struct wiphy *wiphy, struct net_device *dev,
36778860020eSJohannes Berg 			    struct cfg80211_ap_settings *settings);
36788860020eSJohannes Berg 	int	(*change_beacon)(struct wiphy *wiphy, struct net_device *dev,
36798860020eSJohannes Berg 				 struct cfg80211_beacon_data *info);
36808860020eSJohannes Berg 	int	(*stop_ap)(struct wiphy *wiphy, struct net_device *dev);
36815727ef1bSJohannes Berg 
36825727ef1bSJohannes Berg 
36835727ef1bSJohannes Berg 	int	(*add_station)(struct wiphy *wiphy, struct net_device *dev,
36843b3a0162SJohannes Berg 			       const u8 *mac,
36853b3a0162SJohannes Berg 			       struct station_parameters *params);
36865727ef1bSJohannes Berg 	int	(*del_station)(struct wiphy *wiphy, struct net_device *dev,
368789c771e5SJouni Malinen 			       struct station_del_parameters *params);
36885727ef1bSJohannes Berg 	int	(*change_station)(struct wiphy *wiphy, struct net_device *dev,
36893b3a0162SJohannes Berg 				  const u8 *mac,
36903b3a0162SJohannes Berg 				  struct station_parameters *params);
3691fd5b74dcSJohannes Berg 	int	(*get_station)(struct wiphy *wiphy, struct net_device *dev,
36923b3a0162SJohannes Berg 			       const u8 *mac, struct station_info *sinfo);
36932ec600d6SLuis Carlos Cobo 	int	(*dump_station)(struct wiphy *wiphy, struct net_device *dev,
36942ec600d6SLuis Carlos Cobo 				int idx, u8 *mac, struct station_info *sinfo);
36952ec600d6SLuis Carlos Cobo 
36962ec600d6SLuis Carlos Cobo 	int	(*add_mpath)(struct wiphy *wiphy, struct net_device *dev,
36973b3a0162SJohannes Berg 			       const u8 *dst, const u8 *next_hop);
36982ec600d6SLuis Carlos Cobo 	int	(*del_mpath)(struct wiphy *wiphy, struct net_device *dev,
36993b3a0162SJohannes Berg 			       const u8 *dst);
37002ec600d6SLuis Carlos Cobo 	int	(*change_mpath)(struct wiphy *wiphy, struct net_device *dev,
37013b3a0162SJohannes Berg 				  const u8 *dst, const u8 *next_hop);
37022ec600d6SLuis Carlos Cobo 	int	(*get_mpath)(struct wiphy *wiphy, struct net_device *dev,
37033b3a0162SJohannes Berg 			     u8 *dst, u8 *next_hop, struct mpath_info *pinfo);
37042ec600d6SLuis Carlos Cobo 	int	(*dump_mpath)(struct wiphy *wiphy, struct net_device *dev,
37052ec600d6SLuis Carlos Cobo 			      int idx, u8 *dst, u8 *next_hop,
37062ec600d6SLuis Carlos Cobo 			      struct mpath_info *pinfo);
370766be7d2bSHenning Rogge 	int	(*get_mpp)(struct wiphy *wiphy, struct net_device *dev,
370866be7d2bSHenning Rogge 			   u8 *dst, u8 *mpp, struct mpath_info *pinfo);
370966be7d2bSHenning Rogge 	int	(*dump_mpp)(struct wiphy *wiphy, struct net_device *dev,
371066be7d2bSHenning Rogge 			    int idx, u8 *dst, u8 *mpp,
371166be7d2bSHenning Rogge 			    struct mpath_info *pinfo);
371224bdd9f4SJavier Cardona 	int	(*get_mesh_config)(struct wiphy *wiphy,
371393da9cc1Scolin@cozybit.com 				struct net_device *dev,
371493da9cc1Scolin@cozybit.com 				struct mesh_config *conf);
371524bdd9f4SJavier Cardona 	int	(*update_mesh_config)(struct wiphy *wiphy,
371629cbe68cSJohannes Berg 				      struct net_device *dev, u32 mask,
371729cbe68cSJohannes Berg 				      const struct mesh_config *nconf);
371829cbe68cSJohannes Berg 	int	(*join_mesh)(struct wiphy *wiphy, struct net_device *dev,
371929cbe68cSJohannes Berg 			     const struct mesh_config *conf,
372029cbe68cSJohannes Berg 			     const struct mesh_setup *setup);
372129cbe68cSJohannes Berg 	int	(*leave_mesh)(struct wiphy *wiphy, struct net_device *dev);
372229cbe68cSJohannes Berg 
37236e0bd6c3SRostislav Lisovy 	int	(*join_ocb)(struct wiphy *wiphy, struct net_device *dev,
37246e0bd6c3SRostislav Lisovy 			    struct ocb_setup *setup);
37256e0bd6c3SRostislav Lisovy 	int	(*leave_ocb)(struct wiphy *wiphy, struct net_device *dev);
37266e0bd6c3SRostislav Lisovy 
37279f1ba906SJouni Malinen 	int	(*change_bss)(struct wiphy *wiphy, struct net_device *dev,
37289f1ba906SJouni Malinen 			      struct bss_parameters *params);
372931888487SJouni Malinen 
3730f70f01c2SEliad Peller 	int	(*set_txq_params)(struct wiphy *wiphy, struct net_device *dev,
373131888487SJouni Malinen 				  struct ieee80211_txq_params *params);
373272bdcf34SJouni Malinen 
3733e8c9bd5bSJohannes Berg 	int	(*libertas_set_mesh_channel)(struct wiphy *wiphy,
3734e8c9bd5bSJohannes Berg 					     struct net_device *dev,
3735e8c9bd5bSJohannes Berg 					     struct ieee80211_channel *chan);
3736e8c9bd5bSJohannes Berg 
3737e8c9bd5bSJohannes Berg 	int	(*set_monitor_channel)(struct wiphy *wiphy,
3738683b6d3bSJohannes Berg 				       struct cfg80211_chan_def *chandef);
37399aed3cc1SJouni Malinen 
3740fd014284SJohannes Berg 	int	(*scan)(struct wiphy *wiphy,
37412a519311SJohannes Berg 			struct cfg80211_scan_request *request);
374291d3ab46SVidyullatha Kanchanapally 	void	(*abort_scan)(struct wiphy *wiphy, struct wireless_dev *wdev);
3743636a5d36SJouni Malinen 
3744636a5d36SJouni Malinen 	int	(*auth)(struct wiphy *wiphy, struct net_device *dev,
3745636a5d36SJouni Malinen 			struct cfg80211_auth_request *req);
3746636a5d36SJouni Malinen 	int	(*assoc)(struct wiphy *wiphy, struct net_device *dev,
3747636a5d36SJouni Malinen 			 struct cfg80211_assoc_request *req);
3748636a5d36SJouni Malinen 	int	(*deauth)(struct wiphy *wiphy, struct net_device *dev,
374963c9c5e7SJohannes Berg 			  struct cfg80211_deauth_request *req);
3750636a5d36SJouni Malinen 	int	(*disassoc)(struct wiphy *wiphy, struct net_device *dev,
375163c9c5e7SJohannes Berg 			    struct cfg80211_disassoc_request *req);
375204a773adSJohannes Berg 
3753b23aa676SSamuel Ortiz 	int	(*connect)(struct wiphy *wiphy, struct net_device *dev,
3754b23aa676SSamuel Ortiz 			   struct cfg80211_connect_params *sme);
3755088e8df8Svamsi krishna 	int	(*update_connect_params)(struct wiphy *wiphy,
3756088e8df8Svamsi krishna 					 struct net_device *dev,
3757088e8df8Svamsi krishna 					 struct cfg80211_connect_params *sme,
3758088e8df8Svamsi krishna 					 u32 changed);
3759b23aa676SSamuel Ortiz 	int	(*disconnect)(struct wiphy *wiphy, struct net_device *dev,
3760b23aa676SSamuel Ortiz 			      u16 reason_code);
3761b23aa676SSamuel Ortiz 
376204a773adSJohannes Berg 	int	(*join_ibss)(struct wiphy *wiphy, struct net_device *dev,
376304a773adSJohannes Berg 			     struct cfg80211_ibss_params *params);
376404a773adSJohannes Berg 	int	(*leave_ibss)(struct wiphy *wiphy, struct net_device *dev);
3765b9a5f8caSJouni Malinen 
3766f4e583c8SAntonio Quartulli 	int	(*set_mcast_rate)(struct wiphy *wiphy, struct net_device *dev,
376757fbcce3SJohannes Berg 				  int rate[NUM_NL80211_BANDS]);
3768f4e583c8SAntonio Quartulli 
3769b9a5f8caSJouni Malinen 	int	(*set_wiphy_params)(struct wiphy *wiphy, u32 changed);
37707643a2c3SJohannes Berg 
3771c8442118SJohannes Berg 	int	(*set_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
3772fa61cf70SJuuso Oikarinen 				enum nl80211_tx_power_setting type, int mbm);
3773c8442118SJohannes Berg 	int	(*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
3774c8442118SJohannes Berg 				int *dbm);
37751f87f7d3SJohannes Berg 
3776ab737a4fSJohannes Berg 	int	(*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev,
3777388ac775SJohannes Berg 				const u8 *addr);
3778ab737a4fSJohannes Berg 
37791f87f7d3SJohannes Berg 	void	(*rfkill_poll)(struct wiphy *wiphy);
3780aff89a9bSJohannes Berg 
3781aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE
3782fc73f11fSDavid Spinadel 	int	(*testmode_cmd)(struct wiphy *wiphy, struct wireless_dev *wdev,
3783fc73f11fSDavid Spinadel 				void *data, int len);
378471063f0eSWey-Yi Guy 	int	(*testmode_dump)(struct wiphy *wiphy, struct sk_buff *skb,
378571063f0eSWey-Yi Guy 				 struct netlink_callback *cb,
378671063f0eSWey-Yi Guy 				 void *data, int len);
3787aff89a9bSJohannes Berg #endif
3788bc92afd9SJohannes Berg 
37899930380fSJohannes Berg 	int	(*set_bitrate_mask)(struct wiphy *wiphy,
37909930380fSJohannes Berg 				    struct net_device *dev,
37919930380fSJohannes Berg 				    const u8 *peer,
37929930380fSJohannes Berg 				    const struct cfg80211_bitrate_mask *mask);
37939930380fSJohannes Berg 
379461fa713cSHolger Schurig 	int	(*dump_survey)(struct wiphy *wiphy, struct net_device *netdev,
379561fa713cSHolger Schurig 			int idx, struct survey_info *info);
379661fa713cSHolger Schurig 
379767fbb16bSSamuel Ortiz 	int	(*set_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
379867fbb16bSSamuel Ortiz 			     struct cfg80211_pmksa *pmksa);
379967fbb16bSSamuel Ortiz 	int	(*del_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
380067fbb16bSSamuel Ortiz 			     struct cfg80211_pmksa *pmksa);
380167fbb16bSSamuel Ortiz 	int	(*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev);
380267fbb16bSSamuel Ortiz 
38039588bbd5SJouni Malinen 	int	(*remain_on_channel)(struct wiphy *wiphy,
380471bbc994SJohannes Berg 				     struct wireless_dev *wdev,
38059588bbd5SJouni Malinen 				     struct ieee80211_channel *chan,
38069588bbd5SJouni Malinen 				     unsigned int duration,
38079588bbd5SJouni Malinen 				     u64 *cookie);
38089588bbd5SJouni Malinen 	int	(*cancel_remain_on_channel)(struct wiphy *wiphy,
380971bbc994SJohannes Berg 					    struct wireless_dev *wdev,
38109588bbd5SJouni Malinen 					    u64 cookie);
38119588bbd5SJouni Malinen 
381271bbc994SJohannes Berg 	int	(*mgmt_tx)(struct wiphy *wiphy, struct wireless_dev *wdev,
3813b176e629SAndrei Otcheretianski 			   struct cfg80211_mgmt_tx_params *params,
3814b176e629SAndrei Otcheretianski 			   u64 *cookie);
3815f7ca38dfSJohannes Berg 	int	(*mgmt_tx_cancel_wait)(struct wiphy *wiphy,
381671bbc994SJohannes Berg 				       struct wireless_dev *wdev,
3817f7ca38dfSJohannes Berg 				       u64 cookie);
3818026331c4SJouni Malinen 
3819bc92afd9SJohannes Berg 	int	(*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev,
3820bc92afd9SJohannes Berg 				  bool enabled, int timeout);
3821d6dc1a38SJuuso Oikarinen 
3822d6dc1a38SJuuso Oikarinen 	int	(*set_cqm_rssi_config)(struct wiphy *wiphy,
3823d6dc1a38SJuuso Oikarinen 				       struct net_device *dev,
3824d6dc1a38SJuuso Oikarinen 				       s32 rssi_thold, u32 rssi_hyst);
3825271733cfSJohannes Berg 
38264a4b8169SAndrew Zaborowski 	int	(*set_cqm_rssi_range_config)(struct wiphy *wiphy,
38274a4b8169SAndrew Zaborowski 					     struct net_device *dev,
38284a4b8169SAndrew Zaborowski 					     s32 rssi_low, s32 rssi_high);
38294a4b8169SAndrew Zaborowski 
383084f10708SThomas Pedersen 	int	(*set_cqm_txe_config)(struct wiphy *wiphy,
383184f10708SThomas Pedersen 				      struct net_device *dev,
383284f10708SThomas Pedersen 				      u32 rate, u32 pkts, u32 intvl);
383384f10708SThomas Pedersen 
3834271733cfSJohannes Berg 	void	(*mgmt_frame_register)(struct wiphy *wiphy,
383571bbc994SJohannes Berg 				       struct wireless_dev *wdev,
3836271733cfSJohannes Berg 				       u16 frame_type, bool reg);
3837afe0cbf8SBruno Randolf 
3838afe0cbf8SBruno Randolf 	int	(*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant);
3839afe0cbf8SBruno Randolf 	int	(*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant);
38403677713bSJohn W. Linville 
3841807f8a8cSLuciano Coelho 	int	(*sched_scan_start)(struct wiphy *wiphy,
3842807f8a8cSLuciano Coelho 				struct net_device *dev,
3843807f8a8cSLuciano Coelho 				struct cfg80211_sched_scan_request *request);
38443a3ecf1dSArend Van Spriel 	int	(*sched_scan_stop)(struct wiphy *wiphy, struct net_device *dev,
38453a3ecf1dSArend Van Spriel 				   u64 reqid);
3846e5497d76SJohannes Berg 
3847e5497d76SJohannes Berg 	int	(*set_rekey_data)(struct wiphy *wiphy, struct net_device *dev,
3848e5497d76SJohannes Berg 				  struct cfg80211_gtk_rekey_data *data);
3849109086ceSArik Nemtsov 
3850109086ceSArik Nemtsov 	int	(*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev,
38513b3a0162SJohannes Berg 			     const u8 *peer, u8 action_code,  u8 dialog_token,
3852df942e7bSSunil Dutt Undekari 			     u16 status_code, u32 peer_capability,
385331fa97c5SArik Nemtsov 			     bool initiator, const u8 *buf, size_t len);
3854109086ceSArik Nemtsov 	int	(*tdls_oper)(struct wiphy *wiphy, struct net_device *dev,
38553b3a0162SJohannes Berg 			     const u8 *peer, enum nl80211_tdls_operation oper);
38567f6cf311SJohannes Berg 
38577f6cf311SJohannes Berg 	int	(*probe_client)(struct wiphy *wiphy, struct net_device *dev,
38587f6cf311SJohannes Berg 				const u8 *peer, u64 *cookie);
3859e999882aSJohannes Berg 
38601d9d9213SSimon Wunderlich 	int	(*set_noack_map)(struct wiphy *wiphy,
38611d9d9213SSimon Wunderlich 				  struct net_device *dev,
38621d9d9213SSimon Wunderlich 				  u16 noack_map);
38631d9d9213SSimon Wunderlich 
3864683b6d3bSJohannes Berg 	int	(*get_channel)(struct wiphy *wiphy,
38655b7ccaf3SJohannes Berg 			       struct wireless_dev *wdev,
3866683b6d3bSJohannes Berg 			       struct cfg80211_chan_def *chandef);
386798104fdeSJohannes Berg 
386898104fdeSJohannes Berg 	int	(*start_p2p_device)(struct wiphy *wiphy,
386998104fdeSJohannes Berg 				    struct wireless_dev *wdev);
387098104fdeSJohannes Berg 	void	(*stop_p2p_device)(struct wiphy *wiphy,
387198104fdeSJohannes Berg 				   struct wireless_dev *wdev);
387277765eafSVasanthakumar Thiagarajan 
387377765eafSVasanthakumar Thiagarajan 	int	(*set_mac_acl)(struct wiphy *wiphy, struct net_device *dev,
387477765eafSVasanthakumar Thiagarajan 			       const struct cfg80211_acl_data *params);
387504f39047SSimon Wunderlich 
387604f39047SSimon Wunderlich 	int	(*start_radar_detection)(struct wiphy *wiphy,
387704f39047SSimon Wunderlich 					 struct net_device *dev,
387831559f35SJanusz Dziedzic 					 struct cfg80211_chan_def *chandef,
387931559f35SJanusz Dziedzic 					 u32 cac_time_ms);
3880*26ec17a1SOrr Mazor 	void	(*end_cac)(struct wiphy *wiphy,
3881*26ec17a1SOrr Mazor 				struct net_device *dev);
3882355199e0SJouni Malinen 	int	(*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev,
3883355199e0SJouni Malinen 				 struct cfg80211_update_ft_ies_params *ftie);
38845de17984SArend van Spriel 	int	(*crit_proto_start)(struct wiphy *wiphy,
38855de17984SArend van Spriel 				    struct wireless_dev *wdev,
38865de17984SArend van Spriel 				    enum nl80211_crit_proto_id protocol,
38875de17984SArend van Spriel 				    u16 duration);
38885de17984SArend van Spriel 	void	(*crit_proto_stop)(struct wiphy *wiphy,
38895de17984SArend van Spriel 				   struct wireless_dev *wdev);
3890be29b99aSAmitkumar Karwar 	int	(*set_coalesce)(struct wiphy *wiphy,
3891be29b99aSAmitkumar Karwar 				struct cfg80211_coalesce *coalesce);
389216ef1fe2SSimon Wunderlich 
389316ef1fe2SSimon Wunderlich 	int	(*channel_switch)(struct wiphy *wiphy,
389416ef1fe2SSimon Wunderlich 				  struct net_device *dev,
389516ef1fe2SSimon Wunderlich 				  struct cfg80211_csa_settings *params);
3896e16821bcSJouni Malinen 
3897fa9ffc74SKyeyoon Park 	int     (*set_qos_map)(struct wiphy *wiphy,
3898fa9ffc74SKyeyoon Park 			       struct net_device *dev,
3899fa9ffc74SKyeyoon Park 			       struct cfg80211_qos_map *qos_map);
3900e16821bcSJouni Malinen 
3901e16821bcSJouni Malinen 	int	(*set_ap_chanwidth)(struct wiphy *wiphy, struct net_device *dev,
3902e16821bcSJouni Malinen 				    struct cfg80211_chan_def *chandef);
3903960d01acSJohannes Berg 
3904960d01acSJohannes Berg 	int	(*add_tx_ts)(struct wiphy *wiphy, struct net_device *dev,
3905960d01acSJohannes Berg 			     u8 tsid, const u8 *peer, u8 user_prio,
3906960d01acSJohannes Berg 			     u16 admitted_time);
3907960d01acSJohannes Berg 	int	(*del_tx_ts)(struct wiphy *wiphy, struct net_device *dev,
3908960d01acSJohannes Berg 			     u8 tsid, const u8 *peer);
39091057d35eSArik Nemtsov 
39101057d35eSArik Nemtsov 	int	(*tdls_channel_switch)(struct wiphy *wiphy,
39111057d35eSArik Nemtsov 				       struct net_device *dev,
39121057d35eSArik Nemtsov 				       const u8 *addr, u8 oper_class,
39131057d35eSArik Nemtsov 				       struct cfg80211_chan_def *chandef);
39141057d35eSArik Nemtsov 	void	(*tdls_cancel_channel_switch)(struct wiphy *wiphy,
39151057d35eSArik Nemtsov 					      struct net_device *dev,
39161057d35eSArik Nemtsov 					      const u8 *addr);
3917cb3b7d87SAyala Beker 	int	(*start_nan)(struct wiphy *wiphy, struct wireless_dev *wdev,
3918cb3b7d87SAyala Beker 			     struct cfg80211_nan_conf *conf);
3919cb3b7d87SAyala Beker 	void	(*stop_nan)(struct wiphy *wiphy, struct wireless_dev *wdev);
3920a442b761SAyala Beker 	int	(*add_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev,
3921a442b761SAyala Beker 				struct cfg80211_nan_func *nan_func);
3922a442b761SAyala Beker 	void	(*del_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev,
3923a442b761SAyala Beker 			       u64 cookie);
3924a5a9dcf2SAyala Beker 	int	(*nan_change_conf)(struct wiphy *wiphy,
3925a5a9dcf2SAyala Beker 				   struct wireless_dev *wdev,
3926a5a9dcf2SAyala Beker 				   struct cfg80211_nan_conf *conf,
3927a5a9dcf2SAyala Beker 				   u32 changes);
3928ce0ce13aSMichael Braun 
3929ce0ce13aSMichael Braun 	int	(*set_multicast_to_unicast)(struct wiphy *wiphy,
3930ce0ce13aSMichael Braun 					    struct net_device *dev,
3931ce0ce13aSMichael Braun 					    const bool enabled);
39323a00df57SAvraham Stern 
393352539ca8SToke Høiland-Jørgensen 	int	(*get_txq_stats)(struct wiphy *wiphy,
393452539ca8SToke Høiland-Jørgensen 				 struct wireless_dev *wdev,
393552539ca8SToke Høiland-Jørgensen 				 struct cfg80211_txq_stats *txqstats);
393652539ca8SToke Høiland-Jørgensen 
39373a00df57SAvraham Stern 	int	(*set_pmk)(struct wiphy *wiphy, struct net_device *dev,
39383a00df57SAvraham Stern 			   const struct cfg80211_pmk_conf *conf);
39393a00df57SAvraham Stern 	int	(*del_pmk)(struct wiphy *wiphy, struct net_device *dev,
39403a00df57SAvraham Stern 			   const u8 *aa);
394140cbfa90SSrinivas Dasari 	int     (*external_auth)(struct wiphy *wiphy, struct net_device *dev,
394240cbfa90SSrinivas Dasari 				 struct cfg80211_external_auth_params *params);
39432576a9acSDenis Kenzior 
39442576a9acSDenis Kenzior 	int	(*tx_control_port)(struct wiphy *wiphy,
39452576a9acSDenis Kenzior 				   struct net_device *dev,
39462576a9acSDenis Kenzior 				   const u8 *buf, size_t len,
39472576a9acSDenis Kenzior 				   const u8 *dest, const __be16 proto,
39482576a9acSDenis Kenzior 				   const bool noencrypt);
394981e54d08SPradeep Kumar Chitrapu 
395081e54d08SPradeep Kumar Chitrapu 	int	(*get_ftm_responder_stats)(struct wiphy *wiphy,
395181e54d08SPradeep Kumar Chitrapu 				struct net_device *dev,
395281e54d08SPradeep Kumar Chitrapu 				struct cfg80211_ftm_responder_stats *ftm_stats);
39539bb7e0f2SJohannes Berg 
39549bb7e0f2SJohannes Berg 	int	(*start_pmsr)(struct wiphy *wiphy, struct wireless_dev *wdev,
39559bb7e0f2SJohannes Berg 			      struct cfg80211_pmsr_request *request);
39569bb7e0f2SJohannes Berg 	void	(*abort_pmsr)(struct wiphy *wiphy, struct wireless_dev *wdev,
39579bb7e0f2SJohannes Berg 			      struct cfg80211_pmsr_request *request);
3958cb74e977SSunil Dutt 	int	(*update_owe_info)(struct wiphy *wiphy, struct net_device *dev,
3959cb74e977SSunil Dutt 				   struct cfg80211_update_owe_info *owe_info);
39605ab92e7fSRajkumar Manoharan 	int	(*probe_mesh_link)(struct wiphy *wiphy, struct net_device *dev,
39615ab92e7fSRajkumar Manoharan 				   const u8 *buf, size_t len);
3962704232c2SJohannes Berg };
3963704232c2SJohannes Berg 
3964d3236553SJohannes Berg /*
3965d3236553SJohannes Berg  * wireless hardware and networking interfaces structures
3966d3236553SJohannes Berg  * and registration/helper functions
3967d3236553SJohannes Berg  */
3968d3236553SJohannes Berg 
3969d3236553SJohannes Berg /**
39705be83de5SJohannes Berg  * enum wiphy_flags - wiphy capability flags
39715be83de5SJohannes Berg  *
39725be83de5SJohannes Berg  * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this
39735be83de5SJohannes Berg  *	wiphy at all
39745be83de5SJohannes Berg  * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled
39755be83de5SJohannes Berg  *	by default -- this flag will be set depending on the kernel's default
39765be83de5SJohannes Berg  *	on wiphy_new(), but can be changed by the driver if it has a good
39775be83de5SJohannes Berg  *	reason to override the default
39789bc383deSJohannes Berg  * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station
397933d915d9SManikanta Pubbisetty  *	on a VLAN interface). This flag also serves an extra purpose of
398033d915d9SManikanta Pubbisetty  *	supporting 4ADDR AP mode on devices which do not support AP/VLAN iftype.
39819bc383deSJohannes Berg  * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station
3982c0692b8fSJohannes Berg  * @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the
3983c0692b8fSJohannes Berg  *	control port protocol ethertype. The device also honours the
3984c0692b8fSJohannes Berg  *	control_port_no_encrypt flag.
3985e31b8213SJohannes Berg  * @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN.
398615d5dda6SJavier Cardona  * @WIPHY_FLAG_MESH_AUTH: The device supports mesh authentication by routing
398715d5dda6SJavier Cardona  *	auth frames to userspace. See @NL80211_MESH_SETUP_USERSPACE_AUTH.
3988f4b34b55SVivek Natarajan  * @WIPHY_FLAG_SUPPORTS_FW_ROAM: The device supports roaming feature in the
3989f4b34b55SVivek Natarajan  *	firmware.
3990cedb5412SEliad Peller  * @WIPHY_FLAG_AP_UAPSD: The device supports uapsd on AP.
3991109086ceSArik Nemtsov  * @WIPHY_FLAG_SUPPORTS_TDLS: The device supports TDLS (802.11z) operation.
3992109086ceSArik Nemtsov  * @WIPHY_FLAG_TDLS_EXTERNAL_SETUP: The device does not handle TDLS (802.11z)
3993109086ceSArik Nemtsov  *	link setup/discovery operations internally. Setup, discovery and
3994109086ceSArik Nemtsov  *	teardown packets should be sent through the @NL80211_CMD_TDLS_MGMT
3995109086ceSArik Nemtsov  *	command. When this flag is not set, @NL80211_CMD_TDLS_OPER should be
3996109086ceSArik Nemtsov  *	used for asking the driver/firmware to perform a TDLS operation.
3997562a7480SJohannes Berg  * @WIPHY_FLAG_HAVE_AP_SME: device integrates AP SME
39985e760230SJohannes Berg  * @WIPHY_FLAG_REPORTS_OBSS: the device will report beacons from other BSSes
39995e760230SJohannes Berg  *	when there are virtual interfaces in AP mode by calling
40005e760230SJohannes Berg  *	cfg80211_report_obss_beacon().
400187bbbe22SArik Nemtsov  * @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD: When operating as an AP, the device
400287bbbe22SArik Nemtsov  *	responds to probe-requests in hardware.
40037c4ef712SJohannes Berg  * @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX.
40047c4ef712SJohannes Berg  * @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call.
40052f301ab2SSimon Wunderlich  * @WIPHY_FLAG_SUPPORTS_5_10_MHZ: Device supports 5 MHz and 10 MHz channels.
400616ef1fe2SSimon Wunderlich  * @WIPHY_FLAG_HAS_CHANNEL_SWITCH: Device supports channel switch in
400716ef1fe2SSimon Wunderlich  *	beaconing mode (AP, IBSS, Mesh, ...).
4008b8676221SDavid Spinadel  * @WIPHY_FLAG_HAS_STATIC_WEP: The device supports static WEP key installation
4009b8676221SDavid Spinadel  *	before connection.
40105be83de5SJohannes Berg  */
40115be83de5SJohannes Berg enum wiphy_flags {
4012723e73acSJohannes Berg 	/* use hole at 0 */
4013a2f73b6cSLuis R. Rodriguez 	/* use hole at 1 */
4014a2f73b6cSLuis R. Rodriguez 	/* use hole at 2 */
40155be83de5SJohannes Berg 	WIPHY_FLAG_NETNS_OK			= BIT(3),
40165be83de5SJohannes Berg 	WIPHY_FLAG_PS_ON_BY_DEFAULT		= BIT(4),
40179bc383deSJohannes Berg 	WIPHY_FLAG_4ADDR_AP			= BIT(5),
40189bc383deSJohannes Berg 	WIPHY_FLAG_4ADDR_STATION		= BIT(6),
4019c0692b8fSJohannes Berg 	WIPHY_FLAG_CONTROL_PORT_PROTOCOL	= BIT(7),
4020309075cfSJussi Kivilinna 	WIPHY_FLAG_IBSS_RSN			= BIT(8),
402115d5dda6SJavier Cardona 	WIPHY_FLAG_MESH_AUTH			= BIT(10),
4022ca986ad9SArend Van Spriel 	/* use hole at 11 */
40238e8b41f9SJohannes Berg 	/* use hole at 12 */
4024f4b34b55SVivek Natarajan 	WIPHY_FLAG_SUPPORTS_FW_ROAM		= BIT(13),
4025cedb5412SEliad Peller 	WIPHY_FLAG_AP_UAPSD			= BIT(14),
4026109086ceSArik Nemtsov 	WIPHY_FLAG_SUPPORTS_TDLS		= BIT(15),
4027109086ceSArik Nemtsov 	WIPHY_FLAG_TDLS_EXTERNAL_SETUP		= BIT(16),
4028562a7480SJohannes Berg 	WIPHY_FLAG_HAVE_AP_SME			= BIT(17),
40295e760230SJohannes Berg 	WIPHY_FLAG_REPORTS_OBSS			= BIT(18),
403087bbbe22SArik Nemtsov 	WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD	= BIT(19),
40317c4ef712SJohannes Berg 	WIPHY_FLAG_OFFCHAN_TX			= BIT(20),
40327c4ef712SJohannes Berg 	WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL	= BIT(21),
40332f301ab2SSimon Wunderlich 	WIPHY_FLAG_SUPPORTS_5_10_MHZ		= BIT(22),
403416ef1fe2SSimon Wunderlich 	WIPHY_FLAG_HAS_CHANNEL_SWITCH		= BIT(23),
4035b8676221SDavid Spinadel 	WIPHY_FLAG_HAS_STATIC_WEP		= BIT(24),
40367527a782SJohannes Berg };
40377527a782SJohannes Berg 
40387527a782SJohannes Berg /**
40397527a782SJohannes Berg  * struct ieee80211_iface_limit - limit on certain interface types
40407527a782SJohannes Berg  * @max: maximum number of interfaces of these types
40417527a782SJohannes Berg  * @types: interface types (bits)
40427527a782SJohannes Berg  */
40437527a782SJohannes Berg struct ieee80211_iface_limit {
40447527a782SJohannes Berg 	u16 max;
40457527a782SJohannes Berg 	u16 types;
40467527a782SJohannes Berg };
40477527a782SJohannes Berg 
40487527a782SJohannes Berg /**
40497527a782SJohannes Berg  * struct ieee80211_iface_combination - possible interface combination
40507527a782SJohannes Berg  *
4051b80edbc1SLuciano Coelho  * With this structure the driver can describe which interface
4052b80edbc1SLuciano Coelho  * combinations it supports concurrently.
40537527a782SJohannes Berg  *
4054b80edbc1SLuciano Coelho  * Examples:
4055b80edbc1SLuciano Coelho  *
4056b80edbc1SLuciano Coelho  * 1. Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total:
40577527a782SJohannes Berg  *
4058819bf593SJohannes Berg  *    .. code-block:: c
4059819bf593SJohannes Berg  *
40607527a782SJohannes Berg  *	struct ieee80211_iface_limit limits1[] = {
40617527a782SJohannes Berg  *		{ .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
40627527a782SJohannes Berg  *		{ .max = 1, .types = BIT(NL80211_IFTYPE_AP}, },
40637527a782SJohannes Berg  *	};
40647527a782SJohannes Berg  *	struct ieee80211_iface_combination combination1 = {
40657527a782SJohannes Berg  *		.limits = limits1,
40667527a782SJohannes Berg  *		.n_limits = ARRAY_SIZE(limits1),
40677527a782SJohannes Berg  *		.max_interfaces = 2,
40687527a782SJohannes Berg  *		.beacon_int_infra_match = true,
40697527a782SJohannes Berg  *	};
40707527a782SJohannes Berg  *
40717527a782SJohannes Berg  *
4072b80edbc1SLuciano Coelho  * 2. Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total:
40737527a782SJohannes Berg  *
4074819bf593SJohannes Berg  *    .. code-block:: c
4075819bf593SJohannes Berg  *
40767527a782SJohannes Berg  *	struct ieee80211_iface_limit limits2[] = {
40777527a782SJohannes Berg  *		{ .max = 8, .types = BIT(NL80211_IFTYPE_AP) |
40787527a782SJohannes Berg  *				     BIT(NL80211_IFTYPE_P2P_GO), },
40797527a782SJohannes Berg  *	};
40807527a782SJohannes Berg  *	struct ieee80211_iface_combination combination2 = {
40817527a782SJohannes Berg  *		.limits = limits2,
40827527a782SJohannes Berg  *		.n_limits = ARRAY_SIZE(limits2),
40837527a782SJohannes Berg  *		.max_interfaces = 8,
40847527a782SJohannes Berg  *		.num_different_channels = 1,
40857527a782SJohannes Berg  *	};
40867527a782SJohannes Berg  *
40877527a782SJohannes Berg  *
4088b80edbc1SLuciano Coelho  * 3. Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total.
4089b80edbc1SLuciano Coelho  *
40907527a782SJohannes Berg  *    This allows for an infrastructure connection and three P2P connections.
40917527a782SJohannes Berg  *
4092819bf593SJohannes Berg  *    .. code-block:: c
4093819bf593SJohannes Berg  *
40947527a782SJohannes Berg  *	struct ieee80211_iface_limit limits3[] = {
40957527a782SJohannes Berg  *		{ .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
40967527a782SJohannes Berg  *		{ .max = 3, .types = BIT(NL80211_IFTYPE_P2P_GO) |
40977527a782SJohannes Berg  *				     BIT(NL80211_IFTYPE_P2P_CLIENT), },
40987527a782SJohannes Berg  *	};
40997527a782SJohannes Berg  *	struct ieee80211_iface_combination combination3 = {
41007527a782SJohannes Berg  *		.limits = limits3,
41017527a782SJohannes Berg  *		.n_limits = ARRAY_SIZE(limits3),
41027527a782SJohannes Berg  *		.max_interfaces = 4,
41037527a782SJohannes Berg  *		.num_different_channels = 2,
41047527a782SJohannes Berg  *	};
4105819bf593SJohannes Berg  *
41067527a782SJohannes Berg  */
41077527a782SJohannes Berg struct ieee80211_iface_combination {
4108c6c94aeaSJohannes Berg 	/**
4109c6c94aeaSJohannes Berg 	 * @limits:
4110c6c94aeaSJohannes Berg 	 * limits for the given interface types
4111c6c94aeaSJohannes Berg 	 */
41127527a782SJohannes Berg 	const struct ieee80211_iface_limit *limits;
4113c6c94aeaSJohannes Berg 
4114c6c94aeaSJohannes Berg 	/**
4115c6c94aeaSJohannes Berg 	 * @num_different_channels:
4116c6c94aeaSJohannes Berg 	 * can use up to this many different channels
4117c6c94aeaSJohannes Berg 	 */
41187527a782SJohannes Berg 	u32 num_different_channels;
4119c6c94aeaSJohannes Berg 
4120c6c94aeaSJohannes Berg 	/**
4121c6c94aeaSJohannes Berg 	 * @max_interfaces:
4122c6c94aeaSJohannes Berg 	 * maximum number of interfaces in total allowed in this group
4123c6c94aeaSJohannes Berg 	 */
41247527a782SJohannes Berg 	u16 max_interfaces;
4125c6c94aeaSJohannes Berg 
4126c6c94aeaSJohannes Berg 	/**
4127c6c94aeaSJohannes Berg 	 * @n_limits:
4128c6c94aeaSJohannes Berg 	 * number of limitations
4129c6c94aeaSJohannes Berg 	 */
41307527a782SJohannes Berg 	u8 n_limits;
4131c6c94aeaSJohannes Berg 
4132c6c94aeaSJohannes Berg 	/**
4133c6c94aeaSJohannes Berg 	 * @beacon_int_infra_match:
4134c6c94aeaSJohannes Berg 	 * In this combination, the beacon intervals between infrastructure
4135c6c94aeaSJohannes Berg 	 * and AP types must match. This is required only in special cases.
4136c6c94aeaSJohannes Berg 	 */
41377527a782SJohannes Berg 	bool beacon_int_infra_match;
4138c6c94aeaSJohannes Berg 
4139c6c94aeaSJohannes Berg 	/**
4140c6c94aeaSJohannes Berg 	 * @radar_detect_widths:
4141c6c94aeaSJohannes Berg 	 * bitmap of channel widths supported for radar detection
4142c6c94aeaSJohannes Berg 	 */
414311c4a075SSimon Wunderlich 	u8 radar_detect_widths;
4144c6c94aeaSJohannes Berg 
4145c6c94aeaSJohannes Berg 	/**
4146c6c94aeaSJohannes Berg 	 * @radar_detect_regions:
4147c6c94aeaSJohannes Berg 	 * bitmap of regions supported for radar detection
4148c6c94aeaSJohannes Berg 	 */
41498c48b50aSFelix Fietkau 	u8 radar_detect_regions;
4150c6c94aeaSJohannes Berg 
4151c6c94aeaSJohannes Berg 	/**
4152c6c94aeaSJohannes Berg 	 * @beacon_int_min_gcd:
4153c6c94aeaSJohannes Berg 	 * This interface combination supports different beacon intervals.
4154c6c94aeaSJohannes Berg 	 *
4155c6c94aeaSJohannes Berg 	 * = 0
4156c6c94aeaSJohannes Berg 	 *   all beacon intervals for different interface must be same.
4157c6c94aeaSJohannes Berg 	 * > 0
4158c6c94aeaSJohannes Berg 	 *   any beacon interval for the interface part of this combination AND
4159c6c94aeaSJohannes Berg 	 *   GCD of all beacon intervals from beaconing interfaces of this
4160c6c94aeaSJohannes Berg 	 *   combination must be greater or equal to this value.
4161c6c94aeaSJohannes Berg 	 */
41620c317a02SPurushottam Kushwaha 	u32 beacon_int_min_gcd;
41635be83de5SJohannes Berg };
41645be83de5SJohannes Berg 
41652e161f78SJohannes Berg struct ieee80211_txrx_stypes {
41662e161f78SJohannes Berg 	u16 tx, rx;
41672e161f78SJohannes Berg };
41682e161f78SJohannes Berg 
41695be83de5SJohannes Berg /**
4170ff1b6e69SJohannes Berg  * enum wiphy_wowlan_support_flags - WoWLAN support flags
4171ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_ANY: supports wakeup for the special "any"
4172ff1b6e69SJohannes Berg  *	trigger that keeps the device operating as-is and
4173ff1b6e69SJohannes Berg  *	wakes up the host on any activity, for example a
4174ff1b6e69SJohannes Berg  *	received packet that passed filtering; note that the
4175ff1b6e69SJohannes Berg  *	packet should be preserved in that case
4176ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_MAGIC_PKT: supports wakeup on magic packet
4177ff1b6e69SJohannes Berg  *	(see nl80211.h)
4178ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_DISCONNECT: supports wakeup on disconnect
417977dbbb13SJohannes Berg  * @WIPHY_WOWLAN_SUPPORTS_GTK_REKEY: supports GTK rekeying while asleep
418077dbbb13SJohannes Berg  * @WIPHY_WOWLAN_GTK_REKEY_FAILURE: supports wakeup on GTK rekey failure
418177dbbb13SJohannes Berg  * @WIPHY_WOWLAN_EAP_IDENTITY_REQ: supports wakeup on EAP identity request
418277dbbb13SJohannes Berg  * @WIPHY_WOWLAN_4WAY_HANDSHAKE: supports wakeup on 4-way handshake failure
418377dbbb13SJohannes Berg  * @WIPHY_WOWLAN_RFKILL_RELEASE: supports wakeup on RF-kill release
41848cd4d456SLuciano Coelho  * @WIPHY_WOWLAN_NET_DETECT: supports wakeup on network detection
4185ff1b6e69SJohannes Berg  */
4186ff1b6e69SJohannes Berg enum wiphy_wowlan_support_flags {
4187ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_ANY		= BIT(0),
4188ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_MAGIC_PKT		= BIT(1),
4189ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_DISCONNECT		= BIT(2),
419077dbbb13SJohannes Berg 	WIPHY_WOWLAN_SUPPORTS_GTK_REKEY	= BIT(3),
419177dbbb13SJohannes Berg 	WIPHY_WOWLAN_GTK_REKEY_FAILURE	= BIT(4),
419277dbbb13SJohannes Berg 	WIPHY_WOWLAN_EAP_IDENTITY_REQ	= BIT(5),
419377dbbb13SJohannes Berg 	WIPHY_WOWLAN_4WAY_HANDSHAKE	= BIT(6),
419477dbbb13SJohannes Berg 	WIPHY_WOWLAN_RFKILL_RELEASE	= BIT(7),
41958cd4d456SLuciano Coelho 	WIPHY_WOWLAN_NET_DETECT		= BIT(8),
4196ff1b6e69SJohannes Berg };
4197ff1b6e69SJohannes Berg 
41982a0e047eSJohannes Berg struct wiphy_wowlan_tcp_support {
41992a0e047eSJohannes Berg 	const struct nl80211_wowlan_tcp_data_token_feature *tok;
42002a0e047eSJohannes Berg 	u32 data_payload_max;
42012a0e047eSJohannes Berg 	u32 data_interval_max;
42022a0e047eSJohannes Berg 	u32 wake_payload_max;
42032a0e047eSJohannes Berg 	bool seq;
42042a0e047eSJohannes Berg };
42052a0e047eSJohannes Berg 
4206ff1b6e69SJohannes Berg /**
4207ff1b6e69SJohannes Berg  * struct wiphy_wowlan_support - WoWLAN support data
4208ff1b6e69SJohannes Berg  * @flags: see &enum wiphy_wowlan_support_flags
4209ff1b6e69SJohannes Berg  * @n_patterns: number of supported wakeup patterns
4210ff1b6e69SJohannes Berg  *	(see nl80211.h for the pattern definition)
4211ff1b6e69SJohannes Berg  * @pattern_max_len: maximum length of each pattern
4212ff1b6e69SJohannes Berg  * @pattern_min_len: minimum length of each pattern
4213bb92d199SAmitkumar Karwar  * @max_pkt_offset: maximum Rx packet offset
42148cd4d456SLuciano Coelho  * @max_nd_match_sets: maximum number of matchsets for net-detect,
42158cd4d456SLuciano Coelho  *	similar, but not necessarily identical, to max_match_sets for
42168cd4d456SLuciano Coelho  *	scheduled scans.
42178cd4d456SLuciano Coelho  *	See &struct cfg80211_sched_scan_request.@match_sets for more
42188cd4d456SLuciano Coelho  *	details.
42192a0e047eSJohannes Berg  * @tcp: TCP wakeup support information
4220ff1b6e69SJohannes Berg  */
4221ff1b6e69SJohannes Berg struct wiphy_wowlan_support {
4222ff1b6e69SJohannes Berg 	u32 flags;
4223ff1b6e69SJohannes Berg 	int n_patterns;
4224ff1b6e69SJohannes Berg 	int pattern_max_len;
4225ff1b6e69SJohannes Berg 	int pattern_min_len;
4226bb92d199SAmitkumar Karwar 	int max_pkt_offset;
42278cd4d456SLuciano Coelho 	int max_nd_match_sets;
42282a0e047eSJohannes Berg 	const struct wiphy_wowlan_tcp_support *tcp;
4229ff1b6e69SJohannes Berg };
4230ff1b6e69SJohannes Berg 
4231ff1b6e69SJohannes Berg /**
4232be29b99aSAmitkumar Karwar  * struct wiphy_coalesce_support - coalesce support data
4233be29b99aSAmitkumar Karwar  * @n_rules: maximum number of coalesce rules
4234be29b99aSAmitkumar Karwar  * @max_delay: maximum supported coalescing delay in msecs
4235be29b99aSAmitkumar Karwar  * @n_patterns: number of supported patterns in a rule
4236be29b99aSAmitkumar Karwar  *	(see nl80211.h for the pattern definition)
4237be29b99aSAmitkumar Karwar  * @pattern_max_len: maximum length of each pattern
4238be29b99aSAmitkumar Karwar  * @pattern_min_len: minimum length of each pattern
4239be29b99aSAmitkumar Karwar  * @max_pkt_offset: maximum Rx packet offset
4240be29b99aSAmitkumar Karwar  */
4241be29b99aSAmitkumar Karwar struct wiphy_coalesce_support {
4242be29b99aSAmitkumar Karwar 	int n_rules;
4243be29b99aSAmitkumar Karwar 	int max_delay;
4244be29b99aSAmitkumar Karwar 	int n_patterns;
4245be29b99aSAmitkumar Karwar 	int pattern_max_len;
4246be29b99aSAmitkumar Karwar 	int pattern_min_len;
4247be29b99aSAmitkumar Karwar 	int max_pkt_offset;
4248be29b99aSAmitkumar Karwar };
4249be29b99aSAmitkumar Karwar 
4250be29b99aSAmitkumar Karwar /**
4251ad7e718cSJohannes Berg  * enum wiphy_vendor_command_flags - validation flags for vendor commands
4252ad7e718cSJohannes Berg  * @WIPHY_VENDOR_CMD_NEED_WDEV: vendor command requires wdev
4253ad7e718cSJohannes Berg  * @WIPHY_VENDOR_CMD_NEED_NETDEV: vendor command requires netdev
4254ad7e718cSJohannes Berg  * @WIPHY_VENDOR_CMD_NEED_RUNNING: interface/wdev must be up & running
4255ad7e718cSJohannes Berg  *	(must be combined with %_WDEV or %_NETDEV)
4256ad7e718cSJohannes Berg  */
4257ad7e718cSJohannes Berg enum wiphy_vendor_command_flags {
4258ad7e718cSJohannes Berg 	WIPHY_VENDOR_CMD_NEED_WDEV = BIT(0),
4259ad7e718cSJohannes Berg 	WIPHY_VENDOR_CMD_NEED_NETDEV = BIT(1),
4260ad7e718cSJohannes Berg 	WIPHY_VENDOR_CMD_NEED_RUNNING = BIT(2),
4261ad7e718cSJohannes Berg };
4262ad7e718cSJohannes Berg 
4263ad7e718cSJohannes Berg /**
4264466b9936Stamizhr@codeaurora.org  * enum wiphy_opmode_flag - Station's ht/vht operation mode information flags
4265466b9936Stamizhr@codeaurora.org  *
4266466b9936Stamizhr@codeaurora.org  * @STA_OPMODE_MAX_BW_CHANGED: Max Bandwidth changed
4267466b9936Stamizhr@codeaurora.org  * @STA_OPMODE_SMPS_MODE_CHANGED: SMPS mode changed
4268466b9936Stamizhr@codeaurora.org  * @STA_OPMODE_N_SS_CHANGED: max N_SS (number of spatial streams) changed
4269466b9936Stamizhr@codeaurora.org  *
4270466b9936Stamizhr@codeaurora.org  */
4271466b9936Stamizhr@codeaurora.org enum wiphy_opmode_flag {
4272466b9936Stamizhr@codeaurora.org 	STA_OPMODE_MAX_BW_CHANGED	= BIT(0),
4273466b9936Stamizhr@codeaurora.org 	STA_OPMODE_SMPS_MODE_CHANGED	= BIT(1),
4274466b9936Stamizhr@codeaurora.org 	STA_OPMODE_N_SS_CHANGED		= BIT(2),
4275466b9936Stamizhr@codeaurora.org };
4276466b9936Stamizhr@codeaurora.org 
4277466b9936Stamizhr@codeaurora.org /**
4278466b9936Stamizhr@codeaurora.org  * struct sta_opmode_info - Station's ht/vht operation mode information
4279466b9936Stamizhr@codeaurora.org  * @changed: contains value from &enum wiphy_opmode_flag
42805e78abd0Stamizhr@codeaurora.org  * @smps_mode: New SMPS mode value from &enum nl80211_smps_mode of a station
42815e78abd0Stamizhr@codeaurora.org  * @bw: new max bandwidth value from &enum nl80211_chan_width of a station
4282466b9936Stamizhr@codeaurora.org  * @rx_nss: new rx_nss value of a station
4283466b9936Stamizhr@codeaurora.org  */
4284466b9936Stamizhr@codeaurora.org 
4285466b9936Stamizhr@codeaurora.org struct sta_opmode_info {
4286466b9936Stamizhr@codeaurora.org 	u32 changed;
42875e78abd0Stamizhr@codeaurora.org 	enum nl80211_smps_mode smps_mode;
42885e78abd0Stamizhr@codeaurora.org 	enum nl80211_chan_width bw;
4289466b9936Stamizhr@codeaurora.org 	u8 rx_nss;
4290466b9936Stamizhr@codeaurora.org };
4291466b9936Stamizhr@codeaurora.org 
429291046d63SJohannes Berg #define VENDOR_CMD_RAW_DATA ((const struct nla_policy *)(long)(-ENODATA))
4293901bb989SJohannes Berg 
4294466b9936Stamizhr@codeaurora.org /**
4295ad7e718cSJohannes Berg  * struct wiphy_vendor_command - vendor command definition
4296ad7e718cSJohannes Berg  * @info: vendor command identifying information, as used in nl80211
4297ad7e718cSJohannes Berg  * @flags: flags, see &enum wiphy_vendor_command_flags
4298ad7e718cSJohannes Berg  * @doit: callback for the operation, note that wdev is %NULL if the
4299ad7e718cSJohannes Berg  *	flags didn't ask for a wdev and non-%NULL otherwise; the data
4300ad7e718cSJohannes Berg  *	pointer may be %NULL if userspace provided no data at all
43017bdbe400SJohannes Berg  * @dumpit: dump callback, for transferring bigger/multiple items. The
43027bdbe400SJohannes Berg  *	@storage points to cb->args[5], ie. is preserved over the multiple
43037bdbe400SJohannes Berg  *	dumpit calls.
4304901bb989SJohannes Berg  * @policy: policy pointer for attributes within %NL80211_ATTR_VENDOR_DATA.
4305901bb989SJohannes Berg  *	Set this to %VENDOR_CMD_RAW_DATA if no policy can be given and the
4306901bb989SJohannes Berg  *	attribute is just raw data (e.g. a firmware command).
4307901bb989SJohannes Berg  * @maxattr: highest attribute number in policy
43087bdbe400SJohannes Berg  * It's recommended to not have the same sub command with both @doit and
43097bdbe400SJohannes Berg  * @dumpit, so that userspace can assume certain ones are get and others
43107bdbe400SJohannes Berg  * are used with dump requests.
4311ad7e718cSJohannes Berg  */
4312ad7e718cSJohannes Berg struct wiphy_vendor_command {
4313ad7e718cSJohannes Berg 	struct nl80211_vendor_cmd_info info;
4314ad7e718cSJohannes Berg 	u32 flags;
4315ad7e718cSJohannes Berg 	int (*doit)(struct wiphy *wiphy, struct wireless_dev *wdev,
4316ad7e718cSJohannes Berg 		    const void *data, int data_len);
43177bdbe400SJohannes Berg 	int (*dumpit)(struct wiphy *wiphy, struct wireless_dev *wdev,
43187bdbe400SJohannes Berg 		      struct sk_buff *skb, const void *data, int data_len,
43197bdbe400SJohannes Berg 		      unsigned long *storage);
4320901bb989SJohannes Berg 	const struct nla_policy *policy;
4321901bb989SJohannes Berg 	unsigned int maxattr;
4322ad7e718cSJohannes Berg };
4323ad7e718cSJohannes Berg 
4324ad7e718cSJohannes Berg /**
4325019ae3a9SKanchanapally, Vidyullatha  * struct wiphy_iftype_ext_capab - extended capabilities per interface type
4326019ae3a9SKanchanapally, Vidyullatha  * @iftype: interface type
4327019ae3a9SKanchanapally, Vidyullatha  * @extended_capabilities: extended capabilities supported by the driver,
4328019ae3a9SKanchanapally, Vidyullatha  *	additional capabilities might be supported by userspace; these are the
4329019ae3a9SKanchanapally, Vidyullatha  *	802.11 extended capabilities ("Extended Capabilities element") and are
4330019ae3a9SKanchanapally, Vidyullatha  *	in the same format as in the information element. See IEEE Std
4331019ae3a9SKanchanapally, Vidyullatha  *	802.11-2012 8.4.2.29 for the defined fields.
4332019ae3a9SKanchanapally, Vidyullatha  * @extended_capabilities_mask: mask of the valid values
4333019ae3a9SKanchanapally, Vidyullatha  * @extended_capabilities_len: length of the extended capabilities
4334019ae3a9SKanchanapally, Vidyullatha  */
4335019ae3a9SKanchanapally, Vidyullatha struct wiphy_iftype_ext_capab {
4336019ae3a9SKanchanapally, Vidyullatha 	enum nl80211_iftype iftype;
4337019ae3a9SKanchanapally, Vidyullatha 	const u8 *extended_capabilities;
4338019ae3a9SKanchanapally, Vidyullatha 	const u8 *extended_capabilities_mask;
4339019ae3a9SKanchanapally, Vidyullatha 	u8 extended_capabilities_len;
4340019ae3a9SKanchanapally, Vidyullatha };
4341019ae3a9SKanchanapally, Vidyullatha 
4342019ae3a9SKanchanapally, Vidyullatha /**
43439bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_capabilities - cfg80211 peer measurement capabilities
43449bb7e0f2SJohannes Berg  * @max_peers: maximum number of peers in a single measurement
43459bb7e0f2SJohannes Berg  * @report_ap_tsf: can report assoc AP's TSF for radio resource measurement
43469bb7e0f2SJohannes Berg  * @randomize_mac_addr: can randomize MAC address for measurement
43479bb7e0f2SJohannes Berg  * @ftm.supported: FTM measurement is supported
43489bb7e0f2SJohannes Berg  * @ftm.asap: ASAP-mode is supported
43499bb7e0f2SJohannes Berg  * @ftm.non_asap: non-ASAP-mode is supported
43509bb7e0f2SJohannes Berg  * @ftm.request_lci: can request LCI data
43519bb7e0f2SJohannes Berg  * @ftm.request_civicloc: can request civic location data
43529bb7e0f2SJohannes Berg  * @ftm.preambles: bitmap of preambles supported (&enum nl80211_preamble)
43539bb7e0f2SJohannes Berg  * @ftm.bandwidths: bitmap of bandwidths supported (&enum nl80211_chan_width)
43549bb7e0f2SJohannes Berg  * @ftm.max_bursts_exponent: maximum burst exponent supported
43559bb7e0f2SJohannes Berg  *	(set to -1 if not limited; note that setting this will necessarily
43569bb7e0f2SJohannes Berg  *	forbid using the value 15 to let the responder pick)
43579bb7e0f2SJohannes Berg  * @ftm.max_ftms_per_burst: maximum FTMs per burst supported (set to 0 if
43589bb7e0f2SJohannes Berg  *	not limited)
43599bb7e0f2SJohannes Berg  */
43609bb7e0f2SJohannes Berg struct cfg80211_pmsr_capabilities {
43619bb7e0f2SJohannes Berg 	unsigned int max_peers;
43629bb7e0f2SJohannes Berg 	u8 report_ap_tsf:1,
43639bb7e0f2SJohannes Berg 	   randomize_mac_addr:1;
43649bb7e0f2SJohannes Berg 
43659bb7e0f2SJohannes Berg 	struct {
43669bb7e0f2SJohannes Berg 		u32 preambles;
43679bb7e0f2SJohannes Berg 		u32 bandwidths;
43689bb7e0f2SJohannes Berg 		s8 max_bursts_exponent;
43699bb7e0f2SJohannes Berg 		u8 max_ftms_per_burst;
43709bb7e0f2SJohannes Berg 		u8 supported:1,
43719bb7e0f2SJohannes Berg 		   asap:1,
43729bb7e0f2SJohannes Berg 		   non_asap:1,
43739bb7e0f2SJohannes Berg 		   request_lci:1,
43749bb7e0f2SJohannes Berg 		   request_civicloc:1;
43759bb7e0f2SJohannes Berg 	} ftm;
43769bb7e0f2SJohannes Berg };
43779bb7e0f2SJohannes Berg 
43789bb7e0f2SJohannes Berg /**
43795be83de5SJohannes Berg  * struct wiphy - wireless hardware description
43802784fe91SLuis R. Rodriguez  * @reg_notifier: the driver's regulatory notification callback,
43812784fe91SLuis R. Rodriguez  *	note that if your driver uses wiphy_apply_custom_regulatory()
43822784fe91SLuis R. Rodriguez  *	the reg_notifier's request can be passed as NULL
4383d3236553SJohannes Berg  * @regd: the driver's regulatory domain, if one was requested via
4384d3236553SJohannes Berg  * 	the regulatory_hint() API. This can be used by the driver
4385d3236553SJohannes Berg  *	on the reg_notifier() if it chooses to ignore future
4386d3236553SJohannes Berg  *	regulatory domain changes caused by other drivers.
4387d3236553SJohannes Berg  * @signal_type: signal type reported in &struct cfg80211_bss.
4388d3236553SJohannes Berg  * @cipher_suites: supported cipher suites
4389d3236553SJohannes Berg  * @n_cipher_suites: number of supported cipher suites
4390ab4dfa20SVeerendranath Jakkam  * @akm_suites: supported AKM suites
4391ab4dfa20SVeerendranath Jakkam  * @n_akm_suites: number of supported AKM suites
4392b9a5f8caSJouni Malinen  * @retry_short: Retry limit for short frames (dot11ShortRetryLimit)
4393b9a5f8caSJouni Malinen  * @retry_long: Retry limit for long frames (dot11LongRetryLimit)
4394b9a5f8caSJouni Malinen  * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold);
4395b9a5f8caSJouni Malinen  *	-1 = fragmentation disabled, only odd values >= 256 used
4396b9a5f8caSJouni Malinen  * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled
4397abe37c4bSJohannes Berg  * @_net: the network namespace this wiphy currently lives in
4398ef15aac6SJohannes Berg  * @perm_addr: permanent MAC address of this device
4399ef15aac6SJohannes Berg  * @addr_mask: If the device supports multiple MAC addresses by masking,
4400ef15aac6SJohannes Berg  *	set this to a mask with variable bits set to 1, e.g. if the last
44010fcf8ac5SLuciano Coelho  *	four bits are variable then set it to 00-00-00-00-00-0f. The actual
4402ef15aac6SJohannes Berg  *	variable bits shall be determined by the interfaces added, with
4403ef15aac6SJohannes Berg  *	interfaces not matching the mask being rejected to be brought up.
4404ef15aac6SJohannes Berg  * @n_addresses: number of addresses in @addresses.
4405ef15aac6SJohannes Berg  * @addresses: If the device has more than one address, set this pointer
4406ef15aac6SJohannes Berg  *	to a list of addresses (6 bytes each). The first one will be used
4407ef15aac6SJohannes Berg  *	by default for perm_addr. In this case, the mask should be set to
4408ef15aac6SJohannes Berg  *	all-zeroes. In this case it is assumed that the device can handle
4409ef15aac6SJohannes Berg  *	the same number of arbitrary MAC addresses.
4410fd235913SRandy Dunlap  * @registered: protects ->resume and ->suspend sysfs callbacks against
4411fd235913SRandy Dunlap  *	unregister hardware
4412abe37c4bSJohannes Berg  * @debugfsdir: debugfs directory used for this wiphy, will be renamed
4413abe37c4bSJohannes Berg  *	automatically on wiphy renames
4414abe37c4bSJohannes Berg  * @dev: (virtual) struct device for this wiphy
44154a711a85SStanislaw Gruszka  * @registered: helps synchronize suspend/resume with wiphy unregister
4416abe37c4bSJohannes Berg  * @wext: wireless extension handlers
4417abe37c4bSJohannes Berg  * @priv: driver private data (sized according to wiphy_new() parameter)
4418abe37c4bSJohannes Berg  * @interface_modes: bitmask of interfaces types valid for this wiphy,
4419abe37c4bSJohannes Berg  *	must be set by driver
44207527a782SJohannes Berg  * @iface_combinations: Valid interface combinations array, should not
44217527a782SJohannes Berg  *	list single interface types.
44227527a782SJohannes Berg  * @n_iface_combinations: number of entries in @iface_combinations array.
44237527a782SJohannes Berg  * @software_iftypes: bitmask of software interface types, these are not
44247527a782SJohannes Berg  *	subject to any restrictions since they are purely managed in SW.
4425abe37c4bSJohannes Berg  * @flags: wiphy flags, see &enum wiphy_flags
4426a2f73b6cSLuis R. Rodriguez  * @regulatory_flags: wiphy regulatory flags, see
4427a2f73b6cSLuis R. Rodriguez  *	&enum ieee80211_regulatory_flags
44281f074bd8SJohannes Berg  * @features: features advertised to nl80211, see &enum nl80211_feature_flags.
4429d75bb06bSGautam Kumar Shukla  * @ext_features: extended features advertised to nl80211, see
4430d75bb06bSGautam Kumar Shukla  *	&enum nl80211_ext_feature_index.
4431abe37c4bSJohannes Berg  * @bss_priv_size: each BSS struct has private data allocated with it,
4432abe37c4bSJohannes Berg  *	this variable determines its size
4433abe37c4bSJohannes Berg  * @max_scan_ssids: maximum number of SSIDs the device can scan for in
4434abe37c4bSJohannes Berg  *	any given scan
4435ca986ad9SArend Van Spriel  * @max_sched_scan_reqs: maximum number of scheduled scan requests that
4436ca986ad9SArend Van Spriel  *	the device can run concurrently.
443793b6aa69SLuciano Coelho  * @max_sched_scan_ssids: maximum number of SSIDs the device can scan
443893b6aa69SLuciano Coelho  *	for in any given scheduled scan
4439a1f1c21cSLuciano Coelho  * @max_match_sets: maximum number of match sets the device can handle
4440a1f1c21cSLuciano Coelho  *	when performing a scheduled scan, 0 if filtering is not
4441a1f1c21cSLuciano Coelho  *	supported.
4442abe37c4bSJohannes Berg  * @max_scan_ie_len: maximum length of user-controlled IEs device can
4443abe37c4bSJohannes Berg  *	add to probe request frames transmitted during a scan, must not
4444abe37c4bSJohannes Berg  *	include fixed IEs like supported rates
44455a865badSLuciano Coelho  * @max_sched_scan_ie_len: same as max_scan_ie_len, but for scheduled
44465a865badSLuciano Coelho  *	scans
44473b06d277SAvraham Stern  * @max_sched_scan_plans: maximum number of scan plans (scan interval and number
44483b06d277SAvraham Stern  *	of iterations) for scheduled scan supported by the device.
44493b06d277SAvraham Stern  * @max_sched_scan_plan_interval: maximum interval (in seconds) for a
44503b06d277SAvraham Stern  *	single scan plan supported by the device.
44513b06d277SAvraham Stern  * @max_sched_scan_plan_iterations: maximum number of iterations for a single
44523b06d277SAvraham Stern  *	scan plan supported by the device.
4453abe37c4bSJohannes Berg  * @coverage_class: current coverage class
4454abe37c4bSJohannes Berg  * @fw_version: firmware version for ethtool reporting
4455abe37c4bSJohannes Berg  * @hw_version: hardware version for ethtool reporting
4456abe37c4bSJohannes Berg  * @max_num_pmkids: maximum number of PMKIDs supported by device
4457abe37c4bSJohannes Berg  * @privid: a pointer that drivers can use to identify if an arbitrary
4458abe37c4bSJohannes Berg  *	wiphy is theirs, e.g. in global notifiers
4459abe37c4bSJohannes Berg  * @bands: information about bands/channels supported by this device
44602e161f78SJohannes Berg  *
44612e161f78SJohannes Berg  * @mgmt_stypes: bitmasks of frame subtypes that can be subscribed to or
44622e161f78SJohannes Berg  *	transmitted through nl80211, points to an array indexed by interface
44632e161f78SJohannes Berg  *	type
4464a7ffac95SBruno Randolf  *
44657f531e03SBruno Randolf  * @available_antennas_tx: bitmap of antennas which are available to be
44667f531e03SBruno Randolf  *	configured as TX antennas. Antenna configuration commands will be
44677f531e03SBruno Randolf  *	rejected unless this or @available_antennas_rx is set.
44687f531e03SBruno Randolf  *
44697f531e03SBruno Randolf  * @available_antennas_rx: bitmap of antennas which are available to be
44707f531e03SBruno Randolf  *	configured as RX antennas. Antenna configuration commands will be
44717f531e03SBruno Randolf  *	rejected unless this or @available_antennas_tx is set.
4472a293911dSJohannes Berg  *
447315f0ebc2SRandy Dunlap  * @probe_resp_offload:
447415f0ebc2SRandy Dunlap  *	 Bitmap of supported protocols for probe response offloading.
447515f0ebc2SRandy Dunlap  *	 See &enum nl80211_probe_resp_offload_support_attr. Only valid
447615f0ebc2SRandy Dunlap  *	 when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set.
447715f0ebc2SRandy Dunlap  *
4478a293911dSJohannes Berg  * @max_remain_on_channel_duration: Maximum time a remain-on-channel operation
4479a293911dSJohannes Berg  *	may request, if implemented.
4480ff1b6e69SJohannes Berg  *
4481ff1b6e69SJohannes Berg  * @wowlan: WoWLAN support information
44826abb9cb9SJohannes Berg  * @wowlan_config: current WoWLAN configuration; this should usually not be
44836abb9cb9SJohannes Berg  *	used since access to it is necessarily racy, use the parameter passed
44846abb9cb9SJohannes Berg  *	to the suspend() operation instead.
4485562a7480SJohannes Berg  *
4486562a7480SJohannes Berg  * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features.
44877e7c8926SBen Greear  * @ht_capa_mod_mask:  Specify what ht_cap values can be over-ridden.
44887e7c8926SBen Greear  *	If null, then none can be over-ridden.
4489ee2aca34SJohannes Berg  * @vht_capa_mod_mask:  Specify what VHT capabilities can be over-ridden.
4490ee2aca34SJohannes Berg  *	If null, then none can be over-ridden.
449177765eafSVasanthakumar Thiagarajan  *
449253873f13SJohannes Berg  * @wdev_list: the list of associated (virtual) interfaces; this list must
449353873f13SJohannes Berg  *	not be modified by the driver, but can be read with RTNL/RCU protection.
449453873f13SJohannes Berg  *
449577765eafSVasanthakumar Thiagarajan  * @max_acl_mac_addrs: Maximum number of MAC addresses that the device
449677765eafSVasanthakumar Thiagarajan  *	supports for ACL.
4497a50df0c4SJohannes Berg  *
4498a50df0c4SJohannes Berg  * @extended_capabilities: extended capabilities supported by the driver,
4499a50df0c4SJohannes Berg  *	additional capabilities might be supported by userspace; these are
4500a50df0c4SJohannes Berg  *	the 802.11 extended capabilities ("Extended Capabilities element")
4501a50df0c4SJohannes Berg  *	and are in the same format as in the information element. See
4502019ae3a9SKanchanapally, Vidyullatha  *	802.11-2012 8.4.2.29 for the defined fields. These are the default
4503019ae3a9SKanchanapally, Vidyullatha  *	extended capabilities to be used if the capabilities are not specified
4504019ae3a9SKanchanapally, Vidyullatha  *	for a specific interface type in iftype_ext_capab.
4505a50df0c4SJohannes Berg  * @extended_capabilities_mask: mask of the valid values
4506a50df0c4SJohannes Berg  * @extended_capabilities_len: length of the extended capabilities
4507019ae3a9SKanchanapally, Vidyullatha  * @iftype_ext_capab: array of extended capabilities per interface type
4508019ae3a9SKanchanapally, Vidyullatha  * @num_iftype_ext_capab: number of interface types for which extended
4509019ae3a9SKanchanapally, Vidyullatha  *	capabilities are specified separately.
4510be29b99aSAmitkumar Karwar  * @coalesce: packet coalescing support information
4511ad7e718cSJohannes Berg  *
4512ad7e718cSJohannes Berg  * @vendor_commands: array of vendor commands supported by the hardware
4513ad7e718cSJohannes Berg  * @n_vendor_commands: number of vendor commands
4514567ffc35SJohannes Berg  * @vendor_events: array of vendor events supported by the hardware
4515567ffc35SJohannes Berg  * @n_vendor_events: number of vendor events
4516b43504cfSJouni Malinen  *
4517b43504cfSJouni Malinen  * @max_ap_assoc_sta: maximum number of associated stations supported in AP mode
4518b43504cfSJouni Malinen  *	(including P2P GO) or 0 to indicate no such limit is advertised. The
4519b43504cfSJouni Malinen  *	driver is allowed to advertise a theoretical limit that it can reach in
4520b43504cfSJouni Malinen  *	some cases, but may not always reach.
4521c2e4323bSLuciano Coelho  *
4522c2e4323bSLuciano Coelho  * @max_num_csa_counters: Number of supported csa_counters in beacons
4523c2e4323bSLuciano Coelho  *	and probe responses.  This value should be set if the driver
4524c2e4323bSLuciano Coelho  *	wishes to limit the number of csa counters. Default (0) means
4525c2e4323bSLuciano Coelho  *	infinite.
452667af9811SEmmanuel Grumbach  * @max_adj_channel_rssi_comp: max offset of between the channel on which the
452767af9811SEmmanuel Grumbach  *	frame was sent and the channel on which the frame was heard for which
452867af9811SEmmanuel Grumbach  *	the reported rssi is still valid. If a driver is able to compensate the
452967af9811SEmmanuel Grumbach  *	low rssi when a frame is heard on different channel, then it should set
453067af9811SEmmanuel Grumbach  *	this variable to the maximal offset for which it can compensate.
453167af9811SEmmanuel Grumbach  *	This value should be set in MHz.
453238de03d2SArend van Spriel  * @bss_select_support: bitmask indicating the BSS selection criteria supported
453338de03d2SArend van Spriel  *	by the driver in the .connect() callback. The bit position maps to the
453438de03d2SArend van Spriel  *	attribute indices defined in &enum nl80211_bss_select_attr.
4535a442b761SAyala Beker  *
45368585989dSLuca Coelho  * @nan_supported_bands: bands supported by the device in NAN mode, a
45378585989dSLuca Coelho  *	bitmap of &enum nl80211_band values.  For instance, for
45388585989dSLuca Coelho  *	NL80211_BAND_2GHZ, bit 0 would be set
45398585989dSLuca Coelho  *	(i.e. BIT(NL80211_BAND_2GHZ)).
4540f3a7ca64SJohannes Berg  *
4541f3a7ca64SJohannes Berg  * @txq_limit: configuration of internal TX queue frame limit
4542f3a7ca64SJohannes Berg  * @txq_memory_limit: configuration internal TX queue memory limit
4543f3a7ca64SJohannes Berg  * @txq_quantum: configuration of internal TX queue scheduler quantum
45449bb7e0f2SJohannes Berg  *
4545213ed579SSara Sharon  * @support_mbssid: can HW support association with nontransmitted AP
4546213ed579SSara Sharon  * @support_only_he_mbssid: don't parse MBSSID elements if it is not
4547213ed579SSara Sharon  *	HE AP, in order to avoid compatibility issues.
4548213ed579SSara Sharon  *	@support_mbssid must be set for this to have any effect.
4549213ed579SSara Sharon  *
45509bb7e0f2SJohannes Berg  * @pmsr_capa: peer measurement capabilities
4551d3236553SJohannes Berg  */
4552d3236553SJohannes Berg struct wiphy {
4553d3236553SJohannes Berg 	/* assign these fields before you register the wiphy */
4554d3236553SJohannes Berg 
4555ef15aac6SJohannes Berg 	/* permanent MAC address(es) */
4556d3236553SJohannes Berg 	u8 perm_addr[ETH_ALEN];
4557ef15aac6SJohannes Berg 	u8 addr_mask[ETH_ALEN];
4558ef15aac6SJohannes Berg 
4559ef15aac6SJohannes Berg 	struct mac_address *addresses;
4560d3236553SJohannes Berg 
45612e161f78SJohannes Berg 	const struct ieee80211_txrx_stypes *mgmt_stypes;
45622e161f78SJohannes Berg 
45637527a782SJohannes Berg 	const struct ieee80211_iface_combination *iface_combinations;
45647527a782SJohannes Berg 	int n_iface_combinations;
45657527a782SJohannes Berg 	u16 software_iftypes;
45667527a782SJohannes Berg 
45672e161f78SJohannes Berg 	u16 n_addresses;
45682e161f78SJohannes Berg 
4569d3236553SJohannes Berg 	/* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
4570d3236553SJohannes Berg 	u16 interface_modes;
4571d3236553SJohannes Berg 
457277765eafSVasanthakumar Thiagarajan 	u16 max_acl_mac_addrs;
457377765eafSVasanthakumar Thiagarajan 
4574a2f73b6cSLuis R. Rodriguez 	u32 flags, regulatory_flags, features;
4575d75bb06bSGautam Kumar Shukla 	u8 ext_features[DIV_ROUND_UP(NUM_NL80211_EXT_FEATURES, 8)];
4576463d0183SJohannes Berg 
4577562a7480SJohannes Berg 	u32 ap_sme_capa;
4578562a7480SJohannes Berg 
4579d3236553SJohannes Berg 	enum cfg80211_signal_type signal_type;
4580d3236553SJohannes Berg 
4581d3236553SJohannes Berg 	int bss_priv_size;
4582d3236553SJohannes Berg 	u8 max_scan_ssids;
4583ca986ad9SArend Van Spriel 	u8 max_sched_scan_reqs;
458493b6aa69SLuciano Coelho 	u8 max_sched_scan_ssids;
4585a1f1c21cSLuciano Coelho 	u8 max_match_sets;
4586d3236553SJohannes Berg 	u16 max_scan_ie_len;
45875a865badSLuciano Coelho 	u16 max_sched_scan_ie_len;
45883b06d277SAvraham Stern 	u32 max_sched_scan_plans;
45893b06d277SAvraham Stern 	u32 max_sched_scan_plan_interval;
45903b06d277SAvraham Stern 	u32 max_sched_scan_plan_iterations;
4591d3236553SJohannes Berg 
4592d3236553SJohannes Berg 	int n_cipher_suites;
4593d3236553SJohannes Berg 	const u32 *cipher_suites;
4594d3236553SJohannes Berg 
4595ab4dfa20SVeerendranath Jakkam 	int n_akm_suites;
4596ab4dfa20SVeerendranath Jakkam 	const u32 *akm_suites;
4597ab4dfa20SVeerendranath Jakkam 
4598b9a5f8caSJouni Malinen 	u8 retry_short;
4599b9a5f8caSJouni Malinen 	u8 retry_long;
4600b9a5f8caSJouni Malinen 	u32 frag_threshold;
4601b9a5f8caSJouni Malinen 	u32 rts_threshold;
460281077e82SLukáš Turek 	u8 coverage_class;
4603b9a5f8caSJouni Malinen 
460481135548SJiri Pirko 	char fw_version[ETHTOOL_FWVERS_LEN];
4605dfce95f5SKalle Valo 	u32 hw_version;
4606dfce95f5SKalle Valo 
4607dfb89c56SJohannes Berg #ifdef CONFIG_PM
4608964dc9e2SJohannes Berg 	const struct wiphy_wowlan_support *wowlan;
46096abb9cb9SJohannes Berg 	struct cfg80211_wowlan *wowlan_config;
4610dfb89c56SJohannes Berg #endif
4611ff1b6e69SJohannes Berg 
4612a293911dSJohannes Berg 	u16 max_remain_on_channel_duration;
4613a293911dSJohannes Berg 
461467fbb16bSSamuel Ortiz 	u8 max_num_pmkids;
461567fbb16bSSamuel Ortiz 
46167f531e03SBruno Randolf 	u32 available_antennas_tx;
46177f531e03SBruno Randolf 	u32 available_antennas_rx;
4618a7ffac95SBruno Randolf 
461987bbbe22SArik Nemtsov 	/*
462087bbbe22SArik Nemtsov 	 * Bitmap of supported protocols for probe response offloading
462187bbbe22SArik Nemtsov 	 * see &enum nl80211_probe_resp_offload_support_attr. Only valid
462287bbbe22SArik Nemtsov 	 * when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set.
462387bbbe22SArik Nemtsov 	 */
462487bbbe22SArik Nemtsov 	u32 probe_resp_offload;
462587bbbe22SArik Nemtsov 
4626a50df0c4SJohannes Berg 	const u8 *extended_capabilities, *extended_capabilities_mask;
4627a50df0c4SJohannes Berg 	u8 extended_capabilities_len;
4628a50df0c4SJohannes Berg 
4629019ae3a9SKanchanapally, Vidyullatha 	const struct wiphy_iftype_ext_capab *iftype_ext_capab;
4630019ae3a9SKanchanapally, Vidyullatha 	unsigned int num_iftype_ext_capab;
4631019ae3a9SKanchanapally, Vidyullatha 
4632d3236553SJohannes Berg 	/* If multiple wiphys are registered and you're handed e.g.
4633d3236553SJohannes Berg 	 * a regular netdev with assigned ieee80211_ptr, you won't
4634d3236553SJohannes Berg 	 * know whether it points to a wiphy your driver has registered
4635d3236553SJohannes Berg 	 * or not. Assign this to something global to your driver to
4636d3236553SJohannes Berg 	 * help determine whether you own this wiphy or not. */
4637cf5aa2f1SDavid Kilroy 	const void *privid;
4638d3236553SJohannes Berg 
463957fbcce3SJohannes Berg 	struct ieee80211_supported_band *bands[NUM_NL80211_BANDS];
4640d3236553SJohannes Berg 
4641d3236553SJohannes Berg 	/* Lets us get back the wiphy on the callback */
46420c0280bdSLuis R. Rodriguez 	void (*reg_notifier)(struct wiphy *wiphy,
4643d3236553SJohannes Berg 			     struct regulatory_request *request);
4644d3236553SJohannes Berg 
4645d3236553SJohannes Berg 	/* fields below are read-only, assigned by cfg80211 */
4646d3236553SJohannes Berg 
4647458f4f9eSJohannes Berg 	const struct ieee80211_regdomain __rcu *regd;
4648d3236553SJohannes Berg 
4649d3236553SJohannes Berg 	/* the item in /sys/class/ieee80211/ points to this,
4650d3236553SJohannes Berg 	 * you need use set_wiphy_dev() (see below) */
4651d3236553SJohannes Berg 	struct device dev;
4652d3236553SJohannes Berg 
4653ecb44335SStanislaw Gruszka 	/* protects ->resume, ->suspend sysfs callbacks against unregister hw */
4654ecb44335SStanislaw Gruszka 	bool registered;
4655ecb44335SStanislaw Gruszka 
4656d3236553SJohannes Berg 	/* dir in debugfs: ieee80211/<wiphyname> */
4657d3236553SJohannes Berg 	struct dentry *debugfsdir;
4658d3236553SJohannes Berg 
46597e7c8926SBen Greear 	const struct ieee80211_ht_cap *ht_capa_mod_mask;
4660ee2aca34SJohannes Berg 	const struct ieee80211_vht_cap *vht_capa_mod_mask;
46617e7c8926SBen Greear 
466253873f13SJohannes Berg 	struct list_head wdev_list;
466353873f13SJohannes Berg 
4664463d0183SJohannes Berg 	/* the network namespace this phy lives in currently */
46650c5c9fb5SEric W. Biederman 	possible_net_t _net;
4666463d0183SJohannes Berg 
46673d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT
46683d23e349SJohannes Berg 	const struct iw_handler_def *wext;
46693d23e349SJohannes Berg #endif
46703d23e349SJohannes Berg 
4671be29b99aSAmitkumar Karwar 	const struct wiphy_coalesce_support *coalesce;
4672be29b99aSAmitkumar Karwar 
4673ad7e718cSJohannes Berg 	const struct wiphy_vendor_command *vendor_commands;
4674567ffc35SJohannes Berg 	const struct nl80211_vendor_cmd_info *vendor_events;
4675567ffc35SJohannes Berg 	int n_vendor_commands, n_vendor_events;
4676ad7e718cSJohannes Berg 
4677b43504cfSJouni Malinen 	u16 max_ap_assoc_sta;
4678b43504cfSJouni Malinen 
46799a774c78SAndrei Otcheretianski 	u8 max_num_csa_counters;
468067af9811SEmmanuel Grumbach 	u8 max_adj_channel_rssi_comp;
46819a774c78SAndrei Otcheretianski 
468238de03d2SArend van Spriel 	u32 bss_select_support;
468338de03d2SArend van Spriel 
46848585989dSLuca Coelho 	u8 nan_supported_bands;
46858585989dSLuca Coelho 
468652539ca8SToke Høiland-Jørgensen 	u32 txq_limit;
468752539ca8SToke Høiland-Jørgensen 	u32 txq_memory_limit;
468852539ca8SToke Høiland-Jørgensen 	u32 txq_quantum;
468952539ca8SToke Høiland-Jørgensen 
4690213ed579SSara Sharon 	u8 support_mbssid:1,
4691213ed579SSara Sharon 	   support_only_he_mbssid:1;
4692213ed579SSara Sharon 
46939bb7e0f2SJohannes Berg 	const struct cfg80211_pmsr_capabilities *pmsr_capa;
46949bb7e0f2SJohannes Berg 
46951c06ef98SJohannes Berg 	char priv[0] __aligned(NETDEV_ALIGN);
4696d3236553SJohannes Berg };
4697d3236553SJohannes Berg 
4698463d0183SJohannes Berg static inline struct net *wiphy_net(struct wiphy *wiphy)
4699463d0183SJohannes Berg {
4700c2d9ba9bSEric Dumazet 	return read_pnet(&wiphy->_net);
4701463d0183SJohannes Berg }
4702463d0183SJohannes Berg 
4703463d0183SJohannes Berg static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net)
4704463d0183SJohannes Berg {
4705c2d9ba9bSEric Dumazet 	write_pnet(&wiphy->_net, net);
4706463d0183SJohannes Berg }
4707463d0183SJohannes Berg 
4708d3236553SJohannes Berg /**
4709d3236553SJohannes Berg  * wiphy_priv - return priv from wiphy
4710d3236553SJohannes Berg  *
4711d3236553SJohannes Berg  * @wiphy: the wiphy whose priv pointer to return
47120ae997dcSYacine Belkadi  * Return: The priv of @wiphy.
4713d3236553SJohannes Berg  */
4714d3236553SJohannes Berg static inline void *wiphy_priv(struct wiphy *wiphy)
4715d3236553SJohannes Berg {
4716d3236553SJohannes Berg 	BUG_ON(!wiphy);
4717d3236553SJohannes Berg 	return &wiphy->priv;
4718d3236553SJohannes Berg }
4719d3236553SJohannes Berg 
4720d3236553SJohannes Berg /**
4721f1f74825SDavid Kilroy  * priv_to_wiphy - return the wiphy containing the priv
4722f1f74825SDavid Kilroy  *
4723f1f74825SDavid Kilroy  * @priv: a pointer previously returned by wiphy_priv
47240ae997dcSYacine Belkadi  * Return: The wiphy of @priv.
4725f1f74825SDavid Kilroy  */
4726f1f74825SDavid Kilroy static inline struct wiphy *priv_to_wiphy(void *priv)
4727f1f74825SDavid Kilroy {
4728f1f74825SDavid Kilroy 	BUG_ON(!priv);
4729f1f74825SDavid Kilroy 	return container_of(priv, struct wiphy, priv);
4730f1f74825SDavid Kilroy }
4731f1f74825SDavid Kilroy 
4732f1f74825SDavid Kilroy /**
4733d3236553SJohannes Berg  * set_wiphy_dev - set device pointer for wiphy
4734d3236553SJohannes Berg  *
4735d3236553SJohannes Berg  * @wiphy: The wiphy whose device to bind
4736d3236553SJohannes Berg  * @dev: The device to parent it to
4737d3236553SJohannes Berg  */
4738d3236553SJohannes Berg static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev)
4739d3236553SJohannes Berg {
4740d3236553SJohannes Berg 	wiphy->dev.parent = dev;
4741d3236553SJohannes Berg }
4742d3236553SJohannes Berg 
4743d3236553SJohannes Berg /**
4744d3236553SJohannes Berg  * wiphy_dev - get wiphy dev pointer
4745d3236553SJohannes Berg  *
4746d3236553SJohannes Berg  * @wiphy: The wiphy whose device struct to look up
47470ae997dcSYacine Belkadi  * Return: The dev of @wiphy.
4748d3236553SJohannes Berg  */
4749d3236553SJohannes Berg static inline struct device *wiphy_dev(struct wiphy *wiphy)
4750d3236553SJohannes Berg {
4751d3236553SJohannes Berg 	return wiphy->dev.parent;
4752d3236553SJohannes Berg }
4753d3236553SJohannes Berg 
4754d3236553SJohannes Berg /**
4755d3236553SJohannes Berg  * wiphy_name - get wiphy name
4756d3236553SJohannes Berg  *
4757d3236553SJohannes Berg  * @wiphy: The wiphy whose name to return
47580ae997dcSYacine Belkadi  * Return: The name of @wiphy.
4759d3236553SJohannes Berg  */
4760e1db74fcSJoe Perches static inline const char *wiphy_name(const struct wiphy *wiphy)
4761d3236553SJohannes Berg {
4762d3236553SJohannes Berg 	return dev_name(&wiphy->dev);
4763d3236553SJohannes Berg }
4764d3236553SJohannes Berg 
4765d3236553SJohannes Berg /**
47661998d90aSBen Greear  * wiphy_new_nm - create a new wiphy for use with cfg80211
47671998d90aSBen Greear  *
47681998d90aSBen Greear  * @ops: The configuration operations for this device
47691998d90aSBen Greear  * @sizeof_priv: The size of the private area to allocate
47701998d90aSBen Greear  * @requested_name: Request a particular name.
47711998d90aSBen Greear  *	NULL is valid value, and means use the default phy%d naming.
47721998d90aSBen Greear  *
47731998d90aSBen Greear  * Create a new wiphy and associate the given operations with it.
47741998d90aSBen Greear  * @sizeof_priv bytes are allocated for private use.
47751998d90aSBen Greear  *
47761998d90aSBen Greear  * Return: A pointer to the new wiphy. This pointer must be
47771998d90aSBen Greear  * assigned to each netdev's ieee80211_ptr for proper operation.
47781998d90aSBen Greear  */
47791998d90aSBen Greear struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv,
47801998d90aSBen Greear 			   const char *requested_name);
47811998d90aSBen Greear 
47821998d90aSBen Greear /**
4783d3236553SJohannes Berg  * wiphy_new - create a new wiphy for use with cfg80211
4784d3236553SJohannes Berg  *
4785d3236553SJohannes Berg  * @ops: The configuration operations for this device
4786d3236553SJohannes Berg  * @sizeof_priv: The size of the private area to allocate
4787d3236553SJohannes Berg  *
4788d3236553SJohannes Berg  * Create a new wiphy and associate the given operations with it.
4789d3236553SJohannes Berg  * @sizeof_priv bytes are allocated for private use.
4790d3236553SJohannes Berg  *
47910ae997dcSYacine Belkadi  * Return: A pointer to the new wiphy. This pointer must be
47920ae997dcSYacine Belkadi  * assigned to each netdev's ieee80211_ptr for proper operation.
4793d3236553SJohannes Berg  */
47941998d90aSBen Greear static inline struct wiphy *wiphy_new(const struct cfg80211_ops *ops,
47951998d90aSBen Greear 				      int sizeof_priv)
47961998d90aSBen Greear {
47971998d90aSBen Greear 	return wiphy_new_nm(ops, sizeof_priv, NULL);
47981998d90aSBen Greear }
4799d3236553SJohannes Berg 
4800d3236553SJohannes Berg /**
4801d3236553SJohannes Berg  * wiphy_register - register a wiphy with cfg80211
4802d3236553SJohannes Berg  *
4803d3236553SJohannes Berg  * @wiphy: The wiphy to register.
4804d3236553SJohannes Berg  *
48050ae997dcSYacine Belkadi  * Return: A non-negative wiphy index or a negative error code.
4806d3236553SJohannes Berg  */
480710dd9b7cSJoe Perches int wiphy_register(struct wiphy *wiphy);
4808d3236553SJohannes Berg 
4809d3236553SJohannes Berg /**
4810d3236553SJohannes Berg  * wiphy_unregister - deregister a wiphy from cfg80211
4811d3236553SJohannes Berg  *
4812d3236553SJohannes Berg  * @wiphy: The wiphy to unregister.
4813d3236553SJohannes Berg  *
4814d3236553SJohannes Berg  * After this call, no more requests can be made with this priv
4815d3236553SJohannes Berg  * pointer, but the call may sleep to wait for an outstanding
4816d3236553SJohannes Berg  * request that is being handled.
4817d3236553SJohannes Berg  */
481810dd9b7cSJoe Perches void wiphy_unregister(struct wiphy *wiphy);
4819d3236553SJohannes Berg 
4820d3236553SJohannes Berg /**
4821d3236553SJohannes Berg  * wiphy_free - free wiphy
4822d3236553SJohannes Berg  *
4823d3236553SJohannes Berg  * @wiphy: The wiphy to free
4824d3236553SJohannes Berg  */
482510dd9b7cSJoe Perches void wiphy_free(struct wiphy *wiphy);
4826d3236553SJohannes Berg 
4827fffd0934SJohannes Berg /* internal structs */
48286829c878SJohannes Berg struct cfg80211_conn;
482919957bb3SJohannes Berg struct cfg80211_internal_bss;
4830fffd0934SJohannes Berg struct cfg80211_cached_keys;
48314a4b8169SAndrew Zaborowski struct cfg80211_cqm_config;
483219957bb3SJohannes Berg 
4833d3236553SJohannes Berg /**
483489a54e48SJohannes Berg  * struct wireless_dev - wireless device state
4835d3236553SJohannes Berg  *
483689a54e48SJohannes Berg  * For netdevs, this structure must be allocated by the driver
483789a54e48SJohannes Berg  * that uses the ieee80211_ptr field in struct net_device (this
483889a54e48SJohannes Berg  * is intentional so it can be allocated along with the netdev.)
483989a54e48SJohannes Berg  * It need not be registered then as netdev registration will
484089a54e48SJohannes Berg  * be intercepted by cfg80211 to see the new wireless device.
484189a54e48SJohannes Berg  *
484289a54e48SJohannes Berg  * For non-netdev uses, it must also be allocated by the driver
484389a54e48SJohannes Berg  * in response to the cfg80211 callbacks that require it, as
484489a54e48SJohannes Berg  * there's no netdev registration in that case it may not be
484589a54e48SJohannes Berg  * allocated outside of callback operations that return it.
4846d3236553SJohannes Berg  *
4847d3236553SJohannes Berg  * @wiphy: pointer to hardware description
4848d3236553SJohannes Berg  * @iftype: interface type
4849d3236553SJohannes Berg  * @list: (private) Used to collect the interfaces
485089a54e48SJohannes Berg  * @netdev: (private) Used to reference back to the netdev, may be %NULL
485189a54e48SJohannes Berg  * @identifier: (private) Identifier used in nl80211 to identify this
485289a54e48SJohannes Berg  *	wireless device if it has no netdev
4853d3236553SJohannes Berg  * @current_bss: (private) Used by the internal configuration code
48549e0e2961SMichal Kazior  * @chandef: (private) Used by the internal configuration code to track
48559e0e2961SMichal Kazior  *	the user-set channel definition.
4856780b40dfSJohannes Berg  * @preset_chandef: (private) Used by the internal configuration code to
4857aa430da4SJohannes Berg  *	track the channel to be used for AP later
4858d3236553SJohannes Berg  * @bssid: (private) Used by the internal configuration code
4859d3236553SJohannes Berg  * @ssid: (private) Used by the internal configuration code
4860d3236553SJohannes Berg  * @ssid_len: (private) Used by the internal configuration code
486129cbe68cSJohannes Berg  * @mesh_id_len: (private) Used by the internal configuration code
486229cbe68cSJohannes Berg  * @mesh_id_up_len: (private) Used by the internal configuration code
4863d3236553SJohannes Berg  * @wext: (private) Used by the internal wireless extensions compat code
48649874b71fSJohannes Berg  * @wext.ibss: (private) IBSS data part of wext handling
48659874b71fSJohannes Berg  * @wext.connect: (private) connection handling data
48669874b71fSJohannes Berg  * @wext.keys: (private) (WEP) key data
48679874b71fSJohannes Berg  * @wext.ie: (private) extra elements for association
48689874b71fSJohannes Berg  * @wext.ie_len: (private) length of extra elements
48699874b71fSJohannes Berg  * @wext.bssid: (private) selected network BSSID
48709874b71fSJohannes Berg  * @wext.ssid: (private) selected network SSID
48719874b71fSJohannes Berg  * @wext.default_key: (private) selected default key index
48729874b71fSJohannes Berg  * @wext.default_mgmt_key: (private) selected default management key index
48739874b71fSJohannes Berg  * @wext.prev_bssid: (private) previous BSSID for reassociation
48749874b71fSJohannes Berg  * @wext.prev_bssid_valid: (private) previous BSSID validity
48759bc383deSJohannes Berg  * @use_4addr: indicates 4addr mode is used on this interface, must be
48769bc383deSJohannes Berg  *	set by driver (if supported) on add_interface BEFORE registering the
48779bc383deSJohannes Berg  *	netdev and may otherwise be used by driver read-only, will be update
48789bc383deSJohannes Berg  *	by cfg80211 on change_interface
48792e161f78SJohannes Berg  * @mgmt_registrations: list of registrations for management frames
48802e161f78SJohannes Berg  * @mgmt_registrations_lock: lock for the list
48818d61ffa5SJohannes Berg  * @mtx: mutex used to lock data in this struct, may be used by drivers
48828d61ffa5SJohannes Berg  *	and some API functions require it held
488356d1893dSJohannes Berg  * @beacon_interval: beacon interval used on this device for transmitting
488456d1893dSJohannes Berg  *	beacons, 0 when not valid
488598104fdeSJohannes Berg  * @address: The address for this device, valid only if @netdev is %NULL
488673c7da3dSArend Van Spriel  * @is_running: true if this is a non-netdev device that has been started, e.g.
488773c7da3dSArend Van Spriel  *	the P2P Device.
488804f39047SSimon Wunderlich  * @cac_started: true if DFS channel availability check has been started
488904f39047SSimon Wunderlich  * @cac_start_time: timestamp (jiffies) when the dfs state was entered.
489031559f35SJanusz Dziedzic  * @cac_time_ms: CAC time in ms
4891780b40dfSJohannes Berg  * @ps: powersave mode is enabled
4892780b40dfSJohannes Berg  * @ps_timeout: dynamic powersave timeout
4893780b40dfSJohannes Berg  * @ap_unexpected_nlportid: (private) netlink port ID of application
4894780b40dfSJohannes Berg  *	registered for unexpected class 3 frames (AP mode)
4895780b40dfSJohannes Berg  * @conn: (private) cfg80211 software SME connection state machine data
4896780b40dfSJohannes Berg  * @connect_keys: (private) keys to set after connection is established
489734d50519SLior David  * @conn_bss_type: connecting/connected BSS type
4898bd2522b1SAndrzej Zaborowski  * @conn_owner_nlportid: (private) connection owner socket port ID
4899bd2522b1SAndrzej Zaborowski  * @disconnect_wk: (private) auto-disconnect work
4900bd2522b1SAndrzej Zaborowski  * @disconnect_bssid: (private) the BSSID to use for auto-disconnect
4901780b40dfSJohannes Berg  * @ibss_fixed: (private) IBSS is using fixed BSSID
49025336fa88SSimon Wunderlich  * @ibss_dfs_possible: (private) IBSS may change to a DFS channel
4903780b40dfSJohannes Berg  * @event_list: (private) list for internal event processing
4904780b40dfSJohannes Berg  * @event_lock: (private) lock for event list
490578f22b6aSJohannes Berg  * @owner_nlportid: (private) owner socket port ID
4906ab81007aSJohannes Berg  * @nl_owner_dead: (private) owner socket went away
49074a4b8169SAndrew Zaborowski  * @cqm_config: (private) nl80211 RSSI monitor state
49089bb7e0f2SJohannes Berg  * @pmsr_list: (private) peer measurement requests
49099bb7e0f2SJohannes Berg  * @pmsr_lock: (private) peer measurements requests/results lock
49109bb7e0f2SJohannes Berg  * @pmsr_free_wk: (private) peer measurements cleanup work
4911d3236553SJohannes Berg  */
4912d3236553SJohannes Berg struct wireless_dev {
4913d3236553SJohannes Berg 	struct wiphy *wiphy;
4914d3236553SJohannes Berg 	enum nl80211_iftype iftype;
4915d3236553SJohannes Berg 
4916667503ddSJohannes Berg 	/* the remainder of this struct should be private to cfg80211 */
4917d3236553SJohannes Berg 	struct list_head list;
4918d3236553SJohannes Berg 	struct net_device *netdev;
4919d3236553SJohannes Berg 
492089a54e48SJohannes Berg 	u32 identifier;
492189a54e48SJohannes Berg 
49222e161f78SJohannes Berg 	struct list_head mgmt_registrations;
49232e161f78SJohannes Berg 	spinlock_t mgmt_registrations_lock;
4924026331c4SJouni Malinen 
4925667503ddSJohannes Berg 	struct mutex mtx;
4926667503ddSJohannes Berg 
492773c7da3dSArend Van Spriel 	bool use_4addr, is_running;
492898104fdeSJohannes Berg 
492998104fdeSJohannes Berg 	u8 address[ETH_ALEN] __aligned(sizeof(u16));
49309bc383deSJohannes Berg 
4931b23aa676SSamuel Ortiz 	/* currently used for IBSS and SME - might be rearranged later */
4932d3236553SJohannes Berg 	u8 ssid[IEEE80211_MAX_SSID_LEN];
493329cbe68cSJohannes Berg 	u8 ssid_len, mesh_id_len, mesh_id_up_len;
49346829c878SJohannes Berg 	struct cfg80211_conn *conn;
4935fffd0934SJohannes Berg 	struct cfg80211_cached_keys *connect_keys;
493634d50519SLior David 	enum ieee80211_bss_type conn_bss_type;
4937bd2522b1SAndrzej Zaborowski 	u32 conn_owner_nlportid;
4938bd2522b1SAndrzej Zaborowski 
4939bd2522b1SAndrzej Zaborowski 	struct work_struct disconnect_wk;
4940bd2522b1SAndrzej Zaborowski 	u8 disconnect_bssid[ETH_ALEN];
4941d3236553SJohannes Berg 
4942667503ddSJohannes Berg 	struct list_head event_list;
4943667503ddSJohannes Berg 	spinlock_t event_lock;
4944667503ddSJohannes Berg 
494519957bb3SJohannes Berg 	struct cfg80211_internal_bss *current_bss; /* associated / joined */
4946683b6d3bSJohannes Berg 	struct cfg80211_chan_def preset_chandef;
49479e0e2961SMichal Kazior 	struct cfg80211_chan_def chandef;
4948f4489ebeSMichal Kazior 
4949c30a3d38SMichal Kazior 	bool ibss_fixed;
49505336fa88SSimon Wunderlich 	bool ibss_dfs_possible;
4951c30a3d38SMichal Kazior 
4952ffb9eb3dSKalle Valo 	bool ps;
4953ffb9eb3dSKalle Valo 	int ps_timeout;
4954ffb9eb3dSKalle Valo 
495556d1893dSJohannes Berg 	int beacon_interval;
495656d1893dSJohannes Berg 
495715e47304SEric W. Biederman 	u32 ap_unexpected_nlportid;
495828946da7SJohannes Berg 
4959ab81007aSJohannes Berg 	u32 owner_nlportid;
4960ab81007aSJohannes Berg 	bool nl_owner_dead;
4961ab81007aSJohannes Berg 
496204f39047SSimon Wunderlich 	bool cac_started;
496304f39047SSimon Wunderlich 	unsigned long cac_start_time;
496431559f35SJanusz Dziedzic 	unsigned int cac_time_ms;
496504f39047SSimon Wunderlich 
49663d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT
4967d3236553SJohannes Berg 	/* wext data */
4968cbe8fa9cSJohannes Berg 	struct {
4969cbe8fa9cSJohannes Berg 		struct cfg80211_ibss_params ibss;
4970f2129354SJohannes Berg 		struct cfg80211_connect_params connect;
4971fffd0934SJohannes Berg 		struct cfg80211_cached_keys *keys;
4972c1e5f471SJohannes Berg 		const u8 *ie;
4973f2129354SJohannes Berg 		size_t ie_len;
49749874b71fSJohannes Berg 		u8 bssid[ETH_ALEN];
49759874b71fSJohannes Berg 		u8 prev_bssid[ETH_ALEN];
4976f2129354SJohannes Berg 		u8 ssid[IEEE80211_MAX_SSID_LEN];
497708645126SJohannes Berg 		s8 default_key, default_mgmt_key;
4978ffb9eb3dSKalle Valo 		bool prev_bssid_valid;
4979cbe8fa9cSJohannes Berg 	} wext;
4980d3236553SJohannes Berg #endif
49814a4b8169SAndrew Zaborowski 
49824a4b8169SAndrew Zaborowski 	struct cfg80211_cqm_config *cqm_config;
49839bb7e0f2SJohannes Berg 
49849bb7e0f2SJohannes Berg 	struct list_head pmsr_list;
49859bb7e0f2SJohannes Berg 	spinlock_t pmsr_lock;
49869bb7e0f2SJohannes Berg 	struct work_struct pmsr_free_wk;
4987d3236553SJohannes Berg };
4988d3236553SJohannes Berg 
498998104fdeSJohannes Berg static inline u8 *wdev_address(struct wireless_dev *wdev)
499098104fdeSJohannes Berg {
499198104fdeSJohannes Berg 	if (wdev->netdev)
499298104fdeSJohannes Berg 		return wdev->netdev->dev_addr;
499398104fdeSJohannes Berg 	return wdev->address;
499498104fdeSJohannes Berg }
499598104fdeSJohannes Berg 
499673c7da3dSArend Van Spriel static inline bool wdev_running(struct wireless_dev *wdev)
499773c7da3dSArend Van Spriel {
499873c7da3dSArend Van Spriel 	if (wdev->netdev)
499973c7da3dSArend Van Spriel 		return netif_running(wdev->netdev);
500073c7da3dSArend Van Spriel 	return wdev->is_running;
500173c7da3dSArend Van Spriel }
500273c7da3dSArend Van Spriel 
5003d3236553SJohannes Berg /**
5004d3236553SJohannes Berg  * wdev_priv - return wiphy priv from wireless_dev
5005d3236553SJohannes Berg  *
5006d3236553SJohannes Berg  * @wdev: The wireless device whose wiphy's priv pointer to return
50070ae997dcSYacine Belkadi  * Return: The wiphy priv of @wdev.
5008d3236553SJohannes Berg  */
5009d3236553SJohannes Berg static inline void *wdev_priv(struct wireless_dev *wdev)
5010d3236553SJohannes Berg {
5011d3236553SJohannes Berg 	BUG_ON(!wdev);
5012d3236553SJohannes Berg 	return wiphy_priv(wdev->wiphy);
5013d3236553SJohannes Berg }
5014d3236553SJohannes Berg 
5015d70e9693SJohannes Berg /**
5016d70e9693SJohannes Berg  * DOC: Utility functions
5017d70e9693SJohannes Berg  *
5018d70e9693SJohannes Berg  * cfg80211 offers a number of utility functions that can be useful.
5019d3236553SJohannes Berg  */
5020d3236553SJohannes Berg 
5021d3236553SJohannes Berg /**
5022d3236553SJohannes Berg  * ieee80211_channel_to_frequency - convert channel number to frequency
5023abe37c4bSJohannes Berg  * @chan: channel number
502459eb21a6SBruno Randolf  * @band: band, necessary due to channel number overlap
50250ae997dcSYacine Belkadi  * Return: The corresponding frequency (in MHz), or 0 if the conversion failed.
5026d3236553SJohannes Berg  */
502757fbcce3SJohannes Berg int ieee80211_channel_to_frequency(int chan, enum nl80211_band band);
5028d3236553SJohannes Berg 
5029d3236553SJohannes Berg /**
5030d3236553SJohannes Berg  * ieee80211_frequency_to_channel - convert frequency to channel number
5031abe37c4bSJohannes Berg  * @freq: center frequency
50320ae997dcSYacine Belkadi  * Return: The corresponding channel, or 0 if the conversion failed.
5033d3236553SJohannes Berg  */
503410dd9b7cSJoe Perches int ieee80211_frequency_to_channel(int freq);
5035d3236553SJohannes Berg 
5036d3236553SJohannes Berg /**
5037d3236553SJohannes Berg  * ieee80211_get_channel - get channel struct from wiphy for specified frequency
5038543b921bSArend Van Spriel  *
5039abe37c4bSJohannes Berg  * @wiphy: the struct wiphy to get the channel for
5040abe37c4bSJohannes Berg  * @freq: the center frequency of the channel
5041543b921bSArend Van Spriel  *
50420ae997dcSYacine Belkadi  * Return: The channel struct from @wiphy at @freq.
5043d3236553SJohannes Berg  */
5044543b921bSArend Van Spriel struct ieee80211_channel *ieee80211_get_channel(struct wiphy *wiphy, int freq);
5045d3236553SJohannes Berg 
5046d3236553SJohannes Berg /**
5047d3236553SJohannes Berg  * ieee80211_get_response_rate - get basic rate for a given rate
5048d3236553SJohannes Berg  *
5049d3236553SJohannes Berg  * @sband: the band to look for rates in
5050d3236553SJohannes Berg  * @basic_rates: bitmap of basic rates
5051d3236553SJohannes Berg  * @bitrate: the bitrate for which to find the basic rate
5052d3236553SJohannes Berg  *
50530ae997dcSYacine Belkadi  * Return: The basic rate corresponding to a given bitrate, that
50540ae997dcSYacine Belkadi  * is the next lower bitrate contained in the basic rate map,
50550ae997dcSYacine Belkadi  * which is, for this function, given as a bitmap of indices of
50560ae997dcSYacine Belkadi  * rates in the band's bitrate table.
5057d3236553SJohannes Berg  */
5058d3236553SJohannes Berg struct ieee80211_rate *
5059d3236553SJohannes Berg ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
5060d3236553SJohannes Berg 			    u32 basic_rates, int bitrate);
5061d3236553SJohannes Berg 
5062b422c6cdSAshok Nagarajan /**
5063b422c6cdSAshok Nagarajan  * ieee80211_mandatory_rates - get mandatory rates for a given band
5064b422c6cdSAshok Nagarajan  * @sband: the band to look for rates in
506574608acaSSimon Wunderlich  * @scan_width: width of the control channel
5066b422c6cdSAshok Nagarajan  *
5067b422c6cdSAshok Nagarajan  * This function returns a bitmap of the mandatory rates for the given
5068b422c6cdSAshok Nagarajan  * band, bits are set according to the rate position in the bitrates array.
5069b422c6cdSAshok Nagarajan  */
507074608acaSSimon Wunderlich u32 ieee80211_mandatory_rates(struct ieee80211_supported_band *sband,
507174608acaSSimon Wunderlich 			      enum nl80211_bss_scan_width scan_width);
5072b422c6cdSAshok Nagarajan 
5073d3236553SJohannes Berg /*
5074d3236553SJohannes Berg  * Radiotap parsing functions -- for controlled injection support
5075d3236553SJohannes Berg  *
5076d3236553SJohannes Berg  * Implemented in net/wireless/radiotap.c
5077d3236553SJohannes Berg  * Documentation in Documentation/networking/radiotap-headers.txt
5078d3236553SJohannes Berg  */
5079d3236553SJohannes Berg 
508033e5a2f7SJohannes Berg struct radiotap_align_size {
508133e5a2f7SJohannes Berg 	uint8_t align:4, size:4;
508233e5a2f7SJohannes Berg };
508333e5a2f7SJohannes Berg 
508433e5a2f7SJohannes Berg struct ieee80211_radiotap_namespace {
508533e5a2f7SJohannes Berg 	const struct radiotap_align_size *align_size;
508633e5a2f7SJohannes Berg 	int n_bits;
508733e5a2f7SJohannes Berg 	uint32_t oui;
508833e5a2f7SJohannes Berg 	uint8_t subns;
508933e5a2f7SJohannes Berg };
509033e5a2f7SJohannes Berg 
509133e5a2f7SJohannes Berg struct ieee80211_radiotap_vendor_namespaces {
509233e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_namespace *ns;
509333e5a2f7SJohannes Berg 	int n_ns;
509433e5a2f7SJohannes Berg };
509533e5a2f7SJohannes Berg 
5096d3236553SJohannes Berg /**
5097d3236553SJohannes Berg  * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args
509833e5a2f7SJohannes Berg  * @this_arg_index: index of current arg, valid after each successful call
509933e5a2f7SJohannes Berg  *	to ieee80211_radiotap_iterator_next()
510033e5a2f7SJohannes Berg  * @this_arg: pointer to current radiotap arg; it is valid after each
510133e5a2f7SJohannes Berg  *	call to ieee80211_radiotap_iterator_next() but also after
510233e5a2f7SJohannes Berg  *	ieee80211_radiotap_iterator_init() where it will point to
510333e5a2f7SJohannes Berg  *	the beginning of the actual data portion
510433e5a2f7SJohannes Berg  * @this_arg_size: length of the current arg, for convenience
510533e5a2f7SJohannes Berg  * @current_namespace: pointer to the current namespace definition
510633e5a2f7SJohannes Berg  *	(or internally %NULL if the current namespace is unknown)
510733e5a2f7SJohannes Berg  * @is_radiotap_ns: indicates whether the current namespace is the default
510833e5a2f7SJohannes Berg  *	radiotap namespace or not
510933e5a2f7SJohannes Berg  *
511033e5a2f7SJohannes Berg  * @_rtheader: pointer to the radiotap header we are walking through
511133e5a2f7SJohannes Berg  * @_max_length: length of radiotap header in cpu byte ordering
511233e5a2f7SJohannes Berg  * @_arg_index: next argument index
511333e5a2f7SJohannes Berg  * @_arg: next argument pointer
511433e5a2f7SJohannes Berg  * @_next_bitmap: internal pointer to next present u32
511533e5a2f7SJohannes Berg  * @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present
511633e5a2f7SJohannes Berg  * @_vns: vendor namespace definitions
511733e5a2f7SJohannes Berg  * @_next_ns_data: beginning of the next namespace's data
511833e5a2f7SJohannes Berg  * @_reset_on_ext: internal; reset the arg index to 0 when going to the
511933e5a2f7SJohannes Berg  *	next bitmap word
512033e5a2f7SJohannes Berg  *
512133e5a2f7SJohannes Berg  * Describes the radiotap parser state. Fields prefixed with an underscore
512233e5a2f7SJohannes Berg  * must not be used by users of the parser, only by the parser internally.
5123d3236553SJohannes Berg  */
5124d3236553SJohannes Berg 
5125d3236553SJohannes Berg struct ieee80211_radiotap_iterator {
512633e5a2f7SJohannes Berg 	struct ieee80211_radiotap_header *_rtheader;
512733e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_vendor_namespaces *_vns;
512833e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_namespace *current_namespace;
5129d3236553SJohannes Berg 
513033e5a2f7SJohannes Berg 	unsigned char *_arg, *_next_ns_data;
513167272440SJohannes Berg 	__le32 *_next_bitmap;
513233e5a2f7SJohannes Berg 
513333e5a2f7SJohannes Berg 	unsigned char *this_arg;
513433e5a2f7SJohannes Berg 	int this_arg_index;
513533e5a2f7SJohannes Berg 	int this_arg_size;
513633e5a2f7SJohannes Berg 
513733e5a2f7SJohannes Berg 	int is_radiotap_ns;
513833e5a2f7SJohannes Berg 
513933e5a2f7SJohannes Berg 	int _max_length;
514033e5a2f7SJohannes Berg 	int _arg_index;
514133e5a2f7SJohannes Berg 	uint32_t _bitmap_shifter;
514233e5a2f7SJohannes Berg 	int _reset_on_ext;
5143d3236553SJohannes Berg };
5144d3236553SJohannes Berg 
514510dd9b7cSJoe Perches int
514610dd9b7cSJoe Perches ieee80211_radiotap_iterator_init(struct ieee80211_radiotap_iterator *iterator,
5147d3236553SJohannes Berg 				 struct ieee80211_radiotap_header *radiotap_header,
514810dd9b7cSJoe Perches 				 int max_length,
514910dd9b7cSJoe Perches 				 const struct ieee80211_radiotap_vendor_namespaces *vns);
5150d3236553SJohannes Berg 
515110dd9b7cSJoe Perches int
515210dd9b7cSJoe Perches ieee80211_radiotap_iterator_next(struct ieee80211_radiotap_iterator *iterator);
5153d3236553SJohannes Berg 
515433e5a2f7SJohannes Berg 
5155e31a16d6SZhu Yi extern const unsigned char rfc1042_header[6];
5156e31a16d6SZhu Yi extern const unsigned char bridge_tunnel_header[6];
5157e31a16d6SZhu Yi 
5158e31a16d6SZhu Yi /**
5159e31a16d6SZhu Yi  * ieee80211_get_hdrlen_from_skb - get header length from data
5160e31a16d6SZhu Yi  *
5161e31a16d6SZhu Yi  * @skb: the frame
51620ae997dcSYacine Belkadi  *
51630ae997dcSYacine Belkadi  * Given an skb with a raw 802.11 header at the data pointer this function
51640ae997dcSYacine Belkadi  * returns the 802.11 header length.
51650ae997dcSYacine Belkadi  *
51660ae997dcSYacine Belkadi  * Return: The 802.11 header length in bytes (not including encryption
51670ae997dcSYacine Belkadi  * headers). Or 0 if the data in the sk_buff is too short to contain a valid
51680ae997dcSYacine Belkadi  * 802.11 header.
5169e31a16d6SZhu Yi  */
5170e31a16d6SZhu Yi unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb);
5171e31a16d6SZhu Yi 
5172e31a16d6SZhu Yi /**
5173e31a16d6SZhu Yi  * ieee80211_hdrlen - get header length in bytes from frame control
5174e31a16d6SZhu Yi  * @fc: frame control field in little-endian format
51750ae997dcSYacine Belkadi  * Return: The header length in bytes.
5176e31a16d6SZhu Yi  */
5177633adf1aSJohannes Berg unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc);
5178e31a16d6SZhu Yi 
5179e31a16d6SZhu Yi /**
51809b395bc3SJohannes Berg  * ieee80211_get_mesh_hdrlen - get mesh extension header length
51819b395bc3SJohannes Berg  * @meshhdr: the mesh extension header, only the flags field
51829b395bc3SJohannes Berg  *	(first byte) will be accessed
51830ae997dcSYacine Belkadi  * Return: The length of the extension header, which is always at
51849b395bc3SJohannes Berg  * least 6 bytes and at most 18 if address 5 and 6 are present.
51859b395bc3SJohannes Berg  */
51869b395bc3SJohannes Berg unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr);
51879b395bc3SJohannes Berg 
51889b395bc3SJohannes Berg /**
5189d70e9693SJohannes Berg  * DOC: Data path helpers
5190d70e9693SJohannes Berg  *
5191d70e9693SJohannes Berg  * In addition to generic utilities, cfg80211 also offers
5192d70e9693SJohannes Berg  * functions that help implement the data path for devices
5193d70e9693SJohannes Berg  * that do not do the 802.11/802.3 conversion on the device.
5194d70e9693SJohannes Berg  */
5195d70e9693SJohannes Berg 
5196d70e9693SJohannes Berg /**
51977f6990c8SJohannes Berg  * ieee80211_data_to_8023_exthdr - convert an 802.11 data frame to 802.3
51987f6990c8SJohannes Berg  * @skb: the 802.11 data frame
51997f6990c8SJohannes Berg  * @ehdr: pointer to a &struct ethhdr that will get the header, instead
52007f6990c8SJohannes Berg  *	of it being pushed into the SKB
52017f6990c8SJohannes Berg  * @addr: the device MAC address
52027f6990c8SJohannes Berg  * @iftype: the virtual interface type
520324bba078SFelix Fietkau  * @data_offset: offset of payload after the 802.11 header
52047f6990c8SJohannes Berg  * Return: 0 on success. Non-zero on error.
52057f6990c8SJohannes Berg  */
52067f6990c8SJohannes Berg int ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr,
520724bba078SFelix Fietkau 				  const u8 *addr, enum nl80211_iftype iftype,
520824bba078SFelix Fietkau 				  u8 data_offset);
52097f6990c8SJohannes Berg 
52107f6990c8SJohannes Berg /**
5211e31a16d6SZhu Yi  * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3
5212e31a16d6SZhu Yi  * @skb: the 802.11 data frame
5213e31a16d6SZhu Yi  * @addr: the device MAC address
5214e31a16d6SZhu Yi  * @iftype: the virtual interface type
52150ae997dcSYacine Belkadi  * Return: 0 on success. Non-zero on error.
5216e31a16d6SZhu Yi  */
52177f6990c8SJohannes Berg static inline int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
52187f6990c8SJohannes Berg 					 enum nl80211_iftype iftype)
52197f6990c8SJohannes Berg {
522024bba078SFelix Fietkau 	return ieee80211_data_to_8023_exthdr(skb, NULL, addr, iftype, 0);
52217f6990c8SJohannes Berg }
5222e31a16d6SZhu Yi 
5223e31a16d6SZhu Yi /**
5224eaf85ca7SZhu Yi  * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame
5225eaf85ca7SZhu Yi  *
52267f6990c8SJohannes Berg  * Decode an IEEE 802.11 A-MSDU and convert it to a list of 802.3 frames.
52277f6990c8SJohannes Berg  * The @list will be empty if the decode fails. The @skb must be fully
52287f6990c8SJohannes Berg  * header-less before being passed in here; it is freed in this function.
5229eaf85ca7SZhu Yi  *
52307f6990c8SJohannes Berg  * @skb: The input A-MSDU frame without any headers.
5231eaf85ca7SZhu Yi  * @list: The output list of 802.3 frames. It must be allocated and
5232eaf85ca7SZhu Yi  *	initialized by by the caller.
5233eaf85ca7SZhu Yi  * @addr: The device MAC address.
5234eaf85ca7SZhu Yi  * @iftype: The device interface type.
5235eaf85ca7SZhu Yi  * @extra_headroom: The hardware extra headroom for SKBs in the @list.
52368b935ee2SJohannes Berg  * @check_da: DA to check in the inner ethernet header, or NULL
52378b935ee2SJohannes Berg  * @check_sa: SA to check in the inner ethernet header, or NULL
5238eaf85ca7SZhu Yi  */
5239eaf85ca7SZhu Yi void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,
5240eaf85ca7SZhu Yi 			      const u8 *addr, enum nl80211_iftype iftype,
52418b3becadSYogesh Ashok Powar 			      const unsigned int extra_headroom,
52428b935ee2SJohannes Berg 			      const u8 *check_da, const u8 *check_sa);
5243eaf85ca7SZhu Yi 
5244eaf85ca7SZhu Yi /**
5245e31a16d6SZhu Yi  * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame
5246e31a16d6SZhu Yi  * @skb: the data frame
5247fa9ffc74SKyeyoon Park  * @qos_map: Interworking QoS mapping or %NULL if not in use
52480ae997dcSYacine Belkadi  * Return: The 802.1p/1d tag.
5249e31a16d6SZhu Yi  */
5250fa9ffc74SKyeyoon Park unsigned int cfg80211_classify8021d(struct sk_buff *skb,
5251fa9ffc74SKyeyoon Park 				    struct cfg80211_qos_map *qos_map);
5252e31a16d6SZhu Yi 
5253c21dbf92SJohannes Berg /**
525449a68e0dSJohannes Berg  * cfg80211_find_elem_match - match information element and byte array in data
525549a68e0dSJohannes Berg  *
525649a68e0dSJohannes Berg  * @eid: element ID
525749a68e0dSJohannes Berg  * @ies: data consisting of IEs
525849a68e0dSJohannes Berg  * @len: length of data
525949a68e0dSJohannes Berg  * @match: byte array to match
526049a68e0dSJohannes Berg  * @match_len: number of bytes in the match array
526149a68e0dSJohannes Berg  * @match_offset: offset in the IE data where the byte array should match.
526249a68e0dSJohannes Berg  *	Note the difference to cfg80211_find_ie_match() which considers
526349a68e0dSJohannes Berg  *	the offset to start from the element ID byte, but here we take
526449a68e0dSJohannes Berg  *	the data portion instead.
526549a68e0dSJohannes Berg  *
526649a68e0dSJohannes Berg  * Return: %NULL if the element ID could not be found or if
526749a68e0dSJohannes Berg  * the element is invalid (claims to be longer than the given
526849a68e0dSJohannes Berg  * data) or if the byte array doesn't match; otherwise return the
526949a68e0dSJohannes Berg  * requested element struct.
527049a68e0dSJohannes Berg  *
527149a68e0dSJohannes Berg  * Note: There are no checks on the element length other than
527249a68e0dSJohannes Berg  * having to fit into the given data and being large enough for the
527349a68e0dSJohannes Berg  * byte array to match.
527449a68e0dSJohannes Berg  */
527549a68e0dSJohannes Berg const struct element *
527649a68e0dSJohannes Berg cfg80211_find_elem_match(u8 eid, const u8 *ies, unsigned int len,
527749a68e0dSJohannes Berg 			 const u8 *match, unsigned int match_len,
527849a68e0dSJohannes Berg 			 unsigned int match_offset);
527949a68e0dSJohannes Berg 
528049a68e0dSJohannes Berg /**
5281fbd05e4aSLuca Coelho  * cfg80211_find_ie_match - match information element and byte array in data
5282fbd05e4aSLuca Coelho  *
5283fbd05e4aSLuca Coelho  * @eid: element ID
5284fbd05e4aSLuca Coelho  * @ies: data consisting of IEs
5285fbd05e4aSLuca Coelho  * @len: length of data
5286fbd05e4aSLuca Coelho  * @match: byte array to match
5287fbd05e4aSLuca Coelho  * @match_len: number of bytes in the match array
5288fbd05e4aSLuca Coelho  * @match_offset: offset in the IE where the byte array should match.
5289fbd05e4aSLuca Coelho  *	If match_len is zero, this must also be set to zero.
5290fbd05e4aSLuca Coelho  *	Otherwise this must be set to 2 or more, because the first
5291fbd05e4aSLuca Coelho  *	byte is the element id, which is already compared to eid, and
5292fbd05e4aSLuca Coelho  *	the second byte is the IE length.
5293fbd05e4aSLuca Coelho  *
5294fbd05e4aSLuca Coelho  * Return: %NULL if the element ID could not be found or if
5295fbd05e4aSLuca Coelho  * the element is invalid (claims to be longer than the given
5296fbd05e4aSLuca Coelho  * data) or if the byte array doesn't match, or a pointer to the first
5297fbd05e4aSLuca Coelho  * byte of the requested element, that is the byte containing the
5298fbd05e4aSLuca Coelho  * element ID.
5299fbd05e4aSLuca Coelho  *
5300fbd05e4aSLuca Coelho  * Note: There are no checks on the element length other than
5301fbd05e4aSLuca Coelho  * having to fit into the given data and being large enough for the
5302fbd05e4aSLuca Coelho  * byte array to match.
5303fbd05e4aSLuca Coelho  */
530449a68e0dSJohannes Berg static inline const u8 *
530549a68e0dSJohannes Berg cfg80211_find_ie_match(u8 eid, const u8 *ies, unsigned int len,
530649a68e0dSJohannes Berg 		       const u8 *match, unsigned int match_len,
530749a68e0dSJohannes Berg 		       unsigned int match_offset)
530849a68e0dSJohannes Berg {
530949a68e0dSJohannes Berg 	/* match_offset can't be smaller than 2, unless match_len is
531049a68e0dSJohannes Berg 	 * zero, in which case match_offset must be zero as well.
531149a68e0dSJohannes Berg 	 */
531249a68e0dSJohannes Berg 	if (WARN_ON((match_len && match_offset < 2) ||
531349a68e0dSJohannes Berg 		    (!match_len && match_offset)))
531449a68e0dSJohannes Berg 		return NULL;
531549a68e0dSJohannes Berg 
531649a68e0dSJohannes Berg 	return (void *)cfg80211_find_elem_match(eid, ies, len,
531749a68e0dSJohannes Berg 						match, match_len,
531849a68e0dSJohannes Berg 						match_offset ?
531949a68e0dSJohannes Berg 							match_offset - 2 : 0);
532049a68e0dSJohannes Berg }
532149a68e0dSJohannes Berg 
532249a68e0dSJohannes Berg /**
532349a68e0dSJohannes Berg  * cfg80211_find_elem - find information element in data
532449a68e0dSJohannes Berg  *
532549a68e0dSJohannes Berg  * @eid: element ID
532649a68e0dSJohannes Berg  * @ies: data consisting of IEs
532749a68e0dSJohannes Berg  * @len: length of data
532849a68e0dSJohannes Berg  *
532949a68e0dSJohannes Berg  * Return: %NULL if the element ID could not be found or if
533049a68e0dSJohannes Berg  * the element is invalid (claims to be longer than the given
533149a68e0dSJohannes Berg  * data) or if the byte array doesn't match; otherwise return the
533249a68e0dSJohannes Berg  * requested element struct.
533349a68e0dSJohannes Berg  *
533449a68e0dSJohannes Berg  * Note: There are no checks on the element length other than
533549a68e0dSJohannes Berg  * having to fit into the given data.
533649a68e0dSJohannes Berg  */
533749a68e0dSJohannes Berg static inline const struct element *
533849a68e0dSJohannes Berg cfg80211_find_elem(u8 eid, const u8 *ies, int len)
533949a68e0dSJohannes Berg {
534049a68e0dSJohannes Berg 	return cfg80211_find_elem_match(eid, ies, len, NULL, 0, 0);
534149a68e0dSJohannes Berg }
5342fbd05e4aSLuca Coelho 
5343fbd05e4aSLuca Coelho /**
5344c21dbf92SJohannes Berg  * cfg80211_find_ie - find information element in data
5345c21dbf92SJohannes Berg  *
5346c21dbf92SJohannes Berg  * @eid: element ID
5347c21dbf92SJohannes Berg  * @ies: data consisting of IEs
5348c21dbf92SJohannes Berg  * @len: length of data
5349c21dbf92SJohannes Berg  *
53500ae997dcSYacine Belkadi  * Return: %NULL if the element ID could not be found or if
53510ae997dcSYacine Belkadi  * the element is invalid (claims to be longer than the given
53520ae997dcSYacine Belkadi  * data), or a pointer to the first byte of the requested
53530ae997dcSYacine Belkadi  * element, that is the byte containing the element ID.
53540ae997dcSYacine Belkadi  *
53550ae997dcSYacine Belkadi  * Note: There are no checks on the element length other than
53560ae997dcSYacine Belkadi  * having to fit into the given data.
5357c21dbf92SJohannes Berg  */
5358fbd05e4aSLuca Coelho static inline const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len)
5359fbd05e4aSLuca Coelho {
5360fbd05e4aSLuca Coelho 	return cfg80211_find_ie_match(eid, ies, len, NULL, 0, 0);
5361fbd05e4aSLuca Coelho }
5362c21dbf92SJohannes Berg 
5363d70e9693SJohannes Berg /**
536449a68e0dSJohannes Berg  * cfg80211_find_ext_elem - find information element with EID Extension in data
536549a68e0dSJohannes Berg  *
536649a68e0dSJohannes Berg  * @ext_eid: element ID Extension
536749a68e0dSJohannes Berg  * @ies: data consisting of IEs
536849a68e0dSJohannes Berg  * @len: length of data
536949a68e0dSJohannes Berg  *
537049a68e0dSJohannes Berg  * Return: %NULL if the etended element could not be found or if
537149a68e0dSJohannes Berg  * the element is invalid (claims to be longer than the given
537249a68e0dSJohannes Berg  * data) or if the byte array doesn't match; otherwise return the
537349a68e0dSJohannes Berg  * requested element struct.
537449a68e0dSJohannes Berg  *
537549a68e0dSJohannes Berg  * Note: There are no checks on the element length other than
537649a68e0dSJohannes Berg  * having to fit into the given data.
537749a68e0dSJohannes Berg  */
537849a68e0dSJohannes Berg static inline const struct element *
537949a68e0dSJohannes Berg cfg80211_find_ext_elem(u8 ext_eid, const u8 *ies, int len)
538049a68e0dSJohannes Berg {
538149a68e0dSJohannes Berg 	return cfg80211_find_elem_match(WLAN_EID_EXTENSION, ies, len,
538249a68e0dSJohannes Berg 					&ext_eid, 1, 0);
538349a68e0dSJohannes Berg }
538449a68e0dSJohannes Berg 
538549a68e0dSJohannes Berg /**
53863f817fe7SJouni Malinen  * cfg80211_find_ext_ie - find information element with EID Extension in data
53873f817fe7SJouni Malinen  *
53883f817fe7SJouni Malinen  * @ext_eid: element ID Extension
53893f817fe7SJouni Malinen  * @ies: data consisting of IEs
53903f817fe7SJouni Malinen  * @len: length of data
53913f817fe7SJouni Malinen  *
53923f817fe7SJouni Malinen  * Return: %NULL if the extended element ID could not be found or if
53933f817fe7SJouni Malinen  * the element is invalid (claims to be longer than the given
53943f817fe7SJouni Malinen  * data), or a pointer to the first byte of the requested
53953f817fe7SJouni Malinen  * element, that is the byte containing the element ID.
53963f817fe7SJouni Malinen  *
53973f817fe7SJouni Malinen  * Note: There are no checks on the element length other than
53983f817fe7SJouni Malinen  * having to fit into the given data.
53993f817fe7SJouni Malinen  */
54003f817fe7SJouni Malinen static inline const u8 *cfg80211_find_ext_ie(u8 ext_eid, const u8 *ies, int len)
54013f817fe7SJouni Malinen {
54023f817fe7SJouni Malinen 	return cfg80211_find_ie_match(WLAN_EID_EXTENSION, ies, len,
54033f817fe7SJouni Malinen 				      &ext_eid, 1, 2);
54043f817fe7SJouni Malinen }
54053f817fe7SJouni Malinen 
54063f817fe7SJouni Malinen /**
540749a68e0dSJohannes Berg  * cfg80211_find_vendor_elem - find vendor specific information element in data
540849a68e0dSJohannes Berg  *
540949a68e0dSJohannes Berg  * @oui: vendor OUI
541049a68e0dSJohannes Berg  * @oui_type: vendor-specific OUI type (must be < 0xff), negative means any
541149a68e0dSJohannes Berg  * @ies: data consisting of IEs
541249a68e0dSJohannes Berg  * @len: length of data
541349a68e0dSJohannes Berg  *
541449a68e0dSJohannes Berg  * Return: %NULL if the vendor specific element ID could not be found or if the
541549a68e0dSJohannes Berg  * element is invalid (claims to be longer than the given data); otherwise
541649a68e0dSJohannes Berg  * return the element structure for the requested element.
541749a68e0dSJohannes Berg  *
541849a68e0dSJohannes Berg  * Note: There are no checks on the element length other than having to fit into
541949a68e0dSJohannes Berg  * the given data.
542049a68e0dSJohannes Berg  */
542149a68e0dSJohannes Berg const struct element *cfg80211_find_vendor_elem(unsigned int oui, int oui_type,
542249a68e0dSJohannes Berg 						const u8 *ies,
542349a68e0dSJohannes Berg 						unsigned int len);
542449a68e0dSJohannes Berg 
542549a68e0dSJohannes Berg /**
54260c28ec58SEliad Peller  * cfg80211_find_vendor_ie - find vendor specific information element in data
54270c28ec58SEliad Peller  *
54280c28ec58SEliad Peller  * @oui: vendor OUI
54299e9ea439SEmmanuel Grumbach  * @oui_type: vendor-specific OUI type (must be < 0xff), negative means any
54300c28ec58SEliad Peller  * @ies: data consisting of IEs
54310c28ec58SEliad Peller  * @len: length of data
54320c28ec58SEliad Peller  *
54330ae997dcSYacine Belkadi  * Return: %NULL if the vendor specific element ID could not be found or if the
54340ae997dcSYacine Belkadi  * element is invalid (claims to be longer than the given data), or a pointer to
54350ae997dcSYacine Belkadi  * the first byte of the requested element, that is the byte containing the
54360ae997dcSYacine Belkadi  * element ID.
54370ae997dcSYacine Belkadi  *
54380ae997dcSYacine Belkadi  * Note: There are no checks on the element length other than having to fit into
54390ae997dcSYacine Belkadi  * the given data.
54400c28ec58SEliad Peller  */
544149a68e0dSJohannes Berg static inline const u8 *
544249a68e0dSJohannes Berg cfg80211_find_vendor_ie(unsigned int oui, int oui_type,
544349a68e0dSJohannes Berg 			const u8 *ies, unsigned int len)
544449a68e0dSJohannes Berg {
544549a68e0dSJohannes Berg 	return (void *)cfg80211_find_vendor_elem(oui, oui_type, ies, len);
544649a68e0dSJohannes Berg }
54470c28ec58SEliad Peller 
54480c28ec58SEliad Peller /**
544930ca1aa5SDedy Lansky  * cfg80211_send_layer2_update - send layer 2 update frame
545030ca1aa5SDedy Lansky  *
545130ca1aa5SDedy Lansky  * @dev: network device
545230ca1aa5SDedy Lansky  * @addr: STA MAC address
545330ca1aa5SDedy Lansky  *
545430ca1aa5SDedy Lansky  * Wireless drivers can use this function to update forwarding tables in bridge
545530ca1aa5SDedy Lansky  * devices upon STA association.
545630ca1aa5SDedy Lansky  */
545730ca1aa5SDedy Lansky void cfg80211_send_layer2_update(struct net_device *dev, const u8 *addr);
545830ca1aa5SDedy Lansky 
545930ca1aa5SDedy Lansky /**
5460d70e9693SJohannes Berg  * DOC: Regulatory enforcement infrastructure
5461d70e9693SJohannes Berg  *
5462d70e9693SJohannes Berg  * TODO
5463d3236553SJohannes Berg  */
5464d3236553SJohannes Berg 
5465d3236553SJohannes Berg /**
5466d3236553SJohannes Berg  * regulatory_hint - driver hint to the wireless core a regulatory domain
5467d3236553SJohannes Berg  * @wiphy: the wireless device giving the hint (used only for reporting
5468d3236553SJohannes Berg  *	conflicts)
5469d3236553SJohannes Berg  * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain
5470d3236553SJohannes Berg  * 	should be in. If @rd is set this should be NULL. Note that if you
5471d3236553SJohannes Berg  * 	set this to NULL you should still set rd->alpha2 to some accepted
5472d3236553SJohannes Berg  * 	alpha2.
5473d3236553SJohannes Berg  *
5474d3236553SJohannes Berg  * Wireless drivers can use this function to hint to the wireless core
5475d3236553SJohannes Berg  * what it believes should be the current regulatory domain by
5476d3236553SJohannes Berg  * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory
5477d3236553SJohannes Berg  * domain should be in or by providing a completely build regulatory domain.
5478d3236553SJohannes Berg  * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried
5479d3236553SJohannes Berg  * for a regulatory domain structure for the respective country.
5480d3236553SJohannes Berg  *
5481d3236553SJohannes Berg  * The wiphy must have been registered to cfg80211 prior to this call.
5482d3236553SJohannes Berg  * For cfg80211 drivers this means you must first use wiphy_register(),
5483d3236553SJohannes Berg  * for mac80211 drivers you must first use ieee80211_register_hw().
5484d3236553SJohannes Berg  *
5485d3236553SJohannes Berg  * Drivers should check the return value, its possible you can get
5486d3236553SJohannes Berg  * an -ENOMEM.
54870ae997dcSYacine Belkadi  *
54880ae997dcSYacine Belkadi  * Return: 0 on success. -ENOMEM.
5489d3236553SJohannes Berg  */
549010dd9b7cSJoe Perches int regulatory_hint(struct wiphy *wiphy, const char *alpha2);
5491d3236553SJohannes Berg 
5492d3236553SJohannes Berg /**
5493b0d7aa59SJonathan Doron  * regulatory_set_wiphy_regd - set regdom info for self managed drivers
5494b0d7aa59SJonathan Doron  * @wiphy: the wireless device we want to process the regulatory domain on
5495b0d7aa59SJonathan Doron  * @rd: the regulatory domain informatoin to use for this wiphy
5496b0d7aa59SJonathan Doron  *
5497b0d7aa59SJonathan Doron  * Set the regulatory domain information for self-managed wiphys, only they
5498b0d7aa59SJonathan Doron  * may use this function. See %REGULATORY_WIPHY_SELF_MANAGED for more
5499b0d7aa59SJonathan Doron  * information.
5500b0d7aa59SJonathan Doron  *
5501b0d7aa59SJonathan Doron  * Return: 0 on success. -EINVAL, -EPERM
5502b0d7aa59SJonathan Doron  */
5503b0d7aa59SJonathan Doron int regulatory_set_wiphy_regd(struct wiphy *wiphy,
5504b0d7aa59SJonathan Doron 			      struct ieee80211_regdomain *rd);
5505b0d7aa59SJonathan Doron 
5506b0d7aa59SJonathan Doron /**
55072c3e861cSArik Nemtsov  * regulatory_set_wiphy_regd_sync_rtnl - set regdom for self-managed drivers
55082c3e861cSArik Nemtsov  * @wiphy: the wireless device we want to process the regulatory domain on
55092c3e861cSArik Nemtsov  * @rd: the regulatory domain information to use for this wiphy
55102c3e861cSArik Nemtsov  *
55112c3e861cSArik Nemtsov  * This functions requires the RTNL to be held and applies the new regdomain
55122c3e861cSArik Nemtsov  * synchronously to this wiphy. For more details see
55132c3e861cSArik Nemtsov  * regulatory_set_wiphy_regd().
55142c3e861cSArik Nemtsov  *
55152c3e861cSArik Nemtsov  * Return: 0 on success. -EINVAL, -EPERM
55162c3e861cSArik Nemtsov  */
55172c3e861cSArik Nemtsov int regulatory_set_wiphy_regd_sync_rtnl(struct wiphy *wiphy,
55182c3e861cSArik Nemtsov 					struct ieee80211_regdomain *rd);
55192c3e861cSArik Nemtsov 
55202c3e861cSArik Nemtsov /**
5521d3236553SJohannes Berg  * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain
5522d3236553SJohannes Berg  * @wiphy: the wireless device we want to process the regulatory domain on
5523d3236553SJohannes Berg  * @regd: the custom regulatory domain to use for this wiphy
5524d3236553SJohannes Berg  *
5525d3236553SJohannes Berg  * Drivers can sometimes have custom regulatory domains which do not apply
5526d3236553SJohannes Berg  * to a specific country. Drivers can use this to apply such custom regulatory
5527d3236553SJohannes Berg  * domains. This routine must be called prior to wiphy registration. The
5528d3236553SJohannes Berg  * custom regulatory domain will be trusted completely and as such previous
5529d3236553SJohannes Berg  * default channel settings will be disregarded. If no rule is found for a
5530d3236553SJohannes Berg  * channel on the regulatory domain the channel will be disabled.
5531222ea581SLuis R. Rodriguez  * Drivers using this for a wiphy should also set the wiphy flag
5532ce26151bSKalle Valo  * REGULATORY_CUSTOM_REG or cfg80211 will set it for the wiphy
5533222ea581SLuis R. Rodriguez  * that called this helper.
5534d3236553SJohannes Berg  */
553510dd9b7cSJoe Perches void wiphy_apply_custom_regulatory(struct wiphy *wiphy,
5536d3236553SJohannes Berg 				   const struct ieee80211_regdomain *regd);
5537d3236553SJohannes Berg 
5538d3236553SJohannes Berg /**
5539d3236553SJohannes Berg  * freq_reg_info - get regulatory information for the given frequency
5540d3236553SJohannes Berg  * @wiphy: the wiphy for which we want to process this rule for
5541d3236553SJohannes Berg  * @center_freq: Frequency in KHz for which we want regulatory information for
5542d3236553SJohannes Berg  *
5543d3236553SJohannes Berg  * Use this function to get the regulatory rule for a specific frequency on
5544d3236553SJohannes Berg  * a given wireless device. If the device has a specific regulatory domain
5545d3236553SJohannes Berg  * it wants to follow we respect that unless a country IE has been received
5546d3236553SJohannes Berg  * and processed already.
5547d3236553SJohannes Berg  *
55480ae997dcSYacine Belkadi  * Return: A valid pointer, or, when an error occurs, for example if no rule
55490ae997dcSYacine Belkadi  * can be found, the return value is encoded using ERR_PTR(). Use IS_ERR() to
55500ae997dcSYacine Belkadi  * check and PTR_ERR() to obtain the numeric return value. The numeric return
55510ae997dcSYacine Belkadi  * value will be -ERANGE if we determine the given center_freq does not even
55520ae997dcSYacine Belkadi  * have a regulatory rule for a frequency range in the center_freq's band.
55530ae997dcSYacine Belkadi  * See freq_in_rule_band() for our current definition of a band -- this is
55540ae997dcSYacine Belkadi  * purely subjective and right now it's 802.11 specific.
5555d3236553SJohannes Berg  */
5556361c9c8bSJohannes Berg const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy,
5557361c9c8bSJohannes Berg 					       u32 center_freq);
5558d3236553SJohannes Berg 
5559034c6d6eSLuis R. Rodriguez /**
5560034c6d6eSLuis R. Rodriguez  * reg_initiator_name - map regulatory request initiator enum to name
5561034c6d6eSLuis R. Rodriguez  * @initiator: the regulatory request initiator
5562034c6d6eSLuis R. Rodriguez  *
5563034c6d6eSLuis R. Rodriguez  * You can use this to map the regulatory request initiator enum to a
5564034c6d6eSLuis R. Rodriguez  * proper string representation.
5565034c6d6eSLuis R. Rodriguez  */
5566034c6d6eSLuis R. Rodriguez const char *reg_initiator_name(enum nl80211_reg_initiator initiator);
5567034c6d6eSLuis R. Rodriguez 
556819d3577eSHaim Dreyfuss /**
5569dc0c18edSAaron Komisar  * regulatory_pre_cac_allowed - check if pre-CAC allowed in the current regdom
5570dc0c18edSAaron Komisar  * @wiphy: wiphy for which pre-CAC capability is checked.
5571dc0c18edSAaron Komisar  *
5572dc0c18edSAaron Komisar  * Pre-CAC is allowed only in some regdomains (notable ETSI).
5573dc0c18edSAaron Komisar  */
5574dc0c18edSAaron Komisar bool regulatory_pre_cac_allowed(struct wiphy *wiphy);
5575dc0c18edSAaron Komisar 
5576dc0c18edSAaron Komisar /**
557719d3577eSHaim Dreyfuss  * DOC: Internal regulatory db functions
557819d3577eSHaim Dreyfuss  *
557919d3577eSHaim Dreyfuss  */
558019d3577eSHaim Dreyfuss 
558119d3577eSHaim Dreyfuss /**
558219d3577eSHaim Dreyfuss  * reg_query_regdb_wmm -  Query internal regulatory db for wmm rule
558319d3577eSHaim Dreyfuss  * Regulatory self-managed driver can use it to proactively
558419d3577eSHaim Dreyfuss  *
558519d3577eSHaim Dreyfuss  * @alpha2: the ISO/IEC 3166 alpha2 wmm rule to be queried.
558619d3577eSHaim Dreyfuss  * @freq: the freqency(in MHz) to be queried.
558719d3577eSHaim Dreyfuss  * @rule: pointer to store the wmm rule from the regulatory db.
558819d3577eSHaim Dreyfuss  *
558919d3577eSHaim Dreyfuss  * Self-managed wireless drivers can use this function to  query
559019d3577eSHaim Dreyfuss  * the internal regulatory database to check whether the given
559119d3577eSHaim Dreyfuss  * ISO/IEC 3166 alpha2 country and freq have wmm rule limitations.
559219d3577eSHaim Dreyfuss  *
559319d3577eSHaim Dreyfuss  * Drivers should check the return value, its possible you can get
559419d3577eSHaim Dreyfuss  * an -ENODATA.
559519d3577eSHaim Dreyfuss  *
559619d3577eSHaim Dreyfuss  * Return: 0 on success. -ENODATA.
559719d3577eSHaim Dreyfuss  */
559838cb87eeSStanislaw Gruszka int reg_query_regdb_wmm(char *alpha2, int freq,
559938cb87eeSStanislaw Gruszka 			struct ieee80211_reg_rule *rule);
560019d3577eSHaim Dreyfuss 
5601d3236553SJohannes Berg /*
5602d3236553SJohannes Berg  * callbacks for asynchronous cfg80211 methods, notification
5603d3236553SJohannes Berg  * functions and BSS handling helpers
5604d3236553SJohannes Berg  */
5605d3236553SJohannes Berg 
56062a519311SJohannes Berg /**
56072a519311SJohannes Berg  * cfg80211_scan_done - notify that scan finished
56082a519311SJohannes Berg  *
56092a519311SJohannes Berg  * @request: the corresponding scan request
56101d76250bSAvraham Stern  * @info: information about the completed scan
56112a519311SJohannes Berg  */
56121d76250bSAvraham Stern void cfg80211_scan_done(struct cfg80211_scan_request *request,
56131d76250bSAvraham Stern 			struct cfg80211_scan_info *info);
56142a519311SJohannes Berg 
56152a519311SJohannes Berg /**
5616807f8a8cSLuciano Coelho  * cfg80211_sched_scan_results - notify that new scan results are available
5617807f8a8cSLuciano Coelho  *
5618807f8a8cSLuciano Coelho  * @wiphy: the wiphy which got scheduled scan results
5619b34939b9SArend Van Spriel  * @reqid: identifier for the related scheduled scan request
5620807f8a8cSLuciano Coelho  */
5621b34939b9SArend Van Spriel void cfg80211_sched_scan_results(struct wiphy *wiphy, u64 reqid);
5622807f8a8cSLuciano Coelho 
5623807f8a8cSLuciano Coelho /**
5624807f8a8cSLuciano Coelho  * cfg80211_sched_scan_stopped - notify that the scheduled scan has stopped
5625807f8a8cSLuciano Coelho  *
5626807f8a8cSLuciano Coelho  * @wiphy: the wiphy on which the scheduled scan stopped
5627b34939b9SArend Van Spriel  * @reqid: identifier for the related scheduled scan request
5628807f8a8cSLuciano Coelho  *
5629807f8a8cSLuciano Coelho  * The driver can call this function to inform cfg80211 that the
5630807f8a8cSLuciano Coelho  * scheduled scan had to be stopped, for whatever reason.  The driver
5631807f8a8cSLuciano Coelho  * is then called back via the sched_scan_stop operation when done.
5632807f8a8cSLuciano Coelho  */
5633b34939b9SArend Van Spriel void cfg80211_sched_scan_stopped(struct wiphy *wiphy, u64 reqid);
5634807f8a8cSLuciano Coelho 
5635807f8a8cSLuciano Coelho /**
5636792e6aa7SEliad Peller  * cfg80211_sched_scan_stopped_rtnl - notify that the scheduled scan has stopped
5637792e6aa7SEliad Peller  *
5638792e6aa7SEliad Peller  * @wiphy: the wiphy on which the scheduled scan stopped
5639b34939b9SArend Van Spriel  * @reqid: identifier for the related scheduled scan request
5640792e6aa7SEliad Peller  *
5641792e6aa7SEliad Peller  * The driver can call this function to inform cfg80211 that the
5642792e6aa7SEliad Peller  * scheduled scan had to be stopped, for whatever reason.  The driver
5643792e6aa7SEliad Peller  * is then called back via the sched_scan_stop operation when done.
5644792e6aa7SEliad Peller  * This function should be called with rtnl locked.
5645792e6aa7SEliad Peller  */
5646b34939b9SArend Van Spriel void cfg80211_sched_scan_stopped_rtnl(struct wiphy *wiphy, u64 reqid);
5647792e6aa7SEliad Peller 
5648792e6aa7SEliad Peller /**
56496e19bc4bSDmitry Shmidt  * cfg80211_inform_bss_frame_data - inform cfg80211 of a received BSS frame
56502a519311SJohannes Berg  * @wiphy: the wiphy reporting the BSS
56516e19bc4bSDmitry Shmidt  * @data: the BSS metadata
5652abe37c4bSJohannes Berg  * @mgmt: the management frame (probe response or beacon)
5653abe37c4bSJohannes Berg  * @len: length of the management frame
56542a519311SJohannes Berg  * @gfp: context flags
56552a519311SJohannes Berg  *
56562a519311SJohannes Berg  * This informs cfg80211 that BSS information was found and
56572a519311SJohannes Berg  * the BSS should be updated/added.
5658ef100682SJohannes Berg  *
56590ae997dcSYacine Belkadi  * Return: A referenced struct, must be released with cfg80211_put_bss()!
56600ae997dcSYacine Belkadi  * Or %NULL on error.
56612a519311SJohannes Berg  */
5662ef100682SJohannes Berg struct cfg80211_bss * __must_check
56636e19bc4bSDmitry Shmidt cfg80211_inform_bss_frame_data(struct wiphy *wiphy,
56646e19bc4bSDmitry Shmidt 			       struct cfg80211_inform_bss *data,
56656e19bc4bSDmitry Shmidt 			       struct ieee80211_mgmt *mgmt, size_t len,
56666e19bc4bSDmitry Shmidt 			       gfp_t gfp);
56676e19bc4bSDmitry Shmidt 
56686e19bc4bSDmitry Shmidt static inline struct cfg80211_bss * __must_check
5669dcd6eac1SSimon Wunderlich cfg80211_inform_bss_width_frame(struct wiphy *wiphy,
56703afc2167SEmmanuel Grumbach 				struct ieee80211_channel *rx_channel,
5671dcd6eac1SSimon Wunderlich 				enum nl80211_bss_scan_width scan_width,
5672dcd6eac1SSimon Wunderlich 				struct ieee80211_mgmt *mgmt, size_t len,
56736e19bc4bSDmitry Shmidt 				s32 signal, gfp_t gfp)
56746e19bc4bSDmitry Shmidt {
56756e19bc4bSDmitry Shmidt 	struct cfg80211_inform_bss data = {
56766e19bc4bSDmitry Shmidt 		.chan = rx_channel,
56776e19bc4bSDmitry Shmidt 		.scan_width = scan_width,
56786e19bc4bSDmitry Shmidt 		.signal = signal,
56796e19bc4bSDmitry Shmidt 	};
56806e19bc4bSDmitry Shmidt 
56816e19bc4bSDmitry Shmidt 	return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp);
56826e19bc4bSDmitry Shmidt }
5683dcd6eac1SSimon Wunderlich 
5684dcd6eac1SSimon Wunderlich static inline struct cfg80211_bss * __must_check
56852a519311SJohannes Berg cfg80211_inform_bss_frame(struct wiphy *wiphy,
56863afc2167SEmmanuel Grumbach 			  struct ieee80211_channel *rx_channel,
56872a519311SJohannes Berg 			  struct ieee80211_mgmt *mgmt, size_t len,
5688dcd6eac1SSimon Wunderlich 			  s32 signal, gfp_t gfp)
5689dcd6eac1SSimon Wunderlich {
56906e19bc4bSDmitry Shmidt 	struct cfg80211_inform_bss data = {
56916e19bc4bSDmitry Shmidt 		.chan = rx_channel,
56926e19bc4bSDmitry Shmidt 		.scan_width = NL80211_BSS_CHAN_WIDTH_20,
56936e19bc4bSDmitry Shmidt 		.signal = signal,
56946e19bc4bSDmitry Shmidt 	};
56956e19bc4bSDmitry Shmidt 
56966e19bc4bSDmitry Shmidt 	return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp);
5697dcd6eac1SSimon Wunderlich }
56982a519311SJohannes Berg 
5699abe37c4bSJohannes Berg /**
57007ece9c37SSara Sharon  * cfg80211_gen_new_bssid - generate a nontransmitted BSSID for multi-BSSID
57017ece9c37SSara Sharon  * @bssid: transmitter BSSID
57027ece9c37SSara Sharon  * @max_bssid: max BSSID indicator, taken from Multiple BSSID element
57037ece9c37SSara Sharon  * @mbssid_index: BSSID index, taken from Multiple BSSID index element
57045d4071abSJohannes Berg  * @new_bssid: calculated nontransmitted BSSID
57057ece9c37SSara Sharon  */
57067ece9c37SSara Sharon static inline void cfg80211_gen_new_bssid(const u8 *bssid, u8 max_bssid,
57075d4071abSJohannes Berg 					  u8 mbssid_index, u8 *new_bssid)
57087ece9c37SSara Sharon {
57095d4071abSJohannes Berg 	u64 bssid_u64 = ether_addr_to_u64(bssid);
57105d4071abSJohannes Berg 	u64 mask = GENMASK_ULL(max_bssid - 1, 0);
57115d4071abSJohannes Berg 	u64 new_bssid_u64;
57127ece9c37SSara Sharon 
57135d4071abSJohannes Berg 	new_bssid_u64 = bssid_u64 & ~mask;
57147ece9c37SSara Sharon 
57155d4071abSJohannes Berg 	new_bssid_u64 |= ((bssid_u64 & mask) + mbssid_index) & mask;
57167ece9c37SSara Sharon 
57175d4071abSJohannes Berg 	u64_to_ether_addr(new_bssid_u64, new_bssid);
57187ece9c37SSara Sharon }
57197ece9c37SSara Sharon 
57207ece9c37SSara Sharon /**
5721f7dacfb1SSara Sharon  * cfg80211_is_element_inherited - returns if element ID should be inherited
5722f7dacfb1SSara Sharon  * @element: element to check
5723f7dacfb1SSara Sharon  * @non_inherit_element: non inheritance element
5724f7dacfb1SSara Sharon  */
5725f7dacfb1SSara Sharon bool cfg80211_is_element_inherited(const struct element *element,
5726f7dacfb1SSara Sharon 				   const struct element *non_inherit_element);
5727f7dacfb1SSara Sharon 
5728f7dacfb1SSara Sharon /**
5729fe806e49SSara Sharon  * cfg80211_merge_profile - merges a MBSSID profile if it is split between IEs
5730fe806e49SSara Sharon  * @ie: ies
5731fe806e49SSara Sharon  * @ielen: length of IEs
5732fe806e49SSara Sharon  * @mbssid_elem: current MBSSID element
5733fe806e49SSara Sharon  * @sub_elem: current MBSSID subelement (profile)
5734fe806e49SSara Sharon  * @merged_ie: location of the merged profile
5735fe806e49SSara Sharon  * @max_copy_len: max merged profile length
5736fe806e49SSara Sharon  */
5737fe806e49SSara Sharon size_t cfg80211_merge_profile(const u8 *ie, size_t ielen,
5738fe806e49SSara Sharon 			      const struct element *mbssid_elem,
5739fe806e49SSara Sharon 			      const struct element *sub_elem,
57405809a5d5SDan Carpenter 			      u8 *merged_ie, size_t max_copy_len);
5741fe806e49SSara Sharon 
5742fe806e49SSara Sharon /**
57435bc8c1f2SJohannes Berg  * enum cfg80211_bss_frame_type - frame type that the BSS data came from
57445bc8c1f2SJohannes Berg  * @CFG80211_BSS_FTYPE_UNKNOWN: driver doesn't know whether the data is
57455bc8c1f2SJohannes Berg  *	from a beacon or probe response
57465bc8c1f2SJohannes Berg  * @CFG80211_BSS_FTYPE_BEACON: data comes from a beacon
57475bc8c1f2SJohannes Berg  * @CFG80211_BSS_FTYPE_PRESP: data comes from a probe response
57485bc8c1f2SJohannes Berg  */
57495bc8c1f2SJohannes Berg enum cfg80211_bss_frame_type {
57505bc8c1f2SJohannes Berg 	CFG80211_BSS_FTYPE_UNKNOWN,
57515bc8c1f2SJohannes Berg 	CFG80211_BSS_FTYPE_BEACON,
57525bc8c1f2SJohannes Berg 	CFG80211_BSS_FTYPE_PRESP,
57535bc8c1f2SJohannes Berg };
57545bc8c1f2SJohannes Berg 
57555bc8c1f2SJohannes Berg /**
57566e19bc4bSDmitry Shmidt  * cfg80211_inform_bss_data - inform cfg80211 of a new BSS
5757abe37c4bSJohannes Berg  *
5758abe37c4bSJohannes Berg  * @wiphy: the wiphy reporting the BSS
57596e19bc4bSDmitry Shmidt  * @data: the BSS metadata
57605bc8c1f2SJohannes Berg  * @ftype: frame type (if known)
5761abe37c4bSJohannes Berg  * @bssid: the BSSID of the BSS
57627b8bcff2SJohannes Berg  * @tsf: the TSF sent by the peer in the beacon/probe response (or 0)
5763abe37c4bSJohannes Berg  * @capability: the capability field sent by the peer
5764abe37c4bSJohannes Berg  * @beacon_interval: the beacon interval announced by the peer
5765abe37c4bSJohannes Berg  * @ie: additional IEs sent by the peer
5766abe37c4bSJohannes Berg  * @ielen: length of the additional IEs
5767abe37c4bSJohannes Berg  * @gfp: context flags
5768abe37c4bSJohannes Berg  *
5769abe37c4bSJohannes Berg  * This informs cfg80211 that BSS information was found and
5770abe37c4bSJohannes Berg  * the BSS should be updated/added.
5771ef100682SJohannes Berg  *
57720ae997dcSYacine Belkadi  * Return: A referenced struct, must be released with cfg80211_put_bss()!
57730ae997dcSYacine Belkadi  * Or %NULL on error.
5774abe37c4bSJohannes Berg  */
5775ef100682SJohannes Berg struct cfg80211_bss * __must_check
57766e19bc4bSDmitry Shmidt cfg80211_inform_bss_data(struct wiphy *wiphy,
57776e19bc4bSDmitry Shmidt 			 struct cfg80211_inform_bss *data,
57786e19bc4bSDmitry Shmidt 			 enum cfg80211_bss_frame_type ftype,
57796e19bc4bSDmitry Shmidt 			 const u8 *bssid, u64 tsf, u16 capability,
57806e19bc4bSDmitry Shmidt 			 u16 beacon_interval, const u8 *ie, size_t ielen,
57816e19bc4bSDmitry Shmidt 			 gfp_t gfp);
57826e19bc4bSDmitry Shmidt 
57836e19bc4bSDmitry Shmidt static inline struct cfg80211_bss * __must_check
5784dcd6eac1SSimon Wunderlich cfg80211_inform_bss_width(struct wiphy *wiphy,
57853afc2167SEmmanuel Grumbach 			  struct ieee80211_channel *rx_channel,
5786dcd6eac1SSimon Wunderlich 			  enum nl80211_bss_scan_width scan_width,
57875bc8c1f2SJohannes Berg 			  enum cfg80211_bss_frame_type ftype,
5788dcd6eac1SSimon Wunderlich 			  const u8 *bssid, u64 tsf, u16 capability,
5789dcd6eac1SSimon Wunderlich 			  u16 beacon_interval, const u8 *ie, size_t ielen,
57906e19bc4bSDmitry Shmidt 			  s32 signal, gfp_t gfp)
57916e19bc4bSDmitry Shmidt {
57926e19bc4bSDmitry Shmidt 	struct cfg80211_inform_bss data = {
57936e19bc4bSDmitry Shmidt 		.chan = rx_channel,
57946e19bc4bSDmitry Shmidt 		.scan_width = scan_width,
57956e19bc4bSDmitry Shmidt 		.signal = signal,
57966e19bc4bSDmitry Shmidt 	};
57976e19bc4bSDmitry Shmidt 
57986e19bc4bSDmitry Shmidt 	return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf,
57996e19bc4bSDmitry Shmidt 					capability, beacon_interval, ie, ielen,
58006e19bc4bSDmitry Shmidt 					gfp);
58016e19bc4bSDmitry Shmidt }
5802dcd6eac1SSimon Wunderlich 
5803dcd6eac1SSimon Wunderlich static inline struct cfg80211_bss * __must_check
580406aa7afaSJussi Kivilinna cfg80211_inform_bss(struct wiphy *wiphy,
58053afc2167SEmmanuel Grumbach 		    struct ieee80211_channel *rx_channel,
58065bc8c1f2SJohannes Berg 		    enum cfg80211_bss_frame_type ftype,
58077b8bcff2SJohannes Berg 		    const u8 *bssid, u64 tsf, u16 capability,
58087b8bcff2SJohannes Berg 		    u16 beacon_interval, const u8 *ie, size_t ielen,
5809dcd6eac1SSimon Wunderlich 		    s32 signal, gfp_t gfp)
5810dcd6eac1SSimon Wunderlich {
58116e19bc4bSDmitry Shmidt 	struct cfg80211_inform_bss data = {
58126e19bc4bSDmitry Shmidt 		.chan = rx_channel,
58136e19bc4bSDmitry Shmidt 		.scan_width = NL80211_BSS_CHAN_WIDTH_20,
58146e19bc4bSDmitry Shmidt 		.signal = signal,
58156e19bc4bSDmitry Shmidt 	};
58166e19bc4bSDmitry Shmidt 
58176e19bc4bSDmitry Shmidt 	return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf,
58186e19bc4bSDmitry Shmidt 					capability, beacon_interval, ie, ielen,
5819dcd6eac1SSimon Wunderlich 					gfp);
5820dcd6eac1SSimon Wunderlich }
582106aa7afaSJussi Kivilinna 
582227548677SJohannes Berg /**
582327548677SJohannes Berg  * cfg80211_get_bss - get a BSS reference
582427548677SJohannes Berg  * @wiphy: the wiphy this BSS struct belongs to
582527548677SJohannes Berg  * @channel: the channel to search on (or %NULL)
582627548677SJohannes Berg  * @bssid: the desired BSSID (or %NULL)
582727548677SJohannes Berg  * @ssid: the desired SSID (or %NULL)
582827548677SJohannes Berg  * @ssid_len: length of the SSID (or 0)
582927548677SJohannes Berg  * @bss_type: type of BSS, see &enum ieee80211_bss_type
583027548677SJohannes Berg  * @privacy: privacy filter, see &enum ieee80211_privacy
583127548677SJohannes Berg  */
58322a519311SJohannes Berg struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
58332a519311SJohannes Berg 				      struct ieee80211_channel *channel,
58342a519311SJohannes Berg 				      const u8 *bssid,
583579420f09SJohannes Berg 				      const u8 *ssid, size_t ssid_len,
58366eb18137SDedy Lansky 				      enum ieee80211_bss_type bss_type,
583727548677SJohannes Berg 				      enum ieee80211_privacy privacy);
583879420f09SJohannes Berg static inline struct cfg80211_bss *
583979420f09SJohannes Berg cfg80211_get_ibss(struct wiphy *wiphy,
584079420f09SJohannes Berg 		  struct ieee80211_channel *channel,
584179420f09SJohannes Berg 		  const u8 *ssid, size_t ssid_len)
584279420f09SJohannes Berg {
584379420f09SJohannes Berg 	return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len,
58446eb18137SDedy Lansky 				IEEE80211_BSS_TYPE_IBSS,
58456eb18137SDedy Lansky 				IEEE80211_PRIVACY_ANY);
584679420f09SJohannes Berg }
584779420f09SJohannes Berg 
58484c0c0b75SJohannes Berg /**
58494c0c0b75SJohannes Berg  * cfg80211_ref_bss - reference BSS struct
58505b112d3dSJohannes Berg  * @wiphy: the wiphy this BSS struct belongs to
58514c0c0b75SJohannes Berg  * @bss: the BSS struct to reference
58524c0c0b75SJohannes Berg  *
58534c0c0b75SJohannes Berg  * Increments the refcount of the given BSS struct.
58544c0c0b75SJohannes Berg  */
58555b112d3dSJohannes Berg void cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
58564c0c0b75SJohannes Berg 
58574c0c0b75SJohannes Berg /**
58584c0c0b75SJohannes Berg  * cfg80211_put_bss - unref BSS struct
58595b112d3dSJohannes Berg  * @wiphy: the wiphy this BSS struct belongs to
58604c0c0b75SJohannes Berg  * @bss: the BSS struct
58614c0c0b75SJohannes Berg  *
58624c0c0b75SJohannes Berg  * Decrements the refcount of the given BSS struct.
58634c0c0b75SJohannes Berg  */
58645b112d3dSJohannes Berg void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
5865d3236553SJohannes Berg 
5866d491af19SJohannes Berg /**
5867d491af19SJohannes Berg  * cfg80211_unlink_bss - unlink BSS from internal data structures
5868d491af19SJohannes Berg  * @wiphy: the wiphy
5869d491af19SJohannes Berg  * @bss: the bss to remove
5870d491af19SJohannes Berg  *
5871d491af19SJohannes Berg  * This function removes the given BSS from the internal data structures
5872d491af19SJohannes Berg  * thereby making it no longer show up in scan results etc. Use this
5873d491af19SJohannes Berg  * function when you detect a BSS is gone. Normally BSSes will also time
5874d491af19SJohannes Berg  * out, so it is not necessary to use this function at all.
5875d491af19SJohannes Berg  */
5876d491af19SJohannes Berg void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
5877fee52678SJohannes Berg 
58784770c8f9SIlan Peer /**
58794770c8f9SIlan Peer  * cfg80211_bss_iter - iterate all BSS entries
58804770c8f9SIlan Peer  *
58814770c8f9SIlan Peer  * This function iterates over the BSS entries associated with the given wiphy
58824770c8f9SIlan Peer  * and calls the callback for the iterated BSS. The iterator function is not
58834770c8f9SIlan Peer  * allowed to call functions that might modify the internal state of the BSS DB.
58844770c8f9SIlan Peer  *
58854770c8f9SIlan Peer  * @wiphy: the wiphy
58864770c8f9SIlan Peer  * @chandef: if given, the iterator function will be called only if the channel
58874770c8f9SIlan Peer  *     of the currently iterated BSS is a subset of the given channel.
58884770c8f9SIlan Peer  * @iter: the iterator function to call
58894770c8f9SIlan Peer  * @iter_data: an argument to the iterator function
58904770c8f9SIlan Peer  */
58914770c8f9SIlan Peer void cfg80211_bss_iter(struct wiphy *wiphy,
58924770c8f9SIlan Peer 		       struct cfg80211_chan_def *chandef,
58934770c8f9SIlan Peer 		       void (*iter)(struct wiphy *wiphy,
58944770c8f9SIlan Peer 				    struct cfg80211_bss *bss,
58954770c8f9SIlan Peer 				    void *data),
58964770c8f9SIlan Peer 		       void *iter_data);
58974770c8f9SIlan Peer 
5898dcd6eac1SSimon Wunderlich static inline enum nl80211_bss_scan_width
5899dcd6eac1SSimon Wunderlich cfg80211_chandef_to_scan_width(const struct cfg80211_chan_def *chandef)
5900dcd6eac1SSimon Wunderlich {
5901dcd6eac1SSimon Wunderlich 	switch (chandef->width) {
5902dcd6eac1SSimon Wunderlich 	case NL80211_CHAN_WIDTH_5:
5903dcd6eac1SSimon Wunderlich 		return NL80211_BSS_CHAN_WIDTH_5;
5904dcd6eac1SSimon Wunderlich 	case NL80211_CHAN_WIDTH_10:
5905dcd6eac1SSimon Wunderlich 		return NL80211_BSS_CHAN_WIDTH_10;
5906dcd6eac1SSimon Wunderlich 	default:
5907dcd6eac1SSimon Wunderlich 		return NL80211_BSS_CHAN_WIDTH_20;
5908dcd6eac1SSimon Wunderlich 	}
5909dcd6eac1SSimon Wunderlich }
5910dcd6eac1SSimon Wunderlich 
59116039f6d2SJouni Malinen /**
59126ff57cf8SJohannes Berg  * cfg80211_rx_mlme_mgmt - notification of processed MLME management frame
59136039f6d2SJouni Malinen  * @dev: network device
59146039f6d2SJouni Malinen  * @buf: authentication frame (header + body)
59156039f6d2SJouni Malinen  * @len: length of the frame data
59166039f6d2SJouni Malinen  *
59176ff57cf8SJohannes Berg  * This function is called whenever an authentication, disassociation or
59186ff57cf8SJohannes Berg  * deauthentication frame has been received and processed in station mode.
59196ff57cf8SJohannes Berg  * After being asked to authenticate via cfg80211_ops::auth() the driver must
59206ff57cf8SJohannes Berg  * call either this function or cfg80211_auth_timeout().
59216ff57cf8SJohannes Berg  * After being asked to associate via cfg80211_ops::assoc() the driver must
59226ff57cf8SJohannes Berg  * call either this function or cfg80211_auth_timeout().
59236ff57cf8SJohannes Berg  * While connected, the driver must calls this for received and processed
59246ff57cf8SJohannes Berg  * disassociation and deauthentication frames. If the frame couldn't be used
59256ff57cf8SJohannes Berg  * because it was unprotected, the driver must call the function
59266ff57cf8SJohannes Berg  * cfg80211_rx_unprot_mlme_mgmt() instead.
59276ff57cf8SJohannes Berg  *
59286ff57cf8SJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's mutex.
59296039f6d2SJouni Malinen  */
59306ff57cf8SJohannes Berg void cfg80211_rx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len);
59316039f6d2SJouni Malinen 
59326039f6d2SJouni Malinen /**
59336ff57cf8SJohannes Berg  * cfg80211_auth_timeout - notification of timed out authentication
59341965c853SJouni Malinen  * @dev: network device
59351965c853SJouni Malinen  * @addr: The MAC address of the device with which the authentication timed out
5936cb0b4bebSJohannes Berg  *
59378d61ffa5SJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's
59388d61ffa5SJohannes Berg  * mutex.
59391965c853SJouni Malinen  */
59406ff57cf8SJohannes Berg void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr);
59411965c853SJouni Malinen 
59421965c853SJouni Malinen /**
59436ff57cf8SJohannes Berg  * cfg80211_rx_assoc_resp - notification of processed association response
59446039f6d2SJouni Malinen  * @dev: network device
59456ff57cf8SJohannes Berg  * @bss: the BSS that association was requested with, ownership of the pointer
59466ff57cf8SJohannes Berg  *	moves to cfg80211 in this call
59474d9ec73dSJouni Malinen  * @buf: (Re)Association Response frame (header + body)
59486039f6d2SJouni Malinen  * @len: length of the frame data
5949f438ceb8SEmmanuel Grumbach  * @uapsd_queues: bitmap of queues configured for uapsd. Same format
5950f438ceb8SEmmanuel Grumbach  *	as the AC bitmap in the QoS info field
59514d9ec73dSJouni Malinen  * @req_ies: information elements from the (Re)Association Request frame
59524d9ec73dSJouni Malinen  * @req_ies_len: length of req_ies data
59536039f6d2SJouni Malinen  *
59546ff57cf8SJohannes Berg  * After being asked to associate via cfg80211_ops::assoc() the driver must
59556ff57cf8SJohannes Berg  * call either this function or cfg80211_auth_timeout().
59566ff57cf8SJohannes Berg  *
59576ff57cf8SJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's mutex.
59586039f6d2SJouni Malinen  */
59596ff57cf8SJohannes Berg void cfg80211_rx_assoc_resp(struct net_device *dev,
59606ff57cf8SJohannes Berg 			    struct cfg80211_bss *bss,
5961b0b6aa2cSEliad Peller 			    const u8 *buf, size_t len,
59624d9ec73dSJouni Malinen 			    int uapsd_queues,
59634d9ec73dSJouni Malinen 			    const u8 *req_ies, size_t req_ies_len);
59646039f6d2SJouni Malinen 
59656039f6d2SJouni Malinen /**
59666ff57cf8SJohannes Berg  * cfg80211_assoc_timeout - notification of timed out association
59671965c853SJouni Malinen  * @dev: network device
5968959867faSJohannes Berg  * @bss: The BSS entry with which association timed out.
5969cb0b4bebSJohannes Berg  *
59708d61ffa5SJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's mutex.
59711965c853SJouni Malinen  */
5972959867faSJohannes Berg void cfg80211_assoc_timeout(struct net_device *dev, struct cfg80211_bss *bss);
59731965c853SJouni Malinen 
59741965c853SJouni Malinen /**
5975e6f462dfSJohannes Berg  * cfg80211_abandon_assoc - notify cfg80211 of abandoned association attempt
5976e6f462dfSJohannes Berg  * @dev: network device
5977e6f462dfSJohannes Berg  * @bss: The BSS entry with which association was abandoned.
5978e6f462dfSJohannes Berg  *
5979e6f462dfSJohannes Berg  * Call this whenever - for reasons reported through other API, like deauth RX,
5980e6f462dfSJohannes Berg  * an association attempt was abandoned.
5981e6f462dfSJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's mutex.
5982e6f462dfSJohannes Berg  */
5983e6f462dfSJohannes Berg void cfg80211_abandon_assoc(struct net_device *dev, struct cfg80211_bss *bss);
5984e6f462dfSJohannes Berg 
5985e6f462dfSJohannes Berg /**
59866ff57cf8SJohannes Berg  * cfg80211_tx_mlme_mgmt - notification of transmitted deauth/disassoc frame
59876039f6d2SJouni Malinen  * @dev: network device
59886ff57cf8SJohannes Berg  * @buf: 802.11 frame (header + body)
59896039f6d2SJouni Malinen  * @len: length of the frame data
59906039f6d2SJouni Malinen  *
59916039f6d2SJouni Malinen  * This function is called whenever deauthentication has been processed in
599253b46b84SJouni Malinen  * station mode. This includes both received deauthentication frames and
59938d61ffa5SJohannes Berg  * locally generated ones. This function may sleep. The caller must hold the
59948d61ffa5SJohannes Berg  * corresponding wdev's mutex.
59956039f6d2SJouni Malinen  */
59966ff57cf8SJohannes Berg void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len);
5997ce470613SHolger Schurig 
5998ce470613SHolger Schurig /**
59996ff57cf8SJohannes Berg  * cfg80211_rx_unprot_mlme_mgmt - notification of unprotected mlme mgmt frame
6000cf4e594eSJouni Malinen  * @dev: network device
6001cf4e594eSJouni Malinen  * @buf: deauthentication frame (header + body)
6002cf4e594eSJouni Malinen  * @len: length of the frame data
6003cf4e594eSJouni Malinen  *
60046ff57cf8SJohannes Berg  * This function is called whenever a received deauthentication or dissassoc
60056ff57cf8SJohannes Berg  * frame has been dropped in station mode because of MFP being used but the
6006cf4e594eSJouni Malinen  * frame was not protected. This function may sleep.
6007cf4e594eSJouni Malinen  */
60086ff57cf8SJohannes Berg void cfg80211_rx_unprot_mlme_mgmt(struct net_device *dev,
60096ff57cf8SJohannes Berg 				  const u8 *buf, size_t len);
6010cf4e594eSJouni Malinen 
6011cf4e594eSJouni Malinen /**
6012a3b8b056SJouni Malinen  * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP)
6013a3b8b056SJouni Malinen  * @dev: network device
6014a3b8b056SJouni Malinen  * @addr: The source MAC address of the frame
6015a3b8b056SJouni Malinen  * @key_type: The key type that the received frame used
6016a66b98dbSArik Nemtsov  * @key_id: Key identifier (0..3). Can be -1 if missing.
6017a3b8b056SJouni Malinen  * @tsc: The TSC value of the frame that generated the MIC failure (6 octets)
6018e6d6e342SJohannes Berg  * @gfp: allocation flags
6019a3b8b056SJouni Malinen  *
6020a3b8b056SJouni Malinen  * This function is called whenever the local MAC detects a MIC failure in a
6021a3b8b056SJouni Malinen  * received frame. This matches with MLME-MICHAELMICFAILURE.indication()
6022a3b8b056SJouni Malinen  * primitive.
6023a3b8b056SJouni Malinen  */
6024a3b8b056SJouni Malinen void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,
6025a3b8b056SJouni Malinen 				  enum nl80211_key_type key_type, int key_id,
6026e6d6e342SJohannes Berg 				  const u8 *tsc, gfp_t gfp);
6027a3b8b056SJouni Malinen 
602804a773adSJohannes Berg /**
602904a773adSJohannes Berg  * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS
603004a773adSJohannes Berg  *
603104a773adSJohannes Berg  * @dev: network device
603204a773adSJohannes Berg  * @bssid: the BSSID of the IBSS joined
6033fe94f3a4SAntonio Quartulli  * @channel: the channel of the IBSS joined
603404a773adSJohannes Berg  * @gfp: allocation flags
603504a773adSJohannes Berg  *
603604a773adSJohannes Berg  * This function notifies cfg80211 that the device joined an IBSS or
603704a773adSJohannes Berg  * switched to a different BSSID. Before this function can be called,
603804a773adSJohannes Berg  * either a beacon has to have been received from the IBSS, or one of
603904a773adSJohannes Berg  * the cfg80211_inform_bss{,_frame} functions must have been called
604004a773adSJohannes Berg  * with the locally generated beacon -- this guarantees that there is
604104a773adSJohannes Berg  * always a scan result for this IBSS. cfg80211 will handle the rest.
604204a773adSJohannes Berg  */
6043fe94f3a4SAntonio Quartulli void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid,
6044fe94f3a4SAntonio Quartulli 			  struct ieee80211_channel *channel, gfp_t gfp);
604504a773adSJohannes Berg 
60461f87f7d3SJohannes Berg /**
6047c93b5e71SJavier Cardona  * cfg80211_notify_new_candidate - notify cfg80211 of a new mesh peer candidate
6048c93b5e71SJavier Cardona  *
6049c93b5e71SJavier Cardona  * @dev: network device
6050c93b5e71SJavier Cardona  * @macaddr: the MAC address of the new candidate
6051c93b5e71SJavier Cardona  * @ie: information elements advertised by the peer candidate
60525ac4a12dSMatteo Croce  * @ie_len: length of the information elements buffer
6053c93b5e71SJavier Cardona  * @gfp: allocation flags
6054c93b5e71SJavier Cardona  *
6055c93b5e71SJavier Cardona  * This function notifies cfg80211 that the mesh peer candidate has been
6056c93b5e71SJavier Cardona  * detected, most likely via a beacon or, less likely, via a probe response.
6057c93b5e71SJavier Cardona  * cfg80211 then sends a notification to userspace.
6058c93b5e71SJavier Cardona  */
6059c93b5e71SJavier Cardona void cfg80211_notify_new_peer_candidate(struct net_device *dev,
6060ecbc12adSBob Copeland 		const u8 *macaddr, const u8 *ie, u8 ie_len,
6061ecbc12adSBob Copeland 		int sig_dbm, gfp_t gfp);
6062c93b5e71SJavier Cardona 
6063c93b5e71SJavier Cardona /**
6064d70e9693SJohannes Berg  * DOC: RFkill integration
6065d70e9693SJohannes Berg  *
6066d70e9693SJohannes Berg  * RFkill integration in cfg80211 is almost invisible to drivers,
6067d70e9693SJohannes Berg  * as cfg80211 automatically registers an rfkill instance for each
6068d70e9693SJohannes Berg  * wireless device it knows about. Soft kill is also translated
6069d70e9693SJohannes Berg  * into disconnecting and turning all interfaces off, drivers are
6070d70e9693SJohannes Berg  * expected to turn off the device when all interfaces are down.
6071d70e9693SJohannes Berg  *
6072d70e9693SJohannes Berg  * However, devices may have a hard RFkill line, in which case they
6073d70e9693SJohannes Berg  * also need to interact with the rfkill subsystem, via cfg80211.
6074d70e9693SJohannes Berg  * They can do this with a few helper functions documented here.
6075d70e9693SJohannes Berg  */
6076d70e9693SJohannes Berg 
6077d70e9693SJohannes Berg /**
60781f87f7d3SJohannes Berg  * wiphy_rfkill_set_hw_state - notify cfg80211 about hw block state
60791f87f7d3SJohannes Berg  * @wiphy: the wiphy
60801f87f7d3SJohannes Berg  * @blocked: block status
60811f87f7d3SJohannes Berg  */
60821f87f7d3SJohannes Berg void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked);
60831f87f7d3SJohannes Berg 
60841f87f7d3SJohannes Berg /**
60851f87f7d3SJohannes Berg  * wiphy_rfkill_start_polling - start polling rfkill
60861f87f7d3SJohannes Berg  * @wiphy: the wiphy
60871f87f7d3SJohannes Berg  */
60881f87f7d3SJohannes Berg void wiphy_rfkill_start_polling(struct wiphy *wiphy);
60891f87f7d3SJohannes Berg 
60901f87f7d3SJohannes Berg /**
60911f87f7d3SJohannes Berg  * wiphy_rfkill_stop_polling - stop polling rfkill
60921f87f7d3SJohannes Berg  * @wiphy: the wiphy
60931f87f7d3SJohannes Berg  */
60941f87f7d3SJohannes Berg void wiphy_rfkill_stop_polling(struct wiphy *wiphy);
60951f87f7d3SJohannes Berg 
6096ad7e718cSJohannes Berg /**
6097ad7e718cSJohannes Berg  * DOC: Vendor commands
6098ad7e718cSJohannes Berg  *
6099ad7e718cSJohannes Berg  * Occasionally, there are special protocol or firmware features that
6100ad7e718cSJohannes Berg  * can't be implemented very openly. For this and similar cases, the
6101ad7e718cSJohannes Berg  * vendor command functionality allows implementing the features with
6102ad7e718cSJohannes Berg  * (typically closed-source) userspace and firmware, using nl80211 as
6103ad7e718cSJohannes Berg  * the configuration mechanism.
6104ad7e718cSJohannes Berg  *
6105ad7e718cSJohannes Berg  * A driver supporting vendor commands must register them as an array
6106ad7e718cSJohannes Berg  * in struct wiphy, with handlers for each one, each command has an
6107ad7e718cSJohannes Berg  * OUI and sub command ID to identify it.
6108ad7e718cSJohannes Berg  *
6109ad7e718cSJohannes Berg  * Note that this feature should not be (ab)used to implement protocol
6110ad7e718cSJohannes Berg  * features that could openly be shared across drivers. In particular,
6111ad7e718cSJohannes Berg  * it must never be required to use vendor commands to implement any
6112ad7e718cSJohannes Berg  * "normal" functionality that higher-level userspace like connection
6113ad7e718cSJohannes Berg  * managers etc. need.
6114ad7e718cSJohannes Berg  */
6115ad7e718cSJohannes Berg 
6116ad7e718cSJohannes Berg struct sk_buff *__cfg80211_alloc_reply_skb(struct wiphy *wiphy,
6117ad7e718cSJohannes Berg 					   enum nl80211_commands cmd,
6118ad7e718cSJohannes Berg 					   enum nl80211_attrs attr,
6119ad7e718cSJohannes Berg 					   int approxlen);
6120ad7e718cSJohannes Berg 
6121567ffc35SJohannes Berg struct sk_buff *__cfg80211_alloc_event_skb(struct wiphy *wiphy,
61226c09e791SAhmad Kholaif 					   struct wireless_dev *wdev,
6123567ffc35SJohannes Berg 					   enum nl80211_commands cmd,
6124567ffc35SJohannes Berg 					   enum nl80211_attrs attr,
612555c1fdf0SJohannes Berg 					   unsigned int portid,
6126567ffc35SJohannes Berg 					   int vendor_event_idx,
6127567ffc35SJohannes Berg 					   int approxlen, gfp_t gfp);
6128567ffc35SJohannes Berg 
6129567ffc35SJohannes Berg void __cfg80211_send_event_skb(struct sk_buff *skb, gfp_t gfp);
6130567ffc35SJohannes Berg 
6131ad7e718cSJohannes Berg /**
6132ad7e718cSJohannes Berg  * cfg80211_vendor_cmd_alloc_reply_skb - allocate vendor command reply
6133ad7e718cSJohannes Berg  * @wiphy: the wiphy
6134ad7e718cSJohannes Berg  * @approxlen: an upper bound of the length of the data that will
6135ad7e718cSJohannes Berg  *	be put into the skb
6136ad7e718cSJohannes Berg  *
6137ad7e718cSJohannes Berg  * This function allocates and pre-fills an skb for a reply to
6138ad7e718cSJohannes Berg  * a vendor command. Since it is intended for a reply, calling
6139ad7e718cSJohannes Berg  * it outside of a vendor command's doit() operation is invalid.
6140ad7e718cSJohannes Berg  *
6141ad7e718cSJohannes Berg  * The returned skb is pre-filled with some identifying data in
6142ad7e718cSJohannes Berg  * a way that any data that is put into the skb (with skb_put(),
6143ad7e718cSJohannes Berg  * nla_put() or similar) will end up being within the
6144ad7e718cSJohannes Berg  * %NL80211_ATTR_VENDOR_DATA attribute, so all that needs to be done
6145ad7e718cSJohannes Berg  * with the skb is adding data for the corresponding userspace tool
6146ad7e718cSJohannes Berg  * which can then read that data out of the vendor data attribute.
6147ad7e718cSJohannes Berg  * You must not modify the skb in any other way.
6148ad7e718cSJohannes Berg  *
6149ad7e718cSJohannes Berg  * When done, call cfg80211_vendor_cmd_reply() with the skb and return
6150ad7e718cSJohannes Berg  * its error code as the result of the doit() operation.
6151ad7e718cSJohannes Berg  *
6152ad7e718cSJohannes Berg  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
6153ad7e718cSJohannes Berg  */
6154ad7e718cSJohannes Berg static inline struct sk_buff *
6155ad7e718cSJohannes Berg cfg80211_vendor_cmd_alloc_reply_skb(struct wiphy *wiphy, int approxlen)
6156ad7e718cSJohannes Berg {
6157ad7e718cSJohannes Berg 	return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_VENDOR,
6158ad7e718cSJohannes Berg 					  NL80211_ATTR_VENDOR_DATA, approxlen);
6159ad7e718cSJohannes Berg }
6160ad7e718cSJohannes Berg 
6161ad7e718cSJohannes Berg /**
6162ad7e718cSJohannes Berg  * cfg80211_vendor_cmd_reply - send the reply skb
6163ad7e718cSJohannes Berg  * @skb: The skb, must have been allocated with
6164ad7e718cSJohannes Berg  *	cfg80211_vendor_cmd_alloc_reply_skb()
6165ad7e718cSJohannes Berg  *
6166ad7e718cSJohannes Berg  * Since calling this function will usually be the last thing
6167ad7e718cSJohannes Berg  * before returning from the vendor command doit() you should
6168ad7e718cSJohannes Berg  * return the error code.  Note that this function consumes the
6169ad7e718cSJohannes Berg  * skb regardless of the return value.
6170ad7e718cSJohannes Berg  *
6171ad7e718cSJohannes Berg  * Return: An error code or 0 on success.
6172ad7e718cSJohannes Berg  */
6173ad7e718cSJohannes Berg int cfg80211_vendor_cmd_reply(struct sk_buff *skb);
6174ad7e718cSJohannes Berg 
6175567ffc35SJohannes Berg /**
617655c1fdf0SJohannes Berg  * cfg80211_vendor_cmd_get_sender
617755c1fdf0SJohannes Berg  * @wiphy: the wiphy
617855c1fdf0SJohannes Berg  *
617955c1fdf0SJohannes Berg  * Return the current netlink port ID in a vendor command handler.
618055c1fdf0SJohannes Berg  * Valid to call only there.
618155c1fdf0SJohannes Berg  */
618255c1fdf0SJohannes Berg unsigned int cfg80211_vendor_cmd_get_sender(struct wiphy *wiphy);
618355c1fdf0SJohannes Berg 
618455c1fdf0SJohannes Berg /**
6185567ffc35SJohannes Berg  * cfg80211_vendor_event_alloc - allocate vendor-specific event skb
6186567ffc35SJohannes Berg  * @wiphy: the wiphy
61876c09e791SAhmad Kholaif  * @wdev: the wireless device
6188567ffc35SJohannes Berg  * @event_idx: index of the vendor event in the wiphy's vendor_events
6189567ffc35SJohannes Berg  * @approxlen: an upper bound of the length of the data that will
6190567ffc35SJohannes Berg  *	be put into the skb
6191567ffc35SJohannes Berg  * @gfp: allocation flags
6192567ffc35SJohannes Berg  *
6193567ffc35SJohannes Berg  * This function allocates and pre-fills an skb for an event on the
6194567ffc35SJohannes Berg  * vendor-specific multicast group.
6195567ffc35SJohannes Berg  *
61966c09e791SAhmad Kholaif  * If wdev != NULL, both the ifindex and identifier of the specified
61976c09e791SAhmad Kholaif  * wireless device are added to the event message before the vendor data
61986c09e791SAhmad Kholaif  * attribute.
61996c09e791SAhmad Kholaif  *
6200567ffc35SJohannes Berg  * When done filling the skb, call cfg80211_vendor_event() with the
6201567ffc35SJohannes Berg  * skb to send the event.
6202567ffc35SJohannes Berg  *
6203567ffc35SJohannes Berg  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
6204567ffc35SJohannes Berg  */
6205567ffc35SJohannes Berg static inline struct sk_buff *
62066c09e791SAhmad Kholaif cfg80211_vendor_event_alloc(struct wiphy *wiphy, struct wireless_dev *wdev,
62076c09e791SAhmad Kholaif 			     int approxlen, int event_idx, gfp_t gfp)
6208567ffc35SJohannes Berg {
62096c09e791SAhmad Kholaif 	return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR,
6210567ffc35SJohannes Berg 					  NL80211_ATTR_VENDOR_DATA,
621155c1fdf0SJohannes Berg 					  0, event_idx, approxlen, gfp);
621255c1fdf0SJohannes Berg }
621355c1fdf0SJohannes Berg 
621455c1fdf0SJohannes Berg /**
621555c1fdf0SJohannes Berg  * cfg80211_vendor_event_alloc_ucast - alloc unicast vendor-specific event skb
621655c1fdf0SJohannes Berg  * @wiphy: the wiphy
621755c1fdf0SJohannes Berg  * @wdev: the wireless device
621855c1fdf0SJohannes Berg  * @event_idx: index of the vendor event in the wiphy's vendor_events
621955c1fdf0SJohannes Berg  * @portid: port ID of the receiver
622055c1fdf0SJohannes Berg  * @approxlen: an upper bound of the length of the data that will
622155c1fdf0SJohannes Berg  *	be put into the skb
622255c1fdf0SJohannes Berg  * @gfp: allocation flags
622355c1fdf0SJohannes Berg  *
622455c1fdf0SJohannes Berg  * This function allocates and pre-fills an skb for an event to send to
622555c1fdf0SJohannes Berg  * a specific (userland) socket. This socket would previously have been
622655c1fdf0SJohannes Berg  * obtained by cfg80211_vendor_cmd_get_sender(), and the caller MUST take
622755c1fdf0SJohannes Berg  * care to register a netlink notifier to see when the socket closes.
622855c1fdf0SJohannes Berg  *
622955c1fdf0SJohannes Berg  * If wdev != NULL, both the ifindex and identifier of the specified
623055c1fdf0SJohannes Berg  * wireless device are added to the event message before the vendor data
623155c1fdf0SJohannes Berg  * attribute.
623255c1fdf0SJohannes Berg  *
623355c1fdf0SJohannes Berg  * When done filling the skb, call cfg80211_vendor_event() with the
623455c1fdf0SJohannes Berg  * skb to send the event.
623555c1fdf0SJohannes Berg  *
623655c1fdf0SJohannes Berg  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
623755c1fdf0SJohannes Berg  */
623855c1fdf0SJohannes Berg static inline struct sk_buff *
623955c1fdf0SJohannes Berg cfg80211_vendor_event_alloc_ucast(struct wiphy *wiphy,
624055c1fdf0SJohannes Berg 				  struct wireless_dev *wdev,
624155c1fdf0SJohannes Berg 				  unsigned int portid, int approxlen,
624255c1fdf0SJohannes Berg 				  int event_idx, gfp_t gfp)
624355c1fdf0SJohannes Berg {
624455c1fdf0SJohannes Berg 	return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR,
624555c1fdf0SJohannes Berg 					  NL80211_ATTR_VENDOR_DATA,
624655c1fdf0SJohannes Berg 					  portid, event_idx, approxlen, gfp);
6247567ffc35SJohannes Berg }
6248567ffc35SJohannes Berg 
6249567ffc35SJohannes Berg /**
6250567ffc35SJohannes Berg  * cfg80211_vendor_event - send the event
6251567ffc35SJohannes Berg  * @skb: The skb, must have been allocated with cfg80211_vendor_event_alloc()
6252567ffc35SJohannes Berg  * @gfp: allocation flags
6253567ffc35SJohannes Berg  *
6254567ffc35SJohannes Berg  * This function sends the given @skb, which must have been allocated
6255567ffc35SJohannes Berg  * by cfg80211_vendor_event_alloc(), as an event. It always consumes it.
6256567ffc35SJohannes Berg  */
6257567ffc35SJohannes Berg static inline void cfg80211_vendor_event(struct sk_buff *skb, gfp_t gfp)
6258567ffc35SJohannes Berg {
6259567ffc35SJohannes Berg 	__cfg80211_send_event_skb(skb, gfp);
6260567ffc35SJohannes Berg }
6261567ffc35SJohannes Berg 
6262aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE
6263aff89a9bSJohannes Berg /**
6264d70e9693SJohannes Berg  * DOC: Test mode
6265d70e9693SJohannes Berg  *
6266d70e9693SJohannes Berg  * Test mode is a set of utility functions to allow drivers to
6267d70e9693SJohannes Berg  * interact with driver-specific tools to aid, for instance,
6268d70e9693SJohannes Berg  * factory programming.
6269d70e9693SJohannes Berg  *
6270d70e9693SJohannes Berg  * This chapter describes how drivers interact with it, for more
6271d70e9693SJohannes Berg  * information see the nl80211 book's chapter on it.
6272d70e9693SJohannes Berg  */
6273d70e9693SJohannes Berg 
6274d70e9693SJohannes Berg /**
6275aff89a9bSJohannes Berg  * cfg80211_testmode_alloc_reply_skb - allocate testmode reply
6276aff89a9bSJohannes Berg  * @wiphy: the wiphy
6277aff89a9bSJohannes Berg  * @approxlen: an upper bound of the length of the data that will
6278aff89a9bSJohannes Berg  *	be put into the skb
6279aff89a9bSJohannes Berg  *
6280aff89a9bSJohannes Berg  * This function allocates and pre-fills an skb for a reply to
6281aff89a9bSJohannes Berg  * the testmode command. Since it is intended for a reply, calling
6282aff89a9bSJohannes Berg  * it outside of the @testmode_cmd operation is invalid.
6283aff89a9bSJohannes Berg  *
62840ae997dcSYacine Belkadi  * The returned skb is pre-filled with the wiphy index and set up in
62850ae997dcSYacine Belkadi  * a way that any data that is put into the skb (with skb_put(),
62860ae997dcSYacine Belkadi  * nla_put() or similar) will end up being within the
62870ae997dcSYacine Belkadi  * %NL80211_ATTR_TESTDATA attribute, so all that needs to be done
62880ae997dcSYacine Belkadi  * with the skb is adding data for the corresponding userspace tool
62890ae997dcSYacine Belkadi  * which can then read that data out of the testdata attribute. You
62900ae997dcSYacine Belkadi  * must not modify the skb in any other way.
6291aff89a9bSJohannes Berg  *
6292aff89a9bSJohannes Berg  * When done, call cfg80211_testmode_reply() with the skb and return
6293aff89a9bSJohannes Berg  * its error code as the result of the @testmode_cmd operation.
62940ae997dcSYacine Belkadi  *
62950ae997dcSYacine Belkadi  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
6296aff89a9bSJohannes Berg  */
6297ad7e718cSJohannes Berg static inline struct sk_buff *
6298ad7e718cSJohannes Berg cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy, int approxlen)
6299ad7e718cSJohannes Berg {
6300ad7e718cSJohannes Berg 	return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_TESTMODE,
6301ad7e718cSJohannes Berg 					  NL80211_ATTR_TESTDATA, approxlen);
6302ad7e718cSJohannes Berg }
6303aff89a9bSJohannes Berg 
6304aff89a9bSJohannes Berg /**
6305aff89a9bSJohannes Berg  * cfg80211_testmode_reply - send the reply skb
6306aff89a9bSJohannes Berg  * @skb: The skb, must have been allocated with
6307aff89a9bSJohannes Berg  *	cfg80211_testmode_alloc_reply_skb()
6308aff89a9bSJohannes Berg  *
63090ae997dcSYacine Belkadi  * Since calling this function will usually be the last thing
63100ae997dcSYacine Belkadi  * before returning from the @testmode_cmd you should return
63110ae997dcSYacine Belkadi  * the error code.  Note that this function consumes the skb
63120ae997dcSYacine Belkadi  * regardless of the return value.
63130ae997dcSYacine Belkadi  *
63140ae997dcSYacine Belkadi  * Return: An error code or 0 on success.
6315aff89a9bSJohannes Berg  */
6316ad7e718cSJohannes Berg static inline int cfg80211_testmode_reply(struct sk_buff *skb)
6317ad7e718cSJohannes Berg {
6318ad7e718cSJohannes Berg 	return cfg80211_vendor_cmd_reply(skb);
6319ad7e718cSJohannes Berg }
6320aff89a9bSJohannes Berg 
6321aff89a9bSJohannes Berg /**
6322aff89a9bSJohannes Berg  * cfg80211_testmode_alloc_event_skb - allocate testmode event
6323aff89a9bSJohannes Berg  * @wiphy: the wiphy
6324aff89a9bSJohannes Berg  * @approxlen: an upper bound of the length of the data that will
6325aff89a9bSJohannes Berg  *	be put into the skb
6326aff89a9bSJohannes Berg  * @gfp: allocation flags
6327aff89a9bSJohannes Berg  *
6328aff89a9bSJohannes Berg  * This function allocates and pre-fills an skb for an event on the
6329aff89a9bSJohannes Berg  * testmode multicast group.
6330aff89a9bSJohannes Berg  *
63310ae997dcSYacine Belkadi  * The returned skb is set up in the same way as with
63320ae997dcSYacine Belkadi  * cfg80211_testmode_alloc_reply_skb() but prepared for an event. As
63330ae997dcSYacine Belkadi  * there, you should simply add data to it that will then end up in the
63340ae997dcSYacine Belkadi  * %NL80211_ATTR_TESTDATA attribute. Again, you must not modify the skb
63350ae997dcSYacine Belkadi  * in any other way.
6336aff89a9bSJohannes Berg  *
6337aff89a9bSJohannes Berg  * When done filling the skb, call cfg80211_testmode_event() with the
6338aff89a9bSJohannes Berg  * skb to send the event.
63390ae997dcSYacine Belkadi  *
63400ae997dcSYacine Belkadi  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
6341aff89a9bSJohannes Berg  */
6342567ffc35SJohannes Berg static inline struct sk_buff *
6343567ffc35SJohannes Berg cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy, int approxlen, gfp_t gfp)
6344567ffc35SJohannes Berg {
63456c09e791SAhmad Kholaif 	return __cfg80211_alloc_event_skb(wiphy, NULL, NL80211_CMD_TESTMODE,
634655c1fdf0SJohannes Berg 					  NL80211_ATTR_TESTDATA, 0, -1,
6347567ffc35SJohannes Berg 					  approxlen, gfp);
6348567ffc35SJohannes Berg }
6349aff89a9bSJohannes Berg 
6350aff89a9bSJohannes Berg /**
6351aff89a9bSJohannes Berg  * cfg80211_testmode_event - send the event
6352aff89a9bSJohannes Berg  * @skb: The skb, must have been allocated with
6353aff89a9bSJohannes Berg  *	cfg80211_testmode_alloc_event_skb()
6354aff89a9bSJohannes Berg  * @gfp: allocation flags
6355aff89a9bSJohannes Berg  *
6356aff89a9bSJohannes Berg  * This function sends the given @skb, which must have been allocated
6357aff89a9bSJohannes Berg  * by cfg80211_testmode_alloc_event_skb(), as an event. It always
6358aff89a9bSJohannes Berg  * consumes it.
6359aff89a9bSJohannes Berg  */
6360567ffc35SJohannes Berg static inline void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp)
6361567ffc35SJohannes Berg {
6362567ffc35SJohannes Berg 	__cfg80211_send_event_skb(skb, gfp);
6363567ffc35SJohannes Berg }
6364aff89a9bSJohannes Berg 
6365aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd)	.testmode_cmd = (cmd),
636671063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd)	.testmode_dump = (cmd),
6367aff89a9bSJohannes Berg #else
6368aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd)
636971063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd)
6370aff89a9bSJohannes Berg #endif
6371aff89a9bSJohannes Berg 
6372b23aa676SSamuel Ortiz /**
637376804d28SArend Van Spriel  * struct cfg80211_fils_resp_params - FILS connection response params
637476804d28SArend Van Spriel  * @kek: KEK derived from a successful FILS connection (may be %NULL)
637576804d28SArend Van Spriel  * @kek_len: Length of @fils_kek in octets
637676804d28SArend Van Spriel  * @update_erp_next_seq_num: Boolean value to specify whether the value in
637776804d28SArend Van Spriel  *	@erp_next_seq_num is valid.
637876804d28SArend Van Spriel  * @erp_next_seq_num: The next sequence number to use in ERP message in
637976804d28SArend Van Spriel  *	FILS Authentication. This value should be specified irrespective of the
638076804d28SArend Van Spriel  *	status for a FILS connection.
638176804d28SArend Van Spriel  * @pmk: A new PMK if derived from a successful FILS connection (may be %NULL).
638276804d28SArend Van Spriel  * @pmk_len: Length of @pmk in octets
638376804d28SArend Van Spriel  * @pmkid: A new PMKID if derived from a successful FILS connection or the PMKID
638476804d28SArend Van Spriel  *	used for this FILS connection (may be %NULL).
638576804d28SArend Van Spriel  */
638676804d28SArend Van Spriel struct cfg80211_fils_resp_params {
638776804d28SArend Van Spriel 	const u8 *kek;
638876804d28SArend Van Spriel 	size_t kek_len;
638976804d28SArend Van Spriel 	bool update_erp_next_seq_num;
639076804d28SArend Van Spriel 	u16 erp_next_seq_num;
639176804d28SArend Van Spriel 	const u8 *pmk;
639276804d28SArend Van Spriel 	size_t pmk_len;
639376804d28SArend Van Spriel 	const u8 *pmkid;
639476804d28SArend Van Spriel };
639576804d28SArend Van Spriel 
639676804d28SArend Van Spriel /**
63975349a0f7SVidyullatha Kanchanapally  * struct cfg80211_connect_resp_params - Connection response params
63985349a0f7SVidyullatha Kanchanapally  * @status: Status code, %WLAN_STATUS_SUCCESS for successful connection, use
63995349a0f7SVidyullatha Kanchanapally  *	%WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
64005349a0f7SVidyullatha Kanchanapally  *	the real status code for failures. If this call is used to report a
64015349a0f7SVidyullatha Kanchanapally  *	failure due to a timeout (e.g., not receiving an Authentication frame
64025349a0f7SVidyullatha Kanchanapally  *	from the AP) instead of an explicit rejection by the AP, -1 is used to
64035349a0f7SVidyullatha Kanchanapally  *	indicate that this is a failure, but without a status code.
64045349a0f7SVidyullatha Kanchanapally  *	@timeout_reason is used to report the reason for the timeout in that
64055349a0f7SVidyullatha Kanchanapally  *	case.
64065349a0f7SVidyullatha Kanchanapally  * @bssid: The BSSID of the AP (may be %NULL)
64075349a0f7SVidyullatha Kanchanapally  * @bss: Entry of bss to which STA got connected to, can be obtained through
6408a3ce17d1SChaitanya Tata  *	cfg80211_get_bss() (may be %NULL). But it is recommended to store the
6409a3ce17d1SChaitanya Tata  *	bss from the connect_request and hold a reference to it and return
6410a3ce17d1SChaitanya Tata  *	through this param to avoid a warning if the bss is expired during the
6411a3ce17d1SChaitanya Tata  *	connection, esp. for those drivers implementing connect op.
6412a3ce17d1SChaitanya Tata  *	Only one parameter among @bssid and @bss needs to be specified.
64135349a0f7SVidyullatha Kanchanapally  * @req_ie: Association request IEs (may be %NULL)
64145349a0f7SVidyullatha Kanchanapally  * @req_ie_len: Association request IEs length
64155349a0f7SVidyullatha Kanchanapally  * @resp_ie: Association response IEs (may be %NULL)
64165349a0f7SVidyullatha Kanchanapally  * @resp_ie_len: Association response IEs length
641776804d28SArend Van Spriel  * @fils: FILS connection response parameters.
64185349a0f7SVidyullatha Kanchanapally  * @timeout_reason: Reason for connection timeout. This is used when the
64195349a0f7SVidyullatha Kanchanapally  *	connection fails due to a timeout instead of an explicit rejection from
64205349a0f7SVidyullatha Kanchanapally  *	the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is
64215349a0f7SVidyullatha Kanchanapally  *	not known. This value is used only if @status < 0 to indicate that the
64225349a0f7SVidyullatha Kanchanapally  *	failure is due to a timeout and not due to explicit rejection by the AP.
64235349a0f7SVidyullatha Kanchanapally  *	This value is ignored in other cases (@status >= 0).
64245349a0f7SVidyullatha Kanchanapally  */
64255349a0f7SVidyullatha Kanchanapally struct cfg80211_connect_resp_params {
64265349a0f7SVidyullatha Kanchanapally 	int status;
64275349a0f7SVidyullatha Kanchanapally 	const u8 *bssid;
64285349a0f7SVidyullatha Kanchanapally 	struct cfg80211_bss *bss;
64295349a0f7SVidyullatha Kanchanapally 	const u8 *req_ie;
64305349a0f7SVidyullatha Kanchanapally 	size_t req_ie_len;
64315349a0f7SVidyullatha Kanchanapally 	const u8 *resp_ie;
64325349a0f7SVidyullatha Kanchanapally 	size_t resp_ie_len;
643376804d28SArend Van Spriel 	struct cfg80211_fils_resp_params fils;
64345349a0f7SVidyullatha Kanchanapally 	enum nl80211_timeout_reason timeout_reason;
64355349a0f7SVidyullatha Kanchanapally };
64365349a0f7SVidyullatha Kanchanapally 
64375349a0f7SVidyullatha Kanchanapally /**
64385349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_done - notify cfg80211 of connection result
64395349a0f7SVidyullatha Kanchanapally  *
64405349a0f7SVidyullatha Kanchanapally  * @dev: network device
64415349a0f7SVidyullatha Kanchanapally  * @params: connection response parameters
64425349a0f7SVidyullatha Kanchanapally  * @gfp: allocation flags
64435349a0f7SVidyullatha Kanchanapally  *
64445349a0f7SVidyullatha Kanchanapally  * It should be called by the underlying driver once execution of the connection
64455349a0f7SVidyullatha Kanchanapally  * request from connect() has been completed. This is similar to
64465349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_bss(), but takes a structure pointer for connection response
64475349a0f7SVidyullatha Kanchanapally  * parameters. Only one of the functions among cfg80211_connect_bss(),
64485349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_result(), cfg80211_connect_timeout(),
64495349a0f7SVidyullatha Kanchanapally  * and cfg80211_connect_done() should be called.
64505349a0f7SVidyullatha Kanchanapally  */
64515349a0f7SVidyullatha Kanchanapally void cfg80211_connect_done(struct net_device *dev,
64525349a0f7SVidyullatha Kanchanapally 			   struct cfg80211_connect_resp_params *params,
64535349a0f7SVidyullatha Kanchanapally 			   gfp_t gfp);
64545349a0f7SVidyullatha Kanchanapally 
64555349a0f7SVidyullatha Kanchanapally /**
6456e7054989SKanchanapally, Vidyullatha  * cfg80211_connect_bss - notify cfg80211 of connection result
6457e7054989SKanchanapally, Vidyullatha  *
6458e7054989SKanchanapally, Vidyullatha  * @dev: network device
6459e7054989SKanchanapally, Vidyullatha  * @bssid: the BSSID of the AP
6460a3ce17d1SChaitanya Tata  * @bss: Entry of bss to which STA got connected to, can be obtained through
6461a3ce17d1SChaitanya Tata  *	cfg80211_get_bss() (may be %NULL). But it is recommended to store the
6462a3ce17d1SChaitanya Tata  *	bss from the connect_request and hold a reference to it and return
6463a3ce17d1SChaitanya Tata  *	through this param to avoid a warning if the bss is expired during the
6464a3ce17d1SChaitanya Tata  *	connection, esp. for those drivers implementing connect op.
6465a3ce17d1SChaitanya Tata  *	Only one parameter among @bssid and @bss needs to be specified.
6466e7054989SKanchanapally, Vidyullatha  * @req_ie: association request IEs (maybe be %NULL)
6467e7054989SKanchanapally, Vidyullatha  * @req_ie_len: association request IEs length
6468e7054989SKanchanapally, Vidyullatha  * @resp_ie: association response IEs (may be %NULL)
6469e7054989SKanchanapally, Vidyullatha  * @resp_ie_len: assoc response IEs length
6470c88215d7SJouni Malinen  * @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use
6471e7054989SKanchanapally, Vidyullatha  *	%WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
6472c88215d7SJouni Malinen  *	the real status code for failures. If this call is used to report a
6473c88215d7SJouni Malinen  *	failure due to a timeout (e.g., not receiving an Authentication frame
6474c88215d7SJouni Malinen  *	from the AP) instead of an explicit rejection by the AP, -1 is used to
6475c88215d7SJouni Malinen  *	indicate that this is a failure, but without a status code.
6476c88215d7SJouni Malinen  *	@timeout_reason is used to report the reason for the timeout in that
6477c88215d7SJouni Malinen  *	case.
6478e7054989SKanchanapally, Vidyullatha  * @gfp: allocation flags
64793093ebbeSPurushottam Kushwaha  * @timeout_reason: reason for connection timeout. This is used when the
64803093ebbeSPurushottam Kushwaha  *	connection fails due to a timeout instead of an explicit rejection from
64813093ebbeSPurushottam Kushwaha  *	the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is
64823093ebbeSPurushottam Kushwaha  *	not known. This value is used only if @status < 0 to indicate that the
64833093ebbeSPurushottam Kushwaha  *	failure is due to a timeout and not due to explicit rejection by the AP.
64843093ebbeSPurushottam Kushwaha  *	This value is ignored in other cases (@status >= 0).
6485e7054989SKanchanapally, Vidyullatha  *
6486c88215d7SJouni Malinen  * It should be called by the underlying driver once execution of the connection
6487c88215d7SJouni Malinen  * request from connect() has been completed. This is similar to
6488c88215d7SJouni Malinen  * cfg80211_connect_result(), but with the option of identifying the exact bss
64895349a0f7SVidyullatha Kanchanapally  * entry for the connection. Only one of the functions among
64905349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_bss(), cfg80211_connect_result(),
64915349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
6492e7054989SKanchanapally, Vidyullatha  */
64935349a0f7SVidyullatha Kanchanapally static inline void
64945349a0f7SVidyullatha Kanchanapally cfg80211_connect_bss(struct net_device *dev, const u8 *bssid,
6495e7054989SKanchanapally, Vidyullatha 		     struct cfg80211_bss *bss, const u8 *req_ie,
6496e7054989SKanchanapally, Vidyullatha 		     size_t req_ie_len, const u8 *resp_ie,
64973093ebbeSPurushottam Kushwaha 		     size_t resp_ie_len, int status, gfp_t gfp,
64985349a0f7SVidyullatha Kanchanapally 		     enum nl80211_timeout_reason timeout_reason)
64995349a0f7SVidyullatha Kanchanapally {
65005349a0f7SVidyullatha Kanchanapally 	struct cfg80211_connect_resp_params params;
65015349a0f7SVidyullatha Kanchanapally 
65025349a0f7SVidyullatha Kanchanapally 	memset(&params, 0, sizeof(params));
65035349a0f7SVidyullatha Kanchanapally 	params.status = status;
65045349a0f7SVidyullatha Kanchanapally 	params.bssid = bssid;
65055349a0f7SVidyullatha Kanchanapally 	params.bss = bss;
65065349a0f7SVidyullatha Kanchanapally 	params.req_ie = req_ie;
65075349a0f7SVidyullatha Kanchanapally 	params.req_ie_len = req_ie_len;
65085349a0f7SVidyullatha Kanchanapally 	params.resp_ie = resp_ie;
65095349a0f7SVidyullatha Kanchanapally 	params.resp_ie_len = resp_ie_len;
65105349a0f7SVidyullatha Kanchanapally 	params.timeout_reason = timeout_reason;
65115349a0f7SVidyullatha Kanchanapally 
65125349a0f7SVidyullatha Kanchanapally 	cfg80211_connect_done(dev, &params, gfp);
65135349a0f7SVidyullatha Kanchanapally }
6514e7054989SKanchanapally, Vidyullatha 
6515e7054989SKanchanapally, Vidyullatha /**
6516b23aa676SSamuel Ortiz  * cfg80211_connect_result - notify cfg80211 of connection result
6517b23aa676SSamuel Ortiz  *
6518b23aa676SSamuel Ortiz  * @dev: network device
6519b23aa676SSamuel Ortiz  * @bssid: the BSSID of the AP
6520b23aa676SSamuel Ortiz  * @req_ie: association request IEs (maybe be %NULL)
6521b23aa676SSamuel Ortiz  * @req_ie_len: association request IEs length
6522b23aa676SSamuel Ortiz  * @resp_ie: association response IEs (may be %NULL)
6523b23aa676SSamuel Ortiz  * @resp_ie_len: assoc response IEs length
6524c88215d7SJouni Malinen  * @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use
6525b23aa676SSamuel Ortiz  *	%WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
6526b23aa676SSamuel Ortiz  *	the real status code for failures.
6527b23aa676SSamuel Ortiz  * @gfp: allocation flags
6528b23aa676SSamuel Ortiz  *
6529c88215d7SJouni Malinen  * It should be called by the underlying driver once execution of the connection
6530c88215d7SJouni Malinen  * request from connect() has been completed. This is similar to
6531c88215d7SJouni Malinen  * cfg80211_connect_bss() which allows the exact bss entry to be specified. Only
65325349a0f7SVidyullatha Kanchanapally  * one of the functions among cfg80211_connect_bss(), cfg80211_connect_result(),
65335349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
6534b23aa676SSamuel Ortiz  */
6535e7054989SKanchanapally, Vidyullatha static inline void
6536e7054989SKanchanapally, Vidyullatha cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
6537b23aa676SSamuel Ortiz 			const u8 *req_ie, size_t req_ie_len,
6538b23aa676SSamuel Ortiz 			const u8 *resp_ie, size_t resp_ie_len,
6539e7054989SKanchanapally, Vidyullatha 			u16 status, gfp_t gfp)
6540e7054989SKanchanapally, Vidyullatha {
6541e7054989SKanchanapally, Vidyullatha 	cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, resp_ie,
65423093ebbeSPurushottam Kushwaha 			     resp_ie_len, status, gfp,
65433093ebbeSPurushottam Kushwaha 			     NL80211_TIMEOUT_UNSPECIFIED);
6544e7054989SKanchanapally, Vidyullatha }
6545b23aa676SSamuel Ortiz 
6546b23aa676SSamuel Ortiz /**
6547bf1ecd21SJouni Malinen  * cfg80211_connect_timeout - notify cfg80211 of connection timeout
6548bf1ecd21SJouni Malinen  *
6549bf1ecd21SJouni Malinen  * @dev: network device
6550bf1ecd21SJouni Malinen  * @bssid: the BSSID of the AP
6551bf1ecd21SJouni Malinen  * @req_ie: association request IEs (maybe be %NULL)
6552bf1ecd21SJouni Malinen  * @req_ie_len: association request IEs length
6553bf1ecd21SJouni Malinen  * @gfp: allocation flags
65543093ebbeSPurushottam Kushwaha  * @timeout_reason: reason for connection timeout.
6555bf1ecd21SJouni Malinen  *
6556bf1ecd21SJouni Malinen  * It should be called by the underlying driver whenever connect() has failed
6557bf1ecd21SJouni Malinen  * in a sequence where no explicit authentication/association rejection was
6558bf1ecd21SJouni Malinen  * received from the AP. This could happen, e.g., due to not being able to send
6559bf1ecd21SJouni Malinen  * out the Authentication or Association Request frame or timing out while
65605349a0f7SVidyullatha Kanchanapally  * waiting for the response. Only one of the functions among
65615349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_bss(), cfg80211_connect_result(),
65625349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
6563bf1ecd21SJouni Malinen  */
6564bf1ecd21SJouni Malinen static inline void
6565bf1ecd21SJouni Malinen cfg80211_connect_timeout(struct net_device *dev, const u8 *bssid,
65663093ebbeSPurushottam Kushwaha 			 const u8 *req_ie, size_t req_ie_len, gfp_t gfp,
65673093ebbeSPurushottam Kushwaha 			 enum nl80211_timeout_reason timeout_reason)
6568bf1ecd21SJouni Malinen {
6569bf1ecd21SJouni Malinen 	cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, NULL, 0, -1,
65703093ebbeSPurushottam Kushwaha 			     gfp, timeout_reason);
6571bf1ecd21SJouni Malinen }
6572bf1ecd21SJouni Malinen 
6573bf1ecd21SJouni Malinen /**
657429ce6ecbSAvraham Stern  * struct cfg80211_roam_info - driver initiated roaming information
657529ce6ecbSAvraham Stern  *
657629ce6ecbSAvraham Stern  * @channel: the channel of the new AP
657729ce6ecbSAvraham Stern  * @bss: entry of bss to which STA got roamed (may be %NULL if %bssid is set)
657829ce6ecbSAvraham Stern  * @bssid: the BSSID of the new AP (may be %NULL if %bss is set)
657929ce6ecbSAvraham Stern  * @req_ie: association request IEs (maybe be %NULL)
658029ce6ecbSAvraham Stern  * @req_ie_len: association request IEs length
658129ce6ecbSAvraham Stern  * @resp_ie: association response IEs (may be %NULL)
658229ce6ecbSAvraham Stern  * @resp_ie_len: assoc response IEs length
6583e841b7b1SArend Van Spriel  * @fils: FILS related roaming information.
658429ce6ecbSAvraham Stern  */
658529ce6ecbSAvraham Stern struct cfg80211_roam_info {
658629ce6ecbSAvraham Stern 	struct ieee80211_channel *channel;
658729ce6ecbSAvraham Stern 	struct cfg80211_bss *bss;
658829ce6ecbSAvraham Stern 	const u8 *bssid;
658929ce6ecbSAvraham Stern 	const u8 *req_ie;
659029ce6ecbSAvraham Stern 	size_t req_ie_len;
659129ce6ecbSAvraham Stern 	const u8 *resp_ie;
659229ce6ecbSAvraham Stern 	size_t resp_ie_len;
6593e841b7b1SArend Van Spriel 	struct cfg80211_fils_resp_params fils;
659429ce6ecbSAvraham Stern };
659529ce6ecbSAvraham Stern 
659629ce6ecbSAvraham Stern /**
6597b23aa676SSamuel Ortiz  * cfg80211_roamed - notify cfg80211 of roaming
6598b23aa676SSamuel Ortiz  *
6599b23aa676SSamuel Ortiz  * @dev: network device
660029ce6ecbSAvraham Stern  * @info: information about the new BSS. struct &cfg80211_roam_info.
6601b23aa676SSamuel Ortiz  * @gfp: allocation flags
6602b23aa676SSamuel Ortiz  *
660329ce6ecbSAvraham Stern  * This function may be called with the driver passing either the BSSID of the
660429ce6ecbSAvraham Stern  * new AP or passing the bss entry to avoid a race in timeout of the bss entry.
660529ce6ecbSAvraham Stern  * It should be called by the underlying driver whenever it roamed from one AP
660629ce6ecbSAvraham Stern  * to another while connected. Drivers which have roaming implemented in
660729ce6ecbSAvraham Stern  * firmware should pass the bss entry to avoid a race in bss entry timeout where
660829ce6ecbSAvraham Stern  * the bss entry of the new AP is seen in the driver, but gets timed out by the
660929ce6ecbSAvraham Stern  * time it is accessed in __cfg80211_roamed() due to delay in scheduling
6610adbde344SVasanthakumar Thiagarajan  * rdev->event_work. In case of any failures, the reference is released
661129ce6ecbSAvraham Stern  * either in cfg80211_roamed() or in __cfg80211_romed(), Otherwise, it will be
6612e1b18549SGeert Uytterhoeven  * released while disconnecting from the current bss.
6613adbde344SVasanthakumar Thiagarajan  */
661429ce6ecbSAvraham Stern void cfg80211_roamed(struct net_device *dev, struct cfg80211_roam_info *info,
661529ce6ecbSAvraham Stern 		     gfp_t gfp);
6616adbde344SVasanthakumar Thiagarajan 
6617adbde344SVasanthakumar Thiagarajan /**
6618503c1fb9SAvraham Stern  * cfg80211_port_authorized - notify cfg80211 of successful security association
6619503c1fb9SAvraham Stern  *
6620503c1fb9SAvraham Stern  * @dev: network device
6621503c1fb9SAvraham Stern  * @bssid: the BSSID of the AP
6622503c1fb9SAvraham Stern  * @gfp: allocation flags
6623503c1fb9SAvraham Stern  *
6624503c1fb9SAvraham Stern  * This function should be called by a driver that supports 4 way handshake
6625503c1fb9SAvraham Stern  * offload after a security association was successfully established (i.e.,
6626503c1fb9SAvraham Stern  * the 4 way handshake was completed successfully). The call to this function
6627503c1fb9SAvraham Stern  * should be preceded with a call to cfg80211_connect_result(),
6628503c1fb9SAvraham Stern  * cfg80211_connect_done(), cfg80211_connect_bss() or cfg80211_roamed() to
6629503c1fb9SAvraham Stern  * indicate the 802.11 association.
6630503c1fb9SAvraham Stern  */
6631503c1fb9SAvraham Stern void cfg80211_port_authorized(struct net_device *dev, const u8 *bssid,
6632503c1fb9SAvraham Stern 			      gfp_t gfp);
6633503c1fb9SAvraham Stern 
6634503c1fb9SAvraham Stern /**
6635b23aa676SSamuel Ortiz  * cfg80211_disconnected - notify cfg80211 that connection was dropped
6636b23aa676SSamuel Ortiz  *
6637b23aa676SSamuel Ortiz  * @dev: network device
6638b23aa676SSamuel Ortiz  * @ie: information elements of the deauth/disassoc frame (may be %NULL)
6639b23aa676SSamuel Ortiz  * @ie_len: length of IEs
6640b23aa676SSamuel Ortiz  * @reason: reason code for the disconnection, set it to 0 if unknown
664180279fb7SJohannes Berg  * @locally_generated: disconnection was requested locally
6642b23aa676SSamuel Ortiz  * @gfp: allocation flags
6643b23aa676SSamuel Ortiz  *
6644b23aa676SSamuel Ortiz  * After it calls this function, the driver should enter an idle state
6645b23aa676SSamuel Ortiz  * and not try to connect to any AP any more.
6646b23aa676SSamuel Ortiz  */
6647b23aa676SSamuel Ortiz void cfg80211_disconnected(struct net_device *dev, u16 reason,
664880279fb7SJohannes Berg 			   const u8 *ie, size_t ie_len,
664980279fb7SJohannes Berg 			   bool locally_generated, gfp_t gfp);
6650b23aa676SSamuel Ortiz 
66519588bbd5SJouni Malinen /**
66529588bbd5SJouni Malinen  * cfg80211_ready_on_channel - notification of remain_on_channel start
665371bbc994SJohannes Berg  * @wdev: wireless device
66549588bbd5SJouni Malinen  * @cookie: the request cookie
66559588bbd5SJouni Malinen  * @chan: The current channel (from remain_on_channel request)
66569588bbd5SJouni Malinen  * @duration: Duration in milliseconds that the driver intents to remain on the
66579588bbd5SJouni Malinen  *	channel
66589588bbd5SJouni Malinen  * @gfp: allocation flags
66599588bbd5SJouni Malinen  */
666071bbc994SJohannes Berg void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie,
66619588bbd5SJouni Malinen 			       struct ieee80211_channel *chan,
66629588bbd5SJouni Malinen 			       unsigned int duration, gfp_t gfp);
66639588bbd5SJouni Malinen 
66649588bbd5SJouni Malinen /**
66659588bbd5SJouni Malinen  * cfg80211_remain_on_channel_expired - remain_on_channel duration expired
666671bbc994SJohannes Berg  * @wdev: wireless device
66679588bbd5SJouni Malinen  * @cookie: the request cookie
66689588bbd5SJouni Malinen  * @chan: The current channel (from remain_on_channel request)
66699588bbd5SJouni Malinen  * @gfp: allocation flags
66709588bbd5SJouni Malinen  */
667171bbc994SJohannes Berg void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie,
66729588bbd5SJouni Malinen 					struct ieee80211_channel *chan,
66739588bbd5SJouni Malinen 					gfp_t gfp);
6674b23aa676SSamuel Ortiz 
66758689c051SArend van Spriel /**
66761c38c7f2SJames Prestwood  * cfg80211_tx_mgmt_expired - tx_mgmt duration expired
66771c38c7f2SJames Prestwood  * @wdev: wireless device
66781c38c7f2SJames Prestwood  * @cookie: the requested cookie
66791c38c7f2SJames Prestwood  * @chan: The current channel (from tx_mgmt request)
66801c38c7f2SJames Prestwood  * @gfp: allocation flags
66811c38c7f2SJames Prestwood  */
66821c38c7f2SJames Prestwood void cfg80211_tx_mgmt_expired(struct wireless_dev *wdev, u64 cookie,
66831c38c7f2SJames Prestwood 			      struct ieee80211_channel *chan, gfp_t gfp);
66841c38c7f2SJames Prestwood 
66851c38c7f2SJames Prestwood /**
66868689c051SArend van Spriel  * cfg80211_sinfo_alloc_tid_stats - allocate per-tid statistics.
66878689c051SArend van Spriel  *
66888689c051SArend van Spriel  * @sinfo: the station information
66898689c051SArend van Spriel  * @gfp: allocation flags
66908689c051SArend van Spriel  */
66918689c051SArend van Spriel int cfg80211_sinfo_alloc_tid_stats(struct station_info *sinfo, gfp_t gfp);
669298b62183SJohannes Berg 
669398b62183SJohannes Berg /**
66947ea3e110SJohannes Berg  * cfg80211_sinfo_release_content - release contents of station info
66957ea3e110SJohannes Berg  * @sinfo: the station information
66967ea3e110SJohannes Berg  *
66977ea3e110SJohannes Berg  * Releases any potentially allocated sub-information of the station
66987ea3e110SJohannes Berg  * information, but not the struct itself (since it's typically on
66997ea3e110SJohannes Berg  * the stack.)
67007ea3e110SJohannes Berg  */
67017ea3e110SJohannes Berg static inline void cfg80211_sinfo_release_content(struct station_info *sinfo)
67027ea3e110SJohannes Berg {
67037ea3e110SJohannes Berg 	kfree(sinfo->pertid);
67047ea3e110SJohannes Berg }
67057ea3e110SJohannes Berg 
67067ea3e110SJohannes Berg /**
670798b62183SJohannes Berg  * cfg80211_new_sta - notify userspace about station
670898b62183SJohannes Berg  *
670998b62183SJohannes Berg  * @dev: the netdev
671098b62183SJohannes Berg  * @mac_addr: the station's address
671198b62183SJohannes Berg  * @sinfo: the station information
671298b62183SJohannes Berg  * @gfp: allocation flags
671398b62183SJohannes Berg  */
671498b62183SJohannes Berg void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr,
671598b62183SJohannes Berg 		      struct station_info *sinfo, gfp_t gfp);
671698b62183SJohannes Berg 
6717026331c4SJouni Malinen /**
6718cf5ead82SJohannes Berg  * cfg80211_del_sta_sinfo - notify userspace about deletion of a station
6719cf5ead82SJohannes Berg  * @dev: the netdev
6720cf5ead82SJohannes Berg  * @mac_addr: the station's address
6721cf5ead82SJohannes Berg  * @sinfo: the station information/statistics
6722cf5ead82SJohannes Berg  * @gfp: allocation flags
6723cf5ead82SJohannes Berg  */
6724cf5ead82SJohannes Berg void cfg80211_del_sta_sinfo(struct net_device *dev, const u8 *mac_addr,
6725cf5ead82SJohannes Berg 			    struct station_info *sinfo, gfp_t gfp);
6726cf5ead82SJohannes Berg 
6727cf5ead82SJohannes Berg /**
6728ec15e68bSJouni Malinen  * cfg80211_del_sta - notify userspace about deletion of a station
6729ec15e68bSJouni Malinen  *
6730ec15e68bSJouni Malinen  * @dev: the netdev
6731ec15e68bSJouni Malinen  * @mac_addr: the station's address
6732ec15e68bSJouni Malinen  * @gfp: allocation flags
6733ec15e68bSJouni Malinen  */
6734cf5ead82SJohannes Berg static inline void cfg80211_del_sta(struct net_device *dev,
6735cf5ead82SJohannes Berg 				    const u8 *mac_addr, gfp_t gfp)
6736cf5ead82SJohannes Berg {
6737cf5ead82SJohannes Berg 	cfg80211_del_sta_sinfo(dev, mac_addr, NULL, gfp);
6738cf5ead82SJohannes Berg }
6739ec15e68bSJouni Malinen 
6740ec15e68bSJouni Malinen /**
6741ed44a951SPandiyarajan Pitchaimuthu  * cfg80211_conn_failed - connection request failed notification
6742ed44a951SPandiyarajan Pitchaimuthu  *
6743ed44a951SPandiyarajan Pitchaimuthu  * @dev: the netdev
6744ed44a951SPandiyarajan Pitchaimuthu  * @mac_addr: the station's address
6745ed44a951SPandiyarajan Pitchaimuthu  * @reason: the reason for connection failure
6746ed44a951SPandiyarajan Pitchaimuthu  * @gfp: allocation flags
6747ed44a951SPandiyarajan Pitchaimuthu  *
6748ed44a951SPandiyarajan Pitchaimuthu  * Whenever a station tries to connect to an AP and if the station
6749ed44a951SPandiyarajan Pitchaimuthu  * could not connect to the AP as the AP has rejected the connection
6750ed44a951SPandiyarajan Pitchaimuthu  * for some reasons, this function is called.
6751ed44a951SPandiyarajan Pitchaimuthu  *
6752ed44a951SPandiyarajan Pitchaimuthu  * The reason for connection failure can be any of the value from
6753ed44a951SPandiyarajan Pitchaimuthu  * nl80211_connect_failed_reason enum
6754ed44a951SPandiyarajan Pitchaimuthu  */
6755ed44a951SPandiyarajan Pitchaimuthu void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr,
6756ed44a951SPandiyarajan Pitchaimuthu 			  enum nl80211_connect_failed_reason reason,
6757ed44a951SPandiyarajan Pitchaimuthu 			  gfp_t gfp);
6758ed44a951SPandiyarajan Pitchaimuthu 
6759ed44a951SPandiyarajan Pitchaimuthu /**
67602e161f78SJohannes Berg  * cfg80211_rx_mgmt - notification of received, unprocessed management frame
676171bbc994SJohannes Berg  * @wdev: wireless device receiving the frame
6762026331c4SJouni Malinen  * @freq: Frequency on which the frame was received in MHz
67636c2fb1e6SSergey Matyukevich  * @sig_dbm: signal strength in dBm, or 0 if unknown
67642e161f78SJohannes Berg  * @buf: Management frame (header + body)
6765026331c4SJouni Malinen  * @len: length of the frame data
676619504cf5SVladimir Kondratiev  * @flags: flags, as defined in enum nl80211_rxmgmt_flags
67672e161f78SJohannes Berg  *
67680ae997dcSYacine Belkadi  * This function is called whenever an Action frame is received for a station
67690ae997dcSYacine Belkadi  * mode interface, but is not processed in kernel.
67700ae997dcSYacine Belkadi  *
67710ae997dcSYacine Belkadi  * Return: %true if a user space application has registered for this frame.
67722e161f78SJohannes Berg  * For action frames, that makes it responsible for rejecting unrecognized
67732e161f78SJohannes Berg  * action frames; %false otherwise, in which case for action frames the
67742e161f78SJohannes Berg  * driver is responsible for rejecting the frame.
6775026331c4SJouni Malinen  */
677671bbc994SJohannes Berg bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int sig_dbm,
6777970fdfa8SVladimir Kondratiev 		      const u8 *buf, size_t len, u32 flags);
6778026331c4SJouni Malinen 
6779026331c4SJouni Malinen /**
67802e161f78SJohannes Berg  * cfg80211_mgmt_tx_status - notification of TX status for management frame
678171bbc994SJohannes Berg  * @wdev: wireless device receiving the frame
67822e161f78SJohannes Berg  * @cookie: Cookie returned by cfg80211_ops::mgmt_tx()
67832e161f78SJohannes Berg  * @buf: Management frame (header + body)
6784026331c4SJouni Malinen  * @len: length of the frame data
6785026331c4SJouni Malinen  * @ack: Whether frame was acknowledged
6786026331c4SJouni Malinen  * @gfp: context flags
6787026331c4SJouni Malinen  *
67882e161f78SJohannes Berg  * This function is called whenever a management frame was requested to be
67892e161f78SJohannes Berg  * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the
6790026331c4SJouni Malinen  * transmission attempt.
6791026331c4SJouni Malinen  */
679271bbc994SJohannes Berg void cfg80211_mgmt_tx_status(struct wireless_dev *wdev, u64 cookie,
6793026331c4SJouni Malinen 			     const u8 *buf, size_t len, bool ack, gfp_t gfp);
6794026331c4SJouni Malinen 
6795d6dc1a38SJuuso Oikarinen 
6796d6dc1a38SJuuso Oikarinen /**
67976a671a50SDenis Kenzior  * cfg80211_rx_control_port - notification about a received control port frame
67986a671a50SDenis Kenzior  * @dev: The device the frame matched to
6799a948f713SDenis Kenzior  * @skb: The skbuf with the control port frame.  It is assumed that the skbuf
6800a948f713SDenis Kenzior  *	is 802.3 formatted (with 802.3 header).  The skb can be non-linear.
6801a948f713SDenis Kenzior  *	This function does not take ownership of the skb, so the caller is
6802a948f713SDenis Kenzior  *	responsible for any cleanup.  The caller must also ensure that
6803a948f713SDenis Kenzior  *	skb->protocol is set appropriately.
68046a671a50SDenis Kenzior  * @unencrypted: Whether the frame was received unencrypted
68056a671a50SDenis Kenzior  *
68066a671a50SDenis Kenzior  * This function is used to inform userspace about a received control port
68076a671a50SDenis Kenzior  * frame.  It should only be used if userspace indicated it wants to receive
68086a671a50SDenis Kenzior  * control port frames over nl80211.
68096a671a50SDenis Kenzior  *
68106a671a50SDenis Kenzior  * The frame is the data portion of the 802.3 or 802.11 data frame with all
68116a671a50SDenis Kenzior  * network layer headers removed (e.g. the raw EAPoL frame).
68126a671a50SDenis Kenzior  *
68136a671a50SDenis Kenzior  * Return: %true if the frame was passed to userspace
68146a671a50SDenis Kenzior  */
68156a671a50SDenis Kenzior bool cfg80211_rx_control_port(struct net_device *dev,
6816a948f713SDenis Kenzior 			      struct sk_buff *skb, bool unencrypted);
68176a671a50SDenis Kenzior 
68186a671a50SDenis Kenzior /**
6819d6dc1a38SJuuso Oikarinen  * cfg80211_cqm_rssi_notify - connection quality monitoring rssi event
6820d6dc1a38SJuuso Oikarinen  * @dev: network device
6821d6dc1a38SJuuso Oikarinen  * @rssi_event: the triggered RSSI event
6822bee427b8SAndrzej Zaborowski  * @rssi_level: new RSSI level value or 0 if not available
6823d6dc1a38SJuuso Oikarinen  * @gfp: context flags
6824d6dc1a38SJuuso Oikarinen  *
6825d6dc1a38SJuuso Oikarinen  * This function is called when a configured connection quality monitoring
6826d6dc1a38SJuuso Oikarinen  * rssi threshold reached event occurs.
6827d6dc1a38SJuuso Oikarinen  */
6828d6dc1a38SJuuso Oikarinen void cfg80211_cqm_rssi_notify(struct net_device *dev,
6829d6dc1a38SJuuso Oikarinen 			      enum nl80211_cqm_rssi_threshold_event rssi_event,
6830bee427b8SAndrzej Zaborowski 			      s32 rssi_level, gfp_t gfp);
6831d6dc1a38SJuuso Oikarinen 
6832c063dbf5SJohannes Berg /**
6833c063dbf5SJohannes Berg  * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer
6834c063dbf5SJohannes Berg  * @dev: network device
6835c063dbf5SJohannes Berg  * @peer: peer's MAC address
6836c063dbf5SJohannes Berg  * @num_packets: how many packets were lost -- should be a fixed threshold
6837c063dbf5SJohannes Berg  *	but probably no less than maybe 50, or maybe a throughput dependent
6838c063dbf5SJohannes Berg  *	threshold (to account for temporary interference)
6839c063dbf5SJohannes Berg  * @gfp: context flags
6840c063dbf5SJohannes Berg  */
6841c063dbf5SJohannes Berg void cfg80211_cqm_pktloss_notify(struct net_device *dev,
6842c063dbf5SJohannes Berg 				 const u8 *peer, u32 num_packets, gfp_t gfp);
6843c063dbf5SJohannes Berg 
6844e5497d76SJohannes Berg /**
684584f10708SThomas Pedersen  * cfg80211_cqm_txe_notify - TX error rate event
684684f10708SThomas Pedersen  * @dev: network device
684784f10708SThomas Pedersen  * @peer: peer's MAC address
684884f10708SThomas Pedersen  * @num_packets: how many packets were lost
684984f10708SThomas Pedersen  * @rate: % of packets which failed transmission
685084f10708SThomas Pedersen  * @intvl: interval (in s) over which the TX failure threshold was breached.
685184f10708SThomas Pedersen  * @gfp: context flags
685284f10708SThomas Pedersen  *
685384f10708SThomas Pedersen  * Notify userspace when configured % TX failures over number of packets in a
685484f10708SThomas Pedersen  * given interval is exceeded.
685584f10708SThomas Pedersen  */
685684f10708SThomas Pedersen void cfg80211_cqm_txe_notify(struct net_device *dev, const u8 *peer,
685784f10708SThomas Pedersen 			     u32 num_packets, u32 rate, u32 intvl, gfp_t gfp);
685884f10708SThomas Pedersen 
685984f10708SThomas Pedersen /**
686098f03342SJohannes Berg  * cfg80211_cqm_beacon_loss_notify - beacon loss event
686198f03342SJohannes Berg  * @dev: network device
686298f03342SJohannes Berg  * @gfp: context flags
686398f03342SJohannes Berg  *
686498f03342SJohannes Berg  * Notify userspace about beacon loss from the connected AP.
686598f03342SJohannes Berg  */
686698f03342SJohannes Berg void cfg80211_cqm_beacon_loss_notify(struct net_device *dev, gfp_t gfp);
686798f03342SJohannes Berg 
686898f03342SJohannes Berg /**
68695b97f49dSJohannes Berg  * cfg80211_radar_event - radar detection event
68705b97f49dSJohannes Berg  * @wiphy: the wiphy
68715b97f49dSJohannes Berg  * @chandef: chandef for the current channel
68725b97f49dSJohannes Berg  * @gfp: context flags
68735b97f49dSJohannes Berg  *
68745b97f49dSJohannes Berg  * This function is called when a radar is detected on the current chanenl.
68755b97f49dSJohannes Berg  */
68765b97f49dSJohannes Berg void cfg80211_radar_event(struct wiphy *wiphy,
68775b97f49dSJohannes Berg 			  struct cfg80211_chan_def *chandef, gfp_t gfp);
68785b97f49dSJohannes Berg 
68795b97f49dSJohannes Berg /**
6880466b9936Stamizhr@codeaurora.org  * cfg80211_sta_opmode_change_notify - STA's ht/vht operation mode change event
6881466b9936Stamizhr@codeaurora.org  * @dev: network device
6882466b9936Stamizhr@codeaurora.org  * @mac: MAC address of a station which opmode got modified
6883466b9936Stamizhr@codeaurora.org  * @sta_opmode: station's current opmode value
6884466b9936Stamizhr@codeaurora.org  * @gfp: context flags
6885466b9936Stamizhr@codeaurora.org  *
6886466b9936Stamizhr@codeaurora.org  * Driver should call this function when station's opmode modified via action
6887466b9936Stamizhr@codeaurora.org  * frame.
6888466b9936Stamizhr@codeaurora.org  */
6889466b9936Stamizhr@codeaurora.org void cfg80211_sta_opmode_change_notify(struct net_device *dev, const u8 *mac,
6890466b9936Stamizhr@codeaurora.org 				       struct sta_opmode_info *sta_opmode,
6891466b9936Stamizhr@codeaurora.org 				       gfp_t gfp);
6892466b9936Stamizhr@codeaurora.org 
6893466b9936Stamizhr@codeaurora.org /**
68945b97f49dSJohannes Berg  * cfg80211_cac_event - Channel availability check (CAC) event
68955b97f49dSJohannes Berg  * @netdev: network device
68965b97f49dSJohannes Berg  * @chandef: chandef for the current channel
68975b97f49dSJohannes Berg  * @event: type of event
68985b97f49dSJohannes Berg  * @gfp: context flags
68995b97f49dSJohannes Berg  *
69005b97f49dSJohannes Berg  * This function is called when a Channel availability check (CAC) is finished
69015b97f49dSJohannes Berg  * or aborted. This must be called to notify the completion of a CAC process,
69025b97f49dSJohannes Berg  * also by full-MAC drivers.
69035b97f49dSJohannes Berg  */
69045b97f49dSJohannes Berg void cfg80211_cac_event(struct net_device *netdev,
69055b97f49dSJohannes Berg 			const struct cfg80211_chan_def *chandef,
69065b97f49dSJohannes Berg 			enum nl80211_radar_event event, gfp_t gfp);
69075b97f49dSJohannes Berg 
69085b97f49dSJohannes Berg 
69095b97f49dSJohannes Berg /**
6910e5497d76SJohannes Berg  * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying
6911e5497d76SJohannes Berg  * @dev: network device
6912e5497d76SJohannes Berg  * @bssid: BSSID of AP (to avoid races)
6913e5497d76SJohannes Berg  * @replay_ctr: new replay counter
6914af71ff85SJohannes Berg  * @gfp: allocation flags
6915e5497d76SJohannes Berg  */
6916e5497d76SJohannes Berg void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid,
6917e5497d76SJohannes Berg 			       const u8 *replay_ctr, gfp_t gfp);
6918e5497d76SJohannes Berg 
6919c9df56b4SJouni Malinen /**
6920c9df56b4SJouni Malinen  * cfg80211_pmksa_candidate_notify - notify about PMKSA caching candidate
6921c9df56b4SJouni Malinen  * @dev: network device
6922c9df56b4SJouni Malinen  * @index: candidate index (the smaller the index, the higher the priority)
6923c9df56b4SJouni Malinen  * @bssid: BSSID of AP
6924c9df56b4SJouni Malinen  * @preauth: Whether AP advertises support for RSN pre-authentication
6925c9df56b4SJouni Malinen  * @gfp: allocation flags
6926c9df56b4SJouni Malinen  */
6927c9df56b4SJouni Malinen void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index,
6928c9df56b4SJouni Malinen 				     const u8 *bssid, bool preauth, gfp_t gfp);
6929c9df56b4SJouni Malinen 
693028946da7SJohannes Berg /**
693128946da7SJohannes Berg  * cfg80211_rx_spurious_frame - inform userspace about a spurious frame
693228946da7SJohannes Berg  * @dev: The device the frame matched to
693328946da7SJohannes Berg  * @addr: the transmitter address
693428946da7SJohannes Berg  * @gfp: context flags
693528946da7SJohannes Berg  *
693628946da7SJohannes Berg  * This function is used in AP mode (only!) to inform userspace that
693728946da7SJohannes Berg  * a spurious class 3 frame was received, to be able to deauth the
693828946da7SJohannes Berg  * sender.
69390ae997dcSYacine Belkadi  * Return: %true if the frame was passed to userspace (or this failed
694028946da7SJohannes Berg  * for a reason other than not having a subscription.)
694128946da7SJohannes Berg  */
694228946da7SJohannes Berg bool cfg80211_rx_spurious_frame(struct net_device *dev,
694328946da7SJohannes Berg 				const u8 *addr, gfp_t gfp);
694428946da7SJohannes Berg 
69457f6cf311SJohannes Berg /**
6946b92ab5d8SJohannes Berg  * cfg80211_rx_unexpected_4addr_frame - inform about unexpected WDS frame
6947b92ab5d8SJohannes Berg  * @dev: The device the frame matched to
6948b92ab5d8SJohannes Berg  * @addr: the transmitter address
6949b92ab5d8SJohannes Berg  * @gfp: context flags
6950b92ab5d8SJohannes Berg  *
6951b92ab5d8SJohannes Berg  * This function is used in AP mode (only!) to inform userspace that
6952b92ab5d8SJohannes Berg  * an associated station sent a 4addr frame but that wasn't expected.
6953b92ab5d8SJohannes Berg  * It is allowed and desirable to send this event only once for each
6954b92ab5d8SJohannes Berg  * station to avoid event flooding.
69550ae997dcSYacine Belkadi  * Return: %true if the frame was passed to userspace (or this failed
6956b92ab5d8SJohannes Berg  * for a reason other than not having a subscription.)
6957b92ab5d8SJohannes Berg  */
6958b92ab5d8SJohannes Berg bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev,
6959b92ab5d8SJohannes Berg 					const u8 *addr, gfp_t gfp);
6960b92ab5d8SJohannes Berg 
6961b92ab5d8SJohannes Berg /**
69627f6cf311SJohannes Berg  * cfg80211_probe_status - notify userspace about probe status
69637f6cf311SJohannes Berg  * @dev: the device the probe was sent on
69647f6cf311SJohannes Berg  * @addr: the address of the peer
69657f6cf311SJohannes Berg  * @cookie: the cookie filled in @probe_client previously
69667f6cf311SJohannes Berg  * @acked: indicates whether probe was acked or not
6967c4b50cd3SVenkateswara Naralasetty  * @ack_signal: signal strength (in dBm) of the ACK frame.
6968c4b50cd3SVenkateswara Naralasetty  * @is_valid_ack_signal: indicates the ack_signal is valid or not.
69697f6cf311SJohannes Berg  * @gfp: allocation flags
69707f6cf311SJohannes Berg  */
69717f6cf311SJohannes Berg void cfg80211_probe_status(struct net_device *dev, const u8 *addr,
6972c4b50cd3SVenkateswara Naralasetty 			   u64 cookie, bool acked, s32 ack_signal,
6973c4b50cd3SVenkateswara Naralasetty 			   bool is_valid_ack_signal, gfp_t gfp);
69747f6cf311SJohannes Berg 
69755e760230SJohannes Berg /**
69765e760230SJohannes Berg  * cfg80211_report_obss_beacon - report beacon from other APs
69775e760230SJohannes Berg  * @wiphy: The wiphy that received the beacon
69785e760230SJohannes Berg  * @frame: the frame
69795e760230SJohannes Berg  * @len: length of the frame
69805e760230SJohannes Berg  * @freq: frequency the frame was received on
69816c2fb1e6SSergey Matyukevich  * @sig_dbm: signal strength in dBm, or 0 if unknown
69825e760230SJohannes Berg  *
69835e760230SJohannes Berg  * Use this function to report to userspace when a beacon was
69845e760230SJohannes Berg  * received. It is not useful to call this when there is no
69855e760230SJohannes Berg  * netdev that is in AP/GO mode.
69865e760230SJohannes Berg  */
69875e760230SJohannes Berg void cfg80211_report_obss_beacon(struct wiphy *wiphy,
69885e760230SJohannes Berg 				 const u8 *frame, size_t len,
698937c73b5fSBen Greear 				 int freq, int sig_dbm);
69905e760230SJohannes Berg 
6991d58e7e37SJohannes Berg /**
6992683b6d3bSJohannes Berg  * cfg80211_reg_can_beacon - check if beaconing is allowed
699354858ee5SAlexander Simon  * @wiphy: the wiphy
6994683b6d3bSJohannes Berg  * @chandef: the channel definition
6995174e0cd2SIlan Peer  * @iftype: interface type
6996d58e7e37SJohannes Berg  *
69970ae997dcSYacine Belkadi  * Return: %true if there is no secondary channel or the secondary channel(s)
69980ae997dcSYacine Belkadi  * can be used for beaconing (i.e. is not a radar channel etc.)
699954858ee5SAlexander Simon  */
7000683b6d3bSJohannes Berg bool cfg80211_reg_can_beacon(struct wiphy *wiphy,
7001174e0cd2SIlan Peer 			     struct cfg80211_chan_def *chandef,
7002174e0cd2SIlan Peer 			     enum nl80211_iftype iftype);
700354858ee5SAlexander Simon 
7004923b352fSArik Nemtsov /**
7005923b352fSArik Nemtsov  * cfg80211_reg_can_beacon_relax - check if beaconing is allowed with relaxation
7006923b352fSArik Nemtsov  * @wiphy: the wiphy
7007923b352fSArik Nemtsov  * @chandef: the channel definition
7008923b352fSArik Nemtsov  * @iftype: interface type
7009923b352fSArik Nemtsov  *
7010923b352fSArik Nemtsov  * Return: %true if there is no secondary channel or the secondary channel(s)
7011923b352fSArik Nemtsov  * can be used for beaconing (i.e. is not a radar channel etc.). This version
7012923b352fSArik Nemtsov  * also checks if IR-relaxation conditions apply, to allow beaconing under
7013923b352fSArik Nemtsov  * more permissive conditions.
7014923b352fSArik Nemtsov  *
7015923b352fSArik Nemtsov  * Requires the RTNL to be held.
7016923b352fSArik Nemtsov  */
7017923b352fSArik Nemtsov bool cfg80211_reg_can_beacon_relax(struct wiphy *wiphy,
7018923b352fSArik Nemtsov 				   struct cfg80211_chan_def *chandef,
7019923b352fSArik Nemtsov 				   enum nl80211_iftype iftype);
7020923b352fSArik Nemtsov 
70218097e149SThomas Pedersen /*
70225314526bSThomas Pedersen  * cfg80211_ch_switch_notify - update wdev channel and notify userspace
70235314526bSThomas Pedersen  * @dev: the device which switched channels
7024683b6d3bSJohannes Berg  * @chandef: the new channel definition
70255314526bSThomas Pedersen  *
7026e487eaebSSimon Wunderlich  * Caller must acquire wdev_lock, therefore must only be called from sleepable
7027e487eaebSSimon Wunderlich  * driver context!
70285314526bSThomas Pedersen  */
7029683b6d3bSJohannes Berg void cfg80211_ch_switch_notify(struct net_device *dev,
7030683b6d3bSJohannes Berg 			       struct cfg80211_chan_def *chandef);
70315314526bSThomas Pedersen 
7032f8d7552eSLuciano Coelho /*
7033f8d7552eSLuciano Coelho  * cfg80211_ch_switch_started_notify - notify channel switch start
7034f8d7552eSLuciano Coelho  * @dev: the device on which the channel switch started
7035f8d7552eSLuciano Coelho  * @chandef: the future channel definition
7036f8d7552eSLuciano Coelho  * @count: the number of TBTTs until the channel switch happens
7037f8d7552eSLuciano Coelho  *
7038f8d7552eSLuciano Coelho  * Inform the userspace about the channel switch that has just
7039f8d7552eSLuciano Coelho  * started, so that it can take appropriate actions (eg. starting
7040f8d7552eSLuciano Coelho  * channel switch on other vifs), if necessary.
7041f8d7552eSLuciano Coelho  */
7042f8d7552eSLuciano Coelho void cfg80211_ch_switch_started_notify(struct net_device *dev,
7043f8d7552eSLuciano Coelho 				       struct cfg80211_chan_def *chandef,
7044f8d7552eSLuciano Coelho 				       u8 count);
7045f8d7552eSLuciano Coelho 
70461ce3e82bSJohannes Berg /**
70471ce3e82bSJohannes Berg  * ieee80211_operating_class_to_band - convert operating class to band
70481ce3e82bSJohannes Berg  *
70491ce3e82bSJohannes Berg  * @operating_class: the operating class to convert
70501ce3e82bSJohannes Berg  * @band: band pointer to fill
70511ce3e82bSJohannes Berg  *
70521ce3e82bSJohannes Berg  * Returns %true if the conversion was successful, %false otherwise.
70531ce3e82bSJohannes Berg  */
70541ce3e82bSJohannes Berg bool ieee80211_operating_class_to_band(u8 operating_class,
705557fbcce3SJohannes Berg 				       enum nl80211_band *band);
70561ce3e82bSJohannes Berg 
7057a38700ddSArik Nemtsov /**
7058a38700ddSArik Nemtsov  * ieee80211_chandef_to_operating_class - convert chandef to operation class
7059a38700ddSArik Nemtsov  *
7060a38700ddSArik Nemtsov  * @chandef: the chandef to convert
7061a38700ddSArik Nemtsov  * @op_class: a pointer to the resulting operating class
7062a38700ddSArik Nemtsov  *
7063a38700ddSArik Nemtsov  * Returns %true if the conversion was successful, %false otherwise.
7064a38700ddSArik Nemtsov  */
7065a38700ddSArik Nemtsov bool ieee80211_chandef_to_operating_class(struct cfg80211_chan_def *chandef,
7066a38700ddSArik Nemtsov 					  u8 *op_class);
7067a38700ddSArik Nemtsov 
70685314526bSThomas Pedersen /*
70693475b094SJouni Malinen  * cfg80211_tdls_oper_request - request userspace to perform TDLS operation
70703475b094SJouni Malinen  * @dev: the device on which the operation is requested
70713475b094SJouni Malinen  * @peer: the MAC address of the peer device
70723475b094SJouni Malinen  * @oper: the requested TDLS operation (NL80211_TDLS_SETUP or
70733475b094SJouni Malinen  *	NL80211_TDLS_TEARDOWN)
70743475b094SJouni Malinen  * @reason_code: the reason code for teardown request
70753475b094SJouni Malinen  * @gfp: allocation flags
70763475b094SJouni Malinen  *
70773475b094SJouni Malinen  * This function is used to request userspace to perform TDLS operation that
70783475b094SJouni Malinen  * requires knowledge of keys, i.e., link setup or teardown when the AP
70793475b094SJouni Malinen  * connection uses encryption. This is optional mechanism for the driver to use
70803475b094SJouni Malinen  * if it can automatically determine when a TDLS link could be useful (e.g.,
70813475b094SJouni Malinen  * based on traffic and signal strength for a peer).
70823475b094SJouni Malinen  */
70833475b094SJouni Malinen void cfg80211_tdls_oper_request(struct net_device *dev, const u8 *peer,
70843475b094SJouni Malinen 				enum nl80211_tdls_operation oper,
70853475b094SJouni Malinen 				u16 reason_code, gfp_t gfp);
70863475b094SJouni Malinen 
70873475b094SJouni Malinen /*
70888097e149SThomas Pedersen  * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units)
70898097e149SThomas Pedersen  * @rate: given rate_info to calculate bitrate from
70908097e149SThomas Pedersen  *
70918097e149SThomas Pedersen  * return 0 if MCS index >= 32
70928097e149SThomas Pedersen  */
70938eb41c8dSVladimir Kondratiev u32 cfg80211_calculate_bitrate(struct rate_info *rate);
70948097e149SThomas Pedersen 
709598104fdeSJohannes Berg /**
709698104fdeSJohannes Berg  * cfg80211_unregister_wdev - remove the given wdev
709798104fdeSJohannes Berg  * @wdev: struct wireless_dev to remove
709898104fdeSJohannes Berg  *
709998104fdeSJohannes Berg  * Call this function only for wdevs that have no netdev assigned,
710098104fdeSJohannes Berg  * e.g. P2P Devices. It removes the device from the list so that
710198104fdeSJohannes Berg  * it can no longer be used. It is necessary to call this function
710298104fdeSJohannes Berg  * even when cfg80211 requests the removal of the interface by
710398104fdeSJohannes Berg  * calling the del_virtual_intf() callback. The function must also
710498104fdeSJohannes Berg  * be called when the driver wishes to unregister the wdev, e.g.
710598104fdeSJohannes Berg  * when the device is unbound from the driver.
710698104fdeSJohannes Berg  *
710798104fdeSJohannes Berg  * Requires the RTNL to be held.
710898104fdeSJohannes Berg  */
710998104fdeSJohannes Berg void cfg80211_unregister_wdev(struct wireless_dev *wdev);
711098104fdeSJohannes Berg 
71110ee45355SJohannes Berg /**
7112355199e0SJouni Malinen  * struct cfg80211_ft_event - FT Information Elements
7113355199e0SJouni Malinen  * @ies: FT IEs
7114355199e0SJouni Malinen  * @ies_len: length of the FT IE in bytes
7115355199e0SJouni Malinen  * @target_ap: target AP's MAC address
7116355199e0SJouni Malinen  * @ric_ies: RIC IE
7117355199e0SJouni Malinen  * @ric_ies_len: length of the RIC IE in bytes
7118355199e0SJouni Malinen  */
7119355199e0SJouni Malinen struct cfg80211_ft_event_params {
7120355199e0SJouni Malinen 	const u8 *ies;
7121355199e0SJouni Malinen 	size_t ies_len;
7122355199e0SJouni Malinen 	const u8 *target_ap;
7123355199e0SJouni Malinen 	const u8 *ric_ies;
7124355199e0SJouni Malinen 	size_t ric_ies_len;
7125355199e0SJouni Malinen };
7126355199e0SJouni Malinen 
7127355199e0SJouni Malinen /**
7128355199e0SJouni Malinen  * cfg80211_ft_event - notify userspace about FT IE and RIC IE
7129355199e0SJouni Malinen  * @netdev: network device
7130355199e0SJouni Malinen  * @ft_event: IE information
7131355199e0SJouni Malinen  */
7132355199e0SJouni Malinen void cfg80211_ft_event(struct net_device *netdev,
7133355199e0SJouni Malinen 		       struct cfg80211_ft_event_params *ft_event);
7134355199e0SJouni Malinen 
7135355199e0SJouni Malinen /**
71360ee45355SJohannes Berg  * cfg80211_get_p2p_attr - find and copy a P2P attribute from IE buffer
71370ee45355SJohannes Berg  * @ies: the input IE buffer
71380ee45355SJohannes Berg  * @len: the input length
71390ee45355SJohannes Berg  * @attr: the attribute ID to find
71400ee45355SJohannes Berg  * @buf: output buffer, can be %NULL if the data isn't needed, e.g.
71410ee45355SJohannes Berg  *	if the function is only called to get the needed buffer size
71420ee45355SJohannes Berg  * @bufsize: size of the output buffer
71430ee45355SJohannes Berg  *
71440ee45355SJohannes Berg  * The function finds a given P2P attribute in the (vendor) IEs and
71450ee45355SJohannes Berg  * copies its contents to the given buffer.
71460ee45355SJohannes Berg  *
71470ae997dcSYacine Belkadi  * Return: A negative error code (-%EILSEQ or -%ENOENT) if the data is
71480ae997dcSYacine Belkadi  * malformed or the attribute can't be found (respectively), or the
71490ae997dcSYacine Belkadi  * length of the found attribute (which can be zero).
71500ee45355SJohannes Berg  */
7151c216e641SArend van Spriel int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len,
7152c216e641SArend van Spriel 			  enum ieee80211_p2p_attr_id attr,
7153c216e641SArend van Spriel 			  u8 *buf, unsigned int bufsize);
71540ee45355SJohannes Berg 
7155cd8f7cb4SJohannes Berg /**
715629464cccSJohannes Berg  * ieee80211_ie_split_ric - split an IE buffer according to ordering (with RIC)
715729464cccSJohannes Berg  * @ies: the IE buffer
715829464cccSJohannes Berg  * @ielen: the length of the IE buffer
715929464cccSJohannes Berg  * @ids: an array with element IDs that are allowed before
71602512b1b1SLiad Kaufman  *	the split. A WLAN_EID_EXTENSION value means that the next
71612512b1b1SLiad Kaufman  *	EID in the list is a sub-element of the EXTENSION IE.
716229464cccSJohannes Berg  * @n_ids: the size of the element ID array
716329464cccSJohannes Berg  * @after_ric: array IE types that come after the RIC element
716429464cccSJohannes Berg  * @n_after_ric: size of the @after_ric array
716529464cccSJohannes Berg  * @offset: offset where to start splitting in the buffer
716629464cccSJohannes Berg  *
716729464cccSJohannes Berg  * This function splits an IE buffer by updating the @offset
716829464cccSJohannes Berg  * variable to point to the location where the buffer should be
716929464cccSJohannes Berg  * split.
717029464cccSJohannes Berg  *
717129464cccSJohannes Berg  * It assumes that the given IE buffer is well-formed, this
717229464cccSJohannes Berg  * has to be guaranteed by the caller!
717329464cccSJohannes Berg  *
717429464cccSJohannes Berg  * It also assumes that the IEs in the buffer are ordered
717529464cccSJohannes Berg  * correctly, if not the result of using this function will not
717629464cccSJohannes Berg  * be ordered correctly either, i.e. it does no reordering.
717729464cccSJohannes Berg  *
717829464cccSJohannes Berg  * The function returns the offset where the next part of the
717929464cccSJohannes Berg  * buffer starts, which may be @ielen if the entire (remainder)
718029464cccSJohannes Berg  * of the buffer should be used.
718129464cccSJohannes Berg  */
718229464cccSJohannes Berg size_t ieee80211_ie_split_ric(const u8 *ies, size_t ielen,
718329464cccSJohannes Berg 			      const u8 *ids, int n_ids,
718429464cccSJohannes Berg 			      const u8 *after_ric, int n_after_ric,
718529464cccSJohannes Berg 			      size_t offset);
718629464cccSJohannes Berg 
718729464cccSJohannes Berg /**
718829464cccSJohannes Berg  * ieee80211_ie_split - split an IE buffer according to ordering
718929464cccSJohannes Berg  * @ies: the IE buffer
719029464cccSJohannes Berg  * @ielen: the length of the IE buffer
719129464cccSJohannes Berg  * @ids: an array with element IDs that are allowed before
71922512b1b1SLiad Kaufman  *	the split. A WLAN_EID_EXTENSION value means that the next
71932512b1b1SLiad Kaufman  *	EID in the list is a sub-element of the EXTENSION IE.
719429464cccSJohannes Berg  * @n_ids: the size of the element ID array
719529464cccSJohannes Berg  * @offset: offset where to start splitting in the buffer
719629464cccSJohannes Berg  *
719729464cccSJohannes Berg  * This function splits an IE buffer by updating the @offset
719829464cccSJohannes Berg  * variable to point to the location where the buffer should be
719929464cccSJohannes Berg  * split.
720029464cccSJohannes Berg  *
720129464cccSJohannes Berg  * It assumes that the given IE buffer is well-formed, this
720229464cccSJohannes Berg  * has to be guaranteed by the caller!
720329464cccSJohannes Berg  *
720429464cccSJohannes Berg  * It also assumes that the IEs in the buffer are ordered
720529464cccSJohannes Berg  * correctly, if not the result of using this function will not
720629464cccSJohannes Berg  * be ordered correctly either, i.e. it does no reordering.
720729464cccSJohannes Berg  *
720829464cccSJohannes Berg  * The function returns the offset where the next part of the
720929464cccSJohannes Berg  * buffer starts, which may be @ielen if the entire (remainder)
721029464cccSJohannes Berg  * of the buffer should be used.
721129464cccSJohannes Berg  */
72120483eeacSJohannes Berg static inline size_t ieee80211_ie_split(const u8 *ies, size_t ielen,
72130483eeacSJohannes Berg 					const u8 *ids, int n_ids, size_t offset)
72140483eeacSJohannes Berg {
72150483eeacSJohannes Berg 	return ieee80211_ie_split_ric(ies, ielen, ids, n_ids, NULL, 0, offset);
72160483eeacSJohannes Berg }
721729464cccSJohannes Berg 
721829464cccSJohannes Berg /**
7219cd8f7cb4SJohannes Berg  * cfg80211_report_wowlan_wakeup - report wakeup from WoWLAN
7220cd8f7cb4SJohannes Berg  * @wdev: the wireless device reporting the wakeup
7221cd8f7cb4SJohannes Berg  * @wakeup: the wakeup report
7222cd8f7cb4SJohannes Berg  * @gfp: allocation flags
7223cd8f7cb4SJohannes Berg  *
7224cd8f7cb4SJohannes Berg  * This function reports that the given device woke up. If it
7225cd8f7cb4SJohannes Berg  * caused the wakeup, report the reason(s), otherwise you may
7226cd8f7cb4SJohannes Berg  * pass %NULL as the @wakeup parameter to advertise that something
7227cd8f7cb4SJohannes Berg  * else caused the wakeup.
7228cd8f7cb4SJohannes Berg  */
7229cd8f7cb4SJohannes Berg void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev,
7230cd8f7cb4SJohannes Berg 				   struct cfg80211_wowlan_wakeup *wakeup,
7231cd8f7cb4SJohannes Berg 				   gfp_t gfp);
7232cd8f7cb4SJohannes Berg 
72335de17984SArend van Spriel /**
72345de17984SArend van Spriel  * cfg80211_crit_proto_stopped() - indicate critical protocol stopped by driver.
72355de17984SArend van Spriel  *
72365de17984SArend van Spriel  * @wdev: the wireless device for which critical protocol is stopped.
723703f831a6SRobert P. J. Day  * @gfp: allocation flags
72385de17984SArend van Spriel  *
72395de17984SArend van Spriel  * This function can be called by the driver to indicate it has reverted
72405de17984SArend van Spriel  * operation back to normal. One reason could be that the duration given
72415de17984SArend van Spriel  * by .crit_proto_start() has expired.
72425de17984SArend van Spriel  */
72435de17984SArend van Spriel void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp);
72445de17984SArend van Spriel 
7245bdfbec2dSIlan Peer /**
7246bdfbec2dSIlan Peer  * ieee80211_get_num_supported_channels - get number of channels device has
7247bdfbec2dSIlan Peer  * @wiphy: the wiphy
7248bdfbec2dSIlan Peer  *
7249bdfbec2dSIlan Peer  * Return: the number of channels supported by the device.
7250bdfbec2dSIlan Peer  */
7251bdfbec2dSIlan Peer unsigned int ieee80211_get_num_supported_channels(struct wiphy *wiphy);
7252bdfbec2dSIlan Peer 
7253cb2d956dSLuciano Coelho /**
7254cb2d956dSLuciano Coelho  * cfg80211_check_combinations - check interface combinations
7255cb2d956dSLuciano Coelho  *
7256cb2d956dSLuciano Coelho  * @wiphy: the wiphy
7257e227300cSPurushottam Kushwaha  * @params: the interface combinations parameter
7258cb2d956dSLuciano Coelho  *
7259cb2d956dSLuciano Coelho  * This function can be called by the driver to check whether a
7260cb2d956dSLuciano Coelho  * combination of interfaces and their types are allowed according to
7261cb2d956dSLuciano Coelho  * the interface combinations.
7262cb2d956dSLuciano Coelho  */
7263cb2d956dSLuciano Coelho int cfg80211_check_combinations(struct wiphy *wiphy,
7264e227300cSPurushottam Kushwaha 				struct iface_combination_params *params);
7265cb2d956dSLuciano Coelho 
726665a124ddSMichal Kazior /**
726765a124ddSMichal Kazior  * cfg80211_iter_combinations - iterate over matching combinations
726865a124ddSMichal Kazior  *
726965a124ddSMichal Kazior  * @wiphy: the wiphy
7270e227300cSPurushottam Kushwaha  * @params: the interface combinations parameter
727165a124ddSMichal Kazior  * @iter: function to call for each matching combination
727265a124ddSMichal Kazior  * @data: pointer to pass to iter function
727365a124ddSMichal Kazior  *
727465a124ddSMichal Kazior  * This function can be called by the driver to check what possible
727565a124ddSMichal Kazior  * combinations it fits in at a given moment, e.g. for channel switching
727665a124ddSMichal Kazior  * purposes.
727765a124ddSMichal Kazior  */
727865a124ddSMichal Kazior int cfg80211_iter_combinations(struct wiphy *wiphy,
7279e227300cSPurushottam Kushwaha 			       struct iface_combination_params *params,
728065a124ddSMichal Kazior 			       void (*iter)(const struct ieee80211_iface_combination *c,
728165a124ddSMichal Kazior 					    void *data),
728265a124ddSMichal Kazior 			       void *data);
728365a124ddSMichal Kazior 
7284f04c2203SMichal Kazior /*
7285f04c2203SMichal Kazior  * cfg80211_stop_iface - trigger interface disconnection
7286f04c2203SMichal Kazior  *
7287f04c2203SMichal Kazior  * @wiphy: the wiphy
7288f04c2203SMichal Kazior  * @wdev: wireless device
7289f04c2203SMichal Kazior  * @gfp: context flags
7290f04c2203SMichal Kazior  *
7291f04c2203SMichal Kazior  * Trigger interface to be stopped as if AP was stopped, IBSS/mesh left, STA
7292f04c2203SMichal Kazior  * disconnected.
7293f04c2203SMichal Kazior  *
7294f04c2203SMichal Kazior  * Note: This doesn't need any locks and is asynchronous.
7295f04c2203SMichal Kazior  */
7296f04c2203SMichal Kazior void cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev,
7297f04c2203SMichal Kazior 			 gfp_t gfp);
7298f04c2203SMichal Kazior 
7299f6837ba8SJohannes Berg /**
7300f6837ba8SJohannes Berg  * cfg80211_shutdown_all_interfaces - shut down all interfaces for a wiphy
7301f6837ba8SJohannes Berg  * @wiphy: the wiphy to shut down
7302f6837ba8SJohannes Berg  *
7303f6837ba8SJohannes Berg  * This function shuts down all interfaces belonging to this wiphy by
7304f6837ba8SJohannes Berg  * calling dev_close() (and treating non-netdev interfaces as needed).
7305f6837ba8SJohannes Berg  * It shouldn't really be used unless there are some fatal device errors
7306f6837ba8SJohannes Berg  * that really can't be recovered in any other way.
7307f6837ba8SJohannes Berg  *
7308f6837ba8SJohannes Berg  * Callers must hold the RTNL and be able to deal with callbacks into
7309f6837ba8SJohannes Berg  * the driver while the function is running.
7310f6837ba8SJohannes Berg  */
7311f6837ba8SJohannes Berg void cfg80211_shutdown_all_interfaces(struct wiphy *wiphy);
7312f6837ba8SJohannes Berg 
7313d75bb06bSGautam Kumar Shukla /**
7314d75bb06bSGautam Kumar Shukla  * wiphy_ext_feature_set - set the extended feature flag
7315d75bb06bSGautam Kumar Shukla  *
7316d75bb06bSGautam Kumar Shukla  * @wiphy: the wiphy to modify.
7317d75bb06bSGautam Kumar Shukla  * @ftidx: extended feature bit index.
7318d75bb06bSGautam Kumar Shukla  *
7319d75bb06bSGautam Kumar Shukla  * The extended features are flagged in multiple bytes (see
7320d75bb06bSGautam Kumar Shukla  * &struct wiphy.@ext_features)
7321d75bb06bSGautam Kumar Shukla  */
7322d75bb06bSGautam Kumar Shukla static inline void wiphy_ext_feature_set(struct wiphy *wiphy,
7323d75bb06bSGautam Kumar Shukla 					 enum nl80211_ext_feature_index ftidx)
7324d75bb06bSGautam Kumar Shukla {
7325d75bb06bSGautam Kumar Shukla 	u8 *ft_byte;
7326d75bb06bSGautam Kumar Shukla 
7327d75bb06bSGautam Kumar Shukla 	ft_byte = &wiphy->ext_features[ftidx / 8];
7328d75bb06bSGautam Kumar Shukla 	*ft_byte |= BIT(ftidx % 8);
7329d75bb06bSGautam Kumar Shukla }
7330d75bb06bSGautam Kumar Shukla 
7331d75bb06bSGautam Kumar Shukla /**
7332d75bb06bSGautam Kumar Shukla  * wiphy_ext_feature_isset - check the extended feature flag
7333d75bb06bSGautam Kumar Shukla  *
7334d75bb06bSGautam Kumar Shukla  * @wiphy: the wiphy to modify.
7335d75bb06bSGautam Kumar Shukla  * @ftidx: extended feature bit index.
7336d75bb06bSGautam Kumar Shukla  *
7337d75bb06bSGautam Kumar Shukla  * The extended features are flagged in multiple bytes (see
7338d75bb06bSGautam Kumar Shukla  * &struct wiphy.@ext_features)
7339d75bb06bSGautam Kumar Shukla  */
7340d75bb06bSGautam Kumar Shukla static inline bool
7341d75bb06bSGautam Kumar Shukla wiphy_ext_feature_isset(struct wiphy *wiphy,
7342d75bb06bSGautam Kumar Shukla 			enum nl80211_ext_feature_index ftidx)
7343d75bb06bSGautam Kumar Shukla {
7344d75bb06bSGautam Kumar Shukla 	u8 ft_byte;
7345d75bb06bSGautam Kumar Shukla 
7346d75bb06bSGautam Kumar Shukla 	ft_byte = wiphy->ext_features[ftidx / 8];
7347d75bb06bSGautam Kumar Shukla 	return (ft_byte & BIT(ftidx % 8)) != 0;
7348d75bb06bSGautam Kumar Shukla }
7349b7ffbd7eSJohannes Berg 
7350a442b761SAyala Beker /**
7351a442b761SAyala Beker  * cfg80211_free_nan_func - free NAN function
7352a442b761SAyala Beker  * @f: NAN function that should be freed
7353a442b761SAyala Beker  *
7354a442b761SAyala Beker  * Frees all the NAN function and all it's allocated members.
7355a442b761SAyala Beker  */
7356a442b761SAyala Beker void cfg80211_free_nan_func(struct cfg80211_nan_func *f);
7357a442b761SAyala Beker 
735850bcd31dSAyala Beker /**
735950bcd31dSAyala Beker  * struct cfg80211_nan_match_params - NAN match parameters
736050bcd31dSAyala Beker  * @type: the type of the function that triggered a match. If it is
736150bcd31dSAyala Beker  *	 %NL80211_NAN_FUNC_SUBSCRIBE it means that we replied to a subscriber.
736250bcd31dSAyala Beker  *	 If it is %NL80211_NAN_FUNC_PUBLISH, it means that we got a discovery
736350bcd31dSAyala Beker  *	 result.
736450bcd31dSAyala Beker  *	 If it is %NL80211_NAN_FUNC_FOLLOW_UP, we received a follow up.
736550bcd31dSAyala Beker  * @inst_id: the local instance id
736650bcd31dSAyala Beker  * @peer_inst_id: the instance id of the peer's function
736750bcd31dSAyala Beker  * @addr: the MAC address of the peer
736850bcd31dSAyala Beker  * @info_len: the length of the &info
736950bcd31dSAyala Beker  * @info: the Service Specific Info from the peer (if any)
737050bcd31dSAyala Beker  * @cookie: unique identifier of the corresponding function
737150bcd31dSAyala Beker  */
737250bcd31dSAyala Beker struct cfg80211_nan_match_params {
737350bcd31dSAyala Beker 	enum nl80211_nan_function_type type;
737450bcd31dSAyala Beker 	u8 inst_id;
737550bcd31dSAyala Beker 	u8 peer_inst_id;
737650bcd31dSAyala Beker 	const u8 *addr;
737750bcd31dSAyala Beker 	u8 info_len;
737850bcd31dSAyala Beker 	const u8 *info;
737950bcd31dSAyala Beker 	u64 cookie;
738050bcd31dSAyala Beker };
738150bcd31dSAyala Beker 
738250bcd31dSAyala Beker /**
738350bcd31dSAyala Beker  * cfg80211_nan_match - report a match for a NAN function.
738450bcd31dSAyala Beker  * @wdev: the wireless device reporting the match
738550bcd31dSAyala Beker  * @match: match notification parameters
738650bcd31dSAyala Beker  * @gfp: allocation flags
738750bcd31dSAyala Beker  *
738850bcd31dSAyala Beker  * This function reports that the a NAN function had a match. This
738950bcd31dSAyala Beker  * can be a subscribe that had a match or a solicited publish that
739050bcd31dSAyala Beker  * was sent. It can also be a follow up that was received.
739150bcd31dSAyala Beker  */
739250bcd31dSAyala Beker void cfg80211_nan_match(struct wireless_dev *wdev,
739350bcd31dSAyala Beker 			struct cfg80211_nan_match_params *match, gfp_t gfp);
739450bcd31dSAyala Beker 
7395368e5a7bSAyala Beker /**
7396368e5a7bSAyala Beker  * cfg80211_nan_func_terminated - notify about NAN function termination.
7397368e5a7bSAyala Beker  *
7398368e5a7bSAyala Beker  * @wdev: the wireless device reporting the match
7399368e5a7bSAyala Beker  * @inst_id: the local instance id
7400368e5a7bSAyala Beker  * @reason: termination reason (one of the NL80211_NAN_FUNC_TERM_REASON_*)
7401368e5a7bSAyala Beker  * @cookie: unique NAN function identifier
7402368e5a7bSAyala Beker  * @gfp: allocation flags
7403368e5a7bSAyala Beker  *
7404368e5a7bSAyala Beker  * This function reports that the a NAN function is terminated.
7405368e5a7bSAyala Beker  */
7406368e5a7bSAyala Beker void cfg80211_nan_func_terminated(struct wireless_dev *wdev,
7407368e5a7bSAyala Beker 				  u8 inst_id,
7408368e5a7bSAyala Beker 				  enum nl80211_nan_func_term_reason reason,
7409368e5a7bSAyala Beker 				  u64 cookie, gfp_t gfp);
7410368e5a7bSAyala Beker 
7411b7ffbd7eSJohannes Berg /* ethtool helper */
7412b7ffbd7eSJohannes Berg void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info);
7413b7ffbd7eSJohannes Berg 
741440cbfa90SSrinivas Dasari /**
741540cbfa90SSrinivas Dasari  * cfg80211_external_auth_request - userspace request for authentication
741640cbfa90SSrinivas Dasari  * @netdev: network device
741740cbfa90SSrinivas Dasari  * @params: External authentication parameters
741840cbfa90SSrinivas Dasari  * @gfp: allocation flags
741940cbfa90SSrinivas Dasari  * Returns: 0 on success, < 0 on error
742040cbfa90SSrinivas Dasari  */
742140cbfa90SSrinivas Dasari int cfg80211_external_auth_request(struct net_device *netdev,
742240cbfa90SSrinivas Dasari 				   struct cfg80211_external_auth_params *params,
742340cbfa90SSrinivas Dasari 				   gfp_t gfp);
742440cbfa90SSrinivas Dasari 
74259bb7e0f2SJohannes Berg /**
74269bb7e0f2SJohannes Berg  * cfg80211_pmsr_report - report peer measurement result data
74279bb7e0f2SJohannes Berg  * @wdev: the wireless device reporting the measurement
74289bb7e0f2SJohannes Berg  * @req: the original measurement request
74299bb7e0f2SJohannes Berg  * @result: the result data
74309bb7e0f2SJohannes Berg  * @gfp: allocation flags
74319bb7e0f2SJohannes Berg  */
74329bb7e0f2SJohannes Berg void cfg80211_pmsr_report(struct wireless_dev *wdev,
74339bb7e0f2SJohannes Berg 			  struct cfg80211_pmsr_request *req,
74349bb7e0f2SJohannes Berg 			  struct cfg80211_pmsr_result *result,
74359bb7e0f2SJohannes Berg 			  gfp_t gfp);
74369bb7e0f2SJohannes Berg 
74379bb7e0f2SJohannes Berg /**
74389bb7e0f2SJohannes Berg  * cfg80211_pmsr_complete - report peer measurement completed
74399bb7e0f2SJohannes Berg  * @wdev: the wireless device reporting the measurement
74409bb7e0f2SJohannes Berg  * @req: the original measurement request
74419bb7e0f2SJohannes Berg  * @gfp: allocation flags
74429bb7e0f2SJohannes Berg  *
74439bb7e0f2SJohannes Berg  * Report that the entire measurement completed, after this
74449bb7e0f2SJohannes Berg  * the request pointer will no longer be valid.
74459bb7e0f2SJohannes Berg  */
74469bb7e0f2SJohannes Berg void cfg80211_pmsr_complete(struct wireless_dev *wdev,
74479bb7e0f2SJohannes Berg 			    struct cfg80211_pmsr_request *req,
74489bb7e0f2SJohannes Berg 			    gfp_t gfp);
74499bb7e0f2SJohannes Berg 
7450e6f40511SManikanta Pubbisetty /**
7451e6f40511SManikanta Pubbisetty  * cfg80211_iftype_allowed - check whether the interface can be allowed
7452e6f40511SManikanta Pubbisetty  * @wiphy: the wiphy
7453e6f40511SManikanta Pubbisetty  * @iftype: interface type
7454e6f40511SManikanta Pubbisetty  * @is_4addr: use_4addr flag, must be '0' when check_swif is '1'
7455e6f40511SManikanta Pubbisetty  * @check_swif: check iftype against software interfaces
7456e6f40511SManikanta Pubbisetty  *
7457e6f40511SManikanta Pubbisetty  * Check whether the interface is allowed to operate; additionally, this API
7458e6f40511SManikanta Pubbisetty  * can be used to check iftype against the software interfaces when
7459e6f40511SManikanta Pubbisetty  * check_swif is '1'.
7460e6f40511SManikanta Pubbisetty  */
7461e6f40511SManikanta Pubbisetty bool cfg80211_iftype_allowed(struct wiphy *wiphy, enum nl80211_iftype iftype,
7462e6f40511SManikanta Pubbisetty 			     bool is_4addr, u8 check_swif);
7463e6f40511SManikanta Pubbisetty 
7464e6f40511SManikanta Pubbisetty 
7465e1db74fcSJoe Perches /* Logging, debugging and troubleshooting/diagnostic helpers. */
7466e1db74fcSJoe Perches 
7467e1db74fcSJoe Perches /* wiphy_printk helpers, similar to dev_printk */
7468e1db74fcSJoe Perches 
7469e1db74fcSJoe Perches #define wiphy_printk(level, wiphy, format, args...)		\
74709c376639SJoe Perches 	dev_printk(level, &(wiphy)->dev, format, ##args)
7471e1db74fcSJoe Perches #define wiphy_emerg(wiphy, format, args...)			\
74729c376639SJoe Perches 	dev_emerg(&(wiphy)->dev, format, ##args)
7473e1db74fcSJoe Perches #define wiphy_alert(wiphy, format, args...)			\
74749c376639SJoe Perches 	dev_alert(&(wiphy)->dev, format, ##args)
7475e1db74fcSJoe Perches #define wiphy_crit(wiphy, format, args...)			\
74769c376639SJoe Perches 	dev_crit(&(wiphy)->dev, format, ##args)
7477e1db74fcSJoe Perches #define wiphy_err(wiphy, format, args...)			\
74789c376639SJoe Perches 	dev_err(&(wiphy)->dev, format, ##args)
7479e1db74fcSJoe Perches #define wiphy_warn(wiphy, format, args...)			\
74809c376639SJoe Perches 	dev_warn(&(wiphy)->dev, format, ##args)
7481e1db74fcSJoe Perches #define wiphy_notice(wiphy, format, args...)			\
74829c376639SJoe Perches 	dev_notice(&(wiphy)->dev, format, ##args)
7483e1db74fcSJoe Perches #define wiphy_info(wiphy, format, args...)			\
74849c376639SJoe Perches 	dev_info(&(wiphy)->dev, format, ##args)
7485073730d7SJoe Perches 
7486a58d7525SStanislaw Gruszka #define wiphy_err_ratelimited(wiphy, format, args...)		\
7487a58d7525SStanislaw Gruszka 	dev_err_ratelimited(&(wiphy)->dev, format, ##args)
7488a58d7525SStanislaw Gruszka #define wiphy_warn_ratelimited(wiphy, format, args...)		\
7489a58d7525SStanislaw Gruszka 	dev_warn_ratelimited(&(wiphy)->dev, format, ##args)
7490a58d7525SStanislaw Gruszka 
74919c376639SJoe Perches #define wiphy_debug(wiphy, format, args...)			\
7492e1db74fcSJoe Perches 	wiphy_printk(KERN_DEBUG, wiphy, format, ##args)
74939c376639SJoe Perches 
7494e1db74fcSJoe Perches #define wiphy_dbg(wiphy, format, args...)			\
74959c376639SJoe Perches 	dev_dbg(&(wiphy)->dev, format, ##args)
7496e1db74fcSJoe Perches 
7497e1db74fcSJoe Perches #if defined(VERBOSE_DEBUG)
7498e1db74fcSJoe Perches #define wiphy_vdbg	wiphy_dbg
7499e1db74fcSJoe Perches #else
7500e1db74fcSJoe Perches #define wiphy_vdbg(wiphy, format, args...)				\
7501e1db74fcSJoe Perches ({									\
7502e1db74fcSJoe Perches 	if (0)								\
7503e1db74fcSJoe Perches 		wiphy_printk(KERN_DEBUG, wiphy, format, ##args);	\
7504e1db74fcSJoe Perches 	0;								\
7505e1db74fcSJoe Perches })
7506e1db74fcSJoe Perches #endif
7507e1db74fcSJoe Perches 
7508e1db74fcSJoe Perches /*
7509e1db74fcSJoe Perches  * wiphy_WARN() acts like wiphy_printk(), but with the key difference
7510e1db74fcSJoe Perches  * of using a WARN/WARN_ON to get the message out, including the
7511e1db74fcSJoe Perches  * file/line information and a backtrace.
7512e1db74fcSJoe Perches  */
7513e1db74fcSJoe Perches #define wiphy_WARN(wiphy, format, args...)			\
7514e1db74fcSJoe Perches 	WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args);
7515e1db74fcSJoe Perches 
7516cb74e977SSunil Dutt /**
7517cb74e977SSunil Dutt  * cfg80211_update_owe_info_event - Notify the peer's OWE info to user space
7518cb74e977SSunil Dutt  * @netdev: network device
7519cb74e977SSunil Dutt  * @owe_info: peer's owe info
7520cb74e977SSunil Dutt  * @gfp: allocation flags
7521cb74e977SSunil Dutt  */
7522cb74e977SSunil Dutt void cfg80211_update_owe_info_event(struct net_device *netdev,
7523cb74e977SSunil Dutt 				    struct cfg80211_update_owe_info *owe_info,
7524cb74e977SSunil Dutt 				    gfp_t gfp);
7525cb74e977SSunil Dutt 
7526704232c2SJohannes Berg #endif /* __NET_CFG80211_H */
7527