xref: /linux/include/net/cfg80211.h (revision ea05fd3581d32a0f1098657005c7a9b763798fe8)
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
10dd3e4fc7SAvraham Stern  * Copyright (C) 2018-2021 Intel Corporation
11d3236553SJohannes Berg  */
12704232c2SJohannes Berg 
13cc69837fSJakub Kicinski #include <linux/ethtool.h>
146f779a66SEmmanuel Grumbach #include <uapi/linux/rfkill.h>
15d3236553SJohannes Berg #include <linux/netdevice.h>
16d3236553SJohannes Berg #include <linux/debugfs.h>
17d3236553SJohannes Berg #include <linux/list.h>
18187f1882SPaul Gortmaker #include <linux/bug.h>
19704232c2SJohannes Berg #include <linux/netlink.h>
20704232c2SJohannes Berg #include <linux/skbuff.h>
2155682965SJohannes Berg #include <linux/nl80211.h>
222a519311SJohannes Berg #include <linux/if_ether.h>
232a519311SJohannes Berg #include <linux/ieee80211.h>
242a0e047eSJohannes Berg #include <linux/net.h>
25358ae888SEmmanuel Grumbach #include <linux/rfkill.h>
26d3236553SJohannes Berg #include <net/regulatory.h>
27d3236553SJohannes Berg 
28d70e9693SJohannes Berg /**
29d70e9693SJohannes Berg  * DOC: Introduction
30d70e9693SJohannes Berg  *
31d70e9693SJohannes Berg  * cfg80211 is the configuration API for 802.11 devices in Linux. It bridges
32d70e9693SJohannes Berg  * userspace and drivers, and offers some utility functionality associated
33d70e9693SJohannes Berg  * with 802.11. cfg80211 must, directly or indirectly via mac80211, be used
34d70e9693SJohannes Berg  * by all modern wireless drivers in Linux, so that they offer a consistent
35d70e9693SJohannes Berg  * API through nl80211. For backward compatibility, cfg80211 also offers
36d70e9693SJohannes Berg  * wireless extensions to userspace, but hides them from drivers completely.
37d70e9693SJohannes Berg  *
38d70e9693SJohannes Berg  * Additionally, cfg80211 contains code to help enforce regulatory spectrum
39d70e9693SJohannes Berg  * use restrictions.
40d70e9693SJohannes Berg  */
41d70e9693SJohannes Berg 
42d70e9693SJohannes Berg 
43d70e9693SJohannes Berg /**
44d70e9693SJohannes Berg  * DOC: Device registration
45d70e9693SJohannes Berg  *
46d70e9693SJohannes Berg  * In order for a driver to use cfg80211, it must register the hardware device
47d70e9693SJohannes Berg  * with cfg80211. This happens through a number of hardware capability structs
48d70e9693SJohannes Berg  * described below.
49d70e9693SJohannes Berg  *
50d70e9693SJohannes Berg  * The fundamental structure for each device is the 'wiphy', of which each
51d70e9693SJohannes Berg  * instance describes a physical wireless device connected to the system. Each
52d70e9693SJohannes Berg  * such wiphy can have zero, one, or many virtual interfaces associated with
53d70e9693SJohannes Berg  * it, which need to be identified as such by pointing the network interface's
54d70e9693SJohannes Berg  * @ieee80211_ptr pointer to a &struct wireless_dev which further describes
55d70e9693SJohannes Berg  * the wireless part of the interface, normally this struct is embedded in the
56d70e9693SJohannes Berg  * network interface's private data area. Drivers can optionally allow creating
57d70e9693SJohannes Berg  * or destroying virtual interfaces on the fly, but without at least one or the
58d70e9693SJohannes Berg  * ability to create some the wireless device isn't useful.
59d70e9693SJohannes Berg  *
60d70e9693SJohannes Berg  * Each wiphy structure contains device capability information, and also has
61d70e9693SJohannes Berg  * a pointer to the various operations the driver offers. The definitions and
62d70e9693SJohannes Berg  * structures here describe these capabilities in detail.
63d70e9693SJohannes Berg  */
64d70e9693SJohannes Berg 
659f5e8f6eSJohannes Berg struct wiphy;
669f5e8f6eSJohannes Berg 
67704232c2SJohannes Berg /*
68d3236553SJohannes Berg  * wireless hardware capability structures
69d3236553SJohannes Berg  */
70d3236553SJohannes Berg 
71d3236553SJohannes Berg /**
72d3236553SJohannes Berg  * enum ieee80211_channel_flags - channel flags
73d3236553SJohannes Berg  *
74d3236553SJohannes Berg  * Channel flags set by the regulatory control code.
75d3236553SJohannes Berg  *
76d3236553SJohannes Berg  * @IEEE80211_CHAN_DISABLED: This channel is disabled.
778fe02e16SLuis R. Rodriguez  * @IEEE80211_CHAN_NO_IR: do not initiate radiation, this includes
788fe02e16SLuis R. Rodriguez  *	sending probe requests or beaconing.
79d3236553SJohannes Berg  * @IEEE80211_CHAN_RADAR: Radar detection is required on this channel.
80689da1b3SLuis R. Rodriguez  * @IEEE80211_CHAN_NO_HT40PLUS: extension channel above this channel
81d3236553SJohannes Berg  *	is not permitted.
82689da1b3SLuis R. Rodriguez  * @IEEE80211_CHAN_NO_HT40MINUS: extension channel below this channel
83d3236553SJohannes Berg  *	is not permitted.
8403f6b084SSeth Forshee  * @IEEE80211_CHAN_NO_OFDM: OFDM is not allowed on this channel.
85c7a6ee27SJohannes Berg  * @IEEE80211_CHAN_NO_80MHZ: If the driver supports 80 MHz on the band,
86c7a6ee27SJohannes Berg  *	this flag indicates that an 80 MHz channel cannot use this
87c7a6ee27SJohannes Berg  *	channel as the control or any of the secondary channels.
88c7a6ee27SJohannes Berg  *	This may be due to the driver or due to regulatory bandwidth
89c7a6ee27SJohannes Berg  *	restrictions.
90c7a6ee27SJohannes Berg  * @IEEE80211_CHAN_NO_160MHZ: If the driver supports 160 MHz on the band,
91c7a6ee27SJohannes Berg  *	this flag indicates that an 160 MHz channel cannot use this
92c7a6ee27SJohannes Berg  *	channel as the control or any of the secondary channels.
93c7a6ee27SJohannes Berg  *	This may be due to the driver or due to regulatory bandwidth
94c7a6ee27SJohannes Berg  *	restrictions.
95570dbde1SDavid Spinadel  * @IEEE80211_CHAN_INDOOR_ONLY: see %NL80211_FREQUENCY_ATTR_INDOOR_ONLY
9606f207fcSArik Nemtsov  * @IEEE80211_CHAN_IR_CONCURRENT: see %NL80211_FREQUENCY_ATTR_IR_CONCURRENT
97ea077c1cSRostislav Lisovy  * @IEEE80211_CHAN_NO_20MHZ: 20 MHz bandwidth is not permitted
98ea077c1cSRostislav Lisovy  *	on this channel.
99ea077c1cSRostislav Lisovy  * @IEEE80211_CHAN_NO_10MHZ: 10 MHz bandwidth is not permitted
100ea077c1cSRostislav Lisovy  *	on this channel.
1011e61d82cSHaim Dreyfuss  * @IEEE80211_CHAN_NO_HE: HE operation is not permitted on this channel.
102d65a9770SThomas Pedersen  * @IEEE80211_CHAN_1MHZ: 1 MHz bandwidth is permitted
103d65a9770SThomas Pedersen  *	on this channel.
104d65a9770SThomas Pedersen  * @IEEE80211_CHAN_2MHZ: 2 MHz bandwidth is permitted
105d65a9770SThomas Pedersen  *	on this channel.
106d65a9770SThomas Pedersen  * @IEEE80211_CHAN_4MHZ: 4 MHz bandwidth is permitted
107d65a9770SThomas Pedersen  *	on this channel.
108d65a9770SThomas Pedersen  * @IEEE80211_CHAN_8MHZ: 8 MHz bandwidth is permitted
109d65a9770SThomas Pedersen  *	on this channel.
110d65a9770SThomas Pedersen  * @IEEE80211_CHAN_16MHZ: 16 MHz bandwidth is permitted
111d65a9770SThomas Pedersen  *	on this channel.
1123743bec6SJia Ding  * @IEEE80211_CHAN_NO_320MHZ: If the driver supports 320 MHz on the band,
1133743bec6SJia Ding  *	this flag indicates that a 320 MHz channel cannot use this
1143743bec6SJia Ding  *	channel as the control or any of the secondary channels.
1153743bec6SJia Ding  *	This may be due to the driver or due to regulatory bandwidth
1163743bec6SJia Ding  *	restrictions.
11731846b65SIlan Peer  * @IEEE80211_CHAN_NO_EHT: EHT operation is not permitted on this channel.
118d3236553SJohannes Berg  */
119d3236553SJohannes Berg enum ieee80211_channel_flags {
120d3236553SJohannes Berg 	IEEE80211_CHAN_DISABLED		= 1<<0,
1218fe02e16SLuis R. Rodriguez 	IEEE80211_CHAN_NO_IR		= 1<<1,
1228fe02e16SLuis R. Rodriguez 	/* hole at 1<<2 */
123d3236553SJohannes Berg 	IEEE80211_CHAN_RADAR		= 1<<3,
124689da1b3SLuis R. Rodriguez 	IEEE80211_CHAN_NO_HT40PLUS	= 1<<4,
125689da1b3SLuis R. Rodriguez 	IEEE80211_CHAN_NO_HT40MINUS	= 1<<5,
12603f6b084SSeth Forshee 	IEEE80211_CHAN_NO_OFDM		= 1<<6,
127c7a6ee27SJohannes Berg 	IEEE80211_CHAN_NO_80MHZ		= 1<<7,
128c7a6ee27SJohannes Berg 	IEEE80211_CHAN_NO_160MHZ	= 1<<8,
129570dbde1SDavid Spinadel 	IEEE80211_CHAN_INDOOR_ONLY	= 1<<9,
13006f207fcSArik Nemtsov 	IEEE80211_CHAN_IR_CONCURRENT	= 1<<10,
131ea077c1cSRostislav Lisovy 	IEEE80211_CHAN_NO_20MHZ		= 1<<11,
132ea077c1cSRostislav Lisovy 	IEEE80211_CHAN_NO_10MHZ		= 1<<12,
1331e61d82cSHaim Dreyfuss 	IEEE80211_CHAN_NO_HE		= 1<<13,
134d65a9770SThomas Pedersen 	IEEE80211_CHAN_1MHZ		= 1<<14,
135d65a9770SThomas Pedersen 	IEEE80211_CHAN_2MHZ		= 1<<15,
136d65a9770SThomas Pedersen 	IEEE80211_CHAN_4MHZ		= 1<<16,
137d65a9770SThomas Pedersen 	IEEE80211_CHAN_8MHZ		= 1<<17,
138d65a9770SThomas Pedersen 	IEEE80211_CHAN_16MHZ		= 1<<18,
1393743bec6SJia Ding 	IEEE80211_CHAN_NO_320MHZ	= 1<<19,
14031846b65SIlan Peer 	IEEE80211_CHAN_NO_EHT		= 1<<20,
141d3236553SJohannes Berg };
142d3236553SJohannes Berg 
143038659e7SLuis R. Rodriguez #define IEEE80211_CHAN_NO_HT40 \
144689da1b3SLuis R. Rodriguez 	(IEEE80211_CHAN_NO_HT40PLUS | IEEE80211_CHAN_NO_HT40MINUS)
145038659e7SLuis R. Rodriguez 
14604f39047SSimon Wunderlich #define IEEE80211_DFS_MIN_CAC_TIME_MS		60000
14704f39047SSimon Wunderlich #define IEEE80211_DFS_MIN_NOP_TIME_MS		(30 * 60 * 1000)
14804f39047SSimon Wunderlich 
149d3236553SJohannes Berg /**
150d3236553SJohannes Berg  * struct ieee80211_channel - channel definition
151d3236553SJohannes Berg  *
152d3236553SJohannes Berg  * This structure describes a single channel for use
153d3236553SJohannes Berg  * with cfg80211.
154d3236553SJohannes Berg  *
155d3236553SJohannes Berg  * @center_freq: center frequency in MHz
156934f4c7dSThomas Pedersen  * @freq_offset: offset from @center_freq, in KHz
157d3236553SJohannes Berg  * @hw_value: hardware-specific value for the channel
158d3236553SJohannes Berg  * @flags: channel flags from &enum ieee80211_channel_flags.
159d3236553SJohannes Berg  * @orig_flags: channel flags at registration time, used by regulatory
160d3236553SJohannes Berg  *	code to support devices with additional restrictions
161d3236553SJohannes Berg  * @band: band this channel belongs to.
162d3236553SJohannes Berg  * @max_antenna_gain: maximum antenna gain in dBi
163d3236553SJohannes Berg  * @max_power: maximum transmission power (in dBm)
164eccc068eSHong Wu  * @max_reg_power: maximum regulatory transmission power (in dBm)
165d3236553SJohannes Berg  * @beacon_found: helper to regulatory code to indicate when a beacon
166d3236553SJohannes Berg  *	has been found on this channel. Use regulatory_hint_found_beacon()
16777c2061dSWalter Goldens  *	to enable this, this is useful only on 5 GHz band.
168d3236553SJohannes Berg  * @orig_mag: internal use
169d3236553SJohannes Berg  * @orig_mpwr: internal use
17004f39047SSimon Wunderlich  * @dfs_state: current state of this channel. Only relevant if radar is required
17104f39047SSimon Wunderlich  *	on this channel.
17204f39047SSimon Wunderlich  * @dfs_state_entered: timestamp (jiffies) when the dfs state was entered.
173089027e5SJanusz Dziedzic  * @dfs_cac_ms: DFS CAC time in milliseconds, this is valid for DFS channels.
174d3236553SJohannes Berg  */
175d3236553SJohannes Berg struct ieee80211_channel {
17657fbcce3SJohannes Berg 	enum nl80211_band band;
1779cf0a0b4SAlexei Avshalom Lazar 	u32 center_freq;
178934f4c7dSThomas Pedersen 	u16 freq_offset;
179d3236553SJohannes Berg 	u16 hw_value;
180d3236553SJohannes Berg 	u32 flags;
181d3236553SJohannes Berg 	int max_antenna_gain;
182d3236553SJohannes Berg 	int max_power;
183eccc068eSHong Wu 	int max_reg_power;
184d3236553SJohannes Berg 	bool beacon_found;
185d3236553SJohannes Berg 	u32 orig_flags;
186d3236553SJohannes Berg 	int orig_mag, orig_mpwr;
18704f39047SSimon Wunderlich 	enum nl80211_dfs_state dfs_state;
18804f39047SSimon Wunderlich 	unsigned long dfs_state_entered;
189089027e5SJanusz Dziedzic 	unsigned int dfs_cac_ms;
190d3236553SJohannes Berg };
191d3236553SJohannes Berg 
192d3236553SJohannes Berg /**
193d3236553SJohannes Berg  * enum ieee80211_rate_flags - rate flags
194d3236553SJohannes Berg  *
195d3236553SJohannes Berg  * Hardware/specification flags for rates. These are structured
196d3236553SJohannes Berg  * in a way that allows using the same bitrate structure for
197d3236553SJohannes Berg  * different bands/PHY modes.
198d3236553SJohannes Berg  *
199d3236553SJohannes Berg  * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short
200d3236553SJohannes Berg  *	preamble on this bitrate; only relevant in 2.4GHz band and
201d3236553SJohannes Berg  *	with CCK rates.
202d3236553SJohannes Berg  * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate
203d3236553SJohannes Berg  *	when used with 802.11a (on the 5 GHz band); filled by the
204d3236553SJohannes Berg  *	core code when registering the wiphy.
205d3236553SJohannes Berg  * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate
206d3236553SJohannes Berg  *	when used with 802.11b (on the 2.4 GHz band); filled by the
207d3236553SJohannes Berg  *	core code when registering the wiphy.
208d3236553SJohannes Berg  * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate
209d3236553SJohannes Berg  *	when used with 802.11g (on the 2.4 GHz band); filled by the
210d3236553SJohannes Berg  *	core code when registering the wiphy.
211d3236553SJohannes Berg  * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode.
21230e74732SSimon Wunderlich  * @IEEE80211_RATE_SUPPORTS_5MHZ: Rate can be used in 5 MHz mode
21330e74732SSimon Wunderlich  * @IEEE80211_RATE_SUPPORTS_10MHZ: Rate can be used in 10 MHz mode
214d3236553SJohannes Berg  */
215d3236553SJohannes Berg enum ieee80211_rate_flags {
216d3236553SJohannes Berg 	IEEE80211_RATE_SHORT_PREAMBLE	= 1<<0,
217d3236553SJohannes Berg 	IEEE80211_RATE_MANDATORY_A	= 1<<1,
218d3236553SJohannes Berg 	IEEE80211_RATE_MANDATORY_B	= 1<<2,
219d3236553SJohannes Berg 	IEEE80211_RATE_MANDATORY_G	= 1<<3,
220d3236553SJohannes Berg 	IEEE80211_RATE_ERP_G		= 1<<4,
22130e74732SSimon Wunderlich 	IEEE80211_RATE_SUPPORTS_5MHZ	= 1<<5,
22230e74732SSimon Wunderlich 	IEEE80211_RATE_SUPPORTS_10MHZ	= 1<<6,
223d3236553SJohannes Berg };
224d3236553SJohannes Berg 
225d3236553SJohannes Berg /**
2266eb18137SDedy Lansky  * enum ieee80211_bss_type - BSS type filter
2276eb18137SDedy Lansky  *
2286eb18137SDedy Lansky  * @IEEE80211_BSS_TYPE_ESS: Infrastructure BSS
2296eb18137SDedy Lansky  * @IEEE80211_BSS_TYPE_PBSS: Personal BSS
2306eb18137SDedy Lansky  * @IEEE80211_BSS_TYPE_IBSS: Independent BSS
2316eb18137SDedy Lansky  * @IEEE80211_BSS_TYPE_MBSS: Mesh BSS
2326eb18137SDedy Lansky  * @IEEE80211_BSS_TYPE_ANY: Wildcard value for matching any BSS type
2336eb18137SDedy Lansky  */
2346eb18137SDedy Lansky enum ieee80211_bss_type {
2356eb18137SDedy Lansky 	IEEE80211_BSS_TYPE_ESS,
2366eb18137SDedy Lansky 	IEEE80211_BSS_TYPE_PBSS,
2376eb18137SDedy Lansky 	IEEE80211_BSS_TYPE_IBSS,
2386eb18137SDedy Lansky 	IEEE80211_BSS_TYPE_MBSS,
2396eb18137SDedy Lansky 	IEEE80211_BSS_TYPE_ANY
2406eb18137SDedy Lansky };
2416eb18137SDedy Lansky 
2426eb18137SDedy Lansky /**
2436eb18137SDedy Lansky  * enum ieee80211_privacy - BSS privacy filter
2446eb18137SDedy Lansky  *
2456eb18137SDedy Lansky  * @IEEE80211_PRIVACY_ON: privacy bit set
2466eb18137SDedy Lansky  * @IEEE80211_PRIVACY_OFF: privacy bit clear
2476eb18137SDedy Lansky  * @IEEE80211_PRIVACY_ANY: Wildcard value for matching any privacy setting
2486eb18137SDedy Lansky  */
2496eb18137SDedy Lansky enum ieee80211_privacy {
2506eb18137SDedy Lansky 	IEEE80211_PRIVACY_ON,
2516eb18137SDedy Lansky 	IEEE80211_PRIVACY_OFF,
2526eb18137SDedy Lansky 	IEEE80211_PRIVACY_ANY
2536eb18137SDedy Lansky };
2546eb18137SDedy Lansky 
2556eb18137SDedy Lansky #define IEEE80211_PRIVACY(x)	\
2566eb18137SDedy Lansky 	((x) ? IEEE80211_PRIVACY_ON : IEEE80211_PRIVACY_OFF)
2576eb18137SDedy Lansky 
2586eb18137SDedy Lansky /**
259d3236553SJohannes Berg  * struct ieee80211_rate - bitrate definition
260d3236553SJohannes Berg  *
261d3236553SJohannes Berg  * This structure describes a bitrate that an 802.11 PHY can
262d3236553SJohannes Berg  * operate with. The two values @hw_value and @hw_value_short
263d3236553SJohannes Berg  * are only for driver use when pointers to this structure are
264d3236553SJohannes Berg  * passed around.
265d3236553SJohannes Berg  *
266d3236553SJohannes Berg  * @flags: rate-specific flags
267d3236553SJohannes Berg  * @bitrate: bitrate in units of 100 Kbps
268d3236553SJohannes Berg  * @hw_value: driver/hardware value for this rate
269d3236553SJohannes Berg  * @hw_value_short: driver/hardware value for this rate when
270d3236553SJohannes Berg  *	short preamble is used
271d3236553SJohannes Berg  */
272d3236553SJohannes Berg struct ieee80211_rate {
273d3236553SJohannes Berg 	u32 flags;
274d3236553SJohannes Berg 	u16 bitrate;
275d3236553SJohannes Berg 	u16 hw_value, hw_value_short;
276d3236553SJohannes Berg };
277d3236553SJohannes Berg 
278d3236553SJohannes Berg /**
279796e90f4SJohn Crispin  * struct ieee80211_he_obss_pd - AP settings for spatial reuse
280796e90f4SJohn Crispin  *
281796e90f4SJohn Crispin  * @enable: is the feature enabled.
282f5bec330SRajkumar Manoharan  * @sr_ctrl: The SR Control field of SRP element.
283f5bec330SRajkumar Manoharan  * @non_srg_max_offset: non-SRG maximum tx power offset
284796e90f4SJohn Crispin  * @min_offset: minimal tx power offset an associated station shall use
285796e90f4SJohn Crispin  * @max_offset: maximum tx power offset an associated station shall use
286f5bec330SRajkumar Manoharan  * @bss_color_bitmap: bitmap that indicates the BSS color values used by
287f5bec330SRajkumar Manoharan  *	members of the SRG
288f5bec330SRajkumar Manoharan  * @partial_bssid_bitmap: bitmap that indicates the partial BSSID values
289f5bec330SRajkumar Manoharan  *	used by members of the SRG
290796e90f4SJohn Crispin  */
291796e90f4SJohn Crispin struct ieee80211_he_obss_pd {
292796e90f4SJohn Crispin 	bool enable;
293f5bec330SRajkumar Manoharan 	u8 sr_ctrl;
294f5bec330SRajkumar Manoharan 	u8 non_srg_max_offset;
295796e90f4SJohn Crispin 	u8 min_offset;
296796e90f4SJohn Crispin 	u8 max_offset;
297f5bec330SRajkumar Manoharan 	u8 bss_color_bitmap[8];
298f5bec330SRajkumar Manoharan 	u8 partial_bssid_bitmap[8];
299796e90f4SJohn Crispin };
300796e90f4SJohn Crispin 
301796e90f4SJohn Crispin /**
3025c5e52d1SJohn Crispin  * struct cfg80211_he_bss_color - AP settings for BSS coloring
3035c5e52d1SJohn Crispin  *
3045c5e52d1SJohn Crispin  * @color: the current color.
30575e6b594SJohannes Berg  * @enabled: HE BSS color is used
3065c5e52d1SJohn Crispin  * @partial: define the AID equation.
3075c5e52d1SJohn Crispin  */
3085c5e52d1SJohn Crispin struct cfg80211_he_bss_color {
3095c5e52d1SJohn Crispin 	u8 color;
31075e6b594SJohannes Berg 	bool enabled;
3115c5e52d1SJohn Crispin 	bool partial;
3125c5e52d1SJohn Crispin };
3135c5e52d1SJohn Crispin 
3145c5e52d1SJohn Crispin /**
315d3236553SJohannes Berg  * struct ieee80211_sta_ht_cap - STA's HT capabilities
316d3236553SJohannes Berg  *
317d3236553SJohannes Berg  * This structure describes most essential parameters needed
318d3236553SJohannes Berg  * to describe 802.11n HT capabilities for an STA.
319d3236553SJohannes Berg  *
320d3236553SJohannes Berg  * @ht_supported: is HT supported by the STA
321d3236553SJohannes Berg  * @cap: HT capabilities map as described in 802.11n spec
322d3236553SJohannes Berg  * @ampdu_factor: Maximum A-MPDU length factor
323d3236553SJohannes Berg  * @ampdu_density: Minimum A-MPDU spacing
324d3236553SJohannes Berg  * @mcs: Supported MCS rates
325d3236553SJohannes Berg  */
326d3236553SJohannes Berg struct ieee80211_sta_ht_cap {
327d3236553SJohannes Berg 	u16 cap; /* use IEEE80211_HT_CAP_ */
328d3236553SJohannes Berg 	bool ht_supported;
329d3236553SJohannes Berg 	u8 ampdu_factor;
330d3236553SJohannes Berg 	u8 ampdu_density;
331d3236553SJohannes Berg 	struct ieee80211_mcs_info mcs;
332d3236553SJohannes Berg };
333d3236553SJohannes Berg 
334d3236553SJohannes Berg /**
335bf0c111eSMahesh Palivela  * struct ieee80211_sta_vht_cap - STA's VHT capabilities
336bf0c111eSMahesh Palivela  *
337bf0c111eSMahesh Palivela  * This structure describes most essential parameters needed
338bf0c111eSMahesh Palivela  * to describe 802.11ac VHT capabilities for an STA.
339bf0c111eSMahesh Palivela  *
340bf0c111eSMahesh Palivela  * @vht_supported: is VHT supported by the STA
341bf0c111eSMahesh Palivela  * @cap: VHT capabilities map as described in 802.11ac spec
342bf0c111eSMahesh Palivela  * @vht_mcs: Supported VHT MCS rates
343bf0c111eSMahesh Palivela  */
344bf0c111eSMahesh Palivela struct ieee80211_sta_vht_cap {
345bf0c111eSMahesh Palivela 	bool vht_supported;
346bf0c111eSMahesh Palivela 	u32 cap; /* use IEEE80211_VHT_CAP_ */
347bf0c111eSMahesh Palivela 	struct ieee80211_vht_mcs_info vht_mcs;
348bf0c111eSMahesh Palivela };
349bf0c111eSMahesh Palivela 
350c4cbaf79SLuca Coelho #define IEEE80211_HE_PPE_THRES_MAX_LEN		25
351c4cbaf79SLuca Coelho 
352c4cbaf79SLuca Coelho /**
353c4cbaf79SLuca Coelho  * struct ieee80211_sta_he_cap - STA's HE capabilities
354c4cbaf79SLuca Coelho  *
355c4cbaf79SLuca Coelho  * This structure describes most essential parameters needed
356c4cbaf79SLuca Coelho  * to describe 802.11ax HE capabilities for a STA.
357c4cbaf79SLuca Coelho  *
358c4cbaf79SLuca Coelho  * @has_he: true iff HE data is valid.
359c4cbaf79SLuca Coelho  * @he_cap_elem: Fixed portion of the HE capabilities element.
360c4cbaf79SLuca Coelho  * @he_mcs_nss_supp: The supported NSS/MCS combinations.
361c4cbaf79SLuca Coelho  * @ppe_thres: Holds the PPE Thresholds data.
362c4cbaf79SLuca Coelho  */
363c4cbaf79SLuca Coelho struct ieee80211_sta_he_cap {
364c4cbaf79SLuca Coelho 	bool has_he;
365c4cbaf79SLuca Coelho 	struct ieee80211_he_cap_elem he_cap_elem;
366c4cbaf79SLuca Coelho 	struct ieee80211_he_mcs_nss_supp he_mcs_nss_supp;
367c4cbaf79SLuca Coelho 	u8 ppe_thres[IEEE80211_HE_PPE_THRES_MAX_LEN];
368c4cbaf79SLuca Coelho };
369c4cbaf79SLuca Coelho 
370c4cbaf79SLuca Coelho /**
3715cd5a8a3SIlan Peer  * struct ieee80211_eht_mcs_nss_supp - EHT max supported NSS per MCS
3725cd5a8a3SIlan Peer  *
3735cd5a8a3SIlan Peer  * See P802.11be_D1.3 Table 9-401k - "Subfields of the Supported EHT-MCS
3745cd5a8a3SIlan Peer  * and NSS Set field"
3755cd5a8a3SIlan Peer  *
3765cd5a8a3SIlan Peer  * @only_20mhz: MCS/NSS support for 20 MHz-only STA.
3775cd5a8a3SIlan Peer  * @bw._80: MCS/NSS support for BW <= 80 MHz
3785cd5a8a3SIlan Peer  * @bw._160: MCS/NSS support for BW = 160 MHz
3795cd5a8a3SIlan Peer  * @bw._320: MCS/NSS support for BW = 320 MHz
3805cd5a8a3SIlan Peer  */
3815cd5a8a3SIlan Peer struct ieee80211_eht_mcs_nss_supp {
3825cd5a8a3SIlan Peer 	union {
3835cd5a8a3SIlan Peer 		struct ieee80211_eht_mcs_nss_supp_20mhz_only only_20mhz;
3845cd5a8a3SIlan Peer 		struct {
3855cd5a8a3SIlan Peer 			struct ieee80211_eht_mcs_nss_supp_bw _80;
3865cd5a8a3SIlan Peer 			struct ieee80211_eht_mcs_nss_supp_bw _160;
3875cd5a8a3SIlan Peer 			struct ieee80211_eht_mcs_nss_supp_bw _320;
3885cd5a8a3SIlan Peer 		} __packed bw;
3895cd5a8a3SIlan Peer 	} __packed;
3905cd5a8a3SIlan Peer } __packed;
3915cd5a8a3SIlan Peer 
3925cd5a8a3SIlan Peer #define IEEE80211_EHT_PPE_THRES_MAX_LEN		32
3935cd5a8a3SIlan Peer 
3945cd5a8a3SIlan Peer /**
3955cd5a8a3SIlan Peer  * struct ieee80211_sta_eht_cap - STA's EHT capabilities
3965cd5a8a3SIlan Peer  *
3975cd5a8a3SIlan Peer  * This structure describes most essential parameters needed
3985cd5a8a3SIlan Peer  * to describe 802.11be EHT capabilities for a STA.
3995cd5a8a3SIlan Peer  *
4005cd5a8a3SIlan Peer  * @has_eht: true iff EHT data is valid.
4015cd5a8a3SIlan Peer  * @eht_cap_elem: Fixed portion of the eht capabilities element.
4025cd5a8a3SIlan Peer  * @eht_mcs_nss_supp: The supported NSS/MCS combinations.
4035cd5a8a3SIlan Peer  * @eht_ppe_thres: Holds the PPE Thresholds data.
4045cd5a8a3SIlan Peer  */
4055cd5a8a3SIlan Peer struct ieee80211_sta_eht_cap {
4065cd5a8a3SIlan Peer 	bool has_eht;
4075cd5a8a3SIlan Peer 	struct ieee80211_eht_cap_elem_fixed eht_cap_elem;
4085cd5a8a3SIlan Peer 	struct ieee80211_eht_mcs_nss_supp eht_mcs_nss_supp;
4095cd5a8a3SIlan Peer 	u8 eht_ppe_thres[IEEE80211_EHT_PPE_THRES_MAX_LEN];
4105cd5a8a3SIlan Peer };
4115cd5a8a3SIlan Peer 
4125cd5a8a3SIlan Peer /**
4135d9c358dSRandy Dunlap  * struct ieee80211_sband_iftype_data - sband data per interface type
414c4cbaf79SLuca Coelho  *
415c4cbaf79SLuca Coelho  * This structure encapsulates sband data that is relevant for the
416c4cbaf79SLuca Coelho  * interface types defined in @types_mask.  Each type in the
417c4cbaf79SLuca Coelho  * @types_mask must be unique across all instances of iftype_data.
418c4cbaf79SLuca Coelho  *
419c4cbaf79SLuca Coelho  * @types_mask: interface types mask
420c4cbaf79SLuca Coelho  * @he_cap: holds the HE capabilities
42122395217SJohannes Berg  * @he_6ghz_capa: HE 6 GHz capabilities, must be filled in for a
42222395217SJohannes Berg  *	6 GHz band channel (and 0 may be valid value).
423f4f86505SJohannes Berg  * @vendor_elems: vendor element(s) to advertise
424f4f86505SJohannes Berg  * @vendor_elems.data: vendor element(s) data
425f4f86505SJohannes Berg  * @vendor_elems.len: vendor element(s) length
426c4cbaf79SLuca Coelho  */
427c4cbaf79SLuca Coelho struct ieee80211_sband_iftype_data {
428c4cbaf79SLuca Coelho 	u16 types_mask;
429c4cbaf79SLuca Coelho 	struct ieee80211_sta_he_cap he_cap;
43022395217SJohannes Berg 	struct ieee80211_he_6ghz_capa he_6ghz_capa;
4315cd5a8a3SIlan Peer 	struct ieee80211_sta_eht_cap eht_cap;
432f4f86505SJohannes Berg 	struct {
433f4f86505SJohannes Berg 		const u8 *data;
434f4f86505SJohannes Berg 		unsigned int len;
435f4f86505SJohannes Berg 	} vendor_elems;
436c4cbaf79SLuca Coelho };
437c4cbaf79SLuca Coelho 
438bf0c111eSMahesh Palivela /**
4392a38075cSAlexei Avshalom Lazar  * enum ieee80211_edmg_bw_config - allowed channel bandwidth configurations
4402a38075cSAlexei Avshalom Lazar  *
4412a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_4: 2.16GHz
4422a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_5: 2.16GHz and 4.32GHz
4432a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_6: 2.16GHz, 4.32GHz and 6.48GHz
4442a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_7: 2.16GHz, 4.32GHz, 6.48GHz and 8.64GHz
4452a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_8: 2.16GHz and 2.16GHz + 2.16GHz
4462a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_9: 2.16GHz, 4.32GHz and 2.16GHz + 2.16GHz
4472a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_10: 2.16GHz, 4.32GHz, 6.48GHz and 2.16GHz+2.16GHz
4482a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_11: 2.16GHz, 4.32GHz, 6.48GHz, 8.64GHz and
4492a38075cSAlexei Avshalom Lazar  *	2.16GHz+2.16GHz
4502a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_12: 2.16GHz, 2.16GHz + 2.16GHz and
4512a38075cSAlexei Avshalom Lazar  *	4.32GHz + 4.32GHz
4522a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_13: 2.16GHz, 4.32GHz, 2.16GHz + 2.16GHz and
4532a38075cSAlexei Avshalom Lazar  *	4.32GHz + 4.32GHz
4542a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_14: 2.16GHz, 4.32GHz, 6.48GHz, 2.16GHz + 2.16GHz
4552a38075cSAlexei Avshalom Lazar  *	and 4.32GHz + 4.32GHz
4562a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_15: 2.16GHz, 4.32GHz, 6.48GHz, 8.64GHz,
4572a38075cSAlexei Avshalom Lazar  *	2.16GHz + 2.16GHz and 4.32GHz + 4.32GHz
4582a38075cSAlexei Avshalom Lazar  */
4592a38075cSAlexei Avshalom Lazar enum ieee80211_edmg_bw_config {
4602a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_4	= 4,
4612a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_5	= 5,
4622a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_6	= 6,
4632a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_7	= 7,
4642a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_8	= 8,
4652a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_9	= 9,
4662a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_10	= 10,
4672a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_11	= 11,
4682a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_12	= 12,
4692a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_13	= 13,
4702a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_14	= 14,
4712a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_15	= 15,
4722a38075cSAlexei Avshalom Lazar };
4732a38075cSAlexei Avshalom Lazar 
4742a38075cSAlexei Avshalom Lazar /**
4752a38075cSAlexei Avshalom Lazar  * struct ieee80211_edmg - EDMG configuration
4762a38075cSAlexei Avshalom Lazar  *
4772a38075cSAlexei Avshalom Lazar  * This structure describes most essential parameters needed
4782a38075cSAlexei Avshalom Lazar  * to describe 802.11ay EDMG configuration
4792a38075cSAlexei Avshalom Lazar  *
4802a38075cSAlexei Avshalom Lazar  * @channels: bitmap that indicates the 2.16 GHz channel(s)
4812a38075cSAlexei Avshalom Lazar  *	that are allowed to be used for transmissions.
4822a38075cSAlexei Avshalom Lazar  *	Bit 0 indicates channel 1, bit 1 indicates channel 2, etc.
4832a38075cSAlexei Avshalom Lazar  *	Set to 0 indicate EDMG not supported.
4842a38075cSAlexei Avshalom Lazar  * @bw_config: Channel BW Configuration subfield encodes
4852a38075cSAlexei Avshalom Lazar  *	the allowed channel bandwidth configurations
4862a38075cSAlexei Avshalom Lazar  */
4872a38075cSAlexei Avshalom Lazar struct ieee80211_edmg {
4882a38075cSAlexei Avshalom Lazar 	u8 channels;
4892a38075cSAlexei Avshalom Lazar 	enum ieee80211_edmg_bw_config bw_config;
4902a38075cSAlexei Avshalom Lazar };
4912a38075cSAlexei Avshalom Lazar 
4922a38075cSAlexei Avshalom Lazar /**
493df78a0c0SThomas Pedersen  * struct ieee80211_sta_s1g_cap - STA's S1G capabilities
494df78a0c0SThomas Pedersen  *
495df78a0c0SThomas Pedersen  * This structure describes most essential parameters needed
496df78a0c0SThomas Pedersen  * to describe 802.11ah S1G capabilities for a STA.
497df78a0c0SThomas Pedersen  *
498df78a0c0SThomas Pedersen  * @s1g_supported: is STA an S1G STA
499df78a0c0SThomas Pedersen  * @cap: S1G capabilities information
500df78a0c0SThomas Pedersen  * @nss_mcs: Supported NSS MCS set
501df78a0c0SThomas Pedersen  */
502df78a0c0SThomas Pedersen struct ieee80211_sta_s1g_cap {
503df78a0c0SThomas Pedersen 	bool s1g;
504df78a0c0SThomas Pedersen 	u8 cap[10]; /* use S1G_CAPAB_ */
505df78a0c0SThomas Pedersen 	u8 nss_mcs[5];
506df78a0c0SThomas Pedersen };
507df78a0c0SThomas Pedersen 
508df78a0c0SThomas Pedersen /**
509d3236553SJohannes Berg  * struct ieee80211_supported_band - frequency band definition
510d3236553SJohannes Berg  *
511d3236553SJohannes Berg  * This structure describes a frequency band a wiphy
512d3236553SJohannes Berg  * is able to operate in.
513d3236553SJohannes Berg  *
514085a6c10SRandy Dunlap  * @channels: Array of channels the hardware can operate with
515d3236553SJohannes Berg  *	in this band.
516d3236553SJohannes Berg  * @band: the band this structure represents
517d3236553SJohannes Berg  * @n_channels: Number of channels in @channels
518d3236553SJohannes Berg  * @bitrates: Array of bitrates the hardware can operate with
519d3236553SJohannes Berg  *	in this band. Must be sorted to give a valid "supported
520d3236553SJohannes Berg  *	rates" IE, i.e. CCK rates first, then OFDM.
521d3236553SJohannes Berg  * @n_bitrates: Number of bitrates in @bitrates
522abe37c4bSJohannes Berg  * @ht_cap: HT capabilities in this band
523c9a0a302SRobert P. J. Day  * @vht_cap: VHT capabilities in this band
5248a50c057SMauro Carvalho Chehab  * @s1g_cap: S1G capabilities in this band
5252a38075cSAlexei Avshalom Lazar  * @edmg_cap: EDMG capabilities in this band
5269ff167e1SJohannes Berg  * @s1g_cap: S1G capabilities in this band (S1B band only, of course)
527c4cbaf79SLuca Coelho  * @n_iftype_data: number of iftype data entries
528c4cbaf79SLuca Coelho  * @iftype_data: interface type data entries.  Note that the bits in
529c4cbaf79SLuca Coelho  *	@types_mask inside this structure cannot overlap (i.e. only
530c4cbaf79SLuca Coelho  *	one occurrence of each type is allowed across all instances of
531c4cbaf79SLuca Coelho  *	iftype_data).
532d3236553SJohannes Berg  */
533d3236553SJohannes Berg struct ieee80211_supported_band {
534d3236553SJohannes Berg 	struct ieee80211_channel *channels;
535d3236553SJohannes Berg 	struct ieee80211_rate *bitrates;
53657fbcce3SJohannes Berg 	enum nl80211_band band;
537d3236553SJohannes Berg 	int n_channels;
538d3236553SJohannes Berg 	int n_bitrates;
539d3236553SJohannes Berg 	struct ieee80211_sta_ht_cap ht_cap;
540bf0c111eSMahesh Palivela 	struct ieee80211_sta_vht_cap vht_cap;
541df78a0c0SThomas Pedersen 	struct ieee80211_sta_s1g_cap s1g_cap;
5422a38075cSAlexei Avshalom Lazar 	struct ieee80211_edmg edmg_cap;
543c4cbaf79SLuca Coelho 	u16 n_iftype_data;
544c4cbaf79SLuca Coelho 	const struct ieee80211_sband_iftype_data *iftype_data;
545d3236553SJohannes Berg };
546d3236553SJohannes Berg 
547e691ac2fSRafał Miłecki /**
548c4cbaf79SLuca Coelho  * ieee80211_get_sband_iftype_data - return sband data for a given iftype
549c4cbaf79SLuca Coelho  * @sband: the sband to search for the STA on
550c4cbaf79SLuca Coelho  * @iftype: enum nl80211_iftype
551c4cbaf79SLuca Coelho  *
552c4cbaf79SLuca Coelho  * Return: pointer to struct ieee80211_sband_iftype_data, or NULL is none found
553c4cbaf79SLuca Coelho  */
554c4cbaf79SLuca Coelho static inline const struct ieee80211_sband_iftype_data *
555c4cbaf79SLuca Coelho ieee80211_get_sband_iftype_data(const struct ieee80211_supported_band *sband,
556c4cbaf79SLuca Coelho 				u8 iftype)
557c4cbaf79SLuca Coelho {
558c4cbaf79SLuca Coelho 	int i;
559c4cbaf79SLuca Coelho 
560c4cbaf79SLuca Coelho 	if (WARN_ON(iftype >= NL80211_IFTYPE_MAX))
561c4cbaf79SLuca Coelho 		return NULL;
562c4cbaf79SLuca Coelho 
563c4cbaf79SLuca Coelho 	for (i = 0; i < sband->n_iftype_data; i++)  {
564c4cbaf79SLuca Coelho 		const struct ieee80211_sband_iftype_data *data =
565c4cbaf79SLuca Coelho 			&sband->iftype_data[i];
566c4cbaf79SLuca Coelho 
567c4cbaf79SLuca Coelho 		if (data->types_mask & BIT(iftype))
568c4cbaf79SLuca Coelho 			return data;
569c4cbaf79SLuca Coelho 	}
570c4cbaf79SLuca Coelho 
571c4cbaf79SLuca Coelho 	return NULL;
572c4cbaf79SLuca Coelho }
573c4cbaf79SLuca Coelho 
574c4cbaf79SLuca Coelho /**
575d7edf40cSJohn Crispin  * ieee80211_get_he_iftype_cap - return HE capabilities for an sband's iftype
576d7edf40cSJohn Crispin  * @sband: the sband to search for the iftype on
577d7edf40cSJohn Crispin  * @iftype: enum nl80211_iftype
578d7edf40cSJohn Crispin  *
579d7edf40cSJohn Crispin  * Return: pointer to the struct ieee80211_sta_he_cap, or NULL is none found
580d7edf40cSJohn Crispin  */
581d7edf40cSJohn Crispin static inline const struct ieee80211_sta_he_cap *
582d7edf40cSJohn Crispin ieee80211_get_he_iftype_cap(const struct ieee80211_supported_band *sband,
583d7edf40cSJohn Crispin 			    u8 iftype)
584d7edf40cSJohn Crispin {
585d7edf40cSJohn Crispin 	const struct ieee80211_sband_iftype_data *data =
586d7edf40cSJohn Crispin 		ieee80211_get_sband_iftype_data(sband, iftype);
587d7edf40cSJohn Crispin 
588d7edf40cSJohn Crispin 	if (data && data->he_cap.has_he)
589d7edf40cSJohn Crispin 		return &data->he_cap;
590d7edf40cSJohn Crispin 
591d7edf40cSJohn Crispin 	return NULL;
592d7edf40cSJohn Crispin }
593d7edf40cSJohn Crispin 
594d7edf40cSJohn Crispin /**
5952ad2274cSIlan Peer  * ieee80211_get_he_6ghz_capa - return HE 6 GHz capabilities
5962ad2274cSIlan Peer  * @sband: the sband to search for the STA on
5972ad2274cSIlan Peer  * @iftype: the iftype to search for
5982ad2274cSIlan Peer  *
5992ad2274cSIlan Peer  * Return: the 6GHz capabilities
6002ad2274cSIlan Peer  */
6012ad2274cSIlan Peer static inline __le16
6022ad2274cSIlan Peer ieee80211_get_he_6ghz_capa(const struct ieee80211_supported_band *sband,
6032ad2274cSIlan Peer 			   enum nl80211_iftype iftype)
6042ad2274cSIlan Peer {
6052ad2274cSIlan Peer 	const struct ieee80211_sband_iftype_data *data =
6062ad2274cSIlan Peer 		ieee80211_get_sband_iftype_data(sband, iftype);
6072ad2274cSIlan Peer 
6082ad2274cSIlan Peer 	if (WARN_ON(!data || !data->he_cap.has_he))
6092ad2274cSIlan Peer 		return 0;
6102ad2274cSIlan Peer 
6112ad2274cSIlan Peer 	return data->he_6ghz_capa.capa;
6122ad2274cSIlan Peer }
6132ad2274cSIlan Peer 
6142ad2274cSIlan Peer /**
6155cd5a8a3SIlan Peer  * ieee80211_get_eht_iftype_cap - return ETH capabilities for an sband's iftype
6165cd5a8a3SIlan Peer  * @sband: the sband to search for the iftype on
6175cd5a8a3SIlan Peer  * @iftype: enum nl80211_iftype
6185cd5a8a3SIlan Peer  *
6195cd5a8a3SIlan Peer  * Return: pointer to the struct ieee80211_sta_eht_cap, or NULL is none found
6205cd5a8a3SIlan Peer  */
6215cd5a8a3SIlan Peer static inline const struct ieee80211_sta_eht_cap *
6225cd5a8a3SIlan Peer ieee80211_get_eht_iftype_cap(const struct ieee80211_supported_band *sband,
6235cd5a8a3SIlan Peer 			     enum nl80211_iftype iftype)
6245cd5a8a3SIlan Peer {
6255cd5a8a3SIlan Peer 	const struct ieee80211_sband_iftype_data *data =
6265cd5a8a3SIlan Peer 		ieee80211_get_sband_iftype_data(sband, iftype);
6275cd5a8a3SIlan Peer 
6285cd5a8a3SIlan Peer 	if (data && data->eht_cap.has_eht)
6295cd5a8a3SIlan Peer 		return &data->eht_cap;
6305cd5a8a3SIlan Peer 
6315cd5a8a3SIlan Peer 	return NULL;
6325cd5a8a3SIlan Peer }
6335cd5a8a3SIlan Peer 
6345cd5a8a3SIlan Peer /**
635e691ac2fSRafał Miłecki  * wiphy_read_of_freq_limits - read frequency limits from device tree
636e691ac2fSRafał Miłecki  *
637e691ac2fSRafał Miłecki  * @wiphy: the wireless device to get extra limits for
638e691ac2fSRafał Miłecki  *
639e691ac2fSRafał Miłecki  * Some devices may have extra limitations specified in DT. This may be useful
640e691ac2fSRafał Miłecki  * for chipsets that normally support more bands but are limited due to board
641e691ac2fSRafał Miłecki  * design (e.g. by antennas or external power amplifier).
642e691ac2fSRafał Miłecki  *
643e691ac2fSRafał Miłecki  * This function reads info from DT and uses it to *modify* channels (disable
644e691ac2fSRafał Miłecki  * unavailable ones). It's usually a *bad* idea to use it in drivers with
645e691ac2fSRafał Miłecki  * shared channel data as DT limitations are device specific. You should make
646e691ac2fSRafał Miłecki  * sure to call it only if channels in wiphy are copied and can be modified
647e691ac2fSRafał Miłecki  * without affecting other devices.
648e691ac2fSRafał Miłecki  *
649e691ac2fSRafał Miłecki  * As this function access device node it has to be called after set_wiphy_dev.
650e691ac2fSRafał Miłecki  * It also modifies channels so they have to be set first.
651e691ac2fSRafał Miłecki  * If using this helper, call it before wiphy_register().
652e691ac2fSRafał Miłecki  */
653e691ac2fSRafał Miłecki #ifdef CONFIG_OF
654e691ac2fSRafał Miłecki void wiphy_read_of_freq_limits(struct wiphy *wiphy);
655e691ac2fSRafał Miłecki #else /* CONFIG_OF */
656e691ac2fSRafał Miłecki static inline void wiphy_read_of_freq_limits(struct wiphy *wiphy)
657e691ac2fSRafał Miłecki {
658e691ac2fSRafał Miłecki }
659e691ac2fSRafał Miłecki #endif /* !CONFIG_OF */
660e691ac2fSRafał Miłecki 
661e691ac2fSRafał Miłecki 
662d3236553SJohannes Berg /*
663d3236553SJohannes Berg  * Wireless hardware/device configuration structures and methods
664704232c2SJohannes Berg  */
665704232c2SJohannes Berg 
6662ec600d6SLuis Carlos Cobo /**
667d70e9693SJohannes Berg  * DOC: Actions and configuration
668d70e9693SJohannes Berg  *
669d70e9693SJohannes Berg  * Each wireless device and each virtual interface offer a set of configuration
670d70e9693SJohannes Berg  * operations and other actions that are invoked by userspace. Each of these
671d70e9693SJohannes Berg  * actions is described in the operations structure, and the parameters these
672d70e9693SJohannes Berg  * operations use are described separately.
673d70e9693SJohannes Berg  *
674d70e9693SJohannes Berg  * Additionally, some operations are asynchronous and expect to get status
675d70e9693SJohannes Berg  * information via some functions that drivers need to call.
676d70e9693SJohannes Berg  *
677d70e9693SJohannes Berg  * Scanning and BSS list handling with its associated functionality is described
678d70e9693SJohannes Berg  * in a separate chapter.
679d70e9693SJohannes Berg  */
680d70e9693SJohannes Berg 
681c6e6a0c8SAviya Erenfeld #define VHT_MUMIMO_GROUPS_DATA_LEN (WLAN_MEMBERSHIP_LEN +\
682c6e6a0c8SAviya Erenfeld 				    WLAN_USER_POSITION_LEN)
683c6e6a0c8SAviya Erenfeld 
684d70e9693SJohannes Berg /**
6852ec600d6SLuis Carlos Cobo  * struct vif_params - describes virtual interface parameters
686818a986eSJohannes Berg  * @flags: monitor interface flags, unchanged if 0, otherwise
687818a986eSJohannes Berg  *	%MONITOR_FLAG_CHANGED will be set
6888b787643SFelix Fietkau  * @use_4addr: use 4-address frames
689e8f479b1SBen Greear  * @macaddr: address to use for this virtual interface.
690e8f479b1SBen Greear  *	If this parameter is set to zero address the driver may
691e8f479b1SBen Greear  *	determine the address as needed.
692e8f479b1SBen Greear  *	This feature is only fully supported by drivers that enable the
693e8f479b1SBen Greear  *	%NL80211_FEATURE_MAC_ON_CREATE flag.  Others may support creating
694e8f479b1SBen Greear  **	only p2p devices with specified MAC.
695b0265024SJohannes Berg  * @vht_mumimo_groups: MU-MIMO groupID, used for monitoring MU-MIMO packets
696b0265024SJohannes Berg  *	belonging to that MU-MIMO groupID; %NULL if not changed
697b0265024SJohannes Berg  * @vht_mumimo_follow_addr: MU-MIMO follow address, used for monitoring
698b0265024SJohannes Berg  *	MU-MIMO packets going to the specified station; %NULL if not changed
6992ec600d6SLuis Carlos Cobo  */
7002ec600d6SLuis Carlos Cobo struct vif_params {
701818a986eSJohannes Berg 	u32 flags;
7028b787643SFelix Fietkau 	int use_4addr;
7031c18f145SArend van Spriel 	u8 macaddr[ETH_ALEN];
704b0265024SJohannes Berg 	const u8 *vht_mumimo_groups;
705b0265024SJohannes Berg 	const u8 *vht_mumimo_follow_addr;
7062ec600d6SLuis Carlos Cobo };
7072ec600d6SLuis Carlos Cobo 
70841ade00fSJohannes Berg /**
70941ade00fSJohannes Berg  * struct key_params - key information
71041ade00fSJohannes Berg  *
71141ade00fSJohannes Berg  * Information about a key
71241ade00fSJohannes Berg  *
71341ade00fSJohannes Berg  * @key: key material
71441ade00fSJohannes Berg  * @key_len: length of key material
71541ade00fSJohannes Berg  * @cipher: cipher suite selector
71641ade00fSJohannes Berg  * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used
71741ade00fSJohannes Berg  *	with the get_key() callback, must be in little endian,
71841ade00fSJohannes Berg  *	length given by @seq_len.
719abe37c4bSJohannes Berg  * @seq_len: length of @seq.
72014f34e36SGurumoorthi Gnanasambandhan  * @vlan_id: vlan_id for VLAN group key (if nonzero)
7216cdd3979SAlexander Wetzel  * @mode: key install mode (RX_TX, NO_TX or SET_TX)
72241ade00fSJohannes Berg  */
72341ade00fSJohannes Berg struct key_params {
724c1e5f471SJohannes Berg 	const u8 *key;
725c1e5f471SJohannes Berg 	const u8 *seq;
72641ade00fSJohannes Berg 	int key_len;
72741ade00fSJohannes Berg 	int seq_len;
72814f34e36SGurumoorthi Gnanasambandhan 	u16 vlan_id;
72941ade00fSJohannes Berg 	u32 cipher;
7306cdd3979SAlexander Wetzel 	enum nl80211_key_mode mode;
73141ade00fSJohannes Berg };
73241ade00fSJohannes Berg 
733ed1b6cc7SJohannes Berg /**
734683b6d3bSJohannes Berg  * struct cfg80211_chan_def - channel definition
735683b6d3bSJohannes Berg  * @chan: the (control) channel
7363d9d1d66SJohannes Berg  * @width: channel width
7373d9d1d66SJohannes Berg  * @center_freq1: center frequency of first segment
7383d9d1d66SJohannes Berg  * @center_freq2: center frequency of second segment
7393d9d1d66SJohannes Berg  *	(only with 80+80 MHz)
7402a38075cSAlexei Avshalom Lazar  * @edmg: define the EDMG channels configuration.
7412a38075cSAlexei Avshalom Lazar  *	If edmg is requested (i.e. the .channels member is non-zero),
7422a38075cSAlexei Avshalom Lazar  *	chan will define the primary channel and all other
7432a38075cSAlexei Avshalom Lazar  *	parameters are ignored.
744934f4c7dSThomas Pedersen  * @freq1_offset: offset from @center_freq1, in KHz
745683b6d3bSJohannes Berg  */
746683b6d3bSJohannes Berg struct cfg80211_chan_def {
747683b6d3bSJohannes Berg 	struct ieee80211_channel *chan;
7483d9d1d66SJohannes Berg 	enum nl80211_chan_width width;
7493d9d1d66SJohannes Berg 	u32 center_freq1;
7503d9d1d66SJohannes Berg 	u32 center_freq2;
7512a38075cSAlexei Avshalom Lazar 	struct ieee80211_edmg edmg;
752934f4c7dSThomas Pedersen 	u16 freq1_offset;
753683b6d3bSJohannes Berg };
754683b6d3bSJohannes Berg 
7559a5f6488STamizh Chelvam /*
7569a5f6488STamizh Chelvam  * cfg80211_bitrate_mask - masks for bitrate control
7579a5f6488STamizh Chelvam  */
7589a5f6488STamizh Chelvam struct cfg80211_bitrate_mask {
7599a5f6488STamizh Chelvam 	struct {
7609a5f6488STamizh Chelvam 		u32 legacy;
7619a5f6488STamizh Chelvam 		u8 ht_mcs[IEEE80211_HT_MCS_MASK_LEN];
7629a5f6488STamizh Chelvam 		u16 vht_mcs[NL80211_VHT_NSS_MAX];
763eb89a6a6SMiles Hu 		u16 he_mcs[NL80211_HE_NSS_MAX];
7649a5f6488STamizh Chelvam 		enum nl80211_txrate_gi gi;
765eb89a6a6SMiles Hu 		enum nl80211_he_gi he_gi;
766eb89a6a6SMiles Hu 		enum nl80211_he_ltf he_ltf;
7679a5f6488STamizh Chelvam 	} control[NUM_NL80211_BANDS];
7689a5f6488STamizh Chelvam };
7699a5f6488STamizh Chelvam 
7709a5f6488STamizh Chelvam 
77177f576deSTamizh chelvam /**
7723710a8a6SJohannes Berg  * struct cfg80211_tid_cfg - TID specific configuration
77377f576deSTamizh chelvam  * @config_override: Flag to notify driver to reset TID configuration
77477f576deSTamizh chelvam  *	of the peer.
7753710a8a6SJohannes Berg  * @tids: bitmap of TIDs to modify
7763710a8a6SJohannes Berg  * @mask: bitmap of attributes indicating which parameter changed,
7773710a8a6SJohannes Berg  *	similar to &nl80211_tid_config_supp.
77877f576deSTamizh chelvam  * @noack: noack configuration value for the TID
7796a21d16cSTamizh chelvam  * @retry_long: retry count value
7806a21d16cSTamizh chelvam  * @retry_short: retry count value
78133462e68SSergey Matyukevich  * @ampdu: Enable/Disable MPDU aggregation
78204f7d142STamizh chelvam  * @rtscts: Enable/Disable RTS/CTS
78333462e68SSergey Matyukevich  * @amsdu: Enable/Disable MSDU aggregation
7849a5f6488STamizh Chelvam  * @txrate_type: Tx bitrate mask type
7859a5f6488STamizh Chelvam  * @txrate_mask: Tx bitrate to be applied for the TID
78677f576deSTamizh chelvam  */
7873710a8a6SJohannes Berg struct cfg80211_tid_cfg {
78877f576deSTamizh chelvam 	bool config_override;
7893710a8a6SJohannes Berg 	u8 tids;
7902d5d9b7fSSergey Matyukevich 	u64 mask;
79177f576deSTamizh chelvam 	enum nl80211_tid_config noack;
7926a21d16cSTamizh chelvam 	u8 retry_long, retry_short;
793ade274b2STamizh chelvam 	enum nl80211_tid_config ampdu;
79404f7d142STamizh chelvam 	enum nl80211_tid_config rtscts;
79533462e68SSergey Matyukevich 	enum nl80211_tid_config amsdu;
7969a5f6488STamizh Chelvam 	enum nl80211_tx_rate_setting txrate_type;
7979a5f6488STamizh Chelvam 	struct cfg80211_bitrate_mask txrate_mask;
79877f576deSTamizh chelvam };
79977f576deSTamizh chelvam 
80077f576deSTamizh chelvam /**
8013710a8a6SJohannes Berg  * struct cfg80211_tid_config - TID configuration
80277f576deSTamizh chelvam  * @peer: Station's MAC address
80377f576deSTamizh chelvam  * @n_tid_conf: Number of TID specific configurations to be applied
80477f576deSTamizh chelvam  * @tid_conf: Configuration change info
80577f576deSTamizh chelvam  */
8063710a8a6SJohannes Berg struct cfg80211_tid_config {
80777f576deSTamizh chelvam 	const u8 *peer;
80877f576deSTamizh chelvam 	u32 n_tid_conf;
8093710a8a6SJohannes Berg 	struct cfg80211_tid_cfg tid_conf[];
81077f576deSTamizh chelvam };
81177f576deSTamizh chelvam 
8123d9d1d66SJohannes Berg /**
813e306784aSSubrat Mishra  * struct cfg80211_fils_aad - FILS AAD data
814e306784aSSubrat Mishra  * @macaddr: STA MAC address
815e306784aSSubrat Mishra  * @kek: FILS KEK
816e306784aSSubrat Mishra  * @kek_len: FILS KEK length
817e306784aSSubrat Mishra  * @snonce: STA Nonce
818e306784aSSubrat Mishra  * @anonce: AP Nonce
819e306784aSSubrat Mishra  */
820e306784aSSubrat Mishra struct cfg80211_fils_aad {
821e306784aSSubrat Mishra 	const u8 *macaddr;
822e306784aSSubrat Mishra 	const u8 *kek;
823e306784aSSubrat Mishra 	u8 kek_len;
824e306784aSSubrat Mishra 	const u8 *snonce;
825e306784aSSubrat Mishra 	const u8 *anonce;
826e306784aSSubrat Mishra };
827e306784aSSubrat Mishra 
828e306784aSSubrat Mishra /**
8293d9d1d66SJohannes Berg  * cfg80211_get_chandef_type - return old channel type from chandef
8303d9d1d66SJohannes Berg  * @chandef: the channel definition
8313d9d1d66SJohannes Berg  *
8320ae997dcSYacine Belkadi  * Return: The old channel type (NOHT, HT20, HT40+/-) from a given
8333d9d1d66SJohannes Berg  * chandef, which must have a bandwidth allowing this conversion.
8343d9d1d66SJohannes Berg  */
835683b6d3bSJohannes Berg static inline enum nl80211_channel_type
836683b6d3bSJohannes Berg cfg80211_get_chandef_type(const struct cfg80211_chan_def *chandef)
837683b6d3bSJohannes Berg {
8383d9d1d66SJohannes Berg 	switch (chandef->width) {
8393d9d1d66SJohannes Berg 	case NL80211_CHAN_WIDTH_20_NOHT:
8403d9d1d66SJohannes Berg 		return NL80211_CHAN_NO_HT;
8413d9d1d66SJohannes Berg 	case NL80211_CHAN_WIDTH_20:
8423d9d1d66SJohannes Berg 		return NL80211_CHAN_HT20;
8433d9d1d66SJohannes Berg 	case NL80211_CHAN_WIDTH_40:
8443d9d1d66SJohannes Berg 		if (chandef->center_freq1 > chandef->chan->center_freq)
8453d9d1d66SJohannes Berg 			return NL80211_CHAN_HT40PLUS;
8463d9d1d66SJohannes Berg 		return NL80211_CHAN_HT40MINUS;
8473d9d1d66SJohannes Berg 	default:
8483d9d1d66SJohannes Berg 		WARN_ON(1);
8493d9d1d66SJohannes Berg 		return NL80211_CHAN_NO_HT;
850683b6d3bSJohannes Berg 	}
8513d9d1d66SJohannes Berg }
8523d9d1d66SJohannes Berg 
8533d9d1d66SJohannes Berg /**
8543d9d1d66SJohannes Berg  * cfg80211_chandef_create - create channel definition using channel type
8553d9d1d66SJohannes Berg  * @chandef: the channel definition struct to fill
8563d9d1d66SJohannes Berg  * @channel: the control channel
8573d9d1d66SJohannes Berg  * @chantype: the channel type
8583d9d1d66SJohannes Berg  *
8593d9d1d66SJohannes Berg  * Given a channel type, create a channel definition.
8603d9d1d66SJohannes Berg  */
8613d9d1d66SJohannes Berg void cfg80211_chandef_create(struct cfg80211_chan_def *chandef,
8623d9d1d66SJohannes Berg 			     struct ieee80211_channel *channel,
8633d9d1d66SJohannes Berg 			     enum nl80211_channel_type chantype);
8643d9d1d66SJohannes Berg 
8653d9d1d66SJohannes Berg /**
8663d9d1d66SJohannes Berg  * cfg80211_chandef_identical - check if two channel definitions are identical
8673d9d1d66SJohannes Berg  * @chandef1: first channel definition
8683d9d1d66SJohannes Berg  * @chandef2: second channel definition
8693d9d1d66SJohannes Berg  *
8700ae997dcSYacine Belkadi  * Return: %true if the channels defined by the channel definitions are
8713d9d1d66SJohannes Berg  * identical, %false otherwise.
8723d9d1d66SJohannes Berg  */
8733d9d1d66SJohannes Berg static inline bool
8743d9d1d66SJohannes Berg cfg80211_chandef_identical(const struct cfg80211_chan_def *chandef1,
8753d9d1d66SJohannes Berg 			   const struct cfg80211_chan_def *chandef2)
8763d9d1d66SJohannes Berg {
8773d9d1d66SJohannes Berg 	return (chandef1->chan == chandef2->chan &&
8783d9d1d66SJohannes Berg 		chandef1->width == chandef2->width &&
8793d9d1d66SJohannes Berg 		chandef1->center_freq1 == chandef2->center_freq1 &&
880934f4c7dSThomas Pedersen 		chandef1->freq1_offset == chandef2->freq1_offset &&
8813d9d1d66SJohannes Berg 		chandef1->center_freq2 == chandef2->center_freq2);
8823d9d1d66SJohannes Berg }
8833d9d1d66SJohannes Berg 
8843d9d1d66SJohannes Berg /**
8852a38075cSAlexei Avshalom Lazar  * cfg80211_chandef_is_edmg - check if chandef represents an EDMG channel
8862a38075cSAlexei Avshalom Lazar  *
8872a38075cSAlexei Avshalom Lazar  * @chandef: the channel definition
8882a38075cSAlexei Avshalom Lazar  *
8892a38075cSAlexei Avshalom Lazar  * Return: %true if EDMG defined, %false otherwise.
8902a38075cSAlexei Avshalom Lazar  */
8912a38075cSAlexei Avshalom Lazar static inline bool
8922a38075cSAlexei Avshalom Lazar cfg80211_chandef_is_edmg(const struct cfg80211_chan_def *chandef)
8932a38075cSAlexei Avshalom Lazar {
8942a38075cSAlexei Avshalom Lazar 	return chandef->edmg.channels || chandef->edmg.bw_config;
8952a38075cSAlexei Avshalom Lazar }
8962a38075cSAlexei Avshalom Lazar 
8972a38075cSAlexei Avshalom Lazar /**
8983d9d1d66SJohannes Berg  * cfg80211_chandef_compatible - check if two channel definitions are compatible
8993d9d1d66SJohannes Berg  * @chandef1: first channel definition
9003d9d1d66SJohannes Berg  * @chandef2: second channel definition
9013d9d1d66SJohannes Berg  *
9020ae997dcSYacine Belkadi  * Return: %NULL if the given channel definitions are incompatible,
9033d9d1d66SJohannes Berg  * chandef1 or chandef2 otherwise.
9043d9d1d66SJohannes Berg  */
9053d9d1d66SJohannes Berg const struct cfg80211_chan_def *
9063d9d1d66SJohannes Berg cfg80211_chandef_compatible(const struct cfg80211_chan_def *chandef1,
9073d9d1d66SJohannes Berg 			    const struct cfg80211_chan_def *chandef2);
908683b6d3bSJohannes Berg 
909683b6d3bSJohannes Berg /**
9109f5e8f6eSJohannes Berg  * cfg80211_chandef_valid - check if a channel definition is valid
9119f5e8f6eSJohannes Berg  * @chandef: the channel definition to check
9120ae997dcSYacine Belkadi  * Return: %true if the channel definition is valid. %false otherwise.
9139f5e8f6eSJohannes Berg  */
9149f5e8f6eSJohannes Berg bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef);
9159f5e8f6eSJohannes Berg 
9169f5e8f6eSJohannes Berg /**
9179f5e8f6eSJohannes Berg  * cfg80211_chandef_usable - check if secondary channels can be used
9189f5e8f6eSJohannes Berg  * @wiphy: the wiphy to validate against
9199f5e8f6eSJohannes Berg  * @chandef: the channel definition to check
9200ae997dcSYacine Belkadi  * @prohibited_flags: the regulatory channel flags that must not be set
9210ae997dcSYacine Belkadi  * Return: %true if secondary channels are usable. %false otherwise.
9229f5e8f6eSJohannes Berg  */
9239f5e8f6eSJohannes Berg bool cfg80211_chandef_usable(struct wiphy *wiphy,
9249f5e8f6eSJohannes Berg 			     const struct cfg80211_chan_def *chandef,
9259f5e8f6eSJohannes Berg 			     u32 prohibited_flags);
9269f5e8f6eSJohannes Berg 
9279f5e8f6eSJohannes Berg /**
928774f0734SSimon Wunderlich  * cfg80211_chandef_dfs_required - checks if radar detection is required
929774f0734SSimon Wunderlich  * @wiphy: the wiphy to validate against
930774f0734SSimon Wunderlich  * @chandef: the channel definition to check
9312beb6dabSLuciano Coelho  * @iftype: the interface type as specified in &enum nl80211_iftype
9322beb6dabSLuciano Coelho  * Returns:
9332beb6dabSLuciano Coelho  *	1 if radar detection is required, 0 if it is not, < 0 on error
934774f0734SSimon Wunderlich  */
935774f0734SSimon Wunderlich int cfg80211_chandef_dfs_required(struct wiphy *wiphy,
9362beb6dabSLuciano Coelho 				  const struct cfg80211_chan_def *chandef,
937c3d62036SLuciano Coelho 				  enum nl80211_iftype iftype);
938774f0734SSimon Wunderlich 
939774f0734SSimon Wunderlich /**
94030e74732SSimon Wunderlich  * ieee80211_chandef_rate_flags - returns rate flags for a channel
94130e74732SSimon Wunderlich  *
94230e74732SSimon Wunderlich  * In some channel types, not all rates may be used - for example CCK
94330e74732SSimon Wunderlich  * rates may not be used in 5/10 MHz channels.
94430e74732SSimon Wunderlich  *
94530e74732SSimon Wunderlich  * @chandef: channel definition for the channel
94630e74732SSimon Wunderlich  *
94730e74732SSimon Wunderlich  * Returns: rate flags which apply for this channel
94830e74732SSimon Wunderlich  */
94930e74732SSimon Wunderlich static inline enum ieee80211_rate_flags
95030e74732SSimon Wunderlich ieee80211_chandef_rate_flags(struct cfg80211_chan_def *chandef)
95130e74732SSimon Wunderlich {
95230e74732SSimon Wunderlich 	switch (chandef->width) {
95330e74732SSimon Wunderlich 	case NL80211_CHAN_WIDTH_5:
95430e74732SSimon Wunderlich 		return IEEE80211_RATE_SUPPORTS_5MHZ;
95530e74732SSimon Wunderlich 	case NL80211_CHAN_WIDTH_10:
95630e74732SSimon Wunderlich 		return IEEE80211_RATE_SUPPORTS_10MHZ;
95730e74732SSimon Wunderlich 	default:
95830e74732SSimon Wunderlich 		break;
95930e74732SSimon Wunderlich 	}
96030e74732SSimon Wunderlich 	return 0;
96130e74732SSimon Wunderlich }
96230e74732SSimon Wunderlich 
96330e74732SSimon Wunderlich /**
9640430c883SSimon Wunderlich  * ieee80211_chandef_max_power - maximum transmission power for the chandef
9650430c883SSimon Wunderlich  *
9660430c883SSimon Wunderlich  * In some regulations, the transmit power may depend on the configured channel
9670430c883SSimon Wunderlich  * bandwidth which may be defined as dBm/MHz. This function returns the actual
9680430c883SSimon Wunderlich  * max_power for non-standard (20 MHz) channels.
9690430c883SSimon Wunderlich  *
9700430c883SSimon Wunderlich  * @chandef: channel definition for the channel
9710430c883SSimon Wunderlich  *
9720430c883SSimon Wunderlich  * Returns: maximum allowed transmission power in dBm for the chandef
9730430c883SSimon Wunderlich  */
9740430c883SSimon Wunderlich static inline int
9750430c883SSimon Wunderlich ieee80211_chandef_max_power(struct cfg80211_chan_def *chandef)
9760430c883SSimon Wunderlich {
9770430c883SSimon Wunderlich 	switch (chandef->width) {
9780430c883SSimon Wunderlich 	case NL80211_CHAN_WIDTH_5:
9790430c883SSimon Wunderlich 		return min(chandef->chan->max_reg_power - 6,
9800430c883SSimon Wunderlich 			   chandef->chan->max_power);
9810430c883SSimon Wunderlich 	case NL80211_CHAN_WIDTH_10:
9820430c883SSimon Wunderlich 		return min(chandef->chan->max_reg_power - 3,
9830430c883SSimon Wunderlich 			   chandef->chan->max_power);
9840430c883SSimon Wunderlich 	default:
9850430c883SSimon Wunderlich 		break;
9860430c883SSimon Wunderlich 	}
9870430c883SSimon Wunderlich 	return chandef->chan->max_power;
9880430c883SSimon Wunderlich }
9890430c883SSimon Wunderlich 
9900430c883SSimon Wunderlich /**
991be989891SJohannes Berg  * cfg80211_any_usable_channels - check for usable channels
992be989891SJohannes Berg  * @wiphy: the wiphy to check for
993be989891SJohannes Berg  * @band_mask: which bands to check on
994be989891SJohannes Berg  * @prohibited_flags: which channels to not consider usable,
995be989891SJohannes Berg  *	%IEEE80211_CHAN_DISABLED is always taken into account
996be989891SJohannes Berg  */
997be989891SJohannes Berg bool cfg80211_any_usable_channels(struct wiphy *wiphy,
998be989891SJohannes Berg 				  unsigned long band_mask,
999be989891SJohannes Berg 				  u32 prohibited_flags);
1000be989891SJohannes Berg 
1001be989891SJohannes Berg /**
100261fa713cSHolger Schurig  * enum survey_info_flags - survey information flags
100361fa713cSHolger Schurig  *
1004abe37c4bSJohannes Berg  * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in
100517e5a808SFelix Fietkau  * @SURVEY_INFO_IN_USE: channel is currently being used
10064ed20bebSJohannes Berg  * @SURVEY_INFO_TIME: active time (in ms) was filled in
10074ed20bebSJohannes Berg  * @SURVEY_INFO_TIME_BUSY: busy time was filled in
10084ed20bebSJohannes Berg  * @SURVEY_INFO_TIME_EXT_BUSY: extension channel busy time was filled in
10094ed20bebSJohannes Berg  * @SURVEY_INFO_TIME_RX: receive time was filled in
10104ed20bebSJohannes Berg  * @SURVEY_INFO_TIME_TX: transmit time was filled in
1011052536abSJohannes Berg  * @SURVEY_INFO_TIME_SCAN: scan time was filled in
1012c8cd6e7fSFelix Fietkau  * @SURVEY_INFO_TIME_BSS_RX: local BSS receive time was filled in
1013abe37c4bSJohannes Berg  *
101461fa713cSHolger Schurig  * Used by the driver to indicate which info in &struct survey_info
101561fa713cSHolger Schurig  * it has filled in during the get_survey().
101661fa713cSHolger Schurig  */
101761fa713cSHolger Schurig enum survey_info_flags {
10184ed20bebSJohannes Berg 	SURVEY_INFO_NOISE_DBM		= BIT(0),
10194ed20bebSJohannes Berg 	SURVEY_INFO_IN_USE		= BIT(1),
10204ed20bebSJohannes Berg 	SURVEY_INFO_TIME		= BIT(2),
10214ed20bebSJohannes Berg 	SURVEY_INFO_TIME_BUSY		= BIT(3),
10224ed20bebSJohannes Berg 	SURVEY_INFO_TIME_EXT_BUSY	= BIT(4),
10234ed20bebSJohannes Berg 	SURVEY_INFO_TIME_RX		= BIT(5),
10244ed20bebSJohannes Berg 	SURVEY_INFO_TIME_TX		= BIT(6),
1025052536abSJohannes Berg 	SURVEY_INFO_TIME_SCAN		= BIT(7),
1026c8cd6e7fSFelix Fietkau 	SURVEY_INFO_TIME_BSS_RX		= BIT(8),
102761fa713cSHolger Schurig };
102861fa713cSHolger Schurig 
102961fa713cSHolger Schurig /**
103061fa713cSHolger Schurig  * struct survey_info - channel survey response
103161fa713cSHolger Schurig  *
103211f78ac3SJohannes Berg  * @channel: the channel this survey record reports, may be %NULL for a single
103311f78ac3SJohannes Berg  *	record to report global statistics
103461fa713cSHolger Schurig  * @filled: bitflag of flags from &enum survey_info_flags
103561fa713cSHolger Schurig  * @noise: channel noise in dBm. This and all following fields are
103661fa713cSHolger Schurig  *	optional
10374ed20bebSJohannes Berg  * @time: amount of time in ms the radio was turn on (on the channel)
10384ed20bebSJohannes Berg  * @time_busy: amount of time the primary channel was sensed busy
10394ed20bebSJohannes Berg  * @time_ext_busy: amount of time the extension channel was sensed busy
10404ed20bebSJohannes Berg  * @time_rx: amount of time the radio spent receiving data
10414ed20bebSJohannes Berg  * @time_tx: amount of time the radio spent transmitting data
1042052536abSJohannes Berg  * @time_scan: amount of time the radio spent for scanning
1043c8cd6e7fSFelix Fietkau  * @time_bss_rx: amount of time the radio spent receiving data on a local BSS
104461fa713cSHolger Schurig  *
1045abe37c4bSJohannes Berg  * Used by dump_survey() to report back per-channel survey information.
1046abe37c4bSJohannes Berg  *
104761fa713cSHolger Schurig  * This structure can later be expanded with things like
104861fa713cSHolger Schurig  * channel duty cycle etc.
104961fa713cSHolger Schurig  */
105061fa713cSHolger Schurig struct survey_info {
105161fa713cSHolger Schurig 	struct ieee80211_channel *channel;
10524ed20bebSJohannes Berg 	u64 time;
10534ed20bebSJohannes Berg 	u64 time_busy;
10544ed20bebSJohannes Berg 	u64 time_ext_busy;
10554ed20bebSJohannes Berg 	u64 time_rx;
10564ed20bebSJohannes Berg 	u64 time_tx;
1057052536abSJohannes Berg 	u64 time_scan;
1058c8cd6e7fSFelix Fietkau 	u64 time_bss_rx;
105961fa713cSHolger Schurig 	u32 filled;
106061fa713cSHolger Schurig 	s8 noise;
106161fa713cSHolger Schurig };
106261fa713cSHolger Schurig 
1063b8676221SDavid Spinadel #define CFG80211_MAX_WEP_KEYS	4
1064b8676221SDavid Spinadel 
106561fa713cSHolger Schurig /**
10665fb628e9SJouni Malinen  * struct cfg80211_crypto_settings - Crypto settings
10675fb628e9SJouni Malinen  * @wpa_versions: indicates which, if any, WPA versions are enabled
10685fb628e9SJouni Malinen  *	(from enum nl80211_wpa_versions)
10695fb628e9SJouni Malinen  * @cipher_group: group key cipher suite (or 0 if unset)
10705fb628e9SJouni Malinen  * @n_ciphers_pairwise: number of AP supported unicast ciphers
10715fb628e9SJouni Malinen  * @ciphers_pairwise: unicast key cipher suites
10725fb628e9SJouni Malinen  * @n_akm_suites: number of AKM suites
10735fb628e9SJouni Malinen  * @akm_suites: AKM suites
10745fb628e9SJouni Malinen  * @control_port: Whether user space controls IEEE 802.1X port, i.e.,
10755fb628e9SJouni Malinen  *	sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
10765fb628e9SJouni Malinen  *	required to assume that the port is unauthorized until authorized by
10775fb628e9SJouni Malinen  *	user space. Otherwise, port is marked authorized by default.
10785fb628e9SJouni Malinen  * @control_port_ethertype: the control port protocol that should be
10795fb628e9SJouni Malinen  *	allowed through even on unauthorized ports
10805fb628e9SJouni Malinen  * @control_port_no_encrypt: TRUE to prevent encryption of control port
10815fb628e9SJouni Malinen  *	protocol frames.
108264bf3d4bSDenis Kenzior  * @control_port_over_nl80211: TRUE if userspace expects to exchange control
108364bf3d4bSDenis Kenzior  *	port frames over NL80211 instead of the network interface.
1084a710d214SLothar Rubusch  * @control_port_no_preauth: disables pre-auth rx over the nl80211 control
1085a710d214SLothar Rubusch  *	port for mac80211
1086b8676221SDavid Spinadel  * @wep_keys: static WEP keys, if not NULL points to an array of
1087b8676221SDavid Spinadel  *	CFG80211_MAX_WEP_KEYS WEP keys
1088b8676221SDavid Spinadel  * @wep_tx_key: key index (0..3) of the default TX static WEP key
108991b5ab62SEliad Peller  * @psk: PSK (for devices supporting 4-way-handshake offload)
109026f7044eSChung-Hsien Hsu  * @sae_pwd: password for SAE authentication (for devices supporting SAE
109126f7044eSChung-Hsien Hsu  *	offload)
109226f7044eSChung-Hsien Hsu  * @sae_pwd_len: length of SAE password (for devices supporting SAE offload)
1093da1e9dd3SJohannes Berg  * @sae_pwe: The mechanisms allowed for SAE PWE derivation:
1094da1e9dd3SJohannes Berg  *
1095da1e9dd3SJohannes Berg  *	NL80211_SAE_PWE_UNSPECIFIED
1096da1e9dd3SJohannes Berg  *	  Not-specified, used to indicate userspace did not specify any
1097da1e9dd3SJohannes Berg  *	  preference. The driver should follow its internal policy in
1098da1e9dd3SJohannes Berg  *	  such a scenario.
1099da1e9dd3SJohannes Berg  *
1100da1e9dd3SJohannes Berg  *	NL80211_SAE_PWE_HUNT_AND_PECK
1101da1e9dd3SJohannes Berg  *	  Allow hunting-and-pecking loop only
1102da1e9dd3SJohannes Berg  *
1103da1e9dd3SJohannes Berg  *	NL80211_SAE_PWE_HASH_TO_ELEMENT
1104da1e9dd3SJohannes Berg  *	  Allow hash-to-element only
1105da1e9dd3SJohannes Berg  *
1106da1e9dd3SJohannes Berg  *	NL80211_SAE_PWE_BOTH
1107da1e9dd3SJohannes Berg  *	  Allow either hunting-and-pecking loop or hash-to-element
11085fb628e9SJouni Malinen  */
11095fb628e9SJouni Malinen struct cfg80211_crypto_settings {
11105fb628e9SJouni Malinen 	u32 wpa_versions;
11115fb628e9SJouni Malinen 	u32 cipher_group;
11125fb628e9SJouni Malinen 	int n_ciphers_pairwise;
11135fb628e9SJouni Malinen 	u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES];
11145fb628e9SJouni Malinen 	int n_akm_suites;
11155fb628e9SJouni Malinen 	u32 akm_suites[NL80211_MAX_NR_AKM_SUITES];
11165fb628e9SJouni Malinen 	bool control_port;
11175fb628e9SJouni Malinen 	__be16 control_port_ethertype;
11185fb628e9SJouni Malinen 	bool control_port_no_encrypt;
111964bf3d4bSDenis Kenzior 	bool control_port_over_nl80211;
11207f3f96ceSMarkus Theil 	bool control_port_no_preauth;
1121b8676221SDavid Spinadel 	struct key_params *wep_keys;
1122b8676221SDavid Spinadel 	int wep_tx_key;
112391b5ab62SEliad Peller 	const u8 *psk;
112426f7044eSChung-Hsien Hsu 	const u8 *sae_pwd;
112526f7044eSChung-Hsien Hsu 	u8 sae_pwd_len;
11269f0ffa41SRohan Dutta 	enum nl80211_sae_pwe_mechanism sae_pwe;
11275fb628e9SJouni Malinen };
11285fb628e9SJouni Malinen 
11295fb628e9SJouni Malinen /**
1130dc1e3cb8SJohn Crispin  * struct cfg80211_mbssid_config - AP settings for multi bssid
1131dc1e3cb8SJohn Crispin  *
1132dc1e3cb8SJohn Crispin  * @tx_wdev: pointer to the transmitted interface in the MBSSID set
1133dc1e3cb8SJohn Crispin  * @index: index of this AP in the multi bssid group.
1134dc1e3cb8SJohn Crispin  * @ema: set to true if the beacons should be sent out in EMA mode.
1135dc1e3cb8SJohn Crispin  */
1136dc1e3cb8SJohn Crispin struct cfg80211_mbssid_config {
1137dc1e3cb8SJohn Crispin 	struct wireless_dev *tx_wdev;
1138dc1e3cb8SJohn Crispin 	u8 index;
1139dc1e3cb8SJohn Crispin 	bool ema;
1140dc1e3cb8SJohn Crispin };
1141dc1e3cb8SJohn Crispin 
1142dc1e3cb8SJohn Crispin /**
1143dc1e3cb8SJohn Crispin  * struct cfg80211_mbssid_elems - Multiple BSSID elements
1144dc1e3cb8SJohn Crispin  *
1145dc1e3cb8SJohn Crispin  * @cnt: Number of elements in array %elems.
1146dc1e3cb8SJohn Crispin  *
1147dc1e3cb8SJohn Crispin  * @elem: Array of multiple BSSID element(s) to be added into Beacon frames.
1148dc1e3cb8SJohn Crispin  * @elem.data: Data for multiple BSSID elements.
1149dc1e3cb8SJohn Crispin  * @elem.len: Length of data.
1150dc1e3cb8SJohn Crispin  */
1151dc1e3cb8SJohn Crispin struct cfg80211_mbssid_elems {
1152dc1e3cb8SJohn Crispin 	u8 cnt;
1153dc1e3cb8SJohn Crispin 	struct {
1154dc1e3cb8SJohn Crispin 		const u8 *data;
1155dc1e3cb8SJohn Crispin 		size_t len;
1156dc1e3cb8SJohn Crispin 	} elem[];
1157dc1e3cb8SJohn Crispin };
1158dc1e3cb8SJohn Crispin 
1159dc1e3cb8SJohn Crispin /**
11608860020eSJohannes Berg  * struct cfg80211_beacon_data - beacon data
1161ed1b6cc7SJohannes Berg  * @head: head portion of beacon (before TIM IE)
1162ed1b6cc7SJohannes Berg  *	or %NULL if not changed
1163ed1b6cc7SJohannes Berg  * @tail: tail portion of beacon (after TIM IE)
1164ed1b6cc7SJohannes Berg  *	or %NULL if not changed
1165ed1b6cc7SJohannes Berg  * @head_len: length of @head
1166ed1b6cc7SJohannes Berg  * @tail_len: length of @tail
11679946ecfbSJouni Malinen  * @beacon_ies: extra information element(s) to add into Beacon frames or %NULL
11689946ecfbSJouni Malinen  * @beacon_ies_len: length of beacon_ies in octets
11699946ecfbSJouni Malinen  * @proberesp_ies: extra information element(s) to add into Probe Response
11709946ecfbSJouni Malinen  *	frames or %NULL
11719946ecfbSJouni Malinen  * @proberesp_ies_len: length of proberesp_ies in octets
11729946ecfbSJouni Malinen  * @assocresp_ies: extra information element(s) to add into (Re)Association
11739946ecfbSJouni Malinen  *	Response frames or %NULL
11749946ecfbSJouni Malinen  * @assocresp_ies_len: length of assocresp_ies in octets
117500f740e1SArik Nemtsov  * @probe_resp_len: length of probe response template (@probe_resp)
117600f740e1SArik Nemtsov  * @probe_resp: probe response template (AP mode only)
1177dc1e3cb8SJohn Crispin  * @mbssid_ies: multiple BSSID elements
117881e54d08SPradeep Kumar Chitrapu  * @ftm_responder: enable FTM responder functionality; -1 for no change
117981e54d08SPradeep Kumar Chitrapu  *	(which also implies no change in LCI/civic location data)
118030db641eSJohannes Berg  * @lci: Measurement Report element content, starting with Measurement Token
118130db641eSJohannes Berg  *	(measurement type 8)
118230db641eSJohannes Berg  * @civicloc: Measurement Report element content, starting with Measurement
118330db641eSJohannes Berg  *	Token (measurement type 11)
118481e54d08SPradeep Kumar Chitrapu  * @lci_len: LCI data length
118581e54d08SPradeep Kumar Chitrapu  * @civicloc_len: Civic location data length
1186ed1b6cc7SJohannes Berg  */
11878860020eSJohannes Berg struct cfg80211_beacon_data {
11888860020eSJohannes Berg 	const u8 *head, *tail;
11898860020eSJohannes Berg 	const u8 *beacon_ies;
11908860020eSJohannes Berg 	const u8 *proberesp_ies;
11918860020eSJohannes Berg 	const u8 *assocresp_ies;
11928860020eSJohannes Berg 	const u8 *probe_resp;
119381e54d08SPradeep Kumar Chitrapu 	const u8 *lci;
119481e54d08SPradeep Kumar Chitrapu 	const u8 *civicloc;
1195dc1e3cb8SJohn Crispin 	struct cfg80211_mbssid_elems *mbssid_ies;
119681e54d08SPradeep Kumar Chitrapu 	s8 ftm_responder;
11978860020eSJohannes Berg 
11988860020eSJohannes Berg 	size_t head_len, tail_len;
11998860020eSJohannes Berg 	size_t beacon_ies_len;
12008860020eSJohannes Berg 	size_t proberesp_ies_len;
12018860020eSJohannes Berg 	size_t assocresp_ies_len;
12028860020eSJohannes Berg 	size_t probe_resp_len;
120381e54d08SPradeep Kumar Chitrapu 	size_t lci_len;
120481e54d08SPradeep Kumar Chitrapu 	size_t civicloc_len;
12058860020eSJohannes Berg };
12068860020eSJohannes Berg 
12076d45a74bSVasanthakumar Thiagarajan struct mac_address {
12086d45a74bSVasanthakumar Thiagarajan 	u8 addr[ETH_ALEN];
12096d45a74bSVasanthakumar Thiagarajan };
12106d45a74bSVasanthakumar Thiagarajan 
12118860020eSJohannes Berg /**
121277765eafSVasanthakumar Thiagarajan  * struct cfg80211_acl_data - Access control list data
121377765eafSVasanthakumar Thiagarajan  *
121477765eafSVasanthakumar Thiagarajan  * @acl_policy: ACL policy to be applied on the station's
1215077f897aSJohannes Berg  *	entry specified by mac_addr
121677765eafSVasanthakumar Thiagarajan  * @n_acl_entries: Number of MAC address entries passed
121777765eafSVasanthakumar Thiagarajan  * @mac_addrs: List of MAC addresses of stations to be used for ACL
121877765eafSVasanthakumar Thiagarajan  */
121977765eafSVasanthakumar Thiagarajan struct cfg80211_acl_data {
122077765eafSVasanthakumar Thiagarajan 	enum nl80211_acl_policy acl_policy;
122177765eafSVasanthakumar Thiagarajan 	int n_acl_entries;
122277765eafSVasanthakumar Thiagarajan 
122377765eafSVasanthakumar Thiagarajan 	/* Keep it last */
122477765eafSVasanthakumar Thiagarajan 	struct mac_address mac_addrs[];
122577765eafSVasanthakumar Thiagarajan };
122677765eafSVasanthakumar Thiagarajan 
12278860020eSJohannes Berg /**
1228291c49deSAloka Dixit  * struct cfg80211_fils_discovery - FILS discovery parameters from
1229291c49deSAloka Dixit  * IEEE Std 802.11ai-2016, Annex C.3 MIB detail.
1230291c49deSAloka Dixit  *
1231291c49deSAloka Dixit  * @min_interval: Minimum packet interval in TUs (0 - 10000)
1232291c49deSAloka Dixit  * @max_interval: Maximum packet interval in TUs (0 - 10000)
1233291c49deSAloka Dixit  * @tmpl_len: Template length
1234291c49deSAloka Dixit  * @tmpl: Template data for FILS discovery frame including the action
1235291c49deSAloka Dixit  *	frame headers.
1236291c49deSAloka Dixit  */
1237291c49deSAloka Dixit struct cfg80211_fils_discovery {
1238291c49deSAloka Dixit 	u32 min_interval;
1239291c49deSAloka Dixit 	u32 max_interval;
1240291c49deSAloka Dixit 	size_t tmpl_len;
1241291c49deSAloka Dixit 	const u8 *tmpl;
1242291c49deSAloka Dixit };
1243291c49deSAloka Dixit 
1244291c49deSAloka Dixit /**
12457443dcd1SAloka Dixit  * struct cfg80211_unsol_bcast_probe_resp - Unsolicited broadcast probe
12467443dcd1SAloka Dixit  *	response parameters in 6GHz.
12477443dcd1SAloka Dixit  *
12487443dcd1SAloka Dixit  * @interval: Packet interval in TUs. Maximum allowed is 20 TU, as mentioned
12497443dcd1SAloka Dixit  *	in IEEE P802.11ax/D6.0 26.17.2.3.2 - AP behavior for fast passive
12507443dcd1SAloka Dixit  *	scanning
12517443dcd1SAloka Dixit  * @tmpl_len: Template length
12527443dcd1SAloka Dixit  * @tmpl: Template data for probe response
12537443dcd1SAloka Dixit  */
12547443dcd1SAloka Dixit struct cfg80211_unsol_bcast_probe_resp {
12557443dcd1SAloka Dixit 	u32 interval;
12567443dcd1SAloka Dixit 	size_t tmpl_len;
12577443dcd1SAloka Dixit 	const u8 *tmpl;
12587443dcd1SAloka Dixit };
12597443dcd1SAloka Dixit 
12607443dcd1SAloka Dixit /**
12618860020eSJohannes Berg  * struct cfg80211_ap_settings - AP configuration
12628860020eSJohannes Berg  *
12638860020eSJohannes Berg  * Used to configure an AP interface.
12648860020eSJohannes Berg  *
1265683b6d3bSJohannes Berg  * @chandef: defines the channel to use
12668860020eSJohannes Berg  * @beacon: beacon data
12678860020eSJohannes Berg  * @beacon_interval: beacon interval
12688860020eSJohannes Berg  * @dtim_period: DTIM period
12698860020eSJohannes Berg  * @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from
12708860020eSJohannes Berg  *	user space)
12718860020eSJohannes Berg  * @ssid_len: length of @ssid
12728860020eSJohannes Berg  * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames
12738860020eSJohannes Berg  * @crypto: crypto settings
12748860020eSJohannes Berg  * @privacy: the BSS uses privacy
12758860020eSJohannes Berg  * @auth_type: Authentication type (algorithm)
127618998c38SEliad Peller  * @smps_mode: SMPS mode
12771b658f11SVasanthakumar Thiagarajan  * @inactivity_timeout: time in seconds to determine station's inactivity.
127853cabad7SJohannes Berg  * @p2p_ctwindow: P2P CT Window
127953cabad7SJohannes Berg  * @p2p_opp_ps: P2P opportunistic PS
128077765eafSVasanthakumar Thiagarajan  * @acl: ACL configuration used by the drivers which has support for
128177765eafSVasanthakumar Thiagarajan  *	MAC address based access control
128234d50519SLior David  * @pbss: If set, start as a PCP instead of AP. Relevant for DMG
128334d50519SLior David  *	networks.
12848564e382SJohannes Berg  * @beacon_rate: bitrate to be used for beacons
128566cd794eSJohannes Berg  * @ht_cap: HT capabilities (or %NULL if HT isn't enabled)
128666cd794eSJohannes Berg  * @vht_cap: VHT capabilities (or %NULL if VHT isn't enabled)
1287244eb9aeSShaul Triebitz  * @he_cap: HE capabilities (or %NULL if HE isn't enabled)
128866cd794eSJohannes Berg  * @ht_required: stations must support HT
128966cd794eSJohannes Berg  * @vht_required: stations must support VHT
1290a0de1ca3SJohn Crispin  * @twt_responder: Enable Target Wait Time
12912a392596SIlan Peer  * @he_required: stations must support HE
1292d6587602SIlan Peer  * @sae_h2e_required: stations must support direct H2E technique in SAE
1293fe494370SSrinivas Dasari  * @flags: flags, as defined in enum cfg80211_ap_settings_flags
1294796e90f4SJohn Crispin  * @he_obss_pd: OBSS Packet Detection settings
12955c5e52d1SJohn Crispin  * @he_bss_color: BSS Color settings
12967e8d6f12SShaul Triebitz  * @he_oper: HE operation IE (or %NULL if HE isn't enabled)
1297291c49deSAloka Dixit  * @fils_discovery: FILS discovery transmission parameters
12987443dcd1SAloka Dixit  * @unsol_bcast_probe_resp: Unsolicited broadcast probe response parameters
1299dc1e3cb8SJohn Crispin  * @mbssid_config: AP settings for multiple bssid
13008860020eSJohannes Berg  */
13018860020eSJohannes Berg struct cfg80211_ap_settings {
1302683b6d3bSJohannes Berg 	struct cfg80211_chan_def chandef;
1303aa430da4SJohannes Berg 
13048860020eSJohannes Berg 	struct cfg80211_beacon_data beacon;
13058860020eSJohannes Berg 
13068860020eSJohannes Berg 	int beacon_interval, dtim_period;
130732e9de84SJouni Malinen 	const u8 *ssid;
130832e9de84SJouni Malinen 	size_t ssid_len;
130932e9de84SJouni Malinen 	enum nl80211_hidden_ssid hidden_ssid;
13105fb628e9SJouni Malinen 	struct cfg80211_crypto_settings crypto;
13115fb628e9SJouni Malinen 	bool privacy;
13125fb628e9SJouni Malinen 	enum nl80211_auth_type auth_type;
131318998c38SEliad Peller 	enum nl80211_smps_mode smps_mode;
13141b658f11SVasanthakumar Thiagarajan 	int inactivity_timeout;
131553cabad7SJohannes Berg 	u8 p2p_ctwindow;
131653cabad7SJohannes Berg 	bool p2p_opp_ps;
131777765eafSVasanthakumar Thiagarajan 	const struct cfg80211_acl_data *acl;
131834d50519SLior David 	bool pbss;
1319a7c7fbffSPurushottam Kushwaha 	struct cfg80211_bitrate_mask beacon_rate;
132066cd794eSJohannes Berg 
132166cd794eSJohannes Berg 	const struct ieee80211_ht_cap *ht_cap;
132266cd794eSJohannes Berg 	const struct ieee80211_vht_cap *vht_cap;
1323244eb9aeSShaul Triebitz 	const struct ieee80211_he_cap_elem *he_cap;
13247e8d6f12SShaul Triebitz 	const struct ieee80211_he_operation *he_oper;
1325d6587602SIlan Peer 	bool ht_required, vht_required, he_required, sae_h2e_required;
1326a0de1ca3SJohn Crispin 	bool twt_responder;
1327fe494370SSrinivas Dasari 	u32 flags;
1328796e90f4SJohn Crispin 	struct ieee80211_he_obss_pd he_obss_pd;
13295c5e52d1SJohn Crispin 	struct cfg80211_he_bss_color he_bss_color;
1330291c49deSAloka Dixit 	struct cfg80211_fils_discovery fils_discovery;
13317443dcd1SAloka Dixit 	struct cfg80211_unsol_bcast_probe_resp unsol_bcast_probe_resp;
1332dc1e3cb8SJohn Crispin 	struct cfg80211_mbssid_config mbssid_config;
1333ed1b6cc7SJohannes Berg };
1334ed1b6cc7SJohannes Berg 
13355727ef1bSJohannes Berg /**
133616ef1fe2SSimon Wunderlich  * struct cfg80211_csa_settings - channel switch settings
133716ef1fe2SSimon Wunderlich  *
133816ef1fe2SSimon Wunderlich  * Used for channel switch
133916ef1fe2SSimon Wunderlich  *
134016ef1fe2SSimon Wunderlich  * @chandef: defines the channel to use after the switch
134116ef1fe2SSimon Wunderlich  * @beacon_csa: beacon data while performing the switch
13429a774c78SAndrei Otcheretianski  * @counter_offsets_beacon: offsets of the counters within the beacon (tail)
13439a774c78SAndrei Otcheretianski  * @counter_offsets_presp: offsets of the counters within the probe response
13449a774c78SAndrei Otcheretianski  * @n_counter_offsets_beacon: number of csa counters the beacon (tail)
13459a774c78SAndrei Otcheretianski  * @n_counter_offsets_presp: number of csa counters in the probe response
134616ef1fe2SSimon Wunderlich  * @beacon_after: beacon data to be used on the new channel
134716ef1fe2SSimon Wunderlich  * @radar_required: whether radar detection is required on the new channel
134816ef1fe2SSimon Wunderlich  * @block_tx: whether transmissions should be blocked while changing
134916ef1fe2SSimon Wunderlich  * @count: number of beacons until switch
135016ef1fe2SSimon Wunderlich  */
135116ef1fe2SSimon Wunderlich struct cfg80211_csa_settings {
135216ef1fe2SSimon Wunderlich 	struct cfg80211_chan_def chandef;
135316ef1fe2SSimon Wunderlich 	struct cfg80211_beacon_data beacon_csa;
13549a774c78SAndrei Otcheretianski 	const u16 *counter_offsets_beacon;
13559a774c78SAndrei Otcheretianski 	const u16 *counter_offsets_presp;
13569a774c78SAndrei Otcheretianski 	unsigned int n_counter_offsets_beacon;
13579a774c78SAndrei Otcheretianski 	unsigned int n_counter_offsets_presp;
135816ef1fe2SSimon Wunderlich 	struct cfg80211_beacon_data beacon_after;
135916ef1fe2SSimon Wunderlich 	bool radar_required;
136016ef1fe2SSimon Wunderlich 	bool block_tx;
136116ef1fe2SSimon Wunderlich 	u8 count;
136216ef1fe2SSimon Wunderlich };
136316ef1fe2SSimon Wunderlich 
136416ef1fe2SSimon Wunderlich /**
13650d2ab3aeSJohn Crispin  * struct cfg80211_color_change_settings - color change settings
13660d2ab3aeSJohn Crispin  *
13670d2ab3aeSJohn Crispin  * Used for bss color change
13680d2ab3aeSJohn Crispin  *
13690d2ab3aeSJohn Crispin  * @beacon_color_change: beacon data while performing the color countdown
13700d2ab3aeSJohn Crispin  * @counter_offsets_beacon: offsets of the counters within the beacon (tail)
13710d2ab3aeSJohn Crispin  * @counter_offsets_presp: offsets of the counters within the probe response
13720d2ab3aeSJohn Crispin  * @beacon_next: beacon data to be used after the color change
13730d2ab3aeSJohn Crispin  * @count: number of beacons until the color change
13740d2ab3aeSJohn Crispin  * @color: the color used after the change
13750d2ab3aeSJohn Crispin  */
13760d2ab3aeSJohn Crispin struct cfg80211_color_change_settings {
13770d2ab3aeSJohn Crispin 	struct cfg80211_beacon_data beacon_color_change;
13780d2ab3aeSJohn Crispin 	u16 counter_offset_beacon;
13790d2ab3aeSJohn Crispin 	u16 counter_offset_presp;
13800d2ab3aeSJohn Crispin 	struct cfg80211_beacon_data beacon_next;
13810d2ab3aeSJohn Crispin 	u8 count;
13820d2ab3aeSJohn Crispin 	u8 color;
13830d2ab3aeSJohn Crispin };
13840d2ab3aeSJohn Crispin 
13850d2ab3aeSJohn Crispin /**
1386e227300cSPurushottam Kushwaha  * struct iface_combination_params - input parameters for interface combinations
1387e227300cSPurushottam Kushwaha  *
1388e227300cSPurushottam Kushwaha  * Used to pass interface combination parameters
1389e227300cSPurushottam Kushwaha  *
1390e227300cSPurushottam Kushwaha  * @num_different_channels: the number of different channels we want
1391e227300cSPurushottam Kushwaha  *	to use for verification
1392e227300cSPurushottam Kushwaha  * @radar_detect: a bitmap where each bit corresponds to a channel
1393e227300cSPurushottam Kushwaha  *	width where radar detection is needed, as in the definition of
1394e227300cSPurushottam Kushwaha  *	&struct ieee80211_iface_combination.@radar_detect_widths
1395e227300cSPurushottam Kushwaha  * @iftype_num: array with the number of interfaces of each interface
1396e227300cSPurushottam Kushwaha  *	type.  The index is the interface type as specified in &enum
1397e227300cSPurushottam Kushwaha  *	nl80211_iftype.
13984c8dea63SJohannes Berg  * @new_beacon_int: set this to the beacon interval of a new interface
13994c8dea63SJohannes Berg  *	that's not operating yet, if such is to be checked as part of
14004c8dea63SJohannes Berg  *	the verification
1401e227300cSPurushottam Kushwaha  */
1402e227300cSPurushottam Kushwaha struct iface_combination_params {
1403e227300cSPurushottam Kushwaha 	int num_different_channels;
1404e227300cSPurushottam Kushwaha 	u8 radar_detect;
1405e227300cSPurushottam Kushwaha 	int iftype_num[NUM_NL80211_IFTYPES];
14064c8dea63SJohannes Berg 	u32 new_beacon_int;
1407e227300cSPurushottam Kushwaha };
1408e227300cSPurushottam Kushwaha 
1409e227300cSPurushottam Kushwaha /**
14103b9ce80cSJohannes Berg  * enum station_parameters_apply_mask - station parameter values to apply
14113b9ce80cSJohannes Berg  * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp)
14129d62a986SJouni Malinen  * @STATION_PARAM_APPLY_CAPABILITY: apply new capability
1413f8bacc21SJohannes Berg  * @STATION_PARAM_APPLY_PLINK_STATE: apply new plink state
14143b9ce80cSJohannes Berg  *
14153b9ce80cSJohannes Berg  * Not all station parameters have in-band "no change" signalling,
14163b9ce80cSJohannes Berg  * for those that don't these flags will are used.
14173b9ce80cSJohannes Berg  */
14183b9ce80cSJohannes Berg enum station_parameters_apply_mask {
14193b9ce80cSJohannes Berg 	STATION_PARAM_APPLY_UAPSD = BIT(0),
14209d62a986SJouni Malinen 	STATION_PARAM_APPLY_CAPABILITY = BIT(1),
1421f8bacc21SJohannes Berg 	STATION_PARAM_APPLY_PLINK_STATE = BIT(2),
1422e96d1cd2SAshok Raj Nagarajan 	STATION_PARAM_APPLY_STA_TXPOWER = BIT(3),
1423e96d1cd2SAshok Raj Nagarajan };
1424e96d1cd2SAshok Raj Nagarajan 
1425e96d1cd2SAshok Raj Nagarajan /**
1426e96d1cd2SAshok Raj Nagarajan  * struct sta_txpwr - station txpower configuration
1427e96d1cd2SAshok Raj Nagarajan  *
1428e96d1cd2SAshok Raj Nagarajan  * Used to configure txpower for station.
1429e96d1cd2SAshok Raj Nagarajan  *
1430e96d1cd2SAshok Raj Nagarajan  * @power: tx power (in dBm) to be used for sending data traffic. If tx power
1431e96d1cd2SAshok Raj Nagarajan  *	is not provided, the default per-interface tx power setting will be
1432e96d1cd2SAshok Raj Nagarajan  *	overriding. Driver should be picking up the lowest tx power, either tx
1433e96d1cd2SAshok Raj Nagarajan  *	power per-interface or per-station.
1434e96d1cd2SAshok Raj Nagarajan  * @type: In particular if TPC %type is NL80211_TX_POWER_LIMITED then tx power
1435e96d1cd2SAshok Raj Nagarajan  *	will be less than or equal to specified from userspace, whereas if TPC
1436e96d1cd2SAshok Raj Nagarajan  *	%type is NL80211_TX_POWER_AUTOMATIC then it indicates default tx power.
1437e96d1cd2SAshok Raj Nagarajan  *	NL80211_TX_POWER_FIXED is not a valid configuration option for
1438e96d1cd2SAshok Raj Nagarajan  *	per peer TPC.
1439e96d1cd2SAshok Raj Nagarajan  */
1440e96d1cd2SAshok Raj Nagarajan struct sta_txpwr {
1441e96d1cd2SAshok Raj Nagarajan 	s16 power;
1442e96d1cd2SAshok Raj Nagarajan 	enum nl80211_tx_power_setting type;
14433b9ce80cSJohannes Berg };
14443b9ce80cSJohannes Berg 
14453b9ce80cSJohannes Berg /**
14465727ef1bSJohannes Berg  * struct station_parameters - station parameters
14475727ef1bSJohannes Berg  *
14485727ef1bSJohannes Berg  * Used to change and create a new station.
14495727ef1bSJohannes Berg  *
14505727ef1bSJohannes Berg  * @vlan: vlan interface station should belong to
14515727ef1bSJohannes Berg  * @supported_rates: supported rates in IEEE 802.11 format
14525727ef1bSJohannes Berg  *	(or NULL for no change)
14535727ef1bSJohannes Berg  * @supported_rates_len: number of supported rates
1454eccb8e8fSJohannes Berg  * @sta_flags_mask: station flags that changed
1455819bf593SJohannes Berg  *	(bitmask of BIT(%NL80211_STA_FLAG_...))
1456eccb8e8fSJohannes Berg  * @sta_flags_set: station flags values
1457819bf593SJohannes Berg  *	(bitmask of BIT(%NL80211_STA_FLAG_...))
14585727ef1bSJohannes Berg  * @listen_interval: listen interval or -1 for no change
14595727ef1bSJohannes Berg  * @aid: AID or zero for no change
146014f34e36SGurumoorthi Gnanasambandhan  * @vlan_id: VLAN ID for station (if nonzero)
14617d27a0baSMasashi Honma  * @peer_aid: mesh peer AID or zero for no change
1462abe37c4bSJohannes Berg  * @plink_action: plink action to take
14639c3990aaSJavier Cardona  * @plink_state: set the peer link state for a station
1464abe37c4bSJohannes Berg  * @ht_capa: HT capabilities of station
1465f461be3eSMahesh Palivela  * @vht_capa: VHT capabilities of station
1466910868dbSEliad Peller  * @uapsd_queues: bitmap of queues configured for uapsd. same format
1467910868dbSEliad Peller  *	as the AC bitmap in the QoS info field
1468910868dbSEliad Peller  * @max_sp: max Service Period. same format as the MAX_SP in the
1469910868dbSEliad Peller  *	QoS info field (but already shifted down)
1470c26887d2SJohannes Berg  * @sta_modify_mask: bitmap indicating which parameters changed
1471c26887d2SJohannes Berg  *	(for those that don't have a natural "no change" value),
1472c26887d2SJohannes Berg  *	see &enum station_parameters_apply_mask
14733b1c5a53SMarco Porsch  * @local_pm: local link-specific mesh power save mode (no change when set
14743b1c5a53SMarco Porsch  *	to unknown)
14759d62a986SJouni Malinen  * @capability: station capability
14769d62a986SJouni Malinen  * @ext_capab: extended capabilities of the station
14779d62a986SJouni Malinen  * @ext_capab_len: number of extended capabilities
1478c01fc9adSSunil Dutt  * @supported_channels: supported channels in IEEE 802.11 format
1479c01fc9adSSunil Dutt  * @supported_channels_len: number of supported channels
1480c01fc9adSSunil Dutt  * @supported_oper_classes: supported oper classes in IEEE 802.11 format
1481c01fc9adSSunil Dutt  * @supported_oper_classes_len: number of supported operating classes
148260f4a7b1SMarek Kwaczynski  * @opmode_notif: operating mode field from Operating Mode Notification
148360f4a7b1SMarek Kwaczynski  * @opmode_notif_used: information if operating mode field is used
148417b94247SAyala Beker  * @support_p2p_ps: information if station supports P2P PS mechanism
1485c4cbaf79SLuca Coelho  * @he_capa: HE capabilities of station
1486c4cbaf79SLuca Coelho  * @he_capa_len: the length of the HE capabilities
148736647055SToke Høiland-Jørgensen  * @airtime_weight: airtime scheduler weight for this station
1488a710d214SLothar Rubusch  * @txpwr: transmit power for an associated station
148943e64bf3SRajkumar Manoharan  * @he_6ghz_capa: HE 6 GHz Band capabilities of station
1490*ea05fd35SIlan Peer  * @eht_capa: EHT capabilities of station
1491*ea05fd35SIlan Peer  * @eht_capa_len: the length of the EHT capabilities
14925727ef1bSJohannes Berg  */
14935727ef1bSJohannes Berg struct station_parameters {
14942c1aabf3SJohannes Berg 	const u8 *supported_rates;
14955727ef1bSJohannes Berg 	struct net_device *vlan;
1496eccb8e8fSJohannes Berg 	u32 sta_flags_mask, sta_flags_set;
14973b9ce80cSJohannes Berg 	u32 sta_modify_mask;
14985727ef1bSJohannes Berg 	int listen_interval;
14995727ef1bSJohannes Berg 	u16 aid;
150014f34e36SGurumoorthi Gnanasambandhan 	u16 vlan_id;
15017d27a0baSMasashi Honma 	u16 peer_aid;
15025727ef1bSJohannes Berg 	u8 supported_rates_len;
15032ec600d6SLuis Carlos Cobo 	u8 plink_action;
15049c3990aaSJavier Cardona 	u8 plink_state;
15052c1aabf3SJohannes Berg 	const struct ieee80211_ht_cap *ht_capa;
15062c1aabf3SJohannes Berg 	const struct ieee80211_vht_cap *vht_capa;
1507c75786c9SEliad Peller 	u8 uapsd_queues;
1508c75786c9SEliad Peller 	u8 max_sp;
15093b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode local_pm;
15109d62a986SJouni Malinen 	u16 capability;
15112c1aabf3SJohannes Berg 	const u8 *ext_capab;
15129d62a986SJouni Malinen 	u8 ext_capab_len;
1513c01fc9adSSunil Dutt 	const u8 *supported_channels;
1514c01fc9adSSunil Dutt 	u8 supported_channels_len;
1515c01fc9adSSunil Dutt 	const u8 *supported_oper_classes;
1516c01fc9adSSunil Dutt 	u8 supported_oper_classes_len;
151760f4a7b1SMarek Kwaczynski 	u8 opmode_notif;
151860f4a7b1SMarek Kwaczynski 	bool opmode_notif_used;
151917b94247SAyala Beker 	int support_p2p_ps;
1520c4cbaf79SLuca Coelho 	const struct ieee80211_he_cap_elem *he_capa;
1521c4cbaf79SLuca Coelho 	u8 he_capa_len;
152236647055SToke Høiland-Jørgensen 	u16 airtime_weight;
1523e96d1cd2SAshok Raj Nagarajan 	struct sta_txpwr txpwr;
152443e64bf3SRajkumar Manoharan 	const struct ieee80211_he_6ghz_capa *he_6ghz_capa;
1525*ea05fd35SIlan Peer 	const struct ieee80211_eht_cap_elem *eht_capa;
1526*ea05fd35SIlan Peer 	u8 eht_capa_len;
15275727ef1bSJohannes Berg };
15285727ef1bSJohannes Berg 
1529fd5b74dcSJohannes Berg /**
153089c771e5SJouni Malinen  * struct station_del_parameters - station deletion parameters
153189c771e5SJouni Malinen  *
153289c771e5SJouni Malinen  * Used to delete a station entry (or all stations).
153389c771e5SJouni Malinen  *
153489c771e5SJouni Malinen  * @mac: MAC address of the station to remove or NULL to remove all stations
153598856866SJouni Malinen  * @subtype: Management frame subtype to use for indicating removal
153698856866SJouni Malinen  *	(10 = Disassociation, 12 = Deauthentication)
153798856866SJouni Malinen  * @reason_code: Reason code for the Disassociation/Deauthentication frame
153889c771e5SJouni Malinen  */
153989c771e5SJouni Malinen struct station_del_parameters {
154089c771e5SJouni Malinen 	const u8 *mac;
154198856866SJouni Malinen 	u8 subtype;
154298856866SJouni Malinen 	u16 reason_code;
154389c771e5SJouni Malinen };
154489c771e5SJouni Malinen 
154589c771e5SJouni Malinen /**
154677ee7c89SJohannes Berg  * enum cfg80211_station_type - the type of station being modified
154777ee7c89SJohannes Berg  * @CFG80211_STA_AP_CLIENT: client of an AP interface
154847edb11bSAyala Beker  * @CFG80211_STA_AP_CLIENT_UNASSOC: client of an AP interface that is still
154947edb11bSAyala Beker  *	unassociated (update properties for this type of client is permitted)
155077ee7c89SJohannes Berg  * @CFG80211_STA_AP_MLME_CLIENT: client of an AP interface that has
155177ee7c89SJohannes Berg  *	the AP MLME in the device
155277ee7c89SJohannes Berg  * @CFG80211_STA_AP_STA: AP station on managed interface
155377ee7c89SJohannes Berg  * @CFG80211_STA_IBSS: IBSS station
155477ee7c89SJohannes Berg  * @CFG80211_STA_TDLS_PEER_SETUP: TDLS peer on managed interface (dummy entry
155577ee7c89SJohannes Berg  *	while TDLS setup is in progress, it moves out of this state when
155677ee7c89SJohannes Berg  *	being marked authorized; use this only if TDLS with external setup is
155777ee7c89SJohannes Berg  *	supported/used)
155877ee7c89SJohannes Berg  * @CFG80211_STA_TDLS_PEER_ACTIVE: TDLS peer on managed interface (active
155977ee7c89SJohannes Berg  *	entry that is operating, has been marked authorized by userspace)
1560eef941e6SThomas Pedersen  * @CFG80211_STA_MESH_PEER_KERNEL: peer on mesh interface (kernel managed)
1561eef941e6SThomas Pedersen  * @CFG80211_STA_MESH_PEER_USER: peer on mesh interface (user managed)
156277ee7c89SJohannes Berg  */
156377ee7c89SJohannes Berg enum cfg80211_station_type {
156477ee7c89SJohannes Berg 	CFG80211_STA_AP_CLIENT,
156547edb11bSAyala Beker 	CFG80211_STA_AP_CLIENT_UNASSOC,
156677ee7c89SJohannes Berg 	CFG80211_STA_AP_MLME_CLIENT,
156777ee7c89SJohannes Berg 	CFG80211_STA_AP_STA,
156877ee7c89SJohannes Berg 	CFG80211_STA_IBSS,
156977ee7c89SJohannes Berg 	CFG80211_STA_TDLS_PEER_SETUP,
157077ee7c89SJohannes Berg 	CFG80211_STA_TDLS_PEER_ACTIVE,
1571eef941e6SThomas Pedersen 	CFG80211_STA_MESH_PEER_KERNEL,
1572eef941e6SThomas Pedersen 	CFG80211_STA_MESH_PEER_USER,
157377ee7c89SJohannes Berg };
157477ee7c89SJohannes Berg 
157577ee7c89SJohannes Berg /**
157677ee7c89SJohannes Berg  * cfg80211_check_station_change - validate parameter changes
157777ee7c89SJohannes Berg  * @wiphy: the wiphy this operates on
157877ee7c89SJohannes Berg  * @params: the new parameters for a station
157977ee7c89SJohannes Berg  * @statype: the type of station being modified
158077ee7c89SJohannes Berg  *
158177ee7c89SJohannes Berg  * Utility function for the @change_station driver method. Call this function
158277ee7c89SJohannes Berg  * with the appropriate station type looking up the station (and checking that
158377ee7c89SJohannes Berg  * it exists). It will verify whether the station change is acceptable, and if
158477ee7c89SJohannes Berg  * not will return an error code. Note that it may modify the parameters for
158577ee7c89SJohannes Berg  * backward compatibility reasons, so don't use them before calling this.
158677ee7c89SJohannes Berg  */
158777ee7c89SJohannes Berg int cfg80211_check_station_change(struct wiphy *wiphy,
158877ee7c89SJohannes Berg 				  struct station_parameters *params,
158977ee7c89SJohannes Berg 				  enum cfg80211_station_type statype);
159077ee7c89SJohannes Berg 
159177ee7c89SJohannes Berg /**
1592b1e8eb11SMauro Carvalho Chehab  * enum rate_info_flags - bitrate info flags
1593420e7fabSHenning Rogge  *
1594420e7fabSHenning Rogge  * Used by the driver to indicate the specific rate transmission
1595420e7fabSHenning Rogge  * type for 802.11n transmissions.
1596420e7fabSHenning Rogge  *
1597db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_MCS: mcs field filled with HT MCS
1598db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_VHT_MCS: mcs field filled with VHT MCS
1599420e7fabSHenning Rogge  * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval
16002a38075cSAlexei Avshalom Lazar  * @RATE_INFO_FLAGS_DMG: 60GHz MCS
1601c4cbaf79SLuca Coelho  * @RATE_INFO_FLAGS_HE_MCS: HE MCS information
16022a38075cSAlexei Avshalom Lazar  * @RATE_INFO_FLAGS_EDMG: 60GHz MCS in EDMG mode
1603d9c85e24SMax Chen  * @RATE_INFO_FLAGS_EXTENDED_SC_DMG: 60GHz extended SC MCS
1604cfb14110SVeerendranath Jakkam  * @RATE_INFO_FLAGS_EHT_MCS: EHT MCS information
1605420e7fabSHenning Rogge  */
1606420e7fabSHenning Rogge enum rate_info_flags {
1607db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_MCS			= BIT(0),
1608db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_VHT_MCS			= BIT(1),
1609b51f3beeSJohannes Berg 	RATE_INFO_FLAGS_SHORT_GI		= BIT(2),
16102a38075cSAlexei Avshalom Lazar 	RATE_INFO_FLAGS_DMG			= BIT(3),
1611c4cbaf79SLuca Coelho 	RATE_INFO_FLAGS_HE_MCS			= BIT(4),
16122a38075cSAlexei Avshalom Lazar 	RATE_INFO_FLAGS_EDMG			= BIT(5),
1613d9c85e24SMax Chen 	RATE_INFO_FLAGS_EXTENDED_SC_DMG		= BIT(6),
1614cfb14110SVeerendranath Jakkam 	RATE_INFO_FLAGS_EHT_MCS			= BIT(7),
1615b51f3beeSJohannes Berg };
1616b51f3beeSJohannes Berg 
1617b51f3beeSJohannes Berg /**
1618b51f3beeSJohannes Berg  * enum rate_info_bw - rate bandwidth information
1619b51f3beeSJohannes Berg  *
1620b51f3beeSJohannes Berg  * Used by the driver to indicate the rate bandwidth.
1621b51f3beeSJohannes Berg  *
1622b51f3beeSJohannes Berg  * @RATE_INFO_BW_5: 5 MHz bandwidth
1623b51f3beeSJohannes Berg  * @RATE_INFO_BW_10: 10 MHz bandwidth
1624b51f3beeSJohannes Berg  * @RATE_INFO_BW_20: 20 MHz bandwidth
1625b51f3beeSJohannes Berg  * @RATE_INFO_BW_40: 40 MHz bandwidth
1626b51f3beeSJohannes Berg  * @RATE_INFO_BW_80: 80 MHz bandwidth
1627b51f3beeSJohannes Berg  * @RATE_INFO_BW_160: 160 MHz bandwidth
1628c4cbaf79SLuca Coelho  * @RATE_INFO_BW_HE_RU: bandwidth determined by HE RU allocation
1629cfb14110SVeerendranath Jakkam  * @RATE_INFO_BW_320: 320 MHz bandwidth
1630cfb14110SVeerendranath Jakkam  * @RATE_INFO_BW_EHT_RU: bandwidth determined by EHT RU allocation
1631b51f3beeSJohannes Berg  */
1632b51f3beeSJohannes Berg enum rate_info_bw {
1633842be75cSJohannes Berg 	RATE_INFO_BW_20 = 0,
1634b51f3beeSJohannes Berg 	RATE_INFO_BW_5,
1635b51f3beeSJohannes Berg 	RATE_INFO_BW_10,
1636b51f3beeSJohannes Berg 	RATE_INFO_BW_40,
1637b51f3beeSJohannes Berg 	RATE_INFO_BW_80,
1638b51f3beeSJohannes Berg 	RATE_INFO_BW_160,
1639c4cbaf79SLuca Coelho 	RATE_INFO_BW_HE_RU,
1640cfb14110SVeerendranath Jakkam 	RATE_INFO_BW_320,
1641cfb14110SVeerendranath Jakkam 	RATE_INFO_BW_EHT_RU,
1642420e7fabSHenning Rogge };
1643420e7fabSHenning Rogge 
1644420e7fabSHenning Rogge /**
1645420e7fabSHenning Rogge  * struct rate_info - bitrate information
1646420e7fabSHenning Rogge  *
1647420e7fabSHenning Rogge  * Information about a receiving or transmitting bitrate
1648420e7fabSHenning Rogge  *
1649420e7fabSHenning Rogge  * @flags: bitflag of flags from &enum rate_info_flags
1650c4cbaf79SLuca Coelho  * @mcs: mcs index if struct describes an HT/VHT/HE rate
1651420e7fabSHenning Rogge  * @legacy: bitrate in 100kbit/s for 802.11abg
1652c4cbaf79SLuca Coelho  * @nss: number of streams (VHT & HE only)
1653b51f3beeSJohannes Berg  * @bw: bandwidth (from &enum rate_info_bw)
1654c4cbaf79SLuca Coelho  * @he_gi: HE guard interval (from &enum nl80211_he_gi)
1655c4cbaf79SLuca Coelho  * @he_dcm: HE DCM value
1656c4cbaf79SLuca Coelho  * @he_ru_alloc: HE RU allocation (from &enum nl80211_he_ru_alloc,
1657c4cbaf79SLuca Coelho  *	only valid if bw is %RATE_INFO_BW_HE_RU)
16582a38075cSAlexei Avshalom Lazar  * @n_bonded_ch: In case of EDMG the number of bonded channels (1-4)
1659cfb14110SVeerendranath Jakkam  * @eht_gi: EHT guard interval (from &enum nl80211_eht_gi)
1660cfb14110SVeerendranath Jakkam  * @eht_ru_alloc: EHT RU allocation (from &enum nl80211_eht_ru_alloc,
1661cfb14110SVeerendranath Jakkam  *	only valid if bw is %RATE_INFO_BW_EHT_RU)
1662420e7fabSHenning Rogge  */
1663420e7fabSHenning Rogge struct rate_info {
1664420e7fabSHenning Rogge 	u8 flags;
1665420e7fabSHenning Rogge 	u8 mcs;
1666420e7fabSHenning Rogge 	u16 legacy;
1667db9c64cfSJohannes Berg 	u8 nss;
1668b51f3beeSJohannes Berg 	u8 bw;
1669c4cbaf79SLuca Coelho 	u8 he_gi;
1670c4cbaf79SLuca Coelho 	u8 he_dcm;
1671c4cbaf79SLuca Coelho 	u8 he_ru_alloc;
16722a38075cSAlexei Avshalom Lazar 	u8 n_bonded_ch;
1673cfb14110SVeerendranath Jakkam 	u8 eht_gi;
1674cfb14110SVeerendranath Jakkam 	u8 eht_ru_alloc;
1675fd5b74dcSJohannes Berg };
1676fd5b74dcSJohannes Berg 
1677fd5b74dcSJohannes Berg /**
1678b1e8eb11SMauro Carvalho Chehab  * enum bss_param_flags - bitrate info flags
1679f4263c98SPaul Stewart  *
1680f4263c98SPaul Stewart  * Used by the driver to indicate the specific rate transmission
1681f4263c98SPaul Stewart  * type for 802.11n transmissions.
1682f4263c98SPaul Stewart  *
1683f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_CTS_PROT: whether CTS protection is enabled
1684f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_SHORT_PREAMBLE: whether short preamble is enabled
1685f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_SHORT_SLOT_TIME: whether short slot time is enabled
1686f4263c98SPaul Stewart  */
1687f4263c98SPaul Stewart enum bss_param_flags {
1688f4263c98SPaul Stewart 	BSS_PARAM_FLAGS_CTS_PROT	= 1<<0,
1689f4263c98SPaul Stewart 	BSS_PARAM_FLAGS_SHORT_PREAMBLE	= 1<<1,
1690f4263c98SPaul Stewart 	BSS_PARAM_FLAGS_SHORT_SLOT_TIME	= 1<<2,
1691f4263c98SPaul Stewart };
1692f4263c98SPaul Stewart 
1693f4263c98SPaul Stewart /**
1694f4263c98SPaul Stewart  * struct sta_bss_parameters - BSS parameters for the attached station
1695f4263c98SPaul Stewart  *
1696f4263c98SPaul Stewart  * Information about the currently associated BSS
1697f4263c98SPaul Stewart  *
1698f4263c98SPaul Stewart  * @flags: bitflag of flags from &enum bss_param_flags
1699f4263c98SPaul Stewart  * @dtim_period: DTIM period for the BSS
1700f4263c98SPaul Stewart  * @beacon_interval: beacon interval
1701f4263c98SPaul Stewart  */
1702f4263c98SPaul Stewart struct sta_bss_parameters {
1703f4263c98SPaul Stewart 	u8 flags;
1704f4263c98SPaul Stewart 	u8 dtim_period;
1705f4263c98SPaul Stewart 	u16 beacon_interval;
1706f4263c98SPaul Stewart };
1707f4263c98SPaul Stewart 
17086de39808SJohannes Berg /**
170952539ca8SToke Høiland-Jørgensen  * struct cfg80211_txq_stats - TXQ statistics for this TID
171052539ca8SToke Høiland-Jørgensen  * @filled: bitmap of flags using the bits of &enum nl80211_txq_stats to
171152539ca8SToke Høiland-Jørgensen  *	indicate the relevant values in this struct are filled
171252539ca8SToke Høiland-Jørgensen  * @backlog_bytes: total number of bytes currently backlogged
171352539ca8SToke Høiland-Jørgensen  * @backlog_packets: total number of packets currently backlogged
171452539ca8SToke Høiland-Jørgensen  * @flows: number of new flows seen
171552539ca8SToke Høiland-Jørgensen  * @drops: total number of packets dropped
171652539ca8SToke Høiland-Jørgensen  * @ecn_marks: total number of packets marked with ECN CE
171752539ca8SToke Høiland-Jørgensen  * @overlimit: number of drops due to queue space overflow
171852539ca8SToke Høiland-Jørgensen  * @overmemory: number of drops due to memory limit overflow
171952539ca8SToke Høiland-Jørgensen  * @collisions: number of hash collisions
172052539ca8SToke Høiland-Jørgensen  * @tx_bytes: total number of bytes dequeued
172152539ca8SToke Høiland-Jørgensen  * @tx_packets: total number of packets dequeued
172252539ca8SToke Høiland-Jørgensen  * @max_flows: maximum number of flows supported
172352539ca8SToke Høiland-Jørgensen  */
172452539ca8SToke Høiland-Jørgensen struct cfg80211_txq_stats {
172552539ca8SToke Høiland-Jørgensen 	u32 filled;
172652539ca8SToke Høiland-Jørgensen 	u32 backlog_bytes;
172752539ca8SToke Høiland-Jørgensen 	u32 backlog_packets;
172852539ca8SToke Høiland-Jørgensen 	u32 flows;
172952539ca8SToke Høiland-Jørgensen 	u32 drops;
173052539ca8SToke Høiland-Jørgensen 	u32 ecn_marks;
173152539ca8SToke Høiland-Jørgensen 	u32 overlimit;
173252539ca8SToke Høiland-Jørgensen 	u32 overmemory;
173352539ca8SToke Høiland-Jørgensen 	u32 collisions;
173452539ca8SToke Høiland-Jørgensen 	u32 tx_bytes;
173552539ca8SToke Høiland-Jørgensen 	u32 tx_packets;
173652539ca8SToke Høiland-Jørgensen 	u32 max_flows;
173752539ca8SToke Høiland-Jørgensen };
173852539ca8SToke Høiland-Jørgensen 
173952539ca8SToke Høiland-Jørgensen /**
17406de39808SJohannes Berg  * struct cfg80211_tid_stats - per-TID statistics
17416de39808SJohannes Berg  * @filled: bitmap of flags using the bits of &enum nl80211_tid_stats to
17426de39808SJohannes Berg  *	indicate the relevant values in this struct are filled
17436de39808SJohannes Berg  * @rx_msdu: number of received MSDUs
17446de39808SJohannes Berg  * @tx_msdu: number of (attempted) transmitted MSDUs
17456de39808SJohannes Berg  * @tx_msdu_retries: number of retries (not counting the first) for
17466de39808SJohannes Berg  *	transmitted MSDUs
17476de39808SJohannes Berg  * @tx_msdu_failed: number of failed transmitted MSDUs
174852539ca8SToke Høiland-Jørgensen  * @txq_stats: TXQ statistics
17496de39808SJohannes Berg  */
17506de39808SJohannes Berg struct cfg80211_tid_stats {
17516de39808SJohannes Berg 	u32 filled;
17526de39808SJohannes Berg 	u64 rx_msdu;
17536de39808SJohannes Berg 	u64 tx_msdu;
17546de39808SJohannes Berg 	u64 tx_msdu_retries;
17556de39808SJohannes Berg 	u64 tx_msdu_failed;
175652539ca8SToke Høiland-Jørgensen 	struct cfg80211_txq_stats txq_stats;
17576de39808SJohannes Berg };
17586de39808SJohannes Berg 
1759119363c7SFelix Fietkau #define IEEE80211_MAX_CHAINS	4
1760119363c7SFelix Fietkau 
1761f4263c98SPaul Stewart /**
17622ec600d6SLuis Carlos Cobo  * struct station_info - station information
1763fd5b74dcSJohannes Berg  *
17642ec600d6SLuis Carlos Cobo  * Station information filled by driver for get_station() and dump_station.
1765fd5b74dcSJohannes Berg  *
1766319090bfSJohannes Berg  * @filled: bitflag of flags using the bits of &enum nl80211_sta_info to
1767319090bfSJohannes Berg  *	indicate the relevant values in this struct for them
1768ebe27c91SMohammed Shafi Shajakhan  * @connected_time: time(in secs) since a station is last connected
1769fd5b74dcSJohannes Berg  * @inactive_time: time since last station activity (tx/rx) in milliseconds
17706c7a0033SBen Greear  * @assoc_at: bootime (ns) of the last association
17718d791361SJohannes Berg  * @rx_bytes: bytes (size of MPDUs) received from this station
17728d791361SJohannes Berg  * @tx_bytes: bytes (size of MPDUs) transmitted to this station
17732ec600d6SLuis Carlos Cobo  * @llid: mesh local link id
17742ec600d6SLuis Carlos Cobo  * @plid: mesh peer link id
17752ec600d6SLuis Carlos Cobo  * @plink_state: mesh peer link state
177673c3df3bSJohannes Berg  * @signal: The signal strength, type depends on the wiphy's signal_type.
177773c3df3bSJohannes Berg  *	For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
177873c3df3bSJohannes Berg  * @signal_avg: Average signal strength, type depends on the wiphy's signal_type.
177973c3df3bSJohannes Berg  *	For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
1780119363c7SFelix Fietkau  * @chains: bitmask for filled values in @chain_signal, @chain_signal_avg
1781119363c7SFelix Fietkau  * @chain_signal: per-chain signal strength of last received packet in dBm
1782119363c7SFelix Fietkau  * @chain_signal_avg: per-chain signal strength average in dBm
1783858022aaSRandy Dunlap  * @txrate: current unicast bitrate from this station
1784858022aaSRandy Dunlap  * @rxrate: current unicast bitrate to this station
17858d791361SJohannes Berg  * @rx_packets: packets (MSDUs & MMPDUs) received from this station
17868d791361SJohannes Berg  * @tx_packets: packets (MSDUs & MMPDUs) transmitted to this station
17878d791361SJohannes Berg  * @tx_retries: cumulative retry counts (MPDUs)
17888d791361SJohannes Berg  * @tx_failed: number of failed transmissions (MPDUs) (retries exceeded, no ACK)
17895a5c731aSBen Greear  * @rx_dropped_misc:  Dropped for un-specified reason.
17901ba01458SRandy Dunlap  * @bss_param: current BSS parameters
1791f5ea9120SJohannes Berg  * @generation: generation number for nl80211 dumps.
1792f5ea9120SJohannes Berg  *	This number should increase every time the list of stations
1793f5ea9120SJohannes Berg  *	changes, i.e. when a station is added or removed, so that
1794f5ea9120SJohannes Berg  *	userspace can tell whether it got a consistent snapshot.
179550d3dfb7SJouni Malinen  * @assoc_req_ies: IEs from (Re)Association Request.
179650d3dfb7SJouni Malinen  *	This is used only when in AP mode with drivers that do not use
179750d3dfb7SJouni Malinen  *	user space MLME/SME implementation. The information is provided for
179850d3dfb7SJouni Malinen  *	the cfg80211_new_sta() calls to notify user space of the IEs.
179950d3dfb7SJouni Malinen  * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets.
1800c26887d2SJohannes Berg  * @sta_flags: station flags mask & values
1801a85e1d55SPaul Stewart  * @beacon_loss_count: Number of times beacon loss event has triggered.
1802d299a1f2SJavier Cardona  * @t_offset: Time offset of the station relative to this host.
18033b1c5a53SMarco Porsch  * @local_pm: local mesh STA power save mode
18043b1c5a53SMarco Porsch  * @peer_pm: peer mesh STA power save mode
18053b1c5a53SMarco Porsch  * @nonpeer_pm: non-peer mesh STA power save mode
1806867d849fSAntonio Quartulli  * @expected_throughput: expected throughput in kbps (including 802.11 headers)
1807867d849fSAntonio Quartulli  *	towards this station.
1808a76b1942SJohannes Berg  * @rx_beacon: number of beacons received from this peer
1809a76b1942SJohannes Berg  * @rx_beacon_signal_avg: signal strength average (in dBm) for beacons received
1810a76b1942SJohannes Berg  *	from this peer
1811dbdaee7aSBob Copeland  * @connected_to_gate: true if mesh STA has a path to mesh gate
1812739960f1SMohammed Shafi Shajakhan  * @rx_duration: aggregate PPDU duration(usecs) for all the frames from a peer
181336647055SToke Høiland-Jørgensen  * @tx_duration: aggregate PPDU duration(usecs) for all the frames to a peer
181436647055SToke Høiland-Jørgensen  * @airtime_weight: current airtime scheduling weight
18156de39808SJohannes Berg  * @pertid: per-TID statistics, see &struct cfg80211_tid_stats, using the last
18166de39808SJohannes Berg  *	(IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs.
18178689c051SArend van Spriel  *	Note that this doesn't use the @filled bit, but is used if non-NULL.
1818c4b50cd3SVenkateswara Naralasetty  * @ack_signal: signal strength (in dBm) of the last ACK frame.
181981d5439dSBalaji Pothunoori  * @avg_ack_signal: average rssi value of ack packet for the no of msdu's has
182081d5439dSBalaji Pothunoori  *	been sent.
18210d4e14a3SAnkita Bajaj  * @rx_mpdu_count: number of MPDUs received from this station
18220d4e14a3SAnkita Bajaj  * @fcs_err_count: number of packets (MPDUs) received from this station with
18230d4e14a3SAnkita Bajaj  *	an FCS error. This counter should be incremented only when TA of the
18240d4e14a3SAnkita Bajaj  *	received packet with an FCS error matches the peer MAC address.
1825ab60633cSNarayanraddi Masti  * @airtime_link_metric: mesh airtime link metric.
18261303a51cSMarkus Theil  * @connected_to_as: true if mesh STA has a path to authentication server
1827fd5b74dcSJohannes Berg  */
18282ec600d6SLuis Carlos Cobo struct station_info {
1829739960f1SMohammed Shafi Shajakhan 	u64 filled;
1830ebe27c91SMohammed Shafi Shajakhan 	u32 connected_time;
1831fd5b74dcSJohannes Berg 	u32 inactive_time;
18326c7a0033SBen Greear 	u64 assoc_at;
183342745e03SVladimir Kondratiev 	u64 rx_bytes;
183442745e03SVladimir Kondratiev 	u64 tx_bytes;
18352ec600d6SLuis Carlos Cobo 	u16 llid;
18362ec600d6SLuis Carlos Cobo 	u16 plid;
18372ec600d6SLuis Carlos Cobo 	u8 plink_state;
1838420e7fabSHenning Rogge 	s8 signal;
1839541a45a1SBruno Randolf 	s8 signal_avg;
1840119363c7SFelix Fietkau 
1841119363c7SFelix Fietkau 	u8 chains;
1842119363c7SFelix Fietkau 	s8 chain_signal[IEEE80211_MAX_CHAINS];
1843119363c7SFelix Fietkau 	s8 chain_signal_avg[IEEE80211_MAX_CHAINS];
1844119363c7SFelix Fietkau 
1845420e7fabSHenning Rogge 	struct rate_info txrate;
1846c8dcfd8aSFelix Fietkau 	struct rate_info rxrate;
184798c8a60aSJouni Malinen 	u32 rx_packets;
184898c8a60aSJouni Malinen 	u32 tx_packets;
1849b206b4efSBruno Randolf 	u32 tx_retries;
1850b206b4efSBruno Randolf 	u32 tx_failed;
18515a5c731aSBen Greear 	u32 rx_dropped_misc;
1852f4263c98SPaul Stewart 	struct sta_bss_parameters bss_param;
1853bb6e753eSHelmut Schaa 	struct nl80211_sta_flag_update sta_flags;
1854f5ea9120SJohannes Berg 
1855f5ea9120SJohannes Berg 	int generation;
185650d3dfb7SJouni Malinen 
185750d3dfb7SJouni Malinen 	const u8 *assoc_req_ies;
185850d3dfb7SJouni Malinen 	size_t assoc_req_ies_len;
1859f612cedfSJouni Malinen 
1860a85e1d55SPaul Stewart 	u32 beacon_loss_count;
1861d299a1f2SJavier Cardona 	s64 t_offset;
18623b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode local_pm;
18633b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode peer_pm;
18643b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode nonpeer_pm;
1865a85e1d55SPaul Stewart 
1866867d849fSAntonio Quartulli 	u32 expected_throughput;
1867a76b1942SJohannes Berg 
186836647055SToke Høiland-Jørgensen 	u64 tx_duration;
1869739960f1SMohammed Shafi Shajakhan 	u64 rx_duration;
187036647055SToke Høiland-Jørgensen 	u64 rx_beacon;
1871a76b1942SJohannes Berg 	u8 rx_beacon_signal_avg;
1872dbdaee7aSBob Copeland 	u8 connected_to_gate;
1873dbdaee7aSBob Copeland 
18748689c051SArend van Spriel 	struct cfg80211_tid_stats *pertid;
1875c4b50cd3SVenkateswara Naralasetty 	s8 ack_signal;
187681d5439dSBalaji Pothunoori 	s8 avg_ack_signal;
18770d4e14a3SAnkita Bajaj 
187836647055SToke Høiland-Jørgensen 	u16 airtime_weight;
187936647055SToke Høiland-Jørgensen 
18800d4e14a3SAnkita Bajaj 	u32 rx_mpdu_count;
18810d4e14a3SAnkita Bajaj 	u32 fcs_err_count;
1882ab60633cSNarayanraddi Masti 
1883ab60633cSNarayanraddi Masti 	u32 airtime_link_metric;
18841303a51cSMarkus Theil 
18851303a51cSMarkus Theil 	u8 connected_to_as;
1886fd5b74dcSJohannes Berg };
1887fd5b74dcSJohannes Berg 
18886bdb68ceSCarl Huang /**
18896bdb68ceSCarl Huang  * struct cfg80211_sar_sub_specs - sub specs limit
18906bdb68ceSCarl Huang  * @power: power limitation in 0.25dbm
18916bdb68ceSCarl Huang  * @freq_range_index: index the power limitation applies to
18926bdb68ceSCarl Huang  */
18936bdb68ceSCarl Huang struct cfg80211_sar_sub_specs {
18946bdb68ceSCarl Huang 	s32 power;
18956bdb68ceSCarl Huang 	u32 freq_range_index;
18966bdb68ceSCarl Huang };
18976bdb68ceSCarl Huang 
18986bdb68ceSCarl Huang /**
18996bdb68ceSCarl Huang  * struct cfg80211_sar_specs - sar limit specs
19006bdb68ceSCarl Huang  * @type: it's set with power in 0.25dbm or other types
19016bdb68ceSCarl Huang  * @num_sub_specs: number of sar sub specs
19026bdb68ceSCarl Huang  * @sub_specs: memory to hold the sar sub specs
19036bdb68ceSCarl Huang  */
19046bdb68ceSCarl Huang struct cfg80211_sar_specs {
19056bdb68ceSCarl Huang 	enum nl80211_sar_type type;
19066bdb68ceSCarl Huang 	u32 num_sub_specs;
19076bdb68ceSCarl Huang 	struct cfg80211_sar_sub_specs sub_specs[];
19086bdb68ceSCarl Huang };
19096bdb68ceSCarl Huang 
19106bdb68ceSCarl Huang 
19116bdb68ceSCarl Huang /**
1912c2083e28SMauro Carvalho Chehab  * struct cfg80211_sar_freq_ranges - sar frequency ranges
19136bdb68ceSCarl Huang  * @start_freq:  start range edge frequency
19146bdb68ceSCarl Huang  * @end_freq:    end range edge frequency
19156bdb68ceSCarl Huang  */
19166bdb68ceSCarl Huang struct cfg80211_sar_freq_ranges {
19176bdb68ceSCarl Huang 	u32 start_freq;
19186bdb68ceSCarl Huang 	u32 end_freq;
19196bdb68ceSCarl Huang };
19206bdb68ceSCarl Huang 
19216bdb68ceSCarl Huang /**
19226bdb68ceSCarl Huang  * struct cfg80211_sar_capa - sar limit capability
19236bdb68ceSCarl Huang  * @type: it's set via power in 0.25dbm or other types
19246bdb68ceSCarl Huang  * @num_freq_ranges: number of frequency ranges
19256bdb68ceSCarl Huang  * @freq_ranges: memory to hold the freq ranges.
19266bdb68ceSCarl Huang  *
19276bdb68ceSCarl Huang  * Note: WLAN driver may append new ranges or split an existing
19286bdb68ceSCarl Huang  * range to small ones and then append them.
19296bdb68ceSCarl Huang  */
19306bdb68ceSCarl Huang struct cfg80211_sar_capa {
19316bdb68ceSCarl Huang 	enum nl80211_sar_type type;
19326bdb68ceSCarl Huang 	u32 num_freq_ranges;
19336bdb68ceSCarl Huang 	const struct cfg80211_sar_freq_ranges *freq_ranges;
19346bdb68ceSCarl Huang };
19356bdb68ceSCarl Huang 
193661aaa0e8SLinus Lüssing #if IS_ENABLED(CONFIG_CFG80211)
193766f7ac50SMichael Wu /**
19387406353dSAntonio Quartulli  * cfg80211_get_station - retrieve information about a given station
19397406353dSAntonio Quartulli  * @dev: the device where the station is supposed to be connected to
19407406353dSAntonio Quartulli  * @mac_addr: the mac address of the station of interest
19417406353dSAntonio Quartulli  * @sinfo: pointer to the structure to fill with the information
19427406353dSAntonio Quartulli  *
19437406353dSAntonio Quartulli  * Returns 0 on success and sinfo is filled with the available information
19447406353dSAntonio Quartulli  * otherwise returns a negative error code and the content of sinfo has to be
19457406353dSAntonio Quartulli  * considered undefined.
19467406353dSAntonio Quartulli  */
19477406353dSAntonio Quartulli int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr,
19487406353dSAntonio Quartulli 			 struct station_info *sinfo);
194961aaa0e8SLinus Lüssing #else
195061aaa0e8SLinus Lüssing static inline int cfg80211_get_station(struct net_device *dev,
195161aaa0e8SLinus Lüssing 				       const u8 *mac_addr,
195261aaa0e8SLinus Lüssing 				       struct station_info *sinfo)
195361aaa0e8SLinus Lüssing {
195461aaa0e8SLinus Lüssing 	return -ENOENT;
195561aaa0e8SLinus Lüssing }
195661aaa0e8SLinus Lüssing #endif
19577406353dSAntonio Quartulli 
19587406353dSAntonio Quartulli /**
195966f7ac50SMichael Wu  * enum monitor_flags - monitor flags
196066f7ac50SMichael Wu  *
196166f7ac50SMichael Wu  * Monitor interface configuration flags. Note that these must be the bits
196266f7ac50SMichael Wu  * according to the nl80211 flags.
196366f7ac50SMichael Wu  *
1964818a986eSJohannes Berg  * @MONITOR_FLAG_CHANGED: set if the flags were changed
196566f7ac50SMichael Wu  * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS
196666f7ac50SMichael Wu  * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP
196766f7ac50SMichael Wu  * @MONITOR_FLAG_CONTROL: pass control frames
196866f7ac50SMichael Wu  * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering
196966f7ac50SMichael Wu  * @MONITOR_FLAG_COOK_FRAMES: report frames after processing
1970e057d3c3SFelix Fietkau  * @MONITOR_FLAG_ACTIVE: active monitor, ACKs frames on its MAC address
197166f7ac50SMichael Wu  */
197266f7ac50SMichael Wu enum monitor_flags {
1973818a986eSJohannes Berg 	MONITOR_FLAG_CHANGED		= 1<<__NL80211_MNTR_FLAG_INVALID,
197466f7ac50SMichael Wu 	MONITOR_FLAG_FCSFAIL		= 1<<NL80211_MNTR_FLAG_FCSFAIL,
197566f7ac50SMichael Wu 	MONITOR_FLAG_PLCPFAIL		= 1<<NL80211_MNTR_FLAG_PLCPFAIL,
197666f7ac50SMichael Wu 	MONITOR_FLAG_CONTROL		= 1<<NL80211_MNTR_FLAG_CONTROL,
197766f7ac50SMichael Wu 	MONITOR_FLAG_OTHER_BSS		= 1<<NL80211_MNTR_FLAG_OTHER_BSS,
197866f7ac50SMichael Wu 	MONITOR_FLAG_COOK_FRAMES	= 1<<NL80211_MNTR_FLAG_COOK_FRAMES,
1979e057d3c3SFelix Fietkau 	MONITOR_FLAG_ACTIVE		= 1<<NL80211_MNTR_FLAG_ACTIVE,
198066f7ac50SMichael Wu };
198166f7ac50SMichael Wu 
19822ec600d6SLuis Carlos Cobo /**
19832ec600d6SLuis Carlos Cobo  * enum mpath_info_flags -  mesh path information flags
19842ec600d6SLuis Carlos Cobo  *
19852ec600d6SLuis Carlos Cobo  * Used by the driver to indicate which info in &struct mpath_info it has filled
19862ec600d6SLuis Carlos Cobo  * in during get_station() or dump_station().
19872ec600d6SLuis Carlos Cobo  *
1988abe37c4bSJohannes Berg  * @MPATH_INFO_FRAME_QLEN: @frame_qlen filled
1989abe37c4bSJohannes Berg  * @MPATH_INFO_SN: @sn filled
1990abe37c4bSJohannes Berg  * @MPATH_INFO_METRIC: @metric filled
1991abe37c4bSJohannes Berg  * @MPATH_INFO_EXPTIME: @exptime filled
1992abe37c4bSJohannes Berg  * @MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled
1993abe37c4bSJohannes Berg  * @MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled
1994abe37c4bSJohannes Berg  * @MPATH_INFO_FLAGS: @flags filled
1995cc241636SJulan Hsu  * @MPATH_INFO_HOP_COUNT: @hop_count filled
19969874b71fSJohannes Berg  * @MPATH_INFO_PATH_CHANGE: @path_change_count filled
19972ec600d6SLuis Carlos Cobo  */
19982ec600d6SLuis Carlos Cobo enum mpath_info_flags {
19992ec600d6SLuis Carlos Cobo 	MPATH_INFO_FRAME_QLEN		= BIT(0),
2000d19b3bf6SRui Paulo 	MPATH_INFO_SN			= BIT(1),
20012ec600d6SLuis Carlos Cobo 	MPATH_INFO_METRIC		= BIT(2),
20022ec600d6SLuis Carlos Cobo 	MPATH_INFO_EXPTIME		= BIT(3),
20032ec600d6SLuis Carlos Cobo 	MPATH_INFO_DISCOVERY_TIMEOUT	= BIT(4),
20042ec600d6SLuis Carlos Cobo 	MPATH_INFO_DISCOVERY_RETRIES	= BIT(5),
20052ec600d6SLuis Carlos Cobo 	MPATH_INFO_FLAGS		= BIT(6),
2006540bbcb9SJulan Hsu 	MPATH_INFO_HOP_COUNT		= BIT(7),
2007540bbcb9SJulan Hsu 	MPATH_INFO_PATH_CHANGE		= BIT(8),
20082ec600d6SLuis Carlos Cobo };
20092ec600d6SLuis Carlos Cobo 
20102ec600d6SLuis Carlos Cobo /**
20112ec600d6SLuis Carlos Cobo  * struct mpath_info - mesh path information
20122ec600d6SLuis Carlos Cobo  *
20132ec600d6SLuis Carlos Cobo  * Mesh path information filled by driver for get_mpath() and dump_mpath().
20142ec600d6SLuis Carlos Cobo  *
20152ec600d6SLuis Carlos Cobo  * @filled: bitfield of flags from &enum mpath_info_flags
20162ec600d6SLuis Carlos Cobo  * @frame_qlen: number of queued frames for this destination
2017d19b3bf6SRui Paulo  * @sn: target sequence number
20182ec600d6SLuis Carlos Cobo  * @metric: metric (cost) of this mesh path
20192ec600d6SLuis Carlos Cobo  * @exptime: expiration time for the mesh path from now, in msecs
20202ec600d6SLuis Carlos Cobo  * @flags: mesh path flags
20212ec600d6SLuis Carlos Cobo  * @discovery_timeout: total mesh path discovery timeout, in msecs
20222ec600d6SLuis Carlos Cobo  * @discovery_retries: mesh path discovery retries
2023f5ea9120SJohannes Berg  * @generation: generation number for nl80211 dumps.
2024f5ea9120SJohannes Berg  *	This number should increase every time the list of mesh paths
2025f5ea9120SJohannes Berg  *	changes, i.e. when a station is added or removed, so that
2026f5ea9120SJohannes Berg  *	userspace can tell whether it got a consistent snapshot.
2027cc241636SJulan Hsu  * @hop_count: hops to destination
2028540bbcb9SJulan Hsu  * @path_change_count: total number of path changes to destination
20292ec600d6SLuis Carlos Cobo  */
20302ec600d6SLuis Carlos Cobo struct mpath_info {
20312ec600d6SLuis Carlos Cobo 	u32 filled;
20322ec600d6SLuis Carlos Cobo 	u32 frame_qlen;
2033d19b3bf6SRui Paulo 	u32 sn;
20342ec600d6SLuis Carlos Cobo 	u32 metric;
20352ec600d6SLuis Carlos Cobo 	u32 exptime;
20362ec600d6SLuis Carlos Cobo 	u32 discovery_timeout;
20372ec600d6SLuis Carlos Cobo 	u8 discovery_retries;
20382ec600d6SLuis Carlos Cobo 	u8 flags;
2039cc241636SJulan Hsu 	u8 hop_count;
2040540bbcb9SJulan Hsu 	u32 path_change_count;
2041f5ea9120SJohannes Berg 
2042f5ea9120SJohannes Berg 	int generation;
20432ec600d6SLuis Carlos Cobo };
20442ec600d6SLuis Carlos Cobo 
20459f1ba906SJouni Malinen /**
20469f1ba906SJouni Malinen  * struct bss_parameters - BSS parameters
20479f1ba906SJouni Malinen  *
20489f1ba906SJouni Malinen  * Used to change BSS parameters (mainly for AP mode).
20499f1ba906SJouni Malinen  *
20509f1ba906SJouni Malinen  * @use_cts_prot: Whether to use CTS protection
20519f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
20529f1ba906SJouni Malinen  * @use_short_preamble: Whether the use of short preambles is allowed
20539f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
20549f1ba906SJouni Malinen  * @use_short_slot_time: Whether the use of short slot time is allowed
20559f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
205690c97a04SJouni Malinen  * @basic_rates: basic rates in IEEE 802.11 format
205790c97a04SJouni Malinen  *	(or NULL for no change)
205890c97a04SJouni Malinen  * @basic_rates_len: number of basic rates
2059fd8aaaf3SFelix Fietkau  * @ap_isolate: do not forward packets between connected stations
20609d6e371dSWright Feng  *	(0 = no, 1 = yes, -1 = do not change)
206150b12f59SHelmut Schaa  * @ht_opmode: HT Operation mode
206250b12f59SHelmut Schaa  *	(u16 = opmode, -1 = do not change)
206353cabad7SJohannes Berg  * @p2p_ctwindow: P2P CT Window (-1 = no change)
206453cabad7SJohannes Berg  * @p2p_opp_ps: P2P opportunistic PS (-1 = no change)
20659f1ba906SJouni Malinen  */
20669f1ba906SJouni Malinen struct bss_parameters {
20679f1ba906SJouni Malinen 	int use_cts_prot;
20689f1ba906SJouni Malinen 	int use_short_preamble;
20699f1ba906SJouni Malinen 	int use_short_slot_time;
2070c1e5f471SJohannes Berg 	const u8 *basic_rates;
207190c97a04SJouni Malinen 	u8 basic_rates_len;
2072fd8aaaf3SFelix Fietkau 	int ap_isolate;
207350b12f59SHelmut Schaa 	int ht_opmode;
207453cabad7SJohannes Berg 	s8 p2p_ctwindow, p2p_opp_ps;
20759f1ba906SJouni Malinen };
20762ec600d6SLuis Carlos Cobo 
20773ddd53f3SChun-Yeow Yeoh /**
207829cbe68cSJohannes Berg  * struct mesh_config - 802.11s mesh configuration
207929cbe68cSJohannes Berg  *
208029cbe68cSJohannes Berg  * These parameters can be changed while the mesh is active.
20813ddd53f3SChun-Yeow Yeoh  *
20823ddd53f3SChun-Yeow Yeoh  * @dot11MeshRetryTimeout: the initial retry timeout in millisecond units used
20833ddd53f3SChun-Yeow Yeoh  *	by the Mesh Peering Open message
20843ddd53f3SChun-Yeow Yeoh  * @dot11MeshConfirmTimeout: the initial retry timeout in millisecond units
20853ddd53f3SChun-Yeow Yeoh  *	used by the Mesh Peering Open message
20863ddd53f3SChun-Yeow Yeoh  * @dot11MeshHoldingTimeout: the confirm timeout in millisecond units used by
20873ddd53f3SChun-Yeow Yeoh  *	the mesh peering management to close a mesh peering
20883ddd53f3SChun-Yeow Yeoh  * @dot11MeshMaxPeerLinks: the maximum number of peer links allowed on this
20893ddd53f3SChun-Yeow Yeoh  *	mesh interface
20903ddd53f3SChun-Yeow Yeoh  * @dot11MeshMaxRetries: the maximum number of peer link open retries that can
20913ddd53f3SChun-Yeow Yeoh  *	be sent to establish a new peer link instance in a mesh
20923ddd53f3SChun-Yeow Yeoh  * @dot11MeshTTL: the value of TTL field set at a source mesh STA
20933ddd53f3SChun-Yeow Yeoh  * @element_ttl: the value of TTL field set at a mesh STA for path selection
20943ddd53f3SChun-Yeow Yeoh  *	elements
20953ddd53f3SChun-Yeow Yeoh  * @auto_open_plinks: whether we should automatically open peer links when we
20963ddd53f3SChun-Yeow Yeoh  *	detect compatible mesh peers
20973ddd53f3SChun-Yeow Yeoh  * @dot11MeshNbrOffsetMaxNeighbor: the maximum number of neighbors to
20983ddd53f3SChun-Yeow Yeoh  *	synchronize to for 11s default synchronization method
20993ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPmaxPREQretries: the number of action frames containing a PREQ
21003ddd53f3SChun-Yeow Yeoh  *	that an originator mesh STA can send to a particular path target
21013ddd53f3SChun-Yeow Yeoh  * @path_refresh_time: how frequently to refresh mesh paths in milliseconds
21023ddd53f3SChun-Yeow Yeoh  * @min_discovery_timeout: the minimum length of time to wait until giving up on
21033ddd53f3SChun-Yeow Yeoh  *	a path discovery in milliseconds
21043ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPactivePathTimeout: the time (in TUs) for which mesh STAs
21053ddd53f3SChun-Yeow Yeoh  *	receiving a PREQ shall consider the forwarding information from the
21063ddd53f3SChun-Yeow Yeoh  *	root to be valid. (TU = time unit)
21073ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPpreqMinInterval: the minimum interval of time (in TUs) during
21083ddd53f3SChun-Yeow Yeoh  *	which a mesh STA can send only one action frame containing a PREQ
21093ddd53f3SChun-Yeow Yeoh  *	element
21103ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPperrMinInterval: the minimum interval of time (in TUs) during
21113ddd53f3SChun-Yeow Yeoh  *	which a mesh STA can send only one Action frame containing a PERR
21123ddd53f3SChun-Yeow Yeoh  *	element
21133ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPnetDiameterTraversalTime: the interval of time (in TUs) that
21143ddd53f3SChun-Yeow Yeoh  *	it takes for an HWMP information element to propagate across the mesh
21153ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPRootMode: the configuration of a mesh STA as root mesh STA
21163ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPRannInterval: the interval of time (in TUs) between root
21173ddd53f3SChun-Yeow Yeoh  *	announcements are transmitted
21183ddd53f3SChun-Yeow Yeoh  * @dot11MeshGateAnnouncementProtocol: whether to advertise that this mesh
21193ddd53f3SChun-Yeow Yeoh  *	station has access to a broader network beyond the MBSS. (This is
21203ddd53f3SChun-Yeow Yeoh  *	missnamed in draft 12.0: dot11MeshGateAnnouncementProtocol set to true
21213ddd53f3SChun-Yeow Yeoh  *	only means that the station will announce others it's a mesh gate, but
21223ddd53f3SChun-Yeow Yeoh  *	not necessarily using the gate announcement protocol. Still keeping the
21233ddd53f3SChun-Yeow Yeoh  *	same nomenclature to be in sync with the spec)
21243ddd53f3SChun-Yeow Yeoh  * @dot11MeshForwarding: whether the Mesh STA is forwarding or non-forwarding
21253ddd53f3SChun-Yeow Yeoh  *	entity (default is TRUE - forwarding entity)
21263ddd53f3SChun-Yeow Yeoh  * @rssi_threshold: the threshold for average signal strength of candidate
21273ddd53f3SChun-Yeow Yeoh  *	station to establish a peer link
21283ddd53f3SChun-Yeow Yeoh  * @ht_opmode: mesh HT protection mode
2129ac1073a6SChun-Yeow Yeoh  *
2130ac1073a6SChun-Yeow Yeoh  * @dot11MeshHWMPactivePathToRootTimeout: The time (in TUs) for which mesh STAs
2131ac1073a6SChun-Yeow Yeoh  *	receiving a proactive PREQ shall consider the forwarding information to
2132ac1073a6SChun-Yeow Yeoh  *	the root mesh STA to be valid.
2133ac1073a6SChun-Yeow Yeoh  *
2134ac1073a6SChun-Yeow Yeoh  * @dot11MeshHWMProotInterval: The interval of time (in TUs) between proactive
2135ac1073a6SChun-Yeow Yeoh  *	PREQs are transmitted.
2136728b19e5SChun-Yeow Yeoh  * @dot11MeshHWMPconfirmationInterval: The minimum interval of time (in TUs)
2137728b19e5SChun-Yeow Yeoh  *	during which a mesh STA can send only one Action frame containing
2138728b19e5SChun-Yeow Yeoh  *	a PREQ element for root path confirmation.
21393b1c5a53SMarco Porsch  * @power_mode: The default mesh power save mode which will be the initial
21403b1c5a53SMarco Porsch  *	setting for new peer links.
21413b1c5a53SMarco Porsch  * @dot11MeshAwakeWindowDuration: The duration in TUs the STA will remain awake
21423b1c5a53SMarco Porsch  *	after transmitting its beacon.
21438e7c0538SColleen Twitty  * @plink_timeout: If no tx activity is seen from a STA we've established
21448e7c0538SColleen Twitty  *	peering with for longer than this time (in seconds), then remove it
21458e7c0538SColleen Twitty  *	from the STA's list of peers.  Default is 30 minutes.
214601d66fbdSBob Copeland  * @dot11MeshConnectedToMeshGate: if set to true, advertise that this STA is
214701d66fbdSBob Copeland  *      connected to a mesh gate in mesh formation info.  If false, the
214801d66fbdSBob Copeland  *      value in mesh formation is determined by the presence of root paths
214901d66fbdSBob Copeland  *      in the mesh path table
2150e3718a61SLinus Lüssing  * @dot11MeshNolearn: Try to avoid multi-hop path discovery (e.g. PREQ/PREP
2151e3718a61SLinus Lüssing  *      for HWMP) if the destination is a direct neighbor. Note that this might
2152e3718a61SLinus Lüssing  *      not be the optimal decision as a multi-hop route might be better. So
2153e3718a61SLinus Lüssing  *      if using this setting you will likely also want to disable
2154e3718a61SLinus Lüssing  *      dot11MeshForwarding and use another mesh routing protocol on top.
215529cbe68cSJohannes Berg  */
215693da9cc1Scolin@cozybit.com struct mesh_config {
215793da9cc1Scolin@cozybit.com 	u16 dot11MeshRetryTimeout;
215893da9cc1Scolin@cozybit.com 	u16 dot11MeshConfirmTimeout;
215993da9cc1Scolin@cozybit.com 	u16 dot11MeshHoldingTimeout;
216093da9cc1Scolin@cozybit.com 	u16 dot11MeshMaxPeerLinks;
216193da9cc1Scolin@cozybit.com 	u8 dot11MeshMaxRetries;
216293da9cc1Scolin@cozybit.com 	u8 dot11MeshTTL;
216345904f21SJavier Cardona 	u8 element_ttl;
216493da9cc1Scolin@cozybit.com 	bool auto_open_plinks;
2165d299a1f2SJavier Cardona 	u32 dot11MeshNbrOffsetMaxNeighbor;
216693da9cc1Scolin@cozybit.com 	u8 dot11MeshHWMPmaxPREQretries;
216793da9cc1Scolin@cozybit.com 	u32 path_refresh_time;
216893da9cc1Scolin@cozybit.com 	u16 min_discovery_timeout;
216993da9cc1Scolin@cozybit.com 	u32 dot11MeshHWMPactivePathTimeout;
217093da9cc1Scolin@cozybit.com 	u16 dot11MeshHWMPpreqMinInterval;
2171dca7e943SThomas Pedersen 	u16 dot11MeshHWMPperrMinInterval;
217293da9cc1Scolin@cozybit.com 	u16 dot11MeshHWMPnetDiameterTraversalTime;
217363c5723bSRui Paulo 	u8 dot11MeshHWMPRootMode;
217401d66fbdSBob Copeland 	bool dot11MeshConnectedToMeshGate;
2175184eebe6SMarkus Theil 	bool dot11MeshConnectedToAuthServer;
21760507e159SJavier Cardona 	u16 dot11MeshHWMPRannInterval;
217716dd7267SJavier Cardona 	bool dot11MeshGateAnnouncementProtocol;
217894f90656SChun-Yeow Yeoh 	bool dot11MeshForwarding;
217955335137SAshok Nagarajan 	s32 rssi_threshold;
218070c33eaaSAshok Nagarajan 	u16 ht_opmode;
2181ac1073a6SChun-Yeow Yeoh 	u32 dot11MeshHWMPactivePathToRootTimeout;
2182ac1073a6SChun-Yeow Yeoh 	u16 dot11MeshHWMProotInterval;
2183728b19e5SChun-Yeow Yeoh 	u16 dot11MeshHWMPconfirmationInterval;
21843b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode power_mode;
21853b1c5a53SMarco Porsch 	u16 dot11MeshAwakeWindowDuration;
21868e7c0538SColleen Twitty 	u32 plink_timeout;
2187e3718a61SLinus Lüssing 	bool dot11MeshNolearn;
218893da9cc1Scolin@cozybit.com };
218993da9cc1Scolin@cozybit.com 
219031888487SJouni Malinen /**
219129cbe68cSJohannes Berg  * struct mesh_setup - 802.11s mesh setup configuration
2192683b6d3bSJohannes Berg  * @chandef: defines the channel to use
219329cbe68cSJohannes Berg  * @mesh_id: the mesh ID
219429cbe68cSJohannes Berg  * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes
2195d299a1f2SJavier Cardona  * @sync_method: which synchronization method to use
2196c80d545dSJavier Cardona  * @path_sel_proto: which path selection protocol to use
2197c80d545dSJavier Cardona  * @path_metric: which metric to use
21986e16d90bSColleen Twitty  * @auth_id: which authentication method this mesh is using
2199581a8b0fSJavier Cardona  * @ie: vendor information elements (optional)
2200581a8b0fSJavier Cardona  * @ie_len: length of vendor information elements
2201b130e5ceSJavier Cardona  * @is_authenticated: this mesh requires authentication
2202b130e5ceSJavier Cardona  * @is_secure: this mesh uses security
2203bb2798d4SThomas Pedersen  * @user_mpm: userspace handles all MPM functions
22049bdbf04dSMarco Porsch  * @dtim_period: DTIM period to use
22059bdbf04dSMarco Porsch  * @beacon_interval: beacon interval to use
22064bb62344SChun-Yeow Yeoh  * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a]
2207ffb3cf30SAshok Nagarajan  * @basic_rates: basic rates to use when creating the mesh
22088564e382SJohannes Berg  * @beacon_rate: bitrate to be used for beacons
2209d37d49c2SBenjamin Berg  * @userspace_handles_dfs: whether user space controls DFS operation, i.e.
2210d37d49c2SBenjamin Berg  *	changes the channel when a radar is detected. This is required
2211d37d49c2SBenjamin Berg  *	to operate on DFS channels.
22121224f583SDenis Kenzior  * @control_port_over_nl80211: TRUE if userspace expects to exchange control
22131224f583SDenis Kenzior  *	port frames over NL80211 instead of the network interface.
221429cbe68cSJohannes Berg  *
221529cbe68cSJohannes Berg  * These parameters are fixed when the mesh is created.
221629cbe68cSJohannes Berg  */
221729cbe68cSJohannes Berg struct mesh_setup {
2218683b6d3bSJohannes Berg 	struct cfg80211_chan_def chandef;
221929cbe68cSJohannes Berg 	const u8 *mesh_id;
222029cbe68cSJohannes Berg 	u8 mesh_id_len;
2221d299a1f2SJavier Cardona 	u8 sync_method;
2222c80d545dSJavier Cardona 	u8 path_sel_proto;
2223c80d545dSJavier Cardona 	u8 path_metric;
22246e16d90bSColleen Twitty 	u8 auth_id;
2225581a8b0fSJavier Cardona 	const u8 *ie;
2226581a8b0fSJavier Cardona 	u8 ie_len;
2227b130e5ceSJavier Cardona 	bool is_authenticated;
222815d5dda6SJavier Cardona 	bool is_secure;
2229bb2798d4SThomas Pedersen 	bool user_mpm;
22309bdbf04dSMarco Porsch 	u8 dtim_period;
22319bdbf04dSMarco Porsch 	u16 beacon_interval;
223257fbcce3SJohannes Berg 	int mcast_rate[NUM_NL80211_BANDS];
2233ffb3cf30SAshok Nagarajan 	u32 basic_rates;
22348564e382SJohannes Berg 	struct cfg80211_bitrate_mask beacon_rate;
2235d37d49c2SBenjamin Berg 	bool userspace_handles_dfs;
22361224f583SDenis Kenzior 	bool control_port_over_nl80211;
223729cbe68cSJohannes Berg };
223829cbe68cSJohannes Berg 
223929cbe68cSJohannes Berg /**
22406e0bd6c3SRostislav Lisovy  * struct ocb_setup - 802.11p OCB mode setup configuration
22416e0bd6c3SRostislav Lisovy  * @chandef: defines the channel to use
22426e0bd6c3SRostislav Lisovy  *
22436e0bd6c3SRostislav Lisovy  * These parameters are fixed when connecting to the network
22446e0bd6c3SRostislav Lisovy  */
22456e0bd6c3SRostislav Lisovy struct ocb_setup {
22466e0bd6c3SRostislav Lisovy 	struct cfg80211_chan_def chandef;
22476e0bd6c3SRostislav Lisovy };
22486e0bd6c3SRostislav Lisovy 
22496e0bd6c3SRostislav Lisovy /**
225031888487SJouni Malinen  * struct ieee80211_txq_params - TX queue parameters
2251a3304b0aSJohannes Berg  * @ac: AC identifier
225231888487SJouni Malinen  * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled
225331888487SJouni Malinen  * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range
225431888487SJouni Malinen  *	1..32767]
225531888487SJouni Malinen  * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range
225631888487SJouni Malinen  *	1..32767]
225731888487SJouni Malinen  * @aifs: Arbitration interframe space [0..255]
225831888487SJouni Malinen  */
225931888487SJouni Malinen struct ieee80211_txq_params {
2260a3304b0aSJohannes Berg 	enum nl80211_ac ac;
226131888487SJouni Malinen 	u16 txop;
226231888487SJouni Malinen 	u16 cwmin;
226331888487SJouni Malinen 	u16 cwmax;
226431888487SJouni Malinen 	u8 aifs;
226531888487SJouni Malinen };
226631888487SJouni Malinen 
2267d70e9693SJohannes Berg /**
2268d70e9693SJohannes Berg  * DOC: Scanning and BSS list handling
2269d70e9693SJohannes Berg  *
2270d70e9693SJohannes Berg  * The scanning process itself is fairly simple, but cfg80211 offers quite
2271d70e9693SJohannes Berg  * a bit of helper functionality. To start a scan, the scan operation will
2272d70e9693SJohannes Berg  * be invoked with a scan definition. This scan definition contains the
2273d70e9693SJohannes Berg  * channels to scan, and the SSIDs to send probe requests for (including the
2274d70e9693SJohannes Berg  * wildcard, if desired). A passive scan is indicated by having no SSIDs to
2275d70e9693SJohannes Berg  * probe. Additionally, a scan request may contain extra information elements
2276d70e9693SJohannes Berg  * that should be added to the probe request. The IEs are guaranteed to be
2277d70e9693SJohannes Berg  * well-formed, and will not exceed the maximum length the driver advertised
2278d70e9693SJohannes Berg  * in the wiphy structure.
2279d70e9693SJohannes Berg  *
2280d70e9693SJohannes Berg  * When scanning finds a BSS, cfg80211 needs to be notified of that, because
2281d70e9693SJohannes Berg  * it is responsible for maintaining the BSS list; the driver should not
2282d70e9693SJohannes Berg  * maintain a list itself. For this notification, various functions exist.
2283d70e9693SJohannes Berg  *
2284d70e9693SJohannes Berg  * Since drivers do not maintain a BSS list, there are also a number of
2285d70e9693SJohannes Berg  * functions to search for a BSS and obtain information about it from the
2286d70e9693SJohannes Berg  * BSS structure cfg80211 maintains. The BSS list is also made available
2287d70e9693SJohannes Berg  * to userspace.
2288d70e9693SJohannes Berg  */
228972bdcf34SJouni Malinen 
2290704232c2SJohannes Berg /**
22912a519311SJohannes Berg  * struct cfg80211_ssid - SSID description
22922a519311SJohannes Berg  * @ssid: the SSID
22932a519311SJohannes Berg  * @ssid_len: length of the ssid
22942a519311SJohannes Berg  */
22952a519311SJohannes Berg struct cfg80211_ssid {
22962a519311SJohannes Berg 	u8 ssid[IEEE80211_MAX_SSID_LEN];
22972a519311SJohannes Berg 	u8 ssid_len;
22982a519311SJohannes Berg };
22992a519311SJohannes Berg 
23002a519311SJohannes Berg /**
23011d76250bSAvraham Stern  * struct cfg80211_scan_info - information about completed scan
23021d76250bSAvraham Stern  * @scan_start_tsf: scan start time in terms of the TSF of the BSS that the
23031d76250bSAvraham Stern  *	wireless device that requested the scan is connected to. If this
23041d76250bSAvraham Stern  *	information is not available, this field is left zero.
23051d76250bSAvraham Stern  * @tsf_bssid: the BSSID according to which %scan_start_tsf is set.
23061d76250bSAvraham Stern  * @aborted: set to true if the scan was aborted for any reason,
23071d76250bSAvraham Stern  *	userspace will be notified of that
23081d76250bSAvraham Stern  */
23091d76250bSAvraham Stern struct cfg80211_scan_info {
23101d76250bSAvraham Stern 	u64 scan_start_tsf;
23111d76250bSAvraham Stern 	u8 tsf_bssid[ETH_ALEN] __aligned(2);
23121d76250bSAvraham Stern 	bool aborted;
23131d76250bSAvraham Stern };
23141d76250bSAvraham Stern 
23151d76250bSAvraham Stern /**
2316c8cb5b85STova Mussai  * struct cfg80211_scan_6ghz_params - relevant for 6 GHz only
2317c8cb5b85STova Mussai  *
2318c8cb5b85STova Mussai  * @short_bssid: short ssid to scan for
2319c8cb5b85STova Mussai  * @bssid: bssid to scan for
2320c8cb5b85STova Mussai  * @channel_idx: idx of the channel in the channel array in the scan request
2321c8cb5b85STova Mussai  *	 which the above info relvant to
2322c8cb5b85STova Mussai  * @unsolicited_probe: the AP transmits unsolicited probe response every 20 TU
2323c8cb5b85STova Mussai  * @short_ssid_valid: short_ssid is valid and can be used
2324c8cb5b85STova Mussai  * @psc_no_listen: when set, and the channel is a PSC channel, no need to wait
2325c8cb5b85STova Mussai  *       20 TUs before starting to send probe requests.
2326c8cb5b85STova Mussai  */
2327c8cb5b85STova Mussai struct cfg80211_scan_6ghz_params {
2328c8cb5b85STova Mussai 	u32 short_ssid;
2329c8cb5b85STova Mussai 	u32 channel_idx;
2330c8cb5b85STova Mussai 	u8 bssid[ETH_ALEN];
2331c8cb5b85STova Mussai 	bool unsolicited_probe;
2332c8cb5b85STova Mussai 	bool short_ssid_valid;
2333c8cb5b85STova Mussai 	bool psc_no_listen;
2334c8cb5b85STova Mussai };
2335c8cb5b85STova Mussai 
2336c8cb5b85STova Mussai /**
23372a519311SJohannes Berg  * struct cfg80211_scan_request - scan request description
23382a519311SJohannes Berg  *
23392a519311SJohannes Berg  * @ssids: SSIDs to scan for (active scan only)
23402a519311SJohannes Berg  * @n_ssids: number of SSIDs
23412a519311SJohannes Berg  * @channels: channels to scan on.
2342ca3dbc20SHelmut Schaa  * @n_channels: total number of channels to scan
2343dcd6eac1SSimon Wunderlich  * @scan_width: channel width for scanning
234470692ad2SJouni Malinen  * @ie: optional information element(s) to add into Probe Request or %NULL
234570692ad2SJouni Malinen  * @ie_len: length of ie in octets
23461d76250bSAvraham Stern  * @duration: how long to listen on each channel, in TUs. If
23471d76250bSAvraham Stern  *	%duration_mandatory is not set, this is the maximum dwell time and
23481d76250bSAvraham Stern  *	the actual dwell time may be shorter.
23491d76250bSAvraham Stern  * @duration_mandatory: if set, the scan duration must be as specified by the
23501d76250bSAvraham Stern  *	%duration field.
2351ed473771SSam Leffler  * @flags: bit field of flags controlling operation
235234850ab2SJohannes Berg  * @rates: bitmap of rates to advertise for each band
23532a519311SJohannes Berg  * @wiphy: the wiphy this was for
235415d6030bSSam Leffler  * @scan_start: time (in jiffies) when the scan started
2355fd014284SJohannes Berg  * @wdev: the wireless device to scan for
23561d76250bSAvraham Stern  * @info: (internal) information about completed scan
23575fe231e8SJohannes Berg  * @notified: (internal) scan request was notified as done or aborted
2358e9f935e3SRajkumar Manoharan  * @no_cck: used to send probe requests at non CCK rate in 2GHz band
2359ad2b26abSJohannes Berg  * @mac_addr: MAC address used with randomisation
2360ad2b26abSJohannes Berg  * @mac_addr_mask: MAC address mask used with randomisation, bits that
2361ad2b26abSJohannes Berg  *	are 0 in the mask should be randomised, bits that are 1 should
2362ad2b26abSJohannes Berg  *	be taken from the @mac_addr
2363c8cb5b85STova Mussai  * @scan_6ghz: relevant for split scan request only,
2364c8cb5b85STova Mussai  *	true if this is the second scan request
2365c8cb5b85STova Mussai  * @n_6ghz_params: number of 6 GHz params
2366c8cb5b85STova Mussai  * @scan_6ghz_params: 6 GHz params
2367818965d3SJouni Malinen  * @bssid: BSSID to scan for (most commonly, the wildcard BSSID)
23682a519311SJohannes Berg  */
23692a519311SJohannes Berg struct cfg80211_scan_request {
23702a519311SJohannes Berg 	struct cfg80211_ssid *ssids;
23712a519311SJohannes Berg 	int n_ssids;
23722a519311SJohannes Berg 	u32 n_channels;
2373dcd6eac1SSimon Wunderlich 	enum nl80211_bss_scan_width scan_width;
2374de95a54bSJohannes Berg 	const u8 *ie;
237570692ad2SJouni Malinen 	size_t ie_len;
23761d76250bSAvraham Stern 	u16 duration;
23771d76250bSAvraham Stern 	bool duration_mandatory;
2378ed473771SSam Leffler 	u32 flags;
23792a519311SJohannes Berg 
238057fbcce3SJohannes Berg 	u32 rates[NUM_NL80211_BANDS];
238134850ab2SJohannes Berg 
2382fd014284SJohannes Berg 	struct wireless_dev *wdev;
2383fd014284SJohannes Berg 
2384ad2b26abSJohannes Berg 	u8 mac_addr[ETH_ALEN] __aligned(2);
2385ad2b26abSJohannes Berg 	u8 mac_addr_mask[ETH_ALEN] __aligned(2);
2386818965d3SJouni Malinen 	u8 bssid[ETH_ALEN] __aligned(2);
2387ad2b26abSJohannes Berg 
23882a519311SJohannes Berg 	/* internal */
23892a519311SJohannes Berg 	struct wiphy *wiphy;
239015d6030bSSam Leffler 	unsigned long scan_start;
23911d76250bSAvraham Stern 	struct cfg80211_scan_info info;
23921d76250bSAvraham Stern 	bool notified;
2393e9f935e3SRajkumar Manoharan 	bool no_cck;
2394c8cb5b85STova Mussai 	bool scan_6ghz;
2395c8cb5b85STova Mussai 	u32 n_6ghz_params;
2396c8cb5b85STova Mussai 	struct cfg80211_scan_6ghz_params *scan_6ghz_params;
23975ba63533SJohannes Berg 
23985ba63533SJohannes Berg 	/* keep last */
2399396fba0aSGustavo A. R. Silva 	struct ieee80211_channel *channels[];
24002a519311SJohannes Berg };
24012a519311SJohannes Berg 
2402ad2b26abSJohannes Berg static inline void get_random_mask_addr(u8 *buf, const u8 *addr, const u8 *mask)
2403ad2b26abSJohannes Berg {
2404ad2b26abSJohannes Berg 	int i;
2405ad2b26abSJohannes Berg 
2406ad2b26abSJohannes Berg 	get_random_bytes(buf, ETH_ALEN);
2407ad2b26abSJohannes Berg 	for (i = 0; i < ETH_ALEN; i++) {
2408ad2b26abSJohannes Berg 		buf[i] &= ~mask[i];
2409ad2b26abSJohannes Berg 		buf[i] |= addr[i] & mask[i];
2410ad2b26abSJohannes Berg 	}
2411ad2b26abSJohannes Berg }
2412ad2b26abSJohannes Berg 
24132a519311SJohannes Berg /**
2414a1f1c21cSLuciano Coelho  * struct cfg80211_match_set - sets of attributes to match
2415a1f1c21cSLuciano Coelho  *
24163007e352SArend Van Spriel  * @ssid: SSID to be matched; may be zero-length in case of BSSID match
24173007e352SArend Van Spriel  *	or no match (RSSI only)
24183007e352SArend Van Spriel  * @bssid: BSSID to be matched; may be all-zero BSSID in case of SSID match
24193007e352SArend Van Spriel  *	or no match (RSSI only)
2420ea73cbceSJohannes Berg  * @rssi_thold: don't report scan results below this threshold (in s32 dBm)
24211e1b11b6Svamsi krishna  * @per_band_rssi_thold: Minimum rssi threshold for each band to be applied
24221e1b11b6Svamsi krishna  *	for filtering out scan results received. Drivers advertize this support
24231e1b11b6Svamsi krishna  *	of band specific rssi based filtering through the feature capability
24241e1b11b6Svamsi krishna  *	%NL80211_EXT_FEATURE_SCHED_SCAN_BAND_SPECIFIC_RSSI_THOLD. These band
24251e1b11b6Svamsi krishna  *	specific rssi thresholds take precedence over rssi_thold, if specified.
24261e1b11b6Svamsi krishna  *	If not specified for any band, it will be assigned with rssi_thold of
24271e1b11b6Svamsi krishna  *	corresponding matchset.
2428a1f1c21cSLuciano Coelho  */
2429a1f1c21cSLuciano Coelho struct cfg80211_match_set {
2430a1f1c21cSLuciano Coelho 	struct cfg80211_ssid ssid;
24313007e352SArend Van Spriel 	u8 bssid[ETH_ALEN];
2432ea73cbceSJohannes Berg 	s32 rssi_thold;
24331e1b11b6Svamsi krishna 	s32 per_band_rssi_thold[NUM_NL80211_BANDS];
2434a1f1c21cSLuciano Coelho };
2435a1f1c21cSLuciano Coelho 
2436a1f1c21cSLuciano Coelho /**
24373b06d277SAvraham Stern  * struct cfg80211_sched_scan_plan - scan plan for scheduled scan
24383b06d277SAvraham Stern  *
24393b06d277SAvraham Stern  * @interval: interval between scheduled scan iterations. In seconds.
24403b06d277SAvraham Stern  * @iterations: number of scan iterations in this scan plan. Zero means
24413b06d277SAvraham Stern  *	infinite loop.
24423b06d277SAvraham Stern  *	The last scan plan will always have this parameter set to zero,
24433b06d277SAvraham Stern  *	all other scan plans will have a finite number of iterations.
24443b06d277SAvraham Stern  */
24453b06d277SAvraham Stern struct cfg80211_sched_scan_plan {
24463b06d277SAvraham Stern 	u32 interval;
24473b06d277SAvraham Stern 	u32 iterations;
24483b06d277SAvraham Stern };
24493b06d277SAvraham Stern 
24503b06d277SAvraham Stern /**
2451bf95ecdbSvamsi krishna  * struct cfg80211_bss_select_adjust - BSS selection with RSSI adjustment.
2452bf95ecdbSvamsi krishna  *
2453bf95ecdbSvamsi krishna  * @band: band of BSS which should match for RSSI level adjustment.
2454bf95ecdbSvamsi krishna  * @delta: value of RSSI level adjustment.
2455bf95ecdbSvamsi krishna  */
2456bf95ecdbSvamsi krishna struct cfg80211_bss_select_adjust {
2457bf95ecdbSvamsi krishna 	enum nl80211_band band;
2458bf95ecdbSvamsi krishna 	s8 delta;
2459bf95ecdbSvamsi krishna };
2460bf95ecdbSvamsi krishna 
2461bf95ecdbSvamsi krishna /**
2462807f8a8cSLuciano Coelho  * struct cfg80211_sched_scan_request - scheduled scan request description
2463807f8a8cSLuciano Coelho  *
246496b08fd6SArend Van Spriel  * @reqid: identifies this request.
2465807f8a8cSLuciano Coelho  * @ssids: SSIDs to scan for (passed in the probe_reqs in active scans)
2466807f8a8cSLuciano Coelho  * @n_ssids: number of SSIDs
2467807f8a8cSLuciano Coelho  * @n_channels: total number of channels to scan
2468dcd6eac1SSimon Wunderlich  * @scan_width: channel width for scanning
2469807f8a8cSLuciano Coelho  * @ie: optional information element(s) to add into Probe Request or %NULL
2470807f8a8cSLuciano Coelho  * @ie_len: length of ie in octets
2471ed473771SSam Leffler  * @flags: bit field of flags controlling operation
2472a1f1c21cSLuciano Coelho  * @match_sets: sets of parameters to be matched for a scan result
2473a1f1c21cSLuciano Coelho  *	entry to be considered valid and to be passed to the host
2474a1f1c21cSLuciano Coelho  *	(others are filtered out).
2475a1f1c21cSLuciano Coelho  *	If ommited, all results are passed.
2476a1f1c21cSLuciano Coelho  * @n_match_sets: number of match sets
24776406c919SJohannes Berg  * @report_results: indicates that results were reported for this request
2478807f8a8cSLuciano Coelho  * @wiphy: the wiphy this was for
2479807f8a8cSLuciano Coelho  * @dev: the interface
2480077f897aSJohannes Berg  * @scan_start: start time of the scheduled scan
2481807f8a8cSLuciano Coelho  * @channels: channels to scan
2482ea73cbceSJohannes Berg  * @min_rssi_thold: for drivers only supporting a single threshold, this
2483ea73cbceSJohannes Berg  *	contains the minimum over all matchsets
2484ad2b26abSJohannes Berg  * @mac_addr: MAC address used with randomisation
2485ad2b26abSJohannes Berg  * @mac_addr_mask: MAC address mask used with randomisation, bits that
2486ad2b26abSJohannes Berg  *	are 0 in the mask should be randomised, bits that are 1 should
2487ad2b26abSJohannes Berg  *	be taken from the @mac_addr
24883b06d277SAvraham Stern  * @scan_plans: scan plans to be executed in this scheduled scan. Lowest
24893b06d277SAvraham Stern  *	index must be executed first.
24903b06d277SAvraham Stern  * @n_scan_plans: number of scan plans, at least 1.
249131a60ed1SJukka Rissanen  * @rcu_head: RCU callback used to free the struct
249293a1e86cSJukka Rissanen  * @owner_nlportid: netlink portid of owner (if this should is a request
249393a1e86cSJukka Rissanen  *	owned by a particular socket)
2494ca986ad9SArend Van Spriel  * @nl_owner_dead: netlink owner socket was closed - this request be freed
2495ca986ad9SArend Van Spriel  * @list: for keeping list of requests.
24969c748934SLuciano Coelho  * @delay: delay in seconds to use before starting the first scan
24979c748934SLuciano Coelho  *	cycle.  The driver may ignore this parameter and start
24989c748934SLuciano Coelho  *	immediately (or at any other time), if this feature is not
24999c748934SLuciano Coelho  *	supported.
2500bf95ecdbSvamsi krishna  * @relative_rssi_set: Indicates whether @relative_rssi is set or not.
2501bf95ecdbSvamsi krishna  * @relative_rssi: Relative RSSI threshold in dB to restrict scan result
2502bf95ecdbSvamsi krishna  *	reporting in connected state to cases where a matching BSS is determined
2503bf95ecdbSvamsi krishna  *	to have better or slightly worse RSSI than the current connected BSS.
2504bf95ecdbSvamsi krishna  *	The relative RSSI threshold values are ignored in disconnected state.
2505bf95ecdbSvamsi krishna  * @rssi_adjust: delta dB of RSSI preference to be given to the BSSs that belong
2506bf95ecdbSvamsi krishna  *	to the specified band while deciding whether a better BSS is reported
2507bf95ecdbSvamsi krishna  *	using @relative_rssi. If delta is a negative number, the BSSs that
2508bf95ecdbSvamsi krishna  *	belong to the specified band will be penalized by delta dB in relative
2509bf95ecdbSvamsi krishna  *	comparisions.
2510807f8a8cSLuciano Coelho  */
2511807f8a8cSLuciano Coelho struct cfg80211_sched_scan_request {
251296b08fd6SArend Van Spriel 	u64 reqid;
2513807f8a8cSLuciano Coelho 	struct cfg80211_ssid *ssids;
2514807f8a8cSLuciano Coelho 	int n_ssids;
2515807f8a8cSLuciano Coelho 	u32 n_channels;
2516dcd6eac1SSimon Wunderlich 	enum nl80211_bss_scan_width scan_width;
2517807f8a8cSLuciano Coelho 	const u8 *ie;
2518807f8a8cSLuciano Coelho 	size_t ie_len;
2519ed473771SSam Leffler 	u32 flags;
2520a1f1c21cSLuciano Coelho 	struct cfg80211_match_set *match_sets;
2521a1f1c21cSLuciano Coelho 	int n_match_sets;
2522ea73cbceSJohannes Berg 	s32 min_rssi_thold;
25239c748934SLuciano Coelho 	u32 delay;
25243b06d277SAvraham Stern 	struct cfg80211_sched_scan_plan *scan_plans;
25253b06d277SAvraham Stern 	int n_scan_plans;
2526807f8a8cSLuciano Coelho 
2527ad2b26abSJohannes Berg 	u8 mac_addr[ETH_ALEN] __aligned(2);
2528ad2b26abSJohannes Berg 	u8 mac_addr_mask[ETH_ALEN] __aligned(2);
2529ad2b26abSJohannes Berg 
2530bf95ecdbSvamsi krishna 	bool relative_rssi_set;
2531bf95ecdbSvamsi krishna 	s8 relative_rssi;
2532bf95ecdbSvamsi krishna 	struct cfg80211_bss_select_adjust rssi_adjust;
2533bf95ecdbSvamsi krishna 
2534807f8a8cSLuciano Coelho 	/* internal */
2535807f8a8cSLuciano Coelho 	struct wiphy *wiphy;
2536807f8a8cSLuciano Coelho 	struct net_device *dev;
253715d6030bSSam Leffler 	unsigned long scan_start;
2538b34939b9SArend Van Spriel 	bool report_results;
253931a60ed1SJukka Rissanen 	struct rcu_head rcu_head;
254093a1e86cSJukka Rissanen 	u32 owner_nlportid;
2541ca986ad9SArend Van Spriel 	bool nl_owner_dead;
2542ca986ad9SArend Van Spriel 	struct list_head list;
2543807f8a8cSLuciano Coelho 
2544807f8a8cSLuciano Coelho 	/* keep last */
2545396fba0aSGustavo A. R. Silva 	struct ieee80211_channel *channels[];
2546807f8a8cSLuciano Coelho };
2547807f8a8cSLuciano Coelho 
2548807f8a8cSLuciano Coelho /**
25492a519311SJohannes Berg  * enum cfg80211_signal_type - signal type
25502a519311SJohannes Berg  *
25512a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available
25522a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm)
25532a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100
25542a519311SJohannes Berg  */
25552a519311SJohannes Berg enum cfg80211_signal_type {
25562a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_NONE,
25572a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_MBM,
25582a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_UNSPEC,
25592a519311SJohannes Berg };
25602a519311SJohannes Berg 
25612a519311SJohannes Berg /**
25626e19bc4bSDmitry Shmidt  * struct cfg80211_inform_bss - BSS inform data
25636e19bc4bSDmitry Shmidt  * @chan: channel the frame was received on
25646e19bc4bSDmitry Shmidt  * @scan_width: scan width that was used
25656e19bc4bSDmitry Shmidt  * @signal: signal strength value, according to the wiphy's
25666e19bc4bSDmitry Shmidt  *	signal type
25676e19bc4bSDmitry Shmidt  * @boottime_ns: timestamp (CLOCK_BOOTTIME) when the information was
25686e19bc4bSDmitry Shmidt  *	received; should match the time when the frame was actually
25696e19bc4bSDmitry Shmidt  *	received by the device (not just by the host, in case it was
25706e19bc4bSDmitry Shmidt  *	buffered on the device) and be accurate to about 10ms.
25716e19bc4bSDmitry Shmidt  *	If the frame isn't buffered, just passing the return value of
25729285ec4cSJason A. Donenfeld  *	ktime_get_boottime_ns() is likely appropriate.
25731d76250bSAvraham Stern  * @parent_tsf: the time at the start of reception of the first octet of the
25741d76250bSAvraham Stern  *	timestamp field of the frame. The time is the TSF of the BSS specified
25751d76250bSAvraham Stern  *	by %parent_bssid.
25761d76250bSAvraham Stern  * @parent_bssid: the BSS according to which %parent_tsf is set. This is set to
25771d76250bSAvraham Stern  *	the BSS that requested the scan in which the beacon/probe was received.
2578983dafaaSSunil Dutt  * @chains: bitmask for filled values in @chain_signal.
2579983dafaaSSunil Dutt  * @chain_signal: per-chain signal strength of last received BSS in dBm.
25806e19bc4bSDmitry Shmidt  */
25816e19bc4bSDmitry Shmidt struct cfg80211_inform_bss {
25826e19bc4bSDmitry Shmidt 	struct ieee80211_channel *chan;
25836e19bc4bSDmitry Shmidt 	enum nl80211_bss_scan_width scan_width;
25846e19bc4bSDmitry Shmidt 	s32 signal;
25856e19bc4bSDmitry Shmidt 	u64 boottime_ns;
25861d76250bSAvraham Stern 	u64 parent_tsf;
25871d76250bSAvraham Stern 	u8 parent_bssid[ETH_ALEN] __aligned(2);
2588983dafaaSSunil Dutt 	u8 chains;
2589983dafaaSSunil Dutt 	s8 chain_signal[IEEE80211_MAX_CHAINS];
25906e19bc4bSDmitry Shmidt };
25916e19bc4bSDmitry Shmidt 
25926e19bc4bSDmitry Shmidt /**
25932aa4d456SAkira Moroo  * struct cfg80211_bss_ies - BSS entry IE data
25948cef2c9dSJohannes Berg  * @tsf: TSF contained in the frame that carried these IEs
25959caf0364SJohannes Berg  * @rcu_head: internal use, for freeing
25969caf0364SJohannes Berg  * @len: length of the IEs
25970e227084SJohannes Berg  * @from_beacon: these IEs are known to come from a beacon
25989caf0364SJohannes Berg  * @data: IE data
25999caf0364SJohannes Berg  */
26009caf0364SJohannes Berg struct cfg80211_bss_ies {
26018cef2c9dSJohannes Berg 	u64 tsf;
26029caf0364SJohannes Berg 	struct rcu_head rcu_head;
26039caf0364SJohannes Berg 	int len;
26040e227084SJohannes Berg 	bool from_beacon;
26059caf0364SJohannes Berg 	u8 data[];
26069caf0364SJohannes Berg };
26079caf0364SJohannes Berg 
26089caf0364SJohannes Berg /**
26092a519311SJohannes Berg  * struct cfg80211_bss - BSS description
26102a519311SJohannes Berg  *
26112a519311SJohannes Berg  * This structure describes a BSS (which may also be a mesh network)
26122a519311SJohannes Berg  * for use in scan results and similar.
26132a519311SJohannes Berg  *
2614abe37c4bSJohannes Berg  * @channel: channel this BSS is on
2615dcd6eac1SSimon Wunderlich  * @scan_width: width of the control channel
26162a519311SJohannes Berg  * @bssid: BSSID of the BSS
26172a519311SJohannes Berg  * @beacon_interval: the beacon interval as from the frame
26182a519311SJohannes Berg  * @capability: the capability field in host byte order
261983c7aa1aSJohannes Berg  * @ies: the information elements (Note that there is no guarantee that these
262083c7aa1aSJohannes Berg  *	are well-formed!); this is a pointer to either the beacon_ies or
262183c7aa1aSJohannes Berg  *	proberesp_ies depending on whether Probe Response frame has been
262283c7aa1aSJohannes Berg  *	received. It is always non-%NULL.
262334a6eddbSJouni Malinen  * @beacon_ies: the information elements from the last Beacon frame
2624776b3580SJohannes Berg  *	(implementation note: if @hidden_beacon_bss is set this struct doesn't
2625776b3580SJohannes Berg  *	own the beacon_ies, but they're just pointers to the ones from the
2626776b3580SJohannes Berg  *	@hidden_beacon_bss struct)
262734a6eddbSJouni Malinen  * @proberesp_ies: the information elements from the last Probe Response frame
2628776b3580SJohannes Berg  * @hidden_beacon_bss: in case this BSS struct represents a probe response from
2629776b3580SJohannes Berg  *	a BSS that hides the SSID in its beacon, this points to the BSS struct
2630776b3580SJohannes Berg  *	that holds the beacon data. @beacon_ies is still valid, of course, and
2631776b3580SJohannes Berg  *	points to the same data as hidden_beacon_bss->beacon_ies in that case.
2632851ae31dSJohannes Berg  * @transmitted_bss: pointer to the transmitted BSS, if this is a
2633851ae31dSJohannes Berg  *	non-transmitted one (multi-BSSID support)
2634851ae31dSJohannes Berg  * @nontrans_list: list of non-transmitted BSS, if this is a transmitted one
2635851ae31dSJohannes Berg  *	(multi-BSSID support)
263677965c97SJohannes Berg  * @signal: signal strength value (type depends on the wiphy's signal_type)
2637983dafaaSSunil Dutt  * @chains: bitmask for filled values in @chain_signal.
2638983dafaaSSunil Dutt  * @chain_signal: per-chain signal strength of last received BSS in dBm.
26390cd01efbSSara Sharon  * @bssid_index: index in the multiple BSS set
26400cd01efbSSara Sharon  * @max_bssid_indicator: max number of members in the BSS set
26412a519311SJohannes Berg  * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
26422a519311SJohannes Berg  */
26432a519311SJohannes Berg struct cfg80211_bss {
26442a519311SJohannes Berg 	struct ieee80211_channel *channel;
2645dcd6eac1SSimon Wunderlich 	enum nl80211_bss_scan_width scan_width;
26462a519311SJohannes Berg 
26479caf0364SJohannes Berg 	const struct cfg80211_bss_ies __rcu *ies;
26489caf0364SJohannes Berg 	const struct cfg80211_bss_ies __rcu *beacon_ies;
26499caf0364SJohannes Berg 	const struct cfg80211_bss_ies __rcu *proberesp_ies;
26509caf0364SJohannes Berg 
2651776b3580SJohannes Berg 	struct cfg80211_bss *hidden_beacon_bss;
26527011ba58SSara Sharon 	struct cfg80211_bss *transmitted_bss;
26537011ba58SSara Sharon 	struct list_head nontrans_list;
26542a519311SJohannes Berg 
26552a519311SJohannes Berg 	s32 signal;
26562a519311SJohannes Berg 
26579caf0364SJohannes Berg 	u16 beacon_interval;
26589caf0364SJohannes Berg 	u16 capability;
26599caf0364SJohannes Berg 
26609caf0364SJohannes Berg 	u8 bssid[ETH_ALEN];
2661983dafaaSSunil Dutt 	u8 chains;
2662983dafaaSSunil Dutt 	s8 chain_signal[IEEE80211_MAX_CHAINS];
26639caf0364SJohannes Berg 
26640cd01efbSSara Sharon 	u8 bssid_index;
26650cd01efbSSara Sharon 	u8 max_bssid_indicator;
26660cd01efbSSara Sharon 
2667396fba0aSGustavo A. R. Silva 	u8 priv[] __aligned(sizeof(void *));
26682a519311SJohannes Berg };
26692a519311SJohannes Berg 
26702a519311SJohannes Berg /**
267149a68e0dSJohannes Berg  * ieee80211_bss_get_elem - find element with given ID
2672517357c6SJohannes Berg  * @bss: the bss to search
267349a68e0dSJohannes Berg  * @id: the element ID
26749caf0364SJohannes Berg  *
26759caf0364SJohannes Berg  * Note that the return value is an RCU-protected pointer, so
26769caf0364SJohannes Berg  * rcu_read_lock() must be held when calling this function.
26770ae997dcSYacine Belkadi  * Return: %NULL if not found.
2678517357c6SJohannes Berg  */
267949a68e0dSJohannes Berg const struct element *ieee80211_bss_get_elem(struct cfg80211_bss *bss, u8 id);
268049a68e0dSJohannes Berg 
268149a68e0dSJohannes Berg /**
268249a68e0dSJohannes Berg  * ieee80211_bss_get_ie - find IE with given ID
268349a68e0dSJohannes Berg  * @bss: the bss to search
268449a68e0dSJohannes Berg  * @id: the element ID
268549a68e0dSJohannes Berg  *
268649a68e0dSJohannes Berg  * Note that the return value is an RCU-protected pointer, so
268749a68e0dSJohannes Berg  * rcu_read_lock() must be held when calling this function.
268849a68e0dSJohannes Berg  * Return: %NULL if not found.
268949a68e0dSJohannes Berg  */
269049a68e0dSJohannes Berg static inline const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 id)
269149a68e0dSJohannes Berg {
26927e367b06SJohannes Berg 	return (const void *)ieee80211_bss_get_elem(bss, id);
269349a68e0dSJohannes Berg }
2694517357c6SJohannes Berg 
2695517357c6SJohannes Berg 
2696517357c6SJohannes Berg /**
2697636a5d36SJouni Malinen  * struct cfg80211_auth_request - Authentication request data
2698636a5d36SJouni Malinen  *
2699636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
2700636a5d36SJouni Malinen  * authentication.
2701636a5d36SJouni Malinen  *
2702959867faSJohannes Berg  * @bss: The BSS to authenticate with, the callee must obtain a reference
2703959867faSJohannes Berg  *	to it if it needs to keep it.
2704636a5d36SJouni Malinen  * @auth_type: Authentication type (algorithm)
2705636a5d36SJouni Malinen  * @ie: Extra IEs to add to Authentication frame or %NULL
2706636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
2707fffd0934SJohannes Berg  * @key_len: length of WEP key for shared key authentication
2708fffd0934SJohannes Berg  * @key_idx: index of WEP key for shared key authentication
2709fffd0934SJohannes Berg  * @key: WEP key for shared key authentication
271011b6b5a4SJouni Malinen  * @auth_data: Fields and elements in Authentication frames. This contains
271111b6b5a4SJouni Malinen  *	the authentication frame body (non-IE and IE data), excluding the
271211b6b5a4SJouni Malinen  *	Authentication algorithm number, i.e., starting at the Authentication
271311b6b5a4SJouni Malinen  *	transaction sequence number field.
271411b6b5a4SJouni Malinen  * @auth_data_len: Length of auth_data buffer in octets
2715636a5d36SJouni Malinen  */
2716636a5d36SJouni Malinen struct cfg80211_auth_request {
271719957bb3SJohannes Berg 	struct cfg80211_bss *bss;
2718636a5d36SJouni Malinen 	const u8 *ie;
2719636a5d36SJouni Malinen 	size_t ie_len;
272019957bb3SJohannes Berg 	enum nl80211_auth_type auth_type;
2721fffd0934SJohannes Berg 	const u8 *key;
2722fffd0934SJohannes Berg 	u8 key_len, key_idx;
272311b6b5a4SJouni Malinen 	const u8 *auth_data;
272411b6b5a4SJouni Malinen 	size_t auth_data_len;
2725636a5d36SJouni Malinen };
2726636a5d36SJouni Malinen 
2727636a5d36SJouni Malinen /**
27287e7c8926SBen Greear  * enum cfg80211_assoc_req_flags - Over-ride default behaviour in association.
27297e7c8926SBen Greear  *
27307e7c8926SBen Greear  * @ASSOC_REQ_DISABLE_HT:  Disable HT (802.11n)
2731ee2aca34SJohannes Berg  * @ASSOC_REQ_DISABLE_VHT:  Disable VHT
2732bab5ab7dSAssaf Krauss  * @ASSOC_REQ_USE_RRM: Declare RRM capability in this association
273340cbfa90SSrinivas Dasari  * @CONNECT_REQ_EXTERNAL_AUTH_SUPPORT: User space indicates external
273440cbfa90SSrinivas Dasari  *	authentication capability. Drivers can offload authentication to
273540cbfa90SSrinivas Dasari  *	userspace if this flag is set. Only applicable for cfg80211_connect()
273640cbfa90SSrinivas Dasari  *	request (connect callback).
2737b6db0f89SBen Greear  * @ASSOC_REQ_DISABLE_HE:  Disable HE
27387e7c8926SBen Greear  */
27397e7c8926SBen Greear enum cfg80211_assoc_req_flags {
27407e7c8926SBen Greear 	ASSOC_REQ_DISABLE_HT			= BIT(0),
2741ee2aca34SJohannes Berg 	ASSOC_REQ_DISABLE_VHT			= BIT(1),
2742bab5ab7dSAssaf Krauss 	ASSOC_REQ_USE_RRM			= BIT(2),
274340cbfa90SSrinivas Dasari 	CONNECT_REQ_EXTERNAL_AUTH_SUPPORT	= BIT(3),
2744b6db0f89SBen Greear 	ASSOC_REQ_DISABLE_HE			= BIT(4),
27457e7c8926SBen Greear };
27467e7c8926SBen Greear 
27477e7c8926SBen Greear /**
2748636a5d36SJouni Malinen  * struct cfg80211_assoc_request - (Re)Association request data
2749636a5d36SJouni Malinen  *
2750636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
2751636a5d36SJouni Malinen  * (re)association.
2752959867faSJohannes Berg  * @bss: The BSS to associate with. If the call is successful the driver is
2753959867faSJohannes Berg  *	given a reference that it must give back to cfg80211_send_rx_assoc()
2754959867faSJohannes Berg  *	or to cfg80211_assoc_timeout(). To ensure proper refcounting, new
2755959867faSJohannes Berg  *	association requests while already associating must be rejected.
2756636a5d36SJouni Malinen  * @ie: Extra IEs to add to (Re)Association Request frame or %NULL
2757636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
2758dc6382ceSJouni Malinen  * @use_mfp: Use management frame protection (IEEE 802.11w) in this association
2759b23aa676SSamuel Ortiz  * @crypto: crypto settings
276035eb8f7bSJouni Malinen  * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used
276135eb8f7bSJouni Malinen  *	to indicate a request to reassociate within the ESS instead of a request
276235eb8f7bSJouni Malinen  *	do the initial association with the ESS. When included, this is set to
276335eb8f7bSJouni Malinen  *	the BSSID of the current association, i.e., to the value that is
276435eb8f7bSJouni Malinen  *	included in the Current AP address field of the Reassociation Request
276535eb8f7bSJouni Malinen  *	frame.
27667e7c8926SBen Greear  * @flags:  See &enum cfg80211_assoc_req_flags
27677e7c8926SBen Greear  * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask
27687e7c8926SBen Greear  *	will be used in ht_capa.  Un-supported values will be ignored.
27697e7c8926SBen Greear  * @ht_capa_mask:  The bits of ht_capa which are to be used.
2770ee2aca34SJohannes Berg  * @vht_capa: VHT capability override
2771ee2aca34SJohannes Berg  * @vht_capa_mask: VHT capability mask indicating which fields to use
2772348bd456SJouni Malinen  * @fils_kek: FILS KEK for protecting (Re)Association Request/Response frame or
2773348bd456SJouni Malinen  *	%NULL if FILS is not used.
2774348bd456SJouni Malinen  * @fils_kek_len: Length of fils_kek in octets
2775348bd456SJouni Malinen  * @fils_nonces: FILS nonces (part of AAD) for protecting (Re)Association
2776348bd456SJouni Malinen  *	Request/Response frame or %NULL if FILS is not used. This field starts
2777348bd456SJouni Malinen  *	with 16 octets of STA Nonce followed by 16 octets of AP Nonce.
2778d2b7588aSThomas Pedersen  * @s1g_capa: S1G capability override
2779d2b7588aSThomas Pedersen  * @s1g_capa_mask: S1G capability override mask
2780636a5d36SJouni Malinen  */
2781636a5d36SJouni Malinen struct cfg80211_assoc_request {
278219957bb3SJohannes Berg 	struct cfg80211_bss *bss;
27833e5d7649SJohannes Berg 	const u8 *ie, *prev_bssid;
2784636a5d36SJouni Malinen 	size_t ie_len;
2785b23aa676SSamuel Ortiz 	struct cfg80211_crypto_settings crypto;
278619957bb3SJohannes Berg 	bool use_mfp;
27877e7c8926SBen Greear 	u32 flags;
27887e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa;
27897e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa_mask;
2790ee2aca34SJohannes Berg 	struct ieee80211_vht_cap vht_capa, vht_capa_mask;
2791348bd456SJouni Malinen 	const u8 *fils_kek;
2792348bd456SJouni Malinen 	size_t fils_kek_len;
2793348bd456SJouni Malinen 	const u8 *fils_nonces;
2794d2b7588aSThomas Pedersen 	struct ieee80211_s1g_cap s1g_capa, s1g_capa_mask;
2795636a5d36SJouni Malinen };
2796636a5d36SJouni Malinen 
2797636a5d36SJouni Malinen /**
2798636a5d36SJouni Malinen  * struct cfg80211_deauth_request - Deauthentication request data
2799636a5d36SJouni Malinen  *
2800636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
2801636a5d36SJouni Malinen  * deauthentication.
2802636a5d36SJouni Malinen  *
280395de817bSJohannes Berg  * @bssid: the BSSID of the BSS to deauthenticate from
2804636a5d36SJouni Malinen  * @ie: Extra IEs to add to Deauthentication frame or %NULL
2805636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
280619957bb3SJohannes Berg  * @reason_code: The reason code for the deauthentication
2807077f897aSJohannes Berg  * @local_state_change: if set, change local state only and
2808077f897aSJohannes Berg  *	do not set a deauth frame
2809636a5d36SJouni Malinen  */
2810636a5d36SJouni Malinen struct cfg80211_deauth_request {
281195de817bSJohannes Berg 	const u8 *bssid;
2812636a5d36SJouni Malinen 	const u8 *ie;
2813636a5d36SJouni Malinen 	size_t ie_len;
281419957bb3SJohannes Berg 	u16 reason_code;
28156863255bSStanislaw Gruszka 	bool local_state_change;
2816636a5d36SJouni Malinen };
2817636a5d36SJouni Malinen 
2818636a5d36SJouni Malinen /**
2819636a5d36SJouni Malinen  * struct cfg80211_disassoc_request - Disassociation request data
2820636a5d36SJouni Malinen  *
2821636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
282266f00449SMasahiro Yamada  * disassociation.
2823636a5d36SJouni Malinen  *
282419957bb3SJohannes Berg  * @bss: the BSS to disassociate from
2825636a5d36SJouni Malinen  * @ie: Extra IEs to add to Disassociation frame or %NULL
2826636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
282719957bb3SJohannes Berg  * @reason_code: The reason code for the disassociation
2828d5cdfacbSJouni Malinen  * @local_state_change: This is a request for a local state only, i.e., no
2829d5cdfacbSJouni Malinen  *	Disassociation frame is to be transmitted.
2830636a5d36SJouni Malinen  */
2831636a5d36SJouni Malinen struct cfg80211_disassoc_request {
283219957bb3SJohannes Berg 	struct cfg80211_bss *bss;
2833636a5d36SJouni Malinen 	const u8 *ie;
2834636a5d36SJouni Malinen 	size_t ie_len;
283519957bb3SJohannes Berg 	u16 reason_code;
2836d5cdfacbSJouni Malinen 	bool local_state_change;
2837636a5d36SJouni Malinen };
2838636a5d36SJouni Malinen 
2839636a5d36SJouni Malinen /**
284004a773adSJohannes Berg  * struct cfg80211_ibss_params - IBSS parameters
284104a773adSJohannes Berg  *
284204a773adSJohannes Berg  * This structure defines the IBSS parameters for the join_ibss()
284304a773adSJohannes Berg  * method.
284404a773adSJohannes Berg  *
284504a773adSJohannes Berg  * @ssid: The SSID, will always be non-null.
284604a773adSJohannes Berg  * @ssid_len: The length of the SSID, will always be non-zero.
284704a773adSJohannes Berg  * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not
284804a773adSJohannes Berg  *	search for IBSSs with a different BSSID.
2849683b6d3bSJohannes Berg  * @chandef: defines the channel to use if no other IBSS to join can be found
285004a773adSJohannes Berg  * @channel_fixed: The channel should be fixed -- do not search for
285104a773adSJohannes Berg  *	IBSSs to join on other channels.
285204a773adSJohannes Berg  * @ie: information element(s) to include in the beacon
285304a773adSJohannes Berg  * @ie_len: length of that
28548e30bc55SJohannes Berg  * @beacon_interval: beacon interval to use
2855fffd0934SJohannes Berg  * @privacy: this is a protected network, keys will be configured
2856fffd0934SJohannes Berg  *	after joining
2857267335d6SAntonio Quartulli  * @control_port: whether user space controls IEEE 802.1X port, i.e.,
2858267335d6SAntonio Quartulli  *	sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
2859267335d6SAntonio Quartulli  *	required to assume that the port is unauthorized until authorized by
2860267335d6SAntonio Quartulli  *	user space. Otherwise, port is marked authorized by default.
2861c3bfe1f6SDenis Kenzior  * @control_port_over_nl80211: TRUE if userspace expects to exchange control
2862c3bfe1f6SDenis Kenzior  *	port frames over NL80211 instead of the network interface.
28635336fa88SSimon Wunderlich  * @userspace_handles_dfs: whether user space controls DFS operation, i.e.
28645336fa88SSimon Wunderlich  *	changes the channel when a radar is detected. This is required
28655336fa88SSimon Wunderlich  *	to operate on DFS channels.
2866fbd2c8dcSTeemu Paasikivi  * @basic_rates: bitmap of basic rates to use when creating the IBSS
2867dd5b4cc7SFelix Fietkau  * @mcast_rate: per-band multicast rate index + 1 (0: disabled)
2868803768f5SSimon Wunderlich  * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask
2869803768f5SSimon Wunderlich  *	will be used in ht_capa.  Un-supported values will be ignored.
2870803768f5SSimon Wunderlich  * @ht_capa_mask:  The bits of ht_capa which are to be used.
28719ae3b172STova Mussai  * @wep_keys: static WEP keys, if not NULL points to an array of
28729ae3b172STova Mussai  *	CFG80211_MAX_WEP_KEYS WEP keys
28739ae3b172STova Mussai  * @wep_tx_key: key index (0..3) of the default TX static WEP key
287404a773adSJohannes Berg  */
287504a773adSJohannes Berg struct cfg80211_ibss_params {
2876c1e5f471SJohannes Berg 	const u8 *ssid;
2877c1e5f471SJohannes Berg 	const u8 *bssid;
2878683b6d3bSJohannes Berg 	struct cfg80211_chan_def chandef;
2879c1e5f471SJohannes Berg 	const u8 *ie;
288004a773adSJohannes Berg 	u8 ssid_len, ie_len;
28818e30bc55SJohannes Berg 	u16 beacon_interval;
2882fbd2c8dcSTeemu Paasikivi 	u32 basic_rates;
288304a773adSJohannes Berg 	bool channel_fixed;
2884fffd0934SJohannes Berg 	bool privacy;
2885267335d6SAntonio Quartulli 	bool control_port;
2886c3bfe1f6SDenis Kenzior 	bool control_port_over_nl80211;
28875336fa88SSimon Wunderlich 	bool userspace_handles_dfs;
288857fbcce3SJohannes Berg 	int mcast_rate[NUM_NL80211_BANDS];
2889803768f5SSimon Wunderlich 	struct ieee80211_ht_cap ht_capa;
2890803768f5SSimon Wunderlich 	struct ieee80211_ht_cap ht_capa_mask;
28919ae3b172STova Mussai 	struct key_params *wep_keys;
28929ae3b172STova Mussai 	int wep_tx_key;
289304a773adSJohannes Berg };
289404a773adSJohannes Berg 
289504a773adSJohannes Berg /**
289638de03d2SArend van Spriel  * struct cfg80211_bss_selection - connection parameters for BSS selection.
289738de03d2SArend van Spriel  *
289838de03d2SArend van Spriel  * @behaviour: requested BSS selection behaviour.
289938de03d2SArend van Spriel  * @param: parameters for requestion behaviour.
290038de03d2SArend van Spriel  * @band_pref: preferred band for %NL80211_BSS_SELECT_ATTR_BAND_PREF.
290138de03d2SArend van Spriel  * @adjust: parameters for %NL80211_BSS_SELECT_ATTR_RSSI_ADJUST.
290238de03d2SArend van Spriel  */
290338de03d2SArend van Spriel struct cfg80211_bss_selection {
290438de03d2SArend van Spriel 	enum nl80211_bss_select_attr behaviour;
290538de03d2SArend van Spriel 	union {
290657fbcce3SJohannes Berg 		enum nl80211_band band_pref;
290738de03d2SArend van Spriel 		struct cfg80211_bss_select_adjust adjust;
290838de03d2SArend van Spriel 	} param;
290938de03d2SArend van Spriel };
291038de03d2SArend van Spriel 
291138de03d2SArend van Spriel /**
2912b23aa676SSamuel Ortiz  * struct cfg80211_connect_params - Connection parameters
2913b23aa676SSamuel Ortiz  *
2914b23aa676SSamuel Ortiz  * This structure provides information needed to complete IEEE 802.11
2915b23aa676SSamuel Ortiz  * authentication and association.
2916b23aa676SSamuel Ortiz  *
2917b23aa676SSamuel Ortiz  * @channel: The channel to use or %NULL if not specified (auto-select based
2918b23aa676SSamuel Ortiz  *	on scan results)
29191df4a510SJouni Malinen  * @channel_hint: The channel of the recommended BSS for initial connection or
29201df4a510SJouni Malinen  *	%NULL if not specified
2921b23aa676SSamuel Ortiz  * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan
2922b23aa676SSamuel Ortiz  *	results)
29231df4a510SJouni Malinen  * @bssid_hint: The recommended AP BSSID for initial connection to the BSS or
29241df4a510SJouni Malinen  *	%NULL if not specified. Unlike the @bssid parameter, the driver is
29251df4a510SJouni Malinen  *	allowed to ignore this @bssid_hint if it has knowledge of a better BSS
29261df4a510SJouni Malinen  *	to use.
2927b23aa676SSamuel Ortiz  * @ssid: SSID
2928b23aa676SSamuel Ortiz  * @ssid_len: Length of ssid in octets
2929b23aa676SSamuel Ortiz  * @auth_type: Authentication type (algorithm)
2930abe37c4bSJohannes Berg  * @ie: IEs for association request
2931abe37c4bSJohannes Berg  * @ie_len: Length of assoc_ie in octets
2932b23aa676SSamuel Ortiz  * @privacy: indicates whether privacy-enabled APs should be used
2933cee00a95SJouni Malinen  * @mfp: indicate whether management frame protection is used
2934b23aa676SSamuel Ortiz  * @crypto: crypto settings
2935fffd0934SJohannes Berg  * @key_len: length of WEP key for shared key authentication
2936fffd0934SJohannes Berg  * @key_idx: index of WEP key for shared key authentication
2937fffd0934SJohannes Berg  * @key: WEP key for shared key authentication
29387e7c8926SBen Greear  * @flags:  See &enum cfg80211_assoc_req_flags
29394486ea98SBala Shanmugam  * @bg_scan_period:  Background scan period in seconds
29404486ea98SBala Shanmugam  *	or -1 to indicate that default value is to be used.
29417e7c8926SBen Greear  * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask
29427e7c8926SBen Greear  *	will be used in ht_capa.  Un-supported values will be ignored.
29437e7c8926SBen Greear  * @ht_capa_mask:  The bits of ht_capa which are to be used.
2944ee2aca34SJohannes Berg  * @vht_capa:  VHT Capability overrides
2945ee2aca34SJohannes Berg  * @vht_capa_mask: The bits of vht_capa which are to be used.
294634d50519SLior David  * @pbss: if set, connect to a PCP instead of AP. Valid for DMG
294734d50519SLior David  *	networks.
294838de03d2SArend van Spriel  * @bss_select: criteria to be used for BSS selection.
294935eb8f7bSJouni Malinen  * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used
295035eb8f7bSJouni Malinen  *	to indicate a request to reassociate within the ESS instead of a request
295135eb8f7bSJouni Malinen  *	do the initial association with the ESS. When included, this is set to
295235eb8f7bSJouni Malinen  *	the BSSID of the current association, i.e., to the value that is
295335eb8f7bSJouni Malinen  *	included in the Current AP address field of the Reassociation Request
295435eb8f7bSJouni Malinen  *	frame.
2955a3caf744SVidyullatha Kanchanapally  * @fils_erp_username: EAP re-authentication protocol (ERP) username part of the
2956a3caf744SVidyullatha Kanchanapally  *	NAI or %NULL if not specified. This is used to construct FILS wrapped
2957a3caf744SVidyullatha Kanchanapally  *	data IE.
2958a3caf744SVidyullatha Kanchanapally  * @fils_erp_username_len: Length of @fils_erp_username in octets.
2959a3caf744SVidyullatha Kanchanapally  * @fils_erp_realm: EAP re-authentication protocol (ERP) realm part of NAI or
2960a3caf744SVidyullatha Kanchanapally  *	%NULL if not specified. This specifies the domain name of ER server and
2961a3caf744SVidyullatha Kanchanapally  *	is used to construct FILS wrapped data IE.
2962a3caf744SVidyullatha Kanchanapally  * @fils_erp_realm_len: Length of @fils_erp_realm in octets.
2963a3caf744SVidyullatha Kanchanapally  * @fils_erp_next_seq_num: The next sequence number to use in the FILS ERP
2964a3caf744SVidyullatha Kanchanapally  *	messages. This is also used to construct FILS wrapped data IE.
2965a3caf744SVidyullatha Kanchanapally  * @fils_erp_rrk: ERP re-authentication Root Key (rRK) used to derive additional
2966a3caf744SVidyullatha Kanchanapally  *	keys in FILS or %NULL if not specified.
2967a3caf744SVidyullatha Kanchanapally  * @fils_erp_rrk_len: Length of @fils_erp_rrk in octets.
29683a00df57SAvraham Stern  * @want_1x: indicates user-space supports and wants to use 802.1X driver
29693a00df57SAvraham Stern  *	offload of 4-way handshake.
29702a38075cSAlexei Avshalom Lazar  * @edmg: define the EDMG channels.
29712a38075cSAlexei Avshalom Lazar  *	This may specify multiple channels and bonding options for the driver
29722a38075cSAlexei Avshalom Lazar  *	to choose from, based on BSS configuration.
2973b23aa676SSamuel Ortiz  */
2974b23aa676SSamuel Ortiz struct cfg80211_connect_params {
2975b23aa676SSamuel Ortiz 	struct ieee80211_channel *channel;
29761df4a510SJouni Malinen 	struct ieee80211_channel *channel_hint;
2977664834deSJouni Malinen 	const u8 *bssid;
29781df4a510SJouni Malinen 	const u8 *bssid_hint;
2979664834deSJouni Malinen 	const u8 *ssid;
2980b23aa676SSamuel Ortiz 	size_t ssid_len;
2981b23aa676SSamuel Ortiz 	enum nl80211_auth_type auth_type;
29824b5800feSJohannes Berg 	const u8 *ie;
2983b23aa676SSamuel Ortiz 	size_t ie_len;
2984b23aa676SSamuel Ortiz 	bool privacy;
2985cee00a95SJouni Malinen 	enum nl80211_mfp mfp;
2986b23aa676SSamuel Ortiz 	struct cfg80211_crypto_settings crypto;
2987fffd0934SJohannes Berg 	const u8 *key;
2988fffd0934SJohannes Berg 	u8 key_len, key_idx;
29897e7c8926SBen Greear 	u32 flags;
29904486ea98SBala Shanmugam 	int bg_scan_period;
29917e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa;
29927e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa_mask;
2993ee2aca34SJohannes Berg 	struct ieee80211_vht_cap vht_capa;
2994ee2aca34SJohannes Berg 	struct ieee80211_vht_cap vht_capa_mask;
299534d50519SLior David 	bool pbss;
299638de03d2SArend van Spriel 	struct cfg80211_bss_selection bss_select;
2997ba6fbacfSJouni Malinen 	const u8 *prev_bssid;
2998a3caf744SVidyullatha Kanchanapally 	const u8 *fils_erp_username;
2999a3caf744SVidyullatha Kanchanapally 	size_t fils_erp_username_len;
3000a3caf744SVidyullatha Kanchanapally 	const u8 *fils_erp_realm;
3001a3caf744SVidyullatha Kanchanapally 	size_t fils_erp_realm_len;
3002a3caf744SVidyullatha Kanchanapally 	u16 fils_erp_next_seq_num;
3003a3caf744SVidyullatha Kanchanapally 	const u8 *fils_erp_rrk;
3004a3caf744SVidyullatha Kanchanapally 	size_t fils_erp_rrk_len;
30053a00df57SAvraham Stern 	bool want_1x;
30062a38075cSAlexei Avshalom Lazar 	struct ieee80211_edmg edmg;
3007b23aa676SSamuel Ortiz };
3008b23aa676SSamuel Ortiz 
3009b23aa676SSamuel Ortiz /**
3010088e8df8Svamsi krishna  * enum cfg80211_connect_params_changed - Connection parameters being updated
3011088e8df8Svamsi krishna  *
3012088e8df8Svamsi krishna  * This enum provides information of all connect parameters that
3013088e8df8Svamsi krishna  * have to be updated as part of update_connect_params() call.
3014088e8df8Svamsi krishna  *
3015088e8df8Svamsi krishna  * @UPDATE_ASSOC_IES: Indicates whether association request IEs are updated
30167f9a3e15SVidyullatha Kanchanapally  * @UPDATE_FILS_ERP_INFO: Indicates that FILS connection parameters (realm,
30177f9a3e15SVidyullatha Kanchanapally  *	username, erp sequence number and rrk) are updated
30187f9a3e15SVidyullatha Kanchanapally  * @UPDATE_AUTH_TYPE: Indicates that authentication type is updated
3019088e8df8Svamsi krishna  */
3020088e8df8Svamsi krishna enum cfg80211_connect_params_changed {
3021088e8df8Svamsi krishna 	UPDATE_ASSOC_IES		= BIT(0),
30227f9a3e15SVidyullatha Kanchanapally 	UPDATE_FILS_ERP_INFO		= BIT(1),
30237f9a3e15SVidyullatha Kanchanapally 	UPDATE_AUTH_TYPE		= BIT(2),
3024088e8df8Svamsi krishna };
3025088e8df8Svamsi krishna 
3026088e8df8Svamsi krishna /**
3027b9a5f8caSJouni Malinen  * enum wiphy_params_flags - set_wiphy_params bitfield values
3028abe37c4bSJohannes Berg  * @WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed
3029abe37c4bSJohannes Berg  * @WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed
3030abe37c4bSJohannes Berg  * @WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed
3031abe37c4bSJohannes Berg  * @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed
3032abe37c4bSJohannes Berg  * @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed
30333057dbfdSLorenzo Bianconi  * @WIPHY_PARAM_DYN_ACK: dynack has been enabled
303452539ca8SToke Høiland-Jørgensen  * @WIPHY_PARAM_TXQ_LIMIT: TXQ packet limit has been changed
303552539ca8SToke Høiland-Jørgensen  * @WIPHY_PARAM_TXQ_MEMORY_LIMIT: TXQ memory limit has been changed
303652539ca8SToke Høiland-Jørgensen  * @WIPHY_PARAM_TXQ_QUANTUM: TXQ scheduler quantum
3037b9a5f8caSJouni Malinen  */
3038b9a5f8caSJouni Malinen enum wiphy_params_flags {
3039b9a5f8caSJouni Malinen 	WIPHY_PARAM_RETRY_SHORT		= 1 << 0,
3040b9a5f8caSJouni Malinen 	WIPHY_PARAM_RETRY_LONG		= 1 << 1,
3041b9a5f8caSJouni Malinen 	WIPHY_PARAM_FRAG_THRESHOLD	= 1 << 2,
3042b9a5f8caSJouni Malinen 	WIPHY_PARAM_RTS_THRESHOLD	= 1 << 3,
304381077e82SLukáš Turek 	WIPHY_PARAM_COVERAGE_CLASS	= 1 << 4,
30443057dbfdSLorenzo Bianconi 	WIPHY_PARAM_DYN_ACK		= 1 << 5,
304552539ca8SToke Høiland-Jørgensen 	WIPHY_PARAM_TXQ_LIMIT		= 1 << 6,
304652539ca8SToke Høiland-Jørgensen 	WIPHY_PARAM_TXQ_MEMORY_LIMIT	= 1 << 7,
304752539ca8SToke Høiland-Jørgensen 	WIPHY_PARAM_TXQ_QUANTUM		= 1 << 8,
3048b9a5f8caSJouni Malinen };
3049b9a5f8caSJouni Malinen 
305036647055SToke Høiland-Jørgensen #define IEEE80211_DEFAULT_AIRTIME_WEIGHT	256
305136647055SToke Høiland-Jørgensen 
30523ace10f5SKan Yan /* The per TXQ device queue limit in airtime */
30533ace10f5SKan Yan #define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_L	5000
30543ace10f5SKan Yan #define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_H	12000
30553ace10f5SKan Yan 
30563ace10f5SKan Yan /* The per interface airtime threshold to switch to lower queue limit */
30573ace10f5SKan Yan #define IEEE80211_AQL_THRESHOLD			24000
30583ace10f5SKan Yan 
305967fbb16bSSamuel Ortiz /**
306067fbb16bSSamuel Ortiz  * struct cfg80211_pmksa - PMK Security Association
306167fbb16bSSamuel Ortiz  *
306267fbb16bSSamuel Ortiz  * This structure is passed to the set/del_pmksa() method for PMKSA
306367fbb16bSSamuel Ortiz  * caching.
306467fbb16bSSamuel Ortiz  *
3065a3caf744SVidyullatha Kanchanapally  * @bssid: The AP's BSSID (may be %NULL).
3066a3caf744SVidyullatha Kanchanapally  * @pmkid: The identifier to refer a PMKSA.
3067a3caf744SVidyullatha Kanchanapally  * @pmk: The PMK for the PMKSA identified by @pmkid. This is used for key
3068a3caf744SVidyullatha Kanchanapally  *	derivation by a FILS STA. Otherwise, %NULL.
3069a3caf744SVidyullatha Kanchanapally  * @pmk_len: Length of the @pmk. The length of @pmk can differ depending on
3070a3caf744SVidyullatha Kanchanapally  *	the hash algorithm used to generate this.
3071a3caf744SVidyullatha Kanchanapally  * @ssid: SSID to specify the ESS within which a PMKSA is valid when using FILS
3072a3caf744SVidyullatha Kanchanapally  *	cache identifier (may be %NULL).
3073a3caf744SVidyullatha Kanchanapally  * @ssid_len: Length of the @ssid in octets.
3074a3caf744SVidyullatha Kanchanapally  * @cache_id: 2-octet cache identifier advertized by a FILS AP identifying the
3075a3caf744SVidyullatha Kanchanapally  *	scope of PMKSA. This is valid only if @ssid_len is non-zero (may be
3076a3caf744SVidyullatha Kanchanapally  *	%NULL).
30777fc82af8SVeerendranath Jakkam  * @pmk_lifetime: Maximum lifetime for PMKSA in seconds
30787fc82af8SVeerendranath Jakkam  *	(dot11RSNAConfigPMKLifetime) or 0 if not specified.
30797fc82af8SVeerendranath Jakkam  *	The configured PMKSA must not be used for PMKSA caching after
30807fc82af8SVeerendranath Jakkam  *	expiration and any keys derived from this PMK become invalid on
30817fc82af8SVeerendranath Jakkam  *	expiration, i.e., the current association must be dropped if the PMK
30827fc82af8SVeerendranath Jakkam  *	used for it expires.
30837fc82af8SVeerendranath Jakkam  * @pmk_reauth_threshold: Threshold time for reauthentication (percentage of
30847fc82af8SVeerendranath Jakkam  *	PMK lifetime, dot11RSNAConfigPMKReauthThreshold) or 0 if not specified.
30857fc82af8SVeerendranath Jakkam  *	Drivers are expected to trigger a full authentication instead of using
30867fc82af8SVeerendranath Jakkam  *	this PMKSA for caching when reassociating to a new BSS after this
30877fc82af8SVeerendranath Jakkam  *	threshold to generate a new PMK before the current one expires.
308867fbb16bSSamuel Ortiz  */
308967fbb16bSSamuel Ortiz struct cfg80211_pmksa {
3090c1e5f471SJohannes Berg 	const u8 *bssid;
3091c1e5f471SJohannes Berg 	const u8 *pmkid;
3092a3caf744SVidyullatha Kanchanapally 	const u8 *pmk;
3093a3caf744SVidyullatha Kanchanapally 	size_t pmk_len;
3094a3caf744SVidyullatha Kanchanapally 	const u8 *ssid;
3095a3caf744SVidyullatha Kanchanapally 	size_t ssid_len;
3096a3caf744SVidyullatha Kanchanapally 	const u8 *cache_id;
30977fc82af8SVeerendranath Jakkam 	u32 pmk_lifetime;
30987fc82af8SVeerendranath Jakkam 	u8 pmk_reauth_threshold;
309967fbb16bSSamuel Ortiz };
31009930380fSJohannes Berg 
31017643a2c3SJohannes Berg /**
310250ac6607SAmitkumar Karwar  * struct cfg80211_pkt_pattern - packet pattern
3103ff1b6e69SJohannes Berg  * @mask: bitmask where to match pattern and where to ignore bytes,
3104ff1b6e69SJohannes Berg  *	one bit per byte, in same format as nl80211
3105ff1b6e69SJohannes Berg  * @pattern: bytes to match where bitmask is 1
3106ff1b6e69SJohannes Berg  * @pattern_len: length of pattern (in bytes)
3107bb92d199SAmitkumar Karwar  * @pkt_offset: packet offset (in bytes)
3108ff1b6e69SJohannes Berg  *
3109ff1b6e69SJohannes Berg  * Internal note: @mask and @pattern are allocated in one chunk of
3110ff1b6e69SJohannes Berg  * memory, free @mask only!
3111ff1b6e69SJohannes Berg  */
311250ac6607SAmitkumar Karwar struct cfg80211_pkt_pattern {
3113922bd80fSJohannes Berg 	const u8 *mask, *pattern;
3114ff1b6e69SJohannes Berg 	int pattern_len;
3115bb92d199SAmitkumar Karwar 	int pkt_offset;
3116ff1b6e69SJohannes Berg };
3117ff1b6e69SJohannes Berg 
3118ff1b6e69SJohannes Berg /**
31192a0e047eSJohannes Berg  * struct cfg80211_wowlan_tcp - TCP connection parameters
31202a0e047eSJohannes Berg  *
31212a0e047eSJohannes Berg  * @sock: (internal) socket for source port allocation
31222a0e047eSJohannes Berg  * @src: source IP address
31232a0e047eSJohannes Berg  * @dst: destination IP address
31242a0e047eSJohannes Berg  * @dst_mac: destination MAC address
31252a0e047eSJohannes Berg  * @src_port: source port
31262a0e047eSJohannes Berg  * @dst_port: destination port
31272a0e047eSJohannes Berg  * @payload_len: data payload length
31282a0e047eSJohannes Berg  * @payload: data payload buffer
31292a0e047eSJohannes Berg  * @payload_seq: payload sequence stamping configuration
31302a0e047eSJohannes Berg  * @data_interval: interval at which to send data packets
31312a0e047eSJohannes Berg  * @wake_len: wakeup payload match length
31322a0e047eSJohannes Berg  * @wake_data: wakeup payload match data
31332a0e047eSJohannes Berg  * @wake_mask: wakeup payload match mask
31342a0e047eSJohannes Berg  * @tokens_size: length of the tokens buffer
31352a0e047eSJohannes Berg  * @payload_tok: payload token usage configuration
31362a0e047eSJohannes Berg  */
31372a0e047eSJohannes Berg struct cfg80211_wowlan_tcp {
31382a0e047eSJohannes Berg 	struct socket *sock;
31392a0e047eSJohannes Berg 	__be32 src, dst;
31402a0e047eSJohannes Berg 	u16 src_port, dst_port;
31412a0e047eSJohannes Berg 	u8 dst_mac[ETH_ALEN];
31422a0e047eSJohannes Berg 	int payload_len;
31432a0e047eSJohannes Berg 	const u8 *payload;
31442a0e047eSJohannes Berg 	struct nl80211_wowlan_tcp_data_seq payload_seq;
31452a0e047eSJohannes Berg 	u32 data_interval;
31462a0e047eSJohannes Berg 	u32 wake_len;
31472a0e047eSJohannes Berg 	const u8 *wake_data, *wake_mask;
31482a0e047eSJohannes Berg 	u32 tokens_size;
31492a0e047eSJohannes Berg 	/* must be last, variable member */
31502a0e047eSJohannes Berg 	struct nl80211_wowlan_tcp_data_token payload_tok;
3151ff1b6e69SJohannes Berg };
3152ff1b6e69SJohannes Berg 
3153ff1b6e69SJohannes Berg /**
3154ff1b6e69SJohannes Berg  * struct cfg80211_wowlan - Wake on Wireless-LAN support info
3155ff1b6e69SJohannes Berg  *
3156ff1b6e69SJohannes Berg  * This structure defines the enabled WoWLAN triggers for the device.
3157ff1b6e69SJohannes Berg  * @any: wake up on any activity -- special trigger if device continues
3158ff1b6e69SJohannes Berg  *	operating as normal during suspend
3159ff1b6e69SJohannes Berg  * @disconnect: wake up if getting disconnected
3160ff1b6e69SJohannes Berg  * @magic_pkt: wake up on receiving magic packet
3161ff1b6e69SJohannes Berg  * @patterns: wake up on receiving packet matching a pattern
3162ff1b6e69SJohannes Berg  * @n_patterns: number of patterns
316377dbbb13SJohannes Berg  * @gtk_rekey_failure: wake up on GTK rekey failure
316477dbbb13SJohannes Berg  * @eap_identity_req: wake up on EAP identity request packet
316577dbbb13SJohannes Berg  * @four_way_handshake: wake up on 4-way handshake
316677dbbb13SJohannes Berg  * @rfkill_release: wake up when rfkill is released
31672a0e047eSJohannes Berg  * @tcp: TCP connection establishment/wakeup parameters, see nl80211.h.
31682a0e047eSJohannes Berg  *	NULL if not configured.
31698cd4d456SLuciano Coelho  * @nd_config: configuration for the scan to be used for net detect wake.
3170ff1b6e69SJohannes Berg  */
3171ff1b6e69SJohannes Berg struct cfg80211_wowlan {
317277dbbb13SJohannes Berg 	bool any, disconnect, magic_pkt, gtk_rekey_failure,
317377dbbb13SJohannes Berg 	     eap_identity_req, four_way_handshake,
317477dbbb13SJohannes Berg 	     rfkill_release;
317550ac6607SAmitkumar Karwar 	struct cfg80211_pkt_pattern *patterns;
31762a0e047eSJohannes Berg 	struct cfg80211_wowlan_tcp *tcp;
3177ff1b6e69SJohannes Berg 	int n_patterns;
31788cd4d456SLuciano Coelho 	struct cfg80211_sched_scan_request *nd_config;
3179ff1b6e69SJohannes Berg };
3180ff1b6e69SJohannes Berg 
3181ff1b6e69SJohannes Berg /**
3182be29b99aSAmitkumar Karwar  * struct cfg80211_coalesce_rules - Coalesce rule parameters
3183be29b99aSAmitkumar Karwar  *
3184be29b99aSAmitkumar Karwar  * This structure defines coalesce rule for the device.
3185be29b99aSAmitkumar Karwar  * @delay: maximum coalescing delay in msecs.
3186be29b99aSAmitkumar Karwar  * @condition: condition for packet coalescence.
3187be29b99aSAmitkumar Karwar  *	see &enum nl80211_coalesce_condition.
3188be29b99aSAmitkumar Karwar  * @patterns: array of packet patterns
3189be29b99aSAmitkumar Karwar  * @n_patterns: number of patterns
3190be29b99aSAmitkumar Karwar  */
3191be29b99aSAmitkumar Karwar struct cfg80211_coalesce_rules {
3192be29b99aSAmitkumar Karwar 	int delay;
3193be29b99aSAmitkumar Karwar 	enum nl80211_coalesce_condition condition;
3194be29b99aSAmitkumar Karwar 	struct cfg80211_pkt_pattern *patterns;
3195be29b99aSAmitkumar Karwar 	int n_patterns;
3196be29b99aSAmitkumar Karwar };
3197be29b99aSAmitkumar Karwar 
3198be29b99aSAmitkumar Karwar /**
3199be29b99aSAmitkumar Karwar  * struct cfg80211_coalesce - Packet coalescing settings
3200be29b99aSAmitkumar Karwar  *
3201be29b99aSAmitkumar Karwar  * This structure defines coalescing settings.
3202be29b99aSAmitkumar Karwar  * @rules: array of coalesce rules
3203be29b99aSAmitkumar Karwar  * @n_rules: number of rules
3204be29b99aSAmitkumar Karwar  */
3205be29b99aSAmitkumar Karwar struct cfg80211_coalesce {
3206be29b99aSAmitkumar Karwar 	struct cfg80211_coalesce_rules *rules;
3207be29b99aSAmitkumar Karwar 	int n_rules;
3208be29b99aSAmitkumar Karwar };
3209be29b99aSAmitkumar Karwar 
3210be29b99aSAmitkumar Karwar /**
32118cd4d456SLuciano Coelho  * struct cfg80211_wowlan_nd_match - information about the match
32128cd4d456SLuciano Coelho  *
32138cd4d456SLuciano Coelho  * @ssid: SSID of the match that triggered the wake up
32148cd4d456SLuciano Coelho  * @n_channels: Number of channels where the match occurred.  This
32158cd4d456SLuciano Coelho  *	value may be zero if the driver can't report the channels.
32168cd4d456SLuciano Coelho  * @channels: center frequencies of the channels where a match
32178cd4d456SLuciano Coelho  *	occurred (in MHz)
32188cd4d456SLuciano Coelho  */
32198cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_match {
32208cd4d456SLuciano Coelho 	struct cfg80211_ssid ssid;
32218cd4d456SLuciano Coelho 	int n_channels;
32228cd4d456SLuciano Coelho 	u32 channels[];
32238cd4d456SLuciano Coelho };
32248cd4d456SLuciano Coelho 
32258cd4d456SLuciano Coelho /**
32268cd4d456SLuciano Coelho  * struct cfg80211_wowlan_nd_info - net detect wake up information
32278cd4d456SLuciano Coelho  *
32288cd4d456SLuciano Coelho  * @n_matches: Number of match information instances provided in
32298cd4d456SLuciano Coelho  *	@matches.  This value may be zero if the driver can't provide
32308cd4d456SLuciano Coelho  *	match information.
32318cd4d456SLuciano Coelho  * @matches: Array of pointers to matches containing information about
32328cd4d456SLuciano Coelho  *	the matches that triggered the wake up.
32338cd4d456SLuciano Coelho  */
32348cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_info {
32358cd4d456SLuciano Coelho 	int n_matches;
32368cd4d456SLuciano Coelho 	struct cfg80211_wowlan_nd_match *matches[];
32378cd4d456SLuciano Coelho };
32388cd4d456SLuciano Coelho 
32398cd4d456SLuciano Coelho /**
3240cd8f7cb4SJohannes Berg  * struct cfg80211_wowlan_wakeup - wakeup report
3241cd8f7cb4SJohannes Berg  * @disconnect: woke up by getting disconnected
3242cd8f7cb4SJohannes Berg  * @magic_pkt: woke up by receiving magic packet
3243cd8f7cb4SJohannes Berg  * @gtk_rekey_failure: woke up by GTK rekey failure
3244cd8f7cb4SJohannes Berg  * @eap_identity_req: woke up by EAP identity request packet
3245cd8f7cb4SJohannes Berg  * @four_way_handshake: woke up by 4-way handshake
3246cd8f7cb4SJohannes Berg  * @rfkill_release: woke up by rfkill being released
3247cd8f7cb4SJohannes Berg  * @pattern_idx: pattern that caused wakeup, -1 if not due to pattern
3248cd8f7cb4SJohannes Berg  * @packet_present_len: copied wakeup packet data
3249cd8f7cb4SJohannes Berg  * @packet_len: original wakeup packet length
3250cd8f7cb4SJohannes Berg  * @packet: The packet causing the wakeup, if any.
3251cd8f7cb4SJohannes Berg  * @packet_80211:  For pattern match, magic packet and other data
3252cd8f7cb4SJohannes Berg  *	frame triggers an 802.3 frame should be reported, for
3253cd8f7cb4SJohannes Berg  *	disconnect due to deauth 802.11 frame. This indicates which
3254cd8f7cb4SJohannes Berg  *	it is.
32552a0e047eSJohannes Berg  * @tcp_match: TCP wakeup packet received
32562a0e047eSJohannes Berg  * @tcp_connlost: TCP connection lost or failed to establish
32572a0e047eSJohannes Berg  * @tcp_nomoretokens: TCP data ran out of tokens
32588cd4d456SLuciano Coelho  * @net_detect: if not %NULL, woke up because of net detect
3259cd8f7cb4SJohannes Berg  */
3260cd8f7cb4SJohannes Berg struct cfg80211_wowlan_wakeup {
3261cd8f7cb4SJohannes Berg 	bool disconnect, magic_pkt, gtk_rekey_failure,
3262cd8f7cb4SJohannes Berg 	     eap_identity_req, four_way_handshake,
32632a0e047eSJohannes Berg 	     rfkill_release, packet_80211,
32642a0e047eSJohannes Berg 	     tcp_match, tcp_connlost, tcp_nomoretokens;
3265cd8f7cb4SJohannes Berg 	s32 pattern_idx;
3266cd8f7cb4SJohannes Berg 	u32 packet_present_len, packet_len;
3267cd8f7cb4SJohannes Berg 	const void *packet;
32688cd4d456SLuciano Coelho 	struct cfg80211_wowlan_nd_info *net_detect;
3269cd8f7cb4SJohannes Berg };
3270cd8f7cb4SJohannes Berg 
3271cd8f7cb4SJohannes Berg /**
3272e5497d76SJohannes Berg  * struct cfg80211_gtk_rekey_data - rekey data
3273093a48d2SNathan Errera  * @kek: key encryption key (@kek_len bytes)
3274093a48d2SNathan Errera  * @kck: key confirmation key (@kck_len bytes)
327578f686caSJohannes Berg  * @replay_ctr: replay counter (NL80211_REPLAY_CTR_LEN bytes)
3276093a48d2SNathan Errera  * @kek_len: length of kek
3277093a48d2SNathan Errera  * @kck_len length of kck
3278093a48d2SNathan Errera  * @akm: akm (oui, id)
3279e5497d76SJohannes Berg  */
3280e5497d76SJohannes Berg struct cfg80211_gtk_rekey_data {
328178f686caSJohannes Berg 	const u8 *kek, *kck, *replay_ctr;
3282093a48d2SNathan Errera 	u32 akm;
3283093a48d2SNathan Errera 	u8 kek_len, kck_len;
3284e5497d76SJohannes Berg };
3285e5497d76SJohannes Berg 
3286e5497d76SJohannes Berg /**
3287355199e0SJouni Malinen  * struct cfg80211_update_ft_ies_params - FT IE Information
3288355199e0SJouni Malinen  *
3289355199e0SJouni Malinen  * This structure provides information needed to update the fast transition IE
3290355199e0SJouni Malinen  *
3291355199e0SJouni Malinen  * @md: The Mobility Domain ID, 2 Octet value
3292355199e0SJouni Malinen  * @ie: Fast Transition IEs
3293355199e0SJouni Malinen  * @ie_len: Length of ft_ie in octets
3294355199e0SJouni Malinen  */
3295355199e0SJouni Malinen struct cfg80211_update_ft_ies_params {
3296355199e0SJouni Malinen 	u16 md;
3297355199e0SJouni Malinen 	const u8 *ie;
3298355199e0SJouni Malinen 	size_t ie_len;
3299355199e0SJouni Malinen };
3300355199e0SJouni Malinen 
3301355199e0SJouni Malinen /**
3302b176e629SAndrei Otcheretianski  * struct cfg80211_mgmt_tx_params - mgmt tx parameters
3303b176e629SAndrei Otcheretianski  *
3304b176e629SAndrei Otcheretianski  * This structure provides information needed to transmit a mgmt frame
3305b176e629SAndrei Otcheretianski  *
3306b176e629SAndrei Otcheretianski  * @chan: channel to use
3307b176e629SAndrei Otcheretianski  * @offchan: indicates wether off channel operation is required
3308b176e629SAndrei Otcheretianski  * @wait: duration for ROC
3309b176e629SAndrei Otcheretianski  * @buf: buffer to transmit
3310b176e629SAndrei Otcheretianski  * @len: buffer length
3311b176e629SAndrei Otcheretianski  * @no_cck: don't use cck rates for this frame
3312b176e629SAndrei Otcheretianski  * @dont_wait_for_ack: tells the low level not to wait for an ack
331334d22ce2SAndrei Otcheretianski  * @n_csa_offsets: length of csa_offsets array
331434d22ce2SAndrei Otcheretianski  * @csa_offsets: array of all the csa offsets in the frame
3315b176e629SAndrei Otcheretianski  */
3316b176e629SAndrei Otcheretianski struct cfg80211_mgmt_tx_params {
3317b176e629SAndrei Otcheretianski 	struct ieee80211_channel *chan;
3318b176e629SAndrei Otcheretianski 	bool offchan;
3319b176e629SAndrei Otcheretianski 	unsigned int wait;
3320b176e629SAndrei Otcheretianski 	const u8 *buf;
3321b176e629SAndrei Otcheretianski 	size_t len;
3322b176e629SAndrei Otcheretianski 	bool no_cck;
3323b176e629SAndrei Otcheretianski 	bool dont_wait_for_ack;
332434d22ce2SAndrei Otcheretianski 	int n_csa_offsets;
332534d22ce2SAndrei Otcheretianski 	const u16 *csa_offsets;
3326b176e629SAndrei Otcheretianski };
3327b176e629SAndrei Otcheretianski 
3328b176e629SAndrei Otcheretianski /**
3329fa9ffc74SKyeyoon Park  * struct cfg80211_dscp_exception - DSCP exception
3330fa9ffc74SKyeyoon Park  *
3331fa9ffc74SKyeyoon Park  * @dscp: DSCP value that does not adhere to the user priority range definition
3332fa9ffc74SKyeyoon Park  * @up: user priority value to which the corresponding DSCP value belongs
3333fa9ffc74SKyeyoon Park  */
3334fa9ffc74SKyeyoon Park struct cfg80211_dscp_exception {
3335fa9ffc74SKyeyoon Park 	u8 dscp;
3336fa9ffc74SKyeyoon Park 	u8 up;
3337fa9ffc74SKyeyoon Park };
3338fa9ffc74SKyeyoon Park 
3339fa9ffc74SKyeyoon Park /**
3340fa9ffc74SKyeyoon Park  * struct cfg80211_dscp_range - DSCP range definition for user priority
3341fa9ffc74SKyeyoon Park  *
3342fa9ffc74SKyeyoon Park  * @low: lowest DSCP value of this user priority range, inclusive
3343fa9ffc74SKyeyoon Park  * @high: highest DSCP value of this user priority range, inclusive
3344fa9ffc74SKyeyoon Park  */
3345fa9ffc74SKyeyoon Park struct cfg80211_dscp_range {
3346fa9ffc74SKyeyoon Park 	u8 low;
3347fa9ffc74SKyeyoon Park 	u8 high;
3348fa9ffc74SKyeyoon Park };
3349fa9ffc74SKyeyoon Park 
3350fa9ffc74SKyeyoon Park /* QoS Map Set element length defined in IEEE Std 802.11-2012, 8.4.2.97 */
3351fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_MAX_EX	21
3352fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_LEN_MIN	16
3353fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_LEN_MAX \
3354fa9ffc74SKyeyoon Park 	(IEEE80211_QOS_MAP_LEN_MIN + 2 * IEEE80211_QOS_MAP_MAX_EX)
3355fa9ffc74SKyeyoon Park 
3356fa9ffc74SKyeyoon Park /**
3357fa9ffc74SKyeyoon Park  * struct cfg80211_qos_map - QoS Map Information
3358fa9ffc74SKyeyoon Park  *
3359fa9ffc74SKyeyoon Park  * This struct defines the Interworking QoS map setting for DSCP values
3360fa9ffc74SKyeyoon Park  *
3361fa9ffc74SKyeyoon Park  * @num_des: number of DSCP exceptions (0..21)
3362fa9ffc74SKyeyoon Park  * @dscp_exception: optionally up to maximum of 21 DSCP exceptions from
3363fa9ffc74SKyeyoon Park  *	the user priority DSCP range definition
3364fa9ffc74SKyeyoon Park  * @up: DSCP range definition for a particular user priority
3365fa9ffc74SKyeyoon Park  */
3366fa9ffc74SKyeyoon Park struct cfg80211_qos_map {
3367fa9ffc74SKyeyoon Park 	u8 num_des;
3368fa9ffc74SKyeyoon Park 	struct cfg80211_dscp_exception dscp_exception[IEEE80211_QOS_MAP_MAX_EX];
3369fa9ffc74SKyeyoon Park 	struct cfg80211_dscp_range up[8];
3370fa9ffc74SKyeyoon Park };
3371fa9ffc74SKyeyoon Park 
3372fa9ffc74SKyeyoon Park /**
3373cb3b7d87SAyala Beker  * struct cfg80211_nan_conf - NAN configuration
3374cb3b7d87SAyala Beker  *
3375cb3b7d87SAyala Beker  * This struct defines NAN configuration parameters
3376cb3b7d87SAyala Beker  *
3377cb3b7d87SAyala Beker  * @master_pref: master preference (1 - 255)
33788585989dSLuca Coelho  * @bands: operating bands, a bitmap of &enum nl80211_band values.
33798585989dSLuca Coelho  *	For instance, for NL80211_BAND_2GHZ, bit 0 would be set
33808585989dSLuca Coelho  *	(i.e. BIT(NL80211_BAND_2GHZ)).
3381cb3b7d87SAyala Beker  */
3382cb3b7d87SAyala Beker struct cfg80211_nan_conf {
3383cb3b7d87SAyala Beker 	u8 master_pref;
33848585989dSLuca Coelho 	u8 bands;
3385cb3b7d87SAyala Beker };
3386cb3b7d87SAyala Beker 
3387cb3b7d87SAyala Beker /**
3388a5a9dcf2SAyala Beker  * enum cfg80211_nan_conf_changes - indicates changed fields in NAN
3389a5a9dcf2SAyala Beker  * configuration
3390a5a9dcf2SAyala Beker  *
3391a5a9dcf2SAyala Beker  * @CFG80211_NAN_CONF_CHANGED_PREF: master preference
33928585989dSLuca Coelho  * @CFG80211_NAN_CONF_CHANGED_BANDS: operating bands
3393a5a9dcf2SAyala Beker  */
3394a5a9dcf2SAyala Beker enum cfg80211_nan_conf_changes {
3395a5a9dcf2SAyala Beker 	CFG80211_NAN_CONF_CHANGED_PREF = BIT(0),
33968585989dSLuca Coelho 	CFG80211_NAN_CONF_CHANGED_BANDS = BIT(1),
3397a5a9dcf2SAyala Beker };
3398a5a9dcf2SAyala Beker 
3399a5a9dcf2SAyala Beker /**
3400a442b761SAyala Beker  * struct cfg80211_nan_func_filter - a NAN function Rx / Tx filter
3401a442b761SAyala Beker  *
3402a442b761SAyala Beker  * @filter: the content of the filter
3403a442b761SAyala Beker  * @len: the length of the filter
3404a442b761SAyala Beker  */
3405a442b761SAyala Beker struct cfg80211_nan_func_filter {
3406a442b761SAyala Beker 	const u8 *filter;
3407a442b761SAyala Beker 	u8 len;
3408a442b761SAyala Beker };
3409a442b761SAyala Beker 
3410a442b761SAyala Beker /**
3411a442b761SAyala Beker  * struct cfg80211_nan_func - a NAN function
3412a442b761SAyala Beker  *
3413a442b761SAyala Beker  * @type: &enum nl80211_nan_function_type
3414a442b761SAyala Beker  * @service_id: the service ID of the function
3415a442b761SAyala Beker  * @publish_type: &nl80211_nan_publish_type
3416a442b761SAyala Beker  * @close_range: if true, the range should be limited. Threshold is
3417a442b761SAyala Beker  *	implementation specific.
3418a442b761SAyala Beker  * @publish_bcast: if true, the solicited publish should be broadcasted
3419a442b761SAyala Beker  * @subscribe_active: if true, the subscribe is active
3420a442b761SAyala Beker  * @followup_id: the instance ID for follow up
3421a442b761SAyala Beker  * @followup_reqid: the requestor instance ID for follow up
3422a442b761SAyala Beker  * @followup_dest: MAC address of the recipient of the follow up
3423a442b761SAyala Beker  * @ttl: time to live counter in DW.
3424a442b761SAyala Beker  * @serv_spec_info: Service Specific Info
3425a442b761SAyala Beker  * @serv_spec_info_len: Service Specific Info length
3426a442b761SAyala Beker  * @srf_include: if true, SRF is inclusive
3427a442b761SAyala Beker  * @srf_bf: Bloom Filter
3428a442b761SAyala Beker  * @srf_bf_len: Bloom Filter length
3429a442b761SAyala Beker  * @srf_bf_idx: Bloom Filter index
3430a442b761SAyala Beker  * @srf_macs: SRF MAC addresses
3431a442b761SAyala Beker  * @srf_num_macs: number of MAC addresses in SRF
3432a442b761SAyala Beker  * @rx_filters: rx filters that are matched with corresponding peer's tx_filter
3433a442b761SAyala Beker  * @tx_filters: filters that should be transmitted in the SDF.
3434a442b761SAyala Beker  * @num_rx_filters: length of &rx_filters.
3435a442b761SAyala Beker  * @num_tx_filters: length of &tx_filters.
3436a442b761SAyala Beker  * @instance_id: driver allocated id of the function.
3437a442b761SAyala Beker  * @cookie: unique NAN function identifier.
3438a442b761SAyala Beker  */
3439a442b761SAyala Beker struct cfg80211_nan_func {
3440a442b761SAyala Beker 	enum nl80211_nan_function_type type;
3441a442b761SAyala Beker 	u8 service_id[NL80211_NAN_FUNC_SERVICE_ID_LEN];
3442a442b761SAyala Beker 	u8 publish_type;
3443a442b761SAyala Beker 	bool close_range;
3444a442b761SAyala Beker 	bool publish_bcast;
3445a442b761SAyala Beker 	bool subscribe_active;
3446a442b761SAyala Beker 	u8 followup_id;
3447a442b761SAyala Beker 	u8 followup_reqid;
3448a442b761SAyala Beker 	struct mac_address followup_dest;
3449a442b761SAyala Beker 	u32 ttl;
3450a442b761SAyala Beker 	const u8 *serv_spec_info;
3451a442b761SAyala Beker 	u8 serv_spec_info_len;
3452a442b761SAyala Beker 	bool srf_include;
3453a442b761SAyala Beker 	const u8 *srf_bf;
3454a442b761SAyala Beker 	u8 srf_bf_len;
3455a442b761SAyala Beker 	u8 srf_bf_idx;
3456a442b761SAyala Beker 	struct mac_address *srf_macs;
3457a442b761SAyala Beker 	int srf_num_macs;
3458a442b761SAyala Beker 	struct cfg80211_nan_func_filter *rx_filters;
3459a442b761SAyala Beker 	struct cfg80211_nan_func_filter *tx_filters;
3460a442b761SAyala Beker 	u8 num_tx_filters;
3461a442b761SAyala Beker 	u8 num_rx_filters;
3462a442b761SAyala Beker 	u8 instance_id;
3463a442b761SAyala Beker 	u64 cookie;
3464a442b761SAyala Beker };
3465a442b761SAyala Beker 
3466a442b761SAyala Beker /**
34673a00df57SAvraham Stern  * struct cfg80211_pmk_conf - PMK configuration
34683a00df57SAvraham Stern  *
34693a00df57SAvraham Stern  * @aa: authenticator address
34703a00df57SAvraham Stern  * @pmk_len: PMK length in bytes.
34713a00df57SAvraham Stern  * @pmk: the PMK material
34723a00df57SAvraham Stern  * @pmk_r0_name: PMK-R0 Name. NULL if not applicable (i.e., the PMK
34733a00df57SAvraham Stern  *	is not PMK-R0). When pmk_r0_name is not NULL, the pmk field
34743a00df57SAvraham Stern  *	holds PMK-R0.
34753a00df57SAvraham Stern  */
34763a00df57SAvraham Stern struct cfg80211_pmk_conf {
34773a00df57SAvraham Stern 	const u8 *aa;
34783a00df57SAvraham Stern 	u8 pmk_len;
34793a00df57SAvraham Stern 	const u8 *pmk;
34803a00df57SAvraham Stern 	const u8 *pmk_r0_name;
34813a00df57SAvraham Stern };
34823a00df57SAvraham Stern 
34833a00df57SAvraham Stern /**
348440cbfa90SSrinivas Dasari  * struct cfg80211_external_auth_params - Trigger External authentication.
348540cbfa90SSrinivas Dasari  *
348640cbfa90SSrinivas Dasari  * Commonly used across the external auth request and event interfaces.
348740cbfa90SSrinivas Dasari  *
348840cbfa90SSrinivas Dasari  * @action: action type / trigger for external authentication. Only significant
348940cbfa90SSrinivas Dasari  *	for the authentication request event interface (driver to user space).
349040cbfa90SSrinivas Dasari  * @bssid: BSSID of the peer with which the authentication has
349140cbfa90SSrinivas Dasari  *	to happen. Used by both the authentication request event and
349240cbfa90SSrinivas Dasari  *	authentication response command interface.
349340cbfa90SSrinivas Dasari  * @ssid: SSID of the AP.  Used by both the authentication request event and
349440cbfa90SSrinivas Dasari  *	authentication response command interface.
349540cbfa90SSrinivas Dasari  * @key_mgmt_suite: AKM suite of the respective authentication. Used by the
349640cbfa90SSrinivas Dasari  *	authentication request event interface.
349740cbfa90SSrinivas Dasari  * @status: status code, %WLAN_STATUS_SUCCESS for successful authentication,
349840cbfa90SSrinivas Dasari  *	use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space cannot give you
349940cbfa90SSrinivas Dasari  *	the real status code for failures. Used only for the authentication
350040cbfa90SSrinivas Dasari  *	response command interface (user space to driver).
3501fe494370SSrinivas Dasari  * @pmkid: The identifier to refer a PMKSA.
350240cbfa90SSrinivas Dasari  */
350340cbfa90SSrinivas Dasari struct cfg80211_external_auth_params {
350440cbfa90SSrinivas Dasari 	enum nl80211_external_auth_action action;
350540cbfa90SSrinivas Dasari 	u8 bssid[ETH_ALEN] __aligned(2);
350640cbfa90SSrinivas Dasari 	struct cfg80211_ssid ssid;
350740cbfa90SSrinivas Dasari 	unsigned int key_mgmt_suite;
350840cbfa90SSrinivas Dasari 	u16 status;
3509fe494370SSrinivas Dasari 	const u8 *pmkid;
351040cbfa90SSrinivas Dasari };
351140cbfa90SSrinivas Dasari 
351240cbfa90SSrinivas Dasari /**
35133453de98SRandy Dunlap  * struct cfg80211_ftm_responder_stats - FTM responder statistics
351481e54d08SPradeep Kumar Chitrapu  *
351581e54d08SPradeep Kumar Chitrapu  * @filled: bitflag of flags using the bits of &enum nl80211_ftm_stats to
351681e54d08SPradeep Kumar Chitrapu  *	indicate the relevant values in this struct for them
351781e54d08SPradeep Kumar Chitrapu  * @success_num: number of FTM sessions in which all frames were successfully
351881e54d08SPradeep Kumar Chitrapu  *	answered
351981e54d08SPradeep Kumar Chitrapu  * @partial_num: number of FTM sessions in which part of frames were
352081e54d08SPradeep Kumar Chitrapu  *	successfully answered
352181e54d08SPradeep Kumar Chitrapu  * @failed_num: number of failed FTM sessions
352281e54d08SPradeep Kumar Chitrapu  * @asap_num: number of ASAP FTM sessions
352381e54d08SPradeep Kumar Chitrapu  * @non_asap_num: number of  non-ASAP FTM sessions
352481e54d08SPradeep Kumar Chitrapu  * @total_duration_ms: total sessions durations - gives an indication
352581e54d08SPradeep Kumar Chitrapu  *	of how much time the responder was busy
352681e54d08SPradeep Kumar Chitrapu  * @unknown_triggers_num: number of unknown FTM triggers - triggers from
352781e54d08SPradeep Kumar Chitrapu  *	initiators that didn't finish successfully the negotiation phase with
352881e54d08SPradeep Kumar Chitrapu  *	the responder
352981e54d08SPradeep Kumar Chitrapu  * @reschedule_requests_num: number of FTM reschedule requests - initiator asks
353081e54d08SPradeep Kumar Chitrapu  *	for a new scheduling although it already has scheduled FTM slot
353181e54d08SPradeep Kumar Chitrapu  * @out_of_window_triggers_num: total FTM triggers out of scheduled window
353281e54d08SPradeep Kumar Chitrapu  */
353381e54d08SPradeep Kumar Chitrapu struct cfg80211_ftm_responder_stats {
353481e54d08SPradeep Kumar Chitrapu 	u32 filled;
353581e54d08SPradeep Kumar Chitrapu 	u32 success_num;
353681e54d08SPradeep Kumar Chitrapu 	u32 partial_num;
353781e54d08SPradeep Kumar Chitrapu 	u32 failed_num;
353881e54d08SPradeep Kumar Chitrapu 	u32 asap_num;
353981e54d08SPradeep Kumar Chitrapu 	u32 non_asap_num;
354081e54d08SPradeep Kumar Chitrapu 	u64 total_duration_ms;
354181e54d08SPradeep Kumar Chitrapu 	u32 unknown_triggers_num;
354281e54d08SPradeep Kumar Chitrapu 	u32 reschedule_requests_num;
354381e54d08SPradeep Kumar Chitrapu 	u32 out_of_window_triggers_num;
354481e54d08SPradeep Kumar Chitrapu };
354581e54d08SPradeep Kumar Chitrapu 
354681e54d08SPradeep Kumar Chitrapu /**
35479bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_ftm_result - FTM result
35489bb7e0f2SJohannes Berg  * @failure_reason: if this measurement failed (PMSR status is
35499bb7e0f2SJohannes Berg  *	%NL80211_PMSR_STATUS_FAILURE), this gives a more precise
35509bb7e0f2SJohannes Berg  *	reason than just "failure"
35519bb7e0f2SJohannes Berg  * @burst_index: if reporting partial results, this is the index
35529bb7e0f2SJohannes Berg  *	in [0 .. num_bursts-1] of the burst that's being reported
35539bb7e0f2SJohannes Berg  * @num_ftmr_attempts: number of FTM request frames transmitted
35549bb7e0f2SJohannes Berg  * @num_ftmr_successes: number of FTM request frames acked
35559bb7e0f2SJohannes Berg  * @busy_retry_time: if failure_reason is %NL80211_PMSR_FTM_FAILURE_PEER_BUSY,
35569bb7e0f2SJohannes Berg  *	fill this to indicate in how many seconds a retry is deemed possible
35579bb7e0f2SJohannes Berg  *	by the responder
35589bb7e0f2SJohannes Berg  * @num_bursts_exp: actual number of bursts exponent negotiated
35599bb7e0f2SJohannes Berg  * @burst_duration: actual burst duration negotiated
35609bb7e0f2SJohannes Berg  * @ftms_per_burst: actual FTMs per burst negotiated
35619bb7e0f2SJohannes Berg  * @lci_len: length of LCI information (if present)
35629bb7e0f2SJohannes Berg  * @civicloc_len: length of civic location information (if present)
35639bb7e0f2SJohannes Berg  * @lci: LCI data (may be %NULL)
35649bb7e0f2SJohannes Berg  * @civicloc: civic location data (may be %NULL)
35659bb7e0f2SJohannes Berg  * @rssi_avg: average RSSI over FTM action frames reported
35669bb7e0f2SJohannes Berg  * @rssi_spread: spread of the RSSI over FTM action frames reported
35679bb7e0f2SJohannes Berg  * @tx_rate: bitrate for transmitted FTM action frame response
35689bb7e0f2SJohannes Berg  * @rx_rate: bitrate of received FTM action frame
35699bb7e0f2SJohannes Berg  * @rtt_avg: average of RTTs measured (must have either this or @dist_avg)
35709bb7e0f2SJohannes Berg  * @rtt_variance: variance of RTTs measured (note that standard deviation is
35719bb7e0f2SJohannes Berg  *	the square root of the variance)
35729bb7e0f2SJohannes Berg  * @rtt_spread: spread of the RTTs measured
35739bb7e0f2SJohannes Berg  * @dist_avg: average of distances (mm) measured
35749bb7e0f2SJohannes Berg  *	(must have either this or @rtt_avg)
35759bb7e0f2SJohannes Berg  * @dist_variance: variance of distances measured (see also @rtt_variance)
35769bb7e0f2SJohannes Berg  * @dist_spread: spread of distances measured (see also @rtt_spread)
35779bb7e0f2SJohannes Berg  * @num_ftmr_attempts_valid: @num_ftmr_attempts is valid
35789bb7e0f2SJohannes Berg  * @num_ftmr_successes_valid: @num_ftmr_successes is valid
35799bb7e0f2SJohannes Berg  * @rssi_avg_valid: @rssi_avg is valid
35809bb7e0f2SJohannes Berg  * @rssi_spread_valid: @rssi_spread is valid
35819bb7e0f2SJohannes Berg  * @tx_rate_valid: @tx_rate is valid
35829bb7e0f2SJohannes Berg  * @rx_rate_valid: @rx_rate is valid
35839bb7e0f2SJohannes Berg  * @rtt_avg_valid: @rtt_avg is valid
35849bb7e0f2SJohannes Berg  * @rtt_variance_valid: @rtt_variance is valid
35859bb7e0f2SJohannes Berg  * @rtt_spread_valid: @rtt_spread is valid
35869bb7e0f2SJohannes Berg  * @dist_avg_valid: @dist_avg is valid
35879bb7e0f2SJohannes Berg  * @dist_variance_valid: @dist_variance is valid
35889bb7e0f2SJohannes Berg  * @dist_spread_valid: @dist_spread is valid
35899bb7e0f2SJohannes Berg  */
35909bb7e0f2SJohannes Berg struct cfg80211_pmsr_ftm_result {
35919bb7e0f2SJohannes Berg 	const u8 *lci;
35929bb7e0f2SJohannes Berg 	const u8 *civicloc;
35939bb7e0f2SJohannes Berg 	unsigned int lci_len;
35949bb7e0f2SJohannes Berg 	unsigned int civicloc_len;
35959bb7e0f2SJohannes Berg 	enum nl80211_peer_measurement_ftm_failure_reasons failure_reason;
35969bb7e0f2SJohannes Berg 	u32 num_ftmr_attempts, num_ftmr_successes;
35979bb7e0f2SJohannes Berg 	s16 burst_index;
35989bb7e0f2SJohannes Berg 	u8 busy_retry_time;
35999bb7e0f2SJohannes Berg 	u8 num_bursts_exp;
36009bb7e0f2SJohannes Berg 	u8 burst_duration;
36019bb7e0f2SJohannes Berg 	u8 ftms_per_burst;
36029bb7e0f2SJohannes Berg 	s32 rssi_avg;
36039bb7e0f2SJohannes Berg 	s32 rssi_spread;
36049bb7e0f2SJohannes Berg 	struct rate_info tx_rate, rx_rate;
36059bb7e0f2SJohannes Berg 	s64 rtt_avg;
36069bb7e0f2SJohannes Berg 	s64 rtt_variance;
36079bb7e0f2SJohannes Berg 	s64 rtt_spread;
36089bb7e0f2SJohannes Berg 	s64 dist_avg;
36099bb7e0f2SJohannes Berg 	s64 dist_variance;
36109bb7e0f2SJohannes Berg 	s64 dist_spread;
36119bb7e0f2SJohannes Berg 
36129bb7e0f2SJohannes Berg 	u16 num_ftmr_attempts_valid:1,
36139bb7e0f2SJohannes Berg 	    num_ftmr_successes_valid:1,
36149bb7e0f2SJohannes Berg 	    rssi_avg_valid:1,
36159bb7e0f2SJohannes Berg 	    rssi_spread_valid:1,
36169bb7e0f2SJohannes Berg 	    tx_rate_valid:1,
36179bb7e0f2SJohannes Berg 	    rx_rate_valid:1,
36189bb7e0f2SJohannes Berg 	    rtt_avg_valid:1,
36199bb7e0f2SJohannes Berg 	    rtt_variance_valid:1,
36209bb7e0f2SJohannes Berg 	    rtt_spread_valid:1,
36219bb7e0f2SJohannes Berg 	    dist_avg_valid:1,
36229bb7e0f2SJohannes Berg 	    dist_variance_valid:1,
36239bb7e0f2SJohannes Berg 	    dist_spread_valid:1;
36249bb7e0f2SJohannes Berg };
36259bb7e0f2SJohannes Berg 
36269bb7e0f2SJohannes Berg /**
36279bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_result - peer measurement result
36289bb7e0f2SJohannes Berg  * @addr: address of the peer
36299bb7e0f2SJohannes Berg  * @host_time: host time (use ktime_get_boottime() adjust to the time when the
36309bb7e0f2SJohannes Berg  *	measurement was made)
36319bb7e0f2SJohannes Berg  * @ap_tsf: AP's TSF at measurement time
36329bb7e0f2SJohannes Berg  * @status: status of the measurement
36339bb7e0f2SJohannes Berg  * @final: if reporting partial results, mark this as the last one; if not
36349bb7e0f2SJohannes Berg  *	reporting partial results always set this flag
36359bb7e0f2SJohannes Berg  * @ap_tsf_valid: indicates the @ap_tsf value is valid
36369bb7e0f2SJohannes Berg  * @type: type of the measurement reported, note that we only support reporting
36379bb7e0f2SJohannes Berg  *	one type at a time, but you can report multiple results separately and
36389bb7e0f2SJohannes Berg  *	they're all aggregated for userspace.
36399bb7e0f2SJohannes Berg  */
36409bb7e0f2SJohannes Berg struct cfg80211_pmsr_result {
36419bb7e0f2SJohannes Berg 	u64 host_time, ap_tsf;
36429bb7e0f2SJohannes Berg 	enum nl80211_peer_measurement_status status;
36439bb7e0f2SJohannes Berg 
36449bb7e0f2SJohannes Berg 	u8 addr[ETH_ALEN];
36459bb7e0f2SJohannes Berg 
36469bb7e0f2SJohannes Berg 	u8 final:1,
36479bb7e0f2SJohannes Berg 	   ap_tsf_valid:1;
36489bb7e0f2SJohannes Berg 
36499bb7e0f2SJohannes Berg 	enum nl80211_peer_measurement_type type;
36509bb7e0f2SJohannes Berg 
36519bb7e0f2SJohannes Berg 	union {
36529bb7e0f2SJohannes Berg 		struct cfg80211_pmsr_ftm_result ftm;
36539bb7e0f2SJohannes Berg 	};
36549bb7e0f2SJohannes Berg };
36559bb7e0f2SJohannes Berg 
36569bb7e0f2SJohannes Berg /**
36579bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_ftm_request_peer - FTM request data
36589bb7e0f2SJohannes Berg  * @requested: indicates FTM is requested
36599bb7e0f2SJohannes Berg  * @preamble: frame preamble to use
36609bb7e0f2SJohannes Berg  * @burst_period: burst period to use
36619bb7e0f2SJohannes Berg  * @asap: indicates to use ASAP mode
36629bb7e0f2SJohannes Berg  * @num_bursts_exp: number of bursts exponent
36639bb7e0f2SJohannes Berg  * @burst_duration: burst duration
36649bb7e0f2SJohannes Berg  * @ftms_per_burst: number of FTMs per burst
36659bb7e0f2SJohannes Berg  * @ftmr_retries: number of retries for FTM request
36669bb7e0f2SJohannes Berg  * @request_lci: request LCI information
36679bb7e0f2SJohannes Berg  * @request_civicloc: request civic location information
3668efb5520dSAvraham Stern  * @trigger_based: use trigger based ranging for the measurement
3669efb5520dSAvraham Stern  *		 If neither @trigger_based nor @non_trigger_based is set,
3670efb5520dSAvraham Stern  *		 EDCA based ranging will be used.
3671efb5520dSAvraham Stern  * @non_trigger_based: use non trigger based ranging for the measurement
3672efb5520dSAvraham Stern  *		 If neither @trigger_based nor @non_trigger_based is set,
3673efb5520dSAvraham Stern  *		 EDCA based ranging will be used.
367473807523SAvraham Stern  * @lmr_feedback: negotiate for I2R LMR feedback. Only valid if either
367573807523SAvraham Stern  *		 @trigger_based or @non_trigger_based is set.
3676dd3e4fc7SAvraham Stern  * @bss_color: the bss color of the responder. Optional. Set to zero to
3677dd3e4fc7SAvraham Stern  *	indicate the driver should set the BSS color. Only valid if
3678dd3e4fc7SAvraham Stern  *	@non_trigger_based or @trigger_based is set.
36799bb7e0f2SJohannes Berg  *
36809bb7e0f2SJohannes Berg  * See also nl80211 for the respective attribute documentation.
36819bb7e0f2SJohannes Berg  */
36829bb7e0f2SJohannes Berg struct cfg80211_pmsr_ftm_request_peer {
36839bb7e0f2SJohannes Berg 	enum nl80211_preamble preamble;
36849bb7e0f2SJohannes Berg 	u16 burst_period;
36859bb7e0f2SJohannes Berg 	u8 requested:1,
36869bb7e0f2SJohannes Berg 	   asap:1,
36879bb7e0f2SJohannes Berg 	   request_lci:1,
3688efb5520dSAvraham Stern 	   request_civicloc:1,
3689efb5520dSAvraham Stern 	   trigger_based:1,
369073807523SAvraham Stern 	   non_trigger_based:1,
369173807523SAvraham Stern 	   lmr_feedback:1;
36929bb7e0f2SJohannes Berg 	u8 num_bursts_exp;
36939bb7e0f2SJohannes Berg 	u8 burst_duration;
36949bb7e0f2SJohannes Berg 	u8 ftms_per_burst;
36959bb7e0f2SJohannes Berg 	u8 ftmr_retries;
3696dd3e4fc7SAvraham Stern 	u8 bss_color;
36979bb7e0f2SJohannes Berg };
36989bb7e0f2SJohannes Berg 
36999bb7e0f2SJohannes Berg /**
37009bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_request_peer - peer data for a peer measurement request
37019bb7e0f2SJohannes Berg  * @addr: MAC address
37029bb7e0f2SJohannes Berg  * @chandef: channel to use
37039bb7e0f2SJohannes Berg  * @report_ap_tsf: report the associated AP's TSF
37049bb7e0f2SJohannes Berg  * @ftm: FTM data, see &struct cfg80211_pmsr_ftm_request_peer
37059bb7e0f2SJohannes Berg  */
37069bb7e0f2SJohannes Berg struct cfg80211_pmsr_request_peer {
37079bb7e0f2SJohannes Berg 	u8 addr[ETH_ALEN];
37089bb7e0f2SJohannes Berg 	struct cfg80211_chan_def chandef;
37099bb7e0f2SJohannes Berg 	u8 report_ap_tsf:1;
37109bb7e0f2SJohannes Berg 	struct cfg80211_pmsr_ftm_request_peer ftm;
37119bb7e0f2SJohannes Berg };
37129bb7e0f2SJohannes Berg 
37139bb7e0f2SJohannes Berg /**
37149bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_request - peer measurement request
37159bb7e0f2SJohannes Berg  * @cookie: cookie, set by cfg80211
37169bb7e0f2SJohannes Berg  * @nl_portid: netlink portid - used by cfg80211
37179bb7e0f2SJohannes Berg  * @drv_data: driver data for this request, if required for aborting,
37189bb7e0f2SJohannes Berg  *	not otherwise freed or anything by cfg80211
37199bb7e0f2SJohannes Berg  * @mac_addr: MAC address used for (randomised) request
37209bb7e0f2SJohannes Berg  * @mac_addr_mask: MAC address mask used for randomisation, bits that
37219bb7e0f2SJohannes Berg  *	are 0 in the mask should be randomised, bits that are 1 should
37229bb7e0f2SJohannes Berg  *	be taken from the @mac_addr
37239bb7e0f2SJohannes Berg  * @list: used by cfg80211 to hold on to the request
37249bb7e0f2SJohannes Berg  * @timeout: timeout (in milliseconds) for the whole operation, if
37259bb7e0f2SJohannes Berg  *	zero it means there's no timeout
37269bb7e0f2SJohannes Berg  * @n_peers: number of peers to do measurements with
37279bb7e0f2SJohannes Berg  * @peers: per-peer measurement request data
37289bb7e0f2SJohannes Berg  */
37299bb7e0f2SJohannes Berg struct cfg80211_pmsr_request {
37309bb7e0f2SJohannes Berg 	u64 cookie;
37319bb7e0f2SJohannes Berg 	void *drv_data;
37329bb7e0f2SJohannes Berg 	u32 n_peers;
37339bb7e0f2SJohannes Berg 	u32 nl_portid;
37349bb7e0f2SJohannes Berg 
37359bb7e0f2SJohannes Berg 	u32 timeout;
37369bb7e0f2SJohannes Berg 
37379bb7e0f2SJohannes Berg 	u8 mac_addr[ETH_ALEN] __aligned(2);
37389bb7e0f2SJohannes Berg 	u8 mac_addr_mask[ETH_ALEN] __aligned(2);
37399bb7e0f2SJohannes Berg 
37409bb7e0f2SJohannes Berg 	struct list_head list;
37419bb7e0f2SJohannes Berg 
37429bb7e0f2SJohannes Berg 	struct cfg80211_pmsr_request_peer peers[];
37439bb7e0f2SJohannes Berg };
37449bb7e0f2SJohannes Berg 
37459bb7e0f2SJohannes Berg /**
3746cb74e977SSunil Dutt  * struct cfg80211_update_owe_info - OWE Information
3747cb74e977SSunil Dutt  *
3748cb74e977SSunil Dutt  * This structure provides information needed for the drivers to offload OWE
3749cb74e977SSunil Dutt  * (Opportunistic Wireless Encryption) processing to the user space.
3750cb74e977SSunil Dutt  *
3751cb74e977SSunil Dutt  * Commonly used across update_owe_info request and event interfaces.
3752cb74e977SSunil Dutt  *
3753cb74e977SSunil Dutt  * @peer: MAC address of the peer device for which the OWE processing
3754cb74e977SSunil Dutt  *	has to be done.
3755cb74e977SSunil Dutt  * @status: status code, %WLAN_STATUS_SUCCESS for successful OWE info
3756cb74e977SSunil Dutt  *	processing, use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space
3757cb74e977SSunil Dutt  *	cannot give you the real status code for failures. Used only for
3758cb74e977SSunil Dutt  *	OWE update request command interface (user space to driver).
3759cb74e977SSunil Dutt  * @ie: IEs obtained from the peer or constructed by the user space. These are
3760cb74e977SSunil Dutt  *	the IEs of the remote peer in the event from the host driver and
3761cb74e977SSunil Dutt  *	the constructed IEs by the user space in the request interface.
3762cb74e977SSunil Dutt  * @ie_len: Length of IEs in octets.
3763cb74e977SSunil Dutt  */
3764cb74e977SSunil Dutt struct cfg80211_update_owe_info {
3765cb74e977SSunil Dutt 	u8 peer[ETH_ALEN] __aligned(2);
3766cb74e977SSunil Dutt 	u16 status;
3767cb74e977SSunil Dutt 	const u8 *ie;
3768cb74e977SSunil Dutt 	size_t ie_len;
3769cb74e977SSunil Dutt };
3770cb74e977SSunil Dutt 
3771cb74e977SSunil Dutt /**
37726cd536feSJohannes Berg  * struct mgmt_frame_regs - management frame registrations data
37736cd536feSJohannes Berg  * @global_stypes: bitmap of management frame subtypes registered
37746cd536feSJohannes Berg  *	for the entire device
37756cd536feSJohannes Berg  * @interface_stypes: bitmap of management frame subtypes registered
37766cd536feSJohannes Berg  *	for the given interface
37779dba48a6SJohannes Berg  * @global_mcast_rx: mcast RX is needed globally for these subtypes
37789dba48a6SJohannes Berg  * @interface_mcast_stypes: mcast RX is needed on this interface
37799dba48a6SJohannes Berg  *	for these subtypes
37806cd536feSJohannes Berg  */
37816cd536feSJohannes Berg struct mgmt_frame_regs {
37826cd536feSJohannes Berg 	u32 global_stypes, interface_stypes;
37839dba48a6SJohannes Berg 	u32 global_mcast_stypes, interface_mcast_stypes;
37846cd536feSJohannes Berg };
37856cd536feSJohannes Berg 
37866cd536feSJohannes Berg /**
3787704232c2SJohannes Berg  * struct cfg80211_ops - backend description for wireless configuration
3788704232c2SJohannes Berg  *
3789704232c2SJohannes Berg  * This struct is registered by fullmac card drivers and/or wireless stacks
3790704232c2SJohannes Berg  * in order to handle configuration requests on their interfaces.
3791704232c2SJohannes Berg  *
3792704232c2SJohannes Berg  * All callbacks except where otherwise noted should return 0
3793704232c2SJohannes Berg  * on success or a negative error code.
3794704232c2SJohannes Berg  *
3795a05829a7SJohannes Berg  * All operations are invoked with the wiphy mutex held. The RTNL may be
3796a05829a7SJohannes Berg  * held in addition (due to wireless extensions) but this cannot be relied
3797a05829a7SJohannes Berg  * upon except in cases where documented below. Note that due to ordering,
3798a05829a7SJohannes Berg  * the RTNL also cannot be acquired in any handlers.
379943fb45cbSJohannes Berg  *
3800ff1b6e69SJohannes Berg  * @suspend: wiphy device needs to be suspended. The variable @wow will
3801ff1b6e69SJohannes Berg  *	be %NULL or contain the enabled Wake-on-Wireless triggers that are
3802ff1b6e69SJohannes Berg  *	configured for the device.
38030378b3f1SJohannes Berg  * @resume: wiphy device needs to be resumed
38046d52563fSJohannes Berg  * @set_wakeup: Called when WoWLAN is enabled/disabled, use this callback
38056d52563fSJohannes Berg  *	to call device_set_wakeup_enable() to enable/disable wakeup from
38066d52563fSJohannes Berg  *	the device.
38070378b3f1SJohannes Berg  *
380860719ffdSJohannes Berg  * @add_virtual_intf: create a new virtual interface with the given name,
3809463d0183SJohannes Berg  *	must set the struct wireless_dev's iftype. Beware: You must create
381084efbb84SJohannes Berg  *	the new netdev in the wiphy's network namespace! Returns the struct
381198104fdeSJohannes Berg  *	wireless_dev, or an ERR_PTR. For P2P device wdevs, the driver must
381298104fdeSJohannes Berg  *	also set the address member in the wdev.
3813a05829a7SJohannes Berg  *	This additionally holds the RTNL to be able to do netdev changes.
3814704232c2SJohannes Berg  *
381584efbb84SJohannes Berg  * @del_virtual_intf: remove the virtual interface
3816a05829a7SJohannes Berg  *	This additionally holds the RTNL to be able to do netdev changes.
381755682965SJohannes Berg  *
381860719ffdSJohannes Berg  * @change_virtual_intf: change type/configuration of virtual interface,
381960719ffdSJohannes Berg  *	keep the struct wireless_dev's iftype updated.
3820a05829a7SJohannes Berg  *	This additionally holds the RTNL to be able to do netdev changes.
382155682965SJohannes Berg  *
382241ade00fSJohannes Berg  * @add_key: add a key with the given parameters. @mac_addr will be %NULL
382341ade00fSJohannes Berg  *	when adding a group key.
382441ade00fSJohannes Berg  *
382541ade00fSJohannes Berg  * @get_key: get information about the key with the given parameters.
382641ade00fSJohannes Berg  *	@mac_addr will be %NULL when requesting information for a group
382741ade00fSJohannes Berg  *	key. All pointers given to the @callback function need not be valid
3828e3da574aSJohannes Berg  *	after it returns. This function should return an error if it is
3829e3da574aSJohannes Berg  *	not possible to retrieve the key, -ENOENT if it doesn't exist.
383041ade00fSJohannes Berg  *
383141ade00fSJohannes Berg  * @del_key: remove a key given the @mac_addr (%NULL for a group key)
3832e3da574aSJohannes Berg  *	and @key_index, return -ENOENT if the key doesn't exist.
383341ade00fSJohannes Berg  *
383441ade00fSJohannes Berg  * @set_default_key: set the default key on an interface
3835ed1b6cc7SJohannes Berg  *
38363cfcf6acSJouni Malinen  * @set_default_mgmt_key: set the default management frame key on an interface
38371f7e9f46SJohannes Berg  *
383856be393fSJouni Malinen  * @set_default_beacon_key: set the default Beacon frame key on an interface
38393cfcf6acSJouni Malinen  *
3840e5497d76SJohannes Berg  * @set_rekey_data: give the data necessary for GTK rekeying to the driver
3841e5497d76SJohannes Berg  *
3842c04a4ff7SJohannes Berg  * @start_ap: Start acting in AP mode defined by the parameters.
3843c04a4ff7SJohannes Berg  * @change_beacon: Change the beacon parameters for an access point mode
3844c04a4ff7SJohannes Berg  *	interface. This should reject the call when AP mode wasn't started.
3845c04a4ff7SJohannes Berg  * @stop_ap: Stop being an AP, including stopping beaconing.
38465727ef1bSJohannes Berg  *
38475727ef1bSJohannes Berg  * @add_station: Add a new station.
384889c771e5SJouni Malinen  * @del_station: Remove a station
3849bdd90d5eSJohannes Berg  * @change_station: Modify a given station. Note that flags changes are not much
3850bdd90d5eSJohannes Berg  *	validated in cfg80211, in particular the auth/assoc/authorized flags
3851bdd90d5eSJohannes Berg  *	might come to the driver in invalid combinations -- make sure to check
385277ee7c89SJohannes Berg  *	them, also against the existing state! Drivers must call
385377ee7c89SJohannes Berg  *	cfg80211_check_station_change() to validate the information.
3854abe37c4bSJohannes Berg  * @get_station: get station information for the station identified by @mac
3855abe37c4bSJohannes Berg  * @dump_station: dump station callback -- resume dump at index @idx
3856abe37c4bSJohannes Berg  *
3857abe37c4bSJohannes Berg  * @add_mpath: add a fixed mesh path
3858abe37c4bSJohannes Berg  * @del_mpath: delete a given mesh path
3859abe37c4bSJohannes Berg  * @change_mpath: change a given mesh path
3860abe37c4bSJohannes Berg  * @get_mpath: get a mesh path for the given parameters
3861abe37c4bSJohannes Berg  * @dump_mpath: dump mesh path callback -- resume dump at index @idx
386266be7d2bSHenning Rogge  * @get_mpp: get a mesh proxy path for the given parameters
386366be7d2bSHenning Rogge  * @dump_mpp: dump mesh proxy path callback -- resume dump at index @idx
3864f52555a4SJohannes Berg  * @join_mesh: join the mesh network with the specified parameters
38658d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
3866f52555a4SJohannes Berg  * @leave_mesh: leave the current mesh network
38678d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
38682ec600d6SLuis Carlos Cobo  *
386924bdd9f4SJavier Cardona  * @get_mesh_config: Get the current mesh configuration
387093da9cc1Scolin@cozybit.com  *
387124bdd9f4SJavier Cardona  * @update_mesh_config: Update mesh parameters on a running mesh.
387293da9cc1Scolin@cozybit.com  *	The mask is a bitfield which tells us which parameters to
387393da9cc1Scolin@cozybit.com  *	set, and which to leave alone.
387493da9cc1Scolin@cozybit.com  *
38759f1ba906SJouni Malinen  * @change_bss: Modify parameters for a given BSS.
387631888487SJouni Malinen  *
387731888487SJouni Malinen  * @set_txq_params: Set TX queue parameters
387872bdcf34SJouni Malinen  *
3879e8c9bd5bSJohannes Berg  * @libertas_set_mesh_channel: Only for backward compatibility for libertas,
3880e8c9bd5bSJohannes Berg  *	as it doesn't implement join_mesh and needs to set the channel to
3881e8c9bd5bSJohannes Berg  *	join the mesh instead.
3882e8c9bd5bSJohannes Berg  *
3883e8c9bd5bSJohannes Berg  * @set_monitor_channel: Set the monitor mode channel for the device. If other
3884e8c9bd5bSJohannes Berg  *	interfaces are active this callback should reject the configuration.
3885e8c9bd5bSJohannes Berg  *	If no interfaces are active or the device is down, the channel should
3886e8c9bd5bSJohannes Berg  *	be stored for when a monitor interface becomes active.
38879aed3cc1SJouni Malinen  *
38882a519311SJohannes Berg  * @scan: Request to do a scan. If returning zero, the scan request is given
38892a519311SJohannes Berg  *	the driver, and will be valid until passed to cfg80211_scan_done().
38902a519311SJohannes Berg  *	For scan results, call cfg80211_inform_bss(); you can call this outside
38912a519311SJohannes Berg  *	the scan/scan_done bracket too.
389291d3ab46SVidyullatha Kanchanapally  * @abort_scan: Tell the driver to abort an ongoing scan. The driver shall
389391d3ab46SVidyullatha Kanchanapally  *	indicate the status of the scan through cfg80211_scan_done().
3894636a5d36SJouni Malinen  *
3895636a5d36SJouni Malinen  * @auth: Request to authenticate with the specified peer
38968d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
3897636a5d36SJouni Malinen  * @assoc: Request to (re)associate with the specified peer
38988d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
3899636a5d36SJouni Malinen  * @deauth: Request to deauthenticate from the specified peer
39008d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
3901636a5d36SJouni Malinen  * @disassoc: Request to disassociate from the specified peer
39028d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
390304a773adSJohannes Berg  *
3904b23aa676SSamuel Ortiz  * @connect: Connect to the ESS with the specified parameters. When connected,
3905bf1ecd21SJouni Malinen  *	call cfg80211_connect_result()/cfg80211_connect_bss() with status code
3906bf1ecd21SJouni Malinen  *	%WLAN_STATUS_SUCCESS. If the connection fails for some reason, call
3907bf1ecd21SJouni Malinen  *	cfg80211_connect_result()/cfg80211_connect_bss() with the status code
3908bf1ecd21SJouni Malinen  *	from the AP or cfg80211_connect_timeout() if no frame with status code
3909bf1ecd21SJouni Malinen  *	was received.
3910bf1ecd21SJouni Malinen  *	The driver is allowed to roam to other BSSes within the ESS when the
3911bf1ecd21SJouni Malinen  *	other BSS matches the connect parameters. When such roaming is initiated
3912bf1ecd21SJouni Malinen  *	by the driver, the driver is expected to verify that the target matches
3913bf1ecd21SJouni Malinen  *	the configured security parameters and to use Reassociation Request
3914bf1ecd21SJouni Malinen  *	frame instead of Association Request frame.
3915bf1ecd21SJouni Malinen  *	The connect function can also be used to request the driver to perform a
3916bf1ecd21SJouni Malinen  *	specific roam when connected to an ESS. In that case, the prev_bssid
391735eb8f7bSJouni Malinen  *	parameter is set to the BSSID of the currently associated BSS as an
3918bf1ecd21SJouni Malinen  *	indication of requesting reassociation.
3919bf1ecd21SJouni Malinen  *	In both the driver-initiated and new connect() call initiated roaming
3920bf1ecd21SJouni Malinen  *	cases, the result of roaming is indicated with a call to
392129ce6ecbSAvraham Stern  *	cfg80211_roamed(). (invoked with the wireless_dev mutex held)
3922088e8df8Svamsi krishna  * @update_connect_params: Update the connect parameters while connected to a
3923088e8df8Svamsi krishna  *	BSS. The updated parameters can be used by driver/firmware for
3924088e8df8Svamsi krishna  *	subsequent BSS selection (roaming) decisions and to form the
3925088e8df8Svamsi krishna  *	Authentication/(Re)Association Request frames. This call does not
3926088e8df8Svamsi krishna  *	request an immediate disassociation or reassociation with the current
3927088e8df8Svamsi krishna  *	BSS, i.e., this impacts only subsequent (re)associations. The bits in
3928088e8df8Svamsi krishna  *	changed are defined in &enum cfg80211_connect_params_changed.
3929088e8df8Svamsi krishna  *	(invoked with the wireless_dev mutex held)
39300711d638SIlan Peer  * @disconnect: Disconnect from the BSS/ESS or stop connection attempts if
39310711d638SIlan Peer  *      connection is in progress. Once done, call cfg80211_disconnected() in
39320711d638SIlan Peer  *      case connection was already established (invoked with the
39330711d638SIlan Peer  *      wireless_dev mutex held), otherwise call cfg80211_connect_timeout().
3934b23aa676SSamuel Ortiz  *
393504a773adSJohannes Berg  * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call
393604a773adSJohannes Berg  *	cfg80211_ibss_joined(), also call that function when changing BSSID due
393704a773adSJohannes Berg  *	to a merge.
39388d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
393904a773adSJohannes Berg  * @leave_ibss: Leave the IBSS.
39408d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
3941b9a5f8caSJouni Malinen  *
3942f4e583c8SAntonio Quartulli  * @set_mcast_rate: Set the specified multicast rate (only if vif is in ADHOC or
3943f4e583c8SAntonio Quartulli  *	MESH mode)
3944f4e583c8SAntonio Quartulli  *
3945b9a5f8caSJouni Malinen  * @set_wiphy_params: Notify that wiphy parameters have changed;
3946b9a5f8caSJouni Malinen  *	@changed bitfield (see &enum wiphy_params_flags) describes which values
3947b9a5f8caSJouni Malinen  *	have changed. The actual parameter values are available in
3948b9a5f8caSJouni Malinen  *	struct wiphy. If returning an error, no value should be changed.
39497643a2c3SJohannes Berg  *
39501432de07SLuis R. Rodriguez  * @set_tx_power: set the transmit power according to the parameters,
3951c8442118SJohannes Berg  *	the power passed is in mBm, to get dBm use MBM_TO_DBM(). The
3952c8442118SJohannes Berg  *	wdev may be %NULL if power was set for the wiphy, and will
3953c8442118SJohannes Berg  *	always be %NULL unless the driver supports per-vif TX power
3954c8442118SJohannes Berg  *	(as advertised by the nl80211 feature flag.)
39557643a2c3SJohannes Berg  * @get_tx_power: store the current TX power into the dbm variable;
39561f87f7d3SJohannes Berg  *	return 0 if successful
39571f87f7d3SJohannes Berg  *
39581f87f7d3SJohannes Berg  * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting
39591f87f7d3SJohannes Berg  *	functions to adjust rfkill hw state
3960aff89a9bSJohannes Berg  *
396161fa713cSHolger Schurig  * @dump_survey: get site survey information.
396261fa713cSHolger Schurig  *
39639588bbd5SJouni Malinen  * @remain_on_channel: Request the driver to remain awake on the specified
39649588bbd5SJouni Malinen  *	channel for the specified duration to complete an off-channel
39659588bbd5SJouni Malinen  *	operation (e.g., public action frame exchange). When the driver is
39669588bbd5SJouni Malinen  *	ready on the requested channel, it must indicate this with an event
39679588bbd5SJouni Malinen  *	notification by calling cfg80211_ready_on_channel().
39689588bbd5SJouni Malinen  * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation.
39699588bbd5SJouni Malinen  *	This allows the operation to be terminated prior to timeout based on
39709588bbd5SJouni Malinen  *	the duration value.
3971f7ca38dfSJohannes Berg  * @mgmt_tx: Transmit a management frame.
3972f7ca38dfSJohannes Berg  * @mgmt_tx_cancel_wait: Cancel the wait time from transmitting a management
3973f7ca38dfSJohannes Berg  *	frame on another channel
39749588bbd5SJouni Malinen  *
3975fc73f11fSDavid Spinadel  * @testmode_cmd: run a test mode command; @wdev may be %NULL
397671063f0eSWey-Yi Guy  * @testmode_dump: Implement a test mode dump. The cb->args[2] and up may be
397771063f0eSWey-Yi Guy  *	used by the function, but 0 and 1 must not be touched. Additionally,
397871063f0eSWey-Yi Guy  *	return error codes other than -ENOBUFS and -ENOENT will terminate the
397971063f0eSWey-Yi Guy  *	dump and return to userspace with an error, so be careful. If any data
398071063f0eSWey-Yi Guy  *	was passed in from userspace then the data/len arguments will be present
398171063f0eSWey-Yi Guy  *	and point to the data contained in %NL80211_ATTR_TESTDATA.
398267fbb16bSSamuel Ortiz  *
3983abe37c4bSJohannes Berg  * @set_bitrate_mask: set the bitrate mask configuration
3984abe37c4bSJohannes Berg  *
398567fbb16bSSamuel Ortiz  * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac
398667fbb16bSSamuel Ortiz  *	devices running firmwares capable of generating the (re) association
398767fbb16bSSamuel Ortiz  *	RSN IE. It allows for faster roaming between WPA2 BSSIDs.
398867fbb16bSSamuel Ortiz  * @del_pmksa: Delete a cached PMKID.
398967fbb16bSSamuel Ortiz  * @flush_pmksa: Flush all cached PMKIDs.
39909043f3b8SJuuso Oikarinen  * @set_power_mgmt: Configure WLAN power management. A timeout value of -1
39919043f3b8SJuuso Oikarinen  *	allows the driver to adjust the dynamic ps timeout value.
3992d6dc1a38SJuuso Oikarinen  * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold.
3993e86abc68SJohannes Berg  *	After configuration, the driver should (soon) send an event indicating
3994e86abc68SJohannes Berg  *	the current level is above/below the configured threshold; this may
3995e86abc68SJohannes Berg  *	need some care when the configuration is changed (without first being
3996e86abc68SJohannes Berg  *	disabled.)
39974a4b8169SAndrew Zaborowski  * @set_cqm_rssi_range_config: Configure two RSSI thresholds in the
39984a4b8169SAndrew Zaborowski  *	connection quality monitor.  An event is to be sent only when the
39994a4b8169SAndrew Zaborowski  *	signal level is found to be outside the two values.  The driver should
40004a4b8169SAndrew Zaborowski  *	set %NL80211_EXT_FEATURE_CQM_RSSI_LIST if this method is implemented.
40014a4b8169SAndrew Zaborowski  *	If it is provided then there's no point providing @set_cqm_rssi_config.
400284f10708SThomas Pedersen  * @set_cqm_txe_config: Configure connection quality monitor TX error
400384f10708SThomas Pedersen  *	thresholds.
4004807f8a8cSLuciano Coelho  * @sched_scan_start: Tell the driver to start a scheduled scan.
40053a3ecf1dSArend Van Spriel  * @sched_scan_stop: Tell the driver to stop an ongoing scheduled scan with
40063a3ecf1dSArend Van Spriel  *	given request id. This call must stop the scheduled scan and be ready
40073a3ecf1dSArend Van Spriel  *	for starting a new one before it returns, i.e. @sched_scan_start may be
40083a3ecf1dSArend Van Spriel  *	called immediately after that again and should not fail in that case.
40093a3ecf1dSArend Van Spriel  *	The driver should not call cfg80211_sched_scan_stopped() for a requested
40103a3ecf1dSArend Van Spriel  *	stop (when this method returns 0).
401167fbb16bSSamuel Ortiz  *
40126cd536feSJohannes Berg  * @update_mgmt_frame_registrations: Notify the driver that management frame
40136cd536feSJohannes Berg  *	registrations were updated. The callback is allowed to sleep.
4014547025d5SBruno Randolf  *
4015547025d5SBruno Randolf  * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device.
4016547025d5SBruno Randolf  *	Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may
4017547025d5SBruno Randolf  *	reject TX/RX mask combinations they cannot support by returning -EINVAL
4018547025d5SBruno Randolf  *	(also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX).
4019547025d5SBruno Randolf  *
4020547025d5SBruno Randolf  * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant).
40213677713bSJohn W. Linville  *
4022109086ceSArik Nemtsov  * @tdls_mgmt: Transmit a TDLS management frame.
4023109086ceSArik Nemtsov  * @tdls_oper: Perform a high-level TDLS operation (e.g. TDLS link setup).
40247f6cf311SJohannes Berg  *
40257f6cf311SJohannes Berg  * @probe_client: probe an associated client, must return a cookie that it
40267f6cf311SJohannes Berg  *	later passes to cfg80211_probe_status().
40271d9d9213SSimon Wunderlich  *
40281d9d9213SSimon Wunderlich  * @set_noack_map: Set the NoAck Map for the TIDs.
4029d6199218SBen Greear  *
40305b7ccaf3SJohannes Berg  * @get_channel: Get the current operating channel for the virtual interface.
40315b7ccaf3SJohannes Berg  *	For monitor interfaces, it should return %NULL unless there's a single
40325b7ccaf3SJohannes Berg  *	current monitoring channel.
403398104fdeSJohannes Berg  *
403498104fdeSJohannes Berg  * @start_p2p_device: Start the given P2P device.
403598104fdeSJohannes Berg  * @stop_p2p_device: Stop the given P2P device.
403677765eafSVasanthakumar Thiagarajan  *
403777765eafSVasanthakumar Thiagarajan  * @set_mac_acl: Sets MAC address control list in AP and P2P GO mode.
403877765eafSVasanthakumar Thiagarajan  *	Parameters include ACL policy, an array of MAC address of stations
403977765eafSVasanthakumar Thiagarajan  *	and the number of MAC addresses. If there is already a list in driver
404077765eafSVasanthakumar Thiagarajan  *	this new list replaces the existing one. Driver has to clear its ACL
404177765eafSVasanthakumar Thiagarajan  *	when number of MAC addresses entries is passed as 0. Drivers which
404277765eafSVasanthakumar Thiagarajan  *	advertise the support for MAC based ACL have to implement this callback.
404304f39047SSimon Wunderlich  *
404404f39047SSimon Wunderlich  * @start_radar_detection: Start radar detection in the driver.
40458bf24293SJouni Malinen  *
404626ec17a1SOrr Mazor  * @end_cac: End running CAC, probably because a related CAC
404726ec17a1SOrr Mazor  *	was finished on another phy.
404826ec17a1SOrr Mazor  *
40498bf24293SJouni Malinen  * @update_ft_ies: Provide updated Fast BSS Transition information to the
40508bf24293SJouni Malinen  *	driver. If the SME is in the driver/firmware, this information can be
40518bf24293SJouni Malinen  *	used in building Authentication and Reassociation Request frames.
40525de17984SArend van Spriel  *
40535de17984SArend van Spriel  * @crit_proto_start: Indicates a critical protocol needs more link reliability
40545de17984SArend van Spriel  *	for a given duration (milliseconds). The protocol is provided so the
40555de17984SArend van Spriel  *	driver can take the most appropriate actions.
40565de17984SArend van Spriel  * @crit_proto_stop: Indicates critical protocol no longer needs increased link
40575de17984SArend van Spriel  *	reliability. This operation can not fail.
4058be29b99aSAmitkumar Karwar  * @set_coalesce: Set coalesce parameters.
405916ef1fe2SSimon Wunderlich  *
406097dc94f1SMichal Kazior  * @channel_switch: initiate channel-switch procedure (with CSA). Driver is
406197dc94f1SMichal Kazior  *	responsible for veryfing if the switch is possible. Since this is
406297dc94f1SMichal Kazior  *	inherently tricky driver may decide to disconnect an interface later
406397dc94f1SMichal Kazior  *	with cfg80211_stop_iface(). This doesn't mean driver can accept
406497dc94f1SMichal Kazior  *	everything. It should do it's best to verify requests and reject them
406597dc94f1SMichal Kazior  *	as soon as possible.
4066fa9ffc74SKyeyoon Park  *
4067fa9ffc74SKyeyoon Park  * @set_qos_map: Set QoS mapping information to the driver
4068e16821bcSJouni Malinen  *
4069e16821bcSJouni Malinen  * @set_ap_chanwidth: Set the AP (including P2P GO) mode channel width for the
4070e16821bcSJouni Malinen  *	given interface This is used e.g. for dynamic HT 20/40 MHz channel width
4071e16821bcSJouni Malinen  *	changes during the lifetime of the BSS.
4072960d01acSJohannes Berg  *
4073960d01acSJohannes Berg  * @add_tx_ts: validate (if admitted_time is 0) or add a TX TS to the device
4074960d01acSJohannes Berg  *	with the given parameters; action frame exchange has been handled by
4075960d01acSJohannes Berg  *	userspace so this just has to modify the TX path to take the TS into
4076960d01acSJohannes Berg  *	account.
4077960d01acSJohannes Berg  *	If the admitted time is 0 just validate the parameters to make sure
4078960d01acSJohannes Berg  *	the session can be created at all; it is valid to just always return
4079960d01acSJohannes Berg  *	success for that but that may result in inefficient behaviour (handshake
4080960d01acSJohannes Berg  *	with the peer followed by immediate teardown when the addition is later
4081960d01acSJohannes Berg  *	rejected)
4082960d01acSJohannes Berg  * @del_tx_ts: remove an existing TX TS
40836e0bd6c3SRostislav Lisovy  *
40846e0bd6c3SRostislav Lisovy  * @join_ocb: join the OCB network with the specified parameters
40856e0bd6c3SRostislav Lisovy  *	(invoked with the wireless_dev mutex held)
40866e0bd6c3SRostislav Lisovy  * @leave_ocb: leave the current OCB network
40876e0bd6c3SRostislav Lisovy  *	(invoked with the wireless_dev mutex held)
40881057d35eSArik Nemtsov  *
40891057d35eSArik Nemtsov  * @tdls_channel_switch: Start channel-switching with a TDLS peer. The driver
40901057d35eSArik Nemtsov  *	is responsible for continually initiating channel-switching operations
40911057d35eSArik Nemtsov  *	and returning to the base channel for communication with the AP.
40921057d35eSArik Nemtsov  * @tdls_cancel_channel_switch: Stop channel-switching with a TDLS peer. Both
40931057d35eSArik Nemtsov  *	peers must be on the base channel when the call completes.
4094cb3b7d87SAyala Beker  * @start_nan: Start the NAN interface.
4095cb3b7d87SAyala Beker  * @stop_nan: Stop the NAN interface.
4096a442b761SAyala Beker  * @add_nan_func: Add a NAN function. Returns negative value on failure.
4097a442b761SAyala Beker  *	On success @nan_func ownership is transferred to the driver and
4098a442b761SAyala Beker  *	it may access it outside of the scope of this function. The driver
4099a442b761SAyala Beker  *	should free the @nan_func when no longer needed by calling
4100a442b761SAyala Beker  *	cfg80211_free_nan_func().
4101a442b761SAyala Beker  *	On success the driver should assign an instance_id in the
4102a442b761SAyala Beker  *	provided @nan_func.
4103a442b761SAyala Beker  * @del_nan_func: Delete a NAN function.
4104a5a9dcf2SAyala Beker  * @nan_change_conf: changes NAN configuration. The changed parameters must
4105a5a9dcf2SAyala Beker  *	be specified in @changes (using &enum cfg80211_nan_conf_changes);
4106a5a9dcf2SAyala Beker  *	All other parameters must be ignored.
4107ce0ce13aSMichael Braun  *
4108ce0ce13aSMichael Braun  * @set_multicast_to_unicast: configure multicast to unicast conversion for BSS
41093a00df57SAvraham Stern  *
411052539ca8SToke Høiland-Jørgensen  * @get_txq_stats: Get TXQ stats for interface or phy. If wdev is %NULL, this
411152539ca8SToke Høiland-Jørgensen  *      function should return phy stats, and interface stats otherwise.
411252539ca8SToke Høiland-Jørgensen  *
41133a00df57SAvraham Stern  * @set_pmk: configure the PMK to be used for offloaded 802.1X 4-Way handshake.
41143a00df57SAvraham Stern  *	If not deleted through @del_pmk the PMK remains valid until disconnect
41153a00df57SAvraham Stern  *	upon which the driver should clear it.
41163a00df57SAvraham Stern  *	(invoked with the wireless_dev mutex held)
41173a00df57SAvraham Stern  * @del_pmk: delete the previously configured PMK for the given authenticator.
41183a00df57SAvraham Stern  *	(invoked with the wireless_dev mutex held)
411940cbfa90SSrinivas Dasari  *
412040cbfa90SSrinivas Dasari  * @external_auth: indicates result of offloaded authentication processing from
412140cbfa90SSrinivas Dasari  *     user space
41222576a9acSDenis Kenzior  *
41232576a9acSDenis Kenzior  * @tx_control_port: TX a control port frame (EAPoL).  The noencrypt parameter
41242576a9acSDenis Kenzior  *	tells the driver that the frame should not be encrypted.
412581e54d08SPradeep Kumar Chitrapu  *
412681e54d08SPradeep Kumar Chitrapu  * @get_ftm_responder_stats: Retrieve FTM responder statistics, if available.
412781e54d08SPradeep Kumar Chitrapu  *	Statistics should be cumulative, currently no way to reset is provided.
41289bb7e0f2SJohannes Berg  * @start_pmsr: start peer measurement (e.g. FTM)
41299bb7e0f2SJohannes Berg  * @abort_pmsr: abort peer measurement
4130cb74e977SSunil Dutt  *
4131cb74e977SSunil Dutt  * @update_owe_info: Provide updated OWE info to driver. Driver implementing SME
4132cb74e977SSunil Dutt  *	but offloading OWE processing to the user space will get the updated
4133cb74e977SSunil Dutt  *	DH IE through this interface.
41345ab92e7fSRajkumar Manoharan  *
41355ab92e7fSRajkumar Manoharan  * @probe_mesh_link: Probe direct Mesh peer's link quality by sending data frame
41365ab92e7fSRajkumar Manoharan  *	and overrule HWMP path selection algorithm.
413777f576deSTamizh chelvam  * @set_tid_config: TID specific configuration, this can be peer or BSS specific
413877f576deSTamizh chelvam  *	This callback may sleep.
41393710a8a6SJohannes Berg  * @reset_tid_config: Reset TID specific configuration for the peer, for the
41403710a8a6SJohannes Berg  *	given TIDs. This callback may sleep.
414170b6ff35SJohannes Berg  *
414270b6ff35SJohannes Berg  * @set_sar_specs: Update the SAR (TX power) settings.
41430d2ab3aeSJohn Crispin  *
41440d2ab3aeSJohn Crispin  * @color_change: Initiate a color change.
4145e306784aSSubrat Mishra  *
4146e306784aSSubrat Mishra  * @set_fils_aad: Set FILS AAD data to the AP driver so that the driver can use
4147e306784aSSubrat Mishra  *	those to decrypt (Re)Association Request and encrypt (Re)Association
4148e306784aSSubrat Mishra  *	Response frame.
4149bc2dfc02SLorenzo Bianconi  *
4150a95bfb87SLorenzo Bianconi  * @set_radar_background: Configure dedicated offchannel chain available for
4151bc2dfc02SLorenzo Bianconi  *	radar/CAC detection on some hw. This chain can't be used to transmit
4152bc2dfc02SLorenzo Bianconi  *	or receive frames and it is bounded to a running wdev.
4153a95bfb87SLorenzo Bianconi  *	Background radar/CAC detection allows to avoid the CAC downtime
4154bc2dfc02SLorenzo Bianconi  *	switching to a different channel during CAC detection on the selected
4155bc2dfc02SLorenzo Bianconi  *	radar channel.
4156bc2dfc02SLorenzo Bianconi  *	The caller is expected to set chandef pointer to NULL in order to
4157a95bfb87SLorenzo Bianconi  *	disable background CAC/radar detection.
4158704232c2SJohannes Berg  */
4159704232c2SJohannes Berg struct cfg80211_ops {
4160ff1b6e69SJohannes Berg 	int	(*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
41610378b3f1SJohannes Berg 	int	(*resume)(struct wiphy *wiphy);
41626d52563fSJohannes Berg 	void	(*set_wakeup)(struct wiphy *wiphy, bool enabled);
41630378b3f1SJohannes Berg 
416484efbb84SJohannes Berg 	struct wireless_dev * (*add_virtual_intf)(struct wiphy *wiphy,
4165552bff0cSJohannes Berg 						  const char *name,
41666bab2e19STom Gundersen 						  unsigned char name_assign_type,
4167f9e10ce4SJohannes Berg 						  enum nl80211_iftype type,
41682ec600d6SLuis Carlos Cobo 						  struct vif_params *params);
416984efbb84SJohannes Berg 	int	(*del_virtual_intf)(struct wiphy *wiphy,
417084efbb84SJohannes Berg 				    struct wireless_dev *wdev);
4171e36d56b6SJohannes Berg 	int	(*change_virtual_intf)(struct wiphy *wiphy,
4172e36d56b6SJohannes Berg 				       struct net_device *dev,
4173818a986eSJohannes Berg 				       enum nl80211_iftype type,
41742ec600d6SLuis Carlos Cobo 				       struct vif_params *params);
417541ade00fSJohannes Berg 
417641ade00fSJohannes Berg 	int	(*add_key)(struct wiphy *wiphy, struct net_device *netdev,
4177e31b8213SJohannes Berg 			   u8 key_index, bool pairwise, const u8 *mac_addr,
417841ade00fSJohannes Berg 			   struct key_params *params);
417941ade00fSJohannes Berg 	int	(*get_key)(struct wiphy *wiphy, struct net_device *netdev,
4180e31b8213SJohannes Berg 			   u8 key_index, bool pairwise, const u8 *mac_addr,
4181e31b8213SJohannes Berg 			   void *cookie,
418241ade00fSJohannes Berg 			   void (*callback)(void *cookie, struct key_params*));
418341ade00fSJohannes Berg 	int	(*del_key)(struct wiphy *wiphy, struct net_device *netdev,
4184e31b8213SJohannes Berg 			   u8 key_index, bool pairwise, const u8 *mac_addr);
418541ade00fSJohannes Berg 	int	(*set_default_key)(struct wiphy *wiphy,
418641ade00fSJohannes Berg 				   struct net_device *netdev,
4187dbd2fd65SJohannes Berg 				   u8 key_index, bool unicast, bool multicast);
41883cfcf6acSJouni Malinen 	int	(*set_default_mgmt_key)(struct wiphy *wiphy,
41893cfcf6acSJouni Malinen 					struct net_device *netdev,
41903cfcf6acSJouni Malinen 					u8 key_index);
419156be393fSJouni Malinen 	int	(*set_default_beacon_key)(struct wiphy *wiphy,
419256be393fSJouni Malinen 					  struct net_device *netdev,
419356be393fSJouni Malinen 					  u8 key_index);
4194ed1b6cc7SJohannes Berg 
41958860020eSJohannes Berg 	int	(*start_ap)(struct wiphy *wiphy, struct net_device *dev,
41968860020eSJohannes Berg 			    struct cfg80211_ap_settings *settings);
41978860020eSJohannes Berg 	int	(*change_beacon)(struct wiphy *wiphy, struct net_device *dev,
41988860020eSJohannes Berg 				 struct cfg80211_beacon_data *info);
41998860020eSJohannes Berg 	int	(*stop_ap)(struct wiphy *wiphy, struct net_device *dev);
42005727ef1bSJohannes Berg 
42015727ef1bSJohannes Berg 
42025727ef1bSJohannes Berg 	int	(*add_station)(struct wiphy *wiphy, struct net_device *dev,
42033b3a0162SJohannes Berg 			       const u8 *mac,
42043b3a0162SJohannes Berg 			       struct station_parameters *params);
42055727ef1bSJohannes Berg 	int	(*del_station)(struct wiphy *wiphy, struct net_device *dev,
420689c771e5SJouni Malinen 			       struct station_del_parameters *params);
42075727ef1bSJohannes Berg 	int	(*change_station)(struct wiphy *wiphy, struct net_device *dev,
42083b3a0162SJohannes Berg 				  const u8 *mac,
42093b3a0162SJohannes Berg 				  struct station_parameters *params);
4210fd5b74dcSJohannes Berg 	int	(*get_station)(struct wiphy *wiphy, struct net_device *dev,
42113b3a0162SJohannes Berg 			       const u8 *mac, struct station_info *sinfo);
42122ec600d6SLuis Carlos Cobo 	int	(*dump_station)(struct wiphy *wiphy, struct net_device *dev,
42132ec600d6SLuis Carlos Cobo 				int idx, u8 *mac, struct station_info *sinfo);
42142ec600d6SLuis Carlos Cobo 
42152ec600d6SLuis Carlos Cobo 	int	(*add_mpath)(struct wiphy *wiphy, struct net_device *dev,
42163b3a0162SJohannes Berg 			       const u8 *dst, const u8 *next_hop);
42172ec600d6SLuis Carlos Cobo 	int	(*del_mpath)(struct wiphy *wiphy, struct net_device *dev,
42183b3a0162SJohannes Berg 			       const u8 *dst);
42192ec600d6SLuis Carlos Cobo 	int	(*change_mpath)(struct wiphy *wiphy, struct net_device *dev,
42203b3a0162SJohannes Berg 				  const u8 *dst, const u8 *next_hop);
42212ec600d6SLuis Carlos Cobo 	int	(*get_mpath)(struct wiphy *wiphy, struct net_device *dev,
42223b3a0162SJohannes Berg 			     u8 *dst, u8 *next_hop, struct mpath_info *pinfo);
42232ec600d6SLuis Carlos Cobo 	int	(*dump_mpath)(struct wiphy *wiphy, struct net_device *dev,
42242ec600d6SLuis Carlos Cobo 			      int idx, u8 *dst, u8 *next_hop,
42252ec600d6SLuis Carlos Cobo 			      struct mpath_info *pinfo);
422666be7d2bSHenning Rogge 	int	(*get_mpp)(struct wiphy *wiphy, struct net_device *dev,
422766be7d2bSHenning Rogge 			   u8 *dst, u8 *mpp, struct mpath_info *pinfo);
422866be7d2bSHenning Rogge 	int	(*dump_mpp)(struct wiphy *wiphy, struct net_device *dev,
422966be7d2bSHenning Rogge 			    int idx, u8 *dst, u8 *mpp,
423066be7d2bSHenning Rogge 			    struct mpath_info *pinfo);
423124bdd9f4SJavier Cardona 	int	(*get_mesh_config)(struct wiphy *wiphy,
423293da9cc1Scolin@cozybit.com 				struct net_device *dev,
423393da9cc1Scolin@cozybit.com 				struct mesh_config *conf);
423424bdd9f4SJavier Cardona 	int	(*update_mesh_config)(struct wiphy *wiphy,
423529cbe68cSJohannes Berg 				      struct net_device *dev, u32 mask,
423629cbe68cSJohannes Berg 				      const struct mesh_config *nconf);
423729cbe68cSJohannes Berg 	int	(*join_mesh)(struct wiphy *wiphy, struct net_device *dev,
423829cbe68cSJohannes Berg 			     const struct mesh_config *conf,
423929cbe68cSJohannes Berg 			     const struct mesh_setup *setup);
424029cbe68cSJohannes Berg 	int	(*leave_mesh)(struct wiphy *wiphy, struct net_device *dev);
424129cbe68cSJohannes Berg 
42426e0bd6c3SRostislav Lisovy 	int	(*join_ocb)(struct wiphy *wiphy, struct net_device *dev,
42436e0bd6c3SRostislav Lisovy 			    struct ocb_setup *setup);
42446e0bd6c3SRostislav Lisovy 	int	(*leave_ocb)(struct wiphy *wiphy, struct net_device *dev);
42456e0bd6c3SRostislav Lisovy 
42469f1ba906SJouni Malinen 	int	(*change_bss)(struct wiphy *wiphy, struct net_device *dev,
42479f1ba906SJouni Malinen 			      struct bss_parameters *params);
424831888487SJouni Malinen 
4249f70f01c2SEliad Peller 	int	(*set_txq_params)(struct wiphy *wiphy, struct net_device *dev,
425031888487SJouni Malinen 				  struct ieee80211_txq_params *params);
425172bdcf34SJouni Malinen 
4252e8c9bd5bSJohannes Berg 	int	(*libertas_set_mesh_channel)(struct wiphy *wiphy,
4253e8c9bd5bSJohannes Berg 					     struct net_device *dev,
4254e8c9bd5bSJohannes Berg 					     struct ieee80211_channel *chan);
4255e8c9bd5bSJohannes Berg 
4256e8c9bd5bSJohannes Berg 	int	(*set_monitor_channel)(struct wiphy *wiphy,
4257683b6d3bSJohannes Berg 				       struct cfg80211_chan_def *chandef);
42589aed3cc1SJouni Malinen 
4259fd014284SJohannes Berg 	int	(*scan)(struct wiphy *wiphy,
42602a519311SJohannes Berg 			struct cfg80211_scan_request *request);
426191d3ab46SVidyullatha Kanchanapally 	void	(*abort_scan)(struct wiphy *wiphy, struct wireless_dev *wdev);
4262636a5d36SJouni Malinen 
4263636a5d36SJouni Malinen 	int	(*auth)(struct wiphy *wiphy, struct net_device *dev,
4264636a5d36SJouni Malinen 			struct cfg80211_auth_request *req);
4265636a5d36SJouni Malinen 	int	(*assoc)(struct wiphy *wiphy, struct net_device *dev,
4266636a5d36SJouni Malinen 			 struct cfg80211_assoc_request *req);
4267636a5d36SJouni Malinen 	int	(*deauth)(struct wiphy *wiphy, struct net_device *dev,
426863c9c5e7SJohannes Berg 			  struct cfg80211_deauth_request *req);
4269636a5d36SJouni Malinen 	int	(*disassoc)(struct wiphy *wiphy, struct net_device *dev,
427063c9c5e7SJohannes Berg 			    struct cfg80211_disassoc_request *req);
427104a773adSJohannes Berg 
4272b23aa676SSamuel Ortiz 	int	(*connect)(struct wiphy *wiphy, struct net_device *dev,
4273b23aa676SSamuel Ortiz 			   struct cfg80211_connect_params *sme);
4274088e8df8Svamsi krishna 	int	(*update_connect_params)(struct wiphy *wiphy,
4275088e8df8Svamsi krishna 					 struct net_device *dev,
4276088e8df8Svamsi krishna 					 struct cfg80211_connect_params *sme,
4277088e8df8Svamsi krishna 					 u32 changed);
4278b23aa676SSamuel Ortiz 	int	(*disconnect)(struct wiphy *wiphy, struct net_device *dev,
4279b23aa676SSamuel Ortiz 			      u16 reason_code);
4280b23aa676SSamuel Ortiz 
428104a773adSJohannes Berg 	int	(*join_ibss)(struct wiphy *wiphy, struct net_device *dev,
428204a773adSJohannes Berg 			     struct cfg80211_ibss_params *params);
428304a773adSJohannes Berg 	int	(*leave_ibss)(struct wiphy *wiphy, struct net_device *dev);
4284b9a5f8caSJouni Malinen 
4285f4e583c8SAntonio Quartulli 	int	(*set_mcast_rate)(struct wiphy *wiphy, struct net_device *dev,
428657fbcce3SJohannes Berg 				  int rate[NUM_NL80211_BANDS]);
4287f4e583c8SAntonio Quartulli 
4288b9a5f8caSJouni Malinen 	int	(*set_wiphy_params)(struct wiphy *wiphy, u32 changed);
42897643a2c3SJohannes Berg 
4290c8442118SJohannes Berg 	int	(*set_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
4291fa61cf70SJuuso Oikarinen 				enum nl80211_tx_power_setting type, int mbm);
4292c8442118SJohannes Berg 	int	(*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
4293c8442118SJohannes Berg 				int *dbm);
42941f87f7d3SJohannes Berg 
42951f87f7d3SJohannes Berg 	void	(*rfkill_poll)(struct wiphy *wiphy);
4296aff89a9bSJohannes Berg 
4297aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE
4298fc73f11fSDavid Spinadel 	int	(*testmode_cmd)(struct wiphy *wiphy, struct wireless_dev *wdev,
4299fc73f11fSDavid Spinadel 				void *data, int len);
430071063f0eSWey-Yi Guy 	int	(*testmode_dump)(struct wiphy *wiphy, struct sk_buff *skb,
430171063f0eSWey-Yi Guy 				 struct netlink_callback *cb,
430271063f0eSWey-Yi Guy 				 void *data, int len);
4303aff89a9bSJohannes Berg #endif
4304bc92afd9SJohannes Berg 
43059930380fSJohannes Berg 	int	(*set_bitrate_mask)(struct wiphy *wiphy,
43069930380fSJohannes Berg 				    struct net_device *dev,
43079930380fSJohannes Berg 				    const u8 *peer,
43089930380fSJohannes Berg 				    const struct cfg80211_bitrate_mask *mask);
43099930380fSJohannes Berg 
431061fa713cSHolger Schurig 	int	(*dump_survey)(struct wiphy *wiphy, struct net_device *netdev,
431161fa713cSHolger Schurig 			int idx, struct survey_info *info);
431261fa713cSHolger Schurig 
431367fbb16bSSamuel Ortiz 	int	(*set_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
431467fbb16bSSamuel Ortiz 			     struct cfg80211_pmksa *pmksa);
431567fbb16bSSamuel Ortiz 	int	(*del_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
431667fbb16bSSamuel Ortiz 			     struct cfg80211_pmksa *pmksa);
431767fbb16bSSamuel Ortiz 	int	(*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev);
431867fbb16bSSamuel Ortiz 
43199588bbd5SJouni Malinen 	int	(*remain_on_channel)(struct wiphy *wiphy,
432071bbc994SJohannes Berg 				     struct wireless_dev *wdev,
43219588bbd5SJouni Malinen 				     struct ieee80211_channel *chan,
43229588bbd5SJouni Malinen 				     unsigned int duration,
43239588bbd5SJouni Malinen 				     u64 *cookie);
43249588bbd5SJouni Malinen 	int	(*cancel_remain_on_channel)(struct wiphy *wiphy,
432571bbc994SJohannes Berg 					    struct wireless_dev *wdev,
43269588bbd5SJouni Malinen 					    u64 cookie);
43279588bbd5SJouni Malinen 
432871bbc994SJohannes Berg 	int	(*mgmt_tx)(struct wiphy *wiphy, struct wireless_dev *wdev,
4329b176e629SAndrei Otcheretianski 			   struct cfg80211_mgmt_tx_params *params,
4330b176e629SAndrei Otcheretianski 			   u64 *cookie);
4331f7ca38dfSJohannes Berg 	int	(*mgmt_tx_cancel_wait)(struct wiphy *wiphy,
433271bbc994SJohannes Berg 				       struct wireless_dev *wdev,
4333f7ca38dfSJohannes Berg 				       u64 cookie);
4334026331c4SJouni Malinen 
4335bc92afd9SJohannes Berg 	int	(*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev,
4336bc92afd9SJohannes Berg 				  bool enabled, int timeout);
4337d6dc1a38SJuuso Oikarinen 
4338d6dc1a38SJuuso Oikarinen 	int	(*set_cqm_rssi_config)(struct wiphy *wiphy,
4339d6dc1a38SJuuso Oikarinen 				       struct net_device *dev,
4340d6dc1a38SJuuso Oikarinen 				       s32 rssi_thold, u32 rssi_hyst);
4341271733cfSJohannes Berg 
43424a4b8169SAndrew Zaborowski 	int	(*set_cqm_rssi_range_config)(struct wiphy *wiphy,
43434a4b8169SAndrew Zaborowski 					     struct net_device *dev,
43444a4b8169SAndrew Zaborowski 					     s32 rssi_low, s32 rssi_high);
43454a4b8169SAndrew Zaborowski 
434684f10708SThomas Pedersen 	int	(*set_cqm_txe_config)(struct wiphy *wiphy,
434784f10708SThomas Pedersen 				      struct net_device *dev,
434884f10708SThomas Pedersen 				      u32 rate, u32 pkts, u32 intvl);
434984f10708SThomas Pedersen 
43506cd536feSJohannes Berg 	void	(*update_mgmt_frame_registrations)(struct wiphy *wiphy,
435171bbc994SJohannes Berg 						   struct wireless_dev *wdev,
43526cd536feSJohannes Berg 						   struct mgmt_frame_regs *upd);
4353afe0cbf8SBruno Randolf 
4354afe0cbf8SBruno Randolf 	int	(*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant);
4355afe0cbf8SBruno Randolf 	int	(*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant);
43563677713bSJohn W. Linville 
4357807f8a8cSLuciano Coelho 	int	(*sched_scan_start)(struct wiphy *wiphy,
4358807f8a8cSLuciano Coelho 				struct net_device *dev,
4359807f8a8cSLuciano Coelho 				struct cfg80211_sched_scan_request *request);
43603a3ecf1dSArend Van Spriel 	int	(*sched_scan_stop)(struct wiphy *wiphy, struct net_device *dev,
43613a3ecf1dSArend Van Spriel 				   u64 reqid);
4362e5497d76SJohannes Berg 
4363e5497d76SJohannes Berg 	int	(*set_rekey_data)(struct wiphy *wiphy, struct net_device *dev,
4364e5497d76SJohannes Berg 				  struct cfg80211_gtk_rekey_data *data);
4365109086ceSArik Nemtsov 
4366109086ceSArik Nemtsov 	int	(*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev,
43673b3a0162SJohannes Berg 			     const u8 *peer, u8 action_code,  u8 dialog_token,
4368df942e7bSSunil Dutt Undekari 			     u16 status_code, u32 peer_capability,
436931fa97c5SArik Nemtsov 			     bool initiator, const u8 *buf, size_t len);
4370109086ceSArik Nemtsov 	int	(*tdls_oper)(struct wiphy *wiphy, struct net_device *dev,
43713b3a0162SJohannes Berg 			     const u8 *peer, enum nl80211_tdls_operation oper);
43727f6cf311SJohannes Berg 
43737f6cf311SJohannes Berg 	int	(*probe_client)(struct wiphy *wiphy, struct net_device *dev,
43747f6cf311SJohannes Berg 				const u8 *peer, u64 *cookie);
4375e999882aSJohannes Berg 
43761d9d9213SSimon Wunderlich 	int	(*set_noack_map)(struct wiphy *wiphy,
43771d9d9213SSimon Wunderlich 				  struct net_device *dev,
43781d9d9213SSimon Wunderlich 				  u16 noack_map);
43791d9d9213SSimon Wunderlich 
4380683b6d3bSJohannes Berg 	int	(*get_channel)(struct wiphy *wiphy,
43815b7ccaf3SJohannes Berg 			       struct wireless_dev *wdev,
4382683b6d3bSJohannes Berg 			       struct cfg80211_chan_def *chandef);
438398104fdeSJohannes Berg 
438498104fdeSJohannes Berg 	int	(*start_p2p_device)(struct wiphy *wiphy,
438598104fdeSJohannes Berg 				    struct wireless_dev *wdev);
438698104fdeSJohannes Berg 	void	(*stop_p2p_device)(struct wiphy *wiphy,
438798104fdeSJohannes Berg 				   struct wireless_dev *wdev);
438877765eafSVasanthakumar Thiagarajan 
438977765eafSVasanthakumar Thiagarajan 	int	(*set_mac_acl)(struct wiphy *wiphy, struct net_device *dev,
439077765eafSVasanthakumar Thiagarajan 			       const struct cfg80211_acl_data *params);
439104f39047SSimon Wunderlich 
439204f39047SSimon Wunderlich 	int	(*start_radar_detection)(struct wiphy *wiphy,
439304f39047SSimon Wunderlich 					 struct net_device *dev,
439431559f35SJanusz Dziedzic 					 struct cfg80211_chan_def *chandef,
439531559f35SJanusz Dziedzic 					 u32 cac_time_ms);
439626ec17a1SOrr Mazor 	void	(*end_cac)(struct wiphy *wiphy,
439726ec17a1SOrr Mazor 				struct net_device *dev);
4398355199e0SJouni Malinen 	int	(*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev,
4399355199e0SJouni Malinen 				 struct cfg80211_update_ft_ies_params *ftie);
44005de17984SArend van Spriel 	int	(*crit_proto_start)(struct wiphy *wiphy,
44015de17984SArend van Spriel 				    struct wireless_dev *wdev,
44025de17984SArend van Spriel 				    enum nl80211_crit_proto_id protocol,
44035de17984SArend van Spriel 				    u16 duration);
44045de17984SArend van Spriel 	void	(*crit_proto_stop)(struct wiphy *wiphy,
44055de17984SArend van Spriel 				   struct wireless_dev *wdev);
4406be29b99aSAmitkumar Karwar 	int	(*set_coalesce)(struct wiphy *wiphy,
4407be29b99aSAmitkumar Karwar 				struct cfg80211_coalesce *coalesce);
440816ef1fe2SSimon Wunderlich 
440916ef1fe2SSimon Wunderlich 	int	(*channel_switch)(struct wiphy *wiphy,
441016ef1fe2SSimon Wunderlich 				  struct net_device *dev,
441116ef1fe2SSimon Wunderlich 				  struct cfg80211_csa_settings *params);
4412e16821bcSJouni Malinen 
4413fa9ffc74SKyeyoon Park 	int     (*set_qos_map)(struct wiphy *wiphy,
4414fa9ffc74SKyeyoon Park 			       struct net_device *dev,
4415fa9ffc74SKyeyoon Park 			       struct cfg80211_qos_map *qos_map);
4416e16821bcSJouni Malinen 
4417e16821bcSJouni Malinen 	int	(*set_ap_chanwidth)(struct wiphy *wiphy, struct net_device *dev,
4418e16821bcSJouni Malinen 				    struct cfg80211_chan_def *chandef);
4419960d01acSJohannes Berg 
4420960d01acSJohannes Berg 	int	(*add_tx_ts)(struct wiphy *wiphy, struct net_device *dev,
4421960d01acSJohannes Berg 			     u8 tsid, const u8 *peer, u8 user_prio,
4422960d01acSJohannes Berg 			     u16 admitted_time);
4423960d01acSJohannes Berg 	int	(*del_tx_ts)(struct wiphy *wiphy, struct net_device *dev,
4424960d01acSJohannes Berg 			     u8 tsid, const u8 *peer);
44251057d35eSArik Nemtsov 
44261057d35eSArik Nemtsov 	int	(*tdls_channel_switch)(struct wiphy *wiphy,
44271057d35eSArik Nemtsov 				       struct net_device *dev,
44281057d35eSArik Nemtsov 				       const u8 *addr, u8 oper_class,
44291057d35eSArik Nemtsov 				       struct cfg80211_chan_def *chandef);
44301057d35eSArik Nemtsov 	void	(*tdls_cancel_channel_switch)(struct wiphy *wiphy,
44311057d35eSArik Nemtsov 					      struct net_device *dev,
44321057d35eSArik Nemtsov 					      const u8 *addr);
4433cb3b7d87SAyala Beker 	int	(*start_nan)(struct wiphy *wiphy, struct wireless_dev *wdev,
4434cb3b7d87SAyala Beker 			     struct cfg80211_nan_conf *conf);
4435cb3b7d87SAyala Beker 	void	(*stop_nan)(struct wiphy *wiphy, struct wireless_dev *wdev);
4436a442b761SAyala Beker 	int	(*add_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev,
4437a442b761SAyala Beker 				struct cfg80211_nan_func *nan_func);
4438a442b761SAyala Beker 	void	(*del_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev,
4439a442b761SAyala Beker 			       u64 cookie);
4440a5a9dcf2SAyala Beker 	int	(*nan_change_conf)(struct wiphy *wiphy,
4441a5a9dcf2SAyala Beker 				   struct wireless_dev *wdev,
4442a5a9dcf2SAyala Beker 				   struct cfg80211_nan_conf *conf,
4443a5a9dcf2SAyala Beker 				   u32 changes);
4444ce0ce13aSMichael Braun 
4445ce0ce13aSMichael Braun 	int	(*set_multicast_to_unicast)(struct wiphy *wiphy,
4446ce0ce13aSMichael Braun 					    struct net_device *dev,
4447ce0ce13aSMichael Braun 					    const bool enabled);
44483a00df57SAvraham Stern 
444952539ca8SToke Høiland-Jørgensen 	int	(*get_txq_stats)(struct wiphy *wiphy,
445052539ca8SToke Høiland-Jørgensen 				 struct wireless_dev *wdev,
445152539ca8SToke Høiland-Jørgensen 				 struct cfg80211_txq_stats *txqstats);
445252539ca8SToke Høiland-Jørgensen 
44533a00df57SAvraham Stern 	int	(*set_pmk)(struct wiphy *wiphy, struct net_device *dev,
44543a00df57SAvraham Stern 			   const struct cfg80211_pmk_conf *conf);
44553a00df57SAvraham Stern 	int	(*del_pmk)(struct wiphy *wiphy, struct net_device *dev,
44563a00df57SAvraham Stern 			   const u8 *aa);
445740cbfa90SSrinivas Dasari 	int     (*external_auth)(struct wiphy *wiphy, struct net_device *dev,
445840cbfa90SSrinivas Dasari 				 struct cfg80211_external_auth_params *params);
44592576a9acSDenis Kenzior 
44602576a9acSDenis Kenzior 	int	(*tx_control_port)(struct wiphy *wiphy,
44612576a9acSDenis Kenzior 				   struct net_device *dev,
44622576a9acSDenis Kenzior 				   const u8 *buf, size_t len,
44638d74a623SJohannes Berg 				   const u8 *dest, const __be16 proto,
4464dca9ca2dSMarkus Theil 				   const bool noencrypt,
4465dca9ca2dSMarkus Theil 				   u64 *cookie);
446681e54d08SPradeep Kumar Chitrapu 
446781e54d08SPradeep Kumar Chitrapu 	int	(*get_ftm_responder_stats)(struct wiphy *wiphy,
446881e54d08SPradeep Kumar Chitrapu 				struct net_device *dev,
446981e54d08SPradeep Kumar Chitrapu 				struct cfg80211_ftm_responder_stats *ftm_stats);
44709bb7e0f2SJohannes Berg 
44719bb7e0f2SJohannes Berg 	int	(*start_pmsr)(struct wiphy *wiphy, struct wireless_dev *wdev,
44729bb7e0f2SJohannes Berg 			      struct cfg80211_pmsr_request *request);
44739bb7e0f2SJohannes Berg 	void	(*abort_pmsr)(struct wiphy *wiphy, struct wireless_dev *wdev,
44749bb7e0f2SJohannes Berg 			      struct cfg80211_pmsr_request *request);
4475cb74e977SSunil Dutt 	int	(*update_owe_info)(struct wiphy *wiphy, struct net_device *dev,
4476cb74e977SSunil Dutt 				   struct cfg80211_update_owe_info *owe_info);
44775ab92e7fSRajkumar Manoharan 	int	(*probe_mesh_link)(struct wiphy *wiphy, struct net_device *dev,
44785ab92e7fSRajkumar Manoharan 				   const u8 *buf, size_t len);
447977f576deSTamizh chelvam 	int     (*set_tid_config)(struct wiphy *wiphy, struct net_device *dev,
44803710a8a6SJohannes Berg 				  struct cfg80211_tid_config *tid_conf);
448177f576deSTamizh chelvam 	int	(*reset_tid_config)(struct wiphy *wiphy, struct net_device *dev,
44823710a8a6SJohannes Berg 				    const u8 *peer, u8 tids);
44836bdb68ceSCarl Huang 	int	(*set_sar_specs)(struct wiphy *wiphy,
44846bdb68ceSCarl Huang 				 struct cfg80211_sar_specs *sar);
44850d2ab3aeSJohn Crispin 	int	(*color_change)(struct wiphy *wiphy,
44860d2ab3aeSJohn Crispin 				struct net_device *dev,
44870d2ab3aeSJohn Crispin 				struct cfg80211_color_change_settings *params);
4488e306784aSSubrat Mishra 	int     (*set_fils_aad)(struct wiphy *wiphy, struct net_device *dev,
4489e306784aSSubrat Mishra 				struct cfg80211_fils_aad *fils_aad);
4490a95bfb87SLorenzo Bianconi 	int	(*set_radar_background)(struct wiphy *wiphy,
4491bc2dfc02SLorenzo Bianconi 					struct cfg80211_chan_def *chandef);
4492704232c2SJohannes Berg };
4493704232c2SJohannes Berg 
4494d3236553SJohannes Berg /*
4495d3236553SJohannes Berg  * wireless hardware and networking interfaces structures
4496d3236553SJohannes Berg  * and registration/helper functions
4497d3236553SJohannes Berg  */
4498d3236553SJohannes Berg 
4499d3236553SJohannes Berg /**
45005be83de5SJohannes Berg  * enum wiphy_flags - wiphy capability flags
45015be83de5SJohannes Berg  *
4502c8cb5b85STova Mussai  * @WIPHY_FLAG_SPLIT_SCAN_6GHZ: if set to true, the scan request will be split
4503c8cb5b85STova Mussai  *	 into two, first for legacy bands and second for UHB.
45045be83de5SJohannes Berg  * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this
45055be83de5SJohannes Berg  *	wiphy at all
45065be83de5SJohannes Berg  * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled
45075be83de5SJohannes Berg  *	by default -- this flag will be set depending on the kernel's default
45085be83de5SJohannes Berg  *	on wiphy_new(), but can be changed by the driver if it has a good
45095be83de5SJohannes Berg  *	reason to override the default
45109bc383deSJohannes Berg  * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station
451133d915d9SManikanta Pubbisetty  *	on a VLAN interface). This flag also serves an extra purpose of
451233d915d9SManikanta Pubbisetty  *	supporting 4ADDR AP mode on devices which do not support AP/VLAN iftype.
45139bc383deSJohannes Berg  * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station
4514c0692b8fSJohannes Berg  * @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the
4515c0692b8fSJohannes Berg  *	control port protocol ethertype. The device also honours the
4516c0692b8fSJohannes Berg  *	control_port_no_encrypt flag.
4517e31b8213SJohannes Berg  * @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN.
451815d5dda6SJavier Cardona  * @WIPHY_FLAG_MESH_AUTH: The device supports mesh authentication by routing
451915d5dda6SJavier Cardona  *	auth frames to userspace. See @NL80211_MESH_SETUP_USERSPACE_AUTH.
4520f4b34b55SVivek Natarajan  * @WIPHY_FLAG_SUPPORTS_FW_ROAM: The device supports roaming feature in the
4521f4b34b55SVivek Natarajan  *	firmware.
4522cedb5412SEliad Peller  * @WIPHY_FLAG_AP_UAPSD: The device supports uapsd on AP.
4523109086ceSArik Nemtsov  * @WIPHY_FLAG_SUPPORTS_TDLS: The device supports TDLS (802.11z) operation.
4524109086ceSArik Nemtsov  * @WIPHY_FLAG_TDLS_EXTERNAL_SETUP: The device does not handle TDLS (802.11z)
4525109086ceSArik Nemtsov  *	link setup/discovery operations internally. Setup, discovery and
4526109086ceSArik Nemtsov  *	teardown packets should be sent through the @NL80211_CMD_TDLS_MGMT
4527109086ceSArik Nemtsov  *	command. When this flag is not set, @NL80211_CMD_TDLS_OPER should be
4528109086ceSArik Nemtsov  *	used for asking the driver/firmware to perform a TDLS operation.
4529562a7480SJohannes Berg  * @WIPHY_FLAG_HAVE_AP_SME: device integrates AP SME
45305e760230SJohannes Berg  * @WIPHY_FLAG_REPORTS_OBSS: the device will report beacons from other BSSes
45315e760230SJohannes Berg  *	when there are virtual interfaces in AP mode by calling
45325e760230SJohannes Berg  *	cfg80211_report_obss_beacon().
453387bbbe22SArik Nemtsov  * @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD: When operating as an AP, the device
453487bbbe22SArik Nemtsov  *	responds to probe-requests in hardware.
45357c4ef712SJohannes Berg  * @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX.
45367c4ef712SJohannes Berg  * @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call.
45372f301ab2SSimon Wunderlich  * @WIPHY_FLAG_SUPPORTS_5_10_MHZ: Device supports 5 MHz and 10 MHz channels.
453816ef1fe2SSimon Wunderlich  * @WIPHY_FLAG_HAS_CHANNEL_SWITCH: Device supports channel switch in
453916ef1fe2SSimon Wunderlich  *	beaconing mode (AP, IBSS, Mesh, ...).
4540b8676221SDavid Spinadel  * @WIPHY_FLAG_HAS_STATIC_WEP: The device supports static WEP key installation
4541b8676221SDavid Spinadel  *	before connection.
4542093a48d2SNathan Errera  * @WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK: The device supports bigger kek and kck keys
45435be83de5SJohannes Berg  */
45445be83de5SJohannes Berg enum wiphy_flags {
4545093a48d2SNathan Errera 	WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK		= BIT(0),
4546a2f73b6cSLuis R. Rodriguez 	/* use hole at 1 */
4547c8cb5b85STova Mussai 	WIPHY_FLAG_SPLIT_SCAN_6GHZ		= BIT(2),
45485be83de5SJohannes Berg 	WIPHY_FLAG_NETNS_OK			= BIT(3),
45495be83de5SJohannes Berg 	WIPHY_FLAG_PS_ON_BY_DEFAULT		= BIT(4),
45509bc383deSJohannes Berg 	WIPHY_FLAG_4ADDR_AP			= BIT(5),
45519bc383deSJohannes Berg 	WIPHY_FLAG_4ADDR_STATION		= BIT(6),
4552c0692b8fSJohannes Berg 	WIPHY_FLAG_CONTROL_PORT_PROTOCOL	= BIT(7),
4553309075cfSJussi Kivilinna 	WIPHY_FLAG_IBSS_RSN			= BIT(8),
455415d5dda6SJavier Cardona 	WIPHY_FLAG_MESH_AUTH			= BIT(10),
4555ca986ad9SArend Van Spriel 	/* use hole at 11 */
45568e8b41f9SJohannes Berg 	/* use hole at 12 */
4557f4b34b55SVivek Natarajan 	WIPHY_FLAG_SUPPORTS_FW_ROAM		= BIT(13),
4558cedb5412SEliad Peller 	WIPHY_FLAG_AP_UAPSD			= BIT(14),
4559109086ceSArik Nemtsov 	WIPHY_FLAG_SUPPORTS_TDLS		= BIT(15),
4560109086ceSArik Nemtsov 	WIPHY_FLAG_TDLS_EXTERNAL_SETUP		= BIT(16),
4561562a7480SJohannes Berg 	WIPHY_FLAG_HAVE_AP_SME			= BIT(17),
45625e760230SJohannes Berg 	WIPHY_FLAG_REPORTS_OBSS			= BIT(18),
456387bbbe22SArik Nemtsov 	WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD	= BIT(19),
45647c4ef712SJohannes Berg 	WIPHY_FLAG_OFFCHAN_TX			= BIT(20),
45657c4ef712SJohannes Berg 	WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL	= BIT(21),
45662f301ab2SSimon Wunderlich 	WIPHY_FLAG_SUPPORTS_5_10_MHZ		= BIT(22),
456716ef1fe2SSimon Wunderlich 	WIPHY_FLAG_HAS_CHANNEL_SWITCH		= BIT(23),
4568b8676221SDavid Spinadel 	WIPHY_FLAG_HAS_STATIC_WEP		= BIT(24),
45697527a782SJohannes Berg };
45707527a782SJohannes Berg 
45717527a782SJohannes Berg /**
45727527a782SJohannes Berg  * struct ieee80211_iface_limit - limit on certain interface types
45737527a782SJohannes Berg  * @max: maximum number of interfaces of these types
45747527a782SJohannes Berg  * @types: interface types (bits)
45757527a782SJohannes Berg  */
45767527a782SJohannes Berg struct ieee80211_iface_limit {
45777527a782SJohannes Berg 	u16 max;
45787527a782SJohannes Berg 	u16 types;
45797527a782SJohannes Berg };
45807527a782SJohannes Berg 
45817527a782SJohannes Berg /**
45827527a782SJohannes Berg  * struct ieee80211_iface_combination - possible interface combination
45837527a782SJohannes Berg  *
4584b80edbc1SLuciano Coelho  * With this structure the driver can describe which interface
4585b80edbc1SLuciano Coelho  * combinations it supports concurrently.
45867527a782SJohannes Berg  *
4587b80edbc1SLuciano Coelho  * Examples:
4588b80edbc1SLuciano Coelho  *
4589b80edbc1SLuciano Coelho  * 1. Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total:
45907527a782SJohannes Berg  *
4591819bf593SJohannes Berg  *    .. code-block:: c
4592819bf593SJohannes Berg  *
45937527a782SJohannes Berg  *	struct ieee80211_iface_limit limits1[] = {
45947527a782SJohannes Berg  *		{ .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
45957527a782SJohannes Berg  *		{ .max = 1, .types = BIT(NL80211_IFTYPE_AP}, },
45967527a782SJohannes Berg  *	};
45977527a782SJohannes Berg  *	struct ieee80211_iface_combination combination1 = {
45987527a782SJohannes Berg  *		.limits = limits1,
45997527a782SJohannes Berg  *		.n_limits = ARRAY_SIZE(limits1),
46007527a782SJohannes Berg  *		.max_interfaces = 2,
46017527a782SJohannes Berg  *		.beacon_int_infra_match = true,
46027527a782SJohannes Berg  *	};
46037527a782SJohannes Berg  *
46047527a782SJohannes Berg  *
4605b80edbc1SLuciano Coelho  * 2. Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total:
46067527a782SJohannes Berg  *
4607819bf593SJohannes Berg  *    .. code-block:: c
4608819bf593SJohannes Berg  *
46097527a782SJohannes Berg  *	struct ieee80211_iface_limit limits2[] = {
46107527a782SJohannes Berg  *		{ .max = 8, .types = BIT(NL80211_IFTYPE_AP) |
46117527a782SJohannes Berg  *				     BIT(NL80211_IFTYPE_P2P_GO), },
46127527a782SJohannes Berg  *	};
46137527a782SJohannes Berg  *	struct ieee80211_iface_combination combination2 = {
46147527a782SJohannes Berg  *		.limits = limits2,
46157527a782SJohannes Berg  *		.n_limits = ARRAY_SIZE(limits2),
46167527a782SJohannes Berg  *		.max_interfaces = 8,
46177527a782SJohannes Berg  *		.num_different_channels = 1,
46187527a782SJohannes Berg  *	};
46197527a782SJohannes Berg  *
46207527a782SJohannes Berg  *
4621b80edbc1SLuciano Coelho  * 3. Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total.
4622b80edbc1SLuciano Coelho  *
46237527a782SJohannes Berg  *    This allows for an infrastructure connection and three P2P connections.
46247527a782SJohannes Berg  *
4625819bf593SJohannes Berg  *    .. code-block:: c
4626819bf593SJohannes Berg  *
46277527a782SJohannes Berg  *	struct ieee80211_iface_limit limits3[] = {
46287527a782SJohannes Berg  *		{ .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
46297527a782SJohannes Berg  *		{ .max = 3, .types = BIT(NL80211_IFTYPE_P2P_GO) |
46307527a782SJohannes Berg  *				     BIT(NL80211_IFTYPE_P2P_CLIENT), },
46317527a782SJohannes Berg  *	};
46327527a782SJohannes Berg  *	struct ieee80211_iface_combination combination3 = {
46337527a782SJohannes Berg  *		.limits = limits3,
46347527a782SJohannes Berg  *		.n_limits = ARRAY_SIZE(limits3),
46357527a782SJohannes Berg  *		.max_interfaces = 4,
46367527a782SJohannes Berg  *		.num_different_channels = 2,
46377527a782SJohannes Berg  *	};
4638819bf593SJohannes Berg  *
46397527a782SJohannes Berg  */
46407527a782SJohannes Berg struct ieee80211_iface_combination {
4641c6c94aeaSJohannes Berg 	/**
4642c6c94aeaSJohannes Berg 	 * @limits:
4643c6c94aeaSJohannes Berg 	 * limits for the given interface types
4644c6c94aeaSJohannes Berg 	 */
46457527a782SJohannes Berg 	const struct ieee80211_iface_limit *limits;
4646c6c94aeaSJohannes Berg 
4647c6c94aeaSJohannes Berg 	/**
4648c6c94aeaSJohannes Berg 	 * @num_different_channels:
4649c6c94aeaSJohannes Berg 	 * can use up to this many different channels
4650c6c94aeaSJohannes Berg 	 */
46517527a782SJohannes Berg 	u32 num_different_channels;
4652c6c94aeaSJohannes Berg 
4653c6c94aeaSJohannes Berg 	/**
4654c6c94aeaSJohannes Berg 	 * @max_interfaces:
4655c6c94aeaSJohannes Berg 	 * maximum number of interfaces in total allowed in this group
4656c6c94aeaSJohannes Berg 	 */
46577527a782SJohannes Berg 	u16 max_interfaces;
4658c6c94aeaSJohannes Berg 
4659c6c94aeaSJohannes Berg 	/**
4660c6c94aeaSJohannes Berg 	 * @n_limits:
4661c6c94aeaSJohannes Berg 	 * number of limitations
4662c6c94aeaSJohannes Berg 	 */
46637527a782SJohannes Berg 	u8 n_limits;
4664c6c94aeaSJohannes Berg 
4665c6c94aeaSJohannes Berg 	/**
4666c6c94aeaSJohannes Berg 	 * @beacon_int_infra_match:
4667c6c94aeaSJohannes Berg 	 * In this combination, the beacon intervals between infrastructure
4668c6c94aeaSJohannes Berg 	 * and AP types must match. This is required only in special cases.
4669c6c94aeaSJohannes Berg 	 */
46707527a782SJohannes Berg 	bool beacon_int_infra_match;
4671c6c94aeaSJohannes Berg 
4672c6c94aeaSJohannes Berg 	/**
4673c6c94aeaSJohannes Berg 	 * @radar_detect_widths:
4674c6c94aeaSJohannes Berg 	 * bitmap of channel widths supported for radar detection
4675c6c94aeaSJohannes Berg 	 */
467611c4a075SSimon Wunderlich 	u8 radar_detect_widths;
4677c6c94aeaSJohannes Berg 
4678c6c94aeaSJohannes Berg 	/**
4679c6c94aeaSJohannes Berg 	 * @radar_detect_regions:
4680c6c94aeaSJohannes Berg 	 * bitmap of regions supported for radar detection
4681c6c94aeaSJohannes Berg 	 */
46828c48b50aSFelix Fietkau 	u8 radar_detect_regions;
4683c6c94aeaSJohannes Berg 
4684c6c94aeaSJohannes Berg 	/**
4685c6c94aeaSJohannes Berg 	 * @beacon_int_min_gcd:
4686c6c94aeaSJohannes Berg 	 * This interface combination supports different beacon intervals.
4687c6c94aeaSJohannes Berg 	 *
4688c6c94aeaSJohannes Berg 	 * = 0
4689c6c94aeaSJohannes Berg 	 *   all beacon intervals for different interface must be same.
4690c6c94aeaSJohannes Berg 	 * > 0
4691c6c94aeaSJohannes Berg 	 *   any beacon interval for the interface part of this combination AND
4692c6c94aeaSJohannes Berg 	 *   GCD of all beacon intervals from beaconing interfaces of this
4693c6c94aeaSJohannes Berg 	 *   combination must be greater or equal to this value.
4694c6c94aeaSJohannes Berg 	 */
46950c317a02SPurushottam Kushwaha 	u32 beacon_int_min_gcd;
46965be83de5SJohannes Berg };
46975be83de5SJohannes Berg 
46982e161f78SJohannes Berg struct ieee80211_txrx_stypes {
46992e161f78SJohannes Berg 	u16 tx, rx;
47002e161f78SJohannes Berg };
47012e161f78SJohannes Berg 
47025be83de5SJohannes Berg /**
4703ff1b6e69SJohannes Berg  * enum wiphy_wowlan_support_flags - WoWLAN support flags
4704ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_ANY: supports wakeup for the special "any"
4705ff1b6e69SJohannes Berg  *	trigger that keeps the device operating as-is and
4706ff1b6e69SJohannes Berg  *	wakes up the host on any activity, for example a
4707ff1b6e69SJohannes Berg  *	received packet that passed filtering; note that the
4708ff1b6e69SJohannes Berg  *	packet should be preserved in that case
4709ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_MAGIC_PKT: supports wakeup on magic packet
4710ff1b6e69SJohannes Berg  *	(see nl80211.h)
4711ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_DISCONNECT: supports wakeup on disconnect
471277dbbb13SJohannes Berg  * @WIPHY_WOWLAN_SUPPORTS_GTK_REKEY: supports GTK rekeying while asleep
471377dbbb13SJohannes Berg  * @WIPHY_WOWLAN_GTK_REKEY_FAILURE: supports wakeup on GTK rekey failure
471477dbbb13SJohannes Berg  * @WIPHY_WOWLAN_EAP_IDENTITY_REQ: supports wakeup on EAP identity request
471577dbbb13SJohannes Berg  * @WIPHY_WOWLAN_4WAY_HANDSHAKE: supports wakeup on 4-way handshake failure
471677dbbb13SJohannes Berg  * @WIPHY_WOWLAN_RFKILL_RELEASE: supports wakeup on RF-kill release
47178cd4d456SLuciano Coelho  * @WIPHY_WOWLAN_NET_DETECT: supports wakeup on network detection
4718ff1b6e69SJohannes Berg  */
4719ff1b6e69SJohannes Berg enum wiphy_wowlan_support_flags {
4720ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_ANY		= BIT(0),
4721ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_MAGIC_PKT		= BIT(1),
4722ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_DISCONNECT		= BIT(2),
472377dbbb13SJohannes Berg 	WIPHY_WOWLAN_SUPPORTS_GTK_REKEY	= BIT(3),
472477dbbb13SJohannes Berg 	WIPHY_WOWLAN_GTK_REKEY_FAILURE	= BIT(4),
472577dbbb13SJohannes Berg 	WIPHY_WOWLAN_EAP_IDENTITY_REQ	= BIT(5),
472677dbbb13SJohannes Berg 	WIPHY_WOWLAN_4WAY_HANDSHAKE	= BIT(6),
472777dbbb13SJohannes Berg 	WIPHY_WOWLAN_RFKILL_RELEASE	= BIT(7),
47288cd4d456SLuciano Coelho 	WIPHY_WOWLAN_NET_DETECT		= BIT(8),
4729ff1b6e69SJohannes Berg };
4730ff1b6e69SJohannes Berg 
47312a0e047eSJohannes Berg struct wiphy_wowlan_tcp_support {
47322a0e047eSJohannes Berg 	const struct nl80211_wowlan_tcp_data_token_feature *tok;
47332a0e047eSJohannes Berg 	u32 data_payload_max;
47342a0e047eSJohannes Berg 	u32 data_interval_max;
47352a0e047eSJohannes Berg 	u32 wake_payload_max;
47362a0e047eSJohannes Berg 	bool seq;
47372a0e047eSJohannes Berg };
47382a0e047eSJohannes Berg 
4739ff1b6e69SJohannes Berg /**
4740ff1b6e69SJohannes Berg  * struct wiphy_wowlan_support - WoWLAN support data
4741ff1b6e69SJohannes Berg  * @flags: see &enum wiphy_wowlan_support_flags
4742ff1b6e69SJohannes Berg  * @n_patterns: number of supported wakeup patterns
4743ff1b6e69SJohannes Berg  *	(see nl80211.h for the pattern definition)
4744ff1b6e69SJohannes Berg  * @pattern_max_len: maximum length of each pattern
4745ff1b6e69SJohannes Berg  * @pattern_min_len: minimum length of each pattern
4746bb92d199SAmitkumar Karwar  * @max_pkt_offset: maximum Rx packet offset
47478cd4d456SLuciano Coelho  * @max_nd_match_sets: maximum number of matchsets for net-detect,
47488cd4d456SLuciano Coelho  *	similar, but not necessarily identical, to max_match_sets for
47498cd4d456SLuciano Coelho  *	scheduled scans.
47508cd4d456SLuciano Coelho  *	See &struct cfg80211_sched_scan_request.@match_sets for more
47518cd4d456SLuciano Coelho  *	details.
47522a0e047eSJohannes Berg  * @tcp: TCP wakeup support information
4753ff1b6e69SJohannes Berg  */
4754ff1b6e69SJohannes Berg struct wiphy_wowlan_support {
4755ff1b6e69SJohannes Berg 	u32 flags;
4756ff1b6e69SJohannes Berg 	int n_patterns;
4757ff1b6e69SJohannes Berg 	int pattern_max_len;
4758ff1b6e69SJohannes Berg 	int pattern_min_len;
4759bb92d199SAmitkumar Karwar 	int max_pkt_offset;
47608cd4d456SLuciano Coelho 	int max_nd_match_sets;
47612a0e047eSJohannes Berg 	const struct wiphy_wowlan_tcp_support *tcp;
4762ff1b6e69SJohannes Berg };
4763ff1b6e69SJohannes Berg 
4764ff1b6e69SJohannes Berg /**
4765be29b99aSAmitkumar Karwar  * struct wiphy_coalesce_support - coalesce support data
4766be29b99aSAmitkumar Karwar  * @n_rules: maximum number of coalesce rules
4767be29b99aSAmitkumar Karwar  * @max_delay: maximum supported coalescing delay in msecs
4768be29b99aSAmitkumar Karwar  * @n_patterns: number of supported patterns in a rule
4769be29b99aSAmitkumar Karwar  *	(see nl80211.h for the pattern definition)
4770be29b99aSAmitkumar Karwar  * @pattern_max_len: maximum length of each pattern
4771be29b99aSAmitkumar Karwar  * @pattern_min_len: minimum length of each pattern
4772be29b99aSAmitkumar Karwar  * @max_pkt_offset: maximum Rx packet offset
4773be29b99aSAmitkumar Karwar  */
4774be29b99aSAmitkumar Karwar struct wiphy_coalesce_support {
4775be29b99aSAmitkumar Karwar 	int n_rules;
4776be29b99aSAmitkumar Karwar 	int max_delay;
4777be29b99aSAmitkumar Karwar 	int n_patterns;
4778be29b99aSAmitkumar Karwar 	int pattern_max_len;
4779be29b99aSAmitkumar Karwar 	int pattern_min_len;
4780be29b99aSAmitkumar Karwar 	int max_pkt_offset;
4781be29b99aSAmitkumar Karwar };
4782be29b99aSAmitkumar Karwar 
4783be29b99aSAmitkumar Karwar /**
4784ad7e718cSJohannes Berg  * enum wiphy_vendor_command_flags - validation flags for vendor commands
4785ad7e718cSJohannes Berg  * @WIPHY_VENDOR_CMD_NEED_WDEV: vendor command requires wdev
4786ad7e718cSJohannes Berg  * @WIPHY_VENDOR_CMD_NEED_NETDEV: vendor command requires netdev
4787ad7e718cSJohannes Berg  * @WIPHY_VENDOR_CMD_NEED_RUNNING: interface/wdev must be up & running
4788ad7e718cSJohannes Berg  *	(must be combined with %_WDEV or %_NETDEV)
4789ad7e718cSJohannes Berg  */
4790ad7e718cSJohannes Berg enum wiphy_vendor_command_flags {
4791ad7e718cSJohannes Berg 	WIPHY_VENDOR_CMD_NEED_WDEV = BIT(0),
4792ad7e718cSJohannes Berg 	WIPHY_VENDOR_CMD_NEED_NETDEV = BIT(1),
4793ad7e718cSJohannes Berg 	WIPHY_VENDOR_CMD_NEED_RUNNING = BIT(2),
4794ad7e718cSJohannes Berg };
4795ad7e718cSJohannes Berg 
4796ad7e718cSJohannes Berg /**
4797466b9936Stamizhr@codeaurora.org  * enum wiphy_opmode_flag - Station's ht/vht operation mode information flags
4798466b9936Stamizhr@codeaurora.org  *
4799466b9936Stamizhr@codeaurora.org  * @STA_OPMODE_MAX_BW_CHANGED: Max Bandwidth changed
4800466b9936Stamizhr@codeaurora.org  * @STA_OPMODE_SMPS_MODE_CHANGED: SMPS mode changed
4801466b9936Stamizhr@codeaurora.org  * @STA_OPMODE_N_SS_CHANGED: max N_SS (number of spatial streams) changed
4802466b9936Stamizhr@codeaurora.org  *
4803466b9936Stamizhr@codeaurora.org  */
4804466b9936Stamizhr@codeaurora.org enum wiphy_opmode_flag {
4805466b9936Stamizhr@codeaurora.org 	STA_OPMODE_MAX_BW_CHANGED	= BIT(0),
4806466b9936Stamizhr@codeaurora.org 	STA_OPMODE_SMPS_MODE_CHANGED	= BIT(1),
4807466b9936Stamizhr@codeaurora.org 	STA_OPMODE_N_SS_CHANGED		= BIT(2),
4808466b9936Stamizhr@codeaurora.org };
4809466b9936Stamizhr@codeaurora.org 
4810466b9936Stamizhr@codeaurora.org /**
4811466b9936Stamizhr@codeaurora.org  * struct sta_opmode_info - Station's ht/vht operation mode information
4812466b9936Stamizhr@codeaurora.org  * @changed: contains value from &enum wiphy_opmode_flag
48135e78abd0Stamizhr@codeaurora.org  * @smps_mode: New SMPS mode value from &enum nl80211_smps_mode of a station
48145e78abd0Stamizhr@codeaurora.org  * @bw: new max bandwidth value from &enum nl80211_chan_width of a station
4815466b9936Stamizhr@codeaurora.org  * @rx_nss: new rx_nss value of a station
4816466b9936Stamizhr@codeaurora.org  */
4817466b9936Stamizhr@codeaurora.org 
4818466b9936Stamizhr@codeaurora.org struct sta_opmode_info {
4819466b9936Stamizhr@codeaurora.org 	u32 changed;
48205e78abd0Stamizhr@codeaurora.org 	enum nl80211_smps_mode smps_mode;
48215e78abd0Stamizhr@codeaurora.org 	enum nl80211_chan_width bw;
4822466b9936Stamizhr@codeaurora.org 	u8 rx_nss;
4823466b9936Stamizhr@codeaurora.org };
4824466b9936Stamizhr@codeaurora.org 
482591046d63SJohannes Berg #define VENDOR_CMD_RAW_DATA ((const struct nla_policy *)(long)(-ENODATA))
4826901bb989SJohannes Berg 
4827466b9936Stamizhr@codeaurora.org /**
4828ad7e718cSJohannes Berg  * struct wiphy_vendor_command - vendor command definition
4829ad7e718cSJohannes Berg  * @info: vendor command identifying information, as used in nl80211
4830ad7e718cSJohannes Berg  * @flags: flags, see &enum wiphy_vendor_command_flags
4831ad7e718cSJohannes Berg  * @doit: callback for the operation, note that wdev is %NULL if the
4832ad7e718cSJohannes Berg  *	flags didn't ask for a wdev and non-%NULL otherwise; the data
4833ad7e718cSJohannes Berg  *	pointer may be %NULL if userspace provided no data at all
48347bdbe400SJohannes Berg  * @dumpit: dump callback, for transferring bigger/multiple items. The
48357bdbe400SJohannes Berg  *	@storage points to cb->args[5], ie. is preserved over the multiple
48367bdbe400SJohannes Berg  *	dumpit calls.
4837901bb989SJohannes Berg  * @policy: policy pointer for attributes within %NL80211_ATTR_VENDOR_DATA.
4838901bb989SJohannes Berg  *	Set this to %VENDOR_CMD_RAW_DATA if no policy can be given and the
4839901bb989SJohannes Berg  *	attribute is just raw data (e.g. a firmware command).
4840901bb989SJohannes Berg  * @maxattr: highest attribute number in policy
48417bdbe400SJohannes Berg  * It's recommended to not have the same sub command with both @doit and
48427bdbe400SJohannes Berg  * @dumpit, so that userspace can assume certain ones are get and others
48437bdbe400SJohannes Berg  * are used with dump requests.
4844ad7e718cSJohannes Berg  */
4845ad7e718cSJohannes Berg struct wiphy_vendor_command {
4846ad7e718cSJohannes Berg 	struct nl80211_vendor_cmd_info info;
4847ad7e718cSJohannes Berg 	u32 flags;
4848ad7e718cSJohannes Berg 	int (*doit)(struct wiphy *wiphy, struct wireless_dev *wdev,
4849ad7e718cSJohannes Berg 		    const void *data, int data_len);
48507bdbe400SJohannes Berg 	int (*dumpit)(struct wiphy *wiphy, struct wireless_dev *wdev,
48517bdbe400SJohannes Berg 		      struct sk_buff *skb, const void *data, int data_len,
48527bdbe400SJohannes Berg 		      unsigned long *storage);
4853901bb989SJohannes Berg 	const struct nla_policy *policy;
4854901bb989SJohannes Berg 	unsigned int maxattr;
4855ad7e718cSJohannes Berg };
4856ad7e718cSJohannes Berg 
4857ad7e718cSJohannes Berg /**
4858019ae3a9SKanchanapally, Vidyullatha  * struct wiphy_iftype_ext_capab - extended capabilities per interface type
4859019ae3a9SKanchanapally, Vidyullatha  * @iftype: interface type
4860019ae3a9SKanchanapally, Vidyullatha  * @extended_capabilities: extended capabilities supported by the driver,
4861019ae3a9SKanchanapally, Vidyullatha  *	additional capabilities might be supported by userspace; these are the
4862019ae3a9SKanchanapally, Vidyullatha  *	802.11 extended capabilities ("Extended Capabilities element") and are
4863019ae3a9SKanchanapally, Vidyullatha  *	in the same format as in the information element. See IEEE Std
4864019ae3a9SKanchanapally, Vidyullatha  *	802.11-2012 8.4.2.29 for the defined fields.
4865019ae3a9SKanchanapally, Vidyullatha  * @extended_capabilities_mask: mask of the valid values
4866019ae3a9SKanchanapally, Vidyullatha  * @extended_capabilities_len: length of the extended capabilities
4867019ae3a9SKanchanapally, Vidyullatha  */
4868019ae3a9SKanchanapally, Vidyullatha struct wiphy_iftype_ext_capab {
4869019ae3a9SKanchanapally, Vidyullatha 	enum nl80211_iftype iftype;
4870019ae3a9SKanchanapally, Vidyullatha 	const u8 *extended_capabilities;
4871019ae3a9SKanchanapally, Vidyullatha 	const u8 *extended_capabilities_mask;
4872019ae3a9SKanchanapally, Vidyullatha 	u8 extended_capabilities_len;
4873019ae3a9SKanchanapally, Vidyullatha };
4874019ae3a9SKanchanapally, Vidyullatha 
4875019ae3a9SKanchanapally, Vidyullatha /**
48769bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_capabilities - cfg80211 peer measurement capabilities
48779bb7e0f2SJohannes Berg  * @max_peers: maximum number of peers in a single measurement
48789bb7e0f2SJohannes Berg  * @report_ap_tsf: can report assoc AP's TSF for radio resource measurement
48799bb7e0f2SJohannes Berg  * @randomize_mac_addr: can randomize MAC address for measurement
48809bb7e0f2SJohannes Berg  * @ftm.supported: FTM measurement is supported
48819bb7e0f2SJohannes Berg  * @ftm.asap: ASAP-mode is supported
48829bb7e0f2SJohannes Berg  * @ftm.non_asap: non-ASAP-mode is supported
48839bb7e0f2SJohannes Berg  * @ftm.request_lci: can request LCI data
48849bb7e0f2SJohannes Berg  * @ftm.request_civicloc: can request civic location data
48859bb7e0f2SJohannes Berg  * @ftm.preambles: bitmap of preambles supported (&enum nl80211_preamble)
48869bb7e0f2SJohannes Berg  * @ftm.bandwidths: bitmap of bandwidths supported (&enum nl80211_chan_width)
48879bb7e0f2SJohannes Berg  * @ftm.max_bursts_exponent: maximum burst exponent supported
48889bb7e0f2SJohannes Berg  *	(set to -1 if not limited; note that setting this will necessarily
48899bb7e0f2SJohannes Berg  *	forbid using the value 15 to let the responder pick)
48909bb7e0f2SJohannes Berg  * @ftm.max_ftms_per_burst: maximum FTMs per burst supported (set to 0 if
48919bb7e0f2SJohannes Berg  *	not limited)
4892efb5520dSAvraham Stern  * @ftm.trigger_based: trigger based ranging measurement is supported
4893efb5520dSAvraham Stern  * @ftm.non_trigger_based: non trigger based ranging measurement is supported
48949bb7e0f2SJohannes Berg  */
48959bb7e0f2SJohannes Berg struct cfg80211_pmsr_capabilities {
48969bb7e0f2SJohannes Berg 	unsigned int max_peers;
48979bb7e0f2SJohannes Berg 	u8 report_ap_tsf:1,
48989bb7e0f2SJohannes Berg 	   randomize_mac_addr:1;
48999bb7e0f2SJohannes Berg 
49009bb7e0f2SJohannes Berg 	struct {
49019bb7e0f2SJohannes Berg 		u32 preambles;
49029bb7e0f2SJohannes Berg 		u32 bandwidths;
49039bb7e0f2SJohannes Berg 		s8 max_bursts_exponent;
49049bb7e0f2SJohannes Berg 		u8 max_ftms_per_burst;
49059bb7e0f2SJohannes Berg 		u8 supported:1,
49069bb7e0f2SJohannes Berg 		   asap:1,
49079bb7e0f2SJohannes Berg 		   non_asap:1,
49089bb7e0f2SJohannes Berg 		   request_lci:1,
4909efb5520dSAvraham Stern 		   request_civicloc:1,
4910efb5520dSAvraham Stern 		   trigger_based:1,
4911efb5520dSAvraham Stern 		   non_trigger_based:1;
49129bb7e0f2SJohannes Berg 	} ftm;
49139bb7e0f2SJohannes Berg };
49149bb7e0f2SJohannes Berg 
49159bb7e0f2SJohannes Berg /**
4916d6039a34SVeerendranath Jakkam  * struct wiphy_iftype_akm_suites - This structure encapsulates supported akm
4917d6039a34SVeerendranath Jakkam  * suites for interface types defined in @iftypes_mask. Each type in the
4918d6039a34SVeerendranath Jakkam  * @iftypes_mask must be unique across all instances of iftype_akm_suites.
4919d6039a34SVeerendranath Jakkam  *
4920d6039a34SVeerendranath Jakkam  * @iftypes_mask: bitmask of interfaces types
4921d6039a34SVeerendranath Jakkam  * @akm_suites: points to an array of supported akm suites
4922d6039a34SVeerendranath Jakkam  * @n_akm_suites: number of supported AKM suites
4923d6039a34SVeerendranath Jakkam  */
4924d6039a34SVeerendranath Jakkam struct wiphy_iftype_akm_suites {
4925d6039a34SVeerendranath Jakkam 	u16 iftypes_mask;
4926d6039a34SVeerendranath Jakkam 	const u32 *akm_suites;
4927d6039a34SVeerendranath Jakkam 	int n_akm_suites;
4928d6039a34SVeerendranath Jakkam };
4929d6039a34SVeerendranath Jakkam 
4930d6039a34SVeerendranath Jakkam /**
49315be83de5SJohannes Berg  * struct wiphy - wireless hardware description
4932a05829a7SJohannes Berg  * @mtx: mutex for the data (structures) of this device
49332784fe91SLuis R. Rodriguez  * @reg_notifier: the driver's regulatory notification callback,
49342784fe91SLuis R. Rodriguez  *	note that if your driver uses wiphy_apply_custom_regulatory()
49352784fe91SLuis R. Rodriguez  *	the reg_notifier's request can be passed as NULL
4936d3236553SJohannes Berg  * @regd: the driver's regulatory domain, if one was requested via
4937d3236553SJohannes Berg  *	the regulatory_hint() API. This can be used by the driver
4938d3236553SJohannes Berg  *	on the reg_notifier() if it chooses to ignore future
4939d3236553SJohannes Berg  *	regulatory domain changes caused by other drivers.
4940d3236553SJohannes Berg  * @signal_type: signal type reported in &struct cfg80211_bss.
4941d3236553SJohannes Berg  * @cipher_suites: supported cipher suites
4942d3236553SJohannes Berg  * @n_cipher_suites: number of supported cipher suites
4943d6039a34SVeerendranath Jakkam  * @akm_suites: supported AKM suites. These are the default AKMs supported if
4944d6039a34SVeerendranath Jakkam  *	the supported AKMs not advertized for a specific interface type in
4945d6039a34SVeerendranath Jakkam  *	iftype_akm_suites.
4946ab4dfa20SVeerendranath Jakkam  * @n_akm_suites: number of supported AKM suites
4947d6039a34SVeerendranath Jakkam  * @iftype_akm_suites: array of supported akm suites info per interface type.
4948d6039a34SVeerendranath Jakkam  *	Note that the bits in @iftypes_mask inside this structure cannot
4949d6039a34SVeerendranath Jakkam  *	overlap (i.e. only one occurrence of each type is allowed across all
4950d6039a34SVeerendranath Jakkam  *	instances of iftype_akm_suites).
4951d6039a34SVeerendranath Jakkam  * @num_iftype_akm_suites: number of interface types for which supported akm
4952d6039a34SVeerendranath Jakkam  *	suites are specified separately.
4953b9a5f8caSJouni Malinen  * @retry_short: Retry limit for short frames (dot11ShortRetryLimit)
4954b9a5f8caSJouni Malinen  * @retry_long: Retry limit for long frames (dot11LongRetryLimit)
4955b9a5f8caSJouni Malinen  * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold);
4956b9a5f8caSJouni Malinen  *	-1 = fragmentation disabled, only odd values >= 256 used
4957b9a5f8caSJouni Malinen  * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled
4958abe37c4bSJohannes Berg  * @_net: the network namespace this wiphy currently lives in
4959ef15aac6SJohannes Berg  * @perm_addr: permanent MAC address of this device
4960ef15aac6SJohannes Berg  * @addr_mask: If the device supports multiple MAC addresses by masking,
4961ef15aac6SJohannes Berg  *	set this to a mask with variable bits set to 1, e.g. if the last
49620fcf8ac5SLuciano Coelho  *	four bits are variable then set it to 00-00-00-00-00-0f. The actual
4963ef15aac6SJohannes Berg  *	variable bits shall be determined by the interfaces added, with
4964ef15aac6SJohannes Berg  *	interfaces not matching the mask being rejected to be brought up.
4965ef15aac6SJohannes Berg  * @n_addresses: number of addresses in @addresses.
4966ef15aac6SJohannes Berg  * @addresses: If the device has more than one address, set this pointer
4967ef15aac6SJohannes Berg  *	to a list of addresses (6 bytes each). The first one will be used
4968ef15aac6SJohannes Berg  *	by default for perm_addr. In this case, the mask should be set to
4969ef15aac6SJohannes Berg  *	all-zeroes. In this case it is assumed that the device can handle
4970ef15aac6SJohannes Berg  *	the same number of arbitrary MAC addresses.
4971fd235913SRandy Dunlap  * @registered: protects ->resume and ->suspend sysfs callbacks against
4972fd235913SRandy Dunlap  *	unregister hardware
4973edf77192SJérôme Pouiller  * @debugfsdir: debugfs directory used for this wiphy (ieee80211/<wiphyname>).
4974edf77192SJérôme Pouiller  *	It will be renamed automatically on wiphy renames
497515bc6dfbSJérôme Pouiller  * @dev: (virtual) struct device for this wiphy. The item in
497615bc6dfbSJérôme Pouiller  *	/sys/class/ieee80211/ points to this. You need use set_wiphy_dev()
497715bc6dfbSJérôme Pouiller  *	(see below).
4978abe37c4bSJohannes Berg  * @wext: wireless extension handlers
4979abe37c4bSJohannes Berg  * @priv: driver private data (sized according to wiphy_new() parameter)
4980abe37c4bSJohannes Berg  * @interface_modes: bitmask of interfaces types valid for this wiphy,
4981abe37c4bSJohannes Berg  *	must be set by driver
49827527a782SJohannes Berg  * @iface_combinations: Valid interface combinations array, should not
49837527a782SJohannes Berg  *	list single interface types.
49847527a782SJohannes Berg  * @n_iface_combinations: number of entries in @iface_combinations array.
49857527a782SJohannes Berg  * @software_iftypes: bitmask of software interface types, these are not
49867527a782SJohannes Berg  *	subject to any restrictions since they are purely managed in SW.
4987abe37c4bSJohannes Berg  * @flags: wiphy flags, see &enum wiphy_flags
4988a2f73b6cSLuis R. Rodriguez  * @regulatory_flags: wiphy regulatory flags, see
4989a2f73b6cSLuis R. Rodriguez  *	&enum ieee80211_regulatory_flags
49901f074bd8SJohannes Berg  * @features: features advertised to nl80211, see &enum nl80211_feature_flags.
4991d75bb06bSGautam Kumar Shukla  * @ext_features: extended features advertised to nl80211, see
4992d75bb06bSGautam Kumar Shukla  *	&enum nl80211_ext_feature_index.
4993abe37c4bSJohannes Berg  * @bss_priv_size: each BSS struct has private data allocated with it,
4994abe37c4bSJohannes Berg  *	this variable determines its size
4995abe37c4bSJohannes Berg  * @max_scan_ssids: maximum number of SSIDs the device can scan for in
4996abe37c4bSJohannes Berg  *	any given scan
4997ca986ad9SArend Van Spriel  * @max_sched_scan_reqs: maximum number of scheduled scan requests that
4998ca986ad9SArend Van Spriel  *	the device can run concurrently.
499993b6aa69SLuciano Coelho  * @max_sched_scan_ssids: maximum number of SSIDs the device can scan
500093b6aa69SLuciano Coelho  *	for in any given scheduled scan
5001a1f1c21cSLuciano Coelho  * @max_match_sets: maximum number of match sets the device can handle
5002a1f1c21cSLuciano Coelho  *	when performing a scheduled scan, 0 if filtering is not
5003a1f1c21cSLuciano Coelho  *	supported.
5004abe37c4bSJohannes Berg  * @max_scan_ie_len: maximum length of user-controlled IEs device can
5005abe37c4bSJohannes Berg  *	add to probe request frames transmitted during a scan, must not
5006abe37c4bSJohannes Berg  *	include fixed IEs like supported rates
50075a865badSLuciano Coelho  * @max_sched_scan_ie_len: same as max_scan_ie_len, but for scheduled
50085a865badSLuciano Coelho  *	scans
50093b06d277SAvraham Stern  * @max_sched_scan_plans: maximum number of scan plans (scan interval and number
50103b06d277SAvraham Stern  *	of iterations) for scheduled scan supported by the device.
50113b06d277SAvraham Stern  * @max_sched_scan_plan_interval: maximum interval (in seconds) for a
50123b06d277SAvraham Stern  *	single scan plan supported by the device.
50133b06d277SAvraham Stern  * @max_sched_scan_plan_iterations: maximum number of iterations for a single
50143b06d277SAvraham Stern  *	scan plan supported by the device.
5015abe37c4bSJohannes Berg  * @coverage_class: current coverage class
5016abe37c4bSJohannes Berg  * @fw_version: firmware version for ethtool reporting
5017abe37c4bSJohannes Berg  * @hw_version: hardware version for ethtool reporting
5018abe37c4bSJohannes Berg  * @max_num_pmkids: maximum number of PMKIDs supported by device
5019abe37c4bSJohannes Berg  * @privid: a pointer that drivers can use to identify if an arbitrary
5020abe37c4bSJohannes Berg  *	wiphy is theirs, e.g. in global notifiers
5021abe37c4bSJohannes Berg  * @bands: information about bands/channels supported by this device
50222e161f78SJohannes Berg  *
50232e161f78SJohannes Berg  * @mgmt_stypes: bitmasks of frame subtypes that can be subscribed to or
50242e161f78SJohannes Berg  *	transmitted through nl80211, points to an array indexed by interface
50252e161f78SJohannes Berg  *	type
5026a7ffac95SBruno Randolf  *
50277f531e03SBruno Randolf  * @available_antennas_tx: bitmap of antennas which are available to be
50287f531e03SBruno Randolf  *	configured as TX antennas. Antenna configuration commands will be
50297f531e03SBruno Randolf  *	rejected unless this or @available_antennas_rx is set.
50307f531e03SBruno Randolf  *
50317f531e03SBruno Randolf  * @available_antennas_rx: bitmap of antennas which are available to be
50327f531e03SBruno Randolf  *	configured as RX antennas. Antenna configuration commands will be
50337f531e03SBruno Randolf  *	rejected unless this or @available_antennas_tx is set.
5034a293911dSJohannes Berg  *
503515f0ebc2SRandy Dunlap  * @probe_resp_offload:
503615f0ebc2SRandy Dunlap  *	 Bitmap of supported protocols for probe response offloading.
503715f0ebc2SRandy Dunlap  *	 See &enum nl80211_probe_resp_offload_support_attr. Only valid
503815f0ebc2SRandy Dunlap  *	 when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set.
503915f0ebc2SRandy Dunlap  *
5040a293911dSJohannes Berg  * @max_remain_on_channel_duration: Maximum time a remain-on-channel operation
5041a293911dSJohannes Berg  *	may request, if implemented.
5042ff1b6e69SJohannes Berg  *
5043ff1b6e69SJohannes Berg  * @wowlan: WoWLAN support information
50446abb9cb9SJohannes Berg  * @wowlan_config: current WoWLAN configuration; this should usually not be
50456abb9cb9SJohannes Berg  *	used since access to it is necessarily racy, use the parameter passed
50466abb9cb9SJohannes Berg  *	to the suspend() operation instead.
5047562a7480SJohannes Berg  *
5048562a7480SJohannes Berg  * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features.
50497e7c8926SBen Greear  * @ht_capa_mod_mask:  Specify what ht_cap values can be over-ridden.
50507e7c8926SBen Greear  *	If null, then none can be over-ridden.
5051ee2aca34SJohannes Berg  * @vht_capa_mod_mask:  Specify what VHT capabilities can be over-ridden.
5052ee2aca34SJohannes Berg  *	If null, then none can be over-ridden.
505377765eafSVasanthakumar Thiagarajan  *
505453873f13SJohannes Berg  * @wdev_list: the list of associated (virtual) interfaces; this list must
505553873f13SJohannes Berg  *	not be modified by the driver, but can be read with RTNL/RCU protection.
505653873f13SJohannes Berg  *
505777765eafSVasanthakumar Thiagarajan  * @max_acl_mac_addrs: Maximum number of MAC addresses that the device
505877765eafSVasanthakumar Thiagarajan  *	supports for ACL.
5059a50df0c4SJohannes Berg  *
5060a50df0c4SJohannes Berg  * @extended_capabilities: extended capabilities supported by the driver,
5061a50df0c4SJohannes Berg  *	additional capabilities might be supported by userspace; these are
5062a50df0c4SJohannes Berg  *	the 802.11 extended capabilities ("Extended Capabilities element")
5063a50df0c4SJohannes Berg  *	and are in the same format as in the information element. See
5064019ae3a9SKanchanapally, Vidyullatha  *	802.11-2012 8.4.2.29 for the defined fields. These are the default
5065019ae3a9SKanchanapally, Vidyullatha  *	extended capabilities to be used if the capabilities are not specified
5066019ae3a9SKanchanapally, Vidyullatha  *	for a specific interface type in iftype_ext_capab.
5067a50df0c4SJohannes Berg  * @extended_capabilities_mask: mask of the valid values
5068a50df0c4SJohannes Berg  * @extended_capabilities_len: length of the extended capabilities
5069019ae3a9SKanchanapally, Vidyullatha  * @iftype_ext_capab: array of extended capabilities per interface type
5070019ae3a9SKanchanapally, Vidyullatha  * @num_iftype_ext_capab: number of interface types for which extended
5071019ae3a9SKanchanapally, Vidyullatha  *	capabilities are specified separately.
5072be29b99aSAmitkumar Karwar  * @coalesce: packet coalescing support information
5073ad7e718cSJohannes Berg  *
5074ad7e718cSJohannes Berg  * @vendor_commands: array of vendor commands supported by the hardware
5075ad7e718cSJohannes Berg  * @n_vendor_commands: number of vendor commands
5076567ffc35SJohannes Berg  * @vendor_events: array of vendor events supported by the hardware
5077567ffc35SJohannes Berg  * @n_vendor_events: number of vendor events
5078b43504cfSJouni Malinen  *
5079b43504cfSJouni Malinen  * @max_ap_assoc_sta: maximum number of associated stations supported in AP mode
5080b43504cfSJouni Malinen  *	(including P2P GO) or 0 to indicate no such limit is advertised. The
5081b43504cfSJouni Malinen  *	driver is allowed to advertise a theoretical limit that it can reach in
5082b43504cfSJouni Malinen  *	some cases, but may not always reach.
5083c2e4323bSLuciano Coelho  *
5084c2e4323bSLuciano Coelho  * @max_num_csa_counters: Number of supported csa_counters in beacons
5085c2e4323bSLuciano Coelho  *	and probe responses.  This value should be set if the driver
5086c2e4323bSLuciano Coelho  *	wishes to limit the number of csa counters. Default (0) means
5087c2e4323bSLuciano Coelho  *	infinite.
508838de03d2SArend van Spriel  * @bss_select_support: bitmask indicating the BSS selection criteria supported
508938de03d2SArend van Spriel  *	by the driver in the .connect() callback. The bit position maps to the
509038de03d2SArend van Spriel  *	attribute indices defined in &enum nl80211_bss_select_attr.
5091a442b761SAyala Beker  *
50928585989dSLuca Coelho  * @nan_supported_bands: bands supported by the device in NAN mode, a
50938585989dSLuca Coelho  *	bitmap of &enum nl80211_band values.  For instance, for
50948585989dSLuca Coelho  *	NL80211_BAND_2GHZ, bit 0 would be set
50958585989dSLuca Coelho  *	(i.e. BIT(NL80211_BAND_2GHZ)).
5096f3a7ca64SJohannes Berg  *
5097f3a7ca64SJohannes Berg  * @txq_limit: configuration of internal TX queue frame limit
5098f3a7ca64SJohannes Berg  * @txq_memory_limit: configuration internal TX queue memory limit
5099f3a7ca64SJohannes Berg  * @txq_quantum: configuration of internal TX queue scheduler quantum
51009bb7e0f2SJohannes Berg  *
5101a710d214SLothar Rubusch  * @tx_queue_len: allow setting transmit queue len for drivers not using
5102a710d214SLothar Rubusch  *	wake_tx_queue
5103a710d214SLothar Rubusch  *
5104213ed579SSara Sharon  * @support_mbssid: can HW support association with nontransmitted AP
5105213ed579SSara Sharon  * @support_only_he_mbssid: don't parse MBSSID elements if it is not
5106213ed579SSara Sharon  *	HE AP, in order to avoid compatibility issues.
5107213ed579SSara Sharon  *	@support_mbssid must be set for this to have any effect.
5108213ed579SSara Sharon  *
51099bb7e0f2SJohannes Berg  * @pmsr_capa: peer measurement capabilities
51103710a8a6SJohannes Berg  *
51113710a8a6SJohannes Berg  * @tid_config_support: describes the per-TID config support that the
51123710a8a6SJohannes Berg  *	device has
51133710a8a6SJohannes Berg  * @tid_config_support.vif: bitmap of attributes (configurations)
51143710a8a6SJohannes Berg  *	supported by the driver for each vif
51153710a8a6SJohannes Berg  * @tid_config_support.peer: bitmap of attributes (configurations)
51163710a8a6SJohannes Berg  *	supported by the driver for each peer
51176a21d16cSTamizh chelvam  * @tid_config_support.max_retry: maximum supported retry count for
51186a21d16cSTamizh chelvam  *	long/short retry configuration
5119a710d214SLothar Rubusch  *
5120a710d214SLothar Rubusch  * @max_data_retry_count: maximum supported per TID retry count for
5121a710d214SLothar Rubusch  *	configuration through the %NL80211_TID_CONFIG_ATTR_RETRY_SHORT and
5122a710d214SLothar Rubusch  *	%NL80211_TID_CONFIG_ATTR_RETRY_LONG attributes
512370b6ff35SJohannes Berg  * @sar_capa: SAR control capabilities
5124358ae888SEmmanuel Grumbach  * @rfkill: a pointer to the rfkill structure
5125dc1e3cb8SJohn Crispin  *
5126dc1e3cb8SJohn Crispin  * @mbssid_max_interfaces: maximum number of interfaces supported by the driver
5127dc1e3cb8SJohn Crispin  *	in a multiple BSSID set. This field must be set to a non-zero value
5128dc1e3cb8SJohn Crispin  *	by the driver to advertise MBSSID support.
5129f9d366d4SJohannes Berg  * @ema_max_profile_periodicity: maximum profile periodicity supported by
5130dc1e3cb8SJohn Crispin  *	the driver. Setting this field to a non-zero value indicates that the
5131dc1e3cb8SJohn Crispin  *	driver supports enhanced multi-BSSID advertisements (EMA AP).
5132d3236553SJohannes Berg  */
5133d3236553SJohannes Berg struct wiphy {
5134a05829a7SJohannes Berg 	struct mutex mtx;
5135a05829a7SJohannes Berg 
5136d3236553SJohannes Berg 	/* assign these fields before you register the wiphy */
5137d3236553SJohannes Berg 
5138d3236553SJohannes Berg 	u8 perm_addr[ETH_ALEN];
5139ef15aac6SJohannes Berg 	u8 addr_mask[ETH_ALEN];
5140ef15aac6SJohannes Berg 
5141ef15aac6SJohannes Berg 	struct mac_address *addresses;
5142d3236553SJohannes Berg 
51432e161f78SJohannes Berg 	const struct ieee80211_txrx_stypes *mgmt_stypes;
51442e161f78SJohannes Berg 
51457527a782SJohannes Berg 	const struct ieee80211_iface_combination *iface_combinations;
51467527a782SJohannes Berg 	int n_iface_combinations;
51477527a782SJohannes Berg 	u16 software_iftypes;
51487527a782SJohannes Berg 
51492e161f78SJohannes Berg 	u16 n_addresses;
51502e161f78SJohannes Berg 
5151d3236553SJohannes Berg 	/* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
5152d3236553SJohannes Berg 	u16 interface_modes;
5153d3236553SJohannes Berg 
515477765eafSVasanthakumar Thiagarajan 	u16 max_acl_mac_addrs;
515577765eafSVasanthakumar Thiagarajan 
5156a2f73b6cSLuis R. Rodriguez 	u32 flags, regulatory_flags, features;
5157d75bb06bSGautam Kumar Shukla 	u8 ext_features[DIV_ROUND_UP(NUM_NL80211_EXT_FEATURES, 8)];
5158463d0183SJohannes Berg 
5159562a7480SJohannes Berg 	u32 ap_sme_capa;
5160562a7480SJohannes Berg 
5161d3236553SJohannes Berg 	enum cfg80211_signal_type signal_type;
5162d3236553SJohannes Berg 
5163d3236553SJohannes Berg 	int bss_priv_size;
5164d3236553SJohannes Berg 	u8 max_scan_ssids;
5165ca986ad9SArend Van Spriel 	u8 max_sched_scan_reqs;
516693b6aa69SLuciano Coelho 	u8 max_sched_scan_ssids;
5167a1f1c21cSLuciano Coelho 	u8 max_match_sets;
5168d3236553SJohannes Berg 	u16 max_scan_ie_len;
51695a865badSLuciano Coelho 	u16 max_sched_scan_ie_len;
51703b06d277SAvraham Stern 	u32 max_sched_scan_plans;
51713b06d277SAvraham Stern 	u32 max_sched_scan_plan_interval;
51723b06d277SAvraham Stern 	u32 max_sched_scan_plan_iterations;
5173d3236553SJohannes Berg 
5174d3236553SJohannes Berg 	int n_cipher_suites;
5175d3236553SJohannes Berg 	const u32 *cipher_suites;
5176d3236553SJohannes Berg 
5177ab4dfa20SVeerendranath Jakkam 	int n_akm_suites;
5178ab4dfa20SVeerendranath Jakkam 	const u32 *akm_suites;
5179ab4dfa20SVeerendranath Jakkam 
5180d6039a34SVeerendranath Jakkam 	const struct wiphy_iftype_akm_suites *iftype_akm_suites;
5181d6039a34SVeerendranath Jakkam 	unsigned int num_iftype_akm_suites;
5182d6039a34SVeerendranath Jakkam 
5183b9a5f8caSJouni Malinen 	u8 retry_short;
5184b9a5f8caSJouni Malinen 	u8 retry_long;
5185b9a5f8caSJouni Malinen 	u32 frag_threshold;
5186b9a5f8caSJouni Malinen 	u32 rts_threshold;
518781077e82SLukáš Turek 	u8 coverage_class;
5188b9a5f8caSJouni Malinen 
518981135548SJiri Pirko 	char fw_version[ETHTOOL_FWVERS_LEN];
5190dfce95f5SKalle Valo 	u32 hw_version;
5191dfce95f5SKalle Valo 
5192dfb89c56SJohannes Berg #ifdef CONFIG_PM
5193964dc9e2SJohannes Berg 	const struct wiphy_wowlan_support *wowlan;
51946abb9cb9SJohannes Berg 	struct cfg80211_wowlan *wowlan_config;
5195dfb89c56SJohannes Berg #endif
5196ff1b6e69SJohannes Berg 
5197a293911dSJohannes Berg 	u16 max_remain_on_channel_duration;
5198a293911dSJohannes Berg 
519967fbb16bSSamuel Ortiz 	u8 max_num_pmkids;
520067fbb16bSSamuel Ortiz 
52017f531e03SBruno Randolf 	u32 available_antennas_tx;
52027f531e03SBruno Randolf 	u32 available_antennas_rx;
5203a7ffac95SBruno Randolf 
520487bbbe22SArik Nemtsov 	u32 probe_resp_offload;
520587bbbe22SArik Nemtsov 
5206a50df0c4SJohannes Berg 	const u8 *extended_capabilities, *extended_capabilities_mask;
5207a50df0c4SJohannes Berg 	u8 extended_capabilities_len;
5208a50df0c4SJohannes Berg 
5209019ae3a9SKanchanapally, Vidyullatha 	const struct wiphy_iftype_ext_capab *iftype_ext_capab;
5210019ae3a9SKanchanapally, Vidyullatha 	unsigned int num_iftype_ext_capab;
5211019ae3a9SKanchanapally, Vidyullatha 
5212cf5aa2f1SDavid Kilroy 	const void *privid;
5213d3236553SJohannes Berg 
521457fbcce3SJohannes Berg 	struct ieee80211_supported_band *bands[NUM_NL80211_BANDS];
5215d3236553SJohannes Berg 
52160c0280bdSLuis R. Rodriguez 	void (*reg_notifier)(struct wiphy *wiphy,
5217d3236553SJohannes Berg 			     struct regulatory_request *request);
5218d3236553SJohannes Berg 
5219d3236553SJohannes Berg 	/* fields below are read-only, assigned by cfg80211 */
5220d3236553SJohannes Berg 
5221458f4f9eSJohannes Berg 	const struct ieee80211_regdomain __rcu *regd;
5222d3236553SJohannes Berg 
5223d3236553SJohannes Berg 	struct device dev;
5224d3236553SJohannes Berg 
5225ecb44335SStanislaw Gruszka 	bool registered;
5226ecb44335SStanislaw Gruszka 
5227d3236553SJohannes Berg 	struct dentry *debugfsdir;
5228d3236553SJohannes Berg 
52297e7c8926SBen Greear 	const struct ieee80211_ht_cap *ht_capa_mod_mask;
5230ee2aca34SJohannes Berg 	const struct ieee80211_vht_cap *vht_capa_mod_mask;
52317e7c8926SBen Greear 
523253873f13SJohannes Berg 	struct list_head wdev_list;
523353873f13SJohannes Berg 
52340c5c9fb5SEric W. Biederman 	possible_net_t _net;
5235463d0183SJohannes Berg 
52363d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT
52373d23e349SJohannes Berg 	const struct iw_handler_def *wext;
52383d23e349SJohannes Berg #endif
52393d23e349SJohannes Berg 
5240be29b99aSAmitkumar Karwar 	const struct wiphy_coalesce_support *coalesce;
5241be29b99aSAmitkumar Karwar 
5242ad7e718cSJohannes Berg 	const struct wiphy_vendor_command *vendor_commands;
5243567ffc35SJohannes Berg 	const struct nl80211_vendor_cmd_info *vendor_events;
5244567ffc35SJohannes Berg 	int n_vendor_commands, n_vendor_events;
5245ad7e718cSJohannes Berg 
5246b43504cfSJouni Malinen 	u16 max_ap_assoc_sta;
5247b43504cfSJouni Malinen 
52489a774c78SAndrei Otcheretianski 	u8 max_num_csa_counters;
52499a774c78SAndrei Otcheretianski 
525038de03d2SArend van Spriel 	u32 bss_select_support;
525138de03d2SArend van Spriel 
52528585989dSLuca Coelho 	u8 nan_supported_bands;
52538585989dSLuca Coelho 
525452539ca8SToke Høiland-Jørgensen 	u32 txq_limit;
525552539ca8SToke Høiland-Jørgensen 	u32 txq_memory_limit;
525652539ca8SToke Høiland-Jørgensen 	u32 txq_quantum;
525752539ca8SToke Høiland-Jørgensen 
52581f6e0baaSJohn Crispin 	unsigned long tx_queue_len;
52591f6e0baaSJohn Crispin 
5260213ed579SSara Sharon 	u8 support_mbssid:1,
5261213ed579SSara Sharon 	   support_only_he_mbssid:1;
5262213ed579SSara Sharon 
52639bb7e0f2SJohannes Berg 	const struct cfg80211_pmsr_capabilities *pmsr_capa;
52649bb7e0f2SJohannes Berg 
52653710a8a6SJohannes Berg 	struct {
52663710a8a6SJohannes Berg 		u64 peer, vif;
52676a21d16cSTamizh chelvam 		u8 max_retry;
52683710a8a6SJohannes Berg 	} tid_config_support;
52693710a8a6SJohannes Berg 
52706a21d16cSTamizh chelvam 	u8 max_data_retry_count;
52716a21d16cSTamizh chelvam 
52726bdb68ceSCarl Huang 	const struct cfg80211_sar_capa *sar_capa;
52736bdb68ceSCarl Huang 
5274358ae888SEmmanuel Grumbach 	struct rfkill *rfkill;
5275358ae888SEmmanuel Grumbach 
5276dc1e3cb8SJohn Crispin 	u8 mbssid_max_interfaces;
5277dc1e3cb8SJohn Crispin 	u8 ema_max_profile_periodicity;
5278dc1e3cb8SJohn Crispin 
5279396fba0aSGustavo A. R. Silva 	char priv[] __aligned(NETDEV_ALIGN);
5280d3236553SJohannes Berg };
5281d3236553SJohannes Berg 
5282463d0183SJohannes Berg static inline struct net *wiphy_net(struct wiphy *wiphy)
5283463d0183SJohannes Berg {
5284c2d9ba9bSEric Dumazet 	return read_pnet(&wiphy->_net);
5285463d0183SJohannes Berg }
5286463d0183SJohannes Berg 
5287463d0183SJohannes Berg static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net)
5288463d0183SJohannes Berg {
5289c2d9ba9bSEric Dumazet 	write_pnet(&wiphy->_net, net);
5290463d0183SJohannes Berg }
5291463d0183SJohannes Berg 
5292d3236553SJohannes Berg /**
5293d3236553SJohannes Berg  * wiphy_priv - return priv from wiphy
5294d3236553SJohannes Berg  *
5295d3236553SJohannes Berg  * @wiphy: the wiphy whose priv pointer to return
52960ae997dcSYacine Belkadi  * Return: The priv of @wiphy.
5297d3236553SJohannes Berg  */
5298d3236553SJohannes Berg static inline void *wiphy_priv(struct wiphy *wiphy)
5299d3236553SJohannes Berg {
5300d3236553SJohannes Berg 	BUG_ON(!wiphy);
5301d3236553SJohannes Berg 	return &wiphy->priv;
5302d3236553SJohannes Berg }
5303d3236553SJohannes Berg 
5304d3236553SJohannes Berg /**
5305f1f74825SDavid Kilroy  * priv_to_wiphy - return the wiphy containing the priv
5306f1f74825SDavid Kilroy  *
5307f1f74825SDavid Kilroy  * @priv: a pointer previously returned by wiphy_priv
53080ae997dcSYacine Belkadi  * Return: The wiphy of @priv.
5309f1f74825SDavid Kilroy  */
5310f1f74825SDavid Kilroy static inline struct wiphy *priv_to_wiphy(void *priv)
5311f1f74825SDavid Kilroy {
5312f1f74825SDavid Kilroy 	BUG_ON(!priv);
5313f1f74825SDavid Kilroy 	return container_of(priv, struct wiphy, priv);
5314f1f74825SDavid Kilroy }
5315f1f74825SDavid Kilroy 
5316f1f74825SDavid Kilroy /**
5317d3236553SJohannes Berg  * set_wiphy_dev - set device pointer for wiphy
5318d3236553SJohannes Berg  *
5319d3236553SJohannes Berg  * @wiphy: The wiphy whose device to bind
5320d3236553SJohannes Berg  * @dev: The device to parent it to
5321d3236553SJohannes Berg  */
5322d3236553SJohannes Berg static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev)
5323d3236553SJohannes Berg {
5324d3236553SJohannes Berg 	wiphy->dev.parent = dev;
5325d3236553SJohannes Berg }
5326d3236553SJohannes Berg 
5327d3236553SJohannes Berg /**
5328d3236553SJohannes Berg  * wiphy_dev - get wiphy dev pointer
5329d3236553SJohannes Berg  *
5330d3236553SJohannes Berg  * @wiphy: The wiphy whose device struct to look up
53310ae997dcSYacine Belkadi  * Return: The dev of @wiphy.
5332d3236553SJohannes Berg  */
5333d3236553SJohannes Berg static inline struct device *wiphy_dev(struct wiphy *wiphy)
5334d3236553SJohannes Berg {
5335d3236553SJohannes Berg 	return wiphy->dev.parent;
5336d3236553SJohannes Berg }
5337d3236553SJohannes Berg 
5338d3236553SJohannes Berg /**
5339d3236553SJohannes Berg  * wiphy_name - get wiphy name
5340d3236553SJohannes Berg  *
5341d3236553SJohannes Berg  * @wiphy: The wiphy whose name to return
53420ae997dcSYacine Belkadi  * Return: The name of @wiphy.
5343d3236553SJohannes Berg  */
5344e1db74fcSJoe Perches static inline const char *wiphy_name(const struct wiphy *wiphy)
5345d3236553SJohannes Berg {
5346d3236553SJohannes Berg 	return dev_name(&wiphy->dev);
5347d3236553SJohannes Berg }
5348d3236553SJohannes Berg 
5349d3236553SJohannes Berg /**
53501998d90aSBen Greear  * wiphy_new_nm - create a new wiphy for use with cfg80211
53511998d90aSBen Greear  *
53521998d90aSBen Greear  * @ops: The configuration operations for this device
53531998d90aSBen Greear  * @sizeof_priv: The size of the private area to allocate
53541998d90aSBen Greear  * @requested_name: Request a particular name.
53551998d90aSBen Greear  *	NULL is valid value, and means use the default phy%d naming.
53561998d90aSBen Greear  *
53571998d90aSBen Greear  * Create a new wiphy and associate the given operations with it.
53581998d90aSBen Greear  * @sizeof_priv bytes are allocated for private use.
53591998d90aSBen Greear  *
53601998d90aSBen Greear  * Return: A pointer to the new wiphy. This pointer must be
53611998d90aSBen Greear  * assigned to each netdev's ieee80211_ptr for proper operation.
53621998d90aSBen Greear  */
53631998d90aSBen Greear struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv,
53641998d90aSBen Greear 			   const char *requested_name);
53651998d90aSBen Greear 
53661998d90aSBen Greear /**
5367d3236553SJohannes Berg  * wiphy_new - create a new wiphy for use with cfg80211
5368d3236553SJohannes Berg  *
5369d3236553SJohannes Berg  * @ops: The configuration operations for this device
5370d3236553SJohannes Berg  * @sizeof_priv: The size of the private area to allocate
5371d3236553SJohannes Berg  *
5372d3236553SJohannes Berg  * Create a new wiphy and associate the given operations with it.
5373d3236553SJohannes Berg  * @sizeof_priv bytes are allocated for private use.
5374d3236553SJohannes Berg  *
53750ae997dcSYacine Belkadi  * Return: A pointer to the new wiphy. This pointer must be
53760ae997dcSYacine Belkadi  * assigned to each netdev's ieee80211_ptr for proper operation.
5377d3236553SJohannes Berg  */
53781998d90aSBen Greear static inline struct wiphy *wiphy_new(const struct cfg80211_ops *ops,
53791998d90aSBen Greear 				      int sizeof_priv)
53801998d90aSBen Greear {
53811998d90aSBen Greear 	return wiphy_new_nm(ops, sizeof_priv, NULL);
53821998d90aSBen Greear }
5383d3236553SJohannes Berg 
5384d3236553SJohannes Berg /**
5385d3236553SJohannes Berg  * wiphy_register - register a wiphy with cfg80211
5386d3236553SJohannes Berg  *
5387d3236553SJohannes Berg  * @wiphy: The wiphy to register.
5388d3236553SJohannes Berg  *
53890ae997dcSYacine Belkadi  * Return: A non-negative wiphy index or a negative error code.
5390d3236553SJohannes Berg  */
539110dd9b7cSJoe Perches int wiphy_register(struct wiphy *wiphy);
5392d3236553SJohannes Berg 
5393a05829a7SJohannes Berg /* this is a define for better error reporting (file/line) */
5394a05829a7SJohannes Berg #define lockdep_assert_wiphy(wiphy) lockdep_assert_held(&(wiphy)->mtx)
5395a05829a7SJohannes Berg 
5396a05829a7SJohannes Berg /**
5397a05829a7SJohannes Berg  * rcu_dereference_wiphy - rcu_dereference with debug checking
5398a05829a7SJohannes Berg  * @wiphy: the wiphy to check the locking on
5399a05829a7SJohannes Berg  * @p: The pointer to read, prior to dereferencing
5400a05829a7SJohannes Berg  *
5401a05829a7SJohannes Berg  * Do an rcu_dereference(p), but check caller either holds rcu_read_lock()
5402a05829a7SJohannes Berg  * or RTNL. Note: Please prefer wiphy_dereference() or rcu_dereference().
5403a05829a7SJohannes Berg  */
5404a05829a7SJohannes Berg #define rcu_dereference_wiphy(wiphy, p)				\
5405a05829a7SJohannes Berg         rcu_dereference_check(p, lockdep_is_held(&wiphy->mtx))
5406a05829a7SJohannes Berg 
5407a05829a7SJohannes Berg /**
5408a05829a7SJohannes Berg  * wiphy_dereference - fetch RCU pointer when updates are prevented by wiphy mtx
5409a05829a7SJohannes Berg  * @wiphy: the wiphy to check the locking on
5410a05829a7SJohannes Berg  * @p: The pointer to read, prior to dereferencing
5411a05829a7SJohannes Berg  *
5412a05829a7SJohannes Berg  * Return the value of the specified RCU-protected pointer, but omit the
5413a05829a7SJohannes Berg  * READ_ONCE(), because caller holds the wiphy mutex used for updates.
5414a05829a7SJohannes Berg  */
5415a05829a7SJohannes Berg #define wiphy_dereference(wiphy, p)				\
5416a05829a7SJohannes Berg         rcu_dereference_protected(p, lockdep_is_held(&wiphy->mtx))
5417a05829a7SJohannes Berg 
5418a05829a7SJohannes Berg /**
5419a05829a7SJohannes Berg  * get_wiphy_regdom - get custom regdomain for the given wiphy
5420a05829a7SJohannes Berg  * @wiphy: the wiphy to get the regdomain from
5421a05829a7SJohannes Berg  */
5422a05829a7SJohannes Berg const struct ieee80211_regdomain *get_wiphy_regdom(struct wiphy *wiphy);
5423a05829a7SJohannes Berg 
5424d3236553SJohannes Berg /**
5425d3236553SJohannes Berg  * wiphy_unregister - deregister a wiphy from cfg80211
5426d3236553SJohannes Berg  *
5427d3236553SJohannes Berg  * @wiphy: The wiphy to unregister.
5428d3236553SJohannes Berg  *
5429d3236553SJohannes Berg  * After this call, no more requests can be made with this priv
5430d3236553SJohannes Berg  * pointer, but the call may sleep to wait for an outstanding
5431d3236553SJohannes Berg  * request that is being handled.
5432d3236553SJohannes Berg  */
543310dd9b7cSJoe Perches void wiphy_unregister(struct wiphy *wiphy);
5434d3236553SJohannes Berg 
5435d3236553SJohannes Berg /**
5436d3236553SJohannes Berg  * wiphy_free - free wiphy
5437d3236553SJohannes Berg  *
5438d3236553SJohannes Berg  * @wiphy: The wiphy to free
5439d3236553SJohannes Berg  */
544010dd9b7cSJoe Perches void wiphy_free(struct wiphy *wiphy);
5441d3236553SJohannes Berg 
5442fffd0934SJohannes Berg /* internal structs */
54436829c878SJohannes Berg struct cfg80211_conn;
544419957bb3SJohannes Berg struct cfg80211_internal_bss;
5445fffd0934SJohannes Berg struct cfg80211_cached_keys;
54464a4b8169SAndrew Zaborowski struct cfg80211_cqm_config;
544719957bb3SJohannes Berg 
5448d3236553SJohannes Berg /**
5449a05829a7SJohannes Berg  * wiphy_lock - lock the wiphy
5450a05829a7SJohannes Berg  * @wiphy: the wiphy to lock
5451a05829a7SJohannes Berg  *
5452a05829a7SJohannes Berg  * This is mostly exposed so it can be done around registering and
5453a05829a7SJohannes Berg  * unregistering netdevs that aren't created through cfg80211 calls,
5454a05829a7SJohannes Berg  * since that requires locking in cfg80211 when the notifiers is
5455a05829a7SJohannes Berg  * called, but that cannot differentiate which way it's called.
5456a05829a7SJohannes Berg  *
5457a05829a7SJohannes Berg  * When cfg80211 ops are called, the wiphy is already locked.
5458a05829a7SJohannes Berg  */
5459a05829a7SJohannes Berg static inline void wiphy_lock(struct wiphy *wiphy)
5460a05829a7SJohannes Berg 	__acquires(&wiphy->mtx)
5461a05829a7SJohannes Berg {
5462a05829a7SJohannes Berg 	mutex_lock(&wiphy->mtx);
5463a05829a7SJohannes Berg 	__acquire(&wiphy->mtx);
5464a05829a7SJohannes Berg }
5465a05829a7SJohannes Berg 
5466a05829a7SJohannes Berg /**
5467a05829a7SJohannes Berg  * wiphy_unlock - unlock the wiphy again
5468a05829a7SJohannes Berg  * @wiphy: the wiphy to unlock
5469a05829a7SJohannes Berg  */
5470a05829a7SJohannes Berg static inline void wiphy_unlock(struct wiphy *wiphy)
5471a05829a7SJohannes Berg 	__releases(&wiphy->mtx)
5472a05829a7SJohannes Berg {
5473a05829a7SJohannes Berg 	__release(&wiphy->mtx);
5474a05829a7SJohannes Berg 	mutex_unlock(&wiphy->mtx);
5475a05829a7SJohannes Berg }
5476a05829a7SJohannes Berg 
5477a05829a7SJohannes Berg /**
547889a54e48SJohannes Berg  * struct wireless_dev - wireless device state
5479d3236553SJohannes Berg  *
548089a54e48SJohannes Berg  * For netdevs, this structure must be allocated by the driver
548189a54e48SJohannes Berg  * that uses the ieee80211_ptr field in struct net_device (this
548289a54e48SJohannes Berg  * is intentional so it can be allocated along with the netdev.)
548389a54e48SJohannes Berg  * It need not be registered then as netdev registration will
5484a05829a7SJohannes Berg  * be intercepted by cfg80211 to see the new wireless device,
5485a05829a7SJohannes Berg  * however, drivers must lock the wiphy before registering or
5486a05829a7SJohannes Berg  * unregistering netdevs if they pre-create any netdevs (in ops
5487a05829a7SJohannes Berg  * called from cfg80211, the wiphy is already locked.)
548889a54e48SJohannes Berg  *
548989a54e48SJohannes Berg  * For non-netdev uses, it must also be allocated by the driver
549089a54e48SJohannes Berg  * in response to the cfg80211 callbacks that require it, as
549189a54e48SJohannes Berg  * there's no netdev registration in that case it may not be
549289a54e48SJohannes Berg  * allocated outside of callback operations that return it.
5493d3236553SJohannes Berg  *
5494d3236553SJohannes Berg  * @wiphy: pointer to hardware description
5495d3236553SJohannes Berg  * @iftype: interface type
54962fe8ef10SJohannes Berg  * @registered: is this wdev already registered with cfg80211
549740c575d1SJohannes Berg  * @registering: indicates we're doing registration under wiphy lock
549840c575d1SJohannes Berg  *	for the notifier
5499d3236553SJohannes Berg  * @list: (private) Used to collect the interfaces
550089a54e48SJohannes Berg  * @netdev: (private) Used to reference back to the netdev, may be %NULL
550189a54e48SJohannes Berg  * @identifier: (private) Identifier used in nl80211 to identify this
550289a54e48SJohannes Berg  *	wireless device if it has no netdev
5503d3236553SJohannes Berg  * @current_bss: (private) Used by the internal configuration code
55049e0e2961SMichal Kazior  * @chandef: (private) Used by the internal configuration code to track
55059e0e2961SMichal Kazior  *	the user-set channel definition.
5506780b40dfSJohannes Berg  * @preset_chandef: (private) Used by the internal configuration code to
5507aa430da4SJohannes Berg  *	track the channel to be used for AP later
5508d3236553SJohannes Berg  * @bssid: (private) Used by the internal configuration code
5509d3236553SJohannes Berg  * @ssid: (private) Used by the internal configuration code
5510d3236553SJohannes Berg  * @ssid_len: (private) Used by the internal configuration code
551129cbe68cSJohannes Berg  * @mesh_id_len: (private) Used by the internal configuration code
551229cbe68cSJohannes Berg  * @mesh_id_up_len: (private) Used by the internal configuration code
5513d3236553SJohannes Berg  * @wext: (private) Used by the internal wireless extensions compat code
55149874b71fSJohannes Berg  * @wext.ibss: (private) IBSS data part of wext handling
55159874b71fSJohannes Berg  * @wext.connect: (private) connection handling data
55169874b71fSJohannes Berg  * @wext.keys: (private) (WEP) key data
55179874b71fSJohannes Berg  * @wext.ie: (private) extra elements for association
55189874b71fSJohannes Berg  * @wext.ie_len: (private) length of extra elements
55199874b71fSJohannes Berg  * @wext.bssid: (private) selected network BSSID
55209874b71fSJohannes Berg  * @wext.ssid: (private) selected network SSID
55219874b71fSJohannes Berg  * @wext.default_key: (private) selected default key index
55229874b71fSJohannes Berg  * @wext.default_mgmt_key: (private) selected default management key index
55239874b71fSJohannes Berg  * @wext.prev_bssid: (private) previous BSSID for reassociation
55249874b71fSJohannes Berg  * @wext.prev_bssid_valid: (private) previous BSSID validity
55259bc383deSJohannes Berg  * @use_4addr: indicates 4addr mode is used on this interface, must be
55269bc383deSJohannes Berg  *	set by driver (if supported) on add_interface BEFORE registering the
55279bc383deSJohannes Berg  *	netdev and may otherwise be used by driver read-only, will be update
55289bc383deSJohannes Berg  *	by cfg80211 on change_interface
55292e161f78SJohannes Berg  * @mgmt_registrations: list of registrations for management frames
553079ea1e12SJohannes Berg  * @mgmt_registrations_need_update: mgmt registrations were updated,
553179ea1e12SJohannes Berg  *	need to propagate the update to the driver
55328d61ffa5SJohannes Berg  * @mtx: mutex used to lock data in this struct, may be used by drivers
55338d61ffa5SJohannes Berg  *	and some API functions require it held
553456d1893dSJohannes Berg  * @beacon_interval: beacon interval used on this device for transmitting
553556d1893dSJohannes Berg  *	beacons, 0 when not valid
553698104fdeSJohannes Berg  * @address: The address for this device, valid only if @netdev is %NULL
553773c7da3dSArend Van Spriel  * @is_running: true if this is a non-netdev device that has been started, e.g.
553873c7da3dSArend Van Spriel  *	the P2P Device.
553904f39047SSimon Wunderlich  * @cac_started: true if DFS channel availability check has been started
554004f39047SSimon Wunderlich  * @cac_start_time: timestamp (jiffies) when the dfs state was entered.
554131559f35SJanusz Dziedzic  * @cac_time_ms: CAC time in ms
5542780b40dfSJohannes Berg  * @ps: powersave mode is enabled
5543780b40dfSJohannes Berg  * @ps_timeout: dynamic powersave timeout
5544780b40dfSJohannes Berg  * @ap_unexpected_nlportid: (private) netlink port ID of application
5545780b40dfSJohannes Berg  *	registered for unexpected class 3 frames (AP mode)
5546780b40dfSJohannes Berg  * @conn: (private) cfg80211 software SME connection state machine data
5547780b40dfSJohannes Berg  * @connect_keys: (private) keys to set after connection is established
554834d50519SLior David  * @conn_bss_type: connecting/connected BSS type
5549bd2522b1SAndrzej Zaborowski  * @conn_owner_nlportid: (private) connection owner socket port ID
5550bd2522b1SAndrzej Zaborowski  * @disconnect_wk: (private) auto-disconnect work
5551bd2522b1SAndrzej Zaborowski  * @disconnect_bssid: (private) the BSSID to use for auto-disconnect
5552780b40dfSJohannes Berg  * @ibss_fixed: (private) IBSS is using fixed BSSID
55535336fa88SSimon Wunderlich  * @ibss_dfs_possible: (private) IBSS may change to a DFS channel
5554780b40dfSJohannes Berg  * @event_list: (private) list for internal event processing
5555780b40dfSJohannes Berg  * @event_lock: (private) lock for event list
555678f22b6aSJohannes Berg  * @owner_nlportid: (private) owner socket port ID
5557ab81007aSJohannes Berg  * @nl_owner_dead: (private) owner socket went away
55584a4b8169SAndrew Zaborowski  * @cqm_config: (private) nl80211 RSSI monitor state
55599bb7e0f2SJohannes Berg  * @pmsr_list: (private) peer measurement requests
55609bb7e0f2SJohannes Berg  * @pmsr_lock: (private) peer measurements requests/results lock
55619bb7e0f2SJohannes Berg  * @pmsr_free_wk: (private) peer measurements cleanup work
55624d797fceSJouni Malinen  * @unprot_beacon_reported: (private) timestamp of last
55634d797fceSJouni Malinen  *	unprotected beacon report
5564d3236553SJohannes Berg  */
5565d3236553SJohannes Berg struct wireless_dev {
5566d3236553SJohannes Berg 	struct wiphy *wiphy;
5567d3236553SJohannes Berg 	enum nl80211_iftype iftype;
5568d3236553SJohannes Berg 
5569667503ddSJohannes Berg 	/* the remainder of this struct should be private to cfg80211 */
5570d3236553SJohannes Berg 	struct list_head list;
5571d3236553SJohannes Berg 	struct net_device *netdev;
5572d3236553SJohannes Berg 
557389a54e48SJohannes Berg 	u32 identifier;
557489a54e48SJohannes Berg 
55752e161f78SJohannes Berg 	struct list_head mgmt_registrations;
557679ea1e12SJohannes Berg 	u8 mgmt_registrations_need_update:1;
5577026331c4SJouni Malinen 
5578667503ddSJohannes Berg 	struct mutex mtx;
5579667503ddSJohannes Berg 
558040c575d1SJohannes Berg 	bool use_4addr, is_running, registered, registering;
558198104fdeSJohannes Berg 
558298104fdeSJohannes Berg 	u8 address[ETH_ALEN] __aligned(sizeof(u16));
55839bc383deSJohannes Berg 
5584b23aa676SSamuel Ortiz 	/* currently used for IBSS and SME - might be rearranged later */
5585d3236553SJohannes Berg 	u8 ssid[IEEE80211_MAX_SSID_LEN];
558629cbe68cSJohannes Berg 	u8 ssid_len, mesh_id_len, mesh_id_up_len;
55876829c878SJohannes Berg 	struct cfg80211_conn *conn;
5588fffd0934SJohannes Berg 	struct cfg80211_cached_keys *connect_keys;
558934d50519SLior David 	enum ieee80211_bss_type conn_bss_type;
5590bd2522b1SAndrzej Zaborowski 	u32 conn_owner_nlportid;
5591bd2522b1SAndrzej Zaborowski 
5592bd2522b1SAndrzej Zaborowski 	struct work_struct disconnect_wk;
5593bd2522b1SAndrzej Zaborowski 	u8 disconnect_bssid[ETH_ALEN];
5594d3236553SJohannes Berg 
5595667503ddSJohannes Berg 	struct list_head event_list;
5596667503ddSJohannes Berg 	spinlock_t event_lock;
5597667503ddSJohannes Berg 
559819957bb3SJohannes Berg 	struct cfg80211_internal_bss *current_bss; /* associated / joined */
5599683b6d3bSJohannes Berg 	struct cfg80211_chan_def preset_chandef;
56009e0e2961SMichal Kazior 	struct cfg80211_chan_def chandef;
5601f4489ebeSMichal Kazior 
5602c30a3d38SMichal Kazior 	bool ibss_fixed;
56035336fa88SSimon Wunderlich 	bool ibss_dfs_possible;
5604c30a3d38SMichal Kazior 
5605ffb9eb3dSKalle Valo 	bool ps;
5606ffb9eb3dSKalle Valo 	int ps_timeout;
5607ffb9eb3dSKalle Valo 
560856d1893dSJohannes Berg 	int beacon_interval;
560956d1893dSJohannes Berg 
561015e47304SEric W. Biederman 	u32 ap_unexpected_nlportid;
561128946da7SJohannes Berg 
5612ab81007aSJohannes Berg 	u32 owner_nlportid;
5613ab81007aSJohannes Berg 	bool nl_owner_dead;
5614ab81007aSJohannes Berg 
561504f39047SSimon Wunderlich 	bool cac_started;
561604f39047SSimon Wunderlich 	unsigned long cac_start_time;
561731559f35SJanusz Dziedzic 	unsigned int cac_time_ms;
561804f39047SSimon Wunderlich 
56193d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT
5620d3236553SJohannes Berg 	/* wext data */
5621cbe8fa9cSJohannes Berg 	struct {
5622cbe8fa9cSJohannes Berg 		struct cfg80211_ibss_params ibss;
5623f2129354SJohannes Berg 		struct cfg80211_connect_params connect;
5624fffd0934SJohannes Berg 		struct cfg80211_cached_keys *keys;
5625c1e5f471SJohannes Berg 		const u8 *ie;
5626f2129354SJohannes Berg 		size_t ie_len;
56279874b71fSJohannes Berg 		u8 bssid[ETH_ALEN];
56289874b71fSJohannes Berg 		u8 prev_bssid[ETH_ALEN];
5629f2129354SJohannes Berg 		u8 ssid[IEEE80211_MAX_SSID_LEN];
563008645126SJohannes Berg 		s8 default_key, default_mgmt_key;
5631ffb9eb3dSKalle Valo 		bool prev_bssid_valid;
5632cbe8fa9cSJohannes Berg 	} wext;
5633d3236553SJohannes Berg #endif
56344a4b8169SAndrew Zaborowski 
56354a4b8169SAndrew Zaborowski 	struct cfg80211_cqm_config *cqm_config;
56369bb7e0f2SJohannes Berg 
56379bb7e0f2SJohannes Berg 	struct list_head pmsr_list;
56389bb7e0f2SJohannes Berg 	spinlock_t pmsr_lock;
56399bb7e0f2SJohannes Berg 	struct work_struct pmsr_free_wk;
56404d797fceSJouni Malinen 
56414d797fceSJouni Malinen 	unsigned long unprot_beacon_reported;
5642d3236553SJohannes Berg };
5643d3236553SJohannes Berg 
564410de5a59SJakub Kicinski static inline const u8 *wdev_address(struct wireless_dev *wdev)
564598104fdeSJohannes Berg {
564698104fdeSJohannes Berg 	if (wdev->netdev)
564798104fdeSJohannes Berg 		return wdev->netdev->dev_addr;
564898104fdeSJohannes Berg 	return wdev->address;
564998104fdeSJohannes Berg }
565098104fdeSJohannes Berg 
565173c7da3dSArend Van Spriel static inline bool wdev_running(struct wireless_dev *wdev)
565273c7da3dSArend Van Spriel {
565373c7da3dSArend Van Spriel 	if (wdev->netdev)
565473c7da3dSArend Van Spriel 		return netif_running(wdev->netdev);
565573c7da3dSArend Van Spriel 	return wdev->is_running;
565673c7da3dSArend Van Spriel }
565773c7da3dSArend Van Spriel 
5658d3236553SJohannes Berg /**
5659d3236553SJohannes Berg  * wdev_priv - return wiphy priv from wireless_dev
5660d3236553SJohannes Berg  *
5661d3236553SJohannes Berg  * @wdev: The wireless device whose wiphy's priv pointer to return
56620ae997dcSYacine Belkadi  * Return: The wiphy priv of @wdev.
5663d3236553SJohannes Berg  */
5664d3236553SJohannes Berg static inline void *wdev_priv(struct wireless_dev *wdev)
5665d3236553SJohannes Berg {
5666d3236553SJohannes Berg 	BUG_ON(!wdev);
5667d3236553SJohannes Berg 	return wiphy_priv(wdev->wiphy);
5668d3236553SJohannes Berg }
5669d3236553SJohannes Berg 
5670d70e9693SJohannes Berg /**
5671d70e9693SJohannes Berg  * DOC: Utility functions
5672d70e9693SJohannes Berg  *
5673d70e9693SJohannes Berg  * cfg80211 offers a number of utility functions that can be useful.
5674d3236553SJohannes Berg  */
5675d3236553SJohannes Berg 
5676d3236553SJohannes Berg /**
5677934f4c7dSThomas Pedersen  * ieee80211_channel_equal - compare two struct ieee80211_channel
5678934f4c7dSThomas Pedersen  *
5679934f4c7dSThomas Pedersen  * @a: 1st struct ieee80211_channel
5680934f4c7dSThomas Pedersen  * @b: 2nd struct ieee80211_channel
5681934f4c7dSThomas Pedersen  * Return: true if center frequency of @a == @b
5682934f4c7dSThomas Pedersen  */
5683934f4c7dSThomas Pedersen static inline bool
5684934f4c7dSThomas Pedersen ieee80211_channel_equal(struct ieee80211_channel *a,
5685934f4c7dSThomas Pedersen 			struct ieee80211_channel *b)
5686934f4c7dSThomas Pedersen {
5687934f4c7dSThomas Pedersen 	return (a->center_freq == b->center_freq &&
5688934f4c7dSThomas Pedersen 		a->freq_offset == b->freq_offset);
5689934f4c7dSThomas Pedersen }
5690934f4c7dSThomas Pedersen 
5691934f4c7dSThomas Pedersen /**
5692934f4c7dSThomas Pedersen  * ieee80211_channel_to_khz - convert ieee80211_channel to frequency in KHz
5693934f4c7dSThomas Pedersen  * @chan: struct ieee80211_channel to convert
5694934f4c7dSThomas Pedersen  * Return: The corresponding frequency (in KHz)
5695934f4c7dSThomas Pedersen  */
5696934f4c7dSThomas Pedersen static inline u32
5697934f4c7dSThomas Pedersen ieee80211_channel_to_khz(const struct ieee80211_channel *chan)
5698934f4c7dSThomas Pedersen {
5699934f4c7dSThomas Pedersen 	return MHZ_TO_KHZ(chan->center_freq) + chan->freq_offset;
5700934f4c7dSThomas Pedersen }
5701934f4c7dSThomas Pedersen 
5702934f4c7dSThomas Pedersen /**
570311b34737SThomas Pedersen  * ieee80211_s1g_channel_width - get allowed channel width from @chan
570411b34737SThomas Pedersen  *
570511b34737SThomas Pedersen  * Only allowed for band NL80211_BAND_S1GHZ
570611b34737SThomas Pedersen  * @chan: channel
570711b34737SThomas Pedersen  * Return: The allowed channel width for this center_freq
570811b34737SThomas Pedersen  */
570911b34737SThomas Pedersen enum nl80211_chan_width
571011b34737SThomas Pedersen ieee80211_s1g_channel_width(const struct ieee80211_channel *chan);
571111b34737SThomas Pedersen 
571211b34737SThomas Pedersen /**
5713934f4c7dSThomas Pedersen  * ieee80211_channel_to_freq_khz - convert channel number to frequency
5714934f4c7dSThomas Pedersen  * @chan: channel number
5715934f4c7dSThomas Pedersen  * @band: band, necessary due to channel number overlap
5716934f4c7dSThomas Pedersen  * Return: The corresponding frequency (in KHz), or 0 if the conversion failed.
5717934f4c7dSThomas Pedersen  */
5718934f4c7dSThomas Pedersen u32 ieee80211_channel_to_freq_khz(int chan, enum nl80211_band band);
5719934f4c7dSThomas Pedersen 
5720934f4c7dSThomas Pedersen /**
5721d3236553SJohannes Berg  * ieee80211_channel_to_frequency - convert channel number to frequency
5722abe37c4bSJohannes Berg  * @chan: channel number
572359eb21a6SBruno Randolf  * @band: band, necessary due to channel number overlap
57240ae997dcSYacine Belkadi  * Return: The corresponding frequency (in MHz), or 0 if the conversion failed.
5725d3236553SJohannes Berg  */
5726934f4c7dSThomas Pedersen static inline int
5727934f4c7dSThomas Pedersen ieee80211_channel_to_frequency(int chan, enum nl80211_band band)
5728934f4c7dSThomas Pedersen {
5729934f4c7dSThomas Pedersen 	return KHZ_TO_MHZ(ieee80211_channel_to_freq_khz(chan, band));
5730934f4c7dSThomas Pedersen }
5731934f4c7dSThomas Pedersen 
5732934f4c7dSThomas Pedersen /**
5733934f4c7dSThomas Pedersen  * ieee80211_freq_khz_to_channel - convert frequency to channel number
5734934f4c7dSThomas Pedersen  * @freq: center frequency in KHz
5735934f4c7dSThomas Pedersen  * Return: The corresponding channel, or 0 if the conversion failed.
5736934f4c7dSThomas Pedersen  */
5737934f4c7dSThomas Pedersen int ieee80211_freq_khz_to_channel(u32 freq);
5738d3236553SJohannes Berg 
5739d3236553SJohannes Berg /**
5740d3236553SJohannes Berg  * ieee80211_frequency_to_channel - convert frequency to channel number
5741934f4c7dSThomas Pedersen  * @freq: center frequency in MHz
57420ae997dcSYacine Belkadi  * Return: The corresponding channel, or 0 if the conversion failed.
5743d3236553SJohannes Berg  */
5744934f4c7dSThomas Pedersen static inline int
5745934f4c7dSThomas Pedersen ieee80211_frequency_to_channel(int freq)
5746934f4c7dSThomas Pedersen {
5747934f4c7dSThomas Pedersen 	return ieee80211_freq_khz_to_channel(MHZ_TO_KHZ(freq));
5748934f4c7dSThomas Pedersen }
5749934f4c7dSThomas Pedersen 
5750934f4c7dSThomas Pedersen /**
5751934f4c7dSThomas Pedersen  * ieee80211_get_channel_khz - get channel struct from wiphy for specified
5752934f4c7dSThomas Pedersen  * frequency
5753934f4c7dSThomas Pedersen  * @wiphy: the struct wiphy to get the channel for
5754934f4c7dSThomas Pedersen  * @freq: the center frequency (in KHz) of the channel
5755934f4c7dSThomas Pedersen  * Return: The channel struct from @wiphy at @freq.
5756934f4c7dSThomas Pedersen  */
5757934f4c7dSThomas Pedersen struct ieee80211_channel *
5758934f4c7dSThomas Pedersen ieee80211_get_channel_khz(struct wiphy *wiphy, u32 freq);
5759d3236553SJohannes Berg 
5760d3236553SJohannes Berg /**
5761d3236553SJohannes Berg  * ieee80211_get_channel - get channel struct from wiphy for specified frequency
5762543b921bSArend Van Spriel  *
5763abe37c4bSJohannes Berg  * @wiphy: the struct wiphy to get the channel for
5764934f4c7dSThomas Pedersen  * @freq: the center frequency (in MHz) of the channel
57650ae997dcSYacine Belkadi  * Return: The channel struct from @wiphy at @freq.
5766d3236553SJohannes Berg  */
5767934f4c7dSThomas Pedersen static inline struct ieee80211_channel *
5768934f4c7dSThomas Pedersen ieee80211_get_channel(struct wiphy *wiphy, int freq)
5769934f4c7dSThomas Pedersen {
5770934f4c7dSThomas Pedersen 	return ieee80211_get_channel_khz(wiphy, MHZ_TO_KHZ(freq));
5771934f4c7dSThomas Pedersen }
5772d3236553SJohannes Berg 
5773d3236553SJohannes Berg /**
5774afbc9c9eSJohannes Berg  * cfg80211_channel_is_psc - Check if the channel is a 6 GHz PSC
5775afbc9c9eSJohannes Berg  * @chan: control channel to check
5776afbc9c9eSJohannes Berg  *
5777afbc9c9eSJohannes Berg  * The Preferred Scanning Channels (PSC) are defined in
5778afbc9c9eSJohannes Berg  * Draft IEEE P802.11ax/D5.0, 26.17.2.3.3
5779afbc9c9eSJohannes Berg  */
5780afbc9c9eSJohannes Berg static inline bool cfg80211_channel_is_psc(struct ieee80211_channel *chan)
5781afbc9c9eSJohannes Berg {
5782afbc9c9eSJohannes Berg 	if (chan->band != NL80211_BAND_6GHZ)
5783afbc9c9eSJohannes Berg 		return false;
5784afbc9c9eSJohannes Berg 
5785afbc9c9eSJohannes Berg 	return ieee80211_frequency_to_channel(chan->center_freq) % 16 == 5;
5786afbc9c9eSJohannes Berg }
5787afbc9c9eSJohannes Berg 
5788afbc9c9eSJohannes Berg /**
5789d3236553SJohannes Berg  * ieee80211_get_response_rate - get basic rate for a given rate
5790d3236553SJohannes Berg  *
5791d3236553SJohannes Berg  * @sband: the band to look for rates in
5792d3236553SJohannes Berg  * @basic_rates: bitmap of basic rates
5793d3236553SJohannes Berg  * @bitrate: the bitrate for which to find the basic rate
5794d3236553SJohannes Berg  *
57950ae997dcSYacine Belkadi  * Return: The basic rate corresponding to a given bitrate, that
57960ae997dcSYacine Belkadi  * is the next lower bitrate contained in the basic rate map,
57970ae997dcSYacine Belkadi  * which is, for this function, given as a bitmap of indices of
57980ae997dcSYacine Belkadi  * rates in the band's bitrate table.
5799d3236553SJohannes Berg  */
5800623b988fSJoe Perches const struct ieee80211_rate *
5801d3236553SJohannes Berg ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
5802d3236553SJohannes Berg 			    u32 basic_rates, int bitrate);
5803d3236553SJohannes Berg 
5804b422c6cdSAshok Nagarajan /**
5805b422c6cdSAshok Nagarajan  * ieee80211_mandatory_rates - get mandatory rates for a given band
5806b422c6cdSAshok Nagarajan  * @sband: the band to look for rates in
580774608acaSSimon Wunderlich  * @scan_width: width of the control channel
5808b422c6cdSAshok Nagarajan  *
5809b422c6cdSAshok Nagarajan  * This function returns a bitmap of the mandatory rates for the given
5810b422c6cdSAshok Nagarajan  * band, bits are set according to the rate position in the bitrates array.
5811b422c6cdSAshok Nagarajan  */
581274608acaSSimon Wunderlich u32 ieee80211_mandatory_rates(struct ieee80211_supported_band *sband,
581374608acaSSimon Wunderlich 			      enum nl80211_bss_scan_width scan_width);
5814b422c6cdSAshok Nagarajan 
5815d3236553SJohannes Berg /*
5816d3236553SJohannes Berg  * Radiotap parsing functions -- for controlled injection support
5817d3236553SJohannes Berg  *
5818d3236553SJohannes Berg  * Implemented in net/wireless/radiotap.c
581966d495d0SMauro Carvalho Chehab  * Documentation in Documentation/networking/radiotap-headers.rst
5820d3236553SJohannes Berg  */
5821d3236553SJohannes Berg 
582233e5a2f7SJohannes Berg struct radiotap_align_size {
582333e5a2f7SJohannes Berg 	uint8_t align:4, size:4;
582433e5a2f7SJohannes Berg };
582533e5a2f7SJohannes Berg 
582633e5a2f7SJohannes Berg struct ieee80211_radiotap_namespace {
582733e5a2f7SJohannes Berg 	const struct radiotap_align_size *align_size;
582833e5a2f7SJohannes Berg 	int n_bits;
582933e5a2f7SJohannes Berg 	uint32_t oui;
583033e5a2f7SJohannes Berg 	uint8_t subns;
583133e5a2f7SJohannes Berg };
583233e5a2f7SJohannes Berg 
583333e5a2f7SJohannes Berg struct ieee80211_radiotap_vendor_namespaces {
583433e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_namespace *ns;
583533e5a2f7SJohannes Berg 	int n_ns;
583633e5a2f7SJohannes Berg };
583733e5a2f7SJohannes Berg 
5838d3236553SJohannes Berg /**
5839d3236553SJohannes Berg  * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args
584033e5a2f7SJohannes Berg  * @this_arg_index: index of current arg, valid after each successful call
584133e5a2f7SJohannes Berg  *	to ieee80211_radiotap_iterator_next()
584233e5a2f7SJohannes Berg  * @this_arg: pointer to current radiotap arg; it is valid after each
584333e5a2f7SJohannes Berg  *	call to ieee80211_radiotap_iterator_next() but also after
584433e5a2f7SJohannes Berg  *	ieee80211_radiotap_iterator_init() where it will point to
584533e5a2f7SJohannes Berg  *	the beginning of the actual data portion
584633e5a2f7SJohannes Berg  * @this_arg_size: length of the current arg, for convenience
584733e5a2f7SJohannes Berg  * @current_namespace: pointer to the current namespace definition
584833e5a2f7SJohannes Berg  *	(or internally %NULL if the current namespace is unknown)
584933e5a2f7SJohannes Berg  * @is_radiotap_ns: indicates whether the current namespace is the default
585033e5a2f7SJohannes Berg  *	radiotap namespace or not
585133e5a2f7SJohannes Berg  *
585233e5a2f7SJohannes Berg  * @_rtheader: pointer to the radiotap header we are walking through
585333e5a2f7SJohannes Berg  * @_max_length: length of radiotap header in cpu byte ordering
585433e5a2f7SJohannes Berg  * @_arg_index: next argument index
585533e5a2f7SJohannes Berg  * @_arg: next argument pointer
585633e5a2f7SJohannes Berg  * @_next_bitmap: internal pointer to next present u32
585733e5a2f7SJohannes Berg  * @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present
585833e5a2f7SJohannes Berg  * @_vns: vendor namespace definitions
585933e5a2f7SJohannes Berg  * @_next_ns_data: beginning of the next namespace's data
586033e5a2f7SJohannes Berg  * @_reset_on_ext: internal; reset the arg index to 0 when going to the
586133e5a2f7SJohannes Berg  *	next bitmap word
586233e5a2f7SJohannes Berg  *
586333e5a2f7SJohannes Berg  * Describes the radiotap parser state. Fields prefixed with an underscore
586433e5a2f7SJohannes Berg  * must not be used by users of the parser, only by the parser internally.
5865d3236553SJohannes Berg  */
5866d3236553SJohannes Berg 
5867d3236553SJohannes Berg struct ieee80211_radiotap_iterator {
586833e5a2f7SJohannes Berg 	struct ieee80211_radiotap_header *_rtheader;
586933e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_vendor_namespaces *_vns;
587033e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_namespace *current_namespace;
5871d3236553SJohannes Berg 
587233e5a2f7SJohannes Berg 	unsigned char *_arg, *_next_ns_data;
587367272440SJohannes Berg 	__le32 *_next_bitmap;
587433e5a2f7SJohannes Berg 
587533e5a2f7SJohannes Berg 	unsigned char *this_arg;
587633e5a2f7SJohannes Berg 	int this_arg_index;
587733e5a2f7SJohannes Berg 	int this_arg_size;
587833e5a2f7SJohannes Berg 
587933e5a2f7SJohannes Berg 	int is_radiotap_ns;
588033e5a2f7SJohannes Berg 
588133e5a2f7SJohannes Berg 	int _max_length;
588233e5a2f7SJohannes Berg 	int _arg_index;
588333e5a2f7SJohannes Berg 	uint32_t _bitmap_shifter;
588433e5a2f7SJohannes Berg 	int _reset_on_ext;
5885d3236553SJohannes Berg };
5886d3236553SJohannes Berg 
588710dd9b7cSJoe Perches int
588810dd9b7cSJoe Perches ieee80211_radiotap_iterator_init(struct ieee80211_radiotap_iterator *iterator,
5889d3236553SJohannes Berg 				 struct ieee80211_radiotap_header *radiotap_header,
589010dd9b7cSJoe Perches 				 int max_length,
589110dd9b7cSJoe Perches 				 const struct ieee80211_radiotap_vendor_namespaces *vns);
5892d3236553SJohannes Berg 
589310dd9b7cSJoe Perches int
589410dd9b7cSJoe Perches ieee80211_radiotap_iterator_next(struct ieee80211_radiotap_iterator *iterator);
5895d3236553SJohannes Berg 
589633e5a2f7SJohannes Berg 
5897e31a16d6SZhu Yi extern const unsigned char rfc1042_header[6];
5898e31a16d6SZhu Yi extern const unsigned char bridge_tunnel_header[6];
5899e31a16d6SZhu Yi 
5900e31a16d6SZhu Yi /**
5901e31a16d6SZhu Yi  * ieee80211_get_hdrlen_from_skb - get header length from data
5902e31a16d6SZhu Yi  *
5903e31a16d6SZhu Yi  * @skb: the frame
59040ae997dcSYacine Belkadi  *
59050ae997dcSYacine Belkadi  * Given an skb with a raw 802.11 header at the data pointer this function
59060ae997dcSYacine Belkadi  * returns the 802.11 header length.
59070ae997dcSYacine Belkadi  *
59080ae997dcSYacine Belkadi  * Return: The 802.11 header length in bytes (not including encryption
59090ae997dcSYacine Belkadi  * headers). Or 0 if the data in the sk_buff is too short to contain a valid
59100ae997dcSYacine Belkadi  * 802.11 header.
5911e31a16d6SZhu Yi  */
5912e31a16d6SZhu Yi unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb);
5913e31a16d6SZhu Yi 
5914e31a16d6SZhu Yi /**
5915e31a16d6SZhu Yi  * ieee80211_hdrlen - get header length in bytes from frame control
5916e31a16d6SZhu Yi  * @fc: frame control field in little-endian format
59170ae997dcSYacine Belkadi  * Return: The header length in bytes.
5918e31a16d6SZhu Yi  */
5919633adf1aSJohannes Berg unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc);
5920e31a16d6SZhu Yi 
5921e31a16d6SZhu Yi /**
59229b395bc3SJohannes Berg  * ieee80211_get_mesh_hdrlen - get mesh extension header length
59239b395bc3SJohannes Berg  * @meshhdr: the mesh extension header, only the flags field
59249b395bc3SJohannes Berg  *	(first byte) will be accessed
59250ae997dcSYacine Belkadi  * Return: The length of the extension header, which is always at
59269b395bc3SJohannes Berg  * least 6 bytes and at most 18 if address 5 and 6 are present.
59279b395bc3SJohannes Berg  */
59289b395bc3SJohannes Berg unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr);
59299b395bc3SJohannes Berg 
59309b395bc3SJohannes Berg /**
5931d70e9693SJohannes Berg  * DOC: Data path helpers
5932d70e9693SJohannes Berg  *
5933d70e9693SJohannes Berg  * In addition to generic utilities, cfg80211 also offers
5934d70e9693SJohannes Berg  * functions that help implement the data path for devices
5935d70e9693SJohannes Berg  * that do not do the 802.11/802.3 conversion on the device.
5936d70e9693SJohannes Berg  */
5937d70e9693SJohannes Berg 
5938d70e9693SJohannes Berg /**
59397f6990c8SJohannes Berg  * ieee80211_data_to_8023_exthdr - convert an 802.11 data frame to 802.3
59407f6990c8SJohannes Berg  * @skb: the 802.11 data frame
59417f6990c8SJohannes Berg  * @ehdr: pointer to a &struct ethhdr that will get the header, instead
59427f6990c8SJohannes Berg  *	of it being pushed into the SKB
59437f6990c8SJohannes Berg  * @addr: the device MAC address
59447f6990c8SJohannes Berg  * @iftype: the virtual interface type
594524bba078SFelix Fietkau  * @data_offset: offset of payload after the 802.11 header
59467f6990c8SJohannes Berg  * Return: 0 on success. Non-zero on error.
59477f6990c8SJohannes Berg  */
59487f6990c8SJohannes Berg int ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr,
594924bba078SFelix Fietkau 				  const u8 *addr, enum nl80211_iftype iftype,
5950a1d5ff56SMathy Vanhoef 				  u8 data_offset, bool is_amsdu);
59517f6990c8SJohannes Berg 
59527f6990c8SJohannes Berg /**
5953e31a16d6SZhu Yi  * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3
5954e31a16d6SZhu Yi  * @skb: the 802.11 data frame
5955e31a16d6SZhu Yi  * @addr: the device MAC address
5956e31a16d6SZhu Yi  * @iftype: the virtual interface type
59570ae997dcSYacine Belkadi  * Return: 0 on success. Non-zero on error.
5958e31a16d6SZhu Yi  */
59597f6990c8SJohannes Berg static inline int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
59607f6990c8SJohannes Berg 					 enum nl80211_iftype iftype)
59617f6990c8SJohannes Berg {
5962a1d5ff56SMathy Vanhoef 	return ieee80211_data_to_8023_exthdr(skb, NULL, addr, iftype, 0, false);
59637f6990c8SJohannes Berg }
5964e31a16d6SZhu Yi 
5965e31a16d6SZhu Yi /**
5966eaf85ca7SZhu Yi  * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame
5967eaf85ca7SZhu Yi  *
59687f6990c8SJohannes Berg  * Decode an IEEE 802.11 A-MSDU and convert it to a list of 802.3 frames.
59697f6990c8SJohannes Berg  * The @list will be empty if the decode fails. The @skb must be fully
59707f6990c8SJohannes Berg  * header-less before being passed in here; it is freed in this function.
5971eaf85ca7SZhu Yi  *
59727f6990c8SJohannes Berg  * @skb: The input A-MSDU frame without any headers.
5973eaf85ca7SZhu Yi  * @list: The output list of 802.3 frames. It must be allocated and
5974085a6c10SRandy Dunlap  *	initialized by the caller.
5975eaf85ca7SZhu Yi  * @addr: The device MAC address.
5976eaf85ca7SZhu Yi  * @iftype: The device interface type.
5977eaf85ca7SZhu Yi  * @extra_headroom: The hardware extra headroom for SKBs in the @list.
59788b935ee2SJohannes Berg  * @check_da: DA to check in the inner ethernet header, or NULL
59798b935ee2SJohannes Berg  * @check_sa: SA to check in the inner ethernet header, or NULL
5980eaf85ca7SZhu Yi  */
5981eaf85ca7SZhu Yi void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,
5982eaf85ca7SZhu Yi 			      const u8 *addr, enum nl80211_iftype iftype,
59838b3becadSYogesh Ashok Powar 			      const unsigned int extra_headroom,
59848b935ee2SJohannes Berg 			      const u8 *check_da, const u8 *check_sa);
5985eaf85ca7SZhu Yi 
5986eaf85ca7SZhu Yi /**
5987e31a16d6SZhu Yi  * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame
5988e31a16d6SZhu Yi  * @skb: the data frame
5989fa9ffc74SKyeyoon Park  * @qos_map: Interworking QoS mapping or %NULL if not in use
59900ae997dcSYacine Belkadi  * Return: The 802.1p/1d tag.
5991e31a16d6SZhu Yi  */
5992fa9ffc74SKyeyoon Park unsigned int cfg80211_classify8021d(struct sk_buff *skb,
5993fa9ffc74SKyeyoon Park 				    struct cfg80211_qos_map *qos_map);
5994e31a16d6SZhu Yi 
5995c21dbf92SJohannes Berg /**
599649a68e0dSJohannes Berg  * cfg80211_find_elem_match - match information element and byte array in data
599749a68e0dSJohannes Berg  *
599849a68e0dSJohannes Berg  * @eid: element ID
599949a68e0dSJohannes Berg  * @ies: data consisting of IEs
600049a68e0dSJohannes Berg  * @len: length of data
600149a68e0dSJohannes Berg  * @match: byte array to match
600249a68e0dSJohannes Berg  * @match_len: number of bytes in the match array
600349a68e0dSJohannes Berg  * @match_offset: offset in the IE data where the byte array should match.
600449a68e0dSJohannes Berg  *	Note the difference to cfg80211_find_ie_match() which considers
600549a68e0dSJohannes Berg  *	the offset to start from the element ID byte, but here we take
600649a68e0dSJohannes Berg  *	the data portion instead.
600749a68e0dSJohannes Berg  *
600849a68e0dSJohannes Berg  * Return: %NULL if the element ID could not be found or if
600949a68e0dSJohannes Berg  * the element is invalid (claims to be longer than the given
601049a68e0dSJohannes Berg  * data) or if the byte array doesn't match; otherwise return the
601149a68e0dSJohannes Berg  * requested element struct.
601249a68e0dSJohannes Berg  *
601349a68e0dSJohannes Berg  * Note: There are no checks on the element length other than
601449a68e0dSJohannes Berg  * having to fit into the given data and being large enough for the
601549a68e0dSJohannes Berg  * byte array to match.
601649a68e0dSJohannes Berg  */
601749a68e0dSJohannes Berg const struct element *
601849a68e0dSJohannes Berg cfg80211_find_elem_match(u8 eid, const u8 *ies, unsigned int len,
601949a68e0dSJohannes Berg 			 const u8 *match, unsigned int match_len,
602049a68e0dSJohannes Berg 			 unsigned int match_offset);
602149a68e0dSJohannes Berg 
602249a68e0dSJohannes Berg /**
6023fbd05e4aSLuca Coelho  * cfg80211_find_ie_match - match information element and byte array in data
6024fbd05e4aSLuca Coelho  *
6025fbd05e4aSLuca Coelho  * @eid: element ID
6026fbd05e4aSLuca Coelho  * @ies: data consisting of IEs
6027fbd05e4aSLuca Coelho  * @len: length of data
6028fbd05e4aSLuca Coelho  * @match: byte array to match
6029fbd05e4aSLuca Coelho  * @match_len: number of bytes in the match array
6030fbd05e4aSLuca Coelho  * @match_offset: offset in the IE where the byte array should match.
6031fbd05e4aSLuca Coelho  *	If match_len is zero, this must also be set to zero.
6032fbd05e4aSLuca Coelho  *	Otherwise this must be set to 2 or more, because the first
6033fbd05e4aSLuca Coelho  *	byte is the element id, which is already compared to eid, and
6034fbd05e4aSLuca Coelho  *	the second byte is the IE length.
6035fbd05e4aSLuca Coelho  *
6036fbd05e4aSLuca Coelho  * Return: %NULL if the element ID could not be found or if
6037fbd05e4aSLuca Coelho  * the element is invalid (claims to be longer than the given
6038fbd05e4aSLuca Coelho  * data) or if the byte array doesn't match, or a pointer to the first
6039fbd05e4aSLuca Coelho  * byte of the requested element, that is the byte containing the
6040fbd05e4aSLuca Coelho  * element ID.
6041fbd05e4aSLuca Coelho  *
6042fbd05e4aSLuca Coelho  * Note: There are no checks on the element length other than
6043fbd05e4aSLuca Coelho  * having to fit into the given data and being large enough for the
6044fbd05e4aSLuca Coelho  * byte array to match.
6045fbd05e4aSLuca Coelho  */
604649a68e0dSJohannes Berg static inline const u8 *
604749a68e0dSJohannes Berg cfg80211_find_ie_match(u8 eid, const u8 *ies, unsigned int len,
604849a68e0dSJohannes Berg 		       const u8 *match, unsigned int match_len,
604949a68e0dSJohannes Berg 		       unsigned int match_offset)
605049a68e0dSJohannes Berg {
605149a68e0dSJohannes Berg 	/* match_offset can't be smaller than 2, unless match_len is
605249a68e0dSJohannes Berg 	 * zero, in which case match_offset must be zero as well.
605349a68e0dSJohannes Berg 	 */
605449a68e0dSJohannes Berg 	if (WARN_ON((match_len && match_offset < 2) ||
605549a68e0dSJohannes Berg 		    (!match_len && match_offset)))
605649a68e0dSJohannes Berg 		return NULL;
605749a68e0dSJohannes Berg 
60587e367b06SJohannes Berg 	return (const void *)cfg80211_find_elem_match(eid, ies, len,
605949a68e0dSJohannes Berg 						      match, match_len,
606049a68e0dSJohannes Berg 						      match_offset ?
606149a68e0dSJohannes Berg 							match_offset - 2 : 0);
606249a68e0dSJohannes Berg }
606349a68e0dSJohannes Berg 
606449a68e0dSJohannes Berg /**
606549a68e0dSJohannes Berg  * cfg80211_find_elem - find information element in data
606649a68e0dSJohannes Berg  *
606749a68e0dSJohannes Berg  * @eid: element ID
606849a68e0dSJohannes Berg  * @ies: data consisting of IEs
606949a68e0dSJohannes Berg  * @len: length of data
607049a68e0dSJohannes Berg  *
607149a68e0dSJohannes Berg  * Return: %NULL if the element ID could not be found or if
607249a68e0dSJohannes Berg  * the element is invalid (claims to be longer than the given
607349a68e0dSJohannes Berg  * data) or if the byte array doesn't match; otherwise return the
607449a68e0dSJohannes Berg  * requested element struct.
607549a68e0dSJohannes Berg  *
607649a68e0dSJohannes Berg  * Note: There are no checks on the element length other than
607749a68e0dSJohannes Berg  * having to fit into the given data.
607849a68e0dSJohannes Berg  */
607949a68e0dSJohannes Berg static inline const struct element *
608049a68e0dSJohannes Berg cfg80211_find_elem(u8 eid, const u8 *ies, int len)
608149a68e0dSJohannes Berg {
608249a68e0dSJohannes Berg 	return cfg80211_find_elem_match(eid, ies, len, NULL, 0, 0);
608349a68e0dSJohannes Berg }
6084fbd05e4aSLuca Coelho 
6085fbd05e4aSLuca Coelho /**
6086c21dbf92SJohannes Berg  * cfg80211_find_ie - find information element in data
6087c21dbf92SJohannes Berg  *
6088c21dbf92SJohannes Berg  * @eid: element ID
6089c21dbf92SJohannes Berg  * @ies: data consisting of IEs
6090c21dbf92SJohannes Berg  * @len: length of data
6091c21dbf92SJohannes Berg  *
60920ae997dcSYacine Belkadi  * Return: %NULL if the element ID could not be found or if
60930ae997dcSYacine Belkadi  * the element is invalid (claims to be longer than the given
60940ae997dcSYacine Belkadi  * data), or a pointer to the first byte of the requested
60950ae997dcSYacine Belkadi  * element, that is the byte containing the element ID.
60960ae997dcSYacine Belkadi  *
60970ae997dcSYacine Belkadi  * Note: There are no checks on the element length other than
60980ae997dcSYacine Belkadi  * having to fit into the given data.
6099c21dbf92SJohannes Berg  */
6100fbd05e4aSLuca Coelho static inline const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len)
6101fbd05e4aSLuca Coelho {
6102fbd05e4aSLuca Coelho 	return cfg80211_find_ie_match(eid, ies, len, NULL, 0, 0);
6103fbd05e4aSLuca Coelho }
6104c21dbf92SJohannes Berg 
6105d70e9693SJohannes Berg /**
610649a68e0dSJohannes Berg  * cfg80211_find_ext_elem - find information element with EID Extension in data
610749a68e0dSJohannes Berg  *
610849a68e0dSJohannes Berg  * @ext_eid: element ID Extension
610949a68e0dSJohannes Berg  * @ies: data consisting of IEs
611049a68e0dSJohannes Berg  * @len: length of data
611149a68e0dSJohannes Berg  *
611249a68e0dSJohannes Berg  * Return: %NULL if the etended element could not be found or if
611349a68e0dSJohannes Berg  * the element is invalid (claims to be longer than the given
611449a68e0dSJohannes Berg  * data) or if the byte array doesn't match; otherwise return the
611549a68e0dSJohannes Berg  * requested element struct.
611649a68e0dSJohannes Berg  *
611749a68e0dSJohannes Berg  * Note: There are no checks on the element length other than
611849a68e0dSJohannes Berg  * having to fit into the given data.
611949a68e0dSJohannes Berg  */
612049a68e0dSJohannes Berg static inline const struct element *
612149a68e0dSJohannes Berg cfg80211_find_ext_elem(u8 ext_eid, const u8 *ies, int len)
612249a68e0dSJohannes Berg {
612349a68e0dSJohannes Berg 	return cfg80211_find_elem_match(WLAN_EID_EXTENSION, ies, len,
612449a68e0dSJohannes Berg 					&ext_eid, 1, 0);
612549a68e0dSJohannes Berg }
612649a68e0dSJohannes Berg 
612749a68e0dSJohannes Berg /**
61283f817fe7SJouni Malinen  * cfg80211_find_ext_ie - find information element with EID Extension in data
61293f817fe7SJouni Malinen  *
61303f817fe7SJouni Malinen  * @ext_eid: element ID Extension
61313f817fe7SJouni Malinen  * @ies: data consisting of IEs
61323f817fe7SJouni Malinen  * @len: length of data
61333f817fe7SJouni Malinen  *
61343f817fe7SJouni Malinen  * Return: %NULL if the extended element ID could not be found or if
61353f817fe7SJouni Malinen  * the element is invalid (claims to be longer than the given
61363f817fe7SJouni Malinen  * data), or a pointer to the first byte of the requested
61373f817fe7SJouni Malinen  * element, that is the byte containing the element ID.
61383f817fe7SJouni Malinen  *
61393f817fe7SJouni Malinen  * Note: There are no checks on the element length other than
61403f817fe7SJouni Malinen  * having to fit into the given data.
61413f817fe7SJouni Malinen  */
61423f817fe7SJouni Malinen static inline const u8 *cfg80211_find_ext_ie(u8 ext_eid, const u8 *ies, int len)
61433f817fe7SJouni Malinen {
61443f817fe7SJouni Malinen 	return cfg80211_find_ie_match(WLAN_EID_EXTENSION, ies, len,
61453f817fe7SJouni Malinen 				      &ext_eid, 1, 2);
61463f817fe7SJouni Malinen }
61473f817fe7SJouni Malinen 
61483f817fe7SJouni Malinen /**
614949a68e0dSJohannes Berg  * cfg80211_find_vendor_elem - find vendor specific information element in data
615049a68e0dSJohannes Berg  *
615149a68e0dSJohannes Berg  * @oui: vendor OUI
615249a68e0dSJohannes Berg  * @oui_type: vendor-specific OUI type (must be < 0xff), negative means any
615349a68e0dSJohannes Berg  * @ies: data consisting of IEs
615449a68e0dSJohannes Berg  * @len: length of data
615549a68e0dSJohannes Berg  *
615649a68e0dSJohannes Berg  * Return: %NULL if the vendor specific element ID could not be found or if the
615749a68e0dSJohannes Berg  * element is invalid (claims to be longer than the given data); otherwise
615849a68e0dSJohannes Berg  * return the element structure for the requested element.
615949a68e0dSJohannes Berg  *
616049a68e0dSJohannes Berg  * Note: There are no checks on the element length other than having to fit into
616149a68e0dSJohannes Berg  * the given data.
616249a68e0dSJohannes Berg  */
616349a68e0dSJohannes Berg const struct element *cfg80211_find_vendor_elem(unsigned int oui, int oui_type,
616449a68e0dSJohannes Berg 						const u8 *ies,
616549a68e0dSJohannes Berg 						unsigned int len);
616649a68e0dSJohannes Berg 
616749a68e0dSJohannes Berg /**
61680c28ec58SEliad Peller  * cfg80211_find_vendor_ie - find vendor specific information element in data
61690c28ec58SEliad Peller  *
61700c28ec58SEliad Peller  * @oui: vendor OUI
61719e9ea439SEmmanuel Grumbach  * @oui_type: vendor-specific OUI type (must be < 0xff), negative means any
61720c28ec58SEliad Peller  * @ies: data consisting of IEs
61730c28ec58SEliad Peller  * @len: length of data
61740c28ec58SEliad Peller  *
61750ae997dcSYacine Belkadi  * Return: %NULL if the vendor specific element ID could not be found or if the
61760ae997dcSYacine Belkadi  * element is invalid (claims to be longer than the given data), or a pointer to
61770ae997dcSYacine Belkadi  * the first byte of the requested element, that is the byte containing the
61780ae997dcSYacine Belkadi  * element ID.
61790ae997dcSYacine Belkadi  *
61800ae997dcSYacine Belkadi  * Note: There are no checks on the element length other than having to fit into
61810ae997dcSYacine Belkadi  * the given data.
61820c28ec58SEliad Peller  */
618349a68e0dSJohannes Berg static inline const u8 *
618449a68e0dSJohannes Berg cfg80211_find_vendor_ie(unsigned int oui, int oui_type,
618549a68e0dSJohannes Berg 			const u8 *ies, unsigned int len)
618649a68e0dSJohannes Berg {
61877e367b06SJohannes Berg 	return (const void *)cfg80211_find_vendor_elem(oui, oui_type, ies, len);
618849a68e0dSJohannes Berg }
61890c28ec58SEliad Peller 
61900c28ec58SEliad Peller /**
619130ca1aa5SDedy Lansky  * cfg80211_send_layer2_update - send layer 2 update frame
619230ca1aa5SDedy Lansky  *
619330ca1aa5SDedy Lansky  * @dev: network device
619430ca1aa5SDedy Lansky  * @addr: STA MAC address
619530ca1aa5SDedy Lansky  *
619630ca1aa5SDedy Lansky  * Wireless drivers can use this function to update forwarding tables in bridge
619730ca1aa5SDedy Lansky  * devices upon STA association.
619830ca1aa5SDedy Lansky  */
619930ca1aa5SDedy Lansky void cfg80211_send_layer2_update(struct net_device *dev, const u8 *addr);
620030ca1aa5SDedy Lansky 
620130ca1aa5SDedy Lansky /**
6202d70e9693SJohannes Berg  * DOC: Regulatory enforcement infrastructure
6203d70e9693SJohannes Berg  *
6204d70e9693SJohannes Berg  * TODO
6205d3236553SJohannes Berg  */
6206d3236553SJohannes Berg 
6207d3236553SJohannes Berg /**
6208d3236553SJohannes Berg  * regulatory_hint - driver hint to the wireless core a regulatory domain
6209d3236553SJohannes Berg  * @wiphy: the wireless device giving the hint (used only for reporting
6210d3236553SJohannes Berg  *	conflicts)
6211d3236553SJohannes Berg  * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain
6212d3236553SJohannes Berg  *	should be in. If @rd is set this should be NULL. Note that if you
6213d3236553SJohannes Berg  *	set this to NULL you should still set rd->alpha2 to some accepted
6214d3236553SJohannes Berg  *	alpha2.
6215d3236553SJohannes Berg  *
6216d3236553SJohannes Berg  * Wireless drivers can use this function to hint to the wireless core
6217d3236553SJohannes Berg  * what it believes should be the current regulatory domain by
6218d3236553SJohannes Berg  * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory
6219d3236553SJohannes Berg  * domain should be in or by providing a completely build regulatory domain.
6220d3236553SJohannes Berg  * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried
6221d3236553SJohannes Berg  * for a regulatory domain structure for the respective country.
6222d3236553SJohannes Berg  *
6223d3236553SJohannes Berg  * The wiphy must have been registered to cfg80211 prior to this call.
6224d3236553SJohannes Berg  * For cfg80211 drivers this means you must first use wiphy_register(),
6225d3236553SJohannes Berg  * for mac80211 drivers you must first use ieee80211_register_hw().
6226d3236553SJohannes Berg  *
6227d3236553SJohannes Berg  * Drivers should check the return value, its possible you can get
6228d3236553SJohannes Berg  * an -ENOMEM.
62290ae997dcSYacine Belkadi  *
62300ae997dcSYacine Belkadi  * Return: 0 on success. -ENOMEM.
6231d3236553SJohannes Berg  */
623210dd9b7cSJoe Perches int regulatory_hint(struct wiphy *wiphy, const char *alpha2);
6233d3236553SJohannes Berg 
6234d3236553SJohannes Berg /**
6235b0d7aa59SJonathan Doron  * regulatory_set_wiphy_regd - set regdom info for self managed drivers
6236b0d7aa59SJonathan Doron  * @wiphy: the wireless device we want to process the regulatory domain on
6237b0d7aa59SJonathan Doron  * @rd: the regulatory domain informatoin to use for this wiphy
6238b0d7aa59SJonathan Doron  *
6239b0d7aa59SJonathan Doron  * Set the regulatory domain information for self-managed wiphys, only they
6240b0d7aa59SJonathan Doron  * may use this function. See %REGULATORY_WIPHY_SELF_MANAGED for more
6241b0d7aa59SJonathan Doron  * information.
6242b0d7aa59SJonathan Doron  *
6243b0d7aa59SJonathan Doron  * Return: 0 on success. -EINVAL, -EPERM
6244b0d7aa59SJonathan Doron  */
6245b0d7aa59SJonathan Doron int regulatory_set_wiphy_regd(struct wiphy *wiphy,
6246b0d7aa59SJonathan Doron 			      struct ieee80211_regdomain *rd);
6247b0d7aa59SJonathan Doron 
6248b0d7aa59SJonathan Doron /**
6249a05829a7SJohannes Berg  * regulatory_set_wiphy_regd_sync - set regdom for self-managed drivers
62502c3e861cSArik Nemtsov  * @wiphy: the wireless device we want to process the regulatory domain on
62512c3e861cSArik Nemtsov  * @rd: the regulatory domain information to use for this wiphy
62522c3e861cSArik Nemtsov  *
6253a05829a7SJohannes Berg  * This functions requires the RTNL and the wiphy mutex to be held and
6254a05829a7SJohannes Berg  * applies the new regdomain synchronously to this wiphy. For more details
6255a05829a7SJohannes Berg  * see regulatory_set_wiphy_regd().
62562c3e861cSArik Nemtsov  *
62572c3e861cSArik Nemtsov  * Return: 0 on success. -EINVAL, -EPERM
62582c3e861cSArik Nemtsov  */
6259a05829a7SJohannes Berg int regulatory_set_wiphy_regd_sync(struct wiphy *wiphy,
62602c3e861cSArik Nemtsov 				   struct ieee80211_regdomain *rd);
62612c3e861cSArik Nemtsov 
62622c3e861cSArik Nemtsov /**
6263d3236553SJohannes Berg  * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain
6264d3236553SJohannes Berg  * @wiphy: the wireless device we want to process the regulatory domain on
6265d3236553SJohannes Berg  * @regd: the custom regulatory domain to use for this wiphy
6266d3236553SJohannes Berg  *
6267d3236553SJohannes Berg  * Drivers can sometimes have custom regulatory domains which do not apply
6268d3236553SJohannes Berg  * to a specific country. Drivers can use this to apply such custom regulatory
6269d3236553SJohannes Berg  * domains. This routine must be called prior to wiphy registration. The
6270d3236553SJohannes Berg  * custom regulatory domain will be trusted completely and as such previous
6271d3236553SJohannes Berg  * default channel settings will be disregarded. If no rule is found for a
6272d3236553SJohannes Berg  * channel on the regulatory domain the channel will be disabled.
6273222ea581SLuis R. Rodriguez  * Drivers using this for a wiphy should also set the wiphy flag
6274ce26151bSKalle Valo  * REGULATORY_CUSTOM_REG or cfg80211 will set it for the wiphy
6275222ea581SLuis R. Rodriguez  * that called this helper.
6276d3236553SJohannes Berg  */
627710dd9b7cSJoe Perches void wiphy_apply_custom_regulatory(struct wiphy *wiphy,
6278d3236553SJohannes Berg 				   const struct ieee80211_regdomain *regd);
6279d3236553SJohannes Berg 
6280d3236553SJohannes Berg /**
6281d3236553SJohannes Berg  * freq_reg_info - get regulatory information for the given frequency
6282d3236553SJohannes Berg  * @wiphy: the wiphy for which we want to process this rule for
6283d3236553SJohannes Berg  * @center_freq: Frequency in KHz for which we want regulatory information for
6284d3236553SJohannes Berg  *
6285d3236553SJohannes Berg  * Use this function to get the regulatory rule for a specific frequency on
6286d3236553SJohannes Berg  * a given wireless device. If the device has a specific regulatory domain
6287d3236553SJohannes Berg  * it wants to follow we respect that unless a country IE has been received
6288d3236553SJohannes Berg  * and processed already.
6289d3236553SJohannes Berg  *
62900ae997dcSYacine Belkadi  * Return: A valid pointer, or, when an error occurs, for example if no rule
62910ae997dcSYacine Belkadi  * can be found, the return value is encoded using ERR_PTR(). Use IS_ERR() to
62920ae997dcSYacine Belkadi  * check and PTR_ERR() to obtain the numeric return value. The numeric return
62930ae997dcSYacine Belkadi  * value will be -ERANGE if we determine the given center_freq does not even
62940ae997dcSYacine Belkadi  * have a regulatory rule for a frequency range in the center_freq's band.
62950ae997dcSYacine Belkadi  * See freq_in_rule_band() for our current definition of a band -- this is
62960ae997dcSYacine Belkadi  * purely subjective and right now it's 802.11 specific.
6297d3236553SJohannes Berg  */
6298361c9c8bSJohannes Berg const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy,
6299361c9c8bSJohannes Berg 					       u32 center_freq);
6300d3236553SJohannes Berg 
6301034c6d6eSLuis R. Rodriguez /**
6302034c6d6eSLuis R. Rodriguez  * reg_initiator_name - map regulatory request initiator enum to name
6303034c6d6eSLuis R. Rodriguez  * @initiator: the regulatory request initiator
6304034c6d6eSLuis R. Rodriguez  *
6305034c6d6eSLuis R. Rodriguez  * You can use this to map the regulatory request initiator enum to a
6306034c6d6eSLuis R. Rodriguez  * proper string representation.
6307034c6d6eSLuis R. Rodriguez  */
6308034c6d6eSLuis R. Rodriguez const char *reg_initiator_name(enum nl80211_reg_initiator initiator);
6309034c6d6eSLuis R. Rodriguez 
631019d3577eSHaim Dreyfuss /**
6311dc0c18edSAaron Komisar  * regulatory_pre_cac_allowed - check if pre-CAC allowed in the current regdom
6312dc0c18edSAaron Komisar  * @wiphy: wiphy for which pre-CAC capability is checked.
6313dc0c18edSAaron Komisar  *
6314dc0c18edSAaron Komisar  * Pre-CAC is allowed only in some regdomains (notable ETSI).
6315dc0c18edSAaron Komisar  */
6316dc0c18edSAaron Komisar bool regulatory_pre_cac_allowed(struct wiphy *wiphy);
6317dc0c18edSAaron Komisar 
6318dc0c18edSAaron Komisar /**
631919d3577eSHaim Dreyfuss  * DOC: Internal regulatory db functions
632019d3577eSHaim Dreyfuss  *
632119d3577eSHaim Dreyfuss  */
632219d3577eSHaim Dreyfuss 
632319d3577eSHaim Dreyfuss /**
632419d3577eSHaim Dreyfuss  * reg_query_regdb_wmm -  Query internal regulatory db for wmm rule
632519d3577eSHaim Dreyfuss  * Regulatory self-managed driver can use it to proactively
632619d3577eSHaim Dreyfuss  *
632719d3577eSHaim Dreyfuss  * @alpha2: the ISO/IEC 3166 alpha2 wmm rule to be queried.
632819d3577eSHaim Dreyfuss  * @freq: the freqency(in MHz) to be queried.
632919d3577eSHaim Dreyfuss  * @rule: pointer to store the wmm rule from the regulatory db.
633019d3577eSHaim Dreyfuss  *
633119d3577eSHaim Dreyfuss  * Self-managed wireless drivers can use this function to  query
633219d3577eSHaim Dreyfuss  * the internal regulatory database to check whether the given
633319d3577eSHaim Dreyfuss  * ISO/IEC 3166 alpha2 country and freq have wmm rule limitations.
633419d3577eSHaim Dreyfuss  *
633519d3577eSHaim Dreyfuss  * Drivers should check the return value, its possible you can get
633619d3577eSHaim Dreyfuss  * an -ENODATA.
633719d3577eSHaim Dreyfuss  *
633819d3577eSHaim Dreyfuss  * Return: 0 on success. -ENODATA.
633919d3577eSHaim Dreyfuss  */
634038cb87eeSStanislaw Gruszka int reg_query_regdb_wmm(char *alpha2, int freq,
634138cb87eeSStanislaw Gruszka 			struct ieee80211_reg_rule *rule);
634219d3577eSHaim Dreyfuss 
6343d3236553SJohannes Berg /*
6344d3236553SJohannes Berg  * callbacks for asynchronous cfg80211 methods, notification
6345d3236553SJohannes Berg  * functions and BSS handling helpers
6346d3236553SJohannes Berg  */
6347d3236553SJohannes Berg 
63482a519311SJohannes Berg /**
63492a519311SJohannes Berg  * cfg80211_scan_done - notify that scan finished
63502a519311SJohannes Berg  *
63512a519311SJohannes Berg  * @request: the corresponding scan request
63521d76250bSAvraham Stern  * @info: information about the completed scan
63532a519311SJohannes Berg  */
63541d76250bSAvraham Stern void cfg80211_scan_done(struct cfg80211_scan_request *request,
63551d76250bSAvraham Stern 			struct cfg80211_scan_info *info);
63562a519311SJohannes Berg 
63572a519311SJohannes Berg /**
6358807f8a8cSLuciano Coelho  * cfg80211_sched_scan_results - notify that new scan results are available
6359807f8a8cSLuciano Coelho  *
6360807f8a8cSLuciano Coelho  * @wiphy: the wiphy which got scheduled scan results
6361b34939b9SArend Van Spriel  * @reqid: identifier for the related scheduled scan request
6362807f8a8cSLuciano Coelho  */
6363b34939b9SArend Van Spriel void cfg80211_sched_scan_results(struct wiphy *wiphy, u64 reqid);
6364807f8a8cSLuciano Coelho 
6365807f8a8cSLuciano Coelho /**
6366807f8a8cSLuciano Coelho  * cfg80211_sched_scan_stopped - notify that the scheduled scan has stopped
6367807f8a8cSLuciano Coelho  *
6368807f8a8cSLuciano Coelho  * @wiphy: the wiphy on which the scheduled scan stopped
6369b34939b9SArend Van Spriel  * @reqid: identifier for the related scheduled scan request
6370807f8a8cSLuciano Coelho  *
6371807f8a8cSLuciano Coelho  * The driver can call this function to inform cfg80211 that the
6372807f8a8cSLuciano Coelho  * scheduled scan had to be stopped, for whatever reason.  The driver
6373807f8a8cSLuciano Coelho  * is then called back via the sched_scan_stop operation when done.
6374807f8a8cSLuciano Coelho  */
6375b34939b9SArend Van Spriel void cfg80211_sched_scan_stopped(struct wiphy *wiphy, u64 reqid);
6376807f8a8cSLuciano Coelho 
6377807f8a8cSLuciano Coelho /**
6378a05829a7SJohannes Berg  * cfg80211_sched_scan_stopped_locked - notify that the scheduled scan has stopped
6379792e6aa7SEliad Peller  *
6380792e6aa7SEliad Peller  * @wiphy: the wiphy on which the scheduled scan stopped
6381b34939b9SArend Van Spriel  * @reqid: identifier for the related scheduled scan request
6382792e6aa7SEliad Peller  *
6383792e6aa7SEliad Peller  * The driver can call this function to inform cfg80211 that the
6384792e6aa7SEliad Peller  * scheduled scan had to be stopped, for whatever reason.  The driver
6385792e6aa7SEliad Peller  * is then called back via the sched_scan_stop operation when done.
6386a05829a7SJohannes Berg  * This function should be called with the wiphy mutex held.
6387792e6aa7SEliad Peller  */
6388a05829a7SJohannes Berg void cfg80211_sched_scan_stopped_locked(struct wiphy *wiphy, u64 reqid);
6389792e6aa7SEliad Peller 
6390792e6aa7SEliad Peller /**
63916e19bc4bSDmitry Shmidt  * cfg80211_inform_bss_frame_data - inform cfg80211 of a received BSS frame
63922a519311SJohannes Berg  * @wiphy: the wiphy reporting the BSS
63936e19bc4bSDmitry Shmidt  * @data: the BSS metadata
6394abe37c4bSJohannes Berg  * @mgmt: the management frame (probe response or beacon)
6395abe37c4bSJohannes Berg  * @len: length of the management frame
63962a519311SJohannes Berg  * @gfp: context flags
63972a519311SJohannes Berg  *
63982a519311SJohannes Berg  * This informs cfg80211 that BSS information was found and
63992a519311SJohannes Berg  * the BSS should be updated/added.
6400ef100682SJohannes Berg  *
64010ae997dcSYacine Belkadi  * Return: A referenced struct, must be released with cfg80211_put_bss()!
64020ae997dcSYacine Belkadi  * Or %NULL on error.
64032a519311SJohannes Berg  */
6404ef100682SJohannes Berg struct cfg80211_bss * __must_check
64056e19bc4bSDmitry Shmidt cfg80211_inform_bss_frame_data(struct wiphy *wiphy,
64066e19bc4bSDmitry Shmidt 			       struct cfg80211_inform_bss *data,
64076e19bc4bSDmitry Shmidt 			       struct ieee80211_mgmt *mgmt, size_t len,
64086e19bc4bSDmitry Shmidt 			       gfp_t gfp);
64096e19bc4bSDmitry Shmidt 
64106e19bc4bSDmitry Shmidt static inline struct cfg80211_bss * __must_check
6411dcd6eac1SSimon Wunderlich cfg80211_inform_bss_width_frame(struct wiphy *wiphy,
64123afc2167SEmmanuel Grumbach 				struct ieee80211_channel *rx_channel,
6413dcd6eac1SSimon Wunderlich 				enum nl80211_bss_scan_width scan_width,
6414dcd6eac1SSimon Wunderlich 				struct ieee80211_mgmt *mgmt, size_t len,
64156e19bc4bSDmitry Shmidt 				s32 signal, gfp_t gfp)
64166e19bc4bSDmitry Shmidt {
64176e19bc4bSDmitry Shmidt 	struct cfg80211_inform_bss data = {
64186e19bc4bSDmitry Shmidt 		.chan = rx_channel,
64196e19bc4bSDmitry Shmidt 		.scan_width = scan_width,
64206e19bc4bSDmitry Shmidt 		.signal = signal,
64216e19bc4bSDmitry Shmidt 	};
64226e19bc4bSDmitry Shmidt 
64236e19bc4bSDmitry Shmidt 	return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp);
64246e19bc4bSDmitry Shmidt }
6425dcd6eac1SSimon Wunderlich 
6426dcd6eac1SSimon Wunderlich static inline struct cfg80211_bss * __must_check
64272a519311SJohannes Berg cfg80211_inform_bss_frame(struct wiphy *wiphy,
64283afc2167SEmmanuel Grumbach 			  struct ieee80211_channel *rx_channel,
64292a519311SJohannes Berg 			  struct ieee80211_mgmt *mgmt, size_t len,
6430dcd6eac1SSimon Wunderlich 			  s32 signal, gfp_t gfp)
6431dcd6eac1SSimon Wunderlich {
64326e19bc4bSDmitry Shmidt 	struct cfg80211_inform_bss data = {
64336e19bc4bSDmitry Shmidt 		.chan = rx_channel,
64346e19bc4bSDmitry Shmidt 		.scan_width = NL80211_BSS_CHAN_WIDTH_20,
64356e19bc4bSDmitry Shmidt 		.signal = signal,
64366e19bc4bSDmitry Shmidt 	};
64376e19bc4bSDmitry Shmidt 
64386e19bc4bSDmitry Shmidt 	return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp);
6439dcd6eac1SSimon Wunderlich }
64402a519311SJohannes Berg 
6441abe37c4bSJohannes Berg /**
64427ece9c37SSara Sharon  * cfg80211_gen_new_bssid - generate a nontransmitted BSSID for multi-BSSID
64437ece9c37SSara Sharon  * @bssid: transmitter BSSID
64447ece9c37SSara Sharon  * @max_bssid: max BSSID indicator, taken from Multiple BSSID element
64457ece9c37SSara Sharon  * @mbssid_index: BSSID index, taken from Multiple BSSID index element
64465d4071abSJohannes Berg  * @new_bssid: calculated nontransmitted BSSID
64477ece9c37SSara Sharon  */
64487ece9c37SSara Sharon static inline void cfg80211_gen_new_bssid(const u8 *bssid, u8 max_bssid,
64495d4071abSJohannes Berg 					  u8 mbssid_index, u8 *new_bssid)
64507ece9c37SSara Sharon {
64515d4071abSJohannes Berg 	u64 bssid_u64 = ether_addr_to_u64(bssid);
64525d4071abSJohannes Berg 	u64 mask = GENMASK_ULL(max_bssid - 1, 0);
64535d4071abSJohannes Berg 	u64 new_bssid_u64;
64547ece9c37SSara Sharon 
64555d4071abSJohannes Berg 	new_bssid_u64 = bssid_u64 & ~mask;
64567ece9c37SSara Sharon 
64575d4071abSJohannes Berg 	new_bssid_u64 |= ((bssid_u64 & mask) + mbssid_index) & mask;
64587ece9c37SSara Sharon 
64595d4071abSJohannes Berg 	u64_to_ether_addr(new_bssid_u64, new_bssid);
64607ece9c37SSara Sharon }
64617ece9c37SSara Sharon 
64627ece9c37SSara Sharon /**
6463f7dacfb1SSara Sharon  * cfg80211_is_element_inherited - returns if element ID should be inherited
6464f7dacfb1SSara Sharon  * @element: element to check
6465f7dacfb1SSara Sharon  * @non_inherit_element: non inheritance element
6466f7dacfb1SSara Sharon  */
6467f7dacfb1SSara Sharon bool cfg80211_is_element_inherited(const struct element *element,
6468f7dacfb1SSara Sharon 				   const struct element *non_inherit_element);
6469f7dacfb1SSara Sharon 
6470f7dacfb1SSara Sharon /**
6471fe806e49SSara Sharon  * cfg80211_merge_profile - merges a MBSSID profile if it is split between IEs
6472fe806e49SSara Sharon  * @ie: ies
6473fe806e49SSara Sharon  * @ielen: length of IEs
6474fe806e49SSara Sharon  * @mbssid_elem: current MBSSID element
6475fe806e49SSara Sharon  * @sub_elem: current MBSSID subelement (profile)
6476fe806e49SSara Sharon  * @merged_ie: location of the merged profile
6477fe806e49SSara Sharon  * @max_copy_len: max merged profile length
6478fe806e49SSara Sharon  */
6479fe806e49SSara Sharon size_t cfg80211_merge_profile(const u8 *ie, size_t ielen,
6480fe806e49SSara Sharon 			      const struct element *mbssid_elem,
6481fe806e49SSara Sharon 			      const struct element *sub_elem,
64825809a5d5SDan Carpenter 			      u8 *merged_ie, size_t max_copy_len);
6483fe806e49SSara Sharon 
6484fe806e49SSara Sharon /**
64855bc8c1f2SJohannes Berg  * enum cfg80211_bss_frame_type - frame type that the BSS data came from
64865bc8c1f2SJohannes Berg  * @CFG80211_BSS_FTYPE_UNKNOWN: driver doesn't know whether the data is
64875bc8c1f2SJohannes Berg  *	from a beacon or probe response
64885bc8c1f2SJohannes Berg  * @CFG80211_BSS_FTYPE_BEACON: data comes from a beacon
64895bc8c1f2SJohannes Berg  * @CFG80211_BSS_FTYPE_PRESP: data comes from a probe response
64905bc8c1f2SJohannes Berg  */
64915bc8c1f2SJohannes Berg enum cfg80211_bss_frame_type {
64925bc8c1f2SJohannes Berg 	CFG80211_BSS_FTYPE_UNKNOWN,
64935bc8c1f2SJohannes Berg 	CFG80211_BSS_FTYPE_BEACON,
64945bc8c1f2SJohannes Berg 	CFG80211_BSS_FTYPE_PRESP,
64955bc8c1f2SJohannes Berg };
64965bc8c1f2SJohannes Berg 
64975bc8c1f2SJohannes Berg /**
64987f599aecSAyala Beker  * cfg80211_get_ies_channel_number - returns the channel number from ies
64997f599aecSAyala Beker  * @ie: IEs
65007f599aecSAyala Beker  * @ielen: length of IEs
65017f599aecSAyala Beker  * @band: enum nl80211_band of the channel
65027f599aecSAyala Beker  * @ftype: frame type
65037f599aecSAyala Beker  *
65047f599aecSAyala Beker  * Returns the channel number, or -1 if none could be determined.
65057f599aecSAyala Beker  */
65067f599aecSAyala Beker int cfg80211_get_ies_channel_number(const u8 *ie, size_t ielen,
65077f599aecSAyala Beker 				    enum nl80211_band band,
65087f599aecSAyala Beker 				    enum cfg80211_bss_frame_type ftype);
65097f599aecSAyala Beker 
65107f599aecSAyala Beker /**
65116e19bc4bSDmitry Shmidt  * cfg80211_inform_bss_data - inform cfg80211 of a new BSS
6512abe37c4bSJohannes Berg  *
6513abe37c4bSJohannes Berg  * @wiphy: the wiphy reporting the BSS
65146e19bc4bSDmitry Shmidt  * @data: the BSS metadata
65155bc8c1f2SJohannes Berg  * @ftype: frame type (if known)
6516abe37c4bSJohannes Berg  * @bssid: the BSSID of the BSS
65177b8bcff2SJohannes Berg  * @tsf: the TSF sent by the peer in the beacon/probe response (or 0)
6518abe37c4bSJohannes Berg  * @capability: the capability field sent by the peer
6519abe37c4bSJohannes Berg  * @beacon_interval: the beacon interval announced by the peer
6520abe37c4bSJohannes Berg  * @ie: additional IEs sent by the peer
6521abe37c4bSJohannes Berg  * @ielen: length of the additional IEs
6522abe37c4bSJohannes Berg  * @gfp: context flags
6523abe37c4bSJohannes Berg  *
6524abe37c4bSJohannes Berg  * This informs cfg80211 that BSS information was found and
6525abe37c4bSJohannes Berg  * the BSS should be updated/added.
6526ef100682SJohannes Berg  *
65270ae997dcSYacine Belkadi  * Return: A referenced struct, must be released with cfg80211_put_bss()!
65280ae997dcSYacine Belkadi  * Or %NULL on error.
6529abe37c4bSJohannes Berg  */
6530ef100682SJohannes Berg struct cfg80211_bss * __must_check
65316e19bc4bSDmitry Shmidt cfg80211_inform_bss_data(struct wiphy *wiphy,
65326e19bc4bSDmitry Shmidt 			 struct cfg80211_inform_bss *data,
65336e19bc4bSDmitry Shmidt 			 enum cfg80211_bss_frame_type ftype,
65346e19bc4bSDmitry Shmidt 			 const u8 *bssid, u64 tsf, u16 capability,
65356e19bc4bSDmitry Shmidt 			 u16 beacon_interval, const u8 *ie, size_t ielen,
65366e19bc4bSDmitry Shmidt 			 gfp_t gfp);
65376e19bc4bSDmitry Shmidt 
65386e19bc4bSDmitry Shmidt static inline struct cfg80211_bss * __must_check
6539dcd6eac1SSimon Wunderlich cfg80211_inform_bss_width(struct wiphy *wiphy,
65403afc2167SEmmanuel Grumbach 			  struct ieee80211_channel *rx_channel,
6541dcd6eac1SSimon Wunderlich 			  enum nl80211_bss_scan_width scan_width,
65425bc8c1f2SJohannes Berg 			  enum cfg80211_bss_frame_type ftype,
6543dcd6eac1SSimon Wunderlich 			  const u8 *bssid, u64 tsf, u16 capability,
6544dcd6eac1SSimon Wunderlich 			  u16 beacon_interval, const u8 *ie, size_t ielen,
65456e19bc4bSDmitry Shmidt 			  s32 signal, gfp_t gfp)
65466e19bc4bSDmitry Shmidt {
65476e19bc4bSDmitry Shmidt 	struct cfg80211_inform_bss data = {
65486e19bc4bSDmitry Shmidt 		.chan = rx_channel,
65496e19bc4bSDmitry Shmidt 		.scan_width = scan_width,
65506e19bc4bSDmitry Shmidt 		.signal = signal,
65516e19bc4bSDmitry Shmidt 	};
65526e19bc4bSDmitry Shmidt 
65536e19bc4bSDmitry Shmidt 	return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf,
65546e19bc4bSDmitry Shmidt 					capability, beacon_interval, ie, ielen,
65556e19bc4bSDmitry Shmidt 					gfp);
65566e19bc4bSDmitry Shmidt }
6557dcd6eac1SSimon Wunderlich 
6558dcd6eac1SSimon Wunderlich static inline struct cfg80211_bss * __must_check
655906aa7afaSJussi Kivilinna cfg80211_inform_bss(struct wiphy *wiphy,
65603afc2167SEmmanuel Grumbach 		    struct ieee80211_channel *rx_channel,
65615bc8c1f2SJohannes Berg 		    enum cfg80211_bss_frame_type ftype,
65627b8bcff2SJohannes Berg 		    const u8 *bssid, u64 tsf, u16 capability,
65637b8bcff2SJohannes Berg 		    u16 beacon_interval, const u8 *ie, size_t ielen,
6564dcd6eac1SSimon Wunderlich 		    s32 signal, gfp_t gfp)
6565dcd6eac1SSimon Wunderlich {
65666e19bc4bSDmitry Shmidt 	struct cfg80211_inform_bss data = {
65676e19bc4bSDmitry Shmidt 		.chan = rx_channel,
65686e19bc4bSDmitry Shmidt 		.scan_width = NL80211_BSS_CHAN_WIDTH_20,
65696e19bc4bSDmitry Shmidt 		.signal = signal,
65706e19bc4bSDmitry Shmidt 	};
65716e19bc4bSDmitry Shmidt 
65726e19bc4bSDmitry Shmidt 	return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf,
65736e19bc4bSDmitry Shmidt 					capability, beacon_interval, ie, ielen,
6574dcd6eac1SSimon Wunderlich 					gfp);
6575dcd6eac1SSimon Wunderlich }
657606aa7afaSJussi Kivilinna 
657727548677SJohannes Berg /**
657827548677SJohannes Berg  * cfg80211_get_bss - get a BSS reference
657927548677SJohannes Berg  * @wiphy: the wiphy this BSS struct belongs to
658027548677SJohannes Berg  * @channel: the channel to search on (or %NULL)
658127548677SJohannes Berg  * @bssid: the desired BSSID (or %NULL)
658227548677SJohannes Berg  * @ssid: the desired SSID (or %NULL)
658327548677SJohannes Berg  * @ssid_len: length of the SSID (or 0)
658427548677SJohannes Berg  * @bss_type: type of BSS, see &enum ieee80211_bss_type
658527548677SJohannes Berg  * @privacy: privacy filter, see &enum ieee80211_privacy
658627548677SJohannes Berg  */
65872a519311SJohannes Berg struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
65882a519311SJohannes Berg 				      struct ieee80211_channel *channel,
65892a519311SJohannes Berg 				      const u8 *bssid,
659079420f09SJohannes Berg 				      const u8 *ssid, size_t ssid_len,
65916eb18137SDedy Lansky 				      enum ieee80211_bss_type bss_type,
659227548677SJohannes Berg 				      enum ieee80211_privacy privacy);
659379420f09SJohannes Berg static inline struct cfg80211_bss *
659479420f09SJohannes Berg cfg80211_get_ibss(struct wiphy *wiphy,
659579420f09SJohannes Berg 		  struct ieee80211_channel *channel,
659679420f09SJohannes Berg 		  const u8 *ssid, size_t ssid_len)
659779420f09SJohannes Berg {
659879420f09SJohannes Berg 	return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len,
65996eb18137SDedy Lansky 				IEEE80211_BSS_TYPE_IBSS,
66006eb18137SDedy Lansky 				IEEE80211_PRIVACY_ANY);
660179420f09SJohannes Berg }
660279420f09SJohannes Berg 
66034c0c0b75SJohannes Berg /**
66044c0c0b75SJohannes Berg  * cfg80211_ref_bss - reference BSS struct
66055b112d3dSJohannes Berg  * @wiphy: the wiphy this BSS struct belongs to
66064c0c0b75SJohannes Berg  * @bss: the BSS struct to reference
66074c0c0b75SJohannes Berg  *
66084c0c0b75SJohannes Berg  * Increments the refcount of the given BSS struct.
66094c0c0b75SJohannes Berg  */
66105b112d3dSJohannes Berg void cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
66114c0c0b75SJohannes Berg 
66124c0c0b75SJohannes Berg /**
66134c0c0b75SJohannes Berg  * cfg80211_put_bss - unref BSS struct
66145b112d3dSJohannes Berg  * @wiphy: the wiphy this BSS struct belongs to
66154c0c0b75SJohannes Berg  * @bss: the BSS struct
66164c0c0b75SJohannes Berg  *
66174c0c0b75SJohannes Berg  * Decrements the refcount of the given BSS struct.
66184c0c0b75SJohannes Berg  */
66195b112d3dSJohannes Berg void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
6620d3236553SJohannes Berg 
6621d491af19SJohannes Berg /**
6622d491af19SJohannes Berg  * cfg80211_unlink_bss - unlink BSS from internal data structures
6623d491af19SJohannes Berg  * @wiphy: the wiphy
6624d491af19SJohannes Berg  * @bss: the bss to remove
6625d491af19SJohannes Berg  *
6626d491af19SJohannes Berg  * This function removes the given BSS from the internal data structures
6627d491af19SJohannes Berg  * thereby making it no longer show up in scan results etc. Use this
6628d491af19SJohannes Berg  * function when you detect a BSS is gone. Normally BSSes will also time
6629d491af19SJohannes Berg  * out, so it is not necessary to use this function at all.
6630d491af19SJohannes Berg  */
6631d491af19SJohannes Berg void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
6632fee52678SJohannes Berg 
66334770c8f9SIlan Peer /**
66344770c8f9SIlan Peer  * cfg80211_bss_iter - iterate all BSS entries
66354770c8f9SIlan Peer  *
66364770c8f9SIlan Peer  * This function iterates over the BSS entries associated with the given wiphy
66374770c8f9SIlan Peer  * and calls the callback for the iterated BSS. The iterator function is not
66384770c8f9SIlan Peer  * allowed to call functions that might modify the internal state of the BSS DB.
66394770c8f9SIlan Peer  *
66404770c8f9SIlan Peer  * @wiphy: the wiphy
66414770c8f9SIlan Peer  * @chandef: if given, the iterator function will be called only if the channel
66424770c8f9SIlan Peer  *     of the currently iterated BSS is a subset of the given channel.
66434770c8f9SIlan Peer  * @iter: the iterator function to call
66444770c8f9SIlan Peer  * @iter_data: an argument to the iterator function
66454770c8f9SIlan Peer  */
66464770c8f9SIlan Peer void cfg80211_bss_iter(struct wiphy *wiphy,
66474770c8f9SIlan Peer 		       struct cfg80211_chan_def *chandef,
66484770c8f9SIlan Peer 		       void (*iter)(struct wiphy *wiphy,
66494770c8f9SIlan Peer 				    struct cfg80211_bss *bss,
66504770c8f9SIlan Peer 				    void *data),
66514770c8f9SIlan Peer 		       void *iter_data);
66524770c8f9SIlan Peer 
6653dcd6eac1SSimon Wunderlich static inline enum nl80211_bss_scan_width
6654dcd6eac1SSimon Wunderlich cfg80211_chandef_to_scan_width(const struct cfg80211_chan_def *chandef)
6655dcd6eac1SSimon Wunderlich {
6656dcd6eac1SSimon Wunderlich 	switch (chandef->width) {
6657dcd6eac1SSimon Wunderlich 	case NL80211_CHAN_WIDTH_5:
6658dcd6eac1SSimon Wunderlich 		return NL80211_BSS_CHAN_WIDTH_5;
6659dcd6eac1SSimon Wunderlich 	case NL80211_CHAN_WIDTH_10:
6660dcd6eac1SSimon Wunderlich 		return NL80211_BSS_CHAN_WIDTH_10;
6661dcd6eac1SSimon Wunderlich 	default:
6662dcd6eac1SSimon Wunderlich 		return NL80211_BSS_CHAN_WIDTH_20;
6663dcd6eac1SSimon Wunderlich 	}
6664dcd6eac1SSimon Wunderlich }
6665dcd6eac1SSimon Wunderlich 
66666039f6d2SJouni Malinen /**
66676ff57cf8SJohannes Berg  * cfg80211_rx_mlme_mgmt - notification of processed MLME management frame
66686039f6d2SJouni Malinen  * @dev: network device
66696039f6d2SJouni Malinen  * @buf: authentication frame (header + body)
66706039f6d2SJouni Malinen  * @len: length of the frame data
66716039f6d2SJouni Malinen  *
66726ff57cf8SJohannes Berg  * This function is called whenever an authentication, disassociation or
66736ff57cf8SJohannes Berg  * deauthentication frame has been received and processed in station mode.
66746ff57cf8SJohannes Berg  * After being asked to authenticate via cfg80211_ops::auth() the driver must
66756ff57cf8SJohannes Berg  * call either this function or cfg80211_auth_timeout().
66766ff57cf8SJohannes Berg  * After being asked to associate via cfg80211_ops::assoc() the driver must
66776ff57cf8SJohannes Berg  * call either this function or cfg80211_auth_timeout().
66786ff57cf8SJohannes Berg  * While connected, the driver must calls this for received and processed
66796ff57cf8SJohannes Berg  * disassociation and deauthentication frames. If the frame couldn't be used
66806ff57cf8SJohannes Berg  * because it was unprotected, the driver must call the function
66816ff57cf8SJohannes Berg  * cfg80211_rx_unprot_mlme_mgmt() instead.
66826ff57cf8SJohannes Berg  *
66836ff57cf8SJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's mutex.
66846039f6d2SJouni Malinen  */
66856ff57cf8SJohannes Berg void cfg80211_rx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len);
66866039f6d2SJouni Malinen 
66876039f6d2SJouni Malinen /**
66886ff57cf8SJohannes Berg  * cfg80211_auth_timeout - notification of timed out authentication
66891965c853SJouni Malinen  * @dev: network device
66901965c853SJouni Malinen  * @addr: The MAC address of the device with which the authentication timed out
6691cb0b4bebSJohannes Berg  *
66928d61ffa5SJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's
66938d61ffa5SJohannes Berg  * mutex.
66941965c853SJouni Malinen  */
66956ff57cf8SJohannes Berg void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr);
66961965c853SJouni Malinen 
66971965c853SJouni Malinen /**
66986ff57cf8SJohannes Berg  * cfg80211_rx_assoc_resp - notification of processed association response
66996039f6d2SJouni Malinen  * @dev: network device
67006ff57cf8SJohannes Berg  * @bss: the BSS that association was requested with, ownership of the pointer
67016ff57cf8SJohannes Berg  *	moves to cfg80211 in this call
67024d9ec73dSJouni Malinen  * @buf: (Re)Association Response frame (header + body)
67036039f6d2SJouni Malinen  * @len: length of the frame data
6704f438ceb8SEmmanuel Grumbach  * @uapsd_queues: bitmap of queues configured for uapsd. Same format
6705f438ceb8SEmmanuel Grumbach  *	as the AC bitmap in the QoS info field
67064d9ec73dSJouni Malinen  * @req_ies: information elements from the (Re)Association Request frame
67074d9ec73dSJouni Malinen  * @req_ies_len: length of req_ies data
67086039f6d2SJouni Malinen  *
67096ff57cf8SJohannes Berg  * After being asked to associate via cfg80211_ops::assoc() the driver must
67106ff57cf8SJohannes Berg  * call either this function or cfg80211_auth_timeout().
67116ff57cf8SJohannes Berg  *
67126ff57cf8SJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's mutex.
67136039f6d2SJouni Malinen  */
67146ff57cf8SJohannes Berg void cfg80211_rx_assoc_resp(struct net_device *dev,
67156ff57cf8SJohannes Berg 			    struct cfg80211_bss *bss,
6716b0b6aa2cSEliad Peller 			    const u8 *buf, size_t len,
67174d9ec73dSJouni Malinen 			    int uapsd_queues,
67184d9ec73dSJouni Malinen 			    const u8 *req_ies, size_t req_ies_len);
67196039f6d2SJouni Malinen 
67206039f6d2SJouni Malinen /**
67216ff57cf8SJohannes Berg  * cfg80211_assoc_timeout - notification of timed out association
67221965c853SJouni Malinen  * @dev: network device
6723959867faSJohannes Berg  * @bss: The BSS entry with which association timed out.
6724cb0b4bebSJohannes Berg  *
67258d61ffa5SJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's mutex.
67261965c853SJouni Malinen  */
6727959867faSJohannes Berg void cfg80211_assoc_timeout(struct net_device *dev, struct cfg80211_bss *bss);
67281965c853SJouni Malinen 
67291965c853SJouni Malinen /**
6730e6f462dfSJohannes Berg  * cfg80211_abandon_assoc - notify cfg80211 of abandoned association attempt
6731e6f462dfSJohannes Berg  * @dev: network device
6732e6f462dfSJohannes Berg  * @bss: The BSS entry with which association was abandoned.
6733e6f462dfSJohannes Berg  *
6734e6f462dfSJohannes Berg  * Call this whenever - for reasons reported through other API, like deauth RX,
6735e6f462dfSJohannes Berg  * an association attempt was abandoned.
6736e6f462dfSJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's mutex.
6737e6f462dfSJohannes Berg  */
6738e6f462dfSJohannes Berg void cfg80211_abandon_assoc(struct net_device *dev, struct cfg80211_bss *bss);
6739e6f462dfSJohannes Berg 
6740e6f462dfSJohannes Berg /**
67416ff57cf8SJohannes Berg  * cfg80211_tx_mlme_mgmt - notification of transmitted deauth/disassoc frame
67426039f6d2SJouni Malinen  * @dev: network device
67436ff57cf8SJohannes Berg  * @buf: 802.11 frame (header + body)
67446039f6d2SJouni Malinen  * @len: length of the frame data
67453bb02143SJohannes Berg  * @reconnect: immediate reconnect is desired (include the nl80211 attribute)
67466039f6d2SJouni Malinen  *
67476039f6d2SJouni Malinen  * This function is called whenever deauthentication has been processed in
674853b46b84SJouni Malinen  * station mode. This includes both received deauthentication frames and
67498d61ffa5SJohannes Berg  * locally generated ones. This function may sleep. The caller must hold the
67508d61ffa5SJohannes Berg  * corresponding wdev's mutex.
67516039f6d2SJouni Malinen  */
67523bb02143SJohannes Berg void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len,
67533bb02143SJohannes Berg 			   bool reconnect);
6754ce470613SHolger Schurig 
6755ce470613SHolger Schurig /**
67566ff57cf8SJohannes Berg  * cfg80211_rx_unprot_mlme_mgmt - notification of unprotected mlme mgmt frame
6757cf4e594eSJouni Malinen  * @dev: network device
67584d797fceSJouni Malinen  * @buf: received management frame (header + body)
6759cf4e594eSJouni Malinen  * @len: length of the frame data
6760cf4e594eSJouni Malinen  *
67616ff57cf8SJohannes Berg  * This function is called whenever a received deauthentication or dissassoc
67626ff57cf8SJohannes Berg  * frame has been dropped in station mode because of MFP being used but the
67634d797fceSJouni Malinen  * frame was not protected. This is also used to notify reception of a Beacon
67644d797fceSJouni Malinen  * frame that was dropped because it did not include a valid MME MIC while
67654d797fceSJouni Malinen  * beacon protection was enabled (BIGTK configured in station mode).
67664d797fceSJouni Malinen  *
67674d797fceSJouni Malinen  * This function may sleep.
6768cf4e594eSJouni Malinen  */
67696ff57cf8SJohannes Berg void cfg80211_rx_unprot_mlme_mgmt(struct net_device *dev,
67706ff57cf8SJohannes Berg 				  const u8 *buf, size_t len);
6771cf4e594eSJouni Malinen 
6772cf4e594eSJouni Malinen /**
6773a3b8b056SJouni Malinen  * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP)
6774a3b8b056SJouni Malinen  * @dev: network device
6775a3b8b056SJouni Malinen  * @addr: The source MAC address of the frame
6776a3b8b056SJouni Malinen  * @key_type: The key type that the received frame used
6777a66b98dbSArik Nemtsov  * @key_id: Key identifier (0..3). Can be -1 if missing.
6778a3b8b056SJouni Malinen  * @tsc: The TSC value of the frame that generated the MIC failure (6 octets)
6779e6d6e342SJohannes Berg  * @gfp: allocation flags
6780a3b8b056SJouni Malinen  *
6781a3b8b056SJouni Malinen  * This function is called whenever the local MAC detects a MIC failure in a
6782a3b8b056SJouni Malinen  * received frame. This matches with MLME-MICHAELMICFAILURE.indication()
6783a3b8b056SJouni Malinen  * primitive.
6784a3b8b056SJouni Malinen  */
6785a3b8b056SJouni Malinen void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,
6786a3b8b056SJouni Malinen 				  enum nl80211_key_type key_type, int key_id,
6787e6d6e342SJohannes Berg 				  const u8 *tsc, gfp_t gfp);
6788a3b8b056SJouni Malinen 
678904a773adSJohannes Berg /**
679004a773adSJohannes Berg  * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS
679104a773adSJohannes Berg  *
679204a773adSJohannes Berg  * @dev: network device
679304a773adSJohannes Berg  * @bssid: the BSSID of the IBSS joined
6794fe94f3a4SAntonio Quartulli  * @channel: the channel of the IBSS joined
679504a773adSJohannes Berg  * @gfp: allocation flags
679604a773adSJohannes Berg  *
679704a773adSJohannes Berg  * This function notifies cfg80211 that the device joined an IBSS or
679804a773adSJohannes Berg  * switched to a different BSSID. Before this function can be called,
679904a773adSJohannes Berg  * either a beacon has to have been received from the IBSS, or one of
680004a773adSJohannes Berg  * the cfg80211_inform_bss{,_frame} functions must have been called
680104a773adSJohannes Berg  * with the locally generated beacon -- this guarantees that there is
680204a773adSJohannes Berg  * always a scan result for this IBSS. cfg80211 will handle the rest.
680304a773adSJohannes Berg  */
6804fe94f3a4SAntonio Quartulli void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid,
6805fe94f3a4SAntonio Quartulli 			  struct ieee80211_channel *channel, gfp_t gfp);
680604a773adSJohannes Berg 
68071f87f7d3SJohannes Berg /**
6808b1e8eb11SMauro Carvalho Chehab  * cfg80211_notify_new_peer_candidate - notify cfg80211 of a new mesh peer
6809b1e8eb11SMauro Carvalho Chehab  * 					candidate
6810c93b5e71SJavier Cardona  *
6811c93b5e71SJavier Cardona  * @dev: network device
6812c93b5e71SJavier Cardona  * @macaddr: the MAC address of the new candidate
6813c93b5e71SJavier Cardona  * @ie: information elements advertised by the peer candidate
68145ac4a12dSMatteo Croce  * @ie_len: length of the information elements buffer
6815c93b5e71SJavier Cardona  * @gfp: allocation flags
6816c93b5e71SJavier Cardona  *
6817c93b5e71SJavier Cardona  * This function notifies cfg80211 that the mesh peer candidate has been
6818c93b5e71SJavier Cardona  * detected, most likely via a beacon or, less likely, via a probe response.
6819c93b5e71SJavier Cardona  * cfg80211 then sends a notification to userspace.
6820c93b5e71SJavier Cardona  */
6821c93b5e71SJavier Cardona void cfg80211_notify_new_peer_candidate(struct net_device *dev,
6822ecbc12adSBob Copeland 		const u8 *macaddr, const u8 *ie, u8 ie_len,
6823ecbc12adSBob Copeland 		int sig_dbm, gfp_t gfp);
6824c93b5e71SJavier Cardona 
6825c93b5e71SJavier Cardona /**
6826d70e9693SJohannes Berg  * DOC: RFkill integration
6827d70e9693SJohannes Berg  *
6828d70e9693SJohannes Berg  * RFkill integration in cfg80211 is almost invisible to drivers,
6829d70e9693SJohannes Berg  * as cfg80211 automatically registers an rfkill instance for each
6830d70e9693SJohannes Berg  * wireless device it knows about. Soft kill is also translated
6831d70e9693SJohannes Berg  * into disconnecting and turning all interfaces off, drivers are
6832d70e9693SJohannes Berg  * expected to turn off the device when all interfaces are down.
6833d70e9693SJohannes Berg  *
6834d70e9693SJohannes Berg  * However, devices may have a hard RFkill line, in which case they
6835d70e9693SJohannes Berg  * also need to interact with the rfkill subsystem, via cfg80211.
6836d70e9693SJohannes Berg  * They can do this with a few helper functions documented here.
6837d70e9693SJohannes Berg  */
6838d70e9693SJohannes Berg 
6839d70e9693SJohannes Berg /**
6840810344edSEmmanuel Grumbach  * wiphy_rfkill_set_hw_state_reason - notify cfg80211 about hw block state
68411f87f7d3SJohannes Berg  * @wiphy: the wiphy
68421f87f7d3SJohannes Berg  * @blocked: block status
68436f779a66SEmmanuel Grumbach  * @reason: one of reasons in &enum rfkill_hard_block_reasons
68441f87f7d3SJohannes Berg  */
68456f779a66SEmmanuel Grumbach void wiphy_rfkill_set_hw_state_reason(struct wiphy *wiphy, bool blocked,
68466f779a66SEmmanuel Grumbach 				      enum rfkill_hard_block_reasons reason);
68476f779a66SEmmanuel Grumbach 
68486f779a66SEmmanuel Grumbach static inline void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked)
68496f779a66SEmmanuel Grumbach {
68506f779a66SEmmanuel Grumbach 	wiphy_rfkill_set_hw_state_reason(wiphy, blocked,
68516f779a66SEmmanuel Grumbach 					 RFKILL_HARD_BLOCK_SIGNAL);
68526f779a66SEmmanuel Grumbach }
68531f87f7d3SJohannes Berg 
68541f87f7d3SJohannes Berg /**
68551f87f7d3SJohannes Berg  * wiphy_rfkill_start_polling - start polling rfkill
68561f87f7d3SJohannes Berg  * @wiphy: the wiphy
68571f87f7d3SJohannes Berg  */
68581f87f7d3SJohannes Berg void wiphy_rfkill_start_polling(struct wiphy *wiphy);
68591f87f7d3SJohannes Berg 
68601f87f7d3SJohannes Berg /**
68611f87f7d3SJohannes Berg  * wiphy_rfkill_stop_polling - stop polling rfkill
68621f87f7d3SJohannes Berg  * @wiphy: the wiphy
68631f87f7d3SJohannes Berg  */
6864358ae888SEmmanuel Grumbach static inline void wiphy_rfkill_stop_polling(struct wiphy *wiphy)
6865358ae888SEmmanuel Grumbach {
6866358ae888SEmmanuel Grumbach 	rfkill_pause_polling(wiphy->rfkill);
6867358ae888SEmmanuel Grumbach }
68681f87f7d3SJohannes Berg 
6869ad7e718cSJohannes Berg /**
6870ad7e718cSJohannes Berg  * DOC: Vendor commands
6871ad7e718cSJohannes Berg  *
6872ad7e718cSJohannes Berg  * Occasionally, there are special protocol or firmware features that
6873ad7e718cSJohannes Berg  * can't be implemented very openly. For this and similar cases, the
6874ad7e718cSJohannes Berg  * vendor command functionality allows implementing the features with
6875ad7e718cSJohannes Berg  * (typically closed-source) userspace and firmware, using nl80211 as
6876ad7e718cSJohannes Berg  * the configuration mechanism.
6877ad7e718cSJohannes Berg  *
6878ad7e718cSJohannes Berg  * A driver supporting vendor commands must register them as an array
6879ad7e718cSJohannes Berg  * in struct wiphy, with handlers for each one, each command has an
6880ad7e718cSJohannes Berg  * OUI and sub command ID to identify it.
6881ad7e718cSJohannes Berg  *
6882ad7e718cSJohannes Berg  * Note that this feature should not be (ab)used to implement protocol
6883ad7e718cSJohannes Berg  * features that could openly be shared across drivers. In particular,
6884ad7e718cSJohannes Berg  * it must never be required to use vendor commands to implement any
6885ad7e718cSJohannes Berg  * "normal" functionality that higher-level userspace like connection
6886ad7e718cSJohannes Berg  * managers etc. need.
6887ad7e718cSJohannes Berg  */
6888ad7e718cSJohannes Berg 
6889ad7e718cSJohannes Berg struct sk_buff *__cfg80211_alloc_reply_skb(struct wiphy *wiphy,
6890ad7e718cSJohannes Berg 					   enum nl80211_commands cmd,
6891ad7e718cSJohannes Berg 					   enum nl80211_attrs attr,
6892ad7e718cSJohannes Berg 					   int approxlen);
6893ad7e718cSJohannes Berg 
6894567ffc35SJohannes Berg struct sk_buff *__cfg80211_alloc_event_skb(struct wiphy *wiphy,
68956c09e791SAhmad Kholaif 					   struct wireless_dev *wdev,
6896567ffc35SJohannes Berg 					   enum nl80211_commands cmd,
6897567ffc35SJohannes Berg 					   enum nl80211_attrs attr,
689855c1fdf0SJohannes Berg 					   unsigned int portid,
6899567ffc35SJohannes Berg 					   int vendor_event_idx,
6900567ffc35SJohannes Berg 					   int approxlen, gfp_t gfp);
6901567ffc35SJohannes Berg 
6902567ffc35SJohannes Berg void __cfg80211_send_event_skb(struct sk_buff *skb, gfp_t gfp);
6903567ffc35SJohannes Berg 
6904ad7e718cSJohannes Berg /**
6905ad7e718cSJohannes Berg  * cfg80211_vendor_cmd_alloc_reply_skb - allocate vendor command reply
6906ad7e718cSJohannes Berg  * @wiphy: the wiphy
6907ad7e718cSJohannes Berg  * @approxlen: an upper bound of the length of the data that will
6908ad7e718cSJohannes Berg  *	be put into the skb
6909ad7e718cSJohannes Berg  *
6910ad7e718cSJohannes Berg  * This function allocates and pre-fills an skb for a reply to
6911ad7e718cSJohannes Berg  * a vendor command. Since it is intended for a reply, calling
6912ad7e718cSJohannes Berg  * it outside of a vendor command's doit() operation is invalid.
6913ad7e718cSJohannes Berg  *
6914ad7e718cSJohannes Berg  * The returned skb is pre-filled with some identifying data in
6915ad7e718cSJohannes Berg  * a way that any data that is put into the skb (with skb_put(),
6916ad7e718cSJohannes Berg  * nla_put() or similar) will end up being within the
6917ad7e718cSJohannes Berg  * %NL80211_ATTR_VENDOR_DATA attribute, so all that needs to be done
6918ad7e718cSJohannes Berg  * with the skb is adding data for the corresponding userspace tool
6919ad7e718cSJohannes Berg  * which can then read that data out of the vendor data attribute.
6920ad7e718cSJohannes Berg  * You must not modify the skb in any other way.
6921ad7e718cSJohannes Berg  *
6922ad7e718cSJohannes Berg  * When done, call cfg80211_vendor_cmd_reply() with the skb and return
6923ad7e718cSJohannes Berg  * its error code as the result of the doit() operation.
6924ad7e718cSJohannes Berg  *
6925ad7e718cSJohannes Berg  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
6926ad7e718cSJohannes Berg  */
6927ad7e718cSJohannes Berg static inline struct sk_buff *
6928ad7e718cSJohannes Berg cfg80211_vendor_cmd_alloc_reply_skb(struct wiphy *wiphy, int approxlen)
6929ad7e718cSJohannes Berg {
6930ad7e718cSJohannes Berg 	return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_VENDOR,
6931ad7e718cSJohannes Berg 					  NL80211_ATTR_VENDOR_DATA, approxlen);
6932ad7e718cSJohannes Berg }
6933ad7e718cSJohannes Berg 
6934ad7e718cSJohannes Berg /**
6935ad7e718cSJohannes Berg  * cfg80211_vendor_cmd_reply - send the reply skb
6936ad7e718cSJohannes Berg  * @skb: The skb, must have been allocated with
6937ad7e718cSJohannes Berg  *	cfg80211_vendor_cmd_alloc_reply_skb()
6938ad7e718cSJohannes Berg  *
6939ad7e718cSJohannes Berg  * Since calling this function will usually be the last thing
6940ad7e718cSJohannes Berg  * before returning from the vendor command doit() you should
6941ad7e718cSJohannes Berg  * return the error code.  Note that this function consumes the
6942ad7e718cSJohannes Berg  * skb regardless of the return value.
6943ad7e718cSJohannes Berg  *
6944ad7e718cSJohannes Berg  * Return: An error code or 0 on success.
6945ad7e718cSJohannes Berg  */
6946ad7e718cSJohannes Berg int cfg80211_vendor_cmd_reply(struct sk_buff *skb);
6947ad7e718cSJohannes Berg 
6948567ffc35SJohannes Berg /**
69495d9c358dSRandy Dunlap  * cfg80211_vendor_cmd_get_sender - get the current sender netlink ID
695055c1fdf0SJohannes Berg  * @wiphy: the wiphy
695155c1fdf0SJohannes Berg  *
695255c1fdf0SJohannes Berg  * Return the current netlink port ID in a vendor command handler.
695355c1fdf0SJohannes Berg  * Valid to call only there.
695455c1fdf0SJohannes Berg  */
695555c1fdf0SJohannes Berg unsigned int cfg80211_vendor_cmd_get_sender(struct wiphy *wiphy);
695655c1fdf0SJohannes Berg 
695755c1fdf0SJohannes Berg /**
6958567ffc35SJohannes Berg  * cfg80211_vendor_event_alloc - allocate vendor-specific event skb
6959567ffc35SJohannes Berg  * @wiphy: the wiphy
69606c09e791SAhmad Kholaif  * @wdev: the wireless device
6961567ffc35SJohannes Berg  * @event_idx: index of the vendor event in the wiphy's vendor_events
6962567ffc35SJohannes Berg  * @approxlen: an upper bound of the length of the data that will
6963567ffc35SJohannes Berg  *	be put into the skb
6964567ffc35SJohannes Berg  * @gfp: allocation flags
6965567ffc35SJohannes Berg  *
6966567ffc35SJohannes Berg  * This function allocates and pre-fills an skb for an event on the
6967567ffc35SJohannes Berg  * vendor-specific multicast group.
6968567ffc35SJohannes Berg  *
69696c09e791SAhmad Kholaif  * If wdev != NULL, both the ifindex and identifier of the specified
69706c09e791SAhmad Kholaif  * wireless device are added to the event message before the vendor data
69716c09e791SAhmad Kholaif  * attribute.
69726c09e791SAhmad Kholaif  *
6973567ffc35SJohannes Berg  * When done filling the skb, call cfg80211_vendor_event() with the
6974567ffc35SJohannes Berg  * skb to send the event.
6975567ffc35SJohannes Berg  *
6976567ffc35SJohannes Berg  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
6977567ffc35SJohannes Berg  */
6978567ffc35SJohannes Berg static inline struct sk_buff *
69796c09e791SAhmad Kholaif cfg80211_vendor_event_alloc(struct wiphy *wiphy, struct wireless_dev *wdev,
69806c09e791SAhmad Kholaif 			     int approxlen, int event_idx, gfp_t gfp)
6981567ffc35SJohannes Berg {
69826c09e791SAhmad Kholaif 	return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR,
6983567ffc35SJohannes Berg 					  NL80211_ATTR_VENDOR_DATA,
698455c1fdf0SJohannes Berg 					  0, event_idx, approxlen, gfp);
698555c1fdf0SJohannes Berg }
698655c1fdf0SJohannes Berg 
698755c1fdf0SJohannes Berg /**
698855c1fdf0SJohannes Berg  * cfg80211_vendor_event_alloc_ucast - alloc unicast vendor-specific event skb
698955c1fdf0SJohannes Berg  * @wiphy: the wiphy
699055c1fdf0SJohannes Berg  * @wdev: the wireless device
699155c1fdf0SJohannes Berg  * @event_idx: index of the vendor event in the wiphy's vendor_events
699255c1fdf0SJohannes Berg  * @portid: port ID of the receiver
699355c1fdf0SJohannes Berg  * @approxlen: an upper bound of the length of the data that will
699455c1fdf0SJohannes Berg  *	be put into the skb
699555c1fdf0SJohannes Berg  * @gfp: allocation flags
699655c1fdf0SJohannes Berg  *
699755c1fdf0SJohannes Berg  * This function allocates and pre-fills an skb for an event to send to
699855c1fdf0SJohannes Berg  * a specific (userland) socket. This socket would previously have been
699955c1fdf0SJohannes Berg  * obtained by cfg80211_vendor_cmd_get_sender(), and the caller MUST take
700055c1fdf0SJohannes Berg  * care to register a netlink notifier to see when the socket closes.
700155c1fdf0SJohannes Berg  *
700255c1fdf0SJohannes Berg  * If wdev != NULL, both the ifindex and identifier of the specified
700355c1fdf0SJohannes Berg  * wireless device are added to the event message before the vendor data
700455c1fdf0SJohannes Berg  * attribute.
700555c1fdf0SJohannes Berg  *
700655c1fdf0SJohannes Berg  * When done filling the skb, call cfg80211_vendor_event() with the
700755c1fdf0SJohannes Berg  * skb to send the event.
700855c1fdf0SJohannes Berg  *
700955c1fdf0SJohannes Berg  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
701055c1fdf0SJohannes Berg  */
701155c1fdf0SJohannes Berg static inline struct sk_buff *
701255c1fdf0SJohannes Berg cfg80211_vendor_event_alloc_ucast(struct wiphy *wiphy,
701355c1fdf0SJohannes Berg 				  struct wireless_dev *wdev,
701455c1fdf0SJohannes Berg 				  unsigned int portid, int approxlen,
701555c1fdf0SJohannes Berg 				  int event_idx, gfp_t gfp)
701655c1fdf0SJohannes Berg {
701755c1fdf0SJohannes Berg 	return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR,
701855c1fdf0SJohannes Berg 					  NL80211_ATTR_VENDOR_DATA,
701955c1fdf0SJohannes Berg 					  portid, event_idx, approxlen, gfp);
7020567ffc35SJohannes Berg }
7021567ffc35SJohannes Berg 
7022567ffc35SJohannes Berg /**
7023567ffc35SJohannes Berg  * cfg80211_vendor_event - send the event
7024567ffc35SJohannes Berg  * @skb: The skb, must have been allocated with cfg80211_vendor_event_alloc()
7025567ffc35SJohannes Berg  * @gfp: allocation flags
7026567ffc35SJohannes Berg  *
7027567ffc35SJohannes Berg  * This function sends the given @skb, which must have been allocated
7028567ffc35SJohannes Berg  * by cfg80211_vendor_event_alloc(), as an event. It always consumes it.
7029567ffc35SJohannes Berg  */
7030567ffc35SJohannes Berg static inline void cfg80211_vendor_event(struct sk_buff *skb, gfp_t gfp)
7031567ffc35SJohannes Berg {
7032567ffc35SJohannes Berg 	__cfg80211_send_event_skb(skb, gfp);
7033567ffc35SJohannes Berg }
7034567ffc35SJohannes Berg 
7035aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE
7036aff89a9bSJohannes Berg /**
7037d70e9693SJohannes Berg  * DOC: Test mode
7038d70e9693SJohannes Berg  *
7039d70e9693SJohannes Berg  * Test mode is a set of utility functions to allow drivers to
7040d70e9693SJohannes Berg  * interact with driver-specific tools to aid, for instance,
7041d70e9693SJohannes Berg  * factory programming.
7042d70e9693SJohannes Berg  *
7043d70e9693SJohannes Berg  * This chapter describes how drivers interact with it, for more
7044d70e9693SJohannes Berg  * information see the nl80211 book's chapter on it.
7045d70e9693SJohannes Berg  */
7046d70e9693SJohannes Berg 
7047d70e9693SJohannes Berg /**
7048aff89a9bSJohannes Berg  * cfg80211_testmode_alloc_reply_skb - allocate testmode reply
7049aff89a9bSJohannes Berg  * @wiphy: the wiphy
7050aff89a9bSJohannes Berg  * @approxlen: an upper bound of the length of the data that will
7051aff89a9bSJohannes Berg  *	be put into the skb
7052aff89a9bSJohannes Berg  *
7053aff89a9bSJohannes Berg  * This function allocates and pre-fills an skb for a reply to
7054aff89a9bSJohannes Berg  * the testmode command. Since it is intended for a reply, calling
7055aff89a9bSJohannes Berg  * it outside of the @testmode_cmd operation is invalid.
7056aff89a9bSJohannes Berg  *
70570ae997dcSYacine Belkadi  * The returned skb is pre-filled with the wiphy index and set up in
70580ae997dcSYacine Belkadi  * a way that any data that is put into the skb (with skb_put(),
70590ae997dcSYacine Belkadi  * nla_put() or similar) will end up being within the
70600ae997dcSYacine Belkadi  * %NL80211_ATTR_TESTDATA attribute, so all that needs to be done
70610ae997dcSYacine Belkadi  * with the skb is adding data for the corresponding userspace tool
70620ae997dcSYacine Belkadi  * which can then read that data out of the testdata attribute. You
70630ae997dcSYacine Belkadi  * must not modify the skb in any other way.
7064aff89a9bSJohannes Berg  *
7065aff89a9bSJohannes Berg  * When done, call cfg80211_testmode_reply() with the skb and return
7066aff89a9bSJohannes Berg  * its error code as the result of the @testmode_cmd operation.
70670ae997dcSYacine Belkadi  *
70680ae997dcSYacine Belkadi  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
7069aff89a9bSJohannes Berg  */
7070ad7e718cSJohannes Berg static inline struct sk_buff *
7071ad7e718cSJohannes Berg cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy, int approxlen)
7072ad7e718cSJohannes Berg {
7073ad7e718cSJohannes Berg 	return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_TESTMODE,
7074ad7e718cSJohannes Berg 					  NL80211_ATTR_TESTDATA, approxlen);
7075ad7e718cSJohannes Berg }
7076aff89a9bSJohannes Berg 
7077aff89a9bSJohannes Berg /**
7078aff89a9bSJohannes Berg  * cfg80211_testmode_reply - send the reply skb
7079aff89a9bSJohannes Berg  * @skb: The skb, must have been allocated with
7080aff89a9bSJohannes Berg  *	cfg80211_testmode_alloc_reply_skb()
7081aff89a9bSJohannes Berg  *
70820ae997dcSYacine Belkadi  * Since calling this function will usually be the last thing
70830ae997dcSYacine Belkadi  * before returning from the @testmode_cmd you should return
70840ae997dcSYacine Belkadi  * the error code.  Note that this function consumes the skb
70850ae997dcSYacine Belkadi  * regardless of the return value.
70860ae997dcSYacine Belkadi  *
70870ae997dcSYacine Belkadi  * Return: An error code or 0 on success.
7088aff89a9bSJohannes Berg  */
7089ad7e718cSJohannes Berg static inline int cfg80211_testmode_reply(struct sk_buff *skb)
7090ad7e718cSJohannes Berg {
7091ad7e718cSJohannes Berg 	return cfg80211_vendor_cmd_reply(skb);
7092ad7e718cSJohannes Berg }
7093aff89a9bSJohannes Berg 
7094aff89a9bSJohannes Berg /**
7095aff89a9bSJohannes Berg  * cfg80211_testmode_alloc_event_skb - allocate testmode event
7096aff89a9bSJohannes Berg  * @wiphy: the wiphy
7097aff89a9bSJohannes Berg  * @approxlen: an upper bound of the length of the data that will
7098aff89a9bSJohannes Berg  *	be put into the skb
7099aff89a9bSJohannes Berg  * @gfp: allocation flags
7100aff89a9bSJohannes Berg  *
7101aff89a9bSJohannes Berg  * This function allocates and pre-fills an skb for an event on the
7102aff89a9bSJohannes Berg  * testmode multicast group.
7103aff89a9bSJohannes Berg  *
71040ae997dcSYacine Belkadi  * The returned skb is set up in the same way as with
71050ae997dcSYacine Belkadi  * cfg80211_testmode_alloc_reply_skb() but prepared for an event. As
71060ae997dcSYacine Belkadi  * there, you should simply add data to it that will then end up in the
71070ae997dcSYacine Belkadi  * %NL80211_ATTR_TESTDATA attribute. Again, you must not modify the skb
71080ae997dcSYacine Belkadi  * in any other way.
7109aff89a9bSJohannes Berg  *
7110aff89a9bSJohannes Berg  * When done filling the skb, call cfg80211_testmode_event() with the
7111aff89a9bSJohannes Berg  * skb to send the event.
71120ae997dcSYacine Belkadi  *
71130ae997dcSYacine Belkadi  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
7114aff89a9bSJohannes Berg  */
7115567ffc35SJohannes Berg static inline struct sk_buff *
7116567ffc35SJohannes Berg cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy, int approxlen, gfp_t gfp)
7117567ffc35SJohannes Berg {
71186c09e791SAhmad Kholaif 	return __cfg80211_alloc_event_skb(wiphy, NULL, NL80211_CMD_TESTMODE,
711955c1fdf0SJohannes Berg 					  NL80211_ATTR_TESTDATA, 0, -1,
7120567ffc35SJohannes Berg 					  approxlen, gfp);
7121567ffc35SJohannes Berg }
7122aff89a9bSJohannes Berg 
7123aff89a9bSJohannes Berg /**
7124aff89a9bSJohannes Berg  * cfg80211_testmode_event - send the event
7125aff89a9bSJohannes Berg  * @skb: The skb, must have been allocated with
7126aff89a9bSJohannes Berg  *	cfg80211_testmode_alloc_event_skb()
7127aff89a9bSJohannes Berg  * @gfp: allocation flags
7128aff89a9bSJohannes Berg  *
7129aff89a9bSJohannes Berg  * This function sends the given @skb, which must have been allocated
7130aff89a9bSJohannes Berg  * by cfg80211_testmode_alloc_event_skb(), as an event. It always
7131aff89a9bSJohannes Berg  * consumes it.
7132aff89a9bSJohannes Berg  */
7133567ffc35SJohannes Berg static inline void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp)
7134567ffc35SJohannes Berg {
7135567ffc35SJohannes Berg 	__cfg80211_send_event_skb(skb, gfp);
7136567ffc35SJohannes Berg }
7137aff89a9bSJohannes Berg 
7138aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd)	.testmode_cmd = (cmd),
713971063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd)	.testmode_dump = (cmd),
7140aff89a9bSJohannes Berg #else
7141aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd)
714271063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd)
7143aff89a9bSJohannes Berg #endif
7144aff89a9bSJohannes Berg 
7145b23aa676SSamuel Ortiz /**
714676804d28SArend Van Spriel  * struct cfg80211_fils_resp_params - FILS connection response params
714776804d28SArend Van Spriel  * @kek: KEK derived from a successful FILS connection (may be %NULL)
714876804d28SArend Van Spriel  * @kek_len: Length of @fils_kek in octets
714976804d28SArend Van Spriel  * @update_erp_next_seq_num: Boolean value to specify whether the value in
715076804d28SArend Van Spriel  *	@erp_next_seq_num is valid.
715176804d28SArend Van Spriel  * @erp_next_seq_num: The next sequence number to use in ERP message in
715276804d28SArend Van Spriel  *	FILS Authentication. This value should be specified irrespective of the
715376804d28SArend Van Spriel  *	status for a FILS connection.
715476804d28SArend Van Spriel  * @pmk: A new PMK if derived from a successful FILS connection (may be %NULL).
715576804d28SArend Van Spriel  * @pmk_len: Length of @pmk in octets
715676804d28SArend Van Spriel  * @pmkid: A new PMKID if derived from a successful FILS connection or the PMKID
715776804d28SArend Van Spriel  *	used for this FILS connection (may be %NULL).
715876804d28SArend Van Spriel  */
715976804d28SArend Van Spriel struct cfg80211_fils_resp_params {
716076804d28SArend Van Spriel 	const u8 *kek;
716176804d28SArend Van Spriel 	size_t kek_len;
716276804d28SArend Van Spriel 	bool update_erp_next_seq_num;
716376804d28SArend Van Spriel 	u16 erp_next_seq_num;
716476804d28SArend Van Spriel 	const u8 *pmk;
716576804d28SArend Van Spriel 	size_t pmk_len;
716676804d28SArend Van Spriel 	const u8 *pmkid;
716776804d28SArend Van Spriel };
716876804d28SArend Van Spriel 
716976804d28SArend Van Spriel /**
71705349a0f7SVidyullatha Kanchanapally  * struct cfg80211_connect_resp_params - Connection response params
71715349a0f7SVidyullatha Kanchanapally  * @status: Status code, %WLAN_STATUS_SUCCESS for successful connection, use
71725349a0f7SVidyullatha Kanchanapally  *	%WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
71735349a0f7SVidyullatha Kanchanapally  *	the real status code for failures. If this call is used to report a
71745349a0f7SVidyullatha Kanchanapally  *	failure due to a timeout (e.g., not receiving an Authentication frame
71755349a0f7SVidyullatha Kanchanapally  *	from the AP) instead of an explicit rejection by the AP, -1 is used to
71765349a0f7SVidyullatha Kanchanapally  *	indicate that this is a failure, but without a status code.
71775349a0f7SVidyullatha Kanchanapally  *	@timeout_reason is used to report the reason for the timeout in that
71785349a0f7SVidyullatha Kanchanapally  *	case.
71795349a0f7SVidyullatha Kanchanapally  * @bssid: The BSSID of the AP (may be %NULL)
71805349a0f7SVidyullatha Kanchanapally  * @bss: Entry of bss to which STA got connected to, can be obtained through
7181a3ce17d1SChaitanya Tata  *	cfg80211_get_bss() (may be %NULL). But it is recommended to store the
7182a3ce17d1SChaitanya Tata  *	bss from the connect_request and hold a reference to it and return
7183a3ce17d1SChaitanya Tata  *	through this param to avoid a warning if the bss is expired during the
7184a3ce17d1SChaitanya Tata  *	connection, esp. for those drivers implementing connect op.
7185a3ce17d1SChaitanya Tata  *	Only one parameter among @bssid and @bss needs to be specified.
71865349a0f7SVidyullatha Kanchanapally  * @req_ie: Association request IEs (may be %NULL)
71875349a0f7SVidyullatha Kanchanapally  * @req_ie_len: Association request IEs length
71885349a0f7SVidyullatha Kanchanapally  * @resp_ie: Association response IEs (may be %NULL)
71895349a0f7SVidyullatha Kanchanapally  * @resp_ie_len: Association response IEs length
719076804d28SArend Van Spriel  * @fils: FILS connection response parameters.
71915349a0f7SVidyullatha Kanchanapally  * @timeout_reason: Reason for connection timeout. This is used when the
71925349a0f7SVidyullatha Kanchanapally  *	connection fails due to a timeout instead of an explicit rejection from
71935349a0f7SVidyullatha Kanchanapally  *	the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is
71945349a0f7SVidyullatha Kanchanapally  *	not known. This value is used only if @status < 0 to indicate that the
71955349a0f7SVidyullatha Kanchanapally  *	failure is due to a timeout and not due to explicit rejection by the AP.
71965349a0f7SVidyullatha Kanchanapally  *	This value is ignored in other cases (@status >= 0).
71975349a0f7SVidyullatha Kanchanapally  */
71985349a0f7SVidyullatha Kanchanapally struct cfg80211_connect_resp_params {
71995349a0f7SVidyullatha Kanchanapally 	int status;
72005349a0f7SVidyullatha Kanchanapally 	const u8 *bssid;
72015349a0f7SVidyullatha Kanchanapally 	struct cfg80211_bss *bss;
72025349a0f7SVidyullatha Kanchanapally 	const u8 *req_ie;
72035349a0f7SVidyullatha Kanchanapally 	size_t req_ie_len;
72045349a0f7SVidyullatha Kanchanapally 	const u8 *resp_ie;
72055349a0f7SVidyullatha Kanchanapally 	size_t resp_ie_len;
720676804d28SArend Van Spriel 	struct cfg80211_fils_resp_params fils;
72075349a0f7SVidyullatha Kanchanapally 	enum nl80211_timeout_reason timeout_reason;
72085349a0f7SVidyullatha Kanchanapally };
72095349a0f7SVidyullatha Kanchanapally 
72105349a0f7SVidyullatha Kanchanapally /**
72115349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_done - notify cfg80211 of connection result
72125349a0f7SVidyullatha Kanchanapally  *
72135349a0f7SVidyullatha Kanchanapally  * @dev: network device
72145349a0f7SVidyullatha Kanchanapally  * @params: connection response parameters
72155349a0f7SVidyullatha Kanchanapally  * @gfp: allocation flags
72165349a0f7SVidyullatha Kanchanapally  *
72175349a0f7SVidyullatha Kanchanapally  * It should be called by the underlying driver once execution of the connection
72185349a0f7SVidyullatha Kanchanapally  * request from connect() has been completed. This is similar to
72195349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_bss(), but takes a structure pointer for connection response
72205349a0f7SVidyullatha Kanchanapally  * parameters. Only one of the functions among cfg80211_connect_bss(),
72215349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_result(), cfg80211_connect_timeout(),
72225349a0f7SVidyullatha Kanchanapally  * and cfg80211_connect_done() should be called.
72235349a0f7SVidyullatha Kanchanapally  */
72245349a0f7SVidyullatha Kanchanapally void cfg80211_connect_done(struct net_device *dev,
72255349a0f7SVidyullatha Kanchanapally 			   struct cfg80211_connect_resp_params *params,
72265349a0f7SVidyullatha Kanchanapally 			   gfp_t gfp);
72275349a0f7SVidyullatha Kanchanapally 
72285349a0f7SVidyullatha Kanchanapally /**
7229e7054989SKanchanapally, Vidyullatha  * cfg80211_connect_bss - notify cfg80211 of connection result
7230e7054989SKanchanapally, Vidyullatha  *
7231e7054989SKanchanapally, Vidyullatha  * @dev: network device
7232e7054989SKanchanapally, Vidyullatha  * @bssid: the BSSID of the AP
7233a3ce17d1SChaitanya Tata  * @bss: Entry of bss to which STA got connected to, can be obtained through
7234a3ce17d1SChaitanya Tata  *	cfg80211_get_bss() (may be %NULL). But it is recommended to store the
7235a3ce17d1SChaitanya Tata  *	bss from the connect_request and hold a reference to it and return
7236a3ce17d1SChaitanya Tata  *	through this param to avoid a warning if the bss is expired during the
7237a3ce17d1SChaitanya Tata  *	connection, esp. for those drivers implementing connect op.
7238a3ce17d1SChaitanya Tata  *	Only one parameter among @bssid and @bss needs to be specified.
7239e7054989SKanchanapally, Vidyullatha  * @req_ie: association request IEs (maybe be %NULL)
7240e7054989SKanchanapally, Vidyullatha  * @req_ie_len: association request IEs length
7241e7054989SKanchanapally, Vidyullatha  * @resp_ie: association response IEs (may be %NULL)
7242e7054989SKanchanapally, Vidyullatha  * @resp_ie_len: assoc response IEs length
7243c88215d7SJouni Malinen  * @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use
7244e7054989SKanchanapally, Vidyullatha  *	%WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
7245c88215d7SJouni Malinen  *	the real status code for failures. If this call is used to report a
7246c88215d7SJouni Malinen  *	failure due to a timeout (e.g., not receiving an Authentication frame
7247c88215d7SJouni Malinen  *	from the AP) instead of an explicit rejection by the AP, -1 is used to
7248c88215d7SJouni Malinen  *	indicate that this is a failure, but without a status code.
7249c88215d7SJouni Malinen  *	@timeout_reason is used to report the reason for the timeout in that
7250c88215d7SJouni Malinen  *	case.
7251e7054989SKanchanapally, Vidyullatha  * @gfp: allocation flags
72523093ebbeSPurushottam Kushwaha  * @timeout_reason: reason for connection timeout. This is used when the
72533093ebbeSPurushottam Kushwaha  *	connection fails due to a timeout instead of an explicit rejection from
72543093ebbeSPurushottam Kushwaha  *	the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is
72553093ebbeSPurushottam Kushwaha  *	not known. This value is used only if @status < 0 to indicate that the
72563093ebbeSPurushottam Kushwaha  *	failure is due to a timeout and not due to explicit rejection by the AP.
72573093ebbeSPurushottam Kushwaha  *	This value is ignored in other cases (@status >= 0).
7258e7054989SKanchanapally, Vidyullatha  *
7259c88215d7SJouni Malinen  * It should be called by the underlying driver once execution of the connection
7260c88215d7SJouni Malinen  * request from connect() has been completed. This is similar to
7261c88215d7SJouni Malinen  * cfg80211_connect_result(), but with the option of identifying the exact bss
72625349a0f7SVidyullatha Kanchanapally  * entry for the connection. Only one of the functions among
72635349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_bss(), cfg80211_connect_result(),
72645349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
7265e7054989SKanchanapally, Vidyullatha  */
72665349a0f7SVidyullatha Kanchanapally static inline void
72675349a0f7SVidyullatha Kanchanapally cfg80211_connect_bss(struct net_device *dev, const u8 *bssid,
7268e7054989SKanchanapally, Vidyullatha 		     struct cfg80211_bss *bss, const u8 *req_ie,
7269e7054989SKanchanapally, Vidyullatha 		     size_t req_ie_len, const u8 *resp_ie,
72703093ebbeSPurushottam Kushwaha 		     size_t resp_ie_len, int status, gfp_t gfp,
72715349a0f7SVidyullatha Kanchanapally 		     enum nl80211_timeout_reason timeout_reason)
72725349a0f7SVidyullatha Kanchanapally {
72735349a0f7SVidyullatha Kanchanapally 	struct cfg80211_connect_resp_params params;
72745349a0f7SVidyullatha Kanchanapally 
72755349a0f7SVidyullatha Kanchanapally 	memset(&params, 0, sizeof(params));
72765349a0f7SVidyullatha Kanchanapally 	params.status = status;
72775349a0f7SVidyullatha Kanchanapally 	params.bssid = bssid;
72785349a0f7SVidyullatha Kanchanapally 	params.bss = bss;
72795349a0f7SVidyullatha Kanchanapally 	params.req_ie = req_ie;
72805349a0f7SVidyullatha Kanchanapally 	params.req_ie_len = req_ie_len;
72815349a0f7SVidyullatha Kanchanapally 	params.resp_ie = resp_ie;
72825349a0f7SVidyullatha Kanchanapally 	params.resp_ie_len = resp_ie_len;
72835349a0f7SVidyullatha Kanchanapally 	params.timeout_reason = timeout_reason;
72845349a0f7SVidyullatha Kanchanapally 
72855349a0f7SVidyullatha Kanchanapally 	cfg80211_connect_done(dev, &params, gfp);
72865349a0f7SVidyullatha Kanchanapally }
7287e7054989SKanchanapally, Vidyullatha 
7288e7054989SKanchanapally, Vidyullatha /**
7289b23aa676SSamuel Ortiz  * cfg80211_connect_result - notify cfg80211 of connection result
7290b23aa676SSamuel Ortiz  *
7291b23aa676SSamuel Ortiz  * @dev: network device
7292b23aa676SSamuel Ortiz  * @bssid: the BSSID of the AP
7293b23aa676SSamuel Ortiz  * @req_ie: association request IEs (maybe be %NULL)
7294b23aa676SSamuel Ortiz  * @req_ie_len: association request IEs length
7295b23aa676SSamuel Ortiz  * @resp_ie: association response IEs (may be %NULL)
7296b23aa676SSamuel Ortiz  * @resp_ie_len: assoc response IEs length
7297c88215d7SJouni Malinen  * @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use
7298b23aa676SSamuel Ortiz  *	%WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
7299b23aa676SSamuel Ortiz  *	the real status code for failures.
7300b23aa676SSamuel Ortiz  * @gfp: allocation flags
7301b23aa676SSamuel Ortiz  *
7302c88215d7SJouni Malinen  * It should be called by the underlying driver once execution of the connection
7303c88215d7SJouni Malinen  * request from connect() has been completed. This is similar to
7304c88215d7SJouni Malinen  * cfg80211_connect_bss() which allows the exact bss entry to be specified. Only
73055349a0f7SVidyullatha Kanchanapally  * one of the functions among cfg80211_connect_bss(), cfg80211_connect_result(),
73065349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
7307b23aa676SSamuel Ortiz  */
7308e7054989SKanchanapally, Vidyullatha static inline void
7309e7054989SKanchanapally, Vidyullatha cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
7310b23aa676SSamuel Ortiz 			const u8 *req_ie, size_t req_ie_len,
7311b23aa676SSamuel Ortiz 			const u8 *resp_ie, size_t resp_ie_len,
7312e7054989SKanchanapally, Vidyullatha 			u16 status, gfp_t gfp)
7313e7054989SKanchanapally, Vidyullatha {
7314e7054989SKanchanapally, Vidyullatha 	cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, resp_ie,
73153093ebbeSPurushottam Kushwaha 			     resp_ie_len, status, gfp,
73163093ebbeSPurushottam Kushwaha 			     NL80211_TIMEOUT_UNSPECIFIED);
7317e7054989SKanchanapally, Vidyullatha }
7318b23aa676SSamuel Ortiz 
7319b23aa676SSamuel Ortiz /**
7320bf1ecd21SJouni Malinen  * cfg80211_connect_timeout - notify cfg80211 of connection timeout
7321bf1ecd21SJouni Malinen  *
7322bf1ecd21SJouni Malinen  * @dev: network device
7323bf1ecd21SJouni Malinen  * @bssid: the BSSID of the AP
7324bf1ecd21SJouni Malinen  * @req_ie: association request IEs (maybe be %NULL)
7325bf1ecd21SJouni Malinen  * @req_ie_len: association request IEs length
7326bf1ecd21SJouni Malinen  * @gfp: allocation flags
73273093ebbeSPurushottam Kushwaha  * @timeout_reason: reason for connection timeout.
7328bf1ecd21SJouni Malinen  *
7329bf1ecd21SJouni Malinen  * It should be called by the underlying driver whenever connect() has failed
7330bf1ecd21SJouni Malinen  * in a sequence where no explicit authentication/association rejection was
7331bf1ecd21SJouni Malinen  * received from the AP. This could happen, e.g., due to not being able to send
7332bf1ecd21SJouni Malinen  * out the Authentication or Association Request frame or timing out while
73335349a0f7SVidyullatha Kanchanapally  * waiting for the response. Only one of the functions among
73345349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_bss(), cfg80211_connect_result(),
73355349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
7336bf1ecd21SJouni Malinen  */
7337bf1ecd21SJouni Malinen static inline void
7338bf1ecd21SJouni Malinen cfg80211_connect_timeout(struct net_device *dev, const u8 *bssid,
73393093ebbeSPurushottam Kushwaha 			 const u8 *req_ie, size_t req_ie_len, gfp_t gfp,
73403093ebbeSPurushottam Kushwaha 			 enum nl80211_timeout_reason timeout_reason)
7341bf1ecd21SJouni Malinen {
7342bf1ecd21SJouni Malinen 	cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, NULL, 0, -1,
73433093ebbeSPurushottam Kushwaha 			     gfp, timeout_reason);
7344bf1ecd21SJouni Malinen }
7345bf1ecd21SJouni Malinen 
7346bf1ecd21SJouni Malinen /**
734729ce6ecbSAvraham Stern  * struct cfg80211_roam_info - driver initiated roaming information
734829ce6ecbSAvraham Stern  *
734929ce6ecbSAvraham Stern  * @channel: the channel of the new AP
735029ce6ecbSAvraham Stern  * @bss: entry of bss to which STA got roamed (may be %NULL if %bssid is set)
735129ce6ecbSAvraham Stern  * @bssid: the BSSID of the new AP (may be %NULL if %bss is set)
735229ce6ecbSAvraham Stern  * @req_ie: association request IEs (maybe be %NULL)
735329ce6ecbSAvraham Stern  * @req_ie_len: association request IEs length
735429ce6ecbSAvraham Stern  * @resp_ie: association response IEs (may be %NULL)
735529ce6ecbSAvraham Stern  * @resp_ie_len: assoc response IEs length
7356e841b7b1SArend Van Spriel  * @fils: FILS related roaming information.
735729ce6ecbSAvraham Stern  */
735829ce6ecbSAvraham Stern struct cfg80211_roam_info {
735929ce6ecbSAvraham Stern 	struct ieee80211_channel *channel;
736029ce6ecbSAvraham Stern 	struct cfg80211_bss *bss;
736129ce6ecbSAvraham Stern 	const u8 *bssid;
736229ce6ecbSAvraham Stern 	const u8 *req_ie;
736329ce6ecbSAvraham Stern 	size_t req_ie_len;
736429ce6ecbSAvraham Stern 	const u8 *resp_ie;
736529ce6ecbSAvraham Stern 	size_t resp_ie_len;
7366e841b7b1SArend Van Spriel 	struct cfg80211_fils_resp_params fils;
736729ce6ecbSAvraham Stern };
736829ce6ecbSAvraham Stern 
736929ce6ecbSAvraham Stern /**
7370b23aa676SSamuel Ortiz  * cfg80211_roamed - notify cfg80211 of roaming
7371b23aa676SSamuel Ortiz  *
7372b23aa676SSamuel Ortiz  * @dev: network device
737329ce6ecbSAvraham Stern  * @info: information about the new BSS. struct &cfg80211_roam_info.
7374b23aa676SSamuel Ortiz  * @gfp: allocation flags
7375b23aa676SSamuel Ortiz  *
737629ce6ecbSAvraham Stern  * This function may be called with the driver passing either the BSSID of the
737729ce6ecbSAvraham Stern  * new AP or passing the bss entry to avoid a race in timeout of the bss entry.
737829ce6ecbSAvraham Stern  * It should be called by the underlying driver whenever it roamed from one AP
737929ce6ecbSAvraham Stern  * to another while connected. Drivers which have roaming implemented in
738029ce6ecbSAvraham Stern  * firmware should pass the bss entry to avoid a race in bss entry timeout where
738129ce6ecbSAvraham Stern  * the bss entry of the new AP is seen in the driver, but gets timed out by the
738229ce6ecbSAvraham Stern  * time it is accessed in __cfg80211_roamed() due to delay in scheduling
7383adbde344SVasanthakumar Thiagarajan  * rdev->event_work. In case of any failures, the reference is released
738429ce6ecbSAvraham Stern  * either in cfg80211_roamed() or in __cfg80211_romed(), Otherwise, it will be
7385e1b18549SGeert Uytterhoeven  * released while disconnecting from the current bss.
7386adbde344SVasanthakumar Thiagarajan  */
738729ce6ecbSAvraham Stern void cfg80211_roamed(struct net_device *dev, struct cfg80211_roam_info *info,
738829ce6ecbSAvraham Stern 		     gfp_t gfp);
7389adbde344SVasanthakumar Thiagarajan 
7390adbde344SVasanthakumar Thiagarajan /**
7391503c1fb9SAvraham Stern  * cfg80211_port_authorized - notify cfg80211 of successful security association
7392503c1fb9SAvraham Stern  *
7393503c1fb9SAvraham Stern  * @dev: network device
7394503c1fb9SAvraham Stern  * @bssid: the BSSID of the AP
7395503c1fb9SAvraham Stern  * @gfp: allocation flags
7396503c1fb9SAvraham Stern  *
7397503c1fb9SAvraham Stern  * This function should be called by a driver that supports 4 way handshake
7398503c1fb9SAvraham Stern  * offload after a security association was successfully established (i.e.,
7399503c1fb9SAvraham Stern  * the 4 way handshake was completed successfully). The call to this function
7400503c1fb9SAvraham Stern  * should be preceded with a call to cfg80211_connect_result(),
7401503c1fb9SAvraham Stern  * cfg80211_connect_done(), cfg80211_connect_bss() or cfg80211_roamed() to
7402503c1fb9SAvraham Stern  * indicate the 802.11 association.
7403503c1fb9SAvraham Stern  */
7404503c1fb9SAvraham Stern void cfg80211_port_authorized(struct net_device *dev, const u8 *bssid,
7405503c1fb9SAvraham Stern 			      gfp_t gfp);
7406503c1fb9SAvraham Stern 
7407503c1fb9SAvraham Stern /**
7408b23aa676SSamuel Ortiz  * cfg80211_disconnected - notify cfg80211 that connection was dropped
7409b23aa676SSamuel Ortiz  *
7410b23aa676SSamuel Ortiz  * @dev: network device
7411b23aa676SSamuel Ortiz  * @ie: information elements of the deauth/disassoc frame (may be %NULL)
7412b23aa676SSamuel Ortiz  * @ie_len: length of IEs
7413b23aa676SSamuel Ortiz  * @reason: reason code for the disconnection, set it to 0 if unknown
741480279fb7SJohannes Berg  * @locally_generated: disconnection was requested locally
7415b23aa676SSamuel Ortiz  * @gfp: allocation flags
7416b23aa676SSamuel Ortiz  *
7417b23aa676SSamuel Ortiz  * After it calls this function, the driver should enter an idle state
7418b23aa676SSamuel Ortiz  * and not try to connect to any AP any more.
7419b23aa676SSamuel Ortiz  */
7420b23aa676SSamuel Ortiz void cfg80211_disconnected(struct net_device *dev, u16 reason,
742180279fb7SJohannes Berg 			   const u8 *ie, size_t ie_len,
742280279fb7SJohannes Berg 			   bool locally_generated, gfp_t gfp);
7423b23aa676SSamuel Ortiz 
74249588bbd5SJouni Malinen /**
74259588bbd5SJouni Malinen  * cfg80211_ready_on_channel - notification of remain_on_channel start
742671bbc994SJohannes Berg  * @wdev: wireless device
74279588bbd5SJouni Malinen  * @cookie: the request cookie
74289588bbd5SJouni Malinen  * @chan: The current channel (from remain_on_channel request)
74299588bbd5SJouni Malinen  * @duration: Duration in milliseconds that the driver intents to remain on the
74309588bbd5SJouni Malinen  *	channel
74319588bbd5SJouni Malinen  * @gfp: allocation flags
74329588bbd5SJouni Malinen  */
743371bbc994SJohannes Berg void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie,
74349588bbd5SJouni Malinen 			       struct ieee80211_channel *chan,
74359588bbd5SJouni Malinen 			       unsigned int duration, gfp_t gfp);
74369588bbd5SJouni Malinen 
74379588bbd5SJouni Malinen /**
74389588bbd5SJouni Malinen  * cfg80211_remain_on_channel_expired - remain_on_channel duration expired
743971bbc994SJohannes Berg  * @wdev: wireless device
74409588bbd5SJouni Malinen  * @cookie: the request cookie
74419588bbd5SJouni Malinen  * @chan: The current channel (from remain_on_channel request)
74429588bbd5SJouni Malinen  * @gfp: allocation flags
74439588bbd5SJouni Malinen  */
744471bbc994SJohannes Berg void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie,
74459588bbd5SJouni Malinen 					struct ieee80211_channel *chan,
74469588bbd5SJouni Malinen 					gfp_t gfp);
7447b23aa676SSamuel Ortiz 
74488689c051SArend van Spriel /**
74491c38c7f2SJames Prestwood  * cfg80211_tx_mgmt_expired - tx_mgmt duration expired
74501c38c7f2SJames Prestwood  * @wdev: wireless device
74511c38c7f2SJames Prestwood  * @cookie: the requested cookie
74521c38c7f2SJames Prestwood  * @chan: The current channel (from tx_mgmt request)
74531c38c7f2SJames Prestwood  * @gfp: allocation flags
74541c38c7f2SJames Prestwood  */
74551c38c7f2SJames Prestwood void cfg80211_tx_mgmt_expired(struct wireless_dev *wdev, u64 cookie,
74561c38c7f2SJames Prestwood 			      struct ieee80211_channel *chan, gfp_t gfp);
74571c38c7f2SJames Prestwood 
74581c38c7f2SJames Prestwood /**
74598689c051SArend van Spriel  * cfg80211_sinfo_alloc_tid_stats - allocate per-tid statistics.
74608689c051SArend van Spriel  *
74618689c051SArend van Spriel  * @sinfo: the station information
74628689c051SArend van Spriel  * @gfp: allocation flags
74638689c051SArend van Spriel  */
74648689c051SArend van Spriel int cfg80211_sinfo_alloc_tid_stats(struct station_info *sinfo, gfp_t gfp);
746598b62183SJohannes Berg 
746698b62183SJohannes Berg /**
74677ea3e110SJohannes Berg  * cfg80211_sinfo_release_content - release contents of station info
74687ea3e110SJohannes Berg  * @sinfo: the station information
74697ea3e110SJohannes Berg  *
74707ea3e110SJohannes Berg  * Releases any potentially allocated sub-information of the station
74717ea3e110SJohannes Berg  * information, but not the struct itself (since it's typically on
74727ea3e110SJohannes Berg  * the stack.)
74737ea3e110SJohannes Berg  */
74747ea3e110SJohannes Berg static inline void cfg80211_sinfo_release_content(struct station_info *sinfo)
74757ea3e110SJohannes Berg {
74767ea3e110SJohannes Berg 	kfree(sinfo->pertid);
74777ea3e110SJohannes Berg }
74787ea3e110SJohannes Berg 
74797ea3e110SJohannes Berg /**
748098b62183SJohannes Berg  * cfg80211_new_sta - notify userspace about station
748198b62183SJohannes Berg  *
748298b62183SJohannes Berg  * @dev: the netdev
748398b62183SJohannes Berg  * @mac_addr: the station's address
748498b62183SJohannes Berg  * @sinfo: the station information
748598b62183SJohannes Berg  * @gfp: allocation flags
748698b62183SJohannes Berg  */
748798b62183SJohannes Berg void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr,
748898b62183SJohannes Berg 		      struct station_info *sinfo, gfp_t gfp);
748998b62183SJohannes Berg 
7490026331c4SJouni Malinen /**
7491cf5ead82SJohannes Berg  * cfg80211_del_sta_sinfo - notify userspace about deletion of a station
7492cf5ead82SJohannes Berg  * @dev: the netdev
7493cf5ead82SJohannes Berg  * @mac_addr: the station's address
7494cf5ead82SJohannes Berg  * @sinfo: the station information/statistics
7495cf5ead82SJohannes Berg  * @gfp: allocation flags
7496cf5ead82SJohannes Berg  */
7497cf5ead82SJohannes Berg void cfg80211_del_sta_sinfo(struct net_device *dev, const u8 *mac_addr,
7498cf5ead82SJohannes Berg 			    struct station_info *sinfo, gfp_t gfp);
7499cf5ead82SJohannes Berg 
7500cf5ead82SJohannes Berg /**
7501ec15e68bSJouni Malinen  * cfg80211_del_sta - notify userspace about deletion of a station
7502ec15e68bSJouni Malinen  *
7503ec15e68bSJouni Malinen  * @dev: the netdev
7504ec15e68bSJouni Malinen  * @mac_addr: the station's address
7505ec15e68bSJouni Malinen  * @gfp: allocation flags
7506ec15e68bSJouni Malinen  */
7507cf5ead82SJohannes Berg static inline void cfg80211_del_sta(struct net_device *dev,
7508cf5ead82SJohannes Berg 				    const u8 *mac_addr, gfp_t gfp)
7509cf5ead82SJohannes Berg {
7510cf5ead82SJohannes Berg 	cfg80211_del_sta_sinfo(dev, mac_addr, NULL, gfp);
7511cf5ead82SJohannes Berg }
7512ec15e68bSJouni Malinen 
7513ec15e68bSJouni Malinen /**
7514ed44a951SPandiyarajan Pitchaimuthu  * cfg80211_conn_failed - connection request failed notification
7515ed44a951SPandiyarajan Pitchaimuthu  *
7516ed44a951SPandiyarajan Pitchaimuthu  * @dev: the netdev
7517ed44a951SPandiyarajan Pitchaimuthu  * @mac_addr: the station's address
7518ed44a951SPandiyarajan Pitchaimuthu  * @reason: the reason for connection failure
7519ed44a951SPandiyarajan Pitchaimuthu  * @gfp: allocation flags
7520ed44a951SPandiyarajan Pitchaimuthu  *
7521ed44a951SPandiyarajan Pitchaimuthu  * Whenever a station tries to connect to an AP and if the station
7522ed44a951SPandiyarajan Pitchaimuthu  * could not connect to the AP as the AP has rejected the connection
7523ed44a951SPandiyarajan Pitchaimuthu  * for some reasons, this function is called.
7524ed44a951SPandiyarajan Pitchaimuthu  *
7525ed44a951SPandiyarajan Pitchaimuthu  * The reason for connection failure can be any of the value from
7526ed44a951SPandiyarajan Pitchaimuthu  * nl80211_connect_failed_reason enum
7527ed44a951SPandiyarajan Pitchaimuthu  */
7528ed44a951SPandiyarajan Pitchaimuthu void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr,
7529ed44a951SPandiyarajan Pitchaimuthu 			  enum nl80211_connect_failed_reason reason,
7530ed44a951SPandiyarajan Pitchaimuthu 			  gfp_t gfp);
7531ed44a951SPandiyarajan Pitchaimuthu 
7532ed44a951SPandiyarajan Pitchaimuthu /**
7533e76fede8SThomas Pedersen  * cfg80211_rx_mgmt_khz - notification of received, unprocessed management frame
7534e76fede8SThomas Pedersen  * @wdev: wireless device receiving the frame
7535e76fede8SThomas Pedersen  * @freq: Frequency on which the frame was received in KHz
7536e76fede8SThomas Pedersen  * @sig_dbm: signal strength in dBm, or 0 if unknown
7537e76fede8SThomas Pedersen  * @buf: Management frame (header + body)
7538e76fede8SThomas Pedersen  * @len: length of the frame data
7539e76fede8SThomas Pedersen  * @flags: flags, as defined in enum nl80211_rxmgmt_flags
7540e76fede8SThomas Pedersen  *
7541e76fede8SThomas Pedersen  * This function is called whenever an Action frame is received for a station
7542e76fede8SThomas Pedersen  * mode interface, but is not processed in kernel.
7543e76fede8SThomas Pedersen  *
7544e76fede8SThomas Pedersen  * Return: %true if a user space application has registered for this frame.
7545e76fede8SThomas Pedersen  * For action frames, that makes it responsible for rejecting unrecognized
7546e76fede8SThomas Pedersen  * action frames; %false otherwise, in which case for action frames the
7547e76fede8SThomas Pedersen  * driver is responsible for rejecting the frame.
7548e76fede8SThomas Pedersen  */
7549e76fede8SThomas Pedersen bool cfg80211_rx_mgmt_khz(struct wireless_dev *wdev, int freq, int sig_dbm,
7550e76fede8SThomas Pedersen 			  const u8 *buf, size_t len, u32 flags);
7551e76fede8SThomas Pedersen 
7552e76fede8SThomas Pedersen /**
75532e161f78SJohannes Berg  * cfg80211_rx_mgmt - notification of received, unprocessed management frame
755471bbc994SJohannes Berg  * @wdev: wireless device receiving the frame
7555026331c4SJouni Malinen  * @freq: Frequency on which the frame was received in MHz
75566c2fb1e6SSergey Matyukevich  * @sig_dbm: signal strength in dBm, or 0 if unknown
75572e161f78SJohannes Berg  * @buf: Management frame (header + body)
7558026331c4SJouni Malinen  * @len: length of the frame data
755919504cf5SVladimir Kondratiev  * @flags: flags, as defined in enum nl80211_rxmgmt_flags
75602e161f78SJohannes Berg  *
75610ae997dcSYacine Belkadi  * This function is called whenever an Action frame is received for a station
75620ae997dcSYacine Belkadi  * mode interface, but is not processed in kernel.
75630ae997dcSYacine Belkadi  *
75640ae997dcSYacine Belkadi  * Return: %true if a user space application has registered for this frame.
75652e161f78SJohannes Berg  * For action frames, that makes it responsible for rejecting unrecognized
75662e161f78SJohannes Berg  * action frames; %false otherwise, in which case for action frames the
75672e161f78SJohannes Berg  * driver is responsible for rejecting the frame.
7568026331c4SJouni Malinen  */
7569e76fede8SThomas Pedersen static inline bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq,
7570e76fede8SThomas Pedersen 				    int sig_dbm, const u8 *buf, size_t len,
7571e76fede8SThomas Pedersen 				    u32 flags)
7572e76fede8SThomas Pedersen {
7573e76fede8SThomas Pedersen 	return cfg80211_rx_mgmt_khz(wdev, MHZ_TO_KHZ(freq), sig_dbm, buf, len,
7574e76fede8SThomas Pedersen 				    flags);
7575e76fede8SThomas Pedersen }
7576026331c4SJouni Malinen 
7577026331c4SJouni Malinen /**
75782e161f78SJohannes Berg  * cfg80211_mgmt_tx_status - notification of TX status for management frame
757971bbc994SJohannes Berg  * @wdev: wireless device receiving the frame
75802e161f78SJohannes Berg  * @cookie: Cookie returned by cfg80211_ops::mgmt_tx()
75812e161f78SJohannes Berg  * @buf: Management frame (header + body)
7582026331c4SJouni Malinen  * @len: length of the frame data
7583026331c4SJouni Malinen  * @ack: Whether frame was acknowledged
7584026331c4SJouni Malinen  * @gfp: context flags
7585026331c4SJouni Malinen  *
75862e161f78SJohannes Berg  * This function is called whenever a management frame was requested to be
75872e161f78SJohannes Berg  * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the
7588026331c4SJouni Malinen  * transmission attempt.
7589026331c4SJouni Malinen  */
759071bbc994SJohannes Berg void cfg80211_mgmt_tx_status(struct wireless_dev *wdev, u64 cookie,
7591026331c4SJouni Malinen 			     const u8 *buf, size_t len, bool ack, gfp_t gfp);
7592026331c4SJouni Malinen 
7593dca9ca2dSMarkus Theil /**
7594dca9ca2dSMarkus Theil  * cfg80211_control_port_tx_status - notification of TX status for control
7595dca9ca2dSMarkus Theil  *                                   port frames
7596dca9ca2dSMarkus Theil  * @wdev: wireless device receiving the frame
7597dca9ca2dSMarkus Theil  * @cookie: Cookie returned by cfg80211_ops::tx_control_port()
7598dca9ca2dSMarkus Theil  * @buf: Data frame (header + body)
7599dca9ca2dSMarkus Theil  * @len: length of the frame data
7600dca9ca2dSMarkus Theil  * @ack: Whether frame was acknowledged
7601dca9ca2dSMarkus Theil  * @gfp: context flags
7602dca9ca2dSMarkus Theil  *
7603dca9ca2dSMarkus Theil  * This function is called whenever a control port frame was requested to be
7604dca9ca2dSMarkus Theil  * transmitted with cfg80211_ops::tx_control_port() to report the TX status of
7605dca9ca2dSMarkus Theil  * the transmission attempt.
7606dca9ca2dSMarkus Theil  */
7607dca9ca2dSMarkus Theil void cfg80211_control_port_tx_status(struct wireless_dev *wdev, u64 cookie,
7608dca9ca2dSMarkus Theil 				     const u8 *buf, size_t len, bool ack,
7609dca9ca2dSMarkus Theil 				     gfp_t gfp);
7610d6dc1a38SJuuso Oikarinen 
7611d6dc1a38SJuuso Oikarinen /**
76126a671a50SDenis Kenzior  * cfg80211_rx_control_port - notification about a received control port frame
76136a671a50SDenis Kenzior  * @dev: The device the frame matched to
7614a948f713SDenis Kenzior  * @skb: The skbuf with the control port frame.  It is assumed that the skbuf
7615a948f713SDenis Kenzior  *	is 802.3 formatted (with 802.3 header).  The skb can be non-linear.
7616a948f713SDenis Kenzior  *	This function does not take ownership of the skb, so the caller is
7617a948f713SDenis Kenzior  *	responsible for any cleanup.  The caller must also ensure that
7618a948f713SDenis Kenzior  *	skb->protocol is set appropriately.
76196a671a50SDenis Kenzior  * @unencrypted: Whether the frame was received unencrypted
76206a671a50SDenis Kenzior  *
76216a671a50SDenis Kenzior  * This function is used to inform userspace about a received control port
76226a671a50SDenis Kenzior  * frame.  It should only be used if userspace indicated it wants to receive
76236a671a50SDenis Kenzior  * control port frames over nl80211.
76246a671a50SDenis Kenzior  *
76256a671a50SDenis Kenzior  * The frame is the data portion of the 802.3 or 802.11 data frame with all
76266a671a50SDenis Kenzior  * network layer headers removed (e.g. the raw EAPoL frame).
76276a671a50SDenis Kenzior  *
76286a671a50SDenis Kenzior  * Return: %true if the frame was passed to userspace
76296a671a50SDenis Kenzior  */
76306a671a50SDenis Kenzior bool cfg80211_rx_control_port(struct net_device *dev,
7631a948f713SDenis Kenzior 			      struct sk_buff *skb, bool unencrypted);
76326a671a50SDenis Kenzior 
76336a671a50SDenis Kenzior /**
7634d6dc1a38SJuuso Oikarinen  * cfg80211_cqm_rssi_notify - connection quality monitoring rssi event
7635d6dc1a38SJuuso Oikarinen  * @dev: network device
7636d6dc1a38SJuuso Oikarinen  * @rssi_event: the triggered RSSI event
7637bee427b8SAndrzej Zaborowski  * @rssi_level: new RSSI level value or 0 if not available
7638d6dc1a38SJuuso Oikarinen  * @gfp: context flags
7639d6dc1a38SJuuso Oikarinen  *
7640d6dc1a38SJuuso Oikarinen  * This function is called when a configured connection quality monitoring
7641d6dc1a38SJuuso Oikarinen  * rssi threshold reached event occurs.
7642d6dc1a38SJuuso Oikarinen  */
7643d6dc1a38SJuuso Oikarinen void cfg80211_cqm_rssi_notify(struct net_device *dev,
7644d6dc1a38SJuuso Oikarinen 			      enum nl80211_cqm_rssi_threshold_event rssi_event,
7645bee427b8SAndrzej Zaborowski 			      s32 rssi_level, gfp_t gfp);
7646d6dc1a38SJuuso Oikarinen 
7647c063dbf5SJohannes Berg /**
7648c063dbf5SJohannes Berg  * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer
7649c063dbf5SJohannes Berg  * @dev: network device
7650c063dbf5SJohannes Berg  * @peer: peer's MAC address
7651c063dbf5SJohannes Berg  * @num_packets: how many packets were lost -- should be a fixed threshold
7652c063dbf5SJohannes Berg  *	but probably no less than maybe 50, or maybe a throughput dependent
7653c063dbf5SJohannes Berg  *	threshold (to account for temporary interference)
7654c063dbf5SJohannes Berg  * @gfp: context flags
7655c063dbf5SJohannes Berg  */
7656c063dbf5SJohannes Berg void cfg80211_cqm_pktloss_notify(struct net_device *dev,
7657c063dbf5SJohannes Berg 				 const u8 *peer, u32 num_packets, gfp_t gfp);
7658c063dbf5SJohannes Berg 
7659e5497d76SJohannes Berg /**
766084f10708SThomas Pedersen  * cfg80211_cqm_txe_notify - TX error rate event
766184f10708SThomas Pedersen  * @dev: network device
766284f10708SThomas Pedersen  * @peer: peer's MAC address
766384f10708SThomas Pedersen  * @num_packets: how many packets were lost
766484f10708SThomas Pedersen  * @rate: % of packets which failed transmission
766584f10708SThomas Pedersen  * @intvl: interval (in s) over which the TX failure threshold was breached.
766684f10708SThomas Pedersen  * @gfp: context flags
766784f10708SThomas Pedersen  *
766884f10708SThomas Pedersen  * Notify userspace when configured % TX failures over number of packets in a
766984f10708SThomas Pedersen  * given interval is exceeded.
767084f10708SThomas Pedersen  */
767184f10708SThomas Pedersen void cfg80211_cqm_txe_notify(struct net_device *dev, const u8 *peer,
767284f10708SThomas Pedersen 			     u32 num_packets, u32 rate, u32 intvl, gfp_t gfp);
767384f10708SThomas Pedersen 
767484f10708SThomas Pedersen /**
767598f03342SJohannes Berg  * cfg80211_cqm_beacon_loss_notify - beacon loss event
767698f03342SJohannes Berg  * @dev: network device
767798f03342SJohannes Berg  * @gfp: context flags
767898f03342SJohannes Berg  *
767998f03342SJohannes Berg  * Notify userspace about beacon loss from the connected AP.
768098f03342SJohannes Berg  */
768198f03342SJohannes Berg void cfg80211_cqm_beacon_loss_notify(struct net_device *dev, gfp_t gfp);
768298f03342SJohannes Berg 
768398f03342SJohannes Berg /**
7684c47240cbSLorenzo Bianconi  * __cfg80211_radar_event - radar detection event
76855b97f49dSJohannes Berg  * @wiphy: the wiphy
76865b97f49dSJohannes Berg  * @chandef: chandef for the current channel
7687c47240cbSLorenzo Bianconi  * @offchan: the radar has been detected on the offchannel chain
76885b97f49dSJohannes Berg  * @gfp: context flags
76895b97f49dSJohannes Berg  *
76905b97f49dSJohannes Berg  * This function is called when a radar is detected on the current chanenl.
76915b97f49dSJohannes Berg  */
7692c47240cbSLorenzo Bianconi void __cfg80211_radar_event(struct wiphy *wiphy,
7693c47240cbSLorenzo Bianconi 			    struct cfg80211_chan_def *chandef,
7694c47240cbSLorenzo Bianconi 			    bool offchan, gfp_t gfp);
7695c47240cbSLorenzo Bianconi 
7696c47240cbSLorenzo Bianconi static inline void
7697c47240cbSLorenzo Bianconi cfg80211_radar_event(struct wiphy *wiphy,
7698c47240cbSLorenzo Bianconi 		     struct cfg80211_chan_def *chandef,
7699c47240cbSLorenzo Bianconi 		     gfp_t gfp)
7700c47240cbSLorenzo Bianconi {
7701c47240cbSLorenzo Bianconi 	__cfg80211_radar_event(wiphy, chandef, false, gfp);
7702c47240cbSLorenzo Bianconi }
7703c47240cbSLorenzo Bianconi 
7704c47240cbSLorenzo Bianconi static inline void
7705a95bfb87SLorenzo Bianconi cfg80211_background_radar_event(struct wiphy *wiphy,
7706c47240cbSLorenzo Bianconi 				struct cfg80211_chan_def *chandef,
7707c47240cbSLorenzo Bianconi 				gfp_t gfp)
7708c47240cbSLorenzo Bianconi {
7709c47240cbSLorenzo Bianconi 	__cfg80211_radar_event(wiphy, chandef, true, gfp);
7710c47240cbSLorenzo Bianconi }
77115b97f49dSJohannes Berg 
77125b97f49dSJohannes Berg /**
7713466b9936Stamizhr@codeaurora.org  * cfg80211_sta_opmode_change_notify - STA's ht/vht operation mode change event
7714466b9936Stamizhr@codeaurora.org  * @dev: network device
7715466b9936Stamizhr@codeaurora.org  * @mac: MAC address of a station which opmode got modified
7716466b9936Stamizhr@codeaurora.org  * @sta_opmode: station's current opmode value
7717466b9936Stamizhr@codeaurora.org  * @gfp: context flags
7718466b9936Stamizhr@codeaurora.org  *
7719466b9936Stamizhr@codeaurora.org  * Driver should call this function when station's opmode modified via action
7720466b9936Stamizhr@codeaurora.org  * frame.
7721466b9936Stamizhr@codeaurora.org  */
7722466b9936Stamizhr@codeaurora.org void cfg80211_sta_opmode_change_notify(struct net_device *dev, const u8 *mac,
7723466b9936Stamizhr@codeaurora.org 				       struct sta_opmode_info *sta_opmode,
7724466b9936Stamizhr@codeaurora.org 				       gfp_t gfp);
7725466b9936Stamizhr@codeaurora.org 
7726466b9936Stamizhr@codeaurora.org /**
77275b97f49dSJohannes Berg  * cfg80211_cac_event - Channel availability check (CAC) event
77285b97f49dSJohannes Berg  * @netdev: network device
77295b97f49dSJohannes Berg  * @chandef: chandef for the current channel
77305b97f49dSJohannes Berg  * @event: type of event
77315b97f49dSJohannes Berg  * @gfp: context flags
77325b97f49dSJohannes Berg  *
77335b97f49dSJohannes Berg  * This function is called when a Channel availability check (CAC) is finished
77345b97f49dSJohannes Berg  * or aborted. This must be called to notify the completion of a CAC process,
77355b97f49dSJohannes Berg  * also by full-MAC drivers.
77365b97f49dSJohannes Berg  */
77375b97f49dSJohannes Berg void cfg80211_cac_event(struct net_device *netdev,
77385b97f49dSJohannes Berg 			const struct cfg80211_chan_def *chandef,
77395b97f49dSJohannes Berg 			enum nl80211_radar_event event, gfp_t gfp);
77405b97f49dSJohannes Berg 
7741bc2dfc02SLorenzo Bianconi /**
7742a95bfb87SLorenzo Bianconi  * cfg80211_background_cac_abort - Channel Availability Check offchan abort event
7743bc2dfc02SLorenzo Bianconi  * @wiphy: the wiphy
7744bc2dfc02SLorenzo Bianconi  *
77451507b153SLorenzo Bianconi  * This function is called by the driver when a Channel Availability Check
77461507b153SLorenzo Bianconi  * (CAC) is aborted by a offchannel dedicated chain.
7747bc2dfc02SLorenzo Bianconi  */
7748a95bfb87SLorenzo Bianconi void cfg80211_background_cac_abort(struct wiphy *wiphy);
77495b97f49dSJohannes Berg 
77505b97f49dSJohannes Berg /**
7751e5497d76SJohannes Berg  * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying
7752e5497d76SJohannes Berg  * @dev: network device
7753e5497d76SJohannes Berg  * @bssid: BSSID of AP (to avoid races)
7754e5497d76SJohannes Berg  * @replay_ctr: new replay counter
7755af71ff85SJohannes Berg  * @gfp: allocation flags
7756e5497d76SJohannes Berg  */
7757e5497d76SJohannes Berg void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid,
7758e5497d76SJohannes Berg 			       const u8 *replay_ctr, gfp_t gfp);
7759e5497d76SJohannes Berg 
7760c9df56b4SJouni Malinen /**
7761c9df56b4SJouni Malinen  * cfg80211_pmksa_candidate_notify - notify about PMKSA caching candidate
7762c9df56b4SJouni Malinen  * @dev: network device
7763c9df56b4SJouni Malinen  * @index: candidate index (the smaller the index, the higher the priority)
7764c9df56b4SJouni Malinen  * @bssid: BSSID of AP
7765c9df56b4SJouni Malinen  * @preauth: Whether AP advertises support for RSN pre-authentication
7766c9df56b4SJouni Malinen  * @gfp: allocation flags
7767c9df56b4SJouni Malinen  */
7768c9df56b4SJouni Malinen void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index,
7769c9df56b4SJouni Malinen 				     const u8 *bssid, bool preauth, gfp_t gfp);
7770c9df56b4SJouni Malinen 
777128946da7SJohannes Berg /**
777228946da7SJohannes Berg  * cfg80211_rx_spurious_frame - inform userspace about a spurious frame
777328946da7SJohannes Berg  * @dev: The device the frame matched to
777428946da7SJohannes Berg  * @addr: the transmitter address
777528946da7SJohannes Berg  * @gfp: context flags
777628946da7SJohannes Berg  *
777728946da7SJohannes Berg  * This function is used in AP mode (only!) to inform userspace that
777828946da7SJohannes Berg  * a spurious class 3 frame was received, to be able to deauth the
777928946da7SJohannes Berg  * sender.
77800ae997dcSYacine Belkadi  * Return: %true if the frame was passed to userspace (or this failed
778128946da7SJohannes Berg  * for a reason other than not having a subscription.)
778228946da7SJohannes Berg  */
778328946da7SJohannes Berg bool cfg80211_rx_spurious_frame(struct net_device *dev,
778428946da7SJohannes Berg 				const u8 *addr, gfp_t gfp);
778528946da7SJohannes Berg 
77867f6cf311SJohannes Berg /**
7787b92ab5d8SJohannes Berg  * cfg80211_rx_unexpected_4addr_frame - inform about unexpected WDS frame
7788b92ab5d8SJohannes Berg  * @dev: The device the frame matched to
7789b92ab5d8SJohannes Berg  * @addr: the transmitter address
7790b92ab5d8SJohannes Berg  * @gfp: context flags
7791b92ab5d8SJohannes Berg  *
7792b92ab5d8SJohannes Berg  * This function is used in AP mode (only!) to inform userspace that
7793b92ab5d8SJohannes Berg  * an associated station sent a 4addr frame but that wasn't expected.
7794b92ab5d8SJohannes Berg  * It is allowed and desirable to send this event only once for each
7795b92ab5d8SJohannes Berg  * station to avoid event flooding.
77960ae997dcSYacine Belkadi  * Return: %true if the frame was passed to userspace (or this failed
7797b92ab5d8SJohannes Berg  * for a reason other than not having a subscription.)
7798b92ab5d8SJohannes Berg  */
7799b92ab5d8SJohannes Berg bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev,
7800b92ab5d8SJohannes Berg 					const u8 *addr, gfp_t gfp);
7801b92ab5d8SJohannes Berg 
7802b92ab5d8SJohannes Berg /**
78037f6cf311SJohannes Berg  * cfg80211_probe_status - notify userspace about probe status
78047f6cf311SJohannes Berg  * @dev: the device the probe was sent on
78057f6cf311SJohannes Berg  * @addr: the address of the peer
78067f6cf311SJohannes Berg  * @cookie: the cookie filled in @probe_client previously
78077f6cf311SJohannes Berg  * @acked: indicates whether probe was acked or not
7808c4b50cd3SVenkateswara Naralasetty  * @ack_signal: signal strength (in dBm) of the ACK frame.
7809c4b50cd3SVenkateswara Naralasetty  * @is_valid_ack_signal: indicates the ack_signal is valid or not.
78107f6cf311SJohannes Berg  * @gfp: allocation flags
78117f6cf311SJohannes Berg  */
78127f6cf311SJohannes Berg void cfg80211_probe_status(struct net_device *dev, const u8 *addr,
7813c4b50cd3SVenkateswara Naralasetty 			   u64 cookie, bool acked, s32 ack_signal,
7814c4b50cd3SVenkateswara Naralasetty 			   bool is_valid_ack_signal, gfp_t gfp);
78157f6cf311SJohannes Berg 
78165e760230SJohannes Berg /**
7817e76fede8SThomas Pedersen  * cfg80211_report_obss_beacon_khz - report beacon from other APs
7818e76fede8SThomas Pedersen  * @wiphy: The wiphy that received the beacon
7819e76fede8SThomas Pedersen  * @frame: the frame
7820e76fede8SThomas Pedersen  * @len: length of the frame
7821e76fede8SThomas Pedersen  * @freq: frequency the frame was received on in KHz
7822e76fede8SThomas Pedersen  * @sig_dbm: signal strength in dBm, or 0 if unknown
7823e76fede8SThomas Pedersen  *
7824e76fede8SThomas Pedersen  * Use this function to report to userspace when a beacon was
7825e76fede8SThomas Pedersen  * received. It is not useful to call this when there is no
7826e76fede8SThomas Pedersen  * netdev that is in AP/GO mode.
7827e76fede8SThomas Pedersen  */
7828e76fede8SThomas Pedersen void cfg80211_report_obss_beacon_khz(struct wiphy *wiphy, const u8 *frame,
7829e76fede8SThomas Pedersen 				     size_t len, int freq, int sig_dbm);
7830e76fede8SThomas Pedersen 
7831e76fede8SThomas Pedersen /**
78325e760230SJohannes Berg  * cfg80211_report_obss_beacon - report beacon from other APs
78335e760230SJohannes Berg  * @wiphy: The wiphy that received the beacon
78345e760230SJohannes Berg  * @frame: the frame
78355e760230SJohannes Berg  * @len: length of the frame
78365e760230SJohannes Berg  * @freq: frequency the frame was received on
78376c2fb1e6SSergey Matyukevich  * @sig_dbm: signal strength in dBm, or 0 if unknown
78385e760230SJohannes Berg  *
78395e760230SJohannes Berg  * Use this function to report to userspace when a beacon was
78405e760230SJohannes Berg  * received. It is not useful to call this when there is no
78415e760230SJohannes Berg  * netdev that is in AP/GO mode.
78425e760230SJohannes Berg  */
7843e76fede8SThomas Pedersen static inline void cfg80211_report_obss_beacon(struct wiphy *wiphy,
78445e760230SJohannes Berg 					       const u8 *frame, size_t len,
7845e76fede8SThomas Pedersen 					       int freq, int sig_dbm)
7846e76fede8SThomas Pedersen {
7847e76fede8SThomas Pedersen 	cfg80211_report_obss_beacon_khz(wiphy, frame, len, MHZ_TO_KHZ(freq),
7848e76fede8SThomas Pedersen 					sig_dbm);
7849e76fede8SThomas Pedersen }
78505e760230SJohannes Berg 
7851d58e7e37SJohannes Berg /**
7852683b6d3bSJohannes Berg  * cfg80211_reg_can_beacon - check if beaconing is allowed
785354858ee5SAlexander Simon  * @wiphy: the wiphy
7854683b6d3bSJohannes Berg  * @chandef: the channel definition
7855174e0cd2SIlan Peer  * @iftype: interface type
7856d58e7e37SJohannes Berg  *
78570ae997dcSYacine Belkadi  * Return: %true if there is no secondary channel or the secondary channel(s)
78580ae997dcSYacine Belkadi  * can be used for beaconing (i.e. is not a radar channel etc.)
785954858ee5SAlexander Simon  */
7860683b6d3bSJohannes Berg bool cfg80211_reg_can_beacon(struct wiphy *wiphy,
7861174e0cd2SIlan Peer 			     struct cfg80211_chan_def *chandef,
7862174e0cd2SIlan Peer 			     enum nl80211_iftype iftype);
786354858ee5SAlexander Simon 
7864923b352fSArik Nemtsov /**
7865923b352fSArik Nemtsov  * cfg80211_reg_can_beacon_relax - check if beaconing is allowed with relaxation
7866923b352fSArik Nemtsov  * @wiphy: the wiphy
7867923b352fSArik Nemtsov  * @chandef: the channel definition
7868923b352fSArik Nemtsov  * @iftype: interface type
7869923b352fSArik Nemtsov  *
7870923b352fSArik Nemtsov  * Return: %true if there is no secondary channel or the secondary channel(s)
7871923b352fSArik Nemtsov  * can be used for beaconing (i.e. is not a radar channel etc.). This version
7872923b352fSArik Nemtsov  * also checks if IR-relaxation conditions apply, to allow beaconing under
7873923b352fSArik Nemtsov  * more permissive conditions.
7874923b352fSArik Nemtsov  *
7875a05829a7SJohannes Berg  * Requires the wiphy mutex to be held.
7876923b352fSArik Nemtsov  */
7877923b352fSArik Nemtsov bool cfg80211_reg_can_beacon_relax(struct wiphy *wiphy,
7878923b352fSArik Nemtsov 				   struct cfg80211_chan_def *chandef,
7879923b352fSArik Nemtsov 				   enum nl80211_iftype iftype);
7880923b352fSArik Nemtsov 
78818097e149SThomas Pedersen /*
78825314526bSThomas Pedersen  * cfg80211_ch_switch_notify - update wdev channel and notify userspace
78835314526bSThomas Pedersen  * @dev: the device which switched channels
7884683b6d3bSJohannes Berg  * @chandef: the new channel definition
78855314526bSThomas Pedersen  *
7886e487eaebSSimon Wunderlich  * Caller must acquire wdev_lock, therefore must only be called from sleepable
7887e487eaebSSimon Wunderlich  * driver context!
78885314526bSThomas Pedersen  */
7889683b6d3bSJohannes Berg void cfg80211_ch_switch_notify(struct net_device *dev,
7890683b6d3bSJohannes Berg 			       struct cfg80211_chan_def *chandef);
78915314526bSThomas Pedersen 
7892f8d7552eSLuciano Coelho /*
7893f8d7552eSLuciano Coelho  * cfg80211_ch_switch_started_notify - notify channel switch start
7894f8d7552eSLuciano Coelho  * @dev: the device on which the channel switch started
7895f8d7552eSLuciano Coelho  * @chandef: the future channel definition
7896f8d7552eSLuciano Coelho  * @count: the number of TBTTs until the channel switch happens
7897669b8413SJohannes Berg  * @quiet: whether or not immediate quiet was requested by the AP
7898f8d7552eSLuciano Coelho  *
7899f8d7552eSLuciano Coelho  * Inform the userspace about the channel switch that has just
7900f8d7552eSLuciano Coelho  * started, so that it can take appropriate actions (eg. starting
7901f8d7552eSLuciano Coelho  * channel switch on other vifs), if necessary.
7902f8d7552eSLuciano Coelho  */
7903f8d7552eSLuciano Coelho void cfg80211_ch_switch_started_notify(struct net_device *dev,
7904f8d7552eSLuciano Coelho 				       struct cfg80211_chan_def *chandef,
7905669b8413SJohannes Berg 				       u8 count, bool quiet);
7906f8d7552eSLuciano Coelho 
79071ce3e82bSJohannes Berg /**
79081ce3e82bSJohannes Berg  * ieee80211_operating_class_to_band - convert operating class to band
79091ce3e82bSJohannes Berg  *
79101ce3e82bSJohannes Berg  * @operating_class: the operating class to convert
79111ce3e82bSJohannes Berg  * @band: band pointer to fill
79121ce3e82bSJohannes Berg  *
79131ce3e82bSJohannes Berg  * Returns %true if the conversion was successful, %false otherwise.
79141ce3e82bSJohannes Berg  */
79151ce3e82bSJohannes Berg bool ieee80211_operating_class_to_band(u8 operating_class,
791657fbcce3SJohannes Berg 				       enum nl80211_band *band);
79171ce3e82bSJohannes Berg 
7918a38700ddSArik Nemtsov /**
7919a38700ddSArik Nemtsov  * ieee80211_chandef_to_operating_class - convert chandef to operation class
7920a38700ddSArik Nemtsov  *
7921a38700ddSArik Nemtsov  * @chandef: the chandef to convert
7922a38700ddSArik Nemtsov  * @op_class: a pointer to the resulting operating class
7923a38700ddSArik Nemtsov  *
7924a38700ddSArik Nemtsov  * Returns %true if the conversion was successful, %false otherwise.
7925a38700ddSArik Nemtsov  */
7926a38700ddSArik Nemtsov bool ieee80211_chandef_to_operating_class(struct cfg80211_chan_def *chandef,
7927a38700ddSArik Nemtsov 					  u8 *op_class);
7928a38700ddSArik Nemtsov 
7929934f4c7dSThomas Pedersen /**
7930934f4c7dSThomas Pedersen  * ieee80211_chandef_to_khz - convert chandef to frequency in KHz
7931934f4c7dSThomas Pedersen  *
7932934f4c7dSThomas Pedersen  * @chandef: the chandef to convert
7933934f4c7dSThomas Pedersen  *
7934934f4c7dSThomas Pedersen  * Returns the center frequency of chandef (1st segment) in KHz.
7935934f4c7dSThomas Pedersen  */
7936934f4c7dSThomas Pedersen static inline u32
7937934f4c7dSThomas Pedersen ieee80211_chandef_to_khz(const struct cfg80211_chan_def *chandef)
7938934f4c7dSThomas Pedersen {
7939934f4c7dSThomas Pedersen 	return MHZ_TO_KHZ(chandef->center_freq1) + chandef->freq1_offset;
7940934f4c7dSThomas Pedersen }
7941934f4c7dSThomas Pedersen 
79425314526bSThomas Pedersen /*
79433475b094SJouni Malinen  * cfg80211_tdls_oper_request - request userspace to perform TDLS operation
79443475b094SJouni Malinen  * @dev: the device on which the operation is requested
79453475b094SJouni Malinen  * @peer: the MAC address of the peer device
79463475b094SJouni Malinen  * @oper: the requested TDLS operation (NL80211_TDLS_SETUP or
79473475b094SJouni Malinen  *	NL80211_TDLS_TEARDOWN)
79483475b094SJouni Malinen  * @reason_code: the reason code for teardown request
79493475b094SJouni Malinen  * @gfp: allocation flags
79503475b094SJouni Malinen  *
79513475b094SJouni Malinen  * This function is used to request userspace to perform TDLS operation that
79523475b094SJouni Malinen  * requires knowledge of keys, i.e., link setup or teardown when the AP
79533475b094SJouni Malinen  * connection uses encryption. This is optional mechanism for the driver to use
79543475b094SJouni Malinen  * if it can automatically determine when a TDLS link could be useful (e.g.,
79553475b094SJouni Malinen  * based on traffic and signal strength for a peer).
79563475b094SJouni Malinen  */
79573475b094SJouni Malinen void cfg80211_tdls_oper_request(struct net_device *dev, const u8 *peer,
79583475b094SJouni Malinen 				enum nl80211_tdls_operation oper,
79593475b094SJouni Malinen 				u16 reason_code, gfp_t gfp);
79603475b094SJouni Malinen 
79613475b094SJouni Malinen /*
79628097e149SThomas Pedersen  * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units)
79638097e149SThomas Pedersen  * @rate: given rate_info to calculate bitrate from
79648097e149SThomas Pedersen  *
79658097e149SThomas Pedersen  * return 0 if MCS index >= 32
79668097e149SThomas Pedersen  */
79678eb41c8dSVladimir Kondratiev u32 cfg80211_calculate_bitrate(struct rate_info *rate);
79688097e149SThomas Pedersen 
796998104fdeSJohannes Berg /**
797098104fdeSJohannes Berg  * cfg80211_unregister_wdev - remove the given wdev
797198104fdeSJohannes Berg  * @wdev: struct wireless_dev to remove
797298104fdeSJohannes Berg  *
79732fe8ef10SJohannes Berg  * This function removes the device so it can no longer be used. It is necessary
79742fe8ef10SJohannes Berg  * to call this function even when cfg80211 requests the removal of the device
79752fe8ef10SJohannes Berg  * by calling the del_virtual_intf() callback. The function must also be called
79762fe8ef10SJohannes Berg  * when the driver wishes to unregister the wdev, e.g. when the hardware device
79772fe8ef10SJohannes Berg  * is unbound from the driver.
797898104fdeSJohannes Berg  *
7979a05829a7SJohannes Berg  * Requires the RTNL and wiphy mutex to be held.
798098104fdeSJohannes Berg  */
798198104fdeSJohannes Berg void cfg80211_unregister_wdev(struct wireless_dev *wdev);
798298104fdeSJohannes Berg 
79830ee45355SJohannes Berg /**
79842fe8ef10SJohannes Berg  * cfg80211_register_netdevice - register the given netdev
79852fe8ef10SJohannes Berg  * @dev: the netdev to register
79862fe8ef10SJohannes Berg  *
79872fe8ef10SJohannes Berg  * Note: In contexts coming from cfg80211 callbacks, you must call this rather
79882fe8ef10SJohannes Berg  * than register_netdevice(), unregister_netdev() is impossible as the RTNL is
79892fe8ef10SJohannes Berg  * held. Otherwise, both register_netdevice() and register_netdev() are usable
79902fe8ef10SJohannes Berg  * instead as well.
7991a05829a7SJohannes Berg  *
7992a05829a7SJohannes Berg  * Requires the RTNL and wiphy mutex to be held.
79932fe8ef10SJohannes Berg  */
79942fe8ef10SJohannes Berg int cfg80211_register_netdevice(struct net_device *dev);
79952fe8ef10SJohannes Berg 
79962fe8ef10SJohannes Berg /**
79972fe8ef10SJohannes Berg  * cfg80211_unregister_netdevice - unregister the given netdev
79982fe8ef10SJohannes Berg  * @dev: the netdev to register
79992fe8ef10SJohannes Berg  *
80002fe8ef10SJohannes Berg  * Note: In contexts coming from cfg80211 callbacks, you must call this rather
80012fe8ef10SJohannes Berg  * than unregister_netdevice(), unregister_netdev() is impossible as the RTNL
80022fe8ef10SJohannes Berg  * is held. Otherwise, both unregister_netdevice() and unregister_netdev() are
80032fe8ef10SJohannes Berg  * usable instead as well.
8004a05829a7SJohannes Berg  *
8005a05829a7SJohannes Berg  * Requires the RTNL and wiphy mutex to be held.
80062fe8ef10SJohannes Berg  */
80072fe8ef10SJohannes Berg static inline void cfg80211_unregister_netdevice(struct net_device *dev)
80082fe8ef10SJohannes Berg {
80092fe8ef10SJohannes Berg 	cfg80211_unregister_wdev(dev->ieee80211_ptr);
80102fe8ef10SJohannes Berg }
80112fe8ef10SJohannes Berg 
80122fe8ef10SJohannes Berg /**
8013b1e8eb11SMauro Carvalho Chehab  * struct cfg80211_ft_event_params - FT Information Elements
8014355199e0SJouni Malinen  * @ies: FT IEs
8015355199e0SJouni Malinen  * @ies_len: length of the FT IE in bytes
8016355199e0SJouni Malinen  * @target_ap: target AP's MAC address
8017355199e0SJouni Malinen  * @ric_ies: RIC IE
8018355199e0SJouni Malinen  * @ric_ies_len: length of the RIC IE in bytes
8019355199e0SJouni Malinen  */
8020355199e0SJouni Malinen struct cfg80211_ft_event_params {
8021355199e0SJouni Malinen 	const u8 *ies;
8022355199e0SJouni Malinen 	size_t ies_len;
8023355199e0SJouni Malinen 	const u8 *target_ap;
8024355199e0SJouni Malinen 	const u8 *ric_ies;
8025355199e0SJouni Malinen 	size_t ric_ies_len;
8026355199e0SJouni Malinen };
8027355199e0SJouni Malinen 
8028355199e0SJouni Malinen /**
8029355199e0SJouni Malinen  * cfg80211_ft_event - notify userspace about FT IE and RIC IE
8030355199e0SJouni Malinen  * @netdev: network device
8031355199e0SJouni Malinen  * @ft_event: IE information
8032355199e0SJouni Malinen  */
8033355199e0SJouni Malinen void cfg80211_ft_event(struct net_device *netdev,
8034355199e0SJouni Malinen 		       struct cfg80211_ft_event_params *ft_event);
8035355199e0SJouni Malinen 
8036355199e0SJouni Malinen /**
80370ee45355SJohannes Berg  * cfg80211_get_p2p_attr - find and copy a P2P attribute from IE buffer
80380ee45355SJohannes Berg  * @ies: the input IE buffer
80390ee45355SJohannes Berg  * @len: the input length
80400ee45355SJohannes Berg  * @attr: the attribute ID to find
80410ee45355SJohannes Berg  * @buf: output buffer, can be %NULL if the data isn't needed, e.g.
80420ee45355SJohannes Berg  *	if the function is only called to get the needed buffer size
80430ee45355SJohannes Berg  * @bufsize: size of the output buffer
80440ee45355SJohannes Berg  *
80450ee45355SJohannes Berg  * The function finds a given P2P attribute in the (vendor) IEs and
80460ee45355SJohannes Berg  * copies its contents to the given buffer.
80470ee45355SJohannes Berg  *
80480ae997dcSYacine Belkadi  * Return: A negative error code (-%EILSEQ or -%ENOENT) if the data is
80490ae997dcSYacine Belkadi  * malformed or the attribute can't be found (respectively), or the
80500ae997dcSYacine Belkadi  * length of the found attribute (which can be zero).
80510ee45355SJohannes Berg  */
8052c216e641SArend van Spriel int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len,
8053c216e641SArend van Spriel 			  enum ieee80211_p2p_attr_id attr,
8054c216e641SArend van Spriel 			  u8 *buf, unsigned int bufsize);
80550ee45355SJohannes Berg 
8056cd8f7cb4SJohannes Berg /**
805729464cccSJohannes Berg  * ieee80211_ie_split_ric - split an IE buffer according to ordering (with RIC)
805829464cccSJohannes Berg  * @ies: the IE buffer
805929464cccSJohannes Berg  * @ielen: the length of the IE buffer
806029464cccSJohannes Berg  * @ids: an array with element IDs that are allowed before
80612512b1b1SLiad Kaufman  *	the split. A WLAN_EID_EXTENSION value means that the next
80622512b1b1SLiad Kaufman  *	EID in the list is a sub-element of the EXTENSION IE.
806329464cccSJohannes Berg  * @n_ids: the size of the element ID array
806429464cccSJohannes Berg  * @after_ric: array IE types that come after the RIC element
806529464cccSJohannes Berg  * @n_after_ric: size of the @after_ric array
806629464cccSJohannes Berg  * @offset: offset where to start splitting in the buffer
806729464cccSJohannes Berg  *
806829464cccSJohannes Berg  * This function splits an IE buffer by updating the @offset
806929464cccSJohannes Berg  * variable to point to the location where the buffer should be
807029464cccSJohannes Berg  * split.
807129464cccSJohannes Berg  *
807229464cccSJohannes Berg  * It assumes that the given IE buffer is well-formed, this
807329464cccSJohannes Berg  * has to be guaranteed by the caller!
807429464cccSJohannes Berg  *
807529464cccSJohannes Berg  * It also assumes that the IEs in the buffer are ordered
807629464cccSJohannes Berg  * correctly, if not the result of using this function will not
807729464cccSJohannes Berg  * be ordered correctly either, i.e. it does no reordering.
807829464cccSJohannes Berg  *
807929464cccSJohannes Berg  * The function returns the offset where the next part of the
808029464cccSJohannes Berg  * buffer starts, which may be @ielen if the entire (remainder)
808129464cccSJohannes Berg  * of the buffer should be used.
808229464cccSJohannes Berg  */
808329464cccSJohannes Berg size_t ieee80211_ie_split_ric(const u8 *ies, size_t ielen,
808429464cccSJohannes Berg 			      const u8 *ids, int n_ids,
808529464cccSJohannes Berg 			      const u8 *after_ric, int n_after_ric,
808629464cccSJohannes Berg 			      size_t offset);
808729464cccSJohannes Berg 
808829464cccSJohannes Berg /**
808929464cccSJohannes Berg  * ieee80211_ie_split - split an IE buffer according to ordering
809029464cccSJohannes Berg  * @ies: the IE buffer
809129464cccSJohannes Berg  * @ielen: the length of the IE buffer
809229464cccSJohannes Berg  * @ids: an array with element IDs that are allowed before
80932512b1b1SLiad Kaufman  *	the split. A WLAN_EID_EXTENSION value means that the next
80942512b1b1SLiad Kaufman  *	EID in the list is a sub-element of the EXTENSION IE.
809529464cccSJohannes Berg  * @n_ids: the size of the element ID array
809629464cccSJohannes Berg  * @offset: offset where to start splitting in the buffer
809729464cccSJohannes Berg  *
809829464cccSJohannes Berg  * This function splits an IE buffer by updating the @offset
809929464cccSJohannes Berg  * variable to point to the location where the buffer should be
810029464cccSJohannes Berg  * split.
810129464cccSJohannes Berg  *
810229464cccSJohannes Berg  * It assumes that the given IE buffer is well-formed, this
810329464cccSJohannes Berg  * has to be guaranteed by the caller!
810429464cccSJohannes Berg  *
810529464cccSJohannes Berg  * It also assumes that the IEs in the buffer are ordered
810629464cccSJohannes Berg  * correctly, if not the result of using this function will not
810729464cccSJohannes Berg  * be ordered correctly either, i.e. it does no reordering.
810829464cccSJohannes Berg  *
810929464cccSJohannes Berg  * The function returns the offset where the next part of the
811029464cccSJohannes Berg  * buffer starts, which may be @ielen if the entire (remainder)
811129464cccSJohannes Berg  * of the buffer should be used.
811229464cccSJohannes Berg  */
81130483eeacSJohannes Berg static inline size_t ieee80211_ie_split(const u8 *ies, size_t ielen,
81140483eeacSJohannes Berg 					const u8 *ids, int n_ids, size_t offset)
81150483eeacSJohannes Berg {
81160483eeacSJohannes Berg 	return ieee80211_ie_split_ric(ies, ielen, ids, n_ids, NULL, 0, offset);
81170483eeacSJohannes Berg }
811829464cccSJohannes Berg 
811929464cccSJohannes Berg /**
8120cd8f7cb4SJohannes Berg  * cfg80211_report_wowlan_wakeup - report wakeup from WoWLAN
8121cd8f7cb4SJohannes Berg  * @wdev: the wireless device reporting the wakeup
8122cd8f7cb4SJohannes Berg  * @wakeup: the wakeup report
8123cd8f7cb4SJohannes Berg  * @gfp: allocation flags
8124cd8f7cb4SJohannes Berg  *
8125cd8f7cb4SJohannes Berg  * This function reports that the given device woke up. If it
8126cd8f7cb4SJohannes Berg  * caused the wakeup, report the reason(s), otherwise you may
8127cd8f7cb4SJohannes Berg  * pass %NULL as the @wakeup parameter to advertise that something
8128cd8f7cb4SJohannes Berg  * else caused the wakeup.
8129cd8f7cb4SJohannes Berg  */
8130cd8f7cb4SJohannes Berg void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev,
8131cd8f7cb4SJohannes Berg 				   struct cfg80211_wowlan_wakeup *wakeup,
8132cd8f7cb4SJohannes Berg 				   gfp_t gfp);
8133cd8f7cb4SJohannes Berg 
81345de17984SArend van Spriel /**
81355de17984SArend van Spriel  * cfg80211_crit_proto_stopped() - indicate critical protocol stopped by driver.
81365de17984SArend van Spriel  *
81375de17984SArend van Spriel  * @wdev: the wireless device for which critical protocol is stopped.
813803f831a6SRobert P. J. Day  * @gfp: allocation flags
81395de17984SArend van Spriel  *
81405de17984SArend van Spriel  * This function can be called by the driver to indicate it has reverted
81415de17984SArend van Spriel  * operation back to normal. One reason could be that the duration given
81425de17984SArend van Spriel  * by .crit_proto_start() has expired.
81435de17984SArend van Spriel  */
81445de17984SArend van Spriel void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp);
81455de17984SArend van Spriel 
8146bdfbec2dSIlan Peer /**
8147bdfbec2dSIlan Peer  * ieee80211_get_num_supported_channels - get number of channels device has
8148bdfbec2dSIlan Peer  * @wiphy: the wiphy
8149bdfbec2dSIlan Peer  *
8150bdfbec2dSIlan Peer  * Return: the number of channels supported by the device.
8151bdfbec2dSIlan Peer  */
8152bdfbec2dSIlan Peer unsigned int ieee80211_get_num_supported_channels(struct wiphy *wiphy);
8153bdfbec2dSIlan Peer 
8154cb2d956dSLuciano Coelho /**
8155cb2d956dSLuciano Coelho  * cfg80211_check_combinations - check interface combinations
8156cb2d956dSLuciano Coelho  *
8157cb2d956dSLuciano Coelho  * @wiphy: the wiphy
8158e227300cSPurushottam Kushwaha  * @params: the interface combinations parameter
8159cb2d956dSLuciano Coelho  *
8160cb2d956dSLuciano Coelho  * This function can be called by the driver to check whether a
8161cb2d956dSLuciano Coelho  * combination of interfaces and their types are allowed according to
8162cb2d956dSLuciano Coelho  * the interface combinations.
8163cb2d956dSLuciano Coelho  */
8164cb2d956dSLuciano Coelho int cfg80211_check_combinations(struct wiphy *wiphy,
8165e227300cSPurushottam Kushwaha 				struct iface_combination_params *params);
8166cb2d956dSLuciano Coelho 
816765a124ddSMichal Kazior /**
816865a124ddSMichal Kazior  * cfg80211_iter_combinations - iterate over matching combinations
816965a124ddSMichal Kazior  *
817065a124ddSMichal Kazior  * @wiphy: the wiphy
8171e227300cSPurushottam Kushwaha  * @params: the interface combinations parameter
817265a124ddSMichal Kazior  * @iter: function to call for each matching combination
817365a124ddSMichal Kazior  * @data: pointer to pass to iter function
817465a124ddSMichal Kazior  *
817565a124ddSMichal Kazior  * This function can be called by the driver to check what possible
817665a124ddSMichal Kazior  * combinations it fits in at a given moment, e.g. for channel switching
817765a124ddSMichal Kazior  * purposes.
817865a124ddSMichal Kazior  */
817965a124ddSMichal Kazior int cfg80211_iter_combinations(struct wiphy *wiphy,
8180e227300cSPurushottam Kushwaha 			       struct iface_combination_params *params,
818165a124ddSMichal Kazior 			       void (*iter)(const struct ieee80211_iface_combination *c,
818265a124ddSMichal Kazior 					    void *data),
818365a124ddSMichal Kazior 			       void *data);
818465a124ddSMichal Kazior 
8185f04c2203SMichal Kazior /*
8186f04c2203SMichal Kazior  * cfg80211_stop_iface - trigger interface disconnection
8187f04c2203SMichal Kazior  *
8188f04c2203SMichal Kazior  * @wiphy: the wiphy
8189f04c2203SMichal Kazior  * @wdev: wireless device
8190f04c2203SMichal Kazior  * @gfp: context flags
8191f04c2203SMichal Kazior  *
8192f04c2203SMichal Kazior  * Trigger interface to be stopped as if AP was stopped, IBSS/mesh left, STA
8193f04c2203SMichal Kazior  * disconnected.
8194f04c2203SMichal Kazior  *
8195f04c2203SMichal Kazior  * Note: This doesn't need any locks and is asynchronous.
8196f04c2203SMichal Kazior  */
8197f04c2203SMichal Kazior void cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev,
8198f04c2203SMichal Kazior 			 gfp_t gfp);
8199f04c2203SMichal Kazior 
8200f6837ba8SJohannes Berg /**
8201f6837ba8SJohannes Berg  * cfg80211_shutdown_all_interfaces - shut down all interfaces for a wiphy
8202f6837ba8SJohannes Berg  * @wiphy: the wiphy to shut down
8203f6837ba8SJohannes Berg  *
8204f6837ba8SJohannes Berg  * This function shuts down all interfaces belonging to this wiphy by
8205f6837ba8SJohannes Berg  * calling dev_close() (and treating non-netdev interfaces as needed).
8206f6837ba8SJohannes Berg  * It shouldn't really be used unless there are some fatal device errors
8207f6837ba8SJohannes Berg  * that really can't be recovered in any other way.
8208f6837ba8SJohannes Berg  *
8209f6837ba8SJohannes Berg  * Callers must hold the RTNL and be able to deal with callbacks into
8210f6837ba8SJohannes Berg  * the driver while the function is running.
8211f6837ba8SJohannes Berg  */
8212f6837ba8SJohannes Berg void cfg80211_shutdown_all_interfaces(struct wiphy *wiphy);
8213f6837ba8SJohannes Berg 
8214d75bb06bSGautam Kumar Shukla /**
8215d75bb06bSGautam Kumar Shukla  * wiphy_ext_feature_set - set the extended feature flag
8216d75bb06bSGautam Kumar Shukla  *
8217d75bb06bSGautam Kumar Shukla  * @wiphy: the wiphy to modify.
8218d75bb06bSGautam Kumar Shukla  * @ftidx: extended feature bit index.
8219d75bb06bSGautam Kumar Shukla  *
8220d75bb06bSGautam Kumar Shukla  * The extended features are flagged in multiple bytes (see
8221d75bb06bSGautam Kumar Shukla  * &struct wiphy.@ext_features)
8222d75bb06bSGautam Kumar Shukla  */
8223d75bb06bSGautam Kumar Shukla static inline void wiphy_ext_feature_set(struct wiphy *wiphy,
8224d75bb06bSGautam Kumar Shukla 					 enum nl80211_ext_feature_index ftidx)
8225d75bb06bSGautam Kumar Shukla {
8226d75bb06bSGautam Kumar Shukla 	u8 *ft_byte;
8227d75bb06bSGautam Kumar Shukla 
8228d75bb06bSGautam Kumar Shukla 	ft_byte = &wiphy->ext_features[ftidx / 8];
8229d75bb06bSGautam Kumar Shukla 	*ft_byte |= BIT(ftidx % 8);
8230d75bb06bSGautam Kumar Shukla }
8231d75bb06bSGautam Kumar Shukla 
8232d75bb06bSGautam Kumar Shukla /**
8233d75bb06bSGautam Kumar Shukla  * wiphy_ext_feature_isset - check the extended feature flag
8234d75bb06bSGautam Kumar Shukla  *
8235d75bb06bSGautam Kumar Shukla  * @wiphy: the wiphy to modify.
8236d75bb06bSGautam Kumar Shukla  * @ftidx: extended feature bit index.
8237d75bb06bSGautam Kumar Shukla  *
8238d75bb06bSGautam Kumar Shukla  * The extended features are flagged in multiple bytes (see
8239d75bb06bSGautam Kumar Shukla  * &struct wiphy.@ext_features)
8240d75bb06bSGautam Kumar Shukla  */
8241d75bb06bSGautam Kumar Shukla static inline bool
8242d75bb06bSGautam Kumar Shukla wiphy_ext_feature_isset(struct wiphy *wiphy,
8243d75bb06bSGautam Kumar Shukla 			enum nl80211_ext_feature_index ftidx)
8244d75bb06bSGautam Kumar Shukla {
8245d75bb06bSGautam Kumar Shukla 	u8 ft_byte;
8246d75bb06bSGautam Kumar Shukla 
8247d75bb06bSGautam Kumar Shukla 	ft_byte = wiphy->ext_features[ftidx / 8];
8248d75bb06bSGautam Kumar Shukla 	return (ft_byte & BIT(ftidx % 8)) != 0;
8249d75bb06bSGautam Kumar Shukla }
8250b7ffbd7eSJohannes Berg 
8251a442b761SAyala Beker /**
8252a442b761SAyala Beker  * cfg80211_free_nan_func - free NAN function
8253a442b761SAyala Beker  * @f: NAN function that should be freed
8254a442b761SAyala Beker  *
8255a442b761SAyala Beker  * Frees all the NAN function and all it's allocated members.
8256a442b761SAyala Beker  */
8257a442b761SAyala Beker void cfg80211_free_nan_func(struct cfg80211_nan_func *f);
8258a442b761SAyala Beker 
825950bcd31dSAyala Beker /**
826050bcd31dSAyala Beker  * struct cfg80211_nan_match_params - NAN match parameters
826150bcd31dSAyala Beker  * @type: the type of the function that triggered a match. If it is
826250bcd31dSAyala Beker  *	 %NL80211_NAN_FUNC_SUBSCRIBE it means that we replied to a subscriber.
826350bcd31dSAyala Beker  *	 If it is %NL80211_NAN_FUNC_PUBLISH, it means that we got a discovery
826450bcd31dSAyala Beker  *	 result.
826550bcd31dSAyala Beker  *	 If it is %NL80211_NAN_FUNC_FOLLOW_UP, we received a follow up.
826650bcd31dSAyala Beker  * @inst_id: the local instance id
826750bcd31dSAyala Beker  * @peer_inst_id: the instance id of the peer's function
826850bcd31dSAyala Beker  * @addr: the MAC address of the peer
826950bcd31dSAyala Beker  * @info_len: the length of the &info
827050bcd31dSAyala Beker  * @info: the Service Specific Info from the peer (if any)
827150bcd31dSAyala Beker  * @cookie: unique identifier of the corresponding function
827250bcd31dSAyala Beker  */
827350bcd31dSAyala Beker struct cfg80211_nan_match_params {
827450bcd31dSAyala Beker 	enum nl80211_nan_function_type type;
827550bcd31dSAyala Beker 	u8 inst_id;
827650bcd31dSAyala Beker 	u8 peer_inst_id;
827750bcd31dSAyala Beker 	const u8 *addr;
827850bcd31dSAyala Beker 	u8 info_len;
827950bcd31dSAyala Beker 	const u8 *info;
828050bcd31dSAyala Beker 	u64 cookie;
828150bcd31dSAyala Beker };
828250bcd31dSAyala Beker 
828350bcd31dSAyala Beker /**
828450bcd31dSAyala Beker  * cfg80211_nan_match - report a match for a NAN function.
828550bcd31dSAyala Beker  * @wdev: the wireless device reporting the match
828650bcd31dSAyala Beker  * @match: match notification parameters
828750bcd31dSAyala Beker  * @gfp: allocation flags
828850bcd31dSAyala Beker  *
828950bcd31dSAyala Beker  * This function reports that the a NAN function had a match. This
829050bcd31dSAyala Beker  * can be a subscribe that had a match or a solicited publish that
829150bcd31dSAyala Beker  * was sent. It can also be a follow up that was received.
829250bcd31dSAyala Beker  */
829350bcd31dSAyala Beker void cfg80211_nan_match(struct wireless_dev *wdev,
829450bcd31dSAyala Beker 			struct cfg80211_nan_match_params *match, gfp_t gfp);
829550bcd31dSAyala Beker 
8296368e5a7bSAyala Beker /**
8297368e5a7bSAyala Beker  * cfg80211_nan_func_terminated - notify about NAN function termination.
8298368e5a7bSAyala Beker  *
8299368e5a7bSAyala Beker  * @wdev: the wireless device reporting the match
8300368e5a7bSAyala Beker  * @inst_id: the local instance id
8301368e5a7bSAyala Beker  * @reason: termination reason (one of the NL80211_NAN_FUNC_TERM_REASON_*)
8302368e5a7bSAyala Beker  * @cookie: unique NAN function identifier
8303368e5a7bSAyala Beker  * @gfp: allocation flags
8304368e5a7bSAyala Beker  *
8305368e5a7bSAyala Beker  * This function reports that the a NAN function is terminated.
8306368e5a7bSAyala Beker  */
8307368e5a7bSAyala Beker void cfg80211_nan_func_terminated(struct wireless_dev *wdev,
8308368e5a7bSAyala Beker 				  u8 inst_id,
8309368e5a7bSAyala Beker 				  enum nl80211_nan_func_term_reason reason,
8310368e5a7bSAyala Beker 				  u64 cookie, gfp_t gfp);
8311368e5a7bSAyala Beker 
8312b7ffbd7eSJohannes Berg /* ethtool helper */
8313b7ffbd7eSJohannes Berg void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info);
8314b7ffbd7eSJohannes Berg 
831540cbfa90SSrinivas Dasari /**
831640cbfa90SSrinivas Dasari  * cfg80211_external_auth_request - userspace request for authentication
831740cbfa90SSrinivas Dasari  * @netdev: network device
831840cbfa90SSrinivas Dasari  * @params: External authentication parameters
831940cbfa90SSrinivas Dasari  * @gfp: allocation flags
832040cbfa90SSrinivas Dasari  * Returns: 0 on success, < 0 on error
832140cbfa90SSrinivas Dasari  */
832240cbfa90SSrinivas Dasari int cfg80211_external_auth_request(struct net_device *netdev,
832340cbfa90SSrinivas Dasari 				   struct cfg80211_external_auth_params *params,
832440cbfa90SSrinivas Dasari 				   gfp_t gfp);
832540cbfa90SSrinivas Dasari 
83269bb7e0f2SJohannes Berg /**
83279bb7e0f2SJohannes Berg  * cfg80211_pmsr_report - report peer measurement result data
83289bb7e0f2SJohannes Berg  * @wdev: the wireless device reporting the measurement
83299bb7e0f2SJohannes Berg  * @req: the original measurement request
83309bb7e0f2SJohannes Berg  * @result: the result data
83319bb7e0f2SJohannes Berg  * @gfp: allocation flags
83329bb7e0f2SJohannes Berg  */
83339bb7e0f2SJohannes Berg void cfg80211_pmsr_report(struct wireless_dev *wdev,
83349bb7e0f2SJohannes Berg 			  struct cfg80211_pmsr_request *req,
83359bb7e0f2SJohannes Berg 			  struct cfg80211_pmsr_result *result,
83369bb7e0f2SJohannes Berg 			  gfp_t gfp);
83379bb7e0f2SJohannes Berg 
83389bb7e0f2SJohannes Berg /**
83399bb7e0f2SJohannes Berg  * cfg80211_pmsr_complete - report peer measurement completed
83409bb7e0f2SJohannes Berg  * @wdev: the wireless device reporting the measurement
83419bb7e0f2SJohannes Berg  * @req: the original measurement request
83429bb7e0f2SJohannes Berg  * @gfp: allocation flags
83439bb7e0f2SJohannes Berg  *
83449bb7e0f2SJohannes Berg  * Report that the entire measurement completed, after this
83459bb7e0f2SJohannes Berg  * the request pointer will no longer be valid.
83469bb7e0f2SJohannes Berg  */
83479bb7e0f2SJohannes Berg void cfg80211_pmsr_complete(struct wireless_dev *wdev,
83489bb7e0f2SJohannes Berg 			    struct cfg80211_pmsr_request *req,
83499bb7e0f2SJohannes Berg 			    gfp_t gfp);
83509bb7e0f2SJohannes Berg 
8351e6f40511SManikanta Pubbisetty /**
8352e6f40511SManikanta Pubbisetty  * cfg80211_iftype_allowed - check whether the interface can be allowed
8353e6f40511SManikanta Pubbisetty  * @wiphy: the wiphy
8354e6f40511SManikanta Pubbisetty  * @iftype: interface type
8355e6f40511SManikanta Pubbisetty  * @is_4addr: use_4addr flag, must be '0' when check_swif is '1'
8356e6f40511SManikanta Pubbisetty  * @check_swif: check iftype against software interfaces
8357e6f40511SManikanta Pubbisetty  *
8358e6f40511SManikanta Pubbisetty  * Check whether the interface is allowed to operate; additionally, this API
8359e6f40511SManikanta Pubbisetty  * can be used to check iftype against the software interfaces when
8360e6f40511SManikanta Pubbisetty  * check_swif is '1'.
8361e6f40511SManikanta Pubbisetty  */
8362e6f40511SManikanta Pubbisetty bool cfg80211_iftype_allowed(struct wiphy *wiphy, enum nl80211_iftype iftype,
8363e6f40511SManikanta Pubbisetty 			     bool is_4addr, u8 check_swif);
8364e6f40511SManikanta Pubbisetty 
8365e6f40511SManikanta Pubbisetty 
8366a083ee8aSIlan Peer /**
8367a083ee8aSIlan Peer  * cfg80211_assoc_comeback - notification of association that was
8368a083ee8aSIlan Peer  * temporarly rejected with a comeback
8369a083ee8aSIlan Peer  * @netdev: network device
8370a083ee8aSIlan Peer  * @bss: the bss entry with which association is in progress.
8371a083ee8aSIlan Peer  * @timeout: timeout interval value TUs.
8372a083ee8aSIlan Peer  *
8373a083ee8aSIlan Peer  * this function may sleep. the caller must hold the corresponding wdev's mutex.
8374a083ee8aSIlan Peer  */
8375a083ee8aSIlan Peer void cfg80211_assoc_comeback(struct net_device *netdev,
8376a083ee8aSIlan Peer 			     struct cfg80211_bss *bss, u32 timeout);
8377a083ee8aSIlan Peer 
8378e1db74fcSJoe Perches /* Logging, debugging and troubleshooting/diagnostic helpers. */
8379e1db74fcSJoe Perches 
8380e1db74fcSJoe Perches /* wiphy_printk helpers, similar to dev_printk */
8381e1db74fcSJoe Perches 
8382e1db74fcSJoe Perches #define wiphy_printk(level, wiphy, format, args...)		\
83839c376639SJoe Perches 	dev_printk(level, &(wiphy)->dev, format, ##args)
8384e1db74fcSJoe Perches #define wiphy_emerg(wiphy, format, args...)			\
83859c376639SJoe Perches 	dev_emerg(&(wiphy)->dev, format, ##args)
8386e1db74fcSJoe Perches #define wiphy_alert(wiphy, format, args...)			\
83879c376639SJoe Perches 	dev_alert(&(wiphy)->dev, format, ##args)
8388e1db74fcSJoe Perches #define wiphy_crit(wiphy, format, args...)			\
83899c376639SJoe Perches 	dev_crit(&(wiphy)->dev, format, ##args)
8390e1db74fcSJoe Perches #define wiphy_err(wiphy, format, args...)			\
83919c376639SJoe Perches 	dev_err(&(wiphy)->dev, format, ##args)
8392e1db74fcSJoe Perches #define wiphy_warn(wiphy, format, args...)			\
83939c376639SJoe Perches 	dev_warn(&(wiphy)->dev, format, ##args)
8394e1db74fcSJoe Perches #define wiphy_notice(wiphy, format, args...)			\
83959c376639SJoe Perches 	dev_notice(&(wiphy)->dev, format, ##args)
8396e1db74fcSJoe Perches #define wiphy_info(wiphy, format, args...)			\
83979c376639SJoe Perches 	dev_info(&(wiphy)->dev, format, ##args)
8398761025b5SDmitry Osipenko #define wiphy_info_once(wiphy, format, args...)			\
8399761025b5SDmitry Osipenko 	dev_info_once(&(wiphy)->dev, format, ##args)
8400073730d7SJoe Perches 
8401a58d7525SStanislaw Gruszka #define wiphy_err_ratelimited(wiphy, format, args...)		\
8402a58d7525SStanislaw Gruszka 	dev_err_ratelimited(&(wiphy)->dev, format, ##args)
8403a58d7525SStanislaw Gruszka #define wiphy_warn_ratelimited(wiphy, format, args...)		\
8404a58d7525SStanislaw Gruszka 	dev_warn_ratelimited(&(wiphy)->dev, format, ##args)
8405a58d7525SStanislaw Gruszka 
84069c376639SJoe Perches #define wiphy_debug(wiphy, format, args...)			\
8407e1db74fcSJoe Perches 	wiphy_printk(KERN_DEBUG, wiphy, format, ##args)
84089c376639SJoe Perches 
8409e1db74fcSJoe Perches #define wiphy_dbg(wiphy, format, args...)			\
84109c376639SJoe Perches 	dev_dbg(&(wiphy)->dev, format, ##args)
8411e1db74fcSJoe Perches 
8412e1db74fcSJoe Perches #if defined(VERBOSE_DEBUG)
8413e1db74fcSJoe Perches #define wiphy_vdbg	wiphy_dbg
8414e1db74fcSJoe Perches #else
8415e1db74fcSJoe Perches #define wiphy_vdbg(wiphy, format, args...)				\
8416e1db74fcSJoe Perches ({									\
8417e1db74fcSJoe Perches 	if (0)								\
8418e1db74fcSJoe Perches 		wiphy_printk(KERN_DEBUG, wiphy, format, ##args);	\
8419e1db74fcSJoe Perches 	0;								\
8420e1db74fcSJoe Perches })
8421e1db74fcSJoe Perches #endif
8422e1db74fcSJoe Perches 
8423e1db74fcSJoe Perches /*
8424e1db74fcSJoe Perches  * wiphy_WARN() acts like wiphy_printk(), but with the key difference
8425e1db74fcSJoe Perches  * of using a WARN/WARN_ON to get the message out, including the
8426e1db74fcSJoe Perches  * file/line information and a backtrace.
8427e1db74fcSJoe Perches  */
8428e1db74fcSJoe Perches #define wiphy_WARN(wiphy, format, args...)			\
8429e1db74fcSJoe Perches 	WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args);
8430e1db74fcSJoe Perches 
8431cb74e977SSunil Dutt /**
8432cb74e977SSunil Dutt  * cfg80211_update_owe_info_event - Notify the peer's OWE info to user space
8433cb74e977SSunil Dutt  * @netdev: network device
8434cb74e977SSunil Dutt  * @owe_info: peer's owe info
8435cb74e977SSunil Dutt  * @gfp: allocation flags
8436cb74e977SSunil Dutt  */
8437cb74e977SSunil Dutt void cfg80211_update_owe_info_event(struct net_device *netdev,
8438cb74e977SSunil Dutt 				    struct cfg80211_update_owe_info *owe_info,
8439cb74e977SSunil Dutt 				    gfp_t gfp);
8440cb74e977SSunil Dutt 
84412f1805eaSEmmanuel Grumbach /**
84422f1805eaSEmmanuel Grumbach  * cfg80211_bss_flush - resets all the scan entries
84432f1805eaSEmmanuel Grumbach  * @wiphy: the wiphy
84442f1805eaSEmmanuel Grumbach  */
84452f1805eaSEmmanuel Grumbach void cfg80211_bss_flush(struct wiphy *wiphy);
84462f1805eaSEmmanuel Grumbach 
84470d2ab3aeSJohn Crispin /**
84480d2ab3aeSJohn Crispin  * cfg80211_bss_color_notify - notify about bss color event
84490d2ab3aeSJohn Crispin  * @dev: network device
84500d2ab3aeSJohn Crispin  * @gfp: allocation flags
84510d2ab3aeSJohn Crispin  * @cmd: the actual event we want to notify
84520d2ab3aeSJohn Crispin  * @count: the number of TBTTs until the color change happens
84530d2ab3aeSJohn Crispin  * @color_bitmap: representations of the colors that the local BSS is aware of
84540d2ab3aeSJohn Crispin  */
84550d2ab3aeSJohn Crispin int cfg80211_bss_color_notify(struct net_device *dev, gfp_t gfp,
84560d2ab3aeSJohn Crispin 			      enum nl80211_commands cmd, u8 count,
84570d2ab3aeSJohn Crispin 			      u64 color_bitmap);
84580d2ab3aeSJohn Crispin 
84590d2ab3aeSJohn Crispin /**
84600d2ab3aeSJohn Crispin  * cfg80211_obss_color_collision_notify - notify about bss color collision
84610d2ab3aeSJohn Crispin  * @dev: network device
84620d2ab3aeSJohn Crispin  * @color_bitmap: representations of the colors that the local BSS is aware of
84630d2ab3aeSJohn Crispin  */
84640d2ab3aeSJohn Crispin static inline int cfg80211_obss_color_collision_notify(struct net_device *dev,
84650d2ab3aeSJohn Crispin 						       u64 color_bitmap)
84660d2ab3aeSJohn Crispin {
84670d2ab3aeSJohn Crispin 	return cfg80211_bss_color_notify(dev, GFP_KERNEL,
84680d2ab3aeSJohn Crispin 					 NL80211_CMD_OBSS_COLOR_COLLISION,
84690d2ab3aeSJohn Crispin 					 0, color_bitmap);
84700d2ab3aeSJohn Crispin }
84710d2ab3aeSJohn Crispin 
84720d2ab3aeSJohn Crispin /**
84730d2ab3aeSJohn Crispin  * cfg80211_color_change_started_notify - notify color change start
84740d2ab3aeSJohn Crispin  * @dev: the device on which the color is switched
84750d2ab3aeSJohn Crispin  * @count: the number of TBTTs until the color change happens
84760d2ab3aeSJohn Crispin  *
84770d2ab3aeSJohn Crispin  * Inform the userspace about the color change that has started.
84780d2ab3aeSJohn Crispin  */
84790d2ab3aeSJohn Crispin static inline int cfg80211_color_change_started_notify(struct net_device *dev,
84800d2ab3aeSJohn Crispin 						       u8 count)
84810d2ab3aeSJohn Crispin {
84820d2ab3aeSJohn Crispin 	return cfg80211_bss_color_notify(dev, GFP_KERNEL,
84830d2ab3aeSJohn Crispin 					 NL80211_CMD_COLOR_CHANGE_STARTED,
84840d2ab3aeSJohn Crispin 					 count, 0);
84850d2ab3aeSJohn Crispin }
84860d2ab3aeSJohn Crispin 
84870d2ab3aeSJohn Crispin /**
84880d2ab3aeSJohn Crispin  * cfg80211_color_change_aborted_notify - notify color change abort
84890d2ab3aeSJohn Crispin  * @dev: the device on which the color is switched
84900d2ab3aeSJohn Crispin  *
84910d2ab3aeSJohn Crispin  * Inform the userspace about the color change that has aborted.
84920d2ab3aeSJohn Crispin  */
84930d2ab3aeSJohn Crispin static inline int cfg80211_color_change_aborted_notify(struct net_device *dev)
84940d2ab3aeSJohn Crispin {
84950d2ab3aeSJohn Crispin 	return cfg80211_bss_color_notify(dev, GFP_KERNEL,
84960d2ab3aeSJohn Crispin 					 NL80211_CMD_COLOR_CHANGE_ABORTED,
84970d2ab3aeSJohn Crispin 					 0, 0);
84980d2ab3aeSJohn Crispin }
84990d2ab3aeSJohn Crispin 
85000d2ab3aeSJohn Crispin /**
85010d2ab3aeSJohn Crispin  * cfg80211_color_change_notify - notify color change completion
85020d2ab3aeSJohn Crispin  * @dev: the device on which the color was switched
85030d2ab3aeSJohn Crispin  *
85040d2ab3aeSJohn Crispin  * Inform the userspace about the color change that has completed.
85050d2ab3aeSJohn Crispin  */
85060d2ab3aeSJohn Crispin static inline int cfg80211_color_change_notify(struct net_device *dev)
85070d2ab3aeSJohn Crispin {
85080d2ab3aeSJohn Crispin 	return cfg80211_bss_color_notify(dev, GFP_KERNEL,
85090d2ab3aeSJohn Crispin 					 NL80211_CMD_COLOR_CHANGE_COMPLETED,
85100d2ab3aeSJohn Crispin 					 0, 0);
85110d2ab3aeSJohn Crispin }
85120d2ab3aeSJohn Crispin 
8513704232c2SJohannes Berg #endif /* __NET_CFG80211_H */
8514