xref: /linux/include/net/cfg80211.h (revision 6a21d16c4db08398c737e0ffd03e4eca7131ac78)
1d2912cb1SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
2704232c2SJohannes Berg #ifndef __NET_CFG80211_H
3704232c2SJohannes Berg #define __NET_CFG80211_H
4d3236553SJohannes Berg /*
5d3236553SJohannes Berg  * 802.11 device and configuration interface
6d3236553SJohannes Berg  *
7026331c4SJouni Malinen  * Copyright 2006-2010	Johannes Berg <johannes@sipsolutions.net>
82740f0cfSJohannes Berg  * Copyright 2013-2014 Intel Mobile Communications GmbH
98585989dSLuca Coelho  * Copyright 2015-2017	Intel Deutschland GmbH
107011ba58SSara Sharon  * Copyright (C) 2018-2019 Intel Corporation
11d3236553SJohannes Berg  */
12704232c2SJohannes Berg 
13d3236553SJohannes Berg #include <linux/netdevice.h>
14d3236553SJohannes Berg #include <linux/debugfs.h>
15d3236553SJohannes Berg #include <linux/list.h>
16187f1882SPaul Gortmaker #include <linux/bug.h>
17704232c2SJohannes Berg #include <linux/netlink.h>
18704232c2SJohannes Berg #include <linux/skbuff.h>
1955682965SJohannes Berg #include <linux/nl80211.h>
202a519311SJohannes Berg #include <linux/if_ether.h>
212a519311SJohannes Berg #include <linux/ieee80211.h>
222a0e047eSJohannes Berg #include <linux/net.h>
23d3236553SJohannes Berg #include <net/regulatory.h>
24d3236553SJohannes Berg 
25d70e9693SJohannes Berg /**
26d70e9693SJohannes Berg  * DOC: Introduction
27d70e9693SJohannes Berg  *
28d70e9693SJohannes Berg  * cfg80211 is the configuration API for 802.11 devices in Linux. It bridges
29d70e9693SJohannes Berg  * userspace and drivers, and offers some utility functionality associated
30d70e9693SJohannes Berg  * with 802.11. cfg80211 must, directly or indirectly via mac80211, be used
31d70e9693SJohannes Berg  * by all modern wireless drivers in Linux, so that they offer a consistent
32d70e9693SJohannes Berg  * API through nl80211. For backward compatibility, cfg80211 also offers
33d70e9693SJohannes Berg  * wireless extensions to userspace, but hides them from drivers completely.
34d70e9693SJohannes Berg  *
35d70e9693SJohannes Berg  * Additionally, cfg80211 contains code to help enforce regulatory spectrum
36d70e9693SJohannes Berg  * use restrictions.
37d70e9693SJohannes Berg  */
38d70e9693SJohannes Berg 
39d70e9693SJohannes Berg 
40d70e9693SJohannes Berg /**
41d70e9693SJohannes Berg  * DOC: Device registration
42d70e9693SJohannes Berg  *
43d70e9693SJohannes Berg  * In order for a driver to use cfg80211, it must register the hardware device
44d70e9693SJohannes Berg  * with cfg80211. This happens through a number of hardware capability structs
45d70e9693SJohannes Berg  * described below.
46d70e9693SJohannes Berg  *
47d70e9693SJohannes Berg  * The fundamental structure for each device is the 'wiphy', of which each
48d70e9693SJohannes Berg  * instance describes a physical wireless device connected to the system. Each
49d70e9693SJohannes Berg  * such wiphy can have zero, one, or many virtual interfaces associated with
50d70e9693SJohannes Berg  * it, which need to be identified as such by pointing the network interface's
51d70e9693SJohannes Berg  * @ieee80211_ptr pointer to a &struct wireless_dev which further describes
52d70e9693SJohannes Berg  * the wireless part of the interface, normally this struct is embedded in the
53d70e9693SJohannes Berg  * network interface's private data area. Drivers can optionally allow creating
54d70e9693SJohannes Berg  * or destroying virtual interfaces on the fly, but without at least one or the
55d70e9693SJohannes Berg  * ability to create some the wireless device isn't useful.
56d70e9693SJohannes Berg  *
57d70e9693SJohannes Berg  * Each wiphy structure contains device capability information, and also has
58d70e9693SJohannes Berg  * a pointer to the various operations the driver offers. The definitions and
59d70e9693SJohannes Berg  * structures here describe these capabilities in detail.
60d70e9693SJohannes Berg  */
61d70e9693SJohannes Berg 
629f5e8f6eSJohannes Berg struct wiphy;
639f5e8f6eSJohannes Berg 
64704232c2SJohannes Berg /*
65d3236553SJohannes Berg  * wireless hardware capability structures
66d3236553SJohannes Berg  */
67d3236553SJohannes Berg 
68d3236553SJohannes Berg /**
69d3236553SJohannes Berg  * enum ieee80211_channel_flags - channel flags
70d3236553SJohannes Berg  *
71d3236553SJohannes Berg  * Channel flags set by the regulatory control code.
72d3236553SJohannes Berg  *
73d3236553SJohannes Berg  * @IEEE80211_CHAN_DISABLED: This channel is disabled.
748fe02e16SLuis R. Rodriguez  * @IEEE80211_CHAN_NO_IR: do not initiate radiation, this includes
758fe02e16SLuis R. Rodriguez  *	sending probe requests or beaconing.
76d3236553SJohannes Berg  * @IEEE80211_CHAN_RADAR: Radar detection is required on this channel.
77689da1b3SLuis R. Rodriguez  * @IEEE80211_CHAN_NO_HT40PLUS: extension channel above this channel
78d3236553SJohannes Berg  *	is not permitted.
79689da1b3SLuis R. Rodriguez  * @IEEE80211_CHAN_NO_HT40MINUS: extension channel below this channel
80d3236553SJohannes Berg  *	is not permitted.
8103f6b084SSeth Forshee  * @IEEE80211_CHAN_NO_OFDM: OFDM is not allowed on this channel.
82c7a6ee27SJohannes Berg  * @IEEE80211_CHAN_NO_80MHZ: If the driver supports 80 MHz on the band,
83c7a6ee27SJohannes Berg  *	this flag indicates that an 80 MHz channel cannot use this
84c7a6ee27SJohannes Berg  *	channel as the control or any of the secondary channels.
85c7a6ee27SJohannes Berg  *	This may be due to the driver or due to regulatory bandwidth
86c7a6ee27SJohannes Berg  *	restrictions.
87c7a6ee27SJohannes Berg  * @IEEE80211_CHAN_NO_160MHZ: If the driver supports 160 MHz on the band,
88c7a6ee27SJohannes Berg  *	this flag indicates that an 160 MHz channel cannot use this
89c7a6ee27SJohannes Berg  *	channel as the control or any of the secondary channels.
90c7a6ee27SJohannes Berg  *	This may be due to the driver or due to regulatory bandwidth
91c7a6ee27SJohannes Berg  *	restrictions.
92570dbde1SDavid Spinadel  * @IEEE80211_CHAN_INDOOR_ONLY: see %NL80211_FREQUENCY_ATTR_INDOOR_ONLY
9306f207fcSArik Nemtsov  * @IEEE80211_CHAN_IR_CONCURRENT: see %NL80211_FREQUENCY_ATTR_IR_CONCURRENT
94ea077c1cSRostislav Lisovy  * @IEEE80211_CHAN_NO_20MHZ: 20 MHz bandwidth is not permitted
95ea077c1cSRostislav Lisovy  *	on this channel.
96ea077c1cSRostislav Lisovy  * @IEEE80211_CHAN_NO_10MHZ: 10 MHz bandwidth is not permitted
97ea077c1cSRostislav Lisovy  *	on this channel.
981e61d82cSHaim Dreyfuss  * @IEEE80211_CHAN_NO_HE: HE operation is not permitted on this channel.
99570dbde1SDavid Spinadel  *
100d3236553SJohannes Berg  */
101d3236553SJohannes Berg enum ieee80211_channel_flags {
102d3236553SJohannes Berg 	IEEE80211_CHAN_DISABLED		= 1<<0,
1038fe02e16SLuis R. Rodriguez 	IEEE80211_CHAN_NO_IR		= 1<<1,
1048fe02e16SLuis R. Rodriguez 	/* hole at 1<<2 */
105d3236553SJohannes Berg 	IEEE80211_CHAN_RADAR		= 1<<3,
106689da1b3SLuis R. Rodriguez 	IEEE80211_CHAN_NO_HT40PLUS	= 1<<4,
107689da1b3SLuis R. Rodriguez 	IEEE80211_CHAN_NO_HT40MINUS	= 1<<5,
10803f6b084SSeth Forshee 	IEEE80211_CHAN_NO_OFDM		= 1<<6,
109c7a6ee27SJohannes Berg 	IEEE80211_CHAN_NO_80MHZ		= 1<<7,
110c7a6ee27SJohannes Berg 	IEEE80211_CHAN_NO_160MHZ	= 1<<8,
111570dbde1SDavid Spinadel 	IEEE80211_CHAN_INDOOR_ONLY	= 1<<9,
11206f207fcSArik Nemtsov 	IEEE80211_CHAN_IR_CONCURRENT	= 1<<10,
113ea077c1cSRostislav Lisovy 	IEEE80211_CHAN_NO_20MHZ		= 1<<11,
114ea077c1cSRostislav Lisovy 	IEEE80211_CHAN_NO_10MHZ		= 1<<12,
1151e61d82cSHaim Dreyfuss 	IEEE80211_CHAN_NO_HE		= 1<<13,
116d3236553SJohannes Berg };
117d3236553SJohannes Berg 
118038659e7SLuis R. Rodriguez #define IEEE80211_CHAN_NO_HT40 \
119689da1b3SLuis R. Rodriguez 	(IEEE80211_CHAN_NO_HT40PLUS | IEEE80211_CHAN_NO_HT40MINUS)
120038659e7SLuis R. Rodriguez 
12104f39047SSimon Wunderlich #define IEEE80211_DFS_MIN_CAC_TIME_MS		60000
12204f39047SSimon Wunderlich #define IEEE80211_DFS_MIN_NOP_TIME_MS		(30 * 60 * 1000)
12304f39047SSimon Wunderlich 
124d3236553SJohannes Berg /**
125d3236553SJohannes Berg  * struct ieee80211_channel - channel definition
126d3236553SJohannes Berg  *
127d3236553SJohannes Berg  * This structure describes a single channel for use
128d3236553SJohannes Berg  * with cfg80211.
129d3236553SJohannes Berg  *
130d3236553SJohannes Berg  * @center_freq: center frequency in MHz
131d3236553SJohannes Berg  * @hw_value: hardware-specific value for the channel
132d3236553SJohannes Berg  * @flags: channel flags from &enum ieee80211_channel_flags.
133d3236553SJohannes Berg  * @orig_flags: channel flags at registration time, used by regulatory
134d3236553SJohannes Berg  *	code to support devices with additional restrictions
135d3236553SJohannes Berg  * @band: band this channel belongs to.
136d3236553SJohannes Berg  * @max_antenna_gain: maximum antenna gain in dBi
137d3236553SJohannes Berg  * @max_power: maximum transmission power (in dBm)
138eccc068eSHong Wu  * @max_reg_power: maximum regulatory transmission power (in dBm)
139d3236553SJohannes Berg  * @beacon_found: helper to regulatory code to indicate when a beacon
140d3236553SJohannes Berg  *	has been found on this channel. Use regulatory_hint_found_beacon()
14177c2061dSWalter Goldens  *	to enable this, this is useful only on 5 GHz band.
142d3236553SJohannes Berg  * @orig_mag: internal use
143d3236553SJohannes Berg  * @orig_mpwr: internal use
14404f39047SSimon Wunderlich  * @dfs_state: current state of this channel. Only relevant if radar is required
14504f39047SSimon Wunderlich  *	on this channel.
14604f39047SSimon Wunderlich  * @dfs_state_entered: timestamp (jiffies) when the dfs state was entered.
147089027e5SJanusz Dziedzic  * @dfs_cac_ms: DFS CAC time in milliseconds, this is valid for DFS channels.
148d3236553SJohannes Berg  */
149d3236553SJohannes Berg struct ieee80211_channel {
15057fbcce3SJohannes Berg 	enum nl80211_band band;
1519cf0a0b4SAlexei Avshalom Lazar 	u32 center_freq;
152d3236553SJohannes Berg 	u16 hw_value;
153d3236553SJohannes Berg 	u32 flags;
154d3236553SJohannes Berg 	int max_antenna_gain;
155d3236553SJohannes Berg 	int max_power;
156eccc068eSHong Wu 	int max_reg_power;
157d3236553SJohannes Berg 	bool beacon_found;
158d3236553SJohannes Berg 	u32 orig_flags;
159d3236553SJohannes Berg 	int orig_mag, orig_mpwr;
16004f39047SSimon Wunderlich 	enum nl80211_dfs_state dfs_state;
16104f39047SSimon Wunderlich 	unsigned long dfs_state_entered;
162089027e5SJanusz Dziedzic 	unsigned int dfs_cac_ms;
163d3236553SJohannes Berg };
164d3236553SJohannes Berg 
165d3236553SJohannes Berg /**
166d3236553SJohannes Berg  * enum ieee80211_rate_flags - rate flags
167d3236553SJohannes Berg  *
168d3236553SJohannes Berg  * Hardware/specification flags for rates. These are structured
169d3236553SJohannes Berg  * in a way that allows using the same bitrate structure for
170d3236553SJohannes Berg  * different bands/PHY modes.
171d3236553SJohannes Berg  *
172d3236553SJohannes Berg  * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short
173d3236553SJohannes Berg  *	preamble on this bitrate; only relevant in 2.4GHz band and
174d3236553SJohannes Berg  *	with CCK rates.
175d3236553SJohannes Berg  * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate
176d3236553SJohannes Berg  *	when used with 802.11a (on the 5 GHz band); filled by the
177d3236553SJohannes Berg  *	core code when registering the wiphy.
178d3236553SJohannes Berg  * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate
179d3236553SJohannes Berg  *	when used with 802.11b (on the 2.4 GHz band); filled by the
180d3236553SJohannes Berg  *	core code when registering the wiphy.
181d3236553SJohannes Berg  * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate
182d3236553SJohannes Berg  *	when used with 802.11g (on the 2.4 GHz band); filled by the
183d3236553SJohannes Berg  *	core code when registering the wiphy.
184d3236553SJohannes Berg  * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode.
18530e74732SSimon Wunderlich  * @IEEE80211_RATE_SUPPORTS_5MHZ: Rate can be used in 5 MHz mode
18630e74732SSimon Wunderlich  * @IEEE80211_RATE_SUPPORTS_10MHZ: Rate can be used in 10 MHz mode
187d3236553SJohannes Berg  */
188d3236553SJohannes Berg enum ieee80211_rate_flags {
189d3236553SJohannes Berg 	IEEE80211_RATE_SHORT_PREAMBLE	= 1<<0,
190d3236553SJohannes Berg 	IEEE80211_RATE_MANDATORY_A	= 1<<1,
191d3236553SJohannes Berg 	IEEE80211_RATE_MANDATORY_B	= 1<<2,
192d3236553SJohannes Berg 	IEEE80211_RATE_MANDATORY_G	= 1<<3,
193d3236553SJohannes Berg 	IEEE80211_RATE_ERP_G		= 1<<4,
19430e74732SSimon Wunderlich 	IEEE80211_RATE_SUPPORTS_5MHZ	= 1<<5,
19530e74732SSimon Wunderlich 	IEEE80211_RATE_SUPPORTS_10MHZ	= 1<<6,
196d3236553SJohannes Berg };
197d3236553SJohannes Berg 
198d3236553SJohannes Berg /**
1996eb18137SDedy Lansky  * enum ieee80211_bss_type - BSS type filter
2006eb18137SDedy Lansky  *
2016eb18137SDedy Lansky  * @IEEE80211_BSS_TYPE_ESS: Infrastructure BSS
2026eb18137SDedy Lansky  * @IEEE80211_BSS_TYPE_PBSS: Personal BSS
2036eb18137SDedy Lansky  * @IEEE80211_BSS_TYPE_IBSS: Independent BSS
2046eb18137SDedy Lansky  * @IEEE80211_BSS_TYPE_MBSS: Mesh BSS
2056eb18137SDedy Lansky  * @IEEE80211_BSS_TYPE_ANY: Wildcard value for matching any BSS type
2066eb18137SDedy Lansky  */
2076eb18137SDedy Lansky enum ieee80211_bss_type {
2086eb18137SDedy Lansky 	IEEE80211_BSS_TYPE_ESS,
2096eb18137SDedy Lansky 	IEEE80211_BSS_TYPE_PBSS,
2106eb18137SDedy Lansky 	IEEE80211_BSS_TYPE_IBSS,
2116eb18137SDedy Lansky 	IEEE80211_BSS_TYPE_MBSS,
2126eb18137SDedy Lansky 	IEEE80211_BSS_TYPE_ANY
2136eb18137SDedy Lansky };
2146eb18137SDedy Lansky 
2156eb18137SDedy Lansky /**
2166eb18137SDedy Lansky  * enum ieee80211_privacy - BSS privacy filter
2176eb18137SDedy Lansky  *
2186eb18137SDedy Lansky  * @IEEE80211_PRIVACY_ON: privacy bit set
2196eb18137SDedy Lansky  * @IEEE80211_PRIVACY_OFF: privacy bit clear
2206eb18137SDedy Lansky  * @IEEE80211_PRIVACY_ANY: Wildcard value for matching any privacy setting
2216eb18137SDedy Lansky  */
2226eb18137SDedy Lansky enum ieee80211_privacy {
2236eb18137SDedy Lansky 	IEEE80211_PRIVACY_ON,
2246eb18137SDedy Lansky 	IEEE80211_PRIVACY_OFF,
2256eb18137SDedy Lansky 	IEEE80211_PRIVACY_ANY
2266eb18137SDedy Lansky };
2276eb18137SDedy Lansky 
2286eb18137SDedy Lansky #define IEEE80211_PRIVACY(x)	\
2296eb18137SDedy Lansky 	((x) ? IEEE80211_PRIVACY_ON : IEEE80211_PRIVACY_OFF)
2306eb18137SDedy Lansky 
2316eb18137SDedy Lansky /**
232d3236553SJohannes Berg  * struct ieee80211_rate - bitrate definition
233d3236553SJohannes Berg  *
234d3236553SJohannes Berg  * This structure describes a bitrate that an 802.11 PHY can
235d3236553SJohannes Berg  * operate with. The two values @hw_value and @hw_value_short
236d3236553SJohannes Berg  * are only for driver use when pointers to this structure are
237d3236553SJohannes Berg  * passed around.
238d3236553SJohannes Berg  *
239d3236553SJohannes Berg  * @flags: rate-specific flags
240d3236553SJohannes Berg  * @bitrate: bitrate in units of 100 Kbps
241d3236553SJohannes Berg  * @hw_value: driver/hardware value for this rate
242d3236553SJohannes Berg  * @hw_value_short: driver/hardware value for this rate when
243d3236553SJohannes Berg  *	short preamble is used
244d3236553SJohannes Berg  */
245d3236553SJohannes Berg struct ieee80211_rate {
246d3236553SJohannes Berg 	u32 flags;
247d3236553SJohannes Berg 	u16 bitrate;
248d3236553SJohannes Berg 	u16 hw_value, hw_value_short;
249d3236553SJohannes Berg };
250d3236553SJohannes Berg 
251d3236553SJohannes Berg /**
252796e90f4SJohn Crispin  * struct ieee80211_he_obss_pd - AP settings for spatial reuse
253796e90f4SJohn Crispin  *
254796e90f4SJohn Crispin  * @enable: is the feature enabled.
255796e90f4SJohn Crispin  * @min_offset: minimal tx power offset an associated station shall use
256796e90f4SJohn Crispin  * @max_offset: maximum tx power offset an associated station shall use
257796e90f4SJohn Crispin  */
258796e90f4SJohn Crispin struct ieee80211_he_obss_pd {
259796e90f4SJohn Crispin 	bool enable;
260796e90f4SJohn Crispin 	u8 min_offset;
261796e90f4SJohn Crispin 	u8 max_offset;
262796e90f4SJohn Crispin };
263796e90f4SJohn Crispin 
264796e90f4SJohn Crispin /**
2655c5e52d1SJohn Crispin  * struct cfg80211_he_bss_color - AP settings for BSS coloring
2665c5e52d1SJohn Crispin  *
2675c5e52d1SJohn Crispin  * @color: the current color.
2685c5e52d1SJohn Crispin  * @disabled: is the feature disabled.
2695c5e52d1SJohn Crispin  * @partial: define the AID equation.
2705c5e52d1SJohn Crispin  */
2715c5e52d1SJohn Crispin struct cfg80211_he_bss_color {
2725c5e52d1SJohn Crispin 	u8 color;
2735c5e52d1SJohn Crispin 	bool disabled;
2745c5e52d1SJohn Crispin 	bool partial;
2755c5e52d1SJohn Crispin };
2765c5e52d1SJohn Crispin 
2775c5e52d1SJohn Crispin /**
278dd56e902SJohn Crispin  * struct ieee80211_he_bss_color - AP settings for BSS coloring
279dd56e902SJohn Crispin  *
280dd56e902SJohn Crispin  * @color: the current color.
281dd56e902SJohn Crispin  * @disabled: is the feature disabled.
282dd56e902SJohn Crispin  * @partial: define the AID equation.
283dd56e902SJohn Crispin  */
284dd56e902SJohn Crispin struct ieee80211_he_bss_color {
285dd56e902SJohn Crispin 	u8 color;
286dd56e902SJohn Crispin 	bool disabled;
287dd56e902SJohn Crispin 	bool partial;
288dd56e902SJohn Crispin };
289dd56e902SJohn Crispin 
290dd56e902SJohn Crispin /**
291d3236553SJohannes Berg  * struct ieee80211_sta_ht_cap - STA's HT capabilities
292d3236553SJohannes Berg  *
293d3236553SJohannes Berg  * This structure describes most essential parameters needed
294d3236553SJohannes Berg  * to describe 802.11n HT capabilities for an STA.
295d3236553SJohannes Berg  *
296d3236553SJohannes Berg  * @ht_supported: is HT supported by the STA
297d3236553SJohannes Berg  * @cap: HT capabilities map as described in 802.11n spec
298d3236553SJohannes Berg  * @ampdu_factor: Maximum A-MPDU length factor
299d3236553SJohannes Berg  * @ampdu_density: Minimum A-MPDU spacing
300d3236553SJohannes Berg  * @mcs: Supported MCS rates
301d3236553SJohannes Berg  */
302d3236553SJohannes Berg struct ieee80211_sta_ht_cap {
303d3236553SJohannes Berg 	u16 cap; /* use IEEE80211_HT_CAP_ */
304d3236553SJohannes Berg 	bool ht_supported;
305d3236553SJohannes Berg 	u8 ampdu_factor;
306d3236553SJohannes Berg 	u8 ampdu_density;
307d3236553SJohannes Berg 	struct ieee80211_mcs_info mcs;
308d3236553SJohannes Berg };
309d3236553SJohannes Berg 
310d3236553SJohannes Berg /**
311bf0c111eSMahesh Palivela  * struct ieee80211_sta_vht_cap - STA's VHT capabilities
312bf0c111eSMahesh Palivela  *
313bf0c111eSMahesh Palivela  * This structure describes most essential parameters needed
314bf0c111eSMahesh Palivela  * to describe 802.11ac VHT capabilities for an STA.
315bf0c111eSMahesh Palivela  *
316bf0c111eSMahesh Palivela  * @vht_supported: is VHT supported by the STA
317bf0c111eSMahesh Palivela  * @cap: VHT capabilities map as described in 802.11ac spec
318bf0c111eSMahesh Palivela  * @vht_mcs: Supported VHT MCS rates
319bf0c111eSMahesh Palivela  */
320bf0c111eSMahesh Palivela struct ieee80211_sta_vht_cap {
321bf0c111eSMahesh Palivela 	bool vht_supported;
322bf0c111eSMahesh Palivela 	u32 cap; /* use IEEE80211_VHT_CAP_ */
323bf0c111eSMahesh Palivela 	struct ieee80211_vht_mcs_info vht_mcs;
324bf0c111eSMahesh Palivela };
325bf0c111eSMahesh Palivela 
326c4cbaf79SLuca Coelho #define IEEE80211_HE_PPE_THRES_MAX_LEN		25
327c4cbaf79SLuca Coelho 
328c4cbaf79SLuca Coelho /**
329c4cbaf79SLuca Coelho  * struct ieee80211_sta_he_cap - STA's HE capabilities
330c4cbaf79SLuca Coelho  *
331c4cbaf79SLuca Coelho  * This structure describes most essential parameters needed
332c4cbaf79SLuca Coelho  * to describe 802.11ax HE capabilities for a STA.
333c4cbaf79SLuca Coelho  *
334c4cbaf79SLuca Coelho  * @has_he: true iff HE data is valid.
335c4cbaf79SLuca Coelho  * @he_cap_elem: Fixed portion of the HE capabilities element.
336c4cbaf79SLuca Coelho  * @he_mcs_nss_supp: The supported NSS/MCS combinations.
337c4cbaf79SLuca Coelho  * @ppe_thres: Holds the PPE Thresholds data.
338c4cbaf79SLuca Coelho  */
339c4cbaf79SLuca Coelho struct ieee80211_sta_he_cap {
340c4cbaf79SLuca Coelho 	bool has_he;
341c4cbaf79SLuca Coelho 	struct ieee80211_he_cap_elem he_cap_elem;
342c4cbaf79SLuca Coelho 	struct ieee80211_he_mcs_nss_supp he_mcs_nss_supp;
343c4cbaf79SLuca Coelho 	u8 ppe_thres[IEEE80211_HE_PPE_THRES_MAX_LEN];
344c4cbaf79SLuca Coelho };
345c4cbaf79SLuca Coelho 
346c4cbaf79SLuca Coelho /**
347c4cbaf79SLuca Coelho  * struct ieee80211_sband_iftype_data
348c4cbaf79SLuca Coelho  *
349c4cbaf79SLuca Coelho  * This structure encapsulates sband data that is relevant for the
350c4cbaf79SLuca Coelho  * interface types defined in @types_mask.  Each type in the
351c4cbaf79SLuca Coelho  * @types_mask must be unique across all instances of iftype_data.
352c4cbaf79SLuca Coelho  *
353c4cbaf79SLuca Coelho  * @types_mask: interface types mask
354c4cbaf79SLuca Coelho  * @he_cap: holds the HE capabilities
355c4cbaf79SLuca Coelho  */
356c4cbaf79SLuca Coelho struct ieee80211_sband_iftype_data {
357c4cbaf79SLuca Coelho 	u16 types_mask;
358c4cbaf79SLuca Coelho 	struct ieee80211_sta_he_cap he_cap;
359c4cbaf79SLuca Coelho };
360c4cbaf79SLuca Coelho 
361bf0c111eSMahesh Palivela /**
3622a38075cSAlexei Avshalom Lazar  * enum ieee80211_edmg_bw_config - allowed channel bandwidth configurations
3632a38075cSAlexei Avshalom Lazar  *
3642a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_4: 2.16GHz
3652a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_5: 2.16GHz and 4.32GHz
3662a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_6: 2.16GHz, 4.32GHz and 6.48GHz
3672a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_7: 2.16GHz, 4.32GHz, 6.48GHz and 8.64GHz
3682a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_8: 2.16GHz and 2.16GHz + 2.16GHz
3692a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_9: 2.16GHz, 4.32GHz and 2.16GHz + 2.16GHz
3702a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_10: 2.16GHz, 4.32GHz, 6.48GHz and 2.16GHz+2.16GHz
3712a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_11: 2.16GHz, 4.32GHz, 6.48GHz, 8.64GHz and
3722a38075cSAlexei Avshalom Lazar  *	2.16GHz+2.16GHz
3732a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_12: 2.16GHz, 2.16GHz + 2.16GHz and
3742a38075cSAlexei Avshalom Lazar  *	4.32GHz + 4.32GHz
3752a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_13: 2.16GHz, 4.32GHz, 2.16GHz + 2.16GHz and
3762a38075cSAlexei Avshalom Lazar  *	4.32GHz + 4.32GHz
3772a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_14: 2.16GHz, 4.32GHz, 6.48GHz, 2.16GHz + 2.16GHz
3782a38075cSAlexei Avshalom Lazar  *	and 4.32GHz + 4.32GHz
3792a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_15: 2.16GHz, 4.32GHz, 6.48GHz, 8.64GHz,
3802a38075cSAlexei Avshalom Lazar  *	2.16GHz + 2.16GHz and 4.32GHz + 4.32GHz
3812a38075cSAlexei Avshalom Lazar  */
3822a38075cSAlexei Avshalom Lazar enum ieee80211_edmg_bw_config {
3832a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_4	= 4,
3842a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_5	= 5,
3852a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_6	= 6,
3862a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_7	= 7,
3872a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_8	= 8,
3882a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_9	= 9,
3892a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_10	= 10,
3902a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_11	= 11,
3912a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_12	= 12,
3922a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_13	= 13,
3932a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_14	= 14,
3942a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_15	= 15,
3952a38075cSAlexei Avshalom Lazar };
3962a38075cSAlexei Avshalom Lazar 
3972a38075cSAlexei Avshalom Lazar /**
3982a38075cSAlexei Avshalom Lazar  * struct ieee80211_edmg - EDMG configuration
3992a38075cSAlexei Avshalom Lazar  *
4002a38075cSAlexei Avshalom Lazar  * This structure describes most essential parameters needed
4012a38075cSAlexei Avshalom Lazar  * to describe 802.11ay EDMG configuration
4022a38075cSAlexei Avshalom Lazar  *
4032a38075cSAlexei Avshalom Lazar  * @channels: bitmap that indicates the 2.16 GHz channel(s)
4042a38075cSAlexei Avshalom Lazar  *	that are allowed to be used for transmissions.
4052a38075cSAlexei Avshalom Lazar  *	Bit 0 indicates channel 1, bit 1 indicates channel 2, etc.
4062a38075cSAlexei Avshalom Lazar  *	Set to 0 indicate EDMG not supported.
4072a38075cSAlexei Avshalom Lazar  * @bw_config: Channel BW Configuration subfield encodes
4082a38075cSAlexei Avshalom Lazar  *	the allowed channel bandwidth configurations
4092a38075cSAlexei Avshalom Lazar  */
4102a38075cSAlexei Avshalom Lazar struct ieee80211_edmg {
4112a38075cSAlexei Avshalom Lazar 	u8 channels;
4122a38075cSAlexei Avshalom Lazar 	enum ieee80211_edmg_bw_config bw_config;
4132a38075cSAlexei Avshalom Lazar };
4142a38075cSAlexei Avshalom Lazar 
4152a38075cSAlexei Avshalom Lazar /**
416d3236553SJohannes Berg  * struct ieee80211_supported_band - frequency band definition
417d3236553SJohannes Berg  *
418d3236553SJohannes Berg  * This structure describes a frequency band a wiphy
419d3236553SJohannes Berg  * is able to operate in.
420d3236553SJohannes Berg  *
421d3236553SJohannes Berg  * @channels: Array of channels the hardware can operate in
422d3236553SJohannes Berg  *	in this band.
423d3236553SJohannes Berg  * @band: the band this structure represents
424d3236553SJohannes Berg  * @n_channels: Number of channels in @channels
425d3236553SJohannes Berg  * @bitrates: Array of bitrates the hardware can operate with
426d3236553SJohannes Berg  *	in this band. Must be sorted to give a valid "supported
427d3236553SJohannes Berg  *	rates" IE, i.e. CCK rates first, then OFDM.
428d3236553SJohannes Berg  * @n_bitrates: Number of bitrates in @bitrates
429abe37c4bSJohannes Berg  * @ht_cap: HT capabilities in this band
430c9a0a302SRobert P. J. Day  * @vht_cap: VHT capabilities in this band
4312a38075cSAlexei Avshalom Lazar  * @edmg_cap: EDMG capabilities in this band
432c4cbaf79SLuca Coelho  * @n_iftype_data: number of iftype data entries
433c4cbaf79SLuca Coelho  * @iftype_data: interface type data entries.  Note that the bits in
434c4cbaf79SLuca Coelho  *	@types_mask inside this structure cannot overlap (i.e. only
435c4cbaf79SLuca Coelho  *	one occurrence of each type is allowed across all instances of
436c4cbaf79SLuca Coelho  *	iftype_data).
437d3236553SJohannes Berg  */
438d3236553SJohannes Berg struct ieee80211_supported_band {
439d3236553SJohannes Berg 	struct ieee80211_channel *channels;
440d3236553SJohannes Berg 	struct ieee80211_rate *bitrates;
44157fbcce3SJohannes Berg 	enum nl80211_band band;
442d3236553SJohannes Berg 	int n_channels;
443d3236553SJohannes Berg 	int n_bitrates;
444d3236553SJohannes Berg 	struct ieee80211_sta_ht_cap ht_cap;
445bf0c111eSMahesh Palivela 	struct ieee80211_sta_vht_cap vht_cap;
4462a38075cSAlexei Avshalom Lazar 	struct ieee80211_edmg edmg_cap;
447c4cbaf79SLuca Coelho 	u16 n_iftype_data;
448c4cbaf79SLuca Coelho 	const struct ieee80211_sband_iftype_data *iftype_data;
449d3236553SJohannes Berg };
450d3236553SJohannes Berg 
451e691ac2fSRafał Miłecki /**
452c4cbaf79SLuca Coelho  * ieee80211_get_sband_iftype_data - return sband data for a given iftype
453c4cbaf79SLuca Coelho  * @sband: the sband to search for the STA on
454c4cbaf79SLuca Coelho  * @iftype: enum nl80211_iftype
455c4cbaf79SLuca Coelho  *
456c4cbaf79SLuca Coelho  * Return: pointer to struct ieee80211_sband_iftype_data, or NULL is none found
457c4cbaf79SLuca Coelho  */
458c4cbaf79SLuca Coelho static inline const struct ieee80211_sband_iftype_data *
459c4cbaf79SLuca Coelho ieee80211_get_sband_iftype_data(const struct ieee80211_supported_band *sband,
460c4cbaf79SLuca Coelho 				u8 iftype)
461c4cbaf79SLuca Coelho {
462c4cbaf79SLuca Coelho 	int i;
463c4cbaf79SLuca Coelho 
464c4cbaf79SLuca Coelho 	if (WARN_ON(iftype >= NL80211_IFTYPE_MAX))
465c4cbaf79SLuca Coelho 		return NULL;
466c4cbaf79SLuca Coelho 
467c4cbaf79SLuca Coelho 	for (i = 0; i < sband->n_iftype_data; i++)  {
468c4cbaf79SLuca Coelho 		const struct ieee80211_sband_iftype_data *data =
469c4cbaf79SLuca Coelho 			&sband->iftype_data[i];
470c4cbaf79SLuca Coelho 
471c4cbaf79SLuca Coelho 		if (data->types_mask & BIT(iftype))
472c4cbaf79SLuca Coelho 			return data;
473c4cbaf79SLuca Coelho 	}
474c4cbaf79SLuca Coelho 
475c4cbaf79SLuca Coelho 	return NULL;
476c4cbaf79SLuca Coelho }
477c4cbaf79SLuca Coelho 
478c4cbaf79SLuca Coelho /**
479d7edf40cSJohn Crispin  * ieee80211_get_he_iftype_cap - return HE capabilities for an sband's iftype
480d7edf40cSJohn Crispin  * @sband: the sband to search for the iftype on
481d7edf40cSJohn Crispin  * @iftype: enum nl80211_iftype
482d7edf40cSJohn Crispin  *
483d7edf40cSJohn Crispin  * Return: pointer to the struct ieee80211_sta_he_cap, or NULL is none found
484d7edf40cSJohn Crispin  */
485d7edf40cSJohn Crispin static inline const struct ieee80211_sta_he_cap *
486d7edf40cSJohn Crispin ieee80211_get_he_iftype_cap(const struct ieee80211_supported_band *sband,
487d7edf40cSJohn Crispin 			    u8 iftype)
488d7edf40cSJohn Crispin {
489d7edf40cSJohn Crispin 	const struct ieee80211_sband_iftype_data *data =
490d7edf40cSJohn Crispin 		ieee80211_get_sband_iftype_data(sband, iftype);
491d7edf40cSJohn Crispin 
492d7edf40cSJohn Crispin 	if (data && data->he_cap.has_he)
493d7edf40cSJohn Crispin 		return &data->he_cap;
494d7edf40cSJohn Crispin 
495d7edf40cSJohn Crispin 	return NULL;
496d7edf40cSJohn Crispin }
497d7edf40cSJohn Crispin 
498d7edf40cSJohn Crispin /**
499c4cbaf79SLuca Coelho  * ieee80211_get_he_sta_cap - return HE capabilities for an sband's STA
500c4cbaf79SLuca Coelho  * @sband: the sband to search for the STA on
501c4cbaf79SLuca Coelho  *
502c4cbaf79SLuca Coelho  * Return: pointer to the struct ieee80211_sta_he_cap, or NULL is none found
503c4cbaf79SLuca Coelho  */
504c4cbaf79SLuca Coelho static inline const struct ieee80211_sta_he_cap *
505c4cbaf79SLuca Coelho ieee80211_get_he_sta_cap(const struct ieee80211_supported_band *sband)
506c4cbaf79SLuca Coelho {
507d7edf40cSJohn Crispin 	return ieee80211_get_he_iftype_cap(sband, NL80211_IFTYPE_STATION);
508c4cbaf79SLuca Coelho }
509c4cbaf79SLuca Coelho 
510c4cbaf79SLuca Coelho /**
511e691ac2fSRafał Miłecki  * wiphy_read_of_freq_limits - read frequency limits from device tree
512e691ac2fSRafał Miłecki  *
513e691ac2fSRafał Miłecki  * @wiphy: the wireless device to get extra limits for
514e691ac2fSRafał Miłecki  *
515e691ac2fSRafał Miłecki  * Some devices may have extra limitations specified in DT. This may be useful
516e691ac2fSRafał Miłecki  * for chipsets that normally support more bands but are limited due to board
517e691ac2fSRafał Miłecki  * design (e.g. by antennas or external power amplifier).
518e691ac2fSRafał Miłecki  *
519e691ac2fSRafał Miłecki  * This function reads info from DT and uses it to *modify* channels (disable
520e691ac2fSRafał Miłecki  * unavailable ones). It's usually a *bad* idea to use it in drivers with
521e691ac2fSRafał Miłecki  * shared channel data as DT limitations are device specific. You should make
522e691ac2fSRafał Miłecki  * sure to call it only if channels in wiphy are copied and can be modified
523e691ac2fSRafał Miłecki  * without affecting other devices.
524e691ac2fSRafał Miłecki  *
525e691ac2fSRafał Miłecki  * As this function access device node it has to be called after set_wiphy_dev.
526e691ac2fSRafał Miłecki  * It also modifies channels so they have to be set first.
527e691ac2fSRafał Miłecki  * If using this helper, call it before wiphy_register().
528e691ac2fSRafał Miłecki  */
529e691ac2fSRafał Miłecki #ifdef CONFIG_OF
530e691ac2fSRafał Miłecki void wiphy_read_of_freq_limits(struct wiphy *wiphy);
531e691ac2fSRafał Miłecki #else /* CONFIG_OF */
532e691ac2fSRafał Miłecki static inline void wiphy_read_of_freq_limits(struct wiphy *wiphy)
533e691ac2fSRafał Miłecki {
534e691ac2fSRafał Miłecki }
535e691ac2fSRafał Miłecki #endif /* !CONFIG_OF */
536e691ac2fSRafał Miłecki 
537e691ac2fSRafał Miłecki 
538d3236553SJohannes Berg /*
539d3236553SJohannes Berg  * Wireless hardware/device configuration structures and methods
540704232c2SJohannes Berg  */
541704232c2SJohannes Berg 
5422ec600d6SLuis Carlos Cobo /**
543d70e9693SJohannes Berg  * DOC: Actions and configuration
544d70e9693SJohannes Berg  *
545d70e9693SJohannes Berg  * Each wireless device and each virtual interface offer a set of configuration
546d70e9693SJohannes Berg  * operations and other actions that are invoked by userspace. Each of these
547d70e9693SJohannes Berg  * actions is described in the operations structure, and the parameters these
548d70e9693SJohannes Berg  * operations use are described separately.
549d70e9693SJohannes Berg  *
550d70e9693SJohannes Berg  * Additionally, some operations are asynchronous and expect to get status
551d70e9693SJohannes Berg  * information via some functions that drivers need to call.
552d70e9693SJohannes Berg  *
553d70e9693SJohannes Berg  * Scanning and BSS list handling with its associated functionality is described
554d70e9693SJohannes Berg  * in a separate chapter.
555d70e9693SJohannes Berg  */
556d70e9693SJohannes Berg 
557c6e6a0c8SAviya Erenfeld #define VHT_MUMIMO_GROUPS_DATA_LEN (WLAN_MEMBERSHIP_LEN +\
558c6e6a0c8SAviya Erenfeld 				    WLAN_USER_POSITION_LEN)
559c6e6a0c8SAviya Erenfeld 
560d70e9693SJohannes Berg /**
5612ec600d6SLuis Carlos Cobo  * struct vif_params - describes virtual interface parameters
562818a986eSJohannes Berg  * @flags: monitor interface flags, unchanged if 0, otherwise
563818a986eSJohannes Berg  *	%MONITOR_FLAG_CHANGED will be set
5648b787643SFelix Fietkau  * @use_4addr: use 4-address frames
565e8f479b1SBen Greear  * @macaddr: address to use for this virtual interface.
566e8f479b1SBen Greear  *	If this parameter is set to zero address the driver may
567e8f479b1SBen Greear  *	determine the address as needed.
568e8f479b1SBen Greear  *	This feature is only fully supported by drivers that enable the
569e8f479b1SBen Greear  *	%NL80211_FEATURE_MAC_ON_CREATE flag.  Others may support creating
570e8f479b1SBen Greear  **	only p2p devices with specified MAC.
571b0265024SJohannes Berg  * @vht_mumimo_groups: MU-MIMO groupID, used for monitoring MU-MIMO packets
572b0265024SJohannes Berg  *	belonging to that MU-MIMO groupID; %NULL if not changed
573b0265024SJohannes Berg  * @vht_mumimo_follow_addr: MU-MIMO follow address, used for monitoring
574b0265024SJohannes Berg  *	MU-MIMO packets going to the specified station; %NULL if not changed
5752ec600d6SLuis Carlos Cobo  */
5762ec600d6SLuis Carlos Cobo struct vif_params {
577818a986eSJohannes Berg 	u32 flags;
5788b787643SFelix Fietkau 	int use_4addr;
5791c18f145SArend van Spriel 	u8 macaddr[ETH_ALEN];
580b0265024SJohannes Berg 	const u8 *vht_mumimo_groups;
581b0265024SJohannes Berg 	const u8 *vht_mumimo_follow_addr;
5822ec600d6SLuis Carlos Cobo };
5832ec600d6SLuis Carlos Cobo 
58441ade00fSJohannes Berg /**
58541ade00fSJohannes Berg  * struct key_params - key information
58641ade00fSJohannes Berg  *
58741ade00fSJohannes Berg  * Information about a key
58841ade00fSJohannes Berg  *
58941ade00fSJohannes Berg  * @key: key material
59041ade00fSJohannes Berg  * @key_len: length of key material
59141ade00fSJohannes Berg  * @cipher: cipher suite selector
59241ade00fSJohannes Berg  * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used
59341ade00fSJohannes Berg  *	with the get_key() callback, must be in little endian,
59441ade00fSJohannes Berg  *	length given by @seq_len.
595abe37c4bSJohannes Berg  * @seq_len: length of @seq.
59614f34e36SGurumoorthi Gnanasambandhan  * @vlan_id: vlan_id for VLAN group key (if nonzero)
5976cdd3979SAlexander Wetzel  * @mode: key install mode (RX_TX, NO_TX or SET_TX)
59841ade00fSJohannes Berg  */
59941ade00fSJohannes Berg struct key_params {
600c1e5f471SJohannes Berg 	const u8 *key;
601c1e5f471SJohannes Berg 	const u8 *seq;
60241ade00fSJohannes Berg 	int key_len;
60341ade00fSJohannes Berg 	int seq_len;
60414f34e36SGurumoorthi Gnanasambandhan 	u16 vlan_id;
60541ade00fSJohannes Berg 	u32 cipher;
6066cdd3979SAlexander Wetzel 	enum nl80211_key_mode mode;
60741ade00fSJohannes Berg };
60841ade00fSJohannes Berg 
609ed1b6cc7SJohannes Berg /**
610683b6d3bSJohannes Berg  * struct cfg80211_chan_def - channel definition
611683b6d3bSJohannes Berg  * @chan: the (control) channel
6123d9d1d66SJohannes Berg  * @width: channel width
6133d9d1d66SJohannes Berg  * @center_freq1: center frequency of first segment
6143d9d1d66SJohannes Berg  * @center_freq2: center frequency of second segment
6153d9d1d66SJohannes Berg  *	(only with 80+80 MHz)
6162a38075cSAlexei Avshalom Lazar  * @edmg: define the EDMG channels configuration.
6172a38075cSAlexei Avshalom Lazar  *	If edmg is requested (i.e. the .channels member is non-zero),
6182a38075cSAlexei Avshalom Lazar  *	chan will define the primary channel and all other
6192a38075cSAlexei Avshalom Lazar  *	parameters are ignored.
620683b6d3bSJohannes Berg  */
621683b6d3bSJohannes Berg struct cfg80211_chan_def {
622683b6d3bSJohannes Berg 	struct ieee80211_channel *chan;
6233d9d1d66SJohannes Berg 	enum nl80211_chan_width width;
6243d9d1d66SJohannes Berg 	u32 center_freq1;
6253d9d1d66SJohannes Berg 	u32 center_freq2;
6262a38075cSAlexei Avshalom Lazar 	struct ieee80211_edmg edmg;
627683b6d3bSJohannes Berg };
628683b6d3bSJohannes Berg 
62977f576deSTamizh chelvam /**
6303710a8a6SJohannes Berg  * struct cfg80211_tid_cfg - TID specific configuration
63177f576deSTamizh chelvam  * @config_override: Flag to notify driver to reset TID configuration
63277f576deSTamizh chelvam  *	of the peer.
6333710a8a6SJohannes Berg  * @tids: bitmap of TIDs to modify
6343710a8a6SJohannes Berg  * @mask: bitmap of attributes indicating which parameter changed,
6353710a8a6SJohannes Berg  *	similar to &nl80211_tid_config_supp.
63677f576deSTamizh chelvam  * @noack: noack configuration value for the TID
637*6a21d16cSTamizh chelvam  * @retry_long: retry count value
638*6a21d16cSTamizh chelvam  * @retry_short: retry count value
63977f576deSTamizh chelvam  */
6403710a8a6SJohannes Berg struct cfg80211_tid_cfg {
64177f576deSTamizh chelvam 	bool config_override;
6423710a8a6SJohannes Berg 	u8 tids;
6433710a8a6SJohannes Berg 	u32 mask;
64477f576deSTamizh chelvam 	enum nl80211_tid_config noack;
645*6a21d16cSTamizh chelvam 	u8 retry_long, retry_short;
64677f576deSTamizh chelvam };
64777f576deSTamizh chelvam 
64877f576deSTamizh chelvam /**
6493710a8a6SJohannes Berg  * struct cfg80211_tid_config - TID configuration
65077f576deSTamizh chelvam  * @peer: Station's MAC address
65177f576deSTamizh chelvam  * @n_tid_conf: Number of TID specific configurations to be applied
65277f576deSTamizh chelvam  * @tid_conf: Configuration change info
65377f576deSTamizh chelvam  */
6543710a8a6SJohannes Berg struct cfg80211_tid_config {
65577f576deSTamizh chelvam 	const u8 *peer;
65677f576deSTamizh chelvam 	u32 n_tid_conf;
6573710a8a6SJohannes Berg 	struct cfg80211_tid_cfg tid_conf[];
65877f576deSTamizh chelvam };
65977f576deSTamizh chelvam 
6603d9d1d66SJohannes Berg /**
6613d9d1d66SJohannes Berg  * cfg80211_get_chandef_type - return old channel type from chandef
6623d9d1d66SJohannes Berg  * @chandef: the channel definition
6633d9d1d66SJohannes Berg  *
6640ae997dcSYacine Belkadi  * Return: The old channel type (NOHT, HT20, HT40+/-) from a given
6653d9d1d66SJohannes Berg  * chandef, which must have a bandwidth allowing this conversion.
6663d9d1d66SJohannes Berg  */
667683b6d3bSJohannes Berg static inline enum nl80211_channel_type
668683b6d3bSJohannes Berg cfg80211_get_chandef_type(const struct cfg80211_chan_def *chandef)
669683b6d3bSJohannes Berg {
6703d9d1d66SJohannes Berg 	switch (chandef->width) {
6713d9d1d66SJohannes Berg 	case NL80211_CHAN_WIDTH_20_NOHT:
6723d9d1d66SJohannes Berg 		return NL80211_CHAN_NO_HT;
6733d9d1d66SJohannes Berg 	case NL80211_CHAN_WIDTH_20:
6743d9d1d66SJohannes Berg 		return NL80211_CHAN_HT20;
6753d9d1d66SJohannes Berg 	case NL80211_CHAN_WIDTH_40:
6763d9d1d66SJohannes Berg 		if (chandef->center_freq1 > chandef->chan->center_freq)
6773d9d1d66SJohannes Berg 			return NL80211_CHAN_HT40PLUS;
6783d9d1d66SJohannes Berg 		return NL80211_CHAN_HT40MINUS;
6793d9d1d66SJohannes Berg 	default:
6803d9d1d66SJohannes Berg 		WARN_ON(1);
6813d9d1d66SJohannes Berg 		return NL80211_CHAN_NO_HT;
682683b6d3bSJohannes Berg 	}
6833d9d1d66SJohannes Berg }
6843d9d1d66SJohannes Berg 
6853d9d1d66SJohannes Berg /**
6863d9d1d66SJohannes Berg  * cfg80211_chandef_create - create channel definition using channel type
6873d9d1d66SJohannes Berg  * @chandef: the channel definition struct to fill
6883d9d1d66SJohannes Berg  * @channel: the control channel
6893d9d1d66SJohannes Berg  * @chantype: the channel type
6903d9d1d66SJohannes Berg  *
6913d9d1d66SJohannes Berg  * Given a channel type, create a channel definition.
6923d9d1d66SJohannes Berg  */
6933d9d1d66SJohannes Berg void cfg80211_chandef_create(struct cfg80211_chan_def *chandef,
6943d9d1d66SJohannes Berg 			     struct ieee80211_channel *channel,
6953d9d1d66SJohannes Berg 			     enum nl80211_channel_type chantype);
6963d9d1d66SJohannes Berg 
6973d9d1d66SJohannes Berg /**
6983d9d1d66SJohannes Berg  * cfg80211_chandef_identical - check if two channel definitions are identical
6993d9d1d66SJohannes Berg  * @chandef1: first channel definition
7003d9d1d66SJohannes Berg  * @chandef2: second channel definition
7013d9d1d66SJohannes Berg  *
7020ae997dcSYacine Belkadi  * Return: %true if the channels defined by the channel definitions are
7033d9d1d66SJohannes Berg  * identical, %false otherwise.
7043d9d1d66SJohannes Berg  */
7053d9d1d66SJohannes Berg static inline bool
7063d9d1d66SJohannes Berg cfg80211_chandef_identical(const struct cfg80211_chan_def *chandef1,
7073d9d1d66SJohannes Berg 			   const struct cfg80211_chan_def *chandef2)
7083d9d1d66SJohannes Berg {
7093d9d1d66SJohannes Berg 	return (chandef1->chan == chandef2->chan &&
7103d9d1d66SJohannes Berg 		chandef1->width == chandef2->width &&
7113d9d1d66SJohannes Berg 		chandef1->center_freq1 == chandef2->center_freq1 &&
7123d9d1d66SJohannes Berg 		chandef1->center_freq2 == chandef2->center_freq2);
7133d9d1d66SJohannes Berg }
7143d9d1d66SJohannes Berg 
7153d9d1d66SJohannes Berg /**
7162a38075cSAlexei Avshalom Lazar  * cfg80211_chandef_is_edmg - check if chandef represents an EDMG channel
7172a38075cSAlexei Avshalom Lazar  *
7182a38075cSAlexei Avshalom Lazar  * @chandef: the channel definition
7192a38075cSAlexei Avshalom Lazar  *
7202a38075cSAlexei Avshalom Lazar  * Return: %true if EDMG defined, %false otherwise.
7212a38075cSAlexei Avshalom Lazar  */
7222a38075cSAlexei Avshalom Lazar static inline bool
7232a38075cSAlexei Avshalom Lazar cfg80211_chandef_is_edmg(const struct cfg80211_chan_def *chandef)
7242a38075cSAlexei Avshalom Lazar {
7252a38075cSAlexei Avshalom Lazar 	return chandef->edmg.channels || chandef->edmg.bw_config;
7262a38075cSAlexei Avshalom Lazar }
7272a38075cSAlexei Avshalom Lazar 
7282a38075cSAlexei Avshalom Lazar /**
7293d9d1d66SJohannes Berg  * cfg80211_chandef_compatible - check if two channel definitions are compatible
7303d9d1d66SJohannes Berg  * @chandef1: first channel definition
7313d9d1d66SJohannes Berg  * @chandef2: second channel definition
7323d9d1d66SJohannes Berg  *
7330ae997dcSYacine Belkadi  * Return: %NULL if the given channel definitions are incompatible,
7343d9d1d66SJohannes Berg  * chandef1 or chandef2 otherwise.
7353d9d1d66SJohannes Berg  */
7363d9d1d66SJohannes Berg const struct cfg80211_chan_def *
7373d9d1d66SJohannes Berg cfg80211_chandef_compatible(const struct cfg80211_chan_def *chandef1,
7383d9d1d66SJohannes Berg 			    const struct cfg80211_chan_def *chandef2);
739683b6d3bSJohannes Berg 
740683b6d3bSJohannes Berg /**
7419f5e8f6eSJohannes Berg  * cfg80211_chandef_valid - check if a channel definition is valid
7429f5e8f6eSJohannes Berg  * @chandef: the channel definition to check
7430ae997dcSYacine Belkadi  * Return: %true if the channel definition is valid. %false otherwise.
7449f5e8f6eSJohannes Berg  */
7459f5e8f6eSJohannes Berg bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef);
7469f5e8f6eSJohannes Berg 
7479f5e8f6eSJohannes Berg /**
7489f5e8f6eSJohannes Berg  * cfg80211_chandef_usable - check if secondary channels can be used
7499f5e8f6eSJohannes Berg  * @wiphy: the wiphy to validate against
7509f5e8f6eSJohannes Berg  * @chandef: the channel definition to check
7510ae997dcSYacine Belkadi  * @prohibited_flags: the regulatory channel flags that must not be set
7520ae997dcSYacine Belkadi  * Return: %true if secondary channels are usable. %false otherwise.
7539f5e8f6eSJohannes Berg  */
7549f5e8f6eSJohannes Berg bool cfg80211_chandef_usable(struct wiphy *wiphy,
7559f5e8f6eSJohannes Berg 			     const struct cfg80211_chan_def *chandef,
7569f5e8f6eSJohannes Berg 			     u32 prohibited_flags);
7579f5e8f6eSJohannes Berg 
7589f5e8f6eSJohannes Berg /**
759774f0734SSimon Wunderlich  * cfg80211_chandef_dfs_required - checks if radar detection is required
760774f0734SSimon Wunderlich  * @wiphy: the wiphy to validate against
761774f0734SSimon Wunderlich  * @chandef: the channel definition to check
7622beb6dabSLuciano Coelho  * @iftype: the interface type as specified in &enum nl80211_iftype
7632beb6dabSLuciano Coelho  * Returns:
7642beb6dabSLuciano Coelho  *	1 if radar detection is required, 0 if it is not, < 0 on error
765774f0734SSimon Wunderlich  */
766774f0734SSimon Wunderlich int cfg80211_chandef_dfs_required(struct wiphy *wiphy,
7672beb6dabSLuciano Coelho 				  const struct cfg80211_chan_def *chandef,
768c3d62036SLuciano Coelho 				  enum nl80211_iftype iftype);
769774f0734SSimon Wunderlich 
770774f0734SSimon Wunderlich /**
77130e74732SSimon Wunderlich  * ieee80211_chandef_rate_flags - returns rate flags for a channel
77230e74732SSimon Wunderlich  *
77330e74732SSimon Wunderlich  * In some channel types, not all rates may be used - for example CCK
77430e74732SSimon Wunderlich  * rates may not be used in 5/10 MHz channels.
77530e74732SSimon Wunderlich  *
77630e74732SSimon Wunderlich  * @chandef: channel definition for the channel
77730e74732SSimon Wunderlich  *
77830e74732SSimon Wunderlich  * Returns: rate flags which apply for this channel
77930e74732SSimon Wunderlich  */
78030e74732SSimon Wunderlich static inline enum ieee80211_rate_flags
78130e74732SSimon Wunderlich ieee80211_chandef_rate_flags(struct cfg80211_chan_def *chandef)
78230e74732SSimon Wunderlich {
78330e74732SSimon Wunderlich 	switch (chandef->width) {
78430e74732SSimon Wunderlich 	case NL80211_CHAN_WIDTH_5:
78530e74732SSimon Wunderlich 		return IEEE80211_RATE_SUPPORTS_5MHZ;
78630e74732SSimon Wunderlich 	case NL80211_CHAN_WIDTH_10:
78730e74732SSimon Wunderlich 		return IEEE80211_RATE_SUPPORTS_10MHZ;
78830e74732SSimon Wunderlich 	default:
78930e74732SSimon Wunderlich 		break;
79030e74732SSimon Wunderlich 	}
79130e74732SSimon Wunderlich 	return 0;
79230e74732SSimon Wunderlich }
79330e74732SSimon Wunderlich 
79430e74732SSimon Wunderlich /**
7950430c883SSimon Wunderlich  * ieee80211_chandef_max_power - maximum transmission power for the chandef
7960430c883SSimon Wunderlich  *
7970430c883SSimon Wunderlich  * In some regulations, the transmit power may depend on the configured channel
7980430c883SSimon Wunderlich  * bandwidth which may be defined as dBm/MHz. This function returns the actual
7990430c883SSimon Wunderlich  * max_power for non-standard (20 MHz) channels.
8000430c883SSimon Wunderlich  *
8010430c883SSimon Wunderlich  * @chandef: channel definition for the channel
8020430c883SSimon Wunderlich  *
8030430c883SSimon Wunderlich  * Returns: maximum allowed transmission power in dBm for the chandef
8040430c883SSimon Wunderlich  */
8050430c883SSimon Wunderlich static inline int
8060430c883SSimon Wunderlich ieee80211_chandef_max_power(struct cfg80211_chan_def *chandef)
8070430c883SSimon Wunderlich {
8080430c883SSimon Wunderlich 	switch (chandef->width) {
8090430c883SSimon Wunderlich 	case NL80211_CHAN_WIDTH_5:
8100430c883SSimon Wunderlich 		return min(chandef->chan->max_reg_power - 6,
8110430c883SSimon Wunderlich 			   chandef->chan->max_power);
8120430c883SSimon Wunderlich 	case NL80211_CHAN_WIDTH_10:
8130430c883SSimon Wunderlich 		return min(chandef->chan->max_reg_power - 3,
8140430c883SSimon Wunderlich 			   chandef->chan->max_power);
8150430c883SSimon Wunderlich 	default:
8160430c883SSimon Wunderlich 		break;
8170430c883SSimon Wunderlich 	}
8180430c883SSimon Wunderlich 	return chandef->chan->max_power;
8190430c883SSimon Wunderlich }
8200430c883SSimon Wunderlich 
8210430c883SSimon Wunderlich /**
82261fa713cSHolger Schurig  * enum survey_info_flags - survey information flags
82361fa713cSHolger Schurig  *
824abe37c4bSJohannes Berg  * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in
82517e5a808SFelix Fietkau  * @SURVEY_INFO_IN_USE: channel is currently being used
8264ed20bebSJohannes Berg  * @SURVEY_INFO_TIME: active time (in ms) was filled in
8274ed20bebSJohannes Berg  * @SURVEY_INFO_TIME_BUSY: busy time was filled in
8284ed20bebSJohannes Berg  * @SURVEY_INFO_TIME_EXT_BUSY: extension channel busy time was filled in
8294ed20bebSJohannes Berg  * @SURVEY_INFO_TIME_RX: receive time was filled in
8304ed20bebSJohannes Berg  * @SURVEY_INFO_TIME_TX: transmit time was filled in
831052536abSJohannes Berg  * @SURVEY_INFO_TIME_SCAN: scan time was filled in
832c8cd6e7fSFelix Fietkau  * @SURVEY_INFO_TIME_BSS_RX: local BSS receive time was filled in
833abe37c4bSJohannes Berg  *
83461fa713cSHolger Schurig  * Used by the driver to indicate which info in &struct survey_info
83561fa713cSHolger Schurig  * it has filled in during the get_survey().
83661fa713cSHolger Schurig  */
83761fa713cSHolger Schurig enum survey_info_flags {
8384ed20bebSJohannes Berg 	SURVEY_INFO_NOISE_DBM		= BIT(0),
8394ed20bebSJohannes Berg 	SURVEY_INFO_IN_USE		= BIT(1),
8404ed20bebSJohannes Berg 	SURVEY_INFO_TIME		= BIT(2),
8414ed20bebSJohannes Berg 	SURVEY_INFO_TIME_BUSY		= BIT(3),
8424ed20bebSJohannes Berg 	SURVEY_INFO_TIME_EXT_BUSY	= BIT(4),
8434ed20bebSJohannes Berg 	SURVEY_INFO_TIME_RX		= BIT(5),
8444ed20bebSJohannes Berg 	SURVEY_INFO_TIME_TX		= BIT(6),
845052536abSJohannes Berg 	SURVEY_INFO_TIME_SCAN		= BIT(7),
846c8cd6e7fSFelix Fietkau 	SURVEY_INFO_TIME_BSS_RX		= BIT(8),
84761fa713cSHolger Schurig };
84861fa713cSHolger Schurig 
84961fa713cSHolger Schurig /**
85061fa713cSHolger Schurig  * struct survey_info - channel survey response
85161fa713cSHolger Schurig  *
85211f78ac3SJohannes Berg  * @channel: the channel this survey record reports, may be %NULL for a single
85311f78ac3SJohannes Berg  *	record to report global statistics
85461fa713cSHolger Schurig  * @filled: bitflag of flags from &enum survey_info_flags
85561fa713cSHolger Schurig  * @noise: channel noise in dBm. This and all following fields are
85661fa713cSHolger Schurig  *	optional
8574ed20bebSJohannes Berg  * @time: amount of time in ms the radio was turn on (on the channel)
8584ed20bebSJohannes Berg  * @time_busy: amount of time the primary channel was sensed busy
8594ed20bebSJohannes Berg  * @time_ext_busy: amount of time the extension channel was sensed busy
8604ed20bebSJohannes Berg  * @time_rx: amount of time the radio spent receiving data
8614ed20bebSJohannes Berg  * @time_tx: amount of time the radio spent transmitting data
862052536abSJohannes Berg  * @time_scan: amount of time the radio spent for scanning
863c8cd6e7fSFelix Fietkau  * @time_bss_rx: amount of time the radio spent receiving data on a local BSS
86461fa713cSHolger Schurig  *
865abe37c4bSJohannes Berg  * Used by dump_survey() to report back per-channel survey information.
866abe37c4bSJohannes Berg  *
86761fa713cSHolger Schurig  * This structure can later be expanded with things like
86861fa713cSHolger Schurig  * channel duty cycle etc.
86961fa713cSHolger Schurig  */
87061fa713cSHolger Schurig struct survey_info {
87161fa713cSHolger Schurig 	struct ieee80211_channel *channel;
8724ed20bebSJohannes Berg 	u64 time;
8734ed20bebSJohannes Berg 	u64 time_busy;
8744ed20bebSJohannes Berg 	u64 time_ext_busy;
8754ed20bebSJohannes Berg 	u64 time_rx;
8764ed20bebSJohannes Berg 	u64 time_tx;
877052536abSJohannes Berg 	u64 time_scan;
878c8cd6e7fSFelix Fietkau 	u64 time_bss_rx;
87961fa713cSHolger Schurig 	u32 filled;
88061fa713cSHolger Schurig 	s8 noise;
88161fa713cSHolger Schurig };
88261fa713cSHolger Schurig 
883b8676221SDavid Spinadel #define CFG80211_MAX_WEP_KEYS	4
884b8676221SDavid Spinadel 
88561fa713cSHolger Schurig /**
8865fb628e9SJouni Malinen  * struct cfg80211_crypto_settings - Crypto settings
8875fb628e9SJouni Malinen  * @wpa_versions: indicates which, if any, WPA versions are enabled
8885fb628e9SJouni Malinen  *	(from enum nl80211_wpa_versions)
8895fb628e9SJouni Malinen  * @cipher_group: group key cipher suite (or 0 if unset)
8905fb628e9SJouni Malinen  * @n_ciphers_pairwise: number of AP supported unicast ciphers
8915fb628e9SJouni Malinen  * @ciphers_pairwise: unicast key cipher suites
8925fb628e9SJouni Malinen  * @n_akm_suites: number of AKM suites
8935fb628e9SJouni Malinen  * @akm_suites: AKM suites
8945fb628e9SJouni Malinen  * @control_port: Whether user space controls IEEE 802.1X port, i.e.,
8955fb628e9SJouni Malinen  *	sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
8965fb628e9SJouni Malinen  *	required to assume that the port is unauthorized until authorized by
8975fb628e9SJouni Malinen  *	user space. Otherwise, port is marked authorized by default.
8985fb628e9SJouni Malinen  * @control_port_ethertype: the control port protocol that should be
8995fb628e9SJouni Malinen  *	allowed through even on unauthorized ports
9005fb628e9SJouni Malinen  * @control_port_no_encrypt: TRUE to prevent encryption of control port
9015fb628e9SJouni Malinen  *	protocol frames.
90264bf3d4bSDenis Kenzior  * @control_port_over_nl80211: TRUE if userspace expects to exchange control
90364bf3d4bSDenis Kenzior  *	port frames over NL80211 instead of the network interface.
904b8676221SDavid Spinadel  * @wep_keys: static WEP keys, if not NULL points to an array of
905b8676221SDavid Spinadel  *	CFG80211_MAX_WEP_KEYS WEP keys
906b8676221SDavid Spinadel  * @wep_tx_key: key index (0..3) of the default TX static WEP key
90791b5ab62SEliad Peller  * @psk: PSK (for devices supporting 4-way-handshake offload)
90826f7044eSChung-Hsien Hsu  * @sae_pwd: password for SAE authentication (for devices supporting SAE
90926f7044eSChung-Hsien Hsu  *	offload)
91026f7044eSChung-Hsien Hsu  * @sae_pwd_len: length of SAE password (for devices supporting SAE offload)
9115fb628e9SJouni Malinen  */
9125fb628e9SJouni Malinen struct cfg80211_crypto_settings {
9135fb628e9SJouni Malinen 	u32 wpa_versions;
9145fb628e9SJouni Malinen 	u32 cipher_group;
9155fb628e9SJouni Malinen 	int n_ciphers_pairwise;
9165fb628e9SJouni Malinen 	u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES];
9175fb628e9SJouni Malinen 	int n_akm_suites;
9185fb628e9SJouni Malinen 	u32 akm_suites[NL80211_MAX_NR_AKM_SUITES];
9195fb628e9SJouni Malinen 	bool control_port;
9205fb628e9SJouni Malinen 	__be16 control_port_ethertype;
9215fb628e9SJouni Malinen 	bool control_port_no_encrypt;
92264bf3d4bSDenis Kenzior 	bool control_port_over_nl80211;
923b8676221SDavid Spinadel 	struct key_params *wep_keys;
924b8676221SDavid Spinadel 	int wep_tx_key;
92591b5ab62SEliad Peller 	const u8 *psk;
92626f7044eSChung-Hsien Hsu 	const u8 *sae_pwd;
92726f7044eSChung-Hsien Hsu 	u8 sae_pwd_len;
9285fb628e9SJouni Malinen };
9295fb628e9SJouni Malinen 
9305fb628e9SJouni Malinen /**
9318860020eSJohannes Berg  * struct cfg80211_beacon_data - beacon data
932ed1b6cc7SJohannes Berg  * @head: head portion of beacon (before TIM IE)
933ed1b6cc7SJohannes Berg  *	or %NULL if not changed
934ed1b6cc7SJohannes Berg  * @tail: tail portion of beacon (after TIM IE)
935ed1b6cc7SJohannes Berg  *	or %NULL if not changed
936ed1b6cc7SJohannes Berg  * @head_len: length of @head
937ed1b6cc7SJohannes Berg  * @tail_len: length of @tail
9389946ecfbSJouni Malinen  * @beacon_ies: extra information element(s) to add into Beacon frames or %NULL
9399946ecfbSJouni Malinen  * @beacon_ies_len: length of beacon_ies in octets
9409946ecfbSJouni Malinen  * @proberesp_ies: extra information element(s) to add into Probe Response
9419946ecfbSJouni Malinen  *	frames or %NULL
9429946ecfbSJouni Malinen  * @proberesp_ies_len: length of proberesp_ies in octets
9439946ecfbSJouni Malinen  * @assocresp_ies: extra information element(s) to add into (Re)Association
9449946ecfbSJouni Malinen  *	Response frames or %NULL
9459946ecfbSJouni Malinen  * @assocresp_ies_len: length of assocresp_ies in octets
94600f740e1SArik Nemtsov  * @probe_resp_len: length of probe response template (@probe_resp)
94700f740e1SArik Nemtsov  * @probe_resp: probe response template (AP mode only)
94881e54d08SPradeep Kumar Chitrapu  * @ftm_responder: enable FTM responder functionality; -1 for no change
94981e54d08SPradeep Kumar Chitrapu  *	(which also implies no change in LCI/civic location data)
95030db641eSJohannes Berg  * @lci: Measurement Report element content, starting with Measurement Token
95130db641eSJohannes Berg  *	(measurement type 8)
95230db641eSJohannes Berg  * @civicloc: Measurement Report element content, starting with Measurement
95330db641eSJohannes Berg  *	Token (measurement type 11)
95481e54d08SPradeep Kumar Chitrapu  * @lci_len: LCI data length
95581e54d08SPradeep Kumar Chitrapu  * @civicloc_len: Civic location data length
956ed1b6cc7SJohannes Berg  */
9578860020eSJohannes Berg struct cfg80211_beacon_data {
9588860020eSJohannes Berg 	const u8 *head, *tail;
9598860020eSJohannes Berg 	const u8 *beacon_ies;
9608860020eSJohannes Berg 	const u8 *proberesp_ies;
9618860020eSJohannes Berg 	const u8 *assocresp_ies;
9628860020eSJohannes Berg 	const u8 *probe_resp;
96381e54d08SPradeep Kumar Chitrapu 	const u8 *lci;
96481e54d08SPradeep Kumar Chitrapu 	const u8 *civicloc;
96581e54d08SPradeep Kumar Chitrapu 	s8 ftm_responder;
9668860020eSJohannes Berg 
9678860020eSJohannes Berg 	size_t head_len, tail_len;
9688860020eSJohannes Berg 	size_t beacon_ies_len;
9698860020eSJohannes Berg 	size_t proberesp_ies_len;
9708860020eSJohannes Berg 	size_t assocresp_ies_len;
9718860020eSJohannes Berg 	size_t probe_resp_len;
97281e54d08SPradeep Kumar Chitrapu 	size_t lci_len;
97381e54d08SPradeep Kumar Chitrapu 	size_t civicloc_len;
9748860020eSJohannes Berg };
9758860020eSJohannes Berg 
9766d45a74bSVasanthakumar Thiagarajan struct mac_address {
9776d45a74bSVasanthakumar Thiagarajan 	u8 addr[ETH_ALEN];
9786d45a74bSVasanthakumar Thiagarajan };
9796d45a74bSVasanthakumar Thiagarajan 
9808860020eSJohannes Berg /**
98177765eafSVasanthakumar Thiagarajan  * struct cfg80211_acl_data - Access control list data
98277765eafSVasanthakumar Thiagarajan  *
98377765eafSVasanthakumar Thiagarajan  * @acl_policy: ACL policy to be applied on the station's
984077f897aSJohannes Berg  *	entry specified by mac_addr
98577765eafSVasanthakumar Thiagarajan  * @n_acl_entries: Number of MAC address entries passed
98677765eafSVasanthakumar Thiagarajan  * @mac_addrs: List of MAC addresses of stations to be used for ACL
98777765eafSVasanthakumar Thiagarajan  */
98877765eafSVasanthakumar Thiagarajan struct cfg80211_acl_data {
98977765eafSVasanthakumar Thiagarajan 	enum nl80211_acl_policy acl_policy;
99077765eafSVasanthakumar Thiagarajan 	int n_acl_entries;
99177765eafSVasanthakumar Thiagarajan 
99277765eafSVasanthakumar Thiagarajan 	/* Keep it last */
99377765eafSVasanthakumar Thiagarajan 	struct mac_address mac_addrs[];
99477765eafSVasanthakumar Thiagarajan };
99577765eafSVasanthakumar Thiagarajan 
996a7c7fbffSPurushottam Kushwaha /*
997a7c7fbffSPurushottam Kushwaha  * cfg80211_bitrate_mask - masks for bitrate control
998a7c7fbffSPurushottam Kushwaha  */
999a7c7fbffSPurushottam Kushwaha struct cfg80211_bitrate_mask {
1000a7c7fbffSPurushottam Kushwaha 	struct {
1001a7c7fbffSPurushottam Kushwaha 		u32 legacy;
1002a7c7fbffSPurushottam Kushwaha 		u8 ht_mcs[IEEE80211_HT_MCS_MASK_LEN];
1003a7c7fbffSPurushottam Kushwaha 		u16 vht_mcs[NL80211_VHT_NSS_MAX];
1004a7c7fbffSPurushottam Kushwaha 		enum nl80211_txrate_gi gi;
1005a7c7fbffSPurushottam Kushwaha 	} control[NUM_NL80211_BANDS];
1006a7c7fbffSPurushottam Kushwaha };
1007a7c7fbffSPurushottam Kushwaha 
10088860020eSJohannes Berg /**
1009fe494370SSrinivas Dasari  * enum cfg80211_ap_settings_flags - AP settings flags
1010fe494370SSrinivas Dasari  *
1011fe494370SSrinivas Dasari  * Used by cfg80211_ap_settings
1012fe494370SSrinivas Dasari  *
1013fe494370SSrinivas Dasari  * @AP_SETTINGS_EXTERNAL_AUTH_SUPPORT: AP supports external authentication
1014fe494370SSrinivas Dasari  */
1015fe494370SSrinivas Dasari enum cfg80211_ap_settings_flags {
1016fe494370SSrinivas Dasari 	AP_SETTINGS_EXTERNAL_AUTH_SUPPORT = BIT(0),
1017fe494370SSrinivas Dasari };
1018fe494370SSrinivas Dasari 
1019fe494370SSrinivas Dasari /**
10208860020eSJohannes Berg  * struct cfg80211_ap_settings - AP configuration
10218860020eSJohannes Berg  *
10228860020eSJohannes Berg  * Used to configure an AP interface.
10238860020eSJohannes Berg  *
1024683b6d3bSJohannes Berg  * @chandef: defines the channel to use
10258860020eSJohannes Berg  * @beacon: beacon data
10268860020eSJohannes Berg  * @beacon_interval: beacon interval
10278860020eSJohannes Berg  * @dtim_period: DTIM period
10288860020eSJohannes Berg  * @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from
10298860020eSJohannes Berg  *	user space)
10308860020eSJohannes Berg  * @ssid_len: length of @ssid
10318860020eSJohannes Berg  * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames
10328860020eSJohannes Berg  * @crypto: crypto settings
10338860020eSJohannes Berg  * @privacy: the BSS uses privacy
10348860020eSJohannes Berg  * @auth_type: Authentication type (algorithm)
103518998c38SEliad Peller  * @smps_mode: SMPS mode
10361b658f11SVasanthakumar Thiagarajan  * @inactivity_timeout: time in seconds to determine station's inactivity.
103753cabad7SJohannes Berg  * @p2p_ctwindow: P2P CT Window
103853cabad7SJohannes Berg  * @p2p_opp_ps: P2P opportunistic PS
103977765eafSVasanthakumar Thiagarajan  * @acl: ACL configuration used by the drivers which has support for
104077765eafSVasanthakumar Thiagarajan  *	MAC address based access control
104134d50519SLior David  * @pbss: If set, start as a PCP instead of AP. Relevant for DMG
104234d50519SLior David  *	networks.
10438564e382SJohannes Berg  * @beacon_rate: bitrate to be used for beacons
104466cd794eSJohannes Berg  * @ht_cap: HT capabilities (or %NULL if HT isn't enabled)
104566cd794eSJohannes Berg  * @vht_cap: VHT capabilities (or %NULL if VHT isn't enabled)
1046244eb9aeSShaul Triebitz  * @he_cap: HE capabilities (or %NULL if HE isn't enabled)
104766cd794eSJohannes Berg  * @ht_required: stations must support HT
104866cd794eSJohannes Berg  * @vht_required: stations must support VHT
1049a0de1ca3SJohn Crispin  * @twt_responder: Enable Target Wait Time
1050fe494370SSrinivas Dasari  * @flags: flags, as defined in enum cfg80211_ap_settings_flags
1051796e90f4SJohn Crispin  * @he_obss_pd: OBSS Packet Detection settings
10525c5e52d1SJohn Crispin  * @he_bss_color: BSS Color settings
10538860020eSJohannes Berg  */
10548860020eSJohannes Berg struct cfg80211_ap_settings {
1055683b6d3bSJohannes Berg 	struct cfg80211_chan_def chandef;
1056aa430da4SJohannes Berg 
10578860020eSJohannes Berg 	struct cfg80211_beacon_data beacon;
10588860020eSJohannes Berg 
10598860020eSJohannes Berg 	int beacon_interval, dtim_period;
106032e9de84SJouni Malinen 	const u8 *ssid;
106132e9de84SJouni Malinen 	size_t ssid_len;
106232e9de84SJouni Malinen 	enum nl80211_hidden_ssid hidden_ssid;
10635fb628e9SJouni Malinen 	struct cfg80211_crypto_settings crypto;
10645fb628e9SJouni Malinen 	bool privacy;
10655fb628e9SJouni Malinen 	enum nl80211_auth_type auth_type;
106618998c38SEliad Peller 	enum nl80211_smps_mode smps_mode;
10671b658f11SVasanthakumar Thiagarajan 	int inactivity_timeout;
106853cabad7SJohannes Berg 	u8 p2p_ctwindow;
106953cabad7SJohannes Berg 	bool p2p_opp_ps;
107077765eafSVasanthakumar Thiagarajan 	const struct cfg80211_acl_data *acl;
107134d50519SLior David 	bool pbss;
1072a7c7fbffSPurushottam Kushwaha 	struct cfg80211_bitrate_mask beacon_rate;
107366cd794eSJohannes Berg 
107466cd794eSJohannes Berg 	const struct ieee80211_ht_cap *ht_cap;
107566cd794eSJohannes Berg 	const struct ieee80211_vht_cap *vht_cap;
1076244eb9aeSShaul Triebitz 	const struct ieee80211_he_cap_elem *he_cap;
107766cd794eSJohannes Berg 	bool ht_required, vht_required;
1078a0de1ca3SJohn Crispin 	bool twt_responder;
1079fe494370SSrinivas Dasari 	u32 flags;
1080796e90f4SJohn Crispin 	struct ieee80211_he_obss_pd he_obss_pd;
10815c5e52d1SJohn Crispin 	struct cfg80211_he_bss_color he_bss_color;
1082ed1b6cc7SJohannes Berg };
1083ed1b6cc7SJohannes Berg 
10845727ef1bSJohannes Berg /**
108516ef1fe2SSimon Wunderlich  * struct cfg80211_csa_settings - channel switch settings
108616ef1fe2SSimon Wunderlich  *
108716ef1fe2SSimon Wunderlich  * Used for channel switch
108816ef1fe2SSimon Wunderlich  *
108916ef1fe2SSimon Wunderlich  * @chandef: defines the channel to use after the switch
109016ef1fe2SSimon Wunderlich  * @beacon_csa: beacon data while performing the switch
10919a774c78SAndrei Otcheretianski  * @counter_offsets_beacon: offsets of the counters within the beacon (tail)
10929a774c78SAndrei Otcheretianski  * @counter_offsets_presp: offsets of the counters within the probe response
10939a774c78SAndrei Otcheretianski  * @n_counter_offsets_beacon: number of csa counters the beacon (tail)
10949a774c78SAndrei Otcheretianski  * @n_counter_offsets_presp: number of csa counters in the probe response
109516ef1fe2SSimon Wunderlich  * @beacon_after: beacon data to be used on the new channel
109616ef1fe2SSimon Wunderlich  * @radar_required: whether radar detection is required on the new channel
109716ef1fe2SSimon Wunderlich  * @block_tx: whether transmissions should be blocked while changing
109816ef1fe2SSimon Wunderlich  * @count: number of beacons until switch
109916ef1fe2SSimon Wunderlich  */
110016ef1fe2SSimon Wunderlich struct cfg80211_csa_settings {
110116ef1fe2SSimon Wunderlich 	struct cfg80211_chan_def chandef;
110216ef1fe2SSimon Wunderlich 	struct cfg80211_beacon_data beacon_csa;
11039a774c78SAndrei Otcheretianski 	const u16 *counter_offsets_beacon;
11049a774c78SAndrei Otcheretianski 	const u16 *counter_offsets_presp;
11059a774c78SAndrei Otcheretianski 	unsigned int n_counter_offsets_beacon;
11069a774c78SAndrei Otcheretianski 	unsigned int n_counter_offsets_presp;
110716ef1fe2SSimon Wunderlich 	struct cfg80211_beacon_data beacon_after;
110816ef1fe2SSimon Wunderlich 	bool radar_required;
110916ef1fe2SSimon Wunderlich 	bool block_tx;
111016ef1fe2SSimon Wunderlich 	u8 count;
111116ef1fe2SSimon Wunderlich };
111216ef1fe2SSimon Wunderlich 
111351a1aaa6SJohannes Berg #define CFG80211_MAX_NUM_DIFFERENT_CHANNELS 10
111451a1aaa6SJohannes Berg 
111516ef1fe2SSimon Wunderlich /**
1116e227300cSPurushottam Kushwaha  * struct iface_combination_params - input parameters for interface combinations
1117e227300cSPurushottam Kushwaha  *
1118e227300cSPurushottam Kushwaha  * Used to pass interface combination parameters
1119e227300cSPurushottam Kushwaha  *
1120e227300cSPurushottam Kushwaha  * @num_different_channels: the number of different channels we want
1121e227300cSPurushottam Kushwaha  *	to use for verification
1122e227300cSPurushottam Kushwaha  * @radar_detect: a bitmap where each bit corresponds to a channel
1123e227300cSPurushottam Kushwaha  *	width where radar detection is needed, as in the definition of
1124e227300cSPurushottam Kushwaha  *	&struct ieee80211_iface_combination.@radar_detect_widths
1125e227300cSPurushottam Kushwaha  * @iftype_num: array with the number of interfaces of each interface
1126e227300cSPurushottam Kushwaha  *	type.  The index is the interface type as specified in &enum
1127e227300cSPurushottam Kushwaha  *	nl80211_iftype.
11284c8dea63SJohannes Berg  * @new_beacon_int: set this to the beacon interval of a new interface
11294c8dea63SJohannes Berg  *	that's not operating yet, if such is to be checked as part of
11304c8dea63SJohannes Berg  *	the verification
1131e227300cSPurushottam Kushwaha  */
1132e227300cSPurushottam Kushwaha struct iface_combination_params {
1133e227300cSPurushottam Kushwaha 	int num_different_channels;
1134e227300cSPurushottam Kushwaha 	u8 radar_detect;
1135e227300cSPurushottam Kushwaha 	int iftype_num[NUM_NL80211_IFTYPES];
11364c8dea63SJohannes Berg 	u32 new_beacon_int;
1137e227300cSPurushottam Kushwaha };
1138e227300cSPurushottam Kushwaha 
1139e227300cSPurushottam Kushwaha /**
11403b9ce80cSJohannes Berg  * enum station_parameters_apply_mask - station parameter values to apply
11413b9ce80cSJohannes Berg  * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp)
11429d62a986SJouni Malinen  * @STATION_PARAM_APPLY_CAPABILITY: apply new capability
1143f8bacc21SJohannes Berg  * @STATION_PARAM_APPLY_PLINK_STATE: apply new plink state
11443b9ce80cSJohannes Berg  *
11453b9ce80cSJohannes Berg  * Not all station parameters have in-band "no change" signalling,
11463b9ce80cSJohannes Berg  * for those that don't these flags will are used.
11473b9ce80cSJohannes Berg  */
11483b9ce80cSJohannes Berg enum station_parameters_apply_mask {
11493b9ce80cSJohannes Berg 	STATION_PARAM_APPLY_UAPSD = BIT(0),
11509d62a986SJouni Malinen 	STATION_PARAM_APPLY_CAPABILITY = BIT(1),
1151f8bacc21SJohannes Berg 	STATION_PARAM_APPLY_PLINK_STATE = BIT(2),
1152e96d1cd2SAshok Raj Nagarajan 	STATION_PARAM_APPLY_STA_TXPOWER = BIT(3),
1153e96d1cd2SAshok Raj Nagarajan };
1154e96d1cd2SAshok Raj Nagarajan 
1155e96d1cd2SAshok Raj Nagarajan /**
1156e96d1cd2SAshok Raj Nagarajan  * struct sta_txpwr - station txpower configuration
1157e96d1cd2SAshok Raj Nagarajan  *
1158e96d1cd2SAshok Raj Nagarajan  * Used to configure txpower for station.
1159e96d1cd2SAshok Raj Nagarajan  *
1160e96d1cd2SAshok Raj Nagarajan  * @power: tx power (in dBm) to be used for sending data traffic. If tx power
1161e96d1cd2SAshok Raj Nagarajan  *	is not provided, the default per-interface tx power setting will be
1162e96d1cd2SAshok Raj Nagarajan  *	overriding. Driver should be picking up the lowest tx power, either tx
1163e96d1cd2SAshok Raj Nagarajan  *	power per-interface or per-station.
1164e96d1cd2SAshok Raj Nagarajan  * @type: In particular if TPC %type is NL80211_TX_POWER_LIMITED then tx power
1165e96d1cd2SAshok Raj Nagarajan  *	will be less than or equal to specified from userspace, whereas if TPC
1166e96d1cd2SAshok Raj Nagarajan  *	%type is NL80211_TX_POWER_AUTOMATIC then it indicates default tx power.
1167e96d1cd2SAshok Raj Nagarajan  *	NL80211_TX_POWER_FIXED is not a valid configuration option for
1168e96d1cd2SAshok Raj Nagarajan  *	per peer TPC.
1169e96d1cd2SAshok Raj Nagarajan  */
1170e96d1cd2SAshok Raj Nagarajan struct sta_txpwr {
1171e96d1cd2SAshok Raj Nagarajan 	s16 power;
1172e96d1cd2SAshok Raj Nagarajan 	enum nl80211_tx_power_setting type;
11733b9ce80cSJohannes Berg };
11743b9ce80cSJohannes Berg 
11753b9ce80cSJohannes Berg /**
11765727ef1bSJohannes Berg  * struct station_parameters - station parameters
11775727ef1bSJohannes Berg  *
11785727ef1bSJohannes Berg  * Used to change and create a new station.
11795727ef1bSJohannes Berg  *
11805727ef1bSJohannes Berg  * @vlan: vlan interface station should belong to
11815727ef1bSJohannes Berg  * @supported_rates: supported rates in IEEE 802.11 format
11825727ef1bSJohannes Berg  *	(or NULL for no change)
11835727ef1bSJohannes Berg  * @supported_rates_len: number of supported rates
1184eccb8e8fSJohannes Berg  * @sta_flags_mask: station flags that changed
1185819bf593SJohannes Berg  *	(bitmask of BIT(%NL80211_STA_FLAG_...))
1186eccb8e8fSJohannes Berg  * @sta_flags_set: station flags values
1187819bf593SJohannes Berg  *	(bitmask of BIT(%NL80211_STA_FLAG_...))
11885727ef1bSJohannes Berg  * @listen_interval: listen interval or -1 for no change
11895727ef1bSJohannes Berg  * @aid: AID or zero for no change
119014f34e36SGurumoorthi Gnanasambandhan  * @vlan_id: VLAN ID for station (if nonzero)
11917d27a0baSMasashi Honma  * @peer_aid: mesh peer AID or zero for no change
1192abe37c4bSJohannes Berg  * @plink_action: plink action to take
11939c3990aaSJavier Cardona  * @plink_state: set the peer link state for a station
1194abe37c4bSJohannes Berg  * @ht_capa: HT capabilities of station
1195f461be3eSMahesh Palivela  * @vht_capa: VHT capabilities of station
1196910868dbSEliad Peller  * @uapsd_queues: bitmap of queues configured for uapsd. same format
1197910868dbSEliad Peller  *	as the AC bitmap in the QoS info field
1198910868dbSEliad Peller  * @max_sp: max Service Period. same format as the MAX_SP in the
1199910868dbSEliad Peller  *	QoS info field (but already shifted down)
1200c26887d2SJohannes Berg  * @sta_modify_mask: bitmap indicating which parameters changed
1201c26887d2SJohannes Berg  *	(for those that don't have a natural "no change" value),
1202c26887d2SJohannes Berg  *	see &enum station_parameters_apply_mask
12033b1c5a53SMarco Porsch  * @local_pm: local link-specific mesh power save mode (no change when set
12043b1c5a53SMarco Porsch  *	to unknown)
12059d62a986SJouni Malinen  * @capability: station capability
12069d62a986SJouni Malinen  * @ext_capab: extended capabilities of the station
12079d62a986SJouni Malinen  * @ext_capab_len: number of extended capabilities
1208c01fc9adSSunil Dutt  * @supported_channels: supported channels in IEEE 802.11 format
1209c01fc9adSSunil Dutt  * @supported_channels_len: number of supported channels
1210c01fc9adSSunil Dutt  * @supported_oper_classes: supported oper classes in IEEE 802.11 format
1211c01fc9adSSunil Dutt  * @supported_oper_classes_len: number of supported operating classes
121260f4a7b1SMarek Kwaczynski  * @opmode_notif: operating mode field from Operating Mode Notification
121360f4a7b1SMarek Kwaczynski  * @opmode_notif_used: information if operating mode field is used
121417b94247SAyala Beker  * @support_p2p_ps: information if station supports P2P PS mechanism
1215c4cbaf79SLuca Coelho  * @he_capa: HE capabilities of station
1216c4cbaf79SLuca Coelho  * @he_capa_len: the length of the HE capabilities
121736647055SToke Høiland-Jørgensen  * @airtime_weight: airtime scheduler weight for this station
12185727ef1bSJohannes Berg  */
12195727ef1bSJohannes Berg struct station_parameters {
12202c1aabf3SJohannes Berg 	const u8 *supported_rates;
12215727ef1bSJohannes Berg 	struct net_device *vlan;
1222eccb8e8fSJohannes Berg 	u32 sta_flags_mask, sta_flags_set;
12233b9ce80cSJohannes Berg 	u32 sta_modify_mask;
12245727ef1bSJohannes Berg 	int listen_interval;
12255727ef1bSJohannes Berg 	u16 aid;
122614f34e36SGurumoorthi Gnanasambandhan 	u16 vlan_id;
12277d27a0baSMasashi Honma 	u16 peer_aid;
12285727ef1bSJohannes Berg 	u8 supported_rates_len;
12292ec600d6SLuis Carlos Cobo 	u8 plink_action;
12309c3990aaSJavier Cardona 	u8 plink_state;
12312c1aabf3SJohannes Berg 	const struct ieee80211_ht_cap *ht_capa;
12322c1aabf3SJohannes Berg 	const struct ieee80211_vht_cap *vht_capa;
1233c75786c9SEliad Peller 	u8 uapsd_queues;
1234c75786c9SEliad Peller 	u8 max_sp;
12353b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode local_pm;
12369d62a986SJouni Malinen 	u16 capability;
12372c1aabf3SJohannes Berg 	const u8 *ext_capab;
12389d62a986SJouni Malinen 	u8 ext_capab_len;
1239c01fc9adSSunil Dutt 	const u8 *supported_channels;
1240c01fc9adSSunil Dutt 	u8 supported_channels_len;
1241c01fc9adSSunil Dutt 	const u8 *supported_oper_classes;
1242c01fc9adSSunil Dutt 	u8 supported_oper_classes_len;
124360f4a7b1SMarek Kwaczynski 	u8 opmode_notif;
124460f4a7b1SMarek Kwaczynski 	bool opmode_notif_used;
124517b94247SAyala Beker 	int support_p2p_ps;
1246c4cbaf79SLuca Coelho 	const struct ieee80211_he_cap_elem *he_capa;
1247c4cbaf79SLuca Coelho 	u8 he_capa_len;
124836647055SToke Høiland-Jørgensen 	u16 airtime_weight;
1249e96d1cd2SAshok Raj Nagarajan 	struct sta_txpwr txpwr;
12505727ef1bSJohannes Berg };
12515727ef1bSJohannes Berg 
1252fd5b74dcSJohannes Berg /**
125389c771e5SJouni Malinen  * struct station_del_parameters - station deletion parameters
125489c771e5SJouni Malinen  *
125589c771e5SJouni Malinen  * Used to delete a station entry (or all stations).
125689c771e5SJouni Malinen  *
125789c771e5SJouni Malinen  * @mac: MAC address of the station to remove or NULL to remove all stations
125898856866SJouni Malinen  * @subtype: Management frame subtype to use for indicating removal
125998856866SJouni Malinen  *	(10 = Disassociation, 12 = Deauthentication)
126098856866SJouni Malinen  * @reason_code: Reason code for the Disassociation/Deauthentication frame
126189c771e5SJouni Malinen  */
126289c771e5SJouni Malinen struct station_del_parameters {
126389c771e5SJouni Malinen 	const u8 *mac;
126498856866SJouni Malinen 	u8 subtype;
126598856866SJouni Malinen 	u16 reason_code;
126689c771e5SJouni Malinen };
126789c771e5SJouni Malinen 
126889c771e5SJouni Malinen /**
126977ee7c89SJohannes Berg  * enum cfg80211_station_type - the type of station being modified
127077ee7c89SJohannes Berg  * @CFG80211_STA_AP_CLIENT: client of an AP interface
127147edb11bSAyala Beker  * @CFG80211_STA_AP_CLIENT_UNASSOC: client of an AP interface that is still
127247edb11bSAyala Beker  *	unassociated (update properties for this type of client is permitted)
127377ee7c89SJohannes Berg  * @CFG80211_STA_AP_MLME_CLIENT: client of an AP interface that has
127477ee7c89SJohannes Berg  *	the AP MLME in the device
127577ee7c89SJohannes Berg  * @CFG80211_STA_AP_STA: AP station on managed interface
127677ee7c89SJohannes Berg  * @CFG80211_STA_IBSS: IBSS station
127777ee7c89SJohannes Berg  * @CFG80211_STA_TDLS_PEER_SETUP: TDLS peer on managed interface (dummy entry
127877ee7c89SJohannes Berg  *	while TDLS setup is in progress, it moves out of this state when
127977ee7c89SJohannes Berg  *	being marked authorized; use this only if TDLS with external setup is
128077ee7c89SJohannes Berg  *	supported/used)
128177ee7c89SJohannes Berg  * @CFG80211_STA_TDLS_PEER_ACTIVE: TDLS peer on managed interface (active
128277ee7c89SJohannes Berg  *	entry that is operating, has been marked authorized by userspace)
1283eef941e6SThomas Pedersen  * @CFG80211_STA_MESH_PEER_KERNEL: peer on mesh interface (kernel managed)
1284eef941e6SThomas Pedersen  * @CFG80211_STA_MESH_PEER_USER: peer on mesh interface (user managed)
128577ee7c89SJohannes Berg  */
128677ee7c89SJohannes Berg enum cfg80211_station_type {
128777ee7c89SJohannes Berg 	CFG80211_STA_AP_CLIENT,
128847edb11bSAyala Beker 	CFG80211_STA_AP_CLIENT_UNASSOC,
128977ee7c89SJohannes Berg 	CFG80211_STA_AP_MLME_CLIENT,
129077ee7c89SJohannes Berg 	CFG80211_STA_AP_STA,
129177ee7c89SJohannes Berg 	CFG80211_STA_IBSS,
129277ee7c89SJohannes Berg 	CFG80211_STA_TDLS_PEER_SETUP,
129377ee7c89SJohannes Berg 	CFG80211_STA_TDLS_PEER_ACTIVE,
1294eef941e6SThomas Pedersen 	CFG80211_STA_MESH_PEER_KERNEL,
1295eef941e6SThomas Pedersen 	CFG80211_STA_MESH_PEER_USER,
129677ee7c89SJohannes Berg };
129777ee7c89SJohannes Berg 
129877ee7c89SJohannes Berg /**
129977ee7c89SJohannes Berg  * cfg80211_check_station_change - validate parameter changes
130077ee7c89SJohannes Berg  * @wiphy: the wiphy this operates on
130177ee7c89SJohannes Berg  * @params: the new parameters for a station
130277ee7c89SJohannes Berg  * @statype: the type of station being modified
130377ee7c89SJohannes Berg  *
130477ee7c89SJohannes Berg  * Utility function for the @change_station driver method. Call this function
130577ee7c89SJohannes Berg  * with the appropriate station type looking up the station (and checking that
130677ee7c89SJohannes Berg  * it exists). It will verify whether the station change is acceptable, and if
130777ee7c89SJohannes Berg  * not will return an error code. Note that it may modify the parameters for
130877ee7c89SJohannes Berg  * backward compatibility reasons, so don't use them before calling this.
130977ee7c89SJohannes Berg  */
131077ee7c89SJohannes Berg int cfg80211_check_station_change(struct wiphy *wiphy,
131177ee7c89SJohannes Berg 				  struct station_parameters *params,
131277ee7c89SJohannes Berg 				  enum cfg80211_station_type statype);
131377ee7c89SJohannes Berg 
131477ee7c89SJohannes Berg /**
1315420e7fabSHenning Rogge  * enum station_info_rate_flags - bitrate info flags
1316420e7fabSHenning Rogge  *
1317420e7fabSHenning Rogge  * Used by the driver to indicate the specific rate transmission
1318420e7fabSHenning Rogge  * type for 802.11n transmissions.
1319420e7fabSHenning Rogge  *
1320db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_MCS: mcs field filled with HT MCS
1321db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_VHT_MCS: mcs field filled with VHT MCS
1322420e7fabSHenning Rogge  * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval
13232a38075cSAlexei Avshalom Lazar  * @RATE_INFO_FLAGS_DMG: 60GHz MCS
1324c4cbaf79SLuca Coelho  * @RATE_INFO_FLAGS_HE_MCS: HE MCS information
13252a38075cSAlexei Avshalom Lazar  * @RATE_INFO_FLAGS_EDMG: 60GHz MCS in EDMG mode
1326420e7fabSHenning Rogge  */
1327420e7fabSHenning Rogge enum rate_info_flags {
1328db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_MCS			= BIT(0),
1329db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_VHT_MCS			= BIT(1),
1330b51f3beeSJohannes Berg 	RATE_INFO_FLAGS_SHORT_GI		= BIT(2),
13312a38075cSAlexei Avshalom Lazar 	RATE_INFO_FLAGS_DMG			= BIT(3),
1332c4cbaf79SLuca Coelho 	RATE_INFO_FLAGS_HE_MCS			= BIT(4),
13332a38075cSAlexei Avshalom Lazar 	RATE_INFO_FLAGS_EDMG			= BIT(5),
1334b51f3beeSJohannes Berg };
1335b51f3beeSJohannes Berg 
1336b51f3beeSJohannes Berg /**
1337b51f3beeSJohannes Berg  * enum rate_info_bw - rate bandwidth information
1338b51f3beeSJohannes Berg  *
1339b51f3beeSJohannes Berg  * Used by the driver to indicate the rate bandwidth.
1340b51f3beeSJohannes Berg  *
1341b51f3beeSJohannes Berg  * @RATE_INFO_BW_5: 5 MHz bandwidth
1342b51f3beeSJohannes Berg  * @RATE_INFO_BW_10: 10 MHz bandwidth
1343b51f3beeSJohannes Berg  * @RATE_INFO_BW_20: 20 MHz bandwidth
1344b51f3beeSJohannes Berg  * @RATE_INFO_BW_40: 40 MHz bandwidth
1345b51f3beeSJohannes Berg  * @RATE_INFO_BW_80: 80 MHz bandwidth
1346b51f3beeSJohannes Berg  * @RATE_INFO_BW_160: 160 MHz bandwidth
1347c4cbaf79SLuca Coelho  * @RATE_INFO_BW_HE_RU: bandwidth determined by HE RU allocation
1348b51f3beeSJohannes Berg  */
1349b51f3beeSJohannes Berg enum rate_info_bw {
1350842be75cSJohannes Berg 	RATE_INFO_BW_20 = 0,
1351b51f3beeSJohannes Berg 	RATE_INFO_BW_5,
1352b51f3beeSJohannes Berg 	RATE_INFO_BW_10,
1353b51f3beeSJohannes Berg 	RATE_INFO_BW_40,
1354b51f3beeSJohannes Berg 	RATE_INFO_BW_80,
1355b51f3beeSJohannes Berg 	RATE_INFO_BW_160,
1356c4cbaf79SLuca Coelho 	RATE_INFO_BW_HE_RU,
1357420e7fabSHenning Rogge };
1358420e7fabSHenning Rogge 
1359420e7fabSHenning Rogge /**
1360420e7fabSHenning Rogge  * struct rate_info - bitrate information
1361420e7fabSHenning Rogge  *
1362420e7fabSHenning Rogge  * Information about a receiving or transmitting bitrate
1363420e7fabSHenning Rogge  *
1364420e7fabSHenning Rogge  * @flags: bitflag of flags from &enum rate_info_flags
1365c4cbaf79SLuca Coelho  * @mcs: mcs index if struct describes an HT/VHT/HE rate
1366420e7fabSHenning Rogge  * @legacy: bitrate in 100kbit/s for 802.11abg
1367c4cbaf79SLuca Coelho  * @nss: number of streams (VHT & HE only)
1368b51f3beeSJohannes Berg  * @bw: bandwidth (from &enum rate_info_bw)
1369c4cbaf79SLuca Coelho  * @he_gi: HE guard interval (from &enum nl80211_he_gi)
1370c4cbaf79SLuca Coelho  * @he_dcm: HE DCM value
1371c4cbaf79SLuca Coelho  * @he_ru_alloc: HE RU allocation (from &enum nl80211_he_ru_alloc,
1372c4cbaf79SLuca Coelho  *	only valid if bw is %RATE_INFO_BW_HE_RU)
13732a38075cSAlexei Avshalom Lazar  * @n_bonded_ch: In case of EDMG the number of bonded channels (1-4)
1374420e7fabSHenning Rogge  */
1375420e7fabSHenning Rogge struct rate_info {
1376420e7fabSHenning Rogge 	u8 flags;
1377420e7fabSHenning Rogge 	u8 mcs;
1378420e7fabSHenning Rogge 	u16 legacy;
1379db9c64cfSJohannes Berg 	u8 nss;
1380b51f3beeSJohannes Berg 	u8 bw;
1381c4cbaf79SLuca Coelho 	u8 he_gi;
1382c4cbaf79SLuca Coelho 	u8 he_dcm;
1383c4cbaf79SLuca Coelho 	u8 he_ru_alloc;
13842a38075cSAlexei Avshalom Lazar 	u8 n_bonded_ch;
1385fd5b74dcSJohannes Berg };
1386fd5b74dcSJohannes Berg 
1387fd5b74dcSJohannes Berg /**
1388f4263c98SPaul Stewart  * enum station_info_rate_flags - bitrate info flags
1389f4263c98SPaul Stewart  *
1390f4263c98SPaul Stewart  * Used by the driver to indicate the specific rate transmission
1391f4263c98SPaul Stewart  * type for 802.11n transmissions.
1392f4263c98SPaul Stewart  *
1393f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_CTS_PROT: whether CTS protection is enabled
1394f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_SHORT_PREAMBLE: whether short preamble is enabled
1395f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_SHORT_SLOT_TIME: whether short slot time is enabled
1396f4263c98SPaul Stewart  */
1397f4263c98SPaul Stewart enum bss_param_flags {
1398f4263c98SPaul Stewart 	BSS_PARAM_FLAGS_CTS_PROT	= 1<<0,
1399f4263c98SPaul Stewart 	BSS_PARAM_FLAGS_SHORT_PREAMBLE	= 1<<1,
1400f4263c98SPaul Stewart 	BSS_PARAM_FLAGS_SHORT_SLOT_TIME	= 1<<2,
1401f4263c98SPaul Stewart };
1402f4263c98SPaul Stewart 
1403f4263c98SPaul Stewart /**
1404f4263c98SPaul Stewart  * struct sta_bss_parameters - BSS parameters for the attached station
1405f4263c98SPaul Stewart  *
1406f4263c98SPaul Stewart  * Information about the currently associated BSS
1407f4263c98SPaul Stewart  *
1408f4263c98SPaul Stewart  * @flags: bitflag of flags from &enum bss_param_flags
1409f4263c98SPaul Stewart  * @dtim_period: DTIM period for the BSS
1410f4263c98SPaul Stewart  * @beacon_interval: beacon interval
1411f4263c98SPaul Stewart  */
1412f4263c98SPaul Stewart struct sta_bss_parameters {
1413f4263c98SPaul Stewart 	u8 flags;
1414f4263c98SPaul Stewart 	u8 dtim_period;
1415f4263c98SPaul Stewart 	u16 beacon_interval;
1416f4263c98SPaul Stewart };
1417f4263c98SPaul Stewart 
14186de39808SJohannes Berg /**
141952539ca8SToke Høiland-Jørgensen  * struct cfg80211_txq_stats - TXQ statistics for this TID
142052539ca8SToke Høiland-Jørgensen  * @filled: bitmap of flags using the bits of &enum nl80211_txq_stats to
142152539ca8SToke Høiland-Jørgensen  *	indicate the relevant values in this struct are filled
142252539ca8SToke Høiland-Jørgensen  * @backlog_bytes: total number of bytes currently backlogged
142352539ca8SToke Høiland-Jørgensen  * @backlog_packets: total number of packets currently backlogged
142452539ca8SToke Høiland-Jørgensen  * @flows: number of new flows seen
142552539ca8SToke Høiland-Jørgensen  * @drops: total number of packets dropped
142652539ca8SToke Høiland-Jørgensen  * @ecn_marks: total number of packets marked with ECN CE
142752539ca8SToke Høiland-Jørgensen  * @overlimit: number of drops due to queue space overflow
142852539ca8SToke Høiland-Jørgensen  * @overmemory: number of drops due to memory limit overflow
142952539ca8SToke Høiland-Jørgensen  * @collisions: number of hash collisions
143052539ca8SToke Høiland-Jørgensen  * @tx_bytes: total number of bytes dequeued
143152539ca8SToke Høiland-Jørgensen  * @tx_packets: total number of packets dequeued
143252539ca8SToke Høiland-Jørgensen  * @max_flows: maximum number of flows supported
143352539ca8SToke Høiland-Jørgensen  */
143452539ca8SToke Høiland-Jørgensen struct cfg80211_txq_stats {
143552539ca8SToke Høiland-Jørgensen 	u32 filled;
143652539ca8SToke Høiland-Jørgensen 	u32 backlog_bytes;
143752539ca8SToke Høiland-Jørgensen 	u32 backlog_packets;
143852539ca8SToke Høiland-Jørgensen 	u32 flows;
143952539ca8SToke Høiland-Jørgensen 	u32 drops;
144052539ca8SToke Høiland-Jørgensen 	u32 ecn_marks;
144152539ca8SToke Høiland-Jørgensen 	u32 overlimit;
144252539ca8SToke Høiland-Jørgensen 	u32 overmemory;
144352539ca8SToke Høiland-Jørgensen 	u32 collisions;
144452539ca8SToke Høiland-Jørgensen 	u32 tx_bytes;
144552539ca8SToke Høiland-Jørgensen 	u32 tx_packets;
144652539ca8SToke Høiland-Jørgensen 	u32 max_flows;
144752539ca8SToke Høiland-Jørgensen };
144852539ca8SToke Høiland-Jørgensen 
144952539ca8SToke Høiland-Jørgensen /**
14506de39808SJohannes Berg  * struct cfg80211_tid_stats - per-TID statistics
14516de39808SJohannes Berg  * @filled: bitmap of flags using the bits of &enum nl80211_tid_stats to
14526de39808SJohannes Berg  *	indicate the relevant values in this struct are filled
14536de39808SJohannes Berg  * @rx_msdu: number of received MSDUs
14546de39808SJohannes Berg  * @tx_msdu: number of (attempted) transmitted MSDUs
14556de39808SJohannes Berg  * @tx_msdu_retries: number of retries (not counting the first) for
14566de39808SJohannes Berg  *	transmitted MSDUs
14576de39808SJohannes Berg  * @tx_msdu_failed: number of failed transmitted MSDUs
145852539ca8SToke Høiland-Jørgensen  * @txq_stats: TXQ statistics
14596de39808SJohannes Berg  */
14606de39808SJohannes Berg struct cfg80211_tid_stats {
14616de39808SJohannes Berg 	u32 filled;
14626de39808SJohannes Berg 	u64 rx_msdu;
14636de39808SJohannes Berg 	u64 tx_msdu;
14646de39808SJohannes Berg 	u64 tx_msdu_retries;
14656de39808SJohannes Berg 	u64 tx_msdu_failed;
146652539ca8SToke Høiland-Jørgensen 	struct cfg80211_txq_stats txq_stats;
14676de39808SJohannes Berg };
14686de39808SJohannes Berg 
1469119363c7SFelix Fietkau #define IEEE80211_MAX_CHAINS	4
1470119363c7SFelix Fietkau 
1471f4263c98SPaul Stewart /**
14722ec600d6SLuis Carlos Cobo  * struct station_info - station information
1473fd5b74dcSJohannes Berg  *
14742ec600d6SLuis Carlos Cobo  * Station information filled by driver for get_station() and dump_station.
1475fd5b74dcSJohannes Berg  *
1476319090bfSJohannes Berg  * @filled: bitflag of flags using the bits of &enum nl80211_sta_info to
1477319090bfSJohannes Berg  *	indicate the relevant values in this struct for them
1478ebe27c91SMohammed Shafi Shajakhan  * @connected_time: time(in secs) since a station is last connected
1479fd5b74dcSJohannes Berg  * @inactive_time: time since last station activity (tx/rx) in milliseconds
14806c7a0033SBen Greear  * @assoc_at: bootime (ns) of the last association
14818d791361SJohannes Berg  * @rx_bytes: bytes (size of MPDUs) received from this station
14828d791361SJohannes Berg  * @tx_bytes: bytes (size of MPDUs) transmitted to this station
14832ec600d6SLuis Carlos Cobo  * @llid: mesh local link id
14842ec600d6SLuis Carlos Cobo  * @plid: mesh peer link id
14852ec600d6SLuis Carlos Cobo  * @plink_state: mesh peer link state
148673c3df3bSJohannes Berg  * @signal: The signal strength, type depends on the wiphy's signal_type.
148773c3df3bSJohannes Berg  *	For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
148873c3df3bSJohannes Berg  * @signal_avg: Average signal strength, type depends on the wiphy's signal_type.
148973c3df3bSJohannes Berg  *	For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
1490119363c7SFelix Fietkau  * @chains: bitmask for filled values in @chain_signal, @chain_signal_avg
1491119363c7SFelix Fietkau  * @chain_signal: per-chain signal strength of last received packet in dBm
1492119363c7SFelix Fietkau  * @chain_signal_avg: per-chain signal strength average in dBm
1493858022aaSRandy Dunlap  * @txrate: current unicast bitrate from this station
1494858022aaSRandy Dunlap  * @rxrate: current unicast bitrate to this station
14958d791361SJohannes Berg  * @rx_packets: packets (MSDUs & MMPDUs) received from this station
14968d791361SJohannes Berg  * @tx_packets: packets (MSDUs & MMPDUs) transmitted to this station
14978d791361SJohannes Berg  * @tx_retries: cumulative retry counts (MPDUs)
14988d791361SJohannes Berg  * @tx_failed: number of failed transmissions (MPDUs) (retries exceeded, no ACK)
14995a5c731aSBen Greear  * @rx_dropped_misc:  Dropped for un-specified reason.
15001ba01458SRandy Dunlap  * @bss_param: current BSS parameters
1501f5ea9120SJohannes Berg  * @generation: generation number for nl80211 dumps.
1502f5ea9120SJohannes Berg  *	This number should increase every time the list of stations
1503f5ea9120SJohannes Berg  *	changes, i.e. when a station is added or removed, so that
1504f5ea9120SJohannes Berg  *	userspace can tell whether it got a consistent snapshot.
150550d3dfb7SJouni Malinen  * @assoc_req_ies: IEs from (Re)Association Request.
150650d3dfb7SJouni Malinen  *	This is used only when in AP mode with drivers that do not use
150750d3dfb7SJouni Malinen  *	user space MLME/SME implementation. The information is provided for
150850d3dfb7SJouni Malinen  *	the cfg80211_new_sta() calls to notify user space of the IEs.
150950d3dfb7SJouni Malinen  * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets.
1510c26887d2SJohannes Berg  * @sta_flags: station flags mask & values
1511a85e1d55SPaul Stewart  * @beacon_loss_count: Number of times beacon loss event has triggered.
1512d299a1f2SJavier Cardona  * @t_offset: Time offset of the station relative to this host.
15133b1c5a53SMarco Porsch  * @local_pm: local mesh STA power save mode
15143b1c5a53SMarco Porsch  * @peer_pm: peer mesh STA power save mode
15153b1c5a53SMarco Porsch  * @nonpeer_pm: non-peer mesh STA power save mode
1516867d849fSAntonio Quartulli  * @expected_throughput: expected throughput in kbps (including 802.11 headers)
1517867d849fSAntonio Quartulli  *	towards this station.
1518a76b1942SJohannes Berg  * @rx_beacon: number of beacons received from this peer
1519a76b1942SJohannes Berg  * @rx_beacon_signal_avg: signal strength average (in dBm) for beacons received
1520a76b1942SJohannes Berg  *	from this peer
1521dbdaee7aSBob Copeland  * @connected_to_gate: true if mesh STA has a path to mesh gate
1522739960f1SMohammed Shafi Shajakhan  * @rx_duration: aggregate PPDU duration(usecs) for all the frames from a peer
152336647055SToke Høiland-Jørgensen  * @tx_duration: aggregate PPDU duration(usecs) for all the frames to a peer
152436647055SToke Høiland-Jørgensen  * @airtime_weight: current airtime scheduling weight
15256de39808SJohannes Berg  * @pertid: per-TID statistics, see &struct cfg80211_tid_stats, using the last
15266de39808SJohannes Berg  *	(IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs.
15278689c051SArend van Spriel  *	Note that this doesn't use the @filled bit, but is used if non-NULL.
1528c4b50cd3SVenkateswara Naralasetty  * @ack_signal: signal strength (in dBm) of the last ACK frame.
152981d5439dSBalaji Pothunoori  * @avg_ack_signal: average rssi value of ack packet for the no of msdu's has
153081d5439dSBalaji Pothunoori  *	been sent.
15310d4e14a3SAnkita Bajaj  * @rx_mpdu_count: number of MPDUs received from this station
15320d4e14a3SAnkita Bajaj  * @fcs_err_count: number of packets (MPDUs) received from this station with
15330d4e14a3SAnkita Bajaj  *	an FCS error. This counter should be incremented only when TA of the
15340d4e14a3SAnkita Bajaj  *	received packet with an FCS error matches the peer MAC address.
1535ab60633cSNarayanraddi Masti  * @airtime_link_metric: mesh airtime link metric.
1536fd5b74dcSJohannes Berg  */
15372ec600d6SLuis Carlos Cobo struct station_info {
1538739960f1SMohammed Shafi Shajakhan 	u64 filled;
1539ebe27c91SMohammed Shafi Shajakhan 	u32 connected_time;
1540fd5b74dcSJohannes Berg 	u32 inactive_time;
15416c7a0033SBen Greear 	u64 assoc_at;
154242745e03SVladimir Kondratiev 	u64 rx_bytes;
154342745e03SVladimir Kondratiev 	u64 tx_bytes;
15442ec600d6SLuis Carlos Cobo 	u16 llid;
15452ec600d6SLuis Carlos Cobo 	u16 plid;
15462ec600d6SLuis Carlos Cobo 	u8 plink_state;
1547420e7fabSHenning Rogge 	s8 signal;
1548541a45a1SBruno Randolf 	s8 signal_avg;
1549119363c7SFelix Fietkau 
1550119363c7SFelix Fietkau 	u8 chains;
1551119363c7SFelix Fietkau 	s8 chain_signal[IEEE80211_MAX_CHAINS];
1552119363c7SFelix Fietkau 	s8 chain_signal_avg[IEEE80211_MAX_CHAINS];
1553119363c7SFelix Fietkau 
1554420e7fabSHenning Rogge 	struct rate_info txrate;
1555c8dcfd8aSFelix Fietkau 	struct rate_info rxrate;
155698c8a60aSJouni Malinen 	u32 rx_packets;
155798c8a60aSJouni Malinen 	u32 tx_packets;
1558b206b4efSBruno Randolf 	u32 tx_retries;
1559b206b4efSBruno Randolf 	u32 tx_failed;
15605a5c731aSBen Greear 	u32 rx_dropped_misc;
1561f4263c98SPaul Stewart 	struct sta_bss_parameters bss_param;
1562bb6e753eSHelmut Schaa 	struct nl80211_sta_flag_update sta_flags;
1563f5ea9120SJohannes Berg 
1564f5ea9120SJohannes Berg 	int generation;
156550d3dfb7SJouni Malinen 
156650d3dfb7SJouni Malinen 	const u8 *assoc_req_ies;
156750d3dfb7SJouni Malinen 	size_t assoc_req_ies_len;
1568f612cedfSJouni Malinen 
1569a85e1d55SPaul Stewart 	u32 beacon_loss_count;
1570d299a1f2SJavier Cardona 	s64 t_offset;
15713b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode local_pm;
15723b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode peer_pm;
15733b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode nonpeer_pm;
1574a85e1d55SPaul Stewart 
1575867d849fSAntonio Quartulli 	u32 expected_throughput;
1576a76b1942SJohannes Berg 
157736647055SToke Høiland-Jørgensen 	u64 tx_duration;
1578739960f1SMohammed Shafi Shajakhan 	u64 rx_duration;
157936647055SToke Høiland-Jørgensen 	u64 rx_beacon;
1580a76b1942SJohannes Berg 	u8 rx_beacon_signal_avg;
1581dbdaee7aSBob Copeland 	u8 connected_to_gate;
1582dbdaee7aSBob Copeland 
15838689c051SArend van Spriel 	struct cfg80211_tid_stats *pertid;
1584c4b50cd3SVenkateswara Naralasetty 	s8 ack_signal;
158581d5439dSBalaji Pothunoori 	s8 avg_ack_signal;
15860d4e14a3SAnkita Bajaj 
158736647055SToke Høiland-Jørgensen 	u16 airtime_weight;
158836647055SToke Høiland-Jørgensen 
15890d4e14a3SAnkita Bajaj 	u32 rx_mpdu_count;
15900d4e14a3SAnkita Bajaj 	u32 fcs_err_count;
1591ab60633cSNarayanraddi Masti 
1592ab60633cSNarayanraddi Masti 	u32 airtime_link_metric;
1593fd5b74dcSJohannes Berg };
1594fd5b74dcSJohannes Berg 
159561aaa0e8SLinus Lüssing #if IS_ENABLED(CONFIG_CFG80211)
159666f7ac50SMichael Wu /**
15977406353dSAntonio Quartulli  * cfg80211_get_station - retrieve information about a given station
15987406353dSAntonio Quartulli  * @dev: the device where the station is supposed to be connected to
15997406353dSAntonio Quartulli  * @mac_addr: the mac address of the station of interest
16007406353dSAntonio Quartulli  * @sinfo: pointer to the structure to fill with the information
16017406353dSAntonio Quartulli  *
16027406353dSAntonio Quartulli  * Returns 0 on success and sinfo is filled with the available information
16037406353dSAntonio Quartulli  * otherwise returns a negative error code and the content of sinfo has to be
16047406353dSAntonio Quartulli  * considered undefined.
16057406353dSAntonio Quartulli  */
16067406353dSAntonio Quartulli int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr,
16077406353dSAntonio Quartulli 			 struct station_info *sinfo);
160861aaa0e8SLinus Lüssing #else
160961aaa0e8SLinus Lüssing static inline int cfg80211_get_station(struct net_device *dev,
161061aaa0e8SLinus Lüssing 				       const u8 *mac_addr,
161161aaa0e8SLinus Lüssing 				       struct station_info *sinfo)
161261aaa0e8SLinus Lüssing {
161361aaa0e8SLinus Lüssing 	return -ENOENT;
161461aaa0e8SLinus Lüssing }
161561aaa0e8SLinus Lüssing #endif
16167406353dSAntonio Quartulli 
16177406353dSAntonio Quartulli /**
161866f7ac50SMichael Wu  * enum monitor_flags - monitor flags
161966f7ac50SMichael Wu  *
162066f7ac50SMichael Wu  * Monitor interface configuration flags. Note that these must be the bits
162166f7ac50SMichael Wu  * according to the nl80211 flags.
162266f7ac50SMichael Wu  *
1623818a986eSJohannes Berg  * @MONITOR_FLAG_CHANGED: set if the flags were changed
162466f7ac50SMichael Wu  * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS
162566f7ac50SMichael Wu  * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP
162666f7ac50SMichael Wu  * @MONITOR_FLAG_CONTROL: pass control frames
162766f7ac50SMichael Wu  * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering
162866f7ac50SMichael Wu  * @MONITOR_FLAG_COOK_FRAMES: report frames after processing
1629e057d3c3SFelix Fietkau  * @MONITOR_FLAG_ACTIVE: active monitor, ACKs frames on its MAC address
163066f7ac50SMichael Wu  */
163166f7ac50SMichael Wu enum monitor_flags {
1632818a986eSJohannes Berg 	MONITOR_FLAG_CHANGED		= 1<<__NL80211_MNTR_FLAG_INVALID,
163366f7ac50SMichael Wu 	MONITOR_FLAG_FCSFAIL		= 1<<NL80211_MNTR_FLAG_FCSFAIL,
163466f7ac50SMichael Wu 	MONITOR_FLAG_PLCPFAIL		= 1<<NL80211_MNTR_FLAG_PLCPFAIL,
163566f7ac50SMichael Wu 	MONITOR_FLAG_CONTROL		= 1<<NL80211_MNTR_FLAG_CONTROL,
163666f7ac50SMichael Wu 	MONITOR_FLAG_OTHER_BSS		= 1<<NL80211_MNTR_FLAG_OTHER_BSS,
163766f7ac50SMichael Wu 	MONITOR_FLAG_COOK_FRAMES	= 1<<NL80211_MNTR_FLAG_COOK_FRAMES,
1638e057d3c3SFelix Fietkau 	MONITOR_FLAG_ACTIVE		= 1<<NL80211_MNTR_FLAG_ACTIVE,
163966f7ac50SMichael Wu };
164066f7ac50SMichael Wu 
16412ec600d6SLuis Carlos Cobo /**
16422ec600d6SLuis Carlos Cobo  * enum mpath_info_flags -  mesh path information flags
16432ec600d6SLuis Carlos Cobo  *
16442ec600d6SLuis Carlos Cobo  * Used by the driver to indicate which info in &struct mpath_info it has filled
16452ec600d6SLuis Carlos Cobo  * in during get_station() or dump_station().
16462ec600d6SLuis Carlos Cobo  *
1647abe37c4bSJohannes Berg  * @MPATH_INFO_FRAME_QLEN: @frame_qlen filled
1648abe37c4bSJohannes Berg  * @MPATH_INFO_SN: @sn filled
1649abe37c4bSJohannes Berg  * @MPATH_INFO_METRIC: @metric filled
1650abe37c4bSJohannes Berg  * @MPATH_INFO_EXPTIME: @exptime filled
1651abe37c4bSJohannes Berg  * @MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled
1652abe37c4bSJohannes Berg  * @MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled
1653abe37c4bSJohannes Berg  * @MPATH_INFO_FLAGS: @flags filled
1654cc241636SJulan Hsu  * @MPATH_INFO_HOP_COUNT: @hop_count filled
16559874b71fSJohannes Berg  * @MPATH_INFO_PATH_CHANGE: @path_change_count filled
16562ec600d6SLuis Carlos Cobo  */
16572ec600d6SLuis Carlos Cobo enum mpath_info_flags {
16582ec600d6SLuis Carlos Cobo 	MPATH_INFO_FRAME_QLEN		= BIT(0),
1659d19b3bf6SRui Paulo 	MPATH_INFO_SN			= BIT(1),
16602ec600d6SLuis Carlos Cobo 	MPATH_INFO_METRIC		= BIT(2),
16612ec600d6SLuis Carlos Cobo 	MPATH_INFO_EXPTIME		= BIT(3),
16622ec600d6SLuis Carlos Cobo 	MPATH_INFO_DISCOVERY_TIMEOUT	= BIT(4),
16632ec600d6SLuis Carlos Cobo 	MPATH_INFO_DISCOVERY_RETRIES	= BIT(5),
16642ec600d6SLuis Carlos Cobo 	MPATH_INFO_FLAGS		= BIT(6),
1665540bbcb9SJulan Hsu 	MPATH_INFO_HOP_COUNT		= BIT(7),
1666540bbcb9SJulan Hsu 	MPATH_INFO_PATH_CHANGE		= BIT(8),
16672ec600d6SLuis Carlos Cobo };
16682ec600d6SLuis Carlos Cobo 
16692ec600d6SLuis Carlos Cobo /**
16702ec600d6SLuis Carlos Cobo  * struct mpath_info - mesh path information
16712ec600d6SLuis Carlos Cobo  *
16722ec600d6SLuis Carlos Cobo  * Mesh path information filled by driver for get_mpath() and dump_mpath().
16732ec600d6SLuis Carlos Cobo  *
16742ec600d6SLuis Carlos Cobo  * @filled: bitfield of flags from &enum mpath_info_flags
16752ec600d6SLuis Carlos Cobo  * @frame_qlen: number of queued frames for this destination
1676d19b3bf6SRui Paulo  * @sn: target sequence number
16772ec600d6SLuis Carlos Cobo  * @metric: metric (cost) of this mesh path
16782ec600d6SLuis Carlos Cobo  * @exptime: expiration time for the mesh path from now, in msecs
16792ec600d6SLuis Carlos Cobo  * @flags: mesh path flags
16802ec600d6SLuis Carlos Cobo  * @discovery_timeout: total mesh path discovery timeout, in msecs
16812ec600d6SLuis Carlos Cobo  * @discovery_retries: mesh path discovery retries
1682f5ea9120SJohannes Berg  * @generation: generation number for nl80211 dumps.
1683f5ea9120SJohannes Berg  *	This number should increase every time the list of mesh paths
1684f5ea9120SJohannes Berg  *	changes, i.e. when a station is added or removed, so that
1685f5ea9120SJohannes Berg  *	userspace can tell whether it got a consistent snapshot.
1686cc241636SJulan Hsu  * @hop_count: hops to destination
1687540bbcb9SJulan Hsu  * @path_change_count: total number of path changes to destination
16882ec600d6SLuis Carlos Cobo  */
16892ec600d6SLuis Carlos Cobo struct mpath_info {
16902ec600d6SLuis Carlos Cobo 	u32 filled;
16912ec600d6SLuis Carlos Cobo 	u32 frame_qlen;
1692d19b3bf6SRui Paulo 	u32 sn;
16932ec600d6SLuis Carlos Cobo 	u32 metric;
16942ec600d6SLuis Carlos Cobo 	u32 exptime;
16952ec600d6SLuis Carlos Cobo 	u32 discovery_timeout;
16962ec600d6SLuis Carlos Cobo 	u8 discovery_retries;
16972ec600d6SLuis Carlos Cobo 	u8 flags;
1698cc241636SJulan Hsu 	u8 hop_count;
1699540bbcb9SJulan Hsu 	u32 path_change_count;
1700f5ea9120SJohannes Berg 
1701f5ea9120SJohannes Berg 	int generation;
17022ec600d6SLuis Carlos Cobo };
17032ec600d6SLuis Carlos Cobo 
17049f1ba906SJouni Malinen /**
17059f1ba906SJouni Malinen  * struct bss_parameters - BSS parameters
17069f1ba906SJouni Malinen  *
17079f1ba906SJouni Malinen  * Used to change BSS parameters (mainly for AP mode).
17089f1ba906SJouni Malinen  *
17099f1ba906SJouni Malinen  * @use_cts_prot: Whether to use CTS protection
17109f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
17119f1ba906SJouni Malinen  * @use_short_preamble: Whether the use of short preambles is allowed
17129f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
17139f1ba906SJouni Malinen  * @use_short_slot_time: Whether the use of short slot time is allowed
17149f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
171590c97a04SJouni Malinen  * @basic_rates: basic rates in IEEE 802.11 format
171690c97a04SJouni Malinen  *	(or NULL for no change)
171790c97a04SJouni Malinen  * @basic_rates_len: number of basic rates
1718fd8aaaf3SFelix Fietkau  * @ap_isolate: do not forward packets between connected stations
171950b12f59SHelmut Schaa  * @ht_opmode: HT Operation mode
172050b12f59SHelmut Schaa  *	(u16 = opmode, -1 = do not change)
172153cabad7SJohannes Berg  * @p2p_ctwindow: P2P CT Window (-1 = no change)
172253cabad7SJohannes Berg  * @p2p_opp_ps: P2P opportunistic PS (-1 = no change)
17239f1ba906SJouni Malinen  */
17249f1ba906SJouni Malinen struct bss_parameters {
17259f1ba906SJouni Malinen 	int use_cts_prot;
17269f1ba906SJouni Malinen 	int use_short_preamble;
17279f1ba906SJouni Malinen 	int use_short_slot_time;
1728c1e5f471SJohannes Berg 	const u8 *basic_rates;
172990c97a04SJouni Malinen 	u8 basic_rates_len;
1730fd8aaaf3SFelix Fietkau 	int ap_isolate;
173150b12f59SHelmut Schaa 	int ht_opmode;
173253cabad7SJohannes Berg 	s8 p2p_ctwindow, p2p_opp_ps;
17339f1ba906SJouni Malinen };
17342ec600d6SLuis Carlos Cobo 
17353ddd53f3SChun-Yeow Yeoh /**
173629cbe68cSJohannes Berg  * struct mesh_config - 802.11s mesh configuration
173729cbe68cSJohannes Berg  *
173829cbe68cSJohannes Berg  * These parameters can be changed while the mesh is active.
17393ddd53f3SChun-Yeow Yeoh  *
17403ddd53f3SChun-Yeow Yeoh  * @dot11MeshRetryTimeout: the initial retry timeout in millisecond units used
17413ddd53f3SChun-Yeow Yeoh  *	by the Mesh Peering Open message
17423ddd53f3SChun-Yeow Yeoh  * @dot11MeshConfirmTimeout: the initial retry timeout in millisecond units
17433ddd53f3SChun-Yeow Yeoh  *	used by the Mesh Peering Open message
17443ddd53f3SChun-Yeow Yeoh  * @dot11MeshHoldingTimeout: the confirm timeout in millisecond units used by
17453ddd53f3SChun-Yeow Yeoh  *	the mesh peering management to close a mesh peering
17463ddd53f3SChun-Yeow Yeoh  * @dot11MeshMaxPeerLinks: the maximum number of peer links allowed on this
17473ddd53f3SChun-Yeow Yeoh  *	mesh interface
17483ddd53f3SChun-Yeow Yeoh  * @dot11MeshMaxRetries: the maximum number of peer link open retries that can
17493ddd53f3SChun-Yeow Yeoh  *	be sent to establish a new peer link instance in a mesh
17503ddd53f3SChun-Yeow Yeoh  * @dot11MeshTTL: the value of TTL field set at a source mesh STA
17513ddd53f3SChun-Yeow Yeoh  * @element_ttl: the value of TTL field set at a mesh STA for path selection
17523ddd53f3SChun-Yeow Yeoh  *	elements
17533ddd53f3SChun-Yeow Yeoh  * @auto_open_plinks: whether we should automatically open peer links when we
17543ddd53f3SChun-Yeow Yeoh  *	detect compatible mesh peers
17553ddd53f3SChun-Yeow Yeoh  * @dot11MeshNbrOffsetMaxNeighbor: the maximum number of neighbors to
17563ddd53f3SChun-Yeow Yeoh  *	synchronize to for 11s default synchronization method
17573ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPmaxPREQretries: the number of action frames containing a PREQ
17583ddd53f3SChun-Yeow Yeoh  *	that an originator mesh STA can send to a particular path target
17593ddd53f3SChun-Yeow Yeoh  * @path_refresh_time: how frequently to refresh mesh paths in milliseconds
17603ddd53f3SChun-Yeow Yeoh  * @min_discovery_timeout: the minimum length of time to wait until giving up on
17613ddd53f3SChun-Yeow Yeoh  *	a path discovery in milliseconds
17623ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPactivePathTimeout: the time (in TUs) for which mesh STAs
17633ddd53f3SChun-Yeow Yeoh  *	receiving a PREQ shall consider the forwarding information from the
17643ddd53f3SChun-Yeow Yeoh  *	root to be valid. (TU = time unit)
17653ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPpreqMinInterval: the minimum interval of time (in TUs) during
17663ddd53f3SChun-Yeow Yeoh  *	which a mesh STA can send only one action frame containing a PREQ
17673ddd53f3SChun-Yeow Yeoh  *	element
17683ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPperrMinInterval: the minimum interval of time (in TUs) during
17693ddd53f3SChun-Yeow Yeoh  *	which a mesh STA can send only one Action frame containing a PERR
17703ddd53f3SChun-Yeow Yeoh  *	element
17713ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPnetDiameterTraversalTime: the interval of time (in TUs) that
17723ddd53f3SChun-Yeow Yeoh  *	it takes for an HWMP information element to propagate across the mesh
17733ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPRootMode: the configuration of a mesh STA as root mesh STA
17743ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPRannInterval: the interval of time (in TUs) between root
17753ddd53f3SChun-Yeow Yeoh  *	announcements are transmitted
17763ddd53f3SChun-Yeow Yeoh  * @dot11MeshGateAnnouncementProtocol: whether to advertise that this mesh
17773ddd53f3SChun-Yeow Yeoh  *	station has access to a broader network beyond the MBSS. (This is
17783ddd53f3SChun-Yeow Yeoh  *	missnamed in draft 12.0: dot11MeshGateAnnouncementProtocol set to true
17793ddd53f3SChun-Yeow Yeoh  *	only means that the station will announce others it's a mesh gate, but
17803ddd53f3SChun-Yeow Yeoh  *	not necessarily using the gate announcement protocol. Still keeping the
17813ddd53f3SChun-Yeow Yeoh  *	same nomenclature to be in sync with the spec)
17823ddd53f3SChun-Yeow Yeoh  * @dot11MeshForwarding: whether the Mesh STA is forwarding or non-forwarding
17833ddd53f3SChun-Yeow Yeoh  *	entity (default is TRUE - forwarding entity)
17843ddd53f3SChun-Yeow Yeoh  * @rssi_threshold: the threshold for average signal strength of candidate
17853ddd53f3SChun-Yeow Yeoh  *	station to establish a peer link
17863ddd53f3SChun-Yeow Yeoh  * @ht_opmode: mesh HT protection mode
1787ac1073a6SChun-Yeow Yeoh  *
1788ac1073a6SChun-Yeow Yeoh  * @dot11MeshHWMPactivePathToRootTimeout: The time (in TUs) for which mesh STAs
1789ac1073a6SChun-Yeow Yeoh  *	receiving a proactive PREQ shall consider the forwarding information to
1790ac1073a6SChun-Yeow Yeoh  *	the root mesh STA to be valid.
1791ac1073a6SChun-Yeow Yeoh  *
1792ac1073a6SChun-Yeow Yeoh  * @dot11MeshHWMProotInterval: The interval of time (in TUs) between proactive
1793ac1073a6SChun-Yeow Yeoh  *	PREQs are transmitted.
1794728b19e5SChun-Yeow Yeoh  * @dot11MeshHWMPconfirmationInterval: The minimum interval of time (in TUs)
1795728b19e5SChun-Yeow Yeoh  *	during which a mesh STA can send only one Action frame containing
1796728b19e5SChun-Yeow Yeoh  *	a PREQ element for root path confirmation.
17973b1c5a53SMarco Porsch  * @power_mode: The default mesh power save mode which will be the initial
17983b1c5a53SMarco Porsch  *	setting for new peer links.
17993b1c5a53SMarco Porsch  * @dot11MeshAwakeWindowDuration: The duration in TUs the STA will remain awake
18003b1c5a53SMarco Porsch  *	after transmitting its beacon.
18018e7c0538SColleen Twitty  * @plink_timeout: If no tx activity is seen from a STA we've established
18028e7c0538SColleen Twitty  *	peering with for longer than this time (in seconds), then remove it
18038e7c0538SColleen Twitty  *	from the STA's list of peers.  Default is 30 minutes.
180401d66fbdSBob Copeland  * @dot11MeshConnectedToMeshGate: if set to true, advertise that this STA is
180501d66fbdSBob Copeland  *      connected to a mesh gate in mesh formation info.  If false, the
180601d66fbdSBob Copeland  *      value in mesh formation is determined by the presence of root paths
180701d66fbdSBob Copeland  *      in the mesh path table
180829cbe68cSJohannes Berg  */
180993da9cc1Scolin@cozybit.com struct mesh_config {
181093da9cc1Scolin@cozybit.com 	u16 dot11MeshRetryTimeout;
181193da9cc1Scolin@cozybit.com 	u16 dot11MeshConfirmTimeout;
181293da9cc1Scolin@cozybit.com 	u16 dot11MeshHoldingTimeout;
181393da9cc1Scolin@cozybit.com 	u16 dot11MeshMaxPeerLinks;
181493da9cc1Scolin@cozybit.com 	u8 dot11MeshMaxRetries;
181593da9cc1Scolin@cozybit.com 	u8 dot11MeshTTL;
181645904f21SJavier Cardona 	u8 element_ttl;
181793da9cc1Scolin@cozybit.com 	bool auto_open_plinks;
1818d299a1f2SJavier Cardona 	u32 dot11MeshNbrOffsetMaxNeighbor;
181993da9cc1Scolin@cozybit.com 	u8 dot11MeshHWMPmaxPREQretries;
182093da9cc1Scolin@cozybit.com 	u32 path_refresh_time;
182193da9cc1Scolin@cozybit.com 	u16 min_discovery_timeout;
182293da9cc1Scolin@cozybit.com 	u32 dot11MeshHWMPactivePathTimeout;
182393da9cc1Scolin@cozybit.com 	u16 dot11MeshHWMPpreqMinInterval;
1824dca7e943SThomas Pedersen 	u16 dot11MeshHWMPperrMinInterval;
182593da9cc1Scolin@cozybit.com 	u16 dot11MeshHWMPnetDiameterTraversalTime;
182663c5723bSRui Paulo 	u8 dot11MeshHWMPRootMode;
182701d66fbdSBob Copeland 	bool dot11MeshConnectedToMeshGate;
18280507e159SJavier Cardona 	u16 dot11MeshHWMPRannInterval;
182916dd7267SJavier Cardona 	bool dot11MeshGateAnnouncementProtocol;
183094f90656SChun-Yeow Yeoh 	bool dot11MeshForwarding;
183155335137SAshok Nagarajan 	s32 rssi_threshold;
183270c33eaaSAshok Nagarajan 	u16 ht_opmode;
1833ac1073a6SChun-Yeow Yeoh 	u32 dot11MeshHWMPactivePathToRootTimeout;
1834ac1073a6SChun-Yeow Yeoh 	u16 dot11MeshHWMProotInterval;
1835728b19e5SChun-Yeow Yeoh 	u16 dot11MeshHWMPconfirmationInterval;
18363b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode power_mode;
18373b1c5a53SMarco Porsch 	u16 dot11MeshAwakeWindowDuration;
18388e7c0538SColleen Twitty 	u32 plink_timeout;
183993da9cc1Scolin@cozybit.com };
184093da9cc1Scolin@cozybit.com 
184131888487SJouni Malinen /**
184229cbe68cSJohannes Berg  * struct mesh_setup - 802.11s mesh setup configuration
1843683b6d3bSJohannes Berg  * @chandef: defines the channel to use
184429cbe68cSJohannes Berg  * @mesh_id: the mesh ID
184529cbe68cSJohannes Berg  * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes
1846d299a1f2SJavier Cardona  * @sync_method: which synchronization method to use
1847c80d545dSJavier Cardona  * @path_sel_proto: which path selection protocol to use
1848c80d545dSJavier Cardona  * @path_metric: which metric to use
18496e16d90bSColleen Twitty  * @auth_id: which authentication method this mesh is using
1850581a8b0fSJavier Cardona  * @ie: vendor information elements (optional)
1851581a8b0fSJavier Cardona  * @ie_len: length of vendor information elements
1852b130e5ceSJavier Cardona  * @is_authenticated: this mesh requires authentication
1853b130e5ceSJavier Cardona  * @is_secure: this mesh uses security
1854bb2798d4SThomas Pedersen  * @user_mpm: userspace handles all MPM functions
18559bdbf04dSMarco Porsch  * @dtim_period: DTIM period to use
18569bdbf04dSMarco Porsch  * @beacon_interval: beacon interval to use
18574bb62344SChun-Yeow Yeoh  * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a]
1858ffb3cf30SAshok Nagarajan  * @basic_rates: basic rates to use when creating the mesh
18598564e382SJohannes Berg  * @beacon_rate: bitrate to be used for beacons
1860d37d49c2SBenjamin Berg  * @userspace_handles_dfs: whether user space controls DFS operation, i.e.
1861d37d49c2SBenjamin Berg  *	changes the channel when a radar is detected. This is required
1862d37d49c2SBenjamin Berg  *	to operate on DFS channels.
18631224f583SDenis Kenzior  * @control_port_over_nl80211: TRUE if userspace expects to exchange control
18641224f583SDenis Kenzior  *	port frames over NL80211 instead of the network interface.
186529cbe68cSJohannes Berg  *
186629cbe68cSJohannes Berg  * These parameters are fixed when the mesh is created.
186729cbe68cSJohannes Berg  */
186829cbe68cSJohannes Berg struct mesh_setup {
1869683b6d3bSJohannes Berg 	struct cfg80211_chan_def chandef;
187029cbe68cSJohannes Berg 	const u8 *mesh_id;
187129cbe68cSJohannes Berg 	u8 mesh_id_len;
1872d299a1f2SJavier Cardona 	u8 sync_method;
1873c80d545dSJavier Cardona 	u8 path_sel_proto;
1874c80d545dSJavier Cardona 	u8 path_metric;
18756e16d90bSColleen Twitty 	u8 auth_id;
1876581a8b0fSJavier Cardona 	const u8 *ie;
1877581a8b0fSJavier Cardona 	u8 ie_len;
1878b130e5ceSJavier Cardona 	bool is_authenticated;
187915d5dda6SJavier Cardona 	bool is_secure;
1880bb2798d4SThomas Pedersen 	bool user_mpm;
18819bdbf04dSMarco Porsch 	u8 dtim_period;
18829bdbf04dSMarco Porsch 	u16 beacon_interval;
188357fbcce3SJohannes Berg 	int mcast_rate[NUM_NL80211_BANDS];
1884ffb3cf30SAshok Nagarajan 	u32 basic_rates;
18858564e382SJohannes Berg 	struct cfg80211_bitrate_mask beacon_rate;
1886d37d49c2SBenjamin Berg 	bool userspace_handles_dfs;
18871224f583SDenis Kenzior 	bool control_port_over_nl80211;
188829cbe68cSJohannes Berg };
188929cbe68cSJohannes Berg 
189029cbe68cSJohannes Berg /**
18916e0bd6c3SRostislav Lisovy  * struct ocb_setup - 802.11p OCB mode setup configuration
18926e0bd6c3SRostislav Lisovy  * @chandef: defines the channel to use
18936e0bd6c3SRostislav Lisovy  *
18946e0bd6c3SRostislav Lisovy  * These parameters are fixed when connecting to the network
18956e0bd6c3SRostislav Lisovy  */
18966e0bd6c3SRostislav Lisovy struct ocb_setup {
18976e0bd6c3SRostislav Lisovy 	struct cfg80211_chan_def chandef;
18986e0bd6c3SRostislav Lisovy };
18996e0bd6c3SRostislav Lisovy 
19006e0bd6c3SRostislav Lisovy /**
190131888487SJouni Malinen  * struct ieee80211_txq_params - TX queue parameters
1902a3304b0aSJohannes Berg  * @ac: AC identifier
190331888487SJouni Malinen  * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled
190431888487SJouni Malinen  * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range
190531888487SJouni Malinen  *	1..32767]
190631888487SJouni Malinen  * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range
190731888487SJouni Malinen  *	1..32767]
190831888487SJouni Malinen  * @aifs: Arbitration interframe space [0..255]
190931888487SJouni Malinen  */
191031888487SJouni Malinen struct ieee80211_txq_params {
1911a3304b0aSJohannes Berg 	enum nl80211_ac ac;
191231888487SJouni Malinen 	u16 txop;
191331888487SJouni Malinen 	u16 cwmin;
191431888487SJouni Malinen 	u16 cwmax;
191531888487SJouni Malinen 	u8 aifs;
191631888487SJouni Malinen };
191731888487SJouni Malinen 
1918d70e9693SJohannes Berg /**
1919d70e9693SJohannes Berg  * DOC: Scanning and BSS list handling
1920d70e9693SJohannes Berg  *
1921d70e9693SJohannes Berg  * The scanning process itself is fairly simple, but cfg80211 offers quite
1922d70e9693SJohannes Berg  * a bit of helper functionality. To start a scan, the scan operation will
1923d70e9693SJohannes Berg  * be invoked with a scan definition. This scan definition contains the
1924d70e9693SJohannes Berg  * channels to scan, and the SSIDs to send probe requests for (including the
1925d70e9693SJohannes Berg  * wildcard, if desired). A passive scan is indicated by having no SSIDs to
1926d70e9693SJohannes Berg  * probe. Additionally, a scan request may contain extra information elements
1927d70e9693SJohannes Berg  * that should be added to the probe request. The IEs are guaranteed to be
1928d70e9693SJohannes Berg  * well-formed, and will not exceed the maximum length the driver advertised
1929d70e9693SJohannes Berg  * in the wiphy structure.
1930d70e9693SJohannes Berg  *
1931d70e9693SJohannes Berg  * When scanning finds a BSS, cfg80211 needs to be notified of that, because
1932d70e9693SJohannes Berg  * it is responsible for maintaining the BSS list; the driver should not
1933d70e9693SJohannes Berg  * maintain a list itself. For this notification, various functions exist.
1934d70e9693SJohannes Berg  *
1935d70e9693SJohannes Berg  * Since drivers do not maintain a BSS list, there are also a number of
1936d70e9693SJohannes Berg  * functions to search for a BSS and obtain information about it from the
1937d70e9693SJohannes Berg  * BSS structure cfg80211 maintains. The BSS list is also made available
1938d70e9693SJohannes Berg  * to userspace.
1939d70e9693SJohannes Berg  */
194072bdcf34SJouni Malinen 
1941704232c2SJohannes Berg /**
19422a519311SJohannes Berg  * struct cfg80211_ssid - SSID description
19432a519311SJohannes Berg  * @ssid: the SSID
19442a519311SJohannes Berg  * @ssid_len: length of the ssid
19452a519311SJohannes Berg  */
19462a519311SJohannes Berg struct cfg80211_ssid {
19472a519311SJohannes Berg 	u8 ssid[IEEE80211_MAX_SSID_LEN];
19482a519311SJohannes Berg 	u8 ssid_len;
19492a519311SJohannes Berg };
19502a519311SJohannes Berg 
19512a519311SJohannes Berg /**
19521d76250bSAvraham Stern  * struct cfg80211_scan_info - information about completed scan
19531d76250bSAvraham Stern  * @scan_start_tsf: scan start time in terms of the TSF of the BSS that the
19541d76250bSAvraham Stern  *	wireless device that requested the scan is connected to. If this
19551d76250bSAvraham Stern  *	information is not available, this field is left zero.
19561d76250bSAvraham Stern  * @tsf_bssid: the BSSID according to which %scan_start_tsf is set.
19571d76250bSAvraham Stern  * @aborted: set to true if the scan was aborted for any reason,
19581d76250bSAvraham Stern  *	userspace will be notified of that
19591d76250bSAvraham Stern  */
19601d76250bSAvraham Stern struct cfg80211_scan_info {
19611d76250bSAvraham Stern 	u64 scan_start_tsf;
19621d76250bSAvraham Stern 	u8 tsf_bssid[ETH_ALEN] __aligned(2);
19631d76250bSAvraham Stern 	bool aborted;
19641d76250bSAvraham Stern };
19651d76250bSAvraham Stern 
19661d76250bSAvraham Stern /**
19672a519311SJohannes Berg  * struct cfg80211_scan_request - scan request description
19682a519311SJohannes Berg  *
19692a519311SJohannes Berg  * @ssids: SSIDs to scan for (active scan only)
19702a519311SJohannes Berg  * @n_ssids: number of SSIDs
19712a519311SJohannes Berg  * @channels: channels to scan on.
1972ca3dbc20SHelmut Schaa  * @n_channels: total number of channels to scan
1973dcd6eac1SSimon Wunderlich  * @scan_width: channel width for scanning
197470692ad2SJouni Malinen  * @ie: optional information element(s) to add into Probe Request or %NULL
197570692ad2SJouni Malinen  * @ie_len: length of ie in octets
19761d76250bSAvraham Stern  * @duration: how long to listen on each channel, in TUs. If
19771d76250bSAvraham Stern  *	%duration_mandatory is not set, this is the maximum dwell time and
19781d76250bSAvraham Stern  *	the actual dwell time may be shorter.
19791d76250bSAvraham Stern  * @duration_mandatory: if set, the scan duration must be as specified by the
19801d76250bSAvraham Stern  *	%duration field.
1981ed473771SSam Leffler  * @flags: bit field of flags controlling operation
198234850ab2SJohannes Berg  * @rates: bitmap of rates to advertise for each band
19832a519311SJohannes Berg  * @wiphy: the wiphy this was for
198415d6030bSSam Leffler  * @scan_start: time (in jiffies) when the scan started
1985fd014284SJohannes Berg  * @wdev: the wireless device to scan for
19861d76250bSAvraham Stern  * @info: (internal) information about completed scan
19875fe231e8SJohannes Berg  * @notified: (internal) scan request was notified as done or aborted
1988e9f935e3SRajkumar Manoharan  * @no_cck: used to send probe requests at non CCK rate in 2GHz band
1989ad2b26abSJohannes Berg  * @mac_addr: MAC address used with randomisation
1990ad2b26abSJohannes Berg  * @mac_addr_mask: MAC address mask used with randomisation, bits that
1991ad2b26abSJohannes Berg  *	are 0 in the mask should be randomised, bits that are 1 should
1992ad2b26abSJohannes Berg  *	be taken from the @mac_addr
1993818965d3SJouni Malinen  * @bssid: BSSID to scan for (most commonly, the wildcard BSSID)
19942a519311SJohannes Berg  */
19952a519311SJohannes Berg struct cfg80211_scan_request {
19962a519311SJohannes Berg 	struct cfg80211_ssid *ssids;
19972a519311SJohannes Berg 	int n_ssids;
19982a519311SJohannes Berg 	u32 n_channels;
1999dcd6eac1SSimon Wunderlich 	enum nl80211_bss_scan_width scan_width;
2000de95a54bSJohannes Berg 	const u8 *ie;
200170692ad2SJouni Malinen 	size_t ie_len;
20021d76250bSAvraham Stern 	u16 duration;
20031d76250bSAvraham Stern 	bool duration_mandatory;
2004ed473771SSam Leffler 	u32 flags;
20052a519311SJohannes Berg 
200657fbcce3SJohannes Berg 	u32 rates[NUM_NL80211_BANDS];
200734850ab2SJohannes Berg 
2008fd014284SJohannes Berg 	struct wireless_dev *wdev;
2009fd014284SJohannes Berg 
2010ad2b26abSJohannes Berg 	u8 mac_addr[ETH_ALEN] __aligned(2);
2011ad2b26abSJohannes Berg 	u8 mac_addr_mask[ETH_ALEN] __aligned(2);
2012818965d3SJouni Malinen 	u8 bssid[ETH_ALEN] __aligned(2);
2013ad2b26abSJohannes Berg 
20142a519311SJohannes Berg 	/* internal */
20152a519311SJohannes Berg 	struct wiphy *wiphy;
201615d6030bSSam Leffler 	unsigned long scan_start;
20171d76250bSAvraham Stern 	struct cfg80211_scan_info info;
20181d76250bSAvraham Stern 	bool notified;
2019e9f935e3SRajkumar Manoharan 	bool no_cck;
20205ba63533SJohannes Berg 
20215ba63533SJohannes Berg 	/* keep last */
20225ba63533SJohannes Berg 	struct ieee80211_channel *channels[0];
20232a519311SJohannes Berg };
20242a519311SJohannes Berg 
2025ad2b26abSJohannes Berg static inline void get_random_mask_addr(u8 *buf, const u8 *addr, const u8 *mask)
2026ad2b26abSJohannes Berg {
2027ad2b26abSJohannes Berg 	int i;
2028ad2b26abSJohannes Berg 
2029ad2b26abSJohannes Berg 	get_random_bytes(buf, ETH_ALEN);
2030ad2b26abSJohannes Berg 	for (i = 0; i < ETH_ALEN; i++) {
2031ad2b26abSJohannes Berg 		buf[i] &= ~mask[i];
2032ad2b26abSJohannes Berg 		buf[i] |= addr[i] & mask[i];
2033ad2b26abSJohannes Berg 	}
2034ad2b26abSJohannes Berg }
2035ad2b26abSJohannes Berg 
20362a519311SJohannes Berg /**
2037a1f1c21cSLuciano Coelho  * struct cfg80211_match_set - sets of attributes to match
2038a1f1c21cSLuciano Coelho  *
20393007e352SArend Van Spriel  * @ssid: SSID to be matched; may be zero-length in case of BSSID match
20403007e352SArend Van Spriel  *	or no match (RSSI only)
20413007e352SArend Van Spriel  * @bssid: BSSID to be matched; may be all-zero BSSID in case of SSID match
20423007e352SArend Van Spriel  *	or no match (RSSI only)
2043ea73cbceSJohannes Berg  * @rssi_thold: don't report scan results below this threshold (in s32 dBm)
20441e1b11b6Svamsi krishna  * @per_band_rssi_thold: Minimum rssi threshold for each band to be applied
20451e1b11b6Svamsi krishna  *	for filtering out scan results received. Drivers advertize this support
20461e1b11b6Svamsi krishna  *	of band specific rssi based filtering through the feature capability
20471e1b11b6Svamsi krishna  *	%NL80211_EXT_FEATURE_SCHED_SCAN_BAND_SPECIFIC_RSSI_THOLD. These band
20481e1b11b6Svamsi krishna  *	specific rssi thresholds take precedence over rssi_thold, if specified.
20491e1b11b6Svamsi krishna  *	If not specified for any band, it will be assigned with rssi_thold of
20501e1b11b6Svamsi krishna  *	corresponding matchset.
2051a1f1c21cSLuciano Coelho  */
2052a1f1c21cSLuciano Coelho struct cfg80211_match_set {
2053a1f1c21cSLuciano Coelho 	struct cfg80211_ssid ssid;
20543007e352SArend Van Spriel 	u8 bssid[ETH_ALEN];
2055ea73cbceSJohannes Berg 	s32 rssi_thold;
20561e1b11b6Svamsi krishna 	s32 per_band_rssi_thold[NUM_NL80211_BANDS];
2057a1f1c21cSLuciano Coelho };
2058a1f1c21cSLuciano Coelho 
2059a1f1c21cSLuciano Coelho /**
20603b06d277SAvraham Stern  * struct cfg80211_sched_scan_plan - scan plan for scheduled scan
20613b06d277SAvraham Stern  *
20623b06d277SAvraham Stern  * @interval: interval between scheduled scan iterations. In seconds.
20633b06d277SAvraham Stern  * @iterations: number of scan iterations in this scan plan. Zero means
20643b06d277SAvraham Stern  *	infinite loop.
20653b06d277SAvraham Stern  *	The last scan plan will always have this parameter set to zero,
20663b06d277SAvraham Stern  *	all other scan plans will have a finite number of iterations.
20673b06d277SAvraham Stern  */
20683b06d277SAvraham Stern struct cfg80211_sched_scan_plan {
20693b06d277SAvraham Stern 	u32 interval;
20703b06d277SAvraham Stern 	u32 iterations;
20713b06d277SAvraham Stern };
20723b06d277SAvraham Stern 
20733b06d277SAvraham Stern /**
2074bf95ecdbSvamsi krishna  * struct cfg80211_bss_select_adjust - BSS selection with RSSI adjustment.
2075bf95ecdbSvamsi krishna  *
2076bf95ecdbSvamsi krishna  * @band: band of BSS which should match for RSSI level adjustment.
2077bf95ecdbSvamsi krishna  * @delta: value of RSSI level adjustment.
2078bf95ecdbSvamsi krishna  */
2079bf95ecdbSvamsi krishna struct cfg80211_bss_select_adjust {
2080bf95ecdbSvamsi krishna 	enum nl80211_band band;
2081bf95ecdbSvamsi krishna 	s8 delta;
2082bf95ecdbSvamsi krishna };
2083bf95ecdbSvamsi krishna 
2084bf95ecdbSvamsi krishna /**
2085807f8a8cSLuciano Coelho  * struct cfg80211_sched_scan_request - scheduled scan request description
2086807f8a8cSLuciano Coelho  *
208796b08fd6SArend Van Spriel  * @reqid: identifies this request.
2088807f8a8cSLuciano Coelho  * @ssids: SSIDs to scan for (passed in the probe_reqs in active scans)
2089807f8a8cSLuciano Coelho  * @n_ssids: number of SSIDs
2090807f8a8cSLuciano Coelho  * @n_channels: total number of channels to scan
2091dcd6eac1SSimon Wunderlich  * @scan_width: channel width for scanning
2092807f8a8cSLuciano Coelho  * @ie: optional information element(s) to add into Probe Request or %NULL
2093807f8a8cSLuciano Coelho  * @ie_len: length of ie in octets
2094ed473771SSam Leffler  * @flags: bit field of flags controlling operation
2095a1f1c21cSLuciano Coelho  * @match_sets: sets of parameters to be matched for a scan result
2096a1f1c21cSLuciano Coelho  *	entry to be considered valid and to be passed to the host
2097a1f1c21cSLuciano Coelho  *	(others are filtered out).
2098a1f1c21cSLuciano Coelho  *	If ommited, all results are passed.
2099a1f1c21cSLuciano Coelho  * @n_match_sets: number of match sets
21006406c919SJohannes Berg  * @report_results: indicates that results were reported for this request
2101807f8a8cSLuciano Coelho  * @wiphy: the wiphy this was for
2102807f8a8cSLuciano Coelho  * @dev: the interface
2103077f897aSJohannes Berg  * @scan_start: start time of the scheduled scan
2104807f8a8cSLuciano Coelho  * @channels: channels to scan
2105ea73cbceSJohannes Berg  * @min_rssi_thold: for drivers only supporting a single threshold, this
2106ea73cbceSJohannes Berg  *	contains the minimum over all matchsets
2107ad2b26abSJohannes Berg  * @mac_addr: MAC address used with randomisation
2108ad2b26abSJohannes Berg  * @mac_addr_mask: MAC address mask used with randomisation, bits that
2109ad2b26abSJohannes Berg  *	are 0 in the mask should be randomised, bits that are 1 should
2110ad2b26abSJohannes Berg  *	be taken from the @mac_addr
21113b06d277SAvraham Stern  * @scan_plans: scan plans to be executed in this scheduled scan. Lowest
21123b06d277SAvraham Stern  *	index must be executed first.
21133b06d277SAvraham Stern  * @n_scan_plans: number of scan plans, at least 1.
211431a60ed1SJukka Rissanen  * @rcu_head: RCU callback used to free the struct
211593a1e86cSJukka Rissanen  * @owner_nlportid: netlink portid of owner (if this should is a request
211693a1e86cSJukka Rissanen  *	owned by a particular socket)
2117ca986ad9SArend Van Spriel  * @nl_owner_dead: netlink owner socket was closed - this request be freed
2118ca986ad9SArend Van Spriel  * @list: for keeping list of requests.
21199c748934SLuciano Coelho  * @delay: delay in seconds to use before starting the first scan
21209c748934SLuciano Coelho  *	cycle.  The driver may ignore this parameter and start
21219c748934SLuciano Coelho  *	immediately (or at any other time), if this feature is not
21229c748934SLuciano Coelho  *	supported.
2123bf95ecdbSvamsi krishna  * @relative_rssi_set: Indicates whether @relative_rssi is set or not.
2124bf95ecdbSvamsi krishna  * @relative_rssi: Relative RSSI threshold in dB to restrict scan result
2125bf95ecdbSvamsi krishna  *	reporting in connected state to cases where a matching BSS is determined
2126bf95ecdbSvamsi krishna  *	to have better or slightly worse RSSI than the current connected BSS.
2127bf95ecdbSvamsi krishna  *	The relative RSSI threshold values are ignored in disconnected state.
2128bf95ecdbSvamsi krishna  * @rssi_adjust: delta dB of RSSI preference to be given to the BSSs that belong
2129bf95ecdbSvamsi krishna  *	to the specified band while deciding whether a better BSS is reported
2130bf95ecdbSvamsi krishna  *	using @relative_rssi. If delta is a negative number, the BSSs that
2131bf95ecdbSvamsi krishna  *	belong to the specified band will be penalized by delta dB in relative
2132bf95ecdbSvamsi krishna  *	comparisions.
2133807f8a8cSLuciano Coelho  */
2134807f8a8cSLuciano Coelho struct cfg80211_sched_scan_request {
213596b08fd6SArend Van Spriel 	u64 reqid;
2136807f8a8cSLuciano Coelho 	struct cfg80211_ssid *ssids;
2137807f8a8cSLuciano Coelho 	int n_ssids;
2138807f8a8cSLuciano Coelho 	u32 n_channels;
2139dcd6eac1SSimon Wunderlich 	enum nl80211_bss_scan_width scan_width;
2140807f8a8cSLuciano Coelho 	const u8 *ie;
2141807f8a8cSLuciano Coelho 	size_t ie_len;
2142ed473771SSam Leffler 	u32 flags;
2143a1f1c21cSLuciano Coelho 	struct cfg80211_match_set *match_sets;
2144a1f1c21cSLuciano Coelho 	int n_match_sets;
2145ea73cbceSJohannes Berg 	s32 min_rssi_thold;
21469c748934SLuciano Coelho 	u32 delay;
21473b06d277SAvraham Stern 	struct cfg80211_sched_scan_plan *scan_plans;
21483b06d277SAvraham Stern 	int n_scan_plans;
2149807f8a8cSLuciano Coelho 
2150ad2b26abSJohannes Berg 	u8 mac_addr[ETH_ALEN] __aligned(2);
2151ad2b26abSJohannes Berg 	u8 mac_addr_mask[ETH_ALEN] __aligned(2);
2152ad2b26abSJohannes Berg 
2153bf95ecdbSvamsi krishna 	bool relative_rssi_set;
2154bf95ecdbSvamsi krishna 	s8 relative_rssi;
2155bf95ecdbSvamsi krishna 	struct cfg80211_bss_select_adjust rssi_adjust;
2156bf95ecdbSvamsi krishna 
2157807f8a8cSLuciano Coelho 	/* internal */
2158807f8a8cSLuciano Coelho 	struct wiphy *wiphy;
2159807f8a8cSLuciano Coelho 	struct net_device *dev;
216015d6030bSSam Leffler 	unsigned long scan_start;
2161b34939b9SArend Van Spriel 	bool report_results;
216231a60ed1SJukka Rissanen 	struct rcu_head rcu_head;
216393a1e86cSJukka Rissanen 	u32 owner_nlportid;
2164ca986ad9SArend Van Spriel 	bool nl_owner_dead;
2165ca986ad9SArend Van Spriel 	struct list_head list;
2166807f8a8cSLuciano Coelho 
2167807f8a8cSLuciano Coelho 	/* keep last */
2168807f8a8cSLuciano Coelho 	struct ieee80211_channel *channels[0];
2169807f8a8cSLuciano Coelho };
2170807f8a8cSLuciano Coelho 
2171807f8a8cSLuciano Coelho /**
21722a519311SJohannes Berg  * enum cfg80211_signal_type - signal type
21732a519311SJohannes Berg  *
21742a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available
21752a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm)
21762a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100
21772a519311SJohannes Berg  */
21782a519311SJohannes Berg enum cfg80211_signal_type {
21792a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_NONE,
21802a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_MBM,
21812a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_UNSPEC,
21822a519311SJohannes Berg };
21832a519311SJohannes Berg 
21842a519311SJohannes Berg /**
21856e19bc4bSDmitry Shmidt  * struct cfg80211_inform_bss - BSS inform data
21866e19bc4bSDmitry Shmidt  * @chan: channel the frame was received on
21876e19bc4bSDmitry Shmidt  * @scan_width: scan width that was used
21886e19bc4bSDmitry Shmidt  * @signal: signal strength value, according to the wiphy's
21896e19bc4bSDmitry Shmidt  *	signal type
21906e19bc4bSDmitry Shmidt  * @boottime_ns: timestamp (CLOCK_BOOTTIME) when the information was
21916e19bc4bSDmitry Shmidt  *	received; should match the time when the frame was actually
21926e19bc4bSDmitry Shmidt  *	received by the device (not just by the host, in case it was
21936e19bc4bSDmitry Shmidt  *	buffered on the device) and be accurate to about 10ms.
21946e19bc4bSDmitry Shmidt  *	If the frame isn't buffered, just passing the return value of
21959285ec4cSJason A. Donenfeld  *	ktime_get_boottime_ns() is likely appropriate.
21961d76250bSAvraham Stern  * @parent_tsf: the time at the start of reception of the first octet of the
21971d76250bSAvraham Stern  *	timestamp field of the frame. The time is the TSF of the BSS specified
21981d76250bSAvraham Stern  *	by %parent_bssid.
21991d76250bSAvraham Stern  * @parent_bssid: the BSS according to which %parent_tsf is set. This is set to
22001d76250bSAvraham Stern  *	the BSS that requested the scan in which the beacon/probe was received.
2201983dafaaSSunil Dutt  * @chains: bitmask for filled values in @chain_signal.
2202983dafaaSSunil Dutt  * @chain_signal: per-chain signal strength of last received BSS in dBm.
22036e19bc4bSDmitry Shmidt  */
22046e19bc4bSDmitry Shmidt struct cfg80211_inform_bss {
22056e19bc4bSDmitry Shmidt 	struct ieee80211_channel *chan;
22066e19bc4bSDmitry Shmidt 	enum nl80211_bss_scan_width scan_width;
22076e19bc4bSDmitry Shmidt 	s32 signal;
22086e19bc4bSDmitry Shmidt 	u64 boottime_ns;
22091d76250bSAvraham Stern 	u64 parent_tsf;
22101d76250bSAvraham Stern 	u8 parent_bssid[ETH_ALEN] __aligned(2);
2211983dafaaSSunil Dutt 	u8 chains;
2212983dafaaSSunil Dutt 	s8 chain_signal[IEEE80211_MAX_CHAINS];
22136e19bc4bSDmitry Shmidt };
22146e19bc4bSDmitry Shmidt 
22156e19bc4bSDmitry Shmidt /**
22162aa4d456SAkira Moroo  * struct cfg80211_bss_ies - BSS entry IE data
22178cef2c9dSJohannes Berg  * @tsf: TSF contained in the frame that carried these IEs
22189caf0364SJohannes Berg  * @rcu_head: internal use, for freeing
22199caf0364SJohannes Berg  * @len: length of the IEs
22200e227084SJohannes Berg  * @from_beacon: these IEs are known to come from a beacon
22219caf0364SJohannes Berg  * @data: IE data
22229caf0364SJohannes Berg  */
22239caf0364SJohannes Berg struct cfg80211_bss_ies {
22248cef2c9dSJohannes Berg 	u64 tsf;
22259caf0364SJohannes Berg 	struct rcu_head rcu_head;
22269caf0364SJohannes Berg 	int len;
22270e227084SJohannes Berg 	bool from_beacon;
22289caf0364SJohannes Berg 	u8 data[];
22299caf0364SJohannes Berg };
22309caf0364SJohannes Berg 
22319caf0364SJohannes Berg /**
22322a519311SJohannes Berg  * struct cfg80211_bss - BSS description
22332a519311SJohannes Berg  *
22342a519311SJohannes Berg  * This structure describes a BSS (which may also be a mesh network)
22352a519311SJohannes Berg  * for use in scan results and similar.
22362a519311SJohannes Berg  *
2237abe37c4bSJohannes Berg  * @channel: channel this BSS is on
2238dcd6eac1SSimon Wunderlich  * @scan_width: width of the control channel
22392a519311SJohannes Berg  * @bssid: BSSID of the BSS
22402a519311SJohannes Berg  * @beacon_interval: the beacon interval as from the frame
22412a519311SJohannes Berg  * @capability: the capability field in host byte order
224283c7aa1aSJohannes Berg  * @ies: the information elements (Note that there is no guarantee that these
224383c7aa1aSJohannes Berg  *	are well-formed!); this is a pointer to either the beacon_ies or
224483c7aa1aSJohannes Berg  *	proberesp_ies depending on whether Probe Response frame has been
224583c7aa1aSJohannes Berg  *	received. It is always non-%NULL.
224634a6eddbSJouni Malinen  * @beacon_ies: the information elements from the last Beacon frame
2247776b3580SJohannes Berg  *	(implementation note: if @hidden_beacon_bss is set this struct doesn't
2248776b3580SJohannes Berg  *	own the beacon_ies, but they're just pointers to the ones from the
2249776b3580SJohannes Berg  *	@hidden_beacon_bss struct)
225034a6eddbSJouni Malinen  * @proberesp_ies: the information elements from the last Probe Response frame
2251776b3580SJohannes Berg  * @hidden_beacon_bss: in case this BSS struct represents a probe response from
2252776b3580SJohannes Berg  *	a BSS that hides the SSID in its beacon, this points to the BSS struct
2253776b3580SJohannes Berg  *	that holds the beacon data. @beacon_ies is still valid, of course, and
2254776b3580SJohannes Berg  *	points to the same data as hidden_beacon_bss->beacon_ies in that case.
2255851ae31dSJohannes Berg  * @transmitted_bss: pointer to the transmitted BSS, if this is a
2256851ae31dSJohannes Berg  *	non-transmitted one (multi-BSSID support)
2257851ae31dSJohannes Berg  * @nontrans_list: list of non-transmitted BSS, if this is a transmitted one
2258851ae31dSJohannes Berg  *	(multi-BSSID support)
225977965c97SJohannes Berg  * @signal: signal strength value (type depends on the wiphy's signal_type)
2260983dafaaSSunil Dutt  * @chains: bitmask for filled values in @chain_signal.
2261983dafaaSSunil Dutt  * @chain_signal: per-chain signal strength of last received BSS in dBm.
22620cd01efbSSara Sharon  * @bssid_index: index in the multiple BSS set
22630cd01efbSSara Sharon  * @max_bssid_indicator: max number of members in the BSS set
22642a519311SJohannes Berg  * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
22652a519311SJohannes Berg  */
22662a519311SJohannes Berg struct cfg80211_bss {
22672a519311SJohannes Berg 	struct ieee80211_channel *channel;
2268dcd6eac1SSimon Wunderlich 	enum nl80211_bss_scan_width scan_width;
22692a519311SJohannes Berg 
22709caf0364SJohannes Berg 	const struct cfg80211_bss_ies __rcu *ies;
22719caf0364SJohannes Berg 	const struct cfg80211_bss_ies __rcu *beacon_ies;
22729caf0364SJohannes Berg 	const struct cfg80211_bss_ies __rcu *proberesp_ies;
22739caf0364SJohannes Berg 
2274776b3580SJohannes Berg 	struct cfg80211_bss *hidden_beacon_bss;
22757011ba58SSara Sharon 	struct cfg80211_bss *transmitted_bss;
22767011ba58SSara Sharon 	struct list_head nontrans_list;
22772a519311SJohannes Berg 
22782a519311SJohannes Berg 	s32 signal;
22792a519311SJohannes Berg 
22809caf0364SJohannes Berg 	u16 beacon_interval;
22819caf0364SJohannes Berg 	u16 capability;
22829caf0364SJohannes Berg 
22839caf0364SJohannes Berg 	u8 bssid[ETH_ALEN];
2284983dafaaSSunil Dutt 	u8 chains;
2285983dafaaSSunil Dutt 	s8 chain_signal[IEEE80211_MAX_CHAINS];
22869caf0364SJohannes Berg 
22870cd01efbSSara Sharon 	u8 bssid_index;
22880cd01efbSSara Sharon 	u8 max_bssid_indicator;
22890cd01efbSSara Sharon 
22901c06ef98SJohannes Berg 	u8 priv[0] __aligned(sizeof(void *));
22912a519311SJohannes Berg };
22922a519311SJohannes Berg 
22932a519311SJohannes Berg /**
229449a68e0dSJohannes Berg  * ieee80211_bss_get_elem - find element with given ID
2295517357c6SJohannes Berg  * @bss: the bss to search
229649a68e0dSJohannes Berg  * @id: the element ID
22979caf0364SJohannes Berg  *
22989caf0364SJohannes Berg  * Note that the return value is an RCU-protected pointer, so
22999caf0364SJohannes Berg  * rcu_read_lock() must be held when calling this function.
23000ae997dcSYacine Belkadi  * Return: %NULL if not found.
2301517357c6SJohannes Berg  */
230249a68e0dSJohannes Berg const struct element *ieee80211_bss_get_elem(struct cfg80211_bss *bss, u8 id);
230349a68e0dSJohannes Berg 
230449a68e0dSJohannes Berg /**
230549a68e0dSJohannes Berg  * ieee80211_bss_get_ie - find IE with given ID
230649a68e0dSJohannes Berg  * @bss: the bss to search
230749a68e0dSJohannes Berg  * @id: the element ID
230849a68e0dSJohannes Berg  *
230949a68e0dSJohannes Berg  * Note that the return value is an RCU-protected pointer, so
231049a68e0dSJohannes Berg  * rcu_read_lock() must be held when calling this function.
231149a68e0dSJohannes Berg  * Return: %NULL if not found.
231249a68e0dSJohannes Berg  */
231349a68e0dSJohannes Berg static inline const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 id)
231449a68e0dSJohannes Berg {
231549a68e0dSJohannes Berg 	return (void *)ieee80211_bss_get_elem(bss, id);
231649a68e0dSJohannes Berg }
2317517357c6SJohannes Berg 
2318517357c6SJohannes Berg 
2319517357c6SJohannes Berg /**
2320636a5d36SJouni Malinen  * struct cfg80211_auth_request - Authentication request data
2321636a5d36SJouni Malinen  *
2322636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
2323636a5d36SJouni Malinen  * authentication.
2324636a5d36SJouni Malinen  *
2325959867faSJohannes Berg  * @bss: The BSS to authenticate with, the callee must obtain a reference
2326959867faSJohannes Berg  *	to it if it needs to keep it.
2327636a5d36SJouni Malinen  * @auth_type: Authentication type (algorithm)
2328636a5d36SJouni Malinen  * @ie: Extra IEs to add to Authentication frame or %NULL
2329636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
2330fffd0934SJohannes Berg  * @key_len: length of WEP key for shared key authentication
2331fffd0934SJohannes Berg  * @key_idx: index of WEP key for shared key authentication
2332fffd0934SJohannes Berg  * @key: WEP key for shared key authentication
233311b6b5a4SJouni Malinen  * @auth_data: Fields and elements in Authentication frames. This contains
233411b6b5a4SJouni Malinen  *	the authentication frame body (non-IE and IE data), excluding the
233511b6b5a4SJouni Malinen  *	Authentication algorithm number, i.e., starting at the Authentication
233611b6b5a4SJouni Malinen  *	transaction sequence number field.
233711b6b5a4SJouni Malinen  * @auth_data_len: Length of auth_data buffer in octets
2338636a5d36SJouni Malinen  */
2339636a5d36SJouni Malinen struct cfg80211_auth_request {
234019957bb3SJohannes Berg 	struct cfg80211_bss *bss;
2341636a5d36SJouni Malinen 	const u8 *ie;
2342636a5d36SJouni Malinen 	size_t ie_len;
234319957bb3SJohannes Berg 	enum nl80211_auth_type auth_type;
2344fffd0934SJohannes Berg 	const u8 *key;
2345fffd0934SJohannes Berg 	u8 key_len, key_idx;
234611b6b5a4SJouni Malinen 	const u8 *auth_data;
234711b6b5a4SJouni Malinen 	size_t auth_data_len;
2348636a5d36SJouni Malinen };
2349636a5d36SJouni Malinen 
2350636a5d36SJouni Malinen /**
23517e7c8926SBen Greear  * enum cfg80211_assoc_req_flags - Over-ride default behaviour in association.
23527e7c8926SBen Greear  *
23537e7c8926SBen Greear  * @ASSOC_REQ_DISABLE_HT:  Disable HT (802.11n)
2354ee2aca34SJohannes Berg  * @ASSOC_REQ_DISABLE_VHT:  Disable VHT
2355bab5ab7dSAssaf Krauss  * @ASSOC_REQ_USE_RRM: Declare RRM capability in this association
235640cbfa90SSrinivas Dasari  * @CONNECT_REQ_EXTERNAL_AUTH_SUPPORT: User space indicates external
235740cbfa90SSrinivas Dasari  *	authentication capability. Drivers can offload authentication to
235840cbfa90SSrinivas Dasari  *	userspace if this flag is set. Only applicable for cfg80211_connect()
235940cbfa90SSrinivas Dasari  *	request (connect callback).
23607e7c8926SBen Greear  */
23617e7c8926SBen Greear enum cfg80211_assoc_req_flags {
23627e7c8926SBen Greear 	ASSOC_REQ_DISABLE_HT			= BIT(0),
2363ee2aca34SJohannes Berg 	ASSOC_REQ_DISABLE_VHT			= BIT(1),
2364bab5ab7dSAssaf Krauss 	ASSOC_REQ_USE_RRM			= BIT(2),
236540cbfa90SSrinivas Dasari 	CONNECT_REQ_EXTERNAL_AUTH_SUPPORT	= BIT(3),
23667e7c8926SBen Greear };
23677e7c8926SBen Greear 
23687e7c8926SBen Greear /**
2369636a5d36SJouni Malinen  * struct cfg80211_assoc_request - (Re)Association request data
2370636a5d36SJouni Malinen  *
2371636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
2372636a5d36SJouni Malinen  * (re)association.
2373959867faSJohannes Berg  * @bss: The BSS to associate with. If the call is successful the driver is
2374959867faSJohannes Berg  *	given a reference that it must give back to cfg80211_send_rx_assoc()
2375959867faSJohannes Berg  *	or to cfg80211_assoc_timeout(). To ensure proper refcounting, new
2376959867faSJohannes Berg  *	association requests while already associating must be rejected.
2377636a5d36SJouni Malinen  * @ie: Extra IEs to add to (Re)Association Request frame or %NULL
2378636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
2379dc6382ceSJouni Malinen  * @use_mfp: Use management frame protection (IEEE 802.11w) in this association
2380b23aa676SSamuel Ortiz  * @crypto: crypto settings
238135eb8f7bSJouni Malinen  * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used
238235eb8f7bSJouni Malinen  *	to indicate a request to reassociate within the ESS instead of a request
238335eb8f7bSJouni Malinen  *	do the initial association with the ESS. When included, this is set to
238435eb8f7bSJouni Malinen  *	the BSSID of the current association, i.e., to the value that is
238535eb8f7bSJouni Malinen  *	included in the Current AP address field of the Reassociation Request
238635eb8f7bSJouni Malinen  *	frame.
23877e7c8926SBen Greear  * @flags:  See &enum cfg80211_assoc_req_flags
23887e7c8926SBen Greear  * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask
23897e7c8926SBen Greear  *	will be used in ht_capa.  Un-supported values will be ignored.
23907e7c8926SBen Greear  * @ht_capa_mask:  The bits of ht_capa which are to be used.
2391ee2aca34SJohannes Berg  * @vht_capa: VHT capability override
2392ee2aca34SJohannes Berg  * @vht_capa_mask: VHT capability mask indicating which fields to use
2393348bd456SJouni Malinen  * @fils_kek: FILS KEK for protecting (Re)Association Request/Response frame or
2394348bd456SJouni Malinen  *	%NULL if FILS is not used.
2395348bd456SJouni Malinen  * @fils_kek_len: Length of fils_kek in octets
2396348bd456SJouni Malinen  * @fils_nonces: FILS nonces (part of AAD) for protecting (Re)Association
2397348bd456SJouni Malinen  *	Request/Response frame or %NULL if FILS is not used. This field starts
2398348bd456SJouni Malinen  *	with 16 octets of STA Nonce followed by 16 octets of AP Nonce.
2399636a5d36SJouni Malinen  */
2400636a5d36SJouni Malinen struct cfg80211_assoc_request {
240119957bb3SJohannes Berg 	struct cfg80211_bss *bss;
24023e5d7649SJohannes Berg 	const u8 *ie, *prev_bssid;
2403636a5d36SJouni Malinen 	size_t ie_len;
2404b23aa676SSamuel Ortiz 	struct cfg80211_crypto_settings crypto;
240519957bb3SJohannes Berg 	bool use_mfp;
24067e7c8926SBen Greear 	u32 flags;
24077e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa;
24087e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa_mask;
2409ee2aca34SJohannes Berg 	struct ieee80211_vht_cap vht_capa, vht_capa_mask;
2410348bd456SJouni Malinen 	const u8 *fils_kek;
2411348bd456SJouni Malinen 	size_t fils_kek_len;
2412348bd456SJouni Malinen 	const u8 *fils_nonces;
2413636a5d36SJouni Malinen };
2414636a5d36SJouni Malinen 
2415636a5d36SJouni Malinen /**
2416636a5d36SJouni Malinen  * struct cfg80211_deauth_request - Deauthentication request data
2417636a5d36SJouni Malinen  *
2418636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
2419636a5d36SJouni Malinen  * deauthentication.
2420636a5d36SJouni Malinen  *
242195de817bSJohannes Berg  * @bssid: the BSSID of the BSS to deauthenticate from
2422636a5d36SJouni Malinen  * @ie: Extra IEs to add to Deauthentication frame or %NULL
2423636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
242419957bb3SJohannes Berg  * @reason_code: The reason code for the deauthentication
2425077f897aSJohannes Berg  * @local_state_change: if set, change local state only and
2426077f897aSJohannes Berg  *	do not set a deauth frame
2427636a5d36SJouni Malinen  */
2428636a5d36SJouni Malinen struct cfg80211_deauth_request {
242995de817bSJohannes Berg 	const u8 *bssid;
2430636a5d36SJouni Malinen 	const u8 *ie;
2431636a5d36SJouni Malinen 	size_t ie_len;
243219957bb3SJohannes Berg 	u16 reason_code;
24336863255bSStanislaw Gruszka 	bool local_state_change;
2434636a5d36SJouni Malinen };
2435636a5d36SJouni Malinen 
2436636a5d36SJouni Malinen /**
2437636a5d36SJouni Malinen  * struct cfg80211_disassoc_request - Disassociation request data
2438636a5d36SJouni Malinen  *
2439636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
244066f00449SMasahiro Yamada  * disassociation.
2441636a5d36SJouni Malinen  *
244219957bb3SJohannes Berg  * @bss: the BSS to disassociate from
2443636a5d36SJouni Malinen  * @ie: Extra IEs to add to Disassociation frame or %NULL
2444636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
244519957bb3SJohannes Berg  * @reason_code: The reason code for the disassociation
2446d5cdfacbSJouni Malinen  * @local_state_change: This is a request for a local state only, i.e., no
2447d5cdfacbSJouni Malinen  *	Disassociation frame is to be transmitted.
2448636a5d36SJouni Malinen  */
2449636a5d36SJouni Malinen struct cfg80211_disassoc_request {
245019957bb3SJohannes Berg 	struct cfg80211_bss *bss;
2451636a5d36SJouni Malinen 	const u8 *ie;
2452636a5d36SJouni Malinen 	size_t ie_len;
245319957bb3SJohannes Berg 	u16 reason_code;
2454d5cdfacbSJouni Malinen 	bool local_state_change;
2455636a5d36SJouni Malinen };
2456636a5d36SJouni Malinen 
2457636a5d36SJouni Malinen /**
245804a773adSJohannes Berg  * struct cfg80211_ibss_params - IBSS parameters
245904a773adSJohannes Berg  *
246004a773adSJohannes Berg  * This structure defines the IBSS parameters for the join_ibss()
246104a773adSJohannes Berg  * method.
246204a773adSJohannes Berg  *
246304a773adSJohannes Berg  * @ssid: The SSID, will always be non-null.
246404a773adSJohannes Berg  * @ssid_len: The length of the SSID, will always be non-zero.
246504a773adSJohannes Berg  * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not
246604a773adSJohannes Berg  *	search for IBSSs with a different BSSID.
2467683b6d3bSJohannes Berg  * @chandef: defines the channel to use if no other IBSS to join can be found
246804a773adSJohannes Berg  * @channel_fixed: The channel should be fixed -- do not search for
246904a773adSJohannes Berg  *	IBSSs to join on other channels.
247004a773adSJohannes Berg  * @ie: information element(s) to include in the beacon
247104a773adSJohannes Berg  * @ie_len: length of that
24728e30bc55SJohannes Berg  * @beacon_interval: beacon interval to use
2473fffd0934SJohannes Berg  * @privacy: this is a protected network, keys will be configured
2474fffd0934SJohannes Berg  *	after joining
2475267335d6SAntonio Quartulli  * @control_port: whether user space controls IEEE 802.1X port, i.e.,
2476267335d6SAntonio Quartulli  *	sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
2477267335d6SAntonio Quartulli  *	required to assume that the port is unauthorized until authorized by
2478267335d6SAntonio Quartulli  *	user space. Otherwise, port is marked authorized by default.
2479c3bfe1f6SDenis Kenzior  * @control_port_over_nl80211: TRUE if userspace expects to exchange control
2480c3bfe1f6SDenis Kenzior  *	port frames over NL80211 instead of the network interface.
24815336fa88SSimon Wunderlich  * @userspace_handles_dfs: whether user space controls DFS operation, i.e.
24825336fa88SSimon Wunderlich  *	changes the channel when a radar is detected. This is required
24835336fa88SSimon Wunderlich  *	to operate on DFS channels.
2484fbd2c8dcSTeemu Paasikivi  * @basic_rates: bitmap of basic rates to use when creating the IBSS
2485dd5b4cc7SFelix Fietkau  * @mcast_rate: per-band multicast rate index + 1 (0: disabled)
2486803768f5SSimon Wunderlich  * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask
2487803768f5SSimon Wunderlich  *	will be used in ht_capa.  Un-supported values will be ignored.
2488803768f5SSimon Wunderlich  * @ht_capa_mask:  The bits of ht_capa which are to be used.
24899ae3b172STova Mussai  * @wep_keys: static WEP keys, if not NULL points to an array of
24909ae3b172STova Mussai  *	CFG80211_MAX_WEP_KEYS WEP keys
24919ae3b172STova Mussai  * @wep_tx_key: key index (0..3) of the default TX static WEP key
249204a773adSJohannes Berg  */
249304a773adSJohannes Berg struct cfg80211_ibss_params {
2494c1e5f471SJohannes Berg 	const u8 *ssid;
2495c1e5f471SJohannes Berg 	const u8 *bssid;
2496683b6d3bSJohannes Berg 	struct cfg80211_chan_def chandef;
2497c1e5f471SJohannes Berg 	const u8 *ie;
249804a773adSJohannes Berg 	u8 ssid_len, ie_len;
24998e30bc55SJohannes Berg 	u16 beacon_interval;
2500fbd2c8dcSTeemu Paasikivi 	u32 basic_rates;
250104a773adSJohannes Berg 	bool channel_fixed;
2502fffd0934SJohannes Berg 	bool privacy;
2503267335d6SAntonio Quartulli 	bool control_port;
2504c3bfe1f6SDenis Kenzior 	bool control_port_over_nl80211;
25055336fa88SSimon Wunderlich 	bool userspace_handles_dfs;
250657fbcce3SJohannes Berg 	int mcast_rate[NUM_NL80211_BANDS];
2507803768f5SSimon Wunderlich 	struct ieee80211_ht_cap ht_capa;
2508803768f5SSimon Wunderlich 	struct ieee80211_ht_cap ht_capa_mask;
25099ae3b172STova Mussai 	struct key_params *wep_keys;
25109ae3b172STova Mussai 	int wep_tx_key;
251104a773adSJohannes Berg };
251204a773adSJohannes Berg 
251304a773adSJohannes Berg /**
251438de03d2SArend van Spriel  * struct cfg80211_bss_selection - connection parameters for BSS selection.
251538de03d2SArend van Spriel  *
251638de03d2SArend van Spriel  * @behaviour: requested BSS selection behaviour.
251738de03d2SArend van Spriel  * @param: parameters for requestion behaviour.
251838de03d2SArend van Spriel  * @band_pref: preferred band for %NL80211_BSS_SELECT_ATTR_BAND_PREF.
251938de03d2SArend van Spriel  * @adjust: parameters for %NL80211_BSS_SELECT_ATTR_RSSI_ADJUST.
252038de03d2SArend van Spriel  */
252138de03d2SArend van Spriel struct cfg80211_bss_selection {
252238de03d2SArend van Spriel 	enum nl80211_bss_select_attr behaviour;
252338de03d2SArend van Spriel 	union {
252457fbcce3SJohannes Berg 		enum nl80211_band band_pref;
252538de03d2SArend van Spriel 		struct cfg80211_bss_select_adjust adjust;
252638de03d2SArend van Spriel 	} param;
252738de03d2SArend van Spriel };
252838de03d2SArend van Spriel 
252938de03d2SArend van Spriel /**
2530b23aa676SSamuel Ortiz  * struct cfg80211_connect_params - Connection parameters
2531b23aa676SSamuel Ortiz  *
2532b23aa676SSamuel Ortiz  * This structure provides information needed to complete IEEE 802.11
2533b23aa676SSamuel Ortiz  * authentication and association.
2534b23aa676SSamuel Ortiz  *
2535b23aa676SSamuel Ortiz  * @channel: The channel to use or %NULL if not specified (auto-select based
2536b23aa676SSamuel Ortiz  *	on scan results)
25371df4a510SJouni Malinen  * @channel_hint: The channel of the recommended BSS for initial connection or
25381df4a510SJouni Malinen  *	%NULL if not specified
2539b23aa676SSamuel Ortiz  * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan
2540b23aa676SSamuel Ortiz  *	results)
25411df4a510SJouni Malinen  * @bssid_hint: The recommended AP BSSID for initial connection to the BSS or
25421df4a510SJouni Malinen  *	%NULL if not specified. Unlike the @bssid parameter, the driver is
25431df4a510SJouni Malinen  *	allowed to ignore this @bssid_hint if it has knowledge of a better BSS
25441df4a510SJouni Malinen  *	to use.
2545b23aa676SSamuel Ortiz  * @ssid: SSID
2546b23aa676SSamuel Ortiz  * @ssid_len: Length of ssid in octets
2547b23aa676SSamuel Ortiz  * @auth_type: Authentication type (algorithm)
2548abe37c4bSJohannes Berg  * @ie: IEs for association request
2549abe37c4bSJohannes Berg  * @ie_len: Length of assoc_ie in octets
2550b23aa676SSamuel Ortiz  * @privacy: indicates whether privacy-enabled APs should be used
2551cee00a95SJouni Malinen  * @mfp: indicate whether management frame protection is used
2552b23aa676SSamuel Ortiz  * @crypto: crypto settings
2553fffd0934SJohannes Berg  * @key_len: length of WEP key for shared key authentication
2554fffd0934SJohannes Berg  * @key_idx: index of WEP key for shared key authentication
2555fffd0934SJohannes Berg  * @key: WEP key for shared key authentication
25567e7c8926SBen Greear  * @flags:  See &enum cfg80211_assoc_req_flags
25574486ea98SBala Shanmugam  * @bg_scan_period:  Background scan period in seconds
25584486ea98SBala Shanmugam  *	or -1 to indicate that default value is to be used.
25597e7c8926SBen Greear  * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask
25607e7c8926SBen Greear  *	will be used in ht_capa.  Un-supported values will be ignored.
25617e7c8926SBen Greear  * @ht_capa_mask:  The bits of ht_capa which are to be used.
2562ee2aca34SJohannes Berg  * @vht_capa:  VHT Capability overrides
2563ee2aca34SJohannes Berg  * @vht_capa_mask: The bits of vht_capa which are to be used.
256434d50519SLior David  * @pbss: if set, connect to a PCP instead of AP. Valid for DMG
256534d50519SLior David  *	networks.
256638de03d2SArend van Spriel  * @bss_select: criteria to be used for BSS selection.
256735eb8f7bSJouni Malinen  * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used
256835eb8f7bSJouni Malinen  *	to indicate a request to reassociate within the ESS instead of a request
256935eb8f7bSJouni Malinen  *	do the initial association with the ESS. When included, this is set to
257035eb8f7bSJouni Malinen  *	the BSSID of the current association, i.e., to the value that is
257135eb8f7bSJouni Malinen  *	included in the Current AP address field of the Reassociation Request
257235eb8f7bSJouni Malinen  *	frame.
2573a3caf744SVidyullatha Kanchanapally  * @fils_erp_username: EAP re-authentication protocol (ERP) username part of the
2574a3caf744SVidyullatha Kanchanapally  *	NAI or %NULL if not specified. This is used to construct FILS wrapped
2575a3caf744SVidyullatha Kanchanapally  *	data IE.
2576a3caf744SVidyullatha Kanchanapally  * @fils_erp_username_len: Length of @fils_erp_username in octets.
2577a3caf744SVidyullatha Kanchanapally  * @fils_erp_realm: EAP re-authentication protocol (ERP) realm part of NAI or
2578a3caf744SVidyullatha Kanchanapally  *	%NULL if not specified. This specifies the domain name of ER server and
2579a3caf744SVidyullatha Kanchanapally  *	is used to construct FILS wrapped data IE.
2580a3caf744SVidyullatha Kanchanapally  * @fils_erp_realm_len: Length of @fils_erp_realm in octets.
2581a3caf744SVidyullatha Kanchanapally  * @fils_erp_next_seq_num: The next sequence number to use in the FILS ERP
2582a3caf744SVidyullatha Kanchanapally  *	messages. This is also used to construct FILS wrapped data IE.
2583a3caf744SVidyullatha Kanchanapally  * @fils_erp_rrk: ERP re-authentication Root Key (rRK) used to derive additional
2584a3caf744SVidyullatha Kanchanapally  *	keys in FILS or %NULL if not specified.
2585a3caf744SVidyullatha Kanchanapally  * @fils_erp_rrk_len: Length of @fils_erp_rrk in octets.
25863a00df57SAvraham Stern  * @want_1x: indicates user-space supports and wants to use 802.1X driver
25873a00df57SAvraham Stern  *	offload of 4-way handshake.
25882a38075cSAlexei Avshalom Lazar  * @edmg: define the EDMG channels.
25892a38075cSAlexei Avshalom Lazar  *	This may specify multiple channels and bonding options for the driver
25902a38075cSAlexei Avshalom Lazar  *	to choose from, based on BSS configuration.
2591b23aa676SSamuel Ortiz  */
2592b23aa676SSamuel Ortiz struct cfg80211_connect_params {
2593b23aa676SSamuel Ortiz 	struct ieee80211_channel *channel;
25941df4a510SJouni Malinen 	struct ieee80211_channel *channel_hint;
2595664834deSJouni Malinen 	const u8 *bssid;
25961df4a510SJouni Malinen 	const u8 *bssid_hint;
2597664834deSJouni Malinen 	const u8 *ssid;
2598b23aa676SSamuel Ortiz 	size_t ssid_len;
2599b23aa676SSamuel Ortiz 	enum nl80211_auth_type auth_type;
26004b5800feSJohannes Berg 	const u8 *ie;
2601b23aa676SSamuel Ortiz 	size_t ie_len;
2602b23aa676SSamuel Ortiz 	bool privacy;
2603cee00a95SJouni Malinen 	enum nl80211_mfp mfp;
2604b23aa676SSamuel Ortiz 	struct cfg80211_crypto_settings crypto;
2605fffd0934SJohannes Berg 	const u8 *key;
2606fffd0934SJohannes Berg 	u8 key_len, key_idx;
26077e7c8926SBen Greear 	u32 flags;
26084486ea98SBala Shanmugam 	int bg_scan_period;
26097e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa;
26107e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa_mask;
2611ee2aca34SJohannes Berg 	struct ieee80211_vht_cap vht_capa;
2612ee2aca34SJohannes Berg 	struct ieee80211_vht_cap vht_capa_mask;
261334d50519SLior David 	bool pbss;
261438de03d2SArend van Spriel 	struct cfg80211_bss_selection bss_select;
2615ba6fbacfSJouni Malinen 	const u8 *prev_bssid;
2616a3caf744SVidyullatha Kanchanapally 	const u8 *fils_erp_username;
2617a3caf744SVidyullatha Kanchanapally 	size_t fils_erp_username_len;
2618a3caf744SVidyullatha Kanchanapally 	const u8 *fils_erp_realm;
2619a3caf744SVidyullatha Kanchanapally 	size_t fils_erp_realm_len;
2620a3caf744SVidyullatha Kanchanapally 	u16 fils_erp_next_seq_num;
2621a3caf744SVidyullatha Kanchanapally 	const u8 *fils_erp_rrk;
2622a3caf744SVidyullatha Kanchanapally 	size_t fils_erp_rrk_len;
26233a00df57SAvraham Stern 	bool want_1x;
26242a38075cSAlexei Avshalom Lazar 	struct ieee80211_edmg edmg;
2625b23aa676SSamuel Ortiz };
2626b23aa676SSamuel Ortiz 
2627b23aa676SSamuel Ortiz /**
2628088e8df8Svamsi krishna  * enum cfg80211_connect_params_changed - Connection parameters being updated
2629088e8df8Svamsi krishna  *
2630088e8df8Svamsi krishna  * This enum provides information of all connect parameters that
2631088e8df8Svamsi krishna  * have to be updated as part of update_connect_params() call.
2632088e8df8Svamsi krishna  *
2633088e8df8Svamsi krishna  * @UPDATE_ASSOC_IES: Indicates whether association request IEs are updated
26347f9a3e15SVidyullatha Kanchanapally  * @UPDATE_FILS_ERP_INFO: Indicates that FILS connection parameters (realm,
26357f9a3e15SVidyullatha Kanchanapally  *	username, erp sequence number and rrk) are updated
26367f9a3e15SVidyullatha Kanchanapally  * @UPDATE_AUTH_TYPE: Indicates that authentication type is updated
2637088e8df8Svamsi krishna  */
2638088e8df8Svamsi krishna enum cfg80211_connect_params_changed {
2639088e8df8Svamsi krishna 	UPDATE_ASSOC_IES		= BIT(0),
26407f9a3e15SVidyullatha Kanchanapally 	UPDATE_FILS_ERP_INFO		= BIT(1),
26417f9a3e15SVidyullatha Kanchanapally 	UPDATE_AUTH_TYPE		= BIT(2),
2642088e8df8Svamsi krishna };
2643088e8df8Svamsi krishna 
2644088e8df8Svamsi krishna /**
2645b9a5f8caSJouni Malinen  * enum wiphy_params_flags - set_wiphy_params bitfield values
2646abe37c4bSJohannes Berg  * @WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed
2647abe37c4bSJohannes Berg  * @WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed
2648abe37c4bSJohannes Berg  * @WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed
2649abe37c4bSJohannes Berg  * @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed
2650abe37c4bSJohannes Berg  * @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed
26513057dbfdSLorenzo Bianconi  * @WIPHY_PARAM_DYN_ACK: dynack has been enabled
265252539ca8SToke Høiland-Jørgensen  * @WIPHY_PARAM_TXQ_LIMIT: TXQ packet limit has been changed
265352539ca8SToke Høiland-Jørgensen  * @WIPHY_PARAM_TXQ_MEMORY_LIMIT: TXQ memory limit has been changed
265452539ca8SToke Høiland-Jørgensen  * @WIPHY_PARAM_TXQ_QUANTUM: TXQ scheduler quantum
2655b9a5f8caSJouni Malinen  */
2656b9a5f8caSJouni Malinen enum wiphy_params_flags {
2657b9a5f8caSJouni Malinen 	WIPHY_PARAM_RETRY_SHORT		= 1 << 0,
2658b9a5f8caSJouni Malinen 	WIPHY_PARAM_RETRY_LONG		= 1 << 1,
2659b9a5f8caSJouni Malinen 	WIPHY_PARAM_FRAG_THRESHOLD	= 1 << 2,
2660b9a5f8caSJouni Malinen 	WIPHY_PARAM_RTS_THRESHOLD	= 1 << 3,
266181077e82SLukáš Turek 	WIPHY_PARAM_COVERAGE_CLASS	= 1 << 4,
26623057dbfdSLorenzo Bianconi 	WIPHY_PARAM_DYN_ACK		= 1 << 5,
266352539ca8SToke Høiland-Jørgensen 	WIPHY_PARAM_TXQ_LIMIT		= 1 << 6,
266452539ca8SToke Høiland-Jørgensen 	WIPHY_PARAM_TXQ_MEMORY_LIMIT	= 1 << 7,
266552539ca8SToke Høiland-Jørgensen 	WIPHY_PARAM_TXQ_QUANTUM		= 1 << 8,
2666b9a5f8caSJouni Malinen };
2667b9a5f8caSJouni Malinen 
266836647055SToke Høiland-Jørgensen #define IEEE80211_DEFAULT_AIRTIME_WEIGHT	256
266936647055SToke Høiland-Jørgensen 
26703ace10f5SKan Yan /* The per TXQ device queue limit in airtime */
26713ace10f5SKan Yan #define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_L	5000
26723ace10f5SKan Yan #define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_H	12000
26733ace10f5SKan Yan 
26743ace10f5SKan Yan /* The per interface airtime threshold to switch to lower queue limit */
26753ace10f5SKan Yan #define IEEE80211_AQL_THRESHOLD			24000
26763ace10f5SKan Yan 
267767fbb16bSSamuel Ortiz /**
267867fbb16bSSamuel Ortiz  * struct cfg80211_pmksa - PMK Security Association
267967fbb16bSSamuel Ortiz  *
268067fbb16bSSamuel Ortiz  * This structure is passed to the set/del_pmksa() method for PMKSA
268167fbb16bSSamuel Ortiz  * caching.
268267fbb16bSSamuel Ortiz  *
2683a3caf744SVidyullatha Kanchanapally  * @bssid: The AP's BSSID (may be %NULL).
2684a3caf744SVidyullatha Kanchanapally  * @pmkid: The identifier to refer a PMKSA.
2685a3caf744SVidyullatha Kanchanapally  * @pmk: The PMK for the PMKSA identified by @pmkid. This is used for key
2686a3caf744SVidyullatha Kanchanapally  *	derivation by a FILS STA. Otherwise, %NULL.
2687a3caf744SVidyullatha Kanchanapally  * @pmk_len: Length of the @pmk. The length of @pmk can differ depending on
2688a3caf744SVidyullatha Kanchanapally  *	the hash algorithm used to generate this.
2689a3caf744SVidyullatha Kanchanapally  * @ssid: SSID to specify the ESS within which a PMKSA is valid when using FILS
2690a3caf744SVidyullatha Kanchanapally  *	cache identifier (may be %NULL).
2691a3caf744SVidyullatha Kanchanapally  * @ssid_len: Length of the @ssid in octets.
2692a3caf744SVidyullatha Kanchanapally  * @cache_id: 2-octet cache identifier advertized by a FILS AP identifying the
2693a3caf744SVidyullatha Kanchanapally  *	scope of PMKSA. This is valid only if @ssid_len is non-zero (may be
2694a3caf744SVidyullatha Kanchanapally  *	%NULL).
269567fbb16bSSamuel Ortiz  */
269667fbb16bSSamuel Ortiz struct cfg80211_pmksa {
2697c1e5f471SJohannes Berg 	const u8 *bssid;
2698c1e5f471SJohannes Berg 	const u8 *pmkid;
2699a3caf744SVidyullatha Kanchanapally 	const u8 *pmk;
2700a3caf744SVidyullatha Kanchanapally 	size_t pmk_len;
2701a3caf744SVidyullatha Kanchanapally 	const u8 *ssid;
2702a3caf744SVidyullatha Kanchanapally 	size_t ssid_len;
2703a3caf744SVidyullatha Kanchanapally 	const u8 *cache_id;
270467fbb16bSSamuel Ortiz };
27059930380fSJohannes Berg 
27067643a2c3SJohannes Berg /**
270750ac6607SAmitkumar Karwar  * struct cfg80211_pkt_pattern - packet pattern
2708ff1b6e69SJohannes Berg  * @mask: bitmask where to match pattern and where to ignore bytes,
2709ff1b6e69SJohannes Berg  *	one bit per byte, in same format as nl80211
2710ff1b6e69SJohannes Berg  * @pattern: bytes to match where bitmask is 1
2711ff1b6e69SJohannes Berg  * @pattern_len: length of pattern (in bytes)
2712bb92d199SAmitkumar Karwar  * @pkt_offset: packet offset (in bytes)
2713ff1b6e69SJohannes Berg  *
2714ff1b6e69SJohannes Berg  * Internal note: @mask and @pattern are allocated in one chunk of
2715ff1b6e69SJohannes Berg  * memory, free @mask only!
2716ff1b6e69SJohannes Berg  */
271750ac6607SAmitkumar Karwar struct cfg80211_pkt_pattern {
2718922bd80fSJohannes Berg 	const u8 *mask, *pattern;
2719ff1b6e69SJohannes Berg 	int pattern_len;
2720bb92d199SAmitkumar Karwar 	int pkt_offset;
2721ff1b6e69SJohannes Berg };
2722ff1b6e69SJohannes Berg 
2723ff1b6e69SJohannes Berg /**
27242a0e047eSJohannes Berg  * struct cfg80211_wowlan_tcp - TCP connection parameters
27252a0e047eSJohannes Berg  *
27262a0e047eSJohannes Berg  * @sock: (internal) socket for source port allocation
27272a0e047eSJohannes Berg  * @src: source IP address
27282a0e047eSJohannes Berg  * @dst: destination IP address
27292a0e047eSJohannes Berg  * @dst_mac: destination MAC address
27302a0e047eSJohannes Berg  * @src_port: source port
27312a0e047eSJohannes Berg  * @dst_port: destination port
27322a0e047eSJohannes Berg  * @payload_len: data payload length
27332a0e047eSJohannes Berg  * @payload: data payload buffer
27342a0e047eSJohannes Berg  * @payload_seq: payload sequence stamping configuration
27352a0e047eSJohannes Berg  * @data_interval: interval at which to send data packets
27362a0e047eSJohannes Berg  * @wake_len: wakeup payload match length
27372a0e047eSJohannes Berg  * @wake_data: wakeup payload match data
27382a0e047eSJohannes Berg  * @wake_mask: wakeup payload match mask
27392a0e047eSJohannes Berg  * @tokens_size: length of the tokens buffer
27402a0e047eSJohannes Berg  * @payload_tok: payload token usage configuration
27412a0e047eSJohannes Berg  */
27422a0e047eSJohannes Berg struct cfg80211_wowlan_tcp {
27432a0e047eSJohannes Berg 	struct socket *sock;
27442a0e047eSJohannes Berg 	__be32 src, dst;
27452a0e047eSJohannes Berg 	u16 src_port, dst_port;
27462a0e047eSJohannes Berg 	u8 dst_mac[ETH_ALEN];
27472a0e047eSJohannes Berg 	int payload_len;
27482a0e047eSJohannes Berg 	const u8 *payload;
27492a0e047eSJohannes Berg 	struct nl80211_wowlan_tcp_data_seq payload_seq;
27502a0e047eSJohannes Berg 	u32 data_interval;
27512a0e047eSJohannes Berg 	u32 wake_len;
27522a0e047eSJohannes Berg 	const u8 *wake_data, *wake_mask;
27532a0e047eSJohannes Berg 	u32 tokens_size;
27542a0e047eSJohannes Berg 	/* must be last, variable member */
27552a0e047eSJohannes Berg 	struct nl80211_wowlan_tcp_data_token payload_tok;
2756ff1b6e69SJohannes Berg };
2757ff1b6e69SJohannes Berg 
2758ff1b6e69SJohannes Berg /**
2759ff1b6e69SJohannes Berg  * struct cfg80211_wowlan - Wake on Wireless-LAN support info
2760ff1b6e69SJohannes Berg  *
2761ff1b6e69SJohannes Berg  * This structure defines the enabled WoWLAN triggers for the device.
2762ff1b6e69SJohannes Berg  * @any: wake up on any activity -- special trigger if device continues
2763ff1b6e69SJohannes Berg  *	operating as normal during suspend
2764ff1b6e69SJohannes Berg  * @disconnect: wake up if getting disconnected
2765ff1b6e69SJohannes Berg  * @magic_pkt: wake up on receiving magic packet
2766ff1b6e69SJohannes Berg  * @patterns: wake up on receiving packet matching a pattern
2767ff1b6e69SJohannes Berg  * @n_patterns: number of patterns
276877dbbb13SJohannes Berg  * @gtk_rekey_failure: wake up on GTK rekey failure
276977dbbb13SJohannes Berg  * @eap_identity_req: wake up on EAP identity request packet
277077dbbb13SJohannes Berg  * @four_way_handshake: wake up on 4-way handshake
277177dbbb13SJohannes Berg  * @rfkill_release: wake up when rfkill is released
27722a0e047eSJohannes Berg  * @tcp: TCP connection establishment/wakeup parameters, see nl80211.h.
27732a0e047eSJohannes Berg  *	NULL if not configured.
27748cd4d456SLuciano Coelho  * @nd_config: configuration for the scan to be used for net detect wake.
2775ff1b6e69SJohannes Berg  */
2776ff1b6e69SJohannes Berg struct cfg80211_wowlan {
277777dbbb13SJohannes Berg 	bool any, disconnect, magic_pkt, gtk_rekey_failure,
277877dbbb13SJohannes Berg 	     eap_identity_req, four_way_handshake,
277977dbbb13SJohannes Berg 	     rfkill_release;
278050ac6607SAmitkumar Karwar 	struct cfg80211_pkt_pattern *patterns;
27812a0e047eSJohannes Berg 	struct cfg80211_wowlan_tcp *tcp;
2782ff1b6e69SJohannes Berg 	int n_patterns;
27838cd4d456SLuciano Coelho 	struct cfg80211_sched_scan_request *nd_config;
2784ff1b6e69SJohannes Berg };
2785ff1b6e69SJohannes Berg 
2786ff1b6e69SJohannes Berg /**
2787be29b99aSAmitkumar Karwar  * struct cfg80211_coalesce_rules - Coalesce rule parameters
2788be29b99aSAmitkumar Karwar  *
2789be29b99aSAmitkumar Karwar  * This structure defines coalesce rule for the device.
2790be29b99aSAmitkumar Karwar  * @delay: maximum coalescing delay in msecs.
2791be29b99aSAmitkumar Karwar  * @condition: condition for packet coalescence.
2792be29b99aSAmitkumar Karwar  *	see &enum nl80211_coalesce_condition.
2793be29b99aSAmitkumar Karwar  * @patterns: array of packet patterns
2794be29b99aSAmitkumar Karwar  * @n_patterns: number of patterns
2795be29b99aSAmitkumar Karwar  */
2796be29b99aSAmitkumar Karwar struct cfg80211_coalesce_rules {
2797be29b99aSAmitkumar Karwar 	int delay;
2798be29b99aSAmitkumar Karwar 	enum nl80211_coalesce_condition condition;
2799be29b99aSAmitkumar Karwar 	struct cfg80211_pkt_pattern *patterns;
2800be29b99aSAmitkumar Karwar 	int n_patterns;
2801be29b99aSAmitkumar Karwar };
2802be29b99aSAmitkumar Karwar 
2803be29b99aSAmitkumar Karwar /**
2804be29b99aSAmitkumar Karwar  * struct cfg80211_coalesce - Packet coalescing settings
2805be29b99aSAmitkumar Karwar  *
2806be29b99aSAmitkumar Karwar  * This structure defines coalescing settings.
2807be29b99aSAmitkumar Karwar  * @rules: array of coalesce rules
2808be29b99aSAmitkumar Karwar  * @n_rules: number of rules
2809be29b99aSAmitkumar Karwar  */
2810be29b99aSAmitkumar Karwar struct cfg80211_coalesce {
2811be29b99aSAmitkumar Karwar 	struct cfg80211_coalesce_rules *rules;
2812be29b99aSAmitkumar Karwar 	int n_rules;
2813be29b99aSAmitkumar Karwar };
2814be29b99aSAmitkumar Karwar 
2815be29b99aSAmitkumar Karwar /**
28168cd4d456SLuciano Coelho  * struct cfg80211_wowlan_nd_match - information about the match
28178cd4d456SLuciano Coelho  *
28188cd4d456SLuciano Coelho  * @ssid: SSID of the match that triggered the wake up
28198cd4d456SLuciano Coelho  * @n_channels: Number of channels where the match occurred.  This
28208cd4d456SLuciano Coelho  *	value may be zero if the driver can't report the channels.
28218cd4d456SLuciano Coelho  * @channels: center frequencies of the channels where a match
28228cd4d456SLuciano Coelho  *	occurred (in MHz)
28238cd4d456SLuciano Coelho  */
28248cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_match {
28258cd4d456SLuciano Coelho 	struct cfg80211_ssid ssid;
28268cd4d456SLuciano Coelho 	int n_channels;
28278cd4d456SLuciano Coelho 	u32 channels[];
28288cd4d456SLuciano Coelho };
28298cd4d456SLuciano Coelho 
28308cd4d456SLuciano Coelho /**
28318cd4d456SLuciano Coelho  * struct cfg80211_wowlan_nd_info - net detect wake up information
28328cd4d456SLuciano Coelho  *
28338cd4d456SLuciano Coelho  * @n_matches: Number of match information instances provided in
28348cd4d456SLuciano Coelho  *	@matches.  This value may be zero if the driver can't provide
28358cd4d456SLuciano Coelho  *	match information.
28368cd4d456SLuciano Coelho  * @matches: Array of pointers to matches containing information about
28378cd4d456SLuciano Coelho  *	the matches that triggered the wake up.
28388cd4d456SLuciano Coelho  */
28398cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_info {
28408cd4d456SLuciano Coelho 	int n_matches;
28418cd4d456SLuciano Coelho 	struct cfg80211_wowlan_nd_match *matches[];
28428cd4d456SLuciano Coelho };
28438cd4d456SLuciano Coelho 
28448cd4d456SLuciano Coelho /**
2845cd8f7cb4SJohannes Berg  * struct cfg80211_wowlan_wakeup - wakeup report
2846cd8f7cb4SJohannes Berg  * @disconnect: woke up by getting disconnected
2847cd8f7cb4SJohannes Berg  * @magic_pkt: woke up by receiving magic packet
2848cd8f7cb4SJohannes Berg  * @gtk_rekey_failure: woke up by GTK rekey failure
2849cd8f7cb4SJohannes Berg  * @eap_identity_req: woke up by EAP identity request packet
2850cd8f7cb4SJohannes Berg  * @four_way_handshake: woke up by 4-way handshake
2851cd8f7cb4SJohannes Berg  * @rfkill_release: woke up by rfkill being released
2852cd8f7cb4SJohannes Berg  * @pattern_idx: pattern that caused wakeup, -1 if not due to pattern
2853cd8f7cb4SJohannes Berg  * @packet_present_len: copied wakeup packet data
2854cd8f7cb4SJohannes Berg  * @packet_len: original wakeup packet length
2855cd8f7cb4SJohannes Berg  * @packet: The packet causing the wakeup, if any.
2856cd8f7cb4SJohannes Berg  * @packet_80211:  For pattern match, magic packet and other data
2857cd8f7cb4SJohannes Berg  *	frame triggers an 802.3 frame should be reported, for
2858cd8f7cb4SJohannes Berg  *	disconnect due to deauth 802.11 frame. This indicates which
2859cd8f7cb4SJohannes Berg  *	it is.
28602a0e047eSJohannes Berg  * @tcp_match: TCP wakeup packet received
28612a0e047eSJohannes Berg  * @tcp_connlost: TCP connection lost or failed to establish
28622a0e047eSJohannes Berg  * @tcp_nomoretokens: TCP data ran out of tokens
28638cd4d456SLuciano Coelho  * @net_detect: if not %NULL, woke up because of net detect
2864cd8f7cb4SJohannes Berg  */
2865cd8f7cb4SJohannes Berg struct cfg80211_wowlan_wakeup {
2866cd8f7cb4SJohannes Berg 	bool disconnect, magic_pkt, gtk_rekey_failure,
2867cd8f7cb4SJohannes Berg 	     eap_identity_req, four_way_handshake,
28682a0e047eSJohannes Berg 	     rfkill_release, packet_80211,
28692a0e047eSJohannes Berg 	     tcp_match, tcp_connlost, tcp_nomoretokens;
2870cd8f7cb4SJohannes Berg 	s32 pattern_idx;
2871cd8f7cb4SJohannes Berg 	u32 packet_present_len, packet_len;
2872cd8f7cb4SJohannes Berg 	const void *packet;
28738cd4d456SLuciano Coelho 	struct cfg80211_wowlan_nd_info *net_detect;
2874cd8f7cb4SJohannes Berg };
2875cd8f7cb4SJohannes Berg 
2876cd8f7cb4SJohannes Berg /**
2877e5497d76SJohannes Berg  * struct cfg80211_gtk_rekey_data - rekey data
287878f686caSJohannes Berg  * @kek: key encryption key (NL80211_KEK_LEN bytes)
287978f686caSJohannes Berg  * @kck: key confirmation key (NL80211_KCK_LEN bytes)
288078f686caSJohannes Berg  * @replay_ctr: replay counter (NL80211_REPLAY_CTR_LEN bytes)
2881e5497d76SJohannes Berg  */
2882e5497d76SJohannes Berg struct cfg80211_gtk_rekey_data {
288378f686caSJohannes Berg 	const u8 *kek, *kck, *replay_ctr;
2884e5497d76SJohannes Berg };
2885e5497d76SJohannes Berg 
2886e5497d76SJohannes Berg /**
2887355199e0SJouni Malinen  * struct cfg80211_update_ft_ies_params - FT IE Information
2888355199e0SJouni Malinen  *
2889355199e0SJouni Malinen  * This structure provides information needed to update the fast transition IE
2890355199e0SJouni Malinen  *
2891355199e0SJouni Malinen  * @md: The Mobility Domain ID, 2 Octet value
2892355199e0SJouni Malinen  * @ie: Fast Transition IEs
2893355199e0SJouni Malinen  * @ie_len: Length of ft_ie in octets
2894355199e0SJouni Malinen  */
2895355199e0SJouni Malinen struct cfg80211_update_ft_ies_params {
2896355199e0SJouni Malinen 	u16 md;
2897355199e0SJouni Malinen 	const u8 *ie;
2898355199e0SJouni Malinen 	size_t ie_len;
2899355199e0SJouni Malinen };
2900355199e0SJouni Malinen 
2901355199e0SJouni Malinen /**
2902b176e629SAndrei Otcheretianski  * struct cfg80211_mgmt_tx_params - mgmt tx parameters
2903b176e629SAndrei Otcheretianski  *
2904b176e629SAndrei Otcheretianski  * This structure provides information needed to transmit a mgmt frame
2905b176e629SAndrei Otcheretianski  *
2906b176e629SAndrei Otcheretianski  * @chan: channel to use
2907b176e629SAndrei Otcheretianski  * @offchan: indicates wether off channel operation is required
2908b176e629SAndrei Otcheretianski  * @wait: duration for ROC
2909b176e629SAndrei Otcheretianski  * @buf: buffer to transmit
2910b176e629SAndrei Otcheretianski  * @len: buffer length
2911b176e629SAndrei Otcheretianski  * @no_cck: don't use cck rates for this frame
2912b176e629SAndrei Otcheretianski  * @dont_wait_for_ack: tells the low level not to wait for an ack
291334d22ce2SAndrei Otcheretianski  * @n_csa_offsets: length of csa_offsets array
291434d22ce2SAndrei Otcheretianski  * @csa_offsets: array of all the csa offsets in the frame
2915b176e629SAndrei Otcheretianski  */
2916b176e629SAndrei Otcheretianski struct cfg80211_mgmt_tx_params {
2917b176e629SAndrei Otcheretianski 	struct ieee80211_channel *chan;
2918b176e629SAndrei Otcheretianski 	bool offchan;
2919b176e629SAndrei Otcheretianski 	unsigned int wait;
2920b176e629SAndrei Otcheretianski 	const u8 *buf;
2921b176e629SAndrei Otcheretianski 	size_t len;
2922b176e629SAndrei Otcheretianski 	bool no_cck;
2923b176e629SAndrei Otcheretianski 	bool dont_wait_for_ack;
292434d22ce2SAndrei Otcheretianski 	int n_csa_offsets;
292534d22ce2SAndrei Otcheretianski 	const u16 *csa_offsets;
2926b176e629SAndrei Otcheretianski };
2927b176e629SAndrei Otcheretianski 
2928b176e629SAndrei Otcheretianski /**
2929fa9ffc74SKyeyoon Park  * struct cfg80211_dscp_exception - DSCP exception
2930fa9ffc74SKyeyoon Park  *
2931fa9ffc74SKyeyoon Park  * @dscp: DSCP value that does not adhere to the user priority range definition
2932fa9ffc74SKyeyoon Park  * @up: user priority value to which the corresponding DSCP value belongs
2933fa9ffc74SKyeyoon Park  */
2934fa9ffc74SKyeyoon Park struct cfg80211_dscp_exception {
2935fa9ffc74SKyeyoon Park 	u8 dscp;
2936fa9ffc74SKyeyoon Park 	u8 up;
2937fa9ffc74SKyeyoon Park };
2938fa9ffc74SKyeyoon Park 
2939fa9ffc74SKyeyoon Park /**
2940fa9ffc74SKyeyoon Park  * struct cfg80211_dscp_range - DSCP range definition for user priority
2941fa9ffc74SKyeyoon Park  *
2942fa9ffc74SKyeyoon Park  * @low: lowest DSCP value of this user priority range, inclusive
2943fa9ffc74SKyeyoon Park  * @high: highest DSCP value of this user priority range, inclusive
2944fa9ffc74SKyeyoon Park  */
2945fa9ffc74SKyeyoon Park struct cfg80211_dscp_range {
2946fa9ffc74SKyeyoon Park 	u8 low;
2947fa9ffc74SKyeyoon Park 	u8 high;
2948fa9ffc74SKyeyoon Park };
2949fa9ffc74SKyeyoon Park 
2950fa9ffc74SKyeyoon Park /* QoS Map Set element length defined in IEEE Std 802.11-2012, 8.4.2.97 */
2951fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_MAX_EX	21
2952fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_LEN_MIN	16
2953fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_LEN_MAX \
2954fa9ffc74SKyeyoon Park 	(IEEE80211_QOS_MAP_LEN_MIN + 2 * IEEE80211_QOS_MAP_MAX_EX)
2955fa9ffc74SKyeyoon Park 
2956fa9ffc74SKyeyoon Park /**
2957fa9ffc74SKyeyoon Park  * struct cfg80211_qos_map - QoS Map Information
2958fa9ffc74SKyeyoon Park  *
2959fa9ffc74SKyeyoon Park  * This struct defines the Interworking QoS map setting for DSCP values
2960fa9ffc74SKyeyoon Park  *
2961fa9ffc74SKyeyoon Park  * @num_des: number of DSCP exceptions (0..21)
2962fa9ffc74SKyeyoon Park  * @dscp_exception: optionally up to maximum of 21 DSCP exceptions from
2963fa9ffc74SKyeyoon Park  *	the user priority DSCP range definition
2964fa9ffc74SKyeyoon Park  * @up: DSCP range definition for a particular user priority
2965fa9ffc74SKyeyoon Park  */
2966fa9ffc74SKyeyoon Park struct cfg80211_qos_map {
2967fa9ffc74SKyeyoon Park 	u8 num_des;
2968fa9ffc74SKyeyoon Park 	struct cfg80211_dscp_exception dscp_exception[IEEE80211_QOS_MAP_MAX_EX];
2969fa9ffc74SKyeyoon Park 	struct cfg80211_dscp_range up[8];
2970fa9ffc74SKyeyoon Park };
2971fa9ffc74SKyeyoon Park 
2972fa9ffc74SKyeyoon Park /**
2973cb3b7d87SAyala Beker  * struct cfg80211_nan_conf - NAN configuration
2974cb3b7d87SAyala Beker  *
2975cb3b7d87SAyala Beker  * This struct defines NAN configuration parameters
2976cb3b7d87SAyala Beker  *
2977cb3b7d87SAyala Beker  * @master_pref: master preference (1 - 255)
29788585989dSLuca Coelho  * @bands: operating bands, a bitmap of &enum nl80211_band values.
29798585989dSLuca Coelho  *	For instance, for NL80211_BAND_2GHZ, bit 0 would be set
29808585989dSLuca Coelho  *	(i.e. BIT(NL80211_BAND_2GHZ)).
2981cb3b7d87SAyala Beker  */
2982cb3b7d87SAyala Beker struct cfg80211_nan_conf {
2983cb3b7d87SAyala Beker 	u8 master_pref;
29848585989dSLuca Coelho 	u8 bands;
2985cb3b7d87SAyala Beker };
2986cb3b7d87SAyala Beker 
2987cb3b7d87SAyala Beker /**
2988a5a9dcf2SAyala Beker  * enum cfg80211_nan_conf_changes - indicates changed fields in NAN
2989a5a9dcf2SAyala Beker  * configuration
2990a5a9dcf2SAyala Beker  *
2991a5a9dcf2SAyala Beker  * @CFG80211_NAN_CONF_CHANGED_PREF: master preference
29928585989dSLuca Coelho  * @CFG80211_NAN_CONF_CHANGED_BANDS: operating bands
2993a5a9dcf2SAyala Beker  */
2994a5a9dcf2SAyala Beker enum cfg80211_nan_conf_changes {
2995a5a9dcf2SAyala Beker 	CFG80211_NAN_CONF_CHANGED_PREF = BIT(0),
29968585989dSLuca Coelho 	CFG80211_NAN_CONF_CHANGED_BANDS = BIT(1),
2997a5a9dcf2SAyala Beker };
2998a5a9dcf2SAyala Beker 
2999a5a9dcf2SAyala Beker /**
3000a442b761SAyala Beker  * struct cfg80211_nan_func_filter - a NAN function Rx / Tx filter
3001a442b761SAyala Beker  *
3002a442b761SAyala Beker  * @filter: the content of the filter
3003a442b761SAyala Beker  * @len: the length of the filter
3004a442b761SAyala Beker  */
3005a442b761SAyala Beker struct cfg80211_nan_func_filter {
3006a442b761SAyala Beker 	const u8 *filter;
3007a442b761SAyala Beker 	u8 len;
3008a442b761SAyala Beker };
3009a442b761SAyala Beker 
3010a442b761SAyala Beker /**
3011a442b761SAyala Beker  * struct cfg80211_nan_func - a NAN function
3012a442b761SAyala Beker  *
3013a442b761SAyala Beker  * @type: &enum nl80211_nan_function_type
3014a442b761SAyala Beker  * @service_id: the service ID of the function
3015a442b761SAyala Beker  * @publish_type: &nl80211_nan_publish_type
3016a442b761SAyala Beker  * @close_range: if true, the range should be limited. Threshold is
3017a442b761SAyala Beker  *	implementation specific.
3018a442b761SAyala Beker  * @publish_bcast: if true, the solicited publish should be broadcasted
3019a442b761SAyala Beker  * @subscribe_active: if true, the subscribe is active
3020a442b761SAyala Beker  * @followup_id: the instance ID for follow up
3021a442b761SAyala Beker  * @followup_reqid: the requestor instance ID for follow up
3022a442b761SAyala Beker  * @followup_dest: MAC address of the recipient of the follow up
3023a442b761SAyala Beker  * @ttl: time to live counter in DW.
3024a442b761SAyala Beker  * @serv_spec_info: Service Specific Info
3025a442b761SAyala Beker  * @serv_spec_info_len: Service Specific Info length
3026a442b761SAyala Beker  * @srf_include: if true, SRF is inclusive
3027a442b761SAyala Beker  * @srf_bf: Bloom Filter
3028a442b761SAyala Beker  * @srf_bf_len: Bloom Filter length
3029a442b761SAyala Beker  * @srf_bf_idx: Bloom Filter index
3030a442b761SAyala Beker  * @srf_macs: SRF MAC addresses
3031a442b761SAyala Beker  * @srf_num_macs: number of MAC addresses in SRF
3032a442b761SAyala Beker  * @rx_filters: rx filters that are matched with corresponding peer's tx_filter
3033a442b761SAyala Beker  * @tx_filters: filters that should be transmitted in the SDF.
3034a442b761SAyala Beker  * @num_rx_filters: length of &rx_filters.
3035a442b761SAyala Beker  * @num_tx_filters: length of &tx_filters.
3036a442b761SAyala Beker  * @instance_id: driver allocated id of the function.
3037a442b761SAyala Beker  * @cookie: unique NAN function identifier.
3038a442b761SAyala Beker  */
3039a442b761SAyala Beker struct cfg80211_nan_func {
3040a442b761SAyala Beker 	enum nl80211_nan_function_type type;
3041a442b761SAyala Beker 	u8 service_id[NL80211_NAN_FUNC_SERVICE_ID_LEN];
3042a442b761SAyala Beker 	u8 publish_type;
3043a442b761SAyala Beker 	bool close_range;
3044a442b761SAyala Beker 	bool publish_bcast;
3045a442b761SAyala Beker 	bool subscribe_active;
3046a442b761SAyala Beker 	u8 followup_id;
3047a442b761SAyala Beker 	u8 followup_reqid;
3048a442b761SAyala Beker 	struct mac_address followup_dest;
3049a442b761SAyala Beker 	u32 ttl;
3050a442b761SAyala Beker 	const u8 *serv_spec_info;
3051a442b761SAyala Beker 	u8 serv_spec_info_len;
3052a442b761SAyala Beker 	bool srf_include;
3053a442b761SAyala Beker 	const u8 *srf_bf;
3054a442b761SAyala Beker 	u8 srf_bf_len;
3055a442b761SAyala Beker 	u8 srf_bf_idx;
3056a442b761SAyala Beker 	struct mac_address *srf_macs;
3057a442b761SAyala Beker 	int srf_num_macs;
3058a442b761SAyala Beker 	struct cfg80211_nan_func_filter *rx_filters;
3059a442b761SAyala Beker 	struct cfg80211_nan_func_filter *tx_filters;
3060a442b761SAyala Beker 	u8 num_tx_filters;
3061a442b761SAyala Beker 	u8 num_rx_filters;
3062a442b761SAyala Beker 	u8 instance_id;
3063a442b761SAyala Beker 	u64 cookie;
3064a442b761SAyala Beker };
3065a442b761SAyala Beker 
3066a442b761SAyala Beker /**
30673a00df57SAvraham Stern  * struct cfg80211_pmk_conf - PMK configuration
30683a00df57SAvraham Stern  *
30693a00df57SAvraham Stern  * @aa: authenticator address
30703a00df57SAvraham Stern  * @pmk_len: PMK length in bytes.
30713a00df57SAvraham Stern  * @pmk: the PMK material
30723a00df57SAvraham Stern  * @pmk_r0_name: PMK-R0 Name. NULL if not applicable (i.e., the PMK
30733a00df57SAvraham Stern  *	is not PMK-R0). When pmk_r0_name is not NULL, the pmk field
30743a00df57SAvraham Stern  *	holds PMK-R0.
30753a00df57SAvraham Stern  */
30763a00df57SAvraham Stern struct cfg80211_pmk_conf {
30773a00df57SAvraham Stern 	const u8 *aa;
30783a00df57SAvraham Stern 	u8 pmk_len;
30793a00df57SAvraham Stern 	const u8 *pmk;
30803a00df57SAvraham Stern 	const u8 *pmk_r0_name;
30813a00df57SAvraham Stern };
30823a00df57SAvraham Stern 
30833a00df57SAvraham Stern /**
308440cbfa90SSrinivas Dasari  * struct cfg80211_external_auth_params - Trigger External authentication.
308540cbfa90SSrinivas Dasari  *
308640cbfa90SSrinivas Dasari  * Commonly used across the external auth request and event interfaces.
308740cbfa90SSrinivas Dasari  *
308840cbfa90SSrinivas Dasari  * @action: action type / trigger for external authentication. Only significant
308940cbfa90SSrinivas Dasari  *	for the authentication request event interface (driver to user space).
309040cbfa90SSrinivas Dasari  * @bssid: BSSID of the peer with which the authentication has
309140cbfa90SSrinivas Dasari  *	to happen. Used by both the authentication request event and
309240cbfa90SSrinivas Dasari  *	authentication response command interface.
309340cbfa90SSrinivas Dasari  * @ssid: SSID of the AP.  Used by both the authentication request event and
309440cbfa90SSrinivas Dasari  *	authentication response command interface.
309540cbfa90SSrinivas Dasari  * @key_mgmt_suite: AKM suite of the respective authentication. Used by the
309640cbfa90SSrinivas Dasari  *	authentication request event interface.
309740cbfa90SSrinivas Dasari  * @status: status code, %WLAN_STATUS_SUCCESS for successful authentication,
309840cbfa90SSrinivas Dasari  *	use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space cannot give you
309940cbfa90SSrinivas Dasari  *	the real status code for failures. Used only for the authentication
310040cbfa90SSrinivas Dasari  *	response command interface (user space to driver).
3101fe494370SSrinivas Dasari  * @pmkid: The identifier to refer a PMKSA.
310240cbfa90SSrinivas Dasari  */
310340cbfa90SSrinivas Dasari struct cfg80211_external_auth_params {
310440cbfa90SSrinivas Dasari 	enum nl80211_external_auth_action action;
310540cbfa90SSrinivas Dasari 	u8 bssid[ETH_ALEN] __aligned(2);
310640cbfa90SSrinivas Dasari 	struct cfg80211_ssid ssid;
310740cbfa90SSrinivas Dasari 	unsigned int key_mgmt_suite;
310840cbfa90SSrinivas Dasari 	u16 status;
3109fe494370SSrinivas Dasari 	const u8 *pmkid;
311040cbfa90SSrinivas Dasari };
311140cbfa90SSrinivas Dasari 
311240cbfa90SSrinivas Dasari /**
31133453de98SRandy Dunlap  * struct cfg80211_ftm_responder_stats - FTM responder statistics
311481e54d08SPradeep Kumar Chitrapu  *
311581e54d08SPradeep Kumar Chitrapu  * @filled: bitflag of flags using the bits of &enum nl80211_ftm_stats to
311681e54d08SPradeep Kumar Chitrapu  *	indicate the relevant values in this struct for them
311781e54d08SPradeep Kumar Chitrapu  * @success_num: number of FTM sessions in which all frames were successfully
311881e54d08SPradeep Kumar Chitrapu  *	answered
311981e54d08SPradeep Kumar Chitrapu  * @partial_num: number of FTM sessions in which part of frames were
312081e54d08SPradeep Kumar Chitrapu  *	successfully answered
312181e54d08SPradeep Kumar Chitrapu  * @failed_num: number of failed FTM sessions
312281e54d08SPradeep Kumar Chitrapu  * @asap_num: number of ASAP FTM sessions
312381e54d08SPradeep Kumar Chitrapu  * @non_asap_num: number of  non-ASAP FTM sessions
312481e54d08SPradeep Kumar Chitrapu  * @total_duration_ms: total sessions durations - gives an indication
312581e54d08SPradeep Kumar Chitrapu  *	of how much time the responder was busy
312681e54d08SPradeep Kumar Chitrapu  * @unknown_triggers_num: number of unknown FTM triggers - triggers from
312781e54d08SPradeep Kumar Chitrapu  *	initiators that didn't finish successfully the negotiation phase with
312881e54d08SPradeep Kumar Chitrapu  *	the responder
312981e54d08SPradeep Kumar Chitrapu  * @reschedule_requests_num: number of FTM reschedule requests - initiator asks
313081e54d08SPradeep Kumar Chitrapu  *	for a new scheduling although it already has scheduled FTM slot
313181e54d08SPradeep Kumar Chitrapu  * @out_of_window_triggers_num: total FTM triggers out of scheduled window
313281e54d08SPradeep Kumar Chitrapu  */
313381e54d08SPradeep Kumar Chitrapu struct cfg80211_ftm_responder_stats {
313481e54d08SPradeep Kumar Chitrapu 	u32 filled;
313581e54d08SPradeep Kumar Chitrapu 	u32 success_num;
313681e54d08SPradeep Kumar Chitrapu 	u32 partial_num;
313781e54d08SPradeep Kumar Chitrapu 	u32 failed_num;
313881e54d08SPradeep Kumar Chitrapu 	u32 asap_num;
313981e54d08SPradeep Kumar Chitrapu 	u32 non_asap_num;
314081e54d08SPradeep Kumar Chitrapu 	u64 total_duration_ms;
314181e54d08SPradeep Kumar Chitrapu 	u32 unknown_triggers_num;
314281e54d08SPradeep Kumar Chitrapu 	u32 reschedule_requests_num;
314381e54d08SPradeep Kumar Chitrapu 	u32 out_of_window_triggers_num;
314481e54d08SPradeep Kumar Chitrapu };
314581e54d08SPradeep Kumar Chitrapu 
314681e54d08SPradeep Kumar Chitrapu /**
31479bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_ftm_result - FTM result
31489bb7e0f2SJohannes Berg  * @failure_reason: if this measurement failed (PMSR status is
31499bb7e0f2SJohannes Berg  *	%NL80211_PMSR_STATUS_FAILURE), this gives a more precise
31509bb7e0f2SJohannes Berg  *	reason than just "failure"
31519bb7e0f2SJohannes Berg  * @burst_index: if reporting partial results, this is the index
31529bb7e0f2SJohannes Berg  *	in [0 .. num_bursts-1] of the burst that's being reported
31539bb7e0f2SJohannes Berg  * @num_ftmr_attempts: number of FTM request frames transmitted
31549bb7e0f2SJohannes Berg  * @num_ftmr_successes: number of FTM request frames acked
31559bb7e0f2SJohannes Berg  * @busy_retry_time: if failure_reason is %NL80211_PMSR_FTM_FAILURE_PEER_BUSY,
31569bb7e0f2SJohannes Berg  *	fill this to indicate in how many seconds a retry is deemed possible
31579bb7e0f2SJohannes Berg  *	by the responder
31589bb7e0f2SJohannes Berg  * @num_bursts_exp: actual number of bursts exponent negotiated
31599bb7e0f2SJohannes Berg  * @burst_duration: actual burst duration negotiated
31609bb7e0f2SJohannes Berg  * @ftms_per_burst: actual FTMs per burst negotiated
31619bb7e0f2SJohannes Berg  * @lci_len: length of LCI information (if present)
31629bb7e0f2SJohannes Berg  * @civicloc_len: length of civic location information (if present)
31639bb7e0f2SJohannes Berg  * @lci: LCI data (may be %NULL)
31649bb7e0f2SJohannes Berg  * @civicloc: civic location data (may be %NULL)
31659bb7e0f2SJohannes Berg  * @rssi_avg: average RSSI over FTM action frames reported
31669bb7e0f2SJohannes Berg  * @rssi_spread: spread of the RSSI over FTM action frames reported
31679bb7e0f2SJohannes Berg  * @tx_rate: bitrate for transmitted FTM action frame response
31689bb7e0f2SJohannes Berg  * @rx_rate: bitrate of received FTM action frame
31699bb7e0f2SJohannes Berg  * @rtt_avg: average of RTTs measured (must have either this or @dist_avg)
31709bb7e0f2SJohannes Berg  * @rtt_variance: variance of RTTs measured (note that standard deviation is
31719bb7e0f2SJohannes Berg  *	the square root of the variance)
31729bb7e0f2SJohannes Berg  * @rtt_spread: spread of the RTTs measured
31739bb7e0f2SJohannes Berg  * @dist_avg: average of distances (mm) measured
31749bb7e0f2SJohannes Berg  *	(must have either this or @rtt_avg)
31759bb7e0f2SJohannes Berg  * @dist_variance: variance of distances measured (see also @rtt_variance)
31769bb7e0f2SJohannes Berg  * @dist_spread: spread of distances measured (see also @rtt_spread)
31779bb7e0f2SJohannes Berg  * @num_ftmr_attempts_valid: @num_ftmr_attempts is valid
31789bb7e0f2SJohannes Berg  * @num_ftmr_successes_valid: @num_ftmr_successes is valid
31799bb7e0f2SJohannes Berg  * @rssi_avg_valid: @rssi_avg is valid
31809bb7e0f2SJohannes Berg  * @rssi_spread_valid: @rssi_spread is valid
31819bb7e0f2SJohannes Berg  * @tx_rate_valid: @tx_rate is valid
31829bb7e0f2SJohannes Berg  * @rx_rate_valid: @rx_rate is valid
31839bb7e0f2SJohannes Berg  * @rtt_avg_valid: @rtt_avg is valid
31849bb7e0f2SJohannes Berg  * @rtt_variance_valid: @rtt_variance is valid
31859bb7e0f2SJohannes Berg  * @rtt_spread_valid: @rtt_spread is valid
31869bb7e0f2SJohannes Berg  * @dist_avg_valid: @dist_avg is valid
31879bb7e0f2SJohannes Berg  * @dist_variance_valid: @dist_variance is valid
31889bb7e0f2SJohannes Berg  * @dist_spread_valid: @dist_spread is valid
31899bb7e0f2SJohannes Berg  */
31909bb7e0f2SJohannes Berg struct cfg80211_pmsr_ftm_result {
31919bb7e0f2SJohannes Berg 	const u8 *lci;
31929bb7e0f2SJohannes Berg 	const u8 *civicloc;
31939bb7e0f2SJohannes Berg 	unsigned int lci_len;
31949bb7e0f2SJohannes Berg 	unsigned int civicloc_len;
31959bb7e0f2SJohannes Berg 	enum nl80211_peer_measurement_ftm_failure_reasons failure_reason;
31969bb7e0f2SJohannes Berg 	u32 num_ftmr_attempts, num_ftmr_successes;
31979bb7e0f2SJohannes Berg 	s16 burst_index;
31989bb7e0f2SJohannes Berg 	u8 busy_retry_time;
31999bb7e0f2SJohannes Berg 	u8 num_bursts_exp;
32009bb7e0f2SJohannes Berg 	u8 burst_duration;
32019bb7e0f2SJohannes Berg 	u8 ftms_per_burst;
32029bb7e0f2SJohannes Berg 	s32 rssi_avg;
32039bb7e0f2SJohannes Berg 	s32 rssi_spread;
32049bb7e0f2SJohannes Berg 	struct rate_info tx_rate, rx_rate;
32059bb7e0f2SJohannes Berg 	s64 rtt_avg;
32069bb7e0f2SJohannes Berg 	s64 rtt_variance;
32079bb7e0f2SJohannes Berg 	s64 rtt_spread;
32089bb7e0f2SJohannes Berg 	s64 dist_avg;
32099bb7e0f2SJohannes Berg 	s64 dist_variance;
32109bb7e0f2SJohannes Berg 	s64 dist_spread;
32119bb7e0f2SJohannes Berg 
32129bb7e0f2SJohannes Berg 	u16 num_ftmr_attempts_valid:1,
32139bb7e0f2SJohannes Berg 	    num_ftmr_successes_valid:1,
32149bb7e0f2SJohannes Berg 	    rssi_avg_valid:1,
32159bb7e0f2SJohannes Berg 	    rssi_spread_valid:1,
32169bb7e0f2SJohannes Berg 	    tx_rate_valid:1,
32179bb7e0f2SJohannes Berg 	    rx_rate_valid:1,
32189bb7e0f2SJohannes Berg 	    rtt_avg_valid:1,
32199bb7e0f2SJohannes Berg 	    rtt_variance_valid:1,
32209bb7e0f2SJohannes Berg 	    rtt_spread_valid:1,
32219bb7e0f2SJohannes Berg 	    dist_avg_valid:1,
32229bb7e0f2SJohannes Berg 	    dist_variance_valid:1,
32239bb7e0f2SJohannes Berg 	    dist_spread_valid:1;
32249bb7e0f2SJohannes Berg };
32259bb7e0f2SJohannes Berg 
32269bb7e0f2SJohannes Berg /**
32279bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_result - peer measurement result
32289bb7e0f2SJohannes Berg  * @addr: address of the peer
32299bb7e0f2SJohannes Berg  * @host_time: host time (use ktime_get_boottime() adjust to the time when the
32309bb7e0f2SJohannes Berg  *	measurement was made)
32319bb7e0f2SJohannes Berg  * @ap_tsf: AP's TSF at measurement time
32329bb7e0f2SJohannes Berg  * @status: status of the measurement
32339bb7e0f2SJohannes Berg  * @final: if reporting partial results, mark this as the last one; if not
32349bb7e0f2SJohannes Berg  *	reporting partial results always set this flag
32359bb7e0f2SJohannes Berg  * @ap_tsf_valid: indicates the @ap_tsf value is valid
32369bb7e0f2SJohannes Berg  * @type: type of the measurement reported, note that we only support reporting
32379bb7e0f2SJohannes Berg  *	one type at a time, but you can report multiple results separately and
32389bb7e0f2SJohannes Berg  *	they're all aggregated for userspace.
32399bb7e0f2SJohannes Berg  */
32409bb7e0f2SJohannes Berg struct cfg80211_pmsr_result {
32419bb7e0f2SJohannes Berg 	u64 host_time, ap_tsf;
32429bb7e0f2SJohannes Berg 	enum nl80211_peer_measurement_status status;
32439bb7e0f2SJohannes Berg 
32449bb7e0f2SJohannes Berg 	u8 addr[ETH_ALEN];
32459bb7e0f2SJohannes Berg 
32469bb7e0f2SJohannes Berg 	u8 final:1,
32479bb7e0f2SJohannes Berg 	   ap_tsf_valid:1;
32489bb7e0f2SJohannes Berg 
32499bb7e0f2SJohannes Berg 	enum nl80211_peer_measurement_type type;
32509bb7e0f2SJohannes Berg 
32519bb7e0f2SJohannes Berg 	union {
32529bb7e0f2SJohannes Berg 		struct cfg80211_pmsr_ftm_result ftm;
32539bb7e0f2SJohannes Berg 	};
32549bb7e0f2SJohannes Berg };
32559bb7e0f2SJohannes Berg 
32569bb7e0f2SJohannes Berg /**
32579bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_ftm_request_peer - FTM request data
32589bb7e0f2SJohannes Berg  * @requested: indicates FTM is requested
32599bb7e0f2SJohannes Berg  * @preamble: frame preamble to use
32609bb7e0f2SJohannes Berg  * @burst_period: burst period to use
32619bb7e0f2SJohannes Berg  * @asap: indicates to use ASAP mode
32629bb7e0f2SJohannes Berg  * @num_bursts_exp: number of bursts exponent
32639bb7e0f2SJohannes Berg  * @burst_duration: burst duration
32649bb7e0f2SJohannes Berg  * @ftms_per_burst: number of FTMs per burst
32659bb7e0f2SJohannes Berg  * @ftmr_retries: number of retries for FTM request
32669bb7e0f2SJohannes Berg  * @request_lci: request LCI information
32679bb7e0f2SJohannes Berg  * @request_civicloc: request civic location information
32689bb7e0f2SJohannes Berg  *
32699bb7e0f2SJohannes Berg  * See also nl80211 for the respective attribute documentation.
32709bb7e0f2SJohannes Berg  */
32719bb7e0f2SJohannes Berg struct cfg80211_pmsr_ftm_request_peer {
32729bb7e0f2SJohannes Berg 	enum nl80211_preamble preamble;
32739bb7e0f2SJohannes Berg 	u16 burst_period;
32749bb7e0f2SJohannes Berg 	u8 requested:1,
32759bb7e0f2SJohannes Berg 	   asap:1,
32769bb7e0f2SJohannes Berg 	   request_lci:1,
32779bb7e0f2SJohannes Berg 	   request_civicloc:1;
32789bb7e0f2SJohannes Berg 	u8 num_bursts_exp;
32799bb7e0f2SJohannes Berg 	u8 burst_duration;
32809bb7e0f2SJohannes Berg 	u8 ftms_per_burst;
32819bb7e0f2SJohannes Berg 	u8 ftmr_retries;
32829bb7e0f2SJohannes Berg };
32839bb7e0f2SJohannes Berg 
32849bb7e0f2SJohannes Berg /**
32859bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_request_peer - peer data for a peer measurement request
32869bb7e0f2SJohannes Berg  * @addr: MAC address
32879bb7e0f2SJohannes Berg  * @chandef: channel to use
32889bb7e0f2SJohannes Berg  * @report_ap_tsf: report the associated AP's TSF
32899bb7e0f2SJohannes Berg  * @ftm: FTM data, see &struct cfg80211_pmsr_ftm_request_peer
32909bb7e0f2SJohannes Berg  */
32919bb7e0f2SJohannes Berg struct cfg80211_pmsr_request_peer {
32929bb7e0f2SJohannes Berg 	u8 addr[ETH_ALEN];
32939bb7e0f2SJohannes Berg 	struct cfg80211_chan_def chandef;
32949bb7e0f2SJohannes Berg 	u8 report_ap_tsf:1;
32959bb7e0f2SJohannes Berg 	struct cfg80211_pmsr_ftm_request_peer ftm;
32969bb7e0f2SJohannes Berg };
32979bb7e0f2SJohannes Berg 
32989bb7e0f2SJohannes Berg /**
32999bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_request - peer measurement request
33009bb7e0f2SJohannes Berg  * @cookie: cookie, set by cfg80211
33019bb7e0f2SJohannes Berg  * @nl_portid: netlink portid - used by cfg80211
33029bb7e0f2SJohannes Berg  * @drv_data: driver data for this request, if required for aborting,
33039bb7e0f2SJohannes Berg  *	not otherwise freed or anything by cfg80211
33049bb7e0f2SJohannes Berg  * @mac_addr: MAC address used for (randomised) request
33059bb7e0f2SJohannes Berg  * @mac_addr_mask: MAC address mask used for randomisation, bits that
33069bb7e0f2SJohannes Berg  *	are 0 in the mask should be randomised, bits that are 1 should
33079bb7e0f2SJohannes Berg  *	be taken from the @mac_addr
33089bb7e0f2SJohannes Berg  * @list: used by cfg80211 to hold on to the request
33099bb7e0f2SJohannes Berg  * @timeout: timeout (in milliseconds) for the whole operation, if
33109bb7e0f2SJohannes Berg  *	zero it means there's no timeout
33119bb7e0f2SJohannes Berg  * @n_peers: number of peers to do measurements with
33129bb7e0f2SJohannes Berg  * @peers: per-peer measurement request data
33139bb7e0f2SJohannes Berg  */
33149bb7e0f2SJohannes Berg struct cfg80211_pmsr_request {
33159bb7e0f2SJohannes Berg 	u64 cookie;
33169bb7e0f2SJohannes Berg 	void *drv_data;
33179bb7e0f2SJohannes Berg 	u32 n_peers;
33189bb7e0f2SJohannes Berg 	u32 nl_portid;
33199bb7e0f2SJohannes Berg 
33209bb7e0f2SJohannes Berg 	u32 timeout;
33219bb7e0f2SJohannes Berg 
33229bb7e0f2SJohannes Berg 	u8 mac_addr[ETH_ALEN] __aligned(2);
33239bb7e0f2SJohannes Berg 	u8 mac_addr_mask[ETH_ALEN] __aligned(2);
33249bb7e0f2SJohannes Berg 
33259bb7e0f2SJohannes Berg 	struct list_head list;
33269bb7e0f2SJohannes Berg 
33279bb7e0f2SJohannes Berg 	struct cfg80211_pmsr_request_peer peers[];
33289bb7e0f2SJohannes Berg };
33299bb7e0f2SJohannes Berg 
33309bb7e0f2SJohannes Berg /**
3331cb74e977SSunil Dutt  * struct cfg80211_update_owe_info - OWE Information
3332cb74e977SSunil Dutt  *
3333cb74e977SSunil Dutt  * This structure provides information needed for the drivers to offload OWE
3334cb74e977SSunil Dutt  * (Opportunistic Wireless Encryption) processing to the user space.
3335cb74e977SSunil Dutt  *
3336cb74e977SSunil Dutt  * Commonly used across update_owe_info request and event interfaces.
3337cb74e977SSunil Dutt  *
3338cb74e977SSunil Dutt  * @peer: MAC address of the peer device for which the OWE processing
3339cb74e977SSunil Dutt  *	has to be done.
3340cb74e977SSunil Dutt  * @status: status code, %WLAN_STATUS_SUCCESS for successful OWE info
3341cb74e977SSunil Dutt  *	processing, use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space
3342cb74e977SSunil Dutt  *	cannot give you the real status code for failures. Used only for
3343cb74e977SSunil Dutt  *	OWE update request command interface (user space to driver).
3344cb74e977SSunil Dutt  * @ie: IEs obtained from the peer or constructed by the user space. These are
3345cb74e977SSunil Dutt  *	the IEs of the remote peer in the event from the host driver and
3346cb74e977SSunil Dutt  *	the constructed IEs by the user space in the request interface.
3347cb74e977SSunil Dutt  * @ie_len: Length of IEs in octets.
3348cb74e977SSunil Dutt  */
3349cb74e977SSunil Dutt struct cfg80211_update_owe_info {
3350cb74e977SSunil Dutt 	u8 peer[ETH_ALEN] __aligned(2);
3351cb74e977SSunil Dutt 	u16 status;
3352cb74e977SSunil Dutt 	const u8 *ie;
3353cb74e977SSunil Dutt 	size_t ie_len;
3354cb74e977SSunil Dutt };
3355cb74e977SSunil Dutt 
3356cb74e977SSunil Dutt /**
3357704232c2SJohannes Berg  * struct cfg80211_ops - backend description for wireless configuration
3358704232c2SJohannes Berg  *
3359704232c2SJohannes Berg  * This struct is registered by fullmac card drivers and/or wireless stacks
3360704232c2SJohannes Berg  * in order to handle configuration requests on their interfaces.
3361704232c2SJohannes Berg  *
3362704232c2SJohannes Berg  * All callbacks except where otherwise noted should return 0
3363704232c2SJohannes Berg  * on success or a negative error code.
3364704232c2SJohannes Berg  *
336543fb45cbSJohannes Berg  * All operations are currently invoked under rtnl for consistency with the
336643fb45cbSJohannes Berg  * wireless extensions but this is subject to reevaluation as soon as this
336743fb45cbSJohannes Berg  * code is used more widely and we have a first user without wext.
336843fb45cbSJohannes Berg  *
3369ff1b6e69SJohannes Berg  * @suspend: wiphy device needs to be suspended. The variable @wow will
3370ff1b6e69SJohannes Berg  *	be %NULL or contain the enabled Wake-on-Wireless triggers that are
3371ff1b6e69SJohannes Berg  *	configured for the device.
33720378b3f1SJohannes Berg  * @resume: wiphy device needs to be resumed
33736d52563fSJohannes Berg  * @set_wakeup: Called when WoWLAN is enabled/disabled, use this callback
33746d52563fSJohannes Berg  *	to call device_set_wakeup_enable() to enable/disable wakeup from
33756d52563fSJohannes Berg  *	the device.
33760378b3f1SJohannes Berg  *
337760719ffdSJohannes Berg  * @add_virtual_intf: create a new virtual interface with the given name,
3378463d0183SJohannes Berg  *	must set the struct wireless_dev's iftype. Beware: You must create
337984efbb84SJohannes Berg  *	the new netdev in the wiphy's network namespace! Returns the struct
338098104fdeSJohannes Berg  *	wireless_dev, or an ERR_PTR. For P2P device wdevs, the driver must
338198104fdeSJohannes Berg  *	also set the address member in the wdev.
3382704232c2SJohannes Berg  *
338384efbb84SJohannes Berg  * @del_virtual_intf: remove the virtual interface
338455682965SJohannes Berg  *
338560719ffdSJohannes Berg  * @change_virtual_intf: change type/configuration of virtual interface,
338660719ffdSJohannes Berg  *	keep the struct wireless_dev's iftype updated.
338755682965SJohannes Berg  *
338841ade00fSJohannes Berg  * @add_key: add a key with the given parameters. @mac_addr will be %NULL
338941ade00fSJohannes Berg  *	when adding a group key.
339041ade00fSJohannes Berg  *
339141ade00fSJohannes Berg  * @get_key: get information about the key with the given parameters.
339241ade00fSJohannes Berg  *	@mac_addr will be %NULL when requesting information for a group
339341ade00fSJohannes Berg  *	key. All pointers given to the @callback function need not be valid
3394e3da574aSJohannes Berg  *	after it returns. This function should return an error if it is
3395e3da574aSJohannes Berg  *	not possible to retrieve the key, -ENOENT if it doesn't exist.
339641ade00fSJohannes Berg  *
339741ade00fSJohannes Berg  * @del_key: remove a key given the @mac_addr (%NULL for a group key)
3398e3da574aSJohannes Berg  *	and @key_index, return -ENOENT if the key doesn't exist.
339941ade00fSJohannes Berg  *
340041ade00fSJohannes Berg  * @set_default_key: set the default key on an interface
3401ed1b6cc7SJohannes Berg  *
34023cfcf6acSJouni Malinen  * @set_default_mgmt_key: set the default management frame key on an interface
340356be393fSJouni Malinen 
340456be393fSJouni Malinen  * @set_default_beacon_key: set the default Beacon frame key on an interface
34053cfcf6acSJouni Malinen  *
3406e5497d76SJohannes Berg  * @set_rekey_data: give the data necessary for GTK rekeying to the driver
3407e5497d76SJohannes Berg  *
3408c04a4ff7SJohannes Berg  * @start_ap: Start acting in AP mode defined by the parameters.
3409c04a4ff7SJohannes Berg  * @change_beacon: Change the beacon parameters for an access point mode
3410c04a4ff7SJohannes Berg  *	interface. This should reject the call when AP mode wasn't started.
3411c04a4ff7SJohannes Berg  * @stop_ap: Stop being an AP, including stopping beaconing.
34125727ef1bSJohannes Berg  *
34135727ef1bSJohannes Berg  * @add_station: Add a new station.
341489c771e5SJouni Malinen  * @del_station: Remove a station
3415bdd90d5eSJohannes Berg  * @change_station: Modify a given station. Note that flags changes are not much
3416bdd90d5eSJohannes Berg  *	validated in cfg80211, in particular the auth/assoc/authorized flags
3417bdd90d5eSJohannes Berg  *	might come to the driver in invalid combinations -- make sure to check
341877ee7c89SJohannes Berg  *	them, also against the existing state! Drivers must call
341977ee7c89SJohannes Berg  *	cfg80211_check_station_change() to validate the information.
3420abe37c4bSJohannes Berg  * @get_station: get station information for the station identified by @mac
3421abe37c4bSJohannes Berg  * @dump_station: dump station callback -- resume dump at index @idx
3422abe37c4bSJohannes Berg  *
3423abe37c4bSJohannes Berg  * @add_mpath: add a fixed mesh path
3424abe37c4bSJohannes Berg  * @del_mpath: delete a given mesh path
3425abe37c4bSJohannes Berg  * @change_mpath: change a given mesh path
3426abe37c4bSJohannes Berg  * @get_mpath: get a mesh path for the given parameters
3427abe37c4bSJohannes Berg  * @dump_mpath: dump mesh path callback -- resume dump at index @idx
342866be7d2bSHenning Rogge  * @get_mpp: get a mesh proxy path for the given parameters
342966be7d2bSHenning Rogge  * @dump_mpp: dump mesh proxy path callback -- resume dump at index @idx
3430f52555a4SJohannes Berg  * @join_mesh: join the mesh network with the specified parameters
34318d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
3432f52555a4SJohannes Berg  * @leave_mesh: leave the current mesh network
34338d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
34342ec600d6SLuis Carlos Cobo  *
343524bdd9f4SJavier Cardona  * @get_mesh_config: Get the current mesh configuration
343693da9cc1Scolin@cozybit.com  *
343724bdd9f4SJavier Cardona  * @update_mesh_config: Update mesh parameters on a running mesh.
343893da9cc1Scolin@cozybit.com  *	The mask is a bitfield which tells us which parameters to
343993da9cc1Scolin@cozybit.com  *	set, and which to leave alone.
344093da9cc1Scolin@cozybit.com  *
34419f1ba906SJouni Malinen  * @change_bss: Modify parameters for a given BSS.
344231888487SJouni Malinen  *
344331888487SJouni Malinen  * @set_txq_params: Set TX queue parameters
344472bdcf34SJouni Malinen  *
3445e8c9bd5bSJohannes Berg  * @libertas_set_mesh_channel: Only for backward compatibility for libertas,
3446e8c9bd5bSJohannes Berg  *	as it doesn't implement join_mesh and needs to set the channel to
3447e8c9bd5bSJohannes Berg  *	join the mesh instead.
3448e8c9bd5bSJohannes Berg  *
3449e8c9bd5bSJohannes Berg  * @set_monitor_channel: Set the monitor mode channel for the device. If other
3450e8c9bd5bSJohannes Berg  *	interfaces are active this callback should reject the configuration.
3451e8c9bd5bSJohannes Berg  *	If no interfaces are active or the device is down, the channel should
3452e8c9bd5bSJohannes Berg  *	be stored for when a monitor interface becomes active.
34539aed3cc1SJouni Malinen  *
34542a519311SJohannes Berg  * @scan: Request to do a scan. If returning zero, the scan request is given
34552a519311SJohannes Berg  *	the driver, and will be valid until passed to cfg80211_scan_done().
34562a519311SJohannes Berg  *	For scan results, call cfg80211_inform_bss(); you can call this outside
34572a519311SJohannes Berg  *	the scan/scan_done bracket too.
345891d3ab46SVidyullatha Kanchanapally  * @abort_scan: Tell the driver to abort an ongoing scan. The driver shall
345991d3ab46SVidyullatha Kanchanapally  *	indicate the status of the scan through cfg80211_scan_done().
3460636a5d36SJouni Malinen  *
3461636a5d36SJouni Malinen  * @auth: Request to authenticate with the specified peer
34628d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
3463636a5d36SJouni Malinen  * @assoc: Request to (re)associate with the specified peer
34648d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
3465636a5d36SJouni Malinen  * @deauth: Request to deauthenticate from the specified peer
34668d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
3467636a5d36SJouni Malinen  * @disassoc: Request to disassociate from the specified peer
34688d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
346904a773adSJohannes Berg  *
3470b23aa676SSamuel Ortiz  * @connect: Connect to the ESS with the specified parameters. When connected,
3471bf1ecd21SJouni Malinen  *	call cfg80211_connect_result()/cfg80211_connect_bss() with status code
3472bf1ecd21SJouni Malinen  *	%WLAN_STATUS_SUCCESS. If the connection fails for some reason, call
3473bf1ecd21SJouni Malinen  *	cfg80211_connect_result()/cfg80211_connect_bss() with the status code
3474bf1ecd21SJouni Malinen  *	from the AP or cfg80211_connect_timeout() if no frame with status code
3475bf1ecd21SJouni Malinen  *	was received.
3476bf1ecd21SJouni Malinen  *	The driver is allowed to roam to other BSSes within the ESS when the
3477bf1ecd21SJouni Malinen  *	other BSS matches the connect parameters. When such roaming is initiated
3478bf1ecd21SJouni Malinen  *	by the driver, the driver is expected to verify that the target matches
3479bf1ecd21SJouni Malinen  *	the configured security parameters and to use Reassociation Request
3480bf1ecd21SJouni Malinen  *	frame instead of Association Request frame.
3481bf1ecd21SJouni Malinen  *	The connect function can also be used to request the driver to perform a
3482bf1ecd21SJouni Malinen  *	specific roam when connected to an ESS. In that case, the prev_bssid
348335eb8f7bSJouni Malinen  *	parameter is set to the BSSID of the currently associated BSS as an
3484bf1ecd21SJouni Malinen  *	indication of requesting reassociation.
3485bf1ecd21SJouni Malinen  *	In both the driver-initiated and new connect() call initiated roaming
3486bf1ecd21SJouni Malinen  *	cases, the result of roaming is indicated with a call to
348729ce6ecbSAvraham Stern  *	cfg80211_roamed(). (invoked with the wireless_dev mutex held)
3488088e8df8Svamsi krishna  * @update_connect_params: Update the connect parameters while connected to a
3489088e8df8Svamsi krishna  *	BSS. The updated parameters can be used by driver/firmware for
3490088e8df8Svamsi krishna  *	subsequent BSS selection (roaming) decisions and to form the
3491088e8df8Svamsi krishna  *	Authentication/(Re)Association Request frames. This call does not
3492088e8df8Svamsi krishna  *	request an immediate disassociation or reassociation with the current
3493088e8df8Svamsi krishna  *	BSS, i.e., this impacts only subsequent (re)associations. The bits in
3494088e8df8Svamsi krishna  *	changed are defined in &enum cfg80211_connect_params_changed.
3495088e8df8Svamsi krishna  *	(invoked with the wireless_dev mutex held)
34960711d638SIlan Peer  * @disconnect: Disconnect from the BSS/ESS or stop connection attempts if
34970711d638SIlan Peer  *      connection is in progress. Once done, call cfg80211_disconnected() in
34980711d638SIlan Peer  *      case connection was already established (invoked with the
34990711d638SIlan Peer  *      wireless_dev mutex held), otherwise call cfg80211_connect_timeout().
3500b23aa676SSamuel Ortiz  *
350104a773adSJohannes Berg  * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call
350204a773adSJohannes Berg  *	cfg80211_ibss_joined(), also call that function when changing BSSID due
350304a773adSJohannes Berg  *	to a merge.
35048d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
350504a773adSJohannes Berg  * @leave_ibss: Leave the IBSS.
35068d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
3507b9a5f8caSJouni Malinen  *
3508f4e583c8SAntonio Quartulli  * @set_mcast_rate: Set the specified multicast rate (only if vif is in ADHOC or
3509f4e583c8SAntonio Quartulli  *	MESH mode)
3510f4e583c8SAntonio Quartulli  *
3511b9a5f8caSJouni Malinen  * @set_wiphy_params: Notify that wiphy parameters have changed;
3512b9a5f8caSJouni Malinen  *	@changed bitfield (see &enum wiphy_params_flags) describes which values
3513b9a5f8caSJouni Malinen  *	have changed. The actual parameter values are available in
3514b9a5f8caSJouni Malinen  *	struct wiphy. If returning an error, no value should be changed.
35157643a2c3SJohannes Berg  *
35161432de07SLuis R. Rodriguez  * @set_tx_power: set the transmit power according to the parameters,
3517c8442118SJohannes Berg  *	the power passed is in mBm, to get dBm use MBM_TO_DBM(). The
3518c8442118SJohannes Berg  *	wdev may be %NULL if power was set for the wiphy, and will
3519c8442118SJohannes Berg  *	always be %NULL unless the driver supports per-vif TX power
3520c8442118SJohannes Berg  *	(as advertised by the nl80211 feature flag.)
35217643a2c3SJohannes Berg  * @get_tx_power: store the current TX power into the dbm variable;
35221f87f7d3SJohannes Berg  *	return 0 if successful
35231f87f7d3SJohannes Berg  *
3524abe37c4bSJohannes Berg  * @set_wds_peer: set the WDS peer for a WDS interface
3525abe37c4bSJohannes Berg  *
35261f87f7d3SJohannes Berg  * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting
35271f87f7d3SJohannes Berg  *	functions to adjust rfkill hw state
3528aff89a9bSJohannes Berg  *
352961fa713cSHolger Schurig  * @dump_survey: get site survey information.
353061fa713cSHolger Schurig  *
35319588bbd5SJouni Malinen  * @remain_on_channel: Request the driver to remain awake on the specified
35329588bbd5SJouni Malinen  *	channel for the specified duration to complete an off-channel
35339588bbd5SJouni Malinen  *	operation (e.g., public action frame exchange). When the driver is
35349588bbd5SJouni Malinen  *	ready on the requested channel, it must indicate this with an event
35359588bbd5SJouni Malinen  *	notification by calling cfg80211_ready_on_channel().
35369588bbd5SJouni Malinen  * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation.
35379588bbd5SJouni Malinen  *	This allows the operation to be terminated prior to timeout based on
35389588bbd5SJouni Malinen  *	the duration value.
3539f7ca38dfSJohannes Berg  * @mgmt_tx: Transmit a management frame.
3540f7ca38dfSJohannes Berg  * @mgmt_tx_cancel_wait: Cancel the wait time from transmitting a management
3541f7ca38dfSJohannes Berg  *	frame on another channel
35429588bbd5SJouni Malinen  *
3543fc73f11fSDavid Spinadel  * @testmode_cmd: run a test mode command; @wdev may be %NULL
354471063f0eSWey-Yi Guy  * @testmode_dump: Implement a test mode dump. The cb->args[2] and up may be
354571063f0eSWey-Yi Guy  *	used by the function, but 0 and 1 must not be touched. Additionally,
354671063f0eSWey-Yi Guy  *	return error codes other than -ENOBUFS and -ENOENT will terminate the
354771063f0eSWey-Yi Guy  *	dump and return to userspace with an error, so be careful. If any data
354871063f0eSWey-Yi Guy  *	was passed in from userspace then the data/len arguments will be present
354971063f0eSWey-Yi Guy  *	and point to the data contained in %NL80211_ATTR_TESTDATA.
355067fbb16bSSamuel Ortiz  *
3551abe37c4bSJohannes Berg  * @set_bitrate_mask: set the bitrate mask configuration
3552abe37c4bSJohannes Berg  *
355367fbb16bSSamuel Ortiz  * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac
355467fbb16bSSamuel Ortiz  *	devices running firmwares capable of generating the (re) association
355567fbb16bSSamuel Ortiz  *	RSN IE. It allows for faster roaming between WPA2 BSSIDs.
355667fbb16bSSamuel Ortiz  * @del_pmksa: Delete a cached PMKID.
355767fbb16bSSamuel Ortiz  * @flush_pmksa: Flush all cached PMKIDs.
35589043f3b8SJuuso Oikarinen  * @set_power_mgmt: Configure WLAN power management. A timeout value of -1
35599043f3b8SJuuso Oikarinen  *	allows the driver to adjust the dynamic ps timeout value.
3560d6dc1a38SJuuso Oikarinen  * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold.
3561e86abc68SJohannes Berg  *	After configuration, the driver should (soon) send an event indicating
3562e86abc68SJohannes Berg  *	the current level is above/below the configured threshold; this may
3563e86abc68SJohannes Berg  *	need some care when the configuration is changed (without first being
3564e86abc68SJohannes Berg  *	disabled.)
35654a4b8169SAndrew Zaborowski  * @set_cqm_rssi_range_config: Configure two RSSI thresholds in the
35664a4b8169SAndrew Zaborowski  *	connection quality monitor.  An event is to be sent only when the
35674a4b8169SAndrew Zaborowski  *	signal level is found to be outside the two values.  The driver should
35684a4b8169SAndrew Zaborowski  *	set %NL80211_EXT_FEATURE_CQM_RSSI_LIST if this method is implemented.
35694a4b8169SAndrew Zaborowski  *	If it is provided then there's no point providing @set_cqm_rssi_config.
357084f10708SThomas Pedersen  * @set_cqm_txe_config: Configure connection quality monitor TX error
357184f10708SThomas Pedersen  *	thresholds.
3572807f8a8cSLuciano Coelho  * @sched_scan_start: Tell the driver to start a scheduled scan.
35733a3ecf1dSArend Van Spriel  * @sched_scan_stop: Tell the driver to stop an ongoing scheduled scan with
35743a3ecf1dSArend Van Spriel  *	given request id. This call must stop the scheduled scan and be ready
35753a3ecf1dSArend Van Spriel  *	for starting a new one before it returns, i.e. @sched_scan_start may be
35763a3ecf1dSArend Van Spriel  *	called immediately after that again and should not fail in that case.
35773a3ecf1dSArend Van Spriel  *	The driver should not call cfg80211_sched_scan_stopped() for a requested
35783a3ecf1dSArend Van Spriel  *	stop (when this method returns 0).
357967fbb16bSSamuel Ortiz  *
3580271733cfSJohannes Berg  * @mgmt_frame_register: Notify driver that a management frame type was
358133d8783cSJohannes Berg  *	registered. The callback is allowed to sleep.
3582547025d5SBruno Randolf  *
3583547025d5SBruno Randolf  * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device.
3584547025d5SBruno Randolf  *	Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may
3585547025d5SBruno Randolf  *	reject TX/RX mask combinations they cannot support by returning -EINVAL
3586547025d5SBruno Randolf  *	(also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX).
3587547025d5SBruno Randolf  *
3588547025d5SBruno Randolf  * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant).
35893677713bSJohn W. Linville  *
3590109086ceSArik Nemtsov  * @tdls_mgmt: Transmit a TDLS management frame.
3591109086ceSArik Nemtsov  * @tdls_oper: Perform a high-level TDLS operation (e.g. TDLS link setup).
35927f6cf311SJohannes Berg  *
35937f6cf311SJohannes Berg  * @probe_client: probe an associated client, must return a cookie that it
35947f6cf311SJohannes Berg  *	later passes to cfg80211_probe_status().
35951d9d9213SSimon Wunderlich  *
35961d9d9213SSimon Wunderlich  * @set_noack_map: Set the NoAck Map for the TIDs.
3597d6199218SBen Greear  *
35985b7ccaf3SJohannes Berg  * @get_channel: Get the current operating channel for the virtual interface.
35995b7ccaf3SJohannes Berg  *	For monitor interfaces, it should return %NULL unless there's a single
36005b7ccaf3SJohannes Berg  *	current monitoring channel.
360198104fdeSJohannes Berg  *
360298104fdeSJohannes Berg  * @start_p2p_device: Start the given P2P device.
360398104fdeSJohannes Berg  * @stop_p2p_device: Stop the given P2P device.
360477765eafSVasanthakumar Thiagarajan  *
360577765eafSVasanthakumar Thiagarajan  * @set_mac_acl: Sets MAC address control list in AP and P2P GO mode.
360677765eafSVasanthakumar Thiagarajan  *	Parameters include ACL policy, an array of MAC address of stations
360777765eafSVasanthakumar Thiagarajan  *	and the number of MAC addresses. If there is already a list in driver
360877765eafSVasanthakumar Thiagarajan  *	this new list replaces the existing one. Driver has to clear its ACL
360977765eafSVasanthakumar Thiagarajan  *	when number of MAC addresses entries is passed as 0. Drivers which
361077765eafSVasanthakumar Thiagarajan  *	advertise the support for MAC based ACL have to implement this callback.
361104f39047SSimon Wunderlich  *
361204f39047SSimon Wunderlich  * @start_radar_detection: Start radar detection in the driver.
36138bf24293SJouni Malinen  *
361426ec17a1SOrr Mazor  * @end_cac: End running CAC, probably because a related CAC
361526ec17a1SOrr Mazor  *	was finished on another phy.
361626ec17a1SOrr Mazor  *
36178bf24293SJouni Malinen  * @update_ft_ies: Provide updated Fast BSS Transition information to the
36188bf24293SJouni Malinen  *	driver. If the SME is in the driver/firmware, this information can be
36198bf24293SJouni Malinen  *	used in building Authentication and Reassociation Request frames.
36205de17984SArend van Spriel  *
36215de17984SArend van Spriel  * @crit_proto_start: Indicates a critical protocol needs more link reliability
36225de17984SArend van Spriel  *	for a given duration (milliseconds). The protocol is provided so the
36235de17984SArend van Spriel  *	driver can take the most appropriate actions.
36245de17984SArend van Spriel  * @crit_proto_stop: Indicates critical protocol no longer needs increased link
36255de17984SArend van Spriel  *	reliability. This operation can not fail.
3626be29b99aSAmitkumar Karwar  * @set_coalesce: Set coalesce parameters.
362716ef1fe2SSimon Wunderlich  *
362897dc94f1SMichal Kazior  * @channel_switch: initiate channel-switch procedure (with CSA). Driver is
362997dc94f1SMichal Kazior  *	responsible for veryfing if the switch is possible. Since this is
363097dc94f1SMichal Kazior  *	inherently tricky driver may decide to disconnect an interface later
363197dc94f1SMichal Kazior  *	with cfg80211_stop_iface(). This doesn't mean driver can accept
363297dc94f1SMichal Kazior  *	everything. It should do it's best to verify requests and reject them
363397dc94f1SMichal Kazior  *	as soon as possible.
3634fa9ffc74SKyeyoon Park  *
3635fa9ffc74SKyeyoon Park  * @set_qos_map: Set QoS mapping information to the driver
3636e16821bcSJouni Malinen  *
3637e16821bcSJouni Malinen  * @set_ap_chanwidth: Set the AP (including P2P GO) mode channel width for the
3638e16821bcSJouni Malinen  *	given interface This is used e.g. for dynamic HT 20/40 MHz channel width
3639e16821bcSJouni Malinen  *	changes during the lifetime of the BSS.
3640960d01acSJohannes Berg  *
3641960d01acSJohannes Berg  * @add_tx_ts: validate (if admitted_time is 0) or add a TX TS to the device
3642960d01acSJohannes Berg  *	with the given parameters; action frame exchange has been handled by
3643960d01acSJohannes Berg  *	userspace so this just has to modify the TX path to take the TS into
3644960d01acSJohannes Berg  *	account.
3645960d01acSJohannes Berg  *	If the admitted time is 0 just validate the parameters to make sure
3646960d01acSJohannes Berg  *	the session can be created at all; it is valid to just always return
3647960d01acSJohannes Berg  *	success for that but that may result in inefficient behaviour (handshake
3648960d01acSJohannes Berg  *	with the peer followed by immediate teardown when the addition is later
3649960d01acSJohannes Berg  *	rejected)
3650960d01acSJohannes Berg  * @del_tx_ts: remove an existing TX TS
36516e0bd6c3SRostislav Lisovy  *
36526e0bd6c3SRostislav Lisovy  * @join_ocb: join the OCB network with the specified parameters
36536e0bd6c3SRostislav Lisovy  *	(invoked with the wireless_dev mutex held)
36546e0bd6c3SRostislav Lisovy  * @leave_ocb: leave the current OCB network
36556e0bd6c3SRostislav Lisovy  *	(invoked with the wireless_dev mutex held)
36561057d35eSArik Nemtsov  *
36571057d35eSArik Nemtsov  * @tdls_channel_switch: Start channel-switching with a TDLS peer. The driver
36581057d35eSArik Nemtsov  *	is responsible for continually initiating channel-switching operations
36591057d35eSArik Nemtsov  *	and returning to the base channel for communication with the AP.
36601057d35eSArik Nemtsov  * @tdls_cancel_channel_switch: Stop channel-switching with a TDLS peer. Both
36611057d35eSArik Nemtsov  *	peers must be on the base channel when the call completes.
3662cb3b7d87SAyala Beker  * @start_nan: Start the NAN interface.
3663cb3b7d87SAyala Beker  * @stop_nan: Stop the NAN interface.
3664a442b761SAyala Beker  * @add_nan_func: Add a NAN function. Returns negative value on failure.
3665a442b761SAyala Beker  *	On success @nan_func ownership is transferred to the driver and
3666a442b761SAyala Beker  *	it may access it outside of the scope of this function. The driver
3667a442b761SAyala Beker  *	should free the @nan_func when no longer needed by calling
3668a442b761SAyala Beker  *	cfg80211_free_nan_func().
3669a442b761SAyala Beker  *	On success the driver should assign an instance_id in the
3670a442b761SAyala Beker  *	provided @nan_func.
3671a442b761SAyala Beker  * @del_nan_func: Delete a NAN function.
3672a5a9dcf2SAyala Beker  * @nan_change_conf: changes NAN configuration. The changed parameters must
3673a5a9dcf2SAyala Beker  *	be specified in @changes (using &enum cfg80211_nan_conf_changes);
3674a5a9dcf2SAyala Beker  *	All other parameters must be ignored.
3675ce0ce13aSMichael Braun  *
3676ce0ce13aSMichael Braun  * @set_multicast_to_unicast: configure multicast to unicast conversion for BSS
36773a00df57SAvraham Stern  *
367852539ca8SToke Høiland-Jørgensen  * @get_txq_stats: Get TXQ stats for interface or phy. If wdev is %NULL, this
367952539ca8SToke Høiland-Jørgensen  *      function should return phy stats, and interface stats otherwise.
368052539ca8SToke Høiland-Jørgensen  *
36813a00df57SAvraham Stern  * @set_pmk: configure the PMK to be used for offloaded 802.1X 4-Way handshake.
36823a00df57SAvraham Stern  *	If not deleted through @del_pmk the PMK remains valid until disconnect
36833a00df57SAvraham Stern  *	upon which the driver should clear it.
36843a00df57SAvraham Stern  *	(invoked with the wireless_dev mutex held)
36853a00df57SAvraham Stern  * @del_pmk: delete the previously configured PMK for the given authenticator.
36863a00df57SAvraham Stern  *	(invoked with the wireless_dev mutex held)
368740cbfa90SSrinivas Dasari  *
368840cbfa90SSrinivas Dasari  * @external_auth: indicates result of offloaded authentication processing from
368940cbfa90SSrinivas Dasari  *     user space
36902576a9acSDenis Kenzior  *
36912576a9acSDenis Kenzior  * @tx_control_port: TX a control port frame (EAPoL).  The noencrypt parameter
36922576a9acSDenis Kenzior  *	tells the driver that the frame should not be encrypted.
369381e54d08SPradeep Kumar Chitrapu  *
369481e54d08SPradeep Kumar Chitrapu  * @get_ftm_responder_stats: Retrieve FTM responder statistics, if available.
369581e54d08SPradeep Kumar Chitrapu  *	Statistics should be cumulative, currently no way to reset is provided.
36969bb7e0f2SJohannes Berg  * @start_pmsr: start peer measurement (e.g. FTM)
36979bb7e0f2SJohannes Berg  * @abort_pmsr: abort peer measurement
3698cb74e977SSunil Dutt  *
3699cb74e977SSunil Dutt  * @update_owe_info: Provide updated OWE info to driver. Driver implementing SME
3700cb74e977SSunil Dutt  *	but offloading OWE processing to the user space will get the updated
3701cb74e977SSunil Dutt  *	DH IE through this interface.
37025ab92e7fSRajkumar Manoharan  *
37035ab92e7fSRajkumar Manoharan  * @probe_mesh_link: Probe direct Mesh peer's link quality by sending data frame
37045ab92e7fSRajkumar Manoharan  *	and overrule HWMP path selection algorithm.
370577f576deSTamizh chelvam  * @set_tid_config: TID specific configuration, this can be peer or BSS specific
370677f576deSTamizh chelvam  *	This callback may sleep.
37073710a8a6SJohannes Berg  * @reset_tid_config: Reset TID specific configuration for the peer, for the
37083710a8a6SJohannes Berg  *	given TIDs. This callback may sleep.
3709704232c2SJohannes Berg  */
3710704232c2SJohannes Berg struct cfg80211_ops {
3711ff1b6e69SJohannes Berg 	int	(*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
37120378b3f1SJohannes Berg 	int	(*resume)(struct wiphy *wiphy);
37136d52563fSJohannes Berg 	void	(*set_wakeup)(struct wiphy *wiphy, bool enabled);
37140378b3f1SJohannes Berg 
371584efbb84SJohannes Berg 	struct wireless_dev * (*add_virtual_intf)(struct wiphy *wiphy,
3716552bff0cSJohannes Berg 						  const char *name,
37176bab2e19STom Gundersen 						  unsigned char name_assign_type,
3718f9e10ce4SJohannes Berg 						  enum nl80211_iftype type,
37192ec600d6SLuis Carlos Cobo 						  struct vif_params *params);
372084efbb84SJohannes Berg 	int	(*del_virtual_intf)(struct wiphy *wiphy,
372184efbb84SJohannes Berg 				    struct wireless_dev *wdev);
3722e36d56b6SJohannes Berg 	int	(*change_virtual_intf)(struct wiphy *wiphy,
3723e36d56b6SJohannes Berg 				       struct net_device *dev,
3724818a986eSJohannes Berg 				       enum nl80211_iftype type,
37252ec600d6SLuis Carlos Cobo 				       struct vif_params *params);
372641ade00fSJohannes Berg 
372741ade00fSJohannes Berg 	int	(*add_key)(struct wiphy *wiphy, struct net_device *netdev,
3728e31b8213SJohannes Berg 			   u8 key_index, bool pairwise, const u8 *mac_addr,
372941ade00fSJohannes Berg 			   struct key_params *params);
373041ade00fSJohannes Berg 	int	(*get_key)(struct wiphy *wiphy, struct net_device *netdev,
3731e31b8213SJohannes Berg 			   u8 key_index, bool pairwise, const u8 *mac_addr,
3732e31b8213SJohannes Berg 			   void *cookie,
373341ade00fSJohannes Berg 			   void (*callback)(void *cookie, struct key_params*));
373441ade00fSJohannes Berg 	int	(*del_key)(struct wiphy *wiphy, struct net_device *netdev,
3735e31b8213SJohannes Berg 			   u8 key_index, bool pairwise, const u8 *mac_addr);
373641ade00fSJohannes Berg 	int	(*set_default_key)(struct wiphy *wiphy,
373741ade00fSJohannes Berg 				   struct net_device *netdev,
3738dbd2fd65SJohannes Berg 				   u8 key_index, bool unicast, bool multicast);
37393cfcf6acSJouni Malinen 	int	(*set_default_mgmt_key)(struct wiphy *wiphy,
37403cfcf6acSJouni Malinen 					struct net_device *netdev,
37413cfcf6acSJouni Malinen 					u8 key_index);
374256be393fSJouni Malinen 	int	(*set_default_beacon_key)(struct wiphy *wiphy,
374356be393fSJouni Malinen 					  struct net_device *netdev,
374456be393fSJouni Malinen 					  u8 key_index);
3745ed1b6cc7SJohannes Berg 
37468860020eSJohannes Berg 	int	(*start_ap)(struct wiphy *wiphy, struct net_device *dev,
37478860020eSJohannes Berg 			    struct cfg80211_ap_settings *settings);
37488860020eSJohannes Berg 	int	(*change_beacon)(struct wiphy *wiphy, struct net_device *dev,
37498860020eSJohannes Berg 				 struct cfg80211_beacon_data *info);
37508860020eSJohannes Berg 	int	(*stop_ap)(struct wiphy *wiphy, struct net_device *dev);
37515727ef1bSJohannes Berg 
37525727ef1bSJohannes Berg 
37535727ef1bSJohannes Berg 	int	(*add_station)(struct wiphy *wiphy, struct net_device *dev,
37543b3a0162SJohannes Berg 			       const u8 *mac,
37553b3a0162SJohannes Berg 			       struct station_parameters *params);
37565727ef1bSJohannes Berg 	int	(*del_station)(struct wiphy *wiphy, struct net_device *dev,
375789c771e5SJouni Malinen 			       struct station_del_parameters *params);
37585727ef1bSJohannes Berg 	int	(*change_station)(struct wiphy *wiphy, struct net_device *dev,
37593b3a0162SJohannes Berg 				  const u8 *mac,
37603b3a0162SJohannes Berg 				  struct station_parameters *params);
3761fd5b74dcSJohannes Berg 	int	(*get_station)(struct wiphy *wiphy, struct net_device *dev,
37623b3a0162SJohannes Berg 			       const u8 *mac, struct station_info *sinfo);
37632ec600d6SLuis Carlos Cobo 	int	(*dump_station)(struct wiphy *wiphy, struct net_device *dev,
37642ec600d6SLuis Carlos Cobo 				int idx, u8 *mac, struct station_info *sinfo);
37652ec600d6SLuis Carlos Cobo 
37662ec600d6SLuis Carlos Cobo 	int	(*add_mpath)(struct wiphy *wiphy, struct net_device *dev,
37673b3a0162SJohannes Berg 			       const u8 *dst, const u8 *next_hop);
37682ec600d6SLuis Carlos Cobo 	int	(*del_mpath)(struct wiphy *wiphy, struct net_device *dev,
37693b3a0162SJohannes Berg 			       const u8 *dst);
37702ec600d6SLuis Carlos Cobo 	int	(*change_mpath)(struct wiphy *wiphy, struct net_device *dev,
37713b3a0162SJohannes Berg 				  const u8 *dst, const u8 *next_hop);
37722ec600d6SLuis Carlos Cobo 	int	(*get_mpath)(struct wiphy *wiphy, struct net_device *dev,
37733b3a0162SJohannes Berg 			     u8 *dst, u8 *next_hop, struct mpath_info *pinfo);
37742ec600d6SLuis Carlos Cobo 	int	(*dump_mpath)(struct wiphy *wiphy, struct net_device *dev,
37752ec600d6SLuis Carlos Cobo 			      int idx, u8 *dst, u8 *next_hop,
37762ec600d6SLuis Carlos Cobo 			      struct mpath_info *pinfo);
377766be7d2bSHenning Rogge 	int	(*get_mpp)(struct wiphy *wiphy, struct net_device *dev,
377866be7d2bSHenning Rogge 			   u8 *dst, u8 *mpp, struct mpath_info *pinfo);
377966be7d2bSHenning Rogge 	int	(*dump_mpp)(struct wiphy *wiphy, struct net_device *dev,
378066be7d2bSHenning Rogge 			    int idx, u8 *dst, u8 *mpp,
378166be7d2bSHenning Rogge 			    struct mpath_info *pinfo);
378224bdd9f4SJavier Cardona 	int	(*get_mesh_config)(struct wiphy *wiphy,
378393da9cc1Scolin@cozybit.com 				struct net_device *dev,
378493da9cc1Scolin@cozybit.com 				struct mesh_config *conf);
378524bdd9f4SJavier Cardona 	int	(*update_mesh_config)(struct wiphy *wiphy,
378629cbe68cSJohannes Berg 				      struct net_device *dev, u32 mask,
378729cbe68cSJohannes Berg 				      const struct mesh_config *nconf);
378829cbe68cSJohannes Berg 	int	(*join_mesh)(struct wiphy *wiphy, struct net_device *dev,
378929cbe68cSJohannes Berg 			     const struct mesh_config *conf,
379029cbe68cSJohannes Berg 			     const struct mesh_setup *setup);
379129cbe68cSJohannes Berg 	int	(*leave_mesh)(struct wiphy *wiphy, struct net_device *dev);
379229cbe68cSJohannes Berg 
37936e0bd6c3SRostislav Lisovy 	int	(*join_ocb)(struct wiphy *wiphy, struct net_device *dev,
37946e0bd6c3SRostislav Lisovy 			    struct ocb_setup *setup);
37956e0bd6c3SRostislav Lisovy 	int	(*leave_ocb)(struct wiphy *wiphy, struct net_device *dev);
37966e0bd6c3SRostislav Lisovy 
37979f1ba906SJouni Malinen 	int	(*change_bss)(struct wiphy *wiphy, struct net_device *dev,
37989f1ba906SJouni Malinen 			      struct bss_parameters *params);
379931888487SJouni Malinen 
3800f70f01c2SEliad Peller 	int	(*set_txq_params)(struct wiphy *wiphy, struct net_device *dev,
380131888487SJouni Malinen 				  struct ieee80211_txq_params *params);
380272bdcf34SJouni Malinen 
3803e8c9bd5bSJohannes Berg 	int	(*libertas_set_mesh_channel)(struct wiphy *wiphy,
3804e8c9bd5bSJohannes Berg 					     struct net_device *dev,
3805e8c9bd5bSJohannes Berg 					     struct ieee80211_channel *chan);
3806e8c9bd5bSJohannes Berg 
3807e8c9bd5bSJohannes Berg 	int	(*set_monitor_channel)(struct wiphy *wiphy,
3808683b6d3bSJohannes Berg 				       struct cfg80211_chan_def *chandef);
38099aed3cc1SJouni Malinen 
3810fd014284SJohannes Berg 	int	(*scan)(struct wiphy *wiphy,
38112a519311SJohannes Berg 			struct cfg80211_scan_request *request);
381291d3ab46SVidyullatha Kanchanapally 	void	(*abort_scan)(struct wiphy *wiphy, struct wireless_dev *wdev);
3813636a5d36SJouni Malinen 
3814636a5d36SJouni Malinen 	int	(*auth)(struct wiphy *wiphy, struct net_device *dev,
3815636a5d36SJouni Malinen 			struct cfg80211_auth_request *req);
3816636a5d36SJouni Malinen 	int	(*assoc)(struct wiphy *wiphy, struct net_device *dev,
3817636a5d36SJouni Malinen 			 struct cfg80211_assoc_request *req);
3818636a5d36SJouni Malinen 	int	(*deauth)(struct wiphy *wiphy, struct net_device *dev,
381963c9c5e7SJohannes Berg 			  struct cfg80211_deauth_request *req);
3820636a5d36SJouni Malinen 	int	(*disassoc)(struct wiphy *wiphy, struct net_device *dev,
382163c9c5e7SJohannes Berg 			    struct cfg80211_disassoc_request *req);
382204a773adSJohannes Berg 
3823b23aa676SSamuel Ortiz 	int	(*connect)(struct wiphy *wiphy, struct net_device *dev,
3824b23aa676SSamuel Ortiz 			   struct cfg80211_connect_params *sme);
3825088e8df8Svamsi krishna 	int	(*update_connect_params)(struct wiphy *wiphy,
3826088e8df8Svamsi krishna 					 struct net_device *dev,
3827088e8df8Svamsi krishna 					 struct cfg80211_connect_params *sme,
3828088e8df8Svamsi krishna 					 u32 changed);
3829b23aa676SSamuel Ortiz 	int	(*disconnect)(struct wiphy *wiphy, struct net_device *dev,
3830b23aa676SSamuel Ortiz 			      u16 reason_code);
3831b23aa676SSamuel Ortiz 
383204a773adSJohannes Berg 	int	(*join_ibss)(struct wiphy *wiphy, struct net_device *dev,
383304a773adSJohannes Berg 			     struct cfg80211_ibss_params *params);
383404a773adSJohannes Berg 	int	(*leave_ibss)(struct wiphy *wiphy, struct net_device *dev);
3835b9a5f8caSJouni Malinen 
3836f4e583c8SAntonio Quartulli 	int	(*set_mcast_rate)(struct wiphy *wiphy, struct net_device *dev,
383757fbcce3SJohannes Berg 				  int rate[NUM_NL80211_BANDS]);
3838f4e583c8SAntonio Quartulli 
3839b9a5f8caSJouni Malinen 	int	(*set_wiphy_params)(struct wiphy *wiphy, u32 changed);
38407643a2c3SJohannes Berg 
3841c8442118SJohannes Berg 	int	(*set_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
3842fa61cf70SJuuso Oikarinen 				enum nl80211_tx_power_setting type, int mbm);
3843c8442118SJohannes Berg 	int	(*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
3844c8442118SJohannes Berg 				int *dbm);
38451f87f7d3SJohannes Berg 
3846ab737a4fSJohannes Berg 	int	(*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev,
3847388ac775SJohannes Berg 				const u8 *addr);
3848ab737a4fSJohannes Berg 
38491f87f7d3SJohannes Berg 	void	(*rfkill_poll)(struct wiphy *wiphy);
3850aff89a9bSJohannes Berg 
3851aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE
3852fc73f11fSDavid Spinadel 	int	(*testmode_cmd)(struct wiphy *wiphy, struct wireless_dev *wdev,
3853fc73f11fSDavid Spinadel 				void *data, int len);
385471063f0eSWey-Yi Guy 	int	(*testmode_dump)(struct wiphy *wiphy, struct sk_buff *skb,
385571063f0eSWey-Yi Guy 				 struct netlink_callback *cb,
385671063f0eSWey-Yi Guy 				 void *data, int len);
3857aff89a9bSJohannes Berg #endif
3858bc92afd9SJohannes Berg 
38599930380fSJohannes Berg 	int	(*set_bitrate_mask)(struct wiphy *wiphy,
38609930380fSJohannes Berg 				    struct net_device *dev,
38619930380fSJohannes Berg 				    const u8 *peer,
38629930380fSJohannes Berg 				    const struct cfg80211_bitrate_mask *mask);
38639930380fSJohannes Berg 
386461fa713cSHolger Schurig 	int	(*dump_survey)(struct wiphy *wiphy, struct net_device *netdev,
386561fa713cSHolger Schurig 			int idx, struct survey_info *info);
386661fa713cSHolger Schurig 
386767fbb16bSSamuel Ortiz 	int	(*set_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
386867fbb16bSSamuel Ortiz 			     struct cfg80211_pmksa *pmksa);
386967fbb16bSSamuel Ortiz 	int	(*del_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
387067fbb16bSSamuel Ortiz 			     struct cfg80211_pmksa *pmksa);
387167fbb16bSSamuel Ortiz 	int	(*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev);
387267fbb16bSSamuel Ortiz 
38739588bbd5SJouni Malinen 	int	(*remain_on_channel)(struct wiphy *wiphy,
387471bbc994SJohannes Berg 				     struct wireless_dev *wdev,
38759588bbd5SJouni Malinen 				     struct ieee80211_channel *chan,
38769588bbd5SJouni Malinen 				     unsigned int duration,
38779588bbd5SJouni Malinen 				     u64 *cookie);
38789588bbd5SJouni Malinen 	int	(*cancel_remain_on_channel)(struct wiphy *wiphy,
387971bbc994SJohannes Berg 					    struct wireless_dev *wdev,
38809588bbd5SJouni Malinen 					    u64 cookie);
38819588bbd5SJouni Malinen 
388271bbc994SJohannes Berg 	int	(*mgmt_tx)(struct wiphy *wiphy, struct wireless_dev *wdev,
3883b176e629SAndrei Otcheretianski 			   struct cfg80211_mgmt_tx_params *params,
3884b176e629SAndrei Otcheretianski 			   u64 *cookie);
3885f7ca38dfSJohannes Berg 	int	(*mgmt_tx_cancel_wait)(struct wiphy *wiphy,
388671bbc994SJohannes Berg 				       struct wireless_dev *wdev,
3887f7ca38dfSJohannes Berg 				       u64 cookie);
3888026331c4SJouni Malinen 
3889bc92afd9SJohannes Berg 	int	(*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev,
3890bc92afd9SJohannes Berg 				  bool enabled, int timeout);
3891d6dc1a38SJuuso Oikarinen 
3892d6dc1a38SJuuso Oikarinen 	int	(*set_cqm_rssi_config)(struct wiphy *wiphy,
3893d6dc1a38SJuuso Oikarinen 				       struct net_device *dev,
3894d6dc1a38SJuuso Oikarinen 				       s32 rssi_thold, u32 rssi_hyst);
3895271733cfSJohannes Berg 
38964a4b8169SAndrew Zaborowski 	int	(*set_cqm_rssi_range_config)(struct wiphy *wiphy,
38974a4b8169SAndrew Zaborowski 					     struct net_device *dev,
38984a4b8169SAndrew Zaborowski 					     s32 rssi_low, s32 rssi_high);
38994a4b8169SAndrew Zaborowski 
390084f10708SThomas Pedersen 	int	(*set_cqm_txe_config)(struct wiphy *wiphy,
390184f10708SThomas Pedersen 				      struct net_device *dev,
390284f10708SThomas Pedersen 				      u32 rate, u32 pkts, u32 intvl);
390384f10708SThomas Pedersen 
3904271733cfSJohannes Berg 	void	(*mgmt_frame_register)(struct wiphy *wiphy,
390571bbc994SJohannes Berg 				       struct wireless_dev *wdev,
3906271733cfSJohannes Berg 				       u16 frame_type, bool reg);
3907afe0cbf8SBruno Randolf 
3908afe0cbf8SBruno Randolf 	int	(*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant);
3909afe0cbf8SBruno Randolf 	int	(*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant);
39103677713bSJohn W. Linville 
3911807f8a8cSLuciano Coelho 	int	(*sched_scan_start)(struct wiphy *wiphy,
3912807f8a8cSLuciano Coelho 				struct net_device *dev,
3913807f8a8cSLuciano Coelho 				struct cfg80211_sched_scan_request *request);
39143a3ecf1dSArend Van Spriel 	int	(*sched_scan_stop)(struct wiphy *wiphy, struct net_device *dev,
39153a3ecf1dSArend Van Spriel 				   u64 reqid);
3916e5497d76SJohannes Berg 
3917e5497d76SJohannes Berg 	int	(*set_rekey_data)(struct wiphy *wiphy, struct net_device *dev,
3918e5497d76SJohannes Berg 				  struct cfg80211_gtk_rekey_data *data);
3919109086ceSArik Nemtsov 
3920109086ceSArik Nemtsov 	int	(*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev,
39213b3a0162SJohannes Berg 			     const u8 *peer, u8 action_code,  u8 dialog_token,
3922df942e7bSSunil Dutt Undekari 			     u16 status_code, u32 peer_capability,
392331fa97c5SArik Nemtsov 			     bool initiator, const u8 *buf, size_t len);
3924109086ceSArik Nemtsov 	int	(*tdls_oper)(struct wiphy *wiphy, struct net_device *dev,
39253b3a0162SJohannes Berg 			     const u8 *peer, enum nl80211_tdls_operation oper);
39267f6cf311SJohannes Berg 
39277f6cf311SJohannes Berg 	int	(*probe_client)(struct wiphy *wiphy, struct net_device *dev,
39287f6cf311SJohannes Berg 				const u8 *peer, u64 *cookie);
3929e999882aSJohannes Berg 
39301d9d9213SSimon Wunderlich 	int	(*set_noack_map)(struct wiphy *wiphy,
39311d9d9213SSimon Wunderlich 				  struct net_device *dev,
39321d9d9213SSimon Wunderlich 				  u16 noack_map);
39331d9d9213SSimon Wunderlich 
3934683b6d3bSJohannes Berg 	int	(*get_channel)(struct wiphy *wiphy,
39355b7ccaf3SJohannes Berg 			       struct wireless_dev *wdev,
3936683b6d3bSJohannes Berg 			       struct cfg80211_chan_def *chandef);
393798104fdeSJohannes Berg 
393898104fdeSJohannes Berg 	int	(*start_p2p_device)(struct wiphy *wiphy,
393998104fdeSJohannes Berg 				    struct wireless_dev *wdev);
394098104fdeSJohannes Berg 	void	(*stop_p2p_device)(struct wiphy *wiphy,
394198104fdeSJohannes Berg 				   struct wireless_dev *wdev);
394277765eafSVasanthakumar Thiagarajan 
394377765eafSVasanthakumar Thiagarajan 	int	(*set_mac_acl)(struct wiphy *wiphy, struct net_device *dev,
394477765eafSVasanthakumar Thiagarajan 			       const struct cfg80211_acl_data *params);
394504f39047SSimon Wunderlich 
394604f39047SSimon Wunderlich 	int	(*start_radar_detection)(struct wiphy *wiphy,
394704f39047SSimon Wunderlich 					 struct net_device *dev,
394831559f35SJanusz Dziedzic 					 struct cfg80211_chan_def *chandef,
394931559f35SJanusz Dziedzic 					 u32 cac_time_ms);
395026ec17a1SOrr Mazor 	void	(*end_cac)(struct wiphy *wiphy,
395126ec17a1SOrr Mazor 				struct net_device *dev);
3952355199e0SJouni Malinen 	int	(*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev,
3953355199e0SJouni Malinen 				 struct cfg80211_update_ft_ies_params *ftie);
39545de17984SArend van Spriel 	int	(*crit_proto_start)(struct wiphy *wiphy,
39555de17984SArend van Spriel 				    struct wireless_dev *wdev,
39565de17984SArend van Spriel 				    enum nl80211_crit_proto_id protocol,
39575de17984SArend van Spriel 				    u16 duration);
39585de17984SArend van Spriel 	void	(*crit_proto_stop)(struct wiphy *wiphy,
39595de17984SArend van Spriel 				   struct wireless_dev *wdev);
3960be29b99aSAmitkumar Karwar 	int	(*set_coalesce)(struct wiphy *wiphy,
3961be29b99aSAmitkumar Karwar 				struct cfg80211_coalesce *coalesce);
396216ef1fe2SSimon Wunderlich 
396316ef1fe2SSimon Wunderlich 	int	(*channel_switch)(struct wiphy *wiphy,
396416ef1fe2SSimon Wunderlich 				  struct net_device *dev,
396516ef1fe2SSimon Wunderlich 				  struct cfg80211_csa_settings *params);
3966e16821bcSJouni Malinen 
3967fa9ffc74SKyeyoon Park 	int     (*set_qos_map)(struct wiphy *wiphy,
3968fa9ffc74SKyeyoon Park 			       struct net_device *dev,
3969fa9ffc74SKyeyoon Park 			       struct cfg80211_qos_map *qos_map);
3970e16821bcSJouni Malinen 
3971e16821bcSJouni Malinen 	int	(*set_ap_chanwidth)(struct wiphy *wiphy, struct net_device *dev,
3972e16821bcSJouni Malinen 				    struct cfg80211_chan_def *chandef);
3973960d01acSJohannes Berg 
3974960d01acSJohannes Berg 	int	(*add_tx_ts)(struct wiphy *wiphy, struct net_device *dev,
3975960d01acSJohannes Berg 			     u8 tsid, const u8 *peer, u8 user_prio,
3976960d01acSJohannes Berg 			     u16 admitted_time);
3977960d01acSJohannes Berg 	int	(*del_tx_ts)(struct wiphy *wiphy, struct net_device *dev,
3978960d01acSJohannes Berg 			     u8 tsid, const u8 *peer);
39791057d35eSArik Nemtsov 
39801057d35eSArik Nemtsov 	int	(*tdls_channel_switch)(struct wiphy *wiphy,
39811057d35eSArik Nemtsov 				       struct net_device *dev,
39821057d35eSArik Nemtsov 				       const u8 *addr, u8 oper_class,
39831057d35eSArik Nemtsov 				       struct cfg80211_chan_def *chandef);
39841057d35eSArik Nemtsov 	void	(*tdls_cancel_channel_switch)(struct wiphy *wiphy,
39851057d35eSArik Nemtsov 					      struct net_device *dev,
39861057d35eSArik Nemtsov 					      const u8 *addr);
3987cb3b7d87SAyala Beker 	int	(*start_nan)(struct wiphy *wiphy, struct wireless_dev *wdev,
3988cb3b7d87SAyala Beker 			     struct cfg80211_nan_conf *conf);
3989cb3b7d87SAyala Beker 	void	(*stop_nan)(struct wiphy *wiphy, struct wireless_dev *wdev);
3990a442b761SAyala Beker 	int	(*add_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev,
3991a442b761SAyala Beker 				struct cfg80211_nan_func *nan_func);
3992a442b761SAyala Beker 	void	(*del_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev,
3993a442b761SAyala Beker 			       u64 cookie);
3994a5a9dcf2SAyala Beker 	int	(*nan_change_conf)(struct wiphy *wiphy,
3995a5a9dcf2SAyala Beker 				   struct wireless_dev *wdev,
3996a5a9dcf2SAyala Beker 				   struct cfg80211_nan_conf *conf,
3997a5a9dcf2SAyala Beker 				   u32 changes);
3998ce0ce13aSMichael Braun 
3999ce0ce13aSMichael Braun 	int	(*set_multicast_to_unicast)(struct wiphy *wiphy,
4000ce0ce13aSMichael Braun 					    struct net_device *dev,
4001ce0ce13aSMichael Braun 					    const bool enabled);
40023a00df57SAvraham Stern 
400352539ca8SToke Høiland-Jørgensen 	int	(*get_txq_stats)(struct wiphy *wiphy,
400452539ca8SToke Høiland-Jørgensen 				 struct wireless_dev *wdev,
400552539ca8SToke Høiland-Jørgensen 				 struct cfg80211_txq_stats *txqstats);
400652539ca8SToke Høiland-Jørgensen 
40073a00df57SAvraham Stern 	int	(*set_pmk)(struct wiphy *wiphy, struct net_device *dev,
40083a00df57SAvraham Stern 			   const struct cfg80211_pmk_conf *conf);
40093a00df57SAvraham Stern 	int	(*del_pmk)(struct wiphy *wiphy, struct net_device *dev,
40103a00df57SAvraham Stern 			   const u8 *aa);
401140cbfa90SSrinivas Dasari 	int     (*external_auth)(struct wiphy *wiphy, struct net_device *dev,
401240cbfa90SSrinivas Dasari 				 struct cfg80211_external_auth_params *params);
40132576a9acSDenis Kenzior 
40142576a9acSDenis Kenzior 	int	(*tx_control_port)(struct wiphy *wiphy,
40152576a9acSDenis Kenzior 				   struct net_device *dev,
40162576a9acSDenis Kenzior 				   const u8 *buf, size_t len,
40178d74a623SJohannes Berg 				   const u8 *dest, const __be16 proto,
40182576a9acSDenis Kenzior 				   const bool noencrypt);
401981e54d08SPradeep Kumar Chitrapu 
402081e54d08SPradeep Kumar Chitrapu 	int	(*get_ftm_responder_stats)(struct wiphy *wiphy,
402181e54d08SPradeep Kumar Chitrapu 				struct net_device *dev,
402281e54d08SPradeep Kumar Chitrapu 				struct cfg80211_ftm_responder_stats *ftm_stats);
40239bb7e0f2SJohannes Berg 
40249bb7e0f2SJohannes Berg 	int	(*start_pmsr)(struct wiphy *wiphy, struct wireless_dev *wdev,
40259bb7e0f2SJohannes Berg 			      struct cfg80211_pmsr_request *request);
40269bb7e0f2SJohannes Berg 	void	(*abort_pmsr)(struct wiphy *wiphy, struct wireless_dev *wdev,
40279bb7e0f2SJohannes Berg 			      struct cfg80211_pmsr_request *request);
4028cb74e977SSunil Dutt 	int	(*update_owe_info)(struct wiphy *wiphy, struct net_device *dev,
4029cb74e977SSunil Dutt 				   struct cfg80211_update_owe_info *owe_info);
40305ab92e7fSRajkumar Manoharan 	int	(*probe_mesh_link)(struct wiphy *wiphy, struct net_device *dev,
40315ab92e7fSRajkumar Manoharan 				   const u8 *buf, size_t len);
403277f576deSTamizh chelvam 	int     (*set_tid_config)(struct wiphy *wiphy, struct net_device *dev,
40333710a8a6SJohannes Berg 				  struct cfg80211_tid_config *tid_conf);
403477f576deSTamizh chelvam 	int	(*reset_tid_config)(struct wiphy *wiphy, struct net_device *dev,
40353710a8a6SJohannes Berg 				    const u8 *peer, u8 tids);
4036704232c2SJohannes Berg };
4037704232c2SJohannes Berg 
4038d3236553SJohannes Berg /*
4039d3236553SJohannes Berg  * wireless hardware and networking interfaces structures
4040d3236553SJohannes Berg  * and registration/helper functions
4041d3236553SJohannes Berg  */
4042d3236553SJohannes Berg 
4043d3236553SJohannes Berg /**
40445be83de5SJohannes Berg  * enum wiphy_flags - wiphy capability flags
40455be83de5SJohannes Berg  *
40465be83de5SJohannes Berg  * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this
40475be83de5SJohannes Berg  *	wiphy at all
40485be83de5SJohannes Berg  * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled
40495be83de5SJohannes Berg  *	by default -- this flag will be set depending on the kernel's default
40505be83de5SJohannes Berg  *	on wiphy_new(), but can be changed by the driver if it has a good
40515be83de5SJohannes Berg  *	reason to override the default
40529bc383deSJohannes Berg  * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station
405333d915d9SManikanta Pubbisetty  *	on a VLAN interface). This flag also serves an extra purpose of
405433d915d9SManikanta Pubbisetty  *	supporting 4ADDR AP mode on devices which do not support AP/VLAN iftype.
40559bc383deSJohannes Berg  * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station
4056c0692b8fSJohannes Berg  * @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the
4057c0692b8fSJohannes Berg  *	control port protocol ethertype. The device also honours the
4058c0692b8fSJohannes Berg  *	control_port_no_encrypt flag.
4059e31b8213SJohannes Berg  * @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN.
406015d5dda6SJavier Cardona  * @WIPHY_FLAG_MESH_AUTH: The device supports mesh authentication by routing
406115d5dda6SJavier Cardona  *	auth frames to userspace. See @NL80211_MESH_SETUP_USERSPACE_AUTH.
4062f4b34b55SVivek Natarajan  * @WIPHY_FLAG_SUPPORTS_FW_ROAM: The device supports roaming feature in the
4063f4b34b55SVivek Natarajan  *	firmware.
4064cedb5412SEliad Peller  * @WIPHY_FLAG_AP_UAPSD: The device supports uapsd on AP.
4065109086ceSArik Nemtsov  * @WIPHY_FLAG_SUPPORTS_TDLS: The device supports TDLS (802.11z) operation.
4066109086ceSArik Nemtsov  * @WIPHY_FLAG_TDLS_EXTERNAL_SETUP: The device does not handle TDLS (802.11z)
4067109086ceSArik Nemtsov  *	link setup/discovery operations internally. Setup, discovery and
4068109086ceSArik Nemtsov  *	teardown packets should be sent through the @NL80211_CMD_TDLS_MGMT
4069109086ceSArik Nemtsov  *	command. When this flag is not set, @NL80211_CMD_TDLS_OPER should be
4070109086ceSArik Nemtsov  *	used for asking the driver/firmware to perform a TDLS operation.
4071562a7480SJohannes Berg  * @WIPHY_FLAG_HAVE_AP_SME: device integrates AP SME
40725e760230SJohannes Berg  * @WIPHY_FLAG_REPORTS_OBSS: the device will report beacons from other BSSes
40735e760230SJohannes Berg  *	when there are virtual interfaces in AP mode by calling
40745e760230SJohannes Berg  *	cfg80211_report_obss_beacon().
407587bbbe22SArik Nemtsov  * @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD: When operating as an AP, the device
407687bbbe22SArik Nemtsov  *	responds to probe-requests in hardware.
40777c4ef712SJohannes Berg  * @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX.
40787c4ef712SJohannes Berg  * @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call.
40792f301ab2SSimon Wunderlich  * @WIPHY_FLAG_SUPPORTS_5_10_MHZ: Device supports 5 MHz and 10 MHz channels.
408016ef1fe2SSimon Wunderlich  * @WIPHY_FLAG_HAS_CHANNEL_SWITCH: Device supports channel switch in
408116ef1fe2SSimon Wunderlich  *	beaconing mode (AP, IBSS, Mesh, ...).
4082b8676221SDavid Spinadel  * @WIPHY_FLAG_HAS_STATIC_WEP: The device supports static WEP key installation
4083b8676221SDavid Spinadel  *	before connection.
40845be83de5SJohannes Berg  */
40855be83de5SJohannes Berg enum wiphy_flags {
4086723e73acSJohannes Berg 	/* use hole at 0 */
4087a2f73b6cSLuis R. Rodriguez 	/* use hole at 1 */
4088a2f73b6cSLuis R. Rodriguez 	/* use hole at 2 */
40895be83de5SJohannes Berg 	WIPHY_FLAG_NETNS_OK			= BIT(3),
40905be83de5SJohannes Berg 	WIPHY_FLAG_PS_ON_BY_DEFAULT		= BIT(4),
40919bc383deSJohannes Berg 	WIPHY_FLAG_4ADDR_AP			= BIT(5),
40929bc383deSJohannes Berg 	WIPHY_FLAG_4ADDR_STATION		= BIT(6),
4093c0692b8fSJohannes Berg 	WIPHY_FLAG_CONTROL_PORT_PROTOCOL	= BIT(7),
4094309075cfSJussi Kivilinna 	WIPHY_FLAG_IBSS_RSN			= BIT(8),
409515d5dda6SJavier Cardona 	WIPHY_FLAG_MESH_AUTH			= BIT(10),
4096ca986ad9SArend Van Spriel 	/* use hole at 11 */
40978e8b41f9SJohannes Berg 	/* use hole at 12 */
4098f4b34b55SVivek Natarajan 	WIPHY_FLAG_SUPPORTS_FW_ROAM		= BIT(13),
4099cedb5412SEliad Peller 	WIPHY_FLAG_AP_UAPSD			= BIT(14),
4100109086ceSArik Nemtsov 	WIPHY_FLAG_SUPPORTS_TDLS		= BIT(15),
4101109086ceSArik Nemtsov 	WIPHY_FLAG_TDLS_EXTERNAL_SETUP		= BIT(16),
4102562a7480SJohannes Berg 	WIPHY_FLAG_HAVE_AP_SME			= BIT(17),
41035e760230SJohannes Berg 	WIPHY_FLAG_REPORTS_OBSS			= BIT(18),
410487bbbe22SArik Nemtsov 	WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD	= BIT(19),
41057c4ef712SJohannes Berg 	WIPHY_FLAG_OFFCHAN_TX			= BIT(20),
41067c4ef712SJohannes Berg 	WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL	= BIT(21),
41072f301ab2SSimon Wunderlich 	WIPHY_FLAG_SUPPORTS_5_10_MHZ		= BIT(22),
410816ef1fe2SSimon Wunderlich 	WIPHY_FLAG_HAS_CHANNEL_SWITCH		= BIT(23),
4109b8676221SDavid Spinadel 	WIPHY_FLAG_HAS_STATIC_WEP		= BIT(24),
41107527a782SJohannes Berg };
41117527a782SJohannes Berg 
41127527a782SJohannes Berg /**
41137527a782SJohannes Berg  * struct ieee80211_iface_limit - limit on certain interface types
41147527a782SJohannes Berg  * @max: maximum number of interfaces of these types
41157527a782SJohannes Berg  * @types: interface types (bits)
41167527a782SJohannes Berg  */
41177527a782SJohannes Berg struct ieee80211_iface_limit {
41187527a782SJohannes Berg 	u16 max;
41197527a782SJohannes Berg 	u16 types;
41207527a782SJohannes Berg };
41217527a782SJohannes Berg 
41227527a782SJohannes Berg /**
41237527a782SJohannes Berg  * struct ieee80211_iface_combination - possible interface combination
41247527a782SJohannes Berg  *
4125b80edbc1SLuciano Coelho  * With this structure the driver can describe which interface
4126b80edbc1SLuciano Coelho  * combinations it supports concurrently.
41277527a782SJohannes Berg  *
4128b80edbc1SLuciano Coelho  * Examples:
4129b80edbc1SLuciano Coelho  *
4130b80edbc1SLuciano Coelho  * 1. Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total:
41317527a782SJohannes Berg  *
4132819bf593SJohannes Berg  *    .. code-block:: c
4133819bf593SJohannes Berg  *
41347527a782SJohannes Berg  *	struct ieee80211_iface_limit limits1[] = {
41357527a782SJohannes Berg  *		{ .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
41367527a782SJohannes Berg  *		{ .max = 1, .types = BIT(NL80211_IFTYPE_AP}, },
41377527a782SJohannes Berg  *	};
41387527a782SJohannes Berg  *	struct ieee80211_iface_combination combination1 = {
41397527a782SJohannes Berg  *		.limits = limits1,
41407527a782SJohannes Berg  *		.n_limits = ARRAY_SIZE(limits1),
41417527a782SJohannes Berg  *		.max_interfaces = 2,
41427527a782SJohannes Berg  *		.beacon_int_infra_match = true,
41437527a782SJohannes Berg  *	};
41447527a782SJohannes Berg  *
41457527a782SJohannes Berg  *
4146b80edbc1SLuciano Coelho  * 2. Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total:
41477527a782SJohannes Berg  *
4148819bf593SJohannes Berg  *    .. code-block:: c
4149819bf593SJohannes Berg  *
41507527a782SJohannes Berg  *	struct ieee80211_iface_limit limits2[] = {
41517527a782SJohannes Berg  *		{ .max = 8, .types = BIT(NL80211_IFTYPE_AP) |
41527527a782SJohannes Berg  *				     BIT(NL80211_IFTYPE_P2P_GO), },
41537527a782SJohannes Berg  *	};
41547527a782SJohannes Berg  *	struct ieee80211_iface_combination combination2 = {
41557527a782SJohannes Berg  *		.limits = limits2,
41567527a782SJohannes Berg  *		.n_limits = ARRAY_SIZE(limits2),
41577527a782SJohannes Berg  *		.max_interfaces = 8,
41587527a782SJohannes Berg  *		.num_different_channels = 1,
41597527a782SJohannes Berg  *	};
41607527a782SJohannes Berg  *
41617527a782SJohannes Berg  *
4162b80edbc1SLuciano Coelho  * 3. Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total.
4163b80edbc1SLuciano Coelho  *
41647527a782SJohannes Berg  *    This allows for an infrastructure connection and three P2P connections.
41657527a782SJohannes Berg  *
4166819bf593SJohannes Berg  *    .. code-block:: c
4167819bf593SJohannes Berg  *
41687527a782SJohannes Berg  *	struct ieee80211_iface_limit limits3[] = {
41697527a782SJohannes Berg  *		{ .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
41707527a782SJohannes Berg  *		{ .max = 3, .types = BIT(NL80211_IFTYPE_P2P_GO) |
41717527a782SJohannes Berg  *				     BIT(NL80211_IFTYPE_P2P_CLIENT), },
41727527a782SJohannes Berg  *	};
41737527a782SJohannes Berg  *	struct ieee80211_iface_combination combination3 = {
41747527a782SJohannes Berg  *		.limits = limits3,
41757527a782SJohannes Berg  *		.n_limits = ARRAY_SIZE(limits3),
41767527a782SJohannes Berg  *		.max_interfaces = 4,
41777527a782SJohannes Berg  *		.num_different_channels = 2,
41787527a782SJohannes Berg  *	};
4179819bf593SJohannes Berg  *
41807527a782SJohannes Berg  */
41817527a782SJohannes Berg struct ieee80211_iface_combination {
4182c6c94aeaSJohannes Berg 	/**
4183c6c94aeaSJohannes Berg 	 * @limits:
4184c6c94aeaSJohannes Berg 	 * limits for the given interface types
4185c6c94aeaSJohannes Berg 	 */
41867527a782SJohannes Berg 	const struct ieee80211_iface_limit *limits;
4187c6c94aeaSJohannes Berg 
4188c6c94aeaSJohannes Berg 	/**
4189c6c94aeaSJohannes Berg 	 * @num_different_channels:
4190c6c94aeaSJohannes Berg 	 * can use up to this many different channels
4191c6c94aeaSJohannes Berg 	 */
41927527a782SJohannes Berg 	u32 num_different_channels;
4193c6c94aeaSJohannes Berg 
4194c6c94aeaSJohannes Berg 	/**
4195c6c94aeaSJohannes Berg 	 * @max_interfaces:
4196c6c94aeaSJohannes Berg 	 * maximum number of interfaces in total allowed in this group
4197c6c94aeaSJohannes Berg 	 */
41987527a782SJohannes Berg 	u16 max_interfaces;
4199c6c94aeaSJohannes Berg 
4200c6c94aeaSJohannes Berg 	/**
4201c6c94aeaSJohannes Berg 	 * @n_limits:
4202c6c94aeaSJohannes Berg 	 * number of limitations
4203c6c94aeaSJohannes Berg 	 */
42047527a782SJohannes Berg 	u8 n_limits;
4205c6c94aeaSJohannes Berg 
4206c6c94aeaSJohannes Berg 	/**
4207c6c94aeaSJohannes Berg 	 * @beacon_int_infra_match:
4208c6c94aeaSJohannes Berg 	 * In this combination, the beacon intervals between infrastructure
4209c6c94aeaSJohannes Berg 	 * and AP types must match. This is required only in special cases.
4210c6c94aeaSJohannes Berg 	 */
42117527a782SJohannes Berg 	bool beacon_int_infra_match;
4212c6c94aeaSJohannes Berg 
4213c6c94aeaSJohannes Berg 	/**
4214c6c94aeaSJohannes Berg 	 * @radar_detect_widths:
4215c6c94aeaSJohannes Berg 	 * bitmap of channel widths supported for radar detection
4216c6c94aeaSJohannes Berg 	 */
421711c4a075SSimon Wunderlich 	u8 radar_detect_widths;
4218c6c94aeaSJohannes Berg 
4219c6c94aeaSJohannes Berg 	/**
4220c6c94aeaSJohannes Berg 	 * @radar_detect_regions:
4221c6c94aeaSJohannes Berg 	 * bitmap of regions supported for radar detection
4222c6c94aeaSJohannes Berg 	 */
42238c48b50aSFelix Fietkau 	u8 radar_detect_regions;
4224c6c94aeaSJohannes Berg 
4225c6c94aeaSJohannes Berg 	/**
4226c6c94aeaSJohannes Berg 	 * @beacon_int_min_gcd:
4227c6c94aeaSJohannes Berg 	 * This interface combination supports different beacon intervals.
4228c6c94aeaSJohannes Berg 	 *
4229c6c94aeaSJohannes Berg 	 * = 0
4230c6c94aeaSJohannes Berg 	 *   all beacon intervals for different interface must be same.
4231c6c94aeaSJohannes Berg 	 * > 0
4232c6c94aeaSJohannes Berg 	 *   any beacon interval for the interface part of this combination AND
4233c6c94aeaSJohannes Berg 	 *   GCD of all beacon intervals from beaconing interfaces of this
4234c6c94aeaSJohannes Berg 	 *   combination must be greater or equal to this value.
4235c6c94aeaSJohannes Berg 	 */
42360c317a02SPurushottam Kushwaha 	u32 beacon_int_min_gcd;
42375be83de5SJohannes Berg };
42385be83de5SJohannes Berg 
42392e161f78SJohannes Berg struct ieee80211_txrx_stypes {
42402e161f78SJohannes Berg 	u16 tx, rx;
42412e161f78SJohannes Berg };
42422e161f78SJohannes Berg 
42435be83de5SJohannes Berg /**
4244ff1b6e69SJohannes Berg  * enum wiphy_wowlan_support_flags - WoWLAN support flags
4245ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_ANY: supports wakeup for the special "any"
4246ff1b6e69SJohannes Berg  *	trigger that keeps the device operating as-is and
4247ff1b6e69SJohannes Berg  *	wakes up the host on any activity, for example a
4248ff1b6e69SJohannes Berg  *	received packet that passed filtering; note that the
4249ff1b6e69SJohannes Berg  *	packet should be preserved in that case
4250ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_MAGIC_PKT: supports wakeup on magic packet
4251ff1b6e69SJohannes Berg  *	(see nl80211.h)
4252ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_DISCONNECT: supports wakeup on disconnect
425377dbbb13SJohannes Berg  * @WIPHY_WOWLAN_SUPPORTS_GTK_REKEY: supports GTK rekeying while asleep
425477dbbb13SJohannes Berg  * @WIPHY_WOWLAN_GTK_REKEY_FAILURE: supports wakeup on GTK rekey failure
425577dbbb13SJohannes Berg  * @WIPHY_WOWLAN_EAP_IDENTITY_REQ: supports wakeup on EAP identity request
425677dbbb13SJohannes Berg  * @WIPHY_WOWLAN_4WAY_HANDSHAKE: supports wakeup on 4-way handshake failure
425777dbbb13SJohannes Berg  * @WIPHY_WOWLAN_RFKILL_RELEASE: supports wakeup on RF-kill release
42588cd4d456SLuciano Coelho  * @WIPHY_WOWLAN_NET_DETECT: supports wakeup on network detection
4259ff1b6e69SJohannes Berg  */
4260ff1b6e69SJohannes Berg enum wiphy_wowlan_support_flags {
4261ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_ANY		= BIT(0),
4262ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_MAGIC_PKT		= BIT(1),
4263ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_DISCONNECT		= BIT(2),
426477dbbb13SJohannes Berg 	WIPHY_WOWLAN_SUPPORTS_GTK_REKEY	= BIT(3),
426577dbbb13SJohannes Berg 	WIPHY_WOWLAN_GTK_REKEY_FAILURE	= BIT(4),
426677dbbb13SJohannes Berg 	WIPHY_WOWLAN_EAP_IDENTITY_REQ	= BIT(5),
426777dbbb13SJohannes Berg 	WIPHY_WOWLAN_4WAY_HANDSHAKE	= BIT(6),
426877dbbb13SJohannes Berg 	WIPHY_WOWLAN_RFKILL_RELEASE	= BIT(7),
42698cd4d456SLuciano Coelho 	WIPHY_WOWLAN_NET_DETECT		= BIT(8),
4270ff1b6e69SJohannes Berg };
4271ff1b6e69SJohannes Berg 
42722a0e047eSJohannes Berg struct wiphy_wowlan_tcp_support {
42732a0e047eSJohannes Berg 	const struct nl80211_wowlan_tcp_data_token_feature *tok;
42742a0e047eSJohannes Berg 	u32 data_payload_max;
42752a0e047eSJohannes Berg 	u32 data_interval_max;
42762a0e047eSJohannes Berg 	u32 wake_payload_max;
42772a0e047eSJohannes Berg 	bool seq;
42782a0e047eSJohannes Berg };
42792a0e047eSJohannes Berg 
4280ff1b6e69SJohannes Berg /**
4281ff1b6e69SJohannes Berg  * struct wiphy_wowlan_support - WoWLAN support data
4282ff1b6e69SJohannes Berg  * @flags: see &enum wiphy_wowlan_support_flags
4283ff1b6e69SJohannes Berg  * @n_patterns: number of supported wakeup patterns
4284ff1b6e69SJohannes Berg  *	(see nl80211.h for the pattern definition)
4285ff1b6e69SJohannes Berg  * @pattern_max_len: maximum length of each pattern
4286ff1b6e69SJohannes Berg  * @pattern_min_len: minimum length of each pattern
4287bb92d199SAmitkumar Karwar  * @max_pkt_offset: maximum Rx packet offset
42888cd4d456SLuciano Coelho  * @max_nd_match_sets: maximum number of matchsets for net-detect,
42898cd4d456SLuciano Coelho  *	similar, but not necessarily identical, to max_match_sets for
42908cd4d456SLuciano Coelho  *	scheduled scans.
42918cd4d456SLuciano Coelho  *	See &struct cfg80211_sched_scan_request.@match_sets for more
42928cd4d456SLuciano Coelho  *	details.
42932a0e047eSJohannes Berg  * @tcp: TCP wakeup support information
4294ff1b6e69SJohannes Berg  */
4295ff1b6e69SJohannes Berg struct wiphy_wowlan_support {
4296ff1b6e69SJohannes Berg 	u32 flags;
4297ff1b6e69SJohannes Berg 	int n_patterns;
4298ff1b6e69SJohannes Berg 	int pattern_max_len;
4299ff1b6e69SJohannes Berg 	int pattern_min_len;
4300bb92d199SAmitkumar Karwar 	int max_pkt_offset;
43018cd4d456SLuciano Coelho 	int max_nd_match_sets;
43022a0e047eSJohannes Berg 	const struct wiphy_wowlan_tcp_support *tcp;
4303ff1b6e69SJohannes Berg };
4304ff1b6e69SJohannes Berg 
4305ff1b6e69SJohannes Berg /**
4306be29b99aSAmitkumar Karwar  * struct wiphy_coalesce_support - coalesce support data
4307be29b99aSAmitkumar Karwar  * @n_rules: maximum number of coalesce rules
4308be29b99aSAmitkumar Karwar  * @max_delay: maximum supported coalescing delay in msecs
4309be29b99aSAmitkumar Karwar  * @n_patterns: number of supported patterns in a rule
4310be29b99aSAmitkumar Karwar  *	(see nl80211.h for the pattern definition)
4311be29b99aSAmitkumar Karwar  * @pattern_max_len: maximum length of each pattern
4312be29b99aSAmitkumar Karwar  * @pattern_min_len: minimum length of each pattern
4313be29b99aSAmitkumar Karwar  * @max_pkt_offset: maximum Rx packet offset
4314be29b99aSAmitkumar Karwar  */
4315be29b99aSAmitkumar Karwar struct wiphy_coalesce_support {
4316be29b99aSAmitkumar Karwar 	int n_rules;
4317be29b99aSAmitkumar Karwar 	int max_delay;
4318be29b99aSAmitkumar Karwar 	int n_patterns;
4319be29b99aSAmitkumar Karwar 	int pattern_max_len;
4320be29b99aSAmitkumar Karwar 	int pattern_min_len;
4321be29b99aSAmitkumar Karwar 	int max_pkt_offset;
4322be29b99aSAmitkumar Karwar };
4323be29b99aSAmitkumar Karwar 
4324be29b99aSAmitkumar Karwar /**
4325ad7e718cSJohannes Berg  * enum wiphy_vendor_command_flags - validation flags for vendor commands
4326ad7e718cSJohannes Berg  * @WIPHY_VENDOR_CMD_NEED_WDEV: vendor command requires wdev
4327ad7e718cSJohannes Berg  * @WIPHY_VENDOR_CMD_NEED_NETDEV: vendor command requires netdev
4328ad7e718cSJohannes Berg  * @WIPHY_VENDOR_CMD_NEED_RUNNING: interface/wdev must be up & running
4329ad7e718cSJohannes Berg  *	(must be combined with %_WDEV or %_NETDEV)
4330ad7e718cSJohannes Berg  */
4331ad7e718cSJohannes Berg enum wiphy_vendor_command_flags {
4332ad7e718cSJohannes Berg 	WIPHY_VENDOR_CMD_NEED_WDEV = BIT(0),
4333ad7e718cSJohannes Berg 	WIPHY_VENDOR_CMD_NEED_NETDEV = BIT(1),
4334ad7e718cSJohannes Berg 	WIPHY_VENDOR_CMD_NEED_RUNNING = BIT(2),
4335ad7e718cSJohannes Berg };
4336ad7e718cSJohannes Berg 
4337ad7e718cSJohannes Berg /**
4338466b9936Stamizhr@codeaurora.org  * enum wiphy_opmode_flag - Station's ht/vht operation mode information flags
4339466b9936Stamizhr@codeaurora.org  *
4340466b9936Stamizhr@codeaurora.org  * @STA_OPMODE_MAX_BW_CHANGED: Max Bandwidth changed
4341466b9936Stamizhr@codeaurora.org  * @STA_OPMODE_SMPS_MODE_CHANGED: SMPS mode changed
4342466b9936Stamizhr@codeaurora.org  * @STA_OPMODE_N_SS_CHANGED: max N_SS (number of spatial streams) changed
4343466b9936Stamizhr@codeaurora.org  *
4344466b9936Stamizhr@codeaurora.org  */
4345466b9936Stamizhr@codeaurora.org enum wiphy_opmode_flag {
4346466b9936Stamizhr@codeaurora.org 	STA_OPMODE_MAX_BW_CHANGED	= BIT(0),
4347466b9936Stamizhr@codeaurora.org 	STA_OPMODE_SMPS_MODE_CHANGED	= BIT(1),
4348466b9936Stamizhr@codeaurora.org 	STA_OPMODE_N_SS_CHANGED		= BIT(2),
4349466b9936Stamizhr@codeaurora.org };
4350466b9936Stamizhr@codeaurora.org 
4351466b9936Stamizhr@codeaurora.org /**
4352466b9936Stamizhr@codeaurora.org  * struct sta_opmode_info - Station's ht/vht operation mode information
4353466b9936Stamizhr@codeaurora.org  * @changed: contains value from &enum wiphy_opmode_flag
43545e78abd0Stamizhr@codeaurora.org  * @smps_mode: New SMPS mode value from &enum nl80211_smps_mode of a station
43555e78abd0Stamizhr@codeaurora.org  * @bw: new max bandwidth value from &enum nl80211_chan_width of a station
4356466b9936Stamizhr@codeaurora.org  * @rx_nss: new rx_nss value of a station
4357466b9936Stamizhr@codeaurora.org  */
4358466b9936Stamizhr@codeaurora.org 
4359466b9936Stamizhr@codeaurora.org struct sta_opmode_info {
4360466b9936Stamizhr@codeaurora.org 	u32 changed;
43615e78abd0Stamizhr@codeaurora.org 	enum nl80211_smps_mode smps_mode;
43625e78abd0Stamizhr@codeaurora.org 	enum nl80211_chan_width bw;
4363466b9936Stamizhr@codeaurora.org 	u8 rx_nss;
4364466b9936Stamizhr@codeaurora.org };
4365466b9936Stamizhr@codeaurora.org 
436691046d63SJohannes Berg #define VENDOR_CMD_RAW_DATA ((const struct nla_policy *)(long)(-ENODATA))
4367901bb989SJohannes Berg 
4368466b9936Stamizhr@codeaurora.org /**
4369ad7e718cSJohannes Berg  * struct wiphy_vendor_command - vendor command definition
4370ad7e718cSJohannes Berg  * @info: vendor command identifying information, as used in nl80211
4371ad7e718cSJohannes Berg  * @flags: flags, see &enum wiphy_vendor_command_flags
4372ad7e718cSJohannes Berg  * @doit: callback for the operation, note that wdev is %NULL if the
4373ad7e718cSJohannes Berg  *	flags didn't ask for a wdev and non-%NULL otherwise; the data
4374ad7e718cSJohannes Berg  *	pointer may be %NULL if userspace provided no data at all
43757bdbe400SJohannes Berg  * @dumpit: dump callback, for transferring bigger/multiple items. The
43767bdbe400SJohannes Berg  *	@storage points to cb->args[5], ie. is preserved over the multiple
43777bdbe400SJohannes Berg  *	dumpit calls.
4378901bb989SJohannes Berg  * @policy: policy pointer for attributes within %NL80211_ATTR_VENDOR_DATA.
4379901bb989SJohannes Berg  *	Set this to %VENDOR_CMD_RAW_DATA if no policy can be given and the
4380901bb989SJohannes Berg  *	attribute is just raw data (e.g. a firmware command).
4381901bb989SJohannes Berg  * @maxattr: highest attribute number in policy
43827bdbe400SJohannes Berg  * It's recommended to not have the same sub command with both @doit and
43837bdbe400SJohannes Berg  * @dumpit, so that userspace can assume certain ones are get and others
43847bdbe400SJohannes Berg  * are used with dump requests.
4385ad7e718cSJohannes Berg  */
4386ad7e718cSJohannes Berg struct wiphy_vendor_command {
4387ad7e718cSJohannes Berg 	struct nl80211_vendor_cmd_info info;
4388ad7e718cSJohannes Berg 	u32 flags;
4389ad7e718cSJohannes Berg 	int (*doit)(struct wiphy *wiphy, struct wireless_dev *wdev,
4390ad7e718cSJohannes Berg 		    const void *data, int data_len);
43917bdbe400SJohannes Berg 	int (*dumpit)(struct wiphy *wiphy, struct wireless_dev *wdev,
43927bdbe400SJohannes Berg 		      struct sk_buff *skb, const void *data, int data_len,
43937bdbe400SJohannes Berg 		      unsigned long *storage);
4394901bb989SJohannes Berg 	const struct nla_policy *policy;
4395901bb989SJohannes Berg 	unsigned int maxattr;
4396ad7e718cSJohannes Berg };
4397ad7e718cSJohannes Berg 
4398ad7e718cSJohannes Berg /**
4399019ae3a9SKanchanapally, Vidyullatha  * struct wiphy_iftype_ext_capab - extended capabilities per interface type
4400019ae3a9SKanchanapally, Vidyullatha  * @iftype: interface type
4401019ae3a9SKanchanapally, Vidyullatha  * @extended_capabilities: extended capabilities supported by the driver,
4402019ae3a9SKanchanapally, Vidyullatha  *	additional capabilities might be supported by userspace; these are the
4403019ae3a9SKanchanapally, Vidyullatha  *	802.11 extended capabilities ("Extended Capabilities element") and are
4404019ae3a9SKanchanapally, Vidyullatha  *	in the same format as in the information element. See IEEE Std
4405019ae3a9SKanchanapally, Vidyullatha  *	802.11-2012 8.4.2.29 for the defined fields.
4406019ae3a9SKanchanapally, Vidyullatha  * @extended_capabilities_mask: mask of the valid values
4407019ae3a9SKanchanapally, Vidyullatha  * @extended_capabilities_len: length of the extended capabilities
4408019ae3a9SKanchanapally, Vidyullatha  */
4409019ae3a9SKanchanapally, Vidyullatha struct wiphy_iftype_ext_capab {
4410019ae3a9SKanchanapally, Vidyullatha 	enum nl80211_iftype iftype;
4411019ae3a9SKanchanapally, Vidyullatha 	const u8 *extended_capabilities;
4412019ae3a9SKanchanapally, Vidyullatha 	const u8 *extended_capabilities_mask;
4413019ae3a9SKanchanapally, Vidyullatha 	u8 extended_capabilities_len;
4414019ae3a9SKanchanapally, Vidyullatha };
4415019ae3a9SKanchanapally, Vidyullatha 
4416019ae3a9SKanchanapally, Vidyullatha /**
44179bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_capabilities - cfg80211 peer measurement capabilities
44189bb7e0f2SJohannes Berg  * @max_peers: maximum number of peers in a single measurement
44199bb7e0f2SJohannes Berg  * @report_ap_tsf: can report assoc AP's TSF for radio resource measurement
44209bb7e0f2SJohannes Berg  * @randomize_mac_addr: can randomize MAC address for measurement
44219bb7e0f2SJohannes Berg  * @ftm.supported: FTM measurement is supported
44229bb7e0f2SJohannes Berg  * @ftm.asap: ASAP-mode is supported
44239bb7e0f2SJohannes Berg  * @ftm.non_asap: non-ASAP-mode is supported
44249bb7e0f2SJohannes Berg  * @ftm.request_lci: can request LCI data
44259bb7e0f2SJohannes Berg  * @ftm.request_civicloc: can request civic location data
44269bb7e0f2SJohannes Berg  * @ftm.preambles: bitmap of preambles supported (&enum nl80211_preamble)
44279bb7e0f2SJohannes Berg  * @ftm.bandwidths: bitmap of bandwidths supported (&enum nl80211_chan_width)
44289bb7e0f2SJohannes Berg  * @ftm.max_bursts_exponent: maximum burst exponent supported
44299bb7e0f2SJohannes Berg  *	(set to -1 if not limited; note that setting this will necessarily
44309bb7e0f2SJohannes Berg  *	forbid using the value 15 to let the responder pick)
44319bb7e0f2SJohannes Berg  * @ftm.max_ftms_per_burst: maximum FTMs per burst supported (set to 0 if
44329bb7e0f2SJohannes Berg  *	not limited)
44339bb7e0f2SJohannes Berg  */
44349bb7e0f2SJohannes Berg struct cfg80211_pmsr_capabilities {
44359bb7e0f2SJohannes Berg 	unsigned int max_peers;
44369bb7e0f2SJohannes Berg 	u8 report_ap_tsf:1,
44379bb7e0f2SJohannes Berg 	   randomize_mac_addr:1;
44389bb7e0f2SJohannes Berg 
44399bb7e0f2SJohannes Berg 	struct {
44409bb7e0f2SJohannes Berg 		u32 preambles;
44419bb7e0f2SJohannes Berg 		u32 bandwidths;
44429bb7e0f2SJohannes Berg 		s8 max_bursts_exponent;
44439bb7e0f2SJohannes Berg 		u8 max_ftms_per_burst;
44449bb7e0f2SJohannes Berg 		u8 supported:1,
44459bb7e0f2SJohannes Berg 		   asap:1,
44469bb7e0f2SJohannes Berg 		   non_asap:1,
44479bb7e0f2SJohannes Berg 		   request_lci:1,
44489bb7e0f2SJohannes Berg 		   request_civicloc:1;
44499bb7e0f2SJohannes Berg 	} ftm;
44509bb7e0f2SJohannes Berg };
44519bb7e0f2SJohannes Berg 
44529bb7e0f2SJohannes Berg /**
4453d6039a34SVeerendranath Jakkam  * struct wiphy_iftype_akm_suites - This structure encapsulates supported akm
4454d6039a34SVeerendranath Jakkam  * suites for interface types defined in @iftypes_mask. Each type in the
4455d6039a34SVeerendranath Jakkam  * @iftypes_mask must be unique across all instances of iftype_akm_suites.
4456d6039a34SVeerendranath Jakkam  *
4457d6039a34SVeerendranath Jakkam  * @iftypes_mask: bitmask of interfaces types
4458d6039a34SVeerendranath Jakkam  * @akm_suites: points to an array of supported akm suites
4459d6039a34SVeerendranath Jakkam  * @n_akm_suites: number of supported AKM suites
4460d6039a34SVeerendranath Jakkam  */
4461d6039a34SVeerendranath Jakkam struct wiphy_iftype_akm_suites {
4462d6039a34SVeerendranath Jakkam 	u16 iftypes_mask;
4463d6039a34SVeerendranath Jakkam 	const u32 *akm_suites;
4464d6039a34SVeerendranath Jakkam 	int n_akm_suites;
4465d6039a34SVeerendranath Jakkam };
4466d6039a34SVeerendranath Jakkam 
4467d6039a34SVeerendranath Jakkam /**
44685be83de5SJohannes Berg  * struct wiphy - wireless hardware description
44692784fe91SLuis R. Rodriguez  * @reg_notifier: the driver's regulatory notification callback,
44702784fe91SLuis R. Rodriguez  *	note that if your driver uses wiphy_apply_custom_regulatory()
44712784fe91SLuis R. Rodriguez  *	the reg_notifier's request can be passed as NULL
4472d3236553SJohannes Berg  * @regd: the driver's regulatory domain, if one was requested via
4473d3236553SJohannes Berg  *	the regulatory_hint() API. This can be used by the driver
4474d3236553SJohannes Berg  *	on the reg_notifier() if it chooses to ignore future
4475d3236553SJohannes Berg  *	regulatory domain changes caused by other drivers.
4476d3236553SJohannes Berg  * @signal_type: signal type reported in &struct cfg80211_bss.
4477d3236553SJohannes Berg  * @cipher_suites: supported cipher suites
4478d3236553SJohannes Berg  * @n_cipher_suites: number of supported cipher suites
4479d6039a34SVeerendranath Jakkam  * @akm_suites: supported AKM suites. These are the default AKMs supported if
4480d6039a34SVeerendranath Jakkam  *	the supported AKMs not advertized for a specific interface type in
4481d6039a34SVeerendranath Jakkam  *	iftype_akm_suites.
4482ab4dfa20SVeerendranath Jakkam  * @n_akm_suites: number of supported AKM suites
4483d6039a34SVeerendranath Jakkam  * @iftype_akm_suites: array of supported akm suites info per interface type.
4484d6039a34SVeerendranath Jakkam  *	Note that the bits in @iftypes_mask inside this structure cannot
4485d6039a34SVeerendranath Jakkam  *	overlap (i.e. only one occurrence of each type is allowed across all
4486d6039a34SVeerendranath Jakkam  *	instances of iftype_akm_suites).
4487d6039a34SVeerendranath Jakkam  * @num_iftype_akm_suites: number of interface types for which supported akm
4488d6039a34SVeerendranath Jakkam  *	suites are specified separately.
4489b9a5f8caSJouni Malinen  * @retry_short: Retry limit for short frames (dot11ShortRetryLimit)
4490b9a5f8caSJouni Malinen  * @retry_long: Retry limit for long frames (dot11LongRetryLimit)
4491b9a5f8caSJouni Malinen  * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold);
4492b9a5f8caSJouni Malinen  *	-1 = fragmentation disabled, only odd values >= 256 used
4493b9a5f8caSJouni Malinen  * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled
4494abe37c4bSJohannes Berg  * @_net: the network namespace this wiphy currently lives in
4495ef15aac6SJohannes Berg  * @perm_addr: permanent MAC address of this device
4496ef15aac6SJohannes Berg  * @addr_mask: If the device supports multiple MAC addresses by masking,
4497ef15aac6SJohannes Berg  *	set this to a mask with variable bits set to 1, e.g. if the last
44980fcf8ac5SLuciano Coelho  *	four bits are variable then set it to 00-00-00-00-00-0f. The actual
4499ef15aac6SJohannes Berg  *	variable bits shall be determined by the interfaces added, with
4500ef15aac6SJohannes Berg  *	interfaces not matching the mask being rejected to be brought up.
4501ef15aac6SJohannes Berg  * @n_addresses: number of addresses in @addresses.
4502ef15aac6SJohannes Berg  * @addresses: If the device has more than one address, set this pointer
4503ef15aac6SJohannes Berg  *	to a list of addresses (6 bytes each). The first one will be used
4504ef15aac6SJohannes Berg  *	by default for perm_addr. In this case, the mask should be set to
4505ef15aac6SJohannes Berg  *	all-zeroes. In this case it is assumed that the device can handle
4506ef15aac6SJohannes Berg  *	the same number of arbitrary MAC addresses.
4507fd235913SRandy Dunlap  * @registered: protects ->resume and ->suspend sysfs callbacks against
4508fd235913SRandy Dunlap  *	unregister hardware
4509edf77192SJérôme Pouiller  * @debugfsdir: debugfs directory used for this wiphy (ieee80211/<wiphyname>).
4510edf77192SJérôme Pouiller  *	It will be renamed automatically on wiphy renames
451115bc6dfbSJérôme Pouiller  * @dev: (virtual) struct device for this wiphy. The item in
451215bc6dfbSJérôme Pouiller  *	/sys/class/ieee80211/ points to this. You need use set_wiphy_dev()
451315bc6dfbSJérôme Pouiller  *	(see below).
4514abe37c4bSJohannes Berg  * @wext: wireless extension handlers
4515abe37c4bSJohannes Berg  * @priv: driver private data (sized according to wiphy_new() parameter)
4516abe37c4bSJohannes Berg  * @interface_modes: bitmask of interfaces types valid for this wiphy,
4517abe37c4bSJohannes Berg  *	must be set by driver
45187527a782SJohannes Berg  * @iface_combinations: Valid interface combinations array, should not
45197527a782SJohannes Berg  *	list single interface types.
45207527a782SJohannes Berg  * @n_iface_combinations: number of entries in @iface_combinations array.
45217527a782SJohannes Berg  * @software_iftypes: bitmask of software interface types, these are not
45227527a782SJohannes Berg  *	subject to any restrictions since they are purely managed in SW.
4523abe37c4bSJohannes Berg  * @flags: wiphy flags, see &enum wiphy_flags
4524a2f73b6cSLuis R. Rodriguez  * @regulatory_flags: wiphy regulatory flags, see
4525a2f73b6cSLuis R. Rodriguez  *	&enum ieee80211_regulatory_flags
45261f074bd8SJohannes Berg  * @features: features advertised to nl80211, see &enum nl80211_feature_flags.
4527d75bb06bSGautam Kumar Shukla  * @ext_features: extended features advertised to nl80211, see
4528d75bb06bSGautam Kumar Shukla  *	&enum nl80211_ext_feature_index.
4529abe37c4bSJohannes Berg  * @bss_priv_size: each BSS struct has private data allocated with it,
4530abe37c4bSJohannes Berg  *	this variable determines its size
4531abe37c4bSJohannes Berg  * @max_scan_ssids: maximum number of SSIDs the device can scan for in
4532abe37c4bSJohannes Berg  *	any given scan
4533ca986ad9SArend Van Spriel  * @max_sched_scan_reqs: maximum number of scheduled scan requests that
4534ca986ad9SArend Van Spriel  *	the device can run concurrently.
453593b6aa69SLuciano Coelho  * @max_sched_scan_ssids: maximum number of SSIDs the device can scan
453693b6aa69SLuciano Coelho  *	for in any given scheduled scan
4537a1f1c21cSLuciano Coelho  * @max_match_sets: maximum number of match sets the device can handle
4538a1f1c21cSLuciano Coelho  *	when performing a scheduled scan, 0 if filtering is not
4539a1f1c21cSLuciano Coelho  *	supported.
4540abe37c4bSJohannes Berg  * @max_scan_ie_len: maximum length of user-controlled IEs device can
4541abe37c4bSJohannes Berg  *	add to probe request frames transmitted during a scan, must not
4542abe37c4bSJohannes Berg  *	include fixed IEs like supported rates
45435a865badSLuciano Coelho  * @max_sched_scan_ie_len: same as max_scan_ie_len, but for scheduled
45445a865badSLuciano Coelho  *	scans
45453b06d277SAvraham Stern  * @max_sched_scan_plans: maximum number of scan plans (scan interval and number
45463b06d277SAvraham Stern  *	of iterations) for scheduled scan supported by the device.
45473b06d277SAvraham Stern  * @max_sched_scan_plan_interval: maximum interval (in seconds) for a
45483b06d277SAvraham Stern  *	single scan plan supported by the device.
45493b06d277SAvraham Stern  * @max_sched_scan_plan_iterations: maximum number of iterations for a single
45503b06d277SAvraham Stern  *	scan plan supported by the device.
4551abe37c4bSJohannes Berg  * @coverage_class: current coverage class
4552abe37c4bSJohannes Berg  * @fw_version: firmware version for ethtool reporting
4553abe37c4bSJohannes Berg  * @hw_version: hardware version for ethtool reporting
4554abe37c4bSJohannes Berg  * @max_num_pmkids: maximum number of PMKIDs supported by device
4555abe37c4bSJohannes Berg  * @privid: a pointer that drivers can use to identify if an arbitrary
4556abe37c4bSJohannes Berg  *	wiphy is theirs, e.g. in global notifiers
4557abe37c4bSJohannes Berg  * @bands: information about bands/channels supported by this device
45582e161f78SJohannes Berg  *
45592e161f78SJohannes Berg  * @mgmt_stypes: bitmasks of frame subtypes that can be subscribed to or
45602e161f78SJohannes Berg  *	transmitted through nl80211, points to an array indexed by interface
45612e161f78SJohannes Berg  *	type
4562a7ffac95SBruno Randolf  *
45637f531e03SBruno Randolf  * @available_antennas_tx: bitmap of antennas which are available to be
45647f531e03SBruno Randolf  *	configured as TX antennas. Antenna configuration commands will be
45657f531e03SBruno Randolf  *	rejected unless this or @available_antennas_rx is set.
45667f531e03SBruno Randolf  *
45677f531e03SBruno Randolf  * @available_antennas_rx: bitmap of antennas which are available to be
45687f531e03SBruno Randolf  *	configured as RX antennas. Antenna configuration commands will be
45697f531e03SBruno Randolf  *	rejected unless this or @available_antennas_tx is set.
4570a293911dSJohannes Berg  *
457115f0ebc2SRandy Dunlap  * @probe_resp_offload:
457215f0ebc2SRandy Dunlap  *	 Bitmap of supported protocols for probe response offloading.
457315f0ebc2SRandy Dunlap  *	 See &enum nl80211_probe_resp_offload_support_attr. Only valid
457415f0ebc2SRandy Dunlap  *	 when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set.
457515f0ebc2SRandy Dunlap  *
4576a293911dSJohannes Berg  * @max_remain_on_channel_duration: Maximum time a remain-on-channel operation
4577a293911dSJohannes Berg  *	may request, if implemented.
4578ff1b6e69SJohannes Berg  *
4579ff1b6e69SJohannes Berg  * @wowlan: WoWLAN support information
45806abb9cb9SJohannes Berg  * @wowlan_config: current WoWLAN configuration; this should usually not be
45816abb9cb9SJohannes Berg  *	used since access to it is necessarily racy, use the parameter passed
45826abb9cb9SJohannes Berg  *	to the suspend() operation instead.
4583562a7480SJohannes Berg  *
4584562a7480SJohannes Berg  * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features.
45857e7c8926SBen Greear  * @ht_capa_mod_mask:  Specify what ht_cap values can be over-ridden.
45867e7c8926SBen Greear  *	If null, then none can be over-ridden.
4587ee2aca34SJohannes Berg  * @vht_capa_mod_mask:  Specify what VHT capabilities can be over-ridden.
4588ee2aca34SJohannes Berg  *	If null, then none can be over-ridden.
458977765eafSVasanthakumar Thiagarajan  *
459053873f13SJohannes Berg  * @wdev_list: the list of associated (virtual) interfaces; this list must
459153873f13SJohannes Berg  *	not be modified by the driver, but can be read with RTNL/RCU protection.
459253873f13SJohannes Berg  *
459377765eafSVasanthakumar Thiagarajan  * @max_acl_mac_addrs: Maximum number of MAC addresses that the device
459477765eafSVasanthakumar Thiagarajan  *	supports for ACL.
4595a50df0c4SJohannes Berg  *
4596a50df0c4SJohannes Berg  * @extended_capabilities: extended capabilities supported by the driver,
4597a50df0c4SJohannes Berg  *	additional capabilities might be supported by userspace; these are
4598a50df0c4SJohannes Berg  *	the 802.11 extended capabilities ("Extended Capabilities element")
4599a50df0c4SJohannes Berg  *	and are in the same format as in the information element. See
4600019ae3a9SKanchanapally, Vidyullatha  *	802.11-2012 8.4.2.29 for the defined fields. These are the default
4601019ae3a9SKanchanapally, Vidyullatha  *	extended capabilities to be used if the capabilities are not specified
4602019ae3a9SKanchanapally, Vidyullatha  *	for a specific interface type in iftype_ext_capab.
4603a50df0c4SJohannes Berg  * @extended_capabilities_mask: mask of the valid values
4604a50df0c4SJohannes Berg  * @extended_capabilities_len: length of the extended capabilities
4605019ae3a9SKanchanapally, Vidyullatha  * @iftype_ext_capab: array of extended capabilities per interface type
4606019ae3a9SKanchanapally, Vidyullatha  * @num_iftype_ext_capab: number of interface types for which extended
4607019ae3a9SKanchanapally, Vidyullatha  *	capabilities are specified separately.
4608be29b99aSAmitkumar Karwar  * @coalesce: packet coalescing support information
4609ad7e718cSJohannes Berg  *
4610ad7e718cSJohannes Berg  * @vendor_commands: array of vendor commands supported by the hardware
4611ad7e718cSJohannes Berg  * @n_vendor_commands: number of vendor commands
4612567ffc35SJohannes Berg  * @vendor_events: array of vendor events supported by the hardware
4613567ffc35SJohannes Berg  * @n_vendor_events: number of vendor events
4614b43504cfSJouni Malinen  *
4615b43504cfSJouni Malinen  * @max_ap_assoc_sta: maximum number of associated stations supported in AP mode
4616b43504cfSJouni Malinen  *	(including P2P GO) or 0 to indicate no such limit is advertised. The
4617b43504cfSJouni Malinen  *	driver is allowed to advertise a theoretical limit that it can reach in
4618b43504cfSJouni Malinen  *	some cases, but may not always reach.
4619c2e4323bSLuciano Coelho  *
4620c2e4323bSLuciano Coelho  * @max_num_csa_counters: Number of supported csa_counters in beacons
4621c2e4323bSLuciano Coelho  *	and probe responses.  This value should be set if the driver
4622c2e4323bSLuciano Coelho  *	wishes to limit the number of csa counters. Default (0) means
4623c2e4323bSLuciano Coelho  *	infinite.
462438de03d2SArend van Spriel  * @bss_select_support: bitmask indicating the BSS selection criteria supported
462538de03d2SArend van Spriel  *	by the driver in the .connect() callback. The bit position maps to the
462638de03d2SArend van Spriel  *	attribute indices defined in &enum nl80211_bss_select_attr.
4627a442b761SAyala Beker  *
46288585989dSLuca Coelho  * @nan_supported_bands: bands supported by the device in NAN mode, a
46298585989dSLuca Coelho  *	bitmap of &enum nl80211_band values.  For instance, for
46308585989dSLuca Coelho  *	NL80211_BAND_2GHZ, bit 0 would be set
46318585989dSLuca Coelho  *	(i.e. BIT(NL80211_BAND_2GHZ)).
4632f3a7ca64SJohannes Berg  *
4633f3a7ca64SJohannes Berg  * @txq_limit: configuration of internal TX queue frame limit
4634f3a7ca64SJohannes Berg  * @txq_memory_limit: configuration internal TX queue memory limit
4635f3a7ca64SJohannes Berg  * @txq_quantum: configuration of internal TX queue scheduler quantum
46369bb7e0f2SJohannes Berg  *
4637213ed579SSara Sharon  * @support_mbssid: can HW support association with nontransmitted AP
4638213ed579SSara Sharon  * @support_only_he_mbssid: don't parse MBSSID elements if it is not
4639213ed579SSara Sharon  *	HE AP, in order to avoid compatibility issues.
4640213ed579SSara Sharon  *	@support_mbssid must be set for this to have any effect.
4641213ed579SSara Sharon  *
46429bb7e0f2SJohannes Berg  * @pmsr_capa: peer measurement capabilities
46433710a8a6SJohannes Berg  *
46443710a8a6SJohannes Berg  * @tid_config_support: describes the per-TID config support that the
46453710a8a6SJohannes Berg  *	device has
46463710a8a6SJohannes Berg  * @tid_config_support.vif: bitmap of attributes (configurations)
46473710a8a6SJohannes Berg  *	supported by the driver for each vif
46483710a8a6SJohannes Berg  * @tid_config_support.peer: bitmap of attributes (configurations)
46493710a8a6SJohannes Berg  *	supported by the driver for each peer
4650*6a21d16cSTamizh chelvam  * @tid_config_support.max_retry: maximum supported retry count for
4651*6a21d16cSTamizh chelvam  *	long/short retry configuration
4652d3236553SJohannes Berg  */
4653d3236553SJohannes Berg struct wiphy {
4654d3236553SJohannes Berg 	/* assign these fields before you register the wiphy */
4655d3236553SJohannes Berg 
4656d3236553SJohannes Berg 	u8 perm_addr[ETH_ALEN];
4657ef15aac6SJohannes Berg 	u8 addr_mask[ETH_ALEN];
4658ef15aac6SJohannes Berg 
4659ef15aac6SJohannes Berg 	struct mac_address *addresses;
4660d3236553SJohannes Berg 
46612e161f78SJohannes Berg 	const struct ieee80211_txrx_stypes *mgmt_stypes;
46622e161f78SJohannes Berg 
46637527a782SJohannes Berg 	const struct ieee80211_iface_combination *iface_combinations;
46647527a782SJohannes Berg 	int n_iface_combinations;
46657527a782SJohannes Berg 	u16 software_iftypes;
46667527a782SJohannes Berg 
46672e161f78SJohannes Berg 	u16 n_addresses;
46682e161f78SJohannes Berg 
4669d3236553SJohannes Berg 	/* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
4670d3236553SJohannes Berg 	u16 interface_modes;
4671d3236553SJohannes Berg 
467277765eafSVasanthakumar Thiagarajan 	u16 max_acl_mac_addrs;
467377765eafSVasanthakumar Thiagarajan 
4674a2f73b6cSLuis R. Rodriguez 	u32 flags, regulatory_flags, features;
4675d75bb06bSGautam Kumar Shukla 	u8 ext_features[DIV_ROUND_UP(NUM_NL80211_EXT_FEATURES, 8)];
4676463d0183SJohannes Berg 
4677562a7480SJohannes Berg 	u32 ap_sme_capa;
4678562a7480SJohannes Berg 
4679d3236553SJohannes Berg 	enum cfg80211_signal_type signal_type;
4680d3236553SJohannes Berg 
4681d3236553SJohannes Berg 	int bss_priv_size;
4682d3236553SJohannes Berg 	u8 max_scan_ssids;
4683ca986ad9SArend Van Spriel 	u8 max_sched_scan_reqs;
468493b6aa69SLuciano Coelho 	u8 max_sched_scan_ssids;
4685a1f1c21cSLuciano Coelho 	u8 max_match_sets;
4686d3236553SJohannes Berg 	u16 max_scan_ie_len;
46875a865badSLuciano Coelho 	u16 max_sched_scan_ie_len;
46883b06d277SAvraham Stern 	u32 max_sched_scan_plans;
46893b06d277SAvraham Stern 	u32 max_sched_scan_plan_interval;
46903b06d277SAvraham Stern 	u32 max_sched_scan_plan_iterations;
4691d3236553SJohannes Berg 
4692d3236553SJohannes Berg 	int n_cipher_suites;
4693d3236553SJohannes Berg 	const u32 *cipher_suites;
4694d3236553SJohannes Berg 
4695ab4dfa20SVeerendranath Jakkam 	int n_akm_suites;
4696ab4dfa20SVeerendranath Jakkam 	const u32 *akm_suites;
4697ab4dfa20SVeerendranath Jakkam 
4698d6039a34SVeerendranath Jakkam 	const struct wiphy_iftype_akm_suites *iftype_akm_suites;
4699d6039a34SVeerendranath Jakkam 	unsigned int num_iftype_akm_suites;
4700d6039a34SVeerendranath Jakkam 
4701b9a5f8caSJouni Malinen 	u8 retry_short;
4702b9a5f8caSJouni Malinen 	u8 retry_long;
4703b9a5f8caSJouni Malinen 	u32 frag_threshold;
4704b9a5f8caSJouni Malinen 	u32 rts_threshold;
470581077e82SLukáš Turek 	u8 coverage_class;
4706b9a5f8caSJouni Malinen 
470781135548SJiri Pirko 	char fw_version[ETHTOOL_FWVERS_LEN];
4708dfce95f5SKalle Valo 	u32 hw_version;
4709dfce95f5SKalle Valo 
4710dfb89c56SJohannes Berg #ifdef CONFIG_PM
4711964dc9e2SJohannes Berg 	const struct wiphy_wowlan_support *wowlan;
47126abb9cb9SJohannes Berg 	struct cfg80211_wowlan *wowlan_config;
4713dfb89c56SJohannes Berg #endif
4714ff1b6e69SJohannes Berg 
4715a293911dSJohannes Berg 	u16 max_remain_on_channel_duration;
4716a293911dSJohannes Berg 
471767fbb16bSSamuel Ortiz 	u8 max_num_pmkids;
471867fbb16bSSamuel Ortiz 
47197f531e03SBruno Randolf 	u32 available_antennas_tx;
47207f531e03SBruno Randolf 	u32 available_antennas_rx;
4721a7ffac95SBruno Randolf 
472287bbbe22SArik Nemtsov 	u32 probe_resp_offload;
472387bbbe22SArik Nemtsov 
4724a50df0c4SJohannes Berg 	const u8 *extended_capabilities, *extended_capabilities_mask;
4725a50df0c4SJohannes Berg 	u8 extended_capabilities_len;
4726a50df0c4SJohannes Berg 
4727019ae3a9SKanchanapally, Vidyullatha 	const struct wiphy_iftype_ext_capab *iftype_ext_capab;
4728019ae3a9SKanchanapally, Vidyullatha 	unsigned int num_iftype_ext_capab;
4729019ae3a9SKanchanapally, Vidyullatha 
4730cf5aa2f1SDavid Kilroy 	const void *privid;
4731d3236553SJohannes Berg 
473257fbcce3SJohannes Berg 	struct ieee80211_supported_band *bands[NUM_NL80211_BANDS];
4733d3236553SJohannes Berg 
47340c0280bdSLuis R. Rodriguez 	void (*reg_notifier)(struct wiphy *wiphy,
4735d3236553SJohannes Berg 			     struct regulatory_request *request);
4736d3236553SJohannes Berg 
4737d3236553SJohannes Berg 	/* fields below are read-only, assigned by cfg80211 */
4738d3236553SJohannes Berg 
4739458f4f9eSJohannes Berg 	const struct ieee80211_regdomain __rcu *regd;
4740d3236553SJohannes Berg 
4741d3236553SJohannes Berg 	struct device dev;
4742d3236553SJohannes Berg 
4743ecb44335SStanislaw Gruszka 	bool registered;
4744ecb44335SStanislaw Gruszka 
4745d3236553SJohannes Berg 	struct dentry *debugfsdir;
4746d3236553SJohannes Berg 
47477e7c8926SBen Greear 	const struct ieee80211_ht_cap *ht_capa_mod_mask;
4748ee2aca34SJohannes Berg 	const struct ieee80211_vht_cap *vht_capa_mod_mask;
47497e7c8926SBen Greear 
475053873f13SJohannes Berg 	struct list_head wdev_list;
475153873f13SJohannes Berg 
47520c5c9fb5SEric W. Biederman 	possible_net_t _net;
4753463d0183SJohannes Berg 
47543d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT
47553d23e349SJohannes Berg 	const struct iw_handler_def *wext;
47563d23e349SJohannes Berg #endif
47573d23e349SJohannes Berg 
4758be29b99aSAmitkumar Karwar 	const struct wiphy_coalesce_support *coalesce;
4759be29b99aSAmitkumar Karwar 
4760ad7e718cSJohannes Berg 	const struct wiphy_vendor_command *vendor_commands;
4761567ffc35SJohannes Berg 	const struct nl80211_vendor_cmd_info *vendor_events;
4762567ffc35SJohannes Berg 	int n_vendor_commands, n_vendor_events;
4763ad7e718cSJohannes Berg 
4764b43504cfSJouni Malinen 	u16 max_ap_assoc_sta;
4765b43504cfSJouni Malinen 
47669a774c78SAndrei Otcheretianski 	u8 max_num_csa_counters;
47679a774c78SAndrei Otcheretianski 
476838de03d2SArend van Spriel 	u32 bss_select_support;
476938de03d2SArend van Spriel 
47708585989dSLuca Coelho 	u8 nan_supported_bands;
47718585989dSLuca Coelho 
477252539ca8SToke Høiland-Jørgensen 	u32 txq_limit;
477352539ca8SToke Høiland-Jørgensen 	u32 txq_memory_limit;
477452539ca8SToke Høiland-Jørgensen 	u32 txq_quantum;
477552539ca8SToke Høiland-Jørgensen 
47761f6e0baaSJohn Crispin 	unsigned long tx_queue_len;
47771f6e0baaSJohn Crispin 
4778213ed579SSara Sharon 	u8 support_mbssid:1,
4779213ed579SSara Sharon 	   support_only_he_mbssid:1;
4780213ed579SSara Sharon 
47819bb7e0f2SJohannes Berg 	const struct cfg80211_pmsr_capabilities *pmsr_capa;
47829bb7e0f2SJohannes Berg 
47833710a8a6SJohannes Berg 	struct {
47843710a8a6SJohannes Berg 		u64 peer, vif;
4785*6a21d16cSTamizh chelvam 		u8 max_retry;
47863710a8a6SJohannes Berg 	} tid_config_support;
47873710a8a6SJohannes Berg 
4788*6a21d16cSTamizh chelvam 	u8 max_data_retry_count;
4789*6a21d16cSTamizh chelvam 
47901c06ef98SJohannes Berg 	char priv[0] __aligned(NETDEV_ALIGN);
4791d3236553SJohannes Berg };
4792d3236553SJohannes Berg 
4793463d0183SJohannes Berg static inline struct net *wiphy_net(struct wiphy *wiphy)
4794463d0183SJohannes Berg {
4795c2d9ba9bSEric Dumazet 	return read_pnet(&wiphy->_net);
4796463d0183SJohannes Berg }
4797463d0183SJohannes Berg 
4798463d0183SJohannes Berg static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net)
4799463d0183SJohannes Berg {
4800c2d9ba9bSEric Dumazet 	write_pnet(&wiphy->_net, net);
4801463d0183SJohannes Berg }
4802463d0183SJohannes Berg 
4803d3236553SJohannes Berg /**
4804d3236553SJohannes Berg  * wiphy_priv - return priv from wiphy
4805d3236553SJohannes Berg  *
4806d3236553SJohannes Berg  * @wiphy: the wiphy whose priv pointer to return
48070ae997dcSYacine Belkadi  * Return: The priv of @wiphy.
4808d3236553SJohannes Berg  */
4809d3236553SJohannes Berg static inline void *wiphy_priv(struct wiphy *wiphy)
4810d3236553SJohannes Berg {
4811d3236553SJohannes Berg 	BUG_ON(!wiphy);
4812d3236553SJohannes Berg 	return &wiphy->priv;
4813d3236553SJohannes Berg }
4814d3236553SJohannes Berg 
4815d3236553SJohannes Berg /**
4816f1f74825SDavid Kilroy  * priv_to_wiphy - return the wiphy containing the priv
4817f1f74825SDavid Kilroy  *
4818f1f74825SDavid Kilroy  * @priv: a pointer previously returned by wiphy_priv
48190ae997dcSYacine Belkadi  * Return: The wiphy of @priv.
4820f1f74825SDavid Kilroy  */
4821f1f74825SDavid Kilroy static inline struct wiphy *priv_to_wiphy(void *priv)
4822f1f74825SDavid Kilroy {
4823f1f74825SDavid Kilroy 	BUG_ON(!priv);
4824f1f74825SDavid Kilroy 	return container_of(priv, struct wiphy, priv);
4825f1f74825SDavid Kilroy }
4826f1f74825SDavid Kilroy 
4827f1f74825SDavid Kilroy /**
4828d3236553SJohannes Berg  * set_wiphy_dev - set device pointer for wiphy
4829d3236553SJohannes Berg  *
4830d3236553SJohannes Berg  * @wiphy: The wiphy whose device to bind
4831d3236553SJohannes Berg  * @dev: The device to parent it to
4832d3236553SJohannes Berg  */
4833d3236553SJohannes Berg static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev)
4834d3236553SJohannes Berg {
4835d3236553SJohannes Berg 	wiphy->dev.parent = dev;
4836d3236553SJohannes Berg }
4837d3236553SJohannes Berg 
4838d3236553SJohannes Berg /**
4839d3236553SJohannes Berg  * wiphy_dev - get wiphy dev pointer
4840d3236553SJohannes Berg  *
4841d3236553SJohannes Berg  * @wiphy: The wiphy whose device struct to look up
48420ae997dcSYacine Belkadi  * Return: The dev of @wiphy.
4843d3236553SJohannes Berg  */
4844d3236553SJohannes Berg static inline struct device *wiphy_dev(struct wiphy *wiphy)
4845d3236553SJohannes Berg {
4846d3236553SJohannes Berg 	return wiphy->dev.parent;
4847d3236553SJohannes Berg }
4848d3236553SJohannes Berg 
4849d3236553SJohannes Berg /**
4850d3236553SJohannes Berg  * wiphy_name - get wiphy name
4851d3236553SJohannes Berg  *
4852d3236553SJohannes Berg  * @wiphy: The wiphy whose name to return
48530ae997dcSYacine Belkadi  * Return: The name of @wiphy.
4854d3236553SJohannes Berg  */
4855e1db74fcSJoe Perches static inline const char *wiphy_name(const struct wiphy *wiphy)
4856d3236553SJohannes Berg {
4857d3236553SJohannes Berg 	return dev_name(&wiphy->dev);
4858d3236553SJohannes Berg }
4859d3236553SJohannes Berg 
4860d3236553SJohannes Berg /**
48611998d90aSBen Greear  * wiphy_new_nm - create a new wiphy for use with cfg80211
48621998d90aSBen Greear  *
48631998d90aSBen Greear  * @ops: The configuration operations for this device
48641998d90aSBen Greear  * @sizeof_priv: The size of the private area to allocate
48651998d90aSBen Greear  * @requested_name: Request a particular name.
48661998d90aSBen Greear  *	NULL is valid value, and means use the default phy%d naming.
48671998d90aSBen Greear  *
48681998d90aSBen Greear  * Create a new wiphy and associate the given operations with it.
48691998d90aSBen Greear  * @sizeof_priv bytes are allocated for private use.
48701998d90aSBen Greear  *
48711998d90aSBen Greear  * Return: A pointer to the new wiphy. This pointer must be
48721998d90aSBen Greear  * assigned to each netdev's ieee80211_ptr for proper operation.
48731998d90aSBen Greear  */
48741998d90aSBen Greear struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv,
48751998d90aSBen Greear 			   const char *requested_name);
48761998d90aSBen Greear 
48771998d90aSBen Greear /**
4878d3236553SJohannes Berg  * wiphy_new - create a new wiphy for use with cfg80211
4879d3236553SJohannes Berg  *
4880d3236553SJohannes Berg  * @ops: The configuration operations for this device
4881d3236553SJohannes Berg  * @sizeof_priv: The size of the private area to allocate
4882d3236553SJohannes Berg  *
4883d3236553SJohannes Berg  * Create a new wiphy and associate the given operations with it.
4884d3236553SJohannes Berg  * @sizeof_priv bytes are allocated for private use.
4885d3236553SJohannes Berg  *
48860ae997dcSYacine Belkadi  * Return: A pointer to the new wiphy. This pointer must be
48870ae997dcSYacine Belkadi  * assigned to each netdev's ieee80211_ptr for proper operation.
4888d3236553SJohannes Berg  */
48891998d90aSBen Greear static inline struct wiphy *wiphy_new(const struct cfg80211_ops *ops,
48901998d90aSBen Greear 				      int sizeof_priv)
48911998d90aSBen Greear {
48921998d90aSBen Greear 	return wiphy_new_nm(ops, sizeof_priv, NULL);
48931998d90aSBen Greear }
4894d3236553SJohannes Berg 
4895d3236553SJohannes Berg /**
4896d3236553SJohannes Berg  * wiphy_register - register a wiphy with cfg80211
4897d3236553SJohannes Berg  *
4898d3236553SJohannes Berg  * @wiphy: The wiphy to register.
4899d3236553SJohannes Berg  *
49000ae997dcSYacine Belkadi  * Return: A non-negative wiphy index or a negative error code.
4901d3236553SJohannes Berg  */
490210dd9b7cSJoe Perches int wiphy_register(struct wiphy *wiphy);
4903d3236553SJohannes Berg 
4904d3236553SJohannes Berg /**
4905d3236553SJohannes Berg  * wiphy_unregister - deregister a wiphy from cfg80211
4906d3236553SJohannes Berg  *
4907d3236553SJohannes Berg  * @wiphy: The wiphy to unregister.
4908d3236553SJohannes Berg  *
4909d3236553SJohannes Berg  * After this call, no more requests can be made with this priv
4910d3236553SJohannes Berg  * pointer, but the call may sleep to wait for an outstanding
4911d3236553SJohannes Berg  * request that is being handled.
4912d3236553SJohannes Berg  */
491310dd9b7cSJoe Perches void wiphy_unregister(struct wiphy *wiphy);
4914d3236553SJohannes Berg 
4915d3236553SJohannes Berg /**
4916d3236553SJohannes Berg  * wiphy_free - free wiphy
4917d3236553SJohannes Berg  *
4918d3236553SJohannes Berg  * @wiphy: The wiphy to free
4919d3236553SJohannes Berg  */
492010dd9b7cSJoe Perches void wiphy_free(struct wiphy *wiphy);
4921d3236553SJohannes Berg 
4922fffd0934SJohannes Berg /* internal structs */
49236829c878SJohannes Berg struct cfg80211_conn;
492419957bb3SJohannes Berg struct cfg80211_internal_bss;
4925fffd0934SJohannes Berg struct cfg80211_cached_keys;
49264a4b8169SAndrew Zaborowski struct cfg80211_cqm_config;
492719957bb3SJohannes Berg 
4928d3236553SJohannes Berg /**
492989a54e48SJohannes Berg  * struct wireless_dev - wireless device state
4930d3236553SJohannes Berg  *
493189a54e48SJohannes Berg  * For netdevs, this structure must be allocated by the driver
493289a54e48SJohannes Berg  * that uses the ieee80211_ptr field in struct net_device (this
493389a54e48SJohannes Berg  * is intentional so it can be allocated along with the netdev.)
493489a54e48SJohannes Berg  * It need not be registered then as netdev registration will
493589a54e48SJohannes Berg  * be intercepted by cfg80211 to see the new wireless device.
493689a54e48SJohannes Berg  *
493789a54e48SJohannes Berg  * For non-netdev uses, it must also be allocated by the driver
493889a54e48SJohannes Berg  * in response to the cfg80211 callbacks that require it, as
493989a54e48SJohannes Berg  * there's no netdev registration in that case it may not be
494089a54e48SJohannes Berg  * allocated outside of callback operations that return it.
4941d3236553SJohannes Berg  *
4942d3236553SJohannes Berg  * @wiphy: pointer to hardware description
4943d3236553SJohannes Berg  * @iftype: interface type
4944d3236553SJohannes Berg  * @list: (private) Used to collect the interfaces
494589a54e48SJohannes Berg  * @netdev: (private) Used to reference back to the netdev, may be %NULL
494689a54e48SJohannes Berg  * @identifier: (private) Identifier used in nl80211 to identify this
494789a54e48SJohannes Berg  *	wireless device if it has no netdev
4948d3236553SJohannes Berg  * @current_bss: (private) Used by the internal configuration code
49499e0e2961SMichal Kazior  * @chandef: (private) Used by the internal configuration code to track
49509e0e2961SMichal Kazior  *	the user-set channel definition.
4951780b40dfSJohannes Berg  * @preset_chandef: (private) Used by the internal configuration code to
4952aa430da4SJohannes Berg  *	track the channel to be used for AP later
4953d3236553SJohannes Berg  * @bssid: (private) Used by the internal configuration code
4954d3236553SJohannes Berg  * @ssid: (private) Used by the internal configuration code
4955d3236553SJohannes Berg  * @ssid_len: (private) Used by the internal configuration code
495629cbe68cSJohannes Berg  * @mesh_id_len: (private) Used by the internal configuration code
495729cbe68cSJohannes Berg  * @mesh_id_up_len: (private) Used by the internal configuration code
4958d3236553SJohannes Berg  * @wext: (private) Used by the internal wireless extensions compat code
49599874b71fSJohannes Berg  * @wext.ibss: (private) IBSS data part of wext handling
49609874b71fSJohannes Berg  * @wext.connect: (private) connection handling data
49619874b71fSJohannes Berg  * @wext.keys: (private) (WEP) key data
49629874b71fSJohannes Berg  * @wext.ie: (private) extra elements for association
49639874b71fSJohannes Berg  * @wext.ie_len: (private) length of extra elements
49649874b71fSJohannes Berg  * @wext.bssid: (private) selected network BSSID
49659874b71fSJohannes Berg  * @wext.ssid: (private) selected network SSID
49669874b71fSJohannes Berg  * @wext.default_key: (private) selected default key index
49679874b71fSJohannes Berg  * @wext.default_mgmt_key: (private) selected default management key index
49689874b71fSJohannes Berg  * @wext.prev_bssid: (private) previous BSSID for reassociation
49699874b71fSJohannes Berg  * @wext.prev_bssid_valid: (private) previous BSSID validity
49709bc383deSJohannes Berg  * @use_4addr: indicates 4addr mode is used on this interface, must be
49719bc383deSJohannes Berg  *	set by driver (if supported) on add_interface BEFORE registering the
49729bc383deSJohannes Berg  *	netdev and may otherwise be used by driver read-only, will be update
49739bc383deSJohannes Berg  *	by cfg80211 on change_interface
49742e161f78SJohannes Berg  * @mgmt_registrations: list of registrations for management frames
49752e161f78SJohannes Berg  * @mgmt_registrations_lock: lock for the list
49768d61ffa5SJohannes Berg  * @mtx: mutex used to lock data in this struct, may be used by drivers
49778d61ffa5SJohannes Berg  *	and some API functions require it held
497856d1893dSJohannes Berg  * @beacon_interval: beacon interval used on this device for transmitting
497956d1893dSJohannes Berg  *	beacons, 0 when not valid
498098104fdeSJohannes Berg  * @address: The address for this device, valid only if @netdev is %NULL
498173c7da3dSArend Van Spriel  * @is_running: true if this is a non-netdev device that has been started, e.g.
498273c7da3dSArend Van Spriel  *	the P2P Device.
498304f39047SSimon Wunderlich  * @cac_started: true if DFS channel availability check has been started
498404f39047SSimon Wunderlich  * @cac_start_time: timestamp (jiffies) when the dfs state was entered.
498531559f35SJanusz Dziedzic  * @cac_time_ms: CAC time in ms
4986780b40dfSJohannes Berg  * @ps: powersave mode is enabled
4987780b40dfSJohannes Berg  * @ps_timeout: dynamic powersave timeout
4988780b40dfSJohannes Berg  * @ap_unexpected_nlportid: (private) netlink port ID of application
4989780b40dfSJohannes Berg  *	registered for unexpected class 3 frames (AP mode)
4990780b40dfSJohannes Berg  * @conn: (private) cfg80211 software SME connection state machine data
4991780b40dfSJohannes Berg  * @connect_keys: (private) keys to set after connection is established
499234d50519SLior David  * @conn_bss_type: connecting/connected BSS type
4993bd2522b1SAndrzej Zaborowski  * @conn_owner_nlportid: (private) connection owner socket port ID
4994bd2522b1SAndrzej Zaborowski  * @disconnect_wk: (private) auto-disconnect work
4995bd2522b1SAndrzej Zaborowski  * @disconnect_bssid: (private) the BSSID to use for auto-disconnect
4996780b40dfSJohannes Berg  * @ibss_fixed: (private) IBSS is using fixed BSSID
49975336fa88SSimon Wunderlich  * @ibss_dfs_possible: (private) IBSS may change to a DFS channel
4998780b40dfSJohannes Berg  * @event_list: (private) list for internal event processing
4999780b40dfSJohannes Berg  * @event_lock: (private) lock for event list
500078f22b6aSJohannes Berg  * @owner_nlportid: (private) owner socket port ID
5001ab81007aSJohannes Berg  * @nl_owner_dead: (private) owner socket went away
50024a4b8169SAndrew Zaborowski  * @cqm_config: (private) nl80211 RSSI monitor state
50039bb7e0f2SJohannes Berg  * @pmsr_list: (private) peer measurement requests
50049bb7e0f2SJohannes Berg  * @pmsr_lock: (private) peer measurements requests/results lock
50059bb7e0f2SJohannes Berg  * @pmsr_free_wk: (private) peer measurements cleanup work
5006d3236553SJohannes Berg  */
5007d3236553SJohannes Berg struct wireless_dev {
5008d3236553SJohannes Berg 	struct wiphy *wiphy;
5009d3236553SJohannes Berg 	enum nl80211_iftype iftype;
5010d3236553SJohannes Berg 
5011667503ddSJohannes Berg 	/* the remainder of this struct should be private to cfg80211 */
5012d3236553SJohannes Berg 	struct list_head list;
5013d3236553SJohannes Berg 	struct net_device *netdev;
5014d3236553SJohannes Berg 
501589a54e48SJohannes Berg 	u32 identifier;
501689a54e48SJohannes Berg 
50172e161f78SJohannes Berg 	struct list_head mgmt_registrations;
50182e161f78SJohannes Berg 	spinlock_t mgmt_registrations_lock;
5019026331c4SJouni Malinen 
5020667503ddSJohannes Berg 	struct mutex mtx;
5021667503ddSJohannes Berg 
502273c7da3dSArend Van Spriel 	bool use_4addr, is_running;
502398104fdeSJohannes Berg 
502498104fdeSJohannes Berg 	u8 address[ETH_ALEN] __aligned(sizeof(u16));
50259bc383deSJohannes Berg 
5026b23aa676SSamuel Ortiz 	/* currently used for IBSS and SME - might be rearranged later */
5027d3236553SJohannes Berg 	u8 ssid[IEEE80211_MAX_SSID_LEN];
502829cbe68cSJohannes Berg 	u8 ssid_len, mesh_id_len, mesh_id_up_len;
50296829c878SJohannes Berg 	struct cfg80211_conn *conn;
5030fffd0934SJohannes Berg 	struct cfg80211_cached_keys *connect_keys;
503134d50519SLior David 	enum ieee80211_bss_type conn_bss_type;
5032bd2522b1SAndrzej Zaborowski 	u32 conn_owner_nlportid;
5033bd2522b1SAndrzej Zaborowski 
5034bd2522b1SAndrzej Zaborowski 	struct work_struct disconnect_wk;
5035bd2522b1SAndrzej Zaborowski 	u8 disconnect_bssid[ETH_ALEN];
5036d3236553SJohannes Berg 
5037667503ddSJohannes Berg 	struct list_head event_list;
5038667503ddSJohannes Berg 	spinlock_t event_lock;
5039667503ddSJohannes Berg 
504019957bb3SJohannes Berg 	struct cfg80211_internal_bss *current_bss; /* associated / joined */
5041683b6d3bSJohannes Berg 	struct cfg80211_chan_def preset_chandef;
50429e0e2961SMichal Kazior 	struct cfg80211_chan_def chandef;
5043f4489ebeSMichal Kazior 
5044c30a3d38SMichal Kazior 	bool ibss_fixed;
50455336fa88SSimon Wunderlich 	bool ibss_dfs_possible;
5046c30a3d38SMichal Kazior 
5047ffb9eb3dSKalle Valo 	bool ps;
5048ffb9eb3dSKalle Valo 	int ps_timeout;
5049ffb9eb3dSKalle Valo 
505056d1893dSJohannes Berg 	int beacon_interval;
505156d1893dSJohannes Berg 
505215e47304SEric W. Biederman 	u32 ap_unexpected_nlportid;
505328946da7SJohannes Berg 
5054ab81007aSJohannes Berg 	u32 owner_nlportid;
5055ab81007aSJohannes Berg 	bool nl_owner_dead;
5056ab81007aSJohannes Berg 
505704f39047SSimon Wunderlich 	bool cac_started;
505804f39047SSimon Wunderlich 	unsigned long cac_start_time;
505931559f35SJanusz Dziedzic 	unsigned int cac_time_ms;
506004f39047SSimon Wunderlich 
50613d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT
5062d3236553SJohannes Berg 	/* wext data */
5063cbe8fa9cSJohannes Berg 	struct {
5064cbe8fa9cSJohannes Berg 		struct cfg80211_ibss_params ibss;
5065f2129354SJohannes Berg 		struct cfg80211_connect_params connect;
5066fffd0934SJohannes Berg 		struct cfg80211_cached_keys *keys;
5067c1e5f471SJohannes Berg 		const u8 *ie;
5068f2129354SJohannes Berg 		size_t ie_len;
50699874b71fSJohannes Berg 		u8 bssid[ETH_ALEN];
50709874b71fSJohannes Berg 		u8 prev_bssid[ETH_ALEN];
5071f2129354SJohannes Berg 		u8 ssid[IEEE80211_MAX_SSID_LEN];
507208645126SJohannes Berg 		s8 default_key, default_mgmt_key;
5073ffb9eb3dSKalle Valo 		bool prev_bssid_valid;
5074cbe8fa9cSJohannes Berg 	} wext;
5075d3236553SJohannes Berg #endif
50764a4b8169SAndrew Zaborowski 
50774a4b8169SAndrew Zaborowski 	struct cfg80211_cqm_config *cqm_config;
50789bb7e0f2SJohannes Berg 
50799bb7e0f2SJohannes Berg 	struct list_head pmsr_list;
50809bb7e0f2SJohannes Berg 	spinlock_t pmsr_lock;
50819bb7e0f2SJohannes Berg 	struct work_struct pmsr_free_wk;
5082d3236553SJohannes Berg };
5083d3236553SJohannes Berg 
508498104fdeSJohannes Berg static inline u8 *wdev_address(struct wireless_dev *wdev)
508598104fdeSJohannes Berg {
508698104fdeSJohannes Berg 	if (wdev->netdev)
508798104fdeSJohannes Berg 		return wdev->netdev->dev_addr;
508898104fdeSJohannes Berg 	return wdev->address;
508998104fdeSJohannes Berg }
509098104fdeSJohannes Berg 
509173c7da3dSArend Van Spriel static inline bool wdev_running(struct wireless_dev *wdev)
509273c7da3dSArend Van Spriel {
509373c7da3dSArend Van Spriel 	if (wdev->netdev)
509473c7da3dSArend Van Spriel 		return netif_running(wdev->netdev);
509573c7da3dSArend Van Spriel 	return wdev->is_running;
509673c7da3dSArend Van Spriel }
509773c7da3dSArend Van Spriel 
5098d3236553SJohannes Berg /**
5099d3236553SJohannes Berg  * wdev_priv - return wiphy priv from wireless_dev
5100d3236553SJohannes Berg  *
5101d3236553SJohannes Berg  * @wdev: The wireless device whose wiphy's priv pointer to return
51020ae997dcSYacine Belkadi  * Return: The wiphy priv of @wdev.
5103d3236553SJohannes Berg  */
5104d3236553SJohannes Berg static inline void *wdev_priv(struct wireless_dev *wdev)
5105d3236553SJohannes Berg {
5106d3236553SJohannes Berg 	BUG_ON(!wdev);
5107d3236553SJohannes Berg 	return wiphy_priv(wdev->wiphy);
5108d3236553SJohannes Berg }
5109d3236553SJohannes Berg 
5110d70e9693SJohannes Berg /**
5111d70e9693SJohannes Berg  * DOC: Utility functions
5112d70e9693SJohannes Berg  *
5113d70e9693SJohannes Berg  * cfg80211 offers a number of utility functions that can be useful.
5114d3236553SJohannes Berg  */
5115d3236553SJohannes Berg 
5116d3236553SJohannes Berg /**
5117d3236553SJohannes Berg  * ieee80211_channel_to_frequency - convert channel number to frequency
5118abe37c4bSJohannes Berg  * @chan: channel number
511959eb21a6SBruno Randolf  * @band: band, necessary due to channel number overlap
51200ae997dcSYacine Belkadi  * Return: The corresponding frequency (in MHz), or 0 if the conversion failed.
5121d3236553SJohannes Berg  */
512257fbcce3SJohannes Berg int ieee80211_channel_to_frequency(int chan, enum nl80211_band band);
5123d3236553SJohannes Berg 
5124d3236553SJohannes Berg /**
5125d3236553SJohannes Berg  * ieee80211_frequency_to_channel - convert frequency to channel number
5126abe37c4bSJohannes Berg  * @freq: center frequency
51270ae997dcSYacine Belkadi  * Return: The corresponding channel, or 0 if the conversion failed.
5128d3236553SJohannes Berg  */
512910dd9b7cSJoe Perches int ieee80211_frequency_to_channel(int freq);
5130d3236553SJohannes Berg 
5131d3236553SJohannes Berg /**
5132d3236553SJohannes Berg  * ieee80211_get_channel - get channel struct from wiphy for specified frequency
5133543b921bSArend Van Spriel  *
5134abe37c4bSJohannes Berg  * @wiphy: the struct wiphy to get the channel for
5135abe37c4bSJohannes Berg  * @freq: the center frequency of the channel
5136543b921bSArend Van Spriel  *
51370ae997dcSYacine Belkadi  * Return: The channel struct from @wiphy at @freq.
5138d3236553SJohannes Berg  */
5139543b921bSArend Van Spriel struct ieee80211_channel *ieee80211_get_channel(struct wiphy *wiphy, int freq);
5140d3236553SJohannes Berg 
5141d3236553SJohannes Berg /**
5142d3236553SJohannes Berg  * ieee80211_get_response_rate - get basic rate for a given rate
5143d3236553SJohannes Berg  *
5144d3236553SJohannes Berg  * @sband: the band to look for rates in
5145d3236553SJohannes Berg  * @basic_rates: bitmap of basic rates
5146d3236553SJohannes Berg  * @bitrate: the bitrate for which to find the basic rate
5147d3236553SJohannes Berg  *
51480ae997dcSYacine Belkadi  * Return: The basic rate corresponding to a given bitrate, that
51490ae997dcSYacine Belkadi  * is the next lower bitrate contained in the basic rate map,
51500ae997dcSYacine Belkadi  * which is, for this function, given as a bitmap of indices of
51510ae997dcSYacine Belkadi  * rates in the band's bitrate table.
5152d3236553SJohannes Berg  */
5153d3236553SJohannes Berg struct ieee80211_rate *
5154d3236553SJohannes Berg ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
5155d3236553SJohannes Berg 			    u32 basic_rates, int bitrate);
5156d3236553SJohannes Berg 
5157b422c6cdSAshok Nagarajan /**
5158b422c6cdSAshok Nagarajan  * ieee80211_mandatory_rates - get mandatory rates for a given band
5159b422c6cdSAshok Nagarajan  * @sband: the band to look for rates in
516074608acaSSimon Wunderlich  * @scan_width: width of the control channel
5161b422c6cdSAshok Nagarajan  *
5162b422c6cdSAshok Nagarajan  * This function returns a bitmap of the mandatory rates for the given
5163b422c6cdSAshok Nagarajan  * band, bits are set according to the rate position in the bitrates array.
5164b422c6cdSAshok Nagarajan  */
516574608acaSSimon Wunderlich u32 ieee80211_mandatory_rates(struct ieee80211_supported_band *sband,
516674608acaSSimon Wunderlich 			      enum nl80211_bss_scan_width scan_width);
5167b422c6cdSAshok Nagarajan 
5168d3236553SJohannes Berg /*
5169d3236553SJohannes Berg  * Radiotap parsing functions -- for controlled injection support
5170d3236553SJohannes Berg  *
5171d3236553SJohannes Berg  * Implemented in net/wireless/radiotap.c
5172d3236553SJohannes Berg  * Documentation in Documentation/networking/radiotap-headers.txt
5173d3236553SJohannes Berg  */
5174d3236553SJohannes Berg 
517533e5a2f7SJohannes Berg struct radiotap_align_size {
517633e5a2f7SJohannes Berg 	uint8_t align:4, size:4;
517733e5a2f7SJohannes Berg };
517833e5a2f7SJohannes Berg 
517933e5a2f7SJohannes Berg struct ieee80211_radiotap_namespace {
518033e5a2f7SJohannes Berg 	const struct radiotap_align_size *align_size;
518133e5a2f7SJohannes Berg 	int n_bits;
518233e5a2f7SJohannes Berg 	uint32_t oui;
518333e5a2f7SJohannes Berg 	uint8_t subns;
518433e5a2f7SJohannes Berg };
518533e5a2f7SJohannes Berg 
518633e5a2f7SJohannes Berg struct ieee80211_radiotap_vendor_namespaces {
518733e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_namespace *ns;
518833e5a2f7SJohannes Berg 	int n_ns;
518933e5a2f7SJohannes Berg };
519033e5a2f7SJohannes Berg 
5191d3236553SJohannes Berg /**
5192d3236553SJohannes Berg  * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args
519333e5a2f7SJohannes Berg  * @this_arg_index: index of current arg, valid after each successful call
519433e5a2f7SJohannes Berg  *	to ieee80211_radiotap_iterator_next()
519533e5a2f7SJohannes Berg  * @this_arg: pointer to current radiotap arg; it is valid after each
519633e5a2f7SJohannes Berg  *	call to ieee80211_radiotap_iterator_next() but also after
519733e5a2f7SJohannes Berg  *	ieee80211_radiotap_iterator_init() where it will point to
519833e5a2f7SJohannes Berg  *	the beginning of the actual data portion
519933e5a2f7SJohannes Berg  * @this_arg_size: length of the current arg, for convenience
520033e5a2f7SJohannes Berg  * @current_namespace: pointer to the current namespace definition
520133e5a2f7SJohannes Berg  *	(or internally %NULL if the current namespace is unknown)
520233e5a2f7SJohannes Berg  * @is_radiotap_ns: indicates whether the current namespace is the default
520333e5a2f7SJohannes Berg  *	radiotap namespace or not
520433e5a2f7SJohannes Berg  *
520533e5a2f7SJohannes Berg  * @_rtheader: pointer to the radiotap header we are walking through
520633e5a2f7SJohannes Berg  * @_max_length: length of radiotap header in cpu byte ordering
520733e5a2f7SJohannes Berg  * @_arg_index: next argument index
520833e5a2f7SJohannes Berg  * @_arg: next argument pointer
520933e5a2f7SJohannes Berg  * @_next_bitmap: internal pointer to next present u32
521033e5a2f7SJohannes Berg  * @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present
521133e5a2f7SJohannes Berg  * @_vns: vendor namespace definitions
521233e5a2f7SJohannes Berg  * @_next_ns_data: beginning of the next namespace's data
521333e5a2f7SJohannes Berg  * @_reset_on_ext: internal; reset the arg index to 0 when going to the
521433e5a2f7SJohannes Berg  *	next bitmap word
521533e5a2f7SJohannes Berg  *
521633e5a2f7SJohannes Berg  * Describes the radiotap parser state. Fields prefixed with an underscore
521733e5a2f7SJohannes Berg  * must not be used by users of the parser, only by the parser internally.
5218d3236553SJohannes Berg  */
5219d3236553SJohannes Berg 
5220d3236553SJohannes Berg struct ieee80211_radiotap_iterator {
522133e5a2f7SJohannes Berg 	struct ieee80211_radiotap_header *_rtheader;
522233e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_vendor_namespaces *_vns;
522333e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_namespace *current_namespace;
5224d3236553SJohannes Berg 
522533e5a2f7SJohannes Berg 	unsigned char *_arg, *_next_ns_data;
522667272440SJohannes Berg 	__le32 *_next_bitmap;
522733e5a2f7SJohannes Berg 
522833e5a2f7SJohannes Berg 	unsigned char *this_arg;
522933e5a2f7SJohannes Berg 	int this_arg_index;
523033e5a2f7SJohannes Berg 	int this_arg_size;
523133e5a2f7SJohannes Berg 
523233e5a2f7SJohannes Berg 	int is_radiotap_ns;
523333e5a2f7SJohannes Berg 
523433e5a2f7SJohannes Berg 	int _max_length;
523533e5a2f7SJohannes Berg 	int _arg_index;
523633e5a2f7SJohannes Berg 	uint32_t _bitmap_shifter;
523733e5a2f7SJohannes Berg 	int _reset_on_ext;
5238d3236553SJohannes Berg };
5239d3236553SJohannes Berg 
524010dd9b7cSJoe Perches int
524110dd9b7cSJoe Perches ieee80211_radiotap_iterator_init(struct ieee80211_radiotap_iterator *iterator,
5242d3236553SJohannes Berg 				 struct ieee80211_radiotap_header *radiotap_header,
524310dd9b7cSJoe Perches 				 int max_length,
524410dd9b7cSJoe Perches 				 const struct ieee80211_radiotap_vendor_namespaces *vns);
5245d3236553SJohannes Berg 
524610dd9b7cSJoe Perches int
524710dd9b7cSJoe Perches ieee80211_radiotap_iterator_next(struct ieee80211_radiotap_iterator *iterator);
5248d3236553SJohannes Berg 
524933e5a2f7SJohannes Berg 
5250e31a16d6SZhu Yi extern const unsigned char rfc1042_header[6];
5251e31a16d6SZhu Yi extern const unsigned char bridge_tunnel_header[6];
5252e31a16d6SZhu Yi 
5253e31a16d6SZhu Yi /**
5254e31a16d6SZhu Yi  * ieee80211_get_hdrlen_from_skb - get header length from data
5255e31a16d6SZhu Yi  *
5256e31a16d6SZhu Yi  * @skb: the frame
52570ae997dcSYacine Belkadi  *
52580ae997dcSYacine Belkadi  * Given an skb with a raw 802.11 header at the data pointer this function
52590ae997dcSYacine Belkadi  * returns the 802.11 header length.
52600ae997dcSYacine Belkadi  *
52610ae997dcSYacine Belkadi  * Return: The 802.11 header length in bytes (not including encryption
52620ae997dcSYacine Belkadi  * headers). Or 0 if the data in the sk_buff is too short to contain a valid
52630ae997dcSYacine Belkadi  * 802.11 header.
5264e31a16d6SZhu Yi  */
5265e31a16d6SZhu Yi unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb);
5266e31a16d6SZhu Yi 
5267e31a16d6SZhu Yi /**
5268e31a16d6SZhu Yi  * ieee80211_hdrlen - get header length in bytes from frame control
5269e31a16d6SZhu Yi  * @fc: frame control field in little-endian format
52700ae997dcSYacine Belkadi  * Return: The header length in bytes.
5271e31a16d6SZhu Yi  */
5272633adf1aSJohannes Berg unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc);
5273e31a16d6SZhu Yi 
5274e31a16d6SZhu Yi /**
52759b395bc3SJohannes Berg  * ieee80211_get_mesh_hdrlen - get mesh extension header length
52769b395bc3SJohannes Berg  * @meshhdr: the mesh extension header, only the flags field
52779b395bc3SJohannes Berg  *	(first byte) will be accessed
52780ae997dcSYacine Belkadi  * Return: The length of the extension header, which is always at
52799b395bc3SJohannes Berg  * least 6 bytes and at most 18 if address 5 and 6 are present.
52809b395bc3SJohannes Berg  */
52819b395bc3SJohannes Berg unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr);
52829b395bc3SJohannes Berg 
52839b395bc3SJohannes Berg /**
5284d70e9693SJohannes Berg  * DOC: Data path helpers
5285d70e9693SJohannes Berg  *
5286d70e9693SJohannes Berg  * In addition to generic utilities, cfg80211 also offers
5287d70e9693SJohannes Berg  * functions that help implement the data path for devices
5288d70e9693SJohannes Berg  * that do not do the 802.11/802.3 conversion on the device.
5289d70e9693SJohannes Berg  */
5290d70e9693SJohannes Berg 
5291d70e9693SJohannes Berg /**
52927f6990c8SJohannes Berg  * ieee80211_data_to_8023_exthdr - convert an 802.11 data frame to 802.3
52937f6990c8SJohannes Berg  * @skb: the 802.11 data frame
52947f6990c8SJohannes Berg  * @ehdr: pointer to a &struct ethhdr that will get the header, instead
52957f6990c8SJohannes Berg  *	of it being pushed into the SKB
52967f6990c8SJohannes Berg  * @addr: the device MAC address
52977f6990c8SJohannes Berg  * @iftype: the virtual interface type
529824bba078SFelix Fietkau  * @data_offset: offset of payload after the 802.11 header
52997f6990c8SJohannes Berg  * Return: 0 on success. Non-zero on error.
53007f6990c8SJohannes Berg  */
53017f6990c8SJohannes Berg int ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr,
530224bba078SFelix Fietkau 				  const u8 *addr, enum nl80211_iftype iftype,
530324bba078SFelix Fietkau 				  u8 data_offset);
53047f6990c8SJohannes Berg 
53057f6990c8SJohannes Berg /**
5306e31a16d6SZhu Yi  * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3
5307e31a16d6SZhu Yi  * @skb: the 802.11 data frame
5308e31a16d6SZhu Yi  * @addr: the device MAC address
5309e31a16d6SZhu Yi  * @iftype: the virtual interface type
53100ae997dcSYacine Belkadi  * Return: 0 on success. Non-zero on error.
5311e31a16d6SZhu Yi  */
53127f6990c8SJohannes Berg static inline int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
53137f6990c8SJohannes Berg 					 enum nl80211_iftype iftype)
53147f6990c8SJohannes Berg {
531524bba078SFelix Fietkau 	return ieee80211_data_to_8023_exthdr(skb, NULL, addr, iftype, 0);
53167f6990c8SJohannes Berg }
5317e31a16d6SZhu Yi 
5318e31a16d6SZhu Yi /**
5319eaf85ca7SZhu Yi  * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame
5320eaf85ca7SZhu Yi  *
53217f6990c8SJohannes Berg  * Decode an IEEE 802.11 A-MSDU and convert it to a list of 802.3 frames.
53227f6990c8SJohannes Berg  * The @list will be empty if the decode fails. The @skb must be fully
53237f6990c8SJohannes Berg  * header-less before being passed in here; it is freed in this function.
5324eaf85ca7SZhu Yi  *
53257f6990c8SJohannes Berg  * @skb: The input A-MSDU frame without any headers.
5326eaf85ca7SZhu Yi  * @list: The output list of 802.3 frames. It must be allocated and
5327eaf85ca7SZhu Yi  *	initialized by by the caller.
5328eaf85ca7SZhu Yi  * @addr: The device MAC address.
5329eaf85ca7SZhu Yi  * @iftype: The device interface type.
5330eaf85ca7SZhu Yi  * @extra_headroom: The hardware extra headroom for SKBs in the @list.
53318b935ee2SJohannes Berg  * @check_da: DA to check in the inner ethernet header, or NULL
53328b935ee2SJohannes Berg  * @check_sa: SA to check in the inner ethernet header, or NULL
5333eaf85ca7SZhu Yi  */
5334eaf85ca7SZhu Yi void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,
5335eaf85ca7SZhu Yi 			      const u8 *addr, enum nl80211_iftype iftype,
53368b3becadSYogesh Ashok Powar 			      const unsigned int extra_headroom,
53378b935ee2SJohannes Berg 			      const u8 *check_da, const u8 *check_sa);
5338eaf85ca7SZhu Yi 
5339eaf85ca7SZhu Yi /**
5340e31a16d6SZhu Yi  * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame
5341e31a16d6SZhu Yi  * @skb: the data frame
5342fa9ffc74SKyeyoon Park  * @qos_map: Interworking QoS mapping or %NULL if not in use
53430ae997dcSYacine Belkadi  * Return: The 802.1p/1d tag.
5344e31a16d6SZhu Yi  */
5345fa9ffc74SKyeyoon Park unsigned int cfg80211_classify8021d(struct sk_buff *skb,
5346fa9ffc74SKyeyoon Park 				    struct cfg80211_qos_map *qos_map);
5347e31a16d6SZhu Yi 
5348c21dbf92SJohannes Berg /**
534949a68e0dSJohannes Berg  * cfg80211_find_elem_match - match information element and byte array in data
535049a68e0dSJohannes Berg  *
535149a68e0dSJohannes Berg  * @eid: element ID
535249a68e0dSJohannes Berg  * @ies: data consisting of IEs
535349a68e0dSJohannes Berg  * @len: length of data
535449a68e0dSJohannes Berg  * @match: byte array to match
535549a68e0dSJohannes Berg  * @match_len: number of bytes in the match array
535649a68e0dSJohannes Berg  * @match_offset: offset in the IE data where the byte array should match.
535749a68e0dSJohannes Berg  *	Note the difference to cfg80211_find_ie_match() which considers
535849a68e0dSJohannes Berg  *	the offset to start from the element ID byte, but here we take
535949a68e0dSJohannes Berg  *	the data portion instead.
536049a68e0dSJohannes Berg  *
536149a68e0dSJohannes Berg  * Return: %NULL if the element ID could not be found or if
536249a68e0dSJohannes Berg  * the element is invalid (claims to be longer than the given
536349a68e0dSJohannes Berg  * data) or if the byte array doesn't match; otherwise return the
536449a68e0dSJohannes Berg  * requested element struct.
536549a68e0dSJohannes Berg  *
536649a68e0dSJohannes Berg  * Note: There are no checks on the element length other than
536749a68e0dSJohannes Berg  * having to fit into the given data and being large enough for the
536849a68e0dSJohannes Berg  * byte array to match.
536949a68e0dSJohannes Berg  */
537049a68e0dSJohannes Berg const struct element *
537149a68e0dSJohannes Berg cfg80211_find_elem_match(u8 eid, const u8 *ies, unsigned int len,
537249a68e0dSJohannes Berg 			 const u8 *match, unsigned int match_len,
537349a68e0dSJohannes Berg 			 unsigned int match_offset);
537449a68e0dSJohannes Berg 
537549a68e0dSJohannes Berg /**
5376fbd05e4aSLuca Coelho  * cfg80211_find_ie_match - match information element and byte array in data
5377fbd05e4aSLuca Coelho  *
5378fbd05e4aSLuca Coelho  * @eid: element ID
5379fbd05e4aSLuca Coelho  * @ies: data consisting of IEs
5380fbd05e4aSLuca Coelho  * @len: length of data
5381fbd05e4aSLuca Coelho  * @match: byte array to match
5382fbd05e4aSLuca Coelho  * @match_len: number of bytes in the match array
5383fbd05e4aSLuca Coelho  * @match_offset: offset in the IE where the byte array should match.
5384fbd05e4aSLuca Coelho  *	If match_len is zero, this must also be set to zero.
5385fbd05e4aSLuca Coelho  *	Otherwise this must be set to 2 or more, because the first
5386fbd05e4aSLuca Coelho  *	byte is the element id, which is already compared to eid, and
5387fbd05e4aSLuca Coelho  *	the second byte is the IE length.
5388fbd05e4aSLuca Coelho  *
5389fbd05e4aSLuca Coelho  * Return: %NULL if the element ID could not be found or if
5390fbd05e4aSLuca Coelho  * the element is invalid (claims to be longer than the given
5391fbd05e4aSLuca Coelho  * data) or if the byte array doesn't match, or a pointer to the first
5392fbd05e4aSLuca Coelho  * byte of the requested element, that is the byte containing the
5393fbd05e4aSLuca Coelho  * element ID.
5394fbd05e4aSLuca Coelho  *
5395fbd05e4aSLuca Coelho  * Note: There are no checks on the element length other than
5396fbd05e4aSLuca Coelho  * having to fit into the given data and being large enough for the
5397fbd05e4aSLuca Coelho  * byte array to match.
5398fbd05e4aSLuca Coelho  */
539949a68e0dSJohannes Berg static inline const u8 *
540049a68e0dSJohannes Berg cfg80211_find_ie_match(u8 eid, const u8 *ies, unsigned int len,
540149a68e0dSJohannes Berg 		       const u8 *match, unsigned int match_len,
540249a68e0dSJohannes Berg 		       unsigned int match_offset)
540349a68e0dSJohannes Berg {
540449a68e0dSJohannes Berg 	/* match_offset can't be smaller than 2, unless match_len is
540549a68e0dSJohannes Berg 	 * zero, in which case match_offset must be zero as well.
540649a68e0dSJohannes Berg 	 */
540749a68e0dSJohannes Berg 	if (WARN_ON((match_len && match_offset < 2) ||
540849a68e0dSJohannes Berg 		    (!match_len && match_offset)))
540949a68e0dSJohannes Berg 		return NULL;
541049a68e0dSJohannes Berg 
541149a68e0dSJohannes Berg 	return (void *)cfg80211_find_elem_match(eid, ies, len,
541249a68e0dSJohannes Berg 						match, match_len,
541349a68e0dSJohannes Berg 						match_offset ?
541449a68e0dSJohannes Berg 							match_offset - 2 : 0);
541549a68e0dSJohannes Berg }
541649a68e0dSJohannes Berg 
541749a68e0dSJohannes Berg /**
541849a68e0dSJohannes Berg  * cfg80211_find_elem - find information element in data
541949a68e0dSJohannes Berg  *
542049a68e0dSJohannes Berg  * @eid: element ID
542149a68e0dSJohannes Berg  * @ies: data consisting of IEs
542249a68e0dSJohannes Berg  * @len: length of data
542349a68e0dSJohannes Berg  *
542449a68e0dSJohannes Berg  * Return: %NULL if the element ID could not be found or if
542549a68e0dSJohannes Berg  * the element is invalid (claims to be longer than the given
542649a68e0dSJohannes Berg  * data) or if the byte array doesn't match; otherwise return the
542749a68e0dSJohannes Berg  * requested element struct.
542849a68e0dSJohannes Berg  *
542949a68e0dSJohannes Berg  * Note: There are no checks on the element length other than
543049a68e0dSJohannes Berg  * having to fit into the given data.
543149a68e0dSJohannes Berg  */
543249a68e0dSJohannes Berg static inline const struct element *
543349a68e0dSJohannes Berg cfg80211_find_elem(u8 eid, const u8 *ies, int len)
543449a68e0dSJohannes Berg {
543549a68e0dSJohannes Berg 	return cfg80211_find_elem_match(eid, ies, len, NULL, 0, 0);
543649a68e0dSJohannes Berg }
5437fbd05e4aSLuca Coelho 
5438fbd05e4aSLuca Coelho /**
5439c21dbf92SJohannes Berg  * cfg80211_find_ie - find information element in data
5440c21dbf92SJohannes Berg  *
5441c21dbf92SJohannes Berg  * @eid: element ID
5442c21dbf92SJohannes Berg  * @ies: data consisting of IEs
5443c21dbf92SJohannes Berg  * @len: length of data
5444c21dbf92SJohannes Berg  *
54450ae997dcSYacine Belkadi  * Return: %NULL if the element ID could not be found or if
54460ae997dcSYacine Belkadi  * the element is invalid (claims to be longer than the given
54470ae997dcSYacine Belkadi  * data), or a pointer to the first byte of the requested
54480ae997dcSYacine Belkadi  * element, that is the byte containing the element ID.
54490ae997dcSYacine Belkadi  *
54500ae997dcSYacine Belkadi  * Note: There are no checks on the element length other than
54510ae997dcSYacine Belkadi  * having to fit into the given data.
5452c21dbf92SJohannes Berg  */
5453fbd05e4aSLuca Coelho static inline const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len)
5454fbd05e4aSLuca Coelho {
5455fbd05e4aSLuca Coelho 	return cfg80211_find_ie_match(eid, ies, len, NULL, 0, 0);
5456fbd05e4aSLuca Coelho }
5457c21dbf92SJohannes Berg 
5458d70e9693SJohannes Berg /**
545949a68e0dSJohannes Berg  * cfg80211_find_ext_elem - find information element with EID Extension in data
546049a68e0dSJohannes Berg  *
546149a68e0dSJohannes Berg  * @ext_eid: element ID Extension
546249a68e0dSJohannes Berg  * @ies: data consisting of IEs
546349a68e0dSJohannes Berg  * @len: length of data
546449a68e0dSJohannes Berg  *
546549a68e0dSJohannes Berg  * Return: %NULL if the etended element could not be found or if
546649a68e0dSJohannes Berg  * the element is invalid (claims to be longer than the given
546749a68e0dSJohannes Berg  * data) or if the byte array doesn't match; otherwise return the
546849a68e0dSJohannes Berg  * requested element struct.
546949a68e0dSJohannes Berg  *
547049a68e0dSJohannes Berg  * Note: There are no checks on the element length other than
547149a68e0dSJohannes Berg  * having to fit into the given data.
547249a68e0dSJohannes Berg  */
547349a68e0dSJohannes Berg static inline const struct element *
547449a68e0dSJohannes Berg cfg80211_find_ext_elem(u8 ext_eid, const u8 *ies, int len)
547549a68e0dSJohannes Berg {
547649a68e0dSJohannes Berg 	return cfg80211_find_elem_match(WLAN_EID_EXTENSION, ies, len,
547749a68e0dSJohannes Berg 					&ext_eid, 1, 0);
547849a68e0dSJohannes Berg }
547949a68e0dSJohannes Berg 
548049a68e0dSJohannes Berg /**
54813f817fe7SJouni Malinen  * cfg80211_find_ext_ie - find information element with EID Extension in data
54823f817fe7SJouni Malinen  *
54833f817fe7SJouni Malinen  * @ext_eid: element ID Extension
54843f817fe7SJouni Malinen  * @ies: data consisting of IEs
54853f817fe7SJouni Malinen  * @len: length of data
54863f817fe7SJouni Malinen  *
54873f817fe7SJouni Malinen  * Return: %NULL if the extended element ID could not be found or if
54883f817fe7SJouni Malinen  * the element is invalid (claims to be longer than the given
54893f817fe7SJouni Malinen  * data), or a pointer to the first byte of the requested
54903f817fe7SJouni Malinen  * element, that is the byte containing the element ID.
54913f817fe7SJouni Malinen  *
54923f817fe7SJouni Malinen  * Note: There are no checks on the element length other than
54933f817fe7SJouni Malinen  * having to fit into the given data.
54943f817fe7SJouni Malinen  */
54953f817fe7SJouni Malinen static inline const u8 *cfg80211_find_ext_ie(u8 ext_eid, const u8 *ies, int len)
54963f817fe7SJouni Malinen {
54973f817fe7SJouni Malinen 	return cfg80211_find_ie_match(WLAN_EID_EXTENSION, ies, len,
54983f817fe7SJouni Malinen 				      &ext_eid, 1, 2);
54993f817fe7SJouni Malinen }
55003f817fe7SJouni Malinen 
55013f817fe7SJouni Malinen /**
550249a68e0dSJohannes Berg  * cfg80211_find_vendor_elem - find vendor specific information element in data
550349a68e0dSJohannes Berg  *
550449a68e0dSJohannes Berg  * @oui: vendor OUI
550549a68e0dSJohannes Berg  * @oui_type: vendor-specific OUI type (must be < 0xff), negative means any
550649a68e0dSJohannes Berg  * @ies: data consisting of IEs
550749a68e0dSJohannes Berg  * @len: length of data
550849a68e0dSJohannes Berg  *
550949a68e0dSJohannes Berg  * Return: %NULL if the vendor specific element ID could not be found or if the
551049a68e0dSJohannes Berg  * element is invalid (claims to be longer than the given data); otherwise
551149a68e0dSJohannes Berg  * return the element structure for the requested element.
551249a68e0dSJohannes Berg  *
551349a68e0dSJohannes Berg  * Note: There are no checks on the element length other than having to fit into
551449a68e0dSJohannes Berg  * the given data.
551549a68e0dSJohannes Berg  */
551649a68e0dSJohannes Berg const struct element *cfg80211_find_vendor_elem(unsigned int oui, int oui_type,
551749a68e0dSJohannes Berg 						const u8 *ies,
551849a68e0dSJohannes Berg 						unsigned int len);
551949a68e0dSJohannes Berg 
552049a68e0dSJohannes Berg /**
55210c28ec58SEliad Peller  * cfg80211_find_vendor_ie - find vendor specific information element in data
55220c28ec58SEliad Peller  *
55230c28ec58SEliad Peller  * @oui: vendor OUI
55249e9ea439SEmmanuel Grumbach  * @oui_type: vendor-specific OUI type (must be < 0xff), negative means any
55250c28ec58SEliad Peller  * @ies: data consisting of IEs
55260c28ec58SEliad Peller  * @len: length of data
55270c28ec58SEliad Peller  *
55280ae997dcSYacine Belkadi  * Return: %NULL if the vendor specific element ID could not be found or if the
55290ae997dcSYacine Belkadi  * element is invalid (claims to be longer than the given data), or a pointer to
55300ae997dcSYacine Belkadi  * the first byte of the requested element, that is the byte containing the
55310ae997dcSYacine Belkadi  * element ID.
55320ae997dcSYacine Belkadi  *
55330ae997dcSYacine Belkadi  * Note: There are no checks on the element length other than having to fit into
55340ae997dcSYacine Belkadi  * the given data.
55350c28ec58SEliad Peller  */
553649a68e0dSJohannes Berg static inline const u8 *
553749a68e0dSJohannes Berg cfg80211_find_vendor_ie(unsigned int oui, int oui_type,
553849a68e0dSJohannes Berg 			const u8 *ies, unsigned int len)
553949a68e0dSJohannes Berg {
554049a68e0dSJohannes Berg 	return (void *)cfg80211_find_vendor_elem(oui, oui_type, ies, len);
554149a68e0dSJohannes Berg }
55420c28ec58SEliad Peller 
55430c28ec58SEliad Peller /**
554430ca1aa5SDedy Lansky  * cfg80211_send_layer2_update - send layer 2 update frame
554530ca1aa5SDedy Lansky  *
554630ca1aa5SDedy Lansky  * @dev: network device
554730ca1aa5SDedy Lansky  * @addr: STA MAC address
554830ca1aa5SDedy Lansky  *
554930ca1aa5SDedy Lansky  * Wireless drivers can use this function to update forwarding tables in bridge
555030ca1aa5SDedy Lansky  * devices upon STA association.
555130ca1aa5SDedy Lansky  */
555230ca1aa5SDedy Lansky void cfg80211_send_layer2_update(struct net_device *dev, const u8 *addr);
555330ca1aa5SDedy Lansky 
555430ca1aa5SDedy Lansky /**
5555d70e9693SJohannes Berg  * DOC: Regulatory enforcement infrastructure
5556d70e9693SJohannes Berg  *
5557d70e9693SJohannes Berg  * TODO
5558d3236553SJohannes Berg  */
5559d3236553SJohannes Berg 
5560d3236553SJohannes Berg /**
5561d3236553SJohannes Berg  * regulatory_hint - driver hint to the wireless core a regulatory domain
5562d3236553SJohannes Berg  * @wiphy: the wireless device giving the hint (used only for reporting
5563d3236553SJohannes Berg  *	conflicts)
5564d3236553SJohannes Berg  * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain
5565d3236553SJohannes Berg  *	should be in. If @rd is set this should be NULL. Note that if you
5566d3236553SJohannes Berg  *	set this to NULL you should still set rd->alpha2 to some accepted
5567d3236553SJohannes Berg  *	alpha2.
5568d3236553SJohannes Berg  *
5569d3236553SJohannes Berg  * Wireless drivers can use this function to hint to the wireless core
5570d3236553SJohannes Berg  * what it believes should be the current regulatory domain by
5571d3236553SJohannes Berg  * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory
5572d3236553SJohannes Berg  * domain should be in or by providing a completely build regulatory domain.
5573d3236553SJohannes Berg  * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried
5574d3236553SJohannes Berg  * for a regulatory domain structure for the respective country.
5575d3236553SJohannes Berg  *
5576d3236553SJohannes Berg  * The wiphy must have been registered to cfg80211 prior to this call.
5577d3236553SJohannes Berg  * For cfg80211 drivers this means you must first use wiphy_register(),
5578d3236553SJohannes Berg  * for mac80211 drivers you must first use ieee80211_register_hw().
5579d3236553SJohannes Berg  *
5580d3236553SJohannes Berg  * Drivers should check the return value, its possible you can get
5581d3236553SJohannes Berg  * an -ENOMEM.
55820ae997dcSYacine Belkadi  *
55830ae997dcSYacine Belkadi  * Return: 0 on success. -ENOMEM.
5584d3236553SJohannes Berg  */
558510dd9b7cSJoe Perches int regulatory_hint(struct wiphy *wiphy, const char *alpha2);
5586d3236553SJohannes Berg 
5587d3236553SJohannes Berg /**
5588b0d7aa59SJonathan Doron  * regulatory_set_wiphy_regd - set regdom info for self managed drivers
5589b0d7aa59SJonathan Doron  * @wiphy: the wireless device we want to process the regulatory domain on
5590b0d7aa59SJonathan Doron  * @rd: the regulatory domain informatoin to use for this wiphy
5591b0d7aa59SJonathan Doron  *
5592b0d7aa59SJonathan Doron  * Set the regulatory domain information for self-managed wiphys, only they
5593b0d7aa59SJonathan Doron  * may use this function. See %REGULATORY_WIPHY_SELF_MANAGED for more
5594b0d7aa59SJonathan Doron  * information.
5595b0d7aa59SJonathan Doron  *
5596b0d7aa59SJonathan Doron  * Return: 0 on success. -EINVAL, -EPERM
5597b0d7aa59SJonathan Doron  */
5598b0d7aa59SJonathan Doron int regulatory_set_wiphy_regd(struct wiphy *wiphy,
5599b0d7aa59SJonathan Doron 			      struct ieee80211_regdomain *rd);
5600b0d7aa59SJonathan Doron 
5601b0d7aa59SJonathan Doron /**
56022c3e861cSArik Nemtsov  * regulatory_set_wiphy_regd_sync_rtnl - set regdom for self-managed drivers
56032c3e861cSArik Nemtsov  * @wiphy: the wireless device we want to process the regulatory domain on
56042c3e861cSArik Nemtsov  * @rd: the regulatory domain information to use for this wiphy
56052c3e861cSArik Nemtsov  *
56062c3e861cSArik Nemtsov  * This functions requires the RTNL to be held and applies the new regdomain
56072c3e861cSArik Nemtsov  * synchronously to this wiphy. For more details see
56082c3e861cSArik Nemtsov  * regulatory_set_wiphy_regd().
56092c3e861cSArik Nemtsov  *
56102c3e861cSArik Nemtsov  * Return: 0 on success. -EINVAL, -EPERM
56112c3e861cSArik Nemtsov  */
56122c3e861cSArik Nemtsov int regulatory_set_wiphy_regd_sync_rtnl(struct wiphy *wiphy,
56132c3e861cSArik Nemtsov 					struct ieee80211_regdomain *rd);
56142c3e861cSArik Nemtsov 
56152c3e861cSArik Nemtsov /**
5616d3236553SJohannes Berg  * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain
5617d3236553SJohannes Berg  * @wiphy: the wireless device we want to process the regulatory domain on
5618d3236553SJohannes Berg  * @regd: the custom regulatory domain to use for this wiphy
5619d3236553SJohannes Berg  *
5620d3236553SJohannes Berg  * Drivers can sometimes have custom regulatory domains which do not apply
5621d3236553SJohannes Berg  * to a specific country. Drivers can use this to apply such custom regulatory
5622d3236553SJohannes Berg  * domains. This routine must be called prior to wiphy registration. The
5623d3236553SJohannes Berg  * custom regulatory domain will be trusted completely and as such previous
5624d3236553SJohannes Berg  * default channel settings will be disregarded. If no rule is found for a
5625d3236553SJohannes Berg  * channel on the regulatory domain the channel will be disabled.
5626222ea581SLuis R. Rodriguez  * Drivers using this for a wiphy should also set the wiphy flag
5627ce26151bSKalle Valo  * REGULATORY_CUSTOM_REG or cfg80211 will set it for the wiphy
5628222ea581SLuis R. Rodriguez  * that called this helper.
5629d3236553SJohannes Berg  */
563010dd9b7cSJoe Perches void wiphy_apply_custom_regulatory(struct wiphy *wiphy,
5631d3236553SJohannes Berg 				   const struct ieee80211_regdomain *regd);
5632d3236553SJohannes Berg 
5633d3236553SJohannes Berg /**
5634d3236553SJohannes Berg  * freq_reg_info - get regulatory information for the given frequency
5635d3236553SJohannes Berg  * @wiphy: the wiphy for which we want to process this rule for
5636d3236553SJohannes Berg  * @center_freq: Frequency in KHz for which we want regulatory information for
5637d3236553SJohannes Berg  *
5638d3236553SJohannes Berg  * Use this function to get the regulatory rule for a specific frequency on
5639d3236553SJohannes Berg  * a given wireless device. If the device has a specific regulatory domain
5640d3236553SJohannes Berg  * it wants to follow we respect that unless a country IE has been received
5641d3236553SJohannes Berg  * and processed already.
5642d3236553SJohannes Berg  *
56430ae997dcSYacine Belkadi  * Return: A valid pointer, or, when an error occurs, for example if no rule
56440ae997dcSYacine Belkadi  * can be found, the return value is encoded using ERR_PTR(). Use IS_ERR() to
56450ae997dcSYacine Belkadi  * check and PTR_ERR() to obtain the numeric return value. The numeric return
56460ae997dcSYacine Belkadi  * value will be -ERANGE if we determine the given center_freq does not even
56470ae997dcSYacine Belkadi  * have a regulatory rule for a frequency range in the center_freq's band.
56480ae997dcSYacine Belkadi  * See freq_in_rule_band() for our current definition of a band -- this is
56490ae997dcSYacine Belkadi  * purely subjective and right now it's 802.11 specific.
5650d3236553SJohannes Berg  */
5651361c9c8bSJohannes Berg const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy,
5652361c9c8bSJohannes Berg 					       u32 center_freq);
5653d3236553SJohannes Berg 
5654034c6d6eSLuis R. Rodriguez /**
5655034c6d6eSLuis R. Rodriguez  * reg_initiator_name - map regulatory request initiator enum to name
5656034c6d6eSLuis R. Rodriguez  * @initiator: the regulatory request initiator
5657034c6d6eSLuis R. Rodriguez  *
5658034c6d6eSLuis R. Rodriguez  * You can use this to map the regulatory request initiator enum to a
5659034c6d6eSLuis R. Rodriguez  * proper string representation.
5660034c6d6eSLuis R. Rodriguez  */
5661034c6d6eSLuis R. Rodriguez const char *reg_initiator_name(enum nl80211_reg_initiator initiator);
5662034c6d6eSLuis R. Rodriguez 
566319d3577eSHaim Dreyfuss /**
5664dc0c18edSAaron Komisar  * regulatory_pre_cac_allowed - check if pre-CAC allowed in the current regdom
5665dc0c18edSAaron Komisar  * @wiphy: wiphy for which pre-CAC capability is checked.
5666dc0c18edSAaron Komisar  *
5667dc0c18edSAaron Komisar  * Pre-CAC is allowed only in some regdomains (notable ETSI).
5668dc0c18edSAaron Komisar  */
5669dc0c18edSAaron Komisar bool regulatory_pre_cac_allowed(struct wiphy *wiphy);
5670dc0c18edSAaron Komisar 
5671dc0c18edSAaron Komisar /**
567219d3577eSHaim Dreyfuss  * DOC: Internal regulatory db functions
567319d3577eSHaim Dreyfuss  *
567419d3577eSHaim Dreyfuss  */
567519d3577eSHaim Dreyfuss 
567619d3577eSHaim Dreyfuss /**
567719d3577eSHaim Dreyfuss  * reg_query_regdb_wmm -  Query internal regulatory db for wmm rule
567819d3577eSHaim Dreyfuss  * Regulatory self-managed driver can use it to proactively
567919d3577eSHaim Dreyfuss  *
568019d3577eSHaim Dreyfuss  * @alpha2: the ISO/IEC 3166 alpha2 wmm rule to be queried.
568119d3577eSHaim Dreyfuss  * @freq: the freqency(in MHz) to be queried.
568219d3577eSHaim Dreyfuss  * @rule: pointer to store the wmm rule from the regulatory db.
568319d3577eSHaim Dreyfuss  *
568419d3577eSHaim Dreyfuss  * Self-managed wireless drivers can use this function to  query
568519d3577eSHaim Dreyfuss  * the internal regulatory database to check whether the given
568619d3577eSHaim Dreyfuss  * ISO/IEC 3166 alpha2 country and freq have wmm rule limitations.
568719d3577eSHaim Dreyfuss  *
568819d3577eSHaim Dreyfuss  * Drivers should check the return value, its possible you can get
568919d3577eSHaim Dreyfuss  * an -ENODATA.
569019d3577eSHaim Dreyfuss  *
569119d3577eSHaim Dreyfuss  * Return: 0 on success. -ENODATA.
569219d3577eSHaim Dreyfuss  */
569338cb87eeSStanislaw Gruszka int reg_query_regdb_wmm(char *alpha2, int freq,
569438cb87eeSStanislaw Gruszka 			struct ieee80211_reg_rule *rule);
569519d3577eSHaim Dreyfuss 
5696d3236553SJohannes Berg /*
5697d3236553SJohannes Berg  * callbacks for asynchronous cfg80211 methods, notification
5698d3236553SJohannes Berg  * functions and BSS handling helpers
5699d3236553SJohannes Berg  */
5700d3236553SJohannes Berg 
57012a519311SJohannes Berg /**
57022a519311SJohannes Berg  * cfg80211_scan_done - notify that scan finished
57032a519311SJohannes Berg  *
57042a519311SJohannes Berg  * @request: the corresponding scan request
57051d76250bSAvraham Stern  * @info: information about the completed scan
57062a519311SJohannes Berg  */
57071d76250bSAvraham Stern void cfg80211_scan_done(struct cfg80211_scan_request *request,
57081d76250bSAvraham Stern 			struct cfg80211_scan_info *info);
57092a519311SJohannes Berg 
57102a519311SJohannes Berg /**
5711807f8a8cSLuciano Coelho  * cfg80211_sched_scan_results - notify that new scan results are available
5712807f8a8cSLuciano Coelho  *
5713807f8a8cSLuciano Coelho  * @wiphy: the wiphy which got scheduled scan results
5714b34939b9SArend Van Spriel  * @reqid: identifier for the related scheduled scan request
5715807f8a8cSLuciano Coelho  */
5716b34939b9SArend Van Spriel void cfg80211_sched_scan_results(struct wiphy *wiphy, u64 reqid);
5717807f8a8cSLuciano Coelho 
5718807f8a8cSLuciano Coelho /**
5719807f8a8cSLuciano Coelho  * cfg80211_sched_scan_stopped - notify that the scheduled scan has stopped
5720807f8a8cSLuciano Coelho  *
5721807f8a8cSLuciano Coelho  * @wiphy: the wiphy on which the scheduled scan stopped
5722b34939b9SArend Van Spriel  * @reqid: identifier for the related scheduled scan request
5723807f8a8cSLuciano Coelho  *
5724807f8a8cSLuciano Coelho  * The driver can call this function to inform cfg80211 that the
5725807f8a8cSLuciano Coelho  * scheduled scan had to be stopped, for whatever reason.  The driver
5726807f8a8cSLuciano Coelho  * is then called back via the sched_scan_stop operation when done.
5727807f8a8cSLuciano Coelho  */
5728b34939b9SArend Van Spriel void cfg80211_sched_scan_stopped(struct wiphy *wiphy, u64 reqid);
5729807f8a8cSLuciano Coelho 
5730807f8a8cSLuciano Coelho /**
5731792e6aa7SEliad Peller  * cfg80211_sched_scan_stopped_rtnl - notify that the scheduled scan has stopped
5732792e6aa7SEliad Peller  *
5733792e6aa7SEliad Peller  * @wiphy: the wiphy on which the scheduled scan stopped
5734b34939b9SArend Van Spriel  * @reqid: identifier for the related scheduled scan request
5735792e6aa7SEliad Peller  *
5736792e6aa7SEliad Peller  * The driver can call this function to inform cfg80211 that the
5737792e6aa7SEliad Peller  * scheduled scan had to be stopped, for whatever reason.  The driver
5738792e6aa7SEliad Peller  * is then called back via the sched_scan_stop operation when done.
5739792e6aa7SEliad Peller  * This function should be called with rtnl locked.
5740792e6aa7SEliad Peller  */
5741b34939b9SArend Van Spriel void cfg80211_sched_scan_stopped_rtnl(struct wiphy *wiphy, u64 reqid);
5742792e6aa7SEliad Peller 
5743792e6aa7SEliad Peller /**
57446e19bc4bSDmitry Shmidt  * cfg80211_inform_bss_frame_data - inform cfg80211 of a received BSS frame
57452a519311SJohannes Berg  * @wiphy: the wiphy reporting the BSS
57466e19bc4bSDmitry Shmidt  * @data: the BSS metadata
5747abe37c4bSJohannes Berg  * @mgmt: the management frame (probe response or beacon)
5748abe37c4bSJohannes Berg  * @len: length of the management frame
57492a519311SJohannes Berg  * @gfp: context flags
57502a519311SJohannes Berg  *
57512a519311SJohannes Berg  * This informs cfg80211 that BSS information was found and
57522a519311SJohannes Berg  * the BSS should be updated/added.
5753ef100682SJohannes Berg  *
57540ae997dcSYacine Belkadi  * Return: A referenced struct, must be released with cfg80211_put_bss()!
57550ae997dcSYacine Belkadi  * Or %NULL on error.
57562a519311SJohannes Berg  */
5757ef100682SJohannes Berg struct cfg80211_bss * __must_check
57586e19bc4bSDmitry Shmidt cfg80211_inform_bss_frame_data(struct wiphy *wiphy,
57596e19bc4bSDmitry Shmidt 			       struct cfg80211_inform_bss *data,
57606e19bc4bSDmitry Shmidt 			       struct ieee80211_mgmt *mgmt, size_t len,
57616e19bc4bSDmitry Shmidt 			       gfp_t gfp);
57626e19bc4bSDmitry Shmidt 
57636e19bc4bSDmitry Shmidt static inline struct cfg80211_bss * __must_check
5764dcd6eac1SSimon Wunderlich cfg80211_inform_bss_width_frame(struct wiphy *wiphy,
57653afc2167SEmmanuel Grumbach 				struct ieee80211_channel *rx_channel,
5766dcd6eac1SSimon Wunderlich 				enum nl80211_bss_scan_width scan_width,
5767dcd6eac1SSimon Wunderlich 				struct ieee80211_mgmt *mgmt, size_t len,
57686e19bc4bSDmitry Shmidt 				s32 signal, gfp_t gfp)
57696e19bc4bSDmitry Shmidt {
57706e19bc4bSDmitry Shmidt 	struct cfg80211_inform_bss data = {
57716e19bc4bSDmitry Shmidt 		.chan = rx_channel,
57726e19bc4bSDmitry Shmidt 		.scan_width = scan_width,
57736e19bc4bSDmitry Shmidt 		.signal = signal,
57746e19bc4bSDmitry Shmidt 	};
57756e19bc4bSDmitry Shmidt 
57766e19bc4bSDmitry Shmidt 	return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp);
57776e19bc4bSDmitry Shmidt }
5778dcd6eac1SSimon Wunderlich 
5779dcd6eac1SSimon Wunderlich static inline struct cfg80211_bss * __must_check
57802a519311SJohannes Berg cfg80211_inform_bss_frame(struct wiphy *wiphy,
57813afc2167SEmmanuel Grumbach 			  struct ieee80211_channel *rx_channel,
57822a519311SJohannes Berg 			  struct ieee80211_mgmt *mgmt, size_t len,
5783dcd6eac1SSimon Wunderlich 			  s32 signal, gfp_t gfp)
5784dcd6eac1SSimon Wunderlich {
57856e19bc4bSDmitry Shmidt 	struct cfg80211_inform_bss data = {
57866e19bc4bSDmitry Shmidt 		.chan = rx_channel,
57876e19bc4bSDmitry Shmidt 		.scan_width = NL80211_BSS_CHAN_WIDTH_20,
57886e19bc4bSDmitry Shmidt 		.signal = signal,
57896e19bc4bSDmitry Shmidt 	};
57906e19bc4bSDmitry Shmidt 
57916e19bc4bSDmitry Shmidt 	return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp);
5792dcd6eac1SSimon Wunderlich }
57932a519311SJohannes Berg 
5794abe37c4bSJohannes Berg /**
57957ece9c37SSara Sharon  * cfg80211_gen_new_bssid - generate a nontransmitted BSSID for multi-BSSID
57967ece9c37SSara Sharon  * @bssid: transmitter BSSID
57977ece9c37SSara Sharon  * @max_bssid: max BSSID indicator, taken from Multiple BSSID element
57987ece9c37SSara Sharon  * @mbssid_index: BSSID index, taken from Multiple BSSID index element
57995d4071abSJohannes Berg  * @new_bssid: calculated nontransmitted BSSID
58007ece9c37SSara Sharon  */
58017ece9c37SSara Sharon static inline void cfg80211_gen_new_bssid(const u8 *bssid, u8 max_bssid,
58025d4071abSJohannes Berg 					  u8 mbssid_index, u8 *new_bssid)
58037ece9c37SSara Sharon {
58045d4071abSJohannes Berg 	u64 bssid_u64 = ether_addr_to_u64(bssid);
58055d4071abSJohannes Berg 	u64 mask = GENMASK_ULL(max_bssid - 1, 0);
58065d4071abSJohannes Berg 	u64 new_bssid_u64;
58077ece9c37SSara Sharon 
58085d4071abSJohannes Berg 	new_bssid_u64 = bssid_u64 & ~mask;
58097ece9c37SSara Sharon 
58105d4071abSJohannes Berg 	new_bssid_u64 |= ((bssid_u64 & mask) + mbssid_index) & mask;
58117ece9c37SSara Sharon 
58125d4071abSJohannes Berg 	u64_to_ether_addr(new_bssid_u64, new_bssid);
58137ece9c37SSara Sharon }
58147ece9c37SSara Sharon 
58157ece9c37SSara Sharon /**
5816f7dacfb1SSara Sharon  * cfg80211_is_element_inherited - returns if element ID should be inherited
5817f7dacfb1SSara Sharon  * @element: element to check
5818f7dacfb1SSara Sharon  * @non_inherit_element: non inheritance element
5819f7dacfb1SSara Sharon  */
5820f7dacfb1SSara Sharon bool cfg80211_is_element_inherited(const struct element *element,
5821f7dacfb1SSara Sharon 				   const struct element *non_inherit_element);
5822f7dacfb1SSara Sharon 
5823f7dacfb1SSara Sharon /**
5824fe806e49SSara Sharon  * cfg80211_merge_profile - merges a MBSSID profile if it is split between IEs
5825fe806e49SSara Sharon  * @ie: ies
5826fe806e49SSara Sharon  * @ielen: length of IEs
5827fe806e49SSara Sharon  * @mbssid_elem: current MBSSID element
5828fe806e49SSara Sharon  * @sub_elem: current MBSSID subelement (profile)
5829fe806e49SSara Sharon  * @merged_ie: location of the merged profile
5830fe806e49SSara Sharon  * @max_copy_len: max merged profile length
5831fe806e49SSara Sharon  */
5832fe806e49SSara Sharon size_t cfg80211_merge_profile(const u8 *ie, size_t ielen,
5833fe806e49SSara Sharon 			      const struct element *mbssid_elem,
5834fe806e49SSara Sharon 			      const struct element *sub_elem,
58355809a5d5SDan Carpenter 			      u8 *merged_ie, size_t max_copy_len);
5836fe806e49SSara Sharon 
5837fe806e49SSara Sharon /**
58385bc8c1f2SJohannes Berg  * enum cfg80211_bss_frame_type - frame type that the BSS data came from
58395bc8c1f2SJohannes Berg  * @CFG80211_BSS_FTYPE_UNKNOWN: driver doesn't know whether the data is
58405bc8c1f2SJohannes Berg  *	from a beacon or probe response
58415bc8c1f2SJohannes Berg  * @CFG80211_BSS_FTYPE_BEACON: data comes from a beacon
58425bc8c1f2SJohannes Berg  * @CFG80211_BSS_FTYPE_PRESP: data comes from a probe response
58435bc8c1f2SJohannes Berg  */
58445bc8c1f2SJohannes Berg enum cfg80211_bss_frame_type {
58455bc8c1f2SJohannes Berg 	CFG80211_BSS_FTYPE_UNKNOWN,
58465bc8c1f2SJohannes Berg 	CFG80211_BSS_FTYPE_BEACON,
58475bc8c1f2SJohannes Berg 	CFG80211_BSS_FTYPE_PRESP,
58485bc8c1f2SJohannes Berg };
58495bc8c1f2SJohannes Berg 
58505bc8c1f2SJohannes Berg /**
58516e19bc4bSDmitry Shmidt  * cfg80211_inform_bss_data - inform cfg80211 of a new BSS
5852abe37c4bSJohannes Berg  *
5853abe37c4bSJohannes Berg  * @wiphy: the wiphy reporting the BSS
58546e19bc4bSDmitry Shmidt  * @data: the BSS metadata
58555bc8c1f2SJohannes Berg  * @ftype: frame type (if known)
5856abe37c4bSJohannes Berg  * @bssid: the BSSID of the BSS
58577b8bcff2SJohannes Berg  * @tsf: the TSF sent by the peer in the beacon/probe response (or 0)
5858abe37c4bSJohannes Berg  * @capability: the capability field sent by the peer
5859abe37c4bSJohannes Berg  * @beacon_interval: the beacon interval announced by the peer
5860abe37c4bSJohannes Berg  * @ie: additional IEs sent by the peer
5861abe37c4bSJohannes Berg  * @ielen: length of the additional IEs
5862abe37c4bSJohannes Berg  * @gfp: context flags
5863abe37c4bSJohannes Berg  *
5864abe37c4bSJohannes Berg  * This informs cfg80211 that BSS information was found and
5865abe37c4bSJohannes Berg  * the BSS should be updated/added.
5866ef100682SJohannes Berg  *
58670ae997dcSYacine Belkadi  * Return: A referenced struct, must be released with cfg80211_put_bss()!
58680ae997dcSYacine Belkadi  * Or %NULL on error.
5869abe37c4bSJohannes Berg  */
5870ef100682SJohannes Berg struct cfg80211_bss * __must_check
58716e19bc4bSDmitry Shmidt cfg80211_inform_bss_data(struct wiphy *wiphy,
58726e19bc4bSDmitry Shmidt 			 struct cfg80211_inform_bss *data,
58736e19bc4bSDmitry Shmidt 			 enum cfg80211_bss_frame_type ftype,
58746e19bc4bSDmitry Shmidt 			 const u8 *bssid, u64 tsf, u16 capability,
58756e19bc4bSDmitry Shmidt 			 u16 beacon_interval, const u8 *ie, size_t ielen,
58766e19bc4bSDmitry Shmidt 			 gfp_t gfp);
58776e19bc4bSDmitry Shmidt 
58786e19bc4bSDmitry Shmidt static inline struct cfg80211_bss * __must_check
5879dcd6eac1SSimon Wunderlich cfg80211_inform_bss_width(struct wiphy *wiphy,
58803afc2167SEmmanuel Grumbach 			  struct ieee80211_channel *rx_channel,
5881dcd6eac1SSimon Wunderlich 			  enum nl80211_bss_scan_width scan_width,
58825bc8c1f2SJohannes Berg 			  enum cfg80211_bss_frame_type ftype,
5883dcd6eac1SSimon Wunderlich 			  const u8 *bssid, u64 tsf, u16 capability,
5884dcd6eac1SSimon Wunderlich 			  u16 beacon_interval, const u8 *ie, size_t ielen,
58856e19bc4bSDmitry Shmidt 			  s32 signal, gfp_t gfp)
58866e19bc4bSDmitry Shmidt {
58876e19bc4bSDmitry Shmidt 	struct cfg80211_inform_bss data = {
58886e19bc4bSDmitry Shmidt 		.chan = rx_channel,
58896e19bc4bSDmitry Shmidt 		.scan_width = scan_width,
58906e19bc4bSDmitry Shmidt 		.signal = signal,
58916e19bc4bSDmitry Shmidt 	};
58926e19bc4bSDmitry Shmidt 
58936e19bc4bSDmitry Shmidt 	return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf,
58946e19bc4bSDmitry Shmidt 					capability, beacon_interval, ie, ielen,
58956e19bc4bSDmitry Shmidt 					gfp);
58966e19bc4bSDmitry Shmidt }
5897dcd6eac1SSimon Wunderlich 
5898dcd6eac1SSimon Wunderlich static inline struct cfg80211_bss * __must_check
589906aa7afaSJussi Kivilinna cfg80211_inform_bss(struct wiphy *wiphy,
59003afc2167SEmmanuel Grumbach 		    struct ieee80211_channel *rx_channel,
59015bc8c1f2SJohannes Berg 		    enum cfg80211_bss_frame_type ftype,
59027b8bcff2SJohannes Berg 		    const u8 *bssid, u64 tsf, u16 capability,
59037b8bcff2SJohannes Berg 		    u16 beacon_interval, const u8 *ie, size_t ielen,
5904dcd6eac1SSimon Wunderlich 		    s32 signal, gfp_t gfp)
5905dcd6eac1SSimon Wunderlich {
59066e19bc4bSDmitry Shmidt 	struct cfg80211_inform_bss data = {
59076e19bc4bSDmitry Shmidt 		.chan = rx_channel,
59086e19bc4bSDmitry Shmidt 		.scan_width = NL80211_BSS_CHAN_WIDTH_20,
59096e19bc4bSDmitry Shmidt 		.signal = signal,
59106e19bc4bSDmitry Shmidt 	};
59116e19bc4bSDmitry Shmidt 
59126e19bc4bSDmitry Shmidt 	return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf,
59136e19bc4bSDmitry Shmidt 					capability, beacon_interval, ie, ielen,
5914dcd6eac1SSimon Wunderlich 					gfp);
5915dcd6eac1SSimon Wunderlich }
591606aa7afaSJussi Kivilinna 
591727548677SJohannes Berg /**
591827548677SJohannes Berg  * cfg80211_get_bss - get a BSS reference
591927548677SJohannes Berg  * @wiphy: the wiphy this BSS struct belongs to
592027548677SJohannes Berg  * @channel: the channel to search on (or %NULL)
592127548677SJohannes Berg  * @bssid: the desired BSSID (or %NULL)
592227548677SJohannes Berg  * @ssid: the desired SSID (or %NULL)
592327548677SJohannes Berg  * @ssid_len: length of the SSID (or 0)
592427548677SJohannes Berg  * @bss_type: type of BSS, see &enum ieee80211_bss_type
592527548677SJohannes Berg  * @privacy: privacy filter, see &enum ieee80211_privacy
592627548677SJohannes Berg  */
59272a519311SJohannes Berg struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
59282a519311SJohannes Berg 				      struct ieee80211_channel *channel,
59292a519311SJohannes Berg 				      const u8 *bssid,
593079420f09SJohannes Berg 				      const u8 *ssid, size_t ssid_len,
59316eb18137SDedy Lansky 				      enum ieee80211_bss_type bss_type,
593227548677SJohannes Berg 				      enum ieee80211_privacy privacy);
593379420f09SJohannes Berg static inline struct cfg80211_bss *
593479420f09SJohannes Berg cfg80211_get_ibss(struct wiphy *wiphy,
593579420f09SJohannes Berg 		  struct ieee80211_channel *channel,
593679420f09SJohannes Berg 		  const u8 *ssid, size_t ssid_len)
593779420f09SJohannes Berg {
593879420f09SJohannes Berg 	return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len,
59396eb18137SDedy Lansky 				IEEE80211_BSS_TYPE_IBSS,
59406eb18137SDedy Lansky 				IEEE80211_PRIVACY_ANY);
594179420f09SJohannes Berg }
594279420f09SJohannes Berg 
59434c0c0b75SJohannes Berg /**
59444c0c0b75SJohannes Berg  * cfg80211_ref_bss - reference BSS struct
59455b112d3dSJohannes Berg  * @wiphy: the wiphy this BSS struct belongs to
59464c0c0b75SJohannes Berg  * @bss: the BSS struct to reference
59474c0c0b75SJohannes Berg  *
59484c0c0b75SJohannes Berg  * Increments the refcount of the given BSS struct.
59494c0c0b75SJohannes Berg  */
59505b112d3dSJohannes Berg void cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
59514c0c0b75SJohannes Berg 
59524c0c0b75SJohannes Berg /**
59534c0c0b75SJohannes Berg  * cfg80211_put_bss - unref BSS struct
59545b112d3dSJohannes Berg  * @wiphy: the wiphy this BSS struct belongs to
59554c0c0b75SJohannes Berg  * @bss: the BSS struct
59564c0c0b75SJohannes Berg  *
59574c0c0b75SJohannes Berg  * Decrements the refcount of the given BSS struct.
59584c0c0b75SJohannes Berg  */
59595b112d3dSJohannes Berg void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
5960d3236553SJohannes Berg 
5961d491af19SJohannes Berg /**
5962d491af19SJohannes Berg  * cfg80211_unlink_bss - unlink BSS from internal data structures
5963d491af19SJohannes Berg  * @wiphy: the wiphy
5964d491af19SJohannes Berg  * @bss: the bss to remove
5965d491af19SJohannes Berg  *
5966d491af19SJohannes Berg  * This function removes the given BSS from the internal data structures
5967d491af19SJohannes Berg  * thereby making it no longer show up in scan results etc. Use this
5968d491af19SJohannes Berg  * function when you detect a BSS is gone. Normally BSSes will also time
5969d491af19SJohannes Berg  * out, so it is not necessary to use this function at all.
5970d491af19SJohannes Berg  */
5971d491af19SJohannes Berg void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
5972fee52678SJohannes Berg 
59734770c8f9SIlan Peer /**
59744770c8f9SIlan Peer  * cfg80211_bss_iter - iterate all BSS entries
59754770c8f9SIlan Peer  *
59764770c8f9SIlan Peer  * This function iterates over the BSS entries associated with the given wiphy
59774770c8f9SIlan Peer  * and calls the callback for the iterated BSS. The iterator function is not
59784770c8f9SIlan Peer  * allowed to call functions that might modify the internal state of the BSS DB.
59794770c8f9SIlan Peer  *
59804770c8f9SIlan Peer  * @wiphy: the wiphy
59814770c8f9SIlan Peer  * @chandef: if given, the iterator function will be called only if the channel
59824770c8f9SIlan Peer  *     of the currently iterated BSS is a subset of the given channel.
59834770c8f9SIlan Peer  * @iter: the iterator function to call
59844770c8f9SIlan Peer  * @iter_data: an argument to the iterator function
59854770c8f9SIlan Peer  */
59864770c8f9SIlan Peer void cfg80211_bss_iter(struct wiphy *wiphy,
59874770c8f9SIlan Peer 		       struct cfg80211_chan_def *chandef,
59884770c8f9SIlan Peer 		       void (*iter)(struct wiphy *wiphy,
59894770c8f9SIlan Peer 				    struct cfg80211_bss *bss,
59904770c8f9SIlan Peer 				    void *data),
59914770c8f9SIlan Peer 		       void *iter_data);
59924770c8f9SIlan Peer 
5993dcd6eac1SSimon Wunderlich static inline enum nl80211_bss_scan_width
5994dcd6eac1SSimon Wunderlich cfg80211_chandef_to_scan_width(const struct cfg80211_chan_def *chandef)
5995dcd6eac1SSimon Wunderlich {
5996dcd6eac1SSimon Wunderlich 	switch (chandef->width) {
5997dcd6eac1SSimon Wunderlich 	case NL80211_CHAN_WIDTH_5:
5998dcd6eac1SSimon Wunderlich 		return NL80211_BSS_CHAN_WIDTH_5;
5999dcd6eac1SSimon Wunderlich 	case NL80211_CHAN_WIDTH_10:
6000dcd6eac1SSimon Wunderlich 		return NL80211_BSS_CHAN_WIDTH_10;
6001dcd6eac1SSimon Wunderlich 	default:
6002dcd6eac1SSimon Wunderlich 		return NL80211_BSS_CHAN_WIDTH_20;
6003dcd6eac1SSimon Wunderlich 	}
6004dcd6eac1SSimon Wunderlich }
6005dcd6eac1SSimon Wunderlich 
60066039f6d2SJouni Malinen /**
60076ff57cf8SJohannes Berg  * cfg80211_rx_mlme_mgmt - notification of processed MLME management frame
60086039f6d2SJouni Malinen  * @dev: network device
60096039f6d2SJouni Malinen  * @buf: authentication frame (header + body)
60106039f6d2SJouni Malinen  * @len: length of the frame data
60116039f6d2SJouni Malinen  *
60126ff57cf8SJohannes Berg  * This function is called whenever an authentication, disassociation or
60136ff57cf8SJohannes Berg  * deauthentication frame has been received and processed in station mode.
60146ff57cf8SJohannes Berg  * After being asked to authenticate via cfg80211_ops::auth() the driver must
60156ff57cf8SJohannes Berg  * call either this function or cfg80211_auth_timeout().
60166ff57cf8SJohannes Berg  * After being asked to associate via cfg80211_ops::assoc() the driver must
60176ff57cf8SJohannes Berg  * call either this function or cfg80211_auth_timeout().
60186ff57cf8SJohannes Berg  * While connected, the driver must calls this for received and processed
60196ff57cf8SJohannes Berg  * disassociation and deauthentication frames. If the frame couldn't be used
60206ff57cf8SJohannes Berg  * because it was unprotected, the driver must call the function
60216ff57cf8SJohannes Berg  * cfg80211_rx_unprot_mlme_mgmt() instead.
60226ff57cf8SJohannes Berg  *
60236ff57cf8SJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's mutex.
60246039f6d2SJouni Malinen  */
60256ff57cf8SJohannes Berg void cfg80211_rx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len);
60266039f6d2SJouni Malinen 
60276039f6d2SJouni Malinen /**
60286ff57cf8SJohannes Berg  * cfg80211_auth_timeout - notification of timed out authentication
60291965c853SJouni Malinen  * @dev: network device
60301965c853SJouni Malinen  * @addr: The MAC address of the device with which the authentication timed out
6031cb0b4bebSJohannes Berg  *
60328d61ffa5SJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's
60338d61ffa5SJohannes Berg  * mutex.
60341965c853SJouni Malinen  */
60356ff57cf8SJohannes Berg void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr);
60361965c853SJouni Malinen 
60371965c853SJouni Malinen /**
60386ff57cf8SJohannes Berg  * cfg80211_rx_assoc_resp - notification of processed association response
60396039f6d2SJouni Malinen  * @dev: network device
60406ff57cf8SJohannes Berg  * @bss: the BSS that association was requested with, ownership of the pointer
60416ff57cf8SJohannes Berg  *	moves to cfg80211 in this call
60424d9ec73dSJouni Malinen  * @buf: (Re)Association Response frame (header + body)
60436039f6d2SJouni Malinen  * @len: length of the frame data
6044f438ceb8SEmmanuel Grumbach  * @uapsd_queues: bitmap of queues configured for uapsd. Same format
6045f438ceb8SEmmanuel Grumbach  *	as the AC bitmap in the QoS info field
60464d9ec73dSJouni Malinen  * @req_ies: information elements from the (Re)Association Request frame
60474d9ec73dSJouni Malinen  * @req_ies_len: length of req_ies data
60486039f6d2SJouni Malinen  *
60496ff57cf8SJohannes Berg  * After being asked to associate via cfg80211_ops::assoc() the driver must
60506ff57cf8SJohannes Berg  * call either this function or cfg80211_auth_timeout().
60516ff57cf8SJohannes Berg  *
60526ff57cf8SJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's mutex.
60536039f6d2SJouni Malinen  */
60546ff57cf8SJohannes Berg void cfg80211_rx_assoc_resp(struct net_device *dev,
60556ff57cf8SJohannes Berg 			    struct cfg80211_bss *bss,
6056b0b6aa2cSEliad Peller 			    const u8 *buf, size_t len,
60574d9ec73dSJouni Malinen 			    int uapsd_queues,
60584d9ec73dSJouni Malinen 			    const u8 *req_ies, size_t req_ies_len);
60596039f6d2SJouni Malinen 
60606039f6d2SJouni Malinen /**
60616ff57cf8SJohannes Berg  * cfg80211_assoc_timeout - notification of timed out association
60621965c853SJouni Malinen  * @dev: network device
6063959867faSJohannes Berg  * @bss: The BSS entry with which association timed out.
6064cb0b4bebSJohannes Berg  *
60658d61ffa5SJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's mutex.
60661965c853SJouni Malinen  */
6067959867faSJohannes Berg void cfg80211_assoc_timeout(struct net_device *dev, struct cfg80211_bss *bss);
60681965c853SJouni Malinen 
60691965c853SJouni Malinen /**
6070e6f462dfSJohannes Berg  * cfg80211_abandon_assoc - notify cfg80211 of abandoned association attempt
6071e6f462dfSJohannes Berg  * @dev: network device
6072e6f462dfSJohannes Berg  * @bss: The BSS entry with which association was abandoned.
6073e6f462dfSJohannes Berg  *
6074e6f462dfSJohannes Berg  * Call this whenever - for reasons reported through other API, like deauth RX,
6075e6f462dfSJohannes Berg  * an association attempt was abandoned.
6076e6f462dfSJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's mutex.
6077e6f462dfSJohannes Berg  */
6078e6f462dfSJohannes Berg void cfg80211_abandon_assoc(struct net_device *dev, struct cfg80211_bss *bss);
6079e6f462dfSJohannes Berg 
6080e6f462dfSJohannes Berg /**
60816ff57cf8SJohannes Berg  * cfg80211_tx_mlme_mgmt - notification of transmitted deauth/disassoc frame
60826039f6d2SJouni Malinen  * @dev: network device
60836ff57cf8SJohannes Berg  * @buf: 802.11 frame (header + body)
60846039f6d2SJouni Malinen  * @len: length of the frame data
60856039f6d2SJouni Malinen  *
60866039f6d2SJouni Malinen  * This function is called whenever deauthentication has been processed in
608753b46b84SJouni Malinen  * station mode. This includes both received deauthentication frames and
60888d61ffa5SJohannes Berg  * locally generated ones. This function may sleep. The caller must hold the
60898d61ffa5SJohannes Berg  * corresponding wdev's mutex.
60906039f6d2SJouni Malinen  */
60916ff57cf8SJohannes Berg void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len);
6092ce470613SHolger Schurig 
6093ce470613SHolger Schurig /**
60946ff57cf8SJohannes Berg  * cfg80211_rx_unprot_mlme_mgmt - notification of unprotected mlme mgmt frame
6095cf4e594eSJouni Malinen  * @dev: network device
6096cf4e594eSJouni Malinen  * @buf: deauthentication frame (header + body)
6097cf4e594eSJouni Malinen  * @len: length of the frame data
6098cf4e594eSJouni Malinen  *
60996ff57cf8SJohannes Berg  * This function is called whenever a received deauthentication or dissassoc
61006ff57cf8SJohannes Berg  * frame has been dropped in station mode because of MFP being used but the
6101cf4e594eSJouni Malinen  * frame was not protected. This function may sleep.
6102cf4e594eSJouni Malinen  */
61036ff57cf8SJohannes Berg void cfg80211_rx_unprot_mlme_mgmt(struct net_device *dev,
61046ff57cf8SJohannes Berg 				  const u8 *buf, size_t len);
6105cf4e594eSJouni Malinen 
6106cf4e594eSJouni Malinen /**
6107a3b8b056SJouni Malinen  * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP)
6108a3b8b056SJouni Malinen  * @dev: network device
6109a3b8b056SJouni Malinen  * @addr: The source MAC address of the frame
6110a3b8b056SJouni Malinen  * @key_type: The key type that the received frame used
6111a66b98dbSArik Nemtsov  * @key_id: Key identifier (0..3). Can be -1 if missing.
6112a3b8b056SJouni Malinen  * @tsc: The TSC value of the frame that generated the MIC failure (6 octets)
6113e6d6e342SJohannes Berg  * @gfp: allocation flags
6114a3b8b056SJouni Malinen  *
6115a3b8b056SJouni Malinen  * This function is called whenever the local MAC detects a MIC failure in a
6116a3b8b056SJouni Malinen  * received frame. This matches with MLME-MICHAELMICFAILURE.indication()
6117a3b8b056SJouni Malinen  * primitive.
6118a3b8b056SJouni Malinen  */
6119a3b8b056SJouni Malinen void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,
6120a3b8b056SJouni Malinen 				  enum nl80211_key_type key_type, int key_id,
6121e6d6e342SJohannes Berg 				  const u8 *tsc, gfp_t gfp);
6122a3b8b056SJouni Malinen 
612304a773adSJohannes Berg /**
612404a773adSJohannes Berg  * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS
612504a773adSJohannes Berg  *
612604a773adSJohannes Berg  * @dev: network device
612704a773adSJohannes Berg  * @bssid: the BSSID of the IBSS joined
6128fe94f3a4SAntonio Quartulli  * @channel: the channel of the IBSS joined
612904a773adSJohannes Berg  * @gfp: allocation flags
613004a773adSJohannes Berg  *
613104a773adSJohannes Berg  * This function notifies cfg80211 that the device joined an IBSS or
613204a773adSJohannes Berg  * switched to a different BSSID. Before this function can be called,
613304a773adSJohannes Berg  * either a beacon has to have been received from the IBSS, or one of
613404a773adSJohannes Berg  * the cfg80211_inform_bss{,_frame} functions must have been called
613504a773adSJohannes Berg  * with the locally generated beacon -- this guarantees that there is
613604a773adSJohannes Berg  * always a scan result for this IBSS. cfg80211 will handle the rest.
613704a773adSJohannes Berg  */
6138fe94f3a4SAntonio Quartulli void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid,
6139fe94f3a4SAntonio Quartulli 			  struct ieee80211_channel *channel, gfp_t gfp);
614004a773adSJohannes Berg 
61411f87f7d3SJohannes Berg /**
6142c93b5e71SJavier Cardona  * cfg80211_notify_new_candidate - notify cfg80211 of a new mesh peer candidate
6143c93b5e71SJavier Cardona  *
6144c93b5e71SJavier Cardona  * @dev: network device
6145c93b5e71SJavier Cardona  * @macaddr: the MAC address of the new candidate
6146c93b5e71SJavier Cardona  * @ie: information elements advertised by the peer candidate
61475ac4a12dSMatteo Croce  * @ie_len: length of the information elements buffer
6148c93b5e71SJavier Cardona  * @gfp: allocation flags
6149c93b5e71SJavier Cardona  *
6150c93b5e71SJavier Cardona  * This function notifies cfg80211 that the mesh peer candidate has been
6151c93b5e71SJavier Cardona  * detected, most likely via a beacon or, less likely, via a probe response.
6152c93b5e71SJavier Cardona  * cfg80211 then sends a notification to userspace.
6153c93b5e71SJavier Cardona  */
6154c93b5e71SJavier Cardona void cfg80211_notify_new_peer_candidate(struct net_device *dev,
6155ecbc12adSBob Copeland 		const u8 *macaddr, const u8 *ie, u8 ie_len,
6156ecbc12adSBob Copeland 		int sig_dbm, gfp_t gfp);
6157c93b5e71SJavier Cardona 
6158c93b5e71SJavier Cardona /**
6159d70e9693SJohannes Berg  * DOC: RFkill integration
6160d70e9693SJohannes Berg  *
6161d70e9693SJohannes Berg  * RFkill integration in cfg80211 is almost invisible to drivers,
6162d70e9693SJohannes Berg  * as cfg80211 automatically registers an rfkill instance for each
6163d70e9693SJohannes Berg  * wireless device it knows about. Soft kill is also translated
6164d70e9693SJohannes Berg  * into disconnecting and turning all interfaces off, drivers are
6165d70e9693SJohannes Berg  * expected to turn off the device when all interfaces are down.
6166d70e9693SJohannes Berg  *
6167d70e9693SJohannes Berg  * However, devices may have a hard RFkill line, in which case they
6168d70e9693SJohannes Berg  * also need to interact with the rfkill subsystem, via cfg80211.
6169d70e9693SJohannes Berg  * They can do this with a few helper functions documented here.
6170d70e9693SJohannes Berg  */
6171d70e9693SJohannes Berg 
6172d70e9693SJohannes Berg /**
61731f87f7d3SJohannes Berg  * wiphy_rfkill_set_hw_state - notify cfg80211 about hw block state
61741f87f7d3SJohannes Berg  * @wiphy: the wiphy
61751f87f7d3SJohannes Berg  * @blocked: block status
61761f87f7d3SJohannes Berg  */
61771f87f7d3SJohannes Berg void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked);
61781f87f7d3SJohannes Berg 
61791f87f7d3SJohannes Berg /**
61801f87f7d3SJohannes Berg  * wiphy_rfkill_start_polling - start polling rfkill
61811f87f7d3SJohannes Berg  * @wiphy: the wiphy
61821f87f7d3SJohannes Berg  */
61831f87f7d3SJohannes Berg void wiphy_rfkill_start_polling(struct wiphy *wiphy);
61841f87f7d3SJohannes Berg 
61851f87f7d3SJohannes Berg /**
61861f87f7d3SJohannes Berg  * wiphy_rfkill_stop_polling - stop polling rfkill
61871f87f7d3SJohannes Berg  * @wiphy: the wiphy
61881f87f7d3SJohannes Berg  */
61891f87f7d3SJohannes Berg void wiphy_rfkill_stop_polling(struct wiphy *wiphy);
61901f87f7d3SJohannes Berg 
6191ad7e718cSJohannes Berg /**
6192ad7e718cSJohannes Berg  * DOC: Vendor commands
6193ad7e718cSJohannes Berg  *
6194ad7e718cSJohannes Berg  * Occasionally, there are special protocol or firmware features that
6195ad7e718cSJohannes Berg  * can't be implemented very openly. For this and similar cases, the
6196ad7e718cSJohannes Berg  * vendor command functionality allows implementing the features with
6197ad7e718cSJohannes Berg  * (typically closed-source) userspace and firmware, using nl80211 as
6198ad7e718cSJohannes Berg  * the configuration mechanism.
6199ad7e718cSJohannes Berg  *
6200ad7e718cSJohannes Berg  * A driver supporting vendor commands must register them as an array
6201ad7e718cSJohannes Berg  * in struct wiphy, with handlers for each one, each command has an
6202ad7e718cSJohannes Berg  * OUI and sub command ID to identify it.
6203ad7e718cSJohannes Berg  *
6204ad7e718cSJohannes Berg  * Note that this feature should not be (ab)used to implement protocol
6205ad7e718cSJohannes Berg  * features that could openly be shared across drivers. In particular,
6206ad7e718cSJohannes Berg  * it must never be required to use vendor commands to implement any
6207ad7e718cSJohannes Berg  * "normal" functionality that higher-level userspace like connection
6208ad7e718cSJohannes Berg  * managers etc. need.
6209ad7e718cSJohannes Berg  */
6210ad7e718cSJohannes Berg 
6211ad7e718cSJohannes Berg struct sk_buff *__cfg80211_alloc_reply_skb(struct wiphy *wiphy,
6212ad7e718cSJohannes Berg 					   enum nl80211_commands cmd,
6213ad7e718cSJohannes Berg 					   enum nl80211_attrs attr,
6214ad7e718cSJohannes Berg 					   int approxlen);
6215ad7e718cSJohannes Berg 
6216567ffc35SJohannes Berg struct sk_buff *__cfg80211_alloc_event_skb(struct wiphy *wiphy,
62176c09e791SAhmad Kholaif 					   struct wireless_dev *wdev,
6218567ffc35SJohannes Berg 					   enum nl80211_commands cmd,
6219567ffc35SJohannes Berg 					   enum nl80211_attrs attr,
622055c1fdf0SJohannes Berg 					   unsigned int portid,
6221567ffc35SJohannes Berg 					   int vendor_event_idx,
6222567ffc35SJohannes Berg 					   int approxlen, gfp_t gfp);
6223567ffc35SJohannes Berg 
6224567ffc35SJohannes Berg void __cfg80211_send_event_skb(struct sk_buff *skb, gfp_t gfp);
6225567ffc35SJohannes Berg 
6226ad7e718cSJohannes Berg /**
6227ad7e718cSJohannes Berg  * cfg80211_vendor_cmd_alloc_reply_skb - allocate vendor command reply
6228ad7e718cSJohannes Berg  * @wiphy: the wiphy
6229ad7e718cSJohannes Berg  * @approxlen: an upper bound of the length of the data that will
6230ad7e718cSJohannes Berg  *	be put into the skb
6231ad7e718cSJohannes Berg  *
6232ad7e718cSJohannes Berg  * This function allocates and pre-fills an skb for a reply to
6233ad7e718cSJohannes Berg  * a vendor command. Since it is intended for a reply, calling
6234ad7e718cSJohannes Berg  * it outside of a vendor command's doit() operation is invalid.
6235ad7e718cSJohannes Berg  *
6236ad7e718cSJohannes Berg  * The returned skb is pre-filled with some identifying data in
6237ad7e718cSJohannes Berg  * a way that any data that is put into the skb (with skb_put(),
6238ad7e718cSJohannes Berg  * nla_put() or similar) will end up being within the
6239ad7e718cSJohannes Berg  * %NL80211_ATTR_VENDOR_DATA attribute, so all that needs to be done
6240ad7e718cSJohannes Berg  * with the skb is adding data for the corresponding userspace tool
6241ad7e718cSJohannes Berg  * which can then read that data out of the vendor data attribute.
6242ad7e718cSJohannes Berg  * You must not modify the skb in any other way.
6243ad7e718cSJohannes Berg  *
6244ad7e718cSJohannes Berg  * When done, call cfg80211_vendor_cmd_reply() with the skb and return
6245ad7e718cSJohannes Berg  * its error code as the result of the doit() operation.
6246ad7e718cSJohannes Berg  *
6247ad7e718cSJohannes Berg  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
6248ad7e718cSJohannes Berg  */
6249ad7e718cSJohannes Berg static inline struct sk_buff *
6250ad7e718cSJohannes Berg cfg80211_vendor_cmd_alloc_reply_skb(struct wiphy *wiphy, int approxlen)
6251ad7e718cSJohannes Berg {
6252ad7e718cSJohannes Berg 	return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_VENDOR,
6253ad7e718cSJohannes Berg 					  NL80211_ATTR_VENDOR_DATA, approxlen);
6254ad7e718cSJohannes Berg }
6255ad7e718cSJohannes Berg 
6256ad7e718cSJohannes Berg /**
6257ad7e718cSJohannes Berg  * cfg80211_vendor_cmd_reply - send the reply skb
6258ad7e718cSJohannes Berg  * @skb: The skb, must have been allocated with
6259ad7e718cSJohannes Berg  *	cfg80211_vendor_cmd_alloc_reply_skb()
6260ad7e718cSJohannes Berg  *
6261ad7e718cSJohannes Berg  * Since calling this function will usually be the last thing
6262ad7e718cSJohannes Berg  * before returning from the vendor command doit() you should
6263ad7e718cSJohannes Berg  * return the error code.  Note that this function consumes the
6264ad7e718cSJohannes Berg  * skb regardless of the return value.
6265ad7e718cSJohannes Berg  *
6266ad7e718cSJohannes Berg  * Return: An error code or 0 on success.
6267ad7e718cSJohannes Berg  */
6268ad7e718cSJohannes Berg int cfg80211_vendor_cmd_reply(struct sk_buff *skb);
6269ad7e718cSJohannes Berg 
6270567ffc35SJohannes Berg /**
627155c1fdf0SJohannes Berg  * cfg80211_vendor_cmd_get_sender
627255c1fdf0SJohannes Berg  * @wiphy: the wiphy
627355c1fdf0SJohannes Berg  *
627455c1fdf0SJohannes Berg  * Return the current netlink port ID in a vendor command handler.
627555c1fdf0SJohannes Berg  * Valid to call only there.
627655c1fdf0SJohannes Berg  */
627755c1fdf0SJohannes Berg unsigned int cfg80211_vendor_cmd_get_sender(struct wiphy *wiphy);
627855c1fdf0SJohannes Berg 
627955c1fdf0SJohannes Berg /**
6280567ffc35SJohannes Berg  * cfg80211_vendor_event_alloc - allocate vendor-specific event skb
6281567ffc35SJohannes Berg  * @wiphy: the wiphy
62826c09e791SAhmad Kholaif  * @wdev: the wireless device
6283567ffc35SJohannes Berg  * @event_idx: index of the vendor event in the wiphy's vendor_events
6284567ffc35SJohannes Berg  * @approxlen: an upper bound of the length of the data that will
6285567ffc35SJohannes Berg  *	be put into the skb
6286567ffc35SJohannes Berg  * @gfp: allocation flags
6287567ffc35SJohannes Berg  *
6288567ffc35SJohannes Berg  * This function allocates and pre-fills an skb for an event on the
6289567ffc35SJohannes Berg  * vendor-specific multicast group.
6290567ffc35SJohannes Berg  *
62916c09e791SAhmad Kholaif  * If wdev != NULL, both the ifindex and identifier of the specified
62926c09e791SAhmad Kholaif  * wireless device are added to the event message before the vendor data
62936c09e791SAhmad Kholaif  * attribute.
62946c09e791SAhmad Kholaif  *
6295567ffc35SJohannes Berg  * When done filling the skb, call cfg80211_vendor_event() with the
6296567ffc35SJohannes Berg  * skb to send the event.
6297567ffc35SJohannes Berg  *
6298567ffc35SJohannes Berg  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
6299567ffc35SJohannes Berg  */
6300567ffc35SJohannes Berg static inline struct sk_buff *
63016c09e791SAhmad Kholaif cfg80211_vendor_event_alloc(struct wiphy *wiphy, struct wireless_dev *wdev,
63026c09e791SAhmad Kholaif 			     int approxlen, int event_idx, gfp_t gfp)
6303567ffc35SJohannes Berg {
63046c09e791SAhmad Kholaif 	return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR,
6305567ffc35SJohannes Berg 					  NL80211_ATTR_VENDOR_DATA,
630655c1fdf0SJohannes Berg 					  0, event_idx, approxlen, gfp);
630755c1fdf0SJohannes Berg }
630855c1fdf0SJohannes Berg 
630955c1fdf0SJohannes Berg /**
631055c1fdf0SJohannes Berg  * cfg80211_vendor_event_alloc_ucast - alloc unicast vendor-specific event skb
631155c1fdf0SJohannes Berg  * @wiphy: the wiphy
631255c1fdf0SJohannes Berg  * @wdev: the wireless device
631355c1fdf0SJohannes Berg  * @event_idx: index of the vendor event in the wiphy's vendor_events
631455c1fdf0SJohannes Berg  * @portid: port ID of the receiver
631555c1fdf0SJohannes Berg  * @approxlen: an upper bound of the length of the data that will
631655c1fdf0SJohannes Berg  *	be put into the skb
631755c1fdf0SJohannes Berg  * @gfp: allocation flags
631855c1fdf0SJohannes Berg  *
631955c1fdf0SJohannes Berg  * This function allocates and pre-fills an skb for an event to send to
632055c1fdf0SJohannes Berg  * a specific (userland) socket. This socket would previously have been
632155c1fdf0SJohannes Berg  * obtained by cfg80211_vendor_cmd_get_sender(), and the caller MUST take
632255c1fdf0SJohannes Berg  * care to register a netlink notifier to see when the socket closes.
632355c1fdf0SJohannes Berg  *
632455c1fdf0SJohannes Berg  * If wdev != NULL, both the ifindex and identifier of the specified
632555c1fdf0SJohannes Berg  * wireless device are added to the event message before the vendor data
632655c1fdf0SJohannes Berg  * attribute.
632755c1fdf0SJohannes Berg  *
632855c1fdf0SJohannes Berg  * When done filling the skb, call cfg80211_vendor_event() with the
632955c1fdf0SJohannes Berg  * skb to send the event.
633055c1fdf0SJohannes Berg  *
633155c1fdf0SJohannes Berg  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
633255c1fdf0SJohannes Berg  */
633355c1fdf0SJohannes Berg static inline struct sk_buff *
633455c1fdf0SJohannes Berg cfg80211_vendor_event_alloc_ucast(struct wiphy *wiphy,
633555c1fdf0SJohannes Berg 				  struct wireless_dev *wdev,
633655c1fdf0SJohannes Berg 				  unsigned int portid, int approxlen,
633755c1fdf0SJohannes Berg 				  int event_idx, gfp_t gfp)
633855c1fdf0SJohannes Berg {
633955c1fdf0SJohannes Berg 	return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR,
634055c1fdf0SJohannes Berg 					  NL80211_ATTR_VENDOR_DATA,
634155c1fdf0SJohannes Berg 					  portid, event_idx, approxlen, gfp);
6342567ffc35SJohannes Berg }
6343567ffc35SJohannes Berg 
6344567ffc35SJohannes Berg /**
6345567ffc35SJohannes Berg  * cfg80211_vendor_event - send the event
6346567ffc35SJohannes Berg  * @skb: The skb, must have been allocated with cfg80211_vendor_event_alloc()
6347567ffc35SJohannes Berg  * @gfp: allocation flags
6348567ffc35SJohannes Berg  *
6349567ffc35SJohannes Berg  * This function sends the given @skb, which must have been allocated
6350567ffc35SJohannes Berg  * by cfg80211_vendor_event_alloc(), as an event. It always consumes it.
6351567ffc35SJohannes Berg  */
6352567ffc35SJohannes Berg static inline void cfg80211_vendor_event(struct sk_buff *skb, gfp_t gfp)
6353567ffc35SJohannes Berg {
6354567ffc35SJohannes Berg 	__cfg80211_send_event_skb(skb, gfp);
6355567ffc35SJohannes Berg }
6356567ffc35SJohannes Berg 
6357aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE
6358aff89a9bSJohannes Berg /**
6359d70e9693SJohannes Berg  * DOC: Test mode
6360d70e9693SJohannes Berg  *
6361d70e9693SJohannes Berg  * Test mode is a set of utility functions to allow drivers to
6362d70e9693SJohannes Berg  * interact with driver-specific tools to aid, for instance,
6363d70e9693SJohannes Berg  * factory programming.
6364d70e9693SJohannes Berg  *
6365d70e9693SJohannes Berg  * This chapter describes how drivers interact with it, for more
6366d70e9693SJohannes Berg  * information see the nl80211 book's chapter on it.
6367d70e9693SJohannes Berg  */
6368d70e9693SJohannes Berg 
6369d70e9693SJohannes Berg /**
6370aff89a9bSJohannes Berg  * cfg80211_testmode_alloc_reply_skb - allocate testmode reply
6371aff89a9bSJohannes Berg  * @wiphy: the wiphy
6372aff89a9bSJohannes Berg  * @approxlen: an upper bound of the length of the data that will
6373aff89a9bSJohannes Berg  *	be put into the skb
6374aff89a9bSJohannes Berg  *
6375aff89a9bSJohannes Berg  * This function allocates and pre-fills an skb for a reply to
6376aff89a9bSJohannes Berg  * the testmode command. Since it is intended for a reply, calling
6377aff89a9bSJohannes Berg  * it outside of the @testmode_cmd operation is invalid.
6378aff89a9bSJohannes Berg  *
63790ae997dcSYacine Belkadi  * The returned skb is pre-filled with the wiphy index and set up in
63800ae997dcSYacine Belkadi  * a way that any data that is put into the skb (with skb_put(),
63810ae997dcSYacine Belkadi  * nla_put() or similar) will end up being within the
63820ae997dcSYacine Belkadi  * %NL80211_ATTR_TESTDATA attribute, so all that needs to be done
63830ae997dcSYacine Belkadi  * with the skb is adding data for the corresponding userspace tool
63840ae997dcSYacine Belkadi  * which can then read that data out of the testdata attribute. You
63850ae997dcSYacine Belkadi  * must not modify the skb in any other way.
6386aff89a9bSJohannes Berg  *
6387aff89a9bSJohannes Berg  * When done, call cfg80211_testmode_reply() with the skb and return
6388aff89a9bSJohannes Berg  * its error code as the result of the @testmode_cmd operation.
63890ae997dcSYacine Belkadi  *
63900ae997dcSYacine Belkadi  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
6391aff89a9bSJohannes Berg  */
6392ad7e718cSJohannes Berg static inline struct sk_buff *
6393ad7e718cSJohannes Berg cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy, int approxlen)
6394ad7e718cSJohannes Berg {
6395ad7e718cSJohannes Berg 	return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_TESTMODE,
6396ad7e718cSJohannes Berg 					  NL80211_ATTR_TESTDATA, approxlen);
6397ad7e718cSJohannes Berg }
6398aff89a9bSJohannes Berg 
6399aff89a9bSJohannes Berg /**
6400aff89a9bSJohannes Berg  * cfg80211_testmode_reply - send the reply skb
6401aff89a9bSJohannes Berg  * @skb: The skb, must have been allocated with
6402aff89a9bSJohannes Berg  *	cfg80211_testmode_alloc_reply_skb()
6403aff89a9bSJohannes Berg  *
64040ae997dcSYacine Belkadi  * Since calling this function will usually be the last thing
64050ae997dcSYacine Belkadi  * before returning from the @testmode_cmd you should return
64060ae997dcSYacine Belkadi  * the error code.  Note that this function consumes the skb
64070ae997dcSYacine Belkadi  * regardless of the return value.
64080ae997dcSYacine Belkadi  *
64090ae997dcSYacine Belkadi  * Return: An error code or 0 on success.
6410aff89a9bSJohannes Berg  */
6411ad7e718cSJohannes Berg static inline int cfg80211_testmode_reply(struct sk_buff *skb)
6412ad7e718cSJohannes Berg {
6413ad7e718cSJohannes Berg 	return cfg80211_vendor_cmd_reply(skb);
6414ad7e718cSJohannes Berg }
6415aff89a9bSJohannes Berg 
6416aff89a9bSJohannes Berg /**
6417aff89a9bSJohannes Berg  * cfg80211_testmode_alloc_event_skb - allocate testmode event
6418aff89a9bSJohannes Berg  * @wiphy: the wiphy
6419aff89a9bSJohannes Berg  * @approxlen: an upper bound of the length of the data that will
6420aff89a9bSJohannes Berg  *	be put into the skb
6421aff89a9bSJohannes Berg  * @gfp: allocation flags
6422aff89a9bSJohannes Berg  *
6423aff89a9bSJohannes Berg  * This function allocates and pre-fills an skb for an event on the
6424aff89a9bSJohannes Berg  * testmode multicast group.
6425aff89a9bSJohannes Berg  *
64260ae997dcSYacine Belkadi  * The returned skb is set up in the same way as with
64270ae997dcSYacine Belkadi  * cfg80211_testmode_alloc_reply_skb() but prepared for an event. As
64280ae997dcSYacine Belkadi  * there, you should simply add data to it that will then end up in the
64290ae997dcSYacine Belkadi  * %NL80211_ATTR_TESTDATA attribute. Again, you must not modify the skb
64300ae997dcSYacine Belkadi  * in any other way.
6431aff89a9bSJohannes Berg  *
6432aff89a9bSJohannes Berg  * When done filling the skb, call cfg80211_testmode_event() with the
6433aff89a9bSJohannes Berg  * skb to send the event.
64340ae997dcSYacine Belkadi  *
64350ae997dcSYacine Belkadi  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
6436aff89a9bSJohannes Berg  */
6437567ffc35SJohannes Berg static inline struct sk_buff *
6438567ffc35SJohannes Berg cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy, int approxlen, gfp_t gfp)
6439567ffc35SJohannes Berg {
64406c09e791SAhmad Kholaif 	return __cfg80211_alloc_event_skb(wiphy, NULL, NL80211_CMD_TESTMODE,
644155c1fdf0SJohannes Berg 					  NL80211_ATTR_TESTDATA, 0, -1,
6442567ffc35SJohannes Berg 					  approxlen, gfp);
6443567ffc35SJohannes Berg }
6444aff89a9bSJohannes Berg 
6445aff89a9bSJohannes Berg /**
6446aff89a9bSJohannes Berg  * cfg80211_testmode_event - send the event
6447aff89a9bSJohannes Berg  * @skb: The skb, must have been allocated with
6448aff89a9bSJohannes Berg  *	cfg80211_testmode_alloc_event_skb()
6449aff89a9bSJohannes Berg  * @gfp: allocation flags
6450aff89a9bSJohannes Berg  *
6451aff89a9bSJohannes Berg  * This function sends the given @skb, which must have been allocated
6452aff89a9bSJohannes Berg  * by cfg80211_testmode_alloc_event_skb(), as an event. It always
6453aff89a9bSJohannes Berg  * consumes it.
6454aff89a9bSJohannes Berg  */
6455567ffc35SJohannes Berg static inline void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp)
6456567ffc35SJohannes Berg {
6457567ffc35SJohannes Berg 	__cfg80211_send_event_skb(skb, gfp);
6458567ffc35SJohannes Berg }
6459aff89a9bSJohannes Berg 
6460aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd)	.testmode_cmd = (cmd),
646171063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd)	.testmode_dump = (cmd),
6462aff89a9bSJohannes Berg #else
6463aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd)
646471063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd)
6465aff89a9bSJohannes Berg #endif
6466aff89a9bSJohannes Berg 
6467b23aa676SSamuel Ortiz /**
646876804d28SArend Van Spriel  * struct cfg80211_fils_resp_params - FILS connection response params
646976804d28SArend Van Spriel  * @kek: KEK derived from a successful FILS connection (may be %NULL)
647076804d28SArend Van Spriel  * @kek_len: Length of @fils_kek in octets
647176804d28SArend Van Spriel  * @update_erp_next_seq_num: Boolean value to specify whether the value in
647276804d28SArend Van Spriel  *	@erp_next_seq_num is valid.
647376804d28SArend Van Spriel  * @erp_next_seq_num: The next sequence number to use in ERP message in
647476804d28SArend Van Spriel  *	FILS Authentication. This value should be specified irrespective of the
647576804d28SArend Van Spriel  *	status for a FILS connection.
647676804d28SArend Van Spriel  * @pmk: A new PMK if derived from a successful FILS connection (may be %NULL).
647776804d28SArend Van Spriel  * @pmk_len: Length of @pmk in octets
647876804d28SArend Van Spriel  * @pmkid: A new PMKID if derived from a successful FILS connection or the PMKID
647976804d28SArend Van Spriel  *	used for this FILS connection (may be %NULL).
648076804d28SArend Van Spriel  */
648176804d28SArend Van Spriel struct cfg80211_fils_resp_params {
648276804d28SArend Van Spriel 	const u8 *kek;
648376804d28SArend Van Spriel 	size_t kek_len;
648476804d28SArend Van Spriel 	bool update_erp_next_seq_num;
648576804d28SArend Van Spriel 	u16 erp_next_seq_num;
648676804d28SArend Van Spriel 	const u8 *pmk;
648776804d28SArend Van Spriel 	size_t pmk_len;
648876804d28SArend Van Spriel 	const u8 *pmkid;
648976804d28SArend Van Spriel };
649076804d28SArend Van Spriel 
649176804d28SArend Van Spriel /**
64925349a0f7SVidyullatha Kanchanapally  * struct cfg80211_connect_resp_params - Connection response params
64935349a0f7SVidyullatha Kanchanapally  * @status: Status code, %WLAN_STATUS_SUCCESS for successful connection, use
64945349a0f7SVidyullatha Kanchanapally  *	%WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
64955349a0f7SVidyullatha Kanchanapally  *	the real status code for failures. If this call is used to report a
64965349a0f7SVidyullatha Kanchanapally  *	failure due to a timeout (e.g., not receiving an Authentication frame
64975349a0f7SVidyullatha Kanchanapally  *	from the AP) instead of an explicit rejection by the AP, -1 is used to
64985349a0f7SVidyullatha Kanchanapally  *	indicate that this is a failure, but without a status code.
64995349a0f7SVidyullatha Kanchanapally  *	@timeout_reason is used to report the reason for the timeout in that
65005349a0f7SVidyullatha Kanchanapally  *	case.
65015349a0f7SVidyullatha Kanchanapally  * @bssid: The BSSID of the AP (may be %NULL)
65025349a0f7SVidyullatha Kanchanapally  * @bss: Entry of bss to which STA got connected to, can be obtained through
6503a3ce17d1SChaitanya Tata  *	cfg80211_get_bss() (may be %NULL). But it is recommended to store the
6504a3ce17d1SChaitanya Tata  *	bss from the connect_request and hold a reference to it and return
6505a3ce17d1SChaitanya Tata  *	through this param to avoid a warning if the bss is expired during the
6506a3ce17d1SChaitanya Tata  *	connection, esp. for those drivers implementing connect op.
6507a3ce17d1SChaitanya Tata  *	Only one parameter among @bssid and @bss needs to be specified.
65085349a0f7SVidyullatha Kanchanapally  * @req_ie: Association request IEs (may be %NULL)
65095349a0f7SVidyullatha Kanchanapally  * @req_ie_len: Association request IEs length
65105349a0f7SVidyullatha Kanchanapally  * @resp_ie: Association response IEs (may be %NULL)
65115349a0f7SVidyullatha Kanchanapally  * @resp_ie_len: Association response IEs length
651276804d28SArend Van Spriel  * @fils: FILS connection response parameters.
65135349a0f7SVidyullatha Kanchanapally  * @timeout_reason: Reason for connection timeout. This is used when the
65145349a0f7SVidyullatha Kanchanapally  *	connection fails due to a timeout instead of an explicit rejection from
65155349a0f7SVidyullatha Kanchanapally  *	the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is
65165349a0f7SVidyullatha Kanchanapally  *	not known. This value is used only if @status < 0 to indicate that the
65175349a0f7SVidyullatha Kanchanapally  *	failure is due to a timeout and not due to explicit rejection by the AP.
65185349a0f7SVidyullatha Kanchanapally  *	This value is ignored in other cases (@status >= 0).
65195349a0f7SVidyullatha Kanchanapally  */
65205349a0f7SVidyullatha Kanchanapally struct cfg80211_connect_resp_params {
65215349a0f7SVidyullatha Kanchanapally 	int status;
65225349a0f7SVidyullatha Kanchanapally 	const u8 *bssid;
65235349a0f7SVidyullatha Kanchanapally 	struct cfg80211_bss *bss;
65245349a0f7SVidyullatha Kanchanapally 	const u8 *req_ie;
65255349a0f7SVidyullatha Kanchanapally 	size_t req_ie_len;
65265349a0f7SVidyullatha Kanchanapally 	const u8 *resp_ie;
65275349a0f7SVidyullatha Kanchanapally 	size_t resp_ie_len;
652876804d28SArend Van Spriel 	struct cfg80211_fils_resp_params fils;
65295349a0f7SVidyullatha Kanchanapally 	enum nl80211_timeout_reason timeout_reason;
65305349a0f7SVidyullatha Kanchanapally };
65315349a0f7SVidyullatha Kanchanapally 
65325349a0f7SVidyullatha Kanchanapally /**
65335349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_done - notify cfg80211 of connection result
65345349a0f7SVidyullatha Kanchanapally  *
65355349a0f7SVidyullatha Kanchanapally  * @dev: network device
65365349a0f7SVidyullatha Kanchanapally  * @params: connection response parameters
65375349a0f7SVidyullatha Kanchanapally  * @gfp: allocation flags
65385349a0f7SVidyullatha Kanchanapally  *
65395349a0f7SVidyullatha Kanchanapally  * It should be called by the underlying driver once execution of the connection
65405349a0f7SVidyullatha Kanchanapally  * request from connect() has been completed. This is similar to
65415349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_bss(), but takes a structure pointer for connection response
65425349a0f7SVidyullatha Kanchanapally  * parameters. Only one of the functions among cfg80211_connect_bss(),
65435349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_result(), cfg80211_connect_timeout(),
65445349a0f7SVidyullatha Kanchanapally  * and cfg80211_connect_done() should be called.
65455349a0f7SVidyullatha Kanchanapally  */
65465349a0f7SVidyullatha Kanchanapally void cfg80211_connect_done(struct net_device *dev,
65475349a0f7SVidyullatha Kanchanapally 			   struct cfg80211_connect_resp_params *params,
65485349a0f7SVidyullatha Kanchanapally 			   gfp_t gfp);
65495349a0f7SVidyullatha Kanchanapally 
65505349a0f7SVidyullatha Kanchanapally /**
6551e7054989SKanchanapally, Vidyullatha  * cfg80211_connect_bss - notify cfg80211 of connection result
6552e7054989SKanchanapally, Vidyullatha  *
6553e7054989SKanchanapally, Vidyullatha  * @dev: network device
6554e7054989SKanchanapally, Vidyullatha  * @bssid: the BSSID of the AP
6555a3ce17d1SChaitanya Tata  * @bss: Entry of bss to which STA got connected to, can be obtained through
6556a3ce17d1SChaitanya Tata  *	cfg80211_get_bss() (may be %NULL). But it is recommended to store the
6557a3ce17d1SChaitanya Tata  *	bss from the connect_request and hold a reference to it and return
6558a3ce17d1SChaitanya Tata  *	through this param to avoid a warning if the bss is expired during the
6559a3ce17d1SChaitanya Tata  *	connection, esp. for those drivers implementing connect op.
6560a3ce17d1SChaitanya Tata  *	Only one parameter among @bssid and @bss needs to be specified.
6561e7054989SKanchanapally, Vidyullatha  * @req_ie: association request IEs (maybe be %NULL)
6562e7054989SKanchanapally, Vidyullatha  * @req_ie_len: association request IEs length
6563e7054989SKanchanapally, Vidyullatha  * @resp_ie: association response IEs (may be %NULL)
6564e7054989SKanchanapally, Vidyullatha  * @resp_ie_len: assoc response IEs length
6565c88215d7SJouni Malinen  * @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use
6566e7054989SKanchanapally, Vidyullatha  *	%WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
6567c88215d7SJouni Malinen  *	the real status code for failures. If this call is used to report a
6568c88215d7SJouni Malinen  *	failure due to a timeout (e.g., not receiving an Authentication frame
6569c88215d7SJouni Malinen  *	from the AP) instead of an explicit rejection by the AP, -1 is used to
6570c88215d7SJouni Malinen  *	indicate that this is a failure, but without a status code.
6571c88215d7SJouni Malinen  *	@timeout_reason is used to report the reason for the timeout in that
6572c88215d7SJouni Malinen  *	case.
6573e7054989SKanchanapally, Vidyullatha  * @gfp: allocation flags
65743093ebbeSPurushottam Kushwaha  * @timeout_reason: reason for connection timeout. This is used when the
65753093ebbeSPurushottam Kushwaha  *	connection fails due to a timeout instead of an explicit rejection from
65763093ebbeSPurushottam Kushwaha  *	the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is
65773093ebbeSPurushottam Kushwaha  *	not known. This value is used only if @status < 0 to indicate that the
65783093ebbeSPurushottam Kushwaha  *	failure is due to a timeout and not due to explicit rejection by the AP.
65793093ebbeSPurushottam Kushwaha  *	This value is ignored in other cases (@status >= 0).
6580e7054989SKanchanapally, Vidyullatha  *
6581c88215d7SJouni Malinen  * It should be called by the underlying driver once execution of the connection
6582c88215d7SJouni Malinen  * request from connect() has been completed. This is similar to
6583c88215d7SJouni Malinen  * cfg80211_connect_result(), but with the option of identifying the exact bss
65845349a0f7SVidyullatha Kanchanapally  * entry for the connection. Only one of the functions among
65855349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_bss(), cfg80211_connect_result(),
65865349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
6587e7054989SKanchanapally, Vidyullatha  */
65885349a0f7SVidyullatha Kanchanapally static inline void
65895349a0f7SVidyullatha Kanchanapally cfg80211_connect_bss(struct net_device *dev, const u8 *bssid,
6590e7054989SKanchanapally, Vidyullatha 		     struct cfg80211_bss *bss, const u8 *req_ie,
6591e7054989SKanchanapally, Vidyullatha 		     size_t req_ie_len, const u8 *resp_ie,
65923093ebbeSPurushottam Kushwaha 		     size_t resp_ie_len, int status, gfp_t gfp,
65935349a0f7SVidyullatha Kanchanapally 		     enum nl80211_timeout_reason timeout_reason)
65945349a0f7SVidyullatha Kanchanapally {
65955349a0f7SVidyullatha Kanchanapally 	struct cfg80211_connect_resp_params params;
65965349a0f7SVidyullatha Kanchanapally 
65975349a0f7SVidyullatha Kanchanapally 	memset(&params, 0, sizeof(params));
65985349a0f7SVidyullatha Kanchanapally 	params.status = status;
65995349a0f7SVidyullatha Kanchanapally 	params.bssid = bssid;
66005349a0f7SVidyullatha Kanchanapally 	params.bss = bss;
66015349a0f7SVidyullatha Kanchanapally 	params.req_ie = req_ie;
66025349a0f7SVidyullatha Kanchanapally 	params.req_ie_len = req_ie_len;
66035349a0f7SVidyullatha Kanchanapally 	params.resp_ie = resp_ie;
66045349a0f7SVidyullatha Kanchanapally 	params.resp_ie_len = resp_ie_len;
66055349a0f7SVidyullatha Kanchanapally 	params.timeout_reason = timeout_reason;
66065349a0f7SVidyullatha Kanchanapally 
66075349a0f7SVidyullatha Kanchanapally 	cfg80211_connect_done(dev, &params, gfp);
66085349a0f7SVidyullatha Kanchanapally }
6609e7054989SKanchanapally, Vidyullatha 
6610e7054989SKanchanapally, Vidyullatha /**
6611b23aa676SSamuel Ortiz  * cfg80211_connect_result - notify cfg80211 of connection result
6612b23aa676SSamuel Ortiz  *
6613b23aa676SSamuel Ortiz  * @dev: network device
6614b23aa676SSamuel Ortiz  * @bssid: the BSSID of the AP
6615b23aa676SSamuel Ortiz  * @req_ie: association request IEs (maybe be %NULL)
6616b23aa676SSamuel Ortiz  * @req_ie_len: association request IEs length
6617b23aa676SSamuel Ortiz  * @resp_ie: association response IEs (may be %NULL)
6618b23aa676SSamuel Ortiz  * @resp_ie_len: assoc response IEs length
6619c88215d7SJouni Malinen  * @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use
6620b23aa676SSamuel Ortiz  *	%WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
6621b23aa676SSamuel Ortiz  *	the real status code for failures.
6622b23aa676SSamuel Ortiz  * @gfp: allocation flags
6623b23aa676SSamuel Ortiz  *
6624c88215d7SJouni Malinen  * It should be called by the underlying driver once execution of the connection
6625c88215d7SJouni Malinen  * request from connect() has been completed. This is similar to
6626c88215d7SJouni Malinen  * cfg80211_connect_bss() which allows the exact bss entry to be specified. Only
66275349a0f7SVidyullatha Kanchanapally  * one of the functions among cfg80211_connect_bss(), cfg80211_connect_result(),
66285349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
6629b23aa676SSamuel Ortiz  */
6630e7054989SKanchanapally, Vidyullatha static inline void
6631e7054989SKanchanapally, Vidyullatha cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
6632b23aa676SSamuel Ortiz 			const u8 *req_ie, size_t req_ie_len,
6633b23aa676SSamuel Ortiz 			const u8 *resp_ie, size_t resp_ie_len,
6634e7054989SKanchanapally, Vidyullatha 			u16 status, gfp_t gfp)
6635e7054989SKanchanapally, Vidyullatha {
6636e7054989SKanchanapally, Vidyullatha 	cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, resp_ie,
66373093ebbeSPurushottam Kushwaha 			     resp_ie_len, status, gfp,
66383093ebbeSPurushottam Kushwaha 			     NL80211_TIMEOUT_UNSPECIFIED);
6639e7054989SKanchanapally, Vidyullatha }
6640b23aa676SSamuel Ortiz 
6641b23aa676SSamuel Ortiz /**
6642bf1ecd21SJouni Malinen  * cfg80211_connect_timeout - notify cfg80211 of connection timeout
6643bf1ecd21SJouni Malinen  *
6644bf1ecd21SJouni Malinen  * @dev: network device
6645bf1ecd21SJouni Malinen  * @bssid: the BSSID of the AP
6646bf1ecd21SJouni Malinen  * @req_ie: association request IEs (maybe be %NULL)
6647bf1ecd21SJouni Malinen  * @req_ie_len: association request IEs length
6648bf1ecd21SJouni Malinen  * @gfp: allocation flags
66493093ebbeSPurushottam Kushwaha  * @timeout_reason: reason for connection timeout.
6650bf1ecd21SJouni Malinen  *
6651bf1ecd21SJouni Malinen  * It should be called by the underlying driver whenever connect() has failed
6652bf1ecd21SJouni Malinen  * in a sequence where no explicit authentication/association rejection was
6653bf1ecd21SJouni Malinen  * received from the AP. This could happen, e.g., due to not being able to send
6654bf1ecd21SJouni Malinen  * out the Authentication or Association Request frame or timing out while
66555349a0f7SVidyullatha Kanchanapally  * waiting for the response. Only one of the functions among
66565349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_bss(), cfg80211_connect_result(),
66575349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
6658bf1ecd21SJouni Malinen  */
6659bf1ecd21SJouni Malinen static inline void
6660bf1ecd21SJouni Malinen cfg80211_connect_timeout(struct net_device *dev, const u8 *bssid,
66613093ebbeSPurushottam Kushwaha 			 const u8 *req_ie, size_t req_ie_len, gfp_t gfp,
66623093ebbeSPurushottam Kushwaha 			 enum nl80211_timeout_reason timeout_reason)
6663bf1ecd21SJouni Malinen {
6664bf1ecd21SJouni Malinen 	cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, NULL, 0, -1,
66653093ebbeSPurushottam Kushwaha 			     gfp, timeout_reason);
6666bf1ecd21SJouni Malinen }
6667bf1ecd21SJouni Malinen 
6668bf1ecd21SJouni Malinen /**
666929ce6ecbSAvraham Stern  * struct cfg80211_roam_info - driver initiated roaming information
667029ce6ecbSAvraham Stern  *
667129ce6ecbSAvraham Stern  * @channel: the channel of the new AP
667229ce6ecbSAvraham Stern  * @bss: entry of bss to which STA got roamed (may be %NULL if %bssid is set)
667329ce6ecbSAvraham Stern  * @bssid: the BSSID of the new AP (may be %NULL if %bss is set)
667429ce6ecbSAvraham Stern  * @req_ie: association request IEs (maybe be %NULL)
667529ce6ecbSAvraham Stern  * @req_ie_len: association request IEs length
667629ce6ecbSAvraham Stern  * @resp_ie: association response IEs (may be %NULL)
667729ce6ecbSAvraham Stern  * @resp_ie_len: assoc response IEs length
6678e841b7b1SArend Van Spriel  * @fils: FILS related roaming information.
667929ce6ecbSAvraham Stern  */
668029ce6ecbSAvraham Stern struct cfg80211_roam_info {
668129ce6ecbSAvraham Stern 	struct ieee80211_channel *channel;
668229ce6ecbSAvraham Stern 	struct cfg80211_bss *bss;
668329ce6ecbSAvraham Stern 	const u8 *bssid;
668429ce6ecbSAvraham Stern 	const u8 *req_ie;
668529ce6ecbSAvraham Stern 	size_t req_ie_len;
668629ce6ecbSAvraham Stern 	const u8 *resp_ie;
668729ce6ecbSAvraham Stern 	size_t resp_ie_len;
6688e841b7b1SArend Van Spriel 	struct cfg80211_fils_resp_params fils;
668929ce6ecbSAvraham Stern };
669029ce6ecbSAvraham Stern 
669129ce6ecbSAvraham Stern /**
6692b23aa676SSamuel Ortiz  * cfg80211_roamed - notify cfg80211 of roaming
6693b23aa676SSamuel Ortiz  *
6694b23aa676SSamuel Ortiz  * @dev: network device
669529ce6ecbSAvraham Stern  * @info: information about the new BSS. struct &cfg80211_roam_info.
6696b23aa676SSamuel Ortiz  * @gfp: allocation flags
6697b23aa676SSamuel Ortiz  *
669829ce6ecbSAvraham Stern  * This function may be called with the driver passing either the BSSID of the
669929ce6ecbSAvraham Stern  * new AP or passing the bss entry to avoid a race in timeout of the bss entry.
670029ce6ecbSAvraham Stern  * It should be called by the underlying driver whenever it roamed from one AP
670129ce6ecbSAvraham Stern  * to another while connected. Drivers which have roaming implemented in
670229ce6ecbSAvraham Stern  * firmware should pass the bss entry to avoid a race in bss entry timeout where
670329ce6ecbSAvraham Stern  * the bss entry of the new AP is seen in the driver, but gets timed out by the
670429ce6ecbSAvraham Stern  * time it is accessed in __cfg80211_roamed() due to delay in scheduling
6705adbde344SVasanthakumar Thiagarajan  * rdev->event_work. In case of any failures, the reference is released
670629ce6ecbSAvraham Stern  * either in cfg80211_roamed() or in __cfg80211_romed(), Otherwise, it will be
6707e1b18549SGeert Uytterhoeven  * released while disconnecting from the current bss.
6708adbde344SVasanthakumar Thiagarajan  */
670929ce6ecbSAvraham Stern void cfg80211_roamed(struct net_device *dev, struct cfg80211_roam_info *info,
671029ce6ecbSAvraham Stern 		     gfp_t gfp);
6711adbde344SVasanthakumar Thiagarajan 
6712adbde344SVasanthakumar Thiagarajan /**
6713503c1fb9SAvraham Stern  * cfg80211_port_authorized - notify cfg80211 of successful security association
6714503c1fb9SAvraham Stern  *
6715503c1fb9SAvraham Stern  * @dev: network device
6716503c1fb9SAvraham Stern  * @bssid: the BSSID of the AP
6717503c1fb9SAvraham Stern  * @gfp: allocation flags
6718503c1fb9SAvraham Stern  *
6719503c1fb9SAvraham Stern  * This function should be called by a driver that supports 4 way handshake
6720503c1fb9SAvraham Stern  * offload after a security association was successfully established (i.e.,
6721503c1fb9SAvraham Stern  * the 4 way handshake was completed successfully). The call to this function
6722503c1fb9SAvraham Stern  * should be preceded with a call to cfg80211_connect_result(),
6723503c1fb9SAvraham Stern  * cfg80211_connect_done(), cfg80211_connect_bss() or cfg80211_roamed() to
6724503c1fb9SAvraham Stern  * indicate the 802.11 association.
6725503c1fb9SAvraham Stern  */
6726503c1fb9SAvraham Stern void cfg80211_port_authorized(struct net_device *dev, const u8 *bssid,
6727503c1fb9SAvraham Stern 			      gfp_t gfp);
6728503c1fb9SAvraham Stern 
6729503c1fb9SAvraham Stern /**
6730b23aa676SSamuel Ortiz  * cfg80211_disconnected - notify cfg80211 that connection was dropped
6731b23aa676SSamuel Ortiz  *
6732b23aa676SSamuel Ortiz  * @dev: network device
6733b23aa676SSamuel Ortiz  * @ie: information elements of the deauth/disassoc frame (may be %NULL)
6734b23aa676SSamuel Ortiz  * @ie_len: length of IEs
6735b23aa676SSamuel Ortiz  * @reason: reason code for the disconnection, set it to 0 if unknown
673680279fb7SJohannes Berg  * @locally_generated: disconnection was requested locally
6737b23aa676SSamuel Ortiz  * @gfp: allocation flags
6738b23aa676SSamuel Ortiz  *
6739b23aa676SSamuel Ortiz  * After it calls this function, the driver should enter an idle state
6740b23aa676SSamuel Ortiz  * and not try to connect to any AP any more.
6741b23aa676SSamuel Ortiz  */
6742b23aa676SSamuel Ortiz void cfg80211_disconnected(struct net_device *dev, u16 reason,
674380279fb7SJohannes Berg 			   const u8 *ie, size_t ie_len,
674480279fb7SJohannes Berg 			   bool locally_generated, gfp_t gfp);
6745b23aa676SSamuel Ortiz 
67469588bbd5SJouni Malinen /**
67479588bbd5SJouni Malinen  * cfg80211_ready_on_channel - notification of remain_on_channel start
674871bbc994SJohannes Berg  * @wdev: wireless device
67499588bbd5SJouni Malinen  * @cookie: the request cookie
67509588bbd5SJouni Malinen  * @chan: The current channel (from remain_on_channel request)
67519588bbd5SJouni Malinen  * @duration: Duration in milliseconds that the driver intents to remain on the
67529588bbd5SJouni Malinen  *	channel
67539588bbd5SJouni Malinen  * @gfp: allocation flags
67549588bbd5SJouni Malinen  */
675571bbc994SJohannes Berg void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie,
67569588bbd5SJouni Malinen 			       struct ieee80211_channel *chan,
67579588bbd5SJouni Malinen 			       unsigned int duration, gfp_t gfp);
67589588bbd5SJouni Malinen 
67599588bbd5SJouni Malinen /**
67609588bbd5SJouni Malinen  * cfg80211_remain_on_channel_expired - remain_on_channel duration expired
676171bbc994SJohannes Berg  * @wdev: wireless device
67629588bbd5SJouni Malinen  * @cookie: the request cookie
67639588bbd5SJouni Malinen  * @chan: The current channel (from remain_on_channel request)
67649588bbd5SJouni Malinen  * @gfp: allocation flags
67659588bbd5SJouni Malinen  */
676671bbc994SJohannes Berg void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie,
67679588bbd5SJouni Malinen 					struct ieee80211_channel *chan,
67689588bbd5SJouni Malinen 					gfp_t gfp);
6769b23aa676SSamuel Ortiz 
67708689c051SArend van Spriel /**
67711c38c7f2SJames Prestwood  * cfg80211_tx_mgmt_expired - tx_mgmt duration expired
67721c38c7f2SJames Prestwood  * @wdev: wireless device
67731c38c7f2SJames Prestwood  * @cookie: the requested cookie
67741c38c7f2SJames Prestwood  * @chan: The current channel (from tx_mgmt request)
67751c38c7f2SJames Prestwood  * @gfp: allocation flags
67761c38c7f2SJames Prestwood  */
67771c38c7f2SJames Prestwood void cfg80211_tx_mgmt_expired(struct wireless_dev *wdev, u64 cookie,
67781c38c7f2SJames Prestwood 			      struct ieee80211_channel *chan, gfp_t gfp);
67791c38c7f2SJames Prestwood 
67801c38c7f2SJames Prestwood /**
67818689c051SArend van Spriel  * cfg80211_sinfo_alloc_tid_stats - allocate per-tid statistics.
67828689c051SArend van Spriel  *
67838689c051SArend van Spriel  * @sinfo: the station information
67848689c051SArend van Spriel  * @gfp: allocation flags
67858689c051SArend van Spriel  */
67868689c051SArend van Spriel int cfg80211_sinfo_alloc_tid_stats(struct station_info *sinfo, gfp_t gfp);
678798b62183SJohannes Berg 
678898b62183SJohannes Berg /**
67897ea3e110SJohannes Berg  * cfg80211_sinfo_release_content - release contents of station info
67907ea3e110SJohannes Berg  * @sinfo: the station information
67917ea3e110SJohannes Berg  *
67927ea3e110SJohannes Berg  * Releases any potentially allocated sub-information of the station
67937ea3e110SJohannes Berg  * information, but not the struct itself (since it's typically on
67947ea3e110SJohannes Berg  * the stack.)
67957ea3e110SJohannes Berg  */
67967ea3e110SJohannes Berg static inline void cfg80211_sinfo_release_content(struct station_info *sinfo)
67977ea3e110SJohannes Berg {
67987ea3e110SJohannes Berg 	kfree(sinfo->pertid);
67997ea3e110SJohannes Berg }
68007ea3e110SJohannes Berg 
68017ea3e110SJohannes Berg /**
680298b62183SJohannes Berg  * cfg80211_new_sta - notify userspace about station
680398b62183SJohannes Berg  *
680498b62183SJohannes Berg  * @dev: the netdev
680598b62183SJohannes Berg  * @mac_addr: the station's address
680698b62183SJohannes Berg  * @sinfo: the station information
680798b62183SJohannes Berg  * @gfp: allocation flags
680898b62183SJohannes Berg  */
680998b62183SJohannes Berg void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr,
681098b62183SJohannes Berg 		      struct station_info *sinfo, gfp_t gfp);
681198b62183SJohannes Berg 
6812026331c4SJouni Malinen /**
6813cf5ead82SJohannes Berg  * cfg80211_del_sta_sinfo - notify userspace about deletion of a station
6814cf5ead82SJohannes Berg  * @dev: the netdev
6815cf5ead82SJohannes Berg  * @mac_addr: the station's address
6816cf5ead82SJohannes Berg  * @sinfo: the station information/statistics
6817cf5ead82SJohannes Berg  * @gfp: allocation flags
6818cf5ead82SJohannes Berg  */
6819cf5ead82SJohannes Berg void cfg80211_del_sta_sinfo(struct net_device *dev, const u8 *mac_addr,
6820cf5ead82SJohannes Berg 			    struct station_info *sinfo, gfp_t gfp);
6821cf5ead82SJohannes Berg 
6822cf5ead82SJohannes Berg /**
6823ec15e68bSJouni Malinen  * cfg80211_del_sta - notify userspace about deletion of a station
6824ec15e68bSJouni Malinen  *
6825ec15e68bSJouni Malinen  * @dev: the netdev
6826ec15e68bSJouni Malinen  * @mac_addr: the station's address
6827ec15e68bSJouni Malinen  * @gfp: allocation flags
6828ec15e68bSJouni Malinen  */
6829cf5ead82SJohannes Berg static inline void cfg80211_del_sta(struct net_device *dev,
6830cf5ead82SJohannes Berg 				    const u8 *mac_addr, gfp_t gfp)
6831cf5ead82SJohannes Berg {
6832cf5ead82SJohannes Berg 	cfg80211_del_sta_sinfo(dev, mac_addr, NULL, gfp);
6833cf5ead82SJohannes Berg }
6834ec15e68bSJouni Malinen 
6835ec15e68bSJouni Malinen /**
6836ed44a951SPandiyarajan Pitchaimuthu  * cfg80211_conn_failed - connection request failed notification
6837ed44a951SPandiyarajan Pitchaimuthu  *
6838ed44a951SPandiyarajan Pitchaimuthu  * @dev: the netdev
6839ed44a951SPandiyarajan Pitchaimuthu  * @mac_addr: the station's address
6840ed44a951SPandiyarajan Pitchaimuthu  * @reason: the reason for connection failure
6841ed44a951SPandiyarajan Pitchaimuthu  * @gfp: allocation flags
6842ed44a951SPandiyarajan Pitchaimuthu  *
6843ed44a951SPandiyarajan Pitchaimuthu  * Whenever a station tries to connect to an AP and if the station
6844ed44a951SPandiyarajan Pitchaimuthu  * could not connect to the AP as the AP has rejected the connection
6845ed44a951SPandiyarajan Pitchaimuthu  * for some reasons, this function is called.
6846ed44a951SPandiyarajan Pitchaimuthu  *
6847ed44a951SPandiyarajan Pitchaimuthu  * The reason for connection failure can be any of the value from
6848ed44a951SPandiyarajan Pitchaimuthu  * nl80211_connect_failed_reason enum
6849ed44a951SPandiyarajan Pitchaimuthu  */
6850ed44a951SPandiyarajan Pitchaimuthu void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr,
6851ed44a951SPandiyarajan Pitchaimuthu 			  enum nl80211_connect_failed_reason reason,
6852ed44a951SPandiyarajan Pitchaimuthu 			  gfp_t gfp);
6853ed44a951SPandiyarajan Pitchaimuthu 
6854ed44a951SPandiyarajan Pitchaimuthu /**
68552e161f78SJohannes Berg  * cfg80211_rx_mgmt - notification of received, unprocessed management frame
685671bbc994SJohannes Berg  * @wdev: wireless device receiving the frame
6857026331c4SJouni Malinen  * @freq: Frequency on which the frame was received in MHz
68586c2fb1e6SSergey Matyukevich  * @sig_dbm: signal strength in dBm, or 0 if unknown
68592e161f78SJohannes Berg  * @buf: Management frame (header + body)
6860026331c4SJouni Malinen  * @len: length of the frame data
686119504cf5SVladimir Kondratiev  * @flags: flags, as defined in enum nl80211_rxmgmt_flags
68622e161f78SJohannes Berg  *
68630ae997dcSYacine Belkadi  * This function is called whenever an Action frame is received for a station
68640ae997dcSYacine Belkadi  * mode interface, but is not processed in kernel.
68650ae997dcSYacine Belkadi  *
68660ae997dcSYacine Belkadi  * Return: %true if a user space application has registered for this frame.
68672e161f78SJohannes Berg  * For action frames, that makes it responsible for rejecting unrecognized
68682e161f78SJohannes Berg  * action frames; %false otherwise, in which case for action frames the
68692e161f78SJohannes Berg  * driver is responsible for rejecting the frame.
6870026331c4SJouni Malinen  */
687171bbc994SJohannes Berg bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int sig_dbm,
6872970fdfa8SVladimir Kondratiev 		      const u8 *buf, size_t len, u32 flags);
6873026331c4SJouni Malinen 
6874026331c4SJouni Malinen /**
68752e161f78SJohannes Berg  * cfg80211_mgmt_tx_status - notification of TX status for management frame
687671bbc994SJohannes Berg  * @wdev: wireless device receiving the frame
68772e161f78SJohannes Berg  * @cookie: Cookie returned by cfg80211_ops::mgmt_tx()
68782e161f78SJohannes Berg  * @buf: Management frame (header + body)
6879026331c4SJouni Malinen  * @len: length of the frame data
6880026331c4SJouni Malinen  * @ack: Whether frame was acknowledged
6881026331c4SJouni Malinen  * @gfp: context flags
6882026331c4SJouni Malinen  *
68832e161f78SJohannes Berg  * This function is called whenever a management frame was requested to be
68842e161f78SJohannes Berg  * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the
6885026331c4SJouni Malinen  * transmission attempt.
6886026331c4SJouni Malinen  */
688771bbc994SJohannes Berg void cfg80211_mgmt_tx_status(struct wireless_dev *wdev, u64 cookie,
6888026331c4SJouni Malinen 			     const u8 *buf, size_t len, bool ack, gfp_t gfp);
6889026331c4SJouni Malinen 
6890d6dc1a38SJuuso Oikarinen 
6891d6dc1a38SJuuso Oikarinen /**
68926a671a50SDenis Kenzior  * cfg80211_rx_control_port - notification about a received control port frame
68936a671a50SDenis Kenzior  * @dev: The device the frame matched to
6894a948f713SDenis Kenzior  * @skb: The skbuf with the control port frame.  It is assumed that the skbuf
6895a948f713SDenis Kenzior  *	is 802.3 formatted (with 802.3 header).  The skb can be non-linear.
6896a948f713SDenis Kenzior  *	This function does not take ownership of the skb, so the caller is
6897a948f713SDenis Kenzior  *	responsible for any cleanup.  The caller must also ensure that
6898a948f713SDenis Kenzior  *	skb->protocol is set appropriately.
68996a671a50SDenis Kenzior  * @unencrypted: Whether the frame was received unencrypted
69006a671a50SDenis Kenzior  *
69016a671a50SDenis Kenzior  * This function is used to inform userspace about a received control port
69026a671a50SDenis Kenzior  * frame.  It should only be used if userspace indicated it wants to receive
69036a671a50SDenis Kenzior  * control port frames over nl80211.
69046a671a50SDenis Kenzior  *
69056a671a50SDenis Kenzior  * The frame is the data portion of the 802.3 or 802.11 data frame with all
69066a671a50SDenis Kenzior  * network layer headers removed (e.g. the raw EAPoL frame).
69076a671a50SDenis Kenzior  *
69086a671a50SDenis Kenzior  * Return: %true if the frame was passed to userspace
69096a671a50SDenis Kenzior  */
69106a671a50SDenis Kenzior bool cfg80211_rx_control_port(struct net_device *dev,
6911a948f713SDenis Kenzior 			      struct sk_buff *skb, bool unencrypted);
69126a671a50SDenis Kenzior 
69136a671a50SDenis Kenzior /**
6914d6dc1a38SJuuso Oikarinen  * cfg80211_cqm_rssi_notify - connection quality monitoring rssi event
6915d6dc1a38SJuuso Oikarinen  * @dev: network device
6916d6dc1a38SJuuso Oikarinen  * @rssi_event: the triggered RSSI event
6917bee427b8SAndrzej Zaborowski  * @rssi_level: new RSSI level value or 0 if not available
6918d6dc1a38SJuuso Oikarinen  * @gfp: context flags
6919d6dc1a38SJuuso Oikarinen  *
6920d6dc1a38SJuuso Oikarinen  * This function is called when a configured connection quality monitoring
6921d6dc1a38SJuuso Oikarinen  * rssi threshold reached event occurs.
6922d6dc1a38SJuuso Oikarinen  */
6923d6dc1a38SJuuso Oikarinen void cfg80211_cqm_rssi_notify(struct net_device *dev,
6924d6dc1a38SJuuso Oikarinen 			      enum nl80211_cqm_rssi_threshold_event rssi_event,
6925bee427b8SAndrzej Zaborowski 			      s32 rssi_level, gfp_t gfp);
6926d6dc1a38SJuuso Oikarinen 
6927c063dbf5SJohannes Berg /**
6928c063dbf5SJohannes Berg  * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer
6929c063dbf5SJohannes Berg  * @dev: network device
6930c063dbf5SJohannes Berg  * @peer: peer's MAC address
6931c063dbf5SJohannes Berg  * @num_packets: how many packets were lost -- should be a fixed threshold
6932c063dbf5SJohannes Berg  *	but probably no less than maybe 50, or maybe a throughput dependent
6933c063dbf5SJohannes Berg  *	threshold (to account for temporary interference)
6934c063dbf5SJohannes Berg  * @gfp: context flags
6935c063dbf5SJohannes Berg  */
6936c063dbf5SJohannes Berg void cfg80211_cqm_pktloss_notify(struct net_device *dev,
6937c063dbf5SJohannes Berg 				 const u8 *peer, u32 num_packets, gfp_t gfp);
6938c063dbf5SJohannes Berg 
6939e5497d76SJohannes Berg /**
694084f10708SThomas Pedersen  * cfg80211_cqm_txe_notify - TX error rate event
694184f10708SThomas Pedersen  * @dev: network device
694284f10708SThomas Pedersen  * @peer: peer's MAC address
694384f10708SThomas Pedersen  * @num_packets: how many packets were lost
694484f10708SThomas Pedersen  * @rate: % of packets which failed transmission
694584f10708SThomas Pedersen  * @intvl: interval (in s) over which the TX failure threshold was breached.
694684f10708SThomas Pedersen  * @gfp: context flags
694784f10708SThomas Pedersen  *
694884f10708SThomas Pedersen  * Notify userspace when configured % TX failures over number of packets in a
694984f10708SThomas Pedersen  * given interval is exceeded.
695084f10708SThomas Pedersen  */
695184f10708SThomas Pedersen void cfg80211_cqm_txe_notify(struct net_device *dev, const u8 *peer,
695284f10708SThomas Pedersen 			     u32 num_packets, u32 rate, u32 intvl, gfp_t gfp);
695384f10708SThomas Pedersen 
695484f10708SThomas Pedersen /**
695598f03342SJohannes Berg  * cfg80211_cqm_beacon_loss_notify - beacon loss event
695698f03342SJohannes Berg  * @dev: network device
695798f03342SJohannes Berg  * @gfp: context flags
695898f03342SJohannes Berg  *
695998f03342SJohannes Berg  * Notify userspace about beacon loss from the connected AP.
696098f03342SJohannes Berg  */
696198f03342SJohannes Berg void cfg80211_cqm_beacon_loss_notify(struct net_device *dev, gfp_t gfp);
696298f03342SJohannes Berg 
696398f03342SJohannes Berg /**
69645b97f49dSJohannes Berg  * cfg80211_radar_event - radar detection event
69655b97f49dSJohannes Berg  * @wiphy: the wiphy
69665b97f49dSJohannes Berg  * @chandef: chandef for the current channel
69675b97f49dSJohannes Berg  * @gfp: context flags
69685b97f49dSJohannes Berg  *
69695b97f49dSJohannes Berg  * This function is called when a radar is detected on the current chanenl.
69705b97f49dSJohannes Berg  */
69715b97f49dSJohannes Berg void cfg80211_radar_event(struct wiphy *wiphy,
69725b97f49dSJohannes Berg 			  struct cfg80211_chan_def *chandef, gfp_t gfp);
69735b97f49dSJohannes Berg 
69745b97f49dSJohannes Berg /**
6975466b9936Stamizhr@codeaurora.org  * cfg80211_sta_opmode_change_notify - STA's ht/vht operation mode change event
6976466b9936Stamizhr@codeaurora.org  * @dev: network device
6977466b9936Stamizhr@codeaurora.org  * @mac: MAC address of a station which opmode got modified
6978466b9936Stamizhr@codeaurora.org  * @sta_opmode: station's current opmode value
6979466b9936Stamizhr@codeaurora.org  * @gfp: context flags
6980466b9936Stamizhr@codeaurora.org  *
6981466b9936Stamizhr@codeaurora.org  * Driver should call this function when station's opmode modified via action
6982466b9936Stamizhr@codeaurora.org  * frame.
6983466b9936Stamizhr@codeaurora.org  */
6984466b9936Stamizhr@codeaurora.org void cfg80211_sta_opmode_change_notify(struct net_device *dev, const u8 *mac,
6985466b9936Stamizhr@codeaurora.org 				       struct sta_opmode_info *sta_opmode,
6986466b9936Stamizhr@codeaurora.org 				       gfp_t gfp);
6987466b9936Stamizhr@codeaurora.org 
6988466b9936Stamizhr@codeaurora.org /**
69895b97f49dSJohannes Berg  * cfg80211_cac_event - Channel availability check (CAC) event
69905b97f49dSJohannes Berg  * @netdev: network device
69915b97f49dSJohannes Berg  * @chandef: chandef for the current channel
69925b97f49dSJohannes Berg  * @event: type of event
69935b97f49dSJohannes Berg  * @gfp: context flags
69945b97f49dSJohannes Berg  *
69955b97f49dSJohannes Berg  * This function is called when a Channel availability check (CAC) is finished
69965b97f49dSJohannes Berg  * or aborted. This must be called to notify the completion of a CAC process,
69975b97f49dSJohannes Berg  * also by full-MAC drivers.
69985b97f49dSJohannes Berg  */
69995b97f49dSJohannes Berg void cfg80211_cac_event(struct net_device *netdev,
70005b97f49dSJohannes Berg 			const struct cfg80211_chan_def *chandef,
70015b97f49dSJohannes Berg 			enum nl80211_radar_event event, gfp_t gfp);
70025b97f49dSJohannes Berg 
70035b97f49dSJohannes Berg 
70045b97f49dSJohannes Berg /**
7005e5497d76SJohannes Berg  * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying
7006e5497d76SJohannes Berg  * @dev: network device
7007e5497d76SJohannes Berg  * @bssid: BSSID of AP (to avoid races)
7008e5497d76SJohannes Berg  * @replay_ctr: new replay counter
7009af71ff85SJohannes Berg  * @gfp: allocation flags
7010e5497d76SJohannes Berg  */
7011e5497d76SJohannes Berg void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid,
7012e5497d76SJohannes Berg 			       const u8 *replay_ctr, gfp_t gfp);
7013e5497d76SJohannes Berg 
7014c9df56b4SJouni Malinen /**
7015c9df56b4SJouni Malinen  * cfg80211_pmksa_candidate_notify - notify about PMKSA caching candidate
7016c9df56b4SJouni Malinen  * @dev: network device
7017c9df56b4SJouni Malinen  * @index: candidate index (the smaller the index, the higher the priority)
7018c9df56b4SJouni Malinen  * @bssid: BSSID of AP
7019c9df56b4SJouni Malinen  * @preauth: Whether AP advertises support for RSN pre-authentication
7020c9df56b4SJouni Malinen  * @gfp: allocation flags
7021c9df56b4SJouni Malinen  */
7022c9df56b4SJouni Malinen void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index,
7023c9df56b4SJouni Malinen 				     const u8 *bssid, bool preauth, gfp_t gfp);
7024c9df56b4SJouni Malinen 
702528946da7SJohannes Berg /**
702628946da7SJohannes Berg  * cfg80211_rx_spurious_frame - inform userspace about a spurious frame
702728946da7SJohannes Berg  * @dev: The device the frame matched to
702828946da7SJohannes Berg  * @addr: the transmitter address
702928946da7SJohannes Berg  * @gfp: context flags
703028946da7SJohannes Berg  *
703128946da7SJohannes Berg  * This function is used in AP mode (only!) to inform userspace that
703228946da7SJohannes Berg  * a spurious class 3 frame was received, to be able to deauth the
703328946da7SJohannes Berg  * sender.
70340ae997dcSYacine Belkadi  * Return: %true if the frame was passed to userspace (or this failed
703528946da7SJohannes Berg  * for a reason other than not having a subscription.)
703628946da7SJohannes Berg  */
703728946da7SJohannes Berg bool cfg80211_rx_spurious_frame(struct net_device *dev,
703828946da7SJohannes Berg 				const u8 *addr, gfp_t gfp);
703928946da7SJohannes Berg 
70407f6cf311SJohannes Berg /**
7041b92ab5d8SJohannes Berg  * cfg80211_rx_unexpected_4addr_frame - inform about unexpected WDS frame
7042b92ab5d8SJohannes Berg  * @dev: The device the frame matched to
7043b92ab5d8SJohannes Berg  * @addr: the transmitter address
7044b92ab5d8SJohannes Berg  * @gfp: context flags
7045b92ab5d8SJohannes Berg  *
7046b92ab5d8SJohannes Berg  * This function is used in AP mode (only!) to inform userspace that
7047b92ab5d8SJohannes Berg  * an associated station sent a 4addr frame but that wasn't expected.
7048b92ab5d8SJohannes Berg  * It is allowed and desirable to send this event only once for each
7049b92ab5d8SJohannes Berg  * station to avoid event flooding.
70500ae997dcSYacine Belkadi  * Return: %true if the frame was passed to userspace (or this failed
7051b92ab5d8SJohannes Berg  * for a reason other than not having a subscription.)
7052b92ab5d8SJohannes Berg  */
7053b92ab5d8SJohannes Berg bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev,
7054b92ab5d8SJohannes Berg 					const u8 *addr, gfp_t gfp);
7055b92ab5d8SJohannes Berg 
7056b92ab5d8SJohannes Berg /**
70577f6cf311SJohannes Berg  * cfg80211_probe_status - notify userspace about probe status
70587f6cf311SJohannes Berg  * @dev: the device the probe was sent on
70597f6cf311SJohannes Berg  * @addr: the address of the peer
70607f6cf311SJohannes Berg  * @cookie: the cookie filled in @probe_client previously
70617f6cf311SJohannes Berg  * @acked: indicates whether probe was acked or not
7062c4b50cd3SVenkateswara Naralasetty  * @ack_signal: signal strength (in dBm) of the ACK frame.
7063c4b50cd3SVenkateswara Naralasetty  * @is_valid_ack_signal: indicates the ack_signal is valid or not.
70647f6cf311SJohannes Berg  * @gfp: allocation flags
70657f6cf311SJohannes Berg  */
70667f6cf311SJohannes Berg void cfg80211_probe_status(struct net_device *dev, const u8 *addr,
7067c4b50cd3SVenkateswara Naralasetty 			   u64 cookie, bool acked, s32 ack_signal,
7068c4b50cd3SVenkateswara Naralasetty 			   bool is_valid_ack_signal, gfp_t gfp);
70697f6cf311SJohannes Berg 
70705e760230SJohannes Berg /**
70715e760230SJohannes Berg  * cfg80211_report_obss_beacon - report beacon from other APs
70725e760230SJohannes Berg  * @wiphy: The wiphy that received the beacon
70735e760230SJohannes Berg  * @frame: the frame
70745e760230SJohannes Berg  * @len: length of the frame
70755e760230SJohannes Berg  * @freq: frequency the frame was received on
70766c2fb1e6SSergey Matyukevich  * @sig_dbm: signal strength in dBm, or 0 if unknown
70775e760230SJohannes Berg  *
70785e760230SJohannes Berg  * Use this function to report to userspace when a beacon was
70795e760230SJohannes Berg  * received. It is not useful to call this when there is no
70805e760230SJohannes Berg  * netdev that is in AP/GO mode.
70815e760230SJohannes Berg  */
70825e760230SJohannes Berg void cfg80211_report_obss_beacon(struct wiphy *wiphy,
70835e760230SJohannes Berg 				 const u8 *frame, size_t len,
708437c73b5fSBen Greear 				 int freq, int sig_dbm);
70855e760230SJohannes Berg 
7086d58e7e37SJohannes Berg /**
7087683b6d3bSJohannes Berg  * cfg80211_reg_can_beacon - check if beaconing is allowed
708854858ee5SAlexander Simon  * @wiphy: the wiphy
7089683b6d3bSJohannes Berg  * @chandef: the channel definition
7090174e0cd2SIlan Peer  * @iftype: interface type
7091d58e7e37SJohannes Berg  *
70920ae997dcSYacine Belkadi  * Return: %true if there is no secondary channel or the secondary channel(s)
70930ae997dcSYacine Belkadi  * can be used for beaconing (i.e. is not a radar channel etc.)
709454858ee5SAlexander Simon  */
7095683b6d3bSJohannes Berg bool cfg80211_reg_can_beacon(struct wiphy *wiphy,
7096174e0cd2SIlan Peer 			     struct cfg80211_chan_def *chandef,
7097174e0cd2SIlan Peer 			     enum nl80211_iftype iftype);
709854858ee5SAlexander Simon 
7099923b352fSArik Nemtsov /**
7100923b352fSArik Nemtsov  * cfg80211_reg_can_beacon_relax - check if beaconing is allowed with relaxation
7101923b352fSArik Nemtsov  * @wiphy: the wiphy
7102923b352fSArik Nemtsov  * @chandef: the channel definition
7103923b352fSArik Nemtsov  * @iftype: interface type
7104923b352fSArik Nemtsov  *
7105923b352fSArik Nemtsov  * Return: %true if there is no secondary channel or the secondary channel(s)
7106923b352fSArik Nemtsov  * can be used for beaconing (i.e. is not a radar channel etc.). This version
7107923b352fSArik Nemtsov  * also checks if IR-relaxation conditions apply, to allow beaconing under
7108923b352fSArik Nemtsov  * more permissive conditions.
7109923b352fSArik Nemtsov  *
7110923b352fSArik Nemtsov  * Requires the RTNL to be held.
7111923b352fSArik Nemtsov  */
7112923b352fSArik Nemtsov bool cfg80211_reg_can_beacon_relax(struct wiphy *wiphy,
7113923b352fSArik Nemtsov 				   struct cfg80211_chan_def *chandef,
7114923b352fSArik Nemtsov 				   enum nl80211_iftype iftype);
7115923b352fSArik Nemtsov 
71168097e149SThomas Pedersen /*
71175314526bSThomas Pedersen  * cfg80211_ch_switch_notify - update wdev channel and notify userspace
71185314526bSThomas Pedersen  * @dev: the device which switched channels
7119683b6d3bSJohannes Berg  * @chandef: the new channel definition
71205314526bSThomas Pedersen  *
7121e487eaebSSimon Wunderlich  * Caller must acquire wdev_lock, therefore must only be called from sleepable
7122e487eaebSSimon Wunderlich  * driver context!
71235314526bSThomas Pedersen  */
7124683b6d3bSJohannes Berg void cfg80211_ch_switch_notify(struct net_device *dev,
7125683b6d3bSJohannes Berg 			       struct cfg80211_chan_def *chandef);
71265314526bSThomas Pedersen 
7127f8d7552eSLuciano Coelho /*
7128f8d7552eSLuciano Coelho  * cfg80211_ch_switch_started_notify - notify channel switch start
7129f8d7552eSLuciano Coelho  * @dev: the device on which the channel switch started
7130f8d7552eSLuciano Coelho  * @chandef: the future channel definition
7131f8d7552eSLuciano Coelho  * @count: the number of TBTTs until the channel switch happens
7132f8d7552eSLuciano Coelho  *
7133f8d7552eSLuciano Coelho  * Inform the userspace about the channel switch that has just
7134f8d7552eSLuciano Coelho  * started, so that it can take appropriate actions (eg. starting
7135f8d7552eSLuciano Coelho  * channel switch on other vifs), if necessary.
7136f8d7552eSLuciano Coelho  */
7137f8d7552eSLuciano Coelho void cfg80211_ch_switch_started_notify(struct net_device *dev,
7138f8d7552eSLuciano Coelho 				       struct cfg80211_chan_def *chandef,
7139f8d7552eSLuciano Coelho 				       u8 count);
7140f8d7552eSLuciano Coelho 
71411ce3e82bSJohannes Berg /**
71421ce3e82bSJohannes Berg  * ieee80211_operating_class_to_band - convert operating class to band
71431ce3e82bSJohannes Berg  *
71441ce3e82bSJohannes Berg  * @operating_class: the operating class to convert
71451ce3e82bSJohannes Berg  * @band: band pointer to fill
71461ce3e82bSJohannes Berg  *
71471ce3e82bSJohannes Berg  * Returns %true if the conversion was successful, %false otherwise.
71481ce3e82bSJohannes Berg  */
71491ce3e82bSJohannes Berg bool ieee80211_operating_class_to_band(u8 operating_class,
715057fbcce3SJohannes Berg 				       enum nl80211_band *band);
71511ce3e82bSJohannes Berg 
7152a38700ddSArik Nemtsov /**
7153a38700ddSArik Nemtsov  * ieee80211_chandef_to_operating_class - convert chandef to operation class
7154a38700ddSArik Nemtsov  *
7155a38700ddSArik Nemtsov  * @chandef: the chandef to convert
7156a38700ddSArik Nemtsov  * @op_class: a pointer to the resulting operating class
7157a38700ddSArik Nemtsov  *
7158a38700ddSArik Nemtsov  * Returns %true if the conversion was successful, %false otherwise.
7159a38700ddSArik Nemtsov  */
7160a38700ddSArik Nemtsov bool ieee80211_chandef_to_operating_class(struct cfg80211_chan_def *chandef,
7161a38700ddSArik Nemtsov 					  u8 *op_class);
7162a38700ddSArik Nemtsov 
71635314526bSThomas Pedersen /*
71643475b094SJouni Malinen  * cfg80211_tdls_oper_request - request userspace to perform TDLS operation
71653475b094SJouni Malinen  * @dev: the device on which the operation is requested
71663475b094SJouni Malinen  * @peer: the MAC address of the peer device
71673475b094SJouni Malinen  * @oper: the requested TDLS operation (NL80211_TDLS_SETUP or
71683475b094SJouni Malinen  *	NL80211_TDLS_TEARDOWN)
71693475b094SJouni Malinen  * @reason_code: the reason code for teardown request
71703475b094SJouni Malinen  * @gfp: allocation flags
71713475b094SJouni Malinen  *
71723475b094SJouni Malinen  * This function is used to request userspace to perform TDLS operation that
71733475b094SJouni Malinen  * requires knowledge of keys, i.e., link setup or teardown when the AP
71743475b094SJouni Malinen  * connection uses encryption. This is optional mechanism for the driver to use
71753475b094SJouni Malinen  * if it can automatically determine when a TDLS link could be useful (e.g.,
71763475b094SJouni Malinen  * based on traffic and signal strength for a peer).
71773475b094SJouni Malinen  */
71783475b094SJouni Malinen void cfg80211_tdls_oper_request(struct net_device *dev, const u8 *peer,
71793475b094SJouni Malinen 				enum nl80211_tdls_operation oper,
71803475b094SJouni Malinen 				u16 reason_code, gfp_t gfp);
71813475b094SJouni Malinen 
71823475b094SJouni Malinen /*
71838097e149SThomas Pedersen  * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units)
71848097e149SThomas Pedersen  * @rate: given rate_info to calculate bitrate from
71858097e149SThomas Pedersen  *
71868097e149SThomas Pedersen  * return 0 if MCS index >= 32
71878097e149SThomas Pedersen  */
71888eb41c8dSVladimir Kondratiev u32 cfg80211_calculate_bitrate(struct rate_info *rate);
71898097e149SThomas Pedersen 
719098104fdeSJohannes Berg /**
719198104fdeSJohannes Berg  * cfg80211_unregister_wdev - remove the given wdev
719298104fdeSJohannes Berg  * @wdev: struct wireless_dev to remove
719398104fdeSJohannes Berg  *
719498104fdeSJohannes Berg  * Call this function only for wdevs that have no netdev assigned,
719598104fdeSJohannes Berg  * e.g. P2P Devices. It removes the device from the list so that
719698104fdeSJohannes Berg  * it can no longer be used. It is necessary to call this function
719798104fdeSJohannes Berg  * even when cfg80211 requests the removal of the interface by
719898104fdeSJohannes Berg  * calling the del_virtual_intf() callback. The function must also
719998104fdeSJohannes Berg  * be called when the driver wishes to unregister the wdev, e.g.
720098104fdeSJohannes Berg  * when the device is unbound from the driver.
720198104fdeSJohannes Berg  *
720298104fdeSJohannes Berg  * Requires the RTNL to be held.
720398104fdeSJohannes Berg  */
720498104fdeSJohannes Berg void cfg80211_unregister_wdev(struct wireless_dev *wdev);
720598104fdeSJohannes Berg 
72060ee45355SJohannes Berg /**
7207355199e0SJouni Malinen  * struct cfg80211_ft_event - FT Information Elements
7208355199e0SJouni Malinen  * @ies: FT IEs
7209355199e0SJouni Malinen  * @ies_len: length of the FT IE in bytes
7210355199e0SJouni Malinen  * @target_ap: target AP's MAC address
7211355199e0SJouni Malinen  * @ric_ies: RIC IE
7212355199e0SJouni Malinen  * @ric_ies_len: length of the RIC IE in bytes
7213355199e0SJouni Malinen  */
7214355199e0SJouni Malinen struct cfg80211_ft_event_params {
7215355199e0SJouni Malinen 	const u8 *ies;
7216355199e0SJouni Malinen 	size_t ies_len;
7217355199e0SJouni Malinen 	const u8 *target_ap;
7218355199e0SJouni Malinen 	const u8 *ric_ies;
7219355199e0SJouni Malinen 	size_t ric_ies_len;
7220355199e0SJouni Malinen };
7221355199e0SJouni Malinen 
7222355199e0SJouni Malinen /**
7223355199e0SJouni Malinen  * cfg80211_ft_event - notify userspace about FT IE and RIC IE
7224355199e0SJouni Malinen  * @netdev: network device
7225355199e0SJouni Malinen  * @ft_event: IE information
7226355199e0SJouni Malinen  */
7227355199e0SJouni Malinen void cfg80211_ft_event(struct net_device *netdev,
7228355199e0SJouni Malinen 		       struct cfg80211_ft_event_params *ft_event);
7229355199e0SJouni Malinen 
7230355199e0SJouni Malinen /**
72310ee45355SJohannes Berg  * cfg80211_get_p2p_attr - find and copy a P2P attribute from IE buffer
72320ee45355SJohannes Berg  * @ies: the input IE buffer
72330ee45355SJohannes Berg  * @len: the input length
72340ee45355SJohannes Berg  * @attr: the attribute ID to find
72350ee45355SJohannes Berg  * @buf: output buffer, can be %NULL if the data isn't needed, e.g.
72360ee45355SJohannes Berg  *	if the function is only called to get the needed buffer size
72370ee45355SJohannes Berg  * @bufsize: size of the output buffer
72380ee45355SJohannes Berg  *
72390ee45355SJohannes Berg  * The function finds a given P2P attribute in the (vendor) IEs and
72400ee45355SJohannes Berg  * copies its contents to the given buffer.
72410ee45355SJohannes Berg  *
72420ae997dcSYacine Belkadi  * Return: A negative error code (-%EILSEQ or -%ENOENT) if the data is
72430ae997dcSYacine Belkadi  * malformed or the attribute can't be found (respectively), or the
72440ae997dcSYacine Belkadi  * length of the found attribute (which can be zero).
72450ee45355SJohannes Berg  */
7246c216e641SArend van Spriel int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len,
7247c216e641SArend van Spriel 			  enum ieee80211_p2p_attr_id attr,
7248c216e641SArend van Spriel 			  u8 *buf, unsigned int bufsize);
72490ee45355SJohannes Berg 
7250cd8f7cb4SJohannes Berg /**
725129464cccSJohannes Berg  * ieee80211_ie_split_ric - split an IE buffer according to ordering (with RIC)
725229464cccSJohannes Berg  * @ies: the IE buffer
725329464cccSJohannes Berg  * @ielen: the length of the IE buffer
725429464cccSJohannes Berg  * @ids: an array with element IDs that are allowed before
72552512b1b1SLiad Kaufman  *	the split. A WLAN_EID_EXTENSION value means that the next
72562512b1b1SLiad Kaufman  *	EID in the list is a sub-element of the EXTENSION IE.
725729464cccSJohannes Berg  * @n_ids: the size of the element ID array
725829464cccSJohannes Berg  * @after_ric: array IE types that come after the RIC element
725929464cccSJohannes Berg  * @n_after_ric: size of the @after_ric array
726029464cccSJohannes Berg  * @offset: offset where to start splitting in the buffer
726129464cccSJohannes Berg  *
726229464cccSJohannes Berg  * This function splits an IE buffer by updating the @offset
726329464cccSJohannes Berg  * variable to point to the location where the buffer should be
726429464cccSJohannes Berg  * split.
726529464cccSJohannes Berg  *
726629464cccSJohannes Berg  * It assumes that the given IE buffer is well-formed, this
726729464cccSJohannes Berg  * has to be guaranteed by the caller!
726829464cccSJohannes Berg  *
726929464cccSJohannes Berg  * It also assumes that the IEs in the buffer are ordered
727029464cccSJohannes Berg  * correctly, if not the result of using this function will not
727129464cccSJohannes Berg  * be ordered correctly either, i.e. it does no reordering.
727229464cccSJohannes Berg  *
727329464cccSJohannes Berg  * The function returns the offset where the next part of the
727429464cccSJohannes Berg  * buffer starts, which may be @ielen if the entire (remainder)
727529464cccSJohannes Berg  * of the buffer should be used.
727629464cccSJohannes Berg  */
727729464cccSJohannes Berg size_t ieee80211_ie_split_ric(const u8 *ies, size_t ielen,
727829464cccSJohannes Berg 			      const u8 *ids, int n_ids,
727929464cccSJohannes Berg 			      const u8 *after_ric, int n_after_ric,
728029464cccSJohannes Berg 			      size_t offset);
728129464cccSJohannes Berg 
728229464cccSJohannes Berg /**
728329464cccSJohannes Berg  * ieee80211_ie_split - split an IE buffer according to ordering
728429464cccSJohannes Berg  * @ies: the IE buffer
728529464cccSJohannes Berg  * @ielen: the length of the IE buffer
728629464cccSJohannes Berg  * @ids: an array with element IDs that are allowed before
72872512b1b1SLiad Kaufman  *	the split. A WLAN_EID_EXTENSION value means that the next
72882512b1b1SLiad Kaufman  *	EID in the list is a sub-element of the EXTENSION IE.
728929464cccSJohannes Berg  * @n_ids: the size of the element ID array
729029464cccSJohannes Berg  * @offset: offset where to start splitting in the buffer
729129464cccSJohannes Berg  *
729229464cccSJohannes Berg  * This function splits an IE buffer by updating the @offset
729329464cccSJohannes Berg  * variable to point to the location where the buffer should be
729429464cccSJohannes Berg  * split.
729529464cccSJohannes Berg  *
729629464cccSJohannes Berg  * It assumes that the given IE buffer is well-formed, this
729729464cccSJohannes Berg  * has to be guaranteed by the caller!
729829464cccSJohannes Berg  *
729929464cccSJohannes Berg  * It also assumes that the IEs in the buffer are ordered
730029464cccSJohannes Berg  * correctly, if not the result of using this function will not
730129464cccSJohannes Berg  * be ordered correctly either, i.e. it does no reordering.
730229464cccSJohannes Berg  *
730329464cccSJohannes Berg  * The function returns the offset where the next part of the
730429464cccSJohannes Berg  * buffer starts, which may be @ielen if the entire (remainder)
730529464cccSJohannes Berg  * of the buffer should be used.
730629464cccSJohannes Berg  */
73070483eeacSJohannes Berg static inline size_t ieee80211_ie_split(const u8 *ies, size_t ielen,
73080483eeacSJohannes Berg 					const u8 *ids, int n_ids, size_t offset)
73090483eeacSJohannes Berg {
73100483eeacSJohannes Berg 	return ieee80211_ie_split_ric(ies, ielen, ids, n_ids, NULL, 0, offset);
73110483eeacSJohannes Berg }
731229464cccSJohannes Berg 
731329464cccSJohannes Berg /**
7314cd8f7cb4SJohannes Berg  * cfg80211_report_wowlan_wakeup - report wakeup from WoWLAN
7315cd8f7cb4SJohannes Berg  * @wdev: the wireless device reporting the wakeup
7316cd8f7cb4SJohannes Berg  * @wakeup: the wakeup report
7317cd8f7cb4SJohannes Berg  * @gfp: allocation flags
7318cd8f7cb4SJohannes Berg  *
7319cd8f7cb4SJohannes Berg  * This function reports that the given device woke up. If it
7320cd8f7cb4SJohannes Berg  * caused the wakeup, report the reason(s), otherwise you may
7321cd8f7cb4SJohannes Berg  * pass %NULL as the @wakeup parameter to advertise that something
7322cd8f7cb4SJohannes Berg  * else caused the wakeup.
7323cd8f7cb4SJohannes Berg  */
7324cd8f7cb4SJohannes Berg void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev,
7325cd8f7cb4SJohannes Berg 				   struct cfg80211_wowlan_wakeup *wakeup,
7326cd8f7cb4SJohannes Berg 				   gfp_t gfp);
7327cd8f7cb4SJohannes Berg 
73285de17984SArend van Spriel /**
73295de17984SArend van Spriel  * cfg80211_crit_proto_stopped() - indicate critical protocol stopped by driver.
73305de17984SArend van Spriel  *
73315de17984SArend van Spriel  * @wdev: the wireless device for which critical protocol is stopped.
733203f831a6SRobert P. J. Day  * @gfp: allocation flags
73335de17984SArend van Spriel  *
73345de17984SArend van Spriel  * This function can be called by the driver to indicate it has reverted
73355de17984SArend van Spriel  * operation back to normal. One reason could be that the duration given
73365de17984SArend van Spriel  * by .crit_proto_start() has expired.
73375de17984SArend van Spriel  */
73385de17984SArend van Spriel void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp);
73395de17984SArend van Spriel 
7340bdfbec2dSIlan Peer /**
7341bdfbec2dSIlan Peer  * ieee80211_get_num_supported_channels - get number of channels device has
7342bdfbec2dSIlan Peer  * @wiphy: the wiphy
7343bdfbec2dSIlan Peer  *
7344bdfbec2dSIlan Peer  * Return: the number of channels supported by the device.
7345bdfbec2dSIlan Peer  */
7346bdfbec2dSIlan Peer unsigned int ieee80211_get_num_supported_channels(struct wiphy *wiphy);
7347bdfbec2dSIlan Peer 
7348cb2d956dSLuciano Coelho /**
7349cb2d956dSLuciano Coelho  * cfg80211_check_combinations - check interface combinations
7350cb2d956dSLuciano Coelho  *
7351cb2d956dSLuciano Coelho  * @wiphy: the wiphy
7352e227300cSPurushottam Kushwaha  * @params: the interface combinations parameter
7353cb2d956dSLuciano Coelho  *
7354cb2d956dSLuciano Coelho  * This function can be called by the driver to check whether a
7355cb2d956dSLuciano Coelho  * combination of interfaces and their types are allowed according to
7356cb2d956dSLuciano Coelho  * the interface combinations.
7357cb2d956dSLuciano Coelho  */
7358cb2d956dSLuciano Coelho int cfg80211_check_combinations(struct wiphy *wiphy,
7359e227300cSPurushottam Kushwaha 				struct iface_combination_params *params);
7360cb2d956dSLuciano Coelho 
736165a124ddSMichal Kazior /**
736265a124ddSMichal Kazior  * cfg80211_iter_combinations - iterate over matching combinations
736365a124ddSMichal Kazior  *
736465a124ddSMichal Kazior  * @wiphy: the wiphy
7365e227300cSPurushottam Kushwaha  * @params: the interface combinations parameter
736665a124ddSMichal Kazior  * @iter: function to call for each matching combination
736765a124ddSMichal Kazior  * @data: pointer to pass to iter function
736865a124ddSMichal Kazior  *
736965a124ddSMichal Kazior  * This function can be called by the driver to check what possible
737065a124ddSMichal Kazior  * combinations it fits in at a given moment, e.g. for channel switching
737165a124ddSMichal Kazior  * purposes.
737265a124ddSMichal Kazior  */
737365a124ddSMichal Kazior int cfg80211_iter_combinations(struct wiphy *wiphy,
7374e227300cSPurushottam Kushwaha 			       struct iface_combination_params *params,
737565a124ddSMichal Kazior 			       void (*iter)(const struct ieee80211_iface_combination *c,
737665a124ddSMichal Kazior 					    void *data),
737765a124ddSMichal Kazior 			       void *data);
737865a124ddSMichal Kazior 
7379f04c2203SMichal Kazior /*
7380f04c2203SMichal Kazior  * cfg80211_stop_iface - trigger interface disconnection
7381f04c2203SMichal Kazior  *
7382f04c2203SMichal Kazior  * @wiphy: the wiphy
7383f04c2203SMichal Kazior  * @wdev: wireless device
7384f04c2203SMichal Kazior  * @gfp: context flags
7385f04c2203SMichal Kazior  *
7386f04c2203SMichal Kazior  * Trigger interface to be stopped as if AP was stopped, IBSS/mesh left, STA
7387f04c2203SMichal Kazior  * disconnected.
7388f04c2203SMichal Kazior  *
7389f04c2203SMichal Kazior  * Note: This doesn't need any locks and is asynchronous.
7390f04c2203SMichal Kazior  */
7391f04c2203SMichal Kazior void cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev,
7392f04c2203SMichal Kazior 			 gfp_t gfp);
7393f04c2203SMichal Kazior 
7394f6837ba8SJohannes Berg /**
7395f6837ba8SJohannes Berg  * cfg80211_shutdown_all_interfaces - shut down all interfaces for a wiphy
7396f6837ba8SJohannes Berg  * @wiphy: the wiphy to shut down
7397f6837ba8SJohannes Berg  *
7398f6837ba8SJohannes Berg  * This function shuts down all interfaces belonging to this wiphy by
7399f6837ba8SJohannes Berg  * calling dev_close() (and treating non-netdev interfaces as needed).
7400f6837ba8SJohannes Berg  * It shouldn't really be used unless there are some fatal device errors
7401f6837ba8SJohannes Berg  * that really can't be recovered in any other way.
7402f6837ba8SJohannes Berg  *
7403f6837ba8SJohannes Berg  * Callers must hold the RTNL and be able to deal with callbacks into
7404f6837ba8SJohannes Berg  * the driver while the function is running.
7405f6837ba8SJohannes Berg  */
7406f6837ba8SJohannes Berg void cfg80211_shutdown_all_interfaces(struct wiphy *wiphy);
7407f6837ba8SJohannes Berg 
7408d75bb06bSGautam Kumar Shukla /**
7409d75bb06bSGautam Kumar Shukla  * wiphy_ext_feature_set - set the extended feature flag
7410d75bb06bSGautam Kumar Shukla  *
7411d75bb06bSGautam Kumar Shukla  * @wiphy: the wiphy to modify.
7412d75bb06bSGautam Kumar Shukla  * @ftidx: extended feature bit index.
7413d75bb06bSGautam Kumar Shukla  *
7414d75bb06bSGautam Kumar Shukla  * The extended features are flagged in multiple bytes (see
7415d75bb06bSGautam Kumar Shukla  * &struct wiphy.@ext_features)
7416d75bb06bSGautam Kumar Shukla  */
7417d75bb06bSGautam Kumar Shukla static inline void wiphy_ext_feature_set(struct wiphy *wiphy,
7418d75bb06bSGautam Kumar Shukla 					 enum nl80211_ext_feature_index ftidx)
7419d75bb06bSGautam Kumar Shukla {
7420d75bb06bSGautam Kumar Shukla 	u8 *ft_byte;
7421d75bb06bSGautam Kumar Shukla 
7422d75bb06bSGautam Kumar Shukla 	ft_byte = &wiphy->ext_features[ftidx / 8];
7423d75bb06bSGautam Kumar Shukla 	*ft_byte |= BIT(ftidx % 8);
7424d75bb06bSGautam Kumar Shukla }
7425d75bb06bSGautam Kumar Shukla 
7426d75bb06bSGautam Kumar Shukla /**
7427d75bb06bSGautam Kumar Shukla  * wiphy_ext_feature_isset - check the extended feature flag
7428d75bb06bSGautam Kumar Shukla  *
7429d75bb06bSGautam Kumar Shukla  * @wiphy: the wiphy to modify.
7430d75bb06bSGautam Kumar Shukla  * @ftidx: extended feature bit index.
7431d75bb06bSGautam Kumar Shukla  *
7432d75bb06bSGautam Kumar Shukla  * The extended features are flagged in multiple bytes (see
7433d75bb06bSGautam Kumar Shukla  * &struct wiphy.@ext_features)
7434d75bb06bSGautam Kumar Shukla  */
7435d75bb06bSGautam Kumar Shukla static inline bool
7436d75bb06bSGautam Kumar Shukla wiphy_ext_feature_isset(struct wiphy *wiphy,
7437d75bb06bSGautam Kumar Shukla 			enum nl80211_ext_feature_index ftidx)
7438d75bb06bSGautam Kumar Shukla {
7439d75bb06bSGautam Kumar Shukla 	u8 ft_byte;
7440d75bb06bSGautam Kumar Shukla 
7441d75bb06bSGautam Kumar Shukla 	ft_byte = wiphy->ext_features[ftidx / 8];
7442d75bb06bSGautam Kumar Shukla 	return (ft_byte & BIT(ftidx % 8)) != 0;
7443d75bb06bSGautam Kumar Shukla }
7444b7ffbd7eSJohannes Berg 
7445a442b761SAyala Beker /**
7446a442b761SAyala Beker  * cfg80211_free_nan_func - free NAN function
7447a442b761SAyala Beker  * @f: NAN function that should be freed
7448a442b761SAyala Beker  *
7449a442b761SAyala Beker  * Frees all the NAN function and all it's allocated members.
7450a442b761SAyala Beker  */
7451a442b761SAyala Beker void cfg80211_free_nan_func(struct cfg80211_nan_func *f);
7452a442b761SAyala Beker 
745350bcd31dSAyala Beker /**
745450bcd31dSAyala Beker  * struct cfg80211_nan_match_params - NAN match parameters
745550bcd31dSAyala Beker  * @type: the type of the function that triggered a match. If it is
745650bcd31dSAyala Beker  *	 %NL80211_NAN_FUNC_SUBSCRIBE it means that we replied to a subscriber.
745750bcd31dSAyala Beker  *	 If it is %NL80211_NAN_FUNC_PUBLISH, it means that we got a discovery
745850bcd31dSAyala Beker  *	 result.
745950bcd31dSAyala Beker  *	 If it is %NL80211_NAN_FUNC_FOLLOW_UP, we received a follow up.
746050bcd31dSAyala Beker  * @inst_id: the local instance id
746150bcd31dSAyala Beker  * @peer_inst_id: the instance id of the peer's function
746250bcd31dSAyala Beker  * @addr: the MAC address of the peer
746350bcd31dSAyala Beker  * @info_len: the length of the &info
746450bcd31dSAyala Beker  * @info: the Service Specific Info from the peer (if any)
746550bcd31dSAyala Beker  * @cookie: unique identifier of the corresponding function
746650bcd31dSAyala Beker  */
746750bcd31dSAyala Beker struct cfg80211_nan_match_params {
746850bcd31dSAyala Beker 	enum nl80211_nan_function_type type;
746950bcd31dSAyala Beker 	u8 inst_id;
747050bcd31dSAyala Beker 	u8 peer_inst_id;
747150bcd31dSAyala Beker 	const u8 *addr;
747250bcd31dSAyala Beker 	u8 info_len;
747350bcd31dSAyala Beker 	const u8 *info;
747450bcd31dSAyala Beker 	u64 cookie;
747550bcd31dSAyala Beker };
747650bcd31dSAyala Beker 
747750bcd31dSAyala Beker /**
747850bcd31dSAyala Beker  * cfg80211_nan_match - report a match for a NAN function.
747950bcd31dSAyala Beker  * @wdev: the wireless device reporting the match
748050bcd31dSAyala Beker  * @match: match notification parameters
748150bcd31dSAyala Beker  * @gfp: allocation flags
748250bcd31dSAyala Beker  *
748350bcd31dSAyala Beker  * This function reports that the a NAN function had a match. This
748450bcd31dSAyala Beker  * can be a subscribe that had a match or a solicited publish that
748550bcd31dSAyala Beker  * was sent. It can also be a follow up that was received.
748650bcd31dSAyala Beker  */
748750bcd31dSAyala Beker void cfg80211_nan_match(struct wireless_dev *wdev,
748850bcd31dSAyala Beker 			struct cfg80211_nan_match_params *match, gfp_t gfp);
748950bcd31dSAyala Beker 
7490368e5a7bSAyala Beker /**
7491368e5a7bSAyala Beker  * cfg80211_nan_func_terminated - notify about NAN function termination.
7492368e5a7bSAyala Beker  *
7493368e5a7bSAyala Beker  * @wdev: the wireless device reporting the match
7494368e5a7bSAyala Beker  * @inst_id: the local instance id
7495368e5a7bSAyala Beker  * @reason: termination reason (one of the NL80211_NAN_FUNC_TERM_REASON_*)
7496368e5a7bSAyala Beker  * @cookie: unique NAN function identifier
7497368e5a7bSAyala Beker  * @gfp: allocation flags
7498368e5a7bSAyala Beker  *
7499368e5a7bSAyala Beker  * This function reports that the a NAN function is terminated.
7500368e5a7bSAyala Beker  */
7501368e5a7bSAyala Beker void cfg80211_nan_func_terminated(struct wireless_dev *wdev,
7502368e5a7bSAyala Beker 				  u8 inst_id,
7503368e5a7bSAyala Beker 				  enum nl80211_nan_func_term_reason reason,
7504368e5a7bSAyala Beker 				  u64 cookie, gfp_t gfp);
7505368e5a7bSAyala Beker 
7506b7ffbd7eSJohannes Berg /* ethtool helper */
7507b7ffbd7eSJohannes Berg void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info);
7508b7ffbd7eSJohannes Berg 
750940cbfa90SSrinivas Dasari /**
751040cbfa90SSrinivas Dasari  * cfg80211_external_auth_request - userspace request for authentication
751140cbfa90SSrinivas Dasari  * @netdev: network device
751240cbfa90SSrinivas Dasari  * @params: External authentication parameters
751340cbfa90SSrinivas Dasari  * @gfp: allocation flags
751440cbfa90SSrinivas Dasari  * Returns: 0 on success, < 0 on error
751540cbfa90SSrinivas Dasari  */
751640cbfa90SSrinivas Dasari int cfg80211_external_auth_request(struct net_device *netdev,
751740cbfa90SSrinivas Dasari 				   struct cfg80211_external_auth_params *params,
751840cbfa90SSrinivas Dasari 				   gfp_t gfp);
751940cbfa90SSrinivas Dasari 
75209bb7e0f2SJohannes Berg /**
75219bb7e0f2SJohannes Berg  * cfg80211_pmsr_report - report peer measurement result data
75229bb7e0f2SJohannes Berg  * @wdev: the wireless device reporting the measurement
75239bb7e0f2SJohannes Berg  * @req: the original measurement request
75249bb7e0f2SJohannes Berg  * @result: the result data
75259bb7e0f2SJohannes Berg  * @gfp: allocation flags
75269bb7e0f2SJohannes Berg  */
75279bb7e0f2SJohannes Berg void cfg80211_pmsr_report(struct wireless_dev *wdev,
75289bb7e0f2SJohannes Berg 			  struct cfg80211_pmsr_request *req,
75299bb7e0f2SJohannes Berg 			  struct cfg80211_pmsr_result *result,
75309bb7e0f2SJohannes Berg 			  gfp_t gfp);
75319bb7e0f2SJohannes Berg 
75329bb7e0f2SJohannes Berg /**
75339bb7e0f2SJohannes Berg  * cfg80211_pmsr_complete - report peer measurement completed
75349bb7e0f2SJohannes Berg  * @wdev: the wireless device reporting the measurement
75359bb7e0f2SJohannes Berg  * @req: the original measurement request
75369bb7e0f2SJohannes Berg  * @gfp: allocation flags
75379bb7e0f2SJohannes Berg  *
75389bb7e0f2SJohannes Berg  * Report that the entire measurement completed, after this
75399bb7e0f2SJohannes Berg  * the request pointer will no longer be valid.
75409bb7e0f2SJohannes Berg  */
75419bb7e0f2SJohannes Berg void cfg80211_pmsr_complete(struct wireless_dev *wdev,
75429bb7e0f2SJohannes Berg 			    struct cfg80211_pmsr_request *req,
75439bb7e0f2SJohannes Berg 			    gfp_t gfp);
75449bb7e0f2SJohannes Berg 
7545e6f40511SManikanta Pubbisetty /**
7546e6f40511SManikanta Pubbisetty  * cfg80211_iftype_allowed - check whether the interface can be allowed
7547e6f40511SManikanta Pubbisetty  * @wiphy: the wiphy
7548e6f40511SManikanta Pubbisetty  * @iftype: interface type
7549e6f40511SManikanta Pubbisetty  * @is_4addr: use_4addr flag, must be '0' when check_swif is '1'
7550e6f40511SManikanta Pubbisetty  * @check_swif: check iftype against software interfaces
7551e6f40511SManikanta Pubbisetty  *
7552e6f40511SManikanta Pubbisetty  * Check whether the interface is allowed to operate; additionally, this API
7553e6f40511SManikanta Pubbisetty  * can be used to check iftype against the software interfaces when
7554e6f40511SManikanta Pubbisetty  * check_swif is '1'.
7555e6f40511SManikanta Pubbisetty  */
7556e6f40511SManikanta Pubbisetty bool cfg80211_iftype_allowed(struct wiphy *wiphy, enum nl80211_iftype iftype,
7557e6f40511SManikanta Pubbisetty 			     bool is_4addr, u8 check_swif);
7558e6f40511SManikanta Pubbisetty 
7559e6f40511SManikanta Pubbisetty 
7560e1db74fcSJoe Perches /* Logging, debugging and troubleshooting/diagnostic helpers. */
7561e1db74fcSJoe Perches 
7562e1db74fcSJoe Perches /* wiphy_printk helpers, similar to dev_printk */
7563e1db74fcSJoe Perches 
7564e1db74fcSJoe Perches #define wiphy_printk(level, wiphy, format, args...)		\
75659c376639SJoe Perches 	dev_printk(level, &(wiphy)->dev, format, ##args)
7566e1db74fcSJoe Perches #define wiphy_emerg(wiphy, format, args...)			\
75679c376639SJoe Perches 	dev_emerg(&(wiphy)->dev, format, ##args)
7568e1db74fcSJoe Perches #define wiphy_alert(wiphy, format, args...)			\
75699c376639SJoe Perches 	dev_alert(&(wiphy)->dev, format, ##args)
7570e1db74fcSJoe Perches #define wiphy_crit(wiphy, format, args...)			\
75719c376639SJoe Perches 	dev_crit(&(wiphy)->dev, format, ##args)
7572e1db74fcSJoe Perches #define wiphy_err(wiphy, format, args...)			\
75739c376639SJoe Perches 	dev_err(&(wiphy)->dev, format, ##args)
7574e1db74fcSJoe Perches #define wiphy_warn(wiphy, format, args...)			\
75759c376639SJoe Perches 	dev_warn(&(wiphy)->dev, format, ##args)
7576e1db74fcSJoe Perches #define wiphy_notice(wiphy, format, args...)			\
75779c376639SJoe Perches 	dev_notice(&(wiphy)->dev, format, ##args)
7578e1db74fcSJoe Perches #define wiphy_info(wiphy, format, args...)			\
75799c376639SJoe Perches 	dev_info(&(wiphy)->dev, format, ##args)
7580073730d7SJoe Perches 
7581a58d7525SStanislaw Gruszka #define wiphy_err_ratelimited(wiphy, format, args...)		\
7582a58d7525SStanislaw Gruszka 	dev_err_ratelimited(&(wiphy)->dev, format, ##args)
7583a58d7525SStanislaw Gruszka #define wiphy_warn_ratelimited(wiphy, format, args...)		\
7584a58d7525SStanislaw Gruszka 	dev_warn_ratelimited(&(wiphy)->dev, format, ##args)
7585a58d7525SStanislaw Gruszka 
75869c376639SJoe Perches #define wiphy_debug(wiphy, format, args...)			\
7587e1db74fcSJoe Perches 	wiphy_printk(KERN_DEBUG, wiphy, format, ##args)
75889c376639SJoe Perches 
7589e1db74fcSJoe Perches #define wiphy_dbg(wiphy, format, args...)			\
75909c376639SJoe Perches 	dev_dbg(&(wiphy)->dev, format, ##args)
7591e1db74fcSJoe Perches 
7592e1db74fcSJoe Perches #if defined(VERBOSE_DEBUG)
7593e1db74fcSJoe Perches #define wiphy_vdbg	wiphy_dbg
7594e1db74fcSJoe Perches #else
7595e1db74fcSJoe Perches #define wiphy_vdbg(wiphy, format, args...)				\
7596e1db74fcSJoe Perches ({									\
7597e1db74fcSJoe Perches 	if (0)								\
7598e1db74fcSJoe Perches 		wiphy_printk(KERN_DEBUG, wiphy, format, ##args);	\
7599e1db74fcSJoe Perches 	0;								\
7600e1db74fcSJoe Perches })
7601e1db74fcSJoe Perches #endif
7602e1db74fcSJoe Perches 
7603e1db74fcSJoe Perches /*
7604e1db74fcSJoe Perches  * wiphy_WARN() acts like wiphy_printk(), but with the key difference
7605e1db74fcSJoe Perches  * of using a WARN/WARN_ON to get the message out, including the
7606e1db74fcSJoe Perches  * file/line information and a backtrace.
7607e1db74fcSJoe Perches  */
7608e1db74fcSJoe Perches #define wiphy_WARN(wiphy, format, args...)			\
7609e1db74fcSJoe Perches 	WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args);
7610e1db74fcSJoe Perches 
7611cb74e977SSunil Dutt /**
7612cb74e977SSunil Dutt  * cfg80211_update_owe_info_event - Notify the peer's OWE info to user space
7613cb74e977SSunil Dutt  * @netdev: network device
7614cb74e977SSunil Dutt  * @owe_info: peer's owe info
7615cb74e977SSunil Dutt  * @gfp: allocation flags
7616cb74e977SSunil Dutt  */
7617cb74e977SSunil Dutt void cfg80211_update_owe_info_event(struct net_device *netdev,
7618cb74e977SSunil Dutt 				    struct cfg80211_update_owe_info *owe_info,
7619cb74e977SSunil Dutt 				    gfp_t gfp);
7620cb74e977SSunil Dutt 
7621704232c2SJohannes Berg #endif /* __NET_CFG80211_H */
7622