xref: /linux/include/net/cfg80211.h (revision 9bb7e0f24e7e7d00daa1219b14539e2e602649b2)
1704232c2SJohannes Berg #ifndef __NET_CFG80211_H
2704232c2SJohannes Berg #define __NET_CFG80211_H
3d3236553SJohannes Berg /*
4d3236553SJohannes Berg  * 802.11 device and configuration interface
5d3236553SJohannes Berg  *
6026331c4SJouni Malinen  * Copyright 2006-2010	Johannes Berg <johannes@sipsolutions.net>
72740f0cfSJohannes Berg  * Copyright 2013-2014 Intel Mobile Communications GmbH
88585989dSLuca Coelho  * Copyright 2015-2017	Intel Deutschland GmbH
919d3577eSHaim Dreyfuss  * Copyright (C) 2018 Intel Corporation
10d3236553SJohannes Berg  *
11d3236553SJohannes Berg  * This program is free software; you can redistribute it and/or modify
12d3236553SJohannes Berg  * it under the terms of the GNU General Public License version 2 as
13d3236553SJohannes Berg  * published by the Free Software Foundation.
14d3236553SJohannes Berg  */
15704232c2SJohannes Berg 
16d3236553SJohannes Berg #include <linux/netdevice.h>
17d3236553SJohannes Berg #include <linux/debugfs.h>
18d3236553SJohannes Berg #include <linux/list.h>
19187f1882SPaul Gortmaker #include <linux/bug.h>
20704232c2SJohannes Berg #include <linux/netlink.h>
21704232c2SJohannes Berg #include <linux/skbuff.h>
2255682965SJohannes Berg #include <linux/nl80211.h>
232a519311SJohannes Berg #include <linux/if_ether.h>
242a519311SJohannes Berg #include <linux/ieee80211.h>
252a0e047eSJohannes Berg #include <linux/net.h>
26d3236553SJohannes Berg #include <net/regulatory.h>
27d3236553SJohannes Berg 
28d70e9693SJohannes Berg /**
29d70e9693SJohannes Berg  * DOC: Introduction
30d70e9693SJohannes Berg  *
31d70e9693SJohannes Berg  * cfg80211 is the configuration API for 802.11 devices in Linux. It bridges
32d70e9693SJohannes Berg  * userspace and drivers, and offers some utility functionality associated
33d70e9693SJohannes Berg  * with 802.11. cfg80211 must, directly or indirectly via mac80211, be used
34d70e9693SJohannes Berg  * by all modern wireless drivers in Linux, so that they offer a consistent
35d70e9693SJohannes Berg  * API through nl80211. For backward compatibility, cfg80211 also offers
36d70e9693SJohannes Berg  * wireless extensions to userspace, but hides them from drivers completely.
37d70e9693SJohannes Berg  *
38d70e9693SJohannes Berg  * Additionally, cfg80211 contains code to help enforce regulatory spectrum
39d70e9693SJohannes Berg  * use restrictions.
40d70e9693SJohannes Berg  */
41d70e9693SJohannes Berg 
42d70e9693SJohannes Berg 
43d70e9693SJohannes Berg /**
44d70e9693SJohannes Berg  * DOC: Device registration
45d70e9693SJohannes Berg  *
46d70e9693SJohannes Berg  * In order for a driver to use cfg80211, it must register the hardware device
47d70e9693SJohannes Berg  * with cfg80211. This happens through a number of hardware capability structs
48d70e9693SJohannes Berg  * described below.
49d70e9693SJohannes Berg  *
50d70e9693SJohannes Berg  * The fundamental structure for each device is the 'wiphy', of which each
51d70e9693SJohannes Berg  * instance describes a physical wireless device connected to the system. Each
52d70e9693SJohannes Berg  * such wiphy can have zero, one, or many virtual interfaces associated with
53d70e9693SJohannes Berg  * it, which need to be identified as such by pointing the network interface's
54d70e9693SJohannes Berg  * @ieee80211_ptr pointer to a &struct wireless_dev which further describes
55d70e9693SJohannes Berg  * the wireless part of the interface, normally this struct is embedded in the
56d70e9693SJohannes Berg  * network interface's private data area. Drivers can optionally allow creating
57d70e9693SJohannes Berg  * or destroying virtual interfaces on the fly, but without at least one or the
58d70e9693SJohannes Berg  * ability to create some the wireless device isn't useful.
59d70e9693SJohannes Berg  *
60d70e9693SJohannes Berg  * Each wiphy structure contains device capability information, and also has
61d70e9693SJohannes Berg  * a pointer to the various operations the driver offers. The definitions and
62d70e9693SJohannes Berg  * structures here describe these capabilities in detail.
63d70e9693SJohannes Berg  */
64d70e9693SJohannes Berg 
659f5e8f6eSJohannes Berg struct wiphy;
669f5e8f6eSJohannes Berg 
67704232c2SJohannes Berg /*
68d3236553SJohannes Berg  * wireless hardware capability structures
69d3236553SJohannes Berg  */
70d3236553SJohannes Berg 
71d3236553SJohannes Berg /**
72d3236553SJohannes Berg  * enum ieee80211_channel_flags - channel flags
73d3236553SJohannes Berg  *
74d3236553SJohannes Berg  * Channel flags set by the regulatory control code.
75d3236553SJohannes Berg  *
76d3236553SJohannes Berg  * @IEEE80211_CHAN_DISABLED: This channel is disabled.
778fe02e16SLuis R. Rodriguez  * @IEEE80211_CHAN_NO_IR: do not initiate radiation, this includes
788fe02e16SLuis R. Rodriguez  * 	sending probe requests or beaconing.
79d3236553SJohannes Berg  * @IEEE80211_CHAN_RADAR: Radar detection is required on this channel.
80689da1b3SLuis R. Rodriguez  * @IEEE80211_CHAN_NO_HT40PLUS: extension channel above this channel
81d3236553SJohannes Berg  * 	is not permitted.
82689da1b3SLuis R. Rodriguez  * @IEEE80211_CHAN_NO_HT40MINUS: extension channel below this channel
83d3236553SJohannes Berg  * 	is not permitted.
8403f6b084SSeth Forshee  * @IEEE80211_CHAN_NO_OFDM: OFDM is not allowed on this channel.
85c7a6ee27SJohannes Berg  * @IEEE80211_CHAN_NO_80MHZ: If the driver supports 80 MHz on the band,
86c7a6ee27SJohannes Berg  *	this flag indicates that an 80 MHz channel cannot use this
87c7a6ee27SJohannes Berg  *	channel as the control or any of the secondary channels.
88c7a6ee27SJohannes Berg  *	This may be due to the driver or due to regulatory bandwidth
89c7a6ee27SJohannes Berg  *	restrictions.
90c7a6ee27SJohannes Berg  * @IEEE80211_CHAN_NO_160MHZ: If the driver supports 160 MHz on the band,
91c7a6ee27SJohannes Berg  *	this flag indicates that an 160 MHz channel cannot use this
92c7a6ee27SJohannes Berg  *	channel as the control or any of the secondary channels.
93c7a6ee27SJohannes Berg  *	This may be due to the driver or due to regulatory bandwidth
94c7a6ee27SJohannes Berg  *	restrictions.
95570dbde1SDavid Spinadel  * @IEEE80211_CHAN_INDOOR_ONLY: see %NL80211_FREQUENCY_ATTR_INDOOR_ONLY
9606f207fcSArik Nemtsov  * @IEEE80211_CHAN_IR_CONCURRENT: see %NL80211_FREQUENCY_ATTR_IR_CONCURRENT
97ea077c1cSRostislav Lisovy  * @IEEE80211_CHAN_NO_20MHZ: 20 MHz bandwidth is not permitted
98ea077c1cSRostislav Lisovy  *	on this channel.
99ea077c1cSRostislav Lisovy  * @IEEE80211_CHAN_NO_10MHZ: 10 MHz bandwidth is not permitted
100ea077c1cSRostislav Lisovy  *	on this channel.
101570dbde1SDavid Spinadel  *
102d3236553SJohannes Berg  */
103d3236553SJohannes Berg enum ieee80211_channel_flags {
104d3236553SJohannes Berg 	IEEE80211_CHAN_DISABLED		= 1<<0,
1058fe02e16SLuis R. Rodriguez 	IEEE80211_CHAN_NO_IR		= 1<<1,
1068fe02e16SLuis R. Rodriguez 	/* hole at 1<<2 */
107d3236553SJohannes Berg 	IEEE80211_CHAN_RADAR		= 1<<3,
108689da1b3SLuis R. Rodriguez 	IEEE80211_CHAN_NO_HT40PLUS	= 1<<4,
109689da1b3SLuis R. Rodriguez 	IEEE80211_CHAN_NO_HT40MINUS	= 1<<5,
11003f6b084SSeth Forshee 	IEEE80211_CHAN_NO_OFDM		= 1<<6,
111c7a6ee27SJohannes Berg 	IEEE80211_CHAN_NO_80MHZ		= 1<<7,
112c7a6ee27SJohannes Berg 	IEEE80211_CHAN_NO_160MHZ	= 1<<8,
113570dbde1SDavid Spinadel 	IEEE80211_CHAN_INDOOR_ONLY	= 1<<9,
11406f207fcSArik Nemtsov 	IEEE80211_CHAN_IR_CONCURRENT	= 1<<10,
115ea077c1cSRostislav Lisovy 	IEEE80211_CHAN_NO_20MHZ		= 1<<11,
116ea077c1cSRostislav Lisovy 	IEEE80211_CHAN_NO_10MHZ		= 1<<12,
117d3236553SJohannes Berg };
118d3236553SJohannes Berg 
119038659e7SLuis R. Rodriguez #define IEEE80211_CHAN_NO_HT40 \
120689da1b3SLuis R. Rodriguez 	(IEEE80211_CHAN_NO_HT40PLUS | IEEE80211_CHAN_NO_HT40MINUS)
121038659e7SLuis R. Rodriguez 
12204f39047SSimon Wunderlich #define IEEE80211_DFS_MIN_CAC_TIME_MS		60000
12304f39047SSimon Wunderlich #define IEEE80211_DFS_MIN_NOP_TIME_MS		(30 * 60 * 1000)
12404f39047SSimon Wunderlich 
125d3236553SJohannes Berg /**
126d3236553SJohannes Berg  * struct ieee80211_channel - channel definition
127d3236553SJohannes Berg  *
128d3236553SJohannes Berg  * This structure describes a single channel for use
129d3236553SJohannes Berg  * with cfg80211.
130d3236553SJohannes Berg  *
131d3236553SJohannes Berg  * @center_freq: center frequency in MHz
132d3236553SJohannes Berg  * @hw_value: hardware-specific value for the channel
133d3236553SJohannes Berg  * @flags: channel flags from &enum ieee80211_channel_flags.
134d3236553SJohannes Berg  * @orig_flags: channel flags at registration time, used by regulatory
135d3236553SJohannes Berg  *	code to support devices with additional restrictions
136d3236553SJohannes Berg  * @band: band this channel belongs to.
137d3236553SJohannes Berg  * @max_antenna_gain: maximum antenna gain in dBi
138d3236553SJohannes Berg  * @max_power: maximum transmission power (in dBm)
139eccc068eSHong Wu  * @max_reg_power: maximum regulatory transmission power (in dBm)
140d3236553SJohannes Berg  * @beacon_found: helper to regulatory code to indicate when a beacon
141d3236553SJohannes Berg  *	has been found on this channel. Use regulatory_hint_found_beacon()
14277c2061dSWalter Goldens  *	to enable this, this is useful only on 5 GHz band.
143d3236553SJohannes Berg  * @orig_mag: internal use
144d3236553SJohannes Berg  * @orig_mpwr: internal use
14504f39047SSimon Wunderlich  * @dfs_state: current state of this channel. Only relevant if radar is required
14604f39047SSimon Wunderlich  *	on this channel.
14704f39047SSimon Wunderlich  * @dfs_state_entered: timestamp (jiffies) when the dfs state was entered.
148089027e5SJanusz Dziedzic  * @dfs_cac_ms: DFS CAC time in milliseconds, this is valid for DFS channels.
149d3236553SJohannes Berg  */
150d3236553SJohannes Berg struct ieee80211_channel {
15157fbcce3SJohannes Berg 	enum nl80211_band band;
1529cf0a0b4SAlexei Avshalom Lazar 	u32 center_freq;
153d3236553SJohannes Berg 	u16 hw_value;
154d3236553SJohannes Berg 	u32 flags;
155d3236553SJohannes Berg 	int max_antenna_gain;
156d3236553SJohannes Berg 	int max_power;
157eccc068eSHong Wu 	int max_reg_power;
158d3236553SJohannes Berg 	bool beacon_found;
159d3236553SJohannes Berg 	u32 orig_flags;
160d3236553SJohannes Berg 	int orig_mag, orig_mpwr;
16104f39047SSimon Wunderlich 	enum nl80211_dfs_state dfs_state;
16204f39047SSimon Wunderlich 	unsigned long dfs_state_entered;
163089027e5SJanusz Dziedzic 	unsigned int dfs_cac_ms;
164d3236553SJohannes Berg };
165d3236553SJohannes Berg 
166d3236553SJohannes Berg /**
167d3236553SJohannes Berg  * enum ieee80211_rate_flags - rate flags
168d3236553SJohannes Berg  *
169d3236553SJohannes Berg  * Hardware/specification flags for rates. These are structured
170d3236553SJohannes Berg  * in a way that allows using the same bitrate structure for
171d3236553SJohannes Berg  * different bands/PHY modes.
172d3236553SJohannes Berg  *
173d3236553SJohannes Berg  * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short
174d3236553SJohannes Berg  *	preamble on this bitrate; only relevant in 2.4GHz band and
175d3236553SJohannes Berg  *	with CCK rates.
176d3236553SJohannes Berg  * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate
177d3236553SJohannes Berg  *	when used with 802.11a (on the 5 GHz band); filled by the
178d3236553SJohannes Berg  *	core code when registering the wiphy.
179d3236553SJohannes Berg  * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate
180d3236553SJohannes Berg  *	when used with 802.11b (on the 2.4 GHz band); filled by the
181d3236553SJohannes Berg  *	core code when registering the wiphy.
182d3236553SJohannes Berg  * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate
183d3236553SJohannes Berg  *	when used with 802.11g (on the 2.4 GHz band); filled by the
184d3236553SJohannes Berg  *	core code when registering the wiphy.
185d3236553SJohannes Berg  * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode.
18630e74732SSimon Wunderlich  * @IEEE80211_RATE_SUPPORTS_5MHZ: Rate can be used in 5 MHz mode
18730e74732SSimon Wunderlich  * @IEEE80211_RATE_SUPPORTS_10MHZ: Rate can be used in 10 MHz mode
188d3236553SJohannes Berg  */
189d3236553SJohannes Berg enum ieee80211_rate_flags {
190d3236553SJohannes Berg 	IEEE80211_RATE_SHORT_PREAMBLE	= 1<<0,
191d3236553SJohannes Berg 	IEEE80211_RATE_MANDATORY_A	= 1<<1,
192d3236553SJohannes Berg 	IEEE80211_RATE_MANDATORY_B	= 1<<2,
193d3236553SJohannes Berg 	IEEE80211_RATE_MANDATORY_G	= 1<<3,
194d3236553SJohannes Berg 	IEEE80211_RATE_ERP_G		= 1<<4,
19530e74732SSimon Wunderlich 	IEEE80211_RATE_SUPPORTS_5MHZ	= 1<<5,
19630e74732SSimon Wunderlich 	IEEE80211_RATE_SUPPORTS_10MHZ	= 1<<6,
197d3236553SJohannes Berg };
198d3236553SJohannes Berg 
199d3236553SJohannes Berg /**
2006eb18137SDedy Lansky  * enum ieee80211_bss_type - BSS type filter
2016eb18137SDedy Lansky  *
2026eb18137SDedy Lansky  * @IEEE80211_BSS_TYPE_ESS: Infrastructure BSS
2036eb18137SDedy Lansky  * @IEEE80211_BSS_TYPE_PBSS: Personal BSS
2046eb18137SDedy Lansky  * @IEEE80211_BSS_TYPE_IBSS: Independent BSS
2056eb18137SDedy Lansky  * @IEEE80211_BSS_TYPE_MBSS: Mesh BSS
2066eb18137SDedy Lansky  * @IEEE80211_BSS_TYPE_ANY: Wildcard value for matching any BSS type
2076eb18137SDedy Lansky  */
2086eb18137SDedy Lansky enum ieee80211_bss_type {
2096eb18137SDedy Lansky 	IEEE80211_BSS_TYPE_ESS,
2106eb18137SDedy Lansky 	IEEE80211_BSS_TYPE_PBSS,
2116eb18137SDedy Lansky 	IEEE80211_BSS_TYPE_IBSS,
2126eb18137SDedy Lansky 	IEEE80211_BSS_TYPE_MBSS,
2136eb18137SDedy Lansky 	IEEE80211_BSS_TYPE_ANY
2146eb18137SDedy Lansky };
2156eb18137SDedy Lansky 
2166eb18137SDedy Lansky /**
2176eb18137SDedy Lansky  * enum ieee80211_privacy - BSS privacy filter
2186eb18137SDedy Lansky  *
2196eb18137SDedy Lansky  * @IEEE80211_PRIVACY_ON: privacy bit set
2206eb18137SDedy Lansky  * @IEEE80211_PRIVACY_OFF: privacy bit clear
2216eb18137SDedy Lansky  * @IEEE80211_PRIVACY_ANY: Wildcard value for matching any privacy setting
2226eb18137SDedy Lansky  */
2236eb18137SDedy Lansky enum ieee80211_privacy {
2246eb18137SDedy Lansky 	IEEE80211_PRIVACY_ON,
2256eb18137SDedy Lansky 	IEEE80211_PRIVACY_OFF,
2266eb18137SDedy Lansky 	IEEE80211_PRIVACY_ANY
2276eb18137SDedy Lansky };
2286eb18137SDedy Lansky 
2296eb18137SDedy Lansky #define IEEE80211_PRIVACY(x)	\
2306eb18137SDedy Lansky 	((x) ? IEEE80211_PRIVACY_ON : IEEE80211_PRIVACY_OFF)
2316eb18137SDedy Lansky 
2326eb18137SDedy Lansky /**
233d3236553SJohannes Berg  * struct ieee80211_rate - bitrate definition
234d3236553SJohannes Berg  *
235d3236553SJohannes Berg  * This structure describes a bitrate that an 802.11 PHY can
236d3236553SJohannes Berg  * operate with. The two values @hw_value and @hw_value_short
237d3236553SJohannes Berg  * are only for driver use when pointers to this structure are
238d3236553SJohannes Berg  * passed around.
239d3236553SJohannes Berg  *
240d3236553SJohannes Berg  * @flags: rate-specific flags
241d3236553SJohannes Berg  * @bitrate: bitrate in units of 100 Kbps
242d3236553SJohannes Berg  * @hw_value: driver/hardware value for this rate
243d3236553SJohannes Berg  * @hw_value_short: driver/hardware value for this rate when
244d3236553SJohannes Berg  *	short preamble is used
245d3236553SJohannes Berg  */
246d3236553SJohannes Berg struct ieee80211_rate {
247d3236553SJohannes Berg 	u32 flags;
248d3236553SJohannes Berg 	u16 bitrate;
249d3236553SJohannes Berg 	u16 hw_value, hw_value_short;
250d3236553SJohannes Berg };
251d3236553SJohannes Berg 
252d3236553SJohannes Berg /**
253d3236553SJohannes Berg  * struct ieee80211_sta_ht_cap - STA's HT capabilities
254d3236553SJohannes Berg  *
255d3236553SJohannes Berg  * This structure describes most essential parameters needed
256d3236553SJohannes Berg  * to describe 802.11n HT capabilities for an STA.
257d3236553SJohannes Berg  *
258d3236553SJohannes Berg  * @ht_supported: is HT supported by the STA
259d3236553SJohannes Berg  * @cap: HT capabilities map as described in 802.11n spec
260d3236553SJohannes Berg  * @ampdu_factor: Maximum A-MPDU length factor
261d3236553SJohannes Berg  * @ampdu_density: Minimum A-MPDU spacing
262d3236553SJohannes Berg  * @mcs: Supported MCS rates
263d3236553SJohannes Berg  */
264d3236553SJohannes Berg struct ieee80211_sta_ht_cap {
265d3236553SJohannes Berg 	u16 cap; /* use IEEE80211_HT_CAP_ */
266d3236553SJohannes Berg 	bool ht_supported;
267d3236553SJohannes Berg 	u8 ampdu_factor;
268d3236553SJohannes Berg 	u8 ampdu_density;
269d3236553SJohannes Berg 	struct ieee80211_mcs_info mcs;
270d3236553SJohannes Berg };
271d3236553SJohannes Berg 
272d3236553SJohannes Berg /**
273bf0c111eSMahesh Palivela  * struct ieee80211_sta_vht_cap - STA's VHT capabilities
274bf0c111eSMahesh Palivela  *
275bf0c111eSMahesh Palivela  * This structure describes most essential parameters needed
276bf0c111eSMahesh Palivela  * to describe 802.11ac VHT capabilities for an STA.
277bf0c111eSMahesh Palivela  *
278bf0c111eSMahesh Palivela  * @vht_supported: is VHT supported by the STA
279bf0c111eSMahesh Palivela  * @cap: VHT capabilities map as described in 802.11ac spec
280bf0c111eSMahesh Palivela  * @vht_mcs: Supported VHT MCS rates
281bf0c111eSMahesh Palivela  */
282bf0c111eSMahesh Palivela struct ieee80211_sta_vht_cap {
283bf0c111eSMahesh Palivela 	bool vht_supported;
284bf0c111eSMahesh Palivela 	u32 cap; /* use IEEE80211_VHT_CAP_ */
285bf0c111eSMahesh Palivela 	struct ieee80211_vht_mcs_info vht_mcs;
286bf0c111eSMahesh Palivela };
287bf0c111eSMahesh Palivela 
288c4cbaf79SLuca Coelho #define IEEE80211_HE_PPE_THRES_MAX_LEN		25
289c4cbaf79SLuca Coelho 
290c4cbaf79SLuca Coelho /**
291c4cbaf79SLuca Coelho  * struct ieee80211_sta_he_cap - STA's HE capabilities
292c4cbaf79SLuca Coelho  *
293c4cbaf79SLuca Coelho  * This structure describes most essential parameters needed
294c4cbaf79SLuca Coelho  * to describe 802.11ax HE capabilities for a STA.
295c4cbaf79SLuca Coelho  *
296c4cbaf79SLuca Coelho  * @has_he: true iff HE data is valid.
297c4cbaf79SLuca Coelho  * @he_cap_elem: Fixed portion of the HE capabilities element.
298c4cbaf79SLuca Coelho  * @he_mcs_nss_supp: The supported NSS/MCS combinations.
299c4cbaf79SLuca Coelho  * @ppe_thres: Holds the PPE Thresholds data.
300c4cbaf79SLuca Coelho  */
301c4cbaf79SLuca Coelho struct ieee80211_sta_he_cap {
302c4cbaf79SLuca Coelho 	bool has_he;
303c4cbaf79SLuca Coelho 	struct ieee80211_he_cap_elem he_cap_elem;
304c4cbaf79SLuca Coelho 	struct ieee80211_he_mcs_nss_supp he_mcs_nss_supp;
305c4cbaf79SLuca Coelho 	u8 ppe_thres[IEEE80211_HE_PPE_THRES_MAX_LEN];
306c4cbaf79SLuca Coelho };
307c4cbaf79SLuca Coelho 
308c4cbaf79SLuca Coelho /**
309c4cbaf79SLuca Coelho  * struct ieee80211_sband_iftype_data
310c4cbaf79SLuca Coelho  *
311c4cbaf79SLuca Coelho  * This structure encapsulates sband data that is relevant for the
312c4cbaf79SLuca Coelho  * interface types defined in @types_mask.  Each type in the
313c4cbaf79SLuca Coelho  * @types_mask must be unique across all instances of iftype_data.
314c4cbaf79SLuca Coelho  *
315c4cbaf79SLuca Coelho  * @types_mask: interface types mask
316c4cbaf79SLuca Coelho  * @he_cap: holds the HE capabilities
317c4cbaf79SLuca Coelho  */
318c4cbaf79SLuca Coelho struct ieee80211_sband_iftype_data {
319c4cbaf79SLuca Coelho 	u16 types_mask;
320c4cbaf79SLuca Coelho 	struct ieee80211_sta_he_cap he_cap;
321c4cbaf79SLuca Coelho };
322c4cbaf79SLuca Coelho 
323bf0c111eSMahesh Palivela /**
324d3236553SJohannes Berg  * struct ieee80211_supported_band - frequency band definition
325d3236553SJohannes Berg  *
326d3236553SJohannes Berg  * This structure describes a frequency band a wiphy
327d3236553SJohannes Berg  * is able to operate in.
328d3236553SJohannes Berg  *
329d3236553SJohannes Berg  * @channels: Array of channels the hardware can operate in
330d3236553SJohannes Berg  *	in this band.
331d3236553SJohannes Berg  * @band: the band this structure represents
332d3236553SJohannes Berg  * @n_channels: Number of channels in @channels
333d3236553SJohannes Berg  * @bitrates: Array of bitrates the hardware can operate with
334d3236553SJohannes Berg  *	in this band. Must be sorted to give a valid "supported
335d3236553SJohannes Berg  *	rates" IE, i.e. CCK rates first, then OFDM.
336d3236553SJohannes Berg  * @n_bitrates: Number of bitrates in @bitrates
337abe37c4bSJohannes Berg  * @ht_cap: HT capabilities in this band
338c9a0a302SRobert P. J. Day  * @vht_cap: VHT capabilities in this band
339c4cbaf79SLuca Coelho  * @n_iftype_data: number of iftype data entries
340c4cbaf79SLuca Coelho  * @iftype_data: interface type data entries.  Note that the bits in
341c4cbaf79SLuca Coelho  *	@types_mask inside this structure cannot overlap (i.e. only
342c4cbaf79SLuca Coelho  *	one occurrence of each type is allowed across all instances of
343c4cbaf79SLuca Coelho  *	iftype_data).
344d3236553SJohannes Berg  */
345d3236553SJohannes Berg struct ieee80211_supported_band {
346d3236553SJohannes Berg 	struct ieee80211_channel *channels;
347d3236553SJohannes Berg 	struct ieee80211_rate *bitrates;
34857fbcce3SJohannes Berg 	enum nl80211_band band;
349d3236553SJohannes Berg 	int n_channels;
350d3236553SJohannes Berg 	int n_bitrates;
351d3236553SJohannes Berg 	struct ieee80211_sta_ht_cap ht_cap;
352bf0c111eSMahesh Palivela 	struct ieee80211_sta_vht_cap vht_cap;
353c4cbaf79SLuca Coelho 	u16 n_iftype_data;
354c4cbaf79SLuca Coelho 	const struct ieee80211_sband_iftype_data *iftype_data;
355d3236553SJohannes Berg };
356d3236553SJohannes Berg 
357e691ac2fSRafał Miłecki /**
358c4cbaf79SLuca Coelho  * ieee80211_get_sband_iftype_data - return sband data for a given iftype
359c4cbaf79SLuca Coelho  * @sband: the sband to search for the STA on
360c4cbaf79SLuca Coelho  * @iftype: enum nl80211_iftype
361c4cbaf79SLuca Coelho  *
362c4cbaf79SLuca Coelho  * Return: pointer to struct ieee80211_sband_iftype_data, or NULL is none found
363c4cbaf79SLuca Coelho  */
364c4cbaf79SLuca Coelho static inline const struct ieee80211_sband_iftype_data *
365c4cbaf79SLuca Coelho ieee80211_get_sband_iftype_data(const struct ieee80211_supported_band *sband,
366c4cbaf79SLuca Coelho 				u8 iftype)
367c4cbaf79SLuca Coelho {
368c4cbaf79SLuca Coelho 	int i;
369c4cbaf79SLuca Coelho 
370c4cbaf79SLuca Coelho 	if (WARN_ON(iftype >= NL80211_IFTYPE_MAX))
371c4cbaf79SLuca Coelho 		return NULL;
372c4cbaf79SLuca Coelho 
373c4cbaf79SLuca Coelho 	for (i = 0; i < sband->n_iftype_data; i++)  {
374c4cbaf79SLuca Coelho 		const struct ieee80211_sband_iftype_data *data =
375c4cbaf79SLuca Coelho 			&sband->iftype_data[i];
376c4cbaf79SLuca Coelho 
377c4cbaf79SLuca Coelho 		if (data->types_mask & BIT(iftype))
378c4cbaf79SLuca Coelho 			return data;
379c4cbaf79SLuca Coelho 	}
380c4cbaf79SLuca Coelho 
381c4cbaf79SLuca Coelho 	return NULL;
382c4cbaf79SLuca Coelho }
383c4cbaf79SLuca Coelho 
384c4cbaf79SLuca Coelho /**
385c4cbaf79SLuca Coelho  * ieee80211_get_he_sta_cap - return HE capabilities for an sband's STA
386c4cbaf79SLuca Coelho  * @sband: the sband to search for the STA on
387c4cbaf79SLuca Coelho  *
388c4cbaf79SLuca Coelho  * Return: pointer to the struct ieee80211_sta_he_cap, or NULL is none found
389c4cbaf79SLuca Coelho  */
390c4cbaf79SLuca Coelho static inline const struct ieee80211_sta_he_cap *
391c4cbaf79SLuca Coelho ieee80211_get_he_sta_cap(const struct ieee80211_supported_band *sband)
392c4cbaf79SLuca Coelho {
393c4cbaf79SLuca Coelho 	const struct ieee80211_sband_iftype_data *data =
394c4cbaf79SLuca Coelho 		ieee80211_get_sband_iftype_data(sband, NL80211_IFTYPE_STATION);
395c4cbaf79SLuca Coelho 
396c4cbaf79SLuca Coelho 	if (data && data->he_cap.has_he)
397c4cbaf79SLuca Coelho 		return &data->he_cap;
398c4cbaf79SLuca Coelho 
399c4cbaf79SLuca Coelho 	return NULL;
400c4cbaf79SLuca Coelho }
401c4cbaf79SLuca Coelho 
402c4cbaf79SLuca Coelho /**
403e691ac2fSRafał Miłecki  * wiphy_read_of_freq_limits - read frequency limits from device tree
404e691ac2fSRafał Miłecki  *
405e691ac2fSRafał Miłecki  * @wiphy: the wireless device to get extra limits for
406e691ac2fSRafał Miłecki  *
407e691ac2fSRafał Miłecki  * Some devices may have extra limitations specified in DT. This may be useful
408e691ac2fSRafał Miłecki  * for chipsets that normally support more bands but are limited due to board
409e691ac2fSRafał Miłecki  * design (e.g. by antennas or external power amplifier).
410e691ac2fSRafał Miłecki  *
411e691ac2fSRafał Miłecki  * This function reads info from DT and uses it to *modify* channels (disable
412e691ac2fSRafał Miłecki  * unavailable ones). It's usually a *bad* idea to use it in drivers with
413e691ac2fSRafał Miłecki  * shared channel data as DT limitations are device specific. You should make
414e691ac2fSRafał Miłecki  * sure to call it only if channels in wiphy are copied and can be modified
415e691ac2fSRafał Miłecki  * without affecting other devices.
416e691ac2fSRafał Miłecki  *
417e691ac2fSRafał Miłecki  * As this function access device node it has to be called after set_wiphy_dev.
418e691ac2fSRafał Miłecki  * It also modifies channels so they have to be set first.
419e691ac2fSRafał Miłecki  * If using this helper, call it before wiphy_register().
420e691ac2fSRafał Miłecki  */
421e691ac2fSRafał Miłecki #ifdef CONFIG_OF
422e691ac2fSRafał Miłecki void wiphy_read_of_freq_limits(struct wiphy *wiphy);
423e691ac2fSRafał Miłecki #else /* CONFIG_OF */
424e691ac2fSRafał Miłecki static inline void wiphy_read_of_freq_limits(struct wiphy *wiphy)
425e691ac2fSRafał Miłecki {
426e691ac2fSRafał Miłecki }
427e691ac2fSRafał Miłecki #endif /* !CONFIG_OF */
428e691ac2fSRafał Miłecki 
429e691ac2fSRafał Miłecki 
430d3236553SJohannes Berg /*
431d3236553SJohannes Berg  * Wireless hardware/device configuration structures and methods
432704232c2SJohannes Berg  */
433704232c2SJohannes Berg 
4342ec600d6SLuis Carlos Cobo /**
435d70e9693SJohannes Berg  * DOC: Actions and configuration
436d70e9693SJohannes Berg  *
437d70e9693SJohannes Berg  * Each wireless device and each virtual interface offer a set of configuration
438d70e9693SJohannes Berg  * operations and other actions that are invoked by userspace. Each of these
439d70e9693SJohannes Berg  * actions is described in the operations structure, and the parameters these
440d70e9693SJohannes Berg  * operations use are described separately.
441d70e9693SJohannes Berg  *
442d70e9693SJohannes Berg  * Additionally, some operations are asynchronous and expect to get status
443d70e9693SJohannes Berg  * information via some functions that drivers need to call.
444d70e9693SJohannes Berg  *
445d70e9693SJohannes Berg  * Scanning and BSS list handling with its associated functionality is described
446d70e9693SJohannes Berg  * in a separate chapter.
447d70e9693SJohannes Berg  */
448d70e9693SJohannes Berg 
449c6e6a0c8SAviya Erenfeld #define VHT_MUMIMO_GROUPS_DATA_LEN (WLAN_MEMBERSHIP_LEN +\
450c6e6a0c8SAviya Erenfeld 				    WLAN_USER_POSITION_LEN)
451c6e6a0c8SAviya Erenfeld 
452d70e9693SJohannes Berg /**
4532ec600d6SLuis Carlos Cobo  * struct vif_params - describes virtual interface parameters
454818a986eSJohannes Berg  * @flags: monitor interface flags, unchanged if 0, otherwise
455818a986eSJohannes Berg  *	%MONITOR_FLAG_CHANGED will be set
4568b787643SFelix Fietkau  * @use_4addr: use 4-address frames
457e8f479b1SBen Greear  * @macaddr: address to use for this virtual interface.
458e8f479b1SBen Greear  *	If this parameter is set to zero address the driver may
459e8f479b1SBen Greear  *	determine the address as needed.
460e8f479b1SBen Greear  *	This feature is only fully supported by drivers that enable the
461e8f479b1SBen Greear  *	%NL80211_FEATURE_MAC_ON_CREATE flag.  Others may support creating
462e8f479b1SBen Greear  **	only p2p devices with specified MAC.
463b0265024SJohannes Berg  * @vht_mumimo_groups: MU-MIMO groupID, used for monitoring MU-MIMO packets
464b0265024SJohannes Berg  *	belonging to that MU-MIMO groupID; %NULL if not changed
465b0265024SJohannes Berg  * @vht_mumimo_follow_addr: MU-MIMO follow address, used for monitoring
466b0265024SJohannes Berg  *	MU-MIMO packets going to the specified station; %NULL if not changed
4672ec600d6SLuis Carlos Cobo  */
4682ec600d6SLuis Carlos Cobo struct vif_params {
469818a986eSJohannes Berg 	u32 flags;
4708b787643SFelix Fietkau 	int use_4addr;
4711c18f145SArend van Spriel 	u8 macaddr[ETH_ALEN];
472b0265024SJohannes Berg 	const u8 *vht_mumimo_groups;
473b0265024SJohannes Berg 	const u8 *vht_mumimo_follow_addr;
4742ec600d6SLuis Carlos Cobo };
4752ec600d6SLuis Carlos Cobo 
47641ade00fSJohannes Berg /**
47741ade00fSJohannes Berg  * struct key_params - key information
47841ade00fSJohannes Berg  *
47941ade00fSJohannes Berg  * Information about a key
48041ade00fSJohannes Berg  *
48141ade00fSJohannes Berg  * @key: key material
48241ade00fSJohannes Berg  * @key_len: length of key material
48341ade00fSJohannes Berg  * @cipher: cipher suite selector
48441ade00fSJohannes Berg  * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used
48541ade00fSJohannes Berg  *	with the get_key() callback, must be in little endian,
48641ade00fSJohannes Berg  *	length given by @seq_len.
487abe37c4bSJohannes Berg  * @seq_len: length of @seq.
48841ade00fSJohannes Berg  */
48941ade00fSJohannes Berg struct key_params {
490c1e5f471SJohannes Berg 	const u8 *key;
491c1e5f471SJohannes Berg 	const u8 *seq;
49241ade00fSJohannes Berg 	int key_len;
49341ade00fSJohannes Berg 	int seq_len;
49441ade00fSJohannes Berg 	u32 cipher;
49541ade00fSJohannes Berg };
49641ade00fSJohannes Berg 
497ed1b6cc7SJohannes Berg /**
498683b6d3bSJohannes Berg  * struct cfg80211_chan_def - channel definition
499683b6d3bSJohannes Berg  * @chan: the (control) channel
5003d9d1d66SJohannes Berg  * @width: channel width
5013d9d1d66SJohannes Berg  * @center_freq1: center frequency of first segment
5023d9d1d66SJohannes Berg  * @center_freq2: center frequency of second segment
5033d9d1d66SJohannes Berg  *	(only with 80+80 MHz)
504683b6d3bSJohannes Berg  */
505683b6d3bSJohannes Berg struct cfg80211_chan_def {
506683b6d3bSJohannes Berg 	struct ieee80211_channel *chan;
5073d9d1d66SJohannes Berg 	enum nl80211_chan_width width;
5083d9d1d66SJohannes Berg 	u32 center_freq1;
5093d9d1d66SJohannes Berg 	u32 center_freq2;
510683b6d3bSJohannes Berg };
511683b6d3bSJohannes Berg 
5123d9d1d66SJohannes Berg /**
5133d9d1d66SJohannes Berg  * cfg80211_get_chandef_type - return old channel type from chandef
5143d9d1d66SJohannes Berg  * @chandef: the channel definition
5153d9d1d66SJohannes Berg  *
5160ae997dcSYacine Belkadi  * Return: The old channel type (NOHT, HT20, HT40+/-) from a given
5173d9d1d66SJohannes Berg  * chandef, which must have a bandwidth allowing this conversion.
5183d9d1d66SJohannes Berg  */
519683b6d3bSJohannes Berg static inline enum nl80211_channel_type
520683b6d3bSJohannes Berg cfg80211_get_chandef_type(const struct cfg80211_chan_def *chandef)
521683b6d3bSJohannes Berg {
5223d9d1d66SJohannes Berg 	switch (chandef->width) {
5233d9d1d66SJohannes Berg 	case NL80211_CHAN_WIDTH_20_NOHT:
5243d9d1d66SJohannes Berg 		return NL80211_CHAN_NO_HT;
5253d9d1d66SJohannes Berg 	case NL80211_CHAN_WIDTH_20:
5263d9d1d66SJohannes Berg 		return NL80211_CHAN_HT20;
5273d9d1d66SJohannes Berg 	case NL80211_CHAN_WIDTH_40:
5283d9d1d66SJohannes Berg 		if (chandef->center_freq1 > chandef->chan->center_freq)
5293d9d1d66SJohannes Berg 			return NL80211_CHAN_HT40PLUS;
5303d9d1d66SJohannes Berg 		return NL80211_CHAN_HT40MINUS;
5313d9d1d66SJohannes Berg 	default:
5323d9d1d66SJohannes Berg 		WARN_ON(1);
5333d9d1d66SJohannes Berg 		return NL80211_CHAN_NO_HT;
534683b6d3bSJohannes Berg 	}
5353d9d1d66SJohannes Berg }
5363d9d1d66SJohannes Berg 
5373d9d1d66SJohannes Berg /**
5383d9d1d66SJohannes Berg  * cfg80211_chandef_create - create channel definition using channel type
5393d9d1d66SJohannes Berg  * @chandef: the channel definition struct to fill
5403d9d1d66SJohannes Berg  * @channel: the control channel
5413d9d1d66SJohannes Berg  * @chantype: the channel type
5423d9d1d66SJohannes Berg  *
5433d9d1d66SJohannes Berg  * Given a channel type, create a channel definition.
5443d9d1d66SJohannes Berg  */
5453d9d1d66SJohannes Berg void cfg80211_chandef_create(struct cfg80211_chan_def *chandef,
5463d9d1d66SJohannes Berg 			     struct ieee80211_channel *channel,
5473d9d1d66SJohannes Berg 			     enum nl80211_channel_type chantype);
5483d9d1d66SJohannes Berg 
5493d9d1d66SJohannes Berg /**
5503d9d1d66SJohannes Berg  * cfg80211_chandef_identical - check if two channel definitions are identical
5513d9d1d66SJohannes Berg  * @chandef1: first channel definition
5523d9d1d66SJohannes Berg  * @chandef2: second channel definition
5533d9d1d66SJohannes Berg  *
5540ae997dcSYacine Belkadi  * Return: %true if the channels defined by the channel definitions are
5553d9d1d66SJohannes Berg  * identical, %false otherwise.
5563d9d1d66SJohannes Berg  */
5573d9d1d66SJohannes Berg static inline bool
5583d9d1d66SJohannes Berg cfg80211_chandef_identical(const struct cfg80211_chan_def *chandef1,
5593d9d1d66SJohannes Berg 			   const struct cfg80211_chan_def *chandef2)
5603d9d1d66SJohannes Berg {
5613d9d1d66SJohannes Berg 	return (chandef1->chan == chandef2->chan &&
5623d9d1d66SJohannes Berg 		chandef1->width == chandef2->width &&
5633d9d1d66SJohannes Berg 		chandef1->center_freq1 == chandef2->center_freq1 &&
5643d9d1d66SJohannes Berg 		chandef1->center_freq2 == chandef2->center_freq2);
5653d9d1d66SJohannes Berg }
5663d9d1d66SJohannes Berg 
5673d9d1d66SJohannes Berg /**
5683d9d1d66SJohannes Berg  * cfg80211_chandef_compatible - check if two channel definitions are compatible
5693d9d1d66SJohannes Berg  * @chandef1: first channel definition
5703d9d1d66SJohannes Berg  * @chandef2: second channel definition
5713d9d1d66SJohannes Berg  *
5720ae997dcSYacine Belkadi  * Return: %NULL if the given channel definitions are incompatible,
5733d9d1d66SJohannes Berg  * chandef1 or chandef2 otherwise.
5743d9d1d66SJohannes Berg  */
5753d9d1d66SJohannes Berg const struct cfg80211_chan_def *
5763d9d1d66SJohannes Berg cfg80211_chandef_compatible(const struct cfg80211_chan_def *chandef1,
5773d9d1d66SJohannes Berg 			    const struct cfg80211_chan_def *chandef2);
578683b6d3bSJohannes Berg 
579683b6d3bSJohannes Berg /**
5809f5e8f6eSJohannes Berg  * cfg80211_chandef_valid - check if a channel definition is valid
5819f5e8f6eSJohannes Berg  * @chandef: the channel definition to check
5820ae997dcSYacine Belkadi  * Return: %true if the channel definition is valid. %false otherwise.
5839f5e8f6eSJohannes Berg  */
5849f5e8f6eSJohannes Berg bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef);
5859f5e8f6eSJohannes Berg 
5869f5e8f6eSJohannes Berg /**
5879f5e8f6eSJohannes Berg  * cfg80211_chandef_usable - check if secondary channels can be used
5889f5e8f6eSJohannes Berg  * @wiphy: the wiphy to validate against
5899f5e8f6eSJohannes Berg  * @chandef: the channel definition to check
5900ae997dcSYacine Belkadi  * @prohibited_flags: the regulatory channel flags that must not be set
5910ae997dcSYacine Belkadi  * Return: %true if secondary channels are usable. %false otherwise.
5929f5e8f6eSJohannes Berg  */
5939f5e8f6eSJohannes Berg bool cfg80211_chandef_usable(struct wiphy *wiphy,
5949f5e8f6eSJohannes Berg 			     const struct cfg80211_chan_def *chandef,
5959f5e8f6eSJohannes Berg 			     u32 prohibited_flags);
5969f5e8f6eSJohannes Berg 
5979f5e8f6eSJohannes Berg /**
598774f0734SSimon Wunderlich  * cfg80211_chandef_dfs_required - checks if radar detection is required
599774f0734SSimon Wunderlich  * @wiphy: the wiphy to validate against
600774f0734SSimon Wunderlich  * @chandef: the channel definition to check
6012beb6dabSLuciano Coelho  * @iftype: the interface type as specified in &enum nl80211_iftype
6022beb6dabSLuciano Coelho  * Returns:
6032beb6dabSLuciano Coelho  *	1 if radar detection is required, 0 if it is not, < 0 on error
604774f0734SSimon Wunderlich  */
605774f0734SSimon Wunderlich int cfg80211_chandef_dfs_required(struct wiphy *wiphy,
6062beb6dabSLuciano Coelho 				  const struct cfg80211_chan_def *chandef,
607c3d62036SLuciano Coelho 				  enum nl80211_iftype iftype);
608774f0734SSimon Wunderlich 
609774f0734SSimon Wunderlich /**
61030e74732SSimon Wunderlich  * ieee80211_chandef_rate_flags - returns rate flags for a channel
61130e74732SSimon Wunderlich  *
61230e74732SSimon Wunderlich  * In some channel types, not all rates may be used - for example CCK
61330e74732SSimon Wunderlich  * rates may not be used in 5/10 MHz channels.
61430e74732SSimon Wunderlich  *
61530e74732SSimon Wunderlich  * @chandef: channel definition for the channel
61630e74732SSimon Wunderlich  *
61730e74732SSimon Wunderlich  * Returns: rate flags which apply for this channel
61830e74732SSimon Wunderlich  */
61930e74732SSimon Wunderlich static inline enum ieee80211_rate_flags
62030e74732SSimon Wunderlich ieee80211_chandef_rate_flags(struct cfg80211_chan_def *chandef)
62130e74732SSimon Wunderlich {
62230e74732SSimon Wunderlich 	switch (chandef->width) {
62330e74732SSimon Wunderlich 	case NL80211_CHAN_WIDTH_5:
62430e74732SSimon Wunderlich 		return IEEE80211_RATE_SUPPORTS_5MHZ;
62530e74732SSimon Wunderlich 	case NL80211_CHAN_WIDTH_10:
62630e74732SSimon Wunderlich 		return IEEE80211_RATE_SUPPORTS_10MHZ;
62730e74732SSimon Wunderlich 	default:
62830e74732SSimon Wunderlich 		break;
62930e74732SSimon Wunderlich 	}
63030e74732SSimon Wunderlich 	return 0;
63130e74732SSimon Wunderlich }
63230e74732SSimon Wunderlich 
63330e74732SSimon Wunderlich /**
6340430c883SSimon Wunderlich  * ieee80211_chandef_max_power - maximum transmission power for the chandef
6350430c883SSimon Wunderlich  *
6360430c883SSimon Wunderlich  * In some regulations, the transmit power may depend on the configured channel
6370430c883SSimon Wunderlich  * bandwidth which may be defined as dBm/MHz. This function returns the actual
6380430c883SSimon Wunderlich  * max_power for non-standard (20 MHz) channels.
6390430c883SSimon Wunderlich  *
6400430c883SSimon Wunderlich  * @chandef: channel definition for the channel
6410430c883SSimon Wunderlich  *
6420430c883SSimon Wunderlich  * Returns: maximum allowed transmission power in dBm for the chandef
6430430c883SSimon Wunderlich  */
6440430c883SSimon Wunderlich static inline int
6450430c883SSimon Wunderlich ieee80211_chandef_max_power(struct cfg80211_chan_def *chandef)
6460430c883SSimon Wunderlich {
6470430c883SSimon Wunderlich 	switch (chandef->width) {
6480430c883SSimon Wunderlich 	case NL80211_CHAN_WIDTH_5:
6490430c883SSimon Wunderlich 		return min(chandef->chan->max_reg_power - 6,
6500430c883SSimon Wunderlich 			   chandef->chan->max_power);
6510430c883SSimon Wunderlich 	case NL80211_CHAN_WIDTH_10:
6520430c883SSimon Wunderlich 		return min(chandef->chan->max_reg_power - 3,
6530430c883SSimon Wunderlich 			   chandef->chan->max_power);
6540430c883SSimon Wunderlich 	default:
6550430c883SSimon Wunderlich 		break;
6560430c883SSimon Wunderlich 	}
6570430c883SSimon Wunderlich 	return chandef->chan->max_power;
6580430c883SSimon Wunderlich }
6590430c883SSimon Wunderlich 
6600430c883SSimon Wunderlich /**
66161fa713cSHolger Schurig  * enum survey_info_flags - survey information flags
66261fa713cSHolger Schurig  *
663abe37c4bSJohannes Berg  * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in
66417e5a808SFelix Fietkau  * @SURVEY_INFO_IN_USE: channel is currently being used
6654ed20bebSJohannes Berg  * @SURVEY_INFO_TIME: active time (in ms) was filled in
6664ed20bebSJohannes Berg  * @SURVEY_INFO_TIME_BUSY: busy time was filled in
6674ed20bebSJohannes Berg  * @SURVEY_INFO_TIME_EXT_BUSY: extension channel busy time was filled in
6684ed20bebSJohannes Berg  * @SURVEY_INFO_TIME_RX: receive time was filled in
6694ed20bebSJohannes Berg  * @SURVEY_INFO_TIME_TX: transmit time was filled in
670052536abSJohannes Berg  * @SURVEY_INFO_TIME_SCAN: scan time was filled in
671abe37c4bSJohannes Berg  *
67261fa713cSHolger Schurig  * Used by the driver to indicate which info in &struct survey_info
67361fa713cSHolger Schurig  * it has filled in during the get_survey().
67461fa713cSHolger Schurig  */
67561fa713cSHolger Schurig enum survey_info_flags {
6764ed20bebSJohannes Berg 	SURVEY_INFO_NOISE_DBM		= BIT(0),
6774ed20bebSJohannes Berg 	SURVEY_INFO_IN_USE		= BIT(1),
6784ed20bebSJohannes Berg 	SURVEY_INFO_TIME		= BIT(2),
6794ed20bebSJohannes Berg 	SURVEY_INFO_TIME_BUSY		= BIT(3),
6804ed20bebSJohannes Berg 	SURVEY_INFO_TIME_EXT_BUSY	= BIT(4),
6814ed20bebSJohannes Berg 	SURVEY_INFO_TIME_RX		= BIT(5),
6824ed20bebSJohannes Berg 	SURVEY_INFO_TIME_TX		= BIT(6),
683052536abSJohannes Berg 	SURVEY_INFO_TIME_SCAN		= BIT(7),
68461fa713cSHolger Schurig };
68561fa713cSHolger Schurig 
68661fa713cSHolger Schurig /**
68761fa713cSHolger Schurig  * struct survey_info - channel survey response
68861fa713cSHolger Schurig  *
68911f78ac3SJohannes Berg  * @channel: the channel this survey record reports, may be %NULL for a single
69011f78ac3SJohannes Berg  *	record to report global statistics
69161fa713cSHolger Schurig  * @filled: bitflag of flags from &enum survey_info_flags
69261fa713cSHolger Schurig  * @noise: channel noise in dBm. This and all following fields are
69361fa713cSHolger Schurig  *	optional
6944ed20bebSJohannes Berg  * @time: amount of time in ms the radio was turn on (on the channel)
6954ed20bebSJohannes Berg  * @time_busy: amount of time the primary channel was sensed busy
6964ed20bebSJohannes Berg  * @time_ext_busy: amount of time the extension channel was sensed busy
6974ed20bebSJohannes Berg  * @time_rx: amount of time the radio spent receiving data
6984ed20bebSJohannes Berg  * @time_tx: amount of time the radio spent transmitting data
699052536abSJohannes Berg  * @time_scan: amount of time the radio spent for scanning
70061fa713cSHolger Schurig  *
701abe37c4bSJohannes Berg  * Used by dump_survey() to report back per-channel survey information.
702abe37c4bSJohannes Berg  *
70361fa713cSHolger Schurig  * This structure can later be expanded with things like
70461fa713cSHolger Schurig  * channel duty cycle etc.
70561fa713cSHolger Schurig  */
70661fa713cSHolger Schurig struct survey_info {
70761fa713cSHolger Schurig 	struct ieee80211_channel *channel;
7084ed20bebSJohannes Berg 	u64 time;
7094ed20bebSJohannes Berg 	u64 time_busy;
7104ed20bebSJohannes Berg 	u64 time_ext_busy;
7114ed20bebSJohannes Berg 	u64 time_rx;
7124ed20bebSJohannes Berg 	u64 time_tx;
713052536abSJohannes Berg 	u64 time_scan;
71461fa713cSHolger Schurig 	u32 filled;
71561fa713cSHolger Schurig 	s8 noise;
71661fa713cSHolger Schurig };
71761fa713cSHolger Schurig 
718b8676221SDavid Spinadel #define CFG80211_MAX_WEP_KEYS	4
719b8676221SDavid Spinadel 
72061fa713cSHolger Schurig /**
7215fb628e9SJouni Malinen  * struct cfg80211_crypto_settings - Crypto settings
7225fb628e9SJouni Malinen  * @wpa_versions: indicates which, if any, WPA versions are enabled
7235fb628e9SJouni Malinen  *	(from enum nl80211_wpa_versions)
7245fb628e9SJouni Malinen  * @cipher_group: group key cipher suite (or 0 if unset)
7255fb628e9SJouni Malinen  * @n_ciphers_pairwise: number of AP supported unicast ciphers
7265fb628e9SJouni Malinen  * @ciphers_pairwise: unicast key cipher suites
7275fb628e9SJouni Malinen  * @n_akm_suites: number of AKM suites
7285fb628e9SJouni Malinen  * @akm_suites: AKM suites
7295fb628e9SJouni Malinen  * @control_port: Whether user space controls IEEE 802.1X port, i.e.,
7305fb628e9SJouni Malinen  *	sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
7315fb628e9SJouni Malinen  *	required to assume that the port is unauthorized until authorized by
7325fb628e9SJouni Malinen  *	user space. Otherwise, port is marked authorized by default.
7335fb628e9SJouni Malinen  * @control_port_ethertype: the control port protocol that should be
7345fb628e9SJouni Malinen  *	allowed through even on unauthorized ports
7355fb628e9SJouni Malinen  * @control_port_no_encrypt: TRUE to prevent encryption of control port
7365fb628e9SJouni Malinen  *	protocol frames.
73764bf3d4bSDenis Kenzior  * @control_port_over_nl80211: TRUE if userspace expects to exchange control
73864bf3d4bSDenis Kenzior  *	port frames over NL80211 instead of the network interface.
739b8676221SDavid Spinadel  * @wep_keys: static WEP keys, if not NULL points to an array of
740b8676221SDavid Spinadel  *	CFG80211_MAX_WEP_KEYS WEP keys
741b8676221SDavid Spinadel  * @wep_tx_key: key index (0..3) of the default TX static WEP key
74291b5ab62SEliad Peller  * @psk: PSK (for devices supporting 4-way-handshake offload)
7435fb628e9SJouni Malinen  */
7445fb628e9SJouni Malinen struct cfg80211_crypto_settings {
7455fb628e9SJouni Malinen 	u32 wpa_versions;
7465fb628e9SJouni Malinen 	u32 cipher_group;
7475fb628e9SJouni Malinen 	int n_ciphers_pairwise;
7485fb628e9SJouni Malinen 	u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES];
7495fb628e9SJouni Malinen 	int n_akm_suites;
7505fb628e9SJouni Malinen 	u32 akm_suites[NL80211_MAX_NR_AKM_SUITES];
7515fb628e9SJouni Malinen 	bool control_port;
7525fb628e9SJouni Malinen 	__be16 control_port_ethertype;
7535fb628e9SJouni Malinen 	bool control_port_no_encrypt;
75464bf3d4bSDenis Kenzior 	bool control_port_over_nl80211;
755b8676221SDavid Spinadel 	struct key_params *wep_keys;
756b8676221SDavid Spinadel 	int wep_tx_key;
75791b5ab62SEliad Peller 	const u8 *psk;
7585fb628e9SJouni Malinen };
7595fb628e9SJouni Malinen 
7605fb628e9SJouni Malinen /**
7618860020eSJohannes Berg  * struct cfg80211_beacon_data - beacon data
762ed1b6cc7SJohannes Berg  * @head: head portion of beacon (before TIM IE)
763ed1b6cc7SJohannes Berg  *	or %NULL if not changed
764ed1b6cc7SJohannes Berg  * @tail: tail portion of beacon (after TIM IE)
765ed1b6cc7SJohannes Berg  *	or %NULL if not changed
766ed1b6cc7SJohannes Berg  * @head_len: length of @head
767ed1b6cc7SJohannes Berg  * @tail_len: length of @tail
7689946ecfbSJouni Malinen  * @beacon_ies: extra information element(s) to add into Beacon frames or %NULL
7699946ecfbSJouni Malinen  * @beacon_ies_len: length of beacon_ies in octets
7709946ecfbSJouni Malinen  * @proberesp_ies: extra information element(s) to add into Probe Response
7719946ecfbSJouni Malinen  *	frames or %NULL
7729946ecfbSJouni Malinen  * @proberesp_ies_len: length of proberesp_ies in octets
7739946ecfbSJouni Malinen  * @assocresp_ies: extra information element(s) to add into (Re)Association
7749946ecfbSJouni Malinen  *	Response frames or %NULL
7759946ecfbSJouni Malinen  * @assocresp_ies_len: length of assocresp_ies in octets
77600f740e1SArik Nemtsov  * @probe_resp_len: length of probe response template (@probe_resp)
77700f740e1SArik Nemtsov  * @probe_resp: probe response template (AP mode only)
77881e54d08SPradeep Kumar Chitrapu  * @ftm_responder: enable FTM responder functionality; -1 for no change
77981e54d08SPradeep Kumar Chitrapu  *	(which also implies no change in LCI/civic location data)
78081e54d08SPradeep Kumar Chitrapu  * @lci: LCI subelement content
78181e54d08SPradeep Kumar Chitrapu  * @civicloc: Civic location subelement content
78281e54d08SPradeep Kumar Chitrapu  * @lci_len: LCI data length
78381e54d08SPradeep Kumar Chitrapu  * @civicloc_len: Civic location data length
784ed1b6cc7SJohannes Berg  */
7858860020eSJohannes Berg struct cfg80211_beacon_data {
7868860020eSJohannes Berg 	const u8 *head, *tail;
7878860020eSJohannes Berg 	const u8 *beacon_ies;
7888860020eSJohannes Berg 	const u8 *proberesp_ies;
7898860020eSJohannes Berg 	const u8 *assocresp_ies;
7908860020eSJohannes Berg 	const u8 *probe_resp;
79181e54d08SPradeep Kumar Chitrapu 	const u8 *lci;
79281e54d08SPradeep Kumar Chitrapu 	const u8 *civicloc;
79381e54d08SPradeep Kumar Chitrapu 	s8 ftm_responder;
7948860020eSJohannes Berg 
7958860020eSJohannes Berg 	size_t head_len, tail_len;
7968860020eSJohannes Berg 	size_t beacon_ies_len;
7978860020eSJohannes Berg 	size_t proberesp_ies_len;
7988860020eSJohannes Berg 	size_t assocresp_ies_len;
7998860020eSJohannes Berg 	size_t probe_resp_len;
80081e54d08SPradeep Kumar Chitrapu 	size_t lci_len;
80181e54d08SPradeep Kumar Chitrapu 	size_t civicloc_len;
8028860020eSJohannes Berg };
8038860020eSJohannes Berg 
8046d45a74bSVasanthakumar Thiagarajan struct mac_address {
8056d45a74bSVasanthakumar Thiagarajan 	u8 addr[ETH_ALEN];
8066d45a74bSVasanthakumar Thiagarajan };
8076d45a74bSVasanthakumar Thiagarajan 
8088860020eSJohannes Berg /**
80977765eafSVasanthakumar Thiagarajan  * struct cfg80211_acl_data - Access control list data
81077765eafSVasanthakumar Thiagarajan  *
81177765eafSVasanthakumar Thiagarajan  * @acl_policy: ACL policy to be applied on the station's
812077f897aSJohannes Berg  *	entry specified by mac_addr
81377765eafSVasanthakumar Thiagarajan  * @n_acl_entries: Number of MAC address entries passed
81477765eafSVasanthakumar Thiagarajan  * @mac_addrs: List of MAC addresses of stations to be used for ACL
81577765eafSVasanthakumar Thiagarajan  */
81677765eafSVasanthakumar Thiagarajan struct cfg80211_acl_data {
81777765eafSVasanthakumar Thiagarajan 	enum nl80211_acl_policy acl_policy;
81877765eafSVasanthakumar Thiagarajan 	int n_acl_entries;
81977765eafSVasanthakumar Thiagarajan 
82077765eafSVasanthakumar Thiagarajan 	/* Keep it last */
82177765eafSVasanthakumar Thiagarajan 	struct mac_address mac_addrs[];
82277765eafSVasanthakumar Thiagarajan };
82377765eafSVasanthakumar Thiagarajan 
824a7c7fbffSPurushottam Kushwaha /*
825a7c7fbffSPurushottam Kushwaha  * cfg80211_bitrate_mask - masks for bitrate control
826a7c7fbffSPurushottam Kushwaha  */
827a7c7fbffSPurushottam Kushwaha struct cfg80211_bitrate_mask {
828a7c7fbffSPurushottam Kushwaha 	struct {
829a7c7fbffSPurushottam Kushwaha 		u32 legacy;
830a7c7fbffSPurushottam Kushwaha 		u8 ht_mcs[IEEE80211_HT_MCS_MASK_LEN];
831a7c7fbffSPurushottam Kushwaha 		u16 vht_mcs[NL80211_VHT_NSS_MAX];
832a7c7fbffSPurushottam Kushwaha 		enum nl80211_txrate_gi gi;
833a7c7fbffSPurushottam Kushwaha 	} control[NUM_NL80211_BANDS];
834a7c7fbffSPurushottam Kushwaha };
835a7c7fbffSPurushottam Kushwaha 
8368860020eSJohannes Berg /**
8378860020eSJohannes Berg  * struct cfg80211_ap_settings - AP configuration
8388860020eSJohannes Berg  *
8398860020eSJohannes Berg  * Used to configure an AP interface.
8408860020eSJohannes Berg  *
841683b6d3bSJohannes Berg  * @chandef: defines the channel to use
8428860020eSJohannes Berg  * @beacon: beacon data
8438860020eSJohannes Berg  * @beacon_interval: beacon interval
8448860020eSJohannes Berg  * @dtim_period: DTIM period
8458860020eSJohannes Berg  * @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from
8468860020eSJohannes Berg  *	user space)
8478860020eSJohannes Berg  * @ssid_len: length of @ssid
8488860020eSJohannes Berg  * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames
8498860020eSJohannes Berg  * @crypto: crypto settings
8508860020eSJohannes Berg  * @privacy: the BSS uses privacy
8518860020eSJohannes Berg  * @auth_type: Authentication type (algorithm)
85218998c38SEliad Peller  * @smps_mode: SMPS mode
8531b658f11SVasanthakumar Thiagarajan  * @inactivity_timeout: time in seconds to determine station's inactivity.
85453cabad7SJohannes Berg  * @p2p_ctwindow: P2P CT Window
85553cabad7SJohannes Berg  * @p2p_opp_ps: P2P opportunistic PS
85677765eafSVasanthakumar Thiagarajan  * @acl: ACL configuration used by the drivers which has support for
85777765eafSVasanthakumar Thiagarajan  *	MAC address based access control
85834d50519SLior David  * @pbss: If set, start as a PCP instead of AP. Relevant for DMG
85934d50519SLior David  *	networks.
8608564e382SJohannes Berg  * @beacon_rate: bitrate to be used for beacons
86166cd794eSJohannes Berg  * @ht_cap: HT capabilities (or %NULL if HT isn't enabled)
86266cd794eSJohannes Berg  * @vht_cap: VHT capabilities (or %NULL if VHT isn't enabled)
863244eb9aeSShaul Triebitz  * @he_cap: HE capabilities (or %NULL if HE isn't enabled)
86466cd794eSJohannes Berg  * @ht_required: stations must support HT
86566cd794eSJohannes Berg  * @vht_required: stations must support VHT
8668860020eSJohannes Berg  */
8678860020eSJohannes Berg struct cfg80211_ap_settings {
868683b6d3bSJohannes Berg 	struct cfg80211_chan_def chandef;
869aa430da4SJohannes Berg 
8708860020eSJohannes Berg 	struct cfg80211_beacon_data beacon;
8718860020eSJohannes Berg 
8728860020eSJohannes Berg 	int beacon_interval, dtim_period;
87332e9de84SJouni Malinen 	const u8 *ssid;
87432e9de84SJouni Malinen 	size_t ssid_len;
87532e9de84SJouni Malinen 	enum nl80211_hidden_ssid hidden_ssid;
8765fb628e9SJouni Malinen 	struct cfg80211_crypto_settings crypto;
8775fb628e9SJouni Malinen 	bool privacy;
8785fb628e9SJouni Malinen 	enum nl80211_auth_type auth_type;
87918998c38SEliad Peller 	enum nl80211_smps_mode smps_mode;
8801b658f11SVasanthakumar Thiagarajan 	int inactivity_timeout;
88153cabad7SJohannes Berg 	u8 p2p_ctwindow;
88253cabad7SJohannes Berg 	bool p2p_opp_ps;
88377765eafSVasanthakumar Thiagarajan 	const struct cfg80211_acl_data *acl;
88434d50519SLior David 	bool pbss;
885a7c7fbffSPurushottam Kushwaha 	struct cfg80211_bitrate_mask beacon_rate;
88666cd794eSJohannes Berg 
88766cd794eSJohannes Berg 	const struct ieee80211_ht_cap *ht_cap;
88866cd794eSJohannes Berg 	const struct ieee80211_vht_cap *vht_cap;
889244eb9aeSShaul Triebitz 	const struct ieee80211_he_cap_elem *he_cap;
89066cd794eSJohannes Berg 	bool ht_required, vht_required;
891ed1b6cc7SJohannes Berg };
892ed1b6cc7SJohannes Berg 
8935727ef1bSJohannes Berg /**
89416ef1fe2SSimon Wunderlich  * struct cfg80211_csa_settings - channel switch settings
89516ef1fe2SSimon Wunderlich  *
89616ef1fe2SSimon Wunderlich  * Used for channel switch
89716ef1fe2SSimon Wunderlich  *
89816ef1fe2SSimon Wunderlich  * @chandef: defines the channel to use after the switch
89916ef1fe2SSimon Wunderlich  * @beacon_csa: beacon data while performing the switch
9009a774c78SAndrei Otcheretianski  * @counter_offsets_beacon: offsets of the counters within the beacon (tail)
9019a774c78SAndrei Otcheretianski  * @counter_offsets_presp: offsets of the counters within the probe response
9029a774c78SAndrei Otcheretianski  * @n_counter_offsets_beacon: number of csa counters the beacon (tail)
9039a774c78SAndrei Otcheretianski  * @n_counter_offsets_presp: number of csa counters in the probe response
90416ef1fe2SSimon Wunderlich  * @beacon_after: beacon data to be used on the new channel
90516ef1fe2SSimon Wunderlich  * @radar_required: whether radar detection is required on the new channel
90616ef1fe2SSimon Wunderlich  * @block_tx: whether transmissions should be blocked while changing
90716ef1fe2SSimon Wunderlich  * @count: number of beacons until switch
90816ef1fe2SSimon Wunderlich  */
90916ef1fe2SSimon Wunderlich struct cfg80211_csa_settings {
91016ef1fe2SSimon Wunderlich 	struct cfg80211_chan_def chandef;
91116ef1fe2SSimon Wunderlich 	struct cfg80211_beacon_data beacon_csa;
9129a774c78SAndrei Otcheretianski 	const u16 *counter_offsets_beacon;
9139a774c78SAndrei Otcheretianski 	const u16 *counter_offsets_presp;
9149a774c78SAndrei Otcheretianski 	unsigned int n_counter_offsets_beacon;
9159a774c78SAndrei Otcheretianski 	unsigned int n_counter_offsets_presp;
91616ef1fe2SSimon Wunderlich 	struct cfg80211_beacon_data beacon_after;
91716ef1fe2SSimon Wunderlich 	bool radar_required;
91816ef1fe2SSimon Wunderlich 	bool block_tx;
91916ef1fe2SSimon Wunderlich 	u8 count;
92016ef1fe2SSimon Wunderlich };
92116ef1fe2SSimon Wunderlich 
92251a1aaa6SJohannes Berg #define CFG80211_MAX_NUM_DIFFERENT_CHANNELS 10
92351a1aaa6SJohannes Berg 
92416ef1fe2SSimon Wunderlich /**
925e227300cSPurushottam Kushwaha  * struct iface_combination_params - input parameters for interface combinations
926e227300cSPurushottam Kushwaha  *
927e227300cSPurushottam Kushwaha  * Used to pass interface combination parameters
928e227300cSPurushottam Kushwaha  *
929e227300cSPurushottam Kushwaha  * @num_different_channels: the number of different channels we want
930e227300cSPurushottam Kushwaha  *	to use for verification
931e227300cSPurushottam Kushwaha  * @radar_detect: a bitmap where each bit corresponds to a channel
932e227300cSPurushottam Kushwaha  *	width where radar detection is needed, as in the definition of
933e227300cSPurushottam Kushwaha  *	&struct ieee80211_iface_combination.@radar_detect_widths
934e227300cSPurushottam Kushwaha  * @iftype_num: array with the number of interfaces of each interface
935e227300cSPurushottam Kushwaha  *	type.  The index is the interface type as specified in &enum
936e227300cSPurushottam Kushwaha  *	nl80211_iftype.
9374c8dea63SJohannes Berg  * @new_beacon_int: set this to the beacon interval of a new interface
9384c8dea63SJohannes Berg  *	that's not operating yet, if such is to be checked as part of
9394c8dea63SJohannes Berg  *	the verification
940e227300cSPurushottam Kushwaha  */
941e227300cSPurushottam Kushwaha struct iface_combination_params {
942e227300cSPurushottam Kushwaha 	int num_different_channels;
943e227300cSPurushottam Kushwaha 	u8 radar_detect;
944e227300cSPurushottam Kushwaha 	int iftype_num[NUM_NL80211_IFTYPES];
9454c8dea63SJohannes Berg 	u32 new_beacon_int;
946e227300cSPurushottam Kushwaha };
947e227300cSPurushottam Kushwaha 
948e227300cSPurushottam Kushwaha /**
9493b9ce80cSJohannes Berg  * enum station_parameters_apply_mask - station parameter values to apply
9503b9ce80cSJohannes Berg  * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp)
9519d62a986SJouni Malinen  * @STATION_PARAM_APPLY_CAPABILITY: apply new capability
952f8bacc21SJohannes Berg  * @STATION_PARAM_APPLY_PLINK_STATE: apply new plink state
9533b9ce80cSJohannes Berg  *
9543b9ce80cSJohannes Berg  * Not all station parameters have in-band "no change" signalling,
9553b9ce80cSJohannes Berg  * for those that don't these flags will are used.
9563b9ce80cSJohannes Berg  */
9573b9ce80cSJohannes Berg enum station_parameters_apply_mask {
9583b9ce80cSJohannes Berg 	STATION_PARAM_APPLY_UAPSD = BIT(0),
9599d62a986SJouni Malinen 	STATION_PARAM_APPLY_CAPABILITY = BIT(1),
960f8bacc21SJohannes Berg 	STATION_PARAM_APPLY_PLINK_STATE = BIT(2),
9613b9ce80cSJohannes Berg };
9623b9ce80cSJohannes Berg 
9633b9ce80cSJohannes Berg /**
9645727ef1bSJohannes Berg  * struct station_parameters - station parameters
9655727ef1bSJohannes Berg  *
9665727ef1bSJohannes Berg  * Used to change and create a new station.
9675727ef1bSJohannes Berg  *
9685727ef1bSJohannes Berg  * @vlan: vlan interface station should belong to
9695727ef1bSJohannes Berg  * @supported_rates: supported rates in IEEE 802.11 format
9705727ef1bSJohannes Berg  *	(or NULL for no change)
9715727ef1bSJohannes Berg  * @supported_rates_len: number of supported rates
972eccb8e8fSJohannes Berg  * @sta_flags_mask: station flags that changed
973819bf593SJohannes Berg  *	(bitmask of BIT(%NL80211_STA_FLAG_...))
974eccb8e8fSJohannes Berg  * @sta_flags_set: station flags values
975819bf593SJohannes Berg  *	(bitmask of BIT(%NL80211_STA_FLAG_...))
9765727ef1bSJohannes Berg  * @listen_interval: listen interval or -1 for no change
9775727ef1bSJohannes Berg  * @aid: AID or zero for no change
9787d27a0baSMasashi Honma  * @peer_aid: mesh peer AID or zero for no change
979abe37c4bSJohannes Berg  * @plink_action: plink action to take
9809c3990aaSJavier Cardona  * @plink_state: set the peer link state for a station
981abe37c4bSJohannes Berg  * @ht_capa: HT capabilities of station
982f461be3eSMahesh Palivela  * @vht_capa: VHT capabilities of station
983910868dbSEliad Peller  * @uapsd_queues: bitmap of queues configured for uapsd. same format
984910868dbSEliad Peller  *	as the AC bitmap in the QoS info field
985910868dbSEliad Peller  * @max_sp: max Service Period. same format as the MAX_SP in the
986910868dbSEliad Peller  *	QoS info field (but already shifted down)
987c26887d2SJohannes Berg  * @sta_modify_mask: bitmap indicating which parameters changed
988c26887d2SJohannes Berg  *	(for those that don't have a natural "no change" value),
989c26887d2SJohannes Berg  *	see &enum station_parameters_apply_mask
9903b1c5a53SMarco Porsch  * @local_pm: local link-specific mesh power save mode (no change when set
9913b1c5a53SMarco Porsch  *	to unknown)
9929d62a986SJouni Malinen  * @capability: station capability
9939d62a986SJouni Malinen  * @ext_capab: extended capabilities of the station
9949d62a986SJouni Malinen  * @ext_capab_len: number of extended capabilities
995c01fc9adSSunil Dutt  * @supported_channels: supported channels in IEEE 802.11 format
996c01fc9adSSunil Dutt  * @supported_channels_len: number of supported channels
997c01fc9adSSunil Dutt  * @supported_oper_classes: supported oper classes in IEEE 802.11 format
998c01fc9adSSunil Dutt  * @supported_oper_classes_len: number of supported operating classes
99960f4a7b1SMarek Kwaczynski  * @opmode_notif: operating mode field from Operating Mode Notification
100060f4a7b1SMarek Kwaczynski  * @opmode_notif_used: information if operating mode field is used
100117b94247SAyala Beker  * @support_p2p_ps: information if station supports P2P PS mechanism
1002c4cbaf79SLuca Coelho  * @he_capa: HE capabilities of station
1003c4cbaf79SLuca Coelho  * @he_capa_len: the length of the HE capabilities
10045727ef1bSJohannes Berg  */
10055727ef1bSJohannes Berg struct station_parameters {
10062c1aabf3SJohannes Berg 	const u8 *supported_rates;
10075727ef1bSJohannes Berg 	struct net_device *vlan;
1008eccb8e8fSJohannes Berg 	u32 sta_flags_mask, sta_flags_set;
10093b9ce80cSJohannes Berg 	u32 sta_modify_mask;
10105727ef1bSJohannes Berg 	int listen_interval;
10115727ef1bSJohannes Berg 	u16 aid;
10127d27a0baSMasashi Honma 	u16 peer_aid;
10135727ef1bSJohannes Berg 	u8 supported_rates_len;
10142ec600d6SLuis Carlos Cobo 	u8 plink_action;
10159c3990aaSJavier Cardona 	u8 plink_state;
10162c1aabf3SJohannes Berg 	const struct ieee80211_ht_cap *ht_capa;
10172c1aabf3SJohannes Berg 	const struct ieee80211_vht_cap *vht_capa;
1018c75786c9SEliad Peller 	u8 uapsd_queues;
1019c75786c9SEliad Peller 	u8 max_sp;
10203b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode local_pm;
10219d62a986SJouni Malinen 	u16 capability;
10222c1aabf3SJohannes Berg 	const u8 *ext_capab;
10239d62a986SJouni Malinen 	u8 ext_capab_len;
1024c01fc9adSSunil Dutt 	const u8 *supported_channels;
1025c01fc9adSSunil Dutt 	u8 supported_channels_len;
1026c01fc9adSSunil Dutt 	const u8 *supported_oper_classes;
1027c01fc9adSSunil Dutt 	u8 supported_oper_classes_len;
102860f4a7b1SMarek Kwaczynski 	u8 opmode_notif;
102960f4a7b1SMarek Kwaczynski 	bool opmode_notif_used;
103017b94247SAyala Beker 	int support_p2p_ps;
1031c4cbaf79SLuca Coelho 	const struct ieee80211_he_cap_elem *he_capa;
1032c4cbaf79SLuca Coelho 	u8 he_capa_len;
10335727ef1bSJohannes Berg };
10345727ef1bSJohannes Berg 
1035fd5b74dcSJohannes Berg /**
103689c771e5SJouni Malinen  * struct station_del_parameters - station deletion parameters
103789c771e5SJouni Malinen  *
103889c771e5SJouni Malinen  * Used to delete a station entry (or all stations).
103989c771e5SJouni Malinen  *
104089c771e5SJouni Malinen  * @mac: MAC address of the station to remove or NULL to remove all stations
104198856866SJouni Malinen  * @subtype: Management frame subtype to use for indicating removal
104298856866SJouni Malinen  *	(10 = Disassociation, 12 = Deauthentication)
104398856866SJouni Malinen  * @reason_code: Reason code for the Disassociation/Deauthentication frame
104489c771e5SJouni Malinen  */
104589c771e5SJouni Malinen struct station_del_parameters {
104689c771e5SJouni Malinen 	const u8 *mac;
104798856866SJouni Malinen 	u8 subtype;
104898856866SJouni Malinen 	u16 reason_code;
104989c771e5SJouni Malinen };
105089c771e5SJouni Malinen 
105189c771e5SJouni Malinen /**
105277ee7c89SJohannes Berg  * enum cfg80211_station_type - the type of station being modified
105377ee7c89SJohannes Berg  * @CFG80211_STA_AP_CLIENT: client of an AP interface
105447edb11bSAyala Beker  * @CFG80211_STA_AP_CLIENT_UNASSOC: client of an AP interface that is still
105547edb11bSAyala Beker  *	unassociated (update properties for this type of client is permitted)
105677ee7c89SJohannes Berg  * @CFG80211_STA_AP_MLME_CLIENT: client of an AP interface that has
105777ee7c89SJohannes Berg  *	the AP MLME in the device
105877ee7c89SJohannes Berg  * @CFG80211_STA_AP_STA: AP station on managed interface
105977ee7c89SJohannes Berg  * @CFG80211_STA_IBSS: IBSS station
106077ee7c89SJohannes Berg  * @CFG80211_STA_TDLS_PEER_SETUP: TDLS peer on managed interface (dummy entry
106177ee7c89SJohannes Berg  *	while TDLS setup is in progress, it moves out of this state when
106277ee7c89SJohannes Berg  *	being marked authorized; use this only if TDLS with external setup is
106377ee7c89SJohannes Berg  *	supported/used)
106477ee7c89SJohannes Berg  * @CFG80211_STA_TDLS_PEER_ACTIVE: TDLS peer on managed interface (active
106577ee7c89SJohannes Berg  *	entry that is operating, has been marked authorized by userspace)
1066eef941e6SThomas Pedersen  * @CFG80211_STA_MESH_PEER_KERNEL: peer on mesh interface (kernel managed)
1067eef941e6SThomas Pedersen  * @CFG80211_STA_MESH_PEER_USER: peer on mesh interface (user managed)
106877ee7c89SJohannes Berg  */
106977ee7c89SJohannes Berg enum cfg80211_station_type {
107077ee7c89SJohannes Berg 	CFG80211_STA_AP_CLIENT,
107147edb11bSAyala Beker 	CFG80211_STA_AP_CLIENT_UNASSOC,
107277ee7c89SJohannes Berg 	CFG80211_STA_AP_MLME_CLIENT,
107377ee7c89SJohannes Berg 	CFG80211_STA_AP_STA,
107477ee7c89SJohannes Berg 	CFG80211_STA_IBSS,
107577ee7c89SJohannes Berg 	CFG80211_STA_TDLS_PEER_SETUP,
107677ee7c89SJohannes Berg 	CFG80211_STA_TDLS_PEER_ACTIVE,
1077eef941e6SThomas Pedersen 	CFG80211_STA_MESH_PEER_KERNEL,
1078eef941e6SThomas Pedersen 	CFG80211_STA_MESH_PEER_USER,
107977ee7c89SJohannes Berg };
108077ee7c89SJohannes Berg 
108177ee7c89SJohannes Berg /**
108277ee7c89SJohannes Berg  * cfg80211_check_station_change - validate parameter changes
108377ee7c89SJohannes Berg  * @wiphy: the wiphy this operates on
108477ee7c89SJohannes Berg  * @params: the new parameters for a station
108577ee7c89SJohannes Berg  * @statype: the type of station being modified
108677ee7c89SJohannes Berg  *
108777ee7c89SJohannes Berg  * Utility function for the @change_station driver method. Call this function
108877ee7c89SJohannes Berg  * with the appropriate station type looking up the station (and checking that
108977ee7c89SJohannes Berg  * it exists). It will verify whether the station change is acceptable, and if
109077ee7c89SJohannes Berg  * not will return an error code. Note that it may modify the parameters for
109177ee7c89SJohannes Berg  * backward compatibility reasons, so don't use them before calling this.
109277ee7c89SJohannes Berg  */
109377ee7c89SJohannes Berg int cfg80211_check_station_change(struct wiphy *wiphy,
109477ee7c89SJohannes Berg 				  struct station_parameters *params,
109577ee7c89SJohannes Berg 				  enum cfg80211_station_type statype);
109677ee7c89SJohannes Berg 
109777ee7c89SJohannes Berg /**
1098420e7fabSHenning Rogge  * enum station_info_rate_flags - bitrate info flags
1099420e7fabSHenning Rogge  *
1100420e7fabSHenning Rogge  * Used by the driver to indicate the specific rate transmission
1101420e7fabSHenning Rogge  * type for 802.11n transmissions.
1102420e7fabSHenning Rogge  *
1103db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_MCS: mcs field filled with HT MCS
1104db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_VHT_MCS: mcs field filled with VHT MCS
1105420e7fabSHenning Rogge  * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval
1106db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_60G: 60GHz MCS
1107c4cbaf79SLuca Coelho  * @RATE_INFO_FLAGS_HE_MCS: HE MCS information
1108420e7fabSHenning Rogge  */
1109420e7fabSHenning Rogge enum rate_info_flags {
1110db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_MCS			= BIT(0),
1111db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_VHT_MCS			= BIT(1),
1112b51f3beeSJohannes Berg 	RATE_INFO_FLAGS_SHORT_GI		= BIT(2),
1113b51f3beeSJohannes Berg 	RATE_INFO_FLAGS_60G			= BIT(3),
1114c4cbaf79SLuca Coelho 	RATE_INFO_FLAGS_HE_MCS			= BIT(4),
1115b51f3beeSJohannes Berg };
1116b51f3beeSJohannes Berg 
1117b51f3beeSJohannes Berg /**
1118b51f3beeSJohannes Berg  * enum rate_info_bw - rate bandwidth information
1119b51f3beeSJohannes Berg  *
1120b51f3beeSJohannes Berg  * Used by the driver to indicate the rate bandwidth.
1121b51f3beeSJohannes Berg  *
1122b51f3beeSJohannes Berg  * @RATE_INFO_BW_5: 5 MHz bandwidth
1123b51f3beeSJohannes Berg  * @RATE_INFO_BW_10: 10 MHz bandwidth
1124b51f3beeSJohannes Berg  * @RATE_INFO_BW_20: 20 MHz bandwidth
1125b51f3beeSJohannes Berg  * @RATE_INFO_BW_40: 40 MHz bandwidth
1126b51f3beeSJohannes Berg  * @RATE_INFO_BW_80: 80 MHz bandwidth
1127b51f3beeSJohannes Berg  * @RATE_INFO_BW_160: 160 MHz bandwidth
1128c4cbaf79SLuca Coelho  * @RATE_INFO_BW_HE_RU: bandwidth determined by HE RU allocation
1129b51f3beeSJohannes Berg  */
1130b51f3beeSJohannes Berg enum rate_info_bw {
1131842be75cSJohannes Berg 	RATE_INFO_BW_20 = 0,
1132b51f3beeSJohannes Berg 	RATE_INFO_BW_5,
1133b51f3beeSJohannes Berg 	RATE_INFO_BW_10,
1134b51f3beeSJohannes Berg 	RATE_INFO_BW_40,
1135b51f3beeSJohannes Berg 	RATE_INFO_BW_80,
1136b51f3beeSJohannes Berg 	RATE_INFO_BW_160,
1137c4cbaf79SLuca Coelho 	RATE_INFO_BW_HE_RU,
1138420e7fabSHenning Rogge };
1139420e7fabSHenning Rogge 
1140420e7fabSHenning Rogge /**
1141420e7fabSHenning Rogge  * struct rate_info - bitrate information
1142420e7fabSHenning Rogge  *
1143420e7fabSHenning Rogge  * Information about a receiving or transmitting bitrate
1144420e7fabSHenning Rogge  *
1145420e7fabSHenning Rogge  * @flags: bitflag of flags from &enum rate_info_flags
1146c4cbaf79SLuca Coelho  * @mcs: mcs index if struct describes an HT/VHT/HE rate
1147420e7fabSHenning Rogge  * @legacy: bitrate in 100kbit/s for 802.11abg
1148c4cbaf79SLuca Coelho  * @nss: number of streams (VHT & HE only)
1149b51f3beeSJohannes Berg  * @bw: bandwidth (from &enum rate_info_bw)
1150c4cbaf79SLuca Coelho  * @he_gi: HE guard interval (from &enum nl80211_he_gi)
1151c4cbaf79SLuca Coelho  * @he_dcm: HE DCM value
1152c4cbaf79SLuca Coelho  * @he_ru_alloc: HE RU allocation (from &enum nl80211_he_ru_alloc,
1153c4cbaf79SLuca Coelho  *	only valid if bw is %RATE_INFO_BW_HE_RU)
1154420e7fabSHenning Rogge  */
1155420e7fabSHenning Rogge struct rate_info {
1156420e7fabSHenning Rogge 	u8 flags;
1157420e7fabSHenning Rogge 	u8 mcs;
1158420e7fabSHenning Rogge 	u16 legacy;
1159db9c64cfSJohannes Berg 	u8 nss;
1160b51f3beeSJohannes Berg 	u8 bw;
1161c4cbaf79SLuca Coelho 	u8 he_gi;
1162c4cbaf79SLuca Coelho 	u8 he_dcm;
1163c4cbaf79SLuca Coelho 	u8 he_ru_alloc;
1164fd5b74dcSJohannes Berg };
1165fd5b74dcSJohannes Berg 
1166fd5b74dcSJohannes Berg /**
1167f4263c98SPaul Stewart  * enum station_info_rate_flags - bitrate info flags
1168f4263c98SPaul Stewart  *
1169f4263c98SPaul Stewart  * Used by the driver to indicate the specific rate transmission
1170f4263c98SPaul Stewart  * type for 802.11n transmissions.
1171f4263c98SPaul Stewart  *
1172f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_CTS_PROT: whether CTS protection is enabled
1173f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_SHORT_PREAMBLE: whether short preamble is enabled
1174f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_SHORT_SLOT_TIME: whether short slot time is enabled
1175f4263c98SPaul Stewart  */
1176f4263c98SPaul Stewart enum bss_param_flags {
1177f4263c98SPaul Stewart 	BSS_PARAM_FLAGS_CTS_PROT	= 1<<0,
1178f4263c98SPaul Stewart 	BSS_PARAM_FLAGS_SHORT_PREAMBLE	= 1<<1,
1179f4263c98SPaul Stewart 	BSS_PARAM_FLAGS_SHORT_SLOT_TIME	= 1<<2,
1180f4263c98SPaul Stewart };
1181f4263c98SPaul Stewart 
1182f4263c98SPaul Stewart /**
1183f4263c98SPaul Stewart  * struct sta_bss_parameters - BSS parameters for the attached station
1184f4263c98SPaul Stewart  *
1185f4263c98SPaul Stewart  * Information about the currently associated BSS
1186f4263c98SPaul Stewart  *
1187f4263c98SPaul Stewart  * @flags: bitflag of flags from &enum bss_param_flags
1188f4263c98SPaul Stewart  * @dtim_period: DTIM period for the BSS
1189f4263c98SPaul Stewart  * @beacon_interval: beacon interval
1190f4263c98SPaul Stewart  */
1191f4263c98SPaul Stewart struct sta_bss_parameters {
1192f4263c98SPaul Stewart 	u8 flags;
1193f4263c98SPaul Stewart 	u8 dtim_period;
1194f4263c98SPaul Stewart 	u16 beacon_interval;
1195f4263c98SPaul Stewart };
1196f4263c98SPaul Stewart 
11976de39808SJohannes Berg /**
119852539ca8SToke Høiland-Jørgensen  * struct cfg80211_txq_stats - TXQ statistics for this TID
119952539ca8SToke Høiland-Jørgensen  * @filled: bitmap of flags using the bits of &enum nl80211_txq_stats to
120052539ca8SToke Høiland-Jørgensen  *	indicate the relevant values in this struct are filled
120152539ca8SToke Høiland-Jørgensen  * @backlog_bytes: total number of bytes currently backlogged
120252539ca8SToke Høiland-Jørgensen  * @backlog_packets: total number of packets currently backlogged
120352539ca8SToke Høiland-Jørgensen  * @flows: number of new flows seen
120452539ca8SToke Høiland-Jørgensen  * @drops: total number of packets dropped
120552539ca8SToke Høiland-Jørgensen  * @ecn_marks: total number of packets marked with ECN CE
120652539ca8SToke Høiland-Jørgensen  * @overlimit: number of drops due to queue space overflow
120752539ca8SToke Høiland-Jørgensen  * @overmemory: number of drops due to memory limit overflow
120852539ca8SToke Høiland-Jørgensen  * @collisions: number of hash collisions
120952539ca8SToke Høiland-Jørgensen  * @tx_bytes: total number of bytes dequeued
121052539ca8SToke Høiland-Jørgensen  * @tx_packets: total number of packets dequeued
121152539ca8SToke Høiland-Jørgensen  * @max_flows: maximum number of flows supported
121252539ca8SToke Høiland-Jørgensen  */
121352539ca8SToke Høiland-Jørgensen struct cfg80211_txq_stats {
121452539ca8SToke Høiland-Jørgensen 	u32 filled;
121552539ca8SToke Høiland-Jørgensen 	u32 backlog_bytes;
121652539ca8SToke Høiland-Jørgensen 	u32 backlog_packets;
121752539ca8SToke Høiland-Jørgensen 	u32 flows;
121852539ca8SToke Høiland-Jørgensen 	u32 drops;
121952539ca8SToke Høiland-Jørgensen 	u32 ecn_marks;
122052539ca8SToke Høiland-Jørgensen 	u32 overlimit;
122152539ca8SToke Høiland-Jørgensen 	u32 overmemory;
122252539ca8SToke Høiland-Jørgensen 	u32 collisions;
122352539ca8SToke Høiland-Jørgensen 	u32 tx_bytes;
122452539ca8SToke Høiland-Jørgensen 	u32 tx_packets;
122552539ca8SToke Høiland-Jørgensen 	u32 max_flows;
122652539ca8SToke Høiland-Jørgensen };
122752539ca8SToke Høiland-Jørgensen 
122852539ca8SToke Høiland-Jørgensen /**
12296de39808SJohannes Berg  * struct cfg80211_tid_stats - per-TID statistics
12306de39808SJohannes Berg  * @filled: bitmap of flags using the bits of &enum nl80211_tid_stats to
12316de39808SJohannes Berg  *	indicate the relevant values in this struct are filled
12326de39808SJohannes Berg  * @rx_msdu: number of received MSDUs
12336de39808SJohannes Berg  * @tx_msdu: number of (attempted) transmitted MSDUs
12346de39808SJohannes Berg  * @tx_msdu_retries: number of retries (not counting the first) for
12356de39808SJohannes Berg  *	transmitted MSDUs
12366de39808SJohannes Berg  * @tx_msdu_failed: number of failed transmitted MSDUs
123752539ca8SToke Høiland-Jørgensen  * @txq_stats: TXQ statistics
12386de39808SJohannes Berg  */
12396de39808SJohannes Berg struct cfg80211_tid_stats {
12406de39808SJohannes Berg 	u32 filled;
12416de39808SJohannes Berg 	u64 rx_msdu;
12426de39808SJohannes Berg 	u64 tx_msdu;
12436de39808SJohannes Berg 	u64 tx_msdu_retries;
12446de39808SJohannes Berg 	u64 tx_msdu_failed;
124552539ca8SToke Høiland-Jørgensen 	struct cfg80211_txq_stats txq_stats;
12466de39808SJohannes Berg };
12476de39808SJohannes Berg 
1248119363c7SFelix Fietkau #define IEEE80211_MAX_CHAINS	4
1249119363c7SFelix Fietkau 
1250f4263c98SPaul Stewart /**
12512ec600d6SLuis Carlos Cobo  * struct station_info - station information
1252fd5b74dcSJohannes Berg  *
12532ec600d6SLuis Carlos Cobo  * Station information filled by driver for get_station() and dump_station.
1254fd5b74dcSJohannes Berg  *
1255319090bfSJohannes Berg  * @filled: bitflag of flags using the bits of &enum nl80211_sta_info to
1256319090bfSJohannes Berg  *	indicate the relevant values in this struct for them
1257ebe27c91SMohammed Shafi Shajakhan  * @connected_time: time(in secs) since a station is last connected
1258fd5b74dcSJohannes Berg  * @inactive_time: time since last station activity (tx/rx) in milliseconds
12598d791361SJohannes Berg  * @rx_bytes: bytes (size of MPDUs) received from this station
12608d791361SJohannes Berg  * @tx_bytes: bytes (size of MPDUs) transmitted to this station
12612ec600d6SLuis Carlos Cobo  * @llid: mesh local link id
12622ec600d6SLuis Carlos Cobo  * @plid: mesh peer link id
12632ec600d6SLuis Carlos Cobo  * @plink_state: mesh peer link state
126473c3df3bSJohannes Berg  * @signal: The signal strength, type depends on the wiphy's signal_type.
126573c3df3bSJohannes Berg  *	For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
126673c3df3bSJohannes Berg  * @signal_avg: Average signal strength, type depends on the wiphy's signal_type.
126773c3df3bSJohannes Berg  *	For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
1268119363c7SFelix Fietkau  * @chains: bitmask for filled values in @chain_signal, @chain_signal_avg
1269119363c7SFelix Fietkau  * @chain_signal: per-chain signal strength of last received packet in dBm
1270119363c7SFelix Fietkau  * @chain_signal_avg: per-chain signal strength average in dBm
1271858022aaSRandy Dunlap  * @txrate: current unicast bitrate from this station
1272858022aaSRandy Dunlap  * @rxrate: current unicast bitrate to this station
12738d791361SJohannes Berg  * @rx_packets: packets (MSDUs & MMPDUs) received from this station
12748d791361SJohannes Berg  * @tx_packets: packets (MSDUs & MMPDUs) transmitted to this station
12758d791361SJohannes Berg  * @tx_retries: cumulative retry counts (MPDUs)
12768d791361SJohannes Berg  * @tx_failed: number of failed transmissions (MPDUs) (retries exceeded, no ACK)
12775a5c731aSBen Greear  * @rx_dropped_misc:  Dropped for un-specified reason.
12781ba01458SRandy Dunlap  * @bss_param: current BSS parameters
1279f5ea9120SJohannes Berg  * @generation: generation number for nl80211 dumps.
1280f5ea9120SJohannes Berg  *	This number should increase every time the list of stations
1281f5ea9120SJohannes Berg  *	changes, i.e. when a station is added or removed, so that
1282f5ea9120SJohannes Berg  *	userspace can tell whether it got a consistent snapshot.
128350d3dfb7SJouni Malinen  * @assoc_req_ies: IEs from (Re)Association Request.
128450d3dfb7SJouni Malinen  *	This is used only when in AP mode with drivers that do not use
128550d3dfb7SJouni Malinen  *	user space MLME/SME implementation. The information is provided for
128650d3dfb7SJouni Malinen  *	the cfg80211_new_sta() calls to notify user space of the IEs.
128750d3dfb7SJouni Malinen  * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets.
1288c26887d2SJohannes Berg  * @sta_flags: station flags mask & values
1289a85e1d55SPaul Stewart  * @beacon_loss_count: Number of times beacon loss event has triggered.
1290d299a1f2SJavier Cardona  * @t_offset: Time offset of the station relative to this host.
12913b1c5a53SMarco Porsch  * @local_pm: local mesh STA power save mode
12923b1c5a53SMarco Porsch  * @peer_pm: peer mesh STA power save mode
12933b1c5a53SMarco Porsch  * @nonpeer_pm: non-peer mesh STA power save mode
1294867d849fSAntonio Quartulli  * @expected_throughput: expected throughput in kbps (including 802.11 headers)
1295867d849fSAntonio Quartulli  *	towards this station.
1296a76b1942SJohannes Berg  * @rx_beacon: number of beacons received from this peer
1297a76b1942SJohannes Berg  * @rx_beacon_signal_avg: signal strength average (in dBm) for beacons received
1298a76b1942SJohannes Berg  *	from this peer
1299739960f1SMohammed Shafi Shajakhan  * @rx_duration: aggregate PPDU duration(usecs) for all the frames from a peer
13006de39808SJohannes Berg  * @pertid: per-TID statistics, see &struct cfg80211_tid_stats, using the last
13016de39808SJohannes Berg  *	(IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs.
13028689c051SArend van Spriel  *	Note that this doesn't use the @filled bit, but is used if non-NULL.
1303c4b50cd3SVenkateswara Naralasetty  * @ack_signal: signal strength (in dBm) of the last ACK frame.
130481d5439dSBalaji Pothunoori  * @avg_ack_signal: average rssi value of ack packet for the no of msdu's has
130581d5439dSBalaji Pothunoori  *	been sent.
13060d4e14a3SAnkita Bajaj  * @rx_mpdu_count: number of MPDUs received from this station
13070d4e14a3SAnkita Bajaj  * @fcs_err_count: number of packets (MPDUs) received from this station with
13080d4e14a3SAnkita Bajaj  *	an FCS error. This counter should be incremented only when TA of the
13090d4e14a3SAnkita Bajaj  *	received packet with an FCS error matches the peer MAC address.
1310fd5b74dcSJohannes Berg  */
13112ec600d6SLuis Carlos Cobo struct station_info {
1312739960f1SMohammed Shafi Shajakhan 	u64 filled;
1313ebe27c91SMohammed Shafi Shajakhan 	u32 connected_time;
1314fd5b74dcSJohannes Berg 	u32 inactive_time;
131542745e03SVladimir Kondratiev 	u64 rx_bytes;
131642745e03SVladimir Kondratiev 	u64 tx_bytes;
13172ec600d6SLuis Carlos Cobo 	u16 llid;
13182ec600d6SLuis Carlos Cobo 	u16 plid;
13192ec600d6SLuis Carlos Cobo 	u8 plink_state;
1320420e7fabSHenning Rogge 	s8 signal;
1321541a45a1SBruno Randolf 	s8 signal_avg;
1322119363c7SFelix Fietkau 
1323119363c7SFelix Fietkau 	u8 chains;
1324119363c7SFelix Fietkau 	s8 chain_signal[IEEE80211_MAX_CHAINS];
1325119363c7SFelix Fietkau 	s8 chain_signal_avg[IEEE80211_MAX_CHAINS];
1326119363c7SFelix Fietkau 
1327420e7fabSHenning Rogge 	struct rate_info txrate;
1328c8dcfd8aSFelix Fietkau 	struct rate_info rxrate;
132998c8a60aSJouni Malinen 	u32 rx_packets;
133098c8a60aSJouni Malinen 	u32 tx_packets;
1331b206b4efSBruno Randolf 	u32 tx_retries;
1332b206b4efSBruno Randolf 	u32 tx_failed;
13335a5c731aSBen Greear 	u32 rx_dropped_misc;
1334f4263c98SPaul Stewart 	struct sta_bss_parameters bss_param;
1335bb6e753eSHelmut Schaa 	struct nl80211_sta_flag_update sta_flags;
1336f5ea9120SJohannes Berg 
1337f5ea9120SJohannes Berg 	int generation;
133850d3dfb7SJouni Malinen 
133950d3dfb7SJouni Malinen 	const u8 *assoc_req_ies;
134050d3dfb7SJouni Malinen 	size_t assoc_req_ies_len;
1341f612cedfSJouni Malinen 
1342a85e1d55SPaul Stewart 	u32 beacon_loss_count;
1343d299a1f2SJavier Cardona 	s64 t_offset;
13443b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode local_pm;
13453b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode peer_pm;
13463b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode nonpeer_pm;
1347a85e1d55SPaul Stewart 
1348867d849fSAntonio Quartulli 	u32 expected_throughput;
1349a76b1942SJohannes Berg 
1350a76b1942SJohannes Berg 	u64 rx_beacon;
1351739960f1SMohammed Shafi Shajakhan 	u64 rx_duration;
1352a76b1942SJohannes Berg 	u8 rx_beacon_signal_avg;
13538689c051SArend van Spriel 	struct cfg80211_tid_stats *pertid;
1354c4b50cd3SVenkateswara Naralasetty 	s8 ack_signal;
135581d5439dSBalaji Pothunoori 	s8 avg_ack_signal;
13560d4e14a3SAnkita Bajaj 
13570d4e14a3SAnkita Bajaj 	u32 rx_mpdu_count;
13580d4e14a3SAnkita Bajaj 	u32 fcs_err_count;
1359fd5b74dcSJohannes Berg };
1360fd5b74dcSJohannes Berg 
136161aaa0e8SLinus Lüssing #if IS_ENABLED(CONFIG_CFG80211)
136266f7ac50SMichael Wu /**
13637406353dSAntonio Quartulli  * cfg80211_get_station - retrieve information about a given station
13647406353dSAntonio Quartulli  * @dev: the device where the station is supposed to be connected to
13657406353dSAntonio Quartulli  * @mac_addr: the mac address of the station of interest
13667406353dSAntonio Quartulli  * @sinfo: pointer to the structure to fill with the information
13677406353dSAntonio Quartulli  *
13687406353dSAntonio Quartulli  * Returns 0 on success and sinfo is filled with the available information
13697406353dSAntonio Quartulli  * otherwise returns a negative error code and the content of sinfo has to be
13707406353dSAntonio Quartulli  * considered undefined.
13717406353dSAntonio Quartulli  */
13727406353dSAntonio Quartulli int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr,
13737406353dSAntonio Quartulli 			 struct station_info *sinfo);
137461aaa0e8SLinus Lüssing #else
137561aaa0e8SLinus Lüssing static inline int cfg80211_get_station(struct net_device *dev,
137661aaa0e8SLinus Lüssing 				       const u8 *mac_addr,
137761aaa0e8SLinus Lüssing 				       struct station_info *sinfo)
137861aaa0e8SLinus Lüssing {
137961aaa0e8SLinus Lüssing 	return -ENOENT;
138061aaa0e8SLinus Lüssing }
138161aaa0e8SLinus Lüssing #endif
13827406353dSAntonio Quartulli 
13837406353dSAntonio Quartulli /**
138466f7ac50SMichael Wu  * enum monitor_flags - monitor flags
138566f7ac50SMichael Wu  *
138666f7ac50SMichael Wu  * Monitor interface configuration flags. Note that these must be the bits
138766f7ac50SMichael Wu  * according to the nl80211 flags.
138866f7ac50SMichael Wu  *
1389818a986eSJohannes Berg  * @MONITOR_FLAG_CHANGED: set if the flags were changed
139066f7ac50SMichael Wu  * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS
139166f7ac50SMichael Wu  * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP
139266f7ac50SMichael Wu  * @MONITOR_FLAG_CONTROL: pass control frames
139366f7ac50SMichael Wu  * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering
139466f7ac50SMichael Wu  * @MONITOR_FLAG_COOK_FRAMES: report frames after processing
1395e057d3c3SFelix Fietkau  * @MONITOR_FLAG_ACTIVE: active monitor, ACKs frames on its MAC address
139666f7ac50SMichael Wu  */
139766f7ac50SMichael Wu enum monitor_flags {
1398818a986eSJohannes Berg 	MONITOR_FLAG_CHANGED		= 1<<__NL80211_MNTR_FLAG_INVALID,
139966f7ac50SMichael Wu 	MONITOR_FLAG_FCSFAIL		= 1<<NL80211_MNTR_FLAG_FCSFAIL,
140066f7ac50SMichael Wu 	MONITOR_FLAG_PLCPFAIL		= 1<<NL80211_MNTR_FLAG_PLCPFAIL,
140166f7ac50SMichael Wu 	MONITOR_FLAG_CONTROL		= 1<<NL80211_MNTR_FLAG_CONTROL,
140266f7ac50SMichael Wu 	MONITOR_FLAG_OTHER_BSS		= 1<<NL80211_MNTR_FLAG_OTHER_BSS,
140366f7ac50SMichael Wu 	MONITOR_FLAG_COOK_FRAMES	= 1<<NL80211_MNTR_FLAG_COOK_FRAMES,
1404e057d3c3SFelix Fietkau 	MONITOR_FLAG_ACTIVE		= 1<<NL80211_MNTR_FLAG_ACTIVE,
140566f7ac50SMichael Wu };
140666f7ac50SMichael Wu 
14072ec600d6SLuis Carlos Cobo /**
14082ec600d6SLuis Carlos Cobo  * enum mpath_info_flags -  mesh path information flags
14092ec600d6SLuis Carlos Cobo  *
14102ec600d6SLuis Carlos Cobo  * Used by the driver to indicate which info in &struct mpath_info it has filled
14112ec600d6SLuis Carlos Cobo  * in during get_station() or dump_station().
14122ec600d6SLuis Carlos Cobo  *
1413abe37c4bSJohannes Berg  * @MPATH_INFO_FRAME_QLEN: @frame_qlen filled
1414abe37c4bSJohannes Berg  * @MPATH_INFO_SN: @sn filled
1415abe37c4bSJohannes Berg  * @MPATH_INFO_METRIC: @metric filled
1416abe37c4bSJohannes Berg  * @MPATH_INFO_EXPTIME: @exptime filled
1417abe37c4bSJohannes Berg  * @MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled
1418abe37c4bSJohannes Berg  * @MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled
1419abe37c4bSJohannes Berg  * @MPATH_INFO_FLAGS: @flags filled
14202ec600d6SLuis Carlos Cobo  */
14212ec600d6SLuis Carlos Cobo enum mpath_info_flags {
14222ec600d6SLuis Carlos Cobo 	MPATH_INFO_FRAME_QLEN		= BIT(0),
1423d19b3bf6SRui Paulo 	MPATH_INFO_SN			= BIT(1),
14242ec600d6SLuis Carlos Cobo 	MPATH_INFO_METRIC		= BIT(2),
14252ec600d6SLuis Carlos Cobo 	MPATH_INFO_EXPTIME		= BIT(3),
14262ec600d6SLuis Carlos Cobo 	MPATH_INFO_DISCOVERY_TIMEOUT	= BIT(4),
14272ec600d6SLuis Carlos Cobo 	MPATH_INFO_DISCOVERY_RETRIES	= BIT(5),
14282ec600d6SLuis Carlos Cobo 	MPATH_INFO_FLAGS		= BIT(6),
14292ec600d6SLuis Carlos Cobo };
14302ec600d6SLuis Carlos Cobo 
14312ec600d6SLuis Carlos Cobo /**
14322ec600d6SLuis Carlos Cobo  * struct mpath_info - mesh path information
14332ec600d6SLuis Carlos Cobo  *
14342ec600d6SLuis Carlos Cobo  * Mesh path information filled by driver for get_mpath() and dump_mpath().
14352ec600d6SLuis Carlos Cobo  *
14362ec600d6SLuis Carlos Cobo  * @filled: bitfield of flags from &enum mpath_info_flags
14372ec600d6SLuis Carlos Cobo  * @frame_qlen: number of queued frames for this destination
1438d19b3bf6SRui Paulo  * @sn: target sequence number
14392ec600d6SLuis Carlos Cobo  * @metric: metric (cost) of this mesh path
14402ec600d6SLuis Carlos Cobo  * @exptime: expiration time for the mesh path from now, in msecs
14412ec600d6SLuis Carlos Cobo  * @flags: mesh path flags
14422ec600d6SLuis Carlos Cobo  * @discovery_timeout: total mesh path discovery timeout, in msecs
14432ec600d6SLuis Carlos Cobo  * @discovery_retries: mesh path discovery retries
1444f5ea9120SJohannes Berg  * @generation: generation number for nl80211 dumps.
1445f5ea9120SJohannes Berg  *	This number should increase every time the list of mesh paths
1446f5ea9120SJohannes Berg  *	changes, i.e. when a station is added or removed, so that
1447f5ea9120SJohannes Berg  *	userspace can tell whether it got a consistent snapshot.
14482ec600d6SLuis Carlos Cobo  */
14492ec600d6SLuis Carlos Cobo struct mpath_info {
14502ec600d6SLuis Carlos Cobo 	u32 filled;
14512ec600d6SLuis Carlos Cobo 	u32 frame_qlen;
1452d19b3bf6SRui Paulo 	u32 sn;
14532ec600d6SLuis Carlos Cobo 	u32 metric;
14542ec600d6SLuis Carlos Cobo 	u32 exptime;
14552ec600d6SLuis Carlos Cobo 	u32 discovery_timeout;
14562ec600d6SLuis Carlos Cobo 	u8 discovery_retries;
14572ec600d6SLuis Carlos Cobo 	u8 flags;
1458f5ea9120SJohannes Berg 
1459f5ea9120SJohannes Berg 	int generation;
14602ec600d6SLuis Carlos Cobo };
14612ec600d6SLuis Carlos Cobo 
14629f1ba906SJouni Malinen /**
14639f1ba906SJouni Malinen  * struct bss_parameters - BSS parameters
14649f1ba906SJouni Malinen  *
14659f1ba906SJouni Malinen  * Used to change BSS parameters (mainly for AP mode).
14669f1ba906SJouni Malinen  *
14679f1ba906SJouni Malinen  * @use_cts_prot: Whether to use CTS protection
14689f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
14699f1ba906SJouni Malinen  * @use_short_preamble: Whether the use of short preambles is allowed
14709f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
14719f1ba906SJouni Malinen  * @use_short_slot_time: Whether the use of short slot time is allowed
14729f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
147390c97a04SJouni Malinen  * @basic_rates: basic rates in IEEE 802.11 format
147490c97a04SJouni Malinen  *	(or NULL for no change)
147590c97a04SJouni Malinen  * @basic_rates_len: number of basic rates
1476fd8aaaf3SFelix Fietkau  * @ap_isolate: do not forward packets between connected stations
147750b12f59SHelmut Schaa  * @ht_opmode: HT Operation mode
147850b12f59SHelmut Schaa  * 	(u16 = opmode, -1 = do not change)
147953cabad7SJohannes Berg  * @p2p_ctwindow: P2P CT Window (-1 = no change)
148053cabad7SJohannes Berg  * @p2p_opp_ps: P2P opportunistic PS (-1 = no change)
14819f1ba906SJouni Malinen  */
14829f1ba906SJouni Malinen struct bss_parameters {
14839f1ba906SJouni Malinen 	int use_cts_prot;
14849f1ba906SJouni Malinen 	int use_short_preamble;
14859f1ba906SJouni Malinen 	int use_short_slot_time;
1486c1e5f471SJohannes Berg 	const u8 *basic_rates;
148790c97a04SJouni Malinen 	u8 basic_rates_len;
1488fd8aaaf3SFelix Fietkau 	int ap_isolate;
148950b12f59SHelmut Schaa 	int ht_opmode;
149053cabad7SJohannes Berg 	s8 p2p_ctwindow, p2p_opp_ps;
14919f1ba906SJouni Malinen };
14922ec600d6SLuis Carlos Cobo 
14933ddd53f3SChun-Yeow Yeoh /**
149429cbe68cSJohannes Berg  * struct mesh_config - 802.11s mesh configuration
149529cbe68cSJohannes Berg  *
149629cbe68cSJohannes Berg  * These parameters can be changed while the mesh is active.
14973ddd53f3SChun-Yeow Yeoh  *
14983ddd53f3SChun-Yeow Yeoh  * @dot11MeshRetryTimeout: the initial retry timeout in millisecond units used
14993ddd53f3SChun-Yeow Yeoh  *	by the Mesh Peering Open message
15003ddd53f3SChun-Yeow Yeoh  * @dot11MeshConfirmTimeout: the initial retry timeout in millisecond units
15013ddd53f3SChun-Yeow Yeoh  *	used by the Mesh Peering Open message
15023ddd53f3SChun-Yeow Yeoh  * @dot11MeshHoldingTimeout: the confirm timeout in millisecond units used by
15033ddd53f3SChun-Yeow Yeoh  *	the mesh peering management to close a mesh peering
15043ddd53f3SChun-Yeow Yeoh  * @dot11MeshMaxPeerLinks: the maximum number of peer links allowed on this
15053ddd53f3SChun-Yeow Yeoh  *	mesh interface
15063ddd53f3SChun-Yeow Yeoh  * @dot11MeshMaxRetries: the maximum number of peer link open retries that can
15073ddd53f3SChun-Yeow Yeoh  *	be sent to establish a new peer link instance in a mesh
15083ddd53f3SChun-Yeow Yeoh  * @dot11MeshTTL: the value of TTL field set at a source mesh STA
15093ddd53f3SChun-Yeow Yeoh  * @element_ttl: the value of TTL field set at a mesh STA for path selection
15103ddd53f3SChun-Yeow Yeoh  *	elements
15113ddd53f3SChun-Yeow Yeoh  * @auto_open_plinks: whether we should automatically open peer links when we
15123ddd53f3SChun-Yeow Yeoh  *	detect compatible mesh peers
15133ddd53f3SChun-Yeow Yeoh  * @dot11MeshNbrOffsetMaxNeighbor: the maximum number of neighbors to
15143ddd53f3SChun-Yeow Yeoh  *	synchronize to for 11s default synchronization method
15153ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPmaxPREQretries: the number of action frames containing a PREQ
15163ddd53f3SChun-Yeow Yeoh  *	that an originator mesh STA can send to a particular path target
15173ddd53f3SChun-Yeow Yeoh  * @path_refresh_time: how frequently to refresh mesh paths in milliseconds
15183ddd53f3SChun-Yeow Yeoh  * @min_discovery_timeout: the minimum length of time to wait until giving up on
15193ddd53f3SChun-Yeow Yeoh  *	a path discovery in milliseconds
15203ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPactivePathTimeout: the time (in TUs) for which mesh STAs
15213ddd53f3SChun-Yeow Yeoh  *	receiving a PREQ shall consider the forwarding information from the
15223ddd53f3SChun-Yeow Yeoh  *	root to be valid. (TU = time unit)
15233ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPpreqMinInterval: the minimum interval of time (in TUs) during
15243ddd53f3SChun-Yeow Yeoh  *	which a mesh STA can send only one action frame containing a PREQ
15253ddd53f3SChun-Yeow Yeoh  *	element
15263ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPperrMinInterval: the minimum interval of time (in TUs) during
15273ddd53f3SChun-Yeow Yeoh  *	which a mesh STA can send only one Action frame containing a PERR
15283ddd53f3SChun-Yeow Yeoh  *	element
15293ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPnetDiameterTraversalTime: the interval of time (in TUs) that
15303ddd53f3SChun-Yeow Yeoh  *	it takes for an HWMP information element to propagate across the mesh
15313ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPRootMode: the configuration of a mesh STA as root mesh STA
15323ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPRannInterval: the interval of time (in TUs) between root
15333ddd53f3SChun-Yeow Yeoh  *	announcements are transmitted
15343ddd53f3SChun-Yeow Yeoh  * @dot11MeshGateAnnouncementProtocol: whether to advertise that this mesh
15353ddd53f3SChun-Yeow Yeoh  *	station has access to a broader network beyond the MBSS. (This is
15363ddd53f3SChun-Yeow Yeoh  *	missnamed in draft 12.0: dot11MeshGateAnnouncementProtocol set to true
15373ddd53f3SChun-Yeow Yeoh  *	only means that the station will announce others it's a mesh gate, but
15383ddd53f3SChun-Yeow Yeoh  *	not necessarily using the gate announcement protocol. Still keeping the
15393ddd53f3SChun-Yeow Yeoh  *	same nomenclature to be in sync with the spec)
15403ddd53f3SChun-Yeow Yeoh  * @dot11MeshForwarding: whether the Mesh STA is forwarding or non-forwarding
15413ddd53f3SChun-Yeow Yeoh  *	entity (default is TRUE - forwarding entity)
15423ddd53f3SChun-Yeow Yeoh  * @rssi_threshold: the threshold for average signal strength of candidate
15433ddd53f3SChun-Yeow Yeoh  *	station to establish a peer link
15443ddd53f3SChun-Yeow Yeoh  * @ht_opmode: mesh HT protection mode
1545ac1073a6SChun-Yeow Yeoh  *
1546ac1073a6SChun-Yeow Yeoh  * @dot11MeshHWMPactivePathToRootTimeout: The time (in TUs) for which mesh STAs
1547ac1073a6SChun-Yeow Yeoh  *	receiving a proactive PREQ shall consider the forwarding information to
1548ac1073a6SChun-Yeow Yeoh  *	the root mesh STA to be valid.
1549ac1073a6SChun-Yeow Yeoh  *
1550ac1073a6SChun-Yeow Yeoh  * @dot11MeshHWMProotInterval: The interval of time (in TUs) between proactive
1551ac1073a6SChun-Yeow Yeoh  *	PREQs are transmitted.
1552728b19e5SChun-Yeow Yeoh  * @dot11MeshHWMPconfirmationInterval: The minimum interval of time (in TUs)
1553728b19e5SChun-Yeow Yeoh  *	during which a mesh STA can send only one Action frame containing
1554728b19e5SChun-Yeow Yeoh  *	a PREQ element for root path confirmation.
15553b1c5a53SMarco Porsch  * @power_mode: The default mesh power save mode which will be the initial
15563b1c5a53SMarco Porsch  *	setting for new peer links.
15573b1c5a53SMarco Porsch  * @dot11MeshAwakeWindowDuration: The duration in TUs the STA will remain awake
15583b1c5a53SMarco Porsch  *	after transmitting its beacon.
15598e7c0538SColleen Twitty  * @plink_timeout: If no tx activity is seen from a STA we've established
15608e7c0538SColleen Twitty  *	peering with for longer than this time (in seconds), then remove it
15618e7c0538SColleen Twitty  *	from the STA's list of peers.  Default is 30 minutes.
156229cbe68cSJohannes Berg  */
156393da9cc1Scolin@cozybit.com struct mesh_config {
156493da9cc1Scolin@cozybit.com 	u16 dot11MeshRetryTimeout;
156593da9cc1Scolin@cozybit.com 	u16 dot11MeshConfirmTimeout;
156693da9cc1Scolin@cozybit.com 	u16 dot11MeshHoldingTimeout;
156793da9cc1Scolin@cozybit.com 	u16 dot11MeshMaxPeerLinks;
156893da9cc1Scolin@cozybit.com 	u8 dot11MeshMaxRetries;
156993da9cc1Scolin@cozybit.com 	u8 dot11MeshTTL;
157045904f21SJavier Cardona 	u8 element_ttl;
157193da9cc1Scolin@cozybit.com 	bool auto_open_plinks;
1572d299a1f2SJavier Cardona 	u32 dot11MeshNbrOffsetMaxNeighbor;
157393da9cc1Scolin@cozybit.com 	u8 dot11MeshHWMPmaxPREQretries;
157493da9cc1Scolin@cozybit.com 	u32 path_refresh_time;
157593da9cc1Scolin@cozybit.com 	u16 min_discovery_timeout;
157693da9cc1Scolin@cozybit.com 	u32 dot11MeshHWMPactivePathTimeout;
157793da9cc1Scolin@cozybit.com 	u16 dot11MeshHWMPpreqMinInterval;
1578dca7e943SThomas Pedersen 	u16 dot11MeshHWMPperrMinInterval;
157993da9cc1Scolin@cozybit.com 	u16 dot11MeshHWMPnetDiameterTraversalTime;
158063c5723bSRui Paulo 	u8 dot11MeshHWMPRootMode;
15810507e159SJavier Cardona 	u16 dot11MeshHWMPRannInterval;
158216dd7267SJavier Cardona 	bool dot11MeshGateAnnouncementProtocol;
158394f90656SChun-Yeow Yeoh 	bool dot11MeshForwarding;
158455335137SAshok Nagarajan 	s32 rssi_threshold;
158570c33eaaSAshok Nagarajan 	u16 ht_opmode;
1586ac1073a6SChun-Yeow Yeoh 	u32 dot11MeshHWMPactivePathToRootTimeout;
1587ac1073a6SChun-Yeow Yeoh 	u16 dot11MeshHWMProotInterval;
1588728b19e5SChun-Yeow Yeoh 	u16 dot11MeshHWMPconfirmationInterval;
15893b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode power_mode;
15903b1c5a53SMarco Porsch 	u16 dot11MeshAwakeWindowDuration;
15918e7c0538SColleen Twitty 	u32 plink_timeout;
159293da9cc1Scolin@cozybit.com };
159393da9cc1Scolin@cozybit.com 
159431888487SJouni Malinen /**
159529cbe68cSJohannes Berg  * struct mesh_setup - 802.11s mesh setup configuration
1596683b6d3bSJohannes Berg  * @chandef: defines the channel to use
159729cbe68cSJohannes Berg  * @mesh_id: the mesh ID
159829cbe68cSJohannes Berg  * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes
1599d299a1f2SJavier Cardona  * @sync_method: which synchronization method to use
1600c80d545dSJavier Cardona  * @path_sel_proto: which path selection protocol to use
1601c80d545dSJavier Cardona  * @path_metric: which metric to use
16026e16d90bSColleen Twitty  * @auth_id: which authentication method this mesh is using
1603581a8b0fSJavier Cardona  * @ie: vendor information elements (optional)
1604581a8b0fSJavier Cardona  * @ie_len: length of vendor information elements
1605b130e5ceSJavier Cardona  * @is_authenticated: this mesh requires authentication
1606b130e5ceSJavier Cardona  * @is_secure: this mesh uses security
1607bb2798d4SThomas Pedersen  * @user_mpm: userspace handles all MPM functions
16089bdbf04dSMarco Porsch  * @dtim_period: DTIM period to use
16099bdbf04dSMarco Porsch  * @beacon_interval: beacon interval to use
16104bb62344SChun-Yeow Yeoh  * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a]
1611ffb3cf30SAshok Nagarajan  * @basic_rates: basic rates to use when creating the mesh
16128564e382SJohannes Berg  * @beacon_rate: bitrate to be used for beacons
1613d37d49c2SBenjamin Berg  * @userspace_handles_dfs: whether user space controls DFS operation, i.e.
1614d37d49c2SBenjamin Berg  *	changes the channel when a radar is detected. This is required
1615d37d49c2SBenjamin Berg  *	to operate on DFS channels.
16161224f583SDenis Kenzior  * @control_port_over_nl80211: TRUE if userspace expects to exchange control
16171224f583SDenis Kenzior  *	port frames over NL80211 instead of the network interface.
161829cbe68cSJohannes Berg  *
161929cbe68cSJohannes Berg  * These parameters are fixed when the mesh is created.
162029cbe68cSJohannes Berg  */
162129cbe68cSJohannes Berg struct mesh_setup {
1622683b6d3bSJohannes Berg 	struct cfg80211_chan_def chandef;
162329cbe68cSJohannes Berg 	const u8 *mesh_id;
162429cbe68cSJohannes Berg 	u8 mesh_id_len;
1625d299a1f2SJavier Cardona 	u8 sync_method;
1626c80d545dSJavier Cardona 	u8 path_sel_proto;
1627c80d545dSJavier Cardona 	u8 path_metric;
16286e16d90bSColleen Twitty 	u8 auth_id;
1629581a8b0fSJavier Cardona 	const u8 *ie;
1630581a8b0fSJavier Cardona 	u8 ie_len;
1631b130e5ceSJavier Cardona 	bool is_authenticated;
163215d5dda6SJavier Cardona 	bool is_secure;
1633bb2798d4SThomas Pedersen 	bool user_mpm;
16349bdbf04dSMarco Porsch 	u8 dtim_period;
16359bdbf04dSMarco Porsch 	u16 beacon_interval;
163657fbcce3SJohannes Berg 	int mcast_rate[NUM_NL80211_BANDS];
1637ffb3cf30SAshok Nagarajan 	u32 basic_rates;
16388564e382SJohannes Berg 	struct cfg80211_bitrate_mask beacon_rate;
1639d37d49c2SBenjamin Berg 	bool userspace_handles_dfs;
16401224f583SDenis Kenzior 	bool control_port_over_nl80211;
164129cbe68cSJohannes Berg };
164229cbe68cSJohannes Berg 
164329cbe68cSJohannes Berg /**
16446e0bd6c3SRostislav Lisovy  * struct ocb_setup - 802.11p OCB mode setup configuration
16456e0bd6c3SRostislav Lisovy  * @chandef: defines the channel to use
16466e0bd6c3SRostislav Lisovy  *
16476e0bd6c3SRostislav Lisovy  * These parameters are fixed when connecting to the network
16486e0bd6c3SRostislav Lisovy  */
16496e0bd6c3SRostislav Lisovy struct ocb_setup {
16506e0bd6c3SRostislav Lisovy 	struct cfg80211_chan_def chandef;
16516e0bd6c3SRostislav Lisovy };
16526e0bd6c3SRostislav Lisovy 
16536e0bd6c3SRostislav Lisovy /**
165431888487SJouni Malinen  * struct ieee80211_txq_params - TX queue parameters
1655a3304b0aSJohannes Berg  * @ac: AC identifier
165631888487SJouni Malinen  * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled
165731888487SJouni Malinen  * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range
165831888487SJouni Malinen  *	1..32767]
165931888487SJouni Malinen  * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range
166031888487SJouni Malinen  *	1..32767]
166131888487SJouni Malinen  * @aifs: Arbitration interframe space [0..255]
166231888487SJouni Malinen  */
166331888487SJouni Malinen struct ieee80211_txq_params {
1664a3304b0aSJohannes Berg 	enum nl80211_ac ac;
166531888487SJouni Malinen 	u16 txop;
166631888487SJouni Malinen 	u16 cwmin;
166731888487SJouni Malinen 	u16 cwmax;
166831888487SJouni Malinen 	u8 aifs;
166931888487SJouni Malinen };
167031888487SJouni Malinen 
1671d70e9693SJohannes Berg /**
1672d70e9693SJohannes Berg  * DOC: Scanning and BSS list handling
1673d70e9693SJohannes Berg  *
1674d70e9693SJohannes Berg  * The scanning process itself is fairly simple, but cfg80211 offers quite
1675d70e9693SJohannes Berg  * a bit of helper functionality. To start a scan, the scan operation will
1676d70e9693SJohannes Berg  * be invoked with a scan definition. This scan definition contains the
1677d70e9693SJohannes Berg  * channels to scan, and the SSIDs to send probe requests for (including the
1678d70e9693SJohannes Berg  * wildcard, if desired). A passive scan is indicated by having no SSIDs to
1679d70e9693SJohannes Berg  * probe. Additionally, a scan request may contain extra information elements
1680d70e9693SJohannes Berg  * that should be added to the probe request. The IEs are guaranteed to be
1681d70e9693SJohannes Berg  * well-formed, and will not exceed the maximum length the driver advertised
1682d70e9693SJohannes Berg  * in the wiphy structure.
1683d70e9693SJohannes Berg  *
1684d70e9693SJohannes Berg  * When scanning finds a BSS, cfg80211 needs to be notified of that, because
1685d70e9693SJohannes Berg  * it is responsible for maintaining the BSS list; the driver should not
1686d70e9693SJohannes Berg  * maintain a list itself. For this notification, various functions exist.
1687d70e9693SJohannes Berg  *
1688d70e9693SJohannes Berg  * Since drivers do not maintain a BSS list, there are also a number of
1689d70e9693SJohannes Berg  * functions to search for a BSS and obtain information about it from the
1690d70e9693SJohannes Berg  * BSS structure cfg80211 maintains. The BSS list is also made available
1691d70e9693SJohannes Berg  * to userspace.
1692d70e9693SJohannes Berg  */
169372bdcf34SJouni Malinen 
1694704232c2SJohannes Berg /**
16952a519311SJohannes Berg  * struct cfg80211_ssid - SSID description
16962a519311SJohannes Berg  * @ssid: the SSID
16972a519311SJohannes Berg  * @ssid_len: length of the ssid
16982a519311SJohannes Berg  */
16992a519311SJohannes Berg struct cfg80211_ssid {
17002a519311SJohannes Berg 	u8 ssid[IEEE80211_MAX_SSID_LEN];
17012a519311SJohannes Berg 	u8 ssid_len;
17022a519311SJohannes Berg };
17032a519311SJohannes Berg 
17042a519311SJohannes Berg /**
17051d76250bSAvraham Stern  * struct cfg80211_scan_info - information about completed scan
17061d76250bSAvraham Stern  * @scan_start_tsf: scan start time in terms of the TSF of the BSS that the
17071d76250bSAvraham Stern  *	wireless device that requested the scan is connected to. If this
17081d76250bSAvraham Stern  *	information is not available, this field is left zero.
17091d76250bSAvraham Stern  * @tsf_bssid: the BSSID according to which %scan_start_tsf is set.
17101d76250bSAvraham Stern  * @aborted: set to true if the scan was aborted for any reason,
17111d76250bSAvraham Stern  *	userspace will be notified of that
17121d76250bSAvraham Stern  */
17131d76250bSAvraham Stern struct cfg80211_scan_info {
17141d76250bSAvraham Stern 	u64 scan_start_tsf;
17151d76250bSAvraham Stern 	u8 tsf_bssid[ETH_ALEN] __aligned(2);
17161d76250bSAvraham Stern 	bool aborted;
17171d76250bSAvraham Stern };
17181d76250bSAvraham Stern 
17191d76250bSAvraham Stern /**
17202a519311SJohannes Berg  * struct cfg80211_scan_request - scan request description
17212a519311SJohannes Berg  *
17222a519311SJohannes Berg  * @ssids: SSIDs to scan for (active scan only)
17232a519311SJohannes Berg  * @n_ssids: number of SSIDs
17242a519311SJohannes Berg  * @channels: channels to scan on.
1725ca3dbc20SHelmut Schaa  * @n_channels: total number of channels to scan
1726dcd6eac1SSimon Wunderlich  * @scan_width: channel width for scanning
172770692ad2SJouni Malinen  * @ie: optional information element(s) to add into Probe Request or %NULL
172870692ad2SJouni Malinen  * @ie_len: length of ie in octets
17291d76250bSAvraham Stern  * @duration: how long to listen on each channel, in TUs. If
17301d76250bSAvraham Stern  *	%duration_mandatory is not set, this is the maximum dwell time and
17311d76250bSAvraham Stern  *	the actual dwell time may be shorter.
17321d76250bSAvraham Stern  * @duration_mandatory: if set, the scan duration must be as specified by the
17331d76250bSAvraham Stern  *	%duration field.
1734ed473771SSam Leffler  * @flags: bit field of flags controlling operation
173534850ab2SJohannes Berg  * @rates: bitmap of rates to advertise for each band
17362a519311SJohannes Berg  * @wiphy: the wiphy this was for
173715d6030bSSam Leffler  * @scan_start: time (in jiffies) when the scan started
1738fd014284SJohannes Berg  * @wdev: the wireless device to scan for
17391d76250bSAvraham Stern  * @info: (internal) information about completed scan
17405fe231e8SJohannes Berg  * @notified: (internal) scan request was notified as done or aborted
1741e9f935e3SRajkumar Manoharan  * @no_cck: used to send probe requests at non CCK rate in 2GHz band
1742ad2b26abSJohannes Berg  * @mac_addr: MAC address used with randomisation
1743ad2b26abSJohannes Berg  * @mac_addr_mask: MAC address mask used with randomisation, bits that
1744ad2b26abSJohannes Berg  *	are 0 in the mask should be randomised, bits that are 1 should
1745ad2b26abSJohannes Berg  *	be taken from the @mac_addr
1746818965d3SJouni Malinen  * @bssid: BSSID to scan for (most commonly, the wildcard BSSID)
17472a519311SJohannes Berg  */
17482a519311SJohannes Berg struct cfg80211_scan_request {
17492a519311SJohannes Berg 	struct cfg80211_ssid *ssids;
17502a519311SJohannes Berg 	int n_ssids;
17512a519311SJohannes Berg 	u32 n_channels;
1752dcd6eac1SSimon Wunderlich 	enum nl80211_bss_scan_width scan_width;
1753de95a54bSJohannes Berg 	const u8 *ie;
175470692ad2SJouni Malinen 	size_t ie_len;
17551d76250bSAvraham Stern 	u16 duration;
17561d76250bSAvraham Stern 	bool duration_mandatory;
1757ed473771SSam Leffler 	u32 flags;
17582a519311SJohannes Berg 
175957fbcce3SJohannes Berg 	u32 rates[NUM_NL80211_BANDS];
176034850ab2SJohannes Berg 
1761fd014284SJohannes Berg 	struct wireless_dev *wdev;
1762fd014284SJohannes Berg 
1763ad2b26abSJohannes Berg 	u8 mac_addr[ETH_ALEN] __aligned(2);
1764ad2b26abSJohannes Berg 	u8 mac_addr_mask[ETH_ALEN] __aligned(2);
1765818965d3SJouni Malinen 	u8 bssid[ETH_ALEN] __aligned(2);
1766ad2b26abSJohannes Berg 
17672a519311SJohannes Berg 	/* internal */
17682a519311SJohannes Berg 	struct wiphy *wiphy;
176915d6030bSSam Leffler 	unsigned long scan_start;
17701d76250bSAvraham Stern 	struct cfg80211_scan_info info;
17711d76250bSAvraham Stern 	bool notified;
1772e9f935e3SRajkumar Manoharan 	bool no_cck;
17735ba63533SJohannes Berg 
17745ba63533SJohannes Berg 	/* keep last */
17755ba63533SJohannes Berg 	struct ieee80211_channel *channels[0];
17762a519311SJohannes Berg };
17772a519311SJohannes Berg 
1778ad2b26abSJohannes Berg static inline void get_random_mask_addr(u8 *buf, const u8 *addr, const u8 *mask)
1779ad2b26abSJohannes Berg {
1780ad2b26abSJohannes Berg 	int i;
1781ad2b26abSJohannes Berg 
1782ad2b26abSJohannes Berg 	get_random_bytes(buf, ETH_ALEN);
1783ad2b26abSJohannes Berg 	for (i = 0; i < ETH_ALEN; i++) {
1784ad2b26abSJohannes Berg 		buf[i] &= ~mask[i];
1785ad2b26abSJohannes Berg 		buf[i] |= addr[i] & mask[i];
1786ad2b26abSJohannes Berg 	}
1787ad2b26abSJohannes Berg }
1788ad2b26abSJohannes Berg 
17892a519311SJohannes Berg /**
1790a1f1c21cSLuciano Coelho  * struct cfg80211_match_set - sets of attributes to match
1791a1f1c21cSLuciano Coelho  *
17923007e352SArend Van Spriel  * @ssid: SSID to be matched; may be zero-length in case of BSSID match
17933007e352SArend Van Spriel  *	or no match (RSSI only)
17943007e352SArend Van Spriel  * @bssid: BSSID to be matched; may be all-zero BSSID in case of SSID match
17953007e352SArend Van Spriel  *	or no match (RSSI only)
1796ea73cbceSJohannes Berg  * @rssi_thold: don't report scan results below this threshold (in s32 dBm)
1797a1f1c21cSLuciano Coelho  */
1798a1f1c21cSLuciano Coelho struct cfg80211_match_set {
1799a1f1c21cSLuciano Coelho 	struct cfg80211_ssid ssid;
18003007e352SArend Van Spriel 	u8 bssid[ETH_ALEN];
1801ea73cbceSJohannes Berg 	s32 rssi_thold;
1802a1f1c21cSLuciano Coelho };
1803a1f1c21cSLuciano Coelho 
1804a1f1c21cSLuciano Coelho /**
18053b06d277SAvraham Stern  * struct cfg80211_sched_scan_plan - scan plan for scheduled scan
18063b06d277SAvraham Stern  *
18073b06d277SAvraham Stern  * @interval: interval between scheduled scan iterations. In seconds.
18083b06d277SAvraham Stern  * @iterations: number of scan iterations in this scan plan. Zero means
18093b06d277SAvraham Stern  *	infinite loop.
18103b06d277SAvraham Stern  *	The last scan plan will always have this parameter set to zero,
18113b06d277SAvraham Stern  *	all other scan plans will have a finite number of iterations.
18123b06d277SAvraham Stern  */
18133b06d277SAvraham Stern struct cfg80211_sched_scan_plan {
18143b06d277SAvraham Stern 	u32 interval;
18153b06d277SAvraham Stern 	u32 iterations;
18163b06d277SAvraham Stern };
18173b06d277SAvraham Stern 
18183b06d277SAvraham Stern /**
1819bf95ecdbSvamsi krishna  * struct cfg80211_bss_select_adjust - BSS selection with RSSI adjustment.
1820bf95ecdbSvamsi krishna  *
1821bf95ecdbSvamsi krishna  * @band: band of BSS which should match for RSSI level adjustment.
1822bf95ecdbSvamsi krishna  * @delta: value of RSSI level adjustment.
1823bf95ecdbSvamsi krishna  */
1824bf95ecdbSvamsi krishna struct cfg80211_bss_select_adjust {
1825bf95ecdbSvamsi krishna 	enum nl80211_band band;
1826bf95ecdbSvamsi krishna 	s8 delta;
1827bf95ecdbSvamsi krishna };
1828bf95ecdbSvamsi krishna 
1829bf95ecdbSvamsi krishna /**
1830807f8a8cSLuciano Coelho  * struct cfg80211_sched_scan_request - scheduled scan request description
1831807f8a8cSLuciano Coelho  *
183296b08fd6SArend Van Spriel  * @reqid: identifies this request.
1833807f8a8cSLuciano Coelho  * @ssids: SSIDs to scan for (passed in the probe_reqs in active scans)
1834807f8a8cSLuciano Coelho  * @n_ssids: number of SSIDs
1835807f8a8cSLuciano Coelho  * @n_channels: total number of channels to scan
1836dcd6eac1SSimon Wunderlich  * @scan_width: channel width for scanning
1837807f8a8cSLuciano Coelho  * @ie: optional information element(s) to add into Probe Request or %NULL
1838807f8a8cSLuciano Coelho  * @ie_len: length of ie in octets
1839ed473771SSam Leffler  * @flags: bit field of flags controlling operation
1840a1f1c21cSLuciano Coelho  * @match_sets: sets of parameters to be matched for a scan result
1841a1f1c21cSLuciano Coelho  * 	entry to be considered valid and to be passed to the host
1842a1f1c21cSLuciano Coelho  * 	(others are filtered out).
1843a1f1c21cSLuciano Coelho  *	If ommited, all results are passed.
1844a1f1c21cSLuciano Coelho  * @n_match_sets: number of match sets
18456406c919SJohannes Berg  * @report_results: indicates that results were reported for this request
1846807f8a8cSLuciano Coelho  * @wiphy: the wiphy this was for
1847807f8a8cSLuciano Coelho  * @dev: the interface
1848077f897aSJohannes Berg  * @scan_start: start time of the scheduled scan
1849807f8a8cSLuciano Coelho  * @channels: channels to scan
1850ea73cbceSJohannes Berg  * @min_rssi_thold: for drivers only supporting a single threshold, this
1851ea73cbceSJohannes Berg  *	contains the minimum over all matchsets
1852ad2b26abSJohannes Berg  * @mac_addr: MAC address used with randomisation
1853ad2b26abSJohannes Berg  * @mac_addr_mask: MAC address mask used with randomisation, bits that
1854ad2b26abSJohannes Berg  *	are 0 in the mask should be randomised, bits that are 1 should
1855ad2b26abSJohannes Berg  *	be taken from the @mac_addr
18563b06d277SAvraham Stern  * @scan_plans: scan plans to be executed in this scheduled scan. Lowest
18573b06d277SAvraham Stern  *	index must be executed first.
18583b06d277SAvraham Stern  * @n_scan_plans: number of scan plans, at least 1.
185931a60ed1SJukka Rissanen  * @rcu_head: RCU callback used to free the struct
186093a1e86cSJukka Rissanen  * @owner_nlportid: netlink portid of owner (if this should is a request
186193a1e86cSJukka Rissanen  *	owned by a particular socket)
1862ca986ad9SArend Van Spriel  * @nl_owner_dead: netlink owner socket was closed - this request be freed
1863ca986ad9SArend Van Spriel  * @list: for keeping list of requests.
18649c748934SLuciano Coelho  * @delay: delay in seconds to use before starting the first scan
18659c748934SLuciano Coelho  *	cycle.  The driver may ignore this parameter and start
18669c748934SLuciano Coelho  *	immediately (or at any other time), if this feature is not
18679c748934SLuciano Coelho  *	supported.
1868bf95ecdbSvamsi krishna  * @relative_rssi_set: Indicates whether @relative_rssi is set or not.
1869bf95ecdbSvamsi krishna  * @relative_rssi: Relative RSSI threshold in dB to restrict scan result
1870bf95ecdbSvamsi krishna  *	reporting in connected state to cases where a matching BSS is determined
1871bf95ecdbSvamsi krishna  *	to have better or slightly worse RSSI than the current connected BSS.
1872bf95ecdbSvamsi krishna  *	The relative RSSI threshold values are ignored in disconnected state.
1873bf95ecdbSvamsi krishna  * @rssi_adjust: delta dB of RSSI preference to be given to the BSSs that belong
1874bf95ecdbSvamsi krishna  *	to the specified band while deciding whether a better BSS is reported
1875bf95ecdbSvamsi krishna  *	using @relative_rssi. If delta is a negative number, the BSSs that
1876bf95ecdbSvamsi krishna  *	belong to the specified band will be penalized by delta dB in relative
1877bf95ecdbSvamsi krishna  *	comparisions.
1878807f8a8cSLuciano Coelho  */
1879807f8a8cSLuciano Coelho struct cfg80211_sched_scan_request {
188096b08fd6SArend Van Spriel 	u64 reqid;
1881807f8a8cSLuciano Coelho 	struct cfg80211_ssid *ssids;
1882807f8a8cSLuciano Coelho 	int n_ssids;
1883807f8a8cSLuciano Coelho 	u32 n_channels;
1884dcd6eac1SSimon Wunderlich 	enum nl80211_bss_scan_width scan_width;
1885807f8a8cSLuciano Coelho 	const u8 *ie;
1886807f8a8cSLuciano Coelho 	size_t ie_len;
1887ed473771SSam Leffler 	u32 flags;
1888a1f1c21cSLuciano Coelho 	struct cfg80211_match_set *match_sets;
1889a1f1c21cSLuciano Coelho 	int n_match_sets;
1890ea73cbceSJohannes Berg 	s32 min_rssi_thold;
18919c748934SLuciano Coelho 	u32 delay;
18923b06d277SAvraham Stern 	struct cfg80211_sched_scan_plan *scan_plans;
18933b06d277SAvraham Stern 	int n_scan_plans;
1894807f8a8cSLuciano Coelho 
1895ad2b26abSJohannes Berg 	u8 mac_addr[ETH_ALEN] __aligned(2);
1896ad2b26abSJohannes Berg 	u8 mac_addr_mask[ETH_ALEN] __aligned(2);
1897ad2b26abSJohannes Berg 
1898bf95ecdbSvamsi krishna 	bool relative_rssi_set;
1899bf95ecdbSvamsi krishna 	s8 relative_rssi;
1900bf95ecdbSvamsi krishna 	struct cfg80211_bss_select_adjust rssi_adjust;
1901bf95ecdbSvamsi krishna 
1902807f8a8cSLuciano Coelho 	/* internal */
1903807f8a8cSLuciano Coelho 	struct wiphy *wiphy;
1904807f8a8cSLuciano Coelho 	struct net_device *dev;
190515d6030bSSam Leffler 	unsigned long scan_start;
1906b34939b9SArend Van Spriel 	bool report_results;
190731a60ed1SJukka Rissanen 	struct rcu_head rcu_head;
190893a1e86cSJukka Rissanen 	u32 owner_nlportid;
1909ca986ad9SArend Van Spriel 	bool nl_owner_dead;
1910ca986ad9SArend Van Spriel 	struct list_head list;
1911807f8a8cSLuciano Coelho 
1912807f8a8cSLuciano Coelho 	/* keep last */
1913807f8a8cSLuciano Coelho 	struct ieee80211_channel *channels[0];
1914807f8a8cSLuciano Coelho };
1915807f8a8cSLuciano Coelho 
1916807f8a8cSLuciano Coelho /**
19172a519311SJohannes Berg  * enum cfg80211_signal_type - signal type
19182a519311SJohannes Berg  *
19192a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available
19202a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm)
19212a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100
19222a519311SJohannes Berg  */
19232a519311SJohannes Berg enum cfg80211_signal_type {
19242a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_NONE,
19252a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_MBM,
19262a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_UNSPEC,
19272a519311SJohannes Berg };
19282a519311SJohannes Berg 
19292a519311SJohannes Berg /**
19306e19bc4bSDmitry Shmidt  * struct cfg80211_inform_bss - BSS inform data
19316e19bc4bSDmitry Shmidt  * @chan: channel the frame was received on
19326e19bc4bSDmitry Shmidt  * @scan_width: scan width that was used
19336e19bc4bSDmitry Shmidt  * @signal: signal strength value, according to the wiphy's
19346e19bc4bSDmitry Shmidt  *	signal type
19356e19bc4bSDmitry Shmidt  * @boottime_ns: timestamp (CLOCK_BOOTTIME) when the information was
19366e19bc4bSDmitry Shmidt  *	received; should match the time when the frame was actually
19376e19bc4bSDmitry Shmidt  *	received by the device (not just by the host, in case it was
19386e19bc4bSDmitry Shmidt  *	buffered on the device) and be accurate to about 10ms.
19396e19bc4bSDmitry Shmidt  *	If the frame isn't buffered, just passing the return value of
19406e19bc4bSDmitry Shmidt  *	ktime_get_boot_ns() is likely appropriate.
19411d76250bSAvraham Stern  * @parent_tsf: the time at the start of reception of the first octet of the
19421d76250bSAvraham Stern  *	timestamp field of the frame. The time is the TSF of the BSS specified
19431d76250bSAvraham Stern  *	by %parent_bssid.
19441d76250bSAvraham Stern  * @parent_bssid: the BSS according to which %parent_tsf is set. This is set to
19451d76250bSAvraham Stern  *	the BSS that requested the scan in which the beacon/probe was received.
1946983dafaaSSunil Dutt  * @chains: bitmask for filled values in @chain_signal.
1947983dafaaSSunil Dutt  * @chain_signal: per-chain signal strength of last received BSS in dBm.
19486e19bc4bSDmitry Shmidt  */
19496e19bc4bSDmitry Shmidt struct cfg80211_inform_bss {
19506e19bc4bSDmitry Shmidt 	struct ieee80211_channel *chan;
19516e19bc4bSDmitry Shmidt 	enum nl80211_bss_scan_width scan_width;
19526e19bc4bSDmitry Shmidt 	s32 signal;
19536e19bc4bSDmitry Shmidt 	u64 boottime_ns;
19541d76250bSAvraham Stern 	u64 parent_tsf;
19551d76250bSAvraham Stern 	u8 parent_bssid[ETH_ALEN] __aligned(2);
1956983dafaaSSunil Dutt 	u8 chains;
1957983dafaaSSunil Dutt 	s8 chain_signal[IEEE80211_MAX_CHAINS];
19586e19bc4bSDmitry Shmidt };
19596e19bc4bSDmitry Shmidt 
19606e19bc4bSDmitry Shmidt /**
19612aa4d456SAkira Moroo  * struct cfg80211_bss_ies - BSS entry IE data
19628cef2c9dSJohannes Berg  * @tsf: TSF contained in the frame that carried these IEs
19639caf0364SJohannes Berg  * @rcu_head: internal use, for freeing
19649caf0364SJohannes Berg  * @len: length of the IEs
19650e227084SJohannes Berg  * @from_beacon: these IEs are known to come from a beacon
19669caf0364SJohannes Berg  * @data: IE data
19679caf0364SJohannes Berg  */
19689caf0364SJohannes Berg struct cfg80211_bss_ies {
19698cef2c9dSJohannes Berg 	u64 tsf;
19709caf0364SJohannes Berg 	struct rcu_head rcu_head;
19719caf0364SJohannes Berg 	int len;
19720e227084SJohannes Berg 	bool from_beacon;
19739caf0364SJohannes Berg 	u8 data[];
19749caf0364SJohannes Berg };
19759caf0364SJohannes Berg 
19769caf0364SJohannes Berg /**
19772a519311SJohannes Berg  * struct cfg80211_bss - BSS description
19782a519311SJohannes Berg  *
19792a519311SJohannes Berg  * This structure describes a BSS (which may also be a mesh network)
19802a519311SJohannes Berg  * for use in scan results and similar.
19812a519311SJohannes Berg  *
1982abe37c4bSJohannes Berg  * @channel: channel this BSS is on
1983dcd6eac1SSimon Wunderlich  * @scan_width: width of the control channel
19842a519311SJohannes Berg  * @bssid: BSSID of the BSS
19852a519311SJohannes Berg  * @beacon_interval: the beacon interval as from the frame
19862a519311SJohannes Berg  * @capability: the capability field in host byte order
198783c7aa1aSJohannes Berg  * @ies: the information elements (Note that there is no guarantee that these
198883c7aa1aSJohannes Berg  *	are well-formed!); this is a pointer to either the beacon_ies or
198983c7aa1aSJohannes Berg  *	proberesp_ies depending on whether Probe Response frame has been
199083c7aa1aSJohannes Berg  *	received. It is always non-%NULL.
199134a6eddbSJouni Malinen  * @beacon_ies: the information elements from the last Beacon frame
1992776b3580SJohannes Berg  *	(implementation note: if @hidden_beacon_bss is set this struct doesn't
1993776b3580SJohannes Berg  *	own the beacon_ies, but they're just pointers to the ones from the
1994776b3580SJohannes Berg  *	@hidden_beacon_bss struct)
199534a6eddbSJouni Malinen  * @proberesp_ies: the information elements from the last Probe Response frame
1996776b3580SJohannes Berg  * @hidden_beacon_bss: in case this BSS struct represents a probe response from
1997776b3580SJohannes Berg  *	a BSS that hides the SSID in its beacon, this points to the BSS struct
1998776b3580SJohannes Berg  *	that holds the beacon data. @beacon_ies is still valid, of course, and
1999776b3580SJohannes Berg  *	points to the same data as hidden_beacon_bss->beacon_ies in that case.
200077965c97SJohannes Berg  * @signal: signal strength value (type depends on the wiphy's signal_type)
2001983dafaaSSunil Dutt  * @chains: bitmask for filled values in @chain_signal.
2002983dafaaSSunil Dutt  * @chain_signal: per-chain signal strength of last received BSS in dBm.
20032a519311SJohannes Berg  * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
20042a519311SJohannes Berg  */
20052a519311SJohannes Berg struct cfg80211_bss {
20062a519311SJohannes Berg 	struct ieee80211_channel *channel;
2007dcd6eac1SSimon Wunderlich 	enum nl80211_bss_scan_width scan_width;
20082a519311SJohannes Berg 
20099caf0364SJohannes Berg 	const struct cfg80211_bss_ies __rcu *ies;
20109caf0364SJohannes Berg 	const struct cfg80211_bss_ies __rcu *beacon_ies;
20119caf0364SJohannes Berg 	const struct cfg80211_bss_ies __rcu *proberesp_ies;
20129caf0364SJohannes Berg 
2013776b3580SJohannes Berg 	struct cfg80211_bss *hidden_beacon_bss;
20142a519311SJohannes Berg 
20152a519311SJohannes Berg 	s32 signal;
20162a519311SJohannes Berg 
20179caf0364SJohannes Berg 	u16 beacon_interval;
20189caf0364SJohannes Berg 	u16 capability;
20199caf0364SJohannes Berg 
20209caf0364SJohannes Berg 	u8 bssid[ETH_ALEN];
2021983dafaaSSunil Dutt 	u8 chains;
2022983dafaaSSunil Dutt 	s8 chain_signal[IEEE80211_MAX_CHAINS];
20239caf0364SJohannes Berg 
20241c06ef98SJohannes Berg 	u8 priv[0] __aligned(sizeof(void *));
20252a519311SJohannes Berg };
20262a519311SJohannes Berg 
20272a519311SJohannes Berg /**
2028517357c6SJohannes Berg  * ieee80211_bss_get_ie - find IE with given ID
2029517357c6SJohannes Berg  * @bss: the bss to search
2030517357c6SJohannes Berg  * @ie: the IE ID
20319caf0364SJohannes Berg  *
20329caf0364SJohannes Berg  * Note that the return value is an RCU-protected pointer, so
20339caf0364SJohannes Berg  * rcu_read_lock() must be held when calling this function.
20340ae997dcSYacine Belkadi  * Return: %NULL if not found.
2035517357c6SJohannes Berg  */
2036517357c6SJohannes Berg const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie);
2037517357c6SJohannes Berg 
2038517357c6SJohannes Berg 
2039517357c6SJohannes Berg /**
2040636a5d36SJouni Malinen  * struct cfg80211_auth_request - Authentication request data
2041636a5d36SJouni Malinen  *
2042636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
2043636a5d36SJouni Malinen  * authentication.
2044636a5d36SJouni Malinen  *
2045959867faSJohannes Berg  * @bss: The BSS to authenticate with, the callee must obtain a reference
2046959867faSJohannes Berg  *	to it if it needs to keep it.
2047636a5d36SJouni Malinen  * @auth_type: Authentication type (algorithm)
2048636a5d36SJouni Malinen  * @ie: Extra IEs to add to Authentication frame or %NULL
2049636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
2050fffd0934SJohannes Berg  * @key_len: length of WEP key for shared key authentication
2051fffd0934SJohannes Berg  * @key_idx: index of WEP key for shared key authentication
2052fffd0934SJohannes Berg  * @key: WEP key for shared key authentication
205311b6b5a4SJouni Malinen  * @auth_data: Fields and elements in Authentication frames. This contains
205411b6b5a4SJouni Malinen  *	the authentication frame body (non-IE and IE data), excluding the
205511b6b5a4SJouni Malinen  *	Authentication algorithm number, i.e., starting at the Authentication
205611b6b5a4SJouni Malinen  *	transaction sequence number field.
205711b6b5a4SJouni Malinen  * @auth_data_len: Length of auth_data buffer in octets
2058636a5d36SJouni Malinen  */
2059636a5d36SJouni Malinen struct cfg80211_auth_request {
206019957bb3SJohannes Berg 	struct cfg80211_bss *bss;
2061636a5d36SJouni Malinen 	const u8 *ie;
2062636a5d36SJouni Malinen 	size_t ie_len;
206319957bb3SJohannes Berg 	enum nl80211_auth_type auth_type;
2064fffd0934SJohannes Berg 	const u8 *key;
2065fffd0934SJohannes Berg 	u8 key_len, key_idx;
206611b6b5a4SJouni Malinen 	const u8 *auth_data;
206711b6b5a4SJouni Malinen 	size_t auth_data_len;
2068636a5d36SJouni Malinen };
2069636a5d36SJouni Malinen 
2070636a5d36SJouni Malinen /**
20717e7c8926SBen Greear  * enum cfg80211_assoc_req_flags - Over-ride default behaviour in association.
20727e7c8926SBen Greear  *
20737e7c8926SBen Greear  * @ASSOC_REQ_DISABLE_HT:  Disable HT (802.11n)
2074ee2aca34SJohannes Berg  * @ASSOC_REQ_DISABLE_VHT:  Disable VHT
2075bab5ab7dSAssaf Krauss  * @ASSOC_REQ_USE_RRM: Declare RRM capability in this association
207640cbfa90SSrinivas Dasari  * @CONNECT_REQ_EXTERNAL_AUTH_SUPPORT: User space indicates external
207740cbfa90SSrinivas Dasari  *	authentication capability. Drivers can offload authentication to
207840cbfa90SSrinivas Dasari  *	userspace if this flag is set. Only applicable for cfg80211_connect()
207940cbfa90SSrinivas Dasari  *	request (connect callback).
20807e7c8926SBen Greear  */
20817e7c8926SBen Greear enum cfg80211_assoc_req_flags {
20827e7c8926SBen Greear 	ASSOC_REQ_DISABLE_HT			= BIT(0),
2083ee2aca34SJohannes Berg 	ASSOC_REQ_DISABLE_VHT			= BIT(1),
2084bab5ab7dSAssaf Krauss 	ASSOC_REQ_USE_RRM			= BIT(2),
208540cbfa90SSrinivas Dasari 	CONNECT_REQ_EXTERNAL_AUTH_SUPPORT	= BIT(3),
20867e7c8926SBen Greear };
20877e7c8926SBen Greear 
20887e7c8926SBen Greear /**
2089636a5d36SJouni Malinen  * struct cfg80211_assoc_request - (Re)Association request data
2090636a5d36SJouni Malinen  *
2091636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
2092636a5d36SJouni Malinen  * (re)association.
2093959867faSJohannes Berg  * @bss: The BSS to associate with. If the call is successful the driver is
2094959867faSJohannes Berg  *	given a reference that it must give back to cfg80211_send_rx_assoc()
2095959867faSJohannes Berg  *	or to cfg80211_assoc_timeout(). To ensure proper refcounting, new
2096959867faSJohannes Berg  *	association requests while already associating must be rejected.
2097636a5d36SJouni Malinen  * @ie: Extra IEs to add to (Re)Association Request frame or %NULL
2098636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
2099dc6382ceSJouni Malinen  * @use_mfp: Use management frame protection (IEEE 802.11w) in this association
2100b23aa676SSamuel Ortiz  * @crypto: crypto settings
210135eb8f7bSJouni Malinen  * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used
210235eb8f7bSJouni Malinen  *	to indicate a request to reassociate within the ESS instead of a request
210335eb8f7bSJouni Malinen  *	do the initial association with the ESS. When included, this is set to
210435eb8f7bSJouni Malinen  *	the BSSID of the current association, i.e., to the value that is
210535eb8f7bSJouni Malinen  *	included in the Current AP address field of the Reassociation Request
210635eb8f7bSJouni Malinen  *	frame.
21077e7c8926SBen Greear  * @flags:  See &enum cfg80211_assoc_req_flags
21087e7c8926SBen Greear  * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask
21097e7c8926SBen Greear  *	will be used in ht_capa.  Un-supported values will be ignored.
21107e7c8926SBen Greear  * @ht_capa_mask:  The bits of ht_capa which are to be used.
2111ee2aca34SJohannes Berg  * @vht_capa: VHT capability override
2112ee2aca34SJohannes Berg  * @vht_capa_mask: VHT capability mask indicating which fields to use
2113348bd456SJouni Malinen  * @fils_kek: FILS KEK for protecting (Re)Association Request/Response frame or
2114348bd456SJouni Malinen  *	%NULL if FILS is not used.
2115348bd456SJouni Malinen  * @fils_kek_len: Length of fils_kek in octets
2116348bd456SJouni Malinen  * @fils_nonces: FILS nonces (part of AAD) for protecting (Re)Association
2117348bd456SJouni Malinen  *	Request/Response frame or %NULL if FILS is not used. This field starts
2118348bd456SJouni Malinen  *	with 16 octets of STA Nonce followed by 16 octets of AP Nonce.
2119636a5d36SJouni Malinen  */
2120636a5d36SJouni Malinen struct cfg80211_assoc_request {
212119957bb3SJohannes Berg 	struct cfg80211_bss *bss;
21223e5d7649SJohannes Berg 	const u8 *ie, *prev_bssid;
2123636a5d36SJouni Malinen 	size_t ie_len;
2124b23aa676SSamuel Ortiz 	struct cfg80211_crypto_settings crypto;
212519957bb3SJohannes Berg 	bool use_mfp;
21267e7c8926SBen Greear 	u32 flags;
21277e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa;
21287e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa_mask;
2129ee2aca34SJohannes Berg 	struct ieee80211_vht_cap vht_capa, vht_capa_mask;
2130348bd456SJouni Malinen 	const u8 *fils_kek;
2131348bd456SJouni Malinen 	size_t fils_kek_len;
2132348bd456SJouni Malinen 	const u8 *fils_nonces;
2133636a5d36SJouni Malinen };
2134636a5d36SJouni Malinen 
2135636a5d36SJouni Malinen /**
2136636a5d36SJouni Malinen  * struct cfg80211_deauth_request - Deauthentication request data
2137636a5d36SJouni Malinen  *
2138636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
2139636a5d36SJouni Malinen  * deauthentication.
2140636a5d36SJouni Malinen  *
214195de817bSJohannes Berg  * @bssid: the BSSID of the BSS to deauthenticate from
2142636a5d36SJouni Malinen  * @ie: Extra IEs to add to Deauthentication frame or %NULL
2143636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
214419957bb3SJohannes Berg  * @reason_code: The reason code for the deauthentication
2145077f897aSJohannes Berg  * @local_state_change: if set, change local state only and
2146077f897aSJohannes Berg  *	do not set a deauth frame
2147636a5d36SJouni Malinen  */
2148636a5d36SJouni Malinen struct cfg80211_deauth_request {
214995de817bSJohannes Berg 	const u8 *bssid;
2150636a5d36SJouni Malinen 	const u8 *ie;
2151636a5d36SJouni Malinen 	size_t ie_len;
215219957bb3SJohannes Berg 	u16 reason_code;
21536863255bSStanislaw Gruszka 	bool local_state_change;
2154636a5d36SJouni Malinen };
2155636a5d36SJouni Malinen 
2156636a5d36SJouni Malinen /**
2157636a5d36SJouni Malinen  * struct cfg80211_disassoc_request - Disassociation request data
2158636a5d36SJouni Malinen  *
2159636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
216066f00449SMasahiro Yamada  * disassociation.
2161636a5d36SJouni Malinen  *
216219957bb3SJohannes Berg  * @bss: the BSS to disassociate from
2163636a5d36SJouni Malinen  * @ie: Extra IEs to add to Disassociation frame or %NULL
2164636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
216519957bb3SJohannes Berg  * @reason_code: The reason code for the disassociation
2166d5cdfacbSJouni Malinen  * @local_state_change: This is a request for a local state only, i.e., no
2167d5cdfacbSJouni Malinen  *	Disassociation frame is to be transmitted.
2168636a5d36SJouni Malinen  */
2169636a5d36SJouni Malinen struct cfg80211_disassoc_request {
217019957bb3SJohannes Berg 	struct cfg80211_bss *bss;
2171636a5d36SJouni Malinen 	const u8 *ie;
2172636a5d36SJouni Malinen 	size_t ie_len;
217319957bb3SJohannes Berg 	u16 reason_code;
2174d5cdfacbSJouni Malinen 	bool local_state_change;
2175636a5d36SJouni Malinen };
2176636a5d36SJouni Malinen 
2177636a5d36SJouni Malinen /**
217804a773adSJohannes Berg  * struct cfg80211_ibss_params - IBSS parameters
217904a773adSJohannes Berg  *
218004a773adSJohannes Berg  * This structure defines the IBSS parameters for the join_ibss()
218104a773adSJohannes Berg  * method.
218204a773adSJohannes Berg  *
218304a773adSJohannes Berg  * @ssid: The SSID, will always be non-null.
218404a773adSJohannes Berg  * @ssid_len: The length of the SSID, will always be non-zero.
218504a773adSJohannes Berg  * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not
218604a773adSJohannes Berg  *	search for IBSSs with a different BSSID.
2187683b6d3bSJohannes Berg  * @chandef: defines the channel to use if no other IBSS to join can be found
218804a773adSJohannes Berg  * @channel_fixed: The channel should be fixed -- do not search for
218904a773adSJohannes Berg  *	IBSSs to join on other channels.
219004a773adSJohannes Berg  * @ie: information element(s) to include in the beacon
219104a773adSJohannes Berg  * @ie_len: length of that
21928e30bc55SJohannes Berg  * @beacon_interval: beacon interval to use
2193fffd0934SJohannes Berg  * @privacy: this is a protected network, keys will be configured
2194fffd0934SJohannes Berg  *	after joining
2195267335d6SAntonio Quartulli  * @control_port: whether user space controls IEEE 802.1X port, i.e.,
2196267335d6SAntonio Quartulli  *	sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
2197267335d6SAntonio Quartulli  *	required to assume that the port is unauthorized until authorized by
2198267335d6SAntonio Quartulli  *	user space. Otherwise, port is marked authorized by default.
2199c3bfe1f6SDenis Kenzior  * @control_port_over_nl80211: TRUE if userspace expects to exchange control
2200c3bfe1f6SDenis Kenzior  *	port frames over NL80211 instead of the network interface.
22015336fa88SSimon Wunderlich  * @userspace_handles_dfs: whether user space controls DFS operation, i.e.
22025336fa88SSimon Wunderlich  *	changes the channel when a radar is detected. This is required
22035336fa88SSimon Wunderlich  *	to operate on DFS channels.
2204fbd2c8dcSTeemu Paasikivi  * @basic_rates: bitmap of basic rates to use when creating the IBSS
2205dd5b4cc7SFelix Fietkau  * @mcast_rate: per-band multicast rate index + 1 (0: disabled)
2206803768f5SSimon Wunderlich  * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask
2207803768f5SSimon Wunderlich  *	will be used in ht_capa.  Un-supported values will be ignored.
2208803768f5SSimon Wunderlich  * @ht_capa_mask:  The bits of ht_capa which are to be used.
22099ae3b172STova Mussai  * @wep_keys: static WEP keys, if not NULL points to an array of
22109ae3b172STova Mussai  * 	CFG80211_MAX_WEP_KEYS WEP keys
22119ae3b172STova Mussai  * @wep_tx_key: key index (0..3) of the default TX static WEP key
221204a773adSJohannes Berg  */
221304a773adSJohannes Berg struct cfg80211_ibss_params {
2214c1e5f471SJohannes Berg 	const u8 *ssid;
2215c1e5f471SJohannes Berg 	const u8 *bssid;
2216683b6d3bSJohannes Berg 	struct cfg80211_chan_def chandef;
2217c1e5f471SJohannes Berg 	const u8 *ie;
221804a773adSJohannes Berg 	u8 ssid_len, ie_len;
22198e30bc55SJohannes Berg 	u16 beacon_interval;
2220fbd2c8dcSTeemu Paasikivi 	u32 basic_rates;
222104a773adSJohannes Berg 	bool channel_fixed;
2222fffd0934SJohannes Berg 	bool privacy;
2223267335d6SAntonio Quartulli 	bool control_port;
2224c3bfe1f6SDenis Kenzior 	bool control_port_over_nl80211;
22255336fa88SSimon Wunderlich 	bool userspace_handles_dfs;
222657fbcce3SJohannes Berg 	int mcast_rate[NUM_NL80211_BANDS];
2227803768f5SSimon Wunderlich 	struct ieee80211_ht_cap ht_capa;
2228803768f5SSimon Wunderlich 	struct ieee80211_ht_cap ht_capa_mask;
22299ae3b172STova Mussai 	struct key_params *wep_keys;
22309ae3b172STova Mussai 	int wep_tx_key;
223104a773adSJohannes Berg };
223204a773adSJohannes Berg 
223304a773adSJohannes Berg /**
223438de03d2SArend van Spriel  * struct cfg80211_bss_selection - connection parameters for BSS selection.
223538de03d2SArend van Spriel  *
223638de03d2SArend van Spriel  * @behaviour: requested BSS selection behaviour.
223738de03d2SArend van Spriel  * @param: parameters for requestion behaviour.
223838de03d2SArend van Spriel  * @band_pref: preferred band for %NL80211_BSS_SELECT_ATTR_BAND_PREF.
223938de03d2SArend van Spriel  * @adjust: parameters for %NL80211_BSS_SELECT_ATTR_RSSI_ADJUST.
224038de03d2SArend van Spriel  */
224138de03d2SArend van Spriel struct cfg80211_bss_selection {
224238de03d2SArend van Spriel 	enum nl80211_bss_select_attr behaviour;
224338de03d2SArend van Spriel 	union {
224457fbcce3SJohannes Berg 		enum nl80211_band band_pref;
224538de03d2SArend van Spriel 		struct cfg80211_bss_select_adjust adjust;
224638de03d2SArend van Spriel 	} param;
224738de03d2SArend van Spriel };
224838de03d2SArend van Spriel 
224938de03d2SArend van Spriel /**
2250b23aa676SSamuel Ortiz  * struct cfg80211_connect_params - Connection parameters
2251b23aa676SSamuel Ortiz  *
2252b23aa676SSamuel Ortiz  * This structure provides information needed to complete IEEE 802.11
2253b23aa676SSamuel Ortiz  * authentication and association.
2254b23aa676SSamuel Ortiz  *
2255b23aa676SSamuel Ortiz  * @channel: The channel to use or %NULL if not specified (auto-select based
2256b23aa676SSamuel Ortiz  *	on scan results)
22571df4a510SJouni Malinen  * @channel_hint: The channel of the recommended BSS for initial connection or
22581df4a510SJouni Malinen  *	%NULL if not specified
2259b23aa676SSamuel Ortiz  * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan
2260b23aa676SSamuel Ortiz  *	results)
22611df4a510SJouni Malinen  * @bssid_hint: The recommended AP BSSID for initial connection to the BSS or
22621df4a510SJouni Malinen  *	%NULL if not specified. Unlike the @bssid parameter, the driver is
22631df4a510SJouni Malinen  *	allowed to ignore this @bssid_hint if it has knowledge of a better BSS
22641df4a510SJouni Malinen  *	to use.
2265b23aa676SSamuel Ortiz  * @ssid: SSID
2266b23aa676SSamuel Ortiz  * @ssid_len: Length of ssid in octets
2267b23aa676SSamuel Ortiz  * @auth_type: Authentication type (algorithm)
2268abe37c4bSJohannes Berg  * @ie: IEs for association request
2269abe37c4bSJohannes Berg  * @ie_len: Length of assoc_ie in octets
2270b23aa676SSamuel Ortiz  * @privacy: indicates whether privacy-enabled APs should be used
2271cee00a95SJouni Malinen  * @mfp: indicate whether management frame protection is used
2272b23aa676SSamuel Ortiz  * @crypto: crypto settings
2273fffd0934SJohannes Berg  * @key_len: length of WEP key for shared key authentication
2274fffd0934SJohannes Berg  * @key_idx: index of WEP key for shared key authentication
2275fffd0934SJohannes Berg  * @key: WEP key for shared key authentication
22767e7c8926SBen Greear  * @flags:  See &enum cfg80211_assoc_req_flags
22774486ea98SBala Shanmugam  * @bg_scan_period:  Background scan period in seconds
22784486ea98SBala Shanmugam  *	or -1 to indicate that default value is to be used.
22797e7c8926SBen Greear  * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask
22807e7c8926SBen Greear  *	will be used in ht_capa.  Un-supported values will be ignored.
22817e7c8926SBen Greear  * @ht_capa_mask:  The bits of ht_capa which are to be used.
2282ee2aca34SJohannes Berg  * @vht_capa:  VHT Capability overrides
2283ee2aca34SJohannes Berg  * @vht_capa_mask: The bits of vht_capa which are to be used.
228434d50519SLior David  * @pbss: if set, connect to a PCP instead of AP. Valid for DMG
228534d50519SLior David  *	networks.
228638de03d2SArend van Spriel  * @bss_select: criteria to be used for BSS selection.
228735eb8f7bSJouni Malinen  * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used
228835eb8f7bSJouni Malinen  *	to indicate a request to reassociate within the ESS instead of a request
228935eb8f7bSJouni Malinen  *	do the initial association with the ESS. When included, this is set to
229035eb8f7bSJouni Malinen  *	the BSSID of the current association, i.e., to the value that is
229135eb8f7bSJouni Malinen  *	included in the Current AP address field of the Reassociation Request
229235eb8f7bSJouni Malinen  *	frame.
2293a3caf744SVidyullatha Kanchanapally  * @fils_erp_username: EAP re-authentication protocol (ERP) username part of the
2294a3caf744SVidyullatha Kanchanapally  *	NAI or %NULL if not specified. This is used to construct FILS wrapped
2295a3caf744SVidyullatha Kanchanapally  *	data IE.
2296a3caf744SVidyullatha Kanchanapally  * @fils_erp_username_len: Length of @fils_erp_username in octets.
2297a3caf744SVidyullatha Kanchanapally  * @fils_erp_realm: EAP re-authentication protocol (ERP) realm part of NAI or
2298a3caf744SVidyullatha Kanchanapally  *	%NULL if not specified. This specifies the domain name of ER server and
2299a3caf744SVidyullatha Kanchanapally  *	is used to construct FILS wrapped data IE.
2300a3caf744SVidyullatha Kanchanapally  * @fils_erp_realm_len: Length of @fils_erp_realm in octets.
2301a3caf744SVidyullatha Kanchanapally  * @fils_erp_next_seq_num: The next sequence number to use in the FILS ERP
2302a3caf744SVidyullatha Kanchanapally  *	messages. This is also used to construct FILS wrapped data IE.
2303a3caf744SVidyullatha Kanchanapally  * @fils_erp_rrk: ERP re-authentication Root Key (rRK) used to derive additional
2304a3caf744SVidyullatha Kanchanapally  *	keys in FILS or %NULL if not specified.
2305a3caf744SVidyullatha Kanchanapally  * @fils_erp_rrk_len: Length of @fils_erp_rrk in octets.
23063a00df57SAvraham Stern  * @want_1x: indicates user-space supports and wants to use 802.1X driver
23073a00df57SAvraham Stern  *	offload of 4-way handshake.
2308b23aa676SSamuel Ortiz  */
2309b23aa676SSamuel Ortiz struct cfg80211_connect_params {
2310b23aa676SSamuel Ortiz 	struct ieee80211_channel *channel;
23111df4a510SJouni Malinen 	struct ieee80211_channel *channel_hint;
2312664834deSJouni Malinen 	const u8 *bssid;
23131df4a510SJouni Malinen 	const u8 *bssid_hint;
2314664834deSJouni Malinen 	const u8 *ssid;
2315b23aa676SSamuel Ortiz 	size_t ssid_len;
2316b23aa676SSamuel Ortiz 	enum nl80211_auth_type auth_type;
23174b5800feSJohannes Berg 	const u8 *ie;
2318b23aa676SSamuel Ortiz 	size_t ie_len;
2319b23aa676SSamuel Ortiz 	bool privacy;
2320cee00a95SJouni Malinen 	enum nl80211_mfp mfp;
2321b23aa676SSamuel Ortiz 	struct cfg80211_crypto_settings crypto;
2322fffd0934SJohannes Berg 	const u8 *key;
2323fffd0934SJohannes Berg 	u8 key_len, key_idx;
23247e7c8926SBen Greear 	u32 flags;
23254486ea98SBala Shanmugam 	int bg_scan_period;
23267e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa;
23277e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa_mask;
2328ee2aca34SJohannes Berg 	struct ieee80211_vht_cap vht_capa;
2329ee2aca34SJohannes Berg 	struct ieee80211_vht_cap vht_capa_mask;
233034d50519SLior David 	bool pbss;
233138de03d2SArend van Spriel 	struct cfg80211_bss_selection bss_select;
2332ba6fbacfSJouni Malinen 	const u8 *prev_bssid;
2333a3caf744SVidyullatha Kanchanapally 	const u8 *fils_erp_username;
2334a3caf744SVidyullatha Kanchanapally 	size_t fils_erp_username_len;
2335a3caf744SVidyullatha Kanchanapally 	const u8 *fils_erp_realm;
2336a3caf744SVidyullatha Kanchanapally 	size_t fils_erp_realm_len;
2337a3caf744SVidyullatha Kanchanapally 	u16 fils_erp_next_seq_num;
2338a3caf744SVidyullatha Kanchanapally 	const u8 *fils_erp_rrk;
2339a3caf744SVidyullatha Kanchanapally 	size_t fils_erp_rrk_len;
23403a00df57SAvraham Stern 	bool want_1x;
2341b23aa676SSamuel Ortiz };
2342b23aa676SSamuel Ortiz 
2343b23aa676SSamuel Ortiz /**
2344088e8df8Svamsi krishna  * enum cfg80211_connect_params_changed - Connection parameters being updated
2345088e8df8Svamsi krishna  *
2346088e8df8Svamsi krishna  * This enum provides information of all connect parameters that
2347088e8df8Svamsi krishna  * have to be updated as part of update_connect_params() call.
2348088e8df8Svamsi krishna  *
2349088e8df8Svamsi krishna  * @UPDATE_ASSOC_IES: Indicates whether association request IEs are updated
23507f9a3e15SVidyullatha Kanchanapally  * @UPDATE_FILS_ERP_INFO: Indicates that FILS connection parameters (realm,
23517f9a3e15SVidyullatha Kanchanapally  *	username, erp sequence number and rrk) are updated
23527f9a3e15SVidyullatha Kanchanapally  * @UPDATE_AUTH_TYPE: Indicates that authentication type is updated
2353088e8df8Svamsi krishna  */
2354088e8df8Svamsi krishna enum cfg80211_connect_params_changed {
2355088e8df8Svamsi krishna 	UPDATE_ASSOC_IES		= BIT(0),
23567f9a3e15SVidyullatha Kanchanapally 	UPDATE_FILS_ERP_INFO		= BIT(1),
23577f9a3e15SVidyullatha Kanchanapally 	UPDATE_AUTH_TYPE		= BIT(2),
2358088e8df8Svamsi krishna };
2359088e8df8Svamsi krishna 
2360088e8df8Svamsi krishna /**
2361b9a5f8caSJouni Malinen  * enum wiphy_params_flags - set_wiphy_params bitfield values
2362abe37c4bSJohannes Berg  * @WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed
2363abe37c4bSJohannes Berg  * @WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed
2364abe37c4bSJohannes Berg  * @WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed
2365abe37c4bSJohannes Berg  * @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed
2366abe37c4bSJohannes Berg  * @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed
23673057dbfdSLorenzo Bianconi  * @WIPHY_PARAM_DYN_ACK: dynack has been enabled
236852539ca8SToke Høiland-Jørgensen  * @WIPHY_PARAM_TXQ_LIMIT: TXQ packet limit has been changed
236952539ca8SToke Høiland-Jørgensen  * @WIPHY_PARAM_TXQ_MEMORY_LIMIT: TXQ memory limit has been changed
237052539ca8SToke Høiland-Jørgensen  * @WIPHY_PARAM_TXQ_QUANTUM: TXQ scheduler quantum
2371b9a5f8caSJouni Malinen  */
2372b9a5f8caSJouni Malinen enum wiphy_params_flags {
2373b9a5f8caSJouni Malinen 	WIPHY_PARAM_RETRY_SHORT		= 1 << 0,
2374b9a5f8caSJouni Malinen 	WIPHY_PARAM_RETRY_LONG		= 1 << 1,
2375b9a5f8caSJouni Malinen 	WIPHY_PARAM_FRAG_THRESHOLD	= 1 << 2,
2376b9a5f8caSJouni Malinen 	WIPHY_PARAM_RTS_THRESHOLD	= 1 << 3,
237781077e82SLukáš Turek 	WIPHY_PARAM_COVERAGE_CLASS	= 1 << 4,
23783057dbfdSLorenzo Bianconi 	WIPHY_PARAM_DYN_ACK		= 1 << 5,
237952539ca8SToke Høiland-Jørgensen 	WIPHY_PARAM_TXQ_LIMIT		= 1 << 6,
238052539ca8SToke Høiland-Jørgensen 	WIPHY_PARAM_TXQ_MEMORY_LIMIT	= 1 << 7,
238152539ca8SToke Høiland-Jørgensen 	WIPHY_PARAM_TXQ_QUANTUM		= 1 << 8,
2382b9a5f8caSJouni Malinen };
2383b9a5f8caSJouni Malinen 
238467fbb16bSSamuel Ortiz /**
238567fbb16bSSamuel Ortiz  * struct cfg80211_pmksa - PMK Security Association
238667fbb16bSSamuel Ortiz  *
238767fbb16bSSamuel Ortiz  * This structure is passed to the set/del_pmksa() method for PMKSA
238867fbb16bSSamuel Ortiz  * caching.
238967fbb16bSSamuel Ortiz  *
2390a3caf744SVidyullatha Kanchanapally  * @bssid: The AP's BSSID (may be %NULL).
2391a3caf744SVidyullatha Kanchanapally  * @pmkid: The identifier to refer a PMKSA.
2392a3caf744SVidyullatha Kanchanapally  * @pmk: The PMK for the PMKSA identified by @pmkid. This is used for key
2393a3caf744SVidyullatha Kanchanapally  *	derivation by a FILS STA. Otherwise, %NULL.
2394a3caf744SVidyullatha Kanchanapally  * @pmk_len: Length of the @pmk. The length of @pmk can differ depending on
2395a3caf744SVidyullatha Kanchanapally  *	the hash algorithm used to generate this.
2396a3caf744SVidyullatha Kanchanapally  * @ssid: SSID to specify the ESS within which a PMKSA is valid when using FILS
2397a3caf744SVidyullatha Kanchanapally  *	cache identifier (may be %NULL).
2398a3caf744SVidyullatha Kanchanapally  * @ssid_len: Length of the @ssid in octets.
2399a3caf744SVidyullatha Kanchanapally  * @cache_id: 2-octet cache identifier advertized by a FILS AP identifying the
2400a3caf744SVidyullatha Kanchanapally  *	scope of PMKSA. This is valid only if @ssid_len is non-zero (may be
2401a3caf744SVidyullatha Kanchanapally  *	%NULL).
240267fbb16bSSamuel Ortiz  */
240367fbb16bSSamuel Ortiz struct cfg80211_pmksa {
2404c1e5f471SJohannes Berg 	const u8 *bssid;
2405c1e5f471SJohannes Berg 	const u8 *pmkid;
2406a3caf744SVidyullatha Kanchanapally 	const u8 *pmk;
2407a3caf744SVidyullatha Kanchanapally 	size_t pmk_len;
2408a3caf744SVidyullatha Kanchanapally 	const u8 *ssid;
2409a3caf744SVidyullatha Kanchanapally 	size_t ssid_len;
2410a3caf744SVidyullatha Kanchanapally 	const u8 *cache_id;
241167fbb16bSSamuel Ortiz };
24129930380fSJohannes Berg 
24137643a2c3SJohannes Berg /**
241450ac6607SAmitkumar Karwar  * struct cfg80211_pkt_pattern - packet pattern
2415ff1b6e69SJohannes Berg  * @mask: bitmask where to match pattern and where to ignore bytes,
2416ff1b6e69SJohannes Berg  *	one bit per byte, in same format as nl80211
2417ff1b6e69SJohannes Berg  * @pattern: bytes to match where bitmask is 1
2418ff1b6e69SJohannes Berg  * @pattern_len: length of pattern (in bytes)
2419bb92d199SAmitkumar Karwar  * @pkt_offset: packet offset (in bytes)
2420ff1b6e69SJohannes Berg  *
2421ff1b6e69SJohannes Berg  * Internal note: @mask and @pattern are allocated in one chunk of
2422ff1b6e69SJohannes Berg  * memory, free @mask only!
2423ff1b6e69SJohannes Berg  */
242450ac6607SAmitkumar Karwar struct cfg80211_pkt_pattern {
2425922bd80fSJohannes Berg 	const u8 *mask, *pattern;
2426ff1b6e69SJohannes Berg 	int pattern_len;
2427bb92d199SAmitkumar Karwar 	int pkt_offset;
2428ff1b6e69SJohannes Berg };
2429ff1b6e69SJohannes Berg 
2430ff1b6e69SJohannes Berg /**
24312a0e047eSJohannes Berg  * struct cfg80211_wowlan_tcp - TCP connection parameters
24322a0e047eSJohannes Berg  *
24332a0e047eSJohannes Berg  * @sock: (internal) socket for source port allocation
24342a0e047eSJohannes Berg  * @src: source IP address
24352a0e047eSJohannes Berg  * @dst: destination IP address
24362a0e047eSJohannes Berg  * @dst_mac: destination MAC address
24372a0e047eSJohannes Berg  * @src_port: source port
24382a0e047eSJohannes Berg  * @dst_port: destination port
24392a0e047eSJohannes Berg  * @payload_len: data payload length
24402a0e047eSJohannes Berg  * @payload: data payload buffer
24412a0e047eSJohannes Berg  * @payload_seq: payload sequence stamping configuration
24422a0e047eSJohannes Berg  * @data_interval: interval at which to send data packets
24432a0e047eSJohannes Berg  * @wake_len: wakeup payload match length
24442a0e047eSJohannes Berg  * @wake_data: wakeup payload match data
24452a0e047eSJohannes Berg  * @wake_mask: wakeup payload match mask
24462a0e047eSJohannes Berg  * @tokens_size: length of the tokens buffer
24472a0e047eSJohannes Berg  * @payload_tok: payload token usage configuration
24482a0e047eSJohannes Berg  */
24492a0e047eSJohannes Berg struct cfg80211_wowlan_tcp {
24502a0e047eSJohannes Berg 	struct socket *sock;
24512a0e047eSJohannes Berg 	__be32 src, dst;
24522a0e047eSJohannes Berg 	u16 src_port, dst_port;
24532a0e047eSJohannes Berg 	u8 dst_mac[ETH_ALEN];
24542a0e047eSJohannes Berg 	int payload_len;
24552a0e047eSJohannes Berg 	const u8 *payload;
24562a0e047eSJohannes Berg 	struct nl80211_wowlan_tcp_data_seq payload_seq;
24572a0e047eSJohannes Berg 	u32 data_interval;
24582a0e047eSJohannes Berg 	u32 wake_len;
24592a0e047eSJohannes Berg 	const u8 *wake_data, *wake_mask;
24602a0e047eSJohannes Berg 	u32 tokens_size;
24612a0e047eSJohannes Berg 	/* must be last, variable member */
24622a0e047eSJohannes Berg 	struct nl80211_wowlan_tcp_data_token payload_tok;
2463ff1b6e69SJohannes Berg };
2464ff1b6e69SJohannes Berg 
2465ff1b6e69SJohannes Berg /**
2466ff1b6e69SJohannes Berg  * struct cfg80211_wowlan - Wake on Wireless-LAN support info
2467ff1b6e69SJohannes Berg  *
2468ff1b6e69SJohannes Berg  * This structure defines the enabled WoWLAN triggers for the device.
2469ff1b6e69SJohannes Berg  * @any: wake up on any activity -- special trigger if device continues
2470ff1b6e69SJohannes Berg  *	operating as normal during suspend
2471ff1b6e69SJohannes Berg  * @disconnect: wake up if getting disconnected
2472ff1b6e69SJohannes Berg  * @magic_pkt: wake up on receiving magic packet
2473ff1b6e69SJohannes Berg  * @patterns: wake up on receiving packet matching a pattern
2474ff1b6e69SJohannes Berg  * @n_patterns: number of patterns
247577dbbb13SJohannes Berg  * @gtk_rekey_failure: wake up on GTK rekey failure
247677dbbb13SJohannes Berg  * @eap_identity_req: wake up on EAP identity request packet
247777dbbb13SJohannes Berg  * @four_way_handshake: wake up on 4-way handshake
247877dbbb13SJohannes Berg  * @rfkill_release: wake up when rfkill is released
24792a0e047eSJohannes Berg  * @tcp: TCP connection establishment/wakeup parameters, see nl80211.h.
24802a0e047eSJohannes Berg  *	NULL if not configured.
24818cd4d456SLuciano Coelho  * @nd_config: configuration for the scan to be used for net detect wake.
2482ff1b6e69SJohannes Berg  */
2483ff1b6e69SJohannes Berg struct cfg80211_wowlan {
248477dbbb13SJohannes Berg 	bool any, disconnect, magic_pkt, gtk_rekey_failure,
248577dbbb13SJohannes Berg 	     eap_identity_req, four_way_handshake,
248677dbbb13SJohannes Berg 	     rfkill_release;
248750ac6607SAmitkumar Karwar 	struct cfg80211_pkt_pattern *patterns;
24882a0e047eSJohannes Berg 	struct cfg80211_wowlan_tcp *tcp;
2489ff1b6e69SJohannes Berg 	int n_patterns;
24908cd4d456SLuciano Coelho 	struct cfg80211_sched_scan_request *nd_config;
2491ff1b6e69SJohannes Berg };
2492ff1b6e69SJohannes Berg 
2493ff1b6e69SJohannes Berg /**
2494be29b99aSAmitkumar Karwar  * struct cfg80211_coalesce_rules - Coalesce rule parameters
2495be29b99aSAmitkumar Karwar  *
2496be29b99aSAmitkumar Karwar  * This structure defines coalesce rule for the device.
2497be29b99aSAmitkumar Karwar  * @delay: maximum coalescing delay in msecs.
2498be29b99aSAmitkumar Karwar  * @condition: condition for packet coalescence.
2499be29b99aSAmitkumar Karwar  *	see &enum nl80211_coalesce_condition.
2500be29b99aSAmitkumar Karwar  * @patterns: array of packet patterns
2501be29b99aSAmitkumar Karwar  * @n_patterns: number of patterns
2502be29b99aSAmitkumar Karwar  */
2503be29b99aSAmitkumar Karwar struct cfg80211_coalesce_rules {
2504be29b99aSAmitkumar Karwar 	int delay;
2505be29b99aSAmitkumar Karwar 	enum nl80211_coalesce_condition condition;
2506be29b99aSAmitkumar Karwar 	struct cfg80211_pkt_pattern *patterns;
2507be29b99aSAmitkumar Karwar 	int n_patterns;
2508be29b99aSAmitkumar Karwar };
2509be29b99aSAmitkumar Karwar 
2510be29b99aSAmitkumar Karwar /**
2511be29b99aSAmitkumar Karwar  * struct cfg80211_coalesce - Packet coalescing settings
2512be29b99aSAmitkumar Karwar  *
2513be29b99aSAmitkumar Karwar  * This structure defines coalescing settings.
2514be29b99aSAmitkumar Karwar  * @rules: array of coalesce rules
2515be29b99aSAmitkumar Karwar  * @n_rules: number of rules
2516be29b99aSAmitkumar Karwar  */
2517be29b99aSAmitkumar Karwar struct cfg80211_coalesce {
2518be29b99aSAmitkumar Karwar 	struct cfg80211_coalesce_rules *rules;
2519be29b99aSAmitkumar Karwar 	int n_rules;
2520be29b99aSAmitkumar Karwar };
2521be29b99aSAmitkumar Karwar 
2522be29b99aSAmitkumar Karwar /**
25238cd4d456SLuciano Coelho  * struct cfg80211_wowlan_nd_match - information about the match
25248cd4d456SLuciano Coelho  *
25258cd4d456SLuciano Coelho  * @ssid: SSID of the match that triggered the wake up
25268cd4d456SLuciano Coelho  * @n_channels: Number of channels where the match occurred.  This
25278cd4d456SLuciano Coelho  *	value may be zero if the driver can't report the channels.
25288cd4d456SLuciano Coelho  * @channels: center frequencies of the channels where a match
25298cd4d456SLuciano Coelho  *	occurred (in MHz)
25308cd4d456SLuciano Coelho  */
25318cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_match {
25328cd4d456SLuciano Coelho 	struct cfg80211_ssid ssid;
25338cd4d456SLuciano Coelho 	int n_channels;
25348cd4d456SLuciano Coelho 	u32 channels[];
25358cd4d456SLuciano Coelho };
25368cd4d456SLuciano Coelho 
25378cd4d456SLuciano Coelho /**
25388cd4d456SLuciano Coelho  * struct cfg80211_wowlan_nd_info - net detect wake up information
25398cd4d456SLuciano Coelho  *
25408cd4d456SLuciano Coelho  * @n_matches: Number of match information instances provided in
25418cd4d456SLuciano Coelho  *	@matches.  This value may be zero if the driver can't provide
25428cd4d456SLuciano Coelho  *	match information.
25438cd4d456SLuciano Coelho  * @matches: Array of pointers to matches containing information about
25448cd4d456SLuciano Coelho  *	the matches that triggered the wake up.
25458cd4d456SLuciano Coelho  */
25468cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_info {
25478cd4d456SLuciano Coelho 	int n_matches;
25488cd4d456SLuciano Coelho 	struct cfg80211_wowlan_nd_match *matches[];
25498cd4d456SLuciano Coelho };
25508cd4d456SLuciano Coelho 
25518cd4d456SLuciano Coelho /**
2552cd8f7cb4SJohannes Berg  * struct cfg80211_wowlan_wakeup - wakeup report
2553cd8f7cb4SJohannes Berg  * @disconnect: woke up by getting disconnected
2554cd8f7cb4SJohannes Berg  * @magic_pkt: woke up by receiving magic packet
2555cd8f7cb4SJohannes Berg  * @gtk_rekey_failure: woke up by GTK rekey failure
2556cd8f7cb4SJohannes Berg  * @eap_identity_req: woke up by EAP identity request packet
2557cd8f7cb4SJohannes Berg  * @four_way_handshake: woke up by 4-way handshake
2558cd8f7cb4SJohannes Berg  * @rfkill_release: woke up by rfkill being released
2559cd8f7cb4SJohannes Berg  * @pattern_idx: pattern that caused wakeup, -1 if not due to pattern
2560cd8f7cb4SJohannes Berg  * @packet_present_len: copied wakeup packet data
2561cd8f7cb4SJohannes Berg  * @packet_len: original wakeup packet length
2562cd8f7cb4SJohannes Berg  * @packet: The packet causing the wakeup, if any.
2563cd8f7cb4SJohannes Berg  * @packet_80211:  For pattern match, magic packet and other data
2564cd8f7cb4SJohannes Berg  *	frame triggers an 802.3 frame should be reported, for
2565cd8f7cb4SJohannes Berg  *	disconnect due to deauth 802.11 frame. This indicates which
2566cd8f7cb4SJohannes Berg  *	it is.
25672a0e047eSJohannes Berg  * @tcp_match: TCP wakeup packet received
25682a0e047eSJohannes Berg  * @tcp_connlost: TCP connection lost or failed to establish
25692a0e047eSJohannes Berg  * @tcp_nomoretokens: TCP data ran out of tokens
25708cd4d456SLuciano Coelho  * @net_detect: if not %NULL, woke up because of net detect
2571cd8f7cb4SJohannes Berg  */
2572cd8f7cb4SJohannes Berg struct cfg80211_wowlan_wakeup {
2573cd8f7cb4SJohannes Berg 	bool disconnect, magic_pkt, gtk_rekey_failure,
2574cd8f7cb4SJohannes Berg 	     eap_identity_req, four_way_handshake,
25752a0e047eSJohannes Berg 	     rfkill_release, packet_80211,
25762a0e047eSJohannes Berg 	     tcp_match, tcp_connlost, tcp_nomoretokens;
2577cd8f7cb4SJohannes Berg 	s32 pattern_idx;
2578cd8f7cb4SJohannes Berg 	u32 packet_present_len, packet_len;
2579cd8f7cb4SJohannes Berg 	const void *packet;
25808cd4d456SLuciano Coelho 	struct cfg80211_wowlan_nd_info *net_detect;
2581cd8f7cb4SJohannes Berg };
2582cd8f7cb4SJohannes Berg 
2583cd8f7cb4SJohannes Berg /**
2584e5497d76SJohannes Berg  * struct cfg80211_gtk_rekey_data - rekey data
258578f686caSJohannes Berg  * @kek: key encryption key (NL80211_KEK_LEN bytes)
258678f686caSJohannes Berg  * @kck: key confirmation key (NL80211_KCK_LEN bytes)
258778f686caSJohannes Berg  * @replay_ctr: replay counter (NL80211_REPLAY_CTR_LEN bytes)
2588e5497d76SJohannes Berg  */
2589e5497d76SJohannes Berg struct cfg80211_gtk_rekey_data {
259078f686caSJohannes Berg 	const u8 *kek, *kck, *replay_ctr;
2591e5497d76SJohannes Berg };
2592e5497d76SJohannes Berg 
2593e5497d76SJohannes Berg /**
2594355199e0SJouni Malinen  * struct cfg80211_update_ft_ies_params - FT IE Information
2595355199e0SJouni Malinen  *
2596355199e0SJouni Malinen  * This structure provides information needed to update the fast transition IE
2597355199e0SJouni Malinen  *
2598355199e0SJouni Malinen  * @md: The Mobility Domain ID, 2 Octet value
2599355199e0SJouni Malinen  * @ie: Fast Transition IEs
2600355199e0SJouni Malinen  * @ie_len: Length of ft_ie in octets
2601355199e0SJouni Malinen  */
2602355199e0SJouni Malinen struct cfg80211_update_ft_ies_params {
2603355199e0SJouni Malinen 	u16 md;
2604355199e0SJouni Malinen 	const u8 *ie;
2605355199e0SJouni Malinen 	size_t ie_len;
2606355199e0SJouni Malinen };
2607355199e0SJouni Malinen 
2608355199e0SJouni Malinen /**
2609b176e629SAndrei Otcheretianski  * struct cfg80211_mgmt_tx_params - mgmt tx parameters
2610b176e629SAndrei Otcheretianski  *
2611b176e629SAndrei Otcheretianski  * This structure provides information needed to transmit a mgmt frame
2612b176e629SAndrei Otcheretianski  *
2613b176e629SAndrei Otcheretianski  * @chan: channel to use
2614b176e629SAndrei Otcheretianski  * @offchan: indicates wether off channel operation is required
2615b176e629SAndrei Otcheretianski  * @wait: duration for ROC
2616b176e629SAndrei Otcheretianski  * @buf: buffer to transmit
2617b176e629SAndrei Otcheretianski  * @len: buffer length
2618b176e629SAndrei Otcheretianski  * @no_cck: don't use cck rates for this frame
2619b176e629SAndrei Otcheretianski  * @dont_wait_for_ack: tells the low level not to wait for an ack
262034d22ce2SAndrei Otcheretianski  * @n_csa_offsets: length of csa_offsets array
262134d22ce2SAndrei Otcheretianski  * @csa_offsets: array of all the csa offsets in the frame
2622b176e629SAndrei Otcheretianski  */
2623b176e629SAndrei Otcheretianski struct cfg80211_mgmt_tx_params {
2624b176e629SAndrei Otcheretianski 	struct ieee80211_channel *chan;
2625b176e629SAndrei Otcheretianski 	bool offchan;
2626b176e629SAndrei Otcheretianski 	unsigned int wait;
2627b176e629SAndrei Otcheretianski 	const u8 *buf;
2628b176e629SAndrei Otcheretianski 	size_t len;
2629b176e629SAndrei Otcheretianski 	bool no_cck;
2630b176e629SAndrei Otcheretianski 	bool dont_wait_for_ack;
263134d22ce2SAndrei Otcheretianski 	int n_csa_offsets;
263234d22ce2SAndrei Otcheretianski 	const u16 *csa_offsets;
2633b176e629SAndrei Otcheretianski };
2634b176e629SAndrei Otcheretianski 
2635b176e629SAndrei Otcheretianski /**
2636fa9ffc74SKyeyoon Park  * struct cfg80211_dscp_exception - DSCP exception
2637fa9ffc74SKyeyoon Park  *
2638fa9ffc74SKyeyoon Park  * @dscp: DSCP value that does not adhere to the user priority range definition
2639fa9ffc74SKyeyoon Park  * @up: user priority value to which the corresponding DSCP value belongs
2640fa9ffc74SKyeyoon Park  */
2641fa9ffc74SKyeyoon Park struct cfg80211_dscp_exception {
2642fa9ffc74SKyeyoon Park 	u8 dscp;
2643fa9ffc74SKyeyoon Park 	u8 up;
2644fa9ffc74SKyeyoon Park };
2645fa9ffc74SKyeyoon Park 
2646fa9ffc74SKyeyoon Park /**
2647fa9ffc74SKyeyoon Park  * struct cfg80211_dscp_range - DSCP range definition for user priority
2648fa9ffc74SKyeyoon Park  *
2649fa9ffc74SKyeyoon Park  * @low: lowest DSCP value of this user priority range, inclusive
2650fa9ffc74SKyeyoon Park  * @high: highest DSCP value of this user priority range, inclusive
2651fa9ffc74SKyeyoon Park  */
2652fa9ffc74SKyeyoon Park struct cfg80211_dscp_range {
2653fa9ffc74SKyeyoon Park 	u8 low;
2654fa9ffc74SKyeyoon Park 	u8 high;
2655fa9ffc74SKyeyoon Park };
2656fa9ffc74SKyeyoon Park 
2657fa9ffc74SKyeyoon Park /* QoS Map Set element length defined in IEEE Std 802.11-2012, 8.4.2.97 */
2658fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_MAX_EX	21
2659fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_LEN_MIN	16
2660fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_LEN_MAX \
2661fa9ffc74SKyeyoon Park 	(IEEE80211_QOS_MAP_LEN_MIN + 2 * IEEE80211_QOS_MAP_MAX_EX)
2662fa9ffc74SKyeyoon Park 
2663fa9ffc74SKyeyoon Park /**
2664fa9ffc74SKyeyoon Park  * struct cfg80211_qos_map - QoS Map Information
2665fa9ffc74SKyeyoon Park  *
2666fa9ffc74SKyeyoon Park  * This struct defines the Interworking QoS map setting for DSCP values
2667fa9ffc74SKyeyoon Park  *
2668fa9ffc74SKyeyoon Park  * @num_des: number of DSCP exceptions (0..21)
2669fa9ffc74SKyeyoon Park  * @dscp_exception: optionally up to maximum of 21 DSCP exceptions from
2670fa9ffc74SKyeyoon Park  *	the user priority DSCP range definition
2671fa9ffc74SKyeyoon Park  * @up: DSCP range definition for a particular user priority
2672fa9ffc74SKyeyoon Park  */
2673fa9ffc74SKyeyoon Park struct cfg80211_qos_map {
2674fa9ffc74SKyeyoon Park 	u8 num_des;
2675fa9ffc74SKyeyoon Park 	struct cfg80211_dscp_exception dscp_exception[IEEE80211_QOS_MAP_MAX_EX];
2676fa9ffc74SKyeyoon Park 	struct cfg80211_dscp_range up[8];
2677fa9ffc74SKyeyoon Park };
2678fa9ffc74SKyeyoon Park 
2679fa9ffc74SKyeyoon Park /**
2680cb3b7d87SAyala Beker  * struct cfg80211_nan_conf - NAN configuration
2681cb3b7d87SAyala Beker  *
2682cb3b7d87SAyala Beker  * This struct defines NAN configuration parameters
2683cb3b7d87SAyala Beker  *
2684cb3b7d87SAyala Beker  * @master_pref: master preference (1 - 255)
26858585989dSLuca Coelho  * @bands: operating bands, a bitmap of &enum nl80211_band values.
26868585989dSLuca Coelho  *	For instance, for NL80211_BAND_2GHZ, bit 0 would be set
26878585989dSLuca Coelho  *	(i.e. BIT(NL80211_BAND_2GHZ)).
2688cb3b7d87SAyala Beker  */
2689cb3b7d87SAyala Beker struct cfg80211_nan_conf {
2690cb3b7d87SAyala Beker 	u8 master_pref;
26918585989dSLuca Coelho 	u8 bands;
2692cb3b7d87SAyala Beker };
2693cb3b7d87SAyala Beker 
2694cb3b7d87SAyala Beker /**
2695a5a9dcf2SAyala Beker  * enum cfg80211_nan_conf_changes - indicates changed fields in NAN
2696a5a9dcf2SAyala Beker  * configuration
2697a5a9dcf2SAyala Beker  *
2698a5a9dcf2SAyala Beker  * @CFG80211_NAN_CONF_CHANGED_PREF: master preference
26998585989dSLuca Coelho  * @CFG80211_NAN_CONF_CHANGED_BANDS: operating bands
2700a5a9dcf2SAyala Beker  */
2701a5a9dcf2SAyala Beker enum cfg80211_nan_conf_changes {
2702a5a9dcf2SAyala Beker 	CFG80211_NAN_CONF_CHANGED_PREF = BIT(0),
27038585989dSLuca Coelho 	CFG80211_NAN_CONF_CHANGED_BANDS = BIT(1),
2704a5a9dcf2SAyala Beker };
2705a5a9dcf2SAyala Beker 
2706a5a9dcf2SAyala Beker /**
2707a442b761SAyala Beker  * struct cfg80211_nan_func_filter - a NAN function Rx / Tx filter
2708a442b761SAyala Beker  *
2709a442b761SAyala Beker  * @filter: the content of the filter
2710a442b761SAyala Beker  * @len: the length of the filter
2711a442b761SAyala Beker  */
2712a442b761SAyala Beker struct cfg80211_nan_func_filter {
2713a442b761SAyala Beker 	const u8 *filter;
2714a442b761SAyala Beker 	u8 len;
2715a442b761SAyala Beker };
2716a442b761SAyala Beker 
2717a442b761SAyala Beker /**
2718a442b761SAyala Beker  * struct cfg80211_nan_func - a NAN function
2719a442b761SAyala Beker  *
2720a442b761SAyala Beker  * @type: &enum nl80211_nan_function_type
2721a442b761SAyala Beker  * @service_id: the service ID of the function
2722a442b761SAyala Beker  * @publish_type: &nl80211_nan_publish_type
2723a442b761SAyala Beker  * @close_range: if true, the range should be limited. Threshold is
2724a442b761SAyala Beker  *	implementation specific.
2725a442b761SAyala Beker  * @publish_bcast: if true, the solicited publish should be broadcasted
2726a442b761SAyala Beker  * @subscribe_active: if true, the subscribe is active
2727a442b761SAyala Beker  * @followup_id: the instance ID for follow up
2728a442b761SAyala Beker  * @followup_reqid: the requestor instance ID for follow up
2729a442b761SAyala Beker  * @followup_dest: MAC address of the recipient of the follow up
2730a442b761SAyala Beker  * @ttl: time to live counter in DW.
2731a442b761SAyala Beker  * @serv_spec_info: Service Specific Info
2732a442b761SAyala Beker  * @serv_spec_info_len: Service Specific Info length
2733a442b761SAyala Beker  * @srf_include: if true, SRF is inclusive
2734a442b761SAyala Beker  * @srf_bf: Bloom Filter
2735a442b761SAyala Beker  * @srf_bf_len: Bloom Filter length
2736a442b761SAyala Beker  * @srf_bf_idx: Bloom Filter index
2737a442b761SAyala Beker  * @srf_macs: SRF MAC addresses
2738a442b761SAyala Beker  * @srf_num_macs: number of MAC addresses in SRF
2739a442b761SAyala Beker  * @rx_filters: rx filters that are matched with corresponding peer's tx_filter
2740a442b761SAyala Beker  * @tx_filters: filters that should be transmitted in the SDF.
2741a442b761SAyala Beker  * @num_rx_filters: length of &rx_filters.
2742a442b761SAyala Beker  * @num_tx_filters: length of &tx_filters.
2743a442b761SAyala Beker  * @instance_id: driver allocated id of the function.
2744a442b761SAyala Beker  * @cookie: unique NAN function identifier.
2745a442b761SAyala Beker  */
2746a442b761SAyala Beker struct cfg80211_nan_func {
2747a442b761SAyala Beker 	enum nl80211_nan_function_type type;
2748a442b761SAyala Beker 	u8 service_id[NL80211_NAN_FUNC_SERVICE_ID_LEN];
2749a442b761SAyala Beker 	u8 publish_type;
2750a442b761SAyala Beker 	bool close_range;
2751a442b761SAyala Beker 	bool publish_bcast;
2752a442b761SAyala Beker 	bool subscribe_active;
2753a442b761SAyala Beker 	u8 followup_id;
2754a442b761SAyala Beker 	u8 followup_reqid;
2755a442b761SAyala Beker 	struct mac_address followup_dest;
2756a442b761SAyala Beker 	u32 ttl;
2757a442b761SAyala Beker 	const u8 *serv_spec_info;
2758a442b761SAyala Beker 	u8 serv_spec_info_len;
2759a442b761SAyala Beker 	bool srf_include;
2760a442b761SAyala Beker 	const u8 *srf_bf;
2761a442b761SAyala Beker 	u8 srf_bf_len;
2762a442b761SAyala Beker 	u8 srf_bf_idx;
2763a442b761SAyala Beker 	struct mac_address *srf_macs;
2764a442b761SAyala Beker 	int srf_num_macs;
2765a442b761SAyala Beker 	struct cfg80211_nan_func_filter *rx_filters;
2766a442b761SAyala Beker 	struct cfg80211_nan_func_filter *tx_filters;
2767a442b761SAyala Beker 	u8 num_tx_filters;
2768a442b761SAyala Beker 	u8 num_rx_filters;
2769a442b761SAyala Beker 	u8 instance_id;
2770a442b761SAyala Beker 	u64 cookie;
2771a442b761SAyala Beker };
2772a442b761SAyala Beker 
2773a442b761SAyala Beker /**
27743a00df57SAvraham Stern  * struct cfg80211_pmk_conf - PMK configuration
27753a00df57SAvraham Stern  *
27763a00df57SAvraham Stern  * @aa: authenticator address
27773a00df57SAvraham Stern  * @pmk_len: PMK length in bytes.
27783a00df57SAvraham Stern  * @pmk: the PMK material
27793a00df57SAvraham Stern  * @pmk_r0_name: PMK-R0 Name. NULL if not applicable (i.e., the PMK
27803a00df57SAvraham Stern  *	is not PMK-R0). When pmk_r0_name is not NULL, the pmk field
27813a00df57SAvraham Stern  *	holds PMK-R0.
27823a00df57SAvraham Stern  */
27833a00df57SAvraham Stern struct cfg80211_pmk_conf {
27843a00df57SAvraham Stern 	const u8 *aa;
27853a00df57SAvraham Stern 	u8 pmk_len;
27863a00df57SAvraham Stern 	const u8 *pmk;
27873a00df57SAvraham Stern 	const u8 *pmk_r0_name;
27883a00df57SAvraham Stern };
27893a00df57SAvraham Stern 
27903a00df57SAvraham Stern /**
279140cbfa90SSrinivas Dasari  * struct cfg80211_external_auth_params - Trigger External authentication.
279240cbfa90SSrinivas Dasari  *
279340cbfa90SSrinivas Dasari  * Commonly used across the external auth request and event interfaces.
279440cbfa90SSrinivas Dasari  *
279540cbfa90SSrinivas Dasari  * @action: action type / trigger for external authentication. Only significant
279640cbfa90SSrinivas Dasari  *	for the authentication request event interface (driver to user space).
279740cbfa90SSrinivas Dasari  * @bssid: BSSID of the peer with which the authentication has
279840cbfa90SSrinivas Dasari  *	to happen. Used by both the authentication request event and
279940cbfa90SSrinivas Dasari  *	authentication response command interface.
280040cbfa90SSrinivas Dasari  * @ssid: SSID of the AP.  Used by both the authentication request event and
280140cbfa90SSrinivas Dasari  *	authentication response command interface.
280240cbfa90SSrinivas Dasari  * @key_mgmt_suite: AKM suite of the respective authentication. Used by the
280340cbfa90SSrinivas Dasari  *	authentication request event interface.
280440cbfa90SSrinivas Dasari  * @status: status code, %WLAN_STATUS_SUCCESS for successful authentication,
280540cbfa90SSrinivas Dasari  *	use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space cannot give you
280640cbfa90SSrinivas Dasari  *	the real status code for failures. Used only for the authentication
280740cbfa90SSrinivas Dasari  *	response command interface (user space to driver).
280840cbfa90SSrinivas Dasari  */
280940cbfa90SSrinivas Dasari struct cfg80211_external_auth_params {
281040cbfa90SSrinivas Dasari 	enum nl80211_external_auth_action action;
281140cbfa90SSrinivas Dasari 	u8 bssid[ETH_ALEN] __aligned(2);
281240cbfa90SSrinivas Dasari 	struct cfg80211_ssid ssid;
281340cbfa90SSrinivas Dasari 	unsigned int key_mgmt_suite;
281440cbfa90SSrinivas Dasari 	u16 status;
281540cbfa90SSrinivas Dasari };
281640cbfa90SSrinivas Dasari 
281740cbfa90SSrinivas Dasari /**
281881e54d08SPradeep Kumar Chitrapu  * cfg80211_ftm_responder_stats - FTM responder statistics
281981e54d08SPradeep Kumar Chitrapu  *
282081e54d08SPradeep Kumar Chitrapu  * @filled: bitflag of flags using the bits of &enum nl80211_ftm_stats to
282181e54d08SPradeep Kumar Chitrapu  *	indicate the relevant values in this struct for them
282281e54d08SPradeep Kumar Chitrapu  * @success_num: number of FTM sessions in which all frames were successfully
282381e54d08SPradeep Kumar Chitrapu  *	answered
282481e54d08SPradeep Kumar Chitrapu  * @partial_num: number of FTM sessions in which part of frames were
282581e54d08SPradeep Kumar Chitrapu  *	successfully answered
282681e54d08SPradeep Kumar Chitrapu  * @failed_num: number of failed FTM sessions
282781e54d08SPradeep Kumar Chitrapu  * @asap_num: number of ASAP FTM sessions
282881e54d08SPradeep Kumar Chitrapu  * @non_asap_num: number of  non-ASAP FTM sessions
282981e54d08SPradeep Kumar Chitrapu  * @total_duration_ms: total sessions durations - gives an indication
283081e54d08SPradeep Kumar Chitrapu  *	of how much time the responder was busy
283181e54d08SPradeep Kumar Chitrapu  * @unknown_triggers_num: number of unknown FTM triggers - triggers from
283281e54d08SPradeep Kumar Chitrapu  *	initiators that didn't finish successfully the negotiation phase with
283381e54d08SPradeep Kumar Chitrapu  *	the responder
283481e54d08SPradeep Kumar Chitrapu  * @reschedule_requests_num: number of FTM reschedule requests - initiator asks
283581e54d08SPradeep Kumar Chitrapu  *	for a new scheduling although it already has scheduled FTM slot
283681e54d08SPradeep Kumar Chitrapu  * @out_of_window_triggers_num: total FTM triggers out of scheduled window
283781e54d08SPradeep Kumar Chitrapu  */
283881e54d08SPradeep Kumar Chitrapu struct cfg80211_ftm_responder_stats {
283981e54d08SPradeep Kumar Chitrapu 	u32 filled;
284081e54d08SPradeep Kumar Chitrapu 	u32 success_num;
284181e54d08SPradeep Kumar Chitrapu 	u32 partial_num;
284281e54d08SPradeep Kumar Chitrapu 	u32 failed_num;
284381e54d08SPradeep Kumar Chitrapu 	u32 asap_num;
284481e54d08SPradeep Kumar Chitrapu 	u32 non_asap_num;
284581e54d08SPradeep Kumar Chitrapu 	u64 total_duration_ms;
284681e54d08SPradeep Kumar Chitrapu 	u32 unknown_triggers_num;
284781e54d08SPradeep Kumar Chitrapu 	u32 reschedule_requests_num;
284881e54d08SPradeep Kumar Chitrapu 	u32 out_of_window_triggers_num;
284981e54d08SPradeep Kumar Chitrapu };
285081e54d08SPradeep Kumar Chitrapu 
285181e54d08SPradeep Kumar Chitrapu /**
2852*9bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_ftm_result - FTM result
2853*9bb7e0f2SJohannes Berg  * @failure_reason: if this measurement failed (PMSR status is
2854*9bb7e0f2SJohannes Berg  *	%NL80211_PMSR_STATUS_FAILURE), this gives a more precise
2855*9bb7e0f2SJohannes Berg  *	reason than just "failure"
2856*9bb7e0f2SJohannes Berg  * @burst_index: if reporting partial results, this is the index
2857*9bb7e0f2SJohannes Berg  *	in [0 .. num_bursts-1] of the burst that's being reported
2858*9bb7e0f2SJohannes Berg  * @num_ftmr_attempts: number of FTM request frames transmitted
2859*9bb7e0f2SJohannes Berg  * @num_ftmr_successes: number of FTM request frames acked
2860*9bb7e0f2SJohannes Berg  * @busy_retry_time: if failure_reason is %NL80211_PMSR_FTM_FAILURE_PEER_BUSY,
2861*9bb7e0f2SJohannes Berg  *	fill this to indicate in how many seconds a retry is deemed possible
2862*9bb7e0f2SJohannes Berg  *	by the responder
2863*9bb7e0f2SJohannes Berg  * @num_bursts_exp: actual number of bursts exponent negotiated
2864*9bb7e0f2SJohannes Berg  * @burst_duration: actual burst duration negotiated
2865*9bb7e0f2SJohannes Berg  * @ftms_per_burst: actual FTMs per burst negotiated
2866*9bb7e0f2SJohannes Berg  * @lci_len: length of LCI information (if present)
2867*9bb7e0f2SJohannes Berg  * @civicloc_len: length of civic location information (if present)
2868*9bb7e0f2SJohannes Berg  * @lci: LCI data (may be %NULL)
2869*9bb7e0f2SJohannes Berg  * @civicloc: civic location data (may be %NULL)
2870*9bb7e0f2SJohannes Berg  * @rssi_avg: average RSSI over FTM action frames reported
2871*9bb7e0f2SJohannes Berg  * @rssi_spread: spread of the RSSI over FTM action frames reported
2872*9bb7e0f2SJohannes Berg  * @tx_rate: bitrate for transmitted FTM action frame response
2873*9bb7e0f2SJohannes Berg  * @rx_rate: bitrate of received FTM action frame
2874*9bb7e0f2SJohannes Berg  * @rtt_avg: average of RTTs measured (must have either this or @dist_avg)
2875*9bb7e0f2SJohannes Berg  * @rtt_variance: variance of RTTs measured (note that standard deviation is
2876*9bb7e0f2SJohannes Berg  *	the square root of the variance)
2877*9bb7e0f2SJohannes Berg  * @rtt_spread: spread of the RTTs measured
2878*9bb7e0f2SJohannes Berg  * @dist_avg: average of distances (mm) measured
2879*9bb7e0f2SJohannes Berg  *	(must have either this or @rtt_avg)
2880*9bb7e0f2SJohannes Berg  * @dist_variance: variance of distances measured (see also @rtt_variance)
2881*9bb7e0f2SJohannes Berg  * @dist_spread: spread of distances measured (see also @rtt_spread)
2882*9bb7e0f2SJohannes Berg  * @num_ftmr_attempts_valid: @num_ftmr_attempts is valid
2883*9bb7e0f2SJohannes Berg  * @num_ftmr_successes_valid: @num_ftmr_successes is valid
2884*9bb7e0f2SJohannes Berg  * @rssi_avg_valid: @rssi_avg is valid
2885*9bb7e0f2SJohannes Berg  * @rssi_spread_valid: @rssi_spread is valid
2886*9bb7e0f2SJohannes Berg  * @tx_rate_valid: @tx_rate is valid
2887*9bb7e0f2SJohannes Berg  * @rx_rate_valid: @rx_rate is valid
2888*9bb7e0f2SJohannes Berg  * @rtt_avg_valid: @rtt_avg is valid
2889*9bb7e0f2SJohannes Berg  * @rtt_variance_valid: @rtt_variance is valid
2890*9bb7e0f2SJohannes Berg  * @rtt_spread_valid: @rtt_spread is valid
2891*9bb7e0f2SJohannes Berg  * @dist_avg_valid: @dist_avg is valid
2892*9bb7e0f2SJohannes Berg  * @dist_variance_valid: @dist_variance is valid
2893*9bb7e0f2SJohannes Berg  * @dist_spread_valid: @dist_spread is valid
2894*9bb7e0f2SJohannes Berg  */
2895*9bb7e0f2SJohannes Berg struct cfg80211_pmsr_ftm_result {
2896*9bb7e0f2SJohannes Berg 	const u8 *lci;
2897*9bb7e0f2SJohannes Berg 	const u8 *civicloc;
2898*9bb7e0f2SJohannes Berg 	unsigned int lci_len;
2899*9bb7e0f2SJohannes Berg 	unsigned int civicloc_len;
2900*9bb7e0f2SJohannes Berg 	enum nl80211_peer_measurement_ftm_failure_reasons failure_reason;
2901*9bb7e0f2SJohannes Berg 	u32 num_ftmr_attempts, num_ftmr_successes;
2902*9bb7e0f2SJohannes Berg 	s16 burst_index;
2903*9bb7e0f2SJohannes Berg 	u8 busy_retry_time;
2904*9bb7e0f2SJohannes Berg 	u8 num_bursts_exp;
2905*9bb7e0f2SJohannes Berg 	u8 burst_duration;
2906*9bb7e0f2SJohannes Berg 	u8 ftms_per_burst;
2907*9bb7e0f2SJohannes Berg 	s32 rssi_avg;
2908*9bb7e0f2SJohannes Berg 	s32 rssi_spread;
2909*9bb7e0f2SJohannes Berg 	struct rate_info tx_rate, rx_rate;
2910*9bb7e0f2SJohannes Berg 	s64 rtt_avg;
2911*9bb7e0f2SJohannes Berg 	s64 rtt_variance;
2912*9bb7e0f2SJohannes Berg 	s64 rtt_spread;
2913*9bb7e0f2SJohannes Berg 	s64 dist_avg;
2914*9bb7e0f2SJohannes Berg 	s64 dist_variance;
2915*9bb7e0f2SJohannes Berg 	s64 dist_spread;
2916*9bb7e0f2SJohannes Berg 
2917*9bb7e0f2SJohannes Berg 	u16 num_ftmr_attempts_valid:1,
2918*9bb7e0f2SJohannes Berg 	    num_ftmr_successes_valid:1,
2919*9bb7e0f2SJohannes Berg 	    rssi_avg_valid:1,
2920*9bb7e0f2SJohannes Berg 	    rssi_spread_valid:1,
2921*9bb7e0f2SJohannes Berg 	    tx_rate_valid:1,
2922*9bb7e0f2SJohannes Berg 	    rx_rate_valid:1,
2923*9bb7e0f2SJohannes Berg 	    rtt_avg_valid:1,
2924*9bb7e0f2SJohannes Berg 	    rtt_variance_valid:1,
2925*9bb7e0f2SJohannes Berg 	    rtt_spread_valid:1,
2926*9bb7e0f2SJohannes Berg 	    dist_avg_valid:1,
2927*9bb7e0f2SJohannes Berg 	    dist_variance_valid:1,
2928*9bb7e0f2SJohannes Berg 	    dist_spread_valid:1;
2929*9bb7e0f2SJohannes Berg };
2930*9bb7e0f2SJohannes Berg 
2931*9bb7e0f2SJohannes Berg /**
2932*9bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_result - peer measurement result
2933*9bb7e0f2SJohannes Berg  * @addr: address of the peer
2934*9bb7e0f2SJohannes Berg  * @host_time: host time (use ktime_get_boottime() adjust to the time when the
2935*9bb7e0f2SJohannes Berg  *	measurement was made)
2936*9bb7e0f2SJohannes Berg  * @ap_tsf: AP's TSF at measurement time
2937*9bb7e0f2SJohannes Berg  * @status: status of the measurement
2938*9bb7e0f2SJohannes Berg  * @final: if reporting partial results, mark this as the last one; if not
2939*9bb7e0f2SJohannes Berg  *	reporting partial results always set this flag
2940*9bb7e0f2SJohannes Berg  * @ap_tsf_valid: indicates the @ap_tsf value is valid
2941*9bb7e0f2SJohannes Berg  * @type: type of the measurement reported, note that we only support reporting
2942*9bb7e0f2SJohannes Berg  *	one type at a time, but you can report multiple results separately and
2943*9bb7e0f2SJohannes Berg  *	they're all aggregated for userspace.
2944*9bb7e0f2SJohannes Berg  */
2945*9bb7e0f2SJohannes Berg struct cfg80211_pmsr_result {
2946*9bb7e0f2SJohannes Berg 	u64 host_time, ap_tsf;
2947*9bb7e0f2SJohannes Berg 	enum nl80211_peer_measurement_status status;
2948*9bb7e0f2SJohannes Berg 
2949*9bb7e0f2SJohannes Berg 	u8 addr[ETH_ALEN];
2950*9bb7e0f2SJohannes Berg 
2951*9bb7e0f2SJohannes Berg 	u8 final:1,
2952*9bb7e0f2SJohannes Berg 	   ap_tsf_valid:1;
2953*9bb7e0f2SJohannes Berg 
2954*9bb7e0f2SJohannes Berg 	enum nl80211_peer_measurement_type type;
2955*9bb7e0f2SJohannes Berg 
2956*9bb7e0f2SJohannes Berg 	union {
2957*9bb7e0f2SJohannes Berg 		struct cfg80211_pmsr_ftm_result ftm;
2958*9bb7e0f2SJohannes Berg 	};
2959*9bb7e0f2SJohannes Berg };
2960*9bb7e0f2SJohannes Berg 
2961*9bb7e0f2SJohannes Berg /**
2962*9bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_ftm_request_peer - FTM request data
2963*9bb7e0f2SJohannes Berg  * @requested: indicates FTM is requested
2964*9bb7e0f2SJohannes Berg  * @preamble: frame preamble to use
2965*9bb7e0f2SJohannes Berg  * @burst_period: burst period to use
2966*9bb7e0f2SJohannes Berg  * @asap: indicates to use ASAP mode
2967*9bb7e0f2SJohannes Berg  * @num_bursts_exp: number of bursts exponent
2968*9bb7e0f2SJohannes Berg  * @burst_duration: burst duration
2969*9bb7e0f2SJohannes Berg  * @ftms_per_burst: number of FTMs per burst
2970*9bb7e0f2SJohannes Berg  * @ftmr_retries: number of retries for FTM request
2971*9bb7e0f2SJohannes Berg  * @request_lci: request LCI information
2972*9bb7e0f2SJohannes Berg  * @request_civicloc: request civic location information
2973*9bb7e0f2SJohannes Berg  *
2974*9bb7e0f2SJohannes Berg  * See also nl80211 for the respective attribute documentation.
2975*9bb7e0f2SJohannes Berg  */
2976*9bb7e0f2SJohannes Berg struct cfg80211_pmsr_ftm_request_peer {
2977*9bb7e0f2SJohannes Berg 	enum nl80211_preamble preamble;
2978*9bb7e0f2SJohannes Berg 	u16 burst_period;
2979*9bb7e0f2SJohannes Berg 	u8 requested:1,
2980*9bb7e0f2SJohannes Berg 	   asap:1,
2981*9bb7e0f2SJohannes Berg 	   request_lci:1,
2982*9bb7e0f2SJohannes Berg 	   request_civicloc:1;
2983*9bb7e0f2SJohannes Berg 	u8 num_bursts_exp;
2984*9bb7e0f2SJohannes Berg 	u8 burst_duration;
2985*9bb7e0f2SJohannes Berg 	u8 ftms_per_burst;
2986*9bb7e0f2SJohannes Berg 	u8 ftmr_retries;
2987*9bb7e0f2SJohannes Berg };
2988*9bb7e0f2SJohannes Berg 
2989*9bb7e0f2SJohannes Berg /**
2990*9bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_request_peer - peer data for a peer measurement request
2991*9bb7e0f2SJohannes Berg  * @addr: MAC address
2992*9bb7e0f2SJohannes Berg  * @chandef: channel to use
2993*9bb7e0f2SJohannes Berg  * @report_ap_tsf: report the associated AP's TSF
2994*9bb7e0f2SJohannes Berg  * @ftm: FTM data, see &struct cfg80211_pmsr_ftm_request_peer
2995*9bb7e0f2SJohannes Berg  */
2996*9bb7e0f2SJohannes Berg struct cfg80211_pmsr_request_peer {
2997*9bb7e0f2SJohannes Berg 	u8 addr[ETH_ALEN];
2998*9bb7e0f2SJohannes Berg 	struct cfg80211_chan_def chandef;
2999*9bb7e0f2SJohannes Berg 	u8 report_ap_tsf:1;
3000*9bb7e0f2SJohannes Berg 	struct cfg80211_pmsr_ftm_request_peer ftm;
3001*9bb7e0f2SJohannes Berg };
3002*9bb7e0f2SJohannes Berg 
3003*9bb7e0f2SJohannes Berg /**
3004*9bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_request - peer measurement request
3005*9bb7e0f2SJohannes Berg  * @cookie: cookie, set by cfg80211
3006*9bb7e0f2SJohannes Berg  * @nl_portid: netlink portid - used by cfg80211
3007*9bb7e0f2SJohannes Berg  * @drv_data: driver data for this request, if required for aborting,
3008*9bb7e0f2SJohannes Berg  *	not otherwise freed or anything by cfg80211
3009*9bb7e0f2SJohannes Berg  * @mac_addr: MAC address used for (randomised) request
3010*9bb7e0f2SJohannes Berg  * @mac_addr_mask: MAC address mask used for randomisation, bits that
3011*9bb7e0f2SJohannes Berg  *	are 0 in the mask should be randomised, bits that are 1 should
3012*9bb7e0f2SJohannes Berg  *	be taken from the @mac_addr
3013*9bb7e0f2SJohannes Berg  * @list: used by cfg80211 to hold on to the request
3014*9bb7e0f2SJohannes Berg  * @timeout: timeout (in milliseconds) for the whole operation, if
3015*9bb7e0f2SJohannes Berg  *	zero it means there's no timeout
3016*9bb7e0f2SJohannes Berg  * @n_peers: number of peers to do measurements with
3017*9bb7e0f2SJohannes Berg  * @peers: per-peer measurement request data
3018*9bb7e0f2SJohannes Berg  */
3019*9bb7e0f2SJohannes Berg struct cfg80211_pmsr_request {
3020*9bb7e0f2SJohannes Berg 	u64 cookie;
3021*9bb7e0f2SJohannes Berg 	void *drv_data;
3022*9bb7e0f2SJohannes Berg 	u32 n_peers;
3023*9bb7e0f2SJohannes Berg 	u32 nl_portid;
3024*9bb7e0f2SJohannes Berg 
3025*9bb7e0f2SJohannes Berg 	u32 timeout;
3026*9bb7e0f2SJohannes Berg 
3027*9bb7e0f2SJohannes Berg 	u8 mac_addr[ETH_ALEN] __aligned(2);
3028*9bb7e0f2SJohannes Berg 	u8 mac_addr_mask[ETH_ALEN] __aligned(2);
3029*9bb7e0f2SJohannes Berg 
3030*9bb7e0f2SJohannes Berg 	struct list_head list;
3031*9bb7e0f2SJohannes Berg 
3032*9bb7e0f2SJohannes Berg 	struct cfg80211_pmsr_request_peer peers[];
3033*9bb7e0f2SJohannes Berg };
3034*9bb7e0f2SJohannes Berg 
3035*9bb7e0f2SJohannes Berg /**
3036704232c2SJohannes Berg  * struct cfg80211_ops - backend description for wireless configuration
3037704232c2SJohannes Berg  *
3038704232c2SJohannes Berg  * This struct is registered by fullmac card drivers and/or wireless stacks
3039704232c2SJohannes Berg  * in order to handle configuration requests on their interfaces.
3040704232c2SJohannes Berg  *
3041704232c2SJohannes Berg  * All callbacks except where otherwise noted should return 0
3042704232c2SJohannes Berg  * on success or a negative error code.
3043704232c2SJohannes Berg  *
304443fb45cbSJohannes Berg  * All operations are currently invoked under rtnl for consistency with the
304543fb45cbSJohannes Berg  * wireless extensions but this is subject to reevaluation as soon as this
304643fb45cbSJohannes Berg  * code is used more widely and we have a first user without wext.
304743fb45cbSJohannes Berg  *
3048ff1b6e69SJohannes Berg  * @suspend: wiphy device needs to be suspended. The variable @wow will
3049ff1b6e69SJohannes Berg  *	be %NULL or contain the enabled Wake-on-Wireless triggers that are
3050ff1b6e69SJohannes Berg  *	configured for the device.
30510378b3f1SJohannes Berg  * @resume: wiphy device needs to be resumed
30526d52563fSJohannes Berg  * @set_wakeup: Called when WoWLAN is enabled/disabled, use this callback
30536d52563fSJohannes Berg  *	to call device_set_wakeup_enable() to enable/disable wakeup from
30546d52563fSJohannes Berg  *	the device.
30550378b3f1SJohannes Berg  *
305660719ffdSJohannes Berg  * @add_virtual_intf: create a new virtual interface with the given name,
3057463d0183SJohannes Berg  *	must set the struct wireless_dev's iftype. Beware: You must create
305884efbb84SJohannes Berg  *	the new netdev in the wiphy's network namespace! Returns the struct
305998104fdeSJohannes Berg  *	wireless_dev, or an ERR_PTR. For P2P device wdevs, the driver must
306098104fdeSJohannes Berg  *	also set the address member in the wdev.
3061704232c2SJohannes Berg  *
306284efbb84SJohannes Berg  * @del_virtual_intf: remove the virtual interface
306355682965SJohannes Berg  *
306460719ffdSJohannes Berg  * @change_virtual_intf: change type/configuration of virtual interface,
306560719ffdSJohannes Berg  *	keep the struct wireless_dev's iftype updated.
306655682965SJohannes Berg  *
306741ade00fSJohannes Berg  * @add_key: add a key with the given parameters. @mac_addr will be %NULL
306841ade00fSJohannes Berg  *	when adding a group key.
306941ade00fSJohannes Berg  *
307041ade00fSJohannes Berg  * @get_key: get information about the key with the given parameters.
307141ade00fSJohannes Berg  *	@mac_addr will be %NULL when requesting information for a group
307241ade00fSJohannes Berg  *	key. All pointers given to the @callback function need not be valid
3073e3da574aSJohannes Berg  *	after it returns. This function should return an error if it is
3074e3da574aSJohannes Berg  *	not possible to retrieve the key, -ENOENT if it doesn't exist.
307541ade00fSJohannes Berg  *
307641ade00fSJohannes Berg  * @del_key: remove a key given the @mac_addr (%NULL for a group key)
3077e3da574aSJohannes Berg  *	and @key_index, return -ENOENT if the key doesn't exist.
307841ade00fSJohannes Berg  *
307941ade00fSJohannes Berg  * @set_default_key: set the default key on an interface
3080ed1b6cc7SJohannes Berg  *
30813cfcf6acSJouni Malinen  * @set_default_mgmt_key: set the default management frame key on an interface
30823cfcf6acSJouni Malinen  *
3083e5497d76SJohannes Berg  * @set_rekey_data: give the data necessary for GTK rekeying to the driver
3084e5497d76SJohannes Berg  *
3085c04a4ff7SJohannes Berg  * @start_ap: Start acting in AP mode defined by the parameters.
3086c04a4ff7SJohannes Berg  * @change_beacon: Change the beacon parameters for an access point mode
3087c04a4ff7SJohannes Berg  *	interface. This should reject the call when AP mode wasn't started.
3088c04a4ff7SJohannes Berg  * @stop_ap: Stop being an AP, including stopping beaconing.
30895727ef1bSJohannes Berg  *
30905727ef1bSJohannes Berg  * @add_station: Add a new station.
309189c771e5SJouni Malinen  * @del_station: Remove a station
3092bdd90d5eSJohannes Berg  * @change_station: Modify a given station. Note that flags changes are not much
3093bdd90d5eSJohannes Berg  *	validated in cfg80211, in particular the auth/assoc/authorized flags
3094bdd90d5eSJohannes Berg  *	might come to the driver in invalid combinations -- make sure to check
309577ee7c89SJohannes Berg  *	them, also against the existing state! Drivers must call
309677ee7c89SJohannes Berg  *	cfg80211_check_station_change() to validate the information.
3097abe37c4bSJohannes Berg  * @get_station: get station information for the station identified by @mac
3098abe37c4bSJohannes Berg  * @dump_station: dump station callback -- resume dump at index @idx
3099abe37c4bSJohannes Berg  *
3100abe37c4bSJohannes Berg  * @add_mpath: add a fixed mesh path
3101abe37c4bSJohannes Berg  * @del_mpath: delete a given mesh path
3102abe37c4bSJohannes Berg  * @change_mpath: change a given mesh path
3103abe37c4bSJohannes Berg  * @get_mpath: get a mesh path for the given parameters
3104abe37c4bSJohannes Berg  * @dump_mpath: dump mesh path callback -- resume dump at index @idx
310566be7d2bSHenning Rogge  * @get_mpp: get a mesh proxy path for the given parameters
310666be7d2bSHenning Rogge  * @dump_mpp: dump mesh proxy path callback -- resume dump at index @idx
3107f52555a4SJohannes Berg  * @join_mesh: join the mesh network with the specified parameters
31088d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
3109f52555a4SJohannes Berg  * @leave_mesh: leave the current mesh network
31108d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
31112ec600d6SLuis Carlos Cobo  *
311224bdd9f4SJavier Cardona  * @get_mesh_config: Get the current mesh configuration
311393da9cc1Scolin@cozybit.com  *
311424bdd9f4SJavier Cardona  * @update_mesh_config: Update mesh parameters on a running mesh.
311593da9cc1Scolin@cozybit.com  *	The mask is a bitfield which tells us which parameters to
311693da9cc1Scolin@cozybit.com  *	set, and which to leave alone.
311793da9cc1Scolin@cozybit.com  *
31189f1ba906SJouni Malinen  * @change_bss: Modify parameters for a given BSS.
311931888487SJouni Malinen  *
312031888487SJouni Malinen  * @set_txq_params: Set TX queue parameters
312172bdcf34SJouni Malinen  *
3122e8c9bd5bSJohannes Berg  * @libertas_set_mesh_channel: Only for backward compatibility for libertas,
3123e8c9bd5bSJohannes Berg  *	as it doesn't implement join_mesh and needs to set the channel to
3124e8c9bd5bSJohannes Berg  *	join the mesh instead.
3125e8c9bd5bSJohannes Berg  *
3126e8c9bd5bSJohannes Berg  * @set_monitor_channel: Set the monitor mode channel for the device. If other
3127e8c9bd5bSJohannes Berg  *	interfaces are active this callback should reject the configuration.
3128e8c9bd5bSJohannes Berg  *	If no interfaces are active or the device is down, the channel should
3129e8c9bd5bSJohannes Berg  *	be stored for when a monitor interface becomes active.
31309aed3cc1SJouni Malinen  *
31312a519311SJohannes Berg  * @scan: Request to do a scan. If returning zero, the scan request is given
31322a519311SJohannes Berg  *	the driver, and will be valid until passed to cfg80211_scan_done().
31332a519311SJohannes Berg  *	For scan results, call cfg80211_inform_bss(); you can call this outside
31342a519311SJohannes Berg  *	the scan/scan_done bracket too.
313591d3ab46SVidyullatha Kanchanapally  * @abort_scan: Tell the driver to abort an ongoing scan. The driver shall
313691d3ab46SVidyullatha Kanchanapally  *	indicate the status of the scan through cfg80211_scan_done().
3137636a5d36SJouni Malinen  *
3138636a5d36SJouni Malinen  * @auth: Request to authenticate with the specified peer
31398d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
3140636a5d36SJouni Malinen  * @assoc: Request to (re)associate with the specified peer
31418d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
3142636a5d36SJouni Malinen  * @deauth: Request to deauthenticate from the specified peer
31438d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
3144636a5d36SJouni Malinen  * @disassoc: Request to disassociate from the specified peer
31458d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
314604a773adSJohannes Berg  *
3147b23aa676SSamuel Ortiz  * @connect: Connect to the ESS with the specified parameters. When connected,
3148bf1ecd21SJouni Malinen  *	call cfg80211_connect_result()/cfg80211_connect_bss() with status code
3149bf1ecd21SJouni Malinen  *	%WLAN_STATUS_SUCCESS. If the connection fails for some reason, call
3150bf1ecd21SJouni Malinen  *	cfg80211_connect_result()/cfg80211_connect_bss() with the status code
3151bf1ecd21SJouni Malinen  *	from the AP or cfg80211_connect_timeout() if no frame with status code
3152bf1ecd21SJouni Malinen  *	was received.
3153bf1ecd21SJouni Malinen  *	The driver is allowed to roam to other BSSes within the ESS when the
3154bf1ecd21SJouni Malinen  *	other BSS matches the connect parameters. When such roaming is initiated
3155bf1ecd21SJouni Malinen  *	by the driver, the driver is expected to verify that the target matches
3156bf1ecd21SJouni Malinen  *	the configured security parameters and to use Reassociation Request
3157bf1ecd21SJouni Malinen  *	frame instead of Association Request frame.
3158bf1ecd21SJouni Malinen  *	The connect function can also be used to request the driver to perform a
3159bf1ecd21SJouni Malinen  *	specific roam when connected to an ESS. In that case, the prev_bssid
316035eb8f7bSJouni Malinen  *	parameter is set to the BSSID of the currently associated BSS as an
3161bf1ecd21SJouni Malinen  *	indication of requesting reassociation.
3162bf1ecd21SJouni Malinen  *	In both the driver-initiated and new connect() call initiated roaming
3163bf1ecd21SJouni Malinen  *	cases, the result of roaming is indicated with a call to
316429ce6ecbSAvraham Stern  *	cfg80211_roamed(). (invoked with the wireless_dev mutex held)
3165088e8df8Svamsi krishna  * @update_connect_params: Update the connect parameters while connected to a
3166088e8df8Svamsi krishna  *	BSS. The updated parameters can be used by driver/firmware for
3167088e8df8Svamsi krishna  *	subsequent BSS selection (roaming) decisions and to form the
3168088e8df8Svamsi krishna  *	Authentication/(Re)Association Request frames. This call does not
3169088e8df8Svamsi krishna  *	request an immediate disassociation or reassociation with the current
3170088e8df8Svamsi krishna  *	BSS, i.e., this impacts only subsequent (re)associations. The bits in
3171088e8df8Svamsi krishna  *	changed are defined in &enum cfg80211_connect_params_changed.
3172088e8df8Svamsi krishna  *	(invoked with the wireless_dev mutex held)
31730711d638SIlan Peer  * @disconnect: Disconnect from the BSS/ESS or stop connection attempts if
31740711d638SIlan Peer  *      connection is in progress. Once done, call cfg80211_disconnected() in
31750711d638SIlan Peer  *      case connection was already established (invoked with the
31760711d638SIlan Peer  *      wireless_dev mutex held), otherwise call cfg80211_connect_timeout().
3177b23aa676SSamuel Ortiz  *
317804a773adSJohannes Berg  * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call
317904a773adSJohannes Berg  *	cfg80211_ibss_joined(), also call that function when changing BSSID due
318004a773adSJohannes Berg  *	to a merge.
31818d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
318204a773adSJohannes Berg  * @leave_ibss: Leave the IBSS.
31838d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
3184b9a5f8caSJouni Malinen  *
3185f4e583c8SAntonio Quartulli  * @set_mcast_rate: Set the specified multicast rate (only if vif is in ADHOC or
3186f4e583c8SAntonio Quartulli  *	MESH mode)
3187f4e583c8SAntonio Quartulli  *
3188b9a5f8caSJouni Malinen  * @set_wiphy_params: Notify that wiphy parameters have changed;
3189b9a5f8caSJouni Malinen  *	@changed bitfield (see &enum wiphy_params_flags) describes which values
3190b9a5f8caSJouni Malinen  *	have changed. The actual parameter values are available in
3191b9a5f8caSJouni Malinen  *	struct wiphy. If returning an error, no value should be changed.
31927643a2c3SJohannes Berg  *
31931432de07SLuis R. Rodriguez  * @set_tx_power: set the transmit power according to the parameters,
3194c8442118SJohannes Berg  *	the power passed is in mBm, to get dBm use MBM_TO_DBM(). The
3195c8442118SJohannes Berg  *	wdev may be %NULL if power was set for the wiphy, and will
3196c8442118SJohannes Berg  *	always be %NULL unless the driver supports per-vif TX power
3197c8442118SJohannes Berg  *	(as advertised by the nl80211 feature flag.)
31987643a2c3SJohannes Berg  * @get_tx_power: store the current TX power into the dbm variable;
31991f87f7d3SJohannes Berg  *	return 0 if successful
32001f87f7d3SJohannes Berg  *
3201abe37c4bSJohannes Berg  * @set_wds_peer: set the WDS peer for a WDS interface
3202abe37c4bSJohannes Berg  *
32031f87f7d3SJohannes Berg  * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting
32041f87f7d3SJohannes Berg  *	functions to adjust rfkill hw state
3205aff89a9bSJohannes Berg  *
320661fa713cSHolger Schurig  * @dump_survey: get site survey information.
320761fa713cSHolger Schurig  *
32089588bbd5SJouni Malinen  * @remain_on_channel: Request the driver to remain awake on the specified
32099588bbd5SJouni Malinen  *	channel for the specified duration to complete an off-channel
32109588bbd5SJouni Malinen  *	operation (e.g., public action frame exchange). When the driver is
32119588bbd5SJouni Malinen  *	ready on the requested channel, it must indicate this with an event
32129588bbd5SJouni Malinen  *	notification by calling cfg80211_ready_on_channel().
32139588bbd5SJouni Malinen  * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation.
32149588bbd5SJouni Malinen  *	This allows the operation to be terminated prior to timeout based on
32159588bbd5SJouni Malinen  *	the duration value.
3216f7ca38dfSJohannes Berg  * @mgmt_tx: Transmit a management frame.
3217f7ca38dfSJohannes Berg  * @mgmt_tx_cancel_wait: Cancel the wait time from transmitting a management
3218f7ca38dfSJohannes Berg  *	frame on another channel
32199588bbd5SJouni Malinen  *
3220fc73f11fSDavid Spinadel  * @testmode_cmd: run a test mode command; @wdev may be %NULL
322171063f0eSWey-Yi Guy  * @testmode_dump: Implement a test mode dump. The cb->args[2] and up may be
322271063f0eSWey-Yi Guy  *	used by the function, but 0 and 1 must not be touched. Additionally,
322371063f0eSWey-Yi Guy  *	return error codes other than -ENOBUFS and -ENOENT will terminate the
322471063f0eSWey-Yi Guy  *	dump and return to userspace with an error, so be careful. If any data
322571063f0eSWey-Yi Guy  *	was passed in from userspace then the data/len arguments will be present
322671063f0eSWey-Yi Guy  *	and point to the data contained in %NL80211_ATTR_TESTDATA.
322767fbb16bSSamuel Ortiz  *
3228abe37c4bSJohannes Berg  * @set_bitrate_mask: set the bitrate mask configuration
3229abe37c4bSJohannes Berg  *
323067fbb16bSSamuel Ortiz  * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac
323167fbb16bSSamuel Ortiz  *	devices running firmwares capable of generating the (re) association
323267fbb16bSSamuel Ortiz  *	RSN IE. It allows for faster roaming between WPA2 BSSIDs.
323367fbb16bSSamuel Ortiz  * @del_pmksa: Delete a cached PMKID.
323467fbb16bSSamuel Ortiz  * @flush_pmksa: Flush all cached PMKIDs.
32359043f3b8SJuuso Oikarinen  * @set_power_mgmt: Configure WLAN power management. A timeout value of -1
32369043f3b8SJuuso Oikarinen  *	allows the driver to adjust the dynamic ps timeout value.
3237d6dc1a38SJuuso Oikarinen  * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold.
3238e86abc68SJohannes Berg  *	After configuration, the driver should (soon) send an event indicating
3239e86abc68SJohannes Berg  *	the current level is above/below the configured threshold; this may
3240e86abc68SJohannes Berg  *	need some care when the configuration is changed (without first being
3241e86abc68SJohannes Berg  *	disabled.)
32424a4b8169SAndrew Zaborowski  * @set_cqm_rssi_range_config: Configure two RSSI thresholds in the
32434a4b8169SAndrew Zaborowski  *	connection quality monitor.  An event is to be sent only when the
32444a4b8169SAndrew Zaborowski  *	signal level is found to be outside the two values.  The driver should
32454a4b8169SAndrew Zaborowski  *	set %NL80211_EXT_FEATURE_CQM_RSSI_LIST if this method is implemented.
32464a4b8169SAndrew Zaborowski  *	If it is provided then there's no point providing @set_cqm_rssi_config.
324784f10708SThomas Pedersen  * @set_cqm_txe_config: Configure connection quality monitor TX error
324884f10708SThomas Pedersen  *	thresholds.
3249807f8a8cSLuciano Coelho  * @sched_scan_start: Tell the driver to start a scheduled scan.
32503a3ecf1dSArend Van Spriel  * @sched_scan_stop: Tell the driver to stop an ongoing scheduled scan with
32513a3ecf1dSArend Van Spriel  *	given request id. This call must stop the scheduled scan and be ready
32523a3ecf1dSArend Van Spriel  *	for starting a new one before it returns, i.e. @sched_scan_start may be
32533a3ecf1dSArend Van Spriel  *	called immediately after that again and should not fail in that case.
32543a3ecf1dSArend Van Spriel  *	The driver should not call cfg80211_sched_scan_stopped() for a requested
32553a3ecf1dSArend Van Spriel  *	stop (when this method returns 0).
325667fbb16bSSamuel Ortiz  *
3257271733cfSJohannes Berg  * @mgmt_frame_register: Notify driver that a management frame type was
325833d8783cSJohannes Berg  *	registered. The callback is allowed to sleep.
3259547025d5SBruno Randolf  *
3260547025d5SBruno Randolf  * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device.
3261547025d5SBruno Randolf  *	Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may
3262547025d5SBruno Randolf  *	reject TX/RX mask combinations they cannot support by returning -EINVAL
3263547025d5SBruno Randolf  *	(also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX).
3264547025d5SBruno Randolf  *
3265547025d5SBruno Randolf  * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant).
32663677713bSJohn W. Linville  *
3267109086ceSArik Nemtsov  * @tdls_mgmt: Transmit a TDLS management frame.
3268109086ceSArik Nemtsov  * @tdls_oper: Perform a high-level TDLS operation (e.g. TDLS link setup).
32697f6cf311SJohannes Berg  *
32707f6cf311SJohannes Berg  * @probe_client: probe an associated client, must return a cookie that it
32717f6cf311SJohannes Berg  *	later passes to cfg80211_probe_status().
32721d9d9213SSimon Wunderlich  *
32731d9d9213SSimon Wunderlich  * @set_noack_map: Set the NoAck Map for the TIDs.
3274d6199218SBen Greear  *
32755b7ccaf3SJohannes Berg  * @get_channel: Get the current operating channel for the virtual interface.
32765b7ccaf3SJohannes Berg  *	For monitor interfaces, it should return %NULL unless there's a single
32775b7ccaf3SJohannes Berg  *	current monitoring channel.
327898104fdeSJohannes Berg  *
327998104fdeSJohannes Berg  * @start_p2p_device: Start the given P2P device.
328098104fdeSJohannes Berg  * @stop_p2p_device: Stop the given P2P device.
328177765eafSVasanthakumar Thiagarajan  *
328277765eafSVasanthakumar Thiagarajan  * @set_mac_acl: Sets MAC address control list in AP and P2P GO mode.
328377765eafSVasanthakumar Thiagarajan  *	Parameters include ACL policy, an array of MAC address of stations
328477765eafSVasanthakumar Thiagarajan  *	and the number of MAC addresses. If there is already a list in driver
328577765eafSVasanthakumar Thiagarajan  *	this new list replaces the existing one. Driver has to clear its ACL
328677765eafSVasanthakumar Thiagarajan  *	when number of MAC addresses entries is passed as 0. Drivers which
328777765eafSVasanthakumar Thiagarajan  *	advertise the support for MAC based ACL have to implement this callback.
328804f39047SSimon Wunderlich  *
328904f39047SSimon Wunderlich  * @start_radar_detection: Start radar detection in the driver.
32908bf24293SJouni Malinen  *
32918bf24293SJouni Malinen  * @update_ft_ies: Provide updated Fast BSS Transition information to the
32928bf24293SJouni Malinen  *	driver. If the SME is in the driver/firmware, this information can be
32938bf24293SJouni Malinen  *	used in building Authentication and Reassociation Request frames.
32945de17984SArend van Spriel  *
32955de17984SArend van Spriel  * @crit_proto_start: Indicates a critical protocol needs more link reliability
32965de17984SArend van Spriel  *	for a given duration (milliseconds). The protocol is provided so the
32975de17984SArend van Spriel  *	driver can take the most appropriate actions.
32985de17984SArend van Spriel  * @crit_proto_stop: Indicates critical protocol no longer needs increased link
32995de17984SArend van Spriel  *	reliability. This operation can not fail.
3300be29b99aSAmitkumar Karwar  * @set_coalesce: Set coalesce parameters.
330116ef1fe2SSimon Wunderlich  *
330297dc94f1SMichal Kazior  * @channel_switch: initiate channel-switch procedure (with CSA). Driver is
330397dc94f1SMichal Kazior  *	responsible for veryfing if the switch is possible. Since this is
330497dc94f1SMichal Kazior  *	inherently tricky driver may decide to disconnect an interface later
330597dc94f1SMichal Kazior  *	with cfg80211_stop_iface(). This doesn't mean driver can accept
330697dc94f1SMichal Kazior  *	everything. It should do it's best to verify requests and reject them
330797dc94f1SMichal Kazior  *	as soon as possible.
3308fa9ffc74SKyeyoon Park  *
3309fa9ffc74SKyeyoon Park  * @set_qos_map: Set QoS mapping information to the driver
3310e16821bcSJouni Malinen  *
3311e16821bcSJouni Malinen  * @set_ap_chanwidth: Set the AP (including P2P GO) mode channel width for the
3312e16821bcSJouni Malinen  *	given interface This is used e.g. for dynamic HT 20/40 MHz channel width
3313e16821bcSJouni Malinen  *	changes during the lifetime of the BSS.
3314960d01acSJohannes Berg  *
3315960d01acSJohannes Berg  * @add_tx_ts: validate (if admitted_time is 0) or add a TX TS to the device
3316960d01acSJohannes Berg  *	with the given parameters; action frame exchange has been handled by
3317960d01acSJohannes Berg  *	userspace so this just has to modify the TX path to take the TS into
3318960d01acSJohannes Berg  *	account.
3319960d01acSJohannes Berg  *	If the admitted time is 0 just validate the parameters to make sure
3320960d01acSJohannes Berg  *	the session can be created at all; it is valid to just always return
3321960d01acSJohannes Berg  *	success for that but that may result in inefficient behaviour (handshake
3322960d01acSJohannes Berg  *	with the peer followed by immediate teardown when the addition is later
3323960d01acSJohannes Berg  *	rejected)
3324960d01acSJohannes Berg  * @del_tx_ts: remove an existing TX TS
33256e0bd6c3SRostislav Lisovy  *
33266e0bd6c3SRostislav Lisovy  * @join_ocb: join the OCB network with the specified parameters
33276e0bd6c3SRostislav Lisovy  *	(invoked with the wireless_dev mutex held)
33286e0bd6c3SRostislav Lisovy  * @leave_ocb: leave the current OCB network
33296e0bd6c3SRostislav Lisovy  *	(invoked with the wireless_dev mutex held)
33301057d35eSArik Nemtsov  *
33311057d35eSArik Nemtsov  * @tdls_channel_switch: Start channel-switching with a TDLS peer. The driver
33321057d35eSArik Nemtsov  *	is responsible for continually initiating channel-switching operations
33331057d35eSArik Nemtsov  *	and returning to the base channel for communication with the AP.
33341057d35eSArik Nemtsov  * @tdls_cancel_channel_switch: Stop channel-switching with a TDLS peer. Both
33351057d35eSArik Nemtsov  *	peers must be on the base channel when the call completes.
3336cb3b7d87SAyala Beker  * @start_nan: Start the NAN interface.
3337cb3b7d87SAyala Beker  * @stop_nan: Stop the NAN interface.
3338a442b761SAyala Beker  * @add_nan_func: Add a NAN function. Returns negative value on failure.
3339a442b761SAyala Beker  *	On success @nan_func ownership is transferred to the driver and
3340a442b761SAyala Beker  *	it may access it outside of the scope of this function. The driver
3341a442b761SAyala Beker  *	should free the @nan_func when no longer needed by calling
3342a442b761SAyala Beker  *	cfg80211_free_nan_func().
3343a442b761SAyala Beker  *	On success the driver should assign an instance_id in the
3344a442b761SAyala Beker  *	provided @nan_func.
3345a442b761SAyala Beker  * @del_nan_func: Delete a NAN function.
3346a5a9dcf2SAyala Beker  * @nan_change_conf: changes NAN configuration. The changed parameters must
3347a5a9dcf2SAyala Beker  *	be specified in @changes (using &enum cfg80211_nan_conf_changes);
3348a5a9dcf2SAyala Beker  *	All other parameters must be ignored.
3349ce0ce13aSMichael Braun  *
3350ce0ce13aSMichael Braun  * @set_multicast_to_unicast: configure multicast to unicast conversion for BSS
33513a00df57SAvraham Stern  *
335252539ca8SToke Høiland-Jørgensen  * @get_txq_stats: Get TXQ stats for interface or phy. If wdev is %NULL, this
335352539ca8SToke Høiland-Jørgensen  *      function should return phy stats, and interface stats otherwise.
335452539ca8SToke Høiland-Jørgensen  *
33553a00df57SAvraham Stern  * @set_pmk: configure the PMK to be used for offloaded 802.1X 4-Way handshake.
33563a00df57SAvraham Stern  *	If not deleted through @del_pmk the PMK remains valid until disconnect
33573a00df57SAvraham Stern  *	upon which the driver should clear it.
33583a00df57SAvraham Stern  *	(invoked with the wireless_dev mutex held)
33593a00df57SAvraham Stern  * @del_pmk: delete the previously configured PMK for the given authenticator.
33603a00df57SAvraham Stern  *	(invoked with the wireless_dev mutex held)
336140cbfa90SSrinivas Dasari  *
336240cbfa90SSrinivas Dasari  * @external_auth: indicates result of offloaded authentication processing from
336340cbfa90SSrinivas Dasari  *     user space
33642576a9acSDenis Kenzior  *
33652576a9acSDenis Kenzior  * @tx_control_port: TX a control port frame (EAPoL).  The noencrypt parameter
33662576a9acSDenis Kenzior  *	tells the driver that the frame should not be encrypted.
336781e54d08SPradeep Kumar Chitrapu  *
336881e54d08SPradeep Kumar Chitrapu  * @get_ftm_responder_stats: Retrieve FTM responder statistics, if available.
336981e54d08SPradeep Kumar Chitrapu  *	Statistics should be cumulative, currently no way to reset is provided.
3370*9bb7e0f2SJohannes Berg  * @start_pmsr: start peer measurement (e.g. FTM)
3371*9bb7e0f2SJohannes Berg  * @abort_pmsr: abort peer measurement
3372704232c2SJohannes Berg  */
3373704232c2SJohannes Berg struct cfg80211_ops {
3374ff1b6e69SJohannes Berg 	int	(*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
33750378b3f1SJohannes Berg 	int	(*resume)(struct wiphy *wiphy);
33766d52563fSJohannes Berg 	void	(*set_wakeup)(struct wiphy *wiphy, bool enabled);
33770378b3f1SJohannes Berg 
337884efbb84SJohannes Berg 	struct wireless_dev * (*add_virtual_intf)(struct wiphy *wiphy,
3379552bff0cSJohannes Berg 						  const char *name,
33806bab2e19STom Gundersen 						  unsigned char name_assign_type,
3381f9e10ce4SJohannes Berg 						  enum nl80211_iftype type,
33822ec600d6SLuis Carlos Cobo 						  struct vif_params *params);
338384efbb84SJohannes Berg 	int	(*del_virtual_intf)(struct wiphy *wiphy,
338484efbb84SJohannes Berg 				    struct wireless_dev *wdev);
3385e36d56b6SJohannes Berg 	int	(*change_virtual_intf)(struct wiphy *wiphy,
3386e36d56b6SJohannes Berg 				       struct net_device *dev,
3387818a986eSJohannes Berg 				       enum nl80211_iftype type,
33882ec600d6SLuis Carlos Cobo 				       struct vif_params *params);
338941ade00fSJohannes Berg 
339041ade00fSJohannes Berg 	int	(*add_key)(struct wiphy *wiphy, struct net_device *netdev,
3391e31b8213SJohannes Berg 			   u8 key_index, bool pairwise, const u8 *mac_addr,
339241ade00fSJohannes Berg 			   struct key_params *params);
339341ade00fSJohannes Berg 	int	(*get_key)(struct wiphy *wiphy, struct net_device *netdev,
3394e31b8213SJohannes Berg 			   u8 key_index, bool pairwise, const u8 *mac_addr,
3395e31b8213SJohannes Berg 			   void *cookie,
339641ade00fSJohannes Berg 			   void (*callback)(void *cookie, struct key_params*));
339741ade00fSJohannes Berg 	int	(*del_key)(struct wiphy *wiphy, struct net_device *netdev,
3398e31b8213SJohannes Berg 			   u8 key_index, bool pairwise, const u8 *mac_addr);
339941ade00fSJohannes Berg 	int	(*set_default_key)(struct wiphy *wiphy,
340041ade00fSJohannes Berg 				   struct net_device *netdev,
3401dbd2fd65SJohannes Berg 				   u8 key_index, bool unicast, bool multicast);
34023cfcf6acSJouni Malinen 	int	(*set_default_mgmt_key)(struct wiphy *wiphy,
34033cfcf6acSJouni Malinen 					struct net_device *netdev,
34043cfcf6acSJouni Malinen 					u8 key_index);
3405ed1b6cc7SJohannes Berg 
34068860020eSJohannes Berg 	int	(*start_ap)(struct wiphy *wiphy, struct net_device *dev,
34078860020eSJohannes Berg 			    struct cfg80211_ap_settings *settings);
34088860020eSJohannes Berg 	int	(*change_beacon)(struct wiphy *wiphy, struct net_device *dev,
34098860020eSJohannes Berg 				 struct cfg80211_beacon_data *info);
34108860020eSJohannes Berg 	int	(*stop_ap)(struct wiphy *wiphy, struct net_device *dev);
34115727ef1bSJohannes Berg 
34125727ef1bSJohannes Berg 
34135727ef1bSJohannes Berg 	int	(*add_station)(struct wiphy *wiphy, struct net_device *dev,
34143b3a0162SJohannes Berg 			       const u8 *mac,
34153b3a0162SJohannes Berg 			       struct station_parameters *params);
34165727ef1bSJohannes Berg 	int	(*del_station)(struct wiphy *wiphy, struct net_device *dev,
341789c771e5SJouni Malinen 			       struct station_del_parameters *params);
34185727ef1bSJohannes Berg 	int	(*change_station)(struct wiphy *wiphy, struct net_device *dev,
34193b3a0162SJohannes Berg 				  const u8 *mac,
34203b3a0162SJohannes Berg 				  struct station_parameters *params);
3421fd5b74dcSJohannes Berg 	int	(*get_station)(struct wiphy *wiphy, struct net_device *dev,
34223b3a0162SJohannes Berg 			       const u8 *mac, struct station_info *sinfo);
34232ec600d6SLuis Carlos Cobo 	int	(*dump_station)(struct wiphy *wiphy, struct net_device *dev,
34242ec600d6SLuis Carlos Cobo 				int idx, u8 *mac, struct station_info *sinfo);
34252ec600d6SLuis Carlos Cobo 
34262ec600d6SLuis Carlos Cobo 	int	(*add_mpath)(struct wiphy *wiphy, struct net_device *dev,
34273b3a0162SJohannes Berg 			       const u8 *dst, const u8 *next_hop);
34282ec600d6SLuis Carlos Cobo 	int	(*del_mpath)(struct wiphy *wiphy, struct net_device *dev,
34293b3a0162SJohannes Berg 			       const u8 *dst);
34302ec600d6SLuis Carlos Cobo 	int	(*change_mpath)(struct wiphy *wiphy, struct net_device *dev,
34313b3a0162SJohannes Berg 				  const u8 *dst, const u8 *next_hop);
34322ec600d6SLuis Carlos Cobo 	int	(*get_mpath)(struct wiphy *wiphy, struct net_device *dev,
34333b3a0162SJohannes Berg 			     u8 *dst, u8 *next_hop, struct mpath_info *pinfo);
34342ec600d6SLuis Carlos Cobo 	int	(*dump_mpath)(struct wiphy *wiphy, struct net_device *dev,
34352ec600d6SLuis Carlos Cobo 			      int idx, u8 *dst, u8 *next_hop,
34362ec600d6SLuis Carlos Cobo 			      struct mpath_info *pinfo);
343766be7d2bSHenning Rogge 	int	(*get_mpp)(struct wiphy *wiphy, struct net_device *dev,
343866be7d2bSHenning Rogge 			   u8 *dst, u8 *mpp, struct mpath_info *pinfo);
343966be7d2bSHenning Rogge 	int	(*dump_mpp)(struct wiphy *wiphy, struct net_device *dev,
344066be7d2bSHenning Rogge 			    int idx, u8 *dst, u8 *mpp,
344166be7d2bSHenning Rogge 			    struct mpath_info *pinfo);
344224bdd9f4SJavier Cardona 	int	(*get_mesh_config)(struct wiphy *wiphy,
344393da9cc1Scolin@cozybit.com 				struct net_device *dev,
344493da9cc1Scolin@cozybit.com 				struct mesh_config *conf);
344524bdd9f4SJavier Cardona 	int	(*update_mesh_config)(struct wiphy *wiphy,
344629cbe68cSJohannes Berg 				      struct net_device *dev, u32 mask,
344729cbe68cSJohannes Berg 				      const struct mesh_config *nconf);
344829cbe68cSJohannes Berg 	int	(*join_mesh)(struct wiphy *wiphy, struct net_device *dev,
344929cbe68cSJohannes Berg 			     const struct mesh_config *conf,
345029cbe68cSJohannes Berg 			     const struct mesh_setup *setup);
345129cbe68cSJohannes Berg 	int	(*leave_mesh)(struct wiphy *wiphy, struct net_device *dev);
345229cbe68cSJohannes Berg 
34536e0bd6c3SRostislav Lisovy 	int	(*join_ocb)(struct wiphy *wiphy, struct net_device *dev,
34546e0bd6c3SRostislav Lisovy 			    struct ocb_setup *setup);
34556e0bd6c3SRostislav Lisovy 	int	(*leave_ocb)(struct wiphy *wiphy, struct net_device *dev);
34566e0bd6c3SRostislav Lisovy 
34579f1ba906SJouni Malinen 	int	(*change_bss)(struct wiphy *wiphy, struct net_device *dev,
34589f1ba906SJouni Malinen 			      struct bss_parameters *params);
345931888487SJouni Malinen 
3460f70f01c2SEliad Peller 	int	(*set_txq_params)(struct wiphy *wiphy, struct net_device *dev,
346131888487SJouni Malinen 				  struct ieee80211_txq_params *params);
346272bdcf34SJouni Malinen 
3463e8c9bd5bSJohannes Berg 	int	(*libertas_set_mesh_channel)(struct wiphy *wiphy,
3464e8c9bd5bSJohannes Berg 					     struct net_device *dev,
3465e8c9bd5bSJohannes Berg 					     struct ieee80211_channel *chan);
3466e8c9bd5bSJohannes Berg 
3467e8c9bd5bSJohannes Berg 	int	(*set_monitor_channel)(struct wiphy *wiphy,
3468683b6d3bSJohannes Berg 				       struct cfg80211_chan_def *chandef);
34699aed3cc1SJouni Malinen 
3470fd014284SJohannes Berg 	int	(*scan)(struct wiphy *wiphy,
34712a519311SJohannes Berg 			struct cfg80211_scan_request *request);
347291d3ab46SVidyullatha Kanchanapally 	void	(*abort_scan)(struct wiphy *wiphy, struct wireless_dev *wdev);
3473636a5d36SJouni Malinen 
3474636a5d36SJouni Malinen 	int	(*auth)(struct wiphy *wiphy, struct net_device *dev,
3475636a5d36SJouni Malinen 			struct cfg80211_auth_request *req);
3476636a5d36SJouni Malinen 	int	(*assoc)(struct wiphy *wiphy, struct net_device *dev,
3477636a5d36SJouni Malinen 			 struct cfg80211_assoc_request *req);
3478636a5d36SJouni Malinen 	int	(*deauth)(struct wiphy *wiphy, struct net_device *dev,
347963c9c5e7SJohannes Berg 			  struct cfg80211_deauth_request *req);
3480636a5d36SJouni Malinen 	int	(*disassoc)(struct wiphy *wiphy, struct net_device *dev,
348163c9c5e7SJohannes Berg 			    struct cfg80211_disassoc_request *req);
348204a773adSJohannes Berg 
3483b23aa676SSamuel Ortiz 	int	(*connect)(struct wiphy *wiphy, struct net_device *dev,
3484b23aa676SSamuel Ortiz 			   struct cfg80211_connect_params *sme);
3485088e8df8Svamsi krishna 	int	(*update_connect_params)(struct wiphy *wiphy,
3486088e8df8Svamsi krishna 					 struct net_device *dev,
3487088e8df8Svamsi krishna 					 struct cfg80211_connect_params *sme,
3488088e8df8Svamsi krishna 					 u32 changed);
3489b23aa676SSamuel Ortiz 	int	(*disconnect)(struct wiphy *wiphy, struct net_device *dev,
3490b23aa676SSamuel Ortiz 			      u16 reason_code);
3491b23aa676SSamuel Ortiz 
349204a773adSJohannes Berg 	int	(*join_ibss)(struct wiphy *wiphy, struct net_device *dev,
349304a773adSJohannes Berg 			     struct cfg80211_ibss_params *params);
349404a773adSJohannes Berg 	int	(*leave_ibss)(struct wiphy *wiphy, struct net_device *dev);
3495b9a5f8caSJouni Malinen 
3496f4e583c8SAntonio Quartulli 	int	(*set_mcast_rate)(struct wiphy *wiphy, struct net_device *dev,
349757fbcce3SJohannes Berg 				  int rate[NUM_NL80211_BANDS]);
3498f4e583c8SAntonio Quartulli 
3499b9a5f8caSJouni Malinen 	int	(*set_wiphy_params)(struct wiphy *wiphy, u32 changed);
35007643a2c3SJohannes Berg 
3501c8442118SJohannes Berg 	int	(*set_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
3502fa61cf70SJuuso Oikarinen 				enum nl80211_tx_power_setting type, int mbm);
3503c8442118SJohannes Berg 	int	(*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
3504c8442118SJohannes Berg 				int *dbm);
35051f87f7d3SJohannes Berg 
3506ab737a4fSJohannes Berg 	int	(*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev,
3507388ac775SJohannes Berg 				const u8 *addr);
3508ab737a4fSJohannes Berg 
35091f87f7d3SJohannes Berg 	void	(*rfkill_poll)(struct wiphy *wiphy);
3510aff89a9bSJohannes Berg 
3511aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE
3512fc73f11fSDavid Spinadel 	int	(*testmode_cmd)(struct wiphy *wiphy, struct wireless_dev *wdev,
3513fc73f11fSDavid Spinadel 				void *data, int len);
351471063f0eSWey-Yi Guy 	int	(*testmode_dump)(struct wiphy *wiphy, struct sk_buff *skb,
351571063f0eSWey-Yi Guy 				 struct netlink_callback *cb,
351671063f0eSWey-Yi Guy 				 void *data, int len);
3517aff89a9bSJohannes Berg #endif
3518bc92afd9SJohannes Berg 
35199930380fSJohannes Berg 	int	(*set_bitrate_mask)(struct wiphy *wiphy,
35209930380fSJohannes Berg 				    struct net_device *dev,
35219930380fSJohannes Berg 				    const u8 *peer,
35229930380fSJohannes Berg 				    const struct cfg80211_bitrate_mask *mask);
35239930380fSJohannes Berg 
352461fa713cSHolger Schurig 	int	(*dump_survey)(struct wiphy *wiphy, struct net_device *netdev,
352561fa713cSHolger Schurig 			int idx, struct survey_info *info);
352661fa713cSHolger Schurig 
352767fbb16bSSamuel Ortiz 	int	(*set_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
352867fbb16bSSamuel Ortiz 			     struct cfg80211_pmksa *pmksa);
352967fbb16bSSamuel Ortiz 	int	(*del_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
353067fbb16bSSamuel Ortiz 			     struct cfg80211_pmksa *pmksa);
353167fbb16bSSamuel Ortiz 	int	(*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev);
353267fbb16bSSamuel Ortiz 
35339588bbd5SJouni Malinen 	int	(*remain_on_channel)(struct wiphy *wiphy,
353471bbc994SJohannes Berg 				     struct wireless_dev *wdev,
35359588bbd5SJouni Malinen 				     struct ieee80211_channel *chan,
35369588bbd5SJouni Malinen 				     unsigned int duration,
35379588bbd5SJouni Malinen 				     u64 *cookie);
35389588bbd5SJouni Malinen 	int	(*cancel_remain_on_channel)(struct wiphy *wiphy,
353971bbc994SJohannes Berg 					    struct wireless_dev *wdev,
35409588bbd5SJouni Malinen 					    u64 cookie);
35419588bbd5SJouni Malinen 
354271bbc994SJohannes Berg 	int	(*mgmt_tx)(struct wiphy *wiphy, struct wireless_dev *wdev,
3543b176e629SAndrei Otcheretianski 			   struct cfg80211_mgmt_tx_params *params,
3544b176e629SAndrei Otcheretianski 			   u64 *cookie);
3545f7ca38dfSJohannes Berg 	int	(*mgmt_tx_cancel_wait)(struct wiphy *wiphy,
354671bbc994SJohannes Berg 				       struct wireless_dev *wdev,
3547f7ca38dfSJohannes Berg 				       u64 cookie);
3548026331c4SJouni Malinen 
3549bc92afd9SJohannes Berg 	int	(*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev,
3550bc92afd9SJohannes Berg 				  bool enabled, int timeout);
3551d6dc1a38SJuuso Oikarinen 
3552d6dc1a38SJuuso Oikarinen 	int	(*set_cqm_rssi_config)(struct wiphy *wiphy,
3553d6dc1a38SJuuso Oikarinen 				       struct net_device *dev,
3554d6dc1a38SJuuso Oikarinen 				       s32 rssi_thold, u32 rssi_hyst);
3555271733cfSJohannes Berg 
35564a4b8169SAndrew Zaborowski 	int	(*set_cqm_rssi_range_config)(struct wiphy *wiphy,
35574a4b8169SAndrew Zaborowski 					     struct net_device *dev,
35584a4b8169SAndrew Zaborowski 					     s32 rssi_low, s32 rssi_high);
35594a4b8169SAndrew Zaborowski 
356084f10708SThomas Pedersen 	int	(*set_cqm_txe_config)(struct wiphy *wiphy,
356184f10708SThomas Pedersen 				      struct net_device *dev,
356284f10708SThomas Pedersen 				      u32 rate, u32 pkts, u32 intvl);
356384f10708SThomas Pedersen 
3564271733cfSJohannes Berg 	void	(*mgmt_frame_register)(struct wiphy *wiphy,
356571bbc994SJohannes Berg 				       struct wireless_dev *wdev,
3566271733cfSJohannes Berg 				       u16 frame_type, bool reg);
3567afe0cbf8SBruno Randolf 
3568afe0cbf8SBruno Randolf 	int	(*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant);
3569afe0cbf8SBruno Randolf 	int	(*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant);
35703677713bSJohn W. Linville 
3571807f8a8cSLuciano Coelho 	int	(*sched_scan_start)(struct wiphy *wiphy,
3572807f8a8cSLuciano Coelho 				struct net_device *dev,
3573807f8a8cSLuciano Coelho 				struct cfg80211_sched_scan_request *request);
35743a3ecf1dSArend Van Spriel 	int	(*sched_scan_stop)(struct wiphy *wiphy, struct net_device *dev,
35753a3ecf1dSArend Van Spriel 				   u64 reqid);
3576e5497d76SJohannes Berg 
3577e5497d76SJohannes Berg 	int	(*set_rekey_data)(struct wiphy *wiphy, struct net_device *dev,
3578e5497d76SJohannes Berg 				  struct cfg80211_gtk_rekey_data *data);
3579109086ceSArik Nemtsov 
3580109086ceSArik Nemtsov 	int	(*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev,
35813b3a0162SJohannes Berg 			     const u8 *peer, u8 action_code,  u8 dialog_token,
3582df942e7bSSunil Dutt Undekari 			     u16 status_code, u32 peer_capability,
358331fa97c5SArik Nemtsov 			     bool initiator, const u8 *buf, size_t len);
3584109086ceSArik Nemtsov 	int	(*tdls_oper)(struct wiphy *wiphy, struct net_device *dev,
35853b3a0162SJohannes Berg 			     const u8 *peer, enum nl80211_tdls_operation oper);
35867f6cf311SJohannes Berg 
35877f6cf311SJohannes Berg 	int	(*probe_client)(struct wiphy *wiphy, struct net_device *dev,
35887f6cf311SJohannes Berg 				const u8 *peer, u64 *cookie);
3589e999882aSJohannes Berg 
35901d9d9213SSimon Wunderlich 	int	(*set_noack_map)(struct wiphy *wiphy,
35911d9d9213SSimon Wunderlich 				  struct net_device *dev,
35921d9d9213SSimon Wunderlich 				  u16 noack_map);
35931d9d9213SSimon Wunderlich 
3594683b6d3bSJohannes Berg 	int	(*get_channel)(struct wiphy *wiphy,
35955b7ccaf3SJohannes Berg 			       struct wireless_dev *wdev,
3596683b6d3bSJohannes Berg 			       struct cfg80211_chan_def *chandef);
359798104fdeSJohannes Berg 
359898104fdeSJohannes Berg 	int	(*start_p2p_device)(struct wiphy *wiphy,
359998104fdeSJohannes Berg 				    struct wireless_dev *wdev);
360098104fdeSJohannes Berg 	void	(*stop_p2p_device)(struct wiphy *wiphy,
360198104fdeSJohannes Berg 				   struct wireless_dev *wdev);
360277765eafSVasanthakumar Thiagarajan 
360377765eafSVasanthakumar Thiagarajan 	int	(*set_mac_acl)(struct wiphy *wiphy, struct net_device *dev,
360477765eafSVasanthakumar Thiagarajan 			       const struct cfg80211_acl_data *params);
360504f39047SSimon Wunderlich 
360604f39047SSimon Wunderlich 	int	(*start_radar_detection)(struct wiphy *wiphy,
360704f39047SSimon Wunderlich 					 struct net_device *dev,
360831559f35SJanusz Dziedzic 					 struct cfg80211_chan_def *chandef,
360931559f35SJanusz Dziedzic 					 u32 cac_time_ms);
3610355199e0SJouni Malinen 	int	(*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev,
3611355199e0SJouni Malinen 				 struct cfg80211_update_ft_ies_params *ftie);
36125de17984SArend van Spriel 	int	(*crit_proto_start)(struct wiphy *wiphy,
36135de17984SArend van Spriel 				    struct wireless_dev *wdev,
36145de17984SArend van Spriel 				    enum nl80211_crit_proto_id protocol,
36155de17984SArend van Spriel 				    u16 duration);
36165de17984SArend van Spriel 	void	(*crit_proto_stop)(struct wiphy *wiphy,
36175de17984SArend van Spriel 				   struct wireless_dev *wdev);
3618be29b99aSAmitkumar Karwar 	int	(*set_coalesce)(struct wiphy *wiphy,
3619be29b99aSAmitkumar Karwar 				struct cfg80211_coalesce *coalesce);
362016ef1fe2SSimon Wunderlich 
362116ef1fe2SSimon Wunderlich 	int	(*channel_switch)(struct wiphy *wiphy,
362216ef1fe2SSimon Wunderlich 				  struct net_device *dev,
362316ef1fe2SSimon Wunderlich 				  struct cfg80211_csa_settings *params);
3624e16821bcSJouni Malinen 
3625fa9ffc74SKyeyoon Park 	int     (*set_qos_map)(struct wiphy *wiphy,
3626fa9ffc74SKyeyoon Park 			       struct net_device *dev,
3627fa9ffc74SKyeyoon Park 			       struct cfg80211_qos_map *qos_map);
3628e16821bcSJouni Malinen 
3629e16821bcSJouni Malinen 	int	(*set_ap_chanwidth)(struct wiphy *wiphy, struct net_device *dev,
3630e16821bcSJouni Malinen 				    struct cfg80211_chan_def *chandef);
3631960d01acSJohannes Berg 
3632960d01acSJohannes Berg 	int	(*add_tx_ts)(struct wiphy *wiphy, struct net_device *dev,
3633960d01acSJohannes Berg 			     u8 tsid, const u8 *peer, u8 user_prio,
3634960d01acSJohannes Berg 			     u16 admitted_time);
3635960d01acSJohannes Berg 	int	(*del_tx_ts)(struct wiphy *wiphy, struct net_device *dev,
3636960d01acSJohannes Berg 			     u8 tsid, const u8 *peer);
36371057d35eSArik Nemtsov 
36381057d35eSArik Nemtsov 	int	(*tdls_channel_switch)(struct wiphy *wiphy,
36391057d35eSArik Nemtsov 				       struct net_device *dev,
36401057d35eSArik Nemtsov 				       const u8 *addr, u8 oper_class,
36411057d35eSArik Nemtsov 				       struct cfg80211_chan_def *chandef);
36421057d35eSArik Nemtsov 	void	(*tdls_cancel_channel_switch)(struct wiphy *wiphy,
36431057d35eSArik Nemtsov 					      struct net_device *dev,
36441057d35eSArik Nemtsov 					      const u8 *addr);
3645cb3b7d87SAyala Beker 	int	(*start_nan)(struct wiphy *wiphy, struct wireless_dev *wdev,
3646cb3b7d87SAyala Beker 			     struct cfg80211_nan_conf *conf);
3647cb3b7d87SAyala Beker 	void	(*stop_nan)(struct wiphy *wiphy, struct wireless_dev *wdev);
3648a442b761SAyala Beker 	int	(*add_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev,
3649a442b761SAyala Beker 				struct cfg80211_nan_func *nan_func);
3650a442b761SAyala Beker 	void	(*del_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev,
3651a442b761SAyala Beker 			       u64 cookie);
3652a5a9dcf2SAyala Beker 	int	(*nan_change_conf)(struct wiphy *wiphy,
3653a5a9dcf2SAyala Beker 				   struct wireless_dev *wdev,
3654a5a9dcf2SAyala Beker 				   struct cfg80211_nan_conf *conf,
3655a5a9dcf2SAyala Beker 				   u32 changes);
3656ce0ce13aSMichael Braun 
3657ce0ce13aSMichael Braun 	int	(*set_multicast_to_unicast)(struct wiphy *wiphy,
3658ce0ce13aSMichael Braun 					    struct net_device *dev,
3659ce0ce13aSMichael Braun 					    const bool enabled);
36603a00df57SAvraham Stern 
366152539ca8SToke Høiland-Jørgensen 	int	(*get_txq_stats)(struct wiphy *wiphy,
366252539ca8SToke Høiland-Jørgensen 				 struct wireless_dev *wdev,
366352539ca8SToke Høiland-Jørgensen 				 struct cfg80211_txq_stats *txqstats);
366452539ca8SToke Høiland-Jørgensen 
36653a00df57SAvraham Stern 	int	(*set_pmk)(struct wiphy *wiphy, struct net_device *dev,
36663a00df57SAvraham Stern 			   const struct cfg80211_pmk_conf *conf);
36673a00df57SAvraham Stern 	int	(*del_pmk)(struct wiphy *wiphy, struct net_device *dev,
36683a00df57SAvraham Stern 			   const u8 *aa);
366940cbfa90SSrinivas Dasari 	int     (*external_auth)(struct wiphy *wiphy, struct net_device *dev,
367040cbfa90SSrinivas Dasari 				 struct cfg80211_external_auth_params *params);
36712576a9acSDenis Kenzior 
36722576a9acSDenis Kenzior 	int	(*tx_control_port)(struct wiphy *wiphy,
36732576a9acSDenis Kenzior 				   struct net_device *dev,
36742576a9acSDenis Kenzior 				   const u8 *buf, size_t len,
36752576a9acSDenis Kenzior 				   const u8 *dest, const __be16 proto,
36762576a9acSDenis Kenzior 				   const bool noencrypt);
367781e54d08SPradeep Kumar Chitrapu 
367881e54d08SPradeep Kumar Chitrapu 	int	(*get_ftm_responder_stats)(struct wiphy *wiphy,
367981e54d08SPradeep Kumar Chitrapu 				struct net_device *dev,
368081e54d08SPradeep Kumar Chitrapu 				struct cfg80211_ftm_responder_stats *ftm_stats);
3681*9bb7e0f2SJohannes Berg 
3682*9bb7e0f2SJohannes Berg 	int	(*start_pmsr)(struct wiphy *wiphy, struct wireless_dev *wdev,
3683*9bb7e0f2SJohannes Berg 			      struct cfg80211_pmsr_request *request);
3684*9bb7e0f2SJohannes Berg 	void	(*abort_pmsr)(struct wiphy *wiphy, struct wireless_dev *wdev,
3685*9bb7e0f2SJohannes Berg 			      struct cfg80211_pmsr_request *request);
3686704232c2SJohannes Berg };
3687704232c2SJohannes Berg 
3688d3236553SJohannes Berg /*
3689d3236553SJohannes Berg  * wireless hardware and networking interfaces structures
3690d3236553SJohannes Berg  * and registration/helper functions
3691d3236553SJohannes Berg  */
3692d3236553SJohannes Berg 
3693d3236553SJohannes Berg /**
36945be83de5SJohannes Berg  * enum wiphy_flags - wiphy capability flags
36955be83de5SJohannes Berg  *
36965be83de5SJohannes Berg  * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this
36975be83de5SJohannes Berg  *	wiphy at all
36985be83de5SJohannes Berg  * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled
36995be83de5SJohannes Berg  *	by default -- this flag will be set depending on the kernel's default
37005be83de5SJohannes Berg  *	on wiphy_new(), but can be changed by the driver if it has a good
37015be83de5SJohannes Berg  *	reason to override the default
37029bc383deSJohannes Berg  * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station
37039bc383deSJohannes Berg  *	on a VLAN interface)
37049bc383deSJohannes Berg  * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station
3705c0692b8fSJohannes Berg  * @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the
3706c0692b8fSJohannes Berg  *	control port protocol ethertype. The device also honours the
3707c0692b8fSJohannes Berg  *	control_port_no_encrypt flag.
3708e31b8213SJohannes Berg  * @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN.
370915d5dda6SJavier Cardona  * @WIPHY_FLAG_MESH_AUTH: The device supports mesh authentication by routing
371015d5dda6SJavier Cardona  *	auth frames to userspace. See @NL80211_MESH_SETUP_USERSPACE_AUTH.
3711f4b34b55SVivek Natarajan  * @WIPHY_FLAG_SUPPORTS_FW_ROAM: The device supports roaming feature in the
3712f4b34b55SVivek Natarajan  *	firmware.
3713cedb5412SEliad Peller  * @WIPHY_FLAG_AP_UAPSD: The device supports uapsd on AP.
3714109086ceSArik Nemtsov  * @WIPHY_FLAG_SUPPORTS_TDLS: The device supports TDLS (802.11z) operation.
3715109086ceSArik Nemtsov  * @WIPHY_FLAG_TDLS_EXTERNAL_SETUP: The device does not handle TDLS (802.11z)
3716109086ceSArik Nemtsov  *	link setup/discovery operations internally. Setup, discovery and
3717109086ceSArik Nemtsov  *	teardown packets should be sent through the @NL80211_CMD_TDLS_MGMT
3718109086ceSArik Nemtsov  *	command. When this flag is not set, @NL80211_CMD_TDLS_OPER should be
3719109086ceSArik Nemtsov  *	used for asking the driver/firmware to perform a TDLS operation.
3720562a7480SJohannes Berg  * @WIPHY_FLAG_HAVE_AP_SME: device integrates AP SME
37215e760230SJohannes Berg  * @WIPHY_FLAG_REPORTS_OBSS: the device will report beacons from other BSSes
37225e760230SJohannes Berg  *	when there are virtual interfaces in AP mode by calling
37235e760230SJohannes Berg  *	cfg80211_report_obss_beacon().
372487bbbe22SArik Nemtsov  * @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD: When operating as an AP, the device
372587bbbe22SArik Nemtsov  *	responds to probe-requests in hardware.
37267c4ef712SJohannes Berg  * @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX.
37277c4ef712SJohannes Berg  * @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call.
37282f301ab2SSimon Wunderlich  * @WIPHY_FLAG_SUPPORTS_5_10_MHZ: Device supports 5 MHz and 10 MHz channels.
372916ef1fe2SSimon Wunderlich  * @WIPHY_FLAG_HAS_CHANNEL_SWITCH: Device supports channel switch in
373016ef1fe2SSimon Wunderlich  *	beaconing mode (AP, IBSS, Mesh, ...).
3731b8676221SDavid Spinadel  * @WIPHY_FLAG_HAS_STATIC_WEP: The device supports static WEP key installation
3732b8676221SDavid Spinadel  *	before connection.
37335be83de5SJohannes Berg  */
37345be83de5SJohannes Berg enum wiphy_flags {
3735723e73acSJohannes Berg 	/* use hole at 0 */
3736a2f73b6cSLuis R. Rodriguez 	/* use hole at 1 */
3737a2f73b6cSLuis R. Rodriguez 	/* use hole at 2 */
37385be83de5SJohannes Berg 	WIPHY_FLAG_NETNS_OK			= BIT(3),
37395be83de5SJohannes Berg 	WIPHY_FLAG_PS_ON_BY_DEFAULT		= BIT(4),
37409bc383deSJohannes Berg 	WIPHY_FLAG_4ADDR_AP			= BIT(5),
37419bc383deSJohannes Berg 	WIPHY_FLAG_4ADDR_STATION		= BIT(6),
3742c0692b8fSJohannes Berg 	WIPHY_FLAG_CONTROL_PORT_PROTOCOL	= BIT(7),
3743309075cfSJussi Kivilinna 	WIPHY_FLAG_IBSS_RSN			= BIT(8),
374415d5dda6SJavier Cardona 	WIPHY_FLAG_MESH_AUTH			= BIT(10),
3745ca986ad9SArend Van Spriel 	/* use hole at 11 */
37468e8b41f9SJohannes Berg 	/* use hole at 12 */
3747f4b34b55SVivek Natarajan 	WIPHY_FLAG_SUPPORTS_FW_ROAM		= BIT(13),
3748cedb5412SEliad Peller 	WIPHY_FLAG_AP_UAPSD			= BIT(14),
3749109086ceSArik Nemtsov 	WIPHY_FLAG_SUPPORTS_TDLS		= BIT(15),
3750109086ceSArik Nemtsov 	WIPHY_FLAG_TDLS_EXTERNAL_SETUP		= BIT(16),
3751562a7480SJohannes Berg 	WIPHY_FLAG_HAVE_AP_SME			= BIT(17),
37525e760230SJohannes Berg 	WIPHY_FLAG_REPORTS_OBSS			= BIT(18),
375387bbbe22SArik Nemtsov 	WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD	= BIT(19),
37547c4ef712SJohannes Berg 	WIPHY_FLAG_OFFCHAN_TX			= BIT(20),
37557c4ef712SJohannes Berg 	WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL	= BIT(21),
37562f301ab2SSimon Wunderlich 	WIPHY_FLAG_SUPPORTS_5_10_MHZ		= BIT(22),
375716ef1fe2SSimon Wunderlich 	WIPHY_FLAG_HAS_CHANNEL_SWITCH		= BIT(23),
3758b8676221SDavid Spinadel 	WIPHY_FLAG_HAS_STATIC_WEP		= BIT(24),
37597527a782SJohannes Berg };
37607527a782SJohannes Berg 
37617527a782SJohannes Berg /**
37627527a782SJohannes Berg  * struct ieee80211_iface_limit - limit on certain interface types
37637527a782SJohannes Berg  * @max: maximum number of interfaces of these types
37647527a782SJohannes Berg  * @types: interface types (bits)
37657527a782SJohannes Berg  */
37667527a782SJohannes Berg struct ieee80211_iface_limit {
37677527a782SJohannes Berg 	u16 max;
37687527a782SJohannes Berg 	u16 types;
37697527a782SJohannes Berg };
37707527a782SJohannes Berg 
37717527a782SJohannes Berg /**
37727527a782SJohannes Berg  * struct ieee80211_iface_combination - possible interface combination
37737527a782SJohannes Berg  *
3774b80edbc1SLuciano Coelho  * With this structure the driver can describe which interface
3775b80edbc1SLuciano Coelho  * combinations it supports concurrently.
37767527a782SJohannes Berg  *
3777b80edbc1SLuciano Coelho  * Examples:
3778b80edbc1SLuciano Coelho  *
3779b80edbc1SLuciano Coelho  * 1. Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total:
37807527a782SJohannes Berg  *
3781819bf593SJohannes Berg  *    .. code-block:: c
3782819bf593SJohannes Berg  *
37837527a782SJohannes Berg  *	struct ieee80211_iface_limit limits1[] = {
37847527a782SJohannes Berg  *		{ .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
37857527a782SJohannes Berg  *		{ .max = 1, .types = BIT(NL80211_IFTYPE_AP}, },
37867527a782SJohannes Berg  *	};
37877527a782SJohannes Berg  *	struct ieee80211_iface_combination combination1 = {
37887527a782SJohannes Berg  *		.limits = limits1,
37897527a782SJohannes Berg  *		.n_limits = ARRAY_SIZE(limits1),
37907527a782SJohannes Berg  *		.max_interfaces = 2,
37917527a782SJohannes Berg  *		.beacon_int_infra_match = true,
37927527a782SJohannes Berg  *	};
37937527a782SJohannes Berg  *
37947527a782SJohannes Berg  *
3795b80edbc1SLuciano Coelho  * 2. Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total:
37967527a782SJohannes Berg  *
3797819bf593SJohannes Berg  *    .. code-block:: c
3798819bf593SJohannes Berg  *
37997527a782SJohannes Berg  *	struct ieee80211_iface_limit limits2[] = {
38007527a782SJohannes Berg  *		{ .max = 8, .types = BIT(NL80211_IFTYPE_AP) |
38017527a782SJohannes Berg  *				     BIT(NL80211_IFTYPE_P2P_GO), },
38027527a782SJohannes Berg  *	};
38037527a782SJohannes Berg  *	struct ieee80211_iface_combination combination2 = {
38047527a782SJohannes Berg  *		.limits = limits2,
38057527a782SJohannes Berg  *		.n_limits = ARRAY_SIZE(limits2),
38067527a782SJohannes Berg  *		.max_interfaces = 8,
38077527a782SJohannes Berg  *		.num_different_channels = 1,
38087527a782SJohannes Berg  *	};
38097527a782SJohannes Berg  *
38107527a782SJohannes Berg  *
3811b80edbc1SLuciano Coelho  * 3. Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total.
3812b80edbc1SLuciano Coelho  *
38137527a782SJohannes Berg  *    This allows for an infrastructure connection and three P2P connections.
38147527a782SJohannes Berg  *
3815819bf593SJohannes Berg  *    .. code-block:: c
3816819bf593SJohannes Berg  *
38177527a782SJohannes Berg  *	struct ieee80211_iface_limit limits3[] = {
38187527a782SJohannes Berg  *		{ .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
38197527a782SJohannes Berg  *		{ .max = 3, .types = BIT(NL80211_IFTYPE_P2P_GO) |
38207527a782SJohannes Berg  *				     BIT(NL80211_IFTYPE_P2P_CLIENT), },
38217527a782SJohannes Berg  *	};
38227527a782SJohannes Berg  *	struct ieee80211_iface_combination combination3 = {
38237527a782SJohannes Berg  *		.limits = limits3,
38247527a782SJohannes Berg  *		.n_limits = ARRAY_SIZE(limits3),
38257527a782SJohannes Berg  *		.max_interfaces = 4,
38267527a782SJohannes Berg  *		.num_different_channels = 2,
38277527a782SJohannes Berg  *	};
3828819bf593SJohannes Berg  *
38297527a782SJohannes Berg  */
38307527a782SJohannes Berg struct ieee80211_iface_combination {
3831c6c94aeaSJohannes Berg 	/**
3832c6c94aeaSJohannes Berg 	 * @limits:
3833c6c94aeaSJohannes Berg 	 * limits for the given interface types
3834c6c94aeaSJohannes Berg 	 */
38357527a782SJohannes Berg 	const struct ieee80211_iface_limit *limits;
3836c6c94aeaSJohannes Berg 
3837c6c94aeaSJohannes Berg 	/**
3838c6c94aeaSJohannes Berg 	 * @num_different_channels:
3839c6c94aeaSJohannes Berg 	 * can use up to this many different channels
3840c6c94aeaSJohannes Berg 	 */
38417527a782SJohannes Berg 	u32 num_different_channels;
3842c6c94aeaSJohannes Berg 
3843c6c94aeaSJohannes Berg 	/**
3844c6c94aeaSJohannes Berg 	 * @max_interfaces:
3845c6c94aeaSJohannes Berg 	 * maximum number of interfaces in total allowed in this group
3846c6c94aeaSJohannes Berg 	 */
38477527a782SJohannes Berg 	u16 max_interfaces;
3848c6c94aeaSJohannes Berg 
3849c6c94aeaSJohannes Berg 	/**
3850c6c94aeaSJohannes Berg 	 * @n_limits:
3851c6c94aeaSJohannes Berg 	 * number of limitations
3852c6c94aeaSJohannes Berg 	 */
38537527a782SJohannes Berg 	u8 n_limits;
3854c6c94aeaSJohannes Berg 
3855c6c94aeaSJohannes Berg 	/**
3856c6c94aeaSJohannes Berg 	 * @beacon_int_infra_match:
3857c6c94aeaSJohannes Berg 	 * In this combination, the beacon intervals between infrastructure
3858c6c94aeaSJohannes Berg 	 * and AP types must match. This is required only in special cases.
3859c6c94aeaSJohannes Berg 	 */
38607527a782SJohannes Berg 	bool beacon_int_infra_match;
3861c6c94aeaSJohannes Berg 
3862c6c94aeaSJohannes Berg 	/**
3863c6c94aeaSJohannes Berg 	 * @radar_detect_widths:
3864c6c94aeaSJohannes Berg 	 * bitmap of channel widths supported for radar detection
3865c6c94aeaSJohannes Berg 	 */
386611c4a075SSimon Wunderlich 	u8 radar_detect_widths;
3867c6c94aeaSJohannes Berg 
3868c6c94aeaSJohannes Berg 	/**
3869c6c94aeaSJohannes Berg 	 * @radar_detect_regions:
3870c6c94aeaSJohannes Berg 	 * bitmap of regions supported for radar detection
3871c6c94aeaSJohannes Berg 	 */
38728c48b50aSFelix Fietkau 	u8 radar_detect_regions;
3873c6c94aeaSJohannes Berg 
3874c6c94aeaSJohannes Berg 	/**
3875c6c94aeaSJohannes Berg 	 * @beacon_int_min_gcd:
3876c6c94aeaSJohannes Berg 	 * This interface combination supports different beacon intervals.
3877c6c94aeaSJohannes Berg 	 *
3878c6c94aeaSJohannes Berg 	 * = 0
3879c6c94aeaSJohannes Berg 	 *   all beacon intervals for different interface must be same.
3880c6c94aeaSJohannes Berg 	 * > 0
3881c6c94aeaSJohannes Berg 	 *   any beacon interval for the interface part of this combination AND
3882c6c94aeaSJohannes Berg 	 *   GCD of all beacon intervals from beaconing interfaces of this
3883c6c94aeaSJohannes Berg 	 *   combination must be greater or equal to this value.
3884c6c94aeaSJohannes Berg 	 */
38850c317a02SPurushottam Kushwaha 	u32 beacon_int_min_gcd;
38865be83de5SJohannes Berg };
38875be83de5SJohannes Berg 
38882e161f78SJohannes Berg struct ieee80211_txrx_stypes {
38892e161f78SJohannes Berg 	u16 tx, rx;
38902e161f78SJohannes Berg };
38912e161f78SJohannes Berg 
38925be83de5SJohannes Berg /**
3893ff1b6e69SJohannes Berg  * enum wiphy_wowlan_support_flags - WoWLAN support flags
3894ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_ANY: supports wakeup for the special "any"
3895ff1b6e69SJohannes Berg  *	trigger that keeps the device operating as-is and
3896ff1b6e69SJohannes Berg  *	wakes up the host on any activity, for example a
3897ff1b6e69SJohannes Berg  *	received packet that passed filtering; note that the
3898ff1b6e69SJohannes Berg  *	packet should be preserved in that case
3899ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_MAGIC_PKT: supports wakeup on magic packet
3900ff1b6e69SJohannes Berg  *	(see nl80211.h)
3901ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_DISCONNECT: supports wakeup on disconnect
390277dbbb13SJohannes Berg  * @WIPHY_WOWLAN_SUPPORTS_GTK_REKEY: supports GTK rekeying while asleep
390377dbbb13SJohannes Berg  * @WIPHY_WOWLAN_GTK_REKEY_FAILURE: supports wakeup on GTK rekey failure
390477dbbb13SJohannes Berg  * @WIPHY_WOWLAN_EAP_IDENTITY_REQ: supports wakeup on EAP identity request
390577dbbb13SJohannes Berg  * @WIPHY_WOWLAN_4WAY_HANDSHAKE: supports wakeup on 4-way handshake failure
390677dbbb13SJohannes Berg  * @WIPHY_WOWLAN_RFKILL_RELEASE: supports wakeup on RF-kill release
39078cd4d456SLuciano Coelho  * @WIPHY_WOWLAN_NET_DETECT: supports wakeup on network detection
3908ff1b6e69SJohannes Berg  */
3909ff1b6e69SJohannes Berg enum wiphy_wowlan_support_flags {
3910ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_ANY		= BIT(0),
3911ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_MAGIC_PKT		= BIT(1),
3912ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_DISCONNECT		= BIT(2),
391377dbbb13SJohannes Berg 	WIPHY_WOWLAN_SUPPORTS_GTK_REKEY	= BIT(3),
391477dbbb13SJohannes Berg 	WIPHY_WOWLAN_GTK_REKEY_FAILURE	= BIT(4),
391577dbbb13SJohannes Berg 	WIPHY_WOWLAN_EAP_IDENTITY_REQ	= BIT(5),
391677dbbb13SJohannes Berg 	WIPHY_WOWLAN_4WAY_HANDSHAKE	= BIT(6),
391777dbbb13SJohannes Berg 	WIPHY_WOWLAN_RFKILL_RELEASE	= BIT(7),
39188cd4d456SLuciano Coelho 	WIPHY_WOWLAN_NET_DETECT		= BIT(8),
3919ff1b6e69SJohannes Berg };
3920ff1b6e69SJohannes Berg 
39212a0e047eSJohannes Berg struct wiphy_wowlan_tcp_support {
39222a0e047eSJohannes Berg 	const struct nl80211_wowlan_tcp_data_token_feature *tok;
39232a0e047eSJohannes Berg 	u32 data_payload_max;
39242a0e047eSJohannes Berg 	u32 data_interval_max;
39252a0e047eSJohannes Berg 	u32 wake_payload_max;
39262a0e047eSJohannes Berg 	bool seq;
39272a0e047eSJohannes Berg };
39282a0e047eSJohannes Berg 
3929ff1b6e69SJohannes Berg /**
3930ff1b6e69SJohannes Berg  * struct wiphy_wowlan_support - WoWLAN support data
3931ff1b6e69SJohannes Berg  * @flags: see &enum wiphy_wowlan_support_flags
3932ff1b6e69SJohannes Berg  * @n_patterns: number of supported wakeup patterns
3933ff1b6e69SJohannes Berg  *	(see nl80211.h for the pattern definition)
3934ff1b6e69SJohannes Berg  * @pattern_max_len: maximum length of each pattern
3935ff1b6e69SJohannes Berg  * @pattern_min_len: minimum length of each pattern
3936bb92d199SAmitkumar Karwar  * @max_pkt_offset: maximum Rx packet offset
39378cd4d456SLuciano Coelho  * @max_nd_match_sets: maximum number of matchsets for net-detect,
39388cd4d456SLuciano Coelho  *	similar, but not necessarily identical, to max_match_sets for
39398cd4d456SLuciano Coelho  *	scheduled scans.
39408cd4d456SLuciano Coelho  *	See &struct cfg80211_sched_scan_request.@match_sets for more
39418cd4d456SLuciano Coelho  *	details.
39422a0e047eSJohannes Berg  * @tcp: TCP wakeup support information
3943ff1b6e69SJohannes Berg  */
3944ff1b6e69SJohannes Berg struct wiphy_wowlan_support {
3945ff1b6e69SJohannes Berg 	u32 flags;
3946ff1b6e69SJohannes Berg 	int n_patterns;
3947ff1b6e69SJohannes Berg 	int pattern_max_len;
3948ff1b6e69SJohannes Berg 	int pattern_min_len;
3949bb92d199SAmitkumar Karwar 	int max_pkt_offset;
39508cd4d456SLuciano Coelho 	int max_nd_match_sets;
39512a0e047eSJohannes Berg 	const struct wiphy_wowlan_tcp_support *tcp;
3952ff1b6e69SJohannes Berg };
3953ff1b6e69SJohannes Berg 
3954ff1b6e69SJohannes Berg /**
3955be29b99aSAmitkumar Karwar  * struct wiphy_coalesce_support - coalesce support data
3956be29b99aSAmitkumar Karwar  * @n_rules: maximum number of coalesce rules
3957be29b99aSAmitkumar Karwar  * @max_delay: maximum supported coalescing delay in msecs
3958be29b99aSAmitkumar Karwar  * @n_patterns: number of supported patterns in a rule
3959be29b99aSAmitkumar Karwar  *	(see nl80211.h for the pattern definition)
3960be29b99aSAmitkumar Karwar  * @pattern_max_len: maximum length of each pattern
3961be29b99aSAmitkumar Karwar  * @pattern_min_len: minimum length of each pattern
3962be29b99aSAmitkumar Karwar  * @max_pkt_offset: maximum Rx packet offset
3963be29b99aSAmitkumar Karwar  */
3964be29b99aSAmitkumar Karwar struct wiphy_coalesce_support {
3965be29b99aSAmitkumar Karwar 	int n_rules;
3966be29b99aSAmitkumar Karwar 	int max_delay;
3967be29b99aSAmitkumar Karwar 	int n_patterns;
3968be29b99aSAmitkumar Karwar 	int pattern_max_len;
3969be29b99aSAmitkumar Karwar 	int pattern_min_len;
3970be29b99aSAmitkumar Karwar 	int max_pkt_offset;
3971be29b99aSAmitkumar Karwar };
3972be29b99aSAmitkumar Karwar 
3973be29b99aSAmitkumar Karwar /**
3974ad7e718cSJohannes Berg  * enum wiphy_vendor_command_flags - validation flags for vendor commands
3975ad7e718cSJohannes Berg  * @WIPHY_VENDOR_CMD_NEED_WDEV: vendor command requires wdev
3976ad7e718cSJohannes Berg  * @WIPHY_VENDOR_CMD_NEED_NETDEV: vendor command requires netdev
3977ad7e718cSJohannes Berg  * @WIPHY_VENDOR_CMD_NEED_RUNNING: interface/wdev must be up & running
3978ad7e718cSJohannes Berg  *	(must be combined with %_WDEV or %_NETDEV)
3979ad7e718cSJohannes Berg  */
3980ad7e718cSJohannes Berg enum wiphy_vendor_command_flags {
3981ad7e718cSJohannes Berg 	WIPHY_VENDOR_CMD_NEED_WDEV = BIT(0),
3982ad7e718cSJohannes Berg 	WIPHY_VENDOR_CMD_NEED_NETDEV = BIT(1),
3983ad7e718cSJohannes Berg 	WIPHY_VENDOR_CMD_NEED_RUNNING = BIT(2),
3984ad7e718cSJohannes Berg };
3985ad7e718cSJohannes Berg 
3986ad7e718cSJohannes Berg /**
3987466b9936Stamizhr@codeaurora.org  * enum wiphy_opmode_flag - Station's ht/vht operation mode information flags
3988466b9936Stamizhr@codeaurora.org  *
3989466b9936Stamizhr@codeaurora.org  * @STA_OPMODE_MAX_BW_CHANGED: Max Bandwidth changed
3990466b9936Stamizhr@codeaurora.org  * @STA_OPMODE_SMPS_MODE_CHANGED: SMPS mode changed
3991466b9936Stamizhr@codeaurora.org  * @STA_OPMODE_N_SS_CHANGED: max N_SS (number of spatial streams) changed
3992466b9936Stamizhr@codeaurora.org  *
3993466b9936Stamizhr@codeaurora.org  */
3994466b9936Stamizhr@codeaurora.org enum wiphy_opmode_flag {
3995466b9936Stamizhr@codeaurora.org 	STA_OPMODE_MAX_BW_CHANGED	= BIT(0),
3996466b9936Stamizhr@codeaurora.org 	STA_OPMODE_SMPS_MODE_CHANGED	= BIT(1),
3997466b9936Stamizhr@codeaurora.org 	STA_OPMODE_N_SS_CHANGED		= BIT(2),
3998466b9936Stamizhr@codeaurora.org };
3999466b9936Stamizhr@codeaurora.org 
4000466b9936Stamizhr@codeaurora.org /**
4001466b9936Stamizhr@codeaurora.org  * struct sta_opmode_info - Station's ht/vht operation mode information
4002466b9936Stamizhr@codeaurora.org  * @changed: contains value from &enum wiphy_opmode_flag
40035e78abd0Stamizhr@codeaurora.org  * @smps_mode: New SMPS mode value from &enum nl80211_smps_mode of a station
40045e78abd0Stamizhr@codeaurora.org  * @bw: new max bandwidth value from &enum nl80211_chan_width of a station
4005466b9936Stamizhr@codeaurora.org  * @rx_nss: new rx_nss value of a station
4006466b9936Stamizhr@codeaurora.org  */
4007466b9936Stamizhr@codeaurora.org 
4008466b9936Stamizhr@codeaurora.org struct sta_opmode_info {
4009466b9936Stamizhr@codeaurora.org 	u32 changed;
40105e78abd0Stamizhr@codeaurora.org 	enum nl80211_smps_mode smps_mode;
40115e78abd0Stamizhr@codeaurora.org 	enum nl80211_chan_width bw;
4012466b9936Stamizhr@codeaurora.org 	u8 rx_nss;
4013466b9936Stamizhr@codeaurora.org };
4014466b9936Stamizhr@codeaurora.org 
4015466b9936Stamizhr@codeaurora.org /**
4016ad7e718cSJohannes Berg  * struct wiphy_vendor_command - vendor command definition
4017ad7e718cSJohannes Berg  * @info: vendor command identifying information, as used in nl80211
4018ad7e718cSJohannes Berg  * @flags: flags, see &enum wiphy_vendor_command_flags
4019ad7e718cSJohannes Berg  * @doit: callback for the operation, note that wdev is %NULL if the
4020ad7e718cSJohannes Berg  *	flags didn't ask for a wdev and non-%NULL otherwise; the data
4021ad7e718cSJohannes Berg  *	pointer may be %NULL if userspace provided no data at all
40227bdbe400SJohannes Berg  * @dumpit: dump callback, for transferring bigger/multiple items. The
40237bdbe400SJohannes Berg  *	@storage points to cb->args[5], ie. is preserved over the multiple
40247bdbe400SJohannes Berg  *	dumpit calls.
40257bdbe400SJohannes Berg  * It's recommended to not have the same sub command with both @doit and
40267bdbe400SJohannes Berg  * @dumpit, so that userspace can assume certain ones are get and others
40277bdbe400SJohannes Berg  * are used with dump requests.
4028ad7e718cSJohannes Berg  */
4029ad7e718cSJohannes Berg struct wiphy_vendor_command {
4030ad7e718cSJohannes Berg 	struct nl80211_vendor_cmd_info info;
4031ad7e718cSJohannes Berg 	u32 flags;
4032ad7e718cSJohannes Berg 	int (*doit)(struct wiphy *wiphy, struct wireless_dev *wdev,
4033ad7e718cSJohannes Berg 		    const void *data, int data_len);
40347bdbe400SJohannes Berg 	int (*dumpit)(struct wiphy *wiphy, struct wireless_dev *wdev,
40357bdbe400SJohannes Berg 		      struct sk_buff *skb, const void *data, int data_len,
40367bdbe400SJohannes Berg 		      unsigned long *storage);
4037ad7e718cSJohannes Berg };
4038ad7e718cSJohannes Berg 
4039ad7e718cSJohannes Berg /**
4040019ae3a9SKanchanapally, Vidyullatha  * struct wiphy_iftype_ext_capab - extended capabilities per interface type
4041019ae3a9SKanchanapally, Vidyullatha  * @iftype: interface type
4042019ae3a9SKanchanapally, Vidyullatha  * @extended_capabilities: extended capabilities supported by the driver,
4043019ae3a9SKanchanapally, Vidyullatha  *	additional capabilities might be supported by userspace; these are the
4044019ae3a9SKanchanapally, Vidyullatha  *	802.11 extended capabilities ("Extended Capabilities element") and are
4045019ae3a9SKanchanapally, Vidyullatha  *	in the same format as in the information element. See IEEE Std
4046019ae3a9SKanchanapally, Vidyullatha  *	802.11-2012 8.4.2.29 for the defined fields.
4047019ae3a9SKanchanapally, Vidyullatha  * @extended_capabilities_mask: mask of the valid values
4048019ae3a9SKanchanapally, Vidyullatha  * @extended_capabilities_len: length of the extended capabilities
4049019ae3a9SKanchanapally, Vidyullatha  */
4050019ae3a9SKanchanapally, Vidyullatha struct wiphy_iftype_ext_capab {
4051019ae3a9SKanchanapally, Vidyullatha 	enum nl80211_iftype iftype;
4052019ae3a9SKanchanapally, Vidyullatha 	const u8 *extended_capabilities;
4053019ae3a9SKanchanapally, Vidyullatha 	const u8 *extended_capabilities_mask;
4054019ae3a9SKanchanapally, Vidyullatha 	u8 extended_capabilities_len;
4055019ae3a9SKanchanapally, Vidyullatha };
4056019ae3a9SKanchanapally, Vidyullatha 
4057019ae3a9SKanchanapally, Vidyullatha /**
4058*9bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_capabilities - cfg80211 peer measurement capabilities
4059*9bb7e0f2SJohannes Berg  * @max_peers: maximum number of peers in a single measurement
4060*9bb7e0f2SJohannes Berg  * @report_ap_tsf: can report assoc AP's TSF for radio resource measurement
4061*9bb7e0f2SJohannes Berg  * @randomize_mac_addr: can randomize MAC address for measurement
4062*9bb7e0f2SJohannes Berg  * @ftm.supported: FTM measurement is supported
4063*9bb7e0f2SJohannes Berg  * @ftm.asap: ASAP-mode is supported
4064*9bb7e0f2SJohannes Berg  * @ftm.non_asap: non-ASAP-mode is supported
4065*9bb7e0f2SJohannes Berg  * @ftm.request_lci: can request LCI data
4066*9bb7e0f2SJohannes Berg  * @ftm.request_civicloc: can request civic location data
4067*9bb7e0f2SJohannes Berg  * @ftm.preambles: bitmap of preambles supported (&enum nl80211_preamble)
4068*9bb7e0f2SJohannes Berg  * @ftm.bandwidths: bitmap of bandwidths supported (&enum nl80211_chan_width)
4069*9bb7e0f2SJohannes Berg  * @ftm.max_bursts_exponent: maximum burst exponent supported
4070*9bb7e0f2SJohannes Berg  *	(set to -1 if not limited; note that setting this will necessarily
4071*9bb7e0f2SJohannes Berg  *	forbid using the value 15 to let the responder pick)
4072*9bb7e0f2SJohannes Berg  * @ftm.max_ftms_per_burst: maximum FTMs per burst supported (set to 0 if
4073*9bb7e0f2SJohannes Berg  *	not limited)
4074*9bb7e0f2SJohannes Berg  */
4075*9bb7e0f2SJohannes Berg struct cfg80211_pmsr_capabilities {
4076*9bb7e0f2SJohannes Berg 	unsigned int max_peers;
4077*9bb7e0f2SJohannes Berg 	u8 report_ap_tsf:1,
4078*9bb7e0f2SJohannes Berg 	   randomize_mac_addr:1;
4079*9bb7e0f2SJohannes Berg 
4080*9bb7e0f2SJohannes Berg 	struct {
4081*9bb7e0f2SJohannes Berg 		u32 preambles;
4082*9bb7e0f2SJohannes Berg 		u32 bandwidths;
4083*9bb7e0f2SJohannes Berg 		s8 max_bursts_exponent;
4084*9bb7e0f2SJohannes Berg 		u8 max_ftms_per_burst;
4085*9bb7e0f2SJohannes Berg 		u8 supported:1,
4086*9bb7e0f2SJohannes Berg 		   asap:1,
4087*9bb7e0f2SJohannes Berg 		   non_asap:1,
4088*9bb7e0f2SJohannes Berg 		   request_lci:1,
4089*9bb7e0f2SJohannes Berg 		   request_civicloc:1;
4090*9bb7e0f2SJohannes Berg 	} ftm;
4091*9bb7e0f2SJohannes Berg };
4092*9bb7e0f2SJohannes Berg 
4093*9bb7e0f2SJohannes Berg /**
40945be83de5SJohannes Berg  * struct wiphy - wireless hardware description
40952784fe91SLuis R. Rodriguez  * @reg_notifier: the driver's regulatory notification callback,
40962784fe91SLuis R. Rodriguez  *	note that if your driver uses wiphy_apply_custom_regulatory()
40972784fe91SLuis R. Rodriguez  *	the reg_notifier's request can be passed as NULL
4098d3236553SJohannes Berg  * @regd: the driver's regulatory domain, if one was requested via
4099d3236553SJohannes Berg  * 	the regulatory_hint() API. This can be used by the driver
4100d3236553SJohannes Berg  *	on the reg_notifier() if it chooses to ignore future
4101d3236553SJohannes Berg  *	regulatory domain changes caused by other drivers.
4102d3236553SJohannes Berg  * @signal_type: signal type reported in &struct cfg80211_bss.
4103d3236553SJohannes Berg  * @cipher_suites: supported cipher suites
4104d3236553SJohannes Berg  * @n_cipher_suites: number of supported cipher suites
4105b9a5f8caSJouni Malinen  * @retry_short: Retry limit for short frames (dot11ShortRetryLimit)
4106b9a5f8caSJouni Malinen  * @retry_long: Retry limit for long frames (dot11LongRetryLimit)
4107b9a5f8caSJouni Malinen  * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold);
4108b9a5f8caSJouni Malinen  *	-1 = fragmentation disabled, only odd values >= 256 used
4109b9a5f8caSJouni Malinen  * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled
4110abe37c4bSJohannes Berg  * @_net: the network namespace this wiphy currently lives in
4111ef15aac6SJohannes Berg  * @perm_addr: permanent MAC address of this device
4112ef15aac6SJohannes Berg  * @addr_mask: If the device supports multiple MAC addresses by masking,
4113ef15aac6SJohannes Berg  *	set this to a mask with variable bits set to 1, e.g. if the last
41140fcf8ac5SLuciano Coelho  *	four bits are variable then set it to 00-00-00-00-00-0f. The actual
4115ef15aac6SJohannes Berg  *	variable bits shall be determined by the interfaces added, with
4116ef15aac6SJohannes Berg  *	interfaces not matching the mask being rejected to be brought up.
4117ef15aac6SJohannes Berg  * @n_addresses: number of addresses in @addresses.
4118ef15aac6SJohannes Berg  * @addresses: If the device has more than one address, set this pointer
4119ef15aac6SJohannes Berg  *	to a list of addresses (6 bytes each). The first one will be used
4120ef15aac6SJohannes Berg  *	by default for perm_addr. In this case, the mask should be set to
4121ef15aac6SJohannes Berg  *	all-zeroes. In this case it is assumed that the device can handle
4122ef15aac6SJohannes Berg  *	the same number of arbitrary MAC addresses.
4123fd235913SRandy Dunlap  * @registered: protects ->resume and ->suspend sysfs callbacks against
4124fd235913SRandy Dunlap  *	unregister hardware
4125abe37c4bSJohannes Berg  * @debugfsdir: debugfs directory used for this wiphy, will be renamed
4126abe37c4bSJohannes Berg  *	automatically on wiphy renames
4127abe37c4bSJohannes Berg  * @dev: (virtual) struct device for this wiphy
41284a711a85SStanislaw Gruszka  * @registered: helps synchronize suspend/resume with wiphy unregister
4129abe37c4bSJohannes Berg  * @wext: wireless extension handlers
4130abe37c4bSJohannes Berg  * @priv: driver private data (sized according to wiphy_new() parameter)
4131abe37c4bSJohannes Berg  * @interface_modes: bitmask of interfaces types valid for this wiphy,
4132abe37c4bSJohannes Berg  *	must be set by driver
41337527a782SJohannes Berg  * @iface_combinations: Valid interface combinations array, should not
41347527a782SJohannes Berg  *	list single interface types.
41357527a782SJohannes Berg  * @n_iface_combinations: number of entries in @iface_combinations array.
41367527a782SJohannes Berg  * @software_iftypes: bitmask of software interface types, these are not
41377527a782SJohannes Berg  *	subject to any restrictions since they are purely managed in SW.
4138abe37c4bSJohannes Berg  * @flags: wiphy flags, see &enum wiphy_flags
4139a2f73b6cSLuis R. Rodriguez  * @regulatory_flags: wiphy regulatory flags, see
4140a2f73b6cSLuis R. Rodriguez  *	&enum ieee80211_regulatory_flags
41411f074bd8SJohannes Berg  * @features: features advertised to nl80211, see &enum nl80211_feature_flags.
4142d75bb06bSGautam Kumar Shukla  * @ext_features: extended features advertised to nl80211, see
4143d75bb06bSGautam Kumar Shukla  *	&enum nl80211_ext_feature_index.
4144abe37c4bSJohannes Berg  * @bss_priv_size: each BSS struct has private data allocated with it,
4145abe37c4bSJohannes Berg  *	this variable determines its size
4146abe37c4bSJohannes Berg  * @max_scan_ssids: maximum number of SSIDs the device can scan for in
4147abe37c4bSJohannes Berg  *	any given scan
4148ca986ad9SArend Van Spriel  * @max_sched_scan_reqs: maximum number of scheduled scan requests that
4149ca986ad9SArend Van Spriel  *	the device can run concurrently.
415093b6aa69SLuciano Coelho  * @max_sched_scan_ssids: maximum number of SSIDs the device can scan
415193b6aa69SLuciano Coelho  *	for in any given scheduled scan
4152a1f1c21cSLuciano Coelho  * @max_match_sets: maximum number of match sets the device can handle
4153a1f1c21cSLuciano Coelho  *	when performing a scheduled scan, 0 if filtering is not
4154a1f1c21cSLuciano Coelho  *	supported.
4155abe37c4bSJohannes Berg  * @max_scan_ie_len: maximum length of user-controlled IEs device can
4156abe37c4bSJohannes Berg  *	add to probe request frames transmitted during a scan, must not
4157abe37c4bSJohannes Berg  *	include fixed IEs like supported rates
41585a865badSLuciano Coelho  * @max_sched_scan_ie_len: same as max_scan_ie_len, but for scheduled
41595a865badSLuciano Coelho  *	scans
41603b06d277SAvraham Stern  * @max_sched_scan_plans: maximum number of scan plans (scan interval and number
41613b06d277SAvraham Stern  *	of iterations) for scheduled scan supported by the device.
41623b06d277SAvraham Stern  * @max_sched_scan_plan_interval: maximum interval (in seconds) for a
41633b06d277SAvraham Stern  *	single scan plan supported by the device.
41643b06d277SAvraham Stern  * @max_sched_scan_plan_iterations: maximum number of iterations for a single
41653b06d277SAvraham Stern  *	scan plan supported by the device.
4166abe37c4bSJohannes Berg  * @coverage_class: current coverage class
4167abe37c4bSJohannes Berg  * @fw_version: firmware version for ethtool reporting
4168abe37c4bSJohannes Berg  * @hw_version: hardware version for ethtool reporting
4169abe37c4bSJohannes Berg  * @max_num_pmkids: maximum number of PMKIDs supported by device
4170abe37c4bSJohannes Berg  * @privid: a pointer that drivers can use to identify if an arbitrary
4171abe37c4bSJohannes Berg  *	wiphy is theirs, e.g. in global notifiers
4172abe37c4bSJohannes Berg  * @bands: information about bands/channels supported by this device
41732e161f78SJohannes Berg  *
41742e161f78SJohannes Berg  * @mgmt_stypes: bitmasks of frame subtypes that can be subscribed to or
41752e161f78SJohannes Berg  *	transmitted through nl80211, points to an array indexed by interface
41762e161f78SJohannes Berg  *	type
4177a7ffac95SBruno Randolf  *
41787f531e03SBruno Randolf  * @available_antennas_tx: bitmap of antennas which are available to be
41797f531e03SBruno Randolf  *	configured as TX antennas. Antenna configuration commands will be
41807f531e03SBruno Randolf  *	rejected unless this or @available_antennas_rx is set.
41817f531e03SBruno Randolf  *
41827f531e03SBruno Randolf  * @available_antennas_rx: bitmap of antennas which are available to be
41837f531e03SBruno Randolf  *	configured as RX antennas. Antenna configuration commands will be
41847f531e03SBruno Randolf  *	rejected unless this or @available_antennas_tx is set.
4185a293911dSJohannes Berg  *
418615f0ebc2SRandy Dunlap  * @probe_resp_offload:
418715f0ebc2SRandy Dunlap  *	 Bitmap of supported protocols for probe response offloading.
418815f0ebc2SRandy Dunlap  *	 See &enum nl80211_probe_resp_offload_support_attr. Only valid
418915f0ebc2SRandy Dunlap  *	 when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set.
419015f0ebc2SRandy Dunlap  *
4191a293911dSJohannes Berg  * @max_remain_on_channel_duration: Maximum time a remain-on-channel operation
4192a293911dSJohannes Berg  *	may request, if implemented.
4193ff1b6e69SJohannes Berg  *
4194ff1b6e69SJohannes Berg  * @wowlan: WoWLAN support information
41956abb9cb9SJohannes Berg  * @wowlan_config: current WoWLAN configuration; this should usually not be
41966abb9cb9SJohannes Berg  *	used since access to it is necessarily racy, use the parameter passed
41976abb9cb9SJohannes Berg  *	to the suspend() operation instead.
4198562a7480SJohannes Berg  *
4199562a7480SJohannes Berg  * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features.
42007e7c8926SBen Greear  * @ht_capa_mod_mask:  Specify what ht_cap values can be over-ridden.
42017e7c8926SBen Greear  *	If null, then none can be over-ridden.
4202ee2aca34SJohannes Berg  * @vht_capa_mod_mask:  Specify what VHT capabilities can be over-ridden.
4203ee2aca34SJohannes Berg  *	If null, then none can be over-ridden.
420477765eafSVasanthakumar Thiagarajan  *
420553873f13SJohannes Berg  * @wdev_list: the list of associated (virtual) interfaces; this list must
420653873f13SJohannes Berg  *	not be modified by the driver, but can be read with RTNL/RCU protection.
420753873f13SJohannes Berg  *
420877765eafSVasanthakumar Thiagarajan  * @max_acl_mac_addrs: Maximum number of MAC addresses that the device
420977765eafSVasanthakumar Thiagarajan  *	supports for ACL.
4210a50df0c4SJohannes Berg  *
4211a50df0c4SJohannes Berg  * @extended_capabilities: extended capabilities supported by the driver,
4212a50df0c4SJohannes Berg  *	additional capabilities might be supported by userspace; these are
4213a50df0c4SJohannes Berg  *	the 802.11 extended capabilities ("Extended Capabilities element")
4214a50df0c4SJohannes Berg  *	and are in the same format as in the information element. See
4215019ae3a9SKanchanapally, Vidyullatha  *	802.11-2012 8.4.2.29 for the defined fields. These are the default
4216019ae3a9SKanchanapally, Vidyullatha  *	extended capabilities to be used if the capabilities are not specified
4217019ae3a9SKanchanapally, Vidyullatha  *	for a specific interface type in iftype_ext_capab.
4218a50df0c4SJohannes Berg  * @extended_capabilities_mask: mask of the valid values
4219a50df0c4SJohannes Berg  * @extended_capabilities_len: length of the extended capabilities
4220019ae3a9SKanchanapally, Vidyullatha  * @iftype_ext_capab: array of extended capabilities per interface type
4221019ae3a9SKanchanapally, Vidyullatha  * @num_iftype_ext_capab: number of interface types for which extended
4222019ae3a9SKanchanapally, Vidyullatha  *	capabilities are specified separately.
4223be29b99aSAmitkumar Karwar  * @coalesce: packet coalescing support information
4224ad7e718cSJohannes Berg  *
4225ad7e718cSJohannes Berg  * @vendor_commands: array of vendor commands supported by the hardware
4226ad7e718cSJohannes Berg  * @n_vendor_commands: number of vendor commands
4227567ffc35SJohannes Berg  * @vendor_events: array of vendor events supported by the hardware
4228567ffc35SJohannes Berg  * @n_vendor_events: number of vendor events
4229b43504cfSJouni Malinen  *
4230b43504cfSJouni Malinen  * @max_ap_assoc_sta: maximum number of associated stations supported in AP mode
4231b43504cfSJouni Malinen  *	(including P2P GO) or 0 to indicate no such limit is advertised. The
4232b43504cfSJouni Malinen  *	driver is allowed to advertise a theoretical limit that it can reach in
4233b43504cfSJouni Malinen  *	some cases, but may not always reach.
4234c2e4323bSLuciano Coelho  *
4235c2e4323bSLuciano Coelho  * @max_num_csa_counters: Number of supported csa_counters in beacons
4236c2e4323bSLuciano Coelho  *	and probe responses.  This value should be set if the driver
4237c2e4323bSLuciano Coelho  *	wishes to limit the number of csa counters. Default (0) means
4238c2e4323bSLuciano Coelho  *	infinite.
423967af9811SEmmanuel Grumbach  * @max_adj_channel_rssi_comp: max offset of between the channel on which the
424067af9811SEmmanuel Grumbach  *	frame was sent and the channel on which the frame was heard for which
424167af9811SEmmanuel Grumbach  *	the reported rssi is still valid. If a driver is able to compensate the
424267af9811SEmmanuel Grumbach  *	low rssi when a frame is heard on different channel, then it should set
424367af9811SEmmanuel Grumbach  *	this variable to the maximal offset for which it can compensate.
424467af9811SEmmanuel Grumbach  *	This value should be set in MHz.
424538de03d2SArend van Spriel  * @bss_select_support: bitmask indicating the BSS selection criteria supported
424638de03d2SArend van Spriel  *	by the driver in the .connect() callback. The bit position maps to the
424738de03d2SArend van Spriel  *	attribute indices defined in &enum nl80211_bss_select_attr.
4248a442b761SAyala Beker  *
42498585989dSLuca Coelho  * @nan_supported_bands: bands supported by the device in NAN mode, a
42508585989dSLuca Coelho  *	bitmap of &enum nl80211_band values.  For instance, for
42518585989dSLuca Coelho  *	NL80211_BAND_2GHZ, bit 0 would be set
42528585989dSLuca Coelho  *	(i.e. BIT(NL80211_BAND_2GHZ)).
4253f3a7ca64SJohannes Berg  *
4254f3a7ca64SJohannes Berg  * @txq_limit: configuration of internal TX queue frame limit
4255f3a7ca64SJohannes Berg  * @txq_memory_limit: configuration internal TX queue memory limit
4256f3a7ca64SJohannes Berg  * @txq_quantum: configuration of internal TX queue scheduler quantum
4257*9bb7e0f2SJohannes Berg  *
4258*9bb7e0f2SJohannes Berg  * @pmsr_capa: peer measurement capabilities
4259d3236553SJohannes Berg  */
4260d3236553SJohannes Berg struct wiphy {
4261d3236553SJohannes Berg 	/* assign these fields before you register the wiphy */
4262d3236553SJohannes Berg 
4263ef15aac6SJohannes Berg 	/* permanent MAC address(es) */
4264d3236553SJohannes Berg 	u8 perm_addr[ETH_ALEN];
4265ef15aac6SJohannes Berg 	u8 addr_mask[ETH_ALEN];
4266ef15aac6SJohannes Berg 
4267ef15aac6SJohannes Berg 	struct mac_address *addresses;
4268d3236553SJohannes Berg 
42692e161f78SJohannes Berg 	const struct ieee80211_txrx_stypes *mgmt_stypes;
42702e161f78SJohannes Berg 
42717527a782SJohannes Berg 	const struct ieee80211_iface_combination *iface_combinations;
42727527a782SJohannes Berg 	int n_iface_combinations;
42737527a782SJohannes Berg 	u16 software_iftypes;
42747527a782SJohannes Berg 
42752e161f78SJohannes Berg 	u16 n_addresses;
42762e161f78SJohannes Berg 
4277d3236553SJohannes Berg 	/* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
4278d3236553SJohannes Berg 	u16 interface_modes;
4279d3236553SJohannes Berg 
428077765eafSVasanthakumar Thiagarajan 	u16 max_acl_mac_addrs;
428177765eafSVasanthakumar Thiagarajan 
4282a2f73b6cSLuis R. Rodriguez 	u32 flags, regulatory_flags, features;
4283d75bb06bSGautam Kumar Shukla 	u8 ext_features[DIV_ROUND_UP(NUM_NL80211_EXT_FEATURES, 8)];
4284463d0183SJohannes Berg 
4285562a7480SJohannes Berg 	u32 ap_sme_capa;
4286562a7480SJohannes Berg 
4287d3236553SJohannes Berg 	enum cfg80211_signal_type signal_type;
4288d3236553SJohannes Berg 
4289d3236553SJohannes Berg 	int bss_priv_size;
4290d3236553SJohannes Berg 	u8 max_scan_ssids;
4291ca986ad9SArend Van Spriel 	u8 max_sched_scan_reqs;
429293b6aa69SLuciano Coelho 	u8 max_sched_scan_ssids;
4293a1f1c21cSLuciano Coelho 	u8 max_match_sets;
4294d3236553SJohannes Berg 	u16 max_scan_ie_len;
42955a865badSLuciano Coelho 	u16 max_sched_scan_ie_len;
42963b06d277SAvraham Stern 	u32 max_sched_scan_plans;
42973b06d277SAvraham Stern 	u32 max_sched_scan_plan_interval;
42983b06d277SAvraham Stern 	u32 max_sched_scan_plan_iterations;
4299d3236553SJohannes Berg 
4300d3236553SJohannes Berg 	int n_cipher_suites;
4301d3236553SJohannes Berg 	const u32 *cipher_suites;
4302d3236553SJohannes Berg 
4303b9a5f8caSJouni Malinen 	u8 retry_short;
4304b9a5f8caSJouni Malinen 	u8 retry_long;
4305b9a5f8caSJouni Malinen 	u32 frag_threshold;
4306b9a5f8caSJouni Malinen 	u32 rts_threshold;
430781077e82SLukáš Turek 	u8 coverage_class;
4308b9a5f8caSJouni Malinen 
430981135548SJiri Pirko 	char fw_version[ETHTOOL_FWVERS_LEN];
4310dfce95f5SKalle Valo 	u32 hw_version;
4311dfce95f5SKalle Valo 
4312dfb89c56SJohannes Berg #ifdef CONFIG_PM
4313964dc9e2SJohannes Berg 	const struct wiphy_wowlan_support *wowlan;
43146abb9cb9SJohannes Berg 	struct cfg80211_wowlan *wowlan_config;
4315dfb89c56SJohannes Berg #endif
4316ff1b6e69SJohannes Berg 
4317a293911dSJohannes Berg 	u16 max_remain_on_channel_duration;
4318a293911dSJohannes Berg 
431967fbb16bSSamuel Ortiz 	u8 max_num_pmkids;
432067fbb16bSSamuel Ortiz 
43217f531e03SBruno Randolf 	u32 available_antennas_tx;
43227f531e03SBruno Randolf 	u32 available_antennas_rx;
4323a7ffac95SBruno Randolf 
432487bbbe22SArik Nemtsov 	/*
432587bbbe22SArik Nemtsov 	 * Bitmap of supported protocols for probe response offloading
432687bbbe22SArik Nemtsov 	 * see &enum nl80211_probe_resp_offload_support_attr. Only valid
432787bbbe22SArik Nemtsov 	 * when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set.
432887bbbe22SArik Nemtsov 	 */
432987bbbe22SArik Nemtsov 	u32 probe_resp_offload;
433087bbbe22SArik Nemtsov 
4331a50df0c4SJohannes Berg 	const u8 *extended_capabilities, *extended_capabilities_mask;
4332a50df0c4SJohannes Berg 	u8 extended_capabilities_len;
4333a50df0c4SJohannes Berg 
4334019ae3a9SKanchanapally, Vidyullatha 	const struct wiphy_iftype_ext_capab *iftype_ext_capab;
4335019ae3a9SKanchanapally, Vidyullatha 	unsigned int num_iftype_ext_capab;
4336019ae3a9SKanchanapally, Vidyullatha 
4337d3236553SJohannes Berg 	/* If multiple wiphys are registered and you're handed e.g.
4338d3236553SJohannes Berg 	 * a regular netdev with assigned ieee80211_ptr, you won't
4339d3236553SJohannes Berg 	 * know whether it points to a wiphy your driver has registered
4340d3236553SJohannes Berg 	 * or not. Assign this to something global to your driver to
4341d3236553SJohannes Berg 	 * help determine whether you own this wiphy or not. */
4342cf5aa2f1SDavid Kilroy 	const void *privid;
4343d3236553SJohannes Berg 
434457fbcce3SJohannes Berg 	struct ieee80211_supported_band *bands[NUM_NL80211_BANDS];
4345d3236553SJohannes Berg 
4346d3236553SJohannes Berg 	/* Lets us get back the wiphy on the callback */
43470c0280bdSLuis R. Rodriguez 	void (*reg_notifier)(struct wiphy *wiphy,
4348d3236553SJohannes Berg 			     struct regulatory_request *request);
4349d3236553SJohannes Berg 
4350d3236553SJohannes Berg 	/* fields below are read-only, assigned by cfg80211 */
4351d3236553SJohannes Berg 
4352458f4f9eSJohannes Berg 	const struct ieee80211_regdomain __rcu *regd;
4353d3236553SJohannes Berg 
4354d3236553SJohannes Berg 	/* the item in /sys/class/ieee80211/ points to this,
4355d3236553SJohannes Berg 	 * you need use set_wiphy_dev() (see below) */
4356d3236553SJohannes Berg 	struct device dev;
4357d3236553SJohannes Berg 
4358ecb44335SStanislaw Gruszka 	/* protects ->resume, ->suspend sysfs callbacks against unregister hw */
4359ecb44335SStanislaw Gruszka 	bool registered;
4360ecb44335SStanislaw Gruszka 
4361d3236553SJohannes Berg 	/* dir in debugfs: ieee80211/<wiphyname> */
4362d3236553SJohannes Berg 	struct dentry *debugfsdir;
4363d3236553SJohannes Berg 
43647e7c8926SBen Greear 	const struct ieee80211_ht_cap *ht_capa_mod_mask;
4365ee2aca34SJohannes Berg 	const struct ieee80211_vht_cap *vht_capa_mod_mask;
43667e7c8926SBen Greear 
436753873f13SJohannes Berg 	struct list_head wdev_list;
436853873f13SJohannes Berg 
4369463d0183SJohannes Berg 	/* the network namespace this phy lives in currently */
43700c5c9fb5SEric W. Biederman 	possible_net_t _net;
4371463d0183SJohannes Berg 
43723d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT
43733d23e349SJohannes Berg 	const struct iw_handler_def *wext;
43743d23e349SJohannes Berg #endif
43753d23e349SJohannes Berg 
4376be29b99aSAmitkumar Karwar 	const struct wiphy_coalesce_support *coalesce;
4377be29b99aSAmitkumar Karwar 
4378ad7e718cSJohannes Berg 	const struct wiphy_vendor_command *vendor_commands;
4379567ffc35SJohannes Berg 	const struct nl80211_vendor_cmd_info *vendor_events;
4380567ffc35SJohannes Berg 	int n_vendor_commands, n_vendor_events;
4381ad7e718cSJohannes Berg 
4382b43504cfSJouni Malinen 	u16 max_ap_assoc_sta;
4383b43504cfSJouni Malinen 
43849a774c78SAndrei Otcheretianski 	u8 max_num_csa_counters;
438567af9811SEmmanuel Grumbach 	u8 max_adj_channel_rssi_comp;
43869a774c78SAndrei Otcheretianski 
438738de03d2SArend van Spriel 	u32 bss_select_support;
438838de03d2SArend van Spriel 
43898585989dSLuca Coelho 	u8 nan_supported_bands;
43908585989dSLuca Coelho 
439152539ca8SToke Høiland-Jørgensen 	u32 txq_limit;
439252539ca8SToke Høiland-Jørgensen 	u32 txq_memory_limit;
439352539ca8SToke Høiland-Jørgensen 	u32 txq_quantum;
439452539ca8SToke Høiland-Jørgensen 
4395*9bb7e0f2SJohannes Berg 	const struct cfg80211_pmsr_capabilities *pmsr_capa;
4396*9bb7e0f2SJohannes Berg 
43971c06ef98SJohannes Berg 	char priv[0] __aligned(NETDEV_ALIGN);
4398d3236553SJohannes Berg };
4399d3236553SJohannes Berg 
4400463d0183SJohannes Berg static inline struct net *wiphy_net(struct wiphy *wiphy)
4401463d0183SJohannes Berg {
4402c2d9ba9bSEric Dumazet 	return read_pnet(&wiphy->_net);
4403463d0183SJohannes Berg }
4404463d0183SJohannes Berg 
4405463d0183SJohannes Berg static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net)
4406463d0183SJohannes Berg {
4407c2d9ba9bSEric Dumazet 	write_pnet(&wiphy->_net, net);
4408463d0183SJohannes Berg }
4409463d0183SJohannes Berg 
4410d3236553SJohannes Berg /**
4411d3236553SJohannes Berg  * wiphy_priv - return priv from wiphy
4412d3236553SJohannes Berg  *
4413d3236553SJohannes Berg  * @wiphy: the wiphy whose priv pointer to return
44140ae997dcSYacine Belkadi  * Return: The priv of @wiphy.
4415d3236553SJohannes Berg  */
4416d3236553SJohannes Berg static inline void *wiphy_priv(struct wiphy *wiphy)
4417d3236553SJohannes Berg {
4418d3236553SJohannes Berg 	BUG_ON(!wiphy);
4419d3236553SJohannes Berg 	return &wiphy->priv;
4420d3236553SJohannes Berg }
4421d3236553SJohannes Berg 
4422d3236553SJohannes Berg /**
4423f1f74825SDavid Kilroy  * priv_to_wiphy - return the wiphy containing the priv
4424f1f74825SDavid Kilroy  *
4425f1f74825SDavid Kilroy  * @priv: a pointer previously returned by wiphy_priv
44260ae997dcSYacine Belkadi  * Return: The wiphy of @priv.
4427f1f74825SDavid Kilroy  */
4428f1f74825SDavid Kilroy static inline struct wiphy *priv_to_wiphy(void *priv)
4429f1f74825SDavid Kilroy {
4430f1f74825SDavid Kilroy 	BUG_ON(!priv);
4431f1f74825SDavid Kilroy 	return container_of(priv, struct wiphy, priv);
4432f1f74825SDavid Kilroy }
4433f1f74825SDavid Kilroy 
4434f1f74825SDavid Kilroy /**
4435d3236553SJohannes Berg  * set_wiphy_dev - set device pointer for wiphy
4436d3236553SJohannes Berg  *
4437d3236553SJohannes Berg  * @wiphy: The wiphy whose device to bind
4438d3236553SJohannes Berg  * @dev: The device to parent it to
4439d3236553SJohannes Berg  */
4440d3236553SJohannes Berg static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev)
4441d3236553SJohannes Berg {
4442d3236553SJohannes Berg 	wiphy->dev.parent = dev;
4443d3236553SJohannes Berg }
4444d3236553SJohannes Berg 
4445d3236553SJohannes Berg /**
4446d3236553SJohannes Berg  * wiphy_dev - get wiphy dev pointer
4447d3236553SJohannes Berg  *
4448d3236553SJohannes Berg  * @wiphy: The wiphy whose device struct to look up
44490ae997dcSYacine Belkadi  * Return: The dev of @wiphy.
4450d3236553SJohannes Berg  */
4451d3236553SJohannes Berg static inline struct device *wiphy_dev(struct wiphy *wiphy)
4452d3236553SJohannes Berg {
4453d3236553SJohannes Berg 	return wiphy->dev.parent;
4454d3236553SJohannes Berg }
4455d3236553SJohannes Berg 
4456d3236553SJohannes Berg /**
4457d3236553SJohannes Berg  * wiphy_name - get wiphy name
4458d3236553SJohannes Berg  *
4459d3236553SJohannes Berg  * @wiphy: The wiphy whose name to return
44600ae997dcSYacine Belkadi  * Return: The name of @wiphy.
4461d3236553SJohannes Berg  */
4462e1db74fcSJoe Perches static inline const char *wiphy_name(const struct wiphy *wiphy)
4463d3236553SJohannes Berg {
4464d3236553SJohannes Berg 	return dev_name(&wiphy->dev);
4465d3236553SJohannes Berg }
4466d3236553SJohannes Berg 
4467d3236553SJohannes Berg /**
44681998d90aSBen Greear  * wiphy_new_nm - create a new wiphy for use with cfg80211
44691998d90aSBen Greear  *
44701998d90aSBen Greear  * @ops: The configuration operations for this device
44711998d90aSBen Greear  * @sizeof_priv: The size of the private area to allocate
44721998d90aSBen Greear  * @requested_name: Request a particular name.
44731998d90aSBen Greear  *	NULL is valid value, and means use the default phy%d naming.
44741998d90aSBen Greear  *
44751998d90aSBen Greear  * Create a new wiphy and associate the given operations with it.
44761998d90aSBen Greear  * @sizeof_priv bytes are allocated for private use.
44771998d90aSBen Greear  *
44781998d90aSBen Greear  * Return: A pointer to the new wiphy. This pointer must be
44791998d90aSBen Greear  * assigned to each netdev's ieee80211_ptr for proper operation.
44801998d90aSBen Greear  */
44811998d90aSBen Greear struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv,
44821998d90aSBen Greear 			   const char *requested_name);
44831998d90aSBen Greear 
44841998d90aSBen Greear /**
4485d3236553SJohannes Berg  * wiphy_new - create a new wiphy for use with cfg80211
4486d3236553SJohannes Berg  *
4487d3236553SJohannes Berg  * @ops: The configuration operations for this device
4488d3236553SJohannes Berg  * @sizeof_priv: The size of the private area to allocate
4489d3236553SJohannes Berg  *
4490d3236553SJohannes Berg  * Create a new wiphy and associate the given operations with it.
4491d3236553SJohannes Berg  * @sizeof_priv bytes are allocated for private use.
4492d3236553SJohannes Berg  *
44930ae997dcSYacine Belkadi  * Return: A pointer to the new wiphy. This pointer must be
44940ae997dcSYacine Belkadi  * assigned to each netdev's ieee80211_ptr for proper operation.
4495d3236553SJohannes Berg  */
44961998d90aSBen Greear static inline struct wiphy *wiphy_new(const struct cfg80211_ops *ops,
44971998d90aSBen Greear 				      int sizeof_priv)
44981998d90aSBen Greear {
44991998d90aSBen Greear 	return wiphy_new_nm(ops, sizeof_priv, NULL);
45001998d90aSBen Greear }
4501d3236553SJohannes Berg 
4502d3236553SJohannes Berg /**
4503d3236553SJohannes Berg  * wiphy_register - register a wiphy with cfg80211
4504d3236553SJohannes Berg  *
4505d3236553SJohannes Berg  * @wiphy: The wiphy to register.
4506d3236553SJohannes Berg  *
45070ae997dcSYacine Belkadi  * Return: A non-negative wiphy index or a negative error code.
4508d3236553SJohannes Berg  */
450910dd9b7cSJoe Perches int wiphy_register(struct wiphy *wiphy);
4510d3236553SJohannes Berg 
4511d3236553SJohannes Berg /**
4512d3236553SJohannes Berg  * wiphy_unregister - deregister a wiphy from cfg80211
4513d3236553SJohannes Berg  *
4514d3236553SJohannes Berg  * @wiphy: The wiphy to unregister.
4515d3236553SJohannes Berg  *
4516d3236553SJohannes Berg  * After this call, no more requests can be made with this priv
4517d3236553SJohannes Berg  * pointer, but the call may sleep to wait for an outstanding
4518d3236553SJohannes Berg  * request that is being handled.
4519d3236553SJohannes Berg  */
452010dd9b7cSJoe Perches void wiphy_unregister(struct wiphy *wiphy);
4521d3236553SJohannes Berg 
4522d3236553SJohannes Berg /**
4523d3236553SJohannes Berg  * wiphy_free - free wiphy
4524d3236553SJohannes Berg  *
4525d3236553SJohannes Berg  * @wiphy: The wiphy to free
4526d3236553SJohannes Berg  */
452710dd9b7cSJoe Perches void wiphy_free(struct wiphy *wiphy);
4528d3236553SJohannes Berg 
4529fffd0934SJohannes Berg /* internal structs */
45306829c878SJohannes Berg struct cfg80211_conn;
453119957bb3SJohannes Berg struct cfg80211_internal_bss;
4532fffd0934SJohannes Berg struct cfg80211_cached_keys;
45334a4b8169SAndrew Zaborowski struct cfg80211_cqm_config;
453419957bb3SJohannes Berg 
4535d3236553SJohannes Berg /**
453689a54e48SJohannes Berg  * struct wireless_dev - wireless device state
4537d3236553SJohannes Berg  *
453889a54e48SJohannes Berg  * For netdevs, this structure must be allocated by the driver
453989a54e48SJohannes Berg  * that uses the ieee80211_ptr field in struct net_device (this
454089a54e48SJohannes Berg  * is intentional so it can be allocated along with the netdev.)
454189a54e48SJohannes Berg  * It need not be registered then as netdev registration will
454289a54e48SJohannes Berg  * be intercepted by cfg80211 to see the new wireless device.
454389a54e48SJohannes Berg  *
454489a54e48SJohannes Berg  * For non-netdev uses, it must also be allocated by the driver
454589a54e48SJohannes Berg  * in response to the cfg80211 callbacks that require it, as
454689a54e48SJohannes Berg  * there's no netdev registration in that case it may not be
454789a54e48SJohannes Berg  * allocated outside of callback operations that return it.
4548d3236553SJohannes Berg  *
4549d3236553SJohannes Berg  * @wiphy: pointer to hardware description
4550d3236553SJohannes Berg  * @iftype: interface type
4551d3236553SJohannes Berg  * @list: (private) Used to collect the interfaces
455289a54e48SJohannes Berg  * @netdev: (private) Used to reference back to the netdev, may be %NULL
455389a54e48SJohannes Berg  * @identifier: (private) Identifier used in nl80211 to identify this
455489a54e48SJohannes Berg  *	wireless device if it has no netdev
4555d3236553SJohannes Berg  * @current_bss: (private) Used by the internal configuration code
45569e0e2961SMichal Kazior  * @chandef: (private) Used by the internal configuration code to track
45579e0e2961SMichal Kazior  *	the user-set channel definition.
4558780b40dfSJohannes Berg  * @preset_chandef: (private) Used by the internal configuration code to
4559aa430da4SJohannes Berg  *	track the channel to be used for AP later
4560d3236553SJohannes Berg  * @bssid: (private) Used by the internal configuration code
4561d3236553SJohannes Berg  * @ssid: (private) Used by the internal configuration code
4562d3236553SJohannes Berg  * @ssid_len: (private) Used by the internal configuration code
456329cbe68cSJohannes Berg  * @mesh_id_len: (private) Used by the internal configuration code
456429cbe68cSJohannes Berg  * @mesh_id_up_len: (private) Used by the internal configuration code
4565d3236553SJohannes Berg  * @wext: (private) Used by the internal wireless extensions compat code
45669bc383deSJohannes Berg  * @use_4addr: indicates 4addr mode is used on this interface, must be
45679bc383deSJohannes Berg  *	set by driver (if supported) on add_interface BEFORE registering the
45689bc383deSJohannes Berg  *	netdev and may otherwise be used by driver read-only, will be update
45699bc383deSJohannes Berg  *	by cfg80211 on change_interface
45702e161f78SJohannes Berg  * @mgmt_registrations: list of registrations for management frames
45712e161f78SJohannes Berg  * @mgmt_registrations_lock: lock for the list
45728d61ffa5SJohannes Berg  * @mtx: mutex used to lock data in this struct, may be used by drivers
45738d61ffa5SJohannes Berg  *	and some API functions require it held
457456d1893dSJohannes Berg  * @beacon_interval: beacon interval used on this device for transmitting
457556d1893dSJohannes Berg  *	beacons, 0 when not valid
457698104fdeSJohannes Berg  * @address: The address for this device, valid only if @netdev is %NULL
457773c7da3dSArend Van Spriel  * @is_running: true if this is a non-netdev device that has been started, e.g.
457873c7da3dSArend Van Spriel  *	the P2P Device.
457904f39047SSimon Wunderlich  * @cac_started: true if DFS channel availability check has been started
458004f39047SSimon Wunderlich  * @cac_start_time: timestamp (jiffies) when the dfs state was entered.
458131559f35SJanusz Dziedzic  * @cac_time_ms: CAC time in ms
4582780b40dfSJohannes Berg  * @ps: powersave mode is enabled
4583780b40dfSJohannes Berg  * @ps_timeout: dynamic powersave timeout
4584780b40dfSJohannes Berg  * @ap_unexpected_nlportid: (private) netlink port ID of application
4585780b40dfSJohannes Berg  *	registered for unexpected class 3 frames (AP mode)
4586780b40dfSJohannes Berg  * @conn: (private) cfg80211 software SME connection state machine data
4587780b40dfSJohannes Berg  * @connect_keys: (private) keys to set after connection is established
458834d50519SLior David  * @conn_bss_type: connecting/connected BSS type
4589bd2522b1SAndrzej Zaborowski  * @conn_owner_nlportid: (private) connection owner socket port ID
4590bd2522b1SAndrzej Zaborowski  * @disconnect_wk: (private) auto-disconnect work
4591bd2522b1SAndrzej Zaborowski  * @disconnect_bssid: (private) the BSSID to use for auto-disconnect
4592780b40dfSJohannes Berg  * @ibss_fixed: (private) IBSS is using fixed BSSID
45935336fa88SSimon Wunderlich  * @ibss_dfs_possible: (private) IBSS may change to a DFS channel
4594780b40dfSJohannes Berg  * @event_list: (private) list for internal event processing
4595780b40dfSJohannes Berg  * @event_lock: (private) lock for event list
459678f22b6aSJohannes Berg  * @owner_nlportid: (private) owner socket port ID
4597ab81007aSJohannes Berg  * @nl_owner_dead: (private) owner socket went away
45984a4b8169SAndrew Zaborowski  * @cqm_config: (private) nl80211 RSSI monitor state
4599*9bb7e0f2SJohannes Berg  * @pmsr_list: (private) peer measurement requests
4600*9bb7e0f2SJohannes Berg  * @pmsr_lock: (private) peer measurements requests/results lock
4601*9bb7e0f2SJohannes Berg  * @pmsr_free_wk: (private) peer measurements cleanup work
4602d3236553SJohannes Berg  */
4603d3236553SJohannes Berg struct wireless_dev {
4604d3236553SJohannes Berg 	struct wiphy *wiphy;
4605d3236553SJohannes Berg 	enum nl80211_iftype iftype;
4606d3236553SJohannes Berg 
4607667503ddSJohannes Berg 	/* the remainder of this struct should be private to cfg80211 */
4608d3236553SJohannes Berg 	struct list_head list;
4609d3236553SJohannes Berg 	struct net_device *netdev;
4610d3236553SJohannes Berg 
461189a54e48SJohannes Berg 	u32 identifier;
461289a54e48SJohannes Berg 
46132e161f78SJohannes Berg 	struct list_head mgmt_registrations;
46142e161f78SJohannes Berg 	spinlock_t mgmt_registrations_lock;
4615026331c4SJouni Malinen 
4616667503ddSJohannes Berg 	struct mutex mtx;
4617667503ddSJohannes Berg 
461873c7da3dSArend Van Spriel 	bool use_4addr, is_running;
461998104fdeSJohannes Berg 
462098104fdeSJohannes Berg 	u8 address[ETH_ALEN] __aligned(sizeof(u16));
46219bc383deSJohannes Berg 
4622b23aa676SSamuel Ortiz 	/* currently used for IBSS and SME - might be rearranged later */
4623d3236553SJohannes Berg 	u8 ssid[IEEE80211_MAX_SSID_LEN];
462429cbe68cSJohannes Berg 	u8 ssid_len, mesh_id_len, mesh_id_up_len;
46256829c878SJohannes Berg 	struct cfg80211_conn *conn;
4626fffd0934SJohannes Berg 	struct cfg80211_cached_keys *connect_keys;
462734d50519SLior David 	enum ieee80211_bss_type conn_bss_type;
4628bd2522b1SAndrzej Zaborowski 	u32 conn_owner_nlportid;
4629bd2522b1SAndrzej Zaborowski 
4630bd2522b1SAndrzej Zaborowski 	struct work_struct disconnect_wk;
4631bd2522b1SAndrzej Zaborowski 	u8 disconnect_bssid[ETH_ALEN];
4632d3236553SJohannes Berg 
4633667503ddSJohannes Berg 	struct list_head event_list;
4634667503ddSJohannes Berg 	spinlock_t event_lock;
4635667503ddSJohannes Berg 
463619957bb3SJohannes Berg 	struct cfg80211_internal_bss *current_bss; /* associated / joined */
4637683b6d3bSJohannes Berg 	struct cfg80211_chan_def preset_chandef;
46389e0e2961SMichal Kazior 	struct cfg80211_chan_def chandef;
4639f4489ebeSMichal Kazior 
4640c30a3d38SMichal Kazior 	bool ibss_fixed;
46415336fa88SSimon Wunderlich 	bool ibss_dfs_possible;
4642c30a3d38SMichal Kazior 
4643ffb9eb3dSKalle Valo 	bool ps;
4644ffb9eb3dSKalle Valo 	int ps_timeout;
4645ffb9eb3dSKalle Valo 
464656d1893dSJohannes Berg 	int beacon_interval;
464756d1893dSJohannes Berg 
464815e47304SEric W. Biederman 	u32 ap_unexpected_nlportid;
464928946da7SJohannes Berg 
4650ab81007aSJohannes Berg 	u32 owner_nlportid;
4651ab81007aSJohannes Berg 	bool nl_owner_dead;
4652ab81007aSJohannes Berg 
465304f39047SSimon Wunderlich 	bool cac_started;
465404f39047SSimon Wunderlich 	unsigned long cac_start_time;
465531559f35SJanusz Dziedzic 	unsigned int cac_time_ms;
465604f39047SSimon Wunderlich 
46573d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT
4658d3236553SJohannes Berg 	/* wext data */
4659cbe8fa9cSJohannes Berg 	struct {
4660cbe8fa9cSJohannes Berg 		struct cfg80211_ibss_params ibss;
4661f2129354SJohannes Berg 		struct cfg80211_connect_params connect;
4662fffd0934SJohannes Berg 		struct cfg80211_cached_keys *keys;
4663c1e5f471SJohannes Berg 		const u8 *ie;
4664f2129354SJohannes Berg 		size_t ie_len;
4665f401a6f7SJohannes Berg 		u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN];
4666f2129354SJohannes Berg 		u8 ssid[IEEE80211_MAX_SSID_LEN];
466708645126SJohannes Berg 		s8 default_key, default_mgmt_key;
4668ffb9eb3dSKalle Valo 		bool prev_bssid_valid;
4669cbe8fa9cSJohannes Berg 	} wext;
4670d3236553SJohannes Berg #endif
46714a4b8169SAndrew Zaborowski 
46724a4b8169SAndrew Zaborowski 	struct cfg80211_cqm_config *cqm_config;
4673*9bb7e0f2SJohannes Berg 
4674*9bb7e0f2SJohannes Berg 	struct list_head pmsr_list;
4675*9bb7e0f2SJohannes Berg 	spinlock_t pmsr_lock;
4676*9bb7e0f2SJohannes Berg 	struct work_struct pmsr_free_wk;
4677d3236553SJohannes Berg };
4678d3236553SJohannes Berg 
467998104fdeSJohannes Berg static inline u8 *wdev_address(struct wireless_dev *wdev)
468098104fdeSJohannes Berg {
468198104fdeSJohannes Berg 	if (wdev->netdev)
468298104fdeSJohannes Berg 		return wdev->netdev->dev_addr;
468398104fdeSJohannes Berg 	return wdev->address;
468498104fdeSJohannes Berg }
468598104fdeSJohannes Berg 
468673c7da3dSArend Van Spriel static inline bool wdev_running(struct wireless_dev *wdev)
468773c7da3dSArend Van Spriel {
468873c7da3dSArend Van Spriel 	if (wdev->netdev)
468973c7da3dSArend Van Spriel 		return netif_running(wdev->netdev);
469073c7da3dSArend Van Spriel 	return wdev->is_running;
469173c7da3dSArend Van Spriel }
469273c7da3dSArend Van Spriel 
4693d3236553SJohannes Berg /**
4694d3236553SJohannes Berg  * wdev_priv - return wiphy priv from wireless_dev
4695d3236553SJohannes Berg  *
4696d3236553SJohannes Berg  * @wdev: The wireless device whose wiphy's priv pointer to return
46970ae997dcSYacine Belkadi  * Return: The wiphy priv of @wdev.
4698d3236553SJohannes Berg  */
4699d3236553SJohannes Berg static inline void *wdev_priv(struct wireless_dev *wdev)
4700d3236553SJohannes Berg {
4701d3236553SJohannes Berg 	BUG_ON(!wdev);
4702d3236553SJohannes Berg 	return wiphy_priv(wdev->wiphy);
4703d3236553SJohannes Berg }
4704d3236553SJohannes Berg 
4705d70e9693SJohannes Berg /**
4706d70e9693SJohannes Berg  * DOC: Utility functions
4707d70e9693SJohannes Berg  *
4708d70e9693SJohannes Berg  * cfg80211 offers a number of utility functions that can be useful.
4709d3236553SJohannes Berg  */
4710d3236553SJohannes Berg 
4711d3236553SJohannes Berg /**
4712d3236553SJohannes Berg  * ieee80211_channel_to_frequency - convert channel number to frequency
4713abe37c4bSJohannes Berg  * @chan: channel number
471459eb21a6SBruno Randolf  * @band: band, necessary due to channel number overlap
47150ae997dcSYacine Belkadi  * Return: The corresponding frequency (in MHz), or 0 if the conversion failed.
4716d3236553SJohannes Berg  */
471757fbcce3SJohannes Berg int ieee80211_channel_to_frequency(int chan, enum nl80211_band band);
4718d3236553SJohannes Berg 
4719d3236553SJohannes Berg /**
4720d3236553SJohannes Berg  * ieee80211_frequency_to_channel - convert frequency to channel number
4721abe37c4bSJohannes Berg  * @freq: center frequency
47220ae997dcSYacine Belkadi  * Return: The corresponding channel, or 0 if the conversion failed.
4723d3236553SJohannes Berg  */
472410dd9b7cSJoe Perches int ieee80211_frequency_to_channel(int freq);
4725d3236553SJohannes Berg 
4726d3236553SJohannes Berg /**
4727d3236553SJohannes Berg  * ieee80211_get_channel - get channel struct from wiphy for specified frequency
4728543b921bSArend Van Spriel  *
4729abe37c4bSJohannes Berg  * @wiphy: the struct wiphy to get the channel for
4730abe37c4bSJohannes Berg  * @freq: the center frequency of the channel
4731543b921bSArend Van Spriel  *
47320ae997dcSYacine Belkadi  * Return: The channel struct from @wiphy at @freq.
4733d3236553SJohannes Berg  */
4734543b921bSArend Van Spriel struct ieee80211_channel *ieee80211_get_channel(struct wiphy *wiphy, int freq);
4735d3236553SJohannes Berg 
4736d3236553SJohannes Berg /**
4737d3236553SJohannes Berg  * ieee80211_get_response_rate - get basic rate for a given rate
4738d3236553SJohannes Berg  *
4739d3236553SJohannes Berg  * @sband: the band to look for rates in
4740d3236553SJohannes Berg  * @basic_rates: bitmap of basic rates
4741d3236553SJohannes Berg  * @bitrate: the bitrate for which to find the basic rate
4742d3236553SJohannes Berg  *
47430ae997dcSYacine Belkadi  * Return: The basic rate corresponding to a given bitrate, that
47440ae997dcSYacine Belkadi  * is the next lower bitrate contained in the basic rate map,
47450ae997dcSYacine Belkadi  * which is, for this function, given as a bitmap of indices of
47460ae997dcSYacine Belkadi  * rates in the band's bitrate table.
4747d3236553SJohannes Berg  */
4748d3236553SJohannes Berg struct ieee80211_rate *
4749d3236553SJohannes Berg ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
4750d3236553SJohannes Berg 			    u32 basic_rates, int bitrate);
4751d3236553SJohannes Berg 
4752b422c6cdSAshok Nagarajan /**
4753b422c6cdSAshok Nagarajan  * ieee80211_mandatory_rates - get mandatory rates for a given band
4754b422c6cdSAshok Nagarajan  * @sband: the band to look for rates in
475574608acaSSimon Wunderlich  * @scan_width: width of the control channel
4756b422c6cdSAshok Nagarajan  *
4757b422c6cdSAshok Nagarajan  * This function returns a bitmap of the mandatory rates for the given
4758b422c6cdSAshok Nagarajan  * band, bits are set according to the rate position in the bitrates array.
4759b422c6cdSAshok Nagarajan  */
476074608acaSSimon Wunderlich u32 ieee80211_mandatory_rates(struct ieee80211_supported_band *sband,
476174608acaSSimon Wunderlich 			      enum nl80211_bss_scan_width scan_width);
4762b422c6cdSAshok Nagarajan 
4763d3236553SJohannes Berg /*
4764d3236553SJohannes Berg  * Radiotap parsing functions -- for controlled injection support
4765d3236553SJohannes Berg  *
4766d3236553SJohannes Berg  * Implemented in net/wireless/radiotap.c
4767d3236553SJohannes Berg  * Documentation in Documentation/networking/radiotap-headers.txt
4768d3236553SJohannes Berg  */
4769d3236553SJohannes Berg 
477033e5a2f7SJohannes Berg struct radiotap_align_size {
477133e5a2f7SJohannes Berg 	uint8_t align:4, size:4;
477233e5a2f7SJohannes Berg };
477333e5a2f7SJohannes Berg 
477433e5a2f7SJohannes Berg struct ieee80211_radiotap_namespace {
477533e5a2f7SJohannes Berg 	const struct radiotap_align_size *align_size;
477633e5a2f7SJohannes Berg 	int n_bits;
477733e5a2f7SJohannes Berg 	uint32_t oui;
477833e5a2f7SJohannes Berg 	uint8_t subns;
477933e5a2f7SJohannes Berg };
478033e5a2f7SJohannes Berg 
478133e5a2f7SJohannes Berg struct ieee80211_radiotap_vendor_namespaces {
478233e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_namespace *ns;
478333e5a2f7SJohannes Berg 	int n_ns;
478433e5a2f7SJohannes Berg };
478533e5a2f7SJohannes Berg 
4786d3236553SJohannes Berg /**
4787d3236553SJohannes Berg  * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args
478833e5a2f7SJohannes Berg  * @this_arg_index: index of current arg, valid after each successful call
478933e5a2f7SJohannes Berg  *	to ieee80211_radiotap_iterator_next()
479033e5a2f7SJohannes Berg  * @this_arg: pointer to current radiotap arg; it is valid after each
479133e5a2f7SJohannes Berg  *	call to ieee80211_radiotap_iterator_next() but also after
479233e5a2f7SJohannes Berg  *	ieee80211_radiotap_iterator_init() where it will point to
479333e5a2f7SJohannes Berg  *	the beginning of the actual data portion
479433e5a2f7SJohannes Berg  * @this_arg_size: length of the current arg, for convenience
479533e5a2f7SJohannes Berg  * @current_namespace: pointer to the current namespace definition
479633e5a2f7SJohannes Berg  *	(or internally %NULL if the current namespace is unknown)
479733e5a2f7SJohannes Berg  * @is_radiotap_ns: indicates whether the current namespace is the default
479833e5a2f7SJohannes Berg  *	radiotap namespace or not
479933e5a2f7SJohannes Berg  *
480033e5a2f7SJohannes Berg  * @_rtheader: pointer to the radiotap header we are walking through
480133e5a2f7SJohannes Berg  * @_max_length: length of radiotap header in cpu byte ordering
480233e5a2f7SJohannes Berg  * @_arg_index: next argument index
480333e5a2f7SJohannes Berg  * @_arg: next argument pointer
480433e5a2f7SJohannes Berg  * @_next_bitmap: internal pointer to next present u32
480533e5a2f7SJohannes Berg  * @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present
480633e5a2f7SJohannes Berg  * @_vns: vendor namespace definitions
480733e5a2f7SJohannes Berg  * @_next_ns_data: beginning of the next namespace's data
480833e5a2f7SJohannes Berg  * @_reset_on_ext: internal; reset the arg index to 0 when going to the
480933e5a2f7SJohannes Berg  *	next bitmap word
481033e5a2f7SJohannes Berg  *
481133e5a2f7SJohannes Berg  * Describes the radiotap parser state. Fields prefixed with an underscore
481233e5a2f7SJohannes Berg  * must not be used by users of the parser, only by the parser internally.
4813d3236553SJohannes Berg  */
4814d3236553SJohannes Berg 
4815d3236553SJohannes Berg struct ieee80211_radiotap_iterator {
481633e5a2f7SJohannes Berg 	struct ieee80211_radiotap_header *_rtheader;
481733e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_vendor_namespaces *_vns;
481833e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_namespace *current_namespace;
4819d3236553SJohannes Berg 
482033e5a2f7SJohannes Berg 	unsigned char *_arg, *_next_ns_data;
482167272440SJohannes Berg 	__le32 *_next_bitmap;
482233e5a2f7SJohannes Berg 
482333e5a2f7SJohannes Berg 	unsigned char *this_arg;
482433e5a2f7SJohannes Berg 	int this_arg_index;
482533e5a2f7SJohannes Berg 	int this_arg_size;
482633e5a2f7SJohannes Berg 
482733e5a2f7SJohannes Berg 	int is_radiotap_ns;
482833e5a2f7SJohannes Berg 
482933e5a2f7SJohannes Berg 	int _max_length;
483033e5a2f7SJohannes Berg 	int _arg_index;
483133e5a2f7SJohannes Berg 	uint32_t _bitmap_shifter;
483233e5a2f7SJohannes Berg 	int _reset_on_ext;
4833d3236553SJohannes Berg };
4834d3236553SJohannes Berg 
483510dd9b7cSJoe Perches int
483610dd9b7cSJoe Perches ieee80211_radiotap_iterator_init(struct ieee80211_radiotap_iterator *iterator,
4837d3236553SJohannes Berg 				 struct ieee80211_radiotap_header *radiotap_header,
483810dd9b7cSJoe Perches 				 int max_length,
483910dd9b7cSJoe Perches 				 const struct ieee80211_radiotap_vendor_namespaces *vns);
4840d3236553SJohannes Berg 
484110dd9b7cSJoe Perches int
484210dd9b7cSJoe Perches ieee80211_radiotap_iterator_next(struct ieee80211_radiotap_iterator *iterator);
4843d3236553SJohannes Berg 
484433e5a2f7SJohannes Berg 
4845e31a16d6SZhu Yi extern const unsigned char rfc1042_header[6];
4846e31a16d6SZhu Yi extern const unsigned char bridge_tunnel_header[6];
4847e31a16d6SZhu Yi 
4848e31a16d6SZhu Yi /**
4849e31a16d6SZhu Yi  * ieee80211_get_hdrlen_from_skb - get header length from data
4850e31a16d6SZhu Yi  *
4851e31a16d6SZhu Yi  * @skb: the frame
48520ae997dcSYacine Belkadi  *
48530ae997dcSYacine Belkadi  * Given an skb with a raw 802.11 header at the data pointer this function
48540ae997dcSYacine Belkadi  * returns the 802.11 header length.
48550ae997dcSYacine Belkadi  *
48560ae997dcSYacine Belkadi  * Return: The 802.11 header length in bytes (not including encryption
48570ae997dcSYacine Belkadi  * headers). Or 0 if the data in the sk_buff is too short to contain a valid
48580ae997dcSYacine Belkadi  * 802.11 header.
4859e31a16d6SZhu Yi  */
4860e31a16d6SZhu Yi unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb);
4861e31a16d6SZhu Yi 
4862e31a16d6SZhu Yi /**
4863e31a16d6SZhu Yi  * ieee80211_hdrlen - get header length in bytes from frame control
4864e31a16d6SZhu Yi  * @fc: frame control field in little-endian format
48650ae997dcSYacine Belkadi  * Return: The header length in bytes.
4866e31a16d6SZhu Yi  */
4867633adf1aSJohannes Berg unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc);
4868e31a16d6SZhu Yi 
4869e31a16d6SZhu Yi /**
48709b395bc3SJohannes Berg  * ieee80211_get_mesh_hdrlen - get mesh extension header length
48719b395bc3SJohannes Berg  * @meshhdr: the mesh extension header, only the flags field
48729b395bc3SJohannes Berg  *	(first byte) will be accessed
48730ae997dcSYacine Belkadi  * Return: The length of the extension header, which is always at
48749b395bc3SJohannes Berg  * least 6 bytes and at most 18 if address 5 and 6 are present.
48759b395bc3SJohannes Berg  */
48769b395bc3SJohannes Berg unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr);
48779b395bc3SJohannes Berg 
48789b395bc3SJohannes Berg /**
4879d70e9693SJohannes Berg  * DOC: Data path helpers
4880d70e9693SJohannes Berg  *
4881d70e9693SJohannes Berg  * In addition to generic utilities, cfg80211 also offers
4882d70e9693SJohannes Berg  * functions that help implement the data path for devices
4883d70e9693SJohannes Berg  * that do not do the 802.11/802.3 conversion on the device.
4884d70e9693SJohannes Berg  */
4885d70e9693SJohannes Berg 
4886d70e9693SJohannes Berg /**
48877f6990c8SJohannes Berg  * ieee80211_data_to_8023_exthdr - convert an 802.11 data frame to 802.3
48887f6990c8SJohannes Berg  * @skb: the 802.11 data frame
48897f6990c8SJohannes Berg  * @ehdr: pointer to a &struct ethhdr that will get the header, instead
48907f6990c8SJohannes Berg  *	of it being pushed into the SKB
48917f6990c8SJohannes Berg  * @addr: the device MAC address
48927f6990c8SJohannes Berg  * @iftype: the virtual interface type
489324bba078SFelix Fietkau  * @data_offset: offset of payload after the 802.11 header
48947f6990c8SJohannes Berg  * Return: 0 on success. Non-zero on error.
48957f6990c8SJohannes Berg  */
48967f6990c8SJohannes Berg int ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr,
489724bba078SFelix Fietkau 				  const u8 *addr, enum nl80211_iftype iftype,
489824bba078SFelix Fietkau 				  u8 data_offset);
48997f6990c8SJohannes Berg 
49007f6990c8SJohannes Berg /**
4901e31a16d6SZhu Yi  * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3
4902e31a16d6SZhu Yi  * @skb: the 802.11 data frame
4903e31a16d6SZhu Yi  * @addr: the device MAC address
4904e31a16d6SZhu Yi  * @iftype: the virtual interface type
49050ae997dcSYacine Belkadi  * Return: 0 on success. Non-zero on error.
4906e31a16d6SZhu Yi  */
49077f6990c8SJohannes Berg static inline int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
49087f6990c8SJohannes Berg 					 enum nl80211_iftype iftype)
49097f6990c8SJohannes Berg {
491024bba078SFelix Fietkau 	return ieee80211_data_to_8023_exthdr(skb, NULL, addr, iftype, 0);
49117f6990c8SJohannes Berg }
4912e31a16d6SZhu Yi 
4913e31a16d6SZhu Yi /**
4914eaf85ca7SZhu Yi  * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame
4915eaf85ca7SZhu Yi  *
49167f6990c8SJohannes Berg  * Decode an IEEE 802.11 A-MSDU and convert it to a list of 802.3 frames.
49177f6990c8SJohannes Berg  * The @list will be empty if the decode fails. The @skb must be fully
49187f6990c8SJohannes Berg  * header-less before being passed in here; it is freed in this function.
4919eaf85ca7SZhu Yi  *
49207f6990c8SJohannes Berg  * @skb: The input A-MSDU frame without any headers.
4921eaf85ca7SZhu Yi  * @list: The output list of 802.3 frames. It must be allocated and
4922eaf85ca7SZhu Yi  *	initialized by by the caller.
4923eaf85ca7SZhu Yi  * @addr: The device MAC address.
4924eaf85ca7SZhu Yi  * @iftype: The device interface type.
4925eaf85ca7SZhu Yi  * @extra_headroom: The hardware extra headroom for SKBs in the @list.
49268b935ee2SJohannes Berg  * @check_da: DA to check in the inner ethernet header, or NULL
49278b935ee2SJohannes Berg  * @check_sa: SA to check in the inner ethernet header, or NULL
4928eaf85ca7SZhu Yi  */
4929eaf85ca7SZhu Yi void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,
4930eaf85ca7SZhu Yi 			      const u8 *addr, enum nl80211_iftype iftype,
49318b3becadSYogesh Ashok Powar 			      const unsigned int extra_headroom,
49328b935ee2SJohannes Berg 			      const u8 *check_da, const u8 *check_sa);
4933eaf85ca7SZhu Yi 
4934eaf85ca7SZhu Yi /**
4935e31a16d6SZhu Yi  * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame
4936e31a16d6SZhu Yi  * @skb: the data frame
4937fa9ffc74SKyeyoon Park  * @qos_map: Interworking QoS mapping or %NULL if not in use
49380ae997dcSYacine Belkadi  * Return: The 802.1p/1d tag.
4939e31a16d6SZhu Yi  */
4940fa9ffc74SKyeyoon Park unsigned int cfg80211_classify8021d(struct sk_buff *skb,
4941fa9ffc74SKyeyoon Park 				    struct cfg80211_qos_map *qos_map);
4942e31a16d6SZhu Yi 
4943c21dbf92SJohannes Berg /**
4944fbd05e4aSLuca Coelho  * cfg80211_find_ie_match - match information element and byte array in data
4945fbd05e4aSLuca Coelho  *
4946fbd05e4aSLuca Coelho  * @eid: element ID
4947fbd05e4aSLuca Coelho  * @ies: data consisting of IEs
4948fbd05e4aSLuca Coelho  * @len: length of data
4949fbd05e4aSLuca Coelho  * @match: byte array to match
4950fbd05e4aSLuca Coelho  * @match_len: number of bytes in the match array
4951fbd05e4aSLuca Coelho  * @match_offset: offset in the IE where the byte array should match.
4952fbd05e4aSLuca Coelho  *	If match_len is zero, this must also be set to zero.
4953fbd05e4aSLuca Coelho  *	Otherwise this must be set to 2 or more, because the first
4954fbd05e4aSLuca Coelho  *	byte is the element id, which is already compared to eid, and
4955fbd05e4aSLuca Coelho  *	the second byte is the IE length.
4956fbd05e4aSLuca Coelho  *
4957fbd05e4aSLuca Coelho  * Return: %NULL if the element ID could not be found or if
4958fbd05e4aSLuca Coelho  * the element is invalid (claims to be longer than the given
4959fbd05e4aSLuca Coelho  * data) or if the byte array doesn't match, or a pointer to the first
4960fbd05e4aSLuca Coelho  * byte of the requested element, that is the byte containing the
4961fbd05e4aSLuca Coelho  * element ID.
4962fbd05e4aSLuca Coelho  *
4963fbd05e4aSLuca Coelho  * Note: There are no checks on the element length other than
4964fbd05e4aSLuca Coelho  * having to fit into the given data and being large enough for the
4965fbd05e4aSLuca Coelho  * byte array to match.
4966fbd05e4aSLuca Coelho  */
4967fbd05e4aSLuca Coelho const u8 *cfg80211_find_ie_match(u8 eid, const u8 *ies, int len,
4968fbd05e4aSLuca Coelho 				 const u8 *match, int match_len,
4969fbd05e4aSLuca Coelho 				 int match_offset);
4970fbd05e4aSLuca Coelho 
4971fbd05e4aSLuca Coelho /**
4972c21dbf92SJohannes Berg  * cfg80211_find_ie - find information element in data
4973c21dbf92SJohannes Berg  *
4974c21dbf92SJohannes Berg  * @eid: element ID
4975c21dbf92SJohannes Berg  * @ies: data consisting of IEs
4976c21dbf92SJohannes Berg  * @len: length of data
4977c21dbf92SJohannes Berg  *
49780ae997dcSYacine Belkadi  * Return: %NULL if the element ID could not be found or if
49790ae997dcSYacine Belkadi  * the element is invalid (claims to be longer than the given
49800ae997dcSYacine Belkadi  * data), or a pointer to the first byte of the requested
49810ae997dcSYacine Belkadi  * element, that is the byte containing the element ID.
49820ae997dcSYacine Belkadi  *
49830ae997dcSYacine Belkadi  * Note: There are no checks on the element length other than
49840ae997dcSYacine Belkadi  * having to fit into the given data.
4985c21dbf92SJohannes Berg  */
4986fbd05e4aSLuca Coelho static inline const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len)
4987fbd05e4aSLuca Coelho {
4988fbd05e4aSLuca Coelho 	return cfg80211_find_ie_match(eid, ies, len, NULL, 0, 0);
4989fbd05e4aSLuca Coelho }
4990c21dbf92SJohannes Berg 
4991d70e9693SJohannes Berg /**
49923f817fe7SJouni Malinen  * cfg80211_find_ext_ie - find information element with EID Extension in data
49933f817fe7SJouni Malinen  *
49943f817fe7SJouni Malinen  * @ext_eid: element ID Extension
49953f817fe7SJouni Malinen  * @ies: data consisting of IEs
49963f817fe7SJouni Malinen  * @len: length of data
49973f817fe7SJouni Malinen  *
49983f817fe7SJouni Malinen  * Return: %NULL if the extended element ID could not be found or if
49993f817fe7SJouni Malinen  * the element is invalid (claims to be longer than the given
50003f817fe7SJouni Malinen  * data), or a pointer to the first byte of the requested
50013f817fe7SJouni Malinen  * element, that is the byte containing the element ID.
50023f817fe7SJouni Malinen  *
50033f817fe7SJouni Malinen  * Note: There are no checks on the element length other than
50043f817fe7SJouni Malinen  * having to fit into the given data.
50053f817fe7SJouni Malinen  */
50063f817fe7SJouni Malinen static inline const u8 *cfg80211_find_ext_ie(u8 ext_eid, const u8 *ies, int len)
50073f817fe7SJouni Malinen {
50083f817fe7SJouni Malinen 	return cfg80211_find_ie_match(WLAN_EID_EXTENSION, ies, len,
50093f817fe7SJouni Malinen 				      &ext_eid, 1, 2);
50103f817fe7SJouni Malinen }
50113f817fe7SJouni Malinen 
50123f817fe7SJouni Malinen /**
50130c28ec58SEliad Peller  * cfg80211_find_vendor_ie - find vendor specific information element in data
50140c28ec58SEliad Peller  *
50150c28ec58SEliad Peller  * @oui: vendor OUI
50169e9ea439SEmmanuel Grumbach  * @oui_type: vendor-specific OUI type (must be < 0xff), negative means any
50170c28ec58SEliad Peller  * @ies: data consisting of IEs
50180c28ec58SEliad Peller  * @len: length of data
50190c28ec58SEliad Peller  *
50200ae997dcSYacine Belkadi  * Return: %NULL if the vendor specific element ID could not be found or if the
50210ae997dcSYacine Belkadi  * element is invalid (claims to be longer than the given data), or a pointer to
50220ae997dcSYacine Belkadi  * the first byte of the requested element, that is the byte containing the
50230ae997dcSYacine Belkadi  * element ID.
50240ae997dcSYacine Belkadi  *
50250ae997dcSYacine Belkadi  * Note: There are no checks on the element length other than having to fit into
50260ae997dcSYacine Belkadi  * the given data.
50270c28ec58SEliad Peller  */
50289e9ea439SEmmanuel Grumbach const u8 *cfg80211_find_vendor_ie(unsigned int oui, int oui_type,
50290c28ec58SEliad Peller 				  const u8 *ies, int len);
50300c28ec58SEliad Peller 
50310c28ec58SEliad Peller /**
503230ca1aa5SDedy Lansky  * cfg80211_send_layer2_update - send layer 2 update frame
503330ca1aa5SDedy Lansky  *
503430ca1aa5SDedy Lansky  * @dev: network device
503530ca1aa5SDedy Lansky  * @addr: STA MAC address
503630ca1aa5SDedy Lansky  *
503730ca1aa5SDedy Lansky  * Wireless drivers can use this function to update forwarding tables in bridge
503830ca1aa5SDedy Lansky  * devices upon STA association.
503930ca1aa5SDedy Lansky  */
504030ca1aa5SDedy Lansky void cfg80211_send_layer2_update(struct net_device *dev, const u8 *addr);
504130ca1aa5SDedy Lansky 
504230ca1aa5SDedy Lansky /**
5043d70e9693SJohannes Berg  * DOC: Regulatory enforcement infrastructure
5044d70e9693SJohannes Berg  *
5045d70e9693SJohannes Berg  * TODO
5046d3236553SJohannes Berg  */
5047d3236553SJohannes Berg 
5048d3236553SJohannes Berg /**
5049d3236553SJohannes Berg  * regulatory_hint - driver hint to the wireless core a regulatory domain
5050d3236553SJohannes Berg  * @wiphy: the wireless device giving the hint (used only for reporting
5051d3236553SJohannes Berg  *	conflicts)
5052d3236553SJohannes Berg  * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain
5053d3236553SJohannes Berg  * 	should be in. If @rd is set this should be NULL. Note that if you
5054d3236553SJohannes Berg  * 	set this to NULL you should still set rd->alpha2 to some accepted
5055d3236553SJohannes Berg  * 	alpha2.
5056d3236553SJohannes Berg  *
5057d3236553SJohannes Berg  * Wireless drivers can use this function to hint to the wireless core
5058d3236553SJohannes Berg  * what it believes should be the current regulatory domain by
5059d3236553SJohannes Berg  * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory
5060d3236553SJohannes Berg  * domain should be in or by providing a completely build regulatory domain.
5061d3236553SJohannes Berg  * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried
5062d3236553SJohannes Berg  * for a regulatory domain structure for the respective country.
5063d3236553SJohannes Berg  *
5064d3236553SJohannes Berg  * The wiphy must have been registered to cfg80211 prior to this call.
5065d3236553SJohannes Berg  * For cfg80211 drivers this means you must first use wiphy_register(),
5066d3236553SJohannes Berg  * for mac80211 drivers you must first use ieee80211_register_hw().
5067d3236553SJohannes Berg  *
5068d3236553SJohannes Berg  * Drivers should check the return value, its possible you can get
5069d3236553SJohannes Berg  * an -ENOMEM.
50700ae997dcSYacine Belkadi  *
50710ae997dcSYacine Belkadi  * Return: 0 on success. -ENOMEM.
5072d3236553SJohannes Berg  */
507310dd9b7cSJoe Perches int regulatory_hint(struct wiphy *wiphy, const char *alpha2);
5074d3236553SJohannes Berg 
5075d3236553SJohannes Berg /**
5076b0d7aa59SJonathan Doron  * regulatory_set_wiphy_regd - set regdom info for self managed drivers
5077b0d7aa59SJonathan Doron  * @wiphy: the wireless device we want to process the regulatory domain on
5078b0d7aa59SJonathan Doron  * @rd: the regulatory domain informatoin to use for this wiphy
5079b0d7aa59SJonathan Doron  *
5080b0d7aa59SJonathan Doron  * Set the regulatory domain information for self-managed wiphys, only they
5081b0d7aa59SJonathan Doron  * may use this function. See %REGULATORY_WIPHY_SELF_MANAGED for more
5082b0d7aa59SJonathan Doron  * information.
5083b0d7aa59SJonathan Doron  *
5084b0d7aa59SJonathan Doron  * Return: 0 on success. -EINVAL, -EPERM
5085b0d7aa59SJonathan Doron  */
5086b0d7aa59SJonathan Doron int regulatory_set_wiphy_regd(struct wiphy *wiphy,
5087b0d7aa59SJonathan Doron 			      struct ieee80211_regdomain *rd);
5088b0d7aa59SJonathan Doron 
5089b0d7aa59SJonathan Doron /**
50902c3e861cSArik Nemtsov  * regulatory_set_wiphy_regd_sync_rtnl - set regdom for self-managed drivers
50912c3e861cSArik Nemtsov  * @wiphy: the wireless device we want to process the regulatory domain on
50922c3e861cSArik Nemtsov  * @rd: the regulatory domain information to use for this wiphy
50932c3e861cSArik Nemtsov  *
50942c3e861cSArik Nemtsov  * This functions requires the RTNL to be held and applies the new regdomain
50952c3e861cSArik Nemtsov  * synchronously to this wiphy. For more details see
50962c3e861cSArik Nemtsov  * regulatory_set_wiphy_regd().
50972c3e861cSArik Nemtsov  *
50982c3e861cSArik Nemtsov  * Return: 0 on success. -EINVAL, -EPERM
50992c3e861cSArik Nemtsov  */
51002c3e861cSArik Nemtsov int regulatory_set_wiphy_regd_sync_rtnl(struct wiphy *wiphy,
51012c3e861cSArik Nemtsov 					struct ieee80211_regdomain *rd);
51022c3e861cSArik Nemtsov 
51032c3e861cSArik Nemtsov /**
5104d3236553SJohannes Berg  * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain
5105d3236553SJohannes Berg  * @wiphy: the wireless device we want to process the regulatory domain on
5106d3236553SJohannes Berg  * @regd: the custom regulatory domain to use for this wiphy
5107d3236553SJohannes Berg  *
5108d3236553SJohannes Berg  * Drivers can sometimes have custom regulatory domains which do not apply
5109d3236553SJohannes Berg  * to a specific country. Drivers can use this to apply such custom regulatory
5110d3236553SJohannes Berg  * domains. This routine must be called prior to wiphy registration. The
5111d3236553SJohannes Berg  * custom regulatory domain will be trusted completely and as such previous
5112d3236553SJohannes Berg  * default channel settings will be disregarded. If no rule is found for a
5113d3236553SJohannes Berg  * channel on the regulatory domain the channel will be disabled.
5114222ea581SLuis R. Rodriguez  * Drivers using this for a wiphy should also set the wiphy flag
5115ce26151bSKalle Valo  * REGULATORY_CUSTOM_REG or cfg80211 will set it for the wiphy
5116222ea581SLuis R. Rodriguez  * that called this helper.
5117d3236553SJohannes Berg  */
511810dd9b7cSJoe Perches void wiphy_apply_custom_regulatory(struct wiphy *wiphy,
5119d3236553SJohannes Berg 				   const struct ieee80211_regdomain *regd);
5120d3236553SJohannes Berg 
5121d3236553SJohannes Berg /**
5122d3236553SJohannes Berg  * freq_reg_info - get regulatory information for the given frequency
5123d3236553SJohannes Berg  * @wiphy: the wiphy for which we want to process this rule for
5124d3236553SJohannes Berg  * @center_freq: Frequency in KHz for which we want regulatory information for
5125d3236553SJohannes Berg  *
5126d3236553SJohannes Berg  * Use this function to get the regulatory rule for a specific frequency on
5127d3236553SJohannes Berg  * a given wireless device. If the device has a specific regulatory domain
5128d3236553SJohannes Berg  * it wants to follow we respect that unless a country IE has been received
5129d3236553SJohannes Berg  * and processed already.
5130d3236553SJohannes Berg  *
51310ae997dcSYacine Belkadi  * Return: A valid pointer, or, when an error occurs, for example if no rule
51320ae997dcSYacine Belkadi  * can be found, the return value is encoded using ERR_PTR(). Use IS_ERR() to
51330ae997dcSYacine Belkadi  * check and PTR_ERR() to obtain the numeric return value. The numeric return
51340ae997dcSYacine Belkadi  * value will be -ERANGE if we determine the given center_freq does not even
51350ae997dcSYacine Belkadi  * have a regulatory rule for a frequency range in the center_freq's band.
51360ae997dcSYacine Belkadi  * See freq_in_rule_band() for our current definition of a band -- this is
51370ae997dcSYacine Belkadi  * purely subjective and right now it's 802.11 specific.
5138d3236553SJohannes Berg  */
5139361c9c8bSJohannes Berg const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy,
5140361c9c8bSJohannes Berg 					       u32 center_freq);
5141d3236553SJohannes Berg 
5142034c6d6eSLuis R. Rodriguez /**
5143034c6d6eSLuis R. Rodriguez  * reg_initiator_name - map regulatory request initiator enum to name
5144034c6d6eSLuis R. Rodriguez  * @initiator: the regulatory request initiator
5145034c6d6eSLuis R. Rodriguez  *
5146034c6d6eSLuis R. Rodriguez  * You can use this to map the regulatory request initiator enum to a
5147034c6d6eSLuis R. Rodriguez  * proper string representation.
5148034c6d6eSLuis R. Rodriguez  */
5149034c6d6eSLuis R. Rodriguez const char *reg_initiator_name(enum nl80211_reg_initiator initiator);
5150034c6d6eSLuis R. Rodriguez 
515119d3577eSHaim Dreyfuss /**
515219d3577eSHaim Dreyfuss  * DOC: Internal regulatory db functions
515319d3577eSHaim Dreyfuss  *
515419d3577eSHaim Dreyfuss  */
515519d3577eSHaim Dreyfuss 
515619d3577eSHaim Dreyfuss /**
515719d3577eSHaim Dreyfuss  * reg_query_regdb_wmm -  Query internal regulatory db for wmm rule
515819d3577eSHaim Dreyfuss  * Regulatory self-managed driver can use it to proactively
515919d3577eSHaim Dreyfuss  *
516019d3577eSHaim Dreyfuss  * @alpha2: the ISO/IEC 3166 alpha2 wmm rule to be queried.
516119d3577eSHaim Dreyfuss  * @freq: the freqency(in MHz) to be queried.
516219d3577eSHaim Dreyfuss  * @rule: pointer to store the wmm rule from the regulatory db.
516319d3577eSHaim Dreyfuss  *
516419d3577eSHaim Dreyfuss  * Self-managed wireless drivers can use this function to  query
516519d3577eSHaim Dreyfuss  * the internal regulatory database to check whether the given
516619d3577eSHaim Dreyfuss  * ISO/IEC 3166 alpha2 country and freq have wmm rule limitations.
516719d3577eSHaim Dreyfuss  *
516819d3577eSHaim Dreyfuss  * Drivers should check the return value, its possible you can get
516919d3577eSHaim Dreyfuss  * an -ENODATA.
517019d3577eSHaim Dreyfuss  *
517119d3577eSHaim Dreyfuss  * Return: 0 on success. -ENODATA.
517219d3577eSHaim Dreyfuss  */
517338cb87eeSStanislaw Gruszka int reg_query_regdb_wmm(char *alpha2, int freq,
517438cb87eeSStanislaw Gruszka 			struct ieee80211_reg_rule *rule);
517519d3577eSHaim Dreyfuss 
5176d3236553SJohannes Berg /*
5177d3236553SJohannes Berg  * callbacks for asynchronous cfg80211 methods, notification
5178d3236553SJohannes Berg  * functions and BSS handling helpers
5179d3236553SJohannes Berg  */
5180d3236553SJohannes Berg 
51812a519311SJohannes Berg /**
51822a519311SJohannes Berg  * cfg80211_scan_done - notify that scan finished
51832a519311SJohannes Berg  *
51842a519311SJohannes Berg  * @request: the corresponding scan request
51851d76250bSAvraham Stern  * @info: information about the completed scan
51862a519311SJohannes Berg  */
51871d76250bSAvraham Stern void cfg80211_scan_done(struct cfg80211_scan_request *request,
51881d76250bSAvraham Stern 			struct cfg80211_scan_info *info);
51892a519311SJohannes Berg 
51902a519311SJohannes Berg /**
5191807f8a8cSLuciano Coelho  * cfg80211_sched_scan_results - notify that new scan results are available
5192807f8a8cSLuciano Coelho  *
5193807f8a8cSLuciano Coelho  * @wiphy: the wiphy which got scheduled scan results
5194b34939b9SArend Van Spriel  * @reqid: identifier for the related scheduled scan request
5195807f8a8cSLuciano Coelho  */
5196b34939b9SArend Van Spriel void cfg80211_sched_scan_results(struct wiphy *wiphy, u64 reqid);
5197807f8a8cSLuciano Coelho 
5198807f8a8cSLuciano Coelho /**
5199807f8a8cSLuciano Coelho  * cfg80211_sched_scan_stopped - notify that the scheduled scan has stopped
5200807f8a8cSLuciano Coelho  *
5201807f8a8cSLuciano Coelho  * @wiphy: the wiphy on which the scheduled scan stopped
5202b34939b9SArend Van Spriel  * @reqid: identifier for the related scheduled scan request
5203807f8a8cSLuciano Coelho  *
5204807f8a8cSLuciano Coelho  * The driver can call this function to inform cfg80211 that the
5205807f8a8cSLuciano Coelho  * scheduled scan had to be stopped, for whatever reason.  The driver
5206807f8a8cSLuciano Coelho  * is then called back via the sched_scan_stop operation when done.
5207807f8a8cSLuciano Coelho  */
5208b34939b9SArend Van Spriel void cfg80211_sched_scan_stopped(struct wiphy *wiphy, u64 reqid);
5209807f8a8cSLuciano Coelho 
5210807f8a8cSLuciano Coelho /**
5211792e6aa7SEliad Peller  * cfg80211_sched_scan_stopped_rtnl - notify that the scheduled scan has stopped
5212792e6aa7SEliad Peller  *
5213792e6aa7SEliad Peller  * @wiphy: the wiphy on which the scheduled scan stopped
5214b34939b9SArend Van Spriel  * @reqid: identifier for the related scheduled scan request
5215792e6aa7SEliad Peller  *
5216792e6aa7SEliad Peller  * The driver can call this function to inform cfg80211 that the
5217792e6aa7SEliad Peller  * scheduled scan had to be stopped, for whatever reason.  The driver
5218792e6aa7SEliad Peller  * is then called back via the sched_scan_stop operation when done.
5219792e6aa7SEliad Peller  * This function should be called with rtnl locked.
5220792e6aa7SEliad Peller  */
5221b34939b9SArend Van Spriel void cfg80211_sched_scan_stopped_rtnl(struct wiphy *wiphy, u64 reqid);
5222792e6aa7SEliad Peller 
5223792e6aa7SEliad Peller /**
52246e19bc4bSDmitry Shmidt  * cfg80211_inform_bss_frame_data - inform cfg80211 of a received BSS frame
52252a519311SJohannes Berg  * @wiphy: the wiphy reporting the BSS
52266e19bc4bSDmitry Shmidt  * @data: the BSS metadata
5227abe37c4bSJohannes Berg  * @mgmt: the management frame (probe response or beacon)
5228abe37c4bSJohannes Berg  * @len: length of the management frame
52292a519311SJohannes Berg  * @gfp: context flags
52302a519311SJohannes Berg  *
52312a519311SJohannes Berg  * This informs cfg80211 that BSS information was found and
52322a519311SJohannes Berg  * the BSS should be updated/added.
5233ef100682SJohannes Berg  *
52340ae997dcSYacine Belkadi  * Return: A referenced struct, must be released with cfg80211_put_bss()!
52350ae997dcSYacine Belkadi  * Or %NULL on error.
52362a519311SJohannes Berg  */
5237ef100682SJohannes Berg struct cfg80211_bss * __must_check
52386e19bc4bSDmitry Shmidt cfg80211_inform_bss_frame_data(struct wiphy *wiphy,
52396e19bc4bSDmitry Shmidt 			       struct cfg80211_inform_bss *data,
52406e19bc4bSDmitry Shmidt 			       struct ieee80211_mgmt *mgmt, size_t len,
52416e19bc4bSDmitry Shmidt 			       gfp_t gfp);
52426e19bc4bSDmitry Shmidt 
52436e19bc4bSDmitry Shmidt static inline struct cfg80211_bss * __must_check
5244dcd6eac1SSimon Wunderlich cfg80211_inform_bss_width_frame(struct wiphy *wiphy,
52453afc2167SEmmanuel Grumbach 				struct ieee80211_channel *rx_channel,
5246dcd6eac1SSimon Wunderlich 				enum nl80211_bss_scan_width scan_width,
5247dcd6eac1SSimon Wunderlich 				struct ieee80211_mgmt *mgmt, size_t len,
52486e19bc4bSDmitry Shmidt 				s32 signal, gfp_t gfp)
52496e19bc4bSDmitry Shmidt {
52506e19bc4bSDmitry Shmidt 	struct cfg80211_inform_bss data = {
52516e19bc4bSDmitry Shmidt 		.chan = rx_channel,
52526e19bc4bSDmitry Shmidt 		.scan_width = scan_width,
52536e19bc4bSDmitry Shmidt 		.signal = signal,
52546e19bc4bSDmitry Shmidt 	};
52556e19bc4bSDmitry Shmidt 
52566e19bc4bSDmitry Shmidt 	return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp);
52576e19bc4bSDmitry Shmidt }
5258dcd6eac1SSimon Wunderlich 
5259dcd6eac1SSimon Wunderlich static inline struct cfg80211_bss * __must_check
52602a519311SJohannes Berg cfg80211_inform_bss_frame(struct wiphy *wiphy,
52613afc2167SEmmanuel Grumbach 			  struct ieee80211_channel *rx_channel,
52622a519311SJohannes Berg 			  struct ieee80211_mgmt *mgmt, size_t len,
5263dcd6eac1SSimon Wunderlich 			  s32 signal, gfp_t gfp)
5264dcd6eac1SSimon Wunderlich {
52656e19bc4bSDmitry Shmidt 	struct cfg80211_inform_bss data = {
52666e19bc4bSDmitry Shmidt 		.chan = rx_channel,
52676e19bc4bSDmitry Shmidt 		.scan_width = NL80211_BSS_CHAN_WIDTH_20,
52686e19bc4bSDmitry Shmidt 		.signal = signal,
52696e19bc4bSDmitry Shmidt 	};
52706e19bc4bSDmitry Shmidt 
52716e19bc4bSDmitry Shmidt 	return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp);
5272dcd6eac1SSimon Wunderlich }
52732a519311SJohannes Berg 
5274abe37c4bSJohannes Berg /**
52755bc8c1f2SJohannes Berg  * enum cfg80211_bss_frame_type - frame type that the BSS data came from
52765bc8c1f2SJohannes Berg  * @CFG80211_BSS_FTYPE_UNKNOWN: driver doesn't know whether the data is
52775bc8c1f2SJohannes Berg  *	from a beacon or probe response
52785bc8c1f2SJohannes Berg  * @CFG80211_BSS_FTYPE_BEACON: data comes from a beacon
52795bc8c1f2SJohannes Berg  * @CFG80211_BSS_FTYPE_PRESP: data comes from a probe response
52805bc8c1f2SJohannes Berg  */
52815bc8c1f2SJohannes Berg enum cfg80211_bss_frame_type {
52825bc8c1f2SJohannes Berg 	CFG80211_BSS_FTYPE_UNKNOWN,
52835bc8c1f2SJohannes Berg 	CFG80211_BSS_FTYPE_BEACON,
52845bc8c1f2SJohannes Berg 	CFG80211_BSS_FTYPE_PRESP,
52855bc8c1f2SJohannes Berg };
52865bc8c1f2SJohannes Berg 
52875bc8c1f2SJohannes Berg /**
52886e19bc4bSDmitry Shmidt  * cfg80211_inform_bss_data - inform cfg80211 of a new BSS
5289abe37c4bSJohannes Berg  *
5290abe37c4bSJohannes Berg  * @wiphy: the wiphy reporting the BSS
52916e19bc4bSDmitry Shmidt  * @data: the BSS metadata
52925bc8c1f2SJohannes Berg  * @ftype: frame type (if known)
5293abe37c4bSJohannes Berg  * @bssid: the BSSID of the BSS
52947b8bcff2SJohannes Berg  * @tsf: the TSF sent by the peer in the beacon/probe response (or 0)
5295abe37c4bSJohannes Berg  * @capability: the capability field sent by the peer
5296abe37c4bSJohannes Berg  * @beacon_interval: the beacon interval announced by the peer
5297abe37c4bSJohannes Berg  * @ie: additional IEs sent by the peer
5298abe37c4bSJohannes Berg  * @ielen: length of the additional IEs
5299abe37c4bSJohannes Berg  * @gfp: context flags
5300abe37c4bSJohannes Berg  *
5301abe37c4bSJohannes Berg  * This informs cfg80211 that BSS information was found and
5302abe37c4bSJohannes Berg  * the BSS should be updated/added.
5303ef100682SJohannes Berg  *
53040ae997dcSYacine Belkadi  * Return: A referenced struct, must be released with cfg80211_put_bss()!
53050ae997dcSYacine Belkadi  * Or %NULL on error.
5306abe37c4bSJohannes Berg  */
5307ef100682SJohannes Berg struct cfg80211_bss * __must_check
53086e19bc4bSDmitry Shmidt cfg80211_inform_bss_data(struct wiphy *wiphy,
53096e19bc4bSDmitry Shmidt 			 struct cfg80211_inform_bss *data,
53106e19bc4bSDmitry Shmidt 			 enum cfg80211_bss_frame_type ftype,
53116e19bc4bSDmitry Shmidt 			 const u8 *bssid, u64 tsf, u16 capability,
53126e19bc4bSDmitry Shmidt 			 u16 beacon_interval, const u8 *ie, size_t ielen,
53136e19bc4bSDmitry Shmidt 			 gfp_t gfp);
53146e19bc4bSDmitry Shmidt 
53156e19bc4bSDmitry Shmidt static inline struct cfg80211_bss * __must_check
5316dcd6eac1SSimon Wunderlich cfg80211_inform_bss_width(struct wiphy *wiphy,
53173afc2167SEmmanuel Grumbach 			  struct ieee80211_channel *rx_channel,
5318dcd6eac1SSimon Wunderlich 			  enum nl80211_bss_scan_width scan_width,
53195bc8c1f2SJohannes Berg 			  enum cfg80211_bss_frame_type ftype,
5320dcd6eac1SSimon Wunderlich 			  const u8 *bssid, u64 tsf, u16 capability,
5321dcd6eac1SSimon Wunderlich 			  u16 beacon_interval, const u8 *ie, size_t ielen,
53226e19bc4bSDmitry Shmidt 			  s32 signal, gfp_t gfp)
53236e19bc4bSDmitry Shmidt {
53246e19bc4bSDmitry Shmidt 	struct cfg80211_inform_bss data = {
53256e19bc4bSDmitry Shmidt 		.chan = rx_channel,
53266e19bc4bSDmitry Shmidt 		.scan_width = scan_width,
53276e19bc4bSDmitry Shmidt 		.signal = signal,
53286e19bc4bSDmitry Shmidt 	};
53296e19bc4bSDmitry Shmidt 
53306e19bc4bSDmitry Shmidt 	return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf,
53316e19bc4bSDmitry Shmidt 					capability, beacon_interval, ie, ielen,
53326e19bc4bSDmitry Shmidt 					gfp);
53336e19bc4bSDmitry Shmidt }
5334dcd6eac1SSimon Wunderlich 
5335dcd6eac1SSimon Wunderlich static inline struct cfg80211_bss * __must_check
533606aa7afaSJussi Kivilinna cfg80211_inform_bss(struct wiphy *wiphy,
53373afc2167SEmmanuel Grumbach 		    struct ieee80211_channel *rx_channel,
53385bc8c1f2SJohannes Berg 		    enum cfg80211_bss_frame_type ftype,
53397b8bcff2SJohannes Berg 		    const u8 *bssid, u64 tsf, u16 capability,
53407b8bcff2SJohannes Berg 		    u16 beacon_interval, const u8 *ie, size_t ielen,
5341dcd6eac1SSimon Wunderlich 		    s32 signal, gfp_t gfp)
5342dcd6eac1SSimon Wunderlich {
53436e19bc4bSDmitry Shmidt 	struct cfg80211_inform_bss data = {
53446e19bc4bSDmitry Shmidt 		.chan = rx_channel,
53456e19bc4bSDmitry Shmidt 		.scan_width = NL80211_BSS_CHAN_WIDTH_20,
53466e19bc4bSDmitry Shmidt 		.signal = signal,
53476e19bc4bSDmitry Shmidt 	};
53486e19bc4bSDmitry Shmidt 
53496e19bc4bSDmitry Shmidt 	return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf,
53506e19bc4bSDmitry Shmidt 					capability, beacon_interval, ie, ielen,
5351dcd6eac1SSimon Wunderlich 					gfp);
5352dcd6eac1SSimon Wunderlich }
535306aa7afaSJussi Kivilinna 
535427548677SJohannes Berg /**
535527548677SJohannes Berg  * cfg80211_get_bss - get a BSS reference
535627548677SJohannes Berg  * @wiphy: the wiphy this BSS struct belongs to
535727548677SJohannes Berg  * @channel: the channel to search on (or %NULL)
535827548677SJohannes Berg  * @bssid: the desired BSSID (or %NULL)
535927548677SJohannes Berg  * @ssid: the desired SSID (or %NULL)
536027548677SJohannes Berg  * @ssid_len: length of the SSID (or 0)
536127548677SJohannes Berg  * @bss_type: type of BSS, see &enum ieee80211_bss_type
536227548677SJohannes Berg  * @privacy: privacy filter, see &enum ieee80211_privacy
536327548677SJohannes Berg  */
53642a519311SJohannes Berg struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
53652a519311SJohannes Berg 				      struct ieee80211_channel *channel,
53662a519311SJohannes Berg 				      const u8 *bssid,
536779420f09SJohannes Berg 				      const u8 *ssid, size_t ssid_len,
53686eb18137SDedy Lansky 				      enum ieee80211_bss_type bss_type,
536927548677SJohannes Berg 				      enum ieee80211_privacy privacy);
537079420f09SJohannes Berg static inline struct cfg80211_bss *
537179420f09SJohannes Berg cfg80211_get_ibss(struct wiphy *wiphy,
537279420f09SJohannes Berg 		  struct ieee80211_channel *channel,
537379420f09SJohannes Berg 		  const u8 *ssid, size_t ssid_len)
537479420f09SJohannes Berg {
537579420f09SJohannes Berg 	return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len,
53766eb18137SDedy Lansky 				IEEE80211_BSS_TYPE_IBSS,
53776eb18137SDedy Lansky 				IEEE80211_PRIVACY_ANY);
537879420f09SJohannes Berg }
537979420f09SJohannes Berg 
53804c0c0b75SJohannes Berg /**
53814c0c0b75SJohannes Berg  * cfg80211_ref_bss - reference BSS struct
53825b112d3dSJohannes Berg  * @wiphy: the wiphy this BSS struct belongs to
53834c0c0b75SJohannes Berg  * @bss: the BSS struct to reference
53844c0c0b75SJohannes Berg  *
53854c0c0b75SJohannes Berg  * Increments the refcount of the given BSS struct.
53864c0c0b75SJohannes Berg  */
53875b112d3dSJohannes Berg void cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
53884c0c0b75SJohannes Berg 
53894c0c0b75SJohannes Berg /**
53904c0c0b75SJohannes Berg  * cfg80211_put_bss - unref BSS struct
53915b112d3dSJohannes Berg  * @wiphy: the wiphy this BSS struct belongs to
53924c0c0b75SJohannes Berg  * @bss: the BSS struct
53934c0c0b75SJohannes Berg  *
53944c0c0b75SJohannes Berg  * Decrements the refcount of the given BSS struct.
53954c0c0b75SJohannes Berg  */
53965b112d3dSJohannes Berg void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
5397d3236553SJohannes Berg 
5398d491af19SJohannes Berg /**
5399d491af19SJohannes Berg  * cfg80211_unlink_bss - unlink BSS from internal data structures
5400d491af19SJohannes Berg  * @wiphy: the wiphy
5401d491af19SJohannes Berg  * @bss: the bss to remove
5402d491af19SJohannes Berg  *
5403d491af19SJohannes Berg  * This function removes the given BSS from the internal data structures
5404d491af19SJohannes Berg  * thereby making it no longer show up in scan results etc. Use this
5405d491af19SJohannes Berg  * function when you detect a BSS is gone. Normally BSSes will also time
5406d491af19SJohannes Berg  * out, so it is not necessary to use this function at all.
5407d491af19SJohannes Berg  */
5408d491af19SJohannes Berg void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
5409fee52678SJohannes Berg 
5410dcd6eac1SSimon Wunderlich static inline enum nl80211_bss_scan_width
5411dcd6eac1SSimon Wunderlich cfg80211_chandef_to_scan_width(const struct cfg80211_chan_def *chandef)
5412dcd6eac1SSimon Wunderlich {
5413dcd6eac1SSimon Wunderlich 	switch (chandef->width) {
5414dcd6eac1SSimon Wunderlich 	case NL80211_CHAN_WIDTH_5:
5415dcd6eac1SSimon Wunderlich 		return NL80211_BSS_CHAN_WIDTH_5;
5416dcd6eac1SSimon Wunderlich 	case NL80211_CHAN_WIDTH_10:
5417dcd6eac1SSimon Wunderlich 		return NL80211_BSS_CHAN_WIDTH_10;
5418dcd6eac1SSimon Wunderlich 	default:
5419dcd6eac1SSimon Wunderlich 		return NL80211_BSS_CHAN_WIDTH_20;
5420dcd6eac1SSimon Wunderlich 	}
5421dcd6eac1SSimon Wunderlich }
5422dcd6eac1SSimon Wunderlich 
54236039f6d2SJouni Malinen /**
54246ff57cf8SJohannes Berg  * cfg80211_rx_mlme_mgmt - notification of processed MLME management frame
54256039f6d2SJouni Malinen  * @dev: network device
54266039f6d2SJouni Malinen  * @buf: authentication frame (header + body)
54276039f6d2SJouni Malinen  * @len: length of the frame data
54286039f6d2SJouni Malinen  *
54296ff57cf8SJohannes Berg  * This function is called whenever an authentication, disassociation or
54306ff57cf8SJohannes Berg  * deauthentication frame has been received and processed in station mode.
54316ff57cf8SJohannes Berg  * After being asked to authenticate via cfg80211_ops::auth() the driver must
54326ff57cf8SJohannes Berg  * call either this function or cfg80211_auth_timeout().
54336ff57cf8SJohannes Berg  * After being asked to associate via cfg80211_ops::assoc() the driver must
54346ff57cf8SJohannes Berg  * call either this function or cfg80211_auth_timeout().
54356ff57cf8SJohannes Berg  * While connected, the driver must calls this for received and processed
54366ff57cf8SJohannes Berg  * disassociation and deauthentication frames. If the frame couldn't be used
54376ff57cf8SJohannes Berg  * because it was unprotected, the driver must call the function
54386ff57cf8SJohannes Berg  * cfg80211_rx_unprot_mlme_mgmt() instead.
54396ff57cf8SJohannes Berg  *
54406ff57cf8SJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's mutex.
54416039f6d2SJouni Malinen  */
54426ff57cf8SJohannes Berg void cfg80211_rx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len);
54436039f6d2SJouni Malinen 
54446039f6d2SJouni Malinen /**
54456ff57cf8SJohannes Berg  * cfg80211_auth_timeout - notification of timed out authentication
54461965c853SJouni Malinen  * @dev: network device
54471965c853SJouni Malinen  * @addr: The MAC address of the device with which the authentication timed out
5448cb0b4bebSJohannes Berg  *
54498d61ffa5SJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's
54508d61ffa5SJohannes Berg  * mutex.
54511965c853SJouni Malinen  */
54526ff57cf8SJohannes Berg void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr);
54531965c853SJouni Malinen 
54541965c853SJouni Malinen /**
54556ff57cf8SJohannes Berg  * cfg80211_rx_assoc_resp - notification of processed association response
54566039f6d2SJouni Malinen  * @dev: network device
54576ff57cf8SJohannes Berg  * @bss: the BSS that association was requested with, ownership of the pointer
54586ff57cf8SJohannes Berg  *	moves to cfg80211 in this call
54596ff57cf8SJohannes Berg  * @buf: authentication frame (header + body)
54606039f6d2SJouni Malinen  * @len: length of the frame data
5461f438ceb8SEmmanuel Grumbach  * @uapsd_queues: bitmap of queues configured for uapsd. Same format
5462f438ceb8SEmmanuel Grumbach  *	as the AC bitmap in the QoS info field
54636039f6d2SJouni Malinen  *
54646ff57cf8SJohannes Berg  * After being asked to associate via cfg80211_ops::assoc() the driver must
54656ff57cf8SJohannes Berg  * call either this function or cfg80211_auth_timeout().
54666ff57cf8SJohannes Berg  *
54676ff57cf8SJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's mutex.
54686039f6d2SJouni Malinen  */
54696ff57cf8SJohannes Berg void cfg80211_rx_assoc_resp(struct net_device *dev,
54706ff57cf8SJohannes Berg 			    struct cfg80211_bss *bss,
5471b0b6aa2cSEliad Peller 			    const u8 *buf, size_t len,
5472b0b6aa2cSEliad Peller 			    int uapsd_queues);
54736039f6d2SJouni Malinen 
54746039f6d2SJouni Malinen /**
54756ff57cf8SJohannes Berg  * cfg80211_assoc_timeout - notification of timed out association
54761965c853SJouni Malinen  * @dev: network device
5477959867faSJohannes Berg  * @bss: The BSS entry with which association timed out.
5478cb0b4bebSJohannes Berg  *
54798d61ffa5SJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's mutex.
54801965c853SJouni Malinen  */
5481959867faSJohannes Berg void cfg80211_assoc_timeout(struct net_device *dev, struct cfg80211_bss *bss);
54821965c853SJouni Malinen 
54831965c853SJouni Malinen /**
5484e6f462dfSJohannes Berg  * cfg80211_abandon_assoc - notify cfg80211 of abandoned association attempt
5485e6f462dfSJohannes Berg  * @dev: network device
5486e6f462dfSJohannes Berg  * @bss: The BSS entry with which association was abandoned.
5487e6f462dfSJohannes Berg  *
5488e6f462dfSJohannes Berg  * Call this whenever - for reasons reported through other API, like deauth RX,
5489e6f462dfSJohannes Berg  * an association attempt was abandoned.
5490e6f462dfSJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's mutex.
5491e6f462dfSJohannes Berg  */
5492e6f462dfSJohannes Berg void cfg80211_abandon_assoc(struct net_device *dev, struct cfg80211_bss *bss);
5493e6f462dfSJohannes Berg 
5494e6f462dfSJohannes Berg /**
54956ff57cf8SJohannes Berg  * cfg80211_tx_mlme_mgmt - notification of transmitted deauth/disassoc frame
54966039f6d2SJouni Malinen  * @dev: network device
54976ff57cf8SJohannes Berg  * @buf: 802.11 frame (header + body)
54986039f6d2SJouni Malinen  * @len: length of the frame data
54996039f6d2SJouni Malinen  *
55006039f6d2SJouni Malinen  * This function is called whenever deauthentication has been processed in
550153b46b84SJouni Malinen  * station mode. This includes both received deauthentication frames and
55028d61ffa5SJohannes Berg  * locally generated ones. This function may sleep. The caller must hold the
55038d61ffa5SJohannes Berg  * corresponding wdev's mutex.
55046039f6d2SJouni Malinen  */
55056ff57cf8SJohannes Berg void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len);
5506ce470613SHolger Schurig 
5507ce470613SHolger Schurig /**
55086ff57cf8SJohannes Berg  * cfg80211_rx_unprot_mlme_mgmt - notification of unprotected mlme mgmt frame
5509cf4e594eSJouni Malinen  * @dev: network device
5510cf4e594eSJouni Malinen  * @buf: deauthentication frame (header + body)
5511cf4e594eSJouni Malinen  * @len: length of the frame data
5512cf4e594eSJouni Malinen  *
55136ff57cf8SJohannes Berg  * This function is called whenever a received deauthentication or dissassoc
55146ff57cf8SJohannes Berg  * frame has been dropped in station mode because of MFP being used but the
5515cf4e594eSJouni Malinen  * frame was not protected. This function may sleep.
5516cf4e594eSJouni Malinen  */
55176ff57cf8SJohannes Berg void cfg80211_rx_unprot_mlme_mgmt(struct net_device *dev,
55186ff57cf8SJohannes Berg 				  const u8 *buf, size_t len);
5519cf4e594eSJouni Malinen 
5520cf4e594eSJouni Malinen /**
5521a3b8b056SJouni Malinen  * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP)
5522a3b8b056SJouni Malinen  * @dev: network device
5523a3b8b056SJouni Malinen  * @addr: The source MAC address of the frame
5524a3b8b056SJouni Malinen  * @key_type: The key type that the received frame used
5525a66b98dbSArik Nemtsov  * @key_id: Key identifier (0..3). Can be -1 if missing.
5526a3b8b056SJouni Malinen  * @tsc: The TSC value of the frame that generated the MIC failure (6 octets)
5527e6d6e342SJohannes Berg  * @gfp: allocation flags
5528a3b8b056SJouni Malinen  *
5529a3b8b056SJouni Malinen  * This function is called whenever the local MAC detects a MIC failure in a
5530a3b8b056SJouni Malinen  * received frame. This matches with MLME-MICHAELMICFAILURE.indication()
5531a3b8b056SJouni Malinen  * primitive.
5532a3b8b056SJouni Malinen  */
5533a3b8b056SJouni Malinen void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,
5534a3b8b056SJouni Malinen 				  enum nl80211_key_type key_type, int key_id,
5535e6d6e342SJohannes Berg 				  const u8 *tsc, gfp_t gfp);
5536a3b8b056SJouni Malinen 
553704a773adSJohannes Berg /**
553804a773adSJohannes Berg  * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS
553904a773adSJohannes Berg  *
554004a773adSJohannes Berg  * @dev: network device
554104a773adSJohannes Berg  * @bssid: the BSSID of the IBSS joined
5542fe94f3a4SAntonio Quartulli  * @channel: the channel of the IBSS joined
554304a773adSJohannes Berg  * @gfp: allocation flags
554404a773adSJohannes Berg  *
554504a773adSJohannes Berg  * This function notifies cfg80211 that the device joined an IBSS or
554604a773adSJohannes Berg  * switched to a different BSSID. Before this function can be called,
554704a773adSJohannes Berg  * either a beacon has to have been received from the IBSS, or one of
554804a773adSJohannes Berg  * the cfg80211_inform_bss{,_frame} functions must have been called
554904a773adSJohannes Berg  * with the locally generated beacon -- this guarantees that there is
555004a773adSJohannes Berg  * always a scan result for this IBSS. cfg80211 will handle the rest.
555104a773adSJohannes Berg  */
5552fe94f3a4SAntonio Quartulli void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid,
5553fe94f3a4SAntonio Quartulli 			  struct ieee80211_channel *channel, gfp_t gfp);
555404a773adSJohannes Berg 
55551f87f7d3SJohannes Berg /**
5556c93b5e71SJavier Cardona  * cfg80211_notify_new_candidate - notify cfg80211 of a new mesh peer candidate
5557c93b5e71SJavier Cardona  *
5558c93b5e71SJavier Cardona  * @dev: network device
5559c93b5e71SJavier Cardona  * @macaddr: the MAC address of the new candidate
5560c93b5e71SJavier Cardona  * @ie: information elements advertised by the peer candidate
5561c93b5e71SJavier Cardona  * @ie_len: lenght of the information elements buffer
5562c93b5e71SJavier Cardona  * @gfp: allocation flags
5563c93b5e71SJavier Cardona  *
5564c93b5e71SJavier Cardona  * This function notifies cfg80211 that the mesh peer candidate has been
5565c93b5e71SJavier Cardona  * detected, most likely via a beacon or, less likely, via a probe response.
5566c93b5e71SJavier Cardona  * cfg80211 then sends a notification to userspace.
5567c93b5e71SJavier Cardona  */
5568c93b5e71SJavier Cardona void cfg80211_notify_new_peer_candidate(struct net_device *dev,
5569c93b5e71SJavier Cardona 		const u8 *macaddr, const u8 *ie, u8 ie_len, gfp_t gfp);
5570c93b5e71SJavier Cardona 
5571c93b5e71SJavier Cardona /**
5572d70e9693SJohannes Berg  * DOC: RFkill integration
5573d70e9693SJohannes Berg  *
5574d70e9693SJohannes Berg  * RFkill integration in cfg80211 is almost invisible to drivers,
5575d70e9693SJohannes Berg  * as cfg80211 automatically registers an rfkill instance for each
5576d70e9693SJohannes Berg  * wireless device it knows about. Soft kill is also translated
5577d70e9693SJohannes Berg  * into disconnecting and turning all interfaces off, drivers are
5578d70e9693SJohannes Berg  * expected to turn off the device when all interfaces are down.
5579d70e9693SJohannes Berg  *
5580d70e9693SJohannes Berg  * However, devices may have a hard RFkill line, in which case they
5581d70e9693SJohannes Berg  * also need to interact with the rfkill subsystem, via cfg80211.
5582d70e9693SJohannes Berg  * They can do this with a few helper functions documented here.
5583d70e9693SJohannes Berg  */
5584d70e9693SJohannes Berg 
5585d70e9693SJohannes Berg /**
55861f87f7d3SJohannes Berg  * wiphy_rfkill_set_hw_state - notify cfg80211 about hw block state
55871f87f7d3SJohannes Berg  * @wiphy: the wiphy
55881f87f7d3SJohannes Berg  * @blocked: block status
55891f87f7d3SJohannes Berg  */
55901f87f7d3SJohannes Berg void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked);
55911f87f7d3SJohannes Berg 
55921f87f7d3SJohannes Berg /**
55931f87f7d3SJohannes Berg  * wiphy_rfkill_start_polling - start polling rfkill
55941f87f7d3SJohannes Berg  * @wiphy: the wiphy
55951f87f7d3SJohannes Berg  */
55961f87f7d3SJohannes Berg void wiphy_rfkill_start_polling(struct wiphy *wiphy);
55971f87f7d3SJohannes Berg 
55981f87f7d3SJohannes Berg /**
55991f87f7d3SJohannes Berg  * wiphy_rfkill_stop_polling - stop polling rfkill
56001f87f7d3SJohannes Berg  * @wiphy: the wiphy
56011f87f7d3SJohannes Berg  */
56021f87f7d3SJohannes Berg void wiphy_rfkill_stop_polling(struct wiphy *wiphy);
56031f87f7d3SJohannes Berg 
5604ad7e718cSJohannes Berg /**
5605ad7e718cSJohannes Berg  * DOC: Vendor commands
5606ad7e718cSJohannes Berg  *
5607ad7e718cSJohannes Berg  * Occasionally, there are special protocol or firmware features that
5608ad7e718cSJohannes Berg  * can't be implemented very openly. For this and similar cases, the
5609ad7e718cSJohannes Berg  * vendor command functionality allows implementing the features with
5610ad7e718cSJohannes Berg  * (typically closed-source) userspace and firmware, using nl80211 as
5611ad7e718cSJohannes Berg  * the configuration mechanism.
5612ad7e718cSJohannes Berg  *
5613ad7e718cSJohannes Berg  * A driver supporting vendor commands must register them as an array
5614ad7e718cSJohannes Berg  * in struct wiphy, with handlers for each one, each command has an
5615ad7e718cSJohannes Berg  * OUI and sub command ID to identify it.
5616ad7e718cSJohannes Berg  *
5617ad7e718cSJohannes Berg  * Note that this feature should not be (ab)used to implement protocol
5618ad7e718cSJohannes Berg  * features that could openly be shared across drivers. In particular,
5619ad7e718cSJohannes Berg  * it must never be required to use vendor commands to implement any
5620ad7e718cSJohannes Berg  * "normal" functionality that higher-level userspace like connection
5621ad7e718cSJohannes Berg  * managers etc. need.
5622ad7e718cSJohannes Berg  */
5623ad7e718cSJohannes Berg 
5624ad7e718cSJohannes Berg struct sk_buff *__cfg80211_alloc_reply_skb(struct wiphy *wiphy,
5625ad7e718cSJohannes Berg 					   enum nl80211_commands cmd,
5626ad7e718cSJohannes Berg 					   enum nl80211_attrs attr,
5627ad7e718cSJohannes Berg 					   int approxlen);
5628ad7e718cSJohannes Berg 
5629567ffc35SJohannes Berg struct sk_buff *__cfg80211_alloc_event_skb(struct wiphy *wiphy,
56306c09e791SAhmad Kholaif 					   struct wireless_dev *wdev,
5631567ffc35SJohannes Berg 					   enum nl80211_commands cmd,
5632567ffc35SJohannes Berg 					   enum nl80211_attrs attr,
5633567ffc35SJohannes Berg 					   int vendor_event_idx,
5634567ffc35SJohannes Berg 					   int approxlen, gfp_t gfp);
5635567ffc35SJohannes Berg 
5636567ffc35SJohannes Berg void __cfg80211_send_event_skb(struct sk_buff *skb, gfp_t gfp);
5637567ffc35SJohannes Berg 
5638ad7e718cSJohannes Berg /**
5639ad7e718cSJohannes Berg  * cfg80211_vendor_cmd_alloc_reply_skb - allocate vendor command reply
5640ad7e718cSJohannes Berg  * @wiphy: the wiphy
5641ad7e718cSJohannes Berg  * @approxlen: an upper bound of the length of the data that will
5642ad7e718cSJohannes Berg  *	be put into the skb
5643ad7e718cSJohannes Berg  *
5644ad7e718cSJohannes Berg  * This function allocates and pre-fills an skb for a reply to
5645ad7e718cSJohannes Berg  * a vendor command. Since it is intended for a reply, calling
5646ad7e718cSJohannes Berg  * it outside of a vendor command's doit() operation is invalid.
5647ad7e718cSJohannes Berg  *
5648ad7e718cSJohannes Berg  * The returned skb is pre-filled with some identifying data in
5649ad7e718cSJohannes Berg  * a way that any data that is put into the skb (with skb_put(),
5650ad7e718cSJohannes Berg  * nla_put() or similar) will end up being within the
5651ad7e718cSJohannes Berg  * %NL80211_ATTR_VENDOR_DATA attribute, so all that needs to be done
5652ad7e718cSJohannes Berg  * with the skb is adding data for the corresponding userspace tool
5653ad7e718cSJohannes Berg  * which can then read that data out of the vendor data attribute.
5654ad7e718cSJohannes Berg  * You must not modify the skb in any other way.
5655ad7e718cSJohannes Berg  *
5656ad7e718cSJohannes Berg  * When done, call cfg80211_vendor_cmd_reply() with the skb and return
5657ad7e718cSJohannes Berg  * its error code as the result of the doit() operation.
5658ad7e718cSJohannes Berg  *
5659ad7e718cSJohannes Berg  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
5660ad7e718cSJohannes Berg  */
5661ad7e718cSJohannes Berg static inline struct sk_buff *
5662ad7e718cSJohannes Berg cfg80211_vendor_cmd_alloc_reply_skb(struct wiphy *wiphy, int approxlen)
5663ad7e718cSJohannes Berg {
5664ad7e718cSJohannes Berg 	return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_VENDOR,
5665ad7e718cSJohannes Berg 					  NL80211_ATTR_VENDOR_DATA, approxlen);
5666ad7e718cSJohannes Berg }
5667ad7e718cSJohannes Berg 
5668ad7e718cSJohannes Berg /**
5669ad7e718cSJohannes Berg  * cfg80211_vendor_cmd_reply - send the reply skb
5670ad7e718cSJohannes Berg  * @skb: The skb, must have been allocated with
5671ad7e718cSJohannes Berg  *	cfg80211_vendor_cmd_alloc_reply_skb()
5672ad7e718cSJohannes Berg  *
5673ad7e718cSJohannes Berg  * Since calling this function will usually be the last thing
5674ad7e718cSJohannes Berg  * before returning from the vendor command doit() you should
5675ad7e718cSJohannes Berg  * return the error code.  Note that this function consumes the
5676ad7e718cSJohannes Berg  * skb regardless of the return value.
5677ad7e718cSJohannes Berg  *
5678ad7e718cSJohannes Berg  * Return: An error code or 0 on success.
5679ad7e718cSJohannes Berg  */
5680ad7e718cSJohannes Berg int cfg80211_vendor_cmd_reply(struct sk_buff *skb);
5681ad7e718cSJohannes Berg 
5682567ffc35SJohannes Berg /**
5683567ffc35SJohannes Berg  * cfg80211_vendor_event_alloc - allocate vendor-specific event skb
5684567ffc35SJohannes Berg  * @wiphy: the wiphy
56856c09e791SAhmad Kholaif  * @wdev: the wireless device
5686567ffc35SJohannes Berg  * @event_idx: index of the vendor event in the wiphy's vendor_events
5687567ffc35SJohannes Berg  * @approxlen: an upper bound of the length of the data that will
5688567ffc35SJohannes Berg  *	be put into the skb
5689567ffc35SJohannes Berg  * @gfp: allocation flags
5690567ffc35SJohannes Berg  *
5691567ffc35SJohannes Berg  * This function allocates and pre-fills an skb for an event on the
5692567ffc35SJohannes Berg  * vendor-specific multicast group.
5693567ffc35SJohannes Berg  *
56946c09e791SAhmad Kholaif  * If wdev != NULL, both the ifindex and identifier of the specified
56956c09e791SAhmad Kholaif  * wireless device are added to the event message before the vendor data
56966c09e791SAhmad Kholaif  * attribute.
56976c09e791SAhmad Kholaif  *
5698567ffc35SJohannes Berg  * When done filling the skb, call cfg80211_vendor_event() with the
5699567ffc35SJohannes Berg  * skb to send the event.
5700567ffc35SJohannes Berg  *
5701567ffc35SJohannes Berg  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
5702567ffc35SJohannes Berg  */
5703567ffc35SJohannes Berg static inline struct sk_buff *
57046c09e791SAhmad Kholaif cfg80211_vendor_event_alloc(struct wiphy *wiphy, struct wireless_dev *wdev,
57056c09e791SAhmad Kholaif 			     int approxlen, int event_idx, gfp_t gfp)
5706567ffc35SJohannes Berg {
57076c09e791SAhmad Kholaif 	return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR,
5708567ffc35SJohannes Berg 					  NL80211_ATTR_VENDOR_DATA,
5709567ffc35SJohannes Berg 					  event_idx, approxlen, gfp);
5710567ffc35SJohannes Berg }
5711567ffc35SJohannes Berg 
5712567ffc35SJohannes Berg /**
5713567ffc35SJohannes Berg  * cfg80211_vendor_event - send the event
5714567ffc35SJohannes Berg  * @skb: The skb, must have been allocated with cfg80211_vendor_event_alloc()
5715567ffc35SJohannes Berg  * @gfp: allocation flags
5716567ffc35SJohannes Berg  *
5717567ffc35SJohannes Berg  * This function sends the given @skb, which must have been allocated
5718567ffc35SJohannes Berg  * by cfg80211_vendor_event_alloc(), as an event. It always consumes it.
5719567ffc35SJohannes Berg  */
5720567ffc35SJohannes Berg static inline void cfg80211_vendor_event(struct sk_buff *skb, gfp_t gfp)
5721567ffc35SJohannes Berg {
5722567ffc35SJohannes Berg 	__cfg80211_send_event_skb(skb, gfp);
5723567ffc35SJohannes Berg }
5724567ffc35SJohannes Berg 
5725aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE
5726aff89a9bSJohannes Berg /**
5727d70e9693SJohannes Berg  * DOC: Test mode
5728d70e9693SJohannes Berg  *
5729d70e9693SJohannes Berg  * Test mode is a set of utility functions to allow drivers to
5730d70e9693SJohannes Berg  * interact with driver-specific tools to aid, for instance,
5731d70e9693SJohannes Berg  * factory programming.
5732d70e9693SJohannes Berg  *
5733d70e9693SJohannes Berg  * This chapter describes how drivers interact with it, for more
5734d70e9693SJohannes Berg  * information see the nl80211 book's chapter on it.
5735d70e9693SJohannes Berg  */
5736d70e9693SJohannes Berg 
5737d70e9693SJohannes Berg /**
5738aff89a9bSJohannes Berg  * cfg80211_testmode_alloc_reply_skb - allocate testmode reply
5739aff89a9bSJohannes Berg  * @wiphy: the wiphy
5740aff89a9bSJohannes Berg  * @approxlen: an upper bound of the length of the data that will
5741aff89a9bSJohannes Berg  *	be put into the skb
5742aff89a9bSJohannes Berg  *
5743aff89a9bSJohannes Berg  * This function allocates and pre-fills an skb for a reply to
5744aff89a9bSJohannes Berg  * the testmode command. Since it is intended for a reply, calling
5745aff89a9bSJohannes Berg  * it outside of the @testmode_cmd operation is invalid.
5746aff89a9bSJohannes Berg  *
57470ae997dcSYacine Belkadi  * The returned skb is pre-filled with the wiphy index and set up in
57480ae997dcSYacine Belkadi  * a way that any data that is put into the skb (with skb_put(),
57490ae997dcSYacine Belkadi  * nla_put() or similar) will end up being within the
57500ae997dcSYacine Belkadi  * %NL80211_ATTR_TESTDATA attribute, so all that needs to be done
57510ae997dcSYacine Belkadi  * with the skb is adding data for the corresponding userspace tool
57520ae997dcSYacine Belkadi  * which can then read that data out of the testdata attribute. You
57530ae997dcSYacine Belkadi  * must not modify the skb in any other way.
5754aff89a9bSJohannes Berg  *
5755aff89a9bSJohannes Berg  * When done, call cfg80211_testmode_reply() with the skb and return
5756aff89a9bSJohannes Berg  * its error code as the result of the @testmode_cmd operation.
57570ae997dcSYacine Belkadi  *
57580ae997dcSYacine Belkadi  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
5759aff89a9bSJohannes Berg  */
5760ad7e718cSJohannes Berg static inline struct sk_buff *
5761ad7e718cSJohannes Berg cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy, int approxlen)
5762ad7e718cSJohannes Berg {
5763ad7e718cSJohannes Berg 	return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_TESTMODE,
5764ad7e718cSJohannes Berg 					  NL80211_ATTR_TESTDATA, approxlen);
5765ad7e718cSJohannes Berg }
5766aff89a9bSJohannes Berg 
5767aff89a9bSJohannes Berg /**
5768aff89a9bSJohannes Berg  * cfg80211_testmode_reply - send the reply skb
5769aff89a9bSJohannes Berg  * @skb: The skb, must have been allocated with
5770aff89a9bSJohannes Berg  *	cfg80211_testmode_alloc_reply_skb()
5771aff89a9bSJohannes Berg  *
57720ae997dcSYacine Belkadi  * Since calling this function will usually be the last thing
57730ae997dcSYacine Belkadi  * before returning from the @testmode_cmd you should return
57740ae997dcSYacine Belkadi  * the error code.  Note that this function consumes the skb
57750ae997dcSYacine Belkadi  * regardless of the return value.
57760ae997dcSYacine Belkadi  *
57770ae997dcSYacine Belkadi  * Return: An error code or 0 on success.
5778aff89a9bSJohannes Berg  */
5779ad7e718cSJohannes Berg static inline int cfg80211_testmode_reply(struct sk_buff *skb)
5780ad7e718cSJohannes Berg {
5781ad7e718cSJohannes Berg 	return cfg80211_vendor_cmd_reply(skb);
5782ad7e718cSJohannes Berg }
5783aff89a9bSJohannes Berg 
5784aff89a9bSJohannes Berg /**
5785aff89a9bSJohannes Berg  * cfg80211_testmode_alloc_event_skb - allocate testmode event
5786aff89a9bSJohannes Berg  * @wiphy: the wiphy
5787aff89a9bSJohannes Berg  * @approxlen: an upper bound of the length of the data that will
5788aff89a9bSJohannes Berg  *	be put into the skb
5789aff89a9bSJohannes Berg  * @gfp: allocation flags
5790aff89a9bSJohannes Berg  *
5791aff89a9bSJohannes Berg  * This function allocates and pre-fills an skb for an event on the
5792aff89a9bSJohannes Berg  * testmode multicast group.
5793aff89a9bSJohannes Berg  *
57940ae997dcSYacine Belkadi  * The returned skb is set up in the same way as with
57950ae997dcSYacine Belkadi  * cfg80211_testmode_alloc_reply_skb() but prepared for an event. As
57960ae997dcSYacine Belkadi  * there, you should simply add data to it that will then end up in the
57970ae997dcSYacine Belkadi  * %NL80211_ATTR_TESTDATA attribute. Again, you must not modify the skb
57980ae997dcSYacine Belkadi  * in any other way.
5799aff89a9bSJohannes Berg  *
5800aff89a9bSJohannes Berg  * When done filling the skb, call cfg80211_testmode_event() with the
5801aff89a9bSJohannes Berg  * skb to send the event.
58020ae997dcSYacine Belkadi  *
58030ae997dcSYacine Belkadi  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
5804aff89a9bSJohannes Berg  */
5805567ffc35SJohannes Berg static inline struct sk_buff *
5806567ffc35SJohannes Berg cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy, int approxlen, gfp_t gfp)
5807567ffc35SJohannes Berg {
58086c09e791SAhmad Kholaif 	return __cfg80211_alloc_event_skb(wiphy, NULL, NL80211_CMD_TESTMODE,
5809567ffc35SJohannes Berg 					  NL80211_ATTR_TESTDATA, -1,
5810567ffc35SJohannes Berg 					  approxlen, gfp);
5811567ffc35SJohannes Berg }
5812aff89a9bSJohannes Berg 
5813aff89a9bSJohannes Berg /**
5814aff89a9bSJohannes Berg  * cfg80211_testmode_event - send the event
5815aff89a9bSJohannes Berg  * @skb: The skb, must have been allocated with
5816aff89a9bSJohannes Berg  *	cfg80211_testmode_alloc_event_skb()
5817aff89a9bSJohannes Berg  * @gfp: allocation flags
5818aff89a9bSJohannes Berg  *
5819aff89a9bSJohannes Berg  * This function sends the given @skb, which must have been allocated
5820aff89a9bSJohannes Berg  * by cfg80211_testmode_alloc_event_skb(), as an event. It always
5821aff89a9bSJohannes Berg  * consumes it.
5822aff89a9bSJohannes Berg  */
5823567ffc35SJohannes Berg static inline void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp)
5824567ffc35SJohannes Berg {
5825567ffc35SJohannes Berg 	__cfg80211_send_event_skb(skb, gfp);
5826567ffc35SJohannes Berg }
5827aff89a9bSJohannes Berg 
5828aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd)	.testmode_cmd = (cmd),
582971063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd)	.testmode_dump = (cmd),
5830aff89a9bSJohannes Berg #else
5831aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd)
583271063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd)
5833aff89a9bSJohannes Berg #endif
5834aff89a9bSJohannes Berg 
5835b23aa676SSamuel Ortiz /**
583676804d28SArend Van Spriel  * struct cfg80211_fils_resp_params - FILS connection response params
583776804d28SArend Van Spriel  * @kek: KEK derived from a successful FILS connection (may be %NULL)
583876804d28SArend Van Spriel  * @kek_len: Length of @fils_kek in octets
583976804d28SArend Van Spriel  * @update_erp_next_seq_num: Boolean value to specify whether the value in
584076804d28SArend Van Spriel  *	@erp_next_seq_num is valid.
584176804d28SArend Van Spriel  * @erp_next_seq_num: The next sequence number to use in ERP message in
584276804d28SArend Van Spriel  *	FILS Authentication. This value should be specified irrespective of the
584376804d28SArend Van Spriel  *	status for a FILS connection.
584476804d28SArend Van Spriel  * @pmk: A new PMK if derived from a successful FILS connection (may be %NULL).
584576804d28SArend Van Spriel  * @pmk_len: Length of @pmk in octets
584676804d28SArend Van Spriel  * @pmkid: A new PMKID if derived from a successful FILS connection or the PMKID
584776804d28SArend Van Spriel  *	used for this FILS connection (may be %NULL).
584876804d28SArend Van Spriel  */
584976804d28SArend Van Spriel struct cfg80211_fils_resp_params {
585076804d28SArend Van Spriel 	const u8 *kek;
585176804d28SArend Van Spriel 	size_t kek_len;
585276804d28SArend Van Spriel 	bool update_erp_next_seq_num;
585376804d28SArend Van Spriel 	u16 erp_next_seq_num;
585476804d28SArend Van Spriel 	const u8 *pmk;
585576804d28SArend Van Spriel 	size_t pmk_len;
585676804d28SArend Van Spriel 	const u8 *pmkid;
585776804d28SArend Van Spriel };
585876804d28SArend Van Spriel 
585976804d28SArend Van Spriel /**
58605349a0f7SVidyullatha Kanchanapally  * struct cfg80211_connect_resp_params - Connection response params
58615349a0f7SVidyullatha Kanchanapally  * @status: Status code, %WLAN_STATUS_SUCCESS for successful connection, use
58625349a0f7SVidyullatha Kanchanapally  *	%WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
58635349a0f7SVidyullatha Kanchanapally  *	the real status code for failures. If this call is used to report a
58645349a0f7SVidyullatha Kanchanapally  *	failure due to a timeout (e.g., not receiving an Authentication frame
58655349a0f7SVidyullatha Kanchanapally  *	from the AP) instead of an explicit rejection by the AP, -1 is used to
58665349a0f7SVidyullatha Kanchanapally  *	indicate that this is a failure, but without a status code.
58675349a0f7SVidyullatha Kanchanapally  *	@timeout_reason is used to report the reason for the timeout in that
58685349a0f7SVidyullatha Kanchanapally  *	case.
58695349a0f7SVidyullatha Kanchanapally  * @bssid: The BSSID of the AP (may be %NULL)
58705349a0f7SVidyullatha Kanchanapally  * @bss: Entry of bss to which STA got connected to, can be obtained through
58715349a0f7SVidyullatha Kanchanapally  *	cfg80211_get_bss() (may be %NULL). Only one parameter among @bssid and
58725349a0f7SVidyullatha Kanchanapally  *	@bss needs to be specified.
58735349a0f7SVidyullatha Kanchanapally  * @req_ie: Association request IEs (may be %NULL)
58745349a0f7SVidyullatha Kanchanapally  * @req_ie_len: Association request IEs length
58755349a0f7SVidyullatha Kanchanapally  * @resp_ie: Association response IEs (may be %NULL)
58765349a0f7SVidyullatha Kanchanapally  * @resp_ie_len: Association response IEs length
587776804d28SArend Van Spriel  * @fils: FILS connection response parameters.
58785349a0f7SVidyullatha Kanchanapally  * @timeout_reason: Reason for connection timeout. This is used when the
58795349a0f7SVidyullatha Kanchanapally  *	connection fails due to a timeout instead of an explicit rejection from
58805349a0f7SVidyullatha Kanchanapally  *	the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is
58815349a0f7SVidyullatha Kanchanapally  *	not known. This value is used only if @status < 0 to indicate that the
58825349a0f7SVidyullatha Kanchanapally  *	failure is due to a timeout and not due to explicit rejection by the AP.
58835349a0f7SVidyullatha Kanchanapally  *	This value is ignored in other cases (@status >= 0).
58845349a0f7SVidyullatha Kanchanapally  */
58855349a0f7SVidyullatha Kanchanapally struct cfg80211_connect_resp_params {
58865349a0f7SVidyullatha Kanchanapally 	int status;
58875349a0f7SVidyullatha Kanchanapally 	const u8 *bssid;
58885349a0f7SVidyullatha Kanchanapally 	struct cfg80211_bss *bss;
58895349a0f7SVidyullatha Kanchanapally 	const u8 *req_ie;
58905349a0f7SVidyullatha Kanchanapally 	size_t req_ie_len;
58915349a0f7SVidyullatha Kanchanapally 	const u8 *resp_ie;
58925349a0f7SVidyullatha Kanchanapally 	size_t resp_ie_len;
589376804d28SArend Van Spriel 	struct cfg80211_fils_resp_params fils;
58945349a0f7SVidyullatha Kanchanapally 	enum nl80211_timeout_reason timeout_reason;
58955349a0f7SVidyullatha Kanchanapally };
58965349a0f7SVidyullatha Kanchanapally 
58975349a0f7SVidyullatha Kanchanapally /**
58985349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_done - notify cfg80211 of connection result
58995349a0f7SVidyullatha Kanchanapally  *
59005349a0f7SVidyullatha Kanchanapally  * @dev: network device
59015349a0f7SVidyullatha Kanchanapally  * @params: connection response parameters
59025349a0f7SVidyullatha Kanchanapally  * @gfp: allocation flags
59035349a0f7SVidyullatha Kanchanapally  *
59045349a0f7SVidyullatha Kanchanapally  * It should be called by the underlying driver once execution of the connection
59055349a0f7SVidyullatha Kanchanapally  * request from connect() has been completed. This is similar to
59065349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_bss(), but takes a structure pointer for connection response
59075349a0f7SVidyullatha Kanchanapally  * parameters. Only one of the functions among cfg80211_connect_bss(),
59085349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_result(), cfg80211_connect_timeout(),
59095349a0f7SVidyullatha Kanchanapally  * and cfg80211_connect_done() should be called.
59105349a0f7SVidyullatha Kanchanapally  */
59115349a0f7SVidyullatha Kanchanapally void cfg80211_connect_done(struct net_device *dev,
59125349a0f7SVidyullatha Kanchanapally 			   struct cfg80211_connect_resp_params *params,
59135349a0f7SVidyullatha Kanchanapally 			   gfp_t gfp);
59145349a0f7SVidyullatha Kanchanapally 
59155349a0f7SVidyullatha Kanchanapally /**
5916e7054989SKanchanapally, Vidyullatha  * cfg80211_connect_bss - notify cfg80211 of connection result
5917e7054989SKanchanapally, Vidyullatha  *
5918e7054989SKanchanapally, Vidyullatha  * @dev: network device
5919e7054989SKanchanapally, Vidyullatha  * @bssid: the BSSID of the AP
5920e7054989SKanchanapally, Vidyullatha  * @bss: entry of bss to which STA got connected to, can be obtained
5921e7054989SKanchanapally, Vidyullatha  *	through cfg80211_get_bss (may be %NULL)
5922e7054989SKanchanapally, Vidyullatha  * @req_ie: association request IEs (maybe be %NULL)
5923e7054989SKanchanapally, Vidyullatha  * @req_ie_len: association request IEs length
5924e7054989SKanchanapally, Vidyullatha  * @resp_ie: association response IEs (may be %NULL)
5925e7054989SKanchanapally, Vidyullatha  * @resp_ie_len: assoc response IEs length
5926c88215d7SJouni Malinen  * @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use
5927e7054989SKanchanapally, Vidyullatha  *	%WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
5928c88215d7SJouni Malinen  *	the real status code for failures. If this call is used to report a
5929c88215d7SJouni Malinen  *	failure due to a timeout (e.g., not receiving an Authentication frame
5930c88215d7SJouni Malinen  *	from the AP) instead of an explicit rejection by the AP, -1 is used to
5931c88215d7SJouni Malinen  *	indicate that this is a failure, but without a status code.
5932c88215d7SJouni Malinen  *	@timeout_reason is used to report the reason for the timeout in that
5933c88215d7SJouni Malinen  *	case.
5934e7054989SKanchanapally, Vidyullatha  * @gfp: allocation flags
59353093ebbeSPurushottam Kushwaha  * @timeout_reason: reason for connection timeout. This is used when the
59363093ebbeSPurushottam Kushwaha  *	connection fails due to a timeout instead of an explicit rejection from
59373093ebbeSPurushottam Kushwaha  *	the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is
59383093ebbeSPurushottam Kushwaha  *	not known. This value is used only if @status < 0 to indicate that the
59393093ebbeSPurushottam Kushwaha  *	failure is due to a timeout and not due to explicit rejection by the AP.
59403093ebbeSPurushottam Kushwaha  *	This value is ignored in other cases (@status >= 0).
5941e7054989SKanchanapally, Vidyullatha  *
5942c88215d7SJouni Malinen  * It should be called by the underlying driver once execution of the connection
5943c88215d7SJouni Malinen  * request from connect() has been completed. This is similar to
5944c88215d7SJouni Malinen  * cfg80211_connect_result(), but with the option of identifying the exact bss
59455349a0f7SVidyullatha Kanchanapally  * entry for the connection. Only one of the functions among
59465349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_bss(), cfg80211_connect_result(),
59475349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
5948e7054989SKanchanapally, Vidyullatha  */
59495349a0f7SVidyullatha Kanchanapally static inline void
59505349a0f7SVidyullatha Kanchanapally cfg80211_connect_bss(struct net_device *dev, const u8 *bssid,
5951e7054989SKanchanapally, Vidyullatha 		     struct cfg80211_bss *bss, const u8 *req_ie,
5952e7054989SKanchanapally, Vidyullatha 		     size_t req_ie_len, const u8 *resp_ie,
59533093ebbeSPurushottam Kushwaha 		     size_t resp_ie_len, int status, gfp_t gfp,
59545349a0f7SVidyullatha Kanchanapally 		     enum nl80211_timeout_reason timeout_reason)
59555349a0f7SVidyullatha Kanchanapally {
59565349a0f7SVidyullatha Kanchanapally 	struct cfg80211_connect_resp_params params;
59575349a0f7SVidyullatha Kanchanapally 
59585349a0f7SVidyullatha Kanchanapally 	memset(&params, 0, sizeof(params));
59595349a0f7SVidyullatha Kanchanapally 	params.status = status;
59605349a0f7SVidyullatha Kanchanapally 	params.bssid = bssid;
59615349a0f7SVidyullatha Kanchanapally 	params.bss = bss;
59625349a0f7SVidyullatha Kanchanapally 	params.req_ie = req_ie;
59635349a0f7SVidyullatha Kanchanapally 	params.req_ie_len = req_ie_len;
59645349a0f7SVidyullatha Kanchanapally 	params.resp_ie = resp_ie;
59655349a0f7SVidyullatha Kanchanapally 	params.resp_ie_len = resp_ie_len;
59665349a0f7SVidyullatha Kanchanapally 	params.timeout_reason = timeout_reason;
59675349a0f7SVidyullatha Kanchanapally 
59685349a0f7SVidyullatha Kanchanapally 	cfg80211_connect_done(dev, &params, gfp);
59695349a0f7SVidyullatha Kanchanapally }
5970e7054989SKanchanapally, Vidyullatha 
5971e7054989SKanchanapally, Vidyullatha /**
5972b23aa676SSamuel Ortiz  * cfg80211_connect_result - notify cfg80211 of connection result
5973b23aa676SSamuel Ortiz  *
5974b23aa676SSamuel Ortiz  * @dev: network device
5975b23aa676SSamuel Ortiz  * @bssid: the BSSID of the AP
5976b23aa676SSamuel Ortiz  * @req_ie: association request IEs (maybe be %NULL)
5977b23aa676SSamuel Ortiz  * @req_ie_len: association request IEs length
5978b23aa676SSamuel Ortiz  * @resp_ie: association response IEs (may be %NULL)
5979b23aa676SSamuel Ortiz  * @resp_ie_len: assoc response IEs length
5980c88215d7SJouni Malinen  * @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use
5981b23aa676SSamuel Ortiz  *	%WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
5982b23aa676SSamuel Ortiz  *	the real status code for failures.
5983b23aa676SSamuel Ortiz  * @gfp: allocation flags
5984b23aa676SSamuel Ortiz  *
5985c88215d7SJouni Malinen  * It should be called by the underlying driver once execution of the connection
5986c88215d7SJouni Malinen  * request from connect() has been completed. This is similar to
5987c88215d7SJouni Malinen  * cfg80211_connect_bss() which allows the exact bss entry to be specified. Only
59885349a0f7SVidyullatha Kanchanapally  * one of the functions among cfg80211_connect_bss(), cfg80211_connect_result(),
59895349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
5990b23aa676SSamuel Ortiz  */
5991e7054989SKanchanapally, Vidyullatha static inline void
5992e7054989SKanchanapally, Vidyullatha cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
5993b23aa676SSamuel Ortiz 			const u8 *req_ie, size_t req_ie_len,
5994b23aa676SSamuel Ortiz 			const u8 *resp_ie, size_t resp_ie_len,
5995e7054989SKanchanapally, Vidyullatha 			u16 status, gfp_t gfp)
5996e7054989SKanchanapally, Vidyullatha {
5997e7054989SKanchanapally, Vidyullatha 	cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, resp_ie,
59983093ebbeSPurushottam Kushwaha 			     resp_ie_len, status, gfp,
59993093ebbeSPurushottam Kushwaha 			     NL80211_TIMEOUT_UNSPECIFIED);
6000e7054989SKanchanapally, Vidyullatha }
6001b23aa676SSamuel Ortiz 
6002b23aa676SSamuel Ortiz /**
6003bf1ecd21SJouni Malinen  * cfg80211_connect_timeout - notify cfg80211 of connection timeout
6004bf1ecd21SJouni Malinen  *
6005bf1ecd21SJouni Malinen  * @dev: network device
6006bf1ecd21SJouni Malinen  * @bssid: the BSSID of the AP
6007bf1ecd21SJouni Malinen  * @req_ie: association request IEs (maybe be %NULL)
6008bf1ecd21SJouni Malinen  * @req_ie_len: association request IEs length
6009bf1ecd21SJouni Malinen  * @gfp: allocation flags
60103093ebbeSPurushottam Kushwaha  * @timeout_reason: reason for connection timeout.
6011bf1ecd21SJouni Malinen  *
6012bf1ecd21SJouni Malinen  * It should be called by the underlying driver whenever connect() has failed
6013bf1ecd21SJouni Malinen  * in a sequence where no explicit authentication/association rejection was
6014bf1ecd21SJouni Malinen  * received from the AP. This could happen, e.g., due to not being able to send
6015bf1ecd21SJouni Malinen  * out the Authentication or Association Request frame or timing out while
60165349a0f7SVidyullatha Kanchanapally  * waiting for the response. Only one of the functions among
60175349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_bss(), cfg80211_connect_result(),
60185349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
6019bf1ecd21SJouni Malinen  */
6020bf1ecd21SJouni Malinen static inline void
6021bf1ecd21SJouni Malinen cfg80211_connect_timeout(struct net_device *dev, const u8 *bssid,
60223093ebbeSPurushottam Kushwaha 			 const u8 *req_ie, size_t req_ie_len, gfp_t gfp,
60233093ebbeSPurushottam Kushwaha 			 enum nl80211_timeout_reason timeout_reason)
6024bf1ecd21SJouni Malinen {
6025bf1ecd21SJouni Malinen 	cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, NULL, 0, -1,
60263093ebbeSPurushottam Kushwaha 			     gfp, timeout_reason);
6027bf1ecd21SJouni Malinen }
6028bf1ecd21SJouni Malinen 
6029bf1ecd21SJouni Malinen /**
603029ce6ecbSAvraham Stern  * struct cfg80211_roam_info - driver initiated roaming information
603129ce6ecbSAvraham Stern  *
603229ce6ecbSAvraham Stern  * @channel: the channel of the new AP
603329ce6ecbSAvraham Stern  * @bss: entry of bss to which STA got roamed (may be %NULL if %bssid is set)
603429ce6ecbSAvraham Stern  * @bssid: the BSSID of the new AP (may be %NULL if %bss is set)
603529ce6ecbSAvraham Stern  * @req_ie: association request IEs (maybe be %NULL)
603629ce6ecbSAvraham Stern  * @req_ie_len: association request IEs length
603729ce6ecbSAvraham Stern  * @resp_ie: association response IEs (may be %NULL)
603829ce6ecbSAvraham Stern  * @resp_ie_len: assoc response IEs length
6039e841b7b1SArend Van Spriel  * @fils: FILS related roaming information.
604029ce6ecbSAvraham Stern  */
604129ce6ecbSAvraham Stern struct cfg80211_roam_info {
604229ce6ecbSAvraham Stern 	struct ieee80211_channel *channel;
604329ce6ecbSAvraham Stern 	struct cfg80211_bss *bss;
604429ce6ecbSAvraham Stern 	const u8 *bssid;
604529ce6ecbSAvraham Stern 	const u8 *req_ie;
604629ce6ecbSAvraham Stern 	size_t req_ie_len;
604729ce6ecbSAvraham Stern 	const u8 *resp_ie;
604829ce6ecbSAvraham Stern 	size_t resp_ie_len;
6049e841b7b1SArend Van Spriel 	struct cfg80211_fils_resp_params fils;
605029ce6ecbSAvraham Stern };
605129ce6ecbSAvraham Stern 
605229ce6ecbSAvraham Stern /**
6053b23aa676SSamuel Ortiz  * cfg80211_roamed - notify cfg80211 of roaming
6054b23aa676SSamuel Ortiz  *
6055b23aa676SSamuel Ortiz  * @dev: network device
605629ce6ecbSAvraham Stern  * @info: information about the new BSS. struct &cfg80211_roam_info.
6057b23aa676SSamuel Ortiz  * @gfp: allocation flags
6058b23aa676SSamuel Ortiz  *
605929ce6ecbSAvraham Stern  * This function may be called with the driver passing either the BSSID of the
606029ce6ecbSAvraham Stern  * new AP or passing the bss entry to avoid a race in timeout of the bss entry.
606129ce6ecbSAvraham Stern  * It should be called by the underlying driver whenever it roamed from one AP
606229ce6ecbSAvraham Stern  * to another while connected. Drivers which have roaming implemented in
606329ce6ecbSAvraham Stern  * firmware should pass the bss entry to avoid a race in bss entry timeout where
606429ce6ecbSAvraham Stern  * the bss entry of the new AP is seen in the driver, but gets timed out by the
606529ce6ecbSAvraham Stern  * time it is accessed in __cfg80211_roamed() due to delay in scheduling
6066adbde344SVasanthakumar Thiagarajan  * rdev->event_work. In case of any failures, the reference is released
606729ce6ecbSAvraham Stern  * either in cfg80211_roamed() or in __cfg80211_romed(), Otherwise, it will be
606829ce6ecbSAvraham Stern  * released while diconneting from the current bss.
6069adbde344SVasanthakumar Thiagarajan  */
607029ce6ecbSAvraham Stern void cfg80211_roamed(struct net_device *dev, struct cfg80211_roam_info *info,
607129ce6ecbSAvraham Stern 		     gfp_t gfp);
6072adbde344SVasanthakumar Thiagarajan 
6073adbde344SVasanthakumar Thiagarajan /**
6074503c1fb9SAvraham Stern  * cfg80211_port_authorized - notify cfg80211 of successful security association
6075503c1fb9SAvraham Stern  *
6076503c1fb9SAvraham Stern  * @dev: network device
6077503c1fb9SAvraham Stern  * @bssid: the BSSID of the AP
6078503c1fb9SAvraham Stern  * @gfp: allocation flags
6079503c1fb9SAvraham Stern  *
6080503c1fb9SAvraham Stern  * This function should be called by a driver that supports 4 way handshake
6081503c1fb9SAvraham Stern  * offload after a security association was successfully established (i.e.,
6082503c1fb9SAvraham Stern  * the 4 way handshake was completed successfully). The call to this function
6083503c1fb9SAvraham Stern  * should be preceded with a call to cfg80211_connect_result(),
6084503c1fb9SAvraham Stern  * cfg80211_connect_done(), cfg80211_connect_bss() or cfg80211_roamed() to
6085503c1fb9SAvraham Stern  * indicate the 802.11 association.
6086503c1fb9SAvraham Stern  */
6087503c1fb9SAvraham Stern void cfg80211_port_authorized(struct net_device *dev, const u8 *bssid,
6088503c1fb9SAvraham Stern 			      gfp_t gfp);
6089503c1fb9SAvraham Stern 
6090503c1fb9SAvraham Stern /**
6091b23aa676SSamuel Ortiz  * cfg80211_disconnected - notify cfg80211 that connection was dropped
6092b23aa676SSamuel Ortiz  *
6093b23aa676SSamuel Ortiz  * @dev: network device
6094b23aa676SSamuel Ortiz  * @ie: information elements of the deauth/disassoc frame (may be %NULL)
6095b23aa676SSamuel Ortiz  * @ie_len: length of IEs
6096b23aa676SSamuel Ortiz  * @reason: reason code for the disconnection, set it to 0 if unknown
609780279fb7SJohannes Berg  * @locally_generated: disconnection was requested locally
6098b23aa676SSamuel Ortiz  * @gfp: allocation flags
6099b23aa676SSamuel Ortiz  *
6100b23aa676SSamuel Ortiz  * After it calls this function, the driver should enter an idle state
6101b23aa676SSamuel Ortiz  * and not try to connect to any AP any more.
6102b23aa676SSamuel Ortiz  */
6103b23aa676SSamuel Ortiz void cfg80211_disconnected(struct net_device *dev, u16 reason,
610480279fb7SJohannes Berg 			   const u8 *ie, size_t ie_len,
610580279fb7SJohannes Berg 			   bool locally_generated, gfp_t gfp);
6106b23aa676SSamuel Ortiz 
61079588bbd5SJouni Malinen /**
61089588bbd5SJouni Malinen  * cfg80211_ready_on_channel - notification of remain_on_channel start
610971bbc994SJohannes Berg  * @wdev: wireless device
61109588bbd5SJouni Malinen  * @cookie: the request cookie
61119588bbd5SJouni Malinen  * @chan: The current channel (from remain_on_channel request)
61129588bbd5SJouni Malinen  * @duration: Duration in milliseconds that the driver intents to remain on the
61139588bbd5SJouni Malinen  *	channel
61149588bbd5SJouni Malinen  * @gfp: allocation flags
61159588bbd5SJouni Malinen  */
611671bbc994SJohannes Berg void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie,
61179588bbd5SJouni Malinen 			       struct ieee80211_channel *chan,
61189588bbd5SJouni Malinen 			       unsigned int duration, gfp_t gfp);
61199588bbd5SJouni Malinen 
61209588bbd5SJouni Malinen /**
61219588bbd5SJouni Malinen  * cfg80211_remain_on_channel_expired - remain_on_channel duration expired
612271bbc994SJohannes Berg  * @wdev: wireless device
61239588bbd5SJouni Malinen  * @cookie: the request cookie
61249588bbd5SJouni Malinen  * @chan: The current channel (from remain_on_channel request)
61259588bbd5SJouni Malinen  * @gfp: allocation flags
61269588bbd5SJouni Malinen  */
612771bbc994SJohannes Berg void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie,
61289588bbd5SJouni Malinen 					struct ieee80211_channel *chan,
61299588bbd5SJouni Malinen 					gfp_t gfp);
6130b23aa676SSamuel Ortiz 
61318689c051SArend van Spriel /**
61328689c051SArend van Spriel  * cfg80211_sinfo_alloc_tid_stats - allocate per-tid statistics.
61338689c051SArend van Spriel  *
61348689c051SArend van Spriel  * @sinfo: the station information
61358689c051SArend van Spriel  * @gfp: allocation flags
61368689c051SArend van Spriel  */
61378689c051SArend van Spriel int cfg80211_sinfo_alloc_tid_stats(struct station_info *sinfo, gfp_t gfp);
613898b62183SJohannes Berg 
613998b62183SJohannes Berg /**
61407ea3e110SJohannes Berg  * cfg80211_sinfo_release_content - release contents of station info
61417ea3e110SJohannes Berg  * @sinfo: the station information
61427ea3e110SJohannes Berg  *
61437ea3e110SJohannes Berg  * Releases any potentially allocated sub-information of the station
61447ea3e110SJohannes Berg  * information, but not the struct itself (since it's typically on
61457ea3e110SJohannes Berg  * the stack.)
61467ea3e110SJohannes Berg  */
61477ea3e110SJohannes Berg static inline void cfg80211_sinfo_release_content(struct station_info *sinfo)
61487ea3e110SJohannes Berg {
61497ea3e110SJohannes Berg 	kfree(sinfo->pertid);
61507ea3e110SJohannes Berg }
61517ea3e110SJohannes Berg 
61527ea3e110SJohannes Berg /**
615398b62183SJohannes Berg  * cfg80211_new_sta - notify userspace about station
615498b62183SJohannes Berg  *
615598b62183SJohannes Berg  * @dev: the netdev
615698b62183SJohannes Berg  * @mac_addr: the station's address
615798b62183SJohannes Berg  * @sinfo: the station information
615898b62183SJohannes Berg  * @gfp: allocation flags
615998b62183SJohannes Berg  */
616098b62183SJohannes Berg void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr,
616198b62183SJohannes Berg 		      struct station_info *sinfo, gfp_t gfp);
616298b62183SJohannes Berg 
6163026331c4SJouni Malinen /**
6164cf5ead82SJohannes Berg  * cfg80211_del_sta_sinfo - notify userspace about deletion of a station
6165cf5ead82SJohannes Berg  * @dev: the netdev
6166cf5ead82SJohannes Berg  * @mac_addr: the station's address
6167cf5ead82SJohannes Berg  * @sinfo: the station information/statistics
6168cf5ead82SJohannes Berg  * @gfp: allocation flags
6169cf5ead82SJohannes Berg  */
6170cf5ead82SJohannes Berg void cfg80211_del_sta_sinfo(struct net_device *dev, const u8 *mac_addr,
6171cf5ead82SJohannes Berg 			    struct station_info *sinfo, gfp_t gfp);
6172cf5ead82SJohannes Berg 
6173cf5ead82SJohannes Berg /**
6174ec15e68bSJouni Malinen  * cfg80211_del_sta - notify userspace about deletion of a station
6175ec15e68bSJouni Malinen  *
6176ec15e68bSJouni Malinen  * @dev: the netdev
6177ec15e68bSJouni Malinen  * @mac_addr: the station's address
6178ec15e68bSJouni Malinen  * @gfp: allocation flags
6179ec15e68bSJouni Malinen  */
6180cf5ead82SJohannes Berg static inline void cfg80211_del_sta(struct net_device *dev,
6181cf5ead82SJohannes Berg 				    const u8 *mac_addr, gfp_t gfp)
6182cf5ead82SJohannes Berg {
6183cf5ead82SJohannes Berg 	cfg80211_del_sta_sinfo(dev, mac_addr, NULL, gfp);
6184cf5ead82SJohannes Berg }
6185ec15e68bSJouni Malinen 
6186ec15e68bSJouni Malinen /**
6187ed44a951SPandiyarajan Pitchaimuthu  * cfg80211_conn_failed - connection request failed notification
6188ed44a951SPandiyarajan Pitchaimuthu  *
6189ed44a951SPandiyarajan Pitchaimuthu  * @dev: the netdev
6190ed44a951SPandiyarajan Pitchaimuthu  * @mac_addr: the station's address
6191ed44a951SPandiyarajan Pitchaimuthu  * @reason: the reason for connection failure
6192ed44a951SPandiyarajan Pitchaimuthu  * @gfp: allocation flags
6193ed44a951SPandiyarajan Pitchaimuthu  *
6194ed44a951SPandiyarajan Pitchaimuthu  * Whenever a station tries to connect to an AP and if the station
6195ed44a951SPandiyarajan Pitchaimuthu  * could not connect to the AP as the AP has rejected the connection
6196ed44a951SPandiyarajan Pitchaimuthu  * for some reasons, this function is called.
6197ed44a951SPandiyarajan Pitchaimuthu  *
6198ed44a951SPandiyarajan Pitchaimuthu  * The reason for connection failure can be any of the value from
6199ed44a951SPandiyarajan Pitchaimuthu  * nl80211_connect_failed_reason enum
6200ed44a951SPandiyarajan Pitchaimuthu  */
6201ed44a951SPandiyarajan Pitchaimuthu void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr,
6202ed44a951SPandiyarajan Pitchaimuthu 			  enum nl80211_connect_failed_reason reason,
6203ed44a951SPandiyarajan Pitchaimuthu 			  gfp_t gfp);
6204ed44a951SPandiyarajan Pitchaimuthu 
6205ed44a951SPandiyarajan Pitchaimuthu /**
62062e161f78SJohannes Berg  * cfg80211_rx_mgmt - notification of received, unprocessed management frame
620771bbc994SJohannes Berg  * @wdev: wireless device receiving the frame
6208026331c4SJouni Malinen  * @freq: Frequency on which the frame was received in MHz
62096c2fb1e6SSergey Matyukevich  * @sig_dbm: signal strength in dBm, or 0 if unknown
62102e161f78SJohannes Berg  * @buf: Management frame (header + body)
6211026331c4SJouni Malinen  * @len: length of the frame data
621219504cf5SVladimir Kondratiev  * @flags: flags, as defined in enum nl80211_rxmgmt_flags
62132e161f78SJohannes Berg  *
62140ae997dcSYacine Belkadi  * This function is called whenever an Action frame is received for a station
62150ae997dcSYacine Belkadi  * mode interface, but is not processed in kernel.
62160ae997dcSYacine Belkadi  *
62170ae997dcSYacine Belkadi  * Return: %true if a user space application has registered for this frame.
62182e161f78SJohannes Berg  * For action frames, that makes it responsible for rejecting unrecognized
62192e161f78SJohannes Berg  * action frames; %false otherwise, in which case for action frames the
62202e161f78SJohannes Berg  * driver is responsible for rejecting the frame.
6221026331c4SJouni Malinen  */
622271bbc994SJohannes Berg bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int sig_dbm,
6223970fdfa8SVladimir Kondratiev 		      const u8 *buf, size_t len, u32 flags);
6224026331c4SJouni Malinen 
6225026331c4SJouni Malinen /**
62262e161f78SJohannes Berg  * cfg80211_mgmt_tx_status - notification of TX status for management frame
622771bbc994SJohannes Berg  * @wdev: wireless device receiving the frame
62282e161f78SJohannes Berg  * @cookie: Cookie returned by cfg80211_ops::mgmt_tx()
62292e161f78SJohannes Berg  * @buf: Management frame (header + body)
6230026331c4SJouni Malinen  * @len: length of the frame data
6231026331c4SJouni Malinen  * @ack: Whether frame was acknowledged
6232026331c4SJouni Malinen  * @gfp: context flags
6233026331c4SJouni Malinen  *
62342e161f78SJohannes Berg  * This function is called whenever a management frame was requested to be
62352e161f78SJohannes Berg  * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the
6236026331c4SJouni Malinen  * transmission attempt.
6237026331c4SJouni Malinen  */
623871bbc994SJohannes Berg void cfg80211_mgmt_tx_status(struct wireless_dev *wdev, u64 cookie,
6239026331c4SJouni Malinen 			     const u8 *buf, size_t len, bool ack, gfp_t gfp);
6240026331c4SJouni Malinen 
6241d6dc1a38SJuuso Oikarinen 
6242d6dc1a38SJuuso Oikarinen /**
62436a671a50SDenis Kenzior  * cfg80211_rx_control_port - notification about a received control port frame
62446a671a50SDenis Kenzior  * @dev: The device the frame matched to
6245a948f713SDenis Kenzior  * @skb: The skbuf with the control port frame.  It is assumed that the skbuf
6246a948f713SDenis Kenzior  *	is 802.3 formatted (with 802.3 header).  The skb can be non-linear.
6247a948f713SDenis Kenzior  *	This function does not take ownership of the skb, so the caller is
6248a948f713SDenis Kenzior  *	responsible for any cleanup.  The caller must also ensure that
6249a948f713SDenis Kenzior  *	skb->protocol is set appropriately.
62506a671a50SDenis Kenzior  * @unencrypted: Whether the frame was received unencrypted
62516a671a50SDenis Kenzior  *
62526a671a50SDenis Kenzior  * This function is used to inform userspace about a received control port
62536a671a50SDenis Kenzior  * frame.  It should only be used if userspace indicated it wants to receive
62546a671a50SDenis Kenzior  * control port frames over nl80211.
62556a671a50SDenis Kenzior  *
62566a671a50SDenis Kenzior  * The frame is the data portion of the 802.3 or 802.11 data frame with all
62576a671a50SDenis Kenzior  * network layer headers removed (e.g. the raw EAPoL frame).
62586a671a50SDenis Kenzior  *
62596a671a50SDenis Kenzior  * Return: %true if the frame was passed to userspace
62606a671a50SDenis Kenzior  */
62616a671a50SDenis Kenzior bool cfg80211_rx_control_port(struct net_device *dev,
6262a948f713SDenis Kenzior 			      struct sk_buff *skb, bool unencrypted);
62636a671a50SDenis Kenzior 
62646a671a50SDenis Kenzior /**
6265d6dc1a38SJuuso Oikarinen  * cfg80211_cqm_rssi_notify - connection quality monitoring rssi event
6266d6dc1a38SJuuso Oikarinen  * @dev: network device
6267d6dc1a38SJuuso Oikarinen  * @rssi_event: the triggered RSSI event
6268bee427b8SAndrzej Zaborowski  * @rssi_level: new RSSI level value or 0 if not available
6269d6dc1a38SJuuso Oikarinen  * @gfp: context flags
6270d6dc1a38SJuuso Oikarinen  *
6271d6dc1a38SJuuso Oikarinen  * This function is called when a configured connection quality monitoring
6272d6dc1a38SJuuso Oikarinen  * rssi threshold reached event occurs.
6273d6dc1a38SJuuso Oikarinen  */
6274d6dc1a38SJuuso Oikarinen void cfg80211_cqm_rssi_notify(struct net_device *dev,
6275d6dc1a38SJuuso Oikarinen 			      enum nl80211_cqm_rssi_threshold_event rssi_event,
6276bee427b8SAndrzej Zaborowski 			      s32 rssi_level, gfp_t gfp);
6277d6dc1a38SJuuso Oikarinen 
6278c063dbf5SJohannes Berg /**
6279c063dbf5SJohannes Berg  * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer
6280c063dbf5SJohannes Berg  * @dev: network device
6281c063dbf5SJohannes Berg  * @peer: peer's MAC address
6282c063dbf5SJohannes Berg  * @num_packets: how many packets were lost -- should be a fixed threshold
6283c063dbf5SJohannes Berg  *	but probably no less than maybe 50, or maybe a throughput dependent
6284c063dbf5SJohannes Berg  *	threshold (to account for temporary interference)
6285c063dbf5SJohannes Berg  * @gfp: context flags
6286c063dbf5SJohannes Berg  */
6287c063dbf5SJohannes Berg void cfg80211_cqm_pktloss_notify(struct net_device *dev,
6288c063dbf5SJohannes Berg 				 const u8 *peer, u32 num_packets, gfp_t gfp);
6289c063dbf5SJohannes Berg 
6290e5497d76SJohannes Berg /**
629184f10708SThomas Pedersen  * cfg80211_cqm_txe_notify - TX error rate event
629284f10708SThomas Pedersen  * @dev: network device
629384f10708SThomas Pedersen  * @peer: peer's MAC address
629484f10708SThomas Pedersen  * @num_packets: how many packets were lost
629584f10708SThomas Pedersen  * @rate: % of packets which failed transmission
629684f10708SThomas Pedersen  * @intvl: interval (in s) over which the TX failure threshold was breached.
629784f10708SThomas Pedersen  * @gfp: context flags
629884f10708SThomas Pedersen  *
629984f10708SThomas Pedersen  * Notify userspace when configured % TX failures over number of packets in a
630084f10708SThomas Pedersen  * given interval is exceeded.
630184f10708SThomas Pedersen  */
630284f10708SThomas Pedersen void cfg80211_cqm_txe_notify(struct net_device *dev, const u8 *peer,
630384f10708SThomas Pedersen 			     u32 num_packets, u32 rate, u32 intvl, gfp_t gfp);
630484f10708SThomas Pedersen 
630584f10708SThomas Pedersen /**
630698f03342SJohannes Berg  * cfg80211_cqm_beacon_loss_notify - beacon loss event
630798f03342SJohannes Berg  * @dev: network device
630898f03342SJohannes Berg  * @gfp: context flags
630998f03342SJohannes Berg  *
631098f03342SJohannes Berg  * Notify userspace about beacon loss from the connected AP.
631198f03342SJohannes Berg  */
631298f03342SJohannes Berg void cfg80211_cqm_beacon_loss_notify(struct net_device *dev, gfp_t gfp);
631398f03342SJohannes Berg 
631498f03342SJohannes Berg /**
63155b97f49dSJohannes Berg  * cfg80211_radar_event - radar detection event
63165b97f49dSJohannes Berg  * @wiphy: the wiphy
63175b97f49dSJohannes Berg  * @chandef: chandef for the current channel
63185b97f49dSJohannes Berg  * @gfp: context flags
63195b97f49dSJohannes Berg  *
63205b97f49dSJohannes Berg  * This function is called when a radar is detected on the current chanenl.
63215b97f49dSJohannes Berg  */
63225b97f49dSJohannes Berg void cfg80211_radar_event(struct wiphy *wiphy,
63235b97f49dSJohannes Berg 			  struct cfg80211_chan_def *chandef, gfp_t gfp);
63245b97f49dSJohannes Berg 
63255b97f49dSJohannes Berg /**
6326466b9936Stamizhr@codeaurora.org  * cfg80211_sta_opmode_change_notify - STA's ht/vht operation mode change event
6327466b9936Stamizhr@codeaurora.org  * @dev: network device
6328466b9936Stamizhr@codeaurora.org  * @mac: MAC address of a station which opmode got modified
6329466b9936Stamizhr@codeaurora.org  * @sta_opmode: station's current opmode value
6330466b9936Stamizhr@codeaurora.org  * @gfp: context flags
6331466b9936Stamizhr@codeaurora.org  *
6332466b9936Stamizhr@codeaurora.org  * Driver should call this function when station's opmode modified via action
6333466b9936Stamizhr@codeaurora.org  * frame.
6334466b9936Stamizhr@codeaurora.org  */
6335466b9936Stamizhr@codeaurora.org void cfg80211_sta_opmode_change_notify(struct net_device *dev, const u8 *mac,
6336466b9936Stamizhr@codeaurora.org 				       struct sta_opmode_info *sta_opmode,
6337466b9936Stamizhr@codeaurora.org 				       gfp_t gfp);
6338466b9936Stamizhr@codeaurora.org 
6339466b9936Stamizhr@codeaurora.org /**
63405b97f49dSJohannes Berg  * cfg80211_cac_event - Channel availability check (CAC) event
63415b97f49dSJohannes Berg  * @netdev: network device
63425b97f49dSJohannes Berg  * @chandef: chandef for the current channel
63435b97f49dSJohannes Berg  * @event: type of event
63445b97f49dSJohannes Berg  * @gfp: context flags
63455b97f49dSJohannes Berg  *
63465b97f49dSJohannes Berg  * This function is called when a Channel availability check (CAC) is finished
63475b97f49dSJohannes Berg  * or aborted. This must be called to notify the completion of a CAC process,
63485b97f49dSJohannes Berg  * also by full-MAC drivers.
63495b97f49dSJohannes Berg  */
63505b97f49dSJohannes Berg void cfg80211_cac_event(struct net_device *netdev,
63515b97f49dSJohannes Berg 			const struct cfg80211_chan_def *chandef,
63525b97f49dSJohannes Berg 			enum nl80211_radar_event event, gfp_t gfp);
63535b97f49dSJohannes Berg 
63545b97f49dSJohannes Berg 
63555b97f49dSJohannes Berg /**
6356e5497d76SJohannes Berg  * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying
6357e5497d76SJohannes Berg  * @dev: network device
6358e5497d76SJohannes Berg  * @bssid: BSSID of AP (to avoid races)
6359e5497d76SJohannes Berg  * @replay_ctr: new replay counter
6360af71ff85SJohannes Berg  * @gfp: allocation flags
6361e5497d76SJohannes Berg  */
6362e5497d76SJohannes Berg void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid,
6363e5497d76SJohannes Berg 			       const u8 *replay_ctr, gfp_t gfp);
6364e5497d76SJohannes Berg 
6365c9df56b4SJouni Malinen /**
6366c9df56b4SJouni Malinen  * cfg80211_pmksa_candidate_notify - notify about PMKSA caching candidate
6367c9df56b4SJouni Malinen  * @dev: network device
6368c9df56b4SJouni Malinen  * @index: candidate index (the smaller the index, the higher the priority)
6369c9df56b4SJouni Malinen  * @bssid: BSSID of AP
6370c9df56b4SJouni Malinen  * @preauth: Whether AP advertises support for RSN pre-authentication
6371c9df56b4SJouni Malinen  * @gfp: allocation flags
6372c9df56b4SJouni Malinen  */
6373c9df56b4SJouni Malinen void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index,
6374c9df56b4SJouni Malinen 				     const u8 *bssid, bool preauth, gfp_t gfp);
6375c9df56b4SJouni Malinen 
637628946da7SJohannes Berg /**
637728946da7SJohannes Berg  * cfg80211_rx_spurious_frame - inform userspace about a spurious frame
637828946da7SJohannes Berg  * @dev: The device the frame matched to
637928946da7SJohannes Berg  * @addr: the transmitter address
638028946da7SJohannes Berg  * @gfp: context flags
638128946da7SJohannes Berg  *
638228946da7SJohannes Berg  * This function is used in AP mode (only!) to inform userspace that
638328946da7SJohannes Berg  * a spurious class 3 frame was received, to be able to deauth the
638428946da7SJohannes Berg  * sender.
63850ae997dcSYacine Belkadi  * Return: %true if the frame was passed to userspace (or this failed
638628946da7SJohannes Berg  * for a reason other than not having a subscription.)
638728946da7SJohannes Berg  */
638828946da7SJohannes Berg bool cfg80211_rx_spurious_frame(struct net_device *dev,
638928946da7SJohannes Berg 				const u8 *addr, gfp_t gfp);
639028946da7SJohannes Berg 
63917f6cf311SJohannes Berg /**
6392b92ab5d8SJohannes Berg  * cfg80211_rx_unexpected_4addr_frame - inform about unexpected WDS frame
6393b92ab5d8SJohannes Berg  * @dev: The device the frame matched to
6394b92ab5d8SJohannes Berg  * @addr: the transmitter address
6395b92ab5d8SJohannes Berg  * @gfp: context flags
6396b92ab5d8SJohannes Berg  *
6397b92ab5d8SJohannes Berg  * This function is used in AP mode (only!) to inform userspace that
6398b92ab5d8SJohannes Berg  * an associated station sent a 4addr frame but that wasn't expected.
6399b92ab5d8SJohannes Berg  * It is allowed and desirable to send this event only once for each
6400b92ab5d8SJohannes Berg  * station to avoid event flooding.
64010ae997dcSYacine Belkadi  * Return: %true if the frame was passed to userspace (or this failed
6402b92ab5d8SJohannes Berg  * for a reason other than not having a subscription.)
6403b92ab5d8SJohannes Berg  */
6404b92ab5d8SJohannes Berg bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev,
6405b92ab5d8SJohannes Berg 					const u8 *addr, gfp_t gfp);
6406b92ab5d8SJohannes Berg 
6407b92ab5d8SJohannes Berg /**
64087f6cf311SJohannes Berg  * cfg80211_probe_status - notify userspace about probe status
64097f6cf311SJohannes Berg  * @dev: the device the probe was sent on
64107f6cf311SJohannes Berg  * @addr: the address of the peer
64117f6cf311SJohannes Berg  * @cookie: the cookie filled in @probe_client previously
64127f6cf311SJohannes Berg  * @acked: indicates whether probe was acked or not
6413c4b50cd3SVenkateswara Naralasetty  * @ack_signal: signal strength (in dBm) of the ACK frame.
6414c4b50cd3SVenkateswara Naralasetty  * @is_valid_ack_signal: indicates the ack_signal is valid or not.
64157f6cf311SJohannes Berg  * @gfp: allocation flags
64167f6cf311SJohannes Berg  */
64177f6cf311SJohannes Berg void cfg80211_probe_status(struct net_device *dev, const u8 *addr,
6418c4b50cd3SVenkateswara Naralasetty 			   u64 cookie, bool acked, s32 ack_signal,
6419c4b50cd3SVenkateswara Naralasetty 			   bool is_valid_ack_signal, gfp_t gfp);
64207f6cf311SJohannes Berg 
64215e760230SJohannes Berg /**
64225e760230SJohannes Berg  * cfg80211_report_obss_beacon - report beacon from other APs
64235e760230SJohannes Berg  * @wiphy: The wiphy that received the beacon
64245e760230SJohannes Berg  * @frame: the frame
64255e760230SJohannes Berg  * @len: length of the frame
64265e760230SJohannes Berg  * @freq: frequency the frame was received on
64276c2fb1e6SSergey Matyukevich  * @sig_dbm: signal strength in dBm, or 0 if unknown
64285e760230SJohannes Berg  *
64295e760230SJohannes Berg  * Use this function to report to userspace when a beacon was
64305e760230SJohannes Berg  * received. It is not useful to call this when there is no
64315e760230SJohannes Berg  * netdev that is in AP/GO mode.
64325e760230SJohannes Berg  */
64335e760230SJohannes Berg void cfg80211_report_obss_beacon(struct wiphy *wiphy,
64345e760230SJohannes Berg 				 const u8 *frame, size_t len,
643537c73b5fSBen Greear 				 int freq, int sig_dbm);
64365e760230SJohannes Berg 
6437d58e7e37SJohannes Berg /**
6438683b6d3bSJohannes Berg  * cfg80211_reg_can_beacon - check if beaconing is allowed
643954858ee5SAlexander Simon  * @wiphy: the wiphy
6440683b6d3bSJohannes Berg  * @chandef: the channel definition
6441174e0cd2SIlan Peer  * @iftype: interface type
6442d58e7e37SJohannes Berg  *
64430ae997dcSYacine Belkadi  * Return: %true if there is no secondary channel or the secondary channel(s)
64440ae997dcSYacine Belkadi  * can be used for beaconing (i.e. is not a radar channel etc.)
644554858ee5SAlexander Simon  */
6446683b6d3bSJohannes Berg bool cfg80211_reg_can_beacon(struct wiphy *wiphy,
6447174e0cd2SIlan Peer 			     struct cfg80211_chan_def *chandef,
6448174e0cd2SIlan Peer 			     enum nl80211_iftype iftype);
644954858ee5SAlexander Simon 
6450923b352fSArik Nemtsov /**
6451923b352fSArik Nemtsov  * cfg80211_reg_can_beacon_relax - check if beaconing is allowed with relaxation
6452923b352fSArik Nemtsov  * @wiphy: the wiphy
6453923b352fSArik Nemtsov  * @chandef: the channel definition
6454923b352fSArik Nemtsov  * @iftype: interface type
6455923b352fSArik Nemtsov  *
6456923b352fSArik Nemtsov  * Return: %true if there is no secondary channel or the secondary channel(s)
6457923b352fSArik Nemtsov  * can be used for beaconing (i.e. is not a radar channel etc.). This version
6458923b352fSArik Nemtsov  * also checks if IR-relaxation conditions apply, to allow beaconing under
6459923b352fSArik Nemtsov  * more permissive conditions.
6460923b352fSArik Nemtsov  *
6461923b352fSArik Nemtsov  * Requires the RTNL to be held.
6462923b352fSArik Nemtsov  */
6463923b352fSArik Nemtsov bool cfg80211_reg_can_beacon_relax(struct wiphy *wiphy,
6464923b352fSArik Nemtsov 				   struct cfg80211_chan_def *chandef,
6465923b352fSArik Nemtsov 				   enum nl80211_iftype iftype);
6466923b352fSArik Nemtsov 
64678097e149SThomas Pedersen /*
64685314526bSThomas Pedersen  * cfg80211_ch_switch_notify - update wdev channel and notify userspace
64695314526bSThomas Pedersen  * @dev: the device which switched channels
6470683b6d3bSJohannes Berg  * @chandef: the new channel definition
64715314526bSThomas Pedersen  *
6472e487eaebSSimon Wunderlich  * Caller must acquire wdev_lock, therefore must only be called from sleepable
6473e487eaebSSimon Wunderlich  * driver context!
64745314526bSThomas Pedersen  */
6475683b6d3bSJohannes Berg void cfg80211_ch_switch_notify(struct net_device *dev,
6476683b6d3bSJohannes Berg 			       struct cfg80211_chan_def *chandef);
64775314526bSThomas Pedersen 
6478f8d7552eSLuciano Coelho /*
6479f8d7552eSLuciano Coelho  * cfg80211_ch_switch_started_notify - notify channel switch start
6480f8d7552eSLuciano Coelho  * @dev: the device on which the channel switch started
6481f8d7552eSLuciano Coelho  * @chandef: the future channel definition
6482f8d7552eSLuciano Coelho  * @count: the number of TBTTs until the channel switch happens
6483f8d7552eSLuciano Coelho  *
6484f8d7552eSLuciano Coelho  * Inform the userspace about the channel switch that has just
6485f8d7552eSLuciano Coelho  * started, so that it can take appropriate actions (eg. starting
6486f8d7552eSLuciano Coelho  * channel switch on other vifs), if necessary.
6487f8d7552eSLuciano Coelho  */
6488f8d7552eSLuciano Coelho void cfg80211_ch_switch_started_notify(struct net_device *dev,
6489f8d7552eSLuciano Coelho 				       struct cfg80211_chan_def *chandef,
6490f8d7552eSLuciano Coelho 				       u8 count);
6491f8d7552eSLuciano Coelho 
64921ce3e82bSJohannes Berg /**
64931ce3e82bSJohannes Berg  * ieee80211_operating_class_to_band - convert operating class to band
64941ce3e82bSJohannes Berg  *
64951ce3e82bSJohannes Berg  * @operating_class: the operating class to convert
64961ce3e82bSJohannes Berg  * @band: band pointer to fill
64971ce3e82bSJohannes Berg  *
64981ce3e82bSJohannes Berg  * Returns %true if the conversion was successful, %false otherwise.
64991ce3e82bSJohannes Berg  */
65001ce3e82bSJohannes Berg bool ieee80211_operating_class_to_band(u8 operating_class,
650157fbcce3SJohannes Berg 				       enum nl80211_band *band);
65021ce3e82bSJohannes Berg 
6503a38700ddSArik Nemtsov /**
6504a38700ddSArik Nemtsov  * ieee80211_chandef_to_operating_class - convert chandef to operation class
6505a38700ddSArik Nemtsov  *
6506a38700ddSArik Nemtsov  * @chandef: the chandef to convert
6507a38700ddSArik Nemtsov  * @op_class: a pointer to the resulting operating class
6508a38700ddSArik Nemtsov  *
6509a38700ddSArik Nemtsov  * Returns %true if the conversion was successful, %false otherwise.
6510a38700ddSArik Nemtsov  */
6511a38700ddSArik Nemtsov bool ieee80211_chandef_to_operating_class(struct cfg80211_chan_def *chandef,
6512a38700ddSArik Nemtsov 					  u8 *op_class);
6513a38700ddSArik Nemtsov 
65145314526bSThomas Pedersen /*
65153475b094SJouni Malinen  * cfg80211_tdls_oper_request - request userspace to perform TDLS operation
65163475b094SJouni Malinen  * @dev: the device on which the operation is requested
65173475b094SJouni Malinen  * @peer: the MAC address of the peer device
65183475b094SJouni Malinen  * @oper: the requested TDLS operation (NL80211_TDLS_SETUP or
65193475b094SJouni Malinen  *	NL80211_TDLS_TEARDOWN)
65203475b094SJouni Malinen  * @reason_code: the reason code for teardown request
65213475b094SJouni Malinen  * @gfp: allocation flags
65223475b094SJouni Malinen  *
65233475b094SJouni Malinen  * This function is used to request userspace to perform TDLS operation that
65243475b094SJouni Malinen  * requires knowledge of keys, i.e., link setup or teardown when the AP
65253475b094SJouni Malinen  * connection uses encryption. This is optional mechanism for the driver to use
65263475b094SJouni Malinen  * if it can automatically determine when a TDLS link could be useful (e.g.,
65273475b094SJouni Malinen  * based on traffic and signal strength for a peer).
65283475b094SJouni Malinen  */
65293475b094SJouni Malinen void cfg80211_tdls_oper_request(struct net_device *dev, const u8 *peer,
65303475b094SJouni Malinen 				enum nl80211_tdls_operation oper,
65313475b094SJouni Malinen 				u16 reason_code, gfp_t gfp);
65323475b094SJouni Malinen 
65333475b094SJouni Malinen /*
65348097e149SThomas Pedersen  * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units)
65358097e149SThomas Pedersen  * @rate: given rate_info to calculate bitrate from
65368097e149SThomas Pedersen  *
65378097e149SThomas Pedersen  * return 0 if MCS index >= 32
65388097e149SThomas Pedersen  */
65398eb41c8dSVladimir Kondratiev u32 cfg80211_calculate_bitrate(struct rate_info *rate);
65408097e149SThomas Pedersen 
654198104fdeSJohannes Berg /**
654298104fdeSJohannes Berg  * cfg80211_unregister_wdev - remove the given wdev
654398104fdeSJohannes Berg  * @wdev: struct wireless_dev to remove
654498104fdeSJohannes Berg  *
654598104fdeSJohannes Berg  * Call this function only for wdevs that have no netdev assigned,
654698104fdeSJohannes Berg  * e.g. P2P Devices. It removes the device from the list so that
654798104fdeSJohannes Berg  * it can no longer be used. It is necessary to call this function
654898104fdeSJohannes Berg  * even when cfg80211 requests the removal of the interface by
654998104fdeSJohannes Berg  * calling the del_virtual_intf() callback. The function must also
655098104fdeSJohannes Berg  * be called when the driver wishes to unregister the wdev, e.g.
655198104fdeSJohannes Berg  * when the device is unbound from the driver.
655298104fdeSJohannes Berg  *
655398104fdeSJohannes Berg  * Requires the RTNL to be held.
655498104fdeSJohannes Berg  */
655598104fdeSJohannes Berg void cfg80211_unregister_wdev(struct wireless_dev *wdev);
655698104fdeSJohannes Berg 
65570ee45355SJohannes Berg /**
6558355199e0SJouni Malinen  * struct cfg80211_ft_event - FT Information Elements
6559355199e0SJouni Malinen  * @ies: FT IEs
6560355199e0SJouni Malinen  * @ies_len: length of the FT IE in bytes
6561355199e0SJouni Malinen  * @target_ap: target AP's MAC address
6562355199e0SJouni Malinen  * @ric_ies: RIC IE
6563355199e0SJouni Malinen  * @ric_ies_len: length of the RIC IE in bytes
6564355199e0SJouni Malinen  */
6565355199e0SJouni Malinen struct cfg80211_ft_event_params {
6566355199e0SJouni Malinen 	const u8 *ies;
6567355199e0SJouni Malinen 	size_t ies_len;
6568355199e0SJouni Malinen 	const u8 *target_ap;
6569355199e0SJouni Malinen 	const u8 *ric_ies;
6570355199e0SJouni Malinen 	size_t ric_ies_len;
6571355199e0SJouni Malinen };
6572355199e0SJouni Malinen 
6573355199e0SJouni Malinen /**
6574355199e0SJouni Malinen  * cfg80211_ft_event - notify userspace about FT IE and RIC IE
6575355199e0SJouni Malinen  * @netdev: network device
6576355199e0SJouni Malinen  * @ft_event: IE information
6577355199e0SJouni Malinen  */
6578355199e0SJouni Malinen void cfg80211_ft_event(struct net_device *netdev,
6579355199e0SJouni Malinen 		       struct cfg80211_ft_event_params *ft_event);
6580355199e0SJouni Malinen 
6581355199e0SJouni Malinen /**
65820ee45355SJohannes Berg  * cfg80211_get_p2p_attr - find and copy a P2P attribute from IE buffer
65830ee45355SJohannes Berg  * @ies: the input IE buffer
65840ee45355SJohannes Berg  * @len: the input length
65850ee45355SJohannes Berg  * @attr: the attribute ID to find
65860ee45355SJohannes Berg  * @buf: output buffer, can be %NULL if the data isn't needed, e.g.
65870ee45355SJohannes Berg  *	if the function is only called to get the needed buffer size
65880ee45355SJohannes Berg  * @bufsize: size of the output buffer
65890ee45355SJohannes Berg  *
65900ee45355SJohannes Berg  * The function finds a given P2P attribute in the (vendor) IEs and
65910ee45355SJohannes Berg  * copies its contents to the given buffer.
65920ee45355SJohannes Berg  *
65930ae997dcSYacine Belkadi  * Return: A negative error code (-%EILSEQ or -%ENOENT) if the data is
65940ae997dcSYacine Belkadi  * malformed or the attribute can't be found (respectively), or the
65950ae997dcSYacine Belkadi  * length of the found attribute (which can be zero).
65960ee45355SJohannes Berg  */
6597c216e641SArend van Spriel int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len,
6598c216e641SArend van Spriel 			  enum ieee80211_p2p_attr_id attr,
6599c216e641SArend van Spriel 			  u8 *buf, unsigned int bufsize);
66000ee45355SJohannes Berg 
6601cd8f7cb4SJohannes Berg /**
660229464cccSJohannes Berg  * ieee80211_ie_split_ric - split an IE buffer according to ordering (with RIC)
660329464cccSJohannes Berg  * @ies: the IE buffer
660429464cccSJohannes Berg  * @ielen: the length of the IE buffer
660529464cccSJohannes Berg  * @ids: an array with element IDs that are allowed before
66062512b1b1SLiad Kaufman  *	the split. A WLAN_EID_EXTENSION value means that the next
66072512b1b1SLiad Kaufman  *	EID in the list is a sub-element of the EXTENSION IE.
660829464cccSJohannes Berg  * @n_ids: the size of the element ID array
660929464cccSJohannes Berg  * @after_ric: array IE types that come after the RIC element
661029464cccSJohannes Berg  * @n_after_ric: size of the @after_ric array
661129464cccSJohannes Berg  * @offset: offset where to start splitting in the buffer
661229464cccSJohannes Berg  *
661329464cccSJohannes Berg  * This function splits an IE buffer by updating the @offset
661429464cccSJohannes Berg  * variable to point to the location where the buffer should be
661529464cccSJohannes Berg  * split.
661629464cccSJohannes Berg  *
661729464cccSJohannes Berg  * It assumes that the given IE buffer is well-formed, this
661829464cccSJohannes Berg  * has to be guaranteed by the caller!
661929464cccSJohannes Berg  *
662029464cccSJohannes Berg  * It also assumes that the IEs in the buffer are ordered
662129464cccSJohannes Berg  * correctly, if not the result of using this function will not
662229464cccSJohannes Berg  * be ordered correctly either, i.e. it does no reordering.
662329464cccSJohannes Berg  *
662429464cccSJohannes Berg  * The function returns the offset where the next part of the
662529464cccSJohannes Berg  * buffer starts, which may be @ielen if the entire (remainder)
662629464cccSJohannes Berg  * of the buffer should be used.
662729464cccSJohannes Berg  */
662829464cccSJohannes Berg size_t ieee80211_ie_split_ric(const u8 *ies, size_t ielen,
662929464cccSJohannes Berg 			      const u8 *ids, int n_ids,
663029464cccSJohannes Berg 			      const u8 *after_ric, int n_after_ric,
663129464cccSJohannes Berg 			      size_t offset);
663229464cccSJohannes Berg 
663329464cccSJohannes Berg /**
663429464cccSJohannes Berg  * ieee80211_ie_split - split an IE buffer according to ordering
663529464cccSJohannes Berg  * @ies: the IE buffer
663629464cccSJohannes Berg  * @ielen: the length of the IE buffer
663729464cccSJohannes Berg  * @ids: an array with element IDs that are allowed before
66382512b1b1SLiad Kaufman  *	the split. A WLAN_EID_EXTENSION value means that the next
66392512b1b1SLiad Kaufman  *	EID in the list is a sub-element of the EXTENSION IE.
664029464cccSJohannes Berg  * @n_ids: the size of the element ID array
664129464cccSJohannes Berg  * @offset: offset where to start splitting in the buffer
664229464cccSJohannes Berg  *
664329464cccSJohannes Berg  * This function splits an IE buffer by updating the @offset
664429464cccSJohannes Berg  * variable to point to the location where the buffer should be
664529464cccSJohannes Berg  * split.
664629464cccSJohannes Berg  *
664729464cccSJohannes Berg  * It assumes that the given IE buffer is well-formed, this
664829464cccSJohannes Berg  * has to be guaranteed by the caller!
664929464cccSJohannes Berg  *
665029464cccSJohannes Berg  * It also assumes that the IEs in the buffer are ordered
665129464cccSJohannes Berg  * correctly, if not the result of using this function will not
665229464cccSJohannes Berg  * be ordered correctly either, i.e. it does no reordering.
665329464cccSJohannes Berg  *
665429464cccSJohannes Berg  * The function returns the offset where the next part of the
665529464cccSJohannes Berg  * buffer starts, which may be @ielen if the entire (remainder)
665629464cccSJohannes Berg  * of the buffer should be used.
665729464cccSJohannes Berg  */
66580483eeacSJohannes Berg static inline size_t ieee80211_ie_split(const u8 *ies, size_t ielen,
66590483eeacSJohannes Berg 					const u8 *ids, int n_ids, size_t offset)
66600483eeacSJohannes Berg {
66610483eeacSJohannes Berg 	return ieee80211_ie_split_ric(ies, ielen, ids, n_ids, NULL, 0, offset);
66620483eeacSJohannes Berg }
666329464cccSJohannes Berg 
666429464cccSJohannes Berg /**
6665cd8f7cb4SJohannes Berg  * cfg80211_report_wowlan_wakeup - report wakeup from WoWLAN
6666cd8f7cb4SJohannes Berg  * @wdev: the wireless device reporting the wakeup
6667cd8f7cb4SJohannes Berg  * @wakeup: the wakeup report
6668cd8f7cb4SJohannes Berg  * @gfp: allocation flags
6669cd8f7cb4SJohannes Berg  *
6670cd8f7cb4SJohannes Berg  * This function reports that the given device woke up. If it
6671cd8f7cb4SJohannes Berg  * caused the wakeup, report the reason(s), otherwise you may
6672cd8f7cb4SJohannes Berg  * pass %NULL as the @wakeup parameter to advertise that something
6673cd8f7cb4SJohannes Berg  * else caused the wakeup.
6674cd8f7cb4SJohannes Berg  */
6675cd8f7cb4SJohannes Berg void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev,
6676cd8f7cb4SJohannes Berg 				   struct cfg80211_wowlan_wakeup *wakeup,
6677cd8f7cb4SJohannes Berg 				   gfp_t gfp);
6678cd8f7cb4SJohannes Berg 
66795de17984SArend van Spriel /**
66805de17984SArend van Spriel  * cfg80211_crit_proto_stopped() - indicate critical protocol stopped by driver.
66815de17984SArend van Spriel  *
66825de17984SArend van Spriel  * @wdev: the wireless device for which critical protocol is stopped.
668303f831a6SRobert P. J. Day  * @gfp: allocation flags
66845de17984SArend van Spriel  *
66855de17984SArend van Spriel  * This function can be called by the driver to indicate it has reverted
66865de17984SArend van Spriel  * operation back to normal. One reason could be that the duration given
66875de17984SArend van Spriel  * by .crit_proto_start() has expired.
66885de17984SArend van Spriel  */
66895de17984SArend van Spriel void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp);
66905de17984SArend van Spriel 
6691bdfbec2dSIlan Peer /**
6692bdfbec2dSIlan Peer  * ieee80211_get_num_supported_channels - get number of channels device has
6693bdfbec2dSIlan Peer  * @wiphy: the wiphy
6694bdfbec2dSIlan Peer  *
6695bdfbec2dSIlan Peer  * Return: the number of channels supported by the device.
6696bdfbec2dSIlan Peer  */
6697bdfbec2dSIlan Peer unsigned int ieee80211_get_num_supported_channels(struct wiphy *wiphy);
6698bdfbec2dSIlan Peer 
6699cb2d956dSLuciano Coelho /**
6700cb2d956dSLuciano Coelho  * cfg80211_check_combinations - check interface combinations
6701cb2d956dSLuciano Coelho  *
6702cb2d956dSLuciano Coelho  * @wiphy: the wiphy
6703e227300cSPurushottam Kushwaha  * @params: the interface combinations parameter
6704cb2d956dSLuciano Coelho  *
6705cb2d956dSLuciano Coelho  * This function can be called by the driver to check whether a
6706cb2d956dSLuciano Coelho  * combination of interfaces and their types are allowed according to
6707cb2d956dSLuciano Coelho  * the interface combinations.
6708cb2d956dSLuciano Coelho  */
6709cb2d956dSLuciano Coelho int cfg80211_check_combinations(struct wiphy *wiphy,
6710e227300cSPurushottam Kushwaha 				struct iface_combination_params *params);
6711cb2d956dSLuciano Coelho 
671265a124ddSMichal Kazior /**
671365a124ddSMichal Kazior  * cfg80211_iter_combinations - iterate over matching combinations
671465a124ddSMichal Kazior  *
671565a124ddSMichal Kazior  * @wiphy: the wiphy
6716e227300cSPurushottam Kushwaha  * @params: the interface combinations parameter
671765a124ddSMichal Kazior  * @iter: function to call for each matching combination
671865a124ddSMichal Kazior  * @data: pointer to pass to iter function
671965a124ddSMichal Kazior  *
672065a124ddSMichal Kazior  * This function can be called by the driver to check what possible
672165a124ddSMichal Kazior  * combinations it fits in at a given moment, e.g. for channel switching
672265a124ddSMichal Kazior  * purposes.
672365a124ddSMichal Kazior  */
672465a124ddSMichal Kazior int cfg80211_iter_combinations(struct wiphy *wiphy,
6725e227300cSPurushottam Kushwaha 			       struct iface_combination_params *params,
672665a124ddSMichal Kazior 			       void (*iter)(const struct ieee80211_iface_combination *c,
672765a124ddSMichal Kazior 					    void *data),
672865a124ddSMichal Kazior 			       void *data);
672965a124ddSMichal Kazior 
6730f04c2203SMichal Kazior /*
6731f04c2203SMichal Kazior  * cfg80211_stop_iface - trigger interface disconnection
6732f04c2203SMichal Kazior  *
6733f04c2203SMichal Kazior  * @wiphy: the wiphy
6734f04c2203SMichal Kazior  * @wdev: wireless device
6735f04c2203SMichal Kazior  * @gfp: context flags
6736f04c2203SMichal Kazior  *
6737f04c2203SMichal Kazior  * Trigger interface to be stopped as if AP was stopped, IBSS/mesh left, STA
6738f04c2203SMichal Kazior  * disconnected.
6739f04c2203SMichal Kazior  *
6740f04c2203SMichal Kazior  * Note: This doesn't need any locks and is asynchronous.
6741f04c2203SMichal Kazior  */
6742f04c2203SMichal Kazior void cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev,
6743f04c2203SMichal Kazior 			 gfp_t gfp);
6744f04c2203SMichal Kazior 
6745f6837ba8SJohannes Berg /**
6746f6837ba8SJohannes Berg  * cfg80211_shutdown_all_interfaces - shut down all interfaces for a wiphy
6747f6837ba8SJohannes Berg  * @wiphy: the wiphy to shut down
6748f6837ba8SJohannes Berg  *
6749f6837ba8SJohannes Berg  * This function shuts down all interfaces belonging to this wiphy by
6750f6837ba8SJohannes Berg  * calling dev_close() (and treating non-netdev interfaces as needed).
6751f6837ba8SJohannes Berg  * It shouldn't really be used unless there are some fatal device errors
6752f6837ba8SJohannes Berg  * that really can't be recovered in any other way.
6753f6837ba8SJohannes Berg  *
6754f6837ba8SJohannes Berg  * Callers must hold the RTNL and be able to deal with callbacks into
6755f6837ba8SJohannes Berg  * the driver while the function is running.
6756f6837ba8SJohannes Berg  */
6757f6837ba8SJohannes Berg void cfg80211_shutdown_all_interfaces(struct wiphy *wiphy);
6758f6837ba8SJohannes Berg 
6759d75bb06bSGautam Kumar Shukla /**
6760d75bb06bSGautam Kumar Shukla  * wiphy_ext_feature_set - set the extended feature flag
6761d75bb06bSGautam Kumar Shukla  *
6762d75bb06bSGautam Kumar Shukla  * @wiphy: the wiphy to modify.
6763d75bb06bSGautam Kumar Shukla  * @ftidx: extended feature bit index.
6764d75bb06bSGautam Kumar Shukla  *
6765d75bb06bSGautam Kumar Shukla  * The extended features are flagged in multiple bytes (see
6766d75bb06bSGautam Kumar Shukla  * &struct wiphy.@ext_features)
6767d75bb06bSGautam Kumar Shukla  */
6768d75bb06bSGautam Kumar Shukla static inline void wiphy_ext_feature_set(struct wiphy *wiphy,
6769d75bb06bSGautam Kumar Shukla 					 enum nl80211_ext_feature_index ftidx)
6770d75bb06bSGautam Kumar Shukla {
6771d75bb06bSGautam Kumar Shukla 	u8 *ft_byte;
6772d75bb06bSGautam Kumar Shukla 
6773d75bb06bSGautam Kumar Shukla 	ft_byte = &wiphy->ext_features[ftidx / 8];
6774d75bb06bSGautam Kumar Shukla 	*ft_byte |= BIT(ftidx % 8);
6775d75bb06bSGautam Kumar Shukla }
6776d75bb06bSGautam Kumar Shukla 
6777d75bb06bSGautam Kumar Shukla /**
6778d75bb06bSGautam Kumar Shukla  * wiphy_ext_feature_isset - check the extended feature flag
6779d75bb06bSGautam Kumar Shukla  *
6780d75bb06bSGautam Kumar Shukla  * @wiphy: the wiphy to modify.
6781d75bb06bSGautam Kumar Shukla  * @ftidx: extended feature bit index.
6782d75bb06bSGautam Kumar Shukla  *
6783d75bb06bSGautam Kumar Shukla  * The extended features are flagged in multiple bytes (see
6784d75bb06bSGautam Kumar Shukla  * &struct wiphy.@ext_features)
6785d75bb06bSGautam Kumar Shukla  */
6786d75bb06bSGautam Kumar Shukla static inline bool
6787d75bb06bSGautam Kumar Shukla wiphy_ext_feature_isset(struct wiphy *wiphy,
6788d75bb06bSGautam Kumar Shukla 			enum nl80211_ext_feature_index ftidx)
6789d75bb06bSGautam Kumar Shukla {
6790d75bb06bSGautam Kumar Shukla 	u8 ft_byte;
6791d75bb06bSGautam Kumar Shukla 
6792d75bb06bSGautam Kumar Shukla 	ft_byte = wiphy->ext_features[ftidx / 8];
6793d75bb06bSGautam Kumar Shukla 	return (ft_byte & BIT(ftidx % 8)) != 0;
6794d75bb06bSGautam Kumar Shukla }
6795b7ffbd7eSJohannes Berg 
6796a442b761SAyala Beker /**
6797a442b761SAyala Beker  * cfg80211_free_nan_func - free NAN function
6798a442b761SAyala Beker  * @f: NAN function that should be freed
6799a442b761SAyala Beker  *
6800a442b761SAyala Beker  * Frees all the NAN function and all it's allocated members.
6801a442b761SAyala Beker  */
6802a442b761SAyala Beker void cfg80211_free_nan_func(struct cfg80211_nan_func *f);
6803a442b761SAyala Beker 
680450bcd31dSAyala Beker /**
680550bcd31dSAyala Beker  * struct cfg80211_nan_match_params - NAN match parameters
680650bcd31dSAyala Beker  * @type: the type of the function that triggered a match. If it is
680750bcd31dSAyala Beker  *	 %NL80211_NAN_FUNC_SUBSCRIBE it means that we replied to a subscriber.
680850bcd31dSAyala Beker  *	 If it is %NL80211_NAN_FUNC_PUBLISH, it means that we got a discovery
680950bcd31dSAyala Beker  *	 result.
681050bcd31dSAyala Beker  *	 If it is %NL80211_NAN_FUNC_FOLLOW_UP, we received a follow up.
681150bcd31dSAyala Beker  * @inst_id: the local instance id
681250bcd31dSAyala Beker  * @peer_inst_id: the instance id of the peer's function
681350bcd31dSAyala Beker  * @addr: the MAC address of the peer
681450bcd31dSAyala Beker  * @info_len: the length of the &info
681550bcd31dSAyala Beker  * @info: the Service Specific Info from the peer (if any)
681650bcd31dSAyala Beker  * @cookie: unique identifier of the corresponding function
681750bcd31dSAyala Beker  */
681850bcd31dSAyala Beker struct cfg80211_nan_match_params {
681950bcd31dSAyala Beker 	enum nl80211_nan_function_type type;
682050bcd31dSAyala Beker 	u8 inst_id;
682150bcd31dSAyala Beker 	u8 peer_inst_id;
682250bcd31dSAyala Beker 	const u8 *addr;
682350bcd31dSAyala Beker 	u8 info_len;
682450bcd31dSAyala Beker 	const u8 *info;
682550bcd31dSAyala Beker 	u64 cookie;
682650bcd31dSAyala Beker };
682750bcd31dSAyala Beker 
682850bcd31dSAyala Beker /**
682950bcd31dSAyala Beker  * cfg80211_nan_match - report a match for a NAN function.
683050bcd31dSAyala Beker  * @wdev: the wireless device reporting the match
683150bcd31dSAyala Beker  * @match: match notification parameters
683250bcd31dSAyala Beker  * @gfp: allocation flags
683350bcd31dSAyala Beker  *
683450bcd31dSAyala Beker  * This function reports that the a NAN function had a match. This
683550bcd31dSAyala Beker  * can be a subscribe that had a match or a solicited publish that
683650bcd31dSAyala Beker  * was sent. It can also be a follow up that was received.
683750bcd31dSAyala Beker  */
683850bcd31dSAyala Beker void cfg80211_nan_match(struct wireless_dev *wdev,
683950bcd31dSAyala Beker 			struct cfg80211_nan_match_params *match, gfp_t gfp);
684050bcd31dSAyala Beker 
6841368e5a7bSAyala Beker /**
6842368e5a7bSAyala Beker  * cfg80211_nan_func_terminated - notify about NAN function termination.
6843368e5a7bSAyala Beker  *
6844368e5a7bSAyala Beker  * @wdev: the wireless device reporting the match
6845368e5a7bSAyala Beker  * @inst_id: the local instance id
6846368e5a7bSAyala Beker  * @reason: termination reason (one of the NL80211_NAN_FUNC_TERM_REASON_*)
6847368e5a7bSAyala Beker  * @cookie: unique NAN function identifier
6848368e5a7bSAyala Beker  * @gfp: allocation flags
6849368e5a7bSAyala Beker  *
6850368e5a7bSAyala Beker  * This function reports that the a NAN function is terminated.
6851368e5a7bSAyala Beker  */
6852368e5a7bSAyala Beker void cfg80211_nan_func_terminated(struct wireless_dev *wdev,
6853368e5a7bSAyala Beker 				  u8 inst_id,
6854368e5a7bSAyala Beker 				  enum nl80211_nan_func_term_reason reason,
6855368e5a7bSAyala Beker 				  u64 cookie, gfp_t gfp);
6856368e5a7bSAyala Beker 
6857b7ffbd7eSJohannes Berg /* ethtool helper */
6858b7ffbd7eSJohannes Berg void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info);
6859b7ffbd7eSJohannes Berg 
686040cbfa90SSrinivas Dasari /**
686140cbfa90SSrinivas Dasari  * cfg80211_external_auth_request - userspace request for authentication
686240cbfa90SSrinivas Dasari  * @netdev: network device
686340cbfa90SSrinivas Dasari  * @params: External authentication parameters
686440cbfa90SSrinivas Dasari  * @gfp: allocation flags
686540cbfa90SSrinivas Dasari  * Returns: 0 on success, < 0 on error
686640cbfa90SSrinivas Dasari  */
686740cbfa90SSrinivas Dasari int cfg80211_external_auth_request(struct net_device *netdev,
686840cbfa90SSrinivas Dasari 				   struct cfg80211_external_auth_params *params,
686940cbfa90SSrinivas Dasari 				   gfp_t gfp);
687040cbfa90SSrinivas Dasari 
6871*9bb7e0f2SJohannes Berg /**
6872*9bb7e0f2SJohannes Berg  * cfg80211_pmsr_report - report peer measurement result data
6873*9bb7e0f2SJohannes Berg  * @wdev: the wireless device reporting the measurement
6874*9bb7e0f2SJohannes Berg  * @req: the original measurement request
6875*9bb7e0f2SJohannes Berg  * @result: the result data
6876*9bb7e0f2SJohannes Berg  * @gfp: allocation flags
6877*9bb7e0f2SJohannes Berg  */
6878*9bb7e0f2SJohannes Berg void cfg80211_pmsr_report(struct wireless_dev *wdev,
6879*9bb7e0f2SJohannes Berg 			  struct cfg80211_pmsr_request *req,
6880*9bb7e0f2SJohannes Berg 			  struct cfg80211_pmsr_result *result,
6881*9bb7e0f2SJohannes Berg 			  gfp_t gfp);
6882*9bb7e0f2SJohannes Berg 
6883*9bb7e0f2SJohannes Berg /**
6884*9bb7e0f2SJohannes Berg  * cfg80211_pmsr_complete - report peer measurement completed
6885*9bb7e0f2SJohannes Berg  * @wdev: the wireless device reporting the measurement
6886*9bb7e0f2SJohannes Berg  * @req: the original measurement request
6887*9bb7e0f2SJohannes Berg  * @gfp: allocation flags
6888*9bb7e0f2SJohannes Berg  *
6889*9bb7e0f2SJohannes Berg  * Report that the entire measurement completed, after this
6890*9bb7e0f2SJohannes Berg  * the request pointer will no longer be valid.
6891*9bb7e0f2SJohannes Berg  */
6892*9bb7e0f2SJohannes Berg void cfg80211_pmsr_complete(struct wireless_dev *wdev,
6893*9bb7e0f2SJohannes Berg 			    struct cfg80211_pmsr_request *req,
6894*9bb7e0f2SJohannes Berg 			    gfp_t gfp);
6895*9bb7e0f2SJohannes Berg 
6896e1db74fcSJoe Perches /* Logging, debugging and troubleshooting/diagnostic helpers. */
6897e1db74fcSJoe Perches 
6898e1db74fcSJoe Perches /* wiphy_printk helpers, similar to dev_printk */
6899e1db74fcSJoe Perches 
6900e1db74fcSJoe Perches #define wiphy_printk(level, wiphy, format, args...)		\
69019c376639SJoe Perches 	dev_printk(level, &(wiphy)->dev, format, ##args)
6902e1db74fcSJoe Perches #define wiphy_emerg(wiphy, format, args...)			\
69039c376639SJoe Perches 	dev_emerg(&(wiphy)->dev, format, ##args)
6904e1db74fcSJoe Perches #define wiphy_alert(wiphy, format, args...)			\
69059c376639SJoe Perches 	dev_alert(&(wiphy)->dev, format, ##args)
6906e1db74fcSJoe Perches #define wiphy_crit(wiphy, format, args...)			\
69079c376639SJoe Perches 	dev_crit(&(wiphy)->dev, format, ##args)
6908e1db74fcSJoe Perches #define wiphy_err(wiphy, format, args...)			\
69099c376639SJoe Perches 	dev_err(&(wiphy)->dev, format, ##args)
6910e1db74fcSJoe Perches #define wiphy_warn(wiphy, format, args...)			\
69119c376639SJoe Perches 	dev_warn(&(wiphy)->dev, format, ##args)
6912e1db74fcSJoe Perches #define wiphy_notice(wiphy, format, args...)			\
69139c376639SJoe Perches 	dev_notice(&(wiphy)->dev, format, ##args)
6914e1db74fcSJoe Perches #define wiphy_info(wiphy, format, args...)			\
69159c376639SJoe Perches 	dev_info(&(wiphy)->dev, format, ##args)
6916073730d7SJoe Perches 
69179c376639SJoe Perches #define wiphy_debug(wiphy, format, args...)			\
6918e1db74fcSJoe Perches 	wiphy_printk(KERN_DEBUG, wiphy, format, ##args)
69199c376639SJoe Perches 
6920e1db74fcSJoe Perches #define wiphy_dbg(wiphy, format, args...)			\
69219c376639SJoe Perches 	dev_dbg(&(wiphy)->dev, format, ##args)
6922e1db74fcSJoe Perches 
6923e1db74fcSJoe Perches #if defined(VERBOSE_DEBUG)
6924e1db74fcSJoe Perches #define wiphy_vdbg	wiphy_dbg
6925e1db74fcSJoe Perches #else
6926e1db74fcSJoe Perches #define wiphy_vdbg(wiphy, format, args...)				\
6927e1db74fcSJoe Perches ({									\
6928e1db74fcSJoe Perches 	if (0)								\
6929e1db74fcSJoe Perches 		wiphy_printk(KERN_DEBUG, wiphy, format, ##args);	\
6930e1db74fcSJoe Perches 	0;								\
6931e1db74fcSJoe Perches })
6932e1db74fcSJoe Perches #endif
6933e1db74fcSJoe Perches 
6934e1db74fcSJoe Perches /*
6935e1db74fcSJoe Perches  * wiphy_WARN() acts like wiphy_printk(), but with the key difference
6936e1db74fcSJoe Perches  * of using a WARN/WARN_ON to get the message out, including the
6937e1db74fcSJoe Perches  * file/line information and a backtrace.
6938e1db74fcSJoe Perches  */
6939e1db74fcSJoe Perches #define wiphy_WARN(wiphy, format, args...)			\
6940e1db74fcSJoe Perches 	WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args);
6941e1db74fcSJoe Perches 
6942704232c2SJohannes Berg #endif /* __NET_CFG80211_H */
6943