xref: /linux/include/net/cfg80211.h (revision ea7d50c925cec96b22655c4dc8672fbd59355bed)
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.
3772d8b08feSMauro Carvalho Chehab  * @bw: MCS/NSS support for 80, 160 and 320 MHz
3785cd5a8a3SIlan Peer  * @bw._80: MCS/NSS support for BW <= 80 MHz
3795cd5a8a3SIlan Peer  * @bw._160: MCS/NSS support for BW = 160 MHz
3805cd5a8a3SIlan Peer  * @bw._320: MCS/NSS support for BW = 320 MHz
3815cd5a8a3SIlan Peer  */
3825cd5a8a3SIlan Peer struct ieee80211_eht_mcs_nss_supp {
3835cd5a8a3SIlan Peer 	union {
3845cd5a8a3SIlan Peer 		struct ieee80211_eht_mcs_nss_supp_20mhz_only only_20mhz;
3855cd5a8a3SIlan Peer 		struct {
3865cd5a8a3SIlan Peer 			struct ieee80211_eht_mcs_nss_supp_bw _80;
3875cd5a8a3SIlan Peer 			struct ieee80211_eht_mcs_nss_supp_bw _160;
3885cd5a8a3SIlan Peer 			struct ieee80211_eht_mcs_nss_supp_bw _320;
3895cd5a8a3SIlan Peer 		} __packed bw;
3905cd5a8a3SIlan Peer 	} __packed;
3915cd5a8a3SIlan Peer } __packed;
3925cd5a8a3SIlan Peer 
3935cd5a8a3SIlan Peer #define IEEE80211_EHT_PPE_THRES_MAX_LEN		32
3945cd5a8a3SIlan Peer 
3955cd5a8a3SIlan Peer /**
3965cd5a8a3SIlan Peer  * struct ieee80211_sta_eht_cap - STA's EHT capabilities
3975cd5a8a3SIlan Peer  *
3985cd5a8a3SIlan Peer  * This structure describes most essential parameters needed
3995cd5a8a3SIlan Peer  * to describe 802.11be EHT capabilities for a STA.
4005cd5a8a3SIlan Peer  *
4015cd5a8a3SIlan Peer  * @has_eht: true iff EHT data is valid.
4025cd5a8a3SIlan Peer  * @eht_cap_elem: Fixed portion of the eht capabilities element.
4035cd5a8a3SIlan Peer  * @eht_mcs_nss_supp: The supported NSS/MCS combinations.
4045cd5a8a3SIlan Peer  * @eht_ppe_thres: Holds the PPE Thresholds data.
4055cd5a8a3SIlan Peer  */
4065cd5a8a3SIlan Peer struct ieee80211_sta_eht_cap {
4075cd5a8a3SIlan Peer 	bool has_eht;
4085cd5a8a3SIlan Peer 	struct ieee80211_eht_cap_elem_fixed eht_cap_elem;
4095cd5a8a3SIlan Peer 	struct ieee80211_eht_mcs_nss_supp eht_mcs_nss_supp;
4105cd5a8a3SIlan Peer 	u8 eht_ppe_thres[IEEE80211_EHT_PPE_THRES_MAX_LEN];
4115cd5a8a3SIlan Peer };
4125cd5a8a3SIlan Peer 
4135cd5a8a3SIlan Peer /**
4145d9c358dSRandy Dunlap  * struct ieee80211_sband_iftype_data - sband data per interface type
415c4cbaf79SLuca Coelho  *
416c4cbaf79SLuca Coelho  * This structure encapsulates sband data that is relevant for the
417c4cbaf79SLuca Coelho  * interface types defined in @types_mask.  Each type in the
418c4cbaf79SLuca Coelho  * @types_mask must be unique across all instances of iftype_data.
419c4cbaf79SLuca Coelho  *
420c4cbaf79SLuca Coelho  * @types_mask: interface types mask
421c4cbaf79SLuca Coelho  * @he_cap: holds the HE capabilities
42222395217SJohannes Berg  * @he_6ghz_capa: HE 6 GHz capabilities, must be filled in for a
42322395217SJohannes Berg  *	6 GHz band channel (and 0 may be valid value).
4242d8b08feSMauro Carvalho Chehab  * @eht_cap: STA's EHT capabilities
425f4f86505SJohannes Berg  * @vendor_elems: vendor element(s) to advertise
426f4f86505SJohannes Berg  * @vendor_elems.data: vendor element(s) data
427f4f86505SJohannes Berg  * @vendor_elems.len: vendor element(s) length
428c4cbaf79SLuca Coelho  */
429c4cbaf79SLuca Coelho struct ieee80211_sband_iftype_data {
430c4cbaf79SLuca Coelho 	u16 types_mask;
431c4cbaf79SLuca Coelho 	struct ieee80211_sta_he_cap he_cap;
43222395217SJohannes Berg 	struct ieee80211_he_6ghz_capa he_6ghz_capa;
4335cd5a8a3SIlan Peer 	struct ieee80211_sta_eht_cap eht_cap;
434f4f86505SJohannes Berg 	struct {
435f4f86505SJohannes Berg 		const u8 *data;
436f4f86505SJohannes Berg 		unsigned int len;
437f4f86505SJohannes Berg 	} vendor_elems;
438c4cbaf79SLuca Coelho };
439c4cbaf79SLuca Coelho 
440bf0c111eSMahesh Palivela /**
4412a38075cSAlexei Avshalom Lazar  * enum ieee80211_edmg_bw_config - allowed channel bandwidth configurations
4422a38075cSAlexei Avshalom Lazar  *
4432a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_4: 2.16GHz
4442a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_5: 2.16GHz and 4.32GHz
4452a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_6: 2.16GHz, 4.32GHz and 6.48GHz
4462a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_7: 2.16GHz, 4.32GHz, 6.48GHz and 8.64GHz
4472a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_8: 2.16GHz and 2.16GHz + 2.16GHz
4482a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_9: 2.16GHz, 4.32GHz and 2.16GHz + 2.16GHz
4492a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_10: 2.16GHz, 4.32GHz, 6.48GHz and 2.16GHz+2.16GHz
4502a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_11: 2.16GHz, 4.32GHz, 6.48GHz, 8.64GHz and
4512a38075cSAlexei Avshalom Lazar  *	2.16GHz+2.16GHz
4522a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_12: 2.16GHz, 2.16GHz + 2.16GHz and
4532a38075cSAlexei Avshalom Lazar  *	4.32GHz + 4.32GHz
4542a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_13: 2.16GHz, 4.32GHz, 2.16GHz + 2.16GHz and
4552a38075cSAlexei Avshalom Lazar  *	4.32GHz + 4.32GHz
4562a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_14: 2.16GHz, 4.32GHz, 6.48GHz, 2.16GHz + 2.16GHz
4572a38075cSAlexei Avshalom Lazar  *	and 4.32GHz + 4.32GHz
4582a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_15: 2.16GHz, 4.32GHz, 6.48GHz, 8.64GHz,
4592a38075cSAlexei Avshalom Lazar  *	2.16GHz + 2.16GHz and 4.32GHz + 4.32GHz
4602a38075cSAlexei Avshalom Lazar  */
4612a38075cSAlexei Avshalom Lazar enum ieee80211_edmg_bw_config {
4622a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_4	= 4,
4632a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_5	= 5,
4642a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_6	= 6,
4652a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_7	= 7,
4662a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_8	= 8,
4672a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_9	= 9,
4682a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_10	= 10,
4692a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_11	= 11,
4702a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_12	= 12,
4712a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_13	= 13,
4722a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_14	= 14,
4732a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_15	= 15,
4742a38075cSAlexei Avshalom Lazar };
4752a38075cSAlexei Avshalom Lazar 
4762a38075cSAlexei Avshalom Lazar /**
4772a38075cSAlexei Avshalom Lazar  * struct ieee80211_edmg - EDMG configuration
4782a38075cSAlexei Avshalom Lazar  *
4792a38075cSAlexei Avshalom Lazar  * This structure describes most essential parameters needed
4802a38075cSAlexei Avshalom Lazar  * to describe 802.11ay EDMG configuration
4812a38075cSAlexei Avshalom Lazar  *
4822a38075cSAlexei Avshalom Lazar  * @channels: bitmap that indicates the 2.16 GHz channel(s)
4832a38075cSAlexei Avshalom Lazar  *	that are allowed to be used for transmissions.
4842a38075cSAlexei Avshalom Lazar  *	Bit 0 indicates channel 1, bit 1 indicates channel 2, etc.
4852a38075cSAlexei Avshalom Lazar  *	Set to 0 indicate EDMG not supported.
4862a38075cSAlexei Avshalom Lazar  * @bw_config: Channel BW Configuration subfield encodes
4872a38075cSAlexei Avshalom Lazar  *	the allowed channel bandwidth configurations
4882a38075cSAlexei Avshalom Lazar  */
4892a38075cSAlexei Avshalom Lazar struct ieee80211_edmg {
4902a38075cSAlexei Avshalom Lazar 	u8 channels;
4912a38075cSAlexei Avshalom Lazar 	enum ieee80211_edmg_bw_config bw_config;
4922a38075cSAlexei Avshalom Lazar };
4932a38075cSAlexei Avshalom Lazar 
4942a38075cSAlexei Avshalom Lazar /**
495df78a0c0SThomas Pedersen  * struct ieee80211_sta_s1g_cap - STA's S1G capabilities
496df78a0c0SThomas Pedersen  *
497df78a0c0SThomas Pedersen  * This structure describes most essential parameters needed
498df78a0c0SThomas Pedersen  * to describe 802.11ah S1G capabilities for a STA.
499df78a0c0SThomas Pedersen  *
5002d8b08feSMauro Carvalho Chehab  * @s1g: is STA an S1G STA
501df78a0c0SThomas Pedersen  * @cap: S1G capabilities information
502df78a0c0SThomas Pedersen  * @nss_mcs: Supported NSS MCS set
503df78a0c0SThomas Pedersen  */
504df78a0c0SThomas Pedersen struct ieee80211_sta_s1g_cap {
505df78a0c0SThomas Pedersen 	bool s1g;
506df78a0c0SThomas Pedersen 	u8 cap[10]; /* use S1G_CAPAB_ */
507df78a0c0SThomas Pedersen 	u8 nss_mcs[5];
508df78a0c0SThomas Pedersen };
509df78a0c0SThomas Pedersen 
510df78a0c0SThomas Pedersen /**
511d3236553SJohannes Berg  * struct ieee80211_supported_band - frequency band definition
512d3236553SJohannes Berg  *
513d3236553SJohannes Berg  * This structure describes a frequency band a wiphy
514d3236553SJohannes Berg  * is able to operate in.
515d3236553SJohannes Berg  *
516085a6c10SRandy Dunlap  * @channels: Array of channels the hardware can operate with
517d3236553SJohannes Berg  *	in this band.
518d3236553SJohannes Berg  * @band: the band this structure represents
519d3236553SJohannes Berg  * @n_channels: Number of channels in @channels
520d3236553SJohannes Berg  * @bitrates: Array of bitrates the hardware can operate with
521d3236553SJohannes Berg  *	in this band. Must be sorted to give a valid "supported
522d3236553SJohannes Berg  *	rates" IE, i.e. CCK rates first, then OFDM.
523d3236553SJohannes Berg  * @n_bitrates: Number of bitrates in @bitrates
524abe37c4bSJohannes Berg  * @ht_cap: HT capabilities in this band
525c9a0a302SRobert P. J. Day  * @vht_cap: VHT capabilities in this band
5268a50c057SMauro Carvalho Chehab  * @s1g_cap: S1G capabilities in this band
5272a38075cSAlexei Avshalom Lazar  * @edmg_cap: EDMG capabilities in this band
5289ff167e1SJohannes Berg  * @s1g_cap: S1G capabilities in this band (S1B band only, of course)
529c4cbaf79SLuca Coelho  * @n_iftype_data: number of iftype data entries
530c4cbaf79SLuca Coelho  * @iftype_data: interface type data entries.  Note that the bits in
531c4cbaf79SLuca Coelho  *	@types_mask inside this structure cannot overlap (i.e. only
532c4cbaf79SLuca Coelho  *	one occurrence of each type is allowed across all instances of
533c4cbaf79SLuca Coelho  *	iftype_data).
534d3236553SJohannes Berg  */
535d3236553SJohannes Berg struct ieee80211_supported_band {
536d3236553SJohannes Berg 	struct ieee80211_channel *channels;
537d3236553SJohannes Berg 	struct ieee80211_rate *bitrates;
53857fbcce3SJohannes Berg 	enum nl80211_band band;
539d3236553SJohannes Berg 	int n_channels;
540d3236553SJohannes Berg 	int n_bitrates;
541d3236553SJohannes Berg 	struct ieee80211_sta_ht_cap ht_cap;
542bf0c111eSMahesh Palivela 	struct ieee80211_sta_vht_cap vht_cap;
543df78a0c0SThomas Pedersen 	struct ieee80211_sta_s1g_cap s1g_cap;
5442a38075cSAlexei Avshalom Lazar 	struct ieee80211_edmg edmg_cap;
545c4cbaf79SLuca Coelho 	u16 n_iftype_data;
546c4cbaf79SLuca Coelho 	const struct ieee80211_sband_iftype_data *iftype_data;
547d3236553SJohannes Berg };
548d3236553SJohannes Berg 
549e691ac2fSRafał Miłecki /**
550c4cbaf79SLuca Coelho  * ieee80211_get_sband_iftype_data - return sband data for a given iftype
551c4cbaf79SLuca Coelho  * @sband: the sband to search for the STA on
552c4cbaf79SLuca Coelho  * @iftype: enum nl80211_iftype
553c4cbaf79SLuca Coelho  *
554c4cbaf79SLuca Coelho  * Return: pointer to struct ieee80211_sband_iftype_data, or NULL is none found
555c4cbaf79SLuca Coelho  */
556c4cbaf79SLuca Coelho static inline const struct ieee80211_sband_iftype_data *
557c4cbaf79SLuca Coelho ieee80211_get_sband_iftype_data(const struct ieee80211_supported_band *sband,
558c4cbaf79SLuca Coelho 				u8 iftype)
559c4cbaf79SLuca Coelho {
560c4cbaf79SLuca Coelho 	int i;
561c4cbaf79SLuca Coelho 
562c4cbaf79SLuca Coelho 	if (WARN_ON(iftype >= NL80211_IFTYPE_MAX))
563c4cbaf79SLuca Coelho 		return NULL;
564c4cbaf79SLuca Coelho 
565c4cbaf79SLuca Coelho 	for (i = 0; i < sband->n_iftype_data; i++)  {
566c4cbaf79SLuca Coelho 		const struct ieee80211_sband_iftype_data *data =
567c4cbaf79SLuca Coelho 			&sband->iftype_data[i];
568c4cbaf79SLuca Coelho 
569c4cbaf79SLuca Coelho 		if (data->types_mask & BIT(iftype))
570c4cbaf79SLuca Coelho 			return data;
571c4cbaf79SLuca Coelho 	}
572c4cbaf79SLuca Coelho 
573c4cbaf79SLuca Coelho 	return NULL;
574c4cbaf79SLuca Coelho }
575c4cbaf79SLuca Coelho 
576c4cbaf79SLuca Coelho /**
577d7edf40cSJohn Crispin  * ieee80211_get_he_iftype_cap - return HE capabilities for an sband's iftype
578d7edf40cSJohn Crispin  * @sband: the sband to search for the iftype on
579d7edf40cSJohn Crispin  * @iftype: enum nl80211_iftype
580d7edf40cSJohn Crispin  *
581d7edf40cSJohn Crispin  * Return: pointer to the struct ieee80211_sta_he_cap, or NULL is none found
582d7edf40cSJohn Crispin  */
583d7edf40cSJohn Crispin static inline const struct ieee80211_sta_he_cap *
584d7edf40cSJohn Crispin ieee80211_get_he_iftype_cap(const struct ieee80211_supported_band *sband,
585d7edf40cSJohn Crispin 			    u8 iftype)
586d7edf40cSJohn Crispin {
587d7edf40cSJohn Crispin 	const struct ieee80211_sband_iftype_data *data =
588d7edf40cSJohn Crispin 		ieee80211_get_sband_iftype_data(sband, iftype);
589d7edf40cSJohn Crispin 
590d7edf40cSJohn Crispin 	if (data && data->he_cap.has_he)
591d7edf40cSJohn Crispin 		return &data->he_cap;
592d7edf40cSJohn Crispin 
593d7edf40cSJohn Crispin 	return NULL;
594d7edf40cSJohn Crispin }
595d7edf40cSJohn Crispin 
596d7edf40cSJohn Crispin /**
5972ad2274cSIlan Peer  * ieee80211_get_he_6ghz_capa - return HE 6 GHz capabilities
5982ad2274cSIlan Peer  * @sband: the sband to search for the STA on
5992ad2274cSIlan Peer  * @iftype: the iftype to search for
6002ad2274cSIlan Peer  *
6012ad2274cSIlan Peer  * Return: the 6GHz capabilities
6022ad2274cSIlan Peer  */
6032ad2274cSIlan Peer static inline __le16
6042ad2274cSIlan Peer ieee80211_get_he_6ghz_capa(const struct ieee80211_supported_band *sband,
6052ad2274cSIlan Peer 			   enum nl80211_iftype iftype)
6062ad2274cSIlan Peer {
6072ad2274cSIlan Peer 	const struct ieee80211_sband_iftype_data *data =
6082ad2274cSIlan Peer 		ieee80211_get_sband_iftype_data(sband, iftype);
6092ad2274cSIlan Peer 
6102ad2274cSIlan Peer 	if (WARN_ON(!data || !data->he_cap.has_he))
6112ad2274cSIlan Peer 		return 0;
6122ad2274cSIlan Peer 
6132ad2274cSIlan Peer 	return data->he_6ghz_capa.capa;
6142ad2274cSIlan Peer }
6152ad2274cSIlan Peer 
6162ad2274cSIlan Peer /**
6175cd5a8a3SIlan Peer  * ieee80211_get_eht_iftype_cap - return ETH capabilities for an sband's iftype
6185cd5a8a3SIlan Peer  * @sband: the sband to search for the iftype on
6195cd5a8a3SIlan Peer  * @iftype: enum nl80211_iftype
6205cd5a8a3SIlan Peer  *
6215cd5a8a3SIlan Peer  * Return: pointer to the struct ieee80211_sta_eht_cap, or NULL is none found
6225cd5a8a3SIlan Peer  */
6235cd5a8a3SIlan Peer static inline const struct ieee80211_sta_eht_cap *
6245cd5a8a3SIlan Peer ieee80211_get_eht_iftype_cap(const struct ieee80211_supported_band *sband,
6255cd5a8a3SIlan Peer 			     enum nl80211_iftype iftype)
6265cd5a8a3SIlan Peer {
6275cd5a8a3SIlan Peer 	const struct ieee80211_sband_iftype_data *data =
6285cd5a8a3SIlan Peer 		ieee80211_get_sband_iftype_data(sband, iftype);
6295cd5a8a3SIlan Peer 
6305cd5a8a3SIlan Peer 	if (data && data->eht_cap.has_eht)
6315cd5a8a3SIlan Peer 		return &data->eht_cap;
6325cd5a8a3SIlan Peer 
6335cd5a8a3SIlan Peer 	return NULL;
6345cd5a8a3SIlan Peer }
6355cd5a8a3SIlan Peer 
6365cd5a8a3SIlan Peer /**
637e691ac2fSRafał Miłecki  * wiphy_read_of_freq_limits - read frequency limits from device tree
638e691ac2fSRafał Miłecki  *
639e691ac2fSRafał Miłecki  * @wiphy: the wireless device to get extra limits for
640e691ac2fSRafał Miłecki  *
641e691ac2fSRafał Miłecki  * Some devices may have extra limitations specified in DT. This may be useful
642e691ac2fSRafał Miłecki  * for chipsets that normally support more bands but are limited due to board
643e691ac2fSRafał Miłecki  * design (e.g. by antennas or external power amplifier).
644e691ac2fSRafał Miłecki  *
645e691ac2fSRafał Miłecki  * This function reads info from DT and uses it to *modify* channels (disable
646e691ac2fSRafał Miłecki  * unavailable ones). It's usually a *bad* idea to use it in drivers with
647e691ac2fSRafał Miłecki  * shared channel data as DT limitations are device specific. You should make
648e691ac2fSRafał Miłecki  * sure to call it only if channels in wiphy are copied and can be modified
649e691ac2fSRafał Miłecki  * without affecting other devices.
650e691ac2fSRafał Miłecki  *
651e691ac2fSRafał Miłecki  * As this function access device node it has to be called after set_wiphy_dev.
652e691ac2fSRafał Miłecki  * It also modifies channels so they have to be set first.
653e691ac2fSRafał Miłecki  * If using this helper, call it before wiphy_register().
654e691ac2fSRafał Miłecki  */
655e691ac2fSRafał Miłecki #ifdef CONFIG_OF
656e691ac2fSRafał Miłecki void wiphy_read_of_freq_limits(struct wiphy *wiphy);
657e691ac2fSRafał Miłecki #else /* CONFIG_OF */
658e691ac2fSRafał Miłecki static inline void wiphy_read_of_freq_limits(struct wiphy *wiphy)
659e691ac2fSRafał Miłecki {
660e691ac2fSRafał Miłecki }
661e691ac2fSRafał Miłecki #endif /* !CONFIG_OF */
662e691ac2fSRafał Miłecki 
663e691ac2fSRafał Miłecki 
664d3236553SJohannes Berg /*
665d3236553SJohannes Berg  * Wireless hardware/device configuration structures and methods
666704232c2SJohannes Berg  */
667704232c2SJohannes Berg 
6682ec600d6SLuis Carlos Cobo /**
669d70e9693SJohannes Berg  * DOC: Actions and configuration
670d70e9693SJohannes Berg  *
671d70e9693SJohannes Berg  * Each wireless device and each virtual interface offer a set of configuration
672d70e9693SJohannes Berg  * operations and other actions that are invoked by userspace. Each of these
673d70e9693SJohannes Berg  * actions is described in the operations structure, and the parameters these
674d70e9693SJohannes Berg  * operations use are described separately.
675d70e9693SJohannes Berg  *
676d70e9693SJohannes Berg  * Additionally, some operations are asynchronous and expect to get status
677d70e9693SJohannes Berg  * information via some functions that drivers need to call.
678d70e9693SJohannes Berg  *
679d70e9693SJohannes Berg  * Scanning and BSS list handling with its associated functionality is described
680d70e9693SJohannes Berg  * in a separate chapter.
681d70e9693SJohannes Berg  */
682d70e9693SJohannes Berg 
683c6e6a0c8SAviya Erenfeld #define VHT_MUMIMO_GROUPS_DATA_LEN (WLAN_MEMBERSHIP_LEN +\
684c6e6a0c8SAviya Erenfeld 				    WLAN_USER_POSITION_LEN)
685c6e6a0c8SAviya Erenfeld 
686d70e9693SJohannes Berg /**
6872ec600d6SLuis Carlos Cobo  * struct vif_params - describes virtual interface parameters
688818a986eSJohannes Berg  * @flags: monitor interface flags, unchanged if 0, otherwise
689818a986eSJohannes Berg  *	%MONITOR_FLAG_CHANGED will be set
6908b787643SFelix Fietkau  * @use_4addr: use 4-address frames
691e8f479b1SBen Greear  * @macaddr: address to use for this virtual interface.
692e8f479b1SBen Greear  *	If this parameter is set to zero address the driver may
693e8f479b1SBen Greear  *	determine the address as needed.
694e8f479b1SBen Greear  *	This feature is only fully supported by drivers that enable the
695e8f479b1SBen Greear  *	%NL80211_FEATURE_MAC_ON_CREATE flag.  Others may support creating
696e8f479b1SBen Greear  **	only p2p devices with specified MAC.
697b0265024SJohannes Berg  * @vht_mumimo_groups: MU-MIMO groupID, used for monitoring MU-MIMO packets
698b0265024SJohannes Berg  *	belonging to that MU-MIMO groupID; %NULL if not changed
699b0265024SJohannes Berg  * @vht_mumimo_follow_addr: MU-MIMO follow address, used for monitoring
700b0265024SJohannes Berg  *	MU-MIMO packets going to the specified station; %NULL if not changed
7012ec600d6SLuis Carlos Cobo  */
7022ec600d6SLuis Carlos Cobo struct vif_params {
703818a986eSJohannes Berg 	u32 flags;
7048b787643SFelix Fietkau 	int use_4addr;
7051c18f145SArend van Spriel 	u8 macaddr[ETH_ALEN];
706b0265024SJohannes Berg 	const u8 *vht_mumimo_groups;
707b0265024SJohannes Berg 	const u8 *vht_mumimo_follow_addr;
7082ec600d6SLuis Carlos Cobo };
7092ec600d6SLuis Carlos Cobo 
71041ade00fSJohannes Berg /**
71141ade00fSJohannes Berg  * struct key_params - key information
71241ade00fSJohannes Berg  *
71341ade00fSJohannes Berg  * Information about a key
71441ade00fSJohannes Berg  *
71541ade00fSJohannes Berg  * @key: key material
71641ade00fSJohannes Berg  * @key_len: length of key material
71741ade00fSJohannes Berg  * @cipher: cipher suite selector
71841ade00fSJohannes Berg  * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used
71941ade00fSJohannes Berg  *	with the get_key() callback, must be in little endian,
72041ade00fSJohannes Berg  *	length given by @seq_len.
721abe37c4bSJohannes Berg  * @seq_len: length of @seq.
72214f34e36SGurumoorthi Gnanasambandhan  * @vlan_id: vlan_id for VLAN group key (if nonzero)
7236cdd3979SAlexander Wetzel  * @mode: key install mode (RX_TX, NO_TX or SET_TX)
72441ade00fSJohannes Berg  */
72541ade00fSJohannes Berg struct key_params {
726c1e5f471SJohannes Berg 	const u8 *key;
727c1e5f471SJohannes Berg 	const u8 *seq;
72841ade00fSJohannes Berg 	int key_len;
72941ade00fSJohannes Berg 	int seq_len;
73014f34e36SGurumoorthi Gnanasambandhan 	u16 vlan_id;
73141ade00fSJohannes Berg 	u32 cipher;
7326cdd3979SAlexander Wetzel 	enum nl80211_key_mode mode;
73341ade00fSJohannes Berg };
73441ade00fSJohannes Berg 
735ed1b6cc7SJohannes Berg /**
736683b6d3bSJohannes Berg  * struct cfg80211_chan_def - channel definition
737683b6d3bSJohannes Berg  * @chan: the (control) channel
7383d9d1d66SJohannes Berg  * @width: channel width
7393d9d1d66SJohannes Berg  * @center_freq1: center frequency of first segment
7403d9d1d66SJohannes Berg  * @center_freq2: center frequency of second segment
7413d9d1d66SJohannes Berg  *	(only with 80+80 MHz)
7422a38075cSAlexei Avshalom Lazar  * @edmg: define the EDMG channels configuration.
7432a38075cSAlexei Avshalom Lazar  *	If edmg is requested (i.e. the .channels member is non-zero),
7442a38075cSAlexei Avshalom Lazar  *	chan will define the primary channel and all other
7452a38075cSAlexei Avshalom Lazar  *	parameters are ignored.
746934f4c7dSThomas Pedersen  * @freq1_offset: offset from @center_freq1, in KHz
747683b6d3bSJohannes Berg  */
748683b6d3bSJohannes Berg struct cfg80211_chan_def {
749683b6d3bSJohannes Berg 	struct ieee80211_channel *chan;
7503d9d1d66SJohannes Berg 	enum nl80211_chan_width width;
7513d9d1d66SJohannes Berg 	u32 center_freq1;
7523d9d1d66SJohannes Berg 	u32 center_freq2;
7532a38075cSAlexei Avshalom Lazar 	struct ieee80211_edmg edmg;
754934f4c7dSThomas Pedersen 	u16 freq1_offset;
755683b6d3bSJohannes Berg };
756683b6d3bSJohannes Berg 
7579a5f6488STamizh Chelvam /*
7589a5f6488STamizh Chelvam  * cfg80211_bitrate_mask - masks for bitrate control
7599a5f6488STamizh Chelvam  */
7609a5f6488STamizh Chelvam struct cfg80211_bitrate_mask {
7619a5f6488STamizh Chelvam 	struct {
7629a5f6488STamizh Chelvam 		u32 legacy;
7639a5f6488STamizh Chelvam 		u8 ht_mcs[IEEE80211_HT_MCS_MASK_LEN];
7649a5f6488STamizh Chelvam 		u16 vht_mcs[NL80211_VHT_NSS_MAX];
765eb89a6a6SMiles Hu 		u16 he_mcs[NL80211_HE_NSS_MAX];
7669a5f6488STamizh Chelvam 		enum nl80211_txrate_gi gi;
767eb89a6a6SMiles Hu 		enum nl80211_he_gi he_gi;
768eb89a6a6SMiles Hu 		enum nl80211_he_ltf he_ltf;
7699a5f6488STamizh Chelvam 	} control[NUM_NL80211_BANDS];
7709a5f6488STamizh Chelvam };
7719a5f6488STamizh Chelvam 
7729a5f6488STamizh Chelvam 
77377f576deSTamizh chelvam /**
7743710a8a6SJohannes Berg  * struct cfg80211_tid_cfg - TID specific configuration
77577f576deSTamizh chelvam  * @config_override: Flag to notify driver to reset TID configuration
77677f576deSTamizh chelvam  *	of the peer.
7773710a8a6SJohannes Berg  * @tids: bitmap of TIDs to modify
7783710a8a6SJohannes Berg  * @mask: bitmap of attributes indicating which parameter changed,
7793710a8a6SJohannes Berg  *	similar to &nl80211_tid_config_supp.
78077f576deSTamizh chelvam  * @noack: noack configuration value for the TID
7816a21d16cSTamizh chelvam  * @retry_long: retry count value
7826a21d16cSTamizh chelvam  * @retry_short: retry count value
78333462e68SSergey Matyukevich  * @ampdu: Enable/Disable MPDU aggregation
78404f7d142STamizh chelvam  * @rtscts: Enable/Disable RTS/CTS
78533462e68SSergey Matyukevich  * @amsdu: Enable/Disable MSDU aggregation
7869a5f6488STamizh Chelvam  * @txrate_type: Tx bitrate mask type
7879a5f6488STamizh Chelvam  * @txrate_mask: Tx bitrate to be applied for the TID
78877f576deSTamizh chelvam  */
7893710a8a6SJohannes Berg struct cfg80211_tid_cfg {
79077f576deSTamizh chelvam 	bool config_override;
7913710a8a6SJohannes Berg 	u8 tids;
7922d5d9b7fSSergey Matyukevich 	u64 mask;
79377f576deSTamizh chelvam 	enum nl80211_tid_config noack;
7946a21d16cSTamizh chelvam 	u8 retry_long, retry_short;
795ade274b2STamizh chelvam 	enum nl80211_tid_config ampdu;
79604f7d142STamizh chelvam 	enum nl80211_tid_config rtscts;
79733462e68SSergey Matyukevich 	enum nl80211_tid_config amsdu;
7989a5f6488STamizh Chelvam 	enum nl80211_tx_rate_setting txrate_type;
7999a5f6488STamizh Chelvam 	struct cfg80211_bitrate_mask txrate_mask;
80077f576deSTamizh chelvam };
80177f576deSTamizh chelvam 
80277f576deSTamizh chelvam /**
8033710a8a6SJohannes Berg  * struct cfg80211_tid_config - TID configuration
80477f576deSTamizh chelvam  * @peer: Station's MAC address
80577f576deSTamizh chelvam  * @n_tid_conf: Number of TID specific configurations to be applied
80677f576deSTamizh chelvam  * @tid_conf: Configuration change info
80777f576deSTamizh chelvam  */
8083710a8a6SJohannes Berg struct cfg80211_tid_config {
80977f576deSTamizh chelvam 	const u8 *peer;
81077f576deSTamizh chelvam 	u32 n_tid_conf;
8113710a8a6SJohannes Berg 	struct cfg80211_tid_cfg tid_conf[];
81277f576deSTamizh chelvam };
81377f576deSTamizh chelvam 
8143d9d1d66SJohannes Berg /**
815e306784aSSubrat Mishra  * struct cfg80211_fils_aad - FILS AAD data
816e306784aSSubrat Mishra  * @macaddr: STA MAC address
817e306784aSSubrat Mishra  * @kek: FILS KEK
818e306784aSSubrat Mishra  * @kek_len: FILS KEK length
819e306784aSSubrat Mishra  * @snonce: STA Nonce
820e306784aSSubrat Mishra  * @anonce: AP Nonce
821e306784aSSubrat Mishra  */
822e306784aSSubrat Mishra struct cfg80211_fils_aad {
823e306784aSSubrat Mishra 	const u8 *macaddr;
824e306784aSSubrat Mishra 	const u8 *kek;
825e306784aSSubrat Mishra 	u8 kek_len;
826e306784aSSubrat Mishra 	const u8 *snonce;
827e306784aSSubrat Mishra 	const u8 *anonce;
828e306784aSSubrat Mishra };
829e306784aSSubrat Mishra 
830e306784aSSubrat Mishra /**
8313d9d1d66SJohannes Berg  * cfg80211_get_chandef_type - return old channel type from chandef
8323d9d1d66SJohannes Berg  * @chandef: the channel definition
8333d9d1d66SJohannes Berg  *
8340ae997dcSYacine Belkadi  * Return: The old channel type (NOHT, HT20, HT40+/-) from a given
8353d9d1d66SJohannes Berg  * chandef, which must have a bandwidth allowing this conversion.
8363d9d1d66SJohannes Berg  */
837683b6d3bSJohannes Berg static inline enum nl80211_channel_type
838683b6d3bSJohannes Berg cfg80211_get_chandef_type(const struct cfg80211_chan_def *chandef)
839683b6d3bSJohannes Berg {
8403d9d1d66SJohannes Berg 	switch (chandef->width) {
8413d9d1d66SJohannes Berg 	case NL80211_CHAN_WIDTH_20_NOHT:
8423d9d1d66SJohannes Berg 		return NL80211_CHAN_NO_HT;
8433d9d1d66SJohannes Berg 	case NL80211_CHAN_WIDTH_20:
8443d9d1d66SJohannes Berg 		return NL80211_CHAN_HT20;
8453d9d1d66SJohannes Berg 	case NL80211_CHAN_WIDTH_40:
8463d9d1d66SJohannes Berg 		if (chandef->center_freq1 > chandef->chan->center_freq)
8473d9d1d66SJohannes Berg 			return NL80211_CHAN_HT40PLUS;
8483d9d1d66SJohannes Berg 		return NL80211_CHAN_HT40MINUS;
8493d9d1d66SJohannes Berg 	default:
8503d9d1d66SJohannes Berg 		WARN_ON(1);
8513d9d1d66SJohannes Berg 		return NL80211_CHAN_NO_HT;
852683b6d3bSJohannes Berg 	}
8533d9d1d66SJohannes Berg }
8543d9d1d66SJohannes Berg 
8553d9d1d66SJohannes Berg /**
8563d9d1d66SJohannes Berg  * cfg80211_chandef_create - create channel definition using channel type
8573d9d1d66SJohannes Berg  * @chandef: the channel definition struct to fill
8583d9d1d66SJohannes Berg  * @channel: the control channel
8593d9d1d66SJohannes Berg  * @chantype: the channel type
8603d9d1d66SJohannes Berg  *
8613d9d1d66SJohannes Berg  * Given a channel type, create a channel definition.
8623d9d1d66SJohannes Berg  */
8633d9d1d66SJohannes Berg void cfg80211_chandef_create(struct cfg80211_chan_def *chandef,
8643d9d1d66SJohannes Berg 			     struct ieee80211_channel *channel,
8653d9d1d66SJohannes Berg 			     enum nl80211_channel_type chantype);
8663d9d1d66SJohannes Berg 
8673d9d1d66SJohannes Berg /**
8683d9d1d66SJohannes Berg  * cfg80211_chandef_identical - check if two channel definitions are identical
8693d9d1d66SJohannes Berg  * @chandef1: first channel definition
8703d9d1d66SJohannes Berg  * @chandef2: second channel definition
8713d9d1d66SJohannes Berg  *
8720ae997dcSYacine Belkadi  * Return: %true if the channels defined by the channel definitions are
8733d9d1d66SJohannes Berg  * identical, %false otherwise.
8743d9d1d66SJohannes Berg  */
8753d9d1d66SJohannes Berg static inline bool
8763d9d1d66SJohannes Berg cfg80211_chandef_identical(const struct cfg80211_chan_def *chandef1,
8773d9d1d66SJohannes Berg 			   const struct cfg80211_chan_def *chandef2)
8783d9d1d66SJohannes Berg {
8793d9d1d66SJohannes Berg 	return (chandef1->chan == chandef2->chan &&
8803d9d1d66SJohannes Berg 		chandef1->width == chandef2->width &&
8813d9d1d66SJohannes Berg 		chandef1->center_freq1 == chandef2->center_freq1 &&
882934f4c7dSThomas Pedersen 		chandef1->freq1_offset == chandef2->freq1_offset &&
8833d9d1d66SJohannes Berg 		chandef1->center_freq2 == chandef2->center_freq2);
8843d9d1d66SJohannes Berg }
8853d9d1d66SJohannes Berg 
8863d9d1d66SJohannes Berg /**
8872a38075cSAlexei Avshalom Lazar  * cfg80211_chandef_is_edmg - check if chandef represents an EDMG channel
8882a38075cSAlexei Avshalom Lazar  *
8892a38075cSAlexei Avshalom Lazar  * @chandef: the channel definition
8902a38075cSAlexei Avshalom Lazar  *
8912a38075cSAlexei Avshalom Lazar  * Return: %true if EDMG defined, %false otherwise.
8922a38075cSAlexei Avshalom Lazar  */
8932a38075cSAlexei Avshalom Lazar static inline bool
8942a38075cSAlexei Avshalom Lazar cfg80211_chandef_is_edmg(const struct cfg80211_chan_def *chandef)
8952a38075cSAlexei Avshalom Lazar {
8962a38075cSAlexei Avshalom Lazar 	return chandef->edmg.channels || chandef->edmg.bw_config;
8972a38075cSAlexei Avshalom Lazar }
8982a38075cSAlexei Avshalom Lazar 
8992a38075cSAlexei Avshalom Lazar /**
9003d9d1d66SJohannes Berg  * cfg80211_chandef_compatible - check if two channel definitions are compatible
9013d9d1d66SJohannes Berg  * @chandef1: first channel definition
9023d9d1d66SJohannes Berg  * @chandef2: second channel definition
9033d9d1d66SJohannes Berg  *
9040ae997dcSYacine Belkadi  * Return: %NULL if the given channel definitions are incompatible,
9053d9d1d66SJohannes Berg  * chandef1 or chandef2 otherwise.
9063d9d1d66SJohannes Berg  */
9073d9d1d66SJohannes Berg const struct cfg80211_chan_def *
9083d9d1d66SJohannes Berg cfg80211_chandef_compatible(const struct cfg80211_chan_def *chandef1,
9093d9d1d66SJohannes Berg 			    const struct cfg80211_chan_def *chandef2);
910683b6d3bSJohannes Berg 
911683b6d3bSJohannes Berg /**
9129f5e8f6eSJohannes Berg  * cfg80211_chandef_valid - check if a channel definition is valid
9139f5e8f6eSJohannes Berg  * @chandef: the channel definition to check
9140ae997dcSYacine Belkadi  * Return: %true if the channel definition is valid. %false otherwise.
9159f5e8f6eSJohannes Berg  */
9169f5e8f6eSJohannes Berg bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef);
9179f5e8f6eSJohannes Berg 
9189f5e8f6eSJohannes Berg /**
9199f5e8f6eSJohannes Berg  * cfg80211_chandef_usable - check if secondary channels can be used
9209f5e8f6eSJohannes Berg  * @wiphy: the wiphy to validate against
9219f5e8f6eSJohannes Berg  * @chandef: the channel definition to check
9220ae997dcSYacine Belkadi  * @prohibited_flags: the regulatory channel flags that must not be set
9230ae997dcSYacine Belkadi  * Return: %true if secondary channels are usable. %false otherwise.
9249f5e8f6eSJohannes Berg  */
9259f5e8f6eSJohannes Berg bool cfg80211_chandef_usable(struct wiphy *wiphy,
9269f5e8f6eSJohannes Berg 			     const struct cfg80211_chan_def *chandef,
9279f5e8f6eSJohannes Berg 			     u32 prohibited_flags);
9289f5e8f6eSJohannes Berg 
9299f5e8f6eSJohannes Berg /**
930774f0734SSimon Wunderlich  * cfg80211_chandef_dfs_required - checks if radar detection is required
931774f0734SSimon Wunderlich  * @wiphy: the wiphy to validate against
932774f0734SSimon Wunderlich  * @chandef: the channel definition to check
9332beb6dabSLuciano Coelho  * @iftype: the interface type as specified in &enum nl80211_iftype
9342beb6dabSLuciano Coelho  * Returns:
9352beb6dabSLuciano Coelho  *	1 if radar detection is required, 0 if it is not, < 0 on error
936774f0734SSimon Wunderlich  */
937774f0734SSimon Wunderlich int cfg80211_chandef_dfs_required(struct wiphy *wiphy,
9382beb6dabSLuciano Coelho 				  const struct cfg80211_chan_def *chandef,
939c3d62036SLuciano Coelho 				  enum nl80211_iftype iftype);
940774f0734SSimon Wunderlich 
941774f0734SSimon Wunderlich /**
94219654a61SJohannes Berg  * ieee80211_chanwidth_rate_flags - return rate flags for channel width
94319654a61SJohannes Berg  * @width: the channel width of the channel
94430e74732SSimon Wunderlich  *
94530e74732SSimon Wunderlich  * In some channel types, not all rates may be used - for example CCK
94630e74732SSimon Wunderlich  * rates may not be used in 5/10 MHz channels.
94730e74732SSimon Wunderlich  *
94819654a61SJohannes Berg  * Returns: rate flags which apply for this channel width
94930e74732SSimon Wunderlich  */
95030e74732SSimon Wunderlich static inline enum ieee80211_rate_flags
95119654a61SJohannes Berg ieee80211_chanwidth_rate_flags(enum nl80211_chan_width width)
95230e74732SSimon Wunderlich {
95319654a61SJohannes Berg 	switch (width) {
95430e74732SSimon Wunderlich 	case NL80211_CHAN_WIDTH_5:
95530e74732SSimon Wunderlich 		return IEEE80211_RATE_SUPPORTS_5MHZ;
95630e74732SSimon Wunderlich 	case NL80211_CHAN_WIDTH_10:
95730e74732SSimon Wunderlich 		return IEEE80211_RATE_SUPPORTS_10MHZ;
95830e74732SSimon Wunderlich 	default:
95930e74732SSimon Wunderlich 		break;
96030e74732SSimon Wunderlich 	}
96130e74732SSimon Wunderlich 	return 0;
96230e74732SSimon Wunderlich }
96330e74732SSimon Wunderlich 
96430e74732SSimon Wunderlich /**
96519654a61SJohannes Berg  * ieee80211_chandef_rate_flags - returns rate flags for a channel
96619654a61SJohannes Berg  * @chandef: channel definition for the channel
96719654a61SJohannes Berg  *
96819654a61SJohannes Berg  * See ieee80211_chanwidth_rate_flags().
96919654a61SJohannes Berg  *
97019654a61SJohannes Berg  * Returns: rate flags which apply for this channel
97119654a61SJohannes Berg  */
97219654a61SJohannes Berg static inline enum ieee80211_rate_flags
97319654a61SJohannes Berg ieee80211_chandef_rate_flags(struct cfg80211_chan_def *chandef)
97419654a61SJohannes Berg {
97519654a61SJohannes Berg 	return ieee80211_chanwidth_rate_flags(chandef->width);
97619654a61SJohannes Berg }
97719654a61SJohannes Berg 
97819654a61SJohannes Berg /**
9790430c883SSimon Wunderlich  * ieee80211_chandef_max_power - maximum transmission power for the chandef
9800430c883SSimon Wunderlich  *
9810430c883SSimon Wunderlich  * In some regulations, the transmit power may depend on the configured channel
9820430c883SSimon Wunderlich  * bandwidth which may be defined as dBm/MHz. This function returns the actual
9830430c883SSimon Wunderlich  * max_power for non-standard (20 MHz) channels.
9840430c883SSimon Wunderlich  *
9850430c883SSimon Wunderlich  * @chandef: channel definition for the channel
9860430c883SSimon Wunderlich  *
9870430c883SSimon Wunderlich  * Returns: maximum allowed transmission power in dBm for the chandef
9880430c883SSimon Wunderlich  */
9890430c883SSimon Wunderlich static inline int
9900430c883SSimon Wunderlich ieee80211_chandef_max_power(struct cfg80211_chan_def *chandef)
9910430c883SSimon Wunderlich {
9920430c883SSimon Wunderlich 	switch (chandef->width) {
9930430c883SSimon Wunderlich 	case NL80211_CHAN_WIDTH_5:
9940430c883SSimon Wunderlich 		return min(chandef->chan->max_reg_power - 6,
9950430c883SSimon Wunderlich 			   chandef->chan->max_power);
9960430c883SSimon Wunderlich 	case NL80211_CHAN_WIDTH_10:
9970430c883SSimon Wunderlich 		return min(chandef->chan->max_reg_power - 3,
9980430c883SSimon Wunderlich 			   chandef->chan->max_power);
9990430c883SSimon Wunderlich 	default:
10000430c883SSimon Wunderlich 		break;
10010430c883SSimon Wunderlich 	}
10020430c883SSimon Wunderlich 	return chandef->chan->max_power;
10030430c883SSimon Wunderlich }
10040430c883SSimon Wunderlich 
10050430c883SSimon Wunderlich /**
1006be989891SJohannes Berg  * cfg80211_any_usable_channels - check for usable channels
1007be989891SJohannes Berg  * @wiphy: the wiphy to check for
1008be989891SJohannes Berg  * @band_mask: which bands to check on
1009be989891SJohannes Berg  * @prohibited_flags: which channels to not consider usable,
1010be989891SJohannes Berg  *	%IEEE80211_CHAN_DISABLED is always taken into account
1011be989891SJohannes Berg  */
1012be989891SJohannes Berg bool cfg80211_any_usable_channels(struct wiphy *wiphy,
1013be989891SJohannes Berg 				  unsigned long band_mask,
1014be989891SJohannes Berg 				  u32 prohibited_flags);
1015be989891SJohannes Berg 
1016be989891SJohannes Berg /**
101761fa713cSHolger Schurig  * enum survey_info_flags - survey information flags
101861fa713cSHolger Schurig  *
1019abe37c4bSJohannes Berg  * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in
102017e5a808SFelix Fietkau  * @SURVEY_INFO_IN_USE: channel is currently being used
10214ed20bebSJohannes Berg  * @SURVEY_INFO_TIME: active time (in ms) was filled in
10224ed20bebSJohannes Berg  * @SURVEY_INFO_TIME_BUSY: busy time was filled in
10234ed20bebSJohannes Berg  * @SURVEY_INFO_TIME_EXT_BUSY: extension channel busy time was filled in
10244ed20bebSJohannes Berg  * @SURVEY_INFO_TIME_RX: receive time was filled in
10254ed20bebSJohannes Berg  * @SURVEY_INFO_TIME_TX: transmit time was filled in
1026052536abSJohannes Berg  * @SURVEY_INFO_TIME_SCAN: scan time was filled in
1027c8cd6e7fSFelix Fietkau  * @SURVEY_INFO_TIME_BSS_RX: local BSS receive time was filled in
1028abe37c4bSJohannes Berg  *
102961fa713cSHolger Schurig  * Used by the driver to indicate which info in &struct survey_info
103061fa713cSHolger Schurig  * it has filled in during the get_survey().
103161fa713cSHolger Schurig  */
103261fa713cSHolger Schurig enum survey_info_flags {
10334ed20bebSJohannes Berg 	SURVEY_INFO_NOISE_DBM		= BIT(0),
10344ed20bebSJohannes Berg 	SURVEY_INFO_IN_USE		= BIT(1),
10354ed20bebSJohannes Berg 	SURVEY_INFO_TIME		= BIT(2),
10364ed20bebSJohannes Berg 	SURVEY_INFO_TIME_BUSY		= BIT(3),
10374ed20bebSJohannes Berg 	SURVEY_INFO_TIME_EXT_BUSY	= BIT(4),
10384ed20bebSJohannes Berg 	SURVEY_INFO_TIME_RX		= BIT(5),
10394ed20bebSJohannes Berg 	SURVEY_INFO_TIME_TX		= BIT(6),
1040052536abSJohannes Berg 	SURVEY_INFO_TIME_SCAN		= BIT(7),
1041c8cd6e7fSFelix Fietkau 	SURVEY_INFO_TIME_BSS_RX		= BIT(8),
104261fa713cSHolger Schurig };
104361fa713cSHolger Schurig 
104461fa713cSHolger Schurig /**
104561fa713cSHolger Schurig  * struct survey_info - channel survey response
104661fa713cSHolger Schurig  *
104711f78ac3SJohannes Berg  * @channel: the channel this survey record reports, may be %NULL for a single
104811f78ac3SJohannes Berg  *	record to report global statistics
104961fa713cSHolger Schurig  * @filled: bitflag of flags from &enum survey_info_flags
105061fa713cSHolger Schurig  * @noise: channel noise in dBm. This and all following fields are
105161fa713cSHolger Schurig  *	optional
10524ed20bebSJohannes Berg  * @time: amount of time in ms the radio was turn on (on the channel)
10534ed20bebSJohannes Berg  * @time_busy: amount of time the primary channel was sensed busy
10544ed20bebSJohannes Berg  * @time_ext_busy: amount of time the extension channel was sensed busy
10554ed20bebSJohannes Berg  * @time_rx: amount of time the radio spent receiving data
10564ed20bebSJohannes Berg  * @time_tx: amount of time the radio spent transmitting data
1057052536abSJohannes Berg  * @time_scan: amount of time the radio spent for scanning
1058c8cd6e7fSFelix Fietkau  * @time_bss_rx: amount of time the radio spent receiving data on a local BSS
105961fa713cSHolger Schurig  *
1060abe37c4bSJohannes Berg  * Used by dump_survey() to report back per-channel survey information.
1061abe37c4bSJohannes Berg  *
106261fa713cSHolger Schurig  * This structure can later be expanded with things like
106361fa713cSHolger Schurig  * channel duty cycle etc.
106461fa713cSHolger Schurig  */
106561fa713cSHolger Schurig struct survey_info {
106661fa713cSHolger Schurig 	struct ieee80211_channel *channel;
10674ed20bebSJohannes Berg 	u64 time;
10684ed20bebSJohannes Berg 	u64 time_busy;
10694ed20bebSJohannes Berg 	u64 time_ext_busy;
10704ed20bebSJohannes Berg 	u64 time_rx;
10714ed20bebSJohannes Berg 	u64 time_tx;
1072052536abSJohannes Berg 	u64 time_scan;
1073c8cd6e7fSFelix Fietkau 	u64 time_bss_rx;
107461fa713cSHolger Schurig 	u32 filled;
107561fa713cSHolger Schurig 	s8 noise;
107661fa713cSHolger Schurig };
107761fa713cSHolger Schurig 
1078b8676221SDavid Spinadel #define CFG80211_MAX_WEP_KEYS	4
1079ecad3b0bSVeerendranath Jakkam #define CFG80211_MAX_NUM_AKM_SUITES	10
1080b8676221SDavid Spinadel 
108161fa713cSHolger Schurig /**
10825fb628e9SJouni Malinen  * struct cfg80211_crypto_settings - Crypto settings
10835fb628e9SJouni Malinen  * @wpa_versions: indicates which, if any, WPA versions are enabled
10845fb628e9SJouni Malinen  *	(from enum nl80211_wpa_versions)
10855fb628e9SJouni Malinen  * @cipher_group: group key cipher suite (or 0 if unset)
10865fb628e9SJouni Malinen  * @n_ciphers_pairwise: number of AP supported unicast ciphers
10875fb628e9SJouni Malinen  * @ciphers_pairwise: unicast key cipher suites
10885fb628e9SJouni Malinen  * @n_akm_suites: number of AKM suites
10895fb628e9SJouni Malinen  * @akm_suites: AKM suites
10905fb628e9SJouni Malinen  * @control_port: Whether user space controls IEEE 802.1X port, i.e.,
10915fb628e9SJouni Malinen  *	sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
10925fb628e9SJouni Malinen  *	required to assume that the port is unauthorized until authorized by
10935fb628e9SJouni Malinen  *	user space. Otherwise, port is marked authorized by default.
10945fb628e9SJouni Malinen  * @control_port_ethertype: the control port protocol that should be
10955fb628e9SJouni Malinen  *	allowed through even on unauthorized ports
10965fb628e9SJouni Malinen  * @control_port_no_encrypt: TRUE to prevent encryption of control port
10975fb628e9SJouni Malinen  *	protocol frames.
109864bf3d4bSDenis Kenzior  * @control_port_over_nl80211: TRUE if userspace expects to exchange control
109964bf3d4bSDenis Kenzior  *	port frames over NL80211 instead of the network interface.
1100a710d214SLothar Rubusch  * @control_port_no_preauth: disables pre-auth rx over the nl80211 control
1101a710d214SLothar Rubusch  *	port for mac80211
1102b8676221SDavid Spinadel  * @wep_keys: static WEP keys, if not NULL points to an array of
1103b8676221SDavid Spinadel  *	CFG80211_MAX_WEP_KEYS WEP keys
1104b8676221SDavid Spinadel  * @wep_tx_key: key index (0..3) of the default TX static WEP key
110591b5ab62SEliad Peller  * @psk: PSK (for devices supporting 4-way-handshake offload)
110626f7044eSChung-Hsien Hsu  * @sae_pwd: password for SAE authentication (for devices supporting SAE
110726f7044eSChung-Hsien Hsu  *	offload)
110826f7044eSChung-Hsien Hsu  * @sae_pwd_len: length of SAE password (for devices supporting SAE offload)
1109da1e9dd3SJohannes Berg  * @sae_pwe: The mechanisms allowed for SAE PWE derivation:
1110da1e9dd3SJohannes Berg  *
1111da1e9dd3SJohannes Berg  *	NL80211_SAE_PWE_UNSPECIFIED
1112da1e9dd3SJohannes Berg  *	  Not-specified, used to indicate userspace did not specify any
1113da1e9dd3SJohannes Berg  *	  preference. The driver should follow its internal policy in
1114da1e9dd3SJohannes Berg  *	  such a scenario.
1115da1e9dd3SJohannes Berg  *
1116da1e9dd3SJohannes Berg  *	NL80211_SAE_PWE_HUNT_AND_PECK
1117da1e9dd3SJohannes Berg  *	  Allow hunting-and-pecking loop only
1118da1e9dd3SJohannes Berg  *
1119da1e9dd3SJohannes Berg  *	NL80211_SAE_PWE_HASH_TO_ELEMENT
1120da1e9dd3SJohannes Berg  *	  Allow hash-to-element only
1121da1e9dd3SJohannes Berg  *
1122da1e9dd3SJohannes Berg  *	NL80211_SAE_PWE_BOTH
1123da1e9dd3SJohannes Berg  *	  Allow either hunting-and-pecking loop or hash-to-element
11245fb628e9SJouni Malinen  */
11255fb628e9SJouni Malinen struct cfg80211_crypto_settings {
11265fb628e9SJouni Malinen 	u32 wpa_versions;
11275fb628e9SJouni Malinen 	u32 cipher_group;
11285fb628e9SJouni Malinen 	int n_ciphers_pairwise;
11295fb628e9SJouni Malinen 	u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES];
11305fb628e9SJouni Malinen 	int n_akm_suites;
1131ecad3b0bSVeerendranath Jakkam 	u32 akm_suites[CFG80211_MAX_NUM_AKM_SUITES];
11325fb628e9SJouni Malinen 	bool control_port;
11335fb628e9SJouni Malinen 	__be16 control_port_ethertype;
11345fb628e9SJouni Malinen 	bool control_port_no_encrypt;
113564bf3d4bSDenis Kenzior 	bool control_port_over_nl80211;
11367f3f96ceSMarkus Theil 	bool control_port_no_preauth;
1137b8676221SDavid Spinadel 	struct key_params *wep_keys;
1138b8676221SDavid Spinadel 	int wep_tx_key;
113991b5ab62SEliad Peller 	const u8 *psk;
114026f7044eSChung-Hsien Hsu 	const u8 *sae_pwd;
114126f7044eSChung-Hsien Hsu 	u8 sae_pwd_len;
11429f0ffa41SRohan Dutta 	enum nl80211_sae_pwe_mechanism sae_pwe;
11435fb628e9SJouni Malinen };
11445fb628e9SJouni Malinen 
11455fb628e9SJouni Malinen /**
1146dc1e3cb8SJohn Crispin  * struct cfg80211_mbssid_config - AP settings for multi bssid
1147dc1e3cb8SJohn Crispin  *
1148dc1e3cb8SJohn Crispin  * @tx_wdev: pointer to the transmitted interface in the MBSSID set
1149dc1e3cb8SJohn Crispin  * @index: index of this AP in the multi bssid group.
1150dc1e3cb8SJohn Crispin  * @ema: set to true if the beacons should be sent out in EMA mode.
1151dc1e3cb8SJohn Crispin  */
1152dc1e3cb8SJohn Crispin struct cfg80211_mbssid_config {
1153dc1e3cb8SJohn Crispin 	struct wireless_dev *tx_wdev;
1154dc1e3cb8SJohn Crispin 	u8 index;
1155dc1e3cb8SJohn Crispin 	bool ema;
1156dc1e3cb8SJohn Crispin };
1157dc1e3cb8SJohn Crispin 
1158dc1e3cb8SJohn Crispin /**
1159dc1e3cb8SJohn Crispin  * struct cfg80211_mbssid_elems - Multiple BSSID elements
1160dc1e3cb8SJohn Crispin  *
1161dc1e3cb8SJohn Crispin  * @cnt: Number of elements in array %elems.
1162dc1e3cb8SJohn Crispin  *
1163dc1e3cb8SJohn Crispin  * @elem: Array of multiple BSSID element(s) to be added into Beacon frames.
1164dc1e3cb8SJohn Crispin  * @elem.data: Data for multiple BSSID elements.
1165dc1e3cb8SJohn Crispin  * @elem.len: Length of data.
1166dc1e3cb8SJohn Crispin  */
1167dc1e3cb8SJohn Crispin struct cfg80211_mbssid_elems {
1168dc1e3cb8SJohn Crispin 	u8 cnt;
1169dc1e3cb8SJohn Crispin 	struct {
1170dc1e3cb8SJohn Crispin 		const u8 *data;
1171dc1e3cb8SJohn Crispin 		size_t len;
1172dc1e3cb8SJohn Crispin 	} elem[];
1173dc1e3cb8SJohn Crispin };
1174dc1e3cb8SJohn Crispin 
1175dc1e3cb8SJohn Crispin /**
11768860020eSJohannes Berg  * struct cfg80211_beacon_data - beacon data
11777b0a0e3cSJohannes Berg  * @link_id: the link ID for the AP MLD link sending this beacon
1178ed1b6cc7SJohannes Berg  * @head: head portion of beacon (before TIM IE)
1179ed1b6cc7SJohannes Berg  *	or %NULL if not changed
1180ed1b6cc7SJohannes Berg  * @tail: tail portion of beacon (after TIM IE)
1181ed1b6cc7SJohannes Berg  *	or %NULL if not changed
1182ed1b6cc7SJohannes Berg  * @head_len: length of @head
1183ed1b6cc7SJohannes Berg  * @tail_len: length of @tail
11849946ecfbSJouni Malinen  * @beacon_ies: extra information element(s) to add into Beacon frames or %NULL
11859946ecfbSJouni Malinen  * @beacon_ies_len: length of beacon_ies in octets
11869946ecfbSJouni Malinen  * @proberesp_ies: extra information element(s) to add into Probe Response
11879946ecfbSJouni Malinen  *	frames or %NULL
11889946ecfbSJouni Malinen  * @proberesp_ies_len: length of proberesp_ies in octets
11899946ecfbSJouni Malinen  * @assocresp_ies: extra information element(s) to add into (Re)Association
11909946ecfbSJouni Malinen  *	Response frames or %NULL
11919946ecfbSJouni Malinen  * @assocresp_ies_len: length of assocresp_ies in octets
119200f740e1SArik Nemtsov  * @probe_resp_len: length of probe response template (@probe_resp)
119300f740e1SArik Nemtsov  * @probe_resp: probe response template (AP mode only)
1194dc1e3cb8SJohn Crispin  * @mbssid_ies: multiple BSSID elements
119581e54d08SPradeep Kumar Chitrapu  * @ftm_responder: enable FTM responder functionality; -1 for no change
119681e54d08SPradeep Kumar Chitrapu  *	(which also implies no change in LCI/civic location data)
119730db641eSJohannes Berg  * @lci: Measurement Report element content, starting with Measurement Token
119830db641eSJohannes Berg  *	(measurement type 8)
119930db641eSJohannes Berg  * @civicloc: Measurement Report element content, starting with Measurement
120030db641eSJohannes Berg  *	Token (measurement type 11)
120181e54d08SPradeep Kumar Chitrapu  * @lci_len: LCI data length
120281e54d08SPradeep Kumar Chitrapu  * @civicloc_len: Civic location data length
12033d48cb74SRameshkumar Sundaram  * @he_bss_color: BSS Color settings
12043d48cb74SRameshkumar Sundaram  * @he_bss_color_valid: indicates whether bss color
1205ee0e2f51SJohannes Berg  *	attribute is present in beacon data or not.
1206ed1b6cc7SJohannes Berg  */
12078860020eSJohannes Berg struct cfg80211_beacon_data {
12087b0a0e3cSJohannes Berg 	unsigned int link_id;
12097b0a0e3cSJohannes Berg 
12108860020eSJohannes Berg 	const u8 *head, *tail;
12118860020eSJohannes Berg 	const u8 *beacon_ies;
12128860020eSJohannes Berg 	const u8 *proberesp_ies;
12138860020eSJohannes Berg 	const u8 *assocresp_ies;
12148860020eSJohannes Berg 	const u8 *probe_resp;
121581e54d08SPradeep Kumar Chitrapu 	const u8 *lci;
121681e54d08SPradeep Kumar Chitrapu 	const u8 *civicloc;
1217dc1e3cb8SJohn Crispin 	struct cfg80211_mbssid_elems *mbssid_ies;
121881e54d08SPradeep Kumar Chitrapu 	s8 ftm_responder;
12198860020eSJohannes Berg 
12208860020eSJohannes Berg 	size_t head_len, tail_len;
12218860020eSJohannes Berg 	size_t beacon_ies_len;
12228860020eSJohannes Berg 	size_t proberesp_ies_len;
12238860020eSJohannes Berg 	size_t assocresp_ies_len;
12248860020eSJohannes Berg 	size_t probe_resp_len;
122581e54d08SPradeep Kumar Chitrapu 	size_t lci_len;
122681e54d08SPradeep Kumar Chitrapu 	size_t civicloc_len;
12273d48cb74SRameshkumar Sundaram 	struct cfg80211_he_bss_color he_bss_color;
12283d48cb74SRameshkumar Sundaram 	bool he_bss_color_valid;
12298860020eSJohannes Berg };
12308860020eSJohannes Berg 
12316d45a74bSVasanthakumar Thiagarajan struct mac_address {
12326d45a74bSVasanthakumar Thiagarajan 	u8 addr[ETH_ALEN];
12336d45a74bSVasanthakumar Thiagarajan };
12346d45a74bSVasanthakumar Thiagarajan 
12358860020eSJohannes Berg /**
123677765eafSVasanthakumar Thiagarajan  * struct cfg80211_acl_data - Access control list data
123777765eafSVasanthakumar Thiagarajan  *
123877765eafSVasanthakumar Thiagarajan  * @acl_policy: ACL policy to be applied on the station's
1239077f897aSJohannes Berg  *	entry specified by mac_addr
124077765eafSVasanthakumar Thiagarajan  * @n_acl_entries: Number of MAC address entries passed
124177765eafSVasanthakumar Thiagarajan  * @mac_addrs: List of MAC addresses of stations to be used for ACL
124277765eafSVasanthakumar Thiagarajan  */
124377765eafSVasanthakumar Thiagarajan struct cfg80211_acl_data {
124477765eafSVasanthakumar Thiagarajan 	enum nl80211_acl_policy acl_policy;
124577765eafSVasanthakumar Thiagarajan 	int n_acl_entries;
124677765eafSVasanthakumar Thiagarajan 
124777765eafSVasanthakumar Thiagarajan 	/* Keep it last */
124877765eafSVasanthakumar Thiagarajan 	struct mac_address mac_addrs[];
124977765eafSVasanthakumar Thiagarajan };
125077765eafSVasanthakumar Thiagarajan 
12518860020eSJohannes Berg /**
1252291c49deSAloka Dixit  * struct cfg80211_fils_discovery - FILS discovery parameters from
1253291c49deSAloka Dixit  * IEEE Std 802.11ai-2016, Annex C.3 MIB detail.
1254291c49deSAloka Dixit  *
1255291c49deSAloka Dixit  * @min_interval: Minimum packet interval in TUs (0 - 10000)
1256291c49deSAloka Dixit  * @max_interval: Maximum packet interval in TUs (0 - 10000)
1257291c49deSAloka Dixit  * @tmpl_len: Template length
1258291c49deSAloka Dixit  * @tmpl: Template data for FILS discovery frame including the action
1259291c49deSAloka Dixit  *	frame headers.
1260291c49deSAloka Dixit  */
1261291c49deSAloka Dixit struct cfg80211_fils_discovery {
1262291c49deSAloka Dixit 	u32 min_interval;
1263291c49deSAloka Dixit 	u32 max_interval;
1264291c49deSAloka Dixit 	size_t tmpl_len;
1265291c49deSAloka Dixit 	const u8 *tmpl;
1266291c49deSAloka Dixit };
1267291c49deSAloka Dixit 
1268291c49deSAloka Dixit /**
12697443dcd1SAloka Dixit  * struct cfg80211_unsol_bcast_probe_resp - Unsolicited broadcast probe
12707443dcd1SAloka Dixit  *	response parameters in 6GHz.
12717443dcd1SAloka Dixit  *
12727443dcd1SAloka Dixit  * @interval: Packet interval in TUs. Maximum allowed is 20 TU, as mentioned
12737443dcd1SAloka Dixit  *	in IEEE P802.11ax/D6.0 26.17.2.3.2 - AP behavior for fast passive
12747443dcd1SAloka Dixit  *	scanning
12757443dcd1SAloka Dixit  * @tmpl_len: Template length
12767443dcd1SAloka Dixit  * @tmpl: Template data for probe response
12777443dcd1SAloka Dixit  */
12787443dcd1SAloka Dixit struct cfg80211_unsol_bcast_probe_resp {
12797443dcd1SAloka Dixit 	u32 interval;
12807443dcd1SAloka Dixit 	size_t tmpl_len;
12817443dcd1SAloka Dixit 	const u8 *tmpl;
12827443dcd1SAloka Dixit };
12837443dcd1SAloka Dixit 
12847443dcd1SAloka Dixit /**
12858860020eSJohannes Berg  * struct cfg80211_ap_settings - AP configuration
12868860020eSJohannes Berg  *
12878860020eSJohannes Berg  * Used to configure an AP interface.
12888860020eSJohannes Berg  *
1289683b6d3bSJohannes Berg  * @chandef: defines the channel to use
12908860020eSJohannes Berg  * @beacon: beacon data
12918860020eSJohannes Berg  * @beacon_interval: beacon interval
12928860020eSJohannes Berg  * @dtim_period: DTIM period
12938860020eSJohannes Berg  * @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from
12948860020eSJohannes Berg  *	user space)
12958860020eSJohannes Berg  * @ssid_len: length of @ssid
12968860020eSJohannes Berg  * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames
12978860020eSJohannes Berg  * @crypto: crypto settings
12988860020eSJohannes Berg  * @privacy: the BSS uses privacy
12998860020eSJohannes Berg  * @auth_type: Authentication type (algorithm)
130018998c38SEliad Peller  * @smps_mode: SMPS mode
13011b658f11SVasanthakumar Thiagarajan  * @inactivity_timeout: time in seconds to determine station's inactivity.
130253cabad7SJohannes Berg  * @p2p_ctwindow: P2P CT Window
130353cabad7SJohannes Berg  * @p2p_opp_ps: P2P opportunistic PS
130477765eafSVasanthakumar Thiagarajan  * @acl: ACL configuration used by the drivers which has support for
130577765eafSVasanthakumar Thiagarajan  *	MAC address based access control
130634d50519SLior David  * @pbss: If set, start as a PCP instead of AP. Relevant for DMG
130734d50519SLior David  *	networks.
13088564e382SJohannes Berg  * @beacon_rate: bitrate to be used for beacons
130966cd794eSJohannes Berg  * @ht_cap: HT capabilities (or %NULL if HT isn't enabled)
131066cd794eSJohannes Berg  * @vht_cap: VHT capabilities (or %NULL if VHT isn't enabled)
1311244eb9aeSShaul Triebitz  * @he_cap: HE capabilities (or %NULL if HE isn't enabled)
13128bc65d38SAloka Dixit  * @eht_cap: EHT capabilities (or %NULL if EHT isn't enabled)
13138bc65d38SAloka Dixit  * @eht_oper: EHT operation IE (or %NULL if EHT isn't enabled)
131466cd794eSJohannes Berg  * @ht_required: stations must support HT
131566cd794eSJohannes Berg  * @vht_required: stations must support VHT
1316a0de1ca3SJohn Crispin  * @twt_responder: Enable Target Wait Time
13172a392596SIlan Peer  * @he_required: stations must support HE
1318d6587602SIlan Peer  * @sae_h2e_required: stations must support direct H2E technique in SAE
1319fe494370SSrinivas Dasari  * @flags: flags, as defined in enum cfg80211_ap_settings_flags
1320796e90f4SJohn Crispin  * @he_obss_pd: OBSS Packet Detection settings
13217e8d6f12SShaul Triebitz  * @he_oper: HE operation IE (or %NULL if HE isn't enabled)
1322291c49deSAloka Dixit  * @fils_discovery: FILS discovery transmission parameters
13237443dcd1SAloka Dixit  * @unsol_bcast_probe_resp: Unsolicited broadcast probe response parameters
1324dc1e3cb8SJohn Crispin  * @mbssid_config: AP settings for multiple bssid
13258860020eSJohannes Berg  */
13268860020eSJohannes Berg struct cfg80211_ap_settings {
1327683b6d3bSJohannes Berg 	struct cfg80211_chan_def chandef;
1328aa430da4SJohannes Berg 
13298860020eSJohannes Berg 	struct cfg80211_beacon_data beacon;
13308860020eSJohannes Berg 
13318860020eSJohannes Berg 	int beacon_interval, dtim_period;
133232e9de84SJouni Malinen 	const u8 *ssid;
133332e9de84SJouni Malinen 	size_t ssid_len;
133432e9de84SJouni Malinen 	enum nl80211_hidden_ssid hidden_ssid;
13355fb628e9SJouni Malinen 	struct cfg80211_crypto_settings crypto;
13365fb628e9SJouni Malinen 	bool privacy;
13375fb628e9SJouni Malinen 	enum nl80211_auth_type auth_type;
133818998c38SEliad Peller 	enum nl80211_smps_mode smps_mode;
13391b658f11SVasanthakumar Thiagarajan 	int inactivity_timeout;
134053cabad7SJohannes Berg 	u8 p2p_ctwindow;
134153cabad7SJohannes Berg 	bool p2p_opp_ps;
134277765eafSVasanthakumar Thiagarajan 	const struct cfg80211_acl_data *acl;
134334d50519SLior David 	bool pbss;
1344a7c7fbffSPurushottam Kushwaha 	struct cfg80211_bitrate_mask beacon_rate;
134566cd794eSJohannes Berg 
134666cd794eSJohannes Berg 	const struct ieee80211_ht_cap *ht_cap;
134766cd794eSJohannes Berg 	const struct ieee80211_vht_cap *vht_cap;
1348244eb9aeSShaul Triebitz 	const struct ieee80211_he_cap_elem *he_cap;
13497e8d6f12SShaul Triebitz 	const struct ieee80211_he_operation *he_oper;
13508bc65d38SAloka Dixit 	const struct ieee80211_eht_cap_elem *eht_cap;
13518bc65d38SAloka Dixit 	const struct ieee80211_eht_operation *eht_oper;
1352d6587602SIlan Peer 	bool ht_required, vht_required, he_required, sae_h2e_required;
1353a0de1ca3SJohn Crispin 	bool twt_responder;
1354fe494370SSrinivas Dasari 	u32 flags;
1355796e90f4SJohn Crispin 	struct ieee80211_he_obss_pd he_obss_pd;
1356291c49deSAloka Dixit 	struct cfg80211_fils_discovery fils_discovery;
13577443dcd1SAloka Dixit 	struct cfg80211_unsol_bcast_probe_resp unsol_bcast_probe_resp;
1358dc1e3cb8SJohn Crispin 	struct cfg80211_mbssid_config mbssid_config;
1359ed1b6cc7SJohannes Berg };
1360ed1b6cc7SJohannes Berg 
13615727ef1bSJohannes Berg /**
136216ef1fe2SSimon Wunderlich  * struct cfg80211_csa_settings - channel switch settings
136316ef1fe2SSimon Wunderlich  *
136416ef1fe2SSimon Wunderlich  * Used for channel switch
136516ef1fe2SSimon Wunderlich  *
136616ef1fe2SSimon Wunderlich  * @chandef: defines the channel to use after the switch
136716ef1fe2SSimon Wunderlich  * @beacon_csa: beacon data while performing the switch
13689a774c78SAndrei Otcheretianski  * @counter_offsets_beacon: offsets of the counters within the beacon (tail)
13699a774c78SAndrei Otcheretianski  * @counter_offsets_presp: offsets of the counters within the probe response
13709a774c78SAndrei Otcheretianski  * @n_counter_offsets_beacon: number of csa counters the beacon (tail)
13719a774c78SAndrei Otcheretianski  * @n_counter_offsets_presp: number of csa counters in the probe response
137216ef1fe2SSimon Wunderlich  * @beacon_after: beacon data to be used on the new channel
137316ef1fe2SSimon Wunderlich  * @radar_required: whether radar detection is required on the new channel
137416ef1fe2SSimon Wunderlich  * @block_tx: whether transmissions should be blocked while changing
137516ef1fe2SSimon Wunderlich  * @count: number of beacons until switch
137616ef1fe2SSimon Wunderlich  */
137716ef1fe2SSimon Wunderlich struct cfg80211_csa_settings {
137816ef1fe2SSimon Wunderlich 	struct cfg80211_chan_def chandef;
137916ef1fe2SSimon Wunderlich 	struct cfg80211_beacon_data beacon_csa;
13809a774c78SAndrei Otcheretianski 	const u16 *counter_offsets_beacon;
13819a774c78SAndrei Otcheretianski 	const u16 *counter_offsets_presp;
13829a774c78SAndrei Otcheretianski 	unsigned int n_counter_offsets_beacon;
13839a774c78SAndrei Otcheretianski 	unsigned int n_counter_offsets_presp;
138416ef1fe2SSimon Wunderlich 	struct cfg80211_beacon_data beacon_after;
138516ef1fe2SSimon Wunderlich 	bool radar_required;
138616ef1fe2SSimon Wunderlich 	bool block_tx;
138716ef1fe2SSimon Wunderlich 	u8 count;
138816ef1fe2SSimon Wunderlich };
138916ef1fe2SSimon Wunderlich 
139016ef1fe2SSimon Wunderlich /**
13910d2ab3aeSJohn Crispin  * struct cfg80211_color_change_settings - color change settings
13920d2ab3aeSJohn Crispin  *
13930d2ab3aeSJohn Crispin  * Used for bss color change
13940d2ab3aeSJohn Crispin  *
13950d2ab3aeSJohn Crispin  * @beacon_color_change: beacon data while performing the color countdown
13962d8b08feSMauro Carvalho Chehab  * @counter_offset_beacon: offsets of the counters within the beacon (tail)
13972d8b08feSMauro Carvalho Chehab  * @counter_offset_presp: offsets of the counters within the probe response
13980d2ab3aeSJohn Crispin  * @beacon_next: beacon data to be used after the color change
13990d2ab3aeSJohn Crispin  * @count: number of beacons until the color change
14000d2ab3aeSJohn Crispin  * @color: the color used after the change
14010d2ab3aeSJohn Crispin  */
14020d2ab3aeSJohn Crispin struct cfg80211_color_change_settings {
14030d2ab3aeSJohn Crispin 	struct cfg80211_beacon_data beacon_color_change;
14040d2ab3aeSJohn Crispin 	u16 counter_offset_beacon;
14050d2ab3aeSJohn Crispin 	u16 counter_offset_presp;
14060d2ab3aeSJohn Crispin 	struct cfg80211_beacon_data beacon_next;
14070d2ab3aeSJohn Crispin 	u8 count;
14080d2ab3aeSJohn Crispin 	u8 color;
14090d2ab3aeSJohn Crispin };
14100d2ab3aeSJohn Crispin 
14110d2ab3aeSJohn Crispin /**
1412e227300cSPurushottam Kushwaha  * struct iface_combination_params - input parameters for interface combinations
1413e227300cSPurushottam Kushwaha  *
1414e227300cSPurushottam Kushwaha  * Used to pass interface combination parameters
1415e227300cSPurushottam Kushwaha  *
1416e227300cSPurushottam Kushwaha  * @num_different_channels: the number of different channels we want
1417e227300cSPurushottam Kushwaha  *	to use for verification
1418e227300cSPurushottam Kushwaha  * @radar_detect: a bitmap where each bit corresponds to a channel
1419e227300cSPurushottam Kushwaha  *	width where radar detection is needed, as in the definition of
1420e227300cSPurushottam Kushwaha  *	&struct ieee80211_iface_combination.@radar_detect_widths
1421e227300cSPurushottam Kushwaha  * @iftype_num: array with the number of interfaces of each interface
1422e227300cSPurushottam Kushwaha  *	type.  The index is the interface type as specified in &enum
1423e227300cSPurushottam Kushwaha  *	nl80211_iftype.
14244c8dea63SJohannes Berg  * @new_beacon_int: set this to the beacon interval of a new interface
14254c8dea63SJohannes Berg  *	that's not operating yet, if such is to be checked as part of
14264c8dea63SJohannes Berg  *	the verification
1427e227300cSPurushottam Kushwaha  */
1428e227300cSPurushottam Kushwaha struct iface_combination_params {
1429e227300cSPurushottam Kushwaha 	int num_different_channels;
1430e227300cSPurushottam Kushwaha 	u8 radar_detect;
1431e227300cSPurushottam Kushwaha 	int iftype_num[NUM_NL80211_IFTYPES];
14324c8dea63SJohannes Berg 	u32 new_beacon_int;
1433e227300cSPurushottam Kushwaha };
1434e227300cSPurushottam Kushwaha 
1435e227300cSPurushottam Kushwaha /**
14363b9ce80cSJohannes Berg  * enum station_parameters_apply_mask - station parameter values to apply
14373b9ce80cSJohannes Berg  * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp)
14389d62a986SJouni Malinen  * @STATION_PARAM_APPLY_CAPABILITY: apply new capability
1439f8bacc21SJohannes Berg  * @STATION_PARAM_APPLY_PLINK_STATE: apply new plink state
14402d8b08feSMauro Carvalho Chehab  * @STATION_PARAM_APPLY_STA_TXPOWER: apply tx power for STA
14413b9ce80cSJohannes Berg  *
14423b9ce80cSJohannes Berg  * Not all station parameters have in-band "no change" signalling,
14433b9ce80cSJohannes Berg  * for those that don't these flags will are used.
14443b9ce80cSJohannes Berg  */
14453b9ce80cSJohannes Berg enum station_parameters_apply_mask {
14463b9ce80cSJohannes Berg 	STATION_PARAM_APPLY_UAPSD = BIT(0),
14479d62a986SJouni Malinen 	STATION_PARAM_APPLY_CAPABILITY = BIT(1),
1448f8bacc21SJohannes Berg 	STATION_PARAM_APPLY_PLINK_STATE = BIT(2),
1449e96d1cd2SAshok Raj Nagarajan };
1450e96d1cd2SAshok Raj Nagarajan 
1451e96d1cd2SAshok Raj Nagarajan /**
1452e96d1cd2SAshok Raj Nagarajan  * struct sta_txpwr - station txpower configuration
1453e96d1cd2SAshok Raj Nagarajan  *
1454e96d1cd2SAshok Raj Nagarajan  * Used to configure txpower for station.
1455e96d1cd2SAshok Raj Nagarajan  *
1456e96d1cd2SAshok Raj Nagarajan  * @power: tx power (in dBm) to be used for sending data traffic. If tx power
1457e96d1cd2SAshok Raj Nagarajan  *	is not provided, the default per-interface tx power setting will be
1458e96d1cd2SAshok Raj Nagarajan  *	overriding. Driver should be picking up the lowest tx power, either tx
1459e96d1cd2SAshok Raj Nagarajan  *	power per-interface or per-station.
1460e96d1cd2SAshok Raj Nagarajan  * @type: In particular if TPC %type is NL80211_TX_POWER_LIMITED then tx power
1461e96d1cd2SAshok Raj Nagarajan  *	will be less than or equal to specified from userspace, whereas if TPC
1462e96d1cd2SAshok Raj Nagarajan  *	%type is NL80211_TX_POWER_AUTOMATIC then it indicates default tx power.
1463e96d1cd2SAshok Raj Nagarajan  *	NL80211_TX_POWER_FIXED is not a valid configuration option for
1464e96d1cd2SAshok Raj Nagarajan  *	per peer TPC.
1465e96d1cd2SAshok Raj Nagarajan  */
1466e96d1cd2SAshok Raj Nagarajan struct sta_txpwr {
1467e96d1cd2SAshok Raj Nagarajan 	s16 power;
1468e96d1cd2SAshok Raj Nagarajan 	enum nl80211_tx_power_setting type;
14693b9ce80cSJohannes Berg };
14703b9ce80cSJohannes Berg 
14713b9ce80cSJohannes Berg /**
1472577e5b8cSShaul Triebitz  * struct link_station_parameters - link station parameters
1473577e5b8cSShaul Triebitz  *
1474577e5b8cSShaul Triebitz  * Used to change and create a new link station.
1475577e5b8cSShaul Triebitz  *
1476577e5b8cSShaul Triebitz  * @mld_mac: MAC address of the station
1477577e5b8cSShaul Triebitz  * @link_id: the link id (-1 for non-MLD station)
1478577e5b8cSShaul Triebitz  * @link_mac: MAC address of the link
1479577e5b8cSShaul Triebitz  * @supported_rates: supported rates in IEEE 802.11 format
1480577e5b8cSShaul Triebitz  *	(or NULL for no change)
1481577e5b8cSShaul Triebitz  * @supported_rates_len: number of supported rates
1482577e5b8cSShaul Triebitz  * @ht_capa: HT capabilities of station
1483577e5b8cSShaul Triebitz  * @vht_capa: VHT capabilities of station
1484577e5b8cSShaul Triebitz  * @opmode_notif: operating mode field from Operating Mode Notification
1485577e5b8cSShaul Triebitz  * @opmode_notif_used: information if operating mode field is used
1486577e5b8cSShaul Triebitz  * @he_capa: HE capabilities of station
1487577e5b8cSShaul Triebitz  * @he_capa_len: the length of the HE capabilities
1488577e5b8cSShaul Triebitz  * @txpwr: transmit power for an associated station
1489577e5b8cSShaul Triebitz  * @txpwr_set: txpwr field is set
1490577e5b8cSShaul Triebitz  * @he_6ghz_capa: HE 6 GHz Band capabilities of station
1491577e5b8cSShaul Triebitz  * @eht_capa: EHT capabilities of station
1492577e5b8cSShaul Triebitz  * @eht_capa_len: the length of the EHT capabilities
1493577e5b8cSShaul Triebitz  */
1494577e5b8cSShaul Triebitz struct link_station_parameters {
1495577e5b8cSShaul Triebitz 	const u8 *mld_mac;
1496577e5b8cSShaul Triebitz 	int link_id;
1497577e5b8cSShaul Triebitz 	const u8 *link_mac;
1498577e5b8cSShaul Triebitz 	const u8 *supported_rates;
1499577e5b8cSShaul Triebitz 	u8 supported_rates_len;
1500577e5b8cSShaul Triebitz 	const struct ieee80211_ht_cap *ht_capa;
1501577e5b8cSShaul Triebitz 	const struct ieee80211_vht_cap *vht_capa;
1502577e5b8cSShaul Triebitz 	u8 opmode_notif;
1503577e5b8cSShaul Triebitz 	bool opmode_notif_used;
1504577e5b8cSShaul Triebitz 	const struct ieee80211_he_cap_elem *he_capa;
1505577e5b8cSShaul Triebitz 	u8 he_capa_len;
1506577e5b8cSShaul Triebitz 	struct sta_txpwr txpwr;
1507577e5b8cSShaul Triebitz 	bool txpwr_set;
1508577e5b8cSShaul Triebitz 	const struct ieee80211_he_6ghz_capa *he_6ghz_capa;
1509577e5b8cSShaul Triebitz 	const struct ieee80211_eht_cap_elem *eht_capa;
1510577e5b8cSShaul Triebitz 	u8 eht_capa_len;
1511577e5b8cSShaul Triebitz };
1512577e5b8cSShaul Triebitz 
1513577e5b8cSShaul Triebitz /**
1514577e5b8cSShaul Triebitz  * struct link_station_del_parameters - link station deletion parameters
1515577e5b8cSShaul Triebitz  *
1516577e5b8cSShaul Triebitz  * Used to delete a link station entry (or all stations).
1517577e5b8cSShaul Triebitz  *
1518577e5b8cSShaul Triebitz  * @mld_mac: MAC address of the station
1519577e5b8cSShaul Triebitz  * @link_id: the link id
1520577e5b8cSShaul Triebitz  */
1521577e5b8cSShaul Triebitz struct link_station_del_parameters {
1522577e5b8cSShaul Triebitz 	const u8 *mld_mac;
1523577e5b8cSShaul Triebitz 	u32 link_id;
1524577e5b8cSShaul Triebitz };
1525577e5b8cSShaul Triebitz 
1526577e5b8cSShaul Triebitz /**
15275727ef1bSJohannes Berg  * struct station_parameters - station parameters
15285727ef1bSJohannes Berg  *
15295727ef1bSJohannes Berg  * Used to change and create a new station.
15305727ef1bSJohannes Berg  *
15315727ef1bSJohannes Berg  * @vlan: vlan interface station should belong to
1532eccb8e8fSJohannes Berg  * @sta_flags_mask: station flags that changed
1533819bf593SJohannes Berg  *	(bitmask of BIT(%NL80211_STA_FLAG_...))
1534eccb8e8fSJohannes Berg  * @sta_flags_set: station flags values
1535819bf593SJohannes Berg  *	(bitmask of BIT(%NL80211_STA_FLAG_...))
15365727ef1bSJohannes Berg  * @listen_interval: listen interval or -1 for no change
15375727ef1bSJohannes Berg  * @aid: AID or zero for no change
153814f34e36SGurumoorthi Gnanasambandhan  * @vlan_id: VLAN ID for station (if nonzero)
15397d27a0baSMasashi Honma  * @peer_aid: mesh peer AID or zero for no change
1540abe37c4bSJohannes Berg  * @plink_action: plink action to take
15419c3990aaSJavier Cardona  * @plink_state: set the peer link state for a station
1542910868dbSEliad Peller  * @uapsd_queues: bitmap of queues configured for uapsd. same format
1543910868dbSEliad Peller  *	as the AC bitmap in the QoS info field
1544910868dbSEliad Peller  * @max_sp: max Service Period. same format as the MAX_SP in the
1545910868dbSEliad Peller  *	QoS info field (but already shifted down)
1546c26887d2SJohannes Berg  * @sta_modify_mask: bitmap indicating which parameters changed
1547c26887d2SJohannes Berg  *	(for those that don't have a natural "no change" value),
1548c26887d2SJohannes Berg  *	see &enum station_parameters_apply_mask
15493b1c5a53SMarco Porsch  * @local_pm: local link-specific mesh power save mode (no change when set
15503b1c5a53SMarco Porsch  *	to unknown)
15519d62a986SJouni Malinen  * @capability: station capability
15529d62a986SJouni Malinen  * @ext_capab: extended capabilities of the station
15539d62a986SJouni Malinen  * @ext_capab_len: number of extended capabilities
1554c01fc9adSSunil Dutt  * @supported_channels: supported channels in IEEE 802.11 format
1555c01fc9adSSunil Dutt  * @supported_channels_len: number of supported channels
1556c01fc9adSSunil Dutt  * @supported_oper_classes: supported oper classes in IEEE 802.11 format
1557c01fc9adSSunil Dutt  * @supported_oper_classes_len: number of supported operating classes
155817b94247SAyala Beker  * @support_p2p_ps: information if station supports P2P PS mechanism
155936647055SToke Høiland-Jørgensen  * @airtime_weight: airtime scheduler weight for this station
1560b95eb7f0SShaul Triebitz  * @link_sta_params: link related params.
15615727ef1bSJohannes Berg  */
15625727ef1bSJohannes Berg struct station_parameters {
15635727ef1bSJohannes Berg 	struct net_device *vlan;
1564eccb8e8fSJohannes Berg 	u32 sta_flags_mask, sta_flags_set;
15653b9ce80cSJohannes Berg 	u32 sta_modify_mask;
15665727ef1bSJohannes Berg 	int listen_interval;
15675727ef1bSJohannes Berg 	u16 aid;
156814f34e36SGurumoorthi Gnanasambandhan 	u16 vlan_id;
15697d27a0baSMasashi Honma 	u16 peer_aid;
15702ec600d6SLuis Carlos Cobo 	u8 plink_action;
15719c3990aaSJavier Cardona 	u8 plink_state;
1572c75786c9SEliad Peller 	u8 uapsd_queues;
1573c75786c9SEliad Peller 	u8 max_sp;
15743b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode local_pm;
15759d62a986SJouni Malinen 	u16 capability;
15762c1aabf3SJohannes Berg 	const u8 *ext_capab;
15779d62a986SJouni Malinen 	u8 ext_capab_len;
1578c01fc9adSSunil Dutt 	const u8 *supported_channels;
1579c01fc9adSSunil Dutt 	u8 supported_channels_len;
1580c01fc9adSSunil Dutt 	const u8 *supported_oper_classes;
1581c01fc9adSSunil Dutt 	u8 supported_oper_classes_len;
158217b94247SAyala Beker 	int support_p2p_ps;
158336647055SToke Høiland-Jørgensen 	u16 airtime_weight;
1584b95eb7f0SShaul Triebitz 	struct link_station_parameters link_sta_params;
15855727ef1bSJohannes Berg };
15865727ef1bSJohannes Berg 
1587fd5b74dcSJohannes Berg /**
158889c771e5SJouni Malinen  * struct station_del_parameters - station deletion parameters
158989c771e5SJouni Malinen  *
159089c771e5SJouni Malinen  * Used to delete a station entry (or all stations).
159189c771e5SJouni Malinen  *
159289c771e5SJouni Malinen  * @mac: MAC address of the station to remove or NULL to remove all stations
159398856866SJouni Malinen  * @subtype: Management frame subtype to use for indicating removal
159498856866SJouni Malinen  *	(10 = Disassociation, 12 = Deauthentication)
159598856866SJouni Malinen  * @reason_code: Reason code for the Disassociation/Deauthentication frame
159689c771e5SJouni Malinen  */
159789c771e5SJouni Malinen struct station_del_parameters {
159889c771e5SJouni Malinen 	const u8 *mac;
159998856866SJouni Malinen 	u8 subtype;
160098856866SJouni Malinen 	u16 reason_code;
160189c771e5SJouni Malinen };
160289c771e5SJouni Malinen 
160389c771e5SJouni Malinen /**
160477ee7c89SJohannes Berg  * enum cfg80211_station_type - the type of station being modified
160577ee7c89SJohannes Berg  * @CFG80211_STA_AP_CLIENT: client of an AP interface
160647edb11bSAyala Beker  * @CFG80211_STA_AP_CLIENT_UNASSOC: client of an AP interface that is still
160747edb11bSAyala Beker  *	unassociated (update properties for this type of client is permitted)
160877ee7c89SJohannes Berg  * @CFG80211_STA_AP_MLME_CLIENT: client of an AP interface that has
160977ee7c89SJohannes Berg  *	the AP MLME in the device
161077ee7c89SJohannes Berg  * @CFG80211_STA_AP_STA: AP station on managed interface
161177ee7c89SJohannes Berg  * @CFG80211_STA_IBSS: IBSS station
161277ee7c89SJohannes Berg  * @CFG80211_STA_TDLS_PEER_SETUP: TDLS peer on managed interface (dummy entry
161377ee7c89SJohannes Berg  *	while TDLS setup is in progress, it moves out of this state when
161477ee7c89SJohannes Berg  *	being marked authorized; use this only if TDLS with external setup is
161577ee7c89SJohannes Berg  *	supported/used)
161677ee7c89SJohannes Berg  * @CFG80211_STA_TDLS_PEER_ACTIVE: TDLS peer on managed interface (active
161777ee7c89SJohannes Berg  *	entry that is operating, has been marked authorized by userspace)
1618eef941e6SThomas Pedersen  * @CFG80211_STA_MESH_PEER_KERNEL: peer on mesh interface (kernel managed)
1619eef941e6SThomas Pedersen  * @CFG80211_STA_MESH_PEER_USER: peer on mesh interface (user managed)
162077ee7c89SJohannes Berg  */
162177ee7c89SJohannes Berg enum cfg80211_station_type {
162277ee7c89SJohannes Berg 	CFG80211_STA_AP_CLIENT,
162347edb11bSAyala Beker 	CFG80211_STA_AP_CLIENT_UNASSOC,
162477ee7c89SJohannes Berg 	CFG80211_STA_AP_MLME_CLIENT,
162577ee7c89SJohannes Berg 	CFG80211_STA_AP_STA,
162677ee7c89SJohannes Berg 	CFG80211_STA_IBSS,
162777ee7c89SJohannes Berg 	CFG80211_STA_TDLS_PEER_SETUP,
162877ee7c89SJohannes Berg 	CFG80211_STA_TDLS_PEER_ACTIVE,
1629eef941e6SThomas Pedersen 	CFG80211_STA_MESH_PEER_KERNEL,
1630eef941e6SThomas Pedersen 	CFG80211_STA_MESH_PEER_USER,
163177ee7c89SJohannes Berg };
163277ee7c89SJohannes Berg 
163377ee7c89SJohannes Berg /**
163477ee7c89SJohannes Berg  * cfg80211_check_station_change - validate parameter changes
163577ee7c89SJohannes Berg  * @wiphy: the wiphy this operates on
163677ee7c89SJohannes Berg  * @params: the new parameters for a station
163777ee7c89SJohannes Berg  * @statype: the type of station being modified
163877ee7c89SJohannes Berg  *
163977ee7c89SJohannes Berg  * Utility function for the @change_station driver method. Call this function
164077ee7c89SJohannes Berg  * with the appropriate station type looking up the station (and checking that
164177ee7c89SJohannes Berg  * it exists). It will verify whether the station change is acceptable, and if
164277ee7c89SJohannes Berg  * not will return an error code. Note that it may modify the parameters for
164377ee7c89SJohannes Berg  * backward compatibility reasons, so don't use them before calling this.
164477ee7c89SJohannes Berg  */
164577ee7c89SJohannes Berg int cfg80211_check_station_change(struct wiphy *wiphy,
164677ee7c89SJohannes Berg 				  struct station_parameters *params,
164777ee7c89SJohannes Berg 				  enum cfg80211_station_type statype);
164877ee7c89SJohannes Berg 
164977ee7c89SJohannes Berg /**
1650b1e8eb11SMauro Carvalho Chehab  * enum rate_info_flags - bitrate info flags
1651420e7fabSHenning Rogge  *
1652420e7fabSHenning Rogge  * Used by the driver to indicate the specific rate transmission
1653420e7fabSHenning Rogge  * type for 802.11n transmissions.
1654420e7fabSHenning Rogge  *
1655db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_MCS: mcs field filled with HT MCS
1656db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_VHT_MCS: mcs field filled with VHT MCS
1657420e7fabSHenning Rogge  * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval
16582a38075cSAlexei Avshalom Lazar  * @RATE_INFO_FLAGS_DMG: 60GHz MCS
1659c4cbaf79SLuca Coelho  * @RATE_INFO_FLAGS_HE_MCS: HE MCS information
16602a38075cSAlexei Avshalom Lazar  * @RATE_INFO_FLAGS_EDMG: 60GHz MCS in EDMG mode
1661d9c85e24SMax Chen  * @RATE_INFO_FLAGS_EXTENDED_SC_DMG: 60GHz extended SC MCS
1662cfb14110SVeerendranath Jakkam  * @RATE_INFO_FLAGS_EHT_MCS: EHT MCS information
1663420e7fabSHenning Rogge  */
1664420e7fabSHenning Rogge enum rate_info_flags {
1665db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_MCS			= BIT(0),
1666db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_VHT_MCS			= BIT(1),
1667b51f3beeSJohannes Berg 	RATE_INFO_FLAGS_SHORT_GI		= BIT(2),
16682a38075cSAlexei Avshalom Lazar 	RATE_INFO_FLAGS_DMG			= BIT(3),
1669c4cbaf79SLuca Coelho 	RATE_INFO_FLAGS_HE_MCS			= BIT(4),
16702a38075cSAlexei Avshalom Lazar 	RATE_INFO_FLAGS_EDMG			= BIT(5),
1671d9c85e24SMax Chen 	RATE_INFO_FLAGS_EXTENDED_SC_DMG		= BIT(6),
1672cfb14110SVeerendranath Jakkam 	RATE_INFO_FLAGS_EHT_MCS			= BIT(7),
1673b51f3beeSJohannes Berg };
1674b51f3beeSJohannes Berg 
1675b51f3beeSJohannes Berg /**
1676b51f3beeSJohannes Berg  * enum rate_info_bw - rate bandwidth information
1677b51f3beeSJohannes Berg  *
1678b51f3beeSJohannes Berg  * Used by the driver to indicate the rate bandwidth.
1679b51f3beeSJohannes Berg  *
1680b51f3beeSJohannes Berg  * @RATE_INFO_BW_5: 5 MHz bandwidth
1681b51f3beeSJohannes Berg  * @RATE_INFO_BW_10: 10 MHz bandwidth
1682b51f3beeSJohannes Berg  * @RATE_INFO_BW_20: 20 MHz bandwidth
1683b51f3beeSJohannes Berg  * @RATE_INFO_BW_40: 40 MHz bandwidth
1684b51f3beeSJohannes Berg  * @RATE_INFO_BW_80: 80 MHz bandwidth
1685b51f3beeSJohannes Berg  * @RATE_INFO_BW_160: 160 MHz bandwidth
1686c4cbaf79SLuca Coelho  * @RATE_INFO_BW_HE_RU: bandwidth determined by HE RU allocation
1687cfb14110SVeerendranath Jakkam  * @RATE_INFO_BW_320: 320 MHz bandwidth
1688cfb14110SVeerendranath Jakkam  * @RATE_INFO_BW_EHT_RU: bandwidth determined by EHT RU allocation
1689b51f3beeSJohannes Berg  */
1690b51f3beeSJohannes Berg enum rate_info_bw {
1691842be75cSJohannes Berg 	RATE_INFO_BW_20 = 0,
1692b51f3beeSJohannes Berg 	RATE_INFO_BW_5,
1693b51f3beeSJohannes Berg 	RATE_INFO_BW_10,
1694b51f3beeSJohannes Berg 	RATE_INFO_BW_40,
1695b51f3beeSJohannes Berg 	RATE_INFO_BW_80,
1696b51f3beeSJohannes Berg 	RATE_INFO_BW_160,
1697c4cbaf79SLuca Coelho 	RATE_INFO_BW_HE_RU,
1698cfb14110SVeerendranath Jakkam 	RATE_INFO_BW_320,
1699cfb14110SVeerendranath Jakkam 	RATE_INFO_BW_EHT_RU,
1700420e7fabSHenning Rogge };
1701420e7fabSHenning Rogge 
1702420e7fabSHenning Rogge /**
1703420e7fabSHenning Rogge  * struct rate_info - bitrate information
1704420e7fabSHenning Rogge  *
1705420e7fabSHenning Rogge  * Information about a receiving or transmitting bitrate
1706420e7fabSHenning Rogge  *
1707420e7fabSHenning Rogge  * @flags: bitflag of flags from &enum rate_info_flags
1708c4cbaf79SLuca Coelho  * @mcs: mcs index if struct describes an HT/VHT/HE rate
1709420e7fabSHenning Rogge  * @legacy: bitrate in 100kbit/s for 802.11abg
1710c4cbaf79SLuca Coelho  * @nss: number of streams (VHT & HE only)
1711b51f3beeSJohannes Berg  * @bw: bandwidth (from &enum rate_info_bw)
1712c4cbaf79SLuca Coelho  * @he_gi: HE guard interval (from &enum nl80211_he_gi)
1713c4cbaf79SLuca Coelho  * @he_dcm: HE DCM value
1714c4cbaf79SLuca Coelho  * @he_ru_alloc: HE RU allocation (from &enum nl80211_he_ru_alloc,
1715c4cbaf79SLuca Coelho  *	only valid if bw is %RATE_INFO_BW_HE_RU)
17162a38075cSAlexei Avshalom Lazar  * @n_bonded_ch: In case of EDMG the number of bonded channels (1-4)
1717cfb14110SVeerendranath Jakkam  * @eht_gi: EHT guard interval (from &enum nl80211_eht_gi)
1718cfb14110SVeerendranath Jakkam  * @eht_ru_alloc: EHT RU allocation (from &enum nl80211_eht_ru_alloc,
1719cfb14110SVeerendranath Jakkam  *	only valid if bw is %RATE_INFO_BW_EHT_RU)
1720420e7fabSHenning Rogge  */
1721420e7fabSHenning Rogge struct rate_info {
1722420e7fabSHenning Rogge 	u8 flags;
1723420e7fabSHenning Rogge 	u8 mcs;
1724420e7fabSHenning Rogge 	u16 legacy;
1725db9c64cfSJohannes Berg 	u8 nss;
1726b51f3beeSJohannes Berg 	u8 bw;
1727c4cbaf79SLuca Coelho 	u8 he_gi;
1728c4cbaf79SLuca Coelho 	u8 he_dcm;
1729c4cbaf79SLuca Coelho 	u8 he_ru_alloc;
17302a38075cSAlexei Avshalom Lazar 	u8 n_bonded_ch;
1731cfb14110SVeerendranath Jakkam 	u8 eht_gi;
1732cfb14110SVeerendranath Jakkam 	u8 eht_ru_alloc;
1733fd5b74dcSJohannes Berg };
1734fd5b74dcSJohannes Berg 
1735fd5b74dcSJohannes Berg /**
1736b1e8eb11SMauro Carvalho Chehab  * enum bss_param_flags - bitrate info flags
1737f4263c98SPaul Stewart  *
1738f4263c98SPaul Stewart  * Used by the driver to indicate the specific rate transmission
1739f4263c98SPaul Stewart  * type for 802.11n transmissions.
1740f4263c98SPaul Stewart  *
1741f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_CTS_PROT: whether CTS protection is enabled
1742f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_SHORT_PREAMBLE: whether short preamble is enabled
1743f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_SHORT_SLOT_TIME: whether short slot time is enabled
1744f4263c98SPaul Stewart  */
1745f4263c98SPaul Stewart enum bss_param_flags {
1746f4263c98SPaul Stewart 	BSS_PARAM_FLAGS_CTS_PROT	= 1<<0,
1747f4263c98SPaul Stewart 	BSS_PARAM_FLAGS_SHORT_PREAMBLE	= 1<<1,
1748f4263c98SPaul Stewart 	BSS_PARAM_FLAGS_SHORT_SLOT_TIME	= 1<<2,
1749f4263c98SPaul Stewart };
1750f4263c98SPaul Stewart 
1751f4263c98SPaul Stewart /**
1752f4263c98SPaul Stewart  * struct sta_bss_parameters - BSS parameters for the attached station
1753f4263c98SPaul Stewart  *
1754f4263c98SPaul Stewart  * Information about the currently associated BSS
1755f4263c98SPaul Stewart  *
1756f4263c98SPaul Stewart  * @flags: bitflag of flags from &enum bss_param_flags
1757f4263c98SPaul Stewart  * @dtim_period: DTIM period for the BSS
1758f4263c98SPaul Stewart  * @beacon_interval: beacon interval
1759f4263c98SPaul Stewart  */
1760f4263c98SPaul Stewart struct sta_bss_parameters {
1761f4263c98SPaul Stewart 	u8 flags;
1762f4263c98SPaul Stewart 	u8 dtim_period;
1763f4263c98SPaul Stewart 	u16 beacon_interval;
1764f4263c98SPaul Stewart };
1765f4263c98SPaul Stewart 
17666de39808SJohannes Berg /**
176752539ca8SToke Høiland-Jørgensen  * struct cfg80211_txq_stats - TXQ statistics for this TID
176852539ca8SToke Høiland-Jørgensen  * @filled: bitmap of flags using the bits of &enum nl80211_txq_stats to
176952539ca8SToke Høiland-Jørgensen  *	indicate the relevant values in this struct are filled
177052539ca8SToke Høiland-Jørgensen  * @backlog_bytes: total number of bytes currently backlogged
177152539ca8SToke Høiland-Jørgensen  * @backlog_packets: total number of packets currently backlogged
177252539ca8SToke Høiland-Jørgensen  * @flows: number of new flows seen
177352539ca8SToke Høiland-Jørgensen  * @drops: total number of packets dropped
177452539ca8SToke Høiland-Jørgensen  * @ecn_marks: total number of packets marked with ECN CE
177552539ca8SToke Høiland-Jørgensen  * @overlimit: number of drops due to queue space overflow
177652539ca8SToke Høiland-Jørgensen  * @overmemory: number of drops due to memory limit overflow
177752539ca8SToke Høiland-Jørgensen  * @collisions: number of hash collisions
177852539ca8SToke Høiland-Jørgensen  * @tx_bytes: total number of bytes dequeued
177952539ca8SToke Høiland-Jørgensen  * @tx_packets: total number of packets dequeued
178052539ca8SToke Høiland-Jørgensen  * @max_flows: maximum number of flows supported
178152539ca8SToke Høiland-Jørgensen  */
178252539ca8SToke Høiland-Jørgensen struct cfg80211_txq_stats {
178352539ca8SToke Høiland-Jørgensen 	u32 filled;
178452539ca8SToke Høiland-Jørgensen 	u32 backlog_bytes;
178552539ca8SToke Høiland-Jørgensen 	u32 backlog_packets;
178652539ca8SToke Høiland-Jørgensen 	u32 flows;
178752539ca8SToke Høiland-Jørgensen 	u32 drops;
178852539ca8SToke Høiland-Jørgensen 	u32 ecn_marks;
178952539ca8SToke Høiland-Jørgensen 	u32 overlimit;
179052539ca8SToke Høiland-Jørgensen 	u32 overmemory;
179152539ca8SToke Høiland-Jørgensen 	u32 collisions;
179252539ca8SToke Høiland-Jørgensen 	u32 tx_bytes;
179352539ca8SToke Høiland-Jørgensen 	u32 tx_packets;
179452539ca8SToke Høiland-Jørgensen 	u32 max_flows;
179552539ca8SToke Høiland-Jørgensen };
179652539ca8SToke Høiland-Jørgensen 
179752539ca8SToke Høiland-Jørgensen /**
17986de39808SJohannes Berg  * struct cfg80211_tid_stats - per-TID statistics
17996de39808SJohannes Berg  * @filled: bitmap of flags using the bits of &enum nl80211_tid_stats to
18006de39808SJohannes Berg  *	indicate the relevant values in this struct are filled
18016de39808SJohannes Berg  * @rx_msdu: number of received MSDUs
18026de39808SJohannes Berg  * @tx_msdu: number of (attempted) transmitted MSDUs
18036de39808SJohannes Berg  * @tx_msdu_retries: number of retries (not counting the first) for
18046de39808SJohannes Berg  *	transmitted MSDUs
18056de39808SJohannes Berg  * @tx_msdu_failed: number of failed transmitted MSDUs
180652539ca8SToke Høiland-Jørgensen  * @txq_stats: TXQ statistics
18076de39808SJohannes Berg  */
18086de39808SJohannes Berg struct cfg80211_tid_stats {
18096de39808SJohannes Berg 	u32 filled;
18106de39808SJohannes Berg 	u64 rx_msdu;
18116de39808SJohannes Berg 	u64 tx_msdu;
18126de39808SJohannes Berg 	u64 tx_msdu_retries;
18136de39808SJohannes Berg 	u64 tx_msdu_failed;
181452539ca8SToke Høiland-Jørgensen 	struct cfg80211_txq_stats txq_stats;
18156de39808SJohannes Berg };
18166de39808SJohannes Berg 
1817119363c7SFelix Fietkau #define IEEE80211_MAX_CHAINS	4
1818119363c7SFelix Fietkau 
1819f4263c98SPaul Stewart /**
18202ec600d6SLuis Carlos Cobo  * struct station_info - station information
1821fd5b74dcSJohannes Berg  *
18222ec600d6SLuis Carlos Cobo  * Station information filled by driver for get_station() and dump_station.
1823fd5b74dcSJohannes Berg  *
1824319090bfSJohannes Berg  * @filled: bitflag of flags using the bits of &enum nl80211_sta_info to
1825319090bfSJohannes Berg  *	indicate the relevant values in this struct for them
1826ebe27c91SMohammed Shafi Shajakhan  * @connected_time: time(in secs) since a station is last connected
1827fd5b74dcSJohannes Berg  * @inactive_time: time since last station activity (tx/rx) in milliseconds
18286c7a0033SBen Greear  * @assoc_at: bootime (ns) of the last association
18298d791361SJohannes Berg  * @rx_bytes: bytes (size of MPDUs) received from this station
18308d791361SJohannes Berg  * @tx_bytes: bytes (size of MPDUs) transmitted to this station
18312ec600d6SLuis Carlos Cobo  * @llid: mesh local link id
18322ec600d6SLuis Carlos Cobo  * @plid: mesh peer link id
18332ec600d6SLuis Carlos Cobo  * @plink_state: mesh peer link state
183473c3df3bSJohannes Berg  * @signal: The signal strength, type depends on the wiphy's signal_type.
183573c3df3bSJohannes Berg  *	For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
183673c3df3bSJohannes Berg  * @signal_avg: Average signal strength, type depends on the wiphy's signal_type.
183773c3df3bSJohannes Berg  *	For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
1838119363c7SFelix Fietkau  * @chains: bitmask for filled values in @chain_signal, @chain_signal_avg
1839119363c7SFelix Fietkau  * @chain_signal: per-chain signal strength of last received packet in dBm
1840119363c7SFelix Fietkau  * @chain_signal_avg: per-chain signal strength average in dBm
1841858022aaSRandy Dunlap  * @txrate: current unicast bitrate from this station
1842858022aaSRandy Dunlap  * @rxrate: current unicast bitrate to this station
18438d791361SJohannes Berg  * @rx_packets: packets (MSDUs & MMPDUs) received from this station
18448d791361SJohannes Berg  * @tx_packets: packets (MSDUs & MMPDUs) transmitted to this station
18458d791361SJohannes Berg  * @tx_retries: cumulative retry counts (MPDUs)
18468d791361SJohannes Berg  * @tx_failed: number of failed transmissions (MPDUs) (retries exceeded, no ACK)
18475a5c731aSBen Greear  * @rx_dropped_misc:  Dropped for un-specified reason.
18481ba01458SRandy Dunlap  * @bss_param: current BSS parameters
1849f5ea9120SJohannes Berg  * @generation: generation number for nl80211 dumps.
1850f5ea9120SJohannes Berg  *	This number should increase every time the list of stations
1851f5ea9120SJohannes Berg  *	changes, i.e. when a station is added or removed, so that
1852f5ea9120SJohannes Berg  *	userspace can tell whether it got a consistent snapshot.
185350d3dfb7SJouni Malinen  * @assoc_req_ies: IEs from (Re)Association Request.
185450d3dfb7SJouni Malinen  *	This is used only when in AP mode with drivers that do not use
185550d3dfb7SJouni Malinen  *	user space MLME/SME implementation. The information is provided for
185650d3dfb7SJouni Malinen  *	the cfg80211_new_sta() calls to notify user space of the IEs.
185750d3dfb7SJouni Malinen  * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets.
1858c26887d2SJohannes Berg  * @sta_flags: station flags mask & values
1859a85e1d55SPaul Stewart  * @beacon_loss_count: Number of times beacon loss event has triggered.
1860d299a1f2SJavier Cardona  * @t_offset: Time offset of the station relative to this host.
18613b1c5a53SMarco Porsch  * @local_pm: local mesh STA power save mode
18623b1c5a53SMarco Porsch  * @peer_pm: peer mesh STA power save mode
18633b1c5a53SMarco Porsch  * @nonpeer_pm: non-peer mesh STA power save mode
1864867d849fSAntonio Quartulli  * @expected_throughput: expected throughput in kbps (including 802.11 headers)
1865867d849fSAntonio Quartulli  *	towards this station.
1866a76b1942SJohannes Berg  * @rx_beacon: number of beacons received from this peer
1867a76b1942SJohannes Berg  * @rx_beacon_signal_avg: signal strength average (in dBm) for beacons received
1868a76b1942SJohannes Berg  *	from this peer
1869dbdaee7aSBob Copeland  * @connected_to_gate: true if mesh STA has a path to mesh gate
1870739960f1SMohammed Shafi Shajakhan  * @rx_duration: aggregate PPDU duration(usecs) for all the frames from a peer
187136647055SToke Høiland-Jørgensen  * @tx_duration: aggregate PPDU duration(usecs) for all the frames to a peer
187236647055SToke Høiland-Jørgensen  * @airtime_weight: current airtime scheduling weight
18736de39808SJohannes Berg  * @pertid: per-TID statistics, see &struct cfg80211_tid_stats, using the last
18746de39808SJohannes Berg  *	(IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs.
18758689c051SArend van Spriel  *	Note that this doesn't use the @filled bit, but is used if non-NULL.
1876c4b50cd3SVenkateswara Naralasetty  * @ack_signal: signal strength (in dBm) of the last ACK frame.
187781d5439dSBalaji Pothunoori  * @avg_ack_signal: average rssi value of ack packet for the no of msdu's has
187881d5439dSBalaji Pothunoori  *	been sent.
18790d4e14a3SAnkita Bajaj  * @rx_mpdu_count: number of MPDUs received from this station
18800d4e14a3SAnkita Bajaj  * @fcs_err_count: number of packets (MPDUs) received from this station with
18810d4e14a3SAnkita Bajaj  *	an FCS error. This counter should be incremented only when TA of the
18820d4e14a3SAnkita Bajaj  *	received packet with an FCS error matches the peer MAC address.
1883ab60633cSNarayanraddi Masti  * @airtime_link_metric: mesh airtime link metric.
18841303a51cSMarkus Theil  * @connected_to_as: true if mesh STA has a path to authentication server
1885fd5b74dcSJohannes Berg  */
18862ec600d6SLuis Carlos Cobo struct station_info {
1887739960f1SMohammed Shafi Shajakhan 	u64 filled;
1888ebe27c91SMohammed Shafi Shajakhan 	u32 connected_time;
1889fd5b74dcSJohannes Berg 	u32 inactive_time;
18906c7a0033SBen Greear 	u64 assoc_at;
189142745e03SVladimir Kondratiev 	u64 rx_bytes;
189242745e03SVladimir Kondratiev 	u64 tx_bytes;
18932ec600d6SLuis Carlos Cobo 	u16 llid;
18942ec600d6SLuis Carlos Cobo 	u16 plid;
18952ec600d6SLuis Carlos Cobo 	u8 plink_state;
1896420e7fabSHenning Rogge 	s8 signal;
1897541a45a1SBruno Randolf 	s8 signal_avg;
1898119363c7SFelix Fietkau 
1899119363c7SFelix Fietkau 	u8 chains;
1900119363c7SFelix Fietkau 	s8 chain_signal[IEEE80211_MAX_CHAINS];
1901119363c7SFelix Fietkau 	s8 chain_signal_avg[IEEE80211_MAX_CHAINS];
1902119363c7SFelix Fietkau 
1903420e7fabSHenning Rogge 	struct rate_info txrate;
1904c8dcfd8aSFelix Fietkau 	struct rate_info rxrate;
190598c8a60aSJouni Malinen 	u32 rx_packets;
190698c8a60aSJouni Malinen 	u32 tx_packets;
1907b206b4efSBruno Randolf 	u32 tx_retries;
1908b206b4efSBruno Randolf 	u32 tx_failed;
19095a5c731aSBen Greear 	u32 rx_dropped_misc;
1910f4263c98SPaul Stewart 	struct sta_bss_parameters bss_param;
1911bb6e753eSHelmut Schaa 	struct nl80211_sta_flag_update sta_flags;
1912f5ea9120SJohannes Berg 
1913f5ea9120SJohannes Berg 	int generation;
191450d3dfb7SJouni Malinen 
191550d3dfb7SJouni Malinen 	const u8 *assoc_req_ies;
191650d3dfb7SJouni Malinen 	size_t assoc_req_ies_len;
1917f612cedfSJouni Malinen 
1918a85e1d55SPaul Stewart 	u32 beacon_loss_count;
1919d299a1f2SJavier Cardona 	s64 t_offset;
19203b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode local_pm;
19213b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode peer_pm;
19223b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode nonpeer_pm;
1923a85e1d55SPaul Stewart 
1924867d849fSAntonio Quartulli 	u32 expected_throughput;
1925a76b1942SJohannes Berg 
192636647055SToke Høiland-Jørgensen 	u64 tx_duration;
1927739960f1SMohammed Shafi Shajakhan 	u64 rx_duration;
192836647055SToke Høiland-Jørgensen 	u64 rx_beacon;
1929a76b1942SJohannes Berg 	u8 rx_beacon_signal_avg;
1930dbdaee7aSBob Copeland 	u8 connected_to_gate;
1931dbdaee7aSBob Copeland 
19328689c051SArend van Spriel 	struct cfg80211_tid_stats *pertid;
1933c4b50cd3SVenkateswara Naralasetty 	s8 ack_signal;
193481d5439dSBalaji Pothunoori 	s8 avg_ack_signal;
19350d4e14a3SAnkita Bajaj 
193636647055SToke Høiland-Jørgensen 	u16 airtime_weight;
193736647055SToke Høiland-Jørgensen 
19380d4e14a3SAnkita Bajaj 	u32 rx_mpdu_count;
19390d4e14a3SAnkita Bajaj 	u32 fcs_err_count;
1940ab60633cSNarayanraddi Masti 
1941ab60633cSNarayanraddi Masti 	u32 airtime_link_metric;
19421303a51cSMarkus Theil 
19431303a51cSMarkus Theil 	u8 connected_to_as;
1944fd5b74dcSJohannes Berg };
1945fd5b74dcSJohannes Berg 
19466bdb68ceSCarl Huang /**
19476bdb68ceSCarl Huang  * struct cfg80211_sar_sub_specs - sub specs limit
19486bdb68ceSCarl Huang  * @power: power limitation in 0.25dbm
19496bdb68ceSCarl Huang  * @freq_range_index: index the power limitation applies to
19506bdb68ceSCarl Huang  */
19516bdb68ceSCarl Huang struct cfg80211_sar_sub_specs {
19526bdb68ceSCarl Huang 	s32 power;
19536bdb68ceSCarl Huang 	u32 freq_range_index;
19546bdb68ceSCarl Huang };
19556bdb68ceSCarl Huang 
19566bdb68ceSCarl Huang /**
19576bdb68ceSCarl Huang  * struct cfg80211_sar_specs - sar limit specs
19586bdb68ceSCarl Huang  * @type: it's set with power in 0.25dbm or other types
19596bdb68ceSCarl Huang  * @num_sub_specs: number of sar sub specs
19606bdb68ceSCarl Huang  * @sub_specs: memory to hold the sar sub specs
19616bdb68ceSCarl Huang  */
19626bdb68ceSCarl Huang struct cfg80211_sar_specs {
19636bdb68ceSCarl Huang 	enum nl80211_sar_type type;
19646bdb68ceSCarl Huang 	u32 num_sub_specs;
19656bdb68ceSCarl Huang 	struct cfg80211_sar_sub_specs sub_specs[];
19666bdb68ceSCarl Huang };
19676bdb68ceSCarl Huang 
19686bdb68ceSCarl Huang 
19696bdb68ceSCarl Huang /**
1970c2083e28SMauro Carvalho Chehab  * struct cfg80211_sar_freq_ranges - sar frequency ranges
19716bdb68ceSCarl Huang  * @start_freq:  start range edge frequency
19726bdb68ceSCarl Huang  * @end_freq:    end range edge frequency
19736bdb68ceSCarl Huang  */
19746bdb68ceSCarl Huang struct cfg80211_sar_freq_ranges {
19756bdb68ceSCarl Huang 	u32 start_freq;
19766bdb68ceSCarl Huang 	u32 end_freq;
19776bdb68ceSCarl Huang };
19786bdb68ceSCarl Huang 
19796bdb68ceSCarl Huang /**
19806bdb68ceSCarl Huang  * struct cfg80211_sar_capa - sar limit capability
19816bdb68ceSCarl Huang  * @type: it's set via power in 0.25dbm or other types
19826bdb68ceSCarl Huang  * @num_freq_ranges: number of frequency ranges
19836bdb68ceSCarl Huang  * @freq_ranges: memory to hold the freq ranges.
19846bdb68ceSCarl Huang  *
19856bdb68ceSCarl Huang  * Note: WLAN driver may append new ranges or split an existing
19866bdb68ceSCarl Huang  * range to small ones and then append them.
19876bdb68ceSCarl Huang  */
19886bdb68ceSCarl Huang struct cfg80211_sar_capa {
19896bdb68ceSCarl Huang 	enum nl80211_sar_type type;
19906bdb68ceSCarl Huang 	u32 num_freq_ranges;
19916bdb68ceSCarl Huang 	const struct cfg80211_sar_freq_ranges *freq_ranges;
19926bdb68ceSCarl Huang };
19936bdb68ceSCarl Huang 
199461aaa0e8SLinus Lüssing #if IS_ENABLED(CONFIG_CFG80211)
199566f7ac50SMichael Wu /**
19967406353dSAntonio Quartulli  * cfg80211_get_station - retrieve information about a given station
19977406353dSAntonio Quartulli  * @dev: the device where the station is supposed to be connected to
19987406353dSAntonio Quartulli  * @mac_addr: the mac address of the station of interest
19997406353dSAntonio Quartulli  * @sinfo: pointer to the structure to fill with the information
20007406353dSAntonio Quartulli  *
20017406353dSAntonio Quartulli  * Returns 0 on success and sinfo is filled with the available information
20027406353dSAntonio Quartulli  * otherwise returns a negative error code and the content of sinfo has to be
20037406353dSAntonio Quartulli  * considered undefined.
20047406353dSAntonio Quartulli  */
20057406353dSAntonio Quartulli int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr,
20067406353dSAntonio Quartulli 			 struct station_info *sinfo);
200761aaa0e8SLinus Lüssing #else
200861aaa0e8SLinus Lüssing static inline int cfg80211_get_station(struct net_device *dev,
200961aaa0e8SLinus Lüssing 				       const u8 *mac_addr,
201061aaa0e8SLinus Lüssing 				       struct station_info *sinfo)
201161aaa0e8SLinus Lüssing {
201261aaa0e8SLinus Lüssing 	return -ENOENT;
201361aaa0e8SLinus Lüssing }
201461aaa0e8SLinus Lüssing #endif
20157406353dSAntonio Quartulli 
20167406353dSAntonio Quartulli /**
201766f7ac50SMichael Wu  * enum monitor_flags - monitor flags
201866f7ac50SMichael Wu  *
201966f7ac50SMichael Wu  * Monitor interface configuration flags. Note that these must be the bits
202066f7ac50SMichael Wu  * according to the nl80211 flags.
202166f7ac50SMichael Wu  *
2022818a986eSJohannes Berg  * @MONITOR_FLAG_CHANGED: set if the flags were changed
202366f7ac50SMichael Wu  * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS
202466f7ac50SMichael Wu  * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP
202566f7ac50SMichael Wu  * @MONITOR_FLAG_CONTROL: pass control frames
202666f7ac50SMichael Wu  * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering
202766f7ac50SMichael Wu  * @MONITOR_FLAG_COOK_FRAMES: report frames after processing
2028e057d3c3SFelix Fietkau  * @MONITOR_FLAG_ACTIVE: active monitor, ACKs frames on its MAC address
202966f7ac50SMichael Wu  */
203066f7ac50SMichael Wu enum monitor_flags {
2031818a986eSJohannes Berg 	MONITOR_FLAG_CHANGED		= 1<<__NL80211_MNTR_FLAG_INVALID,
203266f7ac50SMichael Wu 	MONITOR_FLAG_FCSFAIL		= 1<<NL80211_MNTR_FLAG_FCSFAIL,
203366f7ac50SMichael Wu 	MONITOR_FLAG_PLCPFAIL		= 1<<NL80211_MNTR_FLAG_PLCPFAIL,
203466f7ac50SMichael Wu 	MONITOR_FLAG_CONTROL		= 1<<NL80211_MNTR_FLAG_CONTROL,
203566f7ac50SMichael Wu 	MONITOR_FLAG_OTHER_BSS		= 1<<NL80211_MNTR_FLAG_OTHER_BSS,
203666f7ac50SMichael Wu 	MONITOR_FLAG_COOK_FRAMES	= 1<<NL80211_MNTR_FLAG_COOK_FRAMES,
2037e057d3c3SFelix Fietkau 	MONITOR_FLAG_ACTIVE		= 1<<NL80211_MNTR_FLAG_ACTIVE,
203866f7ac50SMichael Wu };
203966f7ac50SMichael Wu 
20402ec600d6SLuis Carlos Cobo /**
20412ec600d6SLuis Carlos Cobo  * enum mpath_info_flags -  mesh path information flags
20422ec600d6SLuis Carlos Cobo  *
20432ec600d6SLuis Carlos Cobo  * Used by the driver to indicate which info in &struct mpath_info it has filled
20442ec600d6SLuis Carlos Cobo  * in during get_station() or dump_station().
20452ec600d6SLuis Carlos Cobo  *
2046abe37c4bSJohannes Berg  * @MPATH_INFO_FRAME_QLEN: @frame_qlen filled
2047abe37c4bSJohannes Berg  * @MPATH_INFO_SN: @sn filled
2048abe37c4bSJohannes Berg  * @MPATH_INFO_METRIC: @metric filled
2049abe37c4bSJohannes Berg  * @MPATH_INFO_EXPTIME: @exptime filled
2050abe37c4bSJohannes Berg  * @MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled
2051abe37c4bSJohannes Berg  * @MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled
2052abe37c4bSJohannes Berg  * @MPATH_INFO_FLAGS: @flags filled
2053cc241636SJulan Hsu  * @MPATH_INFO_HOP_COUNT: @hop_count filled
20549874b71fSJohannes Berg  * @MPATH_INFO_PATH_CHANGE: @path_change_count filled
20552ec600d6SLuis Carlos Cobo  */
20562ec600d6SLuis Carlos Cobo enum mpath_info_flags {
20572ec600d6SLuis Carlos Cobo 	MPATH_INFO_FRAME_QLEN		= BIT(0),
2058d19b3bf6SRui Paulo 	MPATH_INFO_SN			= BIT(1),
20592ec600d6SLuis Carlos Cobo 	MPATH_INFO_METRIC		= BIT(2),
20602ec600d6SLuis Carlos Cobo 	MPATH_INFO_EXPTIME		= BIT(3),
20612ec600d6SLuis Carlos Cobo 	MPATH_INFO_DISCOVERY_TIMEOUT	= BIT(4),
20622ec600d6SLuis Carlos Cobo 	MPATH_INFO_DISCOVERY_RETRIES	= BIT(5),
20632ec600d6SLuis Carlos Cobo 	MPATH_INFO_FLAGS		= BIT(6),
2064540bbcb9SJulan Hsu 	MPATH_INFO_HOP_COUNT		= BIT(7),
2065540bbcb9SJulan Hsu 	MPATH_INFO_PATH_CHANGE		= BIT(8),
20662ec600d6SLuis Carlos Cobo };
20672ec600d6SLuis Carlos Cobo 
20682ec600d6SLuis Carlos Cobo /**
20692ec600d6SLuis Carlos Cobo  * struct mpath_info - mesh path information
20702ec600d6SLuis Carlos Cobo  *
20712ec600d6SLuis Carlos Cobo  * Mesh path information filled by driver for get_mpath() and dump_mpath().
20722ec600d6SLuis Carlos Cobo  *
20732ec600d6SLuis Carlos Cobo  * @filled: bitfield of flags from &enum mpath_info_flags
20742ec600d6SLuis Carlos Cobo  * @frame_qlen: number of queued frames for this destination
2075d19b3bf6SRui Paulo  * @sn: target sequence number
20762ec600d6SLuis Carlos Cobo  * @metric: metric (cost) of this mesh path
20772ec600d6SLuis Carlos Cobo  * @exptime: expiration time for the mesh path from now, in msecs
20782ec600d6SLuis Carlos Cobo  * @flags: mesh path flags
20792ec600d6SLuis Carlos Cobo  * @discovery_timeout: total mesh path discovery timeout, in msecs
20802ec600d6SLuis Carlos Cobo  * @discovery_retries: mesh path discovery retries
2081f5ea9120SJohannes Berg  * @generation: generation number for nl80211 dumps.
2082f5ea9120SJohannes Berg  *	This number should increase every time the list of mesh paths
2083f5ea9120SJohannes Berg  *	changes, i.e. when a station is added or removed, so that
2084f5ea9120SJohannes Berg  *	userspace can tell whether it got a consistent snapshot.
2085cc241636SJulan Hsu  * @hop_count: hops to destination
2086540bbcb9SJulan Hsu  * @path_change_count: total number of path changes to destination
20872ec600d6SLuis Carlos Cobo  */
20882ec600d6SLuis Carlos Cobo struct mpath_info {
20892ec600d6SLuis Carlos Cobo 	u32 filled;
20902ec600d6SLuis Carlos Cobo 	u32 frame_qlen;
2091d19b3bf6SRui Paulo 	u32 sn;
20922ec600d6SLuis Carlos Cobo 	u32 metric;
20932ec600d6SLuis Carlos Cobo 	u32 exptime;
20942ec600d6SLuis Carlos Cobo 	u32 discovery_timeout;
20952ec600d6SLuis Carlos Cobo 	u8 discovery_retries;
20962ec600d6SLuis Carlos Cobo 	u8 flags;
2097cc241636SJulan Hsu 	u8 hop_count;
2098540bbcb9SJulan Hsu 	u32 path_change_count;
2099f5ea9120SJohannes Berg 
2100f5ea9120SJohannes Berg 	int generation;
21012ec600d6SLuis Carlos Cobo };
21022ec600d6SLuis Carlos Cobo 
21039f1ba906SJouni Malinen /**
21049f1ba906SJouni Malinen  * struct bss_parameters - BSS parameters
21059f1ba906SJouni Malinen  *
21069f1ba906SJouni Malinen  * Used to change BSS parameters (mainly for AP mode).
21079f1ba906SJouni Malinen  *
21089f1ba906SJouni Malinen  * @use_cts_prot: Whether to use CTS protection
21099f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
21109f1ba906SJouni Malinen  * @use_short_preamble: Whether the use of short preambles is allowed
21119f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
21129f1ba906SJouni Malinen  * @use_short_slot_time: Whether the use of short slot time is allowed
21139f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
211490c97a04SJouni Malinen  * @basic_rates: basic rates in IEEE 802.11 format
211590c97a04SJouni Malinen  *	(or NULL for no change)
211690c97a04SJouni Malinen  * @basic_rates_len: number of basic rates
2117fd8aaaf3SFelix Fietkau  * @ap_isolate: do not forward packets between connected stations
21189d6e371dSWright Feng  *	(0 = no, 1 = yes, -1 = do not change)
211950b12f59SHelmut Schaa  * @ht_opmode: HT Operation mode
212050b12f59SHelmut Schaa  *	(u16 = opmode, -1 = do not change)
212153cabad7SJohannes Berg  * @p2p_ctwindow: P2P CT Window (-1 = no change)
212253cabad7SJohannes Berg  * @p2p_opp_ps: P2P opportunistic PS (-1 = no change)
21239f1ba906SJouni Malinen  */
21249f1ba906SJouni Malinen struct bss_parameters {
21259f1ba906SJouni Malinen 	int use_cts_prot;
21269f1ba906SJouni Malinen 	int use_short_preamble;
21279f1ba906SJouni Malinen 	int use_short_slot_time;
2128c1e5f471SJohannes Berg 	const u8 *basic_rates;
212990c97a04SJouni Malinen 	u8 basic_rates_len;
2130fd8aaaf3SFelix Fietkau 	int ap_isolate;
213150b12f59SHelmut Schaa 	int ht_opmode;
213253cabad7SJohannes Berg 	s8 p2p_ctwindow, p2p_opp_ps;
21339f1ba906SJouni Malinen };
21342ec600d6SLuis Carlos Cobo 
21353ddd53f3SChun-Yeow Yeoh /**
213629cbe68cSJohannes Berg  * struct mesh_config - 802.11s mesh configuration
213729cbe68cSJohannes Berg  *
213829cbe68cSJohannes Berg  * These parameters can be changed while the mesh is active.
21393ddd53f3SChun-Yeow Yeoh  *
21403ddd53f3SChun-Yeow Yeoh  * @dot11MeshRetryTimeout: the initial retry timeout in millisecond units used
21413ddd53f3SChun-Yeow Yeoh  *	by the Mesh Peering Open message
21423ddd53f3SChun-Yeow Yeoh  * @dot11MeshConfirmTimeout: the initial retry timeout in millisecond units
21433ddd53f3SChun-Yeow Yeoh  *	used by the Mesh Peering Open message
21443ddd53f3SChun-Yeow Yeoh  * @dot11MeshHoldingTimeout: the confirm timeout in millisecond units used by
21453ddd53f3SChun-Yeow Yeoh  *	the mesh peering management to close a mesh peering
21463ddd53f3SChun-Yeow Yeoh  * @dot11MeshMaxPeerLinks: the maximum number of peer links allowed on this
21473ddd53f3SChun-Yeow Yeoh  *	mesh interface
21483ddd53f3SChun-Yeow Yeoh  * @dot11MeshMaxRetries: the maximum number of peer link open retries that can
21493ddd53f3SChun-Yeow Yeoh  *	be sent to establish a new peer link instance in a mesh
21503ddd53f3SChun-Yeow Yeoh  * @dot11MeshTTL: the value of TTL field set at a source mesh STA
21513ddd53f3SChun-Yeow Yeoh  * @element_ttl: the value of TTL field set at a mesh STA for path selection
21523ddd53f3SChun-Yeow Yeoh  *	elements
21533ddd53f3SChun-Yeow Yeoh  * @auto_open_plinks: whether we should automatically open peer links when we
21543ddd53f3SChun-Yeow Yeoh  *	detect compatible mesh peers
21553ddd53f3SChun-Yeow Yeoh  * @dot11MeshNbrOffsetMaxNeighbor: the maximum number of neighbors to
21563ddd53f3SChun-Yeow Yeoh  *	synchronize to for 11s default synchronization method
21573ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPmaxPREQretries: the number of action frames containing a PREQ
21583ddd53f3SChun-Yeow Yeoh  *	that an originator mesh STA can send to a particular path target
21593ddd53f3SChun-Yeow Yeoh  * @path_refresh_time: how frequently to refresh mesh paths in milliseconds
21603ddd53f3SChun-Yeow Yeoh  * @min_discovery_timeout: the minimum length of time to wait until giving up on
21613ddd53f3SChun-Yeow Yeoh  *	a path discovery in milliseconds
21623ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPactivePathTimeout: the time (in TUs) for which mesh STAs
21633ddd53f3SChun-Yeow Yeoh  *	receiving a PREQ shall consider the forwarding information from the
21643ddd53f3SChun-Yeow Yeoh  *	root to be valid. (TU = time unit)
21653ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPpreqMinInterval: the minimum interval of time (in TUs) during
21663ddd53f3SChun-Yeow Yeoh  *	which a mesh STA can send only one action frame containing a PREQ
21673ddd53f3SChun-Yeow Yeoh  *	element
21683ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPperrMinInterval: the minimum interval of time (in TUs) during
21693ddd53f3SChun-Yeow Yeoh  *	which a mesh STA can send only one Action frame containing a PERR
21703ddd53f3SChun-Yeow Yeoh  *	element
21713ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPnetDiameterTraversalTime: the interval of time (in TUs) that
21723ddd53f3SChun-Yeow Yeoh  *	it takes for an HWMP information element to propagate across the mesh
21733ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPRootMode: the configuration of a mesh STA as root mesh STA
21743ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPRannInterval: the interval of time (in TUs) between root
21753ddd53f3SChun-Yeow Yeoh  *	announcements are transmitted
21763ddd53f3SChun-Yeow Yeoh  * @dot11MeshGateAnnouncementProtocol: whether to advertise that this mesh
21773ddd53f3SChun-Yeow Yeoh  *	station has access to a broader network beyond the MBSS. (This is
21783ddd53f3SChun-Yeow Yeoh  *	missnamed in draft 12.0: dot11MeshGateAnnouncementProtocol set to true
21793ddd53f3SChun-Yeow Yeoh  *	only means that the station will announce others it's a mesh gate, but
21803ddd53f3SChun-Yeow Yeoh  *	not necessarily using the gate announcement protocol. Still keeping the
21813ddd53f3SChun-Yeow Yeoh  *	same nomenclature to be in sync with the spec)
21823ddd53f3SChun-Yeow Yeoh  * @dot11MeshForwarding: whether the Mesh STA is forwarding or non-forwarding
21833ddd53f3SChun-Yeow Yeoh  *	entity (default is TRUE - forwarding entity)
21843ddd53f3SChun-Yeow Yeoh  * @rssi_threshold: the threshold for average signal strength of candidate
21853ddd53f3SChun-Yeow Yeoh  *	station to establish a peer link
21863ddd53f3SChun-Yeow Yeoh  * @ht_opmode: mesh HT protection mode
2187ac1073a6SChun-Yeow Yeoh  *
2188ac1073a6SChun-Yeow Yeoh  * @dot11MeshHWMPactivePathToRootTimeout: The time (in TUs) for which mesh STAs
2189ac1073a6SChun-Yeow Yeoh  *	receiving a proactive PREQ shall consider the forwarding information to
2190ac1073a6SChun-Yeow Yeoh  *	the root mesh STA to be valid.
2191ac1073a6SChun-Yeow Yeoh  *
2192ac1073a6SChun-Yeow Yeoh  * @dot11MeshHWMProotInterval: The interval of time (in TUs) between proactive
2193ac1073a6SChun-Yeow Yeoh  *	PREQs are transmitted.
2194728b19e5SChun-Yeow Yeoh  * @dot11MeshHWMPconfirmationInterval: The minimum interval of time (in TUs)
2195728b19e5SChun-Yeow Yeoh  *	during which a mesh STA can send only one Action frame containing
2196728b19e5SChun-Yeow Yeoh  *	a PREQ element for root path confirmation.
21973b1c5a53SMarco Porsch  * @power_mode: The default mesh power save mode which will be the initial
21983b1c5a53SMarco Porsch  *	setting for new peer links.
21993b1c5a53SMarco Porsch  * @dot11MeshAwakeWindowDuration: The duration in TUs the STA will remain awake
22003b1c5a53SMarco Porsch  *	after transmitting its beacon.
22018e7c0538SColleen Twitty  * @plink_timeout: If no tx activity is seen from a STA we've established
22028e7c0538SColleen Twitty  *	peering with for longer than this time (in seconds), then remove it
22038e7c0538SColleen Twitty  *	from the STA's list of peers.  Default is 30 minutes.
22042d8b08feSMauro Carvalho Chehab  * @dot11MeshConnectedToAuthServer: if set to true then this mesh STA
22052d8b08feSMauro Carvalho Chehab  *	will advertise that it is connected to a authentication server
22062d8b08feSMauro Carvalho Chehab  *	in the mesh formation field.
220701d66fbdSBob Copeland  * @dot11MeshConnectedToMeshGate: if set to true, advertise that this STA is
220801d66fbdSBob Copeland  *      connected to a mesh gate in mesh formation info.  If false, the
220901d66fbdSBob Copeland  *      value in mesh formation is determined by the presence of root paths
221001d66fbdSBob Copeland  *      in the mesh path table
2211e3718a61SLinus Lüssing  * @dot11MeshNolearn: Try to avoid multi-hop path discovery (e.g. PREQ/PREP
2212e3718a61SLinus Lüssing  *      for HWMP) if the destination is a direct neighbor. Note that this might
2213e3718a61SLinus Lüssing  *      not be the optimal decision as a multi-hop route might be better. So
2214e3718a61SLinus Lüssing  *      if using this setting you will likely also want to disable
2215e3718a61SLinus Lüssing  *      dot11MeshForwarding and use another mesh routing protocol on top.
221629cbe68cSJohannes Berg  */
221793da9cc1Scolin@cozybit.com struct mesh_config {
221893da9cc1Scolin@cozybit.com 	u16 dot11MeshRetryTimeout;
221993da9cc1Scolin@cozybit.com 	u16 dot11MeshConfirmTimeout;
222093da9cc1Scolin@cozybit.com 	u16 dot11MeshHoldingTimeout;
222193da9cc1Scolin@cozybit.com 	u16 dot11MeshMaxPeerLinks;
222293da9cc1Scolin@cozybit.com 	u8 dot11MeshMaxRetries;
222393da9cc1Scolin@cozybit.com 	u8 dot11MeshTTL;
222445904f21SJavier Cardona 	u8 element_ttl;
222593da9cc1Scolin@cozybit.com 	bool auto_open_plinks;
2226d299a1f2SJavier Cardona 	u32 dot11MeshNbrOffsetMaxNeighbor;
222793da9cc1Scolin@cozybit.com 	u8 dot11MeshHWMPmaxPREQretries;
222893da9cc1Scolin@cozybit.com 	u32 path_refresh_time;
222993da9cc1Scolin@cozybit.com 	u16 min_discovery_timeout;
223093da9cc1Scolin@cozybit.com 	u32 dot11MeshHWMPactivePathTimeout;
223193da9cc1Scolin@cozybit.com 	u16 dot11MeshHWMPpreqMinInterval;
2232dca7e943SThomas Pedersen 	u16 dot11MeshHWMPperrMinInterval;
223393da9cc1Scolin@cozybit.com 	u16 dot11MeshHWMPnetDiameterTraversalTime;
223463c5723bSRui Paulo 	u8 dot11MeshHWMPRootMode;
223501d66fbdSBob Copeland 	bool dot11MeshConnectedToMeshGate;
2236184eebe6SMarkus Theil 	bool dot11MeshConnectedToAuthServer;
22370507e159SJavier Cardona 	u16 dot11MeshHWMPRannInterval;
223816dd7267SJavier Cardona 	bool dot11MeshGateAnnouncementProtocol;
223994f90656SChun-Yeow Yeoh 	bool dot11MeshForwarding;
224055335137SAshok Nagarajan 	s32 rssi_threshold;
224170c33eaaSAshok Nagarajan 	u16 ht_opmode;
2242ac1073a6SChun-Yeow Yeoh 	u32 dot11MeshHWMPactivePathToRootTimeout;
2243ac1073a6SChun-Yeow Yeoh 	u16 dot11MeshHWMProotInterval;
2244728b19e5SChun-Yeow Yeoh 	u16 dot11MeshHWMPconfirmationInterval;
22453b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode power_mode;
22463b1c5a53SMarco Porsch 	u16 dot11MeshAwakeWindowDuration;
22478e7c0538SColleen Twitty 	u32 plink_timeout;
2248e3718a61SLinus Lüssing 	bool dot11MeshNolearn;
224993da9cc1Scolin@cozybit.com };
225093da9cc1Scolin@cozybit.com 
225131888487SJouni Malinen /**
225229cbe68cSJohannes Berg  * struct mesh_setup - 802.11s mesh setup configuration
2253683b6d3bSJohannes Berg  * @chandef: defines the channel to use
225429cbe68cSJohannes Berg  * @mesh_id: the mesh ID
225529cbe68cSJohannes Berg  * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes
2256d299a1f2SJavier Cardona  * @sync_method: which synchronization method to use
2257c80d545dSJavier Cardona  * @path_sel_proto: which path selection protocol to use
2258c80d545dSJavier Cardona  * @path_metric: which metric to use
22596e16d90bSColleen Twitty  * @auth_id: which authentication method this mesh is using
2260581a8b0fSJavier Cardona  * @ie: vendor information elements (optional)
2261581a8b0fSJavier Cardona  * @ie_len: length of vendor information elements
2262b130e5ceSJavier Cardona  * @is_authenticated: this mesh requires authentication
2263b130e5ceSJavier Cardona  * @is_secure: this mesh uses security
2264bb2798d4SThomas Pedersen  * @user_mpm: userspace handles all MPM functions
22659bdbf04dSMarco Porsch  * @dtim_period: DTIM period to use
22669bdbf04dSMarco Porsch  * @beacon_interval: beacon interval to use
22674bb62344SChun-Yeow Yeoh  * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a]
2268ffb3cf30SAshok Nagarajan  * @basic_rates: basic rates to use when creating the mesh
22698564e382SJohannes Berg  * @beacon_rate: bitrate to be used for beacons
2270d37d49c2SBenjamin Berg  * @userspace_handles_dfs: whether user space controls DFS operation, i.e.
2271d37d49c2SBenjamin Berg  *	changes the channel when a radar is detected. This is required
2272d37d49c2SBenjamin Berg  *	to operate on DFS channels.
22731224f583SDenis Kenzior  * @control_port_over_nl80211: TRUE if userspace expects to exchange control
22741224f583SDenis Kenzior  *	port frames over NL80211 instead of the network interface.
227529cbe68cSJohannes Berg  *
227629cbe68cSJohannes Berg  * These parameters are fixed when the mesh is created.
227729cbe68cSJohannes Berg  */
227829cbe68cSJohannes Berg struct mesh_setup {
2279683b6d3bSJohannes Berg 	struct cfg80211_chan_def chandef;
228029cbe68cSJohannes Berg 	const u8 *mesh_id;
228129cbe68cSJohannes Berg 	u8 mesh_id_len;
2282d299a1f2SJavier Cardona 	u8 sync_method;
2283c80d545dSJavier Cardona 	u8 path_sel_proto;
2284c80d545dSJavier Cardona 	u8 path_metric;
22856e16d90bSColleen Twitty 	u8 auth_id;
2286581a8b0fSJavier Cardona 	const u8 *ie;
2287581a8b0fSJavier Cardona 	u8 ie_len;
2288b130e5ceSJavier Cardona 	bool is_authenticated;
228915d5dda6SJavier Cardona 	bool is_secure;
2290bb2798d4SThomas Pedersen 	bool user_mpm;
22919bdbf04dSMarco Porsch 	u8 dtim_period;
22929bdbf04dSMarco Porsch 	u16 beacon_interval;
229357fbcce3SJohannes Berg 	int mcast_rate[NUM_NL80211_BANDS];
2294ffb3cf30SAshok Nagarajan 	u32 basic_rates;
22958564e382SJohannes Berg 	struct cfg80211_bitrate_mask beacon_rate;
2296d37d49c2SBenjamin Berg 	bool userspace_handles_dfs;
22971224f583SDenis Kenzior 	bool control_port_over_nl80211;
229829cbe68cSJohannes Berg };
229929cbe68cSJohannes Berg 
230029cbe68cSJohannes Berg /**
23016e0bd6c3SRostislav Lisovy  * struct ocb_setup - 802.11p OCB mode setup configuration
23026e0bd6c3SRostislav Lisovy  * @chandef: defines the channel to use
23036e0bd6c3SRostislav Lisovy  *
23046e0bd6c3SRostislav Lisovy  * These parameters are fixed when connecting to the network
23056e0bd6c3SRostislav Lisovy  */
23066e0bd6c3SRostislav Lisovy struct ocb_setup {
23076e0bd6c3SRostislav Lisovy 	struct cfg80211_chan_def chandef;
23086e0bd6c3SRostislav Lisovy };
23096e0bd6c3SRostislav Lisovy 
23106e0bd6c3SRostislav Lisovy /**
231131888487SJouni Malinen  * struct ieee80211_txq_params - TX queue parameters
2312a3304b0aSJohannes Berg  * @ac: AC identifier
231331888487SJouni Malinen  * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled
231431888487SJouni Malinen  * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range
231531888487SJouni Malinen  *	1..32767]
231631888487SJouni Malinen  * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range
231731888487SJouni Malinen  *	1..32767]
231831888487SJouni Malinen  * @aifs: Arbitration interframe space [0..255]
231931888487SJouni Malinen  */
232031888487SJouni Malinen struct ieee80211_txq_params {
2321a3304b0aSJohannes Berg 	enum nl80211_ac ac;
232231888487SJouni Malinen 	u16 txop;
232331888487SJouni Malinen 	u16 cwmin;
232431888487SJouni Malinen 	u16 cwmax;
232531888487SJouni Malinen 	u8 aifs;
232631888487SJouni Malinen };
232731888487SJouni Malinen 
2328d70e9693SJohannes Berg /**
2329d70e9693SJohannes Berg  * DOC: Scanning and BSS list handling
2330d70e9693SJohannes Berg  *
2331d70e9693SJohannes Berg  * The scanning process itself is fairly simple, but cfg80211 offers quite
2332d70e9693SJohannes Berg  * a bit of helper functionality. To start a scan, the scan operation will
2333d70e9693SJohannes Berg  * be invoked with a scan definition. This scan definition contains the
2334d70e9693SJohannes Berg  * channels to scan, and the SSIDs to send probe requests for (including the
2335d70e9693SJohannes Berg  * wildcard, if desired). A passive scan is indicated by having no SSIDs to
2336d70e9693SJohannes Berg  * probe. Additionally, a scan request may contain extra information elements
2337d70e9693SJohannes Berg  * that should be added to the probe request. The IEs are guaranteed to be
2338d70e9693SJohannes Berg  * well-formed, and will not exceed the maximum length the driver advertised
2339d70e9693SJohannes Berg  * in the wiphy structure.
2340d70e9693SJohannes Berg  *
2341d70e9693SJohannes Berg  * When scanning finds a BSS, cfg80211 needs to be notified of that, because
2342d70e9693SJohannes Berg  * it is responsible for maintaining the BSS list; the driver should not
2343d70e9693SJohannes Berg  * maintain a list itself. For this notification, various functions exist.
2344d70e9693SJohannes Berg  *
2345d70e9693SJohannes Berg  * Since drivers do not maintain a BSS list, there are also a number of
2346d70e9693SJohannes Berg  * functions to search for a BSS and obtain information about it from the
2347d70e9693SJohannes Berg  * BSS structure cfg80211 maintains. The BSS list is also made available
2348d70e9693SJohannes Berg  * to userspace.
2349d70e9693SJohannes Berg  */
235072bdcf34SJouni Malinen 
2351704232c2SJohannes Berg /**
23522a519311SJohannes Berg  * struct cfg80211_ssid - SSID description
23532a519311SJohannes Berg  * @ssid: the SSID
23542a519311SJohannes Berg  * @ssid_len: length of the ssid
23552a519311SJohannes Berg  */
23562a519311SJohannes Berg struct cfg80211_ssid {
23572a519311SJohannes Berg 	u8 ssid[IEEE80211_MAX_SSID_LEN];
23582a519311SJohannes Berg 	u8 ssid_len;
23592a519311SJohannes Berg };
23602a519311SJohannes Berg 
23612a519311SJohannes Berg /**
23621d76250bSAvraham Stern  * struct cfg80211_scan_info - information about completed scan
23631d76250bSAvraham Stern  * @scan_start_tsf: scan start time in terms of the TSF of the BSS that the
23641d76250bSAvraham Stern  *	wireless device that requested the scan is connected to. If this
23651d76250bSAvraham Stern  *	information is not available, this field is left zero.
23661d76250bSAvraham Stern  * @tsf_bssid: the BSSID according to which %scan_start_tsf is set.
23671d76250bSAvraham Stern  * @aborted: set to true if the scan was aborted for any reason,
23681d76250bSAvraham Stern  *	userspace will be notified of that
23691d76250bSAvraham Stern  */
23701d76250bSAvraham Stern struct cfg80211_scan_info {
23711d76250bSAvraham Stern 	u64 scan_start_tsf;
23721d76250bSAvraham Stern 	u8 tsf_bssid[ETH_ALEN] __aligned(2);
23731d76250bSAvraham Stern 	bool aborted;
23741d76250bSAvraham Stern };
23751d76250bSAvraham Stern 
23761d76250bSAvraham Stern /**
2377c8cb5b85STova Mussai  * struct cfg80211_scan_6ghz_params - relevant for 6 GHz only
2378c8cb5b85STova Mussai  *
23792d8b08feSMauro Carvalho Chehab  * @short_ssid: short ssid to scan for
2380c8cb5b85STova Mussai  * @bssid: bssid to scan for
2381c8cb5b85STova Mussai  * @channel_idx: idx of the channel in the channel array in the scan request
2382c8cb5b85STova Mussai  *	 which the above info relvant to
2383c8cb5b85STova Mussai  * @unsolicited_probe: the AP transmits unsolicited probe response every 20 TU
23842d8b08feSMauro Carvalho Chehab  * @short_ssid_valid: @short_ssid is valid and can be used
2385c8cb5b85STova Mussai  * @psc_no_listen: when set, and the channel is a PSC channel, no need to wait
2386c8cb5b85STova Mussai  *       20 TUs before starting to send probe requests.
2387c8cb5b85STova Mussai  */
2388c8cb5b85STova Mussai struct cfg80211_scan_6ghz_params {
2389c8cb5b85STova Mussai 	u32 short_ssid;
2390c8cb5b85STova Mussai 	u32 channel_idx;
2391c8cb5b85STova Mussai 	u8 bssid[ETH_ALEN];
2392c8cb5b85STova Mussai 	bool unsolicited_probe;
2393c8cb5b85STova Mussai 	bool short_ssid_valid;
2394c8cb5b85STova Mussai 	bool psc_no_listen;
2395c8cb5b85STova Mussai };
2396c8cb5b85STova Mussai 
2397c8cb5b85STova Mussai /**
23982a519311SJohannes Berg  * struct cfg80211_scan_request - scan request description
23992a519311SJohannes Berg  *
24002a519311SJohannes Berg  * @ssids: SSIDs to scan for (active scan only)
24012a519311SJohannes Berg  * @n_ssids: number of SSIDs
24022a519311SJohannes Berg  * @channels: channels to scan on.
2403ca3dbc20SHelmut Schaa  * @n_channels: total number of channels to scan
2404dcd6eac1SSimon Wunderlich  * @scan_width: channel width for scanning
240570692ad2SJouni Malinen  * @ie: optional information element(s) to add into Probe Request or %NULL
240670692ad2SJouni Malinen  * @ie_len: length of ie in octets
24071d76250bSAvraham Stern  * @duration: how long to listen on each channel, in TUs. If
24081d76250bSAvraham Stern  *	%duration_mandatory is not set, this is the maximum dwell time and
24091d76250bSAvraham Stern  *	the actual dwell time may be shorter.
24101d76250bSAvraham Stern  * @duration_mandatory: if set, the scan duration must be as specified by the
24111d76250bSAvraham Stern  *	%duration field.
2412ed473771SSam Leffler  * @flags: bit field of flags controlling operation
241334850ab2SJohannes Berg  * @rates: bitmap of rates to advertise for each band
24142a519311SJohannes Berg  * @wiphy: the wiphy this was for
241515d6030bSSam Leffler  * @scan_start: time (in jiffies) when the scan started
2416fd014284SJohannes Berg  * @wdev: the wireless device to scan for
24171d76250bSAvraham Stern  * @info: (internal) information about completed scan
24185fe231e8SJohannes Berg  * @notified: (internal) scan request was notified as done or aborted
2419e9f935e3SRajkumar Manoharan  * @no_cck: used to send probe requests at non CCK rate in 2GHz band
2420ad2b26abSJohannes Berg  * @mac_addr: MAC address used with randomisation
2421ad2b26abSJohannes Berg  * @mac_addr_mask: MAC address mask used with randomisation, bits that
2422ad2b26abSJohannes Berg  *	are 0 in the mask should be randomised, bits that are 1 should
2423ad2b26abSJohannes Berg  *	be taken from the @mac_addr
2424c8cb5b85STova Mussai  * @scan_6ghz: relevant for split scan request only,
2425c8cb5b85STova Mussai  *	true if this is the second scan request
2426c8cb5b85STova Mussai  * @n_6ghz_params: number of 6 GHz params
2427c8cb5b85STova Mussai  * @scan_6ghz_params: 6 GHz params
2428818965d3SJouni Malinen  * @bssid: BSSID to scan for (most commonly, the wildcard BSSID)
24292a519311SJohannes Berg  */
24302a519311SJohannes Berg struct cfg80211_scan_request {
24312a519311SJohannes Berg 	struct cfg80211_ssid *ssids;
24322a519311SJohannes Berg 	int n_ssids;
24332a519311SJohannes Berg 	u32 n_channels;
2434dcd6eac1SSimon Wunderlich 	enum nl80211_bss_scan_width scan_width;
2435de95a54bSJohannes Berg 	const u8 *ie;
243670692ad2SJouni Malinen 	size_t ie_len;
24371d76250bSAvraham Stern 	u16 duration;
24381d76250bSAvraham Stern 	bool duration_mandatory;
2439ed473771SSam Leffler 	u32 flags;
24402a519311SJohannes Berg 
244157fbcce3SJohannes Berg 	u32 rates[NUM_NL80211_BANDS];
244234850ab2SJohannes Berg 
2443fd014284SJohannes Berg 	struct wireless_dev *wdev;
2444fd014284SJohannes Berg 
2445ad2b26abSJohannes Berg 	u8 mac_addr[ETH_ALEN] __aligned(2);
2446ad2b26abSJohannes Berg 	u8 mac_addr_mask[ETH_ALEN] __aligned(2);
2447818965d3SJouni Malinen 	u8 bssid[ETH_ALEN] __aligned(2);
2448ad2b26abSJohannes Berg 
24492a519311SJohannes Berg 	/* internal */
24502a519311SJohannes Berg 	struct wiphy *wiphy;
245115d6030bSSam Leffler 	unsigned long scan_start;
24521d76250bSAvraham Stern 	struct cfg80211_scan_info info;
24531d76250bSAvraham Stern 	bool notified;
2454e9f935e3SRajkumar Manoharan 	bool no_cck;
2455c8cb5b85STova Mussai 	bool scan_6ghz;
2456c8cb5b85STova Mussai 	u32 n_6ghz_params;
2457c8cb5b85STova Mussai 	struct cfg80211_scan_6ghz_params *scan_6ghz_params;
24585ba63533SJohannes Berg 
24595ba63533SJohannes Berg 	/* keep last */
2460396fba0aSGustavo A. R. Silva 	struct ieee80211_channel *channels[];
24612a519311SJohannes Berg };
24622a519311SJohannes Berg 
2463ad2b26abSJohannes Berg static inline void get_random_mask_addr(u8 *buf, const u8 *addr, const u8 *mask)
2464ad2b26abSJohannes Berg {
2465ad2b26abSJohannes Berg 	int i;
2466ad2b26abSJohannes Berg 
2467ad2b26abSJohannes Berg 	get_random_bytes(buf, ETH_ALEN);
2468ad2b26abSJohannes Berg 	for (i = 0; i < ETH_ALEN; i++) {
2469ad2b26abSJohannes Berg 		buf[i] &= ~mask[i];
2470ad2b26abSJohannes Berg 		buf[i] |= addr[i] & mask[i];
2471ad2b26abSJohannes Berg 	}
2472ad2b26abSJohannes Berg }
2473ad2b26abSJohannes Berg 
24742a519311SJohannes Berg /**
2475a1f1c21cSLuciano Coelho  * struct cfg80211_match_set - sets of attributes to match
2476a1f1c21cSLuciano Coelho  *
24773007e352SArend Van Spriel  * @ssid: SSID to be matched; may be zero-length in case of BSSID match
24783007e352SArend Van Spriel  *	or no match (RSSI only)
24793007e352SArend Van Spriel  * @bssid: BSSID to be matched; may be all-zero BSSID in case of SSID match
24803007e352SArend Van Spriel  *	or no match (RSSI only)
2481ea73cbceSJohannes Berg  * @rssi_thold: don't report scan results below this threshold (in s32 dBm)
24821e1b11b6Svamsi krishna  * @per_band_rssi_thold: Minimum rssi threshold for each band to be applied
24831e1b11b6Svamsi krishna  *	for filtering out scan results received. Drivers advertize this support
24841e1b11b6Svamsi krishna  *	of band specific rssi based filtering through the feature capability
24851e1b11b6Svamsi krishna  *	%NL80211_EXT_FEATURE_SCHED_SCAN_BAND_SPECIFIC_RSSI_THOLD. These band
24861e1b11b6Svamsi krishna  *	specific rssi thresholds take precedence over rssi_thold, if specified.
24871e1b11b6Svamsi krishna  *	If not specified for any band, it will be assigned with rssi_thold of
24881e1b11b6Svamsi krishna  *	corresponding matchset.
2489a1f1c21cSLuciano Coelho  */
2490a1f1c21cSLuciano Coelho struct cfg80211_match_set {
2491a1f1c21cSLuciano Coelho 	struct cfg80211_ssid ssid;
24923007e352SArend Van Spriel 	u8 bssid[ETH_ALEN];
2493ea73cbceSJohannes Berg 	s32 rssi_thold;
24941e1b11b6Svamsi krishna 	s32 per_band_rssi_thold[NUM_NL80211_BANDS];
2495a1f1c21cSLuciano Coelho };
2496a1f1c21cSLuciano Coelho 
2497a1f1c21cSLuciano Coelho /**
24983b06d277SAvraham Stern  * struct cfg80211_sched_scan_plan - scan plan for scheduled scan
24993b06d277SAvraham Stern  *
25003b06d277SAvraham Stern  * @interval: interval between scheduled scan iterations. In seconds.
25013b06d277SAvraham Stern  * @iterations: number of scan iterations in this scan plan. Zero means
25023b06d277SAvraham Stern  *	infinite loop.
25033b06d277SAvraham Stern  *	The last scan plan will always have this parameter set to zero,
25043b06d277SAvraham Stern  *	all other scan plans will have a finite number of iterations.
25053b06d277SAvraham Stern  */
25063b06d277SAvraham Stern struct cfg80211_sched_scan_plan {
25073b06d277SAvraham Stern 	u32 interval;
25083b06d277SAvraham Stern 	u32 iterations;
25093b06d277SAvraham Stern };
25103b06d277SAvraham Stern 
25113b06d277SAvraham Stern /**
2512bf95ecdbSvamsi krishna  * struct cfg80211_bss_select_adjust - BSS selection with RSSI adjustment.
2513bf95ecdbSvamsi krishna  *
2514bf95ecdbSvamsi krishna  * @band: band of BSS which should match for RSSI level adjustment.
2515bf95ecdbSvamsi krishna  * @delta: value of RSSI level adjustment.
2516bf95ecdbSvamsi krishna  */
2517bf95ecdbSvamsi krishna struct cfg80211_bss_select_adjust {
2518bf95ecdbSvamsi krishna 	enum nl80211_band band;
2519bf95ecdbSvamsi krishna 	s8 delta;
2520bf95ecdbSvamsi krishna };
2521bf95ecdbSvamsi krishna 
2522bf95ecdbSvamsi krishna /**
2523807f8a8cSLuciano Coelho  * struct cfg80211_sched_scan_request - scheduled scan request description
2524807f8a8cSLuciano Coelho  *
252596b08fd6SArend Van Spriel  * @reqid: identifies this request.
2526807f8a8cSLuciano Coelho  * @ssids: SSIDs to scan for (passed in the probe_reqs in active scans)
2527807f8a8cSLuciano Coelho  * @n_ssids: number of SSIDs
2528807f8a8cSLuciano Coelho  * @n_channels: total number of channels to scan
2529dcd6eac1SSimon Wunderlich  * @scan_width: channel width for scanning
2530807f8a8cSLuciano Coelho  * @ie: optional information element(s) to add into Probe Request or %NULL
2531807f8a8cSLuciano Coelho  * @ie_len: length of ie in octets
2532ed473771SSam Leffler  * @flags: bit field of flags controlling operation
2533a1f1c21cSLuciano Coelho  * @match_sets: sets of parameters to be matched for a scan result
2534a1f1c21cSLuciano Coelho  *	entry to be considered valid and to be passed to the host
2535a1f1c21cSLuciano Coelho  *	(others are filtered out).
2536a1f1c21cSLuciano Coelho  *	If ommited, all results are passed.
2537a1f1c21cSLuciano Coelho  * @n_match_sets: number of match sets
25386406c919SJohannes Berg  * @report_results: indicates that results were reported for this request
2539807f8a8cSLuciano Coelho  * @wiphy: the wiphy this was for
2540807f8a8cSLuciano Coelho  * @dev: the interface
2541077f897aSJohannes Berg  * @scan_start: start time of the scheduled scan
2542807f8a8cSLuciano Coelho  * @channels: channels to scan
2543ea73cbceSJohannes Berg  * @min_rssi_thold: for drivers only supporting a single threshold, this
2544ea73cbceSJohannes Berg  *	contains the minimum over all matchsets
2545ad2b26abSJohannes Berg  * @mac_addr: MAC address used with randomisation
2546ad2b26abSJohannes Berg  * @mac_addr_mask: MAC address mask used with randomisation, bits that
2547ad2b26abSJohannes Berg  *	are 0 in the mask should be randomised, bits that are 1 should
2548ad2b26abSJohannes Berg  *	be taken from the @mac_addr
25493b06d277SAvraham Stern  * @scan_plans: scan plans to be executed in this scheduled scan. Lowest
25503b06d277SAvraham Stern  *	index must be executed first.
25513b06d277SAvraham Stern  * @n_scan_plans: number of scan plans, at least 1.
255231a60ed1SJukka Rissanen  * @rcu_head: RCU callback used to free the struct
255393a1e86cSJukka Rissanen  * @owner_nlportid: netlink portid of owner (if this should is a request
255493a1e86cSJukka Rissanen  *	owned by a particular socket)
2555ca986ad9SArend Van Spriel  * @nl_owner_dead: netlink owner socket was closed - this request be freed
2556ca986ad9SArend Van Spriel  * @list: for keeping list of requests.
25579c748934SLuciano Coelho  * @delay: delay in seconds to use before starting the first scan
25589c748934SLuciano Coelho  *	cycle.  The driver may ignore this parameter and start
25599c748934SLuciano Coelho  *	immediately (or at any other time), if this feature is not
25609c748934SLuciano Coelho  *	supported.
2561bf95ecdbSvamsi krishna  * @relative_rssi_set: Indicates whether @relative_rssi is set or not.
2562bf95ecdbSvamsi krishna  * @relative_rssi: Relative RSSI threshold in dB to restrict scan result
2563bf95ecdbSvamsi krishna  *	reporting in connected state to cases where a matching BSS is determined
2564bf95ecdbSvamsi krishna  *	to have better or slightly worse RSSI than the current connected BSS.
2565bf95ecdbSvamsi krishna  *	The relative RSSI threshold values are ignored in disconnected state.
2566bf95ecdbSvamsi krishna  * @rssi_adjust: delta dB of RSSI preference to be given to the BSSs that belong
2567bf95ecdbSvamsi krishna  *	to the specified band while deciding whether a better BSS is reported
2568bf95ecdbSvamsi krishna  *	using @relative_rssi. If delta is a negative number, the BSSs that
2569bf95ecdbSvamsi krishna  *	belong to the specified band will be penalized by delta dB in relative
2570bf95ecdbSvamsi krishna  *	comparisions.
2571807f8a8cSLuciano Coelho  */
2572807f8a8cSLuciano Coelho struct cfg80211_sched_scan_request {
257396b08fd6SArend Van Spriel 	u64 reqid;
2574807f8a8cSLuciano Coelho 	struct cfg80211_ssid *ssids;
2575807f8a8cSLuciano Coelho 	int n_ssids;
2576807f8a8cSLuciano Coelho 	u32 n_channels;
2577dcd6eac1SSimon Wunderlich 	enum nl80211_bss_scan_width scan_width;
2578807f8a8cSLuciano Coelho 	const u8 *ie;
2579807f8a8cSLuciano Coelho 	size_t ie_len;
2580ed473771SSam Leffler 	u32 flags;
2581a1f1c21cSLuciano Coelho 	struct cfg80211_match_set *match_sets;
2582a1f1c21cSLuciano Coelho 	int n_match_sets;
2583ea73cbceSJohannes Berg 	s32 min_rssi_thold;
25849c748934SLuciano Coelho 	u32 delay;
25853b06d277SAvraham Stern 	struct cfg80211_sched_scan_plan *scan_plans;
25863b06d277SAvraham Stern 	int n_scan_plans;
2587807f8a8cSLuciano Coelho 
2588ad2b26abSJohannes Berg 	u8 mac_addr[ETH_ALEN] __aligned(2);
2589ad2b26abSJohannes Berg 	u8 mac_addr_mask[ETH_ALEN] __aligned(2);
2590ad2b26abSJohannes Berg 
2591bf95ecdbSvamsi krishna 	bool relative_rssi_set;
2592bf95ecdbSvamsi krishna 	s8 relative_rssi;
2593bf95ecdbSvamsi krishna 	struct cfg80211_bss_select_adjust rssi_adjust;
2594bf95ecdbSvamsi krishna 
2595807f8a8cSLuciano Coelho 	/* internal */
2596807f8a8cSLuciano Coelho 	struct wiphy *wiphy;
2597807f8a8cSLuciano Coelho 	struct net_device *dev;
259815d6030bSSam Leffler 	unsigned long scan_start;
2599b34939b9SArend Van Spriel 	bool report_results;
260031a60ed1SJukka Rissanen 	struct rcu_head rcu_head;
260193a1e86cSJukka Rissanen 	u32 owner_nlportid;
2602ca986ad9SArend Van Spriel 	bool nl_owner_dead;
2603ca986ad9SArend Van Spriel 	struct list_head list;
2604807f8a8cSLuciano Coelho 
2605807f8a8cSLuciano Coelho 	/* keep last */
2606396fba0aSGustavo A. R. Silva 	struct ieee80211_channel *channels[];
2607807f8a8cSLuciano Coelho };
2608807f8a8cSLuciano Coelho 
2609807f8a8cSLuciano Coelho /**
26102a519311SJohannes Berg  * enum cfg80211_signal_type - signal type
26112a519311SJohannes Berg  *
26122a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available
26132a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm)
26142a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100
26152a519311SJohannes Berg  */
26162a519311SJohannes Berg enum cfg80211_signal_type {
26172a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_NONE,
26182a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_MBM,
26192a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_UNSPEC,
26202a519311SJohannes Berg };
26212a519311SJohannes Berg 
26222a519311SJohannes Berg /**
26236e19bc4bSDmitry Shmidt  * struct cfg80211_inform_bss - BSS inform data
26246e19bc4bSDmitry Shmidt  * @chan: channel the frame was received on
26256e19bc4bSDmitry Shmidt  * @scan_width: scan width that was used
26266e19bc4bSDmitry Shmidt  * @signal: signal strength value, according to the wiphy's
26276e19bc4bSDmitry Shmidt  *	signal type
26286e19bc4bSDmitry Shmidt  * @boottime_ns: timestamp (CLOCK_BOOTTIME) when the information was
26296e19bc4bSDmitry Shmidt  *	received; should match the time when the frame was actually
26306e19bc4bSDmitry Shmidt  *	received by the device (not just by the host, in case it was
26316e19bc4bSDmitry Shmidt  *	buffered on the device) and be accurate to about 10ms.
26326e19bc4bSDmitry Shmidt  *	If the frame isn't buffered, just passing the return value of
26339285ec4cSJason A. Donenfeld  *	ktime_get_boottime_ns() is likely appropriate.
26341d76250bSAvraham Stern  * @parent_tsf: the time at the start of reception of the first octet of the
26351d76250bSAvraham Stern  *	timestamp field of the frame. The time is the TSF of the BSS specified
26361d76250bSAvraham Stern  *	by %parent_bssid.
26371d76250bSAvraham Stern  * @parent_bssid: the BSS according to which %parent_tsf is set. This is set to
26381d76250bSAvraham Stern  *	the BSS that requested the scan in which the beacon/probe was received.
2639983dafaaSSunil Dutt  * @chains: bitmask for filled values in @chain_signal.
2640983dafaaSSunil Dutt  * @chain_signal: per-chain signal strength of last received BSS in dBm.
26416e19bc4bSDmitry Shmidt  */
26426e19bc4bSDmitry Shmidt struct cfg80211_inform_bss {
26436e19bc4bSDmitry Shmidt 	struct ieee80211_channel *chan;
26446e19bc4bSDmitry Shmidt 	enum nl80211_bss_scan_width scan_width;
26456e19bc4bSDmitry Shmidt 	s32 signal;
26466e19bc4bSDmitry Shmidt 	u64 boottime_ns;
26471d76250bSAvraham Stern 	u64 parent_tsf;
26481d76250bSAvraham Stern 	u8 parent_bssid[ETH_ALEN] __aligned(2);
2649983dafaaSSunil Dutt 	u8 chains;
2650983dafaaSSunil Dutt 	s8 chain_signal[IEEE80211_MAX_CHAINS];
26516e19bc4bSDmitry Shmidt };
26526e19bc4bSDmitry Shmidt 
26536e19bc4bSDmitry Shmidt /**
26542aa4d456SAkira Moroo  * struct cfg80211_bss_ies - BSS entry IE data
26558cef2c9dSJohannes Berg  * @tsf: TSF contained in the frame that carried these IEs
26569caf0364SJohannes Berg  * @rcu_head: internal use, for freeing
26579caf0364SJohannes Berg  * @len: length of the IEs
26580e227084SJohannes Berg  * @from_beacon: these IEs are known to come from a beacon
26599caf0364SJohannes Berg  * @data: IE data
26609caf0364SJohannes Berg  */
26619caf0364SJohannes Berg struct cfg80211_bss_ies {
26628cef2c9dSJohannes Berg 	u64 tsf;
26639caf0364SJohannes Berg 	struct rcu_head rcu_head;
26649caf0364SJohannes Berg 	int len;
26650e227084SJohannes Berg 	bool from_beacon;
26669caf0364SJohannes Berg 	u8 data[];
26679caf0364SJohannes Berg };
26689caf0364SJohannes Berg 
26699caf0364SJohannes Berg /**
26702a519311SJohannes Berg  * struct cfg80211_bss - BSS description
26712a519311SJohannes Berg  *
26722a519311SJohannes Berg  * This structure describes a BSS (which may also be a mesh network)
26732a519311SJohannes Berg  * for use in scan results and similar.
26742a519311SJohannes Berg  *
2675abe37c4bSJohannes Berg  * @channel: channel this BSS is on
2676dcd6eac1SSimon Wunderlich  * @scan_width: width of the control channel
26772a519311SJohannes Berg  * @bssid: BSSID of the BSS
26782a519311SJohannes Berg  * @beacon_interval: the beacon interval as from the frame
26792a519311SJohannes Berg  * @capability: the capability field in host byte order
268083c7aa1aSJohannes Berg  * @ies: the information elements (Note that there is no guarantee that these
268183c7aa1aSJohannes Berg  *	are well-formed!); this is a pointer to either the beacon_ies or
268283c7aa1aSJohannes Berg  *	proberesp_ies depending on whether Probe Response frame has been
268383c7aa1aSJohannes Berg  *	received. It is always non-%NULL.
268434a6eddbSJouni Malinen  * @beacon_ies: the information elements from the last Beacon frame
2685776b3580SJohannes Berg  *	(implementation note: if @hidden_beacon_bss is set this struct doesn't
2686776b3580SJohannes Berg  *	own the beacon_ies, but they're just pointers to the ones from the
2687776b3580SJohannes Berg  *	@hidden_beacon_bss struct)
268834a6eddbSJouni Malinen  * @proberesp_ies: the information elements from the last Probe Response frame
2689776b3580SJohannes Berg  * @hidden_beacon_bss: in case this BSS struct represents a probe response from
2690776b3580SJohannes Berg  *	a BSS that hides the SSID in its beacon, this points to the BSS struct
2691776b3580SJohannes Berg  *	that holds the beacon data. @beacon_ies is still valid, of course, and
2692776b3580SJohannes Berg  *	points to the same data as hidden_beacon_bss->beacon_ies in that case.
2693851ae31dSJohannes Berg  * @transmitted_bss: pointer to the transmitted BSS, if this is a
2694851ae31dSJohannes Berg  *	non-transmitted one (multi-BSSID support)
2695851ae31dSJohannes Berg  * @nontrans_list: list of non-transmitted BSS, if this is a transmitted one
2696851ae31dSJohannes Berg  *	(multi-BSSID support)
269777965c97SJohannes Berg  * @signal: signal strength value (type depends on the wiphy's signal_type)
2698983dafaaSSunil Dutt  * @chains: bitmask for filled values in @chain_signal.
2699983dafaaSSunil Dutt  * @chain_signal: per-chain signal strength of last received BSS in dBm.
27000cd01efbSSara Sharon  * @bssid_index: index in the multiple BSS set
27010cd01efbSSara Sharon  * @max_bssid_indicator: max number of members in the BSS set
27022a519311SJohannes Berg  * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
27032a519311SJohannes Berg  */
27042a519311SJohannes Berg struct cfg80211_bss {
27052a519311SJohannes Berg 	struct ieee80211_channel *channel;
2706dcd6eac1SSimon Wunderlich 	enum nl80211_bss_scan_width scan_width;
27072a519311SJohannes Berg 
27089caf0364SJohannes Berg 	const struct cfg80211_bss_ies __rcu *ies;
27099caf0364SJohannes Berg 	const struct cfg80211_bss_ies __rcu *beacon_ies;
27109caf0364SJohannes Berg 	const struct cfg80211_bss_ies __rcu *proberesp_ies;
27119caf0364SJohannes Berg 
2712776b3580SJohannes Berg 	struct cfg80211_bss *hidden_beacon_bss;
27137011ba58SSara Sharon 	struct cfg80211_bss *transmitted_bss;
27147011ba58SSara Sharon 	struct list_head nontrans_list;
27152a519311SJohannes Berg 
27162a519311SJohannes Berg 	s32 signal;
27172a519311SJohannes Berg 
27189caf0364SJohannes Berg 	u16 beacon_interval;
27199caf0364SJohannes Berg 	u16 capability;
27209caf0364SJohannes Berg 
27219caf0364SJohannes Berg 	u8 bssid[ETH_ALEN];
2722983dafaaSSunil Dutt 	u8 chains;
2723983dafaaSSunil Dutt 	s8 chain_signal[IEEE80211_MAX_CHAINS];
27249caf0364SJohannes Berg 
27250cd01efbSSara Sharon 	u8 bssid_index;
27260cd01efbSSara Sharon 	u8 max_bssid_indicator;
27270cd01efbSSara Sharon 
2728396fba0aSGustavo A. R. Silva 	u8 priv[] __aligned(sizeof(void *));
27292a519311SJohannes Berg };
27302a519311SJohannes Berg 
27312a519311SJohannes Berg /**
273249a68e0dSJohannes Berg  * ieee80211_bss_get_elem - find element with given ID
2733517357c6SJohannes Berg  * @bss: the bss to search
273449a68e0dSJohannes Berg  * @id: the element ID
27359caf0364SJohannes Berg  *
27369caf0364SJohannes Berg  * Note that the return value is an RCU-protected pointer, so
27379caf0364SJohannes Berg  * rcu_read_lock() must be held when calling this function.
27380ae997dcSYacine Belkadi  * Return: %NULL if not found.
2739517357c6SJohannes Berg  */
274049a68e0dSJohannes Berg const struct element *ieee80211_bss_get_elem(struct cfg80211_bss *bss, u8 id);
274149a68e0dSJohannes Berg 
274249a68e0dSJohannes Berg /**
274349a68e0dSJohannes Berg  * ieee80211_bss_get_ie - find IE with given ID
274449a68e0dSJohannes Berg  * @bss: the bss to search
274549a68e0dSJohannes Berg  * @id: the element ID
274649a68e0dSJohannes Berg  *
274749a68e0dSJohannes Berg  * Note that the return value is an RCU-protected pointer, so
274849a68e0dSJohannes Berg  * rcu_read_lock() must be held when calling this function.
274949a68e0dSJohannes Berg  * Return: %NULL if not found.
275049a68e0dSJohannes Berg  */
275149a68e0dSJohannes Berg static inline const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 id)
275249a68e0dSJohannes Berg {
27537e367b06SJohannes Berg 	return (const void *)ieee80211_bss_get_elem(bss, id);
275449a68e0dSJohannes Berg }
2755517357c6SJohannes Berg 
2756517357c6SJohannes Berg 
2757517357c6SJohannes Berg /**
2758636a5d36SJouni Malinen  * struct cfg80211_auth_request - Authentication request data
2759636a5d36SJouni Malinen  *
2760636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
2761636a5d36SJouni Malinen  * authentication.
2762636a5d36SJouni Malinen  *
2763959867faSJohannes Berg  * @bss: The BSS to authenticate with, the callee must obtain a reference
2764959867faSJohannes Berg  *	to it if it needs to keep it.
2765636a5d36SJouni Malinen  * @auth_type: Authentication type (algorithm)
2766636a5d36SJouni Malinen  * @ie: Extra IEs to add to Authentication frame or %NULL
2767636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
2768fffd0934SJohannes Berg  * @key_len: length of WEP key for shared key authentication
2769fffd0934SJohannes Berg  * @key_idx: index of WEP key for shared key authentication
2770fffd0934SJohannes Berg  * @key: WEP key for shared key authentication
277111b6b5a4SJouni Malinen  * @auth_data: Fields and elements in Authentication frames. This contains
277211b6b5a4SJouni Malinen  *	the authentication frame body (non-IE and IE data), excluding the
277311b6b5a4SJouni Malinen  *	Authentication algorithm number, i.e., starting at the Authentication
277411b6b5a4SJouni Malinen  *	transaction sequence number field.
277511b6b5a4SJouni Malinen  * @auth_data_len: Length of auth_data buffer in octets
2776d648c230SJohannes Berg  * @link_id: if >= 0, indicates authentication should be done as an MLD,
2777d648c230SJohannes Berg  *	the interface address is included as the MLD address and the
2778d648c230SJohannes Berg  *	necessary link (with the given link_id) will be created (and
2779d648c230SJohannes Berg  *	given an MLD address) by the driver
2780d648c230SJohannes Berg  * @ap_mld_addr: AP MLD address in case of authentication request with
2781d648c230SJohannes Berg  *	an AP MLD, valid iff @link_id >= 0
2782636a5d36SJouni Malinen  */
2783636a5d36SJouni Malinen struct cfg80211_auth_request {
278419957bb3SJohannes Berg 	struct cfg80211_bss *bss;
2785636a5d36SJouni Malinen 	const u8 *ie;
2786636a5d36SJouni Malinen 	size_t ie_len;
278719957bb3SJohannes Berg 	enum nl80211_auth_type auth_type;
2788fffd0934SJohannes Berg 	const u8 *key;
278923cc6d8cSJohannes Berg 	u8 key_len;
279023cc6d8cSJohannes Berg 	s8 key_idx;
279111b6b5a4SJouni Malinen 	const u8 *auth_data;
279211b6b5a4SJouni Malinen 	size_t auth_data_len;
2793d648c230SJohannes Berg 	s8 link_id;
2794d648c230SJohannes Berg 	const u8 *ap_mld_addr;
2795d648c230SJohannes Berg };
2796d648c230SJohannes Berg 
2797d648c230SJohannes Berg /**
2798d648c230SJohannes Berg  * struct cfg80211_assoc_link - per-link information for MLO association
2799d648c230SJohannes Berg  * @bss: the BSS pointer, see also &struct cfg80211_assoc_request::bss;
2800d648c230SJohannes Berg  *	if this is %NULL for a link, that link is not requested
2801d648c230SJohannes Berg  * @elems: extra elements for the per-STA profile for this link
2802d648c230SJohannes Berg  * @elems_len: length of the elements
2803d648c230SJohannes Berg  */
2804d648c230SJohannes Berg struct cfg80211_assoc_link {
2805d648c230SJohannes Berg 	struct cfg80211_bss *bss;
2806d648c230SJohannes Berg 	const u8 *elems;
2807d648c230SJohannes Berg 	size_t elems_len;
2808636a5d36SJouni Malinen };
2809636a5d36SJouni Malinen 
2810636a5d36SJouni Malinen /**
28117e7c8926SBen Greear  * enum cfg80211_assoc_req_flags - Over-ride default behaviour in association.
28127e7c8926SBen Greear  *
28137e7c8926SBen Greear  * @ASSOC_REQ_DISABLE_HT:  Disable HT (802.11n)
2814ee2aca34SJohannes Berg  * @ASSOC_REQ_DISABLE_VHT:  Disable VHT
2815bab5ab7dSAssaf Krauss  * @ASSOC_REQ_USE_RRM: Declare RRM capability in this association
281640cbfa90SSrinivas Dasari  * @CONNECT_REQ_EXTERNAL_AUTH_SUPPORT: User space indicates external
281740cbfa90SSrinivas Dasari  *	authentication capability. Drivers can offload authentication to
281840cbfa90SSrinivas Dasari  *	userspace if this flag is set. Only applicable for cfg80211_connect()
281940cbfa90SSrinivas Dasari  *	request (connect callback).
2820b6db0f89SBen Greear  * @ASSOC_REQ_DISABLE_HE:  Disable HE
282136f84235SMuna Sinada  * @ASSOC_REQ_DISABLE_EHT:  Disable EHT
2822efbabc11SVeerendranath Jakkam  * @CONNECT_REQ_MLO_SUPPORT: Userspace indicates support for handling MLD links.
2823efbabc11SVeerendranath Jakkam  *	Drivers shall disable MLO features for the current association if this
2824efbabc11SVeerendranath Jakkam  *	flag is not set.
28257e7c8926SBen Greear  */
28267e7c8926SBen Greear enum cfg80211_assoc_req_flags {
28277e7c8926SBen Greear 	ASSOC_REQ_DISABLE_HT			= BIT(0),
2828ee2aca34SJohannes Berg 	ASSOC_REQ_DISABLE_VHT			= BIT(1),
2829bab5ab7dSAssaf Krauss 	ASSOC_REQ_USE_RRM			= BIT(2),
283040cbfa90SSrinivas Dasari 	CONNECT_REQ_EXTERNAL_AUTH_SUPPORT	= BIT(3),
2831b6db0f89SBen Greear 	ASSOC_REQ_DISABLE_HE			= BIT(4),
283236f84235SMuna Sinada 	ASSOC_REQ_DISABLE_EHT			= BIT(5),
2833efbabc11SVeerendranath Jakkam 	CONNECT_REQ_MLO_SUPPORT			= BIT(6),
28347e7c8926SBen Greear };
28357e7c8926SBen Greear 
28367e7c8926SBen Greear /**
2837636a5d36SJouni Malinen  * struct cfg80211_assoc_request - (Re)Association request data
2838636a5d36SJouni Malinen  *
2839636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
2840636a5d36SJouni Malinen  * (re)association.
2841959867faSJohannes Berg  * @bss: The BSS to associate with. If the call is successful the driver is
2842959867faSJohannes Berg  *	given a reference that it must give back to cfg80211_send_rx_assoc()
2843959867faSJohannes Berg  *	or to cfg80211_assoc_timeout(). To ensure proper refcounting, new
2844959867faSJohannes Berg  *	association requests while already associating must be rejected.
2845d648c230SJohannes Berg  *	This also applies to the @links.bss parameter, which is used instead
2846d648c230SJohannes Berg  *	of this one (it is %NULL) for MLO associations.
2847636a5d36SJouni Malinen  * @ie: Extra IEs to add to (Re)Association Request frame or %NULL
2848636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
2849dc6382ceSJouni Malinen  * @use_mfp: Use management frame protection (IEEE 802.11w) in this association
2850b23aa676SSamuel Ortiz  * @crypto: crypto settings
285135eb8f7bSJouni Malinen  * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used
285235eb8f7bSJouni Malinen  *	to indicate a request to reassociate within the ESS instead of a request
285335eb8f7bSJouni Malinen  *	do the initial association with the ESS. When included, this is set to
285435eb8f7bSJouni Malinen  *	the BSSID of the current association, i.e., to the value that is
285535eb8f7bSJouni Malinen  *	included in the Current AP address field of the Reassociation Request
285635eb8f7bSJouni Malinen  *	frame.
28577e7c8926SBen Greear  * @flags:  See &enum cfg80211_assoc_req_flags
28587e7c8926SBen Greear  * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask
28597e7c8926SBen Greear  *	will be used in ht_capa.  Un-supported values will be ignored.
28607e7c8926SBen Greear  * @ht_capa_mask:  The bits of ht_capa which are to be used.
2861ee2aca34SJohannes Berg  * @vht_capa: VHT capability override
2862ee2aca34SJohannes Berg  * @vht_capa_mask: VHT capability mask indicating which fields to use
2863348bd456SJouni Malinen  * @fils_kek: FILS KEK for protecting (Re)Association Request/Response frame or
2864348bd456SJouni Malinen  *	%NULL if FILS is not used.
2865348bd456SJouni Malinen  * @fils_kek_len: Length of fils_kek in octets
2866348bd456SJouni Malinen  * @fils_nonces: FILS nonces (part of AAD) for protecting (Re)Association
2867348bd456SJouni Malinen  *	Request/Response frame or %NULL if FILS is not used. This field starts
2868348bd456SJouni Malinen  *	with 16 octets of STA Nonce followed by 16 octets of AP Nonce.
2869d2b7588aSThomas Pedersen  * @s1g_capa: S1G capability override
2870d2b7588aSThomas Pedersen  * @s1g_capa_mask: S1G capability override mask
2871d648c230SJohannes Berg  * @links: per-link information for MLO connections
2872d648c230SJohannes Berg  * @link_id: >= 0 for MLO connections, where links are given, and indicates
2873d648c230SJohannes Berg  *	the link on which the association request should be sent
2874d648c230SJohannes Berg  * @ap_mld_addr: AP MLD address in case of MLO association request,
2875d648c230SJohannes Berg  *	valid iff @link_id >= 0
2876636a5d36SJouni Malinen  */
2877636a5d36SJouni Malinen struct cfg80211_assoc_request {
287819957bb3SJohannes Berg 	struct cfg80211_bss *bss;
28793e5d7649SJohannes Berg 	const u8 *ie, *prev_bssid;
2880636a5d36SJouni Malinen 	size_t ie_len;
2881b23aa676SSamuel Ortiz 	struct cfg80211_crypto_settings crypto;
288219957bb3SJohannes Berg 	bool use_mfp;
28837e7c8926SBen Greear 	u32 flags;
28847e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa;
28857e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa_mask;
2886ee2aca34SJohannes Berg 	struct ieee80211_vht_cap vht_capa, vht_capa_mask;
2887348bd456SJouni Malinen 	const u8 *fils_kek;
2888348bd456SJouni Malinen 	size_t fils_kek_len;
2889348bd456SJouni Malinen 	const u8 *fils_nonces;
2890d2b7588aSThomas Pedersen 	struct ieee80211_s1g_cap s1g_capa, s1g_capa_mask;
2891d648c230SJohannes Berg 	struct cfg80211_assoc_link links[IEEE80211_MLD_MAX_NUM_LINKS];
2892d648c230SJohannes Berg 	const u8 *ap_mld_addr;
2893d648c230SJohannes Berg 	s8 link_id;
2894636a5d36SJouni Malinen };
2895636a5d36SJouni Malinen 
2896636a5d36SJouni Malinen /**
2897636a5d36SJouni Malinen  * struct cfg80211_deauth_request - Deauthentication request data
2898636a5d36SJouni Malinen  *
2899636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
2900636a5d36SJouni Malinen  * deauthentication.
2901636a5d36SJouni Malinen  *
29028f6e0dfcSJohannes Berg  * @bssid: the BSSID or AP MLD address to deauthenticate from
2903636a5d36SJouni Malinen  * @ie: Extra IEs to add to Deauthentication frame or %NULL
2904636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
290519957bb3SJohannes Berg  * @reason_code: The reason code for the deauthentication
2906077f897aSJohannes Berg  * @local_state_change: if set, change local state only and
2907077f897aSJohannes Berg  *	do not set a deauth frame
2908636a5d36SJouni Malinen  */
2909636a5d36SJouni Malinen struct cfg80211_deauth_request {
291095de817bSJohannes Berg 	const u8 *bssid;
2911636a5d36SJouni Malinen 	const u8 *ie;
2912636a5d36SJouni Malinen 	size_t ie_len;
291319957bb3SJohannes Berg 	u16 reason_code;
29146863255bSStanislaw Gruszka 	bool local_state_change;
2915636a5d36SJouni Malinen };
2916636a5d36SJouni Malinen 
2917636a5d36SJouni Malinen /**
2918636a5d36SJouni Malinen  * struct cfg80211_disassoc_request - Disassociation request data
2919636a5d36SJouni Malinen  *
2920636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
292166f00449SMasahiro Yamada  * disassociation.
2922636a5d36SJouni Malinen  *
29238f6e0dfcSJohannes Berg  * @ap_addr: the BSSID or AP MLD address to disassociate from
2924636a5d36SJouni Malinen  * @ie: Extra IEs to add to Disassociation frame or %NULL
2925636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
292619957bb3SJohannes Berg  * @reason_code: The reason code for the disassociation
2927d5cdfacbSJouni Malinen  * @local_state_change: This is a request for a local state only, i.e., no
2928d5cdfacbSJouni Malinen  *	Disassociation frame is to be transmitted.
2929636a5d36SJouni Malinen  */
2930636a5d36SJouni Malinen struct cfg80211_disassoc_request {
29318f6e0dfcSJohannes Berg 	const u8 *ap_addr;
2932636a5d36SJouni Malinen 	const u8 *ie;
2933636a5d36SJouni Malinen 	size_t ie_len;
293419957bb3SJohannes Berg 	u16 reason_code;
2935d5cdfacbSJouni Malinen 	bool local_state_change;
2936636a5d36SJouni Malinen };
2937636a5d36SJouni Malinen 
2938636a5d36SJouni Malinen /**
293904a773adSJohannes Berg  * struct cfg80211_ibss_params - IBSS parameters
294004a773adSJohannes Berg  *
294104a773adSJohannes Berg  * This structure defines the IBSS parameters for the join_ibss()
294204a773adSJohannes Berg  * method.
294304a773adSJohannes Berg  *
294404a773adSJohannes Berg  * @ssid: The SSID, will always be non-null.
294504a773adSJohannes Berg  * @ssid_len: The length of the SSID, will always be non-zero.
294604a773adSJohannes Berg  * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not
294704a773adSJohannes Berg  *	search for IBSSs with a different BSSID.
2948683b6d3bSJohannes Berg  * @chandef: defines the channel to use if no other IBSS to join can be found
294904a773adSJohannes Berg  * @channel_fixed: The channel should be fixed -- do not search for
295004a773adSJohannes Berg  *	IBSSs to join on other channels.
295104a773adSJohannes Berg  * @ie: information element(s) to include in the beacon
295204a773adSJohannes Berg  * @ie_len: length of that
29538e30bc55SJohannes Berg  * @beacon_interval: beacon interval to use
2954fffd0934SJohannes Berg  * @privacy: this is a protected network, keys will be configured
2955fffd0934SJohannes Berg  *	after joining
2956267335d6SAntonio Quartulli  * @control_port: whether user space controls IEEE 802.1X port, i.e.,
2957267335d6SAntonio Quartulli  *	sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
2958267335d6SAntonio Quartulli  *	required to assume that the port is unauthorized until authorized by
2959267335d6SAntonio Quartulli  *	user space. Otherwise, port is marked authorized by default.
2960c3bfe1f6SDenis Kenzior  * @control_port_over_nl80211: TRUE if userspace expects to exchange control
2961c3bfe1f6SDenis Kenzior  *	port frames over NL80211 instead of the network interface.
29625336fa88SSimon Wunderlich  * @userspace_handles_dfs: whether user space controls DFS operation, i.e.
29635336fa88SSimon Wunderlich  *	changes the channel when a radar is detected. This is required
29645336fa88SSimon Wunderlich  *	to operate on DFS channels.
2965fbd2c8dcSTeemu Paasikivi  * @basic_rates: bitmap of basic rates to use when creating the IBSS
2966dd5b4cc7SFelix Fietkau  * @mcast_rate: per-band multicast rate index + 1 (0: disabled)
2967803768f5SSimon Wunderlich  * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask
2968803768f5SSimon Wunderlich  *	will be used in ht_capa.  Un-supported values will be ignored.
2969803768f5SSimon Wunderlich  * @ht_capa_mask:  The bits of ht_capa which are to be used.
29709ae3b172STova Mussai  * @wep_keys: static WEP keys, if not NULL points to an array of
29719ae3b172STova Mussai  *	CFG80211_MAX_WEP_KEYS WEP keys
29729ae3b172STova Mussai  * @wep_tx_key: key index (0..3) of the default TX static WEP key
297304a773adSJohannes Berg  */
297404a773adSJohannes Berg struct cfg80211_ibss_params {
2975c1e5f471SJohannes Berg 	const u8 *ssid;
2976c1e5f471SJohannes Berg 	const u8 *bssid;
2977683b6d3bSJohannes Berg 	struct cfg80211_chan_def chandef;
2978c1e5f471SJohannes Berg 	const u8 *ie;
297904a773adSJohannes Berg 	u8 ssid_len, ie_len;
29808e30bc55SJohannes Berg 	u16 beacon_interval;
2981fbd2c8dcSTeemu Paasikivi 	u32 basic_rates;
298204a773adSJohannes Berg 	bool channel_fixed;
2983fffd0934SJohannes Berg 	bool privacy;
2984267335d6SAntonio Quartulli 	bool control_port;
2985c3bfe1f6SDenis Kenzior 	bool control_port_over_nl80211;
29865336fa88SSimon Wunderlich 	bool userspace_handles_dfs;
298757fbcce3SJohannes Berg 	int mcast_rate[NUM_NL80211_BANDS];
2988803768f5SSimon Wunderlich 	struct ieee80211_ht_cap ht_capa;
2989803768f5SSimon Wunderlich 	struct ieee80211_ht_cap ht_capa_mask;
29909ae3b172STova Mussai 	struct key_params *wep_keys;
29919ae3b172STova Mussai 	int wep_tx_key;
299204a773adSJohannes Berg };
299304a773adSJohannes Berg 
299404a773adSJohannes Berg /**
299538de03d2SArend van Spriel  * struct cfg80211_bss_selection - connection parameters for BSS selection.
299638de03d2SArend van Spriel  *
299738de03d2SArend van Spriel  * @behaviour: requested BSS selection behaviour.
299838de03d2SArend van Spriel  * @param: parameters for requestion behaviour.
299938de03d2SArend van Spriel  * @band_pref: preferred band for %NL80211_BSS_SELECT_ATTR_BAND_PREF.
300038de03d2SArend van Spriel  * @adjust: parameters for %NL80211_BSS_SELECT_ATTR_RSSI_ADJUST.
300138de03d2SArend van Spriel  */
300238de03d2SArend van Spriel struct cfg80211_bss_selection {
300338de03d2SArend van Spriel 	enum nl80211_bss_select_attr behaviour;
300438de03d2SArend van Spriel 	union {
300557fbcce3SJohannes Berg 		enum nl80211_band band_pref;
300638de03d2SArend van Spriel 		struct cfg80211_bss_select_adjust adjust;
300738de03d2SArend van Spriel 	} param;
300838de03d2SArend van Spriel };
300938de03d2SArend van Spriel 
301038de03d2SArend van Spriel /**
3011b23aa676SSamuel Ortiz  * struct cfg80211_connect_params - Connection parameters
3012b23aa676SSamuel Ortiz  *
3013b23aa676SSamuel Ortiz  * This structure provides information needed to complete IEEE 802.11
3014b23aa676SSamuel Ortiz  * authentication and association.
3015b23aa676SSamuel Ortiz  *
3016b23aa676SSamuel Ortiz  * @channel: The channel to use or %NULL if not specified (auto-select based
3017b23aa676SSamuel Ortiz  *	on scan results)
30181df4a510SJouni Malinen  * @channel_hint: The channel of the recommended BSS for initial connection or
30191df4a510SJouni Malinen  *	%NULL if not specified
3020b23aa676SSamuel Ortiz  * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan
3021b23aa676SSamuel Ortiz  *	results)
30221df4a510SJouni Malinen  * @bssid_hint: The recommended AP BSSID for initial connection to the BSS or
30231df4a510SJouni Malinen  *	%NULL if not specified. Unlike the @bssid parameter, the driver is
30241df4a510SJouni Malinen  *	allowed to ignore this @bssid_hint if it has knowledge of a better BSS
30251df4a510SJouni Malinen  *	to use.
3026b23aa676SSamuel Ortiz  * @ssid: SSID
3027b23aa676SSamuel Ortiz  * @ssid_len: Length of ssid in octets
3028b23aa676SSamuel Ortiz  * @auth_type: Authentication type (algorithm)
3029abe37c4bSJohannes Berg  * @ie: IEs for association request
3030abe37c4bSJohannes Berg  * @ie_len: Length of assoc_ie in octets
3031b23aa676SSamuel Ortiz  * @privacy: indicates whether privacy-enabled APs should be used
3032cee00a95SJouni Malinen  * @mfp: indicate whether management frame protection is used
3033b23aa676SSamuel Ortiz  * @crypto: crypto settings
3034fffd0934SJohannes Berg  * @key_len: length of WEP key for shared key authentication
3035fffd0934SJohannes Berg  * @key_idx: index of WEP key for shared key authentication
3036fffd0934SJohannes Berg  * @key: WEP key for shared key authentication
30377e7c8926SBen Greear  * @flags:  See &enum cfg80211_assoc_req_flags
30384486ea98SBala Shanmugam  * @bg_scan_period:  Background scan period in seconds
30394486ea98SBala Shanmugam  *	or -1 to indicate that default value is to be used.
30407e7c8926SBen Greear  * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask
30417e7c8926SBen Greear  *	will be used in ht_capa.  Un-supported values will be ignored.
30427e7c8926SBen Greear  * @ht_capa_mask:  The bits of ht_capa which are to be used.
3043ee2aca34SJohannes Berg  * @vht_capa:  VHT Capability overrides
3044ee2aca34SJohannes Berg  * @vht_capa_mask: The bits of vht_capa which are to be used.
304534d50519SLior David  * @pbss: if set, connect to a PCP instead of AP. Valid for DMG
304634d50519SLior David  *	networks.
304738de03d2SArend van Spriel  * @bss_select: criteria to be used for BSS selection.
304835eb8f7bSJouni Malinen  * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used
304935eb8f7bSJouni Malinen  *	to indicate a request to reassociate within the ESS instead of a request
305035eb8f7bSJouni Malinen  *	do the initial association with the ESS. When included, this is set to
305135eb8f7bSJouni Malinen  *	the BSSID of the current association, i.e., to the value that is
305235eb8f7bSJouni Malinen  *	included in the Current AP address field of the Reassociation Request
305335eb8f7bSJouni Malinen  *	frame.
3054a3caf744SVidyullatha Kanchanapally  * @fils_erp_username: EAP re-authentication protocol (ERP) username part of the
3055a3caf744SVidyullatha Kanchanapally  *	NAI or %NULL if not specified. This is used to construct FILS wrapped
3056a3caf744SVidyullatha Kanchanapally  *	data IE.
3057a3caf744SVidyullatha Kanchanapally  * @fils_erp_username_len: Length of @fils_erp_username in octets.
3058a3caf744SVidyullatha Kanchanapally  * @fils_erp_realm: EAP re-authentication protocol (ERP) realm part of NAI or
3059a3caf744SVidyullatha Kanchanapally  *	%NULL if not specified. This specifies the domain name of ER server and
3060a3caf744SVidyullatha Kanchanapally  *	is used to construct FILS wrapped data IE.
3061a3caf744SVidyullatha Kanchanapally  * @fils_erp_realm_len: Length of @fils_erp_realm in octets.
3062a3caf744SVidyullatha Kanchanapally  * @fils_erp_next_seq_num: The next sequence number to use in the FILS ERP
3063a3caf744SVidyullatha Kanchanapally  *	messages. This is also used to construct FILS wrapped data IE.
3064a3caf744SVidyullatha Kanchanapally  * @fils_erp_rrk: ERP re-authentication Root Key (rRK) used to derive additional
3065a3caf744SVidyullatha Kanchanapally  *	keys in FILS or %NULL if not specified.
3066a3caf744SVidyullatha Kanchanapally  * @fils_erp_rrk_len: Length of @fils_erp_rrk in octets.
30673a00df57SAvraham Stern  * @want_1x: indicates user-space supports and wants to use 802.1X driver
30683a00df57SAvraham Stern  *	offload of 4-way handshake.
30692a38075cSAlexei Avshalom Lazar  * @edmg: define the EDMG channels.
30702a38075cSAlexei Avshalom Lazar  *	This may specify multiple channels and bonding options for the driver
30712a38075cSAlexei Avshalom Lazar  *	to choose from, based on BSS configuration.
3072b23aa676SSamuel Ortiz  */
3073b23aa676SSamuel Ortiz struct cfg80211_connect_params {
3074b23aa676SSamuel Ortiz 	struct ieee80211_channel *channel;
30751df4a510SJouni Malinen 	struct ieee80211_channel *channel_hint;
3076664834deSJouni Malinen 	const u8 *bssid;
30771df4a510SJouni Malinen 	const u8 *bssid_hint;
3078664834deSJouni Malinen 	const u8 *ssid;
3079b23aa676SSamuel Ortiz 	size_t ssid_len;
3080b23aa676SSamuel Ortiz 	enum nl80211_auth_type auth_type;
30814b5800feSJohannes Berg 	const u8 *ie;
3082b23aa676SSamuel Ortiz 	size_t ie_len;
3083b23aa676SSamuel Ortiz 	bool privacy;
3084cee00a95SJouni Malinen 	enum nl80211_mfp mfp;
3085b23aa676SSamuel Ortiz 	struct cfg80211_crypto_settings crypto;
3086fffd0934SJohannes Berg 	const u8 *key;
3087fffd0934SJohannes Berg 	u8 key_len, key_idx;
30887e7c8926SBen Greear 	u32 flags;
30894486ea98SBala Shanmugam 	int bg_scan_period;
30907e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa;
30917e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa_mask;
3092ee2aca34SJohannes Berg 	struct ieee80211_vht_cap vht_capa;
3093ee2aca34SJohannes Berg 	struct ieee80211_vht_cap vht_capa_mask;
309434d50519SLior David 	bool pbss;
309538de03d2SArend van Spriel 	struct cfg80211_bss_selection bss_select;
3096ba6fbacfSJouni Malinen 	const u8 *prev_bssid;
3097a3caf744SVidyullatha Kanchanapally 	const u8 *fils_erp_username;
3098a3caf744SVidyullatha Kanchanapally 	size_t fils_erp_username_len;
3099a3caf744SVidyullatha Kanchanapally 	const u8 *fils_erp_realm;
3100a3caf744SVidyullatha Kanchanapally 	size_t fils_erp_realm_len;
3101a3caf744SVidyullatha Kanchanapally 	u16 fils_erp_next_seq_num;
3102a3caf744SVidyullatha Kanchanapally 	const u8 *fils_erp_rrk;
3103a3caf744SVidyullatha Kanchanapally 	size_t fils_erp_rrk_len;
31043a00df57SAvraham Stern 	bool want_1x;
31052a38075cSAlexei Avshalom Lazar 	struct ieee80211_edmg edmg;
3106b23aa676SSamuel Ortiz };
3107b23aa676SSamuel Ortiz 
3108b23aa676SSamuel Ortiz /**
3109088e8df8Svamsi krishna  * enum cfg80211_connect_params_changed - Connection parameters being updated
3110088e8df8Svamsi krishna  *
3111088e8df8Svamsi krishna  * This enum provides information of all connect parameters that
3112088e8df8Svamsi krishna  * have to be updated as part of update_connect_params() call.
3113088e8df8Svamsi krishna  *
3114088e8df8Svamsi krishna  * @UPDATE_ASSOC_IES: Indicates whether association request IEs are updated
31157f9a3e15SVidyullatha Kanchanapally  * @UPDATE_FILS_ERP_INFO: Indicates that FILS connection parameters (realm,
31167f9a3e15SVidyullatha Kanchanapally  *	username, erp sequence number and rrk) are updated
31177f9a3e15SVidyullatha Kanchanapally  * @UPDATE_AUTH_TYPE: Indicates that authentication type is updated
3118088e8df8Svamsi krishna  */
3119088e8df8Svamsi krishna enum cfg80211_connect_params_changed {
3120088e8df8Svamsi krishna 	UPDATE_ASSOC_IES		= BIT(0),
31217f9a3e15SVidyullatha Kanchanapally 	UPDATE_FILS_ERP_INFO		= BIT(1),
31227f9a3e15SVidyullatha Kanchanapally 	UPDATE_AUTH_TYPE		= BIT(2),
3123088e8df8Svamsi krishna };
3124088e8df8Svamsi krishna 
3125088e8df8Svamsi krishna /**
3126b9a5f8caSJouni Malinen  * enum wiphy_params_flags - set_wiphy_params bitfield values
3127abe37c4bSJohannes Berg  * @WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed
3128abe37c4bSJohannes Berg  * @WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed
3129abe37c4bSJohannes Berg  * @WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed
3130abe37c4bSJohannes Berg  * @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed
3131abe37c4bSJohannes Berg  * @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed
31323057dbfdSLorenzo Bianconi  * @WIPHY_PARAM_DYN_ACK: dynack has been enabled
313352539ca8SToke Høiland-Jørgensen  * @WIPHY_PARAM_TXQ_LIMIT: TXQ packet limit has been changed
313452539ca8SToke Høiland-Jørgensen  * @WIPHY_PARAM_TXQ_MEMORY_LIMIT: TXQ memory limit has been changed
313552539ca8SToke Høiland-Jørgensen  * @WIPHY_PARAM_TXQ_QUANTUM: TXQ scheduler quantum
3136b9a5f8caSJouni Malinen  */
3137b9a5f8caSJouni Malinen enum wiphy_params_flags {
3138b9a5f8caSJouni Malinen 	WIPHY_PARAM_RETRY_SHORT		= 1 << 0,
3139b9a5f8caSJouni Malinen 	WIPHY_PARAM_RETRY_LONG		= 1 << 1,
3140b9a5f8caSJouni Malinen 	WIPHY_PARAM_FRAG_THRESHOLD	= 1 << 2,
3141b9a5f8caSJouni Malinen 	WIPHY_PARAM_RTS_THRESHOLD	= 1 << 3,
314281077e82SLukáš Turek 	WIPHY_PARAM_COVERAGE_CLASS	= 1 << 4,
31433057dbfdSLorenzo Bianconi 	WIPHY_PARAM_DYN_ACK		= 1 << 5,
314452539ca8SToke Høiland-Jørgensen 	WIPHY_PARAM_TXQ_LIMIT		= 1 << 6,
314552539ca8SToke Høiland-Jørgensen 	WIPHY_PARAM_TXQ_MEMORY_LIMIT	= 1 << 7,
314652539ca8SToke Høiland-Jørgensen 	WIPHY_PARAM_TXQ_QUANTUM		= 1 << 8,
3147b9a5f8caSJouni Malinen };
3148b9a5f8caSJouni Malinen 
314936647055SToke Høiland-Jørgensen #define IEEE80211_DEFAULT_AIRTIME_WEIGHT	256
315036647055SToke Høiland-Jørgensen 
31513ace10f5SKan Yan /* The per TXQ device queue limit in airtime */
31523ace10f5SKan Yan #define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_L	5000
31533ace10f5SKan Yan #define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_H	12000
31543ace10f5SKan Yan 
31553ace10f5SKan Yan /* The per interface airtime threshold to switch to lower queue limit */
31563ace10f5SKan Yan #define IEEE80211_AQL_THRESHOLD			24000
31573ace10f5SKan Yan 
315867fbb16bSSamuel Ortiz /**
315967fbb16bSSamuel Ortiz  * struct cfg80211_pmksa - PMK Security Association
316067fbb16bSSamuel Ortiz  *
316167fbb16bSSamuel Ortiz  * This structure is passed to the set/del_pmksa() method for PMKSA
316267fbb16bSSamuel Ortiz  * caching.
316367fbb16bSSamuel Ortiz  *
3164a3caf744SVidyullatha Kanchanapally  * @bssid: The AP's BSSID (may be %NULL).
3165a3caf744SVidyullatha Kanchanapally  * @pmkid: The identifier to refer a PMKSA.
3166a3caf744SVidyullatha Kanchanapally  * @pmk: The PMK for the PMKSA identified by @pmkid. This is used for key
3167a3caf744SVidyullatha Kanchanapally  *	derivation by a FILS STA. Otherwise, %NULL.
3168a3caf744SVidyullatha Kanchanapally  * @pmk_len: Length of the @pmk. The length of @pmk can differ depending on
3169a3caf744SVidyullatha Kanchanapally  *	the hash algorithm used to generate this.
3170a3caf744SVidyullatha Kanchanapally  * @ssid: SSID to specify the ESS within which a PMKSA is valid when using FILS
3171a3caf744SVidyullatha Kanchanapally  *	cache identifier (may be %NULL).
3172a3caf744SVidyullatha Kanchanapally  * @ssid_len: Length of the @ssid in octets.
3173a3caf744SVidyullatha Kanchanapally  * @cache_id: 2-octet cache identifier advertized by a FILS AP identifying the
3174a3caf744SVidyullatha Kanchanapally  *	scope of PMKSA. This is valid only if @ssid_len is non-zero (may be
3175a3caf744SVidyullatha Kanchanapally  *	%NULL).
31767fc82af8SVeerendranath Jakkam  * @pmk_lifetime: Maximum lifetime for PMKSA in seconds
31777fc82af8SVeerendranath Jakkam  *	(dot11RSNAConfigPMKLifetime) or 0 if not specified.
31787fc82af8SVeerendranath Jakkam  *	The configured PMKSA must not be used for PMKSA caching after
31797fc82af8SVeerendranath Jakkam  *	expiration and any keys derived from this PMK become invalid on
31807fc82af8SVeerendranath Jakkam  *	expiration, i.e., the current association must be dropped if the PMK
31817fc82af8SVeerendranath Jakkam  *	used for it expires.
31827fc82af8SVeerendranath Jakkam  * @pmk_reauth_threshold: Threshold time for reauthentication (percentage of
31837fc82af8SVeerendranath Jakkam  *	PMK lifetime, dot11RSNAConfigPMKReauthThreshold) or 0 if not specified.
31847fc82af8SVeerendranath Jakkam  *	Drivers are expected to trigger a full authentication instead of using
31857fc82af8SVeerendranath Jakkam  *	this PMKSA for caching when reassociating to a new BSS after this
31867fc82af8SVeerendranath Jakkam  *	threshold to generate a new PMK before the current one expires.
318767fbb16bSSamuel Ortiz  */
318867fbb16bSSamuel Ortiz struct cfg80211_pmksa {
3189c1e5f471SJohannes Berg 	const u8 *bssid;
3190c1e5f471SJohannes Berg 	const u8 *pmkid;
3191a3caf744SVidyullatha Kanchanapally 	const u8 *pmk;
3192a3caf744SVidyullatha Kanchanapally 	size_t pmk_len;
3193a3caf744SVidyullatha Kanchanapally 	const u8 *ssid;
3194a3caf744SVidyullatha Kanchanapally 	size_t ssid_len;
3195a3caf744SVidyullatha Kanchanapally 	const u8 *cache_id;
31967fc82af8SVeerendranath Jakkam 	u32 pmk_lifetime;
31977fc82af8SVeerendranath Jakkam 	u8 pmk_reauth_threshold;
319867fbb16bSSamuel Ortiz };
31999930380fSJohannes Berg 
32007643a2c3SJohannes Berg /**
320150ac6607SAmitkumar Karwar  * struct cfg80211_pkt_pattern - packet pattern
3202ff1b6e69SJohannes Berg  * @mask: bitmask where to match pattern and where to ignore bytes,
3203ff1b6e69SJohannes Berg  *	one bit per byte, in same format as nl80211
3204ff1b6e69SJohannes Berg  * @pattern: bytes to match where bitmask is 1
3205ff1b6e69SJohannes Berg  * @pattern_len: length of pattern (in bytes)
3206bb92d199SAmitkumar Karwar  * @pkt_offset: packet offset (in bytes)
3207ff1b6e69SJohannes Berg  *
3208ff1b6e69SJohannes Berg  * Internal note: @mask and @pattern are allocated in one chunk of
3209ff1b6e69SJohannes Berg  * memory, free @mask only!
3210ff1b6e69SJohannes Berg  */
321150ac6607SAmitkumar Karwar struct cfg80211_pkt_pattern {
3212922bd80fSJohannes Berg 	const u8 *mask, *pattern;
3213ff1b6e69SJohannes Berg 	int pattern_len;
3214bb92d199SAmitkumar Karwar 	int pkt_offset;
3215ff1b6e69SJohannes Berg };
3216ff1b6e69SJohannes Berg 
3217ff1b6e69SJohannes Berg /**
32182a0e047eSJohannes Berg  * struct cfg80211_wowlan_tcp - TCP connection parameters
32192a0e047eSJohannes Berg  *
32202a0e047eSJohannes Berg  * @sock: (internal) socket for source port allocation
32212a0e047eSJohannes Berg  * @src: source IP address
32222a0e047eSJohannes Berg  * @dst: destination IP address
32232a0e047eSJohannes Berg  * @dst_mac: destination MAC address
32242a0e047eSJohannes Berg  * @src_port: source port
32252a0e047eSJohannes Berg  * @dst_port: destination port
32262a0e047eSJohannes Berg  * @payload_len: data payload length
32272a0e047eSJohannes Berg  * @payload: data payload buffer
32282a0e047eSJohannes Berg  * @payload_seq: payload sequence stamping configuration
32292a0e047eSJohannes Berg  * @data_interval: interval at which to send data packets
32302a0e047eSJohannes Berg  * @wake_len: wakeup payload match length
32312a0e047eSJohannes Berg  * @wake_data: wakeup payload match data
32322a0e047eSJohannes Berg  * @wake_mask: wakeup payload match mask
32332a0e047eSJohannes Berg  * @tokens_size: length of the tokens buffer
32342a0e047eSJohannes Berg  * @payload_tok: payload token usage configuration
32352a0e047eSJohannes Berg  */
32362a0e047eSJohannes Berg struct cfg80211_wowlan_tcp {
32372a0e047eSJohannes Berg 	struct socket *sock;
32382a0e047eSJohannes Berg 	__be32 src, dst;
32392a0e047eSJohannes Berg 	u16 src_port, dst_port;
32402a0e047eSJohannes Berg 	u8 dst_mac[ETH_ALEN];
32412a0e047eSJohannes Berg 	int payload_len;
32422a0e047eSJohannes Berg 	const u8 *payload;
32432a0e047eSJohannes Berg 	struct nl80211_wowlan_tcp_data_seq payload_seq;
32442a0e047eSJohannes Berg 	u32 data_interval;
32452a0e047eSJohannes Berg 	u32 wake_len;
32462a0e047eSJohannes Berg 	const u8 *wake_data, *wake_mask;
32472a0e047eSJohannes Berg 	u32 tokens_size;
32482a0e047eSJohannes Berg 	/* must be last, variable member */
32492a0e047eSJohannes Berg 	struct nl80211_wowlan_tcp_data_token payload_tok;
3250ff1b6e69SJohannes Berg };
3251ff1b6e69SJohannes Berg 
3252ff1b6e69SJohannes Berg /**
3253ff1b6e69SJohannes Berg  * struct cfg80211_wowlan - Wake on Wireless-LAN support info
3254ff1b6e69SJohannes Berg  *
3255ff1b6e69SJohannes Berg  * This structure defines the enabled WoWLAN triggers for the device.
3256ff1b6e69SJohannes Berg  * @any: wake up on any activity -- special trigger if device continues
3257ff1b6e69SJohannes Berg  *	operating as normal during suspend
3258ff1b6e69SJohannes Berg  * @disconnect: wake up if getting disconnected
3259ff1b6e69SJohannes Berg  * @magic_pkt: wake up on receiving magic packet
3260ff1b6e69SJohannes Berg  * @patterns: wake up on receiving packet matching a pattern
3261ff1b6e69SJohannes Berg  * @n_patterns: number of patterns
326277dbbb13SJohannes Berg  * @gtk_rekey_failure: wake up on GTK rekey failure
326377dbbb13SJohannes Berg  * @eap_identity_req: wake up on EAP identity request packet
326477dbbb13SJohannes Berg  * @four_way_handshake: wake up on 4-way handshake
326577dbbb13SJohannes Berg  * @rfkill_release: wake up when rfkill is released
32662a0e047eSJohannes Berg  * @tcp: TCP connection establishment/wakeup parameters, see nl80211.h.
32672a0e047eSJohannes Berg  *	NULL if not configured.
32688cd4d456SLuciano Coelho  * @nd_config: configuration for the scan to be used for net detect wake.
3269ff1b6e69SJohannes Berg  */
3270ff1b6e69SJohannes Berg struct cfg80211_wowlan {
327177dbbb13SJohannes Berg 	bool any, disconnect, magic_pkt, gtk_rekey_failure,
327277dbbb13SJohannes Berg 	     eap_identity_req, four_way_handshake,
327377dbbb13SJohannes Berg 	     rfkill_release;
327450ac6607SAmitkumar Karwar 	struct cfg80211_pkt_pattern *patterns;
32752a0e047eSJohannes Berg 	struct cfg80211_wowlan_tcp *tcp;
3276ff1b6e69SJohannes Berg 	int n_patterns;
32778cd4d456SLuciano Coelho 	struct cfg80211_sched_scan_request *nd_config;
3278ff1b6e69SJohannes Berg };
3279ff1b6e69SJohannes Berg 
3280ff1b6e69SJohannes Berg /**
3281be29b99aSAmitkumar Karwar  * struct cfg80211_coalesce_rules - Coalesce rule parameters
3282be29b99aSAmitkumar Karwar  *
3283be29b99aSAmitkumar Karwar  * This structure defines coalesce rule for the device.
3284be29b99aSAmitkumar Karwar  * @delay: maximum coalescing delay in msecs.
3285be29b99aSAmitkumar Karwar  * @condition: condition for packet coalescence.
3286be29b99aSAmitkumar Karwar  *	see &enum nl80211_coalesce_condition.
3287be29b99aSAmitkumar Karwar  * @patterns: array of packet patterns
3288be29b99aSAmitkumar Karwar  * @n_patterns: number of patterns
3289be29b99aSAmitkumar Karwar  */
3290be29b99aSAmitkumar Karwar struct cfg80211_coalesce_rules {
3291be29b99aSAmitkumar Karwar 	int delay;
3292be29b99aSAmitkumar Karwar 	enum nl80211_coalesce_condition condition;
3293be29b99aSAmitkumar Karwar 	struct cfg80211_pkt_pattern *patterns;
3294be29b99aSAmitkumar Karwar 	int n_patterns;
3295be29b99aSAmitkumar Karwar };
3296be29b99aSAmitkumar Karwar 
3297be29b99aSAmitkumar Karwar /**
3298be29b99aSAmitkumar Karwar  * struct cfg80211_coalesce - Packet coalescing settings
3299be29b99aSAmitkumar Karwar  *
3300be29b99aSAmitkumar Karwar  * This structure defines coalescing settings.
3301be29b99aSAmitkumar Karwar  * @rules: array of coalesce rules
3302be29b99aSAmitkumar Karwar  * @n_rules: number of rules
3303be29b99aSAmitkumar Karwar  */
3304be29b99aSAmitkumar Karwar struct cfg80211_coalesce {
3305be29b99aSAmitkumar Karwar 	struct cfg80211_coalesce_rules *rules;
3306be29b99aSAmitkumar Karwar 	int n_rules;
3307be29b99aSAmitkumar Karwar };
3308be29b99aSAmitkumar Karwar 
3309be29b99aSAmitkumar Karwar /**
33108cd4d456SLuciano Coelho  * struct cfg80211_wowlan_nd_match - information about the match
33118cd4d456SLuciano Coelho  *
33128cd4d456SLuciano Coelho  * @ssid: SSID of the match that triggered the wake up
33138cd4d456SLuciano Coelho  * @n_channels: Number of channels where the match occurred.  This
33148cd4d456SLuciano Coelho  *	value may be zero if the driver can't report the channels.
33158cd4d456SLuciano Coelho  * @channels: center frequencies of the channels where a match
33168cd4d456SLuciano Coelho  *	occurred (in MHz)
33178cd4d456SLuciano Coelho  */
33188cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_match {
33198cd4d456SLuciano Coelho 	struct cfg80211_ssid ssid;
33208cd4d456SLuciano Coelho 	int n_channels;
33218cd4d456SLuciano Coelho 	u32 channels[];
33228cd4d456SLuciano Coelho };
33238cd4d456SLuciano Coelho 
33248cd4d456SLuciano Coelho /**
33258cd4d456SLuciano Coelho  * struct cfg80211_wowlan_nd_info - net detect wake up information
33268cd4d456SLuciano Coelho  *
33278cd4d456SLuciano Coelho  * @n_matches: Number of match information instances provided in
33288cd4d456SLuciano Coelho  *	@matches.  This value may be zero if the driver can't provide
33298cd4d456SLuciano Coelho  *	match information.
33308cd4d456SLuciano Coelho  * @matches: Array of pointers to matches containing information about
33318cd4d456SLuciano Coelho  *	the matches that triggered the wake up.
33328cd4d456SLuciano Coelho  */
33338cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_info {
33348cd4d456SLuciano Coelho 	int n_matches;
33358cd4d456SLuciano Coelho 	struct cfg80211_wowlan_nd_match *matches[];
33368cd4d456SLuciano Coelho };
33378cd4d456SLuciano Coelho 
33388cd4d456SLuciano Coelho /**
3339cd8f7cb4SJohannes Berg  * struct cfg80211_wowlan_wakeup - wakeup report
3340cd8f7cb4SJohannes Berg  * @disconnect: woke up by getting disconnected
3341cd8f7cb4SJohannes Berg  * @magic_pkt: woke up by receiving magic packet
3342cd8f7cb4SJohannes Berg  * @gtk_rekey_failure: woke up by GTK rekey failure
3343cd8f7cb4SJohannes Berg  * @eap_identity_req: woke up by EAP identity request packet
3344cd8f7cb4SJohannes Berg  * @four_way_handshake: woke up by 4-way handshake
3345cd8f7cb4SJohannes Berg  * @rfkill_release: woke up by rfkill being released
3346cd8f7cb4SJohannes Berg  * @pattern_idx: pattern that caused wakeup, -1 if not due to pattern
3347cd8f7cb4SJohannes Berg  * @packet_present_len: copied wakeup packet data
3348cd8f7cb4SJohannes Berg  * @packet_len: original wakeup packet length
3349cd8f7cb4SJohannes Berg  * @packet: The packet causing the wakeup, if any.
3350cd8f7cb4SJohannes Berg  * @packet_80211:  For pattern match, magic packet and other data
3351cd8f7cb4SJohannes Berg  *	frame triggers an 802.3 frame should be reported, for
3352cd8f7cb4SJohannes Berg  *	disconnect due to deauth 802.11 frame. This indicates which
3353cd8f7cb4SJohannes Berg  *	it is.
33542a0e047eSJohannes Berg  * @tcp_match: TCP wakeup packet received
33552a0e047eSJohannes Berg  * @tcp_connlost: TCP connection lost or failed to establish
33562a0e047eSJohannes Berg  * @tcp_nomoretokens: TCP data ran out of tokens
33578cd4d456SLuciano Coelho  * @net_detect: if not %NULL, woke up because of net detect
3358cd8f7cb4SJohannes Berg  */
3359cd8f7cb4SJohannes Berg struct cfg80211_wowlan_wakeup {
3360cd8f7cb4SJohannes Berg 	bool disconnect, magic_pkt, gtk_rekey_failure,
3361cd8f7cb4SJohannes Berg 	     eap_identity_req, four_way_handshake,
33622a0e047eSJohannes Berg 	     rfkill_release, packet_80211,
33632a0e047eSJohannes Berg 	     tcp_match, tcp_connlost, tcp_nomoretokens;
3364cd8f7cb4SJohannes Berg 	s32 pattern_idx;
3365cd8f7cb4SJohannes Berg 	u32 packet_present_len, packet_len;
3366cd8f7cb4SJohannes Berg 	const void *packet;
33678cd4d456SLuciano Coelho 	struct cfg80211_wowlan_nd_info *net_detect;
3368cd8f7cb4SJohannes Berg };
3369cd8f7cb4SJohannes Berg 
3370cd8f7cb4SJohannes Berg /**
3371e5497d76SJohannes Berg  * struct cfg80211_gtk_rekey_data - rekey data
3372093a48d2SNathan Errera  * @kek: key encryption key (@kek_len bytes)
3373093a48d2SNathan Errera  * @kck: key confirmation key (@kck_len bytes)
337478f686caSJohannes Berg  * @replay_ctr: replay counter (NL80211_REPLAY_CTR_LEN bytes)
3375093a48d2SNathan Errera  * @kek_len: length of kek
33762d8b08feSMauro Carvalho Chehab  * @kck_len: length of kck
3377093a48d2SNathan Errera  * @akm: akm (oui, id)
3378e5497d76SJohannes Berg  */
3379e5497d76SJohannes Berg struct cfg80211_gtk_rekey_data {
338078f686caSJohannes Berg 	const u8 *kek, *kck, *replay_ctr;
3381093a48d2SNathan Errera 	u32 akm;
3382093a48d2SNathan Errera 	u8 kek_len, kck_len;
3383e5497d76SJohannes Berg };
3384e5497d76SJohannes Berg 
3385e5497d76SJohannes Berg /**
3386355199e0SJouni Malinen  * struct cfg80211_update_ft_ies_params - FT IE Information
3387355199e0SJouni Malinen  *
3388355199e0SJouni Malinen  * This structure provides information needed to update the fast transition IE
3389355199e0SJouni Malinen  *
3390355199e0SJouni Malinen  * @md: The Mobility Domain ID, 2 Octet value
3391355199e0SJouni Malinen  * @ie: Fast Transition IEs
3392355199e0SJouni Malinen  * @ie_len: Length of ft_ie in octets
3393355199e0SJouni Malinen  */
3394355199e0SJouni Malinen struct cfg80211_update_ft_ies_params {
3395355199e0SJouni Malinen 	u16 md;
3396355199e0SJouni Malinen 	const u8 *ie;
3397355199e0SJouni Malinen 	size_t ie_len;
3398355199e0SJouni Malinen };
3399355199e0SJouni Malinen 
3400355199e0SJouni Malinen /**
3401b176e629SAndrei Otcheretianski  * struct cfg80211_mgmt_tx_params - mgmt tx parameters
3402b176e629SAndrei Otcheretianski  *
3403b176e629SAndrei Otcheretianski  * This structure provides information needed to transmit a mgmt frame
3404b176e629SAndrei Otcheretianski  *
3405b176e629SAndrei Otcheretianski  * @chan: channel to use
3406b176e629SAndrei Otcheretianski  * @offchan: indicates wether off channel operation is required
3407b176e629SAndrei Otcheretianski  * @wait: duration for ROC
3408b176e629SAndrei Otcheretianski  * @buf: buffer to transmit
3409b176e629SAndrei Otcheretianski  * @len: buffer length
3410b176e629SAndrei Otcheretianski  * @no_cck: don't use cck rates for this frame
3411b176e629SAndrei Otcheretianski  * @dont_wait_for_ack: tells the low level not to wait for an ack
341234d22ce2SAndrei Otcheretianski  * @n_csa_offsets: length of csa_offsets array
341334d22ce2SAndrei Otcheretianski  * @csa_offsets: array of all the csa offsets in the frame
3414b176e629SAndrei Otcheretianski  */
3415b176e629SAndrei Otcheretianski struct cfg80211_mgmt_tx_params {
3416b176e629SAndrei Otcheretianski 	struct ieee80211_channel *chan;
3417b176e629SAndrei Otcheretianski 	bool offchan;
3418b176e629SAndrei Otcheretianski 	unsigned int wait;
3419b176e629SAndrei Otcheretianski 	const u8 *buf;
3420b176e629SAndrei Otcheretianski 	size_t len;
3421b176e629SAndrei Otcheretianski 	bool no_cck;
3422b176e629SAndrei Otcheretianski 	bool dont_wait_for_ack;
342334d22ce2SAndrei Otcheretianski 	int n_csa_offsets;
342434d22ce2SAndrei Otcheretianski 	const u16 *csa_offsets;
3425b176e629SAndrei Otcheretianski };
3426b176e629SAndrei Otcheretianski 
3427b176e629SAndrei Otcheretianski /**
3428fa9ffc74SKyeyoon Park  * struct cfg80211_dscp_exception - DSCP exception
3429fa9ffc74SKyeyoon Park  *
3430fa9ffc74SKyeyoon Park  * @dscp: DSCP value that does not adhere to the user priority range definition
3431fa9ffc74SKyeyoon Park  * @up: user priority value to which the corresponding DSCP value belongs
3432fa9ffc74SKyeyoon Park  */
3433fa9ffc74SKyeyoon Park struct cfg80211_dscp_exception {
3434fa9ffc74SKyeyoon Park 	u8 dscp;
3435fa9ffc74SKyeyoon Park 	u8 up;
3436fa9ffc74SKyeyoon Park };
3437fa9ffc74SKyeyoon Park 
3438fa9ffc74SKyeyoon Park /**
3439fa9ffc74SKyeyoon Park  * struct cfg80211_dscp_range - DSCP range definition for user priority
3440fa9ffc74SKyeyoon Park  *
3441fa9ffc74SKyeyoon Park  * @low: lowest DSCP value of this user priority range, inclusive
3442fa9ffc74SKyeyoon Park  * @high: highest DSCP value of this user priority range, inclusive
3443fa9ffc74SKyeyoon Park  */
3444fa9ffc74SKyeyoon Park struct cfg80211_dscp_range {
3445fa9ffc74SKyeyoon Park 	u8 low;
3446fa9ffc74SKyeyoon Park 	u8 high;
3447fa9ffc74SKyeyoon Park };
3448fa9ffc74SKyeyoon Park 
3449fa9ffc74SKyeyoon Park /* QoS Map Set element length defined in IEEE Std 802.11-2012, 8.4.2.97 */
3450fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_MAX_EX	21
3451fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_LEN_MIN	16
3452fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_LEN_MAX \
3453fa9ffc74SKyeyoon Park 	(IEEE80211_QOS_MAP_LEN_MIN + 2 * IEEE80211_QOS_MAP_MAX_EX)
3454fa9ffc74SKyeyoon Park 
3455fa9ffc74SKyeyoon Park /**
3456fa9ffc74SKyeyoon Park  * struct cfg80211_qos_map - QoS Map Information
3457fa9ffc74SKyeyoon Park  *
3458fa9ffc74SKyeyoon Park  * This struct defines the Interworking QoS map setting for DSCP values
3459fa9ffc74SKyeyoon Park  *
3460fa9ffc74SKyeyoon Park  * @num_des: number of DSCP exceptions (0..21)
3461fa9ffc74SKyeyoon Park  * @dscp_exception: optionally up to maximum of 21 DSCP exceptions from
3462fa9ffc74SKyeyoon Park  *	the user priority DSCP range definition
3463fa9ffc74SKyeyoon Park  * @up: DSCP range definition for a particular user priority
3464fa9ffc74SKyeyoon Park  */
3465fa9ffc74SKyeyoon Park struct cfg80211_qos_map {
3466fa9ffc74SKyeyoon Park 	u8 num_des;
3467fa9ffc74SKyeyoon Park 	struct cfg80211_dscp_exception dscp_exception[IEEE80211_QOS_MAP_MAX_EX];
3468fa9ffc74SKyeyoon Park 	struct cfg80211_dscp_range up[8];
3469fa9ffc74SKyeyoon Park };
3470fa9ffc74SKyeyoon Park 
3471fa9ffc74SKyeyoon Park /**
3472cb3b7d87SAyala Beker  * struct cfg80211_nan_conf - NAN configuration
3473cb3b7d87SAyala Beker  *
3474cb3b7d87SAyala Beker  * This struct defines NAN configuration parameters
3475cb3b7d87SAyala Beker  *
3476cb3b7d87SAyala Beker  * @master_pref: master preference (1 - 255)
34778585989dSLuca Coelho  * @bands: operating bands, a bitmap of &enum nl80211_band values.
34788585989dSLuca Coelho  *	For instance, for NL80211_BAND_2GHZ, bit 0 would be set
34798585989dSLuca Coelho  *	(i.e. BIT(NL80211_BAND_2GHZ)).
3480cb3b7d87SAyala Beker  */
3481cb3b7d87SAyala Beker struct cfg80211_nan_conf {
3482cb3b7d87SAyala Beker 	u8 master_pref;
34838585989dSLuca Coelho 	u8 bands;
3484cb3b7d87SAyala Beker };
3485cb3b7d87SAyala Beker 
3486cb3b7d87SAyala Beker /**
3487a5a9dcf2SAyala Beker  * enum cfg80211_nan_conf_changes - indicates changed fields in NAN
3488a5a9dcf2SAyala Beker  * configuration
3489a5a9dcf2SAyala Beker  *
3490a5a9dcf2SAyala Beker  * @CFG80211_NAN_CONF_CHANGED_PREF: master preference
34918585989dSLuca Coelho  * @CFG80211_NAN_CONF_CHANGED_BANDS: operating bands
3492a5a9dcf2SAyala Beker  */
3493a5a9dcf2SAyala Beker enum cfg80211_nan_conf_changes {
3494a5a9dcf2SAyala Beker 	CFG80211_NAN_CONF_CHANGED_PREF = BIT(0),
34958585989dSLuca Coelho 	CFG80211_NAN_CONF_CHANGED_BANDS = BIT(1),
3496a5a9dcf2SAyala Beker };
3497a5a9dcf2SAyala Beker 
3498a5a9dcf2SAyala Beker /**
3499a442b761SAyala Beker  * struct cfg80211_nan_func_filter - a NAN function Rx / Tx filter
3500a442b761SAyala Beker  *
3501a442b761SAyala Beker  * @filter: the content of the filter
3502a442b761SAyala Beker  * @len: the length of the filter
3503a442b761SAyala Beker  */
3504a442b761SAyala Beker struct cfg80211_nan_func_filter {
3505a442b761SAyala Beker 	const u8 *filter;
3506a442b761SAyala Beker 	u8 len;
3507a442b761SAyala Beker };
3508a442b761SAyala Beker 
3509a442b761SAyala Beker /**
3510a442b761SAyala Beker  * struct cfg80211_nan_func - a NAN function
3511a442b761SAyala Beker  *
3512a442b761SAyala Beker  * @type: &enum nl80211_nan_function_type
3513a442b761SAyala Beker  * @service_id: the service ID of the function
3514a442b761SAyala Beker  * @publish_type: &nl80211_nan_publish_type
3515a442b761SAyala Beker  * @close_range: if true, the range should be limited. Threshold is
3516a442b761SAyala Beker  *	implementation specific.
3517a442b761SAyala Beker  * @publish_bcast: if true, the solicited publish should be broadcasted
3518a442b761SAyala Beker  * @subscribe_active: if true, the subscribe is active
3519a442b761SAyala Beker  * @followup_id: the instance ID for follow up
3520a442b761SAyala Beker  * @followup_reqid: the requestor instance ID for follow up
3521a442b761SAyala Beker  * @followup_dest: MAC address of the recipient of the follow up
3522a442b761SAyala Beker  * @ttl: time to live counter in DW.
3523a442b761SAyala Beker  * @serv_spec_info: Service Specific Info
3524a442b761SAyala Beker  * @serv_spec_info_len: Service Specific Info length
3525a442b761SAyala Beker  * @srf_include: if true, SRF is inclusive
3526a442b761SAyala Beker  * @srf_bf: Bloom Filter
3527a442b761SAyala Beker  * @srf_bf_len: Bloom Filter length
3528a442b761SAyala Beker  * @srf_bf_idx: Bloom Filter index
3529a442b761SAyala Beker  * @srf_macs: SRF MAC addresses
3530a442b761SAyala Beker  * @srf_num_macs: number of MAC addresses in SRF
3531a442b761SAyala Beker  * @rx_filters: rx filters that are matched with corresponding peer's tx_filter
3532a442b761SAyala Beker  * @tx_filters: filters that should be transmitted in the SDF.
3533a442b761SAyala Beker  * @num_rx_filters: length of &rx_filters.
3534a442b761SAyala Beker  * @num_tx_filters: length of &tx_filters.
3535a442b761SAyala Beker  * @instance_id: driver allocated id of the function.
3536a442b761SAyala Beker  * @cookie: unique NAN function identifier.
3537a442b761SAyala Beker  */
3538a442b761SAyala Beker struct cfg80211_nan_func {
3539a442b761SAyala Beker 	enum nl80211_nan_function_type type;
3540a442b761SAyala Beker 	u8 service_id[NL80211_NAN_FUNC_SERVICE_ID_LEN];
3541a442b761SAyala Beker 	u8 publish_type;
3542a442b761SAyala Beker 	bool close_range;
3543a442b761SAyala Beker 	bool publish_bcast;
3544a442b761SAyala Beker 	bool subscribe_active;
3545a442b761SAyala Beker 	u8 followup_id;
3546a442b761SAyala Beker 	u8 followup_reqid;
3547a442b761SAyala Beker 	struct mac_address followup_dest;
3548a442b761SAyala Beker 	u32 ttl;
3549a442b761SAyala Beker 	const u8 *serv_spec_info;
3550a442b761SAyala Beker 	u8 serv_spec_info_len;
3551a442b761SAyala Beker 	bool srf_include;
3552a442b761SAyala Beker 	const u8 *srf_bf;
3553a442b761SAyala Beker 	u8 srf_bf_len;
3554a442b761SAyala Beker 	u8 srf_bf_idx;
3555a442b761SAyala Beker 	struct mac_address *srf_macs;
3556a442b761SAyala Beker 	int srf_num_macs;
3557a442b761SAyala Beker 	struct cfg80211_nan_func_filter *rx_filters;
3558a442b761SAyala Beker 	struct cfg80211_nan_func_filter *tx_filters;
3559a442b761SAyala Beker 	u8 num_tx_filters;
3560a442b761SAyala Beker 	u8 num_rx_filters;
3561a442b761SAyala Beker 	u8 instance_id;
3562a442b761SAyala Beker 	u64 cookie;
3563a442b761SAyala Beker };
3564a442b761SAyala Beker 
3565a442b761SAyala Beker /**
35663a00df57SAvraham Stern  * struct cfg80211_pmk_conf - PMK configuration
35673a00df57SAvraham Stern  *
35683a00df57SAvraham Stern  * @aa: authenticator address
35693a00df57SAvraham Stern  * @pmk_len: PMK length in bytes.
35703a00df57SAvraham Stern  * @pmk: the PMK material
35713a00df57SAvraham Stern  * @pmk_r0_name: PMK-R0 Name. NULL if not applicable (i.e., the PMK
35723a00df57SAvraham Stern  *	is not PMK-R0). When pmk_r0_name is not NULL, the pmk field
35733a00df57SAvraham Stern  *	holds PMK-R0.
35743a00df57SAvraham Stern  */
35753a00df57SAvraham Stern struct cfg80211_pmk_conf {
35763a00df57SAvraham Stern 	const u8 *aa;
35773a00df57SAvraham Stern 	u8 pmk_len;
35783a00df57SAvraham Stern 	const u8 *pmk;
35793a00df57SAvraham Stern 	const u8 *pmk_r0_name;
35803a00df57SAvraham Stern };
35813a00df57SAvraham Stern 
35823a00df57SAvraham Stern /**
358340cbfa90SSrinivas Dasari  * struct cfg80211_external_auth_params - Trigger External authentication.
358440cbfa90SSrinivas Dasari  *
358540cbfa90SSrinivas Dasari  * Commonly used across the external auth request and event interfaces.
358640cbfa90SSrinivas Dasari  *
358740cbfa90SSrinivas Dasari  * @action: action type / trigger for external authentication. Only significant
358840cbfa90SSrinivas Dasari  *	for the authentication request event interface (driver to user space).
358940cbfa90SSrinivas Dasari  * @bssid: BSSID of the peer with which the authentication has
359040cbfa90SSrinivas Dasari  *	to happen. Used by both the authentication request event and
359140cbfa90SSrinivas Dasari  *	authentication response command interface.
359240cbfa90SSrinivas Dasari  * @ssid: SSID of the AP.  Used by both the authentication request event and
359340cbfa90SSrinivas Dasari  *	authentication response command interface.
359440cbfa90SSrinivas Dasari  * @key_mgmt_suite: AKM suite of the respective authentication. Used by the
359540cbfa90SSrinivas Dasari  *	authentication request event interface.
359640cbfa90SSrinivas Dasari  * @status: status code, %WLAN_STATUS_SUCCESS for successful authentication,
359740cbfa90SSrinivas Dasari  *	use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space cannot give you
359840cbfa90SSrinivas Dasari  *	the real status code for failures. Used only for the authentication
359940cbfa90SSrinivas Dasari  *	response command interface (user space to driver).
3600fe494370SSrinivas Dasari  * @pmkid: The identifier to refer a PMKSA.
360140cbfa90SSrinivas Dasari  */
360240cbfa90SSrinivas Dasari struct cfg80211_external_auth_params {
360340cbfa90SSrinivas Dasari 	enum nl80211_external_auth_action action;
360440cbfa90SSrinivas Dasari 	u8 bssid[ETH_ALEN] __aligned(2);
360540cbfa90SSrinivas Dasari 	struct cfg80211_ssid ssid;
360640cbfa90SSrinivas Dasari 	unsigned int key_mgmt_suite;
360740cbfa90SSrinivas Dasari 	u16 status;
3608fe494370SSrinivas Dasari 	const u8 *pmkid;
360940cbfa90SSrinivas Dasari };
361040cbfa90SSrinivas Dasari 
361140cbfa90SSrinivas Dasari /**
36123453de98SRandy Dunlap  * struct cfg80211_ftm_responder_stats - FTM responder statistics
361381e54d08SPradeep Kumar Chitrapu  *
361481e54d08SPradeep Kumar Chitrapu  * @filled: bitflag of flags using the bits of &enum nl80211_ftm_stats to
361581e54d08SPradeep Kumar Chitrapu  *	indicate the relevant values in this struct for them
361681e54d08SPradeep Kumar Chitrapu  * @success_num: number of FTM sessions in which all frames were successfully
361781e54d08SPradeep Kumar Chitrapu  *	answered
361881e54d08SPradeep Kumar Chitrapu  * @partial_num: number of FTM sessions in which part of frames were
361981e54d08SPradeep Kumar Chitrapu  *	successfully answered
362081e54d08SPradeep Kumar Chitrapu  * @failed_num: number of failed FTM sessions
362181e54d08SPradeep Kumar Chitrapu  * @asap_num: number of ASAP FTM sessions
362281e54d08SPradeep Kumar Chitrapu  * @non_asap_num: number of  non-ASAP FTM sessions
362381e54d08SPradeep Kumar Chitrapu  * @total_duration_ms: total sessions durations - gives an indication
362481e54d08SPradeep Kumar Chitrapu  *	of how much time the responder was busy
362581e54d08SPradeep Kumar Chitrapu  * @unknown_triggers_num: number of unknown FTM triggers - triggers from
362681e54d08SPradeep Kumar Chitrapu  *	initiators that didn't finish successfully the negotiation phase with
362781e54d08SPradeep Kumar Chitrapu  *	the responder
362881e54d08SPradeep Kumar Chitrapu  * @reschedule_requests_num: number of FTM reschedule requests - initiator asks
362981e54d08SPradeep Kumar Chitrapu  *	for a new scheduling although it already has scheduled FTM slot
363081e54d08SPradeep Kumar Chitrapu  * @out_of_window_triggers_num: total FTM triggers out of scheduled window
363181e54d08SPradeep Kumar Chitrapu  */
363281e54d08SPradeep Kumar Chitrapu struct cfg80211_ftm_responder_stats {
363381e54d08SPradeep Kumar Chitrapu 	u32 filled;
363481e54d08SPradeep Kumar Chitrapu 	u32 success_num;
363581e54d08SPradeep Kumar Chitrapu 	u32 partial_num;
363681e54d08SPradeep Kumar Chitrapu 	u32 failed_num;
363781e54d08SPradeep Kumar Chitrapu 	u32 asap_num;
363881e54d08SPradeep Kumar Chitrapu 	u32 non_asap_num;
363981e54d08SPradeep Kumar Chitrapu 	u64 total_duration_ms;
364081e54d08SPradeep Kumar Chitrapu 	u32 unknown_triggers_num;
364181e54d08SPradeep Kumar Chitrapu 	u32 reschedule_requests_num;
364281e54d08SPradeep Kumar Chitrapu 	u32 out_of_window_triggers_num;
364381e54d08SPradeep Kumar Chitrapu };
364481e54d08SPradeep Kumar Chitrapu 
364581e54d08SPradeep Kumar Chitrapu /**
36469bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_ftm_result - FTM result
36479bb7e0f2SJohannes Berg  * @failure_reason: if this measurement failed (PMSR status is
36489bb7e0f2SJohannes Berg  *	%NL80211_PMSR_STATUS_FAILURE), this gives a more precise
36499bb7e0f2SJohannes Berg  *	reason than just "failure"
36509bb7e0f2SJohannes Berg  * @burst_index: if reporting partial results, this is the index
36519bb7e0f2SJohannes Berg  *	in [0 .. num_bursts-1] of the burst that's being reported
36529bb7e0f2SJohannes Berg  * @num_ftmr_attempts: number of FTM request frames transmitted
36539bb7e0f2SJohannes Berg  * @num_ftmr_successes: number of FTM request frames acked
36549bb7e0f2SJohannes Berg  * @busy_retry_time: if failure_reason is %NL80211_PMSR_FTM_FAILURE_PEER_BUSY,
36559bb7e0f2SJohannes Berg  *	fill this to indicate in how many seconds a retry is deemed possible
36569bb7e0f2SJohannes Berg  *	by the responder
36579bb7e0f2SJohannes Berg  * @num_bursts_exp: actual number of bursts exponent negotiated
36589bb7e0f2SJohannes Berg  * @burst_duration: actual burst duration negotiated
36599bb7e0f2SJohannes Berg  * @ftms_per_burst: actual FTMs per burst negotiated
36609bb7e0f2SJohannes Berg  * @lci_len: length of LCI information (if present)
36619bb7e0f2SJohannes Berg  * @civicloc_len: length of civic location information (if present)
36629bb7e0f2SJohannes Berg  * @lci: LCI data (may be %NULL)
36639bb7e0f2SJohannes Berg  * @civicloc: civic location data (may be %NULL)
36649bb7e0f2SJohannes Berg  * @rssi_avg: average RSSI over FTM action frames reported
36659bb7e0f2SJohannes Berg  * @rssi_spread: spread of the RSSI over FTM action frames reported
36669bb7e0f2SJohannes Berg  * @tx_rate: bitrate for transmitted FTM action frame response
36679bb7e0f2SJohannes Berg  * @rx_rate: bitrate of received FTM action frame
36689bb7e0f2SJohannes Berg  * @rtt_avg: average of RTTs measured (must have either this or @dist_avg)
36699bb7e0f2SJohannes Berg  * @rtt_variance: variance of RTTs measured (note that standard deviation is
36709bb7e0f2SJohannes Berg  *	the square root of the variance)
36719bb7e0f2SJohannes Berg  * @rtt_spread: spread of the RTTs measured
36729bb7e0f2SJohannes Berg  * @dist_avg: average of distances (mm) measured
36739bb7e0f2SJohannes Berg  *	(must have either this or @rtt_avg)
36749bb7e0f2SJohannes Berg  * @dist_variance: variance of distances measured (see also @rtt_variance)
36759bb7e0f2SJohannes Berg  * @dist_spread: spread of distances measured (see also @rtt_spread)
36769bb7e0f2SJohannes Berg  * @num_ftmr_attempts_valid: @num_ftmr_attempts is valid
36779bb7e0f2SJohannes Berg  * @num_ftmr_successes_valid: @num_ftmr_successes is valid
36789bb7e0f2SJohannes Berg  * @rssi_avg_valid: @rssi_avg is valid
36799bb7e0f2SJohannes Berg  * @rssi_spread_valid: @rssi_spread is valid
36809bb7e0f2SJohannes Berg  * @tx_rate_valid: @tx_rate is valid
36819bb7e0f2SJohannes Berg  * @rx_rate_valid: @rx_rate is valid
36829bb7e0f2SJohannes Berg  * @rtt_avg_valid: @rtt_avg is valid
36839bb7e0f2SJohannes Berg  * @rtt_variance_valid: @rtt_variance is valid
36849bb7e0f2SJohannes Berg  * @rtt_spread_valid: @rtt_spread is valid
36859bb7e0f2SJohannes Berg  * @dist_avg_valid: @dist_avg is valid
36869bb7e0f2SJohannes Berg  * @dist_variance_valid: @dist_variance is valid
36879bb7e0f2SJohannes Berg  * @dist_spread_valid: @dist_spread is valid
36889bb7e0f2SJohannes Berg  */
36899bb7e0f2SJohannes Berg struct cfg80211_pmsr_ftm_result {
36909bb7e0f2SJohannes Berg 	const u8 *lci;
36919bb7e0f2SJohannes Berg 	const u8 *civicloc;
36929bb7e0f2SJohannes Berg 	unsigned int lci_len;
36939bb7e0f2SJohannes Berg 	unsigned int civicloc_len;
36949bb7e0f2SJohannes Berg 	enum nl80211_peer_measurement_ftm_failure_reasons failure_reason;
36959bb7e0f2SJohannes Berg 	u32 num_ftmr_attempts, num_ftmr_successes;
36969bb7e0f2SJohannes Berg 	s16 burst_index;
36979bb7e0f2SJohannes Berg 	u8 busy_retry_time;
36989bb7e0f2SJohannes Berg 	u8 num_bursts_exp;
36999bb7e0f2SJohannes Berg 	u8 burst_duration;
37009bb7e0f2SJohannes Berg 	u8 ftms_per_burst;
37019bb7e0f2SJohannes Berg 	s32 rssi_avg;
37029bb7e0f2SJohannes Berg 	s32 rssi_spread;
37039bb7e0f2SJohannes Berg 	struct rate_info tx_rate, rx_rate;
37049bb7e0f2SJohannes Berg 	s64 rtt_avg;
37059bb7e0f2SJohannes Berg 	s64 rtt_variance;
37069bb7e0f2SJohannes Berg 	s64 rtt_spread;
37079bb7e0f2SJohannes Berg 	s64 dist_avg;
37089bb7e0f2SJohannes Berg 	s64 dist_variance;
37099bb7e0f2SJohannes Berg 	s64 dist_spread;
37109bb7e0f2SJohannes Berg 
37119bb7e0f2SJohannes Berg 	u16 num_ftmr_attempts_valid:1,
37129bb7e0f2SJohannes Berg 	    num_ftmr_successes_valid:1,
37139bb7e0f2SJohannes Berg 	    rssi_avg_valid:1,
37149bb7e0f2SJohannes Berg 	    rssi_spread_valid:1,
37159bb7e0f2SJohannes Berg 	    tx_rate_valid:1,
37169bb7e0f2SJohannes Berg 	    rx_rate_valid:1,
37179bb7e0f2SJohannes Berg 	    rtt_avg_valid:1,
37189bb7e0f2SJohannes Berg 	    rtt_variance_valid:1,
37199bb7e0f2SJohannes Berg 	    rtt_spread_valid:1,
37209bb7e0f2SJohannes Berg 	    dist_avg_valid:1,
37219bb7e0f2SJohannes Berg 	    dist_variance_valid:1,
37229bb7e0f2SJohannes Berg 	    dist_spread_valid:1;
37239bb7e0f2SJohannes Berg };
37249bb7e0f2SJohannes Berg 
37259bb7e0f2SJohannes Berg /**
37269bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_result - peer measurement result
37279bb7e0f2SJohannes Berg  * @addr: address of the peer
37289bb7e0f2SJohannes Berg  * @host_time: host time (use ktime_get_boottime() adjust to the time when the
37299bb7e0f2SJohannes Berg  *	measurement was made)
37309bb7e0f2SJohannes Berg  * @ap_tsf: AP's TSF at measurement time
37319bb7e0f2SJohannes Berg  * @status: status of the measurement
37329bb7e0f2SJohannes Berg  * @final: if reporting partial results, mark this as the last one; if not
37339bb7e0f2SJohannes Berg  *	reporting partial results always set this flag
37349bb7e0f2SJohannes Berg  * @ap_tsf_valid: indicates the @ap_tsf value is valid
37359bb7e0f2SJohannes Berg  * @type: type of the measurement reported, note that we only support reporting
37369bb7e0f2SJohannes Berg  *	one type at a time, but you can report multiple results separately and
37379bb7e0f2SJohannes Berg  *	they're all aggregated for userspace.
37382d8b08feSMauro Carvalho Chehab  * @ftm: FTM result
37399bb7e0f2SJohannes Berg  */
37409bb7e0f2SJohannes Berg struct cfg80211_pmsr_result {
37419bb7e0f2SJohannes Berg 	u64 host_time, ap_tsf;
37429bb7e0f2SJohannes Berg 	enum nl80211_peer_measurement_status status;
37439bb7e0f2SJohannes Berg 
37449bb7e0f2SJohannes Berg 	u8 addr[ETH_ALEN];
37459bb7e0f2SJohannes Berg 
37469bb7e0f2SJohannes Berg 	u8 final:1,
37479bb7e0f2SJohannes Berg 	   ap_tsf_valid:1;
37489bb7e0f2SJohannes Berg 
37499bb7e0f2SJohannes Berg 	enum nl80211_peer_measurement_type type;
37509bb7e0f2SJohannes Berg 
37519bb7e0f2SJohannes Berg 	union {
37529bb7e0f2SJohannes Berg 		struct cfg80211_pmsr_ftm_result ftm;
37539bb7e0f2SJohannes Berg 	};
37549bb7e0f2SJohannes Berg };
37559bb7e0f2SJohannes Berg 
37569bb7e0f2SJohannes Berg /**
37579bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_ftm_request_peer - FTM request data
37589bb7e0f2SJohannes Berg  * @requested: indicates FTM is requested
37599bb7e0f2SJohannes Berg  * @preamble: frame preamble to use
37609bb7e0f2SJohannes Berg  * @burst_period: burst period to use
37619bb7e0f2SJohannes Berg  * @asap: indicates to use ASAP mode
37629bb7e0f2SJohannes Berg  * @num_bursts_exp: number of bursts exponent
37639bb7e0f2SJohannes Berg  * @burst_duration: burst duration
37649bb7e0f2SJohannes Berg  * @ftms_per_burst: number of FTMs per burst
37659bb7e0f2SJohannes Berg  * @ftmr_retries: number of retries for FTM request
37669bb7e0f2SJohannes Berg  * @request_lci: request LCI information
37679bb7e0f2SJohannes Berg  * @request_civicloc: request civic location information
3768efb5520dSAvraham Stern  * @trigger_based: use trigger based ranging for the measurement
3769efb5520dSAvraham Stern  *		 If neither @trigger_based nor @non_trigger_based is set,
3770efb5520dSAvraham Stern  *		 EDCA based ranging will be used.
3771efb5520dSAvraham Stern  * @non_trigger_based: use non trigger based ranging for the measurement
3772efb5520dSAvraham Stern  *		 If neither @trigger_based nor @non_trigger_based is set,
3773efb5520dSAvraham Stern  *		 EDCA based ranging will be used.
377473807523SAvraham Stern  * @lmr_feedback: negotiate for I2R LMR feedback. Only valid if either
377573807523SAvraham Stern  *		 @trigger_based or @non_trigger_based is set.
3776dd3e4fc7SAvraham Stern  * @bss_color: the bss color of the responder. Optional. Set to zero to
3777dd3e4fc7SAvraham Stern  *	indicate the driver should set the BSS color. Only valid if
3778dd3e4fc7SAvraham Stern  *	@non_trigger_based or @trigger_based is set.
37799bb7e0f2SJohannes Berg  *
37809bb7e0f2SJohannes Berg  * See also nl80211 for the respective attribute documentation.
37819bb7e0f2SJohannes Berg  */
37829bb7e0f2SJohannes Berg struct cfg80211_pmsr_ftm_request_peer {
37839bb7e0f2SJohannes Berg 	enum nl80211_preamble preamble;
37849bb7e0f2SJohannes Berg 	u16 burst_period;
37859bb7e0f2SJohannes Berg 	u8 requested:1,
37869bb7e0f2SJohannes Berg 	   asap:1,
37879bb7e0f2SJohannes Berg 	   request_lci:1,
3788efb5520dSAvraham Stern 	   request_civicloc:1,
3789efb5520dSAvraham Stern 	   trigger_based:1,
379073807523SAvraham Stern 	   non_trigger_based:1,
379173807523SAvraham Stern 	   lmr_feedback:1;
37929bb7e0f2SJohannes Berg 	u8 num_bursts_exp;
37939bb7e0f2SJohannes Berg 	u8 burst_duration;
37949bb7e0f2SJohannes Berg 	u8 ftms_per_burst;
37959bb7e0f2SJohannes Berg 	u8 ftmr_retries;
3796dd3e4fc7SAvraham Stern 	u8 bss_color;
37979bb7e0f2SJohannes Berg };
37989bb7e0f2SJohannes Berg 
37999bb7e0f2SJohannes Berg /**
38009bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_request_peer - peer data for a peer measurement request
38019bb7e0f2SJohannes Berg  * @addr: MAC address
38029bb7e0f2SJohannes Berg  * @chandef: channel to use
38039bb7e0f2SJohannes Berg  * @report_ap_tsf: report the associated AP's TSF
38049bb7e0f2SJohannes Berg  * @ftm: FTM data, see &struct cfg80211_pmsr_ftm_request_peer
38059bb7e0f2SJohannes Berg  */
38069bb7e0f2SJohannes Berg struct cfg80211_pmsr_request_peer {
38079bb7e0f2SJohannes Berg 	u8 addr[ETH_ALEN];
38089bb7e0f2SJohannes Berg 	struct cfg80211_chan_def chandef;
38099bb7e0f2SJohannes Berg 	u8 report_ap_tsf:1;
38109bb7e0f2SJohannes Berg 	struct cfg80211_pmsr_ftm_request_peer ftm;
38119bb7e0f2SJohannes Berg };
38129bb7e0f2SJohannes Berg 
38139bb7e0f2SJohannes Berg /**
38149bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_request - peer measurement request
38159bb7e0f2SJohannes Berg  * @cookie: cookie, set by cfg80211
38169bb7e0f2SJohannes Berg  * @nl_portid: netlink portid - used by cfg80211
38179bb7e0f2SJohannes Berg  * @drv_data: driver data for this request, if required for aborting,
38189bb7e0f2SJohannes Berg  *	not otherwise freed or anything by cfg80211
38199bb7e0f2SJohannes Berg  * @mac_addr: MAC address used for (randomised) request
38209bb7e0f2SJohannes Berg  * @mac_addr_mask: MAC address mask used for randomisation, bits that
38219bb7e0f2SJohannes Berg  *	are 0 in the mask should be randomised, bits that are 1 should
38229bb7e0f2SJohannes Berg  *	be taken from the @mac_addr
38239bb7e0f2SJohannes Berg  * @list: used by cfg80211 to hold on to the request
38249bb7e0f2SJohannes Berg  * @timeout: timeout (in milliseconds) for the whole operation, if
38259bb7e0f2SJohannes Berg  *	zero it means there's no timeout
38269bb7e0f2SJohannes Berg  * @n_peers: number of peers to do measurements with
38279bb7e0f2SJohannes Berg  * @peers: per-peer measurement request data
38289bb7e0f2SJohannes Berg  */
38299bb7e0f2SJohannes Berg struct cfg80211_pmsr_request {
38309bb7e0f2SJohannes Berg 	u64 cookie;
38319bb7e0f2SJohannes Berg 	void *drv_data;
38329bb7e0f2SJohannes Berg 	u32 n_peers;
38339bb7e0f2SJohannes Berg 	u32 nl_portid;
38349bb7e0f2SJohannes Berg 
38359bb7e0f2SJohannes Berg 	u32 timeout;
38369bb7e0f2SJohannes Berg 
38379bb7e0f2SJohannes Berg 	u8 mac_addr[ETH_ALEN] __aligned(2);
38389bb7e0f2SJohannes Berg 	u8 mac_addr_mask[ETH_ALEN] __aligned(2);
38399bb7e0f2SJohannes Berg 
38409bb7e0f2SJohannes Berg 	struct list_head list;
38419bb7e0f2SJohannes Berg 
38429bb7e0f2SJohannes Berg 	struct cfg80211_pmsr_request_peer peers[];
38439bb7e0f2SJohannes Berg };
38449bb7e0f2SJohannes Berg 
38459bb7e0f2SJohannes Berg /**
3846cb74e977SSunil Dutt  * struct cfg80211_update_owe_info - OWE Information
3847cb74e977SSunil Dutt  *
3848cb74e977SSunil Dutt  * This structure provides information needed for the drivers to offload OWE
3849cb74e977SSunil Dutt  * (Opportunistic Wireless Encryption) processing to the user space.
3850cb74e977SSunil Dutt  *
3851cb74e977SSunil Dutt  * Commonly used across update_owe_info request and event interfaces.
3852cb74e977SSunil Dutt  *
3853cb74e977SSunil Dutt  * @peer: MAC address of the peer device for which the OWE processing
3854cb74e977SSunil Dutt  *	has to be done.
3855cb74e977SSunil Dutt  * @status: status code, %WLAN_STATUS_SUCCESS for successful OWE info
3856cb74e977SSunil Dutt  *	processing, use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space
3857cb74e977SSunil Dutt  *	cannot give you the real status code for failures. Used only for
3858cb74e977SSunil Dutt  *	OWE update request command interface (user space to driver).
3859cb74e977SSunil Dutt  * @ie: IEs obtained from the peer or constructed by the user space. These are
3860cb74e977SSunil Dutt  *	the IEs of the remote peer in the event from the host driver and
3861cb74e977SSunil Dutt  *	the constructed IEs by the user space in the request interface.
3862cb74e977SSunil Dutt  * @ie_len: Length of IEs in octets.
3863cb74e977SSunil Dutt  */
3864cb74e977SSunil Dutt struct cfg80211_update_owe_info {
3865cb74e977SSunil Dutt 	u8 peer[ETH_ALEN] __aligned(2);
3866cb74e977SSunil Dutt 	u16 status;
3867cb74e977SSunil Dutt 	const u8 *ie;
3868cb74e977SSunil Dutt 	size_t ie_len;
3869cb74e977SSunil Dutt };
3870cb74e977SSunil Dutt 
3871cb74e977SSunil Dutt /**
38726cd536feSJohannes Berg  * struct mgmt_frame_regs - management frame registrations data
38736cd536feSJohannes Berg  * @global_stypes: bitmap of management frame subtypes registered
38746cd536feSJohannes Berg  *	for the entire device
38756cd536feSJohannes Berg  * @interface_stypes: bitmap of management frame subtypes registered
38766cd536feSJohannes Berg  *	for the given interface
38772d8b08feSMauro Carvalho Chehab  * @global_mcast_stypes: mcast RX is needed globally for these subtypes
38789dba48a6SJohannes Berg  * @interface_mcast_stypes: mcast RX is needed on this interface
38799dba48a6SJohannes Berg  *	for these subtypes
38806cd536feSJohannes Berg  */
38816cd536feSJohannes Berg struct mgmt_frame_regs {
38826cd536feSJohannes Berg 	u32 global_stypes, interface_stypes;
38839dba48a6SJohannes Berg 	u32 global_mcast_stypes, interface_mcast_stypes;
38846cd536feSJohannes Berg };
38856cd536feSJohannes Berg 
38866cd536feSJohannes Berg /**
3887704232c2SJohannes Berg  * struct cfg80211_ops - backend description for wireless configuration
3888704232c2SJohannes Berg  *
3889704232c2SJohannes Berg  * This struct is registered by fullmac card drivers and/or wireless stacks
3890704232c2SJohannes Berg  * in order to handle configuration requests on their interfaces.
3891704232c2SJohannes Berg  *
3892704232c2SJohannes Berg  * All callbacks except where otherwise noted should return 0
3893704232c2SJohannes Berg  * on success or a negative error code.
3894704232c2SJohannes Berg  *
3895a05829a7SJohannes Berg  * All operations are invoked with the wiphy mutex held. The RTNL may be
3896a05829a7SJohannes Berg  * held in addition (due to wireless extensions) but this cannot be relied
3897a05829a7SJohannes Berg  * upon except in cases where documented below. Note that due to ordering,
3898a05829a7SJohannes Berg  * the RTNL also cannot be acquired in any handlers.
389943fb45cbSJohannes Berg  *
3900ff1b6e69SJohannes Berg  * @suspend: wiphy device needs to be suspended. The variable @wow will
3901ff1b6e69SJohannes Berg  *	be %NULL or contain the enabled Wake-on-Wireless triggers that are
3902ff1b6e69SJohannes Berg  *	configured for the device.
39030378b3f1SJohannes Berg  * @resume: wiphy device needs to be resumed
39046d52563fSJohannes Berg  * @set_wakeup: Called when WoWLAN is enabled/disabled, use this callback
39056d52563fSJohannes Berg  *	to call device_set_wakeup_enable() to enable/disable wakeup from
39066d52563fSJohannes Berg  *	the device.
39070378b3f1SJohannes Berg  *
390860719ffdSJohannes Berg  * @add_virtual_intf: create a new virtual interface with the given name,
3909463d0183SJohannes Berg  *	must set the struct wireless_dev's iftype. Beware: You must create
391084efbb84SJohannes Berg  *	the new netdev in the wiphy's network namespace! Returns the struct
391198104fdeSJohannes Berg  *	wireless_dev, or an ERR_PTR. For P2P device wdevs, the driver must
391298104fdeSJohannes Berg  *	also set the address member in the wdev.
3913a05829a7SJohannes Berg  *	This additionally holds the RTNL to be able to do netdev changes.
3914704232c2SJohannes Berg  *
391584efbb84SJohannes Berg  * @del_virtual_intf: remove the virtual interface
3916a05829a7SJohannes Berg  *	This additionally holds the RTNL to be able to do netdev changes.
391755682965SJohannes Berg  *
391860719ffdSJohannes Berg  * @change_virtual_intf: change type/configuration of virtual interface,
391960719ffdSJohannes Berg  *	keep the struct wireless_dev's iftype updated.
3920a05829a7SJohannes Berg  *	This additionally holds the RTNL to be able to do netdev changes.
392155682965SJohannes Berg  *
3922f2a0290bSJohannes Berg  * @add_intf_link: Add a new MLO link to the given interface. Note that
3923f2a0290bSJohannes Berg  *	the wdev->link[] data structure has been updated, so the new link
3924f2a0290bSJohannes Berg  *	address is available.
3925f2a0290bSJohannes Berg  * @del_intf_link: Remove an MLO link from the given interface.
3926f2a0290bSJohannes Berg  *
392741ade00fSJohannes Berg  * @add_key: add a key with the given parameters. @mac_addr will be %NULL
392841ade00fSJohannes Berg  *	when adding a group key.
392941ade00fSJohannes Berg  *
393041ade00fSJohannes Berg  * @get_key: get information about the key with the given parameters.
393141ade00fSJohannes Berg  *	@mac_addr will be %NULL when requesting information for a group
393241ade00fSJohannes Berg  *	key. All pointers given to the @callback function need not be valid
3933e3da574aSJohannes Berg  *	after it returns. This function should return an error if it is
3934e3da574aSJohannes Berg  *	not possible to retrieve the key, -ENOENT if it doesn't exist.
393541ade00fSJohannes Berg  *
393641ade00fSJohannes Berg  * @del_key: remove a key given the @mac_addr (%NULL for a group key)
3937e3da574aSJohannes Berg  *	and @key_index, return -ENOENT if the key doesn't exist.
393841ade00fSJohannes Berg  *
393941ade00fSJohannes Berg  * @set_default_key: set the default key on an interface
3940ed1b6cc7SJohannes Berg  *
39413cfcf6acSJouni Malinen  * @set_default_mgmt_key: set the default management frame key on an interface
39421f7e9f46SJohannes Berg  *
394356be393fSJouni Malinen  * @set_default_beacon_key: set the default Beacon frame key on an interface
39443cfcf6acSJouni Malinen  *
3945e5497d76SJohannes Berg  * @set_rekey_data: give the data necessary for GTK rekeying to the driver
3946e5497d76SJohannes Berg  *
3947c04a4ff7SJohannes Berg  * @start_ap: Start acting in AP mode defined by the parameters.
3948c04a4ff7SJohannes Berg  * @change_beacon: Change the beacon parameters for an access point mode
3949c04a4ff7SJohannes Berg  *	interface. This should reject the call when AP mode wasn't started.
3950c04a4ff7SJohannes Berg  * @stop_ap: Stop being an AP, including stopping beaconing.
39515727ef1bSJohannes Berg  *
39525727ef1bSJohannes Berg  * @add_station: Add a new station.
395389c771e5SJouni Malinen  * @del_station: Remove a station
3954bdd90d5eSJohannes Berg  * @change_station: Modify a given station. Note that flags changes are not much
3955bdd90d5eSJohannes Berg  *	validated in cfg80211, in particular the auth/assoc/authorized flags
3956bdd90d5eSJohannes Berg  *	might come to the driver in invalid combinations -- make sure to check
395777ee7c89SJohannes Berg  *	them, also against the existing state! Drivers must call
395877ee7c89SJohannes Berg  *	cfg80211_check_station_change() to validate the information.
3959abe37c4bSJohannes Berg  * @get_station: get station information for the station identified by @mac
3960abe37c4bSJohannes Berg  * @dump_station: dump station callback -- resume dump at index @idx
3961abe37c4bSJohannes Berg  *
3962abe37c4bSJohannes Berg  * @add_mpath: add a fixed mesh path
3963abe37c4bSJohannes Berg  * @del_mpath: delete a given mesh path
3964abe37c4bSJohannes Berg  * @change_mpath: change a given mesh path
3965abe37c4bSJohannes Berg  * @get_mpath: get a mesh path for the given parameters
3966abe37c4bSJohannes Berg  * @dump_mpath: dump mesh path callback -- resume dump at index @idx
396766be7d2bSHenning Rogge  * @get_mpp: get a mesh proxy path for the given parameters
396866be7d2bSHenning Rogge  * @dump_mpp: dump mesh proxy path callback -- resume dump at index @idx
3969f52555a4SJohannes Berg  * @join_mesh: join the mesh network with the specified parameters
39708d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
3971f52555a4SJohannes Berg  * @leave_mesh: leave the current mesh network
39728d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
39732ec600d6SLuis Carlos Cobo  *
397424bdd9f4SJavier Cardona  * @get_mesh_config: Get the current mesh configuration
397593da9cc1Scolin@cozybit.com  *
397624bdd9f4SJavier Cardona  * @update_mesh_config: Update mesh parameters on a running mesh.
397793da9cc1Scolin@cozybit.com  *	The mask is a bitfield which tells us which parameters to
397893da9cc1Scolin@cozybit.com  *	set, and which to leave alone.
397993da9cc1Scolin@cozybit.com  *
39809f1ba906SJouni Malinen  * @change_bss: Modify parameters for a given BSS.
398131888487SJouni Malinen  *
398231888487SJouni Malinen  * @set_txq_params: Set TX queue parameters
398372bdcf34SJouni Malinen  *
3984e8c9bd5bSJohannes Berg  * @libertas_set_mesh_channel: Only for backward compatibility for libertas,
3985e8c9bd5bSJohannes Berg  *	as it doesn't implement join_mesh and needs to set the channel to
3986e8c9bd5bSJohannes Berg  *	join the mesh instead.
3987e8c9bd5bSJohannes Berg  *
3988e8c9bd5bSJohannes Berg  * @set_monitor_channel: Set the monitor mode channel for the device. If other
3989e8c9bd5bSJohannes Berg  *	interfaces are active this callback should reject the configuration.
3990e8c9bd5bSJohannes Berg  *	If no interfaces are active or the device is down, the channel should
3991e8c9bd5bSJohannes Berg  *	be stored for when a monitor interface becomes active.
39929aed3cc1SJouni Malinen  *
39932a519311SJohannes Berg  * @scan: Request to do a scan. If returning zero, the scan request is given
39942a519311SJohannes Berg  *	the driver, and will be valid until passed to cfg80211_scan_done().
39952a519311SJohannes Berg  *	For scan results, call cfg80211_inform_bss(); you can call this outside
39962a519311SJohannes Berg  *	the scan/scan_done bracket too.
399791d3ab46SVidyullatha Kanchanapally  * @abort_scan: Tell the driver to abort an ongoing scan. The driver shall
399891d3ab46SVidyullatha Kanchanapally  *	indicate the status of the scan through cfg80211_scan_done().
3999636a5d36SJouni Malinen  *
4000636a5d36SJouni Malinen  * @auth: Request to authenticate with the specified peer
40018d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
4002636a5d36SJouni Malinen  * @assoc: Request to (re)associate with the specified peer
40038d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
4004636a5d36SJouni Malinen  * @deauth: Request to deauthenticate from the specified peer
40058d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
4006636a5d36SJouni Malinen  * @disassoc: Request to disassociate from the specified peer
40078d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
400804a773adSJohannes Berg  *
4009b23aa676SSamuel Ortiz  * @connect: Connect to the ESS with the specified parameters. When connected,
4010bf1ecd21SJouni Malinen  *	call cfg80211_connect_result()/cfg80211_connect_bss() with status code
4011bf1ecd21SJouni Malinen  *	%WLAN_STATUS_SUCCESS. If the connection fails for some reason, call
4012bf1ecd21SJouni Malinen  *	cfg80211_connect_result()/cfg80211_connect_bss() with the status code
4013bf1ecd21SJouni Malinen  *	from the AP or cfg80211_connect_timeout() if no frame with status code
4014bf1ecd21SJouni Malinen  *	was received.
4015bf1ecd21SJouni Malinen  *	The driver is allowed to roam to other BSSes within the ESS when the
4016bf1ecd21SJouni Malinen  *	other BSS matches the connect parameters. When such roaming is initiated
4017bf1ecd21SJouni Malinen  *	by the driver, the driver is expected to verify that the target matches
4018bf1ecd21SJouni Malinen  *	the configured security parameters and to use Reassociation Request
4019bf1ecd21SJouni Malinen  *	frame instead of Association Request frame.
4020bf1ecd21SJouni Malinen  *	The connect function can also be used to request the driver to perform a
4021bf1ecd21SJouni Malinen  *	specific roam when connected to an ESS. In that case, the prev_bssid
402235eb8f7bSJouni Malinen  *	parameter is set to the BSSID of the currently associated BSS as an
4023bf1ecd21SJouni Malinen  *	indication of requesting reassociation.
4024bf1ecd21SJouni Malinen  *	In both the driver-initiated and new connect() call initiated roaming
4025bf1ecd21SJouni Malinen  *	cases, the result of roaming is indicated with a call to
402629ce6ecbSAvraham Stern  *	cfg80211_roamed(). (invoked with the wireless_dev mutex held)
4027088e8df8Svamsi krishna  * @update_connect_params: Update the connect parameters while connected to a
4028088e8df8Svamsi krishna  *	BSS. The updated parameters can be used by driver/firmware for
4029088e8df8Svamsi krishna  *	subsequent BSS selection (roaming) decisions and to form the
4030088e8df8Svamsi krishna  *	Authentication/(Re)Association Request frames. This call does not
4031088e8df8Svamsi krishna  *	request an immediate disassociation or reassociation with the current
4032088e8df8Svamsi krishna  *	BSS, i.e., this impacts only subsequent (re)associations. The bits in
4033088e8df8Svamsi krishna  *	changed are defined in &enum cfg80211_connect_params_changed.
4034088e8df8Svamsi krishna  *	(invoked with the wireless_dev mutex held)
40350711d638SIlan Peer  * @disconnect: Disconnect from the BSS/ESS or stop connection attempts if
40360711d638SIlan Peer  *      connection is in progress. Once done, call cfg80211_disconnected() in
40370711d638SIlan Peer  *      case connection was already established (invoked with the
40380711d638SIlan Peer  *      wireless_dev mutex held), otherwise call cfg80211_connect_timeout().
4039b23aa676SSamuel Ortiz  *
404004a773adSJohannes Berg  * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call
404104a773adSJohannes Berg  *	cfg80211_ibss_joined(), also call that function when changing BSSID due
404204a773adSJohannes Berg  *	to a merge.
40438d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
404404a773adSJohannes Berg  * @leave_ibss: Leave the IBSS.
40458d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
4046b9a5f8caSJouni Malinen  *
4047f4e583c8SAntonio Quartulli  * @set_mcast_rate: Set the specified multicast rate (only if vif is in ADHOC or
4048f4e583c8SAntonio Quartulli  *	MESH mode)
4049f4e583c8SAntonio Quartulli  *
4050b9a5f8caSJouni Malinen  * @set_wiphy_params: Notify that wiphy parameters have changed;
4051b9a5f8caSJouni Malinen  *	@changed bitfield (see &enum wiphy_params_flags) describes which values
4052b9a5f8caSJouni Malinen  *	have changed. The actual parameter values are available in
4053b9a5f8caSJouni Malinen  *	struct wiphy. If returning an error, no value should be changed.
40547643a2c3SJohannes Berg  *
40551432de07SLuis R. Rodriguez  * @set_tx_power: set the transmit power according to the parameters,
4056c8442118SJohannes Berg  *	the power passed is in mBm, to get dBm use MBM_TO_DBM(). The
4057c8442118SJohannes Berg  *	wdev may be %NULL if power was set for the wiphy, and will
4058c8442118SJohannes Berg  *	always be %NULL unless the driver supports per-vif TX power
4059c8442118SJohannes Berg  *	(as advertised by the nl80211 feature flag.)
40607643a2c3SJohannes Berg  * @get_tx_power: store the current TX power into the dbm variable;
40611f87f7d3SJohannes Berg  *	return 0 if successful
40621f87f7d3SJohannes Berg  *
40631f87f7d3SJohannes Berg  * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting
40641f87f7d3SJohannes Berg  *	functions to adjust rfkill hw state
4065aff89a9bSJohannes Berg  *
406661fa713cSHolger Schurig  * @dump_survey: get site survey information.
406761fa713cSHolger Schurig  *
40689588bbd5SJouni Malinen  * @remain_on_channel: Request the driver to remain awake on the specified
40699588bbd5SJouni Malinen  *	channel for the specified duration to complete an off-channel
40709588bbd5SJouni Malinen  *	operation (e.g., public action frame exchange). When the driver is
40719588bbd5SJouni Malinen  *	ready on the requested channel, it must indicate this with an event
40729588bbd5SJouni Malinen  *	notification by calling cfg80211_ready_on_channel().
40739588bbd5SJouni Malinen  * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation.
40749588bbd5SJouni Malinen  *	This allows the operation to be terminated prior to timeout based on
40759588bbd5SJouni Malinen  *	the duration value.
4076f7ca38dfSJohannes Berg  * @mgmt_tx: Transmit a management frame.
4077f7ca38dfSJohannes Berg  * @mgmt_tx_cancel_wait: Cancel the wait time from transmitting a management
4078f7ca38dfSJohannes Berg  *	frame on another channel
40799588bbd5SJouni Malinen  *
4080fc73f11fSDavid Spinadel  * @testmode_cmd: run a test mode command; @wdev may be %NULL
408171063f0eSWey-Yi Guy  * @testmode_dump: Implement a test mode dump. The cb->args[2] and up may be
408271063f0eSWey-Yi Guy  *	used by the function, but 0 and 1 must not be touched. Additionally,
408371063f0eSWey-Yi Guy  *	return error codes other than -ENOBUFS and -ENOENT will terminate the
408471063f0eSWey-Yi Guy  *	dump and return to userspace with an error, so be careful. If any data
408571063f0eSWey-Yi Guy  *	was passed in from userspace then the data/len arguments will be present
408671063f0eSWey-Yi Guy  *	and point to the data contained in %NL80211_ATTR_TESTDATA.
408767fbb16bSSamuel Ortiz  *
4088abe37c4bSJohannes Berg  * @set_bitrate_mask: set the bitrate mask configuration
4089abe37c4bSJohannes Berg  *
409067fbb16bSSamuel Ortiz  * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac
409167fbb16bSSamuel Ortiz  *	devices running firmwares capable of generating the (re) association
409267fbb16bSSamuel Ortiz  *	RSN IE. It allows for faster roaming between WPA2 BSSIDs.
409367fbb16bSSamuel Ortiz  * @del_pmksa: Delete a cached PMKID.
409467fbb16bSSamuel Ortiz  * @flush_pmksa: Flush all cached PMKIDs.
40959043f3b8SJuuso Oikarinen  * @set_power_mgmt: Configure WLAN power management. A timeout value of -1
40969043f3b8SJuuso Oikarinen  *	allows the driver to adjust the dynamic ps timeout value.
4097d6dc1a38SJuuso Oikarinen  * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold.
4098e86abc68SJohannes Berg  *	After configuration, the driver should (soon) send an event indicating
4099e86abc68SJohannes Berg  *	the current level is above/below the configured threshold; this may
4100e86abc68SJohannes Berg  *	need some care when the configuration is changed (without first being
4101e86abc68SJohannes Berg  *	disabled.)
41024a4b8169SAndrew Zaborowski  * @set_cqm_rssi_range_config: Configure two RSSI thresholds in the
41034a4b8169SAndrew Zaborowski  *	connection quality monitor.  An event is to be sent only when the
41044a4b8169SAndrew Zaborowski  *	signal level is found to be outside the two values.  The driver should
41054a4b8169SAndrew Zaborowski  *	set %NL80211_EXT_FEATURE_CQM_RSSI_LIST if this method is implemented.
41064a4b8169SAndrew Zaborowski  *	If it is provided then there's no point providing @set_cqm_rssi_config.
410784f10708SThomas Pedersen  * @set_cqm_txe_config: Configure connection quality monitor TX error
410884f10708SThomas Pedersen  *	thresholds.
4109807f8a8cSLuciano Coelho  * @sched_scan_start: Tell the driver to start a scheduled scan.
41103a3ecf1dSArend Van Spriel  * @sched_scan_stop: Tell the driver to stop an ongoing scheduled scan with
41113a3ecf1dSArend Van Spriel  *	given request id. This call must stop the scheduled scan and be ready
41123a3ecf1dSArend Van Spriel  *	for starting a new one before it returns, i.e. @sched_scan_start may be
41133a3ecf1dSArend Van Spriel  *	called immediately after that again and should not fail in that case.
41143a3ecf1dSArend Van Spriel  *	The driver should not call cfg80211_sched_scan_stopped() for a requested
41153a3ecf1dSArend Van Spriel  *	stop (when this method returns 0).
411667fbb16bSSamuel Ortiz  *
41176cd536feSJohannes Berg  * @update_mgmt_frame_registrations: Notify the driver that management frame
41186cd536feSJohannes Berg  *	registrations were updated. The callback is allowed to sleep.
4119547025d5SBruno Randolf  *
4120547025d5SBruno Randolf  * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device.
4121547025d5SBruno Randolf  *	Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may
4122547025d5SBruno Randolf  *	reject TX/RX mask combinations they cannot support by returning -EINVAL
4123547025d5SBruno Randolf  *	(also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX).
4124547025d5SBruno Randolf  *
4125547025d5SBruno Randolf  * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant).
41263677713bSJohn W. Linville  *
4127109086ceSArik Nemtsov  * @tdls_mgmt: Transmit a TDLS management frame.
4128109086ceSArik Nemtsov  * @tdls_oper: Perform a high-level TDLS operation (e.g. TDLS link setup).
41297f6cf311SJohannes Berg  *
41307f6cf311SJohannes Berg  * @probe_client: probe an associated client, must return a cookie that it
41317f6cf311SJohannes Berg  *	later passes to cfg80211_probe_status().
41321d9d9213SSimon Wunderlich  *
41331d9d9213SSimon Wunderlich  * @set_noack_map: Set the NoAck Map for the TIDs.
4134d6199218SBen Greear  *
41355b7ccaf3SJohannes Berg  * @get_channel: Get the current operating channel for the virtual interface.
41365b7ccaf3SJohannes Berg  *	For monitor interfaces, it should return %NULL unless there's a single
41375b7ccaf3SJohannes Berg  *	current monitoring channel.
413898104fdeSJohannes Berg  *
413998104fdeSJohannes Berg  * @start_p2p_device: Start the given P2P device.
414098104fdeSJohannes Berg  * @stop_p2p_device: Stop the given P2P device.
414177765eafSVasanthakumar Thiagarajan  *
414277765eafSVasanthakumar Thiagarajan  * @set_mac_acl: Sets MAC address control list in AP and P2P GO mode.
414377765eafSVasanthakumar Thiagarajan  *	Parameters include ACL policy, an array of MAC address of stations
414477765eafSVasanthakumar Thiagarajan  *	and the number of MAC addresses. If there is already a list in driver
414577765eafSVasanthakumar Thiagarajan  *	this new list replaces the existing one. Driver has to clear its ACL
414677765eafSVasanthakumar Thiagarajan  *	when number of MAC addresses entries is passed as 0. Drivers which
414777765eafSVasanthakumar Thiagarajan  *	advertise the support for MAC based ACL have to implement this callback.
414804f39047SSimon Wunderlich  *
414904f39047SSimon Wunderlich  * @start_radar_detection: Start radar detection in the driver.
41508bf24293SJouni Malinen  *
415126ec17a1SOrr Mazor  * @end_cac: End running CAC, probably because a related CAC
415226ec17a1SOrr Mazor  *	was finished on another phy.
415326ec17a1SOrr Mazor  *
41548bf24293SJouni Malinen  * @update_ft_ies: Provide updated Fast BSS Transition information to the
41558bf24293SJouni Malinen  *	driver. If the SME is in the driver/firmware, this information can be
41568bf24293SJouni Malinen  *	used in building Authentication and Reassociation Request frames.
41575de17984SArend van Spriel  *
41585de17984SArend van Spriel  * @crit_proto_start: Indicates a critical protocol needs more link reliability
41595de17984SArend van Spriel  *	for a given duration (milliseconds). The protocol is provided so the
41605de17984SArend van Spriel  *	driver can take the most appropriate actions.
41615de17984SArend van Spriel  * @crit_proto_stop: Indicates critical protocol no longer needs increased link
41625de17984SArend van Spriel  *	reliability. This operation can not fail.
4163be29b99aSAmitkumar Karwar  * @set_coalesce: Set coalesce parameters.
416416ef1fe2SSimon Wunderlich  *
416597dc94f1SMichal Kazior  * @channel_switch: initiate channel-switch procedure (with CSA). Driver is
416697dc94f1SMichal Kazior  *	responsible for veryfing if the switch is possible. Since this is
416797dc94f1SMichal Kazior  *	inherently tricky driver may decide to disconnect an interface later
416897dc94f1SMichal Kazior  *	with cfg80211_stop_iface(). This doesn't mean driver can accept
416997dc94f1SMichal Kazior  *	everything. It should do it's best to verify requests and reject them
417097dc94f1SMichal Kazior  *	as soon as possible.
4171fa9ffc74SKyeyoon Park  *
4172fa9ffc74SKyeyoon Park  * @set_qos_map: Set QoS mapping information to the driver
4173e16821bcSJouni Malinen  *
4174e16821bcSJouni Malinen  * @set_ap_chanwidth: Set the AP (including P2P GO) mode channel width for the
4175e16821bcSJouni Malinen  *	given interface This is used e.g. for dynamic HT 20/40 MHz channel width
4176e16821bcSJouni Malinen  *	changes during the lifetime of the BSS.
4177960d01acSJohannes Berg  *
4178960d01acSJohannes Berg  * @add_tx_ts: validate (if admitted_time is 0) or add a TX TS to the device
4179960d01acSJohannes Berg  *	with the given parameters; action frame exchange has been handled by
4180960d01acSJohannes Berg  *	userspace so this just has to modify the TX path to take the TS into
4181960d01acSJohannes Berg  *	account.
4182960d01acSJohannes Berg  *	If the admitted time is 0 just validate the parameters to make sure
4183960d01acSJohannes Berg  *	the session can be created at all; it is valid to just always return
4184960d01acSJohannes Berg  *	success for that but that may result in inefficient behaviour (handshake
4185960d01acSJohannes Berg  *	with the peer followed by immediate teardown when the addition is later
4186960d01acSJohannes Berg  *	rejected)
4187960d01acSJohannes Berg  * @del_tx_ts: remove an existing TX TS
41886e0bd6c3SRostislav Lisovy  *
41896e0bd6c3SRostislav Lisovy  * @join_ocb: join the OCB network with the specified parameters
41906e0bd6c3SRostislav Lisovy  *	(invoked with the wireless_dev mutex held)
41916e0bd6c3SRostislav Lisovy  * @leave_ocb: leave the current OCB network
41926e0bd6c3SRostislav Lisovy  *	(invoked with the wireless_dev mutex held)
41931057d35eSArik Nemtsov  *
41941057d35eSArik Nemtsov  * @tdls_channel_switch: Start channel-switching with a TDLS peer. The driver
41951057d35eSArik Nemtsov  *	is responsible for continually initiating channel-switching operations
41961057d35eSArik Nemtsov  *	and returning to the base channel for communication with the AP.
41971057d35eSArik Nemtsov  * @tdls_cancel_channel_switch: Stop channel-switching with a TDLS peer. Both
41981057d35eSArik Nemtsov  *	peers must be on the base channel when the call completes.
4199cb3b7d87SAyala Beker  * @start_nan: Start the NAN interface.
4200cb3b7d87SAyala Beker  * @stop_nan: Stop the NAN interface.
4201a442b761SAyala Beker  * @add_nan_func: Add a NAN function. Returns negative value on failure.
4202a442b761SAyala Beker  *	On success @nan_func ownership is transferred to the driver and
4203a442b761SAyala Beker  *	it may access it outside of the scope of this function. The driver
4204a442b761SAyala Beker  *	should free the @nan_func when no longer needed by calling
4205a442b761SAyala Beker  *	cfg80211_free_nan_func().
4206a442b761SAyala Beker  *	On success the driver should assign an instance_id in the
4207a442b761SAyala Beker  *	provided @nan_func.
4208a442b761SAyala Beker  * @del_nan_func: Delete a NAN function.
4209a5a9dcf2SAyala Beker  * @nan_change_conf: changes NAN configuration. The changed parameters must
4210a5a9dcf2SAyala Beker  *	be specified in @changes (using &enum cfg80211_nan_conf_changes);
4211a5a9dcf2SAyala Beker  *	All other parameters must be ignored.
4212ce0ce13aSMichael Braun  *
4213ce0ce13aSMichael Braun  * @set_multicast_to_unicast: configure multicast to unicast conversion for BSS
42143a00df57SAvraham Stern  *
421552539ca8SToke Høiland-Jørgensen  * @get_txq_stats: Get TXQ stats for interface or phy. If wdev is %NULL, this
421652539ca8SToke Høiland-Jørgensen  *      function should return phy stats, and interface stats otherwise.
421752539ca8SToke Høiland-Jørgensen  *
42183a00df57SAvraham Stern  * @set_pmk: configure the PMK to be used for offloaded 802.1X 4-Way handshake.
42193a00df57SAvraham Stern  *	If not deleted through @del_pmk the PMK remains valid until disconnect
42203a00df57SAvraham Stern  *	upon which the driver should clear it.
42213a00df57SAvraham Stern  *	(invoked with the wireless_dev mutex held)
42223a00df57SAvraham Stern  * @del_pmk: delete the previously configured PMK for the given authenticator.
42233a00df57SAvraham Stern  *	(invoked with the wireless_dev mutex held)
422440cbfa90SSrinivas Dasari  *
422540cbfa90SSrinivas Dasari  * @external_auth: indicates result of offloaded authentication processing from
422640cbfa90SSrinivas Dasari  *     user space
42272576a9acSDenis Kenzior  *
42282576a9acSDenis Kenzior  * @tx_control_port: TX a control port frame (EAPoL).  The noencrypt parameter
42292576a9acSDenis Kenzior  *	tells the driver that the frame should not be encrypted.
423081e54d08SPradeep Kumar Chitrapu  *
423181e54d08SPradeep Kumar Chitrapu  * @get_ftm_responder_stats: Retrieve FTM responder statistics, if available.
423281e54d08SPradeep Kumar Chitrapu  *	Statistics should be cumulative, currently no way to reset is provided.
42339bb7e0f2SJohannes Berg  * @start_pmsr: start peer measurement (e.g. FTM)
42349bb7e0f2SJohannes Berg  * @abort_pmsr: abort peer measurement
4235cb74e977SSunil Dutt  *
4236cb74e977SSunil Dutt  * @update_owe_info: Provide updated OWE info to driver. Driver implementing SME
4237cb74e977SSunil Dutt  *	but offloading OWE processing to the user space will get the updated
4238cb74e977SSunil Dutt  *	DH IE through this interface.
42395ab92e7fSRajkumar Manoharan  *
42405ab92e7fSRajkumar Manoharan  * @probe_mesh_link: Probe direct Mesh peer's link quality by sending data frame
42415ab92e7fSRajkumar Manoharan  *	and overrule HWMP path selection algorithm.
424277f576deSTamizh chelvam  * @set_tid_config: TID specific configuration, this can be peer or BSS specific
424377f576deSTamizh chelvam  *	This callback may sleep.
42443710a8a6SJohannes Berg  * @reset_tid_config: Reset TID specific configuration for the peer, for the
42453710a8a6SJohannes Berg  *	given TIDs. This callback may sleep.
424670b6ff35SJohannes Berg  *
424770b6ff35SJohannes Berg  * @set_sar_specs: Update the SAR (TX power) settings.
42480d2ab3aeSJohn Crispin  *
42490d2ab3aeSJohn Crispin  * @color_change: Initiate a color change.
4250e306784aSSubrat Mishra  *
4251e306784aSSubrat Mishra  * @set_fils_aad: Set FILS AAD data to the AP driver so that the driver can use
4252e306784aSSubrat Mishra  *	those to decrypt (Re)Association Request and encrypt (Re)Association
4253e306784aSSubrat Mishra  *	Response frame.
4254bc2dfc02SLorenzo Bianconi  *
4255a95bfb87SLorenzo Bianconi  * @set_radar_background: Configure dedicated offchannel chain available for
4256bc2dfc02SLorenzo Bianconi  *	radar/CAC detection on some hw. This chain can't be used to transmit
4257bc2dfc02SLorenzo Bianconi  *	or receive frames and it is bounded to a running wdev.
4258a95bfb87SLorenzo Bianconi  *	Background radar/CAC detection allows to avoid the CAC downtime
4259bc2dfc02SLorenzo Bianconi  *	switching to a different channel during CAC detection on the selected
4260bc2dfc02SLorenzo Bianconi  *	radar channel.
4261bc2dfc02SLorenzo Bianconi  *	The caller is expected to set chandef pointer to NULL in order to
4262a95bfb87SLorenzo Bianconi  *	disable background CAC/radar detection.
4263577e5b8cSShaul Triebitz  * @add_link_station: Add a link to a station.
4264577e5b8cSShaul Triebitz  * @mod_link_station: Modify a link of a station.
4265577e5b8cSShaul Triebitz  * @del_link_station: Remove a link of a station.
4266704232c2SJohannes Berg  */
4267704232c2SJohannes Berg struct cfg80211_ops {
4268ff1b6e69SJohannes Berg 	int	(*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
42690378b3f1SJohannes Berg 	int	(*resume)(struct wiphy *wiphy);
42706d52563fSJohannes Berg 	void	(*set_wakeup)(struct wiphy *wiphy, bool enabled);
42710378b3f1SJohannes Berg 
427284efbb84SJohannes Berg 	struct wireless_dev * (*add_virtual_intf)(struct wiphy *wiphy,
4273552bff0cSJohannes Berg 						  const char *name,
42746bab2e19STom Gundersen 						  unsigned char name_assign_type,
4275f9e10ce4SJohannes Berg 						  enum nl80211_iftype type,
42762ec600d6SLuis Carlos Cobo 						  struct vif_params *params);
427784efbb84SJohannes Berg 	int	(*del_virtual_intf)(struct wiphy *wiphy,
427884efbb84SJohannes Berg 				    struct wireless_dev *wdev);
4279e36d56b6SJohannes Berg 	int	(*change_virtual_intf)(struct wiphy *wiphy,
4280e36d56b6SJohannes Berg 				       struct net_device *dev,
4281818a986eSJohannes Berg 				       enum nl80211_iftype type,
42822ec600d6SLuis Carlos Cobo 				       struct vif_params *params);
428341ade00fSJohannes Berg 
4284f2a0290bSJohannes Berg 	int	(*add_intf_link)(struct wiphy *wiphy,
4285f2a0290bSJohannes Berg 				 struct wireless_dev *wdev,
4286f2a0290bSJohannes Berg 				 unsigned int link_id);
4287f2a0290bSJohannes Berg 	void	(*del_intf_link)(struct wiphy *wiphy,
4288f2a0290bSJohannes Berg 				 struct wireless_dev *wdev,
4289f2a0290bSJohannes Berg 				 unsigned int link_id);
4290f2a0290bSJohannes Berg 
429141ade00fSJohannes Berg 	int	(*add_key)(struct wiphy *wiphy, struct net_device *netdev,
4292e31b8213SJohannes Berg 			   u8 key_index, bool pairwise, const u8 *mac_addr,
429341ade00fSJohannes Berg 			   struct key_params *params);
429441ade00fSJohannes Berg 	int	(*get_key)(struct wiphy *wiphy, struct net_device *netdev,
4295e31b8213SJohannes Berg 			   u8 key_index, bool pairwise, const u8 *mac_addr,
4296e31b8213SJohannes Berg 			   void *cookie,
429741ade00fSJohannes Berg 			   void (*callback)(void *cookie, struct key_params*));
429841ade00fSJohannes Berg 	int	(*del_key)(struct wiphy *wiphy, struct net_device *netdev,
4299e31b8213SJohannes Berg 			   u8 key_index, bool pairwise, const u8 *mac_addr);
430041ade00fSJohannes Berg 	int	(*set_default_key)(struct wiphy *wiphy,
430141ade00fSJohannes Berg 				   struct net_device *netdev,
4302dbd2fd65SJohannes Berg 				   u8 key_index, bool unicast, bool multicast);
43033cfcf6acSJouni Malinen 	int	(*set_default_mgmt_key)(struct wiphy *wiphy,
43043cfcf6acSJouni Malinen 					struct net_device *netdev,
43053cfcf6acSJouni Malinen 					u8 key_index);
430656be393fSJouni Malinen 	int	(*set_default_beacon_key)(struct wiphy *wiphy,
430756be393fSJouni Malinen 					  struct net_device *netdev,
430856be393fSJouni Malinen 					  u8 key_index);
4309ed1b6cc7SJohannes Berg 
43108860020eSJohannes Berg 	int	(*start_ap)(struct wiphy *wiphy, struct net_device *dev,
43118860020eSJohannes Berg 			    struct cfg80211_ap_settings *settings);
43128860020eSJohannes Berg 	int	(*change_beacon)(struct wiphy *wiphy, struct net_device *dev,
43138860020eSJohannes Berg 				 struct cfg80211_beacon_data *info);
43147b0a0e3cSJohannes Berg 	int	(*stop_ap)(struct wiphy *wiphy, struct net_device *dev,
43157b0a0e3cSJohannes Berg 			   unsigned int link_id);
43165727ef1bSJohannes Berg 
43175727ef1bSJohannes Berg 
43185727ef1bSJohannes Berg 	int	(*add_station)(struct wiphy *wiphy, struct net_device *dev,
43193b3a0162SJohannes Berg 			       const u8 *mac,
43203b3a0162SJohannes Berg 			       struct station_parameters *params);
43215727ef1bSJohannes Berg 	int	(*del_station)(struct wiphy *wiphy, struct net_device *dev,
432289c771e5SJouni Malinen 			       struct station_del_parameters *params);
43235727ef1bSJohannes Berg 	int	(*change_station)(struct wiphy *wiphy, struct net_device *dev,
43243b3a0162SJohannes Berg 				  const u8 *mac,
43253b3a0162SJohannes Berg 				  struct station_parameters *params);
4326fd5b74dcSJohannes Berg 	int	(*get_station)(struct wiphy *wiphy, struct net_device *dev,
43273b3a0162SJohannes Berg 			       const u8 *mac, struct station_info *sinfo);
43282ec600d6SLuis Carlos Cobo 	int	(*dump_station)(struct wiphy *wiphy, struct net_device *dev,
43292ec600d6SLuis Carlos Cobo 				int idx, u8 *mac, struct station_info *sinfo);
43302ec600d6SLuis Carlos Cobo 
43312ec600d6SLuis Carlos Cobo 	int	(*add_mpath)(struct wiphy *wiphy, struct net_device *dev,
43323b3a0162SJohannes Berg 			       const u8 *dst, const u8 *next_hop);
43332ec600d6SLuis Carlos Cobo 	int	(*del_mpath)(struct wiphy *wiphy, struct net_device *dev,
43343b3a0162SJohannes Berg 			       const u8 *dst);
43352ec600d6SLuis Carlos Cobo 	int	(*change_mpath)(struct wiphy *wiphy, struct net_device *dev,
43363b3a0162SJohannes Berg 				  const u8 *dst, const u8 *next_hop);
43372ec600d6SLuis Carlos Cobo 	int	(*get_mpath)(struct wiphy *wiphy, struct net_device *dev,
43383b3a0162SJohannes Berg 			     u8 *dst, u8 *next_hop, struct mpath_info *pinfo);
43392ec600d6SLuis Carlos Cobo 	int	(*dump_mpath)(struct wiphy *wiphy, struct net_device *dev,
43402ec600d6SLuis Carlos Cobo 			      int idx, u8 *dst, u8 *next_hop,
43412ec600d6SLuis Carlos Cobo 			      struct mpath_info *pinfo);
434266be7d2bSHenning Rogge 	int	(*get_mpp)(struct wiphy *wiphy, struct net_device *dev,
434366be7d2bSHenning Rogge 			   u8 *dst, u8 *mpp, struct mpath_info *pinfo);
434466be7d2bSHenning Rogge 	int	(*dump_mpp)(struct wiphy *wiphy, struct net_device *dev,
434566be7d2bSHenning Rogge 			    int idx, u8 *dst, u8 *mpp,
434666be7d2bSHenning Rogge 			    struct mpath_info *pinfo);
434724bdd9f4SJavier Cardona 	int	(*get_mesh_config)(struct wiphy *wiphy,
434893da9cc1Scolin@cozybit.com 				struct net_device *dev,
434993da9cc1Scolin@cozybit.com 				struct mesh_config *conf);
435024bdd9f4SJavier Cardona 	int	(*update_mesh_config)(struct wiphy *wiphy,
435129cbe68cSJohannes Berg 				      struct net_device *dev, u32 mask,
435229cbe68cSJohannes Berg 				      const struct mesh_config *nconf);
435329cbe68cSJohannes Berg 	int	(*join_mesh)(struct wiphy *wiphy, struct net_device *dev,
435429cbe68cSJohannes Berg 			     const struct mesh_config *conf,
435529cbe68cSJohannes Berg 			     const struct mesh_setup *setup);
435629cbe68cSJohannes Berg 	int	(*leave_mesh)(struct wiphy *wiphy, struct net_device *dev);
435729cbe68cSJohannes Berg 
43586e0bd6c3SRostislav Lisovy 	int	(*join_ocb)(struct wiphy *wiphy, struct net_device *dev,
43596e0bd6c3SRostislav Lisovy 			    struct ocb_setup *setup);
43606e0bd6c3SRostislav Lisovy 	int	(*leave_ocb)(struct wiphy *wiphy, struct net_device *dev);
43616e0bd6c3SRostislav Lisovy 
43629f1ba906SJouni Malinen 	int	(*change_bss)(struct wiphy *wiphy, struct net_device *dev,
43639f1ba906SJouni Malinen 			      struct bss_parameters *params);
436431888487SJouni Malinen 
4365f70f01c2SEliad Peller 	int	(*set_txq_params)(struct wiphy *wiphy, struct net_device *dev,
436631888487SJouni Malinen 				  struct ieee80211_txq_params *params);
436772bdcf34SJouni Malinen 
4368e8c9bd5bSJohannes Berg 	int	(*libertas_set_mesh_channel)(struct wiphy *wiphy,
4369e8c9bd5bSJohannes Berg 					     struct net_device *dev,
4370e8c9bd5bSJohannes Berg 					     struct ieee80211_channel *chan);
4371e8c9bd5bSJohannes Berg 
4372e8c9bd5bSJohannes Berg 	int	(*set_monitor_channel)(struct wiphy *wiphy,
4373683b6d3bSJohannes Berg 				       struct cfg80211_chan_def *chandef);
43749aed3cc1SJouni Malinen 
4375fd014284SJohannes Berg 	int	(*scan)(struct wiphy *wiphy,
43762a519311SJohannes Berg 			struct cfg80211_scan_request *request);
437791d3ab46SVidyullatha Kanchanapally 	void	(*abort_scan)(struct wiphy *wiphy, struct wireless_dev *wdev);
4378636a5d36SJouni Malinen 
4379636a5d36SJouni Malinen 	int	(*auth)(struct wiphy *wiphy, struct net_device *dev,
4380636a5d36SJouni Malinen 			struct cfg80211_auth_request *req);
4381636a5d36SJouni Malinen 	int	(*assoc)(struct wiphy *wiphy, struct net_device *dev,
4382636a5d36SJouni Malinen 			 struct cfg80211_assoc_request *req);
4383636a5d36SJouni Malinen 	int	(*deauth)(struct wiphy *wiphy, struct net_device *dev,
438463c9c5e7SJohannes Berg 			  struct cfg80211_deauth_request *req);
4385636a5d36SJouni Malinen 	int	(*disassoc)(struct wiphy *wiphy, struct net_device *dev,
438663c9c5e7SJohannes Berg 			    struct cfg80211_disassoc_request *req);
438704a773adSJohannes Berg 
4388b23aa676SSamuel Ortiz 	int	(*connect)(struct wiphy *wiphy, struct net_device *dev,
4389b23aa676SSamuel Ortiz 			   struct cfg80211_connect_params *sme);
4390088e8df8Svamsi krishna 	int	(*update_connect_params)(struct wiphy *wiphy,
4391088e8df8Svamsi krishna 					 struct net_device *dev,
4392088e8df8Svamsi krishna 					 struct cfg80211_connect_params *sme,
4393088e8df8Svamsi krishna 					 u32 changed);
4394b23aa676SSamuel Ortiz 	int	(*disconnect)(struct wiphy *wiphy, struct net_device *dev,
4395b23aa676SSamuel Ortiz 			      u16 reason_code);
4396b23aa676SSamuel Ortiz 
439704a773adSJohannes Berg 	int	(*join_ibss)(struct wiphy *wiphy, struct net_device *dev,
439804a773adSJohannes Berg 			     struct cfg80211_ibss_params *params);
439904a773adSJohannes Berg 	int	(*leave_ibss)(struct wiphy *wiphy, struct net_device *dev);
4400b9a5f8caSJouni Malinen 
4401f4e583c8SAntonio Quartulli 	int	(*set_mcast_rate)(struct wiphy *wiphy, struct net_device *dev,
440257fbcce3SJohannes Berg 				  int rate[NUM_NL80211_BANDS]);
4403f4e583c8SAntonio Quartulli 
4404b9a5f8caSJouni Malinen 	int	(*set_wiphy_params)(struct wiphy *wiphy, u32 changed);
44057643a2c3SJohannes Berg 
4406c8442118SJohannes Berg 	int	(*set_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
4407fa61cf70SJuuso Oikarinen 				enum nl80211_tx_power_setting type, int mbm);
4408c8442118SJohannes Berg 	int	(*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
4409c8442118SJohannes Berg 				int *dbm);
44101f87f7d3SJohannes Berg 
44111f87f7d3SJohannes Berg 	void	(*rfkill_poll)(struct wiphy *wiphy);
4412aff89a9bSJohannes Berg 
4413aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE
4414fc73f11fSDavid Spinadel 	int	(*testmode_cmd)(struct wiphy *wiphy, struct wireless_dev *wdev,
4415fc73f11fSDavid Spinadel 				void *data, int len);
441671063f0eSWey-Yi Guy 	int	(*testmode_dump)(struct wiphy *wiphy, struct sk_buff *skb,
441771063f0eSWey-Yi Guy 				 struct netlink_callback *cb,
441871063f0eSWey-Yi Guy 				 void *data, int len);
4419aff89a9bSJohannes Berg #endif
4420bc92afd9SJohannes Berg 
44219930380fSJohannes Berg 	int	(*set_bitrate_mask)(struct wiphy *wiphy,
44229930380fSJohannes Berg 				    struct net_device *dev,
44237b0a0e3cSJohannes Berg 				    unsigned int link_id,
44249930380fSJohannes Berg 				    const u8 *peer,
44259930380fSJohannes Berg 				    const struct cfg80211_bitrate_mask *mask);
44269930380fSJohannes Berg 
442761fa713cSHolger Schurig 	int	(*dump_survey)(struct wiphy *wiphy, struct net_device *netdev,
442861fa713cSHolger Schurig 			int idx, struct survey_info *info);
442961fa713cSHolger Schurig 
443067fbb16bSSamuel Ortiz 	int	(*set_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
443167fbb16bSSamuel Ortiz 			     struct cfg80211_pmksa *pmksa);
443267fbb16bSSamuel Ortiz 	int	(*del_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
443367fbb16bSSamuel Ortiz 			     struct cfg80211_pmksa *pmksa);
443467fbb16bSSamuel Ortiz 	int	(*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev);
443567fbb16bSSamuel Ortiz 
44369588bbd5SJouni Malinen 	int	(*remain_on_channel)(struct wiphy *wiphy,
443771bbc994SJohannes Berg 				     struct wireless_dev *wdev,
44389588bbd5SJouni Malinen 				     struct ieee80211_channel *chan,
44399588bbd5SJouni Malinen 				     unsigned int duration,
44409588bbd5SJouni Malinen 				     u64 *cookie);
44419588bbd5SJouni Malinen 	int	(*cancel_remain_on_channel)(struct wiphy *wiphy,
444271bbc994SJohannes Berg 					    struct wireless_dev *wdev,
44439588bbd5SJouni Malinen 					    u64 cookie);
44449588bbd5SJouni Malinen 
444571bbc994SJohannes Berg 	int	(*mgmt_tx)(struct wiphy *wiphy, struct wireless_dev *wdev,
4446b176e629SAndrei Otcheretianski 			   struct cfg80211_mgmt_tx_params *params,
4447b176e629SAndrei Otcheretianski 			   u64 *cookie);
4448f7ca38dfSJohannes Berg 	int	(*mgmt_tx_cancel_wait)(struct wiphy *wiphy,
444971bbc994SJohannes Berg 				       struct wireless_dev *wdev,
4450f7ca38dfSJohannes Berg 				       u64 cookie);
4451026331c4SJouni Malinen 
4452bc92afd9SJohannes Berg 	int	(*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev,
4453bc92afd9SJohannes Berg 				  bool enabled, int timeout);
4454d6dc1a38SJuuso Oikarinen 
4455d6dc1a38SJuuso Oikarinen 	int	(*set_cqm_rssi_config)(struct wiphy *wiphy,
4456d6dc1a38SJuuso Oikarinen 				       struct net_device *dev,
4457d6dc1a38SJuuso Oikarinen 				       s32 rssi_thold, u32 rssi_hyst);
4458271733cfSJohannes Berg 
44594a4b8169SAndrew Zaborowski 	int	(*set_cqm_rssi_range_config)(struct wiphy *wiphy,
44604a4b8169SAndrew Zaborowski 					     struct net_device *dev,
44614a4b8169SAndrew Zaborowski 					     s32 rssi_low, s32 rssi_high);
44624a4b8169SAndrew Zaborowski 
446384f10708SThomas Pedersen 	int	(*set_cqm_txe_config)(struct wiphy *wiphy,
446484f10708SThomas Pedersen 				      struct net_device *dev,
446584f10708SThomas Pedersen 				      u32 rate, u32 pkts, u32 intvl);
446684f10708SThomas Pedersen 
44676cd536feSJohannes Berg 	void	(*update_mgmt_frame_registrations)(struct wiphy *wiphy,
446871bbc994SJohannes Berg 						   struct wireless_dev *wdev,
44696cd536feSJohannes Berg 						   struct mgmt_frame_regs *upd);
4470afe0cbf8SBruno Randolf 
4471afe0cbf8SBruno Randolf 	int	(*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant);
4472afe0cbf8SBruno Randolf 	int	(*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant);
44733677713bSJohn W. Linville 
4474807f8a8cSLuciano Coelho 	int	(*sched_scan_start)(struct wiphy *wiphy,
4475807f8a8cSLuciano Coelho 				struct net_device *dev,
4476807f8a8cSLuciano Coelho 				struct cfg80211_sched_scan_request *request);
44773a3ecf1dSArend Van Spriel 	int	(*sched_scan_stop)(struct wiphy *wiphy, struct net_device *dev,
44783a3ecf1dSArend Van Spriel 				   u64 reqid);
4479e5497d76SJohannes Berg 
4480e5497d76SJohannes Berg 	int	(*set_rekey_data)(struct wiphy *wiphy, struct net_device *dev,
4481e5497d76SJohannes Berg 				  struct cfg80211_gtk_rekey_data *data);
4482109086ceSArik Nemtsov 
4483109086ceSArik Nemtsov 	int	(*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev,
44843b3a0162SJohannes Berg 			     const u8 *peer, u8 action_code,  u8 dialog_token,
4485df942e7bSSunil Dutt Undekari 			     u16 status_code, u32 peer_capability,
448631fa97c5SArik Nemtsov 			     bool initiator, const u8 *buf, size_t len);
4487109086ceSArik Nemtsov 	int	(*tdls_oper)(struct wiphy *wiphy, struct net_device *dev,
44883b3a0162SJohannes Berg 			     const u8 *peer, enum nl80211_tdls_operation oper);
44897f6cf311SJohannes Berg 
44907f6cf311SJohannes Berg 	int	(*probe_client)(struct wiphy *wiphy, struct net_device *dev,
44917f6cf311SJohannes Berg 				const u8 *peer, u64 *cookie);
4492e999882aSJohannes Berg 
44931d9d9213SSimon Wunderlich 	int	(*set_noack_map)(struct wiphy *wiphy,
44941d9d9213SSimon Wunderlich 				  struct net_device *dev,
44951d9d9213SSimon Wunderlich 				  u16 noack_map);
44961d9d9213SSimon Wunderlich 
4497683b6d3bSJohannes Berg 	int	(*get_channel)(struct wiphy *wiphy,
44985b7ccaf3SJohannes Berg 			       struct wireless_dev *wdev,
44997b0a0e3cSJohannes Berg 			       unsigned int link_id,
4500683b6d3bSJohannes Berg 			       struct cfg80211_chan_def *chandef);
450198104fdeSJohannes Berg 
450298104fdeSJohannes Berg 	int	(*start_p2p_device)(struct wiphy *wiphy,
450398104fdeSJohannes Berg 				    struct wireless_dev *wdev);
450498104fdeSJohannes Berg 	void	(*stop_p2p_device)(struct wiphy *wiphy,
450598104fdeSJohannes Berg 				   struct wireless_dev *wdev);
450677765eafSVasanthakumar Thiagarajan 
450777765eafSVasanthakumar Thiagarajan 	int	(*set_mac_acl)(struct wiphy *wiphy, struct net_device *dev,
450877765eafSVasanthakumar Thiagarajan 			       const struct cfg80211_acl_data *params);
450904f39047SSimon Wunderlich 
451004f39047SSimon Wunderlich 	int	(*start_radar_detection)(struct wiphy *wiphy,
451104f39047SSimon Wunderlich 					 struct net_device *dev,
451231559f35SJanusz Dziedzic 					 struct cfg80211_chan_def *chandef,
451331559f35SJanusz Dziedzic 					 u32 cac_time_ms);
451426ec17a1SOrr Mazor 	void	(*end_cac)(struct wiphy *wiphy,
451526ec17a1SOrr Mazor 				struct net_device *dev);
4516355199e0SJouni Malinen 	int	(*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev,
4517355199e0SJouni Malinen 				 struct cfg80211_update_ft_ies_params *ftie);
45185de17984SArend van Spriel 	int	(*crit_proto_start)(struct wiphy *wiphy,
45195de17984SArend van Spriel 				    struct wireless_dev *wdev,
45205de17984SArend van Spriel 				    enum nl80211_crit_proto_id protocol,
45215de17984SArend van Spriel 				    u16 duration);
45225de17984SArend van Spriel 	void	(*crit_proto_stop)(struct wiphy *wiphy,
45235de17984SArend van Spriel 				   struct wireless_dev *wdev);
4524be29b99aSAmitkumar Karwar 	int	(*set_coalesce)(struct wiphy *wiphy,
4525be29b99aSAmitkumar Karwar 				struct cfg80211_coalesce *coalesce);
452616ef1fe2SSimon Wunderlich 
452716ef1fe2SSimon Wunderlich 	int	(*channel_switch)(struct wiphy *wiphy,
452816ef1fe2SSimon Wunderlich 				  struct net_device *dev,
452916ef1fe2SSimon Wunderlich 				  struct cfg80211_csa_settings *params);
4530e16821bcSJouni Malinen 
4531fa9ffc74SKyeyoon Park 	int     (*set_qos_map)(struct wiphy *wiphy,
4532fa9ffc74SKyeyoon Park 			       struct net_device *dev,
4533fa9ffc74SKyeyoon Park 			       struct cfg80211_qos_map *qos_map);
4534e16821bcSJouni Malinen 
4535e16821bcSJouni Malinen 	int	(*set_ap_chanwidth)(struct wiphy *wiphy, struct net_device *dev,
45367b0a0e3cSJohannes Berg 				    unsigned int link_id,
4537e16821bcSJouni Malinen 				    struct cfg80211_chan_def *chandef);
4538960d01acSJohannes Berg 
4539960d01acSJohannes Berg 	int	(*add_tx_ts)(struct wiphy *wiphy, struct net_device *dev,
4540960d01acSJohannes Berg 			     u8 tsid, const u8 *peer, u8 user_prio,
4541960d01acSJohannes Berg 			     u16 admitted_time);
4542960d01acSJohannes Berg 	int	(*del_tx_ts)(struct wiphy *wiphy, struct net_device *dev,
4543960d01acSJohannes Berg 			     u8 tsid, const u8 *peer);
45441057d35eSArik Nemtsov 
45451057d35eSArik Nemtsov 	int	(*tdls_channel_switch)(struct wiphy *wiphy,
45461057d35eSArik Nemtsov 				       struct net_device *dev,
45471057d35eSArik Nemtsov 				       const u8 *addr, u8 oper_class,
45481057d35eSArik Nemtsov 				       struct cfg80211_chan_def *chandef);
45491057d35eSArik Nemtsov 	void	(*tdls_cancel_channel_switch)(struct wiphy *wiphy,
45501057d35eSArik Nemtsov 					      struct net_device *dev,
45511057d35eSArik Nemtsov 					      const u8 *addr);
4552cb3b7d87SAyala Beker 	int	(*start_nan)(struct wiphy *wiphy, struct wireless_dev *wdev,
4553cb3b7d87SAyala Beker 			     struct cfg80211_nan_conf *conf);
4554cb3b7d87SAyala Beker 	void	(*stop_nan)(struct wiphy *wiphy, struct wireless_dev *wdev);
4555a442b761SAyala Beker 	int	(*add_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev,
4556a442b761SAyala Beker 				struct cfg80211_nan_func *nan_func);
4557a442b761SAyala Beker 	void	(*del_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev,
4558a442b761SAyala Beker 			       u64 cookie);
4559a5a9dcf2SAyala Beker 	int	(*nan_change_conf)(struct wiphy *wiphy,
4560a5a9dcf2SAyala Beker 				   struct wireless_dev *wdev,
4561a5a9dcf2SAyala Beker 				   struct cfg80211_nan_conf *conf,
4562a5a9dcf2SAyala Beker 				   u32 changes);
4563ce0ce13aSMichael Braun 
4564ce0ce13aSMichael Braun 	int	(*set_multicast_to_unicast)(struct wiphy *wiphy,
4565ce0ce13aSMichael Braun 					    struct net_device *dev,
4566ce0ce13aSMichael Braun 					    const bool enabled);
45673a00df57SAvraham Stern 
456852539ca8SToke Høiland-Jørgensen 	int	(*get_txq_stats)(struct wiphy *wiphy,
456952539ca8SToke Høiland-Jørgensen 				 struct wireless_dev *wdev,
457052539ca8SToke Høiland-Jørgensen 				 struct cfg80211_txq_stats *txqstats);
457152539ca8SToke Høiland-Jørgensen 
45723a00df57SAvraham Stern 	int	(*set_pmk)(struct wiphy *wiphy, struct net_device *dev,
45733a00df57SAvraham Stern 			   const struct cfg80211_pmk_conf *conf);
45743a00df57SAvraham Stern 	int	(*del_pmk)(struct wiphy *wiphy, struct net_device *dev,
45753a00df57SAvraham Stern 			   const u8 *aa);
457640cbfa90SSrinivas Dasari 	int     (*external_auth)(struct wiphy *wiphy, struct net_device *dev,
457740cbfa90SSrinivas Dasari 				 struct cfg80211_external_auth_params *params);
45782576a9acSDenis Kenzior 
45792576a9acSDenis Kenzior 	int	(*tx_control_port)(struct wiphy *wiphy,
45802576a9acSDenis Kenzior 				   struct net_device *dev,
45812576a9acSDenis Kenzior 				   const u8 *buf, size_t len,
45828d74a623SJohannes Berg 				   const u8 *dest, const __be16 proto,
458367207babSAndrei Otcheretianski 				   const bool noencrypt, int link_id,
4584dca9ca2dSMarkus Theil 				   u64 *cookie);
458581e54d08SPradeep Kumar Chitrapu 
458681e54d08SPradeep Kumar Chitrapu 	int	(*get_ftm_responder_stats)(struct wiphy *wiphy,
458781e54d08SPradeep Kumar Chitrapu 				struct net_device *dev,
458881e54d08SPradeep Kumar Chitrapu 				struct cfg80211_ftm_responder_stats *ftm_stats);
45899bb7e0f2SJohannes Berg 
45909bb7e0f2SJohannes Berg 	int	(*start_pmsr)(struct wiphy *wiphy, struct wireless_dev *wdev,
45919bb7e0f2SJohannes Berg 			      struct cfg80211_pmsr_request *request);
45929bb7e0f2SJohannes Berg 	void	(*abort_pmsr)(struct wiphy *wiphy, struct wireless_dev *wdev,
45939bb7e0f2SJohannes Berg 			      struct cfg80211_pmsr_request *request);
4594cb74e977SSunil Dutt 	int	(*update_owe_info)(struct wiphy *wiphy, struct net_device *dev,
4595cb74e977SSunil Dutt 				   struct cfg80211_update_owe_info *owe_info);
45965ab92e7fSRajkumar Manoharan 	int	(*probe_mesh_link)(struct wiphy *wiphy, struct net_device *dev,
45975ab92e7fSRajkumar Manoharan 				   const u8 *buf, size_t len);
459877f576deSTamizh chelvam 	int     (*set_tid_config)(struct wiphy *wiphy, struct net_device *dev,
45993710a8a6SJohannes Berg 				  struct cfg80211_tid_config *tid_conf);
460077f576deSTamizh chelvam 	int	(*reset_tid_config)(struct wiphy *wiphy, struct net_device *dev,
46013710a8a6SJohannes Berg 				    const u8 *peer, u8 tids);
46026bdb68ceSCarl Huang 	int	(*set_sar_specs)(struct wiphy *wiphy,
46036bdb68ceSCarl Huang 				 struct cfg80211_sar_specs *sar);
46040d2ab3aeSJohn Crispin 	int	(*color_change)(struct wiphy *wiphy,
46050d2ab3aeSJohn Crispin 				struct net_device *dev,
46060d2ab3aeSJohn Crispin 				struct cfg80211_color_change_settings *params);
4607e306784aSSubrat Mishra 	int     (*set_fils_aad)(struct wiphy *wiphy, struct net_device *dev,
4608e306784aSSubrat Mishra 				struct cfg80211_fils_aad *fils_aad);
4609a95bfb87SLorenzo Bianconi 	int	(*set_radar_background)(struct wiphy *wiphy,
4610bc2dfc02SLorenzo Bianconi 					struct cfg80211_chan_def *chandef);
4611577e5b8cSShaul Triebitz 	int	(*add_link_station)(struct wiphy *wiphy, struct net_device *dev,
4612577e5b8cSShaul Triebitz 				    struct link_station_parameters *params);
4613577e5b8cSShaul Triebitz 	int	(*mod_link_station)(struct wiphy *wiphy, struct net_device *dev,
4614577e5b8cSShaul Triebitz 				    struct link_station_parameters *params);
4615577e5b8cSShaul Triebitz 	int	(*del_link_station)(struct wiphy *wiphy, struct net_device *dev,
4616577e5b8cSShaul Triebitz 				    struct link_station_del_parameters *params);
4617704232c2SJohannes Berg };
4618704232c2SJohannes Berg 
4619d3236553SJohannes Berg /*
4620d3236553SJohannes Berg  * wireless hardware and networking interfaces structures
4621d3236553SJohannes Berg  * and registration/helper functions
4622d3236553SJohannes Berg  */
4623d3236553SJohannes Berg 
4624d3236553SJohannes Berg /**
46255be83de5SJohannes Berg  * enum wiphy_flags - wiphy capability flags
46265be83de5SJohannes Berg  *
4627c8cb5b85STova Mussai  * @WIPHY_FLAG_SPLIT_SCAN_6GHZ: if set to true, the scan request will be split
4628c8cb5b85STova Mussai  *	 into two, first for legacy bands and second for UHB.
46295be83de5SJohannes Berg  * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this
46305be83de5SJohannes Berg  *	wiphy at all
46315be83de5SJohannes Berg  * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled
46325be83de5SJohannes Berg  *	by default -- this flag will be set depending on the kernel's default
46335be83de5SJohannes Berg  *	on wiphy_new(), but can be changed by the driver if it has a good
46345be83de5SJohannes Berg  *	reason to override the default
46359bc383deSJohannes Berg  * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station
463633d915d9SManikanta Pubbisetty  *	on a VLAN interface). This flag also serves an extra purpose of
463733d915d9SManikanta Pubbisetty  *	supporting 4ADDR AP mode on devices which do not support AP/VLAN iftype.
46389bc383deSJohannes Berg  * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station
4639c0692b8fSJohannes Berg  * @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the
4640c0692b8fSJohannes Berg  *	control port protocol ethertype. The device also honours the
4641c0692b8fSJohannes Berg  *	control_port_no_encrypt flag.
4642e31b8213SJohannes Berg  * @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN.
464315d5dda6SJavier Cardona  * @WIPHY_FLAG_MESH_AUTH: The device supports mesh authentication by routing
464415d5dda6SJavier Cardona  *	auth frames to userspace. See @NL80211_MESH_SETUP_USERSPACE_AUTH.
4645f4b34b55SVivek Natarajan  * @WIPHY_FLAG_SUPPORTS_FW_ROAM: The device supports roaming feature in the
4646f4b34b55SVivek Natarajan  *	firmware.
4647cedb5412SEliad Peller  * @WIPHY_FLAG_AP_UAPSD: The device supports uapsd on AP.
4648109086ceSArik Nemtsov  * @WIPHY_FLAG_SUPPORTS_TDLS: The device supports TDLS (802.11z) operation.
4649109086ceSArik Nemtsov  * @WIPHY_FLAG_TDLS_EXTERNAL_SETUP: The device does not handle TDLS (802.11z)
4650109086ceSArik Nemtsov  *	link setup/discovery operations internally. Setup, discovery and
4651109086ceSArik Nemtsov  *	teardown packets should be sent through the @NL80211_CMD_TDLS_MGMT
4652109086ceSArik Nemtsov  *	command. When this flag is not set, @NL80211_CMD_TDLS_OPER should be
4653109086ceSArik Nemtsov  *	used for asking the driver/firmware to perform a TDLS operation.
4654562a7480SJohannes Berg  * @WIPHY_FLAG_HAVE_AP_SME: device integrates AP SME
46555e760230SJohannes Berg  * @WIPHY_FLAG_REPORTS_OBSS: the device will report beacons from other BSSes
46565e760230SJohannes Berg  *	when there are virtual interfaces in AP mode by calling
46575e760230SJohannes Berg  *	cfg80211_report_obss_beacon().
465887bbbe22SArik Nemtsov  * @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD: When operating as an AP, the device
465987bbbe22SArik Nemtsov  *	responds to probe-requests in hardware.
46607c4ef712SJohannes Berg  * @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX.
46617c4ef712SJohannes Berg  * @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call.
46622f301ab2SSimon Wunderlich  * @WIPHY_FLAG_SUPPORTS_5_10_MHZ: Device supports 5 MHz and 10 MHz channels.
466316ef1fe2SSimon Wunderlich  * @WIPHY_FLAG_HAS_CHANNEL_SWITCH: Device supports channel switch in
466416ef1fe2SSimon Wunderlich  *	beaconing mode (AP, IBSS, Mesh, ...).
4665b8676221SDavid Spinadel  * @WIPHY_FLAG_HAS_STATIC_WEP: The device supports static WEP key installation
4666b8676221SDavid Spinadel  *	before connection.
4667093a48d2SNathan Errera  * @WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK: The device supports bigger kek and kck keys
46687b0a0e3cSJohannes Berg  * @WIPHY_FLAG_SUPPORTS_MLO: This is a temporary flag gating the MLO APIs,
46697b0a0e3cSJohannes Berg  *	in order to not have them reachable in normal drivers, until we have
46707b0a0e3cSJohannes Berg  *	complete feature/interface combinations/etc. advertisement. No driver
46717b0a0e3cSJohannes Berg  *	should set this flag for now.
46725be83de5SJohannes Berg  */
46735be83de5SJohannes Berg enum wiphy_flags {
4674093a48d2SNathan Errera 	WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK		= BIT(0),
46757b0a0e3cSJohannes Berg 	WIPHY_FLAG_SUPPORTS_MLO			= BIT(1),
4676c8cb5b85STova Mussai 	WIPHY_FLAG_SPLIT_SCAN_6GHZ		= BIT(2),
46775be83de5SJohannes Berg 	WIPHY_FLAG_NETNS_OK			= BIT(3),
46785be83de5SJohannes Berg 	WIPHY_FLAG_PS_ON_BY_DEFAULT		= BIT(4),
46799bc383deSJohannes Berg 	WIPHY_FLAG_4ADDR_AP			= BIT(5),
46809bc383deSJohannes Berg 	WIPHY_FLAG_4ADDR_STATION		= BIT(6),
4681c0692b8fSJohannes Berg 	WIPHY_FLAG_CONTROL_PORT_PROTOCOL	= BIT(7),
4682309075cfSJussi Kivilinna 	WIPHY_FLAG_IBSS_RSN			= BIT(8),
468315d5dda6SJavier Cardona 	WIPHY_FLAG_MESH_AUTH			= BIT(10),
4684ca986ad9SArend Van Spriel 	/* use hole at 11 */
46858e8b41f9SJohannes Berg 	/* use hole at 12 */
4686f4b34b55SVivek Natarajan 	WIPHY_FLAG_SUPPORTS_FW_ROAM		= BIT(13),
4687cedb5412SEliad Peller 	WIPHY_FLAG_AP_UAPSD			= BIT(14),
4688109086ceSArik Nemtsov 	WIPHY_FLAG_SUPPORTS_TDLS		= BIT(15),
4689109086ceSArik Nemtsov 	WIPHY_FLAG_TDLS_EXTERNAL_SETUP		= BIT(16),
4690562a7480SJohannes Berg 	WIPHY_FLAG_HAVE_AP_SME			= BIT(17),
46915e760230SJohannes Berg 	WIPHY_FLAG_REPORTS_OBSS			= BIT(18),
469287bbbe22SArik Nemtsov 	WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD	= BIT(19),
46937c4ef712SJohannes Berg 	WIPHY_FLAG_OFFCHAN_TX			= BIT(20),
46947c4ef712SJohannes Berg 	WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL	= BIT(21),
46952f301ab2SSimon Wunderlich 	WIPHY_FLAG_SUPPORTS_5_10_MHZ		= BIT(22),
469616ef1fe2SSimon Wunderlich 	WIPHY_FLAG_HAS_CHANNEL_SWITCH		= BIT(23),
4697b8676221SDavid Spinadel 	WIPHY_FLAG_HAS_STATIC_WEP		= BIT(24),
46987527a782SJohannes Berg };
46997527a782SJohannes Berg 
47007527a782SJohannes Berg /**
47017527a782SJohannes Berg  * struct ieee80211_iface_limit - limit on certain interface types
47027527a782SJohannes Berg  * @max: maximum number of interfaces of these types
47037527a782SJohannes Berg  * @types: interface types (bits)
47047527a782SJohannes Berg  */
47057527a782SJohannes Berg struct ieee80211_iface_limit {
47067527a782SJohannes Berg 	u16 max;
47077527a782SJohannes Berg 	u16 types;
47087527a782SJohannes Berg };
47097527a782SJohannes Berg 
47107527a782SJohannes Berg /**
47117527a782SJohannes Berg  * struct ieee80211_iface_combination - possible interface combination
47127527a782SJohannes Berg  *
4713b80edbc1SLuciano Coelho  * With this structure the driver can describe which interface
4714b80edbc1SLuciano Coelho  * combinations it supports concurrently.
47157527a782SJohannes Berg  *
4716b80edbc1SLuciano Coelho  * Examples:
4717b80edbc1SLuciano Coelho  *
4718b80edbc1SLuciano Coelho  * 1. Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total:
47197527a782SJohannes Berg  *
4720819bf593SJohannes Berg  *    .. code-block:: c
4721819bf593SJohannes Berg  *
47227527a782SJohannes Berg  *	struct ieee80211_iface_limit limits1[] = {
47237527a782SJohannes Berg  *		{ .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
47247527a782SJohannes Berg  *		{ .max = 1, .types = BIT(NL80211_IFTYPE_AP}, },
47257527a782SJohannes Berg  *	};
47267527a782SJohannes Berg  *	struct ieee80211_iface_combination combination1 = {
47277527a782SJohannes Berg  *		.limits = limits1,
47287527a782SJohannes Berg  *		.n_limits = ARRAY_SIZE(limits1),
47297527a782SJohannes Berg  *		.max_interfaces = 2,
47307527a782SJohannes Berg  *		.beacon_int_infra_match = true,
47317527a782SJohannes Berg  *	};
47327527a782SJohannes Berg  *
47337527a782SJohannes Berg  *
4734b80edbc1SLuciano Coelho  * 2. Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total:
47357527a782SJohannes Berg  *
4736819bf593SJohannes Berg  *    .. code-block:: c
4737819bf593SJohannes Berg  *
47387527a782SJohannes Berg  *	struct ieee80211_iface_limit limits2[] = {
47397527a782SJohannes Berg  *		{ .max = 8, .types = BIT(NL80211_IFTYPE_AP) |
47407527a782SJohannes Berg  *				     BIT(NL80211_IFTYPE_P2P_GO), },
47417527a782SJohannes Berg  *	};
47427527a782SJohannes Berg  *	struct ieee80211_iface_combination combination2 = {
47437527a782SJohannes Berg  *		.limits = limits2,
47447527a782SJohannes Berg  *		.n_limits = ARRAY_SIZE(limits2),
47457527a782SJohannes Berg  *		.max_interfaces = 8,
47467527a782SJohannes Berg  *		.num_different_channels = 1,
47477527a782SJohannes Berg  *	};
47487527a782SJohannes Berg  *
47497527a782SJohannes Berg  *
4750b80edbc1SLuciano Coelho  * 3. Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total.
4751b80edbc1SLuciano Coelho  *
47527527a782SJohannes Berg  *    This allows for an infrastructure connection and three P2P connections.
47537527a782SJohannes Berg  *
4754819bf593SJohannes Berg  *    .. code-block:: c
4755819bf593SJohannes Berg  *
47567527a782SJohannes Berg  *	struct ieee80211_iface_limit limits3[] = {
47577527a782SJohannes Berg  *		{ .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
47587527a782SJohannes Berg  *		{ .max = 3, .types = BIT(NL80211_IFTYPE_P2P_GO) |
47597527a782SJohannes Berg  *				     BIT(NL80211_IFTYPE_P2P_CLIENT), },
47607527a782SJohannes Berg  *	};
47617527a782SJohannes Berg  *	struct ieee80211_iface_combination combination3 = {
47627527a782SJohannes Berg  *		.limits = limits3,
47637527a782SJohannes Berg  *		.n_limits = ARRAY_SIZE(limits3),
47647527a782SJohannes Berg  *		.max_interfaces = 4,
47657527a782SJohannes Berg  *		.num_different_channels = 2,
47667527a782SJohannes Berg  *	};
4767819bf593SJohannes Berg  *
47687527a782SJohannes Berg  */
47697527a782SJohannes Berg struct ieee80211_iface_combination {
4770c6c94aeaSJohannes Berg 	/**
4771c6c94aeaSJohannes Berg 	 * @limits:
4772c6c94aeaSJohannes Berg 	 * limits for the given interface types
4773c6c94aeaSJohannes Berg 	 */
47747527a782SJohannes Berg 	const struct ieee80211_iface_limit *limits;
4775c6c94aeaSJohannes Berg 
4776c6c94aeaSJohannes Berg 	/**
4777c6c94aeaSJohannes Berg 	 * @num_different_channels:
4778c6c94aeaSJohannes Berg 	 * can use up to this many different channels
4779c6c94aeaSJohannes Berg 	 */
47807527a782SJohannes Berg 	u32 num_different_channels;
4781c6c94aeaSJohannes Berg 
4782c6c94aeaSJohannes Berg 	/**
4783c6c94aeaSJohannes Berg 	 * @max_interfaces:
4784c6c94aeaSJohannes Berg 	 * maximum number of interfaces in total allowed in this group
4785c6c94aeaSJohannes Berg 	 */
47867527a782SJohannes Berg 	u16 max_interfaces;
4787c6c94aeaSJohannes Berg 
4788c6c94aeaSJohannes Berg 	/**
4789c6c94aeaSJohannes Berg 	 * @n_limits:
4790c6c94aeaSJohannes Berg 	 * number of limitations
4791c6c94aeaSJohannes Berg 	 */
47927527a782SJohannes Berg 	u8 n_limits;
4793c6c94aeaSJohannes Berg 
4794c6c94aeaSJohannes Berg 	/**
4795c6c94aeaSJohannes Berg 	 * @beacon_int_infra_match:
4796c6c94aeaSJohannes Berg 	 * In this combination, the beacon intervals between infrastructure
4797c6c94aeaSJohannes Berg 	 * and AP types must match. This is required only in special cases.
4798c6c94aeaSJohannes Berg 	 */
47997527a782SJohannes Berg 	bool beacon_int_infra_match;
4800c6c94aeaSJohannes Berg 
4801c6c94aeaSJohannes Berg 	/**
4802c6c94aeaSJohannes Berg 	 * @radar_detect_widths:
4803c6c94aeaSJohannes Berg 	 * bitmap of channel widths supported for radar detection
4804c6c94aeaSJohannes Berg 	 */
480511c4a075SSimon Wunderlich 	u8 radar_detect_widths;
4806c6c94aeaSJohannes Berg 
4807c6c94aeaSJohannes Berg 	/**
4808c6c94aeaSJohannes Berg 	 * @radar_detect_regions:
4809c6c94aeaSJohannes Berg 	 * bitmap of regions supported for radar detection
4810c6c94aeaSJohannes Berg 	 */
48118c48b50aSFelix Fietkau 	u8 radar_detect_regions;
4812c6c94aeaSJohannes Berg 
4813c6c94aeaSJohannes Berg 	/**
4814c6c94aeaSJohannes Berg 	 * @beacon_int_min_gcd:
4815c6c94aeaSJohannes Berg 	 * This interface combination supports different beacon intervals.
4816c6c94aeaSJohannes Berg 	 *
4817c6c94aeaSJohannes Berg 	 * = 0
4818c6c94aeaSJohannes Berg 	 *   all beacon intervals for different interface must be same.
4819c6c94aeaSJohannes Berg 	 * > 0
4820c6c94aeaSJohannes Berg 	 *   any beacon interval for the interface part of this combination AND
4821c6c94aeaSJohannes Berg 	 *   GCD of all beacon intervals from beaconing interfaces of this
4822c6c94aeaSJohannes Berg 	 *   combination must be greater or equal to this value.
4823c6c94aeaSJohannes Berg 	 */
48240c317a02SPurushottam Kushwaha 	u32 beacon_int_min_gcd;
48255be83de5SJohannes Berg };
48265be83de5SJohannes Berg 
48272e161f78SJohannes Berg struct ieee80211_txrx_stypes {
48282e161f78SJohannes Berg 	u16 tx, rx;
48292e161f78SJohannes Berg };
48302e161f78SJohannes Berg 
48315be83de5SJohannes Berg /**
4832ff1b6e69SJohannes Berg  * enum wiphy_wowlan_support_flags - WoWLAN support flags
4833ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_ANY: supports wakeup for the special "any"
4834ff1b6e69SJohannes Berg  *	trigger that keeps the device operating as-is and
4835ff1b6e69SJohannes Berg  *	wakes up the host on any activity, for example a
4836ff1b6e69SJohannes Berg  *	received packet that passed filtering; note that the
4837ff1b6e69SJohannes Berg  *	packet should be preserved in that case
4838ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_MAGIC_PKT: supports wakeup on magic packet
4839ff1b6e69SJohannes Berg  *	(see nl80211.h)
4840ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_DISCONNECT: supports wakeup on disconnect
484177dbbb13SJohannes Berg  * @WIPHY_WOWLAN_SUPPORTS_GTK_REKEY: supports GTK rekeying while asleep
484277dbbb13SJohannes Berg  * @WIPHY_WOWLAN_GTK_REKEY_FAILURE: supports wakeup on GTK rekey failure
484377dbbb13SJohannes Berg  * @WIPHY_WOWLAN_EAP_IDENTITY_REQ: supports wakeup on EAP identity request
484477dbbb13SJohannes Berg  * @WIPHY_WOWLAN_4WAY_HANDSHAKE: supports wakeup on 4-way handshake failure
484577dbbb13SJohannes Berg  * @WIPHY_WOWLAN_RFKILL_RELEASE: supports wakeup on RF-kill release
48468cd4d456SLuciano Coelho  * @WIPHY_WOWLAN_NET_DETECT: supports wakeup on network detection
4847ff1b6e69SJohannes Berg  */
4848ff1b6e69SJohannes Berg enum wiphy_wowlan_support_flags {
4849ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_ANY		= BIT(0),
4850ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_MAGIC_PKT		= BIT(1),
4851ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_DISCONNECT		= BIT(2),
485277dbbb13SJohannes Berg 	WIPHY_WOWLAN_SUPPORTS_GTK_REKEY	= BIT(3),
485377dbbb13SJohannes Berg 	WIPHY_WOWLAN_GTK_REKEY_FAILURE	= BIT(4),
485477dbbb13SJohannes Berg 	WIPHY_WOWLAN_EAP_IDENTITY_REQ	= BIT(5),
485577dbbb13SJohannes Berg 	WIPHY_WOWLAN_4WAY_HANDSHAKE	= BIT(6),
485677dbbb13SJohannes Berg 	WIPHY_WOWLAN_RFKILL_RELEASE	= BIT(7),
48578cd4d456SLuciano Coelho 	WIPHY_WOWLAN_NET_DETECT		= BIT(8),
4858ff1b6e69SJohannes Berg };
4859ff1b6e69SJohannes Berg 
48602a0e047eSJohannes Berg struct wiphy_wowlan_tcp_support {
48612a0e047eSJohannes Berg 	const struct nl80211_wowlan_tcp_data_token_feature *tok;
48622a0e047eSJohannes Berg 	u32 data_payload_max;
48632a0e047eSJohannes Berg 	u32 data_interval_max;
48642a0e047eSJohannes Berg 	u32 wake_payload_max;
48652a0e047eSJohannes Berg 	bool seq;
48662a0e047eSJohannes Berg };
48672a0e047eSJohannes Berg 
4868ff1b6e69SJohannes Berg /**
4869ff1b6e69SJohannes Berg  * struct wiphy_wowlan_support - WoWLAN support data
4870ff1b6e69SJohannes Berg  * @flags: see &enum wiphy_wowlan_support_flags
4871ff1b6e69SJohannes Berg  * @n_patterns: number of supported wakeup patterns
4872ff1b6e69SJohannes Berg  *	(see nl80211.h for the pattern definition)
4873ff1b6e69SJohannes Berg  * @pattern_max_len: maximum length of each pattern
4874ff1b6e69SJohannes Berg  * @pattern_min_len: minimum length of each pattern
4875bb92d199SAmitkumar Karwar  * @max_pkt_offset: maximum Rx packet offset
48768cd4d456SLuciano Coelho  * @max_nd_match_sets: maximum number of matchsets for net-detect,
48778cd4d456SLuciano Coelho  *	similar, but not necessarily identical, to max_match_sets for
48788cd4d456SLuciano Coelho  *	scheduled scans.
48798cd4d456SLuciano Coelho  *	See &struct cfg80211_sched_scan_request.@match_sets for more
48808cd4d456SLuciano Coelho  *	details.
48812a0e047eSJohannes Berg  * @tcp: TCP wakeup support information
4882ff1b6e69SJohannes Berg  */
4883ff1b6e69SJohannes Berg struct wiphy_wowlan_support {
4884ff1b6e69SJohannes Berg 	u32 flags;
4885ff1b6e69SJohannes Berg 	int n_patterns;
4886ff1b6e69SJohannes Berg 	int pattern_max_len;
4887ff1b6e69SJohannes Berg 	int pattern_min_len;
4888bb92d199SAmitkumar Karwar 	int max_pkt_offset;
48898cd4d456SLuciano Coelho 	int max_nd_match_sets;
48902a0e047eSJohannes Berg 	const struct wiphy_wowlan_tcp_support *tcp;
4891ff1b6e69SJohannes Berg };
4892ff1b6e69SJohannes Berg 
4893ff1b6e69SJohannes Berg /**
4894be29b99aSAmitkumar Karwar  * struct wiphy_coalesce_support - coalesce support data
4895be29b99aSAmitkumar Karwar  * @n_rules: maximum number of coalesce rules
4896be29b99aSAmitkumar Karwar  * @max_delay: maximum supported coalescing delay in msecs
4897be29b99aSAmitkumar Karwar  * @n_patterns: number of supported patterns in a rule
4898be29b99aSAmitkumar Karwar  *	(see nl80211.h for the pattern definition)
4899be29b99aSAmitkumar Karwar  * @pattern_max_len: maximum length of each pattern
4900be29b99aSAmitkumar Karwar  * @pattern_min_len: minimum length of each pattern
4901be29b99aSAmitkumar Karwar  * @max_pkt_offset: maximum Rx packet offset
4902be29b99aSAmitkumar Karwar  */
4903be29b99aSAmitkumar Karwar struct wiphy_coalesce_support {
4904be29b99aSAmitkumar Karwar 	int n_rules;
4905be29b99aSAmitkumar Karwar 	int max_delay;
4906be29b99aSAmitkumar Karwar 	int n_patterns;
4907be29b99aSAmitkumar Karwar 	int pattern_max_len;
4908be29b99aSAmitkumar Karwar 	int pattern_min_len;
4909be29b99aSAmitkumar Karwar 	int max_pkt_offset;
4910be29b99aSAmitkumar Karwar };
4911be29b99aSAmitkumar Karwar 
4912be29b99aSAmitkumar Karwar /**
4913ad7e718cSJohannes Berg  * enum wiphy_vendor_command_flags - validation flags for vendor commands
4914ad7e718cSJohannes Berg  * @WIPHY_VENDOR_CMD_NEED_WDEV: vendor command requires wdev
4915ad7e718cSJohannes Berg  * @WIPHY_VENDOR_CMD_NEED_NETDEV: vendor command requires netdev
4916ad7e718cSJohannes Berg  * @WIPHY_VENDOR_CMD_NEED_RUNNING: interface/wdev must be up & running
4917ad7e718cSJohannes Berg  *	(must be combined with %_WDEV or %_NETDEV)
4918ad7e718cSJohannes Berg  */
4919ad7e718cSJohannes Berg enum wiphy_vendor_command_flags {
4920ad7e718cSJohannes Berg 	WIPHY_VENDOR_CMD_NEED_WDEV = BIT(0),
4921ad7e718cSJohannes Berg 	WIPHY_VENDOR_CMD_NEED_NETDEV = BIT(1),
4922ad7e718cSJohannes Berg 	WIPHY_VENDOR_CMD_NEED_RUNNING = BIT(2),
4923ad7e718cSJohannes Berg };
4924ad7e718cSJohannes Berg 
4925ad7e718cSJohannes Berg /**
4926466b9936Stamizhr@codeaurora.org  * enum wiphy_opmode_flag - Station's ht/vht operation mode information flags
4927466b9936Stamizhr@codeaurora.org  *
4928466b9936Stamizhr@codeaurora.org  * @STA_OPMODE_MAX_BW_CHANGED: Max Bandwidth changed
4929466b9936Stamizhr@codeaurora.org  * @STA_OPMODE_SMPS_MODE_CHANGED: SMPS mode changed
4930466b9936Stamizhr@codeaurora.org  * @STA_OPMODE_N_SS_CHANGED: max N_SS (number of spatial streams) changed
4931466b9936Stamizhr@codeaurora.org  *
4932466b9936Stamizhr@codeaurora.org  */
4933466b9936Stamizhr@codeaurora.org enum wiphy_opmode_flag {
4934466b9936Stamizhr@codeaurora.org 	STA_OPMODE_MAX_BW_CHANGED	= BIT(0),
4935466b9936Stamizhr@codeaurora.org 	STA_OPMODE_SMPS_MODE_CHANGED	= BIT(1),
4936466b9936Stamizhr@codeaurora.org 	STA_OPMODE_N_SS_CHANGED		= BIT(2),
4937466b9936Stamizhr@codeaurora.org };
4938466b9936Stamizhr@codeaurora.org 
4939466b9936Stamizhr@codeaurora.org /**
4940466b9936Stamizhr@codeaurora.org  * struct sta_opmode_info - Station's ht/vht operation mode information
4941466b9936Stamizhr@codeaurora.org  * @changed: contains value from &enum wiphy_opmode_flag
49425e78abd0Stamizhr@codeaurora.org  * @smps_mode: New SMPS mode value from &enum nl80211_smps_mode of a station
49435e78abd0Stamizhr@codeaurora.org  * @bw: new max bandwidth value from &enum nl80211_chan_width of a station
4944466b9936Stamizhr@codeaurora.org  * @rx_nss: new rx_nss value of a station
4945466b9936Stamizhr@codeaurora.org  */
4946466b9936Stamizhr@codeaurora.org 
4947466b9936Stamizhr@codeaurora.org struct sta_opmode_info {
4948466b9936Stamizhr@codeaurora.org 	u32 changed;
49495e78abd0Stamizhr@codeaurora.org 	enum nl80211_smps_mode smps_mode;
49505e78abd0Stamizhr@codeaurora.org 	enum nl80211_chan_width bw;
4951466b9936Stamizhr@codeaurora.org 	u8 rx_nss;
4952466b9936Stamizhr@codeaurora.org };
4953466b9936Stamizhr@codeaurora.org 
495491046d63SJohannes Berg #define VENDOR_CMD_RAW_DATA ((const struct nla_policy *)(long)(-ENODATA))
4955901bb989SJohannes Berg 
4956466b9936Stamizhr@codeaurora.org /**
4957ad7e718cSJohannes Berg  * struct wiphy_vendor_command - vendor command definition
4958ad7e718cSJohannes Berg  * @info: vendor command identifying information, as used in nl80211
4959ad7e718cSJohannes Berg  * @flags: flags, see &enum wiphy_vendor_command_flags
4960ad7e718cSJohannes Berg  * @doit: callback for the operation, note that wdev is %NULL if the
4961ad7e718cSJohannes Berg  *	flags didn't ask for a wdev and non-%NULL otherwise; the data
4962ad7e718cSJohannes Berg  *	pointer may be %NULL if userspace provided no data at all
49637bdbe400SJohannes Berg  * @dumpit: dump callback, for transferring bigger/multiple items. The
49647bdbe400SJohannes Berg  *	@storage points to cb->args[5], ie. is preserved over the multiple
49657bdbe400SJohannes Berg  *	dumpit calls.
4966901bb989SJohannes Berg  * @policy: policy pointer for attributes within %NL80211_ATTR_VENDOR_DATA.
4967901bb989SJohannes Berg  *	Set this to %VENDOR_CMD_RAW_DATA if no policy can be given and the
4968901bb989SJohannes Berg  *	attribute is just raw data (e.g. a firmware command).
4969901bb989SJohannes Berg  * @maxattr: highest attribute number in policy
49707bdbe400SJohannes Berg  * It's recommended to not have the same sub command with both @doit and
49717bdbe400SJohannes Berg  * @dumpit, so that userspace can assume certain ones are get and others
49727bdbe400SJohannes Berg  * are used with dump requests.
4973ad7e718cSJohannes Berg  */
4974ad7e718cSJohannes Berg struct wiphy_vendor_command {
4975ad7e718cSJohannes Berg 	struct nl80211_vendor_cmd_info info;
4976ad7e718cSJohannes Berg 	u32 flags;
4977ad7e718cSJohannes Berg 	int (*doit)(struct wiphy *wiphy, struct wireless_dev *wdev,
4978ad7e718cSJohannes Berg 		    const void *data, int data_len);
49797bdbe400SJohannes Berg 	int (*dumpit)(struct wiphy *wiphy, struct wireless_dev *wdev,
49807bdbe400SJohannes Berg 		      struct sk_buff *skb, const void *data, int data_len,
49817bdbe400SJohannes Berg 		      unsigned long *storage);
4982901bb989SJohannes Berg 	const struct nla_policy *policy;
4983901bb989SJohannes Berg 	unsigned int maxattr;
4984ad7e718cSJohannes Berg };
4985ad7e718cSJohannes Berg 
4986ad7e718cSJohannes Berg /**
4987019ae3a9SKanchanapally, Vidyullatha  * struct wiphy_iftype_ext_capab - extended capabilities per interface type
4988019ae3a9SKanchanapally, Vidyullatha  * @iftype: interface type
4989019ae3a9SKanchanapally, Vidyullatha  * @extended_capabilities: extended capabilities supported by the driver,
4990019ae3a9SKanchanapally, Vidyullatha  *	additional capabilities might be supported by userspace; these are the
4991019ae3a9SKanchanapally, Vidyullatha  *	802.11 extended capabilities ("Extended Capabilities element") and are
4992019ae3a9SKanchanapally, Vidyullatha  *	in the same format as in the information element. See IEEE Std
4993019ae3a9SKanchanapally, Vidyullatha  *	802.11-2012 8.4.2.29 for the defined fields.
4994019ae3a9SKanchanapally, Vidyullatha  * @extended_capabilities_mask: mask of the valid values
4995019ae3a9SKanchanapally, Vidyullatha  * @extended_capabilities_len: length of the extended capabilities
49964e9c3af3SJohannes Berg  * @eml_capabilities: EML capabilities (for MLO)
49974e9c3af3SJohannes Berg  * @mld_capa_and_ops: MLD capabilities and operations (for MLO)
4998019ae3a9SKanchanapally, Vidyullatha  */
4999019ae3a9SKanchanapally, Vidyullatha struct wiphy_iftype_ext_capab {
5000019ae3a9SKanchanapally, Vidyullatha 	enum nl80211_iftype iftype;
5001019ae3a9SKanchanapally, Vidyullatha 	const u8 *extended_capabilities;
5002019ae3a9SKanchanapally, Vidyullatha 	const u8 *extended_capabilities_mask;
5003019ae3a9SKanchanapally, Vidyullatha 	u8 extended_capabilities_len;
50044e9c3af3SJohannes Berg 	u16 eml_capabilities;
50054e9c3af3SJohannes Berg 	u16 mld_capa_and_ops;
5006019ae3a9SKanchanapally, Vidyullatha };
5007019ae3a9SKanchanapally, Vidyullatha 
5008019ae3a9SKanchanapally, Vidyullatha /**
50097464f665SJohannes Berg  * cfg80211_get_iftype_ext_capa - lookup interface type extended capability
50107464f665SJohannes Berg  * @wiphy: the wiphy to look up from
50117464f665SJohannes Berg  * @type: the interface type to look up
50127464f665SJohannes Berg  */
50137464f665SJohannes Berg const struct wiphy_iftype_ext_capab *
50147464f665SJohannes Berg cfg80211_get_iftype_ext_capa(struct wiphy *wiphy, enum nl80211_iftype type);
50157464f665SJohannes Berg 
50167464f665SJohannes Berg /**
50179bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_capabilities - cfg80211 peer measurement capabilities
50189bb7e0f2SJohannes Berg  * @max_peers: maximum number of peers in a single measurement
50199bb7e0f2SJohannes Berg  * @report_ap_tsf: can report assoc AP's TSF for radio resource measurement
50209bb7e0f2SJohannes Berg  * @randomize_mac_addr: can randomize MAC address for measurement
50212d8b08feSMauro Carvalho Chehab  * @ftm: FTM measurement data
50229bb7e0f2SJohannes Berg  * @ftm.supported: FTM measurement is supported
50239bb7e0f2SJohannes Berg  * @ftm.asap: ASAP-mode is supported
50249bb7e0f2SJohannes Berg  * @ftm.non_asap: non-ASAP-mode is supported
50259bb7e0f2SJohannes Berg  * @ftm.request_lci: can request LCI data
50269bb7e0f2SJohannes Berg  * @ftm.request_civicloc: can request civic location data
50279bb7e0f2SJohannes Berg  * @ftm.preambles: bitmap of preambles supported (&enum nl80211_preamble)
50289bb7e0f2SJohannes Berg  * @ftm.bandwidths: bitmap of bandwidths supported (&enum nl80211_chan_width)
50299bb7e0f2SJohannes Berg  * @ftm.max_bursts_exponent: maximum burst exponent supported
50309bb7e0f2SJohannes Berg  *	(set to -1 if not limited; note that setting this will necessarily
50319bb7e0f2SJohannes Berg  *	forbid using the value 15 to let the responder pick)
50329bb7e0f2SJohannes Berg  * @ftm.max_ftms_per_burst: maximum FTMs per burst supported (set to 0 if
50339bb7e0f2SJohannes Berg  *	not limited)
5034efb5520dSAvraham Stern  * @ftm.trigger_based: trigger based ranging measurement is supported
5035efb5520dSAvraham Stern  * @ftm.non_trigger_based: non trigger based ranging measurement is supported
50369bb7e0f2SJohannes Berg  */
50379bb7e0f2SJohannes Berg struct cfg80211_pmsr_capabilities {
50389bb7e0f2SJohannes Berg 	unsigned int max_peers;
50399bb7e0f2SJohannes Berg 	u8 report_ap_tsf:1,
50409bb7e0f2SJohannes Berg 	   randomize_mac_addr:1;
50419bb7e0f2SJohannes Berg 
50429bb7e0f2SJohannes Berg 	struct {
50439bb7e0f2SJohannes Berg 		u32 preambles;
50449bb7e0f2SJohannes Berg 		u32 bandwidths;
50459bb7e0f2SJohannes Berg 		s8 max_bursts_exponent;
50469bb7e0f2SJohannes Berg 		u8 max_ftms_per_burst;
50479bb7e0f2SJohannes Berg 		u8 supported:1,
50489bb7e0f2SJohannes Berg 		   asap:1,
50499bb7e0f2SJohannes Berg 		   non_asap:1,
50509bb7e0f2SJohannes Berg 		   request_lci:1,
5051efb5520dSAvraham Stern 		   request_civicloc:1,
5052efb5520dSAvraham Stern 		   trigger_based:1,
5053efb5520dSAvraham Stern 		   non_trigger_based:1;
50549bb7e0f2SJohannes Berg 	} ftm;
50559bb7e0f2SJohannes Berg };
50569bb7e0f2SJohannes Berg 
50579bb7e0f2SJohannes Berg /**
5058d6039a34SVeerendranath Jakkam  * struct wiphy_iftype_akm_suites - This structure encapsulates supported akm
5059d6039a34SVeerendranath Jakkam  * suites for interface types defined in @iftypes_mask. Each type in the
5060d6039a34SVeerendranath Jakkam  * @iftypes_mask must be unique across all instances of iftype_akm_suites.
5061d6039a34SVeerendranath Jakkam  *
5062d6039a34SVeerendranath Jakkam  * @iftypes_mask: bitmask of interfaces types
5063d6039a34SVeerendranath Jakkam  * @akm_suites: points to an array of supported akm suites
5064d6039a34SVeerendranath Jakkam  * @n_akm_suites: number of supported AKM suites
5065d6039a34SVeerendranath Jakkam  */
5066d6039a34SVeerendranath Jakkam struct wiphy_iftype_akm_suites {
5067d6039a34SVeerendranath Jakkam 	u16 iftypes_mask;
5068d6039a34SVeerendranath Jakkam 	const u32 *akm_suites;
5069d6039a34SVeerendranath Jakkam 	int n_akm_suites;
5070d6039a34SVeerendranath Jakkam };
5071d6039a34SVeerendranath Jakkam 
5072d6039a34SVeerendranath Jakkam /**
50735be83de5SJohannes Berg  * struct wiphy - wireless hardware description
5074a05829a7SJohannes Berg  * @mtx: mutex for the data (structures) of this device
50752784fe91SLuis R. Rodriguez  * @reg_notifier: the driver's regulatory notification callback,
50762784fe91SLuis R. Rodriguez  *	note that if your driver uses wiphy_apply_custom_regulatory()
50772784fe91SLuis R. Rodriguez  *	the reg_notifier's request can be passed as NULL
5078d3236553SJohannes Berg  * @regd: the driver's regulatory domain, if one was requested via
5079d3236553SJohannes Berg  *	the regulatory_hint() API. This can be used by the driver
5080d3236553SJohannes Berg  *	on the reg_notifier() if it chooses to ignore future
5081d3236553SJohannes Berg  *	regulatory domain changes caused by other drivers.
5082d3236553SJohannes Berg  * @signal_type: signal type reported in &struct cfg80211_bss.
5083d3236553SJohannes Berg  * @cipher_suites: supported cipher suites
5084d3236553SJohannes Berg  * @n_cipher_suites: number of supported cipher suites
5085d6039a34SVeerendranath Jakkam  * @akm_suites: supported AKM suites. These are the default AKMs supported if
5086d6039a34SVeerendranath Jakkam  *	the supported AKMs not advertized for a specific interface type in
5087d6039a34SVeerendranath Jakkam  *	iftype_akm_suites.
5088ab4dfa20SVeerendranath Jakkam  * @n_akm_suites: number of supported AKM suites
5089d6039a34SVeerendranath Jakkam  * @iftype_akm_suites: array of supported akm suites info per interface type.
5090d6039a34SVeerendranath Jakkam  *	Note that the bits in @iftypes_mask inside this structure cannot
5091d6039a34SVeerendranath Jakkam  *	overlap (i.e. only one occurrence of each type is allowed across all
5092d6039a34SVeerendranath Jakkam  *	instances of iftype_akm_suites).
5093d6039a34SVeerendranath Jakkam  * @num_iftype_akm_suites: number of interface types for which supported akm
5094d6039a34SVeerendranath Jakkam  *	suites are specified separately.
5095b9a5f8caSJouni Malinen  * @retry_short: Retry limit for short frames (dot11ShortRetryLimit)
5096b9a5f8caSJouni Malinen  * @retry_long: Retry limit for long frames (dot11LongRetryLimit)
5097b9a5f8caSJouni Malinen  * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold);
5098b9a5f8caSJouni Malinen  *	-1 = fragmentation disabled, only odd values >= 256 used
5099b9a5f8caSJouni Malinen  * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled
5100abe37c4bSJohannes Berg  * @_net: the network namespace this wiphy currently lives in
5101ef15aac6SJohannes Berg  * @perm_addr: permanent MAC address of this device
5102ef15aac6SJohannes Berg  * @addr_mask: If the device supports multiple MAC addresses by masking,
5103ef15aac6SJohannes Berg  *	set this to a mask with variable bits set to 1, e.g. if the last
51040fcf8ac5SLuciano Coelho  *	four bits are variable then set it to 00-00-00-00-00-0f. The actual
5105ef15aac6SJohannes Berg  *	variable bits shall be determined by the interfaces added, with
5106ef15aac6SJohannes Berg  *	interfaces not matching the mask being rejected to be brought up.
5107ef15aac6SJohannes Berg  * @n_addresses: number of addresses in @addresses.
5108ef15aac6SJohannes Berg  * @addresses: If the device has more than one address, set this pointer
5109ef15aac6SJohannes Berg  *	to a list of addresses (6 bytes each). The first one will be used
5110ef15aac6SJohannes Berg  *	by default for perm_addr. In this case, the mask should be set to
5111ef15aac6SJohannes Berg  *	all-zeroes. In this case it is assumed that the device can handle
5112ef15aac6SJohannes Berg  *	the same number of arbitrary MAC addresses.
5113fd235913SRandy Dunlap  * @registered: protects ->resume and ->suspend sysfs callbacks against
5114fd235913SRandy Dunlap  *	unregister hardware
5115edf77192SJérôme Pouiller  * @debugfsdir: debugfs directory used for this wiphy (ieee80211/<wiphyname>).
5116edf77192SJérôme Pouiller  *	It will be renamed automatically on wiphy renames
511715bc6dfbSJérôme Pouiller  * @dev: (virtual) struct device for this wiphy. The item in
511815bc6dfbSJérôme Pouiller  *	/sys/class/ieee80211/ points to this. You need use set_wiphy_dev()
511915bc6dfbSJérôme Pouiller  *	(see below).
5120abe37c4bSJohannes Berg  * @wext: wireless extension handlers
5121abe37c4bSJohannes Berg  * @priv: driver private data (sized according to wiphy_new() parameter)
5122abe37c4bSJohannes Berg  * @interface_modes: bitmask of interfaces types valid for this wiphy,
5123abe37c4bSJohannes Berg  *	must be set by driver
51247527a782SJohannes Berg  * @iface_combinations: Valid interface combinations array, should not
51257527a782SJohannes Berg  *	list single interface types.
51267527a782SJohannes Berg  * @n_iface_combinations: number of entries in @iface_combinations array.
51277527a782SJohannes Berg  * @software_iftypes: bitmask of software interface types, these are not
51287527a782SJohannes Berg  *	subject to any restrictions since they are purely managed in SW.
5129abe37c4bSJohannes Berg  * @flags: wiphy flags, see &enum wiphy_flags
5130a2f73b6cSLuis R. Rodriguez  * @regulatory_flags: wiphy regulatory flags, see
5131a2f73b6cSLuis R. Rodriguez  *	&enum ieee80211_regulatory_flags
51321f074bd8SJohannes Berg  * @features: features advertised to nl80211, see &enum nl80211_feature_flags.
5133d75bb06bSGautam Kumar Shukla  * @ext_features: extended features advertised to nl80211, see
5134d75bb06bSGautam Kumar Shukla  *	&enum nl80211_ext_feature_index.
5135abe37c4bSJohannes Berg  * @bss_priv_size: each BSS struct has private data allocated with it,
5136abe37c4bSJohannes Berg  *	this variable determines its size
5137abe37c4bSJohannes Berg  * @max_scan_ssids: maximum number of SSIDs the device can scan for in
5138abe37c4bSJohannes Berg  *	any given scan
5139ca986ad9SArend Van Spriel  * @max_sched_scan_reqs: maximum number of scheduled scan requests that
5140ca986ad9SArend Van Spriel  *	the device can run concurrently.
514193b6aa69SLuciano Coelho  * @max_sched_scan_ssids: maximum number of SSIDs the device can scan
514293b6aa69SLuciano Coelho  *	for in any given scheduled scan
5143a1f1c21cSLuciano Coelho  * @max_match_sets: maximum number of match sets the device can handle
5144a1f1c21cSLuciano Coelho  *	when performing a scheduled scan, 0 if filtering is not
5145a1f1c21cSLuciano Coelho  *	supported.
5146abe37c4bSJohannes Berg  * @max_scan_ie_len: maximum length of user-controlled IEs device can
5147abe37c4bSJohannes Berg  *	add to probe request frames transmitted during a scan, must not
5148abe37c4bSJohannes Berg  *	include fixed IEs like supported rates
51495a865badSLuciano Coelho  * @max_sched_scan_ie_len: same as max_scan_ie_len, but for scheduled
51505a865badSLuciano Coelho  *	scans
51513b06d277SAvraham Stern  * @max_sched_scan_plans: maximum number of scan plans (scan interval and number
51523b06d277SAvraham Stern  *	of iterations) for scheduled scan supported by the device.
51533b06d277SAvraham Stern  * @max_sched_scan_plan_interval: maximum interval (in seconds) for a
51543b06d277SAvraham Stern  *	single scan plan supported by the device.
51553b06d277SAvraham Stern  * @max_sched_scan_plan_iterations: maximum number of iterations for a single
51563b06d277SAvraham Stern  *	scan plan supported by the device.
5157abe37c4bSJohannes Berg  * @coverage_class: current coverage class
5158abe37c4bSJohannes Berg  * @fw_version: firmware version for ethtool reporting
5159abe37c4bSJohannes Berg  * @hw_version: hardware version for ethtool reporting
5160abe37c4bSJohannes Berg  * @max_num_pmkids: maximum number of PMKIDs supported by device
5161abe37c4bSJohannes Berg  * @privid: a pointer that drivers can use to identify if an arbitrary
5162abe37c4bSJohannes Berg  *	wiphy is theirs, e.g. in global notifiers
5163abe37c4bSJohannes Berg  * @bands: information about bands/channels supported by this device
51642e161f78SJohannes Berg  *
51652e161f78SJohannes Berg  * @mgmt_stypes: bitmasks of frame subtypes that can be subscribed to or
51662e161f78SJohannes Berg  *	transmitted through nl80211, points to an array indexed by interface
51672e161f78SJohannes Berg  *	type
5168a7ffac95SBruno Randolf  *
51697f531e03SBruno Randolf  * @available_antennas_tx: bitmap of antennas which are available to be
51707f531e03SBruno Randolf  *	configured as TX antennas. Antenna configuration commands will be
51717f531e03SBruno Randolf  *	rejected unless this or @available_antennas_rx is set.
51727f531e03SBruno Randolf  *
51737f531e03SBruno Randolf  * @available_antennas_rx: bitmap of antennas which are available to be
51747f531e03SBruno Randolf  *	configured as RX antennas. Antenna configuration commands will be
51757f531e03SBruno Randolf  *	rejected unless this or @available_antennas_tx is set.
5176a293911dSJohannes Berg  *
517715f0ebc2SRandy Dunlap  * @probe_resp_offload:
517815f0ebc2SRandy Dunlap  *	 Bitmap of supported protocols for probe response offloading.
517915f0ebc2SRandy Dunlap  *	 See &enum nl80211_probe_resp_offload_support_attr. Only valid
518015f0ebc2SRandy Dunlap  *	 when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set.
518115f0ebc2SRandy Dunlap  *
5182a293911dSJohannes Berg  * @max_remain_on_channel_duration: Maximum time a remain-on-channel operation
5183a293911dSJohannes Berg  *	may request, if implemented.
5184ff1b6e69SJohannes Berg  *
5185ff1b6e69SJohannes Berg  * @wowlan: WoWLAN support information
51866abb9cb9SJohannes Berg  * @wowlan_config: current WoWLAN configuration; this should usually not be
51876abb9cb9SJohannes Berg  *	used since access to it is necessarily racy, use the parameter passed
51886abb9cb9SJohannes Berg  *	to the suspend() operation instead.
5189562a7480SJohannes Berg  *
5190562a7480SJohannes Berg  * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features.
51917e7c8926SBen Greear  * @ht_capa_mod_mask:  Specify what ht_cap values can be over-ridden.
51927e7c8926SBen Greear  *	If null, then none can be over-ridden.
5193ee2aca34SJohannes Berg  * @vht_capa_mod_mask:  Specify what VHT capabilities can be over-ridden.
5194ee2aca34SJohannes Berg  *	If null, then none can be over-ridden.
519577765eafSVasanthakumar Thiagarajan  *
519653873f13SJohannes Berg  * @wdev_list: the list of associated (virtual) interfaces; this list must
519753873f13SJohannes Berg  *	not be modified by the driver, but can be read with RTNL/RCU protection.
519853873f13SJohannes Berg  *
519977765eafSVasanthakumar Thiagarajan  * @max_acl_mac_addrs: Maximum number of MAC addresses that the device
520077765eafSVasanthakumar Thiagarajan  *	supports for ACL.
5201a50df0c4SJohannes Berg  *
5202a50df0c4SJohannes Berg  * @extended_capabilities: extended capabilities supported by the driver,
5203a50df0c4SJohannes Berg  *	additional capabilities might be supported by userspace; these are
5204a50df0c4SJohannes Berg  *	the 802.11 extended capabilities ("Extended Capabilities element")
5205a50df0c4SJohannes Berg  *	and are in the same format as in the information element. See
5206019ae3a9SKanchanapally, Vidyullatha  *	802.11-2012 8.4.2.29 for the defined fields. These are the default
5207019ae3a9SKanchanapally, Vidyullatha  *	extended capabilities to be used if the capabilities are not specified
5208019ae3a9SKanchanapally, Vidyullatha  *	for a specific interface type in iftype_ext_capab.
5209a50df0c4SJohannes Berg  * @extended_capabilities_mask: mask of the valid values
5210a50df0c4SJohannes Berg  * @extended_capabilities_len: length of the extended capabilities
5211019ae3a9SKanchanapally, Vidyullatha  * @iftype_ext_capab: array of extended capabilities per interface type
5212019ae3a9SKanchanapally, Vidyullatha  * @num_iftype_ext_capab: number of interface types for which extended
5213019ae3a9SKanchanapally, Vidyullatha  *	capabilities are specified separately.
5214be29b99aSAmitkumar Karwar  * @coalesce: packet coalescing support information
5215ad7e718cSJohannes Berg  *
5216ad7e718cSJohannes Berg  * @vendor_commands: array of vendor commands supported by the hardware
5217ad7e718cSJohannes Berg  * @n_vendor_commands: number of vendor commands
5218567ffc35SJohannes Berg  * @vendor_events: array of vendor events supported by the hardware
5219567ffc35SJohannes Berg  * @n_vendor_events: number of vendor events
5220b43504cfSJouni Malinen  *
5221b43504cfSJouni Malinen  * @max_ap_assoc_sta: maximum number of associated stations supported in AP mode
5222b43504cfSJouni Malinen  *	(including P2P GO) or 0 to indicate no such limit is advertised. The
5223b43504cfSJouni Malinen  *	driver is allowed to advertise a theoretical limit that it can reach in
5224b43504cfSJouni Malinen  *	some cases, but may not always reach.
5225c2e4323bSLuciano Coelho  *
5226c2e4323bSLuciano Coelho  * @max_num_csa_counters: Number of supported csa_counters in beacons
5227c2e4323bSLuciano Coelho  *	and probe responses.  This value should be set if the driver
5228c2e4323bSLuciano Coelho  *	wishes to limit the number of csa counters. Default (0) means
5229c2e4323bSLuciano Coelho  *	infinite.
523038de03d2SArend van Spriel  * @bss_select_support: bitmask indicating the BSS selection criteria supported
523138de03d2SArend van Spriel  *	by the driver in the .connect() callback. The bit position maps to the
523238de03d2SArend van Spriel  *	attribute indices defined in &enum nl80211_bss_select_attr.
5233a442b761SAyala Beker  *
52348585989dSLuca Coelho  * @nan_supported_bands: bands supported by the device in NAN mode, a
52358585989dSLuca Coelho  *	bitmap of &enum nl80211_band values.  For instance, for
52368585989dSLuca Coelho  *	NL80211_BAND_2GHZ, bit 0 would be set
52378585989dSLuca Coelho  *	(i.e. BIT(NL80211_BAND_2GHZ)).
5238f3a7ca64SJohannes Berg  *
5239f3a7ca64SJohannes Berg  * @txq_limit: configuration of internal TX queue frame limit
5240f3a7ca64SJohannes Berg  * @txq_memory_limit: configuration internal TX queue memory limit
5241f3a7ca64SJohannes Berg  * @txq_quantum: configuration of internal TX queue scheduler quantum
52429bb7e0f2SJohannes Berg  *
5243a710d214SLothar Rubusch  * @tx_queue_len: allow setting transmit queue len for drivers not using
5244a710d214SLothar Rubusch  *	wake_tx_queue
5245a710d214SLothar Rubusch  *
5246213ed579SSara Sharon  * @support_mbssid: can HW support association with nontransmitted AP
5247213ed579SSara Sharon  * @support_only_he_mbssid: don't parse MBSSID elements if it is not
5248213ed579SSara Sharon  *	HE AP, in order to avoid compatibility issues.
5249213ed579SSara Sharon  *	@support_mbssid must be set for this to have any effect.
5250213ed579SSara Sharon  *
52519bb7e0f2SJohannes Berg  * @pmsr_capa: peer measurement capabilities
52523710a8a6SJohannes Berg  *
52533710a8a6SJohannes Berg  * @tid_config_support: describes the per-TID config support that the
52543710a8a6SJohannes Berg  *	device has
52553710a8a6SJohannes Berg  * @tid_config_support.vif: bitmap of attributes (configurations)
52563710a8a6SJohannes Berg  *	supported by the driver for each vif
52573710a8a6SJohannes Berg  * @tid_config_support.peer: bitmap of attributes (configurations)
52583710a8a6SJohannes Berg  *	supported by the driver for each peer
52596a21d16cSTamizh chelvam  * @tid_config_support.max_retry: maximum supported retry count for
52606a21d16cSTamizh chelvam  *	long/short retry configuration
5261a710d214SLothar Rubusch  *
5262a710d214SLothar Rubusch  * @max_data_retry_count: maximum supported per TID retry count for
5263a710d214SLothar Rubusch  *	configuration through the %NL80211_TID_CONFIG_ATTR_RETRY_SHORT and
5264a710d214SLothar Rubusch  *	%NL80211_TID_CONFIG_ATTR_RETRY_LONG attributes
526570b6ff35SJohannes Berg  * @sar_capa: SAR control capabilities
5266358ae888SEmmanuel Grumbach  * @rfkill: a pointer to the rfkill structure
5267dc1e3cb8SJohn Crispin  *
5268dc1e3cb8SJohn Crispin  * @mbssid_max_interfaces: maximum number of interfaces supported by the driver
5269dc1e3cb8SJohn Crispin  *	in a multiple BSSID set. This field must be set to a non-zero value
5270dc1e3cb8SJohn Crispin  *	by the driver to advertise MBSSID support.
5271f9d366d4SJohannes Berg  * @ema_max_profile_periodicity: maximum profile periodicity supported by
5272dc1e3cb8SJohn Crispin  *	the driver. Setting this field to a non-zero value indicates that the
5273dc1e3cb8SJohn Crispin  *	driver supports enhanced multi-BSSID advertisements (EMA AP).
5274ecad3b0bSVeerendranath Jakkam  * @max_num_akm_suites: maximum number of AKM suites allowed for
5275ecad3b0bSVeerendranath Jakkam  *	configuration through %NL80211_CMD_CONNECT, %NL80211_CMD_ASSOCIATE and
5276ecad3b0bSVeerendranath Jakkam  *	%NL80211_CMD_START_AP. Set to NL80211_MAX_NR_AKM_SUITES if not set by
5277ecad3b0bSVeerendranath Jakkam  *	driver. If set by driver minimum allowed value is
5278ecad3b0bSVeerendranath Jakkam  *	NL80211_MAX_NR_AKM_SUITES in order to avoid compatibility issues with
5279ecad3b0bSVeerendranath Jakkam  *	legacy userspace and maximum allowed value is
5280ecad3b0bSVeerendranath Jakkam  *	CFG80211_MAX_NUM_AKM_SUITES.
5281d3236553SJohannes Berg  */
5282d3236553SJohannes Berg struct wiphy {
5283a05829a7SJohannes Berg 	struct mutex mtx;
5284a05829a7SJohannes Berg 
5285d3236553SJohannes Berg 	/* assign these fields before you register the wiphy */
5286d3236553SJohannes Berg 
5287d3236553SJohannes Berg 	u8 perm_addr[ETH_ALEN];
5288ef15aac6SJohannes Berg 	u8 addr_mask[ETH_ALEN];
5289ef15aac6SJohannes Berg 
5290ef15aac6SJohannes Berg 	struct mac_address *addresses;
5291d3236553SJohannes Berg 
52922e161f78SJohannes Berg 	const struct ieee80211_txrx_stypes *mgmt_stypes;
52932e161f78SJohannes Berg 
52947527a782SJohannes Berg 	const struct ieee80211_iface_combination *iface_combinations;
52957527a782SJohannes Berg 	int n_iface_combinations;
52967527a782SJohannes Berg 	u16 software_iftypes;
52977527a782SJohannes Berg 
52982e161f78SJohannes Berg 	u16 n_addresses;
52992e161f78SJohannes Berg 
5300d3236553SJohannes Berg 	/* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
5301d3236553SJohannes Berg 	u16 interface_modes;
5302d3236553SJohannes Berg 
530377765eafSVasanthakumar Thiagarajan 	u16 max_acl_mac_addrs;
530477765eafSVasanthakumar Thiagarajan 
5305a2f73b6cSLuis R. Rodriguez 	u32 flags, regulatory_flags, features;
5306d75bb06bSGautam Kumar Shukla 	u8 ext_features[DIV_ROUND_UP(NUM_NL80211_EXT_FEATURES, 8)];
5307463d0183SJohannes Berg 
5308562a7480SJohannes Berg 	u32 ap_sme_capa;
5309562a7480SJohannes Berg 
5310d3236553SJohannes Berg 	enum cfg80211_signal_type signal_type;
5311d3236553SJohannes Berg 
5312d3236553SJohannes Berg 	int bss_priv_size;
5313d3236553SJohannes Berg 	u8 max_scan_ssids;
5314ca986ad9SArend Van Spriel 	u8 max_sched_scan_reqs;
531593b6aa69SLuciano Coelho 	u8 max_sched_scan_ssids;
5316a1f1c21cSLuciano Coelho 	u8 max_match_sets;
5317d3236553SJohannes Berg 	u16 max_scan_ie_len;
53185a865badSLuciano Coelho 	u16 max_sched_scan_ie_len;
53193b06d277SAvraham Stern 	u32 max_sched_scan_plans;
53203b06d277SAvraham Stern 	u32 max_sched_scan_plan_interval;
53213b06d277SAvraham Stern 	u32 max_sched_scan_plan_iterations;
5322d3236553SJohannes Berg 
5323d3236553SJohannes Berg 	int n_cipher_suites;
5324d3236553SJohannes Berg 	const u32 *cipher_suites;
5325d3236553SJohannes Berg 
5326ab4dfa20SVeerendranath Jakkam 	int n_akm_suites;
5327ab4dfa20SVeerendranath Jakkam 	const u32 *akm_suites;
5328ab4dfa20SVeerendranath Jakkam 
5329d6039a34SVeerendranath Jakkam 	const struct wiphy_iftype_akm_suites *iftype_akm_suites;
5330d6039a34SVeerendranath Jakkam 	unsigned int num_iftype_akm_suites;
5331d6039a34SVeerendranath Jakkam 
5332b9a5f8caSJouni Malinen 	u8 retry_short;
5333b9a5f8caSJouni Malinen 	u8 retry_long;
5334b9a5f8caSJouni Malinen 	u32 frag_threshold;
5335b9a5f8caSJouni Malinen 	u32 rts_threshold;
533681077e82SLukáš Turek 	u8 coverage_class;
5337b9a5f8caSJouni Malinen 
533881135548SJiri Pirko 	char fw_version[ETHTOOL_FWVERS_LEN];
5339dfce95f5SKalle Valo 	u32 hw_version;
5340dfce95f5SKalle Valo 
5341dfb89c56SJohannes Berg #ifdef CONFIG_PM
5342964dc9e2SJohannes Berg 	const struct wiphy_wowlan_support *wowlan;
53436abb9cb9SJohannes Berg 	struct cfg80211_wowlan *wowlan_config;
5344dfb89c56SJohannes Berg #endif
5345ff1b6e69SJohannes Berg 
5346a293911dSJohannes Berg 	u16 max_remain_on_channel_duration;
5347a293911dSJohannes Berg 
534867fbb16bSSamuel Ortiz 	u8 max_num_pmkids;
534967fbb16bSSamuel Ortiz 
53507f531e03SBruno Randolf 	u32 available_antennas_tx;
53517f531e03SBruno Randolf 	u32 available_antennas_rx;
5352a7ffac95SBruno Randolf 
535387bbbe22SArik Nemtsov 	u32 probe_resp_offload;
535487bbbe22SArik Nemtsov 
5355a50df0c4SJohannes Berg 	const u8 *extended_capabilities, *extended_capabilities_mask;
5356a50df0c4SJohannes Berg 	u8 extended_capabilities_len;
5357a50df0c4SJohannes Berg 
5358019ae3a9SKanchanapally, Vidyullatha 	const struct wiphy_iftype_ext_capab *iftype_ext_capab;
5359019ae3a9SKanchanapally, Vidyullatha 	unsigned int num_iftype_ext_capab;
5360019ae3a9SKanchanapally, Vidyullatha 
5361cf5aa2f1SDavid Kilroy 	const void *privid;
5362d3236553SJohannes Berg 
536357fbcce3SJohannes Berg 	struct ieee80211_supported_band *bands[NUM_NL80211_BANDS];
5364d3236553SJohannes Berg 
53650c0280bdSLuis R. Rodriguez 	void (*reg_notifier)(struct wiphy *wiphy,
5366d3236553SJohannes Berg 			     struct regulatory_request *request);
5367d3236553SJohannes Berg 
5368d3236553SJohannes Berg 	/* fields below are read-only, assigned by cfg80211 */
5369d3236553SJohannes Berg 
5370458f4f9eSJohannes Berg 	const struct ieee80211_regdomain __rcu *regd;
5371d3236553SJohannes Berg 
5372d3236553SJohannes Berg 	struct device dev;
5373d3236553SJohannes Berg 
5374ecb44335SStanislaw Gruszka 	bool registered;
5375ecb44335SStanislaw Gruszka 
5376d3236553SJohannes Berg 	struct dentry *debugfsdir;
5377d3236553SJohannes Berg 
53787e7c8926SBen Greear 	const struct ieee80211_ht_cap *ht_capa_mod_mask;
5379ee2aca34SJohannes Berg 	const struct ieee80211_vht_cap *vht_capa_mod_mask;
53807e7c8926SBen Greear 
538153873f13SJohannes Berg 	struct list_head wdev_list;
538253873f13SJohannes Berg 
53830c5c9fb5SEric W. Biederman 	possible_net_t _net;
5384463d0183SJohannes Berg 
53853d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT
53863d23e349SJohannes Berg 	const struct iw_handler_def *wext;
53873d23e349SJohannes Berg #endif
53883d23e349SJohannes Berg 
5389be29b99aSAmitkumar Karwar 	const struct wiphy_coalesce_support *coalesce;
5390be29b99aSAmitkumar Karwar 
5391ad7e718cSJohannes Berg 	const struct wiphy_vendor_command *vendor_commands;
5392567ffc35SJohannes Berg 	const struct nl80211_vendor_cmd_info *vendor_events;
5393567ffc35SJohannes Berg 	int n_vendor_commands, n_vendor_events;
5394ad7e718cSJohannes Berg 
5395b43504cfSJouni Malinen 	u16 max_ap_assoc_sta;
5396b43504cfSJouni Malinen 
53979a774c78SAndrei Otcheretianski 	u8 max_num_csa_counters;
53989a774c78SAndrei Otcheretianski 
539938de03d2SArend van Spriel 	u32 bss_select_support;
540038de03d2SArend van Spriel 
54018585989dSLuca Coelho 	u8 nan_supported_bands;
54028585989dSLuca Coelho 
540352539ca8SToke Høiland-Jørgensen 	u32 txq_limit;
540452539ca8SToke Høiland-Jørgensen 	u32 txq_memory_limit;
540552539ca8SToke Høiland-Jørgensen 	u32 txq_quantum;
540652539ca8SToke Høiland-Jørgensen 
54071f6e0baaSJohn Crispin 	unsigned long tx_queue_len;
54081f6e0baaSJohn Crispin 
5409213ed579SSara Sharon 	u8 support_mbssid:1,
5410213ed579SSara Sharon 	   support_only_he_mbssid:1;
5411213ed579SSara Sharon 
54129bb7e0f2SJohannes Berg 	const struct cfg80211_pmsr_capabilities *pmsr_capa;
54139bb7e0f2SJohannes Berg 
54143710a8a6SJohannes Berg 	struct {
54153710a8a6SJohannes Berg 		u64 peer, vif;
54166a21d16cSTamizh chelvam 		u8 max_retry;
54173710a8a6SJohannes Berg 	} tid_config_support;
54183710a8a6SJohannes Berg 
54196a21d16cSTamizh chelvam 	u8 max_data_retry_count;
54206a21d16cSTamizh chelvam 
54216bdb68ceSCarl Huang 	const struct cfg80211_sar_capa *sar_capa;
54226bdb68ceSCarl Huang 
5423358ae888SEmmanuel Grumbach 	struct rfkill *rfkill;
5424358ae888SEmmanuel Grumbach 
5425dc1e3cb8SJohn Crispin 	u8 mbssid_max_interfaces;
5426dc1e3cb8SJohn Crispin 	u8 ema_max_profile_periodicity;
5427ecad3b0bSVeerendranath Jakkam 	u16 max_num_akm_suites;
5428dc1e3cb8SJohn Crispin 
5429396fba0aSGustavo A. R. Silva 	char priv[] __aligned(NETDEV_ALIGN);
5430d3236553SJohannes Berg };
5431d3236553SJohannes Berg 
5432463d0183SJohannes Berg static inline struct net *wiphy_net(struct wiphy *wiphy)
5433463d0183SJohannes Berg {
5434c2d9ba9bSEric Dumazet 	return read_pnet(&wiphy->_net);
5435463d0183SJohannes Berg }
5436463d0183SJohannes Berg 
5437463d0183SJohannes Berg static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net)
5438463d0183SJohannes Berg {
5439c2d9ba9bSEric Dumazet 	write_pnet(&wiphy->_net, net);
5440463d0183SJohannes Berg }
5441463d0183SJohannes Berg 
5442d3236553SJohannes Berg /**
5443d3236553SJohannes Berg  * wiphy_priv - return priv from wiphy
5444d3236553SJohannes Berg  *
5445d3236553SJohannes Berg  * @wiphy: the wiphy whose priv pointer to return
54460ae997dcSYacine Belkadi  * Return: The priv of @wiphy.
5447d3236553SJohannes Berg  */
5448d3236553SJohannes Berg static inline void *wiphy_priv(struct wiphy *wiphy)
5449d3236553SJohannes Berg {
5450d3236553SJohannes Berg 	BUG_ON(!wiphy);
5451d3236553SJohannes Berg 	return &wiphy->priv;
5452d3236553SJohannes Berg }
5453d3236553SJohannes Berg 
5454d3236553SJohannes Berg /**
5455f1f74825SDavid Kilroy  * priv_to_wiphy - return the wiphy containing the priv
5456f1f74825SDavid Kilroy  *
5457f1f74825SDavid Kilroy  * @priv: a pointer previously returned by wiphy_priv
54580ae997dcSYacine Belkadi  * Return: The wiphy of @priv.
5459f1f74825SDavid Kilroy  */
5460f1f74825SDavid Kilroy static inline struct wiphy *priv_to_wiphy(void *priv)
5461f1f74825SDavid Kilroy {
5462f1f74825SDavid Kilroy 	BUG_ON(!priv);
5463f1f74825SDavid Kilroy 	return container_of(priv, struct wiphy, priv);
5464f1f74825SDavid Kilroy }
5465f1f74825SDavid Kilroy 
5466f1f74825SDavid Kilroy /**
5467d3236553SJohannes Berg  * set_wiphy_dev - set device pointer for wiphy
5468d3236553SJohannes Berg  *
5469d3236553SJohannes Berg  * @wiphy: The wiphy whose device to bind
5470d3236553SJohannes Berg  * @dev: The device to parent it to
5471d3236553SJohannes Berg  */
5472d3236553SJohannes Berg static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev)
5473d3236553SJohannes Berg {
5474d3236553SJohannes Berg 	wiphy->dev.parent = dev;
5475d3236553SJohannes Berg }
5476d3236553SJohannes Berg 
5477d3236553SJohannes Berg /**
5478d3236553SJohannes Berg  * wiphy_dev - get wiphy dev pointer
5479d3236553SJohannes Berg  *
5480d3236553SJohannes Berg  * @wiphy: The wiphy whose device struct to look up
54810ae997dcSYacine Belkadi  * Return: The dev of @wiphy.
5482d3236553SJohannes Berg  */
5483d3236553SJohannes Berg static inline struct device *wiphy_dev(struct wiphy *wiphy)
5484d3236553SJohannes Berg {
5485d3236553SJohannes Berg 	return wiphy->dev.parent;
5486d3236553SJohannes Berg }
5487d3236553SJohannes Berg 
5488d3236553SJohannes Berg /**
5489d3236553SJohannes Berg  * wiphy_name - get wiphy name
5490d3236553SJohannes Berg  *
5491d3236553SJohannes Berg  * @wiphy: The wiphy whose name to return
54920ae997dcSYacine Belkadi  * Return: The name of @wiphy.
5493d3236553SJohannes Berg  */
5494e1db74fcSJoe Perches static inline const char *wiphy_name(const struct wiphy *wiphy)
5495d3236553SJohannes Berg {
5496d3236553SJohannes Berg 	return dev_name(&wiphy->dev);
5497d3236553SJohannes Berg }
5498d3236553SJohannes Berg 
5499d3236553SJohannes Berg /**
55001998d90aSBen Greear  * wiphy_new_nm - create a new wiphy for use with cfg80211
55011998d90aSBen Greear  *
55021998d90aSBen Greear  * @ops: The configuration operations for this device
55031998d90aSBen Greear  * @sizeof_priv: The size of the private area to allocate
55041998d90aSBen Greear  * @requested_name: Request a particular name.
55051998d90aSBen Greear  *	NULL is valid value, and means use the default phy%d naming.
55061998d90aSBen Greear  *
55071998d90aSBen Greear  * Create a new wiphy and associate the given operations with it.
55081998d90aSBen Greear  * @sizeof_priv bytes are allocated for private use.
55091998d90aSBen Greear  *
55101998d90aSBen Greear  * Return: A pointer to the new wiphy. This pointer must be
55111998d90aSBen Greear  * assigned to each netdev's ieee80211_ptr for proper operation.
55121998d90aSBen Greear  */
55131998d90aSBen Greear struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv,
55141998d90aSBen Greear 			   const char *requested_name);
55151998d90aSBen Greear 
55161998d90aSBen Greear /**
5517d3236553SJohannes Berg  * wiphy_new - create a new wiphy for use with cfg80211
5518d3236553SJohannes Berg  *
5519d3236553SJohannes Berg  * @ops: The configuration operations for this device
5520d3236553SJohannes Berg  * @sizeof_priv: The size of the private area to allocate
5521d3236553SJohannes Berg  *
5522d3236553SJohannes Berg  * Create a new wiphy and associate the given operations with it.
5523d3236553SJohannes Berg  * @sizeof_priv bytes are allocated for private use.
5524d3236553SJohannes Berg  *
55250ae997dcSYacine Belkadi  * Return: A pointer to the new wiphy. This pointer must be
55260ae997dcSYacine Belkadi  * assigned to each netdev's ieee80211_ptr for proper operation.
5527d3236553SJohannes Berg  */
55281998d90aSBen Greear static inline struct wiphy *wiphy_new(const struct cfg80211_ops *ops,
55291998d90aSBen Greear 				      int sizeof_priv)
55301998d90aSBen Greear {
55311998d90aSBen Greear 	return wiphy_new_nm(ops, sizeof_priv, NULL);
55321998d90aSBen Greear }
5533d3236553SJohannes Berg 
5534d3236553SJohannes Berg /**
5535d3236553SJohannes Berg  * wiphy_register - register a wiphy with cfg80211
5536d3236553SJohannes Berg  *
5537d3236553SJohannes Berg  * @wiphy: The wiphy to register.
5538d3236553SJohannes Berg  *
55390ae997dcSYacine Belkadi  * Return: A non-negative wiphy index or a negative error code.
5540d3236553SJohannes Berg  */
554110dd9b7cSJoe Perches int wiphy_register(struct wiphy *wiphy);
5542d3236553SJohannes Berg 
5543a05829a7SJohannes Berg /* this is a define for better error reporting (file/line) */
5544a05829a7SJohannes Berg #define lockdep_assert_wiphy(wiphy) lockdep_assert_held(&(wiphy)->mtx)
5545a05829a7SJohannes Berg 
5546a05829a7SJohannes Berg /**
5547a05829a7SJohannes Berg  * rcu_dereference_wiphy - rcu_dereference with debug checking
5548a05829a7SJohannes Berg  * @wiphy: the wiphy to check the locking on
5549a05829a7SJohannes Berg  * @p: The pointer to read, prior to dereferencing
5550a05829a7SJohannes Berg  *
5551a05829a7SJohannes Berg  * Do an rcu_dereference(p), but check caller either holds rcu_read_lock()
5552a05829a7SJohannes Berg  * or RTNL. Note: Please prefer wiphy_dereference() or rcu_dereference().
5553a05829a7SJohannes Berg  */
5554a05829a7SJohannes Berg #define rcu_dereference_wiphy(wiphy, p)				\
5555a05829a7SJohannes Berg         rcu_dereference_check(p, lockdep_is_held(&wiphy->mtx))
5556a05829a7SJohannes Berg 
5557a05829a7SJohannes Berg /**
5558a05829a7SJohannes Berg  * wiphy_dereference - fetch RCU pointer when updates are prevented by wiphy mtx
5559a05829a7SJohannes Berg  * @wiphy: the wiphy to check the locking on
5560a05829a7SJohannes Berg  * @p: The pointer to read, prior to dereferencing
5561a05829a7SJohannes Berg  *
5562a05829a7SJohannes Berg  * Return the value of the specified RCU-protected pointer, but omit the
5563a05829a7SJohannes Berg  * READ_ONCE(), because caller holds the wiphy mutex used for updates.
5564a05829a7SJohannes Berg  */
5565a05829a7SJohannes Berg #define wiphy_dereference(wiphy, p)				\
5566a05829a7SJohannes Berg         rcu_dereference_protected(p, lockdep_is_held(&wiphy->mtx))
5567a05829a7SJohannes Berg 
5568a05829a7SJohannes Berg /**
5569a05829a7SJohannes Berg  * get_wiphy_regdom - get custom regdomain for the given wiphy
5570a05829a7SJohannes Berg  * @wiphy: the wiphy to get the regdomain from
5571a05829a7SJohannes Berg  */
5572a05829a7SJohannes Berg const struct ieee80211_regdomain *get_wiphy_regdom(struct wiphy *wiphy);
5573a05829a7SJohannes Berg 
5574d3236553SJohannes Berg /**
5575d3236553SJohannes Berg  * wiphy_unregister - deregister a wiphy from cfg80211
5576d3236553SJohannes Berg  *
5577d3236553SJohannes Berg  * @wiphy: The wiphy to unregister.
5578d3236553SJohannes Berg  *
5579d3236553SJohannes Berg  * After this call, no more requests can be made with this priv
5580d3236553SJohannes Berg  * pointer, but the call may sleep to wait for an outstanding
5581d3236553SJohannes Berg  * request that is being handled.
5582d3236553SJohannes Berg  */
558310dd9b7cSJoe Perches void wiphy_unregister(struct wiphy *wiphy);
5584d3236553SJohannes Berg 
5585d3236553SJohannes Berg /**
5586d3236553SJohannes Berg  * wiphy_free - free wiphy
5587d3236553SJohannes Berg  *
5588d3236553SJohannes Berg  * @wiphy: The wiphy to free
5589d3236553SJohannes Berg  */
559010dd9b7cSJoe Perches void wiphy_free(struct wiphy *wiphy);
5591d3236553SJohannes Berg 
5592fffd0934SJohannes Berg /* internal structs */
55936829c878SJohannes Berg struct cfg80211_conn;
559419957bb3SJohannes Berg struct cfg80211_internal_bss;
5595fffd0934SJohannes Berg struct cfg80211_cached_keys;
55964a4b8169SAndrew Zaborowski struct cfg80211_cqm_config;
559719957bb3SJohannes Berg 
5598d3236553SJohannes Berg /**
5599a05829a7SJohannes Berg  * wiphy_lock - lock the wiphy
5600a05829a7SJohannes Berg  * @wiphy: the wiphy to lock
5601a05829a7SJohannes Berg  *
5602a05829a7SJohannes Berg  * This is mostly exposed so it can be done around registering and
5603a05829a7SJohannes Berg  * unregistering netdevs that aren't created through cfg80211 calls,
5604a05829a7SJohannes Berg  * since that requires locking in cfg80211 when the notifiers is
5605a05829a7SJohannes Berg  * called, but that cannot differentiate which way it's called.
5606a05829a7SJohannes Berg  *
5607a05829a7SJohannes Berg  * When cfg80211 ops are called, the wiphy is already locked.
5608a05829a7SJohannes Berg  */
5609a05829a7SJohannes Berg static inline void wiphy_lock(struct wiphy *wiphy)
5610a05829a7SJohannes Berg 	__acquires(&wiphy->mtx)
5611a05829a7SJohannes Berg {
5612a05829a7SJohannes Berg 	mutex_lock(&wiphy->mtx);
5613a05829a7SJohannes Berg 	__acquire(&wiphy->mtx);
5614a05829a7SJohannes Berg }
5615a05829a7SJohannes Berg 
5616a05829a7SJohannes Berg /**
5617a05829a7SJohannes Berg  * wiphy_unlock - unlock the wiphy again
5618a05829a7SJohannes Berg  * @wiphy: the wiphy to unlock
5619a05829a7SJohannes Berg  */
5620a05829a7SJohannes Berg static inline void wiphy_unlock(struct wiphy *wiphy)
5621a05829a7SJohannes Berg 	__releases(&wiphy->mtx)
5622a05829a7SJohannes Berg {
5623a05829a7SJohannes Berg 	__release(&wiphy->mtx);
5624a05829a7SJohannes Berg 	mutex_unlock(&wiphy->mtx);
5625a05829a7SJohannes Berg }
5626a05829a7SJohannes Berg 
5627a05829a7SJohannes Berg /**
562889a54e48SJohannes Berg  * struct wireless_dev - wireless device state
5629d3236553SJohannes Berg  *
563089a54e48SJohannes Berg  * For netdevs, this structure must be allocated by the driver
563189a54e48SJohannes Berg  * that uses the ieee80211_ptr field in struct net_device (this
563289a54e48SJohannes Berg  * is intentional so it can be allocated along with the netdev.)
563389a54e48SJohannes Berg  * It need not be registered then as netdev registration will
5634a05829a7SJohannes Berg  * be intercepted by cfg80211 to see the new wireless device,
5635a05829a7SJohannes Berg  * however, drivers must lock the wiphy before registering or
5636a05829a7SJohannes Berg  * unregistering netdevs if they pre-create any netdevs (in ops
5637a05829a7SJohannes Berg  * called from cfg80211, the wiphy is already locked.)
563889a54e48SJohannes Berg  *
563989a54e48SJohannes Berg  * For non-netdev uses, it must also be allocated by the driver
564089a54e48SJohannes Berg  * in response to the cfg80211 callbacks that require it, as
564189a54e48SJohannes Berg  * there's no netdev registration in that case it may not be
564289a54e48SJohannes Berg  * allocated outside of callback operations that return it.
5643d3236553SJohannes Berg  *
5644d3236553SJohannes Berg  * @wiphy: pointer to hardware description
5645d3236553SJohannes Berg  * @iftype: interface type
56462fe8ef10SJohannes Berg  * @registered: is this wdev already registered with cfg80211
564740c575d1SJohannes Berg  * @registering: indicates we're doing registration under wiphy lock
564840c575d1SJohannes Berg  *	for the notifier
5649d3236553SJohannes Berg  * @list: (private) Used to collect the interfaces
565089a54e48SJohannes Berg  * @netdev: (private) Used to reference back to the netdev, may be %NULL
565189a54e48SJohannes Berg  * @identifier: (private) Identifier used in nl80211 to identify this
565289a54e48SJohannes Berg  *	wireless device if it has no netdev
56532d8b08feSMauro Carvalho Chehab  * @u: union containing data specific to @iftype
56547b0a0e3cSJohannes Berg  * @connected: indicates if connected or not (STA mode)
5655d3236553SJohannes Berg  * @bssid: (private) Used by the internal configuration code
5656d3236553SJohannes Berg  * @wext: (private) Used by the internal wireless extensions compat code
56579874b71fSJohannes Berg  * @wext.ibss: (private) IBSS data part of wext handling
56589874b71fSJohannes Berg  * @wext.connect: (private) connection handling data
56599874b71fSJohannes Berg  * @wext.keys: (private) (WEP) key data
56609874b71fSJohannes Berg  * @wext.ie: (private) extra elements for association
56619874b71fSJohannes Berg  * @wext.ie_len: (private) length of extra elements
56629874b71fSJohannes Berg  * @wext.bssid: (private) selected network BSSID
56639874b71fSJohannes Berg  * @wext.ssid: (private) selected network SSID
56649874b71fSJohannes Berg  * @wext.default_key: (private) selected default key index
56659874b71fSJohannes Berg  * @wext.default_mgmt_key: (private) selected default management key index
56669874b71fSJohannes Berg  * @wext.prev_bssid: (private) previous BSSID for reassociation
56679874b71fSJohannes Berg  * @wext.prev_bssid_valid: (private) previous BSSID validity
56689bc383deSJohannes Berg  * @use_4addr: indicates 4addr mode is used on this interface, must be
56699bc383deSJohannes Berg  *	set by driver (if supported) on add_interface BEFORE registering the
56709bc383deSJohannes Berg  *	netdev and may otherwise be used by driver read-only, will be update
56719bc383deSJohannes Berg  *	by cfg80211 on change_interface
56722e161f78SJohannes Berg  * @mgmt_registrations: list of registrations for management frames
567379ea1e12SJohannes Berg  * @mgmt_registrations_need_update: mgmt registrations were updated,
567479ea1e12SJohannes Berg  *	need to propagate the update to the driver
56758d61ffa5SJohannes Berg  * @mtx: mutex used to lock data in this struct, may be used by drivers
56768d61ffa5SJohannes Berg  *	and some API functions require it held
567756d1893dSJohannes Berg  * @beacon_interval: beacon interval used on this device for transmitting
567856d1893dSJohannes Berg  *	beacons, 0 when not valid
567998104fdeSJohannes Berg  * @address: The address for this device, valid only if @netdev is %NULL
568073c7da3dSArend Van Spriel  * @is_running: true if this is a non-netdev device that has been started, e.g.
568173c7da3dSArend Van Spriel  *	the P2P Device.
568204f39047SSimon Wunderlich  * @cac_started: true if DFS channel availability check has been started
568304f39047SSimon Wunderlich  * @cac_start_time: timestamp (jiffies) when the dfs state was entered.
568431559f35SJanusz Dziedzic  * @cac_time_ms: CAC time in ms
5685780b40dfSJohannes Berg  * @ps: powersave mode is enabled
5686780b40dfSJohannes Berg  * @ps_timeout: dynamic powersave timeout
5687780b40dfSJohannes Berg  * @ap_unexpected_nlportid: (private) netlink port ID of application
5688780b40dfSJohannes Berg  *	registered for unexpected class 3 frames (AP mode)
5689780b40dfSJohannes Berg  * @conn: (private) cfg80211 software SME connection state machine data
5690780b40dfSJohannes Berg  * @connect_keys: (private) keys to set after connection is established
569134d50519SLior David  * @conn_bss_type: connecting/connected BSS type
5692bd2522b1SAndrzej Zaborowski  * @conn_owner_nlportid: (private) connection owner socket port ID
5693bd2522b1SAndrzej Zaborowski  * @disconnect_wk: (private) auto-disconnect work
5694bd2522b1SAndrzej Zaborowski  * @disconnect_bssid: (private) the BSSID to use for auto-disconnect
5695780b40dfSJohannes Berg  * @event_list: (private) list for internal event processing
5696780b40dfSJohannes Berg  * @event_lock: (private) lock for event list
569778f22b6aSJohannes Berg  * @owner_nlportid: (private) owner socket port ID
5698ab81007aSJohannes Berg  * @nl_owner_dead: (private) owner socket went away
56994a4b8169SAndrew Zaborowski  * @cqm_config: (private) nl80211 RSSI monitor state
57009bb7e0f2SJohannes Berg  * @pmsr_list: (private) peer measurement requests
57019bb7e0f2SJohannes Berg  * @pmsr_lock: (private) peer measurements requests/results lock
57029bb7e0f2SJohannes Berg  * @pmsr_free_wk: (private) peer measurements cleanup work
57034d797fceSJouni Malinen  * @unprot_beacon_reported: (private) timestamp of last
57044d797fceSJouni Malinen  *	unprotected beacon report
57052d8b08feSMauro Carvalho Chehab  * @links: array of %IEEE80211_MLD_MAX_NUM_LINKS elements containing @addr
57062d8b08feSMauro Carvalho Chehab  *	@ap and @client for each link
57072d8b08feSMauro Carvalho Chehab  * @valid_links: bitmap describing what elements of @links are valid
5708d3236553SJohannes Berg  */
5709d3236553SJohannes Berg struct wireless_dev {
5710d3236553SJohannes Berg 	struct wiphy *wiphy;
5711d3236553SJohannes Berg 	enum nl80211_iftype iftype;
5712d3236553SJohannes Berg 
5713667503ddSJohannes Berg 	/* the remainder of this struct should be private to cfg80211 */
5714d3236553SJohannes Berg 	struct list_head list;
5715d3236553SJohannes Berg 	struct net_device *netdev;
5716d3236553SJohannes Berg 
571789a54e48SJohannes Berg 	u32 identifier;
571889a54e48SJohannes Berg 
57192e161f78SJohannes Berg 	struct list_head mgmt_registrations;
572079ea1e12SJohannes Berg 	u8 mgmt_registrations_need_update:1;
5721026331c4SJouni Malinen 
5722667503ddSJohannes Berg 	struct mutex mtx;
5723667503ddSJohannes Berg 
572440c575d1SJohannes Berg 	bool use_4addr, is_running, registered, registering;
572598104fdeSJohannes Berg 
572698104fdeSJohannes Berg 	u8 address[ETH_ALEN] __aligned(sizeof(u16));
57279bc383deSJohannes Berg 
5728b23aa676SSamuel Ortiz 	/* currently used for IBSS and SME - might be rearranged later */
57296829c878SJohannes Berg 	struct cfg80211_conn *conn;
5730fffd0934SJohannes Berg 	struct cfg80211_cached_keys *connect_keys;
573134d50519SLior David 	enum ieee80211_bss_type conn_bss_type;
5732bd2522b1SAndrzej Zaborowski 	u32 conn_owner_nlportid;
5733bd2522b1SAndrzej Zaborowski 
5734bd2522b1SAndrzej Zaborowski 	struct work_struct disconnect_wk;
5735bd2522b1SAndrzej Zaborowski 	u8 disconnect_bssid[ETH_ALEN];
5736d3236553SJohannes Berg 
5737667503ddSJohannes Berg 	struct list_head event_list;
5738667503ddSJohannes Berg 	spinlock_t event_lock;
5739667503ddSJohannes Berg 
57407b0a0e3cSJohannes Berg 	u8 connected:1;
5741f4489ebeSMichal Kazior 
5742ffb9eb3dSKalle Valo 	bool ps;
5743ffb9eb3dSKalle Valo 	int ps_timeout;
5744ffb9eb3dSKalle Valo 
574515e47304SEric W. Biederman 	u32 ap_unexpected_nlportid;
574628946da7SJohannes Berg 
5747ab81007aSJohannes Berg 	u32 owner_nlportid;
5748ab81007aSJohannes Berg 	bool nl_owner_dead;
5749ab81007aSJohannes Berg 
57507b0a0e3cSJohannes Berg 	/* FIXME: need to rework radar detection for MLO */
575104f39047SSimon Wunderlich 	bool cac_started;
575204f39047SSimon Wunderlich 	unsigned long cac_start_time;
575331559f35SJanusz Dziedzic 	unsigned int cac_time_ms;
575404f39047SSimon Wunderlich 
57553d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT
5756d3236553SJohannes Berg 	/* wext data */
5757cbe8fa9cSJohannes Berg 	struct {
5758cbe8fa9cSJohannes Berg 		struct cfg80211_ibss_params ibss;
5759f2129354SJohannes Berg 		struct cfg80211_connect_params connect;
5760fffd0934SJohannes Berg 		struct cfg80211_cached_keys *keys;
5761c1e5f471SJohannes Berg 		const u8 *ie;
5762f2129354SJohannes Berg 		size_t ie_len;
57639874b71fSJohannes Berg 		u8 bssid[ETH_ALEN];
57649874b71fSJohannes Berg 		u8 prev_bssid[ETH_ALEN];
5765f2129354SJohannes Berg 		u8 ssid[IEEE80211_MAX_SSID_LEN];
576608645126SJohannes Berg 		s8 default_key, default_mgmt_key;
5767ffb9eb3dSKalle Valo 		bool prev_bssid_valid;
5768cbe8fa9cSJohannes Berg 	} wext;
5769d3236553SJohannes Berg #endif
57704a4b8169SAndrew Zaborowski 
57714a4b8169SAndrew Zaborowski 	struct cfg80211_cqm_config *cqm_config;
57729bb7e0f2SJohannes Berg 
57739bb7e0f2SJohannes Berg 	struct list_head pmsr_list;
57749bb7e0f2SJohannes Berg 	spinlock_t pmsr_lock;
57759bb7e0f2SJohannes Berg 	struct work_struct pmsr_free_wk;
57764d797fceSJouni Malinen 
57774d797fceSJouni Malinen 	unsigned long unprot_beacon_reported;
57787b0a0e3cSJohannes Berg 
57797b0a0e3cSJohannes Berg 	union {
57807b0a0e3cSJohannes Berg 		struct {
57817b0a0e3cSJohannes Berg 			u8 connected_addr[ETH_ALEN] __aligned(2);
57827b0a0e3cSJohannes Berg 			u8 ssid[IEEE80211_MAX_SSID_LEN];
57837b0a0e3cSJohannes Berg 			u8 ssid_len;
57847b0a0e3cSJohannes Berg 		} client;
57857b0a0e3cSJohannes Berg 		struct {
57867b0a0e3cSJohannes Berg 			int beacon_interval;
57877b0a0e3cSJohannes Berg 			struct cfg80211_chan_def preset_chandef;
57887b0a0e3cSJohannes Berg 			struct cfg80211_chan_def chandef;
57897b0a0e3cSJohannes Berg 			u8 id[IEEE80211_MAX_SSID_LEN];
57907b0a0e3cSJohannes Berg 			u8 id_len, id_up_len;
57917b0a0e3cSJohannes Berg 		} mesh;
57927b0a0e3cSJohannes Berg 		struct {
57937b0a0e3cSJohannes Berg 			struct cfg80211_chan_def preset_chandef;
57947b0a0e3cSJohannes Berg 			u8 ssid[IEEE80211_MAX_SSID_LEN];
57957b0a0e3cSJohannes Berg 			u8 ssid_len;
57967b0a0e3cSJohannes Berg 		} ap;
57977b0a0e3cSJohannes Berg 		struct {
57987b0a0e3cSJohannes Berg 			struct cfg80211_internal_bss *current_bss;
57997b0a0e3cSJohannes Berg 			struct cfg80211_chan_def chandef;
58007b0a0e3cSJohannes Berg 			int beacon_interval;
58017b0a0e3cSJohannes Berg 			u8 ssid[IEEE80211_MAX_SSID_LEN];
58027b0a0e3cSJohannes Berg 			u8 ssid_len;
58037b0a0e3cSJohannes Berg 		} ibss;
58047b0a0e3cSJohannes Berg 		struct {
58057b0a0e3cSJohannes Berg 			struct cfg80211_chan_def chandef;
58067b0a0e3cSJohannes Berg 		} ocb;
58077b0a0e3cSJohannes Berg 	} u;
58087b0a0e3cSJohannes Berg 
58097b0a0e3cSJohannes Berg 	struct {
58107b0a0e3cSJohannes Berg 		u8 addr[ETH_ALEN] __aligned(2);
58117b0a0e3cSJohannes Berg 		union {
58127b0a0e3cSJohannes Berg 			struct {
58137b0a0e3cSJohannes Berg 				unsigned int beacon_interval;
58147b0a0e3cSJohannes Berg 				struct cfg80211_chan_def chandef;
58157b0a0e3cSJohannes Berg 			} ap;
58167b0a0e3cSJohannes Berg 			struct {
58177b0a0e3cSJohannes Berg 				struct cfg80211_internal_bss *current_bss;
58187b0a0e3cSJohannes Berg 			} client;
58197b0a0e3cSJohannes Berg 		};
58207b0a0e3cSJohannes Berg 	} links[IEEE80211_MLD_MAX_NUM_LINKS];
58217b0a0e3cSJohannes Berg 	u16 valid_links;
5822d3236553SJohannes Berg };
5823d3236553SJohannes Berg 
582410de5a59SJakub Kicinski static inline const u8 *wdev_address(struct wireless_dev *wdev)
582598104fdeSJohannes Berg {
582698104fdeSJohannes Berg 	if (wdev->netdev)
582798104fdeSJohannes Berg 		return wdev->netdev->dev_addr;
582898104fdeSJohannes Berg 	return wdev->address;
582998104fdeSJohannes Berg }
583098104fdeSJohannes Berg 
583173c7da3dSArend Van Spriel static inline bool wdev_running(struct wireless_dev *wdev)
583273c7da3dSArend Van Spriel {
583373c7da3dSArend Van Spriel 	if (wdev->netdev)
583473c7da3dSArend Van Spriel 		return netif_running(wdev->netdev);
583573c7da3dSArend Van Spriel 	return wdev->is_running;
583673c7da3dSArend Van Spriel }
583773c7da3dSArend Van Spriel 
5838d3236553SJohannes Berg /**
5839d3236553SJohannes Berg  * wdev_priv - return wiphy priv from wireless_dev
5840d3236553SJohannes Berg  *
5841d3236553SJohannes Berg  * @wdev: The wireless device whose wiphy's priv pointer to return
58420ae997dcSYacine Belkadi  * Return: The wiphy priv of @wdev.
5843d3236553SJohannes Berg  */
5844d3236553SJohannes Berg static inline void *wdev_priv(struct wireless_dev *wdev)
5845d3236553SJohannes Berg {
5846d3236553SJohannes Berg 	BUG_ON(!wdev);
5847d3236553SJohannes Berg 	return wiphy_priv(wdev->wiphy);
5848d3236553SJohannes Berg }
5849d3236553SJohannes Berg 
5850d70e9693SJohannes Berg /**
58517b0a0e3cSJohannes Berg  * wdev_chandef - return chandef pointer from wireless_dev
58527b0a0e3cSJohannes Berg  * @wdev: the wdev
58537b0a0e3cSJohannes Berg  * @link_id: the link ID for MLO
58547b0a0e3cSJohannes Berg  *
58557b0a0e3cSJohannes Berg  * Return: The chandef depending on the mode, or %NULL.
58567b0a0e3cSJohannes Berg  */
58577b0a0e3cSJohannes Berg struct cfg80211_chan_def *wdev_chandef(struct wireless_dev *wdev,
58587b0a0e3cSJohannes Berg 				       unsigned int link_id);
58597b0a0e3cSJohannes Berg 
58607b0a0e3cSJohannes Berg static inline void WARN_INVALID_LINK_ID(struct wireless_dev *wdev,
58617b0a0e3cSJohannes Berg 					unsigned int link_id)
58627b0a0e3cSJohannes Berg {
58637b0a0e3cSJohannes Berg 	WARN_ON(link_id && !wdev->valid_links);
58647b0a0e3cSJohannes Berg 	WARN_ON(wdev->valid_links &&
58657b0a0e3cSJohannes Berg 		!(wdev->valid_links & BIT(link_id)));
58667b0a0e3cSJohannes Berg }
58677b0a0e3cSJohannes Berg 
5868efbabc11SVeerendranath Jakkam #define for_each_valid_link(link_info, link_id)			\
58697b0a0e3cSJohannes Berg 	for (link_id = 0;					\
5870efbabc11SVeerendranath Jakkam 	     link_id < ((link_info)->valid_links ?		\
5871efbabc11SVeerendranath Jakkam 			ARRAY_SIZE((link_info)->links) : 1);	\
58727b0a0e3cSJohannes Berg 	     link_id++)						\
5873efbabc11SVeerendranath Jakkam 		if (!(link_info)->valid_links ||		\
5874efbabc11SVeerendranath Jakkam 		    ((link_info)->valid_links & BIT(link_id)))
58757b0a0e3cSJohannes Berg 
58767b0a0e3cSJohannes Berg /**
5877d70e9693SJohannes Berg  * DOC: Utility functions
5878d70e9693SJohannes Berg  *
5879d70e9693SJohannes Berg  * cfg80211 offers a number of utility functions that can be useful.
5880d3236553SJohannes Berg  */
5881d3236553SJohannes Berg 
5882d3236553SJohannes Berg /**
5883934f4c7dSThomas Pedersen  * ieee80211_channel_equal - compare two struct ieee80211_channel
5884934f4c7dSThomas Pedersen  *
5885934f4c7dSThomas Pedersen  * @a: 1st struct ieee80211_channel
5886934f4c7dSThomas Pedersen  * @b: 2nd struct ieee80211_channel
5887934f4c7dSThomas Pedersen  * Return: true if center frequency of @a == @b
5888934f4c7dSThomas Pedersen  */
5889934f4c7dSThomas Pedersen static inline bool
5890934f4c7dSThomas Pedersen ieee80211_channel_equal(struct ieee80211_channel *a,
5891934f4c7dSThomas Pedersen 			struct ieee80211_channel *b)
5892934f4c7dSThomas Pedersen {
5893934f4c7dSThomas Pedersen 	return (a->center_freq == b->center_freq &&
5894934f4c7dSThomas Pedersen 		a->freq_offset == b->freq_offset);
5895934f4c7dSThomas Pedersen }
5896934f4c7dSThomas Pedersen 
5897934f4c7dSThomas Pedersen /**
5898934f4c7dSThomas Pedersen  * ieee80211_channel_to_khz - convert ieee80211_channel to frequency in KHz
5899934f4c7dSThomas Pedersen  * @chan: struct ieee80211_channel to convert
5900934f4c7dSThomas Pedersen  * Return: The corresponding frequency (in KHz)
5901934f4c7dSThomas Pedersen  */
5902934f4c7dSThomas Pedersen static inline u32
5903934f4c7dSThomas Pedersen ieee80211_channel_to_khz(const struct ieee80211_channel *chan)
5904934f4c7dSThomas Pedersen {
5905934f4c7dSThomas Pedersen 	return MHZ_TO_KHZ(chan->center_freq) + chan->freq_offset;
5906934f4c7dSThomas Pedersen }
5907934f4c7dSThomas Pedersen 
5908934f4c7dSThomas Pedersen /**
590911b34737SThomas Pedersen  * ieee80211_s1g_channel_width - get allowed channel width from @chan
591011b34737SThomas Pedersen  *
591111b34737SThomas Pedersen  * Only allowed for band NL80211_BAND_S1GHZ
591211b34737SThomas Pedersen  * @chan: channel
591311b34737SThomas Pedersen  * Return: The allowed channel width for this center_freq
591411b34737SThomas Pedersen  */
591511b34737SThomas Pedersen enum nl80211_chan_width
591611b34737SThomas Pedersen ieee80211_s1g_channel_width(const struct ieee80211_channel *chan);
591711b34737SThomas Pedersen 
591811b34737SThomas Pedersen /**
5919934f4c7dSThomas Pedersen  * ieee80211_channel_to_freq_khz - convert channel number to frequency
5920934f4c7dSThomas Pedersen  * @chan: channel number
5921934f4c7dSThomas Pedersen  * @band: band, necessary due to channel number overlap
5922934f4c7dSThomas Pedersen  * Return: The corresponding frequency (in KHz), or 0 if the conversion failed.
5923934f4c7dSThomas Pedersen  */
5924934f4c7dSThomas Pedersen u32 ieee80211_channel_to_freq_khz(int chan, enum nl80211_band band);
5925934f4c7dSThomas Pedersen 
5926934f4c7dSThomas Pedersen /**
5927d3236553SJohannes Berg  * ieee80211_channel_to_frequency - convert channel number to frequency
5928abe37c4bSJohannes Berg  * @chan: channel number
592959eb21a6SBruno Randolf  * @band: band, necessary due to channel number overlap
59300ae997dcSYacine Belkadi  * Return: The corresponding frequency (in MHz), or 0 if the conversion failed.
5931d3236553SJohannes Berg  */
5932934f4c7dSThomas Pedersen static inline int
5933934f4c7dSThomas Pedersen ieee80211_channel_to_frequency(int chan, enum nl80211_band band)
5934934f4c7dSThomas Pedersen {
5935934f4c7dSThomas Pedersen 	return KHZ_TO_MHZ(ieee80211_channel_to_freq_khz(chan, band));
5936934f4c7dSThomas Pedersen }
5937934f4c7dSThomas Pedersen 
5938934f4c7dSThomas Pedersen /**
5939934f4c7dSThomas Pedersen  * ieee80211_freq_khz_to_channel - convert frequency to channel number
5940934f4c7dSThomas Pedersen  * @freq: center frequency in KHz
5941934f4c7dSThomas Pedersen  * Return: The corresponding channel, or 0 if the conversion failed.
5942934f4c7dSThomas Pedersen  */
5943934f4c7dSThomas Pedersen int ieee80211_freq_khz_to_channel(u32 freq);
5944d3236553SJohannes Berg 
5945d3236553SJohannes Berg /**
5946d3236553SJohannes Berg  * ieee80211_frequency_to_channel - convert frequency to channel number
5947934f4c7dSThomas Pedersen  * @freq: center frequency in MHz
59480ae997dcSYacine Belkadi  * Return: The corresponding channel, or 0 if the conversion failed.
5949d3236553SJohannes Berg  */
5950934f4c7dSThomas Pedersen static inline int
5951934f4c7dSThomas Pedersen ieee80211_frequency_to_channel(int freq)
5952934f4c7dSThomas Pedersen {
5953934f4c7dSThomas Pedersen 	return ieee80211_freq_khz_to_channel(MHZ_TO_KHZ(freq));
5954934f4c7dSThomas Pedersen }
5955934f4c7dSThomas Pedersen 
5956934f4c7dSThomas Pedersen /**
5957934f4c7dSThomas Pedersen  * ieee80211_get_channel_khz - get channel struct from wiphy for specified
5958934f4c7dSThomas Pedersen  * frequency
5959934f4c7dSThomas Pedersen  * @wiphy: the struct wiphy to get the channel for
5960934f4c7dSThomas Pedersen  * @freq: the center frequency (in KHz) of the channel
5961934f4c7dSThomas Pedersen  * Return: The channel struct from @wiphy at @freq.
5962934f4c7dSThomas Pedersen  */
5963934f4c7dSThomas Pedersen struct ieee80211_channel *
5964934f4c7dSThomas Pedersen ieee80211_get_channel_khz(struct wiphy *wiphy, u32 freq);
5965d3236553SJohannes Berg 
5966d3236553SJohannes Berg /**
5967d3236553SJohannes Berg  * ieee80211_get_channel - get channel struct from wiphy for specified frequency
5968543b921bSArend Van Spriel  *
5969abe37c4bSJohannes Berg  * @wiphy: the struct wiphy to get the channel for
5970934f4c7dSThomas Pedersen  * @freq: the center frequency (in MHz) of the channel
59710ae997dcSYacine Belkadi  * Return: The channel struct from @wiphy at @freq.
5972d3236553SJohannes Berg  */
5973934f4c7dSThomas Pedersen static inline struct ieee80211_channel *
5974934f4c7dSThomas Pedersen ieee80211_get_channel(struct wiphy *wiphy, int freq)
5975934f4c7dSThomas Pedersen {
5976934f4c7dSThomas Pedersen 	return ieee80211_get_channel_khz(wiphy, MHZ_TO_KHZ(freq));
5977934f4c7dSThomas Pedersen }
5978d3236553SJohannes Berg 
5979d3236553SJohannes Berg /**
5980afbc9c9eSJohannes Berg  * cfg80211_channel_is_psc - Check if the channel is a 6 GHz PSC
5981afbc9c9eSJohannes Berg  * @chan: control channel to check
5982afbc9c9eSJohannes Berg  *
5983afbc9c9eSJohannes Berg  * The Preferred Scanning Channels (PSC) are defined in
5984afbc9c9eSJohannes Berg  * Draft IEEE P802.11ax/D5.0, 26.17.2.3.3
5985afbc9c9eSJohannes Berg  */
5986afbc9c9eSJohannes Berg static inline bool cfg80211_channel_is_psc(struct ieee80211_channel *chan)
5987afbc9c9eSJohannes Berg {
5988afbc9c9eSJohannes Berg 	if (chan->band != NL80211_BAND_6GHZ)
5989afbc9c9eSJohannes Berg 		return false;
5990afbc9c9eSJohannes Berg 
5991afbc9c9eSJohannes Berg 	return ieee80211_frequency_to_channel(chan->center_freq) % 16 == 5;
5992afbc9c9eSJohannes Berg }
5993afbc9c9eSJohannes Berg 
5994afbc9c9eSJohannes Berg /**
5995d3236553SJohannes Berg  * ieee80211_get_response_rate - get basic rate for a given rate
5996d3236553SJohannes Berg  *
5997d3236553SJohannes Berg  * @sband: the band to look for rates in
5998d3236553SJohannes Berg  * @basic_rates: bitmap of basic rates
5999d3236553SJohannes Berg  * @bitrate: the bitrate for which to find the basic rate
6000d3236553SJohannes Berg  *
60010ae997dcSYacine Belkadi  * Return: The basic rate corresponding to a given bitrate, that
60020ae997dcSYacine Belkadi  * is the next lower bitrate contained in the basic rate map,
60030ae997dcSYacine Belkadi  * which is, for this function, given as a bitmap of indices of
60040ae997dcSYacine Belkadi  * rates in the band's bitrate table.
6005d3236553SJohannes Berg  */
6006623b988fSJoe Perches const struct ieee80211_rate *
6007d3236553SJohannes Berg ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
6008d3236553SJohannes Berg 			    u32 basic_rates, int bitrate);
6009d3236553SJohannes Berg 
6010b422c6cdSAshok Nagarajan /**
6011b422c6cdSAshok Nagarajan  * ieee80211_mandatory_rates - get mandatory rates for a given band
6012b422c6cdSAshok Nagarajan  * @sband: the band to look for rates in
601374608acaSSimon Wunderlich  * @scan_width: width of the control channel
6014b422c6cdSAshok Nagarajan  *
6015b422c6cdSAshok Nagarajan  * This function returns a bitmap of the mandatory rates for the given
6016b422c6cdSAshok Nagarajan  * band, bits are set according to the rate position in the bitrates array.
6017b422c6cdSAshok Nagarajan  */
601874608acaSSimon Wunderlich u32 ieee80211_mandatory_rates(struct ieee80211_supported_band *sband,
601974608acaSSimon Wunderlich 			      enum nl80211_bss_scan_width scan_width);
6020b422c6cdSAshok Nagarajan 
6021d3236553SJohannes Berg /*
6022d3236553SJohannes Berg  * Radiotap parsing functions -- for controlled injection support
6023d3236553SJohannes Berg  *
6024d3236553SJohannes Berg  * Implemented in net/wireless/radiotap.c
602566d495d0SMauro Carvalho Chehab  * Documentation in Documentation/networking/radiotap-headers.rst
6026d3236553SJohannes Berg  */
6027d3236553SJohannes Berg 
602833e5a2f7SJohannes Berg struct radiotap_align_size {
602933e5a2f7SJohannes Berg 	uint8_t align:4, size:4;
603033e5a2f7SJohannes Berg };
603133e5a2f7SJohannes Berg 
603233e5a2f7SJohannes Berg struct ieee80211_radiotap_namespace {
603333e5a2f7SJohannes Berg 	const struct radiotap_align_size *align_size;
603433e5a2f7SJohannes Berg 	int n_bits;
603533e5a2f7SJohannes Berg 	uint32_t oui;
603633e5a2f7SJohannes Berg 	uint8_t subns;
603733e5a2f7SJohannes Berg };
603833e5a2f7SJohannes Berg 
603933e5a2f7SJohannes Berg struct ieee80211_radiotap_vendor_namespaces {
604033e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_namespace *ns;
604133e5a2f7SJohannes Berg 	int n_ns;
604233e5a2f7SJohannes Berg };
604333e5a2f7SJohannes Berg 
6044d3236553SJohannes Berg /**
6045d3236553SJohannes Berg  * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args
604633e5a2f7SJohannes Berg  * @this_arg_index: index of current arg, valid after each successful call
604733e5a2f7SJohannes Berg  *	to ieee80211_radiotap_iterator_next()
604833e5a2f7SJohannes Berg  * @this_arg: pointer to current radiotap arg; it is valid after each
604933e5a2f7SJohannes Berg  *	call to ieee80211_radiotap_iterator_next() but also after
605033e5a2f7SJohannes Berg  *	ieee80211_radiotap_iterator_init() where it will point to
605133e5a2f7SJohannes Berg  *	the beginning of the actual data portion
605233e5a2f7SJohannes Berg  * @this_arg_size: length of the current arg, for convenience
605333e5a2f7SJohannes Berg  * @current_namespace: pointer to the current namespace definition
605433e5a2f7SJohannes Berg  *	(or internally %NULL if the current namespace is unknown)
605533e5a2f7SJohannes Berg  * @is_radiotap_ns: indicates whether the current namespace is the default
605633e5a2f7SJohannes Berg  *	radiotap namespace or not
605733e5a2f7SJohannes Berg  *
605833e5a2f7SJohannes Berg  * @_rtheader: pointer to the radiotap header we are walking through
605933e5a2f7SJohannes Berg  * @_max_length: length of radiotap header in cpu byte ordering
606033e5a2f7SJohannes Berg  * @_arg_index: next argument index
606133e5a2f7SJohannes Berg  * @_arg: next argument pointer
606233e5a2f7SJohannes Berg  * @_next_bitmap: internal pointer to next present u32
606333e5a2f7SJohannes Berg  * @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present
606433e5a2f7SJohannes Berg  * @_vns: vendor namespace definitions
606533e5a2f7SJohannes Berg  * @_next_ns_data: beginning of the next namespace's data
606633e5a2f7SJohannes Berg  * @_reset_on_ext: internal; reset the arg index to 0 when going to the
606733e5a2f7SJohannes Berg  *	next bitmap word
606833e5a2f7SJohannes Berg  *
606933e5a2f7SJohannes Berg  * Describes the radiotap parser state. Fields prefixed with an underscore
607033e5a2f7SJohannes Berg  * must not be used by users of the parser, only by the parser internally.
6071d3236553SJohannes Berg  */
6072d3236553SJohannes Berg 
6073d3236553SJohannes Berg struct ieee80211_radiotap_iterator {
607433e5a2f7SJohannes Berg 	struct ieee80211_radiotap_header *_rtheader;
607533e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_vendor_namespaces *_vns;
607633e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_namespace *current_namespace;
6077d3236553SJohannes Berg 
607833e5a2f7SJohannes Berg 	unsigned char *_arg, *_next_ns_data;
607967272440SJohannes Berg 	__le32 *_next_bitmap;
608033e5a2f7SJohannes Berg 
608133e5a2f7SJohannes Berg 	unsigned char *this_arg;
608233e5a2f7SJohannes Berg 	int this_arg_index;
608333e5a2f7SJohannes Berg 	int this_arg_size;
608433e5a2f7SJohannes Berg 
608533e5a2f7SJohannes Berg 	int is_radiotap_ns;
608633e5a2f7SJohannes Berg 
608733e5a2f7SJohannes Berg 	int _max_length;
608833e5a2f7SJohannes Berg 	int _arg_index;
608933e5a2f7SJohannes Berg 	uint32_t _bitmap_shifter;
609033e5a2f7SJohannes Berg 	int _reset_on_ext;
6091d3236553SJohannes Berg };
6092d3236553SJohannes Berg 
609310dd9b7cSJoe Perches int
609410dd9b7cSJoe Perches ieee80211_radiotap_iterator_init(struct ieee80211_radiotap_iterator *iterator,
6095d3236553SJohannes Berg 				 struct ieee80211_radiotap_header *radiotap_header,
609610dd9b7cSJoe Perches 				 int max_length,
609710dd9b7cSJoe Perches 				 const struct ieee80211_radiotap_vendor_namespaces *vns);
6098d3236553SJohannes Berg 
609910dd9b7cSJoe Perches int
610010dd9b7cSJoe Perches ieee80211_radiotap_iterator_next(struct ieee80211_radiotap_iterator *iterator);
6101d3236553SJohannes Berg 
610233e5a2f7SJohannes Berg 
6103e31a16d6SZhu Yi extern const unsigned char rfc1042_header[6];
6104e31a16d6SZhu Yi extern const unsigned char bridge_tunnel_header[6];
6105e31a16d6SZhu Yi 
6106e31a16d6SZhu Yi /**
6107e31a16d6SZhu Yi  * ieee80211_get_hdrlen_from_skb - get header length from data
6108e31a16d6SZhu Yi  *
6109e31a16d6SZhu Yi  * @skb: the frame
61100ae997dcSYacine Belkadi  *
61110ae997dcSYacine Belkadi  * Given an skb with a raw 802.11 header at the data pointer this function
61120ae997dcSYacine Belkadi  * returns the 802.11 header length.
61130ae997dcSYacine Belkadi  *
61140ae997dcSYacine Belkadi  * Return: The 802.11 header length in bytes (not including encryption
61150ae997dcSYacine Belkadi  * headers). Or 0 if the data in the sk_buff is too short to contain a valid
61160ae997dcSYacine Belkadi  * 802.11 header.
6117e31a16d6SZhu Yi  */
6118e31a16d6SZhu Yi unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb);
6119e31a16d6SZhu Yi 
6120e31a16d6SZhu Yi /**
6121e31a16d6SZhu Yi  * ieee80211_hdrlen - get header length in bytes from frame control
6122e31a16d6SZhu Yi  * @fc: frame control field in little-endian format
61230ae997dcSYacine Belkadi  * Return: The header length in bytes.
6124e31a16d6SZhu Yi  */
6125633adf1aSJohannes Berg unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc);
6126e31a16d6SZhu Yi 
6127e31a16d6SZhu Yi /**
61289b395bc3SJohannes Berg  * ieee80211_get_mesh_hdrlen - get mesh extension header length
61299b395bc3SJohannes Berg  * @meshhdr: the mesh extension header, only the flags field
61309b395bc3SJohannes Berg  *	(first byte) will be accessed
61310ae997dcSYacine Belkadi  * Return: The length of the extension header, which is always at
61329b395bc3SJohannes Berg  * least 6 bytes and at most 18 if address 5 and 6 are present.
61339b395bc3SJohannes Berg  */
61349b395bc3SJohannes Berg unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr);
61359b395bc3SJohannes Berg 
61369b395bc3SJohannes Berg /**
6137d70e9693SJohannes Berg  * DOC: Data path helpers
6138d70e9693SJohannes Berg  *
6139d70e9693SJohannes Berg  * In addition to generic utilities, cfg80211 also offers
6140d70e9693SJohannes Berg  * functions that help implement the data path for devices
6141d70e9693SJohannes Berg  * that do not do the 802.11/802.3 conversion on the device.
6142d70e9693SJohannes Berg  */
6143d70e9693SJohannes Berg 
6144d70e9693SJohannes Berg /**
61457f6990c8SJohannes Berg  * ieee80211_data_to_8023_exthdr - convert an 802.11 data frame to 802.3
61467f6990c8SJohannes Berg  * @skb: the 802.11 data frame
61477f6990c8SJohannes Berg  * @ehdr: pointer to a &struct ethhdr that will get the header, instead
61487f6990c8SJohannes Berg  *	of it being pushed into the SKB
61497f6990c8SJohannes Berg  * @addr: the device MAC address
61507f6990c8SJohannes Berg  * @iftype: the virtual interface type
615124bba078SFelix Fietkau  * @data_offset: offset of payload after the 802.11 header
61522d8b08feSMauro Carvalho Chehab  * @is_amsdu: true if the 802.11 header is A-MSDU
61537f6990c8SJohannes Berg  * Return: 0 on success. Non-zero on error.
61547f6990c8SJohannes Berg  */
61557f6990c8SJohannes Berg int ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr,
615624bba078SFelix Fietkau 				  const u8 *addr, enum nl80211_iftype iftype,
6157a1d5ff56SMathy Vanhoef 				  u8 data_offset, bool is_amsdu);
61587f6990c8SJohannes Berg 
61597f6990c8SJohannes Berg /**
6160e31a16d6SZhu Yi  * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3
6161e31a16d6SZhu Yi  * @skb: the 802.11 data frame
6162e31a16d6SZhu Yi  * @addr: the device MAC address
6163e31a16d6SZhu Yi  * @iftype: the virtual interface type
61640ae997dcSYacine Belkadi  * Return: 0 on success. Non-zero on error.
6165e31a16d6SZhu Yi  */
61667f6990c8SJohannes Berg static inline int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
61677f6990c8SJohannes Berg 					 enum nl80211_iftype iftype)
61687f6990c8SJohannes Berg {
6169a1d5ff56SMathy Vanhoef 	return ieee80211_data_to_8023_exthdr(skb, NULL, addr, iftype, 0, false);
61707f6990c8SJohannes Berg }
6171e31a16d6SZhu Yi 
6172e31a16d6SZhu Yi /**
6173eaf85ca7SZhu Yi  * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame
6174eaf85ca7SZhu Yi  *
61757f6990c8SJohannes Berg  * Decode an IEEE 802.11 A-MSDU and convert it to a list of 802.3 frames.
61767f6990c8SJohannes Berg  * The @list will be empty if the decode fails. The @skb must be fully
61777f6990c8SJohannes Berg  * header-less before being passed in here; it is freed in this function.
6178eaf85ca7SZhu Yi  *
61797f6990c8SJohannes Berg  * @skb: The input A-MSDU frame without any headers.
6180eaf85ca7SZhu Yi  * @list: The output list of 802.3 frames. It must be allocated and
6181085a6c10SRandy Dunlap  *	initialized by the caller.
6182eaf85ca7SZhu Yi  * @addr: The device MAC address.
6183eaf85ca7SZhu Yi  * @iftype: The device interface type.
6184eaf85ca7SZhu Yi  * @extra_headroom: The hardware extra headroom for SKBs in the @list.
61858b935ee2SJohannes Berg  * @check_da: DA to check in the inner ethernet header, or NULL
61868b935ee2SJohannes Berg  * @check_sa: SA to check in the inner ethernet header, or NULL
6187eaf85ca7SZhu Yi  */
6188eaf85ca7SZhu Yi void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,
6189eaf85ca7SZhu Yi 			      const u8 *addr, enum nl80211_iftype iftype,
61908b3becadSYogesh Ashok Powar 			      const unsigned int extra_headroom,
61918b935ee2SJohannes Berg 			      const u8 *check_da, const u8 *check_sa);
6192eaf85ca7SZhu Yi 
6193eaf85ca7SZhu Yi /**
6194e31a16d6SZhu Yi  * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame
6195e31a16d6SZhu Yi  * @skb: the data frame
6196fa9ffc74SKyeyoon Park  * @qos_map: Interworking QoS mapping or %NULL if not in use
61970ae997dcSYacine Belkadi  * Return: The 802.1p/1d tag.
6198e31a16d6SZhu Yi  */
6199fa9ffc74SKyeyoon Park unsigned int cfg80211_classify8021d(struct sk_buff *skb,
6200fa9ffc74SKyeyoon Park 				    struct cfg80211_qos_map *qos_map);
6201e31a16d6SZhu Yi 
6202c21dbf92SJohannes Berg /**
620349a68e0dSJohannes Berg  * cfg80211_find_elem_match - match information element and byte array in data
620449a68e0dSJohannes Berg  *
620549a68e0dSJohannes Berg  * @eid: element ID
620649a68e0dSJohannes Berg  * @ies: data consisting of IEs
620749a68e0dSJohannes Berg  * @len: length of data
620849a68e0dSJohannes Berg  * @match: byte array to match
620949a68e0dSJohannes Berg  * @match_len: number of bytes in the match array
621049a68e0dSJohannes Berg  * @match_offset: offset in the IE data where the byte array should match.
621149a68e0dSJohannes Berg  *	Note the difference to cfg80211_find_ie_match() which considers
621249a68e0dSJohannes Berg  *	the offset to start from the element ID byte, but here we take
621349a68e0dSJohannes Berg  *	the data portion instead.
621449a68e0dSJohannes Berg  *
621549a68e0dSJohannes Berg  * Return: %NULL if the element ID could not be found or if
621649a68e0dSJohannes Berg  * the element is invalid (claims to be longer than the given
621749a68e0dSJohannes Berg  * data) or if the byte array doesn't match; otherwise return the
621849a68e0dSJohannes Berg  * requested element struct.
621949a68e0dSJohannes Berg  *
622049a68e0dSJohannes Berg  * Note: There are no checks on the element length other than
622149a68e0dSJohannes Berg  * having to fit into the given data and being large enough for the
622249a68e0dSJohannes Berg  * byte array to match.
622349a68e0dSJohannes Berg  */
622449a68e0dSJohannes Berg const struct element *
622549a68e0dSJohannes Berg cfg80211_find_elem_match(u8 eid, const u8 *ies, unsigned int len,
622649a68e0dSJohannes Berg 			 const u8 *match, unsigned int match_len,
622749a68e0dSJohannes Berg 			 unsigned int match_offset);
622849a68e0dSJohannes Berg 
622949a68e0dSJohannes Berg /**
6230fbd05e4aSLuca Coelho  * cfg80211_find_ie_match - match information element and byte array in data
6231fbd05e4aSLuca Coelho  *
6232fbd05e4aSLuca Coelho  * @eid: element ID
6233fbd05e4aSLuca Coelho  * @ies: data consisting of IEs
6234fbd05e4aSLuca Coelho  * @len: length of data
6235fbd05e4aSLuca Coelho  * @match: byte array to match
6236fbd05e4aSLuca Coelho  * @match_len: number of bytes in the match array
6237fbd05e4aSLuca Coelho  * @match_offset: offset in the IE where the byte array should match.
6238fbd05e4aSLuca Coelho  *	If match_len is zero, this must also be set to zero.
6239fbd05e4aSLuca Coelho  *	Otherwise this must be set to 2 or more, because the first
6240fbd05e4aSLuca Coelho  *	byte is the element id, which is already compared to eid, and
6241fbd05e4aSLuca Coelho  *	the second byte is the IE length.
6242fbd05e4aSLuca Coelho  *
6243fbd05e4aSLuca Coelho  * Return: %NULL if the element ID could not be found or if
6244fbd05e4aSLuca Coelho  * the element is invalid (claims to be longer than the given
6245fbd05e4aSLuca Coelho  * data) or if the byte array doesn't match, or a pointer to the first
6246fbd05e4aSLuca Coelho  * byte of the requested element, that is the byte containing the
6247fbd05e4aSLuca Coelho  * element ID.
6248fbd05e4aSLuca Coelho  *
6249fbd05e4aSLuca Coelho  * Note: There are no checks on the element length other than
6250fbd05e4aSLuca Coelho  * having to fit into the given data and being large enough for the
6251fbd05e4aSLuca Coelho  * byte array to match.
6252fbd05e4aSLuca Coelho  */
625349a68e0dSJohannes Berg static inline const u8 *
625449a68e0dSJohannes Berg cfg80211_find_ie_match(u8 eid, const u8 *ies, unsigned int len,
625549a68e0dSJohannes Berg 		       const u8 *match, unsigned int match_len,
625649a68e0dSJohannes Berg 		       unsigned int match_offset)
625749a68e0dSJohannes Berg {
625849a68e0dSJohannes Berg 	/* match_offset can't be smaller than 2, unless match_len is
625949a68e0dSJohannes Berg 	 * zero, in which case match_offset must be zero as well.
626049a68e0dSJohannes Berg 	 */
626149a68e0dSJohannes Berg 	if (WARN_ON((match_len && match_offset < 2) ||
626249a68e0dSJohannes Berg 		    (!match_len && match_offset)))
626349a68e0dSJohannes Berg 		return NULL;
626449a68e0dSJohannes Berg 
62657e367b06SJohannes Berg 	return (const void *)cfg80211_find_elem_match(eid, ies, len,
626649a68e0dSJohannes Berg 						      match, match_len,
626749a68e0dSJohannes Berg 						      match_offset ?
626849a68e0dSJohannes Berg 							match_offset - 2 : 0);
626949a68e0dSJohannes Berg }
627049a68e0dSJohannes Berg 
627149a68e0dSJohannes Berg /**
627249a68e0dSJohannes Berg  * cfg80211_find_elem - find information element in data
627349a68e0dSJohannes Berg  *
627449a68e0dSJohannes Berg  * @eid: element ID
627549a68e0dSJohannes Berg  * @ies: data consisting of IEs
627649a68e0dSJohannes Berg  * @len: length of data
627749a68e0dSJohannes Berg  *
627849a68e0dSJohannes Berg  * Return: %NULL if the element ID could not be found or if
627949a68e0dSJohannes Berg  * the element is invalid (claims to be longer than the given
628049a68e0dSJohannes Berg  * data) or if the byte array doesn't match; otherwise return the
628149a68e0dSJohannes Berg  * requested element struct.
628249a68e0dSJohannes Berg  *
628349a68e0dSJohannes Berg  * Note: There are no checks on the element length other than
628449a68e0dSJohannes Berg  * having to fit into the given data.
628549a68e0dSJohannes Berg  */
628649a68e0dSJohannes Berg static inline const struct element *
628749a68e0dSJohannes Berg cfg80211_find_elem(u8 eid, const u8 *ies, int len)
628849a68e0dSJohannes Berg {
628949a68e0dSJohannes Berg 	return cfg80211_find_elem_match(eid, ies, len, NULL, 0, 0);
629049a68e0dSJohannes Berg }
6291fbd05e4aSLuca Coelho 
6292fbd05e4aSLuca Coelho /**
6293c21dbf92SJohannes Berg  * cfg80211_find_ie - find information element in data
6294c21dbf92SJohannes Berg  *
6295c21dbf92SJohannes Berg  * @eid: element ID
6296c21dbf92SJohannes Berg  * @ies: data consisting of IEs
6297c21dbf92SJohannes Berg  * @len: length of data
6298c21dbf92SJohannes Berg  *
62990ae997dcSYacine Belkadi  * Return: %NULL if the element ID could not be found or if
63000ae997dcSYacine Belkadi  * the element is invalid (claims to be longer than the given
63010ae997dcSYacine Belkadi  * data), or a pointer to the first byte of the requested
63020ae997dcSYacine Belkadi  * element, that is the byte containing the element ID.
63030ae997dcSYacine Belkadi  *
63040ae997dcSYacine Belkadi  * Note: There are no checks on the element length other than
63050ae997dcSYacine Belkadi  * having to fit into the given data.
6306c21dbf92SJohannes Berg  */
6307fbd05e4aSLuca Coelho static inline const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len)
6308fbd05e4aSLuca Coelho {
6309fbd05e4aSLuca Coelho 	return cfg80211_find_ie_match(eid, ies, len, NULL, 0, 0);
6310fbd05e4aSLuca Coelho }
6311c21dbf92SJohannes Berg 
6312d70e9693SJohannes Berg /**
631349a68e0dSJohannes Berg  * cfg80211_find_ext_elem - find information element with EID Extension in data
631449a68e0dSJohannes Berg  *
631549a68e0dSJohannes Berg  * @ext_eid: element ID Extension
631649a68e0dSJohannes Berg  * @ies: data consisting of IEs
631749a68e0dSJohannes Berg  * @len: length of data
631849a68e0dSJohannes Berg  *
631949a68e0dSJohannes Berg  * Return: %NULL if the etended element could not be found or if
632049a68e0dSJohannes Berg  * the element is invalid (claims to be longer than the given
632149a68e0dSJohannes Berg  * data) or if the byte array doesn't match; otherwise return the
632249a68e0dSJohannes Berg  * requested element struct.
632349a68e0dSJohannes Berg  *
632449a68e0dSJohannes Berg  * Note: There are no checks on the element length other than
632549a68e0dSJohannes Berg  * having to fit into the given data.
632649a68e0dSJohannes Berg  */
632749a68e0dSJohannes Berg static inline const struct element *
632849a68e0dSJohannes Berg cfg80211_find_ext_elem(u8 ext_eid, const u8 *ies, int len)
632949a68e0dSJohannes Berg {
633049a68e0dSJohannes Berg 	return cfg80211_find_elem_match(WLAN_EID_EXTENSION, ies, len,
633149a68e0dSJohannes Berg 					&ext_eid, 1, 0);
633249a68e0dSJohannes Berg }
633349a68e0dSJohannes Berg 
633449a68e0dSJohannes Berg /**
63353f817fe7SJouni Malinen  * cfg80211_find_ext_ie - find information element with EID Extension in data
63363f817fe7SJouni Malinen  *
63373f817fe7SJouni Malinen  * @ext_eid: element ID Extension
63383f817fe7SJouni Malinen  * @ies: data consisting of IEs
63393f817fe7SJouni Malinen  * @len: length of data
63403f817fe7SJouni Malinen  *
63413f817fe7SJouni Malinen  * Return: %NULL if the extended element ID could not be found or if
63423f817fe7SJouni Malinen  * the element is invalid (claims to be longer than the given
63433f817fe7SJouni Malinen  * data), or a pointer to the first byte of the requested
63443f817fe7SJouni Malinen  * element, that is the byte containing the element ID.
63453f817fe7SJouni Malinen  *
63463f817fe7SJouni Malinen  * Note: There are no checks on the element length other than
63473f817fe7SJouni Malinen  * having to fit into the given data.
63483f817fe7SJouni Malinen  */
63493f817fe7SJouni Malinen static inline const u8 *cfg80211_find_ext_ie(u8 ext_eid, const u8 *ies, int len)
63503f817fe7SJouni Malinen {
63513f817fe7SJouni Malinen 	return cfg80211_find_ie_match(WLAN_EID_EXTENSION, ies, len,
63523f817fe7SJouni Malinen 				      &ext_eid, 1, 2);
63533f817fe7SJouni Malinen }
63543f817fe7SJouni Malinen 
63553f817fe7SJouni Malinen /**
635649a68e0dSJohannes Berg  * cfg80211_find_vendor_elem - find vendor specific information element in data
635749a68e0dSJohannes Berg  *
635849a68e0dSJohannes Berg  * @oui: vendor OUI
635949a68e0dSJohannes Berg  * @oui_type: vendor-specific OUI type (must be < 0xff), negative means any
636049a68e0dSJohannes Berg  * @ies: data consisting of IEs
636149a68e0dSJohannes Berg  * @len: length of data
636249a68e0dSJohannes Berg  *
636349a68e0dSJohannes Berg  * Return: %NULL if the vendor specific element ID could not be found or if the
636449a68e0dSJohannes Berg  * element is invalid (claims to be longer than the given data); otherwise
636549a68e0dSJohannes Berg  * return the element structure for the requested element.
636649a68e0dSJohannes Berg  *
636749a68e0dSJohannes Berg  * Note: There are no checks on the element length other than having to fit into
636849a68e0dSJohannes Berg  * the given data.
636949a68e0dSJohannes Berg  */
637049a68e0dSJohannes Berg const struct element *cfg80211_find_vendor_elem(unsigned int oui, int oui_type,
637149a68e0dSJohannes Berg 						const u8 *ies,
637249a68e0dSJohannes Berg 						unsigned int len);
637349a68e0dSJohannes Berg 
637449a68e0dSJohannes Berg /**
63750c28ec58SEliad Peller  * cfg80211_find_vendor_ie - find vendor specific information element in data
63760c28ec58SEliad Peller  *
63770c28ec58SEliad Peller  * @oui: vendor OUI
63789e9ea439SEmmanuel Grumbach  * @oui_type: vendor-specific OUI type (must be < 0xff), negative means any
63790c28ec58SEliad Peller  * @ies: data consisting of IEs
63800c28ec58SEliad Peller  * @len: length of data
63810c28ec58SEliad Peller  *
63820ae997dcSYacine Belkadi  * Return: %NULL if the vendor specific element ID could not be found or if the
63830ae997dcSYacine Belkadi  * element is invalid (claims to be longer than the given data), or a pointer to
63840ae997dcSYacine Belkadi  * the first byte of the requested element, that is the byte containing the
63850ae997dcSYacine Belkadi  * element ID.
63860ae997dcSYacine Belkadi  *
63870ae997dcSYacine Belkadi  * Note: There are no checks on the element length other than having to fit into
63880ae997dcSYacine Belkadi  * the given data.
63890c28ec58SEliad Peller  */
639049a68e0dSJohannes Berg static inline const u8 *
639149a68e0dSJohannes Berg cfg80211_find_vendor_ie(unsigned int oui, int oui_type,
639249a68e0dSJohannes Berg 			const u8 *ies, unsigned int len)
639349a68e0dSJohannes Berg {
63947e367b06SJohannes Berg 	return (const void *)cfg80211_find_vendor_elem(oui, oui_type, ies, len);
639549a68e0dSJohannes Berg }
63960c28ec58SEliad Peller 
63970c28ec58SEliad Peller /**
639830ca1aa5SDedy Lansky  * cfg80211_send_layer2_update - send layer 2 update frame
639930ca1aa5SDedy Lansky  *
640030ca1aa5SDedy Lansky  * @dev: network device
640130ca1aa5SDedy Lansky  * @addr: STA MAC address
640230ca1aa5SDedy Lansky  *
640330ca1aa5SDedy Lansky  * Wireless drivers can use this function to update forwarding tables in bridge
640430ca1aa5SDedy Lansky  * devices upon STA association.
640530ca1aa5SDedy Lansky  */
640630ca1aa5SDedy Lansky void cfg80211_send_layer2_update(struct net_device *dev, const u8 *addr);
640730ca1aa5SDedy Lansky 
640830ca1aa5SDedy Lansky /**
6409d70e9693SJohannes Berg  * DOC: Regulatory enforcement infrastructure
6410d70e9693SJohannes Berg  *
6411d70e9693SJohannes Berg  * TODO
6412d3236553SJohannes Berg  */
6413d3236553SJohannes Berg 
6414d3236553SJohannes Berg /**
6415d3236553SJohannes Berg  * regulatory_hint - driver hint to the wireless core a regulatory domain
6416d3236553SJohannes Berg  * @wiphy: the wireless device giving the hint (used only for reporting
6417d3236553SJohannes Berg  *	conflicts)
6418d3236553SJohannes Berg  * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain
6419d3236553SJohannes Berg  *	should be in. If @rd is set this should be NULL. Note that if you
6420d3236553SJohannes Berg  *	set this to NULL you should still set rd->alpha2 to some accepted
6421d3236553SJohannes Berg  *	alpha2.
6422d3236553SJohannes Berg  *
6423d3236553SJohannes Berg  * Wireless drivers can use this function to hint to the wireless core
6424d3236553SJohannes Berg  * what it believes should be the current regulatory domain by
6425d3236553SJohannes Berg  * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory
6426d3236553SJohannes Berg  * domain should be in or by providing a completely build regulatory domain.
6427d3236553SJohannes Berg  * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried
6428d3236553SJohannes Berg  * for a regulatory domain structure for the respective country.
6429d3236553SJohannes Berg  *
6430d3236553SJohannes Berg  * The wiphy must have been registered to cfg80211 prior to this call.
6431d3236553SJohannes Berg  * For cfg80211 drivers this means you must first use wiphy_register(),
6432d3236553SJohannes Berg  * for mac80211 drivers you must first use ieee80211_register_hw().
6433d3236553SJohannes Berg  *
6434d3236553SJohannes Berg  * Drivers should check the return value, its possible you can get
6435d3236553SJohannes Berg  * an -ENOMEM.
64360ae997dcSYacine Belkadi  *
64370ae997dcSYacine Belkadi  * Return: 0 on success. -ENOMEM.
6438d3236553SJohannes Berg  */
643910dd9b7cSJoe Perches int regulatory_hint(struct wiphy *wiphy, const char *alpha2);
6440d3236553SJohannes Berg 
6441d3236553SJohannes Berg /**
6442b0d7aa59SJonathan Doron  * regulatory_set_wiphy_regd - set regdom info for self managed drivers
6443b0d7aa59SJonathan Doron  * @wiphy: the wireless device we want to process the regulatory domain on
6444b0d7aa59SJonathan Doron  * @rd: the regulatory domain informatoin to use for this wiphy
6445b0d7aa59SJonathan Doron  *
6446b0d7aa59SJonathan Doron  * Set the regulatory domain information for self-managed wiphys, only they
6447b0d7aa59SJonathan Doron  * may use this function. See %REGULATORY_WIPHY_SELF_MANAGED for more
6448b0d7aa59SJonathan Doron  * information.
6449b0d7aa59SJonathan Doron  *
6450b0d7aa59SJonathan Doron  * Return: 0 on success. -EINVAL, -EPERM
6451b0d7aa59SJonathan Doron  */
6452b0d7aa59SJonathan Doron int regulatory_set_wiphy_regd(struct wiphy *wiphy,
6453b0d7aa59SJonathan Doron 			      struct ieee80211_regdomain *rd);
6454b0d7aa59SJonathan Doron 
6455b0d7aa59SJonathan Doron /**
6456a05829a7SJohannes Berg  * regulatory_set_wiphy_regd_sync - set regdom for self-managed drivers
64572c3e861cSArik Nemtsov  * @wiphy: the wireless device we want to process the regulatory domain on
64582c3e861cSArik Nemtsov  * @rd: the regulatory domain information to use for this wiphy
64592c3e861cSArik Nemtsov  *
6460a05829a7SJohannes Berg  * This functions requires the RTNL and the wiphy mutex to be held and
6461a05829a7SJohannes Berg  * applies the new regdomain synchronously to this wiphy. For more details
6462a05829a7SJohannes Berg  * see regulatory_set_wiphy_regd().
64632c3e861cSArik Nemtsov  *
64642c3e861cSArik Nemtsov  * Return: 0 on success. -EINVAL, -EPERM
64652c3e861cSArik Nemtsov  */
6466a05829a7SJohannes Berg int regulatory_set_wiphy_regd_sync(struct wiphy *wiphy,
64672c3e861cSArik Nemtsov 				   struct ieee80211_regdomain *rd);
64682c3e861cSArik Nemtsov 
64692c3e861cSArik Nemtsov /**
6470d3236553SJohannes Berg  * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain
6471d3236553SJohannes Berg  * @wiphy: the wireless device we want to process the regulatory domain on
6472d3236553SJohannes Berg  * @regd: the custom regulatory domain to use for this wiphy
6473d3236553SJohannes Berg  *
6474d3236553SJohannes Berg  * Drivers can sometimes have custom regulatory domains which do not apply
6475d3236553SJohannes Berg  * to a specific country. Drivers can use this to apply such custom regulatory
6476d3236553SJohannes Berg  * domains. This routine must be called prior to wiphy registration. The
6477d3236553SJohannes Berg  * custom regulatory domain will be trusted completely and as such previous
6478d3236553SJohannes Berg  * default channel settings will be disregarded. If no rule is found for a
6479d3236553SJohannes Berg  * channel on the regulatory domain the channel will be disabled.
6480222ea581SLuis R. Rodriguez  * Drivers using this for a wiphy should also set the wiphy flag
6481ce26151bSKalle Valo  * REGULATORY_CUSTOM_REG or cfg80211 will set it for the wiphy
6482222ea581SLuis R. Rodriguez  * that called this helper.
6483d3236553SJohannes Berg  */
648410dd9b7cSJoe Perches void wiphy_apply_custom_regulatory(struct wiphy *wiphy,
6485d3236553SJohannes Berg 				   const struct ieee80211_regdomain *regd);
6486d3236553SJohannes Berg 
6487d3236553SJohannes Berg /**
6488d3236553SJohannes Berg  * freq_reg_info - get regulatory information for the given frequency
6489d3236553SJohannes Berg  * @wiphy: the wiphy for which we want to process this rule for
6490d3236553SJohannes Berg  * @center_freq: Frequency in KHz for which we want regulatory information for
6491d3236553SJohannes Berg  *
6492d3236553SJohannes Berg  * Use this function to get the regulatory rule for a specific frequency on
6493d3236553SJohannes Berg  * a given wireless device. If the device has a specific regulatory domain
6494d3236553SJohannes Berg  * it wants to follow we respect that unless a country IE has been received
6495d3236553SJohannes Berg  * and processed already.
6496d3236553SJohannes Berg  *
64970ae997dcSYacine Belkadi  * Return: A valid pointer, or, when an error occurs, for example if no rule
64980ae997dcSYacine Belkadi  * can be found, the return value is encoded using ERR_PTR(). Use IS_ERR() to
64990ae997dcSYacine Belkadi  * check and PTR_ERR() to obtain the numeric return value. The numeric return
65000ae997dcSYacine Belkadi  * value will be -ERANGE if we determine the given center_freq does not even
65010ae997dcSYacine Belkadi  * have a regulatory rule for a frequency range in the center_freq's band.
65020ae997dcSYacine Belkadi  * See freq_in_rule_band() for our current definition of a band -- this is
65030ae997dcSYacine Belkadi  * purely subjective and right now it's 802.11 specific.
6504d3236553SJohannes Berg  */
6505361c9c8bSJohannes Berg const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy,
6506361c9c8bSJohannes Berg 					       u32 center_freq);
6507d3236553SJohannes Berg 
6508034c6d6eSLuis R. Rodriguez /**
6509034c6d6eSLuis R. Rodriguez  * reg_initiator_name - map regulatory request initiator enum to name
6510034c6d6eSLuis R. Rodriguez  * @initiator: the regulatory request initiator
6511034c6d6eSLuis R. Rodriguez  *
6512034c6d6eSLuis R. Rodriguez  * You can use this to map the regulatory request initiator enum to a
6513034c6d6eSLuis R. Rodriguez  * proper string representation.
6514034c6d6eSLuis R. Rodriguez  */
6515034c6d6eSLuis R. Rodriguez const char *reg_initiator_name(enum nl80211_reg_initiator initiator);
6516034c6d6eSLuis R. Rodriguez 
651719d3577eSHaim Dreyfuss /**
6518dc0c18edSAaron Komisar  * regulatory_pre_cac_allowed - check if pre-CAC allowed in the current regdom
6519dc0c18edSAaron Komisar  * @wiphy: wiphy for which pre-CAC capability is checked.
6520dc0c18edSAaron Komisar  *
6521dc0c18edSAaron Komisar  * Pre-CAC is allowed only in some regdomains (notable ETSI).
6522dc0c18edSAaron Komisar  */
6523dc0c18edSAaron Komisar bool regulatory_pre_cac_allowed(struct wiphy *wiphy);
6524dc0c18edSAaron Komisar 
6525dc0c18edSAaron Komisar /**
652619d3577eSHaim Dreyfuss  * DOC: Internal regulatory db functions
652719d3577eSHaim Dreyfuss  *
652819d3577eSHaim Dreyfuss  */
652919d3577eSHaim Dreyfuss 
653019d3577eSHaim Dreyfuss /**
653119d3577eSHaim Dreyfuss  * reg_query_regdb_wmm -  Query internal regulatory db for wmm rule
653219d3577eSHaim Dreyfuss  * Regulatory self-managed driver can use it to proactively
653319d3577eSHaim Dreyfuss  *
653419d3577eSHaim Dreyfuss  * @alpha2: the ISO/IEC 3166 alpha2 wmm rule to be queried.
653519d3577eSHaim Dreyfuss  * @freq: the freqency(in MHz) to be queried.
653619d3577eSHaim Dreyfuss  * @rule: pointer to store the wmm rule from the regulatory db.
653719d3577eSHaim Dreyfuss  *
653819d3577eSHaim Dreyfuss  * Self-managed wireless drivers can use this function to  query
653919d3577eSHaim Dreyfuss  * the internal regulatory database to check whether the given
654019d3577eSHaim Dreyfuss  * ISO/IEC 3166 alpha2 country and freq have wmm rule limitations.
654119d3577eSHaim Dreyfuss  *
654219d3577eSHaim Dreyfuss  * Drivers should check the return value, its possible you can get
654319d3577eSHaim Dreyfuss  * an -ENODATA.
654419d3577eSHaim Dreyfuss  *
654519d3577eSHaim Dreyfuss  * Return: 0 on success. -ENODATA.
654619d3577eSHaim Dreyfuss  */
654738cb87eeSStanislaw Gruszka int reg_query_regdb_wmm(char *alpha2, int freq,
654838cb87eeSStanislaw Gruszka 			struct ieee80211_reg_rule *rule);
654919d3577eSHaim Dreyfuss 
6550d3236553SJohannes Berg /*
6551d3236553SJohannes Berg  * callbacks for asynchronous cfg80211 methods, notification
6552d3236553SJohannes Berg  * functions and BSS handling helpers
6553d3236553SJohannes Berg  */
6554d3236553SJohannes Berg 
65552a519311SJohannes Berg /**
65562a519311SJohannes Berg  * cfg80211_scan_done - notify that scan finished
65572a519311SJohannes Berg  *
65582a519311SJohannes Berg  * @request: the corresponding scan request
65591d76250bSAvraham Stern  * @info: information about the completed scan
65602a519311SJohannes Berg  */
65611d76250bSAvraham Stern void cfg80211_scan_done(struct cfg80211_scan_request *request,
65621d76250bSAvraham Stern 			struct cfg80211_scan_info *info);
65632a519311SJohannes Berg 
65642a519311SJohannes Berg /**
6565807f8a8cSLuciano Coelho  * cfg80211_sched_scan_results - notify that new scan results are available
6566807f8a8cSLuciano Coelho  *
6567807f8a8cSLuciano Coelho  * @wiphy: the wiphy which got scheduled scan results
6568b34939b9SArend Van Spriel  * @reqid: identifier for the related scheduled scan request
6569807f8a8cSLuciano Coelho  */
6570b34939b9SArend Van Spriel void cfg80211_sched_scan_results(struct wiphy *wiphy, u64 reqid);
6571807f8a8cSLuciano Coelho 
6572807f8a8cSLuciano Coelho /**
6573807f8a8cSLuciano Coelho  * cfg80211_sched_scan_stopped - notify that the scheduled scan has stopped
6574807f8a8cSLuciano Coelho  *
6575807f8a8cSLuciano Coelho  * @wiphy: the wiphy on which the scheduled scan stopped
6576b34939b9SArend Van Spriel  * @reqid: identifier for the related scheduled scan request
6577807f8a8cSLuciano Coelho  *
6578807f8a8cSLuciano Coelho  * The driver can call this function to inform cfg80211 that the
6579807f8a8cSLuciano Coelho  * scheduled scan had to be stopped, for whatever reason.  The driver
6580807f8a8cSLuciano Coelho  * is then called back via the sched_scan_stop operation when done.
6581807f8a8cSLuciano Coelho  */
6582b34939b9SArend Van Spriel void cfg80211_sched_scan_stopped(struct wiphy *wiphy, u64 reqid);
6583807f8a8cSLuciano Coelho 
6584807f8a8cSLuciano Coelho /**
6585a05829a7SJohannes Berg  * cfg80211_sched_scan_stopped_locked - notify that the scheduled scan has stopped
6586792e6aa7SEliad Peller  *
6587792e6aa7SEliad Peller  * @wiphy: the wiphy on which the scheduled scan stopped
6588b34939b9SArend Van Spriel  * @reqid: identifier for the related scheduled scan request
6589792e6aa7SEliad Peller  *
6590792e6aa7SEliad Peller  * The driver can call this function to inform cfg80211 that the
6591792e6aa7SEliad Peller  * scheduled scan had to be stopped, for whatever reason.  The driver
6592792e6aa7SEliad Peller  * is then called back via the sched_scan_stop operation when done.
6593a05829a7SJohannes Berg  * This function should be called with the wiphy mutex held.
6594792e6aa7SEliad Peller  */
6595a05829a7SJohannes Berg void cfg80211_sched_scan_stopped_locked(struct wiphy *wiphy, u64 reqid);
6596792e6aa7SEliad Peller 
6597792e6aa7SEliad Peller /**
65986e19bc4bSDmitry Shmidt  * cfg80211_inform_bss_frame_data - inform cfg80211 of a received BSS frame
65992a519311SJohannes Berg  * @wiphy: the wiphy reporting the BSS
66006e19bc4bSDmitry Shmidt  * @data: the BSS metadata
6601abe37c4bSJohannes Berg  * @mgmt: the management frame (probe response or beacon)
6602abe37c4bSJohannes Berg  * @len: length of the management frame
66032a519311SJohannes Berg  * @gfp: context flags
66042a519311SJohannes Berg  *
66052a519311SJohannes Berg  * This informs cfg80211 that BSS information was found and
66062a519311SJohannes Berg  * the BSS should be updated/added.
6607ef100682SJohannes Berg  *
66080ae997dcSYacine Belkadi  * Return: A referenced struct, must be released with cfg80211_put_bss()!
66090ae997dcSYacine Belkadi  * Or %NULL on error.
66102a519311SJohannes Berg  */
6611ef100682SJohannes Berg struct cfg80211_bss * __must_check
66126e19bc4bSDmitry Shmidt cfg80211_inform_bss_frame_data(struct wiphy *wiphy,
66136e19bc4bSDmitry Shmidt 			       struct cfg80211_inform_bss *data,
66146e19bc4bSDmitry Shmidt 			       struct ieee80211_mgmt *mgmt, size_t len,
66156e19bc4bSDmitry Shmidt 			       gfp_t gfp);
66166e19bc4bSDmitry Shmidt 
66176e19bc4bSDmitry Shmidt static inline struct cfg80211_bss * __must_check
6618dcd6eac1SSimon Wunderlich cfg80211_inform_bss_width_frame(struct wiphy *wiphy,
66193afc2167SEmmanuel Grumbach 				struct ieee80211_channel *rx_channel,
6620dcd6eac1SSimon Wunderlich 				enum nl80211_bss_scan_width scan_width,
6621dcd6eac1SSimon Wunderlich 				struct ieee80211_mgmt *mgmt, size_t len,
66226e19bc4bSDmitry Shmidt 				s32 signal, gfp_t gfp)
66236e19bc4bSDmitry Shmidt {
66246e19bc4bSDmitry Shmidt 	struct cfg80211_inform_bss data = {
66256e19bc4bSDmitry Shmidt 		.chan = rx_channel,
66266e19bc4bSDmitry Shmidt 		.scan_width = scan_width,
66276e19bc4bSDmitry Shmidt 		.signal = signal,
66286e19bc4bSDmitry Shmidt 	};
66296e19bc4bSDmitry Shmidt 
66306e19bc4bSDmitry Shmidt 	return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp);
66316e19bc4bSDmitry Shmidt }
6632dcd6eac1SSimon Wunderlich 
6633dcd6eac1SSimon Wunderlich static inline struct cfg80211_bss * __must_check
66342a519311SJohannes Berg cfg80211_inform_bss_frame(struct wiphy *wiphy,
66353afc2167SEmmanuel Grumbach 			  struct ieee80211_channel *rx_channel,
66362a519311SJohannes Berg 			  struct ieee80211_mgmt *mgmt, size_t len,
6637dcd6eac1SSimon Wunderlich 			  s32 signal, gfp_t gfp)
6638dcd6eac1SSimon Wunderlich {
66396e19bc4bSDmitry Shmidt 	struct cfg80211_inform_bss data = {
66406e19bc4bSDmitry Shmidt 		.chan = rx_channel,
66416e19bc4bSDmitry Shmidt 		.scan_width = NL80211_BSS_CHAN_WIDTH_20,
66426e19bc4bSDmitry Shmidt 		.signal = signal,
66436e19bc4bSDmitry Shmidt 	};
66446e19bc4bSDmitry Shmidt 
66456e19bc4bSDmitry Shmidt 	return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp);
6646dcd6eac1SSimon Wunderlich }
66472a519311SJohannes Berg 
6648abe37c4bSJohannes Berg /**
66497ece9c37SSara Sharon  * cfg80211_gen_new_bssid - generate a nontransmitted BSSID for multi-BSSID
66507ece9c37SSara Sharon  * @bssid: transmitter BSSID
66517ece9c37SSara Sharon  * @max_bssid: max BSSID indicator, taken from Multiple BSSID element
66527ece9c37SSara Sharon  * @mbssid_index: BSSID index, taken from Multiple BSSID index element
66535d4071abSJohannes Berg  * @new_bssid: calculated nontransmitted BSSID
66547ece9c37SSara Sharon  */
66557ece9c37SSara Sharon static inline void cfg80211_gen_new_bssid(const u8 *bssid, u8 max_bssid,
66565d4071abSJohannes Berg 					  u8 mbssid_index, u8 *new_bssid)
66577ece9c37SSara Sharon {
66585d4071abSJohannes Berg 	u64 bssid_u64 = ether_addr_to_u64(bssid);
66595d4071abSJohannes Berg 	u64 mask = GENMASK_ULL(max_bssid - 1, 0);
66605d4071abSJohannes Berg 	u64 new_bssid_u64;
66617ece9c37SSara Sharon 
66625d4071abSJohannes Berg 	new_bssid_u64 = bssid_u64 & ~mask;
66637ece9c37SSara Sharon 
66645d4071abSJohannes Berg 	new_bssid_u64 |= ((bssid_u64 & mask) + mbssid_index) & mask;
66657ece9c37SSara Sharon 
66665d4071abSJohannes Berg 	u64_to_ether_addr(new_bssid_u64, new_bssid);
66677ece9c37SSara Sharon }
66687ece9c37SSara Sharon 
66697ece9c37SSara Sharon /**
6670f7dacfb1SSara Sharon  * cfg80211_is_element_inherited - returns if element ID should be inherited
6671f7dacfb1SSara Sharon  * @element: element to check
6672f7dacfb1SSara Sharon  * @non_inherit_element: non inheritance element
6673f7dacfb1SSara Sharon  */
6674f7dacfb1SSara Sharon bool cfg80211_is_element_inherited(const struct element *element,
6675f7dacfb1SSara Sharon 				   const struct element *non_inherit_element);
6676f7dacfb1SSara Sharon 
6677f7dacfb1SSara Sharon /**
6678fe806e49SSara Sharon  * cfg80211_merge_profile - merges a MBSSID profile if it is split between IEs
6679fe806e49SSara Sharon  * @ie: ies
6680fe806e49SSara Sharon  * @ielen: length of IEs
6681fe806e49SSara Sharon  * @mbssid_elem: current MBSSID element
6682fe806e49SSara Sharon  * @sub_elem: current MBSSID subelement (profile)
6683fe806e49SSara Sharon  * @merged_ie: location of the merged profile
6684fe806e49SSara Sharon  * @max_copy_len: max merged profile length
6685fe806e49SSara Sharon  */
6686fe806e49SSara Sharon size_t cfg80211_merge_profile(const u8 *ie, size_t ielen,
6687fe806e49SSara Sharon 			      const struct element *mbssid_elem,
6688fe806e49SSara Sharon 			      const struct element *sub_elem,
66895809a5d5SDan Carpenter 			      u8 *merged_ie, size_t max_copy_len);
6690fe806e49SSara Sharon 
6691fe806e49SSara Sharon /**
66925bc8c1f2SJohannes Berg  * enum cfg80211_bss_frame_type - frame type that the BSS data came from
66935bc8c1f2SJohannes Berg  * @CFG80211_BSS_FTYPE_UNKNOWN: driver doesn't know whether the data is
66945bc8c1f2SJohannes Berg  *	from a beacon or probe response
66955bc8c1f2SJohannes Berg  * @CFG80211_BSS_FTYPE_BEACON: data comes from a beacon
66965bc8c1f2SJohannes Berg  * @CFG80211_BSS_FTYPE_PRESP: data comes from a probe response
66975bc8c1f2SJohannes Berg  */
66985bc8c1f2SJohannes Berg enum cfg80211_bss_frame_type {
66995bc8c1f2SJohannes Berg 	CFG80211_BSS_FTYPE_UNKNOWN,
67005bc8c1f2SJohannes Berg 	CFG80211_BSS_FTYPE_BEACON,
67015bc8c1f2SJohannes Berg 	CFG80211_BSS_FTYPE_PRESP,
67025bc8c1f2SJohannes Berg };
67035bc8c1f2SJohannes Berg 
67045bc8c1f2SJohannes Berg /**
67057f599aecSAyala Beker  * cfg80211_get_ies_channel_number - returns the channel number from ies
67067f599aecSAyala Beker  * @ie: IEs
67077f599aecSAyala Beker  * @ielen: length of IEs
67087f599aecSAyala Beker  * @band: enum nl80211_band of the channel
67097f599aecSAyala Beker  * @ftype: frame type
67107f599aecSAyala Beker  *
67117f599aecSAyala Beker  * Returns the channel number, or -1 if none could be determined.
67127f599aecSAyala Beker  */
67137f599aecSAyala Beker int cfg80211_get_ies_channel_number(const u8 *ie, size_t ielen,
67147f599aecSAyala Beker 				    enum nl80211_band band,
67157f599aecSAyala Beker 				    enum cfg80211_bss_frame_type ftype);
67167f599aecSAyala Beker 
67177f599aecSAyala Beker /**
67186e19bc4bSDmitry Shmidt  * cfg80211_inform_bss_data - inform cfg80211 of a new BSS
6719abe37c4bSJohannes Berg  *
6720abe37c4bSJohannes Berg  * @wiphy: the wiphy reporting the BSS
67216e19bc4bSDmitry Shmidt  * @data: the BSS metadata
67225bc8c1f2SJohannes Berg  * @ftype: frame type (if known)
6723abe37c4bSJohannes Berg  * @bssid: the BSSID of the BSS
67247b8bcff2SJohannes Berg  * @tsf: the TSF sent by the peer in the beacon/probe response (or 0)
6725abe37c4bSJohannes Berg  * @capability: the capability field sent by the peer
6726abe37c4bSJohannes Berg  * @beacon_interval: the beacon interval announced by the peer
6727abe37c4bSJohannes Berg  * @ie: additional IEs sent by the peer
6728abe37c4bSJohannes Berg  * @ielen: length of the additional IEs
6729abe37c4bSJohannes Berg  * @gfp: context flags
6730abe37c4bSJohannes Berg  *
6731abe37c4bSJohannes Berg  * This informs cfg80211 that BSS information was found and
6732abe37c4bSJohannes Berg  * the BSS should be updated/added.
6733ef100682SJohannes Berg  *
67340ae997dcSYacine Belkadi  * Return: A referenced struct, must be released with cfg80211_put_bss()!
67350ae997dcSYacine Belkadi  * Or %NULL on error.
6736abe37c4bSJohannes Berg  */
6737ef100682SJohannes Berg struct cfg80211_bss * __must_check
67386e19bc4bSDmitry Shmidt cfg80211_inform_bss_data(struct wiphy *wiphy,
67396e19bc4bSDmitry Shmidt 			 struct cfg80211_inform_bss *data,
67406e19bc4bSDmitry Shmidt 			 enum cfg80211_bss_frame_type ftype,
67416e19bc4bSDmitry Shmidt 			 const u8 *bssid, u64 tsf, u16 capability,
67426e19bc4bSDmitry Shmidt 			 u16 beacon_interval, const u8 *ie, size_t ielen,
67436e19bc4bSDmitry Shmidt 			 gfp_t gfp);
67446e19bc4bSDmitry Shmidt 
67456e19bc4bSDmitry Shmidt static inline struct cfg80211_bss * __must_check
6746dcd6eac1SSimon Wunderlich cfg80211_inform_bss_width(struct wiphy *wiphy,
67473afc2167SEmmanuel Grumbach 			  struct ieee80211_channel *rx_channel,
6748dcd6eac1SSimon Wunderlich 			  enum nl80211_bss_scan_width scan_width,
67495bc8c1f2SJohannes Berg 			  enum cfg80211_bss_frame_type ftype,
6750dcd6eac1SSimon Wunderlich 			  const u8 *bssid, u64 tsf, u16 capability,
6751dcd6eac1SSimon Wunderlich 			  u16 beacon_interval, const u8 *ie, size_t ielen,
67526e19bc4bSDmitry Shmidt 			  s32 signal, gfp_t gfp)
67536e19bc4bSDmitry Shmidt {
67546e19bc4bSDmitry Shmidt 	struct cfg80211_inform_bss data = {
67556e19bc4bSDmitry Shmidt 		.chan = rx_channel,
67566e19bc4bSDmitry Shmidt 		.scan_width = scan_width,
67576e19bc4bSDmitry Shmidt 		.signal = signal,
67586e19bc4bSDmitry Shmidt 	};
67596e19bc4bSDmitry Shmidt 
67606e19bc4bSDmitry Shmidt 	return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf,
67616e19bc4bSDmitry Shmidt 					capability, beacon_interval, ie, ielen,
67626e19bc4bSDmitry Shmidt 					gfp);
67636e19bc4bSDmitry Shmidt }
6764dcd6eac1SSimon Wunderlich 
6765dcd6eac1SSimon Wunderlich static inline struct cfg80211_bss * __must_check
676606aa7afaSJussi Kivilinna cfg80211_inform_bss(struct wiphy *wiphy,
67673afc2167SEmmanuel Grumbach 		    struct ieee80211_channel *rx_channel,
67685bc8c1f2SJohannes Berg 		    enum cfg80211_bss_frame_type ftype,
67697b8bcff2SJohannes Berg 		    const u8 *bssid, u64 tsf, u16 capability,
67707b8bcff2SJohannes Berg 		    u16 beacon_interval, const u8 *ie, size_t ielen,
6771dcd6eac1SSimon Wunderlich 		    s32 signal, gfp_t gfp)
6772dcd6eac1SSimon Wunderlich {
67736e19bc4bSDmitry Shmidt 	struct cfg80211_inform_bss data = {
67746e19bc4bSDmitry Shmidt 		.chan = rx_channel,
67756e19bc4bSDmitry Shmidt 		.scan_width = NL80211_BSS_CHAN_WIDTH_20,
67766e19bc4bSDmitry Shmidt 		.signal = signal,
67776e19bc4bSDmitry Shmidt 	};
67786e19bc4bSDmitry Shmidt 
67796e19bc4bSDmitry Shmidt 	return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf,
67806e19bc4bSDmitry Shmidt 					capability, beacon_interval, ie, ielen,
6781dcd6eac1SSimon Wunderlich 					gfp);
6782dcd6eac1SSimon Wunderlich }
678306aa7afaSJussi Kivilinna 
678427548677SJohannes Berg /**
678527548677SJohannes Berg  * cfg80211_get_bss - get a BSS reference
678627548677SJohannes Berg  * @wiphy: the wiphy this BSS struct belongs to
678727548677SJohannes Berg  * @channel: the channel to search on (or %NULL)
678827548677SJohannes Berg  * @bssid: the desired BSSID (or %NULL)
678927548677SJohannes Berg  * @ssid: the desired SSID (or %NULL)
679027548677SJohannes Berg  * @ssid_len: length of the SSID (or 0)
679127548677SJohannes Berg  * @bss_type: type of BSS, see &enum ieee80211_bss_type
679227548677SJohannes Berg  * @privacy: privacy filter, see &enum ieee80211_privacy
679327548677SJohannes Berg  */
67942a519311SJohannes Berg struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
67952a519311SJohannes Berg 				      struct ieee80211_channel *channel,
67962a519311SJohannes Berg 				      const u8 *bssid,
679779420f09SJohannes Berg 				      const u8 *ssid, size_t ssid_len,
67986eb18137SDedy Lansky 				      enum ieee80211_bss_type bss_type,
679927548677SJohannes Berg 				      enum ieee80211_privacy privacy);
680079420f09SJohannes Berg static inline struct cfg80211_bss *
680179420f09SJohannes Berg cfg80211_get_ibss(struct wiphy *wiphy,
680279420f09SJohannes Berg 		  struct ieee80211_channel *channel,
680379420f09SJohannes Berg 		  const u8 *ssid, size_t ssid_len)
680479420f09SJohannes Berg {
680579420f09SJohannes Berg 	return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len,
68066eb18137SDedy Lansky 				IEEE80211_BSS_TYPE_IBSS,
68076eb18137SDedy Lansky 				IEEE80211_PRIVACY_ANY);
680879420f09SJohannes Berg }
680979420f09SJohannes Berg 
68104c0c0b75SJohannes Berg /**
68114c0c0b75SJohannes Berg  * cfg80211_ref_bss - reference BSS struct
68125b112d3dSJohannes Berg  * @wiphy: the wiphy this BSS struct belongs to
68134c0c0b75SJohannes Berg  * @bss: the BSS struct to reference
68144c0c0b75SJohannes Berg  *
68154c0c0b75SJohannes Berg  * Increments the refcount of the given BSS struct.
68164c0c0b75SJohannes Berg  */
68175b112d3dSJohannes Berg void cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
68184c0c0b75SJohannes Berg 
68194c0c0b75SJohannes Berg /**
68204c0c0b75SJohannes Berg  * cfg80211_put_bss - unref BSS struct
68215b112d3dSJohannes Berg  * @wiphy: the wiphy this BSS struct belongs to
68224c0c0b75SJohannes Berg  * @bss: the BSS struct
68234c0c0b75SJohannes Berg  *
68244c0c0b75SJohannes Berg  * Decrements the refcount of the given BSS struct.
68254c0c0b75SJohannes Berg  */
68265b112d3dSJohannes Berg void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
6827d3236553SJohannes Berg 
6828d491af19SJohannes Berg /**
6829d491af19SJohannes Berg  * cfg80211_unlink_bss - unlink BSS from internal data structures
6830d491af19SJohannes Berg  * @wiphy: the wiphy
6831d491af19SJohannes Berg  * @bss: the bss to remove
6832d491af19SJohannes Berg  *
6833d491af19SJohannes Berg  * This function removes the given BSS from the internal data structures
6834d491af19SJohannes Berg  * thereby making it no longer show up in scan results etc. Use this
6835d491af19SJohannes Berg  * function when you detect a BSS is gone. Normally BSSes will also time
6836d491af19SJohannes Berg  * out, so it is not necessary to use this function at all.
6837d491af19SJohannes Berg  */
6838d491af19SJohannes Berg void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
6839fee52678SJohannes Berg 
68404770c8f9SIlan Peer /**
68414770c8f9SIlan Peer  * cfg80211_bss_iter - iterate all BSS entries
68424770c8f9SIlan Peer  *
68434770c8f9SIlan Peer  * This function iterates over the BSS entries associated with the given wiphy
68444770c8f9SIlan Peer  * and calls the callback for the iterated BSS. The iterator function is not
68454770c8f9SIlan Peer  * allowed to call functions that might modify the internal state of the BSS DB.
68464770c8f9SIlan Peer  *
68474770c8f9SIlan Peer  * @wiphy: the wiphy
68484770c8f9SIlan Peer  * @chandef: if given, the iterator function will be called only if the channel
68494770c8f9SIlan Peer  *     of the currently iterated BSS is a subset of the given channel.
68504770c8f9SIlan Peer  * @iter: the iterator function to call
68514770c8f9SIlan Peer  * @iter_data: an argument to the iterator function
68524770c8f9SIlan Peer  */
68534770c8f9SIlan Peer void cfg80211_bss_iter(struct wiphy *wiphy,
68544770c8f9SIlan Peer 		       struct cfg80211_chan_def *chandef,
68554770c8f9SIlan Peer 		       void (*iter)(struct wiphy *wiphy,
68564770c8f9SIlan Peer 				    struct cfg80211_bss *bss,
68574770c8f9SIlan Peer 				    void *data),
68584770c8f9SIlan Peer 		       void *iter_data);
68594770c8f9SIlan Peer 
6860dcd6eac1SSimon Wunderlich static inline enum nl80211_bss_scan_width
6861dcd6eac1SSimon Wunderlich cfg80211_chandef_to_scan_width(const struct cfg80211_chan_def *chandef)
6862dcd6eac1SSimon Wunderlich {
6863dcd6eac1SSimon Wunderlich 	switch (chandef->width) {
6864dcd6eac1SSimon Wunderlich 	case NL80211_CHAN_WIDTH_5:
6865dcd6eac1SSimon Wunderlich 		return NL80211_BSS_CHAN_WIDTH_5;
6866dcd6eac1SSimon Wunderlich 	case NL80211_CHAN_WIDTH_10:
6867dcd6eac1SSimon Wunderlich 		return NL80211_BSS_CHAN_WIDTH_10;
6868dcd6eac1SSimon Wunderlich 	default:
6869dcd6eac1SSimon Wunderlich 		return NL80211_BSS_CHAN_WIDTH_20;
6870dcd6eac1SSimon Wunderlich 	}
6871dcd6eac1SSimon Wunderlich }
6872dcd6eac1SSimon Wunderlich 
68736039f6d2SJouni Malinen /**
68746ff57cf8SJohannes Berg  * cfg80211_rx_mlme_mgmt - notification of processed MLME management frame
68756039f6d2SJouni Malinen  * @dev: network device
68766039f6d2SJouni Malinen  * @buf: authentication frame (header + body)
68776039f6d2SJouni Malinen  * @len: length of the frame data
68786039f6d2SJouni Malinen  *
68796ff57cf8SJohannes Berg  * This function is called whenever an authentication, disassociation or
68806ff57cf8SJohannes Berg  * deauthentication frame has been received and processed in station mode.
68816ff57cf8SJohannes Berg  * After being asked to authenticate via cfg80211_ops::auth() the driver must
68826ff57cf8SJohannes Berg  * call either this function or cfg80211_auth_timeout().
68836ff57cf8SJohannes Berg  * After being asked to associate via cfg80211_ops::assoc() the driver must
68846ff57cf8SJohannes Berg  * call either this function or cfg80211_auth_timeout().
68856ff57cf8SJohannes Berg  * While connected, the driver must calls this for received and processed
68866ff57cf8SJohannes Berg  * disassociation and deauthentication frames. If the frame couldn't be used
68876ff57cf8SJohannes Berg  * because it was unprotected, the driver must call the function
68886ff57cf8SJohannes Berg  * cfg80211_rx_unprot_mlme_mgmt() instead.
68896ff57cf8SJohannes Berg  *
68906ff57cf8SJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's mutex.
68916039f6d2SJouni Malinen  */
68926ff57cf8SJohannes Berg void cfg80211_rx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len);
68936039f6d2SJouni Malinen 
68946039f6d2SJouni Malinen /**
68956ff57cf8SJohannes Berg  * cfg80211_auth_timeout - notification of timed out authentication
68961965c853SJouni Malinen  * @dev: network device
68971965c853SJouni Malinen  * @addr: The MAC address of the device with which the authentication timed out
6898cb0b4bebSJohannes Berg  *
68998d61ffa5SJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's
69008d61ffa5SJohannes Berg  * mutex.
69011965c853SJouni Malinen  */
69026ff57cf8SJohannes Berg void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr);
69031965c853SJouni Malinen 
69041965c853SJouni Malinen /**
6905cd47c0f5SJohannes Berg  * struct cfg80211_rx_assoc_resp - association response data
69066ff57cf8SJohannes Berg  * @bss: the BSS that association was requested with, ownership of the pointer
6907cd47c0f5SJohannes Berg  *	moves to cfg80211 in the call to cfg80211_rx_assoc_resp()
69084d9ec73dSJouni Malinen  * @buf: (Re)Association Response frame (header + body)
69096039f6d2SJouni Malinen  * @len: length of the frame data
6910f438ceb8SEmmanuel Grumbach  * @uapsd_queues: bitmap of queues configured for uapsd. Same format
6911f438ceb8SEmmanuel Grumbach  *	as the AC bitmap in the QoS info field
69124d9ec73dSJouni Malinen  * @req_ies: information elements from the (Re)Association Request frame
69134d9ec73dSJouni Malinen  * @req_ies_len: length of req_ies data
69145cd212cbSJohannes Berg  * @ap_mld_addr: AP MLD address (in case of MLO)
69155cd212cbSJohannes Berg  * @links: per-link information indexed by link ID, use links[0] for
69165cd212cbSJohannes Berg  *	non-MLO connections
6917cd47c0f5SJohannes Berg  */
6918cd47c0f5SJohannes Berg struct cfg80211_rx_assoc_resp {
6919cd47c0f5SJohannes Berg 	const u8 *buf;
6920cd47c0f5SJohannes Berg 	size_t len;
6921cd47c0f5SJohannes Berg 	const u8 *req_ies;
6922cd47c0f5SJohannes Berg 	size_t req_ies_len;
6923cd47c0f5SJohannes Berg 	int uapsd_queues;
69245cd212cbSJohannes Berg 	const u8 *ap_mld_addr;
69255cd212cbSJohannes Berg 	struct {
69265cd212cbSJohannes Berg 		const u8 *addr;
69275cd212cbSJohannes Berg 		struct cfg80211_bss *bss;
69285cd212cbSJohannes Berg 	} links[IEEE80211_MLD_MAX_NUM_LINKS];
6929cd47c0f5SJohannes Berg };
6930cd47c0f5SJohannes Berg 
6931cd47c0f5SJohannes Berg /**
6932cd47c0f5SJohannes Berg  * cfg80211_rx_assoc_resp - notification of processed association response
6933cd47c0f5SJohannes Berg  * @dev: network device
6934cd47c0f5SJohannes Berg  * @data: association response data, &struct cfg80211_rx_assoc_resp
69356039f6d2SJouni Malinen  *
69366ff57cf8SJohannes Berg  * After being asked to associate via cfg80211_ops::assoc() the driver must
69376ff57cf8SJohannes Berg  * call either this function or cfg80211_auth_timeout().
69386ff57cf8SJohannes Berg  *
69396ff57cf8SJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's mutex.
69406039f6d2SJouni Malinen  */
69416ff57cf8SJohannes Berg void cfg80211_rx_assoc_resp(struct net_device *dev,
6942cd47c0f5SJohannes Berg 			    struct cfg80211_rx_assoc_resp *data);
69436039f6d2SJouni Malinen 
69446039f6d2SJouni Malinen /**
6945f662d2f4SJohannes Berg  * struct cfg80211_assoc_failure - association failure data
6946f662d2f4SJohannes Berg  * @ap_mld_addr: AP MLD address, or %NULL
6947f662d2f4SJohannes Berg  * @bss: list of BSSes, must use entry 0 for non-MLO connections
6948f662d2f4SJohannes Berg  *	(@ap_mld_addr is %NULL)
6949f662d2f4SJohannes Berg  * @timeout: indicates the association failed due to timeout, otherwise
6950f662d2f4SJohannes Berg  *	the association was abandoned for a reason reported through some
6951f662d2f4SJohannes Berg  *	other API (e.g. deauth RX)
69521965c853SJouni Malinen  */
6953f662d2f4SJohannes Berg struct cfg80211_assoc_failure {
6954f662d2f4SJohannes Berg 	const u8 *ap_mld_addr;
6955f662d2f4SJohannes Berg 	struct cfg80211_bss *bss[IEEE80211_MLD_MAX_NUM_LINKS];
6956f662d2f4SJohannes Berg 	bool timeout;
6957f662d2f4SJohannes Berg };
69581965c853SJouni Malinen 
69591965c853SJouni Malinen /**
6960f662d2f4SJohannes Berg  * cfg80211_assoc_failure - notification of association failure
6961e6f462dfSJohannes Berg  * @dev: network device
6962f662d2f4SJohannes Berg  * @data: data describing the association failure
6963e6f462dfSJohannes Berg  *
6964e6f462dfSJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's mutex.
6965e6f462dfSJohannes Berg  */
6966f662d2f4SJohannes Berg void cfg80211_assoc_failure(struct net_device *dev,
6967f662d2f4SJohannes Berg 			    struct cfg80211_assoc_failure *data);
6968e6f462dfSJohannes Berg 
6969e6f462dfSJohannes Berg /**
69706ff57cf8SJohannes Berg  * cfg80211_tx_mlme_mgmt - notification of transmitted deauth/disassoc frame
69716039f6d2SJouni Malinen  * @dev: network device
69726ff57cf8SJohannes Berg  * @buf: 802.11 frame (header + body)
69736039f6d2SJouni Malinen  * @len: length of the frame data
69743bb02143SJohannes Berg  * @reconnect: immediate reconnect is desired (include the nl80211 attribute)
69756039f6d2SJouni Malinen  *
69766039f6d2SJouni Malinen  * This function is called whenever deauthentication has been processed in
697753b46b84SJouni Malinen  * station mode. This includes both received deauthentication frames and
69788d61ffa5SJohannes Berg  * locally generated ones. This function may sleep. The caller must hold the
69798d61ffa5SJohannes Berg  * corresponding wdev's mutex.
69806039f6d2SJouni Malinen  */
69813bb02143SJohannes Berg void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len,
69823bb02143SJohannes Berg 			   bool reconnect);
6983ce470613SHolger Schurig 
6984ce470613SHolger Schurig /**
69856ff57cf8SJohannes Berg  * cfg80211_rx_unprot_mlme_mgmt - notification of unprotected mlme mgmt frame
6986cf4e594eSJouni Malinen  * @dev: network device
69874d797fceSJouni Malinen  * @buf: received management frame (header + body)
6988cf4e594eSJouni Malinen  * @len: length of the frame data
6989cf4e594eSJouni Malinen  *
69906ff57cf8SJohannes Berg  * This function is called whenever a received deauthentication or dissassoc
69916ff57cf8SJohannes Berg  * frame has been dropped in station mode because of MFP being used but the
69924d797fceSJouni Malinen  * frame was not protected. This is also used to notify reception of a Beacon
69934d797fceSJouni Malinen  * frame that was dropped because it did not include a valid MME MIC while
69944d797fceSJouni Malinen  * beacon protection was enabled (BIGTK configured in station mode).
69954d797fceSJouni Malinen  *
69964d797fceSJouni Malinen  * This function may sleep.
6997cf4e594eSJouni Malinen  */
69986ff57cf8SJohannes Berg void cfg80211_rx_unprot_mlme_mgmt(struct net_device *dev,
69996ff57cf8SJohannes Berg 				  const u8 *buf, size_t len);
7000cf4e594eSJouni Malinen 
7001cf4e594eSJouni Malinen /**
7002a3b8b056SJouni Malinen  * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP)
7003a3b8b056SJouni Malinen  * @dev: network device
7004a3b8b056SJouni Malinen  * @addr: The source MAC address of the frame
7005a3b8b056SJouni Malinen  * @key_type: The key type that the received frame used
7006a66b98dbSArik Nemtsov  * @key_id: Key identifier (0..3). Can be -1 if missing.
7007a3b8b056SJouni Malinen  * @tsc: The TSC value of the frame that generated the MIC failure (6 octets)
7008e6d6e342SJohannes Berg  * @gfp: allocation flags
7009a3b8b056SJouni Malinen  *
7010a3b8b056SJouni Malinen  * This function is called whenever the local MAC detects a MIC failure in a
7011a3b8b056SJouni Malinen  * received frame. This matches with MLME-MICHAELMICFAILURE.indication()
7012a3b8b056SJouni Malinen  * primitive.
7013a3b8b056SJouni Malinen  */
7014a3b8b056SJouni Malinen void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,
7015a3b8b056SJouni Malinen 				  enum nl80211_key_type key_type, int key_id,
7016e6d6e342SJohannes Berg 				  const u8 *tsc, gfp_t gfp);
7017a3b8b056SJouni Malinen 
701804a773adSJohannes Berg /**
701904a773adSJohannes Berg  * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS
702004a773adSJohannes Berg  *
702104a773adSJohannes Berg  * @dev: network device
702204a773adSJohannes Berg  * @bssid: the BSSID of the IBSS joined
7023fe94f3a4SAntonio Quartulli  * @channel: the channel of the IBSS joined
702404a773adSJohannes Berg  * @gfp: allocation flags
702504a773adSJohannes Berg  *
702604a773adSJohannes Berg  * This function notifies cfg80211 that the device joined an IBSS or
702704a773adSJohannes Berg  * switched to a different BSSID. Before this function can be called,
702804a773adSJohannes Berg  * either a beacon has to have been received from the IBSS, or one of
702904a773adSJohannes Berg  * the cfg80211_inform_bss{,_frame} functions must have been called
703004a773adSJohannes Berg  * with the locally generated beacon -- this guarantees that there is
703104a773adSJohannes Berg  * always a scan result for this IBSS. cfg80211 will handle the rest.
703204a773adSJohannes Berg  */
7033fe94f3a4SAntonio Quartulli void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid,
7034fe94f3a4SAntonio Quartulli 			  struct ieee80211_channel *channel, gfp_t gfp);
703504a773adSJohannes Berg 
70361f87f7d3SJohannes Berg /**
7037b1e8eb11SMauro Carvalho Chehab  * cfg80211_notify_new_peer_candidate - notify cfg80211 of a new mesh peer
7038b1e8eb11SMauro Carvalho Chehab  * 					candidate
7039c93b5e71SJavier Cardona  *
7040c93b5e71SJavier Cardona  * @dev: network device
7041c93b5e71SJavier Cardona  * @macaddr: the MAC address of the new candidate
7042c93b5e71SJavier Cardona  * @ie: information elements advertised by the peer candidate
70435ac4a12dSMatteo Croce  * @ie_len: length of the information elements buffer
70442d8b08feSMauro Carvalho Chehab  * @sig_dbm: signal level in dBm
7045c93b5e71SJavier Cardona  * @gfp: allocation flags
7046c93b5e71SJavier Cardona  *
7047c93b5e71SJavier Cardona  * This function notifies cfg80211 that the mesh peer candidate has been
7048c93b5e71SJavier Cardona  * detected, most likely via a beacon or, less likely, via a probe response.
7049c93b5e71SJavier Cardona  * cfg80211 then sends a notification to userspace.
7050c93b5e71SJavier Cardona  */
7051c93b5e71SJavier Cardona void cfg80211_notify_new_peer_candidate(struct net_device *dev,
7052ecbc12adSBob Copeland 		const u8 *macaddr, const u8 *ie, u8 ie_len,
7053ecbc12adSBob Copeland 		int sig_dbm, gfp_t gfp);
7054c93b5e71SJavier Cardona 
7055c93b5e71SJavier Cardona /**
7056d70e9693SJohannes Berg  * DOC: RFkill integration
7057d70e9693SJohannes Berg  *
7058d70e9693SJohannes Berg  * RFkill integration in cfg80211 is almost invisible to drivers,
7059d70e9693SJohannes Berg  * as cfg80211 automatically registers an rfkill instance for each
7060d70e9693SJohannes Berg  * wireless device it knows about. Soft kill is also translated
7061d70e9693SJohannes Berg  * into disconnecting and turning all interfaces off, drivers are
7062d70e9693SJohannes Berg  * expected to turn off the device when all interfaces are down.
7063d70e9693SJohannes Berg  *
7064d70e9693SJohannes Berg  * However, devices may have a hard RFkill line, in which case they
7065d70e9693SJohannes Berg  * also need to interact with the rfkill subsystem, via cfg80211.
7066d70e9693SJohannes Berg  * They can do this with a few helper functions documented here.
7067d70e9693SJohannes Berg  */
7068d70e9693SJohannes Berg 
7069d70e9693SJohannes Berg /**
7070810344edSEmmanuel Grumbach  * wiphy_rfkill_set_hw_state_reason - notify cfg80211 about hw block state
70711f87f7d3SJohannes Berg  * @wiphy: the wiphy
70721f87f7d3SJohannes Berg  * @blocked: block status
70736f779a66SEmmanuel Grumbach  * @reason: one of reasons in &enum rfkill_hard_block_reasons
70741f87f7d3SJohannes Berg  */
70756f779a66SEmmanuel Grumbach void wiphy_rfkill_set_hw_state_reason(struct wiphy *wiphy, bool blocked,
70766f779a66SEmmanuel Grumbach 				      enum rfkill_hard_block_reasons reason);
70776f779a66SEmmanuel Grumbach 
70786f779a66SEmmanuel Grumbach static inline void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked)
70796f779a66SEmmanuel Grumbach {
70806f779a66SEmmanuel Grumbach 	wiphy_rfkill_set_hw_state_reason(wiphy, blocked,
70816f779a66SEmmanuel Grumbach 					 RFKILL_HARD_BLOCK_SIGNAL);
70826f779a66SEmmanuel Grumbach }
70831f87f7d3SJohannes Berg 
70841f87f7d3SJohannes Berg /**
70851f87f7d3SJohannes Berg  * wiphy_rfkill_start_polling - start polling rfkill
70861f87f7d3SJohannes Berg  * @wiphy: the wiphy
70871f87f7d3SJohannes Berg  */
70881f87f7d3SJohannes Berg void wiphy_rfkill_start_polling(struct wiphy *wiphy);
70891f87f7d3SJohannes Berg 
70901f87f7d3SJohannes Berg /**
70911f87f7d3SJohannes Berg  * wiphy_rfkill_stop_polling - stop polling rfkill
70921f87f7d3SJohannes Berg  * @wiphy: the wiphy
70931f87f7d3SJohannes Berg  */
7094358ae888SEmmanuel Grumbach static inline void wiphy_rfkill_stop_polling(struct wiphy *wiphy)
7095358ae888SEmmanuel Grumbach {
7096358ae888SEmmanuel Grumbach 	rfkill_pause_polling(wiphy->rfkill);
7097358ae888SEmmanuel Grumbach }
70981f87f7d3SJohannes Berg 
7099ad7e718cSJohannes Berg /**
7100ad7e718cSJohannes Berg  * DOC: Vendor commands
7101ad7e718cSJohannes Berg  *
7102ad7e718cSJohannes Berg  * Occasionally, there are special protocol or firmware features that
7103ad7e718cSJohannes Berg  * can't be implemented very openly. For this and similar cases, the
7104ad7e718cSJohannes Berg  * vendor command functionality allows implementing the features with
7105ad7e718cSJohannes Berg  * (typically closed-source) userspace and firmware, using nl80211 as
7106ad7e718cSJohannes Berg  * the configuration mechanism.
7107ad7e718cSJohannes Berg  *
7108ad7e718cSJohannes Berg  * A driver supporting vendor commands must register them as an array
7109ad7e718cSJohannes Berg  * in struct wiphy, with handlers for each one, each command has an
7110ad7e718cSJohannes Berg  * OUI and sub command ID to identify it.
7111ad7e718cSJohannes Berg  *
7112ad7e718cSJohannes Berg  * Note that this feature should not be (ab)used to implement protocol
7113ad7e718cSJohannes Berg  * features that could openly be shared across drivers. In particular,
7114ad7e718cSJohannes Berg  * it must never be required to use vendor commands to implement any
7115ad7e718cSJohannes Berg  * "normal" functionality that higher-level userspace like connection
7116ad7e718cSJohannes Berg  * managers etc. need.
7117ad7e718cSJohannes Berg  */
7118ad7e718cSJohannes Berg 
7119ad7e718cSJohannes Berg struct sk_buff *__cfg80211_alloc_reply_skb(struct wiphy *wiphy,
7120ad7e718cSJohannes Berg 					   enum nl80211_commands cmd,
7121ad7e718cSJohannes Berg 					   enum nl80211_attrs attr,
7122ad7e718cSJohannes Berg 					   int approxlen);
7123ad7e718cSJohannes Berg 
7124567ffc35SJohannes Berg struct sk_buff *__cfg80211_alloc_event_skb(struct wiphy *wiphy,
71256c09e791SAhmad Kholaif 					   struct wireless_dev *wdev,
7126567ffc35SJohannes Berg 					   enum nl80211_commands cmd,
7127567ffc35SJohannes Berg 					   enum nl80211_attrs attr,
712855c1fdf0SJohannes Berg 					   unsigned int portid,
7129567ffc35SJohannes Berg 					   int vendor_event_idx,
7130567ffc35SJohannes Berg 					   int approxlen, gfp_t gfp);
7131567ffc35SJohannes Berg 
7132567ffc35SJohannes Berg void __cfg80211_send_event_skb(struct sk_buff *skb, gfp_t gfp);
7133567ffc35SJohannes Berg 
7134ad7e718cSJohannes Berg /**
7135ad7e718cSJohannes Berg  * cfg80211_vendor_cmd_alloc_reply_skb - allocate vendor command reply
7136ad7e718cSJohannes Berg  * @wiphy: the wiphy
7137ad7e718cSJohannes Berg  * @approxlen: an upper bound of the length of the data that will
7138ad7e718cSJohannes Berg  *	be put into the skb
7139ad7e718cSJohannes Berg  *
7140ad7e718cSJohannes Berg  * This function allocates and pre-fills an skb for a reply to
7141ad7e718cSJohannes Berg  * a vendor command. Since it is intended for a reply, calling
7142ad7e718cSJohannes Berg  * it outside of a vendor command's doit() operation is invalid.
7143ad7e718cSJohannes Berg  *
7144ad7e718cSJohannes Berg  * The returned skb is pre-filled with some identifying data in
7145ad7e718cSJohannes Berg  * a way that any data that is put into the skb (with skb_put(),
7146ad7e718cSJohannes Berg  * nla_put() or similar) will end up being within the
7147ad7e718cSJohannes Berg  * %NL80211_ATTR_VENDOR_DATA attribute, so all that needs to be done
7148ad7e718cSJohannes Berg  * with the skb is adding data for the corresponding userspace tool
7149ad7e718cSJohannes Berg  * which can then read that data out of the vendor data attribute.
7150ad7e718cSJohannes Berg  * You must not modify the skb in any other way.
7151ad7e718cSJohannes Berg  *
7152ad7e718cSJohannes Berg  * When done, call cfg80211_vendor_cmd_reply() with the skb and return
7153ad7e718cSJohannes Berg  * its error code as the result of the doit() operation.
7154ad7e718cSJohannes Berg  *
7155ad7e718cSJohannes Berg  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
7156ad7e718cSJohannes Berg  */
7157ad7e718cSJohannes Berg static inline struct sk_buff *
7158ad7e718cSJohannes Berg cfg80211_vendor_cmd_alloc_reply_skb(struct wiphy *wiphy, int approxlen)
7159ad7e718cSJohannes Berg {
7160ad7e718cSJohannes Berg 	return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_VENDOR,
7161ad7e718cSJohannes Berg 					  NL80211_ATTR_VENDOR_DATA, approxlen);
7162ad7e718cSJohannes Berg }
7163ad7e718cSJohannes Berg 
7164ad7e718cSJohannes Berg /**
7165ad7e718cSJohannes Berg  * cfg80211_vendor_cmd_reply - send the reply skb
7166ad7e718cSJohannes Berg  * @skb: The skb, must have been allocated with
7167ad7e718cSJohannes Berg  *	cfg80211_vendor_cmd_alloc_reply_skb()
7168ad7e718cSJohannes Berg  *
7169ad7e718cSJohannes Berg  * Since calling this function will usually be the last thing
7170ad7e718cSJohannes Berg  * before returning from the vendor command doit() you should
7171ad7e718cSJohannes Berg  * return the error code.  Note that this function consumes the
7172ad7e718cSJohannes Berg  * skb regardless of the return value.
7173ad7e718cSJohannes Berg  *
7174ad7e718cSJohannes Berg  * Return: An error code or 0 on success.
7175ad7e718cSJohannes Berg  */
7176ad7e718cSJohannes Berg int cfg80211_vendor_cmd_reply(struct sk_buff *skb);
7177ad7e718cSJohannes Berg 
7178567ffc35SJohannes Berg /**
71795d9c358dSRandy Dunlap  * cfg80211_vendor_cmd_get_sender - get the current sender netlink ID
718055c1fdf0SJohannes Berg  * @wiphy: the wiphy
718155c1fdf0SJohannes Berg  *
718255c1fdf0SJohannes Berg  * Return the current netlink port ID in a vendor command handler.
718355c1fdf0SJohannes Berg  * Valid to call only there.
718455c1fdf0SJohannes Berg  */
718555c1fdf0SJohannes Berg unsigned int cfg80211_vendor_cmd_get_sender(struct wiphy *wiphy);
718655c1fdf0SJohannes Berg 
718755c1fdf0SJohannes Berg /**
7188567ffc35SJohannes Berg  * cfg80211_vendor_event_alloc - allocate vendor-specific event skb
7189567ffc35SJohannes Berg  * @wiphy: the wiphy
71906c09e791SAhmad Kholaif  * @wdev: the wireless device
7191567ffc35SJohannes Berg  * @event_idx: index of the vendor event in the wiphy's vendor_events
7192567ffc35SJohannes Berg  * @approxlen: an upper bound of the length of the data that will
7193567ffc35SJohannes Berg  *	be put into the skb
7194567ffc35SJohannes Berg  * @gfp: allocation flags
7195567ffc35SJohannes Berg  *
7196567ffc35SJohannes Berg  * This function allocates and pre-fills an skb for an event on the
7197567ffc35SJohannes Berg  * vendor-specific multicast group.
7198567ffc35SJohannes Berg  *
71996c09e791SAhmad Kholaif  * If wdev != NULL, both the ifindex and identifier of the specified
72006c09e791SAhmad Kholaif  * wireless device are added to the event message before the vendor data
72016c09e791SAhmad Kholaif  * attribute.
72026c09e791SAhmad Kholaif  *
7203567ffc35SJohannes Berg  * When done filling the skb, call cfg80211_vendor_event() with the
7204567ffc35SJohannes Berg  * skb to send the event.
7205567ffc35SJohannes Berg  *
7206567ffc35SJohannes Berg  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
7207567ffc35SJohannes Berg  */
7208567ffc35SJohannes Berg static inline struct sk_buff *
72096c09e791SAhmad Kholaif cfg80211_vendor_event_alloc(struct wiphy *wiphy, struct wireless_dev *wdev,
72106c09e791SAhmad Kholaif 			     int approxlen, int event_idx, gfp_t gfp)
7211567ffc35SJohannes Berg {
72126c09e791SAhmad Kholaif 	return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR,
7213567ffc35SJohannes Berg 					  NL80211_ATTR_VENDOR_DATA,
721455c1fdf0SJohannes Berg 					  0, event_idx, approxlen, gfp);
721555c1fdf0SJohannes Berg }
721655c1fdf0SJohannes Berg 
721755c1fdf0SJohannes Berg /**
721855c1fdf0SJohannes Berg  * cfg80211_vendor_event_alloc_ucast - alloc unicast vendor-specific event skb
721955c1fdf0SJohannes Berg  * @wiphy: the wiphy
722055c1fdf0SJohannes Berg  * @wdev: the wireless device
722155c1fdf0SJohannes Berg  * @event_idx: index of the vendor event in the wiphy's vendor_events
722255c1fdf0SJohannes Berg  * @portid: port ID of the receiver
722355c1fdf0SJohannes Berg  * @approxlen: an upper bound of the length of the data that will
722455c1fdf0SJohannes Berg  *	be put into the skb
722555c1fdf0SJohannes Berg  * @gfp: allocation flags
722655c1fdf0SJohannes Berg  *
722755c1fdf0SJohannes Berg  * This function allocates and pre-fills an skb for an event to send to
722855c1fdf0SJohannes Berg  * a specific (userland) socket. This socket would previously have been
722955c1fdf0SJohannes Berg  * obtained by cfg80211_vendor_cmd_get_sender(), and the caller MUST take
723055c1fdf0SJohannes Berg  * care to register a netlink notifier to see when the socket closes.
723155c1fdf0SJohannes Berg  *
723255c1fdf0SJohannes Berg  * If wdev != NULL, both the ifindex and identifier of the specified
723355c1fdf0SJohannes Berg  * wireless device are added to the event message before the vendor data
723455c1fdf0SJohannes Berg  * attribute.
723555c1fdf0SJohannes Berg  *
723655c1fdf0SJohannes Berg  * When done filling the skb, call cfg80211_vendor_event() with the
723755c1fdf0SJohannes Berg  * skb to send the event.
723855c1fdf0SJohannes Berg  *
723955c1fdf0SJohannes Berg  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
724055c1fdf0SJohannes Berg  */
724155c1fdf0SJohannes Berg static inline struct sk_buff *
724255c1fdf0SJohannes Berg cfg80211_vendor_event_alloc_ucast(struct wiphy *wiphy,
724355c1fdf0SJohannes Berg 				  struct wireless_dev *wdev,
724455c1fdf0SJohannes Berg 				  unsigned int portid, int approxlen,
724555c1fdf0SJohannes Berg 				  int event_idx, gfp_t gfp)
724655c1fdf0SJohannes Berg {
724755c1fdf0SJohannes Berg 	return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR,
724855c1fdf0SJohannes Berg 					  NL80211_ATTR_VENDOR_DATA,
724955c1fdf0SJohannes Berg 					  portid, event_idx, approxlen, gfp);
7250567ffc35SJohannes Berg }
7251567ffc35SJohannes Berg 
7252567ffc35SJohannes Berg /**
7253567ffc35SJohannes Berg  * cfg80211_vendor_event - send the event
7254567ffc35SJohannes Berg  * @skb: The skb, must have been allocated with cfg80211_vendor_event_alloc()
7255567ffc35SJohannes Berg  * @gfp: allocation flags
7256567ffc35SJohannes Berg  *
7257567ffc35SJohannes Berg  * This function sends the given @skb, which must have been allocated
7258567ffc35SJohannes Berg  * by cfg80211_vendor_event_alloc(), as an event. It always consumes it.
7259567ffc35SJohannes Berg  */
7260567ffc35SJohannes Berg static inline void cfg80211_vendor_event(struct sk_buff *skb, gfp_t gfp)
7261567ffc35SJohannes Berg {
7262567ffc35SJohannes Berg 	__cfg80211_send_event_skb(skb, gfp);
7263567ffc35SJohannes Berg }
7264567ffc35SJohannes Berg 
7265aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE
7266aff89a9bSJohannes Berg /**
7267d70e9693SJohannes Berg  * DOC: Test mode
7268d70e9693SJohannes Berg  *
7269d70e9693SJohannes Berg  * Test mode is a set of utility functions to allow drivers to
7270d70e9693SJohannes Berg  * interact with driver-specific tools to aid, for instance,
7271d70e9693SJohannes Berg  * factory programming.
7272d70e9693SJohannes Berg  *
7273d70e9693SJohannes Berg  * This chapter describes how drivers interact with it, for more
7274d70e9693SJohannes Berg  * information see the nl80211 book's chapter on it.
7275d70e9693SJohannes Berg  */
7276d70e9693SJohannes Berg 
7277d70e9693SJohannes Berg /**
7278aff89a9bSJohannes Berg  * cfg80211_testmode_alloc_reply_skb - allocate testmode reply
7279aff89a9bSJohannes Berg  * @wiphy: the wiphy
7280aff89a9bSJohannes Berg  * @approxlen: an upper bound of the length of the data that will
7281aff89a9bSJohannes Berg  *	be put into the skb
7282aff89a9bSJohannes Berg  *
7283aff89a9bSJohannes Berg  * This function allocates and pre-fills an skb for a reply to
7284aff89a9bSJohannes Berg  * the testmode command. Since it is intended for a reply, calling
7285aff89a9bSJohannes Berg  * it outside of the @testmode_cmd operation is invalid.
7286aff89a9bSJohannes Berg  *
72870ae997dcSYacine Belkadi  * The returned skb is pre-filled with the wiphy index and set up in
72880ae997dcSYacine Belkadi  * a way that any data that is put into the skb (with skb_put(),
72890ae997dcSYacine Belkadi  * nla_put() or similar) will end up being within the
72900ae997dcSYacine Belkadi  * %NL80211_ATTR_TESTDATA attribute, so all that needs to be done
72910ae997dcSYacine Belkadi  * with the skb is adding data for the corresponding userspace tool
72920ae997dcSYacine Belkadi  * which can then read that data out of the testdata attribute. You
72930ae997dcSYacine Belkadi  * must not modify the skb in any other way.
7294aff89a9bSJohannes Berg  *
7295aff89a9bSJohannes Berg  * When done, call cfg80211_testmode_reply() with the skb and return
7296aff89a9bSJohannes Berg  * its error code as the result of the @testmode_cmd operation.
72970ae997dcSYacine Belkadi  *
72980ae997dcSYacine Belkadi  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
7299aff89a9bSJohannes Berg  */
7300ad7e718cSJohannes Berg static inline struct sk_buff *
7301ad7e718cSJohannes Berg cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy, int approxlen)
7302ad7e718cSJohannes Berg {
7303ad7e718cSJohannes Berg 	return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_TESTMODE,
7304ad7e718cSJohannes Berg 					  NL80211_ATTR_TESTDATA, approxlen);
7305ad7e718cSJohannes Berg }
7306aff89a9bSJohannes Berg 
7307aff89a9bSJohannes Berg /**
7308aff89a9bSJohannes Berg  * cfg80211_testmode_reply - send the reply skb
7309aff89a9bSJohannes Berg  * @skb: The skb, must have been allocated with
7310aff89a9bSJohannes Berg  *	cfg80211_testmode_alloc_reply_skb()
7311aff89a9bSJohannes Berg  *
73120ae997dcSYacine Belkadi  * Since calling this function will usually be the last thing
73130ae997dcSYacine Belkadi  * before returning from the @testmode_cmd you should return
73140ae997dcSYacine Belkadi  * the error code.  Note that this function consumes the skb
73150ae997dcSYacine Belkadi  * regardless of the return value.
73160ae997dcSYacine Belkadi  *
73170ae997dcSYacine Belkadi  * Return: An error code or 0 on success.
7318aff89a9bSJohannes Berg  */
7319ad7e718cSJohannes Berg static inline int cfg80211_testmode_reply(struct sk_buff *skb)
7320ad7e718cSJohannes Berg {
7321ad7e718cSJohannes Berg 	return cfg80211_vendor_cmd_reply(skb);
7322ad7e718cSJohannes Berg }
7323aff89a9bSJohannes Berg 
7324aff89a9bSJohannes Berg /**
7325aff89a9bSJohannes Berg  * cfg80211_testmode_alloc_event_skb - allocate testmode event
7326aff89a9bSJohannes Berg  * @wiphy: the wiphy
7327aff89a9bSJohannes Berg  * @approxlen: an upper bound of the length of the data that will
7328aff89a9bSJohannes Berg  *	be put into the skb
7329aff89a9bSJohannes Berg  * @gfp: allocation flags
7330aff89a9bSJohannes Berg  *
7331aff89a9bSJohannes Berg  * This function allocates and pre-fills an skb for an event on the
7332aff89a9bSJohannes Berg  * testmode multicast group.
7333aff89a9bSJohannes Berg  *
73340ae997dcSYacine Belkadi  * The returned skb is set up in the same way as with
73350ae997dcSYacine Belkadi  * cfg80211_testmode_alloc_reply_skb() but prepared for an event. As
73360ae997dcSYacine Belkadi  * there, you should simply add data to it that will then end up in the
73370ae997dcSYacine Belkadi  * %NL80211_ATTR_TESTDATA attribute. Again, you must not modify the skb
73380ae997dcSYacine Belkadi  * in any other way.
7339aff89a9bSJohannes Berg  *
7340aff89a9bSJohannes Berg  * When done filling the skb, call cfg80211_testmode_event() with the
7341aff89a9bSJohannes Berg  * skb to send the event.
73420ae997dcSYacine Belkadi  *
73430ae997dcSYacine Belkadi  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
7344aff89a9bSJohannes Berg  */
7345567ffc35SJohannes Berg static inline struct sk_buff *
7346567ffc35SJohannes Berg cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy, int approxlen, gfp_t gfp)
7347567ffc35SJohannes Berg {
73486c09e791SAhmad Kholaif 	return __cfg80211_alloc_event_skb(wiphy, NULL, NL80211_CMD_TESTMODE,
734955c1fdf0SJohannes Berg 					  NL80211_ATTR_TESTDATA, 0, -1,
7350567ffc35SJohannes Berg 					  approxlen, gfp);
7351567ffc35SJohannes Berg }
7352aff89a9bSJohannes Berg 
7353aff89a9bSJohannes Berg /**
7354aff89a9bSJohannes Berg  * cfg80211_testmode_event - send the event
7355aff89a9bSJohannes Berg  * @skb: The skb, must have been allocated with
7356aff89a9bSJohannes Berg  *	cfg80211_testmode_alloc_event_skb()
7357aff89a9bSJohannes Berg  * @gfp: allocation flags
7358aff89a9bSJohannes Berg  *
7359aff89a9bSJohannes Berg  * This function sends the given @skb, which must have been allocated
7360aff89a9bSJohannes Berg  * by cfg80211_testmode_alloc_event_skb(), as an event. It always
7361aff89a9bSJohannes Berg  * consumes it.
7362aff89a9bSJohannes Berg  */
7363567ffc35SJohannes Berg static inline void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp)
7364567ffc35SJohannes Berg {
7365567ffc35SJohannes Berg 	__cfg80211_send_event_skb(skb, gfp);
7366567ffc35SJohannes Berg }
7367aff89a9bSJohannes Berg 
7368aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd)	.testmode_cmd = (cmd),
736971063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd)	.testmode_dump = (cmd),
7370aff89a9bSJohannes Berg #else
7371aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd)
737271063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd)
7373aff89a9bSJohannes Berg #endif
7374aff89a9bSJohannes Berg 
7375b23aa676SSamuel Ortiz /**
737676804d28SArend Van Spriel  * struct cfg80211_fils_resp_params - FILS connection response params
737776804d28SArend Van Spriel  * @kek: KEK derived from a successful FILS connection (may be %NULL)
737876804d28SArend Van Spriel  * @kek_len: Length of @fils_kek in octets
737976804d28SArend Van Spriel  * @update_erp_next_seq_num: Boolean value to specify whether the value in
738076804d28SArend Van Spriel  *	@erp_next_seq_num is valid.
738176804d28SArend Van Spriel  * @erp_next_seq_num: The next sequence number to use in ERP message in
738276804d28SArend Van Spriel  *	FILS Authentication. This value should be specified irrespective of the
738376804d28SArend Van Spriel  *	status for a FILS connection.
738476804d28SArend Van Spriel  * @pmk: A new PMK if derived from a successful FILS connection (may be %NULL).
738576804d28SArend Van Spriel  * @pmk_len: Length of @pmk in octets
738676804d28SArend Van Spriel  * @pmkid: A new PMKID if derived from a successful FILS connection or the PMKID
738776804d28SArend Van Spriel  *	used for this FILS connection (may be %NULL).
738876804d28SArend Van Spriel  */
738976804d28SArend Van Spriel struct cfg80211_fils_resp_params {
739076804d28SArend Van Spriel 	const u8 *kek;
739176804d28SArend Van Spriel 	size_t kek_len;
739276804d28SArend Van Spriel 	bool update_erp_next_seq_num;
739376804d28SArend Van Spriel 	u16 erp_next_seq_num;
739476804d28SArend Van Spriel 	const u8 *pmk;
739576804d28SArend Van Spriel 	size_t pmk_len;
739676804d28SArend Van Spriel 	const u8 *pmkid;
739776804d28SArend Van Spriel };
739876804d28SArend Van Spriel 
739976804d28SArend Van Spriel /**
74005349a0f7SVidyullatha Kanchanapally  * struct cfg80211_connect_resp_params - Connection response params
74015349a0f7SVidyullatha Kanchanapally  * @status: Status code, %WLAN_STATUS_SUCCESS for successful connection, use
74025349a0f7SVidyullatha Kanchanapally  *	%WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
74035349a0f7SVidyullatha Kanchanapally  *	the real status code for failures. If this call is used to report a
74045349a0f7SVidyullatha Kanchanapally  *	failure due to a timeout (e.g., not receiving an Authentication frame
74055349a0f7SVidyullatha Kanchanapally  *	from the AP) instead of an explicit rejection by the AP, -1 is used to
74065349a0f7SVidyullatha Kanchanapally  *	indicate that this is a failure, but without a status code.
74075349a0f7SVidyullatha Kanchanapally  *	@timeout_reason is used to report the reason for the timeout in that
74085349a0f7SVidyullatha Kanchanapally  *	case.
74095349a0f7SVidyullatha Kanchanapally  * @req_ie: Association request IEs (may be %NULL)
74105349a0f7SVidyullatha Kanchanapally  * @req_ie_len: Association request IEs length
74115349a0f7SVidyullatha Kanchanapally  * @resp_ie: Association response IEs (may be %NULL)
74125349a0f7SVidyullatha Kanchanapally  * @resp_ie_len: Association response IEs length
741376804d28SArend Van Spriel  * @fils: FILS connection response parameters.
74145349a0f7SVidyullatha Kanchanapally  * @timeout_reason: Reason for connection timeout. This is used when the
74155349a0f7SVidyullatha Kanchanapally  *	connection fails due to a timeout instead of an explicit rejection from
74165349a0f7SVidyullatha Kanchanapally  *	the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is
74175349a0f7SVidyullatha Kanchanapally  *	not known. This value is used only if @status < 0 to indicate that the
74185349a0f7SVidyullatha Kanchanapally  *	failure is due to a timeout and not due to explicit rejection by the AP.
74195349a0f7SVidyullatha Kanchanapally  *	This value is ignored in other cases (@status >= 0).
7420efbabc11SVeerendranath Jakkam  * @valid_links: For MLO connection, BIT mask of the valid link ids. Otherwise
7421efbabc11SVeerendranath Jakkam  *	zero.
7422efbabc11SVeerendranath Jakkam  * @ap_mld_addr: For MLO connection, MLD address of the AP. Otherwise %NULL.
7423efbabc11SVeerendranath Jakkam  * @links : For MLO connection, contains link info for the valid links indicated
7424efbabc11SVeerendranath Jakkam  *	using @valid_links. For non-MLO connection, links[0] contains the
7425efbabc11SVeerendranath Jakkam  *	connected AP info.
7426efbabc11SVeerendranath Jakkam  * @links.addr: For MLO connection, MAC address of the STA link. Otherwise
7427efbabc11SVeerendranath Jakkam  *	%NULL.
7428efbabc11SVeerendranath Jakkam  * @links.bssid: For MLO connection, MAC address of the AP link. For non-MLO
7429efbabc11SVeerendranath Jakkam  *	connection, links[0].bssid points to the BSSID of the AP (may be %NULL).
7430efbabc11SVeerendranath Jakkam  * @links.bss: For MLO connection, entry of bss to which STA link is connected.
7431efbabc11SVeerendranath Jakkam  *	For non-MLO connection, links[0].bss points to entry of bss to which STA
7432efbabc11SVeerendranath Jakkam  *	is connected. It can be obtained through cfg80211_get_bss() (may be
7433efbabc11SVeerendranath Jakkam  *	%NULL). It is recommended to store the bss from the connect_request and
7434efbabc11SVeerendranath Jakkam  *	hold a reference to it and return through this param to avoid a warning
7435efbabc11SVeerendranath Jakkam  *	if the bss is expired during the connection, esp. for those drivers
7436efbabc11SVeerendranath Jakkam  *	implementing connect op. Only one parameter among @bssid and @bss needs
7437efbabc11SVeerendranath Jakkam  *	to be specified.
74385349a0f7SVidyullatha Kanchanapally  */
74395349a0f7SVidyullatha Kanchanapally struct cfg80211_connect_resp_params {
74405349a0f7SVidyullatha Kanchanapally 	int status;
74415349a0f7SVidyullatha Kanchanapally 	const u8 *req_ie;
74425349a0f7SVidyullatha Kanchanapally 	size_t req_ie_len;
74435349a0f7SVidyullatha Kanchanapally 	const u8 *resp_ie;
74445349a0f7SVidyullatha Kanchanapally 	size_t resp_ie_len;
744576804d28SArend Van Spriel 	struct cfg80211_fils_resp_params fils;
74465349a0f7SVidyullatha Kanchanapally 	enum nl80211_timeout_reason timeout_reason;
7447efbabc11SVeerendranath Jakkam 
7448efbabc11SVeerendranath Jakkam 	const u8 *ap_mld_addr;
7449efbabc11SVeerendranath Jakkam 	u16 valid_links;
7450efbabc11SVeerendranath Jakkam 	struct {
7451efbabc11SVeerendranath Jakkam 		const u8 *addr;
7452efbabc11SVeerendranath Jakkam 		const u8 *bssid;
7453efbabc11SVeerendranath Jakkam 		struct cfg80211_bss *bss;
7454efbabc11SVeerendranath Jakkam 	} links[IEEE80211_MLD_MAX_NUM_LINKS];
74555349a0f7SVidyullatha Kanchanapally };
74565349a0f7SVidyullatha Kanchanapally 
74575349a0f7SVidyullatha Kanchanapally /**
74585349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_done - notify cfg80211 of connection result
74595349a0f7SVidyullatha Kanchanapally  *
74605349a0f7SVidyullatha Kanchanapally  * @dev: network device
74615349a0f7SVidyullatha Kanchanapally  * @params: connection response parameters
74625349a0f7SVidyullatha Kanchanapally  * @gfp: allocation flags
74635349a0f7SVidyullatha Kanchanapally  *
74645349a0f7SVidyullatha Kanchanapally  * It should be called by the underlying driver once execution of the connection
74655349a0f7SVidyullatha Kanchanapally  * request from connect() has been completed. This is similar to
74665349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_bss(), but takes a structure pointer for connection response
74675349a0f7SVidyullatha Kanchanapally  * parameters. Only one of the functions among cfg80211_connect_bss(),
74685349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_result(), cfg80211_connect_timeout(),
74695349a0f7SVidyullatha Kanchanapally  * and cfg80211_connect_done() should be called.
74705349a0f7SVidyullatha Kanchanapally  */
74715349a0f7SVidyullatha Kanchanapally void cfg80211_connect_done(struct net_device *dev,
74725349a0f7SVidyullatha Kanchanapally 			   struct cfg80211_connect_resp_params *params,
74735349a0f7SVidyullatha Kanchanapally 			   gfp_t gfp);
74745349a0f7SVidyullatha Kanchanapally 
74755349a0f7SVidyullatha Kanchanapally /**
7476e7054989SKanchanapally, Vidyullatha  * cfg80211_connect_bss - notify cfg80211 of connection result
7477e7054989SKanchanapally, Vidyullatha  *
7478e7054989SKanchanapally, Vidyullatha  * @dev: network device
7479e7054989SKanchanapally, Vidyullatha  * @bssid: the BSSID of the AP
7480a3ce17d1SChaitanya Tata  * @bss: Entry of bss to which STA got connected to, can be obtained through
7481a3ce17d1SChaitanya Tata  *	cfg80211_get_bss() (may be %NULL). But it is recommended to store the
7482a3ce17d1SChaitanya Tata  *	bss from the connect_request and hold a reference to it and return
7483a3ce17d1SChaitanya Tata  *	through this param to avoid a warning if the bss is expired during the
7484a3ce17d1SChaitanya Tata  *	connection, esp. for those drivers implementing connect op.
7485a3ce17d1SChaitanya Tata  *	Only one parameter among @bssid and @bss needs to be specified.
7486e7054989SKanchanapally, Vidyullatha  * @req_ie: association request IEs (maybe be %NULL)
7487e7054989SKanchanapally, Vidyullatha  * @req_ie_len: association request IEs length
7488e7054989SKanchanapally, Vidyullatha  * @resp_ie: association response IEs (may be %NULL)
7489e7054989SKanchanapally, Vidyullatha  * @resp_ie_len: assoc response IEs length
7490c88215d7SJouni Malinen  * @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use
7491e7054989SKanchanapally, Vidyullatha  *	%WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
7492c88215d7SJouni Malinen  *	the real status code for failures. If this call is used to report a
7493c88215d7SJouni Malinen  *	failure due to a timeout (e.g., not receiving an Authentication frame
7494c88215d7SJouni Malinen  *	from the AP) instead of an explicit rejection by the AP, -1 is used to
7495c88215d7SJouni Malinen  *	indicate that this is a failure, but without a status code.
7496c88215d7SJouni Malinen  *	@timeout_reason is used to report the reason for the timeout in that
7497c88215d7SJouni Malinen  *	case.
7498e7054989SKanchanapally, Vidyullatha  * @gfp: allocation flags
74993093ebbeSPurushottam Kushwaha  * @timeout_reason: reason for connection timeout. This is used when the
75003093ebbeSPurushottam Kushwaha  *	connection fails due to a timeout instead of an explicit rejection from
75013093ebbeSPurushottam Kushwaha  *	the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is
75023093ebbeSPurushottam Kushwaha  *	not known. This value is used only if @status < 0 to indicate that the
75033093ebbeSPurushottam Kushwaha  *	failure is due to a timeout and not due to explicit rejection by the AP.
75043093ebbeSPurushottam Kushwaha  *	This value is ignored in other cases (@status >= 0).
7505e7054989SKanchanapally, Vidyullatha  *
7506c88215d7SJouni Malinen  * It should be called by the underlying driver once execution of the connection
7507c88215d7SJouni Malinen  * request from connect() has been completed. This is similar to
7508c88215d7SJouni Malinen  * cfg80211_connect_result(), but with the option of identifying the exact bss
75095349a0f7SVidyullatha Kanchanapally  * entry for the connection. Only one of the functions among
75105349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_bss(), cfg80211_connect_result(),
75115349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
7512e7054989SKanchanapally, Vidyullatha  */
75135349a0f7SVidyullatha Kanchanapally static inline void
75145349a0f7SVidyullatha Kanchanapally cfg80211_connect_bss(struct net_device *dev, const u8 *bssid,
7515e7054989SKanchanapally, Vidyullatha 		     struct cfg80211_bss *bss, const u8 *req_ie,
7516e7054989SKanchanapally, Vidyullatha 		     size_t req_ie_len, const u8 *resp_ie,
75173093ebbeSPurushottam Kushwaha 		     size_t resp_ie_len, int status, gfp_t gfp,
75185349a0f7SVidyullatha Kanchanapally 		     enum nl80211_timeout_reason timeout_reason)
75195349a0f7SVidyullatha Kanchanapally {
75205349a0f7SVidyullatha Kanchanapally 	struct cfg80211_connect_resp_params params;
75215349a0f7SVidyullatha Kanchanapally 
75225349a0f7SVidyullatha Kanchanapally 	memset(&params, 0, sizeof(params));
75235349a0f7SVidyullatha Kanchanapally 	params.status = status;
7524efbabc11SVeerendranath Jakkam 	params.links[0].bssid = bssid;
7525efbabc11SVeerendranath Jakkam 	params.links[0].bss = bss;
75265349a0f7SVidyullatha Kanchanapally 	params.req_ie = req_ie;
75275349a0f7SVidyullatha Kanchanapally 	params.req_ie_len = req_ie_len;
75285349a0f7SVidyullatha Kanchanapally 	params.resp_ie = resp_ie;
75295349a0f7SVidyullatha Kanchanapally 	params.resp_ie_len = resp_ie_len;
75305349a0f7SVidyullatha Kanchanapally 	params.timeout_reason = timeout_reason;
75315349a0f7SVidyullatha Kanchanapally 
75325349a0f7SVidyullatha Kanchanapally 	cfg80211_connect_done(dev, &params, gfp);
75335349a0f7SVidyullatha Kanchanapally }
7534e7054989SKanchanapally, Vidyullatha 
7535e7054989SKanchanapally, Vidyullatha /**
7536b23aa676SSamuel Ortiz  * cfg80211_connect_result - notify cfg80211 of connection result
7537b23aa676SSamuel Ortiz  *
7538b23aa676SSamuel Ortiz  * @dev: network device
7539b23aa676SSamuel Ortiz  * @bssid: the BSSID of the AP
7540b23aa676SSamuel Ortiz  * @req_ie: association request IEs (maybe be %NULL)
7541b23aa676SSamuel Ortiz  * @req_ie_len: association request IEs length
7542b23aa676SSamuel Ortiz  * @resp_ie: association response IEs (may be %NULL)
7543b23aa676SSamuel Ortiz  * @resp_ie_len: assoc response IEs length
7544c88215d7SJouni Malinen  * @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use
7545b23aa676SSamuel Ortiz  *	%WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
7546b23aa676SSamuel Ortiz  *	the real status code for failures.
7547b23aa676SSamuel Ortiz  * @gfp: allocation flags
7548b23aa676SSamuel Ortiz  *
7549c88215d7SJouni Malinen  * It should be called by the underlying driver once execution of the connection
7550c88215d7SJouni Malinen  * request from connect() has been completed. This is similar to
7551c88215d7SJouni Malinen  * cfg80211_connect_bss() which allows the exact bss entry to be specified. Only
75525349a0f7SVidyullatha Kanchanapally  * one of the functions among cfg80211_connect_bss(), cfg80211_connect_result(),
75535349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
7554b23aa676SSamuel Ortiz  */
7555e7054989SKanchanapally, Vidyullatha static inline void
7556e7054989SKanchanapally, Vidyullatha cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
7557b23aa676SSamuel Ortiz 			const u8 *req_ie, size_t req_ie_len,
7558b23aa676SSamuel Ortiz 			const u8 *resp_ie, size_t resp_ie_len,
7559e7054989SKanchanapally, Vidyullatha 			u16 status, gfp_t gfp)
7560e7054989SKanchanapally, Vidyullatha {
7561e7054989SKanchanapally, Vidyullatha 	cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, resp_ie,
75623093ebbeSPurushottam Kushwaha 			     resp_ie_len, status, gfp,
75633093ebbeSPurushottam Kushwaha 			     NL80211_TIMEOUT_UNSPECIFIED);
7564e7054989SKanchanapally, Vidyullatha }
7565b23aa676SSamuel Ortiz 
7566b23aa676SSamuel Ortiz /**
7567bf1ecd21SJouni Malinen  * cfg80211_connect_timeout - notify cfg80211 of connection timeout
7568bf1ecd21SJouni Malinen  *
7569bf1ecd21SJouni Malinen  * @dev: network device
7570bf1ecd21SJouni Malinen  * @bssid: the BSSID of the AP
7571bf1ecd21SJouni Malinen  * @req_ie: association request IEs (maybe be %NULL)
7572bf1ecd21SJouni Malinen  * @req_ie_len: association request IEs length
7573bf1ecd21SJouni Malinen  * @gfp: allocation flags
75743093ebbeSPurushottam Kushwaha  * @timeout_reason: reason for connection timeout.
7575bf1ecd21SJouni Malinen  *
7576bf1ecd21SJouni Malinen  * It should be called by the underlying driver whenever connect() has failed
7577bf1ecd21SJouni Malinen  * in a sequence where no explicit authentication/association rejection was
7578bf1ecd21SJouni Malinen  * received from the AP. This could happen, e.g., due to not being able to send
7579bf1ecd21SJouni Malinen  * out the Authentication or Association Request frame or timing out while
75805349a0f7SVidyullatha Kanchanapally  * waiting for the response. Only one of the functions among
75815349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_bss(), cfg80211_connect_result(),
75825349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
7583bf1ecd21SJouni Malinen  */
7584bf1ecd21SJouni Malinen static inline void
7585bf1ecd21SJouni Malinen cfg80211_connect_timeout(struct net_device *dev, const u8 *bssid,
75863093ebbeSPurushottam Kushwaha 			 const u8 *req_ie, size_t req_ie_len, gfp_t gfp,
75873093ebbeSPurushottam Kushwaha 			 enum nl80211_timeout_reason timeout_reason)
7588bf1ecd21SJouni Malinen {
7589bf1ecd21SJouni Malinen 	cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, NULL, 0, -1,
75903093ebbeSPurushottam Kushwaha 			     gfp, timeout_reason);
7591bf1ecd21SJouni Malinen }
7592bf1ecd21SJouni Malinen 
7593bf1ecd21SJouni Malinen /**
759429ce6ecbSAvraham Stern  * struct cfg80211_roam_info - driver initiated roaming information
759529ce6ecbSAvraham Stern  *
759629ce6ecbSAvraham Stern  * @req_ie: association request IEs (maybe be %NULL)
759729ce6ecbSAvraham Stern  * @req_ie_len: association request IEs length
759829ce6ecbSAvraham Stern  * @resp_ie: association response IEs (may be %NULL)
759929ce6ecbSAvraham Stern  * @resp_ie_len: assoc response IEs length
7600e841b7b1SArend Van Spriel  * @fils: FILS related roaming information.
7601efbabc11SVeerendranath Jakkam  * @valid_links: For MLO roaming, BIT mask of the new valid links is set.
7602efbabc11SVeerendranath Jakkam  *	Otherwise zero.
7603efbabc11SVeerendranath Jakkam  * @ap_mld_addr: For MLO roaming, MLD address of the new AP. Otherwise %NULL.
7604efbabc11SVeerendranath Jakkam  * @links : For MLO roaming, contains new link info for the valid links set in
7605efbabc11SVeerendranath Jakkam  *	@valid_links. For non-MLO roaming, links[0] contains the new AP info.
7606efbabc11SVeerendranath Jakkam  * @links.addr: For MLO roaming, MAC address of the STA link. Otherwise %NULL.
7607efbabc11SVeerendranath Jakkam  * @links.bssid: For MLO roaming, MAC address of the new AP link. For non-MLO
7608efbabc11SVeerendranath Jakkam  *	roaming, links[0].bssid points to the BSSID of the new AP. May be
7609efbabc11SVeerendranath Jakkam  *	%NULL if %links.bss is set.
7610efbabc11SVeerendranath Jakkam  * @links.channel: the channel of the new AP.
7611efbabc11SVeerendranath Jakkam  * @links.bss: For MLO roaming, entry of new bss to which STA link got
7612efbabc11SVeerendranath Jakkam  *	roamed. For non-MLO roaming, links[0].bss points to entry of bss to
7613efbabc11SVeerendranath Jakkam  *	which STA got roamed (may be %NULL if %links.bssid is set)
761429ce6ecbSAvraham Stern  */
761529ce6ecbSAvraham Stern struct cfg80211_roam_info {
761629ce6ecbSAvraham Stern 	const u8 *req_ie;
761729ce6ecbSAvraham Stern 	size_t req_ie_len;
761829ce6ecbSAvraham Stern 	const u8 *resp_ie;
761929ce6ecbSAvraham Stern 	size_t resp_ie_len;
7620e841b7b1SArend Van Spriel 	struct cfg80211_fils_resp_params fils;
7621efbabc11SVeerendranath Jakkam 
7622efbabc11SVeerendranath Jakkam 	const u8 *ap_mld_addr;
7623efbabc11SVeerendranath Jakkam 	u16 valid_links;
7624efbabc11SVeerendranath Jakkam 	struct {
7625efbabc11SVeerendranath Jakkam 		const u8 *addr;
7626efbabc11SVeerendranath Jakkam 		const u8 *bssid;
7627efbabc11SVeerendranath Jakkam 		struct ieee80211_channel *channel;
7628efbabc11SVeerendranath Jakkam 		struct cfg80211_bss *bss;
7629efbabc11SVeerendranath Jakkam 	} links[IEEE80211_MLD_MAX_NUM_LINKS];
763029ce6ecbSAvraham Stern };
763129ce6ecbSAvraham Stern 
763229ce6ecbSAvraham Stern /**
7633b23aa676SSamuel Ortiz  * cfg80211_roamed - notify cfg80211 of roaming
7634b23aa676SSamuel Ortiz  *
7635b23aa676SSamuel Ortiz  * @dev: network device
763629ce6ecbSAvraham Stern  * @info: information about the new BSS. struct &cfg80211_roam_info.
7637b23aa676SSamuel Ortiz  * @gfp: allocation flags
7638b23aa676SSamuel Ortiz  *
763929ce6ecbSAvraham Stern  * This function may be called with the driver passing either the BSSID of the
764029ce6ecbSAvraham Stern  * new AP or passing the bss entry to avoid a race in timeout of the bss entry.
764129ce6ecbSAvraham Stern  * It should be called by the underlying driver whenever it roamed from one AP
764229ce6ecbSAvraham Stern  * to another while connected. Drivers which have roaming implemented in
764329ce6ecbSAvraham Stern  * firmware should pass the bss entry to avoid a race in bss entry timeout where
764429ce6ecbSAvraham Stern  * the bss entry of the new AP is seen in the driver, but gets timed out by the
764529ce6ecbSAvraham Stern  * time it is accessed in __cfg80211_roamed() due to delay in scheduling
7646adbde344SVasanthakumar Thiagarajan  * rdev->event_work. In case of any failures, the reference is released
764729ce6ecbSAvraham Stern  * either in cfg80211_roamed() or in __cfg80211_romed(), Otherwise, it will be
7648e1b18549SGeert Uytterhoeven  * released while disconnecting from the current bss.
7649adbde344SVasanthakumar Thiagarajan  */
765029ce6ecbSAvraham Stern void cfg80211_roamed(struct net_device *dev, struct cfg80211_roam_info *info,
765129ce6ecbSAvraham Stern 		     gfp_t gfp);
7652adbde344SVasanthakumar Thiagarajan 
7653adbde344SVasanthakumar Thiagarajan /**
7654503c1fb9SAvraham Stern  * cfg80211_port_authorized - notify cfg80211 of successful security association
7655503c1fb9SAvraham Stern  *
7656503c1fb9SAvraham Stern  * @dev: network device
7657503c1fb9SAvraham Stern  * @bssid: the BSSID of the AP
7658503c1fb9SAvraham Stern  * @gfp: allocation flags
7659503c1fb9SAvraham Stern  *
7660503c1fb9SAvraham Stern  * This function should be called by a driver that supports 4 way handshake
7661503c1fb9SAvraham Stern  * offload after a security association was successfully established (i.e.,
7662503c1fb9SAvraham Stern  * the 4 way handshake was completed successfully). The call to this function
7663503c1fb9SAvraham Stern  * should be preceded with a call to cfg80211_connect_result(),
7664503c1fb9SAvraham Stern  * cfg80211_connect_done(), cfg80211_connect_bss() or cfg80211_roamed() to
7665503c1fb9SAvraham Stern  * indicate the 802.11 association.
7666503c1fb9SAvraham Stern  */
7667503c1fb9SAvraham Stern void cfg80211_port_authorized(struct net_device *dev, const u8 *bssid,
7668503c1fb9SAvraham Stern 			      gfp_t gfp);
7669503c1fb9SAvraham Stern 
7670503c1fb9SAvraham Stern /**
7671b23aa676SSamuel Ortiz  * cfg80211_disconnected - notify cfg80211 that connection was dropped
7672b23aa676SSamuel Ortiz  *
7673b23aa676SSamuel Ortiz  * @dev: network device
7674b23aa676SSamuel Ortiz  * @ie: information elements of the deauth/disassoc frame (may be %NULL)
7675b23aa676SSamuel Ortiz  * @ie_len: length of IEs
7676b23aa676SSamuel Ortiz  * @reason: reason code for the disconnection, set it to 0 if unknown
767780279fb7SJohannes Berg  * @locally_generated: disconnection was requested locally
7678b23aa676SSamuel Ortiz  * @gfp: allocation flags
7679b23aa676SSamuel Ortiz  *
7680b23aa676SSamuel Ortiz  * After it calls this function, the driver should enter an idle state
7681b23aa676SSamuel Ortiz  * and not try to connect to any AP any more.
7682b23aa676SSamuel Ortiz  */
7683b23aa676SSamuel Ortiz void cfg80211_disconnected(struct net_device *dev, u16 reason,
768480279fb7SJohannes Berg 			   const u8 *ie, size_t ie_len,
768580279fb7SJohannes Berg 			   bool locally_generated, gfp_t gfp);
7686b23aa676SSamuel Ortiz 
76879588bbd5SJouni Malinen /**
76889588bbd5SJouni Malinen  * cfg80211_ready_on_channel - notification of remain_on_channel start
768971bbc994SJohannes Berg  * @wdev: wireless device
76909588bbd5SJouni Malinen  * @cookie: the request cookie
76919588bbd5SJouni Malinen  * @chan: The current channel (from remain_on_channel request)
76929588bbd5SJouni Malinen  * @duration: Duration in milliseconds that the driver intents to remain on the
76939588bbd5SJouni Malinen  *	channel
76949588bbd5SJouni Malinen  * @gfp: allocation flags
76959588bbd5SJouni Malinen  */
769671bbc994SJohannes Berg void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie,
76979588bbd5SJouni Malinen 			       struct ieee80211_channel *chan,
76989588bbd5SJouni Malinen 			       unsigned int duration, gfp_t gfp);
76999588bbd5SJouni Malinen 
77009588bbd5SJouni Malinen /**
77019588bbd5SJouni Malinen  * cfg80211_remain_on_channel_expired - remain_on_channel duration expired
770271bbc994SJohannes Berg  * @wdev: wireless device
77039588bbd5SJouni Malinen  * @cookie: the request cookie
77049588bbd5SJouni Malinen  * @chan: The current channel (from remain_on_channel request)
77059588bbd5SJouni Malinen  * @gfp: allocation flags
77069588bbd5SJouni Malinen  */
770771bbc994SJohannes Berg void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie,
77089588bbd5SJouni Malinen 					struct ieee80211_channel *chan,
77099588bbd5SJouni Malinen 					gfp_t gfp);
7710b23aa676SSamuel Ortiz 
77118689c051SArend van Spriel /**
77121c38c7f2SJames Prestwood  * cfg80211_tx_mgmt_expired - tx_mgmt duration expired
77131c38c7f2SJames Prestwood  * @wdev: wireless device
77141c38c7f2SJames Prestwood  * @cookie: the requested cookie
77151c38c7f2SJames Prestwood  * @chan: The current channel (from tx_mgmt request)
77161c38c7f2SJames Prestwood  * @gfp: allocation flags
77171c38c7f2SJames Prestwood  */
77181c38c7f2SJames Prestwood void cfg80211_tx_mgmt_expired(struct wireless_dev *wdev, u64 cookie,
77191c38c7f2SJames Prestwood 			      struct ieee80211_channel *chan, gfp_t gfp);
77201c38c7f2SJames Prestwood 
77211c38c7f2SJames Prestwood /**
77228689c051SArend van Spriel  * cfg80211_sinfo_alloc_tid_stats - allocate per-tid statistics.
77238689c051SArend van Spriel  *
77248689c051SArend van Spriel  * @sinfo: the station information
77258689c051SArend van Spriel  * @gfp: allocation flags
77268689c051SArend van Spriel  */
77278689c051SArend van Spriel int cfg80211_sinfo_alloc_tid_stats(struct station_info *sinfo, gfp_t gfp);
772898b62183SJohannes Berg 
772998b62183SJohannes Berg /**
77307ea3e110SJohannes Berg  * cfg80211_sinfo_release_content - release contents of station info
77317ea3e110SJohannes Berg  * @sinfo: the station information
77327ea3e110SJohannes Berg  *
77337ea3e110SJohannes Berg  * Releases any potentially allocated sub-information of the station
77347ea3e110SJohannes Berg  * information, but not the struct itself (since it's typically on
77357ea3e110SJohannes Berg  * the stack.)
77367ea3e110SJohannes Berg  */
77377ea3e110SJohannes Berg static inline void cfg80211_sinfo_release_content(struct station_info *sinfo)
77387ea3e110SJohannes Berg {
77397ea3e110SJohannes Berg 	kfree(sinfo->pertid);
77407ea3e110SJohannes Berg }
77417ea3e110SJohannes Berg 
77427ea3e110SJohannes Berg /**
774398b62183SJohannes Berg  * cfg80211_new_sta - notify userspace about station
774498b62183SJohannes Berg  *
774598b62183SJohannes Berg  * @dev: the netdev
774698b62183SJohannes Berg  * @mac_addr: the station's address
774798b62183SJohannes Berg  * @sinfo: the station information
774898b62183SJohannes Berg  * @gfp: allocation flags
774998b62183SJohannes Berg  */
775098b62183SJohannes Berg void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr,
775198b62183SJohannes Berg 		      struct station_info *sinfo, gfp_t gfp);
775298b62183SJohannes Berg 
7753026331c4SJouni Malinen /**
7754cf5ead82SJohannes Berg  * cfg80211_del_sta_sinfo - notify userspace about deletion of a station
7755cf5ead82SJohannes Berg  * @dev: the netdev
7756cf5ead82SJohannes Berg  * @mac_addr: the station's address
7757cf5ead82SJohannes Berg  * @sinfo: the station information/statistics
7758cf5ead82SJohannes Berg  * @gfp: allocation flags
7759cf5ead82SJohannes Berg  */
7760cf5ead82SJohannes Berg void cfg80211_del_sta_sinfo(struct net_device *dev, const u8 *mac_addr,
7761cf5ead82SJohannes Berg 			    struct station_info *sinfo, gfp_t gfp);
7762cf5ead82SJohannes Berg 
7763cf5ead82SJohannes Berg /**
7764ec15e68bSJouni Malinen  * cfg80211_del_sta - notify userspace about deletion of a station
7765ec15e68bSJouni Malinen  *
7766ec15e68bSJouni Malinen  * @dev: the netdev
7767ec15e68bSJouni Malinen  * @mac_addr: the station's address
7768ec15e68bSJouni Malinen  * @gfp: allocation flags
7769ec15e68bSJouni Malinen  */
7770cf5ead82SJohannes Berg static inline void cfg80211_del_sta(struct net_device *dev,
7771cf5ead82SJohannes Berg 				    const u8 *mac_addr, gfp_t gfp)
7772cf5ead82SJohannes Berg {
7773cf5ead82SJohannes Berg 	cfg80211_del_sta_sinfo(dev, mac_addr, NULL, gfp);
7774cf5ead82SJohannes Berg }
7775ec15e68bSJouni Malinen 
7776ec15e68bSJouni Malinen /**
7777ed44a951SPandiyarajan Pitchaimuthu  * cfg80211_conn_failed - connection request failed notification
7778ed44a951SPandiyarajan Pitchaimuthu  *
7779ed44a951SPandiyarajan Pitchaimuthu  * @dev: the netdev
7780ed44a951SPandiyarajan Pitchaimuthu  * @mac_addr: the station's address
7781ed44a951SPandiyarajan Pitchaimuthu  * @reason: the reason for connection failure
7782ed44a951SPandiyarajan Pitchaimuthu  * @gfp: allocation flags
7783ed44a951SPandiyarajan Pitchaimuthu  *
7784ed44a951SPandiyarajan Pitchaimuthu  * Whenever a station tries to connect to an AP and if the station
7785ed44a951SPandiyarajan Pitchaimuthu  * could not connect to the AP as the AP has rejected the connection
7786ed44a951SPandiyarajan Pitchaimuthu  * for some reasons, this function is called.
7787ed44a951SPandiyarajan Pitchaimuthu  *
7788ed44a951SPandiyarajan Pitchaimuthu  * The reason for connection failure can be any of the value from
7789ed44a951SPandiyarajan Pitchaimuthu  * nl80211_connect_failed_reason enum
7790ed44a951SPandiyarajan Pitchaimuthu  */
7791ed44a951SPandiyarajan Pitchaimuthu void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr,
7792ed44a951SPandiyarajan Pitchaimuthu 			  enum nl80211_connect_failed_reason reason,
7793ed44a951SPandiyarajan Pitchaimuthu 			  gfp_t gfp);
7794ed44a951SPandiyarajan Pitchaimuthu 
7795ed44a951SPandiyarajan Pitchaimuthu /**
7796e76fede8SThomas Pedersen  * cfg80211_rx_mgmt_khz - notification of received, unprocessed management frame
7797e76fede8SThomas Pedersen  * @wdev: wireless device receiving the frame
7798e76fede8SThomas Pedersen  * @freq: Frequency on which the frame was received in KHz
7799e76fede8SThomas Pedersen  * @sig_dbm: signal strength in dBm, or 0 if unknown
7800e76fede8SThomas Pedersen  * @buf: Management frame (header + body)
7801e76fede8SThomas Pedersen  * @len: length of the frame data
7802e76fede8SThomas Pedersen  * @flags: flags, as defined in enum nl80211_rxmgmt_flags
7803e76fede8SThomas Pedersen  *
7804e76fede8SThomas Pedersen  * This function is called whenever an Action frame is received for a station
7805e76fede8SThomas Pedersen  * mode interface, but is not processed in kernel.
7806e76fede8SThomas Pedersen  *
7807e76fede8SThomas Pedersen  * Return: %true if a user space application has registered for this frame.
7808e76fede8SThomas Pedersen  * For action frames, that makes it responsible for rejecting unrecognized
7809e76fede8SThomas Pedersen  * action frames; %false otherwise, in which case for action frames the
7810e76fede8SThomas Pedersen  * driver is responsible for rejecting the frame.
7811e76fede8SThomas Pedersen  */
7812e76fede8SThomas Pedersen bool cfg80211_rx_mgmt_khz(struct wireless_dev *wdev, int freq, int sig_dbm,
7813e76fede8SThomas Pedersen 			  const u8 *buf, size_t len, u32 flags);
7814e76fede8SThomas Pedersen 
7815e76fede8SThomas Pedersen /**
78162e161f78SJohannes Berg  * cfg80211_rx_mgmt - notification of received, unprocessed management frame
781771bbc994SJohannes Berg  * @wdev: wireless device receiving the frame
7818026331c4SJouni Malinen  * @freq: Frequency on which the frame was received in MHz
78196c2fb1e6SSergey Matyukevich  * @sig_dbm: signal strength in dBm, or 0 if unknown
78202e161f78SJohannes Berg  * @buf: Management frame (header + body)
7821026331c4SJouni Malinen  * @len: length of the frame data
782219504cf5SVladimir Kondratiev  * @flags: flags, as defined in enum nl80211_rxmgmt_flags
78232e161f78SJohannes Berg  *
78240ae997dcSYacine Belkadi  * This function is called whenever an Action frame is received for a station
78250ae997dcSYacine Belkadi  * mode interface, but is not processed in kernel.
78260ae997dcSYacine Belkadi  *
78270ae997dcSYacine Belkadi  * Return: %true if a user space application has registered for this frame.
78282e161f78SJohannes Berg  * For action frames, that makes it responsible for rejecting unrecognized
78292e161f78SJohannes Berg  * action frames; %false otherwise, in which case for action frames the
78302e161f78SJohannes Berg  * driver is responsible for rejecting the frame.
7831026331c4SJouni Malinen  */
7832e76fede8SThomas Pedersen static inline bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq,
7833e76fede8SThomas Pedersen 				    int sig_dbm, const u8 *buf, size_t len,
7834e76fede8SThomas Pedersen 				    u32 flags)
7835e76fede8SThomas Pedersen {
7836e76fede8SThomas Pedersen 	return cfg80211_rx_mgmt_khz(wdev, MHZ_TO_KHZ(freq), sig_dbm, buf, len,
7837e76fede8SThomas Pedersen 				    flags);
7838e76fede8SThomas Pedersen }
7839026331c4SJouni Malinen 
7840026331c4SJouni Malinen /**
7841*ea7d50c9SAvraham Stern  * struct cfg80211_tx_status - TX status for management frame information
7842*ea7d50c9SAvraham Stern  *
7843*ea7d50c9SAvraham Stern  * @cookie: Cookie returned by cfg80211_ops::mgmt_tx()
7844*ea7d50c9SAvraham Stern  * @tx_tstamp: hardware TX timestamp in nanoseconds
7845*ea7d50c9SAvraham Stern  * @ack_tstamp: hardware ack RX timestamp in nanoseconds
7846*ea7d50c9SAvraham Stern  * @buf: Management frame (header + body)
7847*ea7d50c9SAvraham Stern  * @len: length of the frame data
7848*ea7d50c9SAvraham Stern  * @ack: Whether frame was acknowledged
7849*ea7d50c9SAvraham Stern  */
7850*ea7d50c9SAvraham Stern struct cfg80211_tx_status {
7851*ea7d50c9SAvraham Stern 	u64 cookie;
7852*ea7d50c9SAvraham Stern 	u64 tx_tstamp;
7853*ea7d50c9SAvraham Stern 	u64 ack_tstamp;
7854*ea7d50c9SAvraham Stern 	const u8 *buf;
7855*ea7d50c9SAvraham Stern 	size_t len;
7856*ea7d50c9SAvraham Stern 	bool ack;
7857*ea7d50c9SAvraham Stern };
7858*ea7d50c9SAvraham Stern 
7859*ea7d50c9SAvraham Stern /**
7860*ea7d50c9SAvraham Stern  * cfg80211_mgmt_tx_status_ext - TX status notification with extended info
7861*ea7d50c9SAvraham Stern  * @wdev: wireless device receiving the frame
7862*ea7d50c9SAvraham Stern  * @status: TX status data
7863*ea7d50c9SAvraham Stern  * @gfp: context flags
7864*ea7d50c9SAvraham Stern  *
7865*ea7d50c9SAvraham Stern  * This function is called whenever a management frame was requested to be
7866*ea7d50c9SAvraham Stern  * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the
7867*ea7d50c9SAvraham Stern  * transmission attempt with extended info.
7868*ea7d50c9SAvraham Stern  */
7869*ea7d50c9SAvraham Stern void cfg80211_mgmt_tx_status_ext(struct wireless_dev *wdev,
7870*ea7d50c9SAvraham Stern 				 struct cfg80211_tx_status *status, gfp_t gfp);
7871*ea7d50c9SAvraham Stern 
7872*ea7d50c9SAvraham Stern /**
78732e161f78SJohannes Berg  * cfg80211_mgmt_tx_status - notification of TX status for management frame
787471bbc994SJohannes Berg  * @wdev: wireless device receiving the frame
78752e161f78SJohannes Berg  * @cookie: Cookie returned by cfg80211_ops::mgmt_tx()
78762e161f78SJohannes Berg  * @buf: Management frame (header + body)
7877026331c4SJouni Malinen  * @len: length of the frame data
7878026331c4SJouni Malinen  * @ack: Whether frame was acknowledged
7879026331c4SJouni Malinen  * @gfp: context flags
7880026331c4SJouni Malinen  *
78812e161f78SJohannes Berg  * This function is called whenever a management frame was requested to be
78822e161f78SJohannes Berg  * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the
7883026331c4SJouni Malinen  * transmission attempt.
7884026331c4SJouni Malinen  */
7885*ea7d50c9SAvraham Stern static inline void cfg80211_mgmt_tx_status(struct wireless_dev *wdev,
7886*ea7d50c9SAvraham Stern 					   u64 cookie, const u8 *buf,
7887*ea7d50c9SAvraham Stern 					   size_t len, bool ack, gfp_t gfp)
7888*ea7d50c9SAvraham Stern {
7889*ea7d50c9SAvraham Stern 	struct cfg80211_tx_status status = {
7890*ea7d50c9SAvraham Stern 		.cookie = cookie,
7891*ea7d50c9SAvraham Stern 		.buf = buf,
7892*ea7d50c9SAvraham Stern 		.len = len,
7893*ea7d50c9SAvraham Stern 		.ack = ack
7894*ea7d50c9SAvraham Stern 	};
7895*ea7d50c9SAvraham Stern 
7896*ea7d50c9SAvraham Stern 	cfg80211_mgmt_tx_status_ext(wdev, &status, gfp);
7897*ea7d50c9SAvraham Stern }
7898026331c4SJouni Malinen 
7899dca9ca2dSMarkus Theil /**
7900dca9ca2dSMarkus Theil  * cfg80211_control_port_tx_status - notification of TX status for control
7901dca9ca2dSMarkus Theil  *                                   port frames
7902dca9ca2dSMarkus Theil  * @wdev: wireless device receiving the frame
7903dca9ca2dSMarkus Theil  * @cookie: Cookie returned by cfg80211_ops::tx_control_port()
7904dca9ca2dSMarkus Theil  * @buf: Data frame (header + body)
7905dca9ca2dSMarkus Theil  * @len: length of the frame data
7906dca9ca2dSMarkus Theil  * @ack: Whether frame was acknowledged
7907dca9ca2dSMarkus Theil  * @gfp: context flags
7908dca9ca2dSMarkus Theil  *
7909dca9ca2dSMarkus Theil  * This function is called whenever a control port frame was requested to be
7910dca9ca2dSMarkus Theil  * transmitted with cfg80211_ops::tx_control_port() to report the TX status of
7911dca9ca2dSMarkus Theil  * the transmission attempt.
7912dca9ca2dSMarkus Theil  */
7913dca9ca2dSMarkus Theil void cfg80211_control_port_tx_status(struct wireless_dev *wdev, u64 cookie,
7914dca9ca2dSMarkus Theil 				     const u8 *buf, size_t len, bool ack,
7915dca9ca2dSMarkus Theil 				     gfp_t gfp);
7916d6dc1a38SJuuso Oikarinen 
7917d6dc1a38SJuuso Oikarinen /**
79186a671a50SDenis Kenzior  * cfg80211_rx_control_port - notification about a received control port frame
79196a671a50SDenis Kenzior  * @dev: The device the frame matched to
7920a948f713SDenis Kenzior  * @skb: The skbuf with the control port frame.  It is assumed that the skbuf
7921a948f713SDenis Kenzior  *	is 802.3 formatted (with 802.3 header).  The skb can be non-linear.
7922a948f713SDenis Kenzior  *	This function does not take ownership of the skb, so the caller is
7923a948f713SDenis Kenzior  *	responsible for any cleanup.  The caller must also ensure that
7924a948f713SDenis Kenzior  *	skb->protocol is set appropriately.
79256a671a50SDenis Kenzior  * @unencrypted: Whether the frame was received unencrypted
79266a671a50SDenis Kenzior  *
79276a671a50SDenis Kenzior  * This function is used to inform userspace about a received control port
79286a671a50SDenis Kenzior  * frame.  It should only be used if userspace indicated it wants to receive
79296a671a50SDenis Kenzior  * control port frames over nl80211.
79306a671a50SDenis Kenzior  *
79316a671a50SDenis Kenzior  * The frame is the data portion of the 802.3 or 802.11 data frame with all
79326a671a50SDenis Kenzior  * network layer headers removed (e.g. the raw EAPoL frame).
79336a671a50SDenis Kenzior  *
79346a671a50SDenis Kenzior  * Return: %true if the frame was passed to userspace
79356a671a50SDenis Kenzior  */
79366a671a50SDenis Kenzior bool cfg80211_rx_control_port(struct net_device *dev,
7937a948f713SDenis Kenzior 			      struct sk_buff *skb, bool unencrypted);
79386a671a50SDenis Kenzior 
79396a671a50SDenis Kenzior /**
7940d6dc1a38SJuuso Oikarinen  * cfg80211_cqm_rssi_notify - connection quality monitoring rssi event
7941d6dc1a38SJuuso Oikarinen  * @dev: network device
7942d6dc1a38SJuuso Oikarinen  * @rssi_event: the triggered RSSI event
7943bee427b8SAndrzej Zaborowski  * @rssi_level: new RSSI level value or 0 if not available
7944d6dc1a38SJuuso Oikarinen  * @gfp: context flags
7945d6dc1a38SJuuso Oikarinen  *
7946d6dc1a38SJuuso Oikarinen  * This function is called when a configured connection quality monitoring
7947d6dc1a38SJuuso Oikarinen  * rssi threshold reached event occurs.
7948d6dc1a38SJuuso Oikarinen  */
7949d6dc1a38SJuuso Oikarinen void cfg80211_cqm_rssi_notify(struct net_device *dev,
7950d6dc1a38SJuuso Oikarinen 			      enum nl80211_cqm_rssi_threshold_event rssi_event,
7951bee427b8SAndrzej Zaborowski 			      s32 rssi_level, gfp_t gfp);
7952d6dc1a38SJuuso Oikarinen 
7953c063dbf5SJohannes Berg /**
7954c063dbf5SJohannes Berg  * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer
7955c063dbf5SJohannes Berg  * @dev: network device
7956c063dbf5SJohannes Berg  * @peer: peer's MAC address
7957c063dbf5SJohannes Berg  * @num_packets: how many packets were lost -- should be a fixed threshold
7958c063dbf5SJohannes Berg  *	but probably no less than maybe 50, or maybe a throughput dependent
7959c063dbf5SJohannes Berg  *	threshold (to account for temporary interference)
7960c063dbf5SJohannes Berg  * @gfp: context flags
7961c063dbf5SJohannes Berg  */
7962c063dbf5SJohannes Berg void cfg80211_cqm_pktloss_notify(struct net_device *dev,
7963c063dbf5SJohannes Berg 				 const u8 *peer, u32 num_packets, gfp_t gfp);
7964c063dbf5SJohannes Berg 
7965e5497d76SJohannes Berg /**
796684f10708SThomas Pedersen  * cfg80211_cqm_txe_notify - TX error rate event
796784f10708SThomas Pedersen  * @dev: network device
796884f10708SThomas Pedersen  * @peer: peer's MAC address
796984f10708SThomas Pedersen  * @num_packets: how many packets were lost
797084f10708SThomas Pedersen  * @rate: % of packets which failed transmission
797184f10708SThomas Pedersen  * @intvl: interval (in s) over which the TX failure threshold was breached.
797284f10708SThomas Pedersen  * @gfp: context flags
797384f10708SThomas Pedersen  *
797484f10708SThomas Pedersen  * Notify userspace when configured % TX failures over number of packets in a
797584f10708SThomas Pedersen  * given interval is exceeded.
797684f10708SThomas Pedersen  */
797784f10708SThomas Pedersen void cfg80211_cqm_txe_notify(struct net_device *dev, const u8 *peer,
797884f10708SThomas Pedersen 			     u32 num_packets, u32 rate, u32 intvl, gfp_t gfp);
797984f10708SThomas Pedersen 
798084f10708SThomas Pedersen /**
798198f03342SJohannes Berg  * cfg80211_cqm_beacon_loss_notify - beacon loss event
798298f03342SJohannes Berg  * @dev: network device
798398f03342SJohannes Berg  * @gfp: context flags
798498f03342SJohannes Berg  *
798598f03342SJohannes Berg  * Notify userspace about beacon loss from the connected AP.
798698f03342SJohannes Berg  */
798798f03342SJohannes Berg void cfg80211_cqm_beacon_loss_notify(struct net_device *dev, gfp_t gfp);
798898f03342SJohannes Berg 
798998f03342SJohannes Berg /**
7990c47240cbSLorenzo Bianconi  * __cfg80211_radar_event - radar detection event
79915b97f49dSJohannes Berg  * @wiphy: the wiphy
79925b97f49dSJohannes Berg  * @chandef: chandef for the current channel
7993c47240cbSLorenzo Bianconi  * @offchan: the radar has been detected on the offchannel chain
79945b97f49dSJohannes Berg  * @gfp: context flags
79955b97f49dSJohannes Berg  *
79965b97f49dSJohannes Berg  * This function is called when a radar is detected on the current chanenl.
79975b97f49dSJohannes Berg  */
7998c47240cbSLorenzo Bianconi void __cfg80211_radar_event(struct wiphy *wiphy,
7999c47240cbSLorenzo Bianconi 			    struct cfg80211_chan_def *chandef,
8000c47240cbSLorenzo Bianconi 			    bool offchan, gfp_t gfp);
8001c47240cbSLorenzo Bianconi 
8002c47240cbSLorenzo Bianconi static inline void
8003c47240cbSLorenzo Bianconi cfg80211_radar_event(struct wiphy *wiphy,
8004c47240cbSLorenzo Bianconi 		     struct cfg80211_chan_def *chandef,
8005c47240cbSLorenzo Bianconi 		     gfp_t gfp)
8006c47240cbSLorenzo Bianconi {
8007c47240cbSLorenzo Bianconi 	__cfg80211_radar_event(wiphy, chandef, false, gfp);
8008c47240cbSLorenzo Bianconi }
8009c47240cbSLorenzo Bianconi 
8010c47240cbSLorenzo Bianconi static inline void
8011a95bfb87SLorenzo Bianconi cfg80211_background_radar_event(struct wiphy *wiphy,
8012c47240cbSLorenzo Bianconi 				struct cfg80211_chan_def *chandef,
8013c47240cbSLorenzo Bianconi 				gfp_t gfp)
8014c47240cbSLorenzo Bianconi {
8015c47240cbSLorenzo Bianconi 	__cfg80211_radar_event(wiphy, chandef, true, gfp);
8016c47240cbSLorenzo Bianconi }
80175b97f49dSJohannes Berg 
80185b97f49dSJohannes Berg /**
8019466b9936Stamizhr@codeaurora.org  * cfg80211_sta_opmode_change_notify - STA's ht/vht operation mode change event
8020466b9936Stamizhr@codeaurora.org  * @dev: network device
8021466b9936Stamizhr@codeaurora.org  * @mac: MAC address of a station which opmode got modified
8022466b9936Stamizhr@codeaurora.org  * @sta_opmode: station's current opmode value
8023466b9936Stamizhr@codeaurora.org  * @gfp: context flags
8024466b9936Stamizhr@codeaurora.org  *
8025466b9936Stamizhr@codeaurora.org  * Driver should call this function when station's opmode modified via action
8026466b9936Stamizhr@codeaurora.org  * frame.
8027466b9936Stamizhr@codeaurora.org  */
8028466b9936Stamizhr@codeaurora.org void cfg80211_sta_opmode_change_notify(struct net_device *dev, const u8 *mac,
8029466b9936Stamizhr@codeaurora.org 				       struct sta_opmode_info *sta_opmode,
8030466b9936Stamizhr@codeaurora.org 				       gfp_t gfp);
8031466b9936Stamizhr@codeaurora.org 
8032466b9936Stamizhr@codeaurora.org /**
80335b97f49dSJohannes Berg  * cfg80211_cac_event - Channel availability check (CAC) event
80345b97f49dSJohannes Berg  * @netdev: network device
80355b97f49dSJohannes Berg  * @chandef: chandef for the current channel
80365b97f49dSJohannes Berg  * @event: type of event
80375b97f49dSJohannes Berg  * @gfp: context flags
80385b97f49dSJohannes Berg  *
80395b97f49dSJohannes Berg  * This function is called when a Channel availability check (CAC) is finished
80405b97f49dSJohannes Berg  * or aborted. This must be called to notify the completion of a CAC process,
80415b97f49dSJohannes Berg  * also by full-MAC drivers.
80425b97f49dSJohannes Berg  */
80435b97f49dSJohannes Berg void cfg80211_cac_event(struct net_device *netdev,
80445b97f49dSJohannes Berg 			const struct cfg80211_chan_def *chandef,
80455b97f49dSJohannes Berg 			enum nl80211_radar_event event, gfp_t gfp);
80465b97f49dSJohannes Berg 
8047bc2dfc02SLorenzo Bianconi /**
8048a95bfb87SLorenzo Bianconi  * cfg80211_background_cac_abort - Channel Availability Check offchan abort event
8049bc2dfc02SLorenzo Bianconi  * @wiphy: the wiphy
8050bc2dfc02SLorenzo Bianconi  *
80511507b153SLorenzo Bianconi  * This function is called by the driver when a Channel Availability Check
80521507b153SLorenzo Bianconi  * (CAC) is aborted by a offchannel dedicated chain.
8053bc2dfc02SLorenzo Bianconi  */
8054a95bfb87SLorenzo Bianconi void cfg80211_background_cac_abort(struct wiphy *wiphy);
80555b97f49dSJohannes Berg 
80565b97f49dSJohannes Berg /**
8057e5497d76SJohannes Berg  * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying
8058e5497d76SJohannes Berg  * @dev: network device
8059e5497d76SJohannes Berg  * @bssid: BSSID of AP (to avoid races)
8060e5497d76SJohannes Berg  * @replay_ctr: new replay counter
8061af71ff85SJohannes Berg  * @gfp: allocation flags
8062e5497d76SJohannes Berg  */
8063e5497d76SJohannes Berg void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid,
8064e5497d76SJohannes Berg 			       const u8 *replay_ctr, gfp_t gfp);
8065e5497d76SJohannes Berg 
8066c9df56b4SJouni Malinen /**
8067c9df56b4SJouni Malinen  * cfg80211_pmksa_candidate_notify - notify about PMKSA caching candidate
8068c9df56b4SJouni Malinen  * @dev: network device
8069c9df56b4SJouni Malinen  * @index: candidate index (the smaller the index, the higher the priority)
8070c9df56b4SJouni Malinen  * @bssid: BSSID of AP
8071c9df56b4SJouni Malinen  * @preauth: Whether AP advertises support for RSN pre-authentication
8072c9df56b4SJouni Malinen  * @gfp: allocation flags
8073c9df56b4SJouni Malinen  */
8074c9df56b4SJouni Malinen void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index,
8075c9df56b4SJouni Malinen 				     const u8 *bssid, bool preauth, gfp_t gfp);
8076c9df56b4SJouni Malinen 
807728946da7SJohannes Berg /**
807828946da7SJohannes Berg  * cfg80211_rx_spurious_frame - inform userspace about a spurious frame
807928946da7SJohannes Berg  * @dev: The device the frame matched to
808028946da7SJohannes Berg  * @addr: the transmitter address
808128946da7SJohannes Berg  * @gfp: context flags
808228946da7SJohannes Berg  *
808328946da7SJohannes Berg  * This function is used in AP mode (only!) to inform userspace that
808428946da7SJohannes Berg  * a spurious class 3 frame was received, to be able to deauth the
808528946da7SJohannes Berg  * sender.
80860ae997dcSYacine Belkadi  * Return: %true if the frame was passed to userspace (or this failed
808728946da7SJohannes Berg  * for a reason other than not having a subscription.)
808828946da7SJohannes Berg  */
808928946da7SJohannes Berg bool cfg80211_rx_spurious_frame(struct net_device *dev,
809028946da7SJohannes Berg 				const u8 *addr, gfp_t gfp);
809128946da7SJohannes Berg 
80927f6cf311SJohannes Berg /**
8093b92ab5d8SJohannes Berg  * cfg80211_rx_unexpected_4addr_frame - inform about unexpected WDS frame
8094b92ab5d8SJohannes Berg  * @dev: The device the frame matched to
8095b92ab5d8SJohannes Berg  * @addr: the transmitter address
8096b92ab5d8SJohannes Berg  * @gfp: context flags
8097b92ab5d8SJohannes Berg  *
8098b92ab5d8SJohannes Berg  * This function is used in AP mode (only!) to inform userspace that
8099b92ab5d8SJohannes Berg  * an associated station sent a 4addr frame but that wasn't expected.
8100b92ab5d8SJohannes Berg  * It is allowed and desirable to send this event only once for each
8101b92ab5d8SJohannes Berg  * station to avoid event flooding.
81020ae997dcSYacine Belkadi  * Return: %true if the frame was passed to userspace (or this failed
8103b92ab5d8SJohannes Berg  * for a reason other than not having a subscription.)
8104b92ab5d8SJohannes Berg  */
8105b92ab5d8SJohannes Berg bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev,
8106b92ab5d8SJohannes Berg 					const u8 *addr, gfp_t gfp);
8107b92ab5d8SJohannes Berg 
8108b92ab5d8SJohannes Berg /**
81097f6cf311SJohannes Berg  * cfg80211_probe_status - notify userspace about probe status
81107f6cf311SJohannes Berg  * @dev: the device the probe was sent on
81117f6cf311SJohannes Berg  * @addr: the address of the peer
81127f6cf311SJohannes Berg  * @cookie: the cookie filled in @probe_client previously
81137f6cf311SJohannes Berg  * @acked: indicates whether probe was acked or not
8114c4b50cd3SVenkateswara Naralasetty  * @ack_signal: signal strength (in dBm) of the ACK frame.
8115c4b50cd3SVenkateswara Naralasetty  * @is_valid_ack_signal: indicates the ack_signal is valid or not.
81167f6cf311SJohannes Berg  * @gfp: allocation flags
81177f6cf311SJohannes Berg  */
81187f6cf311SJohannes Berg void cfg80211_probe_status(struct net_device *dev, const u8 *addr,
8119c4b50cd3SVenkateswara Naralasetty 			   u64 cookie, bool acked, s32 ack_signal,
8120c4b50cd3SVenkateswara Naralasetty 			   bool is_valid_ack_signal, gfp_t gfp);
81217f6cf311SJohannes Berg 
81225e760230SJohannes Berg /**
8123e76fede8SThomas Pedersen  * cfg80211_report_obss_beacon_khz - report beacon from other APs
8124e76fede8SThomas Pedersen  * @wiphy: The wiphy that received the beacon
8125e76fede8SThomas Pedersen  * @frame: the frame
8126e76fede8SThomas Pedersen  * @len: length of the frame
8127e76fede8SThomas Pedersen  * @freq: frequency the frame was received on in KHz
8128e76fede8SThomas Pedersen  * @sig_dbm: signal strength in dBm, or 0 if unknown
8129e76fede8SThomas Pedersen  *
8130e76fede8SThomas Pedersen  * Use this function to report to userspace when a beacon was
8131e76fede8SThomas Pedersen  * received. It is not useful to call this when there is no
8132e76fede8SThomas Pedersen  * netdev that is in AP/GO mode.
8133e76fede8SThomas Pedersen  */
8134e76fede8SThomas Pedersen void cfg80211_report_obss_beacon_khz(struct wiphy *wiphy, const u8 *frame,
8135e76fede8SThomas Pedersen 				     size_t len, int freq, int sig_dbm);
8136e76fede8SThomas Pedersen 
8137e76fede8SThomas Pedersen /**
81385e760230SJohannes Berg  * cfg80211_report_obss_beacon - report beacon from other APs
81395e760230SJohannes Berg  * @wiphy: The wiphy that received the beacon
81405e760230SJohannes Berg  * @frame: the frame
81415e760230SJohannes Berg  * @len: length of the frame
81425e760230SJohannes Berg  * @freq: frequency the frame was received on
81436c2fb1e6SSergey Matyukevich  * @sig_dbm: signal strength in dBm, or 0 if unknown
81445e760230SJohannes Berg  *
81455e760230SJohannes Berg  * Use this function to report to userspace when a beacon was
81465e760230SJohannes Berg  * received. It is not useful to call this when there is no
81475e760230SJohannes Berg  * netdev that is in AP/GO mode.
81485e760230SJohannes Berg  */
8149e76fede8SThomas Pedersen static inline void cfg80211_report_obss_beacon(struct wiphy *wiphy,
81505e760230SJohannes Berg 					       const u8 *frame, size_t len,
8151e76fede8SThomas Pedersen 					       int freq, int sig_dbm)
8152e76fede8SThomas Pedersen {
8153e76fede8SThomas Pedersen 	cfg80211_report_obss_beacon_khz(wiphy, frame, len, MHZ_TO_KHZ(freq),
8154e76fede8SThomas Pedersen 					sig_dbm);
8155e76fede8SThomas Pedersen }
81565e760230SJohannes Berg 
8157d58e7e37SJohannes Berg /**
8158683b6d3bSJohannes Berg  * cfg80211_reg_can_beacon - check if beaconing is allowed
815954858ee5SAlexander Simon  * @wiphy: the wiphy
8160683b6d3bSJohannes Berg  * @chandef: the channel definition
8161174e0cd2SIlan Peer  * @iftype: interface type
8162d58e7e37SJohannes Berg  *
81630ae997dcSYacine Belkadi  * Return: %true if there is no secondary channel or the secondary channel(s)
81640ae997dcSYacine Belkadi  * can be used for beaconing (i.e. is not a radar channel etc.)
816554858ee5SAlexander Simon  */
8166683b6d3bSJohannes Berg bool cfg80211_reg_can_beacon(struct wiphy *wiphy,
8167174e0cd2SIlan Peer 			     struct cfg80211_chan_def *chandef,
8168174e0cd2SIlan Peer 			     enum nl80211_iftype iftype);
816954858ee5SAlexander Simon 
8170923b352fSArik Nemtsov /**
8171923b352fSArik Nemtsov  * cfg80211_reg_can_beacon_relax - check if beaconing is allowed with relaxation
8172923b352fSArik Nemtsov  * @wiphy: the wiphy
8173923b352fSArik Nemtsov  * @chandef: the channel definition
8174923b352fSArik Nemtsov  * @iftype: interface type
8175923b352fSArik Nemtsov  *
8176923b352fSArik Nemtsov  * Return: %true if there is no secondary channel or the secondary channel(s)
8177923b352fSArik Nemtsov  * can be used for beaconing (i.e. is not a radar channel etc.). This version
8178923b352fSArik Nemtsov  * also checks if IR-relaxation conditions apply, to allow beaconing under
8179923b352fSArik Nemtsov  * more permissive conditions.
8180923b352fSArik Nemtsov  *
8181a05829a7SJohannes Berg  * Requires the wiphy mutex to be held.
8182923b352fSArik Nemtsov  */
8183923b352fSArik Nemtsov bool cfg80211_reg_can_beacon_relax(struct wiphy *wiphy,
8184923b352fSArik Nemtsov 				   struct cfg80211_chan_def *chandef,
8185923b352fSArik Nemtsov 				   enum nl80211_iftype iftype);
8186923b352fSArik Nemtsov 
81878097e149SThomas Pedersen /*
81885314526bSThomas Pedersen  * cfg80211_ch_switch_notify - update wdev channel and notify userspace
81895314526bSThomas Pedersen  * @dev: the device which switched channels
8190683b6d3bSJohannes Berg  * @chandef: the new channel definition
81917b0a0e3cSJohannes Berg  * @link_id: the link ID for MLO, must be 0 for non-MLO
81925314526bSThomas Pedersen  *
8193e487eaebSSimon Wunderlich  * Caller must acquire wdev_lock, therefore must only be called from sleepable
8194e487eaebSSimon Wunderlich  * driver context!
81955314526bSThomas Pedersen  */
8196683b6d3bSJohannes Berg void cfg80211_ch_switch_notify(struct net_device *dev,
81977b0a0e3cSJohannes Berg 			       struct cfg80211_chan_def *chandef,
81987b0a0e3cSJohannes Berg 			       unsigned int link_id);
81995314526bSThomas Pedersen 
8200f8d7552eSLuciano Coelho /*
8201f8d7552eSLuciano Coelho  * cfg80211_ch_switch_started_notify - notify channel switch start
8202f8d7552eSLuciano Coelho  * @dev: the device on which the channel switch started
8203f8d7552eSLuciano Coelho  * @chandef: the future channel definition
8204f8d7552eSLuciano Coelho  * @count: the number of TBTTs until the channel switch happens
8205669b8413SJohannes Berg  * @quiet: whether or not immediate quiet was requested by the AP
8206f8d7552eSLuciano Coelho  *
8207f8d7552eSLuciano Coelho  * Inform the userspace about the channel switch that has just
8208f8d7552eSLuciano Coelho  * started, so that it can take appropriate actions (eg. starting
8209f8d7552eSLuciano Coelho  * channel switch on other vifs), if necessary.
8210f8d7552eSLuciano Coelho  */
8211f8d7552eSLuciano Coelho void cfg80211_ch_switch_started_notify(struct net_device *dev,
8212f8d7552eSLuciano Coelho 				       struct cfg80211_chan_def *chandef,
8213669b8413SJohannes Berg 				       u8 count, bool quiet);
8214f8d7552eSLuciano Coelho 
82151ce3e82bSJohannes Berg /**
82161ce3e82bSJohannes Berg  * ieee80211_operating_class_to_band - convert operating class to band
82171ce3e82bSJohannes Berg  *
82181ce3e82bSJohannes Berg  * @operating_class: the operating class to convert
82191ce3e82bSJohannes Berg  * @band: band pointer to fill
82201ce3e82bSJohannes Berg  *
82211ce3e82bSJohannes Berg  * Returns %true if the conversion was successful, %false otherwise.
82221ce3e82bSJohannes Berg  */
82231ce3e82bSJohannes Berg bool ieee80211_operating_class_to_band(u8 operating_class,
822457fbcce3SJohannes Berg 				       enum nl80211_band *band);
82251ce3e82bSJohannes Berg 
8226a38700ddSArik Nemtsov /**
8227a38700ddSArik Nemtsov  * ieee80211_chandef_to_operating_class - convert chandef to operation class
8228a38700ddSArik Nemtsov  *
8229a38700ddSArik Nemtsov  * @chandef: the chandef to convert
8230a38700ddSArik Nemtsov  * @op_class: a pointer to the resulting operating class
8231a38700ddSArik Nemtsov  *
8232a38700ddSArik Nemtsov  * Returns %true if the conversion was successful, %false otherwise.
8233a38700ddSArik Nemtsov  */
8234a38700ddSArik Nemtsov bool ieee80211_chandef_to_operating_class(struct cfg80211_chan_def *chandef,
8235a38700ddSArik Nemtsov 					  u8 *op_class);
8236a38700ddSArik Nemtsov 
8237934f4c7dSThomas Pedersen /**
8238934f4c7dSThomas Pedersen  * ieee80211_chandef_to_khz - convert chandef to frequency in KHz
8239934f4c7dSThomas Pedersen  *
8240934f4c7dSThomas Pedersen  * @chandef: the chandef to convert
8241934f4c7dSThomas Pedersen  *
8242934f4c7dSThomas Pedersen  * Returns the center frequency of chandef (1st segment) in KHz.
8243934f4c7dSThomas Pedersen  */
8244934f4c7dSThomas Pedersen static inline u32
8245934f4c7dSThomas Pedersen ieee80211_chandef_to_khz(const struct cfg80211_chan_def *chandef)
8246934f4c7dSThomas Pedersen {
8247934f4c7dSThomas Pedersen 	return MHZ_TO_KHZ(chandef->center_freq1) + chandef->freq1_offset;
8248934f4c7dSThomas Pedersen }
8249934f4c7dSThomas Pedersen 
82505314526bSThomas Pedersen /*
82513475b094SJouni Malinen  * cfg80211_tdls_oper_request - request userspace to perform TDLS operation
82523475b094SJouni Malinen  * @dev: the device on which the operation is requested
82533475b094SJouni Malinen  * @peer: the MAC address of the peer device
82543475b094SJouni Malinen  * @oper: the requested TDLS operation (NL80211_TDLS_SETUP or
82553475b094SJouni Malinen  *	NL80211_TDLS_TEARDOWN)
82563475b094SJouni Malinen  * @reason_code: the reason code for teardown request
82573475b094SJouni Malinen  * @gfp: allocation flags
82583475b094SJouni Malinen  *
82593475b094SJouni Malinen  * This function is used to request userspace to perform TDLS operation that
82603475b094SJouni Malinen  * requires knowledge of keys, i.e., link setup or teardown when the AP
82613475b094SJouni Malinen  * connection uses encryption. This is optional mechanism for the driver to use
82623475b094SJouni Malinen  * if it can automatically determine when a TDLS link could be useful (e.g.,
82633475b094SJouni Malinen  * based on traffic and signal strength for a peer).
82643475b094SJouni Malinen  */
82653475b094SJouni Malinen void cfg80211_tdls_oper_request(struct net_device *dev, const u8 *peer,
82663475b094SJouni Malinen 				enum nl80211_tdls_operation oper,
82673475b094SJouni Malinen 				u16 reason_code, gfp_t gfp);
82683475b094SJouni Malinen 
82693475b094SJouni Malinen /*
82708097e149SThomas Pedersen  * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units)
82718097e149SThomas Pedersen  * @rate: given rate_info to calculate bitrate from
82728097e149SThomas Pedersen  *
82738097e149SThomas Pedersen  * return 0 if MCS index >= 32
82748097e149SThomas Pedersen  */
82758eb41c8dSVladimir Kondratiev u32 cfg80211_calculate_bitrate(struct rate_info *rate);
82768097e149SThomas Pedersen 
827798104fdeSJohannes Berg /**
827898104fdeSJohannes Berg  * cfg80211_unregister_wdev - remove the given wdev
827998104fdeSJohannes Berg  * @wdev: struct wireless_dev to remove
828098104fdeSJohannes Berg  *
82812fe8ef10SJohannes Berg  * This function removes the device so it can no longer be used. It is necessary
82822fe8ef10SJohannes Berg  * to call this function even when cfg80211 requests the removal of the device
82832fe8ef10SJohannes Berg  * by calling the del_virtual_intf() callback. The function must also be called
82842fe8ef10SJohannes Berg  * when the driver wishes to unregister the wdev, e.g. when the hardware device
82852fe8ef10SJohannes Berg  * is unbound from the driver.
828698104fdeSJohannes Berg  *
8287a05829a7SJohannes Berg  * Requires the RTNL and wiphy mutex to be held.
828898104fdeSJohannes Berg  */
828998104fdeSJohannes Berg void cfg80211_unregister_wdev(struct wireless_dev *wdev);
829098104fdeSJohannes Berg 
82910ee45355SJohannes Berg /**
82922fe8ef10SJohannes Berg  * cfg80211_register_netdevice - register the given netdev
82932fe8ef10SJohannes Berg  * @dev: the netdev to register
82942fe8ef10SJohannes Berg  *
82952fe8ef10SJohannes Berg  * Note: In contexts coming from cfg80211 callbacks, you must call this rather
82962fe8ef10SJohannes Berg  * than register_netdevice(), unregister_netdev() is impossible as the RTNL is
82972fe8ef10SJohannes Berg  * held. Otherwise, both register_netdevice() and register_netdev() are usable
82982fe8ef10SJohannes Berg  * instead as well.
8299a05829a7SJohannes Berg  *
8300a05829a7SJohannes Berg  * Requires the RTNL and wiphy mutex to be held.
83012fe8ef10SJohannes Berg  */
83022fe8ef10SJohannes Berg int cfg80211_register_netdevice(struct net_device *dev);
83032fe8ef10SJohannes Berg 
83042fe8ef10SJohannes Berg /**
83052fe8ef10SJohannes Berg  * cfg80211_unregister_netdevice - unregister the given netdev
83062fe8ef10SJohannes Berg  * @dev: the netdev to register
83072fe8ef10SJohannes Berg  *
83082fe8ef10SJohannes Berg  * Note: In contexts coming from cfg80211 callbacks, you must call this rather
83092fe8ef10SJohannes Berg  * than unregister_netdevice(), unregister_netdev() is impossible as the RTNL
83102fe8ef10SJohannes Berg  * is held. Otherwise, both unregister_netdevice() and unregister_netdev() are
83112fe8ef10SJohannes Berg  * usable instead as well.
8312a05829a7SJohannes Berg  *
8313a05829a7SJohannes Berg  * Requires the RTNL and wiphy mutex to be held.
83142fe8ef10SJohannes Berg  */
83152fe8ef10SJohannes Berg static inline void cfg80211_unregister_netdevice(struct net_device *dev)
83162fe8ef10SJohannes Berg {
8317c304eddcSJakub Kicinski #if IS_ENABLED(CONFIG_CFG80211)
83182fe8ef10SJohannes Berg 	cfg80211_unregister_wdev(dev->ieee80211_ptr);
8319c304eddcSJakub Kicinski #endif
83202fe8ef10SJohannes Berg }
83212fe8ef10SJohannes Berg 
83222fe8ef10SJohannes Berg /**
8323b1e8eb11SMauro Carvalho Chehab  * struct cfg80211_ft_event_params - FT Information Elements
8324355199e0SJouni Malinen  * @ies: FT IEs
8325355199e0SJouni Malinen  * @ies_len: length of the FT IE in bytes
8326355199e0SJouni Malinen  * @target_ap: target AP's MAC address
8327355199e0SJouni Malinen  * @ric_ies: RIC IE
8328355199e0SJouni Malinen  * @ric_ies_len: length of the RIC IE in bytes
8329355199e0SJouni Malinen  */
8330355199e0SJouni Malinen struct cfg80211_ft_event_params {
8331355199e0SJouni Malinen 	const u8 *ies;
8332355199e0SJouni Malinen 	size_t ies_len;
8333355199e0SJouni Malinen 	const u8 *target_ap;
8334355199e0SJouni Malinen 	const u8 *ric_ies;
8335355199e0SJouni Malinen 	size_t ric_ies_len;
8336355199e0SJouni Malinen };
8337355199e0SJouni Malinen 
8338355199e0SJouni Malinen /**
8339355199e0SJouni Malinen  * cfg80211_ft_event - notify userspace about FT IE and RIC IE
8340355199e0SJouni Malinen  * @netdev: network device
8341355199e0SJouni Malinen  * @ft_event: IE information
8342355199e0SJouni Malinen  */
8343355199e0SJouni Malinen void cfg80211_ft_event(struct net_device *netdev,
8344355199e0SJouni Malinen 		       struct cfg80211_ft_event_params *ft_event);
8345355199e0SJouni Malinen 
8346355199e0SJouni Malinen /**
83470ee45355SJohannes Berg  * cfg80211_get_p2p_attr - find and copy a P2P attribute from IE buffer
83480ee45355SJohannes Berg  * @ies: the input IE buffer
83490ee45355SJohannes Berg  * @len: the input length
83500ee45355SJohannes Berg  * @attr: the attribute ID to find
83510ee45355SJohannes Berg  * @buf: output buffer, can be %NULL if the data isn't needed, e.g.
83520ee45355SJohannes Berg  *	if the function is only called to get the needed buffer size
83530ee45355SJohannes Berg  * @bufsize: size of the output buffer
83540ee45355SJohannes Berg  *
83550ee45355SJohannes Berg  * The function finds a given P2P attribute in the (vendor) IEs and
83560ee45355SJohannes Berg  * copies its contents to the given buffer.
83570ee45355SJohannes Berg  *
83580ae997dcSYacine Belkadi  * Return: A negative error code (-%EILSEQ or -%ENOENT) if the data is
83590ae997dcSYacine Belkadi  * malformed or the attribute can't be found (respectively), or the
83600ae997dcSYacine Belkadi  * length of the found attribute (which can be zero).
83610ee45355SJohannes Berg  */
8362c216e641SArend van Spriel int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len,
8363c216e641SArend van Spriel 			  enum ieee80211_p2p_attr_id attr,
8364c216e641SArend van Spriel 			  u8 *buf, unsigned int bufsize);
83650ee45355SJohannes Berg 
8366cd8f7cb4SJohannes Berg /**
836729464cccSJohannes Berg  * ieee80211_ie_split_ric - split an IE buffer according to ordering (with RIC)
836829464cccSJohannes Berg  * @ies: the IE buffer
836929464cccSJohannes Berg  * @ielen: the length of the IE buffer
837029464cccSJohannes Berg  * @ids: an array with element IDs that are allowed before
83712512b1b1SLiad Kaufman  *	the split. A WLAN_EID_EXTENSION value means that the next
83722512b1b1SLiad Kaufman  *	EID in the list is a sub-element of the EXTENSION IE.
837329464cccSJohannes Berg  * @n_ids: the size of the element ID array
837429464cccSJohannes Berg  * @after_ric: array IE types that come after the RIC element
837529464cccSJohannes Berg  * @n_after_ric: size of the @after_ric array
837629464cccSJohannes Berg  * @offset: offset where to start splitting in the buffer
837729464cccSJohannes Berg  *
837829464cccSJohannes Berg  * This function splits an IE buffer by updating the @offset
837929464cccSJohannes Berg  * variable to point to the location where the buffer should be
838029464cccSJohannes Berg  * split.
838129464cccSJohannes Berg  *
838229464cccSJohannes Berg  * It assumes that the given IE buffer is well-formed, this
838329464cccSJohannes Berg  * has to be guaranteed by the caller!
838429464cccSJohannes Berg  *
838529464cccSJohannes Berg  * It also assumes that the IEs in the buffer are ordered
838629464cccSJohannes Berg  * correctly, if not the result of using this function will not
838729464cccSJohannes Berg  * be ordered correctly either, i.e. it does no reordering.
838829464cccSJohannes Berg  *
838929464cccSJohannes Berg  * The function returns the offset where the next part of the
839029464cccSJohannes Berg  * buffer starts, which may be @ielen if the entire (remainder)
839129464cccSJohannes Berg  * of the buffer should be used.
839229464cccSJohannes Berg  */
839329464cccSJohannes Berg size_t ieee80211_ie_split_ric(const u8 *ies, size_t ielen,
839429464cccSJohannes Berg 			      const u8 *ids, int n_ids,
839529464cccSJohannes Berg 			      const u8 *after_ric, int n_after_ric,
839629464cccSJohannes Berg 			      size_t offset);
839729464cccSJohannes Berg 
839829464cccSJohannes Berg /**
839929464cccSJohannes Berg  * ieee80211_ie_split - split an IE buffer according to ordering
840029464cccSJohannes Berg  * @ies: the IE buffer
840129464cccSJohannes Berg  * @ielen: the length of the IE buffer
840229464cccSJohannes Berg  * @ids: an array with element IDs that are allowed before
84032512b1b1SLiad Kaufman  *	the split. A WLAN_EID_EXTENSION value means that the next
84042512b1b1SLiad Kaufman  *	EID in the list is a sub-element of the EXTENSION IE.
840529464cccSJohannes Berg  * @n_ids: the size of the element ID array
840629464cccSJohannes Berg  * @offset: offset where to start splitting in the buffer
840729464cccSJohannes Berg  *
840829464cccSJohannes Berg  * This function splits an IE buffer by updating the @offset
840929464cccSJohannes Berg  * variable to point to the location where the buffer should be
841029464cccSJohannes Berg  * split.
841129464cccSJohannes Berg  *
841229464cccSJohannes Berg  * It assumes that the given IE buffer is well-formed, this
841329464cccSJohannes Berg  * has to be guaranteed by the caller!
841429464cccSJohannes Berg  *
841529464cccSJohannes Berg  * It also assumes that the IEs in the buffer are ordered
841629464cccSJohannes Berg  * correctly, if not the result of using this function will not
841729464cccSJohannes Berg  * be ordered correctly either, i.e. it does no reordering.
841829464cccSJohannes Berg  *
841929464cccSJohannes Berg  * The function returns the offset where the next part of the
842029464cccSJohannes Berg  * buffer starts, which may be @ielen if the entire (remainder)
842129464cccSJohannes Berg  * of the buffer should be used.
842229464cccSJohannes Berg  */
84230483eeacSJohannes Berg static inline size_t ieee80211_ie_split(const u8 *ies, size_t ielen,
84240483eeacSJohannes Berg 					const u8 *ids, int n_ids, size_t offset)
84250483eeacSJohannes Berg {
84260483eeacSJohannes Berg 	return ieee80211_ie_split_ric(ies, ielen, ids, n_ids, NULL, 0, offset);
84270483eeacSJohannes Berg }
842829464cccSJohannes Berg 
842929464cccSJohannes Berg /**
8430cd8f7cb4SJohannes Berg  * cfg80211_report_wowlan_wakeup - report wakeup from WoWLAN
8431cd8f7cb4SJohannes Berg  * @wdev: the wireless device reporting the wakeup
8432cd8f7cb4SJohannes Berg  * @wakeup: the wakeup report
8433cd8f7cb4SJohannes Berg  * @gfp: allocation flags
8434cd8f7cb4SJohannes Berg  *
8435cd8f7cb4SJohannes Berg  * This function reports that the given device woke up. If it
8436cd8f7cb4SJohannes Berg  * caused the wakeup, report the reason(s), otherwise you may
8437cd8f7cb4SJohannes Berg  * pass %NULL as the @wakeup parameter to advertise that something
8438cd8f7cb4SJohannes Berg  * else caused the wakeup.
8439cd8f7cb4SJohannes Berg  */
8440cd8f7cb4SJohannes Berg void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev,
8441cd8f7cb4SJohannes Berg 				   struct cfg80211_wowlan_wakeup *wakeup,
8442cd8f7cb4SJohannes Berg 				   gfp_t gfp);
8443cd8f7cb4SJohannes Berg 
84445de17984SArend van Spriel /**
84455de17984SArend van Spriel  * cfg80211_crit_proto_stopped() - indicate critical protocol stopped by driver.
84465de17984SArend van Spriel  *
84475de17984SArend van Spriel  * @wdev: the wireless device for which critical protocol is stopped.
844803f831a6SRobert P. J. Day  * @gfp: allocation flags
84495de17984SArend van Spriel  *
84505de17984SArend van Spriel  * This function can be called by the driver to indicate it has reverted
84515de17984SArend van Spriel  * operation back to normal. One reason could be that the duration given
84525de17984SArend van Spriel  * by .crit_proto_start() has expired.
84535de17984SArend van Spriel  */
84545de17984SArend van Spriel void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp);
84555de17984SArend van Spriel 
8456bdfbec2dSIlan Peer /**
8457bdfbec2dSIlan Peer  * ieee80211_get_num_supported_channels - get number of channels device has
8458bdfbec2dSIlan Peer  * @wiphy: the wiphy
8459bdfbec2dSIlan Peer  *
8460bdfbec2dSIlan Peer  * Return: the number of channels supported by the device.
8461bdfbec2dSIlan Peer  */
8462bdfbec2dSIlan Peer unsigned int ieee80211_get_num_supported_channels(struct wiphy *wiphy);
8463bdfbec2dSIlan Peer 
8464cb2d956dSLuciano Coelho /**
8465cb2d956dSLuciano Coelho  * cfg80211_check_combinations - check interface combinations
8466cb2d956dSLuciano Coelho  *
8467cb2d956dSLuciano Coelho  * @wiphy: the wiphy
8468e227300cSPurushottam Kushwaha  * @params: the interface combinations parameter
8469cb2d956dSLuciano Coelho  *
8470cb2d956dSLuciano Coelho  * This function can be called by the driver to check whether a
8471cb2d956dSLuciano Coelho  * combination of interfaces and their types are allowed according to
8472cb2d956dSLuciano Coelho  * the interface combinations.
8473cb2d956dSLuciano Coelho  */
8474cb2d956dSLuciano Coelho int cfg80211_check_combinations(struct wiphy *wiphy,
8475e227300cSPurushottam Kushwaha 				struct iface_combination_params *params);
8476cb2d956dSLuciano Coelho 
847765a124ddSMichal Kazior /**
847865a124ddSMichal Kazior  * cfg80211_iter_combinations - iterate over matching combinations
847965a124ddSMichal Kazior  *
848065a124ddSMichal Kazior  * @wiphy: the wiphy
8481e227300cSPurushottam Kushwaha  * @params: the interface combinations parameter
848265a124ddSMichal Kazior  * @iter: function to call for each matching combination
848365a124ddSMichal Kazior  * @data: pointer to pass to iter function
848465a124ddSMichal Kazior  *
848565a124ddSMichal Kazior  * This function can be called by the driver to check what possible
848665a124ddSMichal Kazior  * combinations it fits in at a given moment, e.g. for channel switching
848765a124ddSMichal Kazior  * purposes.
848865a124ddSMichal Kazior  */
848965a124ddSMichal Kazior int cfg80211_iter_combinations(struct wiphy *wiphy,
8490e227300cSPurushottam Kushwaha 			       struct iface_combination_params *params,
849165a124ddSMichal Kazior 			       void (*iter)(const struct ieee80211_iface_combination *c,
849265a124ddSMichal Kazior 					    void *data),
849365a124ddSMichal Kazior 			       void *data);
849465a124ddSMichal Kazior 
8495f04c2203SMichal Kazior /*
8496f04c2203SMichal Kazior  * cfg80211_stop_iface - trigger interface disconnection
8497f04c2203SMichal Kazior  *
8498f04c2203SMichal Kazior  * @wiphy: the wiphy
8499f04c2203SMichal Kazior  * @wdev: wireless device
8500f04c2203SMichal Kazior  * @gfp: context flags
8501f04c2203SMichal Kazior  *
8502f04c2203SMichal Kazior  * Trigger interface to be stopped as if AP was stopped, IBSS/mesh left, STA
8503f04c2203SMichal Kazior  * disconnected.
8504f04c2203SMichal Kazior  *
8505f04c2203SMichal Kazior  * Note: This doesn't need any locks and is asynchronous.
8506f04c2203SMichal Kazior  */
8507f04c2203SMichal Kazior void cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev,
8508f04c2203SMichal Kazior 			 gfp_t gfp);
8509f04c2203SMichal Kazior 
8510f6837ba8SJohannes Berg /**
8511f6837ba8SJohannes Berg  * cfg80211_shutdown_all_interfaces - shut down all interfaces for a wiphy
8512f6837ba8SJohannes Berg  * @wiphy: the wiphy to shut down
8513f6837ba8SJohannes Berg  *
8514f6837ba8SJohannes Berg  * This function shuts down all interfaces belonging to this wiphy by
8515f6837ba8SJohannes Berg  * calling dev_close() (and treating non-netdev interfaces as needed).
8516f6837ba8SJohannes Berg  * It shouldn't really be used unless there are some fatal device errors
8517f6837ba8SJohannes Berg  * that really can't be recovered in any other way.
8518f6837ba8SJohannes Berg  *
8519f6837ba8SJohannes Berg  * Callers must hold the RTNL and be able to deal with callbacks into
8520f6837ba8SJohannes Berg  * the driver while the function is running.
8521f6837ba8SJohannes Berg  */
8522f6837ba8SJohannes Berg void cfg80211_shutdown_all_interfaces(struct wiphy *wiphy);
8523f6837ba8SJohannes Berg 
8524d75bb06bSGautam Kumar Shukla /**
8525d75bb06bSGautam Kumar Shukla  * wiphy_ext_feature_set - set the extended feature flag
8526d75bb06bSGautam Kumar Shukla  *
8527d75bb06bSGautam Kumar Shukla  * @wiphy: the wiphy to modify.
8528d75bb06bSGautam Kumar Shukla  * @ftidx: extended feature bit index.
8529d75bb06bSGautam Kumar Shukla  *
8530d75bb06bSGautam Kumar Shukla  * The extended features are flagged in multiple bytes (see
8531d75bb06bSGautam Kumar Shukla  * &struct wiphy.@ext_features)
8532d75bb06bSGautam Kumar Shukla  */
8533d75bb06bSGautam Kumar Shukla static inline void wiphy_ext_feature_set(struct wiphy *wiphy,
8534d75bb06bSGautam Kumar Shukla 					 enum nl80211_ext_feature_index ftidx)
8535d75bb06bSGautam Kumar Shukla {
8536d75bb06bSGautam Kumar Shukla 	u8 *ft_byte;
8537d75bb06bSGautam Kumar Shukla 
8538d75bb06bSGautam Kumar Shukla 	ft_byte = &wiphy->ext_features[ftidx / 8];
8539d75bb06bSGautam Kumar Shukla 	*ft_byte |= BIT(ftidx % 8);
8540d75bb06bSGautam Kumar Shukla }
8541d75bb06bSGautam Kumar Shukla 
8542d75bb06bSGautam Kumar Shukla /**
8543d75bb06bSGautam Kumar Shukla  * wiphy_ext_feature_isset - check the extended feature flag
8544d75bb06bSGautam Kumar Shukla  *
8545d75bb06bSGautam Kumar Shukla  * @wiphy: the wiphy to modify.
8546d75bb06bSGautam Kumar Shukla  * @ftidx: extended feature bit index.
8547d75bb06bSGautam Kumar Shukla  *
8548d75bb06bSGautam Kumar Shukla  * The extended features are flagged in multiple bytes (see
8549d75bb06bSGautam Kumar Shukla  * &struct wiphy.@ext_features)
8550d75bb06bSGautam Kumar Shukla  */
8551d75bb06bSGautam Kumar Shukla static inline bool
8552d75bb06bSGautam Kumar Shukla wiphy_ext_feature_isset(struct wiphy *wiphy,
8553d75bb06bSGautam Kumar Shukla 			enum nl80211_ext_feature_index ftidx)
8554d75bb06bSGautam Kumar Shukla {
8555d75bb06bSGautam Kumar Shukla 	u8 ft_byte;
8556d75bb06bSGautam Kumar Shukla 
8557d75bb06bSGautam Kumar Shukla 	ft_byte = wiphy->ext_features[ftidx / 8];
8558d75bb06bSGautam Kumar Shukla 	return (ft_byte & BIT(ftidx % 8)) != 0;
8559d75bb06bSGautam Kumar Shukla }
8560b7ffbd7eSJohannes Berg 
8561a442b761SAyala Beker /**
8562a442b761SAyala Beker  * cfg80211_free_nan_func - free NAN function
8563a442b761SAyala Beker  * @f: NAN function that should be freed
8564a442b761SAyala Beker  *
8565a442b761SAyala Beker  * Frees all the NAN function and all it's allocated members.
8566a442b761SAyala Beker  */
8567a442b761SAyala Beker void cfg80211_free_nan_func(struct cfg80211_nan_func *f);
8568a442b761SAyala Beker 
856950bcd31dSAyala Beker /**
857050bcd31dSAyala Beker  * struct cfg80211_nan_match_params - NAN match parameters
857150bcd31dSAyala Beker  * @type: the type of the function that triggered a match. If it is
857250bcd31dSAyala Beker  *	 %NL80211_NAN_FUNC_SUBSCRIBE it means that we replied to a subscriber.
857350bcd31dSAyala Beker  *	 If it is %NL80211_NAN_FUNC_PUBLISH, it means that we got a discovery
857450bcd31dSAyala Beker  *	 result.
857550bcd31dSAyala Beker  *	 If it is %NL80211_NAN_FUNC_FOLLOW_UP, we received a follow up.
857650bcd31dSAyala Beker  * @inst_id: the local instance id
857750bcd31dSAyala Beker  * @peer_inst_id: the instance id of the peer's function
857850bcd31dSAyala Beker  * @addr: the MAC address of the peer
857950bcd31dSAyala Beker  * @info_len: the length of the &info
858050bcd31dSAyala Beker  * @info: the Service Specific Info from the peer (if any)
858150bcd31dSAyala Beker  * @cookie: unique identifier of the corresponding function
858250bcd31dSAyala Beker  */
858350bcd31dSAyala Beker struct cfg80211_nan_match_params {
858450bcd31dSAyala Beker 	enum nl80211_nan_function_type type;
858550bcd31dSAyala Beker 	u8 inst_id;
858650bcd31dSAyala Beker 	u8 peer_inst_id;
858750bcd31dSAyala Beker 	const u8 *addr;
858850bcd31dSAyala Beker 	u8 info_len;
858950bcd31dSAyala Beker 	const u8 *info;
859050bcd31dSAyala Beker 	u64 cookie;
859150bcd31dSAyala Beker };
859250bcd31dSAyala Beker 
859350bcd31dSAyala Beker /**
859450bcd31dSAyala Beker  * cfg80211_nan_match - report a match for a NAN function.
859550bcd31dSAyala Beker  * @wdev: the wireless device reporting the match
859650bcd31dSAyala Beker  * @match: match notification parameters
859750bcd31dSAyala Beker  * @gfp: allocation flags
859850bcd31dSAyala Beker  *
859950bcd31dSAyala Beker  * This function reports that the a NAN function had a match. This
860050bcd31dSAyala Beker  * can be a subscribe that had a match or a solicited publish that
860150bcd31dSAyala Beker  * was sent. It can also be a follow up that was received.
860250bcd31dSAyala Beker  */
860350bcd31dSAyala Beker void cfg80211_nan_match(struct wireless_dev *wdev,
860450bcd31dSAyala Beker 			struct cfg80211_nan_match_params *match, gfp_t gfp);
860550bcd31dSAyala Beker 
8606368e5a7bSAyala Beker /**
8607368e5a7bSAyala Beker  * cfg80211_nan_func_terminated - notify about NAN function termination.
8608368e5a7bSAyala Beker  *
8609368e5a7bSAyala Beker  * @wdev: the wireless device reporting the match
8610368e5a7bSAyala Beker  * @inst_id: the local instance id
8611368e5a7bSAyala Beker  * @reason: termination reason (one of the NL80211_NAN_FUNC_TERM_REASON_*)
8612368e5a7bSAyala Beker  * @cookie: unique NAN function identifier
8613368e5a7bSAyala Beker  * @gfp: allocation flags
8614368e5a7bSAyala Beker  *
8615368e5a7bSAyala Beker  * This function reports that the a NAN function is terminated.
8616368e5a7bSAyala Beker  */
8617368e5a7bSAyala Beker void cfg80211_nan_func_terminated(struct wireless_dev *wdev,
8618368e5a7bSAyala Beker 				  u8 inst_id,
8619368e5a7bSAyala Beker 				  enum nl80211_nan_func_term_reason reason,
8620368e5a7bSAyala Beker 				  u64 cookie, gfp_t gfp);
8621368e5a7bSAyala Beker 
8622b7ffbd7eSJohannes Berg /* ethtool helper */
8623b7ffbd7eSJohannes Berg void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info);
8624b7ffbd7eSJohannes Berg 
862540cbfa90SSrinivas Dasari /**
862640cbfa90SSrinivas Dasari  * cfg80211_external_auth_request - userspace request for authentication
862740cbfa90SSrinivas Dasari  * @netdev: network device
862840cbfa90SSrinivas Dasari  * @params: External authentication parameters
862940cbfa90SSrinivas Dasari  * @gfp: allocation flags
863040cbfa90SSrinivas Dasari  * Returns: 0 on success, < 0 on error
863140cbfa90SSrinivas Dasari  */
863240cbfa90SSrinivas Dasari int cfg80211_external_auth_request(struct net_device *netdev,
863340cbfa90SSrinivas Dasari 				   struct cfg80211_external_auth_params *params,
863440cbfa90SSrinivas Dasari 				   gfp_t gfp);
863540cbfa90SSrinivas Dasari 
86369bb7e0f2SJohannes Berg /**
86379bb7e0f2SJohannes Berg  * cfg80211_pmsr_report - report peer measurement result data
86389bb7e0f2SJohannes Berg  * @wdev: the wireless device reporting the measurement
86399bb7e0f2SJohannes Berg  * @req: the original measurement request
86409bb7e0f2SJohannes Berg  * @result: the result data
86419bb7e0f2SJohannes Berg  * @gfp: allocation flags
86429bb7e0f2SJohannes Berg  */
86439bb7e0f2SJohannes Berg void cfg80211_pmsr_report(struct wireless_dev *wdev,
86449bb7e0f2SJohannes Berg 			  struct cfg80211_pmsr_request *req,
86459bb7e0f2SJohannes Berg 			  struct cfg80211_pmsr_result *result,
86469bb7e0f2SJohannes Berg 			  gfp_t gfp);
86479bb7e0f2SJohannes Berg 
86489bb7e0f2SJohannes Berg /**
86499bb7e0f2SJohannes Berg  * cfg80211_pmsr_complete - report peer measurement completed
86509bb7e0f2SJohannes Berg  * @wdev: the wireless device reporting the measurement
86519bb7e0f2SJohannes Berg  * @req: the original measurement request
86529bb7e0f2SJohannes Berg  * @gfp: allocation flags
86539bb7e0f2SJohannes Berg  *
86549bb7e0f2SJohannes Berg  * Report that the entire measurement completed, after this
86559bb7e0f2SJohannes Berg  * the request pointer will no longer be valid.
86569bb7e0f2SJohannes Berg  */
86579bb7e0f2SJohannes Berg void cfg80211_pmsr_complete(struct wireless_dev *wdev,
86589bb7e0f2SJohannes Berg 			    struct cfg80211_pmsr_request *req,
86599bb7e0f2SJohannes Berg 			    gfp_t gfp);
86609bb7e0f2SJohannes Berg 
8661e6f40511SManikanta Pubbisetty /**
8662e6f40511SManikanta Pubbisetty  * cfg80211_iftype_allowed - check whether the interface can be allowed
8663e6f40511SManikanta Pubbisetty  * @wiphy: the wiphy
8664e6f40511SManikanta Pubbisetty  * @iftype: interface type
8665e6f40511SManikanta Pubbisetty  * @is_4addr: use_4addr flag, must be '0' when check_swif is '1'
8666e6f40511SManikanta Pubbisetty  * @check_swif: check iftype against software interfaces
8667e6f40511SManikanta Pubbisetty  *
8668e6f40511SManikanta Pubbisetty  * Check whether the interface is allowed to operate; additionally, this API
8669e6f40511SManikanta Pubbisetty  * can be used to check iftype against the software interfaces when
8670e6f40511SManikanta Pubbisetty  * check_swif is '1'.
8671e6f40511SManikanta Pubbisetty  */
8672e6f40511SManikanta Pubbisetty bool cfg80211_iftype_allowed(struct wiphy *wiphy, enum nl80211_iftype iftype,
8673e6f40511SManikanta Pubbisetty 			     bool is_4addr, u8 check_swif);
8674e6f40511SManikanta Pubbisetty 
8675e6f40511SManikanta Pubbisetty 
8676a083ee8aSIlan Peer /**
8677a083ee8aSIlan Peer  * cfg80211_assoc_comeback - notification of association that was
8678a083ee8aSIlan Peer  * temporarly rejected with a comeback
8679a083ee8aSIlan Peer  * @netdev: network device
8680e69dac88SJohannes Berg  * @ap_addr: AP (MLD) address that rejected the assocation
8681a083ee8aSIlan Peer  * @timeout: timeout interval value TUs.
8682a083ee8aSIlan Peer  *
8683a083ee8aSIlan Peer  * this function may sleep. the caller must hold the corresponding wdev's mutex.
8684a083ee8aSIlan Peer  */
8685a083ee8aSIlan Peer void cfg80211_assoc_comeback(struct net_device *netdev,
8686e69dac88SJohannes Berg 			     const u8 *ap_addr, u32 timeout);
8687a083ee8aSIlan Peer 
8688e1db74fcSJoe Perches /* Logging, debugging and troubleshooting/diagnostic helpers. */
8689e1db74fcSJoe Perches 
8690e1db74fcSJoe Perches /* wiphy_printk helpers, similar to dev_printk */
8691e1db74fcSJoe Perches 
8692e1db74fcSJoe Perches #define wiphy_printk(level, wiphy, format, args...)		\
86939c376639SJoe Perches 	dev_printk(level, &(wiphy)->dev, format, ##args)
8694e1db74fcSJoe Perches #define wiphy_emerg(wiphy, format, args...)			\
86959c376639SJoe Perches 	dev_emerg(&(wiphy)->dev, format, ##args)
8696e1db74fcSJoe Perches #define wiphy_alert(wiphy, format, args...)			\
86979c376639SJoe Perches 	dev_alert(&(wiphy)->dev, format, ##args)
8698e1db74fcSJoe Perches #define wiphy_crit(wiphy, format, args...)			\
86999c376639SJoe Perches 	dev_crit(&(wiphy)->dev, format, ##args)
8700e1db74fcSJoe Perches #define wiphy_err(wiphy, format, args...)			\
87019c376639SJoe Perches 	dev_err(&(wiphy)->dev, format, ##args)
8702e1db74fcSJoe Perches #define wiphy_warn(wiphy, format, args...)			\
87039c376639SJoe Perches 	dev_warn(&(wiphy)->dev, format, ##args)
8704e1db74fcSJoe Perches #define wiphy_notice(wiphy, format, args...)			\
87059c376639SJoe Perches 	dev_notice(&(wiphy)->dev, format, ##args)
8706e1db74fcSJoe Perches #define wiphy_info(wiphy, format, args...)			\
87079c376639SJoe Perches 	dev_info(&(wiphy)->dev, format, ##args)
8708761025b5SDmitry Osipenko #define wiphy_info_once(wiphy, format, args...)			\
8709761025b5SDmitry Osipenko 	dev_info_once(&(wiphy)->dev, format, ##args)
8710073730d7SJoe Perches 
8711a58d7525SStanislaw Gruszka #define wiphy_err_ratelimited(wiphy, format, args...)		\
8712a58d7525SStanislaw Gruszka 	dev_err_ratelimited(&(wiphy)->dev, format, ##args)
8713a58d7525SStanislaw Gruszka #define wiphy_warn_ratelimited(wiphy, format, args...)		\
8714a58d7525SStanislaw Gruszka 	dev_warn_ratelimited(&(wiphy)->dev, format, ##args)
8715a58d7525SStanislaw Gruszka 
87169c376639SJoe Perches #define wiphy_debug(wiphy, format, args...)			\
8717e1db74fcSJoe Perches 	wiphy_printk(KERN_DEBUG, wiphy, format, ##args)
87189c376639SJoe Perches 
8719e1db74fcSJoe Perches #define wiphy_dbg(wiphy, format, args...)			\
87209c376639SJoe Perches 	dev_dbg(&(wiphy)->dev, format, ##args)
8721e1db74fcSJoe Perches 
8722e1db74fcSJoe Perches #if defined(VERBOSE_DEBUG)
8723e1db74fcSJoe Perches #define wiphy_vdbg	wiphy_dbg
8724e1db74fcSJoe Perches #else
8725e1db74fcSJoe Perches #define wiphy_vdbg(wiphy, format, args...)				\
8726e1db74fcSJoe Perches ({									\
8727e1db74fcSJoe Perches 	if (0)								\
8728e1db74fcSJoe Perches 		wiphy_printk(KERN_DEBUG, wiphy, format, ##args);	\
8729e1db74fcSJoe Perches 	0;								\
8730e1db74fcSJoe Perches })
8731e1db74fcSJoe Perches #endif
8732e1db74fcSJoe Perches 
8733e1db74fcSJoe Perches /*
8734e1db74fcSJoe Perches  * wiphy_WARN() acts like wiphy_printk(), but with the key difference
8735e1db74fcSJoe Perches  * of using a WARN/WARN_ON to get the message out, including the
8736e1db74fcSJoe Perches  * file/line information and a backtrace.
8737e1db74fcSJoe Perches  */
8738e1db74fcSJoe Perches #define wiphy_WARN(wiphy, format, args...)			\
8739e1db74fcSJoe Perches 	WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args);
8740e1db74fcSJoe Perches 
8741cb74e977SSunil Dutt /**
8742cb74e977SSunil Dutt  * cfg80211_update_owe_info_event - Notify the peer's OWE info to user space
8743cb74e977SSunil Dutt  * @netdev: network device
8744cb74e977SSunil Dutt  * @owe_info: peer's owe info
8745cb74e977SSunil Dutt  * @gfp: allocation flags
8746cb74e977SSunil Dutt  */
8747cb74e977SSunil Dutt void cfg80211_update_owe_info_event(struct net_device *netdev,
8748cb74e977SSunil Dutt 				    struct cfg80211_update_owe_info *owe_info,
8749cb74e977SSunil Dutt 				    gfp_t gfp);
8750cb74e977SSunil Dutt 
87512f1805eaSEmmanuel Grumbach /**
87522f1805eaSEmmanuel Grumbach  * cfg80211_bss_flush - resets all the scan entries
87532f1805eaSEmmanuel Grumbach  * @wiphy: the wiphy
87542f1805eaSEmmanuel Grumbach  */
87552f1805eaSEmmanuel Grumbach void cfg80211_bss_flush(struct wiphy *wiphy);
87562f1805eaSEmmanuel Grumbach 
87570d2ab3aeSJohn Crispin /**
87580d2ab3aeSJohn Crispin  * cfg80211_bss_color_notify - notify about bss color event
87590d2ab3aeSJohn Crispin  * @dev: network device
87600d2ab3aeSJohn Crispin  * @gfp: allocation flags
87610d2ab3aeSJohn Crispin  * @cmd: the actual event we want to notify
87620d2ab3aeSJohn Crispin  * @count: the number of TBTTs until the color change happens
87630d2ab3aeSJohn Crispin  * @color_bitmap: representations of the colors that the local BSS is aware of
87640d2ab3aeSJohn Crispin  */
87650d2ab3aeSJohn Crispin int cfg80211_bss_color_notify(struct net_device *dev, gfp_t gfp,
87660d2ab3aeSJohn Crispin 			      enum nl80211_commands cmd, u8 count,
87670d2ab3aeSJohn Crispin 			      u64 color_bitmap);
87680d2ab3aeSJohn Crispin 
87690d2ab3aeSJohn Crispin /**
87700d2ab3aeSJohn Crispin  * cfg80211_obss_color_collision_notify - notify about bss color collision
87710d2ab3aeSJohn Crispin  * @dev: network device
87720d2ab3aeSJohn Crispin  * @color_bitmap: representations of the colors that the local BSS is aware of
877303895c84SLorenzo Bianconi  * @gfp: allocation flags
87740d2ab3aeSJohn Crispin  */
87750d2ab3aeSJohn Crispin static inline int cfg80211_obss_color_collision_notify(struct net_device *dev,
877603895c84SLorenzo Bianconi 						       u64 color_bitmap, gfp_t gfp)
87770d2ab3aeSJohn Crispin {
877803895c84SLorenzo Bianconi 	return cfg80211_bss_color_notify(dev, gfp,
87790d2ab3aeSJohn Crispin 					 NL80211_CMD_OBSS_COLOR_COLLISION,
87800d2ab3aeSJohn Crispin 					 0, color_bitmap);
87810d2ab3aeSJohn Crispin }
87820d2ab3aeSJohn Crispin 
87830d2ab3aeSJohn Crispin /**
87840d2ab3aeSJohn Crispin  * cfg80211_color_change_started_notify - notify color change start
87850d2ab3aeSJohn Crispin  * @dev: the device on which the color is switched
87860d2ab3aeSJohn Crispin  * @count: the number of TBTTs until the color change happens
87870d2ab3aeSJohn Crispin  *
87880d2ab3aeSJohn Crispin  * Inform the userspace about the color change that has started.
87890d2ab3aeSJohn Crispin  */
87900d2ab3aeSJohn Crispin static inline int cfg80211_color_change_started_notify(struct net_device *dev,
87910d2ab3aeSJohn Crispin 						       u8 count)
87920d2ab3aeSJohn Crispin {
87930d2ab3aeSJohn Crispin 	return cfg80211_bss_color_notify(dev, GFP_KERNEL,
87940d2ab3aeSJohn Crispin 					 NL80211_CMD_COLOR_CHANGE_STARTED,
87950d2ab3aeSJohn Crispin 					 count, 0);
87960d2ab3aeSJohn Crispin }
87970d2ab3aeSJohn Crispin 
87980d2ab3aeSJohn Crispin /**
87990d2ab3aeSJohn Crispin  * cfg80211_color_change_aborted_notify - notify color change abort
88000d2ab3aeSJohn Crispin  * @dev: the device on which the color is switched
88010d2ab3aeSJohn Crispin  *
88020d2ab3aeSJohn Crispin  * Inform the userspace about the color change that has aborted.
88030d2ab3aeSJohn Crispin  */
88040d2ab3aeSJohn Crispin static inline int cfg80211_color_change_aborted_notify(struct net_device *dev)
88050d2ab3aeSJohn Crispin {
88060d2ab3aeSJohn Crispin 	return cfg80211_bss_color_notify(dev, GFP_KERNEL,
88070d2ab3aeSJohn Crispin 					 NL80211_CMD_COLOR_CHANGE_ABORTED,
88080d2ab3aeSJohn Crispin 					 0, 0);
88090d2ab3aeSJohn Crispin }
88100d2ab3aeSJohn Crispin 
88110d2ab3aeSJohn Crispin /**
88120d2ab3aeSJohn Crispin  * cfg80211_color_change_notify - notify color change completion
88130d2ab3aeSJohn Crispin  * @dev: the device on which the color was switched
88140d2ab3aeSJohn Crispin  *
88150d2ab3aeSJohn Crispin  * Inform the userspace about the color change that has completed.
88160d2ab3aeSJohn Crispin  */
88170d2ab3aeSJohn Crispin static inline int cfg80211_color_change_notify(struct net_device *dev)
88180d2ab3aeSJohn Crispin {
88190d2ab3aeSJohn Crispin 	return cfg80211_bss_color_notify(dev, GFP_KERNEL,
88200d2ab3aeSJohn Crispin 					 NL80211_CMD_COLOR_CHANGE_COMPLETED,
88210d2ab3aeSJohn Crispin 					 0, 0);
88220d2ab3aeSJohn Crispin }
88230d2ab3aeSJohn Crispin 
8824704232c2SJohannes Berg #endif /* __NET_CFG80211_H */
8825