xref: /linux/include/net/cfg80211.h (revision 41a313d875e0c5822efb50e8221b8d58811609bb)
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
106cf963edSIlan Peer  * Copyright (C) 2018-2021, 2023 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
5505b23456SRandy Dunlap  * 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.
79ddd7f45cSWen Gong  * @IEEE80211_CHAN_PSD: Power spectral density (in dBm) is set for this
80ddd7f45cSWen Gong  *	channel.
81d3236553SJohannes Berg  * @IEEE80211_CHAN_RADAR: Radar detection is required on this channel.
82689da1b3SLuis R. Rodriguez  * @IEEE80211_CHAN_NO_HT40PLUS: extension channel above this channel
83d3236553SJohannes Berg  *	is not permitted.
84689da1b3SLuis R. Rodriguez  * @IEEE80211_CHAN_NO_HT40MINUS: extension channel below this channel
85d3236553SJohannes Berg  *	is not permitted.
8603f6b084SSeth Forshee  * @IEEE80211_CHAN_NO_OFDM: OFDM is not allowed on this channel.
87c7a6ee27SJohannes Berg  * @IEEE80211_CHAN_NO_80MHZ: If the driver supports 80 MHz on the band,
88c7a6ee27SJohannes Berg  *	this flag indicates that an 80 MHz channel cannot use this
89c7a6ee27SJohannes Berg  *	channel as the control or any of the secondary channels.
90c7a6ee27SJohannes Berg  *	This may be due to the driver or due to regulatory bandwidth
91c7a6ee27SJohannes Berg  *	restrictions.
92c7a6ee27SJohannes Berg  * @IEEE80211_CHAN_NO_160MHZ: If the driver supports 160 MHz on the band,
93c7a6ee27SJohannes Berg  *	this flag indicates that an 160 MHz channel cannot use this
94c7a6ee27SJohannes Berg  *	channel as the control or any of the secondary channels.
95c7a6ee27SJohannes Berg  *	This may be due to the driver or due to regulatory bandwidth
96c7a6ee27SJohannes Berg  *	restrictions.
97570dbde1SDavid Spinadel  * @IEEE80211_CHAN_INDOOR_ONLY: see %NL80211_FREQUENCY_ATTR_INDOOR_ONLY
9806f207fcSArik Nemtsov  * @IEEE80211_CHAN_IR_CONCURRENT: see %NL80211_FREQUENCY_ATTR_IR_CONCURRENT
99ea077c1cSRostislav Lisovy  * @IEEE80211_CHAN_NO_20MHZ: 20 MHz bandwidth is not permitted
100ea077c1cSRostislav Lisovy  *	on this channel.
101ea077c1cSRostislav Lisovy  * @IEEE80211_CHAN_NO_10MHZ: 10 MHz bandwidth is not permitted
102ea077c1cSRostislav Lisovy  *	on this channel.
1031e61d82cSHaim Dreyfuss  * @IEEE80211_CHAN_NO_HE: HE operation is not permitted on this channel.
104d65a9770SThomas Pedersen  * @IEEE80211_CHAN_1MHZ: 1 MHz bandwidth is permitted
105d65a9770SThomas Pedersen  *	on this channel.
106d65a9770SThomas Pedersen  * @IEEE80211_CHAN_2MHZ: 2 MHz bandwidth is permitted
107d65a9770SThomas Pedersen  *	on this channel.
108d65a9770SThomas Pedersen  * @IEEE80211_CHAN_4MHZ: 4 MHz bandwidth is permitted
109d65a9770SThomas Pedersen  *	on this channel.
110d65a9770SThomas Pedersen  * @IEEE80211_CHAN_8MHZ: 8 MHz bandwidth is permitted
111d65a9770SThomas Pedersen  *	on this channel.
112d65a9770SThomas Pedersen  * @IEEE80211_CHAN_16MHZ: 16 MHz bandwidth is permitted
113d65a9770SThomas Pedersen  *	on this channel.
1143743bec6SJia Ding  * @IEEE80211_CHAN_NO_320MHZ: If the driver supports 320 MHz on the band,
1153743bec6SJia Ding  *	this flag indicates that a 320 MHz channel cannot use this
1163743bec6SJia Ding  *	channel as the control or any of the secondary channels.
1173743bec6SJia Ding  *	This may be due to the driver or due to regulatory bandwidth
1183743bec6SJia Ding  *	restrictions.
11931846b65SIlan Peer  * @IEEE80211_CHAN_NO_EHT: EHT operation is not permitted on this channel.
120*41a313d8SAndrei Otcheretianski  * @IEEE80211_CHAN_DFS_CONCURRENT: See %NL80211_RRF_DFS_CONCURRENT
121d3236553SJohannes Berg  */
122d3236553SJohannes Berg enum ieee80211_channel_flags {
123d3236553SJohannes Berg 	IEEE80211_CHAN_DISABLED		= 1<<0,
1248fe02e16SLuis R. Rodriguez 	IEEE80211_CHAN_NO_IR		= 1<<1,
125ddd7f45cSWen Gong 	IEEE80211_CHAN_PSD		= 1<<2,
126d3236553SJohannes Berg 	IEEE80211_CHAN_RADAR		= 1<<3,
127689da1b3SLuis R. Rodriguez 	IEEE80211_CHAN_NO_HT40PLUS	= 1<<4,
128689da1b3SLuis R. Rodriguez 	IEEE80211_CHAN_NO_HT40MINUS	= 1<<5,
12903f6b084SSeth Forshee 	IEEE80211_CHAN_NO_OFDM		= 1<<6,
130c7a6ee27SJohannes Berg 	IEEE80211_CHAN_NO_80MHZ		= 1<<7,
131c7a6ee27SJohannes Berg 	IEEE80211_CHAN_NO_160MHZ	= 1<<8,
132570dbde1SDavid Spinadel 	IEEE80211_CHAN_INDOOR_ONLY	= 1<<9,
13306f207fcSArik Nemtsov 	IEEE80211_CHAN_IR_CONCURRENT	= 1<<10,
134ea077c1cSRostislav Lisovy 	IEEE80211_CHAN_NO_20MHZ		= 1<<11,
135ea077c1cSRostislav Lisovy 	IEEE80211_CHAN_NO_10MHZ		= 1<<12,
1361e61d82cSHaim Dreyfuss 	IEEE80211_CHAN_NO_HE		= 1<<13,
137d65a9770SThomas Pedersen 	IEEE80211_CHAN_1MHZ		= 1<<14,
138d65a9770SThomas Pedersen 	IEEE80211_CHAN_2MHZ		= 1<<15,
139d65a9770SThomas Pedersen 	IEEE80211_CHAN_4MHZ		= 1<<16,
140d65a9770SThomas Pedersen 	IEEE80211_CHAN_8MHZ		= 1<<17,
141d65a9770SThomas Pedersen 	IEEE80211_CHAN_16MHZ		= 1<<18,
1423743bec6SJia Ding 	IEEE80211_CHAN_NO_320MHZ	= 1<<19,
14331846b65SIlan Peer 	IEEE80211_CHAN_NO_EHT		= 1<<20,
144*41a313d8SAndrei Otcheretianski 	IEEE80211_CHAN_DFS_CONCURRENT	= 1<<21,
145d3236553SJohannes Berg };
146d3236553SJohannes Berg 
147038659e7SLuis R. Rodriguez #define IEEE80211_CHAN_NO_HT40 \
148689da1b3SLuis R. Rodriguez 	(IEEE80211_CHAN_NO_HT40PLUS | IEEE80211_CHAN_NO_HT40MINUS)
149038659e7SLuis R. Rodriguez 
15004f39047SSimon Wunderlich #define IEEE80211_DFS_MIN_CAC_TIME_MS		60000
15104f39047SSimon Wunderlich #define IEEE80211_DFS_MIN_NOP_TIME_MS		(30 * 60 * 1000)
15204f39047SSimon Wunderlich 
153d3236553SJohannes Berg /**
154d3236553SJohannes Berg  * struct ieee80211_channel - channel definition
155d3236553SJohannes Berg  *
156d3236553SJohannes Berg  * This structure describes a single channel for use
157d3236553SJohannes Berg  * with cfg80211.
158d3236553SJohannes Berg  *
159d3236553SJohannes Berg  * @center_freq: center frequency in MHz
160934f4c7dSThomas Pedersen  * @freq_offset: offset from @center_freq, in KHz
161d3236553SJohannes Berg  * @hw_value: hardware-specific value for the channel
162d3236553SJohannes Berg  * @flags: channel flags from &enum ieee80211_channel_flags.
163d3236553SJohannes Berg  * @orig_flags: channel flags at registration time, used by regulatory
164d3236553SJohannes Berg  *	code to support devices with additional restrictions
165d3236553SJohannes Berg  * @band: band this channel belongs to.
166d3236553SJohannes Berg  * @max_antenna_gain: maximum antenna gain in dBi
167d3236553SJohannes Berg  * @max_power: maximum transmission power (in dBm)
168eccc068eSHong Wu  * @max_reg_power: maximum regulatory transmission power (in dBm)
169d3236553SJohannes Berg  * @beacon_found: helper to regulatory code to indicate when a beacon
170d3236553SJohannes Berg  *	has been found on this channel. Use regulatory_hint_found_beacon()
17177c2061dSWalter Goldens  *	to enable this, this is useful only on 5 GHz band.
172d3236553SJohannes Berg  * @orig_mag: internal use
173d3236553SJohannes Berg  * @orig_mpwr: internal use
17404f39047SSimon Wunderlich  * @dfs_state: current state of this channel. Only relevant if radar is required
17504f39047SSimon Wunderlich  *	on this channel.
17604f39047SSimon Wunderlich  * @dfs_state_entered: timestamp (jiffies) when the dfs state was entered.
177089027e5SJanusz Dziedzic  * @dfs_cac_ms: DFS CAC time in milliseconds, this is valid for DFS channels.
178ddd7f45cSWen Gong  * @psd: power spectral density (in dBm)
179d3236553SJohannes Berg  */
180d3236553SJohannes Berg struct ieee80211_channel {
18157fbcce3SJohannes Berg 	enum nl80211_band band;
1829cf0a0b4SAlexei Avshalom Lazar 	u32 center_freq;
183934f4c7dSThomas Pedersen 	u16 freq_offset;
184d3236553SJohannes Berg 	u16 hw_value;
185d3236553SJohannes Berg 	u32 flags;
186d3236553SJohannes Berg 	int max_antenna_gain;
187d3236553SJohannes Berg 	int max_power;
188eccc068eSHong Wu 	int max_reg_power;
189d3236553SJohannes Berg 	bool beacon_found;
190d3236553SJohannes Berg 	u32 orig_flags;
191d3236553SJohannes Berg 	int orig_mag, orig_mpwr;
19204f39047SSimon Wunderlich 	enum nl80211_dfs_state dfs_state;
19304f39047SSimon Wunderlich 	unsigned long dfs_state_entered;
194089027e5SJanusz Dziedzic 	unsigned int dfs_cac_ms;
195ddd7f45cSWen Gong 	s8 psd;
196d3236553SJohannes Berg };
197d3236553SJohannes Berg 
198d3236553SJohannes Berg /**
199d3236553SJohannes Berg  * enum ieee80211_rate_flags - rate flags
200d3236553SJohannes Berg  *
201d3236553SJohannes Berg  * Hardware/specification flags for rates. These are structured
202d3236553SJohannes Berg  * in a way that allows using the same bitrate structure for
203d3236553SJohannes Berg  * different bands/PHY modes.
204d3236553SJohannes Berg  *
205d3236553SJohannes Berg  * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short
206d3236553SJohannes Berg  *	preamble on this bitrate; only relevant in 2.4GHz band and
207d3236553SJohannes Berg  *	with CCK rates.
208d3236553SJohannes Berg  * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate
209d3236553SJohannes Berg  *	when used with 802.11a (on the 5 GHz band); filled by the
210d3236553SJohannes Berg  *	core code when registering the wiphy.
211d3236553SJohannes Berg  * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate
212d3236553SJohannes Berg  *	when used with 802.11b (on the 2.4 GHz band); filled by the
213d3236553SJohannes Berg  *	core code when registering the wiphy.
214d3236553SJohannes Berg  * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate
215d3236553SJohannes Berg  *	when used with 802.11g (on the 2.4 GHz band); filled by the
216d3236553SJohannes Berg  *	core code when registering the wiphy.
217d3236553SJohannes Berg  * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode.
21830e74732SSimon Wunderlich  * @IEEE80211_RATE_SUPPORTS_5MHZ: Rate can be used in 5 MHz mode
21930e74732SSimon Wunderlich  * @IEEE80211_RATE_SUPPORTS_10MHZ: Rate can be used in 10 MHz mode
220d3236553SJohannes Berg  */
221d3236553SJohannes Berg enum ieee80211_rate_flags {
222d3236553SJohannes Berg 	IEEE80211_RATE_SHORT_PREAMBLE	= 1<<0,
223d3236553SJohannes Berg 	IEEE80211_RATE_MANDATORY_A	= 1<<1,
224d3236553SJohannes Berg 	IEEE80211_RATE_MANDATORY_B	= 1<<2,
225d3236553SJohannes Berg 	IEEE80211_RATE_MANDATORY_G	= 1<<3,
226d3236553SJohannes Berg 	IEEE80211_RATE_ERP_G		= 1<<4,
22730e74732SSimon Wunderlich 	IEEE80211_RATE_SUPPORTS_5MHZ	= 1<<5,
22830e74732SSimon Wunderlich 	IEEE80211_RATE_SUPPORTS_10MHZ	= 1<<6,
229d3236553SJohannes Berg };
230d3236553SJohannes Berg 
231d3236553SJohannes Berg /**
2326eb18137SDedy Lansky  * enum ieee80211_bss_type - BSS type filter
2336eb18137SDedy Lansky  *
2346eb18137SDedy Lansky  * @IEEE80211_BSS_TYPE_ESS: Infrastructure BSS
2356eb18137SDedy Lansky  * @IEEE80211_BSS_TYPE_PBSS: Personal BSS
2366eb18137SDedy Lansky  * @IEEE80211_BSS_TYPE_IBSS: Independent BSS
2376eb18137SDedy Lansky  * @IEEE80211_BSS_TYPE_MBSS: Mesh BSS
2386eb18137SDedy Lansky  * @IEEE80211_BSS_TYPE_ANY: Wildcard value for matching any BSS type
2396eb18137SDedy Lansky  */
2406eb18137SDedy Lansky enum ieee80211_bss_type {
2416eb18137SDedy Lansky 	IEEE80211_BSS_TYPE_ESS,
2426eb18137SDedy Lansky 	IEEE80211_BSS_TYPE_PBSS,
2436eb18137SDedy Lansky 	IEEE80211_BSS_TYPE_IBSS,
2446eb18137SDedy Lansky 	IEEE80211_BSS_TYPE_MBSS,
2456eb18137SDedy Lansky 	IEEE80211_BSS_TYPE_ANY
2466eb18137SDedy Lansky };
2476eb18137SDedy Lansky 
2486eb18137SDedy Lansky /**
2496eb18137SDedy Lansky  * enum ieee80211_privacy - BSS privacy filter
2506eb18137SDedy Lansky  *
2516eb18137SDedy Lansky  * @IEEE80211_PRIVACY_ON: privacy bit set
2526eb18137SDedy Lansky  * @IEEE80211_PRIVACY_OFF: privacy bit clear
2536eb18137SDedy Lansky  * @IEEE80211_PRIVACY_ANY: Wildcard value for matching any privacy setting
2546eb18137SDedy Lansky  */
2556eb18137SDedy Lansky enum ieee80211_privacy {
2566eb18137SDedy Lansky 	IEEE80211_PRIVACY_ON,
2576eb18137SDedy Lansky 	IEEE80211_PRIVACY_OFF,
2586eb18137SDedy Lansky 	IEEE80211_PRIVACY_ANY
2596eb18137SDedy Lansky };
2606eb18137SDedy Lansky 
2616eb18137SDedy Lansky #define IEEE80211_PRIVACY(x)	\
2626eb18137SDedy Lansky 	((x) ? IEEE80211_PRIVACY_ON : IEEE80211_PRIVACY_OFF)
2636eb18137SDedy Lansky 
2646eb18137SDedy Lansky /**
265d3236553SJohannes Berg  * struct ieee80211_rate - bitrate definition
266d3236553SJohannes Berg  *
267d3236553SJohannes Berg  * This structure describes a bitrate that an 802.11 PHY can
268d3236553SJohannes Berg  * operate with. The two values @hw_value and @hw_value_short
269d3236553SJohannes Berg  * are only for driver use when pointers to this structure are
270d3236553SJohannes Berg  * passed around.
271d3236553SJohannes Berg  *
2721dcf396bSDmitry Antipov  * @flags: rate-specific flags from &enum ieee80211_rate_flags
273d3236553SJohannes Berg  * @bitrate: bitrate in units of 100 Kbps
274d3236553SJohannes Berg  * @hw_value: driver/hardware value for this rate
275d3236553SJohannes Berg  * @hw_value_short: driver/hardware value for this rate when
276d3236553SJohannes Berg  *	short preamble is used
277d3236553SJohannes Berg  */
278d3236553SJohannes Berg struct ieee80211_rate {
279d3236553SJohannes Berg 	u32 flags;
280d3236553SJohannes Berg 	u16 bitrate;
281d3236553SJohannes Berg 	u16 hw_value, hw_value_short;
282d3236553SJohannes Berg };
283d3236553SJohannes Berg 
284d3236553SJohannes Berg /**
285796e90f4SJohn Crispin  * struct ieee80211_he_obss_pd - AP settings for spatial reuse
286796e90f4SJohn Crispin  *
287796e90f4SJohn Crispin  * @enable: is the feature enabled.
288f5bec330SRajkumar Manoharan  * @sr_ctrl: The SR Control field of SRP element.
289f5bec330SRajkumar Manoharan  * @non_srg_max_offset: non-SRG maximum tx power offset
290796e90f4SJohn Crispin  * @min_offset: minimal tx power offset an associated station shall use
291796e90f4SJohn Crispin  * @max_offset: maximum tx power offset an associated station shall use
292f5bec330SRajkumar Manoharan  * @bss_color_bitmap: bitmap that indicates the BSS color values used by
293f5bec330SRajkumar Manoharan  *	members of the SRG
294f5bec330SRajkumar Manoharan  * @partial_bssid_bitmap: bitmap that indicates the partial BSSID values
295f5bec330SRajkumar Manoharan  *	used by members of the SRG
296796e90f4SJohn Crispin  */
297796e90f4SJohn Crispin struct ieee80211_he_obss_pd {
298796e90f4SJohn Crispin 	bool enable;
299f5bec330SRajkumar Manoharan 	u8 sr_ctrl;
300f5bec330SRajkumar Manoharan 	u8 non_srg_max_offset;
301796e90f4SJohn Crispin 	u8 min_offset;
302796e90f4SJohn Crispin 	u8 max_offset;
303f5bec330SRajkumar Manoharan 	u8 bss_color_bitmap[8];
304f5bec330SRajkumar Manoharan 	u8 partial_bssid_bitmap[8];
305796e90f4SJohn Crispin };
306796e90f4SJohn Crispin 
307796e90f4SJohn Crispin /**
3085c5e52d1SJohn Crispin  * struct cfg80211_he_bss_color - AP settings for BSS coloring
3095c5e52d1SJohn Crispin  *
3105c5e52d1SJohn Crispin  * @color: the current color.
31175e6b594SJohannes Berg  * @enabled: HE BSS color is used
3125c5e52d1SJohn Crispin  * @partial: define the AID equation.
3135c5e52d1SJohn Crispin  */
3145c5e52d1SJohn Crispin struct cfg80211_he_bss_color {
3155c5e52d1SJohn Crispin 	u8 color;
31675e6b594SJohannes Berg 	bool enabled;
3175c5e52d1SJohn Crispin 	bool partial;
3185c5e52d1SJohn Crispin };
3195c5e52d1SJohn Crispin 
3205c5e52d1SJohn Crispin /**
321d3236553SJohannes Berg  * struct ieee80211_sta_ht_cap - STA's HT capabilities
322d3236553SJohannes Berg  *
323d3236553SJohannes Berg  * This structure describes most essential parameters needed
324d3236553SJohannes Berg  * to describe 802.11n HT capabilities for an STA.
325d3236553SJohannes Berg  *
326d3236553SJohannes Berg  * @ht_supported: is HT supported by the STA
327d3236553SJohannes Berg  * @cap: HT capabilities map as described in 802.11n spec
328d3236553SJohannes Berg  * @ampdu_factor: Maximum A-MPDU length factor
329d3236553SJohannes Berg  * @ampdu_density: Minimum A-MPDU spacing
330d3236553SJohannes Berg  * @mcs: Supported MCS rates
331d3236553SJohannes Berg  */
332d3236553SJohannes Berg struct ieee80211_sta_ht_cap {
333d3236553SJohannes Berg 	u16 cap; /* use IEEE80211_HT_CAP_ */
334d3236553SJohannes Berg 	bool ht_supported;
335d3236553SJohannes Berg 	u8 ampdu_factor;
336d3236553SJohannes Berg 	u8 ampdu_density;
337d3236553SJohannes Berg 	struct ieee80211_mcs_info mcs;
338d3236553SJohannes Berg };
339d3236553SJohannes Berg 
340d3236553SJohannes Berg /**
341bf0c111eSMahesh Palivela  * struct ieee80211_sta_vht_cap - STA's VHT capabilities
342bf0c111eSMahesh Palivela  *
343bf0c111eSMahesh Palivela  * This structure describes most essential parameters needed
344bf0c111eSMahesh Palivela  * to describe 802.11ac VHT capabilities for an STA.
345bf0c111eSMahesh Palivela  *
346bf0c111eSMahesh Palivela  * @vht_supported: is VHT supported by the STA
347bf0c111eSMahesh Palivela  * @cap: VHT capabilities map as described in 802.11ac spec
348bf0c111eSMahesh Palivela  * @vht_mcs: Supported VHT MCS rates
349bf0c111eSMahesh Palivela  */
350bf0c111eSMahesh Palivela struct ieee80211_sta_vht_cap {
351bf0c111eSMahesh Palivela 	bool vht_supported;
352bf0c111eSMahesh Palivela 	u32 cap; /* use IEEE80211_VHT_CAP_ */
353bf0c111eSMahesh Palivela 	struct ieee80211_vht_mcs_info vht_mcs;
354bf0c111eSMahesh Palivela };
355bf0c111eSMahesh Palivela 
356c4cbaf79SLuca Coelho #define IEEE80211_HE_PPE_THRES_MAX_LEN		25
357c4cbaf79SLuca Coelho 
358c4cbaf79SLuca Coelho /**
359c4cbaf79SLuca Coelho  * struct ieee80211_sta_he_cap - STA's HE capabilities
360c4cbaf79SLuca Coelho  *
361c4cbaf79SLuca Coelho  * This structure describes most essential parameters needed
362c4cbaf79SLuca Coelho  * to describe 802.11ax HE capabilities for a STA.
363c4cbaf79SLuca Coelho  *
364c4cbaf79SLuca Coelho  * @has_he: true iff HE data is valid.
365c4cbaf79SLuca Coelho  * @he_cap_elem: Fixed portion of the HE capabilities element.
366c4cbaf79SLuca Coelho  * @he_mcs_nss_supp: The supported NSS/MCS combinations.
367c4cbaf79SLuca Coelho  * @ppe_thres: Holds the PPE Thresholds data.
368c4cbaf79SLuca Coelho  */
369c4cbaf79SLuca Coelho struct ieee80211_sta_he_cap {
370c4cbaf79SLuca Coelho 	bool has_he;
371c4cbaf79SLuca Coelho 	struct ieee80211_he_cap_elem he_cap_elem;
372c4cbaf79SLuca Coelho 	struct ieee80211_he_mcs_nss_supp he_mcs_nss_supp;
373c4cbaf79SLuca Coelho 	u8 ppe_thres[IEEE80211_HE_PPE_THRES_MAX_LEN];
374c4cbaf79SLuca Coelho };
375c4cbaf79SLuca Coelho 
376c4cbaf79SLuca Coelho /**
3775cd5a8a3SIlan Peer  * struct ieee80211_eht_mcs_nss_supp - EHT max supported NSS per MCS
3785cd5a8a3SIlan Peer  *
3795cd5a8a3SIlan Peer  * See P802.11be_D1.3 Table 9-401k - "Subfields of the Supported EHT-MCS
3805cd5a8a3SIlan Peer  * and NSS Set field"
3815cd5a8a3SIlan Peer  *
3825cd5a8a3SIlan Peer  * @only_20mhz: MCS/NSS support for 20 MHz-only STA.
3832d8b08feSMauro Carvalho Chehab  * @bw: MCS/NSS support for 80, 160 and 320 MHz
3845cd5a8a3SIlan Peer  * @bw._80: MCS/NSS support for BW <= 80 MHz
3855cd5a8a3SIlan Peer  * @bw._160: MCS/NSS support for BW = 160 MHz
3865cd5a8a3SIlan Peer  * @bw._320: MCS/NSS support for BW = 320 MHz
3875cd5a8a3SIlan Peer  */
3885cd5a8a3SIlan Peer struct ieee80211_eht_mcs_nss_supp {
3895cd5a8a3SIlan Peer 	union {
3905cd5a8a3SIlan Peer 		struct ieee80211_eht_mcs_nss_supp_20mhz_only only_20mhz;
3915cd5a8a3SIlan Peer 		struct {
3925cd5a8a3SIlan Peer 			struct ieee80211_eht_mcs_nss_supp_bw _80;
3935cd5a8a3SIlan Peer 			struct ieee80211_eht_mcs_nss_supp_bw _160;
3945cd5a8a3SIlan Peer 			struct ieee80211_eht_mcs_nss_supp_bw _320;
3955cd5a8a3SIlan Peer 		} __packed bw;
3965cd5a8a3SIlan Peer 	} __packed;
3975cd5a8a3SIlan Peer } __packed;
3985cd5a8a3SIlan Peer 
3995cd5a8a3SIlan Peer #define IEEE80211_EHT_PPE_THRES_MAX_LEN		32
4005cd5a8a3SIlan Peer 
4015cd5a8a3SIlan Peer /**
4025cd5a8a3SIlan Peer  * struct ieee80211_sta_eht_cap - STA's EHT capabilities
4035cd5a8a3SIlan Peer  *
4045cd5a8a3SIlan Peer  * This structure describes most essential parameters needed
4055cd5a8a3SIlan Peer  * to describe 802.11be EHT capabilities for a STA.
4065cd5a8a3SIlan Peer  *
4075cd5a8a3SIlan Peer  * @has_eht: true iff EHT data is valid.
4085cd5a8a3SIlan Peer  * @eht_cap_elem: Fixed portion of the eht capabilities element.
4095cd5a8a3SIlan Peer  * @eht_mcs_nss_supp: The supported NSS/MCS combinations.
4105cd5a8a3SIlan Peer  * @eht_ppe_thres: Holds the PPE Thresholds data.
4115cd5a8a3SIlan Peer  */
4125cd5a8a3SIlan Peer struct ieee80211_sta_eht_cap {
4135cd5a8a3SIlan Peer 	bool has_eht;
4145cd5a8a3SIlan Peer 	struct ieee80211_eht_cap_elem_fixed eht_cap_elem;
4155cd5a8a3SIlan Peer 	struct ieee80211_eht_mcs_nss_supp eht_mcs_nss_supp;
4165cd5a8a3SIlan Peer 	u8 eht_ppe_thres[IEEE80211_EHT_PPE_THRES_MAX_LEN];
4175cd5a8a3SIlan Peer };
4185cd5a8a3SIlan Peer 
419e8c18412SJohannes Berg /* sparse defines __CHECKER__; see Documentation/dev-tools/sparse.rst */
420e8c18412SJohannes Berg #ifdef __CHECKER__
421e8c18412SJohannes Berg /*
422e8c18412SJohannes Berg  * This is used to mark the sband->iftype_data pointer which is supposed
423e8c18412SJohannes Berg  * to be an array with special access semantics (per iftype), but a lot
424e8c18412SJohannes Berg  * of code got it wrong in the past, so with this marking sparse will be
425e8c18412SJohannes Berg  * noisy when the pointer is used directly.
426e8c18412SJohannes Berg  */
427e8c18412SJohannes Berg # define __iftd		__attribute__((noderef, address_space(__iftype_data)))
428e8c18412SJohannes Berg #else
429e8c18412SJohannes Berg # define __iftd
430e8c18412SJohannes Berg #endif /* __CHECKER__ */
431e8c18412SJohannes Berg 
4325cd5a8a3SIlan Peer /**
4335d9c358dSRandy Dunlap  * struct ieee80211_sband_iftype_data - sband data per interface type
434c4cbaf79SLuca Coelho  *
435c4cbaf79SLuca Coelho  * This structure encapsulates sband data that is relevant for the
436c4cbaf79SLuca Coelho  * interface types defined in @types_mask.  Each type in the
437c4cbaf79SLuca Coelho  * @types_mask must be unique across all instances of iftype_data.
438c4cbaf79SLuca Coelho  *
439c4cbaf79SLuca Coelho  * @types_mask: interface types mask
440c4cbaf79SLuca Coelho  * @he_cap: holds the HE capabilities
44122395217SJohannes Berg  * @he_6ghz_capa: HE 6 GHz capabilities, must be filled in for a
44222395217SJohannes Berg  *	6 GHz band channel (and 0 may be valid value).
4432d8b08feSMauro Carvalho Chehab  * @eht_cap: STA's EHT capabilities
444f4f86505SJohannes Berg  * @vendor_elems: vendor element(s) to advertise
445f4f86505SJohannes Berg  * @vendor_elems.data: vendor element(s) data
446f4f86505SJohannes Berg  * @vendor_elems.len: vendor element(s) length
447c4cbaf79SLuca Coelho  */
448c4cbaf79SLuca Coelho struct ieee80211_sband_iftype_data {
449c4cbaf79SLuca Coelho 	u16 types_mask;
450c4cbaf79SLuca Coelho 	struct ieee80211_sta_he_cap he_cap;
45122395217SJohannes Berg 	struct ieee80211_he_6ghz_capa he_6ghz_capa;
4525cd5a8a3SIlan Peer 	struct ieee80211_sta_eht_cap eht_cap;
453f4f86505SJohannes Berg 	struct {
454f4f86505SJohannes Berg 		const u8 *data;
455f4f86505SJohannes Berg 		unsigned int len;
456f4f86505SJohannes Berg 	} vendor_elems;
457c4cbaf79SLuca Coelho };
458c4cbaf79SLuca Coelho 
459bf0c111eSMahesh Palivela /**
4602a38075cSAlexei Avshalom Lazar  * enum ieee80211_edmg_bw_config - allowed channel bandwidth configurations
4612a38075cSAlexei Avshalom Lazar  *
4622a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_4: 2.16GHz
4632a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_5: 2.16GHz and 4.32GHz
4642a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_6: 2.16GHz, 4.32GHz and 6.48GHz
4652a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_7: 2.16GHz, 4.32GHz, 6.48GHz and 8.64GHz
4662a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_8: 2.16GHz and 2.16GHz + 2.16GHz
4672a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_9: 2.16GHz, 4.32GHz and 2.16GHz + 2.16GHz
4682a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_10: 2.16GHz, 4.32GHz, 6.48GHz and 2.16GHz+2.16GHz
4692a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_11: 2.16GHz, 4.32GHz, 6.48GHz, 8.64GHz and
4702a38075cSAlexei Avshalom Lazar  *	2.16GHz+2.16GHz
4712a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_12: 2.16GHz, 2.16GHz + 2.16GHz and
4722a38075cSAlexei Avshalom Lazar  *	4.32GHz + 4.32GHz
4732a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_13: 2.16GHz, 4.32GHz, 2.16GHz + 2.16GHz and
4742a38075cSAlexei Avshalom Lazar  *	4.32GHz + 4.32GHz
4752a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_14: 2.16GHz, 4.32GHz, 6.48GHz, 2.16GHz + 2.16GHz
4762a38075cSAlexei Avshalom Lazar  *	and 4.32GHz + 4.32GHz
4772a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_15: 2.16GHz, 4.32GHz, 6.48GHz, 8.64GHz,
4782a38075cSAlexei Avshalom Lazar  *	2.16GHz + 2.16GHz and 4.32GHz + 4.32GHz
4792a38075cSAlexei Avshalom Lazar  */
4802a38075cSAlexei Avshalom Lazar enum ieee80211_edmg_bw_config {
4812a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_4	= 4,
4822a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_5	= 5,
4832a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_6	= 6,
4842a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_7	= 7,
4852a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_8	= 8,
4862a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_9	= 9,
4872a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_10	= 10,
4882a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_11	= 11,
4892a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_12	= 12,
4902a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_13	= 13,
4912a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_14	= 14,
4922a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_15	= 15,
4932a38075cSAlexei Avshalom Lazar };
4942a38075cSAlexei Avshalom Lazar 
4952a38075cSAlexei Avshalom Lazar /**
4962a38075cSAlexei Avshalom Lazar  * struct ieee80211_edmg - EDMG configuration
4972a38075cSAlexei Avshalom Lazar  *
4982a38075cSAlexei Avshalom Lazar  * This structure describes most essential parameters needed
4992a38075cSAlexei Avshalom Lazar  * to describe 802.11ay EDMG configuration
5002a38075cSAlexei Avshalom Lazar  *
5012a38075cSAlexei Avshalom Lazar  * @channels: bitmap that indicates the 2.16 GHz channel(s)
5022a38075cSAlexei Avshalom Lazar  *	that are allowed to be used for transmissions.
5032a38075cSAlexei Avshalom Lazar  *	Bit 0 indicates channel 1, bit 1 indicates channel 2, etc.
5042a38075cSAlexei Avshalom Lazar  *	Set to 0 indicate EDMG not supported.
5052a38075cSAlexei Avshalom Lazar  * @bw_config: Channel BW Configuration subfield encodes
5062a38075cSAlexei Avshalom Lazar  *	the allowed channel bandwidth configurations
5072a38075cSAlexei Avshalom Lazar  */
5082a38075cSAlexei Avshalom Lazar struct ieee80211_edmg {
5092a38075cSAlexei Avshalom Lazar 	u8 channels;
5102a38075cSAlexei Avshalom Lazar 	enum ieee80211_edmg_bw_config bw_config;
5112a38075cSAlexei Avshalom Lazar };
5122a38075cSAlexei Avshalom Lazar 
5132a38075cSAlexei Avshalom Lazar /**
514df78a0c0SThomas Pedersen  * struct ieee80211_sta_s1g_cap - STA's S1G capabilities
515df78a0c0SThomas Pedersen  *
516df78a0c0SThomas Pedersen  * This structure describes most essential parameters needed
517df78a0c0SThomas Pedersen  * to describe 802.11ah S1G capabilities for a STA.
518df78a0c0SThomas Pedersen  *
5192d8b08feSMauro Carvalho Chehab  * @s1g: is STA an S1G STA
520df78a0c0SThomas Pedersen  * @cap: S1G capabilities information
521df78a0c0SThomas Pedersen  * @nss_mcs: Supported NSS MCS set
522df78a0c0SThomas Pedersen  */
523df78a0c0SThomas Pedersen struct ieee80211_sta_s1g_cap {
524df78a0c0SThomas Pedersen 	bool s1g;
525df78a0c0SThomas Pedersen 	u8 cap[10]; /* use S1G_CAPAB_ */
526df78a0c0SThomas Pedersen 	u8 nss_mcs[5];
527df78a0c0SThomas Pedersen };
528df78a0c0SThomas Pedersen 
529df78a0c0SThomas Pedersen /**
530d3236553SJohannes Berg  * struct ieee80211_supported_band - frequency band definition
531d3236553SJohannes Berg  *
532d3236553SJohannes Berg  * This structure describes a frequency band a wiphy
533d3236553SJohannes Berg  * is able to operate in.
534d3236553SJohannes Berg  *
535085a6c10SRandy Dunlap  * @channels: Array of channels the hardware can operate with
536d3236553SJohannes Berg  *	in this band.
537d3236553SJohannes Berg  * @band: the band this structure represents
538d3236553SJohannes Berg  * @n_channels: Number of channels in @channels
539d3236553SJohannes Berg  * @bitrates: Array of bitrates the hardware can operate with
540d3236553SJohannes Berg  *	in this band. Must be sorted to give a valid "supported
541d3236553SJohannes Berg  *	rates" IE, i.e. CCK rates first, then OFDM.
542d3236553SJohannes Berg  * @n_bitrates: Number of bitrates in @bitrates
543abe37c4bSJohannes Berg  * @ht_cap: HT capabilities in this band
544c9a0a302SRobert P. J. Day  * @vht_cap: VHT capabilities in this band
5458a50c057SMauro Carvalho Chehab  * @s1g_cap: S1G capabilities in this band
5462a38075cSAlexei Avshalom Lazar  * @edmg_cap: EDMG capabilities in this band
5479ff167e1SJohannes Berg  * @s1g_cap: S1G capabilities in this band (S1B band only, of course)
548c4cbaf79SLuca Coelho  * @n_iftype_data: number of iftype data entries
549c4cbaf79SLuca Coelho  * @iftype_data: interface type data entries.  Note that the bits in
550c4cbaf79SLuca Coelho  *	@types_mask inside this structure cannot overlap (i.e. only
551c4cbaf79SLuca Coelho  *	one occurrence of each type is allowed across all instances of
552c4cbaf79SLuca Coelho  *	iftype_data).
553d3236553SJohannes Berg  */
554d3236553SJohannes Berg struct ieee80211_supported_band {
555d3236553SJohannes Berg 	struct ieee80211_channel *channels;
556d3236553SJohannes Berg 	struct ieee80211_rate *bitrates;
55757fbcce3SJohannes Berg 	enum nl80211_band band;
558d3236553SJohannes Berg 	int n_channels;
559d3236553SJohannes Berg 	int n_bitrates;
560d3236553SJohannes Berg 	struct ieee80211_sta_ht_cap ht_cap;
561bf0c111eSMahesh Palivela 	struct ieee80211_sta_vht_cap vht_cap;
562df78a0c0SThomas Pedersen 	struct ieee80211_sta_s1g_cap s1g_cap;
5632a38075cSAlexei Avshalom Lazar 	struct ieee80211_edmg edmg_cap;
564c4cbaf79SLuca Coelho 	u16 n_iftype_data;
565e8c18412SJohannes Berg 	const struct ieee80211_sband_iftype_data __iftd *iftype_data;
566d3236553SJohannes Berg };
567d3236553SJohannes Berg 
568e691ac2fSRafał Miłecki /**
569e8c18412SJohannes Berg  * _ieee80211_set_sband_iftype_data - set sband iftype data array
570e8c18412SJohannes Berg  * @sband: the sband to initialize
571e8c18412SJohannes Berg  * @iftd: the iftype data array pointer
572e8c18412SJohannes Berg  * @n_iftd: the length of the iftype data array
573e8c18412SJohannes Berg  *
574e8c18412SJohannes Berg  * Set the sband iftype data array; use this where the length cannot
575e8c18412SJohannes Berg  * be derived from the ARRAY_SIZE() of the argument, but prefer
576e8c18412SJohannes Berg  * ieee80211_set_sband_iftype_data() where it can be used.
577e8c18412SJohannes Berg  */
578e8c18412SJohannes Berg static inline void
579e8c18412SJohannes Berg _ieee80211_set_sband_iftype_data(struct ieee80211_supported_band *sband,
580e8c18412SJohannes Berg 				 const struct ieee80211_sband_iftype_data *iftd,
581e8c18412SJohannes Berg 				 u16 n_iftd)
582e8c18412SJohannes Berg {
583e8c18412SJohannes Berg 	sband->iftype_data = (const void __iftd __force *)iftd;
584e8c18412SJohannes Berg 	sband->n_iftype_data = n_iftd;
585e8c18412SJohannes Berg }
586e8c18412SJohannes Berg 
587e8c18412SJohannes Berg /**
588e8c18412SJohannes Berg  * ieee80211_set_sband_iftype_data - set sband iftype data array
589e8c18412SJohannes Berg  * @sband: the sband to initialize
590e8c18412SJohannes Berg  * @iftd: the iftype data array
591e8c18412SJohannes Berg  */
592e8c18412SJohannes Berg #define ieee80211_set_sband_iftype_data(sband, iftd)	\
593e8c18412SJohannes Berg 	_ieee80211_set_sband_iftype_data(sband, iftd, ARRAY_SIZE(iftd))
594e8c18412SJohannes Berg 
595e8c18412SJohannes Berg /**
596e8c18412SJohannes Berg  * for_each_sband_iftype_data - iterate sband iftype data entries
597e8c18412SJohannes Berg  * @sband: the sband whose iftype_data array to iterate
598e8c18412SJohannes Berg  * @i: iterator counter
599e8c18412SJohannes Berg  * @iftd: iftype data pointer to set
600e8c18412SJohannes Berg  */
601e8c18412SJohannes Berg #define for_each_sband_iftype_data(sband, i, iftd)				\
602e8c18412SJohannes Berg 	for (i = 0, iftd = (const void __force *)&(sband)->iftype_data[i];	\
603e8c18412SJohannes Berg 	     i < (sband)->n_iftype_data;					\
604e8c18412SJohannes Berg 	     i++, iftd = (const void __force *)&(sband)->iftype_data[i])
605e8c18412SJohannes Berg 
606e8c18412SJohannes Berg /**
607c4cbaf79SLuca Coelho  * ieee80211_get_sband_iftype_data - return sband data for a given iftype
608c4cbaf79SLuca Coelho  * @sband: the sband to search for the STA on
609c4cbaf79SLuca Coelho  * @iftype: enum nl80211_iftype
610c4cbaf79SLuca Coelho  *
611c4cbaf79SLuca Coelho  * Return: pointer to struct ieee80211_sband_iftype_data, or NULL is none found
612c4cbaf79SLuca Coelho  */
613c4cbaf79SLuca Coelho static inline const struct ieee80211_sband_iftype_data *
614c4cbaf79SLuca Coelho ieee80211_get_sband_iftype_data(const struct ieee80211_supported_band *sband,
615c4cbaf79SLuca Coelho 				u8 iftype)
616c4cbaf79SLuca Coelho {
617e8c18412SJohannes Berg 	const struct ieee80211_sband_iftype_data *data;
618c4cbaf79SLuca Coelho 	int i;
619c4cbaf79SLuca Coelho 
620c4cbaf79SLuca Coelho 	if (WARN_ON(iftype >= NL80211_IFTYPE_MAX))
621c4cbaf79SLuca Coelho 		return NULL;
622c4cbaf79SLuca Coelho 
6235fb9a9fbSFelix Fietkau 	if (iftype == NL80211_IFTYPE_AP_VLAN)
6245fb9a9fbSFelix Fietkau 		iftype = NL80211_IFTYPE_AP;
6255fb9a9fbSFelix Fietkau 
626e8c18412SJohannes Berg 	for_each_sband_iftype_data(sband, i, data) {
627c4cbaf79SLuca Coelho 		if (data->types_mask & BIT(iftype))
628c4cbaf79SLuca Coelho 			return data;
629c4cbaf79SLuca Coelho 	}
630c4cbaf79SLuca Coelho 
631c4cbaf79SLuca Coelho 	return NULL;
632c4cbaf79SLuca Coelho }
633c4cbaf79SLuca Coelho 
634c4cbaf79SLuca Coelho /**
635d7edf40cSJohn Crispin  * ieee80211_get_he_iftype_cap - return HE capabilities for an sband's iftype
636d7edf40cSJohn Crispin  * @sband: the sband to search for the iftype on
637d7edf40cSJohn Crispin  * @iftype: enum nl80211_iftype
638d7edf40cSJohn Crispin  *
639d7edf40cSJohn Crispin  * Return: pointer to the struct ieee80211_sta_he_cap, or NULL is none found
640d7edf40cSJohn Crispin  */
641d7edf40cSJohn Crispin static inline const struct ieee80211_sta_he_cap *
642d7edf40cSJohn Crispin ieee80211_get_he_iftype_cap(const struct ieee80211_supported_band *sband,
643d7edf40cSJohn Crispin 			    u8 iftype)
644d7edf40cSJohn Crispin {
645d7edf40cSJohn Crispin 	const struct ieee80211_sband_iftype_data *data =
646d7edf40cSJohn Crispin 		ieee80211_get_sband_iftype_data(sband, iftype);
647d7edf40cSJohn Crispin 
648d7edf40cSJohn Crispin 	if (data && data->he_cap.has_he)
649d7edf40cSJohn Crispin 		return &data->he_cap;
650d7edf40cSJohn Crispin 
651d7edf40cSJohn Crispin 	return NULL;
652d7edf40cSJohn Crispin }
653d7edf40cSJohn Crispin 
654d7edf40cSJohn Crispin /**
6552ad2274cSIlan Peer  * ieee80211_get_he_6ghz_capa - return HE 6 GHz capabilities
6562ad2274cSIlan Peer  * @sband: the sband to search for the STA on
6572ad2274cSIlan Peer  * @iftype: the iftype to search for
6582ad2274cSIlan Peer  *
6592ad2274cSIlan Peer  * Return: the 6GHz capabilities
6602ad2274cSIlan Peer  */
6612ad2274cSIlan Peer static inline __le16
6622ad2274cSIlan Peer ieee80211_get_he_6ghz_capa(const struct ieee80211_supported_band *sband,
6632ad2274cSIlan Peer 			   enum nl80211_iftype iftype)
6642ad2274cSIlan Peer {
6652ad2274cSIlan Peer 	const struct ieee80211_sband_iftype_data *data =
6662ad2274cSIlan Peer 		ieee80211_get_sband_iftype_data(sband, iftype);
6672ad2274cSIlan Peer 
6682ad2274cSIlan Peer 	if (WARN_ON(!data || !data->he_cap.has_he))
6692ad2274cSIlan Peer 		return 0;
6702ad2274cSIlan Peer 
6712ad2274cSIlan Peer 	return data->he_6ghz_capa.capa;
6722ad2274cSIlan Peer }
6732ad2274cSIlan Peer 
6742ad2274cSIlan Peer /**
6755cd5a8a3SIlan Peer  * ieee80211_get_eht_iftype_cap - return ETH capabilities for an sband's iftype
6765cd5a8a3SIlan Peer  * @sband: the sband to search for the iftype on
6775cd5a8a3SIlan Peer  * @iftype: enum nl80211_iftype
6785cd5a8a3SIlan Peer  *
6795cd5a8a3SIlan Peer  * Return: pointer to the struct ieee80211_sta_eht_cap, or NULL is none found
6805cd5a8a3SIlan Peer  */
6815cd5a8a3SIlan Peer static inline const struct ieee80211_sta_eht_cap *
6825cd5a8a3SIlan Peer ieee80211_get_eht_iftype_cap(const struct ieee80211_supported_band *sband,
6835cd5a8a3SIlan Peer 			     enum nl80211_iftype iftype)
6845cd5a8a3SIlan Peer {
6855cd5a8a3SIlan Peer 	const struct ieee80211_sband_iftype_data *data =
6865cd5a8a3SIlan Peer 		ieee80211_get_sband_iftype_data(sband, iftype);
6875cd5a8a3SIlan Peer 
6885cd5a8a3SIlan Peer 	if (data && data->eht_cap.has_eht)
6895cd5a8a3SIlan Peer 		return &data->eht_cap;
6905cd5a8a3SIlan Peer 
6915cd5a8a3SIlan Peer 	return NULL;
6925cd5a8a3SIlan Peer }
6935cd5a8a3SIlan Peer 
6945cd5a8a3SIlan Peer /**
695e691ac2fSRafał Miłecki  * wiphy_read_of_freq_limits - read frequency limits from device tree
696e691ac2fSRafał Miłecki  *
697e691ac2fSRafał Miłecki  * @wiphy: the wireless device to get extra limits for
698e691ac2fSRafał Miłecki  *
699e691ac2fSRafał Miłecki  * Some devices may have extra limitations specified in DT. This may be useful
700e691ac2fSRafał Miłecki  * for chipsets that normally support more bands but are limited due to board
701e691ac2fSRafał Miłecki  * design (e.g. by antennas or external power amplifier).
702e691ac2fSRafał Miłecki  *
703e691ac2fSRafał Miłecki  * This function reads info from DT and uses it to *modify* channels (disable
704e691ac2fSRafał Miłecki  * unavailable ones). It's usually a *bad* idea to use it in drivers with
705e691ac2fSRafał Miłecki  * shared channel data as DT limitations are device specific. You should make
706e691ac2fSRafał Miłecki  * sure to call it only if channels in wiphy are copied and can be modified
707e691ac2fSRafał Miłecki  * without affecting other devices.
708e691ac2fSRafał Miłecki  *
709e691ac2fSRafał Miłecki  * As this function access device node it has to be called after set_wiphy_dev.
710e691ac2fSRafał Miłecki  * It also modifies channels so they have to be set first.
711e691ac2fSRafał Miłecki  * If using this helper, call it before wiphy_register().
712e691ac2fSRafał Miłecki  */
713e691ac2fSRafał Miłecki #ifdef CONFIG_OF
714e691ac2fSRafał Miłecki void wiphy_read_of_freq_limits(struct wiphy *wiphy);
715e691ac2fSRafał Miłecki #else /* CONFIG_OF */
716e691ac2fSRafał Miłecki static inline void wiphy_read_of_freq_limits(struct wiphy *wiphy)
717e691ac2fSRafał Miłecki {
718e691ac2fSRafał Miłecki }
719e691ac2fSRafał Miłecki #endif /* !CONFIG_OF */
720e691ac2fSRafał Miłecki 
721e691ac2fSRafał Miłecki 
722d3236553SJohannes Berg /*
723d3236553SJohannes Berg  * Wireless hardware/device configuration structures and methods
724704232c2SJohannes Berg  */
725704232c2SJohannes Berg 
7262ec600d6SLuis Carlos Cobo /**
727d70e9693SJohannes Berg  * DOC: Actions and configuration
728d70e9693SJohannes Berg  *
729d70e9693SJohannes Berg  * Each wireless device and each virtual interface offer a set of configuration
730d70e9693SJohannes Berg  * operations and other actions that are invoked by userspace. Each of these
731d70e9693SJohannes Berg  * actions is described in the operations structure, and the parameters these
732d70e9693SJohannes Berg  * operations use are described separately.
733d70e9693SJohannes Berg  *
734d70e9693SJohannes Berg  * Additionally, some operations are asynchronous and expect to get status
735d70e9693SJohannes Berg  * information via some functions that drivers need to call.
736d70e9693SJohannes Berg  *
737d70e9693SJohannes Berg  * Scanning and BSS list handling with its associated functionality is described
738d70e9693SJohannes Berg  * in a separate chapter.
739d70e9693SJohannes Berg  */
740d70e9693SJohannes Berg 
741c6e6a0c8SAviya Erenfeld #define VHT_MUMIMO_GROUPS_DATA_LEN (WLAN_MEMBERSHIP_LEN +\
742c6e6a0c8SAviya Erenfeld 				    WLAN_USER_POSITION_LEN)
743c6e6a0c8SAviya Erenfeld 
744d70e9693SJohannes Berg /**
7452ec600d6SLuis Carlos Cobo  * struct vif_params - describes virtual interface parameters
746818a986eSJohannes Berg  * @flags: monitor interface flags, unchanged if 0, otherwise
747818a986eSJohannes Berg  *	%MONITOR_FLAG_CHANGED will be set
7488b787643SFelix Fietkau  * @use_4addr: use 4-address frames
749e8f479b1SBen Greear  * @macaddr: address to use for this virtual interface.
750e8f479b1SBen Greear  *	If this parameter is set to zero address the driver may
751e8f479b1SBen Greear  *	determine the address as needed.
752e8f479b1SBen Greear  *	This feature is only fully supported by drivers that enable the
753e8f479b1SBen Greear  *	%NL80211_FEATURE_MAC_ON_CREATE flag.  Others may support creating
754e8f479b1SBen Greear  **	only p2p devices with specified MAC.
755b0265024SJohannes Berg  * @vht_mumimo_groups: MU-MIMO groupID, used for monitoring MU-MIMO packets
756b0265024SJohannes Berg  *	belonging to that MU-MIMO groupID; %NULL if not changed
757b0265024SJohannes Berg  * @vht_mumimo_follow_addr: MU-MIMO follow address, used for monitoring
758b0265024SJohannes Berg  *	MU-MIMO packets going to the specified station; %NULL if not changed
7592ec600d6SLuis Carlos Cobo  */
7602ec600d6SLuis Carlos Cobo struct vif_params {
761818a986eSJohannes Berg 	u32 flags;
7628b787643SFelix Fietkau 	int use_4addr;
7631c18f145SArend van Spriel 	u8 macaddr[ETH_ALEN];
764b0265024SJohannes Berg 	const u8 *vht_mumimo_groups;
765b0265024SJohannes Berg 	const u8 *vht_mumimo_follow_addr;
7662ec600d6SLuis Carlos Cobo };
7672ec600d6SLuis Carlos Cobo 
76841ade00fSJohannes Berg /**
76941ade00fSJohannes Berg  * struct key_params - key information
77041ade00fSJohannes Berg  *
77141ade00fSJohannes Berg  * Information about a key
77241ade00fSJohannes Berg  *
77341ade00fSJohannes Berg  * @key: key material
77441ade00fSJohannes Berg  * @key_len: length of key material
77541ade00fSJohannes Berg  * @cipher: cipher suite selector
77641ade00fSJohannes Berg  * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used
77741ade00fSJohannes Berg  *	with the get_key() callback, must be in little endian,
77841ade00fSJohannes Berg  *	length given by @seq_len.
779abe37c4bSJohannes Berg  * @seq_len: length of @seq.
78014f34e36SGurumoorthi Gnanasambandhan  * @vlan_id: vlan_id for VLAN group key (if nonzero)
7816cdd3979SAlexander Wetzel  * @mode: key install mode (RX_TX, NO_TX or SET_TX)
78241ade00fSJohannes Berg  */
78341ade00fSJohannes Berg struct key_params {
784c1e5f471SJohannes Berg 	const u8 *key;
785c1e5f471SJohannes Berg 	const u8 *seq;
78641ade00fSJohannes Berg 	int key_len;
78741ade00fSJohannes Berg 	int seq_len;
78814f34e36SGurumoorthi Gnanasambandhan 	u16 vlan_id;
78941ade00fSJohannes Berg 	u32 cipher;
7906cdd3979SAlexander Wetzel 	enum nl80211_key_mode mode;
79141ade00fSJohannes Berg };
79241ade00fSJohannes Berg 
793ed1b6cc7SJohannes Berg /**
794683b6d3bSJohannes Berg  * struct cfg80211_chan_def - channel definition
795683b6d3bSJohannes Berg  * @chan: the (control) channel
7963d9d1d66SJohannes Berg  * @width: channel width
7973d9d1d66SJohannes Berg  * @center_freq1: center frequency of first segment
7983d9d1d66SJohannes Berg  * @center_freq2: center frequency of second segment
7993d9d1d66SJohannes Berg  *	(only with 80+80 MHz)
8002a38075cSAlexei Avshalom Lazar  * @edmg: define the EDMG channels configuration.
8012a38075cSAlexei Avshalom Lazar  *	If edmg is requested (i.e. the .channels member is non-zero),
8022a38075cSAlexei Avshalom Lazar  *	chan will define the primary channel and all other
8032a38075cSAlexei Avshalom Lazar  *	parameters are ignored.
804934f4c7dSThomas Pedersen  * @freq1_offset: offset from @center_freq1, in KHz
805683b6d3bSJohannes Berg  */
806683b6d3bSJohannes Berg struct cfg80211_chan_def {
807683b6d3bSJohannes Berg 	struct ieee80211_channel *chan;
8083d9d1d66SJohannes Berg 	enum nl80211_chan_width width;
8093d9d1d66SJohannes Berg 	u32 center_freq1;
8103d9d1d66SJohannes Berg 	u32 center_freq2;
8112a38075cSAlexei Avshalom Lazar 	struct ieee80211_edmg edmg;
812934f4c7dSThomas Pedersen 	u16 freq1_offset;
813683b6d3bSJohannes Berg };
814683b6d3bSJohannes Berg 
8159a5f6488STamizh Chelvam /*
8169a5f6488STamizh Chelvam  * cfg80211_bitrate_mask - masks for bitrate control
8179a5f6488STamizh Chelvam  */
8189a5f6488STamizh Chelvam struct cfg80211_bitrate_mask {
8199a5f6488STamizh Chelvam 	struct {
8209a5f6488STamizh Chelvam 		u32 legacy;
8219a5f6488STamizh Chelvam 		u8 ht_mcs[IEEE80211_HT_MCS_MASK_LEN];
8229a5f6488STamizh Chelvam 		u16 vht_mcs[NL80211_VHT_NSS_MAX];
823eb89a6a6SMiles Hu 		u16 he_mcs[NL80211_HE_NSS_MAX];
8249a5f6488STamizh Chelvam 		enum nl80211_txrate_gi gi;
825eb89a6a6SMiles Hu 		enum nl80211_he_gi he_gi;
826eb89a6a6SMiles Hu 		enum nl80211_he_ltf he_ltf;
8279a5f6488STamizh Chelvam 	} control[NUM_NL80211_BANDS];
8289a5f6488STamizh Chelvam };
8299a5f6488STamizh Chelvam 
8309a5f6488STamizh Chelvam 
83177f576deSTamizh chelvam /**
8323710a8a6SJohannes Berg  * struct cfg80211_tid_cfg - TID specific configuration
83377f576deSTamizh chelvam  * @config_override: Flag to notify driver to reset TID configuration
83477f576deSTamizh chelvam  *	of the peer.
8353710a8a6SJohannes Berg  * @tids: bitmap of TIDs to modify
8363710a8a6SJohannes Berg  * @mask: bitmap of attributes indicating which parameter changed,
8373710a8a6SJohannes Berg  *	similar to &nl80211_tid_config_supp.
83877f576deSTamizh chelvam  * @noack: noack configuration value for the TID
8396a21d16cSTamizh chelvam  * @retry_long: retry count value
8406a21d16cSTamizh chelvam  * @retry_short: retry count value
84133462e68SSergey Matyukevich  * @ampdu: Enable/Disable MPDU aggregation
84204f7d142STamizh chelvam  * @rtscts: Enable/Disable RTS/CTS
84333462e68SSergey Matyukevich  * @amsdu: Enable/Disable MSDU aggregation
8449a5f6488STamizh Chelvam  * @txrate_type: Tx bitrate mask type
8459a5f6488STamizh Chelvam  * @txrate_mask: Tx bitrate to be applied for the TID
84677f576deSTamizh chelvam  */
8473710a8a6SJohannes Berg struct cfg80211_tid_cfg {
84877f576deSTamizh chelvam 	bool config_override;
8493710a8a6SJohannes Berg 	u8 tids;
8502d5d9b7fSSergey Matyukevich 	u64 mask;
85177f576deSTamizh chelvam 	enum nl80211_tid_config noack;
8526a21d16cSTamizh chelvam 	u8 retry_long, retry_short;
853ade274b2STamizh chelvam 	enum nl80211_tid_config ampdu;
85404f7d142STamizh chelvam 	enum nl80211_tid_config rtscts;
85533462e68SSergey Matyukevich 	enum nl80211_tid_config amsdu;
8569a5f6488STamizh Chelvam 	enum nl80211_tx_rate_setting txrate_type;
8579a5f6488STamizh Chelvam 	struct cfg80211_bitrate_mask txrate_mask;
85877f576deSTamizh chelvam };
85977f576deSTamizh chelvam 
86077f576deSTamizh chelvam /**
8613710a8a6SJohannes Berg  * struct cfg80211_tid_config - TID configuration
86277f576deSTamizh chelvam  * @peer: Station's MAC address
86377f576deSTamizh chelvam  * @n_tid_conf: Number of TID specific configurations to be applied
86477f576deSTamizh chelvam  * @tid_conf: Configuration change info
86577f576deSTamizh chelvam  */
8663710a8a6SJohannes Berg struct cfg80211_tid_config {
86777f576deSTamizh chelvam 	const u8 *peer;
86877f576deSTamizh chelvam 	u32 n_tid_conf;
869545d3523SKees Cook 	struct cfg80211_tid_cfg tid_conf[] __counted_by(n_tid_conf);
87077f576deSTamizh chelvam };
87177f576deSTamizh chelvam 
8723d9d1d66SJohannes Berg /**
873e306784aSSubrat Mishra  * struct cfg80211_fils_aad - FILS AAD data
874e306784aSSubrat Mishra  * @macaddr: STA MAC address
875e306784aSSubrat Mishra  * @kek: FILS KEK
876e306784aSSubrat Mishra  * @kek_len: FILS KEK length
877e306784aSSubrat Mishra  * @snonce: STA Nonce
878e306784aSSubrat Mishra  * @anonce: AP Nonce
879e306784aSSubrat Mishra  */
880e306784aSSubrat Mishra struct cfg80211_fils_aad {
881e306784aSSubrat Mishra 	const u8 *macaddr;
882e306784aSSubrat Mishra 	const u8 *kek;
883e306784aSSubrat Mishra 	u8 kek_len;
884e306784aSSubrat Mishra 	const u8 *snonce;
885e306784aSSubrat Mishra 	const u8 *anonce;
886e306784aSSubrat Mishra };
887e306784aSSubrat Mishra 
888e306784aSSubrat Mishra /**
889cbbaf2bbSAvraham Stern  * struct cfg80211_set_hw_timestamp - enable/disable HW timestamping
890cbbaf2bbSAvraham Stern  * @macaddr: peer MAC address. NULL to enable/disable HW timestamping for all
891cbbaf2bbSAvraham Stern  *	addresses.
892cbbaf2bbSAvraham Stern  * @enable: if set, enable HW timestamping for the specified MAC address.
893cbbaf2bbSAvraham Stern  *	Otherwise disable HW timestamping for the specified MAC address.
894cbbaf2bbSAvraham Stern  */
895cbbaf2bbSAvraham Stern struct cfg80211_set_hw_timestamp {
896cbbaf2bbSAvraham Stern 	const u8 *macaddr;
897cbbaf2bbSAvraham Stern 	bool enable;
898cbbaf2bbSAvraham Stern };
899cbbaf2bbSAvraham Stern 
900cbbaf2bbSAvraham Stern /**
9013d9d1d66SJohannes Berg  * cfg80211_get_chandef_type - return old channel type from chandef
9023d9d1d66SJohannes Berg  * @chandef: the channel definition
9033d9d1d66SJohannes Berg  *
9040ae997dcSYacine Belkadi  * Return: The old channel type (NOHT, HT20, HT40+/-) from a given
9053d9d1d66SJohannes Berg  * chandef, which must have a bandwidth allowing this conversion.
9063d9d1d66SJohannes Berg  */
907683b6d3bSJohannes Berg static inline enum nl80211_channel_type
908683b6d3bSJohannes Berg cfg80211_get_chandef_type(const struct cfg80211_chan_def *chandef)
909683b6d3bSJohannes Berg {
9103d9d1d66SJohannes Berg 	switch (chandef->width) {
9113d9d1d66SJohannes Berg 	case NL80211_CHAN_WIDTH_20_NOHT:
9123d9d1d66SJohannes Berg 		return NL80211_CHAN_NO_HT;
9133d9d1d66SJohannes Berg 	case NL80211_CHAN_WIDTH_20:
9143d9d1d66SJohannes Berg 		return NL80211_CHAN_HT20;
9153d9d1d66SJohannes Berg 	case NL80211_CHAN_WIDTH_40:
9163d9d1d66SJohannes Berg 		if (chandef->center_freq1 > chandef->chan->center_freq)
9173d9d1d66SJohannes Berg 			return NL80211_CHAN_HT40PLUS;
9183d9d1d66SJohannes Berg 		return NL80211_CHAN_HT40MINUS;
9193d9d1d66SJohannes Berg 	default:
9203d9d1d66SJohannes Berg 		WARN_ON(1);
9213d9d1d66SJohannes Berg 		return NL80211_CHAN_NO_HT;
922683b6d3bSJohannes Berg 	}
9233d9d1d66SJohannes Berg }
9243d9d1d66SJohannes Berg 
9253d9d1d66SJohannes Berg /**
9263d9d1d66SJohannes Berg  * cfg80211_chandef_create - create channel definition using channel type
9273d9d1d66SJohannes Berg  * @chandef: the channel definition struct to fill
9283d9d1d66SJohannes Berg  * @channel: the control channel
9293d9d1d66SJohannes Berg  * @chantype: the channel type
9303d9d1d66SJohannes Berg  *
9313d9d1d66SJohannes Berg  * Given a channel type, create a channel definition.
9323d9d1d66SJohannes Berg  */
9333d9d1d66SJohannes Berg void cfg80211_chandef_create(struct cfg80211_chan_def *chandef,
9343d9d1d66SJohannes Berg 			     struct ieee80211_channel *channel,
9353d9d1d66SJohannes Berg 			     enum nl80211_channel_type chantype);
9363d9d1d66SJohannes Berg 
9373d9d1d66SJohannes Berg /**
9383d9d1d66SJohannes Berg  * cfg80211_chandef_identical - check if two channel definitions are identical
9393d9d1d66SJohannes Berg  * @chandef1: first channel definition
9403d9d1d66SJohannes Berg  * @chandef2: second channel definition
9413d9d1d66SJohannes Berg  *
9420ae997dcSYacine Belkadi  * Return: %true if the channels defined by the channel definitions are
9433d9d1d66SJohannes Berg  * identical, %false otherwise.
9443d9d1d66SJohannes Berg  */
9453d9d1d66SJohannes Berg static inline bool
9463d9d1d66SJohannes Berg cfg80211_chandef_identical(const struct cfg80211_chan_def *chandef1,
9473d9d1d66SJohannes Berg 			   const struct cfg80211_chan_def *chandef2)
9483d9d1d66SJohannes Berg {
9493d9d1d66SJohannes Berg 	return (chandef1->chan == chandef2->chan &&
9503d9d1d66SJohannes Berg 		chandef1->width == chandef2->width &&
9513d9d1d66SJohannes Berg 		chandef1->center_freq1 == chandef2->center_freq1 &&
952934f4c7dSThomas Pedersen 		chandef1->freq1_offset == chandef2->freq1_offset &&
9533d9d1d66SJohannes Berg 		chandef1->center_freq2 == chandef2->center_freq2);
9543d9d1d66SJohannes Berg }
9553d9d1d66SJohannes Berg 
9563d9d1d66SJohannes Berg /**
9572a38075cSAlexei Avshalom Lazar  * cfg80211_chandef_is_edmg - check if chandef represents an EDMG channel
9582a38075cSAlexei Avshalom Lazar  *
9592a38075cSAlexei Avshalom Lazar  * @chandef: the channel definition
9602a38075cSAlexei Avshalom Lazar  *
9612a38075cSAlexei Avshalom Lazar  * Return: %true if EDMG defined, %false otherwise.
9622a38075cSAlexei Avshalom Lazar  */
9632a38075cSAlexei Avshalom Lazar static inline bool
9642a38075cSAlexei Avshalom Lazar cfg80211_chandef_is_edmg(const struct cfg80211_chan_def *chandef)
9652a38075cSAlexei Avshalom Lazar {
9662a38075cSAlexei Avshalom Lazar 	return chandef->edmg.channels || chandef->edmg.bw_config;
9672a38075cSAlexei Avshalom Lazar }
9682a38075cSAlexei Avshalom Lazar 
9692a38075cSAlexei Avshalom Lazar /**
9703d9d1d66SJohannes Berg  * cfg80211_chandef_compatible - check if two channel definitions are compatible
9713d9d1d66SJohannes Berg  * @chandef1: first channel definition
9723d9d1d66SJohannes Berg  * @chandef2: second channel definition
9733d9d1d66SJohannes Berg  *
9740ae997dcSYacine Belkadi  * Return: %NULL if the given channel definitions are incompatible,
9753d9d1d66SJohannes Berg  * chandef1 or chandef2 otherwise.
9763d9d1d66SJohannes Berg  */
9773d9d1d66SJohannes Berg const struct cfg80211_chan_def *
9783d9d1d66SJohannes Berg cfg80211_chandef_compatible(const struct cfg80211_chan_def *chandef1,
9793d9d1d66SJohannes Berg 			    const struct cfg80211_chan_def *chandef2);
980683b6d3bSJohannes Berg 
981683b6d3bSJohannes Berg /**
98210fa22b6SEvan Quan  * nl80211_chan_width_to_mhz - get the channel width in MHz
98310fa22b6SEvan Quan  * @chan_width: the channel width from &enum nl80211_chan_width
98410fa22b6SEvan Quan  *
98510fa22b6SEvan Quan  * Return: channel width in MHz if the chan_width from &enum nl80211_chan_width
98610fa22b6SEvan Quan  * is valid. -1 otherwise.
98710fa22b6SEvan Quan  */
98810fa22b6SEvan Quan int nl80211_chan_width_to_mhz(enum nl80211_chan_width chan_width);
98910fa22b6SEvan Quan 
99010fa22b6SEvan Quan /**
9919f5e8f6eSJohannes Berg  * cfg80211_chandef_valid - check if a channel definition is valid
9929f5e8f6eSJohannes Berg  * @chandef: the channel definition to check
9930ae997dcSYacine Belkadi  * Return: %true if the channel definition is valid. %false otherwise.
9949f5e8f6eSJohannes Berg  */
9959f5e8f6eSJohannes Berg bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef);
9969f5e8f6eSJohannes Berg 
9979f5e8f6eSJohannes Berg /**
9989f5e8f6eSJohannes Berg  * cfg80211_chandef_usable - check if secondary channels can be used
9999f5e8f6eSJohannes Berg  * @wiphy: the wiphy to validate against
10009f5e8f6eSJohannes Berg  * @chandef: the channel definition to check
10010ae997dcSYacine Belkadi  * @prohibited_flags: the regulatory channel flags that must not be set
10020ae997dcSYacine Belkadi  * Return: %true if secondary channels are usable. %false otherwise.
10039f5e8f6eSJohannes Berg  */
10049f5e8f6eSJohannes Berg bool cfg80211_chandef_usable(struct wiphy *wiphy,
10059f5e8f6eSJohannes Berg 			     const struct cfg80211_chan_def *chandef,
10069f5e8f6eSJohannes Berg 			     u32 prohibited_flags);
10079f5e8f6eSJohannes Berg 
10089f5e8f6eSJohannes Berg /**
1009774f0734SSimon Wunderlich  * cfg80211_chandef_dfs_required - checks if radar detection is required
1010774f0734SSimon Wunderlich  * @wiphy: the wiphy to validate against
1011774f0734SSimon Wunderlich  * @chandef: the channel definition to check
10122beb6dabSLuciano Coelho  * @iftype: the interface type as specified in &enum nl80211_iftype
10132beb6dabSLuciano Coelho  * Returns:
10142beb6dabSLuciano Coelho  *	1 if radar detection is required, 0 if it is not, < 0 on error
1015774f0734SSimon Wunderlich  */
1016774f0734SSimon Wunderlich int cfg80211_chandef_dfs_required(struct wiphy *wiphy,
10172beb6dabSLuciano Coelho 				  const struct cfg80211_chan_def *chandef,
1018c3d62036SLuciano Coelho 				  enum nl80211_iftype iftype);
1019774f0734SSimon Wunderlich 
1020774f0734SSimon Wunderlich /**
102130ca8b0cSAditya Kumar Singh  * cfg80211_chandef_dfs_usable - checks if chandef is DFS usable and we
102230ca8b0cSAditya Kumar Singh  *				 can/need start CAC on such channel
102330ca8b0cSAditya Kumar Singh  * @wiphy: the wiphy to validate against
102430ca8b0cSAditya Kumar Singh  * @chandef: the channel definition to check
102530ca8b0cSAditya Kumar Singh  *
102630ca8b0cSAditya Kumar Singh  * Return: true if all channels available and at least
102730ca8b0cSAditya Kumar Singh  *	   one channel requires CAC (NL80211_DFS_USABLE)
102830ca8b0cSAditya Kumar Singh  */
102930ca8b0cSAditya Kumar Singh bool cfg80211_chandef_dfs_usable(struct wiphy *wiphy,
103030ca8b0cSAditya Kumar Singh 				 const struct cfg80211_chan_def *chandef);
103130ca8b0cSAditya Kumar Singh 
103230ca8b0cSAditya Kumar Singh /**
103330ca8b0cSAditya Kumar Singh  * cfg80211_chandef_dfs_cac_time - get the DFS CAC time (in ms) for given
103430ca8b0cSAditya Kumar Singh  *				   channel definition
103530ca8b0cSAditya Kumar Singh  * @wiphy: the wiphy to validate against
103630ca8b0cSAditya Kumar Singh  * @chandef: the channel definition to check
103730ca8b0cSAditya Kumar Singh  *
103830ca8b0cSAditya Kumar Singh  * Returns: DFS CAC time (in ms) which applies for this channel definition
103930ca8b0cSAditya Kumar Singh  */
104030ca8b0cSAditya Kumar Singh unsigned int
104130ca8b0cSAditya Kumar Singh cfg80211_chandef_dfs_cac_time(struct wiphy *wiphy,
104230ca8b0cSAditya Kumar Singh 			      const struct cfg80211_chan_def *chandef);
104330ca8b0cSAditya Kumar Singh 
104430ca8b0cSAditya Kumar Singh /**
10455097f844SJaewan Kim  * nl80211_send_chandef - sends the channel definition.
10465097f844SJaewan Kim  * @msg: the msg to send channel definition
10475097f844SJaewan Kim  * @chandef: the channel definition to check
10485097f844SJaewan Kim  *
10495097f844SJaewan Kim  * Returns: 0 if sent the channel definition to msg, < 0 on error
10505097f844SJaewan Kim  **/
10515097f844SJaewan Kim int nl80211_send_chandef(struct sk_buff *msg, const struct cfg80211_chan_def *chandef);
10525097f844SJaewan Kim 
10535097f844SJaewan Kim /**
105419654a61SJohannes Berg  * ieee80211_chanwidth_rate_flags - return rate flags for channel width
105519654a61SJohannes Berg  * @width: the channel width of the channel
105630e74732SSimon Wunderlich  *
105730e74732SSimon Wunderlich  * In some channel types, not all rates may be used - for example CCK
105830e74732SSimon Wunderlich  * rates may not be used in 5/10 MHz channels.
105930e74732SSimon Wunderlich  *
106019654a61SJohannes Berg  * Returns: rate flags which apply for this channel width
106130e74732SSimon Wunderlich  */
106230e74732SSimon Wunderlich static inline enum ieee80211_rate_flags
106319654a61SJohannes Berg ieee80211_chanwidth_rate_flags(enum nl80211_chan_width width)
106430e74732SSimon Wunderlich {
106519654a61SJohannes Berg 	switch (width) {
106630e74732SSimon Wunderlich 	case NL80211_CHAN_WIDTH_5:
106730e74732SSimon Wunderlich 		return IEEE80211_RATE_SUPPORTS_5MHZ;
106830e74732SSimon Wunderlich 	case NL80211_CHAN_WIDTH_10:
106930e74732SSimon Wunderlich 		return IEEE80211_RATE_SUPPORTS_10MHZ;
107030e74732SSimon Wunderlich 	default:
107130e74732SSimon Wunderlich 		break;
107230e74732SSimon Wunderlich 	}
107330e74732SSimon Wunderlich 	return 0;
107430e74732SSimon Wunderlich }
107530e74732SSimon Wunderlich 
107630e74732SSimon Wunderlich /**
107719654a61SJohannes Berg  * ieee80211_chandef_rate_flags - returns rate flags for a channel
107819654a61SJohannes Berg  * @chandef: channel definition for the channel
107919654a61SJohannes Berg  *
108019654a61SJohannes Berg  * See ieee80211_chanwidth_rate_flags().
108119654a61SJohannes Berg  *
108219654a61SJohannes Berg  * Returns: rate flags which apply for this channel
108319654a61SJohannes Berg  */
108419654a61SJohannes Berg static inline enum ieee80211_rate_flags
108519654a61SJohannes Berg ieee80211_chandef_rate_flags(struct cfg80211_chan_def *chandef)
108619654a61SJohannes Berg {
108719654a61SJohannes Berg 	return ieee80211_chanwidth_rate_flags(chandef->width);
108819654a61SJohannes Berg }
108919654a61SJohannes Berg 
109019654a61SJohannes Berg /**
10910430c883SSimon Wunderlich  * ieee80211_chandef_max_power - maximum transmission power for the chandef
10920430c883SSimon Wunderlich  *
10930430c883SSimon Wunderlich  * In some regulations, the transmit power may depend on the configured channel
10940430c883SSimon Wunderlich  * bandwidth which may be defined as dBm/MHz. This function returns the actual
10950430c883SSimon Wunderlich  * max_power for non-standard (20 MHz) channels.
10960430c883SSimon Wunderlich  *
10970430c883SSimon Wunderlich  * @chandef: channel definition for the channel
10980430c883SSimon Wunderlich  *
10990430c883SSimon Wunderlich  * Returns: maximum allowed transmission power in dBm for the chandef
11000430c883SSimon Wunderlich  */
11010430c883SSimon Wunderlich static inline int
11020430c883SSimon Wunderlich ieee80211_chandef_max_power(struct cfg80211_chan_def *chandef)
11030430c883SSimon Wunderlich {
11040430c883SSimon Wunderlich 	switch (chandef->width) {
11050430c883SSimon Wunderlich 	case NL80211_CHAN_WIDTH_5:
11060430c883SSimon Wunderlich 		return min(chandef->chan->max_reg_power - 6,
11070430c883SSimon Wunderlich 			   chandef->chan->max_power);
11080430c883SSimon Wunderlich 	case NL80211_CHAN_WIDTH_10:
11090430c883SSimon Wunderlich 		return min(chandef->chan->max_reg_power - 3,
11100430c883SSimon Wunderlich 			   chandef->chan->max_power);
11110430c883SSimon Wunderlich 	default:
11120430c883SSimon Wunderlich 		break;
11130430c883SSimon Wunderlich 	}
11140430c883SSimon Wunderlich 	return chandef->chan->max_power;
11150430c883SSimon Wunderlich }
11160430c883SSimon Wunderlich 
11170430c883SSimon Wunderlich /**
1118be989891SJohannes Berg  * cfg80211_any_usable_channels - check for usable channels
1119be989891SJohannes Berg  * @wiphy: the wiphy to check for
1120be989891SJohannes Berg  * @band_mask: which bands to check on
1121be989891SJohannes Berg  * @prohibited_flags: which channels to not consider usable,
1122be989891SJohannes Berg  *	%IEEE80211_CHAN_DISABLED is always taken into account
1123be989891SJohannes Berg  */
1124be989891SJohannes Berg bool cfg80211_any_usable_channels(struct wiphy *wiphy,
1125be989891SJohannes Berg 				  unsigned long band_mask,
1126be989891SJohannes Berg 				  u32 prohibited_flags);
1127be989891SJohannes Berg 
1128be989891SJohannes Berg /**
112961fa713cSHolger Schurig  * enum survey_info_flags - survey information flags
113061fa713cSHolger Schurig  *
1131abe37c4bSJohannes Berg  * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in
113217e5a808SFelix Fietkau  * @SURVEY_INFO_IN_USE: channel is currently being used
11334ed20bebSJohannes Berg  * @SURVEY_INFO_TIME: active time (in ms) was filled in
11344ed20bebSJohannes Berg  * @SURVEY_INFO_TIME_BUSY: busy time was filled in
11354ed20bebSJohannes Berg  * @SURVEY_INFO_TIME_EXT_BUSY: extension channel busy time was filled in
11364ed20bebSJohannes Berg  * @SURVEY_INFO_TIME_RX: receive time was filled in
11374ed20bebSJohannes Berg  * @SURVEY_INFO_TIME_TX: transmit time was filled in
1138052536abSJohannes Berg  * @SURVEY_INFO_TIME_SCAN: scan time was filled in
1139c8cd6e7fSFelix Fietkau  * @SURVEY_INFO_TIME_BSS_RX: local BSS receive time was filled in
1140abe37c4bSJohannes Berg  *
114161fa713cSHolger Schurig  * Used by the driver to indicate which info in &struct survey_info
114261fa713cSHolger Schurig  * it has filled in during the get_survey().
114361fa713cSHolger Schurig  */
114461fa713cSHolger Schurig enum survey_info_flags {
11454ed20bebSJohannes Berg 	SURVEY_INFO_NOISE_DBM		= BIT(0),
11464ed20bebSJohannes Berg 	SURVEY_INFO_IN_USE		= BIT(1),
11474ed20bebSJohannes Berg 	SURVEY_INFO_TIME		= BIT(2),
11484ed20bebSJohannes Berg 	SURVEY_INFO_TIME_BUSY		= BIT(3),
11494ed20bebSJohannes Berg 	SURVEY_INFO_TIME_EXT_BUSY	= BIT(4),
11504ed20bebSJohannes Berg 	SURVEY_INFO_TIME_RX		= BIT(5),
11514ed20bebSJohannes Berg 	SURVEY_INFO_TIME_TX		= BIT(6),
1152052536abSJohannes Berg 	SURVEY_INFO_TIME_SCAN		= BIT(7),
1153c8cd6e7fSFelix Fietkau 	SURVEY_INFO_TIME_BSS_RX		= BIT(8),
115461fa713cSHolger Schurig };
115561fa713cSHolger Schurig 
115661fa713cSHolger Schurig /**
115761fa713cSHolger Schurig  * struct survey_info - channel survey response
115861fa713cSHolger Schurig  *
115911f78ac3SJohannes Berg  * @channel: the channel this survey record reports, may be %NULL for a single
116011f78ac3SJohannes Berg  *	record to report global statistics
116161fa713cSHolger Schurig  * @filled: bitflag of flags from &enum survey_info_flags
116261fa713cSHolger Schurig  * @noise: channel noise in dBm. This and all following fields are
116361fa713cSHolger Schurig  *	optional
11644ed20bebSJohannes Berg  * @time: amount of time in ms the radio was turn on (on the channel)
11654ed20bebSJohannes Berg  * @time_busy: amount of time the primary channel was sensed busy
11664ed20bebSJohannes Berg  * @time_ext_busy: amount of time the extension channel was sensed busy
11674ed20bebSJohannes Berg  * @time_rx: amount of time the radio spent receiving data
11684ed20bebSJohannes Berg  * @time_tx: amount of time the radio spent transmitting data
1169052536abSJohannes Berg  * @time_scan: amount of time the radio spent for scanning
1170c8cd6e7fSFelix Fietkau  * @time_bss_rx: amount of time the radio spent receiving data on a local BSS
117161fa713cSHolger Schurig  *
1172abe37c4bSJohannes Berg  * Used by dump_survey() to report back per-channel survey information.
1173abe37c4bSJohannes Berg  *
117461fa713cSHolger Schurig  * This structure can later be expanded with things like
117561fa713cSHolger Schurig  * channel duty cycle etc.
117661fa713cSHolger Schurig  */
117761fa713cSHolger Schurig struct survey_info {
117861fa713cSHolger Schurig 	struct ieee80211_channel *channel;
11794ed20bebSJohannes Berg 	u64 time;
11804ed20bebSJohannes Berg 	u64 time_busy;
11814ed20bebSJohannes Berg 	u64 time_ext_busy;
11824ed20bebSJohannes Berg 	u64 time_rx;
11834ed20bebSJohannes Berg 	u64 time_tx;
1184052536abSJohannes Berg 	u64 time_scan;
1185c8cd6e7fSFelix Fietkau 	u64 time_bss_rx;
118661fa713cSHolger Schurig 	u32 filled;
118761fa713cSHolger Schurig 	s8 noise;
118861fa713cSHolger Schurig };
118961fa713cSHolger Schurig 
1190ecad3b0bSVeerendranath Jakkam #define CFG80211_MAX_NUM_AKM_SUITES	10
1191b8676221SDavid Spinadel 
119261fa713cSHolger Schurig /**
11935fb628e9SJouni Malinen  * struct cfg80211_crypto_settings - Crypto settings
11945fb628e9SJouni Malinen  * @wpa_versions: indicates which, if any, WPA versions are enabled
11955fb628e9SJouni Malinen  *	(from enum nl80211_wpa_versions)
11965fb628e9SJouni Malinen  * @cipher_group: group key cipher suite (or 0 if unset)
11975fb628e9SJouni Malinen  * @n_ciphers_pairwise: number of AP supported unicast ciphers
11985fb628e9SJouni Malinen  * @ciphers_pairwise: unicast key cipher suites
11995fb628e9SJouni Malinen  * @n_akm_suites: number of AKM suites
12005fb628e9SJouni Malinen  * @akm_suites: AKM suites
12015fb628e9SJouni Malinen  * @control_port: Whether user space controls IEEE 802.1X port, i.e.,
12025fb628e9SJouni Malinen  *	sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
12035fb628e9SJouni Malinen  *	required to assume that the port is unauthorized until authorized by
12045fb628e9SJouni Malinen  *	user space. Otherwise, port is marked authorized by default.
12055fb628e9SJouni Malinen  * @control_port_ethertype: the control port protocol that should be
12065fb628e9SJouni Malinen  *	allowed through even on unauthorized ports
12075fb628e9SJouni Malinen  * @control_port_no_encrypt: TRUE to prevent encryption of control port
12085fb628e9SJouni Malinen  *	protocol frames.
120964bf3d4bSDenis Kenzior  * @control_port_over_nl80211: TRUE if userspace expects to exchange control
121064bf3d4bSDenis Kenzior  *	port frames over NL80211 instead of the network interface.
1211a710d214SLothar Rubusch  * @control_port_no_preauth: disables pre-auth rx over the nl80211 control
1212a710d214SLothar Rubusch  *	port for mac80211
121391b5ab62SEliad Peller  * @psk: PSK (for devices supporting 4-way-handshake offload)
121426f7044eSChung-Hsien Hsu  * @sae_pwd: password for SAE authentication (for devices supporting SAE
121526f7044eSChung-Hsien Hsu  *	offload)
121626f7044eSChung-Hsien Hsu  * @sae_pwd_len: length of SAE password (for devices supporting SAE offload)
1217da1e9dd3SJohannes Berg  * @sae_pwe: The mechanisms allowed for SAE PWE derivation:
1218da1e9dd3SJohannes Berg  *
1219da1e9dd3SJohannes Berg  *	NL80211_SAE_PWE_UNSPECIFIED
1220da1e9dd3SJohannes Berg  *	  Not-specified, used to indicate userspace did not specify any
1221da1e9dd3SJohannes Berg  *	  preference. The driver should follow its internal policy in
1222da1e9dd3SJohannes Berg  *	  such a scenario.
1223da1e9dd3SJohannes Berg  *
1224da1e9dd3SJohannes Berg  *	NL80211_SAE_PWE_HUNT_AND_PECK
1225da1e9dd3SJohannes Berg  *	  Allow hunting-and-pecking loop only
1226da1e9dd3SJohannes Berg  *
1227da1e9dd3SJohannes Berg  *	NL80211_SAE_PWE_HASH_TO_ELEMENT
1228da1e9dd3SJohannes Berg  *	  Allow hash-to-element only
1229da1e9dd3SJohannes Berg  *
1230da1e9dd3SJohannes Berg  *	NL80211_SAE_PWE_BOTH
1231da1e9dd3SJohannes Berg  *	  Allow either hunting-and-pecking loop or hash-to-element
12325fb628e9SJouni Malinen  */
12335fb628e9SJouni Malinen struct cfg80211_crypto_settings {
12345fb628e9SJouni Malinen 	u32 wpa_versions;
12355fb628e9SJouni Malinen 	u32 cipher_group;
12365fb628e9SJouni Malinen 	int n_ciphers_pairwise;
12375fb628e9SJouni Malinen 	u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES];
12385fb628e9SJouni Malinen 	int n_akm_suites;
1239ecad3b0bSVeerendranath Jakkam 	u32 akm_suites[CFG80211_MAX_NUM_AKM_SUITES];
12405fb628e9SJouni Malinen 	bool control_port;
12415fb628e9SJouni Malinen 	__be16 control_port_ethertype;
12425fb628e9SJouni Malinen 	bool control_port_no_encrypt;
124364bf3d4bSDenis Kenzior 	bool control_port_over_nl80211;
12447f3f96ceSMarkus Theil 	bool control_port_no_preauth;
124591b5ab62SEliad Peller 	const u8 *psk;
124626f7044eSChung-Hsien Hsu 	const u8 *sae_pwd;
124726f7044eSChung-Hsien Hsu 	u8 sae_pwd_len;
12489f0ffa41SRohan Dutta 	enum nl80211_sae_pwe_mechanism sae_pwe;
12495fb628e9SJouni Malinen };
12505fb628e9SJouni Malinen 
12515fb628e9SJouni Malinen /**
1252dc1e3cb8SJohn Crispin  * struct cfg80211_mbssid_config - AP settings for multi bssid
1253dc1e3cb8SJohn Crispin  *
1254dc1e3cb8SJohn Crispin  * @tx_wdev: pointer to the transmitted interface in the MBSSID set
1255dc1e3cb8SJohn Crispin  * @index: index of this AP in the multi bssid group.
1256dc1e3cb8SJohn Crispin  * @ema: set to true if the beacons should be sent out in EMA mode.
1257dc1e3cb8SJohn Crispin  */
1258dc1e3cb8SJohn Crispin struct cfg80211_mbssid_config {
1259dc1e3cb8SJohn Crispin 	struct wireless_dev *tx_wdev;
1260dc1e3cb8SJohn Crispin 	u8 index;
1261dc1e3cb8SJohn Crispin 	bool ema;
1262dc1e3cb8SJohn Crispin };
1263dc1e3cb8SJohn Crispin 
1264dc1e3cb8SJohn Crispin /**
1265dc1e3cb8SJohn Crispin  * struct cfg80211_mbssid_elems - Multiple BSSID elements
1266dc1e3cb8SJohn Crispin  *
1267dc1e3cb8SJohn Crispin  * @cnt: Number of elements in array %elems.
1268dc1e3cb8SJohn Crispin  *
1269dc1e3cb8SJohn Crispin  * @elem: Array of multiple BSSID element(s) to be added into Beacon frames.
1270dc1e3cb8SJohn Crispin  * @elem.data: Data for multiple BSSID elements.
1271dc1e3cb8SJohn Crispin  * @elem.len: Length of data.
1272dc1e3cb8SJohn Crispin  */
1273dc1e3cb8SJohn Crispin struct cfg80211_mbssid_elems {
1274dc1e3cb8SJohn Crispin 	u8 cnt;
1275dc1e3cb8SJohn Crispin 	struct {
1276dc1e3cb8SJohn Crispin 		const u8 *data;
1277dc1e3cb8SJohn Crispin 		size_t len;
1278c14679d7SKees Cook 	} elem[] __counted_by(cnt);
1279dc1e3cb8SJohn Crispin };
1280dc1e3cb8SJohn Crispin 
1281dc1e3cb8SJohn Crispin /**
1282dbbb27e1SAloka Dixit  * struct cfg80211_rnr_elems - Reduced neighbor report (RNR) elements
1283dbbb27e1SAloka Dixit  *
1284dbbb27e1SAloka Dixit  * @cnt: Number of elements in array %elems.
1285dbbb27e1SAloka Dixit  *
1286dbbb27e1SAloka Dixit  * @elem: Array of RNR element(s) to be added into Beacon frames.
1287dbbb27e1SAloka Dixit  * @elem.data: Data for RNR elements.
1288dbbb27e1SAloka Dixit  * @elem.len: Length of data.
1289dbbb27e1SAloka Dixit  */
1290dbbb27e1SAloka Dixit struct cfg80211_rnr_elems {
1291dbbb27e1SAloka Dixit 	u8 cnt;
1292dbbb27e1SAloka Dixit 	struct {
1293dbbb27e1SAloka Dixit 		const u8 *data;
1294dbbb27e1SAloka Dixit 		size_t len;
12957b6d7087SKees Cook 	} elem[] __counted_by(cnt);
1296dbbb27e1SAloka Dixit };
1297dbbb27e1SAloka Dixit 
1298dbbb27e1SAloka Dixit /**
12998860020eSJohannes Berg  * struct cfg80211_beacon_data - beacon data
13007b0a0e3cSJohannes Berg  * @link_id: the link ID for the AP MLD link sending this beacon
1301ed1b6cc7SJohannes Berg  * @head: head portion of beacon (before TIM IE)
1302ed1b6cc7SJohannes Berg  *	or %NULL if not changed
1303ed1b6cc7SJohannes Berg  * @tail: tail portion of beacon (after TIM IE)
1304ed1b6cc7SJohannes Berg  *	or %NULL if not changed
1305ed1b6cc7SJohannes Berg  * @head_len: length of @head
1306ed1b6cc7SJohannes Berg  * @tail_len: length of @tail
13079946ecfbSJouni Malinen  * @beacon_ies: extra information element(s) to add into Beacon frames or %NULL
13089946ecfbSJouni Malinen  * @beacon_ies_len: length of beacon_ies in octets
13099946ecfbSJouni Malinen  * @proberesp_ies: extra information element(s) to add into Probe Response
13109946ecfbSJouni Malinen  *	frames or %NULL
13119946ecfbSJouni Malinen  * @proberesp_ies_len: length of proberesp_ies in octets
13129946ecfbSJouni Malinen  * @assocresp_ies: extra information element(s) to add into (Re)Association
13139946ecfbSJouni Malinen  *	Response frames or %NULL
13149946ecfbSJouni Malinen  * @assocresp_ies_len: length of assocresp_ies in octets
131500f740e1SArik Nemtsov  * @probe_resp_len: length of probe response template (@probe_resp)
131600f740e1SArik Nemtsov  * @probe_resp: probe response template (AP mode only)
1317dc1e3cb8SJohn Crispin  * @mbssid_ies: multiple BSSID elements
1318dbbb27e1SAloka Dixit  * @rnr_ies: reduced neighbor report elements
131981e54d08SPradeep Kumar Chitrapu  * @ftm_responder: enable FTM responder functionality; -1 for no change
132081e54d08SPradeep Kumar Chitrapu  *	(which also implies no change in LCI/civic location data)
132130db641eSJohannes Berg  * @lci: Measurement Report element content, starting with Measurement Token
132230db641eSJohannes Berg  *	(measurement type 8)
132330db641eSJohannes Berg  * @civicloc: Measurement Report element content, starting with Measurement
132430db641eSJohannes Berg  *	Token (measurement type 11)
132581e54d08SPradeep Kumar Chitrapu  * @lci_len: LCI data length
132681e54d08SPradeep Kumar Chitrapu  * @civicloc_len: Civic location data length
13273d48cb74SRameshkumar Sundaram  * @he_bss_color: BSS Color settings
13283d48cb74SRameshkumar Sundaram  * @he_bss_color_valid: indicates whether bss color
1329ee0e2f51SJohannes Berg  *	attribute is present in beacon data or not.
1330ed1b6cc7SJohannes Berg  */
13318860020eSJohannes Berg struct cfg80211_beacon_data {
13327b0a0e3cSJohannes Berg 	unsigned int link_id;
13337b0a0e3cSJohannes Berg 
13348860020eSJohannes Berg 	const u8 *head, *tail;
13358860020eSJohannes Berg 	const u8 *beacon_ies;
13368860020eSJohannes Berg 	const u8 *proberesp_ies;
13378860020eSJohannes Berg 	const u8 *assocresp_ies;
13388860020eSJohannes Berg 	const u8 *probe_resp;
133981e54d08SPradeep Kumar Chitrapu 	const u8 *lci;
134081e54d08SPradeep Kumar Chitrapu 	const u8 *civicloc;
1341dc1e3cb8SJohn Crispin 	struct cfg80211_mbssid_elems *mbssid_ies;
1342dbbb27e1SAloka Dixit 	struct cfg80211_rnr_elems *rnr_ies;
134381e54d08SPradeep Kumar Chitrapu 	s8 ftm_responder;
13448860020eSJohannes Berg 
13458860020eSJohannes Berg 	size_t head_len, tail_len;
13468860020eSJohannes Berg 	size_t beacon_ies_len;
13478860020eSJohannes Berg 	size_t proberesp_ies_len;
13488860020eSJohannes Berg 	size_t assocresp_ies_len;
13498860020eSJohannes Berg 	size_t probe_resp_len;
135081e54d08SPradeep Kumar Chitrapu 	size_t lci_len;
135181e54d08SPradeep Kumar Chitrapu 	size_t civicloc_len;
13523d48cb74SRameshkumar Sundaram 	struct cfg80211_he_bss_color he_bss_color;
13533d48cb74SRameshkumar Sundaram 	bool he_bss_color_valid;
13548860020eSJohannes Berg };
13558860020eSJohannes Berg 
13566d45a74bSVasanthakumar Thiagarajan struct mac_address {
13576d45a74bSVasanthakumar Thiagarajan 	u8 addr[ETH_ALEN];
13586d45a74bSVasanthakumar Thiagarajan };
13596d45a74bSVasanthakumar Thiagarajan 
13608860020eSJohannes Berg /**
136177765eafSVasanthakumar Thiagarajan  * struct cfg80211_acl_data - Access control list data
136277765eafSVasanthakumar Thiagarajan  *
136377765eafSVasanthakumar Thiagarajan  * @acl_policy: ACL policy to be applied on the station's
1364077f897aSJohannes Berg  *	entry specified by mac_addr
136577765eafSVasanthakumar Thiagarajan  * @n_acl_entries: Number of MAC address entries passed
136677765eafSVasanthakumar Thiagarajan  * @mac_addrs: List of MAC addresses of stations to be used for ACL
136777765eafSVasanthakumar Thiagarajan  */
136877765eafSVasanthakumar Thiagarajan struct cfg80211_acl_data {
136977765eafSVasanthakumar Thiagarajan 	enum nl80211_acl_policy acl_policy;
137077765eafSVasanthakumar Thiagarajan 	int n_acl_entries;
137177765eafSVasanthakumar Thiagarajan 
137277765eafSVasanthakumar Thiagarajan 	/* Keep it last */
137393ca8244SKees Cook 	struct mac_address mac_addrs[] __counted_by(n_acl_entries);
137477765eafSVasanthakumar Thiagarajan };
137577765eafSVasanthakumar Thiagarajan 
13768860020eSJohannes Berg /**
1377291c49deSAloka Dixit  * struct cfg80211_fils_discovery - FILS discovery parameters from
1378291c49deSAloka Dixit  * IEEE Std 802.11ai-2016, Annex C.3 MIB detail.
1379291c49deSAloka Dixit  *
13800cfaec25SAloka Dixit  * @update: Set to true if the feature configuration should be updated.
1381291c49deSAloka Dixit  * @min_interval: Minimum packet interval in TUs (0 - 10000)
1382291c49deSAloka Dixit  * @max_interval: Maximum packet interval in TUs (0 - 10000)
1383291c49deSAloka Dixit  * @tmpl_len: Template length
1384291c49deSAloka Dixit  * @tmpl: Template data for FILS discovery frame including the action
1385291c49deSAloka Dixit  *	frame headers.
1386291c49deSAloka Dixit  */
1387291c49deSAloka Dixit struct cfg80211_fils_discovery {
13880cfaec25SAloka Dixit 	bool update;
1389291c49deSAloka Dixit 	u32 min_interval;
1390291c49deSAloka Dixit 	u32 max_interval;
1391291c49deSAloka Dixit 	size_t tmpl_len;
1392291c49deSAloka Dixit 	const u8 *tmpl;
1393291c49deSAloka Dixit };
1394291c49deSAloka Dixit 
1395291c49deSAloka Dixit /**
13967443dcd1SAloka Dixit  * struct cfg80211_unsol_bcast_probe_resp - Unsolicited broadcast probe
13977443dcd1SAloka Dixit  *	response parameters in 6GHz.
13987443dcd1SAloka Dixit  *
13990cfaec25SAloka Dixit  * @update: Set to true if the feature configuration should be updated.
14007443dcd1SAloka Dixit  * @interval: Packet interval in TUs. Maximum allowed is 20 TU, as mentioned
14017443dcd1SAloka Dixit  *	in IEEE P802.11ax/D6.0 26.17.2.3.2 - AP behavior for fast passive
14027443dcd1SAloka Dixit  *	scanning
14037443dcd1SAloka Dixit  * @tmpl_len: Template length
14047443dcd1SAloka Dixit  * @tmpl: Template data for probe response
14057443dcd1SAloka Dixit  */
14067443dcd1SAloka Dixit struct cfg80211_unsol_bcast_probe_resp {
14070cfaec25SAloka Dixit 	bool update;
14087443dcd1SAloka Dixit 	u32 interval;
14097443dcd1SAloka Dixit 	size_t tmpl_len;
14107443dcd1SAloka Dixit 	const u8 *tmpl;
14117443dcd1SAloka Dixit };
14127443dcd1SAloka Dixit 
14137443dcd1SAloka Dixit /**
14148860020eSJohannes Berg  * struct cfg80211_ap_settings - AP configuration
14158860020eSJohannes Berg  *
14168860020eSJohannes Berg  * Used to configure an AP interface.
14178860020eSJohannes Berg  *
1418683b6d3bSJohannes Berg  * @chandef: defines the channel to use
14198860020eSJohannes Berg  * @beacon: beacon data
14208860020eSJohannes Berg  * @beacon_interval: beacon interval
14218860020eSJohannes Berg  * @dtim_period: DTIM period
14228860020eSJohannes Berg  * @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from
14238860020eSJohannes Berg  *	user space)
14248860020eSJohannes Berg  * @ssid_len: length of @ssid
14258860020eSJohannes Berg  * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames
14268860020eSJohannes Berg  * @crypto: crypto settings
14278860020eSJohannes Berg  * @privacy: the BSS uses privacy
14288860020eSJohannes Berg  * @auth_type: Authentication type (algorithm)
142918998c38SEliad Peller  * @smps_mode: SMPS mode
14301b658f11SVasanthakumar Thiagarajan  * @inactivity_timeout: time in seconds to determine station's inactivity.
143153cabad7SJohannes Berg  * @p2p_ctwindow: P2P CT Window
143253cabad7SJohannes Berg  * @p2p_opp_ps: P2P opportunistic PS
143377765eafSVasanthakumar Thiagarajan  * @acl: ACL configuration used by the drivers which has support for
143477765eafSVasanthakumar Thiagarajan  *	MAC address based access control
143534d50519SLior David  * @pbss: If set, start as a PCP instead of AP. Relevant for DMG
143634d50519SLior David  *	networks.
14378564e382SJohannes Berg  * @beacon_rate: bitrate to be used for beacons
143866cd794eSJohannes Berg  * @ht_cap: HT capabilities (or %NULL if HT isn't enabled)
143966cd794eSJohannes Berg  * @vht_cap: VHT capabilities (or %NULL if VHT isn't enabled)
1440244eb9aeSShaul Triebitz  * @he_cap: HE capabilities (or %NULL if HE isn't enabled)
14418bc65d38SAloka Dixit  * @eht_cap: EHT capabilities (or %NULL if EHT isn't enabled)
14428bc65d38SAloka Dixit  * @eht_oper: EHT operation IE (or %NULL if EHT isn't enabled)
144366cd794eSJohannes Berg  * @ht_required: stations must support HT
144466cd794eSJohannes Berg  * @vht_required: stations must support VHT
1445a0de1ca3SJohn Crispin  * @twt_responder: Enable Target Wait Time
14462a392596SIlan Peer  * @he_required: stations must support HE
1447d6587602SIlan Peer  * @sae_h2e_required: stations must support direct H2E technique in SAE
14481dcf396bSDmitry Antipov  * @flags: flags, as defined in &enum nl80211_ap_settings_flags
1449796e90f4SJohn Crispin  * @he_obss_pd: OBSS Packet Detection settings
14507e8d6f12SShaul Triebitz  * @he_oper: HE operation IE (or %NULL if HE isn't enabled)
1451291c49deSAloka Dixit  * @fils_discovery: FILS discovery transmission parameters
14527443dcd1SAloka Dixit  * @unsol_bcast_probe_resp: Unsolicited broadcast probe response parameters
1453dc1e3cb8SJohn Crispin  * @mbssid_config: AP settings for multiple bssid
1454d7c1a9a0SAloka Dixit  * @punct_bitmap: Preamble puncturing bitmap. Each bit represents
1455d7c1a9a0SAloka Dixit  *	a 20 MHz channel, lowest bit corresponding to the lowest channel.
1456d7c1a9a0SAloka Dixit  *	Bit set to 1 indicates that the channel is punctured.
14578860020eSJohannes Berg  */
14588860020eSJohannes Berg struct cfg80211_ap_settings {
1459683b6d3bSJohannes Berg 	struct cfg80211_chan_def chandef;
1460aa430da4SJohannes Berg 
14618860020eSJohannes Berg 	struct cfg80211_beacon_data beacon;
14628860020eSJohannes Berg 
14638860020eSJohannes Berg 	int beacon_interval, dtim_period;
146432e9de84SJouni Malinen 	const u8 *ssid;
146532e9de84SJouni Malinen 	size_t ssid_len;
146632e9de84SJouni Malinen 	enum nl80211_hidden_ssid hidden_ssid;
14675fb628e9SJouni Malinen 	struct cfg80211_crypto_settings crypto;
14685fb628e9SJouni Malinen 	bool privacy;
14695fb628e9SJouni Malinen 	enum nl80211_auth_type auth_type;
147018998c38SEliad Peller 	enum nl80211_smps_mode smps_mode;
14711b658f11SVasanthakumar Thiagarajan 	int inactivity_timeout;
147253cabad7SJohannes Berg 	u8 p2p_ctwindow;
147353cabad7SJohannes Berg 	bool p2p_opp_ps;
147477765eafSVasanthakumar Thiagarajan 	const struct cfg80211_acl_data *acl;
147534d50519SLior David 	bool pbss;
1476a7c7fbffSPurushottam Kushwaha 	struct cfg80211_bitrate_mask beacon_rate;
147766cd794eSJohannes Berg 
147866cd794eSJohannes Berg 	const struct ieee80211_ht_cap *ht_cap;
147966cd794eSJohannes Berg 	const struct ieee80211_vht_cap *vht_cap;
1480244eb9aeSShaul Triebitz 	const struct ieee80211_he_cap_elem *he_cap;
14817e8d6f12SShaul Triebitz 	const struct ieee80211_he_operation *he_oper;
14828bc65d38SAloka Dixit 	const struct ieee80211_eht_cap_elem *eht_cap;
14838bc65d38SAloka Dixit 	const struct ieee80211_eht_operation *eht_oper;
1484d6587602SIlan Peer 	bool ht_required, vht_required, he_required, sae_h2e_required;
1485a0de1ca3SJohn Crispin 	bool twt_responder;
1486fe494370SSrinivas Dasari 	u32 flags;
1487796e90f4SJohn Crispin 	struct ieee80211_he_obss_pd he_obss_pd;
1488291c49deSAloka Dixit 	struct cfg80211_fils_discovery fils_discovery;
14897443dcd1SAloka Dixit 	struct cfg80211_unsol_bcast_probe_resp unsol_bcast_probe_resp;
1490dc1e3cb8SJohn Crispin 	struct cfg80211_mbssid_config mbssid_config;
1491d7c1a9a0SAloka Dixit 	u16 punct_bitmap;
1492ed1b6cc7SJohannes Berg };
1493ed1b6cc7SJohannes Berg 
1494bb55441cSJohannes Berg 
1495bb55441cSJohannes Berg /**
1496bb55441cSJohannes Berg  * struct cfg80211_ap_update - AP configuration update
1497bb55441cSJohannes Berg  *
1498bb55441cSJohannes Berg  * Subset of &struct cfg80211_ap_settings, for updating a running AP.
1499bb55441cSJohannes Berg  *
1500bb55441cSJohannes Berg  * @beacon: beacon data
1501bb55441cSJohannes Berg  * @fils_discovery: FILS discovery transmission parameters
1502bb55441cSJohannes Berg  * @unsol_bcast_probe_resp: Unsolicited broadcast probe response parameters
1503bb55441cSJohannes Berg  */
1504bb55441cSJohannes Berg struct cfg80211_ap_update {
1505bb55441cSJohannes Berg 	struct cfg80211_beacon_data beacon;
1506bb55441cSJohannes Berg 	struct cfg80211_fils_discovery fils_discovery;
1507bb55441cSJohannes Berg 	struct cfg80211_unsol_bcast_probe_resp unsol_bcast_probe_resp;
1508bb55441cSJohannes Berg };
1509bb55441cSJohannes Berg 
15105727ef1bSJohannes Berg /**
151116ef1fe2SSimon Wunderlich  * struct cfg80211_csa_settings - channel switch settings
151216ef1fe2SSimon Wunderlich  *
151316ef1fe2SSimon Wunderlich  * Used for channel switch
151416ef1fe2SSimon Wunderlich  *
151516ef1fe2SSimon Wunderlich  * @chandef: defines the channel to use after the switch
151616ef1fe2SSimon Wunderlich  * @beacon_csa: beacon data while performing the switch
15179a774c78SAndrei Otcheretianski  * @counter_offsets_beacon: offsets of the counters within the beacon (tail)
15189a774c78SAndrei Otcheretianski  * @counter_offsets_presp: offsets of the counters within the probe response
15199a774c78SAndrei Otcheretianski  * @n_counter_offsets_beacon: number of csa counters the beacon (tail)
15209a774c78SAndrei Otcheretianski  * @n_counter_offsets_presp: number of csa counters in the probe response
152116ef1fe2SSimon Wunderlich  * @beacon_after: beacon data to be used on the new channel
152216ef1fe2SSimon Wunderlich  * @radar_required: whether radar detection is required on the new channel
152316ef1fe2SSimon Wunderlich  * @block_tx: whether transmissions should be blocked while changing
152416ef1fe2SSimon Wunderlich  * @count: number of beacons until switch
1525d7c1a9a0SAloka Dixit  * @punct_bitmap: Preamble puncturing bitmap. Each bit represents
1526d7c1a9a0SAloka Dixit  *	a 20 MHz channel, lowest bit corresponding to the lowest channel.
1527d7c1a9a0SAloka Dixit  *	Bit set to 1 indicates that the channel is punctured.
152816ef1fe2SSimon Wunderlich  */
152916ef1fe2SSimon Wunderlich struct cfg80211_csa_settings {
153016ef1fe2SSimon Wunderlich 	struct cfg80211_chan_def chandef;
153116ef1fe2SSimon Wunderlich 	struct cfg80211_beacon_data beacon_csa;
15329a774c78SAndrei Otcheretianski 	const u16 *counter_offsets_beacon;
15339a774c78SAndrei Otcheretianski 	const u16 *counter_offsets_presp;
15349a774c78SAndrei Otcheretianski 	unsigned int n_counter_offsets_beacon;
15359a774c78SAndrei Otcheretianski 	unsigned int n_counter_offsets_presp;
153616ef1fe2SSimon Wunderlich 	struct cfg80211_beacon_data beacon_after;
153716ef1fe2SSimon Wunderlich 	bool radar_required;
153816ef1fe2SSimon Wunderlich 	bool block_tx;
153916ef1fe2SSimon Wunderlich 	u8 count;
1540d7c1a9a0SAloka Dixit 	u16 punct_bitmap;
154116ef1fe2SSimon Wunderlich };
154216ef1fe2SSimon Wunderlich 
154316ef1fe2SSimon Wunderlich /**
15440d2ab3aeSJohn Crispin  * struct cfg80211_color_change_settings - color change settings
15450d2ab3aeSJohn Crispin  *
15460d2ab3aeSJohn Crispin  * Used for bss color change
15470d2ab3aeSJohn Crispin  *
15480d2ab3aeSJohn Crispin  * @beacon_color_change: beacon data while performing the color countdown
15492d8b08feSMauro Carvalho Chehab  * @counter_offset_beacon: offsets of the counters within the beacon (tail)
15502d8b08feSMauro Carvalho Chehab  * @counter_offset_presp: offsets of the counters within the probe response
15510d2ab3aeSJohn Crispin  * @beacon_next: beacon data to be used after the color change
15520d2ab3aeSJohn Crispin  * @count: number of beacons until the color change
15530d2ab3aeSJohn Crispin  * @color: the color used after the change
15540d2ab3aeSJohn Crispin  */
15550d2ab3aeSJohn Crispin struct cfg80211_color_change_settings {
15560d2ab3aeSJohn Crispin 	struct cfg80211_beacon_data beacon_color_change;
15570d2ab3aeSJohn Crispin 	u16 counter_offset_beacon;
15580d2ab3aeSJohn Crispin 	u16 counter_offset_presp;
15590d2ab3aeSJohn Crispin 	struct cfg80211_beacon_data beacon_next;
15600d2ab3aeSJohn Crispin 	u8 count;
15610d2ab3aeSJohn Crispin 	u8 color;
15620d2ab3aeSJohn Crispin };
15630d2ab3aeSJohn Crispin 
15640d2ab3aeSJohn Crispin /**
1565e227300cSPurushottam Kushwaha  * struct iface_combination_params - input parameters for interface combinations
1566e227300cSPurushottam Kushwaha  *
1567e227300cSPurushottam Kushwaha  * Used to pass interface combination parameters
1568e227300cSPurushottam Kushwaha  *
1569e227300cSPurushottam Kushwaha  * @num_different_channels: the number of different channels we want
1570e227300cSPurushottam Kushwaha  *	to use for verification
1571e227300cSPurushottam Kushwaha  * @radar_detect: a bitmap where each bit corresponds to a channel
1572e227300cSPurushottam Kushwaha  *	width where radar detection is needed, as in the definition of
1573e227300cSPurushottam Kushwaha  *	&struct ieee80211_iface_combination.@radar_detect_widths
1574e227300cSPurushottam Kushwaha  * @iftype_num: array with the number of interfaces of each interface
1575e227300cSPurushottam Kushwaha  *	type.  The index is the interface type as specified in &enum
1576e227300cSPurushottam Kushwaha  *	nl80211_iftype.
15774c8dea63SJohannes Berg  * @new_beacon_int: set this to the beacon interval of a new interface
15784c8dea63SJohannes Berg  *	that's not operating yet, if such is to be checked as part of
15794c8dea63SJohannes Berg  *	the verification
1580e227300cSPurushottam Kushwaha  */
1581e227300cSPurushottam Kushwaha struct iface_combination_params {
1582e227300cSPurushottam Kushwaha 	int num_different_channels;
1583e227300cSPurushottam Kushwaha 	u8 radar_detect;
1584e227300cSPurushottam Kushwaha 	int iftype_num[NUM_NL80211_IFTYPES];
15854c8dea63SJohannes Berg 	u32 new_beacon_int;
1586e227300cSPurushottam Kushwaha };
1587e227300cSPurushottam Kushwaha 
1588e227300cSPurushottam Kushwaha /**
15893b9ce80cSJohannes Berg  * enum station_parameters_apply_mask - station parameter values to apply
15903b9ce80cSJohannes Berg  * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp)
15919d62a986SJouni Malinen  * @STATION_PARAM_APPLY_CAPABILITY: apply new capability
1592f8bacc21SJohannes Berg  * @STATION_PARAM_APPLY_PLINK_STATE: apply new plink state
15933b9ce80cSJohannes Berg  *
15943b9ce80cSJohannes Berg  * Not all station parameters have in-band "no change" signalling,
15953b9ce80cSJohannes Berg  * for those that don't these flags will are used.
15963b9ce80cSJohannes Berg  */
15973b9ce80cSJohannes Berg enum station_parameters_apply_mask {
15983b9ce80cSJohannes Berg 	STATION_PARAM_APPLY_UAPSD = BIT(0),
15999d62a986SJouni Malinen 	STATION_PARAM_APPLY_CAPABILITY = BIT(1),
1600f8bacc21SJohannes Berg 	STATION_PARAM_APPLY_PLINK_STATE = BIT(2),
1601e96d1cd2SAshok Raj Nagarajan };
1602e96d1cd2SAshok Raj Nagarajan 
1603e96d1cd2SAshok Raj Nagarajan /**
1604e96d1cd2SAshok Raj Nagarajan  * struct sta_txpwr - station txpower configuration
1605e96d1cd2SAshok Raj Nagarajan  *
1606e96d1cd2SAshok Raj Nagarajan  * Used to configure txpower for station.
1607e96d1cd2SAshok Raj Nagarajan  *
1608e96d1cd2SAshok Raj Nagarajan  * @power: tx power (in dBm) to be used for sending data traffic. If tx power
1609e96d1cd2SAshok Raj Nagarajan  *	is not provided, the default per-interface tx power setting will be
1610e96d1cd2SAshok Raj Nagarajan  *	overriding. Driver should be picking up the lowest tx power, either tx
1611e96d1cd2SAshok Raj Nagarajan  *	power per-interface or per-station.
1612e96d1cd2SAshok Raj Nagarajan  * @type: In particular if TPC %type is NL80211_TX_POWER_LIMITED then tx power
1613e96d1cd2SAshok Raj Nagarajan  *	will be less than or equal to specified from userspace, whereas if TPC
1614e96d1cd2SAshok Raj Nagarajan  *	%type is NL80211_TX_POWER_AUTOMATIC then it indicates default tx power.
1615e96d1cd2SAshok Raj Nagarajan  *	NL80211_TX_POWER_FIXED is not a valid configuration option for
1616e96d1cd2SAshok Raj Nagarajan  *	per peer TPC.
1617e96d1cd2SAshok Raj Nagarajan  */
1618e96d1cd2SAshok Raj Nagarajan struct sta_txpwr {
1619e96d1cd2SAshok Raj Nagarajan 	s16 power;
1620e96d1cd2SAshok Raj Nagarajan 	enum nl80211_tx_power_setting type;
16213b9ce80cSJohannes Berg };
16223b9ce80cSJohannes Berg 
16233b9ce80cSJohannes Berg /**
1624577e5b8cSShaul Triebitz  * struct link_station_parameters - link station parameters
1625577e5b8cSShaul Triebitz  *
1626577e5b8cSShaul Triebitz  * Used to change and create a new link station.
1627577e5b8cSShaul Triebitz  *
1628577e5b8cSShaul Triebitz  * @mld_mac: MAC address of the station
1629577e5b8cSShaul Triebitz  * @link_id: the link id (-1 for non-MLD station)
1630577e5b8cSShaul Triebitz  * @link_mac: MAC address of the link
1631577e5b8cSShaul Triebitz  * @supported_rates: supported rates in IEEE 802.11 format
1632577e5b8cSShaul Triebitz  *	(or NULL for no change)
1633577e5b8cSShaul Triebitz  * @supported_rates_len: number of supported rates
1634577e5b8cSShaul Triebitz  * @ht_capa: HT capabilities of station
1635577e5b8cSShaul Triebitz  * @vht_capa: VHT capabilities of station
1636577e5b8cSShaul Triebitz  * @opmode_notif: operating mode field from Operating Mode Notification
1637577e5b8cSShaul Triebitz  * @opmode_notif_used: information if operating mode field is used
1638577e5b8cSShaul Triebitz  * @he_capa: HE capabilities of station
1639577e5b8cSShaul Triebitz  * @he_capa_len: the length of the HE capabilities
1640577e5b8cSShaul Triebitz  * @txpwr: transmit power for an associated station
1641577e5b8cSShaul Triebitz  * @txpwr_set: txpwr field is set
1642577e5b8cSShaul Triebitz  * @he_6ghz_capa: HE 6 GHz Band capabilities of station
1643577e5b8cSShaul Triebitz  * @eht_capa: EHT capabilities of station
1644577e5b8cSShaul Triebitz  * @eht_capa_len: the length of the EHT capabilities
1645577e5b8cSShaul Triebitz  */
1646577e5b8cSShaul Triebitz struct link_station_parameters {
1647577e5b8cSShaul Triebitz 	const u8 *mld_mac;
1648577e5b8cSShaul Triebitz 	int link_id;
1649577e5b8cSShaul Triebitz 	const u8 *link_mac;
1650577e5b8cSShaul Triebitz 	const u8 *supported_rates;
1651577e5b8cSShaul Triebitz 	u8 supported_rates_len;
1652577e5b8cSShaul Triebitz 	const struct ieee80211_ht_cap *ht_capa;
1653577e5b8cSShaul Triebitz 	const struct ieee80211_vht_cap *vht_capa;
1654577e5b8cSShaul Triebitz 	u8 opmode_notif;
1655577e5b8cSShaul Triebitz 	bool opmode_notif_used;
1656577e5b8cSShaul Triebitz 	const struct ieee80211_he_cap_elem *he_capa;
1657577e5b8cSShaul Triebitz 	u8 he_capa_len;
1658577e5b8cSShaul Triebitz 	struct sta_txpwr txpwr;
1659577e5b8cSShaul Triebitz 	bool txpwr_set;
1660577e5b8cSShaul Triebitz 	const struct ieee80211_he_6ghz_capa *he_6ghz_capa;
1661577e5b8cSShaul Triebitz 	const struct ieee80211_eht_cap_elem *eht_capa;
1662577e5b8cSShaul Triebitz 	u8 eht_capa_len;
1663577e5b8cSShaul Triebitz };
1664577e5b8cSShaul Triebitz 
1665577e5b8cSShaul Triebitz /**
1666577e5b8cSShaul Triebitz  * struct link_station_del_parameters - link station deletion parameters
1667577e5b8cSShaul Triebitz  *
1668577e5b8cSShaul Triebitz  * Used to delete a link station entry (or all stations).
1669577e5b8cSShaul Triebitz  *
1670577e5b8cSShaul Triebitz  * @mld_mac: MAC address of the station
1671577e5b8cSShaul Triebitz  * @link_id: the link id
1672577e5b8cSShaul Triebitz  */
1673577e5b8cSShaul Triebitz struct link_station_del_parameters {
1674577e5b8cSShaul Triebitz 	const u8 *mld_mac;
1675577e5b8cSShaul Triebitz 	u32 link_id;
1676577e5b8cSShaul Triebitz };
1677577e5b8cSShaul Triebitz 
1678577e5b8cSShaul Triebitz /**
1679b61e6b41SIlan Peer  * struct cfg80211_ttlm_params: TID to link mapping parameters
1680b61e6b41SIlan Peer  *
1681b61e6b41SIlan Peer  * Used for setting a TID to link mapping.
1682b61e6b41SIlan Peer  *
1683b61e6b41SIlan Peer  * @dlink: Downlink TID to link mapping, as defined in section 9.4.2.314
1684b61e6b41SIlan Peer  *     (TID-To-Link Mapping element) in Draft P802.11be_D4.0.
1685b61e6b41SIlan Peer  * @ulink: Uplink TID to link mapping, as defined in section 9.4.2.314
1686b61e6b41SIlan Peer  *     (TID-To-Link Mapping element) in Draft P802.11be_D4.0.
1687b61e6b41SIlan Peer  */
1688b61e6b41SIlan Peer struct cfg80211_ttlm_params {
1689b61e6b41SIlan Peer 	u16 dlink[8];
1690b61e6b41SIlan Peer 	u16 ulink[8];
1691b61e6b41SIlan Peer };
1692b61e6b41SIlan Peer 
1693b61e6b41SIlan Peer /**
16945727ef1bSJohannes Berg  * struct station_parameters - station parameters
16955727ef1bSJohannes Berg  *
16965727ef1bSJohannes Berg  * Used to change and create a new station.
16975727ef1bSJohannes Berg  *
16985727ef1bSJohannes Berg  * @vlan: vlan interface station should belong to
1699eccb8e8fSJohannes Berg  * @sta_flags_mask: station flags that changed
1700819bf593SJohannes Berg  *	(bitmask of BIT(%NL80211_STA_FLAG_...))
1701eccb8e8fSJohannes Berg  * @sta_flags_set: station flags values
1702819bf593SJohannes Berg  *	(bitmask of BIT(%NL80211_STA_FLAG_...))
17035727ef1bSJohannes Berg  * @listen_interval: listen interval or -1 for no change
17045727ef1bSJohannes Berg  * @aid: AID or zero for no change
170514f34e36SGurumoorthi Gnanasambandhan  * @vlan_id: VLAN ID for station (if nonzero)
17067d27a0baSMasashi Honma  * @peer_aid: mesh peer AID or zero for no change
1707abe37c4bSJohannes Berg  * @plink_action: plink action to take
17089c3990aaSJavier Cardona  * @plink_state: set the peer link state for a station
1709910868dbSEliad Peller  * @uapsd_queues: bitmap of queues configured for uapsd. same format
1710910868dbSEliad Peller  *	as the AC bitmap in the QoS info field
1711910868dbSEliad Peller  * @max_sp: max Service Period. same format as the MAX_SP in the
1712910868dbSEliad Peller  *	QoS info field (but already shifted down)
1713c26887d2SJohannes Berg  * @sta_modify_mask: bitmap indicating which parameters changed
1714c26887d2SJohannes Berg  *	(for those that don't have a natural "no change" value),
1715c26887d2SJohannes Berg  *	see &enum station_parameters_apply_mask
17163b1c5a53SMarco Porsch  * @local_pm: local link-specific mesh power save mode (no change when set
17173b1c5a53SMarco Porsch  *	to unknown)
17189d62a986SJouni Malinen  * @capability: station capability
17199d62a986SJouni Malinen  * @ext_capab: extended capabilities of the station
17209d62a986SJouni Malinen  * @ext_capab_len: number of extended capabilities
1721c01fc9adSSunil Dutt  * @supported_channels: supported channels in IEEE 802.11 format
1722c01fc9adSSunil Dutt  * @supported_channels_len: number of supported channels
1723c01fc9adSSunil Dutt  * @supported_oper_classes: supported oper classes in IEEE 802.11 format
1724c01fc9adSSunil Dutt  * @supported_oper_classes_len: number of supported operating classes
172517b94247SAyala Beker  * @support_p2p_ps: information if station supports P2P PS mechanism
172636647055SToke Høiland-Jørgensen  * @airtime_weight: airtime scheduler weight for this station
1727b95eb7f0SShaul Triebitz  * @link_sta_params: link related params.
17285727ef1bSJohannes Berg  */
17295727ef1bSJohannes Berg struct station_parameters {
17305727ef1bSJohannes Berg 	struct net_device *vlan;
1731eccb8e8fSJohannes Berg 	u32 sta_flags_mask, sta_flags_set;
17323b9ce80cSJohannes Berg 	u32 sta_modify_mask;
17335727ef1bSJohannes Berg 	int listen_interval;
17345727ef1bSJohannes Berg 	u16 aid;
173514f34e36SGurumoorthi Gnanasambandhan 	u16 vlan_id;
17367d27a0baSMasashi Honma 	u16 peer_aid;
17372ec600d6SLuis Carlos Cobo 	u8 plink_action;
17389c3990aaSJavier Cardona 	u8 plink_state;
1739c75786c9SEliad Peller 	u8 uapsd_queues;
1740c75786c9SEliad Peller 	u8 max_sp;
17413b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode local_pm;
17429d62a986SJouni Malinen 	u16 capability;
17432c1aabf3SJohannes Berg 	const u8 *ext_capab;
17449d62a986SJouni Malinen 	u8 ext_capab_len;
1745c01fc9adSSunil Dutt 	const u8 *supported_channels;
1746c01fc9adSSunil Dutt 	u8 supported_channels_len;
1747c01fc9adSSunil Dutt 	const u8 *supported_oper_classes;
1748c01fc9adSSunil Dutt 	u8 supported_oper_classes_len;
174917b94247SAyala Beker 	int support_p2p_ps;
175036647055SToke Høiland-Jørgensen 	u16 airtime_weight;
1751b95eb7f0SShaul Triebitz 	struct link_station_parameters link_sta_params;
17525727ef1bSJohannes Berg };
17535727ef1bSJohannes Berg 
1754fd5b74dcSJohannes Berg /**
175589c771e5SJouni Malinen  * struct station_del_parameters - station deletion parameters
175689c771e5SJouni Malinen  *
175789c771e5SJouni Malinen  * Used to delete a station entry (or all stations).
175889c771e5SJouni Malinen  *
175989c771e5SJouni Malinen  * @mac: MAC address of the station to remove or NULL to remove all stations
176098856866SJouni Malinen  * @subtype: Management frame subtype to use for indicating removal
176198856866SJouni Malinen  *	(10 = Disassociation, 12 = Deauthentication)
176298856866SJouni Malinen  * @reason_code: Reason code for the Disassociation/Deauthentication frame
176389c771e5SJouni Malinen  */
176489c771e5SJouni Malinen struct station_del_parameters {
176589c771e5SJouni Malinen 	const u8 *mac;
176698856866SJouni Malinen 	u8 subtype;
176798856866SJouni Malinen 	u16 reason_code;
176889c771e5SJouni Malinen };
176989c771e5SJouni Malinen 
177089c771e5SJouni Malinen /**
177177ee7c89SJohannes Berg  * enum cfg80211_station_type - the type of station being modified
177277ee7c89SJohannes Berg  * @CFG80211_STA_AP_CLIENT: client of an AP interface
177347edb11bSAyala Beker  * @CFG80211_STA_AP_CLIENT_UNASSOC: client of an AP interface that is still
177447edb11bSAyala Beker  *	unassociated (update properties for this type of client is permitted)
177577ee7c89SJohannes Berg  * @CFG80211_STA_AP_MLME_CLIENT: client of an AP interface that has
177677ee7c89SJohannes Berg  *	the AP MLME in the device
177777ee7c89SJohannes Berg  * @CFG80211_STA_AP_STA: AP station on managed interface
177877ee7c89SJohannes Berg  * @CFG80211_STA_IBSS: IBSS station
177977ee7c89SJohannes Berg  * @CFG80211_STA_TDLS_PEER_SETUP: TDLS peer on managed interface (dummy entry
178077ee7c89SJohannes Berg  *	while TDLS setup is in progress, it moves out of this state when
178177ee7c89SJohannes Berg  *	being marked authorized; use this only if TDLS with external setup is
178277ee7c89SJohannes Berg  *	supported/used)
178377ee7c89SJohannes Berg  * @CFG80211_STA_TDLS_PEER_ACTIVE: TDLS peer on managed interface (active
178477ee7c89SJohannes Berg  *	entry that is operating, has been marked authorized by userspace)
1785eef941e6SThomas Pedersen  * @CFG80211_STA_MESH_PEER_KERNEL: peer on mesh interface (kernel managed)
1786eef941e6SThomas Pedersen  * @CFG80211_STA_MESH_PEER_USER: peer on mesh interface (user managed)
178777ee7c89SJohannes Berg  */
178877ee7c89SJohannes Berg enum cfg80211_station_type {
178977ee7c89SJohannes Berg 	CFG80211_STA_AP_CLIENT,
179047edb11bSAyala Beker 	CFG80211_STA_AP_CLIENT_UNASSOC,
179177ee7c89SJohannes Berg 	CFG80211_STA_AP_MLME_CLIENT,
179277ee7c89SJohannes Berg 	CFG80211_STA_AP_STA,
179377ee7c89SJohannes Berg 	CFG80211_STA_IBSS,
179477ee7c89SJohannes Berg 	CFG80211_STA_TDLS_PEER_SETUP,
179577ee7c89SJohannes Berg 	CFG80211_STA_TDLS_PEER_ACTIVE,
1796eef941e6SThomas Pedersen 	CFG80211_STA_MESH_PEER_KERNEL,
1797eef941e6SThomas Pedersen 	CFG80211_STA_MESH_PEER_USER,
179877ee7c89SJohannes Berg };
179977ee7c89SJohannes Berg 
180077ee7c89SJohannes Berg /**
180177ee7c89SJohannes Berg  * cfg80211_check_station_change - validate parameter changes
180277ee7c89SJohannes Berg  * @wiphy: the wiphy this operates on
180377ee7c89SJohannes Berg  * @params: the new parameters for a station
180477ee7c89SJohannes Berg  * @statype: the type of station being modified
180577ee7c89SJohannes Berg  *
180677ee7c89SJohannes Berg  * Utility function for the @change_station driver method. Call this function
180777ee7c89SJohannes Berg  * with the appropriate station type looking up the station (and checking that
180877ee7c89SJohannes Berg  * it exists). It will verify whether the station change is acceptable, and if
180977ee7c89SJohannes Berg  * not will return an error code. Note that it may modify the parameters for
181077ee7c89SJohannes Berg  * backward compatibility reasons, so don't use them before calling this.
181177ee7c89SJohannes Berg  */
181277ee7c89SJohannes Berg int cfg80211_check_station_change(struct wiphy *wiphy,
181377ee7c89SJohannes Berg 				  struct station_parameters *params,
181477ee7c89SJohannes Berg 				  enum cfg80211_station_type statype);
181577ee7c89SJohannes Berg 
181677ee7c89SJohannes Berg /**
1817b1e8eb11SMauro Carvalho Chehab  * enum rate_info_flags - bitrate info flags
1818420e7fabSHenning Rogge  *
1819420e7fabSHenning Rogge  * Used by the driver to indicate the specific rate transmission
1820420e7fabSHenning Rogge  * type for 802.11n transmissions.
1821420e7fabSHenning Rogge  *
1822db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_MCS: mcs field filled with HT MCS
1823db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_VHT_MCS: mcs field filled with VHT MCS
1824420e7fabSHenning Rogge  * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval
18252a38075cSAlexei Avshalom Lazar  * @RATE_INFO_FLAGS_DMG: 60GHz MCS
1826c4cbaf79SLuca Coelho  * @RATE_INFO_FLAGS_HE_MCS: HE MCS information
18272a38075cSAlexei Avshalom Lazar  * @RATE_INFO_FLAGS_EDMG: 60GHz MCS in EDMG mode
1828d9c85e24SMax Chen  * @RATE_INFO_FLAGS_EXTENDED_SC_DMG: 60GHz extended SC MCS
1829cfb14110SVeerendranath Jakkam  * @RATE_INFO_FLAGS_EHT_MCS: EHT MCS information
18302ad66fcbSGilad Itzkovitch  * @RATE_INFO_FLAGS_S1G_MCS: MCS field filled with S1G MCS
1831420e7fabSHenning Rogge  */
1832420e7fabSHenning Rogge enum rate_info_flags {
1833db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_MCS			= BIT(0),
1834db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_VHT_MCS			= BIT(1),
1835b51f3beeSJohannes Berg 	RATE_INFO_FLAGS_SHORT_GI		= BIT(2),
18362a38075cSAlexei Avshalom Lazar 	RATE_INFO_FLAGS_DMG			= BIT(3),
1837c4cbaf79SLuca Coelho 	RATE_INFO_FLAGS_HE_MCS			= BIT(4),
18382a38075cSAlexei Avshalom Lazar 	RATE_INFO_FLAGS_EDMG			= BIT(5),
1839d9c85e24SMax Chen 	RATE_INFO_FLAGS_EXTENDED_SC_DMG		= BIT(6),
1840cfb14110SVeerendranath Jakkam 	RATE_INFO_FLAGS_EHT_MCS			= BIT(7),
18412ad66fcbSGilad Itzkovitch 	RATE_INFO_FLAGS_S1G_MCS			= BIT(8),
1842b51f3beeSJohannes Berg };
1843b51f3beeSJohannes Berg 
1844b51f3beeSJohannes Berg /**
1845b51f3beeSJohannes Berg  * enum rate_info_bw - rate bandwidth information
1846b51f3beeSJohannes Berg  *
1847b51f3beeSJohannes Berg  * Used by the driver to indicate the rate bandwidth.
1848b51f3beeSJohannes Berg  *
1849b51f3beeSJohannes Berg  * @RATE_INFO_BW_5: 5 MHz bandwidth
1850b51f3beeSJohannes Berg  * @RATE_INFO_BW_10: 10 MHz bandwidth
1851b51f3beeSJohannes Berg  * @RATE_INFO_BW_20: 20 MHz bandwidth
1852b51f3beeSJohannes Berg  * @RATE_INFO_BW_40: 40 MHz bandwidth
1853b51f3beeSJohannes Berg  * @RATE_INFO_BW_80: 80 MHz bandwidth
1854b51f3beeSJohannes Berg  * @RATE_INFO_BW_160: 160 MHz bandwidth
1855c4cbaf79SLuca Coelho  * @RATE_INFO_BW_HE_RU: bandwidth determined by HE RU allocation
1856cfb14110SVeerendranath Jakkam  * @RATE_INFO_BW_320: 320 MHz bandwidth
1857cfb14110SVeerendranath Jakkam  * @RATE_INFO_BW_EHT_RU: bandwidth determined by EHT RU allocation
18582ad66fcbSGilad Itzkovitch  * @RATE_INFO_BW_1: 1 MHz bandwidth
18592ad66fcbSGilad Itzkovitch  * @RATE_INFO_BW_2: 2 MHz bandwidth
18602ad66fcbSGilad Itzkovitch  * @RATE_INFO_BW_4: 4 MHz bandwidth
18612ad66fcbSGilad Itzkovitch  * @RATE_INFO_BW_8: 8 MHz bandwidth
18622ad66fcbSGilad Itzkovitch  * @RATE_INFO_BW_16: 16 MHz bandwidth
1863b51f3beeSJohannes Berg  */
1864b51f3beeSJohannes Berg enum rate_info_bw {
1865842be75cSJohannes Berg 	RATE_INFO_BW_20 = 0,
1866b51f3beeSJohannes Berg 	RATE_INFO_BW_5,
1867b51f3beeSJohannes Berg 	RATE_INFO_BW_10,
1868b51f3beeSJohannes Berg 	RATE_INFO_BW_40,
1869b51f3beeSJohannes Berg 	RATE_INFO_BW_80,
1870b51f3beeSJohannes Berg 	RATE_INFO_BW_160,
1871c4cbaf79SLuca Coelho 	RATE_INFO_BW_HE_RU,
1872cfb14110SVeerendranath Jakkam 	RATE_INFO_BW_320,
1873cfb14110SVeerendranath Jakkam 	RATE_INFO_BW_EHT_RU,
18742ad66fcbSGilad Itzkovitch 	RATE_INFO_BW_1,
18752ad66fcbSGilad Itzkovitch 	RATE_INFO_BW_2,
18762ad66fcbSGilad Itzkovitch 	RATE_INFO_BW_4,
18772ad66fcbSGilad Itzkovitch 	RATE_INFO_BW_8,
18782ad66fcbSGilad Itzkovitch 	RATE_INFO_BW_16,
1879420e7fabSHenning Rogge };
1880420e7fabSHenning Rogge 
1881420e7fabSHenning Rogge /**
1882420e7fabSHenning Rogge  * struct rate_info - bitrate information
1883420e7fabSHenning Rogge  *
1884420e7fabSHenning Rogge  * Information about a receiving or transmitting bitrate
1885420e7fabSHenning Rogge  *
1886420e7fabSHenning Rogge  * @flags: bitflag of flags from &enum rate_info_flags
1887420e7fabSHenning Rogge  * @legacy: bitrate in 100kbit/s for 802.11abg
18882ad66fcbSGilad Itzkovitch  * @mcs: mcs index if struct describes an HT/VHT/HE/EHT/S1G rate
1889c4cbaf79SLuca Coelho  * @nss: number of streams (VHT & HE only)
1890b51f3beeSJohannes Berg  * @bw: bandwidth (from &enum rate_info_bw)
1891c4cbaf79SLuca Coelho  * @he_gi: HE guard interval (from &enum nl80211_he_gi)
1892c4cbaf79SLuca Coelho  * @he_dcm: HE DCM value
1893c4cbaf79SLuca Coelho  * @he_ru_alloc: HE RU allocation (from &enum nl80211_he_ru_alloc,
1894c4cbaf79SLuca Coelho  *	only valid if bw is %RATE_INFO_BW_HE_RU)
18952a38075cSAlexei Avshalom Lazar  * @n_bonded_ch: In case of EDMG the number of bonded channels (1-4)
1896cfb14110SVeerendranath Jakkam  * @eht_gi: EHT guard interval (from &enum nl80211_eht_gi)
1897cfb14110SVeerendranath Jakkam  * @eht_ru_alloc: EHT RU allocation (from &enum nl80211_eht_ru_alloc,
1898cfb14110SVeerendranath Jakkam  *	only valid if bw is %RATE_INFO_BW_EHT_RU)
1899420e7fabSHenning Rogge  */
1900420e7fabSHenning Rogge struct rate_info {
19012ad66fcbSGilad Itzkovitch 	u16 flags;
1902420e7fabSHenning Rogge 	u16 legacy;
19032ad66fcbSGilad Itzkovitch 	u8 mcs;
1904db9c64cfSJohannes Berg 	u8 nss;
1905b51f3beeSJohannes Berg 	u8 bw;
1906c4cbaf79SLuca Coelho 	u8 he_gi;
1907c4cbaf79SLuca Coelho 	u8 he_dcm;
1908c4cbaf79SLuca Coelho 	u8 he_ru_alloc;
19092a38075cSAlexei Avshalom Lazar 	u8 n_bonded_ch;
1910cfb14110SVeerendranath Jakkam 	u8 eht_gi;
1911cfb14110SVeerendranath Jakkam 	u8 eht_ru_alloc;
1912fd5b74dcSJohannes Berg };
1913fd5b74dcSJohannes Berg 
1914fd5b74dcSJohannes Berg /**
1915b1e8eb11SMauro Carvalho Chehab  * enum bss_param_flags - bitrate info flags
1916f4263c98SPaul Stewart  *
1917f4263c98SPaul Stewart  * Used by the driver to indicate the specific rate transmission
1918f4263c98SPaul Stewart  * type for 802.11n transmissions.
1919f4263c98SPaul Stewart  *
1920f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_CTS_PROT: whether CTS protection is enabled
1921f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_SHORT_PREAMBLE: whether short preamble is enabled
1922f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_SHORT_SLOT_TIME: whether short slot time is enabled
1923f4263c98SPaul Stewart  */
1924f4263c98SPaul Stewart enum bss_param_flags {
1925f4263c98SPaul Stewart 	BSS_PARAM_FLAGS_CTS_PROT	= 1<<0,
1926f4263c98SPaul Stewart 	BSS_PARAM_FLAGS_SHORT_PREAMBLE	= 1<<1,
1927f4263c98SPaul Stewart 	BSS_PARAM_FLAGS_SHORT_SLOT_TIME	= 1<<2,
1928f4263c98SPaul Stewart };
1929f4263c98SPaul Stewart 
1930f4263c98SPaul Stewart /**
1931f4263c98SPaul Stewart  * struct sta_bss_parameters - BSS parameters for the attached station
1932f4263c98SPaul Stewart  *
1933f4263c98SPaul Stewart  * Information about the currently associated BSS
1934f4263c98SPaul Stewart  *
1935f4263c98SPaul Stewart  * @flags: bitflag of flags from &enum bss_param_flags
1936f4263c98SPaul Stewart  * @dtim_period: DTIM period for the BSS
1937f4263c98SPaul Stewart  * @beacon_interval: beacon interval
1938f4263c98SPaul Stewart  */
1939f4263c98SPaul Stewart struct sta_bss_parameters {
1940f4263c98SPaul Stewart 	u8 flags;
1941f4263c98SPaul Stewart 	u8 dtim_period;
1942f4263c98SPaul Stewart 	u16 beacon_interval;
1943f4263c98SPaul Stewart };
1944f4263c98SPaul Stewart 
19456de39808SJohannes Berg /**
194652539ca8SToke Høiland-Jørgensen  * struct cfg80211_txq_stats - TXQ statistics for this TID
194752539ca8SToke Høiland-Jørgensen  * @filled: bitmap of flags using the bits of &enum nl80211_txq_stats to
194852539ca8SToke Høiland-Jørgensen  *	indicate the relevant values in this struct are filled
194952539ca8SToke Høiland-Jørgensen  * @backlog_bytes: total number of bytes currently backlogged
195052539ca8SToke Høiland-Jørgensen  * @backlog_packets: total number of packets currently backlogged
195152539ca8SToke Høiland-Jørgensen  * @flows: number of new flows seen
195252539ca8SToke Høiland-Jørgensen  * @drops: total number of packets dropped
195352539ca8SToke Høiland-Jørgensen  * @ecn_marks: total number of packets marked with ECN CE
195452539ca8SToke Høiland-Jørgensen  * @overlimit: number of drops due to queue space overflow
195552539ca8SToke Høiland-Jørgensen  * @overmemory: number of drops due to memory limit overflow
195652539ca8SToke Høiland-Jørgensen  * @collisions: number of hash collisions
195752539ca8SToke Høiland-Jørgensen  * @tx_bytes: total number of bytes dequeued
195852539ca8SToke Høiland-Jørgensen  * @tx_packets: total number of packets dequeued
195952539ca8SToke Høiland-Jørgensen  * @max_flows: maximum number of flows supported
196052539ca8SToke Høiland-Jørgensen  */
196152539ca8SToke Høiland-Jørgensen struct cfg80211_txq_stats {
196252539ca8SToke Høiland-Jørgensen 	u32 filled;
196352539ca8SToke Høiland-Jørgensen 	u32 backlog_bytes;
196452539ca8SToke Høiland-Jørgensen 	u32 backlog_packets;
196552539ca8SToke Høiland-Jørgensen 	u32 flows;
196652539ca8SToke Høiland-Jørgensen 	u32 drops;
196752539ca8SToke Høiland-Jørgensen 	u32 ecn_marks;
196852539ca8SToke Høiland-Jørgensen 	u32 overlimit;
196952539ca8SToke Høiland-Jørgensen 	u32 overmemory;
197052539ca8SToke Høiland-Jørgensen 	u32 collisions;
197152539ca8SToke Høiland-Jørgensen 	u32 tx_bytes;
197252539ca8SToke Høiland-Jørgensen 	u32 tx_packets;
197352539ca8SToke Høiland-Jørgensen 	u32 max_flows;
197452539ca8SToke Høiland-Jørgensen };
197552539ca8SToke Høiland-Jørgensen 
197652539ca8SToke Høiland-Jørgensen /**
19776de39808SJohannes Berg  * struct cfg80211_tid_stats - per-TID statistics
19786de39808SJohannes Berg  * @filled: bitmap of flags using the bits of &enum nl80211_tid_stats to
19796de39808SJohannes Berg  *	indicate the relevant values in this struct are filled
19806de39808SJohannes Berg  * @rx_msdu: number of received MSDUs
19816de39808SJohannes Berg  * @tx_msdu: number of (attempted) transmitted MSDUs
19826de39808SJohannes Berg  * @tx_msdu_retries: number of retries (not counting the first) for
19836de39808SJohannes Berg  *	transmitted MSDUs
19846de39808SJohannes Berg  * @tx_msdu_failed: number of failed transmitted MSDUs
198552539ca8SToke Høiland-Jørgensen  * @txq_stats: TXQ statistics
19866de39808SJohannes Berg  */
19876de39808SJohannes Berg struct cfg80211_tid_stats {
19886de39808SJohannes Berg 	u32 filled;
19896de39808SJohannes Berg 	u64 rx_msdu;
19906de39808SJohannes Berg 	u64 tx_msdu;
19916de39808SJohannes Berg 	u64 tx_msdu_retries;
19926de39808SJohannes Berg 	u64 tx_msdu_failed;
199352539ca8SToke Høiland-Jørgensen 	struct cfg80211_txq_stats txq_stats;
19946de39808SJohannes Berg };
19956de39808SJohannes Berg 
1996119363c7SFelix Fietkau #define IEEE80211_MAX_CHAINS	4
1997119363c7SFelix Fietkau 
1998f4263c98SPaul Stewart /**
19992ec600d6SLuis Carlos Cobo  * struct station_info - station information
2000fd5b74dcSJohannes Berg  *
20012ec600d6SLuis Carlos Cobo  * Station information filled by driver for get_station() and dump_station.
2002fd5b74dcSJohannes Berg  *
2003319090bfSJohannes Berg  * @filled: bitflag of flags using the bits of &enum nl80211_sta_info to
2004319090bfSJohannes Berg  *	indicate the relevant values in this struct for them
2005ebe27c91SMohammed Shafi Shajakhan  * @connected_time: time(in secs) since a station is last connected
2006fd5b74dcSJohannes Berg  * @inactive_time: time since last station activity (tx/rx) in milliseconds
20076c7a0033SBen Greear  * @assoc_at: bootime (ns) of the last association
20088d791361SJohannes Berg  * @rx_bytes: bytes (size of MPDUs) received from this station
20098d791361SJohannes Berg  * @tx_bytes: bytes (size of MPDUs) transmitted to this station
20102ec600d6SLuis Carlos Cobo  * @llid: mesh local link id
20112ec600d6SLuis Carlos Cobo  * @plid: mesh peer link id
20122ec600d6SLuis Carlos Cobo  * @plink_state: mesh peer link state
201373c3df3bSJohannes Berg  * @signal: The signal strength, type depends on the wiphy's signal_type.
201473c3df3bSJohannes Berg  *	For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
201573c3df3bSJohannes Berg  * @signal_avg: Average signal strength, type depends on the wiphy's signal_type.
201673c3df3bSJohannes Berg  *	For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
2017119363c7SFelix Fietkau  * @chains: bitmask for filled values in @chain_signal, @chain_signal_avg
2018119363c7SFelix Fietkau  * @chain_signal: per-chain signal strength of last received packet in dBm
2019119363c7SFelix Fietkau  * @chain_signal_avg: per-chain signal strength average in dBm
2020858022aaSRandy Dunlap  * @txrate: current unicast bitrate from this station
2021858022aaSRandy Dunlap  * @rxrate: current unicast bitrate to this station
20228d791361SJohannes Berg  * @rx_packets: packets (MSDUs & MMPDUs) received from this station
20238d791361SJohannes Berg  * @tx_packets: packets (MSDUs & MMPDUs) transmitted to this station
20248d791361SJohannes Berg  * @tx_retries: cumulative retry counts (MPDUs)
20258d791361SJohannes Berg  * @tx_failed: number of failed transmissions (MPDUs) (retries exceeded, no ACK)
20265a5c731aSBen Greear  * @rx_dropped_misc:  Dropped for un-specified reason.
20271ba01458SRandy Dunlap  * @bss_param: current BSS parameters
2028f5ea9120SJohannes Berg  * @generation: generation number for nl80211 dumps.
2029f5ea9120SJohannes Berg  *	This number should increase every time the list of stations
2030f5ea9120SJohannes Berg  *	changes, i.e. when a station is added or removed, so that
2031f5ea9120SJohannes Berg  *	userspace can tell whether it got a consistent snapshot.
203250d3dfb7SJouni Malinen  * @assoc_req_ies: IEs from (Re)Association Request.
203350d3dfb7SJouni Malinen  *	This is used only when in AP mode with drivers that do not use
203450d3dfb7SJouni Malinen  *	user space MLME/SME implementation. The information is provided for
203550d3dfb7SJouni Malinen  *	the cfg80211_new_sta() calls to notify user space of the IEs.
203650d3dfb7SJouni Malinen  * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets.
2037c26887d2SJohannes Berg  * @sta_flags: station flags mask & values
2038a85e1d55SPaul Stewart  * @beacon_loss_count: Number of times beacon loss event has triggered.
2039d299a1f2SJavier Cardona  * @t_offset: Time offset of the station relative to this host.
20403b1c5a53SMarco Porsch  * @local_pm: local mesh STA power save mode
20413b1c5a53SMarco Porsch  * @peer_pm: peer mesh STA power save mode
20423b1c5a53SMarco Porsch  * @nonpeer_pm: non-peer mesh STA power save mode
2043867d849fSAntonio Quartulli  * @expected_throughput: expected throughput in kbps (including 802.11 headers)
2044867d849fSAntonio Quartulli  *	towards this station.
2045a76b1942SJohannes Berg  * @rx_beacon: number of beacons received from this peer
2046a76b1942SJohannes Berg  * @rx_beacon_signal_avg: signal strength average (in dBm) for beacons received
2047a76b1942SJohannes Berg  *	from this peer
2048dbdaee7aSBob Copeland  * @connected_to_gate: true if mesh STA has a path to mesh gate
2049739960f1SMohammed Shafi Shajakhan  * @rx_duration: aggregate PPDU duration(usecs) for all the frames from a peer
205036647055SToke Høiland-Jørgensen  * @tx_duration: aggregate PPDU duration(usecs) for all the frames to a peer
205136647055SToke Høiland-Jørgensen  * @airtime_weight: current airtime scheduling weight
20526de39808SJohannes Berg  * @pertid: per-TID statistics, see &struct cfg80211_tid_stats, using the last
20536de39808SJohannes Berg  *	(IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs.
20548689c051SArend van Spriel  *	Note that this doesn't use the @filled bit, but is used if non-NULL.
2055c4b50cd3SVenkateswara Naralasetty  * @ack_signal: signal strength (in dBm) of the last ACK frame.
205681d5439dSBalaji Pothunoori  * @avg_ack_signal: average rssi value of ack packet for the no of msdu's has
205781d5439dSBalaji Pothunoori  *	been sent.
20580d4e14a3SAnkita Bajaj  * @rx_mpdu_count: number of MPDUs received from this station
20590d4e14a3SAnkita Bajaj  * @fcs_err_count: number of packets (MPDUs) received from this station with
20600d4e14a3SAnkita Bajaj  *	an FCS error. This counter should be incremented only when TA of the
20610d4e14a3SAnkita Bajaj  *	received packet with an FCS error matches the peer MAC address.
2062ab60633cSNarayanraddi Masti  * @airtime_link_metric: mesh airtime link metric.
20631303a51cSMarkus Theil  * @connected_to_as: true if mesh STA has a path to authentication server
2064a42e59ebSVeerendranath Jakkam  * @mlo_params_valid: Indicates @assoc_link_id and @mld_addr fields are filled
2065a42e59ebSVeerendranath Jakkam  *	by driver. Drivers use this only in cfg80211_new_sta() calls when AP
2066a42e59ebSVeerendranath Jakkam  *	MLD's MLME/SME is offload to driver. Drivers won't fill this
2067a42e59ebSVeerendranath Jakkam  *	information in cfg80211_del_sta_sinfo(), get_station() and
2068a42e59ebSVeerendranath Jakkam  *	dump_station() callbacks.
2069a42e59ebSVeerendranath Jakkam  * @assoc_link_id: Indicates MLO link ID of the AP, with which the station
2070a42e59ebSVeerendranath Jakkam  *	completed (re)association. This information filled for both MLO
2071a42e59ebSVeerendranath Jakkam  *	and non-MLO STA connections when the AP affiliated with an MLD.
2072a42e59ebSVeerendranath Jakkam  * @mld_addr: For MLO STA connection, filled with MLD address of the station.
2073a42e59ebSVeerendranath Jakkam  *	For non-MLO STA connection, filled with all zeros.
2074a42e59ebSVeerendranath Jakkam  * @assoc_resp_ies: IEs from (Re)Association Response.
2075a42e59ebSVeerendranath Jakkam  *	This is used only when in AP mode with drivers that do not use user
2076a42e59ebSVeerendranath Jakkam  *	space MLME/SME implementation. The information is provided only for the
2077a42e59ebSVeerendranath Jakkam  *	cfg80211_new_sta() calls to notify user space of the IEs. Drivers won't
2078a42e59ebSVeerendranath Jakkam  *	fill this information in cfg80211_del_sta_sinfo(), get_station() and
2079a42e59ebSVeerendranath Jakkam  *	dump_station() callbacks. User space needs this information to determine
2080a42e59ebSVeerendranath Jakkam  *	the accepted and rejected affiliated links of the connected station.
2081a42e59ebSVeerendranath Jakkam  * @assoc_resp_ies_len: Length of @assoc_resp_ies buffer in octets.
2082fd5b74dcSJohannes Berg  */
20832ec600d6SLuis Carlos Cobo struct station_info {
2084739960f1SMohammed Shafi Shajakhan 	u64 filled;
2085ebe27c91SMohammed Shafi Shajakhan 	u32 connected_time;
2086fd5b74dcSJohannes Berg 	u32 inactive_time;
20876c7a0033SBen Greear 	u64 assoc_at;
208842745e03SVladimir Kondratiev 	u64 rx_bytes;
208942745e03SVladimir Kondratiev 	u64 tx_bytes;
20902ec600d6SLuis Carlos Cobo 	u16 llid;
20912ec600d6SLuis Carlos Cobo 	u16 plid;
20922ec600d6SLuis Carlos Cobo 	u8 plink_state;
2093420e7fabSHenning Rogge 	s8 signal;
2094541a45a1SBruno Randolf 	s8 signal_avg;
2095119363c7SFelix Fietkau 
2096119363c7SFelix Fietkau 	u8 chains;
2097119363c7SFelix Fietkau 	s8 chain_signal[IEEE80211_MAX_CHAINS];
2098119363c7SFelix Fietkau 	s8 chain_signal_avg[IEEE80211_MAX_CHAINS];
2099119363c7SFelix Fietkau 
2100420e7fabSHenning Rogge 	struct rate_info txrate;
2101c8dcfd8aSFelix Fietkau 	struct rate_info rxrate;
210298c8a60aSJouni Malinen 	u32 rx_packets;
210398c8a60aSJouni Malinen 	u32 tx_packets;
2104b206b4efSBruno Randolf 	u32 tx_retries;
2105b206b4efSBruno Randolf 	u32 tx_failed;
21065a5c731aSBen Greear 	u32 rx_dropped_misc;
2107f4263c98SPaul Stewart 	struct sta_bss_parameters bss_param;
2108bb6e753eSHelmut Schaa 	struct nl80211_sta_flag_update sta_flags;
2109f5ea9120SJohannes Berg 
2110f5ea9120SJohannes Berg 	int generation;
211150d3dfb7SJouni Malinen 
211250d3dfb7SJouni Malinen 	const u8 *assoc_req_ies;
211350d3dfb7SJouni Malinen 	size_t assoc_req_ies_len;
2114f612cedfSJouni Malinen 
2115a85e1d55SPaul Stewart 	u32 beacon_loss_count;
2116d299a1f2SJavier Cardona 	s64 t_offset;
21173b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode local_pm;
21183b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode peer_pm;
21193b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode nonpeer_pm;
2120a85e1d55SPaul Stewart 
2121867d849fSAntonio Quartulli 	u32 expected_throughput;
2122a76b1942SJohannes Berg 
212336647055SToke Høiland-Jørgensen 	u64 tx_duration;
2124739960f1SMohammed Shafi Shajakhan 	u64 rx_duration;
212536647055SToke Høiland-Jørgensen 	u64 rx_beacon;
2126a76b1942SJohannes Berg 	u8 rx_beacon_signal_avg;
2127dbdaee7aSBob Copeland 	u8 connected_to_gate;
2128dbdaee7aSBob Copeland 
21298689c051SArend van Spriel 	struct cfg80211_tid_stats *pertid;
2130c4b50cd3SVenkateswara Naralasetty 	s8 ack_signal;
213181d5439dSBalaji Pothunoori 	s8 avg_ack_signal;
21320d4e14a3SAnkita Bajaj 
213336647055SToke Høiland-Jørgensen 	u16 airtime_weight;
213436647055SToke Høiland-Jørgensen 
21350d4e14a3SAnkita Bajaj 	u32 rx_mpdu_count;
21360d4e14a3SAnkita Bajaj 	u32 fcs_err_count;
2137ab60633cSNarayanraddi Masti 
2138ab60633cSNarayanraddi Masti 	u32 airtime_link_metric;
21391303a51cSMarkus Theil 
21401303a51cSMarkus Theil 	u8 connected_to_as;
2141a42e59ebSVeerendranath Jakkam 
2142a42e59ebSVeerendranath Jakkam 	bool mlo_params_valid;
2143a42e59ebSVeerendranath Jakkam 	u8 assoc_link_id;
2144a42e59ebSVeerendranath Jakkam 	u8 mld_addr[ETH_ALEN] __aligned(2);
2145a42e59ebSVeerendranath Jakkam 	const u8 *assoc_resp_ies;
2146a42e59ebSVeerendranath Jakkam 	size_t assoc_resp_ies_len;
2147fd5b74dcSJohannes Berg };
2148fd5b74dcSJohannes Berg 
21496bdb68ceSCarl Huang /**
21506bdb68ceSCarl Huang  * struct cfg80211_sar_sub_specs - sub specs limit
21516bdb68ceSCarl Huang  * @power: power limitation in 0.25dbm
21526bdb68ceSCarl Huang  * @freq_range_index: index the power limitation applies to
21536bdb68ceSCarl Huang  */
21546bdb68ceSCarl Huang struct cfg80211_sar_sub_specs {
21556bdb68ceSCarl Huang 	s32 power;
21566bdb68ceSCarl Huang 	u32 freq_range_index;
21576bdb68ceSCarl Huang };
21586bdb68ceSCarl Huang 
21596bdb68ceSCarl Huang /**
21606bdb68ceSCarl Huang  * struct cfg80211_sar_specs - sar limit specs
21616bdb68ceSCarl Huang  * @type: it's set with power in 0.25dbm or other types
21626bdb68ceSCarl Huang  * @num_sub_specs: number of sar sub specs
21636bdb68ceSCarl Huang  * @sub_specs: memory to hold the sar sub specs
21646bdb68ceSCarl Huang  */
21656bdb68ceSCarl Huang struct cfg80211_sar_specs {
21666bdb68ceSCarl Huang 	enum nl80211_sar_type type;
21676bdb68ceSCarl Huang 	u32 num_sub_specs;
21686bdb68ceSCarl Huang 	struct cfg80211_sar_sub_specs sub_specs[];
21696bdb68ceSCarl Huang };
21706bdb68ceSCarl Huang 
21716bdb68ceSCarl Huang 
21726bdb68ceSCarl Huang /**
2173c2083e28SMauro Carvalho Chehab  * struct cfg80211_sar_freq_ranges - sar frequency ranges
21746bdb68ceSCarl Huang  * @start_freq:  start range edge frequency
21756bdb68ceSCarl Huang  * @end_freq:    end range edge frequency
21766bdb68ceSCarl Huang  */
21776bdb68ceSCarl Huang struct cfg80211_sar_freq_ranges {
21786bdb68ceSCarl Huang 	u32 start_freq;
21796bdb68ceSCarl Huang 	u32 end_freq;
21806bdb68ceSCarl Huang };
21816bdb68ceSCarl Huang 
21826bdb68ceSCarl Huang /**
21836bdb68ceSCarl Huang  * struct cfg80211_sar_capa - sar limit capability
21846bdb68ceSCarl Huang  * @type: it's set via power in 0.25dbm or other types
21856bdb68ceSCarl Huang  * @num_freq_ranges: number of frequency ranges
21866bdb68ceSCarl Huang  * @freq_ranges: memory to hold the freq ranges.
21876bdb68ceSCarl Huang  *
21886bdb68ceSCarl Huang  * Note: WLAN driver may append new ranges or split an existing
21896bdb68ceSCarl Huang  * range to small ones and then append them.
21906bdb68ceSCarl Huang  */
21916bdb68ceSCarl Huang struct cfg80211_sar_capa {
21926bdb68ceSCarl Huang 	enum nl80211_sar_type type;
21936bdb68ceSCarl Huang 	u32 num_freq_ranges;
21946bdb68ceSCarl Huang 	const struct cfg80211_sar_freq_ranges *freq_ranges;
21956bdb68ceSCarl Huang };
21966bdb68ceSCarl Huang 
219761aaa0e8SLinus Lüssing #if IS_ENABLED(CONFIG_CFG80211)
219866f7ac50SMichael Wu /**
21997406353dSAntonio Quartulli  * cfg80211_get_station - retrieve information about a given station
22007406353dSAntonio Quartulli  * @dev: the device where the station is supposed to be connected to
22017406353dSAntonio Quartulli  * @mac_addr: the mac address of the station of interest
22027406353dSAntonio Quartulli  * @sinfo: pointer to the structure to fill with the information
22037406353dSAntonio Quartulli  *
22047406353dSAntonio Quartulli  * Returns 0 on success and sinfo is filled with the available information
22057406353dSAntonio Quartulli  * otherwise returns a negative error code and the content of sinfo has to be
22067406353dSAntonio Quartulli  * considered undefined.
22077406353dSAntonio Quartulli  */
22087406353dSAntonio Quartulli int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr,
22097406353dSAntonio Quartulli 			 struct station_info *sinfo);
221061aaa0e8SLinus Lüssing #else
221161aaa0e8SLinus Lüssing static inline int cfg80211_get_station(struct net_device *dev,
221261aaa0e8SLinus Lüssing 				       const u8 *mac_addr,
221361aaa0e8SLinus Lüssing 				       struct station_info *sinfo)
221461aaa0e8SLinus Lüssing {
221561aaa0e8SLinus Lüssing 	return -ENOENT;
221661aaa0e8SLinus Lüssing }
221761aaa0e8SLinus Lüssing #endif
22187406353dSAntonio Quartulli 
22197406353dSAntonio Quartulli /**
222066f7ac50SMichael Wu  * enum monitor_flags - monitor flags
222166f7ac50SMichael Wu  *
222266f7ac50SMichael Wu  * Monitor interface configuration flags. Note that these must be the bits
222366f7ac50SMichael Wu  * according to the nl80211 flags.
222466f7ac50SMichael Wu  *
2225818a986eSJohannes Berg  * @MONITOR_FLAG_CHANGED: set if the flags were changed
222666f7ac50SMichael Wu  * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS
222766f7ac50SMichael Wu  * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP
222866f7ac50SMichael Wu  * @MONITOR_FLAG_CONTROL: pass control frames
222966f7ac50SMichael Wu  * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering
223066f7ac50SMichael Wu  * @MONITOR_FLAG_COOK_FRAMES: report frames after processing
2231e057d3c3SFelix Fietkau  * @MONITOR_FLAG_ACTIVE: active monitor, ACKs frames on its MAC address
223266f7ac50SMichael Wu  */
223366f7ac50SMichael Wu enum monitor_flags {
2234818a986eSJohannes Berg 	MONITOR_FLAG_CHANGED		= 1<<__NL80211_MNTR_FLAG_INVALID,
223566f7ac50SMichael Wu 	MONITOR_FLAG_FCSFAIL		= 1<<NL80211_MNTR_FLAG_FCSFAIL,
223666f7ac50SMichael Wu 	MONITOR_FLAG_PLCPFAIL		= 1<<NL80211_MNTR_FLAG_PLCPFAIL,
223766f7ac50SMichael Wu 	MONITOR_FLAG_CONTROL		= 1<<NL80211_MNTR_FLAG_CONTROL,
223866f7ac50SMichael Wu 	MONITOR_FLAG_OTHER_BSS		= 1<<NL80211_MNTR_FLAG_OTHER_BSS,
223966f7ac50SMichael Wu 	MONITOR_FLAG_COOK_FRAMES	= 1<<NL80211_MNTR_FLAG_COOK_FRAMES,
2240e057d3c3SFelix Fietkau 	MONITOR_FLAG_ACTIVE		= 1<<NL80211_MNTR_FLAG_ACTIVE,
224166f7ac50SMichael Wu };
224266f7ac50SMichael Wu 
22432ec600d6SLuis Carlos Cobo /**
22442ec600d6SLuis Carlos Cobo  * enum mpath_info_flags -  mesh path information flags
22452ec600d6SLuis Carlos Cobo  *
22462ec600d6SLuis Carlos Cobo  * Used by the driver to indicate which info in &struct mpath_info it has filled
22472ec600d6SLuis Carlos Cobo  * in during get_station() or dump_station().
22482ec600d6SLuis Carlos Cobo  *
2249abe37c4bSJohannes Berg  * @MPATH_INFO_FRAME_QLEN: @frame_qlen filled
2250abe37c4bSJohannes Berg  * @MPATH_INFO_SN: @sn filled
2251abe37c4bSJohannes Berg  * @MPATH_INFO_METRIC: @metric filled
2252abe37c4bSJohannes Berg  * @MPATH_INFO_EXPTIME: @exptime filled
2253abe37c4bSJohannes Berg  * @MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled
2254abe37c4bSJohannes Berg  * @MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled
2255abe37c4bSJohannes Berg  * @MPATH_INFO_FLAGS: @flags filled
2256cc241636SJulan Hsu  * @MPATH_INFO_HOP_COUNT: @hop_count filled
22579874b71fSJohannes Berg  * @MPATH_INFO_PATH_CHANGE: @path_change_count filled
22582ec600d6SLuis Carlos Cobo  */
22592ec600d6SLuis Carlos Cobo enum mpath_info_flags {
22602ec600d6SLuis Carlos Cobo 	MPATH_INFO_FRAME_QLEN		= BIT(0),
2261d19b3bf6SRui Paulo 	MPATH_INFO_SN			= BIT(1),
22622ec600d6SLuis Carlos Cobo 	MPATH_INFO_METRIC		= BIT(2),
22632ec600d6SLuis Carlos Cobo 	MPATH_INFO_EXPTIME		= BIT(3),
22642ec600d6SLuis Carlos Cobo 	MPATH_INFO_DISCOVERY_TIMEOUT	= BIT(4),
22652ec600d6SLuis Carlos Cobo 	MPATH_INFO_DISCOVERY_RETRIES	= BIT(5),
22662ec600d6SLuis Carlos Cobo 	MPATH_INFO_FLAGS		= BIT(6),
2267540bbcb9SJulan Hsu 	MPATH_INFO_HOP_COUNT		= BIT(7),
2268540bbcb9SJulan Hsu 	MPATH_INFO_PATH_CHANGE		= BIT(8),
22692ec600d6SLuis Carlos Cobo };
22702ec600d6SLuis Carlos Cobo 
22712ec600d6SLuis Carlos Cobo /**
22722ec600d6SLuis Carlos Cobo  * struct mpath_info - mesh path information
22732ec600d6SLuis Carlos Cobo  *
22742ec600d6SLuis Carlos Cobo  * Mesh path information filled by driver for get_mpath() and dump_mpath().
22752ec600d6SLuis Carlos Cobo  *
22762ec600d6SLuis Carlos Cobo  * @filled: bitfield of flags from &enum mpath_info_flags
22772ec600d6SLuis Carlos Cobo  * @frame_qlen: number of queued frames for this destination
2278d19b3bf6SRui Paulo  * @sn: target sequence number
22792ec600d6SLuis Carlos Cobo  * @metric: metric (cost) of this mesh path
22802ec600d6SLuis Carlos Cobo  * @exptime: expiration time for the mesh path from now, in msecs
22811dcf396bSDmitry Antipov  * @flags: mesh path flags from &enum mesh_path_flags
22822ec600d6SLuis Carlos Cobo  * @discovery_timeout: total mesh path discovery timeout, in msecs
22832ec600d6SLuis Carlos Cobo  * @discovery_retries: mesh path discovery retries
2284f5ea9120SJohannes Berg  * @generation: generation number for nl80211 dumps.
2285f5ea9120SJohannes Berg  *	This number should increase every time the list of mesh paths
2286f5ea9120SJohannes Berg  *	changes, i.e. when a station is added or removed, so that
2287f5ea9120SJohannes Berg  *	userspace can tell whether it got a consistent snapshot.
2288cc241636SJulan Hsu  * @hop_count: hops to destination
2289540bbcb9SJulan Hsu  * @path_change_count: total number of path changes to destination
22902ec600d6SLuis Carlos Cobo  */
22912ec600d6SLuis Carlos Cobo struct mpath_info {
22922ec600d6SLuis Carlos Cobo 	u32 filled;
22932ec600d6SLuis Carlos Cobo 	u32 frame_qlen;
2294d19b3bf6SRui Paulo 	u32 sn;
22952ec600d6SLuis Carlos Cobo 	u32 metric;
22962ec600d6SLuis Carlos Cobo 	u32 exptime;
22972ec600d6SLuis Carlos Cobo 	u32 discovery_timeout;
22982ec600d6SLuis Carlos Cobo 	u8 discovery_retries;
22992ec600d6SLuis Carlos Cobo 	u8 flags;
2300cc241636SJulan Hsu 	u8 hop_count;
2301540bbcb9SJulan Hsu 	u32 path_change_count;
2302f5ea9120SJohannes Berg 
2303f5ea9120SJohannes Berg 	int generation;
23042ec600d6SLuis Carlos Cobo };
23052ec600d6SLuis Carlos Cobo 
23069f1ba906SJouni Malinen /**
23079f1ba906SJouni Malinen  * struct bss_parameters - BSS parameters
23089f1ba906SJouni Malinen  *
23099f1ba906SJouni Malinen  * Used to change BSS parameters (mainly for AP mode).
23109f1ba906SJouni Malinen  *
23111e0f8cc9SJohannes Berg  * @link_id: link_id or -1 for non-MLD
23129f1ba906SJouni Malinen  * @use_cts_prot: Whether to use CTS protection
23139f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
23149f1ba906SJouni Malinen  * @use_short_preamble: Whether the use of short preambles is allowed
23159f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
23169f1ba906SJouni Malinen  * @use_short_slot_time: Whether the use of short slot time is allowed
23179f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
231890c97a04SJouni Malinen  * @basic_rates: basic rates in IEEE 802.11 format
231990c97a04SJouni Malinen  *	(or NULL for no change)
232090c97a04SJouni Malinen  * @basic_rates_len: number of basic rates
2321fd8aaaf3SFelix Fietkau  * @ap_isolate: do not forward packets between connected stations
23229d6e371dSWright Feng  *	(0 = no, 1 = yes, -1 = do not change)
232350b12f59SHelmut Schaa  * @ht_opmode: HT Operation mode
232450b12f59SHelmut Schaa  *	(u16 = opmode, -1 = do not change)
232553cabad7SJohannes Berg  * @p2p_ctwindow: P2P CT Window (-1 = no change)
232653cabad7SJohannes Berg  * @p2p_opp_ps: P2P opportunistic PS (-1 = no change)
23279f1ba906SJouni Malinen  */
23289f1ba906SJouni Malinen struct bss_parameters {
23291e0f8cc9SJohannes Berg 	int link_id;
23309f1ba906SJouni Malinen 	int use_cts_prot;
23319f1ba906SJouni Malinen 	int use_short_preamble;
23329f1ba906SJouni Malinen 	int use_short_slot_time;
2333c1e5f471SJohannes Berg 	const u8 *basic_rates;
233490c97a04SJouni Malinen 	u8 basic_rates_len;
2335fd8aaaf3SFelix Fietkau 	int ap_isolate;
233650b12f59SHelmut Schaa 	int ht_opmode;
233753cabad7SJohannes Berg 	s8 p2p_ctwindow, p2p_opp_ps;
23389f1ba906SJouni Malinen };
23392ec600d6SLuis Carlos Cobo 
23403ddd53f3SChun-Yeow Yeoh /**
234129cbe68cSJohannes Berg  * struct mesh_config - 802.11s mesh configuration
234229cbe68cSJohannes Berg  *
234329cbe68cSJohannes Berg  * These parameters can be changed while the mesh is active.
23443ddd53f3SChun-Yeow Yeoh  *
23453ddd53f3SChun-Yeow Yeoh  * @dot11MeshRetryTimeout: the initial retry timeout in millisecond units used
23463ddd53f3SChun-Yeow Yeoh  *	by the Mesh Peering Open message
23473ddd53f3SChun-Yeow Yeoh  * @dot11MeshConfirmTimeout: the initial retry timeout in millisecond units
23483ddd53f3SChun-Yeow Yeoh  *	used by the Mesh Peering Open message
23493ddd53f3SChun-Yeow Yeoh  * @dot11MeshHoldingTimeout: the confirm timeout in millisecond units used by
23503ddd53f3SChun-Yeow Yeoh  *	the mesh peering management to close a mesh peering
23513ddd53f3SChun-Yeow Yeoh  * @dot11MeshMaxPeerLinks: the maximum number of peer links allowed on this
23523ddd53f3SChun-Yeow Yeoh  *	mesh interface
23533ddd53f3SChun-Yeow Yeoh  * @dot11MeshMaxRetries: the maximum number of peer link open retries that can
23543ddd53f3SChun-Yeow Yeoh  *	be sent to establish a new peer link instance in a mesh
23553ddd53f3SChun-Yeow Yeoh  * @dot11MeshTTL: the value of TTL field set at a source mesh STA
23563ddd53f3SChun-Yeow Yeoh  * @element_ttl: the value of TTL field set at a mesh STA for path selection
23573ddd53f3SChun-Yeow Yeoh  *	elements
23583ddd53f3SChun-Yeow Yeoh  * @auto_open_plinks: whether we should automatically open peer links when we
23593ddd53f3SChun-Yeow Yeoh  *	detect compatible mesh peers
23603ddd53f3SChun-Yeow Yeoh  * @dot11MeshNbrOffsetMaxNeighbor: the maximum number of neighbors to
23613ddd53f3SChun-Yeow Yeoh  *	synchronize to for 11s default synchronization method
23623ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPmaxPREQretries: the number of action frames containing a PREQ
23633ddd53f3SChun-Yeow Yeoh  *	that an originator mesh STA can send to a particular path target
23643ddd53f3SChun-Yeow Yeoh  * @path_refresh_time: how frequently to refresh mesh paths in milliseconds
23653ddd53f3SChun-Yeow Yeoh  * @min_discovery_timeout: the minimum length of time to wait until giving up on
23663ddd53f3SChun-Yeow Yeoh  *	a path discovery in milliseconds
23673ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPactivePathTimeout: the time (in TUs) for which mesh STAs
23683ddd53f3SChun-Yeow Yeoh  *	receiving a PREQ shall consider the forwarding information from the
23693ddd53f3SChun-Yeow Yeoh  *	root to be valid. (TU = time unit)
23703ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPpreqMinInterval: the minimum interval of time (in TUs) during
23713ddd53f3SChun-Yeow Yeoh  *	which a mesh STA can send only one action frame containing a PREQ
23723ddd53f3SChun-Yeow Yeoh  *	element
23733ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPperrMinInterval: the minimum interval of time (in TUs) during
23743ddd53f3SChun-Yeow Yeoh  *	which a mesh STA can send only one Action frame containing a PERR
23753ddd53f3SChun-Yeow Yeoh  *	element
23763ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPnetDiameterTraversalTime: the interval of time (in TUs) that
23773ddd53f3SChun-Yeow Yeoh  *	it takes for an HWMP information element to propagate across the mesh
23783ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPRootMode: the configuration of a mesh STA as root mesh STA
23793ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPRannInterval: the interval of time (in TUs) between root
23803ddd53f3SChun-Yeow Yeoh  *	announcements are transmitted
23813ddd53f3SChun-Yeow Yeoh  * @dot11MeshGateAnnouncementProtocol: whether to advertise that this mesh
23823ddd53f3SChun-Yeow Yeoh  *	station has access to a broader network beyond the MBSS. (This is
23833ddd53f3SChun-Yeow Yeoh  *	missnamed in draft 12.0: dot11MeshGateAnnouncementProtocol set to true
23843ddd53f3SChun-Yeow Yeoh  *	only means that the station will announce others it's a mesh gate, but
23853ddd53f3SChun-Yeow Yeoh  *	not necessarily using the gate announcement protocol. Still keeping the
23863ddd53f3SChun-Yeow Yeoh  *	same nomenclature to be in sync with the spec)
23873ddd53f3SChun-Yeow Yeoh  * @dot11MeshForwarding: whether the Mesh STA is forwarding or non-forwarding
23883ddd53f3SChun-Yeow Yeoh  *	entity (default is TRUE - forwarding entity)
23893ddd53f3SChun-Yeow Yeoh  * @rssi_threshold: the threshold for average signal strength of candidate
23903ddd53f3SChun-Yeow Yeoh  *	station to establish a peer link
23913ddd53f3SChun-Yeow Yeoh  * @ht_opmode: mesh HT protection mode
2392ac1073a6SChun-Yeow Yeoh  *
2393ac1073a6SChun-Yeow Yeoh  * @dot11MeshHWMPactivePathToRootTimeout: The time (in TUs) for which mesh STAs
2394ac1073a6SChun-Yeow Yeoh  *	receiving a proactive PREQ shall consider the forwarding information to
2395ac1073a6SChun-Yeow Yeoh  *	the root mesh STA to be valid.
2396ac1073a6SChun-Yeow Yeoh  *
2397ac1073a6SChun-Yeow Yeoh  * @dot11MeshHWMProotInterval: The interval of time (in TUs) between proactive
2398ac1073a6SChun-Yeow Yeoh  *	PREQs are transmitted.
2399728b19e5SChun-Yeow Yeoh  * @dot11MeshHWMPconfirmationInterval: The minimum interval of time (in TUs)
2400728b19e5SChun-Yeow Yeoh  *	during which a mesh STA can send only one Action frame containing
2401728b19e5SChun-Yeow Yeoh  *	a PREQ element for root path confirmation.
24023b1c5a53SMarco Porsch  * @power_mode: The default mesh power save mode which will be the initial
24033b1c5a53SMarco Porsch  *	setting for new peer links.
24043b1c5a53SMarco Porsch  * @dot11MeshAwakeWindowDuration: The duration in TUs the STA will remain awake
24053b1c5a53SMarco Porsch  *	after transmitting its beacon.
24068e7c0538SColleen Twitty  * @plink_timeout: If no tx activity is seen from a STA we've established
24078e7c0538SColleen Twitty  *	peering with for longer than this time (in seconds), then remove it
24088e7c0538SColleen Twitty  *	from the STA's list of peers.  Default is 30 minutes.
24092d8b08feSMauro Carvalho Chehab  * @dot11MeshConnectedToAuthServer: if set to true then this mesh STA
24102d8b08feSMauro Carvalho Chehab  *	will advertise that it is connected to a authentication server
24112d8b08feSMauro Carvalho Chehab  *	in the mesh formation field.
241201d66fbdSBob Copeland  * @dot11MeshConnectedToMeshGate: if set to true, advertise that this STA is
241301d66fbdSBob Copeland  *      connected to a mesh gate in mesh formation info.  If false, the
241401d66fbdSBob Copeland  *      value in mesh formation is determined by the presence of root paths
241501d66fbdSBob Copeland  *      in the mesh path table
2416e3718a61SLinus Lüssing  * @dot11MeshNolearn: Try to avoid multi-hop path discovery (e.g. PREQ/PREP
2417e3718a61SLinus Lüssing  *      for HWMP) if the destination is a direct neighbor. Note that this might
2418e3718a61SLinus Lüssing  *      not be the optimal decision as a multi-hop route might be better. So
2419e3718a61SLinus Lüssing  *      if using this setting you will likely also want to disable
2420e3718a61SLinus Lüssing  *      dot11MeshForwarding and use another mesh routing protocol on top.
242129cbe68cSJohannes Berg  */
242293da9cc1Scolin@cozybit.com struct mesh_config {
242393da9cc1Scolin@cozybit.com 	u16 dot11MeshRetryTimeout;
242493da9cc1Scolin@cozybit.com 	u16 dot11MeshConfirmTimeout;
242593da9cc1Scolin@cozybit.com 	u16 dot11MeshHoldingTimeout;
242693da9cc1Scolin@cozybit.com 	u16 dot11MeshMaxPeerLinks;
242793da9cc1Scolin@cozybit.com 	u8 dot11MeshMaxRetries;
242893da9cc1Scolin@cozybit.com 	u8 dot11MeshTTL;
242945904f21SJavier Cardona 	u8 element_ttl;
243093da9cc1Scolin@cozybit.com 	bool auto_open_plinks;
2431d299a1f2SJavier Cardona 	u32 dot11MeshNbrOffsetMaxNeighbor;
243293da9cc1Scolin@cozybit.com 	u8 dot11MeshHWMPmaxPREQretries;
243393da9cc1Scolin@cozybit.com 	u32 path_refresh_time;
243493da9cc1Scolin@cozybit.com 	u16 min_discovery_timeout;
243593da9cc1Scolin@cozybit.com 	u32 dot11MeshHWMPactivePathTimeout;
243693da9cc1Scolin@cozybit.com 	u16 dot11MeshHWMPpreqMinInterval;
2437dca7e943SThomas Pedersen 	u16 dot11MeshHWMPperrMinInterval;
243893da9cc1Scolin@cozybit.com 	u16 dot11MeshHWMPnetDiameterTraversalTime;
243963c5723bSRui Paulo 	u8 dot11MeshHWMPRootMode;
244001d66fbdSBob Copeland 	bool dot11MeshConnectedToMeshGate;
2441184eebe6SMarkus Theil 	bool dot11MeshConnectedToAuthServer;
24420507e159SJavier Cardona 	u16 dot11MeshHWMPRannInterval;
244316dd7267SJavier Cardona 	bool dot11MeshGateAnnouncementProtocol;
244494f90656SChun-Yeow Yeoh 	bool dot11MeshForwarding;
244555335137SAshok Nagarajan 	s32 rssi_threshold;
244670c33eaaSAshok Nagarajan 	u16 ht_opmode;
2447ac1073a6SChun-Yeow Yeoh 	u32 dot11MeshHWMPactivePathToRootTimeout;
2448ac1073a6SChun-Yeow Yeoh 	u16 dot11MeshHWMProotInterval;
2449728b19e5SChun-Yeow Yeoh 	u16 dot11MeshHWMPconfirmationInterval;
24503b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode power_mode;
24513b1c5a53SMarco Porsch 	u16 dot11MeshAwakeWindowDuration;
24528e7c0538SColleen Twitty 	u32 plink_timeout;
2453e3718a61SLinus Lüssing 	bool dot11MeshNolearn;
245493da9cc1Scolin@cozybit.com };
245593da9cc1Scolin@cozybit.com 
245631888487SJouni Malinen /**
245729cbe68cSJohannes Berg  * struct mesh_setup - 802.11s mesh setup configuration
2458683b6d3bSJohannes Berg  * @chandef: defines the channel to use
245929cbe68cSJohannes Berg  * @mesh_id: the mesh ID
246029cbe68cSJohannes Berg  * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes
2461d299a1f2SJavier Cardona  * @sync_method: which synchronization method to use
2462c80d545dSJavier Cardona  * @path_sel_proto: which path selection protocol to use
2463c80d545dSJavier Cardona  * @path_metric: which metric to use
24646e16d90bSColleen Twitty  * @auth_id: which authentication method this mesh is using
2465581a8b0fSJavier Cardona  * @ie: vendor information elements (optional)
2466581a8b0fSJavier Cardona  * @ie_len: length of vendor information elements
2467b130e5ceSJavier Cardona  * @is_authenticated: this mesh requires authentication
2468b130e5ceSJavier Cardona  * @is_secure: this mesh uses security
2469bb2798d4SThomas Pedersen  * @user_mpm: userspace handles all MPM functions
24709bdbf04dSMarco Porsch  * @dtim_period: DTIM period to use
24719bdbf04dSMarco Porsch  * @beacon_interval: beacon interval to use
247298e0c7f8SRandy Dunlap  * @mcast_rate: multicast rate for Mesh Node [6Mbps is the default for 802.11a]
2473ffb3cf30SAshok Nagarajan  * @basic_rates: basic rates to use when creating the mesh
24748564e382SJohannes Berg  * @beacon_rate: bitrate to be used for beacons
2475d37d49c2SBenjamin Berg  * @userspace_handles_dfs: whether user space controls DFS operation, i.e.
2476d37d49c2SBenjamin Berg  *	changes the channel when a radar is detected. This is required
2477d37d49c2SBenjamin Berg  *	to operate on DFS channels.
24781224f583SDenis Kenzior  * @control_port_over_nl80211: TRUE if userspace expects to exchange control
24791224f583SDenis Kenzior  *	port frames over NL80211 instead of the network interface.
248029cbe68cSJohannes Berg  *
248129cbe68cSJohannes Berg  * These parameters are fixed when the mesh is created.
248229cbe68cSJohannes Berg  */
248329cbe68cSJohannes Berg struct mesh_setup {
2484683b6d3bSJohannes Berg 	struct cfg80211_chan_def chandef;
248529cbe68cSJohannes Berg 	const u8 *mesh_id;
248629cbe68cSJohannes Berg 	u8 mesh_id_len;
2487d299a1f2SJavier Cardona 	u8 sync_method;
2488c80d545dSJavier Cardona 	u8 path_sel_proto;
2489c80d545dSJavier Cardona 	u8 path_metric;
24906e16d90bSColleen Twitty 	u8 auth_id;
2491581a8b0fSJavier Cardona 	const u8 *ie;
2492581a8b0fSJavier Cardona 	u8 ie_len;
2493b130e5ceSJavier Cardona 	bool is_authenticated;
249415d5dda6SJavier Cardona 	bool is_secure;
2495bb2798d4SThomas Pedersen 	bool user_mpm;
24969bdbf04dSMarco Porsch 	u8 dtim_period;
24979bdbf04dSMarco Porsch 	u16 beacon_interval;
249857fbcce3SJohannes Berg 	int mcast_rate[NUM_NL80211_BANDS];
2499ffb3cf30SAshok Nagarajan 	u32 basic_rates;
25008564e382SJohannes Berg 	struct cfg80211_bitrate_mask beacon_rate;
2501d37d49c2SBenjamin Berg 	bool userspace_handles_dfs;
25021224f583SDenis Kenzior 	bool control_port_over_nl80211;
250329cbe68cSJohannes Berg };
250429cbe68cSJohannes Berg 
250529cbe68cSJohannes Berg /**
25066e0bd6c3SRostislav Lisovy  * struct ocb_setup - 802.11p OCB mode setup configuration
25076e0bd6c3SRostislav Lisovy  * @chandef: defines the channel to use
25086e0bd6c3SRostislav Lisovy  *
25096e0bd6c3SRostislav Lisovy  * These parameters are fixed when connecting to the network
25106e0bd6c3SRostislav Lisovy  */
25116e0bd6c3SRostislav Lisovy struct ocb_setup {
25126e0bd6c3SRostislav Lisovy 	struct cfg80211_chan_def chandef;
25136e0bd6c3SRostislav Lisovy };
25146e0bd6c3SRostislav Lisovy 
25156e0bd6c3SRostislav Lisovy /**
251631888487SJouni Malinen  * struct ieee80211_txq_params - TX queue parameters
2517a3304b0aSJohannes Berg  * @ac: AC identifier
251831888487SJouni Malinen  * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled
251931888487SJouni Malinen  * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range
252031888487SJouni Malinen  *	1..32767]
252131888487SJouni Malinen  * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range
252231888487SJouni Malinen  *	1..32767]
252331888487SJouni Malinen  * @aifs: Arbitration interframe space [0..255]
25249d2bb84dSShaul Triebitz  * @link_id: link_id or -1 for non-MLD
252531888487SJouni Malinen  */
252631888487SJouni Malinen struct ieee80211_txq_params {
2527a3304b0aSJohannes Berg 	enum nl80211_ac ac;
252831888487SJouni Malinen 	u16 txop;
252931888487SJouni Malinen 	u16 cwmin;
253031888487SJouni Malinen 	u16 cwmax;
253131888487SJouni Malinen 	u8 aifs;
25329d2bb84dSShaul Triebitz 	int link_id;
253331888487SJouni Malinen };
253431888487SJouni Malinen 
2535d70e9693SJohannes Berg /**
2536d70e9693SJohannes Berg  * DOC: Scanning and BSS list handling
2537d70e9693SJohannes Berg  *
2538d70e9693SJohannes Berg  * The scanning process itself is fairly simple, but cfg80211 offers quite
2539d70e9693SJohannes Berg  * a bit of helper functionality. To start a scan, the scan operation will
2540d70e9693SJohannes Berg  * be invoked with a scan definition. This scan definition contains the
2541d70e9693SJohannes Berg  * channels to scan, and the SSIDs to send probe requests for (including the
2542d70e9693SJohannes Berg  * wildcard, if desired). A passive scan is indicated by having no SSIDs to
2543d70e9693SJohannes Berg  * probe. Additionally, a scan request may contain extra information elements
2544d70e9693SJohannes Berg  * that should be added to the probe request. The IEs are guaranteed to be
2545d70e9693SJohannes Berg  * well-formed, and will not exceed the maximum length the driver advertised
2546d70e9693SJohannes Berg  * in the wiphy structure.
2547d70e9693SJohannes Berg  *
2548d70e9693SJohannes Berg  * When scanning finds a BSS, cfg80211 needs to be notified of that, because
2549d70e9693SJohannes Berg  * it is responsible for maintaining the BSS list; the driver should not
2550d70e9693SJohannes Berg  * maintain a list itself. For this notification, various functions exist.
2551d70e9693SJohannes Berg  *
2552d70e9693SJohannes Berg  * Since drivers do not maintain a BSS list, there are also a number of
2553d70e9693SJohannes Berg  * functions to search for a BSS and obtain information about it from the
2554d70e9693SJohannes Berg  * BSS structure cfg80211 maintains. The BSS list is also made available
2555d70e9693SJohannes Berg  * to userspace.
2556d70e9693SJohannes Berg  */
255772bdcf34SJouni Malinen 
2558704232c2SJohannes Berg /**
25592a519311SJohannes Berg  * struct cfg80211_ssid - SSID description
25602a519311SJohannes Berg  * @ssid: the SSID
25612a519311SJohannes Berg  * @ssid_len: length of the ssid
25622a519311SJohannes Berg  */
25632a519311SJohannes Berg struct cfg80211_ssid {
25642a519311SJohannes Berg 	u8 ssid[IEEE80211_MAX_SSID_LEN];
25652a519311SJohannes Berg 	u8 ssid_len;
25662a519311SJohannes Berg };
25672a519311SJohannes Berg 
25682a519311SJohannes Berg /**
25691d76250bSAvraham Stern  * struct cfg80211_scan_info - information about completed scan
25701d76250bSAvraham Stern  * @scan_start_tsf: scan start time in terms of the TSF of the BSS that the
25711d76250bSAvraham Stern  *	wireless device that requested the scan is connected to. If this
25721d76250bSAvraham Stern  *	information is not available, this field is left zero.
25731d76250bSAvraham Stern  * @tsf_bssid: the BSSID according to which %scan_start_tsf is set.
25741d76250bSAvraham Stern  * @aborted: set to true if the scan was aborted for any reason,
25751d76250bSAvraham Stern  *	userspace will be notified of that
25761d76250bSAvraham Stern  */
25771d76250bSAvraham Stern struct cfg80211_scan_info {
25781d76250bSAvraham Stern 	u64 scan_start_tsf;
25791d76250bSAvraham Stern 	u8 tsf_bssid[ETH_ALEN] __aligned(2);
25801d76250bSAvraham Stern 	bool aborted;
25811d76250bSAvraham Stern };
25821d76250bSAvraham Stern 
25831d76250bSAvraham Stern /**
2584c8cb5b85STova Mussai  * struct cfg80211_scan_6ghz_params - relevant for 6 GHz only
2585c8cb5b85STova Mussai  *
25862d8b08feSMauro Carvalho Chehab  * @short_ssid: short ssid to scan for
2587c8cb5b85STova Mussai  * @bssid: bssid to scan for
2588c8cb5b85STova Mussai  * @channel_idx: idx of the channel in the channel array in the scan request
258905b23456SRandy Dunlap  *	 which the above info is relevant to
2590c8cb5b85STova Mussai  * @unsolicited_probe: the AP transmits unsolicited probe response every 20 TU
25912d8b08feSMauro Carvalho Chehab  * @short_ssid_valid: @short_ssid is valid and can be used
2592c8cb5b85STova Mussai  * @psc_no_listen: when set, and the channel is a PSC channel, no need to wait
2593c8cb5b85STova Mussai  *       20 TUs before starting to send probe requests.
25944ef2f53eSIlan Peer  * @psd_20: The AP's 20 MHz PSD value.
2595c8cb5b85STova Mussai  */
2596c8cb5b85STova Mussai struct cfg80211_scan_6ghz_params {
2597c8cb5b85STova Mussai 	u32 short_ssid;
2598c8cb5b85STova Mussai 	u32 channel_idx;
2599c8cb5b85STova Mussai 	u8 bssid[ETH_ALEN];
2600c8cb5b85STova Mussai 	bool unsolicited_probe;
2601c8cb5b85STova Mussai 	bool short_ssid_valid;
2602c8cb5b85STova Mussai 	bool psc_no_listen;
26034ef2f53eSIlan Peer 	s8 psd_20;
2604c8cb5b85STova Mussai };
2605c8cb5b85STova Mussai 
2606c8cb5b85STova Mussai /**
26072a519311SJohannes Berg  * struct cfg80211_scan_request - scan request description
26082a519311SJohannes Berg  *
26092a519311SJohannes Berg  * @ssids: SSIDs to scan for (active scan only)
26102a519311SJohannes Berg  * @n_ssids: number of SSIDs
26112a519311SJohannes Berg  * @channels: channels to scan on.
2612ca3dbc20SHelmut Schaa  * @n_channels: total number of channels to scan
261370692ad2SJouni Malinen  * @ie: optional information element(s) to add into Probe Request or %NULL
261470692ad2SJouni Malinen  * @ie_len: length of ie in octets
26151d76250bSAvraham Stern  * @duration: how long to listen on each channel, in TUs. If
26161d76250bSAvraham Stern  *	%duration_mandatory is not set, this is the maximum dwell time and
26171d76250bSAvraham Stern  *	the actual dwell time may be shorter.
26181d76250bSAvraham Stern  * @duration_mandatory: if set, the scan duration must be as specified by the
26191d76250bSAvraham Stern  *	%duration field.
26201dcf396bSDmitry Antipov  * @flags: control flags from &enum nl80211_scan_flags
262134850ab2SJohannes Berg  * @rates: bitmap of rates to advertise for each band
26222a519311SJohannes Berg  * @wiphy: the wiphy this was for
262315d6030bSSam Leffler  * @scan_start: time (in jiffies) when the scan started
2624fd014284SJohannes Berg  * @wdev: the wireless device to scan for
26251d76250bSAvraham Stern  * @info: (internal) information about completed scan
26265fe231e8SJohannes Berg  * @notified: (internal) scan request was notified as done or aborted
2627e9f935e3SRajkumar Manoharan  * @no_cck: used to send probe requests at non CCK rate in 2GHz band
2628ad2b26abSJohannes Berg  * @mac_addr: MAC address used with randomisation
2629ad2b26abSJohannes Berg  * @mac_addr_mask: MAC address mask used with randomisation, bits that
2630ad2b26abSJohannes Berg  *	are 0 in the mask should be randomised, bits that are 1 should
2631ad2b26abSJohannes Berg  *	be taken from the @mac_addr
2632c8cb5b85STova Mussai  * @scan_6ghz: relevant for split scan request only,
2633c8cb5b85STova Mussai  *	true if this is the second scan request
2634c8cb5b85STova Mussai  * @n_6ghz_params: number of 6 GHz params
2635c8cb5b85STova Mussai  * @scan_6ghz_params: 6 GHz params
2636818965d3SJouni Malinen  * @bssid: BSSID to scan for (most commonly, the wildcard BSSID)
26376285ee30SIlan Peer  * @tsf_report_link_id: for MLO, indicates the link ID of the BSS that should be
26386285ee30SIlan Peer  *      used for TSF reporting. Can be set to -1 to indicate no preference.
26392a519311SJohannes Berg  */
26402a519311SJohannes Berg struct cfg80211_scan_request {
26412a519311SJohannes Berg 	struct cfg80211_ssid *ssids;
26422a519311SJohannes Berg 	int n_ssids;
26432a519311SJohannes Berg 	u32 n_channels;
2644de95a54bSJohannes Berg 	const u8 *ie;
264570692ad2SJouni Malinen 	size_t ie_len;
26461d76250bSAvraham Stern 	u16 duration;
26471d76250bSAvraham Stern 	bool duration_mandatory;
2648ed473771SSam Leffler 	u32 flags;
26492a519311SJohannes Berg 
265057fbcce3SJohannes Berg 	u32 rates[NUM_NL80211_BANDS];
265134850ab2SJohannes Berg 
2652fd014284SJohannes Berg 	struct wireless_dev *wdev;
2653fd014284SJohannes Berg 
2654ad2b26abSJohannes Berg 	u8 mac_addr[ETH_ALEN] __aligned(2);
2655ad2b26abSJohannes Berg 	u8 mac_addr_mask[ETH_ALEN] __aligned(2);
2656818965d3SJouni Malinen 	u8 bssid[ETH_ALEN] __aligned(2);
2657ad2b26abSJohannes Berg 
26582a519311SJohannes Berg 	/* internal */
26592a519311SJohannes Berg 	struct wiphy *wiphy;
266015d6030bSSam Leffler 	unsigned long scan_start;
26611d76250bSAvraham Stern 	struct cfg80211_scan_info info;
26621d76250bSAvraham Stern 	bool notified;
2663e9f935e3SRajkumar Manoharan 	bool no_cck;
2664c8cb5b85STova Mussai 	bool scan_6ghz;
2665c8cb5b85STova Mussai 	u32 n_6ghz_params;
2666c8cb5b85STova Mussai 	struct cfg80211_scan_6ghz_params *scan_6ghz_params;
26676285ee30SIlan Peer 	s8 tsf_report_link_id;
26685ba63533SJohannes Berg 
26695ba63533SJohannes Berg 	/* keep last */
2670e3eac9f3SKees Cook 	struct ieee80211_channel *channels[] __counted_by(n_channels);
26712a519311SJohannes Berg };
26722a519311SJohannes Berg 
2673ad2b26abSJohannes Berg static inline void get_random_mask_addr(u8 *buf, const u8 *addr, const u8 *mask)
2674ad2b26abSJohannes Berg {
2675ad2b26abSJohannes Berg 	int i;
2676ad2b26abSJohannes Berg 
2677ad2b26abSJohannes Berg 	get_random_bytes(buf, ETH_ALEN);
2678ad2b26abSJohannes Berg 	for (i = 0; i < ETH_ALEN; i++) {
2679ad2b26abSJohannes Berg 		buf[i] &= ~mask[i];
2680ad2b26abSJohannes Berg 		buf[i] |= addr[i] & mask[i];
2681ad2b26abSJohannes Berg 	}
2682ad2b26abSJohannes Berg }
2683ad2b26abSJohannes Berg 
26842a519311SJohannes Berg /**
2685a1f1c21cSLuciano Coelho  * struct cfg80211_match_set - sets of attributes to match
2686a1f1c21cSLuciano Coelho  *
26873007e352SArend Van Spriel  * @ssid: SSID to be matched; may be zero-length in case of BSSID match
26883007e352SArend Van Spriel  *	or no match (RSSI only)
26893007e352SArend Van Spriel  * @bssid: BSSID to be matched; may be all-zero BSSID in case of SSID match
26903007e352SArend Van Spriel  *	or no match (RSSI only)
2691ea73cbceSJohannes Berg  * @rssi_thold: don't report scan results below this threshold (in s32 dBm)
26921e1b11b6Svamsi krishna  * @per_band_rssi_thold: Minimum rssi threshold for each band to be applied
2693ec06bdb2SIlan Peer  *	for filtering out scan results received. Drivers advertise this support
26941e1b11b6Svamsi krishna  *	of band specific rssi based filtering through the feature capability
26951e1b11b6Svamsi krishna  *	%NL80211_EXT_FEATURE_SCHED_SCAN_BAND_SPECIFIC_RSSI_THOLD. These band
26961e1b11b6Svamsi krishna  *	specific rssi thresholds take precedence over rssi_thold, if specified.
26971e1b11b6Svamsi krishna  *	If not specified for any band, it will be assigned with rssi_thold of
26981e1b11b6Svamsi krishna  *	corresponding matchset.
2699a1f1c21cSLuciano Coelho  */
2700a1f1c21cSLuciano Coelho struct cfg80211_match_set {
2701a1f1c21cSLuciano Coelho 	struct cfg80211_ssid ssid;
27023007e352SArend Van Spriel 	u8 bssid[ETH_ALEN];
2703ea73cbceSJohannes Berg 	s32 rssi_thold;
27041e1b11b6Svamsi krishna 	s32 per_band_rssi_thold[NUM_NL80211_BANDS];
2705a1f1c21cSLuciano Coelho };
2706a1f1c21cSLuciano Coelho 
2707a1f1c21cSLuciano Coelho /**
27083b06d277SAvraham Stern  * struct cfg80211_sched_scan_plan - scan plan for scheduled scan
27093b06d277SAvraham Stern  *
27103b06d277SAvraham Stern  * @interval: interval between scheduled scan iterations. In seconds.
27113b06d277SAvraham Stern  * @iterations: number of scan iterations in this scan plan. Zero means
27123b06d277SAvraham Stern  *	infinite loop.
27133b06d277SAvraham Stern  *	The last scan plan will always have this parameter set to zero,
27143b06d277SAvraham Stern  *	all other scan plans will have a finite number of iterations.
27153b06d277SAvraham Stern  */
27163b06d277SAvraham Stern struct cfg80211_sched_scan_plan {
27173b06d277SAvraham Stern 	u32 interval;
27183b06d277SAvraham Stern 	u32 iterations;
27193b06d277SAvraham Stern };
27203b06d277SAvraham Stern 
27213b06d277SAvraham Stern /**
2722bf95ecdbSvamsi krishna  * struct cfg80211_bss_select_adjust - BSS selection with RSSI adjustment.
2723bf95ecdbSvamsi krishna  *
2724bf95ecdbSvamsi krishna  * @band: band of BSS which should match for RSSI level adjustment.
2725bf95ecdbSvamsi krishna  * @delta: value of RSSI level adjustment.
2726bf95ecdbSvamsi krishna  */
2727bf95ecdbSvamsi krishna struct cfg80211_bss_select_adjust {
2728bf95ecdbSvamsi krishna 	enum nl80211_band band;
2729bf95ecdbSvamsi krishna 	s8 delta;
2730bf95ecdbSvamsi krishna };
2731bf95ecdbSvamsi krishna 
2732bf95ecdbSvamsi krishna /**
2733807f8a8cSLuciano Coelho  * struct cfg80211_sched_scan_request - scheduled scan request description
2734807f8a8cSLuciano Coelho  *
273596b08fd6SArend Van Spriel  * @reqid: identifies this request.
2736807f8a8cSLuciano Coelho  * @ssids: SSIDs to scan for (passed in the probe_reqs in active scans)
2737807f8a8cSLuciano Coelho  * @n_ssids: number of SSIDs
2738807f8a8cSLuciano Coelho  * @n_channels: total number of channels to scan
2739807f8a8cSLuciano Coelho  * @ie: optional information element(s) to add into Probe Request or %NULL
2740807f8a8cSLuciano Coelho  * @ie_len: length of ie in octets
27411dcf396bSDmitry Antipov  * @flags: control flags from &enum nl80211_scan_flags
2742a1f1c21cSLuciano Coelho  * @match_sets: sets of parameters to be matched for a scan result
2743a1f1c21cSLuciano Coelho  *	entry to be considered valid and to be passed to the host
2744a1f1c21cSLuciano Coelho  *	(others are filtered out).
274598e0c7f8SRandy Dunlap  *	If omitted, all results are passed.
2746a1f1c21cSLuciano Coelho  * @n_match_sets: number of match sets
27476406c919SJohannes Berg  * @report_results: indicates that results were reported for this request
2748807f8a8cSLuciano Coelho  * @wiphy: the wiphy this was for
2749807f8a8cSLuciano Coelho  * @dev: the interface
2750077f897aSJohannes Berg  * @scan_start: start time of the scheduled scan
2751807f8a8cSLuciano Coelho  * @channels: channels to scan
2752ea73cbceSJohannes Berg  * @min_rssi_thold: for drivers only supporting a single threshold, this
2753ea73cbceSJohannes Berg  *	contains the minimum over all matchsets
2754ad2b26abSJohannes Berg  * @mac_addr: MAC address used with randomisation
2755ad2b26abSJohannes Berg  * @mac_addr_mask: MAC address mask used with randomisation, bits that
2756ad2b26abSJohannes Berg  *	are 0 in the mask should be randomised, bits that are 1 should
2757ad2b26abSJohannes Berg  *	be taken from the @mac_addr
27583b06d277SAvraham Stern  * @scan_plans: scan plans to be executed in this scheduled scan. Lowest
27593b06d277SAvraham Stern  *	index must be executed first.
27603b06d277SAvraham Stern  * @n_scan_plans: number of scan plans, at least 1.
276131a60ed1SJukka Rissanen  * @rcu_head: RCU callback used to free the struct
276293a1e86cSJukka Rissanen  * @owner_nlportid: netlink portid of owner (if this should is a request
276393a1e86cSJukka Rissanen  *	owned by a particular socket)
2764ca986ad9SArend Van Spriel  * @nl_owner_dead: netlink owner socket was closed - this request be freed
2765ca986ad9SArend Van Spriel  * @list: for keeping list of requests.
27669c748934SLuciano Coelho  * @delay: delay in seconds to use before starting the first scan
27679c748934SLuciano Coelho  *	cycle.  The driver may ignore this parameter and start
27689c748934SLuciano Coelho  *	immediately (or at any other time), if this feature is not
27699c748934SLuciano Coelho  *	supported.
2770bf95ecdbSvamsi krishna  * @relative_rssi_set: Indicates whether @relative_rssi is set or not.
2771bf95ecdbSvamsi krishna  * @relative_rssi: Relative RSSI threshold in dB to restrict scan result
2772bf95ecdbSvamsi krishna  *	reporting in connected state to cases where a matching BSS is determined
2773bf95ecdbSvamsi krishna  *	to have better or slightly worse RSSI than the current connected BSS.
2774bf95ecdbSvamsi krishna  *	The relative RSSI threshold values are ignored in disconnected state.
2775bf95ecdbSvamsi krishna  * @rssi_adjust: delta dB of RSSI preference to be given to the BSSs that belong
2776bf95ecdbSvamsi krishna  *	to the specified band while deciding whether a better BSS is reported
2777bf95ecdbSvamsi krishna  *	using @relative_rssi. If delta is a negative number, the BSSs that
2778bf95ecdbSvamsi krishna  *	belong to the specified band will be penalized by delta dB in relative
277998e0c7f8SRandy Dunlap  *	comparisons.
2780807f8a8cSLuciano Coelho  */
2781807f8a8cSLuciano Coelho struct cfg80211_sched_scan_request {
278296b08fd6SArend Van Spriel 	u64 reqid;
2783807f8a8cSLuciano Coelho 	struct cfg80211_ssid *ssids;
2784807f8a8cSLuciano Coelho 	int n_ssids;
2785807f8a8cSLuciano Coelho 	u32 n_channels;
2786807f8a8cSLuciano Coelho 	const u8 *ie;
2787807f8a8cSLuciano Coelho 	size_t ie_len;
2788ed473771SSam Leffler 	u32 flags;
2789a1f1c21cSLuciano Coelho 	struct cfg80211_match_set *match_sets;
2790a1f1c21cSLuciano Coelho 	int n_match_sets;
2791ea73cbceSJohannes Berg 	s32 min_rssi_thold;
27929c748934SLuciano Coelho 	u32 delay;
27933b06d277SAvraham Stern 	struct cfg80211_sched_scan_plan *scan_plans;
27943b06d277SAvraham Stern 	int n_scan_plans;
2795807f8a8cSLuciano Coelho 
2796ad2b26abSJohannes Berg 	u8 mac_addr[ETH_ALEN] __aligned(2);
2797ad2b26abSJohannes Berg 	u8 mac_addr_mask[ETH_ALEN] __aligned(2);
2798ad2b26abSJohannes Berg 
2799bf95ecdbSvamsi krishna 	bool relative_rssi_set;
2800bf95ecdbSvamsi krishna 	s8 relative_rssi;
2801bf95ecdbSvamsi krishna 	struct cfg80211_bss_select_adjust rssi_adjust;
2802bf95ecdbSvamsi krishna 
2803807f8a8cSLuciano Coelho 	/* internal */
2804807f8a8cSLuciano Coelho 	struct wiphy *wiphy;
2805807f8a8cSLuciano Coelho 	struct net_device *dev;
280615d6030bSSam Leffler 	unsigned long scan_start;
2807b34939b9SArend Van Spriel 	bool report_results;
280831a60ed1SJukka Rissanen 	struct rcu_head rcu_head;
280993a1e86cSJukka Rissanen 	u32 owner_nlportid;
2810ca986ad9SArend Van Spriel 	bool nl_owner_dead;
2811ca986ad9SArend Van Spriel 	struct list_head list;
2812807f8a8cSLuciano Coelho 
2813807f8a8cSLuciano Coelho 	/* keep last */
2814396fba0aSGustavo A. R. Silva 	struct ieee80211_channel *channels[];
2815807f8a8cSLuciano Coelho };
2816807f8a8cSLuciano Coelho 
2817807f8a8cSLuciano Coelho /**
28182a519311SJohannes Berg  * enum cfg80211_signal_type - signal type
28192a519311SJohannes Berg  *
28202a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available
28212a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm)
28222a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100
28232a519311SJohannes Berg  */
28242a519311SJohannes Berg enum cfg80211_signal_type {
28252a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_NONE,
28262a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_MBM,
28272a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_UNSPEC,
28282a519311SJohannes Berg };
28292a519311SJohannes Berg 
28302a519311SJohannes Berg /**
28316e19bc4bSDmitry Shmidt  * struct cfg80211_inform_bss - BSS inform data
28326e19bc4bSDmitry Shmidt  * @chan: channel the frame was received on
28336e19bc4bSDmitry Shmidt  * @signal: signal strength value, according to the wiphy's
28346e19bc4bSDmitry Shmidt  *	signal type
28356e19bc4bSDmitry Shmidt  * @boottime_ns: timestamp (CLOCK_BOOTTIME) when the information was
28366e19bc4bSDmitry Shmidt  *	received; should match the time when the frame was actually
28376e19bc4bSDmitry Shmidt  *	received by the device (not just by the host, in case it was
28386e19bc4bSDmitry Shmidt  *	buffered on the device) and be accurate to about 10ms.
28396e19bc4bSDmitry Shmidt  *	If the frame isn't buffered, just passing the return value of
28409285ec4cSJason A. Donenfeld  *	ktime_get_boottime_ns() is likely appropriate.
28411d76250bSAvraham Stern  * @parent_tsf: the time at the start of reception of the first octet of the
28421d76250bSAvraham Stern  *	timestamp field of the frame. The time is the TSF of the BSS specified
28431d76250bSAvraham Stern  *	by %parent_bssid.
28441d76250bSAvraham Stern  * @parent_bssid: the BSS according to which %parent_tsf is set. This is set to
28451d76250bSAvraham Stern  *	the BSS that requested the scan in which the beacon/probe was received.
2846983dafaaSSunil Dutt  * @chains: bitmask for filled values in @chain_signal.
2847983dafaaSSunil Dutt  * @chain_signal: per-chain signal strength of last received BSS in dBm.
2848d02a12b8SJohannes Berg  * @restrict_use: restrict usage, if not set, assume @use_for is
2849d02a12b8SJohannes Berg  *	%NL80211_BSS_USE_FOR_NORMAL.
2850d02a12b8SJohannes Berg  * @use_for: bitmap of possible usage for this BSS, see
2851d02a12b8SJohannes Berg  *	&enum nl80211_bss_use_for
2852d02a12b8SJohannes Berg  * @cannot_use_reasons: the reasons (bitmap) for not being able to connect,
2853d02a12b8SJohannes Berg  *	if @restrict_use is set and @use_for is zero (empty); may be 0 for
2854d02a12b8SJohannes Berg  *	unspecified reasons; see &enum nl80211_bss_cannot_use_reasons
28555db25290SBenjamin Berg  * @drv_data: Data to be passed through to @inform_bss
28566e19bc4bSDmitry Shmidt  */
28576e19bc4bSDmitry Shmidt struct cfg80211_inform_bss {
28586e19bc4bSDmitry Shmidt 	struct ieee80211_channel *chan;
28596e19bc4bSDmitry Shmidt 	s32 signal;
28606e19bc4bSDmitry Shmidt 	u64 boottime_ns;
28611d76250bSAvraham Stern 	u64 parent_tsf;
28621d76250bSAvraham Stern 	u8 parent_bssid[ETH_ALEN] __aligned(2);
2863983dafaaSSunil Dutt 	u8 chains;
2864983dafaaSSunil Dutt 	s8 chain_signal[IEEE80211_MAX_CHAINS];
28655db25290SBenjamin Berg 
2866d02a12b8SJohannes Berg 	u8 restrict_use:1, use_for:7;
2867d02a12b8SJohannes Berg 	u8 cannot_use_reasons;
2868d02a12b8SJohannes Berg 
28695db25290SBenjamin Berg 	void *drv_data;
28706e19bc4bSDmitry Shmidt };
28716e19bc4bSDmitry Shmidt 
28726e19bc4bSDmitry Shmidt /**
28732aa4d456SAkira Moroo  * struct cfg80211_bss_ies - BSS entry IE data
28748cef2c9dSJohannes Berg  * @tsf: TSF contained in the frame that carried these IEs
28759caf0364SJohannes Berg  * @rcu_head: internal use, for freeing
28769caf0364SJohannes Berg  * @len: length of the IEs
28770e227084SJohannes Berg  * @from_beacon: these IEs are known to come from a beacon
28789caf0364SJohannes Berg  * @data: IE data
28799caf0364SJohannes Berg  */
28809caf0364SJohannes Berg struct cfg80211_bss_ies {
28818cef2c9dSJohannes Berg 	u64 tsf;
28829caf0364SJohannes Berg 	struct rcu_head rcu_head;
28839caf0364SJohannes Berg 	int len;
28840e227084SJohannes Berg 	bool from_beacon;
28859caf0364SJohannes Berg 	u8 data[];
28869caf0364SJohannes Berg };
28879caf0364SJohannes Berg 
28889caf0364SJohannes Berg /**
28892a519311SJohannes Berg  * struct cfg80211_bss - BSS description
28902a519311SJohannes Berg  *
28912a519311SJohannes Berg  * This structure describes a BSS (which may also be a mesh network)
28922a519311SJohannes Berg  * for use in scan results and similar.
28932a519311SJohannes Berg  *
2894abe37c4bSJohannes Berg  * @channel: channel this BSS is on
28952a519311SJohannes Berg  * @bssid: BSSID of the BSS
28962a519311SJohannes Berg  * @beacon_interval: the beacon interval as from the frame
28972a519311SJohannes Berg  * @capability: the capability field in host byte order
289883c7aa1aSJohannes Berg  * @ies: the information elements (Note that there is no guarantee that these
289983c7aa1aSJohannes Berg  *	are well-formed!); this is a pointer to either the beacon_ies or
290083c7aa1aSJohannes Berg  *	proberesp_ies depending on whether Probe Response frame has been
290183c7aa1aSJohannes Berg  *	received. It is always non-%NULL.
290234a6eddbSJouni Malinen  * @beacon_ies: the information elements from the last Beacon frame
2903776b3580SJohannes Berg  *	(implementation note: if @hidden_beacon_bss is set this struct doesn't
2904776b3580SJohannes Berg  *	own the beacon_ies, but they're just pointers to the ones from the
2905776b3580SJohannes Berg  *	@hidden_beacon_bss struct)
290634a6eddbSJouni Malinen  * @proberesp_ies: the information elements from the last Probe Response frame
2907776b3580SJohannes Berg  * @hidden_beacon_bss: in case this BSS struct represents a probe response from
2908776b3580SJohannes Berg  *	a BSS that hides the SSID in its beacon, this points to the BSS struct
2909776b3580SJohannes Berg  *	that holds the beacon data. @beacon_ies is still valid, of course, and
2910776b3580SJohannes Berg  *	points to the same data as hidden_beacon_bss->beacon_ies in that case.
2911851ae31dSJohannes Berg  * @transmitted_bss: pointer to the transmitted BSS, if this is a
2912851ae31dSJohannes Berg  *	non-transmitted one (multi-BSSID support)
2913851ae31dSJohannes Berg  * @nontrans_list: list of non-transmitted BSS, if this is a transmitted one
2914851ae31dSJohannes Berg  *	(multi-BSSID support)
291577965c97SJohannes Berg  * @signal: signal strength value (type depends on the wiphy's signal_type)
2916983dafaaSSunil Dutt  * @chains: bitmask for filled values in @chain_signal.
2917983dafaaSSunil Dutt  * @chain_signal: per-chain signal strength of last received BSS in dBm.
29180cd01efbSSara Sharon  * @bssid_index: index in the multiple BSS set
29190cd01efbSSara Sharon  * @max_bssid_indicator: max number of members in the BSS set
2920d02a12b8SJohannes Berg  * @use_for: bitmap of possible usage for this BSS, see
2921d02a12b8SJohannes Berg  *	&enum nl80211_bss_use_for
2922d02a12b8SJohannes Berg  * @cannot_use_reasons: the reasons (bitmap) for not being able to connect,
2923d02a12b8SJohannes Berg  *	if @restrict_use is set and @use_for is zero (empty); may be 0 for
2924d02a12b8SJohannes Berg  *	unspecified reasons; see &enum nl80211_bss_cannot_use_reasons
29252a519311SJohannes Berg  * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
29262a519311SJohannes Berg  */
29272a519311SJohannes Berg struct cfg80211_bss {
29282a519311SJohannes Berg 	struct ieee80211_channel *channel;
29292a519311SJohannes Berg 
29309caf0364SJohannes Berg 	const struct cfg80211_bss_ies __rcu *ies;
29319caf0364SJohannes Berg 	const struct cfg80211_bss_ies __rcu *beacon_ies;
29329caf0364SJohannes Berg 	const struct cfg80211_bss_ies __rcu *proberesp_ies;
29339caf0364SJohannes Berg 
2934776b3580SJohannes Berg 	struct cfg80211_bss *hidden_beacon_bss;
29357011ba58SSara Sharon 	struct cfg80211_bss *transmitted_bss;
29367011ba58SSara Sharon 	struct list_head nontrans_list;
29372a519311SJohannes Berg 
29382a519311SJohannes Berg 	s32 signal;
29392a519311SJohannes Berg 
29409caf0364SJohannes Berg 	u16 beacon_interval;
29419caf0364SJohannes Berg 	u16 capability;
29429caf0364SJohannes Berg 
29439caf0364SJohannes Berg 	u8 bssid[ETH_ALEN];
2944983dafaaSSunil Dutt 	u8 chains;
2945983dafaaSSunil Dutt 	s8 chain_signal[IEEE80211_MAX_CHAINS];
29469caf0364SJohannes Berg 
29470cd01efbSSara Sharon 	u8 bssid_index;
29480cd01efbSSara Sharon 	u8 max_bssid_indicator;
29490cd01efbSSara Sharon 
2950d02a12b8SJohannes Berg 	u8 use_for;
2951d02a12b8SJohannes Berg 	u8 cannot_use_reasons;
2952d02a12b8SJohannes Berg 
2953396fba0aSGustavo A. R. Silva 	u8 priv[] __aligned(sizeof(void *));
29542a519311SJohannes Berg };
29552a519311SJohannes Berg 
29562a519311SJohannes Berg /**
295749a68e0dSJohannes Berg  * ieee80211_bss_get_elem - find element with given ID
2958517357c6SJohannes Berg  * @bss: the bss to search
295949a68e0dSJohannes Berg  * @id: the element ID
29609caf0364SJohannes Berg  *
29619caf0364SJohannes Berg  * Note that the return value is an RCU-protected pointer, so
29629caf0364SJohannes Berg  * rcu_read_lock() must be held when calling this function.
29630ae997dcSYacine Belkadi  * Return: %NULL if not found.
2964517357c6SJohannes Berg  */
296549a68e0dSJohannes Berg const struct element *ieee80211_bss_get_elem(struct cfg80211_bss *bss, u8 id);
296649a68e0dSJohannes Berg 
296749a68e0dSJohannes Berg /**
296849a68e0dSJohannes Berg  * ieee80211_bss_get_ie - find IE with given ID
296949a68e0dSJohannes Berg  * @bss: the bss to search
297049a68e0dSJohannes Berg  * @id: the element ID
297149a68e0dSJohannes Berg  *
297249a68e0dSJohannes Berg  * Note that the return value is an RCU-protected pointer, so
297349a68e0dSJohannes Berg  * rcu_read_lock() must be held when calling this function.
297449a68e0dSJohannes Berg  * Return: %NULL if not found.
297549a68e0dSJohannes Berg  */
297649a68e0dSJohannes Berg static inline const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 id)
297749a68e0dSJohannes Berg {
29787e367b06SJohannes Berg 	return (const void *)ieee80211_bss_get_elem(bss, id);
297949a68e0dSJohannes Berg }
2980517357c6SJohannes Berg 
2981517357c6SJohannes Berg 
2982517357c6SJohannes Berg /**
2983636a5d36SJouni Malinen  * struct cfg80211_auth_request - Authentication request data
2984636a5d36SJouni Malinen  *
2985636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
2986636a5d36SJouni Malinen  * authentication.
2987636a5d36SJouni Malinen  *
2988959867faSJohannes Berg  * @bss: The BSS to authenticate with, the callee must obtain a reference
2989959867faSJohannes Berg  *	to it if it needs to keep it.
2990636a5d36SJouni Malinen  * @auth_type: Authentication type (algorithm)
2991636a5d36SJouni Malinen  * @ie: Extra IEs to add to Authentication frame or %NULL
2992636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
2993fffd0934SJohannes Berg  * @key_len: length of WEP key for shared key authentication
2994fffd0934SJohannes Berg  * @key_idx: index of WEP key for shared key authentication
2995fffd0934SJohannes Berg  * @key: WEP key for shared key authentication
299611b6b5a4SJouni Malinen  * @auth_data: Fields and elements in Authentication frames. This contains
299711b6b5a4SJouni Malinen  *	the authentication frame body (non-IE and IE data), excluding the
299811b6b5a4SJouni Malinen  *	Authentication algorithm number, i.e., starting at the Authentication
299911b6b5a4SJouni Malinen  *	transaction sequence number field.
300011b6b5a4SJouni Malinen  * @auth_data_len: Length of auth_data buffer in octets
3001d648c230SJohannes Berg  * @link_id: if >= 0, indicates authentication should be done as an MLD,
3002d648c230SJohannes Berg  *	the interface address is included as the MLD address and the
3003d648c230SJohannes Berg  *	necessary link (with the given link_id) will be created (and
3004d648c230SJohannes Berg  *	given an MLD address) by the driver
3005d648c230SJohannes Berg  * @ap_mld_addr: AP MLD address in case of authentication request with
3006d648c230SJohannes Berg  *	an AP MLD, valid iff @link_id >= 0
3007636a5d36SJouni Malinen  */
3008636a5d36SJouni Malinen struct cfg80211_auth_request {
300919957bb3SJohannes Berg 	struct cfg80211_bss *bss;
3010636a5d36SJouni Malinen 	const u8 *ie;
3011636a5d36SJouni Malinen 	size_t ie_len;
301219957bb3SJohannes Berg 	enum nl80211_auth_type auth_type;
3013fffd0934SJohannes Berg 	const u8 *key;
301423cc6d8cSJohannes Berg 	u8 key_len;
301523cc6d8cSJohannes Berg 	s8 key_idx;
301611b6b5a4SJouni Malinen 	const u8 *auth_data;
301711b6b5a4SJouni Malinen 	size_t auth_data_len;
3018d648c230SJohannes Berg 	s8 link_id;
3019d648c230SJohannes Berg 	const u8 *ap_mld_addr;
3020d648c230SJohannes Berg };
3021d648c230SJohannes Berg 
3022d648c230SJohannes Berg /**
3023d648c230SJohannes Berg  * struct cfg80211_assoc_link - per-link information for MLO association
3024d648c230SJohannes Berg  * @bss: the BSS pointer, see also &struct cfg80211_assoc_request::bss;
3025d648c230SJohannes Berg  *	if this is %NULL for a link, that link is not requested
3026d648c230SJohannes Berg  * @elems: extra elements for the per-STA profile for this link
3027d648c230SJohannes Berg  * @elems_len: length of the elements
30286cf963edSIlan Peer  * @disabled: If set this link should be included during association etc. but it
30296cf963edSIlan Peer  *	should not be used until enabled by the AP MLD.
3030a7b2cc59SBenjamin Berg  * @error: per-link error code, must be <= 0. If there is an error, then the
3031a7b2cc59SBenjamin Berg  *	operation as a whole must fail.
3032d648c230SJohannes Berg  */
3033d648c230SJohannes Berg struct cfg80211_assoc_link {
3034d648c230SJohannes Berg 	struct cfg80211_bss *bss;
3035d648c230SJohannes Berg 	const u8 *elems;
3036d648c230SJohannes Berg 	size_t elems_len;
30376cf963edSIlan Peer 	bool disabled;
3038a7b2cc59SBenjamin Berg 	int error;
3039636a5d36SJouni Malinen };
3040636a5d36SJouni Malinen 
3041636a5d36SJouni Malinen /**
30427e7c8926SBen Greear  * enum cfg80211_assoc_req_flags - Over-ride default behaviour in association.
30437e7c8926SBen Greear  *
30447e7c8926SBen Greear  * @ASSOC_REQ_DISABLE_HT:  Disable HT (802.11n)
3045ee2aca34SJohannes Berg  * @ASSOC_REQ_DISABLE_VHT:  Disable VHT
3046bab5ab7dSAssaf Krauss  * @ASSOC_REQ_USE_RRM: Declare RRM capability in this association
304740cbfa90SSrinivas Dasari  * @CONNECT_REQ_EXTERNAL_AUTH_SUPPORT: User space indicates external
304840cbfa90SSrinivas Dasari  *	authentication capability. Drivers can offload authentication to
304940cbfa90SSrinivas Dasari  *	userspace if this flag is set. Only applicable for cfg80211_connect()
305040cbfa90SSrinivas Dasari  *	request (connect callback).
3051b6db0f89SBen Greear  * @ASSOC_REQ_DISABLE_HE:  Disable HE
305236f84235SMuna Sinada  * @ASSOC_REQ_DISABLE_EHT:  Disable EHT
3053efbabc11SVeerendranath Jakkam  * @CONNECT_REQ_MLO_SUPPORT: Userspace indicates support for handling MLD links.
3054efbabc11SVeerendranath Jakkam  *	Drivers shall disable MLO features for the current association if this
3055efbabc11SVeerendranath Jakkam  *	flag is not set.
30567e7c8926SBen Greear  */
30577e7c8926SBen Greear enum cfg80211_assoc_req_flags {
30587e7c8926SBen Greear 	ASSOC_REQ_DISABLE_HT			= BIT(0),
3059ee2aca34SJohannes Berg 	ASSOC_REQ_DISABLE_VHT			= BIT(1),
3060bab5ab7dSAssaf Krauss 	ASSOC_REQ_USE_RRM			= BIT(2),
306140cbfa90SSrinivas Dasari 	CONNECT_REQ_EXTERNAL_AUTH_SUPPORT	= BIT(3),
3062b6db0f89SBen Greear 	ASSOC_REQ_DISABLE_HE			= BIT(4),
306336f84235SMuna Sinada 	ASSOC_REQ_DISABLE_EHT			= BIT(5),
3064efbabc11SVeerendranath Jakkam 	CONNECT_REQ_MLO_SUPPORT			= BIT(6),
30657e7c8926SBen Greear };
30667e7c8926SBen Greear 
30677e7c8926SBen Greear /**
3068636a5d36SJouni Malinen  * struct cfg80211_assoc_request - (Re)Association request data
3069636a5d36SJouni Malinen  *
3070636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
3071636a5d36SJouni Malinen  * (re)association.
3072959867faSJohannes Berg  * @bss: The BSS to associate with. If the call is successful the driver is
3073959867faSJohannes Berg  *	given a reference that it must give back to cfg80211_send_rx_assoc()
3074959867faSJohannes Berg  *	or to cfg80211_assoc_timeout(). To ensure proper refcounting, new
3075959867faSJohannes Berg  *	association requests while already associating must be rejected.
3076d648c230SJohannes Berg  *	This also applies to the @links.bss parameter, which is used instead
3077d648c230SJohannes Berg  *	of this one (it is %NULL) for MLO associations.
3078636a5d36SJouni Malinen  * @ie: Extra IEs to add to (Re)Association Request frame or %NULL
3079636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
3080dc6382ceSJouni Malinen  * @use_mfp: Use management frame protection (IEEE 802.11w) in this association
3081b23aa676SSamuel Ortiz  * @crypto: crypto settings
308235eb8f7bSJouni Malinen  * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used
308335eb8f7bSJouni Malinen  *	to indicate a request to reassociate within the ESS instead of a request
308435eb8f7bSJouni Malinen  *	do the initial association with the ESS. When included, this is set to
308535eb8f7bSJouni Malinen  *	the BSSID of the current association, i.e., to the value that is
308635eb8f7bSJouni Malinen  *	included in the Current AP address field of the Reassociation Request
308735eb8f7bSJouni Malinen  *	frame.
30887e7c8926SBen Greear  * @flags:  See &enum cfg80211_assoc_req_flags
30897e7c8926SBen Greear  * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask
30907e7c8926SBen Greear  *	will be used in ht_capa.  Un-supported values will be ignored.
30917e7c8926SBen Greear  * @ht_capa_mask:  The bits of ht_capa which are to be used.
3092ee2aca34SJohannes Berg  * @vht_capa: VHT capability override
3093ee2aca34SJohannes Berg  * @vht_capa_mask: VHT capability mask indicating which fields to use
3094348bd456SJouni Malinen  * @fils_kek: FILS KEK for protecting (Re)Association Request/Response frame or
3095348bd456SJouni Malinen  *	%NULL if FILS is not used.
3096348bd456SJouni Malinen  * @fils_kek_len: Length of fils_kek in octets
3097348bd456SJouni Malinen  * @fils_nonces: FILS nonces (part of AAD) for protecting (Re)Association
3098348bd456SJouni Malinen  *	Request/Response frame or %NULL if FILS is not used. This field starts
3099348bd456SJouni Malinen  *	with 16 octets of STA Nonce followed by 16 octets of AP Nonce.
3100d2b7588aSThomas Pedersen  * @s1g_capa: S1G capability override
3101d2b7588aSThomas Pedersen  * @s1g_capa_mask: S1G capability override mask
3102d648c230SJohannes Berg  * @links: per-link information for MLO connections
3103d648c230SJohannes Berg  * @link_id: >= 0 for MLO connections, where links are given, and indicates
3104d648c230SJohannes Berg  *	the link on which the association request should be sent
3105d648c230SJohannes Berg  * @ap_mld_addr: AP MLD address in case of MLO association request,
3106d648c230SJohannes Berg  *	valid iff @link_id >= 0
3107636a5d36SJouni Malinen  */
3108636a5d36SJouni Malinen struct cfg80211_assoc_request {
310919957bb3SJohannes Berg 	struct cfg80211_bss *bss;
31103e5d7649SJohannes Berg 	const u8 *ie, *prev_bssid;
3111636a5d36SJouni Malinen 	size_t ie_len;
3112b23aa676SSamuel Ortiz 	struct cfg80211_crypto_settings crypto;
311319957bb3SJohannes Berg 	bool use_mfp;
31147e7c8926SBen Greear 	u32 flags;
31157e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa;
31167e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa_mask;
3117ee2aca34SJohannes Berg 	struct ieee80211_vht_cap vht_capa, vht_capa_mask;
3118348bd456SJouni Malinen 	const u8 *fils_kek;
3119348bd456SJouni Malinen 	size_t fils_kek_len;
3120348bd456SJouni Malinen 	const u8 *fils_nonces;
3121d2b7588aSThomas Pedersen 	struct ieee80211_s1g_cap s1g_capa, s1g_capa_mask;
3122d648c230SJohannes Berg 	struct cfg80211_assoc_link links[IEEE80211_MLD_MAX_NUM_LINKS];
3123d648c230SJohannes Berg 	const u8 *ap_mld_addr;
3124d648c230SJohannes Berg 	s8 link_id;
3125636a5d36SJouni Malinen };
3126636a5d36SJouni Malinen 
3127636a5d36SJouni Malinen /**
3128636a5d36SJouni Malinen  * struct cfg80211_deauth_request - Deauthentication request data
3129636a5d36SJouni Malinen  *
3130636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
3131636a5d36SJouni Malinen  * deauthentication.
3132636a5d36SJouni Malinen  *
31338f6e0dfcSJohannes Berg  * @bssid: the BSSID or AP MLD address to deauthenticate from
3134636a5d36SJouni Malinen  * @ie: Extra IEs to add to Deauthentication frame or %NULL
3135636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
313619957bb3SJohannes Berg  * @reason_code: The reason code for the deauthentication
3137077f897aSJohannes Berg  * @local_state_change: if set, change local state only and
3138077f897aSJohannes Berg  *	do not set a deauth frame
3139636a5d36SJouni Malinen  */
3140636a5d36SJouni Malinen struct cfg80211_deauth_request {
314195de817bSJohannes Berg 	const u8 *bssid;
3142636a5d36SJouni Malinen 	const u8 *ie;
3143636a5d36SJouni Malinen 	size_t ie_len;
314419957bb3SJohannes Berg 	u16 reason_code;
31456863255bSStanislaw Gruszka 	bool local_state_change;
3146636a5d36SJouni Malinen };
3147636a5d36SJouni Malinen 
3148636a5d36SJouni Malinen /**
3149636a5d36SJouni Malinen  * struct cfg80211_disassoc_request - Disassociation request data
3150636a5d36SJouni Malinen  *
3151636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
315266f00449SMasahiro Yamada  * disassociation.
3153636a5d36SJouni Malinen  *
31548f6e0dfcSJohannes Berg  * @ap_addr: the BSSID or AP MLD address to disassociate from
3155636a5d36SJouni Malinen  * @ie: Extra IEs to add to Disassociation frame or %NULL
3156636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
315719957bb3SJohannes Berg  * @reason_code: The reason code for the disassociation
3158d5cdfacbSJouni Malinen  * @local_state_change: This is a request for a local state only, i.e., no
3159d5cdfacbSJouni Malinen  *	Disassociation frame is to be transmitted.
3160636a5d36SJouni Malinen  */
3161636a5d36SJouni Malinen struct cfg80211_disassoc_request {
31628f6e0dfcSJohannes Berg 	const u8 *ap_addr;
3163636a5d36SJouni Malinen 	const u8 *ie;
3164636a5d36SJouni Malinen 	size_t ie_len;
316519957bb3SJohannes Berg 	u16 reason_code;
3166d5cdfacbSJouni Malinen 	bool local_state_change;
3167636a5d36SJouni Malinen };
3168636a5d36SJouni Malinen 
3169636a5d36SJouni Malinen /**
317004a773adSJohannes Berg  * struct cfg80211_ibss_params - IBSS parameters
317104a773adSJohannes Berg  *
317204a773adSJohannes Berg  * This structure defines the IBSS parameters for the join_ibss()
317304a773adSJohannes Berg  * method.
317404a773adSJohannes Berg  *
317504a773adSJohannes Berg  * @ssid: The SSID, will always be non-null.
317604a773adSJohannes Berg  * @ssid_len: The length of the SSID, will always be non-zero.
317704a773adSJohannes Berg  * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not
317804a773adSJohannes Berg  *	search for IBSSs with a different BSSID.
3179683b6d3bSJohannes Berg  * @chandef: defines the channel to use if no other IBSS to join can be found
318004a773adSJohannes Berg  * @channel_fixed: The channel should be fixed -- do not search for
318104a773adSJohannes Berg  *	IBSSs to join on other channels.
318204a773adSJohannes Berg  * @ie: information element(s) to include in the beacon
318304a773adSJohannes Berg  * @ie_len: length of that
31848e30bc55SJohannes Berg  * @beacon_interval: beacon interval to use
3185fffd0934SJohannes Berg  * @privacy: this is a protected network, keys will be configured
3186fffd0934SJohannes Berg  *	after joining
3187267335d6SAntonio Quartulli  * @control_port: whether user space controls IEEE 802.1X port, i.e.,
3188267335d6SAntonio Quartulli  *	sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
3189267335d6SAntonio Quartulli  *	required to assume that the port is unauthorized until authorized by
3190267335d6SAntonio Quartulli  *	user space. Otherwise, port is marked authorized by default.
3191c3bfe1f6SDenis Kenzior  * @control_port_over_nl80211: TRUE if userspace expects to exchange control
3192c3bfe1f6SDenis Kenzior  *	port frames over NL80211 instead of the network interface.
31935336fa88SSimon Wunderlich  * @userspace_handles_dfs: whether user space controls DFS operation, i.e.
31945336fa88SSimon Wunderlich  *	changes the channel when a radar is detected. This is required
31955336fa88SSimon Wunderlich  *	to operate on DFS channels.
3196fbd2c8dcSTeemu Paasikivi  * @basic_rates: bitmap of basic rates to use when creating the IBSS
3197dd5b4cc7SFelix Fietkau  * @mcast_rate: per-band multicast rate index + 1 (0: disabled)
3198803768f5SSimon Wunderlich  * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask
3199803768f5SSimon Wunderlich  *	will be used in ht_capa.  Un-supported values will be ignored.
3200803768f5SSimon Wunderlich  * @ht_capa_mask:  The bits of ht_capa which are to be used.
32019ae3b172STova Mussai  * @wep_keys: static WEP keys, if not NULL points to an array of
32029ae3b172STova Mussai  *	CFG80211_MAX_WEP_KEYS WEP keys
32039ae3b172STova Mussai  * @wep_tx_key: key index (0..3) of the default TX static WEP key
320404a773adSJohannes Berg  */
320504a773adSJohannes Berg struct cfg80211_ibss_params {
3206c1e5f471SJohannes Berg 	const u8 *ssid;
3207c1e5f471SJohannes Berg 	const u8 *bssid;
3208683b6d3bSJohannes Berg 	struct cfg80211_chan_def chandef;
3209c1e5f471SJohannes Berg 	const u8 *ie;
321004a773adSJohannes Berg 	u8 ssid_len, ie_len;
32118e30bc55SJohannes Berg 	u16 beacon_interval;
3212fbd2c8dcSTeemu Paasikivi 	u32 basic_rates;
321304a773adSJohannes Berg 	bool channel_fixed;
3214fffd0934SJohannes Berg 	bool privacy;
3215267335d6SAntonio Quartulli 	bool control_port;
3216c3bfe1f6SDenis Kenzior 	bool control_port_over_nl80211;
32175336fa88SSimon Wunderlich 	bool userspace_handles_dfs;
321857fbcce3SJohannes Berg 	int mcast_rate[NUM_NL80211_BANDS];
3219803768f5SSimon Wunderlich 	struct ieee80211_ht_cap ht_capa;
3220803768f5SSimon Wunderlich 	struct ieee80211_ht_cap ht_capa_mask;
32219ae3b172STova Mussai 	struct key_params *wep_keys;
32229ae3b172STova Mussai 	int wep_tx_key;
322304a773adSJohannes Berg };
322404a773adSJohannes Berg 
322504a773adSJohannes Berg /**
322638de03d2SArend van Spriel  * struct cfg80211_bss_selection - connection parameters for BSS selection.
322738de03d2SArend van Spriel  *
322838de03d2SArend van Spriel  * @behaviour: requested BSS selection behaviour.
322938de03d2SArend van Spriel  * @param: parameters for requestion behaviour.
323033615978SJonathan Corbet  * @param.band_pref: preferred band for %NL80211_BSS_SELECT_ATTR_BAND_PREF.
323133615978SJonathan Corbet  * @param.adjust: parameters for %NL80211_BSS_SELECT_ATTR_RSSI_ADJUST.
323238de03d2SArend van Spriel  */
323338de03d2SArend van Spriel struct cfg80211_bss_selection {
323438de03d2SArend van Spriel 	enum nl80211_bss_select_attr behaviour;
323538de03d2SArend van Spriel 	union {
323657fbcce3SJohannes Berg 		enum nl80211_band band_pref;
323738de03d2SArend van Spriel 		struct cfg80211_bss_select_adjust adjust;
323838de03d2SArend van Spriel 	} param;
323938de03d2SArend van Spriel };
324038de03d2SArend van Spriel 
324138de03d2SArend van Spriel /**
3242b23aa676SSamuel Ortiz  * struct cfg80211_connect_params - Connection parameters
3243b23aa676SSamuel Ortiz  *
3244b23aa676SSamuel Ortiz  * This structure provides information needed to complete IEEE 802.11
3245b23aa676SSamuel Ortiz  * authentication and association.
3246b23aa676SSamuel Ortiz  *
3247b23aa676SSamuel Ortiz  * @channel: The channel to use or %NULL if not specified (auto-select based
3248b23aa676SSamuel Ortiz  *	on scan results)
32491df4a510SJouni Malinen  * @channel_hint: The channel of the recommended BSS for initial connection or
32501df4a510SJouni Malinen  *	%NULL if not specified
3251b23aa676SSamuel Ortiz  * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan
3252b23aa676SSamuel Ortiz  *	results)
32531df4a510SJouni Malinen  * @bssid_hint: The recommended AP BSSID for initial connection to the BSS or
32541df4a510SJouni Malinen  *	%NULL if not specified. Unlike the @bssid parameter, the driver is
32551df4a510SJouni Malinen  *	allowed to ignore this @bssid_hint if it has knowledge of a better BSS
32561df4a510SJouni Malinen  *	to use.
3257b23aa676SSamuel Ortiz  * @ssid: SSID
3258b23aa676SSamuel Ortiz  * @ssid_len: Length of ssid in octets
3259b23aa676SSamuel Ortiz  * @auth_type: Authentication type (algorithm)
3260abe37c4bSJohannes Berg  * @ie: IEs for association request
3261abe37c4bSJohannes Berg  * @ie_len: Length of assoc_ie in octets
3262b23aa676SSamuel Ortiz  * @privacy: indicates whether privacy-enabled APs should be used
3263cee00a95SJouni Malinen  * @mfp: indicate whether management frame protection is used
3264b23aa676SSamuel Ortiz  * @crypto: crypto settings
3265fffd0934SJohannes Berg  * @key_len: length of WEP key for shared key authentication
3266fffd0934SJohannes Berg  * @key_idx: index of WEP key for shared key authentication
3267fffd0934SJohannes Berg  * @key: WEP key for shared key authentication
32687e7c8926SBen Greear  * @flags:  See &enum cfg80211_assoc_req_flags
32694486ea98SBala Shanmugam  * @bg_scan_period:  Background scan period in seconds
32704486ea98SBala Shanmugam  *	or -1 to indicate that default value is to be used.
32717e7c8926SBen Greear  * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask
32727e7c8926SBen Greear  *	will be used in ht_capa.  Un-supported values will be ignored.
32737e7c8926SBen Greear  * @ht_capa_mask:  The bits of ht_capa which are to be used.
3274ee2aca34SJohannes Berg  * @vht_capa:  VHT Capability overrides
3275ee2aca34SJohannes Berg  * @vht_capa_mask: The bits of vht_capa which are to be used.
327634d50519SLior David  * @pbss: if set, connect to a PCP instead of AP. Valid for DMG
327734d50519SLior David  *	networks.
327838de03d2SArend van Spriel  * @bss_select: criteria to be used for BSS selection.
327935eb8f7bSJouni Malinen  * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used
328035eb8f7bSJouni Malinen  *	to indicate a request to reassociate within the ESS instead of a request
328135eb8f7bSJouni Malinen  *	do the initial association with the ESS. When included, this is set to
328235eb8f7bSJouni Malinen  *	the BSSID of the current association, i.e., to the value that is
328335eb8f7bSJouni Malinen  *	included in the Current AP address field of the Reassociation Request
328435eb8f7bSJouni Malinen  *	frame.
3285a3caf744SVidyullatha Kanchanapally  * @fils_erp_username: EAP re-authentication protocol (ERP) username part of the
3286a3caf744SVidyullatha Kanchanapally  *	NAI or %NULL if not specified. This is used to construct FILS wrapped
3287a3caf744SVidyullatha Kanchanapally  *	data IE.
3288a3caf744SVidyullatha Kanchanapally  * @fils_erp_username_len: Length of @fils_erp_username in octets.
3289a3caf744SVidyullatha Kanchanapally  * @fils_erp_realm: EAP re-authentication protocol (ERP) realm part of NAI or
3290a3caf744SVidyullatha Kanchanapally  *	%NULL if not specified. This specifies the domain name of ER server and
3291a3caf744SVidyullatha Kanchanapally  *	is used to construct FILS wrapped data IE.
3292a3caf744SVidyullatha Kanchanapally  * @fils_erp_realm_len: Length of @fils_erp_realm in octets.
3293a3caf744SVidyullatha Kanchanapally  * @fils_erp_next_seq_num: The next sequence number to use in the FILS ERP
3294a3caf744SVidyullatha Kanchanapally  *	messages. This is also used to construct FILS wrapped data IE.
3295a3caf744SVidyullatha Kanchanapally  * @fils_erp_rrk: ERP re-authentication Root Key (rRK) used to derive additional
3296a3caf744SVidyullatha Kanchanapally  *	keys in FILS or %NULL if not specified.
3297a3caf744SVidyullatha Kanchanapally  * @fils_erp_rrk_len: Length of @fils_erp_rrk in octets.
32983a00df57SAvraham Stern  * @want_1x: indicates user-space supports and wants to use 802.1X driver
32993a00df57SAvraham Stern  *	offload of 4-way handshake.
33002a38075cSAlexei Avshalom Lazar  * @edmg: define the EDMG channels.
33012a38075cSAlexei Avshalom Lazar  *	This may specify multiple channels and bonding options for the driver
33022a38075cSAlexei Avshalom Lazar  *	to choose from, based on BSS configuration.
3303b23aa676SSamuel Ortiz  */
3304b23aa676SSamuel Ortiz struct cfg80211_connect_params {
3305b23aa676SSamuel Ortiz 	struct ieee80211_channel *channel;
33061df4a510SJouni Malinen 	struct ieee80211_channel *channel_hint;
3307664834deSJouni Malinen 	const u8 *bssid;
33081df4a510SJouni Malinen 	const u8 *bssid_hint;
3309664834deSJouni Malinen 	const u8 *ssid;
3310b23aa676SSamuel Ortiz 	size_t ssid_len;
3311b23aa676SSamuel Ortiz 	enum nl80211_auth_type auth_type;
33124b5800feSJohannes Berg 	const u8 *ie;
3313b23aa676SSamuel Ortiz 	size_t ie_len;
3314b23aa676SSamuel Ortiz 	bool privacy;
3315cee00a95SJouni Malinen 	enum nl80211_mfp mfp;
3316b23aa676SSamuel Ortiz 	struct cfg80211_crypto_settings crypto;
3317fffd0934SJohannes Berg 	const u8 *key;
3318fffd0934SJohannes Berg 	u8 key_len, key_idx;
33197e7c8926SBen Greear 	u32 flags;
33204486ea98SBala Shanmugam 	int bg_scan_period;
33217e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa;
33227e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa_mask;
3323ee2aca34SJohannes Berg 	struct ieee80211_vht_cap vht_capa;
3324ee2aca34SJohannes Berg 	struct ieee80211_vht_cap vht_capa_mask;
332534d50519SLior David 	bool pbss;
332638de03d2SArend van Spriel 	struct cfg80211_bss_selection bss_select;
3327ba6fbacfSJouni Malinen 	const u8 *prev_bssid;
3328a3caf744SVidyullatha Kanchanapally 	const u8 *fils_erp_username;
3329a3caf744SVidyullatha Kanchanapally 	size_t fils_erp_username_len;
3330a3caf744SVidyullatha Kanchanapally 	const u8 *fils_erp_realm;
3331a3caf744SVidyullatha Kanchanapally 	size_t fils_erp_realm_len;
3332a3caf744SVidyullatha Kanchanapally 	u16 fils_erp_next_seq_num;
3333a3caf744SVidyullatha Kanchanapally 	const u8 *fils_erp_rrk;
3334a3caf744SVidyullatha Kanchanapally 	size_t fils_erp_rrk_len;
33353a00df57SAvraham Stern 	bool want_1x;
33362a38075cSAlexei Avshalom Lazar 	struct ieee80211_edmg edmg;
3337b23aa676SSamuel Ortiz };
3338b23aa676SSamuel Ortiz 
3339b23aa676SSamuel Ortiz /**
3340088e8df8Svamsi krishna  * enum cfg80211_connect_params_changed - Connection parameters being updated
3341088e8df8Svamsi krishna  *
3342088e8df8Svamsi krishna  * This enum provides information of all connect parameters that
3343088e8df8Svamsi krishna  * have to be updated as part of update_connect_params() call.
3344088e8df8Svamsi krishna  *
3345088e8df8Svamsi krishna  * @UPDATE_ASSOC_IES: Indicates whether association request IEs are updated
33467f9a3e15SVidyullatha Kanchanapally  * @UPDATE_FILS_ERP_INFO: Indicates that FILS connection parameters (realm,
33477f9a3e15SVidyullatha Kanchanapally  *	username, erp sequence number and rrk) are updated
33487f9a3e15SVidyullatha Kanchanapally  * @UPDATE_AUTH_TYPE: Indicates that authentication type is updated
3349088e8df8Svamsi krishna  */
3350088e8df8Svamsi krishna enum cfg80211_connect_params_changed {
3351088e8df8Svamsi krishna 	UPDATE_ASSOC_IES		= BIT(0),
33527f9a3e15SVidyullatha Kanchanapally 	UPDATE_FILS_ERP_INFO		= BIT(1),
33537f9a3e15SVidyullatha Kanchanapally 	UPDATE_AUTH_TYPE		= BIT(2),
3354088e8df8Svamsi krishna };
3355088e8df8Svamsi krishna 
3356088e8df8Svamsi krishna /**
3357b9a5f8caSJouni Malinen  * enum wiphy_params_flags - set_wiphy_params bitfield values
3358abe37c4bSJohannes Berg  * @WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed
3359abe37c4bSJohannes Berg  * @WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed
3360abe37c4bSJohannes Berg  * @WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed
3361abe37c4bSJohannes Berg  * @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed
3362abe37c4bSJohannes Berg  * @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed
33633057dbfdSLorenzo Bianconi  * @WIPHY_PARAM_DYN_ACK: dynack has been enabled
336452539ca8SToke Høiland-Jørgensen  * @WIPHY_PARAM_TXQ_LIMIT: TXQ packet limit has been changed
336552539ca8SToke Høiland-Jørgensen  * @WIPHY_PARAM_TXQ_MEMORY_LIMIT: TXQ memory limit has been changed
336652539ca8SToke Høiland-Jørgensen  * @WIPHY_PARAM_TXQ_QUANTUM: TXQ scheduler quantum
3367b9a5f8caSJouni Malinen  */
3368b9a5f8caSJouni Malinen enum wiphy_params_flags {
3369b9a5f8caSJouni Malinen 	WIPHY_PARAM_RETRY_SHORT		= 1 << 0,
3370b9a5f8caSJouni Malinen 	WIPHY_PARAM_RETRY_LONG		= 1 << 1,
3371b9a5f8caSJouni Malinen 	WIPHY_PARAM_FRAG_THRESHOLD	= 1 << 2,
3372b9a5f8caSJouni Malinen 	WIPHY_PARAM_RTS_THRESHOLD	= 1 << 3,
337381077e82SLukáš Turek 	WIPHY_PARAM_COVERAGE_CLASS	= 1 << 4,
33743057dbfdSLorenzo Bianconi 	WIPHY_PARAM_DYN_ACK		= 1 << 5,
337552539ca8SToke Høiland-Jørgensen 	WIPHY_PARAM_TXQ_LIMIT		= 1 << 6,
337652539ca8SToke Høiland-Jørgensen 	WIPHY_PARAM_TXQ_MEMORY_LIMIT	= 1 << 7,
337752539ca8SToke Høiland-Jørgensen 	WIPHY_PARAM_TXQ_QUANTUM		= 1 << 8,
3378b9a5f8caSJouni Malinen };
3379b9a5f8caSJouni Malinen 
338036647055SToke Høiland-Jørgensen #define IEEE80211_DEFAULT_AIRTIME_WEIGHT	256
338136647055SToke Høiland-Jørgensen 
33823ace10f5SKan Yan /* The per TXQ device queue limit in airtime */
33833ace10f5SKan Yan #define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_L	5000
33843ace10f5SKan Yan #define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_H	12000
33853ace10f5SKan Yan 
33863ace10f5SKan Yan /* The per interface airtime threshold to switch to lower queue limit */
33873ace10f5SKan Yan #define IEEE80211_AQL_THRESHOLD			24000
33883ace10f5SKan Yan 
338967fbb16bSSamuel Ortiz /**
339067fbb16bSSamuel Ortiz  * struct cfg80211_pmksa - PMK Security Association
339167fbb16bSSamuel Ortiz  *
339267fbb16bSSamuel Ortiz  * This structure is passed to the set/del_pmksa() method for PMKSA
339367fbb16bSSamuel Ortiz  * caching.
339467fbb16bSSamuel Ortiz  *
3395a3caf744SVidyullatha Kanchanapally  * @bssid: The AP's BSSID (may be %NULL).
3396a3caf744SVidyullatha Kanchanapally  * @pmkid: The identifier to refer a PMKSA.
3397a3caf744SVidyullatha Kanchanapally  * @pmk: The PMK for the PMKSA identified by @pmkid. This is used for key
3398a3caf744SVidyullatha Kanchanapally  *	derivation by a FILS STA. Otherwise, %NULL.
3399a3caf744SVidyullatha Kanchanapally  * @pmk_len: Length of the @pmk. The length of @pmk can differ depending on
3400a3caf744SVidyullatha Kanchanapally  *	the hash algorithm used to generate this.
3401a3caf744SVidyullatha Kanchanapally  * @ssid: SSID to specify the ESS within which a PMKSA is valid when using FILS
3402a3caf744SVidyullatha Kanchanapally  *	cache identifier (may be %NULL).
3403a3caf744SVidyullatha Kanchanapally  * @ssid_len: Length of the @ssid in octets.
3404a3caf744SVidyullatha Kanchanapally  * @cache_id: 2-octet cache identifier advertized by a FILS AP identifying the
3405a3caf744SVidyullatha Kanchanapally  *	scope of PMKSA. This is valid only if @ssid_len is non-zero (may be
3406a3caf744SVidyullatha Kanchanapally  *	%NULL).
34077fc82af8SVeerendranath Jakkam  * @pmk_lifetime: Maximum lifetime for PMKSA in seconds
34087fc82af8SVeerendranath Jakkam  *	(dot11RSNAConfigPMKLifetime) or 0 if not specified.
34097fc82af8SVeerendranath Jakkam  *	The configured PMKSA must not be used for PMKSA caching after
34107fc82af8SVeerendranath Jakkam  *	expiration and any keys derived from this PMK become invalid on
34117fc82af8SVeerendranath Jakkam  *	expiration, i.e., the current association must be dropped if the PMK
34127fc82af8SVeerendranath Jakkam  *	used for it expires.
34137fc82af8SVeerendranath Jakkam  * @pmk_reauth_threshold: Threshold time for reauthentication (percentage of
34147fc82af8SVeerendranath Jakkam  *	PMK lifetime, dot11RSNAConfigPMKReauthThreshold) or 0 if not specified.
34157fc82af8SVeerendranath Jakkam  *	Drivers are expected to trigger a full authentication instead of using
34167fc82af8SVeerendranath Jakkam  *	this PMKSA for caching when reassociating to a new BSS after this
34177fc82af8SVeerendranath Jakkam  *	threshold to generate a new PMK before the current one expires.
341867fbb16bSSamuel Ortiz  */
341967fbb16bSSamuel Ortiz struct cfg80211_pmksa {
3420c1e5f471SJohannes Berg 	const u8 *bssid;
3421c1e5f471SJohannes Berg 	const u8 *pmkid;
3422a3caf744SVidyullatha Kanchanapally 	const u8 *pmk;
3423a3caf744SVidyullatha Kanchanapally 	size_t pmk_len;
3424a3caf744SVidyullatha Kanchanapally 	const u8 *ssid;
3425a3caf744SVidyullatha Kanchanapally 	size_t ssid_len;
3426a3caf744SVidyullatha Kanchanapally 	const u8 *cache_id;
34277fc82af8SVeerendranath Jakkam 	u32 pmk_lifetime;
34287fc82af8SVeerendranath Jakkam 	u8 pmk_reauth_threshold;
342967fbb16bSSamuel Ortiz };
34309930380fSJohannes Berg 
34317643a2c3SJohannes Berg /**
343250ac6607SAmitkumar Karwar  * struct cfg80211_pkt_pattern - packet pattern
3433ff1b6e69SJohannes Berg  * @mask: bitmask where to match pattern and where to ignore bytes,
3434ff1b6e69SJohannes Berg  *	one bit per byte, in same format as nl80211
3435ff1b6e69SJohannes Berg  * @pattern: bytes to match where bitmask is 1
3436ff1b6e69SJohannes Berg  * @pattern_len: length of pattern (in bytes)
3437bb92d199SAmitkumar Karwar  * @pkt_offset: packet offset (in bytes)
3438ff1b6e69SJohannes Berg  *
3439ff1b6e69SJohannes Berg  * Internal note: @mask and @pattern are allocated in one chunk of
3440ff1b6e69SJohannes Berg  * memory, free @mask only!
3441ff1b6e69SJohannes Berg  */
344250ac6607SAmitkumar Karwar struct cfg80211_pkt_pattern {
3443922bd80fSJohannes Berg 	const u8 *mask, *pattern;
3444ff1b6e69SJohannes Berg 	int pattern_len;
3445bb92d199SAmitkumar Karwar 	int pkt_offset;
3446ff1b6e69SJohannes Berg };
3447ff1b6e69SJohannes Berg 
3448ff1b6e69SJohannes Berg /**
34492a0e047eSJohannes Berg  * struct cfg80211_wowlan_tcp - TCP connection parameters
34502a0e047eSJohannes Berg  *
34512a0e047eSJohannes Berg  * @sock: (internal) socket for source port allocation
34522a0e047eSJohannes Berg  * @src: source IP address
34532a0e047eSJohannes Berg  * @dst: destination IP address
34542a0e047eSJohannes Berg  * @dst_mac: destination MAC address
34552a0e047eSJohannes Berg  * @src_port: source port
34562a0e047eSJohannes Berg  * @dst_port: destination port
34572a0e047eSJohannes Berg  * @payload_len: data payload length
34582a0e047eSJohannes Berg  * @payload: data payload buffer
34592a0e047eSJohannes Berg  * @payload_seq: payload sequence stamping configuration
34602a0e047eSJohannes Berg  * @data_interval: interval at which to send data packets
34612a0e047eSJohannes Berg  * @wake_len: wakeup payload match length
34622a0e047eSJohannes Berg  * @wake_data: wakeup payload match data
34632a0e047eSJohannes Berg  * @wake_mask: wakeup payload match mask
34642a0e047eSJohannes Berg  * @tokens_size: length of the tokens buffer
34652a0e047eSJohannes Berg  * @payload_tok: payload token usage configuration
34662a0e047eSJohannes Berg  */
34672a0e047eSJohannes Berg struct cfg80211_wowlan_tcp {
34682a0e047eSJohannes Berg 	struct socket *sock;
34692a0e047eSJohannes Berg 	__be32 src, dst;
34702a0e047eSJohannes Berg 	u16 src_port, dst_port;
34712a0e047eSJohannes Berg 	u8 dst_mac[ETH_ALEN];
34722a0e047eSJohannes Berg 	int payload_len;
34732a0e047eSJohannes Berg 	const u8 *payload;
34742a0e047eSJohannes Berg 	struct nl80211_wowlan_tcp_data_seq payload_seq;
34752a0e047eSJohannes Berg 	u32 data_interval;
34762a0e047eSJohannes Berg 	u32 wake_len;
34772a0e047eSJohannes Berg 	const u8 *wake_data, *wake_mask;
34782a0e047eSJohannes Berg 	u32 tokens_size;
34792a0e047eSJohannes Berg 	/* must be last, variable member */
34802a0e047eSJohannes Berg 	struct nl80211_wowlan_tcp_data_token payload_tok;
3481ff1b6e69SJohannes Berg };
3482ff1b6e69SJohannes Berg 
3483ff1b6e69SJohannes Berg /**
3484ff1b6e69SJohannes Berg  * struct cfg80211_wowlan - Wake on Wireless-LAN support info
3485ff1b6e69SJohannes Berg  *
3486ff1b6e69SJohannes Berg  * This structure defines the enabled WoWLAN triggers for the device.
3487ff1b6e69SJohannes Berg  * @any: wake up on any activity -- special trigger if device continues
3488ff1b6e69SJohannes Berg  *	operating as normal during suspend
3489ff1b6e69SJohannes Berg  * @disconnect: wake up if getting disconnected
3490ff1b6e69SJohannes Berg  * @magic_pkt: wake up on receiving magic packet
3491ff1b6e69SJohannes Berg  * @patterns: wake up on receiving packet matching a pattern
3492ff1b6e69SJohannes Berg  * @n_patterns: number of patterns
349377dbbb13SJohannes Berg  * @gtk_rekey_failure: wake up on GTK rekey failure
349477dbbb13SJohannes Berg  * @eap_identity_req: wake up on EAP identity request packet
349577dbbb13SJohannes Berg  * @four_way_handshake: wake up on 4-way handshake
349677dbbb13SJohannes Berg  * @rfkill_release: wake up when rfkill is released
34972a0e047eSJohannes Berg  * @tcp: TCP connection establishment/wakeup parameters, see nl80211.h.
34982a0e047eSJohannes Berg  *	NULL if not configured.
34998cd4d456SLuciano Coelho  * @nd_config: configuration for the scan to be used for net detect wake.
3500ff1b6e69SJohannes Berg  */
3501ff1b6e69SJohannes Berg struct cfg80211_wowlan {
350277dbbb13SJohannes Berg 	bool any, disconnect, magic_pkt, gtk_rekey_failure,
350377dbbb13SJohannes Berg 	     eap_identity_req, four_way_handshake,
350477dbbb13SJohannes Berg 	     rfkill_release;
350550ac6607SAmitkumar Karwar 	struct cfg80211_pkt_pattern *patterns;
35062a0e047eSJohannes Berg 	struct cfg80211_wowlan_tcp *tcp;
3507ff1b6e69SJohannes Berg 	int n_patterns;
35088cd4d456SLuciano Coelho 	struct cfg80211_sched_scan_request *nd_config;
3509ff1b6e69SJohannes Berg };
3510ff1b6e69SJohannes Berg 
3511ff1b6e69SJohannes Berg /**
3512be29b99aSAmitkumar Karwar  * struct cfg80211_coalesce_rules - Coalesce rule parameters
3513be29b99aSAmitkumar Karwar  *
3514be29b99aSAmitkumar Karwar  * This structure defines coalesce rule for the device.
3515be29b99aSAmitkumar Karwar  * @delay: maximum coalescing delay in msecs.
3516be29b99aSAmitkumar Karwar  * @condition: condition for packet coalescence.
3517be29b99aSAmitkumar Karwar  *	see &enum nl80211_coalesce_condition.
3518be29b99aSAmitkumar Karwar  * @patterns: array of packet patterns
3519be29b99aSAmitkumar Karwar  * @n_patterns: number of patterns
3520be29b99aSAmitkumar Karwar  */
3521be29b99aSAmitkumar Karwar struct cfg80211_coalesce_rules {
3522be29b99aSAmitkumar Karwar 	int delay;
3523be29b99aSAmitkumar Karwar 	enum nl80211_coalesce_condition condition;
3524be29b99aSAmitkumar Karwar 	struct cfg80211_pkt_pattern *patterns;
3525be29b99aSAmitkumar Karwar 	int n_patterns;
3526be29b99aSAmitkumar Karwar };
3527be29b99aSAmitkumar Karwar 
3528be29b99aSAmitkumar Karwar /**
3529be29b99aSAmitkumar Karwar  * struct cfg80211_coalesce - Packet coalescing settings
3530be29b99aSAmitkumar Karwar  *
3531be29b99aSAmitkumar Karwar  * This structure defines coalescing settings.
3532be29b99aSAmitkumar Karwar  * @rules: array of coalesce rules
3533be29b99aSAmitkumar Karwar  * @n_rules: number of rules
3534be29b99aSAmitkumar Karwar  */
3535be29b99aSAmitkumar Karwar struct cfg80211_coalesce {
3536be29b99aSAmitkumar Karwar 	struct cfg80211_coalesce_rules *rules;
3537be29b99aSAmitkumar Karwar 	int n_rules;
3538be29b99aSAmitkumar Karwar };
3539be29b99aSAmitkumar Karwar 
3540be29b99aSAmitkumar Karwar /**
35418cd4d456SLuciano Coelho  * struct cfg80211_wowlan_nd_match - information about the match
35428cd4d456SLuciano Coelho  *
35438cd4d456SLuciano Coelho  * @ssid: SSID of the match that triggered the wake up
35448cd4d456SLuciano Coelho  * @n_channels: Number of channels where the match occurred.  This
35458cd4d456SLuciano Coelho  *	value may be zero if the driver can't report the channels.
35468cd4d456SLuciano Coelho  * @channels: center frequencies of the channels where a match
35478cd4d456SLuciano Coelho  *	occurred (in MHz)
35488cd4d456SLuciano Coelho  */
35498cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_match {
35508cd4d456SLuciano Coelho 	struct cfg80211_ssid ssid;
35518cd4d456SLuciano Coelho 	int n_channels;
35528cd4d456SLuciano Coelho 	u32 channels[];
35538cd4d456SLuciano Coelho };
35548cd4d456SLuciano Coelho 
35558cd4d456SLuciano Coelho /**
35568cd4d456SLuciano Coelho  * struct cfg80211_wowlan_nd_info - net detect wake up information
35578cd4d456SLuciano Coelho  *
35588cd4d456SLuciano Coelho  * @n_matches: Number of match information instances provided in
35598cd4d456SLuciano Coelho  *	@matches.  This value may be zero if the driver can't provide
35608cd4d456SLuciano Coelho  *	match information.
35618cd4d456SLuciano Coelho  * @matches: Array of pointers to matches containing information about
35628cd4d456SLuciano Coelho  *	the matches that triggered the wake up.
35638cd4d456SLuciano Coelho  */
35648cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_info {
35658cd4d456SLuciano Coelho 	int n_matches;
35668cd4d456SLuciano Coelho 	struct cfg80211_wowlan_nd_match *matches[];
35678cd4d456SLuciano Coelho };
35688cd4d456SLuciano Coelho 
35698cd4d456SLuciano Coelho /**
3570cd8f7cb4SJohannes Berg  * struct cfg80211_wowlan_wakeup - wakeup report
3571cd8f7cb4SJohannes Berg  * @disconnect: woke up by getting disconnected
3572cd8f7cb4SJohannes Berg  * @magic_pkt: woke up by receiving magic packet
3573cd8f7cb4SJohannes Berg  * @gtk_rekey_failure: woke up by GTK rekey failure
3574cd8f7cb4SJohannes Berg  * @eap_identity_req: woke up by EAP identity request packet
3575cd8f7cb4SJohannes Berg  * @four_way_handshake: woke up by 4-way handshake
3576cd8f7cb4SJohannes Berg  * @rfkill_release: woke up by rfkill being released
3577cd8f7cb4SJohannes Berg  * @pattern_idx: pattern that caused wakeup, -1 if not due to pattern
3578cd8f7cb4SJohannes Berg  * @packet_present_len: copied wakeup packet data
3579cd8f7cb4SJohannes Berg  * @packet_len: original wakeup packet length
3580cd8f7cb4SJohannes Berg  * @packet: The packet causing the wakeup, if any.
3581cd8f7cb4SJohannes Berg  * @packet_80211:  For pattern match, magic packet and other data
3582cd8f7cb4SJohannes Berg  *	frame triggers an 802.3 frame should be reported, for
3583cd8f7cb4SJohannes Berg  *	disconnect due to deauth 802.11 frame. This indicates which
3584cd8f7cb4SJohannes Berg  *	it is.
35852a0e047eSJohannes Berg  * @tcp_match: TCP wakeup packet received
35862a0e047eSJohannes Berg  * @tcp_connlost: TCP connection lost or failed to establish
35872a0e047eSJohannes Berg  * @tcp_nomoretokens: TCP data ran out of tokens
35888cd4d456SLuciano Coelho  * @net_detect: if not %NULL, woke up because of net detect
3589cd8f7cb4SJohannes Berg  */
3590cd8f7cb4SJohannes Berg struct cfg80211_wowlan_wakeup {
3591cd8f7cb4SJohannes Berg 	bool disconnect, magic_pkt, gtk_rekey_failure,
3592cd8f7cb4SJohannes Berg 	     eap_identity_req, four_way_handshake,
35932a0e047eSJohannes Berg 	     rfkill_release, packet_80211,
35942a0e047eSJohannes Berg 	     tcp_match, tcp_connlost, tcp_nomoretokens;
3595cd8f7cb4SJohannes Berg 	s32 pattern_idx;
3596cd8f7cb4SJohannes Berg 	u32 packet_present_len, packet_len;
3597cd8f7cb4SJohannes Berg 	const void *packet;
35988cd4d456SLuciano Coelho 	struct cfg80211_wowlan_nd_info *net_detect;
3599cd8f7cb4SJohannes Berg };
3600cd8f7cb4SJohannes Berg 
3601cd8f7cb4SJohannes Berg /**
3602e5497d76SJohannes Berg  * struct cfg80211_gtk_rekey_data - rekey data
3603093a48d2SNathan Errera  * @kek: key encryption key (@kek_len bytes)
3604093a48d2SNathan Errera  * @kck: key confirmation key (@kck_len bytes)
360578f686caSJohannes Berg  * @replay_ctr: replay counter (NL80211_REPLAY_CTR_LEN bytes)
3606093a48d2SNathan Errera  * @kek_len: length of kek
36072d8b08feSMauro Carvalho Chehab  * @kck_len: length of kck
3608093a48d2SNathan Errera  * @akm: akm (oui, id)
3609e5497d76SJohannes Berg  */
3610e5497d76SJohannes Berg struct cfg80211_gtk_rekey_data {
361178f686caSJohannes Berg 	const u8 *kek, *kck, *replay_ctr;
3612093a48d2SNathan Errera 	u32 akm;
3613093a48d2SNathan Errera 	u8 kek_len, kck_len;
3614e5497d76SJohannes Berg };
3615e5497d76SJohannes Berg 
3616e5497d76SJohannes Berg /**
3617355199e0SJouni Malinen  * struct cfg80211_update_ft_ies_params - FT IE Information
3618355199e0SJouni Malinen  *
3619355199e0SJouni Malinen  * This structure provides information needed to update the fast transition IE
3620355199e0SJouni Malinen  *
3621355199e0SJouni Malinen  * @md: The Mobility Domain ID, 2 Octet value
3622355199e0SJouni Malinen  * @ie: Fast Transition IEs
3623355199e0SJouni Malinen  * @ie_len: Length of ft_ie in octets
3624355199e0SJouni Malinen  */
3625355199e0SJouni Malinen struct cfg80211_update_ft_ies_params {
3626355199e0SJouni Malinen 	u16 md;
3627355199e0SJouni Malinen 	const u8 *ie;
3628355199e0SJouni Malinen 	size_t ie_len;
3629355199e0SJouni Malinen };
3630355199e0SJouni Malinen 
3631355199e0SJouni Malinen /**
3632b176e629SAndrei Otcheretianski  * struct cfg80211_mgmt_tx_params - mgmt tx parameters
3633b176e629SAndrei Otcheretianski  *
3634b176e629SAndrei Otcheretianski  * This structure provides information needed to transmit a mgmt frame
3635b176e629SAndrei Otcheretianski  *
3636b176e629SAndrei Otcheretianski  * @chan: channel to use
363798e0c7f8SRandy Dunlap  * @offchan: indicates whether off channel operation is required
3638b176e629SAndrei Otcheretianski  * @wait: duration for ROC
3639b176e629SAndrei Otcheretianski  * @buf: buffer to transmit
3640b176e629SAndrei Otcheretianski  * @len: buffer length
3641b176e629SAndrei Otcheretianski  * @no_cck: don't use cck rates for this frame
3642b176e629SAndrei Otcheretianski  * @dont_wait_for_ack: tells the low level not to wait for an ack
364334d22ce2SAndrei Otcheretianski  * @n_csa_offsets: length of csa_offsets array
364434d22ce2SAndrei Otcheretianski  * @csa_offsets: array of all the csa offsets in the frame
364595f498bbSJohannes Berg  * @link_id: for MLO, the link ID to transmit on, -1 if not given; note
364695f498bbSJohannes Berg  *	that the link ID isn't validated (much), it's in range but the
364795f498bbSJohannes Berg  *	link might not exist (or be used by the receiver STA)
3648b176e629SAndrei Otcheretianski  */
3649b176e629SAndrei Otcheretianski struct cfg80211_mgmt_tx_params {
3650b176e629SAndrei Otcheretianski 	struct ieee80211_channel *chan;
3651b176e629SAndrei Otcheretianski 	bool offchan;
3652b176e629SAndrei Otcheretianski 	unsigned int wait;
3653b176e629SAndrei Otcheretianski 	const u8 *buf;
3654b176e629SAndrei Otcheretianski 	size_t len;
3655b176e629SAndrei Otcheretianski 	bool no_cck;
3656b176e629SAndrei Otcheretianski 	bool dont_wait_for_ack;
365734d22ce2SAndrei Otcheretianski 	int n_csa_offsets;
365834d22ce2SAndrei Otcheretianski 	const u16 *csa_offsets;
365995f498bbSJohannes Berg 	int link_id;
3660b176e629SAndrei Otcheretianski };
3661b176e629SAndrei Otcheretianski 
3662b176e629SAndrei Otcheretianski /**
3663fa9ffc74SKyeyoon Park  * struct cfg80211_dscp_exception - DSCP exception
3664fa9ffc74SKyeyoon Park  *
3665fa9ffc74SKyeyoon Park  * @dscp: DSCP value that does not adhere to the user priority range definition
3666fa9ffc74SKyeyoon Park  * @up: user priority value to which the corresponding DSCP value belongs
3667fa9ffc74SKyeyoon Park  */
3668fa9ffc74SKyeyoon Park struct cfg80211_dscp_exception {
3669fa9ffc74SKyeyoon Park 	u8 dscp;
3670fa9ffc74SKyeyoon Park 	u8 up;
3671fa9ffc74SKyeyoon Park };
3672fa9ffc74SKyeyoon Park 
3673fa9ffc74SKyeyoon Park /**
3674fa9ffc74SKyeyoon Park  * struct cfg80211_dscp_range - DSCP range definition for user priority
3675fa9ffc74SKyeyoon Park  *
3676fa9ffc74SKyeyoon Park  * @low: lowest DSCP value of this user priority range, inclusive
3677fa9ffc74SKyeyoon Park  * @high: highest DSCP value of this user priority range, inclusive
3678fa9ffc74SKyeyoon Park  */
3679fa9ffc74SKyeyoon Park struct cfg80211_dscp_range {
3680fa9ffc74SKyeyoon Park 	u8 low;
3681fa9ffc74SKyeyoon Park 	u8 high;
3682fa9ffc74SKyeyoon Park };
3683fa9ffc74SKyeyoon Park 
3684fa9ffc74SKyeyoon Park /* QoS Map Set element length defined in IEEE Std 802.11-2012, 8.4.2.97 */
3685fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_MAX_EX	21
3686fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_LEN_MIN	16
3687fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_LEN_MAX \
3688fa9ffc74SKyeyoon Park 	(IEEE80211_QOS_MAP_LEN_MIN + 2 * IEEE80211_QOS_MAP_MAX_EX)
3689fa9ffc74SKyeyoon Park 
3690fa9ffc74SKyeyoon Park /**
3691fa9ffc74SKyeyoon Park  * struct cfg80211_qos_map - QoS Map Information
3692fa9ffc74SKyeyoon Park  *
3693fa9ffc74SKyeyoon Park  * This struct defines the Interworking QoS map setting for DSCP values
3694fa9ffc74SKyeyoon Park  *
3695fa9ffc74SKyeyoon Park  * @num_des: number of DSCP exceptions (0..21)
3696fa9ffc74SKyeyoon Park  * @dscp_exception: optionally up to maximum of 21 DSCP exceptions from
3697fa9ffc74SKyeyoon Park  *	the user priority DSCP range definition
3698fa9ffc74SKyeyoon Park  * @up: DSCP range definition for a particular user priority
3699fa9ffc74SKyeyoon Park  */
3700fa9ffc74SKyeyoon Park struct cfg80211_qos_map {
3701fa9ffc74SKyeyoon Park 	u8 num_des;
3702fa9ffc74SKyeyoon Park 	struct cfg80211_dscp_exception dscp_exception[IEEE80211_QOS_MAP_MAX_EX];
3703fa9ffc74SKyeyoon Park 	struct cfg80211_dscp_range up[8];
3704fa9ffc74SKyeyoon Park };
3705fa9ffc74SKyeyoon Park 
3706fa9ffc74SKyeyoon Park /**
3707cb3b7d87SAyala Beker  * struct cfg80211_nan_conf - NAN configuration
3708cb3b7d87SAyala Beker  *
3709cb3b7d87SAyala Beker  * This struct defines NAN configuration parameters
3710cb3b7d87SAyala Beker  *
3711cb3b7d87SAyala Beker  * @master_pref: master preference (1 - 255)
37128585989dSLuca Coelho  * @bands: operating bands, a bitmap of &enum nl80211_band values.
37138585989dSLuca Coelho  *	For instance, for NL80211_BAND_2GHZ, bit 0 would be set
37148585989dSLuca Coelho  *	(i.e. BIT(NL80211_BAND_2GHZ)).
3715cb3b7d87SAyala Beker  */
3716cb3b7d87SAyala Beker struct cfg80211_nan_conf {
3717cb3b7d87SAyala Beker 	u8 master_pref;
37188585989dSLuca Coelho 	u8 bands;
3719cb3b7d87SAyala Beker };
3720cb3b7d87SAyala Beker 
3721cb3b7d87SAyala Beker /**
3722a5a9dcf2SAyala Beker  * enum cfg80211_nan_conf_changes - indicates changed fields in NAN
3723a5a9dcf2SAyala Beker  * configuration
3724a5a9dcf2SAyala Beker  *
3725a5a9dcf2SAyala Beker  * @CFG80211_NAN_CONF_CHANGED_PREF: master preference
37268585989dSLuca Coelho  * @CFG80211_NAN_CONF_CHANGED_BANDS: operating bands
3727a5a9dcf2SAyala Beker  */
3728a5a9dcf2SAyala Beker enum cfg80211_nan_conf_changes {
3729a5a9dcf2SAyala Beker 	CFG80211_NAN_CONF_CHANGED_PREF = BIT(0),
37308585989dSLuca Coelho 	CFG80211_NAN_CONF_CHANGED_BANDS = BIT(1),
3731a5a9dcf2SAyala Beker };
3732a5a9dcf2SAyala Beker 
3733a5a9dcf2SAyala Beker /**
3734a442b761SAyala Beker  * struct cfg80211_nan_func_filter - a NAN function Rx / Tx filter
3735a442b761SAyala Beker  *
3736a442b761SAyala Beker  * @filter: the content of the filter
3737a442b761SAyala Beker  * @len: the length of the filter
3738a442b761SAyala Beker  */
3739a442b761SAyala Beker struct cfg80211_nan_func_filter {
3740a442b761SAyala Beker 	const u8 *filter;
3741a442b761SAyala Beker 	u8 len;
3742a442b761SAyala Beker };
3743a442b761SAyala Beker 
3744a442b761SAyala Beker /**
3745a442b761SAyala Beker  * struct cfg80211_nan_func - a NAN function
3746a442b761SAyala Beker  *
3747a442b761SAyala Beker  * @type: &enum nl80211_nan_function_type
3748a442b761SAyala Beker  * @service_id: the service ID of the function
3749a442b761SAyala Beker  * @publish_type: &nl80211_nan_publish_type
3750a442b761SAyala Beker  * @close_range: if true, the range should be limited. Threshold is
3751a442b761SAyala Beker  *	implementation specific.
3752a442b761SAyala Beker  * @publish_bcast: if true, the solicited publish should be broadcasted
3753a442b761SAyala Beker  * @subscribe_active: if true, the subscribe is active
3754a442b761SAyala Beker  * @followup_id: the instance ID for follow up
375598e0c7f8SRandy Dunlap  * @followup_reqid: the requester instance ID for follow up
3756a442b761SAyala Beker  * @followup_dest: MAC address of the recipient of the follow up
3757a442b761SAyala Beker  * @ttl: time to live counter in DW.
3758a442b761SAyala Beker  * @serv_spec_info: Service Specific Info
3759a442b761SAyala Beker  * @serv_spec_info_len: Service Specific Info length
3760a442b761SAyala Beker  * @srf_include: if true, SRF is inclusive
3761a442b761SAyala Beker  * @srf_bf: Bloom Filter
3762a442b761SAyala Beker  * @srf_bf_len: Bloom Filter length
3763a442b761SAyala Beker  * @srf_bf_idx: Bloom Filter index
3764a442b761SAyala Beker  * @srf_macs: SRF MAC addresses
3765a442b761SAyala Beker  * @srf_num_macs: number of MAC addresses in SRF
3766a442b761SAyala Beker  * @rx_filters: rx filters that are matched with corresponding peer's tx_filter
3767a442b761SAyala Beker  * @tx_filters: filters that should be transmitted in the SDF.
3768a442b761SAyala Beker  * @num_rx_filters: length of &rx_filters.
3769a442b761SAyala Beker  * @num_tx_filters: length of &tx_filters.
3770a442b761SAyala Beker  * @instance_id: driver allocated id of the function.
3771a442b761SAyala Beker  * @cookie: unique NAN function identifier.
3772a442b761SAyala Beker  */
3773a442b761SAyala Beker struct cfg80211_nan_func {
3774a442b761SAyala Beker 	enum nl80211_nan_function_type type;
3775a442b761SAyala Beker 	u8 service_id[NL80211_NAN_FUNC_SERVICE_ID_LEN];
3776a442b761SAyala Beker 	u8 publish_type;
3777a442b761SAyala Beker 	bool close_range;
3778a442b761SAyala Beker 	bool publish_bcast;
3779a442b761SAyala Beker 	bool subscribe_active;
3780a442b761SAyala Beker 	u8 followup_id;
3781a442b761SAyala Beker 	u8 followup_reqid;
3782a442b761SAyala Beker 	struct mac_address followup_dest;
3783a442b761SAyala Beker 	u32 ttl;
3784a442b761SAyala Beker 	const u8 *serv_spec_info;
3785a442b761SAyala Beker 	u8 serv_spec_info_len;
3786a442b761SAyala Beker 	bool srf_include;
3787a442b761SAyala Beker 	const u8 *srf_bf;
3788a442b761SAyala Beker 	u8 srf_bf_len;
3789a442b761SAyala Beker 	u8 srf_bf_idx;
3790a442b761SAyala Beker 	struct mac_address *srf_macs;
3791a442b761SAyala Beker 	int srf_num_macs;
3792a442b761SAyala Beker 	struct cfg80211_nan_func_filter *rx_filters;
3793a442b761SAyala Beker 	struct cfg80211_nan_func_filter *tx_filters;
3794a442b761SAyala Beker 	u8 num_tx_filters;
3795a442b761SAyala Beker 	u8 num_rx_filters;
3796a442b761SAyala Beker 	u8 instance_id;
3797a442b761SAyala Beker 	u64 cookie;
3798a442b761SAyala Beker };
3799a442b761SAyala Beker 
3800a442b761SAyala Beker /**
38013a00df57SAvraham Stern  * struct cfg80211_pmk_conf - PMK configuration
38023a00df57SAvraham Stern  *
38033a00df57SAvraham Stern  * @aa: authenticator address
38043a00df57SAvraham Stern  * @pmk_len: PMK length in bytes.
38053a00df57SAvraham Stern  * @pmk: the PMK material
38063a00df57SAvraham Stern  * @pmk_r0_name: PMK-R0 Name. NULL if not applicable (i.e., the PMK
38073a00df57SAvraham Stern  *	is not PMK-R0). When pmk_r0_name is not NULL, the pmk field
38083a00df57SAvraham Stern  *	holds PMK-R0.
38093a00df57SAvraham Stern  */
38103a00df57SAvraham Stern struct cfg80211_pmk_conf {
38113a00df57SAvraham Stern 	const u8 *aa;
38123a00df57SAvraham Stern 	u8 pmk_len;
38133a00df57SAvraham Stern 	const u8 *pmk;
38143a00df57SAvraham Stern 	const u8 *pmk_r0_name;
38153a00df57SAvraham Stern };
38163a00df57SAvraham Stern 
38173a00df57SAvraham Stern /**
381840cbfa90SSrinivas Dasari  * struct cfg80211_external_auth_params - Trigger External authentication.
381940cbfa90SSrinivas Dasari  *
382040cbfa90SSrinivas Dasari  * Commonly used across the external auth request and event interfaces.
382140cbfa90SSrinivas Dasari  *
382240cbfa90SSrinivas Dasari  * @action: action type / trigger for external authentication. Only significant
382340cbfa90SSrinivas Dasari  *	for the authentication request event interface (driver to user space).
382440cbfa90SSrinivas Dasari  * @bssid: BSSID of the peer with which the authentication has
382540cbfa90SSrinivas Dasari  *	to happen. Used by both the authentication request event and
382640cbfa90SSrinivas Dasari  *	authentication response command interface.
382740cbfa90SSrinivas Dasari  * @ssid: SSID of the AP.  Used by both the authentication request event and
382840cbfa90SSrinivas Dasari  *	authentication response command interface.
382940cbfa90SSrinivas Dasari  * @key_mgmt_suite: AKM suite of the respective authentication. Used by the
383040cbfa90SSrinivas Dasari  *	authentication request event interface.
383140cbfa90SSrinivas Dasari  * @status: status code, %WLAN_STATUS_SUCCESS for successful authentication,
383240cbfa90SSrinivas Dasari  *	use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space cannot give you
383340cbfa90SSrinivas Dasari  *	the real status code for failures. Used only for the authentication
383440cbfa90SSrinivas Dasari  *	response command interface (user space to driver).
3835fe494370SSrinivas Dasari  * @pmkid: The identifier to refer a PMKSA.
38369a47c1efSVeerendranath Jakkam  * @mld_addr: MLD address of the peer. Used by the authentication request event
38379a47c1efSVeerendranath Jakkam  *	interface. Driver indicates this to enable MLO during the authentication
38389a47c1efSVeerendranath Jakkam  *	offload to user space. Driver shall look at %NL80211_ATTR_MLO_SUPPORT
38399a47c1efSVeerendranath Jakkam  *	flag capability in NL80211_CMD_CONNECT to know whether the user space
38409a47c1efSVeerendranath Jakkam  *	supports enabling MLO during the authentication offload.
38419a47c1efSVeerendranath Jakkam  *	User space should use the address of the interface (on which the
38429a47c1efSVeerendranath Jakkam  *	authentication request event reported) as self MLD address. User space
38439a47c1efSVeerendranath Jakkam  *	and driver should use MLD addresses in RA, TA and BSSID fields of
38449a47c1efSVeerendranath Jakkam  *	authentication frames sent or received via cfg80211. The driver
38459a47c1efSVeerendranath Jakkam  *	translates the MLD addresses to/from link addresses based on the link
38469a47c1efSVeerendranath Jakkam  *	chosen for the authentication.
384740cbfa90SSrinivas Dasari  */
384840cbfa90SSrinivas Dasari struct cfg80211_external_auth_params {
384940cbfa90SSrinivas Dasari 	enum nl80211_external_auth_action action;
385040cbfa90SSrinivas Dasari 	u8 bssid[ETH_ALEN] __aligned(2);
385140cbfa90SSrinivas Dasari 	struct cfg80211_ssid ssid;
385240cbfa90SSrinivas Dasari 	unsigned int key_mgmt_suite;
385340cbfa90SSrinivas Dasari 	u16 status;
3854fe494370SSrinivas Dasari 	const u8 *pmkid;
38559a47c1efSVeerendranath Jakkam 	u8 mld_addr[ETH_ALEN] __aligned(2);
385640cbfa90SSrinivas Dasari };
385740cbfa90SSrinivas Dasari 
385840cbfa90SSrinivas Dasari /**
38593453de98SRandy Dunlap  * struct cfg80211_ftm_responder_stats - FTM responder statistics
386081e54d08SPradeep Kumar Chitrapu  *
386181e54d08SPradeep Kumar Chitrapu  * @filled: bitflag of flags using the bits of &enum nl80211_ftm_stats to
386281e54d08SPradeep Kumar Chitrapu  *	indicate the relevant values in this struct for them
386381e54d08SPradeep Kumar Chitrapu  * @success_num: number of FTM sessions in which all frames were successfully
386481e54d08SPradeep Kumar Chitrapu  *	answered
386581e54d08SPradeep Kumar Chitrapu  * @partial_num: number of FTM sessions in which part of frames were
386681e54d08SPradeep Kumar Chitrapu  *	successfully answered
386781e54d08SPradeep Kumar Chitrapu  * @failed_num: number of failed FTM sessions
386881e54d08SPradeep Kumar Chitrapu  * @asap_num: number of ASAP FTM sessions
386981e54d08SPradeep Kumar Chitrapu  * @non_asap_num: number of  non-ASAP FTM sessions
387081e54d08SPradeep Kumar Chitrapu  * @total_duration_ms: total sessions durations - gives an indication
387181e54d08SPradeep Kumar Chitrapu  *	of how much time the responder was busy
387281e54d08SPradeep Kumar Chitrapu  * @unknown_triggers_num: number of unknown FTM triggers - triggers from
387381e54d08SPradeep Kumar Chitrapu  *	initiators that didn't finish successfully the negotiation phase with
387481e54d08SPradeep Kumar Chitrapu  *	the responder
387581e54d08SPradeep Kumar Chitrapu  * @reschedule_requests_num: number of FTM reschedule requests - initiator asks
387681e54d08SPradeep Kumar Chitrapu  *	for a new scheduling although it already has scheduled FTM slot
387781e54d08SPradeep Kumar Chitrapu  * @out_of_window_triggers_num: total FTM triggers out of scheduled window
387881e54d08SPradeep Kumar Chitrapu  */
387981e54d08SPradeep Kumar Chitrapu struct cfg80211_ftm_responder_stats {
388081e54d08SPradeep Kumar Chitrapu 	u32 filled;
388181e54d08SPradeep Kumar Chitrapu 	u32 success_num;
388281e54d08SPradeep Kumar Chitrapu 	u32 partial_num;
388381e54d08SPradeep Kumar Chitrapu 	u32 failed_num;
388481e54d08SPradeep Kumar Chitrapu 	u32 asap_num;
388581e54d08SPradeep Kumar Chitrapu 	u32 non_asap_num;
388681e54d08SPradeep Kumar Chitrapu 	u64 total_duration_ms;
388781e54d08SPradeep Kumar Chitrapu 	u32 unknown_triggers_num;
388881e54d08SPradeep Kumar Chitrapu 	u32 reschedule_requests_num;
388981e54d08SPradeep Kumar Chitrapu 	u32 out_of_window_triggers_num;
389081e54d08SPradeep Kumar Chitrapu };
389181e54d08SPradeep Kumar Chitrapu 
389281e54d08SPradeep Kumar Chitrapu /**
38939bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_ftm_result - FTM result
38949bb7e0f2SJohannes Berg  * @failure_reason: if this measurement failed (PMSR status is
38959bb7e0f2SJohannes Berg  *	%NL80211_PMSR_STATUS_FAILURE), this gives a more precise
38969bb7e0f2SJohannes Berg  *	reason than just "failure"
38979bb7e0f2SJohannes Berg  * @burst_index: if reporting partial results, this is the index
38989bb7e0f2SJohannes Berg  *	in [0 .. num_bursts-1] of the burst that's being reported
38999bb7e0f2SJohannes Berg  * @num_ftmr_attempts: number of FTM request frames transmitted
39009bb7e0f2SJohannes Berg  * @num_ftmr_successes: number of FTM request frames acked
39019bb7e0f2SJohannes Berg  * @busy_retry_time: if failure_reason is %NL80211_PMSR_FTM_FAILURE_PEER_BUSY,
39029bb7e0f2SJohannes Berg  *	fill this to indicate in how many seconds a retry is deemed possible
39039bb7e0f2SJohannes Berg  *	by the responder
39049bb7e0f2SJohannes Berg  * @num_bursts_exp: actual number of bursts exponent negotiated
39059bb7e0f2SJohannes Berg  * @burst_duration: actual burst duration negotiated
39069bb7e0f2SJohannes Berg  * @ftms_per_burst: actual FTMs per burst negotiated
39079bb7e0f2SJohannes Berg  * @lci_len: length of LCI information (if present)
39089bb7e0f2SJohannes Berg  * @civicloc_len: length of civic location information (if present)
39099bb7e0f2SJohannes Berg  * @lci: LCI data (may be %NULL)
39109bb7e0f2SJohannes Berg  * @civicloc: civic location data (may be %NULL)
39119bb7e0f2SJohannes Berg  * @rssi_avg: average RSSI over FTM action frames reported
39129bb7e0f2SJohannes Berg  * @rssi_spread: spread of the RSSI over FTM action frames reported
39139bb7e0f2SJohannes Berg  * @tx_rate: bitrate for transmitted FTM action frame response
39149bb7e0f2SJohannes Berg  * @rx_rate: bitrate of received FTM action frame
39159bb7e0f2SJohannes Berg  * @rtt_avg: average of RTTs measured (must have either this or @dist_avg)
39169bb7e0f2SJohannes Berg  * @rtt_variance: variance of RTTs measured (note that standard deviation is
39179bb7e0f2SJohannes Berg  *	the square root of the variance)
39189bb7e0f2SJohannes Berg  * @rtt_spread: spread of the RTTs measured
39199bb7e0f2SJohannes Berg  * @dist_avg: average of distances (mm) measured
39209bb7e0f2SJohannes Berg  *	(must have either this or @rtt_avg)
39219bb7e0f2SJohannes Berg  * @dist_variance: variance of distances measured (see also @rtt_variance)
39229bb7e0f2SJohannes Berg  * @dist_spread: spread of distances measured (see also @rtt_spread)
39239bb7e0f2SJohannes Berg  * @num_ftmr_attempts_valid: @num_ftmr_attempts is valid
39249bb7e0f2SJohannes Berg  * @num_ftmr_successes_valid: @num_ftmr_successes is valid
39259bb7e0f2SJohannes Berg  * @rssi_avg_valid: @rssi_avg is valid
39269bb7e0f2SJohannes Berg  * @rssi_spread_valid: @rssi_spread is valid
39279bb7e0f2SJohannes Berg  * @tx_rate_valid: @tx_rate is valid
39289bb7e0f2SJohannes Berg  * @rx_rate_valid: @rx_rate is valid
39299bb7e0f2SJohannes Berg  * @rtt_avg_valid: @rtt_avg is valid
39309bb7e0f2SJohannes Berg  * @rtt_variance_valid: @rtt_variance is valid
39319bb7e0f2SJohannes Berg  * @rtt_spread_valid: @rtt_spread is valid
39329bb7e0f2SJohannes Berg  * @dist_avg_valid: @dist_avg is valid
39339bb7e0f2SJohannes Berg  * @dist_variance_valid: @dist_variance is valid
39349bb7e0f2SJohannes Berg  * @dist_spread_valid: @dist_spread is valid
39359bb7e0f2SJohannes Berg  */
39369bb7e0f2SJohannes Berg struct cfg80211_pmsr_ftm_result {
39379bb7e0f2SJohannes Berg 	const u8 *lci;
39389bb7e0f2SJohannes Berg 	const u8 *civicloc;
39399bb7e0f2SJohannes Berg 	unsigned int lci_len;
39409bb7e0f2SJohannes Berg 	unsigned int civicloc_len;
39419bb7e0f2SJohannes Berg 	enum nl80211_peer_measurement_ftm_failure_reasons failure_reason;
39429bb7e0f2SJohannes Berg 	u32 num_ftmr_attempts, num_ftmr_successes;
39439bb7e0f2SJohannes Berg 	s16 burst_index;
39449bb7e0f2SJohannes Berg 	u8 busy_retry_time;
39459bb7e0f2SJohannes Berg 	u8 num_bursts_exp;
39469bb7e0f2SJohannes Berg 	u8 burst_duration;
39479bb7e0f2SJohannes Berg 	u8 ftms_per_burst;
39489bb7e0f2SJohannes Berg 	s32 rssi_avg;
39499bb7e0f2SJohannes Berg 	s32 rssi_spread;
39509bb7e0f2SJohannes Berg 	struct rate_info tx_rate, rx_rate;
39519bb7e0f2SJohannes Berg 	s64 rtt_avg;
39529bb7e0f2SJohannes Berg 	s64 rtt_variance;
39539bb7e0f2SJohannes Berg 	s64 rtt_spread;
39549bb7e0f2SJohannes Berg 	s64 dist_avg;
39559bb7e0f2SJohannes Berg 	s64 dist_variance;
39569bb7e0f2SJohannes Berg 	s64 dist_spread;
39579bb7e0f2SJohannes Berg 
39589bb7e0f2SJohannes Berg 	u16 num_ftmr_attempts_valid:1,
39599bb7e0f2SJohannes Berg 	    num_ftmr_successes_valid:1,
39609bb7e0f2SJohannes Berg 	    rssi_avg_valid:1,
39619bb7e0f2SJohannes Berg 	    rssi_spread_valid:1,
39629bb7e0f2SJohannes Berg 	    tx_rate_valid:1,
39639bb7e0f2SJohannes Berg 	    rx_rate_valid:1,
39649bb7e0f2SJohannes Berg 	    rtt_avg_valid:1,
39659bb7e0f2SJohannes Berg 	    rtt_variance_valid:1,
39669bb7e0f2SJohannes Berg 	    rtt_spread_valid:1,
39679bb7e0f2SJohannes Berg 	    dist_avg_valid:1,
39689bb7e0f2SJohannes Berg 	    dist_variance_valid:1,
39699bb7e0f2SJohannes Berg 	    dist_spread_valid:1;
39709bb7e0f2SJohannes Berg };
39719bb7e0f2SJohannes Berg 
39729bb7e0f2SJohannes Berg /**
39739bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_result - peer measurement result
39749bb7e0f2SJohannes Berg  * @addr: address of the peer
39759bb7e0f2SJohannes Berg  * @host_time: host time (use ktime_get_boottime() adjust to the time when the
39769bb7e0f2SJohannes Berg  *	measurement was made)
39779bb7e0f2SJohannes Berg  * @ap_tsf: AP's TSF at measurement time
39789bb7e0f2SJohannes Berg  * @status: status of the measurement
39799bb7e0f2SJohannes Berg  * @final: if reporting partial results, mark this as the last one; if not
39809bb7e0f2SJohannes Berg  *	reporting partial results always set this flag
39819bb7e0f2SJohannes Berg  * @ap_tsf_valid: indicates the @ap_tsf value is valid
39829bb7e0f2SJohannes Berg  * @type: type of the measurement reported, note that we only support reporting
39839bb7e0f2SJohannes Berg  *	one type at a time, but you can report multiple results separately and
39849bb7e0f2SJohannes Berg  *	they're all aggregated for userspace.
39852d8b08feSMauro Carvalho Chehab  * @ftm: FTM result
39869bb7e0f2SJohannes Berg  */
39879bb7e0f2SJohannes Berg struct cfg80211_pmsr_result {
39889bb7e0f2SJohannes Berg 	u64 host_time, ap_tsf;
39899bb7e0f2SJohannes Berg 	enum nl80211_peer_measurement_status status;
39909bb7e0f2SJohannes Berg 
39919bb7e0f2SJohannes Berg 	u8 addr[ETH_ALEN];
39929bb7e0f2SJohannes Berg 
39939bb7e0f2SJohannes Berg 	u8 final:1,
39949bb7e0f2SJohannes Berg 	   ap_tsf_valid:1;
39959bb7e0f2SJohannes Berg 
39969bb7e0f2SJohannes Berg 	enum nl80211_peer_measurement_type type;
39979bb7e0f2SJohannes Berg 
39989bb7e0f2SJohannes Berg 	union {
39999bb7e0f2SJohannes Berg 		struct cfg80211_pmsr_ftm_result ftm;
40009bb7e0f2SJohannes Berg 	};
40019bb7e0f2SJohannes Berg };
40029bb7e0f2SJohannes Berg 
40039bb7e0f2SJohannes Berg /**
40049bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_ftm_request_peer - FTM request data
40059bb7e0f2SJohannes Berg  * @requested: indicates FTM is requested
40069bb7e0f2SJohannes Berg  * @preamble: frame preamble to use
40079bb7e0f2SJohannes Berg  * @burst_period: burst period to use
40089bb7e0f2SJohannes Berg  * @asap: indicates to use ASAP mode
40099bb7e0f2SJohannes Berg  * @num_bursts_exp: number of bursts exponent
40109bb7e0f2SJohannes Berg  * @burst_duration: burst duration
40119bb7e0f2SJohannes Berg  * @ftms_per_burst: number of FTMs per burst
40129bb7e0f2SJohannes Berg  * @ftmr_retries: number of retries for FTM request
40139bb7e0f2SJohannes Berg  * @request_lci: request LCI information
40149bb7e0f2SJohannes Berg  * @request_civicloc: request civic location information
4015efb5520dSAvraham Stern  * @trigger_based: use trigger based ranging for the measurement
4016efb5520dSAvraham Stern  *		 If neither @trigger_based nor @non_trigger_based is set,
4017efb5520dSAvraham Stern  *		 EDCA based ranging will be used.
4018efb5520dSAvraham Stern  * @non_trigger_based: use non trigger based ranging for the measurement
4019efb5520dSAvraham Stern  *		 If neither @trigger_based nor @non_trigger_based is set,
4020efb5520dSAvraham Stern  *		 EDCA based ranging will be used.
402173807523SAvraham Stern  * @lmr_feedback: negotiate for I2R LMR feedback. Only valid if either
402273807523SAvraham Stern  *		 @trigger_based or @non_trigger_based is set.
4023dd3e4fc7SAvraham Stern  * @bss_color: the bss color of the responder. Optional. Set to zero to
4024dd3e4fc7SAvraham Stern  *	indicate the driver should set the BSS color. Only valid if
4025dd3e4fc7SAvraham Stern  *	@non_trigger_based or @trigger_based is set.
40269bb7e0f2SJohannes Berg  *
40279bb7e0f2SJohannes Berg  * See also nl80211 for the respective attribute documentation.
40289bb7e0f2SJohannes Berg  */
40299bb7e0f2SJohannes Berg struct cfg80211_pmsr_ftm_request_peer {
40309bb7e0f2SJohannes Berg 	enum nl80211_preamble preamble;
40319bb7e0f2SJohannes Berg 	u16 burst_period;
40329bb7e0f2SJohannes Berg 	u8 requested:1,
40339bb7e0f2SJohannes Berg 	   asap:1,
40349bb7e0f2SJohannes Berg 	   request_lci:1,
4035efb5520dSAvraham Stern 	   request_civicloc:1,
4036efb5520dSAvraham Stern 	   trigger_based:1,
403773807523SAvraham Stern 	   non_trigger_based:1,
403873807523SAvraham Stern 	   lmr_feedback:1;
40399bb7e0f2SJohannes Berg 	u8 num_bursts_exp;
40409bb7e0f2SJohannes Berg 	u8 burst_duration;
40419bb7e0f2SJohannes Berg 	u8 ftms_per_burst;
40429bb7e0f2SJohannes Berg 	u8 ftmr_retries;
4043dd3e4fc7SAvraham Stern 	u8 bss_color;
40449bb7e0f2SJohannes Berg };
40459bb7e0f2SJohannes Berg 
40469bb7e0f2SJohannes Berg /**
40479bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_request_peer - peer data for a peer measurement request
40489bb7e0f2SJohannes Berg  * @addr: MAC address
40499bb7e0f2SJohannes Berg  * @chandef: channel to use
40509bb7e0f2SJohannes Berg  * @report_ap_tsf: report the associated AP's TSF
40519bb7e0f2SJohannes Berg  * @ftm: FTM data, see &struct cfg80211_pmsr_ftm_request_peer
40529bb7e0f2SJohannes Berg  */
40539bb7e0f2SJohannes Berg struct cfg80211_pmsr_request_peer {
40549bb7e0f2SJohannes Berg 	u8 addr[ETH_ALEN];
40559bb7e0f2SJohannes Berg 	struct cfg80211_chan_def chandef;
40569bb7e0f2SJohannes Berg 	u8 report_ap_tsf:1;
40579bb7e0f2SJohannes Berg 	struct cfg80211_pmsr_ftm_request_peer ftm;
40589bb7e0f2SJohannes Berg };
40599bb7e0f2SJohannes Berg 
40609bb7e0f2SJohannes Berg /**
40619bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_request - peer measurement request
40629bb7e0f2SJohannes Berg  * @cookie: cookie, set by cfg80211
40639bb7e0f2SJohannes Berg  * @nl_portid: netlink portid - used by cfg80211
40649bb7e0f2SJohannes Berg  * @drv_data: driver data for this request, if required for aborting,
40659bb7e0f2SJohannes Berg  *	not otherwise freed or anything by cfg80211
40669bb7e0f2SJohannes Berg  * @mac_addr: MAC address used for (randomised) request
40679bb7e0f2SJohannes Berg  * @mac_addr_mask: MAC address mask used for randomisation, bits that
40689bb7e0f2SJohannes Berg  *	are 0 in the mask should be randomised, bits that are 1 should
40699bb7e0f2SJohannes Berg  *	be taken from the @mac_addr
40709bb7e0f2SJohannes Berg  * @list: used by cfg80211 to hold on to the request
40719bb7e0f2SJohannes Berg  * @timeout: timeout (in milliseconds) for the whole operation, if
40729bb7e0f2SJohannes Berg  *	zero it means there's no timeout
40739bb7e0f2SJohannes Berg  * @n_peers: number of peers to do measurements with
40749bb7e0f2SJohannes Berg  * @peers: per-peer measurement request data
40759bb7e0f2SJohannes Berg  */
40769bb7e0f2SJohannes Berg struct cfg80211_pmsr_request {
40779bb7e0f2SJohannes Berg 	u64 cookie;
40789bb7e0f2SJohannes Berg 	void *drv_data;
40799bb7e0f2SJohannes Berg 	u32 n_peers;
40809bb7e0f2SJohannes Berg 	u32 nl_portid;
40819bb7e0f2SJohannes Berg 
40829bb7e0f2SJohannes Berg 	u32 timeout;
40839bb7e0f2SJohannes Berg 
40849bb7e0f2SJohannes Berg 	u8 mac_addr[ETH_ALEN] __aligned(2);
40859bb7e0f2SJohannes Berg 	u8 mac_addr_mask[ETH_ALEN] __aligned(2);
40869bb7e0f2SJohannes Berg 
40879bb7e0f2SJohannes Berg 	struct list_head list;
40889bb7e0f2SJohannes Berg 
4089342bc7c9SKees Cook 	struct cfg80211_pmsr_request_peer peers[] __counted_by(n_peers);
40909bb7e0f2SJohannes Berg };
40919bb7e0f2SJohannes Berg 
40929bb7e0f2SJohannes Berg /**
4093cb74e977SSunil Dutt  * struct cfg80211_update_owe_info - OWE Information
4094cb74e977SSunil Dutt  *
4095cb74e977SSunil Dutt  * This structure provides information needed for the drivers to offload OWE
4096cb74e977SSunil Dutt  * (Opportunistic Wireless Encryption) processing to the user space.
4097cb74e977SSunil Dutt  *
4098cb74e977SSunil Dutt  * Commonly used across update_owe_info request and event interfaces.
4099cb74e977SSunil Dutt  *
4100cb74e977SSunil Dutt  * @peer: MAC address of the peer device for which the OWE processing
4101cb74e977SSunil Dutt  *	has to be done.
4102cb74e977SSunil Dutt  * @status: status code, %WLAN_STATUS_SUCCESS for successful OWE info
4103cb74e977SSunil Dutt  *	processing, use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space
4104cb74e977SSunil Dutt  *	cannot give you the real status code for failures. Used only for
4105cb74e977SSunil Dutt  *	OWE update request command interface (user space to driver).
4106cb74e977SSunil Dutt  * @ie: IEs obtained from the peer or constructed by the user space. These are
4107cb74e977SSunil Dutt  *	the IEs of the remote peer in the event from the host driver and
4108cb74e977SSunil Dutt  *	the constructed IEs by the user space in the request interface.
4109cb74e977SSunil Dutt  * @ie_len: Length of IEs in octets.
41108bb588d9SVeerendranath Jakkam  * @assoc_link_id: MLO link ID of the AP, with which (re)association requested
41118bb588d9SVeerendranath Jakkam  *	by peer. This will be filled by driver for both MLO and non-MLO station
41128bb588d9SVeerendranath Jakkam  *	connections when the AP affiliated with an MLD. For non-MLD AP mode, it
41138bb588d9SVeerendranath Jakkam  *	will be -1. Used only with OWE update event (driver to user space).
41148bb588d9SVeerendranath Jakkam  * @peer_mld_addr: For MLO connection, MLD address of the peer. For non-MLO
41158bb588d9SVeerendranath Jakkam  *	connection, it will be all zeros. This is applicable only when
41168bb588d9SVeerendranath Jakkam  *	@assoc_link_id is not -1, i.e., the AP affiliated with an MLD. Used only
41178bb588d9SVeerendranath Jakkam  *	with OWE update event (driver to user space).
4118cb74e977SSunil Dutt  */
4119cb74e977SSunil Dutt struct cfg80211_update_owe_info {
4120cb74e977SSunil Dutt 	u8 peer[ETH_ALEN] __aligned(2);
4121cb74e977SSunil Dutt 	u16 status;
4122cb74e977SSunil Dutt 	const u8 *ie;
4123cb74e977SSunil Dutt 	size_t ie_len;
41248bb588d9SVeerendranath Jakkam 	int assoc_link_id;
41258bb588d9SVeerendranath Jakkam 	u8 peer_mld_addr[ETH_ALEN] __aligned(2);
4126cb74e977SSunil Dutt };
4127cb74e977SSunil Dutt 
4128cb74e977SSunil Dutt /**
41296cd536feSJohannes Berg  * struct mgmt_frame_regs - management frame registrations data
41306cd536feSJohannes Berg  * @global_stypes: bitmap of management frame subtypes registered
41316cd536feSJohannes Berg  *	for the entire device
41326cd536feSJohannes Berg  * @interface_stypes: bitmap of management frame subtypes registered
41336cd536feSJohannes Berg  *	for the given interface
41342d8b08feSMauro Carvalho Chehab  * @global_mcast_stypes: mcast RX is needed globally for these subtypes
41359dba48a6SJohannes Berg  * @interface_mcast_stypes: mcast RX is needed on this interface
41369dba48a6SJohannes Berg  *	for these subtypes
41376cd536feSJohannes Berg  */
41386cd536feSJohannes Berg struct mgmt_frame_regs {
41396cd536feSJohannes Berg 	u32 global_stypes, interface_stypes;
41409dba48a6SJohannes Berg 	u32 global_mcast_stypes, interface_mcast_stypes;
41416cd536feSJohannes Berg };
41426cd536feSJohannes Berg 
41436cd536feSJohannes Berg /**
4144704232c2SJohannes Berg  * struct cfg80211_ops - backend description for wireless configuration
4145704232c2SJohannes Berg  *
4146704232c2SJohannes Berg  * This struct is registered by fullmac card drivers and/or wireless stacks
4147704232c2SJohannes Berg  * in order to handle configuration requests on their interfaces.
4148704232c2SJohannes Berg  *
4149704232c2SJohannes Berg  * All callbacks except where otherwise noted should return 0
4150704232c2SJohannes Berg  * on success or a negative error code.
4151704232c2SJohannes Berg  *
4152a05829a7SJohannes Berg  * All operations are invoked with the wiphy mutex held. The RTNL may be
4153a05829a7SJohannes Berg  * held in addition (due to wireless extensions) but this cannot be relied
4154a05829a7SJohannes Berg  * upon except in cases where documented below. Note that due to ordering,
4155a05829a7SJohannes Berg  * the RTNL also cannot be acquired in any handlers.
415643fb45cbSJohannes Berg  *
4157ff1b6e69SJohannes Berg  * @suspend: wiphy device needs to be suspended. The variable @wow will
4158ff1b6e69SJohannes Berg  *	be %NULL or contain the enabled Wake-on-Wireless triggers that are
4159ff1b6e69SJohannes Berg  *	configured for the device.
41600378b3f1SJohannes Berg  * @resume: wiphy device needs to be resumed
41616d52563fSJohannes Berg  * @set_wakeup: Called when WoWLAN is enabled/disabled, use this callback
41626d52563fSJohannes Berg  *	to call device_set_wakeup_enable() to enable/disable wakeup from
41636d52563fSJohannes Berg  *	the device.
41640378b3f1SJohannes Berg  *
416560719ffdSJohannes Berg  * @add_virtual_intf: create a new virtual interface with the given name,
4166463d0183SJohannes Berg  *	must set the struct wireless_dev's iftype. Beware: You must create
416784efbb84SJohannes Berg  *	the new netdev in the wiphy's network namespace! Returns the struct
416898104fdeSJohannes Berg  *	wireless_dev, or an ERR_PTR. For P2P device wdevs, the driver must
416998104fdeSJohannes Berg  *	also set the address member in the wdev.
4170a05829a7SJohannes Berg  *	This additionally holds the RTNL to be able to do netdev changes.
4171704232c2SJohannes Berg  *
417284efbb84SJohannes Berg  * @del_virtual_intf: remove the virtual interface
4173a05829a7SJohannes Berg  *	This additionally holds the RTNL to be able to do netdev changes.
417455682965SJohannes Berg  *
417560719ffdSJohannes Berg  * @change_virtual_intf: change type/configuration of virtual interface,
417660719ffdSJohannes Berg  *	keep the struct wireless_dev's iftype updated.
4177a05829a7SJohannes Berg  *	This additionally holds the RTNL to be able to do netdev changes.
417855682965SJohannes Berg  *
4179f2a0290bSJohannes Berg  * @add_intf_link: Add a new MLO link to the given interface. Note that
4180f2a0290bSJohannes Berg  *	the wdev->link[] data structure has been updated, so the new link
4181f2a0290bSJohannes Berg  *	address is available.
4182f2a0290bSJohannes Berg  * @del_intf_link: Remove an MLO link from the given interface.
4183f2a0290bSJohannes Berg  *
418441ade00fSJohannes Berg  * @add_key: add a key with the given parameters. @mac_addr will be %NULL
4185e7a7b84eSVeerendranath Jakkam  *	when adding a group key. @link_id will be -1 for non-MLO connection.
4186e7a7b84eSVeerendranath Jakkam  *	For MLO connection, @link_id will be >= 0 for group key and -1 for
4187e7a7b84eSVeerendranath Jakkam  *	pairwise key, @mac_addr will be peer's MLD address for MLO pairwise key.
418841ade00fSJohannes Berg  *
418941ade00fSJohannes Berg  * @get_key: get information about the key with the given parameters.
419041ade00fSJohannes Berg  *	@mac_addr will be %NULL when requesting information for a group
419141ade00fSJohannes Berg  *	key. All pointers given to the @callback function need not be valid
4192e3da574aSJohannes Berg  *	after it returns. This function should return an error if it is
4193e3da574aSJohannes Berg  *	not possible to retrieve the key, -ENOENT if it doesn't exist.
4194e7a7b84eSVeerendranath Jakkam  *	@link_id will be -1 for non-MLO connection. For MLO connection,
4195e7a7b84eSVeerendranath Jakkam  *	@link_id will be >= 0 for group key and -1 for pairwise key, @mac_addr
4196e7a7b84eSVeerendranath Jakkam  *	will be peer's MLD address for MLO pairwise key.
419741ade00fSJohannes Berg  *
419841ade00fSJohannes Berg  * @del_key: remove a key given the @mac_addr (%NULL for a group key)
4199e7a7b84eSVeerendranath Jakkam  *	and @key_index, return -ENOENT if the key doesn't exist. @link_id will
4200e7a7b84eSVeerendranath Jakkam  *	be -1 for non-MLO connection. For MLO connection, @link_id will be >= 0
4201e7a7b84eSVeerendranath Jakkam  *	for group key and -1 for pairwise key, @mac_addr will be peer's MLD
4202e7a7b84eSVeerendranath Jakkam  *	address for MLO pairwise key.
420341ade00fSJohannes Berg  *
4204e7a7b84eSVeerendranath Jakkam  * @set_default_key: set the default key on an interface. @link_id will be >= 0
4205e7a7b84eSVeerendranath Jakkam  *	for MLO connection and -1 for non-MLO connection.
4206ed1b6cc7SJohannes Berg  *
4207e7a7b84eSVeerendranath Jakkam  * @set_default_mgmt_key: set the default management frame key on an interface.
4208e7a7b84eSVeerendranath Jakkam  *	@link_id will be >= 0 for MLO connection and -1 for non-MLO connection.
42091f7e9f46SJohannes Berg  *
4210e7a7b84eSVeerendranath Jakkam  * @set_default_beacon_key: set the default Beacon frame key on an interface.
4211e7a7b84eSVeerendranath Jakkam  *	@link_id will be >= 0 for MLO connection and -1 for non-MLO connection.
42123cfcf6acSJouni Malinen  *
4213e5497d76SJohannes Berg  * @set_rekey_data: give the data necessary for GTK rekeying to the driver
4214e5497d76SJohannes Berg  *
4215c04a4ff7SJohannes Berg  * @start_ap: Start acting in AP mode defined by the parameters.
4216c04a4ff7SJohannes Berg  * @change_beacon: Change the beacon parameters for an access point mode
4217c04a4ff7SJohannes Berg  *	interface. This should reject the call when AP mode wasn't started.
4218c04a4ff7SJohannes Berg  * @stop_ap: Stop being an AP, including stopping beaconing.
42195727ef1bSJohannes Berg  *
42205727ef1bSJohannes Berg  * @add_station: Add a new station.
422189c771e5SJouni Malinen  * @del_station: Remove a station
4222bdd90d5eSJohannes Berg  * @change_station: Modify a given station. Note that flags changes are not much
4223bdd90d5eSJohannes Berg  *	validated in cfg80211, in particular the auth/assoc/authorized flags
4224bdd90d5eSJohannes Berg  *	might come to the driver in invalid combinations -- make sure to check
422577ee7c89SJohannes Berg  *	them, also against the existing state! Drivers must call
422677ee7c89SJohannes Berg  *	cfg80211_check_station_change() to validate the information.
4227abe37c4bSJohannes Berg  * @get_station: get station information for the station identified by @mac
4228abe37c4bSJohannes Berg  * @dump_station: dump station callback -- resume dump at index @idx
4229abe37c4bSJohannes Berg  *
4230abe37c4bSJohannes Berg  * @add_mpath: add a fixed mesh path
4231abe37c4bSJohannes Berg  * @del_mpath: delete a given mesh path
4232abe37c4bSJohannes Berg  * @change_mpath: change a given mesh path
4233abe37c4bSJohannes Berg  * @get_mpath: get a mesh path for the given parameters
4234abe37c4bSJohannes Berg  * @dump_mpath: dump mesh path callback -- resume dump at index @idx
423566be7d2bSHenning Rogge  * @get_mpp: get a mesh proxy path for the given parameters
423666be7d2bSHenning Rogge  * @dump_mpp: dump mesh proxy path callback -- resume dump at index @idx
4237f52555a4SJohannes Berg  * @join_mesh: join the mesh network with the specified parameters
42388d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
4239f52555a4SJohannes Berg  * @leave_mesh: leave the current mesh network
42408d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
42412ec600d6SLuis Carlos Cobo  *
424224bdd9f4SJavier Cardona  * @get_mesh_config: Get the current mesh configuration
424393da9cc1Scolin@cozybit.com  *
424424bdd9f4SJavier Cardona  * @update_mesh_config: Update mesh parameters on a running mesh.
424593da9cc1Scolin@cozybit.com  *	The mask is a bitfield which tells us which parameters to
424693da9cc1Scolin@cozybit.com  *	set, and which to leave alone.
424793da9cc1Scolin@cozybit.com  *
42489f1ba906SJouni Malinen  * @change_bss: Modify parameters for a given BSS.
424931888487SJouni Malinen  *
42505db25290SBenjamin Berg  * @inform_bss: Called by cfg80211 while being informed about new BSS data
42515db25290SBenjamin Berg  *	for every BSS found within the reported data or frame. This is called
42525db25290SBenjamin Berg  *	from within the cfg8011 inform_bss handlers while holding the bss_lock.
42535db25290SBenjamin Berg  *	The data parameter is passed through from drv_data inside
42545db25290SBenjamin Berg  *	struct cfg80211_inform_bss.
42555db25290SBenjamin Berg  *	The new IE data for the BSS is explicitly passed.
42565db25290SBenjamin Berg  *
425731888487SJouni Malinen  * @set_txq_params: Set TX queue parameters
425872bdcf34SJouni Malinen  *
4259e8c9bd5bSJohannes Berg  * @libertas_set_mesh_channel: Only for backward compatibility for libertas,
4260e8c9bd5bSJohannes Berg  *	as it doesn't implement join_mesh and needs to set the channel to
4261e8c9bd5bSJohannes Berg  *	join the mesh instead.
4262e8c9bd5bSJohannes Berg  *
4263e8c9bd5bSJohannes Berg  * @set_monitor_channel: Set the monitor mode channel for the device. If other
4264e8c9bd5bSJohannes Berg  *	interfaces are active this callback should reject the configuration.
4265e8c9bd5bSJohannes Berg  *	If no interfaces are active or the device is down, the channel should
4266e8c9bd5bSJohannes Berg  *	be stored for when a monitor interface becomes active.
42679aed3cc1SJouni Malinen  *
42682a519311SJohannes Berg  * @scan: Request to do a scan. If returning zero, the scan request is given
42692a519311SJohannes Berg  *	the driver, and will be valid until passed to cfg80211_scan_done().
42702a519311SJohannes Berg  *	For scan results, call cfg80211_inform_bss(); you can call this outside
42712a519311SJohannes Berg  *	the scan/scan_done bracket too.
427291d3ab46SVidyullatha Kanchanapally  * @abort_scan: Tell the driver to abort an ongoing scan. The driver shall
427391d3ab46SVidyullatha Kanchanapally  *	indicate the status of the scan through cfg80211_scan_done().
4274636a5d36SJouni Malinen  *
4275636a5d36SJouni Malinen  * @auth: Request to authenticate with the specified peer
42768d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
4277636a5d36SJouni Malinen  * @assoc: Request to (re)associate with the specified peer
42788d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
4279636a5d36SJouni Malinen  * @deauth: Request to deauthenticate from the specified peer
42808d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
4281636a5d36SJouni Malinen  * @disassoc: Request to disassociate from the specified peer
42828d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
428304a773adSJohannes Berg  *
4284b23aa676SSamuel Ortiz  * @connect: Connect to the ESS with the specified parameters. When connected,
4285bf1ecd21SJouni Malinen  *	call cfg80211_connect_result()/cfg80211_connect_bss() with status code
4286bf1ecd21SJouni Malinen  *	%WLAN_STATUS_SUCCESS. If the connection fails for some reason, call
4287bf1ecd21SJouni Malinen  *	cfg80211_connect_result()/cfg80211_connect_bss() with the status code
4288bf1ecd21SJouni Malinen  *	from the AP or cfg80211_connect_timeout() if no frame with status code
4289bf1ecd21SJouni Malinen  *	was received.
4290bf1ecd21SJouni Malinen  *	The driver is allowed to roam to other BSSes within the ESS when the
4291bf1ecd21SJouni Malinen  *	other BSS matches the connect parameters. When such roaming is initiated
4292bf1ecd21SJouni Malinen  *	by the driver, the driver is expected to verify that the target matches
4293bf1ecd21SJouni Malinen  *	the configured security parameters and to use Reassociation Request
4294bf1ecd21SJouni Malinen  *	frame instead of Association Request frame.
4295bf1ecd21SJouni Malinen  *	The connect function can also be used to request the driver to perform a
4296bf1ecd21SJouni Malinen  *	specific roam when connected to an ESS. In that case, the prev_bssid
429735eb8f7bSJouni Malinen  *	parameter is set to the BSSID of the currently associated BSS as an
4298bf1ecd21SJouni Malinen  *	indication of requesting reassociation.
4299bf1ecd21SJouni Malinen  *	In both the driver-initiated and new connect() call initiated roaming
4300bf1ecd21SJouni Malinen  *	cases, the result of roaming is indicated with a call to
430129ce6ecbSAvraham Stern  *	cfg80211_roamed(). (invoked with the wireless_dev mutex held)
4302088e8df8Svamsi krishna  * @update_connect_params: Update the connect parameters while connected to a
4303088e8df8Svamsi krishna  *	BSS. The updated parameters can be used by driver/firmware for
4304088e8df8Svamsi krishna  *	subsequent BSS selection (roaming) decisions and to form the
4305088e8df8Svamsi krishna  *	Authentication/(Re)Association Request frames. This call does not
4306088e8df8Svamsi krishna  *	request an immediate disassociation or reassociation with the current
4307088e8df8Svamsi krishna  *	BSS, i.e., this impacts only subsequent (re)associations. The bits in
4308088e8df8Svamsi krishna  *	changed are defined in &enum cfg80211_connect_params_changed.
4309088e8df8Svamsi krishna  *	(invoked with the wireless_dev mutex held)
43100711d638SIlan Peer  * @disconnect: Disconnect from the BSS/ESS or stop connection attempts if
43110711d638SIlan Peer  *      connection is in progress. Once done, call cfg80211_disconnected() in
43120711d638SIlan Peer  *      case connection was already established (invoked with the
43130711d638SIlan Peer  *      wireless_dev mutex held), otherwise call cfg80211_connect_timeout().
4314b23aa676SSamuel Ortiz  *
431504a773adSJohannes Berg  * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call
431604a773adSJohannes Berg  *	cfg80211_ibss_joined(), also call that function when changing BSSID due
431704a773adSJohannes Berg  *	to a merge.
43188d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
431904a773adSJohannes Berg  * @leave_ibss: Leave the IBSS.
43208d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
4321b9a5f8caSJouni Malinen  *
4322f4e583c8SAntonio Quartulli  * @set_mcast_rate: Set the specified multicast rate (only if vif is in ADHOC or
4323f4e583c8SAntonio Quartulli  *	MESH mode)
4324f4e583c8SAntonio Quartulli  *
4325b9a5f8caSJouni Malinen  * @set_wiphy_params: Notify that wiphy parameters have changed;
4326b9a5f8caSJouni Malinen  *	@changed bitfield (see &enum wiphy_params_flags) describes which values
4327b9a5f8caSJouni Malinen  *	have changed. The actual parameter values are available in
4328b9a5f8caSJouni Malinen  *	struct wiphy. If returning an error, no value should be changed.
43297643a2c3SJohannes Berg  *
43301432de07SLuis R. Rodriguez  * @set_tx_power: set the transmit power according to the parameters,
4331c8442118SJohannes Berg  *	the power passed is in mBm, to get dBm use MBM_TO_DBM(). The
4332c8442118SJohannes Berg  *	wdev may be %NULL if power was set for the wiphy, and will
4333c8442118SJohannes Berg  *	always be %NULL unless the driver supports per-vif TX power
4334c8442118SJohannes Berg  *	(as advertised by the nl80211 feature flag.)
43357643a2c3SJohannes Berg  * @get_tx_power: store the current TX power into the dbm variable;
43361f87f7d3SJohannes Berg  *	return 0 if successful
43371f87f7d3SJohannes Berg  *
43381f87f7d3SJohannes Berg  * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting
43391f87f7d3SJohannes Berg  *	functions to adjust rfkill hw state
4340aff89a9bSJohannes Berg  *
434161fa713cSHolger Schurig  * @dump_survey: get site survey information.
434261fa713cSHolger Schurig  *
43439588bbd5SJouni Malinen  * @remain_on_channel: Request the driver to remain awake on the specified
43449588bbd5SJouni Malinen  *	channel for the specified duration to complete an off-channel
43459588bbd5SJouni Malinen  *	operation (e.g., public action frame exchange). When the driver is
43469588bbd5SJouni Malinen  *	ready on the requested channel, it must indicate this with an event
43479588bbd5SJouni Malinen  *	notification by calling cfg80211_ready_on_channel().
43489588bbd5SJouni Malinen  * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation.
43499588bbd5SJouni Malinen  *	This allows the operation to be terminated prior to timeout based on
43509588bbd5SJouni Malinen  *	the duration value.
4351f7ca38dfSJohannes Berg  * @mgmt_tx: Transmit a management frame.
4352f7ca38dfSJohannes Berg  * @mgmt_tx_cancel_wait: Cancel the wait time from transmitting a management
4353f7ca38dfSJohannes Berg  *	frame on another channel
43549588bbd5SJouni Malinen  *
4355fc73f11fSDavid Spinadel  * @testmode_cmd: run a test mode command; @wdev may be %NULL
435671063f0eSWey-Yi Guy  * @testmode_dump: Implement a test mode dump. The cb->args[2] and up may be
435771063f0eSWey-Yi Guy  *	used by the function, but 0 and 1 must not be touched. Additionally,
435871063f0eSWey-Yi Guy  *	return error codes other than -ENOBUFS and -ENOENT will terminate the
435971063f0eSWey-Yi Guy  *	dump and return to userspace with an error, so be careful. If any data
436071063f0eSWey-Yi Guy  *	was passed in from userspace then the data/len arguments will be present
436171063f0eSWey-Yi Guy  *	and point to the data contained in %NL80211_ATTR_TESTDATA.
436267fbb16bSSamuel Ortiz  *
4363abe37c4bSJohannes Berg  * @set_bitrate_mask: set the bitrate mask configuration
4364abe37c4bSJohannes Berg  *
436567fbb16bSSamuel Ortiz  * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac
436667fbb16bSSamuel Ortiz  *	devices running firmwares capable of generating the (re) association
436767fbb16bSSamuel Ortiz  *	RSN IE. It allows for faster roaming between WPA2 BSSIDs.
436867fbb16bSSamuel Ortiz  * @del_pmksa: Delete a cached PMKID.
436967fbb16bSSamuel Ortiz  * @flush_pmksa: Flush all cached PMKIDs.
43709043f3b8SJuuso Oikarinen  * @set_power_mgmt: Configure WLAN power management. A timeout value of -1
43719043f3b8SJuuso Oikarinen  *	allows the driver to adjust the dynamic ps timeout value.
4372d6dc1a38SJuuso Oikarinen  * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold.
4373e86abc68SJohannes Berg  *	After configuration, the driver should (soon) send an event indicating
4374e86abc68SJohannes Berg  *	the current level is above/below the configured threshold; this may
4375e86abc68SJohannes Berg  *	need some care when the configuration is changed (without first being
4376e86abc68SJohannes Berg  *	disabled.)
43774a4b8169SAndrew Zaborowski  * @set_cqm_rssi_range_config: Configure two RSSI thresholds in the
43784a4b8169SAndrew Zaborowski  *	connection quality monitor.  An event is to be sent only when the
43794a4b8169SAndrew Zaborowski  *	signal level is found to be outside the two values.  The driver should
43804a4b8169SAndrew Zaborowski  *	set %NL80211_EXT_FEATURE_CQM_RSSI_LIST if this method is implemented.
43814a4b8169SAndrew Zaborowski  *	If it is provided then there's no point providing @set_cqm_rssi_config.
438284f10708SThomas Pedersen  * @set_cqm_txe_config: Configure connection quality monitor TX error
438384f10708SThomas Pedersen  *	thresholds.
4384807f8a8cSLuciano Coelho  * @sched_scan_start: Tell the driver to start a scheduled scan.
43853a3ecf1dSArend Van Spriel  * @sched_scan_stop: Tell the driver to stop an ongoing scheduled scan with
43863a3ecf1dSArend Van Spriel  *	given request id. This call must stop the scheduled scan and be ready
43873a3ecf1dSArend Van Spriel  *	for starting a new one before it returns, i.e. @sched_scan_start may be
43883a3ecf1dSArend Van Spriel  *	called immediately after that again and should not fail in that case.
43893a3ecf1dSArend Van Spriel  *	The driver should not call cfg80211_sched_scan_stopped() for a requested
43903a3ecf1dSArend Van Spriel  *	stop (when this method returns 0).
439167fbb16bSSamuel Ortiz  *
43926cd536feSJohannes Berg  * @update_mgmt_frame_registrations: Notify the driver that management frame
43936cd536feSJohannes Berg  *	registrations were updated. The callback is allowed to sleep.
4394547025d5SBruno Randolf  *
4395547025d5SBruno Randolf  * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device.
4396547025d5SBruno Randolf  *	Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may
4397547025d5SBruno Randolf  *	reject TX/RX mask combinations they cannot support by returning -EINVAL
4398547025d5SBruno Randolf  *	(also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX).
4399547025d5SBruno Randolf  *
4400547025d5SBruno Randolf  * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant).
44013677713bSJohn W. Linville  *
4402109086ceSArik Nemtsov  * @tdls_mgmt: Transmit a TDLS management frame.
4403109086ceSArik Nemtsov  * @tdls_oper: Perform a high-level TDLS operation (e.g. TDLS link setup).
44047f6cf311SJohannes Berg  *
44057f6cf311SJohannes Berg  * @probe_client: probe an associated client, must return a cookie that it
44067f6cf311SJohannes Berg  *	later passes to cfg80211_probe_status().
44071d9d9213SSimon Wunderlich  *
44081d9d9213SSimon Wunderlich  * @set_noack_map: Set the NoAck Map for the TIDs.
4409d6199218SBen Greear  *
44105b7ccaf3SJohannes Berg  * @get_channel: Get the current operating channel for the virtual interface.
44115b7ccaf3SJohannes Berg  *	For monitor interfaces, it should return %NULL unless there's a single
44125b7ccaf3SJohannes Berg  *	current monitoring channel.
441398104fdeSJohannes Berg  *
441498104fdeSJohannes Berg  * @start_p2p_device: Start the given P2P device.
441598104fdeSJohannes Berg  * @stop_p2p_device: Stop the given P2P device.
441677765eafSVasanthakumar Thiagarajan  *
441777765eafSVasanthakumar Thiagarajan  * @set_mac_acl: Sets MAC address control list in AP and P2P GO mode.
441877765eafSVasanthakumar Thiagarajan  *	Parameters include ACL policy, an array of MAC address of stations
441977765eafSVasanthakumar Thiagarajan  *	and the number of MAC addresses. If there is already a list in driver
442077765eafSVasanthakumar Thiagarajan  *	this new list replaces the existing one. Driver has to clear its ACL
442177765eafSVasanthakumar Thiagarajan  *	when number of MAC addresses entries is passed as 0. Drivers which
442277765eafSVasanthakumar Thiagarajan  *	advertise the support for MAC based ACL have to implement this callback.
442304f39047SSimon Wunderlich  *
442404f39047SSimon Wunderlich  * @start_radar_detection: Start radar detection in the driver.
44258bf24293SJouni Malinen  *
442626ec17a1SOrr Mazor  * @end_cac: End running CAC, probably because a related CAC
442726ec17a1SOrr Mazor  *	was finished on another phy.
442826ec17a1SOrr Mazor  *
44298bf24293SJouni Malinen  * @update_ft_ies: Provide updated Fast BSS Transition information to the
44308bf24293SJouni Malinen  *	driver. If the SME is in the driver/firmware, this information can be
44318bf24293SJouni Malinen  *	used in building Authentication and Reassociation Request frames.
44325de17984SArend van Spriel  *
44335de17984SArend van Spriel  * @crit_proto_start: Indicates a critical protocol needs more link reliability
44345de17984SArend van Spriel  *	for a given duration (milliseconds). The protocol is provided so the
44355de17984SArend van Spriel  *	driver can take the most appropriate actions.
44365de17984SArend van Spriel  * @crit_proto_stop: Indicates critical protocol no longer needs increased link
44375de17984SArend van Spriel  *	reliability. This operation can not fail.
4438be29b99aSAmitkumar Karwar  * @set_coalesce: Set coalesce parameters.
443916ef1fe2SSimon Wunderlich  *
444097dc94f1SMichal Kazior  * @channel_switch: initiate channel-switch procedure (with CSA). Driver is
444197dc94f1SMichal Kazior  *	responsible for veryfing if the switch is possible. Since this is
444297dc94f1SMichal Kazior  *	inherently tricky driver may decide to disconnect an interface later
444397dc94f1SMichal Kazior  *	with cfg80211_stop_iface(). This doesn't mean driver can accept
444497dc94f1SMichal Kazior  *	everything. It should do it's best to verify requests and reject them
444597dc94f1SMichal Kazior  *	as soon as possible.
4446fa9ffc74SKyeyoon Park  *
4447fa9ffc74SKyeyoon Park  * @set_qos_map: Set QoS mapping information to the driver
4448e16821bcSJouni Malinen  *
4449e16821bcSJouni Malinen  * @set_ap_chanwidth: Set the AP (including P2P GO) mode channel width for the
4450e16821bcSJouni Malinen  *	given interface This is used e.g. for dynamic HT 20/40 MHz channel width
4451e16821bcSJouni Malinen  *	changes during the lifetime of the BSS.
4452960d01acSJohannes Berg  *
4453960d01acSJohannes Berg  * @add_tx_ts: validate (if admitted_time is 0) or add a TX TS to the device
4454960d01acSJohannes Berg  *	with the given parameters; action frame exchange has been handled by
4455960d01acSJohannes Berg  *	userspace so this just has to modify the TX path to take the TS into
4456960d01acSJohannes Berg  *	account.
4457960d01acSJohannes Berg  *	If the admitted time is 0 just validate the parameters to make sure
4458960d01acSJohannes Berg  *	the session can be created at all; it is valid to just always return
4459960d01acSJohannes Berg  *	success for that but that may result in inefficient behaviour (handshake
4460960d01acSJohannes Berg  *	with the peer followed by immediate teardown when the addition is later
4461960d01acSJohannes Berg  *	rejected)
4462960d01acSJohannes Berg  * @del_tx_ts: remove an existing TX TS
44636e0bd6c3SRostislav Lisovy  *
44646e0bd6c3SRostislav Lisovy  * @join_ocb: join the OCB network with the specified parameters
44656e0bd6c3SRostislav Lisovy  *	(invoked with the wireless_dev mutex held)
44666e0bd6c3SRostislav Lisovy  * @leave_ocb: leave the current OCB network
44676e0bd6c3SRostislav Lisovy  *	(invoked with the wireless_dev mutex held)
44681057d35eSArik Nemtsov  *
44691057d35eSArik Nemtsov  * @tdls_channel_switch: Start channel-switching with a TDLS peer. The driver
44701057d35eSArik Nemtsov  *	is responsible for continually initiating channel-switching operations
44711057d35eSArik Nemtsov  *	and returning to the base channel for communication with the AP.
44721057d35eSArik Nemtsov  * @tdls_cancel_channel_switch: Stop channel-switching with a TDLS peer. Both
44731057d35eSArik Nemtsov  *	peers must be on the base channel when the call completes.
4474cb3b7d87SAyala Beker  * @start_nan: Start the NAN interface.
4475cb3b7d87SAyala Beker  * @stop_nan: Stop the NAN interface.
4476a442b761SAyala Beker  * @add_nan_func: Add a NAN function. Returns negative value on failure.
4477a442b761SAyala Beker  *	On success @nan_func ownership is transferred to the driver and
4478a442b761SAyala Beker  *	it may access it outside of the scope of this function. The driver
4479a442b761SAyala Beker  *	should free the @nan_func when no longer needed by calling
4480a442b761SAyala Beker  *	cfg80211_free_nan_func().
4481a442b761SAyala Beker  *	On success the driver should assign an instance_id in the
4482a442b761SAyala Beker  *	provided @nan_func.
4483a442b761SAyala Beker  * @del_nan_func: Delete a NAN function.
4484a5a9dcf2SAyala Beker  * @nan_change_conf: changes NAN configuration. The changed parameters must
4485a5a9dcf2SAyala Beker  *	be specified in @changes (using &enum cfg80211_nan_conf_changes);
4486a5a9dcf2SAyala Beker  *	All other parameters must be ignored.
4487ce0ce13aSMichael Braun  *
4488ce0ce13aSMichael Braun  * @set_multicast_to_unicast: configure multicast to unicast conversion for BSS
44893a00df57SAvraham Stern  *
449052539ca8SToke Høiland-Jørgensen  * @get_txq_stats: Get TXQ stats for interface or phy. If wdev is %NULL, this
449152539ca8SToke Høiland-Jørgensen  *      function should return phy stats, and interface stats otherwise.
449252539ca8SToke Høiland-Jørgensen  *
44933a00df57SAvraham Stern  * @set_pmk: configure the PMK to be used for offloaded 802.1X 4-Way handshake.
44943a00df57SAvraham Stern  *	If not deleted through @del_pmk the PMK remains valid until disconnect
44953a00df57SAvraham Stern  *	upon which the driver should clear it.
44963a00df57SAvraham Stern  *	(invoked with the wireless_dev mutex held)
44973a00df57SAvraham Stern  * @del_pmk: delete the previously configured PMK for the given authenticator.
44983a00df57SAvraham Stern  *	(invoked with the wireless_dev mutex held)
449940cbfa90SSrinivas Dasari  *
450040cbfa90SSrinivas Dasari  * @external_auth: indicates result of offloaded authentication processing from
450140cbfa90SSrinivas Dasari  *     user space
45022576a9acSDenis Kenzior  *
45032576a9acSDenis Kenzior  * @tx_control_port: TX a control port frame (EAPoL).  The noencrypt parameter
45042576a9acSDenis Kenzior  *	tells the driver that the frame should not be encrypted.
450581e54d08SPradeep Kumar Chitrapu  *
450681e54d08SPradeep Kumar Chitrapu  * @get_ftm_responder_stats: Retrieve FTM responder statistics, if available.
450781e54d08SPradeep Kumar Chitrapu  *	Statistics should be cumulative, currently no way to reset is provided.
45089bb7e0f2SJohannes Berg  * @start_pmsr: start peer measurement (e.g. FTM)
45099bb7e0f2SJohannes Berg  * @abort_pmsr: abort peer measurement
4510cb74e977SSunil Dutt  *
4511cb74e977SSunil Dutt  * @update_owe_info: Provide updated OWE info to driver. Driver implementing SME
4512cb74e977SSunil Dutt  *	but offloading OWE processing to the user space will get the updated
4513cb74e977SSunil Dutt  *	DH IE through this interface.
45145ab92e7fSRajkumar Manoharan  *
45155ab92e7fSRajkumar Manoharan  * @probe_mesh_link: Probe direct Mesh peer's link quality by sending data frame
45165ab92e7fSRajkumar Manoharan  *	and overrule HWMP path selection algorithm.
451777f576deSTamizh chelvam  * @set_tid_config: TID specific configuration, this can be peer or BSS specific
451877f576deSTamizh chelvam  *	This callback may sleep.
45193710a8a6SJohannes Berg  * @reset_tid_config: Reset TID specific configuration for the peer, for the
45203710a8a6SJohannes Berg  *	given TIDs. This callback may sleep.
452170b6ff35SJohannes Berg  *
452270b6ff35SJohannes Berg  * @set_sar_specs: Update the SAR (TX power) settings.
45230d2ab3aeSJohn Crispin  *
45240d2ab3aeSJohn Crispin  * @color_change: Initiate a color change.
4525e306784aSSubrat Mishra  *
4526e306784aSSubrat Mishra  * @set_fils_aad: Set FILS AAD data to the AP driver so that the driver can use
4527e306784aSSubrat Mishra  *	those to decrypt (Re)Association Request and encrypt (Re)Association
4528e306784aSSubrat Mishra  *	Response frame.
4529bc2dfc02SLorenzo Bianconi  *
4530a95bfb87SLorenzo Bianconi  * @set_radar_background: Configure dedicated offchannel chain available for
4531bc2dfc02SLorenzo Bianconi  *	radar/CAC detection on some hw. This chain can't be used to transmit
4532bc2dfc02SLorenzo Bianconi  *	or receive frames and it is bounded to a running wdev.
4533a95bfb87SLorenzo Bianconi  *	Background radar/CAC detection allows to avoid the CAC downtime
4534bc2dfc02SLorenzo Bianconi  *	switching to a different channel during CAC detection on the selected
4535bc2dfc02SLorenzo Bianconi  *	radar channel.
4536bc2dfc02SLorenzo Bianconi  *	The caller is expected to set chandef pointer to NULL in order to
4537a95bfb87SLorenzo Bianconi  *	disable background CAC/radar detection.
4538577e5b8cSShaul Triebitz  * @add_link_station: Add a link to a station.
4539577e5b8cSShaul Triebitz  * @mod_link_station: Modify a link of a station.
4540577e5b8cSShaul Triebitz  * @del_link_station: Remove a link of a station.
4541cbbaf2bbSAvraham Stern  *
4542cbbaf2bbSAvraham Stern  * @set_hw_timestamp: Enable/disable HW timestamping of TM/FTM frames.
4543b61e6b41SIlan Peer  * @set_ttlm: set the TID to link mapping.
4544704232c2SJohannes Berg  */
4545704232c2SJohannes Berg struct cfg80211_ops {
4546ff1b6e69SJohannes Berg 	int	(*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
45470378b3f1SJohannes Berg 	int	(*resume)(struct wiphy *wiphy);
45486d52563fSJohannes Berg 	void	(*set_wakeup)(struct wiphy *wiphy, bool enabled);
45490378b3f1SJohannes Berg 
455084efbb84SJohannes Berg 	struct wireless_dev * (*add_virtual_intf)(struct wiphy *wiphy,
4551552bff0cSJohannes Berg 						  const char *name,
45526bab2e19STom Gundersen 						  unsigned char name_assign_type,
4553f9e10ce4SJohannes Berg 						  enum nl80211_iftype type,
45542ec600d6SLuis Carlos Cobo 						  struct vif_params *params);
455584efbb84SJohannes Berg 	int	(*del_virtual_intf)(struct wiphy *wiphy,
455684efbb84SJohannes Berg 				    struct wireless_dev *wdev);
4557e36d56b6SJohannes Berg 	int	(*change_virtual_intf)(struct wiphy *wiphy,
4558e36d56b6SJohannes Berg 				       struct net_device *dev,
4559818a986eSJohannes Berg 				       enum nl80211_iftype type,
45602ec600d6SLuis Carlos Cobo 				       struct vif_params *params);
456141ade00fSJohannes Berg 
4562f2a0290bSJohannes Berg 	int	(*add_intf_link)(struct wiphy *wiphy,
4563f2a0290bSJohannes Berg 				 struct wireless_dev *wdev,
4564f2a0290bSJohannes Berg 				 unsigned int link_id);
4565f2a0290bSJohannes Berg 	void	(*del_intf_link)(struct wiphy *wiphy,
4566f2a0290bSJohannes Berg 				 struct wireless_dev *wdev,
4567f2a0290bSJohannes Berg 				 unsigned int link_id);
4568f2a0290bSJohannes Berg 
456941ade00fSJohannes Berg 	int	(*add_key)(struct wiphy *wiphy, struct net_device *netdev,
4570e7a7b84eSVeerendranath Jakkam 			   int link_id, u8 key_index, bool pairwise,
4571e7a7b84eSVeerendranath Jakkam 			   const u8 *mac_addr, struct key_params *params);
457241ade00fSJohannes Berg 	int	(*get_key)(struct wiphy *wiphy, struct net_device *netdev,
4573e7a7b84eSVeerendranath Jakkam 			   int link_id, u8 key_index, bool pairwise,
4574e7a7b84eSVeerendranath Jakkam 			   const u8 *mac_addr, void *cookie,
457541ade00fSJohannes Berg 			   void (*callback)(void *cookie, struct key_params*));
457641ade00fSJohannes Berg 	int	(*del_key)(struct wiphy *wiphy, struct net_device *netdev,
4577e7a7b84eSVeerendranath Jakkam 			   int link_id, u8 key_index, bool pairwise,
4578e7a7b84eSVeerendranath Jakkam 			   const u8 *mac_addr);
457941ade00fSJohannes Berg 	int	(*set_default_key)(struct wiphy *wiphy,
4580e7a7b84eSVeerendranath Jakkam 				   struct net_device *netdev, int link_id,
4581dbd2fd65SJohannes Berg 				   u8 key_index, bool unicast, bool multicast);
45823cfcf6acSJouni Malinen 	int	(*set_default_mgmt_key)(struct wiphy *wiphy,
4583e7a7b84eSVeerendranath Jakkam 					struct net_device *netdev, int link_id,
45843cfcf6acSJouni Malinen 					u8 key_index);
458556be393fSJouni Malinen 	int	(*set_default_beacon_key)(struct wiphy *wiphy,
458656be393fSJouni Malinen 					  struct net_device *netdev,
4587e7a7b84eSVeerendranath Jakkam 					  int link_id,
458856be393fSJouni Malinen 					  u8 key_index);
4589ed1b6cc7SJohannes Berg 
45908860020eSJohannes Berg 	int	(*start_ap)(struct wiphy *wiphy, struct net_device *dev,
45918860020eSJohannes Berg 			    struct cfg80211_ap_settings *settings);
45928860020eSJohannes Berg 	int	(*change_beacon)(struct wiphy *wiphy, struct net_device *dev,
4593bb55441cSJohannes Berg 				 struct cfg80211_ap_update *info);
45947b0a0e3cSJohannes Berg 	int	(*stop_ap)(struct wiphy *wiphy, struct net_device *dev,
45957b0a0e3cSJohannes Berg 			   unsigned int link_id);
45965727ef1bSJohannes Berg 
45975727ef1bSJohannes Berg 
45985727ef1bSJohannes Berg 	int	(*add_station)(struct wiphy *wiphy, struct net_device *dev,
45993b3a0162SJohannes Berg 			       const u8 *mac,
46003b3a0162SJohannes Berg 			       struct station_parameters *params);
46015727ef1bSJohannes Berg 	int	(*del_station)(struct wiphy *wiphy, struct net_device *dev,
460289c771e5SJouni Malinen 			       struct station_del_parameters *params);
46035727ef1bSJohannes Berg 	int	(*change_station)(struct wiphy *wiphy, struct net_device *dev,
46043b3a0162SJohannes Berg 				  const u8 *mac,
46053b3a0162SJohannes Berg 				  struct station_parameters *params);
4606fd5b74dcSJohannes Berg 	int	(*get_station)(struct wiphy *wiphy, struct net_device *dev,
46073b3a0162SJohannes Berg 			       const u8 *mac, struct station_info *sinfo);
46082ec600d6SLuis Carlos Cobo 	int	(*dump_station)(struct wiphy *wiphy, struct net_device *dev,
46092ec600d6SLuis Carlos Cobo 				int idx, u8 *mac, struct station_info *sinfo);
46102ec600d6SLuis Carlos Cobo 
46112ec600d6SLuis Carlos Cobo 	int	(*add_mpath)(struct wiphy *wiphy, struct net_device *dev,
46123b3a0162SJohannes Berg 			       const u8 *dst, const u8 *next_hop);
46132ec600d6SLuis Carlos Cobo 	int	(*del_mpath)(struct wiphy *wiphy, struct net_device *dev,
46143b3a0162SJohannes Berg 			       const u8 *dst);
46152ec600d6SLuis Carlos Cobo 	int	(*change_mpath)(struct wiphy *wiphy, struct net_device *dev,
46163b3a0162SJohannes Berg 				  const u8 *dst, const u8 *next_hop);
46172ec600d6SLuis Carlos Cobo 	int	(*get_mpath)(struct wiphy *wiphy, struct net_device *dev,
46183b3a0162SJohannes Berg 			     u8 *dst, u8 *next_hop, struct mpath_info *pinfo);
46192ec600d6SLuis Carlos Cobo 	int	(*dump_mpath)(struct wiphy *wiphy, struct net_device *dev,
46202ec600d6SLuis Carlos Cobo 			      int idx, u8 *dst, u8 *next_hop,
46212ec600d6SLuis Carlos Cobo 			      struct mpath_info *pinfo);
462266be7d2bSHenning Rogge 	int	(*get_mpp)(struct wiphy *wiphy, struct net_device *dev,
462366be7d2bSHenning Rogge 			   u8 *dst, u8 *mpp, struct mpath_info *pinfo);
462466be7d2bSHenning Rogge 	int	(*dump_mpp)(struct wiphy *wiphy, struct net_device *dev,
462566be7d2bSHenning Rogge 			    int idx, u8 *dst, u8 *mpp,
462666be7d2bSHenning Rogge 			    struct mpath_info *pinfo);
462724bdd9f4SJavier Cardona 	int	(*get_mesh_config)(struct wiphy *wiphy,
462893da9cc1Scolin@cozybit.com 				struct net_device *dev,
462993da9cc1Scolin@cozybit.com 				struct mesh_config *conf);
463024bdd9f4SJavier Cardona 	int	(*update_mesh_config)(struct wiphy *wiphy,
463129cbe68cSJohannes Berg 				      struct net_device *dev, u32 mask,
463229cbe68cSJohannes Berg 				      const struct mesh_config *nconf);
463329cbe68cSJohannes Berg 	int	(*join_mesh)(struct wiphy *wiphy, struct net_device *dev,
463429cbe68cSJohannes Berg 			     const struct mesh_config *conf,
463529cbe68cSJohannes Berg 			     const struct mesh_setup *setup);
463629cbe68cSJohannes Berg 	int	(*leave_mesh)(struct wiphy *wiphy, struct net_device *dev);
463729cbe68cSJohannes Berg 
46386e0bd6c3SRostislav Lisovy 	int	(*join_ocb)(struct wiphy *wiphy, struct net_device *dev,
46396e0bd6c3SRostislav Lisovy 			    struct ocb_setup *setup);
46406e0bd6c3SRostislav Lisovy 	int	(*leave_ocb)(struct wiphy *wiphy, struct net_device *dev);
46416e0bd6c3SRostislav Lisovy 
46429f1ba906SJouni Malinen 	int	(*change_bss)(struct wiphy *wiphy, struct net_device *dev,
46439f1ba906SJouni Malinen 			      struct bss_parameters *params);
464431888487SJouni Malinen 
46455db25290SBenjamin Berg 	void	(*inform_bss)(struct wiphy *wiphy, struct cfg80211_bss *bss,
46465db25290SBenjamin Berg 			      const struct cfg80211_bss_ies *ies, void *data);
46475db25290SBenjamin Berg 
4648f70f01c2SEliad Peller 	int	(*set_txq_params)(struct wiphy *wiphy, struct net_device *dev,
464931888487SJouni Malinen 				  struct ieee80211_txq_params *params);
465072bdcf34SJouni Malinen 
4651e8c9bd5bSJohannes Berg 	int	(*libertas_set_mesh_channel)(struct wiphy *wiphy,
4652e8c9bd5bSJohannes Berg 					     struct net_device *dev,
4653e8c9bd5bSJohannes Berg 					     struct ieee80211_channel *chan);
4654e8c9bd5bSJohannes Berg 
4655e8c9bd5bSJohannes Berg 	int	(*set_monitor_channel)(struct wiphy *wiphy,
4656683b6d3bSJohannes Berg 				       struct cfg80211_chan_def *chandef);
46579aed3cc1SJouni Malinen 
4658fd014284SJohannes Berg 	int	(*scan)(struct wiphy *wiphy,
46592a519311SJohannes Berg 			struct cfg80211_scan_request *request);
466091d3ab46SVidyullatha Kanchanapally 	void	(*abort_scan)(struct wiphy *wiphy, struct wireless_dev *wdev);
4661636a5d36SJouni Malinen 
4662636a5d36SJouni Malinen 	int	(*auth)(struct wiphy *wiphy, struct net_device *dev,
4663636a5d36SJouni Malinen 			struct cfg80211_auth_request *req);
4664636a5d36SJouni Malinen 	int	(*assoc)(struct wiphy *wiphy, struct net_device *dev,
4665636a5d36SJouni Malinen 			 struct cfg80211_assoc_request *req);
4666636a5d36SJouni Malinen 	int	(*deauth)(struct wiphy *wiphy, struct net_device *dev,
466763c9c5e7SJohannes Berg 			  struct cfg80211_deauth_request *req);
4668636a5d36SJouni Malinen 	int	(*disassoc)(struct wiphy *wiphy, struct net_device *dev,
466963c9c5e7SJohannes Berg 			    struct cfg80211_disassoc_request *req);
467004a773adSJohannes Berg 
4671b23aa676SSamuel Ortiz 	int	(*connect)(struct wiphy *wiphy, struct net_device *dev,
4672b23aa676SSamuel Ortiz 			   struct cfg80211_connect_params *sme);
4673088e8df8Svamsi krishna 	int	(*update_connect_params)(struct wiphy *wiphy,
4674088e8df8Svamsi krishna 					 struct net_device *dev,
4675088e8df8Svamsi krishna 					 struct cfg80211_connect_params *sme,
4676088e8df8Svamsi krishna 					 u32 changed);
4677b23aa676SSamuel Ortiz 	int	(*disconnect)(struct wiphy *wiphy, struct net_device *dev,
4678b23aa676SSamuel Ortiz 			      u16 reason_code);
4679b23aa676SSamuel Ortiz 
468004a773adSJohannes Berg 	int	(*join_ibss)(struct wiphy *wiphy, struct net_device *dev,
468104a773adSJohannes Berg 			     struct cfg80211_ibss_params *params);
468204a773adSJohannes Berg 	int	(*leave_ibss)(struct wiphy *wiphy, struct net_device *dev);
4683b9a5f8caSJouni Malinen 
4684f4e583c8SAntonio Quartulli 	int	(*set_mcast_rate)(struct wiphy *wiphy, struct net_device *dev,
468557fbcce3SJohannes Berg 				  int rate[NUM_NL80211_BANDS]);
4686f4e583c8SAntonio Quartulli 
4687b9a5f8caSJouni Malinen 	int	(*set_wiphy_params)(struct wiphy *wiphy, u32 changed);
46887643a2c3SJohannes Berg 
4689c8442118SJohannes Berg 	int	(*set_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
4690fa61cf70SJuuso Oikarinen 				enum nl80211_tx_power_setting type, int mbm);
4691c8442118SJohannes Berg 	int	(*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
4692c8442118SJohannes Berg 				int *dbm);
46931f87f7d3SJohannes Berg 
46941f87f7d3SJohannes Berg 	void	(*rfkill_poll)(struct wiphy *wiphy);
4695aff89a9bSJohannes Berg 
4696aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE
4697fc73f11fSDavid Spinadel 	int	(*testmode_cmd)(struct wiphy *wiphy, struct wireless_dev *wdev,
4698fc73f11fSDavid Spinadel 				void *data, int len);
469971063f0eSWey-Yi Guy 	int	(*testmode_dump)(struct wiphy *wiphy, struct sk_buff *skb,
470071063f0eSWey-Yi Guy 				 struct netlink_callback *cb,
470171063f0eSWey-Yi Guy 				 void *data, int len);
4702aff89a9bSJohannes Berg #endif
4703bc92afd9SJohannes Berg 
47049930380fSJohannes Berg 	int	(*set_bitrate_mask)(struct wiphy *wiphy,
47059930380fSJohannes Berg 				    struct net_device *dev,
47067b0a0e3cSJohannes Berg 				    unsigned int link_id,
47079930380fSJohannes Berg 				    const u8 *peer,
47089930380fSJohannes Berg 				    const struct cfg80211_bitrate_mask *mask);
47099930380fSJohannes Berg 
471061fa713cSHolger Schurig 	int	(*dump_survey)(struct wiphy *wiphy, struct net_device *netdev,
471161fa713cSHolger Schurig 			int idx, struct survey_info *info);
471261fa713cSHolger Schurig 
471367fbb16bSSamuel Ortiz 	int	(*set_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
471467fbb16bSSamuel Ortiz 			     struct cfg80211_pmksa *pmksa);
471567fbb16bSSamuel Ortiz 	int	(*del_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
471667fbb16bSSamuel Ortiz 			     struct cfg80211_pmksa *pmksa);
471767fbb16bSSamuel Ortiz 	int	(*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev);
471867fbb16bSSamuel Ortiz 
47199588bbd5SJouni Malinen 	int	(*remain_on_channel)(struct wiphy *wiphy,
472071bbc994SJohannes Berg 				     struct wireless_dev *wdev,
47219588bbd5SJouni Malinen 				     struct ieee80211_channel *chan,
47229588bbd5SJouni Malinen 				     unsigned int duration,
47239588bbd5SJouni Malinen 				     u64 *cookie);
47249588bbd5SJouni Malinen 	int	(*cancel_remain_on_channel)(struct wiphy *wiphy,
472571bbc994SJohannes Berg 					    struct wireless_dev *wdev,
47269588bbd5SJouni Malinen 					    u64 cookie);
47279588bbd5SJouni Malinen 
472871bbc994SJohannes Berg 	int	(*mgmt_tx)(struct wiphy *wiphy, struct wireless_dev *wdev,
4729b176e629SAndrei Otcheretianski 			   struct cfg80211_mgmt_tx_params *params,
4730b176e629SAndrei Otcheretianski 			   u64 *cookie);
4731f7ca38dfSJohannes Berg 	int	(*mgmt_tx_cancel_wait)(struct wiphy *wiphy,
473271bbc994SJohannes Berg 				       struct wireless_dev *wdev,
4733f7ca38dfSJohannes Berg 				       u64 cookie);
4734026331c4SJouni Malinen 
4735bc92afd9SJohannes Berg 	int	(*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev,
4736bc92afd9SJohannes Berg 				  bool enabled, int timeout);
4737d6dc1a38SJuuso Oikarinen 
4738d6dc1a38SJuuso Oikarinen 	int	(*set_cqm_rssi_config)(struct wiphy *wiphy,
4739d6dc1a38SJuuso Oikarinen 				       struct net_device *dev,
4740d6dc1a38SJuuso Oikarinen 				       s32 rssi_thold, u32 rssi_hyst);
4741271733cfSJohannes Berg 
47424a4b8169SAndrew Zaborowski 	int	(*set_cqm_rssi_range_config)(struct wiphy *wiphy,
47434a4b8169SAndrew Zaborowski 					     struct net_device *dev,
47444a4b8169SAndrew Zaborowski 					     s32 rssi_low, s32 rssi_high);
47454a4b8169SAndrew Zaborowski 
474684f10708SThomas Pedersen 	int	(*set_cqm_txe_config)(struct wiphy *wiphy,
474784f10708SThomas Pedersen 				      struct net_device *dev,
474884f10708SThomas Pedersen 				      u32 rate, u32 pkts, u32 intvl);
474984f10708SThomas Pedersen 
47506cd536feSJohannes Berg 	void	(*update_mgmt_frame_registrations)(struct wiphy *wiphy,
475171bbc994SJohannes Berg 						   struct wireless_dev *wdev,
47526cd536feSJohannes Berg 						   struct mgmt_frame_regs *upd);
4753afe0cbf8SBruno Randolf 
4754afe0cbf8SBruno Randolf 	int	(*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant);
4755afe0cbf8SBruno Randolf 	int	(*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant);
47563677713bSJohn W. Linville 
4757807f8a8cSLuciano Coelho 	int	(*sched_scan_start)(struct wiphy *wiphy,
4758807f8a8cSLuciano Coelho 				struct net_device *dev,
4759807f8a8cSLuciano Coelho 				struct cfg80211_sched_scan_request *request);
47603a3ecf1dSArend Van Spriel 	int	(*sched_scan_stop)(struct wiphy *wiphy, struct net_device *dev,
47613a3ecf1dSArend Van Spriel 				   u64 reqid);
4762e5497d76SJohannes Berg 
4763e5497d76SJohannes Berg 	int	(*set_rekey_data)(struct wiphy *wiphy, struct net_device *dev,
4764e5497d76SJohannes Berg 				  struct cfg80211_gtk_rekey_data *data);
4765109086ceSArik Nemtsov 
4766109086ceSArik Nemtsov 	int	(*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev,
4767c6112046SMukesh Sisodiya 			     const u8 *peer, int link_id,
4768c6112046SMukesh Sisodiya 			     u8 action_code, u8 dialog_token, u16 status_code,
4769c6112046SMukesh Sisodiya 			     u32 peer_capability, bool initiator,
4770c6112046SMukesh Sisodiya 			     const u8 *buf, size_t len);
4771109086ceSArik Nemtsov 	int	(*tdls_oper)(struct wiphy *wiphy, struct net_device *dev,
47723b3a0162SJohannes Berg 			     const u8 *peer, enum nl80211_tdls_operation oper);
47737f6cf311SJohannes Berg 
47747f6cf311SJohannes Berg 	int	(*probe_client)(struct wiphy *wiphy, struct net_device *dev,
47757f6cf311SJohannes Berg 				const u8 *peer, u64 *cookie);
4776e999882aSJohannes Berg 
47771d9d9213SSimon Wunderlich 	int	(*set_noack_map)(struct wiphy *wiphy,
47781d9d9213SSimon Wunderlich 				  struct net_device *dev,
47791d9d9213SSimon Wunderlich 				  u16 noack_map);
47801d9d9213SSimon Wunderlich 
4781683b6d3bSJohannes Berg 	int	(*get_channel)(struct wiphy *wiphy,
47825b7ccaf3SJohannes Berg 			       struct wireless_dev *wdev,
47837b0a0e3cSJohannes Berg 			       unsigned int link_id,
4784683b6d3bSJohannes Berg 			       struct cfg80211_chan_def *chandef);
478598104fdeSJohannes Berg 
478698104fdeSJohannes Berg 	int	(*start_p2p_device)(struct wiphy *wiphy,
478798104fdeSJohannes Berg 				    struct wireless_dev *wdev);
478898104fdeSJohannes Berg 	void	(*stop_p2p_device)(struct wiphy *wiphy,
478998104fdeSJohannes Berg 				   struct wireless_dev *wdev);
479077765eafSVasanthakumar Thiagarajan 
479177765eafSVasanthakumar Thiagarajan 	int	(*set_mac_acl)(struct wiphy *wiphy, struct net_device *dev,
479277765eafSVasanthakumar Thiagarajan 			       const struct cfg80211_acl_data *params);
479304f39047SSimon Wunderlich 
479404f39047SSimon Wunderlich 	int	(*start_radar_detection)(struct wiphy *wiphy,
479504f39047SSimon Wunderlich 					 struct net_device *dev,
479631559f35SJanusz Dziedzic 					 struct cfg80211_chan_def *chandef,
479731559f35SJanusz Dziedzic 					 u32 cac_time_ms);
479826ec17a1SOrr Mazor 	void	(*end_cac)(struct wiphy *wiphy,
479926ec17a1SOrr Mazor 				struct net_device *dev);
4800355199e0SJouni Malinen 	int	(*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev,
4801355199e0SJouni Malinen 				 struct cfg80211_update_ft_ies_params *ftie);
48025de17984SArend van Spriel 	int	(*crit_proto_start)(struct wiphy *wiphy,
48035de17984SArend van Spriel 				    struct wireless_dev *wdev,
48045de17984SArend van Spriel 				    enum nl80211_crit_proto_id protocol,
48055de17984SArend van Spriel 				    u16 duration);
48065de17984SArend van Spriel 	void	(*crit_proto_stop)(struct wiphy *wiphy,
48075de17984SArend van Spriel 				   struct wireless_dev *wdev);
4808be29b99aSAmitkumar Karwar 	int	(*set_coalesce)(struct wiphy *wiphy,
4809be29b99aSAmitkumar Karwar 				struct cfg80211_coalesce *coalesce);
481016ef1fe2SSimon Wunderlich 
481116ef1fe2SSimon Wunderlich 	int	(*channel_switch)(struct wiphy *wiphy,
481216ef1fe2SSimon Wunderlich 				  struct net_device *dev,
481316ef1fe2SSimon Wunderlich 				  struct cfg80211_csa_settings *params);
4814e16821bcSJouni Malinen 
4815fa9ffc74SKyeyoon Park 	int     (*set_qos_map)(struct wiphy *wiphy,
4816fa9ffc74SKyeyoon Park 			       struct net_device *dev,
4817fa9ffc74SKyeyoon Park 			       struct cfg80211_qos_map *qos_map);
4818e16821bcSJouni Malinen 
4819e16821bcSJouni Malinen 	int	(*set_ap_chanwidth)(struct wiphy *wiphy, struct net_device *dev,
48207b0a0e3cSJohannes Berg 				    unsigned int link_id,
4821e16821bcSJouni Malinen 				    struct cfg80211_chan_def *chandef);
4822960d01acSJohannes Berg 
4823960d01acSJohannes Berg 	int	(*add_tx_ts)(struct wiphy *wiphy, struct net_device *dev,
4824960d01acSJohannes Berg 			     u8 tsid, const u8 *peer, u8 user_prio,
4825960d01acSJohannes Berg 			     u16 admitted_time);
4826960d01acSJohannes Berg 	int	(*del_tx_ts)(struct wiphy *wiphy, struct net_device *dev,
4827960d01acSJohannes Berg 			     u8 tsid, const u8 *peer);
48281057d35eSArik Nemtsov 
48291057d35eSArik Nemtsov 	int	(*tdls_channel_switch)(struct wiphy *wiphy,
48301057d35eSArik Nemtsov 				       struct net_device *dev,
48311057d35eSArik Nemtsov 				       const u8 *addr, u8 oper_class,
48321057d35eSArik Nemtsov 				       struct cfg80211_chan_def *chandef);
48331057d35eSArik Nemtsov 	void	(*tdls_cancel_channel_switch)(struct wiphy *wiphy,
48341057d35eSArik Nemtsov 					      struct net_device *dev,
48351057d35eSArik Nemtsov 					      const u8 *addr);
4836cb3b7d87SAyala Beker 	int	(*start_nan)(struct wiphy *wiphy, struct wireless_dev *wdev,
4837cb3b7d87SAyala Beker 			     struct cfg80211_nan_conf *conf);
4838cb3b7d87SAyala Beker 	void	(*stop_nan)(struct wiphy *wiphy, struct wireless_dev *wdev);
4839a442b761SAyala Beker 	int	(*add_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev,
4840a442b761SAyala Beker 				struct cfg80211_nan_func *nan_func);
4841a442b761SAyala Beker 	void	(*del_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev,
4842a442b761SAyala Beker 			       u64 cookie);
4843a5a9dcf2SAyala Beker 	int	(*nan_change_conf)(struct wiphy *wiphy,
4844a5a9dcf2SAyala Beker 				   struct wireless_dev *wdev,
4845a5a9dcf2SAyala Beker 				   struct cfg80211_nan_conf *conf,
4846a5a9dcf2SAyala Beker 				   u32 changes);
4847ce0ce13aSMichael Braun 
4848ce0ce13aSMichael Braun 	int	(*set_multicast_to_unicast)(struct wiphy *wiphy,
4849ce0ce13aSMichael Braun 					    struct net_device *dev,
4850ce0ce13aSMichael Braun 					    const bool enabled);
48513a00df57SAvraham Stern 
485252539ca8SToke Høiland-Jørgensen 	int	(*get_txq_stats)(struct wiphy *wiphy,
485352539ca8SToke Høiland-Jørgensen 				 struct wireless_dev *wdev,
485452539ca8SToke Høiland-Jørgensen 				 struct cfg80211_txq_stats *txqstats);
485552539ca8SToke Høiland-Jørgensen 
48563a00df57SAvraham Stern 	int	(*set_pmk)(struct wiphy *wiphy, struct net_device *dev,
48573a00df57SAvraham Stern 			   const struct cfg80211_pmk_conf *conf);
48583a00df57SAvraham Stern 	int	(*del_pmk)(struct wiphy *wiphy, struct net_device *dev,
48593a00df57SAvraham Stern 			   const u8 *aa);
486040cbfa90SSrinivas Dasari 	int     (*external_auth)(struct wiphy *wiphy, struct net_device *dev,
486140cbfa90SSrinivas Dasari 				 struct cfg80211_external_auth_params *params);
48622576a9acSDenis Kenzior 
48632576a9acSDenis Kenzior 	int	(*tx_control_port)(struct wiphy *wiphy,
48642576a9acSDenis Kenzior 				   struct net_device *dev,
48652576a9acSDenis Kenzior 				   const u8 *buf, size_t len,
48668d74a623SJohannes Berg 				   const u8 *dest, const __be16 proto,
486767207babSAndrei Otcheretianski 				   const bool noencrypt, int link_id,
4868dca9ca2dSMarkus Theil 				   u64 *cookie);
486981e54d08SPradeep Kumar Chitrapu 
487081e54d08SPradeep Kumar Chitrapu 	int	(*get_ftm_responder_stats)(struct wiphy *wiphy,
487181e54d08SPradeep Kumar Chitrapu 				struct net_device *dev,
487281e54d08SPradeep Kumar Chitrapu 				struct cfg80211_ftm_responder_stats *ftm_stats);
48739bb7e0f2SJohannes Berg 
48749bb7e0f2SJohannes Berg 	int	(*start_pmsr)(struct wiphy *wiphy, struct wireless_dev *wdev,
48759bb7e0f2SJohannes Berg 			      struct cfg80211_pmsr_request *request);
48769bb7e0f2SJohannes Berg 	void	(*abort_pmsr)(struct wiphy *wiphy, struct wireless_dev *wdev,
48779bb7e0f2SJohannes Berg 			      struct cfg80211_pmsr_request *request);
4878cb74e977SSunil Dutt 	int	(*update_owe_info)(struct wiphy *wiphy, struct net_device *dev,
4879cb74e977SSunil Dutt 				   struct cfg80211_update_owe_info *owe_info);
48805ab92e7fSRajkumar Manoharan 	int	(*probe_mesh_link)(struct wiphy *wiphy, struct net_device *dev,
48815ab92e7fSRajkumar Manoharan 				   const u8 *buf, size_t len);
488277f576deSTamizh chelvam 	int     (*set_tid_config)(struct wiphy *wiphy, struct net_device *dev,
48833710a8a6SJohannes Berg 				  struct cfg80211_tid_config *tid_conf);
488477f576deSTamizh chelvam 	int	(*reset_tid_config)(struct wiphy *wiphy, struct net_device *dev,
48853710a8a6SJohannes Berg 				    const u8 *peer, u8 tids);
48866bdb68ceSCarl Huang 	int	(*set_sar_specs)(struct wiphy *wiphy,
48876bdb68ceSCarl Huang 				 struct cfg80211_sar_specs *sar);
48880d2ab3aeSJohn Crispin 	int	(*color_change)(struct wiphy *wiphy,
48890d2ab3aeSJohn Crispin 				struct net_device *dev,
48900d2ab3aeSJohn Crispin 				struct cfg80211_color_change_settings *params);
4891e306784aSSubrat Mishra 	int     (*set_fils_aad)(struct wiphy *wiphy, struct net_device *dev,
4892e306784aSSubrat Mishra 				struct cfg80211_fils_aad *fils_aad);
4893a95bfb87SLorenzo Bianconi 	int	(*set_radar_background)(struct wiphy *wiphy,
4894bc2dfc02SLorenzo Bianconi 					struct cfg80211_chan_def *chandef);
4895577e5b8cSShaul Triebitz 	int	(*add_link_station)(struct wiphy *wiphy, struct net_device *dev,
4896577e5b8cSShaul Triebitz 				    struct link_station_parameters *params);
4897577e5b8cSShaul Triebitz 	int	(*mod_link_station)(struct wiphy *wiphy, struct net_device *dev,
4898577e5b8cSShaul Triebitz 				    struct link_station_parameters *params);
4899577e5b8cSShaul Triebitz 	int	(*del_link_station)(struct wiphy *wiphy, struct net_device *dev,
4900577e5b8cSShaul Triebitz 				    struct link_station_del_parameters *params);
4901cbbaf2bbSAvraham Stern 	int	(*set_hw_timestamp)(struct wiphy *wiphy, struct net_device *dev,
4902cbbaf2bbSAvraham Stern 				    struct cfg80211_set_hw_timestamp *hwts);
4903b61e6b41SIlan Peer 	int	(*set_ttlm)(struct wiphy *wiphy, struct net_device *dev,
4904b61e6b41SIlan Peer 			    struct cfg80211_ttlm_params *params);
4905704232c2SJohannes Berg };
4906704232c2SJohannes Berg 
4907d3236553SJohannes Berg /*
4908d3236553SJohannes Berg  * wireless hardware and networking interfaces structures
4909d3236553SJohannes Berg  * and registration/helper functions
4910d3236553SJohannes Berg  */
4911d3236553SJohannes Berg 
4912d3236553SJohannes Berg /**
49135be83de5SJohannes Berg  * enum wiphy_flags - wiphy capability flags
49145be83de5SJohannes Berg  *
4915c8cb5b85STova Mussai  * @WIPHY_FLAG_SPLIT_SCAN_6GHZ: if set to true, the scan request will be split
4916c8cb5b85STova Mussai  *	 into two, first for legacy bands and second for UHB.
49175be83de5SJohannes Berg  * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this
49185be83de5SJohannes Berg  *	wiphy at all
49195be83de5SJohannes Berg  * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled
49205be83de5SJohannes Berg  *	by default -- this flag will be set depending on the kernel's default
49215be83de5SJohannes Berg  *	on wiphy_new(), but can be changed by the driver if it has a good
49225be83de5SJohannes Berg  *	reason to override the default
49239bc383deSJohannes Berg  * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station
492433d915d9SManikanta Pubbisetty  *	on a VLAN interface). This flag also serves an extra purpose of
492533d915d9SManikanta Pubbisetty  *	supporting 4ADDR AP mode on devices which do not support AP/VLAN iftype.
49269bc383deSJohannes Berg  * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station
4927c0692b8fSJohannes Berg  * @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the
4928c0692b8fSJohannes Berg  *	control port protocol ethertype. The device also honours the
4929c0692b8fSJohannes Berg  *	control_port_no_encrypt flag.
4930e31b8213SJohannes Berg  * @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN.
493115d5dda6SJavier Cardona  * @WIPHY_FLAG_MESH_AUTH: The device supports mesh authentication by routing
493215d5dda6SJavier Cardona  *	auth frames to userspace. See @NL80211_MESH_SETUP_USERSPACE_AUTH.
4933f4b34b55SVivek Natarajan  * @WIPHY_FLAG_SUPPORTS_FW_ROAM: The device supports roaming feature in the
4934f4b34b55SVivek Natarajan  *	firmware.
4935cedb5412SEliad Peller  * @WIPHY_FLAG_AP_UAPSD: The device supports uapsd on AP.
4936109086ceSArik Nemtsov  * @WIPHY_FLAG_SUPPORTS_TDLS: The device supports TDLS (802.11z) operation.
4937109086ceSArik Nemtsov  * @WIPHY_FLAG_TDLS_EXTERNAL_SETUP: The device does not handle TDLS (802.11z)
4938109086ceSArik Nemtsov  *	link setup/discovery operations internally. Setup, discovery and
4939109086ceSArik Nemtsov  *	teardown packets should be sent through the @NL80211_CMD_TDLS_MGMT
4940109086ceSArik Nemtsov  *	command. When this flag is not set, @NL80211_CMD_TDLS_OPER should be
4941109086ceSArik Nemtsov  *	used for asking the driver/firmware to perform a TDLS operation.
4942562a7480SJohannes Berg  * @WIPHY_FLAG_HAVE_AP_SME: device integrates AP SME
49435e760230SJohannes Berg  * @WIPHY_FLAG_REPORTS_OBSS: the device will report beacons from other BSSes
49445e760230SJohannes Berg  *	when there are virtual interfaces in AP mode by calling
49455e760230SJohannes Berg  *	cfg80211_report_obss_beacon().
494687bbbe22SArik Nemtsov  * @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD: When operating as an AP, the device
494787bbbe22SArik Nemtsov  *	responds to probe-requests in hardware.
49487c4ef712SJohannes Berg  * @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX.
49497c4ef712SJohannes Berg  * @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call.
49502f301ab2SSimon Wunderlich  * @WIPHY_FLAG_SUPPORTS_5_10_MHZ: Device supports 5 MHz and 10 MHz channels.
495116ef1fe2SSimon Wunderlich  * @WIPHY_FLAG_HAS_CHANNEL_SWITCH: Device supports channel switch in
495216ef1fe2SSimon Wunderlich  *	beaconing mode (AP, IBSS, Mesh, ...).
4953093a48d2SNathan Errera  * @WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK: The device supports bigger kek and kck keys
49547b0a0e3cSJohannes Berg  * @WIPHY_FLAG_SUPPORTS_MLO: This is a temporary flag gating the MLO APIs,
49557b0a0e3cSJohannes Berg  *	in order to not have them reachable in normal drivers, until we have
49567b0a0e3cSJohannes Berg  *	complete feature/interface combinations/etc. advertisement. No driver
49577b0a0e3cSJohannes Berg  *	should set this flag for now.
4958648fba79SShivani Baranwal  * @WIPHY_FLAG_SUPPORTS_EXT_KCK_32: The device supports 32-byte KCK keys.
4959d99975c4SWen Gong  * @WIPHY_FLAG_NOTIFY_REGDOM_BY_DRIVER: The device could handle reg notify for
4960d99975c4SWen Gong  *	NL80211_REGDOM_SET_BY_DRIVER.
4961b13b6bbfSAbhishek Kumar  * @WIPHY_FLAG_CHANNEL_CHANGE_ON_BEACON: reg_call_notifier() is called if driver
4962b13b6bbfSAbhishek Kumar  *	set this flag to update channels on beacon hints.
4963d02a12b8SJohannes Berg  * @WIPHY_FLAG_SUPPORTS_NSTR_NONPRIMARY: support connection to non-primary link
4964d02a12b8SJohannes Berg  *	of an NSTR mobile AP MLD.
49655be83de5SJohannes Berg  */
49665be83de5SJohannes Berg enum wiphy_flags {
4967093a48d2SNathan Errera 	WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK		= BIT(0),
49687b0a0e3cSJohannes Berg 	WIPHY_FLAG_SUPPORTS_MLO			= BIT(1),
4969c8cb5b85STova Mussai 	WIPHY_FLAG_SPLIT_SCAN_6GHZ		= BIT(2),
49705be83de5SJohannes Berg 	WIPHY_FLAG_NETNS_OK			= BIT(3),
49715be83de5SJohannes Berg 	WIPHY_FLAG_PS_ON_BY_DEFAULT		= BIT(4),
49729bc383deSJohannes Berg 	WIPHY_FLAG_4ADDR_AP			= BIT(5),
49739bc383deSJohannes Berg 	WIPHY_FLAG_4ADDR_STATION		= BIT(6),
4974c0692b8fSJohannes Berg 	WIPHY_FLAG_CONTROL_PORT_PROTOCOL	= BIT(7),
4975309075cfSJussi Kivilinna 	WIPHY_FLAG_IBSS_RSN			= BIT(8),
497615d5dda6SJavier Cardona 	WIPHY_FLAG_MESH_AUTH			= BIT(10),
4977648fba79SShivani Baranwal 	WIPHY_FLAG_SUPPORTS_EXT_KCK_32          = BIT(11),
4978d02a12b8SJohannes Berg 	WIPHY_FLAG_SUPPORTS_NSTR_NONPRIMARY	= BIT(12),
4979f4b34b55SVivek Natarajan 	WIPHY_FLAG_SUPPORTS_FW_ROAM		= BIT(13),
4980cedb5412SEliad Peller 	WIPHY_FLAG_AP_UAPSD			= BIT(14),
4981109086ceSArik Nemtsov 	WIPHY_FLAG_SUPPORTS_TDLS		= BIT(15),
4982109086ceSArik Nemtsov 	WIPHY_FLAG_TDLS_EXTERNAL_SETUP		= BIT(16),
4983562a7480SJohannes Berg 	WIPHY_FLAG_HAVE_AP_SME			= BIT(17),
49845e760230SJohannes Berg 	WIPHY_FLAG_REPORTS_OBSS			= BIT(18),
498587bbbe22SArik Nemtsov 	WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD	= BIT(19),
49867c4ef712SJohannes Berg 	WIPHY_FLAG_OFFCHAN_TX			= BIT(20),
49877c4ef712SJohannes Berg 	WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL	= BIT(21),
49882f301ab2SSimon Wunderlich 	WIPHY_FLAG_SUPPORTS_5_10_MHZ		= BIT(22),
498916ef1fe2SSimon Wunderlich 	WIPHY_FLAG_HAS_CHANNEL_SWITCH		= BIT(23),
4990d99975c4SWen Gong 	WIPHY_FLAG_NOTIFY_REGDOM_BY_DRIVER	= BIT(24),
4991b13b6bbfSAbhishek Kumar 	WIPHY_FLAG_CHANNEL_CHANGE_ON_BEACON     = BIT(25),
49927527a782SJohannes Berg };
49937527a782SJohannes Berg 
49947527a782SJohannes Berg /**
49957527a782SJohannes Berg  * struct ieee80211_iface_limit - limit on certain interface types
49967527a782SJohannes Berg  * @max: maximum number of interfaces of these types
49977527a782SJohannes Berg  * @types: interface types (bits)
49987527a782SJohannes Berg  */
49997527a782SJohannes Berg struct ieee80211_iface_limit {
50007527a782SJohannes Berg 	u16 max;
50017527a782SJohannes Berg 	u16 types;
50027527a782SJohannes Berg };
50037527a782SJohannes Berg 
50047527a782SJohannes Berg /**
50057527a782SJohannes Berg  * struct ieee80211_iface_combination - possible interface combination
50067527a782SJohannes Berg  *
5007b80edbc1SLuciano Coelho  * With this structure the driver can describe which interface
5008b80edbc1SLuciano Coelho  * combinations it supports concurrently.
50097527a782SJohannes Berg  *
5010b80edbc1SLuciano Coelho  * Examples:
5011b80edbc1SLuciano Coelho  *
5012b80edbc1SLuciano Coelho  * 1. Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total:
50137527a782SJohannes Berg  *
5014819bf593SJohannes Berg  *    .. code-block:: c
5015819bf593SJohannes Berg  *
50167527a782SJohannes Berg  *	struct ieee80211_iface_limit limits1[] = {
50177527a782SJohannes Berg  *		{ .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
50184d371d6eSPhilipp Hortmann  *		{ .max = 1, .types = BIT(NL80211_IFTYPE_AP), },
50197527a782SJohannes Berg  *	};
50207527a782SJohannes Berg  *	struct ieee80211_iface_combination combination1 = {
50217527a782SJohannes Berg  *		.limits = limits1,
50227527a782SJohannes Berg  *		.n_limits = ARRAY_SIZE(limits1),
50237527a782SJohannes Berg  *		.max_interfaces = 2,
50247527a782SJohannes Berg  *		.beacon_int_infra_match = true,
50257527a782SJohannes Berg  *	};
50267527a782SJohannes Berg  *
50277527a782SJohannes Berg  *
5028b80edbc1SLuciano Coelho  * 2. Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total:
50297527a782SJohannes Berg  *
5030819bf593SJohannes Berg  *    .. code-block:: c
5031819bf593SJohannes Berg  *
50327527a782SJohannes Berg  *	struct ieee80211_iface_limit limits2[] = {
50337527a782SJohannes Berg  *		{ .max = 8, .types = BIT(NL80211_IFTYPE_AP) |
50347527a782SJohannes Berg  *				     BIT(NL80211_IFTYPE_P2P_GO), },
50357527a782SJohannes Berg  *	};
50367527a782SJohannes Berg  *	struct ieee80211_iface_combination combination2 = {
50377527a782SJohannes Berg  *		.limits = limits2,
50387527a782SJohannes Berg  *		.n_limits = ARRAY_SIZE(limits2),
50397527a782SJohannes Berg  *		.max_interfaces = 8,
50407527a782SJohannes Berg  *		.num_different_channels = 1,
50417527a782SJohannes Berg  *	};
50427527a782SJohannes Berg  *
50437527a782SJohannes Berg  *
5044b80edbc1SLuciano Coelho  * 3. Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total.
5045b80edbc1SLuciano Coelho  *
50467527a782SJohannes Berg  *    This allows for an infrastructure connection and three P2P connections.
50477527a782SJohannes Berg  *
5048819bf593SJohannes Berg  *    .. code-block:: c
5049819bf593SJohannes Berg  *
50507527a782SJohannes Berg  *	struct ieee80211_iface_limit limits3[] = {
50517527a782SJohannes Berg  *		{ .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
50527527a782SJohannes Berg  *		{ .max = 3, .types = BIT(NL80211_IFTYPE_P2P_GO) |
50537527a782SJohannes Berg  *				     BIT(NL80211_IFTYPE_P2P_CLIENT), },
50547527a782SJohannes Berg  *	};
50557527a782SJohannes Berg  *	struct ieee80211_iface_combination combination3 = {
50567527a782SJohannes Berg  *		.limits = limits3,
50577527a782SJohannes Berg  *		.n_limits = ARRAY_SIZE(limits3),
50587527a782SJohannes Berg  *		.max_interfaces = 4,
50597527a782SJohannes Berg  *		.num_different_channels = 2,
50607527a782SJohannes Berg  *	};
5061819bf593SJohannes Berg  *
50627527a782SJohannes Berg  */
50637527a782SJohannes Berg struct ieee80211_iface_combination {
5064c6c94aeaSJohannes Berg 	/**
5065c6c94aeaSJohannes Berg 	 * @limits:
5066c6c94aeaSJohannes Berg 	 * limits for the given interface types
5067c6c94aeaSJohannes Berg 	 */
50687527a782SJohannes Berg 	const struct ieee80211_iface_limit *limits;
5069c6c94aeaSJohannes Berg 
5070c6c94aeaSJohannes Berg 	/**
5071c6c94aeaSJohannes Berg 	 * @num_different_channels:
5072c6c94aeaSJohannes Berg 	 * can use up to this many different channels
5073c6c94aeaSJohannes Berg 	 */
50747527a782SJohannes Berg 	u32 num_different_channels;
5075c6c94aeaSJohannes Berg 
5076c6c94aeaSJohannes Berg 	/**
5077c6c94aeaSJohannes Berg 	 * @max_interfaces:
5078c6c94aeaSJohannes Berg 	 * maximum number of interfaces in total allowed in this group
5079c6c94aeaSJohannes Berg 	 */
50807527a782SJohannes Berg 	u16 max_interfaces;
5081c6c94aeaSJohannes Berg 
5082c6c94aeaSJohannes Berg 	/**
5083c6c94aeaSJohannes Berg 	 * @n_limits:
5084c6c94aeaSJohannes Berg 	 * number of limitations
5085c6c94aeaSJohannes Berg 	 */
50867527a782SJohannes Berg 	u8 n_limits;
5087c6c94aeaSJohannes Berg 
5088c6c94aeaSJohannes Berg 	/**
5089c6c94aeaSJohannes Berg 	 * @beacon_int_infra_match:
5090c6c94aeaSJohannes Berg 	 * In this combination, the beacon intervals between infrastructure
5091c6c94aeaSJohannes Berg 	 * and AP types must match. This is required only in special cases.
5092c6c94aeaSJohannes Berg 	 */
50937527a782SJohannes Berg 	bool beacon_int_infra_match;
5094c6c94aeaSJohannes Berg 
5095c6c94aeaSJohannes Berg 	/**
5096c6c94aeaSJohannes Berg 	 * @radar_detect_widths:
5097c6c94aeaSJohannes Berg 	 * bitmap of channel widths supported for radar detection
5098c6c94aeaSJohannes Berg 	 */
509911c4a075SSimon Wunderlich 	u8 radar_detect_widths;
5100c6c94aeaSJohannes Berg 
5101c6c94aeaSJohannes Berg 	/**
5102c6c94aeaSJohannes Berg 	 * @radar_detect_regions:
5103c6c94aeaSJohannes Berg 	 * bitmap of regions supported for radar detection
5104c6c94aeaSJohannes Berg 	 */
51058c48b50aSFelix Fietkau 	u8 radar_detect_regions;
5106c6c94aeaSJohannes Berg 
5107c6c94aeaSJohannes Berg 	/**
5108c6c94aeaSJohannes Berg 	 * @beacon_int_min_gcd:
5109c6c94aeaSJohannes Berg 	 * This interface combination supports different beacon intervals.
5110c6c94aeaSJohannes Berg 	 *
5111c6c94aeaSJohannes Berg 	 * = 0
5112c6c94aeaSJohannes Berg 	 *   all beacon intervals for different interface must be same.
5113c6c94aeaSJohannes Berg 	 * > 0
5114c6c94aeaSJohannes Berg 	 *   any beacon interval for the interface part of this combination AND
5115c6c94aeaSJohannes Berg 	 *   GCD of all beacon intervals from beaconing interfaces of this
5116c6c94aeaSJohannes Berg 	 *   combination must be greater or equal to this value.
5117c6c94aeaSJohannes Berg 	 */
51180c317a02SPurushottam Kushwaha 	u32 beacon_int_min_gcd;
51195be83de5SJohannes Berg };
51205be83de5SJohannes Berg 
51212e161f78SJohannes Berg struct ieee80211_txrx_stypes {
51222e161f78SJohannes Berg 	u16 tx, rx;
51232e161f78SJohannes Berg };
51242e161f78SJohannes Berg 
51255be83de5SJohannes Berg /**
5126ff1b6e69SJohannes Berg  * enum wiphy_wowlan_support_flags - WoWLAN support flags
5127ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_ANY: supports wakeup for the special "any"
5128ff1b6e69SJohannes Berg  *	trigger that keeps the device operating as-is and
5129ff1b6e69SJohannes Berg  *	wakes up the host on any activity, for example a
5130ff1b6e69SJohannes Berg  *	received packet that passed filtering; note that the
5131ff1b6e69SJohannes Berg  *	packet should be preserved in that case
5132ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_MAGIC_PKT: supports wakeup on magic packet
5133ff1b6e69SJohannes Berg  *	(see nl80211.h)
5134ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_DISCONNECT: supports wakeup on disconnect
513577dbbb13SJohannes Berg  * @WIPHY_WOWLAN_SUPPORTS_GTK_REKEY: supports GTK rekeying while asleep
513677dbbb13SJohannes Berg  * @WIPHY_WOWLAN_GTK_REKEY_FAILURE: supports wakeup on GTK rekey failure
513777dbbb13SJohannes Berg  * @WIPHY_WOWLAN_EAP_IDENTITY_REQ: supports wakeup on EAP identity request
513877dbbb13SJohannes Berg  * @WIPHY_WOWLAN_4WAY_HANDSHAKE: supports wakeup on 4-way handshake failure
513977dbbb13SJohannes Berg  * @WIPHY_WOWLAN_RFKILL_RELEASE: supports wakeup on RF-kill release
51408cd4d456SLuciano Coelho  * @WIPHY_WOWLAN_NET_DETECT: supports wakeup on network detection
5141ff1b6e69SJohannes Berg  */
5142ff1b6e69SJohannes Berg enum wiphy_wowlan_support_flags {
5143ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_ANY		= BIT(0),
5144ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_MAGIC_PKT		= BIT(1),
5145ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_DISCONNECT		= BIT(2),
514677dbbb13SJohannes Berg 	WIPHY_WOWLAN_SUPPORTS_GTK_REKEY	= BIT(3),
514777dbbb13SJohannes Berg 	WIPHY_WOWLAN_GTK_REKEY_FAILURE	= BIT(4),
514877dbbb13SJohannes Berg 	WIPHY_WOWLAN_EAP_IDENTITY_REQ	= BIT(5),
514977dbbb13SJohannes Berg 	WIPHY_WOWLAN_4WAY_HANDSHAKE	= BIT(6),
515077dbbb13SJohannes Berg 	WIPHY_WOWLAN_RFKILL_RELEASE	= BIT(7),
51518cd4d456SLuciano Coelho 	WIPHY_WOWLAN_NET_DETECT		= BIT(8),
5152ff1b6e69SJohannes Berg };
5153ff1b6e69SJohannes Berg 
51542a0e047eSJohannes Berg struct wiphy_wowlan_tcp_support {
51552a0e047eSJohannes Berg 	const struct nl80211_wowlan_tcp_data_token_feature *tok;
51562a0e047eSJohannes Berg 	u32 data_payload_max;
51572a0e047eSJohannes Berg 	u32 data_interval_max;
51582a0e047eSJohannes Berg 	u32 wake_payload_max;
51592a0e047eSJohannes Berg 	bool seq;
51602a0e047eSJohannes Berg };
51612a0e047eSJohannes Berg 
5162ff1b6e69SJohannes Berg /**
5163ff1b6e69SJohannes Berg  * struct wiphy_wowlan_support - WoWLAN support data
5164ff1b6e69SJohannes Berg  * @flags: see &enum wiphy_wowlan_support_flags
5165ff1b6e69SJohannes Berg  * @n_patterns: number of supported wakeup patterns
5166ff1b6e69SJohannes Berg  *	(see nl80211.h for the pattern definition)
5167ff1b6e69SJohannes Berg  * @pattern_max_len: maximum length of each pattern
5168ff1b6e69SJohannes Berg  * @pattern_min_len: minimum length of each pattern
5169bb92d199SAmitkumar Karwar  * @max_pkt_offset: maximum Rx packet offset
51708cd4d456SLuciano Coelho  * @max_nd_match_sets: maximum number of matchsets for net-detect,
51718cd4d456SLuciano Coelho  *	similar, but not necessarily identical, to max_match_sets for
51728cd4d456SLuciano Coelho  *	scheduled scans.
51738cd4d456SLuciano Coelho  *	See &struct cfg80211_sched_scan_request.@match_sets for more
51748cd4d456SLuciano Coelho  *	details.
51752a0e047eSJohannes Berg  * @tcp: TCP wakeup support information
5176ff1b6e69SJohannes Berg  */
5177ff1b6e69SJohannes Berg struct wiphy_wowlan_support {
5178ff1b6e69SJohannes Berg 	u32 flags;
5179ff1b6e69SJohannes Berg 	int n_patterns;
5180ff1b6e69SJohannes Berg 	int pattern_max_len;
5181ff1b6e69SJohannes Berg 	int pattern_min_len;
5182bb92d199SAmitkumar Karwar 	int max_pkt_offset;
51838cd4d456SLuciano Coelho 	int max_nd_match_sets;
51842a0e047eSJohannes Berg 	const struct wiphy_wowlan_tcp_support *tcp;
5185ff1b6e69SJohannes Berg };
5186ff1b6e69SJohannes Berg 
5187ff1b6e69SJohannes Berg /**
5188be29b99aSAmitkumar Karwar  * struct wiphy_coalesce_support - coalesce support data
5189be29b99aSAmitkumar Karwar  * @n_rules: maximum number of coalesce rules
5190be29b99aSAmitkumar Karwar  * @max_delay: maximum supported coalescing delay in msecs
5191be29b99aSAmitkumar Karwar  * @n_patterns: number of supported patterns in a rule
5192be29b99aSAmitkumar Karwar  *	(see nl80211.h for the pattern definition)
5193be29b99aSAmitkumar Karwar  * @pattern_max_len: maximum length of each pattern
5194be29b99aSAmitkumar Karwar  * @pattern_min_len: minimum length of each pattern
5195be29b99aSAmitkumar Karwar  * @max_pkt_offset: maximum Rx packet offset
5196be29b99aSAmitkumar Karwar  */
5197be29b99aSAmitkumar Karwar struct wiphy_coalesce_support {
5198be29b99aSAmitkumar Karwar 	int n_rules;
5199be29b99aSAmitkumar Karwar 	int max_delay;
5200be29b99aSAmitkumar Karwar 	int n_patterns;
5201be29b99aSAmitkumar Karwar 	int pattern_max_len;
5202be29b99aSAmitkumar Karwar 	int pattern_min_len;
5203be29b99aSAmitkumar Karwar 	int max_pkt_offset;
5204be29b99aSAmitkumar Karwar };
5205be29b99aSAmitkumar Karwar 
5206be29b99aSAmitkumar Karwar /**
5207ad7e718cSJohannes Berg  * enum wiphy_vendor_command_flags - validation flags for vendor commands
5208ad7e718cSJohannes Berg  * @WIPHY_VENDOR_CMD_NEED_WDEV: vendor command requires wdev
5209ad7e718cSJohannes Berg  * @WIPHY_VENDOR_CMD_NEED_NETDEV: vendor command requires netdev
5210ad7e718cSJohannes Berg  * @WIPHY_VENDOR_CMD_NEED_RUNNING: interface/wdev must be up & running
5211ad7e718cSJohannes Berg  *	(must be combined with %_WDEV or %_NETDEV)
5212ad7e718cSJohannes Berg  */
5213ad7e718cSJohannes Berg enum wiphy_vendor_command_flags {
5214ad7e718cSJohannes Berg 	WIPHY_VENDOR_CMD_NEED_WDEV = BIT(0),
5215ad7e718cSJohannes Berg 	WIPHY_VENDOR_CMD_NEED_NETDEV = BIT(1),
5216ad7e718cSJohannes Berg 	WIPHY_VENDOR_CMD_NEED_RUNNING = BIT(2),
5217ad7e718cSJohannes Berg };
5218ad7e718cSJohannes Berg 
5219ad7e718cSJohannes Berg /**
5220466b9936Stamizhr@codeaurora.org  * enum wiphy_opmode_flag - Station's ht/vht operation mode information flags
5221466b9936Stamizhr@codeaurora.org  *
5222466b9936Stamizhr@codeaurora.org  * @STA_OPMODE_MAX_BW_CHANGED: Max Bandwidth changed
5223466b9936Stamizhr@codeaurora.org  * @STA_OPMODE_SMPS_MODE_CHANGED: SMPS mode changed
5224466b9936Stamizhr@codeaurora.org  * @STA_OPMODE_N_SS_CHANGED: max N_SS (number of spatial streams) changed
5225466b9936Stamizhr@codeaurora.org  *
5226466b9936Stamizhr@codeaurora.org  */
5227466b9936Stamizhr@codeaurora.org enum wiphy_opmode_flag {
5228466b9936Stamizhr@codeaurora.org 	STA_OPMODE_MAX_BW_CHANGED	= BIT(0),
5229466b9936Stamizhr@codeaurora.org 	STA_OPMODE_SMPS_MODE_CHANGED	= BIT(1),
5230466b9936Stamizhr@codeaurora.org 	STA_OPMODE_N_SS_CHANGED		= BIT(2),
5231466b9936Stamizhr@codeaurora.org };
5232466b9936Stamizhr@codeaurora.org 
5233466b9936Stamizhr@codeaurora.org /**
5234466b9936Stamizhr@codeaurora.org  * struct sta_opmode_info - Station's ht/vht operation mode information
5235466b9936Stamizhr@codeaurora.org  * @changed: contains value from &enum wiphy_opmode_flag
52365e78abd0Stamizhr@codeaurora.org  * @smps_mode: New SMPS mode value from &enum nl80211_smps_mode of a station
52375e78abd0Stamizhr@codeaurora.org  * @bw: new max bandwidth value from &enum nl80211_chan_width of a station
5238466b9936Stamizhr@codeaurora.org  * @rx_nss: new rx_nss value of a station
5239466b9936Stamizhr@codeaurora.org  */
5240466b9936Stamizhr@codeaurora.org 
5241466b9936Stamizhr@codeaurora.org struct sta_opmode_info {
5242466b9936Stamizhr@codeaurora.org 	u32 changed;
52435e78abd0Stamizhr@codeaurora.org 	enum nl80211_smps_mode smps_mode;
52445e78abd0Stamizhr@codeaurora.org 	enum nl80211_chan_width bw;
5245466b9936Stamizhr@codeaurora.org 	u8 rx_nss;
5246466b9936Stamizhr@codeaurora.org };
5247466b9936Stamizhr@codeaurora.org 
524891046d63SJohannes Berg #define VENDOR_CMD_RAW_DATA ((const struct nla_policy *)(long)(-ENODATA))
5249901bb989SJohannes Berg 
5250466b9936Stamizhr@codeaurora.org /**
5251ad7e718cSJohannes Berg  * struct wiphy_vendor_command - vendor command definition
5252ad7e718cSJohannes Berg  * @info: vendor command identifying information, as used in nl80211
5253ad7e718cSJohannes Berg  * @flags: flags, see &enum wiphy_vendor_command_flags
5254ad7e718cSJohannes Berg  * @doit: callback for the operation, note that wdev is %NULL if the
5255ad7e718cSJohannes Berg  *	flags didn't ask for a wdev and non-%NULL otherwise; the data
5256ad7e718cSJohannes Berg  *	pointer may be %NULL if userspace provided no data at all
52577bdbe400SJohannes Berg  * @dumpit: dump callback, for transferring bigger/multiple items. The
52587bdbe400SJohannes Berg  *	@storage points to cb->args[5], ie. is preserved over the multiple
52597bdbe400SJohannes Berg  *	dumpit calls.
5260901bb989SJohannes Berg  * @policy: policy pointer for attributes within %NL80211_ATTR_VENDOR_DATA.
5261901bb989SJohannes Berg  *	Set this to %VENDOR_CMD_RAW_DATA if no policy can be given and the
5262901bb989SJohannes Berg  *	attribute is just raw data (e.g. a firmware command).
5263901bb989SJohannes Berg  * @maxattr: highest attribute number in policy
52647bdbe400SJohannes Berg  * It's recommended to not have the same sub command with both @doit and
52657bdbe400SJohannes Berg  * @dumpit, so that userspace can assume certain ones are get and others
52667bdbe400SJohannes Berg  * are used with dump requests.
5267ad7e718cSJohannes Berg  */
5268ad7e718cSJohannes Berg struct wiphy_vendor_command {
5269ad7e718cSJohannes Berg 	struct nl80211_vendor_cmd_info info;
5270ad7e718cSJohannes Berg 	u32 flags;
5271ad7e718cSJohannes Berg 	int (*doit)(struct wiphy *wiphy, struct wireless_dev *wdev,
5272ad7e718cSJohannes Berg 		    const void *data, int data_len);
52737bdbe400SJohannes Berg 	int (*dumpit)(struct wiphy *wiphy, struct wireless_dev *wdev,
52747bdbe400SJohannes Berg 		      struct sk_buff *skb, const void *data, int data_len,
52757bdbe400SJohannes Berg 		      unsigned long *storage);
5276901bb989SJohannes Berg 	const struct nla_policy *policy;
5277901bb989SJohannes Berg 	unsigned int maxattr;
5278ad7e718cSJohannes Berg };
5279ad7e718cSJohannes Berg 
5280ad7e718cSJohannes Berg /**
5281019ae3a9SKanchanapally, Vidyullatha  * struct wiphy_iftype_ext_capab - extended capabilities per interface type
5282019ae3a9SKanchanapally, Vidyullatha  * @iftype: interface type
5283019ae3a9SKanchanapally, Vidyullatha  * @extended_capabilities: extended capabilities supported by the driver,
5284019ae3a9SKanchanapally, Vidyullatha  *	additional capabilities might be supported by userspace; these are the
5285019ae3a9SKanchanapally, Vidyullatha  *	802.11 extended capabilities ("Extended Capabilities element") and are
5286019ae3a9SKanchanapally, Vidyullatha  *	in the same format as in the information element. See IEEE Std
5287019ae3a9SKanchanapally, Vidyullatha  *	802.11-2012 8.4.2.29 for the defined fields.
5288019ae3a9SKanchanapally, Vidyullatha  * @extended_capabilities_mask: mask of the valid values
5289019ae3a9SKanchanapally, Vidyullatha  * @extended_capabilities_len: length of the extended capabilities
52904e9c3af3SJohannes Berg  * @eml_capabilities: EML capabilities (for MLO)
52914e9c3af3SJohannes Berg  * @mld_capa_and_ops: MLD capabilities and operations (for MLO)
5292019ae3a9SKanchanapally, Vidyullatha  */
5293019ae3a9SKanchanapally, Vidyullatha struct wiphy_iftype_ext_capab {
5294019ae3a9SKanchanapally, Vidyullatha 	enum nl80211_iftype iftype;
5295019ae3a9SKanchanapally, Vidyullatha 	const u8 *extended_capabilities;
5296019ae3a9SKanchanapally, Vidyullatha 	const u8 *extended_capabilities_mask;
5297019ae3a9SKanchanapally, Vidyullatha 	u8 extended_capabilities_len;
52984e9c3af3SJohannes Berg 	u16 eml_capabilities;
52994e9c3af3SJohannes Berg 	u16 mld_capa_and_ops;
5300019ae3a9SKanchanapally, Vidyullatha };
5301019ae3a9SKanchanapally, Vidyullatha 
5302019ae3a9SKanchanapally, Vidyullatha /**
53037464f665SJohannes Berg  * cfg80211_get_iftype_ext_capa - lookup interface type extended capability
53047464f665SJohannes Berg  * @wiphy: the wiphy to look up from
53057464f665SJohannes Berg  * @type: the interface type to look up
53067464f665SJohannes Berg  */
53077464f665SJohannes Berg const struct wiphy_iftype_ext_capab *
53087464f665SJohannes Berg cfg80211_get_iftype_ext_capa(struct wiphy *wiphy, enum nl80211_iftype type);
53097464f665SJohannes Berg 
53107464f665SJohannes Berg /**
53119bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_capabilities - cfg80211 peer measurement capabilities
53129bb7e0f2SJohannes Berg  * @max_peers: maximum number of peers in a single measurement
53139bb7e0f2SJohannes Berg  * @report_ap_tsf: can report assoc AP's TSF for radio resource measurement
53149bb7e0f2SJohannes Berg  * @randomize_mac_addr: can randomize MAC address for measurement
53152d8b08feSMauro Carvalho Chehab  * @ftm: FTM measurement data
53169bb7e0f2SJohannes Berg  * @ftm.supported: FTM measurement is supported
53179bb7e0f2SJohannes Berg  * @ftm.asap: ASAP-mode is supported
53189bb7e0f2SJohannes Berg  * @ftm.non_asap: non-ASAP-mode is supported
53199bb7e0f2SJohannes Berg  * @ftm.request_lci: can request LCI data
53209bb7e0f2SJohannes Berg  * @ftm.request_civicloc: can request civic location data
53219bb7e0f2SJohannes Berg  * @ftm.preambles: bitmap of preambles supported (&enum nl80211_preamble)
53229bb7e0f2SJohannes Berg  * @ftm.bandwidths: bitmap of bandwidths supported (&enum nl80211_chan_width)
53239bb7e0f2SJohannes Berg  * @ftm.max_bursts_exponent: maximum burst exponent supported
53249bb7e0f2SJohannes Berg  *	(set to -1 if not limited; note that setting this will necessarily
53259bb7e0f2SJohannes Berg  *	forbid using the value 15 to let the responder pick)
53269bb7e0f2SJohannes Berg  * @ftm.max_ftms_per_burst: maximum FTMs per burst supported (set to 0 if
53279bb7e0f2SJohannes Berg  *	not limited)
5328efb5520dSAvraham Stern  * @ftm.trigger_based: trigger based ranging measurement is supported
5329efb5520dSAvraham Stern  * @ftm.non_trigger_based: non trigger based ranging measurement is supported
53309bb7e0f2SJohannes Berg  */
53319bb7e0f2SJohannes Berg struct cfg80211_pmsr_capabilities {
53329bb7e0f2SJohannes Berg 	unsigned int max_peers;
53339bb7e0f2SJohannes Berg 	u8 report_ap_tsf:1,
53349bb7e0f2SJohannes Berg 	   randomize_mac_addr:1;
53359bb7e0f2SJohannes Berg 
53369bb7e0f2SJohannes Berg 	struct {
53379bb7e0f2SJohannes Berg 		u32 preambles;
53389bb7e0f2SJohannes Berg 		u32 bandwidths;
53399bb7e0f2SJohannes Berg 		s8 max_bursts_exponent;
53409bb7e0f2SJohannes Berg 		u8 max_ftms_per_burst;
53419bb7e0f2SJohannes Berg 		u8 supported:1,
53429bb7e0f2SJohannes Berg 		   asap:1,
53439bb7e0f2SJohannes Berg 		   non_asap:1,
53449bb7e0f2SJohannes Berg 		   request_lci:1,
5345efb5520dSAvraham Stern 		   request_civicloc:1,
5346efb5520dSAvraham Stern 		   trigger_based:1,
5347efb5520dSAvraham Stern 		   non_trigger_based:1;
53489bb7e0f2SJohannes Berg 	} ftm;
53499bb7e0f2SJohannes Berg };
53509bb7e0f2SJohannes Berg 
53519bb7e0f2SJohannes Berg /**
5352d6039a34SVeerendranath Jakkam  * struct wiphy_iftype_akm_suites - This structure encapsulates supported akm
5353d6039a34SVeerendranath Jakkam  * suites for interface types defined in @iftypes_mask. Each type in the
5354d6039a34SVeerendranath Jakkam  * @iftypes_mask must be unique across all instances of iftype_akm_suites.
5355d6039a34SVeerendranath Jakkam  *
5356d6039a34SVeerendranath Jakkam  * @iftypes_mask: bitmask of interfaces types
5357d6039a34SVeerendranath Jakkam  * @akm_suites: points to an array of supported akm suites
5358d6039a34SVeerendranath Jakkam  * @n_akm_suites: number of supported AKM suites
5359d6039a34SVeerendranath Jakkam  */
5360d6039a34SVeerendranath Jakkam struct wiphy_iftype_akm_suites {
5361d6039a34SVeerendranath Jakkam 	u16 iftypes_mask;
5362d6039a34SVeerendranath Jakkam 	const u32 *akm_suites;
5363d6039a34SVeerendranath Jakkam 	int n_akm_suites;
5364d6039a34SVeerendranath Jakkam };
5365d6039a34SVeerendranath Jakkam 
5366cbbaf2bbSAvraham Stern #define CFG80211_HW_TIMESTAMP_ALL_PEERS	0xffff
5367cbbaf2bbSAvraham Stern 
5368d6039a34SVeerendranath Jakkam /**
53695be83de5SJohannes Berg  * struct wiphy - wireless hardware description
5370a05829a7SJohannes Berg  * @mtx: mutex for the data (structures) of this device
53712784fe91SLuis R. Rodriguez  * @reg_notifier: the driver's regulatory notification callback,
53722784fe91SLuis R. Rodriguez  *	note that if your driver uses wiphy_apply_custom_regulatory()
53732784fe91SLuis R. Rodriguez  *	the reg_notifier's request can be passed as NULL
5374d3236553SJohannes Berg  * @regd: the driver's regulatory domain, if one was requested via
5375d3236553SJohannes Berg  *	the regulatory_hint() API. This can be used by the driver
5376d3236553SJohannes Berg  *	on the reg_notifier() if it chooses to ignore future
5377d3236553SJohannes Berg  *	regulatory domain changes caused by other drivers.
5378d3236553SJohannes Berg  * @signal_type: signal type reported in &struct cfg80211_bss.
5379d3236553SJohannes Berg  * @cipher_suites: supported cipher suites
5380d3236553SJohannes Berg  * @n_cipher_suites: number of supported cipher suites
5381d6039a34SVeerendranath Jakkam  * @akm_suites: supported AKM suites. These are the default AKMs supported if
5382d6039a34SVeerendranath Jakkam  *	the supported AKMs not advertized for a specific interface type in
5383d6039a34SVeerendranath Jakkam  *	iftype_akm_suites.
5384ab4dfa20SVeerendranath Jakkam  * @n_akm_suites: number of supported AKM suites
5385d6039a34SVeerendranath Jakkam  * @iftype_akm_suites: array of supported akm suites info per interface type.
5386d6039a34SVeerendranath Jakkam  *	Note that the bits in @iftypes_mask inside this structure cannot
5387d6039a34SVeerendranath Jakkam  *	overlap (i.e. only one occurrence of each type is allowed across all
5388d6039a34SVeerendranath Jakkam  *	instances of iftype_akm_suites).
5389d6039a34SVeerendranath Jakkam  * @num_iftype_akm_suites: number of interface types for which supported akm
5390d6039a34SVeerendranath Jakkam  *	suites are specified separately.
5391b9a5f8caSJouni Malinen  * @retry_short: Retry limit for short frames (dot11ShortRetryLimit)
5392b9a5f8caSJouni Malinen  * @retry_long: Retry limit for long frames (dot11LongRetryLimit)
5393b9a5f8caSJouni Malinen  * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold);
5394b9a5f8caSJouni Malinen  *	-1 = fragmentation disabled, only odd values >= 256 used
5395b9a5f8caSJouni Malinen  * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled
5396abe37c4bSJohannes Berg  * @_net: the network namespace this wiphy currently lives in
5397ef15aac6SJohannes Berg  * @perm_addr: permanent MAC address of this device
5398ef15aac6SJohannes Berg  * @addr_mask: If the device supports multiple MAC addresses by masking,
5399ef15aac6SJohannes Berg  *	set this to a mask with variable bits set to 1, e.g. if the last
54000fcf8ac5SLuciano Coelho  *	four bits are variable then set it to 00-00-00-00-00-0f. The actual
5401ef15aac6SJohannes Berg  *	variable bits shall be determined by the interfaces added, with
5402ef15aac6SJohannes Berg  *	interfaces not matching the mask being rejected to be brought up.
5403ef15aac6SJohannes Berg  * @n_addresses: number of addresses in @addresses.
5404ef15aac6SJohannes Berg  * @addresses: If the device has more than one address, set this pointer
5405ef15aac6SJohannes Berg  *	to a list of addresses (6 bytes each). The first one will be used
5406ef15aac6SJohannes Berg  *	by default for perm_addr. In this case, the mask should be set to
5407ef15aac6SJohannes Berg  *	all-zeroes. In this case it is assumed that the device can handle
5408ef15aac6SJohannes Berg  *	the same number of arbitrary MAC addresses.
5409fd235913SRandy Dunlap  * @registered: protects ->resume and ->suspend sysfs callbacks against
5410fd235913SRandy Dunlap  *	unregister hardware
5411edf77192SJérôme Pouiller  * @debugfsdir: debugfs directory used for this wiphy (ieee80211/<wiphyname>).
5412edf77192SJérôme Pouiller  *	It will be renamed automatically on wiphy renames
541315bc6dfbSJérôme Pouiller  * @dev: (virtual) struct device for this wiphy. The item in
541415bc6dfbSJérôme Pouiller  *	/sys/class/ieee80211/ points to this. You need use set_wiphy_dev()
541515bc6dfbSJérôme Pouiller  *	(see below).
5416abe37c4bSJohannes Berg  * @wext: wireless extension handlers
5417abe37c4bSJohannes Berg  * @priv: driver private data (sized according to wiphy_new() parameter)
5418abe37c4bSJohannes Berg  * @interface_modes: bitmask of interfaces types valid for this wiphy,
5419abe37c4bSJohannes Berg  *	must be set by driver
54207527a782SJohannes Berg  * @iface_combinations: Valid interface combinations array, should not
54217527a782SJohannes Berg  *	list single interface types.
54227527a782SJohannes Berg  * @n_iface_combinations: number of entries in @iface_combinations array.
54237527a782SJohannes Berg  * @software_iftypes: bitmask of software interface types, these are not
54247527a782SJohannes Berg  *	subject to any restrictions since they are purely managed in SW.
5425abe37c4bSJohannes Berg  * @flags: wiphy flags, see &enum wiphy_flags
5426a2f73b6cSLuis R. Rodriguez  * @regulatory_flags: wiphy regulatory flags, see
5427a2f73b6cSLuis R. Rodriguez  *	&enum ieee80211_regulatory_flags
54281f074bd8SJohannes Berg  * @features: features advertised to nl80211, see &enum nl80211_feature_flags.
5429d75bb06bSGautam Kumar Shukla  * @ext_features: extended features advertised to nl80211, see
5430d75bb06bSGautam Kumar Shukla  *	&enum nl80211_ext_feature_index.
5431abe37c4bSJohannes Berg  * @bss_priv_size: each BSS struct has private data allocated with it,
5432abe37c4bSJohannes Berg  *	this variable determines its size
5433abe37c4bSJohannes Berg  * @max_scan_ssids: maximum number of SSIDs the device can scan for in
5434abe37c4bSJohannes Berg  *	any given scan
5435ca986ad9SArend Van Spriel  * @max_sched_scan_reqs: maximum number of scheduled scan requests that
5436ca986ad9SArend Van Spriel  *	the device can run concurrently.
543793b6aa69SLuciano Coelho  * @max_sched_scan_ssids: maximum number of SSIDs the device can scan
543893b6aa69SLuciano Coelho  *	for in any given scheduled scan
5439a1f1c21cSLuciano Coelho  * @max_match_sets: maximum number of match sets the device can handle
5440a1f1c21cSLuciano Coelho  *	when performing a scheduled scan, 0 if filtering is not
5441a1f1c21cSLuciano Coelho  *	supported.
5442abe37c4bSJohannes Berg  * @max_scan_ie_len: maximum length of user-controlled IEs device can
5443abe37c4bSJohannes Berg  *	add to probe request frames transmitted during a scan, must not
5444abe37c4bSJohannes Berg  *	include fixed IEs like supported rates
54455a865badSLuciano Coelho  * @max_sched_scan_ie_len: same as max_scan_ie_len, but for scheduled
54465a865badSLuciano Coelho  *	scans
54473b06d277SAvraham Stern  * @max_sched_scan_plans: maximum number of scan plans (scan interval and number
54483b06d277SAvraham Stern  *	of iterations) for scheduled scan supported by the device.
54493b06d277SAvraham Stern  * @max_sched_scan_plan_interval: maximum interval (in seconds) for a
54503b06d277SAvraham Stern  *	single scan plan supported by the device.
54513b06d277SAvraham Stern  * @max_sched_scan_plan_iterations: maximum number of iterations for a single
54523b06d277SAvraham Stern  *	scan plan supported by the device.
5453abe37c4bSJohannes Berg  * @coverage_class: current coverage class
5454abe37c4bSJohannes Berg  * @fw_version: firmware version for ethtool reporting
5455abe37c4bSJohannes Berg  * @hw_version: hardware version for ethtool reporting
5456abe37c4bSJohannes Berg  * @max_num_pmkids: maximum number of PMKIDs supported by device
5457abe37c4bSJohannes Berg  * @privid: a pointer that drivers can use to identify if an arbitrary
5458abe37c4bSJohannes Berg  *	wiphy is theirs, e.g. in global notifiers
5459abe37c4bSJohannes Berg  * @bands: information about bands/channels supported by this device
54602e161f78SJohannes Berg  *
54612e161f78SJohannes Berg  * @mgmt_stypes: bitmasks of frame subtypes that can be subscribed to or
54622e161f78SJohannes Berg  *	transmitted through nl80211, points to an array indexed by interface
54632e161f78SJohannes Berg  *	type
5464a7ffac95SBruno Randolf  *
54657f531e03SBruno Randolf  * @available_antennas_tx: bitmap of antennas which are available to be
54667f531e03SBruno Randolf  *	configured as TX antennas. Antenna configuration commands will be
54677f531e03SBruno Randolf  *	rejected unless this or @available_antennas_rx is set.
54687f531e03SBruno Randolf  *
54697f531e03SBruno Randolf  * @available_antennas_rx: bitmap of antennas which are available to be
54707f531e03SBruno Randolf  *	configured as RX antennas. Antenna configuration commands will be
54717f531e03SBruno Randolf  *	rejected unless this or @available_antennas_tx is set.
5472a293911dSJohannes Berg  *
547315f0ebc2SRandy Dunlap  * @probe_resp_offload:
547415f0ebc2SRandy Dunlap  *	 Bitmap of supported protocols for probe response offloading.
547515f0ebc2SRandy Dunlap  *	 See &enum nl80211_probe_resp_offload_support_attr. Only valid
547615f0ebc2SRandy Dunlap  *	 when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set.
547715f0ebc2SRandy Dunlap  *
5478a293911dSJohannes Berg  * @max_remain_on_channel_duration: Maximum time a remain-on-channel operation
5479a293911dSJohannes Berg  *	may request, if implemented.
5480ff1b6e69SJohannes Berg  *
5481ff1b6e69SJohannes Berg  * @wowlan: WoWLAN support information
54826abb9cb9SJohannes Berg  * @wowlan_config: current WoWLAN configuration; this should usually not be
54836abb9cb9SJohannes Berg  *	used since access to it is necessarily racy, use the parameter passed
54846abb9cb9SJohannes Berg  *	to the suspend() operation instead.
5485562a7480SJohannes Berg  *
5486562a7480SJohannes Berg  * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features.
54877e7c8926SBen Greear  * @ht_capa_mod_mask:  Specify what ht_cap values can be over-ridden.
54887e7c8926SBen Greear  *	If null, then none can be over-ridden.
5489ee2aca34SJohannes Berg  * @vht_capa_mod_mask:  Specify what VHT capabilities can be over-ridden.
5490ee2aca34SJohannes Berg  *	If null, then none can be over-ridden.
549177765eafSVasanthakumar Thiagarajan  *
549253873f13SJohannes Berg  * @wdev_list: the list of associated (virtual) interfaces; this list must
549353873f13SJohannes Berg  *	not be modified by the driver, but can be read with RTNL/RCU protection.
549453873f13SJohannes Berg  *
549577765eafSVasanthakumar Thiagarajan  * @max_acl_mac_addrs: Maximum number of MAC addresses that the device
549677765eafSVasanthakumar Thiagarajan  *	supports for ACL.
5497a50df0c4SJohannes Berg  *
5498a50df0c4SJohannes Berg  * @extended_capabilities: extended capabilities supported by the driver,
5499a50df0c4SJohannes Berg  *	additional capabilities might be supported by userspace; these are
5500a50df0c4SJohannes Berg  *	the 802.11 extended capabilities ("Extended Capabilities element")
5501a50df0c4SJohannes Berg  *	and are in the same format as in the information element. See
5502019ae3a9SKanchanapally, Vidyullatha  *	802.11-2012 8.4.2.29 for the defined fields. These are the default
5503019ae3a9SKanchanapally, Vidyullatha  *	extended capabilities to be used if the capabilities are not specified
5504019ae3a9SKanchanapally, Vidyullatha  *	for a specific interface type in iftype_ext_capab.
5505a50df0c4SJohannes Berg  * @extended_capabilities_mask: mask of the valid values
5506a50df0c4SJohannes Berg  * @extended_capabilities_len: length of the extended capabilities
5507019ae3a9SKanchanapally, Vidyullatha  * @iftype_ext_capab: array of extended capabilities per interface type
5508019ae3a9SKanchanapally, Vidyullatha  * @num_iftype_ext_capab: number of interface types for which extended
5509019ae3a9SKanchanapally, Vidyullatha  *	capabilities are specified separately.
5510be29b99aSAmitkumar Karwar  * @coalesce: packet coalescing support information
5511ad7e718cSJohannes Berg  *
5512ad7e718cSJohannes Berg  * @vendor_commands: array of vendor commands supported by the hardware
5513ad7e718cSJohannes Berg  * @n_vendor_commands: number of vendor commands
5514567ffc35SJohannes Berg  * @vendor_events: array of vendor events supported by the hardware
5515567ffc35SJohannes Berg  * @n_vendor_events: number of vendor events
5516b43504cfSJouni Malinen  *
5517b43504cfSJouni Malinen  * @max_ap_assoc_sta: maximum number of associated stations supported in AP mode
5518b43504cfSJouni Malinen  *	(including P2P GO) or 0 to indicate no such limit is advertised. The
5519b43504cfSJouni Malinen  *	driver is allowed to advertise a theoretical limit that it can reach in
5520b43504cfSJouni Malinen  *	some cases, but may not always reach.
5521c2e4323bSLuciano Coelho  *
5522c2e4323bSLuciano Coelho  * @max_num_csa_counters: Number of supported csa_counters in beacons
5523c2e4323bSLuciano Coelho  *	and probe responses.  This value should be set if the driver
5524c2e4323bSLuciano Coelho  *	wishes to limit the number of csa counters. Default (0) means
5525c2e4323bSLuciano Coelho  *	infinite.
552638de03d2SArend van Spriel  * @bss_select_support: bitmask indicating the BSS selection criteria supported
552738de03d2SArend van Spriel  *	by the driver in the .connect() callback. The bit position maps to the
552838de03d2SArend van Spriel  *	attribute indices defined in &enum nl80211_bss_select_attr.
5529a442b761SAyala Beker  *
55308585989dSLuca Coelho  * @nan_supported_bands: bands supported by the device in NAN mode, a
55318585989dSLuca Coelho  *	bitmap of &enum nl80211_band values.  For instance, for
55328585989dSLuca Coelho  *	NL80211_BAND_2GHZ, bit 0 would be set
55338585989dSLuca Coelho  *	(i.e. BIT(NL80211_BAND_2GHZ)).
5534f3a7ca64SJohannes Berg  *
5535f3a7ca64SJohannes Berg  * @txq_limit: configuration of internal TX queue frame limit
5536f3a7ca64SJohannes Berg  * @txq_memory_limit: configuration internal TX queue memory limit
5537f3a7ca64SJohannes Berg  * @txq_quantum: configuration of internal TX queue scheduler quantum
55389bb7e0f2SJohannes Berg  *
5539a710d214SLothar Rubusch  * @tx_queue_len: allow setting transmit queue len for drivers not using
5540a710d214SLothar Rubusch  *	wake_tx_queue
5541a710d214SLothar Rubusch  *
5542213ed579SSara Sharon  * @support_mbssid: can HW support association with nontransmitted AP
5543213ed579SSara Sharon  * @support_only_he_mbssid: don't parse MBSSID elements if it is not
5544213ed579SSara Sharon  *	HE AP, in order to avoid compatibility issues.
5545213ed579SSara Sharon  *	@support_mbssid must be set for this to have any effect.
5546213ed579SSara Sharon  *
55479bb7e0f2SJohannes Berg  * @pmsr_capa: peer measurement capabilities
55483710a8a6SJohannes Berg  *
55493710a8a6SJohannes Berg  * @tid_config_support: describes the per-TID config support that the
55503710a8a6SJohannes Berg  *	device has
55513710a8a6SJohannes Berg  * @tid_config_support.vif: bitmap of attributes (configurations)
55523710a8a6SJohannes Berg  *	supported by the driver for each vif
55533710a8a6SJohannes Berg  * @tid_config_support.peer: bitmap of attributes (configurations)
55543710a8a6SJohannes Berg  *	supported by the driver for each peer
55556a21d16cSTamizh chelvam  * @tid_config_support.max_retry: maximum supported retry count for
55566a21d16cSTamizh chelvam  *	long/short retry configuration
5557a710d214SLothar Rubusch  *
5558a710d214SLothar Rubusch  * @max_data_retry_count: maximum supported per TID retry count for
5559a710d214SLothar Rubusch  *	configuration through the %NL80211_TID_CONFIG_ATTR_RETRY_SHORT and
5560a710d214SLothar Rubusch  *	%NL80211_TID_CONFIG_ATTR_RETRY_LONG attributes
556170b6ff35SJohannes Berg  * @sar_capa: SAR control capabilities
5562358ae888SEmmanuel Grumbach  * @rfkill: a pointer to the rfkill structure
5563dc1e3cb8SJohn Crispin  *
5564dc1e3cb8SJohn Crispin  * @mbssid_max_interfaces: maximum number of interfaces supported by the driver
5565dc1e3cb8SJohn Crispin  *	in a multiple BSSID set. This field must be set to a non-zero value
5566dc1e3cb8SJohn Crispin  *	by the driver to advertise MBSSID support.
5567f9d366d4SJohannes Berg  * @ema_max_profile_periodicity: maximum profile periodicity supported by
5568dc1e3cb8SJohn Crispin  *	the driver. Setting this field to a non-zero value indicates that the
5569dc1e3cb8SJohn Crispin  *	driver supports enhanced multi-BSSID advertisements (EMA AP).
5570ecad3b0bSVeerendranath Jakkam  * @max_num_akm_suites: maximum number of AKM suites allowed for
5571ecad3b0bSVeerendranath Jakkam  *	configuration through %NL80211_CMD_CONNECT, %NL80211_CMD_ASSOCIATE and
5572ecad3b0bSVeerendranath Jakkam  *	%NL80211_CMD_START_AP. Set to NL80211_MAX_NR_AKM_SUITES if not set by
5573ecad3b0bSVeerendranath Jakkam  *	driver. If set by driver minimum allowed value is
5574ecad3b0bSVeerendranath Jakkam  *	NL80211_MAX_NR_AKM_SUITES in order to avoid compatibility issues with
5575ecad3b0bSVeerendranath Jakkam  *	legacy userspace and maximum allowed value is
5576ecad3b0bSVeerendranath Jakkam  *	CFG80211_MAX_NUM_AKM_SUITES.
5577cbbaf2bbSAvraham Stern  *
5578cbbaf2bbSAvraham Stern  * @hw_timestamp_max_peers: maximum number of peers that the driver supports
5579cbbaf2bbSAvraham Stern  *	enabling HW timestamping for concurrently. Setting this field to a
5580cbbaf2bbSAvraham Stern  *	non-zero value indicates that the driver supports HW timestamping.
5581cbbaf2bbSAvraham Stern  *	A value of %CFG80211_HW_TIMESTAMP_ALL_PEERS indicates the driver
5582cbbaf2bbSAvraham Stern  *	supports enabling HW timestamping for all peers (i.e. no need to
5583cbbaf2bbSAvraham Stern  *	specify a mac address).
5584d3236553SJohannes Berg  */
5585d3236553SJohannes Berg struct wiphy {
5586a05829a7SJohannes Berg 	struct mutex mtx;
5587a05829a7SJohannes Berg 
5588d3236553SJohannes Berg 	/* assign these fields before you register the wiphy */
5589d3236553SJohannes Berg 
5590d3236553SJohannes Berg 	u8 perm_addr[ETH_ALEN];
5591ef15aac6SJohannes Berg 	u8 addr_mask[ETH_ALEN];
5592ef15aac6SJohannes Berg 
5593ef15aac6SJohannes Berg 	struct mac_address *addresses;
5594d3236553SJohannes Berg 
55952e161f78SJohannes Berg 	const struct ieee80211_txrx_stypes *mgmt_stypes;
55962e161f78SJohannes Berg 
55977527a782SJohannes Berg 	const struct ieee80211_iface_combination *iface_combinations;
55987527a782SJohannes Berg 	int n_iface_combinations;
55997527a782SJohannes Berg 	u16 software_iftypes;
56007527a782SJohannes Berg 
56012e161f78SJohannes Berg 	u16 n_addresses;
56022e161f78SJohannes Berg 
5603d3236553SJohannes Berg 	/* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
5604d3236553SJohannes Berg 	u16 interface_modes;
5605d3236553SJohannes Berg 
560677765eafSVasanthakumar Thiagarajan 	u16 max_acl_mac_addrs;
560777765eafSVasanthakumar Thiagarajan 
5608a2f73b6cSLuis R. Rodriguez 	u32 flags, regulatory_flags, features;
5609d75bb06bSGautam Kumar Shukla 	u8 ext_features[DIV_ROUND_UP(NUM_NL80211_EXT_FEATURES, 8)];
5610463d0183SJohannes Berg 
5611562a7480SJohannes Berg 	u32 ap_sme_capa;
5612562a7480SJohannes Berg 
5613d3236553SJohannes Berg 	enum cfg80211_signal_type signal_type;
5614d3236553SJohannes Berg 
5615d3236553SJohannes Berg 	int bss_priv_size;
5616d3236553SJohannes Berg 	u8 max_scan_ssids;
5617ca986ad9SArend Van Spriel 	u8 max_sched_scan_reqs;
561893b6aa69SLuciano Coelho 	u8 max_sched_scan_ssids;
5619a1f1c21cSLuciano Coelho 	u8 max_match_sets;
5620d3236553SJohannes Berg 	u16 max_scan_ie_len;
56215a865badSLuciano Coelho 	u16 max_sched_scan_ie_len;
56223b06d277SAvraham Stern 	u32 max_sched_scan_plans;
56233b06d277SAvraham Stern 	u32 max_sched_scan_plan_interval;
56243b06d277SAvraham Stern 	u32 max_sched_scan_plan_iterations;
5625d3236553SJohannes Berg 
5626d3236553SJohannes Berg 	int n_cipher_suites;
5627d3236553SJohannes Berg 	const u32 *cipher_suites;
5628d3236553SJohannes Berg 
5629ab4dfa20SVeerendranath Jakkam 	int n_akm_suites;
5630ab4dfa20SVeerendranath Jakkam 	const u32 *akm_suites;
5631ab4dfa20SVeerendranath Jakkam 
5632d6039a34SVeerendranath Jakkam 	const struct wiphy_iftype_akm_suites *iftype_akm_suites;
5633d6039a34SVeerendranath Jakkam 	unsigned int num_iftype_akm_suites;
5634d6039a34SVeerendranath Jakkam 
5635b9a5f8caSJouni Malinen 	u8 retry_short;
5636b9a5f8caSJouni Malinen 	u8 retry_long;
5637b9a5f8caSJouni Malinen 	u32 frag_threshold;
5638b9a5f8caSJouni Malinen 	u32 rts_threshold;
563981077e82SLukáš Turek 	u8 coverage_class;
5640b9a5f8caSJouni Malinen 
564181135548SJiri Pirko 	char fw_version[ETHTOOL_FWVERS_LEN];
5642dfce95f5SKalle Valo 	u32 hw_version;
5643dfce95f5SKalle Valo 
5644dfb89c56SJohannes Berg #ifdef CONFIG_PM
5645964dc9e2SJohannes Berg 	const struct wiphy_wowlan_support *wowlan;
56466abb9cb9SJohannes Berg 	struct cfg80211_wowlan *wowlan_config;
5647dfb89c56SJohannes Berg #endif
5648ff1b6e69SJohannes Berg 
5649a293911dSJohannes Berg 	u16 max_remain_on_channel_duration;
5650a293911dSJohannes Berg 
565167fbb16bSSamuel Ortiz 	u8 max_num_pmkids;
565267fbb16bSSamuel Ortiz 
56537f531e03SBruno Randolf 	u32 available_antennas_tx;
56547f531e03SBruno Randolf 	u32 available_antennas_rx;
5655a7ffac95SBruno Randolf 
565687bbbe22SArik Nemtsov 	u32 probe_resp_offload;
565787bbbe22SArik Nemtsov 
5658a50df0c4SJohannes Berg 	const u8 *extended_capabilities, *extended_capabilities_mask;
5659a50df0c4SJohannes Berg 	u8 extended_capabilities_len;
5660a50df0c4SJohannes Berg 
5661019ae3a9SKanchanapally, Vidyullatha 	const struct wiphy_iftype_ext_capab *iftype_ext_capab;
5662019ae3a9SKanchanapally, Vidyullatha 	unsigned int num_iftype_ext_capab;
5663019ae3a9SKanchanapally, Vidyullatha 
5664cf5aa2f1SDavid Kilroy 	const void *privid;
5665d3236553SJohannes Berg 
566657fbcce3SJohannes Berg 	struct ieee80211_supported_band *bands[NUM_NL80211_BANDS];
5667d3236553SJohannes Berg 
56680c0280bdSLuis R. Rodriguez 	void (*reg_notifier)(struct wiphy *wiphy,
5669d3236553SJohannes Berg 			     struct regulatory_request *request);
5670d3236553SJohannes Berg 
5671d3236553SJohannes Berg 	/* fields below are read-only, assigned by cfg80211 */
5672d3236553SJohannes Berg 
5673458f4f9eSJohannes Berg 	const struct ieee80211_regdomain __rcu *regd;
5674d3236553SJohannes Berg 
5675d3236553SJohannes Berg 	struct device dev;
5676d3236553SJohannes Berg 
5677ecb44335SStanislaw Gruszka 	bool registered;
5678ecb44335SStanislaw Gruszka 
5679d3236553SJohannes Berg 	struct dentry *debugfsdir;
5680d3236553SJohannes Berg 
56817e7c8926SBen Greear 	const struct ieee80211_ht_cap *ht_capa_mod_mask;
5682ee2aca34SJohannes Berg 	const struct ieee80211_vht_cap *vht_capa_mod_mask;
56837e7c8926SBen Greear 
568453873f13SJohannes Berg 	struct list_head wdev_list;
568553873f13SJohannes Berg 
56860c5c9fb5SEric W. Biederman 	possible_net_t _net;
5687463d0183SJohannes Berg 
56883d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT
56893d23e349SJohannes Berg 	const struct iw_handler_def *wext;
56903d23e349SJohannes Berg #endif
56913d23e349SJohannes Berg 
5692be29b99aSAmitkumar Karwar 	const struct wiphy_coalesce_support *coalesce;
5693be29b99aSAmitkumar Karwar 
5694ad7e718cSJohannes Berg 	const struct wiphy_vendor_command *vendor_commands;
5695567ffc35SJohannes Berg 	const struct nl80211_vendor_cmd_info *vendor_events;
5696567ffc35SJohannes Berg 	int n_vendor_commands, n_vendor_events;
5697ad7e718cSJohannes Berg 
5698b43504cfSJouni Malinen 	u16 max_ap_assoc_sta;
5699b43504cfSJouni Malinen 
57009a774c78SAndrei Otcheretianski 	u8 max_num_csa_counters;
57019a774c78SAndrei Otcheretianski 
570238de03d2SArend van Spriel 	u32 bss_select_support;
570338de03d2SArend van Spriel 
57048585989dSLuca Coelho 	u8 nan_supported_bands;
57058585989dSLuca Coelho 
570652539ca8SToke Høiland-Jørgensen 	u32 txq_limit;
570752539ca8SToke Høiland-Jørgensen 	u32 txq_memory_limit;
570852539ca8SToke Høiland-Jørgensen 	u32 txq_quantum;
570952539ca8SToke Høiland-Jørgensen 
57101f6e0baaSJohn Crispin 	unsigned long tx_queue_len;
57111f6e0baaSJohn Crispin 
5712213ed579SSara Sharon 	u8 support_mbssid:1,
5713213ed579SSara Sharon 	   support_only_he_mbssid:1;
5714213ed579SSara Sharon 
57159bb7e0f2SJohannes Berg 	const struct cfg80211_pmsr_capabilities *pmsr_capa;
57169bb7e0f2SJohannes Berg 
57173710a8a6SJohannes Berg 	struct {
57183710a8a6SJohannes Berg 		u64 peer, vif;
57196a21d16cSTamizh chelvam 		u8 max_retry;
57203710a8a6SJohannes Berg 	} tid_config_support;
57213710a8a6SJohannes Berg 
57226a21d16cSTamizh chelvam 	u8 max_data_retry_count;
57236a21d16cSTamizh chelvam 
57246bdb68ceSCarl Huang 	const struct cfg80211_sar_capa *sar_capa;
57256bdb68ceSCarl Huang 
5726358ae888SEmmanuel Grumbach 	struct rfkill *rfkill;
5727358ae888SEmmanuel Grumbach 
5728dc1e3cb8SJohn Crispin 	u8 mbssid_max_interfaces;
5729dc1e3cb8SJohn Crispin 	u8 ema_max_profile_periodicity;
5730ecad3b0bSVeerendranath Jakkam 	u16 max_num_akm_suites;
5731dc1e3cb8SJohn Crispin 
5732cbbaf2bbSAvraham Stern 	u16 hw_timestamp_max_peers;
5733cbbaf2bbSAvraham Stern 
5734396fba0aSGustavo A. R. Silva 	char priv[] __aligned(NETDEV_ALIGN);
5735d3236553SJohannes Berg };
5736d3236553SJohannes Berg 
5737463d0183SJohannes Berg static inline struct net *wiphy_net(struct wiphy *wiphy)
5738463d0183SJohannes Berg {
5739c2d9ba9bSEric Dumazet 	return read_pnet(&wiphy->_net);
5740463d0183SJohannes Berg }
5741463d0183SJohannes Berg 
5742463d0183SJohannes Berg static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net)
5743463d0183SJohannes Berg {
5744c2d9ba9bSEric Dumazet 	write_pnet(&wiphy->_net, net);
5745463d0183SJohannes Berg }
5746463d0183SJohannes Berg 
5747d3236553SJohannes Berg /**
5748d3236553SJohannes Berg  * wiphy_priv - return priv from wiphy
5749d3236553SJohannes Berg  *
5750d3236553SJohannes Berg  * @wiphy: the wiphy whose priv pointer to return
57510ae997dcSYacine Belkadi  * Return: The priv of @wiphy.
5752d3236553SJohannes Berg  */
5753d3236553SJohannes Berg static inline void *wiphy_priv(struct wiphy *wiphy)
5754d3236553SJohannes Berg {
5755d3236553SJohannes Berg 	BUG_ON(!wiphy);
5756d3236553SJohannes Berg 	return &wiphy->priv;
5757d3236553SJohannes Berg }
5758d3236553SJohannes Berg 
5759d3236553SJohannes Berg /**
5760f1f74825SDavid Kilroy  * priv_to_wiphy - return the wiphy containing the priv
5761f1f74825SDavid Kilroy  *
5762f1f74825SDavid Kilroy  * @priv: a pointer previously returned by wiphy_priv
57630ae997dcSYacine Belkadi  * Return: The wiphy of @priv.
5764f1f74825SDavid Kilroy  */
5765f1f74825SDavid Kilroy static inline struct wiphy *priv_to_wiphy(void *priv)
5766f1f74825SDavid Kilroy {
5767f1f74825SDavid Kilroy 	BUG_ON(!priv);
5768f1f74825SDavid Kilroy 	return container_of(priv, struct wiphy, priv);
5769f1f74825SDavid Kilroy }
5770f1f74825SDavid Kilroy 
5771f1f74825SDavid Kilroy /**
5772d3236553SJohannes Berg  * set_wiphy_dev - set device pointer for wiphy
5773d3236553SJohannes Berg  *
5774d3236553SJohannes Berg  * @wiphy: The wiphy whose device to bind
5775d3236553SJohannes Berg  * @dev: The device to parent it to
5776d3236553SJohannes Berg  */
5777d3236553SJohannes Berg static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev)
5778d3236553SJohannes Berg {
5779d3236553SJohannes Berg 	wiphy->dev.parent = dev;
5780d3236553SJohannes Berg }
5781d3236553SJohannes Berg 
5782d3236553SJohannes Berg /**
5783d3236553SJohannes Berg  * wiphy_dev - get wiphy dev pointer
5784d3236553SJohannes Berg  *
5785d3236553SJohannes Berg  * @wiphy: The wiphy whose device struct to look up
57860ae997dcSYacine Belkadi  * Return: The dev of @wiphy.
5787d3236553SJohannes Berg  */
5788d3236553SJohannes Berg static inline struct device *wiphy_dev(struct wiphy *wiphy)
5789d3236553SJohannes Berg {
5790d3236553SJohannes Berg 	return wiphy->dev.parent;
5791d3236553SJohannes Berg }
5792d3236553SJohannes Berg 
5793d3236553SJohannes Berg /**
5794d3236553SJohannes Berg  * wiphy_name - get wiphy name
5795d3236553SJohannes Berg  *
5796d3236553SJohannes Berg  * @wiphy: The wiphy whose name to return
57970ae997dcSYacine Belkadi  * Return: The name of @wiphy.
5798d3236553SJohannes Berg  */
5799e1db74fcSJoe Perches static inline const char *wiphy_name(const struct wiphy *wiphy)
5800d3236553SJohannes Berg {
5801d3236553SJohannes Berg 	return dev_name(&wiphy->dev);
5802d3236553SJohannes Berg }
5803d3236553SJohannes Berg 
5804d3236553SJohannes Berg /**
58051998d90aSBen Greear  * wiphy_new_nm - create a new wiphy for use with cfg80211
58061998d90aSBen Greear  *
58071998d90aSBen Greear  * @ops: The configuration operations for this device
58081998d90aSBen Greear  * @sizeof_priv: The size of the private area to allocate
58091998d90aSBen Greear  * @requested_name: Request a particular name.
58101998d90aSBen Greear  *	NULL is valid value, and means use the default phy%d naming.
58111998d90aSBen Greear  *
58121998d90aSBen Greear  * Create a new wiphy and associate the given operations with it.
58131998d90aSBen Greear  * @sizeof_priv bytes are allocated for private use.
58141998d90aSBen Greear  *
58151998d90aSBen Greear  * Return: A pointer to the new wiphy. This pointer must be
58161998d90aSBen Greear  * assigned to each netdev's ieee80211_ptr for proper operation.
58171998d90aSBen Greear  */
58181998d90aSBen Greear struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv,
58191998d90aSBen Greear 			   const char *requested_name);
58201998d90aSBen Greear 
58211998d90aSBen Greear /**
5822d3236553SJohannes Berg  * wiphy_new - create a new wiphy for use with cfg80211
5823d3236553SJohannes Berg  *
5824d3236553SJohannes Berg  * @ops: The configuration operations for this device
5825d3236553SJohannes Berg  * @sizeof_priv: The size of the private area to allocate
5826d3236553SJohannes Berg  *
5827d3236553SJohannes Berg  * Create a new wiphy and associate the given operations with it.
5828d3236553SJohannes Berg  * @sizeof_priv bytes are allocated for private use.
5829d3236553SJohannes Berg  *
58300ae997dcSYacine Belkadi  * Return: A pointer to the new wiphy. This pointer must be
58310ae997dcSYacine Belkadi  * assigned to each netdev's ieee80211_ptr for proper operation.
5832d3236553SJohannes Berg  */
58331998d90aSBen Greear static inline struct wiphy *wiphy_new(const struct cfg80211_ops *ops,
58341998d90aSBen Greear 				      int sizeof_priv)
58351998d90aSBen Greear {
58361998d90aSBen Greear 	return wiphy_new_nm(ops, sizeof_priv, NULL);
58371998d90aSBen Greear }
5838d3236553SJohannes Berg 
5839d3236553SJohannes Berg /**
5840d3236553SJohannes Berg  * wiphy_register - register a wiphy with cfg80211
5841d3236553SJohannes Berg  *
5842d3236553SJohannes Berg  * @wiphy: The wiphy to register.
5843d3236553SJohannes Berg  *
58440ae997dcSYacine Belkadi  * Return: A non-negative wiphy index or a negative error code.
5845d3236553SJohannes Berg  */
584610dd9b7cSJoe Perches int wiphy_register(struct wiphy *wiphy);
5847d3236553SJohannes Berg 
5848a05829a7SJohannes Berg /* this is a define for better error reporting (file/line) */
5849a05829a7SJohannes Berg #define lockdep_assert_wiphy(wiphy) lockdep_assert_held(&(wiphy)->mtx)
5850a05829a7SJohannes Berg 
5851a05829a7SJohannes Berg /**
5852a05829a7SJohannes Berg  * rcu_dereference_wiphy - rcu_dereference with debug checking
5853a05829a7SJohannes Berg  * @wiphy: the wiphy to check the locking on
5854a05829a7SJohannes Berg  * @p: The pointer to read, prior to dereferencing
5855a05829a7SJohannes Berg  *
5856a05829a7SJohannes Berg  * Do an rcu_dereference(p), but check caller either holds rcu_read_lock()
5857a05829a7SJohannes Berg  * or RTNL. Note: Please prefer wiphy_dereference() or rcu_dereference().
5858a05829a7SJohannes Berg  */
5859a05829a7SJohannes Berg #define rcu_dereference_wiphy(wiphy, p)				\
5860a05829a7SJohannes Berg         rcu_dereference_check(p, lockdep_is_held(&wiphy->mtx))
5861a05829a7SJohannes Berg 
5862a05829a7SJohannes Berg /**
5863a05829a7SJohannes Berg  * wiphy_dereference - fetch RCU pointer when updates are prevented by wiphy mtx
5864a05829a7SJohannes Berg  * @wiphy: the wiphy to check the locking on
5865a05829a7SJohannes Berg  * @p: The pointer to read, prior to dereferencing
5866a05829a7SJohannes Berg  *
5867a05829a7SJohannes Berg  * Return the value of the specified RCU-protected pointer, but omit the
5868a05829a7SJohannes Berg  * READ_ONCE(), because caller holds the wiphy mutex used for updates.
5869a05829a7SJohannes Berg  */
5870a05829a7SJohannes Berg #define wiphy_dereference(wiphy, p)				\
5871a05829a7SJohannes Berg         rcu_dereference_protected(p, lockdep_is_held(&wiphy->mtx))
5872a05829a7SJohannes Berg 
5873a05829a7SJohannes Berg /**
5874a05829a7SJohannes Berg  * get_wiphy_regdom - get custom regdomain for the given wiphy
5875a05829a7SJohannes Berg  * @wiphy: the wiphy to get the regdomain from
5876a05829a7SJohannes Berg  */
5877a05829a7SJohannes Berg const struct ieee80211_regdomain *get_wiphy_regdom(struct wiphy *wiphy);
5878a05829a7SJohannes Berg 
5879d3236553SJohannes Berg /**
5880d3236553SJohannes Berg  * wiphy_unregister - deregister a wiphy from cfg80211
5881d3236553SJohannes Berg  *
5882d3236553SJohannes Berg  * @wiphy: The wiphy to unregister.
5883d3236553SJohannes Berg  *
5884d3236553SJohannes Berg  * After this call, no more requests can be made with this priv
5885d3236553SJohannes Berg  * pointer, but the call may sleep to wait for an outstanding
5886d3236553SJohannes Berg  * request that is being handled.
5887d3236553SJohannes Berg  */
588810dd9b7cSJoe Perches void wiphy_unregister(struct wiphy *wiphy);
5889d3236553SJohannes Berg 
5890d3236553SJohannes Berg /**
5891d3236553SJohannes Berg  * wiphy_free - free wiphy
5892d3236553SJohannes Berg  *
5893d3236553SJohannes Berg  * @wiphy: The wiphy to free
5894d3236553SJohannes Berg  */
589510dd9b7cSJoe Perches void wiphy_free(struct wiphy *wiphy);
5896d3236553SJohannes Berg 
5897fffd0934SJohannes Berg /* internal structs */
58986829c878SJohannes Berg struct cfg80211_conn;
589919957bb3SJohannes Berg struct cfg80211_internal_bss;
5900fffd0934SJohannes Berg struct cfg80211_cached_keys;
59014a4b8169SAndrew Zaborowski struct cfg80211_cqm_config;
590219957bb3SJohannes Berg 
5903d3236553SJohannes Berg /**
5904a05829a7SJohannes Berg  * wiphy_lock - lock the wiphy
5905a05829a7SJohannes Berg  * @wiphy: the wiphy to lock
5906a05829a7SJohannes Berg  *
5907a3ee4dc8SJohannes Berg  * This is needed around registering and unregistering netdevs that
5908a3ee4dc8SJohannes Berg  * aren't created through cfg80211 calls, since that requires locking
5909a3ee4dc8SJohannes Berg  * in cfg80211 when the notifiers is called, but that cannot
5910a3ee4dc8SJohannes Berg  * differentiate which way it's called.
5911a3ee4dc8SJohannes Berg  *
5912a3ee4dc8SJohannes Berg  * It can also be used by drivers for their own purposes.
5913a05829a7SJohannes Berg  *
5914a05829a7SJohannes Berg  * When cfg80211 ops are called, the wiphy is already locked.
5915a3ee4dc8SJohannes Berg  *
5916a3ee4dc8SJohannes Berg  * Note that this makes sure that no workers that have been queued
5917a3ee4dc8SJohannes Berg  * with wiphy_queue_work() are running.
5918a05829a7SJohannes Berg  */
5919a05829a7SJohannes Berg static inline void wiphy_lock(struct wiphy *wiphy)
5920a05829a7SJohannes Berg 	__acquires(&wiphy->mtx)
5921a05829a7SJohannes Berg {
5922a05829a7SJohannes Berg 	mutex_lock(&wiphy->mtx);
5923a05829a7SJohannes Berg 	__acquire(&wiphy->mtx);
5924a05829a7SJohannes Berg }
5925a05829a7SJohannes Berg 
5926a05829a7SJohannes Berg /**
5927a05829a7SJohannes Berg  * wiphy_unlock - unlock the wiphy again
5928a05829a7SJohannes Berg  * @wiphy: the wiphy to unlock
5929a05829a7SJohannes Berg  */
5930a05829a7SJohannes Berg static inline void wiphy_unlock(struct wiphy *wiphy)
5931a05829a7SJohannes Berg 	__releases(&wiphy->mtx)
5932a05829a7SJohannes Berg {
5933a05829a7SJohannes Berg 	__release(&wiphy->mtx);
5934a05829a7SJohannes Berg 	mutex_unlock(&wiphy->mtx);
5935a05829a7SJohannes Berg }
5936a05829a7SJohannes Berg 
5937a3ee4dc8SJohannes Berg struct wiphy_work;
5938a3ee4dc8SJohannes Berg typedef void (*wiphy_work_func_t)(struct wiphy *, struct wiphy_work *);
5939a3ee4dc8SJohannes Berg 
5940a3ee4dc8SJohannes Berg struct wiphy_work {
5941a3ee4dc8SJohannes Berg 	struct list_head entry;
5942a3ee4dc8SJohannes Berg 	wiphy_work_func_t func;
5943a3ee4dc8SJohannes Berg };
5944a3ee4dc8SJohannes Berg 
5945a3ee4dc8SJohannes Berg static inline void wiphy_work_init(struct wiphy_work *work,
5946a3ee4dc8SJohannes Berg 				   wiphy_work_func_t func)
5947a3ee4dc8SJohannes Berg {
5948a3ee4dc8SJohannes Berg 	INIT_LIST_HEAD(&work->entry);
5949a3ee4dc8SJohannes Berg 	work->func = func;
5950a3ee4dc8SJohannes Berg }
5951a3ee4dc8SJohannes Berg 
5952a3ee4dc8SJohannes Berg /**
5953a3ee4dc8SJohannes Berg  * wiphy_work_queue - queue work for the wiphy
5954a3ee4dc8SJohannes Berg  * @wiphy: the wiphy to queue for
5955a3ee4dc8SJohannes Berg  * @work: the work item
5956a3ee4dc8SJohannes Berg  *
5957a3ee4dc8SJohannes Berg  * This is useful for work that must be done asynchronously, and work
5958a3ee4dc8SJohannes Berg  * queued here has the special property that the wiphy mutex will be
5959a3ee4dc8SJohannes Berg  * held as if wiphy_lock() was called, and that it cannot be running
5960a3ee4dc8SJohannes Berg  * after wiphy_lock() was called. Therefore, wiphy_cancel_work() can
5961a3ee4dc8SJohannes Berg  * use just cancel_work() instead of cancel_work_sync(), it requires
5962a3ee4dc8SJohannes Berg  * being in a section protected by wiphy_lock().
5963a3ee4dc8SJohannes Berg  */
5964a3ee4dc8SJohannes Berg void wiphy_work_queue(struct wiphy *wiphy, struct wiphy_work *work);
5965a3ee4dc8SJohannes Berg 
5966a3ee4dc8SJohannes Berg /**
5967a3ee4dc8SJohannes Berg  * wiphy_work_cancel - cancel previously queued work
5968a3ee4dc8SJohannes Berg  * @wiphy: the wiphy, for debug purposes
5969a3ee4dc8SJohannes Berg  * @work: the work to cancel
5970a3ee4dc8SJohannes Berg  *
5971a3ee4dc8SJohannes Berg  * Cancel the work *without* waiting for it, this assumes being
5972a3ee4dc8SJohannes Berg  * called under the wiphy mutex acquired by wiphy_lock().
5973a3ee4dc8SJohannes Berg  */
5974a3ee4dc8SJohannes Berg void wiphy_work_cancel(struct wiphy *wiphy, struct wiphy_work *work);
5975a3ee4dc8SJohannes Berg 
597656cfb8ceSJohannes Berg /**
597756cfb8ceSJohannes Berg  * wiphy_work_flush - flush previously queued work
597856cfb8ceSJohannes Berg  * @wiphy: the wiphy, for debug purposes
597956cfb8ceSJohannes Berg  * @work: the work to flush, this can be %NULL to flush all work
598056cfb8ceSJohannes Berg  *
598156cfb8ceSJohannes Berg  * Flush the work (i.e. run it if pending). This must be called
598256cfb8ceSJohannes Berg  * under the wiphy mutex acquired by wiphy_lock().
598356cfb8ceSJohannes Berg  */
598456cfb8ceSJohannes Berg void wiphy_work_flush(struct wiphy *wiphy, struct wiphy_work *work);
598556cfb8ceSJohannes Berg 
5986a3ee4dc8SJohannes Berg struct wiphy_delayed_work {
5987a3ee4dc8SJohannes Berg 	struct wiphy_work work;
5988a3ee4dc8SJohannes Berg 	struct wiphy *wiphy;
5989a3ee4dc8SJohannes Berg 	struct timer_list timer;
5990a3ee4dc8SJohannes Berg };
5991a3ee4dc8SJohannes Berg 
5992a3ee4dc8SJohannes Berg void wiphy_delayed_work_timer(struct timer_list *t);
5993a3ee4dc8SJohannes Berg 
5994a3ee4dc8SJohannes Berg static inline void wiphy_delayed_work_init(struct wiphy_delayed_work *dwork,
5995a3ee4dc8SJohannes Berg 					   wiphy_work_func_t func)
5996a3ee4dc8SJohannes Berg {
5997a3ee4dc8SJohannes Berg 	timer_setup(&dwork->timer, wiphy_delayed_work_timer, 0);
5998a3ee4dc8SJohannes Berg 	wiphy_work_init(&dwork->work, func);
5999a3ee4dc8SJohannes Berg }
6000a3ee4dc8SJohannes Berg 
6001a3ee4dc8SJohannes Berg /**
6002a3ee4dc8SJohannes Berg  * wiphy_delayed_work_queue - queue delayed work for the wiphy
6003a3ee4dc8SJohannes Berg  * @wiphy: the wiphy to queue for
6004a3ee4dc8SJohannes Berg  * @dwork: the delayable worker
6005a3ee4dc8SJohannes Berg  * @delay: number of jiffies to wait before queueing
6006a3ee4dc8SJohannes Berg  *
6007a3ee4dc8SJohannes Berg  * This is useful for work that must be done asynchronously, and work
6008a3ee4dc8SJohannes Berg  * queued here has the special property that the wiphy mutex will be
6009a3ee4dc8SJohannes Berg  * held as if wiphy_lock() was called, and that it cannot be running
6010a3ee4dc8SJohannes Berg  * after wiphy_lock() was called. Therefore, wiphy_cancel_work() can
6011a3ee4dc8SJohannes Berg  * use just cancel_work() instead of cancel_work_sync(), it requires
6012a3ee4dc8SJohannes Berg  * being in a section protected by wiphy_lock().
6013a3ee4dc8SJohannes Berg  */
6014a3ee4dc8SJohannes Berg void wiphy_delayed_work_queue(struct wiphy *wiphy,
6015a3ee4dc8SJohannes Berg 			      struct wiphy_delayed_work *dwork,
6016a3ee4dc8SJohannes Berg 			      unsigned long delay);
6017a3ee4dc8SJohannes Berg 
6018a3ee4dc8SJohannes Berg /**
6019a3ee4dc8SJohannes Berg  * wiphy_delayed_work_cancel - cancel previously queued delayed work
6020a3ee4dc8SJohannes Berg  * @wiphy: the wiphy, for debug purposes
6021a3ee4dc8SJohannes Berg  * @dwork: the delayed work to cancel
6022a3ee4dc8SJohannes Berg  *
6023a3ee4dc8SJohannes Berg  * Cancel the work *without* waiting for it, this assumes being
6024a3ee4dc8SJohannes Berg  * called under the wiphy mutex acquired by wiphy_lock().
6025a3ee4dc8SJohannes Berg  */
6026a3ee4dc8SJohannes Berg void wiphy_delayed_work_cancel(struct wiphy *wiphy,
6027a3ee4dc8SJohannes Berg 			       struct wiphy_delayed_work *dwork);
6028a3ee4dc8SJohannes Berg 
6029a05829a7SJohannes Berg /**
60308c73d524SJohannes Berg  * wiphy_delayed_work_flush - flush previously queued delayed work
603156cfb8ceSJohannes Berg  * @wiphy: the wiphy, for debug purposes
60329c386911SJohannes Berg  * @dwork: the delayed work to flush
603356cfb8ceSJohannes Berg  *
603456cfb8ceSJohannes Berg  * Flush the work (i.e. run it if pending). This must be called
603556cfb8ceSJohannes Berg  * under the wiphy mutex acquired by wiphy_lock().
603656cfb8ceSJohannes Berg  */
603756cfb8ceSJohannes Berg void wiphy_delayed_work_flush(struct wiphy *wiphy,
603856cfb8ceSJohannes Berg 			      struct wiphy_delayed_work *dwork);
603956cfb8ceSJohannes Berg 
604056cfb8ceSJohannes Berg /**
604189a54e48SJohannes Berg  * struct wireless_dev - wireless device state
6042d3236553SJohannes Berg  *
604389a54e48SJohannes Berg  * For netdevs, this structure must be allocated by the driver
604489a54e48SJohannes Berg  * that uses the ieee80211_ptr field in struct net_device (this
604589a54e48SJohannes Berg  * is intentional so it can be allocated along with the netdev.)
604689a54e48SJohannes Berg  * It need not be registered then as netdev registration will
6047a05829a7SJohannes Berg  * be intercepted by cfg80211 to see the new wireless device,
6048a05829a7SJohannes Berg  * however, drivers must lock the wiphy before registering or
6049a05829a7SJohannes Berg  * unregistering netdevs if they pre-create any netdevs (in ops
6050a05829a7SJohannes Berg  * called from cfg80211, the wiphy is already locked.)
605189a54e48SJohannes Berg  *
605289a54e48SJohannes Berg  * For non-netdev uses, it must also be allocated by the driver
605389a54e48SJohannes Berg  * in response to the cfg80211 callbacks that require it, as
605489a54e48SJohannes Berg  * there's no netdev registration in that case it may not be
605589a54e48SJohannes Berg  * allocated outside of callback operations that return it.
6056d3236553SJohannes Berg  *
6057d3236553SJohannes Berg  * @wiphy: pointer to hardware description
6058d3236553SJohannes Berg  * @iftype: interface type
60592fe8ef10SJohannes Berg  * @registered: is this wdev already registered with cfg80211
606040c575d1SJohannes Berg  * @registering: indicates we're doing registration under wiphy lock
606140c575d1SJohannes Berg  *	for the notifier
6062d3236553SJohannes Berg  * @list: (private) Used to collect the interfaces
606389a54e48SJohannes Berg  * @netdev: (private) Used to reference back to the netdev, may be %NULL
606489a54e48SJohannes Berg  * @identifier: (private) Identifier used in nl80211 to identify this
606589a54e48SJohannes Berg  *	wireless device if it has no netdev
60662d8b08feSMauro Carvalho Chehab  * @u: union containing data specific to @iftype
60677b0a0e3cSJohannes Berg  * @connected: indicates if connected or not (STA mode)
6068d3236553SJohannes Berg  * @wext: (private) Used by the internal wireless extensions compat code
60699874b71fSJohannes Berg  * @wext.ibss: (private) IBSS data part of wext handling
60709874b71fSJohannes Berg  * @wext.connect: (private) connection handling data
60719874b71fSJohannes Berg  * @wext.keys: (private) (WEP) key data
60729874b71fSJohannes Berg  * @wext.ie: (private) extra elements for association
60739874b71fSJohannes Berg  * @wext.ie_len: (private) length of extra elements
60749874b71fSJohannes Berg  * @wext.bssid: (private) selected network BSSID
60759874b71fSJohannes Berg  * @wext.ssid: (private) selected network SSID
60769874b71fSJohannes Berg  * @wext.default_key: (private) selected default key index
60779874b71fSJohannes Berg  * @wext.default_mgmt_key: (private) selected default management key index
60789874b71fSJohannes Berg  * @wext.prev_bssid: (private) previous BSSID for reassociation
60799874b71fSJohannes Berg  * @wext.prev_bssid_valid: (private) previous BSSID validity
60809bc383deSJohannes Berg  * @use_4addr: indicates 4addr mode is used on this interface, must be
60819bc383deSJohannes Berg  *	set by driver (if supported) on add_interface BEFORE registering the
60829bc383deSJohannes Berg  *	netdev and may otherwise be used by driver read-only, will be update
60839bc383deSJohannes Berg  *	by cfg80211 on change_interface
60842e161f78SJohannes Berg  * @mgmt_registrations: list of registrations for management frames
608579ea1e12SJohannes Berg  * @mgmt_registrations_need_update: mgmt registrations were updated,
608679ea1e12SJohannes Berg  *	need to propagate the update to the driver
608798104fdeSJohannes Berg  * @address: The address for this device, valid only if @netdev is %NULL
608873c7da3dSArend Van Spriel  * @is_running: true if this is a non-netdev device that has been started, e.g.
608973c7da3dSArend Van Spriel  *	the P2P Device.
609004f39047SSimon Wunderlich  * @cac_started: true if DFS channel availability check has been started
609104f39047SSimon Wunderlich  * @cac_start_time: timestamp (jiffies) when the dfs state was entered.
609231559f35SJanusz Dziedzic  * @cac_time_ms: CAC time in ms
6093780b40dfSJohannes Berg  * @ps: powersave mode is enabled
6094780b40dfSJohannes Berg  * @ps_timeout: dynamic powersave timeout
6095780b40dfSJohannes Berg  * @ap_unexpected_nlportid: (private) netlink port ID of application
6096780b40dfSJohannes Berg  *	registered for unexpected class 3 frames (AP mode)
6097780b40dfSJohannes Berg  * @conn: (private) cfg80211 software SME connection state machine data
6098780b40dfSJohannes Berg  * @connect_keys: (private) keys to set after connection is established
609934d50519SLior David  * @conn_bss_type: connecting/connected BSS type
6100bd2522b1SAndrzej Zaborowski  * @conn_owner_nlportid: (private) connection owner socket port ID
6101bd2522b1SAndrzej Zaborowski  * @disconnect_wk: (private) auto-disconnect work
6102bd2522b1SAndrzej Zaborowski  * @disconnect_bssid: (private) the BSSID to use for auto-disconnect
6103780b40dfSJohannes Berg  * @event_list: (private) list for internal event processing
6104780b40dfSJohannes Berg  * @event_lock: (private) lock for event list
610578f22b6aSJohannes Berg  * @owner_nlportid: (private) owner socket port ID
6106ab81007aSJohannes Berg  * @nl_owner_dead: (private) owner socket went away
6107d1383077SJohannes Berg  * @cqm_rssi_work: (private) CQM RSSI reporting work
61084a4b8169SAndrew Zaborowski  * @cqm_config: (private) nl80211 RSSI monitor state
61099bb7e0f2SJohannes Berg  * @pmsr_list: (private) peer measurement requests
61109bb7e0f2SJohannes Berg  * @pmsr_lock: (private) peer measurements requests/results lock
61119bb7e0f2SJohannes Berg  * @pmsr_free_wk: (private) peer measurements cleanup work
61124d797fceSJouni Malinen  * @unprot_beacon_reported: (private) timestamp of last
61134d797fceSJouni Malinen  *	unprotected beacon report
61142d8b08feSMauro Carvalho Chehab  * @links: array of %IEEE80211_MLD_MAX_NUM_LINKS elements containing @addr
61152d8b08feSMauro Carvalho Chehab  *	@ap and @client for each link
61162d8b08feSMauro Carvalho Chehab  * @valid_links: bitmap describing what elements of @links are valid
6117d3236553SJohannes Berg  */
6118d3236553SJohannes Berg struct wireless_dev {
6119d3236553SJohannes Berg 	struct wiphy *wiphy;
6120d3236553SJohannes Berg 	enum nl80211_iftype iftype;
6121d3236553SJohannes Berg 
6122667503ddSJohannes Berg 	/* the remainder of this struct should be private to cfg80211 */
6123d3236553SJohannes Berg 	struct list_head list;
6124d3236553SJohannes Berg 	struct net_device *netdev;
6125d3236553SJohannes Berg 
612689a54e48SJohannes Berg 	u32 identifier;
612789a54e48SJohannes Berg 
61282e161f78SJohannes Berg 	struct list_head mgmt_registrations;
612979ea1e12SJohannes Berg 	u8 mgmt_registrations_need_update:1;
6130026331c4SJouni Malinen 
613140c575d1SJohannes Berg 	bool use_4addr, is_running, registered, registering;
613298104fdeSJohannes Berg 
613398104fdeSJohannes Berg 	u8 address[ETH_ALEN] __aligned(sizeof(u16));
61349bc383deSJohannes Berg 
6135b23aa676SSamuel Ortiz 	/* currently used for IBSS and SME - might be rearranged later */
61366829c878SJohannes Berg 	struct cfg80211_conn *conn;
6137fffd0934SJohannes Berg 	struct cfg80211_cached_keys *connect_keys;
613834d50519SLior David 	enum ieee80211_bss_type conn_bss_type;
6139bd2522b1SAndrzej Zaborowski 	u32 conn_owner_nlportid;
6140bd2522b1SAndrzej Zaborowski 
6141bd2522b1SAndrzej Zaborowski 	struct work_struct disconnect_wk;
6142bd2522b1SAndrzej Zaborowski 	u8 disconnect_bssid[ETH_ALEN];
6143d3236553SJohannes Berg 
6144667503ddSJohannes Berg 	struct list_head event_list;
6145667503ddSJohannes Berg 	spinlock_t event_lock;
6146667503ddSJohannes Berg 
61477b0a0e3cSJohannes Berg 	u8 connected:1;
6148f4489ebeSMichal Kazior 
6149ffb9eb3dSKalle Valo 	bool ps;
6150ffb9eb3dSKalle Valo 	int ps_timeout;
6151ffb9eb3dSKalle Valo 
615215e47304SEric W. Biederman 	u32 ap_unexpected_nlportid;
615328946da7SJohannes Berg 
6154ab81007aSJohannes Berg 	u32 owner_nlportid;
6155ab81007aSJohannes Berg 	bool nl_owner_dead;
6156ab81007aSJohannes Berg 
61577b0a0e3cSJohannes Berg 	/* FIXME: need to rework radar detection for MLO */
615804f39047SSimon Wunderlich 	bool cac_started;
615904f39047SSimon Wunderlich 	unsigned long cac_start_time;
616031559f35SJanusz Dziedzic 	unsigned int cac_time_ms;
616104f39047SSimon Wunderlich 
61623d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT
6163d3236553SJohannes Berg 	/* wext data */
6164cbe8fa9cSJohannes Berg 	struct {
6165cbe8fa9cSJohannes Berg 		struct cfg80211_ibss_params ibss;
6166f2129354SJohannes Berg 		struct cfg80211_connect_params connect;
6167fffd0934SJohannes Berg 		struct cfg80211_cached_keys *keys;
6168c1e5f471SJohannes Berg 		const u8 *ie;
6169f2129354SJohannes Berg 		size_t ie_len;
61709874b71fSJohannes Berg 		u8 bssid[ETH_ALEN];
61719874b71fSJohannes Berg 		u8 prev_bssid[ETH_ALEN];
6172f2129354SJohannes Berg 		u8 ssid[IEEE80211_MAX_SSID_LEN];
617308645126SJohannes Berg 		s8 default_key, default_mgmt_key;
6174ffb9eb3dSKalle Valo 		bool prev_bssid_valid;
6175cbe8fa9cSJohannes Berg 	} wext;
6176d3236553SJohannes Berg #endif
61774a4b8169SAndrew Zaborowski 
617837c20b2eSJohannes Berg 	struct wiphy_work cqm_rssi_work;
617937c20b2eSJohannes Berg 	struct cfg80211_cqm_config __rcu *cqm_config;
61809bb7e0f2SJohannes Berg 
61819bb7e0f2SJohannes Berg 	struct list_head pmsr_list;
61829bb7e0f2SJohannes Berg 	spinlock_t pmsr_lock;
61839bb7e0f2SJohannes Berg 	struct work_struct pmsr_free_wk;
61844d797fceSJouni Malinen 
61854d797fceSJouni Malinen 	unsigned long unprot_beacon_reported;
61867b0a0e3cSJohannes Berg 
61877b0a0e3cSJohannes Berg 	union {
61887b0a0e3cSJohannes Berg 		struct {
61897b0a0e3cSJohannes Berg 			u8 connected_addr[ETH_ALEN] __aligned(2);
61907b0a0e3cSJohannes Berg 			u8 ssid[IEEE80211_MAX_SSID_LEN];
61917b0a0e3cSJohannes Berg 			u8 ssid_len;
61927b0a0e3cSJohannes Berg 		} client;
61937b0a0e3cSJohannes Berg 		struct {
61947b0a0e3cSJohannes Berg 			int beacon_interval;
61957b0a0e3cSJohannes Berg 			struct cfg80211_chan_def preset_chandef;
61967b0a0e3cSJohannes Berg 			struct cfg80211_chan_def chandef;
61977b0a0e3cSJohannes Berg 			u8 id[IEEE80211_MAX_SSID_LEN];
61987b0a0e3cSJohannes Berg 			u8 id_len, id_up_len;
61997b0a0e3cSJohannes Berg 		} mesh;
62007b0a0e3cSJohannes Berg 		struct {
62017b0a0e3cSJohannes Berg 			struct cfg80211_chan_def preset_chandef;
62027b0a0e3cSJohannes Berg 			u8 ssid[IEEE80211_MAX_SSID_LEN];
62037b0a0e3cSJohannes Berg 			u8 ssid_len;
62047b0a0e3cSJohannes Berg 		} ap;
62057b0a0e3cSJohannes Berg 		struct {
62067b0a0e3cSJohannes Berg 			struct cfg80211_internal_bss *current_bss;
62077b0a0e3cSJohannes Berg 			struct cfg80211_chan_def chandef;
62087b0a0e3cSJohannes Berg 			int beacon_interval;
62097b0a0e3cSJohannes Berg 			u8 ssid[IEEE80211_MAX_SSID_LEN];
62107b0a0e3cSJohannes Berg 			u8 ssid_len;
62117b0a0e3cSJohannes Berg 		} ibss;
62127b0a0e3cSJohannes Berg 		struct {
62137b0a0e3cSJohannes Berg 			struct cfg80211_chan_def chandef;
62147b0a0e3cSJohannes Berg 		} ocb;
62157b0a0e3cSJohannes Berg 	} u;
62167b0a0e3cSJohannes Berg 
62177b0a0e3cSJohannes Berg 	struct {
62187b0a0e3cSJohannes Berg 		u8 addr[ETH_ALEN] __aligned(2);
62197b0a0e3cSJohannes Berg 		union {
62207b0a0e3cSJohannes Berg 			struct {
62217b0a0e3cSJohannes Berg 				unsigned int beacon_interval;
62227b0a0e3cSJohannes Berg 				struct cfg80211_chan_def chandef;
62237b0a0e3cSJohannes Berg 			} ap;
62247b0a0e3cSJohannes Berg 			struct {
62257b0a0e3cSJohannes Berg 				struct cfg80211_internal_bss *current_bss;
62267b0a0e3cSJohannes Berg 			} client;
62277b0a0e3cSJohannes Berg 		};
62287b0a0e3cSJohannes Berg 	} links[IEEE80211_MLD_MAX_NUM_LINKS];
62297b0a0e3cSJohannes Berg 	u16 valid_links;
6230d3236553SJohannes Berg };
6231d3236553SJohannes Berg 
623210de5a59SJakub Kicinski static inline const u8 *wdev_address(struct wireless_dev *wdev)
623398104fdeSJohannes Berg {
623498104fdeSJohannes Berg 	if (wdev->netdev)
623598104fdeSJohannes Berg 		return wdev->netdev->dev_addr;
623698104fdeSJohannes Berg 	return wdev->address;
623798104fdeSJohannes Berg }
623898104fdeSJohannes Berg 
623973c7da3dSArend Van Spriel static inline bool wdev_running(struct wireless_dev *wdev)
624073c7da3dSArend Van Spriel {
624173c7da3dSArend Van Spriel 	if (wdev->netdev)
624273c7da3dSArend Van Spriel 		return netif_running(wdev->netdev);
624373c7da3dSArend Van Spriel 	return wdev->is_running;
624473c7da3dSArend Van Spriel }
624573c7da3dSArend Van Spriel 
6246d3236553SJohannes Berg /**
6247d3236553SJohannes Berg  * wdev_priv - return wiphy priv from wireless_dev
6248d3236553SJohannes Berg  *
6249d3236553SJohannes Berg  * @wdev: The wireless device whose wiphy's priv pointer to return
62500ae997dcSYacine Belkadi  * Return: The wiphy priv of @wdev.
6251d3236553SJohannes Berg  */
6252d3236553SJohannes Berg static inline void *wdev_priv(struct wireless_dev *wdev)
6253d3236553SJohannes Berg {
6254d3236553SJohannes Berg 	BUG_ON(!wdev);
6255d3236553SJohannes Berg 	return wiphy_priv(wdev->wiphy);
6256d3236553SJohannes Berg }
6257d3236553SJohannes Berg 
6258d70e9693SJohannes Berg /**
62597b0a0e3cSJohannes Berg  * wdev_chandef - return chandef pointer from wireless_dev
62607b0a0e3cSJohannes Berg  * @wdev: the wdev
62617b0a0e3cSJohannes Berg  * @link_id: the link ID for MLO
62627b0a0e3cSJohannes Berg  *
62637b0a0e3cSJohannes Berg  * Return: The chandef depending on the mode, or %NULL.
62647b0a0e3cSJohannes Berg  */
62657b0a0e3cSJohannes Berg struct cfg80211_chan_def *wdev_chandef(struct wireless_dev *wdev,
62667b0a0e3cSJohannes Berg 				       unsigned int link_id);
62677b0a0e3cSJohannes Berg 
62687b0a0e3cSJohannes Berg static inline void WARN_INVALID_LINK_ID(struct wireless_dev *wdev,
62697b0a0e3cSJohannes Berg 					unsigned int link_id)
62707b0a0e3cSJohannes Berg {
62717b0a0e3cSJohannes Berg 	WARN_ON(link_id && !wdev->valid_links);
62727b0a0e3cSJohannes Berg 	WARN_ON(wdev->valid_links &&
62737b0a0e3cSJohannes Berg 		!(wdev->valid_links & BIT(link_id)));
62747b0a0e3cSJohannes Berg }
62757b0a0e3cSJohannes Berg 
6276efbabc11SVeerendranath Jakkam #define for_each_valid_link(link_info, link_id)			\
62777b0a0e3cSJohannes Berg 	for (link_id = 0;					\
6278efbabc11SVeerendranath Jakkam 	     link_id < ((link_info)->valid_links ?		\
6279efbabc11SVeerendranath Jakkam 			ARRAY_SIZE((link_info)->links) : 1);	\
62807b0a0e3cSJohannes Berg 	     link_id++)						\
6281efbabc11SVeerendranath Jakkam 		if (!(link_info)->valid_links ||		\
6282efbabc11SVeerendranath Jakkam 		    ((link_info)->valid_links & BIT(link_id)))
62837b0a0e3cSJohannes Berg 
62847b0a0e3cSJohannes Berg /**
6285d70e9693SJohannes Berg  * DOC: Utility functions
6286d70e9693SJohannes Berg  *
6287d70e9693SJohannes Berg  * cfg80211 offers a number of utility functions that can be useful.
6288d3236553SJohannes Berg  */
6289d3236553SJohannes Berg 
6290d3236553SJohannes Berg /**
6291934f4c7dSThomas Pedersen  * ieee80211_channel_equal - compare two struct ieee80211_channel
6292934f4c7dSThomas Pedersen  *
6293934f4c7dSThomas Pedersen  * @a: 1st struct ieee80211_channel
6294934f4c7dSThomas Pedersen  * @b: 2nd struct ieee80211_channel
6295934f4c7dSThomas Pedersen  * Return: true if center frequency of @a == @b
6296934f4c7dSThomas Pedersen  */
6297934f4c7dSThomas Pedersen static inline bool
6298934f4c7dSThomas Pedersen ieee80211_channel_equal(struct ieee80211_channel *a,
6299934f4c7dSThomas Pedersen 			struct ieee80211_channel *b)
6300934f4c7dSThomas Pedersen {
6301934f4c7dSThomas Pedersen 	return (a->center_freq == b->center_freq &&
6302934f4c7dSThomas Pedersen 		a->freq_offset == b->freq_offset);
6303934f4c7dSThomas Pedersen }
6304934f4c7dSThomas Pedersen 
6305934f4c7dSThomas Pedersen /**
6306934f4c7dSThomas Pedersen  * ieee80211_channel_to_khz - convert ieee80211_channel to frequency in KHz
6307934f4c7dSThomas Pedersen  * @chan: struct ieee80211_channel to convert
6308934f4c7dSThomas Pedersen  * Return: The corresponding frequency (in KHz)
6309934f4c7dSThomas Pedersen  */
6310934f4c7dSThomas Pedersen static inline u32
6311934f4c7dSThomas Pedersen ieee80211_channel_to_khz(const struct ieee80211_channel *chan)
6312934f4c7dSThomas Pedersen {
6313934f4c7dSThomas Pedersen 	return MHZ_TO_KHZ(chan->center_freq) + chan->freq_offset;
6314934f4c7dSThomas Pedersen }
6315934f4c7dSThomas Pedersen 
6316934f4c7dSThomas Pedersen /**
631711b34737SThomas Pedersen  * ieee80211_s1g_channel_width - get allowed channel width from @chan
631811b34737SThomas Pedersen  *
631911b34737SThomas Pedersen  * Only allowed for band NL80211_BAND_S1GHZ
632011b34737SThomas Pedersen  * @chan: channel
632111b34737SThomas Pedersen  * Return: The allowed channel width for this center_freq
632211b34737SThomas Pedersen  */
632311b34737SThomas Pedersen enum nl80211_chan_width
632411b34737SThomas Pedersen ieee80211_s1g_channel_width(const struct ieee80211_channel *chan);
632511b34737SThomas Pedersen 
632611b34737SThomas Pedersen /**
6327934f4c7dSThomas Pedersen  * ieee80211_channel_to_freq_khz - convert channel number to frequency
6328934f4c7dSThomas Pedersen  * @chan: channel number
6329934f4c7dSThomas Pedersen  * @band: band, necessary due to channel number overlap
6330934f4c7dSThomas Pedersen  * Return: The corresponding frequency (in KHz), or 0 if the conversion failed.
6331934f4c7dSThomas Pedersen  */
6332934f4c7dSThomas Pedersen u32 ieee80211_channel_to_freq_khz(int chan, enum nl80211_band band);
6333934f4c7dSThomas Pedersen 
6334934f4c7dSThomas Pedersen /**
6335d3236553SJohannes Berg  * ieee80211_channel_to_frequency - convert channel number to frequency
6336abe37c4bSJohannes Berg  * @chan: channel number
633759eb21a6SBruno Randolf  * @band: band, necessary due to channel number overlap
63380ae997dcSYacine Belkadi  * Return: The corresponding frequency (in MHz), or 0 if the conversion failed.
6339d3236553SJohannes Berg  */
6340934f4c7dSThomas Pedersen static inline int
6341934f4c7dSThomas Pedersen ieee80211_channel_to_frequency(int chan, enum nl80211_band band)
6342934f4c7dSThomas Pedersen {
6343934f4c7dSThomas Pedersen 	return KHZ_TO_MHZ(ieee80211_channel_to_freq_khz(chan, band));
6344934f4c7dSThomas Pedersen }
6345934f4c7dSThomas Pedersen 
6346934f4c7dSThomas Pedersen /**
6347934f4c7dSThomas Pedersen  * ieee80211_freq_khz_to_channel - convert frequency to channel number
6348934f4c7dSThomas Pedersen  * @freq: center frequency in KHz
6349934f4c7dSThomas Pedersen  * Return: The corresponding channel, or 0 if the conversion failed.
6350934f4c7dSThomas Pedersen  */
6351934f4c7dSThomas Pedersen int ieee80211_freq_khz_to_channel(u32 freq);
6352d3236553SJohannes Berg 
6353d3236553SJohannes Berg /**
6354d3236553SJohannes Berg  * ieee80211_frequency_to_channel - convert frequency to channel number
6355934f4c7dSThomas Pedersen  * @freq: center frequency in MHz
63560ae997dcSYacine Belkadi  * Return: The corresponding channel, or 0 if the conversion failed.
6357d3236553SJohannes Berg  */
6358934f4c7dSThomas Pedersen static inline int
6359934f4c7dSThomas Pedersen ieee80211_frequency_to_channel(int freq)
6360934f4c7dSThomas Pedersen {
6361934f4c7dSThomas Pedersen 	return ieee80211_freq_khz_to_channel(MHZ_TO_KHZ(freq));
6362934f4c7dSThomas Pedersen }
6363934f4c7dSThomas Pedersen 
6364934f4c7dSThomas Pedersen /**
6365934f4c7dSThomas Pedersen  * ieee80211_get_channel_khz - get channel struct from wiphy for specified
6366934f4c7dSThomas Pedersen  * frequency
6367934f4c7dSThomas Pedersen  * @wiphy: the struct wiphy to get the channel for
6368934f4c7dSThomas Pedersen  * @freq: the center frequency (in KHz) of the channel
6369934f4c7dSThomas Pedersen  * Return: The channel struct from @wiphy at @freq.
6370934f4c7dSThomas Pedersen  */
6371934f4c7dSThomas Pedersen struct ieee80211_channel *
6372934f4c7dSThomas Pedersen ieee80211_get_channel_khz(struct wiphy *wiphy, u32 freq);
6373d3236553SJohannes Berg 
6374d3236553SJohannes Berg /**
6375d3236553SJohannes Berg  * ieee80211_get_channel - get channel struct from wiphy for specified frequency
6376543b921bSArend Van Spriel  *
6377abe37c4bSJohannes Berg  * @wiphy: the struct wiphy to get the channel for
6378934f4c7dSThomas Pedersen  * @freq: the center frequency (in MHz) of the channel
63790ae997dcSYacine Belkadi  * Return: The channel struct from @wiphy at @freq.
6380d3236553SJohannes Berg  */
6381934f4c7dSThomas Pedersen static inline struct ieee80211_channel *
6382934f4c7dSThomas Pedersen ieee80211_get_channel(struct wiphy *wiphy, int freq)
6383934f4c7dSThomas Pedersen {
6384934f4c7dSThomas Pedersen 	return ieee80211_get_channel_khz(wiphy, MHZ_TO_KHZ(freq));
6385934f4c7dSThomas Pedersen }
6386d3236553SJohannes Berg 
6387d3236553SJohannes Berg /**
6388afbc9c9eSJohannes Berg  * cfg80211_channel_is_psc - Check if the channel is a 6 GHz PSC
6389afbc9c9eSJohannes Berg  * @chan: control channel to check
6390afbc9c9eSJohannes Berg  *
6391afbc9c9eSJohannes Berg  * The Preferred Scanning Channels (PSC) are defined in
6392afbc9c9eSJohannes Berg  * Draft IEEE P802.11ax/D5.0, 26.17.2.3.3
6393afbc9c9eSJohannes Berg  */
6394afbc9c9eSJohannes Berg static inline bool cfg80211_channel_is_psc(struct ieee80211_channel *chan)
6395afbc9c9eSJohannes Berg {
6396afbc9c9eSJohannes Berg 	if (chan->band != NL80211_BAND_6GHZ)
6397afbc9c9eSJohannes Berg 		return false;
6398afbc9c9eSJohannes Berg 
6399afbc9c9eSJohannes Berg 	return ieee80211_frequency_to_channel(chan->center_freq) % 16 == 5;
6400afbc9c9eSJohannes Berg }
6401afbc9c9eSJohannes Berg 
6402afbc9c9eSJohannes Berg /**
6403d3236553SJohannes Berg  * ieee80211_get_response_rate - get basic rate for a given rate
6404d3236553SJohannes Berg  *
6405d3236553SJohannes Berg  * @sband: the band to look for rates in
6406d3236553SJohannes Berg  * @basic_rates: bitmap of basic rates
6407d3236553SJohannes Berg  * @bitrate: the bitrate for which to find the basic rate
6408d3236553SJohannes Berg  *
64090ae997dcSYacine Belkadi  * Return: The basic rate corresponding to a given bitrate, that
64100ae997dcSYacine Belkadi  * is the next lower bitrate contained in the basic rate map,
64110ae997dcSYacine Belkadi  * which is, for this function, given as a bitmap of indices of
64120ae997dcSYacine Belkadi  * rates in the band's bitrate table.
6413d3236553SJohannes Berg  */
6414623b988fSJoe Perches const struct ieee80211_rate *
6415d3236553SJohannes Berg ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
6416d3236553SJohannes Berg 			    u32 basic_rates, int bitrate);
6417d3236553SJohannes Berg 
6418b422c6cdSAshok Nagarajan /**
6419b422c6cdSAshok Nagarajan  * ieee80211_mandatory_rates - get mandatory rates for a given band
6420b422c6cdSAshok Nagarajan  * @sband: the band to look for rates in
6421b422c6cdSAshok Nagarajan  *
6422b422c6cdSAshok Nagarajan  * This function returns a bitmap of the mandatory rates for the given
6423b422c6cdSAshok Nagarajan  * band, bits are set according to the rate position in the bitrates array.
6424b422c6cdSAshok Nagarajan  */
64255add321cSJohannes Berg u32 ieee80211_mandatory_rates(struct ieee80211_supported_band *sband);
6426b422c6cdSAshok Nagarajan 
6427d3236553SJohannes Berg /*
6428d3236553SJohannes Berg  * Radiotap parsing functions -- for controlled injection support
6429d3236553SJohannes Berg  *
6430d3236553SJohannes Berg  * Implemented in net/wireless/radiotap.c
643166d495d0SMauro Carvalho Chehab  * Documentation in Documentation/networking/radiotap-headers.rst
6432d3236553SJohannes Berg  */
6433d3236553SJohannes Berg 
643433e5a2f7SJohannes Berg struct radiotap_align_size {
643533e5a2f7SJohannes Berg 	uint8_t align:4, size:4;
643633e5a2f7SJohannes Berg };
643733e5a2f7SJohannes Berg 
643833e5a2f7SJohannes Berg struct ieee80211_radiotap_namespace {
643933e5a2f7SJohannes Berg 	const struct radiotap_align_size *align_size;
644033e5a2f7SJohannes Berg 	int n_bits;
644133e5a2f7SJohannes Berg 	uint32_t oui;
644233e5a2f7SJohannes Berg 	uint8_t subns;
644333e5a2f7SJohannes Berg };
644433e5a2f7SJohannes Berg 
644533e5a2f7SJohannes Berg struct ieee80211_radiotap_vendor_namespaces {
644633e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_namespace *ns;
644733e5a2f7SJohannes Berg 	int n_ns;
644833e5a2f7SJohannes Berg };
644933e5a2f7SJohannes Berg 
6450d3236553SJohannes Berg /**
6451d3236553SJohannes Berg  * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args
645233e5a2f7SJohannes Berg  * @this_arg_index: index of current arg, valid after each successful call
645333e5a2f7SJohannes Berg  *	to ieee80211_radiotap_iterator_next()
645433e5a2f7SJohannes Berg  * @this_arg: pointer to current radiotap arg; it is valid after each
645533e5a2f7SJohannes Berg  *	call to ieee80211_radiotap_iterator_next() but also after
645633e5a2f7SJohannes Berg  *	ieee80211_radiotap_iterator_init() where it will point to
645733e5a2f7SJohannes Berg  *	the beginning of the actual data portion
645833e5a2f7SJohannes Berg  * @this_arg_size: length of the current arg, for convenience
645933e5a2f7SJohannes Berg  * @current_namespace: pointer to the current namespace definition
646033e5a2f7SJohannes Berg  *	(or internally %NULL if the current namespace is unknown)
646133e5a2f7SJohannes Berg  * @is_radiotap_ns: indicates whether the current namespace is the default
646233e5a2f7SJohannes Berg  *	radiotap namespace or not
646333e5a2f7SJohannes Berg  *
646433e5a2f7SJohannes Berg  * @_rtheader: pointer to the radiotap header we are walking through
646533e5a2f7SJohannes Berg  * @_max_length: length of radiotap header in cpu byte ordering
646633e5a2f7SJohannes Berg  * @_arg_index: next argument index
646733e5a2f7SJohannes Berg  * @_arg: next argument pointer
646833e5a2f7SJohannes Berg  * @_next_bitmap: internal pointer to next present u32
646933e5a2f7SJohannes Berg  * @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present
647033e5a2f7SJohannes Berg  * @_vns: vendor namespace definitions
647133e5a2f7SJohannes Berg  * @_next_ns_data: beginning of the next namespace's data
647233e5a2f7SJohannes Berg  * @_reset_on_ext: internal; reset the arg index to 0 when going to the
647333e5a2f7SJohannes Berg  *	next bitmap word
647433e5a2f7SJohannes Berg  *
647533e5a2f7SJohannes Berg  * Describes the radiotap parser state. Fields prefixed with an underscore
647633e5a2f7SJohannes Berg  * must not be used by users of the parser, only by the parser internally.
6477d3236553SJohannes Berg  */
6478d3236553SJohannes Berg 
6479d3236553SJohannes Berg struct ieee80211_radiotap_iterator {
648033e5a2f7SJohannes Berg 	struct ieee80211_radiotap_header *_rtheader;
648133e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_vendor_namespaces *_vns;
648233e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_namespace *current_namespace;
6483d3236553SJohannes Berg 
648433e5a2f7SJohannes Berg 	unsigned char *_arg, *_next_ns_data;
648567272440SJohannes Berg 	__le32 *_next_bitmap;
648633e5a2f7SJohannes Berg 
648733e5a2f7SJohannes Berg 	unsigned char *this_arg;
648833e5a2f7SJohannes Berg 	int this_arg_index;
648933e5a2f7SJohannes Berg 	int this_arg_size;
649033e5a2f7SJohannes Berg 
649133e5a2f7SJohannes Berg 	int is_radiotap_ns;
649233e5a2f7SJohannes Berg 
649333e5a2f7SJohannes Berg 	int _max_length;
649433e5a2f7SJohannes Berg 	int _arg_index;
649533e5a2f7SJohannes Berg 	uint32_t _bitmap_shifter;
649633e5a2f7SJohannes Berg 	int _reset_on_ext;
6497d3236553SJohannes Berg };
6498d3236553SJohannes Berg 
649910dd9b7cSJoe Perches int
650010dd9b7cSJoe Perches ieee80211_radiotap_iterator_init(struct ieee80211_radiotap_iterator *iterator,
6501d3236553SJohannes Berg 				 struct ieee80211_radiotap_header *radiotap_header,
650210dd9b7cSJoe Perches 				 int max_length,
650310dd9b7cSJoe Perches 				 const struct ieee80211_radiotap_vendor_namespaces *vns);
6504d3236553SJohannes Berg 
650510dd9b7cSJoe Perches int
650610dd9b7cSJoe Perches ieee80211_radiotap_iterator_next(struct ieee80211_radiotap_iterator *iterator);
6507d3236553SJohannes Berg 
650833e5a2f7SJohannes Berg 
6509e31a16d6SZhu Yi extern const unsigned char rfc1042_header[6];
6510e31a16d6SZhu Yi extern const unsigned char bridge_tunnel_header[6];
6511e31a16d6SZhu Yi 
6512e31a16d6SZhu Yi /**
6513e31a16d6SZhu Yi  * ieee80211_get_hdrlen_from_skb - get header length from data
6514e31a16d6SZhu Yi  *
6515e31a16d6SZhu Yi  * @skb: the frame
65160ae997dcSYacine Belkadi  *
65170ae997dcSYacine Belkadi  * Given an skb with a raw 802.11 header at the data pointer this function
65180ae997dcSYacine Belkadi  * returns the 802.11 header length.
65190ae997dcSYacine Belkadi  *
65200ae997dcSYacine Belkadi  * Return: The 802.11 header length in bytes (not including encryption
65210ae997dcSYacine Belkadi  * headers). Or 0 if the data in the sk_buff is too short to contain a valid
65220ae997dcSYacine Belkadi  * 802.11 header.
6523e31a16d6SZhu Yi  */
6524e31a16d6SZhu Yi unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb);
6525e31a16d6SZhu Yi 
6526e31a16d6SZhu Yi /**
6527e31a16d6SZhu Yi  * ieee80211_hdrlen - get header length in bytes from frame control
6528e31a16d6SZhu Yi  * @fc: frame control field in little-endian format
65290ae997dcSYacine Belkadi  * Return: The header length in bytes.
6530e31a16d6SZhu Yi  */
6531633adf1aSJohannes Berg unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc);
6532e31a16d6SZhu Yi 
6533e31a16d6SZhu Yi /**
65349b395bc3SJohannes Berg  * ieee80211_get_mesh_hdrlen - get mesh extension header length
65359b395bc3SJohannes Berg  * @meshhdr: the mesh extension header, only the flags field
65369b395bc3SJohannes Berg  *	(first byte) will be accessed
65370ae997dcSYacine Belkadi  * Return: The length of the extension header, which is always at
65389b395bc3SJohannes Berg  * least 6 bytes and at most 18 if address 5 and 6 are present.
65399b395bc3SJohannes Berg  */
65409b395bc3SJohannes Berg unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr);
65419b395bc3SJohannes Berg 
65429b395bc3SJohannes Berg /**
6543d70e9693SJohannes Berg  * DOC: Data path helpers
6544d70e9693SJohannes Berg  *
6545d70e9693SJohannes Berg  * In addition to generic utilities, cfg80211 also offers
6546d70e9693SJohannes Berg  * functions that help implement the data path for devices
6547d70e9693SJohannes Berg  * that do not do the 802.11/802.3 conversion on the device.
6548d70e9693SJohannes Berg  */
6549d70e9693SJohannes Berg 
6550d70e9693SJohannes Berg /**
65517f6990c8SJohannes Berg  * ieee80211_data_to_8023_exthdr - convert an 802.11 data frame to 802.3
65527f6990c8SJohannes Berg  * @skb: the 802.11 data frame
65537f6990c8SJohannes Berg  * @ehdr: pointer to a &struct ethhdr that will get the header, instead
65547f6990c8SJohannes Berg  *	of it being pushed into the SKB
65557f6990c8SJohannes Berg  * @addr: the device MAC address
65567f6990c8SJohannes Berg  * @iftype: the virtual interface type
655724bba078SFelix Fietkau  * @data_offset: offset of payload after the 802.11 header
65582d8b08feSMauro Carvalho Chehab  * @is_amsdu: true if the 802.11 header is A-MSDU
65597f6990c8SJohannes Berg  * Return: 0 on success. Non-zero on error.
65607f6990c8SJohannes Berg  */
65617f6990c8SJohannes Berg int ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr,
656224bba078SFelix Fietkau 				  const u8 *addr, enum nl80211_iftype iftype,
6563a1d5ff56SMathy Vanhoef 				  u8 data_offset, bool is_amsdu);
65647f6990c8SJohannes Berg 
65657f6990c8SJohannes Berg /**
6566e31a16d6SZhu Yi  * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3
6567e31a16d6SZhu Yi  * @skb: the 802.11 data frame
6568e31a16d6SZhu Yi  * @addr: the device MAC address
6569e31a16d6SZhu Yi  * @iftype: the virtual interface type
65700ae997dcSYacine Belkadi  * Return: 0 on success. Non-zero on error.
6571e31a16d6SZhu Yi  */
65727f6990c8SJohannes Berg static inline int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
65737f6990c8SJohannes Berg 					 enum nl80211_iftype iftype)
65747f6990c8SJohannes Berg {
6575a1d5ff56SMathy Vanhoef 	return ieee80211_data_to_8023_exthdr(skb, NULL, addr, iftype, 0, false);
65767f6990c8SJohannes Berg }
6577e31a16d6SZhu Yi 
6578e31a16d6SZhu Yi /**
65796e4c0d04SFelix Fietkau  * ieee80211_is_valid_amsdu - check if subframe lengths of an A-MSDU are valid
65806e4c0d04SFelix Fietkau  *
65816e4c0d04SFelix Fietkau  * This is used to detect non-standard A-MSDU frames, e.g. the ones generated
65826e4c0d04SFelix Fietkau  * by ath10k and ath11k, where the subframe length includes the length of the
65836e4c0d04SFelix Fietkau  * mesh control field.
65846e4c0d04SFelix Fietkau  *
65856e4c0d04SFelix Fietkau  * @skb: The input A-MSDU frame without any headers.
6586fe4a6d2dSFelix Fietkau  * @mesh_hdr: the type of mesh header to test
6587fe4a6d2dSFelix Fietkau  *	0: non-mesh A-MSDU length field
6588fe4a6d2dSFelix Fietkau  *	1: big-endian mesh A-MSDU length field
6589fe4a6d2dSFelix Fietkau  *	2: little-endian mesh A-MSDU length field
65906e4c0d04SFelix Fietkau  * Returns: true if subframe header lengths are valid for the @mesh_hdr mode
65916e4c0d04SFelix Fietkau  */
6592fe4a6d2dSFelix Fietkau bool ieee80211_is_valid_amsdu(struct sk_buff *skb, u8 mesh_hdr);
65936e4c0d04SFelix Fietkau 
65946e4c0d04SFelix Fietkau /**
6595eaf85ca7SZhu Yi  * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame
6596eaf85ca7SZhu Yi  *
65977f6990c8SJohannes Berg  * Decode an IEEE 802.11 A-MSDU and convert it to a list of 802.3 frames.
65987f6990c8SJohannes Berg  * The @list will be empty if the decode fails. The @skb must be fully
65997f6990c8SJohannes Berg  * header-less before being passed in here; it is freed in this function.
6600eaf85ca7SZhu Yi  *
66017f6990c8SJohannes Berg  * @skb: The input A-MSDU frame without any headers.
6602eaf85ca7SZhu Yi  * @list: The output list of 802.3 frames. It must be allocated and
6603085a6c10SRandy Dunlap  *	initialized by the caller.
6604eaf85ca7SZhu Yi  * @addr: The device MAC address.
6605eaf85ca7SZhu Yi  * @iftype: The device interface type.
6606eaf85ca7SZhu Yi  * @extra_headroom: The hardware extra headroom for SKBs in the @list.
66078b935ee2SJohannes Berg  * @check_da: DA to check in the inner ethernet header, or NULL
66088b935ee2SJohannes Berg  * @check_sa: SA to check in the inner ethernet header, or NULL
6609fe4a6d2dSFelix Fietkau  * @mesh_control: see mesh_hdr in ieee80211_is_valid_amsdu
6610eaf85ca7SZhu Yi  */
6611eaf85ca7SZhu Yi void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,
6612eaf85ca7SZhu Yi 			      const u8 *addr, enum nl80211_iftype iftype,
66138b3becadSYogesh Ashok Powar 			      const unsigned int extra_headroom,
6614986e43b1SFelix Fietkau 			      const u8 *check_da, const u8 *check_sa,
6615fe4a6d2dSFelix Fietkau 			      u8 mesh_control);
6616986e43b1SFelix Fietkau 
6617986e43b1SFelix Fietkau /**
6618986e43b1SFelix Fietkau  * ieee80211_get_8023_tunnel_proto - get RFC1042 or bridge tunnel encap protocol
6619986e43b1SFelix Fietkau  *
6620986e43b1SFelix Fietkau  * Check for RFC1042 or bridge tunnel header and fetch the encapsulated
6621986e43b1SFelix Fietkau  * protocol.
6622986e43b1SFelix Fietkau  *
6623986e43b1SFelix Fietkau  * @hdr: pointer to the MSDU payload
6624986e43b1SFelix Fietkau  * @proto: destination pointer to store the protocol
6625986e43b1SFelix Fietkau  * Return: true if encapsulation was found
6626986e43b1SFelix Fietkau  */
6627986e43b1SFelix Fietkau bool ieee80211_get_8023_tunnel_proto(const void *hdr, __be16 *proto);
6628986e43b1SFelix Fietkau 
6629986e43b1SFelix Fietkau /**
6630986e43b1SFelix Fietkau  * ieee80211_strip_8023_mesh_hdr - strip mesh header from converted 802.3 frames
6631986e43b1SFelix Fietkau  *
6632986e43b1SFelix Fietkau  * Strip the mesh header, which was left in by ieee80211_data_to_8023 as part
6633986e43b1SFelix Fietkau  * of the MSDU data. Also move any source/destination addresses from the mesh
6634986e43b1SFelix Fietkau  * header to the ethernet header (if present).
6635986e43b1SFelix Fietkau  *
6636986e43b1SFelix Fietkau  * @skb: The 802.3 frame with embedded mesh header
6637986e43b1SFelix Fietkau  */
6638986e43b1SFelix Fietkau int ieee80211_strip_8023_mesh_hdr(struct sk_buff *skb);
6639eaf85ca7SZhu Yi 
6640eaf85ca7SZhu Yi /**
6641e31a16d6SZhu Yi  * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame
6642e31a16d6SZhu Yi  * @skb: the data frame
6643fa9ffc74SKyeyoon Park  * @qos_map: Interworking QoS mapping or %NULL if not in use
66440ae997dcSYacine Belkadi  * Return: The 802.1p/1d tag.
6645e31a16d6SZhu Yi  */
6646fa9ffc74SKyeyoon Park unsigned int cfg80211_classify8021d(struct sk_buff *skb,
6647fa9ffc74SKyeyoon Park 				    struct cfg80211_qos_map *qos_map);
6648e31a16d6SZhu Yi 
6649c21dbf92SJohannes Berg /**
665049a68e0dSJohannes Berg  * cfg80211_find_elem_match - match information element and byte array in data
665149a68e0dSJohannes Berg  *
665249a68e0dSJohannes Berg  * @eid: element ID
665349a68e0dSJohannes Berg  * @ies: data consisting of IEs
665449a68e0dSJohannes Berg  * @len: length of data
665549a68e0dSJohannes Berg  * @match: byte array to match
665649a68e0dSJohannes Berg  * @match_len: number of bytes in the match array
665749a68e0dSJohannes Berg  * @match_offset: offset in the IE data where the byte array should match.
665849a68e0dSJohannes Berg  *	Note the difference to cfg80211_find_ie_match() which considers
665949a68e0dSJohannes Berg  *	the offset to start from the element ID byte, but here we take
666049a68e0dSJohannes Berg  *	the data portion instead.
666149a68e0dSJohannes Berg  *
666249a68e0dSJohannes Berg  * Return: %NULL if the element ID could not be found or if
666349a68e0dSJohannes Berg  * the element is invalid (claims to be longer than the given
666449a68e0dSJohannes Berg  * data) or if the byte array doesn't match; otherwise return the
666549a68e0dSJohannes Berg  * requested element struct.
666649a68e0dSJohannes Berg  *
666749a68e0dSJohannes Berg  * Note: There are no checks on the element length other than
666849a68e0dSJohannes Berg  * having to fit into the given data and being large enough for the
666949a68e0dSJohannes Berg  * byte array to match.
667049a68e0dSJohannes Berg  */
667149a68e0dSJohannes Berg const struct element *
667249a68e0dSJohannes Berg cfg80211_find_elem_match(u8 eid, const u8 *ies, unsigned int len,
667349a68e0dSJohannes Berg 			 const u8 *match, unsigned int match_len,
667449a68e0dSJohannes Berg 			 unsigned int match_offset);
667549a68e0dSJohannes Berg 
667649a68e0dSJohannes Berg /**
6677fbd05e4aSLuca Coelho  * cfg80211_find_ie_match - match information element and byte array in data
6678fbd05e4aSLuca Coelho  *
6679fbd05e4aSLuca Coelho  * @eid: element ID
6680fbd05e4aSLuca Coelho  * @ies: data consisting of IEs
6681fbd05e4aSLuca Coelho  * @len: length of data
6682fbd05e4aSLuca Coelho  * @match: byte array to match
6683fbd05e4aSLuca Coelho  * @match_len: number of bytes in the match array
6684fbd05e4aSLuca Coelho  * @match_offset: offset in the IE where the byte array should match.
6685fbd05e4aSLuca Coelho  *	If match_len is zero, this must also be set to zero.
6686fbd05e4aSLuca Coelho  *	Otherwise this must be set to 2 or more, because the first
6687fbd05e4aSLuca Coelho  *	byte is the element id, which is already compared to eid, and
6688fbd05e4aSLuca Coelho  *	the second byte is the IE length.
6689fbd05e4aSLuca Coelho  *
6690fbd05e4aSLuca Coelho  * Return: %NULL if the element ID could not be found or if
6691fbd05e4aSLuca Coelho  * the element is invalid (claims to be longer than the given
6692fbd05e4aSLuca Coelho  * data) or if the byte array doesn't match, or a pointer to the first
6693fbd05e4aSLuca Coelho  * byte of the requested element, that is the byte containing the
6694fbd05e4aSLuca Coelho  * element ID.
6695fbd05e4aSLuca Coelho  *
6696fbd05e4aSLuca Coelho  * Note: There are no checks on the element length other than
6697fbd05e4aSLuca Coelho  * having to fit into the given data and being large enough for the
6698fbd05e4aSLuca Coelho  * byte array to match.
6699fbd05e4aSLuca Coelho  */
670049a68e0dSJohannes Berg static inline const u8 *
670149a68e0dSJohannes Berg cfg80211_find_ie_match(u8 eid, const u8 *ies, unsigned int len,
670249a68e0dSJohannes Berg 		       const u8 *match, unsigned int match_len,
670349a68e0dSJohannes Berg 		       unsigned int match_offset)
670449a68e0dSJohannes Berg {
670549a68e0dSJohannes Berg 	/* match_offset can't be smaller than 2, unless match_len is
670649a68e0dSJohannes Berg 	 * zero, in which case match_offset must be zero as well.
670749a68e0dSJohannes Berg 	 */
670849a68e0dSJohannes Berg 	if (WARN_ON((match_len && match_offset < 2) ||
670949a68e0dSJohannes Berg 		    (!match_len && match_offset)))
671049a68e0dSJohannes Berg 		return NULL;
671149a68e0dSJohannes Berg 
67127e367b06SJohannes Berg 	return (const void *)cfg80211_find_elem_match(eid, ies, len,
671349a68e0dSJohannes Berg 						      match, match_len,
671449a68e0dSJohannes Berg 						      match_offset ?
671549a68e0dSJohannes Berg 							match_offset - 2 : 0);
671649a68e0dSJohannes Berg }
671749a68e0dSJohannes Berg 
671849a68e0dSJohannes Berg /**
671949a68e0dSJohannes Berg  * cfg80211_find_elem - find information element in data
672049a68e0dSJohannes Berg  *
672149a68e0dSJohannes Berg  * @eid: element ID
672249a68e0dSJohannes Berg  * @ies: data consisting of IEs
672349a68e0dSJohannes Berg  * @len: length of data
672449a68e0dSJohannes Berg  *
672549a68e0dSJohannes Berg  * Return: %NULL if the element ID could not be found or if
672649a68e0dSJohannes Berg  * the element is invalid (claims to be longer than the given
672749a68e0dSJohannes Berg  * data) or if the byte array doesn't match; otherwise return the
672849a68e0dSJohannes Berg  * requested element struct.
672949a68e0dSJohannes Berg  *
673049a68e0dSJohannes Berg  * Note: There are no checks on the element length other than
673149a68e0dSJohannes Berg  * having to fit into the given data.
673249a68e0dSJohannes Berg  */
673349a68e0dSJohannes Berg static inline const struct element *
673449a68e0dSJohannes Berg cfg80211_find_elem(u8 eid, const u8 *ies, int len)
673549a68e0dSJohannes Berg {
673649a68e0dSJohannes Berg 	return cfg80211_find_elem_match(eid, ies, len, NULL, 0, 0);
673749a68e0dSJohannes Berg }
6738fbd05e4aSLuca Coelho 
6739fbd05e4aSLuca Coelho /**
6740c21dbf92SJohannes Berg  * cfg80211_find_ie - find information element in data
6741c21dbf92SJohannes Berg  *
6742c21dbf92SJohannes Berg  * @eid: element ID
6743c21dbf92SJohannes Berg  * @ies: data consisting of IEs
6744c21dbf92SJohannes Berg  * @len: length of data
6745c21dbf92SJohannes Berg  *
67460ae997dcSYacine Belkadi  * Return: %NULL if the element ID could not be found or if
67470ae997dcSYacine Belkadi  * the element is invalid (claims to be longer than the given
67480ae997dcSYacine Belkadi  * data), or a pointer to the first byte of the requested
67490ae997dcSYacine Belkadi  * element, that is the byte containing the element ID.
67500ae997dcSYacine Belkadi  *
67510ae997dcSYacine Belkadi  * Note: There are no checks on the element length other than
67520ae997dcSYacine Belkadi  * having to fit into the given data.
6753c21dbf92SJohannes Berg  */
6754fbd05e4aSLuca Coelho static inline const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len)
6755fbd05e4aSLuca Coelho {
6756fbd05e4aSLuca Coelho 	return cfg80211_find_ie_match(eid, ies, len, NULL, 0, 0);
6757fbd05e4aSLuca Coelho }
6758c21dbf92SJohannes Berg 
6759d70e9693SJohannes Berg /**
676049a68e0dSJohannes Berg  * cfg80211_find_ext_elem - find information element with EID Extension in data
676149a68e0dSJohannes Berg  *
676249a68e0dSJohannes Berg  * @ext_eid: element ID Extension
676349a68e0dSJohannes Berg  * @ies: data consisting of IEs
676449a68e0dSJohannes Berg  * @len: length of data
676549a68e0dSJohannes Berg  *
676698e0c7f8SRandy Dunlap  * Return: %NULL if the extended element could not be found or if
676749a68e0dSJohannes Berg  * the element is invalid (claims to be longer than the given
676849a68e0dSJohannes Berg  * data) or if the byte array doesn't match; otherwise return the
676949a68e0dSJohannes Berg  * requested element struct.
677049a68e0dSJohannes Berg  *
677149a68e0dSJohannes Berg  * Note: There are no checks on the element length other than
677249a68e0dSJohannes Berg  * having to fit into the given data.
677349a68e0dSJohannes Berg  */
677449a68e0dSJohannes Berg static inline const struct element *
677549a68e0dSJohannes Berg cfg80211_find_ext_elem(u8 ext_eid, const u8 *ies, int len)
677649a68e0dSJohannes Berg {
677749a68e0dSJohannes Berg 	return cfg80211_find_elem_match(WLAN_EID_EXTENSION, ies, len,
677849a68e0dSJohannes Berg 					&ext_eid, 1, 0);
677949a68e0dSJohannes Berg }
678049a68e0dSJohannes Berg 
678149a68e0dSJohannes Berg /**
67823f817fe7SJouni Malinen  * cfg80211_find_ext_ie - find information element with EID Extension in data
67833f817fe7SJouni Malinen  *
67843f817fe7SJouni Malinen  * @ext_eid: element ID Extension
67853f817fe7SJouni Malinen  * @ies: data consisting of IEs
67863f817fe7SJouni Malinen  * @len: length of data
67873f817fe7SJouni Malinen  *
67883f817fe7SJouni Malinen  * Return: %NULL if the extended element ID could not be found or if
67893f817fe7SJouni Malinen  * the element is invalid (claims to be longer than the given
67903f817fe7SJouni Malinen  * data), or a pointer to the first byte of the requested
67913f817fe7SJouni Malinen  * element, that is the byte containing the element ID.
67923f817fe7SJouni Malinen  *
67933f817fe7SJouni Malinen  * Note: There are no checks on the element length other than
67943f817fe7SJouni Malinen  * having to fit into the given data.
67953f817fe7SJouni Malinen  */
67963f817fe7SJouni Malinen static inline const u8 *cfg80211_find_ext_ie(u8 ext_eid, const u8 *ies, int len)
67973f817fe7SJouni Malinen {
67983f817fe7SJouni Malinen 	return cfg80211_find_ie_match(WLAN_EID_EXTENSION, ies, len,
67993f817fe7SJouni Malinen 				      &ext_eid, 1, 2);
68003f817fe7SJouni Malinen }
68013f817fe7SJouni Malinen 
68023f817fe7SJouni Malinen /**
680349a68e0dSJohannes Berg  * cfg80211_find_vendor_elem - find vendor specific information element in data
680449a68e0dSJohannes Berg  *
680549a68e0dSJohannes Berg  * @oui: vendor OUI
680649a68e0dSJohannes Berg  * @oui_type: vendor-specific OUI type (must be < 0xff), negative means any
680749a68e0dSJohannes Berg  * @ies: data consisting of IEs
680849a68e0dSJohannes Berg  * @len: length of data
680949a68e0dSJohannes Berg  *
681049a68e0dSJohannes Berg  * Return: %NULL if the vendor specific element ID could not be found or if the
681149a68e0dSJohannes Berg  * element is invalid (claims to be longer than the given data); otherwise
681249a68e0dSJohannes Berg  * return the element structure for the requested element.
681349a68e0dSJohannes Berg  *
681449a68e0dSJohannes Berg  * Note: There are no checks on the element length other than having to fit into
681549a68e0dSJohannes Berg  * the given data.
681649a68e0dSJohannes Berg  */
681749a68e0dSJohannes Berg const struct element *cfg80211_find_vendor_elem(unsigned int oui, int oui_type,
681849a68e0dSJohannes Berg 						const u8 *ies,
681949a68e0dSJohannes Berg 						unsigned int len);
682049a68e0dSJohannes Berg 
682149a68e0dSJohannes Berg /**
68220c28ec58SEliad Peller  * cfg80211_find_vendor_ie - find vendor specific information element in data
68230c28ec58SEliad Peller  *
68240c28ec58SEliad Peller  * @oui: vendor OUI
68259e9ea439SEmmanuel Grumbach  * @oui_type: vendor-specific OUI type (must be < 0xff), negative means any
68260c28ec58SEliad Peller  * @ies: data consisting of IEs
68270c28ec58SEliad Peller  * @len: length of data
68280c28ec58SEliad Peller  *
68290ae997dcSYacine Belkadi  * Return: %NULL if the vendor specific element ID could not be found or if the
68300ae997dcSYacine Belkadi  * element is invalid (claims to be longer than the given data), or a pointer to
68310ae997dcSYacine Belkadi  * the first byte of the requested element, that is the byte containing the
68320ae997dcSYacine Belkadi  * element ID.
68330ae997dcSYacine Belkadi  *
68340ae997dcSYacine Belkadi  * Note: There are no checks on the element length other than having to fit into
68350ae997dcSYacine Belkadi  * the given data.
68360c28ec58SEliad Peller  */
683749a68e0dSJohannes Berg static inline const u8 *
683849a68e0dSJohannes Berg cfg80211_find_vendor_ie(unsigned int oui, int oui_type,
683949a68e0dSJohannes Berg 			const u8 *ies, unsigned int len)
684049a68e0dSJohannes Berg {
68417e367b06SJohannes Berg 	return (const void *)cfg80211_find_vendor_elem(oui, oui_type, ies, len);
684249a68e0dSJohannes Berg }
68430c28ec58SEliad Peller 
68440c28ec58SEliad Peller /**
6845f837a653SBenjamin Berg  * cfg80211_defragment_element - Defrag the given element data into a buffer
6846f837a653SBenjamin Berg  *
6847f837a653SBenjamin Berg  * @elem: the element to defragment
6848f837a653SBenjamin Berg  * @ies: elements where @elem is contained
6849f837a653SBenjamin Berg  * @ieslen: length of @ies
6850f837a653SBenjamin Berg  * @data: buffer to store element data
6851f837a653SBenjamin Berg  * @data_len: length of @data
6852f837a653SBenjamin Berg  * @frag_id: the element ID of fragments
6853f837a653SBenjamin Berg  *
6854f837a653SBenjamin Berg  * Return: length of @data, or -EINVAL on error
6855f837a653SBenjamin Berg  *
6856f837a653SBenjamin Berg  * Copy out all data from an element that may be fragmented into @data, while
6857f837a653SBenjamin Berg  * skipping all headers.
6858f837a653SBenjamin Berg  *
6859f837a653SBenjamin Berg  * The function uses memmove() internally. It is acceptable to defragment an
6860f837a653SBenjamin Berg  * element in-place.
6861f837a653SBenjamin Berg  */
6862f837a653SBenjamin Berg ssize_t cfg80211_defragment_element(const struct element *elem, const u8 *ies,
6863f837a653SBenjamin Berg 				    size_t ieslen, u8 *data, size_t data_len,
6864f837a653SBenjamin Berg 				    u8 frag_id);
6865f837a653SBenjamin Berg 
6866f837a653SBenjamin Berg /**
686730ca1aa5SDedy Lansky  * cfg80211_send_layer2_update - send layer 2 update frame
686830ca1aa5SDedy Lansky  *
686930ca1aa5SDedy Lansky  * @dev: network device
687030ca1aa5SDedy Lansky  * @addr: STA MAC address
687130ca1aa5SDedy Lansky  *
687230ca1aa5SDedy Lansky  * Wireless drivers can use this function to update forwarding tables in bridge
687330ca1aa5SDedy Lansky  * devices upon STA association.
687430ca1aa5SDedy Lansky  */
687530ca1aa5SDedy Lansky void cfg80211_send_layer2_update(struct net_device *dev, const u8 *addr);
687630ca1aa5SDedy Lansky 
687730ca1aa5SDedy Lansky /**
6878d70e9693SJohannes Berg  * DOC: Regulatory enforcement infrastructure
6879d70e9693SJohannes Berg  *
6880d70e9693SJohannes Berg  * TODO
6881d3236553SJohannes Berg  */
6882d3236553SJohannes Berg 
6883d3236553SJohannes Berg /**
6884d3236553SJohannes Berg  * regulatory_hint - driver hint to the wireless core a regulatory domain
6885d3236553SJohannes Berg  * @wiphy: the wireless device giving the hint (used only for reporting
6886d3236553SJohannes Berg  *	conflicts)
6887d3236553SJohannes Berg  * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain
6888d3236553SJohannes Berg  *	should be in. If @rd is set this should be NULL. Note that if you
6889d3236553SJohannes Berg  *	set this to NULL you should still set rd->alpha2 to some accepted
6890d3236553SJohannes Berg  *	alpha2.
6891d3236553SJohannes Berg  *
6892d3236553SJohannes Berg  * Wireless drivers can use this function to hint to the wireless core
6893d3236553SJohannes Berg  * what it believes should be the current regulatory domain by
6894d3236553SJohannes Berg  * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory
6895d3236553SJohannes Berg  * domain should be in or by providing a completely build regulatory domain.
6896d3236553SJohannes Berg  * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried
6897d3236553SJohannes Berg  * for a regulatory domain structure for the respective country.
6898d3236553SJohannes Berg  *
6899d3236553SJohannes Berg  * The wiphy must have been registered to cfg80211 prior to this call.
6900d3236553SJohannes Berg  * For cfg80211 drivers this means you must first use wiphy_register(),
6901d3236553SJohannes Berg  * for mac80211 drivers you must first use ieee80211_register_hw().
6902d3236553SJohannes Berg  *
6903d3236553SJohannes Berg  * Drivers should check the return value, its possible you can get
6904d3236553SJohannes Berg  * an -ENOMEM.
69050ae997dcSYacine Belkadi  *
69060ae997dcSYacine Belkadi  * Return: 0 on success. -ENOMEM.
6907d3236553SJohannes Berg  */
690810dd9b7cSJoe Perches int regulatory_hint(struct wiphy *wiphy, const char *alpha2);
6909d3236553SJohannes Berg 
6910d3236553SJohannes Berg /**
6911b0d7aa59SJonathan Doron  * regulatory_set_wiphy_regd - set regdom info for self managed drivers
6912b0d7aa59SJonathan Doron  * @wiphy: the wireless device we want to process the regulatory domain on
691398e0c7f8SRandy Dunlap  * @rd: the regulatory domain information to use for this wiphy
6914b0d7aa59SJonathan Doron  *
6915b0d7aa59SJonathan Doron  * Set the regulatory domain information for self-managed wiphys, only they
6916b0d7aa59SJonathan Doron  * may use this function. See %REGULATORY_WIPHY_SELF_MANAGED for more
6917b0d7aa59SJonathan Doron  * information.
6918b0d7aa59SJonathan Doron  *
6919b0d7aa59SJonathan Doron  * Return: 0 on success. -EINVAL, -EPERM
6920b0d7aa59SJonathan Doron  */
6921b0d7aa59SJonathan Doron int regulatory_set_wiphy_regd(struct wiphy *wiphy,
6922b0d7aa59SJonathan Doron 			      struct ieee80211_regdomain *rd);
6923b0d7aa59SJonathan Doron 
6924b0d7aa59SJonathan Doron /**
6925a05829a7SJohannes Berg  * regulatory_set_wiphy_regd_sync - set regdom for self-managed drivers
69262c3e861cSArik Nemtsov  * @wiphy: the wireless device we want to process the regulatory domain on
69272c3e861cSArik Nemtsov  * @rd: the regulatory domain information to use for this wiphy
69282c3e861cSArik Nemtsov  *
6929a05829a7SJohannes Berg  * This functions requires the RTNL and the wiphy mutex to be held and
6930a05829a7SJohannes Berg  * applies the new regdomain synchronously to this wiphy. For more details
6931a05829a7SJohannes Berg  * see regulatory_set_wiphy_regd().
69322c3e861cSArik Nemtsov  *
69332c3e861cSArik Nemtsov  * Return: 0 on success. -EINVAL, -EPERM
69342c3e861cSArik Nemtsov  */
6935a05829a7SJohannes Berg int regulatory_set_wiphy_regd_sync(struct wiphy *wiphy,
69362c3e861cSArik Nemtsov 				   struct ieee80211_regdomain *rd);
69372c3e861cSArik Nemtsov 
69382c3e861cSArik Nemtsov /**
6939d3236553SJohannes Berg  * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain
6940d3236553SJohannes Berg  * @wiphy: the wireless device we want to process the regulatory domain on
6941d3236553SJohannes Berg  * @regd: the custom regulatory domain to use for this wiphy
6942d3236553SJohannes Berg  *
6943d3236553SJohannes Berg  * Drivers can sometimes have custom regulatory domains which do not apply
6944d3236553SJohannes Berg  * to a specific country. Drivers can use this to apply such custom regulatory
6945d3236553SJohannes Berg  * domains. This routine must be called prior to wiphy registration. The
6946d3236553SJohannes Berg  * custom regulatory domain will be trusted completely and as such previous
6947d3236553SJohannes Berg  * default channel settings will be disregarded. If no rule is found for a
6948d3236553SJohannes Berg  * channel on the regulatory domain the channel will be disabled.
6949222ea581SLuis R. Rodriguez  * Drivers using this for a wiphy should also set the wiphy flag
6950ce26151bSKalle Valo  * REGULATORY_CUSTOM_REG or cfg80211 will set it for the wiphy
6951222ea581SLuis R. Rodriguez  * that called this helper.
6952d3236553SJohannes Berg  */
695310dd9b7cSJoe Perches void wiphy_apply_custom_regulatory(struct wiphy *wiphy,
6954d3236553SJohannes Berg 				   const struct ieee80211_regdomain *regd);
6955d3236553SJohannes Berg 
6956d3236553SJohannes Berg /**
6957d3236553SJohannes Berg  * freq_reg_info - get regulatory information for the given frequency
6958d3236553SJohannes Berg  * @wiphy: the wiphy for which we want to process this rule for
6959d3236553SJohannes Berg  * @center_freq: Frequency in KHz for which we want regulatory information for
6960d3236553SJohannes Berg  *
6961d3236553SJohannes Berg  * Use this function to get the regulatory rule for a specific frequency on
6962d3236553SJohannes Berg  * a given wireless device. If the device has a specific regulatory domain
6963d3236553SJohannes Berg  * it wants to follow we respect that unless a country IE has been received
6964d3236553SJohannes Berg  * and processed already.
6965d3236553SJohannes Berg  *
69660ae997dcSYacine Belkadi  * Return: A valid pointer, or, when an error occurs, for example if no rule
69670ae997dcSYacine Belkadi  * can be found, the return value is encoded using ERR_PTR(). Use IS_ERR() to
69680ae997dcSYacine Belkadi  * check and PTR_ERR() to obtain the numeric return value. The numeric return
69690ae997dcSYacine Belkadi  * value will be -ERANGE if we determine the given center_freq does not even
69700ae997dcSYacine Belkadi  * have a regulatory rule for a frequency range in the center_freq's band.
69710ae997dcSYacine Belkadi  * See freq_in_rule_band() for our current definition of a band -- this is
69720ae997dcSYacine Belkadi  * purely subjective and right now it's 802.11 specific.
6973d3236553SJohannes Berg  */
6974361c9c8bSJohannes Berg const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy,
6975361c9c8bSJohannes Berg 					       u32 center_freq);
6976d3236553SJohannes Berg 
6977034c6d6eSLuis R. Rodriguez /**
6978034c6d6eSLuis R. Rodriguez  * reg_initiator_name - map regulatory request initiator enum to name
6979034c6d6eSLuis R. Rodriguez  * @initiator: the regulatory request initiator
6980034c6d6eSLuis R. Rodriguez  *
6981034c6d6eSLuis R. Rodriguez  * You can use this to map the regulatory request initiator enum to a
6982034c6d6eSLuis R. Rodriguez  * proper string representation.
6983034c6d6eSLuis R. Rodriguez  */
6984034c6d6eSLuis R. Rodriguez const char *reg_initiator_name(enum nl80211_reg_initiator initiator);
6985034c6d6eSLuis R. Rodriguez 
698619d3577eSHaim Dreyfuss /**
6987dc0c18edSAaron Komisar  * regulatory_pre_cac_allowed - check if pre-CAC allowed in the current regdom
6988dc0c18edSAaron Komisar  * @wiphy: wiphy for which pre-CAC capability is checked.
6989dc0c18edSAaron Komisar  *
6990dc0c18edSAaron Komisar  * Pre-CAC is allowed only in some regdomains (notable ETSI).
6991dc0c18edSAaron Komisar  */
6992dc0c18edSAaron Komisar bool regulatory_pre_cac_allowed(struct wiphy *wiphy);
6993dc0c18edSAaron Komisar 
6994dc0c18edSAaron Komisar /**
699519d3577eSHaim Dreyfuss  * DOC: Internal regulatory db functions
699619d3577eSHaim Dreyfuss  *
699719d3577eSHaim Dreyfuss  */
699819d3577eSHaim Dreyfuss 
699919d3577eSHaim Dreyfuss /**
700019d3577eSHaim Dreyfuss  * reg_query_regdb_wmm -  Query internal regulatory db for wmm rule
700119d3577eSHaim Dreyfuss  * Regulatory self-managed driver can use it to proactively
700219d3577eSHaim Dreyfuss  *
700319d3577eSHaim Dreyfuss  * @alpha2: the ISO/IEC 3166 alpha2 wmm rule to be queried.
700498e0c7f8SRandy Dunlap  * @freq: the frequency (in MHz) to be queried.
700519d3577eSHaim Dreyfuss  * @rule: pointer to store the wmm rule from the regulatory db.
700619d3577eSHaim Dreyfuss  *
700719d3577eSHaim Dreyfuss  * Self-managed wireless drivers can use this function to  query
700819d3577eSHaim Dreyfuss  * the internal regulatory database to check whether the given
700919d3577eSHaim Dreyfuss  * ISO/IEC 3166 alpha2 country and freq have wmm rule limitations.
701019d3577eSHaim Dreyfuss  *
701119d3577eSHaim Dreyfuss  * Drivers should check the return value, its possible you can get
701219d3577eSHaim Dreyfuss  * an -ENODATA.
701319d3577eSHaim Dreyfuss  *
701419d3577eSHaim Dreyfuss  * Return: 0 on success. -ENODATA.
701519d3577eSHaim Dreyfuss  */
701638cb87eeSStanislaw Gruszka int reg_query_regdb_wmm(char *alpha2, int freq,
701738cb87eeSStanislaw Gruszka 			struct ieee80211_reg_rule *rule);
701819d3577eSHaim Dreyfuss 
7019d3236553SJohannes Berg /*
7020d3236553SJohannes Berg  * callbacks for asynchronous cfg80211 methods, notification
7021d3236553SJohannes Berg  * functions and BSS handling helpers
7022d3236553SJohannes Berg  */
7023d3236553SJohannes Berg 
70242a519311SJohannes Berg /**
70252a519311SJohannes Berg  * cfg80211_scan_done - notify that scan finished
70262a519311SJohannes Berg  *
70272a519311SJohannes Berg  * @request: the corresponding scan request
70281d76250bSAvraham Stern  * @info: information about the completed scan
70292a519311SJohannes Berg  */
70301d76250bSAvraham Stern void cfg80211_scan_done(struct cfg80211_scan_request *request,
70311d76250bSAvraham Stern 			struct cfg80211_scan_info *info);
70322a519311SJohannes Berg 
70332a519311SJohannes Berg /**
7034807f8a8cSLuciano Coelho  * cfg80211_sched_scan_results - notify that new scan results are available
7035807f8a8cSLuciano Coelho  *
7036807f8a8cSLuciano Coelho  * @wiphy: the wiphy which got scheduled scan results
7037b34939b9SArend Van Spriel  * @reqid: identifier for the related scheduled scan request
7038807f8a8cSLuciano Coelho  */
7039b34939b9SArend Van Spriel void cfg80211_sched_scan_results(struct wiphy *wiphy, u64 reqid);
7040807f8a8cSLuciano Coelho 
7041807f8a8cSLuciano Coelho /**
7042807f8a8cSLuciano Coelho  * cfg80211_sched_scan_stopped - notify that the scheduled scan has stopped
7043807f8a8cSLuciano Coelho  *
7044807f8a8cSLuciano Coelho  * @wiphy: the wiphy on which the scheduled scan stopped
7045b34939b9SArend Van Spriel  * @reqid: identifier for the related scheduled scan request
7046807f8a8cSLuciano Coelho  *
7047807f8a8cSLuciano Coelho  * The driver can call this function to inform cfg80211 that the
7048807f8a8cSLuciano Coelho  * scheduled scan had to be stopped, for whatever reason.  The driver
7049807f8a8cSLuciano Coelho  * is then called back via the sched_scan_stop operation when done.
7050807f8a8cSLuciano Coelho  */
7051b34939b9SArend Van Spriel void cfg80211_sched_scan_stopped(struct wiphy *wiphy, u64 reqid);
7052807f8a8cSLuciano Coelho 
7053807f8a8cSLuciano Coelho /**
7054a05829a7SJohannes Berg  * cfg80211_sched_scan_stopped_locked - notify that the scheduled scan has stopped
7055792e6aa7SEliad Peller  *
7056792e6aa7SEliad Peller  * @wiphy: the wiphy on which the scheduled scan stopped
7057b34939b9SArend Van Spriel  * @reqid: identifier for the related scheduled scan request
7058792e6aa7SEliad Peller  *
7059792e6aa7SEliad Peller  * The driver can call this function to inform cfg80211 that the
7060792e6aa7SEliad Peller  * scheduled scan had to be stopped, for whatever reason.  The driver
7061792e6aa7SEliad Peller  * is then called back via the sched_scan_stop operation when done.
7062a05829a7SJohannes Berg  * This function should be called with the wiphy mutex held.
7063792e6aa7SEliad Peller  */
7064a05829a7SJohannes Berg void cfg80211_sched_scan_stopped_locked(struct wiphy *wiphy, u64 reqid);
7065792e6aa7SEliad Peller 
7066792e6aa7SEliad Peller /**
70676e19bc4bSDmitry Shmidt  * cfg80211_inform_bss_frame_data - inform cfg80211 of a received BSS frame
70682a519311SJohannes Berg  * @wiphy: the wiphy reporting the BSS
70696e19bc4bSDmitry Shmidt  * @data: the BSS metadata
7070abe37c4bSJohannes Berg  * @mgmt: the management frame (probe response or beacon)
7071abe37c4bSJohannes Berg  * @len: length of the management frame
70722a519311SJohannes Berg  * @gfp: context flags
70732a519311SJohannes Berg  *
70742a519311SJohannes Berg  * This informs cfg80211 that BSS information was found and
70752a519311SJohannes Berg  * the BSS should be updated/added.
7076ef100682SJohannes Berg  *
70770ae997dcSYacine Belkadi  * Return: A referenced struct, must be released with cfg80211_put_bss()!
70780ae997dcSYacine Belkadi  * Or %NULL on error.
70792a519311SJohannes Berg  */
7080ef100682SJohannes Berg struct cfg80211_bss * __must_check
70816e19bc4bSDmitry Shmidt cfg80211_inform_bss_frame_data(struct wiphy *wiphy,
70826e19bc4bSDmitry Shmidt 			       struct cfg80211_inform_bss *data,
70836e19bc4bSDmitry Shmidt 			       struct ieee80211_mgmt *mgmt, size_t len,
70846e19bc4bSDmitry Shmidt 			       gfp_t gfp);
70856e19bc4bSDmitry Shmidt 
70866e19bc4bSDmitry Shmidt static inline struct cfg80211_bss * __must_check
70872a519311SJohannes Berg cfg80211_inform_bss_frame(struct wiphy *wiphy,
70883afc2167SEmmanuel Grumbach 			  struct ieee80211_channel *rx_channel,
70892a519311SJohannes Berg 			  struct ieee80211_mgmt *mgmt, size_t len,
7090dcd6eac1SSimon Wunderlich 			  s32 signal, gfp_t gfp)
7091dcd6eac1SSimon Wunderlich {
70926e19bc4bSDmitry Shmidt 	struct cfg80211_inform_bss data = {
70936e19bc4bSDmitry Shmidt 		.chan = rx_channel,
70946e19bc4bSDmitry Shmidt 		.signal = signal,
70956e19bc4bSDmitry Shmidt 	};
70966e19bc4bSDmitry Shmidt 
70976e19bc4bSDmitry Shmidt 	return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp);
7098dcd6eac1SSimon Wunderlich }
70992a519311SJohannes Berg 
7100abe37c4bSJohannes Berg /**
71017ece9c37SSara Sharon  * cfg80211_gen_new_bssid - generate a nontransmitted BSSID for multi-BSSID
71027ece9c37SSara Sharon  * @bssid: transmitter BSSID
71037ece9c37SSara Sharon  * @max_bssid: max BSSID indicator, taken from Multiple BSSID element
71047ece9c37SSara Sharon  * @mbssid_index: BSSID index, taken from Multiple BSSID index element
71055d4071abSJohannes Berg  * @new_bssid: calculated nontransmitted BSSID
71067ece9c37SSara Sharon  */
71077ece9c37SSara Sharon static inline void cfg80211_gen_new_bssid(const u8 *bssid, u8 max_bssid,
71085d4071abSJohannes Berg 					  u8 mbssid_index, u8 *new_bssid)
71097ece9c37SSara Sharon {
71105d4071abSJohannes Berg 	u64 bssid_u64 = ether_addr_to_u64(bssid);
71115d4071abSJohannes Berg 	u64 mask = GENMASK_ULL(max_bssid - 1, 0);
71125d4071abSJohannes Berg 	u64 new_bssid_u64;
71137ece9c37SSara Sharon 
71145d4071abSJohannes Berg 	new_bssid_u64 = bssid_u64 & ~mask;
71157ece9c37SSara Sharon 
71165d4071abSJohannes Berg 	new_bssid_u64 |= ((bssid_u64 & mask) + mbssid_index) & mask;
71177ece9c37SSara Sharon 
71185d4071abSJohannes Berg 	u64_to_ether_addr(new_bssid_u64, new_bssid);
71197ece9c37SSara Sharon }
71207ece9c37SSara Sharon 
71217ece9c37SSara Sharon /**
7122f7dacfb1SSara Sharon  * cfg80211_is_element_inherited - returns if element ID should be inherited
7123f7dacfb1SSara Sharon  * @element: element to check
7124f7dacfb1SSara Sharon  * @non_inherit_element: non inheritance element
7125f7dacfb1SSara Sharon  */
7126f7dacfb1SSara Sharon bool cfg80211_is_element_inherited(const struct element *element,
7127f7dacfb1SSara Sharon 				   const struct element *non_inherit_element);
7128f7dacfb1SSara Sharon 
7129f7dacfb1SSara Sharon /**
7130fe806e49SSara Sharon  * cfg80211_merge_profile - merges a MBSSID profile if it is split between IEs
7131fe806e49SSara Sharon  * @ie: ies
7132fe806e49SSara Sharon  * @ielen: length of IEs
7133fe806e49SSara Sharon  * @mbssid_elem: current MBSSID element
7134fe806e49SSara Sharon  * @sub_elem: current MBSSID subelement (profile)
7135fe806e49SSara Sharon  * @merged_ie: location of the merged profile
7136fe806e49SSara Sharon  * @max_copy_len: max merged profile length
7137fe806e49SSara Sharon  */
7138fe806e49SSara Sharon size_t cfg80211_merge_profile(const u8 *ie, size_t ielen,
7139fe806e49SSara Sharon 			      const struct element *mbssid_elem,
7140fe806e49SSara Sharon 			      const struct element *sub_elem,
71415809a5d5SDan Carpenter 			      u8 *merged_ie, size_t max_copy_len);
7142fe806e49SSara Sharon 
7143fe806e49SSara Sharon /**
71445bc8c1f2SJohannes Berg  * enum cfg80211_bss_frame_type - frame type that the BSS data came from
71455bc8c1f2SJohannes Berg  * @CFG80211_BSS_FTYPE_UNKNOWN: driver doesn't know whether the data is
71465bc8c1f2SJohannes Berg  *	from a beacon or probe response
71475bc8c1f2SJohannes Berg  * @CFG80211_BSS_FTYPE_BEACON: data comes from a beacon
71485bc8c1f2SJohannes Berg  * @CFG80211_BSS_FTYPE_PRESP: data comes from a probe response
71495bc8c1f2SJohannes Berg  */
71505bc8c1f2SJohannes Berg enum cfg80211_bss_frame_type {
71515bc8c1f2SJohannes Berg 	CFG80211_BSS_FTYPE_UNKNOWN,
71525bc8c1f2SJohannes Berg 	CFG80211_BSS_FTYPE_BEACON,
71535bc8c1f2SJohannes Berg 	CFG80211_BSS_FTYPE_PRESP,
71545bc8c1f2SJohannes Berg };
71555bc8c1f2SJohannes Berg 
71565bc8c1f2SJohannes Berg /**
71577f599aecSAyala Beker  * cfg80211_get_ies_channel_number - returns the channel number from ies
71587f599aecSAyala Beker  * @ie: IEs
71597f599aecSAyala Beker  * @ielen: length of IEs
71607f599aecSAyala Beker  * @band: enum nl80211_band of the channel
71617f599aecSAyala Beker  *
71627f599aecSAyala Beker  * Returns the channel number, or -1 if none could be determined.
71637f599aecSAyala Beker  */
71647f599aecSAyala Beker int cfg80211_get_ies_channel_number(const u8 *ie, size_t ielen,
71656ff9efcfSMordechay Goodstein 				    enum nl80211_band band);
71667f599aecSAyala Beker 
71677f599aecSAyala Beker /**
71681c1c2b37SDmitry Antipov  * cfg80211_ssid_eq - compare two SSIDs
71691c1c2b37SDmitry Antipov  * @a: first SSID
71701c1c2b37SDmitry Antipov  * @b: second SSID
71711c1c2b37SDmitry Antipov  *
71721c1c2b37SDmitry Antipov  * Return: %true if SSIDs are equal, %false otherwise.
71731c1c2b37SDmitry Antipov  */
71741c1c2b37SDmitry Antipov static inline bool
71751c1c2b37SDmitry Antipov cfg80211_ssid_eq(struct cfg80211_ssid *a, struct cfg80211_ssid *b)
71761c1c2b37SDmitry Antipov {
71771c1c2b37SDmitry Antipov 	if (WARN_ON(!a || !b))
71781c1c2b37SDmitry Antipov 		return false;
71791c1c2b37SDmitry Antipov 	if (a->ssid_len != b->ssid_len)
71801c1c2b37SDmitry Antipov 		return false;
71811c1c2b37SDmitry Antipov 	return memcmp(a->ssid, b->ssid, a->ssid_len) ? false : true;
71821c1c2b37SDmitry Antipov }
71831c1c2b37SDmitry Antipov 
71841c1c2b37SDmitry Antipov /**
71856e19bc4bSDmitry Shmidt  * cfg80211_inform_bss_data - inform cfg80211 of a new BSS
7186abe37c4bSJohannes Berg  *
7187abe37c4bSJohannes Berg  * @wiphy: the wiphy reporting the BSS
71886e19bc4bSDmitry Shmidt  * @data: the BSS metadata
71895bc8c1f2SJohannes Berg  * @ftype: frame type (if known)
7190abe37c4bSJohannes Berg  * @bssid: the BSSID of the BSS
71917b8bcff2SJohannes Berg  * @tsf: the TSF sent by the peer in the beacon/probe response (or 0)
7192abe37c4bSJohannes Berg  * @capability: the capability field sent by the peer
7193abe37c4bSJohannes Berg  * @beacon_interval: the beacon interval announced by the peer
7194abe37c4bSJohannes Berg  * @ie: additional IEs sent by the peer
7195abe37c4bSJohannes Berg  * @ielen: length of the additional IEs
7196abe37c4bSJohannes Berg  * @gfp: context flags
7197abe37c4bSJohannes Berg  *
7198abe37c4bSJohannes Berg  * This informs cfg80211 that BSS information was found and
7199abe37c4bSJohannes Berg  * the BSS should be updated/added.
7200ef100682SJohannes Berg  *
72010ae997dcSYacine Belkadi  * Return: A referenced struct, must be released with cfg80211_put_bss()!
72020ae997dcSYacine Belkadi  * Or %NULL on error.
7203abe37c4bSJohannes Berg  */
7204ef100682SJohannes Berg struct cfg80211_bss * __must_check
72056e19bc4bSDmitry Shmidt cfg80211_inform_bss_data(struct wiphy *wiphy,
72066e19bc4bSDmitry Shmidt 			 struct cfg80211_inform_bss *data,
72076e19bc4bSDmitry Shmidt 			 enum cfg80211_bss_frame_type ftype,
72086e19bc4bSDmitry Shmidt 			 const u8 *bssid, u64 tsf, u16 capability,
72096e19bc4bSDmitry Shmidt 			 u16 beacon_interval, const u8 *ie, size_t ielen,
72106e19bc4bSDmitry Shmidt 			 gfp_t gfp);
72116e19bc4bSDmitry Shmidt 
72126e19bc4bSDmitry Shmidt static inline struct cfg80211_bss * __must_check
721306aa7afaSJussi Kivilinna cfg80211_inform_bss(struct wiphy *wiphy,
72143afc2167SEmmanuel Grumbach 		    struct ieee80211_channel *rx_channel,
72155bc8c1f2SJohannes Berg 		    enum cfg80211_bss_frame_type ftype,
72167b8bcff2SJohannes Berg 		    const u8 *bssid, u64 tsf, u16 capability,
72177b8bcff2SJohannes Berg 		    u16 beacon_interval, const u8 *ie, size_t ielen,
7218dcd6eac1SSimon Wunderlich 		    s32 signal, gfp_t gfp)
7219dcd6eac1SSimon Wunderlich {
72206e19bc4bSDmitry Shmidt 	struct cfg80211_inform_bss data = {
72216e19bc4bSDmitry Shmidt 		.chan = rx_channel,
72226e19bc4bSDmitry Shmidt 		.signal = signal,
72236e19bc4bSDmitry Shmidt 	};
72246e19bc4bSDmitry Shmidt 
72256e19bc4bSDmitry Shmidt 	return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf,
72266e19bc4bSDmitry Shmidt 					capability, beacon_interval, ie, ielen,
7227dcd6eac1SSimon Wunderlich 					gfp);
7228dcd6eac1SSimon Wunderlich }
722906aa7afaSJussi Kivilinna 
723027548677SJohannes Berg /**
7231d02a12b8SJohannes Berg  * __cfg80211_get_bss - get a BSS reference
7232d02a12b8SJohannes Berg  * @wiphy: the wiphy this BSS struct belongs to
7233d02a12b8SJohannes Berg  * @channel: the channel to search on (or %NULL)
7234d02a12b8SJohannes Berg  * @bssid: the desired BSSID (or %NULL)
7235d02a12b8SJohannes Berg  * @ssid: the desired SSID (or %NULL)
7236d02a12b8SJohannes Berg  * @ssid_len: length of the SSID (or 0)
7237d02a12b8SJohannes Berg  * @bss_type: type of BSS, see &enum ieee80211_bss_type
7238d02a12b8SJohannes Berg  * @privacy: privacy filter, see &enum ieee80211_privacy
7239d02a12b8SJohannes Berg  * @use_for: indicates which use is intended
7240d02a12b8SJohannes Berg  */
7241d02a12b8SJohannes Berg struct cfg80211_bss *__cfg80211_get_bss(struct wiphy *wiphy,
7242d02a12b8SJohannes Berg 					struct ieee80211_channel *channel,
7243d02a12b8SJohannes Berg 					const u8 *bssid,
7244d02a12b8SJohannes Berg 					const u8 *ssid, size_t ssid_len,
7245d02a12b8SJohannes Berg 					enum ieee80211_bss_type bss_type,
7246d02a12b8SJohannes Berg 					enum ieee80211_privacy privacy,
7247d02a12b8SJohannes Berg 					u32 use_for);
7248d02a12b8SJohannes Berg 
7249d02a12b8SJohannes Berg /**
725027548677SJohannes Berg  * cfg80211_get_bss - get a BSS reference
725127548677SJohannes Berg  * @wiphy: the wiphy this BSS struct belongs to
725227548677SJohannes Berg  * @channel: the channel to search on (or %NULL)
725327548677SJohannes Berg  * @bssid: the desired BSSID (or %NULL)
725427548677SJohannes Berg  * @ssid: the desired SSID (or %NULL)
725527548677SJohannes Berg  * @ssid_len: length of the SSID (or 0)
725627548677SJohannes Berg  * @bss_type: type of BSS, see &enum ieee80211_bss_type
725727548677SJohannes Berg  * @privacy: privacy filter, see &enum ieee80211_privacy
7258d02a12b8SJohannes Berg  *
7259d02a12b8SJohannes Berg  * This version implies regular usage, %NL80211_BSS_USE_FOR_NORMAL.
726027548677SJohannes Berg  */
7261d02a12b8SJohannes Berg static inline struct cfg80211_bss *
7262d02a12b8SJohannes Berg cfg80211_get_bss(struct wiphy *wiphy, struct ieee80211_channel *channel,
7263d02a12b8SJohannes Berg 		 const u8 *bssid, const u8 *ssid, size_t ssid_len,
72646eb18137SDedy Lansky 		 enum ieee80211_bss_type bss_type,
7265d02a12b8SJohannes Berg 		 enum ieee80211_privacy privacy)
7266d02a12b8SJohannes Berg {
7267d02a12b8SJohannes Berg 	return __cfg80211_get_bss(wiphy, channel, bssid, ssid, ssid_len,
7268d02a12b8SJohannes Berg 				  bss_type, privacy,
7269d02a12b8SJohannes Berg 				  NL80211_BSS_USE_FOR_NORMAL);
7270d02a12b8SJohannes Berg }
7271d02a12b8SJohannes Berg 
727279420f09SJohannes Berg static inline struct cfg80211_bss *
727379420f09SJohannes Berg cfg80211_get_ibss(struct wiphy *wiphy,
727479420f09SJohannes Berg 		  struct ieee80211_channel *channel,
727579420f09SJohannes Berg 		  const u8 *ssid, size_t ssid_len)
727679420f09SJohannes Berg {
727779420f09SJohannes Berg 	return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len,
72786eb18137SDedy Lansky 				IEEE80211_BSS_TYPE_IBSS,
72796eb18137SDedy Lansky 				IEEE80211_PRIVACY_ANY);
728079420f09SJohannes Berg }
728179420f09SJohannes Berg 
72824c0c0b75SJohannes Berg /**
72834c0c0b75SJohannes Berg  * cfg80211_ref_bss - reference BSS struct
72845b112d3dSJohannes Berg  * @wiphy: the wiphy this BSS struct belongs to
72854c0c0b75SJohannes Berg  * @bss: the BSS struct to reference
72864c0c0b75SJohannes Berg  *
72874c0c0b75SJohannes Berg  * Increments the refcount of the given BSS struct.
72884c0c0b75SJohannes Berg  */
72895b112d3dSJohannes Berg void cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
72904c0c0b75SJohannes Berg 
72914c0c0b75SJohannes Berg /**
72924c0c0b75SJohannes Berg  * cfg80211_put_bss - unref BSS struct
72935b112d3dSJohannes Berg  * @wiphy: the wiphy this BSS struct belongs to
72944c0c0b75SJohannes Berg  * @bss: the BSS struct
72954c0c0b75SJohannes Berg  *
72964c0c0b75SJohannes Berg  * Decrements the refcount of the given BSS struct.
72974c0c0b75SJohannes Berg  */
72985b112d3dSJohannes Berg void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
7299d3236553SJohannes Berg 
7300d491af19SJohannes Berg /**
7301d491af19SJohannes Berg  * cfg80211_unlink_bss - unlink BSS from internal data structures
7302d491af19SJohannes Berg  * @wiphy: the wiphy
7303d491af19SJohannes Berg  * @bss: the bss to remove
7304d491af19SJohannes Berg  *
7305d491af19SJohannes Berg  * This function removes the given BSS from the internal data structures
7306d491af19SJohannes Berg  * thereby making it no longer show up in scan results etc. Use this
7307d491af19SJohannes Berg  * function when you detect a BSS is gone. Normally BSSes will also time
7308d491af19SJohannes Berg  * out, so it is not necessary to use this function at all.
7309d491af19SJohannes Berg  */
7310d491af19SJohannes Berg void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
7311fee52678SJohannes Berg 
73124770c8f9SIlan Peer /**
73134770c8f9SIlan Peer  * cfg80211_bss_iter - iterate all BSS entries
73144770c8f9SIlan Peer  *
73154770c8f9SIlan Peer  * This function iterates over the BSS entries associated with the given wiphy
73164770c8f9SIlan Peer  * and calls the callback for the iterated BSS. The iterator function is not
73174770c8f9SIlan Peer  * allowed to call functions that might modify the internal state of the BSS DB.
73184770c8f9SIlan Peer  *
73194770c8f9SIlan Peer  * @wiphy: the wiphy
73204770c8f9SIlan Peer  * @chandef: if given, the iterator function will be called only if the channel
73214770c8f9SIlan Peer  *     of the currently iterated BSS is a subset of the given channel.
73224770c8f9SIlan Peer  * @iter: the iterator function to call
73234770c8f9SIlan Peer  * @iter_data: an argument to the iterator function
73244770c8f9SIlan Peer  */
73254770c8f9SIlan Peer void cfg80211_bss_iter(struct wiphy *wiphy,
73264770c8f9SIlan Peer 		       struct cfg80211_chan_def *chandef,
73274770c8f9SIlan Peer 		       void (*iter)(struct wiphy *wiphy,
73284770c8f9SIlan Peer 				    struct cfg80211_bss *bss,
73294770c8f9SIlan Peer 				    void *data),
73304770c8f9SIlan Peer 		       void *iter_data);
73314770c8f9SIlan Peer 
73326039f6d2SJouni Malinen /**
73336ff57cf8SJohannes Berg  * cfg80211_rx_mlme_mgmt - notification of processed MLME management frame
73346039f6d2SJouni Malinen  * @dev: network device
73356039f6d2SJouni Malinen  * @buf: authentication frame (header + body)
73366039f6d2SJouni Malinen  * @len: length of the frame data
73376039f6d2SJouni Malinen  *
73386ff57cf8SJohannes Berg  * This function is called whenever an authentication, disassociation or
73396ff57cf8SJohannes Berg  * deauthentication frame has been received and processed in station mode.
73406ff57cf8SJohannes Berg  * After being asked to authenticate via cfg80211_ops::auth() the driver must
73416ff57cf8SJohannes Berg  * call either this function or cfg80211_auth_timeout().
73426ff57cf8SJohannes Berg  * After being asked to associate via cfg80211_ops::assoc() the driver must
73436ff57cf8SJohannes Berg  * call either this function or cfg80211_auth_timeout().
73446ff57cf8SJohannes Berg  * While connected, the driver must calls this for received and processed
73456ff57cf8SJohannes Berg  * disassociation and deauthentication frames. If the frame couldn't be used
73466ff57cf8SJohannes Berg  * because it was unprotected, the driver must call the function
73476ff57cf8SJohannes Berg  * cfg80211_rx_unprot_mlme_mgmt() instead.
73486ff57cf8SJohannes Berg  *
73496ff57cf8SJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's mutex.
73506039f6d2SJouni Malinen  */
73516ff57cf8SJohannes Berg void cfg80211_rx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len);
73526039f6d2SJouni Malinen 
73536039f6d2SJouni Malinen /**
73546ff57cf8SJohannes Berg  * cfg80211_auth_timeout - notification of timed out authentication
73551965c853SJouni Malinen  * @dev: network device
73561965c853SJouni Malinen  * @addr: The MAC address of the device with which the authentication timed out
7357cb0b4bebSJohannes Berg  *
73588d61ffa5SJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's
73598d61ffa5SJohannes Berg  * mutex.
73601965c853SJouni Malinen  */
73616ff57cf8SJohannes Berg void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr);
73621965c853SJouni Malinen 
73631965c853SJouni Malinen /**
73648e4687f6SKalle Valo  * struct cfg80211_rx_assoc_resp_data - association response data
73654d9ec73dSJouni Malinen  * @buf: (Re)Association Response frame (header + body)
73666039f6d2SJouni Malinen  * @len: length of the frame data
7367f438ceb8SEmmanuel Grumbach  * @uapsd_queues: bitmap of queues configured for uapsd. Same format
7368f438ceb8SEmmanuel Grumbach  *	as the AC bitmap in the QoS info field
73694d9ec73dSJouni Malinen  * @req_ies: information elements from the (Re)Association Request frame
73704d9ec73dSJouni Malinen  * @req_ies_len: length of req_ies data
73715cd212cbSJohannes Berg  * @ap_mld_addr: AP MLD address (in case of MLO)
73725cd212cbSJohannes Berg  * @links: per-link information indexed by link ID, use links[0] for
73735cd212cbSJohannes Berg  *	non-MLO connections
737433615978SJonathan Corbet  * @links.bss: the BSS that association was requested with, ownership of the
737533615978SJonathan Corbet  *      pointer moves to cfg80211 in the call to cfg80211_rx_assoc_resp()
737653ad07e9SJohannes Berg  * @links.status: Set this (along with a BSS pointer) for links that
737753ad07e9SJohannes Berg  *	were rejected by the AP.
7378cd47c0f5SJohannes Berg  */
73798e4687f6SKalle Valo struct cfg80211_rx_assoc_resp_data {
7380cd47c0f5SJohannes Berg 	const u8 *buf;
7381cd47c0f5SJohannes Berg 	size_t len;
7382cd47c0f5SJohannes Berg 	const u8 *req_ies;
7383cd47c0f5SJohannes Berg 	size_t req_ies_len;
7384cd47c0f5SJohannes Berg 	int uapsd_queues;
73855cd212cbSJohannes Berg 	const u8 *ap_mld_addr;
73865cd212cbSJohannes Berg 	struct {
7387234249d8SWen Gong 		u8 addr[ETH_ALEN] __aligned(2);
73885cd212cbSJohannes Berg 		struct cfg80211_bss *bss;
738953ad07e9SJohannes Berg 		u16 status;
73905cd212cbSJohannes Berg 	} links[IEEE80211_MLD_MAX_NUM_LINKS];
7391cd47c0f5SJohannes Berg };
7392cd47c0f5SJohannes Berg 
7393cd47c0f5SJohannes Berg /**
7394cd47c0f5SJohannes Berg  * cfg80211_rx_assoc_resp - notification of processed association response
7395cd47c0f5SJohannes Berg  * @dev: network device
73968e4687f6SKalle Valo  * @data: association response data, &struct cfg80211_rx_assoc_resp_data
73976039f6d2SJouni Malinen  *
73986ff57cf8SJohannes Berg  * After being asked to associate via cfg80211_ops::assoc() the driver must
73996ff57cf8SJohannes Berg  * call either this function or cfg80211_auth_timeout().
74006ff57cf8SJohannes Berg  *
74016ff57cf8SJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's mutex.
74026039f6d2SJouni Malinen  */
74036ff57cf8SJohannes Berg void cfg80211_rx_assoc_resp(struct net_device *dev,
740488f29324SJohannes Berg 			    const struct cfg80211_rx_assoc_resp_data *data);
74056039f6d2SJouni Malinen 
74066039f6d2SJouni Malinen /**
7407f662d2f4SJohannes Berg  * struct cfg80211_assoc_failure - association failure data
7408f662d2f4SJohannes Berg  * @ap_mld_addr: AP MLD address, or %NULL
7409f662d2f4SJohannes Berg  * @bss: list of BSSes, must use entry 0 for non-MLO connections
7410f662d2f4SJohannes Berg  *	(@ap_mld_addr is %NULL)
7411f662d2f4SJohannes Berg  * @timeout: indicates the association failed due to timeout, otherwise
7412f662d2f4SJohannes Berg  *	the association was abandoned for a reason reported through some
7413f662d2f4SJohannes Berg  *	other API (e.g. deauth RX)
74141965c853SJouni Malinen  */
7415f662d2f4SJohannes Berg struct cfg80211_assoc_failure {
7416f662d2f4SJohannes Berg 	const u8 *ap_mld_addr;
7417f662d2f4SJohannes Berg 	struct cfg80211_bss *bss[IEEE80211_MLD_MAX_NUM_LINKS];
7418f662d2f4SJohannes Berg 	bool timeout;
7419f662d2f4SJohannes Berg };
74201965c853SJouni Malinen 
74211965c853SJouni Malinen /**
7422f662d2f4SJohannes Berg  * cfg80211_assoc_failure - notification of association failure
7423e6f462dfSJohannes Berg  * @dev: network device
7424f662d2f4SJohannes Berg  * @data: data describing the association failure
7425e6f462dfSJohannes Berg  *
7426e6f462dfSJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's mutex.
7427e6f462dfSJohannes Berg  */
7428f662d2f4SJohannes Berg void cfg80211_assoc_failure(struct net_device *dev,
7429f662d2f4SJohannes Berg 			    struct cfg80211_assoc_failure *data);
7430e6f462dfSJohannes Berg 
7431e6f462dfSJohannes Berg /**
74326ff57cf8SJohannes Berg  * cfg80211_tx_mlme_mgmt - notification of transmitted deauth/disassoc frame
74336039f6d2SJouni Malinen  * @dev: network device
74346ff57cf8SJohannes Berg  * @buf: 802.11 frame (header + body)
74356039f6d2SJouni Malinen  * @len: length of the frame data
74363bb02143SJohannes Berg  * @reconnect: immediate reconnect is desired (include the nl80211 attribute)
74376039f6d2SJouni Malinen  *
74386039f6d2SJouni Malinen  * This function is called whenever deauthentication has been processed in
743953b46b84SJouni Malinen  * station mode. This includes both received deauthentication frames and
74408d61ffa5SJohannes Berg  * locally generated ones. This function may sleep. The caller must hold the
74418d61ffa5SJohannes Berg  * corresponding wdev's mutex.
74426039f6d2SJouni Malinen  */
74433bb02143SJohannes Berg void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len,
74443bb02143SJohannes Berg 			   bool reconnect);
7445ce470613SHolger Schurig 
7446ce470613SHolger Schurig /**
74476ff57cf8SJohannes Berg  * cfg80211_rx_unprot_mlme_mgmt - notification of unprotected mlme mgmt frame
7448cf4e594eSJouni Malinen  * @dev: network device
74494d797fceSJouni Malinen  * @buf: received management frame (header + body)
7450cf4e594eSJouni Malinen  * @len: length of the frame data
7451cf4e594eSJouni Malinen  *
74526ff57cf8SJohannes Berg  * This function is called whenever a received deauthentication or dissassoc
74536ff57cf8SJohannes Berg  * frame has been dropped in station mode because of MFP being used but the
74544d797fceSJouni Malinen  * frame was not protected. This is also used to notify reception of a Beacon
74554d797fceSJouni Malinen  * frame that was dropped because it did not include a valid MME MIC while
74564d797fceSJouni Malinen  * beacon protection was enabled (BIGTK configured in station mode).
74574d797fceSJouni Malinen  *
74584d797fceSJouni Malinen  * This function may sleep.
7459cf4e594eSJouni Malinen  */
74606ff57cf8SJohannes Berg void cfg80211_rx_unprot_mlme_mgmt(struct net_device *dev,
74616ff57cf8SJohannes Berg 				  const u8 *buf, size_t len);
7462cf4e594eSJouni Malinen 
7463cf4e594eSJouni Malinen /**
7464a3b8b056SJouni Malinen  * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP)
7465a3b8b056SJouni Malinen  * @dev: network device
7466a3b8b056SJouni Malinen  * @addr: The source MAC address of the frame
7467a3b8b056SJouni Malinen  * @key_type: The key type that the received frame used
7468a66b98dbSArik Nemtsov  * @key_id: Key identifier (0..3). Can be -1 if missing.
7469a3b8b056SJouni Malinen  * @tsc: The TSC value of the frame that generated the MIC failure (6 octets)
7470e6d6e342SJohannes Berg  * @gfp: allocation flags
7471a3b8b056SJouni Malinen  *
7472a3b8b056SJouni Malinen  * This function is called whenever the local MAC detects a MIC failure in a
7473a3b8b056SJouni Malinen  * received frame. This matches with MLME-MICHAELMICFAILURE.indication()
7474a3b8b056SJouni Malinen  * primitive.
7475a3b8b056SJouni Malinen  */
7476a3b8b056SJouni Malinen void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,
7477a3b8b056SJouni Malinen 				  enum nl80211_key_type key_type, int key_id,
7478e6d6e342SJohannes Berg 				  const u8 *tsc, gfp_t gfp);
7479a3b8b056SJouni Malinen 
748004a773adSJohannes Berg /**
748104a773adSJohannes Berg  * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS
748204a773adSJohannes Berg  *
748304a773adSJohannes Berg  * @dev: network device
748404a773adSJohannes Berg  * @bssid: the BSSID of the IBSS joined
7485fe94f3a4SAntonio Quartulli  * @channel: the channel of the IBSS joined
748604a773adSJohannes Berg  * @gfp: allocation flags
748704a773adSJohannes Berg  *
748804a773adSJohannes Berg  * This function notifies cfg80211 that the device joined an IBSS or
748904a773adSJohannes Berg  * switched to a different BSSID. Before this function can be called,
749004a773adSJohannes Berg  * either a beacon has to have been received from the IBSS, or one of
749104a773adSJohannes Berg  * the cfg80211_inform_bss{,_frame} functions must have been called
749204a773adSJohannes Berg  * with the locally generated beacon -- this guarantees that there is
749304a773adSJohannes Berg  * always a scan result for this IBSS. cfg80211 will handle the rest.
749404a773adSJohannes Berg  */
7495fe94f3a4SAntonio Quartulli void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid,
7496fe94f3a4SAntonio Quartulli 			  struct ieee80211_channel *channel, gfp_t gfp);
749704a773adSJohannes Berg 
74981f87f7d3SJohannes Berg /**
7499b1e8eb11SMauro Carvalho Chehab  * cfg80211_notify_new_peer_candidate - notify cfg80211 of a new mesh peer
7500b1e8eb11SMauro Carvalho Chehab  * 					candidate
7501c93b5e71SJavier Cardona  *
7502c93b5e71SJavier Cardona  * @dev: network device
7503c93b5e71SJavier Cardona  * @macaddr: the MAC address of the new candidate
7504c93b5e71SJavier Cardona  * @ie: information elements advertised by the peer candidate
75055ac4a12dSMatteo Croce  * @ie_len: length of the information elements buffer
75062d8b08feSMauro Carvalho Chehab  * @sig_dbm: signal level in dBm
7507c93b5e71SJavier Cardona  * @gfp: allocation flags
7508c93b5e71SJavier Cardona  *
7509c93b5e71SJavier Cardona  * This function notifies cfg80211 that the mesh peer candidate has been
7510c93b5e71SJavier Cardona  * detected, most likely via a beacon or, less likely, via a probe response.
7511c93b5e71SJavier Cardona  * cfg80211 then sends a notification to userspace.
7512c93b5e71SJavier Cardona  */
7513c93b5e71SJavier Cardona void cfg80211_notify_new_peer_candidate(struct net_device *dev,
7514ecbc12adSBob Copeland 		const u8 *macaddr, const u8 *ie, u8 ie_len,
7515ecbc12adSBob Copeland 		int sig_dbm, gfp_t gfp);
7516c93b5e71SJavier Cardona 
7517c93b5e71SJavier Cardona /**
7518d70e9693SJohannes Berg  * DOC: RFkill integration
7519d70e9693SJohannes Berg  *
7520d70e9693SJohannes Berg  * RFkill integration in cfg80211 is almost invisible to drivers,
7521d70e9693SJohannes Berg  * as cfg80211 automatically registers an rfkill instance for each
7522d70e9693SJohannes Berg  * wireless device it knows about. Soft kill is also translated
752305b23456SRandy Dunlap  * into disconnecting and turning all interfaces off. Drivers are
7524d70e9693SJohannes Berg  * expected to turn off the device when all interfaces are down.
7525d70e9693SJohannes Berg  *
7526d70e9693SJohannes Berg  * However, devices may have a hard RFkill line, in which case they
7527d70e9693SJohannes Berg  * also need to interact with the rfkill subsystem, via cfg80211.
7528d70e9693SJohannes Berg  * They can do this with a few helper functions documented here.
7529d70e9693SJohannes Berg  */
7530d70e9693SJohannes Berg 
7531d70e9693SJohannes Berg /**
7532810344edSEmmanuel Grumbach  * wiphy_rfkill_set_hw_state_reason - notify cfg80211 about hw block state
75331f87f7d3SJohannes Berg  * @wiphy: the wiphy
75341f87f7d3SJohannes Berg  * @blocked: block status
75356f779a66SEmmanuel Grumbach  * @reason: one of reasons in &enum rfkill_hard_block_reasons
75361f87f7d3SJohannes Berg  */
75376f779a66SEmmanuel Grumbach void wiphy_rfkill_set_hw_state_reason(struct wiphy *wiphy, bool blocked,
75386f779a66SEmmanuel Grumbach 				      enum rfkill_hard_block_reasons reason);
75396f779a66SEmmanuel Grumbach 
75406f779a66SEmmanuel Grumbach static inline void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked)
75416f779a66SEmmanuel Grumbach {
75426f779a66SEmmanuel Grumbach 	wiphy_rfkill_set_hw_state_reason(wiphy, blocked,
75436f779a66SEmmanuel Grumbach 					 RFKILL_HARD_BLOCK_SIGNAL);
75446f779a66SEmmanuel Grumbach }
75451f87f7d3SJohannes Berg 
75461f87f7d3SJohannes Berg /**
75471f87f7d3SJohannes Berg  * wiphy_rfkill_start_polling - start polling rfkill
75481f87f7d3SJohannes Berg  * @wiphy: the wiphy
75491f87f7d3SJohannes Berg  */
75501f87f7d3SJohannes Berg void wiphy_rfkill_start_polling(struct wiphy *wiphy);
75511f87f7d3SJohannes Berg 
75521f87f7d3SJohannes Berg /**
75531f87f7d3SJohannes Berg  * wiphy_rfkill_stop_polling - stop polling rfkill
75541f87f7d3SJohannes Berg  * @wiphy: the wiphy
75551f87f7d3SJohannes Berg  */
7556358ae888SEmmanuel Grumbach static inline void wiphy_rfkill_stop_polling(struct wiphy *wiphy)
7557358ae888SEmmanuel Grumbach {
7558358ae888SEmmanuel Grumbach 	rfkill_pause_polling(wiphy->rfkill);
7559358ae888SEmmanuel Grumbach }
75601f87f7d3SJohannes Berg 
7561ad7e718cSJohannes Berg /**
7562ad7e718cSJohannes Berg  * DOC: Vendor commands
7563ad7e718cSJohannes Berg  *
7564ad7e718cSJohannes Berg  * Occasionally, there are special protocol or firmware features that
7565ad7e718cSJohannes Berg  * can't be implemented very openly. For this and similar cases, the
7566ad7e718cSJohannes Berg  * vendor command functionality allows implementing the features with
7567ad7e718cSJohannes Berg  * (typically closed-source) userspace and firmware, using nl80211 as
7568ad7e718cSJohannes Berg  * the configuration mechanism.
7569ad7e718cSJohannes Berg  *
7570ad7e718cSJohannes Berg  * A driver supporting vendor commands must register them as an array
757105b23456SRandy Dunlap  * in struct wiphy, with handlers for each one. Each command has an
7572ad7e718cSJohannes Berg  * OUI and sub command ID to identify it.
7573ad7e718cSJohannes Berg  *
7574ad7e718cSJohannes Berg  * Note that this feature should not be (ab)used to implement protocol
7575ad7e718cSJohannes Berg  * features that could openly be shared across drivers. In particular,
7576ad7e718cSJohannes Berg  * it must never be required to use vendor commands to implement any
7577ad7e718cSJohannes Berg  * "normal" functionality that higher-level userspace like connection
7578ad7e718cSJohannes Berg  * managers etc. need.
7579ad7e718cSJohannes Berg  */
7580ad7e718cSJohannes Berg 
7581ad7e718cSJohannes Berg struct sk_buff *__cfg80211_alloc_reply_skb(struct wiphy *wiphy,
7582ad7e718cSJohannes Berg 					   enum nl80211_commands cmd,
7583ad7e718cSJohannes Berg 					   enum nl80211_attrs attr,
7584ad7e718cSJohannes Berg 					   int approxlen);
7585ad7e718cSJohannes Berg 
7586567ffc35SJohannes Berg struct sk_buff *__cfg80211_alloc_event_skb(struct wiphy *wiphy,
75876c09e791SAhmad Kholaif 					   struct wireless_dev *wdev,
7588567ffc35SJohannes Berg 					   enum nl80211_commands cmd,
7589567ffc35SJohannes Berg 					   enum nl80211_attrs attr,
759055c1fdf0SJohannes Berg 					   unsigned int portid,
7591567ffc35SJohannes Berg 					   int vendor_event_idx,
7592567ffc35SJohannes Berg 					   int approxlen, gfp_t gfp);
7593567ffc35SJohannes Berg 
7594567ffc35SJohannes Berg void __cfg80211_send_event_skb(struct sk_buff *skb, gfp_t gfp);
7595567ffc35SJohannes Berg 
7596ad7e718cSJohannes Berg /**
7597ad7e718cSJohannes Berg  * cfg80211_vendor_cmd_alloc_reply_skb - allocate vendor command reply
7598ad7e718cSJohannes Berg  * @wiphy: the wiphy
7599ad7e718cSJohannes Berg  * @approxlen: an upper bound of the length of the data that will
7600ad7e718cSJohannes Berg  *	be put into the skb
7601ad7e718cSJohannes Berg  *
7602ad7e718cSJohannes Berg  * This function allocates and pre-fills an skb for a reply to
7603ad7e718cSJohannes Berg  * a vendor command. Since it is intended for a reply, calling
7604ad7e718cSJohannes Berg  * it outside of a vendor command's doit() operation is invalid.
7605ad7e718cSJohannes Berg  *
7606ad7e718cSJohannes Berg  * The returned skb is pre-filled with some identifying data in
7607ad7e718cSJohannes Berg  * a way that any data that is put into the skb (with skb_put(),
7608ad7e718cSJohannes Berg  * nla_put() or similar) will end up being within the
7609ad7e718cSJohannes Berg  * %NL80211_ATTR_VENDOR_DATA attribute, so all that needs to be done
7610ad7e718cSJohannes Berg  * with the skb is adding data for the corresponding userspace tool
7611ad7e718cSJohannes Berg  * which can then read that data out of the vendor data attribute.
7612ad7e718cSJohannes Berg  * You must not modify the skb in any other way.
7613ad7e718cSJohannes Berg  *
7614ad7e718cSJohannes Berg  * When done, call cfg80211_vendor_cmd_reply() with the skb and return
7615ad7e718cSJohannes Berg  * its error code as the result of the doit() operation.
7616ad7e718cSJohannes Berg  *
7617ad7e718cSJohannes Berg  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
7618ad7e718cSJohannes Berg  */
7619ad7e718cSJohannes Berg static inline struct sk_buff *
7620ad7e718cSJohannes Berg cfg80211_vendor_cmd_alloc_reply_skb(struct wiphy *wiphy, int approxlen)
7621ad7e718cSJohannes Berg {
7622ad7e718cSJohannes Berg 	return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_VENDOR,
7623ad7e718cSJohannes Berg 					  NL80211_ATTR_VENDOR_DATA, approxlen);
7624ad7e718cSJohannes Berg }
7625ad7e718cSJohannes Berg 
7626ad7e718cSJohannes Berg /**
7627ad7e718cSJohannes Berg  * cfg80211_vendor_cmd_reply - send the reply skb
7628ad7e718cSJohannes Berg  * @skb: The skb, must have been allocated with
7629ad7e718cSJohannes Berg  *	cfg80211_vendor_cmd_alloc_reply_skb()
7630ad7e718cSJohannes Berg  *
7631ad7e718cSJohannes Berg  * Since calling this function will usually be the last thing
7632ad7e718cSJohannes Berg  * before returning from the vendor command doit() you should
7633ad7e718cSJohannes Berg  * return the error code.  Note that this function consumes the
7634ad7e718cSJohannes Berg  * skb regardless of the return value.
7635ad7e718cSJohannes Berg  *
7636ad7e718cSJohannes Berg  * Return: An error code or 0 on success.
7637ad7e718cSJohannes Berg  */
7638ad7e718cSJohannes Berg int cfg80211_vendor_cmd_reply(struct sk_buff *skb);
7639ad7e718cSJohannes Berg 
7640567ffc35SJohannes Berg /**
76415d9c358dSRandy Dunlap  * cfg80211_vendor_cmd_get_sender - get the current sender netlink ID
764255c1fdf0SJohannes Berg  * @wiphy: the wiphy
764355c1fdf0SJohannes Berg  *
764455c1fdf0SJohannes Berg  * Return the current netlink port ID in a vendor command handler.
764555c1fdf0SJohannes Berg  * Valid to call only there.
764655c1fdf0SJohannes Berg  */
764755c1fdf0SJohannes Berg unsigned int cfg80211_vendor_cmd_get_sender(struct wiphy *wiphy);
764855c1fdf0SJohannes Berg 
764955c1fdf0SJohannes Berg /**
7650567ffc35SJohannes Berg  * cfg80211_vendor_event_alloc - allocate vendor-specific event skb
7651567ffc35SJohannes Berg  * @wiphy: the wiphy
76526c09e791SAhmad Kholaif  * @wdev: the wireless device
7653567ffc35SJohannes Berg  * @event_idx: index of the vendor event in the wiphy's vendor_events
7654567ffc35SJohannes Berg  * @approxlen: an upper bound of the length of the data that will
7655567ffc35SJohannes Berg  *	be put into the skb
7656567ffc35SJohannes Berg  * @gfp: allocation flags
7657567ffc35SJohannes Berg  *
7658567ffc35SJohannes Berg  * This function allocates and pre-fills an skb for an event on the
7659567ffc35SJohannes Berg  * vendor-specific multicast group.
7660567ffc35SJohannes Berg  *
76616c09e791SAhmad Kholaif  * If wdev != NULL, both the ifindex and identifier of the specified
76626c09e791SAhmad Kholaif  * wireless device are added to the event message before the vendor data
76636c09e791SAhmad Kholaif  * attribute.
76646c09e791SAhmad Kholaif  *
7665567ffc35SJohannes Berg  * When done filling the skb, call cfg80211_vendor_event() with the
7666567ffc35SJohannes Berg  * skb to send the event.
7667567ffc35SJohannes Berg  *
7668567ffc35SJohannes Berg  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
7669567ffc35SJohannes Berg  */
7670567ffc35SJohannes Berg static inline struct sk_buff *
76716c09e791SAhmad Kholaif cfg80211_vendor_event_alloc(struct wiphy *wiphy, struct wireless_dev *wdev,
76726c09e791SAhmad Kholaif 			     int approxlen, int event_idx, gfp_t gfp)
7673567ffc35SJohannes Berg {
76746c09e791SAhmad Kholaif 	return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR,
7675567ffc35SJohannes Berg 					  NL80211_ATTR_VENDOR_DATA,
767655c1fdf0SJohannes Berg 					  0, event_idx, approxlen, gfp);
767755c1fdf0SJohannes Berg }
767855c1fdf0SJohannes Berg 
767955c1fdf0SJohannes Berg /**
768055c1fdf0SJohannes Berg  * cfg80211_vendor_event_alloc_ucast - alloc unicast vendor-specific event skb
768155c1fdf0SJohannes Berg  * @wiphy: the wiphy
768255c1fdf0SJohannes Berg  * @wdev: the wireless device
768355c1fdf0SJohannes Berg  * @event_idx: index of the vendor event in the wiphy's vendor_events
768455c1fdf0SJohannes Berg  * @portid: port ID of the receiver
768555c1fdf0SJohannes Berg  * @approxlen: an upper bound of the length of the data that will
768655c1fdf0SJohannes Berg  *	be put into the skb
768755c1fdf0SJohannes Berg  * @gfp: allocation flags
768855c1fdf0SJohannes Berg  *
768955c1fdf0SJohannes Berg  * This function allocates and pre-fills an skb for an event to send to
769055c1fdf0SJohannes Berg  * a specific (userland) socket. This socket would previously have been
769155c1fdf0SJohannes Berg  * obtained by cfg80211_vendor_cmd_get_sender(), and the caller MUST take
769255c1fdf0SJohannes Berg  * care to register a netlink notifier to see when the socket closes.
769355c1fdf0SJohannes Berg  *
769455c1fdf0SJohannes Berg  * If wdev != NULL, both the ifindex and identifier of the specified
769555c1fdf0SJohannes Berg  * wireless device are added to the event message before the vendor data
769655c1fdf0SJohannes Berg  * attribute.
769755c1fdf0SJohannes Berg  *
769855c1fdf0SJohannes Berg  * When done filling the skb, call cfg80211_vendor_event() with the
769955c1fdf0SJohannes Berg  * skb to send the event.
770055c1fdf0SJohannes Berg  *
770155c1fdf0SJohannes Berg  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
770255c1fdf0SJohannes Berg  */
770355c1fdf0SJohannes Berg static inline struct sk_buff *
770455c1fdf0SJohannes Berg cfg80211_vendor_event_alloc_ucast(struct wiphy *wiphy,
770555c1fdf0SJohannes Berg 				  struct wireless_dev *wdev,
770655c1fdf0SJohannes Berg 				  unsigned int portid, int approxlen,
770755c1fdf0SJohannes Berg 				  int event_idx, gfp_t gfp)
770855c1fdf0SJohannes Berg {
770955c1fdf0SJohannes Berg 	return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR,
771055c1fdf0SJohannes Berg 					  NL80211_ATTR_VENDOR_DATA,
771155c1fdf0SJohannes Berg 					  portid, event_idx, approxlen, gfp);
7712567ffc35SJohannes Berg }
7713567ffc35SJohannes Berg 
7714567ffc35SJohannes Berg /**
7715567ffc35SJohannes Berg  * cfg80211_vendor_event - send the event
7716567ffc35SJohannes Berg  * @skb: The skb, must have been allocated with cfg80211_vendor_event_alloc()
7717567ffc35SJohannes Berg  * @gfp: allocation flags
7718567ffc35SJohannes Berg  *
7719567ffc35SJohannes Berg  * This function sends the given @skb, which must have been allocated
7720567ffc35SJohannes Berg  * by cfg80211_vendor_event_alloc(), as an event. It always consumes it.
7721567ffc35SJohannes Berg  */
7722567ffc35SJohannes Berg static inline void cfg80211_vendor_event(struct sk_buff *skb, gfp_t gfp)
7723567ffc35SJohannes Berg {
7724567ffc35SJohannes Berg 	__cfg80211_send_event_skb(skb, gfp);
7725567ffc35SJohannes Berg }
7726567ffc35SJohannes Berg 
7727aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE
7728aff89a9bSJohannes Berg /**
7729d70e9693SJohannes Berg  * DOC: Test mode
7730d70e9693SJohannes Berg  *
7731d70e9693SJohannes Berg  * Test mode is a set of utility functions to allow drivers to
7732d70e9693SJohannes Berg  * interact with driver-specific tools to aid, for instance,
7733d70e9693SJohannes Berg  * factory programming.
7734d70e9693SJohannes Berg  *
773505b23456SRandy Dunlap  * This chapter describes how drivers interact with it. For more
7736d70e9693SJohannes Berg  * information see the nl80211 book's chapter on it.
7737d70e9693SJohannes Berg  */
7738d70e9693SJohannes Berg 
7739d70e9693SJohannes Berg /**
7740aff89a9bSJohannes Berg  * cfg80211_testmode_alloc_reply_skb - allocate testmode reply
7741aff89a9bSJohannes Berg  * @wiphy: the wiphy
7742aff89a9bSJohannes Berg  * @approxlen: an upper bound of the length of the data that will
7743aff89a9bSJohannes Berg  *	be put into the skb
7744aff89a9bSJohannes Berg  *
7745aff89a9bSJohannes Berg  * This function allocates and pre-fills an skb for a reply to
7746aff89a9bSJohannes Berg  * the testmode command. Since it is intended for a reply, calling
7747aff89a9bSJohannes Berg  * it outside of the @testmode_cmd operation is invalid.
7748aff89a9bSJohannes Berg  *
77490ae997dcSYacine Belkadi  * The returned skb is pre-filled with the wiphy index and set up in
77500ae997dcSYacine Belkadi  * a way that any data that is put into the skb (with skb_put(),
77510ae997dcSYacine Belkadi  * nla_put() or similar) will end up being within the
77520ae997dcSYacine Belkadi  * %NL80211_ATTR_TESTDATA attribute, so all that needs to be done
77530ae997dcSYacine Belkadi  * with the skb is adding data for the corresponding userspace tool
77540ae997dcSYacine Belkadi  * which can then read that data out of the testdata attribute. You
77550ae997dcSYacine Belkadi  * must not modify the skb in any other way.
7756aff89a9bSJohannes Berg  *
7757aff89a9bSJohannes Berg  * When done, call cfg80211_testmode_reply() with the skb and return
7758aff89a9bSJohannes Berg  * its error code as the result of the @testmode_cmd operation.
77590ae997dcSYacine Belkadi  *
77600ae997dcSYacine Belkadi  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
7761aff89a9bSJohannes Berg  */
7762ad7e718cSJohannes Berg static inline struct sk_buff *
7763ad7e718cSJohannes Berg cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy, int approxlen)
7764ad7e718cSJohannes Berg {
7765ad7e718cSJohannes Berg 	return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_TESTMODE,
7766ad7e718cSJohannes Berg 					  NL80211_ATTR_TESTDATA, approxlen);
7767ad7e718cSJohannes Berg }
7768aff89a9bSJohannes Berg 
7769aff89a9bSJohannes Berg /**
7770aff89a9bSJohannes Berg  * cfg80211_testmode_reply - send the reply skb
7771aff89a9bSJohannes Berg  * @skb: The skb, must have been allocated with
7772aff89a9bSJohannes Berg  *	cfg80211_testmode_alloc_reply_skb()
7773aff89a9bSJohannes Berg  *
77740ae997dcSYacine Belkadi  * Since calling this function will usually be the last thing
77750ae997dcSYacine Belkadi  * before returning from the @testmode_cmd you should return
77760ae997dcSYacine Belkadi  * the error code.  Note that this function consumes the skb
77770ae997dcSYacine Belkadi  * regardless of the return value.
77780ae997dcSYacine Belkadi  *
77790ae997dcSYacine Belkadi  * Return: An error code or 0 on success.
7780aff89a9bSJohannes Berg  */
7781ad7e718cSJohannes Berg static inline int cfg80211_testmode_reply(struct sk_buff *skb)
7782ad7e718cSJohannes Berg {
7783ad7e718cSJohannes Berg 	return cfg80211_vendor_cmd_reply(skb);
7784ad7e718cSJohannes Berg }
7785aff89a9bSJohannes Berg 
7786aff89a9bSJohannes Berg /**
7787aff89a9bSJohannes Berg  * cfg80211_testmode_alloc_event_skb - allocate testmode event
7788aff89a9bSJohannes Berg  * @wiphy: the wiphy
7789aff89a9bSJohannes Berg  * @approxlen: an upper bound of the length of the data that will
7790aff89a9bSJohannes Berg  *	be put into the skb
7791aff89a9bSJohannes Berg  * @gfp: allocation flags
7792aff89a9bSJohannes Berg  *
7793aff89a9bSJohannes Berg  * This function allocates and pre-fills an skb for an event on the
7794aff89a9bSJohannes Berg  * testmode multicast group.
7795aff89a9bSJohannes Berg  *
77960ae997dcSYacine Belkadi  * The returned skb is set up in the same way as with
77970ae997dcSYacine Belkadi  * cfg80211_testmode_alloc_reply_skb() but prepared for an event. As
77980ae997dcSYacine Belkadi  * there, you should simply add data to it that will then end up in the
77990ae997dcSYacine Belkadi  * %NL80211_ATTR_TESTDATA attribute. Again, you must not modify the skb
78000ae997dcSYacine Belkadi  * in any other way.
7801aff89a9bSJohannes Berg  *
7802aff89a9bSJohannes Berg  * When done filling the skb, call cfg80211_testmode_event() with the
7803aff89a9bSJohannes Berg  * skb to send the event.
78040ae997dcSYacine Belkadi  *
78050ae997dcSYacine Belkadi  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
7806aff89a9bSJohannes Berg  */
7807567ffc35SJohannes Berg static inline struct sk_buff *
7808567ffc35SJohannes Berg cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy, int approxlen, gfp_t gfp)
7809567ffc35SJohannes Berg {
78106c09e791SAhmad Kholaif 	return __cfg80211_alloc_event_skb(wiphy, NULL, NL80211_CMD_TESTMODE,
781155c1fdf0SJohannes Berg 					  NL80211_ATTR_TESTDATA, 0, -1,
7812567ffc35SJohannes Berg 					  approxlen, gfp);
7813567ffc35SJohannes Berg }
7814aff89a9bSJohannes Berg 
7815aff89a9bSJohannes Berg /**
7816aff89a9bSJohannes Berg  * cfg80211_testmode_event - send the event
7817aff89a9bSJohannes Berg  * @skb: The skb, must have been allocated with
7818aff89a9bSJohannes Berg  *	cfg80211_testmode_alloc_event_skb()
7819aff89a9bSJohannes Berg  * @gfp: allocation flags
7820aff89a9bSJohannes Berg  *
7821aff89a9bSJohannes Berg  * This function sends the given @skb, which must have been allocated
7822aff89a9bSJohannes Berg  * by cfg80211_testmode_alloc_event_skb(), as an event. It always
7823aff89a9bSJohannes Berg  * consumes it.
7824aff89a9bSJohannes Berg  */
7825567ffc35SJohannes Berg static inline void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp)
7826567ffc35SJohannes Berg {
7827567ffc35SJohannes Berg 	__cfg80211_send_event_skb(skb, gfp);
7828567ffc35SJohannes Berg }
7829aff89a9bSJohannes Berg 
7830aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd)	.testmode_cmd = (cmd),
783171063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd)	.testmode_dump = (cmd),
7832aff89a9bSJohannes Berg #else
7833aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd)
783471063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd)
7835aff89a9bSJohannes Berg #endif
7836aff89a9bSJohannes Berg 
7837b23aa676SSamuel Ortiz /**
783876804d28SArend Van Spriel  * struct cfg80211_fils_resp_params - FILS connection response params
783976804d28SArend Van Spriel  * @kek: KEK derived from a successful FILS connection (may be %NULL)
784076804d28SArend Van Spriel  * @kek_len: Length of @fils_kek in octets
784176804d28SArend Van Spriel  * @update_erp_next_seq_num: Boolean value to specify whether the value in
784276804d28SArend Van Spriel  *	@erp_next_seq_num is valid.
784376804d28SArend Van Spriel  * @erp_next_seq_num: The next sequence number to use in ERP message in
784476804d28SArend Van Spriel  *	FILS Authentication. This value should be specified irrespective of the
784576804d28SArend Van Spriel  *	status for a FILS connection.
784676804d28SArend Van Spriel  * @pmk: A new PMK if derived from a successful FILS connection (may be %NULL).
784776804d28SArend Van Spriel  * @pmk_len: Length of @pmk in octets
784876804d28SArend Van Spriel  * @pmkid: A new PMKID if derived from a successful FILS connection or the PMKID
784976804d28SArend Van Spriel  *	used for this FILS connection (may be %NULL).
785076804d28SArend Van Spriel  */
785176804d28SArend Van Spriel struct cfg80211_fils_resp_params {
785276804d28SArend Van Spriel 	const u8 *kek;
785376804d28SArend Van Spriel 	size_t kek_len;
785476804d28SArend Van Spriel 	bool update_erp_next_seq_num;
785576804d28SArend Van Spriel 	u16 erp_next_seq_num;
785676804d28SArend Van Spriel 	const u8 *pmk;
785776804d28SArend Van Spriel 	size_t pmk_len;
785876804d28SArend Van Spriel 	const u8 *pmkid;
785976804d28SArend Van Spriel };
786076804d28SArend Van Spriel 
786176804d28SArend Van Spriel /**
78625349a0f7SVidyullatha Kanchanapally  * struct cfg80211_connect_resp_params - Connection response params
78635349a0f7SVidyullatha Kanchanapally  * @status: Status code, %WLAN_STATUS_SUCCESS for successful connection, use
78645349a0f7SVidyullatha Kanchanapally  *	%WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
78655349a0f7SVidyullatha Kanchanapally  *	the real status code for failures. If this call is used to report a
78665349a0f7SVidyullatha Kanchanapally  *	failure due to a timeout (e.g., not receiving an Authentication frame
78675349a0f7SVidyullatha Kanchanapally  *	from the AP) instead of an explicit rejection by the AP, -1 is used to
78685349a0f7SVidyullatha Kanchanapally  *	indicate that this is a failure, but without a status code.
78695349a0f7SVidyullatha Kanchanapally  *	@timeout_reason is used to report the reason for the timeout in that
78705349a0f7SVidyullatha Kanchanapally  *	case.
78715349a0f7SVidyullatha Kanchanapally  * @req_ie: Association request IEs (may be %NULL)
78725349a0f7SVidyullatha Kanchanapally  * @req_ie_len: Association request IEs length
78735349a0f7SVidyullatha Kanchanapally  * @resp_ie: Association response IEs (may be %NULL)
78745349a0f7SVidyullatha Kanchanapally  * @resp_ie_len: Association response IEs length
787576804d28SArend Van Spriel  * @fils: FILS connection response parameters.
78765349a0f7SVidyullatha Kanchanapally  * @timeout_reason: Reason for connection timeout. This is used when the
78775349a0f7SVidyullatha Kanchanapally  *	connection fails due to a timeout instead of an explicit rejection from
78785349a0f7SVidyullatha Kanchanapally  *	the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is
78795349a0f7SVidyullatha Kanchanapally  *	not known. This value is used only if @status < 0 to indicate that the
78805349a0f7SVidyullatha Kanchanapally  *	failure is due to a timeout and not due to explicit rejection by the AP.
78815349a0f7SVidyullatha Kanchanapally  *	This value is ignored in other cases (@status >= 0).
7882efbabc11SVeerendranath Jakkam  * @valid_links: For MLO connection, BIT mask of the valid link ids. Otherwise
7883efbabc11SVeerendranath Jakkam  *	zero.
7884efbabc11SVeerendranath Jakkam  * @ap_mld_addr: For MLO connection, MLD address of the AP. Otherwise %NULL.
7885efbabc11SVeerendranath Jakkam  * @links : For MLO connection, contains link info for the valid links indicated
7886efbabc11SVeerendranath Jakkam  *	using @valid_links. For non-MLO connection, links[0] contains the
7887efbabc11SVeerendranath Jakkam  *	connected AP info.
7888efbabc11SVeerendranath Jakkam  * @links.addr: For MLO connection, MAC address of the STA link. Otherwise
7889efbabc11SVeerendranath Jakkam  *	%NULL.
7890efbabc11SVeerendranath Jakkam  * @links.bssid: For MLO connection, MAC address of the AP link. For non-MLO
7891efbabc11SVeerendranath Jakkam  *	connection, links[0].bssid points to the BSSID of the AP (may be %NULL).
7892efbabc11SVeerendranath Jakkam  * @links.bss: For MLO connection, entry of bss to which STA link is connected.
7893efbabc11SVeerendranath Jakkam  *	For non-MLO connection, links[0].bss points to entry of bss to which STA
7894efbabc11SVeerendranath Jakkam  *	is connected. It can be obtained through cfg80211_get_bss() (may be
7895efbabc11SVeerendranath Jakkam  *	%NULL). It is recommended to store the bss from the connect_request and
7896efbabc11SVeerendranath Jakkam  *	hold a reference to it and return through this param to avoid a warning
7897efbabc11SVeerendranath Jakkam  *	if the bss is expired during the connection, esp. for those drivers
7898efbabc11SVeerendranath Jakkam  *	implementing connect op. Only one parameter among @bssid and @bss needs
7899efbabc11SVeerendranath Jakkam  *	to be specified.
790053ad07e9SJohannes Berg  * @links.status: per-link status code, to report a status code that's not
790153ad07e9SJohannes Berg  *	%WLAN_STATUS_SUCCESS for a given link, it must also be in the
790253ad07e9SJohannes Berg  *	@valid_links bitmap and may have a BSS pointer (which is then released)
79035349a0f7SVidyullatha Kanchanapally  */
79045349a0f7SVidyullatha Kanchanapally struct cfg80211_connect_resp_params {
79055349a0f7SVidyullatha Kanchanapally 	int status;
79065349a0f7SVidyullatha Kanchanapally 	const u8 *req_ie;
79075349a0f7SVidyullatha Kanchanapally 	size_t req_ie_len;
79085349a0f7SVidyullatha Kanchanapally 	const u8 *resp_ie;
79095349a0f7SVidyullatha Kanchanapally 	size_t resp_ie_len;
791076804d28SArend Van Spriel 	struct cfg80211_fils_resp_params fils;
79115349a0f7SVidyullatha Kanchanapally 	enum nl80211_timeout_reason timeout_reason;
7912efbabc11SVeerendranath Jakkam 
7913efbabc11SVeerendranath Jakkam 	const u8 *ap_mld_addr;
7914efbabc11SVeerendranath Jakkam 	u16 valid_links;
7915efbabc11SVeerendranath Jakkam 	struct {
7916efbabc11SVeerendranath Jakkam 		const u8 *addr;
7917efbabc11SVeerendranath Jakkam 		const u8 *bssid;
7918efbabc11SVeerendranath Jakkam 		struct cfg80211_bss *bss;
791953ad07e9SJohannes Berg 		u16 status;
7920efbabc11SVeerendranath Jakkam 	} links[IEEE80211_MLD_MAX_NUM_LINKS];
79215349a0f7SVidyullatha Kanchanapally };
79225349a0f7SVidyullatha Kanchanapally 
79235349a0f7SVidyullatha Kanchanapally /**
79245349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_done - notify cfg80211 of connection result
79255349a0f7SVidyullatha Kanchanapally  *
79265349a0f7SVidyullatha Kanchanapally  * @dev: network device
79275349a0f7SVidyullatha Kanchanapally  * @params: connection response parameters
79285349a0f7SVidyullatha Kanchanapally  * @gfp: allocation flags
79295349a0f7SVidyullatha Kanchanapally  *
79305349a0f7SVidyullatha Kanchanapally  * It should be called by the underlying driver once execution of the connection
79315349a0f7SVidyullatha Kanchanapally  * request from connect() has been completed. This is similar to
79325349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_bss(), but takes a structure pointer for connection response
79335349a0f7SVidyullatha Kanchanapally  * parameters. Only one of the functions among cfg80211_connect_bss(),
79345349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_result(), cfg80211_connect_timeout(),
79355349a0f7SVidyullatha Kanchanapally  * and cfg80211_connect_done() should be called.
79365349a0f7SVidyullatha Kanchanapally  */
79375349a0f7SVidyullatha Kanchanapally void cfg80211_connect_done(struct net_device *dev,
79385349a0f7SVidyullatha Kanchanapally 			   struct cfg80211_connect_resp_params *params,
79395349a0f7SVidyullatha Kanchanapally 			   gfp_t gfp);
79405349a0f7SVidyullatha Kanchanapally 
79415349a0f7SVidyullatha Kanchanapally /**
7942e7054989SKanchanapally, Vidyullatha  * cfg80211_connect_bss - notify cfg80211 of connection result
7943e7054989SKanchanapally, Vidyullatha  *
7944e7054989SKanchanapally, Vidyullatha  * @dev: network device
7945e7054989SKanchanapally, Vidyullatha  * @bssid: the BSSID of the AP
7946a3ce17d1SChaitanya Tata  * @bss: Entry of bss to which STA got connected to, can be obtained through
7947a3ce17d1SChaitanya Tata  *	cfg80211_get_bss() (may be %NULL). But it is recommended to store the
7948a3ce17d1SChaitanya Tata  *	bss from the connect_request and hold a reference to it and return
7949a3ce17d1SChaitanya Tata  *	through this param to avoid a warning if the bss is expired during the
7950a3ce17d1SChaitanya Tata  *	connection, esp. for those drivers implementing connect op.
7951a3ce17d1SChaitanya Tata  *	Only one parameter among @bssid and @bss needs to be specified.
7952e7054989SKanchanapally, Vidyullatha  * @req_ie: association request IEs (maybe be %NULL)
7953e7054989SKanchanapally, Vidyullatha  * @req_ie_len: association request IEs length
7954e7054989SKanchanapally, Vidyullatha  * @resp_ie: association response IEs (may be %NULL)
7955e7054989SKanchanapally, Vidyullatha  * @resp_ie_len: assoc response IEs length
7956c88215d7SJouni Malinen  * @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use
7957e7054989SKanchanapally, Vidyullatha  *	%WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
7958c88215d7SJouni Malinen  *	the real status code for failures. If this call is used to report a
7959c88215d7SJouni Malinen  *	failure due to a timeout (e.g., not receiving an Authentication frame
7960c88215d7SJouni Malinen  *	from the AP) instead of an explicit rejection by the AP, -1 is used to
7961c88215d7SJouni Malinen  *	indicate that this is a failure, but without a status code.
7962c88215d7SJouni Malinen  *	@timeout_reason is used to report the reason for the timeout in that
7963c88215d7SJouni Malinen  *	case.
7964e7054989SKanchanapally, Vidyullatha  * @gfp: allocation flags
79653093ebbeSPurushottam Kushwaha  * @timeout_reason: reason for connection timeout. This is used when the
79663093ebbeSPurushottam Kushwaha  *	connection fails due to a timeout instead of an explicit rejection from
79673093ebbeSPurushottam Kushwaha  *	the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is
79683093ebbeSPurushottam Kushwaha  *	not known. This value is used only if @status < 0 to indicate that the
79693093ebbeSPurushottam Kushwaha  *	failure is due to a timeout and not due to explicit rejection by the AP.
79703093ebbeSPurushottam Kushwaha  *	This value is ignored in other cases (@status >= 0).
7971e7054989SKanchanapally, Vidyullatha  *
7972c88215d7SJouni Malinen  * It should be called by the underlying driver once execution of the connection
7973c88215d7SJouni Malinen  * request from connect() has been completed. This is similar to
7974c88215d7SJouni Malinen  * cfg80211_connect_result(), but with the option of identifying the exact bss
79755349a0f7SVidyullatha Kanchanapally  * entry for the connection. Only one of the functions among
79765349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_bss(), cfg80211_connect_result(),
79775349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
7978e7054989SKanchanapally, Vidyullatha  */
79795349a0f7SVidyullatha Kanchanapally static inline void
79805349a0f7SVidyullatha Kanchanapally cfg80211_connect_bss(struct net_device *dev, const u8 *bssid,
7981e7054989SKanchanapally, Vidyullatha 		     struct cfg80211_bss *bss, const u8 *req_ie,
7982e7054989SKanchanapally, Vidyullatha 		     size_t req_ie_len, const u8 *resp_ie,
79833093ebbeSPurushottam Kushwaha 		     size_t resp_ie_len, int status, gfp_t gfp,
79845349a0f7SVidyullatha Kanchanapally 		     enum nl80211_timeout_reason timeout_reason)
79855349a0f7SVidyullatha Kanchanapally {
79865349a0f7SVidyullatha Kanchanapally 	struct cfg80211_connect_resp_params params;
79875349a0f7SVidyullatha Kanchanapally 
79885349a0f7SVidyullatha Kanchanapally 	memset(&params, 0, sizeof(params));
79895349a0f7SVidyullatha Kanchanapally 	params.status = status;
7990efbabc11SVeerendranath Jakkam 	params.links[0].bssid = bssid;
7991efbabc11SVeerendranath Jakkam 	params.links[0].bss = bss;
79925349a0f7SVidyullatha Kanchanapally 	params.req_ie = req_ie;
79935349a0f7SVidyullatha Kanchanapally 	params.req_ie_len = req_ie_len;
79945349a0f7SVidyullatha Kanchanapally 	params.resp_ie = resp_ie;
79955349a0f7SVidyullatha Kanchanapally 	params.resp_ie_len = resp_ie_len;
79965349a0f7SVidyullatha Kanchanapally 	params.timeout_reason = timeout_reason;
79975349a0f7SVidyullatha Kanchanapally 
79985349a0f7SVidyullatha Kanchanapally 	cfg80211_connect_done(dev, &params, gfp);
79995349a0f7SVidyullatha Kanchanapally }
8000e7054989SKanchanapally, Vidyullatha 
8001e7054989SKanchanapally, Vidyullatha /**
8002b23aa676SSamuel Ortiz  * cfg80211_connect_result - notify cfg80211 of connection result
8003b23aa676SSamuel Ortiz  *
8004b23aa676SSamuel Ortiz  * @dev: network device
8005b23aa676SSamuel Ortiz  * @bssid: the BSSID of the AP
8006b23aa676SSamuel Ortiz  * @req_ie: association request IEs (maybe be %NULL)
8007b23aa676SSamuel Ortiz  * @req_ie_len: association request IEs length
8008b23aa676SSamuel Ortiz  * @resp_ie: association response IEs (may be %NULL)
8009b23aa676SSamuel Ortiz  * @resp_ie_len: assoc response IEs length
8010c88215d7SJouni Malinen  * @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use
8011b23aa676SSamuel Ortiz  *	%WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
8012b23aa676SSamuel Ortiz  *	the real status code for failures.
8013b23aa676SSamuel Ortiz  * @gfp: allocation flags
8014b23aa676SSamuel Ortiz  *
8015c88215d7SJouni Malinen  * It should be called by the underlying driver once execution of the connection
8016c88215d7SJouni Malinen  * request from connect() has been completed. This is similar to
8017c88215d7SJouni Malinen  * cfg80211_connect_bss() which allows the exact bss entry to be specified. Only
80185349a0f7SVidyullatha Kanchanapally  * one of the functions among cfg80211_connect_bss(), cfg80211_connect_result(),
80195349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
8020b23aa676SSamuel Ortiz  */
8021e7054989SKanchanapally, Vidyullatha static inline void
8022e7054989SKanchanapally, Vidyullatha cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
8023b23aa676SSamuel Ortiz 			const u8 *req_ie, size_t req_ie_len,
8024b23aa676SSamuel Ortiz 			const u8 *resp_ie, size_t resp_ie_len,
8025e7054989SKanchanapally, Vidyullatha 			u16 status, gfp_t gfp)
8026e7054989SKanchanapally, Vidyullatha {
8027e7054989SKanchanapally, Vidyullatha 	cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, resp_ie,
80283093ebbeSPurushottam Kushwaha 			     resp_ie_len, status, gfp,
80293093ebbeSPurushottam Kushwaha 			     NL80211_TIMEOUT_UNSPECIFIED);
8030e7054989SKanchanapally, Vidyullatha }
8031b23aa676SSamuel Ortiz 
8032b23aa676SSamuel Ortiz /**
8033bf1ecd21SJouni Malinen  * cfg80211_connect_timeout - notify cfg80211 of connection timeout
8034bf1ecd21SJouni Malinen  *
8035bf1ecd21SJouni Malinen  * @dev: network device
8036bf1ecd21SJouni Malinen  * @bssid: the BSSID of the AP
8037bf1ecd21SJouni Malinen  * @req_ie: association request IEs (maybe be %NULL)
8038bf1ecd21SJouni Malinen  * @req_ie_len: association request IEs length
8039bf1ecd21SJouni Malinen  * @gfp: allocation flags
80403093ebbeSPurushottam Kushwaha  * @timeout_reason: reason for connection timeout.
8041bf1ecd21SJouni Malinen  *
8042bf1ecd21SJouni Malinen  * It should be called by the underlying driver whenever connect() has failed
8043bf1ecd21SJouni Malinen  * in a sequence where no explicit authentication/association rejection was
8044bf1ecd21SJouni Malinen  * received from the AP. This could happen, e.g., due to not being able to send
8045bf1ecd21SJouni Malinen  * out the Authentication or Association Request frame or timing out while
80465349a0f7SVidyullatha Kanchanapally  * waiting for the response. Only one of the functions among
80475349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_bss(), cfg80211_connect_result(),
80485349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
8049bf1ecd21SJouni Malinen  */
8050bf1ecd21SJouni Malinen static inline void
8051bf1ecd21SJouni Malinen cfg80211_connect_timeout(struct net_device *dev, const u8 *bssid,
80523093ebbeSPurushottam Kushwaha 			 const u8 *req_ie, size_t req_ie_len, gfp_t gfp,
80533093ebbeSPurushottam Kushwaha 			 enum nl80211_timeout_reason timeout_reason)
8054bf1ecd21SJouni Malinen {
8055bf1ecd21SJouni Malinen 	cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, NULL, 0, -1,
80563093ebbeSPurushottam Kushwaha 			     gfp, timeout_reason);
8057bf1ecd21SJouni Malinen }
8058bf1ecd21SJouni Malinen 
8059bf1ecd21SJouni Malinen /**
806029ce6ecbSAvraham Stern  * struct cfg80211_roam_info - driver initiated roaming information
806129ce6ecbSAvraham Stern  *
806229ce6ecbSAvraham Stern  * @req_ie: association request IEs (maybe be %NULL)
806329ce6ecbSAvraham Stern  * @req_ie_len: association request IEs length
806429ce6ecbSAvraham Stern  * @resp_ie: association response IEs (may be %NULL)
806529ce6ecbSAvraham Stern  * @resp_ie_len: assoc response IEs length
8066e841b7b1SArend Van Spriel  * @fils: FILS related roaming information.
8067efbabc11SVeerendranath Jakkam  * @valid_links: For MLO roaming, BIT mask of the new valid links is set.
8068efbabc11SVeerendranath Jakkam  *	Otherwise zero.
8069efbabc11SVeerendranath Jakkam  * @ap_mld_addr: For MLO roaming, MLD address of the new AP. Otherwise %NULL.
8070efbabc11SVeerendranath Jakkam  * @links : For MLO roaming, contains new link info for the valid links set in
8071efbabc11SVeerendranath Jakkam  *	@valid_links. For non-MLO roaming, links[0] contains the new AP info.
8072efbabc11SVeerendranath Jakkam  * @links.addr: For MLO roaming, MAC address of the STA link. Otherwise %NULL.
8073efbabc11SVeerendranath Jakkam  * @links.bssid: For MLO roaming, MAC address of the new AP link. For non-MLO
8074efbabc11SVeerendranath Jakkam  *	roaming, links[0].bssid points to the BSSID of the new AP. May be
8075efbabc11SVeerendranath Jakkam  *	%NULL if %links.bss is set.
8076efbabc11SVeerendranath Jakkam  * @links.channel: the channel of the new AP.
8077efbabc11SVeerendranath Jakkam  * @links.bss: For MLO roaming, entry of new bss to which STA link got
8078efbabc11SVeerendranath Jakkam  *	roamed. For non-MLO roaming, links[0].bss points to entry of bss to
8079efbabc11SVeerendranath Jakkam  *	which STA got roamed (may be %NULL if %links.bssid is set)
808029ce6ecbSAvraham Stern  */
808129ce6ecbSAvraham Stern struct cfg80211_roam_info {
808229ce6ecbSAvraham Stern 	const u8 *req_ie;
808329ce6ecbSAvraham Stern 	size_t req_ie_len;
808429ce6ecbSAvraham Stern 	const u8 *resp_ie;
808529ce6ecbSAvraham Stern 	size_t resp_ie_len;
8086e841b7b1SArend Van Spriel 	struct cfg80211_fils_resp_params fils;
8087efbabc11SVeerendranath Jakkam 
8088efbabc11SVeerendranath Jakkam 	const u8 *ap_mld_addr;
8089efbabc11SVeerendranath Jakkam 	u16 valid_links;
8090efbabc11SVeerendranath Jakkam 	struct {
8091efbabc11SVeerendranath Jakkam 		const u8 *addr;
8092efbabc11SVeerendranath Jakkam 		const u8 *bssid;
8093efbabc11SVeerendranath Jakkam 		struct ieee80211_channel *channel;
8094efbabc11SVeerendranath Jakkam 		struct cfg80211_bss *bss;
8095efbabc11SVeerendranath Jakkam 	} links[IEEE80211_MLD_MAX_NUM_LINKS];
809629ce6ecbSAvraham Stern };
809729ce6ecbSAvraham Stern 
809829ce6ecbSAvraham Stern /**
8099b23aa676SSamuel Ortiz  * cfg80211_roamed - notify cfg80211 of roaming
8100b23aa676SSamuel Ortiz  *
8101b23aa676SSamuel Ortiz  * @dev: network device
810229ce6ecbSAvraham Stern  * @info: information about the new BSS. struct &cfg80211_roam_info.
8103b23aa676SSamuel Ortiz  * @gfp: allocation flags
8104b23aa676SSamuel Ortiz  *
810529ce6ecbSAvraham Stern  * This function may be called with the driver passing either the BSSID of the
810629ce6ecbSAvraham Stern  * new AP or passing the bss entry to avoid a race in timeout of the bss entry.
810729ce6ecbSAvraham Stern  * It should be called by the underlying driver whenever it roamed from one AP
810829ce6ecbSAvraham Stern  * to another while connected. Drivers which have roaming implemented in
810929ce6ecbSAvraham Stern  * firmware should pass the bss entry to avoid a race in bss entry timeout where
811029ce6ecbSAvraham Stern  * the bss entry of the new AP is seen in the driver, but gets timed out by the
811129ce6ecbSAvraham Stern  * time it is accessed in __cfg80211_roamed() due to delay in scheduling
8112adbde344SVasanthakumar Thiagarajan  * rdev->event_work. In case of any failures, the reference is released
811329ce6ecbSAvraham Stern  * either in cfg80211_roamed() or in __cfg80211_romed(), Otherwise, it will be
8114e1b18549SGeert Uytterhoeven  * released while disconnecting from the current bss.
8115adbde344SVasanthakumar Thiagarajan  */
811629ce6ecbSAvraham Stern void cfg80211_roamed(struct net_device *dev, struct cfg80211_roam_info *info,
811729ce6ecbSAvraham Stern 		     gfp_t gfp);
8118adbde344SVasanthakumar Thiagarajan 
8119adbde344SVasanthakumar Thiagarajan /**
8120503c1fb9SAvraham Stern  * cfg80211_port_authorized - notify cfg80211 of successful security association
8121503c1fb9SAvraham Stern  *
8122503c1fb9SAvraham Stern  * @dev: network device
8123e4e7e3afSVinayak Yadawad  * @peer_addr: BSSID of the AP/P2P GO in case of STA/GC or STA/GC MAC address
8124e4e7e3afSVinayak Yadawad  *	in case of AP/P2P GO
81250ff57171SVinayak Yadawad  * @td_bitmap: transition disable policy
81260ff57171SVinayak Yadawad  * @td_bitmap_len: Length of transition disable policy
8127503c1fb9SAvraham Stern  * @gfp: allocation flags
8128503c1fb9SAvraham Stern  *
8129503c1fb9SAvraham Stern  * This function should be called by a driver that supports 4 way handshake
8130503c1fb9SAvraham Stern  * offload after a security association was successfully established (i.e.,
8131503c1fb9SAvraham Stern  * the 4 way handshake was completed successfully). The call to this function
8132503c1fb9SAvraham Stern  * should be preceded with a call to cfg80211_connect_result(),
8133503c1fb9SAvraham Stern  * cfg80211_connect_done(), cfg80211_connect_bss() or cfg80211_roamed() to
8134503c1fb9SAvraham Stern  * indicate the 802.11 association.
8135e4e7e3afSVinayak Yadawad  * This function can also be called by AP/P2P GO driver that supports
8136e4e7e3afSVinayak Yadawad  * authentication offload. In this case the peer_mac passed is that of
8137e4e7e3afSVinayak Yadawad  * associated STA/GC.
8138503c1fb9SAvraham Stern  */
8139e4e7e3afSVinayak Yadawad void cfg80211_port_authorized(struct net_device *dev, const u8 *peer_addr,
81400ff57171SVinayak Yadawad 			      const u8* td_bitmap, u8 td_bitmap_len, gfp_t gfp);
8141503c1fb9SAvraham Stern 
8142503c1fb9SAvraham Stern /**
8143b23aa676SSamuel Ortiz  * cfg80211_disconnected - notify cfg80211 that connection was dropped
8144b23aa676SSamuel Ortiz  *
8145b23aa676SSamuel Ortiz  * @dev: network device
8146b23aa676SSamuel Ortiz  * @ie: information elements of the deauth/disassoc frame (may be %NULL)
8147b23aa676SSamuel Ortiz  * @ie_len: length of IEs
8148b23aa676SSamuel Ortiz  * @reason: reason code for the disconnection, set it to 0 if unknown
814980279fb7SJohannes Berg  * @locally_generated: disconnection was requested locally
8150b23aa676SSamuel Ortiz  * @gfp: allocation flags
8151b23aa676SSamuel Ortiz  *
8152b23aa676SSamuel Ortiz  * After it calls this function, the driver should enter an idle state
8153b23aa676SSamuel Ortiz  * and not try to connect to any AP any more.
8154b23aa676SSamuel Ortiz  */
8155b23aa676SSamuel Ortiz void cfg80211_disconnected(struct net_device *dev, u16 reason,
815680279fb7SJohannes Berg 			   const u8 *ie, size_t ie_len,
815780279fb7SJohannes Berg 			   bool locally_generated, gfp_t gfp);
8158b23aa676SSamuel Ortiz 
81599588bbd5SJouni Malinen /**
81609588bbd5SJouni Malinen  * cfg80211_ready_on_channel - notification of remain_on_channel start
816171bbc994SJohannes Berg  * @wdev: wireless device
81629588bbd5SJouni Malinen  * @cookie: the request cookie
81639588bbd5SJouni Malinen  * @chan: The current channel (from remain_on_channel request)
81649588bbd5SJouni Malinen  * @duration: Duration in milliseconds that the driver intents to remain on the
81659588bbd5SJouni Malinen  *	channel
81669588bbd5SJouni Malinen  * @gfp: allocation flags
81679588bbd5SJouni Malinen  */
816871bbc994SJohannes Berg void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie,
81699588bbd5SJouni Malinen 			       struct ieee80211_channel *chan,
81709588bbd5SJouni Malinen 			       unsigned int duration, gfp_t gfp);
81719588bbd5SJouni Malinen 
81729588bbd5SJouni Malinen /**
81739588bbd5SJouni Malinen  * cfg80211_remain_on_channel_expired - remain_on_channel duration expired
817471bbc994SJohannes Berg  * @wdev: wireless device
81759588bbd5SJouni Malinen  * @cookie: the request cookie
81769588bbd5SJouni Malinen  * @chan: The current channel (from remain_on_channel request)
81779588bbd5SJouni Malinen  * @gfp: allocation flags
81789588bbd5SJouni Malinen  */
817971bbc994SJohannes Berg void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie,
81809588bbd5SJouni Malinen 					struct ieee80211_channel *chan,
81819588bbd5SJouni Malinen 					gfp_t gfp);
8182b23aa676SSamuel Ortiz 
81838689c051SArend van Spriel /**
81841c38c7f2SJames Prestwood  * cfg80211_tx_mgmt_expired - tx_mgmt duration expired
81851c38c7f2SJames Prestwood  * @wdev: wireless device
81861c38c7f2SJames Prestwood  * @cookie: the requested cookie
81871c38c7f2SJames Prestwood  * @chan: The current channel (from tx_mgmt request)
81881c38c7f2SJames Prestwood  * @gfp: allocation flags
81891c38c7f2SJames Prestwood  */
81901c38c7f2SJames Prestwood void cfg80211_tx_mgmt_expired(struct wireless_dev *wdev, u64 cookie,
81911c38c7f2SJames Prestwood 			      struct ieee80211_channel *chan, gfp_t gfp);
81921c38c7f2SJames Prestwood 
81931c38c7f2SJames Prestwood /**
81948689c051SArend van Spriel  * cfg80211_sinfo_alloc_tid_stats - allocate per-tid statistics.
81958689c051SArend van Spriel  *
81968689c051SArend van Spriel  * @sinfo: the station information
81978689c051SArend van Spriel  * @gfp: allocation flags
81988689c051SArend van Spriel  */
81998689c051SArend van Spriel int cfg80211_sinfo_alloc_tid_stats(struct station_info *sinfo, gfp_t gfp);
820098b62183SJohannes Berg 
820198b62183SJohannes Berg /**
82027ea3e110SJohannes Berg  * cfg80211_sinfo_release_content - release contents of station info
82037ea3e110SJohannes Berg  * @sinfo: the station information
82047ea3e110SJohannes Berg  *
82057ea3e110SJohannes Berg  * Releases any potentially allocated sub-information of the station
82067ea3e110SJohannes Berg  * information, but not the struct itself (since it's typically on
82077ea3e110SJohannes Berg  * the stack.)
82087ea3e110SJohannes Berg  */
82097ea3e110SJohannes Berg static inline void cfg80211_sinfo_release_content(struct station_info *sinfo)
82107ea3e110SJohannes Berg {
82117ea3e110SJohannes Berg 	kfree(sinfo->pertid);
82127ea3e110SJohannes Berg }
82137ea3e110SJohannes Berg 
82147ea3e110SJohannes Berg /**
821598b62183SJohannes Berg  * cfg80211_new_sta - notify userspace about station
821698b62183SJohannes Berg  *
821798b62183SJohannes Berg  * @dev: the netdev
821898b62183SJohannes Berg  * @mac_addr: the station's address
821998b62183SJohannes Berg  * @sinfo: the station information
822098b62183SJohannes Berg  * @gfp: allocation flags
822198b62183SJohannes Berg  */
822298b62183SJohannes Berg void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr,
822398b62183SJohannes Berg 		      struct station_info *sinfo, gfp_t gfp);
822498b62183SJohannes Berg 
8225026331c4SJouni Malinen /**
8226cf5ead82SJohannes Berg  * cfg80211_del_sta_sinfo - notify userspace about deletion of a station
8227cf5ead82SJohannes Berg  * @dev: the netdev
8228bfc55167SVeerendranath Jakkam  * @mac_addr: the station's address. For MLD station, MLD address is used.
8229cf5ead82SJohannes Berg  * @sinfo: the station information/statistics
8230cf5ead82SJohannes Berg  * @gfp: allocation flags
8231cf5ead82SJohannes Berg  */
8232cf5ead82SJohannes Berg void cfg80211_del_sta_sinfo(struct net_device *dev, const u8 *mac_addr,
8233cf5ead82SJohannes Berg 			    struct station_info *sinfo, gfp_t gfp);
8234cf5ead82SJohannes Berg 
8235cf5ead82SJohannes Berg /**
8236ec15e68bSJouni Malinen  * cfg80211_del_sta - notify userspace about deletion of a station
8237ec15e68bSJouni Malinen  *
8238ec15e68bSJouni Malinen  * @dev: the netdev
8239bfc55167SVeerendranath Jakkam  * @mac_addr: the station's address. For MLD station, MLD address is used.
8240ec15e68bSJouni Malinen  * @gfp: allocation flags
8241ec15e68bSJouni Malinen  */
8242cf5ead82SJohannes Berg static inline void cfg80211_del_sta(struct net_device *dev,
8243cf5ead82SJohannes Berg 				    const u8 *mac_addr, gfp_t gfp)
8244cf5ead82SJohannes Berg {
8245cf5ead82SJohannes Berg 	cfg80211_del_sta_sinfo(dev, mac_addr, NULL, gfp);
8246cf5ead82SJohannes Berg }
8247ec15e68bSJouni Malinen 
8248ec15e68bSJouni Malinen /**
8249ed44a951SPandiyarajan Pitchaimuthu  * cfg80211_conn_failed - connection request failed notification
8250ed44a951SPandiyarajan Pitchaimuthu  *
8251ed44a951SPandiyarajan Pitchaimuthu  * @dev: the netdev
8252ed44a951SPandiyarajan Pitchaimuthu  * @mac_addr: the station's address
8253ed44a951SPandiyarajan Pitchaimuthu  * @reason: the reason for connection failure
8254ed44a951SPandiyarajan Pitchaimuthu  * @gfp: allocation flags
8255ed44a951SPandiyarajan Pitchaimuthu  *
8256ed44a951SPandiyarajan Pitchaimuthu  * Whenever a station tries to connect to an AP and if the station
8257ed44a951SPandiyarajan Pitchaimuthu  * could not connect to the AP as the AP has rejected the connection
8258ed44a951SPandiyarajan Pitchaimuthu  * for some reasons, this function is called.
8259ed44a951SPandiyarajan Pitchaimuthu  *
8260ed44a951SPandiyarajan Pitchaimuthu  * The reason for connection failure can be any of the value from
8261ed44a951SPandiyarajan Pitchaimuthu  * nl80211_connect_failed_reason enum
8262ed44a951SPandiyarajan Pitchaimuthu  */
8263ed44a951SPandiyarajan Pitchaimuthu void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr,
8264ed44a951SPandiyarajan Pitchaimuthu 			  enum nl80211_connect_failed_reason reason,
8265ed44a951SPandiyarajan Pitchaimuthu 			  gfp_t gfp);
8266ed44a951SPandiyarajan Pitchaimuthu 
8267ed44a951SPandiyarajan Pitchaimuthu /**
826800b3d840SAvraham Stern  * struct cfg80211_rx_info - received management frame info
826900b3d840SAvraham Stern  *
827000b3d840SAvraham Stern  * @freq: Frequency on which the frame was received in kHz
827100b3d840SAvraham Stern  * @sig_dbm: signal strength in dBm, or 0 if unknown
82726074c9e5SJohannes Berg  * @have_link_id: indicates the frame was received on a link of
82736074c9e5SJohannes Berg  *	an MLD, i.e. the @link_id field is valid
82746074c9e5SJohannes Berg  * @link_id: the ID of the link the frame was received	on
827500b3d840SAvraham Stern  * @buf: Management frame (header + body)
827600b3d840SAvraham Stern  * @len: length of the frame data
82771dcf396bSDmitry Antipov  * @flags: flags, as defined in &enum nl80211_rxmgmt_flags
82781ff715ffSAvraham Stern  * @rx_tstamp: Hardware timestamp of frame RX in nanoseconds
82791ff715ffSAvraham Stern  * @ack_tstamp: Hardware timestamp of ack TX in nanoseconds
828000b3d840SAvraham Stern  */
828100b3d840SAvraham Stern struct cfg80211_rx_info {
828200b3d840SAvraham Stern 	int freq;
828300b3d840SAvraham Stern 	int sig_dbm;
82846074c9e5SJohannes Berg 	bool have_link_id;
82856074c9e5SJohannes Berg 	u8 link_id;
828600b3d840SAvraham Stern 	const u8 *buf;
828700b3d840SAvraham Stern 	size_t len;
828800b3d840SAvraham Stern 	u32 flags;
82891ff715ffSAvraham Stern 	u64 rx_tstamp;
82901ff715ffSAvraham Stern 	u64 ack_tstamp;
829100b3d840SAvraham Stern };
829200b3d840SAvraham Stern 
829300b3d840SAvraham Stern /**
829400b3d840SAvraham Stern  * cfg80211_rx_mgmt_ext - management frame notification with extended info
829500b3d840SAvraham Stern  * @wdev: wireless device receiving the frame
829600b3d840SAvraham Stern  * @info: RX info as defined in struct cfg80211_rx_info
829700b3d840SAvraham Stern  *
829800b3d840SAvraham Stern  * This function is called whenever an Action frame is received for a station
829900b3d840SAvraham Stern  * mode interface, but is not processed in kernel.
830000b3d840SAvraham Stern  *
830100b3d840SAvraham Stern  * Return: %true if a user space application has registered for this frame.
830200b3d840SAvraham Stern  * For action frames, that makes it responsible for rejecting unrecognized
830300b3d840SAvraham Stern  * action frames; %false otherwise, in which case for action frames the
830400b3d840SAvraham Stern  * driver is responsible for rejecting the frame.
830500b3d840SAvraham Stern  */
830600b3d840SAvraham Stern bool cfg80211_rx_mgmt_ext(struct wireless_dev *wdev,
830700b3d840SAvraham Stern 			  struct cfg80211_rx_info *info);
830800b3d840SAvraham Stern 
830900b3d840SAvraham Stern /**
8310e76fede8SThomas Pedersen  * cfg80211_rx_mgmt_khz - notification of received, unprocessed management frame
8311e76fede8SThomas Pedersen  * @wdev: wireless device receiving the frame
8312e76fede8SThomas Pedersen  * @freq: Frequency on which the frame was received in KHz
8313e76fede8SThomas Pedersen  * @sig_dbm: signal strength in dBm, or 0 if unknown
8314e76fede8SThomas Pedersen  * @buf: Management frame (header + body)
8315e76fede8SThomas Pedersen  * @len: length of the frame data
8316e76fede8SThomas Pedersen  * @flags: flags, as defined in enum nl80211_rxmgmt_flags
8317e76fede8SThomas Pedersen  *
8318e76fede8SThomas Pedersen  * This function is called whenever an Action frame is received for a station
8319e76fede8SThomas Pedersen  * mode interface, but is not processed in kernel.
8320e76fede8SThomas Pedersen  *
8321e76fede8SThomas Pedersen  * Return: %true if a user space application has registered for this frame.
8322e76fede8SThomas Pedersen  * For action frames, that makes it responsible for rejecting unrecognized
8323e76fede8SThomas Pedersen  * action frames; %false otherwise, in which case for action frames the
8324e76fede8SThomas Pedersen  * driver is responsible for rejecting the frame.
8325e76fede8SThomas Pedersen  */
832600b3d840SAvraham Stern static inline bool cfg80211_rx_mgmt_khz(struct wireless_dev *wdev, int freq,
832700b3d840SAvraham Stern 					int sig_dbm, const u8 *buf, size_t len,
832800b3d840SAvraham Stern 					u32 flags)
832900b3d840SAvraham Stern {
833000b3d840SAvraham Stern 	struct cfg80211_rx_info info = {
833100b3d840SAvraham Stern 		.freq = freq,
833200b3d840SAvraham Stern 		.sig_dbm = sig_dbm,
833300b3d840SAvraham Stern 		.buf = buf,
833400b3d840SAvraham Stern 		.len = len,
833500b3d840SAvraham Stern 		.flags = flags
833600b3d840SAvraham Stern 	};
833700b3d840SAvraham Stern 
833800b3d840SAvraham Stern 	return cfg80211_rx_mgmt_ext(wdev, &info);
833900b3d840SAvraham Stern }
8340e76fede8SThomas Pedersen 
8341e76fede8SThomas Pedersen /**
83422e161f78SJohannes Berg  * cfg80211_rx_mgmt - notification of received, unprocessed management frame
834371bbc994SJohannes Berg  * @wdev: wireless device receiving the frame
8344026331c4SJouni Malinen  * @freq: Frequency on which the frame was received in MHz
83456c2fb1e6SSergey Matyukevich  * @sig_dbm: signal strength in dBm, or 0 if unknown
83462e161f78SJohannes Berg  * @buf: Management frame (header + body)
8347026331c4SJouni Malinen  * @len: length of the frame data
834819504cf5SVladimir Kondratiev  * @flags: flags, as defined in enum nl80211_rxmgmt_flags
83492e161f78SJohannes Berg  *
83500ae997dcSYacine Belkadi  * This function is called whenever an Action frame is received for a station
83510ae997dcSYacine Belkadi  * mode interface, but is not processed in kernel.
83520ae997dcSYacine Belkadi  *
83530ae997dcSYacine Belkadi  * Return: %true if a user space application has registered for this frame.
83542e161f78SJohannes Berg  * For action frames, that makes it responsible for rejecting unrecognized
83552e161f78SJohannes Berg  * action frames; %false otherwise, in which case for action frames the
83562e161f78SJohannes Berg  * driver is responsible for rejecting the frame.
8357026331c4SJouni Malinen  */
8358e76fede8SThomas Pedersen static inline bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq,
8359e76fede8SThomas Pedersen 				    int sig_dbm, const u8 *buf, size_t len,
8360e76fede8SThomas Pedersen 				    u32 flags)
8361e76fede8SThomas Pedersen {
836200b3d840SAvraham Stern 	struct cfg80211_rx_info info = {
836300b3d840SAvraham Stern 		.freq = MHZ_TO_KHZ(freq),
836400b3d840SAvraham Stern 		.sig_dbm = sig_dbm,
836500b3d840SAvraham Stern 		.buf = buf,
836600b3d840SAvraham Stern 		.len = len,
836700b3d840SAvraham Stern 		.flags = flags
836800b3d840SAvraham Stern 	};
836900b3d840SAvraham Stern 
837000b3d840SAvraham Stern 	return cfg80211_rx_mgmt_ext(wdev, &info);
8371e76fede8SThomas Pedersen }
8372026331c4SJouni Malinen 
8373026331c4SJouni Malinen /**
8374ea7d50c9SAvraham Stern  * struct cfg80211_tx_status - TX status for management frame information
8375ea7d50c9SAvraham Stern  *
8376ea7d50c9SAvraham Stern  * @cookie: Cookie returned by cfg80211_ops::mgmt_tx()
8377ea7d50c9SAvraham Stern  * @tx_tstamp: hardware TX timestamp in nanoseconds
8378ea7d50c9SAvraham Stern  * @ack_tstamp: hardware ack RX timestamp in nanoseconds
8379ea7d50c9SAvraham Stern  * @buf: Management frame (header + body)
8380ea7d50c9SAvraham Stern  * @len: length of the frame data
8381ea7d50c9SAvraham Stern  * @ack: Whether frame was acknowledged
8382ea7d50c9SAvraham Stern  */
8383ea7d50c9SAvraham Stern struct cfg80211_tx_status {
8384ea7d50c9SAvraham Stern 	u64 cookie;
8385ea7d50c9SAvraham Stern 	u64 tx_tstamp;
8386ea7d50c9SAvraham Stern 	u64 ack_tstamp;
8387ea7d50c9SAvraham Stern 	const u8 *buf;
8388ea7d50c9SAvraham Stern 	size_t len;
8389ea7d50c9SAvraham Stern 	bool ack;
8390ea7d50c9SAvraham Stern };
8391ea7d50c9SAvraham Stern 
8392ea7d50c9SAvraham Stern /**
8393ea7d50c9SAvraham Stern  * cfg80211_mgmt_tx_status_ext - TX status notification with extended info
8394ea7d50c9SAvraham Stern  * @wdev: wireless device receiving the frame
8395ea7d50c9SAvraham Stern  * @status: TX status data
8396ea7d50c9SAvraham Stern  * @gfp: context flags
8397ea7d50c9SAvraham Stern  *
8398ea7d50c9SAvraham Stern  * This function is called whenever a management frame was requested to be
8399ea7d50c9SAvraham Stern  * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the
8400ea7d50c9SAvraham Stern  * transmission attempt with extended info.
8401ea7d50c9SAvraham Stern  */
8402ea7d50c9SAvraham Stern void cfg80211_mgmt_tx_status_ext(struct wireless_dev *wdev,
8403ea7d50c9SAvraham Stern 				 struct cfg80211_tx_status *status, gfp_t gfp);
8404ea7d50c9SAvraham Stern 
8405ea7d50c9SAvraham Stern /**
84062e161f78SJohannes Berg  * cfg80211_mgmt_tx_status - notification of TX status for management frame
840771bbc994SJohannes Berg  * @wdev: wireless device receiving the frame
84082e161f78SJohannes Berg  * @cookie: Cookie returned by cfg80211_ops::mgmt_tx()
84092e161f78SJohannes Berg  * @buf: Management frame (header + body)
8410026331c4SJouni Malinen  * @len: length of the frame data
8411026331c4SJouni Malinen  * @ack: Whether frame was acknowledged
8412026331c4SJouni Malinen  * @gfp: context flags
8413026331c4SJouni Malinen  *
84142e161f78SJohannes Berg  * This function is called whenever a management frame was requested to be
84152e161f78SJohannes Berg  * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the
8416026331c4SJouni Malinen  * transmission attempt.
8417026331c4SJouni Malinen  */
8418ea7d50c9SAvraham Stern static inline void cfg80211_mgmt_tx_status(struct wireless_dev *wdev,
8419ea7d50c9SAvraham Stern 					   u64 cookie, const u8 *buf,
8420ea7d50c9SAvraham Stern 					   size_t len, bool ack, gfp_t gfp)
8421ea7d50c9SAvraham Stern {
8422ea7d50c9SAvraham Stern 	struct cfg80211_tx_status status = {
8423ea7d50c9SAvraham Stern 		.cookie = cookie,
8424ea7d50c9SAvraham Stern 		.buf = buf,
8425ea7d50c9SAvraham Stern 		.len = len,
8426ea7d50c9SAvraham Stern 		.ack = ack
8427ea7d50c9SAvraham Stern 	};
8428ea7d50c9SAvraham Stern 
8429ea7d50c9SAvraham Stern 	cfg80211_mgmt_tx_status_ext(wdev, &status, gfp);
8430ea7d50c9SAvraham Stern }
8431026331c4SJouni Malinen 
8432dca9ca2dSMarkus Theil /**
8433dca9ca2dSMarkus Theil  * cfg80211_control_port_tx_status - notification of TX status for control
8434dca9ca2dSMarkus Theil  *                                   port frames
8435dca9ca2dSMarkus Theil  * @wdev: wireless device receiving the frame
8436dca9ca2dSMarkus Theil  * @cookie: Cookie returned by cfg80211_ops::tx_control_port()
8437dca9ca2dSMarkus Theil  * @buf: Data frame (header + body)
8438dca9ca2dSMarkus Theil  * @len: length of the frame data
8439dca9ca2dSMarkus Theil  * @ack: Whether frame was acknowledged
8440dca9ca2dSMarkus Theil  * @gfp: context flags
8441dca9ca2dSMarkus Theil  *
8442dca9ca2dSMarkus Theil  * This function is called whenever a control port frame was requested to be
8443dca9ca2dSMarkus Theil  * transmitted with cfg80211_ops::tx_control_port() to report the TX status of
8444dca9ca2dSMarkus Theil  * the transmission attempt.
8445dca9ca2dSMarkus Theil  */
8446dca9ca2dSMarkus Theil void cfg80211_control_port_tx_status(struct wireless_dev *wdev, u64 cookie,
8447dca9ca2dSMarkus Theil 				     const u8 *buf, size_t len, bool ack,
8448dca9ca2dSMarkus Theil 				     gfp_t gfp);
8449d6dc1a38SJuuso Oikarinen 
8450d6dc1a38SJuuso Oikarinen /**
84516a671a50SDenis Kenzior  * cfg80211_rx_control_port - notification about a received control port frame
84526a671a50SDenis Kenzior  * @dev: The device the frame matched to
8453a948f713SDenis Kenzior  * @skb: The skbuf with the control port frame.  It is assumed that the skbuf
8454a948f713SDenis Kenzior  *	is 802.3 formatted (with 802.3 header).  The skb can be non-linear.
8455a948f713SDenis Kenzior  *	This function does not take ownership of the skb, so the caller is
8456a948f713SDenis Kenzior  *	responsible for any cleanup.  The caller must also ensure that
8457a948f713SDenis Kenzior  *	skb->protocol is set appropriately.
84586a671a50SDenis Kenzior  * @unencrypted: Whether the frame was received unencrypted
84594c532321SJohannes Berg  * @link_id: the link the frame was received on, -1 if not applicable or unknown
84606a671a50SDenis Kenzior  *
84616a671a50SDenis Kenzior  * This function is used to inform userspace about a received control port
84626a671a50SDenis Kenzior  * frame.  It should only be used if userspace indicated it wants to receive
84636a671a50SDenis Kenzior  * control port frames over nl80211.
84646a671a50SDenis Kenzior  *
84656a671a50SDenis Kenzior  * The frame is the data portion of the 802.3 or 802.11 data frame with all
84666a671a50SDenis Kenzior  * network layer headers removed (e.g. the raw EAPoL frame).
84676a671a50SDenis Kenzior  *
84686a671a50SDenis Kenzior  * Return: %true if the frame was passed to userspace
84696a671a50SDenis Kenzior  */
84704c532321SJohannes Berg bool cfg80211_rx_control_port(struct net_device *dev, struct sk_buff *skb,
84714c532321SJohannes Berg 			      bool unencrypted, int link_id);
84726a671a50SDenis Kenzior 
84736a671a50SDenis Kenzior /**
8474d6dc1a38SJuuso Oikarinen  * cfg80211_cqm_rssi_notify - connection quality monitoring rssi event
8475d6dc1a38SJuuso Oikarinen  * @dev: network device
8476d6dc1a38SJuuso Oikarinen  * @rssi_event: the triggered RSSI event
8477bee427b8SAndrzej Zaborowski  * @rssi_level: new RSSI level value or 0 if not available
8478d6dc1a38SJuuso Oikarinen  * @gfp: context flags
8479d6dc1a38SJuuso Oikarinen  *
8480d6dc1a38SJuuso Oikarinen  * This function is called when a configured connection quality monitoring
8481d6dc1a38SJuuso Oikarinen  * rssi threshold reached event occurs.
8482d6dc1a38SJuuso Oikarinen  */
8483d6dc1a38SJuuso Oikarinen void cfg80211_cqm_rssi_notify(struct net_device *dev,
8484d6dc1a38SJuuso Oikarinen 			      enum nl80211_cqm_rssi_threshold_event rssi_event,
8485bee427b8SAndrzej Zaborowski 			      s32 rssi_level, gfp_t gfp);
8486d6dc1a38SJuuso Oikarinen 
8487c063dbf5SJohannes Berg /**
8488c063dbf5SJohannes Berg  * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer
8489c063dbf5SJohannes Berg  * @dev: network device
8490c063dbf5SJohannes Berg  * @peer: peer's MAC address
8491c063dbf5SJohannes Berg  * @num_packets: how many packets were lost -- should be a fixed threshold
8492c063dbf5SJohannes Berg  *	but probably no less than maybe 50, or maybe a throughput dependent
8493c063dbf5SJohannes Berg  *	threshold (to account for temporary interference)
8494c063dbf5SJohannes Berg  * @gfp: context flags
8495c063dbf5SJohannes Berg  */
8496c063dbf5SJohannes Berg void cfg80211_cqm_pktloss_notify(struct net_device *dev,
8497c063dbf5SJohannes Berg 				 const u8 *peer, u32 num_packets, gfp_t gfp);
8498c063dbf5SJohannes Berg 
8499e5497d76SJohannes Berg /**
850084f10708SThomas Pedersen  * cfg80211_cqm_txe_notify - TX error rate event
850184f10708SThomas Pedersen  * @dev: network device
850284f10708SThomas Pedersen  * @peer: peer's MAC address
850384f10708SThomas Pedersen  * @num_packets: how many packets were lost
850484f10708SThomas Pedersen  * @rate: % of packets which failed transmission
850584f10708SThomas Pedersen  * @intvl: interval (in s) over which the TX failure threshold was breached.
850684f10708SThomas Pedersen  * @gfp: context flags
850784f10708SThomas Pedersen  *
850884f10708SThomas Pedersen  * Notify userspace when configured % TX failures over number of packets in a
850984f10708SThomas Pedersen  * given interval is exceeded.
851084f10708SThomas Pedersen  */
851184f10708SThomas Pedersen void cfg80211_cqm_txe_notify(struct net_device *dev, const u8 *peer,
851284f10708SThomas Pedersen 			     u32 num_packets, u32 rate, u32 intvl, gfp_t gfp);
851384f10708SThomas Pedersen 
851484f10708SThomas Pedersen /**
851598f03342SJohannes Berg  * cfg80211_cqm_beacon_loss_notify - beacon loss event
851698f03342SJohannes Berg  * @dev: network device
851798f03342SJohannes Berg  * @gfp: context flags
851898f03342SJohannes Berg  *
851998f03342SJohannes Berg  * Notify userspace about beacon loss from the connected AP.
852098f03342SJohannes Berg  */
852198f03342SJohannes Berg void cfg80211_cqm_beacon_loss_notify(struct net_device *dev, gfp_t gfp);
852298f03342SJohannes Berg 
852398f03342SJohannes Berg /**
8524c47240cbSLorenzo Bianconi  * __cfg80211_radar_event - radar detection event
85255b97f49dSJohannes Berg  * @wiphy: the wiphy
85265b97f49dSJohannes Berg  * @chandef: chandef for the current channel
8527c47240cbSLorenzo Bianconi  * @offchan: the radar has been detected on the offchannel chain
85285b97f49dSJohannes Berg  * @gfp: context flags
85295b97f49dSJohannes Berg  *
85305b97f49dSJohannes Berg  * This function is called when a radar is detected on the current chanenl.
85315b97f49dSJohannes Berg  */
8532c47240cbSLorenzo Bianconi void __cfg80211_radar_event(struct wiphy *wiphy,
8533c47240cbSLorenzo Bianconi 			    struct cfg80211_chan_def *chandef,
8534c47240cbSLorenzo Bianconi 			    bool offchan, gfp_t gfp);
8535c47240cbSLorenzo Bianconi 
8536c47240cbSLorenzo Bianconi static inline void
8537c47240cbSLorenzo Bianconi cfg80211_radar_event(struct wiphy *wiphy,
8538c47240cbSLorenzo Bianconi 		     struct cfg80211_chan_def *chandef,
8539c47240cbSLorenzo Bianconi 		     gfp_t gfp)
8540c47240cbSLorenzo Bianconi {
8541c47240cbSLorenzo Bianconi 	__cfg80211_radar_event(wiphy, chandef, false, gfp);
8542c47240cbSLorenzo Bianconi }
8543c47240cbSLorenzo Bianconi 
8544c47240cbSLorenzo Bianconi static inline void
8545a95bfb87SLorenzo Bianconi cfg80211_background_radar_event(struct wiphy *wiphy,
8546c47240cbSLorenzo Bianconi 				struct cfg80211_chan_def *chandef,
8547c47240cbSLorenzo Bianconi 				gfp_t gfp)
8548c47240cbSLorenzo Bianconi {
8549c47240cbSLorenzo Bianconi 	__cfg80211_radar_event(wiphy, chandef, true, gfp);
8550c47240cbSLorenzo Bianconi }
85515b97f49dSJohannes Berg 
85525b97f49dSJohannes Berg /**
8553466b9936Stamizhr@codeaurora.org  * cfg80211_sta_opmode_change_notify - STA's ht/vht operation mode change event
8554466b9936Stamizhr@codeaurora.org  * @dev: network device
8555466b9936Stamizhr@codeaurora.org  * @mac: MAC address of a station which opmode got modified
8556466b9936Stamizhr@codeaurora.org  * @sta_opmode: station's current opmode value
8557466b9936Stamizhr@codeaurora.org  * @gfp: context flags
8558466b9936Stamizhr@codeaurora.org  *
8559466b9936Stamizhr@codeaurora.org  * Driver should call this function when station's opmode modified via action
8560466b9936Stamizhr@codeaurora.org  * frame.
8561466b9936Stamizhr@codeaurora.org  */
8562466b9936Stamizhr@codeaurora.org void cfg80211_sta_opmode_change_notify(struct net_device *dev, const u8 *mac,
8563466b9936Stamizhr@codeaurora.org 				       struct sta_opmode_info *sta_opmode,
8564466b9936Stamizhr@codeaurora.org 				       gfp_t gfp);
8565466b9936Stamizhr@codeaurora.org 
8566466b9936Stamizhr@codeaurora.org /**
85675b97f49dSJohannes Berg  * cfg80211_cac_event - Channel availability check (CAC) event
85685b97f49dSJohannes Berg  * @netdev: network device
85695b97f49dSJohannes Berg  * @chandef: chandef for the current channel
85705b97f49dSJohannes Berg  * @event: type of event
85715b97f49dSJohannes Berg  * @gfp: context flags
85725b97f49dSJohannes Berg  *
85735b97f49dSJohannes Berg  * This function is called when a Channel availability check (CAC) is finished
85745b97f49dSJohannes Berg  * or aborted. This must be called to notify the completion of a CAC process,
85755b97f49dSJohannes Berg  * also by full-MAC drivers.
85765b97f49dSJohannes Berg  */
85775b97f49dSJohannes Berg void cfg80211_cac_event(struct net_device *netdev,
85785b97f49dSJohannes Berg 			const struct cfg80211_chan_def *chandef,
85795b97f49dSJohannes Berg 			enum nl80211_radar_event event, gfp_t gfp);
85805b97f49dSJohannes Berg 
8581bc2dfc02SLorenzo Bianconi /**
8582a95bfb87SLorenzo Bianconi  * cfg80211_background_cac_abort - Channel Availability Check offchan abort event
8583bc2dfc02SLorenzo Bianconi  * @wiphy: the wiphy
8584bc2dfc02SLorenzo Bianconi  *
85851507b153SLorenzo Bianconi  * This function is called by the driver when a Channel Availability Check
85861507b153SLorenzo Bianconi  * (CAC) is aborted by a offchannel dedicated chain.
8587bc2dfc02SLorenzo Bianconi  */
8588a95bfb87SLorenzo Bianconi void cfg80211_background_cac_abort(struct wiphy *wiphy);
85895b97f49dSJohannes Berg 
85905b97f49dSJohannes Berg /**
8591e5497d76SJohannes Berg  * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying
8592e5497d76SJohannes Berg  * @dev: network device
8593e5497d76SJohannes Berg  * @bssid: BSSID of AP (to avoid races)
8594e5497d76SJohannes Berg  * @replay_ctr: new replay counter
8595af71ff85SJohannes Berg  * @gfp: allocation flags
8596e5497d76SJohannes Berg  */
8597e5497d76SJohannes Berg void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid,
8598e5497d76SJohannes Berg 			       const u8 *replay_ctr, gfp_t gfp);
8599e5497d76SJohannes Berg 
8600c9df56b4SJouni Malinen /**
8601c9df56b4SJouni Malinen  * cfg80211_pmksa_candidate_notify - notify about PMKSA caching candidate
8602c9df56b4SJouni Malinen  * @dev: network device
8603c9df56b4SJouni Malinen  * @index: candidate index (the smaller the index, the higher the priority)
8604c9df56b4SJouni Malinen  * @bssid: BSSID of AP
8605c9df56b4SJouni Malinen  * @preauth: Whether AP advertises support for RSN pre-authentication
8606c9df56b4SJouni Malinen  * @gfp: allocation flags
8607c9df56b4SJouni Malinen  */
8608c9df56b4SJouni Malinen void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index,
8609c9df56b4SJouni Malinen 				     const u8 *bssid, bool preauth, gfp_t gfp);
8610c9df56b4SJouni Malinen 
861128946da7SJohannes Berg /**
861228946da7SJohannes Berg  * cfg80211_rx_spurious_frame - inform userspace about a spurious frame
861328946da7SJohannes Berg  * @dev: The device the frame matched to
861428946da7SJohannes Berg  * @addr: the transmitter address
861528946da7SJohannes Berg  * @gfp: context flags
861628946da7SJohannes Berg  *
861728946da7SJohannes Berg  * This function is used in AP mode (only!) to inform userspace that
861828946da7SJohannes Berg  * a spurious class 3 frame was received, to be able to deauth the
861928946da7SJohannes Berg  * sender.
86200ae997dcSYacine Belkadi  * Return: %true if the frame was passed to userspace (or this failed
862128946da7SJohannes Berg  * for a reason other than not having a subscription.)
862228946da7SJohannes Berg  */
862328946da7SJohannes Berg bool cfg80211_rx_spurious_frame(struct net_device *dev,
862428946da7SJohannes Berg 				const u8 *addr, gfp_t gfp);
862528946da7SJohannes Berg 
86267f6cf311SJohannes Berg /**
8627b92ab5d8SJohannes Berg  * cfg80211_rx_unexpected_4addr_frame - inform about unexpected WDS frame
8628b92ab5d8SJohannes Berg  * @dev: The device the frame matched to
8629b92ab5d8SJohannes Berg  * @addr: the transmitter address
8630b92ab5d8SJohannes Berg  * @gfp: context flags
8631b92ab5d8SJohannes Berg  *
8632b92ab5d8SJohannes Berg  * This function is used in AP mode (only!) to inform userspace that
8633b92ab5d8SJohannes Berg  * an associated station sent a 4addr frame but that wasn't expected.
8634b92ab5d8SJohannes Berg  * It is allowed and desirable to send this event only once for each
8635b92ab5d8SJohannes Berg  * station to avoid event flooding.
86360ae997dcSYacine Belkadi  * Return: %true if the frame was passed to userspace (or this failed
8637b92ab5d8SJohannes Berg  * for a reason other than not having a subscription.)
8638b92ab5d8SJohannes Berg  */
8639b92ab5d8SJohannes Berg bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev,
8640b92ab5d8SJohannes Berg 					const u8 *addr, gfp_t gfp);
8641b92ab5d8SJohannes Berg 
8642b92ab5d8SJohannes Berg /**
86437f6cf311SJohannes Berg  * cfg80211_probe_status - notify userspace about probe status
86447f6cf311SJohannes Berg  * @dev: the device the probe was sent on
86457f6cf311SJohannes Berg  * @addr: the address of the peer
86467f6cf311SJohannes Berg  * @cookie: the cookie filled in @probe_client previously
86477f6cf311SJohannes Berg  * @acked: indicates whether probe was acked or not
8648c4b50cd3SVenkateswara Naralasetty  * @ack_signal: signal strength (in dBm) of the ACK frame.
8649c4b50cd3SVenkateswara Naralasetty  * @is_valid_ack_signal: indicates the ack_signal is valid or not.
86507f6cf311SJohannes Berg  * @gfp: allocation flags
86517f6cf311SJohannes Berg  */
86527f6cf311SJohannes Berg void cfg80211_probe_status(struct net_device *dev, const u8 *addr,
8653c4b50cd3SVenkateswara Naralasetty 			   u64 cookie, bool acked, s32 ack_signal,
8654c4b50cd3SVenkateswara Naralasetty 			   bool is_valid_ack_signal, gfp_t gfp);
86557f6cf311SJohannes Berg 
86565e760230SJohannes Berg /**
8657e76fede8SThomas Pedersen  * cfg80211_report_obss_beacon_khz - report beacon from other APs
8658e76fede8SThomas Pedersen  * @wiphy: The wiphy that received the beacon
8659e76fede8SThomas Pedersen  * @frame: the frame
8660e76fede8SThomas Pedersen  * @len: length of the frame
8661e76fede8SThomas Pedersen  * @freq: frequency the frame was received on in KHz
8662e76fede8SThomas Pedersen  * @sig_dbm: signal strength in dBm, or 0 if unknown
8663e76fede8SThomas Pedersen  *
8664e76fede8SThomas Pedersen  * Use this function to report to userspace when a beacon was
8665e76fede8SThomas Pedersen  * received. It is not useful to call this when there is no
8666e76fede8SThomas Pedersen  * netdev that is in AP/GO mode.
8667e76fede8SThomas Pedersen  */
8668e76fede8SThomas Pedersen void cfg80211_report_obss_beacon_khz(struct wiphy *wiphy, const u8 *frame,
8669e76fede8SThomas Pedersen 				     size_t len, int freq, int sig_dbm);
8670e76fede8SThomas Pedersen 
8671e76fede8SThomas Pedersen /**
86725e760230SJohannes Berg  * cfg80211_report_obss_beacon - report beacon from other APs
86735e760230SJohannes Berg  * @wiphy: The wiphy that received the beacon
86745e760230SJohannes Berg  * @frame: the frame
86755e760230SJohannes Berg  * @len: length of the frame
86765e760230SJohannes Berg  * @freq: frequency the frame was received on
86776c2fb1e6SSergey Matyukevich  * @sig_dbm: signal strength in dBm, or 0 if unknown
86785e760230SJohannes Berg  *
86795e760230SJohannes Berg  * Use this function to report to userspace when a beacon was
86805e760230SJohannes Berg  * received. It is not useful to call this when there is no
86815e760230SJohannes Berg  * netdev that is in AP/GO mode.
86825e760230SJohannes Berg  */
8683e76fede8SThomas Pedersen static inline void cfg80211_report_obss_beacon(struct wiphy *wiphy,
86845e760230SJohannes Berg 					       const u8 *frame, size_t len,
8685e76fede8SThomas Pedersen 					       int freq, int sig_dbm)
8686e76fede8SThomas Pedersen {
8687e76fede8SThomas Pedersen 	cfg80211_report_obss_beacon_khz(wiphy, frame, len, MHZ_TO_KHZ(freq),
8688e76fede8SThomas Pedersen 					sig_dbm);
8689e76fede8SThomas Pedersen }
86905e760230SJohannes Berg 
8691d58e7e37SJohannes Berg /**
8692683b6d3bSJohannes Berg  * cfg80211_reg_can_beacon - check if beaconing is allowed
869354858ee5SAlexander Simon  * @wiphy: the wiphy
8694683b6d3bSJohannes Berg  * @chandef: the channel definition
8695174e0cd2SIlan Peer  * @iftype: interface type
8696d58e7e37SJohannes Berg  *
86970ae997dcSYacine Belkadi  * Return: %true if there is no secondary channel or the secondary channel(s)
86980ae997dcSYacine Belkadi  * can be used for beaconing (i.e. is not a radar channel etc.)
869954858ee5SAlexander Simon  */
8700683b6d3bSJohannes Berg bool cfg80211_reg_can_beacon(struct wiphy *wiphy,
8701174e0cd2SIlan Peer 			     struct cfg80211_chan_def *chandef,
8702174e0cd2SIlan Peer 			     enum nl80211_iftype iftype);
870354858ee5SAlexander Simon 
8704923b352fSArik Nemtsov /**
8705923b352fSArik Nemtsov  * cfg80211_reg_can_beacon_relax - check if beaconing is allowed with relaxation
8706923b352fSArik Nemtsov  * @wiphy: the wiphy
8707923b352fSArik Nemtsov  * @chandef: the channel definition
8708923b352fSArik Nemtsov  * @iftype: interface type
8709923b352fSArik Nemtsov  *
8710923b352fSArik Nemtsov  * Return: %true if there is no secondary channel or the secondary channel(s)
8711923b352fSArik Nemtsov  * can be used for beaconing (i.e. is not a radar channel etc.). This version
8712923b352fSArik Nemtsov  * also checks if IR-relaxation conditions apply, to allow beaconing under
8713923b352fSArik Nemtsov  * more permissive conditions.
8714923b352fSArik Nemtsov  *
8715a05829a7SJohannes Berg  * Requires the wiphy mutex to be held.
8716923b352fSArik Nemtsov  */
8717923b352fSArik Nemtsov bool cfg80211_reg_can_beacon_relax(struct wiphy *wiphy,
8718923b352fSArik Nemtsov 				   struct cfg80211_chan_def *chandef,
8719923b352fSArik Nemtsov 				   enum nl80211_iftype iftype);
8720923b352fSArik Nemtsov 
87218097e149SThomas Pedersen /*
87225314526bSThomas Pedersen  * cfg80211_ch_switch_notify - update wdev channel and notify userspace
87235314526bSThomas Pedersen  * @dev: the device which switched channels
8724683b6d3bSJohannes Berg  * @chandef: the new channel definition
87257b0a0e3cSJohannes Berg  * @link_id: the link ID for MLO, must be 0 for non-MLO
8726b345f063SAloka Dixit  * @punct_bitmap: the new puncturing bitmap
87275314526bSThomas Pedersen  *
8728076fc877SJohannes Berg  * Caller must hold wiphy mutex, therefore must only be called from sleepable
8729e487eaebSSimon Wunderlich  * driver context!
87305314526bSThomas Pedersen  */
8731683b6d3bSJohannes Berg void cfg80211_ch_switch_notify(struct net_device *dev,
87327b0a0e3cSJohannes Berg 			       struct cfg80211_chan_def *chandef,
8733b345f063SAloka Dixit 			       unsigned int link_id, u16 punct_bitmap);
87345314526bSThomas Pedersen 
8735f8d7552eSLuciano Coelho /*
8736f8d7552eSLuciano Coelho  * cfg80211_ch_switch_started_notify - notify channel switch start
8737f8d7552eSLuciano Coelho  * @dev: the device on which the channel switch started
8738f8d7552eSLuciano Coelho  * @chandef: the future channel definition
8739b8c9024eSVeerendranath Jakkam  * @link_id: the link ID for MLO, must be 0 for non-MLO
8740f8d7552eSLuciano Coelho  * @count: the number of TBTTs until the channel switch happens
8741669b8413SJohannes Berg  * @quiet: whether or not immediate quiet was requested by the AP
8742b345f063SAloka Dixit  * @punct_bitmap: the future puncturing bitmap
8743f8d7552eSLuciano Coelho  *
8744f8d7552eSLuciano Coelho  * Inform the userspace about the channel switch that has just
8745f8d7552eSLuciano Coelho  * started, so that it can take appropriate actions (eg. starting
8746f8d7552eSLuciano Coelho  * channel switch on other vifs), if necessary.
8747f8d7552eSLuciano Coelho  */
8748f8d7552eSLuciano Coelho void cfg80211_ch_switch_started_notify(struct net_device *dev,
8749f8d7552eSLuciano Coelho 				       struct cfg80211_chan_def *chandef,
8750b8c9024eSVeerendranath Jakkam 				       unsigned int link_id, u8 count,
8751b345f063SAloka Dixit 				       bool quiet, u16 punct_bitmap);
8752f8d7552eSLuciano Coelho 
87531ce3e82bSJohannes Berg /**
87541ce3e82bSJohannes Berg  * ieee80211_operating_class_to_band - convert operating class to band
87551ce3e82bSJohannes Berg  *
87561ce3e82bSJohannes Berg  * @operating_class: the operating class to convert
87571ce3e82bSJohannes Berg  * @band: band pointer to fill
87581ce3e82bSJohannes Berg  *
87591ce3e82bSJohannes Berg  * Returns %true if the conversion was successful, %false otherwise.
87601ce3e82bSJohannes Berg  */
87611ce3e82bSJohannes Berg bool ieee80211_operating_class_to_band(u8 operating_class,
876257fbcce3SJohannes Berg 				       enum nl80211_band *band);
87631ce3e82bSJohannes Berg 
8764a38700ddSArik Nemtsov /**
8765a38700ddSArik Nemtsov  * ieee80211_chandef_to_operating_class - convert chandef to operation class
8766a38700ddSArik Nemtsov  *
8767a38700ddSArik Nemtsov  * @chandef: the chandef to convert
8768a38700ddSArik Nemtsov  * @op_class: a pointer to the resulting operating class
8769a38700ddSArik Nemtsov  *
8770a38700ddSArik Nemtsov  * Returns %true if the conversion was successful, %false otherwise.
8771a38700ddSArik Nemtsov  */
8772a38700ddSArik Nemtsov bool ieee80211_chandef_to_operating_class(struct cfg80211_chan_def *chandef,
8773a38700ddSArik Nemtsov 					  u8 *op_class);
8774a38700ddSArik Nemtsov 
8775934f4c7dSThomas Pedersen /**
8776934f4c7dSThomas Pedersen  * ieee80211_chandef_to_khz - convert chandef to frequency in KHz
8777934f4c7dSThomas Pedersen  *
8778934f4c7dSThomas Pedersen  * @chandef: the chandef to convert
8779934f4c7dSThomas Pedersen  *
8780934f4c7dSThomas Pedersen  * Returns the center frequency of chandef (1st segment) in KHz.
8781934f4c7dSThomas Pedersen  */
8782934f4c7dSThomas Pedersen static inline u32
8783934f4c7dSThomas Pedersen ieee80211_chandef_to_khz(const struct cfg80211_chan_def *chandef)
8784934f4c7dSThomas Pedersen {
8785934f4c7dSThomas Pedersen 	return MHZ_TO_KHZ(chandef->center_freq1) + chandef->freq1_offset;
8786934f4c7dSThomas Pedersen }
8787934f4c7dSThomas Pedersen 
87885314526bSThomas Pedersen /*
87893475b094SJouni Malinen  * cfg80211_tdls_oper_request - request userspace to perform TDLS operation
87903475b094SJouni Malinen  * @dev: the device on which the operation is requested
87913475b094SJouni Malinen  * @peer: the MAC address of the peer device
87923475b094SJouni Malinen  * @oper: the requested TDLS operation (NL80211_TDLS_SETUP or
87933475b094SJouni Malinen  *	NL80211_TDLS_TEARDOWN)
87943475b094SJouni Malinen  * @reason_code: the reason code for teardown request
87953475b094SJouni Malinen  * @gfp: allocation flags
87963475b094SJouni Malinen  *
87973475b094SJouni Malinen  * This function is used to request userspace to perform TDLS operation that
87983475b094SJouni Malinen  * requires knowledge of keys, i.e., link setup or teardown when the AP
87993475b094SJouni Malinen  * connection uses encryption. This is optional mechanism for the driver to use
88003475b094SJouni Malinen  * if it can automatically determine when a TDLS link could be useful (e.g.,
88013475b094SJouni Malinen  * based on traffic and signal strength for a peer).
88023475b094SJouni Malinen  */
88033475b094SJouni Malinen void cfg80211_tdls_oper_request(struct net_device *dev, const u8 *peer,
88043475b094SJouni Malinen 				enum nl80211_tdls_operation oper,
88053475b094SJouni Malinen 				u16 reason_code, gfp_t gfp);
88063475b094SJouni Malinen 
88073475b094SJouni Malinen /*
88088097e149SThomas Pedersen  * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units)
88098097e149SThomas Pedersen  * @rate: given rate_info to calculate bitrate from
88108097e149SThomas Pedersen  *
88118097e149SThomas Pedersen  * return 0 if MCS index >= 32
88128097e149SThomas Pedersen  */
88138eb41c8dSVladimir Kondratiev u32 cfg80211_calculate_bitrate(struct rate_info *rate);
88148097e149SThomas Pedersen 
881598104fdeSJohannes Berg /**
881698104fdeSJohannes Berg  * cfg80211_unregister_wdev - remove the given wdev
881798104fdeSJohannes Berg  * @wdev: struct wireless_dev to remove
881898104fdeSJohannes Berg  *
88192fe8ef10SJohannes Berg  * This function removes the device so it can no longer be used. It is necessary
88202fe8ef10SJohannes Berg  * to call this function even when cfg80211 requests the removal of the device
88212fe8ef10SJohannes Berg  * by calling the del_virtual_intf() callback. The function must also be called
88222fe8ef10SJohannes Berg  * when the driver wishes to unregister the wdev, e.g. when the hardware device
88232fe8ef10SJohannes Berg  * is unbound from the driver.
882498104fdeSJohannes Berg  *
8825a05829a7SJohannes Berg  * Requires the RTNL and wiphy mutex to be held.
882698104fdeSJohannes Berg  */
882798104fdeSJohannes Berg void cfg80211_unregister_wdev(struct wireless_dev *wdev);
882898104fdeSJohannes Berg 
88290ee45355SJohannes Berg /**
88302fe8ef10SJohannes Berg  * cfg80211_register_netdevice - register the given netdev
88312fe8ef10SJohannes Berg  * @dev: the netdev to register
88322fe8ef10SJohannes Berg  *
88332fe8ef10SJohannes Berg  * Note: In contexts coming from cfg80211 callbacks, you must call this rather
88342fe8ef10SJohannes Berg  * than register_netdevice(), unregister_netdev() is impossible as the RTNL is
88352fe8ef10SJohannes Berg  * held. Otherwise, both register_netdevice() and register_netdev() are usable
88362fe8ef10SJohannes Berg  * instead as well.
8837a05829a7SJohannes Berg  *
8838a05829a7SJohannes Berg  * Requires the RTNL and wiphy mutex to be held.
88392fe8ef10SJohannes Berg  */
88402fe8ef10SJohannes Berg int cfg80211_register_netdevice(struct net_device *dev);
88412fe8ef10SJohannes Berg 
88422fe8ef10SJohannes Berg /**
88432fe8ef10SJohannes Berg  * cfg80211_unregister_netdevice - unregister the given netdev
88442fe8ef10SJohannes Berg  * @dev: the netdev to register
88452fe8ef10SJohannes Berg  *
88462fe8ef10SJohannes Berg  * Note: In contexts coming from cfg80211 callbacks, you must call this rather
88472fe8ef10SJohannes Berg  * than unregister_netdevice(), unregister_netdev() is impossible as the RTNL
88482fe8ef10SJohannes Berg  * is held. Otherwise, both unregister_netdevice() and unregister_netdev() are
88492fe8ef10SJohannes Berg  * usable instead as well.
8850a05829a7SJohannes Berg  *
8851a05829a7SJohannes Berg  * Requires the RTNL and wiphy mutex to be held.
88522fe8ef10SJohannes Berg  */
88532fe8ef10SJohannes Berg static inline void cfg80211_unregister_netdevice(struct net_device *dev)
88542fe8ef10SJohannes Berg {
8855c304eddcSJakub Kicinski #if IS_ENABLED(CONFIG_CFG80211)
88562fe8ef10SJohannes Berg 	cfg80211_unregister_wdev(dev->ieee80211_ptr);
8857c304eddcSJakub Kicinski #endif
88582fe8ef10SJohannes Berg }
88592fe8ef10SJohannes Berg 
88602fe8ef10SJohannes Berg /**
8861b1e8eb11SMauro Carvalho Chehab  * struct cfg80211_ft_event_params - FT Information Elements
8862355199e0SJouni Malinen  * @ies: FT IEs
8863355199e0SJouni Malinen  * @ies_len: length of the FT IE in bytes
8864355199e0SJouni Malinen  * @target_ap: target AP's MAC address
8865355199e0SJouni Malinen  * @ric_ies: RIC IE
8866355199e0SJouni Malinen  * @ric_ies_len: length of the RIC IE in bytes
8867355199e0SJouni Malinen  */
8868355199e0SJouni Malinen struct cfg80211_ft_event_params {
8869355199e0SJouni Malinen 	const u8 *ies;
8870355199e0SJouni Malinen 	size_t ies_len;
8871355199e0SJouni Malinen 	const u8 *target_ap;
8872355199e0SJouni Malinen 	const u8 *ric_ies;
8873355199e0SJouni Malinen 	size_t ric_ies_len;
8874355199e0SJouni Malinen };
8875355199e0SJouni Malinen 
8876355199e0SJouni Malinen /**
8877355199e0SJouni Malinen  * cfg80211_ft_event - notify userspace about FT IE and RIC IE
8878355199e0SJouni Malinen  * @netdev: network device
8879355199e0SJouni Malinen  * @ft_event: IE information
8880355199e0SJouni Malinen  */
8881355199e0SJouni Malinen void cfg80211_ft_event(struct net_device *netdev,
8882355199e0SJouni Malinen 		       struct cfg80211_ft_event_params *ft_event);
8883355199e0SJouni Malinen 
8884355199e0SJouni Malinen /**
88850ee45355SJohannes Berg  * cfg80211_get_p2p_attr - find and copy a P2P attribute from IE buffer
88860ee45355SJohannes Berg  * @ies: the input IE buffer
88870ee45355SJohannes Berg  * @len: the input length
88880ee45355SJohannes Berg  * @attr: the attribute ID to find
88890ee45355SJohannes Berg  * @buf: output buffer, can be %NULL if the data isn't needed, e.g.
88900ee45355SJohannes Berg  *	if the function is only called to get the needed buffer size
88910ee45355SJohannes Berg  * @bufsize: size of the output buffer
88920ee45355SJohannes Berg  *
88930ee45355SJohannes Berg  * The function finds a given P2P attribute in the (vendor) IEs and
88940ee45355SJohannes Berg  * copies its contents to the given buffer.
88950ee45355SJohannes Berg  *
88960ae997dcSYacine Belkadi  * Return: A negative error code (-%EILSEQ or -%ENOENT) if the data is
88970ae997dcSYacine Belkadi  * malformed or the attribute can't be found (respectively), or the
88980ae997dcSYacine Belkadi  * length of the found attribute (which can be zero).
88990ee45355SJohannes Berg  */
8900c216e641SArend van Spriel int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len,
8901c216e641SArend van Spriel 			  enum ieee80211_p2p_attr_id attr,
8902c216e641SArend van Spriel 			  u8 *buf, unsigned int bufsize);
89030ee45355SJohannes Berg 
8904cd8f7cb4SJohannes Berg /**
890529464cccSJohannes Berg  * ieee80211_ie_split_ric - split an IE buffer according to ordering (with RIC)
890629464cccSJohannes Berg  * @ies: the IE buffer
890729464cccSJohannes Berg  * @ielen: the length of the IE buffer
890829464cccSJohannes Berg  * @ids: an array with element IDs that are allowed before
89092512b1b1SLiad Kaufman  *	the split. A WLAN_EID_EXTENSION value means that the next
89102512b1b1SLiad Kaufman  *	EID in the list is a sub-element of the EXTENSION IE.
891129464cccSJohannes Berg  * @n_ids: the size of the element ID array
891229464cccSJohannes Berg  * @after_ric: array IE types that come after the RIC element
891329464cccSJohannes Berg  * @n_after_ric: size of the @after_ric array
891429464cccSJohannes Berg  * @offset: offset where to start splitting in the buffer
891529464cccSJohannes Berg  *
891629464cccSJohannes Berg  * This function splits an IE buffer by updating the @offset
891729464cccSJohannes Berg  * variable to point to the location where the buffer should be
891829464cccSJohannes Berg  * split.
891929464cccSJohannes Berg  *
892029464cccSJohannes Berg  * It assumes that the given IE buffer is well-formed, this
892129464cccSJohannes Berg  * has to be guaranteed by the caller!
892229464cccSJohannes Berg  *
892329464cccSJohannes Berg  * It also assumes that the IEs in the buffer are ordered
892429464cccSJohannes Berg  * correctly, if not the result of using this function will not
892529464cccSJohannes Berg  * be ordered correctly either, i.e. it does no reordering.
892629464cccSJohannes Berg  *
892729464cccSJohannes Berg  * The function returns the offset where the next part of the
892829464cccSJohannes Berg  * buffer starts, which may be @ielen if the entire (remainder)
892929464cccSJohannes Berg  * of the buffer should be used.
893029464cccSJohannes Berg  */
893129464cccSJohannes Berg size_t ieee80211_ie_split_ric(const u8 *ies, size_t ielen,
893229464cccSJohannes Berg 			      const u8 *ids, int n_ids,
893329464cccSJohannes Berg 			      const u8 *after_ric, int n_after_ric,
893429464cccSJohannes Berg 			      size_t offset);
893529464cccSJohannes Berg 
893629464cccSJohannes Berg /**
893729464cccSJohannes Berg  * ieee80211_ie_split - split an IE buffer according to ordering
893829464cccSJohannes Berg  * @ies: the IE buffer
893929464cccSJohannes Berg  * @ielen: the length of the IE buffer
894029464cccSJohannes Berg  * @ids: an array with element IDs that are allowed before
89412512b1b1SLiad Kaufman  *	the split. A WLAN_EID_EXTENSION value means that the next
89422512b1b1SLiad Kaufman  *	EID in the list is a sub-element of the EXTENSION IE.
894329464cccSJohannes Berg  * @n_ids: the size of the element ID array
894429464cccSJohannes Berg  * @offset: offset where to start splitting in the buffer
894529464cccSJohannes Berg  *
894629464cccSJohannes Berg  * This function splits an IE buffer by updating the @offset
894729464cccSJohannes Berg  * variable to point to the location where the buffer should be
894829464cccSJohannes Berg  * split.
894929464cccSJohannes Berg  *
895029464cccSJohannes Berg  * It assumes that the given IE buffer is well-formed, this
895129464cccSJohannes Berg  * has to be guaranteed by the caller!
895229464cccSJohannes Berg  *
895329464cccSJohannes Berg  * It also assumes that the IEs in the buffer are ordered
895429464cccSJohannes Berg  * correctly, if not the result of using this function will not
895529464cccSJohannes Berg  * be ordered correctly either, i.e. it does no reordering.
895629464cccSJohannes Berg  *
895729464cccSJohannes Berg  * The function returns the offset where the next part of the
895829464cccSJohannes Berg  * buffer starts, which may be @ielen if the entire (remainder)
895929464cccSJohannes Berg  * of the buffer should be used.
896029464cccSJohannes Berg  */
89610483eeacSJohannes Berg static inline size_t ieee80211_ie_split(const u8 *ies, size_t ielen,
89620483eeacSJohannes Berg 					const u8 *ids, int n_ids, size_t offset)
89630483eeacSJohannes Berg {
89640483eeacSJohannes Berg 	return ieee80211_ie_split_ric(ies, ielen, ids, n_ids, NULL, 0, offset);
89650483eeacSJohannes Berg }
896629464cccSJohannes Berg 
896729464cccSJohannes Berg /**
89685806ef25SBenjamin Berg  * ieee80211_fragment_element - fragment the last element in skb
89695806ef25SBenjamin Berg  * @skb: The skbuf that the element was added to
89705806ef25SBenjamin Berg  * @len_pos: Pointer to length of the element to fragment
89715806ef25SBenjamin Berg  * @frag_id: The element ID to use for fragments
89725806ef25SBenjamin Berg  *
89735806ef25SBenjamin Berg  * This function fragments all data after @len_pos, adding fragmentation
89745806ef25SBenjamin Berg  * elements with the given ID as appropriate. The SKB will grow in size
89755806ef25SBenjamin Berg  * accordingly.
89765806ef25SBenjamin Berg  */
89775806ef25SBenjamin Berg void ieee80211_fragment_element(struct sk_buff *skb, u8 *len_pos, u8 frag_id);
89785806ef25SBenjamin Berg 
89795806ef25SBenjamin Berg /**
8980cd8f7cb4SJohannes Berg  * cfg80211_report_wowlan_wakeup - report wakeup from WoWLAN
8981cd8f7cb4SJohannes Berg  * @wdev: the wireless device reporting the wakeup
8982cd8f7cb4SJohannes Berg  * @wakeup: the wakeup report
8983cd8f7cb4SJohannes Berg  * @gfp: allocation flags
8984cd8f7cb4SJohannes Berg  *
8985cd8f7cb4SJohannes Berg  * This function reports that the given device woke up. If it
8986cd8f7cb4SJohannes Berg  * caused the wakeup, report the reason(s), otherwise you may
8987cd8f7cb4SJohannes Berg  * pass %NULL as the @wakeup parameter to advertise that something
8988cd8f7cb4SJohannes Berg  * else caused the wakeup.
8989cd8f7cb4SJohannes Berg  */
8990cd8f7cb4SJohannes Berg void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev,
8991cd8f7cb4SJohannes Berg 				   struct cfg80211_wowlan_wakeup *wakeup,
8992cd8f7cb4SJohannes Berg 				   gfp_t gfp);
8993cd8f7cb4SJohannes Berg 
89945de17984SArend van Spriel /**
89955de17984SArend van Spriel  * cfg80211_crit_proto_stopped() - indicate critical protocol stopped by driver.
89965de17984SArend van Spriel  *
89975de17984SArend van Spriel  * @wdev: the wireless device for which critical protocol is stopped.
899803f831a6SRobert P. J. Day  * @gfp: allocation flags
89995de17984SArend van Spriel  *
90005de17984SArend van Spriel  * This function can be called by the driver to indicate it has reverted
90015de17984SArend van Spriel  * operation back to normal. One reason could be that the duration given
90025de17984SArend van Spriel  * by .crit_proto_start() has expired.
90035de17984SArend van Spriel  */
90045de17984SArend van Spriel void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp);
90055de17984SArend van Spriel 
9006bdfbec2dSIlan Peer /**
9007bdfbec2dSIlan Peer  * ieee80211_get_num_supported_channels - get number of channels device has
9008bdfbec2dSIlan Peer  * @wiphy: the wiphy
9009bdfbec2dSIlan Peer  *
9010bdfbec2dSIlan Peer  * Return: the number of channels supported by the device.
9011bdfbec2dSIlan Peer  */
9012bdfbec2dSIlan Peer unsigned int ieee80211_get_num_supported_channels(struct wiphy *wiphy);
9013bdfbec2dSIlan Peer 
9014cb2d956dSLuciano Coelho /**
9015cb2d956dSLuciano Coelho  * cfg80211_check_combinations - check interface combinations
9016cb2d956dSLuciano Coelho  *
9017cb2d956dSLuciano Coelho  * @wiphy: the wiphy
9018e227300cSPurushottam Kushwaha  * @params: the interface combinations parameter
9019cb2d956dSLuciano Coelho  *
9020cb2d956dSLuciano Coelho  * This function can be called by the driver to check whether a
9021cb2d956dSLuciano Coelho  * combination of interfaces and their types are allowed according to
9022cb2d956dSLuciano Coelho  * the interface combinations.
9023cb2d956dSLuciano Coelho  */
9024cb2d956dSLuciano Coelho int cfg80211_check_combinations(struct wiphy *wiphy,
9025e227300cSPurushottam Kushwaha 				struct iface_combination_params *params);
9026cb2d956dSLuciano Coelho 
902765a124ddSMichal Kazior /**
902865a124ddSMichal Kazior  * cfg80211_iter_combinations - iterate over matching combinations
902965a124ddSMichal Kazior  *
903065a124ddSMichal Kazior  * @wiphy: the wiphy
9031e227300cSPurushottam Kushwaha  * @params: the interface combinations parameter
903265a124ddSMichal Kazior  * @iter: function to call for each matching combination
903365a124ddSMichal Kazior  * @data: pointer to pass to iter function
903465a124ddSMichal Kazior  *
903565a124ddSMichal Kazior  * This function can be called by the driver to check what possible
903665a124ddSMichal Kazior  * combinations it fits in at a given moment, e.g. for channel switching
903765a124ddSMichal Kazior  * purposes.
903865a124ddSMichal Kazior  */
903965a124ddSMichal Kazior int cfg80211_iter_combinations(struct wiphy *wiphy,
9040e227300cSPurushottam Kushwaha 			       struct iface_combination_params *params,
904165a124ddSMichal Kazior 			       void (*iter)(const struct ieee80211_iface_combination *c,
904265a124ddSMichal Kazior 					    void *data),
904365a124ddSMichal Kazior 			       void *data);
904465a124ddSMichal Kazior 
9045f04c2203SMichal Kazior /*
9046f04c2203SMichal Kazior  * cfg80211_stop_iface - trigger interface disconnection
9047f04c2203SMichal Kazior  *
9048f04c2203SMichal Kazior  * @wiphy: the wiphy
9049f04c2203SMichal Kazior  * @wdev: wireless device
9050f04c2203SMichal Kazior  * @gfp: context flags
9051f04c2203SMichal Kazior  *
9052f04c2203SMichal Kazior  * Trigger interface to be stopped as if AP was stopped, IBSS/mesh left, STA
9053f04c2203SMichal Kazior  * disconnected.
9054f04c2203SMichal Kazior  *
9055f04c2203SMichal Kazior  * Note: This doesn't need any locks and is asynchronous.
9056f04c2203SMichal Kazior  */
9057f04c2203SMichal Kazior void cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev,
9058f04c2203SMichal Kazior 			 gfp_t gfp);
9059f04c2203SMichal Kazior 
9060f6837ba8SJohannes Berg /**
9061f6837ba8SJohannes Berg  * cfg80211_shutdown_all_interfaces - shut down all interfaces for a wiphy
9062f6837ba8SJohannes Berg  * @wiphy: the wiphy to shut down
9063f6837ba8SJohannes Berg  *
9064f6837ba8SJohannes Berg  * This function shuts down all interfaces belonging to this wiphy by
9065f6837ba8SJohannes Berg  * calling dev_close() (and treating non-netdev interfaces as needed).
9066f6837ba8SJohannes Berg  * It shouldn't really be used unless there are some fatal device errors
9067f6837ba8SJohannes Berg  * that really can't be recovered in any other way.
9068f6837ba8SJohannes Berg  *
9069f6837ba8SJohannes Berg  * Callers must hold the RTNL and be able to deal with callbacks into
9070f6837ba8SJohannes Berg  * the driver while the function is running.
9071f6837ba8SJohannes Berg  */
9072f6837ba8SJohannes Berg void cfg80211_shutdown_all_interfaces(struct wiphy *wiphy);
9073f6837ba8SJohannes Berg 
9074d75bb06bSGautam Kumar Shukla /**
9075d75bb06bSGautam Kumar Shukla  * wiphy_ext_feature_set - set the extended feature flag
9076d75bb06bSGautam Kumar Shukla  *
9077d75bb06bSGautam Kumar Shukla  * @wiphy: the wiphy to modify.
9078d75bb06bSGautam Kumar Shukla  * @ftidx: extended feature bit index.
9079d75bb06bSGautam Kumar Shukla  *
9080d75bb06bSGautam Kumar Shukla  * The extended features are flagged in multiple bytes (see
9081d75bb06bSGautam Kumar Shukla  * &struct wiphy.@ext_features)
9082d75bb06bSGautam Kumar Shukla  */
9083d75bb06bSGautam Kumar Shukla static inline void wiphy_ext_feature_set(struct wiphy *wiphy,
9084d75bb06bSGautam Kumar Shukla 					 enum nl80211_ext_feature_index ftidx)
9085d75bb06bSGautam Kumar Shukla {
9086d75bb06bSGautam Kumar Shukla 	u8 *ft_byte;
9087d75bb06bSGautam Kumar Shukla 
9088d75bb06bSGautam Kumar Shukla 	ft_byte = &wiphy->ext_features[ftidx / 8];
9089d75bb06bSGautam Kumar Shukla 	*ft_byte |= BIT(ftidx % 8);
9090d75bb06bSGautam Kumar Shukla }
9091d75bb06bSGautam Kumar Shukla 
9092d75bb06bSGautam Kumar Shukla /**
9093d75bb06bSGautam Kumar Shukla  * wiphy_ext_feature_isset - check the extended feature flag
9094d75bb06bSGautam Kumar Shukla  *
9095d75bb06bSGautam Kumar Shukla  * @wiphy: the wiphy to modify.
9096d75bb06bSGautam Kumar Shukla  * @ftidx: extended feature bit index.
9097d75bb06bSGautam Kumar Shukla  *
9098d75bb06bSGautam Kumar Shukla  * The extended features are flagged in multiple bytes (see
9099d75bb06bSGautam Kumar Shukla  * &struct wiphy.@ext_features)
9100d75bb06bSGautam Kumar Shukla  */
9101d75bb06bSGautam Kumar Shukla static inline bool
9102d75bb06bSGautam Kumar Shukla wiphy_ext_feature_isset(struct wiphy *wiphy,
9103d75bb06bSGautam Kumar Shukla 			enum nl80211_ext_feature_index ftidx)
9104d75bb06bSGautam Kumar Shukla {
9105d75bb06bSGautam Kumar Shukla 	u8 ft_byte;
9106d75bb06bSGautam Kumar Shukla 
9107d75bb06bSGautam Kumar Shukla 	ft_byte = wiphy->ext_features[ftidx / 8];
9108d75bb06bSGautam Kumar Shukla 	return (ft_byte & BIT(ftidx % 8)) != 0;
9109d75bb06bSGautam Kumar Shukla }
9110b7ffbd7eSJohannes Berg 
9111a442b761SAyala Beker /**
9112a442b761SAyala Beker  * cfg80211_free_nan_func - free NAN function
9113a442b761SAyala Beker  * @f: NAN function that should be freed
9114a442b761SAyala Beker  *
9115a442b761SAyala Beker  * Frees all the NAN function and all it's allocated members.
9116a442b761SAyala Beker  */
9117a442b761SAyala Beker void cfg80211_free_nan_func(struct cfg80211_nan_func *f);
9118a442b761SAyala Beker 
911950bcd31dSAyala Beker /**
912050bcd31dSAyala Beker  * struct cfg80211_nan_match_params - NAN match parameters
912150bcd31dSAyala Beker  * @type: the type of the function that triggered a match. If it is
912250bcd31dSAyala Beker  *	 %NL80211_NAN_FUNC_SUBSCRIBE it means that we replied to a subscriber.
912350bcd31dSAyala Beker  *	 If it is %NL80211_NAN_FUNC_PUBLISH, it means that we got a discovery
912450bcd31dSAyala Beker  *	 result.
912550bcd31dSAyala Beker  *	 If it is %NL80211_NAN_FUNC_FOLLOW_UP, we received a follow up.
912650bcd31dSAyala Beker  * @inst_id: the local instance id
912750bcd31dSAyala Beker  * @peer_inst_id: the instance id of the peer's function
912850bcd31dSAyala Beker  * @addr: the MAC address of the peer
912950bcd31dSAyala Beker  * @info_len: the length of the &info
913050bcd31dSAyala Beker  * @info: the Service Specific Info from the peer (if any)
913150bcd31dSAyala Beker  * @cookie: unique identifier of the corresponding function
913250bcd31dSAyala Beker  */
913350bcd31dSAyala Beker struct cfg80211_nan_match_params {
913450bcd31dSAyala Beker 	enum nl80211_nan_function_type type;
913550bcd31dSAyala Beker 	u8 inst_id;
913650bcd31dSAyala Beker 	u8 peer_inst_id;
913750bcd31dSAyala Beker 	const u8 *addr;
913850bcd31dSAyala Beker 	u8 info_len;
913950bcd31dSAyala Beker 	const u8 *info;
914050bcd31dSAyala Beker 	u64 cookie;
914150bcd31dSAyala Beker };
914250bcd31dSAyala Beker 
914350bcd31dSAyala Beker /**
914450bcd31dSAyala Beker  * cfg80211_nan_match - report a match for a NAN function.
914550bcd31dSAyala Beker  * @wdev: the wireless device reporting the match
914650bcd31dSAyala Beker  * @match: match notification parameters
914750bcd31dSAyala Beker  * @gfp: allocation flags
914850bcd31dSAyala Beker  *
914950bcd31dSAyala Beker  * This function reports that the a NAN function had a match. This
915050bcd31dSAyala Beker  * can be a subscribe that had a match or a solicited publish that
915150bcd31dSAyala Beker  * was sent. It can also be a follow up that was received.
915250bcd31dSAyala Beker  */
915350bcd31dSAyala Beker void cfg80211_nan_match(struct wireless_dev *wdev,
915450bcd31dSAyala Beker 			struct cfg80211_nan_match_params *match, gfp_t gfp);
915550bcd31dSAyala Beker 
9156368e5a7bSAyala Beker /**
9157368e5a7bSAyala Beker  * cfg80211_nan_func_terminated - notify about NAN function termination.
9158368e5a7bSAyala Beker  *
9159368e5a7bSAyala Beker  * @wdev: the wireless device reporting the match
9160368e5a7bSAyala Beker  * @inst_id: the local instance id
9161368e5a7bSAyala Beker  * @reason: termination reason (one of the NL80211_NAN_FUNC_TERM_REASON_*)
9162368e5a7bSAyala Beker  * @cookie: unique NAN function identifier
9163368e5a7bSAyala Beker  * @gfp: allocation flags
9164368e5a7bSAyala Beker  *
9165368e5a7bSAyala Beker  * This function reports that the a NAN function is terminated.
9166368e5a7bSAyala Beker  */
9167368e5a7bSAyala Beker void cfg80211_nan_func_terminated(struct wireless_dev *wdev,
9168368e5a7bSAyala Beker 				  u8 inst_id,
9169368e5a7bSAyala Beker 				  enum nl80211_nan_func_term_reason reason,
9170368e5a7bSAyala Beker 				  u64 cookie, gfp_t gfp);
9171368e5a7bSAyala Beker 
9172b7ffbd7eSJohannes Berg /* ethtool helper */
9173b7ffbd7eSJohannes Berg void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info);
9174b7ffbd7eSJohannes Berg 
917540cbfa90SSrinivas Dasari /**
917640cbfa90SSrinivas Dasari  * cfg80211_external_auth_request - userspace request for authentication
917740cbfa90SSrinivas Dasari  * @netdev: network device
917840cbfa90SSrinivas Dasari  * @params: External authentication parameters
917940cbfa90SSrinivas Dasari  * @gfp: allocation flags
918040cbfa90SSrinivas Dasari  * Returns: 0 on success, < 0 on error
918140cbfa90SSrinivas Dasari  */
918240cbfa90SSrinivas Dasari int cfg80211_external_auth_request(struct net_device *netdev,
918340cbfa90SSrinivas Dasari 				   struct cfg80211_external_auth_params *params,
918440cbfa90SSrinivas Dasari 				   gfp_t gfp);
918540cbfa90SSrinivas Dasari 
91869bb7e0f2SJohannes Berg /**
91879bb7e0f2SJohannes Berg  * cfg80211_pmsr_report - report peer measurement result data
91889bb7e0f2SJohannes Berg  * @wdev: the wireless device reporting the measurement
91899bb7e0f2SJohannes Berg  * @req: the original measurement request
91909bb7e0f2SJohannes Berg  * @result: the result data
91919bb7e0f2SJohannes Berg  * @gfp: allocation flags
91929bb7e0f2SJohannes Berg  */
91939bb7e0f2SJohannes Berg void cfg80211_pmsr_report(struct wireless_dev *wdev,
91949bb7e0f2SJohannes Berg 			  struct cfg80211_pmsr_request *req,
91959bb7e0f2SJohannes Berg 			  struct cfg80211_pmsr_result *result,
91969bb7e0f2SJohannes Berg 			  gfp_t gfp);
91979bb7e0f2SJohannes Berg 
91989bb7e0f2SJohannes Berg /**
91999bb7e0f2SJohannes Berg  * cfg80211_pmsr_complete - report peer measurement completed
92009bb7e0f2SJohannes Berg  * @wdev: the wireless device reporting the measurement
92019bb7e0f2SJohannes Berg  * @req: the original measurement request
92029bb7e0f2SJohannes Berg  * @gfp: allocation flags
92039bb7e0f2SJohannes Berg  *
92049bb7e0f2SJohannes Berg  * Report that the entire measurement completed, after this
92059bb7e0f2SJohannes Berg  * the request pointer will no longer be valid.
92069bb7e0f2SJohannes Berg  */
92079bb7e0f2SJohannes Berg void cfg80211_pmsr_complete(struct wireless_dev *wdev,
92089bb7e0f2SJohannes Berg 			    struct cfg80211_pmsr_request *req,
92099bb7e0f2SJohannes Berg 			    gfp_t gfp);
92109bb7e0f2SJohannes Berg 
9211e6f40511SManikanta Pubbisetty /**
9212e6f40511SManikanta Pubbisetty  * cfg80211_iftype_allowed - check whether the interface can be allowed
9213e6f40511SManikanta Pubbisetty  * @wiphy: the wiphy
9214e6f40511SManikanta Pubbisetty  * @iftype: interface type
9215e6f40511SManikanta Pubbisetty  * @is_4addr: use_4addr flag, must be '0' when check_swif is '1'
9216e6f40511SManikanta Pubbisetty  * @check_swif: check iftype against software interfaces
9217e6f40511SManikanta Pubbisetty  *
9218e6f40511SManikanta Pubbisetty  * Check whether the interface is allowed to operate; additionally, this API
9219e6f40511SManikanta Pubbisetty  * can be used to check iftype against the software interfaces when
9220e6f40511SManikanta Pubbisetty  * check_swif is '1'.
9221e6f40511SManikanta Pubbisetty  */
9222e6f40511SManikanta Pubbisetty bool cfg80211_iftype_allowed(struct wiphy *wiphy, enum nl80211_iftype iftype,
9223e6f40511SManikanta Pubbisetty 			     bool is_4addr, u8 check_swif);
9224e6f40511SManikanta Pubbisetty 
9225e6f40511SManikanta Pubbisetty 
9226a083ee8aSIlan Peer /**
9227a083ee8aSIlan Peer  * cfg80211_assoc_comeback - notification of association that was
922898e0c7f8SRandy Dunlap  * temporarily rejected with a comeback
9229a083ee8aSIlan Peer  * @netdev: network device
923098e0c7f8SRandy Dunlap  * @ap_addr: AP (MLD) address that rejected the association
9231a083ee8aSIlan Peer  * @timeout: timeout interval value TUs.
9232a083ee8aSIlan Peer  *
9233a083ee8aSIlan Peer  * this function may sleep. the caller must hold the corresponding wdev's mutex.
9234a083ee8aSIlan Peer  */
9235a083ee8aSIlan Peer void cfg80211_assoc_comeback(struct net_device *netdev,
9236e69dac88SJohannes Berg 			     const u8 *ap_addr, u32 timeout);
9237a083ee8aSIlan Peer 
9238e1db74fcSJoe Perches /* Logging, debugging and troubleshooting/diagnostic helpers. */
9239e1db74fcSJoe Perches 
9240e1db74fcSJoe Perches /* wiphy_printk helpers, similar to dev_printk */
9241e1db74fcSJoe Perches 
9242e1db74fcSJoe Perches #define wiphy_printk(level, wiphy, format, args...)		\
92439c376639SJoe Perches 	dev_printk(level, &(wiphy)->dev, format, ##args)
9244e1db74fcSJoe Perches #define wiphy_emerg(wiphy, format, args...)			\
92459c376639SJoe Perches 	dev_emerg(&(wiphy)->dev, format, ##args)
9246e1db74fcSJoe Perches #define wiphy_alert(wiphy, format, args...)			\
92479c376639SJoe Perches 	dev_alert(&(wiphy)->dev, format, ##args)
9248e1db74fcSJoe Perches #define wiphy_crit(wiphy, format, args...)			\
92499c376639SJoe Perches 	dev_crit(&(wiphy)->dev, format, ##args)
9250e1db74fcSJoe Perches #define wiphy_err(wiphy, format, args...)			\
92519c376639SJoe Perches 	dev_err(&(wiphy)->dev, format, ##args)
9252e1db74fcSJoe Perches #define wiphy_warn(wiphy, format, args...)			\
92539c376639SJoe Perches 	dev_warn(&(wiphy)->dev, format, ##args)
9254e1db74fcSJoe Perches #define wiphy_notice(wiphy, format, args...)			\
92559c376639SJoe Perches 	dev_notice(&(wiphy)->dev, format, ##args)
9256e1db74fcSJoe Perches #define wiphy_info(wiphy, format, args...)			\
92579c376639SJoe Perches 	dev_info(&(wiphy)->dev, format, ##args)
9258761025b5SDmitry Osipenko #define wiphy_info_once(wiphy, format, args...)			\
9259761025b5SDmitry Osipenko 	dev_info_once(&(wiphy)->dev, format, ##args)
9260073730d7SJoe Perches 
9261a58d7525SStanislaw Gruszka #define wiphy_err_ratelimited(wiphy, format, args...)		\
9262a58d7525SStanislaw Gruszka 	dev_err_ratelimited(&(wiphy)->dev, format, ##args)
9263a58d7525SStanislaw Gruszka #define wiphy_warn_ratelimited(wiphy, format, args...)		\
9264a58d7525SStanislaw Gruszka 	dev_warn_ratelimited(&(wiphy)->dev, format, ##args)
9265a58d7525SStanislaw Gruszka 
92669c376639SJoe Perches #define wiphy_debug(wiphy, format, args...)			\
9267e1db74fcSJoe Perches 	wiphy_printk(KERN_DEBUG, wiphy, format, ##args)
92689c376639SJoe Perches 
9269e1db74fcSJoe Perches #define wiphy_dbg(wiphy, format, args...)			\
92709c376639SJoe Perches 	dev_dbg(&(wiphy)->dev, format, ##args)
9271e1db74fcSJoe Perches 
9272e1db74fcSJoe Perches #if defined(VERBOSE_DEBUG)
9273e1db74fcSJoe Perches #define wiphy_vdbg	wiphy_dbg
9274e1db74fcSJoe Perches #else
9275e1db74fcSJoe Perches #define wiphy_vdbg(wiphy, format, args...)				\
9276e1db74fcSJoe Perches ({									\
9277e1db74fcSJoe Perches 	if (0)								\
9278e1db74fcSJoe Perches 		wiphy_printk(KERN_DEBUG, wiphy, format, ##args);	\
9279e1db74fcSJoe Perches 	0;								\
9280e1db74fcSJoe Perches })
9281e1db74fcSJoe Perches #endif
9282e1db74fcSJoe Perches 
9283e1db74fcSJoe Perches /*
9284e1db74fcSJoe Perches  * wiphy_WARN() acts like wiphy_printk(), but with the key difference
9285e1db74fcSJoe Perches  * of using a WARN/WARN_ON to get the message out, including the
9286e1db74fcSJoe Perches  * file/line information and a backtrace.
9287e1db74fcSJoe Perches  */
9288e1db74fcSJoe Perches #define wiphy_WARN(wiphy, format, args...)			\
9289e1db74fcSJoe Perches 	WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args);
9290e1db74fcSJoe Perches 
9291cb74e977SSunil Dutt /**
9292cb74e977SSunil Dutt  * cfg80211_update_owe_info_event - Notify the peer's OWE info to user space
9293cb74e977SSunil Dutt  * @netdev: network device
9294cb74e977SSunil Dutt  * @owe_info: peer's owe info
9295cb74e977SSunil Dutt  * @gfp: allocation flags
9296cb74e977SSunil Dutt  */
9297cb74e977SSunil Dutt void cfg80211_update_owe_info_event(struct net_device *netdev,
9298cb74e977SSunil Dutt 				    struct cfg80211_update_owe_info *owe_info,
9299cb74e977SSunil Dutt 				    gfp_t gfp);
9300cb74e977SSunil Dutt 
93012f1805eaSEmmanuel Grumbach /**
93022f1805eaSEmmanuel Grumbach  * cfg80211_bss_flush - resets all the scan entries
93032f1805eaSEmmanuel Grumbach  * @wiphy: the wiphy
93042f1805eaSEmmanuel Grumbach  */
93052f1805eaSEmmanuel Grumbach void cfg80211_bss_flush(struct wiphy *wiphy);
93062f1805eaSEmmanuel Grumbach 
93070d2ab3aeSJohn Crispin /**
93080d2ab3aeSJohn Crispin  * cfg80211_bss_color_notify - notify about bss color event
93090d2ab3aeSJohn Crispin  * @dev: network device
93100d2ab3aeSJohn Crispin  * @cmd: the actual event we want to notify
93110d2ab3aeSJohn Crispin  * @count: the number of TBTTs until the color change happens
93120d2ab3aeSJohn Crispin  * @color_bitmap: representations of the colors that the local BSS is aware of
93130d2ab3aeSJohn Crispin  */
9314935ef47bSLorenzo Bianconi int cfg80211_bss_color_notify(struct net_device *dev,
93150d2ab3aeSJohn Crispin 			      enum nl80211_commands cmd, u8 count,
93160d2ab3aeSJohn Crispin 			      u64 color_bitmap);
93170d2ab3aeSJohn Crispin 
93180d2ab3aeSJohn Crispin /**
93190d2ab3aeSJohn Crispin  * cfg80211_obss_color_collision_notify - notify about bss color collision
93200d2ab3aeSJohn Crispin  * @dev: network device
93210d2ab3aeSJohn Crispin  * @color_bitmap: representations of the colors that the local BSS is aware of
93220d2ab3aeSJohn Crispin  */
93230d2ab3aeSJohn Crispin static inline int cfg80211_obss_color_collision_notify(struct net_device *dev,
9324935ef47bSLorenzo Bianconi 						       u64 color_bitmap)
93250d2ab3aeSJohn Crispin {
9326935ef47bSLorenzo Bianconi 	return cfg80211_bss_color_notify(dev, NL80211_CMD_OBSS_COLOR_COLLISION,
93270d2ab3aeSJohn Crispin 					 0, color_bitmap);
93280d2ab3aeSJohn Crispin }
93290d2ab3aeSJohn Crispin 
93300d2ab3aeSJohn Crispin /**
93310d2ab3aeSJohn Crispin  * cfg80211_color_change_started_notify - notify color change start
93320d2ab3aeSJohn Crispin  * @dev: the device on which the color is switched
93330d2ab3aeSJohn Crispin  * @count: the number of TBTTs until the color change happens
93340d2ab3aeSJohn Crispin  *
93350d2ab3aeSJohn Crispin  * Inform the userspace about the color change that has started.
93360d2ab3aeSJohn Crispin  */
93370d2ab3aeSJohn Crispin static inline int cfg80211_color_change_started_notify(struct net_device *dev,
93380d2ab3aeSJohn Crispin 						       u8 count)
93390d2ab3aeSJohn Crispin {
9340935ef47bSLorenzo Bianconi 	return cfg80211_bss_color_notify(dev, NL80211_CMD_COLOR_CHANGE_STARTED,
93410d2ab3aeSJohn Crispin 					 count, 0);
93420d2ab3aeSJohn Crispin }
93430d2ab3aeSJohn Crispin 
93440d2ab3aeSJohn Crispin /**
93450d2ab3aeSJohn Crispin  * cfg80211_color_change_aborted_notify - notify color change abort
93460d2ab3aeSJohn Crispin  * @dev: the device on which the color is switched
93470d2ab3aeSJohn Crispin  *
93480d2ab3aeSJohn Crispin  * Inform the userspace about the color change that has aborted.
93490d2ab3aeSJohn Crispin  */
93500d2ab3aeSJohn Crispin static inline int cfg80211_color_change_aborted_notify(struct net_device *dev)
93510d2ab3aeSJohn Crispin {
9352935ef47bSLorenzo Bianconi 	return cfg80211_bss_color_notify(dev, NL80211_CMD_COLOR_CHANGE_ABORTED,
93530d2ab3aeSJohn Crispin 					 0, 0);
93540d2ab3aeSJohn Crispin }
93550d2ab3aeSJohn Crispin 
93560d2ab3aeSJohn Crispin /**
93570d2ab3aeSJohn Crispin  * cfg80211_color_change_notify - notify color change completion
93580d2ab3aeSJohn Crispin  * @dev: the device on which the color was switched
93590d2ab3aeSJohn Crispin  *
93600d2ab3aeSJohn Crispin  * Inform the userspace about the color change that has completed.
93610d2ab3aeSJohn Crispin  */
93620d2ab3aeSJohn Crispin static inline int cfg80211_color_change_notify(struct net_device *dev)
93630d2ab3aeSJohn Crispin {
9364935ef47bSLorenzo Bianconi 	return cfg80211_bss_color_notify(dev,
93650d2ab3aeSJohn Crispin 					 NL80211_CMD_COLOR_CHANGE_COMPLETED,
93660d2ab3aeSJohn Crispin 					 0, 0);
93670d2ab3aeSJohn Crispin }
93680d2ab3aeSJohn Crispin 
9369b25413feSAloka Dixit /**
9370b25413feSAloka Dixit  * cfg80211_valid_disable_subchannel_bitmap - validate puncturing bitmap
9371b25413feSAloka Dixit  * @bitmap: bitmap to be validated
9372b25413feSAloka Dixit  * @chandef: channel definition
9373b25413feSAloka Dixit  *
9374b25413feSAloka Dixit  * Validate the puncturing bitmap.
9375b25413feSAloka Dixit  *
9376b25413feSAloka Dixit  * Return: %true if the bitmap is valid. %false otherwise.
9377b25413feSAloka Dixit  */
9378b25413feSAloka Dixit bool cfg80211_valid_disable_subchannel_bitmap(u16 *bitmap,
9379b25413feSAloka Dixit 					      const struct cfg80211_chan_def *chandef);
9380b25413feSAloka Dixit 
9381065563b2SVeerendranath Jakkam /**
9382065563b2SVeerendranath Jakkam  * cfg80211_links_removed - Notify about removed STA MLD setup links.
9383065563b2SVeerendranath Jakkam  * @dev: network device.
9384065563b2SVeerendranath Jakkam  * @link_mask: BIT mask of removed STA MLD setup link IDs.
9385065563b2SVeerendranath Jakkam  *
9386065563b2SVeerendranath Jakkam  * Inform cfg80211 and the userspace about removed STA MLD setup links due to
9387065563b2SVeerendranath Jakkam  * AP MLD removing the corresponding affiliated APs with Multi-Link
9388065563b2SVeerendranath Jakkam  * reconfiguration. Note that it's not valid to remove all links, in this
9389065563b2SVeerendranath Jakkam  * case disconnect instead.
9390065563b2SVeerendranath Jakkam  * Also note that the wdev mutex must be held.
9391065563b2SVeerendranath Jakkam  */
9392065563b2SVeerendranath Jakkam void cfg80211_links_removed(struct net_device *dev, u16 link_mask);
9393065563b2SVeerendranath Jakkam 
9394b590b9aeSJohannes Berg #ifdef CONFIG_CFG80211_DEBUGFS
9395b590b9aeSJohannes Berg /**
9396b590b9aeSJohannes Berg  * wiphy_locked_debugfs_read - do a locked read in debugfs
9397b590b9aeSJohannes Berg  * @wiphy: the wiphy to use
9398b590b9aeSJohannes Berg  * @file: the file being read
9399b590b9aeSJohannes Berg  * @buf: the buffer to fill and then read from
9400b590b9aeSJohannes Berg  * @bufsize: size of the buffer
9401b590b9aeSJohannes Berg  * @userbuf: the user buffer to copy to
9402b590b9aeSJohannes Berg  * @count: read count
9403b590b9aeSJohannes Berg  * @ppos: read position
9404b590b9aeSJohannes Berg  * @handler: the read handler to call (under wiphy lock)
9405b590b9aeSJohannes Berg  * @data: additional data to pass to the read handler
9406b590b9aeSJohannes Berg  */
9407b590b9aeSJohannes Berg ssize_t wiphy_locked_debugfs_read(struct wiphy *wiphy, struct file *file,
9408b590b9aeSJohannes Berg 				  char *buf, size_t bufsize,
9409b590b9aeSJohannes Berg 				  char __user *userbuf, size_t count,
9410b590b9aeSJohannes Berg 				  loff_t *ppos,
9411b590b9aeSJohannes Berg 				  ssize_t (*handler)(struct wiphy *wiphy,
9412b590b9aeSJohannes Berg 						     struct file *file,
9413b590b9aeSJohannes Berg 						     char *buf,
9414b590b9aeSJohannes Berg 						     size_t bufsize,
9415b590b9aeSJohannes Berg 						     void *data),
9416b590b9aeSJohannes Berg 				  void *data);
9417b590b9aeSJohannes Berg 
9418b590b9aeSJohannes Berg /**
9419b590b9aeSJohannes Berg  * wiphy_locked_debugfs_write - do a locked write in debugfs
9420b590b9aeSJohannes Berg  * @wiphy: the wiphy to use
9421b590b9aeSJohannes Berg  * @file: the file being written to
9422b590b9aeSJohannes Berg  * @buf: the buffer to copy the user data to
9423b590b9aeSJohannes Berg  * @bufsize: size of the buffer
9424b590b9aeSJohannes Berg  * @userbuf: the user buffer to copy from
9425b590b9aeSJohannes Berg  * @count: read count
9426b590b9aeSJohannes Berg  * @handler: the write handler to call (under wiphy lock)
9427b590b9aeSJohannes Berg  * @data: additional data to pass to the write handler
9428b590b9aeSJohannes Berg  */
9429b590b9aeSJohannes Berg ssize_t wiphy_locked_debugfs_write(struct wiphy *wiphy, struct file *file,
9430b590b9aeSJohannes Berg 				   char *buf, size_t bufsize,
9431b590b9aeSJohannes Berg 				   const char __user *userbuf, size_t count,
9432b590b9aeSJohannes Berg 				   ssize_t (*handler)(struct wiphy *wiphy,
9433b590b9aeSJohannes Berg 						      struct file *file,
9434b590b9aeSJohannes Berg 						      char *buf,
9435b590b9aeSJohannes Berg 						      size_t count,
9436b590b9aeSJohannes Berg 						      void *data),
9437b590b9aeSJohannes Berg 				   void *data);
9438b590b9aeSJohannes Berg #endif
9439b590b9aeSJohannes Berg 
9440704232c2SJohannes Berg #endif /* __NET_CFG80211_H */
9441