xref: /linux/include/net/cfg80211.h (revision f2a0290b2df2b0e65ab78b71c4a15e732afd4458)
1d2912cb1SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
2704232c2SJohannes Berg #ifndef __NET_CFG80211_H
3704232c2SJohannes Berg #define __NET_CFG80211_H
4d3236553SJohannes Berg /*
5d3236553SJohannes Berg  * 802.11 device and configuration interface
6d3236553SJohannes Berg  *
7026331c4SJouni Malinen  * Copyright 2006-2010	Johannes Berg <johannes@sipsolutions.net>
82740f0cfSJohannes Berg  * Copyright 2013-2014 Intel Mobile Communications GmbH
98585989dSLuca Coelho  * Copyright 2015-2017	Intel Deutschland GmbH
10dd3e4fc7SAvraham Stern  * Copyright (C) 2018-2021 Intel Corporation
11d3236553SJohannes Berg  */
12704232c2SJohannes Berg 
13cc69837fSJakub Kicinski #include <linux/ethtool.h>
146f779a66SEmmanuel Grumbach #include <uapi/linux/rfkill.h>
15d3236553SJohannes Berg #include <linux/netdevice.h>
16d3236553SJohannes Berg #include <linux/debugfs.h>
17d3236553SJohannes Berg #include <linux/list.h>
18187f1882SPaul Gortmaker #include <linux/bug.h>
19704232c2SJohannes Berg #include <linux/netlink.h>
20704232c2SJohannes Berg #include <linux/skbuff.h>
2155682965SJohannes Berg #include <linux/nl80211.h>
222a519311SJohannes Berg #include <linux/if_ether.h>
232a519311SJohannes Berg #include <linux/ieee80211.h>
242a0e047eSJohannes Berg #include <linux/net.h>
25358ae888SEmmanuel Grumbach #include <linux/rfkill.h>
26d3236553SJohannes Berg #include <net/regulatory.h>
27d3236553SJohannes Berg 
28d70e9693SJohannes Berg /**
29d70e9693SJohannes Berg  * DOC: Introduction
30d70e9693SJohannes Berg  *
31d70e9693SJohannes Berg  * cfg80211 is the configuration API for 802.11 devices in Linux. It bridges
32d70e9693SJohannes Berg  * userspace and drivers, and offers some utility functionality associated
33d70e9693SJohannes Berg  * with 802.11. cfg80211 must, directly or indirectly via mac80211, be used
34d70e9693SJohannes Berg  * by all modern wireless drivers in Linux, so that they offer a consistent
35d70e9693SJohannes Berg  * API through nl80211. For backward compatibility, cfg80211 also offers
36d70e9693SJohannes Berg  * wireless extensions to userspace, but hides them from drivers completely.
37d70e9693SJohannes Berg  *
38d70e9693SJohannes Berg  * Additionally, cfg80211 contains code to help enforce regulatory spectrum
39d70e9693SJohannes Berg  * use restrictions.
40d70e9693SJohannes Berg  */
41d70e9693SJohannes Berg 
42d70e9693SJohannes Berg 
43d70e9693SJohannes Berg /**
44d70e9693SJohannes Berg  * DOC: Device registration
45d70e9693SJohannes Berg  *
46d70e9693SJohannes Berg  * In order for a driver to use cfg80211, it must register the hardware device
47d70e9693SJohannes Berg  * with cfg80211. This happens through a number of hardware capability structs
48d70e9693SJohannes Berg  * described below.
49d70e9693SJohannes Berg  *
50d70e9693SJohannes Berg  * The fundamental structure for each device is the 'wiphy', of which each
51d70e9693SJohannes Berg  * instance describes a physical wireless device connected to the system. Each
52d70e9693SJohannes Berg  * such wiphy can have zero, one, or many virtual interfaces associated with
53d70e9693SJohannes Berg  * it, which need to be identified as such by pointing the network interface's
54d70e9693SJohannes Berg  * @ieee80211_ptr pointer to a &struct wireless_dev which further describes
55d70e9693SJohannes Berg  * the wireless part of the interface, normally this struct is embedded in the
56d70e9693SJohannes Berg  * network interface's private data area. Drivers can optionally allow creating
57d70e9693SJohannes Berg  * or destroying virtual interfaces on the fly, but without at least one or the
58d70e9693SJohannes Berg  * ability to create some the wireless device isn't useful.
59d70e9693SJohannes Berg  *
60d70e9693SJohannes Berg  * Each wiphy structure contains device capability information, and also has
61d70e9693SJohannes Berg  * a pointer to the various operations the driver offers. The definitions and
62d70e9693SJohannes Berg  * structures here describe these capabilities in detail.
63d70e9693SJohannes Berg  */
64d70e9693SJohannes Berg 
659f5e8f6eSJohannes Berg struct wiphy;
669f5e8f6eSJohannes Berg 
67704232c2SJohannes Berg /*
68d3236553SJohannes Berg  * wireless hardware capability structures
69d3236553SJohannes Berg  */
70d3236553SJohannes Berg 
71d3236553SJohannes Berg /**
72d3236553SJohannes Berg  * enum ieee80211_channel_flags - channel flags
73d3236553SJohannes Berg  *
74d3236553SJohannes Berg  * Channel flags set by the regulatory control code.
75d3236553SJohannes Berg  *
76d3236553SJohannes Berg  * @IEEE80211_CHAN_DISABLED: This channel is disabled.
778fe02e16SLuis R. Rodriguez  * @IEEE80211_CHAN_NO_IR: do not initiate radiation, this includes
788fe02e16SLuis R. Rodriguez  *	sending probe requests or beaconing.
79d3236553SJohannes Berg  * @IEEE80211_CHAN_RADAR: Radar detection is required on this channel.
80689da1b3SLuis R. Rodriguez  * @IEEE80211_CHAN_NO_HT40PLUS: extension channel above this channel
81d3236553SJohannes Berg  *	is not permitted.
82689da1b3SLuis R. Rodriguez  * @IEEE80211_CHAN_NO_HT40MINUS: extension channel below this channel
83d3236553SJohannes Berg  *	is not permitted.
8403f6b084SSeth Forshee  * @IEEE80211_CHAN_NO_OFDM: OFDM is not allowed on this channel.
85c7a6ee27SJohannes Berg  * @IEEE80211_CHAN_NO_80MHZ: If the driver supports 80 MHz on the band,
86c7a6ee27SJohannes Berg  *	this flag indicates that an 80 MHz channel cannot use this
87c7a6ee27SJohannes Berg  *	channel as the control or any of the secondary channels.
88c7a6ee27SJohannes Berg  *	This may be due to the driver or due to regulatory bandwidth
89c7a6ee27SJohannes Berg  *	restrictions.
90c7a6ee27SJohannes Berg  * @IEEE80211_CHAN_NO_160MHZ: If the driver supports 160 MHz on the band,
91c7a6ee27SJohannes Berg  *	this flag indicates that an 160 MHz channel cannot use this
92c7a6ee27SJohannes Berg  *	channel as the control or any of the secondary channels.
93c7a6ee27SJohannes Berg  *	This may be due to the driver or due to regulatory bandwidth
94c7a6ee27SJohannes Berg  *	restrictions.
95570dbde1SDavid Spinadel  * @IEEE80211_CHAN_INDOOR_ONLY: see %NL80211_FREQUENCY_ATTR_INDOOR_ONLY
9606f207fcSArik Nemtsov  * @IEEE80211_CHAN_IR_CONCURRENT: see %NL80211_FREQUENCY_ATTR_IR_CONCURRENT
97ea077c1cSRostislav Lisovy  * @IEEE80211_CHAN_NO_20MHZ: 20 MHz bandwidth is not permitted
98ea077c1cSRostislav Lisovy  *	on this channel.
99ea077c1cSRostislav Lisovy  * @IEEE80211_CHAN_NO_10MHZ: 10 MHz bandwidth is not permitted
100ea077c1cSRostislav Lisovy  *	on this channel.
1011e61d82cSHaim Dreyfuss  * @IEEE80211_CHAN_NO_HE: HE operation is not permitted on this channel.
102d65a9770SThomas Pedersen  * @IEEE80211_CHAN_1MHZ: 1 MHz bandwidth is permitted
103d65a9770SThomas Pedersen  *	on this channel.
104d65a9770SThomas Pedersen  * @IEEE80211_CHAN_2MHZ: 2 MHz bandwidth is permitted
105d65a9770SThomas Pedersen  *	on this channel.
106d65a9770SThomas Pedersen  * @IEEE80211_CHAN_4MHZ: 4 MHz bandwidth is permitted
107d65a9770SThomas Pedersen  *	on this channel.
108d65a9770SThomas Pedersen  * @IEEE80211_CHAN_8MHZ: 8 MHz bandwidth is permitted
109d65a9770SThomas Pedersen  *	on this channel.
110d65a9770SThomas Pedersen  * @IEEE80211_CHAN_16MHZ: 16 MHz bandwidth is permitted
111d65a9770SThomas Pedersen  *	on this channel.
1123743bec6SJia Ding  * @IEEE80211_CHAN_NO_320MHZ: If the driver supports 320 MHz on the band,
1133743bec6SJia Ding  *	this flag indicates that a 320 MHz channel cannot use this
1143743bec6SJia Ding  *	channel as the control or any of the secondary channels.
1153743bec6SJia Ding  *	This may be due to the driver or due to regulatory bandwidth
1163743bec6SJia Ding  *	restrictions.
11731846b65SIlan Peer  * @IEEE80211_CHAN_NO_EHT: EHT operation is not permitted on this channel.
118d3236553SJohannes Berg  */
119d3236553SJohannes Berg enum ieee80211_channel_flags {
120d3236553SJohannes Berg 	IEEE80211_CHAN_DISABLED		= 1<<0,
1218fe02e16SLuis R. Rodriguez 	IEEE80211_CHAN_NO_IR		= 1<<1,
1228fe02e16SLuis R. Rodriguez 	/* hole at 1<<2 */
123d3236553SJohannes Berg 	IEEE80211_CHAN_RADAR		= 1<<3,
124689da1b3SLuis R. Rodriguez 	IEEE80211_CHAN_NO_HT40PLUS	= 1<<4,
125689da1b3SLuis R. Rodriguez 	IEEE80211_CHAN_NO_HT40MINUS	= 1<<5,
12603f6b084SSeth Forshee 	IEEE80211_CHAN_NO_OFDM		= 1<<6,
127c7a6ee27SJohannes Berg 	IEEE80211_CHAN_NO_80MHZ		= 1<<7,
128c7a6ee27SJohannes Berg 	IEEE80211_CHAN_NO_160MHZ	= 1<<8,
129570dbde1SDavid Spinadel 	IEEE80211_CHAN_INDOOR_ONLY	= 1<<9,
13006f207fcSArik Nemtsov 	IEEE80211_CHAN_IR_CONCURRENT	= 1<<10,
131ea077c1cSRostislav Lisovy 	IEEE80211_CHAN_NO_20MHZ		= 1<<11,
132ea077c1cSRostislav Lisovy 	IEEE80211_CHAN_NO_10MHZ		= 1<<12,
1331e61d82cSHaim Dreyfuss 	IEEE80211_CHAN_NO_HE		= 1<<13,
134d65a9770SThomas Pedersen 	IEEE80211_CHAN_1MHZ		= 1<<14,
135d65a9770SThomas Pedersen 	IEEE80211_CHAN_2MHZ		= 1<<15,
136d65a9770SThomas Pedersen 	IEEE80211_CHAN_4MHZ		= 1<<16,
137d65a9770SThomas Pedersen 	IEEE80211_CHAN_8MHZ		= 1<<17,
138d65a9770SThomas Pedersen 	IEEE80211_CHAN_16MHZ		= 1<<18,
1393743bec6SJia Ding 	IEEE80211_CHAN_NO_320MHZ	= 1<<19,
14031846b65SIlan Peer 	IEEE80211_CHAN_NO_EHT		= 1<<20,
141d3236553SJohannes Berg };
142d3236553SJohannes Berg 
143038659e7SLuis R. Rodriguez #define IEEE80211_CHAN_NO_HT40 \
144689da1b3SLuis R. Rodriguez 	(IEEE80211_CHAN_NO_HT40PLUS | IEEE80211_CHAN_NO_HT40MINUS)
145038659e7SLuis R. Rodriguez 
14604f39047SSimon Wunderlich #define IEEE80211_DFS_MIN_CAC_TIME_MS		60000
14704f39047SSimon Wunderlich #define IEEE80211_DFS_MIN_NOP_TIME_MS		(30 * 60 * 1000)
14804f39047SSimon Wunderlich 
149d3236553SJohannes Berg /**
150d3236553SJohannes Berg  * struct ieee80211_channel - channel definition
151d3236553SJohannes Berg  *
152d3236553SJohannes Berg  * This structure describes a single channel for use
153d3236553SJohannes Berg  * with cfg80211.
154d3236553SJohannes Berg  *
155d3236553SJohannes Berg  * @center_freq: center frequency in MHz
156934f4c7dSThomas Pedersen  * @freq_offset: offset from @center_freq, in KHz
157d3236553SJohannes Berg  * @hw_value: hardware-specific value for the channel
158d3236553SJohannes Berg  * @flags: channel flags from &enum ieee80211_channel_flags.
159d3236553SJohannes Berg  * @orig_flags: channel flags at registration time, used by regulatory
160d3236553SJohannes Berg  *	code to support devices with additional restrictions
161d3236553SJohannes Berg  * @band: band this channel belongs to.
162d3236553SJohannes Berg  * @max_antenna_gain: maximum antenna gain in dBi
163d3236553SJohannes Berg  * @max_power: maximum transmission power (in dBm)
164eccc068eSHong Wu  * @max_reg_power: maximum regulatory transmission power (in dBm)
165d3236553SJohannes Berg  * @beacon_found: helper to regulatory code to indicate when a beacon
166d3236553SJohannes Berg  *	has been found on this channel. Use regulatory_hint_found_beacon()
16777c2061dSWalter Goldens  *	to enable this, this is useful only on 5 GHz band.
168d3236553SJohannes Berg  * @orig_mag: internal use
169d3236553SJohannes Berg  * @orig_mpwr: internal use
17004f39047SSimon Wunderlich  * @dfs_state: current state of this channel. Only relevant if radar is required
17104f39047SSimon Wunderlich  *	on this channel.
17204f39047SSimon Wunderlich  * @dfs_state_entered: timestamp (jiffies) when the dfs state was entered.
173089027e5SJanusz Dziedzic  * @dfs_cac_ms: DFS CAC time in milliseconds, this is valid for DFS channels.
174d3236553SJohannes Berg  */
175d3236553SJohannes Berg struct ieee80211_channel {
17657fbcce3SJohannes Berg 	enum nl80211_band band;
1779cf0a0b4SAlexei Avshalom Lazar 	u32 center_freq;
178934f4c7dSThomas Pedersen 	u16 freq_offset;
179d3236553SJohannes Berg 	u16 hw_value;
180d3236553SJohannes Berg 	u32 flags;
181d3236553SJohannes Berg 	int max_antenna_gain;
182d3236553SJohannes Berg 	int max_power;
183eccc068eSHong Wu 	int max_reg_power;
184d3236553SJohannes Berg 	bool beacon_found;
185d3236553SJohannes Berg 	u32 orig_flags;
186d3236553SJohannes Berg 	int orig_mag, orig_mpwr;
18704f39047SSimon Wunderlich 	enum nl80211_dfs_state dfs_state;
18804f39047SSimon Wunderlich 	unsigned long dfs_state_entered;
189089027e5SJanusz Dziedzic 	unsigned int dfs_cac_ms;
190d3236553SJohannes Berg };
191d3236553SJohannes Berg 
192d3236553SJohannes Berg /**
193d3236553SJohannes Berg  * enum ieee80211_rate_flags - rate flags
194d3236553SJohannes Berg  *
195d3236553SJohannes Berg  * Hardware/specification flags for rates. These are structured
196d3236553SJohannes Berg  * in a way that allows using the same bitrate structure for
197d3236553SJohannes Berg  * different bands/PHY modes.
198d3236553SJohannes Berg  *
199d3236553SJohannes Berg  * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short
200d3236553SJohannes Berg  *	preamble on this bitrate; only relevant in 2.4GHz band and
201d3236553SJohannes Berg  *	with CCK rates.
202d3236553SJohannes Berg  * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate
203d3236553SJohannes Berg  *	when used with 802.11a (on the 5 GHz band); filled by the
204d3236553SJohannes Berg  *	core code when registering the wiphy.
205d3236553SJohannes Berg  * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate
206d3236553SJohannes Berg  *	when used with 802.11b (on the 2.4 GHz band); filled by the
207d3236553SJohannes Berg  *	core code when registering the wiphy.
208d3236553SJohannes Berg  * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate
209d3236553SJohannes Berg  *	when used with 802.11g (on the 2.4 GHz band); filled by the
210d3236553SJohannes Berg  *	core code when registering the wiphy.
211d3236553SJohannes Berg  * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode.
21230e74732SSimon Wunderlich  * @IEEE80211_RATE_SUPPORTS_5MHZ: Rate can be used in 5 MHz mode
21330e74732SSimon Wunderlich  * @IEEE80211_RATE_SUPPORTS_10MHZ: Rate can be used in 10 MHz mode
214d3236553SJohannes Berg  */
215d3236553SJohannes Berg enum ieee80211_rate_flags {
216d3236553SJohannes Berg 	IEEE80211_RATE_SHORT_PREAMBLE	= 1<<0,
217d3236553SJohannes Berg 	IEEE80211_RATE_MANDATORY_A	= 1<<1,
218d3236553SJohannes Berg 	IEEE80211_RATE_MANDATORY_B	= 1<<2,
219d3236553SJohannes Berg 	IEEE80211_RATE_MANDATORY_G	= 1<<3,
220d3236553SJohannes Berg 	IEEE80211_RATE_ERP_G		= 1<<4,
22130e74732SSimon Wunderlich 	IEEE80211_RATE_SUPPORTS_5MHZ	= 1<<5,
22230e74732SSimon Wunderlich 	IEEE80211_RATE_SUPPORTS_10MHZ	= 1<<6,
223d3236553SJohannes Berg };
224d3236553SJohannes Berg 
225d3236553SJohannes Berg /**
2266eb18137SDedy Lansky  * enum ieee80211_bss_type - BSS type filter
2276eb18137SDedy Lansky  *
2286eb18137SDedy Lansky  * @IEEE80211_BSS_TYPE_ESS: Infrastructure BSS
2296eb18137SDedy Lansky  * @IEEE80211_BSS_TYPE_PBSS: Personal BSS
2306eb18137SDedy Lansky  * @IEEE80211_BSS_TYPE_IBSS: Independent BSS
2316eb18137SDedy Lansky  * @IEEE80211_BSS_TYPE_MBSS: Mesh BSS
2326eb18137SDedy Lansky  * @IEEE80211_BSS_TYPE_ANY: Wildcard value for matching any BSS type
2336eb18137SDedy Lansky  */
2346eb18137SDedy Lansky enum ieee80211_bss_type {
2356eb18137SDedy Lansky 	IEEE80211_BSS_TYPE_ESS,
2366eb18137SDedy Lansky 	IEEE80211_BSS_TYPE_PBSS,
2376eb18137SDedy Lansky 	IEEE80211_BSS_TYPE_IBSS,
2386eb18137SDedy Lansky 	IEEE80211_BSS_TYPE_MBSS,
2396eb18137SDedy Lansky 	IEEE80211_BSS_TYPE_ANY
2406eb18137SDedy Lansky };
2416eb18137SDedy Lansky 
2426eb18137SDedy Lansky /**
2436eb18137SDedy Lansky  * enum ieee80211_privacy - BSS privacy filter
2446eb18137SDedy Lansky  *
2456eb18137SDedy Lansky  * @IEEE80211_PRIVACY_ON: privacy bit set
2466eb18137SDedy Lansky  * @IEEE80211_PRIVACY_OFF: privacy bit clear
2476eb18137SDedy Lansky  * @IEEE80211_PRIVACY_ANY: Wildcard value for matching any privacy setting
2486eb18137SDedy Lansky  */
2496eb18137SDedy Lansky enum ieee80211_privacy {
2506eb18137SDedy Lansky 	IEEE80211_PRIVACY_ON,
2516eb18137SDedy Lansky 	IEEE80211_PRIVACY_OFF,
2526eb18137SDedy Lansky 	IEEE80211_PRIVACY_ANY
2536eb18137SDedy Lansky };
2546eb18137SDedy Lansky 
2556eb18137SDedy Lansky #define IEEE80211_PRIVACY(x)	\
2566eb18137SDedy Lansky 	((x) ? IEEE80211_PRIVACY_ON : IEEE80211_PRIVACY_OFF)
2576eb18137SDedy Lansky 
2586eb18137SDedy Lansky /**
259d3236553SJohannes Berg  * struct ieee80211_rate - bitrate definition
260d3236553SJohannes Berg  *
261d3236553SJohannes Berg  * This structure describes a bitrate that an 802.11 PHY can
262d3236553SJohannes Berg  * operate with. The two values @hw_value and @hw_value_short
263d3236553SJohannes Berg  * are only for driver use when pointers to this structure are
264d3236553SJohannes Berg  * passed around.
265d3236553SJohannes Berg  *
266d3236553SJohannes Berg  * @flags: rate-specific flags
267d3236553SJohannes Berg  * @bitrate: bitrate in units of 100 Kbps
268d3236553SJohannes Berg  * @hw_value: driver/hardware value for this rate
269d3236553SJohannes Berg  * @hw_value_short: driver/hardware value for this rate when
270d3236553SJohannes Berg  *	short preamble is used
271d3236553SJohannes Berg  */
272d3236553SJohannes Berg struct ieee80211_rate {
273d3236553SJohannes Berg 	u32 flags;
274d3236553SJohannes Berg 	u16 bitrate;
275d3236553SJohannes Berg 	u16 hw_value, hw_value_short;
276d3236553SJohannes Berg };
277d3236553SJohannes Berg 
278d3236553SJohannes Berg /**
279796e90f4SJohn Crispin  * struct ieee80211_he_obss_pd - AP settings for spatial reuse
280796e90f4SJohn Crispin  *
281796e90f4SJohn Crispin  * @enable: is the feature enabled.
282f5bec330SRajkumar Manoharan  * @sr_ctrl: The SR Control field of SRP element.
283f5bec330SRajkumar Manoharan  * @non_srg_max_offset: non-SRG maximum tx power offset
284796e90f4SJohn Crispin  * @min_offset: minimal tx power offset an associated station shall use
285796e90f4SJohn Crispin  * @max_offset: maximum tx power offset an associated station shall use
286f5bec330SRajkumar Manoharan  * @bss_color_bitmap: bitmap that indicates the BSS color values used by
287f5bec330SRajkumar Manoharan  *	members of the SRG
288f5bec330SRajkumar Manoharan  * @partial_bssid_bitmap: bitmap that indicates the partial BSSID values
289f5bec330SRajkumar Manoharan  *	used by members of the SRG
290796e90f4SJohn Crispin  */
291796e90f4SJohn Crispin struct ieee80211_he_obss_pd {
292796e90f4SJohn Crispin 	bool enable;
293f5bec330SRajkumar Manoharan 	u8 sr_ctrl;
294f5bec330SRajkumar Manoharan 	u8 non_srg_max_offset;
295796e90f4SJohn Crispin 	u8 min_offset;
296796e90f4SJohn Crispin 	u8 max_offset;
297f5bec330SRajkumar Manoharan 	u8 bss_color_bitmap[8];
298f5bec330SRajkumar Manoharan 	u8 partial_bssid_bitmap[8];
299796e90f4SJohn Crispin };
300796e90f4SJohn Crispin 
301796e90f4SJohn Crispin /**
3025c5e52d1SJohn Crispin  * struct cfg80211_he_bss_color - AP settings for BSS coloring
3035c5e52d1SJohn Crispin  *
3045c5e52d1SJohn Crispin  * @color: the current color.
30575e6b594SJohannes Berg  * @enabled: HE BSS color is used
3065c5e52d1SJohn Crispin  * @partial: define the AID equation.
3075c5e52d1SJohn Crispin  */
3085c5e52d1SJohn Crispin struct cfg80211_he_bss_color {
3095c5e52d1SJohn Crispin 	u8 color;
31075e6b594SJohannes Berg 	bool enabled;
3115c5e52d1SJohn Crispin 	bool partial;
3125c5e52d1SJohn Crispin };
3135c5e52d1SJohn Crispin 
3145c5e52d1SJohn Crispin /**
315d3236553SJohannes Berg  * struct ieee80211_sta_ht_cap - STA's HT capabilities
316d3236553SJohannes Berg  *
317d3236553SJohannes Berg  * This structure describes most essential parameters needed
318d3236553SJohannes Berg  * to describe 802.11n HT capabilities for an STA.
319d3236553SJohannes Berg  *
320d3236553SJohannes Berg  * @ht_supported: is HT supported by the STA
321d3236553SJohannes Berg  * @cap: HT capabilities map as described in 802.11n spec
322d3236553SJohannes Berg  * @ampdu_factor: Maximum A-MPDU length factor
323d3236553SJohannes Berg  * @ampdu_density: Minimum A-MPDU spacing
324d3236553SJohannes Berg  * @mcs: Supported MCS rates
325d3236553SJohannes Berg  */
326d3236553SJohannes Berg struct ieee80211_sta_ht_cap {
327d3236553SJohannes Berg 	u16 cap; /* use IEEE80211_HT_CAP_ */
328d3236553SJohannes Berg 	bool ht_supported;
329d3236553SJohannes Berg 	u8 ampdu_factor;
330d3236553SJohannes Berg 	u8 ampdu_density;
331d3236553SJohannes Berg 	struct ieee80211_mcs_info mcs;
332d3236553SJohannes Berg };
333d3236553SJohannes Berg 
334d3236553SJohannes Berg /**
335bf0c111eSMahesh Palivela  * struct ieee80211_sta_vht_cap - STA's VHT capabilities
336bf0c111eSMahesh Palivela  *
337bf0c111eSMahesh Palivela  * This structure describes most essential parameters needed
338bf0c111eSMahesh Palivela  * to describe 802.11ac VHT capabilities for an STA.
339bf0c111eSMahesh Palivela  *
340bf0c111eSMahesh Palivela  * @vht_supported: is VHT supported by the STA
341bf0c111eSMahesh Palivela  * @cap: VHT capabilities map as described in 802.11ac spec
342bf0c111eSMahesh Palivela  * @vht_mcs: Supported VHT MCS rates
343bf0c111eSMahesh Palivela  */
344bf0c111eSMahesh Palivela struct ieee80211_sta_vht_cap {
345bf0c111eSMahesh Palivela 	bool vht_supported;
346bf0c111eSMahesh Palivela 	u32 cap; /* use IEEE80211_VHT_CAP_ */
347bf0c111eSMahesh Palivela 	struct ieee80211_vht_mcs_info vht_mcs;
348bf0c111eSMahesh Palivela };
349bf0c111eSMahesh Palivela 
350c4cbaf79SLuca Coelho #define IEEE80211_HE_PPE_THRES_MAX_LEN		25
351c4cbaf79SLuca Coelho 
352c4cbaf79SLuca Coelho /**
353c4cbaf79SLuca Coelho  * struct ieee80211_sta_he_cap - STA's HE capabilities
354c4cbaf79SLuca Coelho  *
355c4cbaf79SLuca Coelho  * This structure describes most essential parameters needed
356c4cbaf79SLuca Coelho  * to describe 802.11ax HE capabilities for a STA.
357c4cbaf79SLuca Coelho  *
358c4cbaf79SLuca Coelho  * @has_he: true iff HE data is valid.
359c4cbaf79SLuca Coelho  * @he_cap_elem: Fixed portion of the HE capabilities element.
360c4cbaf79SLuca Coelho  * @he_mcs_nss_supp: The supported NSS/MCS combinations.
361c4cbaf79SLuca Coelho  * @ppe_thres: Holds the PPE Thresholds data.
362c4cbaf79SLuca Coelho  */
363c4cbaf79SLuca Coelho struct ieee80211_sta_he_cap {
364c4cbaf79SLuca Coelho 	bool has_he;
365c4cbaf79SLuca Coelho 	struct ieee80211_he_cap_elem he_cap_elem;
366c4cbaf79SLuca Coelho 	struct ieee80211_he_mcs_nss_supp he_mcs_nss_supp;
367c4cbaf79SLuca Coelho 	u8 ppe_thres[IEEE80211_HE_PPE_THRES_MAX_LEN];
368c4cbaf79SLuca Coelho };
369c4cbaf79SLuca Coelho 
370c4cbaf79SLuca Coelho /**
3715cd5a8a3SIlan Peer  * struct ieee80211_eht_mcs_nss_supp - EHT max supported NSS per MCS
3725cd5a8a3SIlan Peer  *
3735cd5a8a3SIlan Peer  * See P802.11be_D1.3 Table 9-401k - "Subfields of the Supported EHT-MCS
3745cd5a8a3SIlan Peer  * and NSS Set field"
3755cd5a8a3SIlan Peer  *
3765cd5a8a3SIlan Peer  * @only_20mhz: MCS/NSS support for 20 MHz-only STA.
3775cd5a8a3SIlan Peer  * @bw._80: MCS/NSS support for BW <= 80 MHz
3785cd5a8a3SIlan Peer  * @bw._160: MCS/NSS support for BW = 160 MHz
3795cd5a8a3SIlan Peer  * @bw._320: MCS/NSS support for BW = 320 MHz
3805cd5a8a3SIlan Peer  */
3815cd5a8a3SIlan Peer struct ieee80211_eht_mcs_nss_supp {
3825cd5a8a3SIlan Peer 	union {
3835cd5a8a3SIlan Peer 		struct ieee80211_eht_mcs_nss_supp_20mhz_only only_20mhz;
3845cd5a8a3SIlan Peer 		struct {
3855cd5a8a3SIlan Peer 			struct ieee80211_eht_mcs_nss_supp_bw _80;
3865cd5a8a3SIlan Peer 			struct ieee80211_eht_mcs_nss_supp_bw _160;
3875cd5a8a3SIlan Peer 			struct ieee80211_eht_mcs_nss_supp_bw _320;
3885cd5a8a3SIlan Peer 		} __packed bw;
3895cd5a8a3SIlan Peer 	} __packed;
3905cd5a8a3SIlan Peer } __packed;
3915cd5a8a3SIlan Peer 
3925cd5a8a3SIlan Peer #define IEEE80211_EHT_PPE_THRES_MAX_LEN		32
3935cd5a8a3SIlan Peer 
3945cd5a8a3SIlan Peer /**
3955cd5a8a3SIlan Peer  * struct ieee80211_sta_eht_cap - STA's EHT capabilities
3965cd5a8a3SIlan Peer  *
3975cd5a8a3SIlan Peer  * This structure describes most essential parameters needed
3985cd5a8a3SIlan Peer  * to describe 802.11be EHT capabilities for a STA.
3995cd5a8a3SIlan Peer  *
4005cd5a8a3SIlan Peer  * @has_eht: true iff EHT data is valid.
4015cd5a8a3SIlan Peer  * @eht_cap_elem: Fixed portion of the eht capabilities element.
4025cd5a8a3SIlan Peer  * @eht_mcs_nss_supp: The supported NSS/MCS combinations.
4035cd5a8a3SIlan Peer  * @eht_ppe_thres: Holds the PPE Thresholds data.
4045cd5a8a3SIlan Peer  */
4055cd5a8a3SIlan Peer struct ieee80211_sta_eht_cap {
4065cd5a8a3SIlan Peer 	bool has_eht;
4075cd5a8a3SIlan Peer 	struct ieee80211_eht_cap_elem_fixed eht_cap_elem;
4085cd5a8a3SIlan Peer 	struct ieee80211_eht_mcs_nss_supp eht_mcs_nss_supp;
4095cd5a8a3SIlan Peer 	u8 eht_ppe_thres[IEEE80211_EHT_PPE_THRES_MAX_LEN];
4105cd5a8a3SIlan Peer };
4115cd5a8a3SIlan Peer 
4125cd5a8a3SIlan Peer /**
4135d9c358dSRandy Dunlap  * struct ieee80211_sband_iftype_data - sband data per interface type
414c4cbaf79SLuca Coelho  *
415c4cbaf79SLuca Coelho  * This structure encapsulates sband data that is relevant for the
416c4cbaf79SLuca Coelho  * interface types defined in @types_mask.  Each type in the
417c4cbaf79SLuca Coelho  * @types_mask must be unique across all instances of iftype_data.
418c4cbaf79SLuca Coelho  *
419c4cbaf79SLuca Coelho  * @types_mask: interface types mask
420c4cbaf79SLuca Coelho  * @he_cap: holds the HE capabilities
42122395217SJohannes Berg  * @he_6ghz_capa: HE 6 GHz capabilities, must be filled in for a
42222395217SJohannes Berg  *	6 GHz band channel (and 0 may be valid value).
423f4f86505SJohannes Berg  * @vendor_elems: vendor element(s) to advertise
424f4f86505SJohannes Berg  * @vendor_elems.data: vendor element(s) data
425f4f86505SJohannes Berg  * @vendor_elems.len: vendor element(s) length
426c4cbaf79SLuca Coelho  */
427c4cbaf79SLuca Coelho struct ieee80211_sband_iftype_data {
428c4cbaf79SLuca Coelho 	u16 types_mask;
429c4cbaf79SLuca Coelho 	struct ieee80211_sta_he_cap he_cap;
43022395217SJohannes Berg 	struct ieee80211_he_6ghz_capa he_6ghz_capa;
4315cd5a8a3SIlan Peer 	struct ieee80211_sta_eht_cap eht_cap;
432f4f86505SJohannes Berg 	struct {
433f4f86505SJohannes Berg 		const u8 *data;
434f4f86505SJohannes Berg 		unsigned int len;
435f4f86505SJohannes Berg 	} vendor_elems;
436c4cbaf79SLuca Coelho };
437c4cbaf79SLuca Coelho 
438bf0c111eSMahesh Palivela /**
4392a38075cSAlexei Avshalom Lazar  * enum ieee80211_edmg_bw_config - allowed channel bandwidth configurations
4402a38075cSAlexei Avshalom Lazar  *
4412a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_4: 2.16GHz
4422a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_5: 2.16GHz and 4.32GHz
4432a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_6: 2.16GHz, 4.32GHz and 6.48GHz
4442a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_7: 2.16GHz, 4.32GHz, 6.48GHz and 8.64GHz
4452a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_8: 2.16GHz and 2.16GHz + 2.16GHz
4462a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_9: 2.16GHz, 4.32GHz and 2.16GHz + 2.16GHz
4472a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_10: 2.16GHz, 4.32GHz, 6.48GHz and 2.16GHz+2.16GHz
4482a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_11: 2.16GHz, 4.32GHz, 6.48GHz, 8.64GHz and
4492a38075cSAlexei Avshalom Lazar  *	2.16GHz+2.16GHz
4502a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_12: 2.16GHz, 2.16GHz + 2.16GHz and
4512a38075cSAlexei Avshalom Lazar  *	4.32GHz + 4.32GHz
4522a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_13: 2.16GHz, 4.32GHz, 2.16GHz + 2.16GHz and
4532a38075cSAlexei Avshalom Lazar  *	4.32GHz + 4.32GHz
4542a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_14: 2.16GHz, 4.32GHz, 6.48GHz, 2.16GHz + 2.16GHz
4552a38075cSAlexei Avshalom Lazar  *	and 4.32GHz + 4.32GHz
4562a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_15: 2.16GHz, 4.32GHz, 6.48GHz, 8.64GHz,
4572a38075cSAlexei Avshalom Lazar  *	2.16GHz + 2.16GHz and 4.32GHz + 4.32GHz
4582a38075cSAlexei Avshalom Lazar  */
4592a38075cSAlexei Avshalom Lazar enum ieee80211_edmg_bw_config {
4602a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_4	= 4,
4612a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_5	= 5,
4622a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_6	= 6,
4632a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_7	= 7,
4642a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_8	= 8,
4652a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_9	= 9,
4662a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_10	= 10,
4672a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_11	= 11,
4682a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_12	= 12,
4692a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_13	= 13,
4702a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_14	= 14,
4712a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_15	= 15,
4722a38075cSAlexei Avshalom Lazar };
4732a38075cSAlexei Avshalom Lazar 
4742a38075cSAlexei Avshalom Lazar /**
4752a38075cSAlexei Avshalom Lazar  * struct ieee80211_edmg - EDMG configuration
4762a38075cSAlexei Avshalom Lazar  *
4772a38075cSAlexei Avshalom Lazar  * This structure describes most essential parameters needed
4782a38075cSAlexei Avshalom Lazar  * to describe 802.11ay EDMG configuration
4792a38075cSAlexei Avshalom Lazar  *
4802a38075cSAlexei Avshalom Lazar  * @channels: bitmap that indicates the 2.16 GHz channel(s)
4812a38075cSAlexei Avshalom Lazar  *	that are allowed to be used for transmissions.
4822a38075cSAlexei Avshalom Lazar  *	Bit 0 indicates channel 1, bit 1 indicates channel 2, etc.
4832a38075cSAlexei Avshalom Lazar  *	Set to 0 indicate EDMG not supported.
4842a38075cSAlexei Avshalom Lazar  * @bw_config: Channel BW Configuration subfield encodes
4852a38075cSAlexei Avshalom Lazar  *	the allowed channel bandwidth configurations
4862a38075cSAlexei Avshalom Lazar  */
4872a38075cSAlexei Avshalom Lazar struct ieee80211_edmg {
4882a38075cSAlexei Avshalom Lazar 	u8 channels;
4892a38075cSAlexei Avshalom Lazar 	enum ieee80211_edmg_bw_config bw_config;
4902a38075cSAlexei Avshalom Lazar };
4912a38075cSAlexei Avshalom Lazar 
4922a38075cSAlexei Avshalom Lazar /**
493df78a0c0SThomas Pedersen  * struct ieee80211_sta_s1g_cap - STA's S1G capabilities
494df78a0c0SThomas Pedersen  *
495df78a0c0SThomas Pedersen  * This structure describes most essential parameters needed
496df78a0c0SThomas Pedersen  * to describe 802.11ah S1G capabilities for a STA.
497df78a0c0SThomas Pedersen  *
498df78a0c0SThomas Pedersen  * @s1g_supported: is STA an S1G STA
499df78a0c0SThomas Pedersen  * @cap: S1G capabilities information
500df78a0c0SThomas Pedersen  * @nss_mcs: Supported NSS MCS set
501df78a0c0SThomas Pedersen  */
502df78a0c0SThomas Pedersen struct ieee80211_sta_s1g_cap {
503df78a0c0SThomas Pedersen 	bool s1g;
504df78a0c0SThomas Pedersen 	u8 cap[10]; /* use S1G_CAPAB_ */
505df78a0c0SThomas Pedersen 	u8 nss_mcs[5];
506df78a0c0SThomas Pedersen };
507df78a0c0SThomas Pedersen 
508df78a0c0SThomas Pedersen /**
509d3236553SJohannes Berg  * struct ieee80211_supported_band - frequency band definition
510d3236553SJohannes Berg  *
511d3236553SJohannes Berg  * This structure describes a frequency band a wiphy
512d3236553SJohannes Berg  * is able to operate in.
513d3236553SJohannes Berg  *
514085a6c10SRandy Dunlap  * @channels: Array of channels the hardware can operate with
515d3236553SJohannes Berg  *	in this band.
516d3236553SJohannes Berg  * @band: the band this structure represents
517d3236553SJohannes Berg  * @n_channels: Number of channels in @channels
518d3236553SJohannes Berg  * @bitrates: Array of bitrates the hardware can operate with
519d3236553SJohannes Berg  *	in this band. Must be sorted to give a valid "supported
520d3236553SJohannes Berg  *	rates" IE, i.e. CCK rates first, then OFDM.
521d3236553SJohannes Berg  * @n_bitrates: Number of bitrates in @bitrates
522abe37c4bSJohannes Berg  * @ht_cap: HT capabilities in this band
523c9a0a302SRobert P. J. Day  * @vht_cap: VHT capabilities in this band
5248a50c057SMauro Carvalho Chehab  * @s1g_cap: S1G capabilities in this band
5252a38075cSAlexei Avshalom Lazar  * @edmg_cap: EDMG capabilities in this band
5269ff167e1SJohannes Berg  * @s1g_cap: S1G capabilities in this band (S1B band only, of course)
527c4cbaf79SLuca Coelho  * @n_iftype_data: number of iftype data entries
528c4cbaf79SLuca Coelho  * @iftype_data: interface type data entries.  Note that the bits in
529c4cbaf79SLuca Coelho  *	@types_mask inside this structure cannot overlap (i.e. only
530c4cbaf79SLuca Coelho  *	one occurrence of each type is allowed across all instances of
531c4cbaf79SLuca Coelho  *	iftype_data).
532d3236553SJohannes Berg  */
533d3236553SJohannes Berg struct ieee80211_supported_band {
534d3236553SJohannes Berg 	struct ieee80211_channel *channels;
535d3236553SJohannes Berg 	struct ieee80211_rate *bitrates;
53657fbcce3SJohannes Berg 	enum nl80211_band band;
537d3236553SJohannes Berg 	int n_channels;
538d3236553SJohannes Berg 	int n_bitrates;
539d3236553SJohannes Berg 	struct ieee80211_sta_ht_cap ht_cap;
540bf0c111eSMahesh Palivela 	struct ieee80211_sta_vht_cap vht_cap;
541df78a0c0SThomas Pedersen 	struct ieee80211_sta_s1g_cap s1g_cap;
5422a38075cSAlexei Avshalom Lazar 	struct ieee80211_edmg edmg_cap;
543c4cbaf79SLuca Coelho 	u16 n_iftype_data;
544c4cbaf79SLuca Coelho 	const struct ieee80211_sband_iftype_data *iftype_data;
545d3236553SJohannes Berg };
546d3236553SJohannes Berg 
547e691ac2fSRafał Miłecki /**
548c4cbaf79SLuca Coelho  * ieee80211_get_sband_iftype_data - return sband data for a given iftype
549c4cbaf79SLuca Coelho  * @sband: the sband to search for the STA on
550c4cbaf79SLuca Coelho  * @iftype: enum nl80211_iftype
551c4cbaf79SLuca Coelho  *
552c4cbaf79SLuca Coelho  * Return: pointer to struct ieee80211_sband_iftype_data, or NULL is none found
553c4cbaf79SLuca Coelho  */
554c4cbaf79SLuca Coelho static inline const struct ieee80211_sband_iftype_data *
555c4cbaf79SLuca Coelho ieee80211_get_sband_iftype_data(const struct ieee80211_supported_band *sband,
556c4cbaf79SLuca Coelho 				u8 iftype)
557c4cbaf79SLuca Coelho {
558c4cbaf79SLuca Coelho 	int i;
559c4cbaf79SLuca Coelho 
560c4cbaf79SLuca Coelho 	if (WARN_ON(iftype >= NL80211_IFTYPE_MAX))
561c4cbaf79SLuca Coelho 		return NULL;
562c4cbaf79SLuca Coelho 
563c4cbaf79SLuca Coelho 	for (i = 0; i < sband->n_iftype_data; i++)  {
564c4cbaf79SLuca Coelho 		const struct ieee80211_sband_iftype_data *data =
565c4cbaf79SLuca Coelho 			&sband->iftype_data[i];
566c4cbaf79SLuca Coelho 
567c4cbaf79SLuca Coelho 		if (data->types_mask & BIT(iftype))
568c4cbaf79SLuca Coelho 			return data;
569c4cbaf79SLuca Coelho 	}
570c4cbaf79SLuca Coelho 
571c4cbaf79SLuca Coelho 	return NULL;
572c4cbaf79SLuca Coelho }
573c4cbaf79SLuca Coelho 
574c4cbaf79SLuca Coelho /**
575d7edf40cSJohn Crispin  * ieee80211_get_he_iftype_cap - return HE capabilities for an sband's iftype
576d7edf40cSJohn Crispin  * @sband: the sband to search for the iftype on
577d7edf40cSJohn Crispin  * @iftype: enum nl80211_iftype
578d7edf40cSJohn Crispin  *
579d7edf40cSJohn Crispin  * Return: pointer to the struct ieee80211_sta_he_cap, or NULL is none found
580d7edf40cSJohn Crispin  */
581d7edf40cSJohn Crispin static inline const struct ieee80211_sta_he_cap *
582d7edf40cSJohn Crispin ieee80211_get_he_iftype_cap(const struct ieee80211_supported_band *sband,
583d7edf40cSJohn Crispin 			    u8 iftype)
584d7edf40cSJohn Crispin {
585d7edf40cSJohn Crispin 	const struct ieee80211_sband_iftype_data *data =
586d7edf40cSJohn Crispin 		ieee80211_get_sband_iftype_data(sband, iftype);
587d7edf40cSJohn Crispin 
588d7edf40cSJohn Crispin 	if (data && data->he_cap.has_he)
589d7edf40cSJohn Crispin 		return &data->he_cap;
590d7edf40cSJohn Crispin 
591d7edf40cSJohn Crispin 	return NULL;
592d7edf40cSJohn Crispin }
593d7edf40cSJohn Crispin 
594d7edf40cSJohn Crispin /**
5952ad2274cSIlan Peer  * ieee80211_get_he_6ghz_capa - return HE 6 GHz capabilities
5962ad2274cSIlan Peer  * @sband: the sband to search for the STA on
5972ad2274cSIlan Peer  * @iftype: the iftype to search for
5982ad2274cSIlan Peer  *
5992ad2274cSIlan Peer  * Return: the 6GHz capabilities
6002ad2274cSIlan Peer  */
6012ad2274cSIlan Peer static inline __le16
6022ad2274cSIlan Peer ieee80211_get_he_6ghz_capa(const struct ieee80211_supported_band *sband,
6032ad2274cSIlan Peer 			   enum nl80211_iftype iftype)
6042ad2274cSIlan Peer {
6052ad2274cSIlan Peer 	const struct ieee80211_sband_iftype_data *data =
6062ad2274cSIlan Peer 		ieee80211_get_sband_iftype_data(sband, iftype);
6072ad2274cSIlan Peer 
6082ad2274cSIlan Peer 	if (WARN_ON(!data || !data->he_cap.has_he))
6092ad2274cSIlan Peer 		return 0;
6102ad2274cSIlan Peer 
6112ad2274cSIlan Peer 	return data->he_6ghz_capa.capa;
6122ad2274cSIlan Peer }
6132ad2274cSIlan Peer 
6142ad2274cSIlan Peer /**
6155cd5a8a3SIlan Peer  * ieee80211_get_eht_iftype_cap - return ETH capabilities for an sband's iftype
6165cd5a8a3SIlan Peer  * @sband: the sband to search for the iftype on
6175cd5a8a3SIlan Peer  * @iftype: enum nl80211_iftype
6185cd5a8a3SIlan Peer  *
6195cd5a8a3SIlan Peer  * Return: pointer to the struct ieee80211_sta_eht_cap, or NULL is none found
6205cd5a8a3SIlan Peer  */
6215cd5a8a3SIlan Peer static inline const struct ieee80211_sta_eht_cap *
6225cd5a8a3SIlan Peer ieee80211_get_eht_iftype_cap(const struct ieee80211_supported_band *sband,
6235cd5a8a3SIlan Peer 			     enum nl80211_iftype iftype)
6245cd5a8a3SIlan Peer {
6255cd5a8a3SIlan Peer 	const struct ieee80211_sband_iftype_data *data =
6265cd5a8a3SIlan Peer 		ieee80211_get_sband_iftype_data(sband, iftype);
6275cd5a8a3SIlan Peer 
6285cd5a8a3SIlan Peer 	if (data && data->eht_cap.has_eht)
6295cd5a8a3SIlan Peer 		return &data->eht_cap;
6305cd5a8a3SIlan Peer 
6315cd5a8a3SIlan Peer 	return NULL;
6325cd5a8a3SIlan Peer }
6335cd5a8a3SIlan Peer 
6345cd5a8a3SIlan Peer /**
635e691ac2fSRafał Miłecki  * wiphy_read_of_freq_limits - read frequency limits from device tree
636e691ac2fSRafał Miłecki  *
637e691ac2fSRafał Miłecki  * @wiphy: the wireless device to get extra limits for
638e691ac2fSRafał Miłecki  *
639e691ac2fSRafał Miłecki  * Some devices may have extra limitations specified in DT. This may be useful
640e691ac2fSRafał Miłecki  * for chipsets that normally support more bands but are limited due to board
641e691ac2fSRafał Miłecki  * design (e.g. by antennas or external power amplifier).
642e691ac2fSRafał Miłecki  *
643e691ac2fSRafał Miłecki  * This function reads info from DT and uses it to *modify* channels (disable
644e691ac2fSRafał Miłecki  * unavailable ones). It's usually a *bad* idea to use it in drivers with
645e691ac2fSRafał Miłecki  * shared channel data as DT limitations are device specific. You should make
646e691ac2fSRafał Miłecki  * sure to call it only if channels in wiphy are copied and can be modified
647e691ac2fSRafał Miłecki  * without affecting other devices.
648e691ac2fSRafał Miłecki  *
649e691ac2fSRafał Miłecki  * As this function access device node it has to be called after set_wiphy_dev.
650e691ac2fSRafał Miłecki  * It also modifies channels so they have to be set first.
651e691ac2fSRafał Miłecki  * If using this helper, call it before wiphy_register().
652e691ac2fSRafał Miłecki  */
653e691ac2fSRafał Miłecki #ifdef CONFIG_OF
654e691ac2fSRafał Miłecki void wiphy_read_of_freq_limits(struct wiphy *wiphy);
655e691ac2fSRafał Miłecki #else /* CONFIG_OF */
656e691ac2fSRafał Miłecki static inline void wiphy_read_of_freq_limits(struct wiphy *wiphy)
657e691ac2fSRafał Miłecki {
658e691ac2fSRafał Miłecki }
659e691ac2fSRafał Miłecki #endif /* !CONFIG_OF */
660e691ac2fSRafał Miłecki 
661e691ac2fSRafał Miłecki 
662d3236553SJohannes Berg /*
663d3236553SJohannes Berg  * Wireless hardware/device configuration structures and methods
664704232c2SJohannes Berg  */
665704232c2SJohannes Berg 
6662ec600d6SLuis Carlos Cobo /**
667d70e9693SJohannes Berg  * DOC: Actions and configuration
668d70e9693SJohannes Berg  *
669d70e9693SJohannes Berg  * Each wireless device and each virtual interface offer a set of configuration
670d70e9693SJohannes Berg  * operations and other actions that are invoked by userspace. Each of these
671d70e9693SJohannes Berg  * actions is described in the operations structure, and the parameters these
672d70e9693SJohannes Berg  * operations use are described separately.
673d70e9693SJohannes Berg  *
674d70e9693SJohannes Berg  * Additionally, some operations are asynchronous and expect to get status
675d70e9693SJohannes Berg  * information via some functions that drivers need to call.
676d70e9693SJohannes Berg  *
677d70e9693SJohannes Berg  * Scanning and BSS list handling with its associated functionality is described
678d70e9693SJohannes Berg  * in a separate chapter.
679d70e9693SJohannes Berg  */
680d70e9693SJohannes Berg 
681c6e6a0c8SAviya Erenfeld #define VHT_MUMIMO_GROUPS_DATA_LEN (WLAN_MEMBERSHIP_LEN +\
682c6e6a0c8SAviya Erenfeld 				    WLAN_USER_POSITION_LEN)
683c6e6a0c8SAviya Erenfeld 
684d70e9693SJohannes Berg /**
6852ec600d6SLuis Carlos Cobo  * struct vif_params - describes virtual interface parameters
686818a986eSJohannes Berg  * @flags: monitor interface flags, unchanged if 0, otherwise
687818a986eSJohannes Berg  *	%MONITOR_FLAG_CHANGED will be set
6888b787643SFelix Fietkau  * @use_4addr: use 4-address frames
689e8f479b1SBen Greear  * @macaddr: address to use for this virtual interface.
690e8f479b1SBen Greear  *	If this parameter is set to zero address the driver may
691e8f479b1SBen Greear  *	determine the address as needed.
692e8f479b1SBen Greear  *	This feature is only fully supported by drivers that enable the
693e8f479b1SBen Greear  *	%NL80211_FEATURE_MAC_ON_CREATE flag.  Others may support creating
694e8f479b1SBen Greear  **	only p2p devices with specified MAC.
695b0265024SJohannes Berg  * @vht_mumimo_groups: MU-MIMO groupID, used for monitoring MU-MIMO packets
696b0265024SJohannes Berg  *	belonging to that MU-MIMO groupID; %NULL if not changed
697b0265024SJohannes Berg  * @vht_mumimo_follow_addr: MU-MIMO follow address, used for monitoring
698b0265024SJohannes Berg  *	MU-MIMO packets going to the specified station; %NULL if not changed
6992ec600d6SLuis Carlos Cobo  */
7002ec600d6SLuis Carlos Cobo struct vif_params {
701818a986eSJohannes Berg 	u32 flags;
7028b787643SFelix Fietkau 	int use_4addr;
7031c18f145SArend van Spriel 	u8 macaddr[ETH_ALEN];
704b0265024SJohannes Berg 	const u8 *vht_mumimo_groups;
705b0265024SJohannes Berg 	const u8 *vht_mumimo_follow_addr;
7062ec600d6SLuis Carlos Cobo };
7072ec600d6SLuis Carlos Cobo 
70841ade00fSJohannes Berg /**
70941ade00fSJohannes Berg  * struct key_params - key information
71041ade00fSJohannes Berg  *
71141ade00fSJohannes Berg  * Information about a key
71241ade00fSJohannes Berg  *
71341ade00fSJohannes Berg  * @key: key material
71441ade00fSJohannes Berg  * @key_len: length of key material
71541ade00fSJohannes Berg  * @cipher: cipher suite selector
71641ade00fSJohannes Berg  * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used
71741ade00fSJohannes Berg  *	with the get_key() callback, must be in little endian,
71841ade00fSJohannes Berg  *	length given by @seq_len.
719abe37c4bSJohannes Berg  * @seq_len: length of @seq.
72014f34e36SGurumoorthi Gnanasambandhan  * @vlan_id: vlan_id for VLAN group key (if nonzero)
7216cdd3979SAlexander Wetzel  * @mode: key install mode (RX_TX, NO_TX or SET_TX)
72241ade00fSJohannes Berg  */
72341ade00fSJohannes Berg struct key_params {
724c1e5f471SJohannes Berg 	const u8 *key;
725c1e5f471SJohannes Berg 	const u8 *seq;
72641ade00fSJohannes Berg 	int key_len;
72741ade00fSJohannes Berg 	int seq_len;
72814f34e36SGurumoorthi Gnanasambandhan 	u16 vlan_id;
72941ade00fSJohannes Berg 	u32 cipher;
7306cdd3979SAlexander Wetzel 	enum nl80211_key_mode mode;
73141ade00fSJohannes Berg };
73241ade00fSJohannes Berg 
733ed1b6cc7SJohannes Berg /**
734683b6d3bSJohannes Berg  * struct cfg80211_chan_def - channel definition
735683b6d3bSJohannes Berg  * @chan: the (control) channel
7363d9d1d66SJohannes Berg  * @width: channel width
7373d9d1d66SJohannes Berg  * @center_freq1: center frequency of first segment
7383d9d1d66SJohannes Berg  * @center_freq2: center frequency of second segment
7393d9d1d66SJohannes Berg  *	(only with 80+80 MHz)
7402a38075cSAlexei Avshalom Lazar  * @edmg: define the EDMG channels configuration.
7412a38075cSAlexei Avshalom Lazar  *	If edmg is requested (i.e. the .channels member is non-zero),
7422a38075cSAlexei Avshalom Lazar  *	chan will define the primary channel and all other
7432a38075cSAlexei Avshalom Lazar  *	parameters are ignored.
744934f4c7dSThomas Pedersen  * @freq1_offset: offset from @center_freq1, in KHz
745683b6d3bSJohannes Berg  */
746683b6d3bSJohannes Berg struct cfg80211_chan_def {
747683b6d3bSJohannes Berg 	struct ieee80211_channel *chan;
7483d9d1d66SJohannes Berg 	enum nl80211_chan_width width;
7493d9d1d66SJohannes Berg 	u32 center_freq1;
7503d9d1d66SJohannes Berg 	u32 center_freq2;
7512a38075cSAlexei Avshalom Lazar 	struct ieee80211_edmg edmg;
752934f4c7dSThomas Pedersen 	u16 freq1_offset;
753683b6d3bSJohannes Berg };
754683b6d3bSJohannes Berg 
7559a5f6488STamizh Chelvam /*
7569a5f6488STamizh Chelvam  * cfg80211_bitrate_mask - masks for bitrate control
7579a5f6488STamizh Chelvam  */
7589a5f6488STamizh Chelvam struct cfg80211_bitrate_mask {
7599a5f6488STamizh Chelvam 	struct {
7609a5f6488STamizh Chelvam 		u32 legacy;
7619a5f6488STamizh Chelvam 		u8 ht_mcs[IEEE80211_HT_MCS_MASK_LEN];
7629a5f6488STamizh Chelvam 		u16 vht_mcs[NL80211_VHT_NSS_MAX];
763eb89a6a6SMiles Hu 		u16 he_mcs[NL80211_HE_NSS_MAX];
7649a5f6488STamizh Chelvam 		enum nl80211_txrate_gi gi;
765eb89a6a6SMiles Hu 		enum nl80211_he_gi he_gi;
766eb89a6a6SMiles Hu 		enum nl80211_he_ltf he_ltf;
7679a5f6488STamizh Chelvam 	} control[NUM_NL80211_BANDS];
7689a5f6488STamizh Chelvam };
7699a5f6488STamizh Chelvam 
7709a5f6488STamizh Chelvam 
77177f576deSTamizh chelvam /**
7723710a8a6SJohannes Berg  * struct cfg80211_tid_cfg - TID specific configuration
77377f576deSTamizh chelvam  * @config_override: Flag to notify driver to reset TID configuration
77477f576deSTamizh chelvam  *	of the peer.
7753710a8a6SJohannes Berg  * @tids: bitmap of TIDs to modify
7763710a8a6SJohannes Berg  * @mask: bitmap of attributes indicating which parameter changed,
7773710a8a6SJohannes Berg  *	similar to &nl80211_tid_config_supp.
77877f576deSTamizh chelvam  * @noack: noack configuration value for the TID
7796a21d16cSTamizh chelvam  * @retry_long: retry count value
7806a21d16cSTamizh chelvam  * @retry_short: retry count value
78133462e68SSergey Matyukevich  * @ampdu: Enable/Disable MPDU aggregation
78204f7d142STamizh chelvam  * @rtscts: Enable/Disable RTS/CTS
78333462e68SSergey Matyukevich  * @amsdu: Enable/Disable MSDU aggregation
7849a5f6488STamizh Chelvam  * @txrate_type: Tx bitrate mask type
7859a5f6488STamizh Chelvam  * @txrate_mask: Tx bitrate to be applied for the TID
78677f576deSTamizh chelvam  */
7873710a8a6SJohannes Berg struct cfg80211_tid_cfg {
78877f576deSTamizh chelvam 	bool config_override;
7893710a8a6SJohannes Berg 	u8 tids;
7902d5d9b7fSSergey Matyukevich 	u64 mask;
79177f576deSTamizh chelvam 	enum nl80211_tid_config noack;
7926a21d16cSTamizh chelvam 	u8 retry_long, retry_short;
793ade274b2STamizh chelvam 	enum nl80211_tid_config ampdu;
79404f7d142STamizh chelvam 	enum nl80211_tid_config rtscts;
79533462e68SSergey Matyukevich 	enum nl80211_tid_config amsdu;
7969a5f6488STamizh Chelvam 	enum nl80211_tx_rate_setting txrate_type;
7979a5f6488STamizh Chelvam 	struct cfg80211_bitrate_mask txrate_mask;
79877f576deSTamizh chelvam };
79977f576deSTamizh chelvam 
80077f576deSTamizh chelvam /**
8013710a8a6SJohannes Berg  * struct cfg80211_tid_config - TID configuration
80277f576deSTamizh chelvam  * @peer: Station's MAC address
80377f576deSTamizh chelvam  * @n_tid_conf: Number of TID specific configurations to be applied
80477f576deSTamizh chelvam  * @tid_conf: Configuration change info
80577f576deSTamizh chelvam  */
8063710a8a6SJohannes Berg struct cfg80211_tid_config {
80777f576deSTamizh chelvam 	const u8 *peer;
80877f576deSTamizh chelvam 	u32 n_tid_conf;
8093710a8a6SJohannes Berg 	struct cfg80211_tid_cfg tid_conf[];
81077f576deSTamizh chelvam };
81177f576deSTamizh chelvam 
8123d9d1d66SJohannes Berg /**
813e306784aSSubrat Mishra  * struct cfg80211_fils_aad - FILS AAD data
814e306784aSSubrat Mishra  * @macaddr: STA MAC address
815e306784aSSubrat Mishra  * @kek: FILS KEK
816e306784aSSubrat Mishra  * @kek_len: FILS KEK length
817e306784aSSubrat Mishra  * @snonce: STA Nonce
818e306784aSSubrat Mishra  * @anonce: AP Nonce
819e306784aSSubrat Mishra  */
820e306784aSSubrat Mishra struct cfg80211_fils_aad {
821e306784aSSubrat Mishra 	const u8 *macaddr;
822e306784aSSubrat Mishra 	const u8 *kek;
823e306784aSSubrat Mishra 	u8 kek_len;
824e306784aSSubrat Mishra 	const u8 *snonce;
825e306784aSSubrat Mishra 	const u8 *anonce;
826e306784aSSubrat Mishra };
827e306784aSSubrat Mishra 
828e306784aSSubrat Mishra /**
8293d9d1d66SJohannes Berg  * cfg80211_get_chandef_type - return old channel type from chandef
8303d9d1d66SJohannes Berg  * @chandef: the channel definition
8313d9d1d66SJohannes Berg  *
8320ae997dcSYacine Belkadi  * Return: The old channel type (NOHT, HT20, HT40+/-) from a given
8333d9d1d66SJohannes Berg  * chandef, which must have a bandwidth allowing this conversion.
8343d9d1d66SJohannes Berg  */
835683b6d3bSJohannes Berg static inline enum nl80211_channel_type
836683b6d3bSJohannes Berg cfg80211_get_chandef_type(const struct cfg80211_chan_def *chandef)
837683b6d3bSJohannes Berg {
8383d9d1d66SJohannes Berg 	switch (chandef->width) {
8393d9d1d66SJohannes Berg 	case NL80211_CHAN_WIDTH_20_NOHT:
8403d9d1d66SJohannes Berg 		return NL80211_CHAN_NO_HT;
8413d9d1d66SJohannes Berg 	case NL80211_CHAN_WIDTH_20:
8423d9d1d66SJohannes Berg 		return NL80211_CHAN_HT20;
8433d9d1d66SJohannes Berg 	case NL80211_CHAN_WIDTH_40:
8443d9d1d66SJohannes Berg 		if (chandef->center_freq1 > chandef->chan->center_freq)
8453d9d1d66SJohannes Berg 			return NL80211_CHAN_HT40PLUS;
8463d9d1d66SJohannes Berg 		return NL80211_CHAN_HT40MINUS;
8473d9d1d66SJohannes Berg 	default:
8483d9d1d66SJohannes Berg 		WARN_ON(1);
8493d9d1d66SJohannes Berg 		return NL80211_CHAN_NO_HT;
850683b6d3bSJohannes Berg 	}
8513d9d1d66SJohannes Berg }
8523d9d1d66SJohannes Berg 
8533d9d1d66SJohannes Berg /**
8543d9d1d66SJohannes Berg  * cfg80211_chandef_create - create channel definition using channel type
8553d9d1d66SJohannes Berg  * @chandef: the channel definition struct to fill
8563d9d1d66SJohannes Berg  * @channel: the control channel
8573d9d1d66SJohannes Berg  * @chantype: the channel type
8583d9d1d66SJohannes Berg  *
8593d9d1d66SJohannes Berg  * Given a channel type, create a channel definition.
8603d9d1d66SJohannes Berg  */
8613d9d1d66SJohannes Berg void cfg80211_chandef_create(struct cfg80211_chan_def *chandef,
8623d9d1d66SJohannes Berg 			     struct ieee80211_channel *channel,
8633d9d1d66SJohannes Berg 			     enum nl80211_channel_type chantype);
8643d9d1d66SJohannes Berg 
8653d9d1d66SJohannes Berg /**
8663d9d1d66SJohannes Berg  * cfg80211_chandef_identical - check if two channel definitions are identical
8673d9d1d66SJohannes Berg  * @chandef1: first channel definition
8683d9d1d66SJohannes Berg  * @chandef2: second channel definition
8693d9d1d66SJohannes Berg  *
8700ae997dcSYacine Belkadi  * Return: %true if the channels defined by the channel definitions are
8713d9d1d66SJohannes Berg  * identical, %false otherwise.
8723d9d1d66SJohannes Berg  */
8733d9d1d66SJohannes Berg static inline bool
8743d9d1d66SJohannes Berg cfg80211_chandef_identical(const struct cfg80211_chan_def *chandef1,
8753d9d1d66SJohannes Berg 			   const struct cfg80211_chan_def *chandef2)
8763d9d1d66SJohannes Berg {
8773d9d1d66SJohannes Berg 	return (chandef1->chan == chandef2->chan &&
8783d9d1d66SJohannes Berg 		chandef1->width == chandef2->width &&
8793d9d1d66SJohannes Berg 		chandef1->center_freq1 == chandef2->center_freq1 &&
880934f4c7dSThomas Pedersen 		chandef1->freq1_offset == chandef2->freq1_offset &&
8813d9d1d66SJohannes Berg 		chandef1->center_freq2 == chandef2->center_freq2);
8823d9d1d66SJohannes Berg }
8833d9d1d66SJohannes Berg 
8843d9d1d66SJohannes Berg /**
8852a38075cSAlexei Avshalom Lazar  * cfg80211_chandef_is_edmg - check if chandef represents an EDMG channel
8862a38075cSAlexei Avshalom Lazar  *
8872a38075cSAlexei Avshalom Lazar  * @chandef: the channel definition
8882a38075cSAlexei Avshalom Lazar  *
8892a38075cSAlexei Avshalom Lazar  * Return: %true if EDMG defined, %false otherwise.
8902a38075cSAlexei Avshalom Lazar  */
8912a38075cSAlexei Avshalom Lazar static inline bool
8922a38075cSAlexei Avshalom Lazar cfg80211_chandef_is_edmg(const struct cfg80211_chan_def *chandef)
8932a38075cSAlexei Avshalom Lazar {
8942a38075cSAlexei Avshalom Lazar 	return chandef->edmg.channels || chandef->edmg.bw_config;
8952a38075cSAlexei Avshalom Lazar }
8962a38075cSAlexei Avshalom Lazar 
8972a38075cSAlexei Avshalom Lazar /**
8983d9d1d66SJohannes Berg  * cfg80211_chandef_compatible - check if two channel definitions are compatible
8993d9d1d66SJohannes Berg  * @chandef1: first channel definition
9003d9d1d66SJohannes Berg  * @chandef2: second channel definition
9013d9d1d66SJohannes Berg  *
9020ae997dcSYacine Belkadi  * Return: %NULL if the given channel definitions are incompatible,
9033d9d1d66SJohannes Berg  * chandef1 or chandef2 otherwise.
9043d9d1d66SJohannes Berg  */
9053d9d1d66SJohannes Berg const struct cfg80211_chan_def *
9063d9d1d66SJohannes Berg cfg80211_chandef_compatible(const struct cfg80211_chan_def *chandef1,
9073d9d1d66SJohannes Berg 			    const struct cfg80211_chan_def *chandef2);
908683b6d3bSJohannes Berg 
909683b6d3bSJohannes Berg /**
9109f5e8f6eSJohannes Berg  * cfg80211_chandef_valid - check if a channel definition is valid
9119f5e8f6eSJohannes Berg  * @chandef: the channel definition to check
9120ae997dcSYacine Belkadi  * Return: %true if the channel definition is valid. %false otherwise.
9139f5e8f6eSJohannes Berg  */
9149f5e8f6eSJohannes Berg bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef);
9159f5e8f6eSJohannes Berg 
9169f5e8f6eSJohannes Berg /**
9179f5e8f6eSJohannes Berg  * cfg80211_chandef_usable - check if secondary channels can be used
9189f5e8f6eSJohannes Berg  * @wiphy: the wiphy to validate against
9199f5e8f6eSJohannes Berg  * @chandef: the channel definition to check
9200ae997dcSYacine Belkadi  * @prohibited_flags: the regulatory channel flags that must not be set
9210ae997dcSYacine Belkadi  * Return: %true if secondary channels are usable. %false otherwise.
9229f5e8f6eSJohannes Berg  */
9239f5e8f6eSJohannes Berg bool cfg80211_chandef_usable(struct wiphy *wiphy,
9249f5e8f6eSJohannes Berg 			     const struct cfg80211_chan_def *chandef,
9259f5e8f6eSJohannes Berg 			     u32 prohibited_flags);
9269f5e8f6eSJohannes Berg 
9279f5e8f6eSJohannes Berg /**
928774f0734SSimon Wunderlich  * cfg80211_chandef_dfs_required - checks if radar detection is required
929774f0734SSimon Wunderlich  * @wiphy: the wiphy to validate against
930774f0734SSimon Wunderlich  * @chandef: the channel definition to check
9312beb6dabSLuciano Coelho  * @iftype: the interface type as specified in &enum nl80211_iftype
9322beb6dabSLuciano Coelho  * Returns:
9332beb6dabSLuciano Coelho  *	1 if radar detection is required, 0 if it is not, < 0 on error
934774f0734SSimon Wunderlich  */
935774f0734SSimon Wunderlich int cfg80211_chandef_dfs_required(struct wiphy *wiphy,
9362beb6dabSLuciano Coelho 				  const struct cfg80211_chan_def *chandef,
937c3d62036SLuciano Coelho 				  enum nl80211_iftype iftype);
938774f0734SSimon Wunderlich 
939774f0734SSimon Wunderlich /**
94030e74732SSimon Wunderlich  * ieee80211_chandef_rate_flags - returns rate flags for a channel
94130e74732SSimon Wunderlich  *
94230e74732SSimon Wunderlich  * In some channel types, not all rates may be used - for example CCK
94330e74732SSimon Wunderlich  * rates may not be used in 5/10 MHz channels.
94430e74732SSimon Wunderlich  *
94530e74732SSimon Wunderlich  * @chandef: channel definition for the channel
94630e74732SSimon Wunderlich  *
94730e74732SSimon Wunderlich  * Returns: rate flags which apply for this channel
94830e74732SSimon Wunderlich  */
94930e74732SSimon Wunderlich static inline enum ieee80211_rate_flags
95030e74732SSimon Wunderlich ieee80211_chandef_rate_flags(struct cfg80211_chan_def *chandef)
95130e74732SSimon Wunderlich {
95230e74732SSimon Wunderlich 	switch (chandef->width) {
95330e74732SSimon Wunderlich 	case NL80211_CHAN_WIDTH_5:
95430e74732SSimon Wunderlich 		return IEEE80211_RATE_SUPPORTS_5MHZ;
95530e74732SSimon Wunderlich 	case NL80211_CHAN_WIDTH_10:
95630e74732SSimon Wunderlich 		return IEEE80211_RATE_SUPPORTS_10MHZ;
95730e74732SSimon Wunderlich 	default:
95830e74732SSimon Wunderlich 		break;
95930e74732SSimon Wunderlich 	}
96030e74732SSimon Wunderlich 	return 0;
96130e74732SSimon Wunderlich }
96230e74732SSimon Wunderlich 
96330e74732SSimon Wunderlich /**
9640430c883SSimon Wunderlich  * ieee80211_chandef_max_power - maximum transmission power for the chandef
9650430c883SSimon Wunderlich  *
9660430c883SSimon Wunderlich  * In some regulations, the transmit power may depend on the configured channel
9670430c883SSimon Wunderlich  * bandwidth which may be defined as dBm/MHz. This function returns the actual
9680430c883SSimon Wunderlich  * max_power for non-standard (20 MHz) channels.
9690430c883SSimon Wunderlich  *
9700430c883SSimon Wunderlich  * @chandef: channel definition for the channel
9710430c883SSimon Wunderlich  *
9720430c883SSimon Wunderlich  * Returns: maximum allowed transmission power in dBm for the chandef
9730430c883SSimon Wunderlich  */
9740430c883SSimon Wunderlich static inline int
9750430c883SSimon Wunderlich ieee80211_chandef_max_power(struct cfg80211_chan_def *chandef)
9760430c883SSimon Wunderlich {
9770430c883SSimon Wunderlich 	switch (chandef->width) {
9780430c883SSimon Wunderlich 	case NL80211_CHAN_WIDTH_5:
9790430c883SSimon Wunderlich 		return min(chandef->chan->max_reg_power - 6,
9800430c883SSimon Wunderlich 			   chandef->chan->max_power);
9810430c883SSimon Wunderlich 	case NL80211_CHAN_WIDTH_10:
9820430c883SSimon Wunderlich 		return min(chandef->chan->max_reg_power - 3,
9830430c883SSimon Wunderlich 			   chandef->chan->max_power);
9840430c883SSimon Wunderlich 	default:
9850430c883SSimon Wunderlich 		break;
9860430c883SSimon Wunderlich 	}
9870430c883SSimon Wunderlich 	return chandef->chan->max_power;
9880430c883SSimon Wunderlich }
9890430c883SSimon Wunderlich 
9900430c883SSimon Wunderlich /**
991be989891SJohannes Berg  * cfg80211_any_usable_channels - check for usable channels
992be989891SJohannes Berg  * @wiphy: the wiphy to check for
993be989891SJohannes Berg  * @band_mask: which bands to check on
994be989891SJohannes Berg  * @prohibited_flags: which channels to not consider usable,
995be989891SJohannes Berg  *	%IEEE80211_CHAN_DISABLED is always taken into account
996be989891SJohannes Berg  */
997be989891SJohannes Berg bool cfg80211_any_usable_channels(struct wiphy *wiphy,
998be989891SJohannes Berg 				  unsigned long band_mask,
999be989891SJohannes Berg 				  u32 prohibited_flags);
1000be989891SJohannes Berg 
1001be989891SJohannes Berg /**
100261fa713cSHolger Schurig  * enum survey_info_flags - survey information flags
100361fa713cSHolger Schurig  *
1004abe37c4bSJohannes Berg  * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in
100517e5a808SFelix Fietkau  * @SURVEY_INFO_IN_USE: channel is currently being used
10064ed20bebSJohannes Berg  * @SURVEY_INFO_TIME: active time (in ms) was filled in
10074ed20bebSJohannes Berg  * @SURVEY_INFO_TIME_BUSY: busy time was filled in
10084ed20bebSJohannes Berg  * @SURVEY_INFO_TIME_EXT_BUSY: extension channel busy time was filled in
10094ed20bebSJohannes Berg  * @SURVEY_INFO_TIME_RX: receive time was filled in
10104ed20bebSJohannes Berg  * @SURVEY_INFO_TIME_TX: transmit time was filled in
1011052536abSJohannes Berg  * @SURVEY_INFO_TIME_SCAN: scan time was filled in
1012c8cd6e7fSFelix Fietkau  * @SURVEY_INFO_TIME_BSS_RX: local BSS receive time was filled in
1013abe37c4bSJohannes Berg  *
101461fa713cSHolger Schurig  * Used by the driver to indicate which info in &struct survey_info
101561fa713cSHolger Schurig  * it has filled in during the get_survey().
101661fa713cSHolger Schurig  */
101761fa713cSHolger Schurig enum survey_info_flags {
10184ed20bebSJohannes Berg 	SURVEY_INFO_NOISE_DBM		= BIT(0),
10194ed20bebSJohannes Berg 	SURVEY_INFO_IN_USE		= BIT(1),
10204ed20bebSJohannes Berg 	SURVEY_INFO_TIME		= BIT(2),
10214ed20bebSJohannes Berg 	SURVEY_INFO_TIME_BUSY		= BIT(3),
10224ed20bebSJohannes Berg 	SURVEY_INFO_TIME_EXT_BUSY	= BIT(4),
10234ed20bebSJohannes Berg 	SURVEY_INFO_TIME_RX		= BIT(5),
10244ed20bebSJohannes Berg 	SURVEY_INFO_TIME_TX		= BIT(6),
1025052536abSJohannes Berg 	SURVEY_INFO_TIME_SCAN		= BIT(7),
1026c8cd6e7fSFelix Fietkau 	SURVEY_INFO_TIME_BSS_RX		= BIT(8),
102761fa713cSHolger Schurig };
102861fa713cSHolger Schurig 
102961fa713cSHolger Schurig /**
103061fa713cSHolger Schurig  * struct survey_info - channel survey response
103161fa713cSHolger Schurig  *
103211f78ac3SJohannes Berg  * @channel: the channel this survey record reports, may be %NULL for a single
103311f78ac3SJohannes Berg  *	record to report global statistics
103461fa713cSHolger Schurig  * @filled: bitflag of flags from &enum survey_info_flags
103561fa713cSHolger Schurig  * @noise: channel noise in dBm. This and all following fields are
103661fa713cSHolger Schurig  *	optional
10374ed20bebSJohannes Berg  * @time: amount of time in ms the radio was turn on (on the channel)
10384ed20bebSJohannes Berg  * @time_busy: amount of time the primary channel was sensed busy
10394ed20bebSJohannes Berg  * @time_ext_busy: amount of time the extension channel was sensed busy
10404ed20bebSJohannes Berg  * @time_rx: amount of time the radio spent receiving data
10414ed20bebSJohannes Berg  * @time_tx: amount of time the radio spent transmitting data
1042052536abSJohannes Berg  * @time_scan: amount of time the radio spent for scanning
1043c8cd6e7fSFelix Fietkau  * @time_bss_rx: amount of time the radio spent receiving data on a local BSS
104461fa713cSHolger Schurig  *
1045abe37c4bSJohannes Berg  * Used by dump_survey() to report back per-channel survey information.
1046abe37c4bSJohannes Berg  *
104761fa713cSHolger Schurig  * This structure can later be expanded with things like
104861fa713cSHolger Schurig  * channel duty cycle etc.
104961fa713cSHolger Schurig  */
105061fa713cSHolger Schurig struct survey_info {
105161fa713cSHolger Schurig 	struct ieee80211_channel *channel;
10524ed20bebSJohannes Berg 	u64 time;
10534ed20bebSJohannes Berg 	u64 time_busy;
10544ed20bebSJohannes Berg 	u64 time_ext_busy;
10554ed20bebSJohannes Berg 	u64 time_rx;
10564ed20bebSJohannes Berg 	u64 time_tx;
1057052536abSJohannes Berg 	u64 time_scan;
1058c8cd6e7fSFelix Fietkau 	u64 time_bss_rx;
105961fa713cSHolger Schurig 	u32 filled;
106061fa713cSHolger Schurig 	s8 noise;
106161fa713cSHolger Schurig };
106261fa713cSHolger Schurig 
1063b8676221SDavid Spinadel #define CFG80211_MAX_WEP_KEYS	4
1064b8676221SDavid Spinadel 
106561fa713cSHolger Schurig /**
10665fb628e9SJouni Malinen  * struct cfg80211_crypto_settings - Crypto settings
10675fb628e9SJouni Malinen  * @wpa_versions: indicates which, if any, WPA versions are enabled
10685fb628e9SJouni Malinen  *	(from enum nl80211_wpa_versions)
10695fb628e9SJouni Malinen  * @cipher_group: group key cipher suite (or 0 if unset)
10705fb628e9SJouni Malinen  * @n_ciphers_pairwise: number of AP supported unicast ciphers
10715fb628e9SJouni Malinen  * @ciphers_pairwise: unicast key cipher suites
10725fb628e9SJouni Malinen  * @n_akm_suites: number of AKM suites
10735fb628e9SJouni Malinen  * @akm_suites: AKM suites
10745fb628e9SJouni Malinen  * @control_port: Whether user space controls IEEE 802.1X port, i.e.,
10755fb628e9SJouni Malinen  *	sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
10765fb628e9SJouni Malinen  *	required to assume that the port is unauthorized until authorized by
10775fb628e9SJouni Malinen  *	user space. Otherwise, port is marked authorized by default.
10785fb628e9SJouni Malinen  * @control_port_ethertype: the control port protocol that should be
10795fb628e9SJouni Malinen  *	allowed through even on unauthorized ports
10805fb628e9SJouni Malinen  * @control_port_no_encrypt: TRUE to prevent encryption of control port
10815fb628e9SJouni Malinen  *	protocol frames.
108264bf3d4bSDenis Kenzior  * @control_port_over_nl80211: TRUE if userspace expects to exchange control
108364bf3d4bSDenis Kenzior  *	port frames over NL80211 instead of the network interface.
1084a710d214SLothar Rubusch  * @control_port_no_preauth: disables pre-auth rx over the nl80211 control
1085a710d214SLothar Rubusch  *	port for mac80211
1086b8676221SDavid Spinadel  * @wep_keys: static WEP keys, if not NULL points to an array of
1087b8676221SDavid Spinadel  *	CFG80211_MAX_WEP_KEYS WEP keys
1088b8676221SDavid Spinadel  * @wep_tx_key: key index (0..3) of the default TX static WEP key
108991b5ab62SEliad Peller  * @psk: PSK (for devices supporting 4-way-handshake offload)
109026f7044eSChung-Hsien Hsu  * @sae_pwd: password for SAE authentication (for devices supporting SAE
109126f7044eSChung-Hsien Hsu  *	offload)
109226f7044eSChung-Hsien Hsu  * @sae_pwd_len: length of SAE password (for devices supporting SAE offload)
1093da1e9dd3SJohannes Berg  * @sae_pwe: The mechanisms allowed for SAE PWE derivation:
1094da1e9dd3SJohannes Berg  *
1095da1e9dd3SJohannes Berg  *	NL80211_SAE_PWE_UNSPECIFIED
1096da1e9dd3SJohannes Berg  *	  Not-specified, used to indicate userspace did not specify any
1097da1e9dd3SJohannes Berg  *	  preference. The driver should follow its internal policy in
1098da1e9dd3SJohannes Berg  *	  such a scenario.
1099da1e9dd3SJohannes Berg  *
1100da1e9dd3SJohannes Berg  *	NL80211_SAE_PWE_HUNT_AND_PECK
1101da1e9dd3SJohannes Berg  *	  Allow hunting-and-pecking loop only
1102da1e9dd3SJohannes Berg  *
1103da1e9dd3SJohannes Berg  *	NL80211_SAE_PWE_HASH_TO_ELEMENT
1104da1e9dd3SJohannes Berg  *	  Allow hash-to-element only
1105da1e9dd3SJohannes Berg  *
1106da1e9dd3SJohannes Berg  *	NL80211_SAE_PWE_BOTH
1107da1e9dd3SJohannes Berg  *	  Allow either hunting-and-pecking loop or hash-to-element
11085fb628e9SJouni Malinen  */
11095fb628e9SJouni Malinen struct cfg80211_crypto_settings {
11105fb628e9SJouni Malinen 	u32 wpa_versions;
11115fb628e9SJouni Malinen 	u32 cipher_group;
11125fb628e9SJouni Malinen 	int n_ciphers_pairwise;
11135fb628e9SJouni Malinen 	u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES];
11145fb628e9SJouni Malinen 	int n_akm_suites;
11155fb628e9SJouni Malinen 	u32 akm_suites[NL80211_MAX_NR_AKM_SUITES];
11165fb628e9SJouni Malinen 	bool control_port;
11175fb628e9SJouni Malinen 	__be16 control_port_ethertype;
11185fb628e9SJouni Malinen 	bool control_port_no_encrypt;
111964bf3d4bSDenis Kenzior 	bool control_port_over_nl80211;
11207f3f96ceSMarkus Theil 	bool control_port_no_preauth;
1121b8676221SDavid Spinadel 	struct key_params *wep_keys;
1122b8676221SDavid Spinadel 	int wep_tx_key;
112391b5ab62SEliad Peller 	const u8 *psk;
112426f7044eSChung-Hsien Hsu 	const u8 *sae_pwd;
112526f7044eSChung-Hsien Hsu 	u8 sae_pwd_len;
11269f0ffa41SRohan Dutta 	enum nl80211_sae_pwe_mechanism sae_pwe;
11275fb628e9SJouni Malinen };
11285fb628e9SJouni Malinen 
11295fb628e9SJouni Malinen /**
1130dc1e3cb8SJohn Crispin  * struct cfg80211_mbssid_config - AP settings for multi bssid
1131dc1e3cb8SJohn Crispin  *
1132dc1e3cb8SJohn Crispin  * @tx_wdev: pointer to the transmitted interface in the MBSSID set
1133dc1e3cb8SJohn Crispin  * @index: index of this AP in the multi bssid group.
1134dc1e3cb8SJohn Crispin  * @ema: set to true if the beacons should be sent out in EMA mode.
1135dc1e3cb8SJohn Crispin  */
1136dc1e3cb8SJohn Crispin struct cfg80211_mbssid_config {
1137dc1e3cb8SJohn Crispin 	struct wireless_dev *tx_wdev;
1138dc1e3cb8SJohn Crispin 	u8 index;
1139dc1e3cb8SJohn Crispin 	bool ema;
1140dc1e3cb8SJohn Crispin };
1141dc1e3cb8SJohn Crispin 
1142dc1e3cb8SJohn Crispin /**
1143dc1e3cb8SJohn Crispin  * struct cfg80211_mbssid_elems - Multiple BSSID elements
1144dc1e3cb8SJohn Crispin  *
1145dc1e3cb8SJohn Crispin  * @cnt: Number of elements in array %elems.
1146dc1e3cb8SJohn Crispin  *
1147dc1e3cb8SJohn Crispin  * @elem: Array of multiple BSSID element(s) to be added into Beacon frames.
1148dc1e3cb8SJohn Crispin  * @elem.data: Data for multiple BSSID elements.
1149dc1e3cb8SJohn Crispin  * @elem.len: Length of data.
1150dc1e3cb8SJohn Crispin  */
1151dc1e3cb8SJohn Crispin struct cfg80211_mbssid_elems {
1152dc1e3cb8SJohn Crispin 	u8 cnt;
1153dc1e3cb8SJohn Crispin 	struct {
1154dc1e3cb8SJohn Crispin 		const u8 *data;
1155dc1e3cb8SJohn Crispin 		size_t len;
1156dc1e3cb8SJohn Crispin 	} elem[];
1157dc1e3cb8SJohn Crispin };
1158dc1e3cb8SJohn Crispin 
1159dc1e3cb8SJohn Crispin /**
11608860020eSJohannes Berg  * struct cfg80211_beacon_data - beacon data
11617b0a0e3cSJohannes Berg  * @link_id: the link ID for the AP MLD link sending this beacon
1162ed1b6cc7SJohannes Berg  * @head: head portion of beacon (before TIM IE)
1163ed1b6cc7SJohannes Berg  *	or %NULL if not changed
1164ed1b6cc7SJohannes Berg  * @tail: tail portion of beacon (after TIM IE)
1165ed1b6cc7SJohannes Berg  *	or %NULL if not changed
1166ed1b6cc7SJohannes Berg  * @head_len: length of @head
1167ed1b6cc7SJohannes Berg  * @tail_len: length of @tail
11689946ecfbSJouni Malinen  * @beacon_ies: extra information element(s) to add into Beacon frames or %NULL
11699946ecfbSJouni Malinen  * @beacon_ies_len: length of beacon_ies in octets
11709946ecfbSJouni Malinen  * @proberesp_ies: extra information element(s) to add into Probe Response
11719946ecfbSJouni Malinen  *	frames or %NULL
11729946ecfbSJouni Malinen  * @proberesp_ies_len: length of proberesp_ies in octets
11739946ecfbSJouni Malinen  * @assocresp_ies: extra information element(s) to add into (Re)Association
11749946ecfbSJouni Malinen  *	Response frames or %NULL
11759946ecfbSJouni Malinen  * @assocresp_ies_len: length of assocresp_ies in octets
117600f740e1SArik Nemtsov  * @probe_resp_len: length of probe response template (@probe_resp)
117700f740e1SArik Nemtsov  * @probe_resp: probe response template (AP mode only)
1178dc1e3cb8SJohn Crispin  * @mbssid_ies: multiple BSSID elements
117981e54d08SPradeep Kumar Chitrapu  * @ftm_responder: enable FTM responder functionality; -1 for no change
118081e54d08SPradeep Kumar Chitrapu  *	(which also implies no change in LCI/civic location data)
118130db641eSJohannes Berg  * @lci: Measurement Report element content, starting with Measurement Token
118230db641eSJohannes Berg  *	(measurement type 8)
118330db641eSJohannes Berg  * @civicloc: Measurement Report element content, starting with Measurement
118430db641eSJohannes Berg  *	Token (measurement type 11)
118581e54d08SPradeep Kumar Chitrapu  * @lci_len: LCI data length
118681e54d08SPradeep Kumar Chitrapu  * @civicloc_len: Civic location data length
11873d48cb74SRameshkumar Sundaram  * @he_bss_color: BSS Color settings
11883d48cb74SRameshkumar Sundaram  * @he_bss_color_valid: indicates whether bss color
1189ee0e2f51SJohannes Berg  *	attribute is present in beacon data or not.
1190ed1b6cc7SJohannes Berg  */
11918860020eSJohannes Berg struct cfg80211_beacon_data {
11927b0a0e3cSJohannes Berg 	unsigned int link_id;
11937b0a0e3cSJohannes Berg 
11948860020eSJohannes Berg 	const u8 *head, *tail;
11958860020eSJohannes Berg 	const u8 *beacon_ies;
11968860020eSJohannes Berg 	const u8 *proberesp_ies;
11978860020eSJohannes Berg 	const u8 *assocresp_ies;
11988860020eSJohannes Berg 	const u8 *probe_resp;
119981e54d08SPradeep Kumar Chitrapu 	const u8 *lci;
120081e54d08SPradeep Kumar Chitrapu 	const u8 *civicloc;
1201dc1e3cb8SJohn Crispin 	struct cfg80211_mbssid_elems *mbssid_ies;
120281e54d08SPradeep Kumar Chitrapu 	s8 ftm_responder;
12038860020eSJohannes Berg 
12048860020eSJohannes Berg 	size_t head_len, tail_len;
12058860020eSJohannes Berg 	size_t beacon_ies_len;
12068860020eSJohannes Berg 	size_t proberesp_ies_len;
12078860020eSJohannes Berg 	size_t assocresp_ies_len;
12088860020eSJohannes Berg 	size_t probe_resp_len;
120981e54d08SPradeep Kumar Chitrapu 	size_t lci_len;
121081e54d08SPradeep Kumar Chitrapu 	size_t civicloc_len;
12113d48cb74SRameshkumar Sundaram 	struct cfg80211_he_bss_color he_bss_color;
12123d48cb74SRameshkumar Sundaram 	bool he_bss_color_valid;
12138860020eSJohannes Berg };
12148860020eSJohannes Berg 
12156d45a74bSVasanthakumar Thiagarajan struct mac_address {
12166d45a74bSVasanthakumar Thiagarajan 	u8 addr[ETH_ALEN];
12176d45a74bSVasanthakumar Thiagarajan };
12186d45a74bSVasanthakumar Thiagarajan 
12198860020eSJohannes Berg /**
122077765eafSVasanthakumar Thiagarajan  * struct cfg80211_acl_data - Access control list data
122177765eafSVasanthakumar Thiagarajan  *
122277765eafSVasanthakumar Thiagarajan  * @acl_policy: ACL policy to be applied on the station's
1223077f897aSJohannes Berg  *	entry specified by mac_addr
122477765eafSVasanthakumar Thiagarajan  * @n_acl_entries: Number of MAC address entries passed
122577765eafSVasanthakumar Thiagarajan  * @mac_addrs: List of MAC addresses of stations to be used for ACL
122677765eafSVasanthakumar Thiagarajan  */
122777765eafSVasanthakumar Thiagarajan struct cfg80211_acl_data {
122877765eafSVasanthakumar Thiagarajan 	enum nl80211_acl_policy acl_policy;
122977765eafSVasanthakumar Thiagarajan 	int n_acl_entries;
123077765eafSVasanthakumar Thiagarajan 
123177765eafSVasanthakumar Thiagarajan 	/* Keep it last */
123277765eafSVasanthakumar Thiagarajan 	struct mac_address mac_addrs[];
123377765eafSVasanthakumar Thiagarajan };
123477765eafSVasanthakumar Thiagarajan 
12358860020eSJohannes Berg /**
1236291c49deSAloka Dixit  * struct cfg80211_fils_discovery - FILS discovery parameters from
1237291c49deSAloka Dixit  * IEEE Std 802.11ai-2016, Annex C.3 MIB detail.
1238291c49deSAloka Dixit  *
1239291c49deSAloka Dixit  * @min_interval: Minimum packet interval in TUs (0 - 10000)
1240291c49deSAloka Dixit  * @max_interval: Maximum packet interval in TUs (0 - 10000)
1241291c49deSAloka Dixit  * @tmpl_len: Template length
1242291c49deSAloka Dixit  * @tmpl: Template data for FILS discovery frame including the action
1243291c49deSAloka Dixit  *	frame headers.
1244291c49deSAloka Dixit  */
1245291c49deSAloka Dixit struct cfg80211_fils_discovery {
1246291c49deSAloka Dixit 	u32 min_interval;
1247291c49deSAloka Dixit 	u32 max_interval;
1248291c49deSAloka Dixit 	size_t tmpl_len;
1249291c49deSAloka Dixit 	const u8 *tmpl;
1250291c49deSAloka Dixit };
1251291c49deSAloka Dixit 
1252291c49deSAloka Dixit /**
12537443dcd1SAloka Dixit  * struct cfg80211_unsol_bcast_probe_resp - Unsolicited broadcast probe
12547443dcd1SAloka Dixit  *	response parameters in 6GHz.
12557443dcd1SAloka Dixit  *
12567443dcd1SAloka Dixit  * @interval: Packet interval in TUs. Maximum allowed is 20 TU, as mentioned
12577443dcd1SAloka Dixit  *	in IEEE P802.11ax/D6.0 26.17.2.3.2 - AP behavior for fast passive
12587443dcd1SAloka Dixit  *	scanning
12597443dcd1SAloka Dixit  * @tmpl_len: Template length
12607443dcd1SAloka Dixit  * @tmpl: Template data for probe response
12617443dcd1SAloka Dixit  */
12627443dcd1SAloka Dixit struct cfg80211_unsol_bcast_probe_resp {
12637443dcd1SAloka Dixit 	u32 interval;
12647443dcd1SAloka Dixit 	size_t tmpl_len;
12657443dcd1SAloka Dixit 	const u8 *tmpl;
12667443dcd1SAloka Dixit };
12677443dcd1SAloka Dixit 
12687443dcd1SAloka Dixit /**
12698860020eSJohannes Berg  * struct cfg80211_ap_settings - AP configuration
12708860020eSJohannes Berg  *
12718860020eSJohannes Berg  * Used to configure an AP interface.
12728860020eSJohannes Berg  *
1273683b6d3bSJohannes Berg  * @chandef: defines the channel to use
12748860020eSJohannes Berg  * @beacon: beacon data
12758860020eSJohannes Berg  * @beacon_interval: beacon interval
12768860020eSJohannes Berg  * @dtim_period: DTIM period
12778860020eSJohannes Berg  * @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from
12788860020eSJohannes Berg  *	user space)
12798860020eSJohannes Berg  * @ssid_len: length of @ssid
12808860020eSJohannes Berg  * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames
12818860020eSJohannes Berg  * @crypto: crypto settings
12828860020eSJohannes Berg  * @privacy: the BSS uses privacy
12838860020eSJohannes Berg  * @auth_type: Authentication type (algorithm)
128418998c38SEliad Peller  * @smps_mode: SMPS mode
12851b658f11SVasanthakumar Thiagarajan  * @inactivity_timeout: time in seconds to determine station's inactivity.
128653cabad7SJohannes Berg  * @p2p_ctwindow: P2P CT Window
128753cabad7SJohannes Berg  * @p2p_opp_ps: P2P opportunistic PS
128877765eafSVasanthakumar Thiagarajan  * @acl: ACL configuration used by the drivers which has support for
128977765eafSVasanthakumar Thiagarajan  *	MAC address based access control
129034d50519SLior David  * @pbss: If set, start as a PCP instead of AP. Relevant for DMG
129134d50519SLior David  *	networks.
12928564e382SJohannes Berg  * @beacon_rate: bitrate to be used for beacons
129366cd794eSJohannes Berg  * @ht_cap: HT capabilities (or %NULL if HT isn't enabled)
129466cd794eSJohannes Berg  * @vht_cap: VHT capabilities (or %NULL if VHT isn't enabled)
1295244eb9aeSShaul Triebitz  * @he_cap: HE capabilities (or %NULL if HE isn't enabled)
129666cd794eSJohannes Berg  * @ht_required: stations must support HT
129766cd794eSJohannes Berg  * @vht_required: stations must support VHT
1298a0de1ca3SJohn Crispin  * @twt_responder: Enable Target Wait Time
12992a392596SIlan Peer  * @he_required: stations must support HE
1300d6587602SIlan Peer  * @sae_h2e_required: stations must support direct H2E technique in SAE
1301fe494370SSrinivas Dasari  * @flags: flags, as defined in enum cfg80211_ap_settings_flags
1302796e90f4SJohn Crispin  * @he_obss_pd: OBSS Packet Detection settings
13037e8d6f12SShaul Triebitz  * @he_oper: HE operation IE (or %NULL if HE isn't enabled)
1304291c49deSAloka Dixit  * @fils_discovery: FILS discovery transmission parameters
13057443dcd1SAloka Dixit  * @unsol_bcast_probe_resp: Unsolicited broadcast probe response parameters
1306dc1e3cb8SJohn Crispin  * @mbssid_config: AP settings for multiple bssid
13078860020eSJohannes Berg  */
13088860020eSJohannes Berg struct cfg80211_ap_settings {
1309683b6d3bSJohannes Berg 	struct cfg80211_chan_def chandef;
1310aa430da4SJohannes Berg 
13118860020eSJohannes Berg 	struct cfg80211_beacon_data beacon;
13128860020eSJohannes Berg 
13138860020eSJohannes Berg 	int beacon_interval, dtim_period;
131432e9de84SJouni Malinen 	const u8 *ssid;
131532e9de84SJouni Malinen 	size_t ssid_len;
131632e9de84SJouni Malinen 	enum nl80211_hidden_ssid hidden_ssid;
13175fb628e9SJouni Malinen 	struct cfg80211_crypto_settings crypto;
13185fb628e9SJouni Malinen 	bool privacy;
13195fb628e9SJouni Malinen 	enum nl80211_auth_type auth_type;
132018998c38SEliad Peller 	enum nl80211_smps_mode smps_mode;
13211b658f11SVasanthakumar Thiagarajan 	int inactivity_timeout;
132253cabad7SJohannes Berg 	u8 p2p_ctwindow;
132353cabad7SJohannes Berg 	bool p2p_opp_ps;
132477765eafSVasanthakumar Thiagarajan 	const struct cfg80211_acl_data *acl;
132534d50519SLior David 	bool pbss;
1326a7c7fbffSPurushottam Kushwaha 	struct cfg80211_bitrate_mask beacon_rate;
132766cd794eSJohannes Berg 
132866cd794eSJohannes Berg 	const struct ieee80211_ht_cap *ht_cap;
132966cd794eSJohannes Berg 	const struct ieee80211_vht_cap *vht_cap;
1330244eb9aeSShaul Triebitz 	const struct ieee80211_he_cap_elem *he_cap;
13317e8d6f12SShaul Triebitz 	const struct ieee80211_he_operation *he_oper;
1332d6587602SIlan Peer 	bool ht_required, vht_required, he_required, sae_h2e_required;
1333a0de1ca3SJohn Crispin 	bool twt_responder;
1334fe494370SSrinivas Dasari 	u32 flags;
1335796e90f4SJohn Crispin 	struct ieee80211_he_obss_pd he_obss_pd;
1336291c49deSAloka Dixit 	struct cfg80211_fils_discovery fils_discovery;
13377443dcd1SAloka Dixit 	struct cfg80211_unsol_bcast_probe_resp unsol_bcast_probe_resp;
1338dc1e3cb8SJohn Crispin 	struct cfg80211_mbssid_config mbssid_config;
1339ed1b6cc7SJohannes Berg };
1340ed1b6cc7SJohannes Berg 
13415727ef1bSJohannes Berg /**
134216ef1fe2SSimon Wunderlich  * struct cfg80211_csa_settings - channel switch settings
134316ef1fe2SSimon Wunderlich  *
134416ef1fe2SSimon Wunderlich  * Used for channel switch
134516ef1fe2SSimon Wunderlich  *
134616ef1fe2SSimon Wunderlich  * @chandef: defines the channel to use after the switch
134716ef1fe2SSimon Wunderlich  * @beacon_csa: beacon data while performing the switch
13489a774c78SAndrei Otcheretianski  * @counter_offsets_beacon: offsets of the counters within the beacon (tail)
13499a774c78SAndrei Otcheretianski  * @counter_offsets_presp: offsets of the counters within the probe response
13509a774c78SAndrei Otcheretianski  * @n_counter_offsets_beacon: number of csa counters the beacon (tail)
13519a774c78SAndrei Otcheretianski  * @n_counter_offsets_presp: number of csa counters in the probe response
135216ef1fe2SSimon Wunderlich  * @beacon_after: beacon data to be used on the new channel
135316ef1fe2SSimon Wunderlich  * @radar_required: whether radar detection is required on the new channel
135416ef1fe2SSimon Wunderlich  * @block_tx: whether transmissions should be blocked while changing
135516ef1fe2SSimon Wunderlich  * @count: number of beacons until switch
135616ef1fe2SSimon Wunderlich  */
135716ef1fe2SSimon Wunderlich struct cfg80211_csa_settings {
135816ef1fe2SSimon Wunderlich 	struct cfg80211_chan_def chandef;
135916ef1fe2SSimon Wunderlich 	struct cfg80211_beacon_data beacon_csa;
13609a774c78SAndrei Otcheretianski 	const u16 *counter_offsets_beacon;
13619a774c78SAndrei Otcheretianski 	const u16 *counter_offsets_presp;
13629a774c78SAndrei Otcheretianski 	unsigned int n_counter_offsets_beacon;
13639a774c78SAndrei Otcheretianski 	unsigned int n_counter_offsets_presp;
136416ef1fe2SSimon Wunderlich 	struct cfg80211_beacon_data beacon_after;
136516ef1fe2SSimon Wunderlich 	bool radar_required;
136616ef1fe2SSimon Wunderlich 	bool block_tx;
136716ef1fe2SSimon Wunderlich 	u8 count;
136816ef1fe2SSimon Wunderlich };
136916ef1fe2SSimon Wunderlich 
137016ef1fe2SSimon Wunderlich /**
13710d2ab3aeSJohn Crispin  * struct cfg80211_color_change_settings - color change settings
13720d2ab3aeSJohn Crispin  *
13730d2ab3aeSJohn Crispin  * Used for bss color change
13740d2ab3aeSJohn Crispin  *
13750d2ab3aeSJohn Crispin  * @beacon_color_change: beacon data while performing the color countdown
13760d2ab3aeSJohn Crispin  * @counter_offsets_beacon: offsets of the counters within the beacon (tail)
13770d2ab3aeSJohn Crispin  * @counter_offsets_presp: offsets of the counters within the probe response
13780d2ab3aeSJohn Crispin  * @beacon_next: beacon data to be used after the color change
13790d2ab3aeSJohn Crispin  * @count: number of beacons until the color change
13800d2ab3aeSJohn Crispin  * @color: the color used after the change
13810d2ab3aeSJohn Crispin  */
13820d2ab3aeSJohn Crispin struct cfg80211_color_change_settings {
13830d2ab3aeSJohn Crispin 	struct cfg80211_beacon_data beacon_color_change;
13840d2ab3aeSJohn Crispin 	u16 counter_offset_beacon;
13850d2ab3aeSJohn Crispin 	u16 counter_offset_presp;
13860d2ab3aeSJohn Crispin 	struct cfg80211_beacon_data beacon_next;
13870d2ab3aeSJohn Crispin 	u8 count;
13880d2ab3aeSJohn Crispin 	u8 color;
13890d2ab3aeSJohn Crispin };
13900d2ab3aeSJohn Crispin 
13910d2ab3aeSJohn Crispin /**
1392e227300cSPurushottam Kushwaha  * struct iface_combination_params - input parameters for interface combinations
1393e227300cSPurushottam Kushwaha  *
1394e227300cSPurushottam Kushwaha  * Used to pass interface combination parameters
1395e227300cSPurushottam Kushwaha  *
1396e227300cSPurushottam Kushwaha  * @num_different_channels: the number of different channels we want
1397e227300cSPurushottam Kushwaha  *	to use for verification
1398e227300cSPurushottam Kushwaha  * @radar_detect: a bitmap where each bit corresponds to a channel
1399e227300cSPurushottam Kushwaha  *	width where radar detection is needed, as in the definition of
1400e227300cSPurushottam Kushwaha  *	&struct ieee80211_iface_combination.@radar_detect_widths
1401e227300cSPurushottam Kushwaha  * @iftype_num: array with the number of interfaces of each interface
1402e227300cSPurushottam Kushwaha  *	type.  The index is the interface type as specified in &enum
1403e227300cSPurushottam Kushwaha  *	nl80211_iftype.
14044c8dea63SJohannes Berg  * @new_beacon_int: set this to the beacon interval of a new interface
14054c8dea63SJohannes Berg  *	that's not operating yet, if such is to be checked as part of
14064c8dea63SJohannes Berg  *	the verification
1407e227300cSPurushottam Kushwaha  */
1408e227300cSPurushottam Kushwaha struct iface_combination_params {
1409e227300cSPurushottam Kushwaha 	int num_different_channels;
1410e227300cSPurushottam Kushwaha 	u8 radar_detect;
1411e227300cSPurushottam Kushwaha 	int iftype_num[NUM_NL80211_IFTYPES];
14124c8dea63SJohannes Berg 	u32 new_beacon_int;
1413e227300cSPurushottam Kushwaha };
1414e227300cSPurushottam Kushwaha 
1415e227300cSPurushottam Kushwaha /**
14163b9ce80cSJohannes Berg  * enum station_parameters_apply_mask - station parameter values to apply
14173b9ce80cSJohannes Berg  * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp)
14189d62a986SJouni Malinen  * @STATION_PARAM_APPLY_CAPABILITY: apply new capability
1419f8bacc21SJohannes Berg  * @STATION_PARAM_APPLY_PLINK_STATE: apply new plink state
14203b9ce80cSJohannes Berg  *
14213b9ce80cSJohannes Berg  * Not all station parameters have in-band "no change" signalling,
14223b9ce80cSJohannes Berg  * for those that don't these flags will are used.
14233b9ce80cSJohannes Berg  */
14243b9ce80cSJohannes Berg enum station_parameters_apply_mask {
14253b9ce80cSJohannes Berg 	STATION_PARAM_APPLY_UAPSD = BIT(0),
14269d62a986SJouni Malinen 	STATION_PARAM_APPLY_CAPABILITY = BIT(1),
1427f8bacc21SJohannes Berg 	STATION_PARAM_APPLY_PLINK_STATE = BIT(2),
1428e96d1cd2SAshok Raj Nagarajan 	STATION_PARAM_APPLY_STA_TXPOWER = BIT(3),
1429e96d1cd2SAshok Raj Nagarajan };
1430e96d1cd2SAshok Raj Nagarajan 
1431e96d1cd2SAshok Raj Nagarajan /**
1432e96d1cd2SAshok Raj Nagarajan  * struct sta_txpwr - station txpower configuration
1433e96d1cd2SAshok Raj Nagarajan  *
1434e96d1cd2SAshok Raj Nagarajan  * Used to configure txpower for station.
1435e96d1cd2SAshok Raj Nagarajan  *
1436e96d1cd2SAshok Raj Nagarajan  * @power: tx power (in dBm) to be used for sending data traffic. If tx power
1437e96d1cd2SAshok Raj Nagarajan  *	is not provided, the default per-interface tx power setting will be
1438e96d1cd2SAshok Raj Nagarajan  *	overriding. Driver should be picking up the lowest tx power, either tx
1439e96d1cd2SAshok Raj Nagarajan  *	power per-interface or per-station.
1440e96d1cd2SAshok Raj Nagarajan  * @type: In particular if TPC %type is NL80211_TX_POWER_LIMITED then tx power
1441e96d1cd2SAshok Raj Nagarajan  *	will be less than or equal to specified from userspace, whereas if TPC
1442e96d1cd2SAshok Raj Nagarajan  *	%type is NL80211_TX_POWER_AUTOMATIC then it indicates default tx power.
1443e96d1cd2SAshok Raj Nagarajan  *	NL80211_TX_POWER_FIXED is not a valid configuration option for
1444e96d1cd2SAshok Raj Nagarajan  *	per peer TPC.
1445e96d1cd2SAshok Raj Nagarajan  */
1446e96d1cd2SAshok Raj Nagarajan struct sta_txpwr {
1447e96d1cd2SAshok Raj Nagarajan 	s16 power;
1448e96d1cd2SAshok Raj Nagarajan 	enum nl80211_tx_power_setting type;
14493b9ce80cSJohannes Berg };
14503b9ce80cSJohannes Berg 
14513b9ce80cSJohannes Berg /**
14525727ef1bSJohannes Berg  * struct station_parameters - station parameters
14535727ef1bSJohannes Berg  *
14545727ef1bSJohannes Berg  * Used to change and create a new station.
14555727ef1bSJohannes Berg  *
14565727ef1bSJohannes Berg  * @vlan: vlan interface station should belong to
14575727ef1bSJohannes Berg  * @supported_rates: supported rates in IEEE 802.11 format
14585727ef1bSJohannes Berg  *	(or NULL for no change)
14595727ef1bSJohannes Berg  * @supported_rates_len: number of supported rates
1460eccb8e8fSJohannes Berg  * @sta_flags_mask: station flags that changed
1461819bf593SJohannes Berg  *	(bitmask of BIT(%NL80211_STA_FLAG_...))
1462eccb8e8fSJohannes Berg  * @sta_flags_set: station flags values
1463819bf593SJohannes Berg  *	(bitmask of BIT(%NL80211_STA_FLAG_...))
14645727ef1bSJohannes Berg  * @listen_interval: listen interval or -1 for no change
14655727ef1bSJohannes Berg  * @aid: AID or zero for no change
146614f34e36SGurumoorthi Gnanasambandhan  * @vlan_id: VLAN ID for station (if nonzero)
14677d27a0baSMasashi Honma  * @peer_aid: mesh peer AID or zero for no change
1468abe37c4bSJohannes Berg  * @plink_action: plink action to take
14699c3990aaSJavier Cardona  * @plink_state: set the peer link state for a station
1470abe37c4bSJohannes Berg  * @ht_capa: HT capabilities of station
1471f461be3eSMahesh Palivela  * @vht_capa: VHT capabilities of station
1472910868dbSEliad Peller  * @uapsd_queues: bitmap of queues configured for uapsd. same format
1473910868dbSEliad Peller  *	as the AC bitmap in the QoS info field
1474910868dbSEliad Peller  * @max_sp: max Service Period. same format as the MAX_SP in the
1475910868dbSEliad Peller  *	QoS info field (but already shifted down)
1476c26887d2SJohannes Berg  * @sta_modify_mask: bitmap indicating which parameters changed
1477c26887d2SJohannes Berg  *	(for those that don't have a natural "no change" value),
1478c26887d2SJohannes Berg  *	see &enum station_parameters_apply_mask
14793b1c5a53SMarco Porsch  * @local_pm: local link-specific mesh power save mode (no change when set
14803b1c5a53SMarco Porsch  *	to unknown)
14819d62a986SJouni Malinen  * @capability: station capability
14829d62a986SJouni Malinen  * @ext_capab: extended capabilities of the station
14839d62a986SJouni Malinen  * @ext_capab_len: number of extended capabilities
1484c01fc9adSSunil Dutt  * @supported_channels: supported channels in IEEE 802.11 format
1485c01fc9adSSunil Dutt  * @supported_channels_len: number of supported channels
1486c01fc9adSSunil Dutt  * @supported_oper_classes: supported oper classes in IEEE 802.11 format
1487c01fc9adSSunil Dutt  * @supported_oper_classes_len: number of supported operating classes
148860f4a7b1SMarek Kwaczynski  * @opmode_notif: operating mode field from Operating Mode Notification
148960f4a7b1SMarek Kwaczynski  * @opmode_notif_used: information if operating mode field is used
149017b94247SAyala Beker  * @support_p2p_ps: information if station supports P2P PS mechanism
1491c4cbaf79SLuca Coelho  * @he_capa: HE capabilities of station
1492c4cbaf79SLuca Coelho  * @he_capa_len: the length of the HE capabilities
149336647055SToke Høiland-Jørgensen  * @airtime_weight: airtime scheduler weight for this station
1494a710d214SLothar Rubusch  * @txpwr: transmit power for an associated station
149543e64bf3SRajkumar Manoharan  * @he_6ghz_capa: HE 6 GHz Band capabilities of station
1496ea05fd35SIlan Peer  * @eht_capa: EHT capabilities of station
1497ea05fd35SIlan Peer  * @eht_capa_len: the length of the EHT capabilities
14985727ef1bSJohannes Berg  */
14995727ef1bSJohannes Berg struct station_parameters {
15002c1aabf3SJohannes Berg 	const u8 *supported_rates;
15015727ef1bSJohannes Berg 	struct net_device *vlan;
1502eccb8e8fSJohannes Berg 	u32 sta_flags_mask, sta_flags_set;
15033b9ce80cSJohannes Berg 	u32 sta_modify_mask;
15045727ef1bSJohannes Berg 	int listen_interval;
15055727ef1bSJohannes Berg 	u16 aid;
150614f34e36SGurumoorthi Gnanasambandhan 	u16 vlan_id;
15077d27a0baSMasashi Honma 	u16 peer_aid;
15085727ef1bSJohannes Berg 	u8 supported_rates_len;
15092ec600d6SLuis Carlos Cobo 	u8 plink_action;
15109c3990aaSJavier Cardona 	u8 plink_state;
15112c1aabf3SJohannes Berg 	const struct ieee80211_ht_cap *ht_capa;
15122c1aabf3SJohannes Berg 	const struct ieee80211_vht_cap *vht_capa;
1513c75786c9SEliad Peller 	u8 uapsd_queues;
1514c75786c9SEliad Peller 	u8 max_sp;
15153b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode local_pm;
15169d62a986SJouni Malinen 	u16 capability;
15172c1aabf3SJohannes Berg 	const u8 *ext_capab;
15189d62a986SJouni Malinen 	u8 ext_capab_len;
1519c01fc9adSSunil Dutt 	const u8 *supported_channels;
1520c01fc9adSSunil Dutt 	u8 supported_channels_len;
1521c01fc9adSSunil Dutt 	const u8 *supported_oper_classes;
1522c01fc9adSSunil Dutt 	u8 supported_oper_classes_len;
152360f4a7b1SMarek Kwaczynski 	u8 opmode_notif;
152460f4a7b1SMarek Kwaczynski 	bool opmode_notif_used;
152517b94247SAyala Beker 	int support_p2p_ps;
1526c4cbaf79SLuca Coelho 	const struct ieee80211_he_cap_elem *he_capa;
1527c4cbaf79SLuca Coelho 	u8 he_capa_len;
152836647055SToke Høiland-Jørgensen 	u16 airtime_weight;
1529e96d1cd2SAshok Raj Nagarajan 	struct sta_txpwr txpwr;
153043e64bf3SRajkumar Manoharan 	const struct ieee80211_he_6ghz_capa *he_6ghz_capa;
1531ea05fd35SIlan Peer 	const struct ieee80211_eht_cap_elem *eht_capa;
1532ea05fd35SIlan Peer 	u8 eht_capa_len;
15335727ef1bSJohannes Berg };
15345727ef1bSJohannes Berg 
1535fd5b74dcSJohannes Berg /**
153689c771e5SJouni Malinen  * struct station_del_parameters - station deletion parameters
153789c771e5SJouni Malinen  *
153889c771e5SJouni Malinen  * Used to delete a station entry (or all stations).
153989c771e5SJouni Malinen  *
154089c771e5SJouni Malinen  * @mac: MAC address of the station to remove or NULL to remove all stations
154198856866SJouni Malinen  * @subtype: Management frame subtype to use for indicating removal
154298856866SJouni Malinen  *	(10 = Disassociation, 12 = Deauthentication)
154398856866SJouni Malinen  * @reason_code: Reason code for the Disassociation/Deauthentication frame
154489c771e5SJouni Malinen  */
154589c771e5SJouni Malinen struct station_del_parameters {
154689c771e5SJouni Malinen 	const u8 *mac;
154798856866SJouni Malinen 	u8 subtype;
154898856866SJouni Malinen 	u16 reason_code;
154989c771e5SJouni Malinen };
155089c771e5SJouni Malinen 
155189c771e5SJouni Malinen /**
155277ee7c89SJohannes Berg  * enum cfg80211_station_type - the type of station being modified
155377ee7c89SJohannes Berg  * @CFG80211_STA_AP_CLIENT: client of an AP interface
155447edb11bSAyala Beker  * @CFG80211_STA_AP_CLIENT_UNASSOC: client of an AP interface that is still
155547edb11bSAyala Beker  *	unassociated (update properties for this type of client is permitted)
155677ee7c89SJohannes Berg  * @CFG80211_STA_AP_MLME_CLIENT: client of an AP interface that has
155777ee7c89SJohannes Berg  *	the AP MLME in the device
155877ee7c89SJohannes Berg  * @CFG80211_STA_AP_STA: AP station on managed interface
155977ee7c89SJohannes Berg  * @CFG80211_STA_IBSS: IBSS station
156077ee7c89SJohannes Berg  * @CFG80211_STA_TDLS_PEER_SETUP: TDLS peer on managed interface (dummy entry
156177ee7c89SJohannes Berg  *	while TDLS setup is in progress, it moves out of this state when
156277ee7c89SJohannes Berg  *	being marked authorized; use this only if TDLS with external setup is
156377ee7c89SJohannes Berg  *	supported/used)
156477ee7c89SJohannes Berg  * @CFG80211_STA_TDLS_PEER_ACTIVE: TDLS peer on managed interface (active
156577ee7c89SJohannes Berg  *	entry that is operating, has been marked authorized by userspace)
1566eef941e6SThomas Pedersen  * @CFG80211_STA_MESH_PEER_KERNEL: peer on mesh interface (kernel managed)
1567eef941e6SThomas Pedersen  * @CFG80211_STA_MESH_PEER_USER: peer on mesh interface (user managed)
156877ee7c89SJohannes Berg  */
156977ee7c89SJohannes Berg enum cfg80211_station_type {
157077ee7c89SJohannes Berg 	CFG80211_STA_AP_CLIENT,
157147edb11bSAyala Beker 	CFG80211_STA_AP_CLIENT_UNASSOC,
157277ee7c89SJohannes Berg 	CFG80211_STA_AP_MLME_CLIENT,
157377ee7c89SJohannes Berg 	CFG80211_STA_AP_STA,
157477ee7c89SJohannes Berg 	CFG80211_STA_IBSS,
157577ee7c89SJohannes Berg 	CFG80211_STA_TDLS_PEER_SETUP,
157677ee7c89SJohannes Berg 	CFG80211_STA_TDLS_PEER_ACTIVE,
1577eef941e6SThomas Pedersen 	CFG80211_STA_MESH_PEER_KERNEL,
1578eef941e6SThomas Pedersen 	CFG80211_STA_MESH_PEER_USER,
157977ee7c89SJohannes Berg };
158077ee7c89SJohannes Berg 
158177ee7c89SJohannes Berg /**
158277ee7c89SJohannes Berg  * cfg80211_check_station_change - validate parameter changes
158377ee7c89SJohannes Berg  * @wiphy: the wiphy this operates on
158477ee7c89SJohannes Berg  * @params: the new parameters for a station
158577ee7c89SJohannes Berg  * @statype: the type of station being modified
158677ee7c89SJohannes Berg  *
158777ee7c89SJohannes Berg  * Utility function for the @change_station driver method. Call this function
158877ee7c89SJohannes Berg  * with the appropriate station type looking up the station (and checking that
158977ee7c89SJohannes Berg  * it exists). It will verify whether the station change is acceptable, and if
159077ee7c89SJohannes Berg  * not will return an error code. Note that it may modify the parameters for
159177ee7c89SJohannes Berg  * backward compatibility reasons, so don't use them before calling this.
159277ee7c89SJohannes Berg  */
159377ee7c89SJohannes Berg int cfg80211_check_station_change(struct wiphy *wiphy,
159477ee7c89SJohannes Berg 				  struct station_parameters *params,
159577ee7c89SJohannes Berg 				  enum cfg80211_station_type statype);
159677ee7c89SJohannes Berg 
159777ee7c89SJohannes Berg /**
1598b1e8eb11SMauro Carvalho Chehab  * enum rate_info_flags - bitrate info flags
1599420e7fabSHenning Rogge  *
1600420e7fabSHenning Rogge  * Used by the driver to indicate the specific rate transmission
1601420e7fabSHenning Rogge  * type for 802.11n transmissions.
1602420e7fabSHenning Rogge  *
1603db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_MCS: mcs field filled with HT MCS
1604db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_VHT_MCS: mcs field filled with VHT MCS
1605420e7fabSHenning Rogge  * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval
16062a38075cSAlexei Avshalom Lazar  * @RATE_INFO_FLAGS_DMG: 60GHz MCS
1607c4cbaf79SLuca Coelho  * @RATE_INFO_FLAGS_HE_MCS: HE MCS information
16082a38075cSAlexei Avshalom Lazar  * @RATE_INFO_FLAGS_EDMG: 60GHz MCS in EDMG mode
1609d9c85e24SMax Chen  * @RATE_INFO_FLAGS_EXTENDED_SC_DMG: 60GHz extended SC MCS
1610cfb14110SVeerendranath Jakkam  * @RATE_INFO_FLAGS_EHT_MCS: EHT MCS information
1611420e7fabSHenning Rogge  */
1612420e7fabSHenning Rogge enum rate_info_flags {
1613db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_MCS			= BIT(0),
1614db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_VHT_MCS			= BIT(1),
1615b51f3beeSJohannes Berg 	RATE_INFO_FLAGS_SHORT_GI		= BIT(2),
16162a38075cSAlexei Avshalom Lazar 	RATE_INFO_FLAGS_DMG			= BIT(3),
1617c4cbaf79SLuca Coelho 	RATE_INFO_FLAGS_HE_MCS			= BIT(4),
16182a38075cSAlexei Avshalom Lazar 	RATE_INFO_FLAGS_EDMG			= BIT(5),
1619d9c85e24SMax Chen 	RATE_INFO_FLAGS_EXTENDED_SC_DMG		= BIT(6),
1620cfb14110SVeerendranath Jakkam 	RATE_INFO_FLAGS_EHT_MCS			= BIT(7),
1621b51f3beeSJohannes Berg };
1622b51f3beeSJohannes Berg 
1623b51f3beeSJohannes Berg /**
1624b51f3beeSJohannes Berg  * enum rate_info_bw - rate bandwidth information
1625b51f3beeSJohannes Berg  *
1626b51f3beeSJohannes Berg  * Used by the driver to indicate the rate bandwidth.
1627b51f3beeSJohannes Berg  *
1628b51f3beeSJohannes Berg  * @RATE_INFO_BW_5: 5 MHz bandwidth
1629b51f3beeSJohannes Berg  * @RATE_INFO_BW_10: 10 MHz bandwidth
1630b51f3beeSJohannes Berg  * @RATE_INFO_BW_20: 20 MHz bandwidth
1631b51f3beeSJohannes Berg  * @RATE_INFO_BW_40: 40 MHz bandwidth
1632b51f3beeSJohannes Berg  * @RATE_INFO_BW_80: 80 MHz bandwidth
1633b51f3beeSJohannes Berg  * @RATE_INFO_BW_160: 160 MHz bandwidth
1634c4cbaf79SLuca Coelho  * @RATE_INFO_BW_HE_RU: bandwidth determined by HE RU allocation
1635cfb14110SVeerendranath Jakkam  * @RATE_INFO_BW_320: 320 MHz bandwidth
1636cfb14110SVeerendranath Jakkam  * @RATE_INFO_BW_EHT_RU: bandwidth determined by EHT RU allocation
1637b51f3beeSJohannes Berg  */
1638b51f3beeSJohannes Berg enum rate_info_bw {
1639842be75cSJohannes Berg 	RATE_INFO_BW_20 = 0,
1640b51f3beeSJohannes Berg 	RATE_INFO_BW_5,
1641b51f3beeSJohannes Berg 	RATE_INFO_BW_10,
1642b51f3beeSJohannes Berg 	RATE_INFO_BW_40,
1643b51f3beeSJohannes Berg 	RATE_INFO_BW_80,
1644b51f3beeSJohannes Berg 	RATE_INFO_BW_160,
1645c4cbaf79SLuca Coelho 	RATE_INFO_BW_HE_RU,
1646cfb14110SVeerendranath Jakkam 	RATE_INFO_BW_320,
1647cfb14110SVeerendranath Jakkam 	RATE_INFO_BW_EHT_RU,
1648420e7fabSHenning Rogge };
1649420e7fabSHenning Rogge 
1650420e7fabSHenning Rogge /**
1651420e7fabSHenning Rogge  * struct rate_info - bitrate information
1652420e7fabSHenning Rogge  *
1653420e7fabSHenning Rogge  * Information about a receiving or transmitting bitrate
1654420e7fabSHenning Rogge  *
1655420e7fabSHenning Rogge  * @flags: bitflag of flags from &enum rate_info_flags
1656c4cbaf79SLuca Coelho  * @mcs: mcs index if struct describes an HT/VHT/HE rate
1657420e7fabSHenning Rogge  * @legacy: bitrate in 100kbit/s for 802.11abg
1658c4cbaf79SLuca Coelho  * @nss: number of streams (VHT & HE only)
1659b51f3beeSJohannes Berg  * @bw: bandwidth (from &enum rate_info_bw)
1660c4cbaf79SLuca Coelho  * @he_gi: HE guard interval (from &enum nl80211_he_gi)
1661c4cbaf79SLuca Coelho  * @he_dcm: HE DCM value
1662c4cbaf79SLuca Coelho  * @he_ru_alloc: HE RU allocation (from &enum nl80211_he_ru_alloc,
1663c4cbaf79SLuca Coelho  *	only valid if bw is %RATE_INFO_BW_HE_RU)
16642a38075cSAlexei Avshalom Lazar  * @n_bonded_ch: In case of EDMG the number of bonded channels (1-4)
1665cfb14110SVeerendranath Jakkam  * @eht_gi: EHT guard interval (from &enum nl80211_eht_gi)
1666cfb14110SVeerendranath Jakkam  * @eht_ru_alloc: EHT RU allocation (from &enum nl80211_eht_ru_alloc,
1667cfb14110SVeerendranath Jakkam  *	only valid if bw is %RATE_INFO_BW_EHT_RU)
1668420e7fabSHenning Rogge  */
1669420e7fabSHenning Rogge struct rate_info {
1670420e7fabSHenning Rogge 	u8 flags;
1671420e7fabSHenning Rogge 	u8 mcs;
1672420e7fabSHenning Rogge 	u16 legacy;
1673db9c64cfSJohannes Berg 	u8 nss;
1674b51f3beeSJohannes Berg 	u8 bw;
1675c4cbaf79SLuca Coelho 	u8 he_gi;
1676c4cbaf79SLuca Coelho 	u8 he_dcm;
1677c4cbaf79SLuca Coelho 	u8 he_ru_alloc;
16782a38075cSAlexei Avshalom Lazar 	u8 n_bonded_ch;
1679cfb14110SVeerendranath Jakkam 	u8 eht_gi;
1680cfb14110SVeerendranath Jakkam 	u8 eht_ru_alloc;
1681fd5b74dcSJohannes Berg };
1682fd5b74dcSJohannes Berg 
1683fd5b74dcSJohannes Berg /**
1684b1e8eb11SMauro Carvalho Chehab  * enum bss_param_flags - bitrate info flags
1685f4263c98SPaul Stewart  *
1686f4263c98SPaul Stewart  * Used by the driver to indicate the specific rate transmission
1687f4263c98SPaul Stewart  * type for 802.11n transmissions.
1688f4263c98SPaul Stewart  *
1689f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_CTS_PROT: whether CTS protection is enabled
1690f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_SHORT_PREAMBLE: whether short preamble is enabled
1691f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_SHORT_SLOT_TIME: whether short slot time is enabled
1692f4263c98SPaul Stewart  */
1693f4263c98SPaul Stewart enum bss_param_flags {
1694f4263c98SPaul Stewart 	BSS_PARAM_FLAGS_CTS_PROT	= 1<<0,
1695f4263c98SPaul Stewart 	BSS_PARAM_FLAGS_SHORT_PREAMBLE	= 1<<1,
1696f4263c98SPaul Stewart 	BSS_PARAM_FLAGS_SHORT_SLOT_TIME	= 1<<2,
1697f4263c98SPaul Stewart };
1698f4263c98SPaul Stewart 
1699f4263c98SPaul Stewart /**
1700f4263c98SPaul Stewart  * struct sta_bss_parameters - BSS parameters for the attached station
1701f4263c98SPaul Stewart  *
1702f4263c98SPaul Stewart  * Information about the currently associated BSS
1703f4263c98SPaul Stewart  *
1704f4263c98SPaul Stewart  * @flags: bitflag of flags from &enum bss_param_flags
1705f4263c98SPaul Stewart  * @dtim_period: DTIM period for the BSS
1706f4263c98SPaul Stewart  * @beacon_interval: beacon interval
1707f4263c98SPaul Stewart  */
1708f4263c98SPaul Stewart struct sta_bss_parameters {
1709f4263c98SPaul Stewart 	u8 flags;
1710f4263c98SPaul Stewart 	u8 dtim_period;
1711f4263c98SPaul Stewart 	u16 beacon_interval;
1712f4263c98SPaul Stewart };
1713f4263c98SPaul Stewart 
17146de39808SJohannes Berg /**
171552539ca8SToke Høiland-Jørgensen  * struct cfg80211_txq_stats - TXQ statistics for this TID
171652539ca8SToke Høiland-Jørgensen  * @filled: bitmap of flags using the bits of &enum nl80211_txq_stats to
171752539ca8SToke Høiland-Jørgensen  *	indicate the relevant values in this struct are filled
171852539ca8SToke Høiland-Jørgensen  * @backlog_bytes: total number of bytes currently backlogged
171952539ca8SToke Høiland-Jørgensen  * @backlog_packets: total number of packets currently backlogged
172052539ca8SToke Høiland-Jørgensen  * @flows: number of new flows seen
172152539ca8SToke Høiland-Jørgensen  * @drops: total number of packets dropped
172252539ca8SToke Høiland-Jørgensen  * @ecn_marks: total number of packets marked with ECN CE
172352539ca8SToke Høiland-Jørgensen  * @overlimit: number of drops due to queue space overflow
172452539ca8SToke Høiland-Jørgensen  * @overmemory: number of drops due to memory limit overflow
172552539ca8SToke Høiland-Jørgensen  * @collisions: number of hash collisions
172652539ca8SToke Høiland-Jørgensen  * @tx_bytes: total number of bytes dequeued
172752539ca8SToke Høiland-Jørgensen  * @tx_packets: total number of packets dequeued
172852539ca8SToke Høiland-Jørgensen  * @max_flows: maximum number of flows supported
172952539ca8SToke Høiland-Jørgensen  */
173052539ca8SToke Høiland-Jørgensen struct cfg80211_txq_stats {
173152539ca8SToke Høiland-Jørgensen 	u32 filled;
173252539ca8SToke Høiland-Jørgensen 	u32 backlog_bytes;
173352539ca8SToke Høiland-Jørgensen 	u32 backlog_packets;
173452539ca8SToke Høiland-Jørgensen 	u32 flows;
173552539ca8SToke Høiland-Jørgensen 	u32 drops;
173652539ca8SToke Høiland-Jørgensen 	u32 ecn_marks;
173752539ca8SToke Høiland-Jørgensen 	u32 overlimit;
173852539ca8SToke Høiland-Jørgensen 	u32 overmemory;
173952539ca8SToke Høiland-Jørgensen 	u32 collisions;
174052539ca8SToke Høiland-Jørgensen 	u32 tx_bytes;
174152539ca8SToke Høiland-Jørgensen 	u32 tx_packets;
174252539ca8SToke Høiland-Jørgensen 	u32 max_flows;
174352539ca8SToke Høiland-Jørgensen };
174452539ca8SToke Høiland-Jørgensen 
174552539ca8SToke Høiland-Jørgensen /**
17466de39808SJohannes Berg  * struct cfg80211_tid_stats - per-TID statistics
17476de39808SJohannes Berg  * @filled: bitmap of flags using the bits of &enum nl80211_tid_stats to
17486de39808SJohannes Berg  *	indicate the relevant values in this struct are filled
17496de39808SJohannes Berg  * @rx_msdu: number of received MSDUs
17506de39808SJohannes Berg  * @tx_msdu: number of (attempted) transmitted MSDUs
17516de39808SJohannes Berg  * @tx_msdu_retries: number of retries (not counting the first) for
17526de39808SJohannes Berg  *	transmitted MSDUs
17536de39808SJohannes Berg  * @tx_msdu_failed: number of failed transmitted MSDUs
175452539ca8SToke Høiland-Jørgensen  * @txq_stats: TXQ statistics
17556de39808SJohannes Berg  */
17566de39808SJohannes Berg struct cfg80211_tid_stats {
17576de39808SJohannes Berg 	u32 filled;
17586de39808SJohannes Berg 	u64 rx_msdu;
17596de39808SJohannes Berg 	u64 tx_msdu;
17606de39808SJohannes Berg 	u64 tx_msdu_retries;
17616de39808SJohannes Berg 	u64 tx_msdu_failed;
176252539ca8SToke Høiland-Jørgensen 	struct cfg80211_txq_stats txq_stats;
17636de39808SJohannes Berg };
17646de39808SJohannes Berg 
1765119363c7SFelix Fietkau #define IEEE80211_MAX_CHAINS	4
1766119363c7SFelix Fietkau 
1767f4263c98SPaul Stewart /**
17682ec600d6SLuis Carlos Cobo  * struct station_info - station information
1769fd5b74dcSJohannes Berg  *
17702ec600d6SLuis Carlos Cobo  * Station information filled by driver for get_station() and dump_station.
1771fd5b74dcSJohannes Berg  *
1772319090bfSJohannes Berg  * @filled: bitflag of flags using the bits of &enum nl80211_sta_info to
1773319090bfSJohannes Berg  *	indicate the relevant values in this struct for them
1774ebe27c91SMohammed Shafi Shajakhan  * @connected_time: time(in secs) since a station is last connected
1775fd5b74dcSJohannes Berg  * @inactive_time: time since last station activity (tx/rx) in milliseconds
17766c7a0033SBen Greear  * @assoc_at: bootime (ns) of the last association
17778d791361SJohannes Berg  * @rx_bytes: bytes (size of MPDUs) received from this station
17788d791361SJohannes Berg  * @tx_bytes: bytes (size of MPDUs) transmitted to this station
17792ec600d6SLuis Carlos Cobo  * @llid: mesh local link id
17802ec600d6SLuis Carlos Cobo  * @plid: mesh peer link id
17812ec600d6SLuis Carlos Cobo  * @plink_state: mesh peer link state
178273c3df3bSJohannes Berg  * @signal: The signal strength, type depends on the wiphy's signal_type.
178373c3df3bSJohannes Berg  *	For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
178473c3df3bSJohannes Berg  * @signal_avg: Average signal strength, type depends on the wiphy's signal_type.
178573c3df3bSJohannes Berg  *	For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
1786119363c7SFelix Fietkau  * @chains: bitmask for filled values in @chain_signal, @chain_signal_avg
1787119363c7SFelix Fietkau  * @chain_signal: per-chain signal strength of last received packet in dBm
1788119363c7SFelix Fietkau  * @chain_signal_avg: per-chain signal strength average in dBm
1789858022aaSRandy Dunlap  * @txrate: current unicast bitrate from this station
1790858022aaSRandy Dunlap  * @rxrate: current unicast bitrate to this station
17918d791361SJohannes Berg  * @rx_packets: packets (MSDUs & MMPDUs) received from this station
17928d791361SJohannes Berg  * @tx_packets: packets (MSDUs & MMPDUs) transmitted to this station
17938d791361SJohannes Berg  * @tx_retries: cumulative retry counts (MPDUs)
17948d791361SJohannes Berg  * @tx_failed: number of failed transmissions (MPDUs) (retries exceeded, no ACK)
17955a5c731aSBen Greear  * @rx_dropped_misc:  Dropped for un-specified reason.
17961ba01458SRandy Dunlap  * @bss_param: current BSS parameters
1797f5ea9120SJohannes Berg  * @generation: generation number for nl80211 dumps.
1798f5ea9120SJohannes Berg  *	This number should increase every time the list of stations
1799f5ea9120SJohannes Berg  *	changes, i.e. when a station is added or removed, so that
1800f5ea9120SJohannes Berg  *	userspace can tell whether it got a consistent snapshot.
180150d3dfb7SJouni Malinen  * @assoc_req_ies: IEs from (Re)Association Request.
180250d3dfb7SJouni Malinen  *	This is used only when in AP mode with drivers that do not use
180350d3dfb7SJouni Malinen  *	user space MLME/SME implementation. The information is provided for
180450d3dfb7SJouni Malinen  *	the cfg80211_new_sta() calls to notify user space of the IEs.
180550d3dfb7SJouni Malinen  * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets.
1806c26887d2SJohannes Berg  * @sta_flags: station flags mask & values
1807a85e1d55SPaul Stewart  * @beacon_loss_count: Number of times beacon loss event has triggered.
1808d299a1f2SJavier Cardona  * @t_offset: Time offset of the station relative to this host.
18093b1c5a53SMarco Porsch  * @local_pm: local mesh STA power save mode
18103b1c5a53SMarco Porsch  * @peer_pm: peer mesh STA power save mode
18113b1c5a53SMarco Porsch  * @nonpeer_pm: non-peer mesh STA power save mode
1812867d849fSAntonio Quartulli  * @expected_throughput: expected throughput in kbps (including 802.11 headers)
1813867d849fSAntonio Quartulli  *	towards this station.
1814a76b1942SJohannes Berg  * @rx_beacon: number of beacons received from this peer
1815a76b1942SJohannes Berg  * @rx_beacon_signal_avg: signal strength average (in dBm) for beacons received
1816a76b1942SJohannes Berg  *	from this peer
1817dbdaee7aSBob Copeland  * @connected_to_gate: true if mesh STA has a path to mesh gate
1818739960f1SMohammed Shafi Shajakhan  * @rx_duration: aggregate PPDU duration(usecs) for all the frames from a peer
181936647055SToke Høiland-Jørgensen  * @tx_duration: aggregate PPDU duration(usecs) for all the frames to a peer
182036647055SToke Høiland-Jørgensen  * @airtime_weight: current airtime scheduling weight
18216de39808SJohannes Berg  * @pertid: per-TID statistics, see &struct cfg80211_tid_stats, using the last
18226de39808SJohannes Berg  *	(IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs.
18238689c051SArend van Spriel  *	Note that this doesn't use the @filled bit, but is used if non-NULL.
1824c4b50cd3SVenkateswara Naralasetty  * @ack_signal: signal strength (in dBm) of the last ACK frame.
182581d5439dSBalaji Pothunoori  * @avg_ack_signal: average rssi value of ack packet for the no of msdu's has
182681d5439dSBalaji Pothunoori  *	been sent.
18270d4e14a3SAnkita Bajaj  * @rx_mpdu_count: number of MPDUs received from this station
18280d4e14a3SAnkita Bajaj  * @fcs_err_count: number of packets (MPDUs) received from this station with
18290d4e14a3SAnkita Bajaj  *	an FCS error. This counter should be incremented only when TA of the
18300d4e14a3SAnkita Bajaj  *	received packet with an FCS error matches the peer MAC address.
1831ab60633cSNarayanraddi Masti  * @airtime_link_metric: mesh airtime link metric.
18321303a51cSMarkus Theil  * @connected_to_as: true if mesh STA has a path to authentication server
1833fd5b74dcSJohannes Berg  */
18342ec600d6SLuis Carlos Cobo struct station_info {
1835739960f1SMohammed Shafi Shajakhan 	u64 filled;
1836ebe27c91SMohammed Shafi Shajakhan 	u32 connected_time;
1837fd5b74dcSJohannes Berg 	u32 inactive_time;
18386c7a0033SBen Greear 	u64 assoc_at;
183942745e03SVladimir Kondratiev 	u64 rx_bytes;
184042745e03SVladimir Kondratiev 	u64 tx_bytes;
18412ec600d6SLuis Carlos Cobo 	u16 llid;
18422ec600d6SLuis Carlos Cobo 	u16 plid;
18432ec600d6SLuis Carlos Cobo 	u8 plink_state;
1844420e7fabSHenning Rogge 	s8 signal;
1845541a45a1SBruno Randolf 	s8 signal_avg;
1846119363c7SFelix Fietkau 
1847119363c7SFelix Fietkau 	u8 chains;
1848119363c7SFelix Fietkau 	s8 chain_signal[IEEE80211_MAX_CHAINS];
1849119363c7SFelix Fietkau 	s8 chain_signal_avg[IEEE80211_MAX_CHAINS];
1850119363c7SFelix Fietkau 
1851420e7fabSHenning Rogge 	struct rate_info txrate;
1852c8dcfd8aSFelix Fietkau 	struct rate_info rxrate;
185398c8a60aSJouni Malinen 	u32 rx_packets;
185498c8a60aSJouni Malinen 	u32 tx_packets;
1855b206b4efSBruno Randolf 	u32 tx_retries;
1856b206b4efSBruno Randolf 	u32 tx_failed;
18575a5c731aSBen Greear 	u32 rx_dropped_misc;
1858f4263c98SPaul Stewart 	struct sta_bss_parameters bss_param;
1859bb6e753eSHelmut Schaa 	struct nl80211_sta_flag_update sta_flags;
1860f5ea9120SJohannes Berg 
1861f5ea9120SJohannes Berg 	int generation;
186250d3dfb7SJouni Malinen 
186350d3dfb7SJouni Malinen 	const u8 *assoc_req_ies;
186450d3dfb7SJouni Malinen 	size_t assoc_req_ies_len;
1865f612cedfSJouni Malinen 
1866a85e1d55SPaul Stewart 	u32 beacon_loss_count;
1867d299a1f2SJavier Cardona 	s64 t_offset;
18683b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode local_pm;
18693b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode peer_pm;
18703b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode nonpeer_pm;
1871a85e1d55SPaul Stewart 
1872867d849fSAntonio Quartulli 	u32 expected_throughput;
1873a76b1942SJohannes Berg 
187436647055SToke Høiland-Jørgensen 	u64 tx_duration;
1875739960f1SMohammed Shafi Shajakhan 	u64 rx_duration;
187636647055SToke Høiland-Jørgensen 	u64 rx_beacon;
1877a76b1942SJohannes Berg 	u8 rx_beacon_signal_avg;
1878dbdaee7aSBob Copeland 	u8 connected_to_gate;
1879dbdaee7aSBob Copeland 
18808689c051SArend van Spriel 	struct cfg80211_tid_stats *pertid;
1881c4b50cd3SVenkateswara Naralasetty 	s8 ack_signal;
188281d5439dSBalaji Pothunoori 	s8 avg_ack_signal;
18830d4e14a3SAnkita Bajaj 
188436647055SToke Høiland-Jørgensen 	u16 airtime_weight;
188536647055SToke Høiland-Jørgensen 
18860d4e14a3SAnkita Bajaj 	u32 rx_mpdu_count;
18870d4e14a3SAnkita Bajaj 	u32 fcs_err_count;
1888ab60633cSNarayanraddi Masti 
1889ab60633cSNarayanraddi Masti 	u32 airtime_link_metric;
18901303a51cSMarkus Theil 
18911303a51cSMarkus Theil 	u8 connected_to_as;
1892fd5b74dcSJohannes Berg };
1893fd5b74dcSJohannes Berg 
18946bdb68ceSCarl Huang /**
18956bdb68ceSCarl Huang  * struct cfg80211_sar_sub_specs - sub specs limit
18966bdb68ceSCarl Huang  * @power: power limitation in 0.25dbm
18976bdb68ceSCarl Huang  * @freq_range_index: index the power limitation applies to
18986bdb68ceSCarl Huang  */
18996bdb68ceSCarl Huang struct cfg80211_sar_sub_specs {
19006bdb68ceSCarl Huang 	s32 power;
19016bdb68ceSCarl Huang 	u32 freq_range_index;
19026bdb68ceSCarl Huang };
19036bdb68ceSCarl Huang 
19046bdb68ceSCarl Huang /**
19056bdb68ceSCarl Huang  * struct cfg80211_sar_specs - sar limit specs
19066bdb68ceSCarl Huang  * @type: it's set with power in 0.25dbm or other types
19076bdb68ceSCarl Huang  * @num_sub_specs: number of sar sub specs
19086bdb68ceSCarl Huang  * @sub_specs: memory to hold the sar sub specs
19096bdb68ceSCarl Huang  */
19106bdb68ceSCarl Huang struct cfg80211_sar_specs {
19116bdb68ceSCarl Huang 	enum nl80211_sar_type type;
19126bdb68ceSCarl Huang 	u32 num_sub_specs;
19136bdb68ceSCarl Huang 	struct cfg80211_sar_sub_specs sub_specs[];
19146bdb68ceSCarl Huang };
19156bdb68ceSCarl Huang 
19166bdb68ceSCarl Huang 
19176bdb68ceSCarl Huang /**
1918c2083e28SMauro Carvalho Chehab  * struct cfg80211_sar_freq_ranges - sar frequency ranges
19196bdb68ceSCarl Huang  * @start_freq:  start range edge frequency
19206bdb68ceSCarl Huang  * @end_freq:    end range edge frequency
19216bdb68ceSCarl Huang  */
19226bdb68ceSCarl Huang struct cfg80211_sar_freq_ranges {
19236bdb68ceSCarl Huang 	u32 start_freq;
19246bdb68ceSCarl Huang 	u32 end_freq;
19256bdb68ceSCarl Huang };
19266bdb68ceSCarl Huang 
19276bdb68ceSCarl Huang /**
19286bdb68ceSCarl Huang  * struct cfg80211_sar_capa - sar limit capability
19296bdb68ceSCarl Huang  * @type: it's set via power in 0.25dbm or other types
19306bdb68ceSCarl Huang  * @num_freq_ranges: number of frequency ranges
19316bdb68ceSCarl Huang  * @freq_ranges: memory to hold the freq ranges.
19326bdb68ceSCarl Huang  *
19336bdb68ceSCarl Huang  * Note: WLAN driver may append new ranges or split an existing
19346bdb68ceSCarl Huang  * range to small ones and then append them.
19356bdb68ceSCarl Huang  */
19366bdb68ceSCarl Huang struct cfg80211_sar_capa {
19376bdb68ceSCarl Huang 	enum nl80211_sar_type type;
19386bdb68ceSCarl Huang 	u32 num_freq_ranges;
19396bdb68ceSCarl Huang 	const struct cfg80211_sar_freq_ranges *freq_ranges;
19406bdb68ceSCarl Huang };
19416bdb68ceSCarl Huang 
194261aaa0e8SLinus Lüssing #if IS_ENABLED(CONFIG_CFG80211)
194366f7ac50SMichael Wu /**
19447406353dSAntonio Quartulli  * cfg80211_get_station - retrieve information about a given station
19457406353dSAntonio Quartulli  * @dev: the device where the station is supposed to be connected to
19467406353dSAntonio Quartulli  * @mac_addr: the mac address of the station of interest
19477406353dSAntonio Quartulli  * @sinfo: pointer to the structure to fill with the information
19487406353dSAntonio Quartulli  *
19497406353dSAntonio Quartulli  * Returns 0 on success and sinfo is filled with the available information
19507406353dSAntonio Quartulli  * otherwise returns a negative error code and the content of sinfo has to be
19517406353dSAntonio Quartulli  * considered undefined.
19527406353dSAntonio Quartulli  */
19537406353dSAntonio Quartulli int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr,
19547406353dSAntonio Quartulli 			 struct station_info *sinfo);
195561aaa0e8SLinus Lüssing #else
195661aaa0e8SLinus Lüssing static inline int cfg80211_get_station(struct net_device *dev,
195761aaa0e8SLinus Lüssing 				       const u8 *mac_addr,
195861aaa0e8SLinus Lüssing 				       struct station_info *sinfo)
195961aaa0e8SLinus Lüssing {
196061aaa0e8SLinus Lüssing 	return -ENOENT;
196161aaa0e8SLinus Lüssing }
196261aaa0e8SLinus Lüssing #endif
19637406353dSAntonio Quartulli 
19647406353dSAntonio Quartulli /**
196566f7ac50SMichael Wu  * enum monitor_flags - monitor flags
196666f7ac50SMichael Wu  *
196766f7ac50SMichael Wu  * Monitor interface configuration flags. Note that these must be the bits
196866f7ac50SMichael Wu  * according to the nl80211 flags.
196966f7ac50SMichael Wu  *
1970818a986eSJohannes Berg  * @MONITOR_FLAG_CHANGED: set if the flags were changed
197166f7ac50SMichael Wu  * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS
197266f7ac50SMichael Wu  * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP
197366f7ac50SMichael Wu  * @MONITOR_FLAG_CONTROL: pass control frames
197466f7ac50SMichael Wu  * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering
197566f7ac50SMichael Wu  * @MONITOR_FLAG_COOK_FRAMES: report frames after processing
1976e057d3c3SFelix Fietkau  * @MONITOR_FLAG_ACTIVE: active monitor, ACKs frames on its MAC address
197766f7ac50SMichael Wu  */
197866f7ac50SMichael Wu enum monitor_flags {
1979818a986eSJohannes Berg 	MONITOR_FLAG_CHANGED		= 1<<__NL80211_MNTR_FLAG_INVALID,
198066f7ac50SMichael Wu 	MONITOR_FLAG_FCSFAIL		= 1<<NL80211_MNTR_FLAG_FCSFAIL,
198166f7ac50SMichael Wu 	MONITOR_FLAG_PLCPFAIL		= 1<<NL80211_MNTR_FLAG_PLCPFAIL,
198266f7ac50SMichael Wu 	MONITOR_FLAG_CONTROL		= 1<<NL80211_MNTR_FLAG_CONTROL,
198366f7ac50SMichael Wu 	MONITOR_FLAG_OTHER_BSS		= 1<<NL80211_MNTR_FLAG_OTHER_BSS,
198466f7ac50SMichael Wu 	MONITOR_FLAG_COOK_FRAMES	= 1<<NL80211_MNTR_FLAG_COOK_FRAMES,
1985e057d3c3SFelix Fietkau 	MONITOR_FLAG_ACTIVE		= 1<<NL80211_MNTR_FLAG_ACTIVE,
198666f7ac50SMichael Wu };
198766f7ac50SMichael Wu 
19882ec600d6SLuis Carlos Cobo /**
19892ec600d6SLuis Carlos Cobo  * enum mpath_info_flags -  mesh path information flags
19902ec600d6SLuis Carlos Cobo  *
19912ec600d6SLuis Carlos Cobo  * Used by the driver to indicate which info in &struct mpath_info it has filled
19922ec600d6SLuis Carlos Cobo  * in during get_station() or dump_station().
19932ec600d6SLuis Carlos Cobo  *
1994abe37c4bSJohannes Berg  * @MPATH_INFO_FRAME_QLEN: @frame_qlen filled
1995abe37c4bSJohannes Berg  * @MPATH_INFO_SN: @sn filled
1996abe37c4bSJohannes Berg  * @MPATH_INFO_METRIC: @metric filled
1997abe37c4bSJohannes Berg  * @MPATH_INFO_EXPTIME: @exptime filled
1998abe37c4bSJohannes Berg  * @MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled
1999abe37c4bSJohannes Berg  * @MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled
2000abe37c4bSJohannes Berg  * @MPATH_INFO_FLAGS: @flags filled
2001cc241636SJulan Hsu  * @MPATH_INFO_HOP_COUNT: @hop_count filled
20029874b71fSJohannes Berg  * @MPATH_INFO_PATH_CHANGE: @path_change_count filled
20032ec600d6SLuis Carlos Cobo  */
20042ec600d6SLuis Carlos Cobo enum mpath_info_flags {
20052ec600d6SLuis Carlos Cobo 	MPATH_INFO_FRAME_QLEN		= BIT(0),
2006d19b3bf6SRui Paulo 	MPATH_INFO_SN			= BIT(1),
20072ec600d6SLuis Carlos Cobo 	MPATH_INFO_METRIC		= BIT(2),
20082ec600d6SLuis Carlos Cobo 	MPATH_INFO_EXPTIME		= BIT(3),
20092ec600d6SLuis Carlos Cobo 	MPATH_INFO_DISCOVERY_TIMEOUT	= BIT(4),
20102ec600d6SLuis Carlos Cobo 	MPATH_INFO_DISCOVERY_RETRIES	= BIT(5),
20112ec600d6SLuis Carlos Cobo 	MPATH_INFO_FLAGS		= BIT(6),
2012540bbcb9SJulan Hsu 	MPATH_INFO_HOP_COUNT		= BIT(7),
2013540bbcb9SJulan Hsu 	MPATH_INFO_PATH_CHANGE		= BIT(8),
20142ec600d6SLuis Carlos Cobo };
20152ec600d6SLuis Carlos Cobo 
20162ec600d6SLuis Carlos Cobo /**
20172ec600d6SLuis Carlos Cobo  * struct mpath_info - mesh path information
20182ec600d6SLuis Carlos Cobo  *
20192ec600d6SLuis Carlos Cobo  * Mesh path information filled by driver for get_mpath() and dump_mpath().
20202ec600d6SLuis Carlos Cobo  *
20212ec600d6SLuis Carlos Cobo  * @filled: bitfield of flags from &enum mpath_info_flags
20222ec600d6SLuis Carlos Cobo  * @frame_qlen: number of queued frames for this destination
2023d19b3bf6SRui Paulo  * @sn: target sequence number
20242ec600d6SLuis Carlos Cobo  * @metric: metric (cost) of this mesh path
20252ec600d6SLuis Carlos Cobo  * @exptime: expiration time for the mesh path from now, in msecs
20262ec600d6SLuis Carlos Cobo  * @flags: mesh path flags
20272ec600d6SLuis Carlos Cobo  * @discovery_timeout: total mesh path discovery timeout, in msecs
20282ec600d6SLuis Carlos Cobo  * @discovery_retries: mesh path discovery retries
2029f5ea9120SJohannes Berg  * @generation: generation number for nl80211 dumps.
2030f5ea9120SJohannes Berg  *	This number should increase every time the list of mesh paths
2031f5ea9120SJohannes Berg  *	changes, i.e. when a station is added or removed, so that
2032f5ea9120SJohannes Berg  *	userspace can tell whether it got a consistent snapshot.
2033cc241636SJulan Hsu  * @hop_count: hops to destination
2034540bbcb9SJulan Hsu  * @path_change_count: total number of path changes to destination
20352ec600d6SLuis Carlos Cobo  */
20362ec600d6SLuis Carlos Cobo struct mpath_info {
20372ec600d6SLuis Carlos Cobo 	u32 filled;
20382ec600d6SLuis Carlos Cobo 	u32 frame_qlen;
2039d19b3bf6SRui Paulo 	u32 sn;
20402ec600d6SLuis Carlos Cobo 	u32 metric;
20412ec600d6SLuis Carlos Cobo 	u32 exptime;
20422ec600d6SLuis Carlos Cobo 	u32 discovery_timeout;
20432ec600d6SLuis Carlos Cobo 	u8 discovery_retries;
20442ec600d6SLuis Carlos Cobo 	u8 flags;
2045cc241636SJulan Hsu 	u8 hop_count;
2046540bbcb9SJulan Hsu 	u32 path_change_count;
2047f5ea9120SJohannes Berg 
2048f5ea9120SJohannes Berg 	int generation;
20492ec600d6SLuis Carlos Cobo };
20502ec600d6SLuis Carlos Cobo 
20519f1ba906SJouni Malinen /**
20529f1ba906SJouni Malinen  * struct bss_parameters - BSS parameters
20539f1ba906SJouni Malinen  *
20549f1ba906SJouni Malinen  * Used to change BSS parameters (mainly for AP mode).
20559f1ba906SJouni Malinen  *
20569f1ba906SJouni Malinen  * @use_cts_prot: Whether to use CTS protection
20579f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
20589f1ba906SJouni Malinen  * @use_short_preamble: Whether the use of short preambles is allowed
20599f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
20609f1ba906SJouni Malinen  * @use_short_slot_time: Whether the use of short slot time is allowed
20619f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
206290c97a04SJouni Malinen  * @basic_rates: basic rates in IEEE 802.11 format
206390c97a04SJouni Malinen  *	(or NULL for no change)
206490c97a04SJouni Malinen  * @basic_rates_len: number of basic rates
2065fd8aaaf3SFelix Fietkau  * @ap_isolate: do not forward packets between connected stations
20669d6e371dSWright Feng  *	(0 = no, 1 = yes, -1 = do not change)
206750b12f59SHelmut Schaa  * @ht_opmode: HT Operation mode
206850b12f59SHelmut Schaa  *	(u16 = opmode, -1 = do not change)
206953cabad7SJohannes Berg  * @p2p_ctwindow: P2P CT Window (-1 = no change)
207053cabad7SJohannes Berg  * @p2p_opp_ps: P2P opportunistic PS (-1 = no change)
20719f1ba906SJouni Malinen  */
20729f1ba906SJouni Malinen struct bss_parameters {
20739f1ba906SJouni Malinen 	int use_cts_prot;
20749f1ba906SJouni Malinen 	int use_short_preamble;
20759f1ba906SJouni Malinen 	int use_short_slot_time;
2076c1e5f471SJohannes Berg 	const u8 *basic_rates;
207790c97a04SJouni Malinen 	u8 basic_rates_len;
2078fd8aaaf3SFelix Fietkau 	int ap_isolate;
207950b12f59SHelmut Schaa 	int ht_opmode;
208053cabad7SJohannes Berg 	s8 p2p_ctwindow, p2p_opp_ps;
20819f1ba906SJouni Malinen };
20822ec600d6SLuis Carlos Cobo 
20833ddd53f3SChun-Yeow Yeoh /**
208429cbe68cSJohannes Berg  * struct mesh_config - 802.11s mesh configuration
208529cbe68cSJohannes Berg  *
208629cbe68cSJohannes Berg  * These parameters can be changed while the mesh is active.
20873ddd53f3SChun-Yeow Yeoh  *
20883ddd53f3SChun-Yeow Yeoh  * @dot11MeshRetryTimeout: the initial retry timeout in millisecond units used
20893ddd53f3SChun-Yeow Yeoh  *	by the Mesh Peering Open message
20903ddd53f3SChun-Yeow Yeoh  * @dot11MeshConfirmTimeout: the initial retry timeout in millisecond units
20913ddd53f3SChun-Yeow Yeoh  *	used by the Mesh Peering Open message
20923ddd53f3SChun-Yeow Yeoh  * @dot11MeshHoldingTimeout: the confirm timeout in millisecond units used by
20933ddd53f3SChun-Yeow Yeoh  *	the mesh peering management to close a mesh peering
20943ddd53f3SChun-Yeow Yeoh  * @dot11MeshMaxPeerLinks: the maximum number of peer links allowed on this
20953ddd53f3SChun-Yeow Yeoh  *	mesh interface
20963ddd53f3SChun-Yeow Yeoh  * @dot11MeshMaxRetries: the maximum number of peer link open retries that can
20973ddd53f3SChun-Yeow Yeoh  *	be sent to establish a new peer link instance in a mesh
20983ddd53f3SChun-Yeow Yeoh  * @dot11MeshTTL: the value of TTL field set at a source mesh STA
20993ddd53f3SChun-Yeow Yeoh  * @element_ttl: the value of TTL field set at a mesh STA for path selection
21003ddd53f3SChun-Yeow Yeoh  *	elements
21013ddd53f3SChun-Yeow Yeoh  * @auto_open_plinks: whether we should automatically open peer links when we
21023ddd53f3SChun-Yeow Yeoh  *	detect compatible mesh peers
21033ddd53f3SChun-Yeow Yeoh  * @dot11MeshNbrOffsetMaxNeighbor: the maximum number of neighbors to
21043ddd53f3SChun-Yeow Yeoh  *	synchronize to for 11s default synchronization method
21053ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPmaxPREQretries: the number of action frames containing a PREQ
21063ddd53f3SChun-Yeow Yeoh  *	that an originator mesh STA can send to a particular path target
21073ddd53f3SChun-Yeow Yeoh  * @path_refresh_time: how frequently to refresh mesh paths in milliseconds
21083ddd53f3SChun-Yeow Yeoh  * @min_discovery_timeout: the minimum length of time to wait until giving up on
21093ddd53f3SChun-Yeow Yeoh  *	a path discovery in milliseconds
21103ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPactivePathTimeout: the time (in TUs) for which mesh STAs
21113ddd53f3SChun-Yeow Yeoh  *	receiving a PREQ shall consider the forwarding information from the
21123ddd53f3SChun-Yeow Yeoh  *	root to be valid. (TU = time unit)
21133ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPpreqMinInterval: the minimum interval of time (in TUs) during
21143ddd53f3SChun-Yeow Yeoh  *	which a mesh STA can send only one action frame containing a PREQ
21153ddd53f3SChun-Yeow Yeoh  *	element
21163ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPperrMinInterval: the minimum interval of time (in TUs) during
21173ddd53f3SChun-Yeow Yeoh  *	which a mesh STA can send only one Action frame containing a PERR
21183ddd53f3SChun-Yeow Yeoh  *	element
21193ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPnetDiameterTraversalTime: the interval of time (in TUs) that
21203ddd53f3SChun-Yeow Yeoh  *	it takes for an HWMP information element to propagate across the mesh
21213ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPRootMode: the configuration of a mesh STA as root mesh STA
21223ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPRannInterval: the interval of time (in TUs) between root
21233ddd53f3SChun-Yeow Yeoh  *	announcements are transmitted
21243ddd53f3SChun-Yeow Yeoh  * @dot11MeshGateAnnouncementProtocol: whether to advertise that this mesh
21253ddd53f3SChun-Yeow Yeoh  *	station has access to a broader network beyond the MBSS. (This is
21263ddd53f3SChun-Yeow Yeoh  *	missnamed in draft 12.0: dot11MeshGateAnnouncementProtocol set to true
21273ddd53f3SChun-Yeow Yeoh  *	only means that the station will announce others it's a mesh gate, but
21283ddd53f3SChun-Yeow Yeoh  *	not necessarily using the gate announcement protocol. Still keeping the
21293ddd53f3SChun-Yeow Yeoh  *	same nomenclature to be in sync with the spec)
21303ddd53f3SChun-Yeow Yeoh  * @dot11MeshForwarding: whether the Mesh STA is forwarding or non-forwarding
21313ddd53f3SChun-Yeow Yeoh  *	entity (default is TRUE - forwarding entity)
21323ddd53f3SChun-Yeow Yeoh  * @rssi_threshold: the threshold for average signal strength of candidate
21333ddd53f3SChun-Yeow Yeoh  *	station to establish a peer link
21343ddd53f3SChun-Yeow Yeoh  * @ht_opmode: mesh HT protection mode
2135ac1073a6SChun-Yeow Yeoh  *
2136ac1073a6SChun-Yeow Yeoh  * @dot11MeshHWMPactivePathToRootTimeout: The time (in TUs) for which mesh STAs
2137ac1073a6SChun-Yeow Yeoh  *	receiving a proactive PREQ shall consider the forwarding information to
2138ac1073a6SChun-Yeow Yeoh  *	the root mesh STA to be valid.
2139ac1073a6SChun-Yeow Yeoh  *
2140ac1073a6SChun-Yeow Yeoh  * @dot11MeshHWMProotInterval: The interval of time (in TUs) between proactive
2141ac1073a6SChun-Yeow Yeoh  *	PREQs are transmitted.
2142728b19e5SChun-Yeow Yeoh  * @dot11MeshHWMPconfirmationInterval: The minimum interval of time (in TUs)
2143728b19e5SChun-Yeow Yeoh  *	during which a mesh STA can send only one Action frame containing
2144728b19e5SChun-Yeow Yeoh  *	a PREQ element for root path confirmation.
21453b1c5a53SMarco Porsch  * @power_mode: The default mesh power save mode which will be the initial
21463b1c5a53SMarco Porsch  *	setting for new peer links.
21473b1c5a53SMarco Porsch  * @dot11MeshAwakeWindowDuration: The duration in TUs the STA will remain awake
21483b1c5a53SMarco Porsch  *	after transmitting its beacon.
21498e7c0538SColleen Twitty  * @plink_timeout: If no tx activity is seen from a STA we've established
21508e7c0538SColleen Twitty  *	peering with for longer than this time (in seconds), then remove it
21518e7c0538SColleen Twitty  *	from the STA's list of peers.  Default is 30 minutes.
215201d66fbdSBob Copeland  * @dot11MeshConnectedToMeshGate: if set to true, advertise that this STA is
215301d66fbdSBob Copeland  *      connected to a mesh gate in mesh formation info.  If false, the
215401d66fbdSBob Copeland  *      value in mesh formation is determined by the presence of root paths
215501d66fbdSBob Copeland  *      in the mesh path table
2156e3718a61SLinus Lüssing  * @dot11MeshNolearn: Try to avoid multi-hop path discovery (e.g. PREQ/PREP
2157e3718a61SLinus Lüssing  *      for HWMP) if the destination is a direct neighbor. Note that this might
2158e3718a61SLinus Lüssing  *      not be the optimal decision as a multi-hop route might be better. So
2159e3718a61SLinus Lüssing  *      if using this setting you will likely also want to disable
2160e3718a61SLinus Lüssing  *      dot11MeshForwarding and use another mesh routing protocol on top.
216129cbe68cSJohannes Berg  */
216293da9cc1Scolin@cozybit.com struct mesh_config {
216393da9cc1Scolin@cozybit.com 	u16 dot11MeshRetryTimeout;
216493da9cc1Scolin@cozybit.com 	u16 dot11MeshConfirmTimeout;
216593da9cc1Scolin@cozybit.com 	u16 dot11MeshHoldingTimeout;
216693da9cc1Scolin@cozybit.com 	u16 dot11MeshMaxPeerLinks;
216793da9cc1Scolin@cozybit.com 	u8 dot11MeshMaxRetries;
216893da9cc1Scolin@cozybit.com 	u8 dot11MeshTTL;
216945904f21SJavier Cardona 	u8 element_ttl;
217093da9cc1Scolin@cozybit.com 	bool auto_open_plinks;
2171d299a1f2SJavier Cardona 	u32 dot11MeshNbrOffsetMaxNeighbor;
217293da9cc1Scolin@cozybit.com 	u8 dot11MeshHWMPmaxPREQretries;
217393da9cc1Scolin@cozybit.com 	u32 path_refresh_time;
217493da9cc1Scolin@cozybit.com 	u16 min_discovery_timeout;
217593da9cc1Scolin@cozybit.com 	u32 dot11MeshHWMPactivePathTimeout;
217693da9cc1Scolin@cozybit.com 	u16 dot11MeshHWMPpreqMinInterval;
2177dca7e943SThomas Pedersen 	u16 dot11MeshHWMPperrMinInterval;
217893da9cc1Scolin@cozybit.com 	u16 dot11MeshHWMPnetDiameterTraversalTime;
217963c5723bSRui Paulo 	u8 dot11MeshHWMPRootMode;
218001d66fbdSBob Copeland 	bool dot11MeshConnectedToMeshGate;
2181184eebe6SMarkus Theil 	bool dot11MeshConnectedToAuthServer;
21820507e159SJavier Cardona 	u16 dot11MeshHWMPRannInterval;
218316dd7267SJavier Cardona 	bool dot11MeshGateAnnouncementProtocol;
218494f90656SChun-Yeow Yeoh 	bool dot11MeshForwarding;
218555335137SAshok Nagarajan 	s32 rssi_threshold;
218670c33eaaSAshok Nagarajan 	u16 ht_opmode;
2187ac1073a6SChun-Yeow Yeoh 	u32 dot11MeshHWMPactivePathToRootTimeout;
2188ac1073a6SChun-Yeow Yeoh 	u16 dot11MeshHWMProotInterval;
2189728b19e5SChun-Yeow Yeoh 	u16 dot11MeshHWMPconfirmationInterval;
21903b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode power_mode;
21913b1c5a53SMarco Porsch 	u16 dot11MeshAwakeWindowDuration;
21928e7c0538SColleen Twitty 	u32 plink_timeout;
2193e3718a61SLinus Lüssing 	bool dot11MeshNolearn;
219493da9cc1Scolin@cozybit.com };
219593da9cc1Scolin@cozybit.com 
219631888487SJouni Malinen /**
219729cbe68cSJohannes Berg  * struct mesh_setup - 802.11s mesh setup configuration
2198683b6d3bSJohannes Berg  * @chandef: defines the channel to use
219929cbe68cSJohannes Berg  * @mesh_id: the mesh ID
220029cbe68cSJohannes Berg  * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes
2201d299a1f2SJavier Cardona  * @sync_method: which synchronization method to use
2202c80d545dSJavier Cardona  * @path_sel_proto: which path selection protocol to use
2203c80d545dSJavier Cardona  * @path_metric: which metric to use
22046e16d90bSColleen Twitty  * @auth_id: which authentication method this mesh is using
2205581a8b0fSJavier Cardona  * @ie: vendor information elements (optional)
2206581a8b0fSJavier Cardona  * @ie_len: length of vendor information elements
2207b130e5ceSJavier Cardona  * @is_authenticated: this mesh requires authentication
2208b130e5ceSJavier Cardona  * @is_secure: this mesh uses security
2209bb2798d4SThomas Pedersen  * @user_mpm: userspace handles all MPM functions
22109bdbf04dSMarco Porsch  * @dtim_period: DTIM period to use
22119bdbf04dSMarco Porsch  * @beacon_interval: beacon interval to use
22124bb62344SChun-Yeow Yeoh  * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a]
2213ffb3cf30SAshok Nagarajan  * @basic_rates: basic rates to use when creating the mesh
22148564e382SJohannes Berg  * @beacon_rate: bitrate to be used for beacons
2215d37d49c2SBenjamin Berg  * @userspace_handles_dfs: whether user space controls DFS operation, i.e.
2216d37d49c2SBenjamin Berg  *	changes the channel when a radar is detected. This is required
2217d37d49c2SBenjamin Berg  *	to operate on DFS channels.
22181224f583SDenis Kenzior  * @control_port_over_nl80211: TRUE if userspace expects to exchange control
22191224f583SDenis Kenzior  *	port frames over NL80211 instead of the network interface.
222029cbe68cSJohannes Berg  *
222129cbe68cSJohannes Berg  * These parameters are fixed when the mesh is created.
222229cbe68cSJohannes Berg  */
222329cbe68cSJohannes Berg struct mesh_setup {
2224683b6d3bSJohannes Berg 	struct cfg80211_chan_def chandef;
222529cbe68cSJohannes Berg 	const u8 *mesh_id;
222629cbe68cSJohannes Berg 	u8 mesh_id_len;
2227d299a1f2SJavier Cardona 	u8 sync_method;
2228c80d545dSJavier Cardona 	u8 path_sel_proto;
2229c80d545dSJavier Cardona 	u8 path_metric;
22306e16d90bSColleen Twitty 	u8 auth_id;
2231581a8b0fSJavier Cardona 	const u8 *ie;
2232581a8b0fSJavier Cardona 	u8 ie_len;
2233b130e5ceSJavier Cardona 	bool is_authenticated;
223415d5dda6SJavier Cardona 	bool is_secure;
2235bb2798d4SThomas Pedersen 	bool user_mpm;
22369bdbf04dSMarco Porsch 	u8 dtim_period;
22379bdbf04dSMarco Porsch 	u16 beacon_interval;
223857fbcce3SJohannes Berg 	int mcast_rate[NUM_NL80211_BANDS];
2239ffb3cf30SAshok Nagarajan 	u32 basic_rates;
22408564e382SJohannes Berg 	struct cfg80211_bitrate_mask beacon_rate;
2241d37d49c2SBenjamin Berg 	bool userspace_handles_dfs;
22421224f583SDenis Kenzior 	bool control_port_over_nl80211;
224329cbe68cSJohannes Berg };
224429cbe68cSJohannes Berg 
224529cbe68cSJohannes Berg /**
22466e0bd6c3SRostislav Lisovy  * struct ocb_setup - 802.11p OCB mode setup configuration
22476e0bd6c3SRostislav Lisovy  * @chandef: defines the channel to use
22486e0bd6c3SRostislav Lisovy  *
22496e0bd6c3SRostislav Lisovy  * These parameters are fixed when connecting to the network
22506e0bd6c3SRostislav Lisovy  */
22516e0bd6c3SRostislav Lisovy struct ocb_setup {
22526e0bd6c3SRostislav Lisovy 	struct cfg80211_chan_def chandef;
22536e0bd6c3SRostislav Lisovy };
22546e0bd6c3SRostislav Lisovy 
22556e0bd6c3SRostislav Lisovy /**
225631888487SJouni Malinen  * struct ieee80211_txq_params - TX queue parameters
2257a3304b0aSJohannes Berg  * @ac: AC identifier
225831888487SJouni Malinen  * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled
225931888487SJouni Malinen  * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range
226031888487SJouni Malinen  *	1..32767]
226131888487SJouni Malinen  * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range
226231888487SJouni Malinen  *	1..32767]
226331888487SJouni Malinen  * @aifs: Arbitration interframe space [0..255]
226431888487SJouni Malinen  */
226531888487SJouni Malinen struct ieee80211_txq_params {
2266a3304b0aSJohannes Berg 	enum nl80211_ac ac;
226731888487SJouni Malinen 	u16 txop;
226831888487SJouni Malinen 	u16 cwmin;
226931888487SJouni Malinen 	u16 cwmax;
227031888487SJouni Malinen 	u8 aifs;
227131888487SJouni Malinen };
227231888487SJouni Malinen 
2273d70e9693SJohannes Berg /**
2274d70e9693SJohannes Berg  * DOC: Scanning and BSS list handling
2275d70e9693SJohannes Berg  *
2276d70e9693SJohannes Berg  * The scanning process itself is fairly simple, but cfg80211 offers quite
2277d70e9693SJohannes Berg  * a bit of helper functionality. To start a scan, the scan operation will
2278d70e9693SJohannes Berg  * be invoked with a scan definition. This scan definition contains the
2279d70e9693SJohannes Berg  * channels to scan, and the SSIDs to send probe requests for (including the
2280d70e9693SJohannes Berg  * wildcard, if desired). A passive scan is indicated by having no SSIDs to
2281d70e9693SJohannes Berg  * probe. Additionally, a scan request may contain extra information elements
2282d70e9693SJohannes Berg  * that should be added to the probe request. The IEs are guaranteed to be
2283d70e9693SJohannes Berg  * well-formed, and will not exceed the maximum length the driver advertised
2284d70e9693SJohannes Berg  * in the wiphy structure.
2285d70e9693SJohannes Berg  *
2286d70e9693SJohannes Berg  * When scanning finds a BSS, cfg80211 needs to be notified of that, because
2287d70e9693SJohannes Berg  * it is responsible for maintaining the BSS list; the driver should not
2288d70e9693SJohannes Berg  * maintain a list itself. For this notification, various functions exist.
2289d70e9693SJohannes Berg  *
2290d70e9693SJohannes Berg  * Since drivers do not maintain a BSS list, there are also a number of
2291d70e9693SJohannes Berg  * functions to search for a BSS and obtain information about it from the
2292d70e9693SJohannes Berg  * BSS structure cfg80211 maintains. The BSS list is also made available
2293d70e9693SJohannes Berg  * to userspace.
2294d70e9693SJohannes Berg  */
229572bdcf34SJouni Malinen 
2296704232c2SJohannes Berg /**
22972a519311SJohannes Berg  * struct cfg80211_ssid - SSID description
22982a519311SJohannes Berg  * @ssid: the SSID
22992a519311SJohannes Berg  * @ssid_len: length of the ssid
23002a519311SJohannes Berg  */
23012a519311SJohannes Berg struct cfg80211_ssid {
23022a519311SJohannes Berg 	u8 ssid[IEEE80211_MAX_SSID_LEN];
23032a519311SJohannes Berg 	u8 ssid_len;
23042a519311SJohannes Berg };
23052a519311SJohannes Berg 
23062a519311SJohannes Berg /**
23071d76250bSAvraham Stern  * struct cfg80211_scan_info - information about completed scan
23081d76250bSAvraham Stern  * @scan_start_tsf: scan start time in terms of the TSF of the BSS that the
23091d76250bSAvraham Stern  *	wireless device that requested the scan is connected to. If this
23101d76250bSAvraham Stern  *	information is not available, this field is left zero.
23111d76250bSAvraham Stern  * @tsf_bssid: the BSSID according to which %scan_start_tsf is set.
23121d76250bSAvraham Stern  * @aborted: set to true if the scan was aborted for any reason,
23131d76250bSAvraham Stern  *	userspace will be notified of that
23141d76250bSAvraham Stern  */
23151d76250bSAvraham Stern struct cfg80211_scan_info {
23161d76250bSAvraham Stern 	u64 scan_start_tsf;
23171d76250bSAvraham Stern 	u8 tsf_bssid[ETH_ALEN] __aligned(2);
23181d76250bSAvraham Stern 	bool aborted;
23191d76250bSAvraham Stern };
23201d76250bSAvraham Stern 
23211d76250bSAvraham Stern /**
2322c8cb5b85STova Mussai  * struct cfg80211_scan_6ghz_params - relevant for 6 GHz only
2323c8cb5b85STova Mussai  *
2324c8cb5b85STova Mussai  * @short_bssid: short ssid to scan for
2325c8cb5b85STova Mussai  * @bssid: bssid to scan for
2326c8cb5b85STova Mussai  * @channel_idx: idx of the channel in the channel array in the scan request
2327c8cb5b85STova Mussai  *	 which the above info relvant to
2328c8cb5b85STova Mussai  * @unsolicited_probe: the AP transmits unsolicited probe response every 20 TU
2329c8cb5b85STova Mussai  * @short_ssid_valid: short_ssid is valid and can be used
2330c8cb5b85STova Mussai  * @psc_no_listen: when set, and the channel is a PSC channel, no need to wait
2331c8cb5b85STova Mussai  *       20 TUs before starting to send probe requests.
2332c8cb5b85STova Mussai  */
2333c8cb5b85STova Mussai struct cfg80211_scan_6ghz_params {
2334c8cb5b85STova Mussai 	u32 short_ssid;
2335c8cb5b85STova Mussai 	u32 channel_idx;
2336c8cb5b85STova Mussai 	u8 bssid[ETH_ALEN];
2337c8cb5b85STova Mussai 	bool unsolicited_probe;
2338c8cb5b85STova Mussai 	bool short_ssid_valid;
2339c8cb5b85STova Mussai 	bool psc_no_listen;
2340c8cb5b85STova Mussai };
2341c8cb5b85STova Mussai 
2342c8cb5b85STova Mussai /**
23432a519311SJohannes Berg  * struct cfg80211_scan_request - scan request description
23442a519311SJohannes Berg  *
23452a519311SJohannes Berg  * @ssids: SSIDs to scan for (active scan only)
23462a519311SJohannes Berg  * @n_ssids: number of SSIDs
23472a519311SJohannes Berg  * @channels: channels to scan on.
2348ca3dbc20SHelmut Schaa  * @n_channels: total number of channels to scan
2349dcd6eac1SSimon Wunderlich  * @scan_width: channel width for scanning
235070692ad2SJouni Malinen  * @ie: optional information element(s) to add into Probe Request or %NULL
235170692ad2SJouni Malinen  * @ie_len: length of ie in octets
23521d76250bSAvraham Stern  * @duration: how long to listen on each channel, in TUs. If
23531d76250bSAvraham Stern  *	%duration_mandatory is not set, this is the maximum dwell time and
23541d76250bSAvraham Stern  *	the actual dwell time may be shorter.
23551d76250bSAvraham Stern  * @duration_mandatory: if set, the scan duration must be as specified by the
23561d76250bSAvraham Stern  *	%duration field.
2357ed473771SSam Leffler  * @flags: bit field of flags controlling operation
235834850ab2SJohannes Berg  * @rates: bitmap of rates to advertise for each band
23592a519311SJohannes Berg  * @wiphy: the wiphy this was for
236015d6030bSSam Leffler  * @scan_start: time (in jiffies) when the scan started
2361fd014284SJohannes Berg  * @wdev: the wireless device to scan for
23621d76250bSAvraham Stern  * @info: (internal) information about completed scan
23635fe231e8SJohannes Berg  * @notified: (internal) scan request was notified as done or aborted
2364e9f935e3SRajkumar Manoharan  * @no_cck: used to send probe requests at non CCK rate in 2GHz band
2365ad2b26abSJohannes Berg  * @mac_addr: MAC address used with randomisation
2366ad2b26abSJohannes Berg  * @mac_addr_mask: MAC address mask used with randomisation, bits that
2367ad2b26abSJohannes Berg  *	are 0 in the mask should be randomised, bits that are 1 should
2368ad2b26abSJohannes Berg  *	be taken from the @mac_addr
2369c8cb5b85STova Mussai  * @scan_6ghz: relevant for split scan request only,
2370c8cb5b85STova Mussai  *	true if this is the second scan request
2371c8cb5b85STova Mussai  * @n_6ghz_params: number of 6 GHz params
2372c8cb5b85STova Mussai  * @scan_6ghz_params: 6 GHz params
2373818965d3SJouni Malinen  * @bssid: BSSID to scan for (most commonly, the wildcard BSSID)
23742a519311SJohannes Berg  */
23752a519311SJohannes Berg struct cfg80211_scan_request {
23762a519311SJohannes Berg 	struct cfg80211_ssid *ssids;
23772a519311SJohannes Berg 	int n_ssids;
23782a519311SJohannes Berg 	u32 n_channels;
2379dcd6eac1SSimon Wunderlich 	enum nl80211_bss_scan_width scan_width;
2380de95a54bSJohannes Berg 	const u8 *ie;
238170692ad2SJouni Malinen 	size_t ie_len;
23821d76250bSAvraham Stern 	u16 duration;
23831d76250bSAvraham Stern 	bool duration_mandatory;
2384ed473771SSam Leffler 	u32 flags;
23852a519311SJohannes Berg 
238657fbcce3SJohannes Berg 	u32 rates[NUM_NL80211_BANDS];
238734850ab2SJohannes Berg 
2388fd014284SJohannes Berg 	struct wireless_dev *wdev;
2389fd014284SJohannes Berg 
2390ad2b26abSJohannes Berg 	u8 mac_addr[ETH_ALEN] __aligned(2);
2391ad2b26abSJohannes Berg 	u8 mac_addr_mask[ETH_ALEN] __aligned(2);
2392818965d3SJouni Malinen 	u8 bssid[ETH_ALEN] __aligned(2);
2393ad2b26abSJohannes Berg 
23942a519311SJohannes Berg 	/* internal */
23952a519311SJohannes Berg 	struct wiphy *wiphy;
239615d6030bSSam Leffler 	unsigned long scan_start;
23971d76250bSAvraham Stern 	struct cfg80211_scan_info info;
23981d76250bSAvraham Stern 	bool notified;
2399e9f935e3SRajkumar Manoharan 	bool no_cck;
2400c8cb5b85STova Mussai 	bool scan_6ghz;
2401c8cb5b85STova Mussai 	u32 n_6ghz_params;
2402c8cb5b85STova Mussai 	struct cfg80211_scan_6ghz_params *scan_6ghz_params;
24035ba63533SJohannes Berg 
24045ba63533SJohannes Berg 	/* keep last */
2405396fba0aSGustavo A. R. Silva 	struct ieee80211_channel *channels[];
24062a519311SJohannes Berg };
24072a519311SJohannes Berg 
2408ad2b26abSJohannes Berg static inline void get_random_mask_addr(u8 *buf, const u8 *addr, const u8 *mask)
2409ad2b26abSJohannes Berg {
2410ad2b26abSJohannes Berg 	int i;
2411ad2b26abSJohannes Berg 
2412ad2b26abSJohannes Berg 	get_random_bytes(buf, ETH_ALEN);
2413ad2b26abSJohannes Berg 	for (i = 0; i < ETH_ALEN; i++) {
2414ad2b26abSJohannes Berg 		buf[i] &= ~mask[i];
2415ad2b26abSJohannes Berg 		buf[i] |= addr[i] & mask[i];
2416ad2b26abSJohannes Berg 	}
2417ad2b26abSJohannes Berg }
2418ad2b26abSJohannes Berg 
24192a519311SJohannes Berg /**
2420a1f1c21cSLuciano Coelho  * struct cfg80211_match_set - sets of attributes to match
2421a1f1c21cSLuciano Coelho  *
24223007e352SArend Van Spriel  * @ssid: SSID to be matched; may be zero-length in case of BSSID match
24233007e352SArend Van Spriel  *	or no match (RSSI only)
24243007e352SArend Van Spriel  * @bssid: BSSID to be matched; may be all-zero BSSID in case of SSID match
24253007e352SArend Van Spriel  *	or no match (RSSI only)
2426ea73cbceSJohannes Berg  * @rssi_thold: don't report scan results below this threshold (in s32 dBm)
24271e1b11b6Svamsi krishna  * @per_band_rssi_thold: Minimum rssi threshold for each band to be applied
24281e1b11b6Svamsi krishna  *	for filtering out scan results received. Drivers advertize this support
24291e1b11b6Svamsi krishna  *	of band specific rssi based filtering through the feature capability
24301e1b11b6Svamsi krishna  *	%NL80211_EXT_FEATURE_SCHED_SCAN_BAND_SPECIFIC_RSSI_THOLD. These band
24311e1b11b6Svamsi krishna  *	specific rssi thresholds take precedence over rssi_thold, if specified.
24321e1b11b6Svamsi krishna  *	If not specified for any band, it will be assigned with rssi_thold of
24331e1b11b6Svamsi krishna  *	corresponding matchset.
2434a1f1c21cSLuciano Coelho  */
2435a1f1c21cSLuciano Coelho struct cfg80211_match_set {
2436a1f1c21cSLuciano Coelho 	struct cfg80211_ssid ssid;
24373007e352SArend Van Spriel 	u8 bssid[ETH_ALEN];
2438ea73cbceSJohannes Berg 	s32 rssi_thold;
24391e1b11b6Svamsi krishna 	s32 per_band_rssi_thold[NUM_NL80211_BANDS];
2440a1f1c21cSLuciano Coelho };
2441a1f1c21cSLuciano Coelho 
2442a1f1c21cSLuciano Coelho /**
24433b06d277SAvraham Stern  * struct cfg80211_sched_scan_plan - scan plan for scheduled scan
24443b06d277SAvraham Stern  *
24453b06d277SAvraham Stern  * @interval: interval between scheduled scan iterations. In seconds.
24463b06d277SAvraham Stern  * @iterations: number of scan iterations in this scan plan. Zero means
24473b06d277SAvraham Stern  *	infinite loop.
24483b06d277SAvraham Stern  *	The last scan plan will always have this parameter set to zero,
24493b06d277SAvraham Stern  *	all other scan plans will have a finite number of iterations.
24503b06d277SAvraham Stern  */
24513b06d277SAvraham Stern struct cfg80211_sched_scan_plan {
24523b06d277SAvraham Stern 	u32 interval;
24533b06d277SAvraham Stern 	u32 iterations;
24543b06d277SAvraham Stern };
24553b06d277SAvraham Stern 
24563b06d277SAvraham Stern /**
2457bf95ecdbSvamsi krishna  * struct cfg80211_bss_select_adjust - BSS selection with RSSI adjustment.
2458bf95ecdbSvamsi krishna  *
2459bf95ecdbSvamsi krishna  * @band: band of BSS which should match for RSSI level adjustment.
2460bf95ecdbSvamsi krishna  * @delta: value of RSSI level adjustment.
2461bf95ecdbSvamsi krishna  */
2462bf95ecdbSvamsi krishna struct cfg80211_bss_select_adjust {
2463bf95ecdbSvamsi krishna 	enum nl80211_band band;
2464bf95ecdbSvamsi krishna 	s8 delta;
2465bf95ecdbSvamsi krishna };
2466bf95ecdbSvamsi krishna 
2467bf95ecdbSvamsi krishna /**
2468807f8a8cSLuciano Coelho  * struct cfg80211_sched_scan_request - scheduled scan request description
2469807f8a8cSLuciano Coelho  *
247096b08fd6SArend Van Spriel  * @reqid: identifies this request.
2471807f8a8cSLuciano Coelho  * @ssids: SSIDs to scan for (passed in the probe_reqs in active scans)
2472807f8a8cSLuciano Coelho  * @n_ssids: number of SSIDs
2473807f8a8cSLuciano Coelho  * @n_channels: total number of channels to scan
2474dcd6eac1SSimon Wunderlich  * @scan_width: channel width for scanning
2475807f8a8cSLuciano Coelho  * @ie: optional information element(s) to add into Probe Request or %NULL
2476807f8a8cSLuciano Coelho  * @ie_len: length of ie in octets
2477ed473771SSam Leffler  * @flags: bit field of flags controlling operation
2478a1f1c21cSLuciano Coelho  * @match_sets: sets of parameters to be matched for a scan result
2479a1f1c21cSLuciano Coelho  *	entry to be considered valid and to be passed to the host
2480a1f1c21cSLuciano Coelho  *	(others are filtered out).
2481a1f1c21cSLuciano Coelho  *	If ommited, all results are passed.
2482a1f1c21cSLuciano Coelho  * @n_match_sets: number of match sets
24836406c919SJohannes Berg  * @report_results: indicates that results were reported for this request
2484807f8a8cSLuciano Coelho  * @wiphy: the wiphy this was for
2485807f8a8cSLuciano Coelho  * @dev: the interface
2486077f897aSJohannes Berg  * @scan_start: start time of the scheduled scan
2487807f8a8cSLuciano Coelho  * @channels: channels to scan
2488ea73cbceSJohannes Berg  * @min_rssi_thold: for drivers only supporting a single threshold, this
2489ea73cbceSJohannes Berg  *	contains the minimum over all matchsets
2490ad2b26abSJohannes Berg  * @mac_addr: MAC address used with randomisation
2491ad2b26abSJohannes Berg  * @mac_addr_mask: MAC address mask used with randomisation, bits that
2492ad2b26abSJohannes Berg  *	are 0 in the mask should be randomised, bits that are 1 should
2493ad2b26abSJohannes Berg  *	be taken from the @mac_addr
24943b06d277SAvraham Stern  * @scan_plans: scan plans to be executed in this scheduled scan. Lowest
24953b06d277SAvraham Stern  *	index must be executed first.
24963b06d277SAvraham Stern  * @n_scan_plans: number of scan plans, at least 1.
249731a60ed1SJukka Rissanen  * @rcu_head: RCU callback used to free the struct
249893a1e86cSJukka Rissanen  * @owner_nlportid: netlink portid of owner (if this should is a request
249993a1e86cSJukka Rissanen  *	owned by a particular socket)
2500ca986ad9SArend Van Spriel  * @nl_owner_dead: netlink owner socket was closed - this request be freed
2501ca986ad9SArend Van Spriel  * @list: for keeping list of requests.
25029c748934SLuciano Coelho  * @delay: delay in seconds to use before starting the first scan
25039c748934SLuciano Coelho  *	cycle.  The driver may ignore this parameter and start
25049c748934SLuciano Coelho  *	immediately (or at any other time), if this feature is not
25059c748934SLuciano Coelho  *	supported.
2506bf95ecdbSvamsi krishna  * @relative_rssi_set: Indicates whether @relative_rssi is set or not.
2507bf95ecdbSvamsi krishna  * @relative_rssi: Relative RSSI threshold in dB to restrict scan result
2508bf95ecdbSvamsi krishna  *	reporting in connected state to cases where a matching BSS is determined
2509bf95ecdbSvamsi krishna  *	to have better or slightly worse RSSI than the current connected BSS.
2510bf95ecdbSvamsi krishna  *	The relative RSSI threshold values are ignored in disconnected state.
2511bf95ecdbSvamsi krishna  * @rssi_adjust: delta dB of RSSI preference to be given to the BSSs that belong
2512bf95ecdbSvamsi krishna  *	to the specified band while deciding whether a better BSS is reported
2513bf95ecdbSvamsi krishna  *	using @relative_rssi. If delta is a negative number, the BSSs that
2514bf95ecdbSvamsi krishna  *	belong to the specified band will be penalized by delta dB in relative
2515bf95ecdbSvamsi krishna  *	comparisions.
2516807f8a8cSLuciano Coelho  */
2517807f8a8cSLuciano Coelho struct cfg80211_sched_scan_request {
251896b08fd6SArend Van Spriel 	u64 reqid;
2519807f8a8cSLuciano Coelho 	struct cfg80211_ssid *ssids;
2520807f8a8cSLuciano Coelho 	int n_ssids;
2521807f8a8cSLuciano Coelho 	u32 n_channels;
2522dcd6eac1SSimon Wunderlich 	enum nl80211_bss_scan_width scan_width;
2523807f8a8cSLuciano Coelho 	const u8 *ie;
2524807f8a8cSLuciano Coelho 	size_t ie_len;
2525ed473771SSam Leffler 	u32 flags;
2526a1f1c21cSLuciano Coelho 	struct cfg80211_match_set *match_sets;
2527a1f1c21cSLuciano Coelho 	int n_match_sets;
2528ea73cbceSJohannes Berg 	s32 min_rssi_thold;
25299c748934SLuciano Coelho 	u32 delay;
25303b06d277SAvraham Stern 	struct cfg80211_sched_scan_plan *scan_plans;
25313b06d277SAvraham Stern 	int n_scan_plans;
2532807f8a8cSLuciano Coelho 
2533ad2b26abSJohannes Berg 	u8 mac_addr[ETH_ALEN] __aligned(2);
2534ad2b26abSJohannes Berg 	u8 mac_addr_mask[ETH_ALEN] __aligned(2);
2535ad2b26abSJohannes Berg 
2536bf95ecdbSvamsi krishna 	bool relative_rssi_set;
2537bf95ecdbSvamsi krishna 	s8 relative_rssi;
2538bf95ecdbSvamsi krishna 	struct cfg80211_bss_select_adjust rssi_adjust;
2539bf95ecdbSvamsi krishna 
2540807f8a8cSLuciano Coelho 	/* internal */
2541807f8a8cSLuciano Coelho 	struct wiphy *wiphy;
2542807f8a8cSLuciano Coelho 	struct net_device *dev;
254315d6030bSSam Leffler 	unsigned long scan_start;
2544b34939b9SArend Van Spriel 	bool report_results;
254531a60ed1SJukka Rissanen 	struct rcu_head rcu_head;
254693a1e86cSJukka Rissanen 	u32 owner_nlportid;
2547ca986ad9SArend Van Spriel 	bool nl_owner_dead;
2548ca986ad9SArend Van Spriel 	struct list_head list;
2549807f8a8cSLuciano Coelho 
2550807f8a8cSLuciano Coelho 	/* keep last */
2551396fba0aSGustavo A. R. Silva 	struct ieee80211_channel *channels[];
2552807f8a8cSLuciano Coelho };
2553807f8a8cSLuciano Coelho 
2554807f8a8cSLuciano Coelho /**
25552a519311SJohannes Berg  * enum cfg80211_signal_type - signal type
25562a519311SJohannes Berg  *
25572a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available
25582a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm)
25592a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100
25602a519311SJohannes Berg  */
25612a519311SJohannes Berg enum cfg80211_signal_type {
25622a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_NONE,
25632a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_MBM,
25642a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_UNSPEC,
25652a519311SJohannes Berg };
25662a519311SJohannes Berg 
25672a519311SJohannes Berg /**
25686e19bc4bSDmitry Shmidt  * struct cfg80211_inform_bss - BSS inform data
25696e19bc4bSDmitry Shmidt  * @chan: channel the frame was received on
25706e19bc4bSDmitry Shmidt  * @scan_width: scan width that was used
25716e19bc4bSDmitry Shmidt  * @signal: signal strength value, according to the wiphy's
25726e19bc4bSDmitry Shmidt  *	signal type
25736e19bc4bSDmitry Shmidt  * @boottime_ns: timestamp (CLOCK_BOOTTIME) when the information was
25746e19bc4bSDmitry Shmidt  *	received; should match the time when the frame was actually
25756e19bc4bSDmitry Shmidt  *	received by the device (not just by the host, in case it was
25766e19bc4bSDmitry Shmidt  *	buffered on the device) and be accurate to about 10ms.
25776e19bc4bSDmitry Shmidt  *	If the frame isn't buffered, just passing the return value of
25789285ec4cSJason A. Donenfeld  *	ktime_get_boottime_ns() is likely appropriate.
25791d76250bSAvraham Stern  * @parent_tsf: the time at the start of reception of the first octet of the
25801d76250bSAvraham Stern  *	timestamp field of the frame. The time is the TSF of the BSS specified
25811d76250bSAvraham Stern  *	by %parent_bssid.
25821d76250bSAvraham Stern  * @parent_bssid: the BSS according to which %parent_tsf is set. This is set to
25831d76250bSAvraham Stern  *	the BSS that requested the scan in which the beacon/probe was received.
2584983dafaaSSunil Dutt  * @chains: bitmask for filled values in @chain_signal.
2585983dafaaSSunil Dutt  * @chain_signal: per-chain signal strength of last received BSS in dBm.
25866e19bc4bSDmitry Shmidt  */
25876e19bc4bSDmitry Shmidt struct cfg80211_inform_bss {
25886e19bc4bSDmitry Shmidt 	struct ieee80211_channel *chan;
25896e19bc4bSDmitry Shmidt 	enum nl80211_bss_scan_width scan_width;
25906e19bc4bSDmitry Shmidt 	s32 signal;
25916e19bc4bSDmitry Shmidt 	u64 boottime_ns;
25921d76250bSAvraham Stern 	u64 parent_tsf;
25931d76250bSAvraham Stern 	u8 parent_bssid[ETH_ALEN] __aligned(2);
2594983dafaaSSunil Dutt 	u8 chains;
2595983dafaaSSunil Dutt 	s8 chain_signal[IEEE80211_MAX_CHAINS];
25966e19bc4bSDmitry Shmidt };
25976e19bc4bSDmitry Shmidt 
25986e19bc4bSDmitry Shmidt /**
25992aa4d456SAkira Moroo  * struct cfg80211_bss_ies - BSS entry IE data
26008cef2c9dSJohannes Berg  * @tsf: TSF contained in the frame that carried these IEs
26019caf0364SJohannes Berg  * @rcu_head: internal use, for freeing
26029caf0364SJohannes Berg  * @len: length of the IEs
26030e227084SJohannes Berg  * @from_beacon: these IEs are known to come from a beacon
26049caf0364SJohannes Berg  * @data: IE data
26059caf0364SJohannes Berg  */
26069caf0364SJohannes Berg struct cfg80211_bss_ies {
26078cef2c9dSJohannes Berg 	u64 tsf;
26089caf0364SJohannes Berg 	struct rcu_head rcu_head;
26099caf0364SJohannes Berg 	int len;
26100e227084SJohannes Berg 	bool from_beacon;
26119caf0364SJohannes Berg 	u8 data[];
26129caf0364SJohannes Berg };
26139caf0364SJohannes Berg 
26149caf0364SJohannes Berg /**
26152a519311SJohannes Berg  * struct cfg80211_bss - BSS description
26162a519311SJohannes Berg  *
26172a519311SJohannes Berg  * This structure describes a BSS (which may also be a mesh network)
26182a519311SJohannes Berg  * for use in scan results and similar.
26192a519311SJohannes Berg  *
2620abe37c4bSJohannes Berg  * @channel: channel this BSS is on
2621dcd6eac1SSimon Wunderlich  * @scan_width: width of the control channel
26222a519311SJohannes Berg  * @bssid: BSSID of the BSS
26232a519311SJohannes Berg  * @beacon_interval: the beacon interval as from the frame
26242a519311SJohannes Berg  * @capability: the capability field in host byte order
262583c7aa1aSJohannes Berg  * @ies: the information elements (Note that there is no guarantee that these
262683c7aa1aSJohannes Berg  *	are well-formed!); this is a pointer to either the beacon_ies or
262783c7aa1aSJohannes Berg  *	proberesp_ies depending on whether Probe Response frame has been
262883c7aa1aSJohannes Berg  *	received. It is always non-%NULL.
262934a6eddbSJouni Malinen  * @beacon_ies: the information elements from the last Beacon frame
2630776b3580SJohannes Berg  *	(implementation note: if @hidden_beacon_bss is set this struct doesn't
2631776b3580SJohannes Berg  *	own the beacon_ies, but they're just pointers to the ones from the
2632776b3580SJohannes Berg  *	@hidden_beacon_bss struct)
263334a6eddbSJouni Malinen  * @proberesp_ies: the information elements from the last Probe Response frame
2634776b3580SJohannes Berg  * @hidden_beacon_bss: in case this BSS struct represents a probe response from
2635776b3580SJohannes Berg  *	a BSS that hides the SSID in its beacon, this points to the BSS struct
2636776b3580SJohannes Berg  *	that holds the beacon data. @beacon_ies is still valid, of course, and
2637776b3580SJohannes Berg  *	points to the same data as hidden_beacon_bss->beacon_ies in that case.
2638851ae31dSJohannes Berg  * @transmitted_bss: pointer to the transmitted BSS, if this is a
2639851ae31dSJohannes Berg  *	non-transmitted one (multi-BSSID support)
2640851ae31dSJohannes Berg  * @nontrans_list: list of non-transmitted BSS, if this is a transmitted one
2641851ae31dSJohannes Berg  *	(multi-BSSID support)
264277965c97SJohannes Berg  * @signal: signal strength value (type depends on the wiphy's signal_type)
2643983dafaaSSunil Dutt  * @chains: bitmask for filled values in @chain_signal.
2644983dafaaSSunil Dutt  * @chain_signal: per-chain signal strength of last received BSS in dBm.
26450cd01efbSSara Sharon  * @bssid_index: index in the multiple BSS set
26460cd01efbSSara Sharon  * @max_bssid_indicator: max number of members in the BSS set
26472a519311SJohannes Berg  * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
26482a519311SJohannes Berg  */
26492a519311SJohannes Berg struct cfg80211_bss {
26502a519311SJohannes Berg 	struct ieee80211_channel *channel;
2651dcd6eac1SSimon Wunderlich 	enum nl80211_bss_scan_width scan_width;
26522a519311SJohannes Berg 
26539caf0364SJohannes Berg 	const struct cfg80211_bss_ies __rcu *ies;
26549caf0364SJohannes Berg 	const struct cfg80211_bss_ies __rcu *beacon_ies;
26559caf0364SJohannes Berg 	const struct cfg80211_bss_ies __rcu *proberesp_ies;
26569caf0364SJohannes Berg 
2657776b3580SJohannes Berg 	struct cfg80211_bss *hidden_beacon_bss;
26587011ba58SSara Sharon 	struct cfg80211_bss *transmitted_bss;
26597011ba58SSara Sharon 	struct list_head nontrans_list;
26602a519311SJohannes Berg 
26612a519311SJohannes Berg 	s32 signal;
26622a519311SJohannes Berg 
26639caf0364SJohannes Berg 	u16 beacon_interval;
26649caf0364SJohannes Berg 	u16 capability;
26659caf0364SJohannes Berg 
26669caf0364SJohannes Berg 	u8 bssid[ETH_ALEN];
2667983dafaaSSunil Dutt 	u8 chains;
2668983dafaaSSunil Dutt 	s8 chain_signal[IEEE80211_MAX_CHAINS];
26699caf0364SJohannes Berg 
26700cd01efbSSara Sharon 	u8 bssid_index;
26710cd01efbSSara Sharon 	u8 max_bssid_indicator;
26720cd01efbSSara Sharon 
2673396fba0aSGustavo A. R. Silva 	u8 priv[] __aligned(sizeof(void *));
26742a519311SJohannes Berg };
26752a519311SJohannes Berg 
26762a519311SJohannes Berg /**
267749a68e0dSJohannes Berg  * ieee80211_bss_get_elem - find element with given ID
2678517357c6SJohannes Berg  * @bss: the bss to search
267949a68e0dSJohannes Berg  * @id: the element ID
26809caf0364SJohannes Berg  *
26819caf0364SJohannes Berg  * Note that the return value is an RCU-protected pointer, so
26829caf0364SJohannes Berg  * rcu_read_lock() must be held when calling this function.
26830ae997dcSYacine Belkadi  * Return: %NULL if not found.
2684517357c6SJohannes Berg  */
268549a68e0dSJohannes Berg const struct element *ieee80211_bss_get_elem(struct cfg80211_bss *bss, u8 id);
268649a68e0dSJohannes Berg 
268749a68e0dSJohannes Berg /**
268849a68e0dSJohannes Berg  * ieee80211_bss_get_ie - find IE with given ID
268949a68e0dSJohannes Berg  * @bss: the bss to search
269049a68e0dSJohannes Berg  * @id: the element ID
269149a68e0dSJohannes Berg  *
269249a68e0dSJohannes Berg  * Note that the return value is an RCU-protected pointer, so
269349a68e0dSJohannes Berg  * rcu_read_lock() must be held when calling this function.
269449a68e0dSJohannes Berg  * Return: %NULL if not found.
269549a68e0dSJohannes Berg  */
269649a68e0dSJohannes Berg static inline const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 id)
269749a68e0dSJohannes Berg {
26987e367b06SJohannes Berg 	return (const void *)ieee80211_bss_get_elem(bss, id);
269949a68e0dSJohannes Berg }
2700517357c6SJohannes Berg 
2701517357c6SJohannes Berg 
2702517357c6SJohannes Berg /**
2703636a5d36SJouni Malinen  * struct cfg80211_auth_request - Authentication request data
2704636a5d36SJouni Malinen  *
2705636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
2706636a5d36SJouni Malinen  * authentication.
2707636a5d36SJouni Malinen  *
2708959867faSJohannes Berg  * @bss: The BSS to authenticate with, the callee must obtain a reference
2709959867faSJohannes Berg  *	to it if it needs to keep it.
2710636a5d36SJouni Malinen  * @auth_type: Authentication type (algorithm)
2711636a5d36SJouni Malinen  * @ie: Extra IEs to add to Authentication frame or %NULL
2712636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
2713fffd0934SJohannes Berg  * @key_len: length of WEP key for shared key authentication
2714fffd0934SJohannes Berg  * @key_idx: index of WEP key for shared key authentication
2715fffd0934SJohannes Berg  * @key: WEP key for shared key authentication
271611b6b5a4SJouni Malinen  * @auth_data: Fields and elements in Authentication frames. This contains
271711b6b5a4SJouni Malinen  *	the authentication frame body (non-IE and IE data), excluding the
271811b6b5a4SJouni Malinen  *	Authentication algorithm number, i.e., starting at the Authentication
271911b6b5a4SJouni Malinen  *	transaction sequence number field.
272011b6b5a4SJouni Malinen  * @auth_data_len: Length of auth_data buffer in octets
2721d648c230SJohannes Berg  * @link_id: if >= 0, indicates authentication should be done as an MLD,
2722d648c230SJohannes Berg  *	the interface address is included as the MLD address and the
2723d648c230SJohannes Berg  *	necessary link (with the given link_id) will be created (and
2724d648c230SJohannes Berg  *	given an MLD address) by the driver
2725d648c230SJohannes Berg  * @ap_mld_addr: AP MLD address in case of authentication request with
2726d648c230SJohannes Berg  *	an AP MLD, valid iff @link_id >= 0
2727636a5d36SJouni Malinen  */
2728636a5d36SJouni Malinen struct cfg80211_auth_request {
272919957bb3SJohannes Berg 	struct cfg80211_bss *bss;
2730636a5d36SJouni Malinen 	const u8 *ie;
2731636a5d36SJouni Malinen 	size_t ie_len;
273219957bb3SJohannes Berg 	enum nl80211_auth_type auth_type;
2733fffd0934SJohannes Berg 	const u8 *key;
2734fffd0934SJohannes Berg 	u8 key_len, key_idx;
273511b6b5a4SJouni Malinen 	const u8 *auth_data;
273611b6b5a4SJouni Malinen 	size_t auth_data_len;
2737d648c230SJohannes Berg 	s8 link_id;
2738d648c230SJohannes Berg 	const u8 *ap_mld_addr;
2739d648c230SJohannes Berg };
2740d648c230SJohannes Berg 
2741d648c230SJohannes Berg /**
2742d648c230SJohannes Berg  * struct cfg80211_assoc_link - per-link information for MLO association
2743d648c230SJohannes Berg  * @bss: the BSS pointer, see also &struct cfg80211_assoc_request::bss;
2744d648c230SJohannes Berg  *	if this is %NULL for a link, that link is not requested
2745d648c230SJohannes Berg  * @elems: extra elements for the per-STA profile for this link
2746d648c230SJohannes Berg  * @elems_len: length of the elements
2747d648c230SJohannes Berg  */
2748d648c230SJohannes Berg struct cfg80211_assoc_link {
2749d648c230SJohannes Berg 	struct cfg80211_bss *bss;
2750d648c230SJohannes Berg 	const u8 *elems;
2751d648c230SJohannes Berg 	size_t elems_len;
2752636a5d36SJouni Malinen };
2753636a5d36SJouni Malinen 
2754636a5d36SJouni Malinen /**
27557e7c8926SBen Greear  * enum cfg80211_assoc_req_flags - Over-ride default behaviour in association.
27567e7c8926SBen Greear  *
27577e7c8926SBen Greear  * @ASSOC_REQ_DISABLE_HT:  Disable HT (802.11n)
2758ee2aca34SJohannes Berg  * @ASSOC_REQ_DISABLE_VHT:  Disable VHT
2759bab5ab7dSAssaf Krauss  * @ASSOC_REQ_USE_RRM: Declare RRM capability in this association
276040cbfa90SSrinivas Dasari  * @CONNECT_REQ_EXTERNAL_AUTH_SUPPORT: User space indicates external
276140cbfa90SSrinivas Dasari  *	authentication capability. Drivers can offload authentication to
276240cbfa90SSrinivas Dasari  *	userspace if this flag is set. Only applicable for cfg80211_connect()
276340cbfa90SSrinivas Dasari  *	request (connect callback).
2764b6db0f89SBen Greear  * @ASSOC_REQ_DISABLE_HE:  Disable HE
276536f84235SMuna Sinada  * @ASSOC_REQ_DISABLE_EHT:  Disable EHT
27667e7c8926SBen Greear  */
27677e7c8926SBen Greear enum cfg80211_assoc_req_flags {
27687e7c8926SBen Greear 	ASSOC_REQ_DISABLE_HT			= BIT(0),
2769ee2aca34SJohannes Berg 	ASSOC_REQ_DISABLE_VHT			= BIT(1),
2770bab5ab7dSAssaf Krauss 	ASSOC_REQ_USE_RRM			= BIT(2),
277140cbfa90SSrinivas Dasari 	CONNECT_REQ_EXTERNAL_AUTH_SUPPORT	= BIT(3),
2772b6db0f89SBen Greear 	ASSOC_REQ_DISABLE_HE			= BIT(4),
277336f84235SMuna Sinada 	ASSOC_REQ_DISABLE_EHT			= BIT(5),
27747e7c8926SBen Greear };
27757e7c8926SBen Greear 
27767e7c8926SBen Greear /**
2777636a5d36SJouni Malinen  * struct cfg80211_assoc_request - (Re)Association request data
2778636a5d36SJouni Malinen  *
2779636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
2780636a5d36SJouni Malinen  * (re)association.
2781959867faSJohannes Berg  * @bss: The BSS to associate with. If the call is successful the driver is
2782959867faSJohannes Berg  *	given a reference that it must give back to cfg80211_send_rx_assoc()
2783959867faSJohannes Berg  *	or to cfg80211_assoc_timeout(). To ensure proper refcounting, new
2784959867faSJohannes Berg  *	association requests while already associating must be rejected.
2785d648c230SJohannes Berg  *	This also applies to the @links.bss parameter, which is used instead
2786d648c230SJohannes Berg  *	of this one (it is %NULL) for MLO associations.
2787636a5d36SJouni Malinen  * @ie: Extra IEs to add to (Re)Association Request frame or %NULL
2788636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
2789dc6382ceSJouni Malinen  * @use_mfp: Use management frame protection (IEEE 802.11w) in this association
2790b23aa676SSamuel Ortiz  * @crypto: crypto settings
279135eb8f7bSJouni Malinen  * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used
279235eb8f7bSJouni Malinen  *	to indicate a request to reassociate within the ESS instead of a request
279335eb8f7bSJouni Malinen  *	do the initial association with the ESS. When included, this is set to
279435eb8f7bSJouni Malinen  *	the BSSID of the current association, i.e., to the value that is
279535eb8f7bSJouni Malinen  *	included in the Current AP address field of the Reassociation Request
279635eb8f7bSJouni Malinen  *	frame.
27977e7c8926SBen Greear  * @flags:  See &enum cfg80211_assoc_req_flags
27987e7c8926SBen Greear  * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask
27997e7c8926SBen Greear  *	will be used in ht_capa.  Un-supported values will be ignored.
28007e7c8926SBen Greear  * @ht_capa_mask:  The bits of ht_capa which are to be used.
2801ee2aca34SJohannes Berg  * @vht_capa: VHT capability override
2802ee2aca34SJohannes Berg  * @vht_capa_mask: VHT capability mask indicating which fields to use
2803348bd456SJouni Malinen  * @fils_kek: FILS KEK for protecting (Re)Association Request/Response frame or
2804348bd456SJouni Malinen  *	%NULL if FILS is not used.
2805348bd456SJouni Malinen  * @fils_kek_len: Length of fils_kek in octets
2806348bd456SJouni Malinen  * @fils_nonces: FILS nonces (part of AAD) for protecting (Re)Association
2807348bd456SJouni Malinen  *	Request/Response frame or %NULL if FILS is not used. This field starts
2808348bd456SJouni Malinen  *	with 16 octets of STA Nonce followed by 16 octets of AP Nonce.
2809d2b7588aSThomas Pedersen  * @s1g_capa: S1G capability override
2810d2b7588aSThomas Pedersen  * @s1g_capa_mask: S1G capability override mask
2811d648c230SJohannes Berg  * @links: per-link information for MLO connections
2812d648c230SJohannes Berg  * @link_id: >= 0 for MLO connections, where links are given, and indicates
2813d648c230SJohannes Berg  *	the link on which the association request should be sent
2814d648c230SJohannes Berg  * @ap_mld_addr: AP MLD address in case of MLO association request,
2815d648c230SJohannes Berg  *	valid iff @link_id >= 0
2816636a5d36SJouni Malinen  */
2817636a5d36SJouni Malinen struct cfg80211_assoc_request {
281819957bb3SJohannes Berg 	struct cfg80211_bss *bss;
28193e5d7649SJohannes Berg 	const u8 *ie, *prev_bssid;
2820636a5d36SJouni Malinen 	size_t ie_len;
2821b23aa676SSamuel Ortiz 	struct cfg80211_crypto_settings crypto;
282219957bb3SJohannes Berg 	bool use_mfp;
28237e7c8926SBen Greear 	u32 flags;
28247e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa;
28257e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa_mask;
2826ee2aca34SJohannes Berg 	struct ieee80211_vht_cap vht_capa, vht_capa_mask;
2827348bd456SJouni Malinen 	const u8 *fils_kek;
2828348bd456SJouni Malinen 	size_t fils_kek_len;
2829348bd456SJouni Malinen 	const u8 *fils_nonces;
2830d2b7588aSThomas Pedersen 	struct ieee80211_s1g_cap s1g_capa, s1g_capa_mask;
2831d648c230SJohannes Berg 	struct cfg80211_assoc_link links[IEEE80211_MLD_MAX_NUM_LINKS];
2832d648c230SJohannes Berg 	const u8 *ap_mld_addr;
2833d648c230SJohannes Berg 	s8 link_id;
2834636a5d36SJouni Malinen };
2835636a5d36SJouni Malinen 
2836636a5d36SJouni Malinen /**
2837636a5d36SJouni Malinen  * struct cfg80211_deauth_request - Deauthentication request data
2838636a5d36SJouni Malinen  *
2839636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
2840636a5d36SJouni Malinen  * deauthentication.
2841636a5d36SJouni Malinen  *
284295de817bSJohannes Berg  * @bssid: the BSSID of the BSS to deauthenticate from
2843636a5d36SJouni Malinen  * @ie: Extra IEs to add to Deauthentication frame or %NULL
2844636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
284519957bb3SJohannes Berg  * @reason_code: The reason code for the deauthentication
2846077f897aSJohannes Berg  * @local_state_change: if set, change local state only and
2847077f897aSJohannes Berg  *	do not set a deauth frame
2848636a5d36SJouni Malinen  */
2849636a5d36SJouni Malinen struct cfg80211_deauth_request {
285095de817bSJohannes Berg 	const u8 *bssid;
2851636a5d36SJouni Malinen 	const u8 *ie;
2852636a5d36SJouni Malinen 	size_t ie_len;
285319957bb3SJohannes Berg 	u16 reason_code;
28546863255bSStanislaw Gruszka 	bool local_state_change;
2855636a5d36SJouni Malinen };
2856636a5d36SJouni Malinen 
2857636a5d36SJouni Malinen /**
2858636a5d36SJouni Malinen  * struct cfg80211_disassoc_request - Disassociation request data
2859636a5d36SJouni Malinen  *
2860636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
286166f00449SMasahiro Yamada  * disassociation.
2862636a5d36SJouni Malinen  *
286319957bb3SJohannes Berg  * @bss: the BSS to disassociate from
2864636a5d36SJouni Malinen  * @ie: Extra IEs to add to Disassociation frame or %NULL
2865636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
286619957bb3SJohannes Berg  * @reason_code: The reason code for the disassociation
2867d5cdfacbSJouni Malinen  * @local_state_change: This is a request for a local state only, i.e., no
2868d5cdfacbSJouni Malinen  *	Disassociation frame is to be transmitted.
2869636a5d36SJouni Malinen  */
2870636a5d36SJouni Malinen struct cfg80211_disassoc_request {
287119957bb3SJohannes Berg 	struct cfg80211_bss *bss;
2872636a5d36SJouni Malinen 	const u8 *ie;
2873636a5d36SJouni Malinen 	size_t ie_len;
287419957bb3SJohannes Berg 	u16 reason_code;
2875d5cdfacbSJouni Malinen 	bool local_state_change;
2876636a5d36SJouni Malinen };
2877636a5d36SJouni Malinen 
2878636a5d36SJouni Malinen /**
287904a773adSJohannes Berg  * struct cfg80211_ibss_params - IBSS parameters
288004a773adSJohannes Berg  *
288104a773adSJohannes Berg  * This structure defines the IBSS parameters for the join_ibss()
288204a773adSJohannes Berg  * method.
288304a773adSJohannes Berg  *
288404a773adSJohannes Berg  * @ssid: The SSID, will always be non-null.
288504a773adSJohannes Berg  * @ssid_len: The length of the SSID, will always be non-zero.
288604a773adSJohannes Berg  * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not
288704a773adSJohannes Berg  *	search for IBSSs with a different BSSID.
2888683b6d3bSJohannes Berg  * @chandef: defines the channel to use if no other IBSS to join can be found
288904a773adSJohannes Berg  * @channel_fixed: The channel should be fixed -- do not search for
289004a773adSJohannes Berg  *	IBSSs to join on other channels.
289104a773adSJohannes Berg  * @ie: information element(s) to include in the beacon
289204a773adSJohannes Berg  * @ie_len: length of that
28938e30bc55SJohannes Berg  * @beacon_interval: beacon interval to use
2894fffd0934SJohannes Berg  * @privacy: this is a protected network, keys will be configured
2895fffd0934SJohannes Berg  *	after joining
2896267335d6SAntonio Quartulli  * @control_port: whether user space controls IEEE 802.1X port, i.e.,
2897267335d6SAntonio Quartulli  *	sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
2898267335d6SAntonio Quartulli  *	required to assume that the port is unauthorized until authorized by
2899267335d6SAntonio Quartulli  *	user space. Otherwise, port is marked authorized by default.
2900c3bfe1f6SDenis Kenzior  * @control_port_over_nl80211: TRUE if userspace expects to exchange control
2901c3bfe1f6SDenis Kenzior  *	port frames over NL80211 instead of the network interface.
29025336fa88SSimon Wunderlich  * @userspace_handles_dfs: whether user space controls DFS operation, i.e.
29035336fa88SSimon Wunderlich  *	changes the channel when a radar is detected. This is required
29045336fa88SSimon Wunderlich  *	to operate on DFS channels.
2905fbd2c8dcSTeemu Paasikivi  * @basic_rates: bitmap of basic rates to use when creating the IBSS
2906dd5b4cc7SFelix Fietkau  * @mcast_rate: per-band multicast rate index + 1 (0: disabled)
2907803768f5SSimon Wunderlich  * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask
2908803768f5SSimon Wunderlich  *	will be used in ht_capa.  Un-supported values will be ignored.
2909803768f5SSimon Wunderlich  * @ht_capa_mask:  The bits of ht_capa which are to be used.
29109ae3b172STova Mussai  * @wep_keys: static WEP keys, if not NULL points to an array of
29119ae3b172STova Mussai  *	CFG80211_MAX_WEP_KEYS WEP keys
29129ae3b172STova Mussai  * @wep_tx_key: key index (0..3) of the default TX static WEP key
291304a773adSJohannes Berg  */
291404a773adSJohannes Berg struct cfg80211_ibss_params {
2915c1e5f471SJohannes Berg 	const u8 *ssid;
2916c1e5f471SJohannes Berg 	const u8 *bssid;
2917683b6d3bSJohannes Berg 	struct cfg80211_chan_def chandef;
2918c1e5f471SJohannes Berg 	const u8 *ie;
291904a773adSJohannes Berg 	u8 ssid_len, ie_len;
29208e30bc55SJohannes Berg 	u16 beacon_interval;
2921fbd2c8dcSTeemu Paasikivi 	u32 basic_rates;
292204a773adSJohannes Berg 	bool channel_fixed;
2923fffd0934SJohannes Berg 	bool privacy;
2924267335d6SAntonio Quartulli 	bool control_port;
2925c3bfe1f6SDenis Kenzior 	bool control_port_over_nl80211;
29265336fa88SSimon Wunderlich 	bool userspace_handles_dfs;
292757fbcce3SJohannes Berg 	int mcast_rate[NUM_NL80211_BANDS];
2928803768f5SSimon Wunderlich 	struct ieee80211_ht_cap ht_capa;
2929803768f5SSimon Wunderlich 	struct ieee80211_ht_cap ht_capa_mask;
29309ae3b172STova Mussai 	struct key_params *wep_keys;
29319ae3b172STova Mussai 	int wep_tx_key;
293204a773adSJohannes Berg };
293304a773adSJohannes Berg 
293404a773adSJohannes Berg /**
293538de03d2SArend van Spriel  * struct cfg80211_bss_selection - connection parameters for BSS selection.
293638de03d2SArend van Spriel  *
293738de03d2SArend van Spriel  * @behaviour: requested BSS selection behaviour.
293838de03d2SArend van Spriel  * @param: parameters for requestion behaviour.
293938de03d2SArend van Spriel  * @band_pref: preferred band for %NL80211_BSS_SELECT_ATTR_BAND_PREF.
294038de03d2SArend van Spriel  * @adjust: parameters for %NL80211_BSS_SELECT_ATTR_RSSI_ADJUST.
294138de03d2SArend van Spriel  */
294238de03d2SArend van Spriel struct cfg80211_bss_selection {
294338de03d2SArend van Spriel 	enum nl80211_bss_select_attr behaviour;
294438de03d2SArend van Spriel 	union {
294557fbcce3SJohannes Berg 		enum nl80211_band band_pref;
294638de03d2SArend van Spriel 		struct cfg80211_bss_select_adjust adjust;
294738de03d2SArend van Spriel 	} param;
294838de03d2SArend van Spriel };
294938de03d2SArend van Spriel 
295038de03d2SArend van Spriel /**
2951b23aa676SSamuel Ortiz  * struct cfg80211_connect_params - Connection parameters
2952b23aa676SSamuel Ortiz  *
2953b23aa676SSamuel Ortiz  * This structure provides information needed to complete IEEE 802.11
2954b23aa676SSamuel Ortiz  * authentication and association.
2955b23aa676SSamuel Ortiz  *
2956b23aa676SSamuel Ortiz  * @channel: The channel to use or %NULL if not specified (auto-select based
2957b23aa676SSamuel Ortiz  *	on scan results)
29581df4a510SJouni Malinen  * @channel_hint: The channel of the recommended BSS for initial connection or
29591df4a510SJouni Malinen  *	%NULL if not specified
2960b23aa676SSamuel Ortiz  * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan
2961b23aa676SSamuel Ortiz  *	results)
29621df4a510SJouni Malinen  * @bssid_hint: The recommended AP BSSID for initial connection to the BSS or
29631df4a510SJouni Malinen  *	%NULL if not specified. Unlike the @bssid parameter, the driver is
29641df4a510SJouni Malinen  *	allowed to ignore this @bssid_hint if it has knowledge of a better BSS
29651df4a510SJouni Malinen  *	to use.
2966b23aa676SSamuel Ortiz  * @ssid: SSID
2967b23aa676SSamuel Ortiz  * @ssid_len: Length of ssid in octets
2968b23aa676SSamuel Ortiz  * @auth_type: Authentication type (algorithm)
2969abe37c4bSJohannes Berg  * @ie: IEs for association request
2970abe37c4bSJohannes Berg  * @ie_len: Length of assoc_ie in octets
2971b23aa676SSamuel Ortiz  * @privacy: indicates whether privacy-enabled APs should be used
2972cee00a95SJouni Malinen  * @mfp: indicate whether management frame protection is used
2973b23aa676SSamuel Ortiz  * @crypto: crypto settings
2974fffd0934SJohannes Berg  * @key_len: length of WEP key for shared key authentication
2975fffd0934SJohannes Berg  * @key_idx: index of WEP key for shared key authentication
2976fffd0934SJohannes Berg  * @key: WEP key for shared key authentication
29777e7c8926SBen Greear  * @flags:  See &enum cfg80211_assoc_req_flags
29784486ea98SBala Shanmugam  * @bg_scan_period:  Background scan period in seconds
29794486ea98SBala Shanmugam  *	or -1 to indicate that default value is to be used.
29807e7c8926SBen Greear  * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask
29817e7c8926SBen Greear  *	will be used in ht_capa.  Un-supported values will be ignored.
29827e7c8926SBen Greear  * @ht_capa_mask:  The bits of ht_capa which are to be used.
2983ee2aca34SJohannes Berg  * @vht_capa:  VHT Capability overrides
2984ee2aca34SJohannes Berg  * @vht_capa_mask: The bits of vht_capa which are to be used.
298534d50519SLior David  * @pbss: if set, connect to a PCP instead of AP. Valid for DMG
298634d50519SLior David  *	networks.
298738de03d2SArend van Spriel  * @bss_select: criteria to be used for BSS selection.
298835eb8f7bSJouni Malinen  * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used
298935eb8f7bSJouni Malinen  *	to indicate a request to reassociate within the ESS instead of a request
299035eb8f7bSJouni Malinen  *	do the initial association with the ESS. When included, this is set to
299135eb8f7bSJouni Malinen  *	the BSSID of the current association, i.e., to the value that is
299235eb8f7bSJouni Malinen  *	included in the Current AP address field of the Reassociation Request
299335eb8f7bSJouni Malinen  *	frame.
2994a3caf744SVidyullatha Kanchanapally  * @fils_erp_username: EAP re-authentication protocol (ERP) username part of the
2995a3caf744SVidyullatha Kanchanapally  *	NAI or %NULL if not specified. This is used to construct FILS wrapped
2996a3caf744SVidyullatha Kanchanapally  *	data IE.
2997a3caf744SVidyullatha Kanchanapally  * @fils_erp_username_len: Length of @fils_erp_username in octets.
2998a3caf744SVidyullatha Kanchanapally  * @fils_erp_realm: EAP re-authentication protocol (ERP) realm part of NAI or
2999a3caf744SVidyullatha Kanchanapally  *	%NULL if not specified. This specifies the domain name of ER server and
3000a3caf744SVidyullatha Kanchanapally  *	is used to construct FILS wrapped data IE.
3001a3caf744SVidyullatha Kanchanapally  * @fils_erp_realm_len: Length of @fils_erp_realm in octets.
3002a3caf744SVidyullatha Kanchanapally  * @fils_erp_next_seq_num: The next sequence number to use in the FILS ERP
3003a3caf744SVidyullatha Kanchanapally  *	messages. This is also used to construct FILS wrapped data IE.
3004a3caf744SVidyullatha Kanchanapally  * @fils_erp_rrk: ERP re-authentication Root Key (rRK) used to derive additional
3005a3caf744SVidyullatha Kanchanapally  *	keys in FILS or %NULL if not specified.
3006a3caf744SVidyullatha Kanchanapally  * @fils_erp_rrk_len: Length of @fils_erp_rrk in octets.
30073a00df57SAvraham Stern  * @want_1x: indicates user-space supports and wants to use 802.1X driver
30083a00df57SAvraham Stern  *	offload of 4-way handshake.
30092a38075cSAlexei Avshalom Lazar  * @edmg: define the EDMG channels.
30102a38075cSAlexei Avshalom Lazar  *	This may specify multiple channels and bonding options for the driver
30112a38075cSAlexei Avshalom Lazar  *	to choose from, based on BSS configuration.
3012b23aa676SSamuel Ortiz  */
3013b23aa676SSamuel Ortiz struct cfg80211_connect_params {
3014b23aa676SSamuel Ortiz 	struct ieee80211_channel *channel;
30151df4a510SJouni Malinen 	struct ieee80211_channel *channel_hint;
3016664834deSJouni Malinen 	const u8 *bssid;
30171df4a510SJouni Malinen 	const u8 *bssid_hint;
3018664834deSJouni Malinen 	const u8 *ssid;
3019b23aa676SSamuel Ortiz 	size_t ssid_len;
3020b23aa676SSamuel Ortiz 	enum nl80211_auth_type auth_type;
30214b5800feSJohannes Berg 	const u8 *ie;
3022b23aa676SSamuel Ortiz 	size_t ie_len;
3023b23aa676SSamuel Ortiz 	bool privacy;
3024cee00a95SJouni Malinen 	enum nl80211_mfp mfp;
3025b23aa676SSamuel Ortiz 	struct cfg80211_crypto_settings crypto;
3026fffd0934SJohannes Berg 	const u8 *key;
3027fffd0934SJohannes Berg 	u8 key_len, key_idx;
30287e7c8926SBen Greear 	u32 flags;
30294486ea98SBala Shanmugam 	int bg_scan_period;
30307e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa;
30317e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa_mask;
3032ee2aca34SJohannes Berg 	struct ieee80211_vht_cap vht_capa;
3033ee2aca34SJohannes Berg 	struct ieee80211_vht_cap vht_capa_mask;
303434d50519SLior David 	bool pbss;
303538de03d2SArend van Spriel 	struct cfg80211_bss_selection bss_select;
3036ba6fbacfSJouni Malinen 	const u8 *prev_bssid;
3037a3caf744SVidyullatha Kanchanapally 	const u8 *fils_erp_username;
3038a3caf744SVidyullatha Kanchanapally 	size_t fils_erp_username_len;
3039a3caf744SVidyullatha Kanchanapally 	const u8 *fils_erp_realm;
3040a3caf744SVidyullatha Kanchanapally 	size_t fils_erp_realm_len;
3041a3caf744SVidyullatha Kanchanapally 	u16 fils_erp_next_seq_num;
3042a3caf744SVidyullatha Kanchanapally 	const u8 *fils_erp_rrk;
3043a3caf744SVidyullatha Kanchanapally 	size_t fils_erp_rrk_len;
30443a00df57SAvraham Stern 	bool want_1x;
30452a38075cSAlexei Avshalom Lazar 	struct ieee80211_edmg edmg;
3046b23aa676SSamuel Ortiz };
3047b23aa676SSamuel Ortiz 
3048b23aa676SSamuel Ortiz /**
3049088e8df8Svamsi krishna  * enum cfg80211_connect_params_changed - Connection parameters being updated
3050088e8df8Svamsi krishna  *
3051088e8df8Svamsi krishna  * This enum provides information of all connect parameters that
3052088e8df8Svamsi krishna  * have to be updated as part of update_connect_params() call.
3053088e8df8Svamsi krishna  *
3054088e8df8Svamsi krishna  * @UPDATE_ASSOC_IES: Indicates whether association request IEs are updated
30557f9a3e15SVidyullatha Kanchanapally  * @UPDATE_FILS_ERP_INFO: Indicates that FILS connection parameters (realm,
30567f9a3e15SVidyullatha Kanchanapally  *	username, erp sequence number and rrk) are updated
30577f9a3e15SVidyullatha Kanchanapally  * @UPDATE_AUTH_TYPE: Indicates that authentication type is updated
3058088e8df8Svamsi krishna  */
3059088e8df8Svamsi krishna enum cfg80211_connect_params_changed {
3060088e8df8Svamsi krishna 	UPDATE_ASSOC_IES		= BIT(0),
30617f9a3e15SVidyullatha Kanchanapally 	UPDATE_FILS_ERP_INFO		= BIT(1),
30627f9a3e15SVidyullatha Kanchanapally 	UPDATE_AUTH_TYPE		= BIT(2),
3063088e8df8Svamsi krishna };
3064088e8df8Svamsi krishna 
3065088e8df8Svamsi krishna /**
3066b9a5f8caSJouni Malinen  * enum wiphy_params_flags - set_wiphy_params bitfield values
3067abe37c4bSJohannes Berg  * @WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed
3068abe37c4bSJohannes Berg  * @WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed
3069abe37c4bSJohannes Berg  * @WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed
3070abe37c4bSJohannes Berg  * @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed
3071abe37c4bSJohannes Berg  * @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed
30723057dbfdSLorenzo Bianconi  * @WIPHY_PARAM_DYN_ACK: dynack has been enabled
307352539ca8SToke Høiland-Jørgensen  * @WIPHY_PARAM_TXQ_LIMIT: TXQ packet limit has been changed
307452539ca8SToke Høiland-Jørgensen  * @WIPHY_PARAM_TXQ_MEMORY_LIMIT: TXQ memory limit has been changed
307552539ca8SToke Høiland-Jørgensen  * @WIPHY_PARAM_TXQ_QUANTUM: TXQ scheduler quantum
3076b9a5f8caSJouni Malinen  */
3077b9a5f8caSJouni Malinen enum wiphy_params_flags {
3078b9a5f8caSJouni Malinen 	WIPHY_PARAM_RETRY_SHORT		= 1 << 0,
3079b9a5f8caSJouni Malinen 	WIPHY_PARAM_RETRY_LONG		= 1 << 1,
3080b9a5f8caSJouni Malinen 	WIPHY_PARAM_FRAG_THRESHOLD	= 1 << 2,
3081b9a5f8caSJouni Malinen 	WIPHY_PARAM_RTS_THRESHOLD	= 1 << 3,
308281077e82SLukáš Turek 	WIPHY_PARAM_COVERAGE_CLASS	= 1 << 4,
30833057dbfdSLorenzo Bianconi 	WIPHY_PARAM_DYN_ACK		= 1 << 5,
308452539ca8SToke Høiland-Jørgensen 	WIPHY_PARAM_TXQ_LIMIT		= 1 << 6,
308552539ca8SToke Høiland-Jørgensen 	WIPHY_PARAM_TXQ_MEMORY_LIMIT	= 1 << 7,
308652539ca8SToke Høiland-Jørgensen 	WIPHY_PARAM_TXQ_QUANTUM		= 1 << 8,
3087b9a5f8caSJouni Malinen };
3088b9a5f8caSJouni Malinen 
308936647055SToke Høiland-Jørgensen #define IEEE80211_DEFAULT_AIRTIME_WEIGHT	256
309036647055SToke Høiland-Jørgensen 
30913ace10f5SKan Yan /* The per TXQ device queue limit in airtime */
30923ace10f5SKan Yan #define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_L	5000
30933ace10f5SKan Yan #define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_H	12000
30943ace10f5SKan Yan 
30953ace10f5SKan Yan /* The per interface airtime threshold to switch to lower queue limit */
30963ace10f5SKan Yan #define IEEE80211_AQL_THRESHOLD			24000
30973ace10f5SKan Yan 
309867fbb16bSSamuel Ortiz /**
309967fbb16bSSamuel Ortiz  * struct cfg80211_pmksa - PMK Security Association
310067fbb16bSSamuel Ortiz  *
310167fbb16bSSamuel Ortiz  * This structure is passed to the set/del_pmksa() method for PMKSA
310267fbb16bSSamuel Ortiz  * caching.
310367fbb16bSSamuel Ortiz  *
3104a3caf744SVidyullatha Kanchanapally  * @bssid: The AP's BSSID (may be %NULL).
3105a3caf744SVidyullatha Kanchanapally  * @pmkid: The identifier to refer a PMKSA.
3106a3caf744SVidyullatha Kanchanapally  * @pmk: The PMK for the PMKSA identified by @pmkid. This is used for key
3107a3caf744SVidyullatha Kanchanapally  *	derivation by a FILS STA. Otherwise, %NULL.
3108a3caf744SVidyullatha Kanchanapally  * @pmk_len: Length of the @pmk. The length of @pmk can differ depending on
3109a3caf744SVidyullatha Kanchanapally  *	the hash algorithm used to generate this.
3110a3caf744SVidyullatha Kanchanapally  * @ssid: SSID to specify the ESS within which a PMKSA is valid when using FILS
3111a3caf744SVidyullatha Kanchanapally  *	cache identifier (may be %NULL).
3112a3caf744SVidyullatha Kanchanapally  * @ssid_len: Length of the @ssid in octets.
3113a3caf744SVidyullatha Kanchanapally  * @cache_id: 2-octet cache identifier advertized by a FILS AP identifying the
3114a3caf744SVidyullatha Kanchanapally  *	scope of PMKSA. This is valid only if @ssid_len is non-zero (may be
3115a3caf744SVidyullatha Kanchanapally  *	%NULL).
31167fc82af8SVeerendranath Jakkam  * @pmk_lifetime: Maximum lifetime for PMKSA in seconds
31177fc82af8SVeerendranath Jakkam  *	(dot11RSNAConfigPMKLifetime) or 0 if not specified.
31187fc82af8SVeerendranath Jakkam  *	The configured PMKSA must not be used for PMKSA caching after
31197fc82af8SVeerendranath Jakkam  *	expiration and any keys derived from this PMK become invalid on
31207fc82af8SVeerendranath Jakkam  *	expiration, i.e., the current association must be dropped if the PMK
31217fc82af8SVeerendranath Jakkam  *	used for it expires.
31227fc82af8SVeerendranath Jakkam  * @pmk_reauth_threshold: Threshold time for reauthentication (percentage of
31237fc82af8SVeerendranath Jakkam  *	PMK lifetime, dot11RSNAConfigPMKReauthThreshold) or 0 if not specified.
31247fc82af8SVeerendranath Jakkam  *	Drivers are expected to trigger a full authentication instead of using
31257fc82af8SVeerendranath Jakkam  *	this PMKSA for caching when reassociating to a new BSS after this
31267fc82af8SVeerendranath Jakkam  *	threshold to generate a new PMK before the current one expires.
312767fbb16bSSamuel Ortiz  */
312867fbb16bSSamuel Ortiz struct cfg80211_pmksa {
3129c1e5f471SJohannes Berg 	const u8 *bssid;
3130c1e5f471SJohannes Berg 	const u8 *pmkid;
3131a3caf744SVidyullatha Kanchanapally 	const u8 *pmk;
3132a3caf744SVidyullatha Kanchanapally 	size_t pmk_len;
3133a3caf744SVidyullatha Kanchanapally 	const u8 *ssid;
3134a3caf744SVidyullatha Kanchanapally 	size_t ssid_len;
3135a3caf744SVidyullatha Kanchanapally 	const u8 *cache_id;
31367fc82af8SVeerendranath Jakkam 	u32 pmk_lifetime;
31377fc82af8SVeerendranath Jakkam 	u8 pmk_reauth_threshold;
313867fbb16bSSamuel Ortiz };
31399930380fSJohannes Berg 
31407643a2c3SJohannes Berg /**
314150ac6607SAmitkumar Karwar  * struct cfg80211_pkt_pattern - packet pattern
3142ff1b6e69SJohannes Berg  * @mask: bitmask where to match pattern and where to ignore bytes,
3143ff1b6e69SJohannes Berg  *	one bit per byte, in same format as nl80211
3144ff1b6e69SJohannes Berg  * @pattern: bytes to match where bitmask is 1
3145ff1b6e69SJohannes Berg  * @pattern_len: length of pattern (in bytes)
3146bb92d199SAmitkumar Karwar  * @pkt_offset: packet offset (in bytes)
3147ff1b6e69SJohannes Berg  *
3148ff1b6e69SJohannes Berg  * Internal note: @mask and @pattern are allocated in one chunk of
3149ff1b6e69SJohannes Berg  * memory, free @mask only!
3150ff1b6e69SJohannes Berg  */
315150ac6607SAmitkumar Karwar struct cfg80211_pkt_pattern {
3152922bd80fSJohannes Berg 	const u8 *mask, *pattern;
3153ff1b6e69SJohannes Berg 	int pattern_len;
3154bb92d199SAmitkumar Karwar 	int pkt_offset;
3155ff1b6e69SJohannes Berg };
3156ff1b6e69SJohannes Berg 
3157ff1b6e69SJohannes Berg /**
31582a0e047eSJohannes Berg  * struct cfg80211_wowlan_tcp - TCP connection parameters
31592a0e047eSJohannes Berg  *
31602a0e047eSJohannes Berg  * @sock: (internal) socket for source port allocation
31612a0e047eSJohannes Berg  * @src: source IP address
31622a0e047eSJohannes Berg  * @dst: destination IP address
31632a0e047eSJohannes Berg  * @dst_mac: destination MAC address
31642a0e047eSJohannes Berg  * @src_port: source port
31652a0e047eSJohannes Berg  * @dst_port: destination port
31662a0e047eSJohannes Berg  * @payload_len: data payload length
31672a0e047eSJohannes Berg  * @payload: data payload buffer
31682a0e047eSJohannes Berg  * @payload_seq: payload sequence stamping configuration
31692a0e047eSJohannes Berg  * @data_interval: interval at which to send data packets
31702a0e047eSJohannes Berg  * @wake_len: wakeup payload match length
31712a0e047eSJohannes Berg  * @wake_data: wakeup payload match data
31722a0e047eSJohannes Berg  * @wake_mask: wakeup payload match mask
31732a0e047eSJohannes Berg  * @tokens_size: length of the tokens buffer
31742a0e047eSJohannes Berg  * @payload_tok: payload token usage configuration
31752a0e047eSJohannes Berg  */
31762a0e047eSJohannes Berg struct cfg80211_wowlan_tcp {
31772a0e047eSJohannes Berg 	struct socket *sock;
31782a0e047eSJohannes Berg 	__be32 src, dst;
31792a0e047eSJohannes Berg 	u16 src_port, dst_port;
31802a0e047eSJohannes Berg 	u8 dst_mac[ETH_ALEN];
31812a0e047eSJohannes Berg 	int payload_len;
31822a0e047eSJohannes Berg 	const u8 *payload;
31832a0e047eSJohannes Berg 	struct nl80211_wowlan_tcp_data_seq payload_seq;
31842a0e047eSJohannes Berg 	u32 data_interval;
31852a0e047eSJohannes Berg 	u32 wake_len;
31862a0e047eSJohannes Berg 	const u8 *wake_data, *wake_mask;
31872a0e047eSJohannes Berg 	u32 tokens_size;
31882a0e047eSJohannes Berg 	/* must be last, variable member */
31892a0e047eSJohannes Berg 	struct nl80211_wowlan_tcp_data_token payload_tok;
3190ff1b6e69SJohannes Berg };
3191ff1b6e69SJohannes Berg 
3192ff1b6e69SJohannes Berg /**
3193ff1b6e69SJohannes Berg  * struct cfg80211_wowlan - Wake on Wireless-LAN support info
3194ff1b6e69SJohannes Berg  *
3195ff1b6e69SJohannes Berg  * This structure defines the enabled WoWLAN triggers for the device.
3196ff1b6e69SJohannes Berg  * @any: wake up on any activity -- special trigger if device continues
3197ff1b6e69SJohannes Berg  *	operating as normal during suspend
3198ff1b6e69SJohannes Berg  * @disconnect: wake up if getting disconnected
3199ff1b6e69SJohannes Berg  * @magic_pkt: wake up on receiving magic packet
3200ff1b6e69SJohannes Berg  * @patterns: wake up on receiving packet matching a pattern
3201ff1b6e69SJohannes Berg  * @n_patterns: number of patterns
320277dbbb13SJohannes Berg  * @gtk_rekey_failure: wake up on GTK rekey failure
320377dbbb13SJohannes Berg  * @eap_identity_req: wake up on EAP identity request packet
320477dbbb13SJohannes Berg  * @four_way_handshake: wake up on 4-way handshake
320577dbbb13SJohannes Berg  * @rfkill_release: wake up when rfkill is released
32062a0e047eSJohannes Berg  * @tcp: TCP connection establishment/wakeup parameters, see nl80211.h.
32072a0e047eSJohannes Berg  *	NULL if not configured.
32088cd4d456SLuciano Coelho  * @nd_config: configuration for the scan to be used for net detect wake.
3209ff1b6e69SJohannes Berg  */
3210ff1b6e69SJohannes Berg struct cfg80211_wowlan {
321177dbbb13SJohannes Berg 	bool any, disconnect, magic_pkt, gtk_rekey_failure,
321277dbbb13SJohannes Berg 	     eap_identity_req, four_way_handshake,
321377dbbb13SJohannes Berg 	     rfkill_release;
321450ac6607SAmitkumar Karwar 	struct cfg80211_pkt_pattern *patterns;
32152a0e047eSJohannes Berg 	struct cfg80211_wowlan_tcp *tcp;
3216ff1b6e69SJohannes Berg 	int n_patterns;
32178cd4d456SLuciano Coelho 	struct cfg80211_sched_scan_request *nd_config;
3218ff1b6e69SJohannes Berg };
3219ff1b6e69SJohannes Berg 
3220ff1b6e69SJohannes Berg /**
3221be29b99aSAmitkumar Karwar  * struct cfg80211_coalesce_rules - Coalesce rule parameters
3222be29b99aSAmitkumar Karwar  *
3223be29b99aSAmitkumar Karwar  * This structure defines coalesce rule for the device.
3224be29b99aSAmitkumar Karwar  * @delay: maximum coalescing delay in msecs.
3225be29b99aSAmitkumar Karwar  * @condition: condition for packet coalescence.
3226be29b99aSAmitkumar Karwar  *	see &enum nl80211_coalesce_condition.
3227be29b99aSAmitkumar Karwar  * @patterns: array of packet patterns
3228be29b99aSAmitkumar Karwar  * @n_patterns: number of patterns
3229be29b99aSAmitkumar Karwar  */
3230be29b99aSAmitkumar Karwar struct cfg80211_coalesce_rules {
3231be29b99aSAmitkumar Karwar 	int delay;
3232be29b99aSAmitkumar Karwar 	enum nl80211_coalesce_condition condition;
3233be29b99aSAmitkumar Karwar 	struct cfg80211_pkt_pattern *patterns;
3234be29b99aSAmitkumar Karwar 	int n_patterns;
3235be29b99aSAmitkumar Karwar };
3236be29b99aSAmitkumar Karwar 
3237be29b99aSAmitkumar Karwar /**
3238be29b99aSAmitkumar Karwar  * struct cfg80211_coalesce - Packet coalescing settings
3239be29b99aSAmitkumar Karwar  *
3240be29b99aSAmitkumar Karwar  * This structure defines coalescing settings.
3241be29b99aSAmitkumar Karwar  * @rules: array of coalesce rules
3242be29b99aSAmitkumar Karwar  * @n_rules: number of rules
3243be29b99aSAmitkumar Karwar  */
3244be29b99aSAmitkumar Karwar struct cfg80211_coalesce {
3245be29b99aSAmitkumar Karwar 	struct cfg80211_coalesce_rules *rules;
3246be29b99aSAmitkumar Karwar 	int n_rules;
3247be29b99aSAmitkumar Karwar };
3248be29b99aSAmitkumar Karwar 
3249be29b99aSAmitkumar Karwar /**
32508cd4d456SLuciano Coelho  * struct cfg80211_wowlan_nd_match - information about the match
32518cd4d456SLuciano Coelho  *
32528cd4d456SLuciano Coelho  * @ssid: SSID of the match that triggered the wake up
32538cd4d456SLuciano Coelho  * @n_channels: Number of channels where the match occurred.  This
32548cd4d456SLuciano Coelho  *	value may be zero if the driver can't report the channels.
32558cd4d456SLuciano Coelho  * @channels: center frequencies of the channels where a match
32568cd4d456SLuciano Coelho  *	occurred (in MHz)
32578cd4d456SLuciano Coelho  */
32588cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_match {
32598cd4d456SLuciano Coelho 	struct cfg80211_ssid ssid;
32608cd4d456SLuciano Coelho 	int n_channels;
32618cd4d456SLuciano Coelho 	u32 channels[];
32628cd4d456SLuciano Coelho };
32638cd4d456SLuciano Coelho 
32648cd4d456SLuciano Coelho /**
32658cd4d456SLuciano Coelho  * struct cfg80211_wowlan_nd_info - net detect wake up information
32668cd4d456SLuciano Coelho  *
32678cd4d456SLuciano Coelho  * @n_matches: Number of match information instances provided in
32688cd4d456SLuciano Coelho  *	@matches.  This value may be zero if the driver can't provide
32698cd4d456SLuciano Coelho  *	match information.
32708cd4d456SLuciano Coelho  * @matches: Array of pointers to matches containing information about
32718cd4d456SLuciano Coelho  *	the matches that triggered the wake up.
32728cd4d456SLuciano Coelho  */
32738cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_info {
32748cd4d456SLuciano Coelho 	int n_matches;
32758cd4d456SLuciano Coelho 	struct cfg80211_wowlan_nd_match *matches[];
32768cd4d456SLuciano Coelho };
32778cd4d456SLuciano Coelho 
32788cd4d456SLuciano Coelho /**
3279cd8f7cb4SJohannes Berg  * struct cfg80211_wowlan_wakeup - wakeup report
3280cd8f7cb4SJohannes Berg  * @disconnect: woke up by getting disconnected
3281cd8f7cb4SJohannes Berg  * @magic_pkt: woke up by receiving magic packet
3282cd8f7cb4SJohannes Berg  * @gtk_rekey_failure: woke up by GTK rekey failure
3283cd8f7cb4SJohannes Berg  * @eap_identity_req: woke up by EAP identity request packet
3284cd8f7cb4SJohannes Berg  * @four_way_handshake: woke up by 4-way handshake
3285cd8f7cb4SJohannes Berg  * @rfkill_release: woke up by rfkill being released
3286cd8f7cb4SJohannes Berg  * @pattern_idx: pattern that caused wakeup, -1 if not due to pattern
3287cd8f7cb4SJohannes Berg  * @packet_present_len: copied wakeup packet data
3288cd8f7cb4SJohannes Berg  * @packet_len: original wakeup packet length
3289cd8f7cb4SJohannes Berg  * @packet: The packet causing the wakeup, if any.
3290cd8f7cb4SJohannes Berg  * @packet_80211:  For pattern match, magic packet and other data
3291cd8f7cb4SJohannes Berg  *	frame triggers an 802.3 frame should be reported, for
3292cd8f7cb4SJohannes Berg  *	disconnect due to deauth 802.11 frame. This indicates which
3293cd8f7cb4SJohannes Berg  *	it is.
32942a0e047eSJohannes Berg  * @tcp_match: TCP wakeup packet received
32952a0e047eSJohannes Berg  * @tcp_connlost: TCP connection lost or failed to establish
32962a0e047eSJohannes Berg  * @tcp_nomoretokens: TCP data ran out of tokens
32978cd4d456SLuciano Coelho  * @net_detect: if not %NULL, woke up because of net detect
3298cd8f7cb4SJohannes Berg  */
3299cd8f7cb4SJohannes Berg struct cfg80211_wowlan_wakeup {
3300cd8f7cb4SJohannes Berg 	bool disconnect, magic_pkt, gtk_rekey_failure,
3301cd8f7cb4SJohannes Berg 	     eap_identity_req, four_way_handshake,
33022a0e047eSJohannes Berg 	     rfkill_release, packet_80211,
33032a0e047eSJohannes Berg 	     tcp_match, tcp_connlost, tcp_nomoretokens;
3304cd8f7cb4SJohannes Berg 	s32 pattern_idx;
3305cd8f7cb4SJohannes Berg 	u32 packet_present_len, packet_len;
3306cd8f7cb4SJohannes Berg 	const void *packet;
33078cd4d456SLuciano Coelho 	struct cfg80211_wowlan_nd_info *net_detect;
3308cd8f7cb4SJohannes Berg };
3309cd8f7cb4SJohannes Berg 
3310cd8f7cb4SJohannes Berg /**
3311e5497d76SJohannes Berg  * struct cfg80211_gtk_rekey_data - rekey data
3312093a48d2SNathan Errera  * @kek: key encryption key (@kek_len bytes)
3313093a48d2SNathan Errera  * @kck: key confirmation key (@kck_len bytes)
331478f686caSJohannes Berg  * @replay_ctr: replay counter (NL80211_REPLAY_CTR_LEN bytes)
3315093a48d2SNathan Errera  * @kek_len: length of kek
3316093a48d2SNathan Errera  * @kck_len length of kck
3317093a48d2SNathan Errera  * @akm: akm (oui, id)
3318e5497d76SJohannes Berg  */
3319e5497d76SJohannes Berg struct cfg80211_gtk_rekey_data {
332078f686caSJohannes Berg 	const u8 *kek, *kck, *replay_ctr;
3321093a48d2SNathan Errera 	u32 akm;
3322093a48d2SNathan Errera 	u8 kek_len, kck_len;
3323e5497d76SJohannes Berg };
3324e5497d76SJohannes Berg 
3325e5497d76SJohannes Berg /**
3326355199e0SJouni Malinen  * struct cfg80211_update_ft_ies_params - FT IE Information
3327355199e0SJouni Malinen  *
3328355199e0SJouni Malinen  * This structure provides information needed to update the fast transition IE
3329355199e0SJouni Malinen  *
3330355199e0SJouni Malinen  * @md: The Mobility Domain ID, 2 Octet value
3331355199e0SJouni Malinen  * @ie: Fast Transition IEs
3332355199e0SJouni Malinen  * @ie_len: Length of ft_ie in octets
3333355199e0SJouni Malinen  */
3334355199e0SJouni Malinen struct cfg80211_update_ft_ies_params {
3335355199e0SJouni Malinen 	u16 md;
3336355199e0SJouni Malinen 	const u8 *ie;
3337355199e0SJouni Malinen 	size_t ie_len;
3338355199e0SJouni Malinen };
3339355199e0SJouni Malinen 
3340355199e0SJouni Malinen /**
3341b176e629SAndrei Otcheretianski  * struct cfg80211_mgmt_tx_params - mgmt tx parameters
3342b176e629SAndrei Otcheretianski  *
3343b176e629SAndrei Otcheretianski  * This structure provides information needed to transmit a mgmt frame
3344b176e629SAndrei Otcheretianski  *
3345b176e629SAndrei Otcheretianski  * @chan: channel to use
3346b176e629SAndrei Otcheretianski  * @offchan: indicates wether off channel operation is required
3347b176e629SAndrei Otcheretianski  * @wait: duration for ROC
3348b176e629SAndrei Otcheretianski  * @buf: buffer to transmit
3349b176e629SAndrei Otcheretianski  * @len: buffer length
3350b176e629SAndrei Otcheretianski  * @no_cck: don't use cck rates for this frame
3351b176e629SAndrei Otcheretianski  * @dont_wait_for_ack: tells the low level not to wait for an ack
335234d22ce2SAndrei Otcheretianski  * @n_csa_offsets: length of csa_offsets array
335334d22ce2SAndrei Otcheretianski  * @csa_offsets: array of all the csa offsets in the frame
3354b176e629SAndrei Otcheretianski  */
3355b176e629SAndrei Otcheretianski struct cfg80211_mgmt_tx_params {
3356b176e629SAndrei Otcheretianski 	struct ieee80211_channel *chan;
3357b176e629SAndrei Otcheretianski 	bool offchan;
3358b176e629SAndrei Otcheretianski 	unsigned int wait;
3359b176e629SAndrei Otcheretianski 	const u8 *buf;
3360b176e629SAndrei Otcheretianski 	size_t len;
3361b176e629SAndrei Otcheretianski 	bool no_cck;
3362b176e629SAndrei Otcheretianski 	bool dont_wait_for_ack;
336334d22ce2SAndrei Otcheretianski 	int n_csa_offsets;
336434d22ce2SAndrei Otcheretianski 	const u16 *csa_offsets;
3365b176e629SAndrei Otcheretianski };
3366b176e629SAndrei Otcheretianski 
3367b176e629SAndrei Otcheretianski /**
3368fa9ffc74SKyeyoon Park  * struct cfg80211_dscp_exception - DSCP exception
3369fa9ffc74SKyeyoon Park  *
3370fa9ffc74SKyeyoon Park  * @dscp: DSCP value that does not adhere to the user priority range definition
3371fa9ffc74SKyeyoon Park  * @up: user priority value to which the corresponding DSCP value belongs
3372fa9ffc74SKyeyoon Park  */
3373fa9ffc74SKyeyoon Park struct cfg80211_dscp_exception {
3374fa9ffc74SKyeyoon Park 	u8 dscp;
3375fa9ffc74SKyeyoon Park 	u8 up;
3376fa9ffc74SKyeyoon Park };
3377fa9ffc74SKyeyoon Park 
3378fa9ffc74SKyeyoon Park /**
3379fa9ffc74SKyeyoon Park  * struct cfg80211_dscp_range - DSCP range definition for user priority
3380fa9ffc74SKyeyoon Park  *
3381fa9ffc74SKyeyoon Park  * @low: lowest DSCP value of this user priority range, inclusive
3382fa9ffc74SKyeyoon Park  * @high: highest DSCP value of this user priority range, inclusive
3383fa9ffc74SKyeyoon Park  */
3384fa9ffc74SKyeyoon Park struct cfg80211_dscp_range {
3385fa9ffc74SKyeyoon Park 	u8 low;
3386fa9ffc74SKyeyoon Park 	u8 high;
3387fa9ffc74SKyeyoon Park };
3388fa9ffc74SKyeyoon Park 
3389fa9ffc74SKyeyoon Park /* QoS Map Set element length defined in IEEE Std 802.11-2012, 8.4.2.97 */
3390fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_MAX_EX	21
3391fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_LEN_MIN	16
3392fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_LEN_MAX \
3393fa9ffc74SKyeyoon Park 	(IEEE80211_QOS_MAP_LEN_MIN + 2 * IEEE80211_QOS_MAP_MAX_EX)
3394fa9ffc74SKyeyoon Park 
3395fa9ffc74SKyeyoon Park /**
3396fa9ffc74SKyeyoon Park  * struct cfg80211_qos_map - QoS Map Information
3397fa9ffc74SKyeyoon Park  *
3398fa9ffc74SKyeyoon Park  * This struct defines the Interworking QoS map setting for DSCP values
3399fa9ffc74SKyeyoon Park  *
3400fa9ffc74SKyeyoon Park  * @num_des: number of DSCP exceptions (0..21)
3401fa9ffc74SKyeyoon Park  * @dscp_exception: optionally up to maximum of 21 DSCP exceptions from
3402fa9ffc74SKyeyoon Park  *	the user priority DSCP range definition
3403fa9ffc74SKyeyoon Park  * @up: DSCP range definition for a particular user priority
3404fa9ffc74SKyeyoon Park  */
3405fa9ffc74SKyeyoon Park struct cfg80211_qos_map {
3406fa9ffc74SKyeyoon Park 	u8 num_des;
3407fa9ffc74SKyeyoon Park 	struct cfg80211_dscp_exception dscp_exception[IEEE80211_QOS_MAP_MAX_EX];
3408fa9ffc74SKyeyoon Park 	struct cfg80211_dscp_range up[8];
3409fa9ffc74SKyeyoon Park };
3410fa9ffc74SKyeyoon Park 
3411fa9ffc74SKyeyoon Park /**
3412cb3b7d87SAyala Beker  * struct cfg80211_nan_conf - NAN configuration
3413cb3b7d87SAyala Beker  *
3414cb3b7d87SAyala Beker  * This struct defines NAN configuration parameters
3415cb3b7d87SAyala Beker  *
3416cb3b7d87SAyala Beker  * @master_pref: master preference (1 - 255)
34178585989dSLuca Coelho  * @bands: operating bands, a bitmap of &enum nl80211_band values.
34188585989dSLuca Coelho  *	For instance, for NL80211_BAND_2GHZ, bit 0 would be set
34198585989dSLuca Coelho  *	(i.e. BIT(NL80211_BAND_2GHZ)).
3420cb3b7d87SAyala Beker  */
3421cb3b7d87SAyala Beker struct cfg80211_nan_conf {
3422cb3b7d87SAyala Beker 	u8 master_pref;
34238585989dSLuca Coelho 	u8 bands;
3424cb3b7d87SAyala Beker };
3425cb3b7d87SAyala Beker 
3426cb3b7d87SAyala Beker /**
3427a5a9dcf2SAyala Beker  * enum cfg80211_nan_conf_changes - indicates changed fields in NAN
3428a5a9dcf2SAyala Beker  * configuration
3429a5a9dcf2SAyala Beker  *
3430a5a9dcf2SAyala Beker  * @CFG80211_NAN_CONF_CHANGED_PREF: master preference
34318585989dSLuca Coelho  * @CFG80211_NAN_CONF_CHANGED_BANDS: operating bands
3432a5a9dcf2SAyala Beker  */
3433a5a9dcf2SAyala Beker enum cfg80211_nan_conf_changes {
3434a5a9dcf2SAyala Beker 	CFG80211_NAN_CONF_CHANGED_PREF = BIT(0),
34358585989dSLuca Coelho 	CFG80211_NAN_CONF_CHANGED_BANDS = BIT(1),
3436a5a9dcf2SAyala Beker };
3437a5a9dcf2SAyala Beker 
3438a5a9dcf2SAyala Beker /**
3439a442b761SAyala Beker  * struct cfg80211_nan_func_filter - a NAN function Rx / Tx filter
3440a442b761SAyala Beker  *
3441a442b761SAyala Beker  * @filter: the content of the filter
3442a442b761SAyala Beker  * @len: the length of the filter
3443a442b761SAyala Beker  */
3444a442b761SAyala Beker struct cfg80211_nan_func_filter {
3445a442b761SAyala Beker 	const u8 *filter;
3446a442b761SAyala Beker 	u8 len;
3447a442b761SAyala Beker };
3448a442b761SAyala Beker 
3449a442b761SAyala Beker /**
3450a442b761SAyala Beker  * struct cfg80211_nan_func - a NAN function
3451a442b761SAyala Beker  *
3452a442b761SAyala Beker  * @type: &enum nl80211_nan_function_type
3453a442b761SAyala Beker  * @service_id: the service ID of the function
3454a442b761SAyala Beker  * @publish_type: &nl80211_nan_publish_type
3455a442b761SAyala Beker  * @close_range: if true, the range should be limited. Threshold is
3456a442b761SAyala Beker  *	implementation specific.
3457a442b761SAyala Beker  * @publish_bcast: if true, the solicited publish should be broadcasted
3458a442b761SAyala Beker  * @subscribe_active: if true, the subscribe is active
3459a442b761SAyala Beker  * @followup_id: the instance ID for follow up
3460a442b761SAyala Beker  * @followup_reqid: the requestor instance ID for follow up
3461a442b761SAyala Beker  * @followup_dest: MAC address of the recipient of the follow up
3462a442b761SAyala Beker  * @ttl: time to live counter in DW.
3463a442b761SAyala Beker  * @serv_spec_info: Service Specific Info
3464a442b761SAyala Beker  * @serv_spec_info_len: Service Specific Info length
3465a442b761SAyala Beker  * @srf_include: if true, SRF is inclusive
3466a442b761SAyala Beker  * @srf_bf: Bloom Filter
3467a442b761SAyala Beker  * @srf_bf_len: Bloom Filter length
3468a442b761SAyala Beker  * @srf_bf_idx: Bloom Filter index
3469a442b761SAyala Beker  * @srf_macs: SRF MAC addresses
3470a442b761SAyala Beker  * @srf_num_macs: number of MAC addresses in SRF
3471a442b761SAyala Beker  * @rx_filters: rx filters that are matched with corresponding peer's tx_filter
3472a442b761SAyala Beker  * @tx_filters: filters that should be transmitted in the SDF.
3473a442b761SAyala Beker  * @num_rx_filters: length of &rx_filters.
3474a442b761SAyala Beker  * @num_tx_filters: length of &tx_filters.
3475a442b761SAyala Beker  * @instance_id: driver allocated id of the function.
3476a442b761SAyala Beker  * @cookie: unique NAN function identifier.
3477a442b761SAyala Beker  */
3478a442b761SAyala Beker struct cfg80211_nan_func {
3479a442b761SAyala Beker 	enum nl80211_nan_function_type type;
3480a442b761SAyala Beker 	u8 service_id[NL80211_NAN_FUNC_SERVICE_ID_LEN];
3481a442b761SAyala Beker 	u8 publish_type;
3482a442b761SAyala Beker 	bool close_range;
3483a442b761SAyala Beker 	bool publish_bcast;
3484a442b761SAyala Beker 	bool subscribe_active;
3485a442b761SAyala Beker 	u8 followup_id;
3486a442b761SAyala Beker 	u8 followup_reqid;
3487a442b761SAyala Beker 	struct mac_address followup_dest;
3488a442b761SAyala Beker 	u32 ttl;
3489a442b761SAyala Beker 	const u8 *serv_spec_info;
3490a442b761SAyala Beker 	u8 serv_spec_info_len;
3491a442b761SAyala Beker 	bool srf_include;
3492a442b761SAyala Beker 	const u8 *srf_bf;
3493a442b761SAyala Beker 	u8 srf_bf_len;
3494a442b761SAyala Beker 	u8 srf_bf_idx;
3495a442b761SAyala Beker 	struct mac_address *srf_macs;
3496a442b761SAyala Beker 	int srf_num_macs;
3497a442b761SAyala Beker 	struct cfg80211_nan_func_filter *rx_filters;
3498a442b761SAyala Beker 	struct cfg80211_nan_func_filter *tx_filters;
3499a442b761SAyala Beker 	u8 num_tx_filters;
3500a442b761SAyala Beker 	u8 num_rx_filters;
3501a442b761SAyala Beker 	u8 instance_id;
3502a442b761SAyala Beker 	u64 cookie;
3503a442b761SAyala Beker };
3504a442b761SAyala Beker 
3505a442b761SAyala Beker /**
35063a00df57SAvraham Stern  * struct cfg80211_pmk_conf - PMK configuration
35073a00df57SAvraham Stern  *
35083a00df57SAvraham Stern  * @aa: authenticator address
35093a00df57SAvraham Stern  * @pmk_len: PMK length in bytes.
35103a00df57SAvraham Stern  * @pmk: the PMK material
35113a00df57SAvraham Stern  * @pmk_r0_name: PMK-R0 Name. NULL if not applicable (i.e., the PMK
35123a00df57SAvraham Stern  *	is not PMK-R0). When pmk_r0_name is not NULL, the pmk field
35133a00df57SAvraham Stern  *	holds PMK-R0.
35143a00df57SAvraham Stern  */
35153a00df57SAvraham Stern struct cfg80211_pmk_conf {
35163a00df57SAvraham Stern 	const u8 *aa;
35173a00df57SAvraham Stern 	u8 pmk_len;
35183a00df57SAvraham Stern 	const u8 *pmk;
35193a00df57SAvraham Stern 	const u8 *pmk_r0_name;
35203a00df57SAvraham Stern };
35213a00df57SAvraham Stern 
35223a00df57SAvraham Stern /**
352340cbfa90SSrinivas Dasari  * struct cfg80211_external_auth_params - Trigger External authentication.
352440cbfa90SSrinivas Dasari  *
352540cbfa90SSrinivas Dasari  * Commonly used across the external auth request and event interfaces.
352640cbfa90SSrinivas Dasari  *
352740cbfa90SSrinivas Dasari  * @action: action type / trigger for external authentication. Only significant
352840cbfa90SSrinivas Dasari  *	for the authentication request event interface (driver to user space).
352940cbfa90SSrinivas Dasari  * @bssid: BSSID of the peer with which the authentication has
353040cbfa90SSrinivas Dasari  *	to happen. Used by both the authentication request event and
353140cbfa90SSrinivas Dasari  *	authentication response command interface.
353240cbfa90SSrinivas Dasari  * @ssid: SSID of the AP.  Used by both the authentication request event and
353340cbfa90SSrinivas Dasari  *	authentication response command interface.
353440cbfa90SSrinivas Dasari  * @key_mgmt_suite: AKM suite of the respective authentication. Used by the
353540cbfa90SSrinivas Dasari  *	authentication request event interface.
353640cbfa90SSrinivas Dasari  * @status: status code, %WLAN_STATUS_SUCCESS for successful authentication,
353740cbfa90SSrinivas Dasari  *	use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space cannot give you
353840cbfa90SSrinivas Dasari  *	the real status code for failures. Used only for the authentication
353940cbfa90SSrinivas Dasari  *	response command interface (user space to driver).
3540fe494370SSrinivas Dasari  * @pmkid: The identifier to refer a PMKSA.
354140cbfa90SSrinivas Dasari  */
354240cbfa90SSrinivas Dasari struct cfg80211_external_auth_params {
354340cbfa90SSrinivas Dasari 	enum nl80211_external_auth_action action;
354440cbfa90SSrinivas Dasari 	u8 bssid[ETH_ALEN] __aligned(2);
354540cbfa90SSrinivas Dasari 	struct cfg80211_ssid ssid;
354640cbfa90SSrinivas Dasari 	unsigned int key_mgmt_suite;
354740cbfa90SSrinivas Dasari 	u16 status;
3548fe494370SSrinivas Dasari 	const u8 *pmkid;
354940cbfa90SSrinivas Dasari };
355040cbfa90SSrinivas Dasari 
355140cbfa90SSrinivas Dasari /**
35523453de98SRandy Dunlap  * struct cfg80211_ftm_responder_stats - FTM responder statistics
355381e54d08SPradeep Kumar Chitrapu  *
355481e54d08SPradeep Kumar Chitrapu  * @filled: bitflag of flags using the bits of &enum nl80211_ftm_stats to
355581e54d08SPradeep Kumar Chitrapu  *	indicate the relevant values in this struct for them
355681e54d08SPradeep Kumar Chitrapu  * @success_num: number of FTM sessions in which all frames were successfully
355781e54d08SPradeep Kumar Chitrapu  *	answered
355881e54d08SPradeep Kumar Chitrapu  * @partial_num: number of FTM sessions in which part of frames were
355981e54d08SPradeep Kumar Chitrapu  *	successfully answered
356081e54d08SPradeep Kumar Chitrapu  * @failed_num: number of failed FTM sessions
356181e54d08SPradeep Kumar Chitrapu  * @asap_num: number of ASAP FTM sessions
356281e54d08SPradeep Kumar Chitrapu  * @non_asap_num: number of  non-ASAP FTM sessions
356381e54d08SPradeep Kumar Chitrapu  * @total_duration_ms: total sessions durations - gives an indication
356481e54d08SPradeep Kumar Chitrapu  *	of how much time the responder was busy
356581e54d08SPradeep Kumar Chitrapu  * @unknown_triggers_num: number of unknown FTM triggers - triggers from
356681e54d08SPradeep Kumar Chitrapu  *	initiators that didn't finish successfully the negotiation phase with
356781e54d08SPradeep Kumar Chitrapu  *	the responder
356881e54d08SPradeep Kumar Chitrapu  * @reschedule_requests_num: number of FTM reschedule requests - initiator asks
356981e54d08SPradeep Kumar Chitrapu  *	for a new scheduling although it already has scheduled FTM slot
357081e54d08SPradeep Kumar Chitrapu  * @out_of_window_triggers_num: total FTM triggers out of scheduled window
357181e54d08SPradeep Kumar Chitrapu  */
357281e54d08SPradeep Kumar Chitrapu struct cfg80211_ftm_responder_stats {
357381e54d08SPradeep Kumar Chitrapu 	u32 filled;
357481e54d08SPradeep Kumar Chitrapu 	u32 success_num;
357581e54d08SPradeep Kumar Chitrapu 	u32 partial_num;
357681e54d08SPradeep Kumar Chitrapu 	u32 failed_num;
357781e54d08SPradeep Kumar Chitrapu 	u32 asap_num;
357881e54d08SPradeep Kumar Chitrapu 	u32 non_asap_num;
357981e54d08SPradeep Kumar Chitrapu 	u64 total_duration_ms;
358081e54d08SPradeep Kumar Chitrapu 	u32 unknown_triggers_num;
358181e54d08SPradeep Kumar Chitrapu 	u32 reschedule_requests_num;
358281e54d08SPradeep Kumar Chitrapu 	u32 out_of_window_triggers_num;
358381e54d08SPradeep Kumar Chitrapu };
358481e54d08SPradeep Kumar Chitrapu 
358581e54d08SPradeep Kumar Chitrapu /**
35869bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_ftm_result - FTM result
35879bb7e0f2SJohannes Berg  * @failure_reason: if this measurement failed (PMSR status is
35889bb7e0f2SJohannes Berg  *	%NL80211_PMSR_STATUS_FAILURE), this gives a more precise
35899bb7e0f2SJohannes Berg  *	reason than just "failure"
35909bb7e0f2SJohannes Berg  * @burst_index: if reporting partial results, this is the index
35919bb7e0f2SJohannes Berg  *	in [0 .. num_bursts-1] of the burst that's being reported
35929bb7e0f2SJohannes Berg  * @num_ftmr_attempts: number of FTM request frames transmitted
35939bb7e0f2SJohannes Berg  * @num_ftmr_successes: number of FTM request frames acked
35949bb7e0f2SJohannes Berg  * @busy_retry_time: if failure_reason is %NL80211_PMSR_FTM_FAILURE_PEER_BUSY,
35959bb7e0f2SJohannes Berg  *	fill this to indicate in how many seconds a retry is deemed possible
35969bb7e0f2SJohannes Berg  *	by the responder
35979bb7e0f2SJohannes Berg  * @num_bursts_exp: actual number of bursts exponent negotiated
35989bb7e0f2SJohannes Berg  * @burst_duration: actual burst duration negotiated
35999bb7e0f2SJohannes Berg  * @ftms_per_burst: actual FTMs per burst negotiated
36009bb7e0f2SJohannes Berg  * @lci_len: length of LCI information (if present)
36019bb7e0f2SJohannes Berg  * @civicloc_len: length of civic location information (if present)
36029bb7e0f2SJohannes Berg  * @lci: LCI data (may be %NULL)
36039bb7e0f2SJohannes Berg  * @civicloc: civic location data (may be %NULL)
36049bb7e0f2SJohannes Berg  * @rssi_avg: average RSSI over FTM action frames reported
36059bb7e0f2SJohannes Berg  * @rssi_spread: spread of the RSSI over FTM action frames reported
36069bb7e0f2SJohannes Berg  * @tx_rate: bitrate for transmitted FTM action frame response
36079bb7e0f2SJohannes Berg  * @rx_rate: bitrate of received FTM action frame
36089bb7e0f2SJohannes Berg  * @rtt_avg: average of RTTs measured (must have either this or @dist_avg)
36099bb7e0f2SJohannes Berg  * @rtt_variance: variance of RTTs measured (note that standard deviation is
36109bb7e0f2SJohannes Berg  *	the square root of the variance)
36119bb7e0f2SJohannes Berg  * @rtt_spread: spread of the RTTs measured
36129bb7e0f2SJohannes Berg  * @dist_avg: average of distances (mm) measured
36139bb7e0f2SJohannes Berg  *	(must have either this or @rtt_avg)
36149bb7e0f2SJohannes Berg  * @dist_variance: variance of distances measured (see also @rtt_variance)
36159bb7e0f2SJohannes Berg  * @dist_spread: spread of distances measured (see also @rtt_spread)
36169bb7e0f2SJohannes Berg  * @num_ftmr_attempts_valid: @num_ftmr_attempts is valid
36179bb7e0f2SJohannes Berg  * @num_ftmr_successes_valid: @num_ftmr_successes is valid
36189bb7e0f2SJohannes Berg  * @rssi_avg_valid: @rssi_avg is valid
36199bb7e0f2SJohannes Berg  * @rssi_spread_valid: @rssi_spread is valid
36209bb7e0f2SJohannes Berg  * @tx_rate_valid: @tx_rate is valid
36219bb7e0f2SJohannes Berg  * @rx_rate_valid: @rx_rate is valid
36229bb7e0f2SJohannes Berg  * @rtt_avg_valid: @rtt_avg is valid
36239bb7e0f2SJohannes Berg  * @rtt_variance_valid: @rtt_variance is valid
36249bb7e0f2SJohannes Berg  * @rtt_spread_valid: @rtt_spread is valid
36259bb7e0f2SJohannes Berg  * @dist_avg_valid: @dist_avg is valid
36269bb7e0f2SJohannes Berg  * @dist_variance_valid: @dist_variance is valid
36279bb7e0f2SJohannes Berg  * @dist_spread_valid: @dist_spread is valid
36289bb7e0f2SJohannes Berg  */
36299bb7e0f2SJohannes Berg struct cfg80211_pmsr_ftm_result {
36309bb7e0f2SJohannes Berg 	const u8 *lci;
36319bb7e0f2SJohannes Berg 	const u8 *civicloc;
36329bb7e0f2SJohannes Berg 	unsigned int lci_len;
36339bb7e0f2SJohannes Berg 	unsigned int civicloc_len;
36349bb7e0f2SJohannes Berg 	enum nl80211_peer_measurement_ftm_failure_reasons failure_reason;
36359bb7e0f2SJohannes Berg 	u32 num_ftmr_attempts, num_ftmr_successes;
36369bb7e0f2SJohannes Berg 	s16 burst_index;
36379bb7e0f2SJohannes Berg 	u8 busy_retry_time;
36389bb7e0f2SJohannes Berg 	u8 num_bursts_exp;
36399bb7e0f2SJohannes Berg 	u8 burst_duration;
36409bb7e0f2SJohannes Berg 	u8 ftms_per_burst;
36419bb7e0f2SJohannes Berg 	s32 rssi_avg;
36429bb7e0f2SJohannes Berg 	s32 rssi_spread;
36439bb7e0f2SJohannes Berg 	struct rate_info tx_rate, rx_rate;
36449bb7e0f2SJohannes Berg 	s64 rtt_avg;
36459bb7e0f2SJohannes Berg 	s64 rtt_variance;
36469bb7e0f2SJohannes Berg 	s64 rtt_spread;
36479bb7e0f2SJohannes Berg 	s64 dist_avg;
36489bb7e0f2SJohannes Berg 	s64 dist_variance;
36499bb7e0f2SJohannes Berg 	s64 dist_spread;
36509bb7e0f2SJohannes Berg 
36519bb7e0f2SJohannes Berg 	u16 num_ftmr_attempts_valid:1,
36529bb7e0f2SJohannes Berg 	    num_ftmr_successes_valid:1,
36539bb7e0f2SJohannes Berg 	    rssi_avg_valid:1,
36549bb7e0f2SJohannes Berg 	    rssi_spread_valid:1,
36559bb7e0f2SJohannes Berg 	    tx_rate_valid:1,
36569bb7e0f2SJohannes Berg 	    rx_rate_valid:1,
36579bb7e0f2SJohannes Berg 	    rtt_avg_valid:1,
36589bb7e0f2SJohannes Berg 	    rtt_variance_valid:1,
36599bb7e0f2SJohannes Berg 	    rtt_spread_valid:1,
36609bb7e0f2SJohannes Berg 	    dist_avg_valid:1,
36619bb7e0f2SJohannes Berg 	    dist_variance_valid:1,
36629bb7e0f2SJohannes Berg 	    dist_spread_valid:1;
36639bb7e0f2SJohannes Berg };
36649bb7e0f2SJohannes Berg 
36659bb7e0f2SJohannes Berg /**
36669bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_result - peer measurement result
36679bb7e0f2SJohannes Berg  * @addr: address of the peer
36689bb7e0f2SJohannes Berg  * @host_time: host time (use ktime_get_boottime() adjust to the time when the
36699bb7e0f2SJohannes Berg  *	measurement was made)
36709bb7e0f2SJohannes Berg  * @ap_tsf: AP's TSF at measurement time
36719bb7e0f2SJohannes Berg  * @status: status of the measurement
36729bb7e0f2SJohannes Berg  * @final: if reporting partial results, mark this as the last one; if not
36739bb7e0f2SJohannes Berg  *	reporting partial results always set this flag
36749bb7e0f2SJohannes Berg  * @ap_tsf_valid: indicates the @ap_tsf value is valid
36759bb7e0f2SJohannes Berg  * @type: type of the measurement reported, note that we only support reporting
36769bb7e0f2SJohannes Berg  *	one type at a time, but you can report multiple results separately and
36779bb7e0f2SJohannes Berg  *	they're all aggregated for userspace.
36789bb7e0f2SJohannes Berg  */
36799bb7e0f2SJohannes Berg struct cfg80211_pmsr_result {
36809bb7e0f2SJohannes Berg 	u64 host_time, ap_tsf;
36819bb7e0f2SJohannes Berg 	enum nl80211_peer_measurement_status status;
36829bb7e0f2SJohannes Berg 
36839bb7e0f2SJohannes Berg 	u8 addr[ETH_ALEN];
36849bb7e0f2SJohannes Berg 
36859bb7e0f2SJohannes Berg 	u8 final:1,
36869bb7e0f2SJohannes Berg 	   ap_tsf_valid:1;
36879bb7e0f2SJohannes Berg 
36889bb7e0f2SJohannes Berg 	enum nl80211_peer_measurement_type type;
36899bb7e0f2SJohannes Berg 
36909bb7e0f2SJohannes Berg 	union {
36919bb7e0f2SJohannes Berg 		struct cfg80211_pmsr_ftm_result ftm;
36929bb7e0f2SJohannes Berg 	};
36939bb7e0f2SJohannes Berg };
36949bb7e0f2SJohannes Berg 
36959bb7e0f2SJohannes Berg /**
36969bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_ftm_request_peer - FTM request data
36979bb7e0f2SJohannes Berg  * @requested: indicates FTM is requested
36989bb7e0f2SJohannes Berg  * @preamble: frame preamble to use
36999bb7e0f2SJohannes Berg  * @burst_period: burst period to use
37009bb7e0f2SJohannes Berg  * @asap: indicates to use ASAP mode
37019bb7e0f2SJohannes Berg  * @num_bursts_exp: number of bursts exponent
37029bb7e0f2SJohannes Berg  * @burst_duration: burst duration
37039bb7e0f2SJohannes Berg  * @ftms_per_burst: number of FTMs per burst
37049bb7e0f2SJohannes Berg  * @ftmr_retries: number of retries for FTM request
37059bb7e0f2SJohannes Berg  * @request_lci: request LCI information
37069bb7e0f2SJohannes Berg  * @request_civicloc: request civic location information
3707efb5520dSAvraham Stern  * @trigger_based: use trigger based ranging for the measurement
3708efb5520dSAvraham Stern  *		 If neither @trigger_based nor @non_trigger_based is set,
3709efb5520dSAvraham Stern  *		 EDCA based ranging will be used.
3710efb5520dSAvraham Stern  * @non_trigger_based: use non trigger based ranging for the measurement
3711efb5520dSAvraham Stern  *		 If neither @trigger_based nor @non_trigger_based is set,
3712efb5520dSAvraham Stern  *		 EDCA based ranging will be used.
371373807523SAvraham Stern  * @lmr_feedback: negotiate for I2R LMR feedback. Only valid if either
371473807523SAvraham Stern  *		 @trigger_based or @non_trigger_based is set.
3715dd3e4fc7SAvraham Stern  * @bss_color: the bss color of the responder. Optional. Set to zero to
3716dd3e4fc7SAvraham Stern  *	indicate the driver should set the BSS color. Only valid if
3717dd3e4fc7SAvraham Stern  *	@non_trigger_based or @trigger_based is set.
37189bb7e0f2SJohannes Berg  *
37199bb7e0f2SJohannes Berg  * See also nl80211 for the respective attribute documentation.
37209bb7e0f2SJohannes Berg  */
37219bb7e0f2SJohannes Berg struct cfg80211_pmsr_ftm_request_peer {
37229bb7e0f2SJohannes Berg 	enum nl80211_preamble preamble;
37239bb7e0f2SJohannes Berg 	u16 burst_period;
37249bb7e0f2SJohannes Berg 	u8 requested:1,
37259bb7e0f2SJohannes Berg 	   asap:1,
37269bb7e0f2SJohannes Berg 	   request_lci:1,
3727efb5520dSAvraham Stern 	   request_civicloc:1,
3728efb5520dSAvraham Stern 	   trigger_based:1,
372973807523SAvraham Stern 	   non_trigger_based:1,
373073807523SAvraham Stern 	   lmr_feedback:1;
37319bb7e0f2SJohannes Berg 	u8 num_bursts_exp;
37329bb7e0f2SJohannes Berg 	u8 burst_duration;
37339bb7e0f2SJohannes Berg 	u8 ftms_per_burst;
37349bb7e0f2SJohannes Berg 	u8 ftmr_retries;
3735dd3e4fc7SAvraham Stern 	u8 bss_color;
37369bb7e0f2SJohannes Berg };
37379bb7e0f2SJohannes Berg 
37389bb7e0f2SJohannes Berg /**
37399bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_request_peer - peer data for a peer measurement request
37409bb7e0f2SJohannes Berg  * @addr: MAC address
37419bb7e0f2SJohannes Berg  * @chandef: channel to use
37429bb7e0f2SJohannes Berg  * @report_ap_tsf: report the associated AP's TSF
37439bb7e0f2SJohannes Berg  * @ftm: FTM data, see &struct cfg80211_pmsr_ftm_request_peer
37449bb7e0f2SJohannes Berg  */
37459bb7e0f2SJohannes Berg struct cfg80211_pmsr_request_peer {
37469bb7e0f2SJohannes Berg 	u8 addr[ETH_ALEN];
37479bb7e0f2SJohannes Berg 	struct cfg80211_chan_def chandef;
37489bb7e0f2SJohannes Berg 	u8 report_ap_tsf:1;
37499bb7e0f2SJohannes Berg 	struct cfg80211_pmsr_ftm_request_peer ftm;
37509bb7e0f2SJohannes Berg };
37519bb7e0f2SJohannes Berg 
37529bb7e0f2SJohannes Berg /**
37539bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_request - peer measurement request
37549bb7e0f2SJohannes Berg  * @cookie: cookie, set by cfg80211
37559bb7e0f2SJohannes Berg  * @nl_portid: netlink portid - used by cfg80211
37569bb7e0f2SJohannes Berg  * @drv_data: driver data for this request, if required for aborting,
37579bb7e0f2SJohannes Berg  *	not otherwise freed or anything by cfg80211
37589bb7e0f2SJohannes Berg  * @mac_addr: MAC address used for (randomised) request
37599bb7e0f2SJohannes Berg  * @mac_addr_mask: MAC address mask used for randomisation, bits that
37609bb7e0f2SJohannes Berg  *	are 0 in the mask should be randomised, bits that are 1 should
37619bb7e0f2SJohannes Berg  *	be taken from the @mac_addr
37629bb7e0f2SJohannes Berg  * @list: used by cfg80211 to hold on to the request
37639bb7e0f2SJohannes Berg  * @timeout: timeout (in milliseconds) for the whole operation, if
37649bb7e0f2SJohannes Berg  *	zero it means there's no timeout
37659bb7e0f2SJohannes Berg  * @n_peers: number of peers to do measurements with
37669bb7e0f2SJohannes Berg  * @peers: per-peer measurement request data
37679bb7e0f2SJohannes Berg  */
37689bb7e0f2SJohannes Berg struct cfg80211_pmsr_request {
37699bb7e0f2SJohannes Berg 	u64 cookie;
37709bb7e0f2SJohannes Berg 	void *drv_data;
37719bb7e0f2SJohannes Berg 	u32 n_peers;
37729bb7e0f2SJohannes Berg 	u32 nl_portid;
37739bb7e0f2SJohannes Berg 
37749bb7e0f2SJohannes Berg 	u32 timeout;
37759bb7e0f2SJohannes Berg 
37769bb7e0f2SJohannes Berg 	u8 mac_addr[ETH_ALEN] __aligned(2);
37779bb7e0f2SJohannes Berg 	u8 mac_addr_mask[ETH_ALEN] __aligned(2);
37789bb7e0f2SJohannes Berg 
37799bb7e0f2SJohannes Berg 	struct list_head list;
37809bb7e0f2SJohannes Berg 
37819bb7e0f2SJohannes Berg 	struct cfg80211_pmsr_request_peer peers[];
37829bb7e0f2SJohannes Berg };
37839bb7e0f2SJohannes Berg 
37849bb7e0f2SJohannes Berg /**
3785cb74e977SSunil Dutt  * struct cfg80211_update_owe_info - OWE Information
3786cb74e977SSunil Dutt  *
3787cb74e977SSunil Dutt  * This structure provides information needed for the drivers to offload OWE
3788cb74e977SSunil Dutt  * (Opportunistic Wireless Encryption) processing to the user space.
3789cb74e977SSunil Dutt  *
3790cb74e977SSunil Dutt  * Commonly used across update_owe_info request and event interfaces.
3791cb74e977SSunil Dutt  *
3792cb74e977SSunil Dutt  * @peer: MAC address of the peer device for which the OWE processing
3793cb74e977SSunil Dutt  *	has to be done.
3794cb74e977SSunil Dutt  * @status: status code, %WLAN_STATUS_SUCCESS for successful OWE info
3795cb74e977SSunil Dutt  *	processing, use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space
3796cb74e977SSunil Dutt  *	cannot give you the real status code for failures. Used only for
3797cb74e977SSunil Dutt  *	OWE update request command interface (user space to driver).
3798cb74e977SSunil Dutt  * @ie: IEs obtained from the peer or constructed by the user space. These are
3799cb74e977SSunil Dutt  *	the IEs of the remote peer in the event from the host driver and
3800cb74e977SSunil Dutt  *	the constructed IEs by the user space in the request interface.
3801cb74e977SSunil Dutt  * @ie_len: Length of IEs in octets.
3802cb74e977SSunil Dutt  */
3803cb74e977SSunil Dutt struct cfg80211_update_owe_info {
3804cb74e977SSunil Dutt 	u8 peer[ETH_ALEN] __aligned(2);
3805cb74e977SSunil Dutt 	u16 status;
3806cb74e977SSunil Dutt 	const u8 *ie;
3807cb74e977SSunil Dutt 	size_t ie_len;
3808cb74e977SSunil Dutt };
3809cb74e977SSunil Dutt 
3810cb74e977SSunil Dutt /**
38116cd536feSJohannes Berg  * struct mgmt_frame_regs - management frame registrations data
38126cd536feSJohannes Berg  * @global_stypes: bitmap of management frame subtypes registered
38136cd536feSJohannes Berg  *	for the entire device
38146cd536feSJohannes Berg  * @interface_stypes: bitmap of management frame subtypes registered
38156cd536feSJohannes Berg  *	for the given interface
38169dba48a6SJohannes Berg  * @global_mcast_rx: mcast RX is needed globally for these subtypes
38179dba48a6SJohannes Berg  * @interface_mcast_stypes: mcast RX is needed on this interface
38189dba48a6SJohannes Berg  *	for these subtypes
38196cd536feSJohannes Berg  */
38206cd536feSJohannes Berg struct mgmt_frame_regs {
38216cd536feSJohannes Berg 	u32 global_stypes, interface_stypes;
38229dba48a6SJohannes Berg 	u32 global_mcast_stypes, interface_mcast_stypes;
38236cd536feSJohannes Berg };
38246cd536feSJohannes Berg 
38256cd536feSJohannes Berg /**
3826704232c2SJohannes Berg  * struct cfg80211_ops - backend description for wireless configuration
3827704232c2SJohannes Berg  *
3828704232c2SJohannes Berg  * This struct is registered by fullmac card drivers and/or wireless stacks
3829704232c2SJohannes Berg  * in order to handle configuration requests on their interfaces.
3830704232c2SJohannes Berg  *
3831704232c2SJohannes Berg  * All callbacks except where otherwise noted should return 0
3832704232c2SJohannes Berg  * on success or a negative error code.
3833704232c2SJohannes Berg  *
3834a05829a7SJohannes Berg  * All operations are invoked with the wiphy mutex held. The RTNL may be
3835a05829a7SJohannes Berg  * held in addition (due to wireless extensions) but this cannot be relied
3836a05829a7SJohannes Berg  * upon except in cases where documented below. Note that due to ordering,
3837a05829a7SJohannes Berg  * the RTNL also cannot be acquired in any handlers.
383843fb45cbSJohannes Berg  *
3839ff1b6e69SJohannes Berg  * @suspend: wiphy device needs to be suspended. The variable @wow will
3840ff1b6e69SJohannes Berg  *	be %NULL or contain the enabled Wake-on-Wireless triggers that are
3841ff1b6e69SJohannes Berg  *	configured for the device.
38420378b3f1SJohannes Berg  * @resume: wiphy device needs to be resumed
38436d52563fSJohannes Berg  * @set_wakeup: Called when WoWLAN is enabled/disabled, use this callback
38446d52563fSJohannes Berg  *	to call device_set_wakeup_enable() to enable/disable wakeup from
38456d52563fSJohannes Berg  *	the device.
38460378b3f1SJohannes Berg  *
384760719ffdSJohannes Berg  * @add_virtual_intf: create a new virtual interface with the given name,
3848463d0183SJohannes Berg  *	must set the struct wireless_dev's iftype. Beware: You must create
384984efbb84SJohannes Berg  *	the new netdev in the wiphy's network namespace! Returns the struct
385098104fdeSJohannes Berg  *	wireless_dev, or an ERR_PTR. For P2P device wdevs, the driver must
385198104fdeSJohannes Berg  *	also set the address member in the wdev.
3852a05829a7SJohannes Berg  *	This additionally holds the RTNL to be able to do netdev changes.
3853704232c2SJohannes Berg  *
385484efbb84SJohannes Berg  * @del_virtual_intf: remove the virtual interface
3855a05829a7SJohannes Berg  *	This additionally holds the RTNL to be able to do netdev changes.
385655682965SJohannes Berg  *
385760719ffdSJohannes Berg  * @change_virtual_intf: change type/configuration of virtual interface,
385860719ffdSJohannes Berg  *	keep the struct wireless_dev's iftype updated.
3859a05829a7SJohannes Berg  *	This additionally holds the RTNL to be able to do netdev changes.
386055682965SJohannes Berg  *
3861*f2a0290bSJohannes Berg  * @add_intf_link: Add a new MLO link to the given interface. Note that
3862*f2a0290bSJohannes Berg  *	the wdev->link[] data structure has been updated, so the new link
3863*f2a0290bSJohannes Berg  *	address is available.
3864*f2a0290bSJohannes Berg  * @del_intf_link: Remove an MLO link from the given interface.
3865*f2a0290bSJohannes Berg  *
386641ade00fSJohannes Berg  * @add_key: add a key with the given parameters. @mac_addr will be %NULL
386741ade00fSJohannes Berg  *	when adding a group key.
386841ade00fSJohannes Berg  *
386941ade00fSJohannes Berg  * @get_key: get information about the key with the given parameters.
387041ade00fSJohannes Berg  *	@mac_addr will be %NULL when requesting information for a group
387141ade00fSJohannes Berg  *	key. All pointers given to the @callback function need not be valid
3872e3da574aSJohannes Berg  *	after it returns. This function should return an error if it is
3873e3da574aSJohannes Berg  *	not possible to retrieve the key, -ENOENT if it doesn't exist.
387441ade00fSJohannes Berg  *
387541ade00fSJohannes Berg  * @del_key: remove a key given the @mac_addr (%NULL for a group key)
3876e3da574aSJohannes Berg  *	and @key_index, return -ENOENT if the key doesn't exist.
387741ade00fSJohannes Berg  *
387841ade00fSJohannes Berg  * @set_default_key: set the default key on an interface
3879ed1b6cc7SJohannes Berg  *
38803cfcf6acSJouni Malinen  * @set_default_mgmt_key: set the default management frame key on an interface
38811f7e9f46SJohannes Berg  *
388256be393fSJouni Malinen  * @set_default_beacon_key: set the default Beacon frame key on an interface
38833cfcf6acSJouni Malinen  *
3884e5497d76SJohannes Berg  * @set_rekey_data: give the data necessary for GTK rekeying to the driver
3885e5497d76SJohannes Berg  *
3886c04a4ff7SJohannes Berg  * @start_ap: Start acting in AP mode defined by the parameters.
3887c04a4ff7SJohannes Berg  * @change_beacon: Change the beacon parameters for an access point mode
3888c04a4ff7SJohannes Berg  *	interface. This should reject the call when AP mode wasn't started.
3889c04a4ff7SJohannes Berg  * @stop_ap: Stop being an AP, including stopping beaconing.
38905727ef1bSJohannes Berg  *
38915727ef1bSJohannes Berg  * @add_station: Add a new station.
389289c771e5SJouni Malinen  * @del_station: Remove a station
3893bdd90d5eSJohannes Berg  * @change_station: Modify a given station. Note that flags changes are not much
3894bdd90d5eSJohannes Berg  *	validated in cfg80211, in particular the auth/assoc/authorized flags
3895bdd90d5eSJohannes Berg  *	might come to the driver in invalid combinations -- make sure to check
389677ee7c89SJohannes Berg  *	them, also against the existing state! Drivers must call
389777ee7c89SJohannes Berg  *	cfg80211_check_station_change() to validate the information.
3898abe37c4bSJohannes Berg  * @get_station: get station information for the station identified by @mac
3899abe37c4bSJohannes Berg  * @dump_station: dump station callback -- resume dump at index @idx
3900abe37c4bSJohannes Berg  *
3901abe37c4bSJohannes Berg  * @add_mpath: add a fixed mesh path
3902abe37c4bSJohannes Berg  * @del_mpath: delete a given mesh path
3903abe37c4bSJohannes Berg  * @change_mpath: change a given mesh path
3904abe37c4bSJohannes Berg  * @get_mpath: get a mesh path for the given parameters
3905abe37c4bSJohannes Berg  * @dump_mpath: dump mesh path callback -- resume dump at index @idx
390666be7d2bSHenning Rogge  * @get_mpp: get a mesh proxy path for the given parameters
390766be7d2bSHenning Rogge  * @dump_mpp: dump mesh proxy path callback -- resume dump at index @idx
3908f52555a4SJohannes Berg  * @join_mesh: join the mesh network with the specified parameters
39098d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
3910f52555a4SJohannes Berg  * @leave_mesh: leave the current mesh network
39118d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
39122ec600d6SLuis Carlos Cobo  *
391324bdd9f4SJavier Cardona  * @get_mesh_config: Get the current mesh configuration
391493da9cc1Scolin@cozybit.com  *
391524bdd9f4SJavier Cardona  * @update_mesh_config: Update mesh parameters on a running mesh.
391693da9cc1Scolin@cozybit.com  *	The mask is a bitfield which tells us which parameters to
391793da9cc1Scolin@cozybit.com  *	set, and which to leave alone.
391893da9cc1Scolin@cozybit.com  *
39199f1ba906SJouni Malinen  * @change_bss: Modify parameters for a given BSS.
392031888487SJouni Malinen  *
392131888487SJouni Malinen  * @set_txq_params: Set TX queue parameters
392272bdcf34SJouni Malinen  *
3923e8c9bd5bSJohannes Berg  * @libertas_set_mesh_channel: Only for backward compatibility for libertas,
3924e8c9bd5bSJohannes Berg  *	as it doesn't implement join_mesh and needs to set the channel to
3925e8c9bd5bSJohannes Berg  *	join the mesh instead.
3926e8c9bd5bSJohannes Berg  *
3927e8c9bd5bSJohannes Berg  * @set_monitor_channel: Set the monitor mode channel for the device. If other
3928e8c9bd5bSJohannes Berg  *	interfaces are active this callback should reject the configuration.
3929e8c9bd5bSJohannes Berg  *	If no interfaces are active or the device is down, the channel should
3930e8c9bd5bSJohannes Berg  *	be stored for when a monitor interface becomes active.
39319aed3cc1SJouni Malinen  *
39322a519311SJohannes Berg  * @scan: Request to do a scan. If returning zero, the scan request is given
39332a519311SJohannes Berg  *	the driver, and will be valid until passed to cfg80211_scan_done().
39342a519311SJohannes Berg  *	For scan results, call cfg80211_inform_bss(); you can call this outside
39352a519311SJohannes Berg  *	the scan/scan_done bracket too.
393691d3ab46SVidyullatha Kanchanapally  * @abort_scan: Tell the driver to abort an ongoing scan. The driver shall
393791d3ab46SVidyullatha Kanchanapally  *	indicate the status of the scan through cfg80211_scan_done().
3938636a5d36SJouni Malinen  *
3939636a5d36SJouni Malinen  * @auth: Request to authenticate with the specified peer
39408d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
3941636a5d36SJouni Malinen  * @assoc: Request to (re)associate with the specified peer
39428d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
3943636a5d36SJouni Malinen  * @deauth: Request to deauthenticate from the specified peer
39448d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
3945636a5d36SJouni Malinen  * @disassoc: Request to disassociate from the specified peer
39468d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
394704a773adSJohannes Berg  *
3948b23aa676SSamuel Ortiz  * @connect: Connect to the ESS with the specified parameters. When connected,
3949bf1ecd21SJouni Malinen  *	call cfg80211_connect_result()/cfg80211_connect_bss() with status code
3950bf1ecd21SJouni Malinen  *	%WLAN_STATUS_SUCCESS. If the connection fails for some reason, call
3951bf1ecd21SJouni Malinen  *	cfg80211_connect_result()/cfg80211_connect_bss() with the status code
3952bf1ecd21SJouni Malinen  *	from the AP or cfg80211_connect_timeout() if no frame with status code
3953bf1ecd21SJouni Malinen  *	was received.
3954bf1ecd21SJouni Malinen  *	The driver is allowed to roam to other BSSes within the ESS when the
3955bf1ecd21SJouni Malinen  *	other BSS matches the connect parameters. When such roaming is initiated
3956bf1ecd21SJouni Malinen  *	by the driver, the driver is expected to verify that the target matches
3957bf1ecd21SJouni Malinen  *	the configured security parameters and to use Reassociation Request
3958bf1ecd21SJouni Malinen  *	frame instead of Association Request frame.
3959bf1ecd21SJouni Malinen  *	The connect function can also be used to request the driver to perform a
3960bf1ecd21SJouni Malinen  *	specific roam when connected to an ESS. In that case, the prev_bssid
396135eb8f7bSJouni Malinen  *	parameter is set to the BSSID of the currently associated BSS as an
3962bf1ecd21SJouni Malinen  *	indication of requesting reassociation.
3963bf1ecd21SJouni Malinen  *	In both the driver-initiated and new connect() call initiated roaming
3964bf1ecd21SJouni Malinen  *	cases, the result of roaming is indicated with a call to
396529ce6ecbSAvraham Stern  *	cfg80211_roamed(). (invoked with the wireless_dev mutex held)
3966088e8df8Svamsi krishna  * @update_connect_params: Update the connect parameters while connected to a
3967088e8df8Svamsi krishna  *	BSS. The updated parameters can be used by driver/firmware for
3968088e8df8Svamsi krishna  *	subsequent BSS selection (roaming) decisions and to form the
3969088e8df8Svamsi krishna  *	Authentication/(Re)Association Request frames. This call does not
3970088e8df8Svamsi krishna  *	request an immediate disassociation or reassociation with the current
3971088e8df8Svamsi krishna  *	BSS, i.e., this impacts only subsequent (re)associations. The bits in
3972088e8df8Svamsi krishna  *	changed are defined in &enum cfg80211_connect_params_changed.
3973088e8df8Svamsi krishna  *	(invoked with the wireless_dev mutex held)
39740711d638SIlan Peer  * @disconnect: Disconnect from the BSS/ESS or stop connection attempts if
39750711d638SIlan Peer  *      connection is in progress. Once done, call cfg80211_disconnected() in
39760711d638SIlan Peer  *      case connection was already established (invoked with the
39770711d638SIlan Peer  *      wireless_dev mutex held), otherwise call cfg80211_connect_timeout().
3978b23aa676SSamuel Ortiz  *
397904a773adSJohannes Berg  * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call
398004a773adSJohannes Berg  *	cfg80211_ibss_joined(), also call that function when changing BSSID due
398104a773adSJohannes Berg  *	to a merge.
39828d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
398304a773adSJohannes Berg  * @leave_ibss: Leave the IBSS.
39848d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
3985b9a5f8caSJouni Malinen  *
3986f4e583c8SAntonio Quartulli  * @set_mcast_rate: Set the specified multicast rate (only if vif is in ADHOC or
3987f4e583c8SAntonio Quartulli  *	MESH mode)
3988f4e583c8SAntonio Quartulli  *
3989b9a5f8caSJouni Malinen  * @set_wiphy_params: Notify that wiphy parameters have changed;
3990b9a5f8caSJouni Malinen  *	@changed bitfield (see &enum wiphy_params_flags) describes which values
3991b9a5f8caSJouni Malinen  *	have changed. The actual parameter values are available in
3992b9a5f8caSJouni Malinen  *	struct wiphy. If returning an error, no value should be changed.
39937643a2c3SJohannes Berg  *
39941432de07SLuis R. Rodriguez  * @set_tx_power: set the transmit power according to the parameters,
3995c8442118SJohannes Berg  *	the power passed is in mBm, to get dBm use MBM_TO_DBM(). The
3996c8442118SJohannes Berg  *	wdev may be %NULL if power was set for the wiphy, and will
3997c8442118SJohannes Berg  *	always be %NULL unless the driver supports per-vif TX power
3998c8442118SJohannes Berg  *	(as advertised by the nl80211 feature flag.)
39997643a2c3SJohannes Berg  * @get_tx_power: store the current TX power into the dbm variable;
40001f87f7d3SJohannes Berg  *	return 0 if successful
40011f87f7d3SJohannes Berg  *
40021f87f7d3SJohannes Berg  * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting
40031f87f7d3SJohannes Berg  *	functions to adjust rfkill hw state
4004aff89a9bSJohannes Berg  *
400561fa713cSHolger Schurig  * @dump_survey: get site survey information.
400661fa713cSHolger Schurig  *
40079588bbd5SJouni Malinen  * @remain_on_channel: Request the driver to remain awake on the specified
40089588bbd5SJouni Malinen  *	channel for the specified duration to complete an off-channel
40099588bbd5SJouni Malinen  *	operation (e.g., public action frame exchange). When the driver is
40109588bbd5SJouni Malinen  *	ready on the requested channel, it must indicate this with an event
40119588bbd5SJouni Malinen  *	notification by calling cfg80211_ready_on_channel().
40129588bbd5SJouni Malinen  * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation.
40139588bbd5SJouni Malinen  *	This allows the operation to be terminated prior to timeout based on
40149588bbd5SJouni Malinen  *	the duration value.
4015f7ca38dfSJohannes Berg  * @mgmt_tx: Transmit a management frame.
4016f7ca38dfSJohannes Berg  * @mgmt_tx_cancel_wait: Cancel the wait time from transmitting a management
4017f7ca38dfSJohannes Berg  *	frame on another channel
40189588bbd5SJouni Malinen  *
4019fc73f11fSDavid Spinadel  * @testmode_cmd: run a test mode command; @wdev may be %NULL
402071063f0eSWey-Yi Guy  * @testmode_dump: Implement a test mode dump. The cb->args[2] and up may be
402171063f0eSWey-Yi Guy  *	used by the function, but 0 and 1 must not be touched. Additionally,
402271063f0eSWey-Yi Guy  *	return error codes other than -ENOBUFS and -ENOENT will terminate the
402371063f0eSWey-Yi Guy  *	dump and return to userspace with an error, so be careful. If any data
402471063f0eSWey-Yi Guy  *	was passed in from userspace then the data/len arguments will be present
402571063f0eSWey-Yi Guy  *	and point to the data contained in %NL80211_ATTR_TESTDATA.
402667fbb16bSSamuel Ortiz  *
4027abe37c4bSJohannes Berg  * @set_bitrate_mask: set the bitrate mask configuration
4028abe37c4bSJohannes Berg  *
402967fbb16bSSamuel Ortiz  * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac
403067fbb16bSSamuel Ortiz  *	devices running firmwares capable of generating the (re) association
403167fbb16bSSamuel Ortiz  *	RSN IE. It allows for faster roaming between WPA2 BSSIDs.
403267fbb16bSSamuel Ortiz  * @del_pmksa: Delete a cached PMKID.
403367fbb16bSSamuel Ortiz  * @flush_pmksa: Flush all cached PMKIDs.
40349043f3b8SJuuso Oikarinen  * @set_power_mgmt: Configure WLAN power management. A timeout value of -1
40359043f3b8SJuuso Oikarinen  *	allows the driver to adjust the dynamic ps timeout value.
4036d6dc1a38SJuuso Oikarinen  * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold.
4037e86abc68SJohannes Berg  *	After configuration, the driver should (soon) send an event indicating
4038e86abc68SJohannes Berg  *	the current level is above/below the configured threshold; this may
4039e86abc68SJohannes Berg  *	need some care when the configuration is changed (without first being
4040e86abc68SJohannes Berg  *	disabled.)
40414a4b8169SAndrew Zaborowski  * @set_cqm_rssi_range_config: Configure two RSSI thresholds in the
40424a4b8169SAndrew Zaborowski  *	connection quality monitor.  An event is to be sent only when the
40434a4b8169SAndrew Zaborowski  *	signal level is found to be outside the two values.  The driver should
40444a4b8169SAndrew Zaborowski  *	set %NL80211_EXT_FEATURE_CQM_RSSI_LIST if this method is implemented.
40454a4b8169SAndrew Zaborowski  *	If it is provided then there's no point providing @set_cqm_rssi_config.
404684f10708SThomas Pedersen  * @set_cqm_txe_config: Configure connection quality monitor TX error
404784f10708SThomas Pedersen  *	thresholds.
4048807f8a8cSLuciano Coelho  * @sched_scan_start: Tell the driver to start a scheduled scan.
40493a3ecf1dSArend Van Spriel  * @sched_scan_stop: Tell the driver to stop an ongoing scheduled scan with
40503a3ecf1dSArend Van Spriel  *	given request id. This call must stop the scheduled scan and be ready
40513a3ecf1dSArend Van Spriel  *	for starting a new one before it returns, i.e. @sched_scan_start may be
40523a3ecf1dSArend Van Spriel  *	called immediately after that again and should not fail in that case.
40533a3ecf1dSArend Van Spriel  *	The driver should not call cfg80211_sched_scan_stopped() for a requested
40543a3ecf1dSArend Van Spriel  *	stop (when this method returns 0).
405567fbb16bSSamuel Ortiz  *
40566cd536feSJohannes Berg  * @update_mgmt_frame_registrations: Notify the driver that management frame
40576cd536feSJohannes Berg  *	registrations were updated. The callback is allowed to sleep.
4058547025d5SBruno Randolf  *
4059547025d5SBruno Randolf  * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device.
4060547025d5SBruno Randolf  *	Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may
4061547025d5SBruno Randolf  *	reject TX/RX mask combinations they cannot support by returning -EINVAL
4062547025d5SBruno Randolf  *	(also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX).
4063547025d5SBruno Randolf  *
4064547025d5SBruno Randolf  * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant).
40653677713bSJohn W. Linville  *
4066109086ceSArik Nemtsov  * @tdls_mgmt: Transmit a TDLS management frame.
4067109086ceSArik Nemtsov  * @tdls_oper: Perform a high-level TDLS operation (e.g. TDLS link setup).
40687f6cf311SJohannes Berg  *
40697f6cf311SJohannes Berg  * @probe_client: probe an associated client, must return a cookie that it
40707f6cf311SJohannes Berg  *	later passes to cfg80211_probe_status().
40711d9d9213SSimon Wunderlich  *
40721d9d9213SSimon Wunderlich  * @set_noack_map: Set the NoAck Map for the TIDs.
4073d6199218SBen Greear  *
40745b7ccaf3SJohannes Berg  * @get_channel: Get the current operating channel for the virtual interface.
40755b7ccaf3SJohannes Berg  *	For monitor interfaces, it should return %NULL unless there's a single
40765b7ccaf3SJohannes Berg  *	current monitoring channel.
407798104fdeSJohannes Berg  *
407898104fdeSJohannes Berg  * @start_p2p_device: Start the given P2P device.
407998104fdeSJohannes Berg  * @stop_p2p_device: Stop the given P2P device.
408077765eafSVasanthakumar Thiagarajan  *
408177765eafSVasanthakumar Thiagarajan  * @set_mac_acl: Sets MAC address control list in AP and P2P GO mode.
408277765eafSVasanthakumar Thiagarajan  *	Parameters include ACL policy, an array of MAC address of stations
408377765eafSVasanthakumar Thiagarajan  *	and the number of MAC addresses. If there is already a list in driver
408477765eafSVasanthakumar Thiagarajan  *	this new list replaces the existing one. Driver has to clear its ACL
408577765eafSVasanthakumar Thiagarajan  *	when number of MAC addresses entries is passed as 0. Drivers which
408677765eafSVasanthakumar Thiagarajan  *	advertise the support for MAC based ACL have to implement this callback.
408704f39047SSimon Wunderlich  *
408804f39047SSimon Wunderlich  * @start_radar_detection: Start radar detection in the driver.
40898bf24293SJouni Malinen  *
409026ec17a1SOrr Mazor  * @end_cac: End running CAC, probably because a related CAC
409126ec17a1SOrr Mazor  *	was finished on another phy.
409226ec17a1SOrr Mazor  *
40938bf24293SJouni Malinen  * @update_ft_ies: Provide updated Fast BSS Transition information to the
40948bf24293SJouni Malinen  *	driver. If the SME is in the driver/firmware, this information can be
40958bf24293SJouni Malinen  *	used in building Authentication and Reassociation Request frames.
40965de17984SArend van Spriel  *
40975de17984SArend van Spriel  * @crit_proto_start: Indicates a critical protocol needs more link reliability
40985de17984SArend van Spriel  *	for a given duration (milliseconds). The protocol is provided so the
40995de17984SArend van Spriel  *	driver can take the most appropriate actions.
41005de17984SArend van Spriel  * @crit_proto_stop: Indicates critical protocol no longer needs increased link
41015de17984SArend van Spriel  *	reliability. This operation can not fail.
4102be29b99aSAmitkumar Karwar  * @set_coalesce: Set coalesce parameters.
410316ef1fe2SSimon Wunderlich  *
410497dc94f1SMichal Kazior  * @channel_switch: initiate channel-switch procedure (with CSA). Driver is
410597dc94f1SMichal Kazior  *	responsible for veryfing if the switch is possible. Since this is
410697dc94f1SMichal Kazior  *	inherently tricky driver may decide to disconnect an interface later
410797dc94f1SMichal Kazior  *	with cfg80211_stop_iface(). This doesn't mean driver can accept
410897dc94f1SMichal Kazior  *	everything. It should do it's best to verify requests and reject them
410997dc94f1SMichal Kazior  *	as soon as possible.
4110fa9ffc74SKyeyoon Park  *
4111fa9ffc74SKyeyoon Park  * @set_qos_map: Set QoS mapping information to the driver
4112e16821bcSJouni Malinen  *
4113e16821bcSJouni Malinen  * @set_ap_chanwidth: Set the AP (including P2P GO) mode channel width for the
4114e16821bcSJouni Malinen  *	given interface This is used e.g. for dynamic HT 20/40 MHz channel width
4115e16821bcSJouni Malinen  *	changes during the lifetime of the BSS.
4116960d01acSJohannes Berg  *
4117960d01acSJohannes Berg  * @add_tx_ts: validate (if admitted_time is 0) or add a TX TS to the device
4118960d01acSJohannes Berg  *	with the given parameters; action frame exchange has been handled by
4119960d01acSJohannes Berg  *	userspace so this just has to modify the TX path to take the TS into
4120960d01acSJohannes Berg  *	account.
4121960d01acSJohannes Berg  *	If the admitted time is 0 just validate the parameters to make sure
4122960d01acSJohannes Berg  *	the session can be created at all; it is valid to just always return
4123960d01acSJohannes Berg  *	success for that but that may result in inefficient behaviour (handshake
4124960d01acSJohannes Berg  *	with the peer followed by immediate teardown when the addition is later
4125960d01acSJohannes Berg  *	rejected)
4126960d01acSJohannes Berg  * @del_tx_ts: remove an existing TX TS
41276e0bd6c3SRostislav Lisovy  *
41286e0bd6c3SRostislav Lisovy  * @join_ocb: join the OCB network with the specified parameters
41296e0bd6c3SRostislav Lisovy  *	(invoked with the wireless_dev mutex held)
41306e0bd6c3SRostislav Lisovy  * @leave_ocb: leave the current OCB network
41316e0bd6c3SRostislav Lisovy  *	(invoked with the wireless_dev mutex held)
41321057d35eSArik Nemtsov  *
41331057d35eSArik Nemtsov  * @tdls_channel_switch: Start channel-switching with a TDLS peer. The driver
41341057d35eSArik Nemtsov  *	is responsible for continually initiating channel-switching operations
41351057d35eSArik Nemtsov  *	and returning to the base channel for communication with the AP.
41361057d35eSArik Nemtsov  * @tdls_cancel_channel_switch: Stop channel-switching with a TDLS peer. Both
41371057d35eSArik Nemtsov  *	peers must be on the base channel when the call completes.
4138cb3b7d87SAyala Beker  * @start_nan: Start the NAN interface.
4139cb3b7d87SAyala Beker  * @stop_nan: Stop the NAN interface.
4140a442b761SAyala Beker  * @add_nan_func: Add a NAN function. Returns negative value on failure.
4141a442b761SAyala Beker  *	On success @nan_func ownership is transferred to the driver and
4142a442b761SAyala Beker  *	it may access it outside of the scope of this function. The driver
4143a442b761SAyala Beker  *	should free the @nan_func when no longer needed by calling
4144a442b761SAyala Beker  *	cfg80211_free_nan_func().
4145a442b761SAyala Beker  *	On success the driver should assign an instance_id in the
4146a442b761SAyala Beker  *	provided @nan_func.
4147a442b761SAyala Beker  * @del_nan_func: Delete a NAN function.
4148a5a9dcf2SAyala Beker  * @nan_change_conf: changes NAN configuration. The changed parameters must
4149a5a9dcf2SAyala Beker  *	be specified in @changes (using &enum cfg80211_nan_conf_changes);
4150a5a9dcf2SAyala Beker  *	All other parameters must be ignored.
4151ce0ce13aSMichael Braun  *
4152ce0ce13aSMichael Braun  * @set_multicast_to_unicast: configure multicast to unicast conversion for BSS
41533a00df57SAvraham Stern  *
415452539ca8SToke Høiland-Jørgensen  * @get_txq_stats: Get TXQ stats for interface or phy. If wdev is %NULL, this
415552539ca8SToke Høiland-Jørgensen  *      function should return phy stats, and interface stats otherwise.
415652539ca8SToke Høiland-Jørgensen  *
41573a00df57SAvraham Stern  * @set_pmk: configure the PMK to be used for offloaded 802.1X 4-Way handshake.
41583a00df57SAvraham Stern  *	If not deleted through @del_pmk the PMK remains valid until disconnect
41593a00df57SAvraham Stern  *	upon which the driver should clear it.
41603a00df57SAvraham Stern  *	(invoked with the wireless_dev mutex held)
41613a00df57SAvraham Stern  * @del_pmk: delete the previously configured PMK for the given authenticator.
41623a00df57SAvraham Stern  *	(invoked with the wireless_dev mutex held)
416340cbfa90SSrinivas Dasari  *
416440cbfa90SSrinivas Dasari  * @external_auth: indicates result of offloaded authentication processing from
416540cbfa90SSrinivas Dasari  *     user space
41662576a9acSDenis Kenzior  *
41672576a9acSDenis Kenzior  * @tx_control_port: TX a control port frame (EAPoL).  The noencrypt parameter
41682576a9acSDenis Kenzior  *	tells the driver that the frame should not be encrypted.
416981e54d08SPradeep Kumar Chitrapu  *
417081e54d08SPradeep Kumar Chitrapu  * @get_ftm_responder_stats: Retrieve FTM responder statistics, if available.
417181e54d08SPradeep Kumar Chitrapu  *	Statistics should be cumulative, currently no way to reset is provided.
41729bb7e0f2SJohannes Berg  * @start_pmsr: start peer measurement (e.g. FTM)
41739bb7e0f2SJohannes Berg  * @abort_pmsr: abort peer measurement
4174cb74e977SSunil Dutt  *
4175cb74e977SSunil Dutt  * @update_owe_info: Provide updated OWE info to driver. Driver implementing SME
4176cb74e977SSunil Dutt  *	but offloading OWE processing to the user space will get the updated
4177cb74e977SSunil Dutt  *	DH IE through this interface.
41785ab92e7fSRajkumar Manoharan  *
41795ab92e7fSRajkumar Manoharan  * @probe_mesh_link: Probe direct Mesh peer's link quality by sending data frame
41805ab92e7fSRajkumar Manoharan  *	and overrule HWMP path selection algorithm.
418177f576deSTamizh chelvam  * @set_tid_config: TID specific configuration, this can be peer or BSS specific
418277f576deSTamizh chelvam  *	This callback may sleep.
41833710a8a6SJohannes Berg  * @reset_tid_config: Reset TID specific configuration for the peer, for the
41843710a8a6SJohannes Berg  *	given TIDs. This callback may sleep.
418570b6ff35SJohannes Berg  *
418670b6ff35SJohannes Berg  * @set_sar_specs: Update the SAR (TX power) settings.
41870d2ab3aeSJohn Crispin  *
41880d2ab3aeSJohn Crispin  * @color_change: Initiate a color change.
4189e306784aSSubrat Mishra  *
4190e306784aSSubrat Mishra  * @set_fils_aad: Set FILS AAD data to the AP driver so that the driver can use
4191e306784aSSubrat Mishra  *	those to decrypt (Re)Association Request and encrypt (Re)Association
4192e306784aSSubrat Mishra  *	Response frame.
4193bc2dfc02SLorenzo Bianconi  *
4194a95bfb87SLorenzo Bianconi  * @set_radar_background: Configure dedicated offchannel chain available for
4195bc2dfc02SLorenzo Bianconi  *	radar/CAC detection on some hw. This chain can't be used to transmit
4196bc2dfc02SLorenzo Bianconi  *	or receive frames and it is bounded to a running wdev.
4197a95bfb87SLorenzo Bianconi  *	Background radar/CAC detection allows to avoid the CAC downtime
4198bc2dfc02SLorenzo Bianconi  *	switching to a different channel during CAC detection on the selected
4199bc2dfc02SLorenzo Bianconi  *	radar channel.
4200bc2dfc02SLorenzo Bianconi  *	The caller is expected to set chandef pointer to NULL in order to
4201a95bfb87SLorenzo Bianconi  *	disable background CAC/radar detection.
4202704232c2SJohannes Berg  */
4203704232c2SJohannes Berg struct cfg80211_ops {
4204ff1b6e69SJohannes Berg 	int	(*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
42050378b3f1SJohannes Berg 	int	(*resume)(struct wiphy *wiphy);
42066d52563fSJohannes Berg 	void	(*set_wakeup)(struct wiphy *wiphy, bool enabled);
42070378b3f1SJohannes Berg 
420884efbb84SJohannes Berg 	struct wireless_dev * (*add_virtual_intf)(struct wiphy *wiphy,
4209552bff0cSJohannes Berg 						  const char *name,
42106bab2e19STom Gundersen 						  unsigned char name_assign_type,
4211f9e10ce4SJohannes Berg 						  enum nl80211_iftype type,
42122ec600d6SLuis Carlos Cobo 						  struct vif_params *params);
421384efbb84SJohannes Berg 	int	(*del_virtual_intf)(struct wiphy *wiphy,
421484efbb84SJohannes Berg 				    struct wireless_dev *wdev);
4215e36d56b6SJohannes Berg 	int	(*change_virtual_intf)(struct wiphy *wiphy,
4216e36d56b6SJohannes Berg 				       struct net_device *dev,
4217818a986eSJohannes Berg 				       enum nl80211_iftype type,
42182ec600d6SLuis Carlos Cobo 				       struct vif_params *params);
421941ade00fSJohannes Berg 
4220*f2a0290bSJohannes Berg 	int	(*add_intf_link)(struct wiphy *wiphy,
4221*f2a0290bSJohannes Berg 				 struct wireless_dev *wdev,
4222*f2a0290bSJohannes Berg 				 unsigned int link_id);
4223*f2a0290bSJohannes Berg 	void	(*del_intf_link)(struct wiphy *wiphy,
4224*f2a0290bSJohannes Berg 				 struct wireless_dev *wdev,
4225*f2a0290bSJohannes Berg 				 unsigned int link_id);
4226*f2a0290bSJohannes Berg 
422741ade00fSJohannes Berg 	int	(*add_key)(struct wiphy *wiphy, struct net_device *netdev,
4228e31b8213SJohannes Berg 			   u8 key_index, bool pairwise, const u8 *mac_addr,
422941ade00fSJohannes Berg 			   struct key_params *params);
423041ade00fSJohannes Berg 	int	(*get_key)(struct wiphy *wiphy, struct net_device *netdev,
4231e31b8213SJohannes Berg 			   u8 key_index, bool pairwise, const u8 *mac_addr,
4232e31b8213SJohannes Berg 			   void *cookie,
423341ade00fSJohannes Berg 			   void (*callback)(void *cookie, struct key_params*));
423441ade00fSJohannes Berg 	int	(*del_key)(struct wiphy *wiphy, struct net_device *netdev,
4235e31b8213SJohannes Berg 			   u8 key_index, bool pairwise, const u8 *mac_addr);
423641ade00fSJohannes Berg 	int	(*set_default_key)(struct wiphy *wiphy,
423741ade00fSJohannes Berg 				   struct net_device *netdev,
4238dbd2fd65SJohannes Berg 				   u8 key_index, bool unicast, bool multicast);
42393cfcf6acSJouni Malinen 	int	(*set_default_mgmt_key)(struct wiphy *wiphy,
42403cfcf6acSJouni Malinen 					struct net_device *netdev,
42413cfcf6acSJouni Malinen 					u8 key_index);
424256be393fSJouni Malinen 	int	(*set_default_beacon_key)(struct wiphy *wiphy,
424356be393fSJouni Malinen 					  struct net_device *netdev,
424456be393fSJouni Malinen 					  u8 key_index);
4245ed1b6cc7SJohannes Berg 
42468860020eSJohannes Berg 	int	(*start_ap)(struct wiphy *wiphy, struct net_device *dev,
42478860020eSJohannes Berg 			    struct cfg80211_ap_settings *settings);
42488860020eSJohannes Berg 	int	(*change_beacon)(struct wiphy *wiphy, struct net_device *dev,
42498860020eSJohannes Berg 				 struct cfg80211_beacon_data *info);
42507b0a0e3cSJohannes Berg 	int	(*stop_ap)(struct wiphy *wiphy, struct net_device *dev,
42517b0a0e3cSJohannes Berg 			   unsigned int link_id);
42525727ef1bSJohannes Berg 
42535727ef1bSJohannes Berg 
42545727ef1bSJohannes Berg 	int	(*add_station)(struct wiphy *wiphy, struct net_device *dev,
42553b3a0162SJohannes Berg 			       const u8 *mac,
42563b3a0162SJohannes Berg 			       struct station_parameters *params);
42575727ef1bSJohannes Berg 	int	(*del_station)(struct wiphy *wiphy, struct net_device *dev,
425889c771e5SJouni Malinen 			       struct station_del_parameters *params);
42595727ef1bSJohannes Berg 	int	(*change_station)(struct wiphy *wiphy, struct net_device *dev,
42603b3a0162SJohannes Berg 				  const u8 *mac,
42613b3a0162SJohannes Berg 				  struct station_parameters *params);
4262fd5b74dcSJohannes Berg 	int	(*get_station)(struct wiphy *wiphy, struct net_device *dev,
42633b3a0162SJohannes Berg 			       const u8 *mac, struct station_info *sinfo);
42642ec600d6SLuis Carlos Cobo 	int	(*dump_station)(struct wiphy *wiphy, struct net_device *dev,
42652ec600d6SLuis Carlos Cobo 				int idx, u8 *mac, struct station_info *sinfo);
42662ec600d6SLuis Carlos Cobo 
42672ec600d6SLuis Carlos Cobo 	int	(*add_mpath)(struct wiphy *wiphy, struct net_device *dev,
42683b3a0162SJohannes Berg 			       const u8 *dst, const u8 *next_hop);
42692ec600d6SLuis Carlos Cobo 	int	(*del_mpath)(struct wiphy *wiphy, struct net_device *dev,
42703b3a0162SJohannes Berg 			       const u8 *dst);
42712ec600d6SLuis Carlos Cobo 	int	(*change_mpath)(struct wiphy *wiphy, struct net_device *dev,
42723b3a0162SJohannes Berg 				  const u8 *dst, const u8 *next_hop);
42732ec600d6SLuis Carlos Cobo 	int	(*get_mpath)(struct wiphy *wiphy, struct net_device *dev,
42743b3a0162SJohannes Berg 			     u8 *dst, u8 *next_hop, struct mpath_info *pinfo);
42752ec600d6SLuis Carlos Cobo 	int	(*dump_mpath)(struct wiphy *wiphy, struct net_device *dev,
42762ec600d6SLuis Carlos Cobo 			      int idx, u8 *dst, u8 *next_hop,
42772ec600d6SLuis Carlos Cobo 			      struct mpath_info *pinfo);
427866be7d2bSHenning Rogge 	int	(*get_mpp)(struct wiphy *wiphy, struct net_device *dev,
427966be7d2bSHenning Rogge 			   u8 *dst, u8 *mpp, struct mpath_info *pinfo);
428066be7d2bSHenning Rogge 	int	(*dump_mpp)(struct wiphy *wiphy, struct net_device *dev,
428166be7d2bSHenning Rogge 			    int idx, u8 *dst, u8 *mpp,
428266be7d2bSHenning Rogge 			    struct mpath_info *pinfo);
428324bdd9f4SJavier Cardona 	int	(*get_mesh_config)(struct wiphy *wiphy,
428493da9cc1Scolin@cozybit.com 				struct net_device *dev,
428593da9cc1Scolin@cozybit.com 				struct mesh_config *conf);
428624bdd9f4SJavier Cardona 	int	(*update_mesh_config)(struct wiphy *wiphy,
428729cbe68cSJohannes Berg 				      struct net_device *dev, u32 mask,
428829cbe68cSJohannes Berg 				      const struct mesh_config *nconf);
428929cbe68cSJohannes Berg 	int	(*join_mesh)(struct wiphy *wiphy, struct net_device *dev,
429029cbe68cSJohannes Berg 			     const struct mesh_config *conf,
429129cbe68cSJohannes Berg 			     const struct mesh_setup *setup);
429229cbe68cSJohannes Berg 	int	(*leave_mesh)(struct wiphy *wiphy, struct net_device *dev);
429329cbe68cSJohannes Berg 
42946e0bd6c3SRostislav Lisovy 	int	(*join_ocb)(struct wiphy *wiphy, struct net_device *dev,
42956e0bd6c3SRostislav Lisovy 			    struct ocb_setup *setup);
42966e0bd6c3SRostislav Lisovy 	int	(*leave_ocb)(struct wiphy *wiphy, struct net_device *dev);
42976e0bd6c3SRostislav Lisovy 
42989f1ba906SJouni Malinen 	int	(*change_bss)(struct wiphy *wiphy, struct net_device *dev,
42999f1ba906SJouni Malinen 			      struct bss_parameters *params);
430031888487SJouni Malinen 
4301f70f01c2SEliad Peller 	int	(*set_txq_params)(struct wiphy *wiphy, struct net_device *dev,
430231888487SJouni Malinen 				  struct ieee80211_txq_params *params);
430372bdcf34SJouni Malinen 
4304e8c9bd5bSJohannes Berg 	int	(*libertas_set_mesh_channel)(struct wiphy *wiphy,
4305e8c9bd5bSJohannes Berg 					     struct net_device *dev,
4306e8c9bd5bSJohannes Berg 					     struct ieee80211_channel *chan);
4307e8c9bd5bSJohannes Berg 
4308e8c9bd5bSJohannes Berg 	int	(*set_monitor_channel)(struct wiphy *wiphy,
4309683b6d3bSJohannes Berg 				       struct cfg80211_chan_def *chandef);
43109aed3cc1SJouni Malinen 
4311fd014284SJohannes Berg 	int	(*scan)(struct wiphy *wiphy,
43122a519311SJohannes Berg 			struct cfg80211_scan_request *request);
431391d3ab46SVidyullatha Kanchanapally 	void	(*abort_scan)(struct wiphy *wiphy, struct wireless_dev *wdev);
4314636a5d36SJouni Malinen 
4315636a5d36SJouni Malinen 	int	(*auth)(struct wiphy *wiphy, struct net_device *dev,
4316636a5d36SJouni Malinen 			struct cfg80211_auth_request *req);
4317636a5d36SJouni Malinen 	int	(*assoc)(struct wiphy *wiphy, struct net_device *dev,
4318636a5d36SJouni Malinen 			 struct cfg80211_assoc_request *req);
4319636a5d36SJouni Malinen 	int	(*deauth)(struct wiphy *wiphy, struct net_device *dev,
432063c9c5e7SJohannes Berg 			  struct cfg80211_deauth_request *req);
4321636a5d36SJouni Malinen 	int	(*disassoc)(struct wiphy *wiphy, struct net_device *dev,
432263c9c5e7SJohannes Berg 			    struct cfg80211_disassoc_request *req);
432304a773adSJohannes Berg 
4324b23aa676SSamuel Ortiz 	int	(*connect)(struct wiphy *wiphy, struct net_device *dev,
4325b23aa676SSamuel Ortiz 			   struct cfg80211_connect_params *sme);
4326088e8df8Svamsi krishna 	int	(*update_connect_params)(struct wiphy *wiphy,
4327088e8df8Svamsi krishna 					 struct net_device *dev,
4328088e8df8Svamsi krishna 					 struct cfg80211_connect_params *sme,
4329088e8df8Svamsi krishna 					 u32 changed);
4330b23aa676SSamuel Ortiz 	int	(*disconnect)(struct wiphy *wiphy, struct net_device *dev,
4331b23aa676SSamuel Ortiz 			      u16 reason_code);
4332b23aa676SSamuel Ortiz 
433304a773adSJohannes Berg 	int	(*join_ibss)(struct wiphy *wiphy, struct net_device *dev,
433404a773adSJohannes Berg 			     struct cfg80211_ibss_params *params);
433504a773adSJohannes Berg 	int	(*leave_ibss)(struct wiphy *wiphy, struct net_device *dev);
4336b9a5f8caSJouni Malinen 
4337f4e583c8SAntonio Quartulli 	int	(*set_mcast_rate)(struct wiphy *wiphy, struct net_device *dev,
433857fbcce3SJohannes Berg 				  int rate[NUM_NL80211_BANDS]);
4339f4e583c8SAntonio Quartulli 
4340b9a5f8caSJouni Malinen 	int	(*set_wiphy_params)(struct wiphy *wiphy, u32 changed);
43417643a2c3SJohannes Berg 
4342c8442118SJohannes Berg 	int	(*set_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
4343fa61cf70SJuuso Oikarinen 				enum nl80211_tx_power_setting type, int mbm);
4344c8442118SJohannes Berg 	int	(*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
4345c8442118SJohannes Berg 				int *dbm);
43461f87f7d3SJohannes Berg 
43471f87f7d3SJohannes Berg 	void	(*rfkill_poll)(struct wiphy *wiphy);
4348aff89a9bSJohannes Berg 
4349aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE
4350fc73f11fSDavid Spinadel 	int	(*testmode_cmd)(struct wiphy *wiphy, struct wireless_dev *wdev,
4351fc73f11fSDavid Spinadel 				void *data, int len);
435271063f0eSWey-Yi Guy 	int	(*testmode_dump)(struct wiphy *wiphy, struct sk_buff *skb,
435371063f0eSWey-Yi Guy 				 struct netlink_callback *cb,
435471063f0eSWey-Yi Guy 				 void *data, int len);
4355aff89a9bSJohannes Berg #endif
4356bc92afd9SJohannes Berg 
43579930380fSJohannes Berg 	int	(*set_bitrate_mask)(struct wiphy *wiphy,
43589930380fSJohannes Berg 				    struct net_device *dev,
43597b0a0e3cSJohannes Berg 				    unsigned int link_id,
43609930380fSJohannes Berg 				    const u8 *peer,
43619930380fSJohannes Berg 				    const struct cfg80211_bitrate_mask *mask);
43629930380fSJohannes Berg 
436361fa713cSHolger Schurig 	int	(*dump_survey)(struct wiphy *wiphy, struct net_device *netdev,
436461fa713cSHolger Schurig 			int idx, struct survey_info *info);
436561fa713cSHolger Schurig 
436667fbb16bSSamuel Ortiz 	int	(*set_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
436767fbb16bSSamuel Ortiz 			     struct cfg80211_pmksa *pmksa);
436867fbb16bSSamuel Ortiz 	int	(*del_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
436967fbb16bSSamuel Ortiz 			     struct cfg80211_pmksa *pmksa);
437067fbb16bSSamuel Ortiz 	int	(*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev);
437167fbb16bSSamuel Ortiz 
43729588bbd5SJouni Malinen 	int	(*remain_on_channel)(struct wiphy *wiphy,
437371bbc994SJohannes Berg 				     struct wireless_dev *wdev,
43749588bbd5SJouni Malinen 				     struct ieee80211_channel *chan,
43759588bbd5SJouni Malinen 				     unsigned int duration,
43769588bbd5SJouni Malinen 				     u64 *cookie);
43779588bbd5SJouni Malinen 	int	(*cancel_remain_on_channel)(struct wiphy *wiphy,
437871bbc994SJohannes Berg 					    struct wireless_dev *wdev,
43799588bbd5SJouni Malinen 					    u64 cookie);
43809588bbd5SJouni Malinen 
438171bbc994SJohannes Berg 	int	(*mgmt_tx)(struct wiphy *wiphy, struct wireless_dev *wdev,
4382b176e629SAndrei Otcheretianski 			   struct cfg80211_mgmt_tx_params *params,
4383b176e629SAndrei Otcheretianski 			   u64 *cookie);
4384f7ca38dfSJohannes Berg 	int	(*mgmt_tx_cancel_wait)(struct wiphy *wiphy,
438571bbc994SJohannes Berg 				       struct wireless_dev *wdev,
4386f7ca38dfSJohannes Berg 				       u64 cookie);
4387026331c4SJouni Malinen 
4388bc92afd9SJohannes Berg 	int	(*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev,
4389bc92afd9SJohannes Berg 				  bool enabled, int timeout);
4390d6dc1a38SJuuso Oikarinen 
4391d6dc1a38SJuuso Oikarinen 	int	(*set_cqm_rssi_config)(struct wiphy *wiphy,
4392d6dc1a38SJuuso Oikarinen 				       struct net_device *dev,
4393d6dc1a38SJuuso Oikarinen 				       s32 rssi_thold, u32 rssi_hyst);
4394271733cfSJohannes Berg 
43954a4b8169SAndrew Zaborowski 	int	(*set_cqm_rssi_range_config)(struct wiphy *wiphy,
43964a4b8169SAndrew Zaborowski 					     struct net_device *dev,
43974a4b8169SAndrew Zaborowski 					     s32 rssi_low, s32 rssi_high);
43984a4b8169SAndrew Zaborowski 
439984f10708SThomas Pedersen 	int	(*set_cqm_txe_config)(struct wiphy *wiphy,
440084f10708SThomas Pedersen 				      struct net_device *dev,
440184f10708SThomas Pedersen 				      u32 rate, u32 pkts, u32 intvl);
440284f10708SThomas Pedersen 
44036cd536feSJohannes Berg 	void	(*update_mgmt_frame_registrations)(struct wiphy *wiphy,
440471bbc994SJohannes Berg 						   struct wireless_dev *wdev,
44056cd536feSJohannes Berg 						   struct mgmt_frame_regs *upd);
4406afe0cbf8SBruno Randolf 
4407afe0cbf8SBruno Randolf 	int	(*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant);
4408afe0cbf8SBruno Randolf 	int	(*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant);
44093677713bSJohn W. Linville 
4410807f8a8cSLuciano Coelho 	int	(*sched_scan_start)(struct wiphy *wiphy,
4411807f8a8cSLuciano Coelho 				struct net_device *dev,
4412807f8a8cSLuciano Coelho 				struct cfg80211_sched_scan_request *request);
44133a3ecf1dSArend Van Spriel 	int	(*sched_scan_stop)(struct wiphy *wiphy, struct net_device *dev,
44143a3ecf1dSArend Van Spriel 				   u64 reqid);
4415e5497d76SJohannes Berg 
4416e5497d76SJohannes Berg 	int	(*set_rekey_data)(struct wiphy *wiphy, struct net_device *dev,
4417e5497d76SJohannes Berg 				  struct cfg80211_gtk_rekey_data *data);
4418109086ceSArik Nemtsov 
4419109086ceSArik Nemtsov 	int	(*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev,
44203b3a0162SJohannes Berg 			     const u8 *peer, u8 action_code,  u8 dialog_token,
4421df942e7bSSunil Dutt Undekari 			     u16 status_code, u32 peer_capability,
442231fa97c5SArik Nemtsov 			     bool initiator, const u8 *buf, size_t len);
4423109086ceSArik Nemtsov 	int	(*tdls_oper)(struct wiphy *wiphy, struct net_device *dev,
44243b3a0162SJohannes Berg 			     const u8 *peer, enum nl80211_tdls_operation oper);
44257f6cf311SJohannes Berg 
44267f6cf311SJohannes Berg 	int	(*probe_client)(struct wiphy *wiphy, struct net_device *dev,
44277f6cf311SJohannes Berg 				const u8 *peer, u64 *cookie);
4428e999882aSJohannes Berg 
44291d9d9213SSimon Wunderlich 	int	(*set_noack_map)(struct wiphy *wiphy,
44301d9d9213SSimon Wunderlich 				  struct net_device *dev,
44311d9d9213SSimon Wunderlich 				  u16 noack_map);
44321d9d9213SSimon Wunderlich 
4433683b6d3bSJohannes Berg 	int	(*get_channel)(struct wiphy *wiphy,
44345b7ccaf3SJohannes Berg 			       struct wireless_dev *wdev,
44357b0a0e3cSJohannes Berg 			       unsigned int link_id,
4436683b6d3bSJohannes Berg 			       struct cfg80211_chan_def *chandef);
443798104fdeSJohannes Berg 
443898104fdeSJohannes Berg 	int	(*start_p2p_device)(struct wiphy *wiphy,
443998104fdeSJohannes Berg 				    struct wireless_dev *wdev);
444098104fdeSJohannes Berg 	void	(*stop_p2p_device)(struct wiphy *wiphy,
444198104fdeSJohannes Berg 				   struct wireless_dev *wdev);
444277765eafSVasanthakumar Thiagarajan 
444377765eafSVasanthakumar Thiagarajan 	int	(*set_mac_acl)(struct wiphy *wiphy, struct net_device *dev,
444477765eafSVasanthakumar Thiagarajan 			       const struct cfg80211_acl_data *params);
444504f39047SSimon Wunderlich 
444604f39047SSimon Wunderlich 	int	(*start_radar_detection)(struct wiphy *wiphy,
444704f39047SSimon Wunderlich 					 struct net_device *dev,
444831559f35SJanusz Dziedzic 					 struct cfg80211_chan_def *chandef,
444931559f35SJanusz Dziedzic 					 u32 cac_time_ms);
445026ec17a1SOrr Mazor 	void	(*end_cac)(struct wiphy *wiphy,
445126ec17a1SOrr Mazor 				struct net_device *dev);
4452355199e0SJouni Malinen 	int	(*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev,
4453355199e0SJouni Malinen 				 struct cfg80211_update_ft_ies_params *ftie);
44545de17984SArend van Spriel 	int	(*crit_proto_start)(struct wiphy *wiphy,
44555de17984SArend van Spriel 				    struct wireless_dev *wdev,
44565de17984SArend van Spriel 				    enum nl80211_crit_proto_id protocol,
44575de17984SArend van Spriel 				    u16 duration);
44585de17984SArend van Spriel 	void	(*crit_proto_stop)(struct wiphy *wiphy,
44595de17984SArend van Spriel 				   struct wireless_dev *wdev);
4460be29b99aSAmitkumar Karwar 	int	(*set_coalesce)(struct wiphy *wiphy,
4461be29b99aSAmitkumar Karwar 				struct cfg80211_coalesce *coalesce);
446216ef1fe2SSimon Wunderlich 
446316ef1fe2SSimon Wunderlich 	int	(*channel_switch)(struct wiphy *wiphy,
446416ef1fe2SSimon Wunderlich 				  struct net_device *dev,
446516ef1fe2SSimon Wunderlich 				  struct cfg80211_csa_settings *params);
4466e16821bcSJouni Malinen 
4467fa9ffc74SKyeyoon Park 	int     (*set_qos_map)(struct wiphy *wiphy,
4468fa9ffc74SKyeyoon Park 			       struct net_device *dev,
4469fa9ffc74SKyeyoon Park 			       struct cfg80211_qos_map *qos_map);
4470e16821bcSJouni Malinen 
4471e16821bcSJouni Malinen 	int	(*set_ap_chanwidth)(struct wiphy *wiphy, struct net_device *dev,
44727b0a0e3cSJohannes Berg 				    unsigned int link_id,
4473e16821bcSJouni Malinen 				    struct cfg80211_chan_def *chandef);
4474960d01acSJohannes Berg 
4475960d01acSJohannes Berg 	int	(*add_tx_ts)(struct wiphy *wiphy, struct net_device *dev,
4476960d01acSJohannes Berg 			     u8 tsid, const u8 *peer, u8 user_prio,
4477960d01acSJohannes Berg 			     u16 admitted_time);
4478960d01acSJohannes Berg 	int	(*del_tx_ts)(struct wiphy *wiphy, struct net_device *dev,
4479960d01acSJohannes Berg 			     u8 tsid, const u8 *peer);
44801057d35eSArik Nemtsov 
44811057d35eSArik Nemtsov 	int	(*tdls_channel_switch)(struct wiphy *wiphy,
44821057d35eSArik Nemtsov 				       struct net_device *dev,
44831057d35eSArik Nemtsov 				       const u8 *addr, u8 oper_class,
44841057d35eSArik Nemtsov 				       struct cfg80211_chan_def *chandef);
44851057d35eSArik Nemtsov 	void	(*tdls_cancel_channel_switch)(struct wiphy *wiphy,
44861057d35eSArik Nemtsov 					      struct net_device *dev,
44871057d35eSArik Nemtsov 					      const u8 *addr);
4488cb3b7d87SAyala Beker 	int	(*start_nan)(struct wiphy *wiphy, struct wireless_dev *wdev,
4489cb3b7d87SAyala Beker 			     struct cfg80211_nan_conf *conf);
4490cb3b7d87SAyala Beker 	void	(*stop_nan)(struct wiphy *wiphy, struct wireless_dev *wdev);
4491a442b761SAyala Beker 	int	(*add_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev,
4492a442b761SAyala Beker 				struct cfg80211_nan_func *nan_func);
4493a442b761SAyala Beker 	void	(*del_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev,
4494a442b761SAyala Beker 			       u64 cookie);
4495a5a9dcf2SAyala Beker 	int	(*nan_change_conf)(struct wiphy *wiphy,
4496a5a9dcf2SAyala Beker 				   struct wireless_dev *wdev,
4497a5a9dcf2SAyala Beker 				   struct cfg80211_nan_conf *conf,
4498a5a9dcf2SAyala Beker 				   u32 changes);
4499ce0ce13aSMichael Braun 
4500ce0ce13aSMichael Braun 	int	(*set_multicast_to_unicast)(struct wiphy *wiphy,
4501ce0ce13aSMichael Braun 					    struct net_device *dev,
4502ce0ce13aSMichael Braun 					    const bool enabled);
45033a00df57SAvraham Stern 
450452539ca8SToke Høiland-Jørgensen 	int	(*get_txq_stats)(struct wiphy *wiphy,
450552539ca8SToke Høiland-Jørgensen 				 struct wireless_dev *wdev,
450652539ca8SToke Høiland-Jørgensen 				 struct cfg80211_txq_stats *txqstats);
450752539ca8SToke Høiland-Jørgensen 
45083a00df57SAvraham Stern 	int	(*set_pmk)(struct wiphy *wiphy, struct net_device *dev,
45093a00df57SAvraham Stern 			   const struct cfg80211_pmk_conf *conf);
45103a00df57SAvraham Stern 	int	(*del_pmk)(struct wiphy *wiphy, struct net_device *dev,
45113a00df57SAvraham Stern 			   const u8 *aa);
451240cbfa90SSrinivas Dasari 	int     (*external_auth)(struct wiphy *wiphy, struct net_device *dev,
451340cbfa90SSrinivas Dasari 				 struct cfg80211_external_auth_params *params);
45142576a9acSDenis Kenzior 
45152576a9acSDenis Kenzior 	int	(*tx_control_port)(struct wiphy *wiphy,
45162576a9acSDenis Kenzior 				   struct net_device *dev,
45172576a9acSDenis Kenzior 				   const u8 *buf, size_t len,
45188d74a623SJohannes Berg 				   const u8 *dest, const __be16 proto,
4519dca9ca2dSMarkus Theil 				   const bool noencrypt,
4520dca9ca2dSMarkus Theil 				   u64 *cookie);
452181e54d08SPradeep Kumar Chitrapu 
452281e54d08SPradeep Kumar Chitrapu 	int	(*get_ftm_responder_stats)(struct wiphy *wiphy,
452381e54d08SPradeep Kumar Chitrapu 				struct net_device *dev,
452481e54d08SPradeep Kumar Chitrapu 				struct cfg80211_ftm_responder_stats *ftm_stats);
45259bb7e0f2SJohannes Berg 
45269bb7e0f2SJohannes Berg 	int	(*start_pmsr)(struct wiphy *wiphy, struct wireless_dev *wdev,
45279bb7e0f2SJohannes Berg 			      struct cfg80211_pmsr_request *request);
45289bb7e0f2SJohannes Berg 	void	(*abort_pmsr)(struct wiphy *wiphy, struct wireless_dev *wdev,
45299bb7e0f2SJohannes Berg 			      struct cfg80211_pmsr_request *request);
4530cb74e977SSunil Dutt 	int	(*update_owe_info)(struct wiphy *wiphy, struct net_device *dev,
4531cb74e977SSunil Dutt 				   struct cfg80211_update_owe_info *owe_info);
45325ab92e7fSRajkumar Manoharan 	int	(*probe_mesh_link)(struct wiphy *wiphy, struct net_device *dev,
45335ab92e7fSRajkumar Manoharan 				   const u8 *buf, size_t len);
453477f576deSTamizh chelvam 	int     (*set_tid_config)(struct wiphy *wiphy, struct net_device *dev,
45353710a8a6SJohannes Berg 				  struct cfg80211_tid_config *tid_conf);
453677f576deSTamizh chelvam 	int	(*reset_tid_config)(struct wiphy *wiphy, struct net_device *dev,
45373710a8a6SJohannes Berg 				    const u8 *peer, u8 tids);
45386bdb68ceSCarl Huang 	int	(*set_sar_specs)(struct wiphy *wiphy,
45396bdb68ceSCarl Huang 				 struct cfg80211_sar_specs *sar);
45400d2ab3aeSJohn Crispin 	int	(*color_change)(struct wiphy *wiphy,
45410d2ab3aeSJohn Crispin 				struct net_device *dev,
45420d2ab3aeSJohn Crispin 				struct cfg80211_color_change_settings *params);
4543e306784aSSubrat Mishra 	int     (*set_fils_aad)(struct wiphy *wiphy, struct net_device *dev,
4544e306784aSSubrat Mishra 				struct cfg80211_fils_aad *fils_aad);
4545a95bfb87SLorenzo Bianconi 	int	(*set_radar_background)(struct wiphy *wiphy,
4546bc2dfc02SLorenzo Bianconi 					struct cfg80211_chan_def *chandef);
4547704232c2SJohannes Berg };
4548704232c2SJohannes Berg 
4549d3236553SJohannes Berg /*
4550d3236553SJohannes Berg  * wireless hardware and networking interfaces structures
4551d3236553SJohannes Berg  * and registration/helper functions
4552d3236553SJohannes Berg  */
4553d3236553SJohannes Berg 
4554d3236553SJohannes Berg /**
45555be83de5SJohannes Berg  * enum wiphy_flags - wiphy capability flags
45565be83de5SJohannes Berg  *
4557c8cb5b85STova Mussai  * @WIPHY_FLAG_SPLIT_SCAN_6GHZ: if set to true, the scan request will be split
4558c8cb5b85STova Mussai  *	 into two, first for legacy bands and second for UHB.
45595be83de5SJohannes Berg  * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this
45605be83de5SJohannes Berg  *	wiphy at all
45615be83de5SJohannes Berg  * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled
45625be83de5SJohannes Berg  *	by default -- this flag will be set depending on the kernel's default
45635be83de5SJohannes Berg  *	on wiphy_new(), but can be changed by the driver if it has a good
45645be83de5SJohannes Berg  *	reason to override the default
45659bc383deSJohannes Berg  * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station
456633d915d9SManikanta Pubbisetty  *	on a VLAN interface). This flag also serves an extra purpose of
456733d915d9SManikanta Pubbisetty  *	supporting 4ADDR AP mode on devices which do not support AP/VLAN iftype.
45689bc383deSJohannes Berg  * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station
4569c0692b8fSJohannes Berg  * @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the
4570c0692b8fSJohannes Berg  *	control port protocol ethertype. The device also honours the
4571c0692b8fSJohannes Berg  *	control_port_no_encrypt flag.
4572e31b8213SJohannes Berg  * @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN.
457315d5dda6SJavier Cardona  * @WIPHY_FLAG_MESH_AUTH: The device supports mesh authentication by routing
457415d5dda6SJavier Cardona  *	auth frames to userspace. See @NL80211_MESH_SETUP_USERSPACE_AUTH.
4575f4b34b55SVivek Natarajan  * @WIPHY_FLAG_SUPPORTS_FW_ROAM: The device supports roaming feature in the
4576f4b34b55SVivek Natarajan  *	firmware.
4577cedb5412SEliad Peller  * @WIPHY_FLAG_AP_UAPSD: The device supports uapsd on AP.
4578109086ceSArik Nemtsov  * @WIPHY_FLAG_SUPPORTS_TDLS: The device supports TDLS (802.11z) operation.
4579109086ceSArik Nemtsov  * @WIPHY_FLAG_TDLS_EXTERNAL_SETUP: The device does not handle TDLS (802.11z)
4580109086ceSArik Nemtsov  *	link setup/discovery operations internally. Setup, discovery and
4581109086ceSArik Nemtsov  *	teardown packets should be sent through the @NL80211_CMD_TDLS_MGMT
4582109086ceSArik Nemtsov  *	command. When this flag is not set, @NL80211_CMD_TDLS_OPER should be
4583109086ceSArik Nemtsov  *	used for asking the driver/firmware to perform a TDLS operation.
4584562a7480SJohannes Berg  * @WIPHY_FLAG_HAVE_AP_SME: device integrates AP SME
45855e760230SJohannes Berg  * @WIPHY_FLAG_REPORTS_OBSS: the device will report beacons from other BSSes
45865e760230SJohannes Berg  *	when there are virtual interfaces in AP mode by calling
45875e760230SJohannes Berg  *	cfg80211_report_obss_beacon().
458887bbbe22SArik Nemtsov  * @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD: When operating as an AP, the device
458987bbbe22SArik Nemtsov  *	responds to probe-requests in hardware.
45907c4ef712SJohannes Berg  * @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX.
45917c4ef712SJohannes Berg  * @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call.
45922f301ab2SSimon Wunderlich  * @WIPHY_FLAG_SUPPORTS_5_10_MHZ: Device supports 5 MHz and 10 MHz channels.
459316ef1fe2SSimon Wunderlich  * @WIPHY_FLAG_HAS_CHANNEL_SWITCH: Device supports channel switch in
459416ef1fe2SSimon Wunderlich  *	beaconing mode (AP, IBSS, Mesh, ...).
4595b8676221SDavid Spinadel  * @WIPHY_FLAG_HAS_STATIC_WEP: The device supports static WEP key installation
4596b8676221SDavid Spinadel  *	before connection.
4597093a48d2SNathan Errera  * @WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK: The device supports bigger kek and kck keys
45987b0a0e3cSJohannes Berg  * @WIPHY_FLAG_SUPPORTS_MLO: This is a temporary flag gating the MLO APIs,
45997b0a0e3cSJohannes Berg  *	in order to not have them reachable in normal drivers, until we have
46007b0a0e3cSJohannes Berg  *	complete feature/interface combinations/etc. advertisement. No driver
46017b0a0e3cSJohannes Berg  *	should set this flag for now.
46025be83de5SJohannes Berg  */
46035be83de5SJohannes Berg enum wiphy_flags {
4604093a48d2SNathan Errera 	WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK		= BIT(0),
46057b0a0e3cSJohannes Berg 	WIPHY_FLAG_SUPPORTS_MLO			= BIT(1),
4606c8cb5b85STova Mussai 	WIPHY_FLAG_SPLIT_SCAN_6GHZ		= BIT(2),
46075be83de5SJohannes Berg 	WIPHY_FLAG_NETNS_OK			= BIT(3),
46085be83de5SJohannes Berg 	WIPHY_FLAG_PS_ON_BY_DEFAULT		= BIT(4),
46099bc383deSJohannes Berg 	WIPHY_FLAG_4ADDR_AP			= BIT(5),
46109bc383deSJohannes Berg 	WIPHY_FLAG_4ADDR_STATION		= BIT(6),
4611c0692b8fSJohannes Berg 	WIPHY_FLAG_CONTROL_PORT_PROTOCOL	= BIT(7),
4612309075cfSJussi Kivilinna 	WIPHY_FLAG_IBSS_RSN			= BIT(8),
461315d5dda6SJavier Cardona 	WIPHY_FLAG_MESH_AUTH			= BIT(10),
4614ca986ad9SArend Van Spriel 	/* use hole at 11 */
46158e8b41f9SJohannes Berg 	/* use hole at 12 */
4616f4b34b55SVivek Natarajan 	WIPHY_FLAG_SUPPORTS_FW_ROAM		= BIT(13),
4617cedb5412SEliad Peller 	WIPHY_FLAG_AP_UAPSD			= BIT(14),
4618109086ceSArik Nemtsov 	WIPHY_FLAG_SUPPORTS_TDLS		= BIT(15),
4619109086ceSArik Nemtsov 	WIPHY_FLAG_TDLS_EXTERNAL_SETUP		= BIT(16),
4620562a7480SJohannes Berg 	WIPHY_FLAG_HAVE_AP_SME			= BIT(17),
46215e760230SJohannes Berg 	WIPHY_FLAG_REPORTS_OBSS			= BIT(18),
462287bbbe22SArik Nemtsov 	WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD	= BIT(19),
46237c4ef712SJohannes Berg 	WIPHY_FLAG_OFFCHAN_TX			= BIT(20),
46247c4ef712SJohannes Berg 	WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL	= BIT(21),
46252f301ab2SSimon Wunderlich 	WIPHY_FLAG_SUPPORTS_5_10_MHZ		= BIT(22),
462616ef1fe2SSimon Wunderlich 	WIPHY_FLAG_HAS_CHANNEL_SWITCH		= BIT(23),
4627b8676221SDavid Spinadel 	WIPHY_FLAG_HAS_STATIC_WEP		= BIT(24),
46287527a782SJohannes Berg };
46297527a782SJohannes Berg 
46307527a782SJohannes Berg /**
46317527a782SJohannes Berg  * struct ieee80211_iface_limit - limit on certain interface types
46327527a782SJohannes Berg  * @max: maximum number of interfaces of these types
46337527a782SJohannes Berg  * @types: interface types (bits)
46347527a782SJohannes Berg  */
46357527a782SJohannes Berg struct ieee80211_iface_limit {
46367527a782SJohannes Berg 	u16 max;
46377527a782SJohannes Berg 	u16 types;
46387527a782SJohannes Berg };
46397527a782SJohannes Berg 
46407527a782SJohannes Berg /**
46417527a782SJohannes Berg  * struct ieee80211_iface_combination - possible interface combination
46427527a782SJohannes Berg  *
4643b80edbc1SLuciano Coelho  * With this structure the driver can describe which interface
4644b80edbc1SLuciano Coelho  * combinations it supports concurrently.
46457527a782SJohannes Berg  *
4646b80edbc1SLuciano Coelho  * Examples:
4647b80edbc1SLuciano Coelho  *
4648b80edbc1SLuciano Coelho  * 1. Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total:
46497527a782SJohannes Berg  *
4650819bf593SJohannes Berg  *    .. code-block:: c
4651819bf593SJohannes Berg  *
46527527a782SJohannes Berg  *	struct ieee80211_iface_limit limits1[] = {
46537527a782SJohannes Berg  *		{ .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
46547527a782SJohannes Berg  *		{ .max = 1, .types = BIT(NL80211_IFTYPE_AP}, },
46557527a782SJohannes Berg  *	};
46567527a782SJohannes Berg  *	struct ieee80211_iface_combination combination1 = {
46577527a782SJohannes Berg  *		.limits = limits1,
46587527a782SJohannes Berg  *		.n_limits = ARRAY_SIZE(limits1),
46597527a782SJohannes Berg  *		.max_interfaces = 2,
46607527a782SJohannes Berg  *		.beacon_int_infra_match = true,
46617527a782SJohannes Berg  *	};
46627527a782SJohannes Berg  *
46637527a782SJohannes Berg  *
4664b80edbc1SLuciano Coelho  * 2. Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total:
46657527a782SJohannes Berg  *
4666819bf593SJohannes Berg  *    .. code-block:: c
4667819bf593SJohannes Berg  *
46687527a782SJohannes Berg  *	struct ieee80211_iface_limit limits2[] = {
46697527a782SJohannes Berg  *		{ .max = 8, .types = BIT(NL80211_IFTYPE_AP) |
46707527a782SJohannes Berg  *				     BIT(NL80211_IFTYPE_P2P_GO), },
46717527a782SJohannes Berg  *	};
46727527a782SJohannes Berg  *	struct ieee80211_iface_combination combination2 = {
46737527a782SJohannes Berg  *		.limits = limits2,
46747527a782SJohannes Berg  *		.n_limits = ARRAY_SIZE(limits2),
46757527a782SJohannes Berg  *		.max_interfaces = 8,
46767527a782SJohannes Berg  *		.num_different_channels = 1,
46777527a782SJohannes Berg  *	};
46787527a782SJohannes Berg  *
46797527a782SJohannes Berg  *
4680b80edbc1SLuciano Coelho  * 3. Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total.
4681b80edbc1SLuciano Coelho  *
46827527a782SJohannes Berg  *    This allows for an infrastructure connection and three P2P connections.
46837527a782SJohannes Berg  *
4684819bf593SJohannes Berg  *    .. code-block:: c
4685819bf593SJohannes Berg  *
46867527a782SJohannes Berg  *	struct ieee80211_iface_limit limits3[] = {
46877527a782SJohannes Berg  *		{ .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
46887527a782SJohannes Berg  *		{ .max = 3, .types = BIT(NL80211_IFTYPE_P2P_GO) |
46897527a782SJohannes Berg  *				     BIT(NL80211_IFTYPE_P2P_CLIENT), },
46907527a782SJohannes Berg  *	};
46917527a782SJohannes Berg  *	struct ieee80211_iface_combination combination3 = {
46927527a782SJohannes Berg  *		.limits = limits3,
46937527a782SJohannes Berg  *		.n_limits = ARRAY_SIZE(limits3),
46947527a782SJohannes Berg  *		.max_interfaces = 4,
46957527a782SJohannes Berg  *		.num_different_channels = 2,
46967527a782SJohannes Berg  *	};
4697819bf593SJohannes Berg  *
46987527a782SJohannes Berg  */
46997527a782SJohannes Berg struct ieee80211_iface_combination {
4700c6c94aeaSJohannes Berg 	/**
4701c6c94aeaSJohannes Berg 	 * @limits:
4702c6c94aeaSJohannes Berg 	 * limits for the given interface types
4703c6c94aeaSJohannes Berg 	 */
47047527a782SJohannes Berg 	const struct ieee80211_iface_limit *limits;
4705c6c94aeaSJohannes Berg 
4706c6c94aeaSJohannes Berg 	/**
4707c6c94aeaSJohannes Berg 	 * @num_different_channels:
4708c6c94aeaSJohannes Berg 	 * can use up to this many different channels
4709c6c94aeaSJohannes Berg 	 */
47107527a782SJohannes Berg 	u32 num_different_channels;
4711c6c94aeaSJohannes Berg 
4712c6c94aeaSJohannes Berg 	/**
4713c6c94aeaSJohannes Berg 	 * @max_interfaces:
4714c6c94aeaSJohannes Berg 	 * maximum number of interfaces in total allowed in this group
4715c6c94aeaSJohannes Berg 	 */
47167527a782SJohannes Berg 	u16 max_interfaces;
4717c6c94aeaSJohannes Berg 
4718c6c94aeaSJohannes Berg 	/**
4719c6c94aeaSJohannes Berg 	 * @n_limits:
4720c6c94aeaSJohannes Berg 	 * number of limitations
4721c6c94aeaSJohannes Berg 	 */
47227527a782SJohannes Berg 	u8 n_limits;
4723c6c94aeaSJohannes Berg 
4724c6c94aeaSJohannes Berg 	/**
4725c6c94aeaSJohannes Berg 	 * @beacon_int_infra_match:
4726c6c94aeaSJohannes Berg 	 * In this combination, the beacon intervals between infrastructure
4727c6c94aeaSJohannes Berg 	 * and AP types must match. This is required only in special cases.
4728c6c94aeaSJohannes Berg 	 */
47297527a782SJohannes Berg 	bool beacon_int_infra_match;
4730c6c94aeaSJohannes Berg 
4731c6c94aeaSJohannes Berg 	/**
4732c6c94aeaSJohannes Berg 	 * @radar_detect_widths:
4733c6c94aeaSJohannes Berg 	 * bitmap of channel widths supported for radar detection
4734c6c94aeaSJohannes Berg 	 */
473511c4a075SSimon Wunderlich 	u8 radar_detect_widths;
4736c6c94aeaSJohannes Berg 
4737c6c94aeaSJohannes Berg 	/**
4738c6c94aeaSJohannes Berg 	 * @radar_detect_regions:
4739c6c94aeaSJohannes Berg 	 * bitmap of regions supported for radar detection
4740c6c94aeaSJohannes Berg 	 */
47418c48b50aSFelix Fietkau 	u8 radar_detect_regions;
4742c6c94aeaSJohannes Berg 
4743c6c94aeaSJohannes Berg 	/**
4744c6c94aeaSJohannes Berg 	 * @beacon_int_min_gcd:
4745c6c94aeaSJohannes Berg 	 * This interface combination supports different beacon intervals.
4746c6c94aeaSJohannes Berg 	 *
4747c6c94aeaSJohannes Berg 	 * = 0
4748c6c94aeaSJohannes Berg 	 *   all beacon intervals for different interface must be same.
4749c6c94aeaSJohannes Berg 	 * > 0
4750c6c94aeaSJohannes Berg 	 *   any beacon interval for the interface part of this combination AND
4751c6c94aeaSJohannes Berg 	 *   GCD of all beacon intervals from beaconing interfaces of this
4752c6c94aeaSJohannes Berg 	 *   combination must be greater or equal to this value.
4753c6c94aeaSJohannes Berg 	 */
47540c317a02SPurushottam Kushwaha 	u32 beacon_int_min_gcd;
47555be83de5SJohannes Berg };
47565be83de5SJohannes Berg 
47572e161f78SJohannes Berg struct ieee80211_txrx_stypes {
47582e161f78SJohannes Berg 	u16 tx, rx;
47592e161f78SJohannes Berg };
47602e161f78SJohannes Berg 
47615be83de5SJohannes Berg /**
4762ff1b6e69SJohannes Berg  * enum wiphy_wowlan_support_flags - WoWLAN support flags
4763ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_ANY: supports wakeup for the special "any"
4764ff1b6e69SJohannes Berg  *	trigger that keeps the device operating as-is and
4765ff1b6e69SJohannes Berg  *	wakes up the host on any activity, for example a
4766ff1b6e69SJohannes Berg  *	received packet that passed filtering; note that the
4767ff1b6e69SJohannes Berg  *	packet should be preserved in that case
4768ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_MAGIC_PKT: supports wakeup on magic packet
4769ff1b6e69SJohannes Berg  *	(see nl80211.h)
4770ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_DISCONNECT: supports wakeup on disconnect
477177dbbb13SJohannes Berg  * @WIPHY_WOWLAN_SUPPORTS_GTK_REKEY: supports GTK rekeying while asleep
477277dbbb13SJohannes Berg  * @WIPHY_WOWLAN_GTK_REKEY_FAILURE: supports wakeup on GTK rekey failure
477377dbbb13SJohannes Berg  * @WIPHY_WOWLAN_EAP_IDENTITY_REQ: supports wakeup on EAP identity request
477477dbbb13SJohannes Berg  * @WIPHY_WOWLAN_4WAY_HANDSHAKE: supports wakeup on 4-way handshake failure
477577dbbb13SJohannes Berg  * @WIPHY_WOWLAN_RFKILL_RELEASE: supports wakeup on RF-kill release
47768cd4d456SLuciano Coelho  * @WIPHY_WOWLAN_NET_DETECT: supports wakeup on network detection
4777ff1b6e69SJohannes Berg  */
4778ff1b6e69SJohannes Berg enum wiphy_wowlan_support_flags {
4779ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_ANY		= BIT(0),
4780ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_MAGIC_PKT		= BIT(1),
4781ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_DISCONNECT		= BIT(2),
478277dbbb13SJohannes Berg 	WIPHY_WOWLAN_SUPPORTS_GTK_REKEY	= BIT(3),
478377dbbb13SJohannes Berg 	WIPHY_WOWLAN_GTK_REKEY_FAILURE	= BIT(4),
478477dbbb13SJohannes Berg 	WIPHY_WOWLAN_EAP_IDENTITY_REQ	= BIT(5),
478577dbbb13SJohannes Berg 	WIPHY_WOWLAN_4WAY_HANDSHAKE	= BIT(6),
478677dbbb13SJohannes Berg 	WIPHY_WOWLAN_RFKILL_RELEASE	= BIT(7),
47878cd4d456SLuciano Coelho 	WIPHY_WOWLAN_NET_DETECT		= BIT(8),
4788ff1b6e69SJohannes Berg };
4789ff1b6e69SJohannes Berg 
47902a0e047eSJohannes Berg struct wiphy_wowlan_tcp_support {
47912a0e047eSJohannes Berg 	const struct nl80211_wowlan_tcp_data_token_feature *tok;
47922a0e047eSJohannes Berg 	u32 data_payload_max;
47932a0e047eSJohannes Berg 	u32 data_interval_max;
47942a0e047eSJohannes Berg 	u32 wake_payload_max;
47952a0e047eSJohannes Berg 	bool seq;
47962a0e047eSJohannes Berg };
47972a0e047eSJohannes Berg 
4798ff1b6e69SJohannes Berg /**
4799ff1b6e69SJohannes Berg  * struct wiphy_wowlan_support - WoWLAN support data
4800ff1b6e69SJohannes Berg  * @flags: see &enum wiphy_wowlan_support_flags
4801ff1b6e69SJohannes Berg  * @n_patterns: number of supported wakeup patterns
4802ff1b6e69SJohannes Berg  *	(see nl80211.h for the pattern definition)
4803ff1b6e69SJohannes Berg  * @pattern_max_len: maximum length of each pattern
4804ff1b6e69SJohannes Berg  * @pattern_min_len: minimum length of each pattern
4805bb92d199SAmitkumar Karwar  * @max_pkt_offset: maximum Rx packet offset
48068cd4d456SLuciano Coelho  * @max_nd_match_sets: maximum number of matchsets for net-detect,
48078cd4d456SLuciano Coelho  *	similar, but not necessarily identical, to max_match_sets for
48088cd4d456SLuciano Coelho  *	scheduled scans.
48098cd4d456SLuciano Coelho  *	See &struct cfg80211_sched_scan_request.@match_sets for more
48108cd4d456SLuciano Coelho  *	details.
48112a0e047eSJohannes Berg  * @tcp: TCP wakeup support information
4812ff1b6e69SJohannes Berg  */
4813ff1b6e69SJohannes Berg struct wiphy_wowlan_support {
4814ff1b6e69SJohannes Berg 	u32 flags;
4815ff1b6e69SJohannes Berg 	int n_patterns;
4816ff1b6e69SJohannes Berg 	int pattern_max_len;
4817ff1b6e69SJohannes Berg 	int pattern_min_len;
4818bb92d199SAmitkumar Karwar 	int max_pkt_offset;
48198cd4d456SLuciano Coelho 	int max_nd_match_sets;
48202a0e047eSJohannes Berg 	const struct wiphy_wowlan_tcp_support *tcp;
4821ff1b6e69SJohannes Berg };
4822ff1b6e69SJohannes Berg 
4823ff1b6e69SJohannes Berg /**
4824be29b99aSAmitkumar Karwar  * struct wiphy_coalesce_support - coalesce support data
4825be29b99aSAmitkumar Karwar  * @n_rules: maximum number of coalesce rules
4826be29b99aSAmitkumar Karwar  * @max_delay: maximum supported coalescing delay in msecs
4827be29b99aSAmitkumar Karwar  * @n_patterns: number of supported patterns in a rule
4828be29b99aSAmitkumar Karwar  *	(see nl80211.h for the pattern definition)
4829be29b99aSAmitkumar Karwar  * @pattern_max_len: maximum length of each pattern
4830be29b99aSAmitkumar Karwar  * @pattern_min_len: minimum length of each pattern
4831be29b99aSAmitkumar Karwar  * @max_pkt_offset: maximum Rx packet offset
4832be29b99aSAmitkumar Karwar  */
4833be29b99aSAmitkumar Karwar struct wiphy_coalesce_support {
4834be29b99aSAmitkumar Karwar 	int n_rules;
4835be29b99aSAmitkumar Karwar 	int max_delay;
4836be29b99aSAmitkumar Karwar 	int n_patterns;
4837be29b99aSAmitkumar Karwar 	int pattern_max_len;
4838be29b99aSAmitkumar Karwar 	int pattern_min_len;
4839be29b99aSAmitkumar Karwar 	int max_pkt_offset;
4840be29b99aSAmitkumar Karwar };
4841be29b99aSAmitkumar Karwar 
4842be29b99aSAmitkumar Karwar /**
4843ad7e718cSJohannes Berg  * enum wiphy_vendor_command_flags - validation flags for vendor commands
4844ad7e718cSJohannes Berg  * @WIPHY_VENDOR_CMD_NEED_WDEV: vendor command requires wdev
4845ad7e718cSJohannes Berg  * @WIPHY_VENDOR_CMD_NEED_NETDEV: vendor command requires netdev
4846ad7e718cSJohannes Berg  * @WIPHY_VENDOR_CMD_NEED_RUNNING: interface/wdev must be up & running
4847ad7e718cSJohannes Berg  *	(must be combined with %_WDEV or %_NETDEV)
4848ad7e718cSJohannes Berg  */
4849ad7e718cSJohannes Berg enum wiphy_vendor_command_flags {
4850ad7e718cSJohannes Berg 	WIPHY_VENDOR_CMD_NEED_WDEV = BIT(0),
4851ad7e718cSJohannes Berg 	WIPHY_VENDOR_CMD_NEED_NETDEV = BIT(1),
4852ad7e718cSJohannes Berg 	WIPHY_VENDOR_CMD_NEED_RUNNING = BIT(2),
4853ad7e718cSJohannes Berg };
4854ad7e718cSJohannes Berg 
4855ad7e718cSJohannes Berg /**
4856466b9936Stamizhr@codeaurora.org  * enum wiphy_opmode_flag - Station's ht/vht operation mode information flags
4857466b9936Stamizhr@codeaurora.org  *
4858466b9936Stamizhr@codeaurora.org  * @STA_OPMODE_MAX_BW_CHANGED: Max Bandwidth changed
4859466b9936Stamizhr@codeaurora.org  * @STA_OPMODE_SMPS_MODE_CHANGED: SMPS mode changed
4860466b9936Stamizhr@codeaurora.org  * @STA_OPMODE_N_SS_CHANGED: max N_SS (number of spatial streams) changed
4861466b9936Stamizhr@codeaurora.org  *
4862466b9936Stamizhr@codeaurora.org  */
4863466b9936Stamizhr@codeaurora.org enum wiphy_opmode_flag {
4864466b9936Stamizhr@codeaurora.org 	STA_OPMODE_MAX_BW_CHANGED	= BIT(0),
4865466b9936Stamizhr@codeaurora.org 	STA_OPMODE_SMPS_MODE_CHANGED	= BIT(1),
4866466b9936Stamizhr@codeaurora.org 	STA_OPMODE_N_SS_CHANGED		= BIT(2),
4867466b9936Stamizhr@codeaurora.org };
4868466b9936Stamizhr@codeaurora.org 
4869466b9936Stamizhr@codeaurora.org /**
4870466b9936Stamizhr@codeaurora.org  * struct sta_opmode_info - Station's ht/vht operation mode information
4871466b9936Stamizhr@codeaurora.org  * @changed: contains value from &enum wiphy_opmode_flag
48725e78abd0Stamizhr@codeaurora.org  * @smps_mode: New SMPS mode value from &enum nl80211_smps_mode of a station
48735e78abd0Stamizhr@codeaurora.org  * @bw: new max bandwidth value from &enum nl80211_chan_width of a station
4874466b9936Stamizhr@codeaurora.org  * @rx_nss: new rx_nss value of a station
4875466b9936Stamizhr@codeaurora.org  */
4876466b9936Stamizhr@codeaurora.org 
4877466b9936Stamizhr@codeaurora.org struct sta_opmode_info {
4878466b9936Stamizhr@codeaurora.org 	u32 changed;
48795e78abd0Stamizhr@codeaurora.org 	enum nl80211_smps_mode smps_mode;
48805e78abd0Stamizhr@codeaurora.org 	enum nl80211_chan_width bw;
4881466b9936Stamizhr@codeaurora.org 	u8 rx_nss;
4882466b9936Stamizhr@codeaurora.org };
4883466b9936Stamizhr@codeaurora.org 
488491046d63SJohannes Berg #define VENDOR_CMD_RAW_DATA ((const struct nla_policy *)(long)(-ENODATA))
4885901bb989SJohannes Berg 
4886466b9936Stamizhr@codeaurora.org /**
4887ad7e718cSJohannes Berg  * struct wiphy_vendor_command - vendor command definition
4888ad7e718cSJohannes Berg  * @info: vendor command identifying information, as used in nl80211
4889ad7e718cSJohannes Berg  * @flags: flags, see &enum wiphy_vendor_command_flags
4890ad7e718cSJohannes Berg  * @doit: callback for the operation, note that wdev is %NULL if the
4891ad7e718cSJohannes Berg  *	flags didn't ask for a wdev and non-%NULL otherwise; the data
4892ad7e718cSJohannes Berg  *	pointer may be %NULL if userspace provided no data at all
48937bdbe400SJohannes Berg  * @dumpit: dump callback, for transferring bigger/multiple items. The
48947bdbe400SJohannes Berg  *	@storage points to cb->args[5], ie. is preserved over the multiple
48957bdbe400SJohannes Berg  *	dumpit calls.
4896901bb989SJohannes Berg  * @policy: policy pointer for attributes within %NL80211_ATTR_VENDOR_DATA.
4897901bb989SJohannes Berg  *	Set this to %VENDOR_CMD_RAW_DATA if no policy can be given and the
4898901bb989SJohannes Berg  *	attribute is just raw data (e.g. a firmware command).
4899901bb989SJohannes Berg  * @maxattr: highest attribute number in policy
49007bdbe400SJohannes Berg  * It's recommended to not have the same sub command with both @doit and
49017bdbe400SJohannes Berg  * @dumpit, so that userspace can assume certain ones are get and others
49027bdbe400SJohannes Berg  * are used with dump requests.
4903ad7e718cSJohannes Berg  */
4904ad7e718cSJohannes Berg struct wiphy_vendor_command {
4905ad7e718cSJohannes Berg 	struct nl80211_vendor_cmd_info info;
4906ad7e718cSJohannes Berg 	u32 flags;
4907ad7e718cSJohannes Berg 	int (*doit)(struct wiphy *wiphy, struct wireless_dev *wdev,
4908ad7e718cSJohannes Berg 		    const void *data, int data_len);
49097bdbe400SJohannes Berg 	int (*dumpit)(struct wiphy *wiphy, struct wireless_dev *wdev,
49107bdbe400SJohannes Berg 		      struct sk_buff *skb, const void *data, int data_len,
49117bdbe400SJohannes Berg 		      unsigned long *storage);
4912901bb989SJohannes Berg 	const struct nla_policy *policy;
4913901bb989SJohannes Berg 	unsigned int maxattr;
4914ad7e718cSJohannes Berg };
4915ad7e718cSJohannes Berg 
4916ad7e718cSJohannes Berg /**
4917019ae3a9SKanchanapally, Vidyullatha  * struct wiphy_iftype_ext_capab - extended capabilities per interface type
4918019ae3a9SKanchanapally, Vidyullatha  * @iftype: interface type
4919019ae3a9SKanchanapally, Vidyullatha  * @extended_capabilities: extended capabilities supported by the driver,
4920019ae3a9SKanchanapally, Vidyullatha  *	additional capabilities might be supported by userspace; these are the
4921019ae3a9SKanchanapally, Vidyullatha  *	802.11 extended capabilities ("Extended Capabilities element") and are
4922019ae3a9SKanchanapally, Vidyullatha  *	in the same format as in the information element. See IEEE Std
4923019ae3a9SKanchanapally, Vidyullatha  *	802.11-2012 8.4.2.29 for the defined fields.
4924019ae3a9SKanchanapally, Vidyullatha  * @extended_capabilities_mask: mask of the valid values
4925019ae3a9SKanchanapally, Vidyullatha  * @extended_capabilities_len: length of the extended capabilities
4926019ae3a9SKanchanapally, Vidyullatha  */
4927019ae3a9SKanchanapally, Vidyullatha struct wiphy_iftype_ext_capab {
4928019ae3a9SKanchanapally, Vidyullatha 	enum nl80211_iftype iftype;
4929019ae3a9SKanchanapally, Vidyullatha 	const u8 *extended_capabilities;
4930019ae3a9SKanchanapally, Vidyullatha 	const u8 *extended_capabilities_mask;
4931019ae3a9SKanchanapally, Vidyullatha 	u8 extended_capabilities_len;
4932019ae3a9SKanchanapally, Vidyullatha };
4933019ae3a9SKanchanapally, Vidyullatha 
4934019ae3a9SKanchanapally, Vidyullatha /**
49359bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_capabilities - cfg80211 peer measurement capabilities
49369bb7e0f2SJohannes Berg  * @max_peers: maximum number of peers in a single measurement
49379bb7e0f2SJohannes Berg  * @report_ap_tsf: can report assoc AP's TSF for radio resource measurement
49389bb7e0f2SJohannes Berg  * @randomize_mac_addr: can randomize MAC address for measurement
49399bb7e0f2SJohannes Berg  * @ftm.supported: FTM measurement is supported
49409bb7e0f2SJohannes Berg  * @ftm.asap: ASAP-mode is supported
49419bb7e0f2SJohannes Berg  * @ftm.non_asap: non-ASAP-mode is supported
49429bb7e0f2SJohannes Berg  * @ftm.request_lci: can request LCI data
49439bb7e0f2SJohannes Berg  * @ftm.request_civicloc: can request civic location data
49449bb7e0f2SJohannes Berg  * @ftm.preambles: bitmap of preambles supported (&enum nl80211_preamble)
49459bb7e0f2SJohannes Berg  * @ftm.bandwidths: bitmap of bandwidths supported (&enum nl80211_chan_width)
49469bb7e0f2SJohannes Berg  * @ftm.max_bursts_exponent: maximum burst exponent supported
49479bb7e0f2SJohannes Berg  *	(set to -1 if not limited; note that setting this will necessarily
49489bb7e0f2SJohannes Berg  *	forbid using the value 15 to let the responder pick)
49499bb7e0f2SJohannes Berg  * @ftm.max_ftms_per_burst: maximum FTMs per burst supported (set to 0 if
49509bb7e0f2SJohannes Berg  *	not limited)
4951efb5520dSAvraham Stern  * @ftm.trigger_based: trigger based ranging measurement is supported
4952efb5520dSAvraham Stern  * @ftm.non_trigger_based: non trigger based ranging measurement is supported
49539bb7e0f2SJohannes Berg  */
49549bb7e0f2SJohannes Berg struct cfg80211_pmsr_capabilities {
49559bb7e0f2SJohannes Berg 	unsigned int max_peers;
49569bb7e0f2SJohannes Berg 	u8 report_ap_tsf:1,
49579bb7e0f2SJohannes Berg 	   randomize_mac_addr:1;
49589bb7e0f2SJohannes Berg 
49599bb7e0f2SJohannes Berg 	struct {
49609bb7e0f2SJohannes Berg 		u32 preambles;
49619bb7e0f2SJohannes Berg 		u32 bandwidths;
49629bb7e0f2SJohannes Berg 		s8 max_bursts_exponent;
49639bb7e0f2SJohannes Berg 		u8 max_ftms_per_burst;
49649bb7e0f2SJohannes Berg 		u8 supported:1,
49659bb7e0f2SJohannes Berg 		   asap:1,
49669bb7e0f2SJohannes Berg 		   non_asap:1,
49679bb7e0f2SJohannes Berg 		   request_lci:1,
4968efb5520dSAvraham Stern 		   request_civicloc:1,
4969efb5520dSAvraham Stern 		   trigger_based:1,
4970efb5520dSAvraham Stern 		   non_trigger_based:1;
49719bb7e0f2SJohannes Berg 	} ftm;
49729bb7e0f2SJohannes Berg };
49739bb7e0f2SJohannes Berg 
49749bb7e0f2SJohannes Berg /**
4975d6039a34SVeerendranath Jakkam  * struct wiphy_iftype_akm_suites - This structure encapsulates supported akm
4976d6039a34SVeerendranath Jakkam  * suites for interface types defined in @iftypes_mask. Each type in the
4977d6039a34SVeerendranath Jakkam  * @iftypes_mask must be unique across all instances of iftype_akm_suites.
4978d6039a34SVeerendranath Jakkam  *
4979d6039a34SVeerendranath Jakkam  * @iftypes_mask: bitmask of interfaces types
4980d6039a34SVeerendranath Jakkam  * @akm_suites: points to an array of supported akm suites
4981d6039a34SVeerendranath Jakkam  * @n_akm_suites: number of supported AKM suites
4982d6039a34SVeerendranath Jakkam  */
4983d6039a34SVeerendranath Jakkam struct wiphy_iftype_akm_suites {
4984d6039a34SVeerendranath Jakkam 	u16 iftypes_mask;
4985d6039a34SVeerendranath Jakkam 	const u32 *akm_suites;
4986d6039a34SVeerendranath Jakkam 	int n_akm_suites;
4987d6039a34SVeerendranath Jakkam };
4988d6039a34SVeerendranath Jakkam 
4989d6039a34SVeerendranath Jakkam /**
49905be83de5SJohannes Berg  * struct wiphy - wireless hardware description
4991a05829a7SJohannes Berg  * @mtx: mutex for the data (structures) of this device
49922784fe91SLuis R. Rodriguez  * @reg_notifier: the driver's regulatory notification callback,
49932784fe91SLuis R. Rodriguez  *	note that if your driver uses wiphy_apply_custom_regulatory()
49942784fe91SLuis R. Rodriguez  *	the reg_notifier's request can be passed as NULL
4995d3236553SJohannes Berg  * @regd: the driver's regulatory domain, if one was requested via
4996d3236553SJohannes Berg  *	the regulatory_hint() API. This can be used by the driver
4997d3236553SJohannes Berg  *	on the reg_notifier() if it chooses to ignore future
4998d3236553SJohannes Berg  *	regulatory domain changes caused by other drivers.
4999d3236553SJohannes Berg  * @signal_type: signal type reported in &struct cfg80211_bss.
5000d3236553SJohannes Berg  * @cipher_suites: supported cipher suites
5001d3236553SJohannes Berg  * @n_cipher_suites: number of supported cipher suites
5002d6039a34SVeerendranath Jakkam  * @akm_suites: supported AKM suites. These are the default AKMs supported if
5003d6039a34SVeerendranath Jakkam  *	the supported AKMs not advertized for a specific interface type in
5004d6039a34SVeerendranath Jakkam  *	iftype_akm_suites.
5005ab4dfa20SVeerendranath Jakkam  * @n_akm_suites: number of supported AKM suites
5006d6039a34SVeerendranath Jakkam  * @iftype_akm_suites: array of supported akm suites info per interface type.
5007d6039a34SVeerendranath Jakkam  *	Note that the bits in @iftypes_mask inside this structure cannot
5008d6039a34SVeerendranath Jakkam  *	overlap (i.e. only one occurrence of each type is allowed across all
5009d6039a34SVeerendranath Jakkam  *	instances of iftype_akm_suites).
5010d6039a34SVeerendranath Jakkam  * @num_iftype_akm_suites: number of interface types for which supported akm
5011d6039a34SVeerendranath Jakkam  *	suites are specified separately.
5012b9a5f8caSJouni Malinen  * @retry_short: Retry limit for short frames (dot11ShortRetryLimit)
5013b9a5f8caSJouni Malinen  * @retry_long: Retry limit for long frames (dot11LongRetryLimit)
5014b9a5f8caSJouni Malinen  * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold);
5015b9a5f8caSJouni Malinen  *	-1 = fragmentation disabled, only odd values >= 256 used
5016b9a5f8caSJouni Malinen  * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled
5017abe37c4bSJohannes Berg  * @_net: the network namespace this wiphy currently lives in
5018ef15aac6SJohannes Berg  * @perm_addr: permanent MAC address of this device
5019ef15aac6SJohannes Berg  * @addr_mask: If the device supports multiple MAC addresses by masking,
5020ef15aac6SJohannes Berg  *	set this to a mask with variable bits set to 1, e.g. if the last
50210fcf8ac5SLuciano Coelho  *	four bits are variable then set it to 00-00-00-00-00-0f. The actual
5022ef15aac6SJohannes Berg  *	variable bits shall be determined by the interfaces added, with
5023ef15aac6SJohannes Berg  *	interfaces not matching the mask being rejected to be brought up.
5024ef15aac6SJohannes Berg  * @n_addresses: number of addresses in @addresses.
5025ef15aac6SJohannes Berg  * @addresses: If the device has more than one address, set this pointer
5026ef15aac6SJohannes Berg  *	to a list of addresses (6 bytes each). The first one will be used
5027ef15aac6SJohannes Berg  *	by default for perm_addr. In this case, the mask should be set to
5028ef15aac6SJohannes Berg  *	all-zeroes. In this case it is assumed that the device can handle
5029ef15aac6SJohannes Berg  *	the same number of arbitrary MAC addresses.
5030fd235913SRandy Dunlap  * @registered: protects ->resume and ->suspend sysfs callbacks against
5031fd235913SRandy Dunlap  *	unregister hardware
5032edf77192SJérôme Pouiller  * @debugfsdir: debugfs directory used for this wiphy (ieee80211/<wiphyname>).
5033edf77192SJérôme Pouiller  *	It will be renamed automatically on wiphy renames
503415bc6dfbSJérôme Pouiller  * @dev: (virtual) struct device for this wiphy. The item in
503515bc6dfbSJérôme Pouiller  *	/sys/class/ieee80211/ points to this. You need use set_wiphy_dev()
503615bc6dfbSJérôme Pouiller  *	(see below).
5037abe37c4bSJohannes Berg  * @wext: wireless extension handlers
5038abe37c4bSJohannes Berg  * @priv: driver private data (sized according to wiphy_new() parameter)
5039abe37c4bSJohannes Berg  * @interface_modes: bitmask of interfaces types valid for this wiphy,
5040abe37c4bSJohannes Berg  *	must be set by driver
50417527a782SJohannes Berg  * @iface_combinations: Valid interface combinations array, should not
50427527a782SJohannes Berg  *	list single interface types.
50437527a782SJohannes Berg  * @n_iface_combinations: number of entries in @iface_combinations array.
50447527a782SJohannes Berg  * @software_iftypes: bitmask of software interface types, these are not
50457527a782SJohannes Berg  *	subject to any restrictions since they are purely managed in SW.
5046abe37c4bSJohannes Berg  * @flags: wiphy flags, see &enum wiphy_flags
5047a2f73b6cSLuis R. Rodriguez  * @regulatory_flags: wiphy regulatory flags, see
5048a2f73b6cSLuis R. Rodriguez  *	&enum ieee80211_regulatory_flags
50491f074bd8SJohannes Berg  * @features: features advertised to nl80211, see &enum nl80211_feature_flags.
5050d75bb06bSGautam Kumar Shukla  * @ext_features: extended features advertised to nl80211, see
5051d75bb06bSGautam Kumar Shukla  *	&enum nl80211_ext_feature_index.
5052abe37c4bSJohannes Berg  * @bss_priv_size: each BSS struct has private data allocated with it,
5053abe37c4bSJohannes Berg  *	this variable determines its size
5054abe37c4bSJohannes Berg  * @max_scan_ssids: maximum number of SSIDs the device can scan for in
5055abe37c4bSJohannes Berg  *	any given scan
5056ca986ad9SArend Van Spriel  * @max_sched_scan_reqs: maximum number of scheduled scan requests that
5057ca986ad9SArend Van Spriel  *	the device can run concurrently.
505893b6aa69SLuciano Coelho  * @max_sched_scan_ssids: maximum number of SSIDs the device can scan
505993b6aa69SLuciano Coelho  *	for in any given scheduled scan
5060a1f1c21cSLuciano Coelho  * @max_match_sets: maximum number of match sets the device can handle
5061a1f1c21cSLuciano Coelho  *	when performing a scheduled scan, 0 if filtering is not
5062a1f1c21cSLuciano Coelho  *	supported.
5063abe37c4bSJohannes Berg  * @max_scan_ie_len: maximum length of user-controlled IEs device can
5064abe37c4bSJohannes Berg  *	add to probe request frames transmitted during a scan, must not
5065abe37c4bSJohannes Berg  *	include fixed IEs like supported rates
50665a865badSLuciano Coelho  * @max_sched_scan_ie_len: same as max_scan_ie_len, but for scheduled
50675a865badSLuciano Coelho  *	scans
50683b06d277SAvraham Stern  * @max_sched_scan_plans: maximum number of scan plans (scan interval and number
50693b06d277SAvraham Stern  *	of iterations) for scheduled scan supported by the device.
50703b06d277SAvraham Stern  * @max_sched_scan_plan_interval: maximum interval (in seconds) for a
50713b06d277SAvraham Stern  *	single scan plan supported by the device.
50723b06d277SAvraham Stern  * @max_sched_scan_plan_iterations: maximum number of iterations for a single
50733b06d277SAvraham Stern  *	scan plan supported by the device.
5074abe37c4bSJohannes Berg  * @coverage_class: current coverage class
5075abe37c4bSJohannes Berg  * @fw_version: firmware version for ethtool reporting
5076abe37c4bSJohannes Berg  * @hw_version: hardware version for ethtool reporting
5077abe37c4bSJohannes Berg  * @max_num_pmkids: maximum number of PMKIDs supported by device
5078abe37c4bSJohannes Berg  * @privid: a pointer that drivers can use to identify if an arbitrary
5079abe37c4bSJohannes Berg  *	wiphy is theirs, e.g. in global notifiers
5080abe37c4bSJohannes Berg  * @bands: information about bands/channels supported by this device
50812e161f78SJohannes Berg  *
50822e161f78SJohannes Berg  * @mgmt_stypes: bitmasks of frame subtypes that can be subscribed to or
50832e161f78SJohannes Berg  *	transmitted through nl80211, points to an array indexed by interface
50842e161f78SJohannes Berg  *	type
5085a7ffac95SBruno Randolf  *
50867f531e03SBruno Randolf  * @available_antennas_tx: bitmap of antennas which are available to be
50877f531e03SBruno Randolf  *	configured as TX antennas. Antenna configuration commands will be
50887f531e03SBruno Randolf  *	rejected unless this or @available_antennas_rx is set.
50897f531e03SBruno Randolf  *
50907f531e03SBruno Randolf  * @available_antennas_rx: bitmap of antennas which are available to be
50917f531e03SBruno Randolf  *	configured as RX antennas. Antenna configuration commands will be
50927f531e03SBruno Randolf  *	rejected unless this or @available_antennas_tx is set.
5093a293911dSJohannes Berg  *
509415f0ebc2SRandy Dunlap  * @probe_resp_offload:
509515f0ebc2SRandy Dunlap  *	 Bitmap of supported protocols for probe response offloading.
509615f0ebc2SRandy Dunlap  *	 See &enum nl80211_probe_resp_offload_support_attr. Only valid
509715f0ebc2SRandy Dunlap  *	 when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set.
509815f0ebc2SRandy Dunlap  *
5099a293911dSJohannes Berg  * @max_remain_on_channel_duration: Maximum time a remain-on-channel operation
5100a293911dSJohannes Berg  *	may request, if implemented.
5101ff1b6e69SJohannes Berg  *
5102ff1b6e69SJohannes Berg  * @wowlan: WoWLAN support information
51036abb9cb9SJohannes Berg  * @wowlan_config: current WoWLAN configuration; this should usually not be
51046abb9cb9SJohannes Berg  *	used since access to it is necessarily racy, use the parameter passed
51056abb9cb9SJohannes Berg  *	to the suspend() operation instead.
5106562a7480SJohannes Berg  *
5107562a7480SJohannes Berg  * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features.
51087e7c8926SBen Greear  * @ht_capa_mod_mask:  Specify what ht_cap values can be over-ridden.
51097e7c8926SBen Greear  *	If null, then none can be over-ridden.
5110ee2aca34SJohannes Berg  * @vht_capa_mod_mask:  Specify what VHT capabilities can be over-ridden.
5111ee2aca34SJohannes Berg  *	If null, then none can be over-ridden.
511277765eafSVasanthakumar Thiagarajan  *
511353873f13SJohannes Berg  * @wdev_list: the list of associated (virtual) interfaces; this list must
511453873f13SJohannes Berg  *	not be modified by the driver, but can be read with RTNL/RCU protection.
511553873f13SJohannes Berg  *
511677765eafSVasanthakumar Thiagarajan  * @max_acl_mac_addrs: Maximum number of MAC addresses that the device
511777765eafSVasanthakumar Thiagarajan  *	supports for ACL.
5118a50df0c4SJohannes Berg  *
5119a50df0c4SJohannes Berg  * @extended_capabilities: extended capabilities supported by the driver,
5120a50df0c4SJohannes Berg  *	additional capabilities might be supported by userspace; these are
5121a50df0c4SJohannes Berg  *	the 802.11 extended capabilities ("Extended Capabilities element")
5122a50df0c4SJohannes Berg  *	and are in the same format as in the information element. See
5123019ae3a9SKanchanapally, Vidyullatha  *	802.11-2012 8.4.2.29 for the defined fields. These are the default
5124019ae3a9SKanchanapally, Vidyullatha  *	extended capabilities to be used if the capabilities are not specified
5125019ae3a9SKanchanapally, Vidyullatha  *	for a specific interface type in iftype_ext_capab.
5126a50df0c4SJohannes Berg  * @extended_capabilities_mask: mask of the valid values
5127a50df0c4SJohannes Berg  * @extended_capabilities_len: length of the extended capabilities
5128019ae3a9SKanchanapally, Vidyullatha  * @iftype_ext_capab: array of extended capabilities per interface type
5129019ae3a9SKanchanapally, Vidyullatha  * @num_iftype_ext_capab: number of interface types for which extended
5130019ae3a9SKanchanapally, Vidyullatha  *	capabilities are specified separately.
5131be29b99aSAmitkumar Karwar  * @coalesce: packet coalescing support information
5132ad7e718cSJohannes Berg  *
5133ad7e718cSJohannes Berg  * @vendor_commands: array of vendor commands supported by the hardware
5134ad7e718cSJohannes Berg  * @n_vendor_commands: number of vendor commands
5135567ffc35SJohannes Berg  * @vendor_events: array of vendor events supported by the hardware
5136567ffc35SJohannes Berg  * @n_vendor_events: number of vendor events
5137b43504cfSJouni Malinen  *
5138b43504cfSJouni Malinen  * @max_ap_assoc_sta: maximum number of associated stations supported in AP mode
5139b43504cfSJouni Malinen  *	(including P2P GO) or 0 to indicate no such limit is advertised. The
5140b43504cfSJouni Malinen  *	driver is allowed to advertise a theoretical limit that it can reach in
5141b43504cfSJouni Malinen  *	some cases, but may not always reach.
5142c2e4323bSLuciano Coelho  *
5143c2e4323bSLuciano Coelho  * @max_num_csa_counters: Number of supported csa_counters in beacons
5144c2e4323bSLuciano Coelho  *	and probe responses.  This value should be set if the driver
5145c2e4323bSLuciano Coelho  *	wishes to limit the number of csa counters. Default (0) means
5146c2e4323bSLuciano Coelho  *	infinite.
514738de03d2SArend van Spriel  * @bss_select_support: bitmask indicating the BSS selection criteria supported
514838de03d2SArend van Spriel  *	by the driver in the .connect() callback. The bit position maps to the
514938de03d2SArend van Spriel  *	attribute indices defined in &enum nl80211_bss_select_attr.
5150a442b761SAyala Beker  *
51518585989dSLuca Coelho  * @nan_supported_bands: bands supported by the device in NAN mode, a
51528585989dSLuca Coelho  *	bitmap of &enum nl80211_band values.  For instance, for
51538585989dSLuca Coelho  *	NL80211_BAND_2GHZ, bit 0 would be set
51548585989dSLuca Coelho  *	(i.e. BIT(NL80211_BAND_2GHZ)).
5155f3a7ca64SJohannes Berg  *
5156f3a7ca64SJohannes Berg  * @txq_limit: configuration of internal TX queue frame limit
5157f3a7ca64SJohannes Berg  * @txq_memory_limit: configuration internal TX queue memory limit
5158f3a7ca64SJohannes Berg  * @txq_quantum: configuration of internal TX queue scheduler quantum
51599bb7e0f2SJohannes Berg  *
5160a710d214SLothar Rubusch  * @tx_queue_len: allow setting transmit queue len for drivers not using
5161a710d214SLothar Rubusch  *	wake_tx_queue
5162a710d214SLothar Rubusch  *
5163213ed579SSara Sharon  * @support_mbssid: can HW support association with nontransmitted AP
5164213ed579SSara Sharon  * @support_only_he_mbssid: don't parse MBSSID elements if it is not
5165213ed579SSara Sharon  *	HE AP, in order to avoid compatibility issues.
5166213ed579SSara Sharon  *	@support_mbssid must be set for this to have any effect.
5167213ed579SSara Sharon  *
51689bb7e0f2SJohannes Berg  * @pmsr_capa: peer measurement capabilities
51693710a8a6SJohannes Berg  *
51703710a8a6SJohannes Berg  * @tid_config_support: describes the per-TID config support that the
51713710a8a6SJohannes Berg  *	device has
51723710a8a6SJohannes Berg  * @tid_config_support.vif: bitmap of attributes (configurations)
51733710a8a6SJohannes Berg  *	supported by the driver for each vif
51743710a8a6SJohannes Berg  * @tid_config_support.peer: bitmap of attributes (configurations)
51753710a8a6SJohannes Berg  *	supported by the driver for each peer
51766a21d16cSTamizh chelvam  * @tid_config_support.max_retry: maximum supported retry count for
51776a21d16cSTamizh chelvam  *	long/short retry configuration
5178a710d214SLothar Rubusch  *
5179a710d214SLothar Rubusch  * @max_data_retry_count: maximum supported per TID retry count for
5180a710d214SLothar Rubusch  *	configuration through the %NL80211_TID_CONFIG_ATTR_RETRY_SHORT and
5181a710d214SLothar Rubusch  *	%NL80211_TID_CONFIG_ATTR_RETRY_LONG attributes
518270b6ff35SJohannes Berg  * @sar_capa: SAR control capabilities
5183358ae888SEmmanuel Grumbach  * @rfkill: a pointer to the rfkill structure
5184dc1e3cb8SJohn Crispin  *
5185dc1e3cb8SJohn Crispin  * @mbssid_max_interfaces: maximum number of interfaces supported by the driver
5186dc1e3cb8SJohn Crispin  *	in a multiple BSSID set. This field must be set to a non-zero value
5187dc1e3cb8SJohn Crispin  *	by the driver to advertise MBSSID support.
5188f9d366d4SJohannes Berg  * @ema_max_profile_periodicity: maximum profile periodicity supported by
5189dc1e3cb8SJohn Crispin  *	the driver. Setting this field to a non-zero value indicates that the
5190dc1e3cb8SJohn Crispin  *	driver supports enhanced multi-BSSID advertisements (EMA AP).
5191d3236553SJohannes Berg  */
5192d3236553SJohannes Berg struct wiphy {
5193a05829a7SJohannes Berg 	struct mutex mtx;
5194a05829a7SJohannes Berg 
5195d3236553SJohannes Berg 	/* assign these fields before you register the wiphy */
5196d3236553SJohannes Berg 
5197d3236553SJohannes Berg 	u8 perm_addr[ETH_ALEN];
5198ef15aac6SJohannes Berg 	u8 addr_mask[ETH_ALEN];
5199ef15aac6SJohannes Berg 
5200ef15aac6SJohannes Berg 	struct mac_address *addresses;
5201d3236553SJohannes Berg 
52022e161f78SJohannes Berg 	const struct ieee80211_txrx_stypes *mgmt_stypes;
52032e161f78SJohannes Berg 
52047527a782SJohannes Berg 	const struct ieee80211_iface_combination *iface_combinations;
52057527a782SJohannes Berg 	int n_iface_combinations;
52067527a782SJohannes Berg 	u16 software_iftypes;
52077527a782SJohannes Berg 
52082e161f78SJohannes Berg 	u16 n_addresses;
52092e161f78SJohannes Berg 
5210d3236553SJohannes Berg 	/* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
5211d3236553SJohannes Berg 	u16 interface_modes;
5212d3236553SJohannes Berg 
521377765eafSVasanthakumar Thiagarajan 	u16 max_acl_mac_addrs;
521477765eafSVasanthakumar Thiagarajan 
5215a2f73b6cSLuis R. Rodriguez 	u32 flags, regulatory_flags, features;
5216d75bb06bSGautam Kumar Shukla 	u8 ext_features[DIV_ROUND_UP(NUM_NL80211_EXT_FEATURES, 8)];
5217463d0183SJohannes Berg 
5218562a7480SJohannes Berg 	u32 ap_sme_capa;
5219562a7480SJohannes Berg 
5220d3236553SJohannes Berg 	enum cfg80211_signal_type signal_type;
5221d3236553SJohannes Berg 
5222d3236553SJohannes Berg 	int bss_priv_size;
5223d3236553SJohannes Berg 	u8 max_scan_ssids;
5224ca986ad9SArend Van Spriel 	u8 max_sched_scan_reqs;
522593b6aa69SLuciano Coelho 	u8 max_sched_scan_ssids;
5226a1f1c21cSLuciano Coelho 	u8 max_match_sets;
5227d3236553SJohannes Berg 	u16 max_scan_ie_len;
52285a865badSLuciano Coelho 	u16 max_sched_scan_ie_len;
52293b06d277SAvraham Stern 	u32 max_sched_scan_plans;
52303b06d277SAvraham Stern 	u32 max_sched_scan_plan_interval;
52313b06d277SAvraham Stern 	u32 max_sched_scan_plan_iterations;
5232d3236553SJohannes Berg 
5233d3236553SJohannes Berg 	int n_cipher_suites;
5234d3236553SJohannes Berg 	const u32 *cipher_suites;
5235d3236553SJohannes Berg 
5236ab4dfa20SVeerendranath Jakkam 	int n_akm_suites;
5237ab4dfa20SVeerendranath Jakkam 	const u32 *akm_suites;
5238ab4dfa20SVeerendranath Jakkam 
5239d6039a34SVeerendranath Jakkam 	const struct wiphy_iftype_akm_suites *iftype_akm_suites;
5240d6039a34SVeerendranath Jakkam 	unsigned int num_iftype_akm_suites;
5241d6039a34SVeerendranath Jakkam 
5242b9a5f8caSJouni Malinen 	u8 retry_short;
5243b9a5f8caSJouni Malinen 	u8 retry_long;
5244b9a5f8caSJouni Malinen 	u32 frag_threshold;
5245b9a5f8caSJouni Malinen 	u32 rts_threshold;
524681077e82SLukáš Turek 	u8 coverage_class;
5247b9a5f8caSJouni Malinen 
524881135548SJiri Pirko 	char fw_version[ETHTOOL_FWVERS_LEN];
5249dfce95f5SKalle Valo 	u32 hw_version;
5250dfce95f5SKalle Valo 
5251dfb89c56SJohannes Berg #ifdef CONFIG_PM
5252964dc9e2SJohannes Berg 	const struct wiphy_wowlan_support *wowlan;
52536abb9cb9SJohannes Berg 	struct cfg80211_wowlan *wowlan_config;
5254dfb89c56SJohannes Berg #endif
5255ff1b6e69SJohannes Berg 
5256a293911dSJohannes Berg 	u16 max_remain_on_channel_duration;
5257a293911dSJohannes Berg 
525867fbb16bSSamuel Ortiz 	u8 max_num_pmkids;
525967fbb16bSSamuel Ortiz 
52607f531e03SBruno Randolf 	u32 available_antennas_tx;
52617f531e03SBruno Randolf 	u32 available_antennas_rx;
5262a7ffac95SBruno Randolf 
526387bbbe22SArik Nemtsov 	u32 probe_resp_offload;
526487bbbe22SArik Nemtsov 
5265a50df0c4SJohannes Berg 	const u8 *extended_capabilities, *extended_capabilities_mask;
5266a50df0c4SJohannes Berg 	u8 extended_capabilities_len;
5267a50df0c4SJohannes Berg 
5268019ae3a9SKanchanapally, Vidyullatha 	const struct wiphy_iftype_ext_capab *iftype_ext_capab;
5269019ae3a9SKanchanapally, Vidyullatha 	unsigned int num_iftype_ext_capab;
5270019ae3a9SKanchanapally, Vidyullatha 
5271cf5aa2f1SDavid Kilroy 	const void *privid;
5272d3236553SJohannes Berg 
527357fbcce3SJohannes Berg 	struct ieee80211_supported_band *bands[NUM_NL80211_BANDS];
5274d3236553SJohannes Berg 
52750c0280bdSLuis R. Rodriguez 	void (*reg_notifier)(struct wiphy *wiphy,
5276d3236553SJohannes Berg 			     struct regulatory_request *request);
5277d3236553SJohannes Berg 
5278d3236553SJohannes Berg 	/* fields below are read-only, assigned by cfg80211 */
5279d3236553SJohannes Berg 
5280458f4f9eSJohannes Berg 	const struct ieee80211_regdomain __rcu *regd;
5281d3236553SJohannes Berg 
5282d3236553SJohannes Berg 	struct device dev;
5283d3236553SJohannes Berg 
5284ecb44335SStanislaw Gruszka 	bool registered;
5285ecb44335SStanislaw Gruszka 
5286d3236553SJohannes Berg 	struct dentry *debugfsdir;
5287d3236553SJohannes Berg 
52887e7c8926SBen Greear 	const struct ieee80211_ht_cap *ht_capa_mod_mask;
5289ee2aca34SJohannes Berg 	const struct ieee80211_vht_cap *vht_capa_mod_mask;
52907e7c8926SBen Greear 
529153873f13SJohannes Berg 	struct list_head wdev_list;
529253873f13SJohannes Berg 
52930c5c9fb5SEric W. Biederman 	possible_net_t _net;
5294463d0183SJohannes Berg 
52953d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT
52963d23e349SJohannes Berg 	const struct iw_handler_def *wext;
52973d23e349SJohannes Berg #endif
52983d23e349SJohannes Berg 
5299be29b99aSAmitkumar Karwar 	const struct wiphy_coalesce_support *coalesce;
5300be29b99aSAmitkumar Karwar 
5301ad7e718cSJohannes Berg 	const struct wiphy_vendor_command *vendor_commands;
5302567ffc35SJohannes Berg 	const struct nl80211_vendor_cmd_info *vendor_events;
5303567ffc35SJohannes Berg 	int n_vendor_commands, n_vendor_events;
5304ad7e718cSJohannes Berg 
5305b43504cfSJouni Malinen 	u16 max_ap_assoc_sta;
5306b43504cfSJouni Malinen 
53079a774c78SAndrei Otcheretianski 	u8 max_num_csa_counters;
53089a774c78SAndrei Otcheretianski 
530938de03d2SArend van Spriel 	u32 bss_select_support;
531038de03d2SArend van Spriel 
53118585989dSLuca Coelho 	u8 nan_supported_bands;
53128585989dSLuca Coelho 
531352539ca8SToke Høiland-Jørgensen 	u32 txq_limit;
531452539ca8SToke Høiland-Jørgensen 	u32 txq_memory_limit;
531552539ca8SToke Høiland-Jørgensen 	u32 txq_quantum;
531652539ca8SToke Høiland-Jørgensen 
53171f6e0baaSJohn Crispin 	unsigned long tx_queue_len;
53181f6e0baaSJohn Crispin 
5319213ed579SSara Sharon 	u8 support_mbssid:1,
5320213ed579SSara Sharon 	   support_only_he_mbssid:1;
5321213ed579SSara Sharon 
53229bb7e0f2SJohannes Berg 	const struct cfg80211_pmsr_capabilities *pmsr_capa;
53239bb7e0f2SJohannes Berg 
53243710a8a6SJohannes Berg 	struct {
53253710a8a6SJohannes Berg 		u64 peer, vif;
53266a21d16cSTamizh chelvam 		u8 max_retry;
53273710a8a6SJohannes Berg 	} tid_config_support;
53283710a8a6SJohannes Berg 
53296a21d16cSTamizh chelvam 	u8 max_data_retry_count;
53306a21d16cSTamizh chelvam 
53316bdb68ceSCarl Huang 	const struct cfg80211_sar_capa *sar_capa;
53326bdb68ceSCarl Huang 
5333358ae888SEmmanuel Grumbach 	struct rfkill *rfkill;
5334358ae888SEmmanuel Grumbach 
5335dc1e3cb8SJohn Crispin 	u8 mbssid_max_interfaces;
5336dc1e3cb8SJohn Crispin 	u8 ema_max_profile_periodicity;
5337dc1e3cb8SJohn Crispin 
5338396fba0aSGustavo A. R. Silva 	char priv[] __aligned(NETDEV_ALIGN);
5339d3236553SJohannes Berg };
5340d3236553SJohannes Berg 
5341463d0183SJohannes Berg static inline struct net *wiphy_net(struct wiphy *wiphy)
5342463d0183SJohannes Berg {
5343c2d9ba9bSEric Dumazet 	return read_pnet(&wiphy->_net);
5344463d0183SJohannes Berg }
5345463d0183SJohannes Berg 
5346463d0183SJohannes Berg static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net)
5347463d0183SJohannes Berg {
5348c2d9ba9bSEric Dumazet 	write_pnet(&wiphy->_net, net);
5349463d0183SJohannes Berg }
5350463d0183SJohannes Berg 
5351d3236553SJohannes Berg /**
5352d3236553SJohannes Berg  * wiphy_priv - return priv from wiphy
5353d3236553SJohannes Berg  *
5354d3236553SJohannes Berg  * @wiphy: the wiphy whose priv pointer to return
53550ae997dcSYacine Belkadi  * Return: The priv of @wiphy.
5356d3236553SJohannes Berg  */
5357d3236553SJohannes Berg static inline void *wiphy_priv(struct wiphy *wiphy)
5358d3236553SJohannes Berg {
5359d3236553SJohannes Berg 	BUG_ON(!wiphy);
5360d3236553SJohannes Berg 	return &wiphy->priv;
5361d3236553SJohannes Berg }
5362d3236553SJohannes Berg 
5363d3236553SJohannes Berg /**
5364f1f74825SDavid Kilroy  * priv_to_wiphy - return the wiphy containing the priv
5365f1f74825SDavid Kilroy  *
5366f1f74825SDavid Kilroy  * @priv: a pointer previously returned by wiphy_priv
53670ae997dcSYacine Belkadi  * Return: The wiphy of @priv.
5368f1f74825SDavid Kilroy  */
5369f1f74825SDavid Kilroy static inline struct wiphy *priv_to_wiphy(void *priv)
5370f1f74825SDavid Kilroy {
5371f1f74825SDavid Kilroy 	BUG_ON(!priv);
5372f1f74825SDavid Kilroy 	return container_of(priv, struct wiphy, priv);
5373f1f74825SDavid Kilroy }
5374f1f74825SDavid Kilroy 
5375f1f74825SDavid Kilroy /**
5376d3236553SJohannes Berg  * set_wiphy_dev - set device pointer for wiphy
5377d3236553SJohannes Berg  *
5378d3236553SJohannes Berg  * @wiphy: The wiphy whose device to bind
5379d3236553SJohannes Berg  * @dev: The device to parent it to
5380d3236553SJohannes Berg  */
5381d3236553SJohannes Berg static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev)
5382d3236553SJohannes Berg {
5383d3236553SJohannes Berg 	wiphy->dev.parent = dev;
5384d3236553SJohannes Berg }
5385d3236553SJohannes Berg 
5386d3236553SJohannes Berg /**
5387d3236553SJohannes Berg  * wiphy_dev - get wiphy dev pointer
5388d3236553SJohannes Berg  *
5389d3236553SJohannes Berg  * @wiphy: The wiphy whose device struct to look up
53900ae997dcSYacine Belkadi  * Return: The dev of @wiphy.
5391d3236553SJohannes Berg  */
5392d3236553SJohannes Berg static inline struct device *wiphy_dev(struct wiphy *wiphy)
5393d3236553SJohannes Berg {
5394d3236553SJohannes Berg 	return wiphy->dev.parent;
5395d3236553SJohannes Berg }
5396d3236553SJohannes Berg 
5397d3236553SJohannes Berg /**
5398d3236553SJohannes Berg  * wiphy_name - get wiphy name
5399d3236553SJohannes Berg  *
5400d3236553SJohannes Berg  * @wiphy: The wiphy whose name to return
54010ae997dcSYacine Belkadi  * Return: The name of @wiphy.
5402d3236553SJohannes Berg  */
5403e1db74fcSJoe Perches static inline const char *wiphy_name(const struct wiphy *wiphy)
5404d3236553SJohannes Berg {
5405d3236553SJohannes Berg 	return dev_name(&wiphy->dev);
5406d3236553SJohannes Berg }
5407d3236553SJohannes Berg 
5408d3236553SJohannes Berg /**
54091998d90aSBen Greear  * wiphy_new_nm - create a new wiphy for use with cfg80211
54101998d90aSBen Greear  *
54111998d90aSBen Greear  * @ops: The configuration operations for this device
54121998d90aSBen Greear  * @sizeof_priv: The size of the private area to allocate
54131998d90aSBen Greear  * @requested_name: Request a particular name.
54141998d90aSBen Greear  *	NULL is valid value, and means use the default phy%d naming.
54151998d90aSBen Greear  *
54161998d90aSBen Greear  * Create a new wiphy and associate the given operations with it.
54171998d90aSBen Greear  * @sizeof_priv bytes are allocated for private use.
54181998d90aSBen Greear  *
54191998d90aSBen Greear  * Return: A pointer to the new wiphy. This pointer must be
54201998d90aSBen Greear  * assigned to each netdev's ieee80211_ptr for proper operation.
54211998d90aSBen Greear  */
54221998d90aSBen Greear struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv,
54231998d90aSBen Greear 			   const char *requested_name);
54241998d90aSBen Greear 
54251998d90aSBen Greear /**
5426d3236553SJohannes Berg  * wiphy_new - create a new wiphy for use with cfg80211
5427d3236553SJohannes Berg  *
5428d3236553SJohannes Berg  * @ops: The configuration operations for this device
5429d3236553SJohannes Berg  * @sizeof_priv: The size of the private area to allocate
5430d3236553SJohannes Berg  *
5431d3236553SJohannes Berg  * Create a new wiphy and associate the given operations with it.
5432d3236553SJohannes Berg  * @sizeof_priv bytes are allocated for private use.
5433d3236553SJohannes Berg  *
54340ae997dcSYacine Belkadi  * Return: A pointer to the new wiphy. This pointer must be
54350ae997dcSYacine Belkadi  * assigned to each netdev's ieee80211_ptr for proper operation.
5436d3236553SJohannes Berg  */
54371998d90aSBen Greear static inline struct wiphy *wiphy_new(const struct cfg80211_ops *ops,
54381998d90aSBen Greear 				      int sizeof_priv)
54391998d90aSBen Greear {
54401998d90aSBen Greear 	return wiphy_new_nm(ops, sizeof_priv, NULL);
54411998d90aSBen Greear }
5442d3236553SJohannes Berg 
5443d3236553SJohannes Berg /**
5444d3236553SJohannes Berg  * wiphy_register - register a wiphy with cfg80211
5445d3236553SJohannes Berg  *
5446d3236553SJohannes Berg  * @wiphy: The wiphy to register.
5447d3236553SJohannes Berg  *
54480ae997dcSYacine Belkadi  * Return: A non-negative wiphy index or a negative error code.
5449d3236553SJohannes Berg  */
545010dd9b7cSJoe Perches int wiphy_register(struct wiphy *wiphy);
5451d3236553SJohannes Berg 
5452a05829a7SJohannes Berg /* this is a define for better error reporting (file/line) */
5453a05829a7SJohannes Berg #define lockdep_assert_wiphy(wiphy) lockdep_assert_held(&(wiphy)->mtx)
5454a05829a7SJohannes Berg 
5455a05829a7SJohannes Berg /**
5456a05829a7SJohannes Berg  * rcu_dereference_wiphy - rcu_dereference with debug checking
5457a05829a7SJohannes Berg  * @wiphy: the wiphy to check the locking on
5458a05829a7SJohannes Berg  * @p: The pointer to read, prior to dereferencing
5459a05829a7SJohannes Berg  *
5460a05829a7SJohannes Berg  * Do an rcu_dereference(p), but check caller either holds rcu_read_lock()
5461a05829a7SJohannes Berg  * or RTNL. Note: Please prefer wiphy_dereference() or rcu_dereference().
5462a05829a7SJohannes Berg  */
5463a05829a7SJohannes Berg #define rcu_dereference_wiphy(wiphy, p)				\
5464a05829a7SJohannes Berg         rcu_dereference_check(p, lockdep_is_held(&wiphy->mtx))
5465a05829a7SJohannes Berg 
5466a05829a7SJohannes Berg /**
5467a05829a7SJohannes Berg  * wiphy_dereference - fetch RCU pointer when updates are prevented by wiphy mtx
5468a05829a7SJohannes Berg  * @wiphy: the wiphy to check the locking on
5469a05829a7SJohannes Berg  * @p: The pointer to read, prior to dereferencing
5470a05829a7SJohannes Berg  *
5471a05829a7SJohannes Berg  * Return the value of the specified RCU-protected pointer, but omit the
5472a05829a7SJohannes Berg  * READ_ONCE(), because caller holds the wiphy mutex used for updates.
5473a05829a7SJohannes Berg  */
5474a05829a7SJohannes Berg #define wiphy_dereference(wiphy, p)				\
5475a05829a7SJohannes Berg         rcu_dereference_protected(p, lockdep_is_held(&wiphy->mtx))
5476a05829a7SJohannes Berg 
5477a05829a7SJohannes Berg /**
5478a05829a7SJohannes Berg  * get_wiphy_regdom - get custom regdomain for the given wiphy
5479a05829a7SJohannes Berg  * @wiphy: the wiphy to get the regdomain from
5480a05829a7SJohannes Berg  */
5481a05829a7SJohannes Berg const struct ieee80211_regdomain *get_wiphy_regdom(struct wiphy *wiphy);
5482a05829a7SJohannes Berg 
5483d3236553SJohannes Berg /**
5484d3236553SJohannes Berg  * wiphy_unregister - deregister a wiphy from cfg80211
5485d3236553SJohannes Berg  *
5486d3236553SJohannes Berg  * @wiphy: The wiphy to unregister.
5487d3236553SJohannes Berg  *
5488d3236553SJohannes Berg  * After this call, no more requests can be made with this priv
5489d3236553SJohannes Berg  * pointer, but the call may sleep to wait for an outstanding
5490d3236553SJohannes Berg  * request that is being handled.
5491d3236553SJohannes Berg  */
549210dd9b7cSJoe Perches void wiphy_unregister(struct wiphy *wiphy);
5493d3236553SJohannes Berg 
5494d3236553SJohannes Berg /**
5495d3236553SJohannes Berg  * wiphy_free - free wiphy
5496d3236553SJohannes Berg  *
5497d3236553SJohannes Berg  * @wiphy: The wiphy to free
5498d3236553SJohannes Berg  */
549910dd9b7cSJoe Perches void wiphy_free(struct wiphy *wiphy);
5500d3236553SJohannes Berg 
5501fffd0934SJohannes Berg /* internal structs */
55026829c878SJohannes Berg struct cfg80211_conn;
550319957bb3SJohannes Berg struct cfg80211_internal_bss;
5504fffd0934SJohannes Berg struct cfg80211_cached_keys;
55054a4b8169SAndrew Zaborowski struct cfg80211_cqm_config;
550619957bb3SJohannes Berg 
5507d3236553SJohannes Berg /**
5508a05829a7SJohannes Berg  * wiphy_lock - lock the wiphy
5509a05829a7SJohannes Berg  * @wiphy: the wiphy to lock
5510a05829a7SJohannes Berg  *
5511a05829a7SJohannes Berg  * This is mostly exposed so it can be done around registering and
5512a05829a7SJohannes Berg  * unregistering netdevs that aren't created through cfg80211 calls,
5513a05829a7SJohannes Berg  * since that requires locking in cfg80211 when the notifiers is
5514a05829a7SJohannes Berg  * called, but that cannot differentiate which way it's called.
5515a05829a7SJohannes Berg  *
5516a05829a7SJohannes Berg  * When cfg80211 ops are called, the wiphy is already locked.
5517a05829a7SJohannes Berg  */
5518a05829a7SJohannes Berg static inline void wiphy_lock(struct wiphy *wiphy)
5519a05829a7SJohannes Berg 	__acquires(&wiphy->mtx)
5520a05829a7SJohannes Berg {
5521a05829a7SJohannes Berg 	mutex_lock(&wiphy->mtx);
5522a05829a7SJohannes Berg 	__acquire(&wiphy->mtx);
5523a05829a7SJohannes Berg }
5524a05829a7SJohannes Berg 
5525a05829a7SJohannes Berg /**
5526a05829a7SJohannes Berg  * wiphy_unlock - unlock the wiphy again
5527a05829a7SJohannes Berg  * @wiphy: the wiphy to unlock
5528a05829a7SJohannes Berg  */
5529a05829a7SJohannes Berg static inline void wiphy_unlock(struct wiphy *wiphy)
5530a05829a7SJohannes Berg 	__releases(&wiphy->mtx)
5531a05829a7SJohannes Berg {
5532a05829a7SJohannes Berg 	__release(&wiphy->mtx);
5533a05829a7SJohannes Berg 	mutex_unlock(&wiphy->mtx);
5534a05829a7SJohannes Berg }
5535a05829a7SJohannes Berg 
5536a05829a7SJohannes Berg /**
553789a54e48SJohannes Berg  * struct wireless_dev - wireless device state
5538d3236553SJohannes Berg  *
553989a54e48SJohannes Berg  * For netdevs, this structure must be allocated by the driver
554089a54e48SJohannes Berg  * that uses the ieee80211_ptr field in struct net_device (this
554189a54e48SJohannes Berg  * is intentional so it can be allocated along with the netdev.)
554289a54e48SJohannes Berg  * It need not be registered then as netdev registration will
5543a05829a7SJohannes Berg  * be intercepted by cfg80211 to see the new wireless device,
5544a05829a7SJohannes Berg  * however, drivers must lock the wiphy before registering or
5545a05829a7SJohannes Berg  * unregistering netdevs if they pre-create any netdevs (in ops
5546a05829a7SJohannes Berg  * called from cfg80211, the wiphy is already locked.)
554789a54e48SJohannes Berg  *
554889a54e48SJohannes Berg  * For non-netdev uses, it must also be allocated by the driver
554989a54e48SJohannes Berg  * in response to the cfg80211 callbacks that require it, as
555089a54e48SJohannes Berg  * there's no netdev registration in that case it may not be
555189a54e48SJohannes Berg  * allocated outside of callback operations that return it.
5552d3236553SJohannes Berg  *
5553d3236553SJohannes Berg  * @wiphy: pointer to hardware description
5554d3236553SJohannes Berg  * @iftype: interface type
55552fe8ef10SJohannes Berg  * @registered: is this wdev already registered with cfg80211
555640c575d1SJohannes Berg  * @registering: indicates we're doing registration under wiphy lock
555740c575d1SJohannes Berg  *	for the notifier
5558d3236553SJohannes Berg  * @list: (private) Used to collect the interfaces
555989a54e48SJohannes Berg  * @netdev: (private) Used to reference back to the netdev, may be %NULL
556089a54e48SJohannes Berg  * @identifier: (private) Identifier used in nl80211 to identify this
556189a54e48SJohannes Berg  *	wireless device if it has no netdev
55627b0a0e3cSJohannes Berg  * @connected_addr: (private) BSSID or AP MLD address if connected
55637b0a0e3cSJohannes Berg  * @connected: indicates if connected or not (STA mode)
5564d3236553SJohannes Berg  * @current_bss: (private) Used by the internal configuration code
55659e0e2961SMichal Kazior  * @chandef: (private) Used by the internal configuration code to track
55669e0e2961SMichal Kazior  *	the user-set channel definition.
5567780b40dfSJohannes Berg  * @preset_chandef: (private) Used by the internal configuration code to
5568aa430da4SJohannes Berg  *	track the channel to be used for AP later
5569d3236553SJohannes Berg  * @bssid: (private) Used by the internal configuration code
5570d3236553SJohannes Berg  * @ssid: (private) Used by the internal configuration code
5571d3236553SJohannes Berg  * @ssid_len: (private) Used by the internal configuration code
557229cbe68cSJohannes Berg  * @mesh_id_len: (private) Used by the internal configuration code
557329cbe68cSJohannes Berg  * @mesh_id_up_len: (private) Used by the internal configuration code
5574d3236553SJohannes Berg  * @wext: (private) Used by the internal wireless extensions compat code
55759874b71fSJohannes Berg  * @wext.ibss: (private) IBSS data part of wext handling
55769874b71fSJohannes Berg  * @wext.connect: (private) connection handling data
55779874b71fSJohannes Berg  * @wext.keys: (private) (WEP) key data
55789874b71fSJohannes Berg  * @wext.ie: (private) extra elements for association
55799874b71fSJohannes Berg  * @wext.ie_len: (private) length of extra elements
55809874b71fSJohannes Berg  * @wext.bssid: (private) selected network BSSID
55819874b71fSJohannes Berg  * @wext.ssid: (private) selected network SSID
55829874b71fSJohannes Berg  * @wext.default_key: (private) selected default key index
55839874b71fSJohannes Berg  * @wext.default_mgmt_key: (private) selected default management key index
55849874b71fSJohannes Berg  * @wext.prev_bssid: (private) previous BSSID for reassociation
55859874b71fSJohannes Berg  * @wext.prev_bssid_valid: (private) previous BSSID validity
55869bc383deSJohannes Berg  * @use_4addr: indicates 4addr mode is used on this interface, must be
55879bc383deSJohannes Berg  *	set by driver (if supported) on add_interface BEFORE registering the
55889bc383deSJohannes Berg  *	netdev and may otherwise be used by driver read-only, will be update
55899bc383deSJohannes Berg  *	by cfg80211 on change_interface
55902e161f78SJohannes Berg  * @mgmt_registrations: list of registrations for management frames
559179ea1e12SJohannes Berg  * @mgmt_registrations_need_update: mgmt registrations were updated,
559279ea1e12SJohannes Berg  *	need to propagate the update to the driver
55938d61ffa5SJohannes Berg  * @mtx: mutex used to lock data in this struct, may be used by drivers
55948d61ffa5SJohannes Berg  *	and some API functions require it held
559556d1893dSJohannes Berg  * @beacon_interval: beacon interval used on this device for transmitting
559656d1893dSJohannes Berg  *	beacons, 0 when not valid
559798104fdeSJohannes Berg  * @address: The address for this device, valid only if @netdev is %NULL
559873c7da3dSArend Van Spriel  * @is_running: true if this is a non-netdev device that has been started, e.g.
559973c7da3dSArend Van Spriel  *	the P2P Device.
560004f39047SSimon Wunderlich  * @cac_started: true if DFS channel availability check has been started
560104f39047SSimon Wunderlich  * @cac_start_time: timestamp (jiffies) when the dfs state was entered.
560231559f35SJanusz Dziedzic  * @cac_time_ms: CAC time in ms
5603780b40dfSJohannes Berg  * @ps: powersave mode is enabled
5604780b40dfSJohannes Berg  * @ps_timeout: dynamic powersave timeout
5605780b40dfSJohannes Berg  * @ap_unexpected_nlportid: (private) netlink port ID of application
5606780b40dfSJohannes Berg  *	registered for unexpected class 3 frames (AP mode)
5607780b40dfSJohannes Berg  * @conn: (private) cfg80211 software SME connection state machine data
5608780b40dfSJohannes Berg  * @connect_keys: (private) keys to set after connection is established
560934d50519SLior David  * @conn_bss_type: connecting/connected BSS type
5610bd2522b1SAndrzej Zaborowski  * @conn_owner_nlportid: (private) connection owner socket port ID
5611bd2522b1SAndrzej Zaborowski  * @disconnect_wk: (private) auto-disconnect work
5612bd2522b1SAndrzej Zaborowski  * @disconnect_bssid: (private) the BSSID to use for auto-disconnect
5613780b40dfSJohannes Berg  * @event_list: (private) list for internal event processing
5614780b40dfSJohannes Berg  * @event_lock: (private) lock for event list
561578f22b6aSJohannes Berg  * @owner_nlportid: (private) owner socket port ID
5616ab81007aSJohannes Berg  * @nl_owner_dead: (private) owner socket went away
56174a4b8169SAndrew Zaborowski  * @cqm_config: (private) nl80211 RSSI monitor state
56189bb7e0f2SJohannes Berg  * @pmsr_list: (private) peer measurement requests
56199bb7e0f2SJohannes Berg  * @pmsr_lock: (private) peer measurements requests/results lock
56209bb7e0f2SJohannes Berg  * @pmsr_free_wk: (private) peer measurements cleanup work
56214d797fceSJouni Malinen  * @unprot_beacon_reported: (private) timestamp of last
56224d797fceSJouni Malinen  *	unprotected beacon report
5623d3236553SJohannes Berg  */
5624d3236553SJohannes Berg struct wireless_dev {
5625d3236553SJohannes Berg 	struct wiphy *wiphy;
5626d3236553SJohannes Berg 	enum nl80211_iftype iftype;
5627d3236553SJohannes Berg 
5628667503ddSJohannes Berg 	/* the remainder of this struct should be private to cfg80211 */
5629d3236553SJohannes Berg 	struct list_head list;
5630d3236553SJohannes Berg 	struct net_device *netdev;
5631d3236553SJohannes Berg 
563289a54e48SJohannes Berg 	u32 identifier;
563389a54e48SJohannes Berg 
56342e161f78SJohannes Berg 	struct list_head mgmt_registrations;
563579ea1e12SJohannes Berg 	u8 mgmt_registrations_need_update:1;
5636026331c4SJouni Malinen 
5637667503ddSJohannes Berg 	struct mutex mtx;
5638667503ddSJohannes Berg 
563940c575d1SJohannes Berg 	bool use_4addr, is_running, registered, registering;
564098104fdeSJohannes Berg 
564198104fdeSJohannes Berg 	u8 address[ETH_ALEN] __aligned(sizeof(u16));
56429bc383deSJohannes Berg 
5643b23aa676SSamuel Ortiz 	/* currently used for IBSS and SME - might be rearranged later */
56446829c878SJohannes Berg 	struct cfg80211_conn *conn;
5645fffd0934SJohannes Berg 	struct cfg80211_cached_keys *connect_keys;
564634d50519SLior David 	enum ieee80211_bss_type conn_bss_type;
5647bd2522b1SAndrzej Zaborowski 	u32 conn_owner_nlportid;
5648bd2522b1SAndrzej Zaborowski 
5649bd2522b1SAndrzej Zaborowski 	struct work_struct disconnect_wk;
5650bd2522b1SAndrzej Zaborowski 	u8 disconnect_bssid[ETH_ALEN];
5651d3236553SJohannes Berg 
5652667503ddSJohannes Berg 	struct list_head event_list;
5653667503ddSJohannes Berg 	spinlock_t event_lock;
5654667503ddSJohannes Berg 
56557b0a0e3cSJohannes Berg 	u8 connected:1;
5656f4489ebeSMichal Kazior 
5657ffb9eb3dSKalle Valo 	bool ps;
5658ffb9eb3dSKalle Valo 	int ps_timeout;
5659ffb9eb3dSKalle Valo 
566015e47304SEric W. Biederman 	u32 ap_unexpected_nlportid;
566128946da7SJohannes Berg 
5662ab81007aSJohannes Berg 	u32 owner_nlportid;
5663ab81007aSJohannes Berg 	bool nl_owner_dead;
5664ab81007aSJohannes Berg 
56657b0a0e3cSJohannes Berg 	/* FIXME: need to rework radar detection for MLO */
566604f39047SSimon Wunderlich 	bool cac_started;
566704f39047SSimon Wunderlich 	unsigned long cac_start_time;
566831559f35SJanusz Dziedzic 	unsigned int cac_time_ms;
566904f39047SSimon Wunderlich 
56703d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT
5671d3236553SJohannes Berg 	/* wext data */
5672cbe8fa9cSJohannes Berg 	struct {
5673cbe8fa9cSJohannes Berg 		struct cfg80211_ibss_params ibss;
5674f2129354SJohannes Berg 		struct cfg80211_connect_params connect;
5675fffd0934SJohannes Berg 		struct cfg80211_cached_keys *keys;
5676c1e5f471SJohannes Berg 		const u8 *ie;
5677f2129354SJohannes Berg 		size_t ie_len;
56789874b71fSJohannes Berg 		u8 bssid[ETH_ALEN];
56799874b71fSJohannes Berg 		u8 prev_bssid[ETH_ALEN];
5680f2129354SJohannes Berg 		u8 ssid[IEEE80211_MAX_SSID_LEN];
568108645126SJohannes Berg 		s8 default_key, default_mgmt_key;
5682ffb9eb3dSKalle Valo 		bool prev_bssid_valid;
5683cbe8fa9cSJohannes Berg 	} wext;
5684d3236553SJohannes Berg #endif
56854a4b8169SAndrew Zaborowski 
56864a4b8169SAndrew Zaborowski 	struct cfg80211_cqm_config *cqm_config;
56879bb7e0f2SJohannes Berg 
56889bb7e0f2SJohannes Berg 	struct list_head pmsr_list;
56899bb7e0f2SJohannes Berg 	spinlock_t pmsr_lock;
56909bb7e0f2SJohannes Berg 	struct work_struct pmsr_free_wk;
56914d797fceSJouni Malinen 
56924d797fceSJouni Malinen 	unsigned long unprot_beacon_reported;
56937b0a0e3cSJohannes Berg 
56947b0a0e3cSJohannes Berg 	union {
56957b0a0e3cSJohannes Berg 		struct {
56967b0a0e3cSJohannes Berg 			u8 connected_addr[ETH_ALEN] __aligned(2);
56977b0a0e3cSJohannes Berg 			u8 ssid[IEEE80211_MAX_SSID_LEN];
56987b0a0e3cSJohannes Berg 			u8 ssid_len;
56997b0a0e3cSJohannes Berg 		} client;
57007b0a0e3cSJohannes Berg 		struct {
57017b0a0e3cSJohannes Berg 			int beacon_interval;
57027b0a0e3cSJohannes Berg 			struct cfg80211_chan_def preset_chandef;
57037b0a0e3cSJohannes Berg 			struct cfg80211_chan_def chandef;
57047b0a0e3cSJohannes Berg 			u8 id[IEEE80211_MAX_SSID_LEN];
57057b0a0e3cSJohannes Berg 			u8 id_len, id_up_len;
57067b0a0e3cSJohannes Berg 		} mesh;
57077b0a0e3cSJohannes Berg 		struct {
57087b0a0e3cSJohannes Berg 			struct cfg80211_chan_def preset_chandef;
57097b0a0e3cSJohannes Berg 			u8 ssid[IEEE80211_MAX_SSID_LEN];
57107b0a0e3cSJohannes Berg 			u8 ssid_len;
57117b0a0e3cSJohannes Berg 		} ap;
57127b0a0e3cSJohannes Berg 		struct {
57137b0a0e3cSJohannes Berg 			struct cfg80211_internal_bss *current_bss;
57147b0a0e3cSJohannes Berg 			struct cfg80211_chan_def chandef;
57157b0a0e3cSJohannes Berg 			int beacon_interval;
57167b0a0e3cSJohannes Berg 			u8 ssid[IEEE80211_MAX_SSID_LEN];
57177b0a0e3cSJohannes Berg 			u8 ssid_len;
57187b0a0e3cSJohannes Berg 		} ibss;
57197b0a0e3cSJohannes Berg 		struct {
57207b0a0e3cSJohannes Berg 			struct cfg80211_chan_def chandef;
57217b0a0e3cSJohannes Berg 		} ocb;
57227b0a0e3cSJohannes Berg 	} u;
57237b0a0e3cSJohannes Berg 
57247b0a0e3cSJohannes Berg 	struct {
57257b0a0e3cSJohannes Berg 		u8 addr[ETH_ALEN] __aligned(2);
57267b0a0e3cSJohannes Berg 		union {
57277b0a0e3cSJohannes Berg 			struct {
57287b0a0e3cSJohannes Berg 				unsigned int beacon_interval;
57297b0a0e3cSJohannes Berg 				struct cfg80211_chan_def chandef;
57307b0a0e3cSJohannes Berg 			} ap;
57317b0a0e3cSJohannes Berg 			struct {
57327b0a0e3cSJohannes Berg 				struct cfg80211_internal_bss *current_bss;
57337b0a0e3cSJohannes Berg 			} client;
57347b0a0e3cSJohannes Berg 		};
57357b0a0e3cSJohannes Berg 	} links[IEEE80211_MLD_MAX_NUM_LINKS];
57367b0a0e3cSJohannes Berg 	u16 valid_links;
5737d3236553SJohannes Berg };
5738d3236553SJohannes Berg 
573910de5a59SJakub Kicinski static inline const u8 *wdev_address(struct wireless_dev *wdev)
574098104fdeSJohannes Berg {
574198104fdeSJohannes Berg 	if (wdev->netdev)
574298104fdeSJohannes Berg 		return wdev->netdev->dev_addr;
574398104fdeSJohannes Berg 	return wdev->address;
574498104fdeSJohannes Berg }
574598104fdeSJohannes Berg 
574673c7da3dSArend Van Spriel static inline bool wdev_running(struct wireless_dev *wdev)
574773c7da3dSArend Van Spriel {
574873c7da3dSArend Van Spriel 	if (wdev->netdev)
574973c7da3dSArend Van Spriel 		return netif_running(wdev->netdev);
575073c7da3dSArend Van Spriel 	return wdev->is_running;
575173c7da3dSArend Van Spriel }
575273c7da3dSArend Van Spriel 
5753d3236553SJohannes Berg /**
5754d3236553SJohannes Berg  * wdev_priv - return wiphy priv from wireless_dev
5755d3236553SJohannes Berg  *
5756d3236553SJohannes Berg  * @wdev: The wireless device whose wiphy's priv pointer to return
57570ae997dcSYacine Belkadi  * Return: The wiphy priv of @wdev.
5758d3236553SJohannes Berg  */
5759d3236553SJohannes Berg static inline void *wdev_priv(struct wireless_dev *wdev)
5760d3236553SJohannes Berg {
5761d3236553SJohannes Berg 	BUG_ON(!wdev);
5762d3236553SJohannes Berg 	return wiphy_priv(wdev->wiphy);
5763d3236553SJohannes Berg }
5764d3236553SJohannes Berg 
5765d70e9693SJohannes Berg /**
57667b0a0e3cSJohannes Berg  * wdev_chandef - return chandef pointer from wireless_dev
57677b0a0e3cSJohannes Berg  * @wdev: the wdev
57687b0a0e3cSJohannes Berg  * @link_id: the link ID for MLO
57697b0a0e3cSJohannes Berg  *
57707b0a0e3cSJohannes Berg  * Return: The chandef depending on the mode, or %NULL.
57717b0a0e3cSJohannes Berg  */
57727b0a0e3cSJohannes Berg struct cfg80211_chan_def *wdev_chandef(struct wireless_dev *wdev,
57737b0a0e3cSJohannes Berg 				       unsigned int link_id);
57747b0a0e3cSJohannes Berg 
57757b0a0e3cSJohannes Berg static inline void WARN_INVALID_LINK_ID(struct wireless_dev *wdev,
57767b0a0e3cSJohannes Berg 					unsigned int link_id)
57777b0a0e3cSJohannes Berg {
57787b0a0e3cSJohannes Berg 	WARN_ON(link_id && !wdev->valid_links);
57797b0a0e3cSJohannes Berg 	WARN_ON(wdev->valid_links &&
57807b0a0e3cSJohannes Berg 		!(wdev->valid_links & BIT(link_id)));
57817b0a0e3cSJohannes Berg }
57827b0a0e3cSJohannes Berg 
57837b0a0e3cSJohannes Berg #define for_each_valid_link(wdev, link_id)					\
57847b0a0e3cSJohannes Berg 	for (link_id = 0;							\
57857b0a0e3cSJohannes Berg 	     link_id < ((wdev)->valid_links ? ARRAY_SIZE((wdev)->links) : 1);	\
57867b0a0e3cSJohannes Berg 	     link_id++)								\
57877b0a0e3cSJohannes Berg 		if (!(wdev)->valid_links ||					\
57887b0a0e3cSJohannes Berg 		    ((wdev)->valid_links & BIT(link_id)))
57897b0a0e3cSJohannes Berg 
57907b0a0e3cSJohannes Berg /**
5791d70e9693SJohannes Berg  * DOC: Utility functions
5792d70e9693SJohannes Berg  *
5793d70e9693SJohannes Berg  * cfg80211 offers a number of utility functions that can be useful.
5794d3236553SJohannes Berg  */
5795d3236553SJohannes Berg 
5796d3236553SJohannes Berg /**
5797934f4c7dSThomas Pedersen  * ieee80211_channel_equal - compare two struct ieee80211_channel
5798934f4c7dSThomas Pedersen  *
5799934f4c7dSThomas Pedersen  * @a: 1st struct ieee80211_channel
5800934f4c7dSThomas Pedersen  * @b: 2nd struct ieee80211_channel
5801934f4c7dSThomas Pedersen  * Return: true if center frequency of @a == @b
5802934f4c7dSThomas Pedersen  */
5803934f4c7dSThomas Pedersen static inline bool
5804934f4c7dSThomas Pedersen ieee80211_channel_equal(struct ieee80211_channel *a,
5805934f4c7dSThomas Pedersen 			struct ieee80211_channel *b)
5806934f4c7dSThomas Pedersen {
5807934f4c7dSThomas Pedersen 	return (a->center_freq == b->center_freq &&
5808934f4c7dSThomas Pedersen 		a->freq_offset == b->freq_offset);
5809934f4c7dSThomas Pedersen }
5810934f4c7dSThomas Pedersen 
5811934f4c7dSThomas Pedersen /**
5812934f4c7dSThomas Pedersen  * ieee80211_channel_to_khz - convert ieee80211_channel to frequency in KHz
5813934f4c7dSThomas Pedersen  * @chan: struct ieee80211_channel to convert
5814934f4c7dSThomas Pedersen  * Return: The corresponding frequency (in KHz)
5815934f4c7dSThomas Pedersen  */
5816934f4c7dSThomas Pedersen static inline u32
5817934f4c7dSThomas Pedersen ieee80211_channel_to_khz(const struct ieee80211_channel *chan)
5818934f4c7dSThomas Pedersen {
5819934f4c7dSThomas Pedersen 	return MHZ_TO_KHZ(chan->center_freq) + chan->freq_offset;
5820934f4c7dSThomas Pedersen }
5821934f4c7dSThomas Pedersen 
5822934f4c7dSThomas Pedersen /**
582311b34737SThomas Pedersen  * ieee80211_s1g_channel_width - get allowed channel width from @chan
582411b34737SThomas Pedersen  *
582511b34737SThomas Pedersen  * Only allowed for band NL80211_BAND_S1GHZ
582611b34737SThomas Pedersen  * @chan: channel
582711b34737SThomas Pedersen  * Return: The allowed channel width for this center_freq
582811b34737SThomas Pedersen  */
582911b34737SThomas Pedersen enum nl80211_chan_width
583011b34737SThomas Pedersen ieee80211_s1g_channel_width(const struct ieee80211_channel *chan);
583111b34737SThomas Pedersen 
583211b34737SThomas Pedersen /**
5833934f4c7dSThomas Pedersen  * ieee80211_channel_to_freq_khz - convert channel number to frequency
5834934f4c7dSThomas Pedersen  * @chan: channel number
5835934f4c7dSThomas Pedersen  * @band: band, necessary due to channel number overlap
5836934f4c7dSThomas Pedersen  * Return: The corresponding frequency (in KHz), or 0 if the conversion failed.
5837934f4c7dSThomas Pedersen  */
5838934f4c7dSThomas Pedersen u32 ieee80211_channel_to_freq_khz(int chan, enum nl80211_band band);
5839934f4c7dSThomas Pedersen 
5840934f4c7dSThomas Pedersen /**
5841d3236553SJohannes Berg  * ieee80211_channel_to_frequency - convert channel number to frequency
5842abe37c4bSJohannes Berg  * @chan: channel number
584359eb21a6SBruno Randolf  * @band: band, necessary due to channel number overlap
58440ae997dcSYacine Belkadi  * Return: The corresponding frequency (in MHz), or 0 if the conversion failed.
5845d3236553SJohannes Berg  */
5846934f4c7dSThomas Pedersen static inline int
5847934f4c7dSThomas Pedersen ieee80211_channel_to_frequency(int chan, enum nl80211_band band)
5848934f4c7dSThomas Pedersen {
5849934f4c7dSThomas Pedersen 	return KHZ_TO_MHZ(ieee80211_channel_to_freq_khz(chan, band));
5850934f4c7dSThomas Pedersen }
5851934f4c7dSThomas Pedersen 
5852934f4c7dSThomas Pedersen /**
5853934f4c7dSThomas Pedersen  * ieee80211_freq_khz_to_channel - convert frequency to channel number
5854934f4c7dSThomas Pedersen  * @freq: center frequency in KHz
5855934f4c7dSThomas Pedersen  * Return: The corresponding channel, or 0 if the conversion failed.
5856934f4c7dSThomas Pedersen  */
5857934f4c7dSThomas Pedersen int ieee80211_freq_khz_to_channel(u32 freq);
5858d3236553SJohannes Berg 
5859d3236553SJohannes Berg /**
5860d3236553SJohannes Berg  * ieee80211_frequency_to_channel - convert frequency to channel number
5861934f4c7dSThomas Pedersen  * @freq: center frequency in MHz
58620ae997dcSYacine Belkadi  * Return: The corresponding channel, or 0 if the conversion failed.
5863d3236553SJohannes Berg  */
5864934f4c7dSThomas Pedersen static inline int
5865934f4c7dSThomas Pedersen ieee80211_frequency_to_channel(int freq)
5866934f4c7dSThomas Pedersen {
5867934f4c7dSThomas Pedersen 	return ieee80211_freq_khz_to_channel(MHZ_TO_KHZ(freq));
5868934f4c7dSThomas Pedersen }
5869934f4c7dSThomas Pedersen 
5870934f4c7dSThomas Pedersen /**
5871934f4c7dSThomas Pedersen  * ieee80211_get_channel_khz - get channel struct from wiphy for specified
5872934f4c7dSThomas Pedersen  * frequency
5873934f4c7dSThomas Pedersen  * @wiphy: the struct wiphy to get the channel for
5874934f4c7dSThomas Pedersen  * @freq: the center frequency (in KHz) of the channel
5875934f4c7dSThomas Pedersen  * Return: The channel struct from @wiphy at @freq.
5876934f4c7dSThomas Pedersen  */
5877934f4c7dSThomas Pedersen struct ieee80211_channel *
5878934f4c7dSThomas Pedersen ieee80211_get_channel_khz(struct wiphy *wiphy, u32 freq);
5879d3236553SJohannes Berg 
5880d3236553SJohannes Berg /**
5881d3236553SJohannes Berg  * ieee80211_get_channel - get channel struct from wiphy for specified frequency
5882543b921bSArend Van Spriel  *
5883abe37c4bSJohannes Berg  * @wiphy: the struct wiphy to get the channel for
5884934f4c7dSThomas Pedersen  * @freq: the center frequency (in MHz) of the channel
58850ae997dcSYacine Belkadi  * Return: The channel struct from @wiphy at @freq.
5886d3236553SJohannes Berg  */
5887934f4c7dSThomas Pedersen static inline struct ieee80211_channel *
5888934f4c7dSThomas Pedersen ieee80211_get_channel(struct wiphy *wiphy, int freq)
5889934f4c7dSThomas Pedersen {
5890934f4c7dSThomas Pedersen 	return ieee80211_get_channel_khz(wiphy, MHZ_TO_KHZ(freq));
5891934f4c7dSThomas Pedersen }
5892d3236553SJohannes Berg 
5893d3236553SJohannes Berg /**
5894afbc9c9eSJohannes Berg  * cfg80211_channel_is_psc - Check if the channel is a 6 GHz PSC
5895afbc9c9eSJohannes Berg  * @chan: control channel to check
5896afbc9c9eSJohannes Berg  *
5897afbc9c9eSJohannes Berg  * The Preferred Scanning Channels (PSC) are defined in
5898afbc9c9eSJohannes Berg  * Draft IEEE P802.11ax/D5.0, 26.17.2.3.3
5899afbc9c9eSJohannes Berg  */
5900afbc9c9eSJohannes Berg static inline bool cfg80211_channel_is_psc(struct ieee80211_channel *chan)
5901afbc9c9eSJohannes Berg {
5902afbc9c9eSJohannes Berg 	if (chan->band != NL80211_BAND_6GHZ)
5903afbc9c9eSJohannes Berg 		return false;
5904afbc9c9eSJohannes Berg 
5905afbc9c9eSJohannes Berg 	return ieee80211_frequency_to_channel(chan->center_freq) % 16 == 5;
5906afbc9c9eSJohannes Berg }
5907afbc9c9eSJohannes Berg 
5908afbc9c9eSJohannes Berg /**
5909d3236553SJohannes Berg  * ieee80211_get_response_rate - get basic rate for a given rate
5910d3236553SJohannes Berg  *
5911d3236553SJohannes Berg  * @sband: the band to look for rates in
5912d3236553SJohannes Berg  * @basic_rates: bitmap of basic rates
5913d3236553SJohannes Berg  * @bitrate: the bitrate for which to find the basic rate
5914d3236553SJohannes Berg  *
59150ae997dcSYacine Belkadi  * Return: The basic rate corresponding to a given bitrate, that
59160ae997dcSYacine Belkadi  * is the next lower bitrate contained in the basic rate map,
59170ae997dcSYacine Belkadi  * which is, for this function, given as a bitmap of indices of
59180ae997dcSYacine Belkadi  * rates in the band's bitrate table.
5919d3236553SJohannes Berg  */
5920623b988fSJoe Perches const struct ieee80211_rate *
5921d3236553SJohannes Berg ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
5922d3236553SJohannes Berg 			    u32 basic_rates, int bitrate);
5923d3236553SJohannes Berg 
5924b422c6cdSAshok Nagarajan /**
5925b422c6cdSAshok Nagarajan  * ieee80211_mandatory_rates - get mandatory rates for a given band
5926b422c6cdSAshok Nagarajan  * @sband: the band to look for rates in
592774608acaSSimon Wunderlich  * @scan_width: width of the control channel
5928b422c6cdSAshok Nagarajan  *
5929b422c6cdSAshok Nagarajan  * This function returns a bitmap of the mandatory rates for the given
5930b422c6cdSAshok Nagarajan  * band, bits are set according to the rate position in the bitrates array.
5931b422c6cdSAshok Nagarajan  */
593274608acaSSimon Wunderlich u32 ieee80211_mandatory_rates(struct ieee80211_supported_band *sband,
593374608acaSSimon Wunderlich 			      enum nl80211_bss_scan_width scan_width);
5934b422c6cdSAshok Nagarajan 
5935d3236553SJohannes Berg /*
5936d3236553SJohannes Berg  * Radiotap parsing functions -- for controlled injection support
5937d3236553SJohannes Berg  *
5938d3236553SJohannes Berg  * Implemented in net/wireless/radiotap.c
593966d495d0SMauro Carvalho Chehab  * Documentation in Documentation/networking/radiotap-headers.rst
5940d3236553SJohannes Berg  */
5941d3236553SJohannes Berg 
594233e5a2f7SJohannes Berg struct radiotap_align_size {
594333e5a2f7SJohannes Berg 	uint8_t align:4, size:4;
594433e5a2f7SJohannes Berg };
594533e5a2f7SJohannes Berg 
594633e5a2f7SJohannes Berg struct ieee80211_radiotap_namespace {
594733e5a2f7SJohannes Berg 	const struct radiotap_align_size *align_size;
594833e5a2f7SJohannes Berg 	int n_bits;
594933e5a2f7SJohannes Berg 	uint32_t oui;
595033e5a2f7SJohannes Berg 	uint8_t subns;
595133e5a2f7SJohannes Berg };
595233e5a2f7SJohannes Berg 
595333e5a2f7SJohannes Berg struct ieee80211_radiotap_vendor_namespaces {
595433e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_namespace *ns;
595533e5a2f7SJohannes Berg 	int n_ns;
595633e5a2f7SJohannes Berg };
595733e5a2f7SJohannes Berg 
5958d3236553SJohannes Berg /**
5959d3236553SJohannes Berg  * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args
596033e5a2f7SJohannes Berg  * @this_arg_index: index of current arg, valid after each successful call
596133e5a2f7SJohannes Berg  *	to ieee80211_radiotap_iterator_next()
596233e5a2f7SJohannes Berg  * @this_arg: pointer to current radiotap arg; it is valid after each
596333e5a2f7SJohannes Berg  *	call to ieee80211_radiotap_iterator_next() but also after
596433e5a2f7SJohannes Berg  *	ieee80211_radiotap_iterator_init() where it will point to
596533e5a2f7SJohannes Berg  *	the beginning of the actual data portion
596633e5a2f7SJohannes Berg  * @this_arg_size: length of the current arg, for convenience
596733e5a2f7SJohannes Berg  * @current_namespace: pointer to the current namespace definition
596833e5a2f7SJohannes Berg  *	(or internally %NULL if the current namespace is unknown)
596933e5a2f7SJohannes Berg  * @is_radiotap_ns: indicates whether the current namespace is the default
597033e5a2f7SJohannes Berg  *	radiotap namespace or not
597133e5a2f7SJohannes Berg  *
597233e5a2f7SJohannes Berg  * @_rtheader: pointer to the radiotap header we are walking through
597333e5a2f7SJohannes Berg  * @_max_length: length of radiotap header in cpu byte ordering
597433e5a2f7SJohannes Berg  * @_arg_index: next argument index
597533e5a2f7SJohannes Berg  * @_arg: next argument pointer
597633e5a2f7SJohannes Berg  * @_next_bitmap: internal pointer to next present u32
597733e5a2f7SJohannes Berg  * @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present
597833e5a2f7SJohannes Berg  * @_vns: vendor namespace definitions
597933e5a2f7SJohannes Berg  * @_next_ns_data: beginning of the next namespace's data
598033e5a2f7SJohannes Berg  * @_reset_on_ext: internal; reset the arg index to 0 when going to the
598133e5a2f7SJohannes Berg  *	next bitmap word
598233e5a2f7SJohannes Berg  *
598333e5a2f7SJohannes Berg  * Describes the radiotap parser state. Fields prefixed with an underscore
598433e5a2f7SJohannes Berg  * must not be used by users of the parser, only by the parser internally.
5985d3236553SJohannes Berg  */
5986d3236553SJohannes Berg 
5987d3236553SJohannes Berg struct ieee80211_radiotap_iterator {
598833e5a2f7SJohannes Berg 	struct ieee80211_radiotap_header *_rtheader;
598933e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_vendor_namespaces *_vns;
599033e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_namespace *current_namespace;
5991d3236553SJohannes Berg 
599233e5a2f7SJohannes Berg 	unsigned char *_arg, *_next_ns_data;
599367272440SJohannes Berg 	__le32 *_next_bitmap;
599433e5a2f7SJohannes Berg 
599533e5a2f7SJohannes Berg 	unsigned char *this_arg;
599633e5a2f7SJohannes Berg 	int this_arg_index;
599733e5a2f7SJohannes Berg 	int this_arg_size;
599833e5a2f7SJohannes Berg 
599933e5a2f7SJohannes Berg 	int is_radiotap_ns;
600033e5a2f7SJohannes Berg 
600133e5a2f7SJohannes Berg 	int _max_length;
600233e5a2f7SJohannes Berg 	int _arg_index;
600333e5a2f7SJohannes Berg 	uint32_t _bitmap_shifter;
600433e5a2f7SJohannes Berg 	int _reset_on_ext;
6005d3236553SJohannes Berg };
6006d3236553SJohannes Berg 
600710dd9b7cSJoe Perches int
600810dd9b7cSJoe Perches ieee80211_radiotap_iterator_init(struct ieee80211_radiotap_iterator *iterator,
6009d3236553SJohannes Berg 				 struct ieee80211_radiotap_header *radiotap_header,
601010dd9b7cSJoe Perches 				 int max_length,
601110dd9b7cSJoe Perches 				 const struct ieee80211_radiotap_vendor_namespaces *vns);
6012d3236553SJohannes Berg 
601310dd9b7cSJoe Perches int
601410dd9b7cSJoe Perches ieee80211_radiotap_iterator_next(struct ieee80211_radiotap_iterator *iterator);
6015d3236553SJohannes Berg 
601633e5a2f7SJohannes Berg 
6017e31a16d6SZhu Yi extern const unsigned char rfc1042_header[6];
6018e31a16d6SZhu Yi extern const unsigned char bridge_tunnel_header[6];
6019e31a16d6SZhu Yi 
6020e31a16d6SZhu Yi /**
6021e31a16d6SZhu Yi  * ieee80211_get_hdrlen_from_skb - get header length from data
6022e31a16d6SZhu Yi  *
6023e31a16d6SZhu Yi  * @skb: the frame
60240ae997dcSYacine Belkadi  *
60250ae997dcSYacine Belkadi  * Given an skb with a raw 802.11 header at the data pointer this function
60260ae997dcSYacine Belkadi  * returns the 802.11 header length.
60270ae997dcSYacine Belkadi  *
60280ae997dcSYacine Belkadi  * Return: The 802.11 header length in bytes (not including encryption
60290ae997dcSYacine Belkadi  * headers). Or 0 if the data in the sk_buff is too short to contain a valid
60300ae997dcSYacine Belkadi  * 802.11 header.
6031e31a16d6SZhu Yi  */
6032e31a16d6SZhu Yi unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb);
6033e31a16d6SZhu Yi 
6034e31a16d6SZhu Yi /**
6035e31a16d6SZhu Yi  * ieee80211_hdrlen - get header length in bytes from frame control
6036e31a16d6SZhu Yi  * @fc: frame control field in little-endian format
60370ae997dcSYacine Belkadi  * Return: The header length in bytes.
6038e31a16d6SZhu Yi  */
6039633adf1aSJohannes Berg unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc);
6040e31a16d6SZhu Yi 
6041e31a16d6SZhu Yi /**
60429b395bc3SJohannes Berg  * ieee80211_get_mesh_hdrlen - get mesh extension header length
60439b395bc3SJohannes Berg  * @meshhdr: the mesh extension header, only the flags field
60449b395bc3SJohannes Berg  *	(first byte) will be accessed
60450ae997dcSYacine Belkadi  * Return: The length of the extension header, which is always at
60469b395bc3SJohannes Berg  * least 6 bytes and at most 18 if address 5 and 6 are present.
60479b395bc3SJohannes Berg  */
60489b395bc3SJohannes Berg unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr);
60499b395bc3SJohannes Berg 
60509b395bc3SJohannes Berg /**
6051d70e9693SJohannes Berg  * DOC: Data path helpers
6052d70e9693SJohannes Berg  *
6053d70e9693SJohannes Berg  * In addition to generic utilities, cfg80211 also offers
6054d70e9693SJohannes Berg  * functions that help implement the data path for devices
6055d70e9693SJohannes Berg  * that do not do the 802.11/802.3 conversion on the device.
6056d70e9693SJohannes Berg  */
6057d70e9693SJohannes Berg 
6058d70e9693SJohannes Berg /**
60597f6990c8SJohannes Berg  * ieee80211_data_to_8023_exthdr - convert an 802.11 data frame to 802.3
60607f6990c8SJohannes Berg  * @skb: the 802.11 data frame
60617f6990c8SJohannes Berg  * @ehdr: pointer to a &struct ethhdr that will get the header, instead
60627f6990c8SJohannes Berg  *	of it being pushed into the SKB
60637f6990c8SJohannes Berg  * @addr: the device MAC address
60647f6990c8SJohannes Berg  * @iftype: the virtual interface type
606524bba078SFelix Fietkau  * @data_offset: offset of payload after the 802.11 header
60667f6990c8SJohannes Berg  * Return: 0 on success. Non-zero on error.
60677f6990c8SJohannes Berg  */
60687f6990c8SJohannes Berg int ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr,
606924bba078SFelix Fietkau 				  const u8 *addr, enum nl80211_iftype iftype,
6070a1d5ff56SMathy Vanhoef 				  u8 data_offset, bool is_amsdu);
60717f6990c8SJohannes Berg 
60727f6990c8SJohannes Berg /**
6073e31a16d6SZhu Yi  * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3
6074e31a16d6SZhu Yi  * @skb: the 802.11 data frame
6075e31a16d6SZhu Yi  * @addr: the device MAC address
6076e31a16d6SZhu Yi  * @iftype: the virtual interface type
60770ae997dcSYacine Belkadi  * Return: 0 on success. Non-zero on error.
6078e31a16d6SZhu Yi  */
60797f6990c8SJohannes Berg static inline int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
60807f6990c8SJohannes Berg 					 enum nl80211_iftype iftype)
60817f6990c8SJohannes Berg {
6082a1d5ff56SMathy Vanhoef 	return ieee80211_data_to_8023_exthdr(skb, NULL, addr, iftype, 0, false);
60837f6990c8SJohannes Berg }
6084e31a16d6SZhu Yi 
6085e31a16d6SZhu Yi /**
6086eaf85ca7SZhu Yi  * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame
6087eaf85ca7SZhu Yi  *
60887f6990c8SJohannes Berg  * Decode an IEEE 802.11 A-MSDU and convert it to a list of 802.3 frames.
60897f6990c8SJohannes Berg  * The @list will be empty if the decode fails. The @skb must be fully
60907f6990c8SJohannes Berg  * header-less before being passed in here; it is freed in this function.
6091eaf85ca7SZhu Yi  *
60927f6990c8SJohannes Berg  * @skb: The input A-MSDU frame without any headers.
6093eaf85ca7SZhu Yi  * @list: The output list of 802.3 frames. It must be allocated and
6094085a6c10SRandy Dunlap  *	initialized by the caller.
6095eaf85ca7SZhu Yi  * @addr: The device MAC address.
6096eaf85ca7SZhu Yi  * @iftype: The device interface type.
6097eaf85ca7SZhu Yi  * @extra_headroom: The hardware extra headroom for SKBs in the @list.
60988b935ee2SJohannes Berg  * @check_da: DA to check in the inner ethernet header, or NULL
60998b935ee2SJohannes Berg  * @check_sa: SA to check in the inner ethernet header, or NULL
6100eaf85ca7SZhu Yi  */
6101eaf85ca7SZhu Yi void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,
6102eaf85ca7SZhu Yi 			      const u8 *addr, enum nl80211_iftype iftype,
61038b3becadSYogesh Ashok Powar 			      const unsigned int extra_headroom,
61048b935ee2SJohannes Berg 			      const u8 *check_da, const u8 *check_sa);
6105eaf85ca7SZhu Yi 
6106eaf85ca7SZhu Yi /**
6107e31a16d6SZhu Yi  * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame
6108e31a16d6SZhu Yi  * @skb: the data frame
6109fa9ffc74SKyeyoon Park  * @qos_map: Interworking QoS mapping or %NULL if not in use
61100ae997dcSYacine Belkadi  * Return: The 802.1p/1d tag.
6111e31a16d6SZhu Yi  */
6112fa9ffc74SKyeyoon Park unsigned int cfg80211_classify8021d(struct sk_buff *skb,
6113fa9ffc74SKyeyoon Park 				    struct cfg80211_qos_map *qos_map);
6114e31a16d6SZhu Yi 
6115c21dbf92SJohannes Berg /**
611649a68e0dSJohannes Berg  * cfg80211_find_elem_match - match information element and byte array in data
611749a68e0dSJohannes Berg  *
611849a68e0dSJohannes Berg  * @eid: element ID
611949a68e0dSJohannes Berg  * @ies: data consisting of IEs
612049a68e0dSJohannes Berg  * @len: length of data
612149a68e0dSJohannes Berg  * @match: byte array to match
612249a68e0dSJohannes Berg  * @match_len: number of bytes in the match array
612349a68e0dSJohannes Berg  * @match_offset: offset in the IE data where the byte array should match.
612449a68e0dSJohannes Berg  *	Note the difference to cfg80211_find_ie_match() which considers
612549a68e0dSJohannes Berg  *	the offset to start from the element ID byte, but here we take
612649a68e0dSJohannes Berg  *	the data portion instead.
612749a68e0dSJohannes Berg  *
612849a68e0dSJohannes Berg  * Return: %NULL if the element ID could not be found or if
612949a68e0dSJohannes Berg  * the element is invalid (claims to be longer than the given
613049a68e0dSJohannes Berg  * data) or if the byte array doesn't match; otherwise return the
613149a68e0dSJohannes Berg  * requested element struct.
613249a68e0dSJohannes Berg  *
613349a68e0dSJohannes Berg  * Note: There are no checks on the element length other than
613449a68e0dSJohannes Berg  * having to fit into the given data and being large enough for the
613549a68e0dSJohannes Berg  * byte array to match.
613649a68e0dSJohannes Berg  */
613749a68e0dSJohannes Berg const struct element *
613849a68e0dSJohannes Berg cfg80211_find_elem_match(u8 eid, const u8 *ies, unsigned int len,
613949a68e0dSJohannes Berg 			 const u8 *match, unsigned int match_len,
614049a68e0dSJohannes Berg 			 unsigned int match_offset);
614149a68e0dSJohannes Berg 
614249a68e0dSJohannes Berg /**
6143fbd05e4aSLuca Coelho  * cfg80211_find_ie_match - match information element and byte array in data
6144fbd05e4aSLuca Coelho  *
6145fbd05e4aSLuca Coelho  * @eid: element ID
6146fbd05e4aSLuca Coelho  * @ies: data consisting of IEs
6147fbd05e4aSLuca Coelho  * @len: length of data
6148fbd05e4aSLuca Coelho  * @match: byte array to match
6149fbd05e4aSLuca Coelho  * @match_len: number of bytes in the match array
6150fbd05e4aSLuca Coelho  * @match_offset: offset in the IE where the byte array should match.
6151fbd05e4aSLuca Coelho  *	If match_len is zero, this must also be set to zero.
6152fbd05e4aSLuca Coelho  *	Otherwise this must be set to 2 or more, because the first
6153fbd05e4aSLuca Coelho  *	byte is the element id, which is already compared to eid, and
6154fbd05e4aSLuca Coelho  *	the second byte is the IE length.
6155fbd05e4aSLuca Coelho  *
6156fbd05e4aSLuca Coelho  * Return: %NULL if the element ID could not be found or if
6157fbd05e4aSLuca Coelho  * the element is invalid (claims to be longer than the given
6158fbd05e4aSLuca Coelho  * data) or if the byte array doesn't match, or a pointer to the first
6159fbd05e4aSLuca Coelho  * byte of the requested element, that is the byte containing the
6160fbd05e4aSLuca Coelho  * element ID.
6161fbd05e4aSLuca Coelho  *
6162fbd05e4aSLuca Coelho  * Note: There are no checks on the element length other than
6163fbd05e4aSLuca Coelho  * having to fit into the given data and being large enough for the
6164fbd05e4aSLuca Coelho  * byte array to match.
6165fbd05e4aSLuca Coelho  */
616649a68e0dSJohannes Berg static inline const u8 *
616749a68e0dSJohannes Berg cfg80211_find_ie_match(u8 eid, const u8 *ies, unsigned int len,
616849a68e0dSJohannes Berg 		       const u8 *match, unsigned int match_len,
616949a68e0dSJohannes Berg 		       unsigned int match_offset)
617049a68e0dSJohannes Berg {
617149a68e0dSJohannes Berg 	/* match_offset can't be smaller than 2, unless match_len is
617249a68e0dSJohannes Berg 	 * zero, in which case match_offset must be zero as well.
617349a68e0dSJohannes Berg 	 */
617449a68e0dSJohannes Berg 	if (WARN_ON((match_len && match_offset < 2) ||
617549a68e0dSJohannes Berg 		    (!match_len && match_offset)))
617649a68e0dSJohannes Berg 		return NULL;
617749a68e0dSJohannes Berg 
61787e367b06SJohannes Berg 	return (const void *)cfg80211_find_elem_match(eid, ies, len,
617949a68e0dSJohannes Berg 						      match, match_len,
618049a68e0dSJohannes Berg 						      match_offset ?
618149a68e0dSJohannes Berg 							match_offset - 2 : 0);
618249a68e0dSJohannes Berg }
618349a68e0dSJohannes Berg 
618449a68e0dSJohannes Berg /**
618549a68e0dSJohannes Berg  * cfg80211_find_elem - find information element in data
618649a68e0dSJohannes Berg  *
618749a68e0dSJohannes Berg  * @eid: element ID
618849a68e0dSJohannes Berg  * @ies: data consisting of IEs
618949a68e0dSJohannes Berg  * @len: length of data
619049a68e0dSJohannes Berg  *
619149a68e0dSJohannes Berg  * Return: %NULL if the element ID could not be found or if
619249a68e0dSJohannes Berg  * the element is invalid (claims to be longer than the given
619349a68e0dSJohannes Berg  * data) or if the byte array doesn't match; otherwise return the
619449a68e0dSJohannes Berg  * requested element struct.
619549a68e0dSJohannes Berg  *
619649a68e0dSJohannes Berg  * Note: There are no checks on the element length other than
619749a68e0dSJohannes Berg  * having to fit into the given data.
619849a68e0dSJohannes Berg  */
619949a68e0dSJohannes Berg static inline const struct element *
620049a68e0dSJohannes Berg cfg80211_find_elem(u8 eid, const u8 *ies, int len)
620149a68e0dSJohannes Berg {
620249a68e0dSJohannes Berg 	return cfg80211_find_elem_match(eid, ies, len, NULL, 0, 0);
620349a68e0dSJohannes Berg }
6204fbd05e4aSLuca Coelho 
6205fbd05e4aSLuca Coelho /**
6206c21dbf92SJohannes Berg  * cfg80211_find_ie - find information element in data
6207c21dbf92SJohannes Berg  *
6208c21dbf92SJohannes Berg  * @eid: element ID
6209c21dbf92SJohannes Berg  * @ies: data consisting of IEs
6210c21dbf92SJohannes Berg  * @len: length of data
6211c21dbf92SJohannes Berg  *
62120ae997dcSYacine Belkadi  * Return: %NULL if the element ID could not be found or if
62130ae997dcSYacine Belkadi  * the element is invalid (claims to be longer than the given
62140ae997dcSYacine Belkadi  * data), or a pointer to the first byte of the requested
62150ae997dcSYacine Belkadi  * element, that is the byte containing the element ID.
62160ae997dcSYacine Belkadi  *
62170ae997dcSYacine Belkadi  * Note: There are no checks on the element length other than
62180ae997dcSYacine Belkadi  * having to fit into the given data.
6219c21dbf92SJohannes Berg  */
6220fbd05e4aSLuca Coelho static inline const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len)
6221fbd05e4aSLuca Coelho {
6222fbd05e4aSLuca Coelho 	return cfg80211_find_ie_match(eid, ies, len, NULL, 0, 0);
6223fbd05e4aSLuca Coelho }
6224c21dbf92SJohannes Berg 
6225d70e9693SJohannes Berg /**
622649a68e0dSJohannes Berg  * cfg80211_find_ext_elem - find information element with EID Extension in data
622749a68e0dSJohannes Berg  *
622849a68e0dSJohannes Berg  * @ext_eid: element ID Extension
622949a68e0dSJohannes Berg  * @ies: data consisting of IEs
623049a68e0dSJohannes Berg  * @len: length of data
623149a68e0dSJohannes Berg  *
623249a68e0dSJohannes Berg  * Return: %NULL if the etended element could not be found or if
623349a68e0dSJohannes Berg  * the element is invalid (claims to be longer than the given
623449a68e0dSJohannes Berg  * data) or if the byte array doesn't match; otherwise return the
623549a68e0dSJohannes Berg  * requested element struct.
623649a68e0dSJohannes Berg  *
623749a68e0dSJohannes Berg  * Note: There are no checks on the element length other than
623849a68e0dSJohannes Berg  * having to fit into the given data.
623949a68e0dSJohannes Berg  */
624049a68e0dSJohannes Berg static inline const struct element *
624149a68e0dSJohannes Berg cfg80211_find_ext_elem(u8 ext_eid, const u8 *ies, int len)
624249a68e0dSJohannes Berg {
624349a68e0dSJohannes Berg 	return cfg80211_find_elem_match(WLAN_EID_EXTENSION, ies, len,
624449a68e0dSJohannes Berg 					&ext_eid, 1, 0);
624549a68e0dSJohannes Berg }
624649a68e0dSJohannes Berg 
624749a68e0dSJohannes Berg /**
62483f817fe7SJouni Malinen  * cfg80211_find_ext_ie - find information element with EID Extension in data
62493f817fe7SJouni Malinen  *
62503f817fe7SJouni Malinen  * @ext_eid: element ID Extension
62513f817fe7SJouni Malinen  * @ies: data consisting of IEs
62523f817fe7SJouni Malinen  * @len: length of data
62533f817fe7SJouni Malinen  *
62543f817fe7SJouni Malinen  * Return: %NULL if the extended element ID could not be found or if
62553f817fe7SJouni Malinen  * the element is invalid (claims to be longer than the given
62563f817fe7SJouni Malinen  * data), or a pointer to the first byte of the requested
62573f817fe7SJouni Malinen  * element, that is the byte containing the element ID.
62583f817fe7SJouni Malinen  *
62593f817fe7SJouni Malinen  * Note: There are no checks on the element length other than
62603f817fe7SJouni Malinen  * having to fit into the given data.
62613f817fe7SJouni Malinen  */
62623f817fe7SJouni Malinen static inline const u8 *cfg80211_find_ext_ie(u8 ext_eid, const u8 *ies, int len)
62633f817fe7SJouni Malinen {
62643f817fe7SJouni Malinen 	return cfg80211_find_ie_match(WLAN_EID_EXTENSION, ies, len,
62653f817fe7SJouni Malinen 				      &ext_eid, 1, 2);
62663f817fe7SJouni Malinen }
62673f817fe7SJouni Malinen 
62683f817fe7SJouni Malinen /**
626949a68e0dSJohannes Berg  * cfg80211_find_vendor_elem - find vendor specific information element in data
627049a68e0dSJohannes Berg  *
627149a68e0dSJohannes Berg  * @oui: vendor OUI
627249a68e0dSJohannes Berg  * @oui_type: vendor-specific OUI type (must be < 0xff), negative means any
627349a68e0dSJohannes Berg  * @ies: data consisting of IEs
627449a68e0dSJohannes Berg  * @len: length of data
627549a68e0dSJohannes Berg  *
627649a68e0dSJohannes Berg  * Return: %NULL if the vendor specific element ID could not be found or if the
627749a68e0dSJohannes Berg  * element is invalid (claims to be longer than the given data); otherwise
627849a68e0dSJohannes Berg  * return the element structure for the requested element.
627949a68e0dSJohannes Berg  *
628049a68e0dSJohannes Berg  * Note: There are no checks on the element length other than having to fit into
628149a68e0dSJohannes Berg  * the given data.
628249a68e0dSJohannes Berg  */
628349a68e0dSJohannes Berg const struct element *cfg80211_find_vendor_elem(unsigned int oui, int oui_type,
628449a68e0dSJohannes Berg 						const u8 *ies,
628549a68e0dSJohannes Berg 						unsigned int len);
628649a68e0dSJohannes Berg 
628749a68e0dSJohannes Berg /**
62880c28ec58SEliad Peller  * cfg80211_find_vendor_ie - find vendor specific information element in data
62890c28ec58SEliad Peller  *
62900c28ec58SEliad Peller  * @oui: vendor OUI
62919e9ea439SEmmanuel Grumbach  * @oui_type: vendor-specific OUI type (must be < 0xff), negative means any
62920c28ec58SEliad Peller  * @ies: data consisting of IEs
62930c28ec58SEliad Peller  * @len: length of data
62940c28ec58SEliad Peller  *
62950ae997dcSYacine Belkadi  * Return: %NULL if the vendor specific element ID could not be found or if the
62960ae997dcSYacine Belkadi  * element is invalid (claims to be longer than the given data), or a pointer to
62970ae997dcSYacine Belkadi  * the first byte of the requested element, that is the byte containing the
62980ae997dcSYacine Belkadi  * element ID.
62990ae997dcSYacine Belkadi  *
63000ae997dcSYacine Belkadi  * Note: There are no checks on the element length other than having to fit into
63010ae997dcSYacine Belkadi  * the given data.
63020c28ec58SEliad Peller  */
630349a68e0dSJohannes Berg static inline const u8 *
630449a68e0dSJohannes Berg cfg80211_find_vendor_ie(unsigned int oui, int oui_type,
630549a68e0dSJohannes Berg 			const u8 *ies, unsigned int len)
630649a68e0dSJohannes Berg {
63077e367b06SJohannes Berg 	return (const void *)cfg80211_find_vendor_elem(oui, oui_type, ies, len);
630849a68e0dSJohannes Berg }
63090c28ec58SEliad Peller 
63100c28ec58SEliad Peller /**
631130ca1aa5SDedy Lansky  * cfg80211_send_layer2_update - send layer 2 update frame
631230ca1aa5SDedy Lansky  *
631330ca1aa5SDedy Lansky  * @dev: network device
631430ca1aa5SDedy Lansky  * @addr: STA MAC address
631530ca1aa5SDedy Lansky  *
631630ca1aa5SDedy Lansky  * Wireless drivers can use this function to update forwarding tables in bridge
631730ca1aa5SDedy Lansky  * devices upon STA association.
631830ca1aa5SDedy Lansky  */
631930ca1aa5SDedy Lansky void cfg80211_send_layer2_update(struct net_device *dev, const u8 *addr);
632030ca1aa5SDedy Lansky 
632130ca1aa5SDedy Lansky /**
6322d70e9693SJohannes Berg  * DOC: Regulatory enforcement infrastructure
6323d70e9693SJohannes Berg  *
6324d70e9693SJohannes Berg  * TODO
6325d3236553SJohannes Berg  */
6326d3236553SJohannes Berg 
6327d3236553SJohannes Berg /**
6328d3236553SJohannes Berg  * regulatory_hint - driver hint to the wireless core a regulatory domain
6329d3236553SJohannes Berg  * @wiphy: the wireless device giving the hint (used only for reporting
6330d3236553SJohannes Berg  *	conflicts)
6331d3236553SJohannes Berg  * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain
6332d3236553SJohannes Berg  *	should be in. If @rd is set this should be NULL. Note that if you
6333d3236553SJohannes Berg  *	set this to NULL you should still set rd->alpha2 to some accepted
6334d3236553SJohannes Berg  *	alpha2.
6335d3236553SJohannes Berg  *
6336d3236553SJohannes Berg  * Wireless drivers can use this function to hint to the wireless core
6337d3236553SJohannes Berg  * what it believes should be the current regulatory domain by
6338d3236553SJohannes Berg  * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory
6339d3236553SJohannes Berg  * domain should be in or by providing a completely build regulatory domain.
6340d3236553SJohannes Berg  * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried
6341d3236553SJohannes Berg  * for a regulatory domain structure for the respective country.
6342d3236553SJohannes Berg  *
6343d3236553SJohannes Berg  * The wiphy must have been registered to cfg80211 prior to this call.
6344d3236553SJohannes Berg  * For cfg80211 drivers this means you must first use wiphy_register(),
6345d3236553SJohannes Berg  * for mac80211 drivers you must first use ieee80211_register_hw().
6346d3236553SJohannes Berg  *
6347d3236553SJohannes Berg  * Drivers should check the return value, its possible you can get
6348d3236553SJohannes Berg  * an -ENOMEM.
63490ae997dcSYacine Belkadi  *
63500ae997dcSYacine Belkadi  * Return: 0 on success. -ENOMEM.
6351d3236553SJohannes Berg  */
635210dd9b7cSJoe Perches int regulatory_hint(struct wiphy *wiphy, const char *alpha2);
6353d3236553SJohannes Berg 
6354d3236553SJohannes Berg /**
6355b0d7aa59SJonathan Doron  * regulatory_set_wiphy_regd - set regdom info for self managed drivers
6356b0d7aa59SJonathan Doron  * @wiphy: the wireless device we want to process the regulatory domain on
6357b0d7aa59SJonathan Doron  * @rd: the regulatory domain informatoin to use for this wiphy
6358b0d7aa59SJonathan Doron  *
6359b0d7aa59SJonathan Doron  * Set the regulatory domain information for self-managed wiphys, only they
6360b0d7aa59SJonathan Doron  * may use this function. See %REGULATORY_WIPHY_SELF_MANAGED for more
6361b0d7aa59SJonathan Doron  * information.
6362b0d7aa59SJonathan Doron  *
6363b0d7aa59SJonathan Doron  * Return: 0 on success. -EINVAL, -EPERM
6364b0d7aa59SJonathan Doron  */
6365b0d7aa59SJonathan Doron int regulatory_set_wiphy_regd(struct wiphy *wiphy,
6366b0d7aa59SJonathan Doron 			      struct ieee80211_regdomain *rd);
6367b0d7aa59SJonathan Doron 
6368b0d7aa59SJonathan Doron /**
6369a05829a7SJohannes Berg  * regulatory_set_wiphy_regd_sync - set regdom for self-managed drivers
63702c3e861cSArik Nemtsov  * @wiphy: the wireless device we want to process the regulatory domain on
63712c3e861cSArik Nemtsov  * @rd: the regulatory domain information to use for this wiphy
63722c3e861cSArik Nemtsov  *
6373a05829a7SJohannes Berg  * This functions requires the RTNL and the wiphy mutex to be held and
6374a05829a7SJohannes Berg  * applies the new regdomain synchronously to this wiphy. For more details
6375a05829a7SJohannes Berg  * see regulatory_set_wiphy_regd().
63762c3e861cSArik Nemtsov  *
63772c3e861cSArik Nemtsov  * Return: 0 on success. -EINVAL, -EPERM
63782c3e861cSArik Nemtsov  */
6379a05829a7SJohannes Berg int regulatory_set_wiphy_regd_sync(struct wiphy *wiphy,
63802c3e861cSArik Nemtsov 				   struct ieee80211_regdomain *rd);
63812c3e861cSArik Nemtsov 
63822c3e861cSArik Nemtsov /**
6383d3236553SJohannes Berg  * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain
6384d3236553SJohannes Berg  * @wiphy: the wireless device we want to process the regulatory domain on
6385d3236553SJohannes Berg  * @regd: the custom regulatory domain to use for this wiphy
6386d3236553SJohannes Berg  *
6387d3236553SJohannes Berg  * Drivers can sometimes have custom regulatory domains which do not apply
6388d3236553SJohannes Berg  * to a specific country. Drivers can use this to apply such custom regulatory
6389d3236553SJohannes Berg  * domains. This routine must be called prior to wiphy registration. The
6390d3236553SJohannes Berg  * custom regulatory domain will be trusted completely and as such previous
6391d3236553SJohannes Berg  * default channel settings will be disregarded. If no rule is found for a
6392d3236553SJohannes Berg  * channel on the regulatory domain the channel will be disabled.
6393222ea581SLuis R. Rodriguez  * Drivers using this for a wiphy should also set the wiphy flag
6394ce26151bSKalle Valo  * REGULATORY_CUSTOM_REG or cfg80211 will set it for the wiphy
6395222ea581SLuis R. Rodriguez  * that called this helper.
6396d3236553SJohannes Berg  */
639710dd9b7cSJoe Perches void wiphy_apply_custom_regulatory(struct wiphy *wiphy,
6398d3236553SJohannes Berg 				   const struct ieee80211_regdomain *regd);
6399d3236553SJohannes Berg 
6400d3236553SJohannes Berg /**
6401d3236553SJohannes Berg  * freq_reg_info - get regulatory information for the given frequency
6402d3236553SJohannes Berg  * @wiphy: the wiphy for which we want to process this rule for
6403d3236553SJohannes Berg  * @center_freq: Frequency in KHz for which we want regulatory information for
6404d3236553SJohannes Berg  *
6405d3236553SJohannes Berg  * Use this function to get the regulatory rule for a specific frequency on
6406d3236553SJohannes Berg  * a given wireless device. If the device has a specific regulatory domain
6407d3236553SJohannes Berg  * it wants to follow we respect that unless a country IE has been received
6408d3236553SJohannes Berg  * and processed already.
6409d3236553SJohannes Berg  *
64100ae997dcSYacine Belkadi  * Return: A valid pointer, or, when an error occurs, for example if no rule
64110ae997dcSYacine Belkadi  * can be found, the return value is encoded using ERR_PTR(). Use IS_ERR() to
64120ae997dcSYacine Belkadi  * check and PTR_ERR() to obtain the numeric return value. The numeric return
64130ae997dcSYacine Belkadi  * value will be -ERANGE if we determine the given center_freq does not even
64140ae997dcSYacine Belkadi  * have a regulatory rule for a frequency range in the center_freq's band.
64150ae997dcSYacine Belkadi  * See freq_in_rule_band() for our current definition of a band -- this is
64160ae997dcSYacine Belkadi  * purely subjective and right now it's 802.11 specific.
6417d3236553SJohannes Berg  */
6418361c9c8bSJohannes Berg const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy,
6419361c9c8bSJohannes Berg 					       u32 center_freq);
6420d3236553SJohannes Berg 
6421034c6d6eSLuis R. Rodriguez /**
6422034c6d6eSLuis R. Rodriguez  * reg_initiator_name - map regulatory request initiator enum to name
6423034c6d6eSLuis R. Rodriguez  * @initiator: the regulatory request initiator
6424034c6d6eSLuis R. Rodriguez  *
6425034c6d6eSLuis R. Rodriguez  * You can use this to map the regulatory request initiator enum to a
6426034c6d6eSLuis R. Rodriguez  * proper string representation.
6427034c6d6eSLuis R. Rodriguez  */
6428034c6d6eSLuis R. Rodriguez const char *reg_initiator_name(enum nl80211_reg_initiator initiator);
6429034c6d6eSLuis R. Rodriguez 
643019d3577eSHaim Dreyfuss /**
6431dc0c18edSAaron Komisar  * regulatory_pre_cac_allowed - check if pre-CAC allowed in the current regdom
6432dc0c18edSAaron Komisar  * @wiphy: wiphy for which pre-CAC capability is checked.
6433dc0c18edSAaron Komisar  *
6434dc0c18edSAaron Komisar  * Pre-CAC is allowed only in some regdomains (notable ETSI).
6435dc0c18edSAaron Komisar  */
6436dc0c18edSAaron Komisar bool regulatory_pre_cac_allowed(struct wiphy *wiphy);
6437dc0c18edSAaron Komisar 
6438dc0c18edSAaron Komisar /**
643919d3577eSHaim Dreyfuss  * DOC: Internal regulatory db functions
644019d3577eSHaim Dreyfuss  *
644119d3577eSHaim Dreyfuss  */
644219d3577eSHaim Dreyfuss 
644319d3577eSHaim Dreyfuss /**
644419d3577eSHaim Dreyfuss  * reg_query_regdb_wmm -  Query internal regulatory db for wmm rule
644519d3577eSHaim Dreyfuss  * Regulatory self-managed driver can use it to proactively
644619d3577eSHaim Dreyfuss  *
644719d3577eSHaim Dreyfuss  * @alpha2: the ISO/IEC 3166 alpha2 wmm rule to be queried.
644819d3577eSHaim Dreyfuss  * @freq: the freqency(in MHz) to be queried.
644919d3577eSHaim Dreyfuss  * @rule: pointer to store the wmm rule from the regulatory db.
645019d3577eSHaim Dreyfuss  *
645119d3577eSHaim Dreyfuss  * Self-managed wireless drivers can use this function to  query
645219d3577eSHaim Dreyfuss  * the internal regulatory database to check whether the given
645319d3577eSHaim Dreyfuss  * ISO/IEC 3166 alpha2 country and freq have wmm rule limitations.
645419d3577eSHaim Dreyfuss  *
645519d3577eSHaim Dreyfuss  * Drivers should check the return value, its possible you can get
645619d3577eSHaim Dreyfuss  * an -ENODATA.
645719d3577eSHaim Dreyfuss  *
645819d3577eSHaim Dreyfuss  * Return: 0 on success. -ENODATA.
645919d3577eSHaim Dreyfuss  */
646038cb87eeSStanislaw Gruszka int reg_query_regdb_wmm(char *alpha2, int freq,
646138cb87eeSStanislaw Gruszka 			struct ieee80211_reg_rule *rule);
646219d3577eSHaim Dreyfuss 
6463d3236553SJohannes Berg /*
6464d3236553SJohannes Berg  * callbacks for asynchronous cfg80211 methods, notification
6465d3236553SJohannes Berg  * functions and BSS handling helpers
6466d3236553SJohannes Berg  */
6467d3236553SJohannes Berg 
64682a519311SJohannes Berg /**
64692a519311SJohannes Berg  * cfg80211_scan_done - notify that scan finished
64702a519311SJohannes Berg  *
64712a519311SJohannes Berg  * @request: the corresponding scan request
64721d76250bSAvraham Stern  * @info: information about the completed scan
64732a519311SJohannes Berg  */
64741d76250bSAvraham Stern void cfg80211_scan_done(struct cfg80211_scan_request *request,
64751d76250bSAvraham Stern 			struct cfg80211_scan_info *info);
64762a519311SJohannes Berg 
64772a519311SJohannes Berg /**
6478807f8a8cSLuciano Coelho  * cfg80211_sched_scan_results - notify that new scan results are available
6479807f8a8cSLuciano Coelho  *
6480807f8a8cSLuciano Coelho  * @wiphy: the wiphy which got scheduled scan results
6481b34939b9SArend Van Spriel  * @reqid: identifier for the related scheduled scan request
6482807f8a8cSLuciano Coelho  */
6483b34939b9SArend Van Spriel void cfg80211_sched_scan_results(struct wiphy *wiphy, u64 reqid);
6484807f8a8cSLuciano Coelho 
6485807f8a8cSLuciano Coelho /**
6486807f8a8cSLuciano Coelho  * cfg80211_sched_scan_stopped - notify that the scheduled scan has stopped
6487807f8a8cSLuciano Coelho  *
6488807f8a8cSLuciano Coelho  * @wiphy: the wiphy on which the scheduled scan stopped
6489b34939b9SArend Van Spriel  * @reqid: identifier for the related scheduled scan request
6490807f8a8cSLuciano Coelho  *
6491807f8a8cSLuciano Coelho  * The driver can call this function to inform cfg80211 that the
6492807f8a8cSLuciano Coelho  * scheduled scan had to be stopped, for whatever reason.  The driver
6493807f8a8cSLuciano Coelho  * is then called back via the sched_scan_stop operation when done.
6494807f8a8cSLuciano Coelho  */
6495b34939b9SArend Van Spriel void cfg80211_sched_scan_stopped(struct wiphy *wiphy, u64 reqid);
6496807f8a8cSLuciano Coelho 
6497807f8a8cSLuciano Coelho /**
6498a05829a7SJohannes Berg  * cfg80211_sched_scan_stopped_locked - notify that the scheduled scan has stopped
6499792e6aa7SEliad Peller  *
6500792e6aa7SEliad Peller  * @wiphy: the wiphy on which the scheduled scan stopped
6501b34939b9SArend Van Spriel  * @reqid: identifier for the related scheduled scan request
6502792e6aa7SEliad Peller  *
6503792e6aa7SEliad Peller  * The driver can call this function to inform cfg80211 that the
6504792e6aa7SEliad Peller  * scheduled scan had to be stopped, for whatever reason.  The driver
6505792e6aa7SEliad Peller  * is then called back via the sched_scan_stop operation when done.
6506a05829a7SJohannes Berg  * This function should be called with the wiphy mutex held.
6507792e6aa7SEliad Peller  */
6508a05829a7SJohannes Berg void cfg80211_sched_scan_stopped_locked(struct wiphy *wiphy, u64 reqid);
6509792e6aa7SEliad Peller 
6510792e6aa7SEliad Peller /**
65116e19bc4bSDmitry Shmidt  * cfg80211_inform_bss_frame_data - inform cfg80211 of a received BSS frame
65122a519311SJohannes Berg  * @wiphy: the wiphy reporting the BSS
65136e19bc4bSDmitry Shmidt  * @data: the BSS metadata
6514abe37c4bSJohannes Berg  * @mgmt: the management frame (probe response or beacon)
6515abe37c4bSJohannes Berg  * @len: length of the management frame
65162a519311SJohannes Berg  * @gfp: context flags
65172a519311SJohannes Berg  *
65182a519311SJohannes Berg  * This informs cfg80211 that BSS information was found and
65192a519311SJohannes Berg  * the BSS should be updated/added.
6520ef100682SJohannes Berg  *
65210ae997dcSYacine Belkadi  * Return: A referenced struct, must be released with cfg80211_put_bss()!
65220ae997dcSYacine Belkadi  * Or %NULL on error.
65232a519311SJohannes Berg  */
6524ef100682SJohannes Berg struct cfg80211_bss * __must_check
65256e19bc4bSDmitry Shmidt cfg80211_inform_bss_frame_data(struct wiphy *wiphy,
65266e19bc4bSDmitry Shmidt 			       struct cfg80211_inform_bss *data,
65276e19bc4bSDmitry Shmidt 			       struct ieee80211_mgmt *mgmt, size_t len,
65286e19bc4bSDmitry Shmidt 			       gfp_t gfp);
65296e19bc4bSDmitry Shmidt 
65306e19bc4bSDmitry Shmidt static inline struct cfg80211_bss * __must_check
6531dcd6eac1SSimon Wunderlich cfg80211_inform_bss_width_frame(struct wiphy *wiphy,
65323afc2167SEmmanuel Grumbach 				struct ieee80211_channel *rx_channel,
6533dcd6eac1SSimon Wunderlich 				enum nl80211_bss_scan_width scan_width,
6534dcd6eac1SSimon Wunderlich 				struct ieee80211_mgmt *mgmt, size_t len,
65356e19bc4bSDmitry Shmidt 				s32 signal, gfp_t gfp)
65366e19bc4bSDmitry Shmidt {
65376e19bc4bSDmitry Shmidt 	struct cfg80211_inform_bss data = {
65386e19bc4bSDmitry Shmidt 		.chan = rx_channel,
65396e19bc4bSDmitry Shmidt 		.scan_width = scan_width,
65406e19bc4bSDmitry Shmidt 		.signal = signal,
65416e19bc4bSDmitry Shmidt 	};
65426e19bc4bSDmitry Shmidt 
65436e19bc4bSDmitry Shmidt 	return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp);
65446e19bc4bSDmitry Shmidt }
6545dcd6eac1SSimon Wunderlich 
6546dcd6eac1SSimon Wunderlich static inline struct cfg80211_bss * __must_check
65472a519311SJohannes Berg cfg80211_inform_bss_frame(struct wiphy *wiphy,
65483afc2167SEmmanuel Grumbach 			  struct ieee80211_channel *rx_channel,
65492a519311SJohannes Berg 			  struct ieee80211_mgmt *mgmt, size_t len,
6550dcd6eac1SSimon Wunderlich 			  s32 signal, gfp_t gfp)
6551dcd6eac1SSimon Wunderlich {
65526e19bc4bSDmitry Shmidt 	struct cfg80211_inform_bss data = {
65536e19bc4bSDmitry Shmidt 		.chan = rx_channel,
65546e19bc4bSDmitry Shmidt 		.scan_width = NL80211_BSS_CHAN_WIDTH_20,
65556e19bc4bSDmitry Shmidt 		.signal = signal,
65566e19bc4bSDmitry Shmidt 	};
65576e19bc4bSDmitry Shmidt 
65586e19bc4bSDmitry Shmidt 	return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp);
6559dcd6eac1SSimon Wunderlich }
65602a519311SJohannes Berg 
6561abe37c4bSJohannes Berg /**
65627ece9c37SSara Sharon  * cfg80211_gen_new_bssid - generate a nontransmitted BSSID for multi-BSSID
65637ece9c37SSara Sharon  * @bssid: transmitter BSSID
65647ece9c37SSara Sharon  * @max_bssid: max BSSID indicator, taken from Multiple BSSID element
65657ece9c37SSara Sharon  * @mbssid_index: BSSID index, taken from Multiple BSSID index element
65665d4071abSJohannes Berg  * @new_bssid: calculated nontransmitted BSSID
65677ece9c37SSara Sharon  */
65687ece9c37SSara Sharon static inline void cfg80211_gen_new_bssid(const u8 *bssid, u8 max_bssid,
65695d4071abSJohannes Berg 					  u8 mbssid_index, u8 *new_bssid)
65707ece9c37SSara Sharon {
65715d4071abSJohannes Berg 	u64 bssid_u64 = ether_addr_to_u64(bssid);
65725d4071abSJohannes Berg 	u64 mask = GENMASK_ULL(max_bssid - 1, 0);
65735d4071abSJohannes Berg 	u64 new_bssid_u64;
65747ece9c37SSara Sharon 
65755d4071abSJohannes Berg 	new_bssid_u64 = bssid_u64 & ~mask;
65767ece9c37SSara Sharon 
65775d4071abSJohannes Berg 	new_bssid_u64 |= ((bssid_u64 & mask) + mbssid_index) & mask;
65787ece9c37SSara Sharon 
65795d4071abSJohannes Berg 	u64_to_ether_addr(new_bssid_u64, new_bssid);
65807ece9c37SSara Sharon }
65817ece9c37SSara Sharon 
65827ece9c37SSara Sharon /**
6583f7dacfb1SSara Sharon  * cfg80211_is_element_inherited - returns if element ID should be inherited
6584f7dacfb1SSara Sharon  * @element: element to check
6585f7dacfb1SSara Sharon  * @non_inherit_element: non inheritance element
6586f7dacfb1SSara Sharon  */
6587f7dacfb1SSara Sharon bool cfg80211_is_element_inherited(const struct element *element,
6588f7dacfb1SSara Sharon 				   const struct element *non_inherit_element);
6589f7dacfb1SSara Sharon 
6590f7dacfb1SSara Sharon /**
6591fe806e49SSara Sharon  * cfg80211_merge_profile - merges a MBSSID profile if it is split between IEs
6592fe806e49SSara Sharon  * @ie: ies
6593fe806e49SSara Sharon  * @ielen: length of IEs
6594fe806e49SSara Sharon  * @mbssid_elem: current MBSSID element
6595fe806e49SSara Sharon  * @sub_elem: current MBSSID subelement (profile)
6596fe806e49SSara Sharon  * @merged_ie: location of the merged profile
6597fe806e49SSara Sharon  * @max_copy_len: max merged profile length
6598fe806e49SSara Sharon  */
6599fe806e49SSara Sharon size_t cfg80211_merge_profile(const u8 *ie, size_t ielen,
6600fe806e49SSara Sharon 			      const struct element *mbssid_elem,
6601fe806e49SSara Sharon 			      const struct element *sub_elem,
66025809a5d5SDan Carpenter 			      u8 *merged_ie, size_t max_copy_len);
6603fe806e49SSara Sharon 
6604fe806e49SSara Sharon /**
66055bc8c1f2SJohannes Berg  * enum cfg80211_bss_frame_type - frame type that the BSS data came from
66065bc8c1f2SJohannes Berg  * @CFG80211_BSS_FTYPE_UNKNOWN: driver doesn't know whether the data is
66075bc8c1f2SJohannes Berg  *	from a beacon or probe response
66085bc8c1f2SJohannes Berg  * @CFG80211_BSS_FTYPE_BEACON: data comes from a beacon
66095bc8c1f2SJohannes Berg  * @CFG80211_BSS_FTYPE_PRESP: data comes from a probe response
66105bc8c1f2SJohannes Berg  */
66115bc8c1f2SJohannes Berg enum cfg80211_bss_frame_type {
66125bc8c1f2SJohannes Berg 	CFG80211_BSS_FTYPE_UNKNOWN,
66135bc8c1f2SJohannes Berg 	CFG80211_BSS_FTYPE_BEACON,
66145bc8c1f2SJohannes Berg 	CFG80211_BSS_FTYPE_PRESP,
66155bc8c1f2SJohannes Berg };
66165bc8c1f2SJohannes Berg 
66175bc8c1f2SJohannes Berg /**
66187f599aecSAyala Beker  * cfg80211_get_ies_channel_number - returns the channel number from ies
66197f599aecSAyala Beker  * @ie: IEs
66207f599aecSAyala Beker  * @ielen: length of IEs
66217f599aecSAyala Beker  * @band: enum nl80211_band of the channel
66227f599aecSAyala Beker  * @ftype: frame type
66237f599aecSAyala Beker  *
66247f599aecSAyala Beker  * Returns the channel number, or -1 if none could be determined.
66257f599aecSAyala Beker  */
66267f599aecSAyala Beker int cfg80211_get_ies_channel_number(const u8 *ie, size_t ielen,
66277f599aecSAyala Beker 				    enum nl80211_band band,
66287f599aecSAyala Beker 				    enum cfg80211_bss_frame_type ftype);
66297f599aecSAyala Beker 
66307f599aecSAyala Beker /**
66316e19bc4bSDmitry Shmidt  * cfg80211_inform_bss_data - inform cfg80211 of a new BSS
6632abe37c4bSJohannes Berg  *
6633abe37c4bSJohannes Berg  * @wiphy: the wiphy reporting the BSS
66346e19bc4bSDmitry Shmidt  * @data: the BSS metadata
66355bc8c1f2SJohannes Berg  * @ftype: frame type (if known)
6636abe37c4bSJohannes Berg  * @bssid: the BSSID of the BSS
66377b8bcff2SJohannes Berg  * @tsf: the TSF sent by the peer in the beacon/probe response (or 0)
6638abe37c4bSJohannes Berg  * @capability: the capability field sent by the peer
6639abe37c4bSJohannes Berg  * @beacon_interval: the beacon interval announced by the peer
6640abe37c4bSJohannes Berg  * @ie: additional IEs sent by the peer
6641abe37c4bSJohannes Berg  * @ielen: length of the additional IEs
6642abe37c4bSJohannes Berg  * @gfp: context flags
6643abe37c4bSJohannes Berg  *
6644abe37c4bSJohannes Berg  * This informs cfg80211 that BSS information was found and
6645abe37c4bSJohannes Berg  * the BSS should be updated/added.
6646ef100682SJohannes Berg  *
66470ae997dcSYacine Belkadi  * Return: A referenced struct, must be released with cfg80211_put_bss()!
66480ae997dcSYacine Belkadi  * Or %NULL on error.
6649abe37c4bSJohannes Berg  */
6650ef100682SJohannes Berg struct cfg80211_bss * __must_check
66516e19bc4bSDmitry Shmidt cfg80211_inform_bss_data(struct wiphy *wiphy,
66526e19bc4bSDmitry Shmidt 			 struct cfg80211_inform_bss *data,
66536e19bc4bSDmitry Shmidt 			 enum cfg80211_bss_frame_type ftype,
66546e19bc4bSDmitry Shmidt 			 const u8 *bssid, u64 tsf, u16 capability,
66556e19bc4bSDmitry Shmidt 			 u16 beacon_interval, const u8 *ie, size_t ielen,
66566e19bc4bSDmitry Shmidt 			 gfp_t gfp);
66576e19bc4bSDmitry Shmidt 
66586e19bc4bSDmitry Shmidt static inline struct cfg80211_bss * __must_check
6659dcd6eac1SSimon Wunderlich cfg80211_inform_bss_width(struct wiphy *wiphy,
66603afc2167SEmmanuel Grumbach 			  struct ieee80211_channel *rx_channel,
6661dcd6eac1SSimon Wunderlich 			  enum nl80211_bss_scan_width scan_width,
66625bc8c1f2SJohannes Berg 			  enum cfg80211_bss_frame_type ftype,
6663dcd6eac1SSimon Wunderlich 			  const u8 *bssid, u64 tsf, u16 capability,
6664dcd6eac1SSimon Wunderlich 			  u16 beacon_interval, const u8 *ie, size_t ielen,
66656e19bc4bSDmitry Shmidt 			  s32 signal, gfp_t gfp)
66666e19bc4bSDmitry Shmidt {
66676e19bc4bSDmitry Shmidt 	struct cfg80211_inform_bss data = {
66686e19bc4bSDmitry Shmidt 		.chan = rx_channel,
66696e19bc4bSDmitry Shmidt 		.scan_width = scan_width,
66706e19bc4bSDmitry Shmidt 		.signal = signal,
66716e19bc4bSDmitry Shmidt 	};
66726e19bc4bSDmitry Shmidt 
66736e19bc4bSDmitry Shmidt 	return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf,
66746e19bc4bSDmitry Shmidt 					capability, beacon_interval, ie, ielen,
66756e19bc4bSDmitry Shmidt 					gfp);
66766e19bc4bSDmitry Shmidt }
6677dcd6eac1SSimon Wunderlich 
6678dcd6eac1SSimon Wunderlich static inline struct cfg80211_bss * __must_check
667906aa7afaSJussi Kivilinna cfg80211_inform_bss(struct wiphy *wiphy,
66803afc2167SEmmanuel Grumbach 		    struct ieee80211_channel *rx_channel,
66815bc8c1f2SJohannes Berg 		    enum cfg80211_bss_frame_type ftype,
66827b8bcff2SJohannes Berg 		    const u8 *bssid, u64 tsf, u16 capability,
66837b8bcff2SJohannes Berg 		    u16 beacon_interval, const u8 *ie, size_t ielen,
6684dcd6eac1SSimon Wunderlich 		    s32 signal, gfp_t gfp)
6685dcd6eac1SSimon Wunderlich {
66866e19bc4bSDmitry Shmidt 	struct cfg80211_inform_bss data = {
66876e19bc4bSDmitry Shmidt 		.chan = rx_channel,
66886e19bc4bSDmitry Shmidt 		.scan_width = NL80211_BSS_CHAN_WIDTH_20,
66896e19bc4bSDmitry Shmidt 		.signal = signal,
66906e19bc4bSDmitry Shmidt 	};
66916e19bc4bSDmitry Shmidt 
66926e19bc4bSDmitry Shmidt 	return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf,
66936e19bc4bSDmitry Shmidt 					capability, beacon_interval, ie, ielen,
6694dcd6eac1SSimon Wunderlich 					gfp);
6695dcd6eac1SSimon Wunderlich }
669606aa7afaSJussi Kivilinna 
669727548677SJohannes Berg /**
669827548677SJohannes Berg  * cfg80211_get_bss - get a BSS reference
669927548677SJohannes Berg  * @wiphy: the wiphy this BSS struct belongs to
670027548677SJohannes Berg  * @channel: the channel to search on (or %NULL)
670127548677SJohannes Berg  * @bssid: the desired BSSID (or %NULL)
670227548677SJohannes Berg  * @ssid: the desired SSID (or %NULL)
670327548677SJohannes Berg  * @ssid_len: length of the SSID (or 0)
670427548677SJohannes Berg  * @bss_type: type of BSS, see &enum ieee80211_bss_type
670527548677SJohannes Berg  * @privacy: privacy filter, see &enum ieee80211_privacy
670627548677SJohannes Berg  */
67072a519311SJohannes Berg struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
67082a519311SJohannes Berg 				      struct ieee80211_channel *channel,
67092a519311SJohannes Berg 				      const u8 *bssid,
671079420f09SJohannes Berg 				      const u8 *ssid, size_t ssid_len,
67116eb18137SDedy Lansky 				      enum ieee80211_bss_type bss_type,
671227548677SJohannes Berg 				      enum ieee80211_privacy privacy);
671379420f09SJohannes Berg static inline struct cfg80211_bss *
671479420f09SJohannes Berg cfg80211_get_ibss(struct wiphy *wiphy,
671579420f09SJohannes Berg 		  struct ieee80211_channel *channel,
671679420f09SJohannes Berg 		  const u8 *ssid, size_t ssid_len)
671779420f09SJohannes Berg {
671879420f09SJohannes Berg 	return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len,
67196eb18137SDedy Lansky 				IEEE80211_BSS_TYPE_IBSS,
67206eb18137SDedy Lansky 				IEEE80211_PRIVACY_ANY);
672179420f09SJohannes Berg }
672279420f09SJohannes Berg 
67234c0c0b75SJohannes Berg /**
67244c0c0b75SJohannes Berg  * cfg80211_ref_bss - reference BSS struct
67255b112d3dSJohannes Berg  * @wiphy: the wiphy this BSS struct belongs to
67264c0c0b75SJohannes Berg  * @bss: the BSS struct to reference
67274c0c0b75SJohannes Berg  *
67284c0c0b75SJohannes Berg  * Increments the refcount of the given BSS struct.
67294c0c0b75SJohannes Berg  */
67305b112d3dSJohannes Berg void cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
67314c0c0b75SJohannes Berg 
67324c0c0b75SJohannes Berg /**
67334c0c0b75SJohannes Berg  * cfg80211_put_bss - unref BSS struct
67345b112d3dSJohannes Berg  * @wiphy: the wiphy this BSS struct belongs to
67354c0c0b75SJohannes Berg  * @bss: the BSS struct
67364c0c0b75SJohannes Berg  *
67374c0c0b75SJohannes Berg  * Decrements the refcount of the given BSS struct.
67384c0c0b75SJohannes Berg  */
67395b112d3dSJohannes Berg void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
6740d3236553SJohannes Berg 
6741d491af19SJohannes Berg /**
6742d491af19SJohannes Berg  * cfg80211_unlink_bss - unlink BSS from internal data structures
6743d491af19SJohannes Berg  * @wiphy: the wiphy
6744d491af19SJohannes Berg  * @bss: the bss to remove
6745d491af19SJohannes Berg  *
6746d491af19SJohannes Berg  * This function removes the given BSS from the internal data structures
6747d491af19SJohannes Berg  * thereby making it no longer show up in scan results etc. Use this
6748d491af19SJohannes Berg  * function when you detect a BSS is gone. Normally BSSes will also time
6749d491af19SJohannes Berg  * out, so it is not necessary to use this function at all.
6750d491af19SJohannes Berg  */
6751d491af19SJohannes Berg void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
6752fee52678SJohannes Berg 
67534770c8f9SIlan Peer /**
67544770c8f9SIlan Peer  * cfg80211_bss_iter - iterate all BSS entries
67554770c8f9SIlan Peer  *
67564770c8f9SIlan Peer  * This function iterates over the BSS entries associated with the given wiphy
67574770c8f9SIlan Peer  * and calls the callback for the iterated BSS. The iterator function is not
67584770c8f9SIlan Peer  * allowed to call functions that might modify the internal state of the BSS DB.
67594770c8f9SIlan Peer  *
67604770c8f9SIlan Peer  * @wiphy: the wiphy
67614770c8f9SIlan Peer  * @chandef: if given, the iterator function will be called only if the channel
67624770c8f9SIlan Peer  *     of the currently iterated BSS is a subset of the given channel.
67634770c8f9SIlan Peer  * @iter: the iterator function to call
67644770c8f9SIlan Peer  * @iter_data: an argument to the iterator function
67654770c8f9SIlan Peer  */
67664770c8f9SIlan Peer void cfg80211_bss_iter(struct wiphy *wiphy,
67674770c8f9SIlan Peer 		       struct cfg80211_chan_def *chandef,
67684770c8f9SIlan Peer 		       void (*iter)(struct wiphy *wiphy,
67694770c8f9SIlan Peer 				    struct cfg80211_bss *bss,
67704770c8f9SIlan Peer 				    void *data),
67714770c8f9SIlan Peer 		       void *iter_data);
67724770c8f9SIlan Peer 
6773dcd6eac1SSimon Wunderlich static inline enum nl80211_bss_scan_width
6774dcd6eac1SSimon Wunderlich cfg80211_chandef_to_scan_width(const struct cfg80211_chan_def *chandef)
6775dcd6eac1SSimon Wunderlich {
6776dcd6eac1SSimon Wunderlich 	switch (chandef->width) {
6777dcd6eac1SSimon Wunderlich 	case NL80211_CHAN_WIDTH_5:
6778dcd6eac1SSimon Wunderlich 		return NL80211_BSS_CHAN_WIDTH_5;
6779dcd6eac1SSimon Wunderlich 	case NL80211_CHAN_WIDTH_10:
6780dcd6eac1SSimon Wunderlich 		return NL80211_BSS_CHAN_WIDTH_10;
6781dcd6eac1SSimon Wunderlich 	default:
6782dcd6eac1SSimon Wunderlich 		return NL80211_BSS_CHAN_WIDTH_20;
6783dcd6eac1SSimon Wunderlich 	}
6784dcd6eac1SSimon Wunderlich }
6785dcd6eac1SSimon Wunderlich 
67866039f6d2SJouni Malinen /**
67876ff57cf8SJohannes Berg  * cfg80211_rx_mlme_mgmt - notification of processed MLME management frame
67886039f6d2SJouni Malinen  * @dev: network device
67896039f6d2SJouni Malinen  * @buf: authentication frame (header + body)
67906039f6d2SJouni Malinen  * @len: length of the frame data
67916039f6d2SJouni Malinen  *
67926ff57cf8SJohannes Berg  * This function is called whenever an authentication, disassociation or
67936ff57cf8SJohannes Berg  * deauthentication frame has been received and processed in station mode.
67946ff57cf8SJohannes Berg  * After being asked to authenticate via cfg80211_ops::auth() the driver must
67956ff57cf8SJohannes Berg  * call either this function or cfg80211_auth_timeout().
67966ff57cf8SJohannes Berg  * After being asked to associate via cfg80211_ops::assoc() the driver must
67976ff57cf8SJohannes Berg  * call either this function or cfg80211_auth_timeout().
67986ff57cf8SJohannes Berg  * While connected, the driver must calls this for received and processed
67996ff57cf8SJohannes Berg  * disassociation and deauthentication frames. If the frame couldn't be used
68006ff57cf8SJohannes Berg  * because it was unprotected, the driver must call the function
68016ff57cf8SJohannes Berg  * cfg80211_rx_unprot_mlme_mgmt() instead.
68026ff57cf8SJohannes Berg  *
68036ff57cf8SJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's mutex.
68046039f6d2SJouni Malinen  */
68056ff57cf8SJohannes Berg void cfg80211_rx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len);
68066039f6d2SJouni Malinen 
68076039f6d2SJouni Malinen /**
68086ff57cf8SJohannes Berg  * cfg80211_auth_timeout - notification of timed out authentication
68091965c853SJouni Malinen  * @dev: network device
68101965c853SJouni Malinen  * @addr: The MAC address of the device with which the authentication timed out
6811cb0b4bebSJohannes Berg  *
68128d61ffa5SJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's
68138d61ffa5SJohannes Berg  * mutex.
68141965c853SJouni Malinen  */
68156ff57cf8SJohannes Berg void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr);
68161965c853SJouni Malinen 
68171965c853SJouni Malinen /**
68186ff57cf8SJohannes Berg  * cfg80211_rx_assoc_resp - notification of processed association response
68196039f6d2SJouni Malinen  * @dev: network device
68206ff57cf8SJohannes Berg  * @bss: the BSS that association was requested with, ownership of the pointer
68216ff57cf8SJohannes Berg  *	moves to cfg80211 in this call
68224d9ec73dSJouni Malinen  * @buf: (Re)Association Response frame (header + body)
68236039f6d2SJouni Malinen  * @len: length of the frame data
6824f438ceb8SEmmanuel Grumbach  * @uapsd_queues: bitmap of queues configured for uapsd. Same format
6825f438ceb8SEmmanuel Grumbach  *	as the AC bitmap in the QoS info field
68264d9ec73dSJouni Malinen  * @req_ies: information elements from the (Re)Association Request frame
68274d9ec73dSJouni Malinen  * @req_ies_len: length of req_ies data
68286039f6d2SJouni Malinen  *
68296ff57cf8SJohannes Berg  * After being asked to associate via cfg80211_ops::assoc() the driver must
68306ff57cf8SJohannes Berg  * call either this function or cfg80211_auth_timeout().
68316ff57cf8SJohannes Berg  *
68326ff57cf8SJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's mutex.
68336039f6d2SJouni Malinen  */
68346ff57cf8SJohannes Berg void cfg80211_rx_assoc_resp(struct net_device *dev,
68356ff57cf8SJohannes Berg 			    struct cfg80211_bss *bss,
6836b0b6aa2cSEliad Peller 			    const u8 *buf, size_t len,
68374d9ec73dSJouni Malinen 			    int uapsd_queues,
68384d9ec73dSJouni Malinen 			    const u8 *req_ies, size_t req_ies_len);
68396039f6d2SJouni Malinen 
68406039f6d2SJouni Malinen /**
68416ff57cf8SJohannes Berg  * cfg80211_assoc_timeout - notification of timed out association
68421965c853SJouni Malinen  * @dev: network device
6843959867faSJohannes Berg  * @bss: The BSS entry with which association timed out.
6844cb0b4bebSJohannes Berg  *
68458d61ffa5SJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's mutex.
68461965c853SJouni Malinen  */
6847959867faSJohannes Berg void cfg80211_assoc_timeout(struct net_device *dev, struct cfg80211_bss *bss);
68481965c853SJouni Malinen 
68491965c853SJouni Malinen /**
6850e6f462dfSJohannes Berg  * cfg80211_abandon_assoc - notify cfg80211 of abandoned association attempt
6851e6f462dfSJohannes Berg  * @dev: network device
6852e6f462dfSJohannes Berg  * @bss: The BSS entry with which association was abandoned.
6853e6f462dfSJohannes Berg  *
6854e6f462dfSJohannes Berg  * Call this whenever - for reasons reported through other API, like deauth RX,
6855e6f462dfSJohannes Berg  * an association attempt was abandoned.
6856e6f462dfSJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's mutex.
6857e6f462dfSJohannes Berg  */
6858e6f462dfSJohannes Berg void cfg80211_abandon_assoc(struct net_device *dev, struct cfg80211_bss *bss);
6859e6f462dfSJohannes Berg 
6860e6f462dfSJohannes Berg /**
68616ff57cf8SJohannes Berg  * cfg80211_tx_mlme_mgmt - notification of transmitted deauth/disassoc frame
68626039f6d2SJouni Malinen  * @dev: network device
68636ff57cf8SJohannes Berg  * @buf: 802.11 frame (header + body)
68646039f6d2SJouni Malinen  * @len: length of the frame data
68653bb02143SJohannes Berg  * @reconnect: immediate reconnect is desired (include the nl80211 attribute)
68666039f6d2SJouni Malinen  *
68676039f6d2SJouni Malinen  * This function is called whenever deauthentication has been processed in
686853b46b84SJouni Malinen  * station mode. This includes both received deauthentication frames and
68698d61ffa5SJohannes Berg  * locally generated ones. This function may sleep. The caller must hold the
68708d61ffa5SJohannes Berg  * corresponding wdev's mutex.
68716039f6d2SJouni Malinen  */
68723bb02143SJohannes Berg void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len,
68733bb02143SJohannes Berg 			   bool reconnect);
6874ce470613SHolger Schurig 
6875ce470613SHolger Schurig /**
68766ff57cf8SJohannes Berg  * cfg80211_rx_unprot_mlme_mgmt - notification of unprotected mlme mgmt frame
6877cf4e594eSJouni Malinen  * @dev: network device
68784d797fceSJouni Malinen  * @buf: received management frame (header + body)
6879cf4e594eSJouni Malinen  * @len: length of the frame data
6880cf4e594eSJouni Malinen  *
68816ff57cf8SJohannes Berg  * This function is called whenever a received deauthentication or dissassoc
68826ff57cf8SJohannes Berg  * frame has been dropped in station mode because of MFP being used but the
68834d797fceSJouni Malinen  * frame was not protected. This is also used to notify reception of a Beacon
68844d797fceSJouni Malinen  * frame that was dropped because it did not include a valid MME MIC while
68854d797fceSJouni Malinen  * beacon protection was enabled (BIGTK configured in station mode).
68864d797fceSJouni Malinen  *
68874d797fceSJouni Malinen  * This function may sleep.
6888cf4e594eSJouni Malinen  */
68896ff57cf8SJohannes Berg void cfg80211_rx_unprot_mlme_mgmt(struct net_device *dev,
68906ff57cf8SJohannes Berg 				  const u8 *buf, size_t len);
6891cf4e594eSJouni Malinen 
6892cf4e594eSJouni Malinen /**
6893a3b8b056SJouni Malinen  * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP)
6894a3b8b056SJouni Malinen  * @dev: network device
6895a3b8b056SJouni Malinen  * @addr: The source MAC address of the frame
6896a3b8b056SJouni Malinen  * @key_type: The key type that the received frame used
6897a66b98dbSArik Nemtsov  * @key_id: Key identifier (0..3). Can be -1 if missing.
6898a3b8b056SJouni Malinen  * @tsc: The TSC value of the frame that generated the MIC failure (6 octets)
6899e6d6e342SJohannes Berg  * @gfp: allocation flags
6900a3b8b056SJouni Malinen  *
6901a3b8b056SJouni Malinen  * This function is called whenever the local MAC detects a MIC failure in a
6902a3b8b056SJouni Malinen  * received frame. This matches with MLME-MICHAELMICFAILURE.indication()
6903a3b8b056SJouni Malinen  * primitive.
6904a3b8b056SJouni Malinen  */
6905a3b8b056SJouni Malinen void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,
6906a3b8b056SJouni Malinen 				  enum nl80211_key_type key_type, int key_id,
6907e6d6e342SJohannes Berg 				  const u8 *tsc, gfp_t gfp);
6908a3b8b056SJouni Malinen 
690904a773adSJohannes Berg /**
691004a773adSJohannes Berg  * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS
691104a773adSJohannes Berg  *
691204a773adSJohannes Berg  * @dev: network device
691304a773adSJohannes Berg  * @bssid: the BSSID of the IBSS joined
6914fe94f3a4SAntonio Quartulli  * @channel: the channel of the IBSS joined
691504a773adSJohannes Berg  * @gfp: allocation flags
691604a773adSJohannes Berg  *
691704a773adSJohannes Berg  * This function notifies cfg80211 that the device joined an IBSS or
691804a773adSJohannes Berg  * switched to a different BSSID. Before this function can be called,
691904a773adSJohannes Berg  * either a beacon has to have been received from the IBSS, or one of
692004a773adSJohannes Berg  * the cfg80211_inform_bss{,_frame} functions must have been called
692104a773adSJohannes Berg  * with the locally generated beacon -- this guarantees that there is
692204a773adSJohannes Berg  * always a scan result for this IBSS. cfg80211 will handle the rest.
692304a773adSJohannes Berg  */
6924fe94f3a4SAntonio Quartulli void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid,
6925fe94f3a4SAntonio Quartulli 			  struct ieee80211_channel *channel, gfp_t gfp);
692604a773adSJohannes Berg 
69271f87f7d3SJohannes Berg /**
6928b1e8eb11SMauro Carvalho Chehab  * cfg80211_notify_new_peer_candidate - notify cfg80211 of a new mesh peer
6929b1e8eb11SMauro Carvalho Chehab  * 					candidate
6930c93b5e71SJavier Cardona  *
6931c93b5e71SJavier Cardona  * @dev: network device
6932c93b5e71SJavier Cardona  * @macaddr: the MAC address of the new candidate
6933c93b5e71SJavier Cardona  * @ie: information elements advertised by the peer candidate
69345ac4a12dSMatteo Croce  * @ie_len: length of the information elements buffer
6935c93b5e71SJavier Cardona  * @gfp: allocation flags
6936c93b5e71SJavier Cardona  *
6937c93b5e71SJavier Cardona  * This function notifies cfg80211 that the mesh peer candidate has been
6938c93b5e71SJavier Cardona  * detected, most likely via a beacon or, less likely, via a probe response.
6939c93b5e71SJavier Cardona  * cfg80211 then sends a notification to userspace.
6940c93b5e71SJavier Cardona  */
6941c93b5e71SJavier Cardona void cfg80211_notify_new_peer_candidate(struct net_device *dev,
6942ecbc12adSBob Copeland 		const u8 *macaddr, const u8 *ie, u8 ie_len,
6943ecbc12adSBob Copeland 		int sig_dbm, gfp_t gfp);
6944c93b5e71SJavier Cardona 
6945c93b5e71SJavier Cardona /**
6946d70e9693SJohannes Berg  * DOC: RFkill integration
6947d70e9693SJohannes Berg  *
6948d70e9693SJohannes Berg  * RFkill integration in cfg80211 is almost invisible to drivers,
6949d70e9693SJohannes Berg  * as cfg80211 automatically registers an rfkill instance for each
6950d70e9693SJohannes Berg  * wireless device it knows about. Soft kill is also translated
6951d70e9693SJohannes Berg  * into disconnecting and turning all interfaces off, drivers are
6952d70e9693SJohannes Berg  * expected to turn off the device when all interfaces are down.
6953d70e9693SJohannes Berg  *
6954d70e9693SJohannes Berg  * However, devices may have a hard RFkill line, in which case they
6955d70e9693SJohannes Berg  * also need to interact with the rfkill subsystem, via cfg80211.
6956d70e9693SJohannes Berg  * They can do this with a few helper functions documented here.
6957d70e9693SJohannes Berg  */
6958d70e9693SJohannes Berg 
6959d70e9693SJohannes Berg /**
6960810344edSEmmanuel Grumbach  * wiphy_rfkill_set_hw_state_reason - notify cfg80211 about hw block state
69611f87f7d3SJohannes Berg  * @wiphy: the wiphy
69621f87f7d3SJohannes Berg  * @blocked: block status
69636f779a66SEmmanuel Grumbach  * @reason: one of reasons in &enum rfkill_hard_block_reasons
69641f87f7d3SJohannes Berg  */
69656f779a66SEmmanuel Grumbach void wiphy_rfkill_set_hw_state_reason(struct wiphy *wiphy, bool blocked,
69666f779a66SEmmanuel Grumbach 				      enum rfkill_hard_block_reasons reason);
69676f779a66SEmmanuel Grumbach 
69686f779a66SEmmanuel Grumbach static inline void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked)
69696f779a66SEmmanuel Grumbach {
69706f779a66SEmmanuel Grumbach 	wiphy_rfkill_set_hw_state_reason(wiphy, blocked,
69716f779a66SEmmanuel Grumbach 					 RFKILL_HARD_BLOCK_SIGNAL);
69726f779a66SEmmanuel Grumbach }
69731f87f7d3SJohannes Berg 
69741f87f7d3SJohannes Berg /**
69751f87f7d3SJohannes Berg  * wiphy_rfkill_start_polling - start polling rfkill
69761f87f7d3SJohannes Berg  * @wiphy: the wiphy
69771f87f7d3SJohannes Berg  */
69781f87f7d3SJohannes Berg void wiphy_rfkill_start_polling(struct wiphy *wiphy);
69791f87f7d3SJohannes Berg 
69801f87f7d3SJohannes Berg /**
69811f87f7d3SJohannes Berg  * wiphy_rfkill_stop_polling - stop polling rfkill
69821f87f7d3SJohannes Berg  * @wiphy: the wiphy
69831f87f7d3SJohannes Berg  */
6984358ae888SEmmanuel Grumbach static inline void wiphy_rfkill_stop_polling(struct wiphy *wiphy)
6985358ae888SEmmanuel Grumbach {
6986358ae888SEmmanuel Grumbach 	rfkill_pause_polling(wiphy->rfkill);
6987358ae888SEmmanuel Grumbach }
69881f87f7d3SJohannes Berg 
6989ad7e718cSJohannes Berg /**
6990ad7e718cSJohannes Berg  * DOC: Vendor commands
6991ad7e718cSJohannes Berg  *
6992ad7e718cSJohannes Berg  * Occasionally, there are special protocol or firmware features that
6993ad7e718cSJohannes Berg  * can't be implemented very openly. For this and similar cases, the
6994ad7e718cSJohannes Berg  * vendor command functionality allows implementing the features with
6995ad7e718cSJohannes Berg  * (typically closed-source) userspace and firmware, using nl80211 as
6996ad7e718cSJohannes Berg  * the configuration mechanism.
6997ad7e718cSJohannes Berg  *
6998ad7e718cSJohannes Berg  * A driver supporting vendor commands must register them as an array
6999ad7e718cSJohannes Berg  * in struct wiphy, with handlers for each one, each command has an
7000ad7e718cSJohannes Berg  * OUI and sub command ID to identify it.
7001ad7e718cSJohannes Berg  *
7002ad7e718cSJohannes Berg  * Note that this feature should not be (ab)used to implement protocol
7003ad7e718cSJohannes Berg  * features that could openly be shared across drivers. In particular,
7004ad7e718cSJohannes Berg  * it must never be required to use vendor commands to implement any
7005ad7e718cSJohannes Berg  * "normal" functionality that higher-level userspace like connection
7006ad7e718cSJohannes Berg  * managers etc. need.
7007ad7e718cSJohannes Berg  */
7008ad7e718cSJohannes Berg 
7009ad7e718cSJohannes Berg struct sk_buff *__cfg80211_alloc_reply_skb(struct wiphy *wiphy,
7010ad7e718cSJohannes Berg 					   enum nl80211_commands cmd,
7011ad7e718cSJohannes Berg 					   enum nl80211_attrs attr,
7012ad7e718cSJohannes Berg 					   int approxlen);
7013ad7e718cSJohannes Berg 
7014567ffc35SJohannes Berg struct sk_buff *__cfg80211_alloc_event_skb(struct wiphy *wiphy,
70156c09e791SAhmad Kholaif 					   struct wireless_dev *wdev,
7016567ffc35SJohannes Berg 					   enum nl80211_commands cmd,
7017567ffc35SJohannes Berg 					   enum nl80211_attrs attr,
701855c1fdf0SJohannes Berg 					   unsigned int portid,
7019567ffc35SJohannes Berg 					   int vendor_event_idx,
7020567ffc35SJohannes Berg 					   int approxlen, gfp_t gfp);
7021567ffc35SJohannes Berg 
7022567ffc35SJohannes Berg void __cfg80211_send_event_skb(struct sk_buff *skb, gfp_t gfp);
7023567ffc35SJohannes Berg 
7024ad7e718cSJohannes Berg /**
7025ad7e718cSJohannes Berg  * cfg80211_vendor_cmd_alloc_reply_skb - allocate vendor command reply
7026ad7e718cSJohannes Berg  * @wiphy: the wiphy
7027ad7e718cSJohannes Berg  * @approxlen: an upper bound of the length of the data that will
7028ad7e718cSJohannes Berg  *	be put into the skb
7029ad7e718cSJohannes Berg  *
7030ad7e718cSJohannes Berg  * This function allocates and pre-fills an skb for a reply to
7031ad7e718cSJohannes Berg  * a vendor command. Since it is intended for a reply, calling
7032ad7e718cSJohannes Berg  * it outside of a vendor command's doit() operation is invalid.
7033ad7e718cSJohannes Berg  *
7034ad7e718cSJohannes Berg  * The returned skb is pre-filled with some identifying data in
7035ad7e718cSJohannes Berg  * a way that any data that is put into the skb (with skb_put(),
7036ad7e718cSJohannes Berg  * nla_put() or similar) will end up being within the
7037ad7e718cSJohannes Berg  * %NL80211_ATTR_VENDOR_DATA attribute, so all that needs to be done
7038ad7e718cSJohannes Berg  * with the skb is adding data for the corresponding userspace tool
7039ad7e718cSJohannes Berg  * which can then read that data out of the vendor data attribute.
7040ad7e718cSJohannes Berg  * You must not modify the skb in any other way.
7041ad7e718cSJohannes Berg  *
7042ad7e718cSJohannes Berg  * When done, call cfg80211_vendor_cmd_reply() with the skb and return
7043ad7e718cSJohannes Berg  * its error code as the result of the doit() operation.
7044ad7e718cSJohannes Berg  *
7045ad7e718cSJohannes Berg  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
7046ad7e718cSJohannes Berg  */
7047ad7e718cSJohannes Berg static inline struct sk_buff *
7048ad7e718cSJohannes Berg cfg80211_vendor_cmd_alloc_reply_skb(struct wiphy *wiphy, int approxlen)
7049ad7e718cSJohannes Berg {
7050ad7e718cSJohannes Berg 	return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_VENDOR,
7051ad7e718cSJohannes Berg 					  NL80211_ATTR_VENDOR_DATA, approxlen);
7052ad7e718cSJohannes Berg }
7053ad7e718cSJohannes Berg 
7054ad7e718cSJohannes Berg /**
7055ad7e718cSJohannes Berg  * cfg80211_vendor_cmd_reply - send the reply skb
7056ad7e718cSJohannes Berg  * @skb: The skb, must have been allocated with
7057ad7e718cSJohannes Berg  *	cfg80211_vendor_cmd_alloc_reply_skb()
7058ad7e718cSJohannes Berg  *
7059ad7e718cSJohannes Berg  * Since calling this function will usually be the last thing
7060ad7e718cSJohannes Berg  * before returning from the vendor command doit() you should
7061ad7e718cSJohannes Berg  * return the error code.  Note that this function consumes the
7062ad7e718cSJohannes Berg  * skb regardless of the return value.
7063ad7e718cSJohannes Berg  *
7064ad7e718cSJohannes Berg  * Return: An error code or 0 on success.
7065ad7e718cSJohannes Berg  */
7066ad7e718cSJohannes Berg int cfg80211_vendor_cmd_reply(struct sk_buff *skb);
7067ad7e718cSJohannes Berg 
7068567ffc35SJohannes Berg /**
70695d9c358dSRandy Dunlap  * cfg80211_vendor_cmd_get_sender - get the current sender netlink ID
707055c1fdf0SJohannes Berg  * @wiphy: the wiphy
707155c1fdf0SJohannes Berg  *
707255c1fdf0SJohannes Berg  * Return the current netlink port ID in a vendor command handler.
707355c1fdf0SJohannes Berg  * Valid to call only there.
707455c1fdf0SJohannes Berg  */
707555c1fdf0SJohannes Berg unsigned int cfg80211_vendor_cmd_get_sender(struct wiphy *wiphy);
707655c1fdf0SJohannes Berg 
707755c1fdf0SJohannes Berg /**
7078567ffc35SJohannes Berg  * cfg80211_vendor_event_alloc - allocate vendor-specific event skb
7079567ffc35SJohannes Berg  * @wiphy: the wiphy
70806c09e791SAhmad Kholaif  * @wdev: the wireless device
7081567ffc35SJohannes Berg  * @event_idx: index of the vendor event in the wiphy's vendor_events
7082567ffc35SJohannes Berg  * @approxlen: an upper bound of the length of the data that will
7083567ffc35SJohannes Berg  *	be put into the skb
7084567ffc35SJohannes Berg  * @gfp: allocation flags
7085567ffc35SJohannes Berg  *
7086567ffc35SJohannes Berg  * This function allocates and pre-fills an skb for an event on the
7087567ffc35SJohannes Berg  * vendor-specific multicast group.
7088567ffc35SJohannes Berg  *
70896c09e791SAhmad Kholaif  * If wdev != NULL, both the ifindex and identifier of the specified
70906c09e791SAhmad Kholaif  * wireless device are added to the event message before the vendor data
70916c09e791SAhmad Kholaif  * attribute.
70926c09e791SAhmad Kholaif  *
7093567ffc35SJohannes Berg  * When done filling the skb, call cfg80211_vendor_event() with the
7094567ffc35SJohannes Berg  * skb to send the event.
7095567ffc35SJohannes Berg  *
7096567ffc35SJohannes Berg  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
7097567ffc35SJohannes Berg  */
7098567ffc35SJohannes Berg static inline struct sk_buff *
70996c09e791SAhmad Kholaif cfg80211_vendor_event_alloc(struct wiphy *wiphy, struct wireless_dev *wdev,
71006c09e791SAhmad Kholaif 			     int approxlen, int event_idx, gfp_t gfp)
7101567ffc35SJohannes Berg {
71026c09e791SAhmad Kholaif 	return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR,
7103567ffc35SJohannes Berg 					  NL80211_ATTR_VENDOR_DATA,
710455c1fdf0SJohannes Berg 					  0, event_idx, approxlen, gfp);
710555c1fdf0SJohannes Berg }
710655c1fdf0SJohannes Berg 
710755c1fdf0SJohannes Berg /**
710855c1fdf0SJohannes Berg  * cfg80211_vendor_event_alloc_ucast - alloc unicast vendor-specific event skb
710955c1fdf0SJohannes Berg  * @wiphy: the wiphy
711055c1fdf0SJohannes Berg  * @wdev: the wireless device
711155c1fdf0SJohannes Berg  * @event_idx: index of the vendor event in the wiphy's vendor_events
711255c1fdf0SJohannes Berg  * @portid: port ID of the receiver
711355c1fdf0SJohannes Berg  * @approxlen: an upper bound of the length of the data that will
711455c1fdf0SJohannes Berg  *	be put into the skb
711555c1fdf0SJohannes Berg  * @gfp: allocation flags
711655c1fdf0SJohannes Berg  *
711755c1fdf0SJohannes Berg  * This function allocates and pre-fills an skb for an event to send to
711855c1fdf0SJohannes Berg  * a specific (userland) socket. This socket would previously have been
711955c1fdf0SJohannes Berg  * obtained by cfg80211_vendor_cmd_get_sender(), and the caller MUST take
712055c1fdf0SJohannes Berg  * care to register a netlink notifier to see when the socket closes.
712155c1fdf0SJohannes Berg  *
712255c1fdf0SJohannes Berg  * If wdev != NULL, both the ifindex and identifier of the specified
712355c1fdf0SJohannes Berg  * wireless device are added to the event message before the vendor data
712455c1fdf0SJohannes Berg  * attribute.
712555c1fdf0SJohannes Berg  *
712655c1fdf0SJohannes Berg  * When done filling the skb, call cfg80211_vendor_event() with the
712755c1fdf0SJohannes Berg  * skb to send the event.
712855c1fdf0SJohannes Berg  *
712955c1fdf0SJohannes Berg  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
713055c1fdf0SJohannes Berg  */
713155c1fdf0SJohannes Berg static inline struct sk_buff *
713255c1fdf0SJohannes Berg cfg80211_vendor_event_alloc_ucast(struct wiphy *wiphy,
713355c1fdf0SJohannes Berg 				  struct wireless_dev *wdev,
713455c1fdf0SJohannes Berg 				  unsigned int portid, int approxlen,
713555c1fdf0SJohannes Berg 				  int event_idx, gfp_t gfp)
713655c1fdf0SJohannes Berg {
713755c1fdf0SJohannes Berg 	return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR,
713855c1fdf0SJohannes Berg 					  NL80211_ATTR_VENDOR_DATA,
713955c1fdf0SJohannes Berg 					  portid, event_idx, approxlen, gfp);
7140567ffc35SJohannes Berg }
7141567ffc35SJohannes Berg 
7142567ffc35SJohannes Berg /**
7143567ffc35SJohannes Berg  * cfg80211_vendor_event - send the event
7144567ffc35SJohannes Berg  * @skb: The skb, must have been allocated with cfg80211_vendor_event_alloc()
7145567ffc35SJohannes Berg  * @gfp: allocation flags
7146567ffc35SJohannes Berg  *
7147567ffc35SJohannes Berg  * This function sends the given @skb, which must have been allocated
7148567ffc35SJohannes Berg  * by cfg80211_vendor_event_alloc(), as an event. It always consumes it.
7149567ffc35SJohannes Berg  */
7150567ffc35SJohannes Berg static inline void cfg80211_vendor_event(struct sk_buff *skb, gfp_t gfp)
7151567ffc35SJohannes Berg {
7152567ffc35SJohannes Berg 	__cfg80211_send_event_skb(skb, gfp);
7153567ffc35SJohannes Berg }
7154567ffc35SJohannes Berg 
7155aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE
7156aff89a9bSJohannes Berg /**
7157d70e9693SJohannes Berg  * DOC: Test mode
7158d70e9693SJohannes Berg  *
7159d70e9693SJohannes Berg  * Test mode is a set of utility functions to allow drivers to
7160d70e9693SJohannes Berg  * interact with driver-specific tools to aid, for instance,
7161d70e9693SJohannes Berg  * factory programming.
7162d70e9693SJohannes Berg  *
7163d70e9693SJohannes Berg  * This chapter describes how drivers interact with it, for more
7164d70e9693SJohannes Berg  * information see the nl80211 book's chapter on it.
7165d70e9693SJohannes Berg  */
7166d70e9693SJohannes Berg 
7167d70e9693SJohannes Berg /**
7168aff89a9bSJohannes Berg  * cfg80211_testmode_alloc_reply_skb - allocate testmode reply
7169aff89a9bSJohannes Berg  * @wiphy: the wiphy
7170aff89a9bSJohannes Berg  * @approxlen: an upper bound of the length of the data that will
7171aff89a9bSJohannes Berg  *	be put into the skb
7172aff89a9bSJohannes Berg  *
7173aff89a9bSJohannes Berg  * This function allocates and pre-fills an skb for a reply to
7174aff89a9bSJohannes Berg  * the testmode command. Since it is intended for a reply, calling
7175aff89a9bSJohannes Berg  * it outside of the @testmode_cmd operation is invalid.
7176aff89a9bSJohannes Berg  *
71770ae997dcSYacine Belkadi  * The returned skb is pre-filled with the wiphy index and set up in
71780ae997dcSYacine Belkadi  * a way that any data that is put into the skb (with skb_put(),
71790ae997dcSYacine Belkadi  * nla_put() or similar) will end up being within the
71800ae997dcSYacine Belkadi  * %NL80211_ATTR_TESTDATA attribute, so all that needs to be done
71810ae997dcSYacine Belkadi  * with the skb is adding data for the corresponding userspace tool
71820ae997dcSYacine Belkadi  * which can then read that data out of the testdata attribute. You
71830ae997dcSYacine Belkadi  * must not modify the skb in any other way.
7184aff89a9bSJohannes Berg  *
7185aff89a9bSJohannes Berg  * When done, call cfg80211_testmode_reply() with the skb and return
7186aff89a9bSJohannes Berg  * its error code as the result of the @testmode_cmd operation.
71870ae997dcSYacine Belkadi  *
71880ae997dcSYacine Belkadi  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
7189aff89a9bSJohannes Berg  */
7190ad7e718cSJohannes Berg static inline struct sk_buff *
7191ad7e718cSJohannes Berg cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy, int approxlen)
7192ad7e718cSJohannes Berg {
7193ad7e718cSJohannes Berg 	return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_TESTMODE,
7194ad7e718cSJohannes Berg 					  NL80211_ATTR_TESTDATA, approxlen);
7195ad7e718cSJohannes Berg }
7196aff89a9bSJohannes Berg 
7197aff89a9bSJohannes Berg /**
7198aff89a9bSJohannes Berg  * cfg80211_testmode_reply - send the reply skb
7199aff89a9bSJohannes Berg  * @skb: The skb, must have been allocated with
7200aff89a9bSJohannes Berg  *	cfg80211_testmode_alloc_reply_skb()
7201aff89a9bSJohannes Berg  *
72020ae997dcSYacine Belkadi  * Since calling this function will usually be the last thing
72030ae997dcSYacine Belkadi  * before returning from the @testmode_cmd you should return
72040ae997dcSYacine Belkadi  * the error code.  Note that this function consumes the skb
72050ae997dcSYacine Belkadi  * regardless of the return value.
72060ae997dcSYacine Belkadi  *
72070ae997dcSYacine Belkadi  * Return: An error code or 0 on success.
7208aff89a9bSJohannes Berg  */
7209ad7e718cSJohannes Berg static inline int cfg80211_testmode_reply(struct sk_buff *skb)
7210ad7e718cSJohannes Berg {
7211ad7e718cSJohannes Berg 	return cfg80211_vendor_cmd_reply(skb);
7212ad7e718cSJohannes Berg }
7213aff89a9bSJohannes Berg 
7214aff89a9bSJohannes Berg /**
7215aff89a9bSJohannes Berg  * cfg80211_testmode_alloc_event_skb - allocate testmode event
7216aff89a9bSJohannes Berg  * @wiphy: the wiphy
7217aff89a9bSJohannes Berg  * @approxlen: an upper bound of the length of the data that will
7218aff89a9bSJohannes Berg  *	be put into the skb
7219aff89a9bSJohannes Berg  * @gfp: allocation flags
7220aff89a9bSJohannes Berg  *
7221aff89a9bSJohannes Berg  * This function allocates and pre-fills an skb for an event on the
7222aff89a9bSJohannes Berg  * testmode multicast group.
7223aff89a9bSJohannes Berg  *
72240ae997dcSYacine Belkadi  * The returned skb is set up in the same way as with
72250ae997dcSYacine Belkadi  * cfg80211_testmode_alloc_reply_skb() but prepared for an event. As
72260ae997dcSYacine Belkadi  * there, you should simply add data to it that will then end up in the
72270ae997dcSYacine Belkadi  * %NL80211_ATTR_TESTDATA attribute. Again, you must not modify the skb
72280ae997dcSYacine Belkadi  * in any other way.
7229aff89a9bSJohannes Berg  *
7230aff89a9bSJohannes Berg  * When done filling the skb, call cfg80211_testmode_event() with the
7231aff89a9bSJohannes Berg  * skb to send the event.
72320ae997dcSYacine Belkadi  *
72330ae997dcSYacine Belkadi  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
7234aff89a9bSJohannes Berg  */
7235567ffc35SJohannes Berg static inline struct sk_buff *
7236567ffc35SJohannes Berg cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy, int approxlen, gfp_t gfp)
7237567ffc35SJohannes Berg {
72386c09e791SAhmad Kholaif 	return __cfg80211_alloc_event_skb(wiphy, NULL, NL80211_CMD_TESTMODE,
723955c1fdf0SJohannes Berg 					  NL80211_ATTR_TESTDATA, 0, -1,
7240567ffc35SJohannes Berg 					  approxlen, gfp);
7241567ffc35SJohannes Berg }
7242aff89a9bSJohannes Berg 
7243aff89a9bSJohannes Berg /**
7244aff89a9bSJohannes Berg  * cfg80211_testmode_event - send the event
7245aff89a9bSJohannes Berg  * @skb: The skb, must have been allocated with
7246aff89a9bSJohannes Berg  *	cfg80211_testmode_alloc_event_skb()
7247aff89a9bSJohannes Berg  * @gfp: allocation flags
7248aff89a9bSJohannes Berg  *
7249aff89a9bSJohannes Berg  * This function sends the given @skb, which must have been allocated
7250aff89a9bSJohannes Berg  * by cfg80211_testmode_alloc_event_skb(), as an event. It always
7251aff89a9bSJohannes Berg  * consumes it.
7252aff89a9bSJohannes Berg  */
7253567ffc35SJohannes Berg static inline void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp)
7254567ffc35SJohannes Berg {
7255567ffc35SJohannes Berg 	__cfg80211_send_event_skb(skb, gfp);
7256567ffc35SJohannes Berg }
7257aff89a9bSJohannes Berg 
7258aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd)	.testmode_cmd = (cmd),
725971063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd)	.testmode_dump = (cmd),
7260aff89a9bSJohannes Berg #else
7261aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd)
726271063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd)
7263aff89a9bSJohannes Berg #endif
7264aff89a9bSJohannes Berg 
7265b23aa676SSamuel Ortiz /**
726676804d28SArend Van Spriel  * struct cfg80211_fils_resp_params - FILS connection response params
726776804d28SArend Van Spriel  * @kek: KEK derived from a successful FILS connection (may be %NULL)
726876804d28SArend Van Spriel  * @kek_len: Length of @fils_kek in octets
726976804d28SArend Van Spriel  * @update_erp_next_seq_num: Boolean value to specify whether the value in
727076804d28SArend Van Spriel  *	@erp_next_seq_num is valid.
727176804d28SArend Van Spriel  * @erp_next_seq_num: The next sequence number to use in ERP message in
727276804d28SArend Van Spriel  *	FILS Authentication. This value should be specified irrespective of the
727376804d28SArend Van Spriel  *	status for a FILS connection.
727476804d28SArend Van Spriel  * @pmk: A new PMK if derived from a successful FILS connection (may be %NULL).
727576804d28SArend Van Spriel  * @pmk_len: Length of @pmk in octets
727676804d28SArend Van Spriel  * @pmkid: A new PMKID if derived from a successful FILS connection or the PMKID
727776804d28SArend Van Spriel  *	used for this FILS connection (may be %NULL).
727876804d28SArend Van Spriel  */
727976804d28SArend Van Spriel struct cfg80211_fils_resp_params {
728076804d28SArend Van Spriel 	const u8 *kek;
728176804d28SArend Van Spriel 	size_t kek_len;
728276804d28SArend Van Spriel 	bool update_erp_next_seq_num;
728376804d28SArend Van Spriel 	u16 erp_next_seq_num;
728476804d28SArend Van Spriel 	const u8 *pmk;
728576804d28SArend Van Spriel 	size_t pmk_len;
728676804d28SArend Van Spriel 	const u8 *pmkid;
728776804d28SArend Van Spriel };
728876804d28SArend Van Spriel 
728976804d28SArend Van Spriel /**
72905349a0f7SVidyullatha Kanchanapally  * struct cfg80211_connect_resp_params - Connection response params
72915349a0f7SVidyullatha Kanchanapally  * @status: Status code, %WLAN_STATUS_SUCCESS for successful connection, use
72925349a0f7SVidyullatha Kanchanapally  *	%WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
72935349a0f7SVidyullatha Kanchanapally  *	the real status code for failures. If this call is used to report a
72945349a0f7SVidyullatha Kanchanapally  *	failure due to a timeout (e.g., not receiving an Authentication frame
72955349a0f7SVidyullatha Kanchanapally  *	from the AP) instead of an explicit rejection by the AP, -1 is used to
72965349a0f7SVidyullatha Kanchanapally  *	indicate that this is a failure, but without a status code.
72975349a0f7SVidyullatha Kanchanapally  *	@timeout_reason is used to report the reason for the timeout in that
72985349a0f7SVidyullatha Kanchanapally  *	case.
72995349a0f7SVidyullatha Kanchanapally  * @bssid: The BSSID of the AP (may be %NULL)
73005349a0f7SVidyullatha Kanchanapally  * @bss: Entry of bss to which STA got connected to, can be obtained through
7301a3ce17d1SChaitanya Tata  *	cfg80211_get_bss() (may be %NULL). But it is recommended to store the
7302a3ce17d1SChaitanya Tata  *	bss from the connect_request and hold a reference to it and return
7303a3ce17d1SChaitanya Tata  *	through this param to avoid a warning if the bss is expired during the
7304a3ce17d1SChaitanya Tata  *	connection, esp. for those drivers implementing connect op.
7305a3ce17d1SChaitanya Tata  *	Only one parameter among @bssid and @bss needs to be specified.
73065349a0f7SVidyullatha Kanchanapally  * @req_ie: Association request IEs (may be %NULL)
73075349a0f7SVidyullatha Kanchanapally  * @req_ie_len: Association request IEs length
73085349a0f7SVidyullatha Kanchanapally  * @resp_ie: Association response IEs (may be %NULL)
73095349a0f7SVidyullatha Kanchanapally  * @resp_ie_len: Association response IEs length
731076804d28SArend Van Spriel  * @fils: FILS connection response parameters.
73115349a0f7SVidyullatha Kanchanapally  * @timeout_reason: Reason for connection timeout. This is used when the
73125349a0f7SVidyullatha Kanchanapally  *	connection fails due to a timeout instead of an explicit rejection from
73135349a0f7SVidyullatha Kanchanapally  *	the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is
73145349a0f7SVidyullatha Kanchanapally  *	not known. This value is used only if @status < 0 to indicate that the
73155349a0f7SVidyullatha Kanchanapally  *	failure is due to a timeout and not due to explicit rejection by the AP.
73165349a0f7SVidyullatha Kanchanapally  *	This value is ignored in other cases (@status >= 0).
73175349a0f7SVidyullatha Kanchanapally  */
73185349a0f7SVidyullatha Kanchanapally struct cfg80211_connect_resp_params {
73195349a0f7SVidyullatha Kanchanapally 	int status;
73205349a0f7SVidyullatha Kanchanapally 	const u8 *bssid;
73215349a0f7SVidyullatha Kanchanapally 	struct cfg80211_bss *bss;
73225349a0f7SVidyullatha Kanchanapally 	const u8 *req_ie;
73235349a0f7SVidyullatha Kanchanapally 	size_t req_ie_len;
73245349a0f7SVidyullatha Kanchanapally 	const u8 *resp_ie;
73255349a0f7SVidyullatha Kanchanapally 	size_t resp_ie_len;
732676804d28SArend Van Spriel 	struct cfg80211_fils_resp_params fils;
73275349a0f7SVidyullatha Kanchanapally 	enum nl80211_timeout_reason timeout_reason;
73285349a0f7SVidyullatha Kanchanapally };
73295349a0f7SVidyullatha Kanchanapally 
73305349a0f7SVidyullatha Kanchanapally /**
73315349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_done - notify cfg80211 of connection result
73325349a0f7SVidyullatha Kanchanapally  *
73335349a0f7SVidyullatha Kanchanapally  * @dev: network device
73345349a0f7SVidyullatha Kanchanapally  * @params: connection response parameters
73355349a0f7SVidyullatha Kanchanapally  * @gfp: allocation flags
73365349a0f7SVidyullatha Kanchanapally  *
73375349a0f7SVidyullatha Kanchanapally  * It should be called by the underlying driver once execution of the connection
73385349a0f7SVidyullatha Kanchanapally  * request from connect() has been completed. This is similar to
73395349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_bss(), but takes a structure pointer for connection response
73405349a0f7SVidyullatha Kanchanapally  * parameters. Only one of the functions among cfg80211_connect_bss(),
73415349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_result(), cfg80211_connect_timeout(),
73425349a0f7SVidyullatha Kanchanapally  * and cfg80211_connect_done() should be called.
73435349a0f7SVidyullatha Kanchanapally  */
73445349a0f7SVidyullatha Kanchanapally void cfg80211_connect_done(struct net_device *dev,
73455349a0f7SVidyullatha Kanchanapally 			   struct cfg80211_connect_resp_params *params,
73465349a0f7SVidyullatha Kanchanapally 			   gfp_t gfp);
73475349a0f7SVidyullatha Kanchanapally 
73485349a0f7SVidyullatha Kanchanapally /**
7349e7054989SKanchanapally, Vidyullatha  * cfg80211_connect_bss - notify cfg80211 of connection result
7350e7054989SKanchanapally, Vidyullatha  *
7351e7054989SKanchanapally, Vidyullatha  * @dev: network device
7352e7054989SKanchanapally, Vidyullatha  * @bssid: the BSSID of the AP
7353a3ce17d1SChaitanya Tata  * @bss: Entry of bss to which STA got connected to, can be obtained through
7354a3ce17d1SChaitanya Tata  *	cfg80211_get_bss() (may be %NULL). But it is recommended to store the
7355a3ce17d1SChaitanya Tata  *	bss from the connect_request and hold a reference to it and return
7356a3ce17d1SChaitanya Tata  *	through this param to avoid a warning if the bss is expired during the
7357a3ce17d1SChaitanya Tata  *	connection, esp. for those drivers implementing connect op.
7358a3ce17d1SChaitanya Tata  *	Only one parameter among @bssid and @bss needs to be specified.
7359e7054989SKanchanapally, Vidyullatha  * @req_ie: association request IEs (maybe be %NULL)
7360e7054989SKanchanapally, Vidyullatha  * @req_ie_len: association request IEs length
7361e7054989SKanchanapally, Vidyullatha  * @resp_ie: association response IEs (may be %NULL)
7362e7054989SKanchanapally, Vidyullatha  * @resp_ie_len: assoc response IEs length
7363c88215d7SJouni Malinen  * @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use
7364e7054989SKanchanapally, Vidyullatha  *	%WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
7365c88215d7SJouni Malinen  *	the real status code for failures. If this call is used to report a
7366c88215d7SJouni Malinen  *	failure due to a timeout (e.g., not receiving an Authentication frame
7367c88215d7SJouni Malinen  *	from the AP) instead of an explicit rejection by the AP, -1 is used to
7368c88215d7SJouni Malinen  *	indicate that this is a failure, but without a status code.
7369c88215d7SJouni Malinen  *	@timeout_reason is used to report the reason for the timeout in that
7370c88215d7SJouni Malinen  *	case.
7371e7054989SKanchanapally, Vidyullatha  * @gfp: allocation flags
73723093ebbeSPurushottam Kushwaha  * @timeout_reason: reason for connection timeout. This is used when the
73733093ebbeSPurushottam Kushwaha  *	connection fails due to a timeout instead of an explicit rejection from
73743093ebbeSPurushottam Kushwaha  *	the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is
73753093ebbeSPurushottam Kushwaha  *	not known. This value is used only if @status < 0 to indicate that the
73763093ebbeSPurushottam Kushwaha  *	failure is due to a timeout and not due to explicit rejection by the AP.
73773093ebbeSPurushottam Kushwaha  *	This value is ignored in other cases (@status >= 0).
7378e7054989SKanchanapally, Vidyullatha  *
7379c88215d7SJouni Malinen  * It should be called by the underlying driver once execution of the connection
7380c88215d7SJouni Malinen  * request from connect() has been completed. This is similar to
7381c88215d7SJouni Malinen  * cfg80211_connect_result(), but with the option of identifying the exact bss
73825349a0f7SVidyullatha Kanchanapally  * entry for the connection. Only one of the functions among
73835349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_bss(), cfg80211_connect_result(),
73845349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
7385e7054989SKanchanapally, Vidyullatha  */
73865349a0f7SVidyullatha Kanchanapally static inline void
73875349a0f7SVidyullatha Kanchanapally cfg80211_connect_bss(struct net_device *dev, const u8 *bssid,
7388e7054989SKanchanapally, Vidyullatha 		     struct cfg80211_bss *bss, const u8 *req_ie,
7389e7054989SKanchanapally, Vidyullatha 		     size_t req_ie_len, const u8 *resp_ie,
73903093ebbeSPurushottam Kushwaha 		     size_t resp_ie_len, int status, gfp_t gfp,
73915349a0f7SVidyullatha Kanchanapally 		     enum nl80211_timeout_reason timeout_reason)
73925349a0f7SVidyullatha Kanchanapally {
73935349a0f7SVidyullatha Kanchanapally 	struct cfg80211_connect_resp_params params;
73945349a0f7SVidyullatha Kanchanapally 
73955349a0f7SVidyullatha Kanchanapally 	memset(&params, 0, sizeof(params));
73965349a0f7SVidyullatha Kanchanapally 	params.status = status;
73975349a0f7SVidyullatha Kanchanapally 	params.bssid = bssid;
73985349a0f7SVidyullatha Kanchanapally 	params.bss = bss;
73995349a0f7SVidyullatha Kanchanapally 	params.req_ie = req_ie;
74005349a0f7SVidyullatha Kanchanapally 	params.req_ie_len = req_ie_len;
74015349a0f7SVidyullatha Kanchanapally 	params.resp_ie = resp_ie;
74025349a0f7SVidyullatha Kanchanapally 	params.resp_ie_len = resp_ie_len;
74035349a0f7SVidyullatha Kanchanapally 	params.timeout_reason = timeout_reason;
74045349a0f7SVidyullatha Kanchanapally 
74055349a0f7SVidyullatha Kanchanapally 	cfg80211_connect_done(dev, &params, gfp);
74065349a0f7SVidyullatha Kanchanapally }
7407e7054989SKanchanapally, Vidyullatha 
7408e7054989SKanchanapally, Vidyullatha /**
7409b23aa676SSamuel Ortiz  * cfg80211_connect_result - notify cfg80211 of connection result
7410b23aa676SSamuel Ortiz  *
7411b23aa676SSamuel Ortiz  * @dev: network device
7412b23aa676SSamuel Ortiz  * @bssid: the BSSID of the AP
7413b23aa676SSamuel Ortiz  * @req_ie: association request IEs (maybe be %NULL)
7414b23aa676SSamuel Ortiz  * @req_ie_len: association request IEs length
7415b23aa676SSamuel Ortiz  * @resp_ie: association response IEs (may be %NULL)
7416b23aa676SSamuel Ortiz  * @resp_ie_len: assoc response IEs length
7417c88215d7SJouni Malinen  * @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use
7418b23aa676SSamuel Ortiz  *	%WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
7419b23aa676SSamuel Ortiz  *	the real status code for failures.
7420b23aa676SSamuel Ortiz  * @gfp: allocation flags
7421b23aa676SSamuel Ortiz  *
7422c88215d7SJouni Malinen  * It should be called by the underlying driver once execution of the connection
7423c88215d7SJouni Malinen  * request from connect() has been completed. This is similar to
7424c88215d7SJouni Malinen  * cfg80211_connect_bss() which allows the exact bss entry to be specified. Only
74255349a0f7SVidyullatha Kanchanapally  * one of the functions among cfg80211_connect_bss(), cfg80211_connect_result(),
74265349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
7427b23aa676SSamuel Ortiz  */
7428e7054989SKanchanapally, Vidyullatha static inline void
7429e7054989SKanchanapally, Vidyullatha cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
7430b23aa676SSamuel Ortiz 			const u8 *req_ie, size_t req_ie_len,
7431b23aa676SSamuel Ortiz 			const u8 *resp_ie, size_t resp_ie_len,
7432e7054989SKanchanapally, Vidyullatha 			u16 status, gfp_t gfp)
7433e7054989SKanchanapally, Vidyullatha {
7434e7054989SKanchanapally, Vidyullatha 	cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, resp_ie,
74353093ebbeSPurushottam Kushwaha 			     resp_ie_len, status, gfp,
74363093ebbeSPurushottam Kushwaha 			     NL80211_TIMEOUT_UNSPECIFIED);
7437e7054989SKanchanapally, Vidyullatha }
7438b23aa676SSamuel Ortiz 
7439b23aa676SSamuel Ortiz /**
7440bf1ecd21SJouni Malinen  * cfg80211_connect_timeout - notify cfg80211 of connection timeout
7441bf1ecd21SJouni Malinen  *
7442bf1ecd21SJouni Malinen  * @dev: network device
7443bf1ecd21SJouni Malinen  * @bssid: the BSSID of the AP
7444bf1ecd21SJouni Malinen  * @req_ie: association request IEs (maybe be %NULL)
7445bf1ecd21SJouni Malinen  * @req_ie_len: association request IEs length
7446bf1ecd21SJouni Malinen  * @gfp: allocation flags
74473093ebbeSPurushottam Kushwaha  * @timeout_reason: reason for connection timeout.
7448bf1ecd21SJouni Malinen  *
7449bf1ecd21SJouni Malinen  * It should be called by the underlying driver whenever connect() has failed
7450bf1ecd21SJouni Malinen  * in a sequence where no explicit authentication/association rejection was
7451bf1ecd21SJouni Malinen  * received from the AP. This could happen, e.g., due to not being able to send
7452bf1ecd21SJouni Malinen  * out the Authentication or Association Request frame or timing out while
74535349a0f7SVidyullatha Kanchanapally  * waiting for the response. Only one of the functions among
74545349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_bss(), cfg80211_connect_result(),
74555349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
7456bf1ecd21SJouni Malinen  */
7457bf1ecd21SJouni Malinen static inline void
7458bf1ecd21SJouni Malinen cfg80211_connect_timeout(struct net_device *dev, const u8 *bssid,
74593093ebbeSPurushottam Kushwaha 			 const u8 *req_ie, size_t req_ie_len, gfp_t gfp,
74603093ebbeSPurushottam Kushwaha 			 enum nl80211_timeout_reason timeout_reason)
7461bf1ecd21SJouni Malinen {
7462bf1ecd21SJouni Malinen 	cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, NULL, 0, -1,
74633093ebbeSPurushottam Kushwaha 			     gfp, timeout_reason);
7464bf1ecd21SJouni Malinen }
7465bf1ecd21SJouni Malinen 
7466bf1ecd21SJouni Malinen /**
746729ce6ecbSAvraham Stern  * struct cfg80211_roam_info - driver initiated roaming information
746829ce6ecbSAvraham Stern  *
746929ce6ecbSAvraham Stern  * @channel: the channel of the new AP
747029ce6ecbSAvraham Stern  * @bss: entry of bss to which STA got roamed (may be %NULL if %bssid is set)
747129ce6ecbSAvraham Stern  * @bssid: the BSSID of the new AP (may be %NULL if %bss is set)
747229ce6ecbSAvraham Stern  * @req_ie: association request IEs (maybe be %NULL)
747329ce6ecbSAvraham Stern  * @req_ie_len: association request IEs length
747429ce6ecbSAvraham Stern  * @resp_ie: association response IEs (may be %NULL)
747529ce6ecbSAvraham Stern  * @resp_ie_len: assoc response IEs length
7476e841b7b1SArend Van Spriel  * @fils: FILS related roaming information.
747729ce6ecbSAvraham Stern  */
747829ce6ecbSAvraham Stern struct cfg80211_roam_info {
747929ce6ecbSAvraham Stern 	struct ieee80211_channel *channel;
748029ce6ecbSAvraham Stern 	struct cfg80211_bss *bss;
748129ce6ecbSAvraham Stern 	const u8 *bssid;
748229ce6ecbSAvraham Stern 	const u8 *req_ie;
748329ce6ecbSAvraham Stern 	size_t req_ie_len;
748429ce6ecbSAvraham Stern 	const u8 *resp_ie;
748529ce6ecbSAvraham Stern 	size_t resp_ie_len;
7486e841b7b1SArend Van Spriel 	struct cfg80211_fils_resp_params fils;
748729ce6ecbSAvraham Stern };
748829ce6ecbSAvraham Stern 
748929ce6ecbSAvraham Stern /**
7490b23aa676SSamuel Ortiz  * cfg80211_roamed - notify cfg80211 of roaming
7491b23aa676SSamuel Ortiz  *
7492b23aa676SSamuel Ortiz  * @dev: network device
749329ce6ecbSAvraham Stern  * @info: information about the new BSS. struct &cfg80211_roam_info.
7494b23aa676SSamuel Ortiz  * @gfp: allocation flags
7495b23aa676SSamuel Ortiz  *
749629ce6ecbSAvraham Stern  * This function may be called with the driver passing either the BSSID of the
749729ce6ecbSAvraham Stern  * new AP or passing the bss entry to avoid a race in timeout of the bss entry.
749829ce6ecbSAvraham Stern  * It should be called by the underlying driver whenever it roamed from one AP
749929ce6ecbSAvraham Stern  * to another while connected. Drivers which have roaming implemented in
750029ce6ecbSAvraham Stern  * firmware should pass the bss entry to avoid a race in bss entry timeout where
750129ce6ecbSAvraham Stern  * the bss entry of the new AP is seen in the driver, but gets timed out by the
750229ce6ecbSAvraham Stern  * time it is accessed in __cfg80211_roamed() due to delay in scheduling
7503adbde344SVasanthakumar Thiagarajan  * rdev->event_work. In case of any failures, the reference is released
750429ce6ecbSAvraham Stern  * either in cfg80211_roamed() or in __cfg80211_romed(), Otherwise, it will be
7505e1b18549SGeert Uytterhoeven  * released while disconnecting from the current bss.
7506adbde344SVasanthakumar Thiagarajan  */
750729ce6ecbSAvraham Stern void cfg80211_roamed(struct net_device *dev, struct cfg80211_roam_info *info,
750829ce6ecbSAvraham Stern 		     gfp_t gfp);
7509adbde344SVasanthakumar Thiagarajan 
7510adbde344SVasanthakumar Thiagarajan /**
7511503c1fb9SAvraham Stern  * cfg80211_port_authorized - notify cfg80211 of successful security association
7512503c1fb9SAvraham Stern  *
7513503c1fb9SAvraham Stern  * @dev: network device
7514503c1fb9SAvraham Stern  * @bssid: the BSSID of the AP
7515503c1fb9SAvraham Stern  * @gfp: allocation flags
7516503c1fb9SAvraham Stern  *
7517503c1fb9SAvraham Stern  * This function should be called by a driver that supports 4 way handshake
7518503c1fb9SAvraham Stern  * offload after a security association was successfully established (i.e.,
7519503c1fb9SAvraham Stern  * the 4 way handshake was completed successfully). The call to this function
7520503c1fb9SAvraham Stern  * should be preceded with a call to cfg80211_connect_result(),
7521503c1fb9SAvraham Stern  * cfg80211_connect_done(), cfg80211_connect_bss() or cfg80211_roamed() to
7522503c1fb9SAvraham Stern  * indicate the 802.11 association.
7523503c1fb9SAvraham Stern  */
7524503c1fb9SAvraham Stern void cfg80211_port_authorized(struct net_device *dev, const u8 *bssid,
7525503c1fb9SAvraham Stern 			      gfp_t gfp);
7526503c1fb9SAvraham Stern 
7527503c1fb9SAvraham Stern /**
7528b23aa676SSamuel Ortiz  * cfg80211_disconnected - notify cfg80211 that connection was dropped
7529b23aa676SSamuel Ortiz  *
7530b23aa676SSamuel Ortiz  * @dev: network device
7531b23aa676SSamuel Ortiz  * @ie: information elements of the deauth/disassoc frame (may be %NULL)
7532b23aa676SSamuel Ortiz  * @ie_len: length of IEs
7533b23aa676SSamuel Ortiz  * @reason: reason code for the disconnection, set it to 0 if unknown
753480279fb7SJohannes Berg  * @locally_generated: disconnection was requested locally
7535b23aa676SSamuel Ortiz  * @gfp: allocation flags
7536b23aa676SSamuel Ortiz  *
7537b23aa676SSamuel Ortiz  * After it calls this function, the driver should enter an idle state
7538b23aa676SSamuel Ortiz  * and not try to connect to any AP any more.
7539b23aa676SSamuel Ortiz  */
7540b23aa676SSamuel Ortiz void cfg80211_disconnected(struct net_device *dev, u16 reason,
754180279fb7SJohannes Berg 			   const u8 *ie, size_t ie_len,
754280279fb7SJohannes Berg 			   bool locally_generated, gfp_t gfp);
7543b23aa676SSamuel Ortiz 
75449588bbd5SJouni Malinen /**
75459588bbd5SJouni Malinen  * cfg80211_ready_on_channel - notification of remain_on_channel start
754671bbc994SJohannes Berg  * @wdev: wireless device
75479588bbd5SJouni Malinen  * @cookie: the request cookie
75489588bbd5SJouni Malinen  * @chan: The current channel (from remain_on_channel request)
75499588bbd5SJouni Malinen  * @duration: Duration in milliseconds that the driver intents to remain on the
75509588bbd5SJouni Malinen  *	channel
75519588bbd5SJouni Malinen  * @gfp: allocation flags
75529588bbd5SJouni Malinen  */
755371bbc994SJohannes Berg void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie,
75549588bbd5SJouni Malinen 			       struct ieee80211_channel *chan,
75559588bbd5SJouni Malinen 			       unsigned int duration, gfp_t gfp);
75569588bbd5SJouni Malinen 
75579588bbd5SJouni Malinen /**
75589588bbd5SJouni Malinen  * cfg80211_remain_on_channel_expired - remain_on_channel duration expired
755971bbc994SJohannes Berg  * @wdev: wireless device
75609588bbd5SJouni Malinen  * @cookie: the request cookie
75619588bbd5SJouni Malinen  * @chan: The current channel (from remain_on_channel request)
75629588bbd5SJouni Malinen  * @gfp: allocation flags
75639588bbd5SJouni Malinen  */
756471bbc994SJohannes Berg void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie,
75659588bbd5SJouni Malinen 					struct ieee80211_channel *chan,
75669588bbd5SJouni Malinen 					gfp_t gfp);
7567b23aa676SSamuel Ortiz 
75688689c051SArend van Spriel /**
75691c38c7f2SJames Prestwood  * cfg80211_tx_mgmt_expired - tx_mgmt duration expired
75701c38c7f2SJames Prestwood  * @wdev: wireless device
75711c38c7f2SJames Prestwood  * @cookie: the requested cookie
75721c38c7f2SJames Prestwood  * @chan: The current channel (from tx_mgmt request)
75731c38c7f2SJames Prestwood  * @gfp: allocation flags
75741c38c7f2SJames Prestwood  */
75751c38c7f2SJames Prestwood void cfg80211_tx_mgmt_expired(struct wireless_dev *wdev, u64 cookie,
75761c38c7f2SJames Prestwood 			      struct ieee80211_channel *chan, gfp_t gfp);
75771c38c7f2SJames Prestwood 
75781c38c7f2SJames Prestwood /**
75798689c051SArend van Spriel  * cfg80211_sinfo_alloc_tid_stats - allocate per-tid statistics.
75808689c051SArend van Spriel  *
75818689c051SArend van Spriel  * @sinfo: the station information
75828689c051SArend van Spriel  * @gfp: allocation flags
75838689c051SArend van Spriel  */
75848689c051SArend van Spriel int cfg80211_sinfo_alloc_tid_stats(struct station_info *sinfo, gfp_t gfp);
758598b62183SJohannes Berg 
758698b62183SJohannes Berg /**
75877ea3e110SJohannes Berg  * cfg80211_sinfo_release_content - release contents of station info
75887ea3e110SJohannes Berg  * @sinfo: the station information
75897ea3e110SJohannes Berg  *
75907ea3e110SJohannes Berg  * Releases any potentially allocated sub-information of the station
75917ea3e110SJohannes Berg  * information, but not the struct itself (since it's typically on
75927ea3e110SJohannes Berg  * the stack.)
75937ea3e110SJohannes Berg  */
75947ea3e110SJohannes Berg static inline void cfg80211_sinfo_release_content(struct station_info *sinfo)
75957ea3e110SJohannes Berg {
75967ea3e110SJohannes Berg 	kfree(sinfo->pertid);
75977ea3e110SJohannes Berg }
75987ea3e110SJohannes Berg 
75997ea3e110SJohannes Berg /**
760098b62183SJohannes Berg  * cfg80211_new_sta - notify userspace about station
760198b62183SJohannes Berg  *
760298b62183SJohannes Berg  * @dev: the netdev
760398b62183SJohannes Berg  * @mac_addr: the station's address
760498b62183SJohannes Berg  * @sinfo: the station information
760598b62183SJohannes Berg  * @gfp: allocation flags
760698b62183SJohannes Berg  */
760798b62183SJohannes Berg void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr,
760898b62183SJohannes Berg 		      struct station_info *sinfo, gfp_t gfp);
760998b62183SJohannes Berg 
7610026331c4SJouni Malinen /**
7611cf5ead82SJohannes Berg  * cfg80211_del_sta_sinfo - notify userspace about deletion of a station
7612cf5ead82SJohannes Berg  * @dev: the netdev
7613cf5ead82SJohannes Berg  * @mac_addr: the station's address
7614cf5ead82SJohannes Berg  * @sinfo: the station information/statistics
7615cf5ead82SJohannes Berg  * @gfp: allocation flags
7616cf5ead82SJohannes Berg  */
7617cf5ead82SJohannes Berg void cfg80211_del_sta_sinfo(struct net_device *dev, const u8 *mac_addr,
7618cf5ead82SJohannes Berg 			    struct station_info *sinfo, gfp_t gfp);
7619cf5ead82SJohannes Berg 
7620cf5ead82SJohannes Berg /**
7621ec15e68bSJouni Malinen  * cfg80211_del_sta - notify userspace about deletion of a station
7622ec15e68bSJouni Malinen  *
7623ec15e68bSJouni Malinen  * @dev: the netdev
7624ec15e68bSJouni Malinen  * @mac_addr: the station's address
7625ec15e68bSJouni Malinen  * @gfp: allocation flags
7626ec15e68bSJouni Malinen  */
7627cf5ead82SJohannes Berg static inline void cfg80211_del_sta(struct net_device *dev,
7628cf5ead82SJohannes Berg 				    const u8 *mac_addr, gfp_t gfp)
7629cf5ead82SJohannes Berg {
7630cf5ead82SJohannes Berg 	cfg80211_del_sta_sinfo(dev, mac_addr, NULL, gfp);
7631cf5ead82SJohannes Berg }
7632ec15e68bSJouni Malinen 
7633ec15e68bSJouni Malinen /**
7634ed44a951SPandiyarajan Pitchaimuthu  * cfg80211_conn_failed - connection request failed notification
7635ed44a951SPandiyarajan Pitchaimuthu  *
7636ed44a951SPandiyarajan Pitchaimuthu  * @dev: the netdev
7637ed44a951SPandiyarajan Pitchaimuthu  * @mac_addr: the station's address
7638ed44a951SPandiyarajan Pitchaimuthu  * @reason: the reason for connection failure
7639ed44a951SPandiyarajan Pitchaimuthu  * @gfp: allocation flags
7640ed44a951SPandiyarajan Pitchaimuthu  *
7641ed44a951SPandiyarajan Pitchaimuthu  * Whenever a station tries to connect to an AP and if the station
7642ed44a951SPandiyarajan Pitchaimuthu  * could not connect to the AP as the AP has rejected the connection
7643ed44a951SPandiyarajan Pitchaimuthu  * for some reasons, this function is called.
7644ed44a951SPandiyarajan Pitchaimuthu  *
7645ed44a951SPandiyarajan Pitchaimuthu  * The reason for connection failure can be any of the value from
7646ed44a951SPandiyarajan Pitchaimuthu  * nl80211_connect_failed_reason enum
7647ed44a951SPandiyarajan Pitchaimuthu  */
7648ed44a951SPandiyarajan Pitchaimuthu void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr,
7649ed44a951SPandiyarajan Pitchaimuthu 			  enum nl80211_connect_failed_reason reason,
7650ed44a951SPandiyarajan Pitchaimuthu 			  gfp_t gfp);
7651ed44a951SPandiyarajan Pitchaimuthu 
7652ed44a951SPandiyarajan Pitchaimuthu /**
7653e76fede8SThomas Pedersen  * cfg80211_rx_mgmt_khz - notification of received, unprocessed management frame
7654e76fede8SThomas Pedersen  * @wdev: wireless device receiving the frame
7655e76fede8SThomas Pedersen  * @freq: Frequency on which the frame was received in KHz
7656e76fede8SThomas Pedersen  * @sig_dbm: signal strength in dBm, or 0 if unknown
7657e76fede8SThomas Pedersen  * @buf: Management frame (header + body)
7658e76fede8SThomas Pedersen  * @len: length of the frame data
7659e76fede8SThomas Pedersen  * @flags: flags, as defined in enum nl80211_rxmgmt_flags
7660e76fede8SThomas Pedersen  *
7661e76fede8SThomas Pedersen  * This function is called whenever an Action frame is received for a station
7662e76fede8SThomas Pedersen  * mode interface, but is not processed in kernel.
7663e76fede8SThomas Pedersen  *
7664e76fede8SThomas Pedersen  * Return: %true if a user space application has registered for this frame.
7665e76fede8SThomas Pedersen  * For action frames, that makes it responsible for rejecting unrecognized
7666e76fede8SThomas Pedersen  * action frames; %false otherwise, in which case for action frames the
7667e76fede8SThomas Pedersen  * driver is responsible for rejecting the frame.
7668e76fede8SThomas Pedersen  */
7669e76fede8SThomas Pedersen bool cfg80211_rx_mgmt_khz(struct wireless_dev *wdev, int freq, int sig_dbm,
7670e76fede8SThomas Pedersen 			  const u8 *buf, size_t len, u32 flags);
7671e76fede8SThomas Pedersen 
7672e76fede8SThomas Pedersen /**
76732e161f78SJohannes Berg  * cfg80211_rx_mgmt - notification of received, unprocessed management frame
767471bbc994SJohannes Berg  * @wdev: wireless device receiving the frame
7675026331c4SJouni Malinen  * @freq: Frequency on which the frame was received in MHz
76766c2fb1e6SSergey Matyukevich  * @sig_dbm: signal strength in dBm, or 0 if unknown
76772e161f78SJohannes Berg  * @buf: Management frame (header + body)
7678026331c4SJouni Malinen  * @len: length of the frame data
767919504cf5SVladimir Kondratiev  * @flags: flags, as defined in enum nl80211_rxmgmt_flags
76802e161f78SJohannes Berg  *
76810ae997dcSYacine Belkadi  * This function is called whenever an Action frame is received for a station
76820ae997dcSYacine Belkadi  * mode interface, but is not processed in kernel.
76830ae997dcSYacine Belkadi  *
76840ae997dcSYacine Belkadi  * Return: %true if a user space application has registered for this frame.
76852e161f78SJohannes Berg  * For action frames, that makes it responsible for rejecting unrecognized
76862e161f78SJohannes Berg  * action frames; %false otherwise, in which case for action frames the
76872e161f78SJohannes Berg  * driver is responsible for rejecting the frame.
7688026331c4SJouni Malinen  */
7689e76fede8SThomas Pedersen static inline bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq,
7690e76fede8SThomas Pedersen 				    int sig_dbm, const u8 *buf, size_t len,
7691e76fede8SThomas Pedersen 				    u32 flags)
7692e76fede8SThomas Pedersen {
7693e76fede8SThomas Pedersen 	return cfg80211_rx_mgmt_khz(wdev, MHZ_TO_KHZ(freq), sig_dbm, buf, len,
7694e76fede8SThomas Pedersen 				    flags);
7695e76fede8SThomas Pedersen }
7696026331c4SJouni Malinen 
7697026331c4SJouni Malinen /**
76982e161f78SJohannes Berg  * cfg80211_mgmt_tx_status - notification of TX status for management frame
769971bbc994SJohannes Berg  * @wdev: wireless device receiving the frame
77002e161f78SJohannes Berg  * @cookie: Cookie returned by cfg80211_ops::mgmt_tx()
77012e161f78SJohannes Berg  * @buf: Management frame (header + body)
7702026331c4SJouni Malinen  * @len: length of the frame data
7703026331c4SJouni Malinen  * @ack: Whether frame was acknowledged
7704026331c4SJouni Malinen  * @gfp: context flags
7705026331c4SJouni Malinen  *
77062e161f78SJohannes Berg  * This function is called whenever a management frame was requested to be
77072e161f78SJohannes Berg  * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the
7708026331c4SJouni Malinen  * transmission attempt.
7709026331c4SJouni Malinen  */
771071bbc994SJohannes Berg void cfg80211_mgmt_tx_status(struct wireless_dev *wdev, u64 cookie,
7711026331c4SJouni Malinen 			     const u8 *buf, size_t len, bool ack, gfp_t gfp);
7712026331c4SJouni Malinen 
7713dca9ca2dSMarkus Theil /**
7714dca9ca2dSMarkus Theil  * cfg80211_control_port_tx_status - notification of TX status for control
7715dca9ca2dSMarkus Theil  *                                   port frames
7716dca9ca2dSMarkus Theil  * @wdev: wireless device receiving the frame
7717dca9ca2dSMarkus Theil  * @cookie: Cookie returned by cfg80211_ops::tx_control_port()
7718dca9ca2dSMarkus Theil  * @buf: Data frame (header + body)
7719dca9ca2dSMarkus Theil  * @len: length of the frame data
7720dca9ca2dSMarkus Theil  * @ack: Whether frame was acknowledged
7721dca9ca2dSMarkus Theil  * @gfp: context flags
7722dca9ca2dSMarkus Theil  *
7723dca9ca2dSMarkus Theil  * This function is called whenever a control port frame was requested to be
7724dca9ca2dSMarkus Theil  * transmitted with cfg80211_ops::tx_control_port() to report the TX status of
7725dca9ca2dSMarkus Theil  * the transmission attempt.
7726dca9ca2dSMarkus Theil  */
7727dca9ca2dSMarkus Theil void cfg80211_control_port_tx_status(struct wireless_dev *wdev, u64 cookie,
7728dca9ca2dSMarkus Theil 				     const u8 *buf, size_t len, bool ack,
7729dca9ca2dSMarkus Theil 				     gfp_t gfp);
7730d6dc1a38SJuuso Oikarinen 
7731d6dc1a38SJuuso Oikarinen /**
77326a671a50SDenis Kenzior  * cfg80211_rx_control_port - notification about a received control port frame
77336a671a50SDenis Kenzior  * @dev: The device the frame matched to
7734a948f713SDenis Kenzior  * @skb: The skbuf with the control port frame.  It is assumed that the skbuf
7735a948f713SDenis Kenzior  *	is 802.3 formatted (with 802.3 header).  The skb can be non-linear.
7736a948f713SDenis Kenzior  *	This function does not take ownership of the skb, so the caller is
7737a948f713SDenis Kenzior  *	responsible for any cleanup.  The caller must also ensure that
7738a948f713SDenis Kenzior  *	skb->protocol is set appropriately.
77396a671a50SDenis Kenzior  * @unencrypted: Whether the frame was received unencrypted
77406a671a50SDenis Kenzior  *
77416a671a50SDenis Kenzior  * This function is used to inform userspace about a received control port
77426a671a50SDenis Kenzior  * frame.  It should only be used if userspace indicated it wants to receive
77436a671a50SDenis Kenzior  * control port frames over nl80211.
77446a671a50SDenis Kenzior  *
77456a671a50SDenis Kenzior  * The frame is the data portion of the 802.3 or 802.11 data frame with all
77466a671a50SDenis Kenzior  * network layer headers removed (e.g. the raw EAPoL frame).
77476a671a50SDenis Kenzior  *
77486a671a50SDenis Kenzior  * Return: %true if the frame was passed to userspace
77496a671a50SDenis Kenzior  */
77506a671a50SDenis Kenzior bool cfg80211_rx_control_port(struct net_device *dev,
7751a948f713SDenis Kenzior 			      struct sk_buff *skb, bool unencrypted);
77526a671a50SDenis Kenzior 
77536a671a50SDenis Kenzior /**
7754d6dc1a38SJuuso Oikarinen  * cfg80211_cqm_rssi_notify - connection quality monitoring rssi event
7755d6dc1a38SJuuso Oikarinen  * @dev: network device
7756d6dc1a38SJuuso Oikarinen  * @rssi_event: the triggered RSSI event
7757bee427b8SAndrzej Zaborowski  * @rssi_level: new RSSI level value or 0 if not available
7758d6dc1a38SJuuso Oikarinen  * @gfp: context flags
7759d6dc1a38SJuuso Oikarinen  *
7760d6dc1a38SJuuso Oikarinen  * This function is called when a configured connection quality monitoring
7761d6dc1a38SJuuso Oikarinen  * rssi threshold reached event occurs.
7762d6dc1a38SJuuso Oikarinen  */
7763d6dc1a38SJuuso Oikarinen void cfg80211_cqm_rssi_notify(struct net_device *dev,
7764d6dc1a38SJuuso Oikarinen 			      enum nl80211_cqm_rssi_threshold_event rssi_event,
7765bee427b8SAndrzej Zaborowski 			      s32 rssi_level, gfp_t gfp);
7766d6dc1a38SJuuso Oikarinen 
7767c063dbf5SJohannes Berg /**
7768c063dbf5SJohannes Berg  * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer
7769c063dbf5SJohannes Berg  * @dev: network device
7770c063dbf5SJohannes Berg  * @peer: peer's MAC address
7771c063dbf5SJohannes Berg  * @num_packets: how many packets were lost -- should be a fixed threshold
7772c063dbf5SJohannes Berg  *	but probably no less than maybe 50, or maybe a throughput dependent
7773c063dbf5SJohannes Berg  *	threshold (to account for temporary interference)
7774c063dbf5SJohannes Berg  * @gfp: context flags
7775c063dbf5SJohannes Berg  */
7776c063dbf5SJohannes Berg void cfg80211_cqm_pktloss_notify(struct net_device *dev,
7777c063dbf5SJohannes Berg 				 const u8 *peer, u32 num_packets, gfp_t gfp);
7778c063dbf5SJohannes Berg 
7779e5497d76SJohannes Berg /**
778084f10708SThomas Pedersen  * cfg80211_cqm_txe_notify - TX error rate event
778184f10708SThomas Pedersen  * @dev: network device
778284f10708SThomas Pedersen  * @peer: peer's MAC address
778384f10708SThomas Pedersen  * @num_packets: how many packets were lost
778484f10708SThomas Pedersen  * @rate: % of packets which failed transmission
778584f10708SThomas Pedersen  * @intvl: interval (in s) over which the TX failure threshold was breached.
778684f10708SThomas Pedersen  * @gfp: context flags
778784f10708SThomas Pedersen  *
778884f10708SThomas Pedersen  * Notify userspace when configured % TX failures over number of packets in a
778984f10708SThomas Pedersen  * given interval is exceeded.
779084f10708SThomas Pedersen  */
779184f10708SThomas Pedersen void cfg80211_cqm_txe_notify(struct net_device *dev, const u8 *peer,
779284f10708SThomas Pedersen 			     u32 num_packets, u32 rate, u32 intvl, gfp_t gfp);
779384f10708SThomas Pedersen 
779484f10708SThomas Pedersen /**
779598f03342SJohannes Berg  * cfg80211_cqm_beacon_loss_notify - beacon loss event
779698f03342SJohannes Berg  * @dev: network device
779798f03342SJohannes Berg  * @gfp: context flags
779898f03342SJohannes Berg  *
779998f03342SJohannes Berg  * Notify userspace about beacon loss from the connected AP.
780098f03342SJohannes Berg  */
780198f03342SJohannes Berg void cfg80211_cqm_beacon_loss_notify(struct net_device *dev, gfp_t gfp);
780298f03342SJohannes Berg 
780398f03342SJohannes Berg /**
7804c47240cbSLorenzo Bianconi  * __cfg80211_radar_event - radar detection event
78055b97f49dSJohannes Berg  * @wiphy: the wiphy
78065b97f49dSJohannes Berg  * @chandef: chandef for the current channel
7807c47240cbSLorenzo Bianconi  * @offchan: the radar has been detected on the offchannel chain
78085b97f49dSJohannes Berg  * @gfp: context flags
78095b97f49dSJohannes Berg  *
78105b97f49dSJohannes Berg  * This function is called when a radar is detected on the current chanenl.
78115b97f49dSJohannes Berg  */
7812c47240cbSLorenzo Bianconi void __cfg80211_radar_event(struct wiphy *wiphy,
7813c47240cbSLorenzo Bianconi 			    struct cfg80211_chan_def *chandef,
7814c47240cbSLorenzo Bianconi 			    bool offchan, gfp_t gfp);
7815c47240cbSLorenzo Bianconi 
7816c47240cbSLorenzo Bianconi static inline void
7817c47240cbSLorenzo Bianconi cfg80211_radar_event(struct wiphy *wiphy,
7818c47240cbSLorenzo Bianconi 		     struct cfg80211_chan_def *chandef,
7819c47240cbSLorenzo Bianconi 		     gfp_t gfp)
7820c47240cbSLorenzo Bianconi {
7821c47240cbSLorenzo Bianconi 	__cfg80211_radar_event(wiphy, chandef, false, gfp);
7822c47240cbSLorenzo Bianconi }
7823c47240cbSLorenzo Bianconi 
7824c47240cbSLorenzo Bianconi static inline void
7825a95bfb87SLorenzo Bianconi cfg80211_background_radar_event(struct wiphy *wiphy,
7826c47240cbSLorenzo Bianconi 				struct cfg80211_chan_def *chandef,
7827c47240cbSLorenzo Bianconi 				gfp_t gfp)
7828c47240cbSLorenzo Bianconi {
7829c47240cbSLorenzo Bianconi 	__cfg80211_radar_event(wiphy, chandef, true, gfp);
7830c47240cbSLorenzo Bianconi }
78315b97f49dSJohannes Berg 
78325b97f49dSJohannes Berg /**
7833466b9936Stamizhr@codeaurora.org  * cfg80211_sta_opmode_change_notify - STA's ht/vht operation mode change event
7834466b9936Stamizhr@codeaurora.org  * @dev: network device
7835466b9936Stamizhr@codeaurora.org  * @mac: MAC address of a station which opmode got modified
7836466b9936Stamizhr@codeaurora.org  * @sta_opmode: station's current opmode value
7837466b9936Stamizhr@codeaurora.org  * @gfp: context flags
7838466b9936Stamizhr@codeaurora.org  *
7839466b9936Stamizhr@codeaurora.org  * Driver should call this function when station's opmode modified via action
7840466b9936Stamizhr@codeaurora.org  * frame.
7841466b9936Stamizhr@codeaurora.org  */
7842466b9936Stamizhr@codeaurora.org void cfg80211_sta_opmode_change_notify(struct net_device *dev, const u8 *mac,
7843466b9936Stamizhr@codeaurora.org 				       struct sta_opmode_info *sta_opmode,
7844466b9936Stamizhr@codeaurora.org 				       gfp_t gfp);
7845466b9936Stamizhr@codeaurora.org 
7846466b9936Stamizhr@codeaurora.org /**
78475b97f49dSJohannes Berg  * cfg80211_cac_event - Channel availability check (CAC) event
78485b97f49dSJohannes Berg  * @netdev: network device
78495b97f49dSJohannes Berg  * @chandef: chandef for the current channel
78505b97f49dSJohannes Berg  * @event: type of event
78515b97f49dSJohannes Berg  * @gfp: context flags
78525b97f49dSJohannes Berg  *
78535b97f49dSJohannes Berg  * This function is called when a Channel availability check (CAC) is finished
78545b97f49dSJohannes Berg  * or aborted. This must be called to notify the completion of a CAC process,
78555b97f49dSJohannes Berg  * also by full-MAC drivers.
78565b97f49dSJohannes Berg  */
78575b97f49dSJohannes Berg void cfg80211_cac_event(struct net_device *netdev,
78585b97f49dSJohannes Berg 			const struct cfg80211_chan_def *chandef,
78595b97f49dSJohannes Berg 			enum nl80211_radar_event event, gfp_t gfp);
78605b97f49dSJohannes Berg 
7861bc2dfc02SLorenzo Bianconi /**
7862a95bfb87SLorenzo Bianconi  * cfg80211_background_cac_abort - Channel Availability Check offchan abort event
7863bc2dfc02SLorenzo Bianconi  * @wiphy: the wiphy
7864bc2dfc02SLorenzo Bianconi  *
78651507b153SLorenzo Bianconi  * This function is called by the driver when a Channel Availability Check
78661507b153SLorenzo Bianconi  * (CAC) is aborted by a offchannel dedicated chain.
7867bc2dfc02SLorenzo Bianconi  */
7868a95bfb87SLorenzo Bianconi void cfg80211_background_cac_abort(struct wiphy *wiphy);
78695b97f49dSJohannes Berg 
78705b97f49dSJohannes Berg /**
7871e5497d76SJohannes Berg  * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying
7872e5497d76SJohannes Berg  * @dev: network device
7873e5497d76SJohannes Berg  * @bssid: BSSID of AP (to avoid races)
7874e5497d76SJohannes Berg  * @replay_ctr: new replay counter
7875af71ff85SJohannes Berg  * @gfp: allocation flags
7876e5497d76SJohannes Berg  */
7877e5497d76SJohannes Berg void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid,
7878e5497d76SJohannes Berg 			       const u8 *replay_ctr, gfp_t gfp);
7879e5497d76SJohannes Berg 
7880c9df56b4SJouni Malinen /**
7881c9df56b4SJouni Malinen  * cfg80211_pmksa_candidate_notify - notify about PMKSA caching candidate
7882c9df56b4SJouni Malinen  * @dev: network device
7883c9df56b4SJouni Malinen  * @index: candidate index (the smaller the index, the higher the priority)
7884c9df56b4SJouni Malinen  * @bssid: BSSID of AP
7885c9df56b4SJouni Malinen  * @preauth: Whether AP advertises support for RSN pre-authentication
7886c9df56b4SJouni Malinen  * @gfp: allocation flags
7887c9df56b4SJouni Malinen  */
7888c9df56b4SJouni Malinen void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index,
7889c9df56b4SJouni Malinen 				     const u8 *bssid, bool preauth, gfp_t gfp);
7890c9df56b4SJouni Malinen 
789128946da7SJohannes Berg /**
789228946da7SJohannes Berg  * cfg80211_rx_spurious_frame - inform userspace about a spurious frame
789328946da7SJohannes Berg  * @dev: The device the frame matched to
789428946da7SJohannes Berg  * @addr: the transmitter address
789528946da7SJohannes Berg  * @gfp: context flags
789628946da7SJohannes Berg  *
789728946da7SJohannes Berg  * This function is used in AP mode (only!) to inform userspace that
789828946da7SJohannes Berg  * a spurious class 3 frame was received, to be able to deauth the
789928946da7SJohannes Berg  * sender.
79000ae997dcSYacine Belkadi  * Return: %true if the frame was passed to userspace (or this failed
790128946da7SJohannes Berg  * for a reason other than not having a subscription.)
790228946da7SJohannes Berg  */
790328946da7SJohannes Berg bool cfg80211_rx_spurious_frame(struct net_device *dev,
790428946da7SJohannes Berg 				const u8 *addr, gfp_t gfp);
790528946da7SJohannes Berg 
79067f6cf311SJohannes Berg /**
7907b92ab5d8SJohannes Berg  * cfg80211_rx_unexpected_4addr_frame - inform about unexpected WDS frame
7908b92ab5d8SJohannes Berg  * @dev: The device the frame matched to
7909b92ab5d8SJohannes Berg  * @addr: the transmitter address
7910b92ab5d8SJohannes Berg  * @gfp: context flags
7911b92ab5d8SJohannes Berg  *
7912b92ab5d8SJohannes Berg  * This function is used in AP mode (only!) to inform userspace that
7913b92ab5d8SJohannes Berg  * an associated station sent a 4addr frame but that wasn't expected.
7914b92ab5d8SJohannes Berg  * It is allowed and desirable to send this event only once for each
7915b92ab5d8SJohannes Berg  * station to avoid event flooding.
79160ae997dcSYacine Belkadi  * Return: %true if the frame was passed to userspace (or this failed
7917b92ab5d8SJohannes Berg  * for a reason other than not having a subscription.)
7918b92ab5d8SJohannes Berg  */
7919b92ab5d8SJohannes Berg bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev,
7920b92ab5d8SJohannes Berg 					const u8 *addr, gfp_t gfp);
7921b92ab5d8SJohannes Berg 
7922b92ab5d8SJohannes Berg /**
79237f6cf311SJohannes Berg  * cfg80211_probe_status - notify userspace about probe status
79247f6cf311SJohannes Berg  * @dev: the device the probe was sent on
79257f6cf311SJohannes Berg  * @addr: the address of the peer
79267f6cf311SJohannes Berg  * @cookie: the cookie filled in @probe_client previously
79277f6cf311SJohannes Berg  * @acked: indicates whether probe was acked or not
7928c4b50cd3SVenkateswara Naralasetty  * @ack_signal: signal strength (in dBm) of the ACK frame.
7929c4b50cd3SVenkateswara Naralasetty  * @is_valid_ack_signal: indicates the ack_signal is valid or not.
79307f6cf311SJohannes Berg  * @gfp: allocation flags
79317f6cf311SJohannes Berg  */
79327f6cf311SJohannes Berg void cfg80211_probe_status(struct net_device *dev, const u8 *addr,
7933c4b50cd3SVenkateswara Naralasetty 			   u64 cookie, bool acked, s32 ack_signal,
7934c4b50cd3SVenkateswara Naralasetty 			   bool is_valid_ack_signal, gfp_t gfp);
79357f6cf311SJohannes Berg 
79365e760230SJohannes Berg /**
7937e76fede8SThomas Pedersen  * cfg80211_report_obss_beacon_khz - report beacon from other APs
7938e76fede8SThomas Pedersen  * @wiphy: The wiphy that received the beacon
7939e76fede8SThomas Pedersen  * @frame: the frame
7940e76fede8SThomas Pedersen  * @len: length of the frame
7941e76fede8SThomas Pedersen  * @freq: frequency the frame was received on in KHz
7942e76fede8SThomas Pedersen  * @sig_dbm: signal strength in dBm, or 0 if unknown
7943e76fede8SThomas Pedersen  *
7944e76fede8SThomas Pedersen  * Use this function to report to userspace when a beacon was
7945e76fede8SThomas Pedersen  * received. It is not useful to call this when there is no
7946e76fede8SThomas Pedersen  * netdev that is in AP/GO mode.
7947e76fede8SThomas Pedersen  */
7948e76fede8SThomas Pedersen void cfg80211_report_obss_beacon_khz(struct wiphy *wiphy, const u8 *frame,
7949e76fede8SThomas Pedersen 				     size_t len, int freq, int sig_dbm);
7950e76fede8SThomas Pedersen 
7951e76fede8SThomas Pedersen /**
79525e760230SJohannes Berg  * cfg80211_report_obss_beacon - report beacon from other APs
79535e760230SJohannes Berg  * @wiphy: The wiphy that received the beacon
79545e760230SJohannes Berg  * @frame: the frame
79555e760230SJohannes Berg  * @len: length of the frame
79565e760230SJohannes Berg  * @freq: frequency the frame was received on
79576c2fb1e6SSergey Matyukevich  * @sig_dbm: signal strength in dBm, or 0 if unknown
79585e760230SJohannes Berg  *
79595e760230SJohannes Berg  * Use this function to report to userspace when a beacon was
79605e760230SJohannes Berg  * received. It is not useful to call this when there is no
79615e760230SJohannes Berg  * netdev that is in AP/GO mode.
79625e760230SJohannes Berg  */
7963e76fede8SThomas Pedersen static inline void cfg80211_report_obss_beacon(struct wiphy *wiphy,
79645e760230SJohannes Berg 					       const u8 *frame, size_t len,
7965e76fede8SThomas Pedersen 					       int freq, int sig_dbm)
7966e76fede8SThomas Pedersen {
7967e76fede8SThomas Pedersen 	cfg80211_report_obss_beacon_khz(wiphy, frame, len, MHZ_TO_KHZ(freq),
7968e76fede8SThomas Pedersen 					sig_dbm);
7969e76fede8SThomas Pedersen }
79705e760230SJohannes Berg 
7971d58e7e37SJohannes Berg /**
7972683b6d3bSJohannes Berg  * cfg80211_reg_can_beacon - check if beaconing is allowed
797354858ee5SAlexander Simon  * @wiphy: the wiphy
7974683b6d3bSJohannes Berg  * @chandef: the channel definition
7975174e0cd2SIlan Peer  * @iftype: interface type
7976d58e7e37SJohannes Berg  *
79770ae997dcSYacine Belkadi  * Return: %true if there is no secondary channel or the secondary channel(s)
79780ae997dcSYacine Belkadi  * can be used for beaconing (i.e. is not a radar channel etc.)
797954858ee5SAlexander Simon  */
7980683b6d3bSJohannes Berg bool cfg80211_reg_can_beacon(struct wiphy *wiphy,
7981174e0cd2SIlan Peer 			     struct cfg80211_chan_def *chandef,
7982174e0cd2SIlan Peer 			     enum nl80211_iftype iftype);
798354858ee5SAlexander Simon 
7984923b352fSArik Nemtsov /**
7985923b352fSArik Nemtsov  * cfg80211_reg_can_beacon_relax - check if beaconing is allowed with relaxation
7986923b352fSArik Nemtsov  * @wiphy: the wiphy
7987923b352fSArik Nemtsov  * @chandef: the channel definition
7988923b352fSArik Nemtsov  * @iftype: interface type
7989923b352fSArik Nemtsov  *
7990923b352fSArik Nemtsov  * Return: %true if there is no secondary channel or the secondary channel(s)
7991923b352fSArik Nemtsov  * can be used for beaconing (i.e. is not a radar channel etc.). This version
7992923b352fSArik Nemtsov  * also checks if IR-relaxation conditions apply, to allow beaconing under
7993923b352fSArik Nemtsov  * more permissive conditions.
7994923b352fSArik Nemtsov  *
7995a05829a7SJohannes Berg  * Requires the wiphy mutex to be held.
7996923b352fSArik Nemtsov  */
7997923b352fSArik Nemtsov bool cfg80211_reg_can_beacon_relax(struct wiphy *wiphy,
7998923b352fSArik Nemtsov 				   struct cfg80211_chan_def *chandef,
7999923b352fSArik Nemtsov 				   enum nl80211_iftype iftype);
8000923b352fSArik Nemtsov 
80018097e149SThomas Pedersen /*
80025314526bSThomas Pedersen  * cfg80211_ch_switch_notify - update wdev channel and notify userspace
80035314526bSThomas Pedersen  * @dev: the device which switched channels
8004683b6d3bSJohannes Berg  * @chandef: the new channel definition
80057b0a0e3cSJohannes Berg  * @link_id: the link ID for MLO, must be 0 for non-MLO
80065314526bSThomas Pedersen  *
8007e487eaebSSimon Wunderlich  * Caller must acquire wdev_lock, therefore must only be called from sleepable
8008e487eaebSSimon Wunderlich  * driver context!
80095314526bSThomas Pedersen  */
8010683b6d3bSJohannes Berg void cfg80211_ch_switch_notify(struct net_device *dev,
80117b0a0e3cSJohannes Berg 			       struct cfg80211_chan_def *chandef,
80127b0a0e3cSJohannes Berg 			       unsigned int link_id);
80135314526bSThomas Pedersen 
8014f8d7552eSLuciano Coelho /*
8015f8d7552eSLuciano Coelho  * cfg80211_ch_switch_started_notify - notify channel switch start
8016f8d7552eSLuciano Coelho  * @dev: the device on which the channel switch started
8017f8d7552eSLuciano Coelho  * @chandef: the future channel definition
8018f8d7552eSLuciano Coelho  * @count: the number of TBTTs until the channel switch happens
8019669b8413SJohannes Berg  * @quiet: whether or not immediate quiet was requested by the AP
8020f8d7552eSLuciano Coelho  *
8021f8d7552eSLuciano Coelho  * Inform the userspace about the channel switch that has just
8022f8d7552eSLuciano Coelho  * started, so that it can take appropriate actions (eg. starting
8023f8d7552eSLuciano Coelho  * channel switch on other vifs), if necessary.
8024f8d7552eSLuciano Coelho  */
8025f8d7552eSLuciano Coelho void cfg80211_ch_switch_started_notify(struct net_device *dev,
8026f8d7552eSLuciano Coelho 				       struct cfg80211_chan_def *chandef,
8027669b8413SJohannes Berg 				       u8 count, bool quiet);
8028f8d7552eSLuciano Coelho 
80291ce3e82bSJohannes Berg /**
80301ce3e82bSJohannes Berg  * ieee80211_operating_class_to_band - convert operating class to band
80311ce3e82bSJohannes Berg  *
80321ce3e82bSJohannes Berg  * @operating_class: the operating class to convert
80331ce3e82bSJohannes Berg  * @band: band pointer to fill
80341ce3e82bSJohannes Berg  *
80351ce3e82bSJohannes Berg  * Returns %true if the conversion was successful, %false otherwise.
80361ce3e82bSJohannes Berg  */
80371ce3e82bSJohannes Berg bool ieee80211_operating_class_to_band(u8 operating_class,
803857fbcce3SJohannes Berg 				       enum nl80211_band *band);
80391ce3e82bSJohannes Berg 
8040a38700ddSArik Nemtsov /**
8041a38700ddSArik Nemtsov  * ieee80211_chandef_to_operating_class - convert chandef to operation class
8042a38700ddSArik Nemtsov  *
8043a38700ddSArik Nemtsov  * @chandef: the chandef to convert
8044a38700ddSArik Nemtsov  * @op_class: a pointer to the resulting operating class
8045a38700ddSArik Nemtsov  *
8046a38700ddSArik Nemtsov  * Returns %true if the conversion was successful, %false otherwise.
8047a38700ddSArik Nemtsov  */
8048a38700ddSArik Nemtsov bool ieee80211_chandef_to_operating_class(struct cfg80211_chan_def *chandef,
8049a38700ddSArik Nemtsov 					  u8 *op_class);
8050a38700ddSArik Nemtsov 
8051934f4c7dSThomas Pedersen /**
8052934f4c7dSThomas Pedersen  * ieee80211_chandef_to_khz - convert chandef to frequency in KHz
8053934f4c7dSThomas Pedersen  *
8054934f4c7dSThomas Pedersen  * @chandef: the chandef to convert
8055934f4c7dSThomas Pedersen  *
8056934f4c7dSThomas Pedersen  * Returns the center frequency of chandef (1st segment) in KHz.
8057934f4c7dSThomas Pedersen  */
8058934f4c7dSThomas Pedersen static inline u32
8059934f4c7dSThomas Pedersen ieee80211_chandef_to_khz(const struct cfg80211_chan_def *chandef)
8060934f4c7dSThomas Pedersen {
8061934f4c7dSThomas Pedersen 	return MHZ_TO_KHZ(chandef->center_freq1) + chandef->freq1_offset;
8062934f4c7dSThomas Pedersen }
8063934f4c7dSThomas Pedersen 
80645314526bSThomas Pedersen /*
80653475b094SJouni Malinen  * cfg80211_tdls_oper_request - request userspace to perform TDLS operation
80663475b094SJouni Malinen  * @dev: the device on which the operation is requested
80673475b094SJouni Malinen  * @peer: the MAC address of the peer device
80683475b094SJouni Malinen  * @oper: the requested TDLS operation (NL80211_TDLS_SETUP or
80693475b094SJouni Malinen  *	NL80211_TDLS_TEARDOWN)
80703475b094SJouni Malinen  * @reason_code: the reason code for teardown request
80713475b094SJouni Malinen  * @gfp: allocation flags
80723475b094SJouni Malinen  *
80733475b094SJouni Malinen  * This function is used to request userspace to perform TDLS operation that
80743475b094SJouni Malinen  * requires knowledge of keys, i.e., link setup or teardown when the AP
80753475b094SJouni Malinen  * connection uses encryption. This is optional mechanism for the driver to use
80763475b094SJouni Malinen  * if it can automatically determine when a TDLS link could be useful (e.g.,
80773475b094SJouni Malinen  * based on traffic and signal strength for a peer).
80783475b094SJouni Malinen  */
80793475b094SJouni Malinen void cfg80211_tdls_oper_request(struct net_device *dev, const u8 *peer,
80803475b094SJouni Malinen 				enum nl80211_tdls_operation oper,
80813475b094SJouni Malinen 				u16 reason_code, gfp_t gfp);
80823475b094SJouni Malinen 
80833475b094SJouni Malinen /*
80848097e149SThomas Pedersen  * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units)
80858097e149SThomas Pedersen  * @rate: given rate_info to calculate bitrate from
80868097e149SThomas Pedersen  *
80878097e149SThomas Pedersen  * return 0 if MCS index >= 32
80888097e149SThomas Pedersen  */
80898eb41c8dSVladimir Kondratiev u32 cfg80211_calculate_bitrate(struct rate_info *rate);
80908097e149SThomas Pedersen 
809198104fdeSJohannes Berg /**
809298104fdeSJohannes Berg  * cfg80211_unregister_wdev - remove the given wdev
809398104fdeSJohannes Berg  * @wdev: struct wireless_dev to remove
809498104fdeSJohannes Berg  *
80952fe8ef10SJohannes Berg  * This function removes the device so it can no longer be used. It is necessary
80962fe8ef10SJohannes Berg  * to call this function even when cfg80211 requests the removal of the device
80972fe8ef10SJohannes Berg  * by calling the del_virtual_intf() callback. The function must also be called
80982fe8ef10SJohannes Berg  * when the driver wishes to unregister the wdev, e.g. when the hardware device
80992fe8ef10SJohannes Berg  * is unbound from the driver.
810098104fdeSJohannes Berg  *
8101a05829a7SJohannes Berg  * Requires the RTNL and wiphy mutex to be held.
810298104fdeSJohannes Berg  */
810398104fdeSJohannes Berg void cfg80211_unregister_wdev(struct wireless_dev *wdev);
810498104fdeSJohannes Berg 
81050ee45355SJohannes Berg /**
81062fe8ef10SJohannes Berg  * cfg80211_register_netdevice - register the given netdev
81072fe8ef10SJohannes Berg  * @dev: the netdev to register
81082fe8ef10SJohannes Berg  *
81092fe8ef10SJohannes Berg  * Note: In contexts coming from cfg80211 callbacks, you must call this rather
81102fe8ef10SJohannes Berg  * than register_netdevice(), unregister_netdev() is impossible as the RTNL is
81112fe8ef10SJohannes Berg  * held. Otherwise, both register_netdevice() and register_netdev() are usable
81122fe8ef10SJohannes Berg  * instead as well.
8113a05829a7SJohannes Berg  *
8114a05829a7SJohannes Berg  * Requires the RTNL and wiphy mutex to be held.
81152fe8ef10SJohannes Berg  */
81162fe8ef10SJohannes Berg int cfg80211_register_netdevice(struct net_device *dev);
81172fe8ef10SJohannes Berg 
81182fe8ef10SJohannes Berg /**
81192fe8ef10SJohannes Berg  * cfg80211_unregister_netdevice - unregister the given netdev
81202fe8ef10SJohannes Berg  * @dev: the netdev to register
81212fe8ef10SJohannes Berg  *
81222fe8ef10SJohannes Berg  * Note: In contexts coming from cfg80211 callbacks, you must call this rather
81232fe8ef10SJohannes Berg  * than unregister_netdevice(), unregister_netdev() is impossible as the RTNL
81242fe8ef10SJohannes Berg  * is held. Otherwise, both unregister_netdevice() and unregister_netdev() are
81252fe8ef10SJohannes Berg  * usable instead as well.
8126a05829a7SJohannes Berg  *
8127a05829a7SJohannes Berg  * Requires the RTNL and wiphy mutex to be held.
81282fe8ef10SJohannes Berg  */
81292fe8ef10SJohannes Berg static inline void cfg80211_unregister_netdevice(struct net_device *dev)
81302fe8ef10SJohannes Berg {
8131c304eddcSJakub Kicinski #if IS_ENABLED(CONFIG_CFG80211)
81322fe8ef10SJohannes Berg 	cfg80211_unregister_wdev(dev->ieee80211_ptr);
8133c304eddcSJakub Kicinski #endif
81342fe8ef10SJohannes Berg }
81352fe8ef10SJohannes Berg 
81362fe8ef10SJohannes Berg /**
8137b1e8eb11SMauro Carvalho Chehab  * struct cfg80211_ft_event_params - FT Information Elements
8138355199e0SJouni Malinen  * @ies: FT IEs
8139355199e0SJouni Malinen  * @ies_len: length of the FT IE in bytes
8140355199e0SJouni Malinen  * @target_ap: target AP's MAC address
8141355199e0SJouni Malinen  * @ric_ies: RIC IE
8142355199e0SJouni Malinen  * @ric_ies_len: length of the RIC IE in bytes
8143355199e0SJouni Malinen  */
8144355199e0SJouni Malinen struct cfg80211_ft_event_params {
8145355199e0SJouni Malinen 	const u8 *ies;
8146355199e0SJouni Malinen 	size_t ies_len;
8147355199e0SJouni Malinen 	const u8 *target_ap;
8148355199e0SJouni Malinen 	const u8 *ric_ies;
8149355199e0SJouni Malinen 	size_t ric_ies_len;
8150355199e0SJouni Malinen };
8151355199e0SJouni Malinen 
8152355199e0SJouni Malinen /**
8153355199e0SJouni Malinen  * cfg80211_ft_event - notify userspace about FT IE and RIC IE
8154355199e0SJouni Malinen  * @netdev: network device
8155355199e0SJouni Malinen  * @ft_event: IE information
8156355199e0SJouni Malinen  */
8157355199e0SJouni Malinen void cfg80211_ft_event(struct net_device *netdev,
8158355199e0SJouni Malinen 		       struct cfg80211_ft_event_params *ft_event);
8159355199e0SJouni Malinen 
8160355199e0SJouni Malinen /**
81610ee45355SJohannes Berg  * cfg80211_get_p2p_attr - find and copy a P2P attribute from IE buffer
81620ee45355SJohannes Berg  * @ies: the input IE buffer
81630ee45355SJohannes Berg  * @len: the input length
81640ee45355SJohannes Berg  * @attr: the attribute ID to find
81650ee45355SJohannes Berg  * @buf: output buffer, can be %NULL if the data isn't needed, e.g.
81660ee45355SJohannes Berg  *	if the function is only called to get the needed buffer size
81670ee45355SJohannes Berg  * @bufsize: size of the output buffer
81680ee45355SJohannes Berg  *
81690ee45355SJohannes Berg  * The function finds a given P2P attribute in the (vendor) IEs and
81700ee45355SJohannes Berg  * copies its contents to the given buffer.
81710ee45355SJohannes Berg  *
81720ae997dcSYacine Belkadi  * Return: A negative error code (-%EILSEQ or -%ENOENT) if the data is
81730ae997dcSYacine Belkadi  * malformed or the attribute can't be found (respectively), or the
81740ae997dcSYacine Belkadi  * length of the found attribute (which can be zero).
81750ee45355SJohannes Berg  */
8176c216e641SArend van Spriel int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len,
8177c216e641SArend van Spriel 			  enum ieee80211_p2p_attr_id attr,
8178c216e641SArend van Spriel 			  u8 *buf, unsigned int bufsize);
81790ee45355SJohannes Berg 
8180cd8f7cb4SJohannes Berg /**
818129464cccSJohannes Berg  * ieee80211_ie_split_ric - split an IE buffer according to ordering (with RIC)
818229464cccSJohannes Berg  * @ies: the IE buffer
818329464cccSJohannes Berg  * @ielen: the length of the IE buffer
818429464cccSJohannes Berg  * @ids: an array with element IDs that are allowed before
81852512b1b1SLiad Kaufman  *	the split. A WLAN_EID_EXTENSION value means that the next
81862512b1b1SLiad Kaufman  *	EID in the list is a sub-element of the EXTENSION IE.
818729464cccSJohannes Berg  * @n_ids: the size of the element ID array
818829464cccSJohannes Berg  * @after_ric: array IE types that come after the RIC element
818929464cccSJohannes Berg  * @n_after_ric: size of the @after_ric array
819029464cccSJohannes Berg  * @offset: offset where to start splitting in the buffer
819129464cccSJohannes Berg  *
819229464cccSJohannes Berg  * This function splits an IE buffer by updating the @offset
819329464cccSJohannes Berg  * variable to point to the location where the buffer should be
819429464cccSJohannes Berg  * split.
819529464cccSJohannes Berg  *
819629464cccSJohannes Berg  * It assumes that the given IE buffer is well-formed, this
819729464cccSJohannes Berg  * has to be guaranteed by the caller!
819829464cccSJohannes Berg  *
819929464cccSJohannes Berg  * It also assumes that the IEs in the buffer are ordered
820029464cccSJohannes Berg  * correctly, if not the result of using this function will not
820129464cccSJohannes Berg  * be ordered correctly either, i.e. it does no reordering.
820229464cccSJohannes Berg  *
820329464cccSJohannes Berg  * The function returns the offset where the next part of the
820429464cccSJohannes Berg  * buffer starts, which may be @ielen if the entire (remainder)
820529464cccSJohannes Berg  * of the buffer should be used.
820629464cccSJohannes Berg  */
820729464cccSJohannes Berg size_t ieee80211_ie_split_ric(const u8 *ies, size_t ielen,
820829464cccSJohannes Berg 			      const u8 *ids, int n_ids,
820929464cccSJohannes Berg 			      const u8 *after_ric, int n_after_ric,
821029464cccSJohannes Berg 			      size_t offset);
821129464cccSJohannes Berg 
821229464cccSJohannes Berg /**
821329464cccSJohannes Berg  * ieee80211_ie_split - split an IE buffer according to ordering
821429464cccSJohannes Berg  * @ies: the IE buffer
821529464cccSJohannes Berg  * @ielen: the length of the IE buffer
821629464cccSJohannes Berg  * @ids: an array with element IDs that are allowed before
82172512b1b1SLiad Kaufman  *	the split. A WLAN_EID_EXTENSION value means that the next
82182512b1b1SLiad Kaufman  *	EID in the list is a sub-element of the EXTENSION IE.
821929464cccSJohannes Berg  * @n_ids: the size of the element ID array
822029464cccSJohannes Berg  * @offset: offset where to start splitting in the buffer
822129464cccSJohannes Berg  *
822229464cccSJohannes Berg  * This function splits an IE buffer by updating the @offset
822329464cccSJohannes Berg  * variable to point to the location where the buffer should be
822429464cccSJohannes Berg  * split.
822529464cccSJohannes Berg  *
822629464cccSJohannes Berg  * It assumes that the given IE buffer is well-formed, this
822729464cccSJohannes Berg  * has to be guaranteed by the caller!
822829464cccSJohannes Berg  *
822929464cccSJohannes Berg  * It also assumes that the IEs in the buffer are ordered
823029464cccSJohannes Berg  * correctly, if not the result of using this function will not
823129464cccSJohannes Berg  * be ordered correctly either, i.e. it does no reordering.
823229464cccSJohannes Berg  *
823329464cccSJohannes Berg  * The function returns the offset where the next part of the
823429464cccSJohannes Berg  * buffer starts, which may be @ielen if the entire (remainder)
823529464cccSJohannes Berg  * of the buffer should be used.
823629464cccSJohannes Berg  */
82370483eeacSJohannes Berg static inline size_t ieee80211_ie_split(const u8 *ies, size_t ielen,
82380483eeacSJohannes Berg 					const u8 *ids, int n_ids, size_t offset)
82390483eeacSJohannes Berg {
82400483eeacSJohannes Berg 	return ieee80211_ie_split_ric(ies, ielen, ids, n_ids, NULL, 0, offset);
82410483eeacSJohannes Berg }
824229464cccSJohannes Berg 
824329464cccSJohannes Berg /**
8244cd8f7cb4SJohannes Berg  * cfg80211_report_wowlan_wakeup - report wakeup from WoWLAN
8245cd8f7cb4SJohannes Berg  * @wdev: the wireless device reporting the wakeup
8246cd8f7cb4SJohannes Berg  * @wakeup: the wakeup report
8247cd8f7cb4SJohannes Berg  * @gfp: allocation flags
8248cd8f7cb4SJohannes Berg  *
8249cd8f7cb4SJohannes Berg  * This function reports that the given device woke up. If it
8250cd8f7cb4SJohannes Berg  * caused the wakeup, report the reason(s), otherwise you may
8251cd8f7cb4SJohannes Berg  * pass %NULL as the @wakeup parameter to advertise that something
8252cd8f7cb4SJohannes Berg  * else caused the wakeup.
8253cd8f7cb4SJohannes Berg  */
8254cd8f7cb4SJohannes Berg void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev,
8255cd8f7cb4SJohannes Berg 				   struct cfg80211_wowlan_wakeup *wakeup,
8256cd8f7cb4SJohannes Berg 				   gfp_t gfp);
8257cd8f7cb4SJohannes Berg 
82585de17984SArend van Spriel /**
82595de17984SArend van Spriel  * cfg80211_crit_proto_stopped() - indicate critical protocol stopped by driver.
82605de17984SArend van Spriel  *
82615de17984SArend van Spriel  * @wdev: the wireless device for which critical protocol is stopped.
826203f831a6SRobert P. J. Day  * @gfp: allocation flags
82635de17984SArend van Spriel  *
82645de17984SArend van Spriel  * This function can be called by the driver to indicate it has reverted
82655de17984SArend van Spriel  * operation back to normal. One reason could be that the duration given
82665de17984SArend van Spriel  * by .crit_proto_start() has expired.
82675de17984SArend van Spriel  */
82685de17984SArend van Spriel void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp);
82695de17984SArend van Spriel 
8270bdfbec2dSIlan Peer /**
8271bdfbec2dSIlan Peer  * ieee80211_get_num_supported_channels - get number of channels device has
8272bdfbec2dSIlan Peer  * @wiphy: the wiphy
8273bdfbec2dSIlan Peer  *
8274bdfbec2dSIlan Peer  * Return: the number of channels supported by the device.
8275bdfbec2dSIlan Peer  */
8276bdfbec2dSIlan Peer unsigned int ieee80211_get_num_supported_channels(struct wiphy *wiphy);
8277bdfbec2dSIlan Peer 
8278cb2d956dSLuciano Coelho /**
8279cb2d956dSLuciano Coelho  * cfg80211_check_combinations - check interface combinations
8280cb2d956dSLuciano Coelho  *
8281cb2d956dSLuciano Coelho  * @wiphy: the wiphy
8282e227300cSPurushottam Kushwaha  * @params: the interface combinations parameter
8283cb2d956dSLuciano Coelho  *
8284cb2d956dSLuciano Coelho  * This function can be called by the driver to check whether a
8285cb2d956dSLuciano Coelho  * combination of interfaces and their types are allowed according to
8286cb2d956dSLuciano Coelho  * the interface combinations.
8287cb2d956dSLuciano Coelho  */
8288cb2d956dSLuciano Coelho int cfg80211_check_combinations(struct wiphy *wiphy,
8289e227300cSPurushottam Kushwaha 				struct iface_combination_params *params);
8290cb2d956dSLuciano Coelho 
829165a124ddSMichal Kazior /**
829265a124ddSMichal Kazior  * cfg80211_iter_combinations - iterate over matching combinations
829365a124ddSMichal Kazior  *
829465a124ddSMichal Kazior  * @wiphy: the wiphy
8295e227300cSPurushottam Kushwaha  * @params: the interface combinations parameter
829665a124ddSMichal Kazior  * @iter: function to call for each matching combination
829765a124ddSMichal Kazior  * @data: pointer to pass to iter function
829865a124ddSMichal Kazior  *
829965a124ddSMichal Kazior  * This function can be called by the driver to check what possible
830065a124ddSMichal Kazior  * combinations it fits in at a given moment, e.g. for channel switching
830165a124ddSMichal Kazior  * purposes.
830265a124ddSMichal Kazior  */
830365a124ddSMichal Kazior int cfg80211_iter_combinations(struct wiphy *wiphy,
8304e227300cSPurushottam Kushwaha 			       struct iface_combination_params *params,
830565a124ddSMichal Kazior 			       void (*iter)(const struct ieee80211_iface_combination *c,
830665a124ddSMichal Kazior 					    void *data),
830765a124ddSMichal Kazior 			       void *data);
830865a124ddSMichal Kazior 
8309f04c2203SMichal Kazior /*
8310f04c2203SMichal Kazior  * cfg80211_stop_iface - trigger interface disconnection
8311f04c2203SMichal Kazior  *
8312f04c2203SMichal Kazior  * @wiphy: the wiphy
8313f04c2203SMichal Kazior  * @wdev: wireless device
8314f04c2203SMichal Kazior  * @gfp: context flags
8315f04c2203SMichal Kazior  *
8316f04c2203SMichal Kazior  * Trigger interface to be stopped as if AP was stopped, IBSS/mesh left, STA
8317f04c2203SMichal Kazior  * disconnected.
8318f04c2203SMichal Kazior  *
8319f04c2203SMichal Kazior  * Note: This doesn't need any locks and is asynchronous.
8320f04c2203SMichal Kazior  */
8321f04c2203SMichal Kazior void cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev,
8322f04c2203SMichal Kazior 			 gfp_t gfp);
8323f04c2203SMichal Kazior 
8324f6837ba8SJohannes Berg /**
8325f6837ba8SJohannes Berg  * cfg80211_shutdown_all_interfaces - shut down all interfaces for a wiphy
8326f6837ba8SJohannes Berg  * @wiphy: the wiphy to shut down
8327f6837ba8SJohannes Berg  *
8328f6837ba8SJohannes Berg  * This function shuts down all interfaces belonging to this wiphy by
8329f6837ba8SJohannes Berg  * calling dev_close() (and treating non-netdev interfaces as needed).
8330f6837ba8SJohannes Berg  * It shouldn't really be used unless there are some fatal device errors
8331f6837ba8SJohannes Berg  * that really can't be recovered in any other way.
8332f6837ba8SJohannes Berg  *
8333f6837ba8SJohannes Berg  * Callers must hold the RTNL and be able to deal with callbacks into
8334f6837ba8SJohannes Berg  * the driver while the function is running.
8335f6837ba8SJohannes Berg  */
8336f6837ba8SJohannes Berg void cfg80211_shutdown_all_interfaces(struct wiphy *wiphy);
8337f6837ba8SJohannes Berg 
8338d75bb06bSGautam Kumar Shukla /**
8339d75bb06bSGautam Kumar Shukla  * wiphy_ext_feature_set - set the extended feature flag
8340d75bb06bSGautam Kumar Shukla  *
8341d75bb06bSGautam Kumar Shukla  * @wiphy: the wiphy to modify.
8342d75bb06bSGautam Kumar Shukla  * @ftidx: extended feature bit index.
8343d75bb06bSGautam Kumar Shukla  *
8344d75bb06bSGautam Kumar Shukla  * The extended features are flagged in multiple bytes (see
8345d75bb06bSGautam Kumar Shukla  * &struct wiphy.@ext_features)
8346d75bb06bSGautam Kumar Shukla  */
8347d75bb06bSGautam Kumar Shukla static inline void wiphy_ext_feature_set(struct wiphy *wiphy,
8348d75bb06bSGautam Kumar Shukla 					 enum nl80211_ext_feature_index ftidx)
8349d75bb06bSGautam Kumar Shukla {
8350d75bb06bSGautam Kumar Shukla 	u8 *ft_byte;
8351d75bb06bSGautam Kumar Shukla 
8352d75bb06bSGautam Kumar Shukla 	ft_byte = &wiphy->ext_features[ftidx / 8];
8353d75bb06bSGautam Kumar Shukla 	*ft_byte |= BIT(ftidx % 8);
8354d75bb06bSGautam Kumar Shukla }
8355d75bb06bSGautam Kumar Shukla 
8356d75bb06bSGautam Kumar Shukla /**
8357d75bb06bSGautam Kumar Shukla  * wiphy_ext_feature_isset - check the extended feature flag
8358d75bb06bSGautam Kumar Shukla  *
8359d75bb06bSGautam Kumar Shukla  * @wiphy: the wiphy to modify.
8360d75bb06bSGautam Kumar Shukla  * @ftidx: extended feature bit index.
8361d75bb06bSGautam Kumar Shukla  *
8362d75bb06bSGautam Kumar Shukla  * The extended features are flagged in multiple bytes (see
8363d75bb06bSGautam Kumar Shukla  * &struct wiphy.@ext_features)
8364d75bb06bSGautam Kumar Shukla  */
8365d75bb06bSGautam Kumar Shukla static inline bool
8366d75bb06bSGautam Kumar Shukla wiphy_ext_feature_isset(struct wiphy *wiphy,
8367d75bb06bSGautam Kumar Shukla 			enum nl80211_ext_feature_index ftidx)
8368d75bb06bSGautam Kumar Shukla {
8369d75bb06bSGautam Kumar Shukla 	u8 ft_byte;
8370d75bb06bSGautam Kumar Shukla 
8371d75bb06bSGautam Kumar Shukla 	ft_byte = wiphy->ext_features[ftidx / 8];
8372d75bb06bSGautam Kumar Shukla 	return (ft_byte & BIT(ftidx % 8)) != 0;
8373d75bb06bSGautam Kumar Shukla }
8374b7ffbd7eSJohannes Berg 
8375a442b761SAyala Beker /**
8376a442b761SAyala Beker  * cfg80211_free_nan_func - free NAN function
8377a442b761SAyala Beker  * @f: NAN function that should be freed
8378a442b761SAyala Beker  *
8379a442b761SAyala Beker  * Frees all the NAN function and all it's allocated members.
8380a442b761SAyala Beker  */
8381a442b761SAyala Beker void cfg80211_free_nan_func(struct cfg80211_nan_func *f);
8382a442b761SAyala Beker 
838350bcd31dSAyala Beker /**
838450bcd31dSAyala Beker  * struct cfg80211_nan_match_params - NAN match parameters
838550bcd31dSAyala Beker  * @type: the type of the function that triggered a match. If it is
838650bcd31dSAyala Beker  *	 %NL80211_NAN_FUNC_SUBSCRIBE it means that we replied to a subscriber.
838750bcd31dSAyala Beker  *	 If it is %NL80211_NAN_FUNC_PUBLISH, it means that we got a discovery
838850bcd31dSAyala Beker  *	 result.
838950bcd31dSAyala Beker  *	 If it is %NL80211_NAN_FUNC_FOLLOW_UP, we received a follow up.
839050bcd31dSAyala Beker  * @inst_id: the local instance id
839150bcd31dSAyala Beker  * @peer_inst_id: the instance id of the peer's function
839250bcd31dSAyala Beker  * @addr: the MAC address of the peer
839350bcd31dSAyala Beker  * @info_len: the length of the &info
839450bcd31dSAyala Beker  * @info: the Service Specific Info from the peer (if any)
839550bcd31dSAyala Beker  * @cookie: unique identifier of the corresponding function
839650bcd31dSAyala Beker  */
839750bcd31dSAyala Beker struct cfg80211_nan_match_params {
839850bcd31dSAyala Beker 	enum nl80211_nan_function_type type;
839950bcd31dSAyala Beker 	u8 inst_id;
840050bcd31dSAyala Beker 	u8 peer_inst_id;
840150bcd31dSAyala Beker 	const u8 *addr;
840250bcd31dSAyala Beker 	u8 info_len;
840350bcd31dSAyala Beker 	const u8 *info;
840450bcd31dSAyala Beker 	u64 cookie;
840550bcd31dSAyala Beker };
840650bcd31dSAyala Beker 
840750bcd31dSAyala Beker /**
840850bcd31dSAyala Beker  * cfg80211_nan_match - report a match for a NAN function.
840950bcd31dSAyala Beker  * @wdev: the wireless device reporting the match
841050bcd31dSAyala Beker  * @match: match notification parameters
841150bcd31dSAyala Beker  * @gfp: allocation flags
841250bcd31dSAyala Beker  *
841350bcd31dSAyala Beker  * This function reports that the a NAN function had a match. This
841450bcd31dSAyala Beker  * can be a subscribe that had a match or a solicited publish that
841550bcd31dSAyala Beker  * was sent. It can also be a follow up that was received.
841650bcd31dSAyala Beker  */
841750bcd31dSAyala Beker void cfg80211_nan_match(struct wireless_dev *wdev,
841850bcd31dSAyala Beker 			struct cfg80211_nan_match_params *match, gfp_t gfp);
841950bcd31dSAyala Beker 
8420368e5a7bSAyala Beker /**
8421368e5a7bSAyala Beker  * cfg80211_nan_func_terminated - notify about NAN function termination.
8422368e5a7bSAyala Beker  *
8423368e5a7bSAyala Beker  * @wdev: the wireless device reporting the match
8424368e5a7bSAyala Beker  * @inst_id: the local instance id
8425368e5a7bSAyala Beker  * @reason: termination reason (one of the NL80211_NAN_FUNC_TERM_REASON_*)
8426368e5a7bSAyala Beker  * @cookie: unique NAN function identifier
8427368e5a7bSAyala Beker  * @gfp: allocation flags
8428368e5a7bSAyala Beker  *
8429368e5a7bSAyala Beker  * This function reports that the a NAN function is terminated.
8430368e5a7bSAyala Beker  */
8431368e5a7bSAyala Beker void cfg80211_nan_func_terminated(struct wireless_dev *wdev,
8432368e5a7bSAyala Beker 				  u8 inst_id,
8433368e5a7bSAyala Beker 				  enum nl80211_nan_func_term_reason reason,
8434368e5a7bSAyala Beker 				  u64 cookie, gfp_t gfp);
8435368e5a7bSAyala Beker 
8436b7ffbd7eSJohannes Berg /* ethtool helper */
8437b7ffbd7eSJohannes Berg void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info);
8438b7ffbd7eSJohannes Berg 
843940cbfa90SSrinivas Dasari /**
844040cbfa90SSrinivas Dasari  * cfg80211_external_auth_request - userspace request for authentication
844140cbfa90SSrinivas Dasari  * @netdev: network device
844240cbfa90SSrinivas Dasari  * @params: External authentication parameters
844340cbfa90SSrinivas Dasari  * @gfp: allocation flags
844440cbfa90SSrinivas Dasari  * Returns: 0 on success, < 0 on error
844540cbfa90SSrinivas Dasari  */
844640cbfa90SSrinivas Dasari int cfg80211_external_auth_request(struct net_device *netdev,
844740cbfa90SSrinivas Dasari 				   struct cfg80211_external_auth_params *params,
844840cbfa90SSrinivas Dasari 				   gfp_t gfp);
844940cbfa90SSrinivas Dasari 
84509bb7e0f2SJohannes Berg /**
84519bb7e0f2SJohannes Berg  * cfg80211_pmsr_report - report peer measurement result data
84529bb7e0f2SJohannes Berg  * @wdev: the wireless device reporting the measurement
84539bb7e0f2SJohannes Berg  * @req: the original measurement request
84549bb7e0f2SJohannes Berg  * @result: the result data
84559bb7e0f2SJohannes Berg  * @gfp: allocation flags
84569bb7e0f2SJohannes Berg  */
84579bb7e0f2SJohannes Berg void cfg80211_pmsr_report(struct wireless_dev *wdev,
84589bb7e0f2SJohannes Berg 			  struct cfg80211_pmsr_request *req,
84599bb7e0f2SJohannes Berg 			  struct cfg80211_pmsr_result *result,
84609bb7e0f2SJohannes Berg 			  gfp_t gfp);
84619bb7e0f2SJohannes Berg 
84629bb7e0f2SJohannes Berg /**
84639bb7e0f2SJohannes Berg  * cfg80211_pmsr_complete - report peer measurement completed
84649bb7e0f2SJohannes Berg  * @wdev: the wireless device reporting the measurement
84659bb7e0f2SJohannes Berg  * @req: the original measurement request
84669bb7e0f2SJohannes Berg  * @gfp: allocation flags
84679bb7e0f2SJohannes Berg  *
84689bb7e0f2SJohannes Berg  * Report that the entire measurement completed, after this
84699bb7e0f2SJohannes Berg  * the request pointer will no longer be valid.
84709bb7e0f2SJohannes Berg  */
84719bb7e0f2SJohannes Berg void cfg80211_pmsr_complete(struct wireless_dev *wdev,
84729bb7e0f2SJohannes Berg 			    struct cfg80211_pmsr_request *req,
84739bb7e0f2SJohannes Berg 			    gfp_t gfp);
84749bb7e0f2SJohannes Berg 
8475e6f40511SManikanta Pubbisetty /**
8476e6f40511SManikanta Pubbisetty  * cfg80211_iftype_allowed - check whether the interface can be allowed
8477e6f40511SManikanta Pubbisetty  * @wiphy: the wiphy
8478e6f40511SManikanta Pubbisetty  * @iftype: interface type
8479e6f40511SManikanta Pubbisetty  * @is_4addr: use_4addr flag, must be '0' when check_swif is '1'
8480e6f40511SManikanta Pubbisetty  * @check_swif: check iftype against software interfaces
8481e6f40511SManikanta Pubbisetty  *
8482e6f40511SManikanta Pubbisetty  * Check whether the interface is allowed to operate; additionally, this API
8483e6f40511SManikanta Pubbisetty  * can be used to check iftype against the software interfaces when
8484e6f40511SManikanta Pubbisetty  * check_swif is '1'.
8485e6f40511SManikanta Pubbisetty  */
8486e6f40511SManikanta Pubbisetty bool cfg80211_iftype_allowed(struct wiphy *wiphy, enum nl80211_iftype iftype,
8487e6f40511SManikanta Pubbisetty 			     bool is_4addr, u8 check_swif);
8488e6f40511SManikanta Pubbisetty 
8489e6f40511SManikanta Pubbisetty 
8490a083ee8aSIlan Peer /**
8491a083ee8aSIlan Peer  * cfg80211_assoc_comeback - notification of association that was
8492a083ee8aSIlan Peer  * temporarly rejected with a comeback
8493a083ee8aSIlan Peer  * @netdev: network device
8494a083ee8aSIlan Peer  * @bss: the bss entry with which association is in progress.
8495a083ee8aSIlan Peer  * @timeout: timeout interval value TUs.
8496a083ee8aSIlan Peer  *
8497a083ee8aSIlan Peer  * this function may sleep. the caller must hold the corresponding wdev's mutex.
8498a083ee8aSIlan Peer  */
8499a083ee8aSIlan Peer void cfg80211_assoc_comeback(struct net_device *netdev,
8500a083ee8aSIlan Peer 			     struct cfg80211_bss *bss, u32 timeout);
8501a083ee8aSIlan Peer 
8502e1db74fcSJoe Perches /* Logging, debugging and troubleshooting/diagnostic helpers. */
8503e1db74fcSJoe Perches 
8504e1db74fcSJoe Perches /* wiphy_printk helpers, similar to dev_printk */
8505e1db74fcSJoe Perches 
8506e1db74fcSJoe Perches #define wiphy_printk(level, wiphy, format, args...)		\
85079c376639SJoe Perches 	dev_printk(level, &(wiphy)->dev, format, ##args)
8508e1db74fcSJoe Perches #define wiphy_emerg(wiphy, format, args...)			\
85099c376639SJoe Perches 	dev_emerg(&(wiphy)->dev, format, ##args)
8510e1db74fcSJoe Perches #define wiphy_alert(wiphy, format, args...)			\
85119c376639SJoe Perches 	dev_alert(&(wiphy)->dev, format, ##args)
8512e1db74fcSJoe Perches #define wiphy_crit(wiphy, format, args...)			\
85139c376639SJoe Perches 	dev_crit(&(wiphy)->dev, format, ##args)
8514e1db74fcSJoe Perches #define wiphy_err(wiphy, format, args...)			\
85159c376639SJoe Perches 	dev_err(&(wiphy)->dev, format, ##args)
8516e1db74fcSJoe Perches #define wiphy_warn(wiphy, format, args...)			\
85179c376639SJoe Perches 	dev_warn(&(wiphy)->dev, format, ##args)
8518e1db74fcSJoe Perches #define wiphy_notice(wiphy, format, args...)			\
85199c376639SJoe Perches 	dev_notice(&(wiphy)->dev, format, ##args)
8520e1db74fcSJoe Perches #define wiphy_info(wiphy, format, args...)			\
85219c376639SJoe Perches 	dev_info(&(wiphy)->dev, format, ##args)
8522761025b5SDmitry Osipenko #define wiphy_info_once(wiphy, format, args...)			\
8523761025b5SDmitry Osipenko 	dev_info_once(&(wiphy)->dev, format, ##args)
8524073730d7SJoe Perches 
8525a58d7525SStanislaw Gruszka #define wiphy_err_ratelimited(wiphy, format, args...)		\
8526a58d7525SStanislaw Gruszka 	dev_err_ratelimited(&(wiphy)->dev, format, ##args)
8527a58d7525SStanislaw Gruszka #define wiphy_warn_ratelimited(wiphy, format, args...)		\
8528a58d7525SStanislaw Gruszka 	dev_warn_ratelimited(&(wiphy)->dev, format, ##args)
8529a58d7525SStanislaw Gruszka 
85309c376639SJoe Perches #define wiphy_debug(wiphy, format, args...)			\
8531e1db74fcSJoe Perches 	wiphy_printk(KERN_DEBUG, wiphy, format, ##args)
85329c376639SJoe Perches 
8533e1db74fcSJoe Perches #define wiphy_dbg(wiphy, format, args...)			\
85349c376639SJoe Perches 	dev_dbg(&(wiphy)->dev, format, ##args)
8535e1db74fcSJoe Perches 
8536e1db74fcSJoe Perches #if defined(VERBOSE_DEBUG)
8537e1db74fcSJoe Perches #define wiphy_vdbg	wiphy_dbg
8538e1db74fcSJoe Perches #else
8539e1db74fcSJoe Perches #define wiphy_vdbg(wiphy, format, args...)				\
8540e1db74fcSJoe Perches ({									\
8541e1db74fcSJoe Perches 	if (0)								\
8542e1db74fcSJoe Perches 		wiphy_printk(KERN_DEBUG, wiphy, format, ##args);	\
8543e1db74fcSJoe Perches 	0;								\
8544e1db74fcSJoe Perches })
8545e1db74fcSJoe Perches #endif
8546e1db74fcSJoe Perches 
8547e1db74fcSJoe Perches /*
8548e1db74fcSJoe Perches  * wiphy_WARN() acts like wiphy_printk(), but with the key difference
8549e1db74fcSJoe Perches  * of using a WARN/WARN_ON to get the message out, including the
8550e1db74fcSJoe Perches  * file/line information and a backtrace.
8551e1db74fcSJoe Perches  */
8552e1db74fcSJoe Perches #define wiphy_WARN(wiphy, format, args...)			\
8553e1db74fcSJoe Perches 	WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args);
8554e1db74fcSJoe Perches 
8555cb74e977SSunil Dutt /**
8556cb74e977SSunil Dutt  * cfg80211_update_owe_info_event - Notify the peer's OWE info to user space
8557cb74e977SSunil Dutt  * @netdev: network device
8558cb74e977SSunil Dutt  * @owe_info: peer's owe info
8559cb74e977SSunil Dutt  * @gfp: allocation flags
8560cb74e977SSunil Dutt  */
8561cb74e977SSunil Dutt void cfg80211_update_owe_info_event(struct net_device *netdev,
8562cb74e977SSunil Dutt 				    struct cfg80211_update_owe_info *owe_info,
8563cb74e977SSunil Dutt 				    gfp_t gfp);
8564cb74e977SSunil Dutt 
85652f1805eaSEmmanuel Grumbach /**
85662f1805eaSEmmanuel Grumbach  * cfg80211_bss_flush - resets all the scan entries
85672f1805eaSEmmanuel Grumbach  * @wiphy: the wiphy
85682f1805eaSEmmanuel Grumbach  */
85692f1805eaSEmmanuel Grumbach void cfg80211_bss_flush(struct wiphy *wiphy);
85702f1805eaSEmmanuel Grumbach 
85710d2ab3aeSJohn Crispin /**
85720d2ab3aeSJohn Crispin  * cfg80211_bss_color_notify - notify about bss color event
85730d2ab3aeSJohn Crispin  * @dev: network device
85740d2ab3aeSJohn Crispin  * @gfp: allocation flags
85750d2ab3aeSJohn Crispin  * @cmd: the actual event we want to notify
85760d2ab3aeSJohn Crispin  * @count: the number of TBTTs until the color change happens
85770d2ab3aeSJohn Crispin  * @color_bitmap: representations of the colors that the local BSS is aware of
85780d2ab3aeSJohn Crispin  */
85790d2ab3aeSJohn Crispin int cfg80211_bss_color_notify(struct net_device *dev, gfp_t gfp,
85800d2ab3aeSJohn Crispin 			      enum nl80211_commands cmd, u8 count,
85810d2ab3aeSJohn Crispin 			      u64 color_bitmap);
85820d2ab3aeSJohn Crispin 
85830d2ab3aeSJohn Crispin /**
85840d2ab3aeSJohn Crispin  * cfg80211_obss_color_collision_notify - notify about bss color collision
85850d2ab3aeSJohn Crispin  * @dev: network device
85860d2ab3aeSJohn Crispin  * @color_bitmap: representations of the colors that the local BSS is aware of
85870d2ab3aeSJohn Crispin  */
85880d2ab3aeSJohn Crispin static inline int cfg80211_obss_color_collision_notify(struct net_device *dev,
85890d2ab3aeSJohn Crispin 						       u64 color_bitmap)
85900d2ab3aeSJohn Crispin {
85910d2ab3aeSJohn Crispin 	return cfg80211_bss_color_notify(dev, GFP_KERNEL,
85920d2ab3aeSJohn Crispin 					 NL80211_CMD_OBSS_COLOR_COLLISION,
85930d2ab3aeSJohn Crispin 					 0, color_bitmap);
85940d2ab3aeSJohn Crispin }
85950d2ab3aeSJohn Crispin 
85960d2ab3aeSJohn Crispin /**
85970d2ab3aeSJohn Crispin  * cfg80211_color_change_started_notify - notify color change start
85980d2ab3aeSJohn Crispin  * @dev: the device on which the color is switched
85990d2ab3aeSJohn Crispin  * @count: the number of TBTTs until the color change happens
86000d2ab3aeSJohn Crispin  *
86010d2ab3aeSJohn Crispin  * Inform the userspace about the color change that has started.
86020d2ab3aeSJohn Crispin  */
86030d2ab3aeSJohn Crispin static inline int cfg80211_color_change_started_notify(struct net_device *dev,
86040d2ab3aeSJohn Crispin 						       u8 count)
86050d2ab3aeSJohn Crispin {
86060d2ab3aeSJohn Crispin 	return cfg80211_bss_color_notify(dev, GFP_KERNEL,
86070d2ab3aeSJohn Crispin 					 NL80211_CMD_COLOR_CHANGE_STARTED,
86080d2ab3aeSJohn Crispin 					 count, 0);
86090d2ab3aeSJohn Crispin }
86100d2ab3aeSJohn Crispin 
86110d2ab3aeSJohn Crispin /**
86120d2ab3aeSJohn Crispin  * cfg80211_color_change_aborted_notify - notify color change abort
86130d2ab3aeSJohn Crispin  * @dev: the device on which the color is switched
86140d2ab3aeSJohn Crispin  *
86150d2ab3aeSJohn Crispin  * Inform the userspace about the color change that has aborted.
86160d2ab3aeSJohn Crispin  */
86170d2ab3aeSJohn Crispin static inline int cfg80211_color_change_aborted_notify(struct net_device *dev)
86180d2ab3aeSJohn Crispin {
86190d2ab3aeSJohn Crispin 	return cfg80211_bss_color_notify(dev, GFP_KERNEL,
86200d2ab3aeSJohn Crispin 					 NL80211_CMD_COLOR_CHANGE_ABORTED,
86210d2ab3aeSJohn Crispin 					 0, 0);
86220d2ab3aeSJohn Crispin }
86230d2ab3aeSJohn Crispin 
86240d2ab3aeSJohn Crispin /**
86250d2ab3aeSJohn Crispin  * cfg80211_color_change_notify - notify color change completion
86260d2ab3aeSJohn Crispin  * @dev: the device on which the color was switched
86270d2ab3aeSJohn Crispin  *
86280d2ab3aeSJohn Crispin  * Inform the userspace about the color change that has completed.
86290d2ab3aeSJohn Crispin  */
86300d2ab3aeSJohn Crispin static inline int cfg80211_color_change_notify(struct net_device *dev)
86310d2ab3aeSJohn Crispin {
86320d2ab3aeSJohn Crispin 	return cfg80211_bss_color_notify(dev, GFP_KERNEL,
86330d2ab3aeSJohn Crispin 					 NL80211_CMD_COLOR_CHANGE_COMPLETED,
86340d2ab3aeSJohn Crispin 					 0, 0);
86350d2ab3aeSJohn Crispin }
86360d2ab3aeSJohn Crispin 
8637704232c2SJohannes Berg #endif /* __NET_CFG80211_H */
8638