xref: /linux/include/net/cfg80211.h (revision 085a6c109b9dbcb6dfc0c7d1001f554a6d513342)
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
107e8d6f12SShaul Triebitz  * Copyright (C) 2018-2020 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
131934f4c7dSThomas Pedersen  * @freq_offset: offset from @center_freq, in KHz
132d3236553SJohannes Berg  * @hw_value: hardware-specific value for the channel
133d3236553SJohannes Berg  * @flags: channel flags from &enum ieee80211_channel_flags.
134d3236553SJohannes Berg  * @orig_flags: channel flags at registration time, used by regulatory
135d3236553SJohannes Berg  *	code to support devices with additional restrictions
136d3236553SJohannes Berg  * @band: band this channel belongs to.
137d3236553SJohannes Berg  * @max_antenna_gain: maximum antenna gain in dBi
138d3236553SJohannes Berg  * @max_power: maximum transmission power (in dBm)
139eccc068eSHong Wu  * @max_reg_power: maximum regulatory transmission power (in dBm)
140d3236553SJohannes Berg  * @beacon_found: helper to regulatory code to indicate when a beacon
141d3236553SJohannes Berg  *	has been found on this channel. Use regulatory_hint_found_beacon()
14277c2061dSWalter Goldens  *	to enable this, this is useful only on 5 GHz band.
143d3236553SJohannes Berg  * @orig_mag: internal use
144d3236553SJohannes Berg  * @orig_mpwr: internal use
14504f39047SSimon Wunderlich  * @dfs_state: current state of this channel. Only relevant if radar is required
14604f39047SSimon Wunderlich  *	on this channel.
14704f39047SSimon Wunderlich  * @dfs_state_entered: timestamp (jiffies) when the dfs state was entered.
148089027e5SJanusz Dziedzic  * @dfs_cac_ms: DFS CAC time in milliseconds, this is valid for DFS channels.
149d3236553SJohannes Berg  */
150d3236553SJohannes Berg struct ieee80211_channel {
15157fbcce3SJohannes Berg 	enum nl80211_band band;
1529cf0a0b4SAlexei Avshalom Lazar 	u32 center_freq;
153934f4c7dSThomas Pedersen 	u16 freq_offset;
154d3236553SJohannes Berg 	u16 hw_value;
155d3236553SJohannes Berg 	u32 flags;
156d3236553SJohannes Berg 	int max_antenna_gain;
157d3236553SJohannes Berg 	int max_power;
158eccc068eSHong Wu 	int max_reg_power;
159d3236553SJohannes Berg 	bool beacon_found;
160d3236553SJohannes Berg 	u32 orig_flags;
161d3236553SJohannes Berg 	int orig_mag, orig_mpwr;
16204f39047SSimon Wunderlich 	enum nl80211_dfs_state dfs_state;
16304f39047SSimon Wunderlich 	unsigned long dfs_state_entered;
164089027e5SJanusz Dziedzic 	unsigned int dfs_cac_ms;
165d3236553SJohannes Berg };
166d3236553SJohannes Berg 
167d3236553SJohannes Berg /**
168d3236553SJohannes Berg  * enum ieee80211_rate_flags - rate flags
169d3236553SJohannes Berg  *
170d3236553SJohannes Berg  * Hardware/specification flags for rates. These are structured
171d3236553SJohannes Berg  * in a way that allows using the same bitrate structure for
172d3236553SJohannes Berg  * different bands/PHY modes.
173d3236553SJohannes Berg  *
174d3236553SJohannes Berg  * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short
175d3236553SJohannes Berg  *	preamble on this bitrate; only relevant in 2.4GHz band and
176d3236553SJohannes Berg  *	with CCK rates.
177d3236553SJohannes Berg  * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate
178d3236553SJohannes Berg  *	when used with 802.11a (on the 5 GHz band); filled by the
179d3236553SJohannes Berg  *	core code when registering the wiphy.
180d3236553SJohannes Berg  * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate
181d3236553SJohannes Berg  *	when used with 802.11b (on the 2.4 GHz band); filled by the
182d3236553SJohannes Berg  *	core code when registering the wiphy.
183d3236553SJohannes Berg  * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate
184d3236553SJohannes Berg  *	when used with 802.11g (on the 2.4 GHz band); filled by the
185d3236553SJohannes Berg  *	core code when registering the wiphy.
186d3236553SJohannes Berg  * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode.
18730e74732SSimon Wunderlich  * @IEEE80211_RATE_SUPPORTS_5MHZ: Rate can be used in 5 MHz mode
18830e74732SSimon Wunderlich  * @IEEE80211_RATE_SUPPORTS_10MHZ: Rate can be used in 10 MHz mode
189d3236553SJohannes Berg  */
190d3236553SJohannes Berg enum ieee80211_rate_flags {
191d3236553SJohannes Berg 	IEEE80211_RATE_SHORT_PREAMBLE	= 1<<0,
192d3236553SJohannes Berg 	IEEE80211_RATE_MANDATORY_A	= 1<<1,
193d3236553SJohannes Berg 	IEEE80211_RATE_MANDATORY_B	= 1<<2,
194d3236553SJohannes Berg 	IEEE80211_RATE_MANDATORY_G	= 1<<3,
195d3236553SJohannes Berg 	IEEE80211_RATE_ERP_G		= 1<<4,
19630e74732SSimon Wunderlich 	IEEE80211_RATE_SUPPORTS_5MHZ	= 1<<5,
19730e74732SSimon Wunderlich 	IEEE80211_RATE_SUPPORTS_10MHZ	= 1<<6,
198d3236553SJohannes Berg };
199d3236553SJohannes Berg 
200d3236553SJohannes Berg /**
2016eb18137SDedy Lansky  * enum ieee80211_bss_type - BSS type filter
2026eb18137SDedy Lansky  *
2036eb18137SDedy Lansky  * @IEEE80211_BSS_TYPE_ESS: Infrastructure BSS
2046eb18137SDedy Lansky  * @IEEE80211_BSS_TYPE_PBSS: Personal BSS
2056eb18137SDedy Lansky  * @IEEE80211_BSS_TYPE_IBSS: Independent BSS
2066eb18137SDedy Lansky  * @IEEE80211_BSS_TYPE_MBSS: Mesh BSS
2076eb18137SDedy Lansky  * @IEEE80211_BSS_TYPE_ANY: Wildcard value for matching any BSS type
2086eb18137SDedy Lansky  */
2096eb18137SDedy Lansky enum ieee80211_bss_type {
2106eb18137SDedy Lansky 	IEEE80211_BSS_TYPE_ESS,
2116eb18137SDedy Lansky 	IEEE80211_BSS_TYPE_PBSS,
2126eb18137SDedy Lansky 	IEEE80211_BSS_TYPE_IBSS,
2136eb18137SDedy Lansky 	IEEE80211_BSS_TYPE_MBSS,
2146eb18137SDedy Lansky 	IEEE80211_BSS_TYPE_ANY
2156eb18137SDedy Lansky };
2166eb18137SDedy Lansky 
2176eb18137SDedy Lansky /**
2186eb18137SDedy Lansky  * enum ieee80211_privacy - BSS privacy filter
2196eb18137SDedy Lansky  *
2206eb18137SDedy Lansky  * @IEEE80211_PRIVACY_ON: privacy bit set
2216eb18137SDedy Lansky  * @IEEE80211_PRIVACY_OFF: privacy bit clear
2226eb18137SDedy Lansky  * @IEEE80211_PRIVACY_ANY: Wildcard value for matching any privacy setting
2236eb18137SDedy Lansky  */
2246eb18137SDedy Lansky enum ieee80211_privacy {
2256eb18137SDedy Lansky 	IEEE80211_PRIVACY_ON,
2266eb18137SDedy Lansky 	IEEE80211_PRIVACY_OFF,
2276eb18137SDedy Lansky 	IEEE80211_PRIVACY_ANY
2286eb18137SDedy Lansky };
2296eb18137SDedy Lansky 
2306eb18137SDedy Lansky #define IEEE80211_PRIVACY(x)	\
2316eb18137SDedy Lansky 	((x) ? IEEE80211_PRIVACY_ON : IEEE80211_PRIVACY_OFF)
2326eb18137SDedy Lansky 
2336eb18137SDedy Lansky /**
234d3236553SJohannes Berg  * struct ieee80211_rate - bitrate definition
235d3236553SJohannes Berg  *
236d3236553SJohannes Berg  * This structure describes a bitrate that an 802.11 PHY can
237d3236553SJohannes Berg  * operate with. The two values @hw_value and @hw_value_short
238d3236553SJohannes Berg  * are only for driver use when pointers to this structure are
239d3236553SJohannes Berg  * passed around.
240d3236553SJohannes Berg  *
241d3236553SJohannes Berg  * @flags: rate-specific flags
242d3236553SJohannes Berg  * @bitrate: bitrate in units of 100 Kbps
243d3236553SJohannes Berg  * @hw_value: driver/hardware value for this rate
244d3236553SJohannes Berg  * @hw_value_short: driver/hardware value for this rate when
245d3236553SJohannes Berg  *	short preamble is used
246d3236553SJohannes Berg  */
247d3236553SJohannes Berg struct ieee80211_rate {
248d3236553SJohannes Berg 	u32 flags;
249d3236553SJohannes Berg 	u16 bitrate;
250d3236553SJohannes Berg 	u16 hw_value, hw_value_short;
251d3236553SJohannes Berg };
252d3236553SJohannes Berg 
253d3236553SJohannes Berg /**
254796e90f4SJohn Crispin  * struct ieee80211_he_obss_pd - AP settings for spatial reuse
255796e90f4SJohn Crispin  *
256796e90f4SJohn Crispin  * @enable: is the feature enabled.
257796e90f4SJohn Crispin  * @min_offset: minimal tx power offset an associated station shall use
258796e90f4SJohn Crispin  * @max_offset: maximum tx power offset an associated station shall use
259796e90f4SJohn Crispin  */
260796e90f4SJohn Crispin struct ieee80211_he_obss_pd {
261796e90f4SJohn Crispin 	bool enable;
262796e90f4SJohn Crispin 	u8 min_offset;
263796e90f4SJohn Crispin 	u8 max_offset;
264796e90f4SJohn Crispin };
265796e90f4SJohn Crispin 
266796e90f4SJohn Crispin /**
2675c5e52d1SJohn Crispin  * struct cfg80211_he_bss_color - AP settings for BSS coloring
2685c5e52d1SJohn Crispin  *
2695c5e52d1SJohn Crispin  * @color: the current color.
2705c5e52d1SJohn Crispin  * @disabled: is the feature disabled.
2715c5e52d1SJohn Crispin  * @partial: define the AID equation.
2725c5e52d1SJohn Crispin  */
2735c5e52d1SJohn Crispin struct cfg80211_he_bss_color {
2745c5e52d1SJohn Crispin 	u8 color;
2755c5e52d1SJohn Crispin 	bool disabled;
2765c5e52d1SJohn Crispin 	bool partial;
2775c5e52d1SJohn Crispin };
2785c5e52d1SJohn Crispin 
2795c5e52d1SJohn Crispin /**
280dd56e902SJohn Crispin  * struct ieee80211_he_bss_color - AP settings for BSS coloring
281dd56e902SJohn Crispin  *
282dd56e902SJohn Crispin  * @color: the current color.
283dd56e902SJohn Crispin  * @disabled: is the feature disabled.
284dd56e902SJohn Crispin  * @partial: define the AID equation.
285dd56e902SJohn Crispin  */
286dd56e902SJohn Crispin struct ieee80211_he_bss_color {
287dd56e902SJohn Crispin 	u8 color;
288dd56e902SJohn Crispin 	bool disabled;
289dd56e902SJohn Crispin 	bool partial;
290dd56e902SJohn Crispin };
291dd56e902SJohn Crispin 
292dd56e902SJohn Crispin /**
293d3236553SJohannes Berg  * struct ieee80211_sta_ht_cap - STA's HT capabilities
294d3236553SJohannes Berg  *
295d3236553SJohannes Berg  * This structure describes most essential parameters needed
296d3236553SJohannes Berg  * to describe 802.11n HT capabilities for an STA.
297d3236553SJohannes Berg  *
298d3236553SJohannes Berg  * @ht_supported: is HT supported by the STA
299d3236553SJohannes Berg  * @cap: HT capabilities map as described in 802.11n spec
300d3236553SJohannes Berg  * @ampdu_factor: Maximum A-MPDU length factor
301d3236553SJohannes Berg  * @ampdu_density: Minimum A-MPDU spacing
302d3236553SJohannes Berg  * @mcs: Supported MCS rates
303d3236553SJohannes Berg  */
304d3236553SJohannes Berg struct ieee80211_sta_ht_cap {
305d3236553SJohannes Berg 	u16 cap; /* use IEEE80211_HT_CAP_ */
306d3236553SJohannes Berg 	bool ht_supported;
307d3236553SJohannes Berg 	u8 ampdu_factor;
308d3236553SJohannes Berg 	u8 ampdu_density;
309d3236553SJohannes Berg 	struct ieee80211_mcs_info mcs;
310d3236553SJohannes Berg };
311d3236553SJohannes Berg 
312d3236553SJohannes Berg /**
313bf0c111eSMahesh Palivela  * struct ieee80211_sta_vht_cap - STA's VHT capabilities
314bf0c111eSMahesh Palivela  *
315bf0c111eSMahesh Palivela  * This structure describes most essential parameters needed
316bf0c111eSMahesh Palivela  * to describe 802.11ac VHT capabilities for an STA.
317bf0c111eSMahesh Palivela  *
318bf0c111eSMahesh Palivela  * @vht_supported: is VHT supported by the STA
319bf0c111eSMahesh Palivela  * @cap: VHT capabilities map as described in 802.11ac spec
320bf0c111eSMahesh Palivela  * @vht_mcs: Supported VHT MCS rates
321bf0c111eSMahesh Palivela  */
322bf0c111eSMahesh Palivela struct ieee80211_sta_vht_cap {
323bf0c111eSMahesh Palivela 	bool vht_supported;
324bf0c111eSMahesh Palivela 	u32 cap; /* use IEEE80211_VHT_CAP_ */
325bf0c111eSMahesh Palivela 	struct ieee80211_vht_mcs_info vht_mcs;
326bf0c111eSMahesh Palivela };
327bf0c111eSMahesh Palivela 
328c4cbaf79SLuca Coelho #define IEEE80211_HE_PPE_THRES_MAX_LEN		25
329c4cbaf79SLuca Coelho 
330c4cbaf79SLuca Coelho /**
331c4cbaf79SLuca Coelho  * struct ieee80211_sta_he_cap - STA's HE capabilities
332c4cbaf79SLuca Coelho  *
333c4cbaf79SLuca Coelho  * This structure describes most essential parameters needed
334c4cbaf79SLuca Coelho  * to describe 802.11ax HE capabilities for a STA.
335c4cbaf79SLuca Coelho  *
336c4cbaf79SLuca Coelho  * @has_he: true iff HE data is valid.
337c4cbaf79SLuca Coelho  * @he_cap_elem: Fixed portion of the HE capabilities element.
338c4cbaf79SLuca Coelho  * @he_mcs_nss_supp: The supported NSS/MCS combinations.
339c4cbaf79SLuca Coelho  * @ppe_thres: Holds the PPE Thresholds data.
340c4cbaf79SLuca Coelho  */
341c4cbaf79SLuca Coelho struct ieee80211_sta_he_cap {
342c4cbaf79SLuca Coelho 	bool has_he;
343c4cbaf79SLuca Coelho 	struct ieee80211_he_cap_elem he_cap_elem;
344c4cbaf79SLuca Coelho 	struct ieee80211_he_mcs_nss_supp he_mcs_nss_supp;
345c4cbaf79SLuca Coelho 	u8 ppe_thres[IEEE80211_HE_PPE_THRES_MAX_LEN];
346c4cbaf79SLuca Coelho };
347c4cbaf79SLuca Coelho 
348c4cbaf79SLuca Coelho /**
349c4cbaf79SLuca Coelho  * struct ieee80211_sband_iftype_data
350c4cbaf79SLuca Coelho  *
351c4cbaf79SLuca Coelho  * This structure encapsulates sband data that is relevant for the
352c4cbaf79SLuca Coelho  * interface types defined in @types_mask.  Each type in the
353c4cbaf79SLuca Coelho  * @types_mask must be unique across all instances of iftype_data.
354c4cbaf79SLuca Coelho  *
355c4cbaf79SLuca Coelho  * @types_mask: interface types mask
356c4cbaf79SLuca Coelho  * @he_cap: holds the HE capabilities
35722395217SJohannes Berg  * @he_6ghz_capa: HE 6 GHz capabilities, must be filled in for a
35822395217SJohannes Berg  *	6 GHz band channel (and 0 may be valid value).
359c4cbaf79SLuca Coelho  */
360c4cbaf79SLuca Coelho struct ieee80211_sband_iftype_data {
361c4cbaf79SLuca Coelho 	u16 types_mask;
362c4cbaf79SLuca Coelho 	struct ieee80211_sta_he_cap he_cap;
36322395217SJohannes Berg 	struct ieee80211_he_6ghz_capa he_6ghz_capa;
364c4cbaf79SLuca Coelho };
365c4cbaf79SLuca Coelho 
366bf0c111eSMahesh Palivela /**
3672a38075cSAlexei Avshalom Lazar  * enum ieee80211_edmg_bw_config - allowed channel bandwidth configurations
3682a38075cSAlexei Avshalom Lazar  *
3692a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_4: 2.16GHz
3702a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_5: 2.16GHz and 4.32GHz
3712a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_6: 2.16GHz, 4.32GHz and 6.48GHz
3722a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_7: 2.16GHz, 4.32GHz, 6.48GHz and 8.64GHz
3732a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_8: 2.16GHz and 2.16GHz + 2.16GHz
3742a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_9: 2.16GHz, 4.32GHz and 2.16GHz + 2.16GHz
3752a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_10: 2.16GHz, 4.32GHz, 6.48GHz and 2.16GHz+2.16GHz
3762a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_11: 2.16GHz, 4.32GHz, 6.48GHz, 8.64GHz and
3772a38075cSAlexei Avshalom Lazar  *	2.16GHz+2.16GHz
3782a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_12: 2.16GHz, 2.16GHz + 2.16GHz and
3792a38075cSAlexei Avshalom Lazar  *	4.32GHz + 4.32GHz
3802a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_13: 2.16GHz, 4.32GHz, 2.16GHz + 2.16GHz and
3812a38075cSAlexei Avshalom Lazar  *	4.32GHz + 4.32GHz
3822a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_14: 2.16GHz, 4.32GHz, 6.48GHz, 2.16GHz + 2.16GHz
3832a38075cSAlexei Avshalom Lazar  *	and 4.32GHz + 4.32GHz
3842a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_15: 2.16GHz, 4.32GHz, 6.48GHz, 8.64GHz,
3852a38075cSAlexei Avshalom Lazar  *	2.16GHz + 2.16GHz and 4.32GHz + 4.32GHz
3862a38075cSAlexei Avshalom Lazar  */
3872a38075cSAlexei Avshalom Lazar enum ieee80211_edmg_bw_config {
3882a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_4	= 4,
3892a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_5	= 5,
3902a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_6	= 6,
3912a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_7	= 7,
3922a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_8	= 8,
3932a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_9	= 9,
3942a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_10	= 10,
3952a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_11	= 11,
3962a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_12	= 12,
3972a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_13	= 13,
3982a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_14	= 14,
3992a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_15	= 15,
4002a38075cSAlexei Avshalom Lazar };
4012a38075cSAlexei Avshalom Lazar 
4022a38075cSAlexei Avshalom Lazar /**
4032a38075cSAlexei Avshalom Lazar  * struct ieee80211_edmg - EDMG configuration
4042a38075cSAlexei Avshalom Lazar  *
4052a38075cSAlexei Avshalom Lazar  * This structure describes most essential parameters needed
4062a38075cSAlexei Avshalom Lazar  * to describe 802.11ay EDMG configuration
4072a38075cSAlexei Avshalom Lazar  *
4082a38075cSAlexei Avshalom Lazar  * @channels: bitmap that indicates the 2.16 GHz channel(s)
4092a38075cSAlexei Avshalom Lazar  *	that are allowed to be used for transmissions.
4102a38075cSAlexei Avshalom Lazar  *	Bit 0 indicates channel 1, bit 1 indicates channel 2, etc.
4112a38075cSAlexei Avshalom Lazar  *	Set to 0 indicate EDMG not supported.
4122a38075cSAlexei Avshalom Lazar  * @bw_config: Channel BW Configuration subfield encodes
4132a38075cSAlexei Avshalom Lazar  *	the allowed channel bandwidth configurations
4142a38075cSAlexei Avshalom Lazar  */
4152a38075cSAlexei Avshalom Lazar struct ieee80211_edmg {
4162a38075cSAlexei Avshalom Lazar 	u8 channels;
4172a38075cSAlexei Avshalom Lazar 	enum ieee80211_edmg_bw_config bw_config;
4182a38075cSAlexei Avshalom Lazar };
4192a38075cSAlexei Avshalom Lazar 
4202a38075cSAlexei Avshalom Lazar /**
421df78a0c0SThomas Pedersen  * struct ieee80211_sta_s1g_cap - STA's S1G capabilities
422df78a0c0SThomas Pedersen  *
423df78a0c0SThomas Pedersen  * This structure describes most essential parameters needed
424df78a0c0SThomas Pedersen  * to describe 802.11ah S1G capabilities for a STA.
425df78a0c0SThomas Pedersen  *
426df78a0c0SThomas Pedersen  * @s1g_supported: is STA an S1G STA
427df78a0c0SThomas Pedersen  * @cap: S1G capabilities information
428df78a0c0SThomas Pedersen  * @nss_mcs: Supported NSS MCS set
429df78a0c0SThomas Pedersen  */
430df78a0c0SThomas Pedersen struct ieee80211_sta_s1g_cap {
431df78a0c0SThomas Pedersen 	bool s1g;
432df78a0c0SThomas Pedersen 	u8 cap[10]; /* use S1G_CAPAB_ */
433df78a0c0SThomas Pedersen 	u8 nss_mcs[5];
434df78a0c0SThomas Pedersen };
435df78a0c0SThomas Pedersen 
436df78a0c0SThomas Pedersen /**
437d3236553SJohannes Berg  * struct ieee80211_supported_band - frequency band definition
438d3236553SJohannes Berg  *
439d3236553SJohannes Berg  * This structure describes a frequency band a wiphy
440d3236553SJohannes Berg  * is able to operate in.
441d3236553SJohannes Berg  *
442*085a6c10SRandy Dunlap  * @channels: Array of channels the hardware can operate with
443d3236553SJohannes Berg  *	in this band.
444d3236553SJohannes Berg  * @band: the band this structure represents
445d3236553SJohannes Berg  * @n_channels: Number of channels in @channels
446d3236553SJohannes Berg  * @bitrates: Array of bitrates the hardware can operate with
447d3236553SJohannes Berg  *	in this band. Must be sorted to give a valid "supported
448d3236553SJohannes Berg  *	rates" IE, i.e. CCK rates first, then OFDM.
449d3236553SJohannes Berg  * @n_bitrates: Number of bitrates in @bitrates
450abe37c4bSJohannes Berg  * @ht_cap: HT capabilities in this band
451c9a0a302SRobert P. J. Day  * @vht_cap: VHT capabilities in this band
4522a38075cSAlexei Avshalom Lazar  * @edmg_cap: EDMG capabilities in this band
453c4cbaf79SLuca Coelho  * @n_iftype_data: number of iftype data entries
454c4cbaf79SLuca Coelho  * @iftype_data: interface type data entries.  Note that the bits in
455c4cbaf79SLuca Coelho  *	@types_mask inside this structure cannot overlap (i.e. only
456c4cbaf79SLuca Coelho  *	one occurrence of each type is allowed across all instances of
457c4cbaf79SLuca Coelho  *	iftype_data).
458d3236553SJohannes Berg  */
459d3236553SJohannes Berg struct ieee80211_supported_band {
460d3236553SJohannes Berg 	struct ieee80211_channel *channels;
461d3236553SJohannes Berg 	struct ieee80211_rate *bitrates;
46257fbcce3SJohannes Berg 	enum nl80211_band band;
463d3236553SJohannes Berg 	int n_channels;
464d3236553SJohannes Berg 	int n_bitrates;
465d3236553SJohannes Berg 	struct ieee80211_sta_ht_cap ht_cap;
466bf0c111eSMahesh Palivela 	struct ieee80211_sta_vht_cap vht_cap;
467df78a0c0SThomas Pedersen 	struct ieee80211_sta_s1g_cap s1g_cap;
4682a38075cSAlexei Avshalom Lazar 	struct ieee80211_edmg edmg_cap;
469c4cbaf79SLuca Coelho 	u16 n_iftype_data;
470c4cbaf79SLuca Coelho 	const struct ieee80211_sband_iftype_data *iftype_data;
471d3236553SJohannes Berg };
472d3236553SJohannes Berg 
473e691ac2fSRafał Miłecki /**
474c4cbaf79SLuca Coelho  * ieee80211_get_sband_iftype_data - return sband data for a given iftype
475c4cbaf79SLuca Coelho  * @sband: the sband to search for the STA on
476c4cbaf79SLuca Coelho  * @iftype: enum nl80211_iftype
477c4cbaf79SLuca Coelho  *
478c4cbaf79SLuca Coelho  * Return: pointer to struct ieee80211_sband_iftype_data, or NULL is none found
479c4cbaf79SLuca Coelho  */
480c4cbaf79SLuca Coelho static inline const struct ieee80211_sband_iftype_data *
481c4cbaf79SLuca Coelho ieee80211_get_sband_iftype_data(const struct ieee80211_supported_band *sband,
482c4cbaf79SLuca Coelho 				u8 iftype)
483c4cbaf79SLuca Coelho {
484c4cbaf79SLuca Coelho 	int i;
485c4cbaf79SLuca Coelho 
486c4cbaf79SLuca Coelho 	if (WARN_ON(iftype >= NL80211_IFTYPE_MAX))
487c4cbaf79SLuca Coelho 		return NULL;
488c4cbaf79SLuca Coelho 
489c4cbaf79SLuca Coelho 	for (i = 0; i < sband->n_iftype_data; i++)  {
490c4cbaf79SLuca Coelho 		const struct ieee80211_sband_iftype_data *data =
491c4cbaf79SLuca Coelho 			&sband->iftype_data[i];
492c4cbaf79SLuca Coelho 
493c4cbaf79SLuca Coelho 		if (data->types_mask & BIT(iftype))
494c4cbaf79SLuca Coelho 			return data;
495c4cbaf79SLuca Coelho 	}
496c4cbaf79SLuca Coelho 
497c4cbaf79SLuca Coelho 	return NULL;
498c4cbaf79SLuca Coelho }
499c4cbaf79SLuca Coelho 
500c4cbaf79SLuca Coelho /**
501d7edf40cSJohn Crispin  * ieee80211_get_he_iftype_cap - return HE capabilities for an sband's iftype
502d7edf40cSJohn Crispin  * @sband: the sband to search for the iftype on
503d7edf40cSJohn Crispin  * @iftype: enum nl80211_iftype
504d7edf40cSJohn Crispin  *
505d7edf40cSJohn Crispin  * Return: pointer to the struct ieee80211_sta_he_cap, or NULL is none found
506d7edf40cSJohn Crispin  */
507d7edf40cSJohn Crispin static inline const struct ieee80211_sta_he_cap *
508d7edf40cSJohn Crispin ieee80211_get_he_iftype_cap(const struct ieee80211_supported_band *sband,
509d7edf40cSJohn Crispin 			    u8 iftype)
510d7edf40cSJohn Crispin {
511d7edf40cSJohn Crispin 	const struct ieee80211_sband_iftype_data *data =
512d7edf40cSJohn Crispin 		ieee80211_get_sband_iftype_data(sband, iftype);
513d7edf40cSJohn Crispin 
514d7edf40cSJohn Crispin 	if (data && data->he_cap.has_he)
515d7edf40cSJohn Crispin 		return &data->he_cap;
516d7edf40cSJohn Crispin 
517d7edf40cSJohn Crispin 	return NULL;
518d7edf40cSJohn Crispin }
519d7edf40cSJohn Crispin 
520d7edf40cSJohn Crispin /**
521c4cbaf79SLuca Coelho  * ieee80211_get_he_sta_cap - return HE capabilities for an sband's STA
522c4cbaf79SLuca Coelho  * @sband: the sband to search for the STA on
523c4cbaf79SLuca Coelho  *
524c4cbaf79SLuca Coelho  * Return: pointer to the struct ieee80211_sta_he_cap, or NULL is none found
525c4cbaf79SLuca Coelho  */
526c4cbaf79SLuca Coelho static inline const struct ieee80211_sta_he_cap *
527c4cbaf79SLuca Coelho ieee80211_get_he_sta_cap(const struct ieee80211_supported_band *sband)
528c4cbaf79SLuca Coelho {
529d7edf40cSJohn Crispin 	return ieee80211_get_he_iftype_cap(sband, NL80211_IFTYPE_STATION);
530c4cbaf79SLuca Coelho }
531c4cbaf79SLuca Coelho 
532c4cbaf79SLuca Coelho /**
5332ad2274cSIlan Peer  * ieee80211_get_he_6ghz_capa - return HE 6 GHz capabilities
5342ad2274cSIlan Peer  * @sband: the sband to search for the STA on
5352ad2274cSIlan Peer  * @iftype: the iftype to search for
5362ad2274cSIlan Peer  *
5372ad2274cSIlan Peer  * Return: the 6GHz capabilities
5382ad2274cSIlan Peer  */
5392ad2274cSIlan Peer static inline __le16
5402ad2274cSIlan Peer ieee80211_get_he_6ghz_capa(const struct ieee80211_supported_band *sband,
5412ad2274cSIlan Peer 			   enum nl80211_iftype iftype)
5422ad2274cSIlan Peer {
5432ad2274cSIlan Peer 	const struct ieee80211_sband_iftype_data *data =
5442ad2274cSIlan Peer 		ieee80211_get_sband_iftype_data(sband, iftype);
5452ad2274cSIlan Peer 
5462ad2274cSIlan Peer 	if (WARN_ON(!data || !data->he_cap.has_he))
5472ad2274cSIlan Peer 		return 0;
5482ad2274cSIlan Peer 
5492ad2274cSIlan Peer 	return data->he_6ghz_capa.capa;
5502ad2274cSIlan Peer }
5512ad2274cSIlan Peer 
5522ad2274cSIlan Peer /**
553e691ac2fSRafał Miłecki  * wiphy_read_of_freq_limits - read frequency limits from device tree
554e691ac2fSRafał Miłecki  *
555e691ac2fSRafał Miłecki  * @wiphy: the wireless device to get extra limits for
556e691ac2fSRafał Miłecki  *
557e691ac2fSRafał Miłecki  * Some devices may have extra limitations specified in DT. This may be useful
558e691ac2fSRafał Miłecki  * for chipsets that normally support more bands but are limited due to board
559e691ac2fSRafał Miłecki  * design (e.g. by antennas or external power amplifier).
560e691ac2fSRafał Miłecki  *
561e691ac2fSRafał Miłecki  * This function reads info from DT and uses it to *modify* channels (disable
562e691ac2fSRafał Miłecki  * unavailable ones). It's usually a *bad* idea to use it in drivers with
563e691ac2fSRafał Miłecki  * shared channel data as DT limitations are device specific. You should make
564e691ac2fSRafał Miłecki  * sure to call it only if channels in wiphy are copied and can be modified
565e691ac2fSRafał Miłecki  * without affecting other devices.
566e691ac2fSRafał Miłecki  *
567e691ac2fSRafał Miłecki  * As this function access device node it has to be called after set_wiphy_dev.
568e691ac2fSRafał Miłecki  * It also modifies channels so they have to be set first.
569e691ac2fSRafał Miłecki  * If using this helper, call it before wiphy_register().
570e691ac2fSRafał Miłecki  */
571e691ac2fSRafał Miłecki #ifdef CONFIG_OF
572e691ac2fSRafał Miłecki void wiphy_read_of_freq_limits(struct wiphy *wiphy);
573e691ac2fSRafał Miłecki #else /* CONFIG_OF */
574e691ac2fSRafał Miłecki static inline void wiphy_read_of_freq_limits(struct wiphy *wiphy)
575e691ac2fSRafał Miłecki {
576e691ac2fSRafał Miłecki }
577e691ac2fSRafał Miłecki #endif /* !CONFIG_OF */
578e691ac2fSRafał Miłecki 
579e691ac2fSRafał Miłecki 
580d3236553SJohannes Berg /*
581d3236553SJohannes Berg  * Wireless hardware/device configuration structures and methods
582704232c2SJohannes Berg  */
583704232c2SJohannes Berg 
5842ec600d6SLuis Carlos Cobo /**
585d70e9693SJohannes Berg  * DOC: Actions and configuration
586d70e9693SJohannes Berg  *
587d70e9693SJohannes Berg  * Each wireless device and each virtual interface offer a set of configuration
588d70e9693SJohannes Berg  * operations and other actions that are invoked by userspace. Each of these
589d70e9693SJohannes Berg  * actions is described in the operations structure, and the parameters these
590d70e9693SJohannes Berg  * operations use are described separately.
591d70e9693SJohannes Berg  *
592d70e9693SJohannes Berg  * Additionally, some operations are asynchronous and expect to get status
593d70e9693SJohannes Berg  * information via some functions that drivers need to call.
594d70e9693SJohannes Berg  *
595d70e9693SJohannes Berg  * Scanning and BSS list handling with its associated functionality is described
596d70e9693SJohannes Berg  * in a separate chapter.
597d70e9693SJohannes Berg  */
598d70e9693SJohannes Berg 
599c6e6a0c8SAviya Erenfeld #define VHT_MUMIMO_GROUPS_DATA_LEN (WLAN_MEMBERSHIP_LEN +\
600c6e6a0c8SAviya Erenfeld 				    WLAN_USER_POSITION_LEN)
601c6e6a0c8SAviya Erenfeld 
602d70e9693SJohannes Berg /**
6032ec600d6SLuis Carlos Cobo  * struct vif_params - describes virtual interface parameters
604818a986eSJohannes Berg  * @flags: monitor interface flags, unchanged if 0, otherwise
605818a986eSJohannes Berg  *	%MONITOR_FLAG_CHANGED will be set
6068b787643SFelix Fietkau  * @use_4addr: use 4-address frames
607e8f479b1SBen Greear  * @macaddr: address to use for this virtual interface.
608e8f479b1SBen Greear  *	If this parameter is set to zero address the driver may
609e8f479b1SBen Greear  *	determine the address as needed.
610e8f479b1SBen Greear  *	This feature is only fully supported by drivers that enable the
611e8f479b1SBen Greear  *	%NL80211_FEATURE_MAC_ON_CREATE flag.  Others may support creating
612e8f479b1SBen Greear  **	only p2p devices with specified MAC.
613b0265024SJohannes Berg  * @vht_mumimo_groups: MU-MIMO groupID, used for monitoring MU-MIMO packets
614b0265024SJohannes Berg  *	belonging to that MU-MIMO groupID; %NULL if not changed
615b0265024SJohannes Berg  * @vht_mumimo_follow_addr: MU-MIMO follow address, used for monitoring
616b0265024SJohannes Berg  *	MU-MIMO packets going to the specified station; %NULL if not changed
6172ec600d6SLuis Carlos Cobo  */
6182ec600d6SLuis Carlos Cobo struct vif_params {
619818a986eSJohannes Berg 	u32 flags;
6208b787643SFelix Fietkau 	int use_4addr;
6211c18f145SArend van Spriel 	u8 macaddr[ETH_ALEN];
622b0265024SJohannes Berg 	const u8 *vht_mumimo_groups;
623b0265024SJohannes Berg 	const u8 *vht_mumimo_follow_addr;
6242ec600d6SLuis Carlos Cobo };
6252ec600d6SLuis Carlos Cobo 
62641ade00fSJohannes Berg /**
62741ade00fSJohannes Berg  * struct key_params - key information
62841ade00fSJohannes Berg  *
62941ade00fSJohannes Berg  * Information about a key
63041ade00fSJohannes Berg  *
63141ade00fSJohannes Berg  * @key: key material
63241ade00fSJohannes Berg  * @key_len: length of key material
63341ade00fSJohannes Berg  * @cipher: cipher suite selector
63441ade00fSJohannes Berg  * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used
63541ade00fSJohannes Berg  *	with the get_key() callback, must be in little endian,
63641ade00fSJohannes Berg  *	length given by @seq_len.
637abe37c4bSJohannes Berg  * @seq_len: length of @seq.
63814f34e36SGurumoorthi Gnanasambandhan  * @vlan_id: vlan_id for VLAN group key (if nonzero)
6396cdd3979SAlexander Wetzel  * @mode: key install mode (RX_TX, NO_TX or SET_TX)
64041ade00fSJohannes Berg  */
64141ade00fSJohannes Berg struct key_params {
642c1e5f471SJohannes Berg 	const u8 *key;
643c1e5f471SJohannes Berg 	const u8 *seq;
64441ade00fSJohannes Berg 	int key_len;
64541ade00fSJohannes Berg 	int seq_len;
64614f34e36SGurumoorthi Gnanasambandhan 	u16 vlan_id;
64741ade00fSJohannes Berg 	u32 cipher;
6486cdd3979SAlexander Wetzel 	enum nl80211_key_mode mode;
64941ade00fSJohannes Berg };
65041ade00fSJohannes Berg 
651ed1b6cc7SJohannes Berg /**
652683b6d3bSJohannes Berg  * struct cfg80211_chan_def - channel definition
653683b6d3bSJohannes Berg  * @chan: the (control) channel
6543d9d1d66SJohannes Berg  * @width: channel width
6553d9d1d66SJohannes Berg  * @center_freq1: center frequency of first segment
6563d9d1d66SJohannes Berg  * @center_freq2: center frequency of second segment
6573d9d1d66SJohannes Berg  *	(only with 80+80 MHz)
6582a38075cSAlexei Avshalom Lazar  * @edmg: define the EDMG channels configuration.
6592a38075cSAlexei Avshalom Lazar  *	If edmg is requested (i.e. the .channels member is non-zero),
6602a38075cSAlexei Avshalom Lazar  *	chan will define the primary channel and all other
6612a38075cSAlexei Avshalom Lazar  *	parameters are ignored.
662934f4c7dSThomas Pedersen  * @freq1_offset: offset from @center_freq1, in KHz
663683b6d3bSJohannes Berg  */
664683b6d3bSJohannes Berg struct cfg80211_chan_def {
665683b6d3bSJohannes Berg 	struct ieee80211_channel *chan;
6663d9d1d66SJohannes Berg 	enum nl80211_chan_width width;
6673d9d1d66SJohannes Berg 	u32 center_freq1;
6683d9d1d66SJohannes Berg 	u32 center_freq2;
6692a38075cSAlexei Avshalom Lazar 	struct ieee80211_edmg edmg;
670934f4c7dSThomas Pedersen 	u16 freq1_offset;
671683b6d3bSJohannes Berg };
672683b6d3bSJohannes Berg 
6739a5f6488STamizh Chelvam /*
6749a5f6488STamizh Chelvam  * cfg80211_bitrate_mask - masks for bitrate control
6759a5f6488STamizh Chelvam  */
6769a5f6488STamizh Chelvam struct cfg80211_bitrate_mask {
6779a5f6488STamizh Chelvam 	struct {
6789a5f6488STamizh Chelvam 		u32 legacy;
6799a5f6488STamizh Chelvam 		u8 ht_mcs[IEEE80211_HT_MCS_MASK_LEN];
6809a5f6488STamizh Chelvam 		u16 vht_mcs[NL80211_VHT_NSS_MAX];
6819a5f6488STamizh Chelvam 		enum nl80211_txrate_gi gi;
6829a5f6488STamizh Chelvam 	} control[NUM_NL80211_BANDS];
6839a5f6488STamizh Chelvam };
6849a5f6488STamizh Chelvam 
6859a5f6488STamizh Chelvam 
68677f576deSTamizh chelvam /**
6873710a8a6SJohannes Berg  * struct cfg80211_tid_cfg - TID specific configuration
68877f576deSTamizh chelvam  * @config_override: Flag to notify driver to reset TID configuration
68977f576deSTamizh chelvam  *	of the peer.
6903710a8a6SJohannes Berg  * @tids: bitmap of TIDs to modify
6913710a8a6SJohannes Berg  * @mask: bitmap of attributes indicating which parameter changed,
6923710a8a6SJohannes Berg  *	similar to &nl80211_tid_config_supp.
69377f576deSTamizh chelvam  * @noack: noack configuration value for the TID
6946a21d16cSTamizh chelvam  * @retry_long: retry count value
6956a21d16cSTamizh chelvam  * @retry_short: retry count value
69633462e68SSergey Matyukevich  * @ampdu: Enable/Disable MPDU aggregation
69704f7d142STamizh chelvam  * @rtscts: Enable/Disable RTS/CTS
69833462e68SSergey Matyukevich  * @amsdu: Enable/Disable MSDU aggregation
6999a5f6488STamizh Chelvam  * @txrate_type: Tx bitrate mask type
7009a5f6488STamizh Chelvam  * @txrate_mask: Tx bitrate to be applied for the TID
70177f576deSTamizh chelvam  */
7023710a8a6SJohannes Berg struct cfg80211_tid_cfg {
70377f576deSTamizh chelvam 	bool config_override;
7043710a8a6SJohannes Berg 	u8 tids;
7052d5d9b7fSSergey Matyukevich 	u64 mask;
70677f576deSTamizh chelvam 	enum nl80211_tid_config noack;
7076a21d16cSTamizh chelvam 	u8 retry_long, retry_short;
708ade274b2STamizh chelvam 	enum nl80211_tid_config ampdu;
70904f7d142STamizh chelvam 	enum nl80211_tid_config rtscts;
71033462e68SSergey Matyukevich 	enum nl80211_tid_config amsdu;
7119a5f6488STamizh Chelvam 	enum nl80211_tx_rate_setting txrate_type;
7129a5f6488STamizh Chelvam 	struct cfg80211_bitrate_mask txrate_mask;
71377f576deSTamizh chelvam };
71477f576deSTamizh chelvam 
71577f576deSTamizh chelvam /**
7163710a8a6SJohannes Berg  * struct cfg80211_tid_config - TID configuration
71777f576deSTamizh chelvam  * @peer: Station's MAC address
71877f576deSTamizh chelvam  * @n_tid_conf: Number of TID specific configurations to be applied
71977f576deSTamizh chelvam  * @tid_conf: Configuration change info
72077f576deSTamizh chelvam  */
7213710a8a6SJohannes Berg struct cfg80211_tid_config {
72277f576deSTamizh chelvam 	const u8 *peer;
72377f576deSTamizh chelvam 	u32 n_tid_conf;
7243710a8a6SJohannes Berg 	struct cfg80211_tid_cfg tid_conf[];
72577f576deSTamizh chelvam };
72677f576deSTamizh chelvam 
7273d9d1d66SJohannes Berg /**
7283d9d1d66SJohannes Berg  * cfg80211_get_chandef_type - return old channel type from chandef
7293d9d1d66SJohannes Berg  * @chandef: the channel definition
7303d9d1d66SJohannes Berg  *
7310ae997dcSYacine Belkadi  * Return: The old channel type (NOHT, HT20, HT40+/-) from a given
7323d9d1d66SJohannes Berg  * chandef, which must have a bandwidth allowing this conversion.
7333d9d1d66SJohannes Berg  */
734683b6d3bSJohannes Berg static inline enum nl80211_channel_type
735683b6d3bSJohannes Berg cfg80211_get_chandef_type(const struct cfg80211_chan_def *chandef)
736683b6d3bSJohannes Berg {
7373d9d1d66SJohannes Berg 	switch (chandef->width) {
7383d9d1d66SJohannes Berg 	case NL80211_CHAN_WIDTH_20_NOHT:
7393d9d1d66SJohannes Berg 		return NL80211_CHAN_NO_HT;
7403d9d1d66SJohannes Berg 	case NL80211_CHAN_WIDTH_20:
7413d9d1d66SJohannes Berg 		return NL80211_CHAN_HT20;
7423d9d1d66SJohannes Berg 	case NL80211_CHAN_WIDTH_40:
7433d9d1d66SJohannes Berg 		if (chandef->center_freq1 > chandef->chan->center_freq)
7443d9d1d66SJohannes Berg 			return NL80211_CHAN_HT40PLUS;
7453d9d1d66SJohannes Berg 		return NL80211_CHAN_HT40MINUS;
7463d9d1d66SJohannes Berg 	default:
7473d9d1d66SJohannes Berg 		WARN_ON(1);
7483d9d1d66SJohannes Berg 		return NL80211_CHAN_NO_HT;
749683b6d3bSJohannes Berg 	}
7503d9d1d66SJohannes Berg }
7513d9d1d66SJohannes Berg 
7523d9d1d66SJohannes Berg /**
7533d9d1d66SJohannes Berg  * cfg80211_chandef_create - create channel definition using channel type
7543d9d1d66SJohannes Berg  * @chandef: the channel definition struct to fill
7553d9d1d66SJohannes Berg  * @channel: the control channel
7563d9d1d66SJohannes Berg  * @chantype: the channel type
7573d9d1d66SJohannes Berg  *
7583d9d1d66SJohannes Berg  * Given a channel type, create a channel definition.
7593d9d1d66SJohannes Berg  */
7603d9d1d66SJohannes Berg void cfg80211_chandef_create(struct cfg80211_chan_def *chandef,
7613d9d1d66SJohannes Berg 			     struct ieee80211_channel *channel,
7623d9d1d66SJohannes Berg 			     enum nl80211_channel_type chantype);
7633d9d1d66SJohannes Berg 
7643d9d1d66SJohannes Berg /**
7653d9d1d66SJohannes Berg  * cfg80211_chandef_identical - check if two channel definitions are identical
7663d9d1d66SJohannes Berg  * @chandef1: first channel definition
7673d9d1d66SJohannes Berg  * @chandef2: second channel definition
7683d9d1d66SJohannes Berg  *
7690ae997dcSYacine Belkadi  * Return: %true if the channels defined by the channel definitions are
7703d9d1d66SJohannes Berg  * identical, %false otherwise.
7713d9d1d66SJohannes Berg  */
7723d9d1d66SJohannes Berg static inline bool
7733d9d1d66SJohannes Berg cfg80211_chandef_identical(const struct cfg80211_chan_def *chandef1,
7743d9d1d66SJohannes Berg 			   const struct cfg80211_chan_def *chandef2)
7753d9d1d66SJohannes Berg {
7763d9d1d66SJohannes Berg 	return (chandef1->chan == chandef2->chan &&
7773d9d1d66SJohannes Berg 		chandef1->width == chandef2->width &&
7783d9d1d66SJohannes Berg 		chandef1->center_freq1 == chandef2->center_freq1 &&
779934f4c7dSThomas Pedersen 		chandef1->freq1_offset == chandef2->freq1_offset &&
7803d9d1d66SJohannes Berg 		chandef1->center_freq2 == chandef2->center_freq2);
7813d9d1d66SJohannes Berg }
7823d9d1d66SJohannes Berg 
7833d9d1d66SJohannes Berg /**
7842a38075cSAlexei Avshalom Lazar  * cfg80211_chandef_is_edmg - check if chandef represents an EDMG channel
7852a38075cSAlexei Avshalom Lazar  *
7862a38075cSAlexei Avshalom Lazar  * @chandef: the channel definition
7872a38075cSAlexei Avshalom Lazar  *
7882a38075cSAlexei Avshalom Lazar  * Return: %true if EDMG defined, %false otherwise.
7892a38075cSAlexei Avshalom Lazar  */
7902a38075cSAlexei Avshalom Lazar static inline bool
7912a38075cSAlexei Avshalom Lazar cfg80211_chandef_is_edmg(const struct cfg80211_chan_def *chandef)
7922a38075cSAlexei Avshalom Lazar {
7932a38075cSAlexei Avshalom Lazar 	return chandef->edmg.channels || chandef->edmg.bw_config;
7942a38075cSAlexei Avshalom Lazar }
7952a38075cSAlexei Avshalom Lazar 
7962a38075cSAlexei Avshalom Lazar /**
7973d9d1d66SJohannes Berg  * cfg80211_chandef_compatible - check if two channel definitions are compatible
7983d9d1d66SJohannes Berg  * @chandef1: first channel definition
7993d9d1d66SJohannes Berg  * @chandef2: second channel definition
8003d9d1d66SJohannes Berg  *
8010ae997dcSYacine Belkadi  * Return: %NULL if the given channel definitions are incompatible,
8023d9d1d66SJohannes Berg  * chandef1 or chandef2 otherwise.
8033d9d1d66SJohannes Berg  */
8043d9d1d66SJohannes Berg const struct cfg80211_chan_def *
8053d9d1d66SJohannes Berg cfg80211_chandef_compatible(const struct cfg80211_chan_def *chandef1,
8063d9d1d66SJohannes Berg 			    const struct cfg80211_chan_def *chandef2);
807683b6d3bSJohannes Berg 
808683b6d3bSJohannes Berg /**
8099f5e8f6eSJohannes Berg  * cfg80211_chandef_valid - check if a channel definition is valid
8109f5e8f6eSJohannes Berg  * @chandef: the channel definition to check
8110ae997dcSYacine Belkadi  * Return: %true if the channel definition is valid. %false otherwise.
8129f5e8f6eSJohannes Berg  */
8139f5e8f6eSJohannes Berg bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef);
8149f5e8f6eSJohannes Berg 
8159f5e8f6eSJohannes Berg /**
8169f5e8f6eSJohannes Berg  * cfg80211_chandef_usable - check if secondary channels can be used
8179f5e8f6eSJohannes Berg  * @wiphy: the wiphy to validate against
8189f5e8f6eSJohannes Berg  * @chandef: the channel definition to check
8190ae997dcSYacine Belkadi  * @prohibited_flags: the regulatory channel flags that must not be set
8200ae997dcSYacine Belkadi  * Return: %true if secondary channels are usable. %false otherwise.
8219f5e8f6eSJohannes Berg  */
8229f5e8f6eSJohannes Berg bool cfg80211_chandef_usable(struct wiphy *wiphy,
8239f5e8f6eSJohannes Berg 			     const struct cfg80211_chan_def *chandef,
8249f5e8f6eSJohannes Berg 			     u32 prohibited_flags);
8259f5e8f6eSJohannes Berg 
8269f5e8f6eSJohannes Berg /**
827774f0734SSimon Wunderlich  * cfg80211_chandef_dfs_required - checks if radar detection is required
828774f0734SSimon Wunderlich  * @wiphy: the wiphy to validate against
829774f0734SSimon Wunderlich  * @chandef: the channel definition to check
8302beb6dabSLuciano Coelho  * @iftype: the interface type as specified in &enum nl80211_iftype
8312beb6dabSLuciano Coelho  * Returns:
8322beb6dabSLuciano Coelho  *	1 if radar detection is required, 0 if it is not, < 0 on error
833774f0734SSimon Wunderlich  */
834774f0734SSimon Wunderlich int cfg80211_chandef_dfs_required(struct wiphy *wiphy,
8352beb6dabSLuciano Coelho 				  const struct cfg80211_chan_def *chandef,
836c3d62036SLuciano Coelho 				  enum nl80211_iftype iftype);
837774f0734SSimon Wunderlich 
838774f0734SSimon Wunderlich /**
83930e74732SSimon Wunderlich  * ieee80211_chandef_rate_flags - returns rate flags for a channel
84030e74732SSimon Wunderlich  *
84130e74732SSimon Wunderlich  * In some channel types, not all rates may be used - for example CCK
84230e74732SSimon Wunderlich  * rates may not be used in 5/10 MHz channels.
84330e74732SSimon Wunderlich  *
84430e74732SSimon Wunderlich  * @chandef: channel definition for the channel
84530e74732SSimon Wunderlich  *
84630e74732SSimon Wunderlich  * Returns: rate flags which apply for this channel
84730e74732SSimon Wunderlich  */
84830e74732SSimon Wunderlich static inline enum ieee80211_rate_flags
84930e74732SSimon Wunderlich ieee80211_chandef_rate_flags(struct cfg80211_chan_def *chandef)
85030e74732SSimon Wunderlich {
85130e74732SSimon Wunderlich 	switch (chandef->width) {
85230e74732SSimon Wunderlich 	case NL80211_CHAN_WIDTH_5:
85330e74732SSimon Wunderlich 		return IEEE80211_RATE_SUPPORTS_5MHZ;
85430e74732SSimon Wunderlich 	case NL80211_CHAN_WIDTH_10:
85530e74732SSimon Wunderlich 		return IEEE80211_RATE_SUPPORTS_10MHZ;
85630e74732SSimon Wunderlich 	default:
85730e74732SSimon Wunderlich 		break;
85830e74732SSimon Wunderlich 	}
85930e74732SSimon Wunderlich 	return 0;
86030e74732SSimon Wunderlich }
86130e74732SSimon Wunderlich 
86230e74732SSimon Wunderlich /**
8630430c883SSimon Wunderlich  * ieee80211_chandef_max_power - maximum transmission power for the chandef
8640430c883SSimon Wunderlich  *
8650430c883SSimon Wunderlich  * In some regulations, the transmit power may depend on the configured channel
8660430c883SSimon Wunderlich  * bandwidth which may be defined as dBm/MHz. This function returns the actual
8670430c883SSimon Wunderlich  * max_power for non-standard (20 MHz) channels.
8680430c883SSimon Wunderlich  *
8690430c883SSimon Wunderlich  * @chandef: channel definition for the channel
8700430c883SSimon Wunderlich  *
8710430c883SSimon Wunderlich  * Returns: maximum allowed transmission power in dBm for the chandef
8720430c883SSimon Wunderlich  */
8730430c883SSimon Wunderlich static inline int
8740430c883SSimon Wunderlich ieee80211_chandef_max_power(struct cfg80211_chan_def *chandef)
8750430c883SSimon Wunderlich {
8760430c883SSimon Wunderlich 	switch (chandef->width) {
8770430c883SSimon Wunderlich 	case NL80211_CHAN_WIDTH_5:
8780430c883SSimon Wunderlich 		return min(chandef->chan->max_reg_power - 6,
8790430c883SSimon Wunderlich 			   chandef->chan->max_power);
8800430c883SSimon Wunderlich 	case NL80211_CHAN_WIDTH_10:
8810430c883SSimon Wunderlich 		return min(chandef->chan->max_reg_power - 3,
8820430c883SSimon Wunderlich 			   chandef->chan->max_power);
8830430c883SSimon Wunderlich 	default:
8840430c883SSimon Wunderlich 		break;
8850430c883SSimon Wunderlich 	}
8860430c883SSimon Wunderlich 	return chandef->chan->max_power;
8870430c883SSimon Wunderlich }
8880430c883SSimon Wunderlich 
8890430c883SSimon Wunderlich /**
89061fa713cSHolger Schurig  * enum survey_info_flags - survey information flags
89161fa713cSHolger Schurig  *
892abe37c4bSJohannes Berg  * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in
89317e5a808SFelix Fietkau  * @SURVEY_INFO_IN_USE: channel is currently being used
8944ed20bebSJohannes Berg  * @SURVEY_INFO_TIME: active time (in ms) was filled in
8954ed20bebSJohannes Berg  * @SURVEY_INFO_TIME_BUSY: busy time was filled in
8964ed20bebSJohannes Berg  * @SURVEY_INFO_TIME_EXT_BUSY: extension channel busy time was filled in
8974ed20bebSJohannes Berg  * @SURVEY_INFO_TIME_RX: receive time was filled in
8984ed20bebSJohannes Berg  * @SURVEY_INFO_TIME_TX: transmit time was filled in
899052536abSJohannes Berg  * @SURVEY_INFO_TIME_SCAN: scan time was filled in
900c8cd6e7fSFelix Fietkau  * @SURVEY_INFO_TIME_BSS_RX: local BSS receive time was filled in
901abe37c4bSJohannes Berg  *
90261fa713cSHolger Schurig  * Used by the driver to indicate which info in &struct survey_info
90361fa713cSHolger Schurig  * it has filled in during the get_survey().
90461fa713cSHolger Schurig  */
90561fa713cSHolger Schurig enum survey_info_flags {
9064ed20bebSJohannes Berg 	SURVEY_INFO_NOISE_DBM		= BIT(0),
9074ed20bebSJohannes Berg 	SURVEY_INFO_IN_USE		= BIT(1),
9084ed20bebSJohannes Berg 	SURVEY_INFO_TIME		= BIT(2),
9094ed20bebSJohannes Berg 	SURVEY_INFO_TIME_BUSY		= BIT(3),
9104ed20bebSJohannes Berg 	SURVEY_INFO_TIME_EXT_BUSY	= BIT(4),
9114ed20bebSJohannes Berg 	SURVEY_INFO_TIME_RX		= BIT(5),
9124ed20bebSJohannes Berg 	SURVEY_INFO_TIME_TX		= BIT(6),
913052536abSJohannes Berg 	SURVEY_INFO_TIME_SCAN		= BIT(7),
914c8cd6e7fSFelix Fietkau 	SURVEY_INFO_TIME_BSS_RX		= BIT(8),
91561fa713cSHolger Schurig };
91661fa713cSHolger Schurig 
91761fa713cSHolger Schurig /**
91861fa713cSHolger Schurig  * struct survey_info - channel survey response
91961fa713cSHolger Schurig  *
92011f78ac3SJohannes Berg  * @channel: the channel this survey record reports, may be %NULL for a single
92111f78ac3SJohannes Berg  *	record to report global statistics
92261fa713cSHolger Schurig  * @filled: bitflag of flags from &enum survey_info_flags
92361fa713cSHolger Schurig  * @noise: channel noise in dBm. This and all following fields are
92461fa713cSHolger Schurig  *	optional
9254ed20bebSJohannes Berg  * @time: amount of time in ms the radio was turn on (on the channel)
9264ed20bebSJohannes Berg  * @time_busy: amount of time the primary channel was sensed busy
9274ed20bebSJohannes Berg  * @time_ext_busy: amount of time the extension channel was sensed busy
9284ed20bebSJohannes Berg  * @time_rx: amount of time the radio spent receiving data
9294ed20bebSJohannes Berg  * @time_tx: amount of time the radio spent transmitting data
930052536abSJohannes Berg  * @time_scan: amount of time the radio spent for scanning
931c8cd6e7fSFelix Fietkau  * @time_bss_rx: amount of time the radio spent receiving data on a local BSS
93261fa713cSHolger Schurig  *
933abe37c4bSJohannes Berg  * Used by dump_survey() to report back per-channel survey information.
934abe37c4bSJohannes Berg  *
93561fa713cSHolger Schurig  * This structure can later be expanded with things like
93661fa713cSHolger Schurig  * channel duty cycle etc.
93761fa713cSHolger Schurig  */
93861fa713cSHolger Schurig struct survey_info {
93961fa713cSHolger Schurig 	struct ieee80211_channel *channel;
9404ed20bebSJohannes Berg 	u64 time;
9414ed20bebSJohannes Berg 	u64 time_busy;
9424ed20bebSJohannes Berg 	u64 time_ext_busy;
9434ed20bebSJohannes Berg 	u64 time_rx;
9444ed20bebSJohannes Berg 	u64 time_tx;
945052536abSJohannes Berg 	u64 time_scan;
946c8cd6e7fSFelix Fietkau 	u64 time_bss_rx;
94761fa713cSHolger Schurig 	u32 filled;
94861fa713cSHolger Schurig 	s8 noise;
94961fa713cSHolger Schurig };
95061fa713cSHolger Schurig 
951b8676221SDavid Spinadel #define CFG80211_MAX_WEP_KEYS	4
952b8676221SDavid Spinadel 
95361fa713cSHolger Schurig /**
9545fb628e9SJouni Malinen  * struct cfg80211_crypto_settings - Crypto settings
9555fb628e9SJouni Malinen  * @wpa_versions: indicates which, if any, WPA versions are enabled
9565fb628e9SJouni Malinen  *	(from enum nl80211_wpa_versions)
9575fb628e9SJouni Malinen  * @cipher_group: group key cipher suite (or 0 if unset)
9585fb628e9SJouni Malinen  * @n_ciphers_pairwise: number of AP supported unicast ciphers
9595fb628e9SJouni Malinen  * @ciphers_pairwise: unicast key cipher suites
9605fb628e9SJouni Malinen  * @n_akm_suites: number of AKM suites
9615fb628e9SJouni Malinen  * @akm_suites: AKM suites
9625fb628e9SJouni Malinen  * @control_port: Whether user space controls IEEE 802.1X port, i.e.,
9635fb628e9SJouni Malinen  *	sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
9645fb628e9SJouni Malinen  *	required to assume that the port is unauthorized until authorized by
9655fb628e9SJouni Malinen  *	user space. Otherwise, port is marked authorized by default.
9665fb628e9SJouni Malinen  * @control_port_ethertype: the control port protocol that should be
9675fb628e9SJouni Malinen  *	allowed through even on unauthorized ports
9685fb628e9SJouni Malinen  * @control_port_no_encrypt: TRUE to prevent encryption of control port
9695fb628e9SJouni Malinen  *	protocol frames.
97064bf3d4bSDenis Kenzior  * @control_port_over_nl80211: TRUE if userspace expects to exchange control
97164bf3d4bSDenis Kenzior  *	port frames over NL80211 instead of the network interface.
972a710d214SLothar Rubusch  * @control_port_no_preauth: disables pre-auth rx over the nl80211 control
973a710d214SLothar Rubusch  *	port for mac80211
974b8676221SDavid Spinadel  * @wep_keys: static WEP keys, if not NULL points to an array of
975b8676221SDavid Spinadel  *	CFG80211_MAX_WEP_KEYS WEP keys
976b8676221SDavid Spinadel  * @wep_tx_key: key index (0..3) of the default TX static WEP key
97791b5ab62SEliad Peller  * @psk: PSK (for devices supporting 4-way-handshake offload)
97826f7044eSChung-Hsien Hsu  * @sae_pwd: password for SAE authentication (for devices supporting SAE
97926f7044eSChung-Hsien Hsu  *	offload)
98026f7044eSChung-Hsien Hsu  * @sae_pwd_len: length of SAE password (for devices supporting SAE offload)
9815fb628e9SJouni Malinen  */
9825fb628e9SJouni Malinen struct cfg80211_crypto_settings {
9835fb628e9SJouni Malinen 	u32 wpa_versions;
9845fb628e9SJouni Malinen 	u32 cipher_group;
9855fb628e9SJouni Malinen 	int n_ciphers_pairwise;
9865fb628e9SJouni Malinen 	u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES];
9875fb628e9SJouni Malinen 	int n_akm_suites;
9885fb628e9SJouni Malinen 	u32 akm_suites[NL80211_MAX_NR_AKM_SUITES];
9895fb628e9SJouni Malinen 	bool control_port;
9905fb628e9SJouni Malinen 	__be16 control_port_ethertype;
9915fb628e9SJouni Malinen 	bool control_port_no_encrypt;
99264bf3d4bSDenis Kenzior 	bool control_port_over_nl80211;
9937f3f96ceSMarkus Theil 	bool control_port_no_preauth;
994b8676221SDavid Spinadel 	struct key_params *wep_keys;
995b8676221SDavid Spinadel 	int wep_tx_key;
99691b5ab62SEliad Peller 	const u8 *psk;
99726f7044eSChung-Hsien Hsu 	const u8 *sae_pwd;
99826f7044eSChung-Hsien Hsu 	u8 sae_pwd_len;
9995fb628e9SJouni Malinen };
10005fb628e9SJouni Malinen 
10015fb628e9SJouni Malinen /**
10028860020eSJohannes Berg  * struct cfg80211_beacon_data - beacon data
1003ed1b6cc7SJohannes Berg  * @head: head portion of beacon (before TIM IE)
1004ed1b6cc7SJohannes Berg  *	or %NULL if not changed
1005ed1b6cc7SJohannes Berg  * @tail: tail portion of beacon (after TIM IE)
1006ed1b6cc7SJohannes Berg  *	or %NULL if not changed
1007ed1b6cc7SJohannes Berg  * @head_len: length of @head
1008ed1b6cc7SJohannes Berg  * @tail_len: length of @tail
10099946ecfbSJouni Malinen  * @beacon_ies: extra information element(s) to add into Beacon frames or %NULL
10109946ecfbSJouni Malinen  * @beacon_ies_len: length of beacon_ies in octets
10119946ecfbSJouni Malinen  * @proberesp_ies: extra information element(s) to add into Probe Response
10129946ecfbSJouni Malinen  *	frames or %NULL
10139946ecfbSJouni Malinen  * @proberesp_ies_len: length of proberesp_ies in octets
10149946ecfbSJouni Malinen  * @assocresp_ies: extra information element(s) to add into (Re)Association
10159946ecfbSJouni Malinen  *	Response frames or %NULL
10169946ecfbSJouni Malinen  * @assocresp_ies_len: length of assocresp_ies in octets
101700f740e1SArik Nemtsov  * @probe_resp_len: length of probe response template (@probe_resp)
101800f740e1SArik Nemtsov  * @probe_resp: probe response template (AP mode only)
101981e54d08SPradeep Kumar Chitrapu  * @ftm_responder: enable FTM responder functionality; -1 for no change
102081e54d08SPradeep Kumar Chitrapu  *	(which also implies no change in LCI/civic location data)
102130db641eSJohannes Berg  * @lci: Measurement Report element content, starting with Measurement Token
102230db641eSJohannes Berg  *	(measurement type 8)
102330db641eSJohannes Berg  * @civicloc: Measurement Report element content, starting with Measurement
102430db641eSJohannes Berg  *	Token (measurement type 11)
102581e54d08SPradeep Kumar Chitrapu  * @lci_len: LCI data length
102681e54d08SPradeep Kumar Chitrapu  * @civicloc_len: Civic location data length
1027ed1b6cc7SJohannes Berg  */
10288860020eSJohannes Berg struct cfg80211_beacon_data {
10298860020eSJohannes Berg 	const u8 *head, *tail;
10308860020eSJohannes Berg 	const u8 *beacon_ies;
10318860020eSJohannes Berg 	const u8 *proberesp_ies;
10328860020eSJohannes Berg 	const u8 *assocresp_ies;
10338860020eSJohannes Berg 	const u8 *probe_resp;
103481e54d08SPradeep Kumar Chitrapu 	const u8 *lci;
103581e54d08SPradeep Kumar Chitrapu 	const u8 *civicloc;
103681e54d08SPradeep Kumar Chitrapu 	s8 ftm_responder;
10378860020eSJohannes Berg 
10388860020eSJohannes Berg 	size_t head_len, tail_len;
10398860020eSJohannes Berg 	size_t beacon_ies_len;
10408860020eSJohannes Berg 	size_t proberesp_ies_len;
10418860020eSJohannes Berg 	size_t assocresp_ies_len;
10428860020eSJohannes Berg 	size_t probe_resp_len;
104381e54d08SPradeep Kumar Chitrapu 	size_t lci_len;
104481e54d08SPradeep Kumar Chitrapu 	size_t civicloc_len;
10458860020eSJohannes Berg };
10468860020eSJohannes Berg 
10476d45a74bSVasanthakumar Thiagarajan struct mac_address {
10486d45a74bSVasanthakumar Thiagarajan 	u8 addr[ETH_ALEN];
10496d45a74bSVasanthakumar Thiagarajan };
10506d45a74bSVasanthakumar Thiagarajan 
10518860020eSJohannes Berg /**
105277765eafSVasanthakumar Thiagarajan  * struct cfg80211_acl_data - Access control list data
105377765eafSVasanthakumar Thiagarajan  *
105477765eafSVasanthakumar Thiagarajan  * @acl_policy: ACL policy to be applied on the station's
1055077f897aSJohannes Berg  *	entry specified by mac_addr
105677765eafSVasanthakumar Thiagarajan  * @n_acl_entries: Number of MAC address entries passed
105777765eafSVasanthakumar Thiagarajan  * @mac_addrs: List of MAC addresses of stations to be used for ACL
105877765eafSVasanthakumar Thiagarajan  */
105977765eafSVasanthakumar Thiagarajan struct cfg80211_acl_data {
106077765eafSVasanthakumar Thiagarajan 	enum nl80211_acl_policy acl_policy;
106177765eafSVasanthakumar Thiagarajan 	int n_acl_entries;
106277765eafSVasanthakumar Thiagarajan 
106377765eafSVasanthakumar Thiagarajan 	/* Keep it last */
106477765eafSVasanthakumar Thiagarajan 	struct mac_address mac_addrs[];
106577765eafSVasanthakumar Thiagarajan };
106677765eafSVasanthakumar Thiagarajan 
10678860020eSJohannes Berg /**
1068fe494370SSrinivas Dasari  * enum cfg80211_ap_settings_flags - AP settings flags
1069fe494370SSrinivas Dasari  *
1070fe494370SSrinivas Dasari  * Used by cfg80211_ap_settings
1071fe494370SSrinivas Dasari  *
1072fe494370SSrinivas Dasari  * @AP_SETTINGS_EXTERNAL_AUTH_SUPPORT: AP supports external authentication
1073fe494370SSrinivas Dasari  */
1074fe494370SSrinivas Dasari enum cfg80211_ap_settings_flags {
1075fe494370SSrinivas Dasari 	AP_SETTINGS_EXTERNAL_AUTH_SUPPORT = BIT(0),
1076fe494370SSrinivas Dasari };
1077fe494370SSrinivas Dasari 
1078fe494370SSrinivas Dasari /**
10798860020eSJohannes Berg  * struct cfg80211_ap_settings - AP configuration
10808860020eSJohannes Berg  *
10818860020eSJohannes Berg  * Used to configure an AP interface.
10828860020eSJohannes Berg  *
1083683b6d3bSJohannes Berg  * @chandef: defines the channel to use
10848860020eSJohannes Berg  * @beacon: beacon data
10858860020eSJohannes Berg  * @beacon_interval: beacon interval
10868860020eSJohannes Berg  * @dtim_period: DTIM period
10878860020eSJohannes Berg  * @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from
10888860020eSJohannes Berg  *	user space)
10898860020eSJohannes Berg  * @ssid_len: length of @ssid
10908860020eSJohannes Berg  * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames
10918860020eSJohannes Berg  * @crypto: crypto settings
10928860020eSJohannes Berg  * @privacy: the BSS uses privacy
10938860020eSJohannes Berg  * @auth_type: Authentication type (algorithm)
109418998c38SEliad Peller  * @smps_mode: SMPS mode
10951b658f11SVasanthakumar Thiagarajan  * @inactivity_timeout: time in seconds to determine station's inactivity.
109653cabad7SJohannes Berg  * @p2p_ctwindow: P2P CT Window
109753cabad7SJohannes Berg  * @p2p_opp_ps: P2P opportunistic PS
109877765eafSVasanthakumar Thiagarajan  * @acl: ACL configuration used by the drivers which has support for
109977765eafSVasanthakumar Thiagarajan  *	MAC address based access control
110034d50519SLior David  * @pbss: If set, start as a PCP instead of AP. Relevant for DMG
110134d50519SLior David  *	networks.
11028564e382SJohannes Berg  * @beacon_rate: bitrate to be used for beacons
110366cd794eSJohannes Berg  * @ht_cap: HT capabilities (or %NULL if HT isn't enabled)
110466cd794eSJohannes Berg  * @vht_cap: VHT capabilities (or %NULL if VHT isn't enabled)
1105244eb9aeSShaul Triebitz  * @he_cap: HE capabilities (or %NULL if HE isn't enabled)
110666cd794eSJohannes Berg  * @ht_required: stations must support HT
110766cd794eSJohannes Berg  * @vht_required: stations must support VHT
1108a0de1ca3SJohn Crispin  * @twt_responder: Enable Target Wait Time
11092a392596SIlan Peer  * @he_required: stations must support HE
1110fe494370SSrinivas Dasari  * @flags: flags, as defined in enum cfg80211_ap_settings_flags
1111796e90f4SJohn Crispin  * @he_obss_pd: OBSS Packet Detection settings
11125c5e52d1SJohn Crispin  * @he_bss_color: BSS Color settings
11137e8d6f12SShaul Triebitz  * @he_oper: HE operation IE (or %NULL if HE isn't enabled)
11148860020eSJohannes Berg  */
11158860020eSJohannes Berg struct cfg80211_ap_settings {
1116683b6d3bSJohannes Berg 	struct cfg80211_chan_def chandef;
1117aa430da4SJohannes Berg 
11188860020eSJohannes Berg 	struct cfg80211_beacon_data beacon;
11198860020eSJohannes Berg 
11208860020eSJohannes Berg 	int beacon_interval, dtim_period;
112132e9de84SJouni Malinen 	const u8 *ssid;
112232e9de84SJouni Malinen 	size_t ssid_len;
112332e9de84SJouni Malinen 	enum nl80211_hidden_ssid hidden_ssid;
11245fb628e9SJouni Malinen 	struct cfg80211_crypto_settings crypto;
11255fb628e9SJouni Malinen 	bool privacy;
11265fb628e9SJouni Malinen 	enum nl80211_auth_type auth_type;
112718998c38SEliad Peller 	enum nl80211_smps_mode smps_mode;
11281b658f11SVasanthakumar Thiagarajan 	int inactivity_timeout;
112953cabad7SJohannes Berg 	u8 p2p_ctwindow;
113053cabad7SJohannes Berg 	bool p2p_opp_ps;
113177765eafSVasanthakumar Thiagarajan 	const struct cfg80211_acl_data *acl;
113234d50519SLior David 	bool pbss;
1133a7c7fbffSPurushottam Kushwaha 	struct cfg80211_bitrate_mask beacon_rate;
113466cd794eSJohannes Berg 
113566cd794eSJohannes Berg 	const struct ieee80211_ht_cap *ht_cap;
113666cd794eSJohannes Berg 	const struct ieee80211_vht_cap *vht_cap;
1137244eb9aeSShaul Triebitz 	const struct ieee80211_he_cap_elem *he_cap;
11387e8d6f12SShaul Triebitz 	const struct ieee80211_he_operation *he_oper;
11392a392596SIlan Peer 	bool ht_required, vht_required, he_required;
1140a0de1ca3SJohn Crispin 	bool twt_responder;
1141fe494370SSrinivas Dasari 	u32 flags;
1142796e90f4SJohn Crispin 	struct ieee80211_he_obss_pd he_obss_pd;
11435c5e52d1SJohn Crispin 	struct cfg80211_he_bss_color he_bss_color;
1144ed1b6cc7SJohannes Berg };
1145ed1b6cc7SJohannes Berg 
11465727ef1bSJohannes Berg /**
114716ef1fe2SSimon Wunderlich  * struct cfg80211_csa_settings - channel switch settings
114816ef1fe2SSimon Wunderlich  *
114916ef1fe2SSimon Wunderlich  * Used for channel switch
115016ef1fe2SSimon Wunderlich  *
115116ef1fe2SSimon Wunderlich  * @chandef: defines the channel to use after the switch
115216ef1fe2SSimon Wunderlich  * @beacon_csa: beacon data while performing the switch
11539a774c78SAndrei Otcheretianski  * @counter_offsets_beacon: offsets of the counters within the beacon (tail)
11549a774c78SAndrei Otcheretianski  * @counter_offsets_presp: offsets of the counters within the probe response
11559a774c78SAndrei Otcheretianski  * @n_counter_offsets_beacon: number of csa counters the beacon (tail)
11569a774c78SAndrei Otcheretianski  * @n_counter_offsets_presp: number of csa counters in the probe response
115716ef1fe2SSimon Wunderlich  * @beacon_after: beacon data to be used on the new channel
115816ef1fe2SSimon Wunderlich  * @radar_required: whether radar detection is required on the new channel
115916ef1fe2SSimon Wunderlich  * @block_tx: whether transmissions should be blocked while changing
116016ef1fe2SSimon Wunderlich  * @count: number of beacons until switch
116116ef1fe2SSimon Wunderlich  */
116216ef1fe2SSimon Wunderlich struct cfg80211_csa_settings {
116316ef1fe2SSimon Wunderlich 	struct cfg80211_chan_def chandef;
116416ef1fe2SSimon Wunderlich 	struct cfg80211_beacon_data beacon_csa;
11659a774c78SAndrei Otcheretianski 	const u16 *counter_offsets_beacon;
11669a774c78SAndrei Otcheretianski 	const u16 *counter_offsets_presp;
11679a774c78SAndrei Otcheretianski 	unsigned int n_counter_offsets_beacon;
11689a774c78SAndrei Otcheretianski 	unsigned int n_counter_offsets_presp;
116916ef1fe2SSimon Wunderlich 	struct cfg80211_beacon_data beacon_after;
117016ef1fe2SSimon Wunderlich 	bool radar_required;
117116ef1fe2SSimon Wunderlich 	bool block_tx;
117216ef1fe2SSimon Wunderlich 	u8 count;
117316ef1fe2SSimon Wunderlich };
117416ef1fe2SSimon Wunderlich 
117551a1aaa6SJohannes Berg #define CFG80211_MAX_NUM_DIFFERENT_CHANNELS 10
117651a1aaa6SJohannes Berg 
117716ef1fe2SSimon Wunderlich /**
1178e227300cSPurushottam Kushwaha  * struct iface_combination_params - input parameters for interface combinations
1179e227300cSPurushottam Kushwaha  *
1180e227300cSPurushottam Kushwaha  * Used to pass interface combination parameters
1181e227300cSPurushottam Kushwaha  *
1182e227300cSPurushottam Kushwaha  * @num_different_channels: the number of different channels we want
1183e227300cSPurushottam Kushwaha  *	to use for verification
1184e227300cSPurushottam Kushwaha  * @radar_detect: a bitmap where each bit corresponds to a channel
1185e227300cSPurushottam Kushwaha  *	width where radar detection is needed, as in the definition of
1186e227300cSPurushottam Kushwaha  *	&struct ieee80211_iface_combination.@radar_detect_widths
1187e227300cSPurushottam Kushwaha  * @iftype_num: array with the number of interfaces of each interface
1188e227300cSPurushottam Kushwaha  *	type.  The index is the interface type as specified in &enum
1189e227300cSPurushottam Kushwaha  *	nl80211_iftype.
11904c8dea63SJohannes Berg  * @new_beacon_int: set this to the beacon interval of a new interface
11914c8dea63SJohannes Berg  *	that's not operating yet, if such is to be checked as part of
11924c8dea63SJohannes Berg  *	the verification
1193e227300cSPurushottam Kushwaha  */
1194e227300cSPurushottam Kushwaha struct iface_combination_params {
1195e227300cSPurushottam Kushwaha 	int num_different_channels;
1196e227300cSPurushottam Kushwaha 	u8 radar_detect;
1197e227300cSPurushottam Kushwaha 	int iftype_num[NUM_NL80211_IFTYPES];
11984c8dea63SJohannes Berg 	u32 new_beacon_int;
1199e227300cSPurushottam Kushwaha };
1200e227300cSPurushottam Kushwaha 
1201e227300cSPurushottam Kushwaha /**
12023b9ce80cSJohannes Berg  * enum station_parameters_apply_mask - station parameter values to apply
12033b9ce80cSJohannes Berg  * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp)
12049d62a986SJouni Malinen  * @STATION_PARAM_APPLY_CAPABILITY: apply new capability
1205f8bacc21SJohannes Berg  * @STATION_PARAM_APPLY_PLINK_STATE: apply new plink state
12063b9ce80cSJohannes Berg  *
12073b9ce80cSJohannes Berg  * Not all station parameters have in-band "no change" signalling,
12083b9ce80cSJohannes Berg  * for those that don't these flags will are used.
12093b9ce80cSJohannes Berg  */
12103b9ce80cSJohannes Berg enum station_parameters_apply_mask {
12113b9ce80cSJohannes Berg 	STATION_PARAM_APPLY_UAPSD = BIT(0),
12129d62a986SJouni Malinen 	STATION_PARAM_APPLY_CAPABILITY = BIT(1),
1213f8bacc21SJohannes Berg 	STATION_PARAM_APPLY_PLINK_STATE = BIT(2),
1214e96d1cd2SAshok Raj Nagarajan 	STATION_PARAM_APPLY_STA_TXPOWER = BIT(3),
1215e96d1cd2SAshok Raj Nagarajan };
1216e96d1cd2SAshok Raj Nagarajan 
1217e96d1cd2SAshok Raj Nagarajan /**
1218e96d1cd2SAshok Raj Nagarajan  * struct sta_txpwr - station txpower configuration
1219e96d1cd2SAshok Raj Nagarajan  *
1220e96d1cd2SAshok Raj Nagarajan  * Used to configure txpower for station.
1221e96d1cd2SAshok Raj Nagarajan  *
1222e96d1cd2SAshok Raj Nagarajan  * @power: tx power (in dBm) to be used for sending data traffic. If tx power
1223e96d1cd2SAshok Raj Nagarajan  *	is not provided, the default per-interface tx power setting will be
1224e96d1cd2SAshok Raj Nagarajan  *	overriding. Driver should be picking up the lowest tx power, either tx
1225e96d1cd2SAshok Raj Nagarajan  *	power per-interface or per-station.
1226e96d1cd2SAshok Raj Nagarajan  * @type: In particular if TPC %type is NL80211_TX_POWER_LIMITED then tx power
1227e96d1cd2SAshok Raj Nagarajan  *	will be less than or equal to specified from userspace, whereas if TPC
1228e96d1cd2SAshok Raj Nagarajan  *	%type is NL80211_TX_POWER_AUTOMATIC then it indicates default tx power.
1229e96d1cd2SAshok Raj Nagarajan  *	NL80211_TX_POWER_FIXED is not a valid configuration option for
1230e96d1cd2SAshok Raj Nagarajan  *	per peer TPC.
1231e96d1cd2SAshok Raj Nagarajan  */
1232e96d1cd2SAshok Raj Nagarajan struct sta_txpwr {
1233e96d1cd2SAshok Raj Nagarajan 	s16 power;
1234e96d1cd2SAshok Raj Nagarajan 	enum nl80211_tx_power_setting type;
12353b9ce80cSJohannes Berg };
12363b9ce80cSJohannes Berg 
12373b9ce80cSJohannes Berg /**
12385727ef1bSJohannes Berg  * struct station_parameters - station parameters
12395727ef1bSJohannes Berg  *
12405727ef1bSJohannes Berg  * Used to change and create a new station.
12415727ef1bSJohannes Berg  *
12425727ef1bSJohannes Berg  * @vlan: vlan interface station should belong to
12435727ef1bSJohannes Berg  * @supported_rates: supported rates in IEEE 802.11 format
12445727ef1bSJohannes Berg  *	(or NULL for no change)
12455727ef1bSJohannes Berg  * @supported_rates_len: number of supported rates
1246eccb8e8fSJohannes Berg  * @sta_flags_mask: station flags that changed
1247819bf593SJohannes Berg  *	(bitmask of BIT(%NL80211_STA_FLAG_...))
1248eccb8e8fSJohannes Berg  * @sta_flags_set: station flags values
1249819bf593SJohannes Berg  *	(bitmask of BIT(%NL80211_STA_FLAG_...))
12505727ef1bSJohannes Berg  * @listen_interval: listen interval or -1 for no change
12515727ef1bSJohannes Berg  * @aid: AID or zero for no change
125214f34e36SGurumoorthi Gnanasambandhan  * @vlan_id: VLAN ID for station (if nonzero)
12537d27a0baSMasashi Honma  * @peer_aid: mesh peer AID or zero for no change
1254abe37c4bSJohannes Berg  * @plink_action: plink action to take
12559c3990aaSJavier Cardona  * @plink_state: set the peer link state for a station
1256abe37c4bSJohannes Berg  * @ht_capa: HT capabilities of station
1257f461be3eSMahesh Palivela  * @vht_capa: VHT capabilities of station
1258910868dbSEliad Peller  * @uapsd_queues: bitmap of queues configured for uapsd. same format
1259910868dbSEliad Peller  *	as the AC bitmap in the QoS info field
1260910868dbSEliad Peller  * @max_sp: max Service Period. same format as the MAX_SP in the
1261910868dbSEliad Peller  *	QoS info field (but already shifted down)
1262c26887d2SJohannes Berg  * @sta_modify_mask: bitmap indicating which parameters changed
1263c26887d2SJohannes Berg  *	(for those that don't have a natural "no change" value),
1264c26887d2SJohannes Berg  *	see &enum station_parameters_apply_mask
12653b1c5a53SMarco Porsch  * @local_pm: local link-specific mesh power save mode (no change when set
12663b1c5a53SMarco Porsch  *	to unknown)
12679d62a986SJouni Malinen  * @capability: station capability
12689d62a986SJouni Malinen  * @ext_capab: extended capabilities of the station
12699d62a986SJouni Malinen  * @ext_capab_len: number of extended capabilities
1270c01fc9adSSunil Dutt  * @supported_channels: supported channels in IEEE 802.11 format
1271c01fc9adSSunil Dutt  * @supported_channels_len: number of supported channels
1272c01fc9adSSunil Dutt  * @supported_oper_classes: supported oper classes in IEEE 802.11 format
1273c01fc9adSSunil Dutt  * @supported_oper_classes_len: number of supported operating classes
127460f4a7b1SMarek Kwaczynski  * @opmode_notif: operating mode field from Operating Mode Notification
127560f4a7b1SMarek Kwaczynski  * @opmode_notif_used: information if operating mode field is used
127617b94247SAyala Beker  * @support_p2p_ps: information if station supports P2P PS mechanism
1277c4cbaf79SLuca Coelho  * @he_capa: HE capabilities of station
1278c4cbaf79SLuca Coelho  * @he_capa_len: the length of the HE capabilities
127936647055SToke Høiland-Jørgensen  * @airtime_weight: airtime scheduler weight for this station
1280a710d214SLothar Rubusch  * @txpwr: transmit power for an associated station
128143e64bf3SRajkumar Manoharan  * @he_6ghz_capa: HE 6 GHz Band capabilities of station
12825727ef1bSJohannes Berg  */
12835727ef1bSJohannes Berg struct station_parameters {
12842c1aabf3SJohannes Berg 	const u8 *supported_rates;
12855727ef1bSJohannes Berg 	struct net_device *vlan;
1286eccb8e8fSJohannes Berg 	u32 sta_flags_mask, sta_flags_set;
12873b9ce80cSJohannes Berg 	u32 sta_modify_mask;
12885727ef1bSJohannes Berg 	int listen_interval;
12895727ef1bSJohannes Berg 	u16 aid;
129014f34e36SGurumoorthi Gnanasambandhan 	u16 vlan_id;
12917d27a0baSMasashi Honma 	u16 peer_aid;
12925727ef1bSJohannes Berg 	u8 supported_rates_len;
12932ec600d6SLuis Carlos Cobo 	u8 plink_action;
12949c3990aaSJavier Cardona 	u8 plink_state;
12952c1aabf3SJohannes Berg 	const struct ieee80211_ht_cap *ht_capa;
12962c1aabf3SJohannes Berg 	const struct ieee80211_vht_cap *vht_capa;
1297c75786c9SEliad Peller 	u8 uapsd_queues;
1298c75786c9SEliad Peller 	u8 max_sp;
12993b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode local_pm;
13009d62a986SJouni Malinen 	u16 capability;
13012c1aabf3SJohannes Berg 	const u8 *ext_capab;
13029d62a986SJouni Malinen 	u8 ext_capab_len;
1303c01fc9adSSunil Dutt 	const u8 *supported_channels;
1304c01fc9adSSunil Dutt 	u8 supported_channels_len;
1305c01fc9adSSunil Dutt 	const u8 *supported_oper_classes;
1306c01fc9adSSunil Dutt 	u8 supported_oper_classes_len;
130760f4a7b1SMarek Kwaczynski 	u8 opmode_notif;
130860f4a7b1SMarek Kwaczynski 	bool opmode_notif_used;
130917b94247SAyala Beker 	int support_p2p_ps;
1310c4cbaf79SLuca Coelho 	const struct ieee80211_he_cap_elem *he_capa;
1311c4cbaf79SLuca Coelho 	u8 he_capa_len;
131236647055SToke Høiland-Jørgensen 	u16 airtime_weight;
1313e96d1cd2SAshok Raj Nagarajan 	struct sta_txpwr txpwr;
131443e64bf3SRajkumar Manoharan 	const struct ieee80211_he_6ghz_capa *he_6ghz_capa;
13155727ef1bSJohannes Berg };
13165727ef1bSJohannes Berg 
1317fd5b74dcSJohannes Berg /**
131889c771e5SJouni Malinen  * struct station_del_parameters - station deletion parameters
131989c771e5SJouni Malinen  *
132089c771e5SJouni Malinen  * Used to delete a station entry (or all stations).
132189c771e5SJouni Malinen  *
132289c771e5SJouni Malinen  * @mac: MAC address of the station to remove or NULL to remove all stations
132398856866SJouni Malinen  * @subtype: Management frame subtype to use for indicating removal
132498856866SJouni Malinen  *	(10 = Disassociation, 12 = Deauthentication)
132598856866SJouni Malinen  * @reason_code: Reason code for the Disassociation/Deauthentication frame
132689c771e5SJouni Malinen  */
132789c771e5SJouni Malinen struct station_del_parameters {
132889c771e5SJouni Malinen 	const u8 *mac;
132998856866SJouni Malinen 	u8 subtype;
133098856866SJouni Malinen 	u16 reason_code;
133189c771e5SJouni Malinen };
133289c771e5SJouni Malinen 
133389c771e5SJouni Malinen /**
133477ee7c89SJohannes Berg  * enum cfg80211_station_type - the type of station being modified
133577ee7c89SJohannes Berg  * @CFG80211_STA_AP_CLIENT: client of an AP interface
133647edb11bSAyala Beker  * @CFG80211_STA_AP_CLIENT_UNASSOC: client of an AP interface that is still
133747edb11bSAyala Beker  *	unassociated (update properties for this type of client is permitted)
133877ee7c89SJohannes Berg  * @CFG80211_STA_AP_MLME_CLIENT: client of an AP interface that has
133977ee7c89SJohannes Berg  *	the AP MLME in the device
134077ee7c89SJohannes Berg  * @CFG80211_STA_AP_STA: AP station on managed interface
134177ee7c89SJohannes Berg  * @CFG80211_STA_IBSS: IBSS station
134277ee7c89SJohannes Berg  * @CFG80211_STA_TDLS_PEER_SETUP: TDLS peer on managed interface (dummy entry
134377ee7c89SJohannes Berg  *	while TDLS setup is in progress, it moves out of this state when
134477ee7c89SJohannes Berg  *	being marked authorized; use this only if TDLS with external setup is
134577ee7c89SJohannes Berg  *	supported/used)
134677ee7c89SJohannes Berg  * @CFG80211_STA_TDLS_PEER_ACTIVE: TDLS peer on managed interface (active
134777ee7c89SJohannes Berg  *	entry that is operating, has been marked authorized by userspace)
1348eef941e6SThomas Pedersen  * @CFG80211_STA_MESH_PEER_KERNEL: peer on mesh interface (kernel managed)
1349eef941e6SThomas Pedersen  * @CFG80211_STA_MESH_PEER_USER: peer on mesh interface (user managed)
135077ee7c89SJohannes Berg  */
135177ee7c89SJohannes Berg enum cfg80211_station_type {
135277ee7c89SJohannes Berg 	CFG80211_STA_AP_CLIENT,
135347edb11bSAyala Beker 	CFG80211_STA_AP_CLIENT_UNASSOC,
135477ee7c89SJohannes Berg 	CFG80211_STA_AP_MLME_CLIENT,
135577ee7c89SJohannes Berg 	CFG80211_STA_AP_STA,
135677ee7c89SJohannes Berg 	CFG80211_STA_IBSS,
135777ee7c89SJohannes Berg 	CFG80211_STA_TDLS_PEER_SETUP,
135877ee7c89SJohannes Berg 	CFG80211_STA_TDLS_PEER_ACTIVE,
1359eef941e6SThomas Pedersen 	CFG80211_STA_MESH_PEER_KERNEL,
1360eef941e6SThomas Pedersen 	CFG80211_STA_MESH_PEER_USER,
136177ee7c89SJohannes Berg };
136277ee7c89SJohannes Berg 
136377ee7c89SJohannes Berg /**
136477ee7c89SJohannes Berg  * cfg80211_check_station_change - validate parameter changes
136577ee7c89SJohannes Berg  * @wiphy: the wiphy this operates on
136677ee7c89SJohannes Berg  * @params: the new parameters for a station
136777ee7c89SJohannes Berg  * @statype: the type of station being modified
136877ee7c89SJohannes Berg  *
136977ee7c89SJohannes Berg  * Utility function for the @change_station driver method. Call this function
137077ee7c89SJohannes Berg  * with the appropriate station type looking up the station (and checking that
137177ee7c89SJohannes Berg  * it exists). It will verify whether the station change is acceptable, and if
137277ee7c89SJohannes Berg  * not will return an error code. Note that it may modify the parameters for
137377ee7c89SJohannes Berg  * backward compatibility reasons, so don't use them before calling this.
137477ee7c89SJohannes Berg  */
137577ee7c89SJohannes Berg int cfg80211_check_station_change(struct wiphy *wiphy,
137677ee7c89SJohannes Berg 				  struct station_parameters *params,
137777ee7c89SJohannes Berg 				  enum cfg80211_station_type statype);
137877ee7c89SJohannes Berg 
137977ee7c89SJohannes Berg /**
1380420e7fabSHenning Rogge  * enum station_info_rate_flags - bitrate info flags
1381420e7fabSHenning Rogge  *
1382420e7fabSHenning Rogge  * Used by the driver to indicate the specific rate transmission
1383420e7fabSHenning Rogge  * type for 802.11n transmissions.
1384420e7fabSHenning Rogge  *
1385db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_MCS: mcs field filled with HT MCS
1386db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_VHT_MCS: mcs field filled with VHT MCS
1387420e7fabSHenning Rogge  * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval
13882a38075cSAlexei Avshalom Lazar  * @RATE_INFO_FLAGS_DMG: 60GHz MCS
1389c4cbaf79SLuca Coelho  * @RATE_INFO_FLAGS_HE_MCS: HE MCS information
13902a38075cSAlexei Avshalom Lazar  * @RATE_INFO_FLAGS_EDMG: 60GHz MCS in EDMG mode
1391420e7fabSHenning Rogge  */
1392420e7fabSHenning Rogge enum rate_info_flags {
1393db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_MCS			= BIT(0),
1394db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_VHT_MCS			= BIT(1),
1395b51f3beeSJohannes Berg 	RATE_INFO_FLAGS_SHORT_GI		= BIT(2),
13962a38075cSAlexei Avshalom Lazar 	RATE_INFO_FLAGS_DMG			= BIT(3),
1397c4cbaf79SLuca Coelho 	RATE_INFO_FLAGS_HE_MCS			= BIT(4),
13982a38075cSAlexei Avshalom Lazar 	RATE_INFO_FLAGS_EDMG			= BIT(5),
1399b51f3beeSJohannes Berg };
1400b51f3beeSJohannes Berg 
1401b51f3beeSJohannes Berg /**
1402b51f3beeSJohannes Berg  * enum rate_info_bw - rate bandwidth information
1403b51f3beeSJohannes Berg  *
1404b51f3beeSJohannes Berg  * Used by the driver to indicate the rate bandwidth.
1405b51f3beeSJohannes Berg  *
1406b51f3beeSJohannes Berg  * @RATE_INFO_BW_5: 5 MHz bandwidth
1407b51f3beeSJohannes Berg  * @RATE_INFO_BW_10: 10 MHz bandwidth
1408b51f3beeSJohannes Berg  * @RATE_INFO_BW_20: 20 MHz bandwidth
1409b51f3beeSJohannes Berg  * @RATE_INFO_BW_40: 40 MHz bandwidth
1410b51f3beeSJohannes Berg  * @RATE_INFO_BW_80: 80 MHz bandwidth
1411b51f3beeSJohannes Berg  * @RATE_INFO_BW_160: 160 MHz bandwidth
1412c4cbaf79SLuca Coelho  * @RATE_INFO_BW_HE_RU: bandwidth determined by HE RU allocation
1413b51f3beeSJohannes Berg  */
1414b51f3beeSJohannes Berg enum rate_info_bw {
1415842be75cSJohannes Berg 	RATE_INFO_BW_20 = 0,
1416b51f3beeSJohannes Berg 	RATE_INFO_BW_5,
1417b51f3beeSJohannes Berg 	RATE_INFO_BW_10,
1418b51f3beeSJohannes Berg 	RATE_INFO_BW_40,
1419b51f3beeSJohannes Berg 	RATE_INFO_BW_80,
1420b51f3beeSJohannes Berg 	RATE_INFO_BW_160,
1421c4cbaf79SLuca Coelho 	RATE_INFO_BW_HE_RU,
1422420e7fabSHenning Rogge };
1423420e7fabSHenning Rogge 
1424420e7fabSHenning Rogge /**
1425420e7fabSHenning Rogge  * struct rate_info - bitrate information
1426420e7fabSHenning Rogge  *
1427420e7fabSHenning Rogge  * Information about a receiving or transmitting bitrate
1428420e7fabSHenning Rogge  *
1429420e7fabSHenning Rogge  * @flags: bitflag of flags from &enum rate_info_flags
1430c4cbaf79SLuca Coelho  * @mcs: mcs index if struct describes an HT/VHT/HE rate
1431420e7fabSHenning Rogge  * @legacy: bitrate in 100kbit/s for 802.11abg
1432c4cbaf79SLuca Coelho  * @nss: number of streams (VHT & HE only)
1433b51f3beeSJohannes Berg  * @bw: bandwidth (from &enum rate_info_bw)
1434c4cbaf79SLuca Coelho  * @he_gi: HE guard interval (from &enum nl80211_he_gi)
1435c4cbaf79SLuca Coelho  * @he_dcm: HE DCM value
1436c4cbaf79SLuca Coelho  * @he_ru_alloc: HE RU allocation (from &enum nl80211_he_ru_alloc,
1437c4cbaf79SLuca Coelho  *	only valid if bw is %RATE_INFO_BW_HE_RU)
14382a38075cSAlexei Avshalom Lazar  * @n_bonded_ch: In case of EDMG the number of bonded channels (1-4)
1439420e7fabSHenning Rogge  */
1440420e7fabSHenning Rogge struct rate_info {
1441420e7fabSHenning Rogge 	u8 flags;
1442420e7fabSHenning Rogge 	u8 mcs;
1443420e7fabSHenning Rogge 	u16 legacy;
1444db9c64cfSJohannes Berg 	u8 nss;
1445b51f3beeSJohannes Berg 	u8 bw;
1446c4cbaf79SLuca Coelho 	u8 he_gi;
1447c4cbaf79SLuca Coelho 	u8 he_dcm;
1448c4cbaf79SLuca Coelho 	u8 he_ru_alloc;
14492a38075cSAlexei Avshalom Lazar 	u8 n_bonded_ch;
1450fd5b74dcSJohannes Berg };
1451fd5b74dcSJohannes Berg 
1452fd5b74dcSJohannes Berg /**
1453f4263c98SPaul Stewart  * enum station_info_rate_flags - bitrate info flags
1454f4263c98SPaul Stewart  *
1455f4263c98SPaul Stewart  * Used by the driver to indicate the specific rate transmission
1456f4263c98SPaul Stewart  * type for 802.11n transmissions.
1457f4263c98SPaul Stewart  *
1458f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_CTS_PROT: whether CTS protection is enabled
1459f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_SHORT_PREAMBLE: whether short preamble is enabled
1460f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_SHORT_SLOT_TIME: whether short slot time is enabled
1461f4263c98SPaul Stewart  */
1462f4263c98SPaul Stewart enum bss_param_flags {
1463f4263c98SPaul Stewart 	BSS_PARAM_FLAGS_CTS_PROT	= 1<<0,
1464f4263c98SPaul Stewart 	BSS_PARAM_FLAGS_SHORT_PREAMBLE	= 1<<1,
1465f4263c98SPaul Stewart 	BSS_PARAM_FLAGS_SHORT_SLOT_TIME	= 1<<2,
1466f4263c98SPaul Stewart };
1467f4263c98SPaul Stewart 
1468f4263c98SPaul Stewart /**
1469f4263c98SPaul Stewart  * struct sta_bss_parameters - BSS parameters for the attached station
1470f4263c98SPaul Stewart  *
1471f4263c98SPaul Stewart  * Information about the currently associated BSS
1472f4263c98SPaul Stewart  *
1473f4263c98SPaul Stewart  * @flags: bitflag of flags from &enum bss_param_flags
1474f4263c98SPaul Stewart  * @dtim_period: DTIM period for the BSS
1475f4263c98SPaul Stewart  * @beacon_interval: beacon interval
1476f4263c98SPaul Stewart  */
1477f4263c98SPaul Stewart struct sta_bss_parameters {
1478f4263c98SPaul Stewart 	u8 flags;
1479f4263c98SPaul Stewart 	u8 dtim_period;
1480f4263c98SPaul Stewart 	u16 beacon_interval;
1481f4263c98SPaul Stewart };
1482f4263c98SPaul Stewart 
14836de39808SJohannes Berg /**
148452539ca8SToke Høiland-Jørgensen  * struct cfg80211_txq_stats - TXQ statistics for this TID
148552539ca8SToke Høiland-Jørgensen  * @filled: bitmap of flags using the bits of &enum nl80211_txq_stats to
148652539ca8SToke Høiland-Jørgensen  *	indicate the relevant values in this struct are filled
148752539ca8SToke Høiland-Jørgensen  * @backlog_bytes: total number of bytes currently backlogged
148852539ca8SToke Høiland-Jørgensen  * @backlog_packets: total number of packets currently backlogged
148952539ca8SToke Høiland-Jørgensen  * @flows: number of new flows seen
149052539ca8SToke Høiland-Jørgensen  * @drops: total number of packets dropped
149152539ca8SToke Høiland-Jørgensen  * @ecn_marks: total number of packets marked with ECN CE
149252539ca8SToke Høiland-Jørgensen  * @overlimit: number of drops due to queue space overflow
149352539ca8SToke Høiland-Jørgensen  * @overmemory: number of drops due to memory limit overflow
149452539ca8SToke Høiland-Jørgensen  * @collisions: number of hash collisions
149552539ca8SToke Høiland-Jørgensen  * @tx_bytes: total number of bytes dequeued
149652539ca8SToke Høiland-Jørgensen  * @tx_packets: total number of packets dequeued
149752539ca8SToke Høiland-Jørgensen  * @max_flows: maximum number of flows supported
149852539ca8SToke Høiland-Jørgensen  */
149952539ca8SToke Høiland-Jørgensen struct cfg80211_txq_stats {
150052539ca8SToke Høiland-Jørgensen 	u32 filled;
150152539ca8SToke Høiland-Jørgensen 	u32 backlog_bytes;
150252539ca8SToke Høiland-Jørgensen 	u32 backlog_packets;
150352539ca8SToke Høiland-Jørgensen 	u32 flows;
150452539ca8SToke Høiland-Jørgensen 	u32 drops;
150552539ca8SToke Høiland-Jørgensen 	u32 ecn_marks;
150652539ca8SToke Høiland-Jørgensen 	u32 overlimit;
150752539ca8SToke Høiland-Jørgensen 	u32 overmemory;
150852539ca8SToke Høiland-Jørgensen 	u32 collisions;
150952539ca8SToke Høiland-Jørgensen 	u32 tx_bytes;
151052539ca8SToke Høiland-Jørgensen 	u32 tx_packets;
151152539ca8SToke Høiland-Jørgensen 	u32 max_flows;
151252539ca8SToke Høiland-Jørgensen };
151352539ca8SToke Høiland-Jørgensen 
151452539ca8SToke Høiland-Jørgensen /**
15156de39808SJohannes Berg  * struct cfg80211_tid_stats - per-TID statistics
15166de39808SJohannes Berg  * @filled: bitmap of flags using the bits of &enum nl80211_tid_stats to
15176de39808SJohannes Berg  *	indicate the relevant values in this struct are filled
15186de39808SJohannes Berg  * @rx_msdu: number of received MSDUs
15196de39808SJohannes Berg  * @tx_msdu: number of (attempted) transmitted MSDUs
15206de39808SJohannes Berg  * @tx_msdu_retries: number of retries (not counting the first) for
15216de39808SJohannes Berg  *	transmitted MSDUs
15226de39808SJohannes Berg  * @tx_msdu_failed: number of failed transmitted MSDUs
152352539ca8SToke Høiland-Jørgensen  * @txq_stats: TXQ statistics
15246de39808SJohannes Berg  */
15256de39808SJohannes Berg struct cfg80211_tid_stats {
15266de39808SJohannes Berg 	u32 filled;
15276de39808SJohannes Berg 	u64 rx_msdu;
15286de39808SJohannes Berg 	u64 tx_msdu;
15296de39808SJohannes Berg 	u64 tx_msdu_retries;
15306de39808SJohannes Berg 	u64 tx_msdu_failed;
153152539ca8SToke Høiland-Jørgensen 	struct cfg80211_txq_stats txq_stats;
15326de39808SJohannes Berg };
15336de39808SJohannes Berg 
1534119363c7SFelix Fietkau #define IEEE80211_MAX_CHAINS	4
1535119363c7SFelix Fietkau 
1536f4263c98SPaul Stewart /**
15372ec600d6SLuis Carlos Cobo  * struct station_info - station information
1538fd5b74dcSJohannes Berg  *
15392ec600d6SLuis Carlos Cobo  * Station information filled by driver for get_station() and dump_station.
1540fd5b74dcSJohannes Berg  *
1541319090bfSJohannes Berg  * @filled: bitflag of flags using the bits of &enum nl80211_sta_info to
1542319090bfSJohannes Berg  *	indicate the relevant values in this struct for them
1543ebe27c91SMohammed Shafi Shajakhan  * @connected_time: time(in secs) since a station is last connected
1544fd5b74dcSJohannes Berg  * @inactive_time: time since last station activity (tx/rx) in milliseconds
15456c7a0033SBen Greear  * @assoc_at: bootime (ns) of the last association
15468d791361SJohannes Berg  * @rx_bytes: bytes (size of MPDUs) received from this station
15478d791361SJohannes Berg  * @tx_bytes: bytes (size of MPDUs) transmitted to this station
15482ec600d6SLuis Carlos Cobo  * @llid: mesh local link id
15492ec600d6SLuis Carlos Cobo  * @plid: mesh peer link id
15502ec600d6SLuis Carlos Cobo  * @plink_state: mesh peer link state
155173c3df3bSJohannes Berg  * @signal: The signal strength, type depends on the wiphy's signal_type.
155273c3df3bSJohannes Berg  *	For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
155373c3df3bSJohannes Berg  * @signal_avg: Average signal strength, type depends on the wiphy's signal_type.
155473c3df3bSJohannes Berg  *	For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
1555119363c7SFelix Fietkau  * @chains: bitmask for filled values in @chain_signal, @chain_signal_avg
1556119363c7SFelix Fietkau  * @chain_signal: per-chain signal strength of last received packet in dBm
1557119363c7SFelix Fietkau  * @chain_signal_avg: per-chain signal strength average in dBm
1558858022aaSRandy Dunlap  * @txrate: current unicast bitrate from this station
1559858022aaSRandy Dunlap  * @rxrate: current unicast bitrate to this station
15608d791361SJohannes Berg  * @rx_packets: packets (MSDUs & MMPDUs) received from this station
15618d791361SJohannes Berg  * @tx_packets: packets (MSDUs & MMPDUs) transmitted to this station
15628d791361SJohannes Berg  * @tx_retries: cumulative retry counts (MPDUs)
15638d791361SJohannes Berg  * @tx_failed: number of failed transmissions (MPDUs) (retries exceeded, no ACK)
15645a5c731aSBen Greear  * @rx_dropped_misc:  Dropped for un-specified reason.
15651ba01458SRandy Dunlap  * @bss_param: current BSS parameters
1566f5ea9120SJohannes Berg  * @generation: generation number for nl80211 dumps.
1567f5ea9120SJohannes Berg  *	This number should increase every time the list of stations
1568f5ea9120SJohannes Berg  *	changes, i.e. when a station is added or removed, so that
1569f5ea9120SJohannes Berg  *	userspace can tell whether it got a consistent snapshot.
157050d3dfb7SJouni Malinen  * @assoc_req_ies: IEs from (Re)Association Request.
157150d3dfb7SJouni Malinen  *	This is used only when in AP mode with drivers that do not use
157250d3dfb7SJouni Malinen  *	user space MLME/SME implementation. The information is provided for
157350d3dfb7SJouni Malinen  *	the cfg80211_new_sta() calls to notify user space of the IEs.
157450d3dfb7SJouni Malinen  * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets.
1575c26887d2SJohannes Berg  * @sta_flags: station flags mask & values
1576a85e1d55SPaul Stewart  * @beacon_loss_count: Number of times beacon loss event has triggered.
1577d299a1f2SJavier Cardona  * @t_offset: Time offset of the station relative to this host.
15783b1c5a53SMarco Porsch  * @local_pm: local mesh STA power save mode
15793b1c5a53SMarco Porsch  * @peer_pm: peer mesh STA power save mode
15803b1c5a53SMarco Porsch  * @nonpeer_pm: non-peer mesh STA power save mode
1581867d849fSAntonio Quartulli  * @expected_throughput: expected throughput in kbps (including 802.11 headers)
1582867d849fSAntonio Quartulli  *	towards this station.
1583a76b1942SJohannes Berg  * @rx_beacon: number of beacons received from this peer
1584a76b1942SJohannes Berg  * @rx_beacon_signal_avg: signal strength average (in dBm) for beacons received
1585a76b1942SJohannes Berg  *	from this peer
1586dbdaee7aSBob Copeland  * @connected_to_gate: true if mesh STA has a path to mesh gate
1587739960f1SMohammed Shafi Shajakhan  * @rx_duration: aggregate PPDU duration(usecs) for all the frames from a peer
158836647055SToke Høiland-Jørgensen  * @tx_duration: aggregate PPDU duration(usecs) for all the frames to a peer
158936647055SToke Høiland-Jørgensen  * @airtime_weight: current airtime scheduling weight
15906de39808SJohannes Berg  * @pertid: per-TID statistics, see &struct cfg80211_tid_stats, using the last
15916de39808SJohannes Berg  *	(IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs.
15928689c051SArend van Spriel  *	Note that this doesn't use the @filled bit, but is used if non-NULL.
1593c4b50cd3SVenkateswara Naralasetty  * @ack_signal: signal strength (in dBm) of the last ACK frame.
159481d5439dSBalaji Pothunoori  * @avg_ack_signal: average rssi value of ack packet for the no of msdu's has
159581d5439dSBalaji Pothunoori  *	been sent.
15960d4e14a3SAnkita Bajaj  * @rx_mpdu_count: number of MPDUs received from this station
15970d4e14a3SAnkita Bajaj  * @fcs_err_count: number of packets (MPDUs) received from this station with
15980d4e14a3SAnkita Bajaj  *	an FCS error. This counter should be incremented only when TA of the
15990d4e14a3SAnkita Bajaj  *	received packet with an FCS error matches the peer MAC address.
1600ab60633cSNarayanraddi Masti  * @airtime_link_metric: mesh airtime link metric.
1601fd5b74dcSJohannes Berg  */
16022ec600d6SLuis Carlos Cobo struct station_info {
1603739960f1SMohammed Shafi Shajakhan 	u64 filled;
1604ebe27c91SMohammed Shafi Shajakhan 	u32 connected_time;
1605fd5b74dcSJohannes Berg 	u32 inactive_time;
16066c7a0033SBen Greear 	u64 assoc_at;
160742745e03SVladimir Kondratiev 	u64 rx_bytes;
160842745e03SVladimir Kondratiev 	u64 tx_bytes;
16092ec600d6SLuis Carlos Cobo 	u16 llid;
16102ec600d6SLuis Carlos Cobo 	u16 plid;
16112ec600d6SLuis Carlos Cobo 	u8 plink_state;
1612420e7fabSHenning Rogge 	s8 signal;
1613541a45a1SBruno Randolf 	s8 signal_avg;
1614119363c7SFelix Fietkau 
1615119363c7SFelix Fietkau 	u8 chains;
1616119363c7SFelix Fietkau 	s8 chain_signal[IEEE80211_MAX_CHAINS];
1617119363c7SFelix Fietkau 	s8 chain_signal_avg[IEEE80211_MAX_CHAINS];
1618119363c7SFelix Fietkau 
1619420e7fabSHenning Rogge 	struct rate_info txrate;
1620c8dcfd8aSFelix Fietkau 	struct rate_info rxrate;
162198c8a60aSJouni Malinen 	u32 rx_packets;
162298c8a60aSJouni Malinen 	u32 tx_packets;
1623b206b4efSBruno Randolf 	u32 tx_retries;
1624b206b4efSBruno Randolf 	u32 tx_failed;
16255a5c731aSBen Greear 	u32 rx_dropped_misc;
1626f4263c98SPaul Stewart 	struct sta_bss_parameters bss_param;
1627bb6e753eSHelmut Schaa 	struct nl80211_sta_flag_update sta_flags;
1628f5ea9120SJohannes Berg 
1629f5ea9120SJohannes Berg 	int generation;
163050d3dfb7SJouni Malinen 
163150d3dfb7SJouni Malinen 	const u8 *assoc_req_ies;
163250d3dfb7SJouni Malinen 	size_t assoc_req_ies_len;
1633f612cedfSJouni Malinen 
1634a85e1d55SPaul Stewart 	u32 beacon_loss_count;
1635d299a1f2SJavier Cardona 	s64 t_offset;
16363b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode local_pm;
16373b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode peer_pm;
16383b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode nonpeer_pm;
1639a85e1d55SPaul Stewart 
1640867d849fSAntonio Quartulli 	u32 expected_throughput;
1641a76b1942SJohannes Berg 
164236647055SToke Høiland-Jørgensen 	u64 tx_duration;
1643739960f1SMohammed Shafi Shajakhan 	u64 rx_duration;
164436647055SToke Høiland-Jørgensen 	u64 rx_beacon;
1645a76b1942SJohannes Berg 	u8 rx_beacon_signal_avg;
1646dbdaee7aSBob Copeland 	u8 connected_to_gate;
1647dbdaee7aSBob Copeland 
16488689c051SArend van Spriel 	struct cfg80211_tid_stats *pertid;
1649c4b50cd3SVenkateswara Naralasetty 	s8 ack_signal;
165081d5439dSBalaji Pothunoori 	s8 avg_ack_signal;
16510d4e14a3SAnkita Bajaj 
165236647055SToke Høiland-Jørgensen 	u16 airtime_weight;
165336647055SToke Høiland-Jørgensen 
16540d4e14a3SAnkita Bajaj 	u32 rx_mpdu_count;
16550d4e14a3SAnkita Bajaj 	u32 fcs_err_count;
1656ab60633cSNarayanraddi Masti 
1657ab60633cSNarayanraddi Masti 	u32 airtime_link_metric;
1658fd5b74dcSJohannes Berg };
1659fd5b74dcSJohannes Berg 
166061aaa0e8SLinus Lüssing #if IS_ENABLED(CONFIG_CFG80211)
166166f7ac50SMichael Wu /**
16627406353dSAntonio Quartulli  * cfg80211_get_station - retrieve information about a given station
16637406353dSAntonio Quartulli  * @dev: the device where the station is supposed to be connected to
16647406353dSAntonio Quartulli  * @mac_addr: the mac address of the station of interest
16657406353dSAntonio Quartulli  * @sinfo: pointer to the structure to fill with the information
16667406353dSAntonio Quartulli  *
16677406353dSAntonio Quartulli  * Returns 0 on success and sinfo is filled with the available information
16687406353dSAntonio Quartulli  * otherwise returns a negative error code and the content of sinfo has to be
16697406353dSAntonio Quartulli  * considered undefined.
16707406353dSAntonio Quartulli  */
16717406353dSAntonio Quartulli int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr,
16727406353dSAntonio Quartulli 			 struct station_info *sinfo);
167361aaa0e8SLinus Lüssing #else
167461aaa0e8SLinus Lüssing static inline int cfg80211_get_station(struct net_device *dev,
167561aaa0e8SLinus Lüssing 				       const u8 *mac_addr,
167661aaa0e8SLinus Lüssing 				       struct station_info *sinfo)
167761aaa0e8SLinus Lüssing {
167861aaa0e8SLinus Lüssing 	return -ENOENT;
167961aaa0e8SLinus Lüssing }
168061aaa0e8SLinus Lüssing #endif
16817406353dSAntonio Quartulli 
16827406353dSAntonio Quartulli /**
168366f7ac50SMichael Wu  * enum monitor_flags - monitor flags
168466f7ac50SMichael Wu  *
168566f7ac50SMichael Wu  * Monitor interface configuration flags. Note that these must be the bits
168666f7ac50SMichael Wu  * according to the nl80211 flags.
168766f7ac50SMichael Wu  *
1688818a986eSJohannes Berg  * @MONITOR_FLAG_CHANGED: set if the flags were changed
168966f7ac50SMichael Wu  * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS
169066f7ac50SMichael Wu  * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP
169166f7ac50SMichael Wu  * @MONITOR_FLAG_CONTROL: pass control frames
169266f7ac50SMichael Wu  * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering
169366f7ac50SMichael Wu  * @MONITOR_FLAG_COOK_FRAMES: report frames after processing
1694e057d3c3SFelix Fietkau  * @MONITOR_FLAG_ACTIVE: active monitor, ACKs frames on its MAC address
169566f7ac50SMichael Wu  */
169666f7ac50SMichael Wu enum monitor_flags {
1697818a986eSJohannes Berg 	MONITOR_FLAG_CHANGED		= 1<<__NL80211_MNTR_FLAG_INVALID,
169866f7ac50SMichael Wu 	MONITOR_FLAG_FCSFAIL		= 1<<NL80211_MNTR_FLAG_FCSFAIL,
169966f7ac50SMichael Wu 	MONITOR_FLAG_PLCPFAIL		= 1<<NL80211_MNTR_FLAG_PLCPFAIL,
170066f7ac50SMichael Wu 	MONITOR_FLAG_CONTROL		= 1<<NL80211_MNTR_FLAG_CONTROL,
170166f7ac50SMichael Wu 	MONITOR_FLAG_OTHER_BSS		= 1<<NL80211_MNTR_FLAG_OTHER_BSS,
170266f7ac50SMichael Wu 	MONITOR_FLAG_COOK_FRAMES	= 1<<NL80211_MNTR_FLAG_COOK_FRAMES,
1703e057d3c3SFelix Fietkau 	MONITOR_FLAG_ACTIVE		= 1<<NL80211_MNTR_FLAG_ACTIVE,
170466f7ac50SMichael Wu };
170566f7ac50SMichael Wu 
17062ec600d6SLuis Carlos Cobo /**
17072ec600d6SLuis Carlos Cobo  * enum mpath_info_flags -  mesh path information flags
17082ec600d6SLuis Carlos Cobo  *
17092ec600d6SLuis Carlos Cobo  * Used by the driver to indicate which info in &struct mpath_info it has filled
17102ec600d6SLuis Carlos Cobo  * in during get_station() or dump_station().
17112ec600d6SLuis Carlos Cobo  *
1712abe37c4bSJohannes Berg  * @MPATH_INFO_FRAME_QLEN: @frame_qlen filled
1713abe37c4bSJohannes Berg  * @MPATH_INFO_SN: @sn filled
1714abe37c4bSJohannes Berg  * @MPATH_INFO_METRIC: @metric filled
1715abe37c4bSJohannes Berg  * @MPATH_INFO_EXPTIME: @exptime filled
1716abe37c4bSJohannes Berg  * @MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled
1717abe37c4bSJohannes Berg  * @MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled
1718abe37c4bSJohannes Berg  * @MPATH_INFO_FLAGS: @flags filled
1719cc241636SJulan Hsu  * @MPATH_INFO_HOP_COUNT: @hop_count filled
17209874b71fSJohannes Berg  * @MPATH_INFO_PATH_CHANGE: @path_change_count filled
17212ec600d6SLuis Carlos Cobo  */
17222ec600d6SLuis Carlos Cobo enum mpath_info_flags {
17232ec600d6SLuis Carlos Cobo 	MPATH_INFO_FRAME_QLEN		= BIT(0),
1724d19b3bf6SRui Paulo 	MPATH_INFO_SN			= BIT(1),
17252ec600d6SLuis Carlos Cobo 	MPATH_INFO_METRIC		= BIT(2),
17262ec600d6SLuis Carlos Cobo 	MPATH_INFO_EXPTIME		= BIT(3),
17272ec600d6SLuis Carlos Cobo 	MPATH_INFO_DISCOVERY_TIMEOUT	= BIT(4),
17282ec600d6SLuis Carlos Cobo 	MPATH_INFO_DISCOVERY_RETRIES	= BIT(5),
17292ec600d6SLuis Carlos Cobo 	MPATH_INFO_FLAGS		= BIT(6),
1730540bbcb9SJulan Hsu 	MPATH_INFO_HOP_COUNT		= BIT(7),
1731540bbcb9SJulan Hsu 	MPATH_INFO_PATH_CHANGE		= BIT(8),
17322ec600d6SLuis Carlos Cobo };
17332ec600d6SLuis Carlos Cobo 
17342ec600d6SLuis Carlos Cobo /**
17352ec600d6SLuis Carlos Cobo  * struct mpath_info - mesh path information
17362ec600d6SLuis Carlos Cobo  *
17372ec600d6SLuis Carlos Cobo  * Mesh path information filled by driver for get_mpath() and dump_mpath().
17382ec600d6SLuis Carlos Cobo  *
17392ec600d6SLuis Carlos Cobo  * @filled: bitfield of flags from &enum mpath_info_flags
17402ec600d6SLuis Carlos Cobo  * @frame_qlen: number of queued frames for this destination
1741d19b3bf6SRui Paulo  * @sn: target sequence number
17422ec600d6SLuis Carlos Cobo  * @metric: metric (cost) of this mesh path
17432ec600d6SLuis Carlos Cobo  * @exptime: expiration time for the mesh path from now, in msecs
17442ec600d6SLuis Carlos Cobo  * @flags: mesh path flags
17452ec600d6SLuis Carlos Cobo  * @discovery_timeout: total mesh path discovery timeout, in msecs
17462ec600d6SLuis Carlos Cobo  * @discovery_retries: mesh path discovery retries
1747f5ea9120SJohannes Berg  * @generation: generation number for nl80211 dumps.
1748f5ea9120SJohannes Berg  *	This number should increase every time the list of mesh paths
1749f5ea9120SJohannes Berg  *	changes, i.e. when a station is added or removed, so that
1750f5ea9120SJohannes Berg  *	userspace can tell whether it got a consistent snapshot.
1751cc241636SJulan Hsu  * @hop_count: hops to destination
1752540bbcb9SJulan Hsu  * @path_change_count: total number of path changes to destination
17532ec600d6SLuis Carlos Cobo  */
17542ec600d6SLuis Carlos Cobo struct mpath_info {
17552ec600d6SLuis Carlos Cobo 	u32 filled;
17562ec600d6SLuis Carlos Cobo 	u32 frame_qlen;
1757d19b3bf6SRui Paulo 	u32 sn;
17582ec600d6SLuis Carlos Cobo 	u32 metric;
17592ec600d6SLuis Carlos Cobo 	u32 exptime;
17602ec600d6SLuis Carlos Cobo 	u32 discovery_timeout;
17612ec600d6SLuis Carlos Cobo 	u8 discovery_retries;
17622ec600d6SLuis Carlos Cobo 	u8 flags;
1763cc241636SJulan Hsu 	u8 hop_count;
1764540bbcb9SJulan Hsu 	u32 path_change_count;
1765f5ea9120SJohannes Berg 
1766f5ea9120SJohannes Berg 	int generation;
17672ec600d6SLuis Carlos Cobo };
17682ec600d6SLuis Carlos Cobo 
17699f1ba906SJouni Malinen /**
17709f1ba906SJouni Malinen  * struct bss_parameters - BSS parameters
17719f1ba906SJouni Malinen  *
17729f1ba906SJouni Malinen  * Used to change BSS parameters (mainly for AP mode).
17739f1ba906SJouni Malinen  *
17749f1ba906SJouni Malinen  * @use_cts_prot: Whether to use CTS protection
17759f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
17769f1ba906SJouni Malinen  * @use_short_preamble: Whether the use of short preambles is allowed
17779f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
17789f1ba906SJouni Malinen  * @use_short_slot_time: Whether the use of short slot time is allowed
17799f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
178090c97a04SJouni Malinen  * @basic_rates: basic rates in IEEE 802.11 format
178190c97a04SJouni Malinen  *	(or NULL for no change)
178290c97a04SJouni Malinen  * @basic_rates_len: number of basic rates
1783fd8aaaf3SFelix Fietkau  * @ap_isolate: do not forward packets between connected stations
178450b12f59SHelmut Schaa  * @ht_opmode: HT Operation mode
178550b12f59SHelmut Schaa  *	(u16 = opmode, -1 = do not change)
178653cabad7SJohannes Berg  * @p2p_ctwindow: P2P CT Window (-1 = no change)
178753cabad7SJohannes Berg  * @p2p_opp_ps: P2P opportunistic PS (-1 = no change)
17889f1ba906SJouni Malinen  */
17899f1ba906SJouni Malinen struct bss_parameters {
17909f1ba906SJouni Malinen 	int use_cts_prot;
17919f1ba906SJouni Malinen 	int use_short_preamble;
17929f1ba906SJouni Malinen 	int use_short_slot_time;
1793c1e5f471SJohannes Berg 	const u8 *basic_rates;
179490c97a04SJouni Malinen 	u8 basic_rates_len;
1795fd8aaaf3SFelix Fietkau 	int ap_isolate;
179650b12f59SHelmut Schaa 	int ht_opmode;
179753cabad7SJohannes Berg 	s8 p2p_ctwindow, p2p_opp_ps;
17989f1ba906SJouni Malinen };
17992ec600d6SLuis Carlos Cobo 
18003ddd53f3SChun-Yeow Yeoh /**
180129cbe68cSJohannes Berg  * struct mesh_config - 802.11s mesh configuration
180229cbe68cSJohannes Berg  *
180329cbe68cSJohannes Berg  * These parameters can be changed while the mesh is active.
18043ddd53f3SChun-Yeow Yeoh  *
18053ddd53f3SChun-Yeow Yeoh  * @dot11MeshRetryTimeout: the initial retry timeout in millisecond units used
18063ddd53f3SChun-Yeow Yeoh  *	by the Mesh Peering Open message
18073ddd53f3SChun-Yeow Yeoh  * @dot11MeshConfirmTimeout: the initial retry timeout in millisecond units
18083ddd53f3SChun-Yeow Yeoh  *	used by the Mesh Peering Open message
18093ddd53f3SChun-Yeow Yeoh  * @dot11MeshHoldingTimeout: the confirm timeout in millisecond units used by
18103ddd53f3SChun-Yeow Yeoh  *	the mesh peering management to close a mesh peering
18113ddd53f3SChun-Yeow Yeoh  * @dot11MeshMaxPeerLinks: the maximum number of peer links allowed on this
18123ddd53f3SChun-Yeow Yeoh  *	mesh interface
18133ddd53f3SChun-Yeow Yeoh  * @dot11MeshMaxRetries: the maximum number of peer link open retries that can
18143ddd53f3SChun-Yeow Yeoh  *	be sent to establish a new peer link instance in a mesh
18153ddd53f3SChun-Yeow Yeoh  * @dot11MeshTTL: the value of TTL field set at a source mesh STA
18163ddd53f3SChun-Yeow Yeoh  * @element_ttl: the value of TTL field set at a mesh STA for path selection
18173ddd53f3SChun-Yeow Yeoh  *	elements
18183ddd53f3SChun-Yeow Yeoh  * @auto_open_plinks: whether we should automatically open peer links when we
18193ddd53f3SChun-Yeow Yeoh  *	detect compatible mesh peers
18203ddd53f3SChun-Yeow Yeoh  * @dot11MeshNbrOffsetMaxNeighbor: the maximum number of neighbors to
18213ddd53f3SChun-Yeow Yeoh  *	synchronize to for 11s default synchronization method
18223ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPmaxPREQretries: the number of action frames containing a PREQ
18233ddd53f3SChun-Yeow Yeoh  *	that an originator mesh STA can send to a particular path target
18243ddd53f3SChun-Yeow Yeoh  * @path_refresh_time: how frequently to refresh mesh paths in milliseconds
18253ddd53f3SChun-Yeow Yeoh  * @min_discovery_timeout: the minimum length of time to wait until giving up on
18263ddd53f3SChun-Yeow Yeoh  *	a path discovery in milliseconds
18273ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPactivePathTimeout: the time (in TUs) for which mesh STAs
18283ddd53f3SChun-Yeow Yeoh  *	receiving a PREQ shall consider the forwarding information from the
18293ddd53f3SChun-Yeow Yeoh  *	root to be valid. (TU = time unit)
18303ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPpreqMinInterval: the minimum interval of time (in TUs) during
18313ddd53f3SChun-Yeow Yeoh  *	which a mesh STA can send only one action frame containing a PREQ
18323ddd53f3SChun-Yeow Yeoh  *	element
18333ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPperrMinInterval: the minimum interval of time (in TUs) during
18343ddd53f3SChun-Yeow Yeoh  *	which a mesh STA can send only one Action frame containing a PERR
18353ddd53f3SChun-Yeow Yeoh  *	element
18363ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPnetDiameterTraversalTime: the interval of time (in TUs) that
18373ddd53f3SChun-Yeow Yeoh  *	it takes for an HWMP information element to propagate across the mesh
18383ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPRootMode: the configuration of a mesh STA as root mesh STA
18393ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPRannInterval: the interval of time (in TUs) between root
18403ddd53f3SChun-Yeow Yeoh  *	announcements are transmitted
18413ddd53f3SChun-Yeow Yeoh  * @dot11MeshGateAnnouncementProtocol: whether to advertise that this mesh
18423ddd53f3SChun-Yeow Yeoh  *	station has access to a broader network beyond the MBSS. (This is
18433ddd53f3SChun-Yeow Yeoh  *	missnamed in draft 12.0: dot11MeshGateAnnouncementProtocol set to true
18443ddd53f3SChun-Yeow Yeoh  *	only means that the station will announce others it's a mesh gate, but
18453ddd53f3SChun-Yeow Yeoh  *	not necessarily using the gate announcement protocol. Still keeping the
18463ddd53f3SChun-Yeow Yeoh  *	same nomenclature to be in sync with the spec)
18473ddd53f3SChun-Yeow Yeoh  * @dot11MeshForwarding: whether the Mesh STA is forwarding or non-forwarding
18483ddd53f3SChun-Yeow Yeoh  *	entity (default is TRUE - forwarding entity)
18493ddd53f3SChun-Yeow Yeoh  * @rssi_threshold: the threshold for average signal strength of candidate
18503ddd53f3SChun-Yeow Yeoh  *	station to establish a peer link
18513ddd53f3SChun-Yeow Yeoh  * @ht_opmode: mesh HT protection mode
1852ac1073a6SChun-Yeow Yeoh  *
1853ac1073a6SChun-Yeow Yeoh  * @dot11MeshHWMPactivePathToRootTimeout: The time (in TUs) for which mesh STAs
1854ac1073a6SChun-Yeow Yeoh  *	receiving a proactive PREQ shall consider the forwarding information to
1855ac1073a6SChun-Yeow Yeoh  *	the root mesh STA to be valid.
1856ac1073a6SChun-Yeow Yeoh  *
1857ac1073a6SChun-Yeow Yeoh  * @dot11MeshHWMProotInterval: The interval of time (in TUs) between proactive
1858ac1073a6SChun-Yeow Yeoh  *	PREQs are transmitted.
1859728b19e5SChun-Yeow Yeoh  * @dot11MeshHWMPconfirmationInterval: The minimum interval of time (in TUs)
1860728b19e5SChun-Yeow Yeoh  *	during which a mesh STA can send only one Action frame containing
1861728b19e5SChun-Yeow Yeoh  *	a PREQ element for root path confirmation.
18623b1c5a53SMarco Porsch  * @power_mode: The default mesh power save mode which will be the initial
18633b1c5a53SMarco Porsch  *	setting for new peer links.
18643b1c5a53SMarco Porsch  * @dot11MeshAwakeWindowDuration: The duration in TUs the STA will remain awake
18653b1c5a53SMarco Porsch  *	after transmitting its beacon.
18668e7c0538SColleen Twitty  * @plink_timeout: If no tx activity is seen from a STA we've established
18678e7c0538SColleen Twitty  *	peering with for longer than this time (in seconds), then remove it
18688e7c0538SColleen Twitty  *	from the STA's list of peers.  Default is 30 minutes.
186901d66fbdSBob Copeland  * @dot11MeshConnectedToMeshGate: if set to true, advertise that this STA is
187001d66fbdSBob Copeland  *      connected to a mesh gate in mesh formation info.  If false, the
187101d66fbdSBob Copeland  *      value in mesh formation is determined by the presence of root paths
187201d66fbdSBob Copeland  *      in the mesh path table
187329cbe68cSJohannes Berg  */
187493da9cc1Scolin@cozybit.com struct mesh_config {
187593da9cc1Scolin@cozybit.com 	u16 dot11MeshRetryTimeout;
187693da9cc1Scolin@cozybit.com 	u16 dot11MeshConfirmTimeout;
187793da9cc1Scolin@cozybit.com 	u16 dot11MeshHoldingTimeout;
187893da9cc1Scolin@cozybit.com 	u16 dot11MeshMaxPeerLinks;
187993da9cc1Scolin@cozybit.com 	u8 dot11MeshMaxRetries;
188093da9cc1Scolin@cozybit.com 	u8 dot11MeshTTL;
188145904f21SJavier Cardona 	u8 element_ttl;
188293da9cc1Scolin@cozybit.com 	bool auto_open_plinks;
1883d299a1f2SJavier Cardona 	u32 dot11MeshNbrOffsetMaxNeighbor;
188493da9cc1Scolin@cozybit.com 	u8 dot11MeshHWMPmaxPREQretries;
188593da9cc1Scolin@cozybit.com 	u32 path_refresh_time;
188693da9cc1Scolin@cozybit.com 	u16 min_discovery_timeout;
188793da9cc1Scolin@cozybit.com 	u32 dot11MeshHWMPactivePathTimeout;
188893da9cc1Scolin@cozybit.com 	u16 dot11MeshHWMPpreqMinInterval;
1889dca7e943SThomas Pedersen 	u16 dot11MeshHWMPperrMinInterval;
189093da9cc1Scolin@cozybit.com 	u16 dot11MeshHWMPnetDiameterTraversalTime;
189163c5723bSRui Paulo 	u8 dot11MeshHWMPRootMode;
189201d66fbdSBob Copeland 	bool dot11MeshConnectedToMeshGate;
18930507e159SJavier Cardona 	u16 dot11MeshHWMPRannInterval;
189416dd7267SJavier Cardona 	bool dot11MeshGateAnnouncementProtocol;
189594f90656SChun-Yeow Yeoh 	bool dot11MeshForwarding;
189655335137SAshok Nagarajan 	s32 rssi_threshold;
189770c33eaaSAshok Nagarajan 	u16 ht_opmode;
1898ac1073a6SChun-Yeow Yeoh 	u32 dot11MeshHWMPactivePathToRootTimeout;
1899ac1073a6SChun-Yeow Yeoh 	u16 dot11MeshHWMProotInterval;
1900728b19e5SChun-Yeow Yeoh 	u16 dot11MeshHWMPconfirmationInterval;
19013b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode power_mode;
19023b1c5a53SMarco Porsch 	u16 dot11MeshAwakeWindowDuration;
19038e7c0538SColleen Twitty 	u32 plink_timeout;
190493da9cc1Scolin@cozybit.com };
190593da9cc1Scolin@cozybit.com 
190631888487SJouni Malinen /**
190729cbe68cSJohannes Berg  * struct mesh_setup - 802.11s mesh setup configuration
1908683b6d3bSJohannes Berg  * @chandef: defines the channel to use
190929cbe68cSJohannes Berg  * @mesh_id: the mesh ID
191029cbe68cSJohannes Berg  * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes
1911d299a1f2SJavier Cardona  * @sync_method: which synchronization method to use
1912c80d545dSJavier Cardona  * @path_sel_proto: which path selection protocol to use
1913c80d545dSJavier Cardona  * @path_metric: which metric to use
19146e16d90bSColleen Twitty  * @auth_id: which authentication method this mesh is using
1915581a8b0fSJavier Cardona  * @ie: vendor information elements (optional)
1916581a8b0fSJavier Cardona  * @ie_len: length of vendor information elements
1917b130e5ceSJavier Cardona  * @is_authenticated: this mesh requires authentication
1918b130e5ceSJavier Cardona  * @is_secure: this mesh uses security
1919bb2798d4SThomas Pedersen  * @user_mpm: userspace handles all MPM functions
19209bdbf04dSMarco Porsch  * @dtim_period: DTIM period to use
19219bdbf04dSMarco Porsch  * @beacon_interval: beacon interval to use
19224bb62344SChun-Yeow Yeoh  * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a]
1923ffb3cf30SAshok Nagarajan  * @basic_rates: basic rates to use when creating the mesh
19248564e382SJohannes Berg  * @beacon_rate: bitrate to be used for beacons
1925d37d49c2SBenjamin Berg  * @userspace_handles_dfs: whether user space controls DFS operation, i.e.
1926d37d49c2SBenjamin Berg  *	changes the channel when a radar is detected. This is required
1927d37d49c2SBenjamin Berg  *	to operate on DFS channels.
19281224f583SDenis Kenzior  * @control_port_over_nl80211: TRUE if userspace expects to exchange control
19291224f583SDenis Kenzior  *	port frames over NL80211 instead of the network interface.
193029cbe68cSJohannes Berg  *
193129cbe68cSJohannes Berg  * These parameters are fixed when the mesh is created.
193229cbe68cSJohannes Berg  */
193329cbe68cSJohannes Berg struct mesh_setup {
1934683b6d3bSJohannes Berg 	struct cfg80211_chan_def chandef;
193529cbe68cSJohannes Berg 	const u8 *mesh_id;
193629cbe68cSJohannes Berg 	u8 mesh_id_len;
1937d299a1f2SJavier Cardona 	u8 sync_method;
1938c80d545dSJavier Cardona 	u8 path_sel_proto;
1939c80d545dSJavier Cardona 	u8 path_metric;
19406e16d90bSColleen Twitty 	u8 auth_id;
1941581a8b0fSJavier Cardona 	const u8 *ie;
1942581a8b0fSJavier Cardona 	u8 ie_len;
1943b130e5ceSJavier Cardona 	bool is_authenticated;
194415d5dda6SJavier Cardona 	bool is_secure;
1945bb2798d4SThomas Pedersen 	bool user_mpm;
19469bdbf04dSMarco Porsch 	u8 dtim_period;
19479bdbf04dSMarco Porsch 	u16 beacon_interval;
194857fbcce3SJohannes Berg 	int mcast_rate[NUM_NL80211_BANDS];
1949ffb3cf30SAshok Nagarajan 	u32 basic_rates;
19508564e382SJohannes Berg 	struct cfg80211_bitrate_mask beacon_rate;
1951d37d49c2SBenjamin Berg 	bool userspace_handles_dfs;
19521224f583SDenis Kenzior 	bool control_port_over_nl80211;
195329cbe68cSJohannes Berg };
195429cbe68cSJohannes Berg 
195529cbe68cSJohannes Berg /**
19566e0bd6c3SRostislav Lisovy  * struct ocb_setup - 802.11p OCB mode setup configuration
19576e0bd6c3SRostislav Lisovy  * @chandef: defines the channel to use
19586e0bd6c3SRostislav Lisovy  *
19596e0bd6c3SRostislav Lisovy  * These parameters are fixed when connecting to the network
19606e0bd6c3SRostislav Lisovy  */
19616e0bd6c3SRostislav Lisovy struct ocb_setup {
19626e0bd6c3SRostislav Lisovy 	struct cfg80211_chan_def chandef;
19636e0bd6c3SRostislav Lisovy };
19646e0bd6c3SRostislav Lisovy 
19656e0bd6c3SRostislav Lisovy /**
196631888487SJouni Malinen  * struct ieee80211_txq_params - TX queue parameters
1967a3304b0aSJohannes Berg  * @ac: AC identifier
196831888487SJouni Malinen  * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled
196931888487SJouni Malinen  * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range
197031888487SJouni Malinen  *	1..32767]
197131888487SJouni Malinen  * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range
197231888487SJouni Malinen  *	1..32767]
197331888487SJouni Malinen  * @aifs: Arbitration interframe space [0..255]
197431888487SJouni Malinen  */
197531888487SJouni Malinen struct ieee80211_txq_params {
1976a3304b0aSJohannes Berg 	enum nl80211_ac ac;
197731888487SJouni Malinen 	u16 txop;
197831888487SJouni Malinen 	u16 cwmin;
197931888487SJouni Malinen 	u16 cwmax;
198031888487SJouni Malinen 	u8 aifs;
198131888487SJouni Malinen };
198231888487SJouni Malinen 
1983d70e9693SJohannes Berg /**
1984d70e9693SJohannes Berg  * DOC: Scanning and BSS list handling
1985d70e9693SJohannes Berg  *
1986d70e9693SJohannes Berg  * The scanning process itself is fairly simple, but cfg80211 offers quite
1987d70e9693SJohannes Berg  * a bit of helper functionality. To start a scan, the scan operation will
1988d70e9693SJohannes Berg  * be invoked with a scan definition. This scan definition contains the
1989d70e9693SJohannes Berg  * channels to scan, and the SSIDs to send probe requests for (including the
1990d70e9693SJohannes Berg  * wildcard, if desired). A passive scan is indicated by having no SSIDs to
1991d70e9693SJohannes Berg  * probe. Additionally, a scan request may contain extra information elements
1992d70e9693SJohannes Berg  * that should be added to the probe request. The IEs are guaranteed to be
1993d70e9693SJohannes Berg  * well-formed, and will not exceed the maximum length the driver advertised
1994d70e9693SJohannes Berg  * in the wiphy structure.
1995d70e9693SJohannes Berg  *
1996d70e9693SJohannes Berg  * When scanning finds a BSS, cfg80211 needs to be notified of that, because
1997d70e9693SJohannes Berg  * it is responsible for maintaining the BSS list; the driver should not
1998d70e9693SJohannes Berg  * maintain a list itself. For this notification, various functions exist.
1999d70e9693SJohannes Berg  *
2000d70e9693SJohannes Berg  * Since drivers do not maintain a BSS list, there are also a number of
2001d70e9693SJohannes Berg  * functions to search for a BSS and obtain information about it from the
2002d70e9693SJohannes Berg  * BSS structure cfg80211 maintains. The BSS list is also made available
2003d70e9693SJohannes Berg  * to userspace.
2004d70e9693SJohannes Berg  */
200572bdcf34SJouni Malinen 
2006704232c2SJohannes Berg /**
20072a519311SJohannes Berg  * struct cfg80211_ssid - SSID description
20082a519311SJohannes Berg  * @ssid: the SSID
20092a519311SJohannes Berg  * @ssid_len: length of the ssid
20102a519311SJohannes Berg  */
20112a519311SJohannes Berg struct cfg80211_ssid {
20122a519311SJohannes Berg 	u8 ssid[IEEE80211_MAX_SSID_LEN];
20132a519311SJohannes Berg 	u8 ssid_len;
20142a519311SJohannes Berg };
20152a519311SJohannes Berg 
20162a519311SJohannes Berg /**
20171d76250bSAvraham Stern  * struct cfg80211_scan_info - information about completed scan
20181d76250bSAvraham Stern  * @scan_start_tsf: scan start time in terms of the TSF of the BSS that the
20191d76250bSAvraham Stern  *	wireless device that requested the scan is connected to. If this
20201d76250bSAvraham Stern  *	information is not available, this field is left zero.
20211d76250bSAvraham Stern  * @tsf_bssid: the BSSID according to which %scan_start_tsf is set.
20221d76250bSAvraham Stern  * @aborted: set to true if the scan was aborted for any reason,
20231d76250bSAvraham Stern  *	userspace will be notified of that
20241d76250bSAvraham Stern  */
20251d76250bSAvraham Stern struct cfg80211_scan_info {
20261d76250bSAvraham Stern 	u64 scan_start_tsf;
20271d76250bSAvraham Stern 	u8 tsf_bssid[ETH_ALEN] __aligned(2);
20281d76250bSAvraham Stern 	bool aborted;
20291d76250bSAvraham Stern };
20301d76250bSAvraham Stern 
20311d76250bSAvraham Stern /**
20322a519311SJohannes Berg  * struct cfg80211_scan_request - scan request description
20332a519311SJohannes Berg  *
20342a519311SJohannes Berg  * @ssids: SSIDs to scan for (active scan only)
20352a519311SJohannes Berg  * @n_ssids: number of SSIDs
20362a519311SJohannes Berg  * @channels: channels to scan on.
2037ca3dbc20SHelmut Schaa  * @n_channels: total number of channels to scan
2038dcd6eac1SSimon Wunderlich  * @scan_width: channel width for scanning
203970692ad2SJouni Malinen  * @ie: optional information element(s) to add into Probe Request or %NULL
204070692ad2SJouni Malinen  * @ie_len: length of ie in octets
20411d76250bSAvraham Stern  * @duration: how long to listen on each channel, in TUs. If
20421d76250bSAvraham Stern  *	%duration_mandatory is not set, this is the maximum dwell time and
20431d76250bSAvraham Stern  *	the actual dwell time may be shorter.
20441d76250bSAvraham Stern  * @duration_mandatory: if set, the scan duration must be as specified by the
20451d76250bSAvraham Stern  *	%duration field.
2046ed473771SSam Leffler  * @flags: bit field of flags controlling operation
204734850ab2SJohannes Berg  * @rates: bitmap of rates to advertise for each band
20482a519311SJohannes Berg  * @wiphy: the wiphy this was for
204915d6030bSSam Leffler  * @scan_start: time (in jiffies) when the scan started
2050fd014284SJohannes Berg  * @wdev: the wireless device to scan for
20511d76250bSAvraham Stern  * @info: (internal) information about completed scan
20525fe231e8SJohannes Berg  * @notified: (internal) scan request was notified as done or aborted
2053e9f935e3SRajkumar Manoharan  * @no_cck: used to send probe requests at non CCK rate in 2GHz band
2054ad2b26abSJohannes Berg  * @mac_addr: MAC address used with randomisation
2055ad2b26abSJohannes Berg  * @mac_addr_mask: MAC address mask used with randomisation, bits that
2056ad2b26abSJohannes Berg  *	are 0 in the mask should be randomised, bits that are 1 should
2057ad2b26abSJohannes Berg  *	be taken from the @mac_addr
2058818965d3SJouni Malinen  * @bssid: BSSID to scan for (most commonly, the wildcard BSSID)
20592a519311SJohannes Berg  */
20602a519311SJohannes Berg struct cfg80211_scan_request {
20612a519311SJohannes Berg 	struct cfg80211_ssid *ssids;
20622a519311SJohannes Berg 	int n_ssids;
20632a519311SJohannes Berg 	u32 n_channels;
2064dcd6eac1SSimon Wunderlich 	enum nl80211_bss_scan_width scan_width;
2065de95a54bSJohannes Berg 	const u8 *ie;
206670692ad2SJouni Malinen 	size_t ie_len;
20671d76250bSAvraham Stern 	u16 duration;
20681d76250bSAvraham Stern 	bool duration_mandatory;
2069ed473771SSam Leffler 	u32 flags;
20702a519311SJohannes Berg 
207157fbcce3SJohannes Berg 	u32 rates[NUM_NL80211_BANDS];
207234850ab2SJohannes Berg 
2073fd014284SJohannes Berg 	struct wireless_dev *wdev;
2074fd014284SJohannes Berg 
2075ad2b26abSJohannes Berg 	u8 mac_addr[ETH_ALEN] __aligned(2);
2076ad2b26abSJohannes Berg 	u8 mac_addr_mask[ETH_ALEN] __aligned(2);
2077818965d3SJouni Malinen 	u8 bssid[ETH_ALEN] __aligned(2);
2078ad2b26abSJohannes Berg 
20792a519311SJohannes Berg 	/* internal */
20802a519311SJohannes Berg 	struct wiphy *wiphy;
208115d6030bSSam Leffler 	unsigned long scan_start;
20821d76250bSAvraham Stern 	struct cfg80211_scan_info info;
20831d76250bSAvraham Stern 	bool notified;
2084e9f935e3SRajkumar Manoharan 	bool no_cck;
20855ba63533SJohannes Berg 
20865ba63533SJohannes Berg 	/* keep last */
2087396fba0aSGustavo A. R. Silva 	struct ieee80211_channel *channels[];
20882a519311SJohannes Berg };
20892a519311SJohannes Berg 
2090ad2b26abSJohannes Berg static inline void get_random_mask_addr(u8 *buf, const u8 *addr, const u8 *mask)
2091ad2b26abSJohannes Berg {
2092ad2b26abSJohannes Berg 	int i;
2093ad2b26abSJohannes Berg 
2094ad2b26abSJohannes Berg 	get_random_bytes(buf, ETH_ALEN);
2095ad2b26abSJohannes Berg 	for (i = 0; i < ETH_ALEN; i++) {
2096ad2b26abSJohannes Berg 		buf[i] &= ~mask[i];
2097ad2b26abSJohannes Berg 		buf[i] |= addr[i] & mask[i];
2098ad2b26abSJohannes Berg 	}
2099ad2b26abSJohannes Berg }
2100ad2b26abSJohannes Berg 
21012a519311SJohannes Berg /**
2102a1f1c21cSLuciano Coelho  * struct cfg80211_match_set - sets of attributes to match
2103a1f1c21cSLuciano Coelho  *
21043007e352SArend Van Spriel  * @ssid: SSID to be matched; may be zero-length in case of BSSID match
21053007e352SArend Van Spriel  *	or no match (RSSI only)
21063007e352SArend Van Spriel  * @bssid: BSSID to be matched; may be all-zero BSSID in case of SSID match
21073007e352SArend Van Spriel  *	or no match (RSSI only)
2108ea73cbceSJohannes Berg  * @rssi_thold: don't report scan results below this threshold (in s32 dBm)
21091e1b11b6Svamsi krishna  * @per_band_rssi_thold: Minimum rssi threshold for each band to be applied
21101e1b11b6Svamsi krishna  *	for filtering out scan results received. Drivers advertize this support
21111e1b11b6Svamsi krishna  *	of band specific rssi based filtering through the feature capability
21121e1b11b6Svamsi krishna  *	%NL80211_EXT_FEATURE_SCHED_SCAN_BAND_SPECIFIC_RSSI_THOLD. These band
21131e1b11b6Svamsi krishna  *	specific rssi thresholds take precedence over rssi_thold, if specified.
21141e1b11b6Svamsi krishna  *	If not specified for any band, it will be assigned with rssi_thold of
21151e1b11b6Svamsi krishna  *	corresponding matchset.
2116a1f1c21cSLuciano Coelho  */
2117a1f1c21cSLuciano Coelho struct cfg80211_match_set {
2118a1f1c21cSLuciano Coelho 	struct cfg80211_ssid ssid;
21193007e352SArend Van Spriel 	u8 bssid[ETH_ALEN];
2120ea73cbceSJohannes Berg 	s32 rssi_thold;
21211e1b11b6Svamsi krishna 	s32 per_band_rssi_thold[NUM_NL80211_BANDS];
2122a1f1c21cSLuciano Coelho };
2123a1f1c21cSLuciano Coelho 
2124a1f1c21cSLuciano Coelho /**
21253b06d277SAvraham Stern  * struct cfg80211_sched_scan_plan - scan plan for scheduled scan
21263b06d277SAvraham Stern  *
21273b06d277SAvraham Stern  * @interval: interval between scheduled scan iterations. In seconds.
21283b06d277SAvraham Stern  * @iterations: number of scan iterations in this scan plan. Zero means
21293b06d277SAvraham Stern  *	infinite loop.
21303b06d277SAvraham Stern  *	The last scan plan will always have this parameter set to zero,
21313b06d277SAvraham Stern  *	all other scan plans will have a finite number of iterations.
21323b06d277SAvraham Stern  */
21333b06d277SAvraham Stern struct cfg80211_sched_scan_plan {
21343b06d277SAvraham Stern 	u32 interval;
21353b06d277SAvraham Stern 	u32 iterations;
21363b06d277SAvraham Stern };
21373b06d277SAvraham Stern 
21383b06d277SAvraham Stern /**
2139bf95ecdbSvamsi krishna  * struct cfg80211_bss_select_adjust - BSS selection with RSSI adjustment.
2140bf95ecdbSvamsi krishna  *
2141bf95ecdbSvamsi krishna  * @band: band of BSS which should match for RSSI level adjustment.
2142bf95ecdbSvamsi krishna  * @delta: value of RSSI level adjustment.
2143bf95ecdbSvamsi krishna  */
2144bf95ecdbSvamsi krishna struct cfg80211_bss_select_adjust {
2145bf95ecdbSvamsi krishna 	enum nl80211_band band;
2146bf95ecdbSvamsi krishna 	s8 delta;
2147bf95ecdbSvamsi krishna };
2148bf95ecdbSvamsi krishna 
2149bf95ecdbSvamsi krishna /**
2150807f8a8cSLuciano Coelho  * struct cfg80211_sched_scan_request - scheduled scan request description
2151807f8a8cSLuciano Coelho  *
215296b08fd6SArend Van Spriel  * @reqid: identifies this request.
2153807f8a8cSLuciano Coelho  * @ssids: SSIDs to scan for (passed in the probe_reqs in active scans)
2154807f8a8cSLuciano Coelho  * @n_ssids: number of SSIDs
2155807f8a8cSLuciano Coelho  * @n_channels: total number of channels to scan
2156dcd6eac1SSimon Wunderlich  * @scan_width: channel width for scanning
2157807f8a8cSLuciano Coelho  * @ie: optional information element(s) to add into Probe Request or %NULL
2158807f8a8cSLuciano Coelho  * @ie_len: length of ie in octets
2159ed473771SSam Leffler  * @flags: bit field of flags controlling operation
2160a1f1c21cSLuciano Coelho  * @match_sets: sets of parameters to be matched for a scan result
2161a1f1c21cSLuciano Coelho  *	entry to be considered valid and to be passed to the host
2162a1f1c21cSLuciano Coelho  *	(others are filtered out).
2163a1f1c21cSLuciano Coelho  *	If ommited, all results are passed.
2164a1f1c21cSLuciano Coelho  * @n_match_sets: number of match sets
21656406c919SJohannes Berg  * @report_results: indicates that results were reported for this request
2166807f8a8cSLuciano Coelho  * @wiphy: the wiphy this was for
2167807f8a8cSLuciano Coelho  * @dev: the interface
2168077f897aSJohannes Berg  * @scan_start: start time of the scheduled scan
2169807f8a8cSLuciano Coelho  * @channels: channels to scan
2170ea73cbceSJohannes Berg  * @min_rssi_thold: for drivers only supporting a single threshold, this
2171ea73cbceSJohannes Berg  *	contains the minimum over all matchsets
2172ad2b26abSJohannes Berg  * @mac_addr: MAC address used with randomisation
2173ad2b26abSJohannes Berg  * @mac_addr_mask: MAC address mask used with randomisation, bits that
2174ad2b26abSJohannes Berg  *	are 0 in the mask should be randomised, bits that are 1 should
2175ad2b26abSJohannes Berg  *	be taken from the @mac_addr
21763b06d277SAvraham Stern  * @scan_plans: scan plans to be executed in this scheduled scan. Lowest
21773b06d277SAvraham Stern  *	index must be executed first.
21783b06d277SAvraham Stern  * @n_scan_plans: number of scan plans, at least 1.
217931a60ed1SJukka Rissanen  * @rcu_head: RCU callback used to free the struct
218093a1e86cSJukka Rissanen  * @owner_nlportid: netlink portid of owner (if this should is a request
218193a1e86cSJukka Rissanen  *	owned by a particular socket)
2182ca986ad9SArend Van Spriel  * @nl_owner_dead: netlink owner socket was closed - this request be freed
2183ca986ad9SArend Van Spriel  * @list: for keeping list of requests.
21849c748934SLuciano Coelho  * @delay: delay in seconds to use before starting the first scan
21859c748934SLuciano Coelho  *	cycle.  The driver may ignore this parameter and start
21869c748934SLuciano Coelho  *	immediately (or at any other time), if this feature is not
21879c748934SLuciano Coelho  *	supported.
2188bf95ecdbSvamsi krishna  * @relative_rssi_set: Indicates whether @relative_rssi is set or not.
2189bf95ecdbSvamsi krishna  * @relative_rssi: Relative RSSI threshold in dB to restrict scan result
2190bf95ecdbSvamsi krishna  *	reporting in connected state to cases where a matching BSS is determined
2191bf95ecdbSvamsi krishna  *	to have better or slightly worse RSSI than the current connected BSS.
2192bf95ecdbSvamsi krishna  *	The relative RSSI threshold values are ignored in disconnected state.
2193bf95ecdbSvamsi krishna  * @rssi_adjust: delta dB of RSSI preference to be given to the BSSs that belong
2194bf95ecdbSvamsi krishna  *	to the specified band while deciding whether a better BSS is reported
2195bf95ecdbSvamsi krishna  *	using @relative_rssi. If delta is a negative number, the BSSs that
2196bf95ecdbSvamsi krishna  *	belong to the specified band will be penalized by delta dB in relative
2197bf95ecdbSvamsi krishna  *	comparisions.
2198807f8a8cSLuciano Coelho  */
2199807f8a8cSLuciano Coelho struct cfg80211_sched_scan_request {
220096b08fd6SArend Van Spriel 	u64 reqid;
2201807f8a8cSLuciano Coelho 	struct cfg80211_ssid *ssids;
2202807f8a8cSLuciano Coelho 	int n_ssids;
2203807f8a8cSLuciano Coelho 	u32 n_channels;
2204dcd6eac1SSimon Wunderlich 	enum nl80211_bss_scan_width scan_width;
2205807f8a8cSLuciano Coelho 	const u8 *ie;
2206807f8a8cSLuciano Coelho 	size_t ie_len;
2207ed473771SSam Leffler 	u32 flags;
2208a1f1c21cSLuciano Coelho 	struct cfg80211_match_set *match_sets;
2209a1f1c21cSLuciano Coelho 	int n_match_sets;
2210ea73cbceSJohannes Berg 	s32 min_rssi_thold;
22119c748934SLuciano Coelho 	u32 delay;
22123b06d277SAvraham Stern 	struct cfg80211_sched_scan_plan *scan_plans;
22133b06d277SAvraham Stern 	int n_scan_plans;
2214807f8a8cSLuciano Coelho 
2215ad2b26abSJohannes Berg 	u8 mac_addr[ETH_ALEN] __aligned(2);
2216ad2b26abSJohannes Berg 	u8 mac_addr_mask[ETH_ALEN] __aligned(2);
2217ad2b26abSJohannes Berg 
2218bf95ecdbSvamsi krishna 	bool relative_rssi_set;
2219bf95ecdbSvamsi krishna 	s8 relative_rssi;
2220bf95ecdbSvamsi krishna 	struct cfg80211_bss_select_adjust rssi_adjust;
2221bf95ecdbSvamsi krishna 
2222807f8a8cSLuciano Coelho 	/* internal */
2223807f8a8cSLuciano Coelho 	struct wiphy *wiphy;
2224807f8a8cSLuciano Coelho 	struct net_device *dev;
222515d6030bSSam Leffler 	unsigned long scan_start;
2226b34939b9SArend Van Spriel 	bool report_results;
222731a60ed1SJukka Rissanen 	struct rcu_head rcu_head;
222893a1e86cSJukka Rissanen 	u32 owner_nlportid;
2229ca986ad9SArend Van Spriel 	bool nl_owner_dead;
2230ca986ad9SArend Van Spriel 	struct list_head list;
2231807f8a8cSLuciano Coelho 
2232807f8a8cSLuciano Coelho 	/* keep last */
2233396fba0aSGustavo A. R. Silva 	struct ieee80211_channel *channels[];
2234807f8a8cSLuciano Coelho };
2235807f8a8cSLuciano Coelho 
2236807f8a8cSLuciano Coelho /**
22372a519311SJohannes Berg  * enum cfg80211_signal_type - signal type
22382a519311SJohannes Berg  *
22392a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available
22402a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm)
22412a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100
22422a519311SJohannes Berg  */
22432a519311SJohannes Berg enum cfg80211_signal_type {
22442a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_NONE,
22452a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_MBM,
22462a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_UNSPEC,
22472a519311SJohannes Berg };
22482a519311SJohannes Berg 
22492a519311SJohannes Berg /**
22506e19bc4bSDmitry Shmidt  * struct cfg80211_inform_bss - BSS inform data
22516e19bc4bSDmitry Shmidt  * @chan: channel the frame was received on
22526e19bc4bSDmitry Shmidt  * @scan_width: scan width that was used
22536e19bc4bSDmitry Shmidt  * @signal: signal strength value, according to the wiphy's
22546e19bc4bSDmitry Shmidt  *	signal type
22556e19bc4bSDmitry Shmidt  * @boottime_ns: timestamp (CLOCK_BOOTTIME) when the information was
22566e19bc4bSDmitry Shmidt  *	received; should match the time when the frame was actually
22576e19bc4bSDmitry Shmidt  *	received by the device (not just by the host, in case it was
22586e19bc4bSDmitry Shmidt  *	buffered on the device) and be accurate to about 10ms.
22596e19bc4bSDmitry Shmidt  *	If the frame isn't buffered, just passing the return value of
22609285ec4cSJason A. Donenfeld  *	ktime_get_boottime_ns() is likely appropriate.
22611d76250bSAvraham Stern  * @parent_tsf: the time at the start of reception of the first octet of the
22621d76250bSAvraham Stern  *	timestamp field of the frame. The time is the TSF of the BSS specified
22631d76250bSAvraham Stern  *	by %parent_bssid.
22641d76250bSAvraham Stern  * @parent_bssid: the BSS according to which %parent_tsf is set. This is set to
22651d76250bSAvraham Stern  *	the BSS that requested the scan in which the beacon/probe was received.
2266983dafaaSSunil Dutt  * @chains: bitmask for filled values in @chain_signal.
2267983dafaaSSunil Dutt  * @chain_signal: per-chain signal strength of last received BSS in dBm.
22686e19bc4bSDmitry Shmidt  */
22696e19bc4bSDmitry Shmidt struct cfg80211_inform_bss {
22706e19bc4bSDmitry Shmidt 	struct ieee80211_channel *chan;
22716e19bc4bSDmitry Shmidt 	enum nl80211_bss_scan_width scan_width;
22726e19bc4bSDmitry Shmidt 	s32 signal;
22736e19bc4bSDmitry Shmidt 	u64 boottime_ns;
22741d76250bSAvraham Stern 	u64 parent_tsf;
22751d76250bSAvraham Stern 	u8 parent_bssid[ETH_ALEN] __aligned(2);
2276983dafaaSSunil Dutt 	u8 chains;
2277983dafaaSSunil Dutt 	s8 chain_signal[IEEE80211_MAX_CHAINS];
22786e19bc4bSDmitry Shmidt };
22796e19bc4bSDmitry Shmidt 
22806e19bc4bSDmitry Shmidt /**
22812aa4d456SAkira Moroo  * struct cfg80211_bss_ies - BSS entry IE data
22828cef2c9dSJohannes Berg  * @tsf: TSF contained in the frame that carried these IEs
22839caf0364SJohannes Berg  * @rcu_head: internal use, for freeing
22849caf0364SJohannes Berg  * @len: length of the IEs
22850e227084SJohannes Berg  * @from_beacon: these IEs are known to come from a beacon
22869caf0364SJohannes Berg  * @data: IE data
22879caf0364SJohannes Berg  */
22889caf0364SJohannes Berg struct cfg80211_bss_ies {
22898cef2c9dSJohannes Berg 	u64 tsf;
22909caf0364SJohannes Berg 	struct rcu_head rcu_head;
22919caf0364SJohannes Berg 	int len;
22920e227084SJohannes Berg 	bool from_beacon;
22939caf0364SJohannes Berg 	u8 data[];
22949caf0364SJohannes Berg };
22959caf0364SJohannes Berg 
22969caf0364SJohannes Berg /**
22972a519311SJohannes Berg  * struct cfg80211_bss - BSS description
22982a519311SJohannes Berg  *
22992a519311SJohannes Berg  * This structure describes a BSS (which may also be a mesh network)
23002a519311SJohannes Berg  * for use in scan results and similar.
23012a519311SJohannes Berg  *
2302abe37c4bSJohannes Berg  * @channel: channel this BSS is on
2303dcd6eac1SSimon Wunderlich  * @scan_width: width of the control channel
23042a519311SJohannes Berg  * @bssid: BSSID of the BSS
23052a519311SJohannes Berg  * @beacon_interval: the beacon interval as from the frame
23062a519311SJohannes Berg  * @capability: the capability field in host byte order
230783c7aa1aSJohannes Berg  * @ies: the information elements (Note that there is no guarantee that these
230883c7aa1aSJohannes Berg  *	are well-formed!); this is a pointer to either the beacon_ies or
230983c7aa1aSJohannes Berg  *	proberesp_ies depending on whether Probe Response frame has been
231083c7aa1aSJohannes Berg  *	received. It is always non-%NULL.
231134a6eddbSJouni Malinen  * @beacon_ies: the information elements from the last Beacon frame
2312776b3580SJohannes Berg  *	(implementation note: if @hidden_beacon_bss is set this struct doesn't
2313776b3580SJohannes Berg  *	own the beacon_ies, but they're just pointers to the ones from the
2314776b3580SJohannes Berg  *	@hidden_beacon_bss struct)
231534a6eddbSJouni Malinen  * @proberesp_ies: the information elements from the last Probe Response frame
2316776b3580SJohannes Berg  * @hidden_beacon_bss: in case this BSS struct represents a probe response from
2317776b3580SJohannes Berg  *	a BSS that hides the SSID in its beacon, this points to the BSS struct
2318776b3580SJohannes Berg  *	that holds the beacon data. @beacon_ies is still valid, of course, and
2319776b3580SJohannes Berg  *	points to the same data as hidden_beacon_bss->beacon_ies in that case.
2320851ae31dSJohannes Berg  * @transmitted_bss: pointer to the transmitted BSS, if this is a
2321851ae31dSJohannes Berg  *	non-transmitted one (multi-BSSID support)
2322851ae31dSJohannes Berg  * @nontrans_list: list of non-transmitted BSS, if this is a transmitted one
2323851ae31dSJohannes Berg  *	(multi-BSSID support)
232477965c97SJohannes Berg  * @signal: signal strength value (type depends on the wiphy's signal_type)
2325983dafaaSSunil Dutt  * @chains: bitmask for filled values in @chain_signal.
2326983dafaaSSunil Dutt  * @chain_signal: per-chain signal strength of last received BSS in dBm.
23270cd01efbSSara Sharon  * @bssid_index: index in the multiple BSS set
23280cd01efbSSara Sharon  * @max_bssid_indicator: max number of members in the BSS set
23292a519311SJohannes Berg  * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
23302a519311SJohannes Berg  */
23312a519311SJohannes Berg struct cfg80211_bss {
23322a519311SJohannes Berg 	struct ieee80211_channel *channel;
2333dcd6eac1SSimon Wunderlich 	enum nl80211_bss_scan_width scan_width;
23342a519311SJohannes Berg 
23359caf0364SJohannes Berg 	const struct cfg80211_bss_ies __rcu *ies;
23369caf0364SJohannes Berg 	const struct cfg80211_bss_ies __rcu *beacon_ies;
23379caf0364SJohannes Berg 	const struct cfg80211_bss_ies __rcu *proberesp_ies;
23389caf0364SJohannes Berg 
2339776b3580SJohannes Berg 	struct cfg80211_bss *hidden_beacon_bss;
23407011ba58SSara Sharon 	struct cfg80211_bss *transmitted_bss;
23417011ba58SSara Sharon 	struct list_head nontrans_list;
23422a519311SJohannes Berg 
23432a519311SJohannes Berg 	s32 signal;
23442a519311SJohannes Berg 
23459caf0364SJohannes Berg 	u16 beacon_interval;
23469caf0364SJohannes Berg 	u16 capability;
23479caf0364SJohannes Berg 
23489caf0364SJohannes Berg 	u8 bssid[ETH_ALEN];
2349983dafaaSSunil Dutt 	u8 chains;
2350983dafaaSSunil Dutt 	s8 chain_signal[IEEE80211_MAX_CHAINS];
23519caf0364SJohannes Berg 
23520cd01efbSSara Sharon 	u8 bssid_index;
23530cd01efbSSara Sharon 	u8 max_bssid_indicator;
23540cd01efbSSara Sharon 
2355396fba0aSGustavo A. R. Silva 	u8 priv[] __aligned(sizeof(void *));
23562a519311SJohannes Berg };
23572a519311SJohannes Berg 
23582a519311SJohannes Berg /**
235949a68e0dSJohannes Berg  * ieee80211_bss_get_elem - find element with given ID
2360517357c6SJohannes Berg  * @bss: the bss to search
236149a68e0dSJohannes Berg  * @id: the element ID
23629caf0364SJohannes Berg  *
23639caf0364SJohannes Berg  * Note that the return value is an RCU-protected pointer, so
23649caf0364SJohannes Berg  * rcu_read_lock() must be held when calling this function.
23650ae997dcSYacine Belkadi  * Return: %NULL if not found.
2366517357c6SJohannes Berg  */
236749a68e0dSJohannes Berg const struct element *ieee80211_bss_get_elem(struct cfg80211_bss *bss, u8 id);
236849a68e0dSJohannes Berg 
236949a68e0dSJohannes Berg /**
237049a68e0dSJohannes Berg  * ieee80211_bss_get_ie - find IE with given ID
237149a68e0dSJohannes Berg  * @bss: the bss to search
237249a68e0dSJohannes Berg  * @id: the element ID
237349a68e0dSJohannes Berg  *
237449a68e0dSJohannes Berg  * Note that the return value is an RCU-protected pointer, so
237549a68e0dSJohannes Berg  * rcu_read_lock() must be held when calling this function.
237649a68e0dSJohannes Berg  * Return: %NULL if not found.
237749a68e0dSJohannes Berg  */
237849a68e0dSJohannes Berg static inline const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 id)
237949a68e0dSJohannes Berg {
238049a68e0dSJohannes Berg 	return (void *)ieee80211_bss_get_elem(bss, id);
238149a68e0dSJohannes Berg }
2382517357c6SJohannes Berg 
2383517357c6SJohannes Berg 
2384517357c6SJohannes Berg /**
2385636a5d36SJouni Malinen  * struct cfg80211_auth_request - Authentication request data
2386636a5d36SJouni Malinen  *
2387636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
2388636a5d36SJouni Malinen  * authentication.
2389636a5d36SJouni Malinen  *
2390959867faSJohannes Berg  * @bss: The BSS to authenticate with, the callee must obtain a reference
2391959867faSJohannes Berg  *	to it if it needs to keep it.
2392636a5d36SJouni Malinen  * @auth_type: Authentication type (algorithm)
2393636a5d36SJouni Malinen  * @ie: Extra IEs to add to Authentication frame or %NULL
2394636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
2395fffd0934SJohannes Berg  * @key_len: length of WEP key for shared key authentication
2396fffd0934SJohannes Berg  * @key_idx: index of WEP key for shared key authentication
2397fffd0934SJohannes Berg  * @key: WEP key for shared key authentication
239811b6b5a4SJouni Malinen  * @auth_data: Fields and elements in Authentication frames. This contains
239911b6b5a4SJouni Malinen  *	the authentication frame body (non-IE and IE data), excluding the
240011b6b5a4SJouni Malinen  *	Authentication algorithm number, i.e., starting at the Authentication
240111b6b5a4SJouni Malinen  *	transaction sequence number field.
240211b6b5a4SJouni Malinen  * @auth_data_len: Length of auth_data buffer in octets
2403636a5d36SJouni Malinen  */
2404636a5d36SJouni Malinen struct cfg80211_auth_request {
240519957bb3SJohannes Berg 	struct cfg80211_bss *bss;
2406636a5d36SJouni Malinen 	const u8 *ie;
2407636a5d36SJouni Malinen 	size_t ie_len;
240819957bb3SJohannes Berg 	enum nl80211_auth_type auth_type;
2409fffd0934SJohannes Berg 	const u8 *key;
2410fffd0934SJohannes Berg 	u8 key_len, key_idx;
241111b6b5a4SJouni Malinen 	const u8 *auth_data;
241211b6b5a4SJouni Malinen 	size_t auth_data_len;
2413636a5d36SJouni Malinen };
2414636a5d36SJouni Malinen 
2415636a5d36SJouni Malinen /**
24167e7c8926SBen Greear  * enum cfg80211_assoc_req_flags - Over-ride default behaviour in association.
24177e7c8926SBen Greear  *
24187e7c8926SBen Greear  * @ASSOC_REQ_DISABLE_HT:  Disable HT (802.11n)
2419ee2aca34SJohannes Berg  * @ASSOC_REQ_DISABLE_VHT:  Disable VHT
2420bab5ab7dSAssaf Krauss  * @ASSOC_REQ_USE_RRM: Declare RRM capability in this association
242140cbfa90SSrinivas Dasari  * @CONNECT_REQ_EXTERNAL_AUTH_SUPPORT: User space indicates external
242240cbfa90SSrinivas Dasari  *	authentication capability. Drivers can offload authentication to
242340cbfa90SSrinivas Dasari  *	userspace if this flag is set. Only applicable for cfg80211_connect()
242440cbfa90SSrinivas Dasari  *	request (connect callback).
24257e7c8926SBen Greear  */
24267e7c8926SBen Greear enum cfg80211_assoc_req_flags {
24277e7c8926SBen Greear 	ASSOC_REQ_DISABLE_HT			= BIT(0),
2428ee2aca34SJohannes Berg 	ASSOC_REQ_DISABLE_VHT			= BIT(1),
2429bab5ab7dSAssaf Krauss 	ASSOC_REQ_USE_RRM			= BIT(2),
243040cbfa90SSrinivas Dasari 	CONNECT_REQ_EXTERNAL_AUTH_SUPPORT	= BIT(3),
24317e7c8926SBen Greear };
24327e7c8926SBen Greear 
24337e7c8926SBen Greear /**
2434636a5d36SJouni Malinen  * struct cfg80211_assoc_request - (Re)Association request data
2435636a5d36SJouni Malinen  *
2436636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
2437636a5d36SJouni Malinen  * (re)association.
2438959867faSJohannes Berg  * @bss: The BSS to associate with. If the call is successful the driver is
2439959867faSJohannes Berg  *	given a reference that it must give back to cfg80211_send_rx_assoc()
2440959867faSJohannes Berg  *	or to cfg80211_assoc_timeout(). To ensure proper refcounting, new
2441959867faSJohannes Berg  *	association requests while already associating must be rejected.
2442636a5d36SJouni Malinen  * @ie: Extra IEs to add to (Re)Association Request frame or %NULL
2443636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
2444dc6382ceSJouni Malinen  * @use_mfp: Use management frame protection (IEEE 802.11w) in this association
2445b23aa676SSamuel Ortiz  * @crypto: crypto settings
244635eb8f7bSJouni Malinen  * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used
244735eb8f7bSJouni Malinen  *	to indicate a request to reassociate within the ESS instead of a request
244835eb8f7bSJouni Malinen  *	do the initial association with the ESS. When included, this is set to
244935eb8f7bSJouni Malinen  *	the BSSID of the current association, i.e., to the value that is
245035eb8f7bSJouni Malinen  *	included in the Current AP address field of the Reassociation Request
245135eb8f7bSJouni Malinen  *	frame.
24527e7c8926SBen Greear  * @flags:  See &enum cfg80211_assoc_req_flags
24537e7c8926SBen Greear  * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask
24547e7c8926SBen Greear  *	will be used in ht_capa.  Un-supported values will be ignored.
24557e7c8926SBen Greear  * @ht_capa_mask:  The bits of ht_capa which are to be used.
2456ee2aca34SJohannes Berg  * @vht_capa: VHT capability override
2457ee2aca34SJohannes Berg  * @vht_capa_mask: VHT capability mask indicating which fields to use
2458348bd456SJouni Malinen  * @fils_kek: FILS KEK for protecting (Re)Association Request/Response frame or
2459348bd456SJouni Malinen  *	%NULL if FILS is not used.
2460348bd456SJouni Malinen  * @fils_kek_len: Length of fils_kek in octets
2461348bd456SJouni Malinen  * @fils_nonces: FILS nonces (part of AAD) for protecting (Re)Association
2462348bd456SJouni Malinen  *	Request/Response frame or %NULL if FILS is not used. This field starts
2463348bd456SJouni Malinen  *	with 16 octets of STA Nonce followed by 16 octets of AP Nonce.
2464636a5d36SJouni Malinen  */
2465636a5d36SJouni Malinen struct cfg80211_assoc_request {
246619957bb3SJohannes Berg 	struct cfg80211_bss *bss;
24673e5d7649SJohannes Berg 	const u8 *ie, *prev_bssid;
2468636a5d36SJouni Malinen 	size_t ie_len;
2469b23aa676SSamuel Ortiz 	struct cfg80211_crypto_settings crypto;
247019957bb3SJohannes Berg 	bool use_mfp;
24717e7c8926SBen Greear 	u32 flags;
24727e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa;
24737e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa_mask;
2474ee2aca34SJohannes Berg 	struct ieee80211_vht_cap vht_capa, vht_capa_mask;
2475348bd456SJouni Malinen 	const u8 *fils_kek;
2476348bd456SJouni Malinen 	size_t fils_kek_len;
2477348bd456SJouni Malinen 	const u8 *fils_nonces;
2478636a5d36SJouni Malinen };
2479636a5d36SJouni Malinen 
2480636a5d36SJouni Malinen /**
2481636a5d36SJouni Malinen  * struct cfg80211_deauth_request - Deauthentication request data
2482636a5d36SJouni Malinen  *
2483636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
2484636a5d36SJouni Malinen  * deauthentication.
2485636a5d36SJouni Malinen  *
248695de817bSJohannes Berg  * @bssid: the BSSID of the BSS to deauthenticate from
2487636a5d36SJouni Malinen  * @ie: Extra IEs to add to Deauthentication frame or %NULL
2488636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
248919957bb3SJohannes Berg  * @reason_code: The reason code for the deauthentication
2490077f897aSJohannes Berg  * @local_state_change: if set, change local state only and
2491077f897aSJohannes Berg  *	do not set a deauth frame
2492636a5d36SJouni Malinen  */
2493636a5d36SJouni Malinen struct cfg80211_deauth_request {
249495de817bSJohannes Berg 	const u8 *bssid;
2495636a5d36SJouni Malinen 	const u8 *ie;
2496636a5d36SJouni Malinen 	size_t ie_len;
249719957bb3SJohannes Berg 	u16 reason_code;
24986863255bSStanislaw Gruszka 	bool local_state_change;
2499636a5d36SJouni Malinen };
2500636a5d36SJouni Malinen 
2501636a5d36SJouni Malinen /**
2502636a5d36SJouni Malinen  * struct cfg80211_disassoc_request - Disassociation request data
2503636a5d36SJouni Malinen  *
2504636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
250566f00449SMasahiro Yamada  * disassociation.
2506636a5d36SJouni Malinen  *
250719957bb3SJohannes Berg  * @bss: the BSS to disassociate from
2508636a5d36SJouni Malinen  * @ie: Extra IEs to add to Disassociation frame or %NULL
2509636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
251019957bb3SJohannes Berg  * @reason_code: The reason code for the disassociation
2511d5cdfacbSJouni Malinen  * @local_state_change: This is a request for a local state only, i.e., no
2512d5cdfacbSJouni Malinen  *	Disassociation frame is to be transmitted.
2513636a5d36SJouni Malinen  */
2514636a5d36SJouni Malinen struct cfg80211_disassoc_request {
251519957bb3SJohannes Berg 	struct cfg80211_bss *bss;
2516636a5d36SJouni Malinen 	const u8 *ie;
2517636a5d36SJouni Malinen 	size_t ie_len;
251819957bb3SJohannes Berg 	u16 reason_code;
2519d5cdfacbSJouni Malinen 	bool local_state_change;
2520636a5d36SJouni Malinen };
2521636a5d36SJouni Malinen 
2522636a5d36SJouni Malinen /**
252304a773adSJohannes Berg  * struct cfg80211_ibss_params - IBSS parameters
252404a773adSJohannes Berg  *
252504a773adSJohannes Berg  * This structure defines the IBSS parameters for the join_ibss()
252604a773adSJohannes Berg  * method.
252704a773adSJohannes Berg  *
252804a773adSJohannes Berg  * @ssid: The SSID, will always be non-null.
252904a773adSJohannes Berg  * @ssid_len: The length of the SSID, will always be non-zero.
253004a773adSJohannes Berg  * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not
253104a773adSJohannes Berg  *	search for IBSSs with a different BSSID.
2532683b6d3bSJohannes Berg  * @chandef: defines the channel to use if no other IBSS to join can be found
253304a773adSJohannes Berg  * @channel_fixed: The channel should be fixed -- do not search for
253404a773adSJohannes Berg  *	IBSSs to join on other channels.
253504a773adSJohannes Berg  * @ie: information element(s) to include in the beacon
253604a773adSJohannes Berg  * @ie_len: length of that
25378e30bc55SJohannes Berg  * @beacon_interval: beacon interval to use
2538fffd0934SJohannes Berg  * @privacy: this is a protected network, keys will be configured
2539fffd0934SJohannes Berg  *	after joining
2540267335d6SAntonio Quartulli  * @control_port: whether user space controls IEEE 802.1X port, i.e.,
2541267335d6SAntonio Quartulli  *	sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
2542267335d6SAntonio Quartulli  *	required to assume that the port is unauthorized until authorized by
2543267335d6SAntonio Quartulli  *	user space. Otherwise, port is marked authorized by default.
2544c3bfe1f6SDenis Kenzior  * @control_port_over_nl80211: TRUE if userspace expects to exchange control
2545c3bfe1f6SDenis Kenzior  *	port frames over NL80211 instead of the network interface.
25465336fa88SSimon Wunderlich  * @userspace_handles_dfs: whether user space controls DFS operation, i.e.
25475336fa88SSimon Wunderlich  *	changes the channel when a radar is detected. This is required
25485336fa88SSimon Wunderlich  *	to operate on DFS channels.
2549fbd2c8dcSTeemu Paasikivi  * @basic_rates: bitmap of basic rates to use when creating the IBSS
2550dd5b4cc7SFelix Fietkau  * @mcast_rate: per-band multicast rate index + 1 (0: disabled)
2551803768f5SSimon Wunderlich  * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask
2552803768f5SSimon Wunderlich  *	will be used in ht_capa.  Un-supported values will be ignored.
2553803768f5SSimon Wunderlich  * @ht_capa_mask:  The bits of ht_capa which are to be used.
25549ae3b172STova Mussai  * @wep_keys: static WEP keys, if not NULL points to an array of
25559ae3b172STova Mussai  *	CFG80211_MAX_WEP_KEYS WEP keys
25569ae3b172STova Mussai  * @wep_tx_key: key index (0..3) of the default TX static WEP key
255704a773adSJohannes Berg  */
255804a773adSJohannes Berg struct cfg80211_ibss_params {
2559c1e5f471SJohannes Berg 	const u8 *ssid;
2560c1e5f471SJohannes Berg 	const u8 *bssid;
2561683b6d3bSJohannes Berg 	struct cfg80211_chan_def chandef;
2562c1e5f471SJohannes Berg 	const u8 *ie;
256304a773adSJohannes Berg 	u8 ssid_len, ie_len;
25648e30bc55SJohannes Berg 	u16 beacon_interval;
2565fbd2c8dcSTeemu Paasikivi 	u32 basic_rates;
256604a773adSJohannes Berg 	bool channel_fixed;
2567fffd0934SJohannes Berg 	bool privacy;
2568267335d6SAntonio Quartulli 	bool control_port;
2569c3bfe1f6SDenis Kenzior 	bool control_port_over_nl80211;
25705336fa88SSimon Wunderlich 	bool userspace_handles_dfs;
257157fbcce3SJohannes Berg 	int mcast_rate[NUM_NL80211_BANDS];
2572803768f5SSimon Wunderlich 	struct ieee80211_ht_cap ht_capa;
2573803768f5SSimon Wunderlich 	struct ieee80211_ht_cap ht_capa_mask;
25749ae3b172STova Mussai 	struct key_params *wep_keys;
25759ae3b172STova Mussai 	int wep_tx_key;
257604a773adSJohannes Berg };
257704a773adSJohannes Berg 
257804a773adSJohannes Berg /**
257938de03d2SArend van Spriel  * struct cfg80211_bss_selection - connection parameters for BSS selection.
258038de03d2SArend van Spriel  *
258138de03d2SArend van Spriel  * @behaviour: requested BSS selection behaviour.
258238de03d2SArend van Spriel  * @param: parameters for requestion behaviour.
258338de03d2SArend van Spriel  * @band_pref: preferred band for %NL80211_BSS_SELECT_ATTR_BAND_PREF.
258438de03d2SArend van Spriel  * @adjust: parameters for %NL80211_BSS_SELECT_ATTR_RSSI_ADJUST.
258538de03d2SArend van Spriel  */
258638de03d2SArend van Spriel struct cfg80211_bss_selection {
258738de03d2SArend van Spriel 	enum nl80211_bss_select_attr behaviour;
258838de03d2SArend van Spriel 	union {
258957fbcce3SJohannes Berg 		enum nl80211_band band_pref;
259038de03d2SArend van Spriel 		struct cfg80211_bss_select_adjust adjust;
259138de03d2SArend van Spriel 	} param;
259238de03d2SArend van Spriel };
259338de03d2SArend van Spriel 
259438de03d2SArend van Spriel /**
2595b23aa676SSamuel Ortiz  * struct cfg80211_connect_params - Connection parameters
2596b23aa676SSamuel Ortiz  *
2597b23aa676SSamuel Ortiz  * This structure provides information needed to complete IEEE 802.11
2598b23aa676SSamuel Ortiz  * authentication and association.
2599b23aa676SSamuel Ortiz  *
2600b23aa676SSamuel Ortiz  * @channel: The channel to use or %NULL if not specified (auto-select based
2601b23aa676SSamuel Ortiz  *	on scan results)
26021df4a510SJouni Malinen  * @channel_hint: The channel of the recommended BSS for initial connection or
26031df4a510SJouni Malinen  *	%NULL if not specified
2604b23aa676SSamuel Ortiz  * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan
2605b23aa676SSamuel Ortiz  *	results)
26061df4a510SJouni Malinen  * @bssid_hint: The recommended AP BSSID for initial connection to the BSS or
26071df4a510SJouni Malinen  *	%NULL if not specified. Unlike the @bssid parameter, the driver is
26081df4a510SJouni Malinen  *	allowed to ignore this @bssid_hint if it has knowledge of a better BSS
26091df4a510SJouni Malinen  *	to use.
2610b23aa676SSamuel Ortiz  * @ssid: SSID
2611b23aa676SSamuel Ortiz  * @ssid_len: Length of ssid in octets
2612b23aa676SSamuel Ortiz  * @auth_type: Authentication type (algorithm)
2613abe37c4bSJohannes Berg  * @ie: IEs for association request
2614abe37c4bSJohannes Berg  * @ie_len: Length of assoc_ie in octets
2615b23aa676SSamuel Ortiz  * @privacy: indicates whether privacy-enabled APs should be used
2616cee00a95SJouni Malinen  * @mfp: indicate whether management frame protection is used
2617b23aa676SSamuel Ortiz  * @crypto: crypto settings
2618fffd0934SJohannes Berg  * @key_len: length of WEP key for shared key authentication
2619fffd0934SJohannes Berg  * @key_idx: index of WEP key for shared key authentication
2620fffd0934SJohannes Berg  * @key: WEP key for shared key authentication
26217e7c8926SBen Greear  * @flags:  See &enum cfg80211_assoc_req_flags
26224486ea98SBala Shanmugam  * @bg_scan_period:  Background scan period in seconds
26234486ea98SBala Shanmugam  *	or -1 to indicate that default value is to be used.
26247e7c8926SBen Greear  * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask
26257e7c8926SBen Greear  *	will be used in ht_capa.  Un-supported values will be ignored.
26267e7c8926SBen Greear  * @ht_capa_mask:  The bits of ht_capa which are to be used.
2627ee2aca34SJohannes Berg  * @vht_capa:  VHT Capability overrides
2628ee2aca34SJohannes Berg  * @vht_capa_mask: The bits of vht_capa which are to be used.
262934d50519SLior David  * @pbss: if set, connect to a PCP instead of AP. Valid for DMG
263034d50519SLior David  *	networks.
263138de03d2SArend van Spriel  * @bss_select: criteria to be used for BSS selection.
263235eb8f7bSJouni Malinen  * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used
263335eb8f7bSJouni Malinen  *	to indicate a request to reassociate within the ESS instead of a request
263435eb8f7bSJouni Malinen  *	do the initial association with the ESS. When included, this is set to
263535eb8f7bSJouni Malinen  *	the BSSID of the current association, i.e., to the value that is
263635eb8f7bSJouni Malinen  *	included in the Current AP address field of the Reassociation Request
263735eb8f7bSJouni Malinen  *	frame.
2638a3caf744SVidyullatha Kanchanapally  * @fils_erp_username: EAP re-authentication protocol (ERP) username part of the
2639a3caf744SVidyullatha Kanchanapally  *	NAI or %NULL if not specified. This is used to construct FILS wrapped
2640a3caf744SVidyullatha Kanchanapally  *	data IE.
2641a3caf744SVidyullatha Kanchanapally  * @fils_erp_username_len: Length of @fils_erp_username in octets.
2642a3caf744SVidyullatha Kanchanapally  * @fils_erp_realm: EAP re-authentication protocol (ERP) realm part of NAI or
2643a3caf744SVidyullatha Kanchanapally  *	%NULL if not specified. This specifies the domain name of ER server and
2644a3caf744SVidyullatha Kanchanapally  *	is used to construct FILS wrapped data IE.
2645a3caf744SVidyullatha Kanchanapally  * @fils_erp_realm_len: Length of @fils_erp_realm in octets.
2646a3caf744SVidyullatha Kanchanapally  * @fils_erp_next_seq_num: The next sequence number to use in the FILS ERP
2647a3caf744SVidyullatha Kanchanapally  *	messages. This is also used to construct FILS wrapped data IE.
2648a3caf744SVidyullatha Kanchanapally  * @fils_erp_rrk: ERP re-authentication Root Key (rRK) used to derive additional
2649a3caf744SVidyullatha Kanchanapally  *	keys in FILS or %NULL if not specified.
2650a3caf744SVidyullatha Kanchanapally  * @fils_erp_rrk_len: Length of @fils_erp_rrk in octets.
26513a00df57SAvraham Stern  * @want_1x: indicates user-space supports and wants to use 802.1X driver
26523a00df57SAvraham Stern  *	offload of 4-way handshake.
26532a38075cSAlexei Avshalom Lazar  * @edmg: define the EDMG channels.
26542a38075cSAlexei Avshalom Lazar  *	This may specify multiple channels and bonding options for the driver
26552a38075cSAlexei Avshalom Lazar  *	to choose from, based on BSS configuration.
2656b23aa676SSamuel Ortiz  */
2657b23aa676SSamuel Ortiz struct cfg80211_connect_params {
2658b23aa676SSamuel Ortiz 	struct ieee80211_channel *channel;
26591df4a510SJouni Malinen 	struct ieee80211_channel *channel_hint;
2660664834deSJouni Malinen 	const u8 *bssid;
26611df4a510SJouni Malinen 	const u8 *bssid_hint;
2662664834deSJouni Malinen 	const u8 *ssid;
2663b23aa676SSamuel Ortiz 	size_t ssid_len;
2664b23aa676SSamuel Ortiz 	enum nl80211_auth_type auth_type;
26654b5800feSJohannes Berg 	const u8 *ie;
2666b23aa676SSamuel Ortiz 	size_t ie_len;
2667b23aa676SSamuel Ortiz 	bool privacy;
2668cee00a95SJouni Malinen 	enum nl80211_mfp mfp;
2669b23aa676SSamuel Ortiz 	struct cfg80211_crypto_settings crypto;
2670fffd0934SJohannes Berg 	const u8 *key;
2671fffd0934SJohannes Berg 	u8 key_len, key_idx;
26727e7c8926SBen Greear 	u32 flags;
26734486ea98SBala Shanmugam 	int bg_scan_period;
26747e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa;
26757e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa_mask;
2676ee2aca34SJohannes Berg 	struct ieee80211_vht_cap vht_capa;
2677ee2aca34SJohannes Berg 	struct ieee80211_vht_cap vht_capa_mask;
267834d50519SLior David 	bool pbss;
267938de03d2SArend van Spriel 	struct cfg80211_bss_selection bss_select;
2680ba6fbacfSJouni Malinen 	const u8 *prev_bssid;
2681a3caf744SVidyullatha Kanchanapally 	const u8 *fils_erp_username;
2682a3caf744SVidyullatha Kanchanapally 	size_t fils_erp_username_len;
2683a3caf744SVidyullatha Kanchanapally 	const u8 *fils_erp_realm;
2684a3caf744SVidyullatha Kanchanapally 	size_t fils_erp_realm_len;
2685a3caf744SVidyullatha Kanchanapally 	u16 fils_erp_next_seq_num;
2686a3caf744SVidyullatha Kanchanapally 	const u8 *fils_erp_rrk;
2687a3caf744SVidyullatha Kanchanapally 	size_t fils_erp_rrk_len;
26883a00df57SAvraham Stern 	bool want_1x;
26892a38075cSAlexei Avshalom Lazar 	struct ieee80211_edmg edmg;
2690b23aa676SSamuel Ortiz };
2691b23aa676SSamuel Ortiz 
2692b23aa676SSamuel Ortiz /**
2693088e8df8Svamsi krishna  * enum cfg80211_connect_params_changed - Connection parameters being updated
2694088e8df8Svamsi krishna  *
2695088e8df8Svamsi krishna  * This enum provides information of all connect parameters that
2696088e8df8Svamsi krishna  * have to be updated as part of update_connect_params() call.
2697088e8df8Svamsi krishna  *
2698088e8df8Svamsi krishna  * @UPDATE_ASSOC_IES: Indicates whether association request IEs are updated
26997f9a3e15SVidyullatha Kanchanapally  * @UPDATE_FILS_ERP_INFO: Indicates that FILS connection parameters (realm,
27007f9a3e15SVidyullatha Kanchanapally  *	username, erp sequence number and rrk) are updated
27017f9a3e15SVidyullatha Kanchanapally  * @UPDATE_AUTH_TYPE: Indicates that authentication type is updated
2702088e8df8Svamsi krishna  */
2703088e8df8Svamsi krishna enum cfg80211_connect_params_changed {
2704088e8df8Svamsi krishna 	UPDATE_ASSOC_IES		= BIT(0),
27057f9a3e15SVidyullatha Kanchanapally 	UPDATE_FILS_ERP_INFO		= BIT(1),
27067f9a3e15SVidyullatha Kanchanapally 	UPDATE_AUTH_TYPE		= BIT(2),
2707088e8df8Svamsi krishna };
2708088e8df8Svamsi krishna 
2709088e8df8Svamsi krishna /**
2710b9a5f8caSJouni Malinen  * enum wiphy_params_flags - set_wiphy_params bitfield values
2711abe37c4bSJohannes Berg  * @WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed
2712abe37c4bSJohannes Berg  * @WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed
2713abe37c4bSJohannes Berg  * @WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed
2714abe37c4bSJohannes Berg  * @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed
2715abe37c4bSJohannes Berg  * @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed
27163057dbfdSLorenzo Bianconi  * @WIPHY_PARAM_DYN_ACK: dynack has been enabled
271752539ca8SToke Høiland-Jørgensen  * @WIPHY_PARAM_TXQ_LIMIT: TXQ packet limit has been changed
271852539ca8SToke Høiland-Jørgensen  * @WIPHY_PARAM_TXQ_MEMORY_LIMIT: TXQ memory limit has been changed
271952539ca8SToke Høiland-Jørgensen  * @WIPHY_PARAM_TXQ_QUANTUM: TXQ scheduler quantum
2720b9a5f8caSJouni Malinen  */
2721b9a5f8caSJouni Malinen enum wiphy_params_flags {
2722b9a5f8caSJouni Malinen 	WIPHY_PARAM_RETRY_SHORT		= 1 << 0,
2723b9a5f8caSJouni Malinen 	WIPHY_PARAM_RETRY_LONG		= 1 << 1,
2724b9a5f8caSJouni Malinen 	WIPHY_PARAM_FRAG_THRESHOLD	= 1 << 2,
2725b9a5f8caSJouni Malinen 	WIPHY_PARAM_RTS_THRESHOLD	= 1 << 3,
272681077e82SLukáš Turek 	WIPHY_PARAM_COVERAGE_CLASS	= 1 << 4,
27273057dbfdSLorenzo Bianconi 	WIPHY_PARAM_DYN_ACK		= 1 << 5,
272852539ca8SToke Høiland-Jørgensen 	WIPHY_PARAM_TXQ_LIMIT		= 1 << 6,
272952539ca8SToke Høiland-Jørgensen 	WIPHY_PARAM_TXQ_MEMORY_LIMIT	= 1 << 7,
273052539ca8SToke Høiland-Jørgensen 	WIPHY_PARAM_TXQ_QUANTUM		= 1 << 8,
2731b9a5f8caSJouni Malinen };
2732b9a5f8caSJouni Malinen 
273336647055SToke Høiland-Jørgensen #define IEEE80211_DEFAULT_AIRTIME_WEIGHT	256
273436647055SToke Høiland-Jørgensen 
27353ace10f5SKan Yan /* The per TXQ device queue limit in airtime */
27363ace10f5SKan Yan #define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_L	5000
27373ace10f5SKan Yan #define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_H	12000
27383ace10f5SKan Yan 
27393ace10f5SKan Yan /* The per interface airtime threshold to switch to lower queue limit */
27403ace10f5SKan Yan #define IEEE80211_AQL_THRESHOLD			24000
27413ace10f5SKan Yan 
274267fbb16bSSamuel Ortiz /**
274367fbb16bSSamuel Ortiz  * struct cfg80211_pmksa - PMK Security Association
274467fbb16bSSamuel Ortiz  *
274567fbb16bSSamuel Ortiz  * This structure is passed to the set/del_pmksa() method for PMKSA
274667fbb16bSSamuel Ortiz  * caching.
274767fbb16bSSamuel Ortiz  *
2748a3caf744SVidyullatha Kanchanapally  * @bssid: The AP's BSSID (may be %NULL).
2749a3caf744SVidyullatha Kanchanapally  * @pmkid: The identifier to refer a PMKSA.
2750a3caf744SVidyullatha Kanchanapally  * @pmk: The PMK for the PMKSA identified by @pmkid. This is used for key
2751a3caf744SVidyullatha Kanchanapally  *	derivation by a FILS STA. Otherwise, %NULL.
2752a3caf744SVidyullatha Kanchanapally  * @pmk_len: Length of the @pmk. The length of @pmk can differ depending on
2753a3caf744SVidyullatha Kanchanapally  *	the hash algorithm used to generate this.
2754a3caf744SVidyullatha Kanchanapally  * @ssid: SSID to specify the ESS within which a PMKSA is valid when using FILS
2755a3caf744SVidyullatha Kanchanapally  *	cache identifier (may be %NULL).
2756a3caf744SVidyullatha Kanchanapally  * @ssid_len: Length of the @ssid in octets.
2757a3caf744SVidyullatha Kanchanapally  * @cache_id: 2-octet cache identifier advertized by a FILS AP identifying the
2758a3caf744SVidyullatha Kanchanapally  *	scope of PMKSA. This is valid only if @ssid_len is non-zero (may be
2759a3caf744SVidyullatha Kanchanapally  *	%NULL).
27607fc82af8SVeerendranath Jakkam  * @pmk_lifetime: Maximum lifetime for PMKSA in seconds
27617fc82af8SVeerendranath Jakkam  *	(dot11RSNAConfigPMKLifetime) or 0 if not specified.
27627fc82af8SVeerendranath Jakkam  *	The configured PMKSA must not be used for PMKSA caching after
27637fc82af8SVeerendranath Jakkam  *	expiration and any keys derived from this PMK become invalid on
27647fc82af8SVeerendranath Jakkam  *	expiration, i.e., the current association must be dropped if the PMK
27657fc82af8SVeerendranath Jakkam  *	used for it expires.
27667fc82af8SVeerendranath Jakkam  * @pmk_reauth_threshold: Threshold time for reauthentication (percentage of
27677fc82af8SVeerendranath Jakkam  *	PMK lifetime, dot11RSNAConfigPMKReauthThreshold) or 0 if not specified.
27687fc82af8SVeerendranath Jakkam  *	Drivers are expected to trigger a full authentication instead of using
27697fc82af8SVeerendranath Jakkam  *	this PMKSA for caching when reassociating to a new BSS after this
27707fc82af8SVeerendranath Jakkam  *	threshold to generate a new PMK before the current one expires.
277167fbb16bSSamuel Ortiz  */
277267fbb16bSSamuel Ortiz struct cfg80211_pmksa {
2773c1e5f471SJohannes Berg 	const u8 *bssid;
2774c1e5f471SJohannes Berg 	const u8 *pmkid;
2775a3caf744SVidyullatha Kanchanapally 	const u8 *pmk;
2776a3caf744SVidyullatha Kanchanapally 	size_t pmk_len;
2777a3caf744SVidyullatha Kanchanapally 	const u8 *ssid;
2778a3caf744SVidyullatha Kanchanapally 	size_t ssid_len;
2779a3caf744SVidyullatha Kanchanapally 	const u8 *cache_id;
27807fc82af8SVeerendranath Jakkam 	u32 pmk_lifetime;
27817fc82af8SVeerendranath Jakkam 	u8 pmk_reauth_threshold;
278267fbb16bSSamuel Ortiz };
27839930380fSJohannes Berg 
27847643a2c3SJohannes Berg /**
278550ac6607SAmitkumar Karwar  * struct cfg80211_pkt_pattern - packet pattern
2786ff1b6e69SJohannes Berg  * @mask: bitmask where to match pattern and where to ignore bytes,
2787ff1b6e69SJohannes Berg  *	one bit per byte, in same format as nl80211
2788ff1b6e69SJohannes Berg  * @pattern: bytes to match where bitmask is 1
2789ff1b6e69SJohannes Berg  * @pattern_len: length of pattern (in bytes)
2790bb92d199SAmitkumar Karwar  * @pkt_offset: packet offset (in bytes)
2791ff1b6e69SJohannes Berg  *
2792ff1b6e69SJohannes Berg  * Internal note: @mask and @pattern are allocated in one chunk of
2793ff1b6e69SJohannes Berg  * memory, free @mask only!
2794ff1b6e69SJohannes Berg  */
279550ac6607SAmitkumar Karwar struct cfg80211_pkt_pattern {
2796922bd80fSJohannes Berg 	const u8 *mask, *pattern;
2797ff1b6e69SJohannes Berg 	int pattern_len;
2798bb92d199SAmitkumar Karwar 	int pkt_offset;
2799ff1b6e69SJohannes Berg };
2800ff1b6e69SJohannes Berg 
2801ff1b6e69SJohannes Berg /**
28022a0e047eSJohannes Berg  * struct cfg80211_wowlan_tcp - TCP connection parameters
28032a0e047eSJohannes Berg  *
28042a0e047eSJohannes Berg  * @sock: (internal) socket for source port allocation
28052a0e047eSJohannes Berg  * @src: source IP address
28062a0e047eSJohannes Berg  * @dst: destination IP address
28072a0e047eSJohannes Berg  * @dst_mac: destination MAC address
28082a0e047eSJohannes Berg  * @src_port: source port
28092a0e047eSJohannes Berg  * @dst_port: destination port
28102a0e047eSJohannes Berg  * @payload_len: data payload length
28112a0e047eSJohannes Berg  * @payload: data payload buffer
28122a0e047eSJohannes Berg  * @payload_seq: payload sequence stamping configuration
28132a0e047eSJohannes Berg  * @data_interval: interval at which to send data packets
28142a0e047eSJohannes Berg  * @wake_len: wakeup payload match length
28152a0e047eSJohannes Berg  * @wake_data: wakeup payload match data
28162a0e047eSJohannes Berg  * @wake_mask: wakeup payload match mask
28172a0e047eSJohannes Berg  * @tokens_size: length of the tokens buffer
28182a0e047eSJohannes Berg  * @payload_tok: payload token usage configuration
28192a0e047eSJohannes Berg  */
28202a0e047eSJohannes Berg struct cfg80211_wowlan_tcp {
28212a0e047eSJohannes Berg 	struct socket *sock;
28222a0e047eSJohannes Berg 	__be32 src, dst;
28232a0e047eSJohannes Berg 	u16 src_port, dst_port;
28242a0e047eSJohannes Berg 	u8 dst_mac[ETH_ALEN];
28252a0e047eSJohannes Berg 	int payload_len;
28262a0e047eSJohannes Berg 	const u8 *payload;
28272a0e047eSJohannes Berg 	struct nl80211_wowlan_tcp_data_seq payload_seq;
28282a0e047eSJohannes Berg 	u32 data_interval;
28292a0e047eSJohannes Berg 	u32 wake_len;
28302a0e047eSJohannes Berg 	const u8 *wake_data, *wake_mask;
28312a0e047eSJohannes Berg 	u32 tokens_size;
28322a0e047eSJohannes Berg 	/* must be last, variable member */
28332a0e047eSJohannes Berg 	struct nl80211_wowlan_tcp_data_token payload_tok;
2834ff1b6e69SJohannes Berg };
2835ff1b6e69SJohannes Berg 
2836ff1b6e69SJohannes Berg /**
2837ff1b6e69SJohannes Berg  * struct cfg80211_wowlan - Wake on Wireless-LAN support info
2838ff1b6e69SJohannes Berg  *
2839ff1b6e69SJohannes Berg  * This structure defines the enabled WoWLAN triggers for the device.
2840ff1b6e69SJohannes Berg  * @any: wake up on any activity -- special trigger if device continues
2841ff1b6e69SJohannes Berg  *	operating as normal during suspend
2842ff1b6e69SJohannes Berg  * @disconnect: wake up if getting disconnected
2843ff1b6e69SJohannes Berg  * @magic_pkt: wake up on receiving magic packet
2844ff1b6e69SJohannes Berg  * @patterns: wake up on receiving packet matching a pattern
2845ff1b6e69SJohannes Berg  * @n_patterns: number of patterns
284677dbbb13SJohannes Berg  * @gtk_rekey_failure: wake up on GTK rekey failure
284777dbbb13SJohannes Berg  * @eap_identity_req: wake up on EAP identity request packet
284877dbbb13SJohannes Berg  * @four_way_handshake: wake up on 4-way handshake
284977dbbb13SJohannes Berg  * @rfkill_release: wake up when rfkill is released
28502a0e047eSJohannes Berg  * @tcp: TCP connection establishment/wakeup parameters, see nl80211.h.
28512a0e047eSJohannes Berg  *	NULL if not configured.
28528cd4d456SLuciano Coelho  * @nd_config: configuration for the scan to be used for net detect wake.
2853ff1b6e69SJohannes Berg  */
2854ff1b6e69SJohannes Berg struct cfg80211_wowlan {
285577dbbb13SJohannes Berg 	bool any, disconnect, magic_pkt, gtk_rekey_failure,
285677dbbb13SJohannes Berg 	     eap_identity_req, four_way_handshake,
285777dbbb13SJohannes Berg 	     rfkill_release;
285850ac6607SAmitkumar Karwar 	struct cfg80211_pkt_pattern *patterns;
28592a0e047eSJohannes Berg 	struct cfg80211_wowlan_tcp *tcp;
2860ff1b6e69SJohannes Berg 	int n_patterns;
28618cd4d456SLuciano Coelho 	struct cfg80211_sched_scan_request *nd_config;
2862ff1b6e69SJohannes Berg };
2863ff1b6e69SJohannes Berg 
2864ff1b6e69SJohannes Berg /**
2865be29b99aSAmitkumar Karwar  * struct cfg80211_coalesce_rules - Coalesce rule parameters
2866be29b99aSAmitkumar Karwar  *
2867be29b99aSAmitkumar Karwar  * This structure defines coalesce rule for the device.
2868be29b99aSAmitkumar Karwar  * @delay: maximum coalescing delay in msecs.
2869be29b99aSAmitkumar Karwar  * @condition: condition for packet coalescence.
2870be29b99aSAmitkumar Karwar  *	see &enum nl80211_coalesce_condition.
2871be29b99aSAmitkumar Karwar  * @patterns: array of packet patterns
2872be29b99aSAmitkumar Karwar  * @n_patterns: number of patterns
2873be29b99aSAmitkumar Karwar  */
2874be29b99aSAmitkumar Karwar struct cfg80211_coalesce_rules {
2875be29b99aSAmitkumar Karwar 	int delay;
2876be29b99aSAmitkumar Karwar 	enum nl80211_coalesce_condition condition;
2877be29b99aSAmitkumar Karwar 	struct cfg80211_pkt_pattern *patterns;
2878be29b99aSAmitkumar Karwar 	int n_patterns;
2879be29b99aSAmitkumar Karwar };
2880be29b99aSAmitkumar Karwar 
2881be29b99aSAmitkumar Karwar /**
2882be29b99aSAmitkumar Karwar  * struct cfg80211_coalesce - Packet coalescing settings
2883be29b99aSAmitkumar Karwar  *
2884be29b99aSAmitkumar Karwar  * This structure defines coalescing settings.
2885be29b99aSAmitkumar Karwar  * @rules: array of coalesce rules
2886be29b99aSAmitkumar Karwar  * @n_rules: number of rules
2887be29b99aSAmitkumar Karwar  */
2888be29b99aSAmitkumar Karwar struct cfg80211_coalesce {
2889be29b99aSAmitkumar Karwar 	struct cfg80211_coalesce_rules *rules;
2890be29b99aSAmitkumar Karwar 	int n_rules;
2891be29b99aSAmitkumar Karwar };
2892be29b99aSAmitkumar Karwar 
2893be29b99aSAmitkumar Karwar /**
28948cd4d456SLuciano Coelho  * struct cfg80211_wowlan_nd_match - information about the match
28958cd4d456SLuciano Coelho  *
28968cd4d456SLuciano Coelho  * @ssid: SSID of the match that triggered the wake up
28978cd4d456SLuciano Coelho  * @n_channels: Number of channels where the match occurred.  This
28988cd4d456SLuciano Coelho  *	value may be zero if the driver can't report the channels.
28998cd4d456SLuciano Coelho  * @channels: center frequencies of the channels where a match
29008cd4d456SLuciano Coelho  *	occurred (in MHz)
29018cd4d456SLuciano Coelho  */
29028cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_match {
29038cd4d456SLuciano Coelho 	struct cfg80211_ssid ssid;
29048cd4d456SLuciano Coelho 	int n_channels;
29058cd4d456SLuciano Coelho 	u32 channels[];
29068cd4d456SLuciano Coelho };
29078cd4d456SLuciano Coelho 
29088cd4d456SLuciano Coelho /**
29098cd4d456SLuciano Coelho  * struct cfg80211_wowlan_nd_info - net detect wake up information
29108cd4d456SLuciano Coelho  *
29118cd4d456SLuciano Coelho  * @n_matches: Number of match information instances provided in
29128cd4d456SLuciano Coelho  *	@matches.  This value may be zero if the driver can't provide
29138cd4d456SLuciano Coelho  *	match information.
29148cd4d456SLuciano Coelho  * @matches: Array of pointers to matches containing information about
29158cd4d456SLuciano Coelho  *	the matches that triggered the wake up.
29168cd4d456SLuciano Coelho  */
29178cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_info {
29188cd4d456SLuciano Coelho 	int n_matches;
29198cd4d456SLuciano Coelho 	struct cfg80211_wowlan_nd_match *matches[];
29208cd4d456SLuciano Coelho };
29218cd4d456SLuciano Coelho 
29228cd4d456SLuciano Coelho /**
2923cd8f7cb4SJohannes Berg  * struct cfg80211_wowlan_wakeup - wakeup report
2924cd8f7cb4SJohannes Berg  * @disconnect: woke up by getting disconnected
2925cd8f7cb4SJohannes Berg  * @magic_pkt: woke up by receiving magic packet
2926cd8f7cb4SJohannes Berg  * @gtk_rekey_failure: woke up by GTK rekey failure
2927cd8f7cb4SJohannes Berg  * @eap_identity_req: woke up by EAP identity request packet
2928cd8f7cb4SJohannes Berg  * @four_way_handshake: woke up by 4-way handshake
2929cd8f7cb4SJohannes Berg  * @rfkill_release: woke up by rfkill being released
2930cd8f7cb4SJohannes Berg  * @pattern_idx: pattern that caused wakeup, -1 if not due to pattern
2931cd8f7cb4SJohannes Berg  * @packet_present_len: copied wakeup packet data
2932cd8f7cb4SJohannes Berg  * @packet_len: original wakeup packet length
2933cd8f7cb4SJohannes Berg  * @packet: The packet causing the wakeup, if any.
2934cd8f7cb4SJohannes Berg  * @packet_80211:  For pattern match, magic packet and other data
2935cd8f7cb4SJohannes Berg  *	frame triggers an 802.3 frame should be reported, for
2936cd8f7cb4SJohannes Berg  *	disconnect due to deauth 802.11 frame. This indicates which
2937cd8f7cb4SJohannes Berg  *	it is.
29382a0e047eSJohannes Berg  * @tcp_match: TCP wakeup packet received
29392a0e047eSJohannes Berg  * @tcp_connlost: TCP connection lost or failed to establish
29402a0e047eSJohannes Berg  * @tcp_nomoretokens: TCP data ran out of tokens
29418cd4d456SLuciano Coelho  * @net_detect: if not %NULL, woke up because of net detect
2942cd8f7cb4SJohannes Berg  */
2943cd8f7cb4SJohannes Berg struct cfg80211_wowlan_wakeup {
2944cd8f7cb4SJohannes Berg 	bool disconnect, magic_pkt, gtk_rekey_failure,
2945cd8f7cb4SJohannes Berg 	     eap_identity_req, four_way_handshake,
29462a0e047eSJohannes Berg 	     rfkill_release, packet_80211,
29472a0e047eSJohannes Berg 	     tcp_match, tcp_connlost, tcp_nomoretokens;
2948cd8f7cb4SJohannes Berg 	s32 pattern_idx;
2949cd8f7cb4SJohannes Berg 	u32 packet_present_len, packet_len;
2950cd8f7cb4SJohannes Berg 	const void *packet;
29518cd4d456SLuciano Coelho 	struct cfg80211_wowlan_nd_info *net_detect;
2952cd8f7cb4SJohannes Berg };
2953cd8f7cb4SJohannes Berg 
2954cd8f7cb4SJohannes Berg /**
2955e5497d76SJohannes Berg  * struct cfg80211_gtk_rekey_data - rekey data
2956093a48d2SNathan Errera  * @kek: key encryption key (@kek_len bytes)
2957093a48d2SNathan Errera  * @kck: key confirmation key (@kck_len bytes)
295878f686caSJohannes Berg  * @replay_ctr: replay counter (NL80211_REPLAY_CTR_LEN bytes)
2959093a48d2SNathan Errera  * @kek_len: length of kek
2960093a48d2SNathan Errera  * @kck_len length of kck
2961093a48d2SNathan Errera  * @akm: akm (oui, id)
2962e5497d76SJohannes Berg  */
2963e5497d76SJohannes Berg struct cfg80211_gtk_rekey_data {
296478f686caSJohannes Berg 	const u8 *kek, *kck, *replay_ctr;
2965093a48d2SNathan Errera 	u32 akm;
2966093a48d2SNathan Errera 	u8 kek_len, kck_len;
2967e5497d76SJohannes Berg };
2968e5497d76SJohannes Berg 
2969e5497d76SJohannes Berg /**
2970355199e0SJouni Malinen  * struct cfg80211_update_ft_ies_params - FT IE Information
2971355199e0SJouni Malinen  *
2972355199e0SJouni Malinen  * This structure provides information needed to update the fast transition IE
2973355199e0SJouni Malinen  *
2974355199e0SJouni Malinen  * @md: The Mobility Domain ID, 2 Octet value
2975355199e0SJouni Malinen  * @ie: Fast Transition IEs
2976355199e0SJouni Malinen  * @ie_len: Length of ft_ie in octets
2977355199e0SJouni Malinen  */
2978355199e0SJouni Malinen struct cfg80211_update_ft_ies_params {
2979355199e0SJouni Malinen 	u16 md;
2980355199e0SJouni Malinen 	const u8 *ie;
2981355199e0SJouni Malinen 	size_t ie_len;
2982355199e0SJouni Malinen };
2983355199e0SJouni Malinen 
2984355199e0SJouni Malinen /**
2985b176e629SAndrei Otcheretianski  * struct cfg80211_mgmt_tx_params - mgmt tx parameters
2986b176e629SAndrei Otcheretianski  *
2987b176e629SAndrei Otcheretianski  * This structure provides information needed to transmit a mgmt frame
2988b176e629SAndrei Otcheretianski  *
2989b176e629SAndrei Otcheretianski  * @chan: channel to use
2990b176e629SAndrei Otcheretianski  * @offchan: indicates wether off channel operation is required
2991b176e629SAndrei Otcheretianski  * @wait: duration for ROC
2992b176e629SAndrei Otcheretianski  * @buf: buffer to transmit
2993b176e629SAndrei Otcheretianski  * @len: buffer length
2994b176e629SAndrei Otcheretianski  * @no_cck: don't use cck rates for this frame
2995b176e629SAndrei Otcheretianski  * @dont_wait_for_ack: tells the low level not to wait for an ack
299634d22ce2SAndrei Otcheretianski  * @n_csa_offsets: length of csa_offsets array
299734d22ce2SAndrei Otcheretianski  * @csa_offsets: array of all the csa offsets in the frame
2998b176e629SAndrei Otcheretianski  */
2999b176e629SAndrei Otcheretianski struct cfg80211_mgmt_tx_params {
3000b176e629SAndrei Otcheretianski 	struct ieee80211_channel *chan;
3001b176e629SAndrei Otcheretianski 	bool offchan;
3002b176e629SAndrei Otcheretianski 	unsigned int wait;
3003b176e629SAndrei Otcheretianski 	const u8 *buf;
3004b176e629SAndrei Otcheretianski 	size_t len;
3005b176e629SAndrei Otcheretianski 	bool no_cck;
3006b176e629SAndrei Otcheretianski 	bool dont_wait_for_ack;
300734d22ce2SAndrei Otcheretianski 	int n_csa_offsets;
300834d22ce2SAndrei Otcheretianski 	const u16 *csa_offsets;
3009b176e629SAndrei Otcheretianski };
3010b176e629SAndrei Otcheretianski 
3011b176e629SAndrei Otcheretianski /**
3012fa9ffc74SKyeyoon Park  * struct cfg80211_dscp_exception - DSCP exception
3013fa9ffc74SKyeyoon Park  *
3014fa9ffc74SKyeyoon Park  * @dscp: DSCP value that does not adhere to the user priority range definition
3015fa9ffc74SKyeyoon Park  * @up: user priority value to which the corresponding DSCP value belongs
3016fa9ffc74SKyeyoon Park  */
3017fa9ffc74SKyeyoon Park struct cfg80211_dscp_exception {
3018fa9ffc74SKyeyoon Park 	u8 dscp;
3019fa9ffc74SKyeyoon Park 	u8 up;
3020fa9ffc74SKyeyoon Park };
3021fa9ffc74SKyeyoon Park 
3022fa9ffc74SKyeyoon Park /**
3023fa9ffc74SKyeyoon Park  * struct cfg80211_dscp_range - DSCP range definition for user priority
3024fa9ffc74SKyeyoon Park  *
3025fa9ffc74SKyeyoon Park  * @low: lowest DSCP value of this user priority range, inclusive
3026fa9ffc74SKyeyoon Park  * @high: highest DSCP value of this user priority range, inclusive
3027fa9ffc74SKyeyoon Park  */
3028fa9ffc74SKyeyoon Park struct cfg80211_dscp_range {
3029fa9ffc74SKyeyoon Park 	u8 low;
3030fa9ffc74SKyeyoon Park 	u8 high;
3031fa9ffc74SKyeyoon Park };
3032fa9ffc74SKyeyoon Park 
3033fa9ffc74SKyeyoon Park /* QoS Map Set element length defined in IEEE Std 802.11-2012, 8.4.2.97 */
3034fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_MAX_EX	21
3035fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_LEN_MIN	16
3036fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_LEN_MAX \
3037fa9ffc74SKyeyoon Park 	(IEEE80211_QOS_MAP_LEN_MIN + 2 * IEEE80211_QOS_MAP_MAX_EX)
3038fa9ffc74SKyeyoon Park 
3039fa9ffc74SKyeyoon Park /**
3040fa9ffc74SKyeyoon Park  * struct cfg80211_qos_map - QoS Map Information
3041fa9ffc74SKyeyoon Park  *
3042fa9ffc74SKyeyoon Park  * This struct defines the Interworking QoS map setting for DSCP values
3043fa9ffc74SKyeyoon Park  *
3044fa9ffc74SKyeyoon Park  * @num_des: number of DSCP exceptions (0..21)
3045fa9ffc74SKyeyoon Park  * @dscp_exception: optionally up to maximum of 21 DSCP exceptions from
3046fa9ffc74SKyeyoon Park  *	the user priority DSCP range definition
3047fa9ffc74SKyeyoon Park  * @up: DSCP range definition for a particular user priority
3048fa9ffc74SKyeyoon Park  */
3049fa9ffc74SKyeyoon Park struct cfg80211_qos_map {
3050fa9ffc74SKyeyoon Park 	u8 num_des;
3051fa9ffc74SKyeyoon Park 	struct cfg80211_dscp_exception dscp_exception[IEEE80211_QOS_MAP_MAX_EX];
3052fa9ffc74SKyeyoon Park 	struct cfg80211_dscp_range up[8];
3053fa9ffc74SKyeyoon Park };
3054fa9ffc74SKyeyoon Park 
3055fa9ffc74SKyeyoon Park /**
3056cb3b7d87SAyala Beker  * struct cfg80211_nan_conf - NAN configuration
3057cb3b7d87SAyala Beker  *
3058cb3b7d87SAyala Beker  * This struct defines NAN configuration parameters
3059cb3b7d87SAyala Beker  *
3060cb3b7d87SAyala Beker  * @master_pref: master preference (1 - 255)
30618585989dSLuca Coelho  * @bands: operating bands, a bitmap of &enum nl80211_band values.
30628585989dSLuca Coelho  *	For instance, for NL80211_BAND_2GHZ, bit 0 would be set
30638585989dSLuca Coelho  *	(i.e. BIT(NL80211_BAND_2GHZ)).
3064cb3b7d87SAyala Beker  */
3065cb3b7d87SAyala Beker struct cfg80211_nan_conf {
3066cb3b7d87SAyala Beker 	u8 master_pref;
30678585989dSLuca Coelho 	u8 bands;
3068cb3b7d87SAyala Beker };
3069cb3b7d87SAyala Beker 
3070cb3b7d87SAyala Beker /**
3071a5a9dcf2SAyala Beker  * enum cfg80211_nan_conf_changes - indicates changed fields in NAN
3072a5a9dcf2SAyala Beker  * configuration
3073a5a9dcf2SAyala Beker  *
3074a5a9dcf2SAyala Beker  * @CFG80211_NAN_CONF_CHANGED_PREF: master preference
30758585989dSLuca Coelho  * @CFG80211_NAN_CONF_CHANGED_BANDS: operating bands
3076a5a9dcf2SAyala Beker  */
3077a5a9dcf2SAyala Beker enum cfg80211_nan_conf_changes {
3078a5a9dcf2SAyala Beker 	CFG80211_NAN_CONF_CHANGED_PREF = BIT(0),
30798585989dSLuca Coelho 	CFG80211_NAN_CONF_CHANGED_BANDS = BIT(1),
3080a5a9dcf2SAyala Beker };
3081a5a9dcf2SAyala Beker 
3082a5a9dcf2SAyala Beker /**
3083a442b761SAyala Beker  * struct cfg80211_nan_func_filter - a NAN function Rx / Tx filter
3084a442b761SAyala Beker  *
3085a442b761SAyala Beker  * @filter: the content of the filter
3086a442b761SAyala Beker  * @len: the length of the filter
3087a442b761SAyala Beker  */
3088a442b761SAyala Beker struct cfg80211_nan_func_filter {
3089a442b761SAyala Beker 	const u8 *filter;
3090a442b761SAyala Beker 	u8 len;
3091a442b761SAyala Beker };
3092a442b761SAyala Beker 
3093a442b761SAyala Beker /**
3094a442b761SAyala Beker  * struct cfg80211_nan_func - a NAN function
3095a442b761SAyala Beker  *
3096a442b761SAyala Beker  * @type: &enum nl80211_nan_function_type
3097a442b761SAyala Beker  * @service_id: the service ID of the function
3098a442b761SAyala Beker  * @publish_type: &nl80211_nan_publish_type
3099a442b761SAyala Beker  * @close_range: if true, the range should be limited. Threshold is
3100a442b761SAyala Beker  *	implementation specific.
3101a442b761SAyala Beker  * @publish_bcast: if true, the solicited publish should be broadcasted
3102a442b761SAyala Beker  * @subscribe_active: if true, the subscribe is active
3103a442b761SAyala Beker  * @followup_id: the instance ID for follow up
3104a442b761SAyala Beker  * @followup_reqid: the requestor instance ID for follow up
3105a442b761SAyala Beker  * @followup_dest: MAC address of the recipient of the follow up
3106a442b761SAyala Beker  * @ttl: time to live counter in DW.
3107a442b761SAyala Beker  * @serv_spec_info: Service Specific Info
3108a442b761SAyala Beker  * @serv_spec_info_len: Service Specific Info length
3109a442b761SAyala Beker  * @srf_include: if true, SRF is inclusive
3110a442b761SAyala Beker  * @srf_bf: Bloom Filter
3111a442b761SAyala Beker  * @srf_bf_len: Bloom Filter length
3112a442b761SAyala Beker  * @srf_bf_idx: Bloom Filter index
3113a442b761SAyala Beker  * @srf_macs: SRF MAC addresses
3114a442b761SAyala Beker  * @srf_num_macs: number of MAC addresses in SRF
3115a442b761SAyala Beker  * @rx_filters: rx filters that are matched with corresponding peer's tx_filter
3116a442b761SAyala Beker  * @tx_filters: filters that should be transmitted in the SDF.
3117a442b761SAyala Beker  * @num_rx_filters: length of &rx_filters.
3118a442b761SAyala Beker  * @num_tx_filters: length of &tx_filters.
3119a442b761SAyala Beker  * @instance_id: driver allocated id of the function.
3120a442b761SAyala Beker  * @cookie: unique NAN function identifier.
3121a442b761SAyala Beker  */
3122a442b761SAyala Beker struct cfg80211_nan_func {
3123a442b761SAyala Beker 	enum nl80211_nan_function_type type;
3124a442b761SAyala Beker 	u8 service_id[NL80211_NAN_FUNC_SERVICE_ID_LEN];
3125a442b761SAyala Beker 	u8 publish_type;
3126a442b761SAyala Beker 	bool close_range;
3127a442b761SAyala Beker 	bool publish_bcast;
3128a442b761SAyala Beker 	bool subscribe_active;
3129a442b761SAyala Beker 	u8 followup_id;
3130a442b761SAyala Beker 	u8 followup_reqid;
3131a442b761SAyala Beker 	struct mac_address followup_dest;
3132a442b761SAyala Beker 	u32 ttl;
3133a442b761SAyala Beker 	const u8 *serv_spec_info;
3134a442b761SAyala Beker 	u8 serv_spec_info_len;
3135a442b761SAyala Beker 	bool srf_include;
3136a442b761SAyala Beker 	const u8 *srf_bf;
3137a442b761SAyala Beker 	u8 srf_bf_len;
3138a442b761SAyala Beker 	u8 srf_bf_idx;
3139a442b761SAyala Beker 	struct mac_address *srf_macs;
3140a442b761SAyala Beker 	int srf_num_macs;
3141a442b761SAyala Beker 	struct cfg80211_nan_func_filter *rx_filters;
3142a442b761SAyala Beker 	struct cfg80211_nan_func_filter *tx_filters;
3143a442b761SAyala Beker 	u8 num_tx_filters;
3144a442b761SAyala Beker 	u8 num_rx_filters;
3145a442b761SAyala Beker 	u8 instance_id;
3146a442b761SAyala Beker 	u64 cookie;
3147a442b761SAyala Beker };
3148a442b761SAyala Beker 
3149a442b761SAyala Beker /**
31503a00df57SAvraham Stern  * struct cfg80211_pmk_conf - PMK configuration
31513a00df57SAvraham Stern  *
31523a00df57SAvraham Stern  * @aa: authenticator address
31533a00df57SAvraham Stern  * @pmk_len: PMK length in bytes.
31543a00df57SAvraham Stern  * @pmk: the PMK material
31553a00df57SAvraham Stern  * @pmk_r0_name: PMK-R0 Name. NULL if not applicable (i.e., the PMK
31563a00df57SAvraham Stern  *	is not PMK-R0). When pmk_r0_name is not NULL, the pmk field
31573a00df57SAvraham Stern  *	holds PMK-R0.
31583a00df57SAvraham Stern  */
31593a00df57SAvraham Stern struct cfg80211_pmk_conf {
31603a00df57SAvraham Stern 	const u8 *aa;
31613a00df57SAvraham Stern 	u8 pmk_len;
31623a00df57SAvraham Stern 	const u8 *pmk;
31633a00df57SAvraham Stern 	const u8 *pmk_r0_name;
31643a00df57SAvraham Stern };
31653a00df57SAvraham Stern 
31663a00df57SAvraham Stern /**
316740cbfa90SSrinivas Dasari  * struct cfg80211_external_auth_params - Trigger External authentication.
316840cbfa90SSrinivas Dasari  *
316940cbfa90SSrinivas Dasari  * Commonly used across the external auth request and event interfaces.
317040cbfa90SSrinivas Dasari  *
317140cbfa90SSrinivas Dasari  * @action: action type / trigger for external authentication. Only significant
317240cbfa90SSrinivas Dasari  *	for the authentication request event interface (driver to user space).
317340cbfa90SSrinivas Dasari  * @bssid: BSSID of the peer with which the authentication has
317440cbfa90SSrinivas Dasari  *	to happen. Used by both the authentication request event and
317540cbfa90SSrinivas Dasari  *	authentication response command interface.
317640cbfa90SSrinivas Dasari  * @ssid: SSID of the AP.  Used by both the authentication request event and
317740cbfa90SSrinivas Dasari  *	authentication response command interface.
317840cbfa90SSrinivas Dasari  * @key_mgmt_suite: AKM suite of the respective authentication. Used by the
317940cbfa90SSrinivas Dasari  *	authentication request event interface.
318040cbfa90SSrinivas Dasari  * @status: status code, %WLAN_STATUS_SUCCESS for successful authentication,
318140cbfa90SSrinivas Dasari  *	use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space cannot give you
318240cbfa90SSrinivas Dasari  *	the real status code for failures. Used only for the authentication
318340cbfa90SSrinivas Dasari  *	response command interface (user space to driver).
3184fe494370SSrinivas Dasari  * @pmkid: The identifier to refer a PMKSA.
318540cbfa90SSrinivas Dasari  */
318640cbfa90SSrinivas Dasari struct cfg80211_external_auth_params {
318740cbfa90SSrinivas Dasari 	enum nl80211_external_auth_action action;
318840cbfa90SSrinivas Dasari 	u8 bssid[ETH_ALEN] __aligned(2);
318940cbfa90SSrinivas Dasari 	struct cfg80211_ssid ssid;
319040cbfa90SSrinivas Dasari 	unsigned int key_mgmt_suite;
319140cbfa90SSrinivas Dasari 	u16 status;
3192fe494370SSrinivas Dasari 	const u8 *pmkid;
319340cbfa90SSrinivas Dasari };
319440cbfa90SSrinivas Dasari 
319540cbfa90SSrinivas Dasari /**
31963453de98SRandy Dunlap  * struct cfg80211_ftm_responder_stats - FTM responder statistics
319781e54d08SPradeep Kumar Chitrapu  *
319881e54d08SPradeep Kumar Chitrapu  * @filled: bitflag of flags using the bits of &enum nl80211_ftm_stats to
319981e54d08SPradeep Kumar Chitrapu  *	indicate the relevant values in this struct for them
320081e54d08SPradeep Kumar Chitrapu  * @success_num: number of FTM sessions in which all frames were successfully
320181e54d08SPradeep Kumar Chitrapu  *	answered
320281e54d08SPradeep Kumar Chitrapu  * @partial_num: number of FTM sessions in which part of frames were
320381e54d08SPradeep Kumar Chitrapu  *	successfully answered
320481e54d08SPradeep Kumar Chitrapu  * @failed_num: number of failed FTM sessions
320581e54d08SPradeep Kumar Chitrapu  * @asap_num: number of ASAP FTM sessions
320681e54d08SPradeep Kumar Chitrapu  * @non_asap_num: number of  non-ASAP FTM sessions
320781e54d08SPradeep Kumar Chitrapu  * @total_duration_ms: total sessions durations - gives an indication
320881e54d08SPradeep Kumar Chitrapu  *	of how much time the responder was busy
320981e54d08SPradeep Kumar Chitrapu  * @unknown_triggers_num: number of unknown FTM triggers - triggers from
321081e54d08SPradeep Kumar Chitrapu  *	initiators that didn't finish successfully the negotiation phase with
321181e54d08SPradeep Kumar Chitrapu  *	the responder
321281e54d08SPradeep Kumar Chitrapu  * @reschedule_requests_num: number of FTM reschedule requests - initiator asks
321381e54d08SPradeep Kumar Chitrapu  *	for a new scheduling although it already has scheduled FTM slot
321481e54d08SPradeep Kumar Chitrapu  * @out_of_window_triggers_num: total FTM triggers out of scheduled window
321581e54d08SPradeep Kumar Chitrapu  */
321681e54d08SPradeep Kumar Chitrapu struct cfg80211_ftm_responder_stats {
321781e54d08SPradeep Kumar Chitrapu 	u32 filled;
321881e54d08SPradeep Kumar Chitrapu 	u32 success_num;
321981e54d08SPradeep Kumar Chitrapu 	u32 partial_num;
322081e54d08SPradeep Kumar Chitrapu 	u32 failed_num;
322181e54d08SPradeep Kumar Chitrapu 	u32 asap_num;
322281e54d08SPradeep Kumar Chitrapu 	u32 non_asap_num;
322381e54d08SPradeep Kumar Chitrapu 	u64 total_duration_ms;
322481e54d08SPradeep Kumar Chitrapu 	u32 unknown_triggers_num;
322581e54d08SPradeep Kumar Chitrapu 	u32 reschedule_requests_num;
322681e54d08SPradeep Kumar Chitrapu 	u32 out_of_window_triggers_num;
322781e54d08SPradeep Kumar Chitrapu };
322881e54d08SPradeep Kumar Chitrapu 
322981e54d08SPradeep Kumar Chitrapu /**
32309bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_ftm_result - FTM result
32319bb7e0f2SJohannes Berg  * @failure_reason: if this measurement failed (PMSR status is
32329bb7e0f2SJohannes Berg  *	%NL80211_PMSR_STATUS_FAILURE), this gives a more precise
32339bb7e0f2SJohannes Berg  *	reason than just "failure"
32349bb7e0f2SJohannes Berg  * @burst_index: if reporting partial results, this is the index
32359bb7e0f2SJohannes Berg  *	in [0 .. num_bursts-1] of the burst that's being reported
32369bb7e0f2SJohannes Berg  * @num_ftmr_attempts: number of FTM request frames transmitted
32379bb7e0f2SJohannes Berg  * @num_ftmr_successes: number of FTM request frames acked
32389bb7e0f2SJohannes Berg  * @busy_retry_time: if failure_reason is %NL80211_PMSR_FTM_FAILURE_PEER_BUSY,
32399bb7e0f2SJohannes Berg  *	fill this to indicate in how many seconds a retry is deemed possible
32409bb7e0f2SJohannes Berg  *	by the responder
32419bb7e0f2SJohannes Berg  * @num_bursts_exp: actual number of bursts exponent negotiated
32429bb7e0f2SJohannes Berg  * @burst_duration: actual burst duration negotiated
32439bb7e0f2SJohannes Berg  * @ftms_per_burst: actual FTMs per burst negotiated
32449bb7e0f2SJohannes Berg  * @lci_len: length of LCI information (if present)
32459bb7e0f2SJohannes Berg  * @civicloc_len: length of civic location information (if present)
32469bb7e0f2SJohannes Berg  * @lci: LCI data (may be %NULL)
32479bb7e0f2SJohannes Berg  * @civicloc: civic location data (may be %NULL)
32489bb7e0f2SJohannes Berg  * @rssi_avg: average RSSI over FTM action frames reported
32499bb7e0f2SJohannes Berg  * @rssi_spread: spread of the RSSI over FTM action frames reported
32509bb7e0f2SJohannes Berg  * @tx_rate: bitrate for transmitted FTM action frame response
32519bb7e0f2SJohannes Berg  * @rx_rate: bitrate of received FTM action frame
32529bb7e0f2SJohannes Berg  * @rtt_avg: average of RTTs measured (must have either this or @dist_avg)
32539bb7e0f2SJohannes Berg  * @rtt_variance: variance of RTTs measured (note that standard deviation is
32549bb7e0f2SJohannes Berg  *	the square root of the variance)
32559bb7e0f2SJohannes Berg  * @rtt_spread: spread of the RTTs measured
32569bb7e0f2SJohannes Berg  * @dist_avg: average of distances (mm) measured
32579bb7e0f2SJohannes Berg  *	(must have either this or @rtt_avg)
32589bb7e0f2SJohannes Berg  * @dist_variance: variance of distances measured (see also @rtt_variance)
32599bb7e0f2SJohannes Berg  * @dist_spread: spread of distances measured (see also @rtt_spread)
32609bb7e0f2SJohannes Berg  * @num_ftmr_attempts_valid: @num_ftmr_attempts is valid
32619bb7e0f2SJohannes Berg  * @num_ftmr_successes_valid: @num_ftmr_successes is valid
32629bb7e0f2SJohannes Berg  * @rssi_avg_valid: @rssi_avg is valid
32639bb7e0f2SJohannes Berg  * @rssi_spread_valid: @rssi_spread is valid
32649bb7e0f2SJohannes Berg  * @tx_rate_valid: @tx_rate is valid
32659bb7e0f2SJohannes Berg  * @rx_rate_valid: @rx_rate is valid
32669bb7e0f2SJohannes Berg  * @rtt_avg_valid: @rtt_avg is valid
32679bb7e0f2SJohannes Berg  * @rtt_variance_valid: @rtt_variance is valid
32689bb7e0f2SJohannes Berg  * @rtt_spread_valid: @rtt_spread is valid
32699bb7e0f2SJohannes Berg  * @dist_avg_valid: @dist_avg is valid
32709bb7e0f2SJohannes Berg  * @dist_variance_valid: @dist_variance is valid
32719bb7e0f2SJohannes Berg  * @dist_spread_valid: @dist_spread is valid
32729bb7e0f2SJohannes Berg  */
32739bb7e0f2SJohannes Berg struct cfg80211_pmsr_ftm_result {
32749bb7e0f2SJohannes Berg 	const u8 *lci;
32759bb7e0f2SJohannes Berg 	const u8 *civicloc;
32769bb7e0f2SJohannes Berg 	unsigned int lci_len;
32779bb7e0f2SJohannes Berg 	unsigned int civicloc_len;
32789bb7e0f2SJohannes Berg 	enum nl80211_peer_measurement_ftm_failure_reasons failure_reason;
32799bb7e0f2SJohannes Berg 	u32 num_ftmr_attempts, num_ftmr_successes;
32809bb7e0f2SJohannes Berg 	s16 burst_index;
32819bb7e0f2SJohannes Berg 	u8 busy_retry_time;
32829bb7e0f2SJohannes Berg 	u8 num_bursts_exp;
32839bb7e0f2SJohannes Berg 	u8 burst_duration;
32849bb7e0f2SJohannes Berg 	u8 ftms_per_burst;
32859bb7e0f2SJohannes Berg 	s32 rssi_avg;
32869bb7e0f2SJohannes Berg 	s32 rssi_spread;
32879bb7e0f2SJohannes Berg 	struct rate_info tx_rate, rx_rate;
32889bb7e0f2SJohannes Berg 	s64 rtt_avg;
32899bb7e0f2SJohannes Berg 	s64 rtt_variance;
32909bb7e0f2SJohannes Berg 	s64 rtt_spread;
32919bb7e0f2SJohannes Berg 	s64 dist_avg;
32929bb7e0f2SJohannes Berg 	s64 dist_variance;
32939bb7e0f2SJohannes Berg 	s64 dist_spread;
32949bb7e0f2SJohannes Berg 
32959bb7e0f2SJohannes Berg 	u16 num_ftmr_attempts_valid:1,
32969bb7e0f2SJohannes Berg 	    num_ftmr_successes_valid:1,
32979bb7e0f2SJohannes Berg 	    rssi_avg_valid:1,
32989bb7e0f2SJohannes Berg 	    rssi_spread_valid:1,
32999bb7e0f2SJohannes Berg 	    tx_rate_valid:1,
33009bb7e0f2SJohannes Berg 	    rx_rate_valid:1,
33019bb7e0f2SJohannes Berg 	    rtt_avg_valid:1,
33029bb7e0f2SJohannes Berg 	    rtt_variance_valid:1,
33039bb7e0f2SJohannes Berg 	    rtt_spread_valid:1,
33049bb7e0f2SJohannes Berg 	    dist_avg_valid:1,
33059bb7e0f2SJohannes Berg 	    dist_variance_valid:1,
33069bb7e0f2SJohannes Berg 	    dist_spread_valid:1;
33079bb7e0f2SJohannes Berg };
33089bb7e0f2SJohannes Berg 
33099bb7e0f2SJohannes Berg /**
33109bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_result - peer measurement result
33119bb7e0f2SJohannes Berg  * @addr: address of the peer
33129bb7e0f2SJohannes Berg  * @host_time: host time (use ktime_get_boottime() adjust to the time when the
33139bb7e0f2SJohannes Berg  *	measurement was made)
33149bb7e0f2SJohannes Berg  * @ap_tsf: AP's TSF at measurement time
33159bb7e0f2SJohannes Berg  * @status: status of the measurement
33169bb7e0f2SJohannes Berg  * @final: if reporting partial results, mark this as the last one; if not
33179bb7e0f2SJohannes Berg  *	reporting partial results always set this flag
33189bb7e0f2SJohannes Berg  * @ap_tsf_valid: indicates the @ap_tsf value is valid
33199bb7e0f2SJohannes Berg  * @type: type of the measurement reported, note that we only support reporting
33209bb7e0f2SJohannes Berg  *	one type at a time, but you can report multiple results separately and
33219bb7e0f2SJohannes Berg  *	they're all aggregated for userspace.
33229bb7e0f2SJohannes Berg  */
33239bb7e0f2SJohannes Berg struct cfg80211_pmsr_result {
33249bb7e0f2SJohannes Berg 	u64 host_time, ap_tsf;
33259bb7e0f2SJohannes Berg 	enum nl80211_peer_measurement_status status;
33269bb7e0f2SJohannes Berg 
33279bb7e0f2SJohannes Berg 	u8 addr[ETH_ALEN];
33289bb7e0f2SJohannes Berg 
33299bb7e0f2SJohannes Berg 	u8 final:1,
33309bb7e0f2SJohannes Berg 	   ap_tsf_valid:1;
33319bb7e0f2SJohannes Berg 
33329bb7e0f2SJohannes Berg 	enum nl80211_peer_measurement_type type;
33339bb7e0f2SJohannes Berg 
33349bb7e0f2SJohannes Berg 	union {
33359bb7e0f2SJohannes Berg 		struct cfg80211_pmsr_ftm_result ftm;
33369bb7e0f2SJohannes Berg 	};
33379bb7e0f2SJohannes Berg };
33389bb7e0f2SJohannes Berg 
33399bb7e0f2SJohannes Berg /**
33409bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_ftm_request_peer - FTM request data
33419bb7e0f2SJohannes Berg  * @requested: indicates FTM is requested
33429bb7e0f2SJohannes Berg  * @preamble: frame preamble to use
33439bb7e0f2SJohannes Berg  * @burst_period: burst period to use
33449bb7e0f2SJohannes Berg  * @asap: indicates to use ASAP mode
33459bb7e0f2SJohannes Berg  * @num_bursts_exp: number of bursts exponent
33469bb7e0f2SJohannes Berg  * @burst_duration: burst duration
33479bb7e0f2SJohannes Berg  * @ftms_per_burst: number of FTMs per burst
33489bb7e0f2SJohannes Berg  * @ftmr_retries: number of retries for FTM request
33499bb7e0f2SJohannes Berg  * @request_lci: request LCI information
33509bb7e0f2SJohannes Berg  * @request_civicloc: request civic location information
3351efb5520dSAvraham Stern  * @trigger_based: use trigger based ranging for the measurement
3352efb5520dSAvraham Stern  *		 If neither @trigger_based nor @non_trigger_based is set,
3353efb5520dSAvraham Stern  *		 EDCA based ranging will be used.
3354efb5520dSAvraham Stern  * @non_trigger_based: use non trigger based ranging for the measurement
3355efb5520dSAvraham Stern  *		 If neither @trigger_based nor @non_trigger_based is set,
3356efb5520dSAvraham Stern  *		 EDCA based ranging will be used.
33579bb7e0f2SJohannes Berg  *
33589bb7e0f2SJohannes Berg  * See also nl80211 for the respective attribute documentation.
33599bb7e0f2SJohannes Berg  */
33609bb7e0f2SJohannes Berg struct cfg80211_pmsr_ftm_request_peer {
33619bb7e0f2SJohannes Berg 	enum nl80211_preamble preamble;
33629bb7e0f2SJohannes Berg 	u16 burst_period;
33639bb7e0f2SJohannes Berg 	u8 requested:1,
33649bb7e0f2SJohannes Berg 	   asap:1,
33659bb7e0f2SJohannes Berg 	   request_lci:1,
3366efb5520dSAvraham Stern 	   request_civicloc:1,
3367efb5520dSAvraham Stern 	   trigger_based:1,
3368efb5520dSAvraham Stern 	   non_trigger_based:1;
33699bb7e0f2SJohannes Berg 	u8 num_bursts_exp;
33709bb7e0f2SJohannes Berg 	u8 burst_duration;
33719bb7e0f2SJohannes Berg 	u8 ftms_per_burst;
33729bb7e0f2SJohannes Berg 	u8 ftmr_retries;
33739bb7e0f2SJohannes Berg };
33749bb7e0f2SJohannes Berg 
33759bb7e0f2SJohannes Berg /**
33769bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_request_peer - peer data for a peer measurement request
33779bb7e0f2SJohannes Berg  * @addr: MAC address
33789bb7e0f2SJohannes Berg  * @chandef: channel to use
33799bb7e0f2SJohannes Berg  * @report_ap_tsf: report the associated AP's TSF
33809bb7e0f2SJohannes Berg  * @ftm: FTM data, see &struct cfg80211_pmsr_ftm_request_peer
33819bb7e0f2SJohannes Berg  */
33829bb7e0f2SJohannes Berg struct cfg80211_pmsr_request_peer {
33839bb7e0f2SJohannes Berg 	u8 addr[ETH_ALEN];
33849bb7e0f2SJohannes Berg 	struct cfg80211_chan_def chandef;
33859bb7e0f2SJohannes Berg 	u8 report_ap_tsf:1;
33869bb7e0f2SJohannes Berg 	struct cfg80211_pmsr_ftm_request_peer ftm;
33879bb7e0f2SJohannes Berg };
33889bb7e0f2SJohannes Berg 
33899bb7e0f2SJohannes Berg /**
33909bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_request - peer measurement request
33919bb7e0f2SJohannes Berg  * @cookie: cookie, set by cfg80211
33929bb7e0f2SJohannes Berg  * @nl_portid: netlink portid - used by cfg80211
33939bb7e0f2SJohannes Berg  * @drv_data: driver data for this request, if required for aborting,
33949bb7e0f2SJohannes Berg  *	not otherwise freed or anything by cfg80211
33959bb7e0f2SJohannes Berg  * @mac_addr: MAC address used for (randomised) request
33969bb7e0f2SJohannes Berg  * @mac_addr_mask: MAC address mask used for randomisation, bits that
33979bb7e0f2SJohannes Berg  *	are 0 in the mask should be randomised, bits that are 1 should
33989bb7e0f2SJohannes Berg  *	be taken from the @mac_addr
33999bb7e0f2SJohannes Berg  * @list: used by cfg80211 to hold on to the request
34009bb7e0f2SJohannes Berg  * @timeout: timeout (in milliseconds) for the whole operation, if
34019bb7e0f2SJohannes Berg  *	zero it means there's no timeout
34029bb7e0f2SJohannes Berg  * @n_peers: number of peers to do measurements with
34039bb7e0f2SJohannes Berg  * @peers: per-peer measurement request data
34049bb7e0f2SJohannes Berg  */
34059bb7e0f2SJohannes Berg struct cfg80211_pmsr_request {
34069bb7e0f2SJohannes Berg 	u64 cookie;
34079bb7e0f2SJohannes Berg 	void *drv_data;
34089bb7e0f2SJohannes Berg 	u32 n_peers;
34099bb7e0f2SJohannes Berg 	u32 nl_portid;
34109bb7e0f2SJohannes Berg 
34119bb7e0f2SJohannes Berg 	u32 timeout;
34129bb7e0f2SJohannes Berg 
34139bb7e0f2SJohannes Berg 	u8 mac_addr[ETH_ALEN] __aligned(2);
34149bb7e0f2SJohannes Berg 	u8 mac_addr_mask[ETH_ALEN] __aligned(2);
34159bb7e0f2SJohannes Berg 
34169bb7e0f2SJohannes Berg 	struct list_head list;
34179bb7e0f2SJohannes Berg 
34189bb7e0f2SJohannes Berg 	struct cfg80211_pmsr_request_peer peers[];
34199bb7e0f2SJohannes Berg };
34209bb7e0f2SJohannes Berg 
34219bb7e0f2SJohannes Berg /**
3422cb74e977SSunil Dutt  * struct cfg80211_update_owe_info - OWE Information
3423cb74e977SSunil Dutt  *
3424cb74e977SSunil Dutt  * This structure provides information needed for the drivers to offload OWE
3425cb74e977SSunil Dutt  * (Opportunistic Wireless Encryption) processing to the user space.
3426cb74e977SSunil Dutt  *
3427cb74e977SSunil Dutt  * Commonly used across update_owe_info request and event interfaces.
3428cb74e977SSunil Dutt  *
3429cb74e977SSunil Dutt  * @peer: MAC address of the peer device for which the OWE processing
3430cb74e977SSunil Dutt  *	has to be done.
3431cb74e977SSunil Dutt  * @status: status code, %WLAN_STATUS_SUCCESS for successful OWE info
3432cb74e977SSunil Dutt  *	processing, use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space
3433cb74e977SSunil Dutt  *	cannot give you the real status code for failures. Used only for
3434cb74e977SSunil Dutt  *	OWE update request command interface (user space to driver).
3435cb74e977SSunil Dutt  * @ie: IEs obtained from the peer or constructed by the user space. These are
3436cb74e977SSunil Dutt  *	the IEs of the remote peer in the event from the host driver and
3437cb74e977SSunil Dutt  *	the constructed IEs by the user space in the request interface.
3438cb74e977SSunil Dutt  * @ie_len: Length of IEs in octets.
3439cb74e977SSunil Dutt  */
3440cb74e977SSunil Dutt struct cfg80211_update_owe_info {
3441cb74e977SSunil Dutt 	u8 peer[ETH_ALEN] __aligned(2);
3442cb74e977SSunil Dutt 	u16 status;
3443cb74e977SSunil Dutt 	const u8 *ie;
3444cb74e977SSunil Dutt 	size_t ie_len;
3445cb74e977SSunil Dutt };
3446cb74e977SSunil Dutt 
3447cb74e977SSunil Dutt /**
34486cd536feSJohannes Berg  * struct mgmt_frame_regs - management frame registrations data
34496cd536feSJohannes Berg  * @global_stypes: bitmap of management frame subtypes registered
34506cd536feSJohannes Berg  *	for the entire device
34516cd536feSJohannes Berg  * @interface_stypes: bitmap of management frame subtypes registered
34526cd536feSJohannes Berg  *	for the given interface
34539dba48a6SJohannes Berg  * @global_mcast_rx: mcast RX is needed globally for these subtypes
34549dba48a6SJohannes Berg  * @interface_mcast_stypes: mcast RX is needed on this interface
34559dba48a6SJohannes Berg  *	for these subtypes
34566cd536feSJohannes Berg  */
34576cd536feSJohannes Berg struct mgmt_frame_regs {
34586cd536feSJohannes Berg 	u32 global_stypes, interface_stypes;
34599dba48a6SJohannes Berg 	u32 global_mcast_stypes, interface_mcast_stypes;
34606cd536feSJohannes Berg };
34616cd536feSJohannes Berg 
34626cd536feSJohannes Berg /**
3463704232c2SJohannes Berg  * struct cfg80211_ops - backend description for wireless configuration
3464704232c2SJohannes Berg  *
3465704232c2SJohannes Berg  * This struct is registered by fullmac card drivers and/or wireless stacks
3466704232c2SJohannes Berg  * in order to handle configuration requests on their interfaces.
3467704232c2SJohannes Berg  *
3468704232c2SJohannes Berg  * All callbacks except where otherwise noted should return 0
3469704232c2SJohannes Berg  * on success or a negative error code.
3470704232c2SJohannes Berg  *
347143fb45cbSJohannes Berg  * All operations are currently invoked under rtnl for consistency with the
347243fb45cbSJohannes Berg  * wireless extensions but this is subject to reevaluation as soon as this
347343fb45cbSJohannes Berg  * code is used more widely and we have a first user without wext.
347443fb45cbSJohannes Berg  *
3475ff1b6e69SJohannes Berg  * @suspend: wiphy device needs to be suspended. The variable @wow will
3476ff1b6e69SJohannes Berg  *	be %NULL or contain the enabled Wake-on-Wireless triggers that are
3477ff1b6e69SJohannes Berg  *	configured for the device.
34780378b3f1SJohannes Berg  * @resume: wiphy device needs to be resumed
34796d52563fSJohannes Berg  * @set_wakeup: Called when WoWLAN is enabled/disabled, use this callback
34806d52563fSJohannes Berg  *	to call device_set_wakeup_enable() to enable/disable wakeup from
34816d52563fSJohannes Berg  *	the device.
34820378b3f1SJohannes Berg  *
348360719ffdSJohannes Berg  * @add_virtual_intf: create a new virtual interface with the given name,
3484463d0183SJohannes Berg  *	must set the struct wireless_dev's iftype. Beware: You must create
348584efbb84SJohannes Berg  *	the new netdev in the wiphy's network namespace! Returns the struct
348698104fdeSJohannes Berg  *	wireless_dev, or an ERR_PTR. For P2P device wdevs, the driver must
348798104fdeSJohannes Berg  *	also set the address member in the wdev.
3488704232c2SJohannes Berg  *
348984efbb84SJohannes Berg  * @del_virtual_intf: remove the virtual interface
349055682965SJohannes Berg  *
349160719ffdSJohannes Berg  * @change_virtual_intf: change type/configuration of virtual interface,
349260719ffdSJohannes Berg  *	keep the struct wireless_dev's iftype updated.
349355682965SJohannes Berg  *
349441ade00fSJohannes Berg  * @add_key: add a key with the given parameters. @mac_addr will be %NULL
349541ade00fSJohannes Berg  *	when adding a group key.
349641ade00fSJohannes Berg  *
349741ade00fSJohannes Berg  * @get_key: get information about the key with the given parameters.
349841ade00fSJohannes Berg  *	@mac_addr will be %NULL when requesting information for a group
349941ade00fSJohannes Berg  *	key. All pointers given to the @callback function need not be valid
3500e3da574aSJohannes Berg  *	after it returns. This function should return an error if it is
3501e3da574aSJohannes Berg  *	not possible to retrieve the key, -ENOENT if it doesn't exist.
350241ade00fSJohannes Berg  *
350341ade00fSJohannes Berg  * @del_key: remove a key given the @mac_addr (%NULL for a group key)
3504e3da574aSJohannes Berg  *	and @key_index, return -ENOENT if the key doesn't exist.
350541ade00fSJohannes Berg  *
350641ade00fSJohannes Berg  * @set_default_key: set the default key on an interface
3507ed1b6cc7SJohannes Berg  *
35083cfcf6acSJouni Malinen  * @set_default_mgmt_key: set the default management frame key on an interface
35091f7e9f46SJohannes Berg  *
351056be393fSJouni Malinen  * @set_default_beacon_key: set the default Beacon frame key on an interface
35113cfcf6acSJouni Malinen  *
3512e5497d76SJohannes Berg  * @set_rekey_data: give the data necessary for GTK rekeying to the driver
3513e5497d76SJohannes Berg  *
3514c04a4ff7SJohannes Berg  * @start_ap: Start acting in AP mode defined by the parameters.
3515c04a4ff7SJohannes Berg  * @change_beacon: Change the beacon parameters for an access point mode
3516c04a4ff7SJohannes Berg  *	interface. This should reject the call when AP mode wasn't started.
3517c04a4ff7SJohannes Berg  * @stop_ap: Stop being an AP, including stopping beaconing.
35185727ef1bSJohannes Berg  *
35195727ef1bSJohannes Berg  * @add_station: Add a new station.
352089c771e5SJouni Malinen  * @del_station: Remove a station
3521bdd90d5eSJohannes Berg  * @change_station: Modify a given station. Note that flags changes are not much
3522bdd90d5eSJohannes Berg  *	validated in cfg80211, in particular the auth/assoc/authorized flags
3523bdd90d5eSJohannes Berg  *	might come to the driver in invalid combinations -- make sure to check
352477ee7c89SJohannes Berg  *	them, also against the existing state! Drivers must call
352577ee7c89SJohannes Berg  *	cfg80211_check_station_change() to validate the information.
3526abe37c4bSJohannes Berg  * @get_station: get station information for the station identified by @mac
3527abe37c4bSJohannes Berg  * @dump_station: dump station callback -- resume dump at index @idx
3528abe37c4bSJohannes Berg  *
3529abe37c4bSJohannes Berg  * @add_mpath: add a fixed mesh path
3530abe37c4bSJohannes Berg  * @del_mpath: delete a given mesh path
3531abe37c4bSJohannes Berg  * @change_mpath: change a given mesh path
3532abe37c4bSJohannes Berg  * @get_mpath: get a mesh path for the given parameters
3533abe37c4bSJohannes Berg  * @dump_mpath: dump mesh path callback -- resume dump at index @idx
353466be7d2bSHenning Rogge  * @get_mpp: get a mesh proxy path for the given parameters
353566be7d2bSHenning Rogge  * @dump_mpp: dump mesh proxy path callback -- resume dump at index @idx
3536f52555a4SJohannes Berg  * @join_mesh: join the mesh network with the specified parameters
35378d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
3538f52555a4SJohannes Berg  * @leave_mesh: leave the current mesh network
35398d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
35402ec600d6SLuis Carlos Cobo  *
354124bdd9f4SJavier Cardona  * @get_mesh_config: Get the current mesh configuration
354293da9cc1Scolin@cozybit.com  *
354324bdd9f4SJavier Cardona  * @update_mesh_config: Update mesh parameters on a running mesh.
354493da9cc1Scolin@cozybit.com  *	The mask is a bitfield which tells us which parameters to
354593da9cc1Scolin@cozybit.com  *	set, and which to leave alone.
354693da9cc1Scolin@cozybit.com  *
35479f1ba906SJouni Malinen  * @change_bss: Modify parameters for a given BSS.
354831888487SJouni Malinen  *
354931888487SJouni Malinen  * @set_txq_params: Set TX queue parameters
355072bdcf34SJouni Malinen  *
3551e8c9bd5bSJohannes Berg  * @libertas_set_mesh_channel: Only for backward compatibility for libertas,
3552e8c9bd5bSJohannes Berg  *	as it doesn't implement join_mesh and needs to set the channel to
3553e8c9bd5bSJohannes Berg  *	join the mesh instead.
3554e8c9bd5bSJohannes Berg  *
3555e8c9bd5bSJohannes Berg  * @set_monitor_channel: Set the monitor mode channel for the device. If other
3556e8c9bd5bSJohannes Berg  *	interfaces are active this callback should reject the configuration.
3557e8c9bd5bSJohannes Berg  *	If no interfaces are active or the device is down, the channel should
3558e8c9bd5bSJohannes Berg  *	be stored for when a monitor interface becomes active.
35599aed3cc1SJouni Malinen  *
35602a519311SJohannes Berg  * @scan: Request to do a scan. If returning zero, the scan request is given
35612a519311SJohannes Berg  *	the driver, and will be valid until passed to cfg80211_scan_done().
35622a519311SJohannes Berg  *	For scan results, call cfg80211_inform_bss(); you can call this outside
35632a519311SJohannes Berg  *	the scan/scan_done bracket too.
356491d3ab46SVidyullatha Kanchanapally  * @abort_scan: Tell the driver to abort an ongoing scan. The driver shall
356591d3ab46SVidyullatha Kanchanapally  *	indicate the status of the scan through cfg80211_scan_done().
3566636a5d36SJouni Malinen  *
3567636a5d36SJouni Malinen  * @auth: Request to authenticate with the specified peer
35688d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
3569636a5d36SJouni Malinen  * @assoc: Request to (re)associate with the specified peer
35708d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
3571636a5d36SJouni Malinen  * @deauth: Request to deauthenticate from the specified peer
35728d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
3573636a5d36SJouni Malinen  * @disassoc: Request to disassociate from the specified peer
35748d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
357504a773adSJohannes Berg  *
3576b23aa676SSamuel Ortiz  * @connect: Connect to the ESS with the specified parameters. When connected,
3577bf1ecd21SJouni Malinen  *	call cfg80211_connect_result()/cfg80211_connect_bss() with status code
3578bf1ecd21SJouni Malinen  *	%WLAN_STATUS_SUCCESS. If the connection fails for some reason, call
3579bf1ecd21SJouni Malinen  *	cfg80211_connect_result()/cfg80211_connect_bss() with the status code
3580bf1ecd21SJouni Malinen  *	from the AP or cfg80211_connect_timeout() if no frame with status code
3581bf1ecd21SJouni Malinen  *	was received.
3582bf1ecd21SJouni Malinen  *	The driver is allowed to roam to other BSSes within the ESS when the
3583bf1ecd21SJouni Malinen  *	other BSS matches the connect parameters. When such roaming is initiated
3584bf1ecd21SJouni Malinen  *	by the driver, the driver is expected to verify that the target matches
3585bf1ecd21SJouni Malinen  *	the configured security parameters and to use Reassociation Request
3586bf1ecd21SJouni Malinen  *	frame instead of Association Request frame.
3587bf1ecd21SJouni Malinen  *	The connect function can also be used to request the driver to perform a
3588bf1ecd21SJouni Malinen  *	specific roam when connected to an ESS. In that case, the prev_bssid
358935eb8f7bSJouni Malinen  *	parameter is set to the BSSID of the currently associated BSS as an
3590bf1ecd21SJouni Malinen  *	indication of requesting reassociation.
3591bf1ecd21SJouni Malinen  *	In both the driver-initiated and new connect() call initiated roaming
3592bf1ecd21SJouni Malinen  *	cases, the result of roaming is indicated with a call to
359329ce6ecbSAvraham Stern  *	cfg80211_roamed(). (invoked with the wireless_dev mutex held)
3594088e8df8Svamsi krishna  * @update_connect_params: Update the connect parameters while connected to a
3595088e8df8Svamsi krishna  *	BSS. The updated parameters can be used by driver/firmware for
3596088e8df8Svamsi krishna  *	subsequent BSS selection (roaming) decisions and to form the
3597088e8df8Svamsi krishna  *	Authentication/(Re)Association Request frames. This call does not
3598088e8df8Svamsi krishna  *	request an immediate disassociation or reassociation with the current
3599088e8df8Svamsi krishna  *	BSS, i.e., this impacts only subsequent (re)associations. The bits in
3600088e8df8Svamsi krishna  *	changed are defined in &enum cfg80211_connect_params_changed.
3601088e8df8Svamsi krishna  *	(invoked with the wireless_dev mutex held)
36020711d638SIlan Peer  * @disconnect: Disconnect from the BSS/ESS or stop connection attempts if
36030711d638SIlan Peer  *      connection is in progress. Once done, call cfg80211_disconnected() in
36040711d638SIlan Peer  *      case connection was already established (invoked with the
36050711d638SIlan Peer  *      wireless_dev mutex held), otherwise call cfg80211_connect_timeout().
3606b23aa676SSamuel Ortiz  *
360704a773adSJohannes Berg  * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call
360804a773adSJohannes Berg  *	cfg80211_ibss_joined(), also call that function when changing BSSID due
360904a773adSJohannes Berg  *	to a merge.
36108d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
361104a773adSJohannes Berg  * @leave_ibss: Leave the IBSS.
36128d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
3613b9a5f8caSJouni Malinen  *
3614f4e583c8SAntonio Quartulli  * @set_mcast_rate: Set the specified multicast rate (only if vif is in ADHOC or
3615f4e583c8SAntonio Quartulli  *	MESH mode)
3616f4e583c8SAntonio Quartulli  *
3617b9a5f8caSJouni Malinen  * @set_wiphy_params: Notify that wiphy parameters have changed;
3618b9a5f8caSJouni Malinen  *	@changed bitfield (see &enum wiphy_params_flags) describes which values
3619b9a5f8caSJouni Malinen  *	have changed. The actual parameter values are available in
3620b9a5f8caSJouni Malinen  *	struct wiphy. If returning an error, no value should be changed.
36217643a2c3SJohannes Berg  *
36221432de07SLuis R. Rodriguez  * @set_tx_power: set the transmit power according to the parameters,
3623c8442118SJohannes Berg  *	the power passed is in mBm, to get dBm use MBM_TO_DBM(). The
3624c8442118SJohannes Berg  *	wdev may be %NULL if power was set for the wiphy, and will
3625c8442118SJohannes Berg  *	always be %NULL unless the driver supports per-vif TX power
3626c8442118SJohannes Berg  *	(as advertised by the nl80211 feature flag.)
36277643a2c3SJohannes Berg  * @get_tx_power: store the current TX power into the dbm variable;
36281f87f7d3SJohannes Berg  *	return 0 if successful
36291f87f7d3SJohannes Berg  *
3630abe37c4bSJohannes Berg  * @set_wds_peer: set the WDS peer for a WDS interface
3631abe37c4bSJohannes Berg  *
36321f87f7d3SJohannes Berg  * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting
36331f87f7d3SJohannes Berg  *	functions to adjust rfkill hw state
3634aff89a9bSJohannes Berg  *
363561fa713cSHolger Schurig  * @dump_survey: get site survey information.
363661fa713cSHolger Schurig  *
36379588bbd5SJouni Malinen  * @remain_on_channel: Request the driver to remain awake on the specified
36389588bbd5SJouni Malinen  *	channel for the specified duration to complete an off-channel
36399588bbd5SJouni Malinen  *	operation (e.g., public action frame exchange). When the driver is
36409588bbd5SJouni Malinen  *	ready on the requested channel, it must indicate this with an event
36419588bbd5SJouni Malinen  *	notification by calling cfg80211_ready_on_channel().
36429588bbd5SJouni Malinen  * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation.
36439588bbd5SJouni Malinen  *	This allows the operation to be terminated prior to timeout based on
36449588bbd5SJouni Malinen  *	the duration value.
3645f7ca38dfSJohannes Berg  * @mgmt_tx: Transmit a management frame.
3646f7ca38dfSJohannes Berg  * @mgmt_tx_cancel_wait: Cancel the wait time from transmitting a management
3647f7ca38dfSJohannes Berg  *	frame on another channel
36489588bbd5SJouni Malinen  *
3649fc73f11fSDavid Spinadel  * @testmode_cmd: run a test mode command; @wdev may be %NULL
365071063f0eSWey-Yi Guy  * @testmode_dump: Implement a test mode dump. The cb->args[2] and up may be
365171063f0eSWey-Yi Guy  *	used by the function, but 0 and 1 must not be touched. Additionally,
365271063f0eSWey-Yi Guy  *	return error codes other than -ENOBUFS and -ENOENT will terminate the
365371063f0eSWey-Yi Guy  *	dump and return to userspace with an error, so be careful. If any data
365471063f0eSWey-Yi Guy  *	was passed in from userspace then the data/len arguments will be present
365571063f0eSWey-Yi Guy  *	and point to the data contained in %NL80211_ATTR_TESTDATA.
365667fbb16bSSamuel Ortiz  *
3657abe37c4bSJohannes Berg  * @set_bitrate_mask: set the bitrate mask configuration
3658abe37c4bSJohannes Berg  *
365967fbb16bSSamuel Ortiz  * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac
366067fbb16bSSamuel Ortiz  *	devices running firmwares capable of generating the (re) association
366167fbb16bSSamuel Ortiz  *	RSN IE. It allows for faster roaming between WPA2 BSSIDs.
366267fbb16bSSamuel Ortiz  * @del_pmksa: Delete a cached PMKID.
366367fbb16bSSamuel Ortiz  * @flush_pmksa: Flush all cached PMKIDs.
36649043f3b8SJuuso Oikarinen  * @set_power_mgmt: Configure WLAN power management. A timeout value of -1
36659043f3b8SJuuso Oikarinen  *	allows the driver to adjust the dynamic ps timeout value.
3666d6dc1a38SJuuso Oikarinen  * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold.
3667e86abc68SJohannes Berg  *	After configuration, the driver should (soon) send an event indicating
3668e86abc68SJohannes Berg  *	the current level is above/below the configured threshold; this may
3669e86abc68SJohannes Berg  *	need some care when the configuration is changed (without first being
3670e86abc68SJohannes Berg  *	disabled.)
36714a4b8169SAndrew Zaborowski  * @set_cqm_rssi_range_config: Configure two RSSI thresholds in the
36724a4b8169SAndrew Zaborowski  *	connection quality monitor.  An event is to be sent only when the
36734a4b8169SAndrew Zaborowski  *	signal level is found to be outside the two values.  The driver should
36744a4b8169SAndrew Zaborowski  *	set %NL80211_EXT_FEATURE_CQM_RSSI_LIST if this method is implemented.
36754a4b8169SAndrew Zaborowski  *	If it is provided then there's no point providing @set_cqm_rssi_config.
367684f10708SThomas Pedersen  * @set_cqm_txe_config: Configure connection quality monitor TX error
367784f10708SThomas Pedersen  *	thresholds.
3678807f8a8cSLuciano Coelho  * @sched_scan_start: Tell the driver to start a scheduled scan.
36793a3ecf1dSArend Van Spriel  * @sched_scan_stop: Tell the driver to stop an ongoing scheduled scan with
36803a3ecf1dSArend Van Spriel  *	given request id. This call must stop the scheduled scan and be ready
36813a3ecf1dSArend Van Spriel  *	for starting a new one before it returns, i.e. @sched_scan_start may be
36823a3ecf1dSArend Van Spriel  *	called immediately after that again and should not fail in that case.
36833a3ecf1dSArend Van Spriel  *	The driver should not call cfg80211_sched_scan_stopped() for a requested
36843a3ecf1dSArend Van Spriel  *	stop (when this method returns 0).
368567fbb16bSSamuel Ortiz  *
36866cd536feSJohannes Berg  * @update_mgmt_frame_registrations: Notify the driver that management frame
36876cd536feSJohannes Berg  *	registrations were updated. The callback is allowed to sleep.
3688547025d5SBruno Randolf  *
3689547025d5SBruno Randolf  * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device.
3690547025d5SBruno Randolf  *	Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may
3691547025d5SBruno Randolf  *	reject TX/RX mask combinations they cannot support by returning -EINVAL
3692547025d5SBruno Randolf  *	(also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX).
3693547025d5SBruno Randolf  *
3694547025d5SBruno Randolf  * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant).
36953677713bSJohn W. Linville  *
3696109086ceSArik Nemtsov  * @tdls_mgmt: Transmit a TDLS management frame.
3697109086ceSArik Nemtsov  * @tdls_oper: Perform a high-level TDLS operation (e.g. TDLS link setup).
36987f6cf311SJohannes Berg  *
36997f6cf311SJohannes Berg  * @probe_client: probe an associated client, must return a cookie that it
37007f6cf311SJohannes Berg  *	later passes to cfg80211_probe_status().
37011d9d9213SSimon Wunderlich  *
37021d9d9213SSimon Wunderlich  * @set_noack_map: Set the NoAck Map for the TIDs.
3703d6199218SBen Greear  *
37045b7ccaf3SJohannes Berg  * @get_channel: Get the current operating channel for the virtual interface.
37055b7ccaf3SJohannes Berg  *	For monitor interfaces, it should return %NULL unless there's a single
37065b7ccaf3SJohannes Berg  *	current monitoring channel.
370798104fdeSJohannes Berg  *
370898104fdeSJohannes Berg  * @start_p2p_device: Start the given P2P device.
370998104fdeSJohannes Berg  * @stop_p2p_device: Stop the given P2P device.
371077765eafSVasanthakumar Thiagarajan  *
371177765eafSVasanthakumar Thiagarajan  * @set_mac_acl: Sets MAC address control list in AP and P2P GO mode.
371277765eafSVasanthakumar Thiagarajan  *	Parameters include ACL policy, an array of MAC address of stations
371377765eafSVasanthakumar Thiagarajan  *	and the number of MAC addresses. If there is already a list in driver
371477765eafSVasanthakumar Thiagarajan  *	this new list replaces the existing one. Driver has to clear its ACL
371577765eafSVasanthakumar Thiagarajan  *	when number of MAC addresses entries is passed as 0. Drivers which
371677765eafSVasanthakumar Thiagarajan  *	advertise the support for MAC based ACL have to implement this callback.
371704f39047SSimon Wunderlich  *
371804f39047SSimon Wunderlich  * @start_radar_detection: Start radar detection in the driver.
37198bf24293SJouni Malinen  *
372026ec17a1SOrr Mazor  * @end_cac: End running CAC, probably because a related CAC
372126ec17a1SOrr Mazor  *	was finished on another phy.
372226ec17a1SOrr Mazor  *
37238bf24293SJouni Malinen  * @update_ft_ies: Provide updated Fast BSS Transition information to the
37248bf24293SJouni Malinen  *	driver. If the SME is in the driver/firmware, this information can be
37258bf24293SJouni Malinen  *	used in building Authentication and Reassociation Request frames.
37265de17984SArend van Spriel  *
37275de17984SArend van Spriel  * @crit_proto_start: Indicates a critical protocol needs more link reliability
37285de17984SArend van Spriel  *	for a given duration (milliseconds). The protocol is provided so the
37295de17984SArend van Spriel  *	driver can take the most appropriate actions.
37305de17984SArend van Spriel  * @crit_proto_stop: Indicates critical protocol no longer needs increased link
37315de17984SArend van Spriel  *	reliability. This operation can not fail.
3732be29b99aSAmitkumar Karwar  * @set_coalesce: Set coalesce parameters.
373316ef1fe2SSimon Wunderlich  *
373497dc94f1SMichal Kazior  * @channel_switch: initiate channel-switch procedure (with CSA). Driver is
373597dc94f1SMichal Kazior  *	responsible for veryfing if the switch is possible. Since this is
373697dc94f1SMichal Kazior  *	inherently tricky driver may decide to disconnect an interface later
373797dc94f1SMichal Kazior  *	with cfg80211_stop_iface(). This doesn't mean driver can accept
373897dc94f1SMichal Kazior  *	everything. It should do it's best to verify requests and reject them
373997dc94f1SMichal Kazior  *	as soon as possible.
3740fa9ffc74SKyeyoon Park  *
3741fa9ffc74SKyeyoon Park  * @set_qos_map: Set QoS mapping information to the driver
3742e16821bcSJouni Malinen  *
3743e16821bcSJouni Malinen  * @set_ap_chanwidth: Set the AP (including P2P GO) mode channel width for the
3744e16821bcSJouni Malinen  *	given interface This is used e.g. for dynamic HT 20/40 MHz channel width
3745e16821bcSJouni Malinen  *	changes during the lifetime of the BSS.
3746960d01acSJohannes Berg  *
3747960d01acSJohannes Berg  * @add_tx_ts: validate (if admitted_time is 0) or add a TX TS to the device
3748960d01acSJohannes Berg  *	with the given parameters; action frame exchange has been handled by
3749960d01acSJohannes Berg  *	userspace so this just has to modify the TX path to take the TS into
3750960d01acSJohannes Berg  *	account.
3751960d01acSJohannes Berg  *	If the admitted time is 0 just validate the parameters to make sure
3752960d01acSJohannes Berg  *	the session can be created at all; it is valid to just always return
3753960d01acSJohannes Berg  *	success for that but that may result in inefficient behaviour (handshake
3754960d01acSJohannes Berg  *	with the peer followed by immediate teardown when the addition is later
3755960d01acSJohannes Berg  *	rejected)
3756960d01acSJohannes Berg  * @del_tx_ts: remove an existing TX TS
37576e0bd6c3SRostislav Lisovy  *
37586e0bd6c3SRostislav Lisovy  * @join_ocb: join the OCB network with the specified parameters
37596e0bd6c3SRostislav Lisovy  *	(invoked with the wireless_dev mutex held)
37606e0bd6c3SRostislav Lisovy  * @leave_ocb: leave the current OCB network
37616e0bd6c3SRostislav Lisovy  *	(invoked with the wireless_dev mutex held)
37621057d35eSArik Nemtsov  *
37631057d35eSArik Nemtsov  * @tdls_channel_switch: Start channel-switching with a TDLS peer. The driver
37641057d35eSArik Nemtsov  *	is responsible for continually initiating channel-switching operations
37651057d35eSArik Nemtsov  *	and returning to the base channel for communication with the AP.
37661057d35eSArik Nemtsov  * @tdls_cancel_channel_switch: Stop channel-switching with a TDLS peer. Both
37671057d35eSArik Nemtsov  *	peers must be on the base channel when the call completes.
3768cb3b7d87SAyala Beker  * @start_nan: Start the NAN interface.
3769cb3b7d87SAyala Beker  * @stop_nan: Stop the NAN interface.
3770a442b761SAyala Beker  * @add_nan_func: Add a NAN function. Returns negative value on failure.
3771a442b761SAyala Beker  *	On success @nan_func ownership is transferred to the driver and
3772a442b761SAyala Beker  *	it may access it outside of the scope of this function. The driver
3773a442b761SAyala Beker  *	should free the @nan_func when no longer needed by calling
3774a442b761SAyala Beker  *	cfg80211_free_nan_func().
3775a442b761SAyala Beker  *	On success the driver should assign an instance_id in the
3776a442b761SAyala Beker  *	provided @nan_func.
3777a442b761SAyala Beker  * @del_nan_func: Delete a NAN function.
3778a5a9dcf2SAyala Beker  * @nan_change_conf: changes NAN configuration. The changed parameters must
3779a5a9dcf2SAyala Beker  *	be specified in @changes (using &enum cfg80211_nan_conf_changes);
3780a5a9dcf2SAyala Beker  *	All other parameters must be ignored.
3781ce0ce13aSMichael Braun  *
3782ce0ce13aSMichael Braun  * @set_multicast_to_unicast: configure multicast to unicast conversion for BSS
37833a00df57SAvraham Stern  *
378452539ca8SToke Høiland-Jørgensen  * @get_txq_stats: Get TXQ stats for interface or phy. If wdev is %NULL, this
378552539ca8SToke Høiland-Jørgensen  *      function should return phy stats, and interface stats otherwise.
378652539ca8SToke Høiland-Jørgensen  *
37873a00df57SAvraham Stern  * @set_pmk: configure the PMK to be used for offloaded 802.1X 4-Way handshake.
37883a00df57SAvraham Stern  *	If not deleted through @del_pmk the PMK remains valid until disconnect
37893a00df57SAvraham Stern  *	upon which the driver should clear it.
37903a00df57SAvraham Stern  *	(invoked with the wireless_dev mutex held)
37913a00df57SAvraham Stern  * @del_pmk: delete the previously configured PMK for the given authenticator.
37923a00df57SAvraham Stern  *	(invoked with the wireless_dev mutex held)
379340cbfa90SSrinivas Dasari  *
379440cbfa90SSrinivas Dasari  * @external_auth: indicates result of offloaded authentication processing from
379540cbfa90SSrinivas Dasari  *     user space
37962576a9acSDenis Kenzior  *
37972576a9acSDenis Kenzior  * @tx_control_port: TX a control port frame (EAPoL).  The noencrypt parameter
37982576a9acSDenis Kenzior  *	tells the driver that the frame should not be encrypted.
379981e54d08SPradeep Kumar Chitrapu  *
380081e54d08SPradeep Kumar Chitrapu  * @get_ftm_responder_stats: Retrieve FTM responder statistics, if available.
380181e54d08SPradeep Kumar Chitrapu  *	Statistics should be cumulative, currently no way to reset is provided.
38029bb7e0f2SJohannes Berg  * @start_pmsr: start peer measurement (e.g. FTM)
38039bb7e0f2SJohannes Berg  * @abort_pmsr: abort peer measurement
3804cb74e977SSunil Dutt  *
3805cb74e977SSunil Dutt  * @update_owe_info: Provide updated OWE info to driver. Driver implementing SME
3806cb74e977SSunil Dutt  *	but offloading OWE processing to the user space will get the updated
3807cb74e977SSunil Dutt  *	DH IE through this interface.
38085ab92e7fSRajkumar Manoharan  *
38095ab92e7fSRajkumar Manoharan  * @probe_mesh_link: Probe direct Mesh peer's link quality by sending data frame
38105ab92e7fSRajkumar Manoharan  *	and overrule HWMP path selection algorithm.
381177f576deSTamizh chelvam  * @set_tid_config: TID specific configuration, this can be peer or BSS specific
381277f576deSTamizh chelvam  *	This callback may sleep.
38133710a8a6SJohannes Berg  * @reset_tid_config: Reset TID specific configuration for the peer, for the
38143710a8a6SJohannes Berg  *	given TIDs. This callback may sleep.
3815704232c2SJohannes Berg  */
3816704232c2SJohannes Berg struct cfg80211_ops {
3817ff1b6e69SJohannes Berg 	int	(*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
38180378b3f1SJohannes Berg 	int	(*resume)(struct wiphy *wiphy);
38196d52563fSJohannes Berg 	void	(*set_wakeup)(struct wiphy *wiphy, bool enabled);
38200378b3f1SJohannes Berg 
382184efbb84SJohannes Berg 	struct wireless_dev * (*add_virtual_intf)(struct wiphy *wiphy,
3822552bff0cSJohannes Berg 						  const char *name,
38236bab2e19STom Gundersen 						  unsigned char name_assign_type,
3824f9e10ce4SJohannes Berg 						  enum nl80211_iftype type,
38252ec600d6SLuis Carlos Cobo 						  struct vif_params *params);
382684efbb84SJohannes Berg 	int	(*del_virtual_intf)(struct wiphy *wiphy,
382784efbb84SJohannes Berg 				    struct wireless_dev *wdev);
3828e36d56b6SJohannes Berg 	int	(*change_virtual_intf)(struct wiphy *wiphy,
3829e36d56b6SJohannes Berg 				       struct net_device *dev,
3830818a986eSJohannes Berg 				       enum nl80211_iftype type,
38312ec600d6SLuis Carlos Cobo 				       struct vif_params *params);
383241ade00fSJohannes Berg 
383341ade00fSJohannes Berg 	int	(*add_key)(struct wiphy *wiphy, struct net_device *netdev,
3834e31b8213SJohannes Berg 			   u8 key_index, bool pairwise, const u8 *mac_addr,
383541ade00fSJohannes Berg 			   struct key_params *params);
383641ade00fSJohannes Berg 	int	(*get_key)(struct wiphy *wiphy, struct net_device *netdev,
3837e31b8213SJohannes Berg 			   u8 key_index, bool pairwise, const u8 *mac_addr,
3838e31b8213SJohannes Berg 			   void *cookie,
383941ade00fSJohannes Berg 			   void (*callback)(void *cookie, struct key_params*));
384041ade00fSJohannes Berg 	int	(*del_key)(struct wiphy *wiphy, struct net_device *netdev,
3841e31b8213SJohannes Berg 			   u8 key_index, bool pairwise, const u8 *mac_addr);
384241ade00fSJohannes Berg 	int	(*set_default_key)(struct wiphy *wiphy,
384341ade00fSJohannes Berg 				   struct net_device *netdev,
3844dbd2fd65SJohannes Berg 				   u8 key_index, bool unicast, bool multicast);
38453cfcf6acSJouni Malinen 	int	(*set_default_mgmt_key)(struct wiphy *wiphy,
38463cfcf6acSJouni Malinen 					struct net_device *netdev,
38473cfcf6acSJouni Malinen 					u8 key_index);
384856be393fSJouni Malinen 	int	(*set_default_beacon_key)(struct wiphy *wiphy,
384956be393fSJouni Malinen 					  struct net_device *netdev,
385056be393fSJouni Malinen 					  u8 key_index);
3851ed1b6cc7SJohannes Berg 
38528860020eSJohannes Berg 	int	(*start_ap)(struct wiphy *wiphy, struct net_device *dev,
38538860020eSJohannes Berg 			    struct cfg80211_ap_settings *settings);
38548860020eSJohannes Berg 	int	(*change_beacon)(struct wiphy *wiphy, struct net_device *dev,
38558860020eSJohannes Berg 				 struct cfg80211_beacon_data *info);
38568860020eSJohannes Berg 	int	(*stop_ap)(struct wiphy *wiphy, struct net_device *dev);
38575727ef1bSJohannes Berg 
38585727ef1bSJohannes Berg 
38595727ef1bSJohannes Berg 	int	(*add_station)(struct wiphy *wiphy, struct net_device *dev,
38603b3a0162SJohannes Berg 			       const u8 *mac,
38613b3a0162SJohannes Berg 			       struct station_parameters *params);
38625727ef1bSJohannes Berg 	int	(*del_station)(struct wiphy *wiphy, struct net_device *dev,
386389c771e5SJouni Malinen 			       struct station_del_parameters *params);
38645727ef1bSJohannes Berg 	int	(*change_station)(struct wiphy *wiphy, struct net_device *dev,
38653b3a0162SJohannes Berg 				  const u8 *mac,
38663b3a0162SJohannes Berg 				  struct station_parameters *params);
3867fd5b74dcSJohannes Berg 	int	(*get_station)(struct wiphy *wiphy, struct net_device *dev,
38683b3a0162SJohannes Berg 			       const u8 *mac, struct station_info *sinfo);
38692ec600d6SLuis Carlos Cobo 	int	(*dump_station)(struct wiphy *wiphy, struct net_device *dev,
38702ec600d6SLuis Carlos Cobo 				int idx, u8 *mac, struct station_info *sinfo);
38712ec600d6SLuis Carlos Cobo 
38722ec600d6SLuis Carlos Cobo 	int	(*add_mpath)(struct wiphy *wiphy, struct net_device *dev,
38733b3a0162SJohannes Berg 			       const u8 *dst, const u8 *next_hop);
38742ec600d6SLuis Carlos Cobo 	int	(*del_mpath)(struct wiphy *wiphy, struct net_device *dev,
38753b3a0162SJohannes Berg 			       const u8 *dst);
38762ec600d6SLuis Carlos Cobo 	int	(*change_mpath)(struct wiphy *wiphy, struct net_device *dev,
38773b3a0162SJohannes Berg 				  const u8 *dst, const u8 *next_hop);
38782ec600d6SLuis Carlos Cobo 	int	(*get_mpath)(struct wiphy *wiphy, struct net_device *dev,
38793b3a0162SJohannes Berg 			     u8 *dst, u8 *next_hop, struct mpath_info *pinfo);
38802ec600d6SLuis Carlos Cobo 	int	(*dump_mpath)(struct wiphy *wiphy, struct net_device *dev,
38812ec600d6SLuis Carlos Cobo 			      int idx, u8 *dst, u8 *next_hop,
38822ec600d6SLuis Carlos Cobo 			      struct mpath_info *pinfo);
388366be7d2bSHenning Rogge 	int	(*get_mpp)(struct wiphy *wiphy, struct net_device *dev,
388466be7d2bSHenning Rogge 			   u8 *dst, u8 *mpp, struct mpath_info *pinfo);
388566be7d2bSHenning Rogge 	int	(*dump_mpp)(struct wiphy *wiphy, struct net_device *dev,
388666be7d2bSHenning Rogge 			    int idx, u8 *dst, u8 *mpp,
388766be7d2bSHenning Rogge 			    struct mpath_info *pinfo);
388824bdd9f4SJavier Cardona 	int	(*get_mesh_config)(struct wiphy *wiphy,
388993da9cc1Scolin@cozybit.com 				struct net_device *dev,
389093da9cc1Scolin@cozybit.com 				struct mesh_config *conf);
389124bdd9f4SJavier Cardona 	int	(*update_mesh_config)(struct wiphy *wiphy,
389229cbe68cSJohannes Berg 				      struct net_device *dev, u32 mask,
389329cbe68cSJohannes Berg 				      const struct mesh_config *nconf);
389429cbe68cSJohannes Berg 	int	(*join_mesh)(struct wiphy *wiphy, struct net_device *dev,
389529cbe68cSJohannes Berg 			     const struct mesh_config *conf,
389629cbe68cSJohannes Berg 			     const struct mesh_setup *setup);
389729cbe68cSJohannes Berg 	int	(*leave_mesh)(struct wiphy *wiphy, struct net_device *dev);
389829cbe68cSJohannes Berg 
38996e0bd6c3SRostislav Lisovy 	int	(*join_ocb)(struct wiphy *wiphy, struct net_device *dev,
39006e0bd6c3SRostislav Lisovy 			    struct ocb_setup *setup);
39016e0bd6c3SRostislav Lisovy 	int	(*leave_ocb)(struct wiphy *wiphy, struct net_device *dev);
39026e0bd6c3SRostislav Lisovy 
39039f1ba906SJouni Malinen 	int	(*change_bss)(struct wiphy *wiphy, struct net_device *dev,
39049f1ba906SJouni Malinen 			      struct bss_parameters *params);
390531888487SJouni Malinen 
3906f70f01c2SEliad Peller 	int	(*set_txq_params)(struct wiphy *wiphy, struct net_device *dev,
390731888487SJouni Malinen 				  struct ieee80211_txq_params *params);
390872bdcf34SJouni Malinen 
3909e8c9bd5bSJohannes Berg 	int	(*libertas_set_mesh_channel)(struct wiphy *wiphy,
3910e8c9bd5bSJohannes Berg 					     struct net_device *dev,
3911e8c9bd5bSJohannes Berg 					     struct ieee80211_channel *chan);
3912e8c9bd5bSJohannes Berg 
3913e8c9bd5bSJohannes Berg 	int	(*set_monitor_channel)(struct wiphy *wiphy,
3914683b6d3bSJohannes Berg 				       struct cfg80211_chan_def *chandef);
39159aed3cc1SJouni Malinen 
3916fd014284SJohannes Berg 	int	(*scan)(struct wiphy *wiphy,
39172a519311SJohannes Berg 			struct cfg80211_scan_request *request);
391891d3ab46SVidyullatha Kanchanapally 	void	(*abort_scan)(struct wiphy *wiphy, struct wireless_dev *wdev);
3919636a5d36SJouni Malinen 
3920636a5d36SJouni Malinen 	int	(*auth)(struct wiphy *wiphy, struct net_device *dev,
3921636a5d36SJouni Malinen 			struct cfg80211_auth_request *req);
3922636a5d36SJouni Malinen 	int	(*assoc)(struct wiphy *wiphy, struct net_device *dev,
3923636a5d36SJouni Malinen 			 struct cfg80211_assoc_request *req);
3924636a5d36SJouni Malinen 	int	(*deauth)(struct wiphy *wiphy, struct net_device *dev,
392563c9c5e7SJohannes Berg 			  struct cfg80211_deauth_request *req);
3926636a5d36SJouni Malinen 	int	(*disassoc)(struct wiphy *wiphy, struct net_device *dev,
392763c9c5e7SJohannes Berg 			    struct cfg80211_disassoc_request *req);
392804a773adSJohannes Berg 
3929b23aa676SSamuel Ortiz 	int	(*connect)(struct wiphy *wiphy, struct net_device *dev,
3930b23aa676SSamuel Ortiz 			   struct cfg80211_connect_params *sme);
3931088e8df8Svamsi krishna 	int	(*update_connect_params)(struct wiphy *wiphy,
3932088e8df8Svamsi krishna 					 struct net_device *dev,
3933088e8df8Svamsi krishna 					 struct cfg80211_connect_params *sme,
3934088e8df8Svamsi krishna 					 u32 changed);
3935b23aa676SSamuel Ortiz 	int	(*disconnect)(struct wiphy *wiphy, struct net_device *dev,
3936b23aa676SSamuel Ortiz 			      u16 reason_code);
3937b23aa676SSamuel Ortiz 
393804a773adSJohannes Berg 	int	(*join_ibss)(struct wiphy *wiphy, struct net_device *dev,
393904a773adSJohannes Berg 			     struct cfg80211_ibss_params *params);
394004a773adSJohannes Berg 	int	(*leave_ibss)(struct wiphy *wiphy, struct net_device *dev);
3941b9a5f8caSJouni Malinen 
3942f4e583c8SAntonio Quartulli 	int	(*set_mcast_rate)(struct wiphy *wiphy, struct net_device *dev,
394357fbcce3SJohannes Berg 				  int rate[NUM_NL80211_BANDS]);
3944f4e583c8SAntonio Quartulli 
3945b9a5f8caSJouni Malinen 	int	(*set_wiphy_params)(struct wiphy *wiphy, u32 changed);
39467643a2c3SJohannes Berg 
3947c8442118SJohannes Berg 	int	(*set_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
3948fa61cf70SJuuso Oikarinen 				enum nl80211_tx_power_setting type, int mbm);
3949c8442118SJohannes Berg 	int	(*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
3950c8442118SJohannes Berg 				int *dbm);
39511f87f7d3SJohannes Berg 
3952ab737a4fSJohannes Berg 	int	(*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev,
3953388ac775SJohannes Berg 				const u8 *addr);
3954ab737a4fSJohannes Berg 
39551f87f7d3SJohannes Berg 	void	(*rfkill_poll)(struct wiphy *wiphy);
3956aff89a9bSJohannes Berg 
3957aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE
3958fc73f11fSDavid Spinadel 	int	(*testmode_cmd)(struct wiphy *wiphy, struct wireless_dev *wdev,
3959fc73f11fSDavid Spinadel 				void *data, int len);
396071063f0eSWey-Yi Guy 	int	(*testmode_dump)(struct wiphy *wiphy, struct sk_buff *skb,
396171063f0eSWey-Yi Guy 				 struct netlink_callback *cb,
396271063f0eSWey-Yi Guy 				 void *data, int len);
3963aff89a9bSJohannes Berg #endif
3964bc92afd9SJohannes Berg 
39659930380fSJohannes Berg 	int	(*set_bitrate_mask)(struct wiphy *wiphy,
39669930380fSJohannes Berg 				    struct net_device *dev,
39679930380fSJohannes Berg 				    const u8 *peer,
39689930380fSJohannes Berg 				    const struct cfg80211_bitrate_mask *mask);
39699930380fSJohannes Berg 
397061fa713cSHolger Schurig 	int	(*dump_survey)(struct wiphy *wiphy, struct net_device *netdev,
397161fa713cSHolger Schurig 			int idx, struct survey_info *info);
397261fa713cSHolger Schurig 
397367fbb16bSSamuel Ortiz 	int	(*set_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
397467fbb16bSSamuel Ortiz 			     struct cfg80211_pmksa *pmksa);
397567fbb16bSSamuel Ortiz 	int	(*del_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
397667fbb16bSSamuel Ortiz 			     struct cfg80211_pmksa *pmksa);
397767fbb16bSSamuel Ortiz 	int	(*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev);
397867fbb16bSSamuel Ortiz 
39799588bbd5SJouni Malinen 	int	(*remain_on_channel)(struct wiphy *wiphy,
398071bbc994SJohannes Berg 				     struct wireless_dev *wdev,
39819588bbd5SJouni Malinen 				     struct ieee80211_channel *chan,
39829588bbd5SJouni Malinen 				     unsigned int duration,
39839588bbd5SJouni Malinen 				     u64 *cookie);
39849588bbd5SJouni Malinen 	int	(*cancel_remain_on_channel)(struct wiphy *wiphy,
398571bbc994SJohannes Berg 					    struct wireless_dev *wdev,
39869588bbd5SJouni Malinen 					    u64 cookie);
39879588bbd5SJouni Malinen 
398871bbc994SJohannes Berg 	int	(*mgmt_tx)(struct wiphy *wiphy, struct wireless_dev *wdev,
3989b176e629SAndrei Otcheretianski 			   struct cfg80211_mgmt_tx_params *params,
3990b176e629SAndrei Otcheretianski 			   u64 *cookie);
3991f7ca38dfSJohannes Berg 	int	(*mgmt_tx_cancel_wait)(struct wiphy *wiphy,
399271bbc994SJohannes Berg 				       struct wireless_dev *wdev,
3993f7ca38dfSJohannes Berg 				       u64 cookie);
3994026331c4SJouni Malinen 
3995bc92afd9SJohannes Berg 	int	(*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev,
3996bc92afd9SJohannes Berg 				  bool enabled, int timeout);
3997d6dc1a38SJuuso Oikarinen 
3998d6dc1a38SJuuso Oikarinen 	int	(*set_cqm_rssi_config)(struct wiphy *wiphy,
3999d6dc1a38SJuuso Oikarinen 				       struct net_device *dev,
4000d6dc1a38SJuuso Oikarinen 				       s32 rssi_thold, u32 rssi_hyst);
4001271733cfSJohannes Berg 
40024a4b8169SAndrew Zaborowski 	int	(*set_cqm_rssi_range_config)(struct wiphy *wiphy,
40034a4b8169SAndrew Zaborowski 					     struct net_device *dev,
40044a4b8169SAndrew Zaborowski 					     s32 rssi_low, s32 rssi_high);
40054a4b8169SAndrew Zaborowski 
400684f10708SThomas Pedersen 	int	(*set_cqm_txe_config)(struct wiphy *wiphy,
400784f10708SThomas Pedersen 				      struct net_device *dev,
400884f10708SThomas Pedersen 				      u32 rate, u32 pkts, u32 intvl);
400984f10708SThomas Pedersen 
40106cd536feSJohannes Berg 	void	(*update_mgmt_frame_registrations)(struct wiphy *wiphy,
401171bbc994SJohannes Berg 						   struct wireless_dev *wdev,
40126cd536feSJohannes Berg 						   struct mgmt_frame_regs *upd);
4013afe0cbf8SBruno Randolf 
4014afe0cbf8SBruno Randolf 	int	(*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant);
4015afe0cbf8SBruno Randolf 	int	(*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant);
40163677713bSJohn W. Linville 
4017807f8a8cSLuciano Coelho 	int	(*sched_scan_start)(struct wiphy *wiphy,
4018807f8a8cSLuciano Coelho 				struct net_device *dev,
4019807f8a8cSLuciano Coelho 				struct cfg80211_sched_scan_request *request);
40203a3ecf1dSArend Van Spriel 	int	(*sched_scan_stop)(struct wiphy *wiphy, struct net_device *dev,
40213a3ecf1dSArend Van Spriel 				   u64 reqid);
4022e5497d76SJohannes Berg 
4023e5497d76SJohannes Berg 	int	(*set_rekey_data)(struct wiphy *wiphy, struct net_device *dev,
4024e5497d76SJohannes Berg 				  struct cfg80211_gtk_rekey_data *data);
4025109086ceSArik Nemtsov 
4026109086ceSArik Nemtsov 	int	(*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev,
40273b3a0162SJohannes Berg 			     const u8 *peer, u8 action_code,  u8 dialog_token,
4028df942e7bSSunil Dutt Undekari 			     u16 status_code, u32 peer_capability,
402931fa97c5SArik Nemtsov 			     bool initiator, const u8 *buf, size_t len);
4030109086ceSArik Nemtsov 	int	(*tdls_oper)(struct wiphy *wiphy, struct net_device *dev,
40313b3a0162SJohannes Berg 			     const u8 *peer, enum nl80211_tdls_operation oper);
40327f6cf311SJohannes Berg 
40337f6cf311SJohannes Berg 	int	(*probe_client)(struct wiphy *wiphy, struct net_device *dev,
40347f6cf311SJohannes Berg 				const u8 *peer, u64 *cookie);
4035e999882aSJohannes Berg 
40361d9d9213SSimon Wunderlich 	int	(*set_noack_map)(struct wiphy *wiphy,
40371d9d9213SSimon Wunderlich 				  struct net_device *dev,
40381d9d9213SSimon Wunderlich 				  u16 noack_map);
40391d9d9213SSimon Wunderlich 
4040683b6d3bSJohannes Berg 	int	(*get_channel)(struct wiphy *wiphy,
40415b7ccaf3SJohannes Berg 			       struct wireless_dev *wdev,
4042683b6d3bSJohannes Berg 			       struct cfg80211_chan_def *chandef);
404398104fdeSJohannes Berg 
404498104fdeSJohannes Berg 	int	(*start_p2p_device)(struct wiphy *wiphy,
404598104fdeSJohannes Berg 				    struct wireless_dev *wdev);
404698104fdeSJohannes Berg 	void	(*stop_p2p_device)(struct wiphy *wiphy,
404798104fdeSJohannes Berg 				   struct wireless_dev *wdev);
404877765eafSVasanthakumar Thiagarajan 
404977765eafSVasanthakumar Thiagarajan 	int	(*set_mac_acl)(struct wiphy *wiphy, struct net_device *dev,
405077765eafSVasanthakumar Thiagarajan 			       const struct cfg80211_acl_data *params);
405104f39047SSimon Wunderlich 
405204f39047SSimon Wunderlich 	int	(*start_radar_detection)(struct wiphy *wiphy,
405304f39047SSimon Wunderlich 					 struct net_device *dev,
405431559f35SJanusz Dziedzic 					 struct cfg80211_chan_def *chandef,
405531559f35SJanusz Dziedzic 					 u32 cac_time_ms);
405626ec17a1SOrr Mazor 	void	(*end_cac)(struct wiphy *wiphy,
405726ec17a1SOrr Mazor 				struct net_device *dev);
4058355199e0SJouni Malinen 	int	(*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev,
4059355199e0SJouni Malinen 				 struct cfg80211_update_ft_ies_params *ftie);
40605de17984SArend van Spriel 	int	(*crit_proto_start)(struct wiphy *wiphy,
40615de17984SArend van Spriel 				    struct wireless_dev *wdev,
40625de17984SArend van Spriel 				    enum nl80211_crit_proto_id protocol,
40635de17984SArend van Spriel 				    u16 duration);
40645de17984SArend van Spriel 	void	(*crit_proto_stop)(struct wiphy *wiphy,
40655de17984SArend van Spriel 				   struct wireless_dev *wdev);
4066be29b99aSAmitkumar Karwar 	int	(*set_coalesce)(struct wiphy *wiphy,
4067be29b99aSAmitkumar Karwar 				struct cfg80211_coalesce *coalesce);
406816ef1fe2SSimon Wunderlich 
406916ef1fe2SSimon Wunderlich 	int	(*channel_switch)(struct wiphy *wiphy,
407016ef1fe2SSimon Wunderlich 				  struct net_device *dev,
407116ef1fe2SSimon Wunderlich 				  struct cfg80211_csa_settings *params);
4072e16821bcSJouni Malinen 
4073fa9ffc74SKyeyoon Park 	int     (*set_qos_map)(struct wiphy *wiphy,
4074fa9ffc74SKyeyoon Park 			       struct net_device *dev,
4075fa9ffc74SKyeyoon Park 			       struct cfg80211_qos_map *qos_map);
4076e16821bcSJouni Malinen 
4077e16821bcSJouni Malinen 	int	(*set_ap_chanwidth)(struct wiphy *wiphy, struct net_device *dev,
4078e16821bcSJouni Malinen 				    struct cfg80211_chan_def *chandef);
4079960d01acSJohannes Berg 
4080960d01acSJohannes Berg 	int	(*add_tx_ts)(struct wiphy *wiphy, struct net_device *dev,
4081960d01acSJohannes Berg 			     u8 tsid, const u8 *peer, u8 user_prio,
4082960d01acSJohannes Berg 			     u16 admitted_time);
4083960d01acSJohannes Berg 	int	(*del_tx_ts)(struct wiphy *wiphy, struct net_device *dev,
4084960d01acSJohannes Berg 			     u8 tsid, const u8 *peer);
40851057d35eSArik Nemtsov 
40861057d35eSArik Nemtsov 	int	(*tdls_channel_switch)(struct wiphy *wiphy,
40871057d35eSArik Nemtsov 				       struct net_device *dev,
40881057d35eSArik Nemtsov 				       const u8 *addr, u8 oper_class,
40891057d35eSArik Nemtsov 				       struct cfg80211_chan_def *chandef);
40901057d35eSArik Nemtsov 	void	(*tdls_cancel_channel_switch)(struct wiphy *wiphy,
40911057d35eSArik Nemtsov 					      struct net_device *dev,
40921057d35eSArik Nemtsov 					      const u8 *addr);
4093cb3b7d87SAyala Beker 	int	(*start_nan)(struct wiphy *wiphy, struct wireless_dev *wdev,
4094cb3b7d87SAyala Beker 			     struct cfg80211_nan_conf *conf);
4095cb3b7d87SAyala Beker 	void	(*stop_nan)(struct wiphy *wiphy, struct wireless_dev *wdev);
4096a442b761SAyala Beker 	int	(*add_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev,
4097a442b761SAyala Beker 				struct cfg80211_nan_func *nan_func);
4098a442b761SAyala Beker 	void	(*del_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev,
4099a442b761SAyala Beker 			       u64 cookie);
4100a5a9dcf2SAyala Beker 	int	(*nan_change_conf)(struct wiphy *wiphy,
4101a5a9dcf2SAyala Beker 				   struct wireless_dev *wdev,
4102a5a9dcf2SAyala Beker 				   struct cfg80211_nan_conf *conf,
4103a5a9dcf2SAyala Beker 				   u32 changes);
4104ce0ce13aSMichael Braun 
4105ce0ce13aSMichael Braun 	int	(*set_multicast_to_unicast)(struct wiphy *wiphy,
4106ce0ce13aSMichael Braun 					    struct net_device *dev,
4107ce0ce13aSMichael Braun 					    const bool enabled);
41083a00df57SAvraham Stern 
410952539ca8SToke Høiland-Jørgensen 	int	(*get_txq_stats)(struct wiphy *wiphy,
411052539ca8SToke Høiland-Jørgensen 				 struct wireless_dev *wdev,
411152539ca8SToke Høiland-Jørgensen 				 struct cfg80211_txq_stats *txqstats);
411252539ca8SToke Høiland-Jørgensen 
41133a00df57SAvraham Stern 	int	(*set_pmk)(struct wiphy *wiphy, struct net_device *dev,
41143a00df57SAvraham Stern 			   const struct cfg80211_pmk_conf *conf);
41153a00df57SAvraham Stern 	int	(*del_pmk)(struct wiphy *wiphy, struct net_device *dev,
41163a00df57SAvraham Stern 			   const u8 *aa);
411740cbfa90SSrinivas Dasari 	int     (*external_auth)(struct wiphy *wiphy, struct net_device *dev,
411840cbfa90SSrinivas Dasari 				 struct cfg80211_external_auth_params *params);
41192576a9acSDenis Kenzior 
41202576a9acSDenis Kenzior 	int	(*tx_control_port)(struct wiphy *wiphy,
41212576a9acSDenis Kenzior 				   struct net_device *dev,
41222576a9acSDenis Kenzior 				   const u8 *buf, size_t len,
41238d74a623SJohannes Berg 				   const u8 *dest, const __be16 proto,
4124dca9ca2dSMarkus Theil 				   const bool noencrypt,
4125dca9ca2dSMarkus Theil 				   u64 *cookie);
412681e54d08SPradeep Kumar Chitrapu 
412781e54d08SPradeep Kumar Chitrapu 	int	(*get_ftm_responder_stats)(struct wiphy *wiphy,
412881e54d08SPradeep Kumar Chitrapu 				struct net_device *dev,
412981e54d08SPradeep Kumar Chitrapu 				struct cfg80211_ftm_responder_stats *ftm_stats);
41309bb7e0f2SJohannes Berg 
41319bb7e0f2SJohannes Berg 	int	(*start_pmsr)(struct wiphy *wiphy, struct wireless_dev *wdev,
41329bb7e0f2SJohannes Berg 			      struct cfg80211_pmsr_request *request);
41339bb7e0f2SJohannes Berg 	void	(*abort_pmsr)(struct wiphy *wiphy, struct wireless_dev *wdev,
41349bb7e0f2SJohannes Berg 			      struct cfg80211_pmsr_request *request);
4135cb74e977SSunil Dutt 	int	(*update_owe_info)(struct wiphy *wiphy, struct net_device *dev,
4136cb74e977SSunil Dutt 				   struct cfg80211_update_owe_info *owe_info);
41375ab92e7fSRajkumar Manoharan 	int	(*probe_mesh_link)(struct wiphy *wiphy, struct net_device *dev,
41385ab92e7fSRajkumar Manoharan 				   const u8 *buf, size_t len);
413977f576deSTamizh chelvam 	int     (*set_tid_config)(struct wiphy *wiphy, struct net_device *dev,
41403710a8a6SJohannes Berg 				  struct cfg80211_tid_config *tid_conf);
414177f576deSTamizh chelvam 	int	(*reset_tid_config)(struct wiphy *wiphy, struct net_device *dev,
41423710a8a6SJohannes Berg 				    const u8 *peer, u8 tids);
4143704232c2SJohannes Berg };
4144704232c2SJohannes Berg 
4145d3236553SJohannes Berg /*
4146d3236553SJohannes Berg  * wireless hardware and networking interfaces structures
4147d3236553SJohannes Berg  * and registration/helper functions
4148d3236553SJohannes Berg  */
4149d3236553SJohannes Berg 
4150d3236553SJohannes Berg /**
41515be83de5SJohannes Berg  * enum wiphy_flags - wiphy capability flags
41525be83de5SJohannes Berg  *
41535be83de5SJohannes Berg  * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this
41545be83de5SJohannes Berg  *	wiphy at all
41555be83de5SJohannes Berg  * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled
41565be83de5SJohannes Berg  *	by default -- this flag will be set depending on the kernel's default
41575be83de5SJohannes Berg  *	on wiphy_new(), but can be changed by the driver if it has a good
41585be83de5SJohannes Berg  *	reason to override the default
41599bc383deSJohannes Berg  * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station
416033d915d9SManikanta Pubbisetty  *	on a VLAN interface). This flag also serves an extra purpose of
416133d915d9SManikanta Pubbisetty  *	supporting 4ADDR AP mode on devices which do not support AP/VLAN iftype.
41629bc383deSJohannes Berg  * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station
4163c0692b8fSJohannes Berg  * @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the
4164c0692b8fSJohannes Berg  *	control port protocol ethertype. The device also honours the
4165c0692b8fSJohannes Berg  *	control_port_no_encrypt flag.
4166e31b8213SJohannes Berg  * @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN.
416715d5dda6SJavier Cardona  * @WIPHY_FLAG_MESH_AUTH: The device supports mesh authentication by routing
416815d5dda6SJavier Cardona  *	auth frames to userspace. See @NL80211_MESH_SETUP_USERSPACE_AUTH.
4169f4b34b55SVivek Natarajan  * @WIPHY_FLAG_SUPPORTS_FW_ROAM: The device supports roaming feature in the
4170f4b34b55SVivek Natarajan  *	firmware.
4171cedb5412SEliad Peller  * @WIPHY_FLAG_AP_UAPSD: The device supports uapsd on AP.
4172109086ceSArik Nemtsov  * @WIPHY_FLAG_SUPPORTS_TDLS: The device supports TDLS (802.11z) operation.
4173109086ceSArik Nemtsov  * @WIPHY_FLAG_TDLS_EXTERNAL_SETUP: The device does not handle TDLS (802.11z)
4174109086ceSArik Nemtsov  *	link setup/discovery operations internally. Setup, discovery and
4175109086ceSArik Nemtsov  *	teardown packets should be sent through the @NL80211_CMD_TDLS_MGMT
4176109086ceSArik Nemtsov  *	command. When this flag is not set, @NL80211_CMD_TDLS_OPER should be
4177109086ceSArik Nemtsov  *	used for asking the driver/firmware to perform a TDLS operation.
4178562a7480SJohannes Berg  * @WIPHY_FLAG_HAVE_AP_SME: device integrates AP SME
41795e760230SJohannes Berg  * @WIPHY_FLAG_REPORTS_OBSS: the device will report beacons from other BSSes
41805e760230SJohannes Berg  *	when there are virtual interfaces in AP mode by calling
41815e760230SJohannes Berg  *	cfg80211_report_obss_beacon().
418287bbbe22SArik Nemtsov  * @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD: When operating as an AP, the device
418387bbbe22SArik Nemtsov  *	responds to probe-requests in hardware.
41847c4ef712SJohannes Berg  * @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX.
41857c4ef712SJohannes Berg  * @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call.
41862f301ab2SSimon Wunderlich  * @WIPHY_FLAG_SUPPORTS_5_10_MHZ: Device supports 5 MHz and 10 MHz channels.
418716ef1fe2SSimon Wunderlich  * @WIPHY_FLAG_HAS_CHANNEL_SWITCH: Device supports channel switch in
418816ef1fe2SSimon Wunderlich  *	beaconing mode (AP, IBSS, Mesh, ...).
4189b8676221SDavid Spinadel  * @WIPHY_FLAG_HAS_STATIC_WEP: The device supports static WEP key installation
4190b8676221SDavid Spinadel  *	before connection.
4191093a48d2SNathan Errera  * @WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK: The device supports bigger kek and kck keys
41925be83de5SJohannes Berg  */
41935be83de5SJohannes Berg enum wiphy_flags {
4194093a48d2SNathan Errera 	WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK		= BIT(0),
4195a2f73b6cSLuis R. Rodriguez 	/* use hole at 1 */
4196a2f73b6cSLuis R. Rodriguez 	/* use hole at 2 */
41975be83de5SJohannes Berg 	WIPHY_FLAG_NETNS_OK			= BIT(3),
41985be83de5SJohannes Berg 	WIPHY_FLAG_PS_ON_BY_DEFAULT		= BIT(4),
41999bc383deSJohannes Berg 	WIPHY_FLAG_4ADDR_AP			= BIT(5),
42009bc383deSJohannes Berg 	WIPHY_FLAG_4ADDR_STATION		= BIT(6),
4201c0692b8fSJohannes Berg 	WIPHY_FLAG_CONTROL_PORT_PROTOCOL	= BIT(7),
4202309075cfSJussi Kivilinna 	WIPHY_FLAG_IBSS_RSN			= BIT(8),
420315d5dda6SJavier Cardona 	WIPHY_FLAG_MESH_AUTH			= BIT(10),
4204ca986ad9SArend Van Spriel 	/* use hole at 11 */
42058e8b41f9SJohannes Berg 	/* use hole at 12 */
4206f4b34b55SVivek Natarajan 	WIPHY_FLAG_SUPPORTS_FW_ROAM		= BIT(13),
4207cedb5412SEliad Peller 	WIPHY_FLAG_AP_UAPSD			= BIT(14),
4208109086ceSArik Nemtsov 	WIPHY_FLAG_SUPPORTS_TDLS		= BIT(15),
4209109086ceSArik Nemtsov 	WIPHY_FLAG_TDLS_EXTERNAL_SETUP		= BIT(16),
4210562a7480SJohannes Berg 	WIPHY_FLAG_HAVE_AP_SME			= BIT(17),
42115e760230SJohannes Berg 	WIPHY_FLAG_REPORTS_OBSS			= BIT(18),
421287bbbe22SArik Nemtsov 	WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD	= BIT(19),
42137c4ef712SJohannes Berg 	WIPHY_FLAG_OFFCHAN_TX			= BIT(20),
42147c4ef712SJohannes Berg 	WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL	= BIT(21),
42152f301ab2SSimon Wunderlich 	WIPHY_FLAG_SUPPORTS_5_10_MHZ		= BIT(22),
421616ef1fe2SSimon Wunderlich 	WIPHY_FLAG_HAS_CHANNEL_SWITCH		= BIT(23),
4217b8676221SDavid Spinadel 	WIPHY_FLAG_HAS_STATIC_WEP		= BIT(24),
42187527a782SJohannes Berg };
42197527a782SJohannes Berg 
42207527a782SJohannes Berg /**
42217527a782SJohannes Berg  * struct ieee80211_iface_limit - limit on certain interface types
42227527a782SJohannes Berg  * @max: maximum number of interfaces of these types
42237527a782SJohannes Berg  * @types: interface types (bits)
42247527a782SJohannes Berg  */
42257527a782SJohannes Berg struct ieee80211_iface_limit {
42267527a782SJohannes Berg 	u16 max;
42277527a782SJohannes Berg 	u16 types;
42287527a782SJohannes Berg };
42297527a782SJohannes Berg 
42307527a782SJohannes Berg /**
42317527a782SJohannes Berg  * struct ieee80211_iface_combination - possible interface combination
42327527a782SJohannes Berg  *
4233b80edbc1SLuciano Coelho  * With this structure the driver can describe which interface
4234b80edbc1SLuciano Coelho  * combinations it supports concurrently.
42357527a782SJohannes Berg  *
4236b80edbc1SLuciano Coelho  * Examples:
4237b80edbc1SLuciano Coelho  *
4238b80edbc1SLuciano Coelho  * 1. Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total:
42397527a782SJohannes Berg  *
4240819bf593SJohannes Berg  *    .. code-block:: c
4241819bf593SJohannes Berg  *
42427527a782SJohannes Berg  *	struct ieee80211_iface_limit limits1[] = {
42437527a782SJohannes Berg  *		{ .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
42447527a782SJohannes Berg  *		{ .max = 1, .types = BIT(NL80211_IFTYPE_AP}, },
42457527a782SJohannes Berg  *	};
42467527a782SJohannes Berg  *	struct ieee80211_iface_combination combination1 = {
42477527a782SJohannes Berg  *		.limits = limits1,
42487527a782SJohannes Berg  *		.n_limits = ARRAY_SIZE(limits1),
42497527a782SJohannes Berg  *		.max_interfaces = 2,
42507527a782SJohannes Berg  *		.beacon_int_infra_match = true,
42517527a782SJohannes Berg  *	};
42527527a782SJohannes Berg  *
42537527a782SJohannes Berg  *
4254b80edbc1SLuciano Coelho  * 2. Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total:
42557527a782SJohannes Berg  *
4256819bf593SJohannes Berg  *    .. code-block:: c
4257819bf593SJohannes Berg  *
42587527a782SJohannes Berg  *	struct ieee80211_iface_limit limits2[] = {
42597527a782SJohannes Berg  *		{ .max = 8, .types = BIT(NL80211_IFTYPE_AP) |
42607527a782SJohannes Berg  *				     BIT(NL80211_IFTYPE_P2P_GO), },
42617527a782SJohannes Berg  *	};
42627527a782SJohannes Berg  *	struct ieee80211_iface_combination combination2 = {
42637527a782SJohannes Berg  *		.limits = limits2,
42647527a782SJohannes Berg  *		.n_limits = ARRAY_SIZE(limits2),
42657527a782SJohannes Berg  *		.max_interfaces = 8,
42667527a782SJohannes Berg  *		.num_different_channels = 1,
42677527a782SJohannes Berg  *	};
42687527a782SJohannes Berg  *
42697527a782SJohannes Berg  *
4270b80edbc1SLuciano Coelho  * 3. Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total.
4271b80edbc1SLuciano Coelho  *
42727527a782SJohannes Berg  *    This allows for an infrastructure connection and three P2P connections.
42737527a782SJohannes Berg  *
4274819bf593SJohannes Berg  *    .. code-block:: c
4275819bf593SJohannes Berg  *
42767527a782SJohannes Berg  *	struct ieee80211_iface_limit limits3[] = {
42777527a782SJohannes Berg  *		{ .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
42787527a782SJohannes Berg  *		{ .max = 3, .types = BIT(NL80211_IFTYPE_P2P_GO) |
42797527a782SJohannes Berg  *				     BIT(NL80211_IFTYPE_P2P_CLIENT), },
42807527a782SJohannes Berg  *	};
42817527a782SJohannes Berg  *	struct ieee80211_iface_combination combination3 = {
42827527a782SJohannes Berg  *		.limits = limits3,
42837527a782SJohannes Berg  *		.n_limits = ARRAY_SIZE(limits3),
42847527a782SJohannes Berg  *		.max_interfaces = 4,
42857527a782SJohannes Berg  *		.num_different_channels = 2,
42867527a782SJohannes Berg  *	};
4287819bf593SJohannes Berg  *
42887527a782SJohannes Berg  */
42897527a782SJohannes Berg struct ieee80211_iface_combination {
4290c6c94aeaSJohannes Berg 	/**
4291c6c94aeaSJohannes Berg 	 * @limits:
4292c6c94aeaSJohannes Berg 	 * limits for the given interface types
4293c6c94aeaSJohannes Berg 	 */
42947527a782SJohannes Berg 	const struct ieee80211_iface_limit *limits;
4295c6c94aeaSJohannes Berg 
4296c6c94aeaSJohannes Berg 	/**
4297c6c94aeaSJohannes Berg 	 * @num_different_channels:
4298c6c94aeaSJohannes Berg 	 * can use up to this many different channels
4299c6c94aeaSJohannes Berg 	 */
43007527a782SJohannes Berg 	u32 num_different_channels;
4301c6c94aeaSJohannes Berg 
4302c6c94aeaSJohannes Berg 	/**
4303c6c94aeaSJohannes Berg 	 * @max_interfaces:
4304c6c94aeaSJohannes Berg 	 * maximum number of interfaces in total allowed in this group
4305c6c94aeaSJohannes Berg 	 */
43067527a782SJohannes Berg 	u16 max_interfaces;
4307c6c94aeaSJohannes Berg 
4308c6c94aeaSJohannes Berg 	/**
4309c6c94aeaSJohannes Berg 	 * @n_limits:
4310c6c94aeaSJohannes Berg 	 * number of limitations
4311c6c94aeaSJohannes Berg 	 */
43127527a782SJohannes Berg 	u8 n_limits;
4313c6c94aeaSJohannes Berg 
4314c6c94aeaSJohannes Berg 	/**
4315c6c94aeaSJohannes Berg 	 * @beacon_int_infra_match:
4316c6c94aeaSJohannes Berg 	 * In this combination, the beacon intervals between infrastructure
4317c6c94aeaSJohannes Berg 	 * and AP types must match. This is required only in special cases.
4318c6c94aeaSJohannes Berg 	 */
43197527a782SJohannes Berg 	bool beacon_int_infra_match;
4320c6c94aeaSJohannes Berg 
4321c6c94aeaSJohannes Berg 	/**
4322c6c94aeaSJohannes Berg 	 * @radar_detect_widths:
4323c6c94aeaSJohannes Berg 	 * bitmap of channel widths supported for radar detection
4324c6c94aeaSJohannes Berg 	 */
432511c4a075SSimon Wunderlich 	u8 radar_detect_widths;
4326c6c94aeaSJohannes Berg 
4327c6c94aeaSJohannes Berg 	/**
4328c6c94aeaSJohannes Berg 	 * @radar_detect_regions:
4329c6c94aeaSJohannes Berg 	 * bitmap of regions supported for radar detection
4330c6c94aeaSJohannes Berg 	 */
43318c48b50aSFelix Fietkau 	u8 radar_detect_regions;
4332c6c94aeaSJohannes Berg 
4333c6c94aeaSJohannes Berg 	/**
4334c6c94aeaSJohannes Berg 	 * @beacon_int_min_gcd:
4335c6c94aeaSJohannes Berg 	 * This interface combination supports different beacon intervals.
4336c6c94aeaSJohannes Berg 	 *
4337c6c94aeaSJohannes Berg 	 * = 0
4338c6c94aeaSJohannes Berg 	 *   all beacon intervals for different interface must be same.
4339c6c94aeaSJohannes Berg 	 * > 0
4340c6c94aeaSJohannes Berg 	 *   any beacon interval for the interface part of this combination AND
4341c6c94aeaSJohannes Berg 	 *   GCD of all beacon intervals from beaconing interfaces of this
4342c6c94aeaSJohannes Berg 	 *   combination must be greater or equal to this value.
4343c6c94aeaSJohannes Berg 	 */
43440c317a02SPurushottam Kushwaha 	u32 beacon_int_min_gcd;
43455be83de5SJohannes Berg };
43465be83de5SJohannes Berg 
43472e161f78SJohannes Berg struct ieee80211_txrx_stypes {
43482e161f78SJohannes Berg 	u16 tx, rx;
43492e161f78SJohannes Berg };
43502e161f78SJohannes Berg 
43515be83de5SJohannes Berg /**
4352ff1b6e69SJohannes Berg  * enum wiphy_wowlan_support_flags - WoWLAN support flags
4353ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_ANY: supports wakeup for the special "any"
4354ff1b6e69SJohannes Berg  *	trigger that keeps the device operating as-is and
4355ff1b6e69SJohannes Berg  *	wakes up the host on any activity, for example a
4356ff1b6e69SJohannes Berg  *	received packet that passed filtering; note that the
4357ff1b6e69SJohannes Berg  *	packet should be preserved in that case
4358ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_MAGIC_PKT: supports wakeup on magic packet
4359ff1b6e69SJohannes Berg  *	(see nl80211.h)
4360ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_DISCONNECT: supports wakeup on disconnect
436177dbbb13SJohannes Berg  * @WIPHY_WOWLAN_SUPPORTS_GTK_REKEY: supports GTK rekeying while asleep
436277dbbb13SJohannes Berg  * @WIPHY_WOWLAN_GTK_REKEY_FAILURE: supports wakeup on GTK rekey failure
436377dbbb13SJohannes Berg  * @WIPHY_WOWLAN_EAP_IDENTITY_REQ: supports wakeup on EAP identity request
436477dbbb13SJohannes Berg  * @WIPHY_WOWLAN_4WAY_HANDSHAKE: supports wakeup on 4-way handshake failure
436577dbbb13SJohannes Berg  * @WIPHY_WOWLAN_RFKILL_RELEASE: supports wakeup on RF-kill release
43668cd4d456SLuciano Coelho  * @WIPHY_WOWLAN_NET_DETECT: supports wakeup on network detection
4367ff1b6e69SJohannes Berg  */
4368ff1b6e69SJohannes Berg enum wiphy_wowlan_support_flags {
4369ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_ANY		= BIT(0),
4370ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_MAGIC_PKT		= BIT(1),
4371ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_DISCONNECT		= BIT(2),
437277dbbb13SJohannes Berg 	WIPHY_WOWLAN_SUPPORTS_GTK_REKEY	= BIT(3),
437377dbbb13SJohannes Berg 	WIPHY_WOWLAN_GTK_REKEY_FAILURE	= BIT(4),
437477dbbb13SJohannes Berg 	WIPHY_WOWLAN_EAP_IDENTITY_REQ	= BIT(5),
437577dbbb13SJohannes Berg 	WIPHY_WOWLAN_4WAY_HANDSHAKE	= BIT(6),
437677dbbb13SJohannes Berg 	WIPHY_WOWLAN_RFKILL_RELEASE	= BIT(7),
43778cd4d456SLuciano Coelho 	WIPHY_WOWLAN_NET_DETECT		= BIT(8),
4378ff1b6e69SJohannes Berg };
4379ff1b6e69SJohannes Berg 
43802a0e047eSJohannes Berg struct wiphy_wowlan_tcp_support {
43812a0e047eSJohannes Berg 	const struct nl80211_wowlan_tcp_data_token_feature *tok;
43822a0e047eSJohannes Berg 	u32 data_payload_max;
43832a0e047eSJohannes Berg 	u32 data_interval_max;
43842a0e047eSJohannes Berg 	u32 wake_payload_max;
43852a0e047eSJohannes Berg 	bool seq;
43862a0e047eSJohannes Berg };
43872a0e047eSJohannes Berg 
4388ff1b6e69SJohannes Berg /**
4389ff1b6e69SJohannes Berg  * struct wiphy_wowlan_support - WoWLAN support data
4390ff1b6e69SJohannes Berg  * @flags: see &enum wiphy_wowlan_support_flags
4391ff1b6e69SJohannes Berg  * @n_patterns: number of supported wakeup patterns
4392ff1b6e69SJohannes Berg  *	(see nl80211.h for the pattern definition)
4393ff1b6e69SJohannes Berg  * @pattern_max_len: maximum length of each pattern
4394ff1b6e69SJohannes Berg  * @pattern_min_len: minimum length of each pattern
4395bb92d199SAmitkumar Karwar  * @max_pkt_offset: maximum Rx packet offset
43968cd4d456SLuciano Coelho  * @max_nd_match_sets: maximum number of matchsets for net-detect,
43978cd4d456SLuciano Coelho  *	similar, but not necessarily identical, to max_match_sets for
43988cd4d456SLuciano Coelho  *	scheduled scans.
43998cd4d456SLuciano Coelho  *	See &struct cfg80211_sched_scan_request.@match_sets for more
44008cd4d456SLuciano Coelho  *	details.
44012a0e047eSJohannes Berg  * @tcp: TCP wakeup support information
4402ff1b6e69SJohannes Berg  */
4403ff1b6e69SJohannes Berg struct wiphy_wowlan_support {
4404ff1b6e69SJohannes Berg 	u32 flags;
4405ff1b6e69SJohannes Berg 	int n_patterns;
4406ff1b6e69SJohannes Berg 	int pattern_max_len;
4407ff1b6e69SJohannes Berg 	int pattern_min_len;
4408bb92d199SAmitkumar Karwar 	int max_pkt_offset;
44098cd4d456SLuciano Coelho 	int max_nd_match_sets;
44102a0e047eSJohannes Berg 	const struct wiphy_wowlan_tcp_support *tcp;
4411ff1b6e69SJohannes Berg };
4412ff1b6e69SJohannes Berg 
4413ff1b6e69SJohannes Berg /**
4414be29b99aSAmitkumar Karwar  * struct wiphy_coalesce_support - coalesce support data
4415be29b99aSAmitkumar Karwar  * @n_rules: maximum number of coalesce rules
4416be29b99aSAmitkumar Karwar  * @max_delay: maximum supported coalescing delay in msecs
4417be29b99aSAmitkumar Karwar  * @n_patterns: number of supported patterns in a rule
4418be29b99aSAmitkumar Karwar  *	(see nl80211.h for the pattern definition)
4419be29b99aSAmitkumar Karwar  * @pattern_max_len: maximum length of each pattern
4420be29b99aSAmitkumar Karwar  * @pattern_min_len: minimum length of each pattern
4421be29b99aSAmitkumar Karwar  * @max_pkt_offset: maximum Rx packet offset
4422be29b99aSAmitkumar Karwar  */
4423be29b99aSAmitkumar Karwar struct wiphy_coalesce_support {
4424be29b99aSAmitkumar Karwar 	int n_rules;
4425be29b99aSAmitkumar Karwar 	int max_delay;
4426be29b99aSAmitkumar Karwar 	int n_patterns;
4427be29b99aSAmitkumar Karwar 	int pattern_max_len;
4428be29b99aSAmitkumar Karwar 	int pattern_min_len;
4429be29b99aSAmitkumar Karwar 	int max_pkt_offset;
4430be29b99aSAmitkumar Karwar };
4431be29b99aSAmitkumar Karwar 
4432be29b99aSAmitkumar Karwar /**
4433ad7e718cSJohannes Berg  * enum wiphy_vendor_command_flags - validation flags for vendor commands
4434ad7e718cSJohannes Berg  * @WIPHY_VENDOR_CMD_NEED_WDEV: vendor command requires wdev
4435ad7e718cSJohannes Berg  * @WIPHY_VENDOR_CMD_NEED_NETDEV: vendor command requires netdev
4436ad7e718cSJohannes Berg  * @WIPHY_VENDOR_CMD_NEED_RUNNING: interface/wdev must be up & running
4437ad7e718cSJohannes Berg  *	(must be combined with %_WDEV or %_NETDEV)
4438ad7e718cSJohannes Berg  */
4439ad7e718cSJohannes Berg enum wiphy_vendor_command_flags {
4440ad7e718cSJohannes Berg 	WIPHY_VENDOR_CMD_NEED_WDEV = BIT(0),
4441ad7e718cSJohannes Berg 	WIPHY_VENDOR_CMD_NEED_NETDEV = BIT(1),
4442ad7e718cSJohannes Berg 	WIPHY_VENDOR_CMD_NEED_RUNNING = BIT(2),
4443ad7e718cSJohannes Berg };
4444ad7e718cSJohannes Berg 
4445ad7e718cSJohannes Berg /**
4446466b9936Stamizhr@codeaurora.org  * enum wiphy_opmode_flag - Station's ht/vht operation mode information flags
4447466b9936Stamizhr@codeaurora.org  *
4448466b9936Stamizhr@codeaurora.org  * @STA_OPMODE_MAX_BW_CHANGED: Max Bandwidth changed
4449466b9936Stamizhr@codeaurora.org  * @STA_OPMODE_SMPS_MODE_CHANGED: SMPS mode changed
4450466b9936Stamizhr@codeaurora.org  * @STA_OPMODE_N_SS_CHANGED: max N_SS (number of spatial streams) changed
4451466b9936Stamizhr@codeaurora.org  *
4452466b9936Stamizhr@codeaurora.org  */
4453466b9936Stamizhr@codeaurora.org enum wiphy_opmode_flag {
4454466b9936Stamizhr@codeaurora.org 	STA_OPMODE_MAX_BW_CHANGED	= BIT(0),
4455466b9936Stamizhr@codeaurora.org 	STA_OPMODE_SMPS_MODE_CHANGED	= BIT(1),
4456466b9936Stamizhr@codeaurora.org 	STA_OPMODE_N_SS_CHANGED		= BIT(2),
4457466b9936Stamizhr@codeaurora.org };
4458466b9936Stamizhr@codeaurora.org 
4459466b9936Stamizhr@codeaurora.org /**
4460466b9936Stamizhr@codeaurora.org  * struct sta_opmode_info - Station's ht/vht operation mode information
4461466b9936Stamizhr@codeaurora.org  * @changed: contains value from &enum wiphy_opmode_flag
44625e78abd0Stamizhr@codeaurora.org  * @smps_mode: New SMPS mode value from &enum nl80211_smps_mode of a station
44635e78abd0Stamizhr@codeaurora.org  * @bw: new max bandwidth value from &enum nl80211_chan_width of a station
4464466b9936Stamizhr@codeaurora.org  * @rx_nss: new rx_nss value of a station
4465466b9936Stamizhr@codeaurora.org  */
4466466b9936Stamizhr@codeaurora.org 
4467466b9936Stamizhr@codeaurora.org struct sta_opmode_info {
4468466b9936Stamizhr@codeaurora.org 	u32 changed;
44695e78abd0Stamizhr@codeaurora.org 	enum nl80211_smps_mode smps_mode;
44705e78abd0Stamizhr@codeaurora.org 	enum nl80211_chan_width bw;
4471466b9936Stamizhr@codeaurora.org 	u8 rx_nss;
4472466b9936Stamizhr@codeaurora.org };
4473466b9936Stamizhr@codeaurora.org 
447491046d63SJohannes Berg #define VENDOR_CMD_RAW_DATA ((const struct nla_policy *)(long)(-ENODATA))
4475901bb989SJohannes Berg 
4476466b9936Stamizhr@codeaurora.org /**
4477ad7e718cSJohannes Berg  * struct wiphy_vendor_command - vendor command definition
4478ad7e718cSJohannes Berg  * @info: vendor command identifying information, as used in nl80211
4479ad7e718cSJohannes Berg  * @flags: flags, see &enum wiphy_vendor_command_flags
4480ad7e718cSJohannes Berg  * @doit: callback for the operation, note that wdev is %NULL if the
4481ad7e718cSJohannes Berg  *	flags didn't ask for a wdev and non-%NULL otherwise; the data
4482ad7e718cSJohannes Berg  *	pointer may be %NULL if userspace provided no data at all
44837bdbe400SJohannes Berg  * @dumpit: dump callback, for transferring bigger/multiple items. The
44847bdbe400SJohannes Berg  *	@storage points to cb->args[5], ie. is preserved over the multiple
44857bdbe400SJohannes Berg  *	dumpit calls.
4486901bb989SJohannes Berg  * @policy: policy pointer for attributes within %NL80211_ATTR_VENDOR_DATA.
4487901bb989SJohannes Berg  *	Set this to %VENDOR_CMD_RAW_DATA if no policy can be given and the
4488901bb989SJohannes Berg  *	attribute is just raw data (e.g. a firmware command).
4489901bb989SJohannes Berg  * @maxattr: highest attribute number in policy
44907bdbe400SJohannes Berg  * It's recommended to not have the same sub command with both @doit and
44917bdbe400SJohannes Berg  * @dumpit, so that userspace can assume certain ones are get and others
44927bdbe400SJohannes Berg  * are used with dump requests.
4493ad7e718cSJohannes Berg  */
4494ad7e718cSJohannes Berg struct wiphy_vendor_command {
4495ad7e718cSJohannes Berg 	struct nl80211_vendor_cmd_info info;
4496ad7e718cSJohannes Berg 	u32 flags;
4497ad7e718cSJohannes Berg 	int (*doit)(struct wiphy *wiphy, struct wireless_dev *wdev,
4498ad7e718cSJohannes Berg 		    const void *data, int data_len);
44997bdbe400SJohannes Berg 	int (*dumpit)(struct wiphy *wiphy, struct wireless_dev *wdev,
45007bdbe400SJohannes Berg 		      struct sk_buff *skb, const void *data, int data_len,
45017bdbe400SJohannes Berg 		      unsigned long *storage);
4502901bb989SJohannes Berg 	const struct nla_policy *policy;
4503901bb989SJohannes Berg 	unsigned int maxattr;
4504ad7e718cSJohannes Berg };
4505ad7e718cSJohannes Berg 
4506ad7e718cSJohannes Berg /**
4507019ae3a9SKanchanapally, Vidyullatha  * struct wiphy_iftype_ext_capab - extended capabilities per interface type
4508019ae3a9SKanchanapally, Vidyullatha  * @iftype: interface type
4509019ae3a9SKanchanapally, Vidyullatha  * @extended_capabilities: extended capabilities supported by the driver,
4510019ae3a9SKanchanapally, Vidyullatha  *	additional capabilities might be supported by userspace; these are the
4511019ae3a9SKanchanapally, Vidyullatha  *	802.11 extended capabilities ("Extended Capabilities element") and are
4512019ae3a9SKanchanapally, Vidyullatha  *	in the same format as in the information element. See IEEE Std
4513019ae3a9SKanchanapally, Vidyullatha  *	802.11-2012 8.4.2.29 for the defined fields.
4514019ae3a9SKanchanapally, Vidyullatha  * @extended_capabilities_mask: mask of the valid values
4515019ae3a9SKanchanapally, Vidyullatha  * @extended_capabilities_len: length of the extended capabilities
4516019ae3a9SKanchanapally, Vidyullatha  */
4517019ae3a9SKanchanapally, Vidyullatha struct wiphy_iftype_ext_capab {
4518019ae3a9SKanchanapally, Vidyullatha 	enum nl80211_iftype iftype;
4519019ae3a9SKanchanapally, Vidyullatha 	const u8 *extended_capabilities;
4520019ae3a9SKanchanapally, Vidyullatha 	const u8 *extended_capabilities_mask;
4521019ae3a9SKanchanapally, Vidyullatha 	u8 extended_capabilities_len;
4522019ae3a9SKanchanapally, Vidyullatha };
4523019ae3a9SKanchanapally, Vidyullatha 
4524019ae3a9SKanchanapally, Vidyullatha /**
45259bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_capabilities - cfg80211 peer measurement capabilities
45269bb7e0f2SJohannes Berg  * @max_peers: maximum number of peers in a single measurement
45279bb7e0f2SJohannes Berg  * @report_ap_tsf: can report assoc AP's TSF for radio resource measurement
45289bb7e0f2SJohannes Berg  * @randomize_mac_addr: can randomize MAC address for measurement
45299bb7e0f2SJohannes Berg  * @ftm.supported: FTM measurement is supported
45309bb7e0f2SJohannes Berg  * @ftm.asap: ASAP-mode is supported
45319bb7e0f2SJohannes Berg  * @ftm.non_asap: non-ASAP-mode is supported
45329bb7e0f2SJohannes Berg  * @ftm.request_lci: can request LCI data
45339bb7e0f2SJohannes Berg  * @ftm.request_civicloc: can request civic location data
45349bb7e0f2SJohannes Berg  * @ftm.preambles: bitmap of preambles supported (&enum nl80211_preamble)
45359bb7e0f2SJohannes Berg  * @ftm.bandwidths: bitmap of bandwidths supported (&enum nl80211_chan_width)
45369bb7e0f2SJohannes Berg  * @ftm.max_bursts_exponent: maximum burst exponent supported
45379bb7e0f2SJohannes Berg  *	(set to -1 if not limited; note that setting this will necessarily
45389bb7e0f2SJohannes Berg  *	forbid using the value 15 to let the responder pick)
45399bb7e0f2SJohannes Berg  * @ftm.max_ftms_per_burst: maximum FTMs per burst supported (set to 0 if
45409bb7e0f2SJohannes Berg  *	not limited)
4541efb5520dSAvraham Stern  * @ftm.trigger_based: trigger based ranging measurement is supported
4542efb5520dSAvraham Stern  * @ftm.non_trigger_based: non trigger based ranging measurement is supported
45439bb7e0f2SJohannes Berg  */
45449bb7e0f2SJohannes Berg struct cfg80211_pmsr_capabilities {
45459bb7e0f2SJohannes Berg 	unsigned int max_peers;
45469bb7e0f2SJohannes Berg 	u8 report_ap_tsf:1,
45479bb7e0f2SJohannes Berg 	   randomize_mac_addr:1;
45489bb7e0f2SJohannes Berg 
45499bb7e0f2SJohannes Berg 	struct {
45509bb7e0f2SJohannes Berg 		u32 preambles;
45519bb7e0f2SJohannes Berg 		u32 bandwidths;
45529bb7e0f2SJohannes Berg 		s8 max_bursts_exponent;
45539bb7e0f2SJohannes Berg 		u8 max_ftms_per_burst;
45549bb7e0f2SJohannes Berg 		u8 supported:1,
45559bb7e0f2SJohannes Berg 		   asap:1,
45569bb7e0f2SJohannes Berg 		   non_asap:1,
45579bb7e0f2SJohannes Berg 		   request_lci:1,
4558efb5520dSAvraham Stern 		   request_civicloc:1,
4559efb5520dSAvraham Stern 		   trigger_based:1,
4560efb5520dSAvraham Stern 		   non_trigger_based:1;
45619bb7e0f2SJohannes Berg 	} ftm;
45629bb7e0f2SJohannes Berg };
45639bb7e0f2SJohannes Berg 
45649bb7e0f2SJohannes Berg /**
4565d6039a34SVeerendranath Jakkam  * struct wiphy_iftype_akm_suites - This structure encapsulates supported akm
4566d6039a34SVeerendranath Jakkam  * suites for interface types defined in @iftypes_mask. Each type in the
4567d6039a34SVeerendranath Jakkam  * @iftypes_mask must be unique across all instances of iftype_akm_suites.
4568d6039a34SVeerendranath Jakkam  *
4569d6039a34SVeerendranath Jakkam  * @iftypes_mask: bitmask of interfaces types
4570d6039a34SVeerendranath Jakkam  * @akm_suites: points to an array of supported akm suites
4571d6039a34SVeerendranath Jakkam  * @n_akm_suites: number of supported AKM suites
4572d6039a34SVeerendranath Jakkam  */
4573d6039a34SVeerendranath Jakkam struct wiphy_iftype_akm_suites {
4574d6039a34SVeerendranath Jakkam 	u16 iftypes_mask;
4575d6039a34SVeerendranath Jakkam 	const u32 *akm_suites;
4576d6039a34SVeerendranath Jakkam 	int n_akm_suites;
4577d6039a34SVeerendranath Jakkam };
4578d6039a34SVeerendranath Jakkam 
4579d6039a34SVeerendranath Jakkam /**
45805be83de5SJohannes Berg  * struct wiphy - wireless hardware description
45812784fe91SLuis R. Rodriguez  * @reg_notifier: the driver's regulatory notification callback,
45822784fe91SLuis R. Rodriguez  *	note that if your driver uses wiphy_apply_custom_regulatory()
45832784fe91SLuis R. Rodriguez  *	the reg_notifier's request can be passed as NULL
4584d3236553SJohannes Berg  * @regd: the driver's regulatory domain, if one was requested via
4585d3236553SJohannes Berg  *	the regulatory_hint() API. This can be used by the driver
4586d3236553SJohannes Berg  *	on the reg_notifier() if it chooses to ignore future
4587d3236553SJohannes Berg  *	regulatory domain changes caused by other drivers.
4588d3236553SJohannes Berg  * @signal_type: signal type reported in &struct cfg80211_bss.
4589d3236553SJohannes Berg  * @cipher_suites: supported cipher suites
4590d3236553SJohannes Berg  * @n_cipher_suites: number of supported cipher suites
4591d6039a34SVeerendranath Jakkam  * @akm_suites: supported AKM suites. These are the default AKMs supported if
4592d6039a34SVeerendranath Jakkam  *	the supported AKMs not advertized for a specific interface type in
4593d6039a34SVeerendranath Jakkam  *	iftype_akm_suites.
4594ab4dfa20SVeerendranath Jakkam  * @n_akm_suites: number of supported AKM suites
4595d6039a34SVeerendranath Jakkam  * @iftype_akm_suites: array of supported akm suites info per interface type.
4596d6039a34SVeerendranath Jakkam  *	Note that the bits in @iftypes_mask inside this structure cannot
4597d6039a34SVeerendranath Jakkam  *	overlap (i.e. only one occurrence of each type is allowed across all
4598d6039a34SVeerendranath Jakkam  *	instances of iftype_akm_suites).
4599d6039a34SVeerendranath Jakkam  * @num_iftype_akm_suites: number of interface types for which supported akm
4600d6039a34SVeerendranath Jakkam  *	suites are specified separately.
4601b9a5f8caSJouni Malinen  * @retry_short: Retry limit for short frames (dot11ShortRetryLimit)
4602b9a5f8caSJouni Malinen  * @retry_long: Retry limit for long frames (dot11LongRetryLimit)
4603b9a5f8caSJouni Malinen  * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold);
4604b9a5f8caSJouni Malinen  *	-1 = fragmentation disabled, only odd values >= 256 used
4605b9a5f8caSJouni Malinen  * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled
4606abe37c4bSJohannes Berg  * @_net: the network namespace this wiphy currently lives in
4607ef15aac6SJohannes Berg  * @perm_addr: permanent MAC address of this device
4608ef15aac6SJohannes Berg  * @addr_mask: If the device supports multiple MAC addresses by masking,
4609ef15aac6SJohannes Berg  *	set this to a mask with variable bits set to 1, e.g. if the last
46100fcf8ac5SLuciano Coelho  *	four bits are variable then set it to 00-00-00-00-00-0f. The actual
4611ef15aac6SJohannes Berg  *	variable bits shall be determined by the interfaces added, with
4612ef15aac6SJohannes Berg  *	interfaces not matching the mask being rejected to be brought up.
4613ef15aac6SJohannes Berg  * @n_addresses: number of addresses in @addresses.
4614ef15aac6SJohannes Berg  * @addresses: If the device has more than one address, set this pointer
4615ef15aac6SJohannes Berg  *	to a list of addresses (6 bytes each). The first one will be used
4616ef15aac6SJohannes Berg  *	by default for perm_addr. In this case, the mask should be set to
4617ef15aac6SJohannes Berg  *	all-zeroes. In this case it is assumed that the device can handle
4618ef15aac6SJohannes Berg  *	the same number of arbitrary MAC addresses.
4619fd235913SRandy Dunlap  * @registered: protects ->resume and ->suspend sysfs callbacks against
4620fd235913SRandy Dunlap  *	unregister hardware
4621edf77192SJérôme Pouiller  * @debugfsdir: debugfs directory used for this wiphy (ieee80211/<wiphyname>).
4622edf77192SJérôme Pouiller  *	It will be renamed automatically on wiphy renames
462315bc6dfbSJérôme Pouiller  * @dev: (virtual) struct device for this wiphy. The item in
462415bc6dfbSJérôme Pouiller  *	/sys/class/ieee80211/ points to this. You need use set_wiphy_dev()
462515bc6dfbSJérôme Pouiller  *	(see below).
4626abe37c4bSJohannes Berg  * @wext: wireless extension handlers
4627abe37c4bSJohannes Berg  * @priv: driver private data (sized according to wiphy_new() parameter)
4628abe37c4bSJohannes Berg  * @interface_modes: bitmask of interfaces types valid for this wiphy,
4629abe37c4bSJohannes Berg  *	must be set by driver
46307527a782SJohannes Berg  * @iface_combinations: Valid interface combinations array, should not
46317527a782SJohannes Berg  *	list single interface types.
46327527a782SJohannes Berg  * @n_iface_combinations: number of entries in @iface_combinations array.
46337527a782SJohannes Berg  * @software_iftypes: bitmask of software interface types, these are not
46347527a782SJohannes Berg  *	subject to any restrictions since they are purely managed in SW.
4635abe37c4bSJohannes Berg  * @flags: wiphy flags, see &enum wiphy_flags
4636a2f73b6cSLuis R. Rodriguez  * @regulatory_flags: wiphy regulatory flags, see
4637a2f73b6cSLuis R. Rodriguez  *	&enum ieee80211_regulatory_flags
46381f074bd8SJohannes Berg  * @features: features advertised to nl80211, see &enum nl80211_feature_flags.
4639d75bb06bSGautam Kumar Shukla  * @ext_features: extended features advertised to nl80211, see
4640d75bb06bSGautam Kumar Shukla  *	&enum nl80211_ext_feature_index.
4641abe37c4bSJohannes Berg  * @bss_priv_size: each BSS struct has private data allocated with it,
4642abe37c4bSJohannes Berg  *	this variable determines its size
4643abe37c4bSJohannes Berg  * @max_scan_ssids: maximum number of SSIDs the device can scan for in
4644abe37c4bSJohannes Berg  *	any given scan
4645ca986ad9SArend Van Spriel  * @max_sched_scan_reqs: maximum number of scheduled scan requests that
4646ca986ad9SArend Van Spriel  *	the device can run concurrently.
464793b6aa69SLuciano Coelho  * @max_sched_scan_ssids: maximum number of SSIDs the device can scan
464893b6aa69SLuciano Coelho  *	for in any given scheduled scan
4649a1f1c21cSLuciano Coelho  * @max_match_sets: maximum number of match sets the device can handle
4650a1f1c21cSLuciano Coelho  *	when performing a scheduled scan, 0 if filtering is not
4651a1f1c21cSLuciano Coelho  *	supported.
4652abe37c4bSJohannes Berg  * @max_scan_ie_len: maximum length of user-controlled IEs device can
4653abe37c4bSJohannes Berg  *	add to probe request frames transmitted during a scan, must not
4654abe37c4bSJohannes Berg  *	include fixed IEs like supported rates
46555a865badSLuciano Coelho  * @max_sched_scan_ie_len: same as max_scan_ie_len, but for scheduled
46565a865badSLuciano Coelho  *	scans
46573b06d277SAvraham Stern  * @max_sched_scan_plans: maximum number of scan plans (scan interval and number
46583b06d277SAvraham Stern  *	of iterations) for scheduled scan supported by the device.
46593b06d277SAvraham Stern  * @max_sched_scan_plan_interval: maximum interval (in seconds) for a
46603b06d277SAvraham Stern  *	single scan plan supported by the device.
46613b06d277SAvraham Stern  * @max_sched_scan_plan_iterations: maximum number of iterations for a single
46623b06d277SAvraham Stern  *	scan plan supported by the device.
4663abe37c4bSJohannes Berg  * @coverage_class: current coverage class
4664abe37c4bSJohannes Berg  * @fw_version: firmware version for ethtool reporting
4665abe37c4bSJohannes Berg  * @hw_version: hardware version for ethtool reporting
4666abe37c4bSJohannes Berg  * @max_num_pmkids: maximum number of PMKIDs supported by device
4667abe37c4bSJohannes Berg  * @privid: a pointer that drivers can use to identify if an arbitrary
4668abe37c4bSJohannes Berg  *	wiphy is theirs, e.g. in global notifiers
4669abe37c4bSJohannes Berg  * @bands: information about bands/channels supported by this device
46702e161f78SJohannes Berg  *
46712e161f78SJohannes Berg  * @mgmt_stypes: bitmasks of frame subtypes that can be subscribed to or
46722e161f78SJohannes Berg  *	transmitted through nl80211, points to an array indexed by interface
46732e161f78SJohannes Berg  *	type
4674a7ffac95SBruno Randolf  *
46757f531e03SBruno Randolf  * @available_antennas_tx: bitmap of antennas which are available to be
46767f531e03SBruno Randolf  *	configured as TX antennas. Antenna configuration commands will be
46777f531e03SBruno Randolf  *	rejected unless this or @available_antennas_rx is set.
46787f531e03SBruno Randolf  *
46797f531e03SBruno Randolf  * @available_antennas_rx: bitmap of antennas which are available to be
46807f531e03SBruno Randolf  *	configured as RX antennas. Antenna configuration commands will be
46817f531e03SBruno Randolf  *	rejected unless this or @available_antennas_tx is set.
4682a293911dSJohannes Berg  *
468315f0ebc2SRandy Dunlap  * @probe_resp_offload:
468415f0ebc2SRandy Dunlap  *	 Bitmap of supported protocols for probe response offloading.
468515f0ebc2SRandy Dunlap  *	 See &enum nl80211_probe_resp_offload_support_attr. Only valid
468615f0ebc2SRandy Dunlap  *	 when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set.
468715f0ebc2SRandy Dunlap  *
4688a293911dSJohannes Berg  * @max_remain_on_channel_duration: Maximum time a remain-on-channel operation
4689a293911dSJohannes Berg  *	may request, if implemented.
4690ff1b6e69SJohannes Berg  *
4691ff1b6e69SJohannes Berg  * @wowlan: WoWLAN support information
46926abb9cb9SJohannes Berg  * @wowlan_config: current WoWLAN configuration; this should usually not be
46936abb9cb9SJohannes Berg  *	used since access to it is necessarily racy, use the parameter passed
46946abb9cb9SJohannes Berg  *	to the suspend() operation instead.
4695562a7480SJohannes Berg  *
4696562a7480SJohannes Berg  * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features.
46977e7c8926SBen Greear  * @ht_capa_mod_mask:  Specify what ht_cap values can be over-ridden.
46987e7c8926SBen Greear  *	If null, then none can be over-ridden.
4699ee2aca34SJohannes Berg  * @vht_capa_mod_mask:  Specify what VHT capabilities can be over-ridden.
4700ee2aca34SJohannes Berg  *	If null, then none can be over-ridden.
470177765eafSVasanthakumar Thiagarajan  *
470253873f13SJohannes Berg  * @wdev_list: the list of associated (virtual) interfaces; this list must
470353873f13SJohannes Berg  *	not be modified by the driver, but can be read with RTNL/RCU protection.
470453873f13SJohannes Berg  *
470577765eafSVasanthakumar Thiagarajan  * @max_acl_mac_addrs: Maximum number of MAC addresses that the device
470677765eafSVasanthakumar Thiagarajan  *	supports for ACL.
4707a50df0c4SJohannes Berg  *
4708a50df0c4SJohannes Berg  * @extended_capabilities: extended capabilities supported by the driver,
4709a50df0c4SJohannes Berg  *	additional capabilities might be supported by userspace; these are
4710a50df0c4SJohannes Berg  *	the 802.11 extended capabilities ("Extended Capabilities element")
4711a50df0c4SJohannes Berg  *	and are in the same format as in the information element. See
4712019ae3a9SKanchanapally, Vidyullatha  *	802.11-2012 8.4.2.29 for the defined fields. These are the default
4713019ae3a9SKanchanapally, Vidyullatha  *	extended capabilities to be used if the capabilities are not specified
4714019ae3a9SKanchanapally, Vidyullatha  *	for a specific interface type in iftype_ext_capab.
4715a50df0c4SJohannes Berg  * @extended_capabilities_mask: mask of the valid values
4716a50df0c4SJohannes Berg  * @extended_capabilities_len: length of the extended capabilities
4717019ae3a9SKanchanapally, Vidyullatha  * @iftype_ext_capab: array of extended capabilities per interface type
4718019ae3a9SKanchanapally, Vidyullatha  * @num_iftype_ext_capab: number of interface types for which extended
4719019ae3a9SKanchanapally, Vidyullatha  *	capabilities are specified separately.
4720be29b99aSAmitkumar Karwar  * @coalesce: packet coalescing support information
4721ad7e718cSJohannes Berg  *
4722ad7e718cSJohannes Berg  * @vendor_commands: array of vendor commands supported by the hardware
4723ad7e718cSJohannes Berg  * @n_vendor_commands: number of vendor commands
4724567ffc35SJohannes Berg  * @vendor_events: array of vendor events supported by the hardware
4725567ffc35SJohannes Berg  * @n_vendor_events: number of vendor events
4726b43504cfSJouni Malinen  *
4727b43504cfSJouni Malinen  * @max_ap_assoc_sta: maximum number of associated stations supported in AP mode
4728b43504cfSJouni Malinen  *	(including P2P GO) or 0 to indicate no such limit is advertised. The
4729b43504cfSJouni Malinen  *	driver is allowed to advertise a theoretical limit that it can reach in
4730b43504cfSJouni Malinen  *	some cases, but may not always reach.
4731c2e4323bSLuciano Coelho  *
4732c2e4323bSLuciano Coelho  * @max_num_csa_counters: Number of supported csa_counters in beacons
4733c2e4323bSLuciano Coelho  *	and probe responses.  This value should be set if the driver
4734c2e4323bSLuciano Coelho  *	wishes to limit the number of csa counters. Default (0) means
4735c2e4323bSLuciano Coelho  *	infinite.
473638de03d2SArend van Spriel  * @bss_select_support: bitmask indicating the BSS selection criteria supported
473738de03d2SArend van Spriel  *	by the driver in the .connect() callback. The bit position maps to the
473838de03d2SArend van Spriel  *	attribute indices defined in &enum nl80211_bss_select_attr.
4739a442b761SAyala Beker  *
47408585989dSLuca Coelho  * @nan_supported_bands: bands supported by the device in NAN mode, a
47418585989dSLuca Coelho  *	bitmap of &enum nl80211_band values.  For instance, for
47428585989dSLuca Coelho  *	NL80211_BAND_2GHZ, bit 0 would be set
47438585989dSLuca Coelho  *	(i.e. BIT(NL80211_BAND_2GHZ)).
4744f3a7ca64SJohannes Berg  *
4745f3a7ca64SJohannes Berg  * @txq_limit: configuration of internal TX queue frame limit
4746f3a7ca64SJohannes Berg  * @txq_memory_limit: configuration internal TX queue memory limit
4747f3a7ca64SJohannes Berg  * @txq_quantum: configuration of internal TX queue scheduler quantum
47489bb7e0f2SJohannes Berg  *
4749a710d214SLothar Rubusch  * @tx_queue_len: allow setting transmit queue len for drivers not using
4750a710d214SLothar Rubusch  *	wake_tx_queue
4751a710d214SLothar Rubusch  *
4752213ed579SSara Sharon  * @support_mbssid: can HW support association with nontransmitted AP
4753213ed579SSara Sharon  * @support_only_he_mbssid: don't parse MBSSID elements if it is not
4754213ed579SSara Sharon  *	HE AP, in order to avoid compatibility issues.
4755213ed579SSara Sharon  *	@support_mbssid must be set for this to have any effect.
4756213ed579SSara Sharon  *
47579bb7e0f2SJohannes Berg  * @pmsr_capa: peer measurement capabilities
47583710a8a6SJohannes Berg  *
47593710a8a6SJohannes Berg  * @tid_config_support: describes the per-TID config support that the
47603710a8a6SJohannes Berg  *	device has
47613710a8a6SJohannes Berg  * @tid_config_support.vif: bitmap of attributes (configurations)
47623710a8a6SJohannes Berg  *	supported by the driver for each vif
47633710a8a6SJohannes Berg  * @tid_config_support.peer: bitmap of attributes (configurations)
47643710a8a6SJohannes Berg  *	supported by the driver for each peer
47656a21d16cSTamizh chelvam  * @tid_config_support.max_retry: maximum supported retry count for
47666a21d16cSTamizh chelvam  *	long/short retry configuration
4767a710d214SLothar Rubusch  *
4768a710d214SLothar Rubusch  * @max_data_retry_count: maximum supported per TID retry count for
4769a710d214SLothar Rubusch  *	configuration through the %NL80211_TID_CONFIG_ATTR_RETRY_SHORT and
4770a710d214SLothar Rubusch  *	%NL80211_TID_CONFIG_ATTR_RETRY_LONG attributes
4771d3236553SJohannes Berg  */
4772d3236553SJohannes Berg struct wiphy {
4773d3236553SJohannes Berg 	/* assign these fields before you register the wiphy */
4774d3236553SJohannes Berg 
4775d3236553SJohannes Berg 	u8 perm_addr[ETH_ALEN];
4776ef15aac6SJohannes Berg 	u8 addr_mask[ETH_ALEN];
4777ef15aac6SJohannes Berg 
4778ef15aac6SJohannes Berg 	struct mac_address *addresses;
4779d3236553SJohannes Berg 
47802e161f78SJohannes Berg 	const struct ieee80211_txrx_stypes *mgmt_stypes;
47812e161f78SJohannes Berg 
47827527a782SJohannes Berg 	const struct ieee80211_iface_combination *iface_combinations;
47837527a782SJohannes Berg 	int n_iface_combinations;
47847527a782SJohannes Berg 	u16 software_iftypes;
47857527a782SJohannes Berg 
47862e161f78SJohannes Berg 	u16 n_addresses;
47872e161f78SJohannes Berg 
4788d3236553SJohannes Berg 	/* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
4789d3236553SJohannes Berg 	u16 interface_modes;
4790d3236553SJohannes Berg 
479177765eafSVasanthakumar Thiagarajan 	u16 max_acl_mac_addrs;
479277765eafSVasanthakumar Thiagarajan 
4793a2f73b6cSLuis R. Rodriguez 	u32 flags, regulatory_flags, features;
4794d75bb06bSGautam Kumar Shukla 	u8 ext_features[DIV_ROUND_UP(NUM_NL80211_EXT_FEATURES, 8)];
4795463d0183SJohannes Berg 
4796562a7480SJohannes Berg 	u32 ap_sme_capa;
4797562a7480SJohannes Berg 
4798d3236553SJohannes Berg 	enum cfg80211_signal_type signal_type;
4799d3236553SJohannes Berg 
4800d3236553SJohannes Berg 	int bss_priv_size;
4801d3236553SJohannes Berg 	u8 max_scan_ssids;
4802ca986ad9SArend Van Spriel 	u8 max_sched_scan_reqs;
480393b6aa69SLuciano Coelho 	u8 max_sched_scan_ssids;
4804a1f1c21cSLuciano Coelho 	u8 max_match_sets;
4805d3236553SJohannes Berg 	u16 max_scan_ie_len;
48065a865badSLuciano Coelho 	u16 max_sched_scan_ie_len;
48073b06d277SAvraham Stern 	u32 max_sched_scan_plans;
48083b06d277SAvraham Stern 	u32 max_sched_scan_plan_interval;
48093b06d277SAvraham Stern 	u32 max_sched_scan_plan_iterations;
4810d3236553SJohannes Berg 
4811d3236553SJohannes Berg 	int n_cipher_suites;
4812d3236553SJohannes Berg 	const u32 *cipher_suites;
4813d3236553SJohannes Berg 
4814ab4dfa20SVeerendranath Jakkam 	int n_akm_suites;
4815ab4dfa20SVeerendranath Jakkam 	const u32 *akm_suites;
4816ab4dfa20SVeerendranath Jakkam 
4817d6039a34SVeerendranath Jakkam 	const struct wiphy_iftype_akm_suites *iftype_akm_suites;
4818d6039a34SVeerendranath Jakkam 	unsigned int num_iftype_akm_suites;
4819d6039a34SVeerendranath Jakkam 
4820b9a5f8caSJouni Malinen 	u8 retry_short;
4821b9a5f8caSJouni Malinen 	u8 retry_long;
4822b9a5f8caSJouni Malinen 	u32 frag_threshold;
4823b9a5f8caSJouni Malinen 	u32 rts_threshold;
482481077e82SLukáš Turek 	u8 coverage_class;
4825b9a5f8caSJouni Malinen 
482681135548SJiri Pirko 	char fw_version[ETHTOOL_FWVERS_LEN];
4827dfce95f5SKalle Valo 	u32 hw_version;
4828dfce95f5SKalle Valo 
4829dfb89c56SJohannes Berg #ifdef CONFIG_PM
4830964dc9e2SJohannes Berg 	const struct wiphy_wowlan_support *wowlan;
48316abb9cb9SJohannes Berg 	struct cfg80211_wowlan *wowlan_config;
4832dfb89c56SJohannes Berg #endif
4833ff1b6e69SJohannes Berg 
4834a293911dSJohannes Berg 	u16 max_remain_on_channel_duration;
4835a293911dSJohannes Berg 
483667fbb16bSSamuel Ortiz 	u8 max_num_pmkids;
483767fbb16bSSamuel Ortiz 
48387f531e03SBruno Randolf 	u32 available_antennas_tx;
48397f531e03SBruno Randolf 	u32 available_antennas_rx;
4840a7ffac95SBruno Randolf 
484187bbbe22SArik Nemtsov 	u32 probe_resp_offload;
484287bbbe22SArik Nemtsov 
4843a50df0c4SJohannes Berg 	const u8 *extended_capabilities, *extended_capabilities_mask;
4844a50df0c4SJohannes Berg 	u8 extended_capabilities_len;
4845a50df0c4SJohannes Berg 
4846019ae3a9SKanchanapally, Vidyullatha 	const struct wiphy_iftype_ext_capab *iftype_ext_capab;
4847019ae3a9SKanchanapally, Vidyullatha 	unsigned int num_iftype_ext_capab;
4848019ae3a9SKanchanapally, Vidyullatha 
4849cf5aa2f1SDavid Kilroy 	const void *privid;
4850d3236553SJohannes Berg 
485157fbcce3SJohannes Berg 	struct ieee80211_supported_band *bands[NUM_NL80211_BANDS];
4852d3236553SJohannes Berg 
48530c0280bdSLuis R. Rodriguez 	void (*reg_notifier)(struct wiphy *wiphy,
4854d3236553SJohannes Berg 			     struct regulatory_request *request);
4855d3236553SJohannes Berg 
4856d3236553SJohannes Berg 	/* fields below are read-only, assigned by cfg80211 */
4857d3236553SJohannes Berg 
4858458f4f9eSJohannes Berg 	const struct ieee80211_regdomain __rcu *regd;
4859d3236553SJohannes Berg 
4860d3236553SJohannes Berg 	struct device dev;
4861d3236553SJohannes Berg 
4862ecb44335SStanislaw Gruszka 	bool registered;
4863ecb44335SStanislaw Gruszka 
4864d3236553SJohannes Berg 	struct dentry *debugfsdir;
4865d3236553SJohannes Berg 
48667e7c8926SBen Greear 	const struct ieee80211_ht_cap *ht_capa_mod_mask;
4867ee2aca34SJohannes Berg 	const struct ieee80211_vht_cap *vht_capa_mod_mask;
48687e7c8926SBen Greear 
486953873f13SJohannes Berg 	struct list_head wdev_list;
487053873f13SJohannes Berg 
48710c5c9fb5SEric W. Biederman 	possible_net_t _net;
4872463d0183SJohannes Berg 
48733d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT
48743d23e349SJohannes Berg 	const struct iw_handler_def *wext;
48753d23e349SJohannes Berg #endif
48763d23e349SJohannes Berg 
4877be29b99aSAmitkumar Karwar 	const struct wiphy_coalesce_support *coalesce;
4878be29b99aSAmitkumar Karwar 
4879ad7e718cSJohannes Berg 	const struct wiphy_vendor_command *vendor_commands;
4880567ffc35SJohannes Berg 	const struct nl80211_vendor_cmd_info *vendor_events;
4881567ffc35SJohannes Berg 	int n_vendor_commands, n_vendor_events;
4882ad7e718cSJohannes Berg 
4883b43504cfSJouni Malinen 	u16 max_ap_assoc_sta;
4884b43504cfSJouni Malinen 
48859a774c78SAndrei Otcheretianski 	u8 max_num_csa_counters;
48869a774c78SAndrei Otcheretianski 
488738de03d2SArend van Spriel 	u32 bss_select_support;
488838de03d2SArend van Spriel 
48898585989dSLuca Coelho 	u8 nan_supported_bands;
48908585989dSLuca Coelho 
489152539ca8SToke Høiland-Jørgensen 	u32 txq_limit;
489252539ca8SToke Høiland-Jørgensen 	u32 txq_memory_limit;
489352539ca8SToke Høiland-Jørgensen 	u32 txq_quantum;
489452539ca8SToke Høiland-Jørgensen 
48951f6e0baaSJohn Crispin 	unsigned long tx_queue_len;
48961f6e0baaSJohn Crispin 
4897213ed579SSara Sharon 	u8 support_mbssid:1,
4898213ed579SSara Sharon 	   support_only_he_mbssid:1;
4899213ed579SSara Sharon 
49009bb7e0f2SJohannes Berg 	const struct cfg80211_pmsr_capabilities *pmsr_capa;
49019bb7e0f2SJohannes Berg 
49023710a8a6SJohannes Berg 	struct {
49033710a8a6SJohannes Berg 		u64 peer, vif;
49046a21d16cSTamizh chelvam 		u8 max_retry;
49053710a8a6SJohannes Berg 	} tid_config_support;
49063710a8a6SJohannes Berg 
49076a21d16cSTamizh chelvam 	u8 max_data_retry_count;
49086a21d16cSTamizh chelvam 
4909396fba0aSGustavo A. R. Silva 	char priv[] __aligned(NETDEV_ALIGN);
4910d3236553SJohannes Berg };
4911d3236553SJohannes Berg 
4912463d0183SJohannes Berg static inline struct net *wiphy_net(struct wiphy *wiphy)
4913463d0183SJohannes Berg {
4914c2d9ba9bSEric Dumazet 	return read_pnet(&wiphy->_net);
4915463d0183SJohannes Berg }
4916463d0183SJohannes Berg 
4917463d0183SJohannes Berg static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net)
4918463d0183SJohannes Berg {
4919c2d9ba9bSEric Dumazet 	write_pnet(&wiphy->_net, net);
4920463d0183SJohannes Berg }
4921463d0183SJohannes Berg 
4922d3236553SJohannes Berg /**
4923d3236553SJohannes Berg  * wiphy_priv - return priv from wiphy
4924d3236553SJohannes Berg  *
4925d3236553SJohannes Berg  * @wiphy: the wiphy whose priv pointer to return
49260ae997dcSYacine Belkadi  * Return: The priv of @wiphy.
4927d3236553SJohannes Berg  */
4928d3236553SJohannes Berg static inline void *wiphy_priv(struct wiphy *wiphy)
4929d3236553SJohannes Berg {
4930d3236553SJohannes Berg 	BUG_ON(!wiphy);
4931d3236553SJohannes Berg 	return &wiphy->priv;
4932d3236553SJohannes Berg }
4933d3236553SJohannes Berg 
4934d3236553SJohannes Berg /**
4935f1f74825SDavid Kilroy  * priv_to_wiphy - return the wiphy containing the priv
4936f1f74825SDavid Kilroy  *
4937f1f74825SDavid Kilroy  * @priv: a pointer previously returned by wiphy_priv
49380ae997dcSYacine Belkadi  * Return: The wiphy of @priv.
4939f1f74825SDavid Kilroy  */
4940f1f74825SDavid Kilroy static inline struct wiphy *priv_to_wiphy(void *priv)
4941f1f74825SDavid Kilroy {
4942f1f74825SDavid Kilroy 	BUG_ON(!priv);
4943f1f74825SDavid Kilroy 	return container_of(priv, struct wiphy, priv);
4944f1f74825SDavid Kilroy }
4945f1f74825SDavid Kilroy 
4946f1f74825SDavid Kilroy /**
4947d3236553SJohannes Berg  * set_wiphy_dev - set device pointer for wiphy
4948d3236553SJohannes Berg  *
4949d3236553SJohannes Berg  * @wiphy: The wiphy whose device to bind
4950d3236553SJohannes Berg  * @dev: The device to parent it to
4951d3236553SJohannes Berg  */
4952d3236553SJohannes Berg static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev)
4953d3236553SJohannes Berg {
4954d3236553SJohannes Berg 	wiphy->dev.parent = dev;
4955d3236553SJohannes Berg }
4956d3236553SJohannes Berg 
4957d3236553SJohannes Berg /**
4958d3236553SJohannes Berg  * wiphy_dev - get wiphy dev pointer
4959d3236553SJohannes Berg  *
4960d3236553SJohannes Berg  * @wiphy: The wiphy whose device struct to look up
49610ae997dcSYacine Belkadi  * Return: The dev of @wiphy.
4962d3236553SJohannes Berg  */
4963d3236553SJohannes Berg static inline struct device *wiphy_dev(struct wiphy *wiphy)
4964d3236553SJohannes Berg {
4965d3236553SJohannes Berg 	return wiphy->dev.parent;
4966d3236553SJohannes Berg }
4967d3236553SJohannes Berg 
4968d3236553SJohannes Berg /**
4969d3236553SJohannes Berg  * wiphy_name - get wiphy name
4970d3236553SJohannes Berg  *
4971d3236553SJohannes Berg  * @wiphy: The wiphy whose name to return
49720ae997dcSYacine Belkadi  * Return: The name of @wiphy.
4973d3236553SJohannes Berg  */
4974e1db74fcSJoe Perches static inline const char *wiphy_name(const struct wiphy *wiphy)
4975d3236553SJohannes Berg {
4976d3236553SJohannes Berg 	return dev_name(&wiphy->dev);
4977d3236553SJohannes Berg }
4978d3236553SJohannes Berg 
4979d3236553SJohannes Berg /**
49801998d90aSBen Greear  * wiphy_new_nm - create a new wiphy for use with cfg80211
49811998d90aSBen Greear  *
49821998d90aSBen Greear  * @ops: The configuration operations for this device
49831998d90aSBen Greear  * @sizeof_priv: The size of the private area to allocate
49841998d90aSBen Greear  * @requested_name: Request a particular name.
49851998d90aSBen Greear  *	NULL is valid value, and means use the default phy%d naming.
49861998d90aSBen Greear  *
49871998d90aSBen Greear  * Create a new wiphy and associate the given operations with it.
49881998d90aSBen Greear  * @sizeof_priv bytes are allocated for private use.
49891998d90aSBen Greear  *
49901998d90aSBen Greear  * Return: A pointer to the new wiphy. This pointer must be
49911998d90aSBen Greear  * assigned to each netdev's ieee80211_ptr for proper operation.
49921998d90aSBen Greear  */
49931998d90aSBen Greear struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv,
49941998d90aSBen Greear 			   const char *requested_name);
49951998d90aSBen Greear 
49961998d90aSBen Greear /**
4997d3236553SJohannes Berg  * wiphy_new - create a new wiphy for use with cfg80211
4998d3236553SJohannes Berg  *
4999d3236553SJohannes Berg  * @ops: The configuration operations for this device
5000d3236553SJohannes Berg  * @sizeof_priv: The size of the private area to allocate
5001d3236553SJohannes Berg  *
5002d3236553SJohannes Berg  * Create a new wiphy and associate the given operations with it.
5003d3236553SJohannes Berg  * @sizeof_priv bytes are allocated for private use.
5004d3236553SJohannes Berg  *
50050ae997dcSYacine Belkadi  * Return: A pointer to the new wiphy. This pointer must be
50060ae997dcSYacine Belkadi  * assigned to each netdev's ieee80211_ptr for proper operation.
5007d3236553SJohannes Berg  */
50081998d90aSBen Greear static inline struct wiphy *wiphy_new(const struct cfg80211_ops *ops,
50091998d90aSBen Greear 				      int sizeof_priv)
50101998d90aSBen Greear {
50111998d90aSBen Greear 	return wiphy_new_nm(ops, sizeof_priv, NULL);
50121998d90aSBen Greear }
5013d3236553SJohannes Berg 
5014d3236553SJohannes Berg /**
5015d3236553SJohannes Berg  * wiphy_register - register a wiphy with cfg80211
5016d3236553SJohannes Berg  *
5017d3236553SJohannes Berg  * @wiphy: The wiphy to register.
5018d3236553SJohannes Berg  *
50190ae997dcSYacine Belkadi  * Return: A non-negative wiphy index or a negative error code.
5020d3236553SJohannes Berg  */
502110dd9b7cSJoe Perches int wiphy_register(struct wiphy *wiphy);
5022d3236553SJohannes Berg 
5023d3236553SJohannes Berg /**
5024d3236553SJohannes Berg  * wiphy_unregister - deregister a wiphy from cfg80211
5025d3236553SJohannes Berg  *
5026d3236553SJohannes Berg  * @wiphy: The wiphy to unregister.
5027d3236553SJohannes Berg  *
5028d3236553SJohannes Berg  * After this call, no more requests can be made with this priv
5029d3236553SJohannes Berg  * pointer, but the call may sleep to wait for an outstanding
5030d3236553SJohannes Berg  * request that is being handled.
5031d3236553SJohannes Berg  */
503210dd9b7cSJoe Perches void wiphy_unregister(struct wiphy *wiphy);
5033d3236553SJohannes Berg 
5034d3236553SJohannes Berg /**
5035d3236553SJohannes Berg  * wiphy_free - free wiphy
5036d3236553SJohannes Berg  *
5037d3236553SJohannes Berg  * @wiphy: The wiphy to free
5038d3236553SJohannes Berg  */
503910dd9b7cSJoe Perches void wiphy_free(struct wiphy *wiphy);
5040d3236553SJohannes Berg 
5041fffd0934SJohannes Berg /* internal structs */
50426829c878SJohannes Berg struct cfg80211_conn;
504319957bb3SJohannes Berg struct cfg80211_internal_bss;
5044fffd0934SJohannes Berg struct cfg80211_cached_keys;
50454a4b8169SAndrew Zaborowski struct cfg80211_cqm_config;
504619957bb3SJohannes Berg 
5047d3236553SJohannes Berg /**
504889a54e48SJohannes Berg  * struct wireless_dev - wireless device state
5049d3236553SJohannes Berg  *
505089a54e48SJohannes Berg  * For netdevs, this structure must be allocated by the driver
505189a54e48SJohannes Berg  * that uses the ieee80211_ptr field in struct net_device (this
505289a54e48SJohannes Berg  * is intentional so it can be allocated along with the netdev.)
505389a54e48SJohannes Berg  * It need not be registered then as netdev registration will
505489a54e48SJohannes Berg  * be intercepted by cfg80211 to see the new wireless device.
505589a54e48SJohannes Berg  *
505689a54e48SJohannes Berg  * For non-netdev uses, it must also be allocated by the driver
505789a54e48SJohannes Berg  * in response to the cfg80211 callbacks that require it, as
505889a54e48SJohannes Berg  * there's no netdev registration in that case it may not be
505989a54e48SJohannes Berg  * allocated outside of callback operations that return it.
5060d3236553SJohannes Berg  *
5061d3236553SJohannes Berg  * @wiphy: pointer to hardware description
5062d3236553SJohannes Berg  * @iftype: interface type
5063d3236553SJohannes Berg  * @list: (private) Used to collect the interfaces
506489a54e48SJohannes Berg  * @netdev: (private) Used to reference back to the netdev, may be %NULL
506589a54e48SJohannes Berg  * @identifier: (private) Identifier used in nl80211 to identify this
506689a54e48SJohannes Berg  *	wireless device if it has no netdev
5067d3236553SJohannes Berg  * @current_bss: (private) Used by the internal configuration code
50689e0e2961SMichal Kazior  * @chandef: (private) Used by the internal configuration code to track
50699e0e2961SMichal Kazior  *	the user-set channel definition.
5070780b40dfSJohannes Berg  * @preset_chandef: (private) Used by the internal configuration code to
5071aa430da4SJohannes Berg  *	track the channel to be used for AP later
5072d3236553SJohannes Berg  * @bssid: (private) Used by the internal configuration code
5073d3236553SJohannes Berg  * @ssid: (private) Used by the internal configuration code
5074d3236553SJohannes Berg  * @ssid_len: (private) Used by the internal configuration code
507529cbe68cSJohannes Berg  * @mesh_id_len: (private) Used by the internal configuration code
507629cbe68cSJohannes Berg  * @mesh_id_up_len: (private) Used by the internal configuration code
5077d3236553SJohannes Berg  * @wext: (private) Used by the internal wireless extensions compat code
50789874b71fSJohannes Berg  * @wext.ibss: (private) IBSS data part of wext handling
50799874b71fSJohannes Berg  * @wext.connect: (private) connection handling data
50809874b71fSJohannes Berg  * @wext.keys: (private) (WEP) key data
50819874b71fSJohannes Berg  * @wext.ie: (private) extra elements for association
50829874b71fSJohannes Berg  * @wext.ie_len: (private) length of extra elements
50839874b71fSJohannes Berg  * @wext.bssid: (private) selected network BSSID
50849874b71fSJohannes Berg  * @wext.ssid: (private) selected network SSID
50859874b71fSJohannes Berg  * @wext.default_key: (private) selected default key index
50869874b71fSJohannes Berg  * @wext.default_mgmt_key: (private) selected default management key index
50879874b71fSJohannes Berg  * @wext.prev_bssid: (private) previous BSSID for reassociation
50889874b71fSJohannes Berg  * @wext.prev_bssid_valid: (private) previous BSSID validity
50899bc383deSJohannes Berg  * @use_4addr: indicates 4addr mode is used on this interface, must be
50909bc383deSJohannes Berg  *	set by driver (if supported) on add_interface BEFORE registering the
50919bc383deSJohannes Berg  *	netdev and may otherwise be used by driver read-only, will be update
50929bc383deSJohannes Berg  *	by cfg80211 on change_interface
50932e161f78SJohannes Berg  * @mgmt_registrations: list of registrations for management frames
50942e161f78SJohannes Berg  * @mgmt_registrations_lock: lock for the list
509579ea1e12SJohannes Berg  * @mgmt_registrations_need_update: mgmt registrations were updated,
509679ea1e12SJohannes Berg  *	need to propagate the update to the driver
50978d61ffa5SJohannes Berg  * @mtx: mutex used to lock data in this struct, may be used by drivers
50988d61ffa5SJohannes Berg  *	and some API functions require it held
509956d1893dSJohannes Berg  * @beacon_interval: beacon interval used on this device for transmitting
510056d1893dSJohannes Berg  *	beacons, 0 when not valid
510198104fdeSJohannes Berg  * @address: The address for this device, valid only if @netdev is %NULL
510273c7da3dSArend Van Spriel  * @is_running: true if this is a non-netdev device that has been started, e.g.
510373c7da3dSArend Van Spriel  *	the P2P Device.
510404f39047SSimon Wunderlich  * @cac_started: true if DFS channel availability check has been started
510504f39047SSimon Wunderlich  * @cac_start_time: timestamp (jiffies) when the dfs state was entered.
510631559f35SJanusz Dziedzic  * @cac_time_ms: CAC time in ms
5107780b40dfSJohannes Berg  * @ps: powersave mode is enabled
5108780b40dfSJohannes Berg  * @ps_timeout: dynamic powersave timeout
5109780b40dfSJohannes Berg  * @ap_unexpected_nlportid: (private) netlink port ID of application
5110780b40dfSJohannes Berg  *	registered for unexpected class 3 frames (AP mode)
5111780b40dfSJohannes Berg  * @conn: (private) cfg80211 software SME connection state machine data
5112780b40dfSJohannes Berg  * @connect_keys: (private) keys to set after connection is established
511334d50519SLior David  * @conn_bss_type: connecting/connected BSS type
5114bd2522b1SAndrzej Zaborowski  * @conn_owner_nlportid: (private) connection owner socket port ID
5115bd2522b1SAndrzej Zaborowski  * @disconnect_wk: (private) auto-disconnect work
5116bd2522b1SAndrzej Zaborowski  * @disconnect_bssid: (private) the BSSID to use for auto-disconnect
5117780b40dfSJohannes Berg  * @ibss_fixed: (private) IBSS is using fixed BSSID
51185336fa88SSimon Wunderlich  * @ibss_dfs_possible: (private) IBSS may change to a DFS channel
5119780b40dfSJohannes Berg  * @event_list: (private) list for internal event processing
5120780b40dfSJohannes Berg  * @event_lock: (private) lock for event list
512178f22b6aSJohannes Berg  * @owner_nlportid: (private) owner socket port ID
5122ab81007aSJohannes Berg  * @nl_owner_dead: (private) owner socket went away
51234a4b8169SAndrew Zaborowski  * @cqm_config: (private) nl80211 RSSI monitor state
51249bb7e0f2SJohannes Berg  * @pmsr_list: (private) peer measurement requests
51259bb7e0f2SJohannes Berg  * @pmsr_lock: (private) peer measurements requests/results lock
51269bb7e0f2SJohannes Berg  * @pmsr_free_wk: (private) peer measurements cleanup work
51274d797fceSJouni Malinen  * @unprot_beacon_reported: (private) timestamp of last
51284d797fceSJouni Malinen  *	unprotected beacon report
5129d3236553SJohannes Berg  */
5130d3236553SJohannes Berg struct wireless_dev {
5131d3236553SJohannes Berg 	struct wiphy *wiphy;
5132d3236553SJohannes Berg 	enum nl80211_iftype iftype;
5133d3236553SJohannes Berg 
5134667503ddSJohannes Berg 	/* the remainder of this struct should be private to cfg80211 */
5135d3236553SJohannes Berg 	struct list_head list;
5136d3236553SJohannes Berg 	struct net_device *netdev;
5137d3236553SJohannes Berg 
513889a54e48SJohannes Berg 	u32 identifier;
513989a54e48SJohannes Berg 
51402e161f78SJohannes Berg 	struct list_head mgmt_registrations;
51412e161f78SJohannes Berg 	spinlock_t mgmt_registrations_lock;
514279ea1e12SJohannes Berg 	u8 mgmt_registrations_need_update:1;
5143026331c4SJouni Malinen 
5144667503ddSJohannes Berg 	struct mutex mtx;
5145667503ddSJohannes Berg 
514673c7da3dSArend Van Spriel 	bool use_4addr, is_running;
514798104fdeSJohannes Berg 
514898104fdeSJohannes Berg 	u8 address[ETH_ALEN] __aligned(sizeof(u16));
51499bc383deSJohannes Berg 
5150b23aa676SSamuel Ortiz 	/* currently used for IBSS and SME - might be rearranged later */
5151d3236553SJohannes Berg 	u8 ssid[IEEE80211_MAX_SSID_LEN];
515229cbe68cSJohannes Berg 	u8 ssid_len, mesh_id_len, mesh_id_up_len;
51536829c878SJohannes Berg 	struct cfg80211_conn *conn;
5154fffd0934SJohannes Berg 	struct cfg80211_cached_keys *connect_keys;
515534d50519SLior David 	enum ieee80211_bss_type conn_bss_type;
5156bd2522b1SAndrzej Zaborowski 	u32 conn_owner_nlportid;
5157bd2522b1SAndrzej Zaborowski 
5158bd2522b1SAndrzej Zaborowski 	struct work_struct disconnect_wk;
5159bd2522b1SAndrzej Zaborowski 	u8 disconnect_bssid[ETH_ALEN];
5160d3236553SJohannes Berg 
5161667503ddSJohannes Berg 	struct list_head event_list;
5162667503ddSJohannes Berg 	spinlock_t event_lock;
5163667503ddSJohannes Berg 
516419957bb3SJohannes Berg 	struct cfg80211_internal_bss *current_bss; /* associated / joined */
5165683b6d3bSJohannes Berg 	struct cfg80211_chan_def preset_chandef;
51669e0e2961SMichal Kazior 	struct cfg80211_chan_def chandef;
5167f4489ebeSMichal Kazior 
5168c30a3d38SMichal Kazior 	bool ibss_fixed;
51695336fa88SSimon Wunderlich 	bool ibss_dfs_possible;
5170c30a3d38SMichal Kazior 
5171ffb9eb3dSKalle Valo 	bool ps;
5172ffb9eb3dSKalle Valo 	int ps_timeout;
5173ffb9eb3dSKalle Valo 
517456d1893dSJohannes Berg 	int beacon_interval;
517556d1893dSJohannes Berg 
517615e47304SEric W. Biederman 	u32 ap_unexpected_nlportid;
517728946da7SJohannes Berg 
5178ab81007aSJohannes Berg 	u32 owner_nlportid;
5179ab81007aSJohannes Berg 	bool nl_owner_dead;
5180ab81007aSJohannes Berg 
518104f39047SSimon Wunderlich 	bool cac_started;
518204f39047SSimon Wunderlich 	unsigned long cac_start_time;
518331559f35SJanusz Dziedzic 	unsigned int cac_time_ms;
518404f39047SSimon Wunderlich 
51853d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT
5186d3236553SJohannes Berg 	/* wext data */
5187cbe8fa9cSJohannes Berg 	struct {
5188cbe8fa9cSJohannes Berg 		struct cfg80211_ibss_params ibss;
5189f2129354SJohannes Berg 		struct cfg80211_connect_params connect;
5190fffd0934SJohannes Berg 		struct cfg80211_cached_keys *keys;
5191c1e5f471SJohannes Berg 		const u8 *ie;
5192f2129354SJohannes Berg 		size_t ie_len;
51939874b71fSJohannes Berg 		u8 bssid[ETH_ALEN];
51949874b71fSJohannes Berg 		u8 prev_bssid[ETH_ALEN];
5195f2129354SJohannes Berg 		u8 ssid[IEEE80211_MAX_SSID_LEN];
519608645126SJohannes Berg 		s8 default_key, default_mgmt_key;
5197ffb9eb3dSKalle Valo 		bool prev_bssid_valid;
5198cbe8fa9cSJohannes Berg 	} wext;
5199d3236553SJohannes Berg #endif
52004a4b8169SAndrew Zaborowski 
52014a4b8169SAndrew Zaborowski 	struct cfg80211_cqm_config *cqm_config;
52029bb7e0f2SJohannes Berg 
52039bb7e0f2SJohannes Berg 	struct list_head pmsr_list;
52049bb7e0f2SJohannes Berg 	spinlock_t pmsr_lock;
52059bb7e0f2SJohannes Berg 	struct work_struct pmsr_free_wk;
52064d797fceSJouni Malinen 
52074d797fceSJouni Malinen 	unsigned long unprot_beacon_reported;
5208d3236553SJohannes Berg };
5209d3236553SJohannes Berg 
521098104fdeSJohannes Berg static inline u8 *wdev_address(struct wireless_dev *wdev)
521198104fdeSJohannes Berg {
521298104fdeSJohannes Berg 	if (wdev->netdev)
521398104fdeSJohannes Berg 		return wdev->netdev->dev_addr;
521498104fdeSJohannes Berg 	return wdev->address;
521598104fdeSJohannes Berg }
521698104fdeSJohannes Berg 
521773c7da3dSArend Van Spriel static inline bool wdev_running(struct wireless_dev *wdev)
521873c7da3dSArend Van Spriel {
521973c7da3dSArend Van Spriel 	if (wdev->netdev)
522073c7da3dSArend Van Spriel 		return netif_running(wdev->netdev);
522173c7da3dSArend Van Spriel 	return wdev->is_running;
522273c7da3dSArend Van Spriel }
522373c7da3dSArend Van Spriel 
5224d3236553SJohannes Berg /**
5225d3236553SJohannes Berg  * wdev_priv - return wiphy priv from wireless_dev
5226d3236553SJohannes Berg  *
5227d3236553SJohannes Berg  * @wdev: The wireless device whose wiphy's priv pointer to return
52280ae997dcSYacine Belkadi  * Return: The wiphy priv of @wdev.
5229d3236553SJohannes Berg  */
5230d3236553SJohannes Berg static inline void *wdev_priv(struct wireless_dev *wdev)
5231d3236553SJohannes Berg {
5232d3236553SJohannes Berg 	BUG_ON(!wdev);
5233d3236553SJohannes Berg 	return wiphy_priv(wdev->wiphy);
5234d3236553SJohannes Berg }
5235d3236553SJohannes Berg 
5236d70e9693SJohannes Berg /**
5237d70e9693SJohannes Berg  * DOC: Utility functions
5238d70e9693SJohannes Berg  *
5239d70e9693SJohannes Berg  * cfg80211 offers a number of utility functions that can be useful.
5240d3236553SJohannes Berg  */
5241d3236553SJohannes Berg 
5242d3236553SJohannes Berg /**
5243934f4c7dSThomas Pedersen  * ieee80211_channel_equal - compare two struct ieee80211_channel
5244934f4c7dSThomas Pedersen  *
5245934f4c7dSThomas Pedersen  * @a: 1st struct ieee80211_channel
5246934f4c7dSThomas Pedersen  * @b: 2nd struct ieee80211_channel
5247934f4c7dSThomas Pedersen  * Return: true if center frequency of @a == @b
5248934f4c7dSThomas Pedersen  */
5249934f4c7dSThomas Pedersen static inline bool
5250934f4c7dSThomas Pedersen ieee80211_channel_equal(struct ieee80211_channel *a,
5251934f4c7dSThomas Pedersen 			struct ieee80211_channel *b)
5252934f4c7dSThomas Pedersen {
5253934f4c7dSThomas Pedersen 	return (a->center_freq == b->center_freq &&
5254934f4c7dSThomas Pedersen 		a->freq_offset == b->freq_offset);
5255934f4c7dSThomas Pedersen }
5256934f4c7dSThomas Pedersen 
5257934f4c7dSThomas Pedersen /**
5258934f4c7dSThomas Pedersen  * ieee80211_channel_to_khz - convert ieee80211_channel to frequency in KHz
5259934f4c7dSThomas Pedersen  * @chan: struct ieee80211_channel to convert
5260934f4c7dSThomas Pedersen  * Return: The corresponding frequency (in KHz)
5261934f4c7dSThomas Pedersen  */
5262934f4c7dSThomas Pedersen static inline u32
5263934f4c7dSThomas Pedersen ieee80211_channel_to_khz(const struct ieee80211_channel *chan)
5264934f4c7dSThomas Pedersen {
5265934f4c7dSThomas Pedersen 	return MHZ_TO_KHZ(chan->center_freq) + chan->freq_offset;
5266934f4c7dSThomas Pedersen }
5267934f4c7dSThomas Pedersen 
5268934f4c7dSThomas Pedersen /**
5269934f4c7dSThomas Pedersen  * ieee80211_channel_to_freq_khz - convert channel number to frequency
5270934f4c7dSThomas Pedersen  * @chan: channel number
5271934f4c7dSThomas Pedersen  * @band: band, necessary due to channel number overlap
5272934f4c7dSThomas Pedersen  * Return: The corresponding frequency (in KHz), or 0 if the conversion failed.
5273934f4c7dSThomas Pedersen  */
5274934f4c7dSThomas Pedersen u32 ieee80211_channel_to_freq_khz(int chan, enum nl80211_band band);
5275934f4c7dSThomas Pedersen 
5276934f4c7dSThomas Pedersen /**
5277d3236553SJohannes Berg  * ieee80211_channel_to_frequency - convert channel number to frequency
5278abe37c4bSJohannes Berg  * @chan: channel number
527959eb21a6SBruno Randolf  * @band: band, necessary due to channel number overlap
52800ae997dcSYacine Belkadi  * Return: The corresponding frequency (in MHz), or 0 if the conversion failed.
5281d3236553SJohannes Berg  */
5282934f4c7dSThomas Pedersen static inline int
5283934f4c7dSThomas Pedersen ieee80211_channel_to_frequency(int chan, enum nl80211_band band)
5284934f4c7dSThomas Pedersen {
5285934f4c7dSThomas Pedersen 	return KHZ_TO_MHZ(ieee80211_channel_to_freq_khz(chan, band));
5286934f4c7dSThomas Pedersen }
5287934f4c7dSThomas Pedersen 
5288934f4c7dSThomas Pedersen /**
5289934f4c7dSThomas Pedersen  * ieee80211_freq_khz_to_channel - convert frequency to channel number
5290934f4c7dSThomas Pedersen  * @freq: center frequency in KHz
5291934f4c7dSThomas Pedersen  * Return: The corresponding channel, or 0 if the conversion failed.
5292934f4c7dSThomas Pedersen  */
5293934f4c7dSThomas Pedersen int ieee80211_freq_khz_to_channel(u32 freq);
5294d3236553SJohannes Berg 
5295d3236553SJohannes Berg /**
5296d3236553SJohannes Berg  * ieee80211_frequency_to_channel - convert frequency to channel number
5297934f4c7dSThomas Pedersen  * @freq: center frequency in MHz
52980ae997dcSYacine Belkadi  * Return: The corresponding channel, or 0 if the conversion failed.
5299d3236553SJohannes Berg  */
5300934f4c7dSThomas Pedersen static inline int
5301934f4c7dSThomas Pedersen ieee80211_frequency_to_channel(int freq)
5302934f4c7dSThomas Pedersen {
5303934f4c7dSThomas Pedersen 	return ieee80211_freq_khz_to_channel(MHZ_TO_KHZ(freq));
5304934f4c7dSThomas Pedersen }
5305934f4c7dSThomas Pedersen 
5306934f4c7dSThomas Pedersen /**
5307934f4c7dSThomas Pedersen  * ieee80211_get_channel_khz - get channel struct from wiphy for specified
5308934f4c7dSThomas Pedersen  * frequency
5309934f4c7dSThomas Pedersen  * @wiphy: the struct wiphy to get the channel for
5310934f4c7dSThomas Pedersen  * @freq: the center frequency (in KHz) of the channel
5311934f4c7dSThomas Pedersen  * Return: The channel struct from @wiphy at @freq.
5312934f4c7dSThomas Pedersen  */
5313934f4c7dSThomas Pedersen struct ieee80211_channel *
5314934f4c7dSThomas Pedersen ieee80211_get_channel_khz(struct wiphy *wiphy, u32 freq);
5315d3236553SJohannes Berg 
5316d3236553SJohannes Berg /**
5317d3236553SJohannes Berg  * ieee80211_get_channel - get channel struct from wiphy for specified frequency
5318543b921bSArend Van Spriel  *
5319abe37c4bSJohannes Berg  * @wiphy: the struct wiphy to get the channel for
5320934f4c7dSThomas Pedersen  * @freq: the center frequency (in MHz) of the channel
53210ae997dcSYacine Belkadi  * Return: The channel struct from @wiphy at @freq.
5322d3236553SJohannes Berg  */
5323934f4c7dSThomas Pedersen static inline struct ieee80211_channel *
5324934f4c7dSThomas Pedersen ieee80211_get_channel(struct wiphy *wiphy, int freq)
5325934f4c7dSThomas Pedersen {
5326934f4c7dSThomas Pedersen 	return ieee80211_get_channel_khz(wiphy, MHZ_TO_KHZ(freq));
5327934f4c7dSThomas Pedersen }
5328d3236553SJohannes Berg 
5329d3236553SJohannes Berg /**
5330afbc9c9eSJohannes Berg  * cfg80211_channel_is_psc - Check if the channel is a 6 GHz PSC
5331afbc9c9eSJohannes Berg  * @chan: control channel to check
5332afbc9c9eSJohannes Berg  *
5333afbc9c9eSJohannes Berg  * The Preferred Scanning Channels (PSC) are defined in
5334afbc9c9eSJohannes Berg  * Draft IEEE P802.11ax/D5.0, 26.17.2.3.3
5335afbc9c9eSJohannes Berg  */
5336afbc9c9eSJohannes Berg static inline bool cfg80211_channel_is_psc(struct ieee80211_channel *chan)
5337afbc9c9eSJohannes Berg {
5338afbc9c9eSJohannes Berg 	if (chan->band != NL80211_BAND_6GHZ)
5339afbc9c9eSJohannes Berg 		return false;
5340afbc9c9eSJohannes Berg 
5341afbc9c9eSJohannes Berg 	return ieee80211_frequency_to_channel(chan->center_freq) % 16 == 5;
5342afbc9c9eSJohannes Berg }
5343afbc9c9eSJohannes Berg 
5344afbc9c9eSJohannes Berg /**
5345d3236553SJohannes Berg  * ieee80211_get_response_rate - get basic rate for a given rate
5346d3236553SJohannes Berg  *
5347d3236553SJohannes Berg  * @sband: the band to look for rates in
5348d3236553SJohannes Berg  * @basic_rates: bitmap of basic rates
5349d3236553SJohannes Berg  * @bitrate: the bitrate for which to find the basic rate
5350d3236553SJohannes Berg  *
53510ae997dcSYacine Belkadi  * Return: The basic rate corresponding to a given bitrate, that
53520ae997dcSYacine Belkadi  * is the next lower bitrate contained in the basic rate map,
53530ae997dcSYacine Belkadi  * which is, for this function, given as a bitmap of indices of
53540ae997dcSYacine Belkadi  * rates in the band's bitrate table.
5355d3236553SJohannes Berg  */
5356d3236553SJohannes Berg struct ieee80211_rate *
5357d3236553SJohannes Berg ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
5358d3236553SJohannes Berg 			    u32 basic_rates, int bitrate);
5359d3236553SJohannes Berg 
5360b422c6cdSAshok Nagarajan /**
5361b422c6cdSAshok Nagarajan  * ieee80211_mandatory_rates - get mandatory rates for a given band
5362b422c6cdSAshok Nagarajan  * @sband: the band to look for rates in
536374608acaSSimon Wunderlich  * @scan_width: width of the control channel
5364b422c6cdSAshok Nagarajan  *
5365b422c6cdSAshok Nagarajan  * This function returns a bitmap of the mandatory rates for the given
5366b422c6cdSAshok Nagarajan  * band, bits are set according to the rate position in the bitrates array.
5367b422c6cdSAshok Nagarajan  */
536874608acaSSimon Wunderlich u32 ieee80211_mandatory_rates(struct ieee80211_supported_band *sband,
536974608acaSSimon Wunderlich 			      enum nl80211_bss_scan_width scan_width);
5370b422c6cdSAshok Nagarajan 
5371d3236553SJohannes Berg /*
5372d3236553SJohannes Berg  * Radiotap parsing functions -- for controlled injection support
5373d3236553SJohannes Berg  *
5374d3236553SJohannes Berg  * Implemented in net/wireless/radiotap.c
537566d495d0SMauro Carvalho Chehab  * Documentation in Documentation/networking/radiotap-headers.rst
5376d3236553SJohannes Berg  */
5377d3236553SJohannes Berg 
537833e5a2f7SJohannes Berg struct radiotap_align_size {
537933e5a2f7SJohannes Berg 	uint8_t align:4, size:4;
538033e5a2f7SJohannes Berg };
538133e5a2f7SJohannes Berg 
538233e5a2f7SJohannes Berg struct ieee80211_radiotap_namespace {
538333e5a2f7SJohannes Berg 	const struct radiotap_align_size *align_size;
538433e5a2f7SJohannes Berg 	int n_bits;
538533e5a2f7SJohannes Berg 	uint32_t oui;
538633e5a2f7SJohannes Berg 	uint8_t subns;
538733e5a2f7SJohannes Berg };
538833e5a2f7SJohannes Berg 
538933e5a2f7SJohannes Berg struct ieee80211_radiotap_vendor_namespaces {
539033e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_namespace *ns;
539133e5a2f7SJohannes Berg 	int n_ns;
539233e5a2f7SJohannes Berg };
539333e5a2f7SJohannes Berg 
5394d3236553SJohannes Berg /**
5395d3236553SJohannes Berg  * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args
539633e5a2f7SJohannes Berg  * @this_arg_index: index of current arg, valid after each successful call
539733e5a2f7SJohannes Berg  *	to ieee80211_radiotap_iterator_next()
539833e5a2f7SJohannes Berg  * @this_arg: pointer to current radiotap arg; it is valid after each
539933e5a2f7SJohannes Berg  *	call to ieee80211_radiotap_iterator_next() but also after
540033e5a2f7SJohannes Berg  *	ieee80211_radiotap_iterator_init() where it will point to
540133e5a2f7SJohannes Berg  *	the beginning of the actual data portion
540233e5a2f7SJohannes Berg  * @this_arg_size: length of the current arg, for convenience
540333e5a2f7SJohannes Berg  * @current_namespace: pointer to the current namespace definition
540433e5a2f7SJohannes Berg  *	(or internally %NULL if the current namespace is unknown)
540533e5a2f7SJohannes Berg  * @is_radiotap_ns: indicates whether the current namespace is the default
540633e5a2f7SJohannes Berg  *	radiotap namespace or not
540733e5a2f7SJohannes Berg  *
540833e5a2f7SJohannes Berg  * @_rtheader: pointer to the radiotap header we are walking through
540933e5a2f7SJohannes Berg  * @_max_length: length of radiotap header in cpu byte ordering
541033e5a2f7SJohannes Berg  * @_arg_index: next argument index
541133e5a2f7SJohannes Berg  * @_arg: next argument pointer
541233e5a2f7SJohannes Berg  * @_next_bitmap: internal pointer to next present u32
541333e5a2f7SJohannes Berg  * @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present
541433e5a2f7SJohannes Berg  * @_vns: vendor namespace definitions
541533e5a2f7SJohannes Berg  * @_next_ns_data: beginning of the next namespace's data
541633e5a2f7SJohannes Berg  * @_reset_on_ext: internal; reset the arg index to 0 when going to the
541733e5a2f7SJohannes Berg  *	next bitmap word
541833e5a2f7SJohannes Berg  *
541933e5a2f7SJohannes Berg  * Describes the radiotap parser state. Fields prefixed with an underscore
542033e5a2f7SJohannes Berg  * must not be used by users of the parser, only by the parser internally.
5421d3236553SJohannes Berg  */
5422d3236553SJohannes Berg 
5423d3236553SJohannes Berg struct ieee80211_radiotap_iterator {
542433e5a2f7SJohannes Berg 	struct ieee80211_radiotap_header *_rtheader;
542533e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_vendor_namespaces *_vns;
542633e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_namespace *current_namespace;
5427d3236553SJohannes Berg 
542833e5a2f7SJohannes Berg 	unsigned char *_arg, *_next_ns_data;
542967272440SJohannes Berg 	__le32 *_next_bitmap;
543033e5a2f7SJohannes Berg 
543133e5a2f7SJohannes Berg 	unsigned char *this_arg;
543233e5a2f7SJohannes Berg 	int this_arg_index;
543333e5a2f7SJohannes Berg 	int this_arg_size;
543433e5a2f7SJohannes Berg 
543533e5a2f7SJohannes Berg 	int is_radiotap_ns;
543633e5a2f7SJohannes Berg 
543733e5a2f7SJohannes Berg 	int _max_length;
543833e5a2f7SJohannes Berg 	int _arg_index;
543933e5a2f7SJohannes Berg 	uint32_t _bitmap_shifter;
544033e5a2f7SJohannes Berg 	int _reset_on_ext;
5441d3236553SJohannes Berg };
5442d3236553SJohannes Berg 
544310dd9b7cSJoe Perches int
544410dd9b7cSJoe Perches ieee80211_radiotap_iterator_init(struct ieee80211_radiotap_iterator *iterator,
5445d3236553SJohannes Berg 				 struct ieee80211_radiotap_header *radiotap_header,
544610dd9b7cSJoe Perches 				 int max_length,
544710dd9b7cSJoe Perches 				 const struct ieee80211_radiotap_vendor_namespaces *vns);
5448d3236553SJohannes Berg 
544910dd9b7cSJoe Perches int
545010dd9b7cSJoe Perches ieee80211_radiotap_iterator_next(struct ieee80211_radiotap_iterator *iterator);
5451d3236553SJohannes Berg 
545233e5a2f7SJohannes Berg 
5453e31a16d6SZhu Yi extern const unsigned char rfc1042_header[6];
5454e31a16d6SZhu Yi extern const unsigned char bridge_tunnel_header[6];
5455e31a16d6SZhu Yi 
5456e31a16d6SZhu Yi /**
5457e31a16d6SZhu Yi  * ieee80211_get_hdrlen_from_skb - get header length from data
5458e31a16d6SZhu Yi  *
5459e31a16d6SZhu Yi  * @skb: the frame
54600ae997dcSYacine Belkadi  *
54610ae997dcSYacine Belkadi  * Given an skb with a raw 802.11 header at the data pointer this function
54620ae997dcSYacine Belkadi  * returns the 802.11 header length.
54630ae997dcSYacine Belkadi  *
54640ae997dcSYacine Belkadi  * Return: The 802.11 header length in bytes (not including encryption
54650ae997dcSYacine Belkadi  * headers). Or 0 if the data in the sk_buff is too short to contain a valid
54660ae997dcSYacine Belkadi  * 802.11 header.
5467e31a16d6SZhu Yi  */
5468e31a16d6SZhu Yi unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb);
5469e31a16d6SZhu Yi 
5470e31a16d6SZhu Yi /**
5471e31a16d6SZhu Yi  * ieee80211_hdrlen - get header length in bytes from frame control
5472e31a16d6SZhu Yi  * @fc: frame control field in little-endian format
54730ae997dcSYacine Belkadi  * Return: The header length in bytes.
5474e31a16d6SZhu Yi  */
5475633adf1aSJohannes Berg unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc);
5476e31a16d6SZhu Yi 
5477e31a16d6SZhu Yi /**
54789b395bc3SJohannes Berg  * ieee80211_get_mesh_hdrlen - get mesh extension header length
54799b395bc3SJohannes Berg  * @meshhdr: the mesh extension header, only the flags field
54809b395bc3SJohannes Berg  *	(first byte) will be accessed
54810ae997dcSYacine Belkadi  * Return: The length of the extension header, which is always at
54829b395bc3SJohannes Berg  * least 6 bytes and at most 18 if address 5 and 6 are present.
54839b395bc3SJohannes Berg  */
54849b395bc3SJohannes Berg unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr);
54859b395bc3SJohannes Berg 
54869b395bc3SJohannes Berg /**
5487d70e9693SJohannes Berg  * DOC: Data path helpers
5488d70e9693SJohannes Berg  *
5489d70e9693SJohannes Berg  * In addition to generic utilities, cfg80211 also offers
5490d70e9693SJohannes Berg  * functions that help implement the data path for devices
5491d70e9693SJohannes Berg  * that do not do the 802.11/802.3 conversion on the device.
5492d70e9693SJohannes Berg  */
5493d70e9693SJohannes Berg 
5494d70e9693SJohannes Berg /**
54957f6990c8SJohannes Berg  * ieee80211_data_to_8023_exthdr - convert an 802.11 data frame to 802.3
54967f6990c8SJohannes Berg  * @skb: the 802.11 data frame
54977f6990c8SJohannes Berg  * @ehdr: pointer to a &struct ethhdr that will get the header, instead
54987f6990c8SJohannes Berg  *	of it being pushed into the SKB
54997f6990c8SJohannes Berg  * @addr: the device MAC address
55007f6990c8SJohannes Berg  * @iftype: the virtual interface type
550124bba078SFelix Fietkau  * @data_offset: offset of payload after the 802.11 header
55027f6990c8SJohannes Berg  * Return: 0 on success. Non-zero on error.
55037f6990c8SJohannes Berg  */
55047f6990c8SJohannes Berg int ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr,
550524bba078SFelix Fietkau 				  const u8 *addr, enum nl80211_iftype iftype,
550624bba078SFelix Fietkau 				  u8 data_offset);
55077f6990c8SJohannes Berg 
55087f6990c8SJohannes Berg /**
5509e31a16d6SZhu Yi  * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3
5510e31a16d6SZhu Yi  * @skb: the 802.11 data frame
5511e31a16d6SZhu Yi  * @addr: the device MAC address
5512e31a16d6SZhu Yi  * @iftype: the virtual interface type
55130ae997dcSYacine Belkadi  * Return: 0 on success. Non-zero on error.
5514e31a16d6SZhu Yi  */
55157f6990c8SJohannes Berg static inline int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
55167f6990c8SJohannes Berg 					 enum nl80211_iftype iftype)
55177f6990c8SJohannes Berg {
551824bba078SFelix Fietkau 	return ieee80211_data_to_8023_exthdr(skb, NULL, addr, iftype, 0);
55197f6990c8SJohannes Berg }
5520e31a16d6SZhu Yi 
5521e31a16d6SZhu Yi /**
5522eaf85ca7SZhu Yi  * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame
5523eaf85ca7SZhu Yi  *
55247f6990c8SJohannes Berg  * Decode an IEEE 802.11 A-MSDU and convert it to a list of 802.3 frames.
55257f6990c8SJohannes Berg  * The @list will be empty if the decode fails. The @skb must be fully
55267f6990c8SJohannes Berg  * header-less before being passed in here; it is freed in this function.
5527eaf85ca7SZhu Yi  *
55287f6990c8SJohannes Berg  * @skb: The input A-MSDU frame without any headers.
5529eaf85ca7SZhu Yi  * @list: The output list of 802.3 frames. It must be allocated and
5530*085a6c10SRandy Dunlap  *	initialized by the caller.
5531eaf85ca7SZhu Yi  * @addr: The device MAC address.
5532eaf85ca7SZhu Yi  * @iftype: The device interface type.
5533eaf85ca7SZhu Yi  * @extra_headroom: The hardware extra headroom for SKBs in the @list.
55348b935ee2SJohannes Berg  * @check_da: DA to check in the inner ethernet header, or NULL
55358b935ee2SJohannes Berg  * @check_sa: SA to check in the inner ethernet header, or NULL
5536eaf85ca7SZhu Yi  */
5537eaf85ca7SZhu Yi void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,
5538eaf85ca7SZhu Yi 			      const u8 *addr, enum nl80211_iftype iftype,
55398b3becadSYogesh Ashok Powar 			      const unsigned int extra_headroom,
55408b935ee2SJohannes Berg 			      const u8 *check_da, const u8 *check_sa);
5541eaf85ca7SZhu Yi 
5542eaf85ca7SZhu Yi /**
5543e31a16d6SZhu Yi  * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame
5544e31a16d6SZhu Yi  * @skb: the data frame
5545fa9ffc74SKyeyoon Park  * @qos_map: Interworking QoS mapping or %NULL if not in use
55460ae997dcSYacine Belkadi  * Return: The 802.1p/1d tag.
5547e31a16d6SZhu Yi  */
5548fa9ffc74SKyeyoon Park unsigned int cfg80211_classify8021d(struct sk_buff *skb,
5549fa9ffc74SKyeyoon Park 				    struct cfg80211_qos_map *qos_map);
5550e31a16d6SZhu Yi 
5551c21dbf92SJohannes Berg /**
555249a68e0dSJohannes Berg  * cfg80211_find_elem_match - match information element and byte array in data
555349a68e0dSJohannes Berg  *
555449a68e0dSJohannes Berg  * @eid: element ID
555549a68e0dSJohannes Berg  * @ies: data consisting of IEs
555649a68e0dSJohannes Berg  * @len: length of data
555749a68e0dSJohannes Berg  * @match: byte array to match
555849a68e0dSJohannes Berg  * @match_len: number of bytes in the match array
555949a68e0dSJohannes Berg  * @match_offset: offset in the IE data where the byte array should match.
556049a68e0dSJohannes Berg  *	Note the difference to cfg80211_find_ie_match() which considers
556149a68e0dSJohannes Berg  *	the offset to start from the element ID byte, but here we take
556249a68e0dSJohannes Berg  *	the data portion instead.
556349a68e0dSJohannes Berg  *
556449a68e0dSJohannes Berg  * Return: %NULL if the element ID could not be found or if
556549a68e0dSJohannes Berg  * the element is invalid (claims to be longer than the given
556649a68e0dSJohannes Berg  * data) or if the byte array doesn't match; otherwise return the
556749a68e0dSJohannes Berg  * requested element struct.
556849a68e0dSJohannes Berg  *
556949a68e0dSJohannes Berg  * Note: There are no checks on the element length other than
557049a68e0dSJohannes Berg  * having to fit into the given data and being large enough for the
557149a68e0dSJohannes Berg  * byte array to match.
557249a68e0dSJohannes Berg  */
557349a68e0dSJohannes Berg const struct element *
557449a68e0dSJohannes Berg cfg80211_find_elem_match(u8 eid, const u8 *ies, unsigned int len,
557549a68e0dSJohannes Berg 			 const u8 *match, unsigned int match_len,
557649a68e0dSJohannes Berg 			 unsigned int match_offset);
557749a68e0dSJohannes Berg 
557849a68e0dSJohannes Berg /**
5579fbd05e4aSLuca Coelho  * cfg80211_find_ie_match - match information element and byte array in data
5580fbd05e4aSLuca Coelho  *
5581fbd05e4aSLuca Coelho  * @eid: element ID
5582fbd05e4aSLuca Coelho  * @ies: data consisting of IEs
5583fbd05e4aSLuca Coelho  * @len: length of data
5584fbd05e4aSLuca Coelho  * @match: byte array to match
5585fbd05e4aSLuca Coelho  * @match_len: number of bytes in the match array
5586fbd05e4aSLuca Coelho  * @match_offset: offset in the IE where the byte array should match.
5587fbd05e4aSLuca Coelho  *	If match_len is zero, this must also be set to zero.
5588fbd05e4aSLuca Coelho  *	Otherwise this must be set to 2 or more, because the first
5589fbd05e4aSLuca Coelho  *	byte is the element id, which is already compared to eid, and
5590fbd05e4aSLuca Coelho  *	the second byte is the IE length.
5591fbd05e4aSLuca Coelho  *
5592fbd05e4aSLuca Coelho  * Return: %NULL if the element ID could not be found or if
5593fbd05e4aSLuca Coelho  * the element is invalid (claims to be longer than the given
5594fbd05e4aSLuca Coelho  * data) or if the byte array doesn't match, or a pointer to the first
5595fbd05e4aSLuca Coelho  * byte of the requested element, that is the byte containing the
5596fbd05e4aSLuca Coelho  * element ID.
5597fbd05e4aSLuca Coelho  *
5598fbd05e4aSLuca Coelho  * Note: There are no checks on the element length other than
5599fbd05e4aSLuca Coelho  * having to fit into the given data and being large enough for the
5600fbd05e4aSLuca Coelho  * byte array to match.
5601fbd05e4aSLuca Coelho  */
560249a68e0dSJohannes Berg static inline const u8 *
560349a68e0dSJohannes Berg cfg80211_find_ie_match(u8 eid, const u8 *ies, unsigned int len,
560449a68e0dSJohannes Berg 		       const u8 *match, unsigned int match_len,
560549a68e0dSJohannes Berg 		       unsigned int match_offset)
560649a68e0dSJohannes Berg {
560749a68e0dSJohannes Berg 	/* match_offset can't be smaller than 2, unless match_len is
560849a68e0dSJohannes Berg 	 * zero, in which case match_offset must be zero as well.
560949a68e0dSJohannes Berg 	 */
561049a68e0dSJohannes Berg 	if (WARN_ON((match_len && match_offset < 2) ||
561149a68e0dSJohannes Berg 		    (!match_len && match_offset)))
561249a68e0dSJohannes Berg 		return NULL;
561349a68e0dSJohannes Berg 
561449a68e0dSJohannes Berg 	return (void *)cfg80211_find_elem_match(eid, ies, len,
561549a68e0dSJohannes Berg 						match, match_len,
561649a68e0dSJohannes Berg 						match_offset ?
561749a68e0dSJohannes Berg 							match_offset - 2 : 0);
561849a68e0dSJohannes Berg }
561949a68e0dSJohannes Berg 
562049a68e0dSJohannes Berg /**
562149a68e0dSJohannes Berg  * cfg80211_find_elem - find information element in data
562249a68e0dSJohannes Berg  *
562349a68e0dSJohannes Berg  * @eid: element ID
562449a68e0dSJohannes Berg  * @ies: data consisting of IEs
562549a68e0dSJohannes Berg  * @len: length of data
562649a68e0dSJohannes Berg  *
562749a68e0dSJohannes Berg  * Return: %NULL if the element ID could not be found or if
562849a68e0dSJohannes Berg  * the element is invalid (claims to be longer than the given
562949a68e0dSJohannes Berg  * data) or if the byte array doesn't match; otherwise return the
563049a68e0dSJohannes Berg  * requested element struct.
563149a68e0dSJohannes Berg  *
563249a68e0dSJohannes Berg  * Note: There are no checks on the element length other than
563349a68e0dSJohannes Berg  * having to fit into the given data.
563449a68e0dSJohannes Berg  */
563549a68e0dSJohannes Berg static inline const struct element *
563649a68e0dSJohannes Berg cfg80211_find_elem(u8 eid, const u8 *ies, int len)
563749a68e0dSJohannes Berg {
563849a68e0dSJohannes Berg 	return cfg80211_find_elem_match(eid, ies, len, NULL, 0, 0);
563949a68e0dSJohannes Berg }
5640fbd05e4aSLuca Coelho 
5641fbd05e4aSLuca Coelho /**
5642c21dbf92SJohannes Berg  * cfg80211_find_ie - find information element in data
5643c21dbf92SJohannes Berg  *
5644c21dbf92SJohannes Berg  * @eid: element ID
5645c21dbf92SJohannes Berg  * @ies: data consisting of IEs
5646c21dbf92SJohannes Berg  * @len: length of data
5647c21dbf92SJohannes Berg  *
56480ae997dcSYacine Belkadi  * Return: %NULL if the element ID could not be found or if
56490ae997dcSYacine Belkadi  * the element is invalid (claims to be longer than the given
56500ae997dcSYacine Belkadi  * data), or a pointer to the first byte of the requested
56510ae997dcSYacine Belkadi  * element, that is the byte containing the element ID.
56520ae997dcSYacine Belkadi  *
56530ae997dcSYacine Belkadi  * Note: There are no checks on the element length other than
56540ae997dcSYacine Belkadi  * having to fit into the given data.
5655c21dbf92SJohannes Berg  */
5656fbd05e4aSLuca Coelho static inline const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len)
5657fbd05e4aSLuca Coelho {
5658fbd05e4aSLuca Coelho 	return cfg80211_find_ie_match(eid, ies, len, NULL, 0, 0);
5659fbd05e4aSLuca Coelho }
5660c21dbf92SJohannes Berg 
5661d70e9693SJohannes Berg /**
566249a68e0dSJohannes Berg  * cfg80211_find_ext_elem - find information element with EID Extension in data
566349a68e0dSJohannes Berg  *
566449a68e0dSJohannes Berg  * @ext_eid: element ID Extension
566549a68e0dSJohannes Berg  * @ies: data consisting of IEs
566649a68e0dSJohannes Berg  * @len: length of data
566749a68e0dSJohannes Berg  *
566849a68e0dSJohannes Berg  * Return: %NULL if the etended element could not be found or if
566949a68e0dSJohannes Berg  * the element is invalid (claims to be longer than the given
567049a68e0dSJohannes Berg  * data) or if the byte array doesn't match; otherwise return the
567149a68e0dSJohannes Berg  * requested element struct.
567249a68e0dSJohannes Berg  *
567349a68e0dSJohannes Berg  * Note: There are no checks on the element length other than
567449a68e0dSJohannes Berg  * having to fit into the given data.
567549a68e0dSJohannes Berg  */
567649a68e0dSJohannes Berg static inline const struct element *
567749a68e0dSJohannes Berg cfg80211_find_ext_elem(u8 ext_eid, const u8 *ies, int len)
567849a68e0dSJohannes Berg {
567949a68e0dSJohannes Berg 	return cfg80211_find_elem_match(WLAN_EID_EXTENSION, ies, len,
568049a68e0dSJohannes Berg 					&ext_eid, 1, 0);
568149a68e0dSJohannes Berg }
568249a68e0dSJohannes Berg 
568349a68e0dSJohannes Berg /**
56843f817fe7SJouni Malinen  * cfg80211_find_ext_ie - find information element with EID Extension in data
56853f817fe7SJouni Malinen  *
56863f817fe7SJouni Malinen  * @ext_eid: element ID Extension
56873f817fe7SJouni Malinen  * @ies: data consisting of IEs
56883f817fe7SJouni Malinen  * @len: length of data
56893f817fe7SJouni Malinen  *
56903f817fe7SJouni Malinen  * Return: %NULL if the extended element ID could not be found or if
56913f817fe7SJouni Malinen  * the element is invalid (claims to be longer than the given
56923f817fe7SJouni Malinen  * data), or a pointer to the first byte of the requested
56933f817fe7SJouni Malinen  * element, that is the byte containing the element ID.
56943f817fe7SJouni Malinen  *
56953f817fe7SJouni Malinen  * Note: There are no checks on the element length other than
56963f817fe7SJouni Malinen  * having to fit into the given data.
56973f817fe7SJouni Malinen  */
56983f817fe7SJouni Malinen static inline const u8 *cfg80211_find_ext_ie(u8 ext_eid, const u8 *ies, int len)
56993f817fe7SJouni Malinen {
57003f817fe7SJouni Malinen 	return cfg80211_find_ie_match(WLAN_EID_EXTENSION, ies, len,
57013f817fe7SJouni Malinen 				      &ext_eid, 1, 2);
57023f817fe7SJouni Malinen }
57033f817fe7SJouni Malinen 
57043f817fe7SJouni Malinen /**
570549a68e0dSJohannes Berg  * cfg80211_find_vendor_elem - find vendor specific information element in data
570649a68e0dSJohannes Berg  *
570749a68e0dSJohannes Berg  * @oui: vendor OUI
570849a68e0dSJohannes Berg  * @oui_type: vendor-specific OUI type (must be < 0xff), negative means any
570949a68e0dSJohannes Berg  * @ies: data consisting of IEs
571049a68e0dSJohannes Berg  * @len: length of data
571149a68e0dSJohannes Berg  *
571249a68e0dSJohannes Berg  * Return: %NULL if the vendor specific element ID could not be found or if the
571349a68e0dSJohannes Berg  * element is invalid (claims to be longer than the given data); otherwise
571449a68e0dSJohannes Berg  * return the element structure for the requested element.
571549a68e0dSJohannes Berg  *
571649a68e0dSJohannes Berg  * Note: There are no checks on the element length other than having to fit into
571749a68e0dSJohannes Berg  * the given data.
571849a68e0dSJohannes Berg  */
571949a68e0dSJohannes Berg const struct element *cfg80211_find_vendor_elem(unsigned int oui, int oui_type,
572049a68e0dSJohannes Berg 						const u8 *ies,
572149a68e0dSJohannes Berg 						unsigned int len);
572249a68e0dSJohannes Berg 
572349a68e0dSJohannes Berg /**
57240c28ec58SEliad Peller  * cfg80211_find_vendor_ie - find vendor specific information element in data
57250c28ec58SEliad Peller  *
57260c28ec58SEliad Peller  * @oui: vendor OUI
57279e9ea439SEmmanuel Grumbach  * @oui_type: vendor-specific OUI type (must be < 0xff), negative means any
57280c28ec58SEliad Peller  * @ies: data consisting of IEs
57290c28ec58SEliad Peller  * @len: length of data
57300c28ec58SEliad Peller  *
57310ae997dcSYacine Belkadi  * Return: %NULL if the vendor specific element ID could not be found or if the
57320ae997dcSYacine Belkadi  * element is invalid (claims to be longer than the given data), or a pointer to
57330ae997dcSYacine Belkadi  * the first byte of the requested element, that is the byte containing the
57340ae997dcSYacine Belkadi  * element ID.
57350ae997dcSYacine Belkadi  *
57360ae997dcSYacine Belkadi  * Note: There are no checks on the element length other than having to fit into
57370ae997dcSYacine Belkadi  * the given data.
57380c28ec58SEliad Peller  */
573949a68e0dSJohannes Berg static inline const u8 *
574049a68e0dSJohannes Berg cfg80211_find_vendor_ie(unsigned int oui, int oui_type,
574149a68e0dSJohannes Berg 			const u8 *ies, unsigned int len)
574249a68e0dSJohannes Berg {
574349a68e0dSJohannes Berg 	return (void *)cfg80211_find_vendor_elem(oui, oui_type, ies, len);
574449a68e0dSJohannes Berg }
57450c28ec58SEliad Peller 
57460c28ec58SEliad Peller /**
574730ca1aa5SDedy Lansky  * cfg80211_send_layer2_update - send layer 2 update frame
574830ca1aa5SDedy Lansky  *
574930ca1aa5SDedy Lansky  * @dev: network device
575030ca1aa5SDedy Lansky  * @addr: STA MAC address
575130ca1aa5SDedy Lansky  *
575230ca1aa5SDedy Lansky  * Wireless drivers can use this function to update forwarding tables in bridge
575330ca1aa5SDedy Lansky  * devices upon STA association.
575430ca1aa5SDedy Lansky  */
575530ca1aa5SDedy Lansky void cfg80211_send_layer2_update(struct net_device *dev, const u8 *addr);
575630ca1aa5SDedy Lansky 
575730ca1aa5SDedy Lansky /**
5758d70e9693SJohannes Berg  * DOC: Regulatory enforcement infrastructure
5759d70e9693SJohannes Berg  *
5760d70e9693SJohannes Berg  * TODO
5761d3236553SJohannes Berg  */
5762d3236553SJohannes Berg 
5763d3236553SJohannes Berg /**
5764d3236553SJohannes Berg  * regulatory_hint - driver hint to the wireless core a regulatory domain
5765d3236553SJohannes Berg  * @wiphy: the wireless device giving the hint (used only for reporting
5766d3236553SJohannes Berg  *	conflicts)
5767d3236553SJohannes Berg  * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain
5768d3236553SJohannes Berg  *	should be in. If @rd is set this should be NULL. Note that if you
5769d3236553SJohannes Berg  *	set this to NULL you should still set rd->alpha2 to some accepted
5770d3236553SJohannes Berg  *	alpha2.
5771d3236553SJohannes Berg  *
5772d3236553SJohannes Berg  * Wireless drivers can use this function to hint to the wireless core
5773d3236553SJohannes Berg  * what it believes should be the current regulatory domain by
5774d3236553SJohannes Berg  * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory
5775d3236553SJohannes Berg  * domain should be in or by providing a completely build regulatory domain.
5776d3236553SJohannes Berg  * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried
5777d3236553SJohannes Berg  * for a regulatory domain structure for the respective country.
5778d3236553SJohannes Berg  *
5779d3236553SJohannes Berg  * The wiphy must have been registered to cfg80211 prior to this call.
5780d3236553SJohannes Berg  * For cfg80211 drivers this means you must first use wiphy_register(),
5781d3236553SJohannes Berg  * for mac80211 drivers you must first use ieee80211_register_hw().
5782d3236553SJohannes Berg  *
5783d3236553SJohannes Berg  * Drivers should check the return value, its possible you can get
5784d3236553SJohannes Berg  * an -ENOMEM.
57850ae997dcSYacine Belkadi  *
57860ae997dcSYacine Belkadi  * Return: 0 on success. -ENOMEM.
5787d3236553SJohannes Berg  */
578810dd9b7cSJoe Perches int regulatory_hint(struct wiphy *wiphy, const char *alpha2);
5789d3236553SJohannes Berg 
5790d3236553SJohannes Berg /**
5791b0d7aa59SJonathan Doron  * regulatory_set_wiphy_regd - set regdom info for self managed drivers
5792b0d7aa59SJonathan Doron  * @wiphy: the wireless device we want to process the regulatory domain on
5793b0d7aa59SJonathan Doron  * @rd: the regulatory domain informatoin to use for this wiphy
5794b0d7aa59SJonathan Doron  *
5795b0d7aa59SJonathan Doron  * Set the regulatory domain information for self-managed wiphys, only they
5796b0d7aa59SJonathan Doron  * may use this function. See %REGULATORY_WIPHY_SELF_MANAGED for more
5797b0d7aa59SJonathan Doron  * information.
5798b0d7aa59SJonathan Doron  *
5799b0d7aa59SJonathan Doron  * Return: 0 on success. -EINVAL, -EPERM
5800b0d7aa59SJonathan Doron  */
5801b0d7aa59SJonathan Doron int regulatory_set_wiphy_regd(struct wiphy *wiphy,
5802b0d7aa59SJonathan Doron 			      struct ieee80211_regdomain *rd);
5803b0d7aa59SJonathan Doron 
5804b0d7aa59SJonathan Doron /**
58052c3e861cSArik Nemtsov  * regulatory_set_wiphy_regd_sync_rtnl - set regdom for self-managed drivers
58062c3e861cSArik Nemtsov  * @wiphy: the wireless device we want to process the regulatory domain on
58072c3e861cSArik Nemtsov  * @rd: the regulatory domain information to use for this wiphy
58082c3e861cSArik Nemtsov  *
58092c3e861cSArik Nemtsov  * This functions requires the RTNL to be held and applies the new regdomain
58102c3e861cSArik Nemtsov  * synchronously to this wiphy. For more details see
58112c3e861cSArik Nemtsov  * regulatory_set_wiphy_regd().
58122c3e861cSArik Nemtsov  *
58132c3e861cSArik Nemtsov  * Return: 0 on success. -EINVAL, -EPERM
58142c3e861cSArik Nemtsov  */
58152c3e861cSArik Nemtsov int regulatory_set_wiphy_regd_sync_rtnl(struct wiphy *wiphy,
58162c3e861cSArik Nemtsov 					struct ieee80211_regdomain *rd);
58172c3e861cSArik Nemtsov 
58182c3e861cSArik Nemtsov /**
5819d3236553SJohannes Berg  * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain
5820d3236553SJohannes Berg  * @wiphy: the wireless device we want to process the regulatory domain on
5821d3236553SJohannes Berg  * @regd: the custom regulatory domain to use for this wiphy
5822d3236553SJohannes Berg  *
5823d3236553SJohannes Berg  * Drivers can sometimes have custom regulatory domains which do not apply
5824d3236553SJohannes Berg  * to a specific country. Drivers can use this to apply such custom regulatory
5825d3236553SJohannes Berg  * domains. This routine must be called prior to wiphy registration. The
5826d3236553SJohannes Berg  * custom regulatory domain will be trusted completely and as such previous
5827d3236553SJohannes Berg  * default channel settings will be disregarded. If no rule is found for a
5828d3236553SJohannes Berg  * channel on the regulatory domain the channel will be disabled.
5829222ea581SLuis R. Rodriguez  * Drivers using this for a wiphy should also set the wiphy flag
5830ce26151bSKalle Valo  * REGULATORY_CUSTOM_REG or cfg80211 will set it for the wiphy
5831222ea581SLuis R. Rodriguez  * that called this helper.
5832d3236553SJohannes Berg  */
583310dd9b7cSJoe Perches void wiphy_apply_custom_regulatory(struct wiphy *wiphy,
5834d3236553SJohannes Berg 				   const struct ieee80211_regdomain *regd);
5835d3236553SJohannes Berg 
5836d3236553SJohannes Berg /**
5837d3236553SJohannes Berg  * freq_reg_info - get regulatory information for the given frequency
5838d3236553SJohannes Berg  * @wiphy: the wiphy for which we want to process this rule for
5839d3236553SJohannes Berg  * @center_freq: Frequency in KHz for which we want regulatory information for
5840d3236553SJohannes Berg  *
5841d3236553SJohannes Berg  * Use this function to get the regulatory rule for a specific frequency on
5842d3236553SJohannes Berg  * a given wireless device. If the device has a specific regulatory domain
5843d3236553SJohannes Berg  * it wants to follow we respect that unless a country IE has been received
5844d3236553SJohannes Berg  * and processed already.
5845d3236553SJohannes Berg  *
58460ae997dcSYacine Belkadi  * Return: A valid pointer, or, when an error occurs, for example if no rule
58470ae997dcSYacine Belkadi  * can be found, the return value is encoded using ERR_PTR(). Use IS_ERR() to
58480ae997dcSYacine Belkadi  * check and PTR_ERR() to obtain the numeric return value. The numeric return
58490ae997dcSYacine Belkadi  * value will be -ERANGE if we determine the given center_freq does not even
58500ae997dcSYacine Belkadi  * have a regulatory rule for a frequency range in the center_freq's band.
58510ae997dcSYacine Belkadi  * See freq_in_rule_band() for our current definition of a band -- this is
58520ae997dcSYacine Belkadi  * purely subjective and right now it's 802.11 specific.
5853d3236553SJohannes Berg  */
5854361c9c8bSJohannes Berg const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy,
5855361c9c8bSJohannes Berg 					       u32 center_freq);
5856d3236553SJohannes Berg 
5857034c6d6eSLuis R. Rodriguez /**
5858034c6d6eSLuis R. Rodriguez  * reg_initiator_name - map regulatory request initiator enum to name
5859034c6d6eSLuis R. Rodriguez  * @initiator: the regulatory request initiator
5860034c6d6eSLuis R. Rodriguez  *
5861034c6d6eSLuis R. Rodriguez  * You can use this to map the regulatory request initiator enum to a
5862034c6d6eSLuis R. Rodriguez  * proper string representation.
5863034c6d6eSLuis R. Rodriguez  */
5864034c6d6eSLuis R. Rodriguez const char *reg_initiator_name(enum nl80211_reg_initiator initiator);
5865034c6d6eSLuis R. Rodriguez 
586619d3577eSHaim Dreyfuss /**
5867dc0c18edSAaron Komisar  * regulatory_pre_cac_allowed - check if pre-CAC allowed in the current regdom
5868dc0c18edSAaron Komisar  * @wiphy: wiphy for which pre-CAC capability is checked.
5869dc0c18edSAaron Komisar  *
5870dc0c18edSAaron Komisar  * Pre-CAC is allowed only in some regdomains (notable ETSI).
5871dc0c18edSAaron Komisar  */
5872dc0c18edSAaron Komisar bool regulatory_pre_cac_allowed(struct wiphy *wiphy);
5873dc0c18edSAaron Komisar 
5874dc0c18edSAaron Komisar /**
587519d3577eSHaim Dreyfuss  * DOC: Internal regulatory db functions
587619d3577eSHaim Dreyfuss  *
587719d3577eSHaim Dreyfuss  */
587819d3577eSHaim Dreyfuss 
587919d3577eSHaim Dreyfuss /**
588019d3577eSHaim Dreyfuss  * reg_query_regdb_wmm -  Query internal regulatory db for wmm rule
588119d3577eSHaim Dreyfuss  * Regulatory self-managed driver can use it to proactively
588219d3577eSHaim Dreyfuss  *
588319d3577eSHaim Dreyfuss  * @alpha2: the ISO/IEC 3166 alpha2 wmm rule to be queried.
588419d3577eSHaim Dreyfuss  * @freq: the freqency(in MHz) to be queried.
588519d3577eSHaim Dreyfuss  * @rule: pointer to store the wmm rule from the regulatory db.
588619d3577eSHaim Dreyfuss  *
588719d3577eSHaim Dreyfuss  * Self-managed wireless drivers can use this function to  query
588819d3577eSHaim Dreyfuss  * the internal regulatory database to check whether the given
588919d3577eSHaim Dreyfuss  * ISO/IEC 3166 alpha2 country and freq have wmm rule limitations.
589019d3577eSHaim Dreyfuss  *
589119d3577eSHaim Dreyfuss  * Drivers should check the return value, its possible you can get
589219d3577eSHaim Dreyfuss  * an -ENODATA.
589319d3577eSHaim Dreyfuss  *
589419d3577eSHaim Dreyfuss  * Return: 0 on success. -ENODATA.
589519d3577eSHaim Dreyfuss  */
589638cb87eeSStanislaw Gruszka int reg_query_regdb_wmm(char *alpha2, int freq,
589738cb87eeSStanislaw Gruszka 			struct ieee80211_reg_rule *rule);
589819d3577eSHaim Dreyfuss 
5899d3236553SJohannes Berg /*
5900d3236553SJohannes Berg  * callbacks for asynchronous cfg80211 methods, notification
5901d3236553SJohannes Berg  * functions and BSS handling helpers
5902d3236553SJohannes Berg  */
5903d3236553SJohannes Berg 
59042a519311SJohannes Berg /**
59052a519311SJohannes Berg  * cfg80211_scan_done - notify that scan finished
59062a519311SJohannes Berg  *
59072a519311SJohannes Berg  * @request: the corresponding scan request
59081d76250bSAvraham Stern  * @info: information about the completed scan
59092a519311SJohannes Berg  */
59101d76250bSAvraham Stern void cfg80211_scan_done(struct cfg80211_scan_request *request,
59111d76250bSAvraham Stern 			struct cfg80211_scan_info *info);
59122a519311SJohannes Berg 
59132a519311SJohannes Berg /**
5914807f8a8cSLuciano Coelho  * cfg80211_sched_scan_results - notify that new scan results are available
5915807f8a8cSLuciano Coelho  *
5916807f8a8cSLuciano Coelho  * @wiphy: the wiphy which got scheduled scan results
5917b34939b9SArend Van Spriel  * @reqid: identifier for the related scheduled scan request
5918807f8a8cSLuciano Coelho  */
5919b34939b9SArend Van Spriel void cfg80211_sched_scan_results(struct wiphy *wiphy, u64 reqid);
5920807f8a8cSLuciano Coelho 
5921807f8a8cSLuciano Coelho /**
5922807f8a8cSLuciano Coelho  * cfg80211_sched_scan_stopped - notify that the scheduled scan has stopped
5923807f8a8cSLuciano Coelho  *
5924807f8a8cSLuciano Coelho  * @wiphy: the wiphy on which the scheduled scan stopped
5925b34939b9SArend Van Spriel  * @reqid: identifier for the related scheduled scan request
5926807f8a8cSLuciano Coelho  *
5927807f8a8cSLuciano Coelho  * The driver can call this function to inform cfg80211 that the
5928807f8a8cSLuciano Coelho  * scheduled scan had to be stopped, for whatever reason.  The driver
5929807f8a8cSLuciano Coelho  * is then called back via the sched_scan_stop operation when done.
5930807f8a8cSLuciano Coelho  */
5931b34939b9SArend Van Spriel void cfg80211_sched_scan_stopped(struct wiphy *wiphy, u64 reqid);
5932807f8a8cSLuciano Coelho 
5933807f8a8cSLuciano Coelho /**
5934792e6aa7SEliad Peller  * cfg80211_sched_scan_stopped_rtnl - notify that the scheduled scan has stopped
5935792e6aa7SEliad Peller  *
5936792e6aa7SEliad Peller  * @wiphy: the wiphy on which the scheduled scan stopped
5937b34939b9SArend Van Spriel  * @reqid: identifier for the related scheduled scan request
5938792e6aa7SEliad Peller  *
5939792e6aa7SEliad Peller  * The driver can call this function to inform cfg80211 that the
5940792e6aa7SEliad Peller  * scheduled scan had to be stopped, for whatever reason.  The driver
5941792e6aa7SEliad Peller  * is then called back via the sched_scan_stop operation when done.
5942792e6aa7SEliad Peller  * This function should be called with rtnl locked.
5943792e6aa7SEliad Peller  */
5944b34939b9SArend Van Spriel void cfg80211_sched_scan_stopped_rtnl(struct wiphy *wiphy, u64 reqid);
5945792e6aa7SEliad Peller 
5946792e6aa7SEliad Peller /**
59476e19bc4bSDmitry Shmidt  * cfg80211_inform_bss_frame_data - inform cfg80211 of a received BSS frame
59482a519311SJohannes Berg  * @wiphy: the wiphy reporting the BSS
59496e19bc4bSDmitry Shmidt  * @data: the BSS metadata
5950abe37c4bSJohannes Berg  * @mgmt: the management frame (probe response or beacon)
5951abe37c4bSJohannes Berg  * @len: length of the management frame
59522a519311SJohannes Berg  * @gfp: context flags
59532a519311SJohannes Berg  *
59542a519311SJohannes Berg  * This informs cfg80211 that BSS information was found and
59552a519311SJohannes Berg  * the BSS should be updated/added.
5956ef100682SJohannes Berg  *
59570ae997dcSYacine Belkadi  * Return: A referenced struct, must be released with cfg80211_put_bss()!
59580ae997dcSYacine Belkadi  * Or %NULL on error.
59592a519311SJohannes Berg  */
5960ef100682SJohannes Berg struct cfg80211_bss * __must_check
59616e19bc4bSDmitry Shmidt cfg80211_inform_bss_frame_data(struct wiphy *wiphy,
59626e19bc4bSDmitry Shmidt 			       struct cfg80211_inform_bss *data,
59636e19bc4bSDmitry Shmidt 			       struct ieee80211_mgmt *mgmt, size_t len,
59646e19bc4bSDmitry Shmidt 			       gfp_t gfp);
59656e19bc4bSDmitry Shmidt 
59666e19bc4bSDmitry Shmidt static inline struct cfg80211_bss * __must_check
5967dcd6eac1SSimon Wunderlich cfg80211_inform_bss_width_frame(struct wiphy *wiphy,
59683afc2167SEmmanuel Grumbach 				struct ieee80211_channel *rx_channel,
5969dcd6eac1SSimon Wunderlich 				enum nl80211_bss_scan_width scan_width,
5970dcd6eac1SSimon Wunderlich 				struct ieee80211_mgmt *mgmt, size_t len,
59716e19bc4bSDmitry Shmidt 				s32 signal, gfp_t gfp)
59726e19bc4bSDmitry Shmidt {
59736e19bc4bSDmitry Shmidt 	struct cfg80211_inform_bss data = {
59746e19bc4bSDmitry Shmidt 		.chan = rx_channel,
59756e19bc4bSDmitry Shmidt 		.scan_width = scan_width,
59766e19bc4bSDmitry Shmidt 		.signal = signal,
59776e19bc4bSDmitry Shmidt 	};
59786e19bc4bSDmitry Shmidt 
59796e19bc4bSDmitry Shmidt 	return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp);
59806e19bc4bSDmitry Shmidt }
5981dcd6eac1SSimon Wunderlich 
5982dcd6eac1SSimon Wunderlich static inline struct cfg80211_bss * __must_check
59832a519311SJohannes Berg cfg80211_inform_bss_frame(struct wiphy *wiphy,
59843afc2167SEmmanuel Grumbach 			  struct ieee80211_channel *rx_channel,
59852a519311SJohannes Berg 			  struct ieee80211_mgmt *mgmt, size_t len,
5986dcd6eac1SSimon Wunderlich 			  s32 signal, gfp_t gfp)
5987dcd6eac1SSimon Wunderlich {
59886e19bc4bSDmitry Shmidt 	struct cfg80211_inform_bss data = {
59896e19bc4bSDmitry Shmidt 		.chan = rx_channel,
59906e19bc4bSDmitry Shmidt 		.scan_width = NL80211_BSS_CHAN_WIDTH_20,
59916e19bc4bSDmitry Shmidt 		.signal = signal,
59926e19bc4bSDmitry Shmidt 	};
59936e19bc4bSDmitry Shmidt 
59946e19bc4bSDmitry Shmidt 	return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp);
5995dcd6eac1SSimon Wunderlich }
59962a519311SJohannes Berg 
5997abe37c4bSJohannes Berg /**
59987ece9c37SSara Sharon  * cfg80211_gen_new_bssid - generate a nontransmitted BSSID for multi-BSSID
59997ece9c37SSara Sharon  * @bssid: transmitter BSSID
60007ece9c37SSara Sharon  * @max_bssid: max BSSID indicator, taken from Multiple BSSID element
60017ece9c37SSara Sharon  * @mbssid_index: BSSID index, taken from Multiple BSSID index element
60025d4071abSJohannes Berg  * @new_bssid: calculated nontransmitted BSSID
60037ece9c37SSara Sharon  */
60047ece9c37SSara Sharon static inline void cfg80211_gen_new_bssid(const u8 *bssid, u8 max_bssid,
60055d4071abSJohannes Berg 					  u8 mbssid_index, u8 *new_bssid)
60067ece9c37SSara Sharon {
60075d4071abSJohannes Berg 	u64 bssid_u64 = ether_addr_to_u64(bssid);
60085d4071abSJohannes Berg 	u64 mask = GENMASK_ULL(max_bssid - 1, 0);
60095d4071abSJohannes Berg 	u64 new_bssid_u64;
60107ece9c37SSara Sharon 
60115d4071abSJohannes Berg 	new_bssid_u64 = bssid_u64 & ~mask;
60127ece9c37SSara Sharon 
60135d4071abSJohannes Berg 	new_bssid_u64 |= ((bssid_u64 & mask) + mbssid_index) & mask;
60147ece9c37SSara Sharon 
60155d4071abSJohannes Berg 	u64_to_ether_addr(new_bssid_u64, new_bssid);
60167ece9c37SSara Sharon }
60177ece9c37SSara Sharon 
60187ece9c37SSara Sharon /**
6019f7dacfb1SSara Sharon  * cfg80211_is_element_inherited - returns if element ID should be inherited
6020f7dacfb1SSara Sharon  * @element: element to check
6021f7dacfb1SSara Sharon  * @non_inherit_element: non inheritance element
6022f7dacfb1SSara Sharon  */
6023f7dacfb1SSara Sharon bool cfg80211_is_element_inherited(const struct element *element,
6024f7dacfb1SSara Sharon 				   const struct element *non_inherit_element);
6025f7dacfb1SSara Sharon 
6026f7dacfb1SSara Sharon /**
6027fe806e49SSara Sharon  * cfg80211_merge_profile - merges a MBSSID profile if it is split between IEs
6028fe806e49SSara Sharon  * @ie: ies
6029fe806e49SSara Sharon  * @ielen: length of IEs
6030fe806e49SSara Sharon  * @mbssid_elem: current MBSSID element
6031fe806e49SSara Sharon  * @sub_elem: current MBSSID subelement (profile)
6032fe806e49SSara Sharon  * @merged_ie: location of the merged profile
6033fe806e49SSara Sharon  * @max_copy_len: max merged profile length
6034fe806e49SSara Sharon  */
6035fe806e49SSara Sharon size_t cfg80211_merge_profile(const u8 *ie, size_t ielen,
6036fe806e49SSara Sharon 			      const struct element *mbssid_elem,
6037fe806e49SSara Sharon 			      const struct element *sub_elem,
60385809a5d5SDan Carpenter 			      u8 *merged_ie, size_t max_copy_len);
6039fe806e49SSara Sharon 
6040fe806e49SSara Sharon /**
60415bc8c1f2SJohannes Berg  * enum cfg80211_bss_frame_type - frame type that the BSS data came from
60425bc8c1f2SJohannes Berg  * @CFG80211_BSS_FTYPE_UNKNOWN: driver doesn't know whether the data is
60435bc8c1f2SJohannes Berg  *	from a beacon or probe response
60445bc8c1f2SJohannes Berg  * @CFG80211_BSS_FTYPE_BEACON: data comes from a beacon
60455bc8c1f2SJohannes Berg  * @CFG80211_BSS_FTYPE_PRESP: data comes from a probe response
60465bc8c1f2SJohannes Berg  */
60475bc8c1f2SJohannes Berg enum cfg80211_bss_frame_type {
60485bc8c1f2SJohannes Berg 	CFG80211_BSS_FTYPE_UNKNOWN,
60495bc8c1f2SJohannes Berg 	CFG80211_BSS_FTYPE_BEACON,
60505bc8c1f2SJohannes Berg 	CFG80211_BSS_FTYPE_PRESP,
60515bc8c1f2SJohannes Berg };
60525bc8c1f2SJohannes Berg 
60535bc8c1f2SJohannes Berg /**
60546e19bc4bSDmitry Shmidt  * cfg80211_inform_bss_data - inform cfg80211 of a new BSS
6055abe37c4bSJohannes Berg  *
6056abe37c4bSJohannes Berg  * @wiphy: the wiphy reporting the BSS
60576e19bc4bSDmitry Shmidt  * @data: the BSS metadata
60585bc8c1f2SJohannes Berg  * @ftype: frame type (if known)
6059abe37c4bSJohannes Berg  * @bssid: the BSSID of the BSS
60607b8bcff2SJohannes Berg  * @tsf: the TSF sent by the peer in the beacon/probe response (or 0)
6061abe37c4bSJohannes Berg  * @capability: the capability field sent by the peer
6062abe37c4bSJohannes Berg  * @beacon_interval: the beacon interval announced by the peer
6063abe37c4bSJohannes Berg  * @ie: additional IEs sent by the peer
6064abe37c4bSJohannes Berg  * @ielen: length of the additional IEs
6065abe37c4bSJohannes Berg  * @gfp: context flags
6066abe37c4bSJohannes Berg  *
6067abe37c4bSJohannes Berg  * This informs cfg80211 that BSS information was found and
6068abe37c4bSJohannes Berg  * the BSS should be updated/added.
6069ef100682SJohannes Berg  *
60700ae997dcSYacine Belkadi  * Return: A referenced struct, must be released with cfg80211_put_bss()!
60710ae997dcSYacine Belkadi  * Or %NULL on error.
6072abe37c4bSJohannes Berg  */
6073ef100682SJohannes Berg struct cfg80211_bss * __must_check
60746e19bc4bSDmitry Shmidt cfg80211_inform_bss_data(struct wiphy *wiphy,
60756e19bc4bSDmitry Shmidt 			 struct cfg80211_inform_bss *data,
60766e19bc4bSDmitry Shmidt 			 enum cfg80211_bss_frame_type ftype,
60776e19bc4bSDmitry Shmidt 			 const u8 *bssid, u64 tsf, u16 capability,
60786e19bc4bSDmitry Shmidt 			 u16 beacon_interval, const u8 *ie, size_t ielen,
60796e19bc4bSDmitry Shmidt 			 gfp_t gfp);
60806e19bc4bSDmitry Shmidt 
60816e19bc4bSDmitry Shmidt static inline struct cfg80211_bss * __must_check
6082dcd6eac1SSimon Wunderlich cfg80211_inform_bss_width(struct wiphy *wiphy,
60833afc2167SEmmanuel Grumbach 			  struct ieee80211_channel *rx_channel,
6084dcd6eac1SSimon Wunderlich 			  enum nl80211_bss_scan_width scan_width,
60855bc8c1f2SJohannes Berg 			  enum cfg80211_bss_frame_type ftype,
6086dcd6eac1SSimon Wunderlich 			  const u8 *bssid, u64 tsf, u16 capability,
6087dcd6eac1SSimon Wunderlich 			  u16 beacon_interval, const u8 *ie, size_t ielen,
60886e19bc4bSDmitry Shmidt 			  s32 signal, gfp_t gfp)
60896e19bc4bSDmitry Shmidt {
60906e19bc4bSDmitry Shmidt 	struct cfg80211_inform_bss data = {
60916e19bc4bSDmitry Shmidt 		.chan = rx_channel,
60926e19bc4bSDmitry Shmidt 		.scan_width = scan_width,
60936e19bc4bSDmitry Shmidt 		.signal = signal,
60946e19bc4bSDmitry Shmidt 	};
60956e19bc4bSDmitry Shmidt 
60966e19bc4bSDmitry Shmidt 	return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf,
60976e19bc4bSDmitry Shmidt 					capability, beacon_interval, ie, ielen,
60986e19bc4bSDmitry Shmidt 					gfp);
60996e19bc4bSDmitry Shmidt }
6100dcd6eac1SSimon Wunderlich 
6101dcd6eac1SSimon Wunderlich static inline struct cfg80211_bss * __must_check
610206aa7afaSJussi Kivilinna cfg80211_inform_bss(struct wiphy *wiphy,
61033afc2167SEmmanuel Grumbach 		    struct ieee80211_channel *rx_channel,
61045bc8c1f2SJohannes Berg 		    enum cfg80211_bss_frame_type ftype,
61057b8bcff2SJohannes Berg 		    const u8 *bssid, u64 tsf, u16 capability,
61067b8bcff2SJohannes Berg 		    u16 beacon_interval, const u8 *ie, size_t ielen,
6107dcd6eac1SSimon Wunderlich 		    s32 signal, gfp_t gfp)
6108dcd6eac1SSimon Wunderlich {
61096e19bc4bSDmitry Shmidt 	struct cfg80211_inform_bss data = {
61106e19bc4bSDmitry Shmidt 		.chan = rx_channel,
61116e19bc4bSDmitry Shmidt 		.scan_width = NL80211_BSS_CHAN_WIDTH_20,
61126e19bc4bSDmitry Shmidt 		.signal = signal,
61136e19bc4bSDmitry Shmidt 	};
61146e19bc4bSDmitry Shmidt 
61156e19bc4bSDmitry Shmidt 	return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf,
61166e19bc4bSDmitry Shmidt 					capability, beacon_interval, ie, ielen,
6117dcd6eac1SSimon Wunderlich 					gfp);
6118dcd6eac1SSimon Wunderlich }
611906aa7afaSJussi Kivilinna 
612027548677SJohannes Berg /**
612127548677SJohannes Berg  * cfg80211_get_bss - get a BSS reference
612227548677SJohannes Berg  * @wiphy: the wiphy this BSS struct belongs to
612327548677SJohannes Berg  * @channel: the channel to search on (or %NULL)
612427548677SJohannes Berg  * @bssid: the desired BSSID (or %NULL)
612527548677SJohannes Berg  * @ssid: the desired SSID (or %NULL)
612627548677SJohannes Berg  * @ssid_len: length of the SSID (or 0)
612727548677SJohannes Berg  * @bss_type: type of BSS, see &enum ieee80211_bss_type
612827548677SJohannes Berg  * @privacy: privacy filter, see &enum ieee80211_privacy
612927548677SJohannes Berg  */
61302a519311SJohannes Berg struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
61312a519311SJohannes Berg 				      struct ieee80211_channel *channel,
61322a519311SJohannes Berg 				      const u8 *bssid,
613379420f09SJohannes Berg 				      const u8 *ssid, size_t ssid_len,
61346eb18137SDedy Lansky 				      enum ieee80211_bss_type bss_type,
613527548677SJohannes Berg 				      enum ieee80211_privacy privacy);
613679420f09SJohannes Berg static inline struct cfg80211_bss *
613779420f09SJohannes Berg cfg80211_get_ibss(struct wiphy *wiphy,
613879420f09SJohannes Berg 		  struct ieee80211_channel *channel,
613979420f09SJohannes Berg 		  const u8 *ssid, size_t ssid_len)
614079420f09SJohannes Berg {
614179420f09SJohannes Berg 	return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len,
61426eb18137SDedy Lansky 				IEEE80211_BSS_TYPE_IBSS,
61436eb18137SDedy Lansky 				IEEE80211_PRIVACY_ANY);
614479420f09SJohannes Berg }
614579420f09SJohannes Berg 
61464c0c0b75SJohannes Berg /**
61474c0c0b75SJohannes Berg  * cfg80211_ref_bss - reference BSS struct
61485b112d3dSJohannes Berg  * @wiphy: the wiphy this BSS struct belongs to
61494c0c0b75SJohannes Berg  * @bss: the BSS struct to reference
61504c0c0b75SJohannes Berg  *
61514c0c0b75SJohannes Berg  * Increments the refcount of the given BSS struct.
61524c0c0b75SJohannes Berg  */
61535b112d3dSJohannes Berg void cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
61544c0c0b75SJohannes Berg 
61554c0c0b75SJohannes Berg /**
61564c0c0b75SJohannes Berg  * cfg80211_put_bss - unref BSS struct
61575b112d3dSJohannes Berg  * @wiphy: the wiphy this BSS struct belongs to
61584c0c0b75SJohannes Berg  * @bss: the BSS struct
61594c0c0b75SJohannes Berg  *
61604c0c0b75SJohannes Berg  * Decrements the refcount of the given BSS struct.
61614c0c0b75SJohannes Berg  */
61625b112d3dSJohannes Berg void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
6163d3236553SJohannes Berg 
6164d491af19SJohannes Berg /**
6165d491af19SJohannes Berg  * cfg80211_unlink_bss - unlink BSS from internal data structures
6166d491af19SJohannes Berg  * @wiphy: the wiphy
6167d491af19SJohannes Berg  * @bss: the bss to remove
6168d491af19SJohannes Berg  *
6169d491af19SJohannes Berg  * This function removes the given BSS from the internal data structures
6170d491af19SJohannes Berg  * thereby making it no longer show up in scan results etc. Use this
6171d491af19SJohannes Berg  * function when you detect a BSS is gone. Normally BSSes will also time
6172d491af19SJohannes Berg  * out, so it is not necessary to use this function at all.
6173d491af19SJohannes Berg  */
6174d491af19SJohannes Berg void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
6175fee52678SJohannes Berg 
61764770c8f9SIlan Peer /**
61774770c8f9SIlan Peer  * cfg80211_bss_iter - iterate all BSS entries
61784770c8f9SIlan Peer  *
61794770c8f9SIlan Peer  * This function iterates over the BSS entries associated with the given wiphy
61804770c8f9SIlan Peer  * and calls the callback for the iterated BSS. The iterator function is not
61814770c8f9SIlan Peer  * allowed to call functions that might modify the internal state of the BSS DB.
61824770c8f9SIlan Peer  *
61834770c8f9SIlan Peer  * @wiphy: the wiphy
61844770c8f9SIlan Peer  * @chandef: if given, the iterator function will be called only if the channel
61854770c8f9SIlan Peer  *     of the currently iterated BSS is a subset of the given channel.
61864770c8f9SIlan Peer  * @iter: the iterator function to call
61874770c8f9SIlan Peer  * @iter_data: an argument to the iterator function
61884770c8f9SIlan Peer  */
61894770c8f9SIlan Peer void cfg80211_bss_iter(struct wiphy *wiphy,
61904770c8f9SIlan Peer 		       struct cfg80211_chan_def *chandef,
61914770c8f9SIlan Peer 		       void (*iter)(struct wiphy *wiphy,
61924770c8f9SIlan Peer 				    struct cfg80211_bss *bss,
61934770c8f9SIlan Peer 				    void *data),
61944770c8f9SIlan Peer 		       void *iter_data);
61954770c8f9SIlan Peer 
6196dcd6eac1SSimon Wunderlich static inline enum nl80211_bss_scan_width
6197dcd6eac1SSimon Wunderlich cfg80211_chandef_to_scan_width(const struct cfg80211_chan_def *chandef)
6198dcd6eac1SSimon Wunderlich {
6199dcd6eac1SSimon Wunderlich 	switch (chandef->width) {
6200dcd6eac1SSimon Wunderlich 	case NL80211_CHAN_WIDTH_5:
6201dcd6eac1SSimon Wunderlich 		return NL80211_BSS_CHAN_WIDTH_5;
6202dcd6eac1SSimon Wunderlich 	case NL80211_CHAN_WIDTH_10:
6203dcd6eac1SSimon Wunderlich 		return NL80211_BSS_CHAN_WIDTH_10;
6204dcd6eac1SSimon Wunderlich 	default:
6205dcd6eac1SSimon Wunderlich 		return NL80211_BSS_CHAN_WIDTH_20;
6206dcd6eac1SSimon Wunderlich 	}
6207dcd6eac1SSimon Wunderlich }
6208dcd6eac1SSimon Wunderlich 
62096039f6d2SJouni Malinen /**
62106ff57cf8SJohannes Berg  * cfg80211_rx_mlme_mgmt - notification of processed MLME management frame
62116039f6d2SJouni Malinen  * @dev: network device
62126039f6d2SJouni Malinen  * @buf: authentication frame (header + body)
62136039f6d2SJouni Malinen  * @len: length of the frame data
62146039f6d2SJouni Malinen  *
62156ff57cf8SJohannes Berg  * This function is called whenever an authentication, disassociation or
62166ff57cf8SJohannes Berg  * deauthentication frame has been received and processed in station mode.
62176ff57cf8SJohannes Berg  * After being asked to authenticate via cfg80211_ops::auth() the driver must
62186ff57cf8SJohannes Berg  * call either this function or cfg80211_auth_timeout().
62196ff57cf8SJohannes Berg  * After being asked to associate via cfg80211_ops::assoc() the driver must
62206ff57cf8SJohannes Berg  * call either this function or cfg80211_auth_timeout().
62216ff57cf8SJohannes Berg  * While connected, the driver must calls this for received and processed
62226ff57cf8SJohannes Berg  * disassociation and deauthentication frames. If the frame couldn't be used
62236ff57cf8SJohannes Berg  * because it was unprotected, the driver must call the function
62246ff57cf8SJohannes Berg  * cfg80211_rx_unprot_mlme_mgmt() instead.
62256ff57cf8SJohannes Berg  *
62266ff57cf8SJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's mutex.
62276039f6d2SJouni Malinen  */
62286ff57cf8SJohannes Berg void cfg80211_rx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len);
62296039f6d2SJouni Malinen 
62306039f6d2SJouni Malinen /**
62316ff57cf8SJohannes Berg  * cfg80211_auth_timeout - notification of timed out authentication
62321965c853SJouni Malinen  * @dev: network device
62331965c853SJouni Malinen  * @addr: The MAC address of the device with which the authentication timed out
6234cb0b4bebSJohannes Berg  *
62358d61ffa5SJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's
62368d61ffa5SJohannes Berg  * mutex.
62371965c853SJouni Malinen  */
62386ff57cf8SJohannes Berg void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr);
62391965c853SJouni Malinen 
62401965c853SJouni Malinen /**
62416ff57cf8SJohannes Berg  * cfg80211_rx_assoc_resp - notification of processed association response
62426039f6d2SJouni Malinen  * @dev: network device
62436ff57cf8SJohannes Berg  * @bss: the BSS that association was requested with, ownership of the pointer
62446ff57cf8SJohannes Berg  *	moves to cfg80211 in this call
62454d9ec73dSJouni Malinen  * @buf: (Re)Association Response frame (header + body)
62466039f6d2SJouni Malinen  * @len: length of the frame data
6247f438ceb8SEmmanuel Grumbach  * @uapsd_queues: bitmap of queues configured for uapsd. Same format
6248f438ceb8SEmmanuel Grumbach  *	as the AC bitmap in the QoS info field
62494d9ec73dSJouni Malinen  * @req_ies: information elements from the (Re)Association Request frame
62504d9ec73dSJouni Malinen  * @req_ies_len: length of req_ies data
62516039f6d2SJouni Malinen  *
62526ff57cf8SJohannes Berg  * After being asked to associate via cfg80211_ops::assoc() the driver must
62536ff57cf8SJohannes Berg  * call either this function or cfg80211_auth_timeout().
62546ff57cf8SJohannes Berg  *
62556ff57cf8SJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's mutex.
62566039f6d2SJouni Malinen  */
62576ff57cf8SJohannes Berg void cfg80211_rx_assoc_resp(struct net_device *dev,
62586ff57cf8SJohannes Berg 			    struct cfg80211_bss *bss,
6259b0b6aa2cSEliad Peller 			    const u8 *buf, size_t len,
62604d9ec73dSJouni Malinen 			    int uapsd_queues,
62614d9ec73dSJouni Malinen 			    const u8 *req_ies, size_t req_ies_len);
62626039f6d2SJouni Malinen 
62636039f6d2SJouni Malinen /**
62646ff57cf8SJohannes Berg  * cfg80211_assoc_timeout - notification of timed out association
62651965c853SJouni Malinen  * @dev: network device
6266959867faSJohannes Berg  * @bss: The BSS entry with which association timed out.
6267cb0b4bebSJohannes Berg  *
62688d61ffa5SJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's mutex.
62691965c853SJouni Malinen  */
6270959867faSJohannes Berg void cfg80211_assoc_timeout(struct net_device *dev, struct cfg80211_bss *bss);
62711965c853SJouni Malinen 
62721965c853SJouni Malinen /**
6273e6f462dfSJohannes Berg  * cfg80211_abandon_assoc - notify cfg80211 of abandoned association attempt
6274e6f462dfSJohannes Berg  * @dev: network device
6275e6f462dfSJohannes Berg  * @bss: The BSS entry with which association was abandoned.
6276e6f462dfSJohannes Berg  *
6277e6f462dfSJohannes Berg  * Call this whenever - for reasons reported through other API, like deauth RX,
6278e6f462dfSJohannes Berg  * an association attempt was abandoned.
6279e6f462dfSJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's mutex.
6280e6f462dfSJohannes Berg  */
6281e6f462dfSJohannes Berg void cfg80211_abandon_assoc(struct net_device *dev, struct cfg80211_bss *bss);
6282e6f462dfSJohannes Berg 
6283e6f462dfSJohannes Berg /**
62846ff57cf8SJohannes Berg  * cfg80211_tx_mlme_mgmt - notification of transmitted deauth/disassoc frame
62856039f6d2SJouni Malinen  * @dev: network device
62866ff57cf8SJohannes Berg  * @buf: 802.11 frame (header + body)
62876039f6d2SJouni Malinen  * @len: length of the frame data
62886039f6d2SJouni Malinen  *
62896039f6d2SJouni Malinen  * This function is called whenever deauthentication has been processed in
629053b46b84SJouni Malinen  * station mode. This includes both received deauthentication frames and
62918d61ffa5SJohannes Berg  * locally generated ones. This function may sleep. The caller must hold the
62928d61ffa5SJohannes Berg  * corresponding wdev's mutex.
62936039f6d2SJouni Malinen  */
62946ff57cf8SJohannes Berg void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len);
6295ce470613SHolger Schurig 
6296ce470613SHolger Schurig /**
62976ff57cf8SJohannes Berg  * cfg80211_rx_unprot_mlme_mgmt - notification of unprotected mlme mgmt frame
6298cf4e594eSJouni Malinen  * @dev: network device
62994d797fceSJouni Malinen  * @buf: received management frame (header + body)
6300cf4e594eSJouni Malinen  * @len: length of the frame data
6301cf4e594eSJouni Malinen  *
63026ff57cf8SJohannes Berg  * This function is called whenever a received deauthentication or dissassoc
63036ff57cf8SJohannes Berg  * frame has been dropped in station mode because of MFP being used but the
63044d797fceSJouni Malinen  * frame was not protected. This is also used to notify reception of a Beacon
63054d797fceSJouni Malinen  * frame that was dropped because it did not include a valid MME MIC while
63064d797fceSJouni Malinen  * beacon protection was enabled (BIGTK configured in station mode).
63074d797fceSJouni Malinen  *
63084d797fceSJouni Malinen  * This function may sleep.
6309cf4e594eSJouni Malinen  */
63106ff57cf8SJohannes Berg void cfg80211_rx_unprot_mlme_mgmt(struct net_device *dev,
63116ff57cf8SJohannes Berg 				  const u8 *buf, size_t len);
6312cf4e594eSJouni Malinen 
6313cf4e594eSJouni Malinen /**
6314a3b8b056SJouni Malinen  * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP)
6315a3b8b056SJouni Malinen  * @dev: network device
6316a3b8b056SJouni Malinen  * @addr: The source MAC address of the frame
6317a3b8b056SJouni Malinen  * @key_type: The key type that the received frame used
6318a66b98dbSArik Nemtsov  * @key_id: Key identifier (0..3). Can be -1 if missing.
6319a3b8b056SJouni Malinen  * @tsc: The TSC value of the frame that generated the MIC failure (6 octets)
6320e6d6e342SJohannes Berg  * @gfp: allocation flags
6321a3b8b056SJouni Malinen  *
6322a3b8b056SJouni Malinen  * This function is called whenever the local MAC detects a MIC failure in a
6323a3b8b056SJouni Malinen  * received frame. This matches with MLME-MICHAELMICFAILURE.indication()
6324a3b8b056SJouni Malinen  * primitive.
6325a3b8b056SJouni Malinen  */
6326a3b8b056SJouni Malinen void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,
6327a3b8b056SJouni Malinen 				  enum nl80211_key_type key_type, int key_id,
6328e6d6e342SJohannes Berg 				  const u8 *tsc, gfp_t gfp);
6329a3b8b056SJouni Malinen 
633004a773adSJohannes Berg /**
633104a773adSJohannes Berg  * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS
633204a773adSJohannes Berg  *
633304a773adSJohannes Berg  * @dev: network device
633404a773adSJohannes Berg  * @bssid: the BSSID of the IBSS joined
6335fe94f3a4SAntonio Quartulli  * @channel: the channel of the IBSS joined
633604a773adSJohannes Berg  * @gfp: allocation flags
633704a773adSJohannes Berg  *
633804a773adSJohannes Berg  * This function notifies cfg80211 that the device joined an IBSS or
633904a773adSJohannes Berg  * switched to a different BSSID. Before this function can be called,
634004a773adSJohannes Berg  * either a beacon has to have been received from the IBSS, or one of
634104a773adSJohannes Berg  * the cfg80211_inform_bss{,_frame} functions must have been called
634204a773adSJohannes Berg  * with the locally generated beacon -- this guarantees that there is
634304a773adSJohannes Berg  * always a scan result for this IBSS. cfg80211 will handle the rest.
634404a773adSJohannes Berg  */
6345fe94f3a4SAntonio Quartulli void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid,
6346fe94f3a4SAntonio Quartulli 			  struct ieee80211_channel *channel, gfp_t gfp);
634704a773adSJohannes Berg 
63481f87f7d3SJohannes Berg /**
6349c93b5e71SJavier Cardona  * cfg80211_notify_new_candidate - notify cfg80211 of a new mesh peer candidate
6350c93b5e71SJavier Cardona  *
6351c93b5e71SJavier Cardona  * @dev: network device
6352c93b5e71SJavier Cardona  * @macaddr: the MAC address of the new candidate
6353c93b5e71SJavier Cardona  * @ie: information elements advertised by the peer candidate
63545ac4a12dSMatteo Croce  * @ie_len: length of the information elements buffer
6355c93b5e71SJavier Cardona  * @gfp: allocation flags
6356c93b5e71SJavier Cardona  *
6357c93b5e71SJavier Cardona  * This function notifies cfg80211 that the mesh peer candidate has been
6358c93b5e71SJavier Cardona  * detected, most likely via a beacon or, less likely, via a probe response.
6359c93b5e71SJavier Cardona  * cfg80211 then sends a notification to userspace.
6360c93b5e71SJavier Cardona  */
6361c93b5e71SJavier Cardona void cfg80211_notify_new_peer_candidate(struct net_device *dev,
6362ecbc12adSBob Copeland 		const u8 *macaddr, const u8 *ie, u8 ie_len,
6363ecbc12adSBob Copeland 		int sig_dbm, gfp_t gfp);
6364c93b5e71SJavier Cardona 
6365c93b5e71SJavier Cardona /**
6366d70e9693SJohannes Berg  * DOC: RFkill integration
6367d70e9693SJohannes Berg  *
6368d70e9693SJohannes Berg  * RFkill integration in cfg80211 is almost invisible to drivers,
6369d70e9693SJohannes Berg  * as cfg80211 automatically registers an rfkill instance for each
6370d70e9693SJohannes Berg  * wireless device it knows about. Soft kill is also translated
6371d70e9693SJohannes Berg  * into disconnecting and turning all interfaces off, drivers are
6372d70e9693SJohannes Berg  * expected to turn off the device when all interfaces are down.
6373d70e9693SJohannes Berg  *
6374d70e9693SJohannes Berg  * However, devices may have a hard RFkill line, in which case they
6375d70e9693SJohannes Berg  * also need to interact with the rfkill subsystem, via cfg80211.
6376d70e9693SJohannes Berg  * They can do this with a few helper functions documented here.
6377d70e9693SJohannes Berg  */
6378d70e9693SJohannes Berg 
6379d70e9693SJohannes Berg /**
63801f87f7d3SJohannes Berg  * wiphy_rfkill_set_hw_state - notify cfg80211 about hw block state
63811f87f7d3SJohannes Berg  * @wiphy: the wiphy
63821f87f7d3SJohannes Berg  * @blocked: block status
63831f87f7d3SJohannes Berg  */
63841f87f7d3SJohannes Berg void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked);
63851f87f7d3SJohannes Berg 
63861f87f7d3SJohannes Berg /**
63871f87f7d3SJohannes Berg  * wiphy_rfkill_start_polling - start polling rfkill
63881f87f7d3SJohannes Berg  * @wiphy: the wiphy
63891f87f7d3SJohannes Berg  */
63901f87f7d3SJohannes Berg void wiphy_rfkill_start_polling(struct wiphy *wiphy);
63911f87f7d3SJohannes Berg 
63921f87f7d3SJohannes Berg /**
63931f87f7d3SJohannes Berg  * wiphy_rfkill_stop_polling - stop polling rfkill
63941f87f7d3SJohannes Berg  * @wiphy: the wiphy
63951f87f7d3SJohannes Berg  */
63961f87f7d3SJohannes Berg void wiphy_rfkill_stop_polling(struct wiphy *wiphy);
63971f87f7d3SJohannes Berg 
6398ad7e718cSJohannes Berg /**
6399ad7e718cSJohannes Berg  * DOC: Vendor commands
6400ad7e718cSJohannes Berg  *
6401ad7e718cSJohannes Berg  * Occasionally, there are special protocol or firmware features that
6402ad7e718cSJohannes Berg  * can't be implemented very openly. For this and similar cases, the
6403ad7e718cSJohannes Berg  * vendor command functionality allows implementing the features with
6404ad7e718cSJohannes Berg  * (typically closed-source) userspace and firmware, using nl80211 as
6405ad7e718cSJohannes Berg  * the configuration mechanism.
6406ad7e718cSJohannes Berg  *
6407ad7e718cSJohannes Berg  * A driver supporting vendor commands must register them as an array
6408ad7e718cSJohannes Berg  * in struct wiphy, with handlers for each one, each command has an
6409ad7e718cSJohannes Berg  * OUI and sub command ID to identify it.
6410ad7e718cSJohannes Berg  *
6411ad7e718cSJohannes Berg  * Note that this feature should not be (ab)used to implement protocol
6412ad7e718cSJohannes Berg  * features that could openly be shared across drivers. In particular,
6413ad7e718cSJohannes Berg  * it must never be required to use vendor commands to implement any
6414ad7e718cSJohannes Berg  * "normal" functionality that higher-level userspace like connection
6415ad7e718cSJohannes Berg  * managers etc. need.
6416ad7e718cSJohannes Berg  */
6417ad7e718cSJohannes Berg 
6418ad7e718cSJohannes Berg struct sk_buff *__cfg80211_alloc_reply_skb(struct wiphy *wiphy,
6419ad7e718cSJohannes Berg 					   enum nl80211_commands cmd,
6420ad7e718cSJohannes Berg 					   enum nl80211_attrs attr,
6421ad7e718cSJohannes Berg 					   int approxlen);
6422ad7e718cSJohannes Berg 
6423567ffc35SJohannes Berg struct sk_buff *__cfg80211_alloc_event_skb(struct wiphy *wiphy,
64246c09e791SAhmad Kholaif 					   struct wireless_dev *wdev,
6425567ffc35SJohannes Berg 					   enum nl80211_commands cmd,
6426567ffc35SJohannes Berg 					   enum nl80211_attrs attr,
642755c1fdf0SJohannes Berg 					   unsigned int portid,
6428567ffc35SJohannes Berg 					   int vendor_event_idx,
6429567ffc35SJohannes Berg 					   int approxlen, gfp_t gfp);
6430567ffc35SJohannes Berg 
6431567ffc35SJohannes Berg void __cfg80211_send_event_skb(struct sk_buff *skb, gfp_t gfp);
6432567ffc35SJohannes Berg 
6433ad7e718cSJohannes Berg /**
6434ad7e718cSJohannes Berg  * cfg80211_vendor_cmd_alloc_reply_skb - allocate vendor command reply
6435ad7e718cSJohannes Berg  * @wiphy: the wiphy
6436ad7e718cSJohannes Berg  * @approxlen: an upper bound of the length of the data that will
6437ad7e718cSJohannes Berg  *	be put into the skb
6438ad7e718cSJohannes Berg  *
6439ad7e718cSJohannes Berg  * This function allocates and pre-fills an skb for a reply to
6440ad7e718cSJohannes Berg  * a vendor command. Since it is intended for a reply, calling
6441ad7e718cSJohannes Berg  * it outside of a vendor command's doit() operation is invalid.
6442ad7e718cSJohannes Berg  *
6443ad7e718cSJohannes Berg  * The returned skb is pre-filled with some identifying data in
6444ad7e718cSJohannes Berg  * a way that any data that is put into the skb (with skb_put(),
6445ad7e718cSJohannes Berg  * nla_put() or similar) will end up being within the
6446ad7e718cSJohannes Berg  * %NL80211_ATTR_VENDOR_DATA attribute, so all that needs to be done
6447ad7e718cSJohannes Berg  * with the skb is adding data for the corresponding userspace tool
6448ad7e718cSJohannes Berg  * which can then read that data out of the vendor data attribute.
6449ad7e718cSJohannes Berg  * You must not modify the skb in any other way.
6450ad7e718cSJohannes Berg  *
6451ad7e718cSJohannes Berg  * When done, call cfg80211_vendor_cmd_reply() with the skb and return
6452ad7e718cSJohannes Berg  * its error code as the result of the doit() operation.
6453ad7e718cSJohannes Berg  *
6454ad7e718cSJohannes Berg  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
6455ad7e718cSJohannes Berg  */
6456ad7e718cSJohannes Berg static inline struct sk_buff *
6457ad7e718cSJohannes Berg cfg80211_vendor_cmd_alloc_reply_skb(struct wiphy *wiphy, int approxlen)
6458ad7e718cSJohannes Berg {
6459ad7e718cSJohannes Berg 	return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_VENDOR,
6460ad7e718cSJohannes Berg 					  NL80211_ATTR_VENDOR_DATA, approxlen);
6461ad7e718cSJohannes Berg }
6462ad7e718cSJohannes Berg 
6463ad7e718cSJohannes Berg /**
6464ad7e718cSJohannes Berg  * cfg80211_vendor_cmd_reply - send the reply skb
6465ad7e718cSJohannes Berg  * @skb: The skb, must have been allocated with
6466ad7e718cSJohannes Berg  *	cfg80211_vendor_cmd_alloc_reply_skb()
6467ad7e718cSJohannes Berg  *
6468ad7e718cSJohannes Berg  * Since calling this function will usually be the last thing
6469ad7e718cSJohannes Berg  * before returning from the vendor command doit() you should
6470ad7e718cSJohannes Berg  * return the error code.  Note that this function consumes the
6471ad7e718cSJohannes Berg  * skb regardless of the return value.
6472ad7e718cSJohannes Berg  *
6473ad7e718cSJohannes Berg  * Return: An error code or 0 on success.
6474ad7e718cSJohannes Berg  */
6475ad7e718cSJohannes Berg int cfg80211_vendor_cmd_reply(struct sk_buff *skb);
6476ad7e718cSJohannes Berg 
6477567ffc35SJohannes Berg /**
647855c1fdf0SJohannes Berg  * cfg80211_vendor_cmd_get_sender
647955c1fdf0SJohannes Berg  * @wiphy: the wiphy
648055c1fdf0SJohannes Berg  *
648155c1fdf0SJohannes Berg  * Return the current netlink port ID in a vendor command handler.
648255c1fdf0SJohannes Berg  * Valid to call only there.
648355c1fdf0SJohannes Berg  */
648455c1fdf0SJohannes Berg unsigned int cfg80211_vendor_cmd_get_sender(struct wiphy *wiphy);
648555c1fdf0SJohannes Berg 
648655c1fdf0SJohannes Berg /**
6487567ffc35SJohannes Berg  * cfg80211_vendor_event_alloc - allocate vendor-specific event skb
6488567ffc35SJohannes Berg  * @wiphy: the wiphy
64896c09e791SAhmad Kholaif  * @wdev: the wireless device
6490567ffc35SJohannes Berg  * @event_idx: index of the vendor event in the wiphy's vendor_events
6491567ffc35SJohannes Berg  * @approxlen: an upper bound of the length of the data that will
6492567ffc35SJohannes Berg  *	be put into the skb
6493567ffc35SJohannes Berg  * @gfp: allocation flags
6494567ffc35SJohannes Berg  *
6495567ffc35SJohannes Berg  * This function allocates and pre-fills an skb for an event on the
6496567ffc35SJohannes Berg  * vendor-specific multicast group.
6497567ffc35SJohannes Berg  *
64986c09e791SAhmad Kholaif  * If wdev != NULL, both the ifindex and identifier of the specified
64996c09e791SAhmad Kholaif  * wireless device are added to the event message before the vendor data
65006c09e791SAhmad Kholaif  * attribute.
65016c09e791SAhmad Kholaif  *
6502567ffc35SJohannes Berg  * When done filling the skb, call cfg80211_vendor_event() with the
6503567ffc35SJohannes Berg  * skb to send the event.
6504567ffc35SJohannes Berg  *
6505567ffc35SJohannes Berg  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
6506567ffc35SJohannes Berg  */
6507567ffc35SJohannes Berg static inline struct sk_buff *
65086c09e791SAhmad Kholaif cfg80211_vendor_event_alloc(struct wiphy *wiphy, struct wireless_dev *wdev,
65096c09e791SAhmad Kholaif 			     int approxlen, int event_idx, gfp_t gfp)
6510567ffc35SJohannes Berg {
65116c09e791SAhmad Kholaif 	return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR,
6512567ffc35SJohannes Berg 					  NL80211_ATTR_VENDOR_DATA,
651355c1fdf0SJohannes Berg 					  0, event_idx, approxlen, gfp);
651455c1fdf0SJohannes Berg }
651555c1fdf0SJohannes Berg 
651655c1fdf0SJohannes Berg /**
651755c1fdf0SJohannes Berg  * cfg80211_vendor_event_alloc_ucast - alloc unicast vendor-specific event skb
651855c1fdf0SJohannes Berg  * @wiphy: the wiphy
651955c1fdf0SJohannes Berg  * @wdev: the wireless device
652055c1fdf0SJohannes Berg  * @event_idx: index of the vendor event in the wiphy's vendor_events
652155c1fdf0SJohannes Berg  * @portid: port ID of the receiver
652255c1fdf0SJohannes Berg  * @approxlen: an upper bound of the length of the data that will
652355c1fdf0SJohannes Berg  *	be put into the skb
652455c1fdf0SJohannes Berg  * @gfp: allocation flags
652555c1fdf0SJohannes Berg  *
652655c1fdf0SJohannes Berg  * This function allocates and pre-fills an skb for an event to send to
652755c1fdf0SJohannes Berg  * a specific (userland) socket. This socket would previously have been
652855c1fdf0SJohannes Berg  * obtained by cfg80211_vendor_cmd_get_sender(), and the caller MUST take
652955c1fdf0SJohannes Berg  * care to register a netlink notifier to see when the socket closes.
653055c1fdf0SJohannes Berg  *
653155c1fdf0SJohannes Berg  * If wdev != NULL, both the ifindex and identifier of the specified
653255c1fdf0SJohannes Berg  * wireless device are added to the event message before the vendor data
653355c1fdf0SJohannes Berg  * attribute.
653455c1fdf0SJohannes Berg  *
653555c1fdf0SJohannes Berg  * When done filling the skb, call cfg80211_vendor_event() with the
653655c1fdf0SJohannes Berg  * skb to send the event.
653755c1fdf0SJohannes Berg  *
653855c1fdf0SJohannes Berg  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
653955c1fdf0SJohannes Berg  */
654055c1fdf0SJohannes Berg static inline struct sk_buff *
654155c1fdf0SJohannes Berg cfg80211_vendor_event_alloc_ucast(struct wiphy *wiphy,
654255c1fdf0SJohannes Berg 				  struct wireless_dev *wdev,
654355c1fdf0SJohannes Berg 				  unsigned int portid, int approxlen,
654455c1fdf0SJohannes Berg 				  int event_idx, gfp_t gfp)
654555c1fdf0SJohannes Berg {
654655c1fdf0SJohannes Berg 	return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR,
654755c1fdf0SJohannes Berg 					  NL80211_ATTR_VENDOR_DATA,
654855c1fdf0SJohannes Berg 					  portid, event_idx, approxlen, gfp);
6549567ffc35SJohannes Berg }
6550567ffc35SJohannes Berg 
6551567ffc35SJohannes Berg /**
6552567ffc35SJohannes Berg  * cfg80211_vendor_event - send the event
6553567ffc35SJohannes Berg  * @skb: The skb, must have been allocated with cfg80211_vendor_event_alloc()
6554567ffc35SJohannes Berg  * @gfp: allocation flags
6555567ffc35SJohannes Berg  *
6556567ffc35SJohannes Berg  * This function sends the given @skb, which must have been allocated
6557567ffc35SJohannes Berg  * by cfg80211_vendor_event_alloc(), as an event. It always consumes it.
6558567ffc35SJohannes Berg  */
6559567ffc35SJohannes Berg static inline void cfg80211_vendor_event(struct sk_buff *skb, gfp_t gfp)
6560567ffc35SJohannes Berg {
6561567ffc35SJohannes Berg 	__cfg80211_send_event_skb(skb, gfp);
6562567ffc35SJohannes Berg }
6563567ffc35SJohannes Berg 
6564aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE
6565aff89a9bSJohannes Berg /**
6566d70e9693SJohannes Berg  * DOC: Test mode
6567d70e9693SJohannes Berg  *
6568d70e9693SJohannes Berg  * Test mode is a set of utility functions to allow drivers to
6569d70e9693SJohannes Berg  * interact with driver-specific tools to aid, for instance,
6570d70e9693SJohannes Berg  * factory programming.
6571d70e9693SJohannes Berg  *
6572d70e9693SJohannes Berg  * This chapter describes how drivers interact with it, for more
6573d70e9693SJohannes Berg  * information see the nl80211 book's chapter on it.
6574d70e9693SJohannes Berg  */
6575d70e9693SJohannes Berg 
6576d70e9693SJohannes Berg /**
6577aff89a9bSJohannes Berg  * cfg80211_testmode_alloc_reply_skb - allocate testmode reply
6578aff89a9bSJohannes Berg  * @wiphy: the wiphy
6579aff89a9bSJohannes Berg  * @approxlen: an upper bound of the length of the data that will
6580aff89a9bSJohannes Berg  *	be put into the skb
6581aff89a9bSJohannes Berg  *
6582aff89a9bSJohannes Berg  * This function allocates and pre-fills an skb for a reply to
6583aff89a9bSJohannes Berg  * the testmode command. Since it is intended for a reply, calling
6584aff89a9bSJohannes Berg  * it outside of the @testmode_cmd operation is invalid.
6585aff89a9bSJohannes Berg  *
65860ae997dcSYacine Belkadi  * The returned skb is pre-filled with the wiphy index and set up in
65870ae997dcSYacine Belkadi  * a way that any data that is put into the skb (with skb_put(),
65880ae997dcSYacine Belkadi  * nla_put() or similar) will end up being within the
65890ae997dcSYacine Belkadi  * %NL80211_ATTR_TESTDATA attribute, so all that needs to be done
65900ae997dcSYacine Belkadi  * with the skb is adding data for the corresponding userspace tool
65910ae997dcSYacine Belkadi  * which can then read that data out of the testdata attribute. You
65920ae997dcSYacine Belkadi  * must not modify the skb in any other way.
6593aff89a9bSJohannes Berg  *
6594aff89a9bSJohannes Berg  * When done, call cfg80211_testmode_reply() with the skb and return
6595aff89a9bSJohannes Berg  * its error code as the result of the @testmode_cmd operation.
65960ae997dcSYacine Belkadi  *
65970ae997dcSYacine Belkadi  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
6598aff89a9bSJohannes Berg  */
6599ad7e718cSJohannes Berg static inline struct sk_buff *
6600ad7e718cSJohannes Berg cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy, int approxlen)
6601ad7e718cSJohannes Berg {
6602ad7e718cSJohannes Berg 	return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_TESTMODE,
6603ad7e718cSJohannes Berg 					  NL80211_ATTR_TESTDATA, approxlen);
6604ad7e718cSJohannes Berg }
6605aff89a9bSJohannes Berg 
6606aff89a9bSJohannes Berg /**
6607aff89a9bSJohannes Berg  * cfg80211_testmode_reply - send the reply skb
6608aff89a9bSJohannes Berg  * @skb: The skb, must have been allocated with
6609aff89a9bSJohannes Berg  *	cfg80211_testmode_alloc_reply_skb()
6610aff89a9bSJohannes Berg  *
66110ae997dcSYacine Belkadi  * Since calling this function will usually be the last thing
66120ae997dcSYacine Belkadi  * before returning from the @testmode_cmd you should return
66130ae997dcSYacine Belkadi  * the error code.  Note that this function consumes the skb
66140ae997dcSYacine Belkadi  * regardless of the return value.
66150ae997dcSYacine Belkadi  *
66160ae997dcSYacine Belkadi  * Return: An error code or 0 on success.
6617aff89a9bSJohannes Berg  */
6618ad7e718cSJohannes Berg static inline int cfg80211_testmode_reply(struct sk_buff *skb)
6619ad7e718cSJohannes Berg {
6620ad7e718cSJohannes Berg 	return cfg80211_vendor_cmd_reply(skb);
6621ad7e718cSJohannes Berg }
6622aff89a9bSJohannes Berg 
6623aff89a9bSJohannes Berg /**
6624aff89a9bSJohannes Berg  * cfg80211_testmode_alloc_event_skb - allocate testmode event
6625aff89a9bSJohannes Berg  * @wiphy: the wiphy
6626aff89a9bSJohannes Berg  * @approxlen: an upper bound of the length of the data that will
6627aff89a9bSJohannes Berg  *	be put into the skb
6628aff89a9bSJohannes Berg  * @gfp: allocation flags
6629aff89a9bSJohannes Berg  *
6630aff89a9bSJohannes Berg  * This function allocates and pre-fills an skb for an event on the
6631aff89a9bSJohannes Berg  * testmode multicast group.
6632aff89a9bSJohannes Berg  *
66330ae997dcSYacine Belkadi  * The returned skb is set up in the same way as with
66340ae997dcSYacine Belkadi  * cfg80211_testmode_alloc_reply_skb() but prepared for an event. As
66350ae997dcSYacine Belkadi  * there, you should simply add data to it that will then end up in the
66360ae997dcSYacine Belkadi  * %NL80211_ATTR_TESTDATA attribute. Again, you must not modify the skb
66370ae997dcSYacine Belkadi  * in any other way.
6638aff89a9bSJohannes Berg  *
6639aff89a9bSJohannes Berg  * When done filling the skb, call cfg80211_testmode_event() with the
6640aff89a9bSJohannes Berg  * skb to send the event.
66410ae997dcSYacine Belkadi  *
66420ae997dcSYacine Belkadi  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
6643aff89a9bSJohannes Berg  */
6644567ffc35SJohannes Berg static inline struct sk_buff *
6645567ffc35SJohannes Berg cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy, int approxlen, gfp_t gfp)
6646567ffc35SJohannes Berg {
66476c09e791SAhmad Kholaif 	return __cfg80211_alloc_event_skb(wiphy, NULL, NL80211_CMD_TESTMODE,
664855c1fdf0SJohannes Berg 					  NL80211_ATTR_TESTDATA, 0, -1,
6649567ffc35SJohannes Berg 					  approxlen, gfp);
6650567ffc35SJohannes Berg }
6651aff89a9bSJohannes Berg 
6652aff89a9bSJohannes Berg /**
6653aff89a9bSJohannes Berg  * cfg80211_testmode_event - send the event
6654aff89a9bSJohannes Berg  * @skb: The skb, must have been allocated with
6655aff89a9bSJohannes Berg  *	cfg80211_testmode_alloc_event_skb()
6656aff89a9bSJohannes Berg  * @gfp: allocation flags
6657aff89a9bSJohannes Berg  *
6658aff89a9bSJohannes Berg  * This function sends the given @skb, which must have been allocated
6659aff89a9bSJohannes Berg  * by cfg80211_testmode_alloc_event_skb(), as an event. It always
6660aff89a9bSJohannes Berg  * consumes it.
6661aff89a9bSJohannes Berg  */
6662567ffc35SJohannes Berg static inline void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp)
6663567ffc35SJohannes Berg {
6664567ffc35SJohannes Berg 	__cfg80211_send_event_skb(skb, gfp);
6665567ffc35SJohannes Berg }
6666aff89a9bSJohannes Berg 
6667aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd)	.testmode_cmd = (cmd),
666871063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd)	.testmode_dump = (cmd),
6669aff89a9bSJohannes Berg #else
6670aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd)
667171063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd)
6672aff89a9bSJohannes Berg #endif
6673aff89a9bSJohannes Berg 
6674b23aa676SSamuel Ortiz /**
667576804d28SArend Van Spriel  * struct cfg80211_fils_resp_params - FILS connection response params
667676804d28SArend Van Spriel  * @kek: KEK derived from a successful FILS connection (may be %NULL)
667776804d28SArend Van Spriel  * @kek_len: Length of @fils_kek in octets
667876804d28SArend Van Spriel  * @update_erp_next_seq_num: Boolean value to specify whether the value in
667976804d28SArend Van Spriel  *	@erp_next_seq_num is valid.
668076804d28SArend Van Spriel  * @erp_next_seq_num: The next sequence number to use in ERP message in
668176804d28SArend Van Spriel  *	FILS Authentication. This value should be specified irrespective of the
668276804d28SArend Van Spriel  *	status for a FILS connection.
668376804d28SArend Van Spriel  * @pmk: A new PMK if derived from a successful FILS connection (may be %NULL).
668476804d28SArend Van Spriel  * @pmk_len: Length of @pmk in octets
668576804d28SArend Van Spriel  * @pmkid: A new PMKID if derived from a successful FILS connection or the PMKID
668676804d28SArend Van Spriel  *	used for this FILS connection (may be %NULL).
668776804d28SArend Van Spriel  */
668876804d28SArend Van Spriel struct cfg80211_fils_resp_params {
668976804d28SArend Van Spriel 	const u8 *kek;
669076804d28SArend Van Spriel 	size_t kek_len;
669176804d28SArend Van Spriel 	bool update_erp_next_seq_num;
669276804d28SArend Van Spriel 	u16 erp_next_seq_num;
669376804d28SArend Van Spriel 	const u8 *pmk;
669476804d28SArend Van Spriel 	size_t pmk_len;
669576804d28SArend Van Spriel 	const u8 *pmkid;
669676804d28SArend Van Spriel };
669776804d28SArend Van Spriel 
669876804d28SArend Van Spriel /**
66995349a0f7SVidyullatha Kanchanapally  * struct cfg80211_connect_resp_params - Connection response params
67005349a0f7SVidyullatha Kanchanapally  * @status: Status code, %WLAN_STATUS_SUCCESS for successful connection, use
67015349a0f7SVidyullatha Kanchanapally  *	%WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
67025349a0f7SVidyullatha Kanchanapally  *	the real status code for failures. If this call is used to report a
67035349a0f7SVidyullatha Kanchanapally  *	failure due to a timeout (e.g., not receiving an Authentication frame
67045349a0f7SVidyullatha Kanchanapally  *	from the AP) instead of an explicit rejection by the AP, -1 is used to
67055349a0f7SVidyullatha Kanchanapally  *	indicate that this is a failure, but without a status code.
67065349a0f7SVidyullatha Kanchanapally  *	@timeout_reason is used to report the reason for the timeout in that
67075349a0f7SVidyullatha Kanchanapally  *	case.
67085349a0f7SVidyullatha Kanchanapally  * @bssid: The BSSID of the AP (may be %NULL)
67095349a0f7SVidyullatha Kanchanapally  * @bss: Entry of bss to which STA got connected to, can be obtained through
6710a3ce17d1SChaitanya Tata  *	cfg80211_get_bss() (may be %NULL). But it is recommended to store the
6711a3ce17d1SChaitanya Tata  *	bss from the connect_request and hold a reference to it and return
6712a3ce17d1SChaitanya Tata  *	through this param to avoid a warning if the bss is expired during the
6713a3ce17d1SChaitanya Tata  *	connection, esp. for those drivers implementing connect op.
6714a3ce17d1SChaitanya Tata  *	Only one parameter among @bssid and @bss needs to be specified.
67155349a0f7SVidyullatha Kanchanapally  * @req_ie: Association request IEs (may be %NULL)
67165349a0f7SVidyullatha Kanchanapally  * @req_ie_len: Association request IEs length
67175349a0f7SVidyullatha Kanchanapally  * @resp_ie: Association response IEs (may be %NULL)
67185349a0f7SVidyullatha Kanchanapally  * @resp_ie_len: Association response IEs length
671976804d28SArend Van Spriel  * @fils: FILS connection response parameters.
67205349a0f7SVidyullatha Kanchanapally  * @timeout_reason: Reason for connection timeout. This is used when the
67215349a0f7SVidyullatha Kanchanapally  *	connection fails due to a timeout instead of an explicit rejection from
67225349a0f7SVidyullatha Kanchanapally  *	the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is
67235349a0f7SVidyullatha Kanchanapally  *	not known. This value is used only if @status < 0 to indicate that the
67245349a0f7SVidyullatha Kanchanapally  *	failure is due to a timeout and not due to explicit rejection by the AP.
67255349a0f7SVidyullatha Kanchanapally  *	This value is ignored in other cases (@status >= 0).
67265349a0f7SVidyullatha Kanchanapally  */
67275349a0f7SVidyullatha Kanchanapally struct cfg80211_connect_resp_params {
67285349a0f7SVidyullatha Kanchanapally 	int status;
67295349a0f7SVidyullatha Kanchanapally 	const u8 *bssid;
67305349a0f7SVidyullatha Kanchanapally 	struct cfg80211_bss *bss;
67315349a0f7SVidyullatha Kanchanapally 	const u8 *req_ie;
67325349a0f7SVidyullatha Kanchanapally 	size_t req_ie_len;
67335349a0f7SVidyullatha Kanchanapally 	const u8 *resp_ie;
67345349a0f7SVidyullatha Kanchanapally 	size_t resp_ie_len;
673576804d28SArend Van Spriel 	struct cfg80211_fils_resp_params fils;
67365349a0f7SVidyullatha Kanchanapally 	enum nl80211_timeout_reason timeout_reason;
67375349a0f7SVidyullatha Kanchanapally };
67385349a0f7SVidyullatha Kanchanapally 
67395349a0f7SVidyullatha Kanchanapally /**
67405349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_done - notify cfg80211 of connection result
67415349a0f7SVidyullatha Kanchanapally  *
67425349a0f7SVidyullatha Kanchanapally  * @dev: network device
67435349a0f7SVidyullatha Kanchanapally  * @params: connection response parameters
67445349a0f7SVidyullatha Kanchanapally  * @gfp: allocation flags
67455349a0f7SVidyullatha Kanchanapally  *
67465349a0f7SVidyullatha Kanchanapally  * It should be called by the underlying driver once execution of the connection
67475349a0f7SVidyullatha Kanchanapally  * request from connect() has been completed. This is similar to
67485349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_bss(), but takes a structure pointer for connection response
67495349a0f7SVidyullatha Kanchanapally  * parameters. Only one of the functions among cfg80211_connect_bss(),
67505349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_result(), cfg80211_connect_timeout(),
67515349a0f7SVidyullatha Kanchanapally  * and cfg80211_connect_done() should be called.
67525349a0f7SVidyullatha Kanchanapally  */
67535349a0f7SVidyullatha Kanchanapally void cfg80211_connect_done(struct net_device *dev,
67545349a0f7SVidyullatha Kanchanapally 			   struct cfg80211_connect_resp_params *params,
67555349a0f7SVidyullatha Kanchanapally 			   gfp_t gfp);
67565349a0f7SVidyullatha Kanchanapally 
67575349a0f7SVidyullatha Kanchanapally /**
6758e7054989SKanchanapally, Vidyullatha  * cfg80211_connect_bss - notify cfg80211 of connection result
6759e7054989SKanchanapally, Vidyullatha  *
6760e7054989SKanchanapally, Vidyullatha  * @dev: network device
6761e7054989SKanchanapally, Vidyullatha  * @bssid: the BSSID of the AP
6762a3ce17d1SChaitanya Tata  * @bss: Entry of bss to which STA got connected to, can be obtained through
6763a3ce17d1SChaitanya Tata  *	cfg80211_get_bss() (may be %NULL). But it is recommended to store the
6764a3ce17d1SChaitanya Tata  *	bss from the connect_request and hold a reference to it and return
6765a3ce17d1SChaitanya Tata  *	through this param to avoid a warning if the bss is expired during the
6766a3ce17d1SChaitanya Tata  *	connection, esp. for those drivers implementing connect op.
6767a3ce17d1SChaitanya Tata  *	Only one parameter among @bssid and @bss needs to be specified.
6768e7054989SKanchanapally, Vidyullatha  * @req_ie: association request IEs (maybe be %NULL)
6769e7054989SKanchanapally, Vidyullatha  * @req_ie_len: association request IEs length
6770e7054989SKanchanapally, Vidyullatha  * @resp_ie: association response IEs (may be %NULL)
6771e7054989SKanchanapally, Vidyullatha  * @resp_ie_len: assoc response IEs length
6772c88215d7SJouni Malinen  * @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use
6773e7054989SKanchanapally, Vidyullatha  *	%WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
6774c88215d7SJouni Malinen  *	the real status code for failures. If this call is used to report a
6775c88215d7SJouni Malinen  *	failure due to a timeout (e.g., not receiving an Authentication frame
6776c88215d7SJouni Malinen  *	from the AP) instead of an explicit rejection by the AP, -1 is used to
6777c88215d7SJouni Malinen  *	indicate that this is a failure, but without a status code.
6778c88215d7SJouni Malinen  *	@timeout_reason is used to report the reason for the timeout in that
6779c88215d7SJouni Malinen  *	case.
6780e7054989SKanchanapally, Vidyullatha  * @gfp: allocation flags
67813093ebbeSPurushottam Kushwaha  * @timeout_reason: reason for connection timeout. This is used when the
67823093ebbeSPurushottam Kushwaha  *	connection fails due to a timeout instead of an explicit rejection from
67833093ebbeSPurushottam Kushwaha  *	the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is
67843093ebbeSPurushottam Kushwaha  *	not known. This value is used only if @status < 0 to indicate that the
67853093ebbeSPurushottam Kushwaha  *	failure is due to a timeout and not due to explicit rejection by the AP.
67863093ebbeSPurushottam Kushwaha  *	This value is ignored in other cases (@status >= 0).
6787e7054989SKanchanapally, Vidyullatha  *
6788c88215d7SJouni Malinen  * It should be called by the underlying driver once execution of the connection
6789c88215d7SJouni Malinen  * request from connect() has been completed. This is similar to
6790c88215d7SJouni Malinen  * cfg80211_connect_result(), but with the option of identifying the exact bss
67915349a0f7SVidyullatha Kanchanapally  * entry for the connection. Only one of the functions among
67925349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_bss(), cfg80211_connect_result(),
67935349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
6794e7054989SKanchanapally, Vidyullatha  */
67955349a0f7SVidyullatha Kanchanapally static inline void
67965349a0f7SVidyullatha Kanchanapally cfg80211_connect_bss(struct net_device *dev, const u8 *bssid,
6797e7054989SKanchanapally, Vidyullatha 		     struct cfg80211_bss *bss, const u8 *req_ie,
6798e7054989SKanchanapally, Vidyullatha 		     size_t req_ie_len, const u8 *resp_ie,
67993093ebbeSPurushottam Kushwaha 		     size_t resp_ie_len, int status, gfp_t gfp,
68005349a0f7SVidyullatha Kanchanapally 		     enum nl80211_timeout_reason timeout_reason)
68015349a0f7SVidyullatha Kanchanapally {
68025349a0f7SVidyullatha Kanchanapally 	struct cfg80211_connect_resp_params params;
68035349a0f7SVidyullatha Kanchanapally 
68045349a0f7SVidyullatha Kanchanapally 	memset(&params, 0, sizeof(params));
68055349a0f7SVidyullatha Kanchanapally 	params.status = status;
68065349a0f7SVidyullatha Kanchanapally 	params.bssid = bssid;
68075349a0f7SVidyullatha Kanchanapally 	params.bss = bss;
68085349a0f7SVidyullatha Kanchanapally 	params.req_ie = req_ie;
68095349a0f7SVidyullatha Kanchanapally 	params.req_ie_len = req_ie_len;
68105349a0f7SVidyullatha Kanchanapally 	params.resp_ie = resp_ie;
68115349a0f7SVidyullatha Kanchanapally 	params.resp_ie_len = resp_ie_len;
68125349a0f7SVidyullatha Kanchanapally 	params.timeout_reason = timeout_reason;
68135349a0f7SVidyullatha Kanchanapally 
68145349a0f7SVidyullatha Kanchanapally 	cfg80211_connect_done(dev, &params, gfp);
68155349a0f7SVidyullatha Kanchanapally }
6816e7054989SKanchanapally, Vidyullatha 
6817e7054989SKanchanapally, Vidyullatha /**
6818b23aa676SSamuel Ortiz  * cfg80211_connect_result - notify cfg80211 of connection result
6819b23aa676SSamuel Ortiz  *
6820b23aa676SSamuel Ortiz  * @dev: network device
6821b23aa676SSamuel Ortiz  * @bssid: the BSSID of the AP
6822b23aa676SSamuel Ortiz  * @req_ie: association request IEs (maybe be %NULL)
6823b23aa676SSamuel Ortiz  * @req_ie_len: association request IEs length
6824b23aa676SSamuel Ortiz  * @resp_ie: association response IEs (may be %NULL)
6825b23aa676SSamuel Ortiz  * @resp_ie_len: assoc response IEs length
6826c88215d7SJouni Malinen  * @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use
6827b23aa676SSamuel Ortiz  *	%WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
6828b23aa676SSamuel Ortiz  *	the real status code for failures.
6829b23aa676SSamuel Ortiz  * @gfp: allocation flags
6830b23aa676SSamuel Ortiz  *
6831c88215d7SJouni Malinen  * It should be called by the underlying driver once execution of the connection
6832c88215d7SJouni Malinen  * request from connect() has been completed. This is similar to
6833c88215d7SJouni Malinen  * cfg80211_connect_bss() which allows the exact bss entry to be specified. Only
68345349a0f7SVidyullatha Kanchanapally  * one of the functions among cfg80211_connect_bss(), cfg80211_connect_result(),
68355349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
6836b23aa676SSamuel Ortiz  */
6837e7054989SKanchanapally, Vidyullatha static inline void
6838e7054989SKanchanapally, Vidyullatha cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
6839b23aa676SSamuel Ortiz 			const u8 *req_ie, size_t req_ie_len,
6840b23aa676SSamuel Ortiz 			const u8 *resp_ie, size_t resp_ie_len,
6841e7054989SKanchanapally, Vidyullatha 			u16 status, gfp_t gfp)
6842e7054989SKanchanapally, Vidyullatha {
6843e7054989SKanchanapally, Vidyullatha 	cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, resp_ie,
68443093ebbeSPurushottam Kushwaha 			     resp_ie_len, status, gfp,
68453093ebbeSPurushottam Kushwaha 			     NL80211_TIMEOUT_UNSPECIFIED);
6846e7054989SKanchanapally, Vidyullatha }
6847b23aa676SSamuel Ortiz 
6848b23aa676SSamuel Ortiz /**
6849bf1ecd21SJouni Malinen  * cfg80211_connect_timeout - notify cfg80211 of connection timeout
6850bf1ecd21SJouni Malinen  *
6851bf1ecd21SJouni Malinen  * @dev: network device
6852bf1ecd21SJouni Malinen  * @bssid: the BSSID of the AP
6853bf1ecd21SJouni Malinen  * @req_ie: association request IEs (maybe be %NULL)
6854bf1ecd21SJouni Malinen  * @req_ie_len: association request IEs length
6855bf1ecd21SJouni Malinen  * @gfp: allocation flags
68563093ebbeSPurushottam Kushwaha  * @timeout_reason: reason for connection timeout.
6857bf1ecd21SJouni Malinen  *
6858bf1ecd21SJouni Malinen  * It should be called by the underlying driver whenever connect() has failed
6859bf1ecd21SJouni Malinen  * in a sequence where no explicit authentication/association rejection was
6860bf1ecd21SJouni Malinen  * received from the AP. This could happen, e.g., due to not being able to send
6861bf1ecd21SJouni Malinen  * out the Authentication or Association Request frame or timing out while
68625349a0f7SVidyullatha Kanchanapally  * waiting for the response. Only one of the functions among
68635349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_bss(), cfg80211_connect_result(),
68645349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
6865bf1ecd21SJouni Malinen  */
6866bf1ecd21SJouni Malinen static inline void
6867bf1ecd21SJouni Malinen cfg80211_connect_timeout(struct net_device *dev, const u8 *bssid,
68683093ebbeSPurushottam Kushwaha 			 const u8 *req_ie, size_t req_ie_len, gfp_t gfp,
68693093ebbeSPurushottam Kushwaha 			 enum nl80211_timeout_reason timeout_reason)
6870bf1ecd21SJouni Malinen {
6871bf1ecd21SJouni Malinen 	cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, NULL, 0, -1,
68723093ebbeSPurushottam Kushwaha 			     gfp, timeout_reason);
6873bf1ecd21SJouni Malinen }
6874bf1ecd21SJouni Malinen 
6875bf1ecd21SJouni Malinen /**
687629ce6ecbSAvraham Stern  * struct cfg80211_roam_info - driver initiated roaming information
687729ce6ecbSAvraham Stern  *
687829ce6ecbSAvraham Stern  * @channel: the channel of the new AP
687929ce6ecbSAvraham Stern  * @bss: entry of bss to which STA got roamed (may be %NULL if %bssid is set)
688029ce6ecbSAvraham Stern  * @bssid: the BSSID of the new AP (may be %NULL if %bss is set)
688129ce6ecbSAvraham Stern  * @req_ie: association request IEs (maybe be %NULL)
688229ce6ecbSAvraham Stern  * @req_ie_len: association request IEs length
688329ce6ecbSAvraham Stern  * @resp_ie: association response IEs (may be %NULL)
688429ce6ecbSAvraham Stern  * @resp_ie_len: assoc response IEs length
6885e841b7b1SArend Van Spriel  * @fils: FILS related roaming information.
688629ce6ecbSAvraham Stern  */
688729ce6ecbSAvraham Stern struct cfg80211_roam_info {
688829ce6ecbSAvraham Stern 	struct ieee80211_channel *channel;
688929ce6ecbSAvraham Stern 	struct cfg80211_bss *bss;
689029ce6ecbSAvraham Stern 	const u8 *bssid;
689129ce6ecbSAvraham Stern 	const u8 *req_ie;
689229ce6ecbSAvraham Stern 	size_t req_ie_len;
689329ce6ecbSAvraham Stern 	const u8 *resp_ie;
689429ce6ecbSAvraham Stern 	size_t resp_ie_len;
6895e841b7b1SArend Van Spriel 	struct cfg80211_fils_resp_params fils;
689629ce6ecbSAvraham Stern };
689729ce6ecbSAvraham Stern 
689829ce6ecbSAvraham Stern /**
6899b23aa676SSamuel Ortiz  * cfg80211_roamed - notify cfg80211 of roaming
6900b23aa676SSamuel Ortiz  *
6901b23aa676SSamuel Ortiz  * @dev: network device
690229ce6ecbSAvraham Stern  * @info: information about the new BSS. struct &cfg80211_roam_info.
6903b23aa676SSamuel Ortiz  * @gfp: allocation flags
6904b23aa676SSamuel Ortiz  *
690529ce6ecbSAvraham Stern  * This function may be called with the driver passing either the BSSID of the
690629ce6ecbSAvraham Stern  * new AP or passing the bss entry to avoid a race in timeout of the bss entry.
690729ce6ecbSAvraham Stern  * It should be called by the underlying driver whenever it roamed from one AP
690829ce6ecbSAvraham Stern  * to another while connected. Drivers which have roaming implemented in
690929ce6ecbSAvraham Stern  * firmware should pass the bss entry to avoid a race in bss entry timeout where
691029ce6ecbSAvraham Stern  * the bss entry of the new AP is seen in the driver, but gets timed out by the
691129ce6ecbSAvraham Stern  * time it is accessed in __cfg80211_roamed() due to delay in scheduling
6912adbde344SVasanthakumar Thiagarajan  * rdev->event_work. In case of any failures, the reference is released
691329ce6ecbSAvraham Stern  * either in cfg80211_roamed() or in __cfg80211_romed(), Otherwise, it will be
6914e1b18549SGeert Uytterhoeven  * released while disconnecting from the current bss.
6915adbde344SVasanthakumar Thiagarajan  */
691629ce6ecbSAvraham Stern void cfg80211_roamed(struct net_device *dev, struct cfg80211_roam_info *info,
691729ce6ecbSAvraham Stern 		     gfp_t gfp);
6918adbde344SVasanthakumar Thiagarajan 
6919adbde344SVasanthakumar Thiagarajan /**
6920503c1fb9SAvraham Stern  * cfg80211_port_authorized - notify cfg80211 of successful security association
6921503c1fb9SAvraham Stern  *
6922503c1fb9SAvraham Stern  * @dev: network device
6923503c1fb9SAvraham Stern  * @bssid: the BSSID of the AP
6924503c1fb9SAvraham Stern  * @gfp: allocation flags
6925503c1fb9SAvraham Stern  *
6926503c1fb9SAvraham Stern  * This function should be called by a driver that supports 4 way handshake
6927503c1fb9SAvraham Stern  * offload after a security association was successfully established (i.e.,
6928503c1fb9SAvraham Stern  * the 4 way handshake was completed successfully). The call to this function
6929503c1fb9SAvraham Stern  * should be preceded with a call to cfg80211_connect_result(),
6930503c1fb9SAvraham Stern  * cfg80211_connect_done(), cfg80211_connect_bss() or cfg80211_roamed() to
6931503c1fb9SAvraham Stern  * indicate the 802.11 association.
6932503c1fb9SAvraham Stern  */
6933503c1fb9SAvraham Stern void cfg80211_port_authorized(struct net_device *dev, const u8 *bssid,
6934503c1fb9SAvraham Stern 			      gfp_t gfp);
6935503c1fb9SAvraham Stern 
6936503c1fb9SAvraham Stern /**
6937b23aa676SSamuel Ortiz  * cfg80211_disconnected - notify cfg80211 that connection was dropped
6938b23aa676SSamuel Ortiz  *
6939b23aa676SSamuel Ortiz  * @dev: network device
6940b23aa676SSamuel Ortiz  * @ie: information elements of the deauth/disassoc frame (may be %NULL)
6941b23aa676SSamuel Ortiz  * @ie_len: length of IEs
6942b23aa676SSamuel Ortiz  * @reason: reason code for the disconnection, set it to 0 if unknown
694380279fb7SJohannes Berg  * @locally_generated: disconnection was requested locally
6944b23aa676SSamuel Ortiz  * @gfp: allocation flags
6945b23aa676SSamuel Ortiz  *
6946b23aa676SSamuel Ortiz  * After it calls this function, the driver should enter an idle state
6947b23aa676SSamuel Ortiz  * and not try to connect to any AP any more.
6948b23aa676SSamuel Ortiz  */
6949b23aa676SSamuel Ortiz void cfg80211_disconnected(struct net_device *dev, u16 reason,
695080279fb7SJohannes Berg 			   const u8 *ie, size_t ie_len,
695180279fb7SJohannes Berg 			   bool locally_generated, gfp_t gfp);
6952b23aa676SSamuel Ortiz 
69539588bbd5SJouni Malinen /**
69549588bbd5SJouni Malinen  * cfg80211_ready_on_channel - notification of remain_on_channel start
695571bbc994SJohannes Berg  * @wdev: wireless device
69569588bbd5SJouni Malinen  * @cookie: the request cookie
69579588bbd5SJouni Malinen  * @chan: The current channel (from remain_on_channel request)
69589588bbd5SJouni Malinen  * @duration: Duration in milliseconds that the driver intents to remain on the
69599588bbd5SJouni Malinen  *	channel
69609588bbd5SJouni Malinen  * @gfp: allocation flags
69619588bbd5SJouni Malinen  */
696271bbc994SJohannes Berg void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie,
69639588bbd5SJouni Malinen 			       struct ieee80211_channel *chan,
69649588bbd5SJouni Malinen 			       unsigned int duration, gfp_t gfp);
69659588bbd5SJouni Malinen 
69669588bbd5SJouni Malinen /**
69679588bbd5SJouni Malinen  * cfg80211_remain_on_channel_expired - remain_on_channel duration expired
696871bbc994SJohannes Berg  * @wdev: wireless device
69699588bbd5SJouni Malinen  * @cookie: the request cookie
69709588bbd5SJouni Malinen  * @chan: The current channel (from remain_on_channel request)
69719588bbd5SJouni Malinen  * @gfp: allocation flags
69729588bbd5SJouni Malinen  */
697371bbc994SJohannes Berg void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie,
69749588bbd5SJouni Malinen 					struct ieee80211_channel *chan,
69759588bbd5SJouni Malinen 					gfp_t gfp);
6976b23aa676SSamuel Ortiz 
69778689c051SArend van Spriel /**
69781c38c7f2SJames Prestwood  * cfg80211_tx_mgmt_expired - tx_mgmt duration expired
69791c38c7f2SJames Prestwood  * @wdev: wireless device
69801c38c7f2SJames Prestwood  * @cookie: the requested cookie
69811c38c7f2SJames Prestwood  * @chan: The current channel (from tx_mgmt request)
69821c38c7f2SJames Prestwood  * @gfp: allocation flags
69831c38c7f2SJames Prestwood  */
69841c38c7f2SJames Prestwood void cfg80211_tx_mgmt_expired(struct wireless_dev *wdev, u64 cookie,
69851c38c7f2SJames Prestwood 			      struct ieee80211_channel *chan, gfp_t gfp);
69861c38c7f2SJames Prestwood 
69871c38c7f2SJames Prestwood /**
69888689c051SArend van Spriel  * cfg80211_sinfo_alloc_tid_stats - allocate per-tid statistics.
69898689c051SArend van Spriel  *
69908689c051SArend van Spriel  * @sinfo: the station information
69918689c051SArend van Spriel  * @gfp: allocation flags
69928689c051SArend van Spriel  */
69938689c051SArend van Spriel int cfg80211_sinfo_alloc_tid_stats(struct station_info *sinfo, gfp_t gfp);
699498b62183SJohannes Berg 
699598b62183SJohannes Berg /**
69967ea3e110SJohannes Berg  * cfg80211_sinfo_release_content - release contents of station info
69977ea3e110SJohannes Berg  * @sinfo: the station information
69987ea3e110SJohannes Berg  *
69997ea3e110SJohannes Berg  * Releases any potentially allocated sub-information of the station
70007ea3e110SJohannes Berg  * information, but not the struct itself (since it's typically on
70017ea3e110SJohannes Berg  * the stack.)
70027ea3e110SJohannes Berg  */
70037ea3e110SJohannes Berg static inline void cfg80211_sinfo_release_content(struct station_info *sinfo)
70047ea3e110SJohannes Berg {
70057ea3e110SJohannes Berg 	kfree(sinfo->pertid);
70067ea3e110SJohannes Berg }
70077ea3e110SJohannes Berg 
70087ea3e110SJohannes Berg /**
700998b62183SJohannes Berg  * cfg80211_new_sta - notify userspace about station
701098b62183SJohannes Berg  *
701198b62183SJohannes Berg  * @dev: the netdev
701298b62183SJohannes Berg  * @mac_addr: the station's address
701398b62183SJohannes Berg  * @sinfo: the station information
701498b62183SJohannes Berg  * @gfp: allocation flags
701598b62183SJohannes Berg  */
701698b62183SJohannes Berg void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr,
701798b62183SJohannes Berg 		      struct station_info *sinfo, gfp_t gfp);
701898b62183SJohannes Berg 
7019026331c4SJouni Malinen /**
7020cf5ead82SJohannes Berg  * cfg80211_del_sta_sinfo - notify userspace about deletion of a station
7021cf5ead82SJohannes Berg  * @dev: the netdev
7022cf5ead82SJohannes Berg  * @mac_addr: the station's address
7023cf5ead82SJohannes Berg  * @sinfo: the station information/statistics
7024cf5ead82SJohannes Berg  * @gfp: allocation flags
7025cf5ead82SJohannes Berg  */
7026cf5ead82SJohannes Berg void cfg80211_del_sta_sinfo(struct net_device *dev, const u8 *mac_addr,
7027cf5ead82SJohannes Berg 			    struct station_info *sinfo, gfp_t gfp);
7028cf5ead82SJohannes Berg 
7029cf5ead82SJohannes Berg /**
7030ec15e68bSJouni Malinen  * cfg80211_del_sta - notify userspace about deletion of a station
7031ec15e68bSJouni Malinen  *
7032ec15e68bSJouni Malinen  * @dev: the netdev
7033ec15e68bSJouni Malinen  * @mac_addr: the station's address
7034ec15e68bSJouni Malinen  * @gfp: allocation flags
7035ec15e68bSJouni Malinen  */
7036cf5ead82SJohannes Berg static inline void cfg80211_del_sta(struct net_device *dev,
7037cf5ead82SJohannes Berg 				    const u8 *mac_addr, gfp_t gfp)
7038cf5ead82SJohannes Berg {
7039cf5ead82SJohannes Berg 	cfg80211_del_sta_sinfo(dev, mac_addr, NULL, gfp);
7040cf5ead82SJohannes Berg }
7041ec15e68bSJouni Malinen 
7042ec15e68bSJouni Malinen /**
7043ed44a951SPandiyarajan Pitchaimuthu  * cfg80211_conn_failed - connection request failed notification
7044ed44a951SPandiyarajan Pitchaimuthu  *
7045ed44a951SPandiyarajan Pitchaimuthu  * @dev: the netdev
7046ed44a951SPandiyarajan Pitchaimuthu  * @mac_addr: the station's address
7047ed44a951SPandiyarajan Pitchaimuthu  * @reason: the reason for connection failure
7048ed44a951SPandiyarajan Pitchaimuthu  * @gfp: allocation flags
7049ed44a951SPandiyarajan Pitchaimuthu  *
7050ed44a951SPandiyarajan Pitchaimuthu  * Whenever a station tries to connect to an AP and if the station
7051ed44a951SPandiyarajan Pitchaimuthu  * could not connect to the AP as the AP has rejected the connection
7052ed44a951SPandiyarajan Pitchaimuthu  * for some reasons, this function is called.
7053ed44a951SPandiyarajan Pitchaimuthu  *
7054ed44a951SPandiyarajan Pitchaimuthu  * The reason for connection failure can be any of the value from
7055ed44a951SPandiyarajan Pitchaimuthu  * nl80211_connect_failed_reason enum
7056ed44a951SPandiyarajan Pitchaimuthu  */
7057ed44a951SPandiyarajan Pitchaimuthu void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr,
7058ed44a951SPandiyarajan Pitchaimuthu 			  enum nl80211_connect_failed_reason reason,
7059ed44a951SPandiyarajan Pitchaimuthu 			  gfp_t gfp);
7060ed44a951SPandiyarajan Pitchaimuthu 
7061ed44a951SPandiyarajan Pitchaimuthu /**
7062e76fede8SThomas Pedersen  * cfg80211_rx_mgmt_khz - notification of received, unprocessed management frame
7063e76fede8SThomas Pedersen  * @wdev: wireless device receiving the frame
7064e76fede8SThomas Pedersen  * @freq: Frequency on which the frame was received in KHz
7065e76fede8SThomas Pedersen  * @sig_dbm: signal strength in dBm, or 0 if unknown
7066e76fede8SThomas Pedersen  * @buf: Management frame (header + body)
7067e76fede8SThomas Pedersen  * @len: length of the frame data
7068e76fede8SThomas Pedersen  * @flags: flags, as defined in enum nl80211_rxmgmt_flags
7069e76fede8SThomas Pedersen  *
7070e76fede8SThomas Pedersen  * This function is called whenever an Action frame is received for a station
7071e76fede8SThomas Pedersen  * mode interface, but is not processed in kernel.
7072e76fede8SThomas Pedersen  *
7073e76fede8SThomas Pedersen  * Return: %true if a user space application has registered for this frame.
7074e76fede8SThomas Pedersen  * For action frames, that makes it responsible for rejecting unrecognized
7075e76fede8SThomas Pedersen  * action frames; %false otherwise, in which case for action frames the
7076e76fede8SThomas Pedersen  * driver is responsible for rejecting the frame.
7077e76fede8SThomas Pedersen  */
7078e76fede8SThomas Pedersen bool cfg80211_rx_mgmt_khz(struct wireless_dev *wdev, int freq, int sig_dbm,
7079e76fede8SThomas Pedersen 			  const u8 *buf, size_t len, u32 flags);
7080e76fede8SThomas Pedersen 
7081e76fede8SThomas Pedersen /**
70822e161f78SJohannes Berg  * cfg80211_rx_mgmt - notification of received, unprocessed management frame
708371bbc994SJohannes Berg  * @wdev: wireless device receiving the frame
7084026331c4SJouni Malinen  * @freq: Frequency on which the frame was received in MHz
70856c2fb1e6SSergey Matyukevich  * @sig_dbm: signal strength in dBm, or 0 if unknown
70862e161f78SJohannes Berg  * @buf: Management frame (header + body)
7087026331c4SJouni Malinen  * @len: length of the frame data
708819504cf5SVladimir Kondratiev  * @flags: flags, as defined in enum nl80211_rxmgmt_flags
70892e161f78SJohannes Berg  *
70900ae997dcSYacine Belkadi  * This function is called whenever an Action frame is received for a station
70910ae997dcSYacine Belkadi  * mode interface, but is not processed in kernel.
70920ae997dcSYacine Belkadi  *
70930ae997dcSYacine Belkadi  * Return: %true if a user space application has registered for this frame.
70942e161f78SJohannes Berg  * For action frames, that makes it responsible for rejecting unrecognized
70952e161f78SJohannes Berg  * action frames; %false otherwise, in which case for action frames the
70962e161f78SJohannes Berg  * driver is responsible for rejecting the frame.
7097026331c4SJouni Malinen  */
7098e76fede8SThomas Pedersen static inline bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq,
7099e76fede8SThomas Pedersen 				    int sig_dbm, const u8 *buf, size_t len,
7100e76fede8SThomas Pedersen 				    u32 flags)
7101e76fede8SThomas Pedersen {
7102e76fede8SThomas Pedersen 	return cfg80211_rx_mgmt_khz(wdev, MHZ_TO_KHZ(freq), sig_dbm, buf, len,
7103e76fede8SThomas Pedersen 				    flags);
7104e76fede8SThomas Pedersen }
7105026331c4SJouni Malinen 
7106026331c4SJouni Malinen /**
71072e161f78SJohannes Berg  * cfg80211_mgmt_tx_status - notification of TX status for management frame
710871bbc994SJohannes Berg  * @wdev: wireless device receiving the frame
71092e161f78SJohannes Berg  * @cookie: Cookie returned by cfg80211_ops::mgmt_tx()
71102e161f78SJohannes Berg  * @buf: Management frame (header + body)
7111026331c4SJouni Malinen  * @len: length of the frame data
7112026331c4SJouni Malinen  * @ack: Whether frame was acknowledged
7113026331c4SJouni Malinen  * @gfp: context flags
7114026331c4SJouni Malinen  *
71152e161f78SJohannes Berg  * This function is called whenever a management frame was requested to be
71162e161f78SJohannes Berg  * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the
7117026331c4SJouni Malinen  * transmission attempt.
7118026331c4SJouni Malinen  */
711971bbc994SJohannes Berg void cfg80211_mgmt_tx_status(struct wireless_dev *wdev, u64 cookie,
7120026331c4SJouni Malinen 			     const u8 *buf, size_t len, bool ack, gfp_t gfp);
7121026331c4SJouni Malinen 
7122dca9ca2dSMarkus Theil /**
7123dca9ca2dSMarkus Theil  * cfg80211_control_port_tx_status - notification of TX status for control
7124dca9ca2dSMarkus Theil  *                                   port frames
7125dca9ca2dSMarkus Theil  * @wdev: wireless device receiving the frame
7126dca9ca2dSMarkus Theil  * @cookie: Cookie returned by cfg80211_ops::tx_control_port()
7127dca9ca2dSMarkus Theil  * @buf: Data frame (header + body)
7128dca9ca2dSMarkus Theil  * @len: length of the frame data
7129dca9ca2dSMarkus Theil  * @ack: Whether frame was acknowledged
7130dca9ca2dSMarkus Theil  * @gfp: context flags
7131dca9ca2dSMarkus Theil  *
7132dca9ca2dSMarkus Theil  * This function is called whenever a control port frame was requested to be
7133dca9ca2dSMarkus Theil  * transmitted with cfg80211_ops::tx_control_port() to report the TX status of
7134dca9ca2dSMarkus Theil  * the transmission attempt.
7135dca9ca2dSMarkus Theil  */
7136dca9ca2dSMarkus Theil void cfg80211_control_port_tx_status(struct wireless_dev *wdev, u64 cookie,
7137dca9ca2dSMarkus Theil 				     const u8 *buf, size_t len, bool ack,
7138dca9ca2dSMarkus Theil 				     gfp_t gfp);
7139d6dc1a38SJuuso Oikarinen 
7140d6dc1a38SJuuso Oikarinen /**
71416a671a50SDenis Kenzior  * cfg80211_rx_control_port - notification about a received control port frame
71426a671a50SDenis Kenzior  * @dev: The device the frame matched to
7143a948f713SDenis Kenzior  * @skb: The skbuf with the control port frame.  It is assumed that the skbuf
7144a948f713SDenis Kenzior  *	is 802.3 formatted (with 802.3 header).  The skb can be non-linear.
7145a948f713SDenis Kenzior  *	This function does not take ownership of the skb, so the caller is
7146a948f713SDenis Kenzior  *	responsible for any cleanup.  The caller must also ensure that
7147a948f713SDenis Kenzior  *	skb->protocol is set appropriately.
71486a671a50SDenis Kenzior  * @unencrypted: Whether the frame was received unencrypted
71496a671a50SDenis Kenzior  *
71506a671a50SDenis Kenzior  * This function is used to inform userspace about a received control port
71516a671a50SDenis Kenzior  * frame.  It should only be used if userspace indicated it wants to receive
71526a671a50SDenis Kenzior  * control port frames over nl80211.
71536a671a50SDenis Kenzior  *
71546a671a50SDenis Kenzior  * The frame is the data portion of the 802.3 or 802.11 data frame with all
71556a671a50SDenis Kenzior  * network layer headers removed (e.g. the raw EAPoL frame).
71566a671a50SDenis Kenzior  *
71576a671a50SDenis Kenzior  * Return: %true if the frame was passed to userspace
71586a671a50SDenis Kenzior  */
71596a671a50SDenis Kenzior bool cfg80211_rx_control_port(struct net_device *dev,
7160a948f713SDenis Kenzior 			      struct sk_buff *skb, bool unencrypted);
71616a671a50SDenis Kenzior 
71626a671a50SDenis Kenzior /**
7163d6dc1a38SJuuso Oikarinen  * cfg80211_cqm_rssi_notify - connection quality monitoring rssi event
7164d6dc1a38SJuuso Oikarinen  * @dev: network device
7165d6dc1a38SJuuso Oikarinen  * @rssi_event: the triggered RSSI event
7166bee427b8SAndrzej Zaborowski  * @rssi_level: new RSSI level value or 0 if not available
7167d6dc1a38SJuuso Oikarinen  * @gfp: context flags
7168d6dc1a38SJuuso Oikarinen  *
7169d6dc1a38SJuuso Oikarinen  * This function is called when a configured connection quality monitoring
7170d6dc1a38SJuuso Oikarinen  * rssi threshold reached event occurs.
7171d6dc1a38SJuuso Oikarinen  */
7172d6dc1a38SJuuso Oikarinen void cfg80211_cqm_rssi_notify(struct net_device *dev,
7173d6dc1a38SJuuso Oikarinen 			      enum nl80211_cqm_rssi_threshold_event rssi_event,
7174bee427b8SAndrzej Zaborowski 			      s32 rssi_level, gfp_t gfp);
7175d6dc1a38SJuuso Oikarinen 
7176c063dbf5SJohannes Berg /**
7177c063dbf5SJohannes Berg  * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer
7178c063dbf5SJohannes Berg  * @dev: network device
7179c063dbf5SJohannes Berg  * @peer: peer's MAC address
7180c063dbf5SJohannes Berg  * @num_packets: how many packets were lost -- should be a fixed threshold
7181c063dbf5SJohannes Berg  *	but probably no less than maybe 50, or maybe a throughput dependent
7182c063dbf5SJohannes Berg  *	threshold (to account for temporary interference)
7183c063dbf5SJohannes Berg  * @gfp: context flags
7184c063dbf5SJohannes Berg  */
7185c063dbf5SJohannes Berg void cfg80211_cqm_pktloss_notify(struct net_device *dev,
7186c063dbf5SJohannes Berg 				 const u8 *peer, u32 num_packets, gfp_t gfp);
7187c063dbf5SJohannes Berg 
7188e5497d76SJohannes Berg /**
718984f10708SThomas Pedersen  * cfg80211_cqm_txe_notify - TX error rate event
719084f10708SThomas Pedersen  * @dev: network device
719184f10708SThomas Pedersen  * @peer: peer's MAC address
719284f10708SThomas Pedersen  * @num_packets: how many packets were lost
719384f10708SThomas Pedersen  * @rate: % of packets which failed transmission
719484f10708SThomas Pedersen  * @intvl: interval (in s) over which the TX failure threshold was breached.
719584f10708SThomas Pedersen  * @gfp: context flags
719684f10708SThomas Pedersen  *
719784f10708SThomas Pedersen  * Notify userspace when configured % TX failures over number of packets in a
719884f10708SThomas Pedersen  * given interval is exceeded.
719984f10708SThomas Pedersen  */
720084f10708SThomas Pedersen void cfg80211_cqm_txe_notify(struct net_device *dev, const u8 *peer,
720184f10708SThomas Pedersen 			     u32 num_packets, u32 rate, u32 intvl, gfp_t gfp);
720284f10708SThomas Pedersen 
720384f10708SThomas Pedersen /**
720498f03342SJohannes Berg  * cfg80211_cqm_beacon_loss_notify - beacon loss event
720598f03342SJohannes Berg  * @dev: network device
720698f03342SJohannes Berg  * @gfp: context flags
720798f03342SJohannes Berg  *
720898f03342SJohannes Berg  * Notify userspace about beacon loss from the connected AP.
720998f03342SJohannes Berg  */
721098f03342SJohannes Berg void cfg80211_cqm_beacon_loss_notify(struct net_device *dev, gfp_t gfp);
721198f03342SJohannes Berg 
721298f03342SJohannes Berg /**
72135b97f49dSJohannes Berg  * cfg80211_radar_event - radar detection event
72145b97f49dSJohannes Berg  * @wiphy: the wiphy
72155b97f49dSJohannes Berg  * @chandef: chandef for the current channel
72165b97f49dSJohannes Berg  * @gfp: context flags
72175b97f49dSJohannes Berg  *
72185b97f49dSJohannes Berg  * This function is called when a radar is detected on the current chanenl.
72195b97f49dSJohannes Berg  */
72205b97f49dSJohannes Berg void cfg80211_radar_event(struct wiphy *wiphy,
72215b97f49dSJohannes Berg 			  struct cfg80211_chan_def *chandef, gfp_t gfp);
72225b97f49dSJohannes Berg 
72235b97f49dSJohannes Berg /**
7224466b9936Stamizhr@codeaurora.org  * cfg80211_sta_opmode_change_notify - STA's ht/vht operation mode change event
7225466b9936Stamizhr@codeaurora.org  * @dev: network device
7226466b9936Stamizhr@codeaurora.org  * @mac: MAC address of a station which opmode got modified
7227466b9936Stamizhr@codeaurora.org  * @sta_opmode: station's current opmode value
7228466b9936Stamizhr@codeaurora.org  * @gfp: context flags
7229466b9936Stamizhr@codeaurora.org  *
7230466b9936Stamizhr@codeaurora.org  * Driver should call this function when station's opmode modified via action
7231466b9936Stamizhr@codeaurora.org  * frame.
7232466b9936Stamizhr@codeaurora.org  */
7233466b9936Stamizhr@codeaurora.org void cfg80211_sta_opmode_change_notify(struct net_device *dev, const u8 *mac,
7234466b9936Stamizhr@codeaurora.org 				       struct sta_opmode_info *sta_opmode,
7235466b9936Stamizhr@codeaurora.org 				       gfp_t gfp);
7236466b9936Stamizhr@codeaurora.org 
7237466b9936Stamizhr@codeaurora.org /**
72385b97f49dSJohannes Berg  * cfg80211_cac_event - Channel availability check (CAC) event
72395b97f49dSJohannes Berg  * @netdev: network device
72405b97f49dSJohannes Berg  * @chandef: chandef for the current channel
72415b97f49dSJohannes Berg  * @event: type of event
72425b97f49dSJohannes Berg  * @gfp: context flags
72435b97f49dSJohannes Berg  *
72445b97f49dSJohannes Berg  * This function is called when a Channel availability check (CAC) is finished
72455b97f49dSJohannes Berg  * or aborted. This must be called to notify the completion of a CAC process,
72465b97f49dSJohannes Berg  * also by full-MAC drivers.
72475b97f49dSJohannes Berg  */
72485b97f49dSJohannes Berg void cfg80211_cac_event(struct net_device *netdev,
72495b97f49dSJohannes Berg 			const struct cfg80211_chan_def *chandef,
72505b97f49dSJohannes Berg 			enum nl80211_radar_event event, gfp_t gfp);
72515b97f49dSJohannes Berg 
72525b97f49dSJohannes Berg 
72535b97f49dSJohannes Berg /**
7254e5497d76SJohannes Berg  * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying
7255e5497d76SJohannes Berg  * @dev: network device
7256e5497d76SJohannes Berg  * @bssid: BSSID of AP (to avoid races)
7257e5497d76SJohannes Berg  * @replay_ctr: new replay counter
7258af71ff85SJohannes Berg  * @gfp: allocation flags
7259e5497d76SJohannes Berg  */
7260e5497d76SJohannes Berg void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid,
7261e5497d76SJohannes Berg 			       const u8 *replay_ctr, gfp_t gfp);
7262e5497d76SJohannes Berg 
7263c9df56b4SJouni Malinen /**
7264c9df56b4SJouni Malinen  * cfg80211_pmksa_candidate_notify - notify about PMKSA caching candidate
7265c9df56b4SJouni Malinen  * @dev: network device
7266c9df56b4SJouni Malinen  * @index: candidate index (the smaller the index, the higher the priority)
7267c9df56b4SJouni Malinen  * @bssid: BSSID of AP
7268c9df56b4SJouni Malinen  * @preauth: Whether AP advertises support for RSN pre-authentication
7269c9df56b4SJouni Malinen  * @gfp: allocation flags
7270c9df56b4SJouni Malinen  */
7271c9df56b4SJouni Malinen void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index,
7272c9df56b4SJouni Malinen 				     const u8 *bssid, bool preauth, gfp_t gfp);
7273c9df56b4SJouni Malinen 
727428946da7SJohannes Berg /**
727528946da7SJohannes Berg  * cfg80211_rx_spurious_frame - inform userspace about a spurious frame
727628946da7SJohannes Berg  * @dev: The device the frame matched to
727728946da7SJohannes Berg  * @addr: the transmitter address
727828946da7SJohannes Berg  * @gfp: context flags
727928946da7SJohannes Berg  *
728028946da7SJohannes Berg  * This function is used in AP mode (only!) to inform userspace that
728128946da7SJohannes Berg  * a spurious class 3 frame was received, to be able to deauth the
728228946da7SJohannes Berg  * sender.
72830ae997dcSYacine Belkadi  * Return: %true if the frame was passed to userspace (or this failed
728428946da7SJohannes Berg  * for a reason other than not having a subscription.)
728528946da7SJohannes Berg  */
728628946da7SJohannes Berg bool cfg80211_rx_spurious_frame(struct net_device *dev,
728728946da7SJohannes Berg 				const u8 *addr, gfp_t gfp);
728828946da7SJohannes Berg 
72897f6cf311SJohannes Berg /**
7290b92ab5d8SJohannes Berg  * cfg80211_rx_unexpected_4addr_frame - inform about unexpected WDS frame
7291b92ab5d8SJohannes Berg  * @dev: The device the frame matched to
7292b92ab5d8SJohannes Berg  * @addr: the transmitter address
7293b92ab5d8SJohannes Berg  * @gfp: context flags
7294b92ab5d8SJohannes Berg  *
7295b92ab5d8SJohannes Berg  * This function is used in AP mode (only!) to inform userspace that
7296b92ab5d8SJohannes Berg  * an associated station sent a 4addr frame but that wasn't expected.
7297b92ab5d8SJohannes Berg  * It is allowed and desirable to send this event only once for each
7298b92ab5d8SJohannes Berg  * station to avoid event flooding.
72990ae997dcSYacine Belkadi  * Return: %true if the frame was passed to userspace (or this failed
7300b92ab5d8SJohannes Berg  * for a reason other than not having a subscription.)
7301b92ab5d8SJohannes Berg  */
7302b92ab5d8SJohannes Berg bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev,
7303b92ab5d8SJohannes Berg 					const u8 *addr, gfp_t gfp);
7304b92ab5d8SJohannes Berg 
7305b92ab5d8SJohannes Berg /**
73067f6cf311SJohannes Berg  * cfg80211_probe_status - notify userspace about probe status
73077f6cf311SJohannes Berg  * @dev: the device the probe was sent on
73087f6cf311SJohannes Berg  * @addr: the address of the peer
73097f6cf311SJohannes Berg  * @cookie: the cookie filled in @probe_client previously
73107f6cf311SJohannes Berg  * @acked: indicates whether probe was acked or not
7311c4b50cd3SVenkateswara Naralasetty  * @ack_signal: signal strength (in dBm) of the ACK frame.
7312c4b50cd3SVenkateswara Naralasetty  * @is_valid_ack_signal: indicates the ack_signal is valid or not.
73137f6cf311SJohannes Berg  * @gfp: allocation flags
73147f6cf311SJohannes Berg  */
73157f6cf311SJohannes Berg void cfg80211_probe_status(struct net_device *dev, const u8 *addr,
7316c4b50cd3SVenkateswara Naralasetty 			   u64 cookie, bool acked, s32 ack_signal,
7317c4b50cd3SVenkateswara Naralasetty 			   bool is_valid_ack_signal, gfp_t gfp);
73187f6cf311SJohannes Berg 
73195e760230SJohannes Berg /**
7320e76fede8SThomas Pedersen  * cfg80211_report_obss_beacon_khz - report beacon from other APs
7321e76fede8SThomas Pedersen  * @wiphy: The wiphy that received the beacon
7322e76fede8SThomas Pedersen  * @frame: the frame
7323e76fede8SThomas Pedersen  * @len: length of the frame
7324e76fede8SThomas Pedersen  * @freq: frequency the frame was received on in KHz
7325e76fede8SThomas Pedersen  * @sig_dbm: signal strength in dBm, or 0 if unknown
7326e76fede8SThomas Pedersen  *
7327e76fede8SThomas Pedersen  * Use this function to report to userspace when a beacon was
7328e76fede8SThomas Pedersen  * received. It is not useful to call this when there is no
7329e76fede8SThomas Pedersen  * netdev that is in AP/GO mode.
7330e76fede8SThomas Pedersen  */
7331e76fede8SThomas Pedersen void cfg80211_report_obss_beacon_khz(struct wiphy *wiphy, const u8 *frame,
7332e76fede8SThomas Pedersen 				     size_t len, int freq, int sig_dbm);
7333e76fede8SThomas Pedersen 
7334e76fede8SThomas Pedersen /**
73355e760230SJohannes Berg  * cfg80211_report_obss_beacon - report beacon from other APs
73365e760230SJohannes Berg  * @wiphy: The wiphy that received the beacon
73375e760230SJohannes Berg  * @frame: the frame
73385e760230SJohannes Berg  * @len: length of the frame
73395e760230SJohannes Berg  * @freq: frequency the frame was received on
73406c2fb1e6SSergey Matyukevich  * @sig_dbm: signal strength in dBm, or 0 if unknown
73415e760230SJohannes Berg  *
73425e760230SJohannes Berg  * Use this function to report to userspace when a beacon was
73435e760230SJohannes Berg  * received. It is not useful to call this when there is no
73445e760230SJohannes Berg  * netdev that is in AP/GO mode.
73455e760230SJohannes Berg  */
7346e76fede8SThomas Pedersen static inline void cfg80211_report_obss_beacon(struct wiphy *wiphy,
73475e760230SJohannes Berg 					       const u8 *frame, size_t len,
7348e76fede8SThomas Pedersen 					       int freq, int sig_dbm)
7349e76fede8SThomas Pedersen {
7350e76fede8SThomas Pedersen 	cfg80211_report_obss_beacon_khz(wiphy, frame, len, MHZ_TO_KHZ(freq),
7351e76fede8SThomas Pedersen 					sig_dbm);
7352e76fede8SThomas Pedersen }
73535e760230SJohannes Berg 
7354d58e7e37SJohannes Berg /**
7355683b6d3bSJohannes Berg  * cfg80211_reg_can_beacon - check if beaconing is allowed
735654858ee5SAlexander Simon  * @wiphy: the wiphy
7357683b6d3bSJohannes Berg  * @chandef: the channel definition
7358174e0cd2SIlan Peer  * @iftype: interface type
7359d58e7e37SJohannes Berg  *
73600ae997dcSYacine Belkadi  * Return: %true if there is no secondary channel or the secondary channel(s)
73610ae997dcSYacine Belkadi  * can be used for beaconing (i.e. is not a radar channel etc.)
736254858ee5SAlexander Simon  */
7363683b6d3bSJohannes Berg bool cfg80211_reg_can_beacon(struct wiphy *wiphy,
7364174e0cd2SIlan Peer 			     struct cfg80211_chan_def *chandef,
7365174e0cd2SIlan Peer 			     enum nl80211_iftype iftype);
736654858ee5SAlexander Simon 
7367923b352fSArik Nemtsov /**
7368923b352fSArik Nemtsov  * cfg80211_reg_can_beacon_relax - check if beaconing is allowed with relaxation
7369923b352fSArik Nemtsov  * @wiphy: the wiphy
7370923b352fSArik Nemtsov  * @chandef: the channel definition
7371923b352fSArik Nemtsov  * @iftype: interface type
7372923b352fSArik Nemtsov  *
7373923b352fSArik Nemtsov  * Return: %true if there is no secondary channel or the secondary channel(s)
7374923b352fSArik Nemtsov  * can be used for beaconing (i.e. is not a radar channel etc.). This version
7375923b352fSArik Nemtsov  * also checks if IR-relaxation conditions apply, to allow beaconing under
7376923b352fSArik Nemtsov  * more permissive conditions.
7377923b352fSArik Nemtsov  *
7378923b352fSArik Nemtsov  * Requires the RTNL to be held.
7379923b352fSArik Nemtsov  */
7380923b352fSArik Nemtsov bool cfg80211_reg_can_beacon_relax(struct wiphy *wiphy,
7381923b352fSArik Nemtsov 				   struct cfg80211_chan_def *chandef,
7382923b352fSArik Nemtsov 				   enum nl80211_iftype iftype);
7383923b352fSArik Nemtsov 
73848097e149SThomas Pedersen /*
73855314526bSThomas Pedersen  * cfg80211_ch_switch_notify - update wdev channel and notify userspace
73865314526bSThomas Pedersen  * @dev: the device which switched channels
7387683b6d3bSJohannes Berg  * @chandef: the new channel definition
73885314526bSThomas Pedersen  *
7389e487eaebSSimon Wunderlich  * Caller must acquire wdev_lock, therefore must only be called from sleepable
7390e487eaebSSimon Wunderlich  * driver context!
73915314526bSThomas Pedersen  */
7392683b6d3bSJohannes Berg void cfg80211_ch_switch_notify(struct net_device *dev,
7393683b6d3bSJohannes Berg 			       struct cfg80211_chan_def *chandef);
73945314526bSThomas Pedersen 
7395f8d7552eSLuciano Coelho /*
7396f8d7552eSLuciano Coelho  * cfg80211_ch_switch_started_notify - notify channel switch start
7397f8d7552eSLuciano Coelho  * @dev: the device on which the channel switch started
7398f8d7552eSLuciano Coelho  * @chandef: the future channel definition
7399f8d7552eSLuciano Coelho  * @count: the number of TBTTs until the channel switch happens
7400f8d7552eSLuciano Coelho  *
7401f8d7552eSLuciano Coelho  * Inform the userspace about the channel switch that has just
7402f8d7552eSLuciano Coelho  * started, so that it can take appropriate actions (eg. starting
7403f8d7552eSLuciano Coelho  * channel switch on other vifs), if necessary.
7404f8d7552eSLuciano Coelho  */
7405f8d7552eSLuciano Coelho void cfg80211_ch_switch_started_notify(struct net_device *dev,
7406f8d7552eSLuciano Coelho 				       struct cfg80211_chan_def *chandef,
7407f8d7552eSLuciano Coelho 				       u8 count);
7408f8d7552eSLuciano Coelho 
74091ce3e82bSJohannes Berg /**
74101ce3e82bSJohannes Berg  * ieee80211_operating_class_to_band - convert operating class to band
74111ce3e82bSJohannes Berg  *
74121ce3e82bSJohannes Berg  * @operating_class: the operating class to convert
74131ce3e82bSJohannes Berg  * @band: band pointer to fill
74141ce3e82bSJohannes Berg  *
74151ce3e82bSJohannes Berg  * Returns %true if the conversion was successful, %false otherwise.
74161ce3e82bSJohannes Berg  */
74171ce3e82bSJohannes Berg bool ieee80211_operating_class_to_band(u8 operating_class,
741857fbcce3SJohannes Berg 				       enum nl80211_band *band);
74191ce3e82bSJohannes Berg 
7420a38700ddSArik Nemtsov /**
7421a38700ddSArik Nemtsov  * ieee80211_chandef_to_operating_class - convert chandef to operation class
7422a38700ddSArik Nemtsov  *
7423a38700ddSArik Nemtsov  * @chandef: the chandef to convert
7424a38700ddSArik Nemtsov  * @op_class: a pointer to the resulting operating class
7425a38700ddSArik Nemtsov  *
7426a38700ddSArik Nemtsov  * Returns %true if the conversion was successful, %false otherwise.
7427a38700ddSArik Nemtsov  */
7428a38700ddSArik Nemtsov bool ieee80211_chandef_to_operating_class(struct cfg80211_chan_def *chandef,
7429a38700ddSArik Nemtsov 					  u8 *op_class);
7430a38700ddSArik Nemtsov 
7431934f4c7dSThomas Pedersen /**
7432934f4c7dSThomas Pedersen  * ieee80211_chandef_to_khz - convert chandef to frequency in KHz
7433934f4c7dSThomas Pedersen  *
7434934f4c7dSThomas Pedersen  * @chandef: the chandef to convert
7435934f4c7dSThomas Pedersen  *
7436934f4c7dSThomas Pedersen  * Returns the center frequency of chandef (1st segment) in KHz.
7437934f4c7dSThomas Pedersen  */
7438934f4c7dSThomas Pedersen static inline u32
7439934f4c7dSThomas Pedersen ieee80211_chandef_to_khz(const struct cfg80211_chan_def *chandef)
7440934f4c7dSThomas Pedersen {
7441934f4c7dSThomas Pedersen 	return MHZ_TO_KHZ(chandef->center_freq1) + chandef->freq1_offset;
7442934f4c7dSThomas Pedersen }
7443934f4c7dSThomas Pedersen 
74445314526bSThomas Pedersen /*
74453475b094SJouni Malinen  * cfg80211_tdls_oper_request - request userspace to perform TDLS operation
74463475b094SJouni Malinen  * @dev: the device on which the operation is requested
74473475b094SJouni Malinen  * @peer: the MAC address of the peer device
74483475b094SJouni Malinen  * @oper: the requested TDLS operation (NL80211_TDLS_SETUP or
74493475b094SJouni Malinen  *	NL80211_TDLS_TEARDOWN)
74503475b094SJouni Malinen  * @reason_code: the reason code for teardown request
74513475b094SJouni Malinen  * @gfp: allocation flags
74523475b094SJouni Malinen  *
74533475b094SJouni Malinen  * This function is used to request userspace to perform TDLS operation that
74543475b094SJouni Malinen  * requires knowledge of keys, i.e., link setup or teardown when the AP
74553475b094SJouni Malinen  * connection uses encryption. This is optional mechanism for the driver to use
74563475b094SJouni Malinen  * if it can automatically determine when a TDLS link could be useful (e.g.,
74573475b094SJouni Malinen  * based on traffic and signal strength for a peer).
74583475b094SJouni Malinen  */
74593475b094SJouni Malinen void cfg80211_tdls_oper_request(struct net_device *dev, const u8 *peer,
74603475b094SJouni Malinen 				enum nl80211_tdls_operation oper,
74613475b094SJouni Malinen 				u16 reason_code, gfp_t gfp);
74623475b094SJouni Malinen 
74633475b094SJouni Malinen /*
74648097e149SThomas Pedersen  * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units)
74658097e149SThomas Pedersen  * @rate: given rate_info to calculate bitrate from
74668097e149SThomas Pedersen  *
74678097e149SThomas Pedersen  * return 0 if MCS index >= 32
74688097e149SThomas Pedersen  */
74698eb41c8dSVladimir Kondratiev u32 cfg80211_calculate_bitrate(struct rate_info *rate);
74708097e149SThomas Pedersen 
747198104fdeSJohannes Berg /**
747298104fdeSJohannes Berg  * cfg80211_unregister_wdev - remove the given wdev
747398104fdeSJohannes Berg  * @wdev: struct wireless_dev to remove
747498104fdeSJohannes Berg  *
747598104fdeSJohannes Berg  * Call this function only for wdevs that have no netdev assigned,
747698104fdeSJohannes Berg  * e.g. P2P Devices. It removes the device from the list so that
747798104fdeSJohannes Berg  * it can no longer be used. It is necessary to call this function
747898104fdeSJohannes Berg  * even when cfg80211 requests the removal of the interface by
747998104fdeSJohannes Berg  * calling the del_virtual_intf() callback. The function must also
748098104fdeSJohannes Berg  * be called when the driver wishes to unregister the wdev, e.g.
748198104fdeSJohannes Berg  * when the device is unbound from the driver.
748298104fdeSJohannes Berg  *
748398104fdeSJohannes Berg  * Requires the RTNL to be held.
748498104fdeSJohannes Berg  */
748598104fdeSJohannes Berg void cfg80211_unregister_wdev(struct wireless_dev *wdev);
748698104fdeSJohannes Berg 
74870ee45355SJohannes Berg /**
7488355199e0SJouni Malinen  * struct cfg80211_ft_event - FT Information Elements
7489355199e0SJouni Malinen  * @ies: FT IEs
7490355199e0SJouni Malinen  * @ies_len: length of the FT IE in bytes
7491355199e0SJouni Malinen  * @target_ap: target AP's MAC address
7492355199e0SJouni Malinen  * @ric_ies: RIC IE
7493355199e0SJouni Malinen  * @ric_ies_len: length of the RIC IE in bytes
7494355199e0SJouni Malinen  */
7495355199e0SJouni Malinen struct cfg80211_ft_event_params {
7496355199e0SJouni Malinen 	const u8 *ies;
7497355199e0SJouni Malinen 	size_t ies_len;
7498355199e0SJouni Malinen 	const u8 *target_ap;
7499355199e0SJouni Malinen 	const u8 *ric_ies;
7500355199e0SJouni Malinen 	size_t ric_ies_len;
7501355199e0SJouni Malinen };
7502355199e0SJouni Malinen 
7503355199e0SJouni Malinen /**
7504355199e0SJouni Malinen  * cfg80211_ft_event - notify userspace about FT IE and RIC IE
7505355199e0SJouni Malinen  * @netdev: network device
7506355199e0SJouni Malinen  * @ft_event: IE information
7507355199e0SJouni Malinen  */
7508355199e0SJouni Malinen void cfg80211_ft_event(struct net_device *netdev,
7509355199e0SJouni Malinen 		       struct cfg80211_ft_event_params *ft_event);
7510355199e0SJouni Malinen 
7511355199e0SJouni Malinen /**
75120ee45355SJohannes Berg  * cfg80211_get_p2p_attr - find and copy a P2P attribute from IE buffer
75130ee45355SJohannes Berg  * @ies: the input IE buffer
75140ee45355SJohannes Berg  * @len: the input length
75150ee45355SJohannes Berg  * @attr: the attribute ID to find
75160ee45355SJohannes Berg  * @buf: output buffer, can be %NULL if the data isn't needed, e.g.
75170ee45355SJohannes Berg  *	if the function is only called to get the needed buffer size
75180ee45355SJohannes Berg  * @bufsize: size of the output buffer
75190ee45355SJohannes Berg  *
75200ee45355SJohannes Berg  * The function finds a given P2P attribute in the (vendor) IEs and
75210ee45355SJohannes Berg  * copies its contents to the given buffer.
75220ee45355SJohannes Berg  *
75230ae997dcSYacine Belkadi  * Return: A negative error code (-%EILSEQ or -%ENOENT) if the data is
75240ae997dcSYacine Belkadi  * malformed or the attribute can't be found (respectively), or the
75250ae997dcSYacine Belkadi  * length of the found attribute (which can be zero).
75260ee45355SJohannes Berg  */
7527c216e641SArend van Spriel int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len,
7528c216e641SArend van Spriel 			  enum ieee80211_p2p_attr_id attr,
7529c216e641SArend van Spriel 			  u8 *buf, unsigned int bufsize);
75300ee45355SJohannes Berg 
7531cd8f7cb4SJohannes Berg /**
753229464cccSJohannes Berg  * ieee80211_ie_split_ric - split an IE buffer according to ordering (with RIC)
753329464cccSJohannes Berg  * @ies: the IE buffer
753429464cccSJohannes Berg  * @ielen: the length of the IE buffer
753529464cccSJohannes Berg  * @ids: an array with element IDs that are allowed before
75362512b1b1SLiad Kaufman  *	the split. A WLAN_EID_EXTENSION value means that the next
75372512b1b1SLiad Kaufman  *	EID in the list is a sub-element of the EXTENSION IE.
753829464cccSJohannes Berg  * @n_ids: the size of the element ID array
753929464cccSJohannes Berg  * @after_ric: array IE types that come after the RIC element
754029464cccSJohannes Berg  * @n_after_ric: size of the @after_ric array
754129464cccSJohannes Berg  * @offset: offset where to start splitting in the buffer
754229464cccSJohannes Berg  *
754329464cccSJohannes Berg  * This function splits an IE buffer by updating the @offset
754429464cccSJohannes Berg  * variable to point to the location where the buffer should be
754529464cccSJohannes Berg  * split.
754629464cccSJohannes Berg  *
754729464cccSJohannes Berg  * It assumes that the given IE buffer is well-formed, this
754829464cccSJohannes Berg  * has to be guaranteed by the caller!
754929464cccSJohannes Berg  *
755029464cccSJohannes Berg  * It also assumes that the IEs in the buffer are ordered
755129464cccSJohannes Berg  * correctly, if not the result of using this function will not
755229464cccSJohannes Berg  * be ordered correctly either, i.e. it does no reordering.
755329464cccSJohannes Berg  *
755429464cccSJohannes Berg  * The function returns the offset where the next part of the
755529464cccSJohannes Berg  * buffer starts, which may be @ielen if the entire (remainder)
755629464cccSJohannes Berg  * of the buffer should be used.
755729464cccSJohannes Berg  */
755829464cccSJohannes Berg size_t ieee80211_ie_split_ric(const u8 *ies, size_t ielen,
755929464cccSJohannes Berg 			      const u8 *ids, int n_ids,
756029464cccSJohannes Berg 			      const u8 *after_ric, int n_after_ric,
756129464cccSJohannes Berg 			      size_t offset);
756229464cccSJohannes Berg 
756329464cccSJohannes Berg /**
756429464cccSJohannes Berg  * ieee80211_ie_split - split an IE buffer according to ordering
756529464cccSJohannes Berg  * @ies: the IE buffer
756629464cccSJohannes Berg  * @ielen: the length of the IE buffer
756729464cccSJohannes Berg  * @ids: an array with element IDs that are allowed before
75682512b1b1SLiad Kaufman  *	the split. A WLAN_EID_EXTENSION value means that the next
75692512b1b1SLiad Kaufman  *	EID in the list is a sub-element of the EXTENSION IE.
757029464cccSJohannes Berg  * @n_ids: the size of the element ID array
757129464cccSJohannes Berg  * @offset: offset where to start splitting in the buffer
757229464cccSJohannes Berg  *
757329464cccSJohannes Berg  * This function splits an IE buffer by updating the @offset
757429464cccSJohannes Berg  * variable to point to the location where the buffer should be
757529464cccSJohannes Berg  * split.
757629464cccSJohannes Berg  *
757729464cccSJohannes Berg  * It assumes that the given IE buffer is well-formed, this
757829464cccSJohannes Berg  * has to be guaranteed by the caller!
757929464cccSJohannes Berg  *
758029464cccSJohannes Berg  * It also assumes that the IEs in the buffer are ordered
758129464cccSJohannes Berg  * correctly, if not the result of using this function will not
758229464cccSJohannes Berg  * be ordered correctly either, i.e. it does no reordering.
758329464cccSJohannes Berg  *
758429464cccSJohannes Berg  * The function returns the offset where the next part of the
758529464cccSJohannes Berg  * buffer starts, which may be @ielen if the entire (remainder)
758629464cccSJohannes Berg  * of the buffer should be used.
758729464cccSJohannes Berg  */
75880483eeacSJohannes Berg static inline size_t ieee80211_ie_split(const u8 *ies, size_t ielen,
75890483eeacSJohannes Berg 					const u8 *ids, int n_ids, size_t offset)
75900483eeacSJohannes Berg {
75910483eeacSJohannes Berg 	return ieee80211_ie_split_ric(ies, ielen, ids, n_ids, NULL, 0, offset);
75920483eeacSJohannes Berg }
759329464cccSJohannes Berg 
759429464cccSJohannes Berg /**
7595cd8f7cb4SJohannes Berg  * cfg80211_report_wowlan_wakeup - report wakeup from WoWLAN
7596cd8f7cb4SJohannes Berg  * @wdev: the wireless device reporting the wakeup
7597cd8f7cb4SJohannes Berg  * @wakeup: the wakeup report
7598cd8f7cb4SJohannes Berg  * @gfp: allocation flags
7599cd8f7cb4SJohannes Berg  *
7600cd8f7cb4SJohannes Berg  * This function reports that the given device woke up. If it
7601cd8f7cb4SJohannes Berg  * caused the wakeup, report the reason(s), otherwise you may
7602cd8f7cb4SJohannes Berg  * pass %NULL as the @wakeup parameter to advertise that something
7603cd8f7cb4SJohannes Berg  * else caused the wakeup.
7604cd8f7cb4SJohannes Berg  */
7605cd8f7cb4SJohannes Berg void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev,
7606cd8f7cb4SJohannes Berg 				   struct cfg80211_wowlan_wakeup *wakeup,
7607cd8f7cb4SJohannes Berg 				   gfp_t gfp);
7608cd8f7cb4SJohannes Berg 
76095de17984SArend van Spriel /**
76105de17984SArend van Spriel  * cfg80211_crit_proto_stopped() - indicate critical protocol stopped by driver.
76115de17984SArend van Spriel  *
76125de17984SArend van Spriel  * @wdev: the wireless device for which critical protocol is stopped.
761303f831a6SRobert P. J. Day  * @gfp: allocation flags
76145de17984SArend van Spriel  *
76155de17984SArend van Spriel  * This function can be called by the driver to indicate it has reverted
76165de17984SArend van Spriel  * operation back to normal. One reason could be that the duration given
76175de17984SArend van Spriel  * by .crit_proto_start() has expired.
76185de17984SArend van Spriel  */
76195de17984SArend van Spriel void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp);
76205de17984SArend van Spriel 
7621bdfbec2dSIlan Peer /**
7622bdfbec2dSIlan Peer  * ieee80211_get_num_supported_channels - get number of channels device has
7623bdfbec2dSIlan Peer  * @wiphy: the wiphy
7624bdfbec2dSIlan Peer  *
7625bdfbec2dSIlan Peer  * Return: the number of channels supported by the device.
7626bdfbec2dSIlan Peer  */
7627bdfbec2dSIlan Peer unsigned int ieee80211_get_num_supported_channels(struct wiphy *wiphy);
7628bdfbec2dSIlan Peer 
7629cb2d956dSLuciano Coelho /**
7630cb2d956dSLuciano Coelho  * cfg80211_check_combinations - check interface combinations
7631cb2d956dSLuciano Coelho  *
7632cb2d956dSLuciano Coelho  * @wiphy: the wiphy
7633e227300cSPurushottam Kushwaha  * @params: the interface combinations parameter
7634cb2d956dSLuciano Coelho  *
7635cb2d956dSLuciano Coelho  * This function can be called by the driver to check whether a
7636cb2d956dSLuciano Coelho  * combination of interfaces and their types are allowed according to
7637cb2d956dSLuciano Coelho  * the interface combinations.
7638cb2d956dSLuciano Coelho  */
7639cb2d956dSLuciano Coelho int cfg80211_check_combinations(struct wiphy *wiphy,
7640e227300cSPurushottam Kushwaha 				struct iface_combination_params *params);
7641cb2d956dSLuciano Coelho 
764265a124ddSMichal Kazior /**
764365a124ddSMichal Kazior  * cfg80211_iter_combinations - iterate over matching combinations
764465a124ddSMichal Kazior  *
764565a124ddSMichal Kazior  * @wiphy: the wiphy
7646e227300cSPurushottam Kushwaha  * @params: the interface combinations parameter
764765a124ddSMichal Kazior  * @iter: function to call for each matching combination
764865a124ddSMichal Kazior  * @data: pointer to pass to iter function
764965a124ddSMichal Kazior  *
765065a124ddSMichal Kazior  * This function can be called by the driver to check what possible
765165a124ddSMichal Kazior  * combinations it fits in at a given moment, e.g. for channel switching
765265a124ddSMichal Kazior  * purposes.
765365a124ddSMichal Kazior  */
765465a124ddSMichal Kazior int cfg80211_iter_combinations(struct wiphy *wiphy,
7655e227300cSPurushottam Kushwaha 			       struct iface_combination_params *params,
765665a124ddSMichal Kazior 			       void (*iter)(const struct ieee80211_iface_combination *c,
765765a124ddSMichal Kazior 					    void *data),
765865a124ddSMichal Kazior 			       void *data);
765965a124ddSMichal Kazior 
7660f04c2203SMichal Kazior /*
7661f04c2203SMichal Kazior  * cfg80211_stop_iface - trigger interface disconnection
7662f04c2203SMichal Kazior  *
7663f04c2203SMichal Kazior  * @wiphy: the wiphy
7664f04c2203SMichal Kazior  * @wdev: wireless device
7665f04c2203SMichal Kazior  * @gfp: context flags
7666f04c2203SMichal Kazior  *
7667f04c2203SMichal Kazior  * Trigger interface to be stopped as if AP was stopped, IBSS/mesh left, STA
7668f04c2203SMichal Kazior  * disconnected.
7669f04c2203SMichal Kazior  *
7670f04c2203SMichal Kazior  * Note: This doesn't need any locks and is asynchronous.
7671f04c2203SMichal Kazior  */
7672f04c2203SMichal Kazior void cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev,
7673f04c2203SMichal Kazior 			 gfp_t gfp);
7674f04c2203SMichal Kazior 
7675f6837ba8SJohannes Berg /**
7676f6837ba8SJohannes Berg  * cfg80211_shutdown_all_interfaces - shut down all interfaces for a wiphy
7677f6837ba8SJohannes Berg  * @wiphy: the wiphy to shut down
7678f6837ba8SJohannes Berg  *
7679f6837ba8SJohannes Berg  * This function shuts down all interfaces belonging to this wiphy by
7680f6837ba8SJohannes Berg  * calling dev_close() (and treating non-netdev interfaces as needed).
7681f6837ba8SJohannes Berg  * It shouldn't really be used unless there are some fatal device errors
7682f6837ba8SJohannes Berg  * that really can't be recovered in any other way.
7683f6837ba8SJohannes Berg  *
7684f6837ba8SJohannes Berg  * Callers must hold the RTNL and be able to deal with callbacks into
7685f6837ba8SJohannes Berg  * the driver while the function is running.
7686f6837ba8SJohannes Berg  */
7687f6837ba8SJohannes Berg void cfg80211_shutdown_all_interfaces(struct wiphy *wiphy);
7688f6837ba8SJohannes Berg 
7689d75bb06bSGautam Kumar Shukla /**
7690d75bb06bSGautam Kumar Shukla  * wiphy_ext_feature_set - set the extended feature flag
7691d75bb06bSGautam Kumar Shukla  *
7692d75bb06bSGautam Kumar Shukla  * @wiphy: the wiphy to modify.
7693d75bb06bSGautam Kumar Shukla  * @ftidx: extended feature bit index.
7694d75bb06bSGautam Kumar Shukla  *
7695d75bb06bSGautam Kumar Shukla  * The extended features are flagged in multiple bytes (see
7696d75bb06bSGautam Kumar Shukla  * &struct wiphy.@ext_features)
7697d75bb06bSGautam Kumar Shukla  */
7698d75bb06bSGautam Kumar Shukla static inline void wiphy_ext_feature_set(struct wiphy *wiphy,
7699d75bb06bSGautam Kumar Shukla 					 enum nl80211_ext_feature_index ftidx)
7700d75bb06bSGautam Kumar Shukla {
7701d75bb06bSGautam Kumar Shukla 	u8 *ft_byte;
7702d75bb06bSGautam Kumar Shukla 
7703d75bb06bSGautam Kumar Shukla 	ft_byte = &wiphy->ext_features[ftidx / 8];
7704d75bb06bSGautam Kumar Shukla 	*ft_byte |= BIT(ftidx % 8);
7705d75bb06bSGautam Kumar Shukla }
7706d75bb06bSGautam Kumar Shukla 
7707d75bb06bSGautam Kumar Shukla /**
7708d75bb06bSGautam Kumar Shukla  * wiphy_ext_feature_isset - check the extended feature flag
7709d75bb06bSGautam Kumar Shukla  *
7710d75bb06bSGautam Kumar Shukla  * @wiphy: the wiphy to modify.
7711d75bb06bSGautam Kumar Shukla  * @ftidx: extended feature bit index.
7712d75bb06bSGautam Kumar Shukla  *
7713d75bb06bSGautam Kumar Shukla  * The extended features are flagged in multiple bytes (see
7714d75bb06bSGautam Kumar Shukla  * &struct wiphy.@ext_features)
7715d75bb06bSGautam Kumar Shukla  */
7716d75bb06bSGautam Kumar Shukla static inline bool
7717d75bb06bSGautam Kumar Shukla wiphy_ext_feature_isset(struct wiphy *wiphy,
7718d75bb06bSGautam Kumar Shukla 			enum nl80211_ext_feature_index ftidx)
7719d75bb06bSGautam Kumar Shukla {
7720d75bb06bSGautam Kumar Shukla 	u8 ft_byte;
7721d75bb06bSGautam Kumar Shukla 
7722d75bb06bSGautam Kumar Shukla 	ft_byte = wiphy->ext_features[ftidx / 8];
7723d75bb06bSGautam Kumar Shukla 	return (ft_byte & BIT(ftidx % 8)) != 0;
7724d75bb06bSGautam Kumar Shukla }
7725b7ffbd7eSJohannes Berg 
7726a442b761SAyala Beker /**
7727a442b761SAyala Beker  * cfg80211_free_nan_func - free NAN function
7728a442b761SAyala Beker  * @f: NAN function that should be freed
7729a442b761SAyala Beker  *
7730a442b761SAyala Beker  * Frees all the NAN function and all it's allocated members.
7731a442b761SAyala Beker  */
7732a442b761SAyala Beker void cfg80211_free_nan_func(struct cfg80211_nan_func *f);
7733a442b761SAyala Beker 
773450bcd31dSAyala Beker /**
773550bcd31dSAyala Beker  * struct cfg80211_nan_match_params - NAN match parameters
773650bcd31dSAyala Beker  * @type: the type of the function that triggered a match. If it is
773750bcd31dSAyala Beker  *	 %NL80211_NAN_FUNC_SUBSCRIBE it means that we replied to a subscriber.
773850bcd31dSAyala Beker  *	 If it is %NL80211_NAN_FUNC_PUBLISH, it means that we got a discovery
773950bcd31dSAyala Beker  *	 result.
774050bcd31dSAyala Beker  *	 If it is %NL80211_NAN_FUNC_FOLLOW_UP, we received a follow up.
774150bcd31dSAyala Beker  * @inst_id: the local instance id
774250bcd31dSAyala Beker  * @peer_inst_id: the instance id of the peer's function
774350bcd31dSAyala Beker  * @addr: the MAC address of the peer
774450bcd31dSAyala Beker  * @info_len: the length of the &info
774550bcd31dSAyala Beker  * @info: the Service Specific Info from the peer (if any)
774650bcd31dSAyala Beker  * @cookie: unique identifier of the corresponding function
774750bcd31dSAyala Beker  */
774850bcd31dSAyala Beker struct cfg80211_nan_match_params {
774950bcd31dSAyala Beker 	enum nl80211_nan_function_type type;
775050bcd31dSAyala Beker 	u8 inst_id;
775150bcd31dSAyala Beker 	u8 peer_inst_id;
775250bcd31dSAyala Beker 	const u8 *addr;
775350bcd31dSAyala Beker 	u8 info_len;
775450bcd31dSAyala Beker 	const u8 *info;
775550bcd31dSAyala Beker 	u64 cookie;
775650bcd31dSAyala Beker };
775750bcd31dSAyala Beker 
775850bcd31dSAyala Beker /**
775950bcd31dSAyala Beker  * cfg80211_nan_match - report a match for a NAN function.
776050bcd31dSAyala Beker  * @wdev: the wireless device reporting the match
776150bcd31dSAyala Beker  * @match: match notification parameters
776250bcd31dSAyala Beker  * @gfp: allocation flags
776350bcd31dSAyala Beker  *
776450bcd31dSAyala Beker  * This function reports that the a NAN function had a match. This
776550bcd31dSAyala Beker  * can be a subscribe that had a match or a solicited publish that
776650bcd31dSAyala Beker  * was sent. It can also be a follow up that was received.
776750bcd31dSAyala Beker  */
776850bcd31dSAyala Beker void cfg80211_nan_match(struct wireless_dev *wdev,
776950bcd31dSAyala Beker 			struct cfg80211_nan_match_params *match, gfp_t gfp);
777050bcd31dSAyala Beker 
7771368e5a7bSAyala Beker /**
7772368e5a7bSAyala Beker  * cfg80211_nan_func_terminated - notify about NAN function termination.
7773368e5a7bSAyala Beker  *
7774368e5a7bSAyala Beker  * @wdev: the wireless device reporting the match
7775368e5a7bSAyala Beker  * @inst_id: the local instance id
7776368e5a7bSAyala Beker  * @reason: termination reason (one of the NL80211_NAN_FUNC_TERM_REASON_*)
7777368e5a7bSAyala Beker  * @cookie: unique NAN function identifier
7778368e5a7bSAyala Beker  * @gfp: allocation flags
7779368e5a7bSAyala Beker  *
7780368e5a7bSAyala Beker  * This function reports that the a NAN function is terminated.
7781368e5a7bSAyala Beker  */
7782368e5a7bSAyala Beker void cfg80211_nan_func_terminated(struct wireless_dev *wdev,
7783368e5a7bSAyala Beker 				  u8 inst_id,
7784368e5a7bSAyala Beker 				  enum nl80211_nan_func_term_reason reason,
7785368e5a7bSAyala Beker 				  u64 cookie, gfp_t gfp);
7786368e5a7bSAyala Beker 
7787b7ffbd7eSJohannes Berg /* ethtool helper */
7788b7ffbd7eSJohannes Berg void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info);
7789b7ffbd7eSJohannes Berg 
779040cbfa90SSrinivas Dasari /**
779140cbfa90SSrinivas Dasari  * cfg80211_external_auth_request - userspace request for authentication
779240cbfa90SSrinivas Dasari  * @netdev: network device
779340cbfa90SSrinivas Dasari  * @params: External authentication parameters
779440cbfa90SSrinivas Dasari  * @gfp: allocation flags
779540cbfa90SSrinivas Dasari  * Returns: 0 on success, < 0 on error
779640cbfa90SSrinivas Dasari  */
779740cbfa90SSrinivas Dasari int cfg80211_external_auth_request(struct net_device *netdev,
779840cbfa90SSrinivas Dasari 				   struct cfg80211_external_auth_params *params,
779940cbfa90SSrinivas Dasari 				   gfp_t gfp);
780040cbfa90SSrinivas Dasari 
78019bb7e0f2SJohannes Berg /**
78029bb7e0f2SJohannes Berg  * cfg80211_pmsr_report - report peer measurement result data
78039bb7e0f2SJohannes Berg  * @wdev: the wireless device reporting the measurement
78049bb7e0f2SJohannes Berg  * @req: the original measurement request
78059bb7e0f2SJohannes Berg  * @result: the result data
78069bb7e0f2SJohannes Berg  * @gfp: allocation flags
78079bb7e0f2SJohannes Berg  */
78089bb7e0f2SJohannes Berg void cfg80211_pmsr_report(struct wireless_dev *wdev,
78099bb7e0f2SJohannes Berg 			  struct cfg80211_pmsr_request *req,
78109bb7e0f2SJohannes Berg 			  struct cfg80211_pmsr_result *result,
78119bb7e0f2SJohannes Berg 			  gfp_t gfp);
78129bb7e0f2SJohannes Berg 
78139bb7e0f2SJohannes Berg /**
78149bb7e0f2SJohannes Berg  * cfg80211_pmsr_complete - report peer measurement completed
78159bb7e0f2SJohannes Berg  * @wdev: the wireless device reporting the measurement
78169bb7e0f2SJohannes Berg  * @req: the original measurement request
78179bb7e0f2SJohannes Berg  * @gfp: allocation flags
78189bb7e0f2SJohannes Berg  *
78199bb7e0f2SJohannes Berg  * Report that the entire measurement completed, after this
78209bb7e0f2SJohannes Berg  * the request pointer will no longer be valid.
78219bb7e0f2SJohannes Berg  */
78229bb7e0f2SJohannes Berg void cfg80211_pmsr_complete(struct wireless_dev *wdev,
78239bb7e0f2SJohannes Berg 			    struct cfg80211_pmsr_request *req,
78249bb7e0f2SJohannes Berg 			    gfp_t gfp);
78259bb7e0f2SJohannes Berg 
7826e6f40511SManikanta Pubbisetty /**
7827e6f40511SManikanta Pubbisetty  * cfg80211_iftype_allowed - check whether the interface can be allowed
7828e6f40511SManikanta Pubbisetty  * @wiphy: the wiphy
7829e6f40511SManikanta Pubbisetty  * @iftype: interface type
7830e6f40511SManikanta Pubbisetty  * @is_4addr: use_4addr flag, must be '0' when check_swif is '1'
7831e6f40511SManikanta Pubbisetty  * @check_swif: check iftype against software interfaces
7832e6f40511SManikanta Pubbisetty  *
7833e6f40511SManikanta Pubbisetty  * Check whether the interface is allowed to operate; additionally, this API
7834e6f40511SManikanta Pubbisetty  * can be used to check iftype against the software interfaces when
7835e6f40511SManikanta Pubbisetty  * check_swif is '1'.
7836e6f40511SManikanta Pubbisetty  */
7837e6f40511SManikanta Pubbisetty bool cfg80211_iftype_allowed(struct wiphy *wiphy, enum nl80211_iftype iftype,
7838e6f40511SManikanta Pubbisetty 			     bool is_4addr, u8 check_swif);
7839e6f40511SManikanta Pubbisetty 
7840e6f40511SManikanta Pubbisetty 
7841e1db74fcSJoe Perches /* Logging, debugging and troubleshooting/diagnostic helpers. */
7842e1db74fcSJoe Perches 
7843e1db74fcSJoe Perches /* wiphy_printk helpers, similar to dev_printk */
7844e1db74fcSJoe Perches 
7845e1db74fcSJoe Perches #define wiphy_printk(level, wiphy, format, args...)		\
78469c376639SJoe Perches 	dev_printk(level, &(wiphy)->dev, format, ##args)
7847e1db74fcSJoe Perches #define wiphy_emerg(wiphy, format, args...)			\
78489c376639SJoe Perches 	dev_emerg(&(wiphy)->dev, format, ##args)
7849e1db74fcSJoe Perches #define wiphy_alert(wiphy, format, args...)			\
78509c376639SJoe Perches 	dev_alert(&(wiphy)->dev, format, ##args)
7851e1db74fcSJoe Perches #define wiphy_crit(wiphy, format, args...)			\
78529c376639SJoe Perches 	dev_crit(&(wiphy)->dev, format, ##args)
7853e1db74fcSJoe Perches #define wiphy_err(wiphy, format, args...)			\
78549c376639SJoe Perches 	dev_err(&(wiphy)->dev, format, ##args)
7855e1db74fcSJoe Perches #define wiphy_warn(wiphy, format, args...)			\
78569c376639SJoe Perches 	dev_warn(&(wiphy)->dev, format, ##args)
7857e1db74fcSJoe Perches #define wiphy_notice(wiphy, format, args...)			\
78589c376639SJoe Perches 	dev_notice(&(wiphy)->dev, format, ##args)
7859e1db74fcSJoe Perches #define wiphy_info(wiphy, format, args...)			\
78609c376639SJoe Perches 	dev_info(&(wiphy)->dev, format, ##args)
7861073730d7SJoe Perches 
7862a58d7525SStanislaw Gruszka #define wiphy_err_ratelimited(wiphy, format, args...)		\
7863a58d7525SStanislaw Gruszka 	dev_err_ratelimited(&(wiphy)->dev, format, ##args)
7864a58d7525SStanislaw Gruszka #define wiphy_warn_ratelimited(wiphy, format, args...)		\
7865a58d7525SStanislaw Gruszka 	dev_warn_ratelimited(&(wiphy)->dev, format, ##args)
7866a58d7525SStanislaw Gruszka 
78679c376639SJoe Perches #define wiphy_debug(wiphy, format, args...)			\
7868e1db74fcSJoe Perches 	wiphy_printk(KERN_DEBUG, wiphy, format, ##args)
78699c376639SJoe Perches 
7870e1db74fcSJoe Perches #define wiphy_dbg(wiphy, format, args...)			\
78719c376639SJoe Perches 	dev_dbg(&(wiphy)->dev, format, ##args)
7872e1db74fcSJoe Perches 
7873e1db74fcSJoe Perches #if defined(VERBOSE_DEBUG)
7874e1db74fcSJoe Perches #define wiphy_vdbg	wiphy_dbg
7875e1db74fcSJoe Perches #else
7876e1db74fcSJoe Perches #define wiphy_vdbg(wiphy, format, args...)				\
7877e1db74fcSJoe Perches ({									\
7878e1db74fcSJoe Perches 	if (0)								\
7879e1db74fcSJoe Perches 		wiphy_printk(KERN_DEBUG, wiphy, format, ##args);	\
7880e1db74fcSJoe Perches 	0;								\
7881e1db74fcSJoe Perches })
7882e1db74fcSJoe Perches #endif
7883e1db74fcSJoe Perches 
7884e1db74fcSJoe Perches /*
7885e1db74fcSJoe Perches  * wiphy_WARN() acts like wiphy_printk(), but with the key difference
7886e1db74fcSJoe Perches  * of using a WARN/WARN_ON to get the message out, including the
7887e1db74fcSJoe Perches  * file/line information and a backtrace.
7888e1db74fcSJoe Perches  */
7889e1db74fcSJoe Perches #define wiphy_WARN(wiphy, format, args...)			\
7890e1db74fcSJoe Perches 	WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args);
7891e1db74fcSJoe Perches 
7892cb74e977SSunil Dutt /**
7893cb74e977SSunil Dutt  * cfg80211_update_owe_info_event - Notify the peer's OWE info to user space
7894cb74e977SSunil Dutt  * @netdev: network device
7895cb74e977SSunil Dutt  * @owe_info: peer's owe info
7896cb74e977SSunil Dutt  * @gfp: allocation flags
7897cb74e977SSunil Dutt  */
7898cb74e977SSunil Dutt void cfg80211_update_owe_info_event(struct net_device *netdev,
7899cb74e977SSunil Dutt 				    struct cfg80211_update_owe_info *owe_info,
7900cb74e977SSunil Dutt 				    gfp_t gfp);
7901cb74e977SSunil Dutt 
7902704232c2SJohannes Berg #endif /* __NET_CFG80211_H */
7903