xref: /linux/include/net/cfg80211.h (revision 9410645520e9b820069761f3450ef6661418e279)
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
10b82730bfSJohannes Berg  * Copyright (C) 2018-2024 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.
12041a313d8SAndrei Otcheretianski  * @IEEE80211_CHAN_DFS_CONCURRENT: See %NL80211_RRF_DFS_CONCURRENT
1217b5e25b8SJohannes Berg  * @IEEE80211_CHAN_NO_6GHZ_VLP_CLIENT: Client connection with VLP AP
122645f3d85SMukesh Sisodiya  *	not permitted using this channel
1237b5e25b8SJohannes Berg  * @IEEE80211_CHAN_NO_6GHZ_AFC_CLIENT: Client connection with AFC AP
124645f3d85SMukesh Sisodiya  *	not permitted using this channel
125a110a3b7SJohannes Berg  * @IEEE80211_CHAN_CAN_MONITOR: This channel can be used for monitor
126a110a3b7SJohannes Berg  *	mode even in the presence of other (regulatory) restrictions,
127a110a3b7SJohannes Berg  *	even if it is otherwise disabled.
128c1d8bd8dSJohannes Berg  * @IEEE80211_CHAN_ALLOW_6GHZ_VLP_AP: Allow using this channel for AP operation
129c1d8bd8dSJohannes Berg  *	with very low power (VLP), even if otherwise set to NO_IR.
130d3236553SJohannes Berg  */
131d3236553SJohannes Berg enum ieee80211_channel_flags {
1328682ad36SJohannes Berg 	IEEE80211_CHAN_DISABLED			= BIT(0),
1338682ad36SJohannes Berg 	IEEE80211_CHAN_NO_IR			= BIT(1),
1348682ad36SJohannes Berg 	IEEE80211_CHAN_PSD			= BIT(2),
1358682ad36SJohannes Berg 	IEEE80211_CHAN_RADAR			= BIT(3),
1368682ad36SJohannes Berg 	IEEE80211_CHAN_NO_HT40PLUS		= BIT(4),
1378682ad36SJohannes Berg 	IEEE80211_CHAN_NO_HT40MINUS		= BIT(5),
1388682ad36SJohannes Berg 	IEEE80211_CHAN_NO_OFDM			= BIT(6),
1398682ad36SJohannes Berg 	IEEE80211_CHAN_NO_80MHZ			= BIT(7),
1408682ad36SJohannes Berg 	IEEE80211_CHAN_NO_160MHZ		= BIT(8),
1418682ad36SJohannes Berg 	IEEE80211_CHAN_INDOOR_ONLY		= BIT(9),
1428682ad36SJohannes Berg 	IEEE80211_CHAN_IR_CONCURRENT		= BIT(10),
1438682ad36SJohannes Berg 	IEEE80211_CHAN_NO_20MHZ			= BIT(11),
1448682ad36SJohannes Berg 	IEEE80211_CHAN_NO_10MHZ			= BIT(12),
1458682ad36SJohannes Berg 	IEEE80211_CHAN_NO_HE			= BIT(13),
1468682ad36SJohannes Berg 	IEEE80211_CHAN_1MHZ			= BIT(14),
1478682ad36SJohannes Berg 	IEEE80211_CHAN_2MHZ			= BIT(15),
1488682ad36SJohannes Berg 	IEEE80211_CHAN_4MHZ			= BIT(16),
1498682ad36SJohannes Berg 	IEEE80211_CHAN_8MHZ			= BIT(17),
1508682ad36SJohannes Berg 	IEEE80211_CHAN_16MHZ			= BIT(18),
1518682ad36SJohannes Berg 	IEEE80211_CHAN_NO_320MHZ		= BIT(19),
1528682ad36SJohannes Berg 	IEEE80211_CHAN_NO_EHT			= BIT(20),
1538682ad36SJohannes Berg 	IEEE80211_CHAN_DFS_CONCURRENT		= BIT(21),
1548682ad36SJohannes Berg 	IEEE80211_CHAN_NO_6GHZ_VLP_CLIENT	= BIT(22),
1558682ad36SJohannes Berg 	IEEE80211_CHAN_NO_6GHZ_AFC_CLIENT	= BIT(23),
1568682ad36SJohannes Berg 	IEEE80211_CHAN_CAN_MONITOR		= BIT(24),
157c1d8bd8dSJohannes Berg 	IEEE80211_CHAN_ALLOW_6GHZ_VLP_AP	= BIT(25),
158d3236553SJohannes Berg };
159d3236553SJohannes Berg 
160038659e7SLuis R. Rodriguez #define IEEE80211_CHAN_NO_HT40 \
161689da1b3SLuis R. Rodriguez 	(IEEE80211_CHAN_NO_HT40PLUS | IEEE80211_CHAN_NO_HT40MINUS)
162038659e7SLuis R. Rodriguez 
16304f39047SSimon Wunderlich #define IEEE80211_DFS_MIN_CAC_TIME_MS		60000
16404f39047SSimon Wunderlich #define IEEE80211_DFS_MIN_NOP_TIME_MS		(30 * 60 * 1000)
16504f39047SSimon Wunderlich 
166d3236553SJohannes Berg /**
167d3236553SJohannes Berg  * struct ieee80211_channel - channel definition
168d3236553SJohannes Berg  *
169d3236553SJohannes Berg  * This structure describes a single channel for use
170d3236553SJohannes Berg  * with cfg80211.
171d3236553SJohannes Berg  *
172d3236553SJohannes Berg  * @center_freq: center frequency in MHz
173934f4c7dSThomas Pedersen  * @freq_offset: offset from @center_freq, in KHz
174d3236553SJohannes Berg  * @hw_value: hardware-specific value for the channel
175d3236553SJohannes Berg  * @flags: channel flags from &enum ieee80211_channel_flags.
176d3236553SJohannes Berg  * @orig_flags: channel flags at registration time, used by regulatory
177d3236553SJohannes Berg  *	code to support devices with additional restrictions
178d3236553SJohannes Berg  * @band: band this channel belongs to.
179d3236553SJohannes Berg  * @max_antenna_gain: maximum antenna gain in dBi
180d3236553SJohannes Berg  * @max_power: maximum transmission power (in dBm)
181eccc068eSHong Wu  * @max_reg_power: maximum regulatory transmission power (in dBm)
182d3236553SJohannes Berg  * @beacon_found: helper to regulatory code to indicate when a beacon
183d3236553SJohannes Berg  *	has been found on this channel. Use regulatory_hint_found_beacon()
18477c2061dSWalter Goldens  *	to enable this, this is useful only on 5 GHz band.
185d3236553SJohannes Berg  * @orig_mag: internal use
186d3236553SJohannes Berg  * @orig_mpwr: internal use
18704f39047SSimon Wunderlich  * @dfs_state: current state of this channel. Only relevant if radar is required
18804f39047SSimon Wunderlich  *	on this channel.
18904f39047SSimon Wunderlich  * @dfs_state_entered: timestamp (jiffies) when the dfs state was entered.
190089027e5SJanusz Dziedzic  * @dfs_cac_ms: DFS CAC time in milliseconds, this is valid for DFS channels.
191ddd7f45cSWen Gong  * @psd: power spectral density (in dBm)
192d3236553SJohannes Berg  */
193d3236553SJohannes Berg struct ieee80211_channel {
19457fbcce3SJohannes Berg 	enum nl80211_band band;
1959cf0a0b4SAlexei Avshalom Lazar 	u32 center_freq;
196934f4c7dSThomas Pedersen 	u16 freq_offset;
197d3236553SJohannes Berg 	u16 hw_value;
198d3236553SJohannes Berg 	u32 flags;
199d3236553SJohannes Berg 	int max_antenna_gain;
200d3236553SJohannes Berg 	int max_power;
201eccc068eSHong Wu 	int max_reg_power;
202d3236553SJohannes Berg 	bool beacon_found;
203d3236553SJohannes Berg 	u32 orig_flags;
204d3236553SJohannes Berg 	int orig_mag, orig_mpwr;
20504f39047SSimon Wunderlich 	enum nl80211_dfs_state dfs_state;
20604f39047SSimon Wunderlich 	unsigned long dfs_state_entered;
207089027e5SJanusz Dziedzic 	unsigned int dfs_cac_ms;
208ddd7f45cSWen Gong 	s8 psd;
209d3236553SJohannes Berg };
210d3236553SJohannes Berg 
211d3236553SJohannes Berg /**
212d3236553SJohannes Berg  * enum ieee80211_rate_flags - rate flags
213d3236553SJohannes Berg  *
214d3236553SJohannes Berg  * Hardware/specification flags for rates. These are structured
215d3236553SJohannes Berg  * in a way that allows using the same bitrate structure for
216d3236553SJohannes Berg  * different bands/PHY modes.
217d3236553SJohannes Berg  *
218d3236553SJohannes Berg  * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short
219d3236553SJohannes Berg  *	preamble on this bitrate; only relevant in 2.4GHz band and
220d3236553SJohannes Berg  *	with CCK rates.
221d3236553SJohannes Berg  * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate
222d3236553SJohannes Berg  *	when used with 802.11a (on the 5 GHz band); filled by the
223d3236553SJohannes Berg  *	core code when registering the wiphy.
224d3236553SJohannes Berg  * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate
225d3236553SJohannes Berg  *	when used with 802.11b (on the 2.4 GHz band); filled by the
226d3236553SJohannes Berg  *	core code when registering the wiphy.
227d3236553SJohannes Berg  * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate
228d3236553SJohannes Berg  *	when used with 802.11g (on the 2.4 GHz band); filled by the
229d3236553SJohannes Berg  *	core code when registering the wiphy.
230d3236553SJohannes Berg  * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode.
23130e74732SSimon Wunderlich  * @IEEE80211_RATE_SUPPORTS_5MHZ: Rate can be used in 5 MHz mode
23230e74732SSimon Wunderlich  * @IEEE80211_RATE_SUPPORTS_10MHZ: Rate can be used in 10 MHz mode
233d3236553SJohannes Berg  */
234d3236553SJohannes Berg enum ieee80211_rate_flags {
2358682ad36SJohannes Berg 	IEEE80211_RATE_SHORT_PREAMBLE	= BIT(0),
2368682ad36SJohannes Berg 	IEEE80211_RATE_MANDATORY_A	= BIT(1),
2378682ad36SJohannes Berg 	IEEE80211_RATE_MANDATORY_B	= BIT(2),
2388682ad36SJohannes Berg 	IEEE80211_RATE_MANDATORY_G	= BIT(3),
2398682ad36SJohannes Berg 	IEEE80211_RATE_ERP_G		= BIT(4),
2408682ad36SJohannes Berg 	IEEE80211_RATE_SUPPORTS_5MHZ	= BIT(5),
2418682ad36SJohannes Berg 	IEEE80211_RATE_SUPPORTS_10MHZ	= BIT(6),
242d3236553SJohannes Berg };
243d3236553SJohannes Berg 
244d3236553SJohannes Berg /**
2456eb18137SDedy Lansky  * enum ieee80211_bss_type - BSS type filter
2466eb18137SDedy Lansky  *
2476eb18137SDedy Lansky  * @IEEE80211_BSS_TYPE_ESS: Infrastructure BSS
2486eb18137SDedy Lansky  * @IEEE80211_BSS_TYPE_PBSS: Personal BSS
2496eb18137SDedy Lansky  * @IEEE80211_BSS_TYPE_IBSS: Independent BSS
2506eb18137SDedy Lansky  * @IEEE80211_BSS_TYPE_MBSS: Mesh BSS
2516eb18137SDedy Lansky  * @IEEE80211_BSS_TYPE_ANY: Wildcard value for matching any BSS type
2526eb18137SDedy Lansky  */
2536eb18137SDedy Lansky enum ieee80211_bss_type {
2546eb18137SDedy Lansky 	IEEE80211_BSS_TYPE_ESS,
2556eb18137SDedy Lansky 	IEEE80211_BSS_TYPE_PBSS,
2566eb18137SDedy Lansky 	IEEE80211_BSS_TYPE_IBSS,
2576eb18137SDedy Lansky 	IEEE80211_BSS_TYPE_MBSS,
2586eb18137SDedy Lansky 	IEEE80211_BSS_TYPE_ANY
2596eb18137SDedy Lansky };
2606eb18137SDedy Lansky 
2616eb18137SDedy Lansky /**
2626eb18137SDedy Lansky  * enum ieee80211_privacy - BSS privacy filter
2636eb18137SDedy Lansky  *
2646eb18137SDedy Lansky  * @IEEE80211_PRIVACY_ON: privacy bit set
2656eb18137SDedy Lansky  * @IEEE80211_PRIVACY_OFF: privacy bit clear
2666eb18137SDedy Lansky  * @IEEE80211_PRIVACY_ANY: Wildcard value for matching any privacy setting
2676eb18137SDedy Lansky  */
2686eb18137SDedy Lansky enum ieee80211_privacy {
2696eb18137SDedy Lansky 	IEEE80211_PRIVACY_ON,
2706eb18137SDedy Lansky 	IEEE80211_PRIVACY_OFF,
2716eb18137SDedy Lansky 	IEEE80211_PRIVACY_ANY
2726eb18137SDedy Lansky };
2736eb18137SDedy Lansky 
2746eb18137SDedy Lansky #define IEEE80211_PRIVACY(x)	\
2756eb18137SDedy Lansky 	((x) ? IEEE80211_PRIVACY_ON : IEEE80211_PRIVACY_OFF)
2766eb18137SDedy Lansky 
2776eb18137SDedy Lansky /**
278d3236553SJohannes Berg  * struct ieee80211_rate - bitrate definition
279d3236553SJohannes Berg  *
280d3236553SJohannes Berg  * This structure describes a bitrate that an 802.11 PHY can
281d3236553SJohannes Berg  * operate with. The two values @hw_value and @hw_value_short
282d3236553SJohannes Berg  * are only for driver use when pointers to this structure are
283d3236553SJohannes Berg  * passed around.
284d3236553SJohannes Berg  *
2851dcf396bSDmitry Antipov  * @flags: rate-specific flags from &enum ieee80211_rate_flags
286d3236553SJohannes Berg  * @bitrate: bitrate in units of 100 Kbps
287d3236553SJohannes Berg  * @hw_value: driver/hardware value for this rate
288d3236553SJohannes Berg  * @hw_value_short: driver/hardware value for this rate when
289d3236553SJohannes Berg  *	short preamble is used
290d3236553SJohannes Berg  */
291d3236553SJohannes Berg struct ieee80211_rate {
292d3236553SJohannes Berg 	u32 flags;
293d3236553SJohannes Berg 	u16 bitrate;
294d3236553SJohannes Berg 	u16 hw_value, hw_value_short;
295d3236553SJohannes Berg };
296d3236553SJohannes Berg 
297d3236553SJohannes Berg /**
298796e90f4SJohn Crispin  * struct ieee80211_he_obss_pd - AP settings for spatial reuse
299796e90f4SJohn Crispin  *
300796e90f4SJohn Crispin  * @enable: is the feature enabled.
301f5bec330SRajkumar Manoharan  * @sr_ctrl: The SR Control field of SRP element.
302f5bec330SRajkumar Manoharan  * @non_srg_max_offset: non-SRG maximum tx power offset
303796e90f4SJohn Crispin  * @min_offset: minimal tx power offset an associated station shall use
304796e90f4SJohn Crispin  * @max_offset: maximum tx power offset an associated station shall use
305f5bec330SRajkumar Manoharan  * @bss_color_bitmap: bitmap that indicates the BSS color values used by
306f5bec330SRajkumar Manoharan  *	members of the SRG
307f5bec330SRajkumar Manoharan  * @partial_bssid_bitmap: bitmap that indicates the partial BSSID values
308f5bec330SRajkumar Manoharan  *	used by members of the SRG
309796e90f4SJohn Crispin  */
310796e90f4SJohn Crispin struct ieee80211_he_obss_pd {
311796e90f4SJohn Crispin 	bool enable;
312f5bec330SRajkumar Manoharan 	u8 sr_ctrl;
313f5bec330SRajkumar Manoharan 	u8 non_srg_max_offset;
314796e90f4SJohn Crispin 	u8 min_offset;
315796e90f4SJohn Crispin 	u8 max_offset;
316f5bec330SRajkumar Manoharan 	u8 bss_color_bitmap[8];
317f5bec330SRajkumar Manoharan 	u8 partial_bssid_bitmap[8];
318796e90f4SJohn Crispin };
319796e90f4SJohn Crispin 
320796e90f4SJohn Crispin /**
3215c5e52d1SJohn Crispin  * struct cfg80211_he_bss_color - AP settings for BSS coloring
3225c5e52d1SJohn Crispin  *
3235c5e52d1SJohn Crispin  * @color: the current color.
32475e6b594SJohannes Berg  * @enabled: HE BSS color is used
3255c5e52d1SJohn Crispin  * @partial: define the AID equation.
3265c5e52d1SJohn Crispin  */
3275c5e52d1SJohn Crispin struct cfg80211_he_bss_color {
3285c5e52d1SJohn Crispin 	u8 color;
32975e6b594SJohannes Berg 	bool enabled;
3305c5e52d1SJohn Crispin 	bool partial;
3315c5e52d1SJohn Crispin };
3325c5e52d1SJohn Crispin 
3335c5e52d1SJohn Crispin /**
334d3236553SJohannes Berg  * struct ieee80211_sta_ht_cap - STA's HT capabilities
335d3236553SJohannes Berg  *
336d3236553SJohannes Berg  * This structure describes most essential parameters needed
337d3236553SJohannes Berg  * to describe 802.11n HT capabilities for an STA.
338d3236553SJohannes Berg  *
339d3236553SJohannes Berg  * @ht_supported: is HT supported by the STA
340d3236553SJohannes Berg  * @cap: HT capabilities map as described in 802.11n spec
341d3236553SJohannes Berg  * @ampdu_factor: Maximum A-MPDU length factor
342d3236553SJohannes Berg  * @ampdu_density: Minimum A-MPDU spacing
343d3236553SJohannes Berg  * @mcs: Supported MCS rates
344d3236553SJohannes Berg  */
345d3236553SJohannes Berg struct ieee80211_sta_ht_cap {
346d3236553SJohannes Berg 	u16 cap; /* use IEEE80211_HT_CAP_ */
347d3236553SJohannes Berg 	bool ht_supported;
348d3236553SJohannes Berg 	u8 ampdu_factor;
349d3236553SJohannes Berg 	u8 ampdu_density;
350d3236553SJohannes Berg 	struct ieee80211_mcs_info mcs;
351d3236553SJohannes Berg };
352d3236553SJohannes Berg 
353d3236553SJohannes Berg /**
354bf0c111eSMahesh Palivela  * struct ieee80211_sta_vht_cap - STA's VHT capabilities
355bf0c111eSMahesh Palivela  *
356bf0c111eSMahesh Palivela  * This structure describes most essential parameters needed
357bf0c111eSMahesh Palivela  * to describe 802.11ac VHT capabilities for an STA.
358bf0c111eSMahesh Palivela  *
359bf0c111eSMahesh Palivela  * @vht_supported: is VHT supported by the STA
360bf0c111eSMahesh Palivela  * @cap: VHT capabilities map as described in 802.11ac spec
361bf0c111eSMahesh Palivela  * @vht_mcs: Supported VHT MCS rates
362bf0c111eSMahesh Palivela  */
363bf0c111eSMahesh Palivela struct ieee80211_sta_vht_cap {
364bf0c111eSMahesh Palivela 	bool vht_supported;
365bf0c111eSMahesh Palivela 	u32 cap; /* use IEEE80211_VHT_CAP_ */
366bf0c111eSMahesh Palivela 	struct ieee80211_vht_mcs_info vht_mcs;
367bf0c111eSMahesh Palivela };
368bf0c111eSMahesh Palivela 
369c4cbaf79SLuca Coelho #define IEEE80211_HE_PPE_THRES_MAX_LEN		25
370c4cbaf79SLuca Coelho 
371c4cbaf79SLuca Coelho /**
372c4cbaf79SLuca Coelho  * struct ieee80211_sta_he_cap - STA's HE capabilities
373c4cbaf79SLuca Coelho  *
374c4cbaf79SLuca Coelho  * This structure describes most essential parameters needed
375c4cbaf79SLuca Coelho  * to describe 802.11ax HE capabilities for a STA.
376c4cbaf79SLuca Coelho  *
377c4cbaf79SLuca Coelho  * @has_he: true iff HE data is valid.
378c4cbaf79SLuca Coelho  * @he_cap_elem: Fixed portion of the HE capabilities element.
379c4cbaf79SLuca Coelho  * @he_mcs_nss_supp: The supported NSS/MCS combinations.
380c4cbaf79SLuca Coelho  * @ppe_thres: Holds the PPE Thresholds data.
381c4cbaf79SLuca Coelho  */
382c4cbaf79SLuca Coelho struct ieee80211_sta_he_cap {
383c4cbaf79SLuca Coelho 	bool has_he;
384c4cbaf79SLuca Coelho 	struct ieee80211_he_cap_elem he_cap_elem;
385c4cbaf79SLuca Coelho 	struct ieee80211_he_mcs_nss_supp he_mcs_nss_supp;
386c4cbaf79SLuca Coelho 	u8 ppe_thres[IEEE80211_HE_PPE_THRES_MAX_LEN];
387c4cbaf79SLuca Coelho };
388c4cbaf79SLuca Coelho 
389c4cbaf79SLuca Coelho /**
3905cd5a8a3SIlan Peer  * struct ieee80211_eht_mcs_nss_supp - EHT max supported NSS per MCS
3915cd5a8a3SIlan Peer  *
3925cd5a8a3SIlan Peer  * See P802.11be_D1.3 Table 9-401k - "Subfields of the Supported EHT-MCS
3935cd5a8a3SIlan Peer  * and NSS Set field"
3945cd5a8a3SIlan Peer  *
3955cd5a8a3SIlan Peer  * @only_20mhz: MCS/NSS support for 20 MHz-only STA.
3962d8b08feSMauro Carvalho Chehab  * @bw: MCS/NSS support for 80, 160 and 320 MHz
3975cd5a8a3SIlan Peer  * @bw._80: MCS/NSS support for BW <= 80 MHz
3985cd5a8a3SIlan Peer  * @bw._160: MCS/NSS support for BW = 160 MHz
3995cd5a8a3SIlan Peer  * @bw._320: MCS/NSS support for BW = 320 MHz
4005cd5a8a3SIlan Peer  */
4015cd5a8a3SIlan Peer struct ieee80211_eht_mcs_nss_supp {
4025cd5a8a3SIlan Peer 	union {
4035cd5a8a3SIlan Peer 		struct ieee80211_eht_mcs_nss_supp_20mhz_only only_20mhz;
4045cd5a8a3SIlan Peer 		struct {
4055cd5a8a3SIlan Peer 			struct ieee80211_eht_mcs_nss_supp_bw _80;
4065cd5a8a3SIlan Peer 			struct ieee80211_eht_mcs_nss_supp_bw _160;
4075cd5a8a3SIlan Peer 			struct ieee80211_eht_mcs_nss_supp_bw _320;
4085cd5a8a3SIlan Peer 		} __packed bw;
4095cd5a8a3SIlan Peer 	} __packed;
4105cd5a8a3SIlan Peer } __packed;
4115cd5a8a3SIlan Peer 
4125cd5a8a3SIlan Peer #define IEEE80211_EHT_PPE_THRES_MAX_LEN		32
4135cd5a8a3SIlan Peer 
4145cd5a8a3SIlan Peer /**
4155cd5a8a3SIlan Peer  * struct ieee80211_sta_eht_cap - STA's EHT capabilities
4165cd5a8a3SIlan Peer  *
4175cd5a8a3SIlan Peer  * This structure describes most essential parameters needed
4185cd5a8a3SIlan Peer  * to describe 802.11be EHT capabilities for a STA.
4195cd5a8a3SIlan Peer  *
4205cd5a8a3SIlan Peer  * @has_eht: true iff EHT data is valid.
4215cd5a8a3SIlan Peer  * @eht_cap_elem: Fixed portion of the eht capabilities element.
4225cd5a8a3SIlan Peer  * @eht_mcs_nss_supp: The supported NSS/MCS combinations.
4235cd5a8a3SIlan Peer  * @eht_ppe_thres: Holds the PPE Thresholds data.
4245cd5a8a3SIlan Peer  */
4255cd5a8a3SIlan Peer struct ieee80211_sta_eht_cap {
4265cd5a8a3SIlan Peer 	bool has_eht;
4275cd5a8a3SIlan Peer 	struct ieee80211_eht_cap_elem_fixed eht_cap_elem;
4285cd5a8a3SIlan Peer 	struct ieee80211_eht_mcs_nss_supp eht_mcs_nss_supp;
4295cd5a8a3SIlan Peer 	u8 eht_ppe_thres[IEEE80211_EHT_PPE_THRES_MAX_LEN];
4305cd5a8a3SIlan Peer };
4315cd5a8a3SIlan Peer 
432e8c18412SJohannes Berg /* sparse defines __CHECKER__; see Documentation/dev-tools/sparse.rst */
433e8c18412SJohannes Berg #ifdef __CHECKER__
434e8c18412SJohannes Berg /*
435e8c18412SJohannes Berg  * This is used to mark the sband->iftype_data pointer which is supposed
436e8c18412SJohannes Berg  * to be an array with special access semantics (per iftype), but a lot
437e8c18412SJohannes Berg  * of code got it wrong in the past, so with this marking sparse will be
438e8c18412SJohannes Berg  * noisy when the pointer is used directly.
439e8c18412SJohannes Berg  */
440e8c18412SJohannes Berg # define __iftd		__attribute__((noderef, address_space(__iftype_data)))
441e8c18412SJohannes Berg #else
442e8c18412SJohannes Berg # define __iftd
443e8c18412SJohannes Berg #endif /* __CHECKER__ */
444e8c18412SJohannes Berg 
4455cd5a8a3SIlan Peer /**
4465d9c358dSRandy Dunlap  * struct ieee80211_sband_iftype_data - sband data per interface type
447c4cbaf79SLuca Coelho  *
448c4cbaf79SLuca Coelho  * This structure encapsulates sband data that is relevant for the
449c4cbaf79SLuca Coelho  * interface types defined in @types_mask.  Each type in the
450c4cbaf79SLuca Coelho  * @types_mask must be unique across all instances of iftype_data.
451c4cbaf79SLuca Coelho  *
452c4cbaf79SLuca Coelho  * @types_mask: interface types mask
453c4cbaf79SLuca Coelho  * @he_cap: holds the HE capabilities
45422395217SJohannes Berg  * @he_6ghz_capa: HE 6 GHz capabilities, must be filled in for a
45522395217SJohannes Berg  *	6 GHz band channel (and 0 may be valid value).
4562d8b08feSMauro Carvalho Chehab  * @eht_cap: STA's EHT capabilities
457f4f86505SJohannes Berg  * @vendor_elems: vendor element(s) to advertise
458f4f86505SJohannes Berg  * @vendor_elems.data: vendor element(s) data
459f4f86505SJohannes Berg  * @vendor_elems.len: vendor element(s) length
460c4cbaf79SLuca Coelho  */
461c4cbaf79SLuca Coelho struct ieee80211_sband_iftype_data {
462c4cbaf79SLuca Coelho 	u16 types_mask;
463c4cbaf79SLuca Coelho 	struct ieee80211_sta_he_cap he_cap;
46422395217SJohannes Berg 	struct ieee80211_he_6ghz_capa he_6ghz_capa;
4655cd5a8a3SIlan Peer 	struct ieee80211_sta_eht_cap eht_cap;
466f4f86505SJohannes Berg 	struct {
467f4f86505SJohannes Berg 		const u8 *data;
468f4f86505SJohannes Berg 		unsigned int len;
469f4f86505SJohannes Berg 	} vendor_elems;
470c4cbaf79SLuca Coelho };
471c4cbaf79SLuca Coelho 
472bf0c111eSMahesh Palivela /**
4732a38075cSAlexei Avshalom Lazar  * enum ieee80211_edmg_bw_config - allowed channel bandwidth configurations
4742a38075cSAlexei Avshalom Lazar  *
4752a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_4: 2.16GHz
4762a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_5: 2.16GHz and 4.32GHz
4772a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_6: 2.16GHz, 4.32GHz and 6.48GHz
4782a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_7: 2.16GHz, 4.32GHz, 6.48GHz and 8.64GHz
4792a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_8: 2.16GHz and 2.16GHz + 2.16GHz
4802a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_9: 2.16GHz, 4.32GHz and 2.16GHz + 2.16GHz
4812a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_10: 2.16GHz, 4.32GHz, 6.48GHz and 2.16GHz+2.16GHz
4822a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_11: 2.16GHz, 4.32GHz, 6.48GHz, 8.64GHz and
4832a38075cSAlexei Avshalom Lazar  *	2.16GHz+2.16GHz
4842a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_12: 2.16GHz, 2.16GHz + 2.16GHz and
4852a38075cSAlexei Avshalom Lazar  *	4.32GHz + 4.32GHz
4862a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_13: 2.16GHz, 4.32GHz, 2.16GHz + 2.16GHz and
4872a38075cSAlexei Avshalom Lazar  *	4.32GHz + 4.32GHz
4882a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_14: 2.16GHz, 4.32GHz, 6.48GHz, 2.16GHz + 2.16GHz
4892a38075cSAlexei Avshalom Lazar  *	and 4.32GHz + 4.32GHz
4902a38075cSAlexei Avshalom Lazar  * @IEEE80211_EDMG_BW_CONFIG_15: 2.16GHz, 4.32GHz, 6.48GHz, 8.64GHz,
4912a38075cSAlexei Avshalom Lazar  *	2.16GHz + 2.16GHz and 4.32GHz + 4.32GHz
4922a38075cSAlexei Avshalom Lazar  */
4932a38075cSAlexei Avshalom Lazar enum ieee80211_edmg_bw_config {
4942a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_4	= 4,
4952a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_5	= 5,
4962a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_6	= 6,
4972a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_7	= 7,
4982a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_8	= 8,
4992a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_9	= 9,
5002a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_10	= 10,
5012a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_11	= 11,
5022a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_12	= 12,
5032a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_13	= 13,
5042a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_14	= 14,
5052a38075cSAlexei Avshalom Lazar 	IEEE80211_EDMG_BW_CONFIG_15	= 15,
5062a38075cSAlexei Avshalom Lazar };
5072a38075cSAlexei Avshalom Lazar 
5082a38075cSAlexei Avshalom Lazar /**
5092a38075cSAlexei Avshalom Lazar  * struct ieee80211_edmg - EDMG configuration
5102a38075cSAlexei Avshalom Lazar  *
5112a38075cSAlexei Avshalom Lazar  * This structure describes most essential parameters needed
5122a38075cSAlexei Avshalom Lazar  * to describe 802.11ay EDMG configuration
5132a38075cSAlexei Avshalom Lazar  *
5142a38075cSAlexei Avshalom Lazar  * @channels: bitmap that indicates the 2.16 GHz channel(s)
5152a38075cSAlexei Avshalom Lazar  *	that are allowed to be used for transmissions.
5162a38075cSAlexei Avshalom Lazar  *	Bit 0 indicates channel 1, bit 1 indicates channel 2, etc.
5172a38075cSAlexei Avshalom Lazar  *	Set to 0 indicate EDMG not supported.
5182a38075cSAlexei Avshalom Lazar  * @bw_config: Channel BW Configuration subfield encodes
5192a38075cSAlexei Avshalom Lazar  *	the allowed channel bandwidth configurations
5202a38075cSAlexei Avshalom Lazar  */
5212a38075cSAlexei Avshalom Lazar struct ieee80211_edmg {
5222a38075cSAlexei Avshalom Lazar 	u8 channels;
5232a38075cSAlexei Avshalom Lazar 	enum ieee80211_edmg_bw_config bw_config;
5242a38075cSAlexei Avshalom Lazar };
5252a38075cSAlexei Avshalom Lazar 
5262a38075cSAlexei Avshalom Lazar /**
527df78a0c0SThomas Pedersen  * struct ieee80211_sta_s1g_cap - STA's S1G capabilities
528df78a0c0SThomas Pedersen  *
529df78a0c0SThomas Pedersen  * This structure describes most essential parameters needed
530df78a0c0SThomas Pedersen  * to describe 802.11ah S1G capabilities for a STA.
531df78a0c0SThomas Pedersen  *
5322d8b08feSMauro Carvalho Chehab  * @s1g: is STA an S1G STA
533df78a0c0SThomas Pedersen  * @cap: S1G capabilities information
534df78a0c0SThomas Pedersen  * @nss_mcs: Supported NSS MCS set
535df78a0c0SThomas Pedersen  */
536df78a0c0SThomas Pedersen struct ieee80211_sta_s1g_cap {
537df78a0c0SThomas Pedersen 	bool s1g;
538df78a0c0SThomas Pedersen 	u8 cap[10]; /* use S1G_CAPAB_ */
539df78a0c0SThomas Pedersen 	u8 nss_mcs[5];
540df78a0c0SThomas Pedersen };
541df78a0c0SThomas Pedersen 
542df78a0c0SThomas Pedersen /**
543d3236553SJohannes Berg  * struct ieee80211_supported_band - frequency band definition
544d3236553SJohannes Berg  *
545d3236553SJohannes Berg  * This structure describes a frequency band a wiphy
546d3236553SJohannes Berg  * is able to operate in.
547d3236553SJohannes Berg  *
548085a6c10SRandy Dunlap  * @channels: Array of channels the hardware can operate with
549d3236553SJohannes Berg  *	in this band.
550d3236553SJohannes Berg  * @band: the band this structure represents
551d3236553SJohannes Berg  * @n_channels: Number of channels in @channels
552d3236553SJohannes Berg  * @bitrates: Array of bitrates the hardware can operate with
553d3236553SJohannes Berg  *	in this band. Must be sorted to give a valid "supported
554d3236553SJohannes Berg  *	rates" IE, i.e. CCK rates first, then OFDM.
555d3236553SJohannes Berg  * @n_bitrates: Number of bitrates in @bitrates
556abe37c4bSJohannes Berg  * @ht_cap: HT capabilities in this band
557c9a0a302SRobert P. J. Day  * @vht_cap: VHT capabilities in this band
5588a50c057SMauro Carvalho Chehab  * @s1g_cap: S1G capabilities in this band
5592a38075cSAlexei Avshalom Lazar  * @edmg_cap: EDMG capabilities in this band
5609ff167e1SJohannes Berg  * @s1g_cap: S1G capabilities in this band (S1B band only, of course)
561c4cbaf79SLuca Coelho  * @n_iftype_data: number of iftype data entries
562c4cbaf79SLuca Coelho  * @iftype_data: interface type data entries.  Note that the bits in
563c4cbaf79SLuca Coelho  *	@types_mask inside this structure cannot overlap (i.e. only
564c4cbaf79SLuca Coelho  *	one occurrence of each type is allowed across all instances of
565c4cbaf79SLuca Coelho  *	iftype_data).
566d3236553SJohannes Berg  */
567d3236553SJohannes Berg struct ieee80211_supported_band {
568d3236553SJohannes Berg 	struct ieee80211_channel *channels;
569d3236553SJohannes Berg 	struct ieee80211_rate *bitrates;
57057fbcce3SJohannes Berg 	enum nl80211_band band;
571d3236553SJohannes Berg 	int n_channels;
572d3236553SJohannes Berg 	int n_bitrates;
573d3236553SJohannes Berg 	struct ieee80211_sta_ht_cap ht_cap;
574bf0c111eSMahesh Palivela 	struct ieee80211_sta_vht_cap vht_cap;
575df78a0c0SThomas Pedersen 	struct ieee80211_sta_s1g_cap s1g_cap;
5762a38075cSAlexei Avshalom Lazar 	struct ieee80211_edmg edmg_cap;
577c4cbaf79SLuca Coelho 	u16 n_iftype_data;
578e8c18412SJohannes Berg 	const struct ieee80211_sband_iftype_data __iftd *iftype_data;
579d3236553SJohannes Berg };
580d3236553SJohannes Berg 
581e691ac2fSRafał Miłecki /**
582e8c18412SJohannes Berg  * _ieee80211_set_sband_iftype_data - set sband iftype data array
583e8c18412SJohannes Berg  * @sband: the sband to initialize
584e8c18412SJohannes Berg  * @iftd: the iftype data array pointer
585e8c18412SJohannes Berg  * @n_iftd: the length of the iftype data array
586e8c18412SJohannes Berg  *
587e8c18412SJohannes Berg  * Set the sband iftype data array; use this where the length cannot
588e8c18412SJohannes Berg  * be derived from the ARRAY_SIZE() of the argument, but prefer
589e8c18412SJohannes Berg  * ieee80211_set_sband_iftype_data() where it can be used.
590e8c18412SJohannes Berg  */
591e8c18412SJohannes Berg static inline void
_ieee80211_set_sband_iftype_data(struct ieee80211_supported_band * sband,const struct ieee80211_sband_iftype_data * iftd,u16 n_iftd)592e8c18412SJohannes Berg _ieee80211_set_sband_iftype_data(struct ieee80211_supported_band *sband,
593e8c18412SJohannes Berg 				 const struct ieee80211_sband_iftype_data *iftd,
594e8c18412SJohannes Berg 				 u16 n_iftd)
595e8c18412SJohannes Berg {
596e8c18412SJohannes Berg 	sband->iftype_data = (const void __iftd __force *)iftd;
597e8c18412SJohannes Berg 	sband->n_iftype_data = n_iftd;
598e8c18412SJohannes Berg }
599e8c18412SJohannes Berg 
600e8c18412SJohannes Berg /**
601e8c18412SJohannes Berg  * ieee80211_set_sband_iftype_data - set sband iftype data array
602e8c18412SJohannes Berg  * @sband: the sband to initialize
603e8c18412SJohannes Berg  * @iftd: the iftype data array
604e8c18412SJohannes Berg  */
605e8c18412SJohannes Berg #define ieee80211_set_sband_iftype_data(sband, iftd)	\
606e8c18412SJohannes Berg 	_ieee80211_set_sband_iftype_data(sband, iftd, ARRAY_SIZE(iftd))
607e8c18412SJohannes Berg 
608e8c18412SJohannes Berg /**
609e8c18412SJohannes Berg  * for_each_sband_iftype_data - iterate sband iftype data entries
610e8c18412SJohannes Berg  * @sband: the sband whose iftype_data array to iterate
611e8c18412SJohannes Berg  * @i: iterator counter
612e8c18412SJohannes Berg  * @iftd: iftype data pointer to set
613e8c18412SJohannes Berg  */
614e8c18412SJohannes Berg #define for_each_sband_iftype_data(sband, i, iftd)				\
615e8c18412SJohannes Berg 	for (i = 0, iftd = (const void __force *)&(sband)->iftype_data[i];	\
616e8c18412SJohannes Berg 	     i < (sband)->n_iftype_data;					\
617e8c18412SJohannes Berg 	     i++, iftd = (const void __force *)&(sband)->iftype_data[i])
618e8c18412SJohannes Berg 
619e8c18412SJohannes Berg /**
620c4cbaf79SLuca Coelho  * ieee80211_get_sband_iftype_data - return sband data for a given iftype
621c4cbaf79SLuca Coelho  * @sband: the sband to search for the STA on
622c4cbaf79SLuca Coelho  * @iftype: enum nl80211_iftype
623c4cbaf79SLuca Coelho  *
624c4cbaf79SLuca Coelho  * Return: pointer to struct ieee80211_sband_iftype_data, or NULL is none found
625c4cbaf79SLuca Coelho  */
626c4cbaf79SLuca Coelho static inline const struct ieee80211_sband_iftype_data *
ieee80211_get_sband_iftype_data(const struct ieee80211_supported_band * sband,u8 iftype)627c4cbaf79SLuca Coelho ieee80211_get_sband_iftype_data(const struct ieee80211_supported_band *sband,
628c4cbaf79SLuca Coelho 				u8 iftype)
629c4cbaf79SLuca Coelho {
630e8c18412SJohannes Berg 	const struct ieee80211_sband_iftype_data *data;
631c4cbaf79SLuca Coelho 	int i;
632c4cbaf79SLuca Coelho 
633c4cbaf79SLuca Coelho 	if (WARN_ON(iftype >= NL80211_IFTYPE_MAX))
634c4cbaf79SLuca Coelho 		return NULL;
635c4cbaf79SLuca Coelho 
6365fb9a9fbSFelix Fietkau 	if (iftype == NL80211_IFTYPE_AP_VLAN)
6375fb9a9fbSFelix Fietkau 		iftype = NL80211_IFTYPE_AP;
6385fb9a9fbSFelix Fietkau 
639e8c18412SJohannes Berg 	for_each_sband_iftype_data(sband, i, data) {
640c4cbaf79SLuca Coelho 		if (data->types_mask & BIT(iftype))
641c4cbaf79SLuca Coelho 			return data;
642c4cbaf79SLuca Coelho 	}
643c4cbaf79SLuca Coelho 
644c4cbaf79SLuca Coelho 	return NULL;
645c4cbaf79SLuca Coelho }
646c4cbaf79SLuca Coelho 
647c4cbaf79SLuca Coelho /**
648d7edf40cSJohn Crispin  * ieee80211_get_he_iftype_cap - return HE capabilities for an sband's iftype
649d7edf40cSJohn Crispin  * @sband: the sband to search for the iftype on
650d7edf40cSJohn Crispin  * @iftype: enum nl80211_iftype
651d7edf40cSJohn Crispin  *
652d7edf40cSJohn Crispin  * Return: pointer to the struct ieee80211_sta_he_cap, or NULL is none found
653d7edf40cSJohn Crispin  */
654d7edf40cSJohn Crispin static inline const struct ieee80211_sta_he_cap *
ieee80211_get_he_iftype_cap(const struct ieee80211_supported_band * sband,u8 iftype)655d7edf40cSJohn Crispin ieee80211_get_he_iftype_cap(const struct ieee80211_supported_band *sband,
656d7edf40cSJohn Crispin 			    u8 iftype)
657d7edf40cSJohn Crispin {
658d7edf40cSJohn Crispin 	const struct ieee80211_sband_iftype_data *data =
659d7edf40cSJohn Crispin 		ieee80211_get_sband_iftype_data(sband, iftype);
660d7edf40cSJohn Crispin 
661d7edf40cSJohn Crispin 	if (data && data->he_cap.has_he)
662d7edf40cSJohn Crispin 		return &data->he_cap;
663d7edf40cSJohn Crispin 
664d7edf40cSJohn Crispin 	return NULL;
665d7edf40cSJohn Crispin }
666d7edf40cSJohn Crispin 
667d7edf40cSJohn Crispin /**
6682ad2274cSIlan Peer  * ieee80211_get_he_6ghz_capa - return HE 6 GHz capabilities
6692ad2274cSIlan Peer  * @sband: the sband to search for the STA on
6702ad2274cSIlan Peer  * @iftype: the iftype to search for
6712ad2274cSIlan Peer  *
6722ad2274cSIlan Peer  * Return: the 6GHz capabilities
6732ad2274cSIlan Peer  */
6742ad2274cSIlan Peer static inline __le16
ieee80211_get_he_6ghz_capa(const struct ieee80211_supported_band * sband,enum nl80211_iftype iftype)6752ad2274cSIlan Peer ieee80211_get_he_6ghz_capa(const struct ieee80211_supported_band *sband,
6762ad2274cSIlan Peer 			   enum nl80211_iftype iftype)
6772ad2274cSIlan Peer {
6782ad2274cSIlan Peer 	const struct ieee80211_sband_iftype_data *data =
6792ad2274cSIlan Peer 		ieee80211_get_sband_iftype_data(sband, iftype);
6802ad2274cSIlan Peer 
6812ad2274cSIlan Peer 	if (WARN_ON(!data || !data->he_cap.has_he))
6822ad2274cSIlan Peer 		return 0;
6832ad2274cSIlan Peer 
6842ad2274cSIlan Peer 	return data->he_6ghz_capa.capa;
6852ad2274cSIlan Peer }
6862ad2274cSIlan Peer 
6872ad2274cSIlan Peer /**
6885cd5a8a3SIlan Peer  * ieee80211_get_eht_iftype_cap - return ETH capabilities for an sband's iftype
6895cd5a8a3SIlan Peer  * @sband: the sband to search for the iftype on
6905cd5a8a3SIlan Peer  * @iftype: enum nl80211_iftype
6915cd5a8a3SIlan Peer  *
6925cd5a8a3SIlan Peer  * Return: pointer to the struct ieee80211_sta_eht_cap, or NULL is none found
6935cd5a8a3SIlan Peer  */
6945cd5a8a3SIlan Peer static inline const struct ieee80211_sta_eht_cap *
ieee80211_get_eht_iftype_cap(const struct ieee80211_supported_band * sband,enum nl80211_iftype iftype)6955cd5a8a3SIlan Peer ieee80211_get_eht_iftype_cap(const struct ieee80211_supported_band *sband,
6965cd5a8a3SIlan Peer 			     enum nl80211_iftype iftype)
6975cd5a8a3SIlan Peer {
6985cd5a8a3SIlan Peer 	const struct ieee80211_sband_iftype_data *data =
6995cd5a8a3SIlan Peer 		ieee80211_get_sband_iftype_data(sband, iftype);
7005cd5a8a3SIlan Peer 
7015cd5a8a3SIlan Peer 	if (data && data->eht_cap.has_eht)
7025cd5a8a3SIlan Peer 		return &data->eht_cap;
7035cd5a8a3SIlan Peer 
7045cd5a8a3SIlan Peer 	return NULL;
7055cd5a8a3SIlan Peer }
7065cd5a8a3SIlan Peer 
7075cd5a8a3SIlan Peer /**
708e691ac2fSRafał Miłecki  * wiphy_read_of_freq_limits - read frequency limits from device tree
709e691ac2fSRafał Miłecki  *
710e691ac2fSRafał Miłecki  * @wiphy: the wireless device to get extra limits for
711e691ac2fSRafał Miłecki  *
712e691ac2fSRafał Miłecki  * Some devices may have extra limitations specified in DT. This may be useful
713e691ac2fSRafał Miłecki  * for chipsets that normally support more bands but are limited due to board
714e691ac2fSRafał Miłecki  * design (e.g. by antennas or external power amplifier).
715e691ac2fSRafał Miłecki  *
716e691ac2fSRafał Miłecki  * This function reads info from DT and uses it to *modify* channels (disable
717e691ac2fSRafał Miłecki  * unavailable ones). It's usually a *bad* idea to use it in drivers with
718e691ac2fSRafał Miłecki  * shared channel data as DT limitations are device specific. You should make
719e691ac2fSRafał Miłecki  * sure to call it only if channels in wiphy are copied and can be modified
720e691ac2fSRafał Miłecki  * without affecting other devices.
721e691ac2fSRafał Miłecki  *
722e691ac2fSRafał Miłecki  * As this function access device node it has to be called after set_wiphy_dev.
723e691ac2fSRafał Miłecki  * It also modifies channels so they have to be set first.
724e691ac2fSRafał Miłecki  * If using this helper, call it before wiphy_register().
725e691ac2fSRafał Miłecki  */
726e691ac2fSRafał Miłecki #ifdef CONFIG_OF
727e691ac2fSRafał Miłecki void wiphy_read_of_freq_limits(struct wiphy *wiphy);
728e691ac2fSRafał Miłecki #else /* CONFIG_OF */
wiphy_read_of_freq_limits(struct wiphy * wiphy)729e691ac2fSRafał Miłecki static inline void wiphy_read_of_freq_limits(struct wiphy *wiphy)
730e691ac2fSRafał Miłecki {
731e691ac2fSRafał Miłecki }
732e691ac2fSRafał Miłecki #endif /* !CONFIG_OF */
733e691ac2fSRafał Miłecki 
734e691ac2fSRafał Miłecki 
735d3236553SJohannes Berg /*
736d3236553SJohannes Berg  * Wireless hardware/device configuration structures and methods
737704232c2SJohannes Berg  */
738704232c2SJohannes Berg 
7392ec600d6SLuis Carlos Cobo /**
740d70e9693SJohannes Berg  * DOC: Actions and configuration
741d70e9693SJohannes Berg  *
742d70e9693SJohannes Berg  * Each wireless device and each virtual interface offer a set of configuration
743d70e9693SJohannes Berg  * operations and other actions that are invoked by userspace. Each of these
744d70e9693SJohannes Berg  * actions is described in the operations structure, and the parameters these
745d70e9693SJohannes Berg  * operations use are described separately.
746d70e9693SJohannes Berg  *
747d70e9693SJohannes Berg  * Additionally, some operations are asynchronous and expect to get status
748d70e9693SJohannes Berg  * information via some functions that drivers need to call.
749d70e9693SJohannes Berg  *
750d70e9693SJohannes Berg  * Scanning and BSS list handling with its associated functionality is described
751d70e9693SJohannes Berg  * in a separate chapter.
752d70e9693SJohannes Berg  */
753d70e9693SJohannes Berg 
754c6e6a0c8SAviya Erenfeld #define VHT_MUMIMO_GROUPS_DATA_LEN (WLAN_MEMBERSHIP_LEN +\
755c6e6a0c8SAviya Erenfeld 				    WLAN_USER_POSITION_LEN)
756c6e6a0c8SAviya Erenfeld 
757d70e9693SJohannes Berg /**
7582ec600d6SLuis Carlos Cobo  * struct vif_params - describes virtual interface parameters
759818a986eSJohannes Berg  * @flags: monitor interface flags, unchanged if 0, otherwise
760818a986eSJohannes Berg  *	%MONITOR_FLAG_CHANGED will be set
7618b787643SFelix Fietkau  * @use_4addr: use 4-address frames
762e8f479b1SBen Greear  * @macaddr: address to use for this virtual interface.
763e8f479b1SBen Greear  *	If this parameter is set to zero address the driver may
764e8f479b1SBen Greear  *	determine the address as needed.
765e8f479b1SBen Greear  *	This feature is only fully supported by drivers that enable the
766e8f479b1SBen Greear  *	%NL80211_FEATURE_MAC_ON_CREATE flag.  Others may support creating
767e8f479b1SBen Greear  **	only p2p devices with specified MAC.
768b0265024SJohannes Berg  * @vht_mumimo_groups: MU-MIMO groupID, used for monitoring MU-MIMO packets
769b0265024SJohannes Berg  *	belonging to that MU-MIMO groupID; %NULL if not changed
770b0265024SJohannes Berg  * @vht_mumimo_follow_addr: MU-MIMO follow address, used for monitoring
771b0265024SJohannes Berg  *	MU-MIMO packets going to the specified station; %NULL if not changed
7722ec600d6SLuis Carlos Cobo  */
7732ec600d6SLuis Carlos Cobo struct vif_params {
774818a986eSJohannes Berg 	u32 flags;
7758b787643SFelix Fietkau 	int use_4addr;
7761c18f145SArend van Spriel 	u8 macaddr[ETH_ALEN];
777b0265024SJohannes Berg 	const u8 *vht_mumimo_groups;
778b0265024SJohannes Berg 	const u8 *vht_mumimo_follow_addr;
7792ec600d6SLuis Carlos Cobo };
7802ec600d6SLuis Carlos Cobo 
78141ade00fSJohannes Berg /**
78241ade00fSJohannes Berg  * struct key_params - key information
78341ade00fSJohannes Berg  *
78441ade00fSJohannes Berg  * Information about a key
78541ade00fSJohannes Berg  *
78641ade00fSJohannes Berg  * @key: key material
78741ade00fSJohannes Berg  * @key_len: length of key material
78841ade00fSJohannes Berg  * @cipher: cipher suite selector
78941ade00fSJohannes Berg  * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used
79041ade00fSJohannes Berg  *	with the get_key() callback, must be in little endian,
79141ade00fSJohannes Berg  *	length given by @seq_len.
792abe37c4bSJohannes Berg  * @seq_len: length of @seq.
79314f34e36SGurumoorthi Gnanasambandhan  * @vlan_id: vlan_id for VLAN group key (if nonzero)
7946cdd3979SAlexander Wetzel  * @mode: key install mode (RX_TX, NO_TX or SET_TX)
79541ade00fSJohannes Berg  */
79641ade00fSJohannes Berg struct key_params {
797c1e5f471SJohannes Berg 	const u8 *key;
798c1e5f471SJohannes Berg 	const u8 *seq;
79941ade00fSJohannes Berg 	int key_len;
80041ade00fSJohannes Berg 	int seq_len;
80114f34e36SGurumoorthi Gnanasambandhan 	u16 vlan_id;
80241ade00fSJohannes Berg 	u32 cipher;
8036cdd3979SAlexander Wetzel 	enum nl80211_key_mode mode;
80441ade00fSJohannes Berg };
80541ade00fSJohannes Berg 
806ed1b6cc7SJohannes Berg /**
807683b6d3bSJohannes Berg  * struct cfg80211_chan_def - channel definition
808683b6d3bSJohannes Berg  * @chan: the (control) channel
8093d9d1d66SJohannes Berg  * @width: channel width
8103d9d1d66SJohannes Berg  * @center_freq1: center frequency of first segment
8113d9d1d66SJohannes Berg  * @center_freq2: center frequency of second segment
8123d9d1d66SJohannes Berg  *	(only with 80+80 MHz)
8132a38075cSAlexei Avshalom Lazar  * @edmg: define the EDMG channels configuration.
8142a38075cSAlexei Avshalom Lazar  *	If edmg is requested (i.e. the .channels member is non-zero),
8152a38075cSAlexei Avshalom Lazar  *	chan will define the primary channel and all other
8162a38075cSAlexei Avshalom Lazar  *	parameters are ignored.
817934f4c7dSThomas Pedersen  * @freq1_offset: offset from @center_freq1, in KHz
818b82730bfSJohannes Berg  * @punctured: mask of the punctured 20 MHz subchannels, with
819b82730bfSJohannes Berg  *	bits turned on being disabled (punctured); numbered
820b82730bfSJohannes Berg  *	from lower to higher frequency (like in the spec)
821683b6d3bSJohannes Berg  */
822683b6d3bSJohannes Berg struct cfg80211_chan_def {
823683b6d3bSJohannes Berg 	struct ieee80211_channel *chan;
8243d9d1d66SJohannes Berg 	enum nl80211_chan_width width;
8253d9d1d66SJohannes Berg 	u32 center_freq1;
8263d9d1d66SJohannes Berg 	u32 center_freq2;
8272a38075cSAlexei Avshalom Lazar 	struct ieee80211_edmg edmg;
828934f4c7dSThomas Pedersen 	u16 freq1_offset;
829b82730bfSJohannes Berg 	u16 punctured;
830683b6d3bSJohannes Berg };
831683b6d3bSJohannes Berg 
8329a5f6488STamizh Chelvam /*
8339a5f6488STamizh Chelvam  * cfg80211_bitrate_mask - masks for bitrate control
8349a5f6488STamizh Chelvam  */
8359a5f6488STamizh Chelvam struct cfg80211_bitrate_mask {
8369a5f6488STamizh Chelvam 	struct {
8379a5f6488STamizh Chelvam 		u32 legacy;
8389a5f6488STamizh Chelvam 		u8 ht_mcs[IEEE80211_HT_MCS_MASK_LEN];
8399a5f6488STamizh Chelvam 		u16 vht_mcs[NL80211_VHT_NSS_MAX];
840eb89a6a6SMiles Hu 		u16 he_mcs[NL80211_HE_NSS_MAX];
8419a5f6488STamizh Chelvam 		enum nl80211_txrate_gi gi;
842eb89a6a6SMiles Hu 		enum nl80211_he_gi he_gi;
843eb89a6a6SMiles Hu 		enum nl80211_he_ltf he_ltf;
8449a5f6488STamizh Chelvam 	} control[NUM_NL80211_BANDS];
8459a5f6488STamizh Chelvam };
8469a5f6488STamizh Chelvam 
8479a5f6488STamizh Chelvam 
84877f576deSTamizh chelvam /**
8493710a8a6SJohannes Berg  * struct cfg80211_tid_cfg - TID specific configuration
85077f576deSTamizh chelvam  * @config_override: Flag to notify driver to reset TID configuration
85177f576deSTamizh chelvam  *	of the peer.
8523710a8a6SJohannes Berg  * @tids: bitmap of TIDs to modify
8533710a8a6SJohannes Berg  * @mask: bitmap of attributes indicating which parameter changed,
8543710a8a6SJohannes Berg  *	similar to &nl80211_tid_config_supp.
85577f576deSTamizh chelvam  * @noack: noack configuration value for the TID
8566a21d16cSTamizh chelvam  * @retry_long: retry count value
8576a21d16cSTamizh chelvam  * @retry_short: retry count value
85833462e68SSergey Matyukevich  * @ampdu: Enable/Disable MPDU aggregation
85904f7d142STamizh chelvam  * @rtscts: Enable/Disable RTS/CTS
86033462e68SSergey Matyukevich  * @amsdu: Enable/Disable MSDU aggregation
8619a5f6488STamizh Chelvam  * @txrate_type: Tx bitrate mask type
8629a5f6488STamizh Chelvam  * @txrate_mask: Tx bitrate to be applied for the TID
86377f576deSTamizh chelvam  */
8643710a8a6SJohannes Berg struct cfg80211_tid_cfg {
86577f576deSTamizh chelvam 	bool config_override;
8663710a8a6SJohannes Berg 	u8 tids;
8672d5d9b7fSSergey Matyukevich 	u64 mask;
86877f576deSTamizh chelvam 	enum nl80211_tid_config noack;
8696a21d16cSTamizh chelvam 	u8 retry_long, retry_short;
870ade274b2STamizh chelvam 	enum nl80211_tid_config ampdu;
87104f7d142STamizh chelvam 	enum nl80211_tid_config rtscts;
87233462e68SSergey Matyukevich 	enum nl80211_tid_config amsdu;
8739a5f6488STamizh Chelvam 	enum nl80211_tx_rate_setting txrate_type;
8749a5f6488STamizh Chelvam 	struct cfg80211_bitrate_mask txrate_mask;
87577f576deSTamizh chelvam };
87677f576deSTamizh chelvam 
87777f576deSTamizh chelvam /**
8783710a8a6SJohannes Berg  * struct cfg80211_tid_config - TID configuration
87977f576deSTamizh chelvam  * @peer: Station's MAC address
88077f576deSTamizh chelvam  * @n_tid_conf: Number of TID specific configurations to be applied
88177f576deSTamizh chelvam  * @tid_conf: Configuration change info
88277f576deSTamizh chelvam  */
8833710a8a6SJohannes Berg struct cfg80211_tid_config {
88477f576deSTamizh chelvam 	const u8 *peer;
88577f576deSTamizh chelvam 	u32 n_tid_conf;
886545d3523SKees Cook 	struct cfg80211_tid_cfg tid_conf[] __counted_by(n_tid_conf);
88777f576deSTamizh chelvam };
88877f576deSTamizh chelvam 
8893d9d1d66SJohannes Berg /**
890e306784aSSubrat Mishra  * struct cfg80211_fils_aad - FILS AAD data
891e306784aSSubrat Mishra  * @macaddr: STA MAC address
892e306784aSSubrat Mishra  * @kek: FILS KEK
893e306784aSSubrat Mishra  * @kek_len: FILS KEK length
894e306784aSSubrat Mishra  * @snonce: STA Nonce
895e306784aSSubrat Mishra  * @anonce: AP Nonce
896e306784aSSubrat Mishra  */
897e306784aSSubrat Mishra struct cfg80211_fils_aad {
898e306784aSSubrat Mishra 	const u8 *macaddr;
899e306784aSSubrat Mishra 	const u8 *kek;
900e306784aSSubrat Mishra 	u8 kek_len;
901e306784aSSubrat Mishra 	const u8 *snonce;
902e306784aSSubrat Mishra 	const u8 *anonce;
903e306784aSSubrat Mishra };
904e306784aSSubrat Mishra 
905e306784aSSubrat Mishra /**
906cbbaf2bbSAvraham Stern  * struct cfg80211_set_hw_timestamp - enable/disable HW timestamping
907cbbaf2bbSAvraham Stern  * @macaddr: peer MAC address. NULL to enable/disable HW timestamping for all
908cbbaf2bbSAvraham Stern  *	addresses.
909cbbaf2bbSAvraham Stern  * @enable: if set, enable HW timestamping for the specified MAC address.
910cbbaf2bbSAvraham Stern  *	Otherwise disable HW timestamping for the specified MAC address.
911cbbaf2bbSAvraham Stern  */
912cbbaf2bbSAvraham Stern struct cfg80211_set_hw_timestamp {
913cbbaf2bbSAvraham Stern 	const u8 *macaddr;
914cbbaf2bbSAvraham Stern 	bool enable;
915cbbaf2bbSAvraham Stern };
916cbbaf2bbSAvraham Stern 
917cbbaf2bbSAvraham Stern /**
9183d9d1d66SJohannes Berg  * cfg80211_get_chandef_type - return old channel type from chandef
9193d9d1d66SJohannes Berg  * @chandef: the channel definition
9203d9d1d66SJohannes Berg  *
9210ae997dcSYacine Belkadi  * Return: The old channel type (NOHT, HT20, HT40+/-) from a given
9223d9d1d66SJohannes Berg  * chandef, which must have a bandwidth allowing this conversion.
9233d9d1d66SJohannes Berg  */
924683b6d3bSJohannes Berg static inline enum nl80211_channel_type
cfg80211_get_chandef_type(const struct cfg80211_chan_def * chandef)925683b6d3bSJohannes Berg cfg80211_get_chandef_type(const struct cfg80211_chan_def *chandef)
926683b6d3bSJohannes Berg {
9273d9d1d66SJohannes Berg 	switch (chandef->width) {
9283d9d1d66SJohannes Berg 	case NL80211_CHAN_WIDTH_20_NOHT:
9293d9d1d66SJohannes Berg 		return NL80211_CHAN_NO_HT;
9303d9d1d66SJohannes Berg 	case NL80211_CHAN_WIDTH_20:
9313d9d1d66SJohannes Berg 		return NL80211_CHAN_HT20;
9323d9d1d66SJohannes Berg 	case NL80211_CHAN_WIDTH_40:
9333d9d1d66SJohannes Berg 		if (chandef->center_freq1 > chandef->chan->center_freq)
9343d9d1d66SJohannes Berg 			return NL80211_CHAN_HT40PLUS;
9353d9d1d66SJohannes Berg 		return NL80211_CHAN_HT40MINUS;
9363d9d1d66SJohannes Berg 	default:
9373d9d1d66SJohannes Berg 		WARN_ON(1);
9383d9d1d66SJohannes Berg 		return NL80211_CHAN_NO_HT;
939683b6d3bSJohannes Berg 	}
9403d9d1d66SJohannes Berg }
9413d9d1d66SJohannes Berg 
9423d9d1d66SJohannes Berg /**
9433d9d1d66SJohannes Berg  * cfg80211_chandef_create - create channel definition using channel type
9443d9d1d66SJohannes Berg  * @chandef: the channel definition struct to fill
9453d9d1d66SJohannes Berg  * @channel: the control channel
9463d9d1d66SJohannes Berg  * @chantype: the channel type
9473d9d1d66SJohannes Berg  *
9483d9d1d66SJohannes Berg  * Given a channel type, create a channel definition.
9493d9d1d66SJohannes Berg  */
9503d9d1d66SJohannes Berg void cfg80211_chandef_create(struct cfg80211_chan_def *chandef,
9513d9d1d66SJohannes Berg 			     struct ieee80211_channel *channel,
9523d9d1d66SJohannes Berg 			     enum nl80211_channel_type chantype);
9533d9d1d66SJohannes Berg 
9543d9d1d66SJohannes Berg /**
9553d9d1d66SJohannes Berg  * cfg80211_chandef_identical - check if two channel definitions are identical
9563d9d1d66SJohannes Berg  * @chandef1: first channel definition
9573d9d1d66SJohannes Berg  * @chandef2: second channel definition
9583d9d1d66SJohannes Berg  *
9590ae997dcSYacine Belkadi  * Return: %true if the channels defined by the channel definitions are
9603d9d1d66SJohannes Berg  * identical, %false otherwise.
9613d9d1d66SJohannes Berg  */
9623d9d1d66SJohannes Berg static inline bool
cfg80211_chandef_identical(const struct cfg80211_chan_def * chandef1,const struct cfg80211_chan_def * chandef2)9633d9d1d66SJohannes Berg cfg80211_chandef_identical(const struct cfg80211_chan_def *chandef1,
9643d9d1d66SJohannes Berg 			   const struct cfg80211_chan_def *chandef2)
9653d9d1d66SJohannes Berg {
9663d9d1d66SJohannes Berg 	return (chandef1->chan == chandef2->chan &&
9673d9d1d66SJohannes Berg 		chandef1->width == chandef2->width &&
9683d9d1d66SJohannes Berg 		chandef1->center_freq1 == chandef2->center_freq1 &&
969934f4c7dSThomas Pedersen 		chandef1->freq1_offset == chandef2->freq1_offset &&
970b82730bfSJohannes Berg 		chandef1->center_freq2 == chandef2->center_freq2 &&
971b82730bfSJohannes Berg 		chandef1->punctured == chandef2->punctured);
9723d9d1d66SJohannes Berg }
9733d9d1d66SJohannes Berg 
9743d9d1d66SJohannes Berg /**
9752a38075cSAlexei Avshalom Lazar  * cfg80211_chandef_is_edmg - check if chandef represents an EDMG channel
9762a38075cSAlexei Avshalom Lazar  *
9772a38075cSAlexei Avshalom Lazar  * @chandef: the channel definition
9782a38075cSAlexei Avshalom Lazar  *
9792a38075cSAlexei Avshalom Lazar  * Return: %true if EDMG defined, %false otherwise.
9802a38075cSAlexei Avshalom Lazar  */
9812a38075cSAlexei Avshalom Lazar static inline bool
cfg80211_chandef_is_edmg(const struct cfg80211_chan_def * chandef)9822a38075cSAlexei Avshalom Lazar cfg80211_chandef_is_edmg(const struct cfg80211_chan_def *chandef)
9832a38075cSAlexei Avshalom Lazar {
9842a38075cSAlexei Avshalom Lazar 	return chandef->edmg.channels || chandef->edmg.bw_config;
9852a38075cSAlexei Avshalom Lazar }
9862a38075cSAlexei Avshalom Lazar 
9872a38075cSAlexei Avshalom Lazar /**
9883d9d1d66SJohannes Berg  * cfg80211_chandef_compatible - check if two channel definitions are compatible
9893d9d1d66SJohannes Berg  * @chandef1: first channel definition
9903d9d1d66SJohannes Berg  * @chandef2: second channel definition
9913d9d1d66SJohannes Berg  *
9920ae997dcSYacine Belkadi  * Return: %NULL if the given channel definitions are incompatible,
9933d9d1d66SJohannes Berg  * chandef1 or chandef2 otherwise.
9943d9d1d66SJohannes Berg  */
9953d9d1d66SJohannes Berg const struct cfg80211_chan_def *
9963d9d1d66SJohannes Berg cfg80211_chandef_compatible(const struct cfg80211_chan_def *chandef1,
9973d9d1d66SJohannes Berg 			    const struct cfg80211_chan_def *chandef2);
998683b6d3bSJohannes Berg 
999683b6d3bSJohannes Berg /**
100010fa22b6SEvan Quan  * nl80211_chan_width_to_mhz - get the channel width in MHz
100110fa22b6SEvan Quan  * @chan_width: the channel width from &enum nl80211_chan_width
100210fa22b6SEvan Quan  *
100310fa22b6SEvan Quan  * Return: channel width in MHz if the chan_width from &enum nl80211_chan_width
100410fa22b6SEvan Quan  * is valid. -1 otherwise.
100510fa22b6SEvan Quan  */
100610fa22b6SEvan Quan int nl80211_chan_width_to_mhz(enum nl80211_chan_width chan_width);
100710fa22b6SEvan Quan 
100810fa22b6SEvan Quan /**
10099f5e8f6eSJohannes Berg  * cfg80211_chandef_valid - check if a channel definition is valid
10109f5e8f6eSJohannes Berg  * @chandef: the channel definition to check
10110ae997dcSYacine Belkadi  * Return: %true if the channel definition is valid. %false otherwise.
10129f5e8f6eSJohannes Berg  */
10139f5e8f6eSJohannes Berg bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef);
10149f5e8f6eSJohannes Berg 
10159f5e8f6eSJohannes Berg /**
10169f5e8f6eSJohannes Berg  * cfg80211_chandef_usable - check if secondary channels can be used
10179f5e8f6eSJohannes Berg  * @wiphy: the wiphy to validate against
10189f5e8f6eSJohannes Berg  * @chandef: the channel definition to check
10190ae997dcSYacine Belkadi  * @prohibited_flags: the regulatory channel flags that must not be set
10200ae997dcSYacine Belkadi  * Return: %true if secondary channels are usable. %false otherwise.
10219f5e8f6eSJohannes Berg  */
10229f5e8f6eSJohannes Berg bool cfg80211_chandef_usable(struct wiphy *wiphy,
10239f5e8f6eSJohannes Berg 			     const struct cfg80211_chan_def *chandef,
10249f5e8f6eSJohannes Berg 			     u32 prohibited_flags);
10259f5e8f6eSJohannes Berg 
10269f5e8f6eSJohannes Berg /**
1027774f0734SSimon Wunderlich  * cfg80211_chandef_dfs_required - checks if radar detection is required
1028774f0734SSimon Wunderlich  * @wiphy: the wiphy to validate against
1029774f0734SSimon Wunderlich  * @chandef: the channel definition to check
10302beb6dabSLuciano Coelho  * @iftype: the interface type as specified in &enum nl80211_iftype
10312beb6dabSLuciano Coelho  * Returns:
10322beb6dabSLuciano Coelho  *	1 if radar detection is required, 0 if it is not, < 0 on error
1033774f0734SSimon Wunderlich  */
1034774f0734SSimon Wunderlich int cfg80211_chandef_dfs_required(struct wiphy *wiphy,
10352beb6dabSLuciano Coelho 				  const struct cfg80211_chan_def *chandef,
1036c3d62036SLuciano Coelho 				  enum nl80211_iftype iftype);
1037774f0734SSimon Wunderlich 
1038774f0734SSimon Wunderlich /**
103930ca8b0cSAditya Kumar Singh  * cfg80211_chandef_dfs_usable - checks if chandef is DFS usable and we
104030ca8b0cSAditya Kumar Singh  *				 can/need start CAC on such channel
104130ca8b0cSAditya Kumar Singh  * @wiphy: the wiphy to validate against
104230ca8b0cSAditya Kumar Singh  * @chandef: the channel definition to check
104330ca8b0cSAditya Kumar Singh  *
104430ca8b0cSAditya Kumar Singh  * Return: true if all channels available and at least
104530ca8b0cSAditya Kumar Singh  *	   one channel requires CAC (NL80211_DFS_USABLE)
104630ca8b0cSAditya Kumar Singh  */
104730ca8b0cSAditya Kumar Singh bool cfg80211_chandef_dfs_usable(struct wiphy *wiphy,
104830ca8b0cSAditya Kumar Singh 				 const struct cfg80211_chan_def *chandef);
104930ca8b0cSAditya Kumar Singh 
105030ca8b0cSAditya Kumar Singh /**
105130ca8b0cSAditya Kumar Singh  * cfg80211_chandef_dfs_cac_time - get the DFS CAC time (in ms) for given
105230ca8b0cSAditya Kumar Singh  *				   channel definition
105330ca8b0cSAditya Kumar Singh  * @wiphy: the wiphy to validate against
105430ca8b0cSAditya Kumar Singh  * @chandef: the channel definition to check
105530ca8b0cSAditya Kumar Singh  *
105630ca8b0cSAditya Kumar Singh  * Returns: DFS CAC time (in ms) which applies for this channel definition
105730ca8b0cSAditya Kumar Singh  */
105830ca8b0cSAditya Kumar Singh unsigned int
105930ca8b0cSAditya Kumar Singh cfg80211_chandef_dfs_cac_time(struct wiphy *wiphy,
106030ca8b0cSAditya Kumar Singh 			      const struct cfg80211_chan_def *chandef);
106130ca8b0cSAditya Kumar Singh 
106230ca8b0cSAditya Kumar Singh /**
1063d4655db0SJohannes Berg  * cfg80211_chandef_primary - calculate primary 40/80/160 MHz freq
10648f251a0aSJohannes Berg  * @chandef: chandef to calculate for
10658f251a0aSJohannes Berg  * @primary_chan_width: primary channel width to calculate center for
1066b82730bfSJohannes Berg  * @punctured: punctured sub-channel bitmap, will be recalculated
1067b82730bfSJohannes Berg  *	according to the new bandwidth, can be %NULL
10688f251a0aSJohannes Berg  *
10698f251a0aSJohannes Berg  * Returns: the primary 40/80/160 MHz channel center frequency, or -1
1070b82730bfSJohannes Berg  *	for errors, updating the punctured bitmap
10718f251a0aSJohannes Berg  */
1072b82730bfSJohannes Berg int cfg80211_chandef_primary(const struct cfg80211_chan_def *chandef,
1073b82730bfSJohannes Berg 			     enum nl80211_chan_width primary_chan_width,
1074b82730bfSJohannes Berg 			     u16 *punctured);
10758f251a0aSJohannes Berg 
10768f251a0aSJohannes Berg /**
10775097f844SJaewan Kim  * nl80211_send_chandef - sends the channel definition.
10785097f844SJaewan Kim  * @msg: the msg to send channel definition
10795097f844SJaewan Kim  * @chandef: the channel definition to check
10805097f844SJaewan Kim  *
10815097f844SJaewan Kim  * Returns: 0 if sent the channel definition to msg, < 0 on error
10825097f844SJaewan Kim  **/
10835097f844SJaewan Kim int nl80211_send_chandef(struct sk_buff *msg, const struct cfg80211_chan_def *chandef);
10845097f844SJaewan Kim 
10855097f844SJaewan Kim /**
108619654a61SJohannes Berg  * ieee80211_chanwidth_rate_flags - return rate flags for channel width
108719654a61SJohannes Berg  * @width: the channel width of the channel
108830e74732SSimon Wunderlich  *
108930e74732SSimon Wunderlich  * In some channel types, not all rates may be used - for example CCK
109030e74732SSimon Wunderlich  * rates may not be used in 5/10 MHz channels.
109130e74732SSimon Wunderlich  *
109219654a61SJohannes Berg  * Returns: rate flags which apply for this channel width
109330e74732SSimon Wunderlich  */
109430e74732SSimon Wunderlich static inline enum ieee80211_rate_flags
ieee80211_chanwidth_rate_flags(enum nl80211_chan_width width)109519654a61SJohannes Berg ieee80211_chanwidth_rate_flags(enum nl80211_chan_width width)
109630e74732SSimon Wunderlich {
109719654a61SJohannes Berg 	switch (width) {
109830e74732SSimon Wunderlich 	case NL80211_CHAN_WIDTH_5:
109930e74732SSimon Wunderlich 		return IEEE80211_RATE_SUPPORTS_5MHZ;
110030e74732SSimon Wunderlich 	case NL80211_CHAN_WIDTH_10:
110130e74732SSimon Wunderlich 		return IEEE80211_RATE_SUPPORTS_10MHZ;
110230e74732SSimon Wunderlich 	default:
110330e74732SSimon Wunderlich 		break;
110430e74732SSimon Wunderlich 	}
110530e74732SSimon Wunderlich 	return 0;
110630e74732SSimon Wunderlich }
110730e74732SSimon Wunderlich 
110830e74732SSimon Wunderlich /**
110919654a61SJohannes Berg  * ieee80211_chandef_rate_flags - returns rate flags for a channel
111019654a61SJohannes Berg  * @chandef: channel definition for the channel
111119654a61SJohannes Berg  *
111219654a61SJohannes Berg  * See ieee80211_chanwidth_rate_flags().
111319654a61SJohannes Berg  *
111419654a61SJohannes Berg  * Returns: rate flags which apply for this channel
111519654a61SJohannes Berg  */
111619654a61SJohannes Berg static inline enum ieee80211_rate_flags
ieee80211_chandef_rate_flags(struct cfg80211_chan_def * chandef)111719654a61SJohannes Berg ieee80211_chandef_rate_flags(struct cfg80211_chan_def *chandef)
111819654a61SJohannes Berg {
111919654a61SJohannes Berg 	return ieee80211_chanwidth_rate_flags(chandef->width);
112019654a61SJohannes Berg }
112119654a61SJohannes Berg 
112219654a61SJohannes Berg /**
11230430c883SSimon Wunderlich  * ieee80211_chandef_max_power - maximum transmission power for the chandef
11240430c883SSimon Wunderlich  *
11250430c883SSimon Wunderlich  * In some regulations, the transmit power may depend on the configured channel
11260430c883SSimon Wunderlich  * bandwidth which may be defined as dBm/MHz. This function returns the actual
11270430c883SSimon Wunderlich  * max_power for non-standard (20 MHz) channels.
11280430c883SSimon Wunderlich  *
11290430c883SSimon Wunderlich  * @chandef: channel definition for the channel
11300430c883SSimon Wunderlich  *
11310430c883SSimon Wunderlich  * Returns: maximum allowed transmission power in dBm for the chandef
11320430c883SSimon Wunderlich  */
11330430c883SSimon Wunderlich static inline int
ieee80211_chandef_max_power(struct cfg80211_chan_def * chandef)11340430c883SSimon Wunderlich ieee80211_chandef_max_power(struct cfg80211_chan_def *chandef)
11350430c883SSimon Wunderlich {
11360430c883SSimon Wunderlich 	switch (chandef->width) {
11370430c883SSimon Wunderlich 	case NL80211_CHAN_WIDTH_5:
11380430c883SSimon Wunderlich 		return min(chandef->chan->max_reg_power - 6,
11390430c883SSimon Wunderlich 			   chandef->chan->max_power);
11400430c883SSimon Wunderlich 	case NL80211_CHAN_WIDTH_10:
11410430c883SSimon Wunderlich 		return min(chandef->chan->max_reg_power - 3,
11420430c883SSimon Wunderlich 			   chandef->chan->max_power);
11430430c883SSimon Wunderlich 	default:
11440430c883SSimon Wunderlich 		break;
11450430c883SSimon Wunderlich 	}
11460430c883SSimon Wunderlich 	return chandef->chan->max_power;
11470430c883SSimon Wunderlich }
11480430c883SSimon Wunderlich 
11490430c883SSimon Wunderlich /**
1150be989891SJohannes Berg  * cfg80211_any_usable_channels - check for usable channels
1151be989891SJohannes Berg  * @wiphy: the wiphy to check for
1152be989891SJohannes Berg  * @band_mask: which bands to check on
1153be989891SJohannes Berg  * @prohibited_flags: which channels to not consider usable,
1154be989891SJohannes Berg  *	%IEEE80211_CHAN_DISABLED is always taken into account
115562cc206cSJeff Johnson  *
115662cc206cSJeff Johnson  * Return: %true if usable channels found, %false otherwise
1157be989891SJohannes Berg  */
1158be989891SJohannes Berg bool cfg80211_any_usable_channels(struct wiphy *wiphy,
1159be989891SJohannes Berg 				  unsigned long band_mask,
1160be989891SJohannes Berg 				  u32 prohibited_flags);
1161be989891SJohannes Berg 
1162be989891SJohannes Berg /**
116361fa713cSHolger Schurig  * enum survey_info_flags - survey information flags
116461fa713cSHolger Schurig  *
1165abe37c4bSJohannes Berg  * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in
116617e5a808SFelix Fietkau  * @SURVEY_INFO_IN_USE: channel is currently being used
11674ed20bebSJohannes Berg  * @SURVEY_INFO_TIME: active time (in ms) was filled in
11684ed20bebSJohannes Berg  * @SURVEY_INFO_TIME_BUSY: busy time was filled in
11694ed20bebSJohannes Berg  * @SURVEY_INFO_TIME_EXT_BUSY: extension channel busy time was filled in
11704ed20bebSJohannes Berg  * @SURVEY_INFO_TIME_RX: receive time was filled in
11714ed20bebSJohannes Berg  * @SURVEY_INFO_TIME_TX: transmit time was filled in
1172052536abSJohannes Berg  * @SURVEY_INFO_TIME_SCAN: scan time was filled in
1173c8cd6e7fSFelix Fietkau  * @SURVEY_INFO_TIME_BSS_RX: local BSS receive time was filled in
1174abe37c4bSJohannes Berg  *
117561fa713cSHolger Schurig  * Used by the driver to indicate which info in &struct survey_info
117661fa713cSHolger Schurig  * it has filled in during the get_survey().
117761fa713cSHolger Schurig  */
117861fa713cSHolger Schurig enum survey_info_flags {
11794ed20bebSJohannes Berg 	SURVEY_INFO_NOISE_DBM		= BIT(0),
11804ed20bebSJohannes Berg 	SURVEY_INFO_IN_USE		= BIT(1),
11814ed20bebSJohannes Berg 	SURVEY_INFO_TIME		= BIT(2),
11824ed20bebSJohannes Berg 	SURVEY_INFO_TIME_BUSY		= BIT(3),
11834ed20bebSJohannes Berg 	SURVEY_INFO_TIME_EXT_BUSY	= BIT(4),
11844ed20bebSJohannes Berg 	SURVEY_INFO_TIME_RX		= BIT(5),
11854ed20bebSJohannes Berg 	SURVEY_INFO_TIME_TX		= BIT(6),
1186052536abSJohannes Berg 	SURVEY_INFO_TIME_SCAN		= BIT(7),
1187c8cd6e7fSFelix Fietkau 	SURVEY_INFO_TIME_BSS_RX		= BIT(8),
118861fa713cSHolger Schurig };
118961fa713cSHolger Schurig 
119061fa713cSHolger Schurig /**
119161fa713cSHolger Schurig  * struct survey_info - channel survey response
119261fa713cSHolger Schurig  *
119311f78ac3SJohannes Berg  * @channel: the channel this survey record reports, may be %NULL for a single
119411f78ac3SJohannes Berg  *	record to report global statistics
119561fa713cSHolger Schurig  * @filled: bitflag of flags from &enum survey_info_flags
119661fa713cSHolger Schurig  * @noise: channel noise in dBm. This and all following fields are
119761fa713cSHolger Schurig  *	optional
11984ed20bebSJohannes Berg  * @time: amount of time in ms the radio was turn on (on the channel)
11994ed20bebSJohannes Berg  * @time_busy: amount of time the primary channel was sensed busy
12004ed20bebSJohannes Berg  * @time_ext_busy: amount of time the extension channel was sensed busy
12014ed20bebSJohannes Berg  * @time_rx: amount of time the radio spent receiving data
12024ed20bebSJohannes Berg  * @time_tx: amount of time the radio spent transmitting data
1203052536abSJohannes Berg  * @time_scan: amount of time the radio spent for scanning
1204c8cd6e7fSFelix Fietkau  * @time_bss_rx: amount of time the radio spent receiving data on a local BSS
120561fa713cSHolger Schurig  *
1206abe37c4bSJohannes Berg  * Used by dump_survey() to report back per-channel survey information.
1207abe37c4bSJohannes Berg  *
120861fa713cSHolger Schurig  * This structure can later be expanded with things like
120961fa713cSHolger Schurig  * channel duty cycle etc.
121061fa713cSHolger Schurig  */
121161fa713cSHolger Schurig struct survey_info {
121261fa713cSHolger Schurig 	struct ieee80211_channel *channel;
12134ed20bebSJohannes Berg 	u64 time;
12144ed20bebSJohannes Berg 	u64 time_busy;
12154ed20bebSJohannes Berg 	u64 time_ext_busy;
12164ed20bebSJohannes Berg 	u64 time_rx;
12174ed20bebSJohannes Berg 	u64 time_tx;
1218052536abSJohannes Berg 	u64 time_scan;
1219c8cd6e7fSFelix Fietkau 	u64 time_bss_rx;
122061fa713cSHolger Schurig 	u32 filled;
122161fa713cSHolger Schurig 	s8 noise;
122261fa713cSHolger Schurig };
122361fa713cSHolger Schurig 
1224ecad3b0bSVeerendranath Jakkam #define CFG80211_MAX_NUM_AKM_SUITES	10
1225b8676221SDavid Spinadel 
122661fa713cSHolger Schurig /**
12275fb628e9SJouni Malinen  * struct cfg80211_crypto_settings - Crypto settings
12285fb628e9SJouni Malinen  * @wpa_versions: indicates which, if any, WPA versions are enabled
12295fb628e9SJouni Malinen  *	(from enum nl80211_wpa_versions)
12305fb628e9SJouni Malinen  * @cipher_group: group key cipher suite (or 0 if unset)
12315fb628e9SJouni Malinen  * @n_ciphers_pairwise: number of AP supported unicast ciphers
12325fb628e9SJouni Malinen  * @ciphers_pairwise: unicast key cipher suites
12335fb628e9SJouni Malinen  * @n_akm_suites: number of AKM suites
12345fb628e9SJouni Malinen  * @akm_suites: AKM suites
12355fb628e9SJouni Malinen  * @control_port: Whether user space controls IEEE 802.1X port, i.e.,
12365fb628e9SJouni Malinen  *	sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
12375fb628e9SJouni Malinen  *	required to assume that the port is unauthorized until authorized by
12385fb628e9SJouni Malinen  *	user space. Otherwise, port is marked authorized by default.
12395fb628e9SJouni Malinen  * @control_port_ethertype: the control port protocol that should be
12405fb628e9SJouni Malinen  *	allowed through even on unauthorized ports
12415fb628e9SJouni Malinen  * @control_port_no_encrypt: TRUE to prevent encryption of control port
12425fb628e9SJouni Malinen  *	protocol frames.
124364bf3d4bSDenis Kenzior  * @control_port_over_nl80211: TRUE if userspace expects to exchange control
124464bf3d4bSDenis Kenzior  *	port frames over NL80211 instead of the network interface.
1245a710d214SLothar Rubusch  * @control_port_no_preauth: disables pre-auth rx over the nl80211 control
1246a710d214SLothar Rubusch  *	port for mac80211
124791b5ab62SEliad Peller  * @psk: PSK (for devices supporting 4-way-handshake offload)
124826f7044eSChung-Hsien Hsu  * @sae_pwd: password for SAE authentication (for devices supporting SAE
124926f7044eSChung-Hsien Hsu  *	offload)
125026f7044eSChung-Hsien Hsu  * @sae_pwd_len: length of SAE password (for devices supporting SAE offload)
1251da1e9dd3SJohannes Berg  * @sae_pwe: The mechanisms allowed for SAE PWE derivation:
1252da1e9dd3SJohannes Berg  *
1253da1e9dd3SJohannes Berg  *	NL80211_SAE_PWE_UNSPECIFIED
1254da1e9dd3SJohannes Berg  *	  Not-specified, used to indicate userspace did not specify any
1255da1e9dd3SJohannes Berg  *	  preference. The driver should follow its internal policy in
1256da1e9dd3SJohannes Berg  *	  such a scenario.
1257da1e9dd3SJohannes Berg  *
1258da1e9dd3SJohannes Berg  *	NL80211_SAE_PWE_HUNT_AND_PECK
1259da1e9dd3SJohannes Berg  *	  Allow hunting-and-pecking loop only
1260da1e9dd3SJohannes Berg  *
1261da1e9dd3SJohannes Berg  *	NL80211_SAE_PWE_HASH_TO_ELEMENT
1262da1e9dd3SJohannes Berg  *	  Allow hash-to-element only
1263da1e9dd3SJohannes Berg  *
1264da1e9dd3SJohannes Berg  *	NL80211_SAE_PWE_BOTH
1265da1e9dd3SJohannes Berg  *	  Allow either hunting-and-pecking loop or hash-to-element
12665fb628e9SJouni Malinen  */
12675fb628e9SJouni Malinen struct cfg80211_crypto_settings {
12685fb628e9SJouni Malinen 	u32 wpa_versions;
12695fb628e9SJouni Malinen 	u32 cipher_group;
12705fb628e9SJouni Malinen 	int n_ciphers_pairwise;
12715fb628e9SJouni Malinen 	u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES];
12725fb628e9SJouni Malinen 	int n_akm_suites;
1273ecad3b0bSVeerendranath Jakkam 	u32 akm_suites[CFG80211_MAX_NUM_AKM_SUITES];
12745fb628e9SJouni Malinen 	bool control_port;
12755fb628e9SJouni Malinen 	__be16 control_port_ethertype;
12765fb628e9SJouni Malinen 	bool control_port_no_encrypt;
127764bf3d4bSDenis Kenzior 	bool control_port_over_nl80211;
12787f3f96ceSMarkus Theil 	bool control_port_no_preauth;
127991b5ab62SEliad Peller 	const u8 *psk;
128026f7044eSChung-Hsien Hsu 	const u8 *sae_pwd;
128126f7044eSChung-Hsien Hsu 	u8 sae_pwd_len;
12829f0ffa41SRohan Dutta 	enum nl80211_sae_pwe_mechanism sae_pwe;
12835fb628e9SJouni Malinen };
12845fb628e9SJouni Malinen 
12855fb628e9SJouni Malinen /**
1286dc1e3cb8SJohn Crispin  * struct cfg80211_mbssid_config - AP settings for multi bssid
1287dc1e3cb8SJohn Crispin  *
1288dc1e3cb8SJohn Crispin  * @tx_wdev: pointer to the transmitted interface in the MBSSID set
1289dc1e3cb8SJohn Crispin  * @index: index of this AP in the multi bssid group.
1290dc1e3cb8SJohn Crispin  * @ema: set to true if the beacons should be sent out in EMA mode.
1291dc1e3cb8SJohn Crispin  */
1292dc1e3cb8SJohn Crispin struct cfg80211_mbssid_config {
1293dc1e3cb8SJohn Crispin 	struct wireless_dev *tx_wdev;
1294dc1e3cb8SJohn Crispin 	u8 index;
1295dc1e3cb8SJohn Crispin 	bool ema;
1296dc1e3cb8SJohn Crispin };
1297dc1e3cb8SJohn Crispin 
1298dc1e3cb8SJohn Crispin /**
1299dc1e3cb8SJohn Crispin  * struct cfg80211_mbssid_elems - Multiple BSSID elements
1300dc1e3cb8SJohn Crispin  *
1301dc1e3cb8SJohn Crispin  * @cnt: Number of elements in array %elems.
1302dc1e3cb8SJohn Crispin  *
1303dc1e3cb8SJohn Crispin  * @elem: Array of multiple BSSID element(s) to be added into Beacon frames.
1304dc1e3cb8SJohn Crispin  * @elem.data: Data for multiple BSSID elements.
1305dc1e3cb8SJohn Crispin  * @elem.len: Length of data.
1306dc1e3cb8SJohn Crispin  */
1307dc1e3cb8SJohn Crispin struct cfg80211_mbssid_elems {
1308dc1e3cb8SJohn Crispin 	u8 cnt;
1309dc1e3cb8SJohn Crispin 	struct {
1310dc1e3cb8SJohn Crispin 		const u8 *data;
1311dc1e3cb8SJohn Crispin 		size_t len;
1312c14679d7SKees Cook 	} elem[] __counted_by(cnt);
1313dc1e3cb8SJohn Crispin };
1314dc1e3cb8SJohn Crispin 
1315dc1e3cb8SJohn Crispin /**
1316dbbb27e1SAloka Dixit  * struct cfg80211_rnr_elems - Reduced neighbor report (RNR) elements
1317dbbb27e1SAloka Dixit  *
1318dbbb27e1SAloka Dixit  * @cnt: Number of elements in array %elems.
1319dbbb27e1SAloka Dixit  *
1320dbbb27e1SAloka Dixit  * @elem: Array of RNR element(s) to be added into Beacon frames.
1321dbbb27e1SAloka Dixit  * @elem.data: Data for RNR elements.
1322dbbb27e1SAloka Dixit  * @elem.len: Length of data.
1323dbbb27e1SAloka Dixit  */
1324dbbb27e1SAloka Dixit struct cfg80211_rnr_elems {
1325dbbb27e1SAloka Dixit 	u8 cnt;
1326dbbb27e1SAloka Dixit 	struct {
1327dbbb27e1SAloka Dixit 		const u8 *data;
1328dbbb27e1SAloka Dixit 		size_t len;
13297b6d7087SKees Cook 	} elem[] __counted_by(cnt);
1330dbbb27e1SAloka Dixit };
1331dbbb27e1SAloka Dixit 
1332dbbb27e1SAloka Dixit /**
13338860020eSJohannes Berg  * struct cfg80211_beacon_data - beacon data
13347b0a0e3cSJohannes Berg  * @link_id: the link ID for the AP MLD link sending this beacon
1335ed1b6cc7SJohannes Berg  * @head: head portion of beacon (before TIM IE)
1336ed1b6cc7SJohannes Berg  *	or %NULL if not changed
1337ed1b6cc7SJohannes Berg  * @tail: tail portion of beacon (after TIM IE)
1338ed1b6cc7SJohannes Berg  *	or %NULL if not changed
1339ed1b6cc7SJohannes Berg  * @head_len: length of @head
1340ed1b6cc7SJohannes Berg  * @tail_len: length of @tail
13419946ecfbSJouni Malinen  * @beacon_ies: extra information element(s) to add into Beacon frames or %NULL
13429946ecfbSJouni Malinen  * @beacon_ies_len: length of beacon_ies in octets
13439946ecfbSJouni Malinen  * @proberesp_ies: extra information element(s) to add into Probe Response
13449946ecfbSJouni Malinen  *	frames or %NULL
13459946ecfbSJouni Malinen  * @proberesp_ies_len: length of proberesp_ies in octets
13469946ecfbSJouni Malinen  * @assocresp_ies: extra information element(s) to add into (Re)Association
13479946ecfbSJouni Malinen  *	Response frames or %NULL
13489946ecfbSJouni Malinen  * @assocresp_ies_len: length of assocresp_ies in octets
134900f740e1SArik Nemtsov  * @probe_resp_len: length of probe response template (@probe_resp)
135000f740e1SArik Nemtsov  * @probe_resp: probe response template (AP mode only)
1351dc1e3cb8SJohn Crispin  * @mbssid_ies: multiple BSSID elements
1352dbbb27e1SAloka Dixit  * @rnr_ies: reduced neighbor report elements
135381e54d08SPradeep Kumar Chitrapu  * @ftm_responder: enable FTM responder functionality; -1 for no change
135481e54d08SPradeep Kumar Chitrapu  *	(which also implies no change in LCI/civic location data)
135530db641eSJohannes Berg  * @lci: Measurement Report element content, starting with Measurement Token
135630db641eSJohannes Berg  *	(measurement type 8)
135730db641eSJohannes Berg  * @civicloc: Measurement Report element content, starting with Measurement
135830db641eSJohannes Berg  *	Token (measurement type 11)
135981e54d08SPradeep Kumar Chitrapu  * @lci_len: LCI data length
136081e54d08SPradeep Kumar Chitrapu  * @civicloc_len: Civic location data length
13613d48cb74SRameshkumar Sundaram  * @he_bss_color: BSS Color settings
13623d48cb74SRameshkumar Sundaram  * @he_bss_color_valid: indicates whether bss color
1363ee0e2f51SJohannes Berg  *	attribute is present in beacon data or not.
1364ed1b6cc7SJohannes Berg  */
13658860020eSJohannes Berg struct cfg80211_beacon_data {
13667b0a0e3cSJohannes Berg 	unsigned int link_id;
13677b0a0e3cSJohannes Berg 
13688860020eSJohannes Berg 	const u8 *head, *tail;
13698860020eSJohannes Berg 	const u8 *beacon_ies;
13708860020eSJohannes Berg 	const u8 *proberesp_ies;
13718860020eSJohannes Berg 	const u8 *assocresp_ies;
13728860020eSJohannes Berg 	const u8 *probe_resp;
137381e54d08SPradeep Kumar Chitrapu 	const u8 *lci;
137481e54d08SPradeep Kumar Chitrapu 	const u8 *civicloc;
1375dc1e3cb8SJohn Crispin 	struct cfg80211_mbssid_elems *mbssid_ies;
1376dbbb27e1SAloka Dixit 	struct cfg80211_rnr_elems *rnr_ies;
137781e54d08SPradeep Kumar Chitrapu 	s8 ftm_responder;
13788860020eSJohannes Berg 
13798860020eSJohannes Berg 	size_t head_len, tail_len;
13808860020eSJohannes Berg 	size_t beacon_ies_len;
13818860020eSJohannes Berg 	size_t proberesp_ies_len;
13828860020eSJohannes Berg 	size_t assocresp_ies_len;
13838860020eSJohannes Berg 	size_t probe_resp_len;
138481e54d08SPradeep Kumar Chitrapu 	size_t lci_len;
138581e54d08SPradeep Kumar Chitrapu 	size_t civicloc_len;
13863d48cb74SRameshkumar Sundaram 	struct cfg80211_he_bss_color he_bss_color;
13873d48cb74SRameshkumar Sundaram 	bool he_bss_color_valid;
13888860020eSJohannes Berg };
13898860020eSJohannes Berg 
13906d45a74bSVasanthakumar Thiagarajan struct mac_address {
13916d45a74bSVasanthakumar Thiagarajan 	u8 addr[ETH_ALEN];
13926d45a74bSVasanthakumar Thiagarajan };
13936d45a74bSVasanthakumar Thiagarajan 
13948860020eSJohannes Berg /**
139577765eafSVasanthakumar Thiagarajan  * struct cfg80211_acl_data - Access control list data
139677765eafSVasanthakumar Thiagarajan  *
139777765eafSVasanthakumar Thiagarajan  * @acl_policy: ACL policy to be applied on the station's
1398077f897aSJohannes Berg  *	entry specified by mac_addr
139977765eafSVasanthakumar Thiagarajan  * @n_acl_entries: Number of MAC address entries passed
140077765eafSVasanthakumar Thiagarajan  * @mac_addrs: List of MAC addresses of stations to be used for ACL
140177765eafSVasanthakumar Thiagarajan  */
140277765eafSVasanthakumar Thiagarajan struct cfg80211_acl_data {
140377765eafSVasanthakumar Thiagarajan 	enum nl80211_acl_policy acl_policy;
140477765eafSVasanthakumar Thiagarajan 	int n_acl_entries;
140577765eafSVasanthakumar Thiagarajan 
140677765eafSVasanthakumar Thiagarajan 	/* Keep it last */
140793ca8244SKees Cook 	struct mac_address mac_addrs[] __counted_by(n_acl_entries);
140877765eafSVasanthakumar Thiagarajan };
140977765eafSVasanthakumar Thiagarajan 
14108860020eSJohannes Berg /**
1411291c49deSAloka Dixit  * struct cfg80211_fils_discovery - FILS discovery parameters from
1412291c49deSAloka Dixit  * IEEE Std 802.11ai-2016, Annex C.3 MIB detail.
1413291c49deSAloka Dixit  *
14140cfaec25SAloka Dixit  * @update: Set to true if the feature configuration should be updated.
1415291c49deSAloka Dixit  * @min_interval: Minimum packet interval in TUs (0 - 10000)
1416291c49deSAloka Dixit  * @max_interval: Maximum packet interval in TUs (0 - 10000)
1417291c49deSAloka Dixit  * @tmpl_len: Template length
1418291c49deSAloka Dixit  * @tmpl: Template data for FILS discovery frame including the action
1419291c49deSAloka Dixit  *	frame headers.
1420291c49deSAloka Dixit  */
1421291c49deSAloka Dixit struct cfg80211_fils_discovery {
14220cfaec25SAloka Dixit 	bool update;
1423291c49deSAloka Dixit 	u32 min_interval;
1424291c49deSAloka Dixit 	u32 max_interval;
1425291c49deSAloka Dixit 	size_t tmpl_len;
1426291c49deSAloka Dixit 	const u8 *tmpl;
1427291c49deSAloka Dixit };
1428291c49deSAloka Dixit 
1429291c49deSAloka Dixit /**
14307443dcd1SAloka Dixit  * struct cfg80211_unsol_bcast_probe_resp - Unsolicited broadcast probe
14317443dcd1SAloka Dixit  *	response parameters in 6GHz.
14327443dcd1SAloka Dixit  *
14330cfaec25SAloka Dixit  * @update: Set to true if the feature configuration should be updated.
14347443dcd1SAloka Dixit  * @interval: Packet interval in TUs. Maximum allowed is 20 TU, as mentioned
14357443dcd1SAloka Dixit  *	in IEEE P802.11ax/D6.0 26.17.2.3.2 - AP behavior for fast passive
14367443dcd1SAloka Dixit  *	scanning
14377443dcd1SAloka Dixit  * @tmpl_len: Template length
14387443dcd1SAloka Dixit  * @tmpl: Template data for probe response
14397443dcd1SAloka Dixit  */
14407443dcd1SAloka Dixit struct cfg80211_unsol_bcast_probe_resp {
14410cfaec25SAloka Dixit 	bool update;
14427443dcd1SAloka Dixit 	u32 interval;
14437443dcd1SAloka Dixit 	size_t tmpl_len;
14447443dcd1SAloka Dixit 	const u8 *tmpl;
14457443dcd1SAloka Dixit };
14467443dcd1SAloka Dixit 
14477443dcd1SAloka Dixit /**
14488860020eSJohannes Berg  * struct cfg80211_ap_settings - AP configuration
14498860020eSJohannes Berg  *
14508860020eSJohannes Berg  * Used to configure an AP interface.
14518860020eSJohannes Berg  *
1452683b6d3bSJohannes Berg  * @chandef: defines the channel to use
14538860020eSJohannes Berg  * @beacon: beacon data
14548860020eSJohannes Berg  * @beacon_interval: beacon interval
14558860020eSJohannes Berg  * @dtim_period: DTIM period
14568860020eSJohannes Berg  * @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from
14578860020eSJohannes Berg  *	user space)
14588860020eSJohannes Berg  * @ssid_len: length of @ssid
14598860020eSJohannes Berg  * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames
14608860020eSJohannes Berg  * @crypto: crypto settings
14618860020eSJohannes Berg  * @privacy: the BSS uses privacy
14628860020eSJohannes Berg  * @auth_type: Authentication type (algorithm)
146318998c38SEliad Peller  * @smps_mode: SMPS mode
14641b658f11SVasanthakumar Thiagarajan  * @inactivity_timeout: time in seconds to determine station's inactivity.
146553cabad7SJohannes Berg  * @p2p_ctwindow: P2P CT Window
146653cabad7SJohannes Berg  * @p2p_opp_ps: P2P opportunistic PS
146777765eafSVasanthakumar Thiagarajan  * @acl: ACL configuration used by the drivers which has support for
146877765eafSVasanthakumar Thiagarajan  *	MAC address based access control
146934d50519SLior David  * @pbss: If set, start as a PCP instead of AP. Relevant for DMG
147034d50519SLior David  *	networks.
14718564e382SJohannes Berg  * @beacon_rate: bitrate to be used for beacons
147266cd794eSJohannes Berg  * @ht_cap: HT capabilities (or %NULL if HT isn't enabled)
147366cd794eSJohannes Berg  * @vht_cap: VHT capabilities (or %NULL if VHT isn't enabled)
1474244eb9aeSShaul Triebitz  * @he_cap: HE capabilities (or %NULL if HE isn't enabled)
14758bc65d38SAloka Dixit  * @eht_cap: EHT capabilities (or %NULL if EHT isn't enabled)
14768bc65d38SAloka Dixit  * @eht_oper: EHT operation IE (or %NULL if EHT isn't enabled)
147766cd794eSJohannes Berg  * @ht_required: stations must support HT
147866cd794eSJohannes Berg  * @vht_required: stations must support VHT
1479a0de1ca3SJohn Crispin  * @twt_responder: Enable Target Wait Time
14802a392596SIlan Peer  * @he_required: stations must support HE
1481d6587602SIlan Peer  * @sae_h2e_required: stations must support direct H2E technique in SAE
14821dcf396bSDmitry Antipov  * @flags: flags, as defined in &enum nl80211_ap_settings_flags
1483796e90f4SJohn Crispin  * @he_obss_pd: OBSS Packet Detection settings
14847e8d6f12SShaul Triebitz  * @he_oper: HE operation IE (or %NULL if HE isn't enabled)
1485291c49deSAloka Dixit  * @fils_discovery: FILS discovery transmission parameters
14867443dcd1SAloka Dixit  * @unsol_bcast_probe_resp: Unsolicited broadcast probe response parameters
1487dc1e3cb8SJohn Crispin  * @mbssid_config: AP settings for multiple bssid
14888860020eSJohannes Berg  */
14898860020eSJohannes Berg struct cfg80211_ap_settings {
1490683b6d3bSJohannes Berg 	struct cfg80211_chan_def chandef;
1491aa430da4SJohannes Berg 
14928860020eSJohannes Berg 	struct cfg80211_beacon_data beacon;
14938860020eSJohannes Berg 
14948860020eSJohannes Berg 	int beacon_interval, dtim_period;
149532e9de84SJouni Malinen 	const u8 *ssid;
149632e9de84SJouni Malinen 	size_t ssid_len;
149732e9de84SJouni Malinen 	enum nl80211_hidden_ssid hidden_ssid;
14985fb628e9SJouni Malinen 	struct cfg80211_crypto_settings crypto;
14995fb628e9SJouni Malinen 	bool privacy;
15005fb628e9SJouni Malinen 	enum nl80211_auth_type auth_type;
150118998c38SEliad Peller 	enum nl80211_smps_mode smps_mode;
15021b658f11SVasanthakumar Thiagarajan 	int inactivity_timeout;
150353cabad7SJohannes Berg 	u8 p2p_ctwindow;
150453cabad7SJohannes Berg 	bool p2p_opp_ps;
150577765eafSVasanthakumar Thiagarajan 	const struct cfg80211_acl_data *acl;
150634d50519SLior David 	bool pbss;
1507a7c7fbffSPurushottam Kushwaha 	struct cfg80211_bitrate_mask beacon_rate;
150866cd794eSJohannes Berg 
150966cd794eSJohannes Berg 	const struct ieee80211_ht_cap *ht_cap;
151066cd794eSJohannes Berg 	const struct ieee80211_vht_cap *vht_cap;
1511244eb9aeSShaul Triebitz 	const struct ieee80211_he_cap_elem *he_cap;
15127e8d6f12SShaul Triebitz 	const struct ieee80211_he_operation *he_oper;
15138bc65d38SAloka Dixit 	const struct ieee80211_eht_cap_elem *eht_cap;
15148bc65d38SAloka Dixit 	const struct ieee80211_eht_operation *eht_oper;
1515d6587602SIlan Peer 	bool ht_required, vht_required, he_required, sae_h2e_required;
1516a0de1ca3SJohn Crispin 	bool twt_responder;
1517fe494370SSrinivas Dasari 	u32 flags;
1518796e90f4SJohn Crispin 	struct ieee80211_he_obss_pd he_obss_pd;
1519291c49deSAloka Dixit 	struct cfg80211_fils_discovery fils_discovery;
15207443dcd1SAloka Dixit 	struct cfg80211_unsol_bcast_probe_resp unsol_bcast_probe_resp;
1521dc1e3cb8SJohn Crispin 	struct cfg80211_mbssid_config mbssid_config;
1522ed1b6cc7SJohannes Berg };
1523ed1b6cc7SJohannes Berg 
1524bb55441cSJohannes Berg 
1525bb55441cSJohannes Berg /**
1526bb55441cSJohannes Berg  * struct cfg80211_ap_update - AP configuration update
1527bb55441cSJohannes Berg  *
1528bb55441cSJohannes Berg  * Subset of &struct cfg80211_ap_settings, for updating a running AP.
1529bb55441cSJohannes Berg  *
1530bb55441cSJohannes Berg  * @beacon: beacon data
1531bb55441cSJohannes Berg  * @fils_discovery: FILS discovery transmission parameters
1532bb55441cSJohannes Berg  * @unsol_bcast_probe_resp: Unsolicited broadcast probe response parameters
1533bb55441cSJohannes Berg  */
1534bb55441cSJohannes Berg struct cfg80211_ap_update {
1535bb55441cSJohannes Berg 	struct cfg80211_beacon_data beacon;
1536bb55441cSJohannes Berg 	struct cfg80211_fils_discovery fils_discovery;
1537bb55441cSJohannes Berg 	struct cfg80211_unsol_bcast_probe_resp unsol_bcast_probe_resp;
1538bb55441cSJohannes Berg };
1539bb55441cSJohannes Berg 
15405727ef1bSJohannes Berg /**
154116ef1fe2SSimon Wunderlich  * struct cfg80211_csa_settings - channel switch settings
154216ef1fe2SSimon Wunderlich  *
154316ef1fe2SSimon Wunderlich  * Used for channel switch
154416ef1fe2SSimon Wunderlich  *
154516ef1fe2SSimon Wunderlich  * @chandef: defines the channel to use after the switch
154616ef1fe2SSimon Wunderlich  * @beacon_csa: beacon data while performing the switch
15479a774c78SAndrei Otcheretianski  * @counter_offsets_beacon: offsets of the counters within the beacon (tail)
15489a774c78SAndrei Otcheretianski  * @counter_offsets_presp: offsets of the counters within the probe response
15499a774c78SAndrei Otcheretianski  * @n_counter_offsets_beacon: number of csa counters the beacon (tail)
15509a774c78SAndrei Otcheretianski  * @n_counter_offsets_presp: number of csa counters in the probe response
155116ef1fe2SSimon Wunderlich  * @beacon_after: beacon data to be used on the new channel
155216ef1fe2SSimon Wunderlich  * @radar_required: whether radar detection is required on the new channel
155316ef1fe2SSimon Wunderlich  * @block_tx: whether transmissions should be blocked while changing
155416ef1fe2SSimon Wunderlich  * @count: number of beacons until switch
15554ace04c0SAditya Kumar Singh  * @link_id: defines the link on which channel switch is expected during
15564ace04c0SAditya Kumar Singh  *	MLO. 0 in case of non-MLO.
155716ef1fe2SSimon Wunderlich  */
155816ef1fe2SSimon Wunderlich struct cfg80211_csa_settings {
155916ef1fe2SSimon Wunderlich 	struct cfg80211_chan_def chandef;
156016ef1fe2SSimon Wunderlich 	struct cfg80211_beacon_data beacon_csa;
15619a774c78SAndrei Otcheretianski 	const u16 *counter_offsets_beacon;
15629a774c78SAndrei Otcheretianski 	const u16 *counter_offsets_presp;
15639a774c78SAndrei Otcheretianski 	unsigned int n_counter_offsets_beacon;
15649a774c78SAndrei Otcheretianski 	unsigned int n_counter_offsets_presp;
156516ef1fe2SSimon Wunderlich 	struct cfg80211_beacon_data beacon_after;
156616ef1fe2SSimon Wunderlich 	bool radar_required;
156716ef1fe2SSimon Wunderlich 	bool block_tx;
156816ef1fe2SSimon Wunderlich 	u8 count;
15694ace04c0SAditya Kumar Singh 	u8 link_id;
157016ef1fe2SSimon Wunderlich };
157116ef1fe2SSimon Wunderlich 
157216ef1fe2SSimon Wunderlich /**
15730d2ab3aeSJohn Crispin  * struct cfg80211_color_change_settings - color change settings
15740d2ab3aeSJohn Crispin  *
15750d2ab3aeSJohn Crispin  * Used for bss color change
15760d2ab3aeSJohn Crispin  *
15770d2ab3aeSJohn Crispin  * @beacon_color_change: beacon data while performing the color countdown
15782d8b08feSMauro Carvalho Chehab  * @counter_offset_beacon: offsets of the counters within the beacon (tail)
15792d8b08feSMauro Carvalho Chehab  * @counter_offset_presp: offsets of the counters within the probe response
15800d2ab3aeSJohn Crispin  * @beacon_next: beacon data to be used after the color change
15810d2ab3aeSJohn Crispin  * @count: number of beacons until the color change
15820d2ab3aeSJohn Crispin  * @color: the color used after the change
158391d2b6eeSAditya Kumar Singh  * @link_id: defines the link on which color change is expected during MLO.
158491d2b6eeSAditya Kumar Singh  *	0 in case of non-MLO.
15850d2ab3aeSJohn Crispin  */
15860d2ab3aeSJohn Crispin struct cfg80211_color_change_settings {
15870d2ab3aeSJohn Crispin 	struct cfg80211_beacon_data beacon_color_change;
15880d2ab3aeSJohn Crispin 	u16 counter_offset_beacon;
15890d2ab3aeSJohn Crispin 	u16 counter_offset_presp;
15900d2ab3aeSJohn Crispin 	struct cfg80211_beacon_data beacon_next;
15910d2ab3aeSJohn Crispin 	u8 count;
15920d2ab3aeSJohn Crispin 	u8 color;
159391d2b6eeSAditya Kumar Singh 	u8 link_id;
15940d2ab3aeSJohn Crispin };
15950d2ab3aeSJohn Crispin 
15960d2ab3aeSJohn Crispin /**
1597e227300cSPurushottam Kushwaha  * struct iface_combination_params - input parameters for interface combinations
1598e227300cSPurushottam Kushwaha  *
1599e227300cSPurushottam Kushwaha  * Used to pass interface combination parameters
1600e227300cSPurushottam Kushwaha  *
1601abb4cfe3SFelix Fietkau  * @radio_idx: wiphy radio index or -1 for global
1602e227300cSPurushottam Kushwaha  * @num_different_channels: the number of different channels we want
1603e227300cSPurushottam Kushwaha  *	to use for verification
1604e227300cSPurushottam Kushwaha  * @radar_detect: a bitmap where each bit corresponds to a channel
1605e227300cSPurushottam Kushwaha  *	width where radar detection is needed, as in the definition of
1606e227300cSPurushottam Kushwaha  *	&struct ieee80211_iface_combination.@radar_detect_widths
1607e227300cSPurushottam Kushwaha  * @iftype_num: array with the number of interfaces of each interface
1608e227300cSPurushottam Kushwaha  *	type.  The index is the interface type as specified in &enum
1609e227300cSPurushottam Kushwaha  *	nl80211_iftype.
16104c8dea63SJohannes Berg  * @new_beacon_int: set this to the beacon interval of a new interface
16114c8dea63SJohannes Berg  *	that's not operating yet, if such is to be checked as part of
16124c8dea63SJohannes Berg  *	the verification
1613e227300cSPurushottam Kushwaha  */
1614e227300cSPurushottam Kushwaha struct iface_combination_params {
1615abb4cfe3SFelix Fietkau 	int radio_idx;
1616e227300cSPurushottam Kushwaha 	int num_different_channels;
1617e227300cSPurushottam Kushwaha 	u8 radar_detect;
1618e227300cSPurushottam Kushwaha 	int iftype_num[NUM_NL80211_IFTYPES];
16194c8dea63SJohannes Berg 	u32 new_beacon_int;
1620e227300cSPurushottam Kushwaha };
1621e227300cSPurushottam Kushwaha 
1622e227300cSPurushottam Kushwaha /**
16233b9ce80cSJohannes Berg  * enum station_parameters_apply_mask - station parameter values to apply
16243b9ce80cSJohannes Berg  * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp)
16259d62a986SJouni Malinen  * @STATION_PARAM_APPLY_CAPABILITY: apply new capability
1626f8bacc21SJohannes Berg  * @STATION_PARAM_APPLY_PLINK_STATE: apply new plink state
16273b9ce80cSJohannes Berg  *
16283b9ce80cSJohannes Berg  * Not all station parameters have in-band "no change" signalling,
16293b9ce80cSJohannes Berg  * for those that don't these flags will are used.
16303b9ce80cSJohannes Berg  */
16313b9ce80cSJohannes Berg enum station_parameters_apply_mask {
16323b9ce80cSJohannes Berg 	STATION_PARAM_APPLY_UAPSD = BIT(0),
16339d62a986SJouni Malinen 	STATION_PARAM_APPLY_CAPABILITY = BIT(1),
1634f8bacc21SJohannes Berg 	STATION_PARAM_APPLY_PLINK_STATE = BIT(2),
1635e96d1cd2SAshok Raj Nagarajan };
1636e96d1cd2SAshok Raj Nagarajan 
1637e96d1cd2SAshok Raj Nagarajan /**
1638e96d1cd2SAshok Raj Nagarajan  * struct sta_txpwr - station txpower configuration
1639e96d1cd2SAshok Raj Nagarajan  *
1640e96d1cd2SAshok Raj Nagarajan  * Used to configure txpower for station.
1641e96d1cd2SAshok Raj Nagarajan  *
1642e96d1cd2SAshok Raj Nagarajan  * @power: tx power (in dBm) to be used for sending data traffic. If tx power
1643e96d1cd2SAshok Raj Nagarajan  *	is not provided, the default per-interface tx power setting will be
1644e96d1cd2SAshok Raj Nagarajan  *	overriding. Driver should be picking up the lowest tx power, either tx
1645e96d1cd2SAshok Raj Nagarajan  *	power per-interface or per-station.
1646e96d1cd2SAshok Raj Nagarajan  * @type: In particular if TPC %type is NL80211_TX_POWER_LIMITED then tx power
1647e96d1cd2SAshok Raj Nagarajan  *	will be less than or equal to specified from userspace, whereas if TPC
1648e96d1cd2SAshok Raj Nagarajan  *	%type is NL80211_TX_POWER_AUTOMATIC then it indicates default tx power.
1649e96d1cd2SAshok Raj Nagarajan  *	NL80211_TX_POWER_FIXED is not a valid configuration option for
1650e96d1cd2SAshok Raj Nagarajan  *	per peer TPC.
1651e96d1cd2SAshok Raj Nagarajan  */
1652e96d1cd2SAshok Raj Nagarajan struct sta_txpwr {
1653e96d1cd2SAshok Raj Nagarajan 	s16 power;
1654e96d1cd2SAshok Raj Nagarajan 	enum nl80211_tx_power_setting type;
16553b9ce80cSJohannes Berg };
16563b9ce80cSJohannes Berg 
16573b9ce80cSJohannes Berg /**
1658577e5b8cSShaul Triebitz  * struct link_station_parameters - link station parameters
1659577e5b8cSShaul Triebitz  *
1660577e5b8cSShaul Triebitz  * Used to change and create a new link station.
1661577e5b8cSShaul Triebitz  *
1662577e5b8cSShaul Triebitz  * @mld_mac: MAC address of the station
1663577e5b8cSShaul Triebitz  * @link_id: the link id (-1 for non-MLD station)
1664577e5b8cSShaul Triebitz  * @link_mac: MAC address of the link
1665577e5b8cSShaul Triebitz  * @supported_rates: supported rates in IEEE 802.11 format
1666577e5b8cSShaul Triebitz  *	(or NULL for no change)
1667577e5b8cSShaul Triebitz  * @supported_rates_len: number of supported rates
1668577e5b8cSShaul Triebitz  * @ht_capa: HT capabilities of station
1669577e5b8cSShaul Triebitz  * @vht_capa: VHT capabilities of station
1670577e5b8cSShaul Triebitz  * @opmode_notif: operating mode field from Operating Mode Notification
1671577e5b8cSShaul Triebitz  * @opmode_notif_used: information if operating mode field is used
1672577e5b8cSShaul Triebitz  * @he_capa: HE capabilities of station
1673577e5b8cSShaul Triebitz  * @he_capa_len: the length of the HE capabilities
1674577e5b8cSShaul Triebitz  * @txpwr: transmit power for an associated station
1675577e5b8cSShaul Triebitz  * @txpwr_set: txpwr field is set
1676577e5b8cSShaul Triebitz  * @he_6ghz_capa: HE 6 GHz Band capabilities of station
1677577e5b8cSShaul Triebitz  * @eht_capa: EHT capabilities of station
1678577e5b8cSShaul Triebitz  * @eht_capa_len: the length of the EHT capabilities
1679577e5b8cSShaul Triebitz  */
1680577e5b8cSShaul Triebitz struct link_station_parameters {
1681577e5b8cSShaul Triebitz 	const u8 *mld_mac;
1682577e5b8cSShaul Triebitz 	int link_id;
1683577e5b8cSShaul Triebitz 	const u8 *link_mac;
1684577e5b8cSShaul Triebitz 	const u8 *supported_rates;
1685577e5b8cSShaul Triebitz 	u8 supported_rates_len;
1686577e5b8cSShaul Triebitz 	const struct ieee80211_ht_cap *ht_capa;
1687577e5b8cSShaul Triebitz 	const struct ieee80211_vht_cap *vht_capa;
1688577e5b8cSShaul Triebitz 	u8 opmode_notif;
1689577e5b8cSShaul Triebitz 	bool opmode_notif_used;
1690577e5b8cSShaul Triebitz 	const struct ieee80211_he_cap_elem *he_capa;
1691577e5b8cSShaul Triebitz 	u8 he_capa_len;
1692577e5b8cSShaul Triebitz 	struct sta_txpwr txpwr;
1693577e5b8cSShaul Triebitz 	bool txpwr_set;
1694577e5b8cSShaul Triebitz 	const struct ieee80211_he_6ghz_capa *he_6ghz_capa;
1695577e5b8cSShaul Triebitz 	const struct ieee80211_eht_cap_elem *eht_capa;
1696577e5b8cSShaul Triebitz 	u8 eht_capa_len;
1697577e5b8cSShaul Triebitz };
1698577e5b8cSShaul Triebitz 
1699577e5b8cSShaul Triebitz /**
1700577e5b8cSShaul Triebitz  * struct link_station_del_parameters - link station deletion parameters
1701577e5b8cSShaul Triebitz  *
1702577e5b8cSShaul Triebitz  * Used to delete a link station entry (or all stations).
1703577e5b8cSShaul Triebitz  *
1704577e5b8cSShaul Triebitz  * @mld_mac: MAC address of the station
1705577e5b8cSShaul Triebitz  * @link_id: the link id
1706577e5b8cSShaul Triebitz  */
1707577e5b8cSShaul Triebitz struct link_station_del_parameters {
1708577e5b8cSShaul Triebitz 	const u8 *mld_mac;
1709577e5b8cSShaul Triebitz 	u32 link_id;
1710577e5b8cSShaul Triebitz };
1711577e5b8cSShaul Triebitz 
1712577e5b8cSShaul Triebitz /**
1713b61e6b41SIlan Peer  * struct cfg80211_ttlm_params: TID to link mapping parameters
1714b61e6b41SIlan Peer  *
1715b61e6b41SIlan Peer  * Used for setting a TID to link mapping.
1716b61e6b41SIlan Peer  *
1717b61e6b41SIlan Peer  * @dlink: Downlink TID to link mapping, as defined in section 9.4.2.314
1718b61e6b41SIlan Peer  *     (TID-To-Link Mapping element) in Draft P802.11be_D4.0.
1719b61e6b41SIlan Peer  * @ulink: Uplink TID to link mapping, as defined in section 9.4.2.314
1720b61e6b41SIlan Peer  *     (TID-To-Link Mapping element) in Draft P802.11be_D4.0.
1721b61e6b41SIlan Peer  */
1722b61e6b41SIlan Peer struct cfg80211_ttlm_params {
1723b61e6b41SIlan Peer 	u16 dlink[8];
1724b61e6b41SIlan Peer 	u16 ulink[8];
1725b61e6b41SIlan Peer };
1726b61e6b41SIlan Peer 
1727b61e6b41SIlan Peer /**
17285727ef1bSJohannes Berg  * struct station_parameters - station parameters
17295727ef1bSJohannes Berg  *
17305727ef1bSJohannes Berg  * Used to change and create a new station.
17315727ef1bSJohannes Berg  *
17325727ef1bSJohannes Berg  * @vlan: vlan interface station should belong to
1733eccb8e8fSJohannes Berg  * @sta_flags_mask: station flags that changed
1734819bf593SJohannes Berg  *	(bitmask of BIT(%NL80211_STA_FLAG_...))
1735eccb8e8fSJohannes Berg  * @sta_flags_set: station flags values
1736819bf593SJohannes Berg  *	(bitmask of BIT(%NL80211_STA_FLAG_...))
17375727ef1bSJohannes Berg  * @listen_interval: listen interval or -1 for no change
17385727ef1bSJohannes Berg  * @aid: AID or zero for no change
173914f34e36SGurumoorthi Gnanasambandhan  * @vlan_id: VLAN ID for station (if nonzero)
17407d27a0baSMasashi Honma  * @peer_aid: mesh peer AID or zero for no change
1741abe37c4bSJohannes Berg  * @plink_action: plink action to take
17429c3990aaSJavier Cardona  * @plink_state: set the peer link state for a station
1743910868dbSEliad Peller  * @uapsd_queues: bitmap of queues configured for uapsd. same format
1744910868dbSEliad Peller  *	as the AC bitmap in the QoS info field
1745910868dbSEliad Peller  * @max_sp: max Service Period. same format as the MAX_SP in the
1746910868dbSEliad Peller  *	QoS info field (but already shifted down)
1747c26887d2SJohannes Berg  * @sta_modify_mask: bitmap indicating which parameters changed
1748c26887d2SJohannes Berg  *	(for those that don't have a natural "no change" value),
1749c26887d2SJohannes Berg  *	see &enum station_parameters_apply_mask
17503b1c5a53SMarco Porsch  * @local_pm: local link-specific mesh power save mode (no change when set
17513b1c5a53SMarco Porsch  *	to unknown)
17529d62a986SJouni Malinen  * @capability: station capability
17539d62a986SJouni Malinen  * @ext_capab: extended capabilities of the station
17549d62a986SJouni Malinen  * @ext_capab_len: number of extended capabilities
1755c01fc9adSSunil Dutt  * @supported_channels: supported channels in IEEE 802.11 format
1756c01fc9adSSunil Dutt  * @supported_channels_len: number of supported channels
1757c01fc9adSSunil Dutt  * @supported_oper_classes: supported oper classes in IEEE 802.11 format
1758c01fc9adSSunil Dutt  * @supported_oper_classes_len: number of supported operating classes
175917b94247SAyala Beker  * @support_p2p_ps: information if station supports P2P PS mechanism
176036647055SToke Høiland-Jørgensen  * @airtime_weight: airtime scheduler weight for this station
1761b95eb7f0SShaul Triebitz  * @link_sta_params: link related params.
17625727ef1bSJohannes Berg  */
17635727ef1bSJohannes Berg struct station_parameters {
17645727ef1bSJohannes Berg 	struct net_device *vlan;
1765eccb8e8fSJohannes Berg 	u32 sta_flags_mask, sta_flags_set;
17663b9ce80cSJohannes Berg 	u32 sta_modify_mask;
17675727ef1bSJohannes Berg 	int listen_interval;
17685727ef1bSJohannes Berg 	u16 aid;
176914f34e36SGurumoorthi Gnanasambandhan 	u16 vlan_id;
17707d27a0baSMasashi Honma 	u16 peer_aid;
17712ec600d6SLuis Carlos Cobo 	u8 plink_action;
17729c3990aaSJavier Cardona 	u8 plink_state;
1773c75786c9SEliad Peller 	u8 uapsd_queues;
1774c75786c9SEliad Peller 	u8 max_sp;
17753b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode local_pm;
17769d62a986SJouni Malinen 	u16 capability;
17772c1aabf3SJohannes Berg 	const u8 *ext_capab;
17789d62a986SJouni Malinen 	u8 ext_capab_len;
1779c01fc9adSSunil Dutt 	const u8 *supported_channels;
1780c01fc9adSSunil Dutt 	u8 supported_channels_len;
1781c01fc9adSSunil Dutt 	const u8 *supported_oper_classes;
1782c01fc9adSSunil Dutt 	u8 supported_oper_classes_len;
178317b94247SAyala Beker 	int support_p2p_ps;
178436647055SToke Høiland-Jørgensen 	u16 airtime_weight;
1785b95eb7f0SShaul Triebitz 	struct link_station_parameters link_sta_params;
17865727ef1bSJohannes Berg };
17875727ef1bSJohannes Berg 
1788fd5b74dcSJohannes Berg /**
178989c771e5SJouni Malinen  * struct station_del_parameters - station deletion parameters
179089c771e5SJouni Malinen  *
179189c771e5SJouni Malinen  * Used to delete a station entry (or all stations).
179289c771e5SJouni Malinen  *
179389c771e5SJouni Malinen  * @mac: MAC address of the station to remove or NULL to remove all stations
179498856866SJouni Malinen  * @subtype: Management frame subtype to use for indicating removal
179598856866SJouni Malinen  *	(10 = Disassociation, 12 = Deauthentication)
179698856866SJouni Malinen  * @reason_code: Reason code for the Disassociation/Deauthentication frame
1797f6ca96aaSAditya Kumar Singh  * @link_id: Link ID indicating a link that stations to be flushed must be
1798f6ca96aaSAditya Kumar Singh  *	using; valid only for MLO, but can also be -1 for MLO to really
1799f6ca96aaSAditya Kumar Singh  *	remove all stations.
180089c771e5SJouni Malinen  */
180189c771e5SJouni Malinen struct station_del_parameters {
180289c771e5SJouni Malinen 	const u8 *mac;
180398856866SJouni Malinen 	u8 subtype;
180498856866SJouni Malinen 	u16 reason_code;
1805f6ca96aaSAditya Kumar Singh 	int link_id;
180689c771e5SJouni Malinen };
180789c771e5SJouni Malinen 
180889c771e5SJouni Malinen /**
180977ee7c89SJohannes Berg  * enum cfg80211_station_type - the type of station being modified
181077ee7c89SJohannes Berg  * @CFG80211_STA_AP_CLIENT: client of an AP interface
181147edb11bSAyala Beker  * @CFG80211_STA_AP_CLIENT_UNASSOC: client of an AP interface that is still
181247edb11bSAyala Beker  *	unassociated (update properties for this type of client is permitted)
181377ee7c89SJohannes Berg  * @CFG80211_STA_AP_MLME_CLIENT: client of an AP interface that has
181477ee7c89SJohannes Berg  *	the AP MLME in the device
181577ee7c89SJohannes Berg  * @CFG80211_STA_AP_STA: AP station on managed interface
181677ee7c89SJohannes Berg  * @CFG80211_STA_IBSS: IBSS station
181777ee7c89SJohannes Berg  * @CFG80211_STA_TDLS_PEER_SETUP: TDLS peer on managed interface (dummy entry
181877ee7c89SJohannes Berg  *	while TDLS setup is in progress, it moves out of this state when
181977ee7c89SJohannes Berg  *	being marked authorized; use this only if TDLS with external setup is
182077ee7c89SJohannes Berg  *	supported/used)
182177ee7c89SJohannes Berg  * @CFG80211_STA_TDLS_PEER_ACTIVE: TDLS peer on managed interface (active
182277ee7c89SJohannes Berg  *	entry that is operating, has been marked authorized by userspace)
1823eef941e6SThomas Pedersen  * @CFG80211_STA_MESH_PEER_KERNEL: peer on mesh interface (kernel managed)
1824eef941e6SThomas Pedersen  * @CFG80211_STA_MESH_PEER_USER: peer on mesh interface (user managed)
182577ee7c89SJohannes Berg  */
182677ee7c89SJohannes Berg enum cfg80211_station_type {
182777ee7c89SJohannes Berg 	CFG80211_STA_AP_CLIENT,
182847edb11bSAyala Beker 	CFG80211_STA_AP_CLIENT_UNASSOC,
182977ee7c89SJohannes Berg 	CFG80211_STA_AP_MLME_CLIENT,
183077ee7c89SJohannes Berg 	CFG80211_STA_AP_STA,
183177ee7c89SJohannes Berg 	CFG80211_STA_IBSS,
183277ee7c89SJohannes Berg 	CFG80211_STA_TDLS_PEER_SETUP,
183377ee7c89SJohannes Berg 	CFG80211_STA_TDLS_PEER_ACTIVE,
1834eef941e6SThomas Pedersen 	CFG80211_STA_MESH_PEER_KERNEL,
1835eef941e6SThomas Pedersen 	CFG80211_STA_MESH_PEER_USER,
183677ee7c89SJohannes Berg };
183777ee7c89SJohannes Berg 
183877ee7c89SJohannes Berg /**
183977ee7c89SJohannes Berg  * cfg80211_check_station_change - validate parameter changes
184077ee7c89SJohannes Berg  * @wiphy: the wiphy this operates on
184177ee7c89SJohannes Berg  * @params: the new parameters for a station
184277ee7c89SJohannes Berg  * @statype: the type of station being modified
184377ee7c89SJohannes Berg  *
184477ee7c89SJohannes Berg  * Utility function for the @change_station driver method. Call this function
184577ee7c89SJohannes Berg  * with the appropriate station type looking up the station (and checking that
184662cc206cSJeff Johnson  * it exists). It will verify whether the station change is acceptable.
184762cc206cSJeff Johnson  *
184862cc206cSJeff Johnson  * Return: 0 if the change is acceptable, otherwise an error code. Note that
184962cc206cSJeff Johnson  * it may modify the parameters for backward compatibility reasons, so don't
185062cc206cSJeff Johnson  * use them before calling this.
185177ee7c89SJohannes Berg  */
185277ee7c89SJohannes Berg int cfg80211_check_station_change(struct wiphy *wiphy,
185377ee7c89SJohannes Berg 				  struct station_parameters *params,
185477ee7c89SJohannes Berg 				  enum cfg80211_station_type statype);
185577ee7c89SJohannes Berg 
185677ee7c89SJohannes Berg /**
1857b1e8eb11SMauro Carvalho Chehab  * enum rate_info_flags - bitrate info flags
1858420e7fabSHenning Rogge  *
1859420e7fabSHenning Rogge  * Used by the driver to indicate the specific rate transmission
1860420e7fabSHenning Rogge  * type for 802.11n transmissions.
1861420e7fabSHenning Rogge  *
1862db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_MCS: mcs field filled with HT MCS
1863db9c64cfSJohannes Berg  * @RATE_INFO_FLAGS_VHT_MCS: mcs field filled with VHT MCS
1864420e7fabSHenning Rogge  * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval
18652a38075cSAlexei Avshalom Lazar  * @RATE_INFO_FLAGS_DMG: 60GHz MCS
1866c4cbaf79SLuca Coelho  * @RATE_INFO_FLAGS_HE_MCS: HE MCS information
18672a38075cSAlexei Avshalom Lazar  * @RATE_INFO_FLAGS_EDMG: 60GHz MCS in EDMG mode
1868d9c85e24SMax Chen  * @RATE_INFO_FLAGS_EXTENDED_SC_DMG: 60GHz extended SC MCS
1869cfb14110SVeerendranath Jakkam  * @RATE_INFO_FLAGS_EHT_MCS: EHT MCS information
18702ad66fcbSGilad Itzkovitch  * @RATE_INFO_FLAGS_S1G_MCS: MCS field filled with S1G MCS
1871420e7fabSHenning Rogge  */
1872420e7fabSHenning Rogge enum rate_info_flags {
1873db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_MCS			= BIT(0),
1874db9c64cfSJohannes Berg 	RATE_INFO_FLAGS_VHT_MCS			= BIT(1),
1875b51f3beeSJohannes Berg 	RATE_INFO_FLAGS_SHORT_GI		= BIT(2),
18762a38075cSAlexei Avshalom Lazar 	RATE_INFO_FLAGS_DMG			= BIT(3),
1877c4cbaf79SLuca Coelho 	RATE_INFO_FLAGS_HE_MCS			= BIT(4),
18782a38075cSAlexei Avshalom Lazar 	RATE_INFO_FLAGS_EDMG			= BIT(5),
1879d9c85e24SMax Chen 	RATE_INFO_FLAGS_EXTENDED_SC_DMG		= BIT(6),
1880cfb14110SVeerendranath Jakkam 	RATE_INFO_FLAGS_EHT_MCS			= BIT(7),
18812ad66fcbSGilad Itzkovitch 	RATE_INFO_FLAGS_S1G_MCS			= BIT(8),
1882b51f3beeSJohannes Berg };
1883b51f3beeSJohannes Berg 
1884b51f3beeSJohannes Berg /**
1885b51f3beeSJohannes Berg  * enum rate_info_bw - rate bandwidth information
1886b51f3beeSJohannes Berg  *
1887b51f3beeSJohannes Berg  * Used by the driver to indicate the rate bandwidth.
1888b51f3beeSJohannes Berg  *
1889b51f3beeSJohannes Berg  * @RATE_INFO_BW_5: 5 MHz bandwidth
1890b51f3beeSJohannes Berg  * @RATE_INFO_BW_10: 10 MHz bandwidth
1891b51f3beeSJohannes Berg  * @RATE_INFO_BW_20: 20 MHz bandwidth
1892b51f3beeSJohannes Berg  * @RATE_INFO_BW_40: 40 MHz bandwidth
1893b51f3beeSJohannes Berg  * @RATE_INFO_BW_80: 80 MHz bandwidth
1894b51f3beeSJohannes Berg  * @RATE_INFO_BW_160: 160 MHz bandwidth
1895c4cbaf79SLuca Coelho  * @RATE_INFO_BW_HE_RU: bandwidth determined by HE RU allocation
1896cfb14110SVeerendranath Jakkam  * @RATE_INFO_BW_320: 320 MHz bandwidth
1897cfb14110SVeerendranath Jakkam  * @RATE_INFO_BW_EHT_RU: bandwidth determined by EHT RU allocation
18982ad66fcbSGilad Itzkovitch  * @RATE_INFO_BW_1: 1 MHz bandwidth
18992ad66fcbSGilad Itzkovitch  * @RATE_INFO_BW_2: 2 MHz bandwidth
19002ad66fcbSGilad Itzkovitch  * @RATE_INFO_BW_4: 4 MHz bandwidth
19012ad66fcbSGilad Itzkovitch  * @RATE_INFO_BW_8: 8 MHz bandwidth
19022ad66fcbSGilad Itzkovitch  * @RATE_INFO_BW_16: 16 MHz bandwidth
1903b51f3beeSJohannes Berg  */
1904b51f3beeSJohannes Berg enum rate_info_bw {
1905842be75cSJohannes Berg 	RATE_INFO_BW_20 = 0,
1906b51f3beeSJohannes Berg 	RATE_INFO_BW_5,
1907b51f3beeSJohannes Berg 	RATE_INFO_BW_10,
1908b51f3beeSJohannes Berg 	RATE_INFO_BW_40,
1909b51f3beeSJohannes Berg 	RATE_INFO_BW_80,
1910b51f3beeSJohannes Berg 	RATE_INFO_BW_160,
1911c4cbaf79SLuca Coelho 	RATE_INFO_BW_HE_RU,
1912cfb14110SVeerendranath Jakkam 	RATE_INFO_BW_320,
1913cfb14110SVeerendranath Jakkam 	RATE_INFO_BW_EHT_RU,
19142ad66fcbSGilad Itzkovitch 	RATE_INFO_BW_1,
19152ad66fcbSGilad Itzkovitch 	RATE_INFO_BW_2,
19162ad66fcbSGilad Itzkovitch 	RATE_INFO_BW_4,
19172ad66fcbSGilad Itzkovitch 	RATE_INFO_BW_8,
19182ad66fcbSGilad Itzkovitch 	RATE_INFO_BW_16,
1919420e7fabSHenning Rogge };
1920420e7fabSHenning Rogge 
1921420e7fabSHenning Rogge /**
1922420e7fabSHenning Rogge  * struct rate_info - bitrate information
1923420e7fabSHenning Rogge  *
1924420e7fabSHenning Rogge  * Information about a receiving or transmitting bitrate
1925420e7fabSHenning Rogge  *
1926420e7fabSHenning Rogge  * @flags: bitflag of flags from &enum rate_info_flags
1927420e7fabSHenning Rogge  * @legacy: bitrate in 100kbit/s for 802.11abg
19282ad66fcbSGilad Itzkovitch  * @mcs: mcs index if struct describes an HT/VHT/HE/EHT/S1G rate
1929c4cbaf79SLuca Coelho  * @nss: number of streams (VHT & HE only)
1930b51f3beeSJohannes Berg  * @bw: bandwidth (from &enum rate_info_bw)
1931c4cbaf79SLuca Coelho  * @he_gi: HE guard interval (from &enum nl80211_he_gi)
1932c4cbaf79SLuca Coelho  * @he_dcm: HE DCM value
1933c4cbaf79SLuca Coelho  * @he_ru_alloc: HE RU allocation (from &enum nl80211_he_ru_alloc,
1934c4cbaf79SLuca Coelho  *	only valid if bw is %RATE_INFO_BW_HE_RU)
19352a38075cSAlexei Avshalom Lazar  * @n_bonded_ch: In case of EDMG the number of bonded channels (1-4)
1936cfb14110SVeerendranath Jakkam  * @eht_gi: EHT guard interval (from &enum nl80211_eht_gi)
1937cfb14110SVeerendranath Jakkam  * @eht_ru_alloc: EHT RU allocation (from &enum nl80211_eht_ru_alloc,
1938cfb14110SVeerendranath Jakkam  *	only valid if bw is %RATE_INFO_BW_EHT_RU)
1939420e7fabSHenning Rogge  */
1940420e7fabSHenning Rogge struct rate_info {
19412ad66fcbSGilad Itzkovitch 	u16 flags;
1942420e7fabSHenning Rogge 	u16 legacy;
19432ad66fcbSGilad Itzkovitch 	u8 mcs;
1944db9c64cfSJohannes Berg 	u8 nss;
1945b51f3beeSJohannes Berg 	u8 bw;
1946c4cbaf79SLuca Coelho 	u8 he_gi;
1947c4cbaf79SLuca Coelho 	u8 he_dcm;
1948c4cbaf79SLuca Coelho 	u8 he_ru_alloc;
19492a38075cSAlexei Avshalom Lazar 	u8 n_bonded_ch;
1950cfb14110SVeerendranath Jakkam 	u8 eht_gi;
1951cfb14110SVeerendranath Jakkam 	u8 eht_ru_alloc;
1952fd5b74dcSJohannes Berg };
1953fd5b74dcSJohannes Berg 
1954fd5b74dcSJohannes Berg /**
1955b1e8eb11SMauro Carvalho Chehab  * enum bss_param_flags - bitrate info flags
1956f4263c98SPaul Stewart  *
1957f4263c98SPaul Stewart  * Used by the driver to indicate the specific rate transmission
1958f4263c98SPaul Stewart  * type for 802.11n transmissions.
1959f4263c98SPaul Stewart  *
1960f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_CTS_PROT: whether CTS protection is enabled
1961f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_SHORT_PREAMBLE: whether short preamble is enabled
1962f4263c98SPaul Stewart  * @BSS_PARAM_FLAGS_SHORT_SLOT_TIME: whether short slot time is enabled
1963f4263c98SPaul Stewart  */
1964f4263c98SPaul Stewart enum bss_param_flags {
19658682ad36SJohannes Berg 	BSS_PARAM_FLAGS_CTS_PROT	= BIT(0),
19668682ad36SJohannes Berg 	BSS_PARAM_FLAGS_SHORT_PREAMBLE	= BIT(1),
19678682ad36SJohannes Berg 	BSS_PARAM_FLAGS_SHORT_SLOT_TIME	= BIT(2),
1968f4263c98SPaul Stewart };
1969f4263c98SPaul Stewart 
1970f4263c98SPaul Stewart /**
1971f4263c98SPaul Stewart  * struct sta_bss_parameters - BSS parameters for the attached station
1972f4263c98SPaul Stewart  *
1973f4263c98SPaul Stewart  * Information about the currently associated BSS
1974f4263c98SPaul Stewart  *
1975f4263c98SPaul Stewart  * @flags: bitflag of flags from &enum bss_param_flags
1976f4263c98SPaul Stewart  * @dtim_period: DTIM period for the BSS
1977f4263c98SPaul Stewart  * @beacon_interval: beacon interval
1978f4263c98SPaul Stewart  */
1979f4263c98SPaul Stewart struct sta_bss_parameters {
1980f4263c98SPaul Stewart 	u8 flags;
1981f4263c98SPaul Stewart 	u8 dtim_period;
1982f4263c98SPaul Stewart 	u16 beacon_interval;
1983f4263c98SPaul Stewart };
1984f4263c98SPaul Stewart 
19856de39808SJohannes Berg /**
198652539ca8SToke Høiland-Jørgensen  * struct cfg80211_txq_stats - TXQ statistics for this TID
198752539ca8SToke Høiland-Jørgensen  * @filled: bitmap of flags using the bits of &enum nl80211_txq_stats to
198852539ca8SToke Høiland-Jørgensen  *	indicate the relevant values in this struct are filled
198952539ca8SToke Høiland-Jørgensen  * @backlog_bytes: total number of bytes currently backlogged
199052539ca8SToke Høiland-Jørgensen  * @backlog_packets: total number of packets currently backlogged
199152539ca8SToke Høiland-Jørgensen  * @flows: number of new flows seen
199252539ca8SToke Høiland-Jørgensen  * @drops: total number of packets dropped
199352539ca8SToke Høiland-Jørgensen  * @ecn_marks: total number of packets marked with ECN CE
199452539ca8SToke Høiland-Jørgensen  * @overlimit: number of drops due to queue space overflow
199552539ca8SToke Høiland-Jørgensen  * @overmemory: number of drops due to memory limit overflow
199652539ca8SToke Høiland-Jørgensen  * @collisions: number of hash collisions
199752539ca8SToke Høiland-Jørgensen  * @tx_bytes: total number of bytes dequeued
199852539ca8SToke Høiland-Jørgensen  * @tx_packets: total number of packets dequeued
199952539ca8SToke Høiland-Jørgensen  * @max_flows: maximum number of flows supported
200052539ca8SToke Høiland-Jørgensen  */
200152539ca8SToke Høiland-Jørgensen struct cfg80211_txq_stats {
200252539ca8SToke Høiland-Jørgensen 	u32 filled;
200352539ca8SToke Høiland-Jørgensen 	u32 backlog_bytes;
200452539ca8SToke Høiland-Jørgensen 	u32 backlog_packets;
200552539ca8SToke Høiland-Jørgensen 	u32 flows;
200652539ca8SToke Høiland-Jørgensen 	u32 drops;
200752539ca8SToke Høiland-Jørgensen 	u32 ecn_marks;
200852539ca8SToke Høiland-Jørgensen 	u32 overlimit;
200952539ca8SToke Høiland-Jørgensen 	u32 overmemory;
201052539ca8SToke Høiland-Jørgensen 	u32 collisions;
201152539ca8SToke Høiland-Jørgensen 	u32 tx_bytes;
201252539ca8SToke Høiland-Jørgensen 	u32 tx_packets;
201352539ca8SToke Høiland-Jørgensen 	u32 max_flows;
201452539ca8SToke Høiland-Jørgensen };
201552539ca8SToke Høiland-Jørgensen 
201652539ca8SToke Høiland-Jørgensen /**
20176de39808SJohannes Berg  * struct cfg80211_tid_stats - per-TID statistics
20186de39808SJohannes Berg  * @filled: bitmap of flags using the bits of &enum nl80211_tid_stats to
20196de39808SJohannes Berg  *	indicate the relevant values in this struct are filled
20206de39808SJohannes Berg  * @rx_msdu: number of received MSDUs
20216de39808SJohannes Berg  * @tx_msdu: number of (attempted) transmitted MSDUs
20226de39808SJohannes Berg  * @tx_msdu_retries: number of retries (not counting the first) for
20236de39808SJohannes Berg  *	transmitted MSDUs
20246de39808SJohannes Berg  * @tx_msdu_failed: number of failed transmitted MSDUs
202552539ca8SToke Høiland-Jørgensen  * @txq_stats: TXQ statistics
20266de39808SJohannes Berg  */
20276de39808SJohannes Berg struct cfg80211_tid_stats {
20286de39808SJohannes Berg 	u32 filled;
20296de39808SJohannes Berg 	u64 rx_msdu;
20306de39808SJohannes Berg 	u64 tx_msdu;
20316de39808SJohannes Berg 	u64 tx_msdu_retries;
20326de39808SJohannes Berg 	u64 tx_msdu_failed;
203352539ca8SToke Høiland-Jørgensen 	struct cfg80211_txq_stats txq_stats;
20346de39808SJohannes Berg };
20356de39808SJohannes Berg 
2036119363c7SFelix Fietkau #define IEEE80211_MAX_CHAINS	4
2037119363c7SFelix Fietkau 
2038f4263c98SPaul Stewart /**
20392ec600d6SLuis Carlos Cobo  * struct station_info - station information
2040fd5b74dcSJohannes Berg  *
20412ec600d6SLuis Carlos Cobo  * Station information filled by driver for get_station() and dump_station.
2042fd5b74dcSJohannes Berg  *
2043319090bfSJohannes Berg  * @filled: bitflag of flags using the bits of &enum nl80211_sta_info to
2044319090bfSJohannes Berg  *	indicate the relevant values in this struct for them
2045ebe27c91SMohammed Shafi Shajakhan  * @connected_time: time(in secs) since a station is last connected
2046fd5b74dcSJohannes Berg  * @inactive_time: time since last station activity (tx/rx) in milliseconds
20476c7a0033SBen Greear  * @assoc_at: bootime (ns) of the last association
20488d791361SJohannes Berg  * @rx_bytes: bytes (size of MPDUs) received from this station
20498d791361SJohannes Berg  * @tx_bytes: bytes (size of MPDUs) transmitted to this station
20502ec600d6SLuis Carlos Cobo  * @llid: mesh local link id
20512ec600d6SLuis Carlos Cobo  * @plid: mesh peer link id
20522ec600d6SLuis Carlos Cobo  * @plink_state: mesh peer link state
205373c3df3bSJohannes Berg  * @signal: The signal strength, type depends on the wiphy's signal_type.
205473c3df3bSJohannes Berg  *	For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
205573c3df3bSJohannes Berg  * @signal_avg: Average signal strength, type depends on the wiphy's signal_type.
205673c3df3bSJohannes Berg  *	For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
2057119363c7SFelix Fietkau  * @chains: bitmask for filled values in @chain_signal, @chain_signal_avg
2058119363c7SFelix Fietkau  * @chain_signal: per-chain signal strength of last received packet in dBm
2059119363c7SFelix Fietkau  * @chain_signal_avg: per-chain signal strength average in dBm
2060858022aaSRandy Dunlap  * @txrate: current unicast bitrate from this station
2061858022aaSRandy Dunlap  * @rxrate: current unicast bitrate to this station
20628d791361SJohannes Berg  * @rx_packets: packets (MSDUs & MMPDUs) received from this station
20638d791361SJohannes Berg  * @tx_packets: packets (MSDUs & MMPDUs) transmitted to this station
20648d791361SJohannes Berg  * @tx_retries: cumulative retry counts (MPDUs)
20658d791361SJohannes Berg  * @tx_failed: number of failed transmissions (MPDUs) (retries exceeded, no ACK)
20665a5c731aSBen Greear  * @rx_dropped_misc:  Dropped for un-specified reason.
20671ba01458SRandy Dunlap  * @bss_param: current BSS parameters
2068f5ea9120SJohannes Berg  * @generation: generation number for nl80211 dumps.
2069f5ea9120SJohannes Berg  *	This number should increase every time the list of stations
2070f5ea9120SJohannes Berg  *	changes, i.e. when a station is added or removed, so that
2071f5ea9120SJohannes Berg  *	userspace can tell whether it got a consistent snapshot.
207250d3dfb7SJouni Malinen  * @assoc_req_ies: IEs from (Re)Association Request.
207350d3dfb7SJouni Malinen  *	This is used only when in AP mode with drivers that do not use
207450d3dfb7SJouni Malinen  *	user space MLME/SME implementation. The information is provided for
207550d3dfb7SJouni Malinen  *	the cfg80211_new_sta() calls to notify user space of the IEs.
207650d3dfb7SJouni Malinen  * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets.
2077c26887d2SJohannes Berg  * @sta_flags: station flags mask & values
2078a85e1d55SPaul Stewart  * @beacon_loss_count: Number of times beacon loss event has triggered.
2079d299a1f2SJavier Cardona  * @t_offset: Time offset of the station relative to this host.
20803b1c5a53SMarco Porsch  * @local_pm: local mesh STA power save mode
20813b1c5a53SMarco Porsch  * @peer_pm: peer mesh STA power save mode
20823b1c5a53SMarco Porsch  * @nonpeer_pm: non-peer mesh STA power save mode
2083867d849fSAntonio Quartulli  * @expected_throughput: expected throughput in kbps (including 802.11 headers)
2084867d849fSAntonio Quartulli  *	towards this station.
2085a76b1942SJohannes Berg  * @rx_beacon: number of beacons received from this peer
2086a76b1942SJohannes Berg  * @rx_beacon_signal_avg: signal strength average (in dBm) for beacons received
2087a76b1942SJohannes Berg  *	from this peer
2088dbdaee7aSBob Copeland  * @connected_to_gate: true if mesh STA has a path to mesh gate
2089739960f1SMohammed Shafi Shajakhan  * @rx_duration: aggregate PPDU duration(usecs) for all the frames from a peer
209036647055SToke Høiland-Jørgensen  * @tx_duration: aggregate PPDU duration(usecs) for all the frames to a peer
209136647055SToke Høiland-Jørgensen  * @airtime_weight: current airtime scheduling weight
20926de39808SJohannes Berg  * @pertid: per-TID statistics, see &struct cfg80211_tid_stats, using the last
20936de39808SJohannes Berg  *	(IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs.
20948689c051SArend van Spriel  *	Note that this doesn't use the @filled bit, but is used if non-NULL.
2095c4b50cd3SVenkateswara Naralasetty  * @ack_signal: signal strength (in dBm) of the last ACK frame.
209681d5439dSBalaji Pothunoori  * @avg_ack_signal: average rssi value of ack packet for the no of msdu's has
209781d5439dSBalaji Pothunoori  *	been sent.
20980d4e14a3SAnkita Bajaj  * @rx_mpdu_count: number of MPDUs received from this station
20990d4e14a3SAnkita Bajaj  * @fcs_err_count: number of packets (MPDUs) received from this station with
21000d4e14a3SAnkita Bajaj  *	an FCS error. This counter should be incremented only when TA of the
21010d4e14a3SAnkita Bajaj  *	received packet with an FCS error matches the peer MAC address.
2102ab60633cSNarayanraddi Masti  * @airtime_link_metric: mesh airtime link metric.
21031303a51cSMarkus Theil  * @connected_to_as: true if mesh STA has a path to authentication server
2104a42e59ebSVeerendranath Jakkam  * @mlo_params_valid: Indicates @assoc_link_id and @mld_addr fields are filled
2105a42e59ebSVeerendranath Jakkam  *	by driver. Drivers use this only in cfg80211_new_sta() calls when AP
2106a42e59ebSVeerendranath Jakkam  *	MLD's MLME/SME is offload to driver. Drivers won't fill this
2107a42e59ebSVeerendranath Jakkam  *	information in cfg80211_del_sta_sinfo(), get_station() and
2108a42e59ebSVeerendranath Jakkam  *	dump_station() callbacks.
2109a42e59ebSVeerendranath Jakkam  * @assoc_link_id: Indicates MLO link ID of the AP, with which the station
2110a42e59ebSVeerendranath Jakkam  *	completed (re)association. This information filled for both MLO
2111a42e59ebSVeerendranath Jakkam  *	and non-MLO STA connections when the AP affiliated with an MLD.
2112a42e59ebSVeerendranath Jakkam  * @mld_addr: For MLO STA connection, filled with MLD address of the station.
2113a42e59ebSVeerendranath Jakkam  *	For non-MLO STA connection, filled with all zeros.
2114a42e59ebSVeerendranath Jakkam  * @assoc_resp_ies: IEs from (Re)Association Response.
2115a42e59ebSVeerendranath Jakkam  *	This is used only when in AP mode with drivers that do not use user
2116a42e59ebSVeerendranath Jakkam  *	space MLME/SME implementation. The information is provided only for the
2117a42e59ebSVeerendranath Jakkam  *	cfg80211_new_sta() calls to notify user space of the IEs. Drivers won't
2118a42e59ebSVeerendranath Jakkam  *	fill this information in cfg80211_del_sta_sinfo(), get_station() and
2119a42e59ebSVeerendranath Jakkam  *	dump_station() callbacks. User space needs this information to determine
2120a42e59ebSVeerendranath Jakkam  *	the accepted and rejected affiliated links of the connected station.
2121a42e59ebSVeerendranath Jakkam  * @assoc_resp_ies_len: Length of @assoc_resp_ies buffer in octets.
2122fd5b74dcSJohannes Berg  */
21232ec600d6SLuis Carlos Cobo struct station_info {
2124739960f1SMohammed Shafi Shajakhan 	u64 filled;
2125ebe27c91SMohammed Shafi Shajakhan 	u32 connected_time;
2126fd5b74dcSJohannes Berg 	u32 inactive_time;
21276c7a0033SBen Greear 	u64 assoc_at;
212842745e03SVladimir Kondratiev 	u64 rx_bytes;
212942745e03SVladimir Kondratiev 	u64 tx_bytes;
21302ec600d6SLuis Carlos Cobo 	u16 llid;
21312ec600d6SLuis Carlos Cobo 	u16 plid;
21322ec600d6SLuis Carlos Cobo 	u8 plink_state;
2133420e7fabSHenning Rogge 	s8 signal;
2134541a45a1SBruno Randolf 	s8 signal_avg;
2135119363c7SFelix Fietkau 
2136119363c7SFelix Fietkau 	u8 chains;
2137119363c7SFelix Fietkau 	s8 chain_signal[IEEE80211_MAX_CHAINS];
2138119363c7SFelix Fietkau 	s8 chain_signal_avg[IEEE80211_MAX_CHAINS];
2139119363c7SFelix Fietkau 
2140420e7fabSHenning Rogge 	struct rate_info txrate;
2141c8dcfd8aSFelix Fietkau 	struct rate_info rxrate;
214298c8a60aSJouni Malinen 	u32 rx_packets;
214398c8a60aSJouni Malinen 	u32 tx_packets;
2144b206b4efSBruno Randolf 	u32 tx_retries;
2145b206b4efSBruno Randolf 	u32 tx_failed;
21465a5c731aSBen Greear 	u32 rx_dropped_misc;
2147f4263c98SPaul Stewart 	struct sta_bss_parameters bss_param;
2148bb6e753eSHelmut Schaa 	struct nl80211_sta_flag_update sta_flags;
2149f5ea9120SJohannes Berg 
2150f5ea9120SJohannes Berg 	int generation;
215150d3dfb7SJouni Malinen 
215250d3dfb7SJouni Malinen 	const u8 *assoc_req_ies;
215350d3dfb7SJouni Malinen 	size_t assoc_req_ies_len;
2154f612cedfSJouni Malinen 
2155a85e1d55SPaul Stewart 	u32 beacon_loss_count;
2156d299a1f2SJavier Cardona 	s64 t_offset;
21573b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode local_pm;
21583b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode peer_pm;
21593b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode nonpeer_pm;
2160a85e1d55SPaul Stewart 
2161867d849fSAntonio Quartulli 	u32 expected_throughput;
2162a76b1942SJohannes Berg 
216336647055SToke Høiland-Jørgensen 	u64 tx_duration;
2164739960f1SMohammed Shafi Shajakhan 	u64 rx_duration;
216536647055SToke Høiland-Jørgensen 	u64 rx_beacon;
2166a76b1942SJohannes Berg 	u8 rx_beacon_signal_avg;
2167dbdaee7aSBob Copeland 	u8 connected_to_gate;
2168dbdaee7aSBob Copeland 
21698689c051SArend van Spriel 	struct cfg80211_tid_stats *pertid;
2170c4b50cd3SVenkateswara Naralasetty 	s8 ack_signal;
217181d5439dSBalaji Pothunoori 	s8 avg_ack_signal;
21720d4e14a3SAnkita Bajaj 
217336647055SToke Høiland-Jørgensen 	u16 airtime_weight;
217436647055SToke Høiland-Jørgensen 
21750d4e14a3SAnkita Bajaj 	u32 rx_mpdu_count;
21760d4e14a3SAnkita Bajaj 	u32 fcs_err_count;
2177ab60633cSNarayanraddi Masti 
2178ab60633cSNarayanraddi Masti 	u32 airtime_link_metric;
21791303a51cSMarkus Theil 
21801303a51cSMarkus Theil 	u8 connected_to_as;
2181a42e59ebSVeerendranath Jakkam 
2182a42e59ebSVeerendranath Jakkam 	bool mlo_params_valid;
2183a42e59ebSVeerendranath Jakkam 	u8 assoc_link_id;
2184a42e59ebSVeerendranath Jakkam 	u8 mld_addr[ETH_ALEN] __aligned(2);
2185a42e59ebSVeerendranath Jakkam 	const u8 *assoc_resp_ies;
2186a42e59ebSVeerendranath Jakkam 	size_t assoc_resp_ies_len;
2187fd5b74dcSJohannes Berg };
2188fd5b74dcSJohannes Berg 
21896bdb68ceSCarl Huang /**
21906bdb68ceSCarl Huang  * struct cfg80211_sar_sub_specs - sub specs limit
21916bdb68ceSCarl Huang  * @power: power limitation in 0.25dbm
21926bdb68ceSCarl Huang  * @freq_range_index: index the power limitation applies to
21936bdb68ceSCarl Huang  */
21946bdb68ceSCarl Huang struct cfg80211_sar_sub_specs {
21956bdb68ceSCarl Huang 	s32 power;
21966bdb68ceSCarl Huang 	u32 freq_range_index;
21976bdb68ceSCarl Huang };
21986bdb68ceSCarl Huang 
21996bdb68ceSCarl Huang /**
22006bdb68ceSCarl Huang  * struct cfg80211_sar_specs - sar limit specs
22016bdb68ceSCarl Huang  * @type: it's set with power in 0.25dbm or other types
22026bdb68ceSCarl Huang  * @num_sub_specs: number of sar sub specs
22036bdb68ceSCarl Huang  * @sub_specs: memory to hold the sar sub specs
22046bdb68ceSCarl Huang  */
22056bdb68ceSCarl Huang struct cfg80211_sar_specs {
22066bdb68ceSCarl Huang 	enum nl80211_sar_type type;
22076bdb68ceSCarl Huang 	u32 num_sub_specs;
2208aa4ec06cSDmitry Antipov 	struct cfg80211_sar_sub_specs sub_specs[] __counted_by(num_sub_specs);
22096bdb68ceSCarl Huang };
22106bdb68ceSCarl Huang 
22116bdb68ceSCarl Huang 
22126bdb68ceSCarl Huang /**
2213c2083e28SMauro Carvalho Chehab  * struct cfg80211_sar_freq_ranges - sar frequency ranges
22146bdb68ceSCarl Huang  * @start_freq:  start range edge frequency
22156bdb68ceSCarl Huang  * @end_freq:    end range edge frequency
22166bdb68ceSCarl Huang  */
22176bdb68ceSCarl Huang struct cfg80211_sar_freq_ranges {
22186bdb68ceSCarl Huang 	u32 start_freq;
22196bdb68ceSCarl Huang 	u32 end_freq;
22206bdb68ceSCarl Huang };
22216bdb68ceSCarl Huang 
22226bdb68ceSCarl Huang /**
22236bdb68ceSCarl Huang  * struct cfg80211_sar_capa - sar limit capability
22246bdb68ceSCarl Huang  * @type: it's set via power in 0.25dbm or other types
22256bdb68ceSCarl Huang  * @num_freq_ranges: number of frequency ranges
22266bdb68ceSCarl Huang  * @freq_ranges: memory to hold the freq ranges.
22276bdb68ceSCarl Huang  *
22286bdb68ceSCarl Huang  * Note: WLAN driver may append new ranges or split an existing
22296bdb68ceSCarl Huang  * range to small ones and then append them.
22306bdb68ceSCarl Huang  */
22316bdb68ceSCarl Huang struct cfg80211_sar_capa {
22326bdb68ceSCarl Huang 	enum nl80211_sar_type type;
22336bdb68ceSCarl Huang 	u32 num_freq_ranges;
22346bdb68ceSCarl Huang 	const struct cfg80211_sar_freq_ranges *freq_ranges;
22356bdb68ceSCarl Huang };
22366bdb68ceSCarl Huang 
223761aaa0e8SLinus Lüssing #if IS_ENABLED(CONFIG_CFG80211)
223866f7ac50SMichael Wu /**
22397406353dSAntonio Quartulli  * cfg80211_get_station - retrieve information about a given station
22407406353dSAntonio Quartulli  * @dev: the device where the station is supposed to be connected to
22417406353dSAntonio Quartulli  * @mac_addr: the mac address of the station of interest
22427406353dSAntonio Quartulli  * @sinfo: pointer to the structure to fill with the information
22437406353dSAntonio Quartulli  *
224462cc206cSJeff Johnson  * Return: 0 on success and sinfo is filled with the available information
22457406353dSAntonio Quartulli  * otherwise returns a negative error code and the content of sinfo has to be
22467406353dSAntonio Quartulli  * considered undefined.
22477406353dSAntonio Quartulli  */
22487406353dSAntonio Quartulli int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr,
22497406353dSAntonio Quartulli 			 struct station_info *sinfo);
225061aaa0e8SLinus Lüssing #else
cfg80211_get_station(struct net_device * dev,const u8 * mac_addr,struct station_info * sinfo)225161aaa0e8SLinus Lüssing static inline int cfg80211_get_station(struct net_device *dev,
225261aaa0e8SLinus Lüssing 				       const u8 *mac_addr,
225361aaa0e8SLinus Lüssing 				       struct station_info *sinfo)
225461aaa0e8SLinus Lüssing {
225561aaa0e8SLinus Lüssing 	return -ENOENT;
225661aaa0e8SLinus Lüssing }
225761aaa0e8SLinus Lüssing #endif
22587406353dSAntonio Quartulli 
22597406353dSAntonio Quartulli /**
226066f7ac50SMichael Wu  * enum monitor_flags - monitor flags
226166f7ac50SMichael Wu  *
226266f7ac50SMichael Wu  * Monitor interface configuration flags. Note that these must be the bits
226366f7ac50SMichael Wu  * according to the nl80211 flags.
226466f7ac50SMichael Wu  *
2265818a986eSJohannes Berg  * @MONITOR_FLAG_CHANGED: set if the flags were changed
226666f7ac50SMichael Wu  * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS
226766f7ac50SMichael Wu  * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP
226866f7ac50SMichael Wu  * @MONITOR_FLAG_CONTROL: pass control frames
226966f7ac50SMichael Wu  * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering
227066f7ac50SMichael Wu  * @MONITOR_FLAG_COOK_FRAMES: report frames after processing
2271e057d3c3SFelix Fietkau  * @MONITOR_FLAG_ACTIVE: active monitor, ACKs frames on its MAC address
227266f7ac50SMichael Wu  */
227366f7ac50SMichael Wu enum monitor_flags {
22748682ad36SJohannes Berg 	MONITOR_FLAG_CHANGED		= BIT(__NL80211_MNTR_FLAG_INVALID),
22758682ad36SJohannes Berg 	MONITOR_FLAG_FCSFAIL		= BIT(NL80211_MNTR_FLAG_FCSFAIL),
22768682ad36SJohannes Berg 	MONITOR_FLAG_PLCPFAIL		= BIT(NL80211_MNTR_FLAG_PLCPFAIL),
22778682ad36SJohannes Berg 	MONITOR_FLAG_CONTROL		= BIT(NL80211_MNTR_FLAG_CONTROL),
22788682ad36SJohannes Berg 	MONITOR_FLAG_OTHER_BSS		= BIT(NL80211_MNTR_FLAG_OTHER_BSS),
22798682ad36SJohannes Berg 	MONITOR_FLAG_COOK_FRAMES	= BIT(NL80211_MNTR_FLAG_COOK_FRAMES),
22808682ad36SJohannes Berg 	MONITOR_FLAG_ACTIVE		= BIT(NL80211_MNTR_FLAG_ACTIVE),
228166f7ac50SMichael Wu };
228266f7ac50SMichael Wu 
22832ec600d6SLuis Carlos Cobo /**
22842ec600d6SLuis Carlos Cobo  * enum mpath_info_flags -  mesh path information flags
22852ec600d6SLuis Carlos Cobo  *
22862ec600d6SLuis Carlos Cobo  * Used by the driver to indicate which info in &struct mpath_info it has filled
22872ec600d6SLuis Carlos Cobo  * in during get_station() or dump_station().
22882ec600d6SLuis Carlos Cobo  *
2289abe37c4bSJohannes Berg  * @MPATH_INFO_FRAME_QLEN: @frame_qlen filled
2290abe37c4bSJohannes Berg  * @MPATH_INFO_SN: @sn filled
2291abe37c4bSJohannes Berg  * @MPATH_INFO_METRIC: @metric filled
2292abe37c4bSJohannes Berg  * @MPATH_INFO_EXPTIME: @exptime filled
2293abe37c4bSJohannes Berg  * @MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled
2294abe37c4bSJohannes Berg  * @MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled
2295abe37c4bSJohannes Berg  * @MPATH_INFO_FLAGS: @flags filled
2296cc241636SJulan Hsu  * @MPATH_INFO_HOP_COUNT: @hop_count filled
22979874b71fSJohannes Berg  * @MPATH_INFO_PATH_CHANGE: @path_change_count filled
22982ec600d6SLuis Carlos Cobo  */
22992ec600d6SLuis Carlos Cobo enum mpath_info_flags {
23002ec600d6SLuis Carlos Cobo 	MPATH_INFO_FRAME_QLEN		= BIT(0),
2301d19b3bf6SRui Paulo 	MPATH_INFO_SN			= BIT(1),
23022ec600d6SLuis Carlos Cobo 	MPATH_INFO_METRIC		= BIT(2),
23032ec600d6SLuis Carlos Cobo 	MPATH_INFO_EXPTIME		= BIT(3),
23042ec600d6SLuis Carlos Cobo 	MPATH_INFO_DISCOVERY_TIMEOUT	= BIT(4),
23052ec600d6SLuis Carlos Cobo 	MPATH_INFO_DISCOVERY_RETRIES	= BIT(5),
23062ec600d6SLuis Carlos Cobo 	MPATH_INFO_FLAGS		= BIT(6),
2307540bbcb9SJulan Hsu 	MPATH_INFO_HOP_COUNT		= BIT(7),
2308540bbcb9SJulan Hsu 	MPATH_INFO_PATH_CHANGE		= BIT(8),
23092ec600d6SLuis Carlos Cobo };
23102ec600d6SLuis Carlos Cobo 
23112ec600d6SLuis Carlos Cobo /**
23122ec600d6SLuis Carlos Cobo  * struct mpath_info - mesh path information
23132ec600d6SLuis Carlos Cobo  *
23142ec600d6SLuis Carlos Cobo  * Mesh path information filled by driver for get_mpath() and dump_mpath().
23152ec600d6SLuis Carlos Cobo  *
23162ec600d6SLuis Carlos Cobo  * @filled: bitfield of flags from &enum mpath_info_flags
23172ec600d6SLuis Carlos Cobo  * @frame_qlen: number of queued frames for this destination
2318d19b3bf6SRui Paulo  * @sn: target sequence number
23192ec600d6SLuis Carlos Cobo  * @metric: metric (cost) of this mesh path
23202ec600d6SLuis Carlos Cobo  * @exptime: expiration time for the mesh path from now, in msecs
23211dcf396bSDmitry Antipov  * @flags: mesh path flags from &enum mesh_path_flags
23222ec600d6SLuis Carlos Cobo  * @discovery_timeout: total mesh path discovery timeout, in msecs
23232ec600d6SLuis Carlos Cobo  * @discovery_retries: mesh path discovery retries
2324f5ea9120SJohannes Berg  * @generation: generation number for nl80211 dumps.
2325f5ea9120SJohannes Berg  *	This number should increase every time the list of mesh paths
2326f5ea9120SJohannes Berg  *	changes, i.e. when a station is added or removed, so that
2327f5ea9120SJohannes Berg  *	userspace can tell whether it got a consistent snapshot.
2328cc241636SJulan Hsu  * @hop_count: hops to destination
2329540bbcb9SJulan Hsu  * @path_change_count: total number of path changes to destination
23302ec600d6SLuis Carlos Cobo  */
23312ec600d6SLuis Carlos Cobo struct mpath_info {
23322ec600d6SLuis Carlos Cobo 	u32 filled;
23332ec600d6SLuis Carlos Cobo 	u32 frame_qlen;
2334d19b3bf6SRui Paulo 	u32 sn;
23352ec600d6SLuis Carlos Cobo 	u32 metric;
23362ec600d6SLuis Carlos Cobo 	u32 exptime;
23372ec600d6SLuis Carlos Cobo 	u32 discovery_timeout;
23382ec600d6SLuis Carlos Cobo 	u8 discovery_retries;
23392ec600d6SLuis Carlos Cobo 	u8 flags;
2340cc241636SJulan Hsu 	u8 hop_count;
2341540bbcb9SJulan Hsu 	u32 path_change_count;
2342f5ea9120SJohannes Berg 
2343f5ea9120SJohannes Berg 	int generation;
23442ec600d6SLuis Carlos Cobo };
23452ec600d6SLuis Carlos Cobo 
23469f1ba906SJouni Malinen /**
23479f1ba906SJouni Malinen  * struct bss_parameters - BSS parameters
23489f1ba906SJouni Malinen  *
23499f1ba906SJouni Malinen  * Used to change BSS parameters (mainly for AP mode).
23509f1ba906SJouni Malinen  *
23511e0f8cc9SJohannes Berg  * @link_id: link_id or -1 for non-MLD
23529f1ba906SJouni Malinen  * @use_cts_prot: Whether to use CTS protection
23539f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
23549f1ba906SJouni Malinen  * @use_short_preamble: Whether the use of short preambles is allowed
23559f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
23569f1ba906SJouni Malinen  * @use_short_slot_time: Whether the use of short slot time is allowed
23579f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
235890c97a04SJouni Malinen  * @basic_rates: basic rates in IEEE 802.11 format
235990c97a04SJouni Malinen  *	(or NULL for no change)
236090c97a04SJouni Malinen  * @basic_rates_len: number of basic rates
2361fd8aaaf3SFelix Fietkau  * @ap_isolate: do not forward packets between connected stations
23629d6e371dSWright Feng  *	(0 = no, 1 = yes, -1 = do not change)
236350b12f59SHelmut Schaa  * @ht_opmode: HT Operation mode
236450b12f59SHelmut Schaa  *	(u16 = opmode, -1 = do not change)
236553cabad7SJohannes Berg  * @p2p_ctwindow: P2P CT Window (-1 = no change)
236653cabad7SJohannes Berg  * @p2p_opp_ps: P2P opportunistic PS (-1 = no change)
23679f1ba906SJouni Malinen  */
23689f1ba906SJouni Malinen struct bss_parameters {
23691e0f8cc9SJohannes Berg 	int link_id;
23709f1ba906SJouni Malinen 	int use_cts_prot;
23719f1ba906SJouni Malinen 	int use_short_preamble;
23729f1ba906SJouni Malinen 	int use_short_slot_time;
2373c1e5f471SJohannes Berg 	const u8 *basic_rates;
237490c97a04SJouni Malinen 	u8 basic_rates_len;
2375fd8aaaf3SFelix Fietkau 	int ap_isolate;
237650b12f59SHelmut Schaa 	int ht_opmode;
237753cabad7SJohannes Berg 	s8 p2p_ctwindow, p2p_opp_ps;
23789f1ba906SJouni Malinen };
23792ec600d6SLuis Carlos Cobo 
23803ddd53f3SChun-Yeow Yeoh /**
238129cbe68cSJohannes Berg  * struct mesh_config - 802.11s mesh configuration
238229cbe68cSJohannes Berg  *
238329cbe68cSJohannes Berg  * These parameters can be changed while the mesh is active.
23843ddd53f3SChun-Yeow Yeoh  *
23853ddd53f3SChun-Yeow Yeoh  * @dot11MeshRetryTimeout: the initial retry timeout in millisecond units used
23863ddd53f3SChun-Yeow Yeoh  *	by the Mesh Peering Open message
23873ddd53f3SChun-Yeow Yeoh  * @dot11MeshConfirmTimeout: the initial retry timeout in millisecond units
23883ddd53f3SChun-Yeow Yeoh  *	used by the Mesh Peering Open message
23893ddd53f3SChun-Yeow Yeoh  * @dot11MeshHoldingTimeout: the confirm timeout in millisecond units used by
23903ddd53f3SChun-Yeow Yeoh  *	the mesh peering management to close a mesh peering
23913ddd53f3SChun-Yeow Yeoh  * @dot11MeshMaxPeerLinks: the maximum number of peer links allowed on this
23923ddd53f3SChun-Yeow Yeoh  *	mesh interface
23933ddd53f3SChun-Yeow Yeoh  * @dot11MeshMaxRetries: the maximum number of peer link open retries that can
23943ddd53f3SChun-Yeow Yeoh  *	be sent to establish a new peer link instance in a mesh
23953ddd53f3SChun-Yeow Yeoh  * @dot11MeshTTL: the value of TTL field set at a source mesh STA
23963ddd53f3SChun-Yeow Yeoh  * @element_ttl: the value of TTL field set at a mesh STA for path selection
23973ddd53f3SChun-Yeow Yeoh  *	elements
23983ddd53f3SChun-Yeow Yeoh  * @auto_open_plinks: whether we should automatically open peer links when we
23993ddd53f3SChun-Yeow Yeoh  *	detect compatible mesh peers
24003ddd53f3SChun-Yeow Yeoh  * @dot11MeshNbrOffsetMaxNeighbor: the maximum number of neighbors to
24013ddd53f3SChun-Yeow Yeoh  *	synchronize to for 11s default synchronization method
24023ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPmaxPREQretries: the number of action frames containing a PREQ
24033ddd53f3SChun-Yeow Yeoh  *	that an originator mesh STA can send to a particular path target
24043ddd53f3SChun-Yeow Yeoh  * @path_refresh_time: how frequently to refresh mesh paths in milliseconds
24053ddd53f3SChun-Yeow Yeoh  * @min_discovery_timeout: the minimum length of time to wait until giving up on
24063ddd53f3SChun-Yeow Yeoh  *	a path discovery in milliseconds
24073ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPactivePathTimeout: the time (in TUs) for which mesh STAs
24083ddd53f3SChun-Yeow Yeoh  *	receiving a PREQ shall consider the forwarding information from the
24093ddd53f3SChun-Yeow Yeoh  *	root to be valid. (TU = time unit)
24103ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPpreqMinInterval: the minimum interval of time (in TUs) during
24113ddd53f3SChun-Yeow Yeoh  *	which a mesh STA can send only one action frame containing a PREQ
24123ddd53f3SChun-Yeow Yeoh  *	element
24133ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPperrMinInterval: the minimum interval of time (in TUs) during
24143ddd53f3SChun-Yeow Yeoh  *	which a mesh STA can send only one Action frame containing a PERR
24153ddd53f3SChun-Yeow Yeoh  *	element
24163ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPnetDiameterTraversalTime: the interval of time (in TUs) that
24173ddd53f3SChun-Yeow Yeoh  *	it takes for an HWMP information element to propagate across the mesh
24183ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPRootMode: the configuration of a mesh STA as root mesh STA
24193ddd53f3SChun-Yeow Yeoh  * @dot11MeshHWMPRannInterval: the interval of time (in TUs) between root
24203ddd53f3SChun-Yeow Yeoh  *	announcements are transmitted
24213ddd53f3SChun-Yeow Yeoh  * @dot11MeshGateAnnouncementProtocol: whether to advertise that this mesh
24223ddd53f3SChun-Yeow Yeoh  *	station has access to a broader network beyond the MBSS. (This is
24233ddd53f3SChun-Yeow Yeoh  *	missnamed in draft 12.0: dot11MeshGateAnnouncementProtocol set to true
24243ddd53f3SChun-Yeow Yeoh  *	only means that the station will announce others it's a mesh gate, but
24253ddd53f3SChun-Yeow Yeoh  *	not necessarily using the gate announcement protocol. Still keeping the
24263ddd53f3SChun-Yeow Yeoh  *	same nomenclature to be in sync with the spec)
24273ddd53f3SChun-Yeow Yeoh  * @dot11MeshForwarding: whether the Mesh STA is forwarding or non-forwarding
24283ddd53f3SChun-Yeow Yeoh  *	entity (default is TRUE - forwarding entity)
24293ddd53f3SChun-Yeow Yeoh  * @rssi_threshold: the threshold for average signal strength of candidate
24303ddd53f3SChun-Yeow Yeoh  *	station to establish a peer link
24313ddd53f3SChun-Yeow Yeoh  * @ht_opmode: mesh HT protection mode
2432ac1073a6SChun-Yeow Yeoh  *
2433ac1073a6SChun-Yeow Yeoh  * @dot11MeshHWMPactivePathToRootTimeout: The time (in TUs) for which mesh STAs
2434ac1073a6SChun-Yeow Yeoh  *	receiving a proactive PREQ shall consider the forwarding information to
2435ac1073a6SChun-Yeow Yeoh  *	the root mesh STA to be valid.
2436ac1073a6SChun-Yeow Yeoh  *
2437ac1073a6SChun-Yeow Yeoh  * @dot11MeshHWMProotInterval: The interval of time (in TUs) between proactive
2438ac1073a6SChun-Yeow Yeoh  *	PREQs are transmitted.
2439728b19e5SChun-Yeow Yeoh  * @dot11MeshHWMPconfirmationInterval: The minimum interval of time (in TUs)
2440728b19e5SChun-Yeow Yeoh  *	during which a mesh STA can send only one Action frame containing
2441728b19e5SChun-Yeow Yeoh  *	a PREQ element for root path confirmation.
24423b1c5a53SMarco Porsch  * @power_mode: The default mesh power save mode which will be the initial
24433b1c5a53SMarco Porsch  *	setting for new peer links.
24443b1c5a53SMarco Porsch  * @dot11MeshAwakeWindowDuration: The duration in TUs the STA will remain awake
24453b1c5a53SMarco Porsch  *	after transmitting its beacon.
24468e7c0538SColleen Twitty  * @plink_timeout: If no tx activity is seen from a STA we've established
24478e7c0538SColleen Twitty  *	peering with for longer than this time (in seconds), then remove it
24488e7c0538SColleen Twitty  *	from the STA's list of peers.  Default is 30 minutes.
24492d8b08feSMauro Carvalho Chehab  * @dot11MeshConnectedToAuthServer: if set to true then this mesh STA
24502d8b08feSMauro Carvalho Chehab  *	will advertise that it is connected to a authentication server
24512d8b08feSMauro Carvalho Chehab  *	in the mesh formation field.
245201d66fbdSBob Copeland  * @dot11MeshConnectedToMeshGate: if set to true, advertise that this STA is
245301d66fbdSBob Copeland  *      connected to a mesh gate in mesh formation info.  If false, the
245401d66fbdSBob Copeland  *      value in mesh formation is determined by the presence of root paths
245501d66fbdSBob Copeland  *      in the mesh path table
2456e3718a61SLinus Lüssing  * @dot11MeshNolearn: Try to avoid multi-hop path discovery (e.g. PREQ/PREP
2457e3718a61SLinus Lüssing  *      for HWMP) if the destination is a direct neighbor. Note that this might
2458e3718a61SLinus Lüssing  *      not be the optimal decision as a multi-hop route might be better. So
2459e3718a61SLinus Lüssing  *      if using this setting you will likely also want to disable
2460e3718a61SLinus Lüssing  *      dot11MeshForwarding and use another mesh routing protocol on top.
246129cbe68cSJohannes Berg  */
246293da9cc1Scolin@cozybit.com struct mesh_config {
246393da9cc1Scolin@cozybit.com 	u16 dot11MeshRetryTimeout;
246493da9cc1Scolin@cozybit.com 	u16 dot11MeshConfirmTimeout;
246593da9cc1Scolin@cozybit.com 	u16 dot11MeshHoldingTimeout;
246693da9cc1Scolin@cozybit.com 	u16 dot11MeshMaxPeerLinks;
246793da9cc1Scolin@cozybit.com 	u8 dot11MeshMaxRetries;
246893da9cc1Scolin@cozybit.com 	u8 dot11MeshTTL;
246945904f21SJavier Cardona 	u8 element_ttl;
247093da9cc1Scolin@cozybit.com 	bool auto_open_plinks;
2471d299a1f2SJavier Cardona 	u32 dot11MeshNbrOffsetMaxNeighbor;
247293da9cc1Scolin@cozybit.com 	u8 dot11MeshHWMPmaxPREQretries;
247393da9cc1Scolin@cozybit.com 	u32 path_refresh_time;
247493da9cc1Scolin@cozybit.com 	u16 min_discovery_timeout;
247593da9cc1Scolin@cozybit.com 	u32 dot11MeshHWMPactivePathTimeout;
247693da9cc1Scolin@cozybit.com 	u16 dot11MeshHWMPpreqMinInterval;
2477dca7e943SThomas Pedersen 	u16 dot11MeshHWMPperrMinInterval;
247893da9cc1Scolin@cozybit.com 	u16 dot11MeshHWMPnetDiameterTraversalTime;
247963c5723bSRui Paulo 	u8 dot11MeshHWMPRootMode;
248001d66fbdSBob Copeland 	bool dot11MeshConnectedToMeshGate;
2481184eebe6SMarkus Theil 	bool dot11MeshConnectedToAuthServer;
24820507e159SJavier Cardona 	u16 dot11MeshHWMPRannInterval;
248316dd7267SJavier Cardona 	bool dot11MeshGateAnnouncementProtocol;
248494f90656SChun-Yeow Yeoh 	bool dot11MeshForwarding;
248555335137SAshok Nagarajan 	s32 rssi_threshold;
248670c33eaaSAshok Nagarajan 	u16 ht_opmode;
2487ac1073a6SChun-Yeow Yeoh 	u32 dot11MeshHWMPactivePathToRootTimeout;
2488ac1073a6SChun-Yeow Yeoh 	u16 dot11MeshHWMProotInterval;
2489728b19e5SChun-Yeow Yeoh 	u16 dot11MeshHWMPconfirmationInterval;
24903b1c5a53SMarco Porsch 	enum nl80211_mesh_power_mode power_mode;
24913b1c5a53SMarco Porsch 	u16 dot11MeshAwakeWindowDuration;
24928e7c0538SColleen Twitty 	u32 plink_timeout;
2493e3718a61SLinus Lüssing 	bool dot11MeshNolearn;
249493da9cc1Scolin@cozybit.com };
249593da9cc1Scolin@cozybit.com 
249631888487SJouni Malinen /**
249729cbe68cSJohannes Berg  * struct mesh_setup - 802.11s mesh setup configuration
2498683b6d3bSJohannes Berg  * @chandef: defines the channel to use
249929cbe68cSJohannes Berg  * @mesh_id: the mesh ID
250029cbe68cSJohannes Berg  * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes
2501d299a1f2SJavier Cardona  * @sync_method: which synchronization method to use
2502c80d545dSJavier Cardona  * @path_sel_proto: which path selection protocol to use
2503c80d545dSJavier Cardona  * @path_metric: which metric to use
25046e16d90bSColleen Twitty  * @auth_id: which authentication method this mesh is using
2505581a8b0fSJavier Cardona  * @ie: vendor information elements (optional)
2506581a8b0fSJavier Cardona  * @ie_len: length of vendor information elements
2507b130e5ceSJavier Cardona  * @is_authenticated: this mesh requires authentication
2508b130e5ceSJavier Cardona  * @is_secure: this mesh uses security
2509bb2798d4SThomas Pedersen  * @user_mpm: userspace handles all MPM functions
25109bdbf04dSMarco Porsch  * @dtim_period: DTIM period to use
25119bdbf04dSMarco Porsch  * @beacon_interval: beacon interval to use
251298e0c7f8SRandy Dunlap  * @mcast_rate: multicast rate for Mesh Node [6Mbps is the default for 802.11a]
2513ffb3cf30SAshok Nagarajan  * @basic_rates: basic rates to use when creating the mesh
25148564e382SJohannes Berg  * @beacon_rate: bitrate to be used for beacons
2515d37d49c2SBenjamin Berg  * @userspace_handles_dfs: whether user space controls DFS operation, i.e.
2516d37d49c2SBenjamin Berg  *	changes the channel when a radar is detected. This is required
2517d37d49c2SBenjamin Berg  *	to operate on DFS channels.
25181224f583SDenis Kenzior  * @control_port_over_nl80211: TRUE if userspace expects to exchange control
25191224f583SDenis Kenzior  *	port frames over NL80211 instead of the network interface.
252029cbe68cSJohannes Berg  *
252129cbe68cSJohannes Berg  * These parameters are fixed when the mesh is created.
252229cbe68cSJohannes Berg  */
252329cbe68cSJohannes Berg struct mesh_setup {
2524683b6d3bSJohannes Berg 	struct cfg80211_chan_def chandef;
252529cbe68cSJohannes Berg 	const u8 *mesh_id;
252629cbe68cSJohannes Berg 	u8 mesh_id_len;
2527d299a1f2SJavier Cardona 	u8 sync_method;
2528c80d545dSJavier Cardona 	u8 path_sel_proto;
2529c80d545dSJavier Cardona 	u8 path_metric;
25306e16d90bSColleen Twitty 	u8 auth_id;
2531581a8b0fSJavier Cardona 	const u8 *ie;
2532581a8b0fSJavier Cardona 	u8 ie_len;
2533b130e5ceSJavier Cardona 	bool is_authenticated;
253415d5dda6SJavier Cardona 	bool is_secure;
2535bb2798d4SThomas Pedersen 	bool user_mpm;
25369bdbf04dSMarco Porsch 	u8 dtim_period;
25379bdbf04dSMarco Porsch 	u16 beacon_interval;
253857fbcce3SJohannes Berg 	int mcast_rate[NUM_NL80211_BANDS];
2539ffb3cf30SAshok Nagarajan 	u32 basic_rates;
25408564e382SJohannes Berg 	struct cfg80211_bitrate_mask beacon_rate;
2541d37d49c2SBenjamin Berg 	bool userspace_handles_dfs;
25421224f583SDenis Kenzior 	bool control_port_over_nl80211;
254329cbe68cSJohannes Berg };
254429cbe68cSJohannes Berg 
254529cbe68cSJohannes Berg /**
25466e0bd6c3SRostislav Lisovy  * struct ocb_setup - 802.11p OCB mode setup configuration
25476e0bd6c3SRostislav Lisovy  * @chandef: defines the channel to use
25486e0bd6c3SRostislav Lisovy  *
25496e0bd6c3SRostislav Lisovy  * These parameters are fixed when connecting to the network
25506e0bd6c3SRostislav Lisovy  */
25516e0bd6c3SRostislav Lisovy struct ocb_setup {
25526e0bd6c3SRostislav Lisovy 	struct cfg80211_chan_def chandef;
25536e0bd6c3SRostislav Lisovy };
25546e0bd6c3SRostislav Lisovy 
25556e0bd6c3SRostislav Lisovy /**
255631888487SJouni Malinen  * struct ieee80211_txq_params - TX queue parameters
2557a3304b0aSJohannes Berg  * @ac: AC identifier
255831888487SJouni Malinen  * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled
255931888487SJouni Malinen  * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range
256031888487SJouni Malinen  *	1..32767]
256131888487SJouni Malinen  * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range
256231888487SJouni Malinen  *	1..32767]
256331888487SJouni Malinen  * @aifs: Arbitration interframe space [0..255]
25649d2bb84dSShaul Triebitz  * @link_id: link_id or -1 for non-MLD
256531888487SJouni Malinen  */
256631888487SJouni Malinen struct ieee80211_txq_params {
2567a3304b0aSJohannes Berg 	enum nl80211_ac ac;
256831888487SJouni Malinen 	u16 txop;
256931888487SJouni Malinen 	u16 cwmin;
257031888487SJouni Malinen 	u16 cwmax;
257131888487SJouni Malinen 	u8 aifs;
25729d2bb84dSShaul Triebitz 	int link_id;
257331888487SJouni Malinen };
257431888487SJouni Malinen 
2575d70e9693SJohannes Berg /**
2576d70e9693SJohannes Berg  * DOC: Scanning and BSS list handling
2577d70e9693SJohannes Berg  *
2578d70e9693SJohannes Berg  * The scanning process itself is fairly simple, but cfg80211 offers quite
2579d70e9693SJohannes Berg  * a bit of helper functionality. To start a scan, the scan operation will
2580d70e9693SJohannes Berg  * be invoked with a scan definition. This scan definition contains the
2581d70e9693SJohannes Berg  * channels to scan, and the SSIDs to send probe requests for (including the
2582d70e9693SJohannes Berg  * wildcard, if desired). A passive scan is indicated by having no SSIDs to
2583d70e9693SJohannes Berg  * probe. Additionally, a scan request may contain extra information elements
2584d70e9693SJohannes Berg  * that should be added to the probe request. The IEs are guaranteed to be
2585d70e9693SJohannes Berg  * well-formed, and will not exceed the maximum length the driver advertised
2586d70e9693SJohannes Berg  * in the wiphy structure.
2587d70e9693SJohannes Berg  *
2588d70e9693SJohannes Berg  * When scanning finds a BSS, cfg80211 needs to be notified of that, because
2589d70e9693SJohannes Berg  * it is responsible for maintaining the BSS list; the driver should not
2590d70e9693SJohannes Berg  * maintain a list itself. For this notification, various functions exist.
2591d70e9693SJohannes Berg  *
2592d70e9693SJohannes Berg  * Since drivers do not maintain a BSS list, there are also a number of
2593d70e9693SJohannes Berg  * functions to search for a BSS and obtain information about it from the
2594d70e9693SJohannes Berg  * BSS structure cfg80211 maintains. The BSS list is also made available
2595d70e9693SJohannes Berg  * to userspace.
2596d70e9693SJohannes Berg  */
259772bdcf34SJouni Malinen 
2598704232c2SJohannes Berg /**
25992a519311SJohannes Berg  * struct cfg80211_ssid - SSID description
26002a519311SJohannes Berg  * @ssid: the SSID
26012a519311SJohannes Berg  * @ssid_len: length of the ssid
26022a519311SJohannes Berg  */
26032a519311SJohannes Berg struct cfg80211_ssid {
26042a519311SJohannes Berg 	u8 ssid[IEEE80211_MAX_SSID_LEN];
26052a519311SJohannes Berg 	u8 ssid_len;
26062a519311SJohannes Berg };
26072a519311SJohannes Berg 
26082a519311SJohannes Berg /**
26091d76250bSAvraham Stern  * struct cfg80211_scan_info - information about completed scan
26101d76250bSAvraham Stern  * @scan_start_tsf: scan start time in terms of the TSF of the BSS that the
26111d76250bSAvraham Stern  *	wireless device that requested the scan is connected to. If this
26121d76250bSAvraham Stern  *	information is not available, this field is left zero.
26131d76250bSAvraham Stern  * @tsf_bssid: the BSSID according to which %scan_start_tsf is set.
26141d76250bSAvraham Stern  * @aborted: set to true if the scan was aborted for any reason,
26151d76250bSAvraham Stern  *	userspace will be notified of that
26161d76250bSAvraham Stern  */
26171d76250bSAvraham Stern struct cfg80211_scan_info {
26181d76250bSAvraham Stern 	u64 scan_start_tsf;
26191d76250bSAvraham Stern 	u8 tsf_bssid[ETH_ALEN] __aligned(2);
26201d76250bSAvraham Stern 	bool aborted;
26211d76250bSAvraham Stern };
26221d76250bSAvraham Stern 
26231d76250bSAvraham Stern /**
2624c8cb5b85STova Mussai  * struct cfg80211_scan_6ghz_params - relevant for 6 GHz only
2625c8cb5b85STova Mussai  *
26262d8b08feSMauro Carvalho Chehab  * @short_ssid: short ssid to scan for
2627c8cb5b85STova Mussai  * @bssid: bssid to scan for
2628c8cb5b85STova Mussai  * @channel_idx: idx of the channel in the channel array in the scan request
262905b23456SRandy Dunlap  *	 which the above info is relevant to
2630c8cb5b85STova Mussai  * @unsolicited_probe: the AP transmits unsolicited probe response every 20 TU
26312d8b08feSMauro Carvalho Chehab  * @short_ssid_valid: @short_ssid is valid and can be used
2632c8cb5b85STova Mussai  * @psc_no_listen: when set, and the channel is a PSC channel, no need to wait
2633c8cb5b85STova Mussai  *       20 TUs before starting to send probe requests.
26344ef2f53eSIlan Peer  * @psd_20: The AP's 20 MHz PSD value.
2635c8cb5b85STova Mussai  */
2636c8cb5b85STova Mussai struct cfg80211_scan_6ghz_params {
2637c8cb5b85STova Mussai 	u32 short_ssid;
2638c8cb5b85STova Mussai 	u32 channel_idx;
2639c8cb5b85STova Mussai 	u8 bssid[ETH_ALEN];
2640c8cb5b85STova Mussai 	bool unsolicited_probe;
2641c8cb5b85STova Mussai 	bool short_ssid_valid;
2642c8cb5b85STova Mussai 	bool psc_no_listen;
26434ef2f53eSIlan Peer 	s8 psd_20;
2644c8cb5b85STova Mussai };
2645c8cb5b85STova Mussai 
2646c8cb5b85STova Mussai /**
26472a519311SJohannes Berg  * struct cfg80211_scan_request - scan request description
26482a519311SJohannes Berg  *
26492a519311SJohannes Berg  * @ssids: SSIDs to scan for (active scan only)
26502a519311SJohannes Berg  * @n_ssids: number of SSIDs
26512a519311SJohannes Berg  * @channels: channels to scan on.
2652ca3dbc20SHelmut Schaa  * @n_channels: total number of channels to scan
265370692ad2SJouni Malinen  * @ie: optional information element(s) to add into Probe Request or %NULL
265470692ad2SJouni Malinen  * @ie_len: length of ie in octets
26551d76250bSAvraham Stern  * @duration: how long to listen on each channel, in TUs. If
26561d76250bSAvraham Stern  *	%duration_mandatory is not set, this is the maximum dwell time and
26571d76250bSAvraham Stern  *	the actual dwell time may be shorter.
26581d76250bSAvraham Stern  * @duration_mandatory: if set, the scan duration must be as specified by the
26591d76250bSAvraham Stern  *	%duration field.
26601dcf396bSDmitry Antipov  * @flags: control flags from &enum nl80211_scan_flags
266134850ab2SJohannes Berg  * @rates: bitmap of rates to advertise for each band
26622a519311SJohannes Berg  * @wiphy: the wiphy this was for
266315d6030bSSam Leffler  * @scan_start: time (in jiffies) when the scan started
2664fd014284SJohannes Berg  * @wdev: the wireless device to scan for
26651d76250bSAvraham Stern  * @info: (internal) information about completed scan
26665fe231e8SJohannes Berg  * @notified: (internal) scan request was notified as done or aborted
2667e9f935e3SRajkumar Manoharan  * @no_cck: used to send probe requests at non CCK rate in 2GHz band
2668ad2b26abSJohannes Berg  * @mac_addr: MAC address used with randomisation
2669ad2b26abSJohannes Berg  * @mac_addr_mask: MAC address mask used with randomisation, bits that
2670ad2b26abSJohannes Berg  *	are 0 in the mask should be randomised, bits that are 1 should
2671ad2b26abSJohannes Berg  *	be taken from the @mac_addr
2672c8cb5b85STova Mussai  * @scan_6ghz: relevant for split scan request only,
2673c8cb5b85STova Mussai  *	true if this is the second scan request
2674c8cb5b85STova Mussai  * @n_6ghz_params: number of 6 GHz params
2675c8cb5b85STova Mussai  * @scan_6ghz_params: 6 GHz params
2676818965d3SJouni Malinen  * @bssid: BSSID to scan for (most commonly, the wildcard BSSID)
26776285ee30SIlan Peer  * @tsf_report_link_id: for MLO, indicates the link ID of the BSS that should be
26786285ee30SIlan Peer  *      used for TSF reporting. Can be set to -1 to indicate no preference.
26792a519311SJohannes Berg  */
26802a519311SJohannes Berg struct cfg80211_scan_request {
26812a519311SJohannes Berg 	struct cfg80211_ssid *ssids;
26822a519311SJohannes Berg 	int n_ssids;
26832a519311SJohannes Berg 	u32 n_channels;
2684de95a54bSJohannes Berg 	const u8 *ie;
268570692ad2SJouni Malinen 	size_t ie_len;
26861d76250bSAvraham Stern 	u16 duration;
26871d76250bSAvraham Stern 	bool duration_mandatory;
2688ed473771SSam Leffler 	u32 flags;
26892a519311SJohannes Berg 
269057fbcce3SJohannes Berg 	u32 rates[NUM_NL80211_BANDS];
269134850ab2SJohannes Berg 
2692fd014284SJohannes Berg 	struct wireless_dev *wdev;
2693fd014284SJohannes Berg 
2694ad2b26abSJohannes Berg 	u8 mac_addr[ETH_ALEN] __aligned(2);
2695ad2b26abSJohannes Berg 	u8 mac_addr_mask[ETH_ALEN] __aligned(2);
2696818965d3SJouni Malinen 	u8 bssid[ETH_ALEN] __aligned(2);
2697ad2b26abSJohannes Berg 
26982a519311SJohannes Berg 	/* internal */
26992a519311SJohannes Berg 	struct wiphy *wiphy;
270015d6030bSSam Leffler 	unsigned long scan_start;
27011d76250bSAvraham Stern 	struct cfg80211_scan_info info;
27021d76250bSAvraham Stern 	bool notified;
2703e9f935e3SRajkumar Manoharan 	bool no_cck;
2704c8cb5b85STova Mussai 	bool scan_6ghz;
2705c8cb5b85STova Mussai 	u32 n_6ghz_params;
2706c8cb5b85STova Mussai 	struct cfg80211_scan_6ghz_params *scan_6ghz_params;
27076285ee30SIlan Peer 	s8 tsf_report_link_id;
27085ba63533SJohannes Berg 
27095ba63533SJohannes Berg 	/* keep last */
2710e3eac9f3SKees Cook 	struct ieee80211_channel *channels[] __counted_by(n_channels);
27112a519311SJohannes Berg };
27122a519311SJohannes Berg 
get_random_mask_addr(u8 * buf,const u8 * addr,const u8 * mask)2713ad2b26abSJohannes Berg static inline void get_random_mask_addr(u8 *buf, const u8 *addr, const u8 *mask)
2714ad2b26abSJohannes Berg {
2715ad2b26abSJohannes Berg 	int i;
2716ad2b26abSJohannes Berg 
2717ad2b26abSJohannes Berg 	get_random_bytes(buf, ETH_ALEN);
2718ad2b26abSJohannes Berg 	for (i = 0; i < ETH_ALEN; i++) {
2719ad2b26abSJohannes Berg 		buf[i] &= ~mask[i];
2720ad2b26abSJohannes Berg 		buf[i] |= addr[i] & mask[i];
2721ad2b26abSJohannes Berg 	}
2722ad2b26abSJohannes Berg }
2723ad2b26abSJohannes Berg 
27242a519311SJohannes Berg /**
2725a1f1c21cSLuciano Coelho  * struct cfg80211_match_set - sets of attributes to match
2726a1f1c21cSLuciano Coelho  *
27273007e352SArend Van Spriel  * @ssid: SSID to be matched; may be zero-length in case of BSSID match
27283007e352SArend Van Spriel  *	or no match (RSSI only)
27293007e352SArend Van Spriel  * @bssid: BSSID to be matched; may be all-zero BSSID in case of SSID match
27303007e352SArend Van Spriel  *	or no match (RSSI only)
2731ea73cbceSJohannes Berg  * @rssi_thold: don't report scan results below this threshold (in s32 dBm)
2732a1f1c21cSLuciano Coelho  */
2733a1f1c21cSLuciano Coelho struct cfg80211_match_set {
2734a1f1c21cSLuciano Coelho 	struct cfg80211_ssid ssid;
27353007e352SArend Van Spriel 	u8 bssid[ETH_ALEN];
2736ea73cbceSJohannes Berg 	s32 rssi_thold;
2737a1f1c21cSLuciano Coelho };
2738a1f1c21cSLuciano Coelho 
2739a1f1c21cSLuciano Coelho /**
27403b06d277SAvraham Stern  * struct cfg80211_sched_scan_plan - scan plan for scheduled scan
27413b06d277SAvraham Stern  *
27423b06d277SAvraham Stern  * @interval: interval between scheduled scan iterations. In seconds.
27433b06d277SAvraham Stern  * @iterations: number of scan iterations in this scan plan. Zero means
27443b06d277SAvraham Stern  *	infinite loop.
27453b06d277SAvraham Stern  *	The last scan plan will always have this parameter set to zero,
27463b06d277SAvraham Stern  *	all other scan plans will have a finite number of iterations.
27473b06d277SAvraham Stern  */
27483b06d277SAvraham Stern struct cfg80211_sched_scan_plan {
27493b06d277SAvraham Stern 	u32 interval;
27503b06d277SAvraham Stern 	u32 iterations;
27513b06d277SAvraham Stern };
27523b06d277SAvraham Stern 
27533b06d277SAvraham Stern /**
2754bf95ecdbSvamsi krishna  * struct cfg80211_bss_select_adjust - BSS selection with RSSI adjustment.
2755bf95ecdbSvamsi krishna  *
2756bf95ecdbSvamsi krishna  * @band: band of BSS which should match for RSSI level adjustment.
2757bf95ecdbSvamsi krishna  * @delta: value of RSSI level adjustment.
2758bf95ecdbSvamsi krishna  */
2759bf95ecdbSvamsi krishna struct cfg80211_bss_select_adjust {
2760bf95ecdbSvamsi krishna 	enum nl80211_band band;
2761bf95ecdbSvamsi krishna 	s8 delta;
2762bf95ecdbSvamsi krishna };
2763bf95ecdbSvamsi krishna 
2764bf95ecdbSvamsi krishna /**
2765807f8a8cSLuciano Coelho  * struct cfg80211_sched_scan_request - scheduled scan request description
2766807f8a8cSLuciano Coelho  *
276796b08fd6SArend Van Spriel  * @reqid: identifies this request.
2768807f8a8cSLuciano Coelho  * @ssids: SSIDs to scan for (passed in the probe_reqs in active scans)
2769807f8a8cSLuciano Coelho  * @n_ssids: number of SSIDs
2770807f8a8cSLuciano Coelho  * @n_channels: total number of channels to scan
2771807f8a8cSLuciano Coelho  * @ie: optional information element(s) to add into Probe Request or %NULL
2772807f8a8cSLuciano Coelho  * @ie_len: length of ie in octets
27731dcf396bSDmitry Antipov  * @flags: control flags from &enum nl80211_scan_flags
2774a1f1c21cSLuciano Coelho  * @match_sets: sets of parameters to be matched for a scan result
2775a1f1c21cSLuciano Coelho  *	entry to be considered valid and to be passed to the host
2776a1f1c21cSLuciano Coelho  *	(others are filtered out).
277798e0c7f8SRandy Dunlap  *	If omitted, all results are passed.
2778a1f1c21cSLuciano Coelho  * @n_match_sets: number of match sets
27796406c919SJohannes Berg  * @report_results: indicates that results were reported for this request
2780807f8a8cSLuciano Coelho  * @wiphy: the wiphy this was for
2781807f8a8cSLuciano Coelho  * @dev: the interface
2782077f897aSJohannes Berg  * @scan_start: start time of the scheduled scan
2783807f8a8cSLuciano Coelho  * @channels: channels to scan
2784ea73cbceSJohannes Berg  * @min_rssi_thold: for drivers only supporting a single threshold, this
2785ea73cbceSJohannes Berg  *	contains the minimum over all matchsets
2786ad2b26abSJohannes Berg  * @mac_addr: MAC address used with randomisation
2787ad2b26abSJohannes Berg  * @mac_addr_mask: MAC address mask used with randomisation, bits that
2788ad2b26abSJohannes Berg  *	are 0 in the mask should be randomised, bits that are 1 should
2789ad2b26abSJohannes Berg  *	be taken from the @mac_addr
27903b06d277SAvraham Stern  * @scan_plans: scan plans to be executed in this scheduled scan. Lowest
27913b06d277SAvraham Stern  *	index must be executed first.
27923b06d277SAvraham Stern  * @n_scan_plans: number of scan plans, at least 1.
279331a60ed1SJukka Rissanen  * @rcu_head: RCU callback used to free the struct
279493a1e86cSJukka Rissanen  * @owner_nlportid: netlink portid of owner (if this should is a request
279593a1e86cSJukka Rissanen  *	owned by a particular socket)
2796ca986ad9SArend Van Spriel  * @nl_owner_dead: netlink owner socket was closed - this request be freed
2797ca986ad9SArend Van Spriel  * @list: for keeping list of requests.
27989c748934SLuciano Coelho  * @delay: delay in seconds to use before starting the first scan
27999c748934SLuciano Coelho  *	cycle.  The driver may ignore this parameter and start
28009c748934SLuciano Coelho  *	immediately (or at any other time), if this feature is not
28019c748934SLuciano Coelho  *	supported.
2802bf95ecdbSvamsi krishna  * @relative_rssi_set: Indicates whether @relative_rssi is set or not.
2803bf95ecdbSvamsi krishna  * @relative_rssi: Relative RSSI threshold in dB to restrict scan result
2804bf95ecdbSvamsi krishna  *	reporting in connected state to cases where a matching BSS is determined
2805bf95ecdbSvamsi krishna  *	to have better or slightly worse RSSI than the current connected BSS.
2806bf95ecdbSvamsi krishna  *	The relative RSSI threshold values are ignored in disconnected state.
2807bf95ecdbSvamsi krishna  * @rssi_adjust: delta dB of RSSI preference to be given to the BSSs that belong
2808bf95ecdbSvamsi krishna  *	to the specified band while deciding whether a better BSS is reported
2809bf95ecdbSvamsi krishna  *	using @relative_rssi. If delta is a negative number, the BSSs that
2810bf95ecdbSvamsi krishna  *	belong to the specified band will be penalized by delta dB in relative
281198e0c7f8SRandy Dunlap  *	comparisons.
2812807f8a8cSLuciano Coelho  */
2813807f8a8cSLuciano Coelho struct cfg80211_sched_scan_request {
281496b08fd6SArend Van Spriel 	u64 reqid;
2815807f8a8cSLuciano Coelho 	struct cfg80211_ssid *ssids;
2816807f8a8cSLuciano Coelho 	int n_ssids;
2817807f8a8cSLuciano Coelho 	u32 n_channels;
2818807f8a8cSLuciano Coelho 	const u8 *ie;
2819807f8a8cSLuciano Coelho 	size_t ie_len;
2820ed473771SSam Leffler 	u32 flags;
2821a1f1c21cSLuciano Coelho 	struct cfg80211_match_set *match_sets;
2822a1f1c21cSLuciano Coelho 	int n_match_sets;
2823ea73cbceSJohannes Berg 	s32 min_rssi_thold;
28249c748934SLuciano Coelho 	u32 delay;
28253b06d277SAvraham Stern 	struct cfg80211_sched_scan_plan *scan_plans;
28263b06d277SAvraham Stern 	int n_scan_plans;
2827807f8a8cSLuciano Coelho 
2828ad2b26abSJohannes Berg 	u8 mac_addr[ETH_ALEN] __aligned(2);
2829ad2b26abSJohannes Berg 	u8 mac_addr_mask[ETH_ALEN] __aligned(2);
2830ad2b26abSJohannes Berg 
2831bf95ecdbSvamsi krishna 	bool relative_rssi_set;
2832bf95ecdbSvamsi krishna 	s8 relative_rssi;
2833bf95ecdbSvamsi krishna 	struct cfg80211_bss_select_adjust rssi_adjust;
2834bf95ecdbSvamsi krishna 
2835807f8a8cSLuciano Coelho 	/* internal */
2836807f8a8cSLuciano Coelho 	struct wiphy *wiphy;
2837807f8a8cSLuciano Coelho 	struct net_device *dev;
283815d6030bSSam Leffler 	unsigned long scan_start;
2839b34939b9SArend Van Spriel 	bool report_results;
284031a60ed1SJukka Rissanen 	struct rcu_head rcu_head;
284193a1e86cSJukka Rissanen 	u32 owner_nlportid;
2842ca986ad9SArend Van Spriel 	bool nl_owner_dead;
2843ca986ad9SArend Van Spriel 	struct list_head list;
2844807f8a8cSLuciano Coelho 
2845807f8a8cSLuciano Coelho 	/* keep last */
2846aa4ec06cSDmitry Antipov 	struct ieee80211_channel *channels[] __counted_by(n_channels);
2847807f8a8cSLuciano Coelho };
2848807f8a8cSLuciano Coelho 
2849807f8a8cSLuciano Coelho /**
28502a519311SJohannes Berg  * enum cfg80211_signal_type - signal type
28512a519311SJohannes Berg  *
28522a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available
28532a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm)
28542a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100
28552a519311SJohannes Berg  */
28562a519311SJohannes Berg enum cfg80211_signal_type {
28572a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_NONE,
28582a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_MBM,
28592a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_UNSPEC,
28602a519311SJohannes Berg };
28612a519311SJohannes Berg 
28622a519311SJohannes Berg /**
28636e19bc4bSDmitry Shmidt  * struct cfg80211_inform_bss - BSS inform data
28646e19bc4bSDmitry Shmidt  * @chan: channel the frame was received on
28656e19bc4bSDmitry Shmidt  * @signal: signal strength value, according to the wiphy's
28666e19bc4bSDmitry Shmidt  *	signal type
28676e19bc4bSDmitry Shmidt  * @boottime_ns: timestamp (CLOCK_BOOTTIME) when the information was
28686e19bc4bSDmitry Shmidt  *	received; should match the time when the frame was actually
28696e19bc4bSDmitry Shmidt  *	received by the device (not just by the host, in case it was
28706e19bc4bSDmitry Shmidt  *	buffered on the device) and be accurate to about 10ms.
28716e19bc4bSDmitry Shmidt  *	If the frame isn't buffered, just passing the return value of
28729285ec4cSJason A. Donenfeld  *	ktime_get_boottime_ns() is likely appropriate.
28731d76250bSAvraham Stern  * @parent_tsf: the time at the start of reception of the first octet of the
28741d76250bSAvraham Stern  *	timestamp field of the frame. The time is the TSF of the BSS specified
28751d76250bSAvraham Stern  *	by %parent_bssid.
28761d76250bSAvraham Stern  * @parent_bssid: the BSS according to which %parent_tsf is set. This is set to
28771d76250bSAvraham Stern  *	the BSS that requested the scan in which the beacon/probe was received.
2878983dafaaSSunil Dutt  * @chains: bitmask for filled values in @chain_signal.
2879983dafaaSSunil Dutt  * @chain_signal: per-chain signal strength of last received BSS in dBm.
2880d02a12b8SJohannes Berg  * @restrict_use: restrict usage, if not set, assume @use_for is
2881d02a12b8SJohannes Berg  *	%NL80211_BSS_USE_FOR_NORMAL.
2882d02a12b8SJohannes Berg  * @use_for: bitmap of possible usage for this BSS, see
2883d02a12b8SJohannes Berg  *	&enum nl80211_bss_use_for
2884d02a12b8SJohannes Berg  * @cannot_use_reasons: the reasons (bitmap) for not being able to connect,
2885d02a12b8SJohannes Berg  *	if @restrict_use is set and @use_for is zero (empty); may be 0 for
2886d02a12b8SJohannes Berg  *	unspecified reasons; see &enum nl80211_bss_cannot_use_reasons
28875db25290SBenjamin Berg  * @drv_data: Data to be passed through to @inform_bss
28886e19bc4bSDmitry Shmidt  */
28896e19bc4bSDmitry Shmidt struct cfg80211_inform_bss {
28906e19bc4bSDmitry Shmidt 	struct ieee80211_channel *chan;
28916e19bc4bSDmitry Shmidt 	s32 signal;
28926e19bc4bSDmitry Shmidt 	u64 boottime_ns;
28931d76250bSAvraham Stern 	u64 parent_tsf;
28941d76250bSAvraham Stern 	u8 parent_bssid[ETH_ALEN] __aligned(2);
2895983dafaaSSunil Dutt 	u8 chains;
2896983dafaaSSunil Dutt 	s8 chain_signal[IEEE80211_MAX_CHAINS];
28975db25290SBenjamin Berg 
2898d02a12b8SJohannes Berg 	u8 restrict_use:1, use_for:7;
2899d02a12b8SJohannes Berg 	u8 cannot_use_reasons;
2900d02a12b8SJohannes Berg 
29015db25290SBenjamin Berg 	void *drv_data;
29026e19bc4bSDmitry Shmidt };
29036e19bc4bSDmitry Shmidt 
29046e19bc4bSDmitry Shmidt /**
29052aa4d456SAkira Moroo  * struct cfg80211_bss_ies - BSS entry IE data
29068cef2c9dSJohannes Berg  * @tsf: TSF contained in the frame that carried these IEs
29079caf0364SJohannes Berg  * @rcu_head: internal use, for freeing
29089caf0364SJohannes Berg  * @len: length of the IEs
29090e227084SJohannes Berg  * @from_beacon: these IEs are known to come from a beacon
29109caf0364SJohannes Berg  * @data: IE data
29119caf0364SJohannes Berg  */
29129caf0364SJohannes Berg struct cfg80211_bss_ies {
29138cef2c9dSJohannes Berg 	u64 tsf;
29149caf0364SJohannes Berg 	struct rcu_head rcu_head;
29159caf0364SJohannes Berg 	int len;
29160e227084SJohannes Berg 	bool from_beacon;
29179caf0364SJohannes Berg 	u8 data[];
29189caf0364SJohannes Berg };
29199caf0364SJohannes Berg 
29209caf0364SJohannes Berg /**
29212a519311SJohannes Berg  * struct cfg80211_bss - BSS description
29222a519311SJohannes Berg  *
29232a519311SJohannes Berg  * This structure describes a BSS (which may also be a mesh network)
29242a519311SJohannes Berg  * for use in scan results and similar.
29252a519311SJohannes Berg  *
2926abe37c4bSJohannes Berg  * @channel: channel this BSS is on
29272a519311SJohannes Berg  * @bssid: BSSID of the BSS
29282a519311SJohannes Berg  * @beacon_interval: the beacon interval as from the frame
29292a519311SJohannes Berg  * @capability: the capability field in host byte order
293083c7aa1aSJohannes Berg  * @ies: the information elements (Note that there is no guarantee that these
293183c7aa1aSJohannes Berg  *	are well-formed!); this is a pointer to either the beacon_ies or
293283c7aa1aSJohannes Berg  *	proberesp_ies depending on whether Probe Response frame has been
293383c7aa1aSJohannes Berg  *	received. It is always non-%NULL.
293434a6eddbSJouni Malinen  * @beacon_ies: the information elements from the last Beacon frame
2935776b3580SJohannes Berg  *	(implementation note: if @hidden_beacon_bss is set this struct doesn't
2936776b3580SJohannes Berg  *	own the beacon_ies, but they're just pointers to the ones from the
2937776b3580SJohannes Berg  *	@hidden_beacon_bss struct)
293834a6eddbSJouni Malinen  * @proberesp_ies: the information elements from the last Probe Response frame
2939177fbbcbSJohannes Berg  * @proberesp_ecsa_stuck: ECSA element is stuck in the Probe Response frame,
2940177fbbcbSJohannes Berg  *	cannot rely on it having valid data
2941776b3580SJohannes Berg  * @hidden_beacon_bss: in case this BSS struct represents a probe response from
2942776b3580SJohannes Berg  *	a BSS that hides the SSID in its beacon, this points to the BSS struct
2943776b3580SJohannes Berg  *	that holds the beacon data. @beacon_ies is still valid, of course, and
2944776b3580SJohannes Berg  *	points to the same data as hidden_beacon_bss->beacon_ies in that case.
2945851ae31dSJohannes Berg  * @transmitted_bss: pointer to the transmitted BSS, if this is a
2946851ae31dSJohannes Berg  *	non-transmitted one (multi-BSSID support)
2947851ae31dSJohannes Berg  * @nontrans_list: list of non-transmitted BSS, if this is a transmitted one
2948851ae31dSJohannes Berg  *	(multi-BSSID support)
294977965c97SJohannes Berg  * @signal: signal strength value (type depends on the wiphy's signal_type)
2950983dafaaSSunil Dutt  * @chains: bitmask for filled values in @chain_signal.
2951983dafaaSSunil Dutt  * @chain_signal: per-chain signal strength of last received BSS in dBm.
29520cd01efbSSara Sharon  * @bssid_index: index in the multiple BSS set
29530cd01efbSSara Sharon  * @max_bssid_indicator: max number of members in the BSS set
2954d02a12b8SJohannes Berg  * @use_for: bitmap of possible usage for this BSS, see
2955d02a12b8SJohannes Berg  *	&enum nl80211_bss_use_for
2956d02a12b8SJohannes Berg  * @cannot_use_reasons: the reasons (bitmap) for not being able to connect,
2957d02a12b8SJohannes Berg  *	if @restrict_use is set and @use_for is zero (empty); may be 0 for
2958d02a12b8SJohannes Berg  *	unspecified reasons; see &enum nl80211_bss_cannot_use_reasons
29592a519311SJohannes Berg  * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
29602a519311SJohannes Berg  */
29612a519311SJohannes Berg struct cfg80211_bss {
29622a519311SJohannes Berg 	struct ieee80211_channel *channel;
29632a519311SJohannes Berg 
29649caf0364SJohannes Berg 	const struct cfg80211_bss_ies __rcu *ies;
29659caf0364SJohannes Berg 	const struct cfg80211_bss_ies __rcu *beacon_ies;
29669caf0364SJohannes Berg 	const struct cfg80211_bss_ies __rcu *proberesp_ies;
29679caf0364SJohannes Berg 
2968776b3580SJohannes Berg 	struct cfg80211_bss *hidden_beacon_bss;
29697011ba58SSara Sharon 	struct cfg80211_bss *transmitted_bss;
29707011ba58SSara Sharon 	struct list_head nontrans_list;
29712a519311SJohannes Berg 
29722a519311SJohannes Berg 	s32 signal;
29732a519311SJohannes Berg 
29749caf0364SJohannes Berg 	u16 beacon_interval;
29759caf0364SJohannes Berg 	u16 capability;
29769caf0364SJohannes Berg 
29779caf0364SJohannes Berg 	u8 bssid[ETH_ALEN];
2978983dafaaSSunil Dutt 	u8 chains;
2979983dafaaSSunil Dutt 	s8 chain_signal[IEEE80211_MAX_CHAINS];
29809caf0364SJohannes Berg 
2981177fbbcbSJohannes Berg 	u8 proberesp_ecsa_stuck:1;
2982177fbbcbSJohannes Berg 
29830cd01efbSSara Sharon 	u8 bssid_index;
29840cd01efbSSara Sharon 	u8 max_bssid_indicator;
29850cd01efbSSara Sharon 
2986d02a12b8SJohannes Berg 	u8 use_for;
2987d02a12b8SJohannes Berg 	u8 cannot_use_reasons;
2988d02a12b8SJohannes Berg 
2989396fba0aSGustavo A. R. Silva 	u8 priv[] __aligned(sizeof(void *));
29902a519311SJohannes Berg };
29912a519311SJohannes Berg 
29922a519311SJohannes Berg /**
299349a68e0dSJohannes Berg  * ieee80211_bss_get_elem - find element with given ID
2994517357c6SJohannes Berg  * @bss: the bss to search
299549a68e0dSJohannes Berg  * @id: the element ID
29969caf0364SJohannes Berg  *
29979caf0364SJohannes Berg  * Note that the return value is an RCU-protected pointer, so
29989caf0364SJohannes Berg  * rcu_read_lock() must be held when calling this function.
29990ae997dcSYacine Belkadi  * Return: %NULL if not found.
3000517357c6SJohannes Berg  */
300149a68e0dSJohannes Berg const struct element *ieee80211_bss_get_elem(struct cfg80211_bss *bss, u8 id);
300249a68e0dSJohannes Berg 
300349a68e0dSJohannes Berg /**
300449a68e0dSJohannes Berg  * ieee80211_bss_get_ie - find IE with given ID
300549a68e0dSJohannes Berg  * @bss: the bss to search
300649a68e0dSJohannes Berg  * @id: the element ID
300749a68e0dSJohannes Berg  *
300849a68e0dSJohannes Berg  * Note that the return value is an RCU-protected pointer, so
300949a68e0dSJohannes Berg  * rcu_read_lock() must be held when calling this function.
301049a68e0dSJohannes Berg  * Return: %NULL if not found.
301149a68e0dSJohannes Berg  */
ieee80211_bss_get_ie(struct cfg80211_bss * bss,u8 id)301249a68e0dSJohannes Berg static inline const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 id)
301349a68e0dSJohannes Berg {
30147e367b06SJohannes Berg 	return (const void *)ieee80211_bss_get_elem(bss, id);
301549a68e0dSJohannes Berg }
3016517357c6SJohannes Berg 
3017517357c6SJohannes Berg 
3018517357c6SJohannes Berg /**
3019636a5d36SJouni Malinen  * struct cfg80211_auth_request - Authentication request data
3020636a5d36SJouni Malinen  *
3021636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
3022636a5d36SJouni Malinen  * authentication.
3023636a5d36SJouni Malinen  *
3024959867faSJohannes Berg  * @bss: The BSS to authenticate with, the callee must obtain a reference
3025959867faSJohannes Berg  *	to it if it needs to keep it.
3026636a5d36SJouni Malinen  * @auth_type: Authentication type (algorithm)
3027636a5d36SJouni Malinen  * @ie: Extra IEs to add to Authentication frame or %NULL
3028636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
3029fffd0934SJohannes Berg  * @key_len: length of WEP key for shared key authentication
3030fffd0934SJohannes Berg  * @key_idx: index of WEP key for shared key authentication
3031fffd0934SJohannes Berg  * @key: WEP key for shared key authentication
303211b6b5a4SJouni Malinen  * @auth_data: Fields and elements in Authentication frames. This contains
303311b6b5a4SJouni Malinen  *	the authentication frame body (non-IE and IE data), excluding the
303411b6b5a4SJouni Malinen  *	Authentication algorithm number, i.e., starting at the Authentication
303511b6b5a4SJouni Malinen  *	transaction sequence number field.
303611b6b5a4SJouni Malinen  * @auth_data_len: Length of auth_data buffer in octets
3037d648c230SJohannes Berg  * @link_id: if >= 0, indicates authentication should be done as an MLD,
3038d648c230SJohannes Berg  *	the interface address is included as the MLD address and the
3039d648c230SJohannes Berg  *	necessary link (with the given link_id) will be created (and
3040d648c230SJohannes Berg  *	given an MLD address) by the driver
3041d648c230SJohannes Berg  * @ap_mld_addr: AP MLD address in case of authentication request with
3042d648c230SJohannes Berg  *	an AP MLD, valid iff @link_id >= 0
3043636a5d36SJouni Malinen  */
3044636a5d36SJouni Malinen struct cfg80211_auth_request {
304519957bb3SJohannes Berg 	struct cfg80211_bss *bss;
3046636a5d36SJouni Malinen 	const u8 *ie;
3047636a5d36SJouni Malinen 	size_t ie_len;
304819957bb3SJohannes Berg 	enum nl80211_auth_type auth_type;
3049fffd0934SJohannes Berg 	const u8 *key;
305023cc6d8cSJohannes Berg 	u8 key_len;
305123cc6d8cSJohannes Berg 	s8 key_idx;
305211b6b5a4SJouni Malinen 	const u8 *auth_data;
305311b6b5a4SJouni Malinen 	size_t auth_data_len;
3054d648c230SJohannes Berg 	s8 link_id;
3055d648c230SJohannes Berg 	const u8 *ap_mld_addr;
3056d648c230SJohannes Berg };
3057d648c230SJohannes Berg 
3058d648c230SJohannes Berg /**
3059d648c230SJohannes Berg  * struct cfg80211_assoc_link - per-link information for MLO association
3060d648c230SJohannes Berg  * @bss: the BSS pointer, see also &struct cfg80211_assoc_request::bss;
3061d648c230SJohannes Berg  *	if this is %NULL for a link, that link is not requested
3062d648c230SJohannes Berg  * @elems: extra elements for the per-STA profile for this link
3063d648c230SJohannes Berg  * @elems_len: length of the elements
30646cf963edSIlan Peer  * @disabled: If set this link should be included during association etc. but it
30656cf963edSIlan Peer  *	should not be used until enabled by the AP MLD.
3066a7b2cc59SBenjamin Berg  * @error: per-link error code, must be <= 0. If there is an error, then the
3067a7b2cc59SBenjamin Berg  *	operation as a whole must fail.
3068d648c230SJohannes Berg  */
3069d648c230SJohannes Berg struct cfg80211_assoc_link {
3070d648c230SJohannes Berg 	struct cfg80211_bss *bss;
3071d648c230SJohannes Berg 	const u8 *elems;
3072d648c230SJohannes Berg 	size_t elems_len;
30736cf963edSIlan Peer 	bool disabled;
3074a7b2cc59SBenjamin Berg 	int error;
3075636a5d36SJouni Malinen };
3076636a5d36SJouni Malinen 
3077636a5d36SJouni Malinen /**
30787e7c8926SBen Greear  * enum cfg80211_assoc_req_flags - Over-ride default behaviour in association.
30797e7c8926SBen Greear  *
30807e7c8926SBen Greear  * @ASSOC_REQ_DISABLE_HT:  Disable HT (802.11n)
3081ee2aca34SJohannes Berg  * @ASSOC_REQ_DISABLE_VHT:  Disable VHT
3082bab5ab7dSAssaf Krauss  * @ASSOC_REQ_USE_RRM: Declare RRM capability in this association
308340cbfa90SSrinivas Dasari  * @CONNECT_REQ_EXTERNAL_AUTH_SUPPORT: User space indicates external
308440cbfa90SSrinivas Dasari  *	authentication capability. Drivers can offload authentication to
308540cbfa90SSrinivas Dasari  *	userspace if this flag is set. Only applicable for cfg80211_connect()
308640cbfa90SSrinivas Dasari  *	request (connect callback).
3087b6db0f89SBen Greear  * @ASSOC_REQ_DISABLE_HE:  Disable HE
308836f84235SMuna Sinada  * @ASSOC_REQ_DISABLE_EHT:  Disable EHT
3089efbabc11SVeerendranath Jakkam  * @CONNECT_REQ_MLO_SUPPORT: Userspace indicates support for handling MLD links.
3090efbabc11SVeerendranath Jakkam  *	Drivers shall disable MLO features for the current association if this
3091efbabc11SVeerendranath Jakkam  *	flag is not set.
30922518e89dSJohannes Berg  * @ASSOC_REQ_SPP_AMSDU: SPP A-MSDUs will be used on this connection (if any)
30937e7c8926SBen Greear  */
30947e7c8926SBen Greear enum cfg80211_assoc_req_flags {
30957e7c8926SBen Greear 	ASSOC_REQ_DISABLE_HT			= BIT(0),
3096ee2aca34SJohannes Berg 	ASSOC_REQ_DISABLE_VHT			= BIT(1),
3097bab5ab7dSAssaf Krauss 	ASSOC_REQ_USE_RRM			= BIT(2),
309840cbfa90SSrinivas Dasari 	CONNECT_REQ_EXTERNAL_AUTH_SUPPORT	= BIT(3),
3099b6db0f89SBen Greear 	ASSOC_REQ_DISABLE_HE			= BIT(4),
310036f84235SMuna Sinada 	ASSOC_REQ_DISABLE_EHT			= BIT(5),
3101efbabc11SVeerendranath Jakkam 	CONNECT_REQ_MLO_SUPPORT			= BIT(6),
31022518e89dSJohannes Berg 	ASSOC_REQ_SPP_AMSDU			= BIT(7),
31037e7c8926SBen Greear };
31047e7c8926SBen Greear 
31057e7c8926SBen Greear /**
3106636a5d36SJouni Malinen  * struct cfg80211_assoc_request - (Re)Association request data
3107636a5d36SJouni Malinen  *
3108636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
3109636a5d36SJouni Malinen  * (re)association.
3110959867faSJohannes Berg  * @bss: The BSS to associate with. If the call is successful the driver is
3111959867faSJohannes Berg  *	given a reference that it must give back to cfg80211_send_rx_assoc()
3112959867faSJohannes Berg  *	or to cfg80211_assoc_timeout(). To ensure proper refcounting, new
3113959867faSJohannes Berg  *	association requests while already associating must be rejected.
3114d648c230SJohannes Berg  *	This also applies to the @links.bss parameter, which is used instead
3115d648c230SJohannes Berg  *	of this one (it is %NULL) for MLO associations.
3116636a5d36SJouni Malinen  * @ie: Extra IEs to add to (Re)Association Request frame or %NULL
3117636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
3118dc6382ceSJouni Malinen  * @use_mfp: Use management frame protection (IEEE 802.11w) in this association
3119b23aa676SSamuel Ortiz  * @crypto: crypto settings
312035eb8f7bSJouni Malinen  * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used
312135eb8f7bSJouni Malinen  *	to indicate a request to reassociate within the ESS instead of a request
312235eb8f7bSJouni Malinen  *	do the initial association with the ESS. When included, this is set to
312335eb8f7bSJouni Malinen  *	the BSSID of the current association, i.e., to the value that is
312435eb8f7bSJouni Malinen  *	included in the Current AP address field of the Reassociation Request
312535eb8f7bSJouni Malinen  *	frame.
31267e7c8926SBen Greear  * @flags:  See &enum cfg80211_assoc_req_flags
31277e7c8926SBen Greear  * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask
31287e7c8926SBen Greear  *	will be used in ht_capa.  Un-supported values will be ignored.
31297e7c8926SBen Greear  * @ht_capa_mask:  The bits of ht_capa which are to be used.
3130ee2aca34SJohannes Berg  * @vht_capa: VHT capability override
3131ee2aca34SJohannes Berg  * @vht_capa_mask: VHT capability mask indicating which fields to use
3132348bd456SJouni Malinen  * @fils_kek: FILS KEK for protecting (Re)Association Request/Response frame or
3133348bd456SJouni Malinen  *	%NULL if FILS is not used.
3134348bd456SJouni Malinen  * @fils_kek_len: Length of fils_kek in octets
3135348bd456SJouni Malinen  * @fils_nonces: FILS nonces (part of AAD) for protecting (Re)Association
3136348bd456SJouni Malinen  *	Request/Response frame or %NULL if FILS is not used. This field starts
3137348bd456SJouni Malinen  *	with 16 octets of STA Nonce followed by 16 octets of AP Nonce.
3138d2b7588aSThomas Pedersen  * @s1g_capa: S1G capability override
3139d2b7588aSThomas Pedersen  * @s1g_capa_mask: S1G capability override mask
3140d648c230SJohannes Berg  * @links: per-link information for MLO connections
3141d648c230SJohannes Berg  * @link_id: >= 0 for MLO connections, where links are given, and indicates
3142d648c230SJohannes Berg  *	the link on which the association request should be sent
3143d648c230SJohannes Berg  * @ap_mld_addr: AP MLD address in case of MLO association request,
3144d648c230SJohannes Berg  *	valid iff @link_id >= 0
3145636a5d36SJouni Malinen  */
3146636a5d36SJouni Malinen struct cfg80211_assoc_request {
314719957bb3SJohannes Berg 	struct cfg80211_bss *bss;
31483e5d7649SJohannes Berg 	const u8 *ie, *prev_bssid;
3149636a5d36SJouni Malinen 	size_t ie_len;
3150b23aa676SSamuel Ortiz 	struct cfg80211_crypto_settings crypto;
315119957bb3SJohannes Berg 	bool use_mfp;
31527e7c8926SBen Greear 	u32 flags;
31537e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa;
31547e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa_mask;
3155ee2aca34SJohannes Berg 	struct ieee80211_vht_cap vht_capa, vht_capa_mask;
3156348bd456SJouni Malinen 	const u8 *fils_kek;
3157348bd456SJouni Malinen 	size_t fils_kek_len;
3158348bd456SJouni Malinen 	const u8 *fils_nonces;
3159d2b7588aSThomas Pedersen 	struct ieee80211_s1g_cap s1g_capa, s1g_capa_mask;
3160d648c230SJohannes Berg 	struct cfg80211_assoc_link links[IEEE80211_MLD_MAX_NUM_LINKS];
3161d648c230SJohannes Berg 	const u8 *ap_mld_addr;
3162d648c230SJohannes Berg 	s8 link_id;
3163636a5d36SJouni Malinen };
3164636a5d36SJouni Malinen 
3165636a5d36SJouni Malinen /**
3166636a5d36SJouni Malinen  * struct cfg80211_deauth_request - Deauthentication request data
3167636a5d36SJouni Malinen  *
3168636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
3169636a5d36SJouni Malinen  * deauthentication.
3170636a5d36SJouni Malinen  *
31718f6e0dfcSJohannes Berg  * @bssid: the BSSID or AP MLD address to deauthenticate from
3172636a5d36SJouni Malinen  * @ie: Extra IEs to add to Deauthentication frame or %NULL
3173636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
317419957bb3SJohannes Berg  * @reason_code: The reason code for the deauthentication
3175077f897aSJohannes Berg  * @local_state_change: if set, change local state only and
3176077f897aSJohannes Berg  *	do not set a deauth frame
3177636a5d36SJouni Malinen  */
3178636a5d36SJouni Malinen struct cfg80211_deauth_request {
317995de817bSJohannes Berg 	const u8 *bssid;
3180636a5d36SJouni Malinen 	const u8 *ie;
3181636a5d36SJouni Malinen 	size_t ie_len;
318219957bb3SJohannes Berg 	u16 reason_code;
31836863255bSStanislaw Gruszka 	bool local_state_change;
3184636a5d36SJouni Malinen };
3185636a5d36SJouni Malinen 
3186636a5d36SJouni Malinen /**
3187636a5d36SJouni Malinen  * struct cfg80211_disassoc_request - Disassociation request data
3188636a5d36SJouni Malinen  *
3189636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
319066f00449SMasahiro Yamada  * disassociation.
3191636a5d36SJouni Malinen  *
31928f6e0dfcSJohannes Berg  * @ap_addr: the BSSID or AP MLD address to disassociate from
3193636a5d36SJouni Malinen  * @ie: Extra IEs to add to Disassociation frame or %NULL
3194636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
319519957bb3SJohannes Berg  * @reason_code: The reason code for the disassociation
3196d5cdfacbSJouni Malinen  * @local_state_change: This is a request for a local state only, i.e., no
3197d5cdfacbSJouni Malinen  *	Disassociation frame is to be transmitted.
3198636a5d36SJouni Malinen  */
3199636a5d36SJouni Malinen struct cfg80211_disassoc_request {
32008f6e0dfcSJohannes Berg 	const u8 *ap_addr;
3201636a5d36SJouni Malinen 	const u8 *ie;
3202636a5d36SJouni Malinen 	size_t ie_len;
320319957bb3SJohannes Berg 	u16 reason_code;
3204d5cdfacbSJouni Malinen 	bool local_state_change;
3205636a5d36SJouni Malinen };
3206636a5d36SJouni Malinen 
3207636a5d36SJouni Malinen /**
320804a773adSJohannes Berg  * struct cfg80211_ibss_params - IBSS parameters
320904a773adSJohannes Berg  *
321004a773adSJohannes Berg  * This structure defines the IBSS parameters for the join_ibss()
321104a773adSJohannes Berg  * method.
321204a773adSJohannes Berg  *
321304a773adSJohannes Berg  * @ssid: The SSID, will always be non-null.
321404a773adSJohannes Berg  * @ssid_len: The length of the SSID, will always be non-zero.
321504a773adSJohannes Berg  * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not
321604a773adSJohannes Berg  *	search for IBSSs with a different BSSID.
3217683b6d3bSJohannes Berg  * @chandef: defines the channel to use if no other IBSS to join can be found
321804a773adSJohannes Berg  * @channel_fixed: The channel should be fixed -- do not search for
321904a773adSJohannes Berg  *	IBSSs to join on other channels.
322004a773adSJohannes Berg  * @ie: information element(s) to include in the beacon
322104a773adSJohannes Berg  * @ie_len: length of that
32228e30bc55SJohannes Berg  * @beacon_interval: beacon interval to use
3223fffd0934SJohannes Berg  * @privacy: this is a protected network, keys will be configured
3224fffd0934SJohannes Berg  *	after joining
3225267335d6SAntonio Quartulli  * @control_port: whether user space controls IEEE 802.1X port, i.e.,
3226267335d6SAntonio Quartulli  *	sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
3227267335d6SAntonio Quartulli  *	required to assume that the port is unauthorized until authorized by
3228267335d6SAntonio Quartulli  *	user space. Otherwise, port is marked authorized by default.
3229c3bfe1f6SDenis Kenzior  * @control_port_over_nl80211: TRUE if userspace expects to exchange control
3230c3bfe1f6SDenis Kenzior  *	port frames over NL80211 instead of the network interface.
32315336fa88SSimon Wunderlich  * @userspace_handles_dfs: whether user space controls DFS operation, i.e.
32325336fa88SSimon Wunderlich  *	changes the channel when a radar is detected. This is required
32335336fa88SSimon Wunderlich  *	to operate on DFS channels.
3234fbd2c8dcSTeemu Paasikivi  * @basic_rates: bitmap of basic rates to use when creating the IBSS
3235dd5b4cc7SFelix Fietkau  * @mcast_rate: per-band multicast rate index + 1 (0: disabled)
3236803768f5SSimon Wunderlich  * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask
3237803768f5SSimon Wunderlich  *	will be used in ht_capa.  Un-supported values will be ignored.
3238803768f5SSimon Wunderlich  * @ht_capa_mask:  The bits of ht_capa which are to be used.
32399ae3b172STova Mussai  * @wep_keys: static WEP keys, if not NULL points to an array of
32409ae3b172STova Mussai  *	CFG80211_MAX_WEP_KEYS WEP keys
32419ae3b172STova Mussai  * @wep_tx_key: key index (0..3) of the default TX static WEP key
324204a773adSJohannes Berg  */
324304a773adSJohannes Berg struct cfg80211_ibss_params {
3244c1e5f471SJohannes Berg 	const u8 *ssid;
3245c1e5f471SJohannes Berg 	const u8 *bssid;
3246683b6d3bSJohannes Berg 	struct cfg80211_chan_def chandef;
3247c1e5f471SJohannes Berg 	const u8 *ie;
324804a773adSJohannes Berg 	u8 ssid_len, ie_len;
32498e30bc55SJohannes Berg 	u16 beacon_interval;
3250fbd2c8dcSTeemu Paasikivi 	u32 basic_rates;
325104a773adSJohannes Berg 	bool channel_fixed;
3252fffd0934SJohannes Berg 	bool privacy;
3253267335d6SAntonio Quartulli 	bool control_port;
3254c3bfe1f6SDenis Kenzior 	bool control_port_over_nl80211;
32555336fa88SSimon Wunderlich 	bool userspace_handles_dfs;
325657fbcce3SJohannes Berg 	int mcast_rate[NUM_NL80211_BANDS];
3257803768f5SSimon Wunderlich 	struct ieee80211_ht_cap ht_capa;
3258803768f5SSimon Wunderlich 	struct ieee80211_ht_cap ht_capa_mask;
32599ae3b172STova Mussai 	struct key_params *wep_keys;
32609ae3b172STova Mussai 	int wep_tx_key;
326104a773adSJohannes Berg };
326204a773adSJohannes Berg 
326304a773adSJohannes Berg /**
326438de03d2SArend van Spriel  * struct cfg80211_bss_selection - connection parameters for BSS selection.
326538de03d2SArend van Spriel  *
326638de03d2SArend van Spriel  * @behaviour: requested BSS selection behaviour.
326738de03d2SArend van Spriel  * @param: parameters for requestion behaviour.
326833615978SJonathan Corbet  * @param.band_pref: preferred band for %NL80211_BSS_SELECT_ATTR_BAND_PREF.
326933615978SJonathan Corbet  * @param.adjust: parameters for %NL80211_BSS_SELECT_ATTR_RSSI_ADJUST.
327038de03d2SArend van Spriel  */
327138de03d2SArend van Spriel struct cfg80211_bss_selection {
327238de03d2SArend van Spriel 	enum nl80211_bss_select_attr behaviour;
327338de03d2SArend van Spriel 	union {
327457fbcce3SJohannes Berg 		enum nl80211_band band_pref;
327538de03d2SArend van Spriel 		struct cfg80211_bss_select_adjust adjust;
327638de03d2SArend van Spriel 	} param;
327738de03d2SArend van Spriel };
327838de03d2SArend van Spriel 
327938de03d2SArend van Spriel /**
3280b23aa676SSamuel Ortiz  * struct cfg80211_connect_params - Connection parameters
3281b23aa676SSamuel Ortiz  *
3282b23aa676SSamuel Ortiz  * This structure provides information needed to complete IEEE 802.11
3283b23aa676SSamuel Ortiz  * authentication and association.
3284b23aa676SSamuel Ortiz  *
3285b23aa676SSamuel Ortiz  * @channel: The channel to use or %NULL if not specified (auto-select based
3286b23aa676SSamuel Ortiz  *	on scan results)
32871df4a510SJouni Malinen  * @channel_hint: The channel of the recommended BSS for initial connection or
32881df4a510SJouni Malinen  *	%NULL if not specified
3289b23aa676SSamuel Ortiz  * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan
3290b23aa676SSamuel Ortiz  *	results)
32911df4a510SJouni Malinen  * @bssid_hint: The recommended AP BSSID for initial connection to the BSS or
32921df4a510SJouni Malinen  *	%NULL if not specified. Unlike the @bssid parameter, the driver is
32931df4a510SJouni Malinen  *	allowed to ignore this @bssid_hint if it has knowledge of a better BSS
32941df4a510SJouni Malinen  *	to use.
3295b23aa676SSamuel Ortiz  * @ssid: SSID
3296b23aa676SSamuel Ortiz  * @ssid_len: Length of ssid in octets
3297b23aa676SSamuel Ortiz  * @auth_type: Authentication type (algorithm)
3298abe37c4bSJohannes Berg  * @ie: IEs for association request
3299abe37c4bSJohannes Berg  * @ie_len: Length of assoc_ie in octets
3300b23aa676SSamuel Ortiz  * @privacy: indicates whether privacy-enabled APs should be used
3301cee00a95SJouni Malinen  * @mfp: indicate whether management frame protection is used
3302b23aa676SSamuel Ortiz  * @crypto: crypto settings
3303fffd0934SJohannes Berg  * @key_len: length of WEP key for shared key authentication
3304fffd0934SJohannes Berg  * @key_idx: index of WEP key for shared key authentication
3305fffd0934SJohannes Berg  * @key: WEP key for shared key authentication
33067e7c8926SBen Greear  * @flags:  See &enum cfg80211_assoc_req_flags
33074486ea98SBala Shanmugam  * @bg_scan_period:  Background scan period in seconds
33084486ea98SBala Shanmugam  *	or -1 to indicate that default value is to be used.
33097e7c8926SBen Greear  * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask
33107e7c8926SBen Greear  *	will be used in ht_capa.  Un-supported values will be ignored.
33117e7c8926SBen Greear  * @ht_capa_mask:  The bits of ht_capa which are to be used.
3312ee2aca34SJohannes Berg  * @vht_capa:  VHT Capability overrides
3313ee2aca34SJohannes Berg  * @vht_capa_mask: The bits of vht_capa which are to be used.
331434d50519SLior David  * @pbss: if set, connect to a PCP instead of AP. Valid for DMG
331534d50519SLior David  *	networks.
331638de03d2SArend van Spriel  * @bss_select: criteria to be used for BSS selection.
331735eb8f7bSJouni Malinen  * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used
331835eb8f7bSJouni Malinen  *	to indicate a request to reassociate within the ESS instead of a request
331935eb8f7bSJouni Malinen  *	do the initial association with the ESS. When included, this is set to
332035eb8f7bSJouni Malinen  *	the BSSID of the current association, i.e., to the value that is
332135eb8f7bSJouni Malinen  *	included in the Current AP address field of the Reassociation Request
332235eb8f7bSJouni Malinen  *	frame.
3323a3caf744SVidyullatha Kanchanapally  * @fils_erp_username: EAP re-authentication protocol (ERP) username part of the
3324a3caf744SVidyullatha Kanchanapally  *	NAI or %NULL if not specified. This is used to construct FILS wrapped
3325a3caf744SVidyullatha Kanchanapally  *	data IE.
3326a3caf744SVidyullatha Kanchanapally  * @fils_erp_username_len: Length of @fils_erp_username in octets.
3327a3caf744SVidyullatha Kanchanapally  * @fils_erp_realm: EAP re-authentication protocol (ERP) realm part of NAI or
3328a3caf744SVidyullatha Kanchanapally  *	%NULL if not specified. This specifies the domain name of ER server and
3329a3caf744SVidyullatha Kanchanapally  *	is used to construct FILS wrapped data IE.
3330a3caf744SVidyullatha Kanchanapally  * @fils_erp_realm_len: Length of @fils_erp_realm in octets.
3331a3caf744SVidyullatha Kanchanapally  * @fils_erp_next_seq_num: The next sequence number to use in the FILS ERP
3332a3caf744SVidyullatha Kanchanapally  *	messages. This is also used to construct FILS wrapped data IE.
3333a3caf744SVidyullatha Kanchanapally  * @fils_erp_rrk: ERP re-authentication Root Key (rRK) used to derive additional
3334a3caf744SVidyullatha Kanchanapally  *	keys in FILS or %NULL if not specified.
3335a3caf744SVidyullatha Kanchanapally  * @fils_erp_rrk_len: Length of @fils_erp_rrk in octets.
33363a00df57SAvraham Stern  * @want_1x: indicates user-space supports and wants to use 802.1X driver
33373a00df57SAvraham Stern  *	offload of 4-way handshake.
33382a38075cSAlexei Avshalom Lazar  * @edmg: define the EDMG channels.
33392a38075cSAlexei Avshalom Lazar  *	This may specify multiple channels and bonding options for the driver
33402a38075cSAlexei Avshalom Lazar  *	to choose from, based on BSS configuration.
3341b23aa676SSamuel Ortiz  */
3342b23aa676SSamuel Ortiz struct cfg80211_connect_params {
3343b23aa676SSamuel Ortiz 	struct ieee80211_channel *channel;
33441df4a510SJouni Malinen 	struct ieee80211_channel *channel_hint;
3345664834deSJouni Malinen 	const u8 *bssid;
33461df4a510SJouni Malinen 	const u8 *bssid_hint;
3347664834deSJouni Malinen 	const u8 *ssid;
3348b23aa676SSamuel Ortiz 	size_t ssid_len;
3349b23aa676SSamuel Ortiz 	enum nl80211_auth_type auth_type;
33504b5800feSJohannes Berg 	const u8 *ie;
3351b23aa676SSamuel Ortiz 	size_t ie_len;
3352b23aa676SSamuel Ortiz 	bool privacy;
3353cee00a95SJouni Malinen 	enum nl80211_mfp mfp;
3354b23aa676SSamuel Ortiz 	struct cfg80211_crypto_settings crypto;
3355fffd0934SJohannes Berg 	const u8 *key;
3356fffd0934SJohannes Berg 	u8 key_len, key_idx;
33577e7c8926SBen Greear 	u32 flags;
33584486ea98SBala Shanmugam 	int bg_scan_period;
33597e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa;
33607e7c8926SBen Greear 	struct ieee80211_ht_cap ht_capa_mask;
3361ee2aca34SJohannes Berg 	struct ieee80211_vht_cap vht_capa;
3362ee2aca34SJohannes Berg 	struct ieee80211_vht_cap vht_capa_mask;
336334d50519SLior David 	bool pbss;
336438de03d2SArend van Spriel 	struct cfg80211_bss_selection bss_select;
3365ba6fbacfSJouni Malinen 	const u8 *prev_bssid;
3366a3caf744SVidyullatha Kanchanapally 	const u8 *fils_erp_username;
3367a3caf744SVidyullatha Kanchanapally 	size_t fils_erp_username_len;
3368a3caf744SVidyullatha Kanchanapally 	const u8 *fils_erp_realm;
3369a3caf744SVidyullatha Kanchanapally 	size_t fils_erp_realm_len;
3370a3caf744SVidyullatha Kanchanapally 	u16 fils_erp_next_seq_num;
3371a3caf744SVidyullatha Kanchanapally 	const u8 *fils_erp_rrk;
3372a3caf744SVidyullatha Kanchanapally 	size_t fils_erp_rrk_len;
33733a00df57SAvraham Stern 	bool want_1x;
33742a38075cSAlexei Avshalom Lazar 	struct ieee80211_edmg edmg;
3375b23aa676SSamuel Ortiz };
3376b23aa676SSamuel Ortiz 
3377b23aa676SSamuel Ortiz /**
3378088e8df8Svamsi krishna  * enum cfg80211_connect_params_changed - Connection parameters being updated
3379088e8df8Svamsi krishna  *
3380088e8df8Svamsi krishna  * This enum provides information of all connect parameters that
3381088e8df8Svamsi krishna  * have to be updated as part of update_connect_params() call.
3382088e8df8Svamsi krishna  *
3383088e8df8Svamsi krishna  * @UPDATE_ASSOC_IES: Indicates whether association request IEs are updated
33847f9a3e15SVidyullatha Kanchanapally  * @UPDATE_FILS_ERP_INFO: Indicates that FILS connection parameters (realm,
33857f9a3e15SVidyullatha Kanchanapally  *	username, erp sequence number and rrk) are updated
33867f9a3e15SVidyullatha Kanchanapally  * @UPDATE_AUTH_TYPE: Indicates that authentication type is updated
3387088e8df8Svamsi krishna  */
3388088e8df8Svamsi krishna enum cfg80211_connect_params_changed {
3389088e8df8Svamsi krishna 	UPDATE_ASSOC_IES		= BIT(0),
33907f9a3e15SVidyullatha Kanchanapally 	UPDATE_FILS_ERP_INFO		= BIT(1),
33917f9a3e15SVidyullatha Kanchanapally 	UPDATE_AUTH_TYPE		= BIT(2),
3392088e8df8Svamsi krishna };
3393088e8df8Svamsi krishna 
3394088e8df8Svamsi krishna /**
3395b9a5f8caSJouni Malinen  * enum wiphy_params_flags - set_wiphy_params bitfield values
3396abe37c4bSJohannes Berg  * @WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed
3397abe37c4bSJohannes Berg  * @WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed
3398abe37c4bSJohannes Berg  * @WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed
3399abe37c4bSJohannes Berg  * @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed
3400abe37c4bSJohannes Berg  * @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed
34013057dbfdSLorenzo Bianconi  * @WIPHY_PARAM_DYN_ACK: dynack has been enabled
340252539ca8SToke Høiland-Jørgensen  * @WIPHY_PARAM_TXQ_LIMIT: TXQ packet limit has been changed
340352539ca8SToke Høiland-Jørgensen  * @WIPHY_PARAM_TXQ_MEMORY_LIMIT: TXQ memory limit has been changed
340452539ca8SToke Høiland-Jørgensen  * @WIPHY_PARAM_TXQ_QUANTUM: TXQ scheduler quantum
3405b9a5f8caSJouni Malinen  */
3406b9a5f8caSJouni Malinen enum wiphy_params_flags {
34078682ad36SJohannes Berg 	WIPHY_PARAM_RETRY_SHORT		= BIT(0),
34088682ad36SJohannes Berg 	WIPHY_PARAM_RETRY_LONG		= BIT(1),
34098682ad36SJohannes Berg 	WIPHY_PARAM_FRAG_THRESHOLD	= BIT(2),
34108682ad36SJohannes Berg 	WIPHY_PARAM_RTS_THRESHOLD	= BIT(3),
34118682ad36SJohannes Berg 	WIPHY_PARAM_COVERAGE_CLASS	= BIT(4),
34128682ad36SJohannes Berg 	WIPHY_PARAM_DYN_ACK		= BIT(5),
34138682ad36SJohannes Berg 	WIPHY_PARAM_TXQ_LIMIT		= BIT(6),
34148682ad36SJohannes Berg 	WIPHY_PARAM_TXQ_MEMORY_LIMIT	= BIT(7),
34158682ad36SJohannes Berg 	WIPHY_PARAM_TXQ_QUANTUM		= BIT(8),
3416b9a5f8caSJouni Malinen };
3417b9a5f8caSJouni Malinen 
341836647055SToke Høiland-Jørgensen #define IEEE80211_DEFAULT_AIRTIME_WEIGHT	256
341936647055SToke Høiland-Jørgensen 
34203ace10f5SKan Yan /* The per TXQ device queue limit in airtime */
34213ace10f5SKan Yan #define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_L	5000
34223ace10f5SKan Yan #define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_H	12000
34233ace10f5SKan Yan 
34243ace10f5SKan Yan /* The per interface airtime threshold to switch to lower queue limit */
34253ace10f5SKan Yan #define IEEE80211_AQL_THRESHOLD			24000
34263ace10f5SKan Yan 
342767fbb16bSSamuel Ortiz /**
342867fbb16bSSamuel Ortiz  * struct cfg80211_pmksa - PMK Security Association
342967fbb16bSSamuel Ortiz  *
343067fbb16bSSamuel Ortiz  * This structure is passed to the set/del_pmksa() method for PMKSA
343167fbb16bSSamuel Ortiz  * caching.
343267fbb16bSSamuel Ortiz  *
3433a3caf744SVidyullatha Kanchanapally  * @bssid: The AP's BSSID (may be %NULL).
3434a3caf744SVidyullatha Kanchanapally  * @pmkid: The identifier to refer a PMKSA.
3435a3caf744SVidyullatha Kanchanapally  * @pmk: The PMK for the PMKSA identified by @pmkid. This is used for key
3436a3caf744SVidyullatha Kanchanapally  *	derivation by a FILS STA. Otherwise, %NULL.
3437a3caf744SVidyullatha Kanchanapally  * @pmk_len: Length of the @pmk. The length of @pmk can differ depending on
3438a3caf744SVidyullatha Kanchanapally  *	the hash algorithm used to generate this.
3439a3caf744SVidyullatha Kanchanapally  * @ssid: SSID to specify the ESS within which a PMKSA is valid when using FILS
3440a3caf744SVidyullatha Kanchanapally  *	cache identifier (may be %NULL).
3441a3caf744SVidyullatha Kanchanapally  * @ssid_len: Length of the @ssid in octets.
3442a3caf744SVidyullatha Kanchanapally  * @cache_id: 2-octet cache identifier advertized by a FILS AP identifying the
3443a3caf744SVidyullatha Kanchanapally  *	scope of PMKSA. This is valid only if @ssid_len is non-zero (may be
3444a3caf744SVidyullatha Kanchanapally  *	%NULL).
34457fc82af8SVeerendranath Jakkam  * @pmk_lifetime: Maximum lifetime for PMKSA in seconds
34467fc82af8SVeerendranath Jakkam  *	(dot11RSNAConfigPMKLifetime) or 0 if not specified.
34477fc82af8SVeerendranath Jakkam  *	The configured PMKSA must not be used for PMKSA caching after
34487fc82af8SVeerendranath Jakkam  *	expiration and any keys derived from this PMK become invalid on
34497fc82af8SVeerendranath Jakkam  *	expiration, i.e., the current association must be dropped if the PMK
34507fc82af8SVeerendranath Jakkam  *	used for it expires.
34517fc82af8SVeerendranath Jakkam  * @pmk_reauth_threshold: Threshold time for reauthentication (percentage of
34527fc82af8SVeerendranath Jakkam  *	PMK lifetime, dot11RSNAConfigPMKReauthThreshold) or 0 if not specified.
34537fc82af8SVeerendranath Jakkam  *	Drivers are expected to trigger a full authentication instead of using
34547fc82af8SVeerendranath Jakkam  *	this PMKSA for caching when reassociating to a new BSS after this
34557fc82af8SVeerendranath Jakkam  *	threshold to generate a new PMK before the current one expires.
345667fbb16bSSamuel Ortiz  */
345767fbb16bSSamuel Ortiz struct cfg80211_pmksa {
3458c1e5f471SJohannes Berg 	const u8 *bssid;
3459c1e5f471SJohannes Berg 	const u8 *pmkid;
3460a3caf744SVidyullatha Kanchanapally 	const u8 *pmk;
3461a3caf744SVidyullatha Kanchanapally 	size_t pmk_len;
3462a3caf744SVidyullatha Kanchanapally 	const u8 *ssid;
3463a3caf744SVidyullatha Kanchanapally 	size_t ssid_len;
3464a3caf744SVidyullatha Kanchanapally 	const u8 *cache_id;
34657fc82af8SVeerendranath Jakkam 	u32 pmk_lifetime;
34667fc82af8SVeerendranath Jakkam 	u8 pmk_reauth_threshold;
346767fbb16bSSamuel Ortiz };
34689930380fSJohannes Berg 
34697643a2c3SJohannes Berg /**
347050ac6607SAmitkumar Karwar  * struct cfg80211_pkt_pattern - packet pattern
3471ff1b6e69SJohannes Berg  * @mask: bitmask where to match pattern and where to ignore bytes,
3472ff1b6e69SJohannes Berg  *	one bit per byte, in same format as nl80211
3473ff1b6e69SJohannes Berg  * @pattern: bytes to match where bitmask is 1
3474ff1b6e69SJohannes Berg  * @pattern_len: length of pattern (in bytes)
3475bb92d199SAmitkumar Karwar  * @pkt_offset: packet offset (in bytes)
3476ff1b6e69SJohannes Berg  *
3477ff1b6e69SJohannes Berg  * Internal note: @mask and @pattern are allocated in one chunk of
3478ff1b6e69SJohannes Berg  * memory, free @mask only!
3479ff1b6e69SJohannes Berg  */
348050ac6607SAmitkumar Karwar struct cfg80211_pkt_pattern {
3481922bd80fSJohannes Berg 	const u8 *mask, *pattern;
3482ff1b6e69SJohannes Berg 	int pattern_len;
3483bb92d199SAmitkumar Karwar 	int pkt_offset;
3484ff1b6e69SJohannes Berg };
3485ff1b6e69SJohannes Berg 
3486ff1b6e69SJohannes Berg /**
34872a0e047eSJohannes Berg  * struct cfg80211_wowlan_tcp - TCP connection parameters
34882a0e047eSJohannes Berg  *
34892a0e047eSJohannes Berg  * @sock: (internal) socket for source port allocation
34902a0e047eSJohannes Berg  * @src: source IP address
34912a0e047eSJohannes Berg  * @dst: destination IP address
34922a0e047eSJohannes Berg  * @dst_mac: destination MAC address
34932a0e047eSJohannes Berg  * @src_port: source port
34942a0e047eSJohannes Berg  * @dst_port: destination port
34952a0e047eSJohannes Berg  * @payload_len: data payload length
34962a0e047eSJohannes Berg  * @payload: data payload buffer
34972a0e047eSJohannes Berg  * @payload_seq: payload sequence stamping configuration
34982a0e047eSJohannes Berg  * @data_interval: interval at which to send data packets
34992a0e047eSJohannes Berg  * @wake_len: wakeup payload match length
35002a0e047eSJohannes Berg  * @wake_data: wakeup payload match data
35012a0e047eSJohannes Berg  * @wake_mask: wakeup payload match mask
35022a0e047eSJohannes Berg  * @tokens_size: length of the tokens buffer
35032a0e047eSJohannes Berg  * @payload_tok: payload token usage configuration
35042a0e047eSJohannes Berg  */
35052a0e047eSJohannes Berg struct cfg80211_wowlan_tcp {
35062a0e047eSJohannes Berg 	struct socket *sock;
35072a0e047eSJohannes Berg 	__be32 src, dst;
35082a0e047eSJohannes Berg 	u16 src_port, dst_port;
35092a0e047eSJohannes Berg 	u8 dst_mac[ETH_ALEN];
35102a0e047eSJohannes Berg 	int payload_len;
35112a0e047eSJohannes Berg 	const u8 *payload;
35122a0e047eSJohannes Berg 	struct nl80211_wowlan_tcp_data_seq payload_seq;
35132a0e047eSJohannes Berg 	u32 data_interval;
35142a0e047eSJohannes Berg 	u32 wake_len;
35152a0e047eSJohannes Berg 	const u8 *wake_data, *wake_mask;
35162a0e047eSJohannes Berg 	u32 tokens_size;
35172a0e047eSJohannes Berg 	/* must be last, variable member */
35182a0e047eSJohannes Berg 	struct nl80211_wowlan_tcp_data_token payload_tok;
3519ff1b6e69SJohannes Berg };
3520ff1b6e69SJohannes Berg 
3521ff1b6e69SJohannes Berg /**
3522ff1b6e69SJohannes Berg  * struct cfg80211_wowlan - Wake on Wireless-LAN support info
3523ff1b6e69SJohannes Berg  *
3524ff1b6e69SJohannes Berg  * This structure defines the enabled WoWLAN triggers for the device.
3525ff1b6e69SJohannes Berg  * @any: wake up on any activity -- special trigger if device continues
3526ff1b6e69SJohannes Berg  *	operating as normal during suspend
3527ff1b6e69SJohannes Berg  * @disconnect: wake up if getting disconnected
3528ff1b6e69SJohannes Berg  * @magic_pkt: wake up on receiving magic packet
3529ff1b6e69SJohannes Berg  * @patterns: wake up on receiving packet matching a pattern
3530ff1b6e69SJohannes Berg  * @n_patterns: number of patterns
353177dbbb13SJohannes Berg  * @gtk_rekey_failure: wake up on GTK rekey failure
353277dbbb13SJohannes Berg  * @eap_identity_req: wake up on EAP identity request packet
353377dbbb13SJohannes Berg  * @four_way_handshake: wake up on 4-way handshake
353477dbbb13SJohannes Berg  * @rfkill_release: wake up when rfkill is released
35352a0e047eSJohannes Berg  * @tcp: TCP connection establishment/wakeup parameters, see nl80211.h.
35362a0e047eSJohannes Berg  *	NULL if not configured.
35378cd4d456SLuciano Coelho  * @nd_config: configuration for the scan to be used for net detect wake.
3538ff1b6e69SJohannes Berg  */
3539ff1b6e69SJohannes Berg struct cfg80211_wowlan {
354077dbbb13SJohannes Berg 	bool any, disconnect, magic_pkt, gtk_rekey_failure,
354177dbbb13SJohannes Berg 	     eap_identity_req, four_way_handshake,
354277dbbb13SJohannes Berg 	     rfkill_release;
354350ac6607SAmitkumar Karwar 	struct cfg80211_pkt_pattern *patterns;
35442a0e047eSJohannes Berg 	struct cfg80211_wowlan_tcp *tcp;
3545ff1b6e69SJohannes Berg 	int n_patterns;
35468cd4d456SLuciano Coelho 	struct cfg80211_sched_scan_request *nd_config;
3547ff1b6e69SJohannes Berg };
3548ff1b6e69SJohannes Berg 
3549ff1b6e69SJohannes Berg /**
3550be29b99aSAmitkumar Karwar  * struct cfg80211_coalesce_rules - Coalesce rule parameters
3551be29b99aSAmitkumar Karwar  *
3552be29b99aSAmitkumar Karwar  * This structure defines coalesce rule for the device.
3553be29b99aSAmitkumar Karwar  * @delay: maximum coalescing delay in msecs.
3554be29b99aSAmitkumar Karwar  * @condition: condition for packet coalescence.
3555be29b99aSAmitkumar Karwar  *	see &enum nl80211_coalesce_condition.
3556be29b99aSAmitkumar Karwar  * @patterns: array of packet patterns
3557be29b99aSAmitkumar Karwar  * @n_patterns: number of patterns
3558be29b99aSAmitkumar Karwar  */
3559be29b99aSAmitkumar Karwar struct cfg80211_coalesce_rules {
3560be29b99aSAmitkumar Karwar 	int delay;
3561be29b99aSAmitkumar Karwar 	enum nl80211_coalesce_condition condition;
3562be29b99aSAmitkumar Karwar 	struct cfg80211_pkt_pattern *patterns;
3563be29b99aSAmitkumar Karwar 	int n_patterns;
3564be29b99aSAmitkumar Karwar };
3565be29b99aSAmitkumar Karwar 
3566be29b99aSAmitkumar Karwar /**
3567be29b99aSAmitkumar Karwar  * struct cfg80211_coalesce - Packet coalescing settings
3568be29b99aSAmitkumar Karwar  *
3569be29b99aSAmitkumar Karwar  * This structure defines coalescing settings.
3570be29b99aSAmitkumar Karwar  * @rules: array of coalesce rules
3571be29b99aSAmitkumar Karwar  * @n_rules: number of rules
3572be29b99aSAmitkumar Karwar  */
3573be29b99aSAmitkumar Karwar struct cfg80211_coalesce {
3574be29b99aSAmitkumar Karwar 	int n_rules;
35758526f8c8SJohannes Berg 	struct cfg80211_coalesce_rules rules[] __counted_by(n_rules);
3576be29b99aSAmitkumar Karwar };
3577be29b99aSAmitkumar Karwar 
3578be29b99aSAmitkumar Karwar /**
35798cd4d456SLuciano Coelho  * struct cfg80211_wowlan_nd_match - information about the match
35808cd4d456SLuciano Coelho  *
35818cd4d456SLuciano Coelho  * @ssid: SSID of the match that triggered the wake up
35828cd4d456SLuciano Coelho  * @n_channels: Number of channels where the match occurred.  This
35838cd4d456SLuciano Coelho  *	value may be zero if the driver can't report the channels.
35848cd4d456SLuciano Coelho  * @channels: center frequencies of the channels where a match
35858cd4d456SLuciano Coelho  *	occurred (in MHz)
35868cd4d456SLuciano Coelho  */
35878cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_match {
35888cd4d456SLuciano Coelho 	struct cfg80211_ssid ssid;
35898cd4d456SLuciano Coelho 	int n_channels;
3590aa4ec06cSDmitry Antipov 	u32 channels[] __counted_by(n_channels);
35918cd4d456SLuciano Coelho };
35928cd4d456SLuciano Coelho 
35938cd4d456SLuciano Coelho /**
35948cd4d456SLuciano Coelho  * struct cfg80211_wowlan_nd_info - net detect wake up information
35958cd4d456SLuciano Coelho  *
35968cd4d456SLuciano Coelho  * @n_matches: Number of match information instances provided in
35978cd4d456SLuciano Coelho  *	@matches.  This value may be zero if the driver can't provide
35988cd4d456SLuciano Coelho  *	match information.
35998cd4d456SLuciano Coelho  * @matches: Array of pointers to matches containing information about
36008cd4d456SLuciano Coelho  *	the matches that triggered the wake up.
36018cd4d456SLuciano Coelho  */
36028cd4d456SLuciano Coelho struct cfg80211_wowlan_nd_info {
36038cd4d456SLuciano Coelho 	int n_matches;
3604aa4ec06cSDmitry Antipov 	struct cfg80211_wowlan_nd_match *matches[] __counted_by(n_matches);
36058cd4d456SLuciano Coelho };
36068cd4d456SLuciano Coelho 
36078cd4d456SLuciano Coelho /**
3608cd8f7cb4SJohannes Berg  * struct cfg80211_wowlan_wakeup - wakeup report
3609cd8f7cb4SJohannes Berg  * @disconnect: woke up by getting disconnected
3610cd8f7cb4SJohannes Berg  * @magic_pkt: woke up by receiving magic packet
3611cd8f7cb4SJohannes Berg  * @gtk_rekey_failure: woke up by GTK rekey failure
3612cd8f7cb4SJohannes Berg  * @eap_identity_req: woke up by EAP identity request packet
3613cd8f7cb4SJohannes Berg  * @four_way_handshake: woke up by 4-way handshake
3614cd8f7cb4SJohannes Berg  * @rfkill_release: woke up by rfkill being released
3615cd8f7cb4SJohannes Berg  * @pattern_idx: pattern that caused wakeup, -1 if not due to pattern
3616cd8f7cb4SJohannes Berg  * @packet_present_len: copied wakeup packet data
3617cd8f7cb4SJohannes Berg  * @packet_len: original wakeup packet length
3618cd8f7cb4SJohannes Berg  * @packet: The packet causing the wakeup, if any.
3619cd8f7cb4SJohannes Berg  * @packet_80211:  For pattern match, magic packet and other data
3620cd8f7cb4SJohannes Berg  *	frame triggers an 802.3 frame should be reported, for
3621cd8f7cb4SJohannes Berg  *	disconnect due to deauth 802.11 frame. This indicates which
3622cd8f7cb4SJohannes Berg  *	it is.
36232a0e047eSJohannes Berg  * @tcp_match: TCP wakeup packet received
36242a0e047eSJohannes Berg  * @tcp_connlost: TCP connection lost or failed to establish
36252a0e047eSJohannes Berg  * @tcp_nomoretokens: TCP data ran out of tokens
36268cd4d456SLuciano Coelho  * @net_detect: if not %NULL, woke up because of net detect
3627a64be829SShaul Triebitz  * @unprot_deauth_disassoc: woke up due to unprotected deauth or
3628a64be829SShaul Triebitz  *	disassoc frame (in MFP).
3629cd8f7cb4SJohannes Berg  */
3630cd8f7cb4SJohannes Berg struct cfg80211_wowlan_wakeup {
3631cd8f7cb4SJohannes Berg 	bool disconnect, magic_pkt, gtk_rekey_failure,
3632cd8f7cb4SJohannes Berg 	     eap_identity_req, four_way_handshake,
36332a0e047eSJohannes Berg 	     rfkill_release, packet_80211,
3634a64be829SShaul Triebitz 	     tcp_match, tcp_connlost, tcp_nomoretokens,
3635a64be829SShaul Triebitz 	     unprot_deauth_disassoc;
3636cd8f7cb4SJohannes Berg 	s32 pattern_idx;
3637cd8f7cb4SJohannes Berg 	u32 packet_present_len, packet_len;
3638cd8f7cb4SJohannes Berg 	const void *packet;
36398cd4d456SLuciano Coelho 	struct cfg80211_wowlan_nd_info *net_detect;
3640cd8f7cb4SJohannes Berg };
3641cd8f7cb4SJohannes Berg 
3642cd8f7cb4SJohannes Berg /**
3643e5497d76SJohannes Berg  * struct cfg80211_gtk_rekey_data - rekey data
3644093a48d2SNathan Errera  * @kek: key encryption key (@kek_len bytes)
3645093a48d2SNathan Errera  * @kck: key confirmation key (@kck_len bytes)
364678f686caSJohannes Berg  * @replay_ctr: replay counter (NL80211_REPLAY_CTR_LEN bytes)
3647093a48d2SNathan Errera  * @kek_len: length of kek
36482d8b08feSMauro Carvalho Chehab  * @kck_len: length of kck
3649093a48d2SNathan Errera  * @akm: akm (oui, id)
3650e5497d76SJohannes Berg  */
3651e5497d76SJohannes Berg struct cfg80211_gtk_rekey_data {
365278f686caSJohannes Berg 	const u8 *kek, *kck, *replay_ctr;
3653093a48d2SNathan Errera 	u32 akm;
3654093a48d2SNathan Errera 	u8 kek_len, kck_len;
3655e5497d76SJohannes Berg };
3656e5497d76SJohannes Berg 
3657e5497d76SJohannes Berg /**
3658355199e0SJouni Malinen  * struct cfg80211_update_ft_ies_params - FT IE Information
3659355199e0SJouni Malinen  *
3660355199e0SJouni Malinen  * This structure provides information needed to update the fast transition IE
3661355199e0SJouni Malinen  *
3662355199e0SJouni Malinen  * @md: The Mobility Domain ID, 2 Octet value
3663355199e0SJouni Malinen  * @ie: Fast Transition IEs
3664355199e0SJouni Malinen  * @ie_len: Length of ft_ie in octets
3665355199e0SJouni Malinen  */
3666355199e0SJouni Malinen struct cfg80211_update_ft_ies_params {
3667355199e0SJouni Malinen 	u16 md;
3668355199e0SJouni Malinen 	const u8 *ie;
3669355199e0SJouni Malinen 	size_t ie_len;
3670355199e0SJouni Malinen };
3671355199e0SJouni Malinen 
3672355199e0SJouni Malinen /**
3673b176e629SAndrei Otcheretianski  * struct cfg80211_mgmt_tx_params - mgmt tx parameters
3674b176e629SAndrei Otcheretianski  *
3675b176e629SAndrei Otcheretianski  * This structure provides information needed to transmit a mgmt frame
3676b176e629SAndrei Otcheretianski  *
3677b176e629SAndrei Otcheretianski  * @chan: channel to use
367898e0c7f8SRandy Dunlap  * @offchan: indicates whether off channel operation is required
3679b176e629SAndrei Otcheretianski  * @wait: duration for ROC
3680b176e629SAndrei Otcheretianski  * @buf: buffer to transmit
3681b176e629SAndrei Otcheretianski  * @len: buffer length
3682b176e629SAndrei Otcheretianski  * @no_cck: don't use cck rates for this frame
3683b176e629SAndrei Otcheretianski  * @dont_wait_for_ack: tells the low level not to wait for an ack
368434d22ce2SAndrei Otcheretianski  * @n_csa_offsets: length of csa_offsets array
368534d22ce2SAndrei Otcheretianski  * @csa_offsets: array of all the csa offsets in the frame
368695f498bbSJohannes Berg  * @link_id: for MLO, the link ID to transmit on, -1 if not given; note
368795f498bbSJohannes Berg  *	that the link ID isn't validated (much), it's in range but the
368895f498bbSJohannes Berg  *	link might not exist (or be used by the receiver STA)
3689b176e629SAndrei Otcheretianski  */
3690b176e629SAndrei Otcheretianski struct cfg80211_mgmt_tx_params {
3691b176e629SAndrei Otcheretianski 	struct ieee80211_channel *chan;
3692b176e629SAndrei Otcheretianski 	bool offchan;
3693b176e629SAndrei Otcheretianski 	unsigned int wait;
3694b176e629SAndrei Otcheretianski 	const u8 *buf;
3695b176e629SAndrei Otcheretianski 	size_t len;
3696b176e629SAndrei Otcheretianski 	bool no_cck;
3697b176e629SAndrei Otcheretianski 	bool dont_wait_for_ack;
369834d22ce2SAndrei Otcheretianski 	int n_csa_offsets;
369934d22ce2SAndrei Otcheretianski 	const u16 *csa_offsets;
370095f498bbSJohannes Berg 	int link_id;
3701b176e629SAndrei Otcheretianski };
3702b176e629SAndrei Otcheretianski 
3703b176e629SAndrei Otcheretianski /**
3704fa9ffc74SKyeyoon Park  * struct cfg80211_dscp_exception - DSCP exception
3705fa9ffc74SKyeyoon Park  *
3706fa9ffc74SKyeyoon Park  * @dscp: DSCP value that does not adhere to the user priority range definition
3707fa9ffc74SKyeyoon Park  * @up: user priority value to which the corresponding DSCP value belongs
3708fa9ffc74SKyeyoon Park  */
3709fa9ffc74SKyeyoon Park struct cfg80211_dscp_exception {
3710fa9ffc74SKyeyoon Park 	u8 dscp;
3711fa9ffc74SKyeyoon Park 	u8 up;
3712fa9ffc74SKyeyoon Park };
3713fa9ffc74SKyeyoon Park 
3714fa9ffc74SKyeyoon Park /**
3715fa9ffc74SKyeyoon Park  * struct cfg80211_dscp_range - DSCP range definition for user priority
3716fa9ffc74SKyeyoon Park  *
3717fa9ffc74SKyeyoon Park  * @low: lowest DSCP value of this user priority range, inclusive
3718fa9ffc74SKyeyoon Park  * @high: highest DSCP value of this user priority range, inclusive
3719fa9ffc74SKyeyoon Park  */
3720fa9ffc74SKyeyoon Park struct cfg80211_dscp_range {
3721fa9ffc74SKyeyoon Park 	u8 low;
3722fa9ffc74SKyeyoon Park 	u8 high;
3723fa9ffc74SKyeyoon Park };
3724fa9ffc74SKyeyoon Park 
3725fa9ffc74SKyeyoon Park /* QoS Map Set element length defined in IEEE Std 802.11-2012, 8.4.2.97 */
3726fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_MAX_EX	21
3727fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_LEN_MIN	16
3728fa9ffc74SKyeyoon Park #define IEEE80211_QOS_MAP_LEN_MAX \
3729fa9ffc74SKyeyoon Park 	(IEEE80211_QOS_MAP_LEN_MIN + 2 * IEEE80211_QOS_MAP_MAX_EX)
3730fa9ffc74SKyeyoon Park 
3731fa9ffc74SKyeyoon Park /**
3732fa9ffc74SKyeyoon Park  * struct cfg80211_qos_map - QoS Map Information
3733fa9ffc74SKyeyoon Park  *
3734fa9ffc74SKyeyoon Park  * This struct defines the Interworking QoS map setting for DSCP values
3735fa9ffc74SKyeyoon Park  *
3736fa9ffc74SKyeyoon Park  * @num_des: number of DSCP exceptions (0..21)
3737fa9ffc74SKyeyoon Park  * @dscp_exception: optionally up to maximum of 21 DSCP exceptions from
3738fa9ffc74SKyeyoon Park  *	the user priority DSCP range definition
3739fa9ffc74SKyeyoon Park  * @up: DSCP range definition for a particular user priority
3740fa9ffc74SKyeyoon Park  */
3741fa9ffc74SKyeyoon Park struct cfg80211_qos_map {
3742fa9ffc74SKyeyoon Park 	u8 num_des;
3743fa9ffc74SKyeyoon Park 	struct cfg80211_dscp_exception dscp_exception[IEEE80211_QOS_MAP_MAX_EX];
3744fa9ffc74SKyeyoon Park 	struct cfg80211_dscp_range up[8];
3745fa9ffc74SKyeyoon Park };
3746fa9ffc74SKyeyoon Park 
3747fa9ffc74SKyeyoon Park /**
3748cb3b7d87SAyala Beker  * struct cfg80211_nan_conf - NAN configuration
3749cb3b7d87SAyala Beker  *
3750cb3b7d87SAyala Beker  * This struct defines NAN configuration parameters
3751cb3b7d87SAyala Beker  *
3752cb3b7d87SAyala Beker  * @master_pref: master preference (1 - 255)
37538585989dSLuca Coelho  * @bands: operating bands, a bitmap of &enum nl80211_band values.
37548585989dSLuca Coelho  *	For instance, for NL80211_BAND_2GHZ, bit 0 would be set
37558585989dSLuca Coelho  *	(i.e. BIT(NL80211_BAND_2GHZ)).
3756cb3b7d87SAyala Beker  */
3757cb3b7d87SAyala Beker struct cfg80211_nan_conf {
3758cb3b7d87SAyala Beker 	u8 master_pref;
37598585989dSLuca Coelho 	u8 bands;
3760cb3b7d87SAyala Beker };
3761cb3b7d87SAyala Beker 
3762cb3b7d87SAyala Beker /**
3763a5a9dcf2SAyala Beker  * enum cfg80211_nan_conf_changes - indicates changed fields in NAN
3764a5a9dcf2SAyala Beker  * configuration
3765a5a9dcf2SAyala Beker  *
3766a5a9dcf2SAyala Beker  * @CFG80211_NAN_CONF_CHANGED_PREF: master preference
37678585989dSLuca Coelho  * @CFG80211_NAN_CONF_CHANGED_BANDS: operating bands
3768a5a9dcf2SAyala Beker  */
3769a5a9dcf2SAyala Beker enum cfg80211_nan_conf_changes {
3770a5a9dcf2SAyala Beker 	CFG80211_NAN_CONF_CHANGED_PREF = BIT(0),
37718585989dSLuca Coelho 	CFG80211_NAN_CONF_CHANGED_BANDS = BIT(1),
3772a5a9dcf2SAyala Beker };
3773a5a9dcf2SAyala Beker 
3774a5a9dcf2SAyala Beker /**
3775a442b761SAyala Beker  * struct cfg80211_nan_func_filter - a NAN function Rx / Tx filter
3776a442b761SAyala Beker  *
3777a442b761SAyala Beker  * @filter: the content of the filter
3778a442b761SAyala Beker  * @len: the length of the filter
3779a442b761SAyala Beker  */
3780a442b761SAyala Beker struct cfg80211_nan_func_filter {
3781a442b761SAyala Beker 	const u8 *filter;
3782a442b761SAyala Beker 	u8 len;
3783a442b761SAyala Beker };
3784a442b761SAyala Beker 
3785a442b761SAyala Beker /**
3786a442b761SAyala Beker  * struct cfg80211_nan_func - a NAN function
3787a442b761SAyala Beker  *
3788a442b761SAyala Beker  * @type: &enum nl80211_nan_function_type
3789a442b761SAyala Beker  * @service_id: the service ID of the function
3790a442b761SAyala Beker  * @publish_type: &nl80211_nan_publish_type
3791a442b761SAyala Beker  * @close_range: if true, the range should be limited. Threshold is
3792a442b761SAyala Beker  *	implementation specific.
3793a442b761SAyala Beker  * @publish_bcast: if true, the solicited publish should be broadcasted
3794a442b761SAyala Beker  * @subscribe_active: if true, the subscribe is active
3795a442b761SAyala Beker  * @followup_id: the instance ID for follow up
379698e0c7f8SRandy Dunlap  * @followup_reqid: the requester instance ID for follow up
3797a442b761SAyala Beker  * @followup_dest: MAC address of the recipient of the follow up
3798a442b761SAyala Beker  * @ttl: time to live counter in DW.
3799a442b761SAyala Beker  * @serv_spec_info: Service Specific Info
3800a442b761SAyala Beker  * @serv_spec_info_len: Service Specific Info length
3801a442b761SAyala Beker  * @srf_include: if true, SRF is inclusive
3802a442b761SAyala Beker  * @srf_bf: Bloom Filter
3803a442b761SAyala Beker  * @srf_bf_len: Bloom Filter length
3804a442b761SAyala Beker  * @srf_bf_idx: Bloom Filter index
3805a442b761SAyala Beker  * @srf_macs: SRF MAC addresses
3806a442b761SAyala Beker  * @srf_num_macs: number of MAC addresses in SRF
3807a442b761SAyala Beker  * @rx_filters: rx filters that are matched with corresponding peer's tx_filter
3808a442b761SAyala Beker  * @tx_filters: filters that should be transmitted in the SDF.
3809a442b761SAyala Beker  * @num_rx_filters: length of &rx_filters.
3810a442b761SAyala Beker  * @num_tx_filters: length of &tx_filters.
3811a442b761SAyala Beker  * @instance_id: driver allocated id of the function.
3812a442b761SAyala Beker  * @cookie: unique NAN function identifier.
3813a442b761SAyala Beker  */
3814a442b761SAyala Beker struct cfg80211_nan_func {
3815a442b761SAyala Beker 	enum nl80211_nan_function_type type;
3816a442b761SAyala Beker 	u8 service_id[NL80211_NAN_FUNC_SERVICE_ID_LEN];
3817a442b761SAyala Beker 	u8 publish_type;
3818a442b761SAyala Beker 	bool close_range;
3819a442b761SAyala Beker 	bool publish_bcast;
3820a442b761SAyala Beker 	bool subscribe_active;
3821a442b761SAyala Beker 	u8 followup_id;
3822a442b761SAyala Beker 	u8 followup_reqid;
3823a442b761SAyala Beker 	struct mac_address followup_dest;
3824a442b761SAyala Beker 	u32 ttl;
3825a442b761SAyala Beker 	const u8 *serv_spec_info;
3826a442b761SAyala Beker 	u8 serv_spec_info_len;
3827a442b761SAyala Beker 	bool srf_include;
3828a442b761SAyala Beker 	const u8 *srf_bf;
3829a442b761SAyala Beker 	u8 srf_bf_len;
3830a442b761SAyala Beker 	u8 srf_bf_idx;
3831a442b761SAyala Beker 	struct mac_address *srf_macs;
3832a442b761SAyala Beker 	int srf_num_macs;
3833a442b761SAyala Beker 	struct cfg80211_nan_func_filter *rx_filters;
3834a442b761SAyala Beker 	struct cfg80211_nan_func_filter *tx_filters;
3835a442b761SAyala Beker 	u8 num_tx_filters;
3836a442b761SAyala Beker 	u8 num_rx_filters;
3837a442b761SAyala Beker 	u8 instance_id;
3838a442b761SAyala Beker 	u64 cookie;
3839a442b761SAyala Beker };
3840a442b761SAyala Beker 
3841a442b761SAyala Beker /**
38423a00df57SAvraham Stern  * struct cfg80211_pmk_conf - PMK configuration
38433a00df57SAvraham Stern  *
38443a00df57SAvraham Stern  * @aa: authenticator address
38453a00df57SAvraham Stern  * @pmk_len: PMK length in bytes.
38463a00df57SAvraham Stern  * @pmk: the PMK material
38473a00df57SAvraham Stern  * @pmk_r0_name: PMK-R0 Name. NULL if not applicable (i.e., the PMK
38483a00df57SAvraham Stern  *	is not PMK-R0). When pmk_r0_name is not NULL, the pmk field
38493a00df57SAvraham Stern  *	holds PMK-R0.
38503a00df57SAvraham Stern  */
38513a00df57SAvraham Stern struct cfg80211_pmk_conf {
38523a00df57SAvraham Stern 	const u8 *aa;
38533a00df57SAvraham Stern 	u8 pmk_len;
38543a00df57SAvraham Stern 	const u8 *pmk;
38553a00df57SAvraham Stern 	const u8 *pmk_r0_name;
38563a00df57SAvraham Stern };
38573a00df57SAvraham Stern 
38583a00df57SAvraham Stern /**
385940cbfa90SSrinivas Dasari  * struct cfg80211_external_auth_params - Trigger External authentication.
386040cbfa90SSrinivas Dasari  *
386140cbfa90SSrinivas Dasari  * Commonly used across the external auth request and event interfaces.
386240cbfa90SSrinivas Dasari  *
386340cbfa90SSrinivas Dasari  * @action: action type / trigger for external authentication. Only significant
386440cbfa90SSrinivas Dasari  *	for the authentication request event interface (driver to user space).
386540cbfa90SSrinivas Dasari  * @bssid: BSSID of the peer with which the authentication has
386640cbfa90SSrinivas Dasari  *	to happen. Used by both the authentication request event and
386740cbfa90SSrinivas Dasari  *	authentication response command interface.
386840cbfa90SSrinivas Dasari  * @ssid: SSID of the AP.  Used by both the authentication request event and
386940cbfa90SSrinivas Dasari  *	authentication response command interface.
387040cbfa90SSrinivas Dasari  * @key_mgmt_suite: AKM suite of the respective authentication. Used by the
387140cbfa90SSrinivas Dasari  *	authentication request event interface.
387240cbfa90SSrinivas Dasari  * @status: status code, %WLAN_STATUS_SUCCESS for successful authentication,
387340cbfa90SSrinivas Dasari  *	use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space cannot give you
387440cbfa90SSrinivas Dasari  *	the real status code for failures. Used only for the authentication
387540cbfa90SSrinivas Dasari  *	response command interface (user space to driver).
3876fe494370SSrinivas Dasari  * @pmkid: The identifier to refer a PMKSA.
38779a47c1efSVeerendranath Jakkam  * @mld_addr: MLD address of the peer. Used by the authentication request event
38789a47c1efSVeerendranath Jakkam  *	interface. Driver indicates this to enable MLO during the authentication
38799a47c1efSVeerendranath Jakkam  *	offload to user space. Driver shall look at %NL80211_ATTR_MLO_SUPPORT
38809a47c1efSVeerendranath Jakkam  *	flag capability in NL80211_CMD_CONNECT to know whether the user space
38819a47c1efSVeerendranath Jakkam  *	supports enabling MLO during the authentication offload.
38829a47c1efSVeerendranath Jakkam  *	User space should use the address of the interface (on which the
38839a47c1efSVeerendranath Jakkam  *	authentication request event reported) as self MLD address. User space
38849a47c1efSVeerendranath Jakkam  *	and driver should use MLD addresses in RA, TA and BSSID fields of
38859a47c1efSVeerendranath Jakkam  *	authentication frames sent or received via cfg80211. The driver
38869a47c1efSVeerendranath Jakkam  *	translates the MLD addresses to/from link addresses based on the link
38879a47c1efSVeerendranath Jakkam  *	chosen for the authentication.
388840cbfa90SSrinivas Dasari  */
388940cbfa90SSrinivas Dasari struct cfg80211_external_auth_params {
389040cbfa90SSrinivas Dasari 	enum nl80211_external_auth_action action;
389140cbfa90SSrinivas Dasari 	u8 bssid[ETH_ALEN] __aligned(2);
389240cbfa90SSrinivas Dasari 	struct cfg80211_ssid ssid;
389340cbfa90SSrinivas Dasari 	unsigned int key_mgmt_suite;
389440cbfa90SSrinivas Dasari 	u16 status;
3895fe494370SSrinivas Dasari 	const u8 *pmkid;
38969a47c1efSVeerendranath Jakkam 	u8 mld_addr[ETH_ALEN] __aligned(2);
389740cbfa90SSrinivas Dasari };
389840cbfa90SSrinivas Dasari 
389940cbfa90SSrinivas Dasari /**
39003453de98SRandy Dunlap  * struct cfg80211_ftm_responder_stats - FTM responder statistics
390181e54d08SPradeep Kumar Chitrapu  *
390281e54d08SPradeep Kumar Chitrapu  * @filled: bitflag of flags using the bits of &enum nl80211_ftm_stats to
390381e54d08SPradeep Kumar Chitrapu  *	indicate the relevant values in this struct for them
390481e54d08SPradeep Kumar Chitrapu  * @success_num: number of FTM sessions in which all frames were successfully
390581e54d08SPradeep Kumar Chitrapu  *	answered
390681e54d08SPradeep Kumar Chitrapu  * @partial_num: number of FTM sessions in which part of frames were
390781e54d08SPradeep Kumar Chitrapu  *	successfully answered
390881e54d08SPradeep Kumar Chitrapu  * @failed_num: number of failed FTM sessions
390981e54d08SPradeep Kumar Chitrapu  * @asap_num: number of ASAP FTM sessions
391081e54d08SPradeep Kumar Chitrapu  * @non_asap_num: number of  non-ASAP FTM sessions
391181e54d08SPradeep Kumar Chitrapu  * @total_duration_ms: total sessions durations - gives an indication
391281e54d08SPradeep Kumar Chitrapu  *	of how much time the responder was busy
391381e54d08SPradeep Kumar Chitrapu  * @unknown_triggers_num: number of unknown FTM triggers - triggers from
391481e54d08SPradeep Kumar Chitrapu  *	initiators that didn't finish successfully the negotiation phase with
391581e54d08SPradeep Kumar Chitrapu  *	the responder
391681e54d08SPradeep Kumar Chitrapu  * @reschedule_requests_num: number of FTM reschedule requests - initiator asks
391781e54d08SPradeep Kumar Chitrapu  *	for a new scheduling although it already has scheduled FTM slot
391881e54d08SPradeep Kumar Chitrapu  * @out_of_window_triggers_num: total FTM triggers out of scheduled window
391981e54d08SPradeep Kumar Chitrapu  */
392081e54d08SPradeep Kumar Chitrapu struct cfg80211_ftm_responder_stats {
392181e54d08SPradeep Kumar Chitrapu 	u32 filled;
392281e54d08SPradeep Kumar Chitrapu 	u32 success_num;
392381e54d08SPradeep Kumar Chitrapu 	u32 partial_num;
392481e54d08SPradeep Kumar Chitrapu 	u32 failed_num;
392581e54d08SPradeep Kumar Chitrapu 	u32 asap_num;
392681e54d08SPradeep Kumar Chitrapu 	u32 non_asap_num;
392781e54d08SPradeep Kumar Chitrapu 	u64 total_duration_ms;
392881e54d08SPradeep Kumar Chitrapu 	u32 unknown_triggers_num;
392981e54d08SPradeep Kumar Chitrapu 	u32 reschedule_requests_num;
393081e54d08SPradeep Kumar Chitrapu 	u32 out_of_window_triggers_num;
393181e54d08SPradeep Kumar Chitrapu };
393281e54d08SPradeep Kumar Chitrapu 
393381e54d08SPradeep Kumar Chitrapu /**
39349bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_ftm_result - FTM result
39359bb7e0f2SJohannes Berg  * @failure_reason: if this measurement failed (PMSR status is
39369bb7e0f2SJohannes Berg  *	%NL80211_PMSR_STATUS_FAILURE), this gives a more precise
39379bb7e0f2SJohannes Berg  *	reason than just "failure"
39389bb7e0f2SJohannes Berg  * @burst_index: if reporting partial results, this is the index
39399bb7e0f2SJohannes Berg  *	in [0 .. num_bursts-1] of the burst that's being reported
39409bb7e0f2SJohannes Berg  * @num_ftmr_attempts: number of FTM request frames transmitted
39419bb7e0f2SJohannes Berg  * @num_ftmr_successes: number of FTM request frames acked
39429bb7e0f2SJohannes Berg  * @busy_retry_time: if failure_reason is %NL80211_PMSR_FTM_FAILURE_PEER_BUSY,
39439bb7e0f2SJohannes Berg  *	fill this to indicate in how many seconds a retry is deemed possible
39449bb7e0f2SJohannes Berg  *	by the responder
39459bb7e0f2SJohannes Berg  * @num_bursts_exp: actual number of bursts exponent negotiated
39469bb7e0f2SJohannes Berg  * @burst_duration: actual burst duration negotiated
39479bb7e0f2SJohannes Berg  * @ftms_per_burst: actual FTMs per burst negotiated
39489bb7e0f2SJohannes Berg  * @lci_len: length of LCI information (if present)
39499bb7e0f2SJohannes Berg  * @civicloc_len: length of civic location information (if present)
39509bb7e0f2SJohannes Berg  * @lci: LCI data (may be %NULL)
39519bb7e0f2SJohannes Berg  * @civicloc: civic location data (may be %NULL)
39529bb7e0f2SJohannes Berg  * @rssi_avg: average RSSI over FTM action frames reported
39539bb7e0f2SJohannes Berg  * @rssi_spread: spread of the RSSI over FTM action frames reported
39549bb7e0f2SJohannes Berg  * @tx_rate: bitrate for transmitted FTM action frame response
39559bb7e0f2SJohannes Berg  * @rx_rate: bitrate of received FTM action frame
39569bb7e0f2SJohannes Berg  * @rtt_avg: average of RTTs measured (must have either this or @dist_avg)
39579bb7e0f2SJohannes Berg  * @rtt_variance: variance of RTTs measured (note that standard deviation is
39589bb7e0f2SJohannes Berg  *	the square root of the variance)
39599bb7e0f2SJohannes Berg  * @rtt_spread: spread of the RTTs measured
39609bb7e0f2SJohannes Berg  * @dist_avg: average of distances (mm) measured
39619bb7e0f2SJohannes Berg  *	(must have either this or @rtt_avg)
39629bb7e0f2SJohannes Berg  * @dist_variance: variance of distances measured (see also @rtt_variance)
39639bb7e0f2SJohannes Berg  * @dist_spread: spread of distances measured (see also @rtt_spread)
39649bb7e0f2SJohannes Berg  * @num_ftmr_attempts_valid: @num_ftmr_attempts is valid
39659bb7e0f2SJohannes Berg  * @num_ftmr_successes_valid: @num_ftmr_successes is valid
39669bb7e0f2SJohannes Berg  * @rssi_avg_valid: @rssi_avg is valid
39679bb7e0f2SJohannes Berg  * @rssi_spread_valid: @rssi_spread is valid
39689bb7e0f2SJohannes Berg  * @tx_rate_valid: @tx_rate is valid
39699bb7e0f2SJohannes Berg  * @rx_rate_valid: @rx_rate is valid
39709bb7e0f2SJohannes Berg  * @rtt_avg_valid: @rtt_avg is valid
39719bb7e0f2SJohannes Berg  * @rtt_variance_valid: @rtt_variance is valid
39729bb7e0f2SJohannes Berg  * @rtt_spread_valid: @rtt_spread is valid
39739bb7e0f2SJohannes Berg  * @dist_avg_valid: @dist_avg is valid
39749bb7e0f2SJohannes Berg  * @dist_variance_valid: @dist_variance is valid
39759bb7e0f2SJohannes Berg  * @dist_spread_valid: @dist_spread is valid
39769bb7e0f2SJohannes Berg  */
39779bb7e0f2SJohannes Berg struct cfg80211_pmsr_ftm_result {
39789bb7e0f2SJohannes Berg 	const u8 *lci;
39799bb7e0f2SJohannes Berg 	const u8 *civicloc;
39809bb7e0f2SJohannes Berg 	unsigned int lci_len;
39819bb7e0f2SJohannes Berg 	unsigned int civicloc_len;
39829bb7e0f2SJohannes Berg 	enum nl80211_peer_measurement_ftm_failure_reasons failure_reason;
39839bb7e0f2SJohannes Berg 	u32 num_ftmr_attempts, num_ftmr_successes;
39849bb7e0f2SJohannes Berg 	s16 burst_index;
39859bb7e0f2SJohannes Berg 	u8 busy_retry_time;
39869bb7e0f2SJohannes Berg 	u8 num_bursts_exp;
39879bb7e0f2SJohannes Berg 	u8 burst_duration;
39889bb7e0f2SJohannes Berg 	u8 ftms_per_burst;
39899bb7e0f2SJohannes Berg 	s32 rssi_avg;
39909bb7e0f2SJohannes Berg 	s32 rssi_spread;
39919bb7e0f2SJohannes Berg 	struct rate_info tx_rate, rx_rate;
39929bb7e0f2SJohannes Berg 	s64 rtt_avg;
39939bb7e0f2SJohannes Berg 	s64 rtt_variance;
39949bb7e0f2SJohannes Berg 	s64 rtt_spread;
39959bb7e0f2SJohannes Berg 	s64 dist_avg;
39969bb7e0f2SJohannes Berg 	s64 dist_variance;
39979bb7e0f2SJohannes Berg 	s64 dist_spread;
39989bb7e0f2SJohannes Berg 
39999bb7e0f2SJohannes Berg 	u16 num_ftmr_attempts_valid:1,
40009bb7e0f2SJohannes Berg 	    num_ftmr_successes_valid:1,
40019bb7e0f2SJohannes Berg 	    rssi_avg_valid:1,
40029bb7e0f2SJohannes Berg 	    rssi_spread_valid:1,
40039bb7e0f2SJohannes Berg 	    tx_rate_valid:1,
40049bb7e0f2SJohannes Berg 	    rx_rate_valid:1,
40059bb7e0f2SJohannes Berg 	    rtt_avg_valid:1,
40069bb7e0f2SJohannes Berg 	    rtt_variance_valid:1,
40079bb7e0f2SJohannes Berg 	    rtt_spread_valid:1,
40089bb7e0f2SJohannes Berg 	    dist_avg_valid:1,
40099bb7e0f2SJohannes Berg 	    dist_variance_valid:1,
40109bb7e0f2SJohannes Berg 	    dist_spread_valid:1;
40119bb7e0f2SJohannes Berg };
40129bb7e0f2SJohannes Berg 
40139bb7e0f2SJohannes Berg /**
40149bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_result - peer measurement result
40159bb7e0f2SJohannes Berg  * @addr: address of the peer
40169bb7e0f2SJohannes Berg  * @host_time: host time (use ktime_get_boottime() adjust to the time when the
40179bb7e0f2SJohannes Berg  *	measurement was made)
40189bb7e0f2SJohannes Berg  * @ap_tsf: AP's TSF at measurement time
40199bb7e0f2SJohannes Berg  * @status: status of the measurement
40209bb7e0f2SJohannes Berg  * @final: if reporting partial results, mark this as the last one; if not
40219bb7e0f2SJohannes Berg  *	reporting partial results always set this flag
40229bb7e0f2SJohannes Berg  * @ap_tsf_valid: indicates the @ap_tsf value is valid
40239bb7e0f2SJohannes Berg  * @type: type of the measurement reported, note that we only support reporting
40249bb7e0f2SJohannes Berg  *	one type at a time, but you can report multiple results separately and
40259bb7e0f2SJohannes Berg  *	they're all aggregated for userspace.
40262d8b08feSMauro Carvalho Chehab  * @ftm: FTM result
40279bb7e0f2SJohannes Berg  */
40289bb7e0f2SJohannes Berg struct cfg80211_pmsr_result {
40299bb7e0f2SJohannes Berg 	u64 host_time, ap_tsf;
40309bb7e0f2SJohannes Berg 	enum nl80211_peer_measurement_status status;
40319bb7e0f2SJohannes Berg 
40329bb7e0f2SJohannes Berg 	u8 addr[ETH_ALEN];
40339bb7e0f2SJohannes Berg 
40349bb7e0f2SJohannes Berg 	u8 final:1,
40359bb7e0f2SJohannes Berg 	   ap_tsf_valid:1;
40369bb7e0f2SJohannes Berg 
40379bb7e0f2SJohannes Berg 	enum nl80211_peer_measurement_type type;
40389bb7e0f2SJohannes Berg 
40399bb7e0f2SJohannes Berg 	union {
40409bb7e0f2SJohannes Berg 		struct cfg80211_pmsr_ftm_result ftm;
40419bb7e0f2SJohannes Berg 	};
40429bb7e0f2SJohannes Berg };
40439bb7e0f2SJohannes Berg 
40449bb7e0f2SJohannes Berg /**
40459bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_ftm_request_peer - FTM request data
40469bb7e0f2SJohannes Berg  * @requested: indicates FTM is requested
40479bb7e0f2SJohannes Berg  * @preamble: frame preamble to use
40489bb7e0f2SJohannes Berg  * @burst_period: burst period to use
40499bb7e0f2SJohannes Berg  * @asap: indicates to use ASAP mode
40509bb7e0f2SJohannes Berg  * @num_bursts_exp: number of bursts exponent
40519bb7e0f2SJohannes Berg  * @burst_duration: burst duration
40529bb7e0f2SJohannes Berg  * @ftms_per_burst: number of FTMs per burst
40539bb7e0f2SJohannes Berg  * @ftmr_retries: number of retries for FTM request
40549bb7e0f2SJohannes Berg  * @request_lci: request LCI information
40559bb7e0f2SJohannes Berg  * @request_civicloc: request civic location information
4056efb5520dSAvraham Stern  * @trigger_based: use trigger based ranging for the measurement
4057efb5520dSAvraham Stern  *		 If neither @trigger_based nor @non_trigger_based is set,
4058efb5520dSAvraham Stern  *		 EDCA based ranging will be used.
4059efb5520dSAvraham Stern  * @non_trigger_based: use non trigger based ranging for the measurement
4060efb5520dSAvraham Stern  *		 If neither @trigger_based nor @non_trigger_based is set,
4061efb5520dSAvraham Stern  *		 EDCA based ranging will be used.
406273807523SAvraham Stern  * @lmr_feedback: negotiate for I2R LMR feedback. Only valid if either
406373807523SAvraham Stern  *		 @trigger_based or @non_trigger_based is set.
4064dd3e4fc7SAvraham Stern  * @bss_color: the bss color of the responder. Optional. Set to zero to
4065dd3e4fc7SAvraham Stern  *	indicate the driver should set the BSS color. Only valid if
4066dd3e4fc7SAvraham Stern  *	@non_trigger_based or @trigger_based is set.
40679bb7e0f2SJohannes Berg  *
40689bb7e0f2SJohannes Berg  * See also nl80211 for the respective attribute documentation.
40699bb7e0f2SJohannes Berg  */
40709bb7e0f2SJohannes Berg struct cfg80211_pmsr_ftm_request_peer {
40719bb7e0f2SJohannes Berg 	enum nl80211_preamble preamble;
40729bb7e0f2SJohannes Berg 	u16 burst_period;
40739bb7e0f2SJohannes Berg 	u8 requested:1,
40749bb7e0f2SJohannes Berg 	   asap:1,
40759bb7e0f2SJohannes Berg 	   request_lci:1,
4076efb5520dSAvraham Stern 	   request_civicloc:1,
4077efb5520dSAvraham Stern 	   trigger_based:1,
407873807523SAvraham Stern 	   non_trigger_based:1,
407973807523SAvraham Stern 	   lmr_feedback:1;
40809bb7e0f2SJohannes Berg 	u8 num_bursts_exp;
40819bb7e0f2SJohannes Berg 	u8 burst_duration;
40829bb7e0f2SJohannes Berg 	u8 ftms_per_burst;
40839bb7e0f2SJohannes Berg 	u8 ftmr_retries;
4084dd3e4fc7SAvraham Stern 	u8 bss_color;
40859bb7e0f2SJohannes Berg };
40869bb7e0f2SJohannes Berg 
40879bb7e0f2SJohannes Berg /**
40889bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_request_peer - peer data for a peer measurement request
40899bb7e0f2SJohannes Berg  * @addr: MAC address
40909bb7e0f2SJohannes Berg  * @chandef: channel to use
40919bb7e0f2SJohannes Berg  * @report_ap_tsf: report the associated AP's TSF
40929bb7e0f2SJohannes Berg  * @ftm: FTM data, see &struct cfg80211_pmsr_ftm_request_peer
40939bb7e0f2SJohannes Berg  */
40949bb7e0f2SJohannes Berg struct cfg80211_pmsr_request_peer {
40959bb7e0f2SJohannes Berg 	u8 addr[ETH_ALEN];
40969bb7e0f2SJohannes Berg 	struct cfg80211_chan_def chandef;
40979bb7e0f2SJohannes Berg 	u8 report_ap_tsf:1;
40989bb7e0f2SJohannes Berg 	struct cfg80211_pmsr_ftm_request_peer ftm;
40999bb7e0f2SJohannes Berg };
41009bb7e0f2SJohannes Berg 
41019bb7e0f2SJohannes Berg /**
41029bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_request - peer measurement request
41039bb7e0f2SJohannes Berg  * @cookie: cookie, set by cfg80211
41049bb7e0f2SJohannes Berg  * @nl_portid: netlink portid - used by cfg80211
41059bb7e0f2SJohannes Berg  * @drv_data: driver data for this request, if required for aborting,
41069bb7e0f2SJohannes Berg  *	not otherwise freed or anything by cfg80211
41079bb7e0f2SJohannes Berg  * @mac_addr: MAC address used for (randomised) request
41089bb7e0f2SJohannes Berg  * @mac_addr_mask: MAC address mask used for randomisation, bits that
41099bb7e0f2SJohannes Berg  *	are 0 in the mask should be randomised, bits that are 1 should
41109bb7e0f2SJohannes Berg  *	be taken from the @mac_addr
41119bb7e0f2SJohannes Berg  * @list: used by cfg80211 to hold on to the request
41129bb7e0f2SJohannes Berg  * @timeout: timeout (in milliseconds) for the whole operation, if
41139bb7e0f2SJohannes Berg  *	zero it means there's no timeout
41149bb7e0f2SJohannes Berg  * @n_peers: number of peers to do measurements with
41159bb7e0f2SJohannes Berg  * @peers: per-peer measurement request data
41169bb7e0f2SJohannes Berg  */
41179bb7e0f2SJohannes Berg struct cfg80211_pmsr_request {
41189bb7e0f2SJohannes Berg 	u64 cookie;
41199bb7e0f2SJohannes Berg 	void *drv_data;
41209bb7e0f2SJohannes Berg 	u32 n_peers;
41219bb7e0f2SJohannes Berg 	u32 nl_portid;
41229bb7e0f2SJohannes Berg 
41239bb7e0f2SJohannes Berg 	u32 timeout;
41249bb7e0f2SJohannes Berg 
41259bb7e0f2SJohannes Berg 	u8 mac_addr[ETH_ALEN] __aligned(2);
41269bb7e0f2SJohannes Berg 	u8 mac_addr_mask[ETH_ALEN] __aligned(2);
41279bb7e0f2SJohannes Berg 
41289bb7e0f2SJohannes Berg 	struct list_head list;
41299bb7e0f2SJohannes Berg 
4130342bc7c9SKees Cook 	struct cfg80211_pmsr_request_peer peers[] __counted_by(n_peers);
41319bb7e0f2SJohannes Berg };
41329bb7e0f2SJohannes Berg 
41339bb7e0f2SJohannes Berg /**
4134cb74e977SSunil Dutt  * struct cfg80211_update_owe_info - OWE Information
4135cb74e977SSunil Dutt  *
4136cb74e977SSunil Dutt  * This structure provides information needed for the drivers to offload OWE
4137cb74e977SSunil Dutt  * (Opportunistic Wireless Encryption) processing to the user space.
4138cb74e977SSunil Dutt  *
4139cb74e977SSunil Dutt  * Commonly used across update_owe_info request and event interfaces.
4140cb74e977SSunil Dutt  *
4141cb74e977SSunil Dutt  * @peer: MAC address of the peer device for which the OWE processing
4142cb74e977SSunil Dutt  *	has to be done.
4143cb74e977SSunil Dutt  * @status: status code, %WLAN_STATUS_SUCCESS for successful OWE info
4144cb74e977SSunil Dutt  *	processing, use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space
4145cb74e977SSunil Dutt  *	cannot give you the real status code for failures. Used only for
4146cb74e977SSunil Dutt  *	OWE update request command interface (user space to driver).
4147cb74e977SSunil Dutt  * @ie: IEs obtained from the peer or constructed by the user space. These are
4148cb74e977SSunil Dutt  *	the IEs of the remote peer in the event from the host driver and
4149cb74e977SSunil Dutt  *	the constructed IEs by the user space in the request interface.
4150cb74e977SSunil Dutt  * @ie_len: Length of IEs in octets.
41518bb588d9SVeerendranath Jakkam  * @assoc_link_id: MLO link ID of the AP, with which (re)association requested
41528bb588d9SVeerendranath Jakkam  *	by peer. This will be filled by driver for both MLO and non-MLO station
41538bb588d9SVeerendranath Jakkam  *	connections when the AP affiliated with an MLD. For non-MLD AP mode, it
41548bb588d9SVeerendranath Jakkam  *	will be -1. Used only with OWE update event (driver to user space).
41558bb588d9SVeerendranath Jakkam  * @peer_mld_addr: For MLO connection, MLD address of the peer. For non-MLO
41568bb588d9SVeerendranath Jakkam  *	connection, it will be all zeros. This is applicable only when
41578bb588d9SVeerendranath Jakkam  *	@assoc_link_id is not -1, i.e., the AP affiliated with an MLD. Used only
41588bb588d9SVeerendranath Jakkam  *	with OWE update event (driver to user space).
4159cb74e977SSunil Dutt  */
4160cb74e977SSunil Dutt struct cfg80211_update_owe_info {
4161cb74e977SSunil Dutt 	u8 peer[ETH_ALEN] __aligned(2);
4162cb74e977SSunil Dutt 	u16 status;
4163cb74e977SSunil Dutt 	const u8 *ie;
4164cb74e977SSunil Dutt 	size_t ie_len;
41658bb588d9SVeerendranath Jakkam 	int assoc_link_id;
41668bb588d9SVeerendranath Jakkam 	u8 peer_mld_addr[ETH_ALEN] __aligned(2);
4167cb74e977SSunil Dutt };
4168cb74e977SSunil Dutt 
4169cb74e977SSunil Dutt /**
41706cd536feSJohannes Berg  * struct mgmt_frame_regs - management frame registrations data
41716cd536feSJohannes Berg  * @global_stypes: bitmap of management frame subtypes registered
41726cd536feSJohannes Berg  *	for the entire device
41736cd536feSJohannes Berg  * @interface_stypes: bitmap of management frame subtypes registered
41746cd536feSJohannes Berg  *	for the given interface
41752d8b08feSMauro Carvalho Chehab  * @global_mcast_stypes: mcast RX is needed globally for these subtypes
41769dba48a6SJohannes Berg  * @interface_mcast_stypes: mcast RX is needed on this interface
41779dba48a6SJohannes Berg  *	for these subtypes
41786cd536feSJohannes Berg  */
41796cd536feSJohannes Berg struct mgmt_frame_regs {
41806cd536feSJohannes Berg 	u32 global_stypes, interface_stypes;
41819dba48a6SJohannes Berg 	u32 global_mcast_stypes, interface_mcast_stypes;
41826cd536feSJohannes Berg };
41836cd536feSJohannes Berg 
41846cd536feSJohannes Berg /**
4185704232c2SJohannes Berg  * struct cfg80211_ops - backend description for wireless configuration
4186704232c2SJohannes Berg  *
4187704232c2SJohannes Berg  * This struct is registered by fullmac card drivers and/or wireless stacks
4188704232c2SJohannes Berg  * in order to handle configuration requests on their interfaces.
4189704232c2SJohannes Berg  *
4190704232c2SJohannes Berg  * All callbacks except where otherwise noted should return 0
4191704232c2SJohannes Berg  * on success or a negative error code.
4192704232c2SJohannes Berg  *
4193a05829a7SJohannes Berg  * All operations are invoked with the wiphy mutex held. The RTNL may be
4194a05829a7SJohannes Berg  * held in addition (due to wireless extensions) but this cannot be relied
4195a05829a7SJohannes Berg  * upon except in cases where documented below. Note that due to ordering,
4196a05829a7SJohannes Berg  * the RTNL also cannot be acquired in any handlers.
419743fb45cbSJohannes Berg  *
4198ff1b6e69SJohannes Berg  * @suspend: wiphy device needs to be suspended. The variable @wow will
4199ff1b6e69SJohannes Berg  *	be %NULL or contain the enabled Wake-on-Wireless triggers that are
4200ff1b6e69SJohannes Berg  *	configured for the device.
42010378b3f1SJohannes Berg  * @resume: wiphy device needs to be resumed
42026d52563fSJohannes Berg  * @set_wakeup: Called when WoWLAN is enabled/disabled, use this callback
42036d52563fSJohannes Berg  *	to call device_set_wakeup_enable() to enable/disable wakeup from
42046d52563fSJohannes Berg  *	the device.
42050378b3f1SJohannes Berg  *
420660719ffdSJohannes Berg  * @add_virtual_intf: create a new virtual interface with the given name,
4207463d0183SJohannes Berg  *	must set the struct wireless_dev's iftype. Beware: You must create
420884efbb84SJohannes Berg  *	the new netdev in the wiphy's network namespace! Returns the struct
420998104fdeSJohannes Berg  *	wireless_dev, or an ERR_PTR. For P2P device wdevs, the driver must
421098104fdeSJohannes Berg  *	also set the address member in the wdev.
4211a05829a7SJohannes Berg  *	This additionally holds the RTNL to be able to do netdev changes.
4212704232c2SJohannes Berg  *
421384efbb84SJohannes Berg  * @del_virtual_intf: remove the virtual interface
4214a05829a7SJohannes Berg  *	This additionally holds the RTNL to be able to do netdev changes.
421555682965SJohannes Berg  *
421660719ffdSJohannes Berg  * @change_virtual_intf: change type/configuration of virtual interface,
421760719ffdSJohannes Berg  *	keep the struct wireless_dev's iftype updated.
4218a05829a7SJohannes Berg  *	This additionally holds the RTNL to be able to do netdev changes.
421955682965SJohannes Berg  *
4220f2a0290bSJohannes Berg  * @add_intf_link: Add a new MLO link to the given interface. Note that
4221f2a0290bSJohannes Berg  *	the wdev->link[] data structure has been updated, so the new link
4222f2a0290bSJohannes Berg  *	address is available.
4223f2a0290bSJohannes Berg  * @del_intf_link: Remove an MLO link from the given interface.
4224f2a0290bSJohannes Berg  *
422541ade00fSJohannes Berg  * @add_key: add a key with the given parameters. @mac_addr will be %NULL
4226e7a7b84eSVeerendranath Jakkam  *	when adding a group key. @link_id will be -1 for non-MLO connection.
4227e7a7b84eSVeerendranath Jakkam  *	For MLO connection, @link_id will be >= 0 for group key and -1 for
4228e7a7b84eSVeerendranath Jakkam  *	pairwise key, @mac_addr will be peer's MLD address for MLO pairwise key.
422941ade00fSJohannes Berg  *
423041ade00fSJohannes Berg  * @get_key: get information about the key with the given parameters.
423141ade00fSJohannes Berg  *	@mac_addr will be %NULL when requesting information for a group
423241ade00fSJohannes Berg  *	key. All pointers given to the @callback function need not be valid
4233e3da574aSJohannes Berg  *	after it returns. This function should return an error if it is
4234e3da574aSJohannes Berg  *	not possible to retrieve the key, -ENOENT if it doesn't exist.
4235e7a7b84eSVeerendranath Jakkam  *	@link_id will be -1 for non-MLO connection. For MLO connection,
4236e7a7b84eSVeerendranath Jakkam  *	@link_id will be >= 0 for group key and -1 for pairwise key, @mac_addr
4237e7a7b84eSVeerendranath Jakkam  *	will be peer's MLD address for MLO pairwise key.
423841ade00fSJohannes Berg  *
423941ade00fSJohannes Berg  * @del_key: remove a key given the @mac_addr (%NULL for a group key)
4240e7a7b84eSVeerendranath Jakkam  *	and @key_index, return -ENOENT if the key doesn't exist. @link_id will
4241e7a7b84eSVeerendranath Jakkam  *	be -1 for non-MLO connection. For MLO connection, @link_id will be >= 0
4242e7a7b84eSVeerendranath Jakkam  *	for group key and -1 for pairwise key, @mac_addr will be peer's MLD
4243e7a7b84eSVeerendranath Jakkam  *	address for MLO pairwise key.
424441ade00fSJohannes Berg  *
4245e7a7b84eSVeerendranath Jakkam  * @set_default_key: set the default key on an interface. @link_id will be >= 0
4246e7a7b84eSVeerendranath Jakkam  *	for MLO connection and -1 for non-MLO connection.
4247ed1b6cc7SJohannes Berg  *
4248e7a7b84eSVeerendranath Jakkam  * @set_default_mgmt_key: set the default management frame key on an interface.
4249e7a7b84eSVeerendranath Jakkam  *	@link_id will be >= 0 for MLO connection and -1 for non-MLO connection.
42501f7e9f46SJohannes Berg  *
4251e7a7b84eSVeerendranath Jakkam  * @set_default_beacon_key: set the default Beacon frame key on an interface.
4252e7a7b84eSVeerendranath Jakkam  *	@link_id will be >= 0 for MLO connection and -1 for non-MLO connection.
42533cfcf6acSJouni Malinen  *
4254e5497d76SJohannes Berg  * @set_rekey_data: give the data necessary for GTK rekeying to the driver
4255e5497d76SJohannes Berg  *
4256c04a4ff7SJohannes Berg  * @start_ap: Start acting in AP mode defined by the parameters.
4257c04a4ff7SJohannes Berg  * @change_beacon: Change the beacon parameters for an access point mode
4258c04a4ff7SJohannes Berg  *	interface. This should reject the call when AP mode wasn't started.
4259c04a4ff7SJohannes Berg  * @stop_ap: Stop being an AP, including stopping beaconing.
42605727ef1bSJohannes Berg  *
42615727ef1bSJohannes Berg  * @add_station: Add a new station.
426289c771e5SJouni Malinen  * @del_station: Remove a station
4263bdd90d5eSJohannes Berg  * @change_station: Modify a given station. Note that flags changes are not much
4264bdd90d5eSJohannes Berg  *	validated in cfg80211, in particular the auth/assoc/authorized flags
4265bdd90d5eSJohannes Berg  *	might come to the driver in invalid combinations -- make sure to check
426677ee7c89SJohannes Berg  *	them, also against the existing state! Drivers must call
426777ee7c89SJohannes Berg  *	cfg80211_check_station_change() to validate the information.
4268abe37c4bSJohannes Berg  * @get_station: get station information for the station identified by @mac
4269abe37c4bSJohannes Berg  * @dump_station: dump station callback -- resume dump at index @idx
4270abe37c4bSJohannes Berg  *
4271abe37c4bSJohannes Berg  * @add_mpath: add a fixed mesh path
4272abe37c4bSJohannes Berg  * @del_mpath: delete a given mesh path
4273abe37c4bSJohannes Berg  * @change_mpath: change a given mesh path
4274abe37c4bSJohannes Berg  * @get_mpath: get a mesh path for the given parameters
4275abe37c4bSJohannes Berg  * @dump_mpath: dump mesh path callback -- resume dump at index @idx
427666be7d2bSHenning Rogge  * @get_mpp: get a mesh proxy path for the given parameters
427766be7d2bSHenning Rogge  * @dump_mpp: dump mesh proxy path callback -- resume dump at index @idx
4278f52555a4SJohannes Berg  * @join_mesh: join the mesh network with the specified parameters
42798d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
4280f52555a4SJohannes Berg  * @leave_mesh: leave the current mesh network
42818d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
42822ec600d6SLuis Carlos Cobo  *
428324bdd9f4SJavier Cardona  * @get_mesh_config: Get the current mesh configuration
428493da9cc1Scolin@cozybit.com  *
428524bdd9f4SJavier Cardona  * @update_mesh_config: Update mesh parameters on a running mesh.
428693da9cc1Scolin@cozybit.com  *	The mask is a bitfield which tells us which parameters to
428793da9cc1Scolin@cozybit.com  *	set, and which to leave alone.
428893da9cc1Scolin@cozybit.com  *
42899f1ba906SJouni Malinen  * @change_bss: Modify parameters for a given BSS.
429031888487SJouni Malinen  *
42915db25290SBenjamin Berg  * @inform_bss: Called by cfg80211 while being informed about new BSS data
42925db25290SBenjamin Berg  *	for every BSS found within the reported data or frame. This is called
42935db25290SBenjamin Berg  *	from within the cfg8011 inform_bss handlers while holding the bss_lock.
42945db25290SBenjamin Berg  *	The data parameter is passed through from drv_data inside
42955db25290SBenjamin Berg  *	struct cfg80211_inform_bss.
42965db25290SBenjamin Berg  *	The new IE data for the BSS is explicitly passed.
42975db25290SBenjamin Berg  *
429831888487SJouni Malinen  * @set_txq_params: Set TX queue parameters
429972bdcf34SJouni Malinen  *
4300e8c9bd5bSJohannes Berg  * @libertas_set_mesh_channel: Only for backward compatibility for libertas,
4301e8c9bd5bSJohannes Berg  *	as it doesn't implement join_mesh and needs to set the channel to
4302e8c9bd5bSJohannes Berg  *	join the mesh instead.
4303e8c9bd5bSJohannes Berg  *
4304e8c9bd5bSJohannes Berg  * @set_monitor_channel: Set the monitor mode channel for the device. If other
4305e8c9bd5bSJohannes Berg  *	interfaces are active this callback should reject the configuration.
4306e8c9bd5bSJohannes Berg  *	If no interfaces are active or the device is down, the channel should
4307e8c9bd5bSJohannes Berg  *	be stored for when a monitor interface becomes active.
43089aed3cc1SJouni Malinen  *
43092a519311SJohannes Berg  * @scan: Request to do a scan. If returning zero, the scan request is given
43102a519311SJohannes Berg  *	the driver, and will be valid until passed to cfg80211_scan_done().
43112a519311SJohannes Berg  *	For scan results, call cfg80211_inform_bss(); you can call this outside
43122a519311SJohannes Berg  *	the scan/scan_done bracket too.
431391d3ab46SVidyullatha Kanchanapally  * @abort_scan: Tell the driver to abort an ongoing scan. The driver shall
431491d3ab46SVidyullatha Kanchanapally  *	indicate the status of the scan through cfg80211_scan_done().
4315636a5d36SJouni Malinen  *
4316636a5d36SJouni Malinen  * @auth: Request to authenticate with the specified peer
43178d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
4318636a5d36SJouni Malinen  * @assoc: Request to (re)associate with the specified peer
43198d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
4320636a5d36SJouni Malinen  * @deauth: Request to deauthenticate from the specified peer
43218d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
4322636a5d36SJouni Malinen  * @disassoc: Request to disassociate from the specified peer
43238d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
432404a773adSJohannes Berg  *
4325b23aa676SSamuel Ortiz  * @connect: Connect to the ESS with the specified parameters. When connected,
4326bf1ecd21SJouni Malinen  *	call cfg80211_connect_result()/cfg80211_connect_bss() with status code
4327bf1ecd21SJouni Malinen  *	%WLAN_STATUS_SUCCESS. If the connection fails for some reason, call
4328bf1ecd21SJouni Malinen  *	cfg80211_connect_result()/cfg80211_connect_bss() with the status code
4329bf1ecd21SJouni Malinen  *	from the AP or cfg80211_connect_timeout() if no frame with status code
4330bf1ecd21SJouni Malinen  *	was received.
4331bf1ecd21SJouni Malinen  *	The driver is allowed to roam to other BSSes within the ESS when the
4332bf1ecd21SJouni Malinen  *	other BSS matches the connect parameters. When such roaming is initiated
4333bf1ecd21SJouni Malinen  *	by the driver, the driver is expected to verify that the target matches
4334bf1ecd21SJouni Malinen  *	the configured security parameters and to use Reassociation Request
4335bf1ecd21SJouni Malinen  *	frame instead of Association Request frame.
4336bf1ecd21SJouni Malinen  *	The connect function can also be used to request the driver to perform a
4337bf1ecd21SJouni Malinen  *	specific roam when connected to an ESS. In that case, the prev_bssid
433835eb8f7bSJouni Malinen  *	parameter is set to the BSSID of the currently associated BSS as an
4339bf1ecd21SJouni Malinen  *	indication of requesting reassociation.
4340bf1ecd21SJouni Malinen  *	In both the driver-initiated and new connect() call initiated roaming
4341bf1ecd21SJouni Malinen  *	cases, the result of roaming is indicated with a call to
434229ce6ecbSAvraham Stern  *	cfg80211_roamed(). (invoked with the wireless_dev mutex held)
4343088e8df8Svamsi krishna  * @update_connect_params: Update the connect parameters while connected to a
4344088e8df8Svamsi krishna  *	BSS. The updated parameters can be used by driver/firmware for
4345088e8df8Svamsi krishna  *	subsequent BSS selection (roaming) decisions and to form the
4346088e8df8Svamsi krishna  *	Authentication/(Re)Association Request frames. This call does not
4347088e8df8Svamsi krishna  *	request an immediate disassociation or reassociation with the current
4348088e8df8Svamsi krishna  *	BSS, i.e., this impacts only subsequent (re)associations. The bits in
4349088e8df8Svamsi krishna  *	changed are defined in &enum cfg80211_connect_params_changed.
4350088e8df8Svamsi krishna  *	(invoked with the wireless_dev mutex held)
43510711d638SIlan Peer  * @disconnect: Disconnect from the BSS/ESS or stop connection attempts if
43520711d638SIlan Peer  *      connection is in progress. Once done, call cfg80211_disconnected() in
43530711d638SIlan Peer  *      case connection was already established (invoked with the
43540711d638SIlan Peer  *      wireless_dev mutex held), otherwise call cfg80211_connect_timeout().
4355b23aa676SSamuel Ortiz  *
435604a773adSJohannes Berg  * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call
435704a773adSJohannes Berg  *	cfg80211_ibss_joined(), also call that function when changing BSSID due
435804a773adSJohannes Berg  *	to a merge.
43598d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
436004a773adSJohannes Berg  * @leave_ibss: Leave the IBSS.
43618d61ffa5SJohannes Berg  *	(invoked with the wireless_dev mutex held)
4362b9a5f8caSJouni Malinen  *
4363f4e583c8SAntonio Quartulli  * @set_mcast_rate: Set the specified multicast rate (only if vif is in ADHOC or
4364f4e583c8SAntonio Quartulli  *	MESH mode)
4365f4e583c8SAntonio Quartulli  *
4366b9a5f8caSJouni Malinen  * @set_wiphy_params: Notify that wiphy parameters have changed;
4367b9a5f8caSJouni Malinen  *	@changed bitfield (see &enum wiphy_params_flags) describes which values
4368b9a5f8caSJouni Malinen  *	have changed. The actual parameter values are available in
4369b9a5f8caSJouni Malinen  *	struct wiphy. If returning an error, no value should be changed.
43707643a2c3SJohannes Berg  *
43711432de07SLuis R. Rodriguez  * @set_tx_power: set the transmit power according to the parameters,
4372c8442118SJohannes Berg  *	the power passed is in mBm, to get dBm use MBM_TO_DBM(). The
4373c8442118SJohannes Berg  *	wdev may be %NULL if power was set for the wiphy, and will
4374c8442118SJohannes Berg  *	always be %NULL unless the driver supports per-vif TX power
4375c8442118SJohannes Berg  *	(as advertised by the nl80211 feature flag.)
43767643a2c3SJohannes Berg  * @get_tx_power: store the current TX power into the dbm variable;
43771f87f7d3SJohannes Berg  *	return 0 if successful
43781f87f7d3SJohannes Berg  *
43791f87f7d3SJohannes Berg  * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting
43801f87f7d3SJohannes Berg  *	functions to adjust rfkill hw state
4381aff89a9bSJohannes Berg  *
438261fa713cSHolger Schurig  * @dump_survey: get site survey information.
438361fa713cSHolger Schurig  *
43849588bbd5SJouni Malinen  * @remain_on_channel: Request the driver to remain awake on the specified
43859588bbd5SJouni Malinen  *	channel for the specified duration to complete an off-channel
43869588bbd5SJouni Malinen  *	operation (e.g., public action frame exchange). When the driver is
43879588bbd5SJouni Malinen  *	ready on the requested channel, it must indicate this with an event
43889588bbd5SJouni Malinen  *	notification by calling cfg80211_ready_on_channel().
43899588bbd5SJouni Malinen  * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation.
43909588bbd5SJouni Malinen  *	This allows the operation to be terminated prior to timeout based on
43919588bbd5SJouni Malinen  *	the duration value.
4392f7ca38dfSJohannes Berg  * @mgmt_tx: Transmit a management frame.
4393f7ca38dfSJohannes Berg  * @mgmt_tx_cancel_wait: Cancel the wait time from transmitting a management
4394f7ca38dfSJohannes Berg  *	frame on another channel
43959588bbd5SJouni Malinen  *
4396fc73f11fSDavid Spinadel  * @testmode_cmd: run a test mode command; @wdev may be %NULL
439771063f0eSWey-Yi Guy  * @testmode_dump: Implement a test mode dump. The cb->args[2] and up may be
439871063f0eSWey-Yi Guy  *	used by the function, but 0 and 1 must not be touched. Additionally,
439971063f0eSWey-Yi Guy  *	return error codes other than -ENOBUFS and -ENOENT will terminate the
440071063f0eSWey-Yi Guy  *	dump and return to userspace with an error, so be careful. If any data
440171063f0eSWey-Yi Guy  *	was passed in from userspace then the data/len arguments will be present
440271063f0eSWey-Yi Guy  *	and point to the data contained in %NL80211_ATTR_TESTDATA.
440367fbb16bSSamuel Ortiz  *
4404abe37c4bSJohannes Berg  * @set_bitrate_mask: set the bitrate mask configuration
4405abe37c4bSJohannes Berg  *
440667fbb16bSSamuel Ortiz  * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac
440767fbb16bSSamuel Ortiz  *	devices running firmwares capable of generating the (re) association
440867fbb16bSSamuel Ortiz  *	RSN IE. It allows for faster roaming between WPA2 BSSIDs.
440967fbb16bSSamuel Ortiz  * @del_pmksa: Delete a cached PMKID.
441067fbb16bSSamuel Ortiz  * @flush_pmksa: Flush all cached PMKIDs.
44119043f3b8SJuuso Oikarinen  * @set_power_mgmt: Configure WLAN power management. A timeout value of -1
44129043f3b8SJuuso Oikarinen  *	allows the driver to adjust the dynamic ps timeout value.
4413d6dc1a38SJuuso Oikarinen  * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold.
4414e86abc68SJohannes Berg  *	After configuration, the driver should (soon) send an event indicating
4415e86abc68SJohannes Berg  *	the current level is above/below the configured threshold; this may
4416e86abc68SJohannes Berg  *	need some care when the configuration is changed (without first being
4417e86abc68SJohannes Berg  *	disabled.)
44184a4b8169SAndrew Zaborowski  * @set_cqm_rssi_range_config: Configure two RSSI thresholds in the
44194a4b8169SAndrew Zaborowski  *	connection quality monitor.  An event is to be sent only when the
44204a4b8169SAndrew Zaborowski  *	signal level is found to be outside the two values.  The driver should
44214a4b8169SAndrew Zaborowski  *	set %NL80211_EXT_FEATURE_CQM_RSSI_LIST if this method is implemented.
44224a4b8169SAndrew Zaborowski  *	If it is provided then there's no point providing @set_cqm_rssi_config.
442384f10708SThomas Pedersen  * @set_cqm_txe_config: Configure connection quality monitor TX error
442484f10708SThomas Pedersen  *	thresholds.
4425807f8a8cSLuciano Coelho  * @sched_scan_start: Tell the driver to start a scheduled scan.
44263a3ecf1dSArend Van Spriel  * @sched_scan_stop: Tell the driver to stop an ongoing scheduled scan with
44273a3ecf1dSArend Van Spriel  *	given request id. This call must stop the scheduled scan and be ready
44283a3ecf1dSArend Van Spriel  *	for starting a new one before it returns, i.e. @sched_scan_start may be
44293a3ecf1dSArend Van Spriel  *	called immediately after that again and should not fail in that case.
44303a3ecf1dSArend Van Spriel  *	The driver should not call cfg80211_sched_scan_stopped() for a requested
44313a3ecf1dSArend Van Spriel  *	stop (when this method returns 0).
443267fbb16bSSamuel Ortiz  *
44336cd536feSJohannes Berg  * @update_mgmt_frame_registrations: Notify the driver that management frame
44346cd536feSJohannes Berg  *	registrations were updated. The callback is allowed to sleep.
4435547025d5SBruno Randolf  *
4436547025d5SBruno Randolf  * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device.
4437547025d5SBruno Randolf  *	Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may
4438547025d5SBruno Randolf  *	reject TX/RX mask combinations they cannot support by returning -EINVAL
4439547025d5SBruno Randolf  *	(also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX).
4440547025d5SBruno Randolf  *
4441547025d5SBruno Randolf  * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant).
44423677713bSJohn W. Linville  *
4443109086ceSArik Nemtsov  * @tdls_mgmt: Transmit a TDLS management frame.
4444109086ceSArik Nemtsov  * @tdls_oper: Perform a high-level TDLS operation (e.g. TDLS link setup).
44457f6cf311SJohannes Berg  *
44467f6cf311SJohannes Berg  * @probe_client: probe an associated client, must return a cookie that it
44477f6cf311SJohannes Berg  *	later passes to cfg80211_probe_status().
44481d9d9213SSimon Wunderlich  *
44491d9d9213SSimon Wunderlich  * @set_noack_map: Set the NoAck Map for the TIDs.
4450d6199218SBen Greear  *
44515b7ccaf3SJohannes Berg  * @get_channel: Get the current operating channel for the virtual interface.
44525b7ccaf3SJohannes Berg  *	For monitor interfaces, it should return %NULL unless there's a single
44535b7ccaf3SJohannes Berg  *	current monitoring channel.
445498104fdeSJohannes Berg  *
445598104fdeSJohannes Berg  * @start_p2p_device: Start the given P2P device.
445698104fdeSJohannes Berg  * @stop_p2p_device: Stop the given P2P device.
445777765eafSVasanthakumar Thiagarajan  *
445877765eafSVasanthakumar Thiagarajan  * @set_mac_acl: Sets MAC address control list in AP and P2P GO mode.
445977765eafSVasanthakumar Thiagarajan  *	Parameters include ACL policy, an array of MAC address of stations
446077765eafSVasanthakumar Thiagarajan  *	and the number of MAC addresses. If there is already a list in driver
446177765eafSVasanthakumar Thiagarajan  *	this new list replaces the existing one. Driver has to clear its ACL
446277765eafSVasanthakumar Thiagarajan  *	when number of MAC addresses entries is passed as 0. Drivers which
446377765eafSVasanthakumar Thiagarajan  *	advertise the support for MAC based ACL have to implement this callback.
446404f39047SSimon Wunderlich  *
446504f39047SSimon Wunderlich  * @start_radar_detection: Start radar detection in the driver.
44668bf24293SJouni Malinen  *
446726ec17a1SOrr Mazor  * @end_cac: End running CAC, probably because a related CAC
446826ec17a1SOrr Mazor  *	was finished on another phy.
446926ec17a1SOrr Mazor  *
44708bf24293SJouni Malinen  * @update_ft_ies: Provide updated Fast BSS Transition information to the
44718bf24293SJouni Malinen  *	driver. If the SME is in the driver/firmware, this information can be
44728bf24293SJouni Malinen  *	used in building Authentication and Reassociation Request frames.
44735de17984SArend van Spriel  *
44745de17984SArend van Spriel  * @crit_proto_start: Indicates a critical protocol needs more link reliability
44755de17984SArend van Spriel  *	for a given duration (milliseconds). The protocol is provided so the
44765de17984SArend van Spriel  *	driver can take the most appropriate actions.
44775de17984SArend van Spriel  * @crit_proto_stop: Indicates critical protocol no longer needs increased link
44785de17984SArend van Spriel  *	reliability. This operation can not fail.
4479be29b99aSAmitkumar Karwar  * @set_coalesce: Set coalesce parameters.
448016ef1fe2SSimon Wunderlich  *
448197dc94f1SMichal Kazior  * @channel_switch: initiate channel-switch procedure (with CSA). Driver is
448297dc94f1SMichal Kazior  *	responsible for veryfing if the switch is possible. Since this is
448397dc94f1SMichal Kazior  *	inherently tricky driver may decide to disconnect an interface later
448497dc94f1SMichal Kazior  *	with cfg80211_stop_iface(). This doesn't mean driver can accept
448597dc94f1SMichal Kazior  *	everything. It should do it's best to verify requests and reject them
448697dc94f1SMichal Kazior  *	as soon as possible.
4487fa9ffc74SKyeyoon Park  *
4488fa9ffc74SKyeyoon Park  * @set_qos_map: Set QoS mapping information to the driver
4489e16821bcSJouni Malinen  *
4490e16821bcSJouni Malinen  * @set_ap_chanwidth: Set the AP (including P2P GO) mode channel width for the
4491e16821bcSJouni Malinen  *	given interface This is used e.g. for dynamic HT 20/40 MHz channel width
4492e16821bcSJouni Malinen  *	changes during the lifetime of the BSS.
4493960d01acSJohannes Berg  *
4494960d01acSJohannes Berg  * @add_tx_ts: validate (if admitted_time is 0) or add a TX TS to the device
4495960d01acSJohannes Berg  *	with the given parameters; action frame exchange has been handled by
4496960d01acSJohannes Berg  *	userspace so this just has to modify the TX path to take the TS into
4497960d01acSJohannes Berg  *	account.
4498960d01acSJohannes Berg  *	If the admitted time is 0 just validate the parameters to make sure
4499960d01acSJohannes Berg  *	the session can be created at all; it is valid to just always return
4500960d01acSJohannes Berg  *	success for that but that may result in inefficient behaviour (handshake
4501960d01acSJohannes Berg  *	with the peer followed by immediate teardown when the addition is later
4502960d01acSJohannes Berg  *	rejected)
4503960d01acSJohannes Berg  * @del_tx_ts: remove an existing TX TS
45046e0bd6c3SRostislav Lisovy  *
45056e0bd6c3SRostislav Lisovy  * @join_ocb: join the OCB network with the specified parameters
45066e0bd6c3SRostislav Lisovy  *	(invoked with the wireless_dev mutex held)
45076e0bd6c3SRostislav Lisovy  * @leave_ocb: leave the current OCB network
45086e0bd6c3SRostislav Lisovy  *	(invoked with the wireless_dev mutex held)
45091057d35eSArik Nemtsov  *
45101057d35eSArik Nemtsov  * @tdls_channel_switch: Start channel-switching with a TDLS peer. The driver
45111057d35eSArik Nemtsov  *	is responsible for continually initiating channel-switching operations
45121057d35eSArik Nemtsov  *	and returning to the base channel for communication with the AP.
45131057d35eSArik Nemtsov  * @tdls_cancel_channel_switch: Stop channel-switching with a TDLS peer. Both
45141057d35eSArik Nemtsov  *	peers must be on the base channel when the call completes.
4515cb3b7d87SAyala Beker  * @start_nan: Start the NAN interface.
4516cb3b7d87SAyala Beker  * @stop_nan: Stop the NAN interface.
4517a442b761SAyala Beker  * @add_nan_func: Add a NAN function. Returns negative value on failure.
4518a442b761SAyala Beker  *	On success @nan_func ownership is transferred to the driver and
4519a442b761SAyala Beker  *	it may access it outside of the scope of this function. The driver
4520a442b761SAyala Beker  *	should free the @nan_func when no longer needed by calling
4521a442b761SAyala Beker  *	cfg80211_free_nan_func().
4522a442b761SAyala Beker  *	On success the driver should assign an instance_id in the
4523a442b761SAyala Beker  *	provided @nan_func.
4524a442b761SAyala Beker  * @del_nan_func: Delete a NAN function.
4525a5a9dcf2SAyala Beker  * @nan_change_conf: changes NAN configuration. The changed parameters must
4526a5a9dcf2SAyala Beker  *	be specified in @changes (using &enum cfg80211_nan_conf_changes);
4527a5a9dcf2SAyala Beker  *	All other parameters must be ignored.
4528ce0ce13aSMichael Braun  *
4529ce0ce13aSMichael Braun  * @set_multicast_to_unicast: configure multicast to unicast conversion for BSS
45303a00df57SAvraham Stern  *
453152539ca8SToke Høiland-Jørgensen  * @get_txq_stats: Get TXQ stats for interface or phy. If wdev is %NULL, this
453252539ca8SToke Høiland-Jørgensen  *      function should return phy stats, and interface stats otherwise.
453352539ca8SToke Høiland-Jørgensen  *
45343a00df57SAvraham Stern  * @set_pmk: configure the PMK to be used for offloaded 802.1X 4-Way handshake.
45353a00df57SAvraham Stern  *	If not deleted through @del_pmk the PMK remains valid until disconnect
45363a00df57SAvraham Stern  *	upon which the driver should clear it.
45373a00df57SAvraham Stern  *	(invoked with the wireless_dev mutex held)
45383a00df57SAvraham Stern  * @del_pmk: delete the previously configured PMK for the given authenticator.
45393a00df57SAvraham Stern  *	(invoked with the wireless_dev mutex held)
454040cbfa90SSrinivas Dasari  *
454140cbfa90SSrinivas Dasari  * @external_auth: indicates result of offloaded authentication processing from
454240cbfa90SSrinivas Dasari  *     user space
45432576a9acSDenis Kenzior  *
45442576a9acSDenis Kenzior  * @tx_control_port: TX a control port frame (EAPoL).  The noencrypt parameter
45452576a9acSDenis Kenzior  *	tells the driver that the frame should not be encrypted.
454681e54d08SPradeep Kumar Chitrapu  *
454781e54d08SPradeep Kumar Chitrapu  * @get_ftm_responder_stats: Retrieve FTM responder statistics, if available.
454881e54d08SPradeep Kumar Chitrapu  *	Statistics should be cumulative, currently no way to reset is provided.
45499bb7e0f2SJohannes Berg  * @start_pmsr: start peer measurement (e.g. FTM)
45509bb7e0f2SJohannes Berg  * @abort_pmsr: abort peer measurement
4551cb74e977SSunil Dutt  *
4552cb74e977SSunil Dutt  * @update_owe_info: Provide updated OWE info to driver. Driver implementing SME
4553cb74e977SSunil Dutt  *	but offloading OWE processing to the user space will get the updated
4554cb74e977SSunil Dutt  *	DH IE through this interface.
45555ab92e7fSRajkumar Manoharan  *
45565ab92e7fSRajkumar Manoharan  * @probe_mesh_link: Probe direct Mesh peer's link quality by sending data frame
45575ab92e7fSRajkumar Manoharan  *	and overrule HWMP path selection algorithm.
455877f576deSTamizh chelvam  * @set_tid_config: TID specific configuration, this can be peer or BSS specific
455977f576deSTamizh chelvam  *	This callback may sleep.
45603710a8a6SJohannes Berg  * @reset_tid_config: Reset TID specific configuration for the peer, for the
45613710a8a6SJohannes Berg  *	given TIDs. This callback may sleep.
456270b6ff35SJohannes Berg  *
456370b6ff35SJohannes Berg  * @set_sar_specs: Update the SAR (TX power) settings.
45640d2ab3aeSJohn Crispin  *
45650d2ab3aeSJohn Crispin  * @color_change: Initiate a color change.
4566e306784aSSubrat Mishra  *
4567e306784aSSubrat Mishra  * @set_fils_aad: Set FILS AAD data to the AP driver so that the driver can use
4568e306784aSSubrat Mishra  *	those to decrypt (Re)Association Request and encrypt (Re)Association
4569e306784aSSubrat Mishra  *	Response frame.
4570bc2dfc02SLorenzo Bianconi  *
4571a95bfb87SLorenzo Bianconi  * @set_radar_background: Configure dedicated offchannel chain available for
4572bc2dfc02SLorenzo Bianconi  *	radar/CAC detection on some hw. This chain can't be used to transmit
4573bc2dfc02SLorenzo Bianconi  *	or receive frames and it is bounded to a running wdev.
4574a95bfb87SLorenzo Bianconi  *	Background radar/CAC detection allows to avoid the CAC downtime
4575bc2dfc02SLorenzo Bianconi  *	switching to a different channel during CAC detection on the selected
4576bc2dfc02SLorenzo Bianconi  *	radar channel.
4577bc2dfc02SLorenzo Bianconi  *	The caller is expected to set chandef pointer to NULL in order to
4578a95bfb87SLorenzo Bianconi  *	disable background CAC/radar detection.
4579577e5b8cSShaul Triebitz  * @add_link_station: Add a link to a station.
4580577e5b8cSShaul Triebitz  * @mod_link_station: Modify a link of a station.
4581577e5b8cSShaul Triebitz  * @del_link_station: Remove a link of a station.
4582cbbaf2bbSAvraham Stern  *
4583cbbaf2bbSAvraham Stern  * @set_hw_timestamp: Enable/disable HW timestamping of TM/FTM frames.
4584b61e6b41SIlan Peer  * @set_ttlm: set the TID to link mapping.
4585abb4cfe3SFelix Fietkau  * @get_radio_mask: get bitmask of radios in use.
4586abb4cfe3SFelix Fietkau  *	(invoked with the wiphy mutex held)
4587704232c2SJohannes Berg  */
4588704232c2SJohannes Berg struct cfg80211_ops {
4589ff1b6e69SJohannes Berg 	int	(*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
45900378b3f1SJohannes Berg 	int	(*resume)(struct wiphy *wiphy);
45916d52563fSJohannes Berg 	void	(*set_wakeup)(struct wiphy *wiphy, bool enabled);
45920378b3f1SJohannes Berg 
459384efbb84SJohannes Berg 	struct wireless_dev * (*add_virtual_intf)(struct wiphy *wiphy,
4594552bff0cSJohannes Berg 						  const char *name,
45956bab2e19STom Gundersen 						  unsigned char name_assign_type,
4596f9e10ce4SJohannes Berg 						  enum nl80211_iftype type,
45972ec600d6SLuis Carlos Cobo 						  struct vif_params *params);
459884efbb84SJohannes Berg 	int	(*del_virtual_intf)(struct wiphy *wiphy,
459984efbb84SJohannes Berg 				    struct wireless_dev *wdev);
4600e36d56b6SJohannes Berg 	int	(*change_virtual_intf)(struct wiphy *wiphy,
4601e36d56b6SJohannes Berg 				       struct net_device *dev,
4602818a986eSJohannes Berg 				       enum nl80211_iftype type,
46032ec600d6SLuis Carlos Cobo 				       struct vif_params *params);
460441ade00fSJohannes Berg 
4605f2a0290bSJohannes Berg 	int	(*add_intf_link)(struct wiphy *wiphy,
4606f2a0290bSJohannes Berg 				 struct wireless_dev *wdev,
4607f2a0290bSJohannes Berg 				 unsigned int link_id);
4608f2a0290bSJohannes Berg 	void	(*del_intf_link)(struct wiphy *wiphy,
4609f2a0290bSJohannes Berg 				 struct wireless_dev *wdev,
4610f2a0290bSJohannes Berg 				 unsigned int link_id);
4611f2a0290bSJohannes Berg 
461241ade00fSJohannes Berg 	int	(*add_key)(struct wiphy *wiphy, struct net_device *netdev,
4613e7a7b84eSVeerendranath Jakkam 			   int link_id, u8 key_index, bool pairwise,
4614e7a7b84eSVeerendranath Jakkam 			   const u8 *mac_addr, struct key_params *params);
461541ade00fSJohannes Berg 	int	(*get_key)(struct wiphy *wiphy, struct net_device *netdev,
4616e7a7b84eSVeerendranath Jakkam 			   int link_id, u8 key_index, bool pairwise,
4617e7a7b84eSVeerendranath Jakkam 			   const u8 *mac_addr, void *cookie,
461841ade00fSJohannes Berg 			   void (*callback)(void *cookie, struct key_params*));
461941ade00fSJohannes Berg 	int	(*del_key)(struct wiphy *wiphy, struct net_device *netdev,
4620e7a7b84eSVeerendranath Jakkam 			   int link_id, u8 key_index, bool pairwise,
4621e7a7b84eSVeerendranath Jakkam 			   const u8 *mac_addr);
462241ade00fSJohannes Berg 	int	(*set_default_key)(struct wiphy *wiphy,
4623e7a7b84eSVeerendranath Jakkam 				   struct net_device *netdev, int link_id,
4624dbd2fd65SJohannes Berg 				   u8 key_index, bool unicast, bool multicast);
46253cfcf6acSJouni Malinen 	int	(*set_default_mgmt_key)(struct wiphy *wiphy,
4626e7a7b84eSVeerendranath Jakkam 					struct net_device *netdev, int link_id,
46273cfcf6acSJouni Malinen 					u8 key_index);
462856be393fSJouni Malinen 	int	(*set_default_beacon_key)(struct wiphy *wiphy,
462956be393fSJouni Malinen 					  struct net_device *netdev,
4630e7a7b84eSVeerendranath Jakkam 					  int link_id,
463156be393fSJouni Malinen 					  u8 key_index);
4632ed1b6cc7SJohannes Berg 
46338860020eSJohannes Berg 	int	(*start_ap)(struct wiphy *wiphy, struct net_device *dev,
46348860020eSJohannes Berg 			    struct cfg80211_ap_settings *settings);
46358860020eSJohannes Berg 	int	(*change_beacon)(struct wiphy *wiphy, struct net_device *dev,
4636bb55441cSJohannes Berg 				 struct cfg80211_ap_update *info);
46377b0a0e3cSJohannes Berg 	int	(*stop_ap)(struct wiphy *wiphy, struct net_device *dev,
46387b0a0e3cSJohannes Berg 			   unsigned int link_id);
46395727ef1bSJohannes Berg 
46405727ef1bSJohannes Berg 
46415727ef1bSJohannes Berg 	int	(*add_station)(struct wiphy *wiphy, struct net_device *dev,
46423b3a0162SJohannes Berg 			       const u8 *mac,
46433b3a0162SJohannes Berg 			       struct station_parameters *params);
46445727ef1bSJohannes Berg 	int	(*del_station)(struct wiphy *wiphy, struct net_device *dev,
464589c771e5SJouni Malinen 			       struct station_del_parameters *params);
46465727ef1bSJohannes Berg 	int	(*change_station)(struct wiphy *wiphy, struct net_device *dev,
46473b3a0162SJohannes Berg 				  const u8 *mac,
46483b3a0162SJohannes Berg 				  struct station_parameters *params);
4649fd5b74dcSJohannes Berg 	int	(*get_station)(struct wiphy *wiphy, struct net_device *dev,
46503b3a0162SJohannes Berg 			       const u8 *mac, struct station_info *sinfo);
46512ec600d6SLuis Carlos Cobo 	int	(*dump_station)(struct wiphy *wiphy, struct net_device *dev,
46522ec600d6SLuis Carlos Cobo 				int idx, u8 *mac, struct station_info *sinfo);
46532ec600d6SLuis Carlos Cobo 
46542ec600d6SLuis Carlos Cobo 	int	(*add_mpath)(struct wiphy *wiphy, struct net_device *dev,
46553b3a0162SJohannes Berg 			       const u8 *dst, const u8 *next_hop);
46562ec600d6SLuis Carlos Cobo 	int	(*del_mpath)(struct wiphy *wiphy, struct net_device *dev,
46573b3a0162SJohannes Berg 			       const u8 *dst);
46582ec600d6SLuis Carlos Cobo 	int	(*change_mpath)(struct wiphy *wiphy, struct net_device *dev,
46593b3a0162SJohannes Berg 				  const u8 *dst, const u8 *next_hop);
46602ec600d6SLuis Carlos Cobo 	int	(*get_mpath)(struct wiphy *wiphy, struct net_device *dev,
46613b3a0162SJohannes Berg 			     u8 *dst, u8 *next_hop, struct mpath_info *pinfo);
46622ec600d6SLuis Carlos Cobo 	int	(*dump_mpath)(struct wiphy *wiphy, struct net_device *dev,
46632ec600d6SLuis Carlos Cobo 			      int idx, u8 *dst, u8 *next_hop,
46642ec600d6SLuis Carlos Cobo 			      struct mpath_info *pinfo);
466566be7d2bSHenning Rogge 	int	(*get_mpp)(struct wiphy *wiphy, struct net_device *dev,
466666be7d2bSHenning Rogge 			   u8 *dst, u8 *mpp, struct mpath_info *pinfo);
466766be7d2bSHenning Rogge 	int	(*dump_mpp)(struct wiphy *wiphy, struct net_device *dev,
466866be7d2bSHenning Rogge 			    int idx, u8 *dst, u8 *mpp,
466966be7d2bSHenning Rogge 			    struct mpath_info *pinfo);
467024bdd9f4SJavier Cardona 	int	(*get_mesh_config)(struct wiphy *wiphy,
467193da9cc1Scolin@cozybit.com 				struct net_device *dev,
467293da9cc1Scolin@cozybit.com 				struct mesh_config *conf);
467324bdd9f4SJavier Cardona 	int	(*update_mesh_config)(struct wiphy *wiphy,
467429cbe68cSJohannes Berg 				      struct net_device *dev, u32 mask,
467529cbe68cSJohannes Berg 				      const struct mesh_config *nconf);
467629cbe68cSJohannes Berg 	int	(*join_mesh)(struct wiphy *wiphy, struct net_device *dev,
467729cbe68cSJohannes Berg 			     const struct mesh_config *conf,
467829cbe68cSJohannes Berg 			     const struct mesh_setup *setup);
467929cbe68cSJohannes Berg 	int	(*leave_mesh)(struct wiphy *wiphy, struct net_device *dev);
468029cbe68cSJohannes Berg 
46816e0bd6c3SRostislav Lisovy 	int	(*join_ocb)(struct wiphy *wiphy, struct net_device *dev,
46826e0bd6c3SRostislav Lisovy 			    struct ocb_setup *setup);
46836e0bd6c3SRostislav Lisovy 	int	(*leave_ocb)(struct wiphy *wiphy, struct net_device *dev);
46846e0bd6c3SRostislav Lisovy 
46859f1ba906SJouni Malinen 	int	(*change_bss)(struct wiphy *wiphy, struct net_device *dev,
46869f1ba906SJouni Malinen 			      struct bss_parameters *params);
468731888487SJouni Malinen 
46885db25290SBenjamin Berg 	void	(*inform_bss)(struct wiphy *wiphy, struct cfg80211_bss *bss,
46895db25290SBenjamin Berg 			      const struct cfg80211_bss_ies *ies, void *data);
46905db25290SBenjamin Berg 
4691f70f01c2SEliad Peller 	int	(*set_txq_params)(struct wiphy *wiphy, struct net_device *dev,
469231888487SJouni Malinen 				  struct ieee80211_txq_params *params);
469372bdcf34SJouni Malinen 
4694e8c9bd5bSJohannes Berg 	int	(*libertas_set_mesh_channel)(struct wiphy *wiphy,
4695e8c9bd5bSJohannes Berg 					     struct net_device *dev,
4696e8c9bd5bSJohannes Berg 					     struct ieee80211_channel *chan);
4697e8c9bd5bSJohannes Berg 
4698e8c9bd5bSJohannes Berg 	int	(*set_monitor_channel)(struct wiphy *wiphy,
4699683b6d3bSJohannes Berg 				       struct cfg80211_chan_def *chandef);
47009aed3cc1SJouni Malinen 
4701fd014284SJohannes Berg 	int	(*scan)(struct wiphy *wiphy,
47022a519311SJohannes Berg 			struct cfg80211_scan_request *request);
470391d3ab46SVidyullatha Kanchanapally 	void	(*abort_scan)(struct wiphy *wiphy, struct wireless_dev *wdev);
4704636a5d36SJouni Malinen 
4705636a5d36SJouni Malinen 	int	(*auth)(struct wiphy *wiphy, struct net_device *dev,
4706636a5d36SJouni Malinen 			struct cfg80211_auth_request *req);
4707636a5d36SJouni Malinen 	int	(*assoc)(struct wiphy *wiphy, struct net_device *dev,
4708636a5d36SJouni Malinen 			 struct cfg80211_assoc_request *req);
4709636a5d36SJouni Malinen 	int	(*deauth)(struct wiphy *wiphy, struct net_device *dev,
471063c9c5e7SJohannes Berg 			  struct cfg80211_deauth_request *req);
4711636a5d36SJouni Malinen 	int	(*disassoc)(struct wiphy *wiphy, struct net_device *dev,
471263c9c5e7SJohannes Berg 			    struct cfg80211_disassoc_request *req);
471304a773adSJohannes Berg 
4714b23aa676SSamuel Ortiz 	int	(*connect)(struct wiphy *wiphy, struct net_device *dev,
4715b23aa676SSamuel Ortiz 			   struct cfg80211_connect_params *sme);
4716088e8df8Svamsi krishna 	int	(*update_connect_params)(struct wiphy *wiphy,
4717088e8df8Svamsi krishna 					 struct net_device *dev,
4718088e8df8Svamsi krishna 					 struct cfg80211_connect_params *sme,
4719088e8df8Svamsi krishna 					 u32 changed);
4720b23aa676SSamuel Ortiz 	int	(*disconnect)(struct wiphy *wiphy, struct net_device *dev,
4721b23aa676SSamuel Ortiz 			      u16 reason_code);
4722b23aa676SSamuel Ortiz 
472304a773adSJohannes Berg 	int	(*join_ibss)(struct wiphy *wiphy, struct net_device *dev,
472404a773adSJohannes Berg 			     struct cfg80211_ibss_params *params);
472504a773adSJohannes Berg 	int	(*leave_ibss)(struct wiphy *wiphy, struct net_device *dev);
4726b9a5f8caSJouni Malinen 
4727f4e583c8SAntonio Quartulli 	int	(*set_mcast_rate)(struct wiphy *wiphy, struct net_device *dev,
472857fbcce3SJohannes Berg 				  int rate[NUM_NL80211_BANDS]);
4729f4e583c8SAntonio Quartulli 
4730b9a5f8caSJouni Malinen 	int	(*set_wiphy_params)(struct wiphy *wiphy, u32 changed);
47317643a2c3SJohannes Berg 
4732c8442118SJohannes Berg 	int	(*set_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
4733fa61cf70SJuuso Oikarinen 				enum nl80211_tx_power_setting type, int mbm);
4734c8442118SJohannes Berg 	int	(*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
4735c8442118SJohannes Berg 				int *dbm);
47361f87f7d3SJohannes Berg 
47371f87f7d3SJohannes Berg 	void	(*rfkill_poll)(struct wiphy *wiphy);
4738aff89a9bSJohannes Berg 
4739aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE
4740fc73f11fSDavid Spinadel 	int	(*testmode_cmd)(struct wiphy *wiphy, struct wireless_dev *wdev,
4741fc73f11fSDavid Spinadel 				void *data, int len);
474271063f0eSWey-Yi Guy 	int	(*testmode_dump)(struct wiphy *wiphy, struct sk_buff *skb,
474371063f0eSWey-Yi Guy 				 struct netlink_callback *cb,
474471063f0eSWey-Yi Guy 				 void *data, int len);
4745aff89a9bSJohannes Berg #endif
4746bc92afd9SJohannes Berg 
47479930380fSJohannes Berg 	int	(*set_bitrate_mask)(struct wiphy *wiphy,
47489930380fSJohannes Berg 				    struct net_device *dev,
47497b0a0e3cSJohannes Berg 				    unsigned int link_id,
47509930380fSJohannes Berg 				    const u8 *peer,
47519930380fSJohannes Berg 				    const struct cfg80211_bitrate_mask *mask);
47529930380fSJohannes Berg 
475361fa713cSHolger Schurig 	int	(*dump_survey)(struct wiphy *wiphy, struct net_device *netdev,
475461fa713cSHolger Schurig 			int idx, struct survey_info *info);
475561fa713cSHolger Schurig 
475667fbb16bSSamuel Ortiz 	int	(*set_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
475767fbb16bSSamuel Ortiz 			     struct cfg80211_pmksa *pmksa);
475867fbb16bSSamuel Ortiz 	int	(*del_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
475967fbb16bSSamuel Ortiz 			     struct cfg80211_pmksa *pmksa);
476067fbb16bSSamuel Ortiz 	int	(*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev);
476167fbb16bSSamuel Ortiz 
47629588bbd5SJouni Malinen 	int	(*remain_on_channel)(struct wiphy *wiphy,
476371bbc994SJohannes Berg 				     struct wireless_dev *wdev,
47649588bbd5SJouni Malinen 				     struct ieee80211_channel *chan,
47659588bbd5SJouni Malinen 				     unsigned int duration,
47669588bbd5SJouni Malinen 				     u64 *cookie);
47679588bbd5SJouni Malinen 	int	(*cancel_remain_on_channel)(struct wiphy *wiphy,
476871bbc994SJohannes Berg 					    struct wireless_dev *wdev,
47699588bbd5SJouni Malinen 					    u64 cookie);
47709588bbd5SJouni Malinen 
477171bbc994SJohannes Berg 	int	(*mgmt_tx)(struct wiphy *wiphy, struct wireless_dev *wdev,
4772b176e629SAndrei Otcheretianski 			   struct cfg80211_mgmt_tx_params *params,
4773b176e629SAndrei Otcheretianski 			   u64 *cookie);
4774f7ca38dfSJohannes Berg 	int	(*mgmt_tx_cancel_wait)(struct wiphy *wiphy,
477571bbc994SJohannes Berg 				       struct wireless_dev *wdev,
4776f7ca38dfSJohannes Berg 				       u64 cookie);
4777026331c4SJouni Malinen 
4778bc92afd9SJohannes Berg 	int	(*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev,
4779bc92afd9SJohannes Berg 				  bool enabled, int timeout);
4780d6dc1a38SJuuso Oikarinen 
4781d6dc1a38SJuuso Oikarinen 	int	(*set_cqm_rssi_config)(struct wiphy *wiphy,
4782d6dc1a38SJuuso Oikarinen 				       struct net_device *dev,
4783d6dc1a38SJuuso Oikarinen 				       s32 rssi_thold, u32 rssi_hyst);
4784271733cfSJohannes Berg 
47854a4b8169SAndrew Zaborowski 	int	(*set_cqm_rssi_range_config)(struct wiphy *wiphy,
47864a4b8169SAndrew Zaborowski 					     struct net_device *dev,
47874a4b8169SAndrew Zaborowski 					     s32 rssi_low, s32 rssi_high);
47884a4b8169SAndrew Zaborowski 
478984f10708SThomas Pedersen 	int	(*set_cqm_txe_config)(struct wiphy *wiphy,
479084f10708SThomas Pedersen 				      struct net_device *dev,
479184f10708SThomas Pedersen 				      u32 rate, u32 pkts, u32 intvl);
479284f10708SThomas Pedersen 
47936cd536feSJohannes Berg 	void	(*update_mgmt_frame_registrations)(struct wiphy *wiphy,
479471bbc994SJohannes Berg 						   struct wireless_dev *wdev,
47956cd536feSJohannes Berg 						   struct mgmt_frame_regs *upd);
4796afe0cbf8SBruno Randolf 
4797afe0cbf8SBruno Randolf 	int	(*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant);
4798afe0cbf8SBruno Randolf 	int	(*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant);
47993677713bSJohn W. Linville 
4800807f8a8cSLuciano Coelho 	int	(*sched_scan_start)(struct wiphy *wiphy,
4801807f8a8cSLuciano Coelho 				struct net_device *dev,
4802807f8a8cSLuciano Coelho 				struct cfg80211_sched_scan_request *request);
48033a3ecf1dSArend Van Spriel 	int	(*sched_scan_stop)(struct wiphy *wiphy, struct net_device *dev,
48043a3ecf1dSArend Van Spriel 				   u64 reqid);
4805e5497d76SJohannes Berg 
4806e5497d76SJohannes Berg 	int	(*set_rekey_data)(struct wiphy *wiphy, struct net_device *dev,
4807e5497d76SJohannes Berg 				  struct cfg80211_gtk_rekey_data *data);
4808109086ceSArik Nemtsov 
4809109086ceSArik Nemtsov 	int	(*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev,
4810c6112046SMukesh Sisodiya 			     const u8 *peer, int link_id,
4811c6112046SMukesh Sisodiya 			     u8 action_code, u8 dialog_token, u16 status_code,
4812c6112046SMukesh Sisodiya 			     u32 peer_capability, bool initiator,
4813c6112046SMukesh Sisodiya 			     const u8 *buf, size_t len);
4814109086ceSArik Nemtsov 	int	(*tdls_oper)(struct wiphy *wiphy, struct net_device *dev,
48153b3a0162SJohannes Berg 			     const u8 *peer, enum nl80211_tdls_operation oper);
48167f6cf311SJohannes Berg 
48177f6cf311SJohannes Berg 	int	(*probe_client)(struct wiphy *wiphy, struct net_device *dev,
48187f6cf311SJohannes Berg 				const u8 *peer, u64 *cookie);
4819e999882aSJohannes Berg 
48201d9d9213SSimon Wunderlich 	int	(*set_noack_map)(struct wiphy *wiphy,
48211d9d9213SSimon Wunderlich 				  struct net_device *dev,
48221d9d9213SSimon Wunderlich 				  u16 noack_map);
48231d9d9213SSimon Wunderlich 
4824683b6d3bSJohannes Berg 	int	(*get_channel)(struct wiphy *wiphy,
48255b7ccaf3SJohannes Berg 			       struct wireless_dev *wdev,
48267b0a0e3cSJohannes Berg 			       unsigned int link_id,
4827683b6d3bSJohannes Berg 			       struct cfg80211_chan_def *chandef);
482898104fdeSJohannes Berg 
482998104fdeSJohannes Berg 	int	(*start_p2p_device)(struct wiphy *wiphy,
483098104fdeSJohannes Berg 				    struct wireless_dev *wdev);
483198104fdeSJohannes Berg 	void	(*stop_p2p_device)(struct wiphy *wiphy,
483298104fdeSJohannes Berg 				   struct wireless_dev *wdev);
483377765eafSVasanthakumar Thiagarajan 
483477765eafSVasanthakumar Thiagarajan 	int	(*set_mac_acl)(struct wiphy *wiphy, struct net_device *dev,
483577765eafSVasanthakumar Thiagarajan 			       const struct cfg80211_acl_data *params);
483604f39047SSimon Wunderlich 
483704f39047SSimon Wunderlich 	int	(*start_radar_detection)(struct wiphy *wiphy,
483804f39047SSimon Wunderlich 					 struct net_device *dev,
483931559f35SJanusz Dziedzic 					 struct cfg80211_chan_def *chandef,
484081f67d60SAditya Kumar Singh 					 u32 cac_time_ms, int link_id);
484126ec17a1SOrr Mazor 	void	(*end_cac)(struct wiphy *wiphy,
484281f67d60SAditya Kumar Singh 			   struct net_device *dev, unsigned int link_id);
4843355199e0SJouni Malinen 	int	(*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev,
4844355199e0SJouni Malinen 				 struct cfg80211_update_ft_ies_params *ftie);
48455de17984SArend van Spriel 	int	(*crit_proto_start)(struct wiphy *wiphy,
48465de17984SArend van Spriel 				    struct wireless_dev *wdev,
48475de17984SArend van Spriel 				    enum nl80211_crit_proto_id protocol,
48485de17984SArend van Spriel 				    u16 duration);
48495de17984SArend van Spriel 	void	(*crit_proto_stop)(struct wiphy *wiphy,
48505de17984SArend van Spriel 				   struct wireless_dev *wdev);
4851be29b99aSAmitkumar Karwar 	int	(*set_coalesce)(struct wiphy *wiphy,
4852be29b99aSAmitkumar Karwar 				struct cfg80211_coalesce *coalesce);
485316ef1fe2SSimon Wunderlich 
485416ef1fe2SSimon Wunderlich 	int	(*channel_switch)(struct wiphy *wiphy,
485516ef1fe2SSimon Wunderlich 				  struct net_device *dev,
485616ef1fe2SSimon Wunderlich 				  struct cfg80211_csa_settings *params);
4857e16821bcSJouni Malinen 
4858fa9ffc74SKyeyoon Park 	int     (*set_qos_map)(struct wiphy *wiphy,
4859fa9ffc74SKyeyoon Park 			       struct net_device *dev,
4860fa9ffc74SKyeyoon Park 			       struct cfg80211_qos_map *qos_map);
4861e16821bcSJouni Malinen 
4862e16821bcSJouni Malinen 	int	(*set_ap_chanwidth)(struct wiphy *wiphy, struct net_device *dev,
48637b0a0e3cSJohannes Berg 				    unsigned int link_id,
4864e16821bcSJouni Malinen 				    struct cfg80211_chan_def *chandef);
4865960d01acSJohannes Berg 
4866960d01acSJohannes Berg 	int	(*add_tx_ts)(struct wiphy *wiphy, struct net_device *dev,
4867960d01acSJohannes Berg 			     u8 tsid, const u8 *peer, u8 user_prio,
4868960d01acSJohannes Berg 			     u16 admitted_time);
4869960d01acSJohannes Berg 	int	(*del_tx_ts)(struct wiphy *wiphy, struct net_device *dev,
4870960d01acSJohannes Berg 			     u8 tsid, const u8 *peer);
48711057d35eSArik Nemtsov 
48721057d35eSArik Nemtsov 	int	(*tdls_channel_switch)(struct wiphy *wiphy,
48731057d35eSArik Nemtsov 				       struct net_device *dev,
48741057d35eSArik Nemtsov 				       const u8 *addr, u8 oper_class,
48751057d35eSArik Nemtsov 				       struct cfg80211_chan_def *chandef);
48761057d35eSArik Nemtsov 	void	(*tdls_cancel_channel_switch)(struct wiphy *wiphy,
48771057d35eSArik Nemtsov 					      struct net_device *dev,
48781057d35eSArik Nemtsov 					      const u8 *addr);
4879cb3b7d87SAyala Beker 	int	(*start_nan)(struct wiphy *wiphy, struct wireless_dev *wdev,
4880cb3b7d87SAyala Beker 			     struct cfg80211_nan_conf *conf);
4881cb3b7d87SAyala Beker 	void	(*stop_nan)(struct wiphy *wiphy, struct wireless_dev *wdev);
4882a442b761SAyala Beker 	int	(*add_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev,
4883a442b761SAyala Beker 				struct cfg80211_nan_func *nan_func);
4884a442b761SAyala Beker 	void	(*del_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev,
4885a442b761SAyala Beker 			       u64 cookie);
4886a5a9dcf2SAyala Beker 	int	(*nan_change_conf)(struct wiphy *wiphy,
4887a5a9dcf2SAyala Beker 				   struct wireless_dev *wdev,
4888a5a9dcf2SAyala Beker 				   struct cfg80211_nan_conf *conf,
4889a5a9dcf2SAyala Beker 				   u32 changes);
4890ce0ce13aSMichael Braun 
4891ce0ce13aSMichael Braun 	int	(*set_multicast_to_unicast)(struct wiphy *wiphy,
4892ce0ce13aSMichael Braun 					    struct net_device *dev,
4893ce0ce13aSMichael Braun 					    const bool enabled);
48943a00df57SAvraham Stern 
489552539ca8SToke Høiland-Jørgensen 	int	(*get_txq_stats)(struct wiphy *wiphy,
489652539ca8SToke Høiland-Jørgensen 				 struct wireless_dev *wdev,
489752539ca8SToke Høiland-Jørgensen 				 struct cfg80211_txq_stats *txqstats);
489852539ca8SToke Høiland-Jørgensen 
48993a00df57SAvraham Stern 	int	(*set_pmk)(struct wiphy *wiphy, struct net_device *dev,
49003a00df57SAvraham Stern 			   const struct cfg80211_pmk_conf *conf);
49013a00df57SAvraham Stern 	int	(*del_pmk)(struct wiphy *wiphy, struct net_device *dev,
49023a00df57SAvraham Stern 			   const u8 *aa);
490340cbfa90SSrinivas Dasari 	int     (*external_auth)(struct wiphy *wiphy, struct net_device *dev,
490440cbfa90SSrinivas Dasari 				 struct cfg80211_external_auth_params *params);
49052576a9acSDenis Kenzior 
49062576a9acSDenis Kenzior 	int	(*tx_control_port)(struct wiphy *wiphy,
49072576a9acSDenis Kenzior 				   struct net_device *dev,
49082576a9acSDenis Kenzior 				   const u8 *buf, size_t len,
49098d74a623SJohannes Berg 				   const u8 *dest, const __be16 proto,
491067207babSAndrei Otcheretianski 				   const bool noencrypt, int link_id,
4911dca9ca2dSMarkus Theil 				   u64 *cookie);
491281e54d08SPradeep Kumar Chitrapu 
491381e54d08SPradeep Kumar Chitrapu 	int	(*get_ftm_responder_stats)(struct wiphy *wiphy,
491481e54d08SPradeep Kumar Chitrapu 				struct net_device *dev,
491581e54d08SPradeep Kumar Chitrapu 				struct cfg80211_ftm_responder_stats *ftm_stats);
49169bb7e0f2SJohannes Berg 
49179bb7e0f2SJohannes Berg 	int	(*start_pmsr)(struct wiphy *wiphy, struct wireless_dev *wdev,
49189bb7e0f2SJohannes Berg 			      struct cfg80211_pmsr_request *request);
49199bb7e0f2SJohannes Berg 	void	(*abort_pmsr)(struct wiphy *wiphy, struct wireless_dev *wdev,
49209bb7e0f2SJohannes Berg 			      struct cfg80211_pmsr_request *request);
4921cb74e977SSunil Dutt 	int	(*update_owe_info)(struct wiphy *wiphy, struct net_device *dev,
4922cb74e977SSunil Dutt 				   struct cfg80211_update_owe_info *owe_info);
49235ab92e7fSRajkumar Manoharan 	int	(*probe_mesh_link)(struct wiphy *wiphy, struct net_device *dev,
49245ab92e7fSRajkumar Manoharan 				   const u8 *buf, size_t len);
492577f576deSTamizh chelvam 	int     (*set_tid_config)(struct wiphy *wiphy, struct net_device *dev,
49263710a8a6SJohannes Berg 				  struct cfg80211_tid_config *tid_conf);
492777f576deSTamizh chelvam 	int	(*reset_tid_config)(struct wiphy *wiphy, struct net_device *dev,
49283710a8a6SJohannes Berg 				    const u8 *peer, u8 tids);
49296bdb68ceSCarl Huang 	int	(*set_sar_specs)(struct wiphy *wiphy,
49306bdb68ceSCarl Huang 				 struct cfg80211_sar_specs *sar);
49310d2ab3aeSJohn Crispin 	int	(*color_change)(struct wiphy *wiphy,
49320d2ab3aeSJohn Crispin 				struct net_device *dev,
49330d2ab3aeSJohn Crispin 				struct cfg80211_color_change_settings *params);
4934e306784aSSubrat Mishra 	int     (*set_fils_aad)(struct wiphy *wiphy, struct net_device *dev,
4935e306784aSSubrat Mishra 				struct cfg80211_fils_aad *fils_aad);
4936a95bfb87SLorenzo Bianconi 	int	(*set_radar_background)(struct wiphy *wiphy,
4937bc2dfc02SLorenzo Bianconi 					struct cfg80211_chan_def *chandef);
4938577e5b8cSShaul Triebitz 	int	(*add_link_station)(struct wiphy *wiphy, struct net_device *dev,
4939577e5b8cSShaul Triebitz 				    struct link_station_parameters *params);
4940577e5b8cSShaul Triebitz 	int	(*mod_link_station)(struct wiphy *wiphy, struct net_device *dev,
4941577e5b8cSShaul Triebitz 				    struct link_station_parameters *params);
4942577e5b8cSShaul Triebitz 	int	(*del_link_station)(struct wiphy *wiphy, struct net_device *dev,
4943577e5b8cSShaul Triebitz 				    struct link_station_del_parameters *params);
4944cbbaf2bbSAvraham Stern 	int	(*set_hw_timestamp)(struct wiphy *wiphy, struct net_device *dev,
4945cbbaf2bbSAvraham Stern 				    struct cfg80211_set_hw_timestamp *hwts);
4946b61e6b41SIlan Peer 	int	(*set_ttlm)(struct wiphy *wiphy, struct net_device *dev,
4947b61e6b41SIlan Peer 			    struct cfg80211_ttlm_params *params);
4948abb4cfe3SFelix Fietkau 	u32	(*get_radio_mask)(struct wiphy *wiphy, struct net_device *dev);
4949704232c2SJohannes Berg };
4950704232c2SJohannes Berg 
4951d3236553SJohannes Berg /*
4952d3236553SJohannes Berg  * wireless hardware and networking interfaces structures
4953d3236553SJohannes Berg  * and registration/helper functions
4954d3236553SJohannes Berg  */
4955d3236553SJohannes Berg 
4956d3236553SJohannes Berg /**
49575be83de5SJohannes Berg  * enum wiphy_flags - wiphy capability flags
49585be83de5SJohannes Berg  *
4959c8cb5b85STova Mussai  * @WIPHY_FLAG_SPLIT_SCAN_6GHZ: if set to true, the scan request will be split
49607b5e25b8SJohannes Berg  *	 into two, first for legacy bands and second for 6 GHz.
49615be83de5SJohannes Berg  * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this
49625be83de5SJohannes Berg  *	wiphy at all
49635be83de5SJohannes Berg  * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled
49645be83de5SJohannes Berg  *	by default -- this flag will be set depending on the kernel's default
49655be83de5SJohannes Berg  *	on wiphy_new(), but can be changed by the driver if it has a good
49665be83de5SJohannes Berg  *	reason to override the default
49679bc383deSJohannes Berg  * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station
496833d915d9SManikanta Pubbisetty  *	on a VLAN interface). This flag also serves an extra purpose of
496933d915d9SManikanta Pubbisetty  *	supporting 4ADDR AP mode on devices which do not support AP/VLAN iftype.
49709bc383deSJohannes Berg  * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station
4971c0692b8fSJohannes Berg  * @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the
4972c0692b8fSJohannes Berg  *	control port protocol ethertype. The device also honours the
4973c0692b8fSJohannes Berg  *	control_port_no_encrypt flag.
4974e31b8213SJohannes Berg  * @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN.
497515d5dda6SJavier Cardona  * @WIPHY_FLAG_MESH_AUTH: The device supports mesh authentication by routing
497615d5dda6SJavier Cardona  *	auth frames to userspace. See @NL80211_MESH_SETUP_USERSPACE_AUTH.
4977f4b34b55SVivek Natarajan  * @WIPHY_FLAG_SUPPORTS_FW_ROAM: The device supports roaming feature in the
4978f4b34b55SVivek Natarajan  *	firmware.
4979cedb5412SEliad Peller  * @WIPHY_FLAG_AP_UAPSD: The device supports uapsd on AP.
4980109086ceSArik Nemtsov  * @WIPHY_FLAG_SUPPORTS_TDLS: The device supports TDLS (802.11z) operation.
4981109086ceSArik Nemtsov  * @WIPHY_FLAG_TDLS_EXTERNAL_SETUP: The device does not handle TDLS (802.11z)
4982109086ceSArik Nemtsov  *	link setup/discovery operations internally. Setup, discovery and
4983109086ceSArik Nemtsov  *	teardown packets should be sent through the @NL80211_CMD_TDLS_MGMT
4984109086ceSArik Nemtsov  *	command. When this flag is not set, @NL80211_CMD_TDLS_OPER should be
4985109086ceSArik Nemtsov  *	used for asking the driver/firmware to perform a TDLS operation.
4986562a7480SJohannes Berg  * @WIPHY_FLAG_HAVE_AP_SME: device integrates AP SME
49875e760230SJohannes Berg  * @WIPHY_FLAG_REPORTS_OBSS: the device will report beacons from other BSSes
49885e760230SJohannes Berg  *	when there are virtual interfaces in AP mode by calling
49895e760230SJohannes Berg  *	cfg80211_report_obss_beacon().
499087bbbe22SArik Nemtsov  * @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD: When operating as an AP, the device
499187bbbe22SArik Nemtsov  *	responds to probe-requests in hardware.
49927c4ef712SJohannes Berg  * @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX.
49937c4ef712SJohannes Berg  * @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call.
49942f301ab2SSimon Wunderlich  * @WIPHY_FLAG_SUPPORTS_5_10_MHZ: Device supports 5 MHz and 10 MHz channels.
499516ef1fe2SSimon Wunderlich  * @WIPHY_FLAG_HAS_CHANNEL_SWITCH: Device supports channel switch in
499616ef1fe2SSimon Wunderlich  *	beaconing mode (AP, IBSS, Mesh, ...).
4997093a48d2SNathan Errera  * @WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK: The device supports bigger kek and kck keys
49987b0a0e3cSJohannes Berg  * @WIPHY_FLAG_SUPPORTS_MLO: This is a temporary flag gating the MLO APIs,
49997b0a0e3cSJohannes Berg  *	in order to not have them reachable in normal drivers, until we have
50007b0a0e3cSJohannes Berg  *	complete feature/interface combinations/etc. advertisement. No driver
50017b0a0e3cSJohannes Berg  *	should set this flag for now.
5002648fba79SShivani Baranwal  * @WIPHY_FLAG_SUPPORTS_EXT_KCK_32: The device supports 32-byte KCK keys.
5003d99975c4SWen Gong  * @WIPHY_FLAG_NOTIFY_REGDOM_BY_DRIVER: The device could handle reg notify for
5004d99975c4SWen Gong  *	NL80211_REGDOM_SET_BY_DRIVER.
5005b13b6bbfSAbhishek Kumar  * @WIPHY_FLAG_CHANNEL_CHANGE_ON_BEACON: reg_call_notifier() is called if driver
5006b13b6bbfSAbhishek Kumar  *	set this flag to update channels on beacon hints.
5007d02a12b8SJohannes Berg  * @WIPHY_FLAG_SUPPORTS_NSTR_NONPRIMARY: support connection to non-primary link
5008d02a12b8SJohannes Berg  *	of an NSTR mobile AP MLD.
5009be23b2d7SJohannes Berg  * @WIPHY_FLAG_DISABLE_WEXT: disable wireless extensions for this device
50105be83de5SJohannes Berg  */
50115be83de5SJohannes Berg enum wiphy_flags {
5012093a48d2SNathan Errera 	WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK		= BIT(0),
50137b0a0e3cSJohannes Berg 	WIPHY_FLAG_SUPPORTS_MLO			= BIT(1),
5014c8cb5b85STova Mussai 	WIPHY_FLAG_SPLIT_SCAN_6GHZ		= BIT(2),
50155be83de5SJohannes Berg 	WIPHY_FLAG_NETNS_OK			= BIT(3),
50165be83de5SJohannes Berg 	WIPHY_FLAG_PS_ON_BY_DEFAULT		= BIT(4),
50179bc383deSJohannes Berg 	WIPHY_FLAG_4ADDR_AP			= BIT(5),
50189bc383deSJohannes Berg 	WIPHY_FLAG_4ADDR_STATION		= BIT(6),
5019c0692b8fSJohannes Berg 	WIPHY_FLAG_CONTROL_PORT_PROTOCOL	= BIT(7),
5020309075cfSJussi Kivilinna 	WIPHY_FLAG_IBSS_RSN			= BIT(8),
5021be23b2d7SJohannes Berg 	WIPHY_FLAG_DISABLE_WEXT			= BIT(9),
502215d5dda6SJavier Cardona 	WIPHY_FLAG_MESH_AUTH			= BIT(10),
5023648fba79SShivani Baranwal 	WIPHY_FLAG_SUPPORTS_EXT_KCK_32          = BIT(11),
5024d02a12b8SJohannes Berg 	WIPHY_FLAG_SUPPORTS_NSTR_NONPRIMARY	= BIT(12),
5025f4b34b55SVivek Natarajan 	WIPHY_FLAG_SUPPORTS_FW_ROAM		= BIT(13),
5026cedb5412SEliad Peller 	WIPHY_FLAG_AP_UAPSD			= BIT(14),
5027109086ceSArik Nemtsov 	WIPHY_FLAG_SUPPORTS_TDLS		= BIT(15),
5028109086ceSArik Nemtsov 	WIPHY_FLAG_TDLS_EXTERNAL_SETUP		= BIT(16),
5029562a7480SJohannes Berg 	WIPHY_FLAG_HAVE_AP_SME			= BIT(17),
50305e760230SJohannes Berg 	WIPHY_FLAG_REPORTS_OBSS			= BIT(18),
503187bbbe22SArik Nemtsov 	WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD	= BIT(19),
50327c4ef712SJohannes Berg 	WIPHY_FLAG_OFFCHAN_TX			= BIT(20),
50337c4ef712SJohannes Berg 	WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL	= BIT(21),
50342f301ab2SSimon Wunderlich 	WIPHY_FLAG_SUPPORTS_5_10_MHZ		= BIT(22),
503516ef1fe2SSimon Wunderlich 	WIPHY_FLAG_HAS_CHANNEL_SWITCH		= BIT(23),
5036d99975c4SWen Gong 	WIPHY_FLAG_NOTIFY_REGDOM_BY_DRIVER	= BIT(24),
5037b13b6bbfSAbhishek Kumar 	WIPHY_FLAG_CHANNEL_CHANGE_ON_BEACON     = BIT(25),
50387527a782SJohannes Berg };
50397527a782SJohannes Berg 
50407527a782SJohannes Berg /**
50417527a782SJohannes Berg  * struct ieee80211_iface_limit - limit on certain interface types
50427527a782SJohannes Berg  * @max: maximum number of interfaces of these types
50437527a782SJohannes Berg  * @types: interface types (bits)
50447527a782SJohannes Berg  */
50457527a782SJohannes Berg struct ieee80211_iface_limit {
50467527a782SJohannes Berg 	u16 max;
50477527a782SJohannes Berg 	u16 types;
50487527a782SJohannes Berg };
50497527a782SJohannes Berg 
50507527a782SJohannes Berg /**
50517527a782SJohannes Berg  * struct ieee80211_iface_combination - possible interface combination
50527527a782SJohannes Berg  *
5053b80edbc1SLuciano Coelho  * With this structure the driver can describe which interface
5054e6c06ca8SFelix Fietkau  * combinations it supports concurrently. When set in a struct wiphy_radio,
5055e6c06ca8SFelix Fietkau  * the combinations refer to combinations of interfaces currently active on
5056e6c06ca8SFelix Fietkau  * that radio.
50577527a782SJohannes Berg  *
5058b80edbc1SLuciano Coelho  * Examples:
5059b80edbc1SLuciano Coelho  *
5060b80edbc1SLuciano Coelho  * 1. Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total:
50617527a782SJohannes Berg  *
5062819bf593SJohannes Berg  *    .. code-block:: c
5063819bf593SJohannes Berg  *
50647527a782SJohannes Berg  *	struct ieee80211_iface_limit limits1[] = {
50657527a782SJohannes Berg  *		{ .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
50664d371d6eSPhilipp Hortmann  *		{ .max = 1, .types = BIT(NL80211_IFTYPE_AP), },
50677527a782SJohannes Berg  *	};
50687527a782SJohannes Berg  *	struct ieee80211_iface_combination combination1 = {
50697527a782SJohannes Berg  *		.limits = limits1,
50707527a782SJohannes Berg  *		.n_limits = ARRAY_SIZE(limits1),
50717527a782SJohannes Berg  *		.max_interfaces = 2,
50727527a782SJohannes Berg  *		.beacon_int_infra_match = true,
50737527a782SJohannes Berg  *	};
50747527a782SJohannes Berg  *
50757527a782SJohannes Berg  *
5076b80edbc1SLuciano Coelho  * 2. Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total:
50777527a782SJohannes Berg  *
5078819bf593SJohannes Berg  *    .. code-block:: c
5079819bf593SJohannes Berg  *
50807527a782SJohannes Berg  *	struct ieee80211_iface_limit limits2[] = {
50817527a782SJohannes Berg  *		{ .max = 8, .types = BIT(NL80211_IFTYPE_AP) |
50827527a782SJohannes Berg  *				     BIT(NL80211_IFTYPE_P2P_GO), },
50837527a782SJohannes Berg  *	};
50847527a782SJohannes Berg  *	struct ieee80211_iface_combination combination2 = {
50857527a782SJohannes Berg  *		.limits = limits2,
50867527a782SJohannes Berg  *		.n_limits = ARRAY_SIZE(limits2),
50877527a782SJohannes Berg  *		.max_interfaces = 8,
50887527a782SJohannes Berg  *		.num_different_channels = 1,
50897527a782SJohannes Berg  *	};
50907527a782SJohannes Berg  *
50917527a782SJohannes Berg  *
5092b80edbc1SLuciano Coelho  * 3. Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total.
5093b80edbc1SLuciano Coelho  *
50947527a782SJohannes Berg  *    This allows for an infrastructure connection and three P2P connections.
50957527a782SJohannes Berg  *
5096819bf593SJohannes Berg  *    .. code-block:: c
5097819bf593SJohannes Berg  *
50987527a782SJohannes Berg  *	struct ieee80211_iface_limit limits3[] = {
50997527a782SJohannes Berg  *		{ .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
51007527a782SJohannes Berg  *		{ .max = 3, .types = BIT(NL80211_IFTYPE_P2P_GO) |
51017527a782SJohannes Berg  *				     BIT(NL80211_IFTYPE_P2P_CLIENT), },
51027527a782SJohannes Berg  *	};
51037527a782SJohannes Berg  *	struct ieee80211_iface_combination combination3 = {
51047527a782SJohannes Berg  *		.limits = limits3,
51057527a782SJohannes Berg  *		.n_limits = ARRAY_SIZE(limits3),
51067527a782SJohannes Berg  *		.max_interfaces = 4,
51077527a782SJohannes Berg  *		.num_different_channels = 2,
51087527a782SJohannes Berg  *	};
5109819bf593SJohannes Berg  *
51107527a782SJohannes Berg  */
51117527a782SJohannes Berg struct ieee80211_iface_combination {
5112c6c94aeaSJohannes Berg 	/**
5113c6c94aeaSJohannes Berg 	 * @limits:
5114c6c94aeaSJohannes Berg 	 * limits for the given interface types
5115c6c94aeaSJohannes Berg 	 */
51167527a782SJohannes Berg 	const struct ieee80211_iface_limit *limits;
5117c6c94aeaSJohannes Berg 
5118c6c94aeaSJohannes Berg 	/**
5119c6c94aeaSJohannes Berg 	 * @num_different_channels:
5120c6c94aeaSJohannes Berg 	 * can use up to this many different channels
5121c6c94aeaSJohannes Berg 	 */
51227527a782SJohannes Berg 	u32 num_different_channels;
5123c6c94aeaSJohannes Berg 
5124c6c94aeaSJohannes Berg 	/**
5125c6c94aeaSJohannes Berg 	 * @max_interfaces:
5126c6c94aeaSJohannes Berg 	 * maximum number of interfaces in total allowed in this group
5127c6c94aeaSJohannes Berg 	 */
51287527a782SJohannes Berg 	u16 max_interfaces;
5129c6c94aeaSJohannes Berg 
5130c6c94aeaSJohannes Berg 	/**
5131c6c94aeaSJohannes Berg 	 * @n_limits:
5132c6c94aeaSJohannes Berg 	 * number of limitations
5133c6c94aeaSJohannes Berg 	 */
51347527a782SJohannes Berg 	u8 n_limits;
5135c6c94aeaSJohannes Berg 
5136c6c94aeaSJohannes Berg 	/**
5137c6c94aeaSJohannes Berg 	 * @beacon_int_infra_match:
5138c6c94aeaSJohannes Berg 	 * In this combination, the beacon intervals between infrastructure
5139c6c94aeaSJohannes Berg 	 * and AP types must match. This is required only in special cases.
5140c6c94aeaSJohannes Berg 	 */
51417527a782SJohannes Berg 	bool beacon_int_infra_match;
5142c6c94aeaSJohannes Berg 
5143c6c94aeaSJohannes Berg 	/**
5144c6c94aeaSJohannes Berg 	 * @radar_detect_widths:
5145c6c94aeaSJohannes Berg 	 * bitmap of channel widths supported for radar detection
5146c6c94aeaSJohannes Berg 	 */
514711c4a075SSimon Wunderlich 	u8 radar_detect_widths;
5148c6c94aeaSJohannes Berg 
5149c6c94aeaSJohannes Berg 	/**
5150c6c94aeaSJohannes Berg 	 * @radar_detect_regions:
5151c6c94aeaSJohannes Berg 	 * bitmap of regions supported for radar detection
5152c6c94aeaSJohannes Berg 	 */
51538c48b50aSFelix Fietkau 	u8 radar_detect_regions;
5154c6c94aeaSJohannes Berg 
5155c6c94aeaSJohannes Berg 	/**
5156c6c94aeaSJohannes Berg 	 * @beacon_int_min_gcd:
5157c6c94aeaSJohannes Berg 	 * This interface combination supports different beacon intervals.
5158c6c94aeaSJohannes Berg 	 *
5159c6c94aeaSJohannes Berg 	 * = 0
5160c6c94aeaSJohannes Berg 	 *   all beacon intervals for different interface must be same.
5161c6c94aeaSJohannes Berg 	 * > 0
5162c6c94aeaSJohannes Berg 	 *   any beacon interval for the interface part of this combination AND
5163c6c94aeaSJohannes Berg 	 *   GCD of all beacon intervals from beaconing interfaces of this
5164c6c94aeaSJohannes Berg 	 *   combination must be greater or equal to this value.
5165c6c94aeaSJohannes Berg 	 */
51660c317a02SPurushottam Kushwaha 	u32 beacon_int_min_gcd;
51675be83de5SJohannes Berg };
51685be83de5SJohannes Berg 
51692e161f78SJohannes Berg struct ieee80211_txrx_stypes {
51702e161f78SJohannes Berg 	u16 tx, rx;
51712e161f78SJohannes Berg };
51722e161f78SJohannes Berg 
51735be83de5SJohannes Berg /**
5174ff1b6e69SJohannes Berg  * enum wiphy_wowlan_support_flags - WoWLAN support flags
5175ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_ANY: supports wakeup for the special "any"
5176ff1b6e69SJohannes Berg  *	trigger that keeps the device operating as-is and
5177ff1b6e69SJohannes Berg  *	wakes up the host on any activity, for example a
5178ff1b6e69SJohannes Berg  *	received packet that passed filtering; note that the
5179ff1b6e69SJohannes Berg  *	packet should be preserved in that case
5180ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_MAGIC_PKT: supports wakeup on magic packet
5181ff1b6e69SJohannes Berg  *	(see nl80211.h)
5182ff1b6e69SJohannes Berg  * @WIPHY_WOWLAN_DISCONNECT: supports wakeup on disconnect
518377dbbb13SJohannes Berg  * @WIPHY_WOWLAN_SUPPORTS_GTK_REKEY: supports GTK rekeying while asleep
518477dbbb13SJohannes Berg  * @WIPHY_WOWLAN_GTK_REKEY_FAILURE: supports wakeup on GTK rekey failure
518577dbbb13SJohannes Berg  * @WIPHY_WOWLAN_EAP_IDENTITY_REQ: supports wakeup on EAP identity request
518677dbbb13SJohannes Berg  * @WIPHY_WOWLAN_4WAY_HANDSHAKE: supports wakeup on 4-way handshake failure
518777dbbb13SJohannes Berg  * @WIPHY_WOWLAN_RFKILL_RELEASE: supports wakeup on RF-kill release
51888cd4d456SLuciano Coelho  * @WIPHY_WOWLAN_NET_DETECT: supports wakeup on network detection
5189ff1b6e69SJohannes Berg  */
5190ff1b6e69SJohannes Berg enum wiphy_wowlan_support_flags {
5191ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_ANY		= BIT(0),
5192ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_MAGIC_PKT		= BIT(1),
5193ff1b6e69SJohannes Berg 	WIPHY_WOWLAN_DISCONNECT		= BIT(2),
519477dbbb13SJohannes Berg 	WIPHY_WOWLAN_SUPPORTS_GTK_REKEY	= BIT(3),
519577dbbb13SJohannes Berg 	WIPHY_WOWLAN_GTK_REKEY_FAILURE	= BIT(4),
519677dbbb13SJohannes Berg 	WIPHY_WOWLAN_EAP_IDENTITY_REQ	= BIT(5),
519777dbbb13SJohannes Berg 	WIPHY_WOWLAN_4WAY_HANDSHAKE	= BIT(6),
519877dbbb13SJohannes Berg 	WIPHY_WOWLAN_RFKILL_RELEASE	= BIT(7),
51998cd4d456SLuciano Coelho 	WIPHY_WOWLAN_NET_DETECT		= BIT(8),
5200ff1b6e69SJohannes Berg };
5201ff1b6e69SJohannes Berg 
52022a0e047eSJohannes Berg struct wiphy_wowlan_tcp_support {
52032a0e047eSJohannes Berg 	const struct nl80211_wowlan_tcp_data_token_feature *tok;
52042a0e047eSJohannes Berg 	u32 data_payload_max;
52052a0e047eSJohannes Berg 	u32 data_interval_max;
52062a0e047eSJohannes Berg 	u32 wake_payload_max;
52072a0e047eSJohannes Berg 	bool seq;
52082a0e047eSJohannes Berg };
52092a0e047eSJohannes Berg 
5210ff1b6e69SJohannes Berg /**
5211ff1b6e69SJohannes Berg  * struct wiphy_wowlan_support - WoWLAN support data
5212ff1b6e69SJohannes Berg  * @flags: see &enum wiphy_wowlan_support_flags
5213ff1b6e69SJohannes Berg  * @n_patterns: number of supported wakeup patterns
5214ff1b6e69SJohannes Berg  *	(see nl80211.h for the pattern definition)
5215ff1b6e69SJohannes Berg  * @pattern_max_len: maximum length of each pattern
5216ff1b6e69SJohannes Berg  * @pattern_min_len: minimum length of each pattern
5217bb92d199SAmitkumar Karwar  * @max_pkt_offset: maximum Rx packet offset
52188cd4d456SLuciano Coelho  * @max_nd_match_sets: maximum number of matchsets for net-detect,
52198cd4d456SLuciano Coelho  *	similar, but not necessarily identical, to max_match_sets for
52208cd4d456SLuciano Coelho  *	scheduled scans.
52218cd4d456SLuciano Coelho  *	See &struct cfg80211_sched_scan_request.@match_sets for more
52228cd4d456SLuciano Coelho  *	details.
52232a0e047eSJohannes Berg  * @tcp: TCP wakeup support information
5224ff1b6e69SJohannes Berg  */
5225ff1b6e69SJohannes Berg struct wiphy_wowlan_support {
5226ff1b6e69SJohannes Berg 	u32 flags;
5227ff1b6e69SJohannes Berg 	int n_patterns;
5228ff1b6e69SJohannes Berg 	int pattern_max_len;
5229ff1b6e69SJohannes Berg 	int pattern_min_len;
5230bb92d199SAmitkumar Karwar 	int max_pkt_offset;
52318cd4d456SLuciano Coelho 	int max_nd_match_sets;
52322a0e047eSJohannes Berg 	const struct wiphy_wowlan_tcp_support *tcp;
5233ff1b6e69SJohannes Berg };
5234ff1b6e69SJohannes Berg 
5235ff1b6e69SJohannes Berg /**
5236be29b99aSAmitkumar Karwar  * struct wiphy_coalesce_support - coalesce support data
5237be29b99aSAmitkumar Karwar  * @n_rules: maximum number of coalesce rules
5238be29b99aSAmitkumar Karwar  * @max_delay: maximum supported coalescing delay in msecs
5239be29b99aSAmitkumar Karwar  * @n_patterns: number of supported patterns in a rule
5240be29b99aSAmitkumar Karwar  *	(see nl80211.h for the pattern definition)
5241be29b99aSAmitkumar Karwar  * @pattern_max_len: maximum length of each pattern
5242be29b99aSAmitkumar Karwar  * @pattern_min_len: minimum length of each pattern
5243be29b99aSAmitkumar Karwar  * @max_pkt_offset: maximum Rx packet offset
5244be29b99aSAmitkumar Karwar  */
5245be29b99aSAmitkumar Karwar struct wiphy_coalesce_support {
5246be29b99aSAmitkumar Karwar 	int n_rules;
5247be29b99aSAmitkumar Karwar 	int max_delay;
5248be29b99aSAmitkumar Karwar 	int n_patterns;
5249be29b99aSAmitkumar Karwar 	int pattern_max_len;
5250be29b99aSAmitkumar Karwar 	int pattern_min_len;
5251be29b99aSAmitkumar Karwar 	int max_pkt_offset;
5252be29b99aSAmitkumar Karwar };
5253be29b99aSAmitkumar Karwar 
5254be29b99aSAmitkumar Karwar /**
5255ad7e718cSJohannes Berg  * enum wiphy_vendor_command_flags - validation flags for vendor commands
5256ad7e718cSJohannes Berg  * @WIPHY_VENDOR_CMD_NEED_WDEV: vendor command requires wdev
5257ad7e718cSJohannes Berg  * @WIPHY_VENDOR_CMD_NEED_NETDEV: vendor command requires netdev
5258ad7e718cSJohannes Berg  * @WIPHY_VENDOR_CMD_NEED_RUNNING: interface/wdev must be up & running
5259ad7e718cSJohannes Berg  *	(must be combined with %_WDEV or %_NETDEV)
5260ad7e718cSJohannes Berg  */
5261ad7e718cSJohannes Berg enum wiphy_vendor_command_flags {
5262ad7e718cSJohannes Berg 	WIPHY_VENDOR_CMD_NEED_WDEV = BIT(0),
5263ad7e718cSJohannes Berg 	WIPHY_VENDOR_CMD_NEED_NETDEV = BIT(1),
5264ad7e718cSJohannes Berg 	WIPHY_VENDOR_CMD_NEED_RUNNING = BIT(2),
5265ad7e718cSJohannes Berg };
5266ad7e718cSJohannes Berg 
5267ad7e718cSJohannes Berg /**
5268466b9936Stamizhr@codeaurora.org  * enum wiphy_opmode_flag - Station's ht/vht operation mode information flags
5269466b9936Stamizhr@codeaurora.org  *
5270466b9936Stamizhr@codeaurora.org  * @STA_OPMODE_MAX_BW_CHANGED: Max Bandwidth changed
5271466b9936Stamizhr@codeaurora.org  * @STA_OPMODE_SMPS_MODE_CHANGED: SMPS mode changed
5272466b9936Stamizhr@codeaurora.org  * @STA_OPMODE_N_SS_CHANGED: max N_SS (number of spatial streams) changed
5273466b9936Stamizhr@codeaurora.org  *
5274466b9936Stamizhr@codeaurora.org  */
5275466b9936Stamizhr@codeaurora.org enum wiphy_opmode_flag {
5276466b9936Stamizhr@codeaurora.org 	STA_OPMODE_MAX_BW_CHANGED	= BIT(0),
5277466b9936Stamizhr@codeaurora.org 	STA_OPMODE_SMPS_MODE_CHANGED	= BIT(1),
5278466b9936Stamizhr@codeaurora.org 	STA_OPMODE_N_SS_CHANGED		= BIT(2),
5279466b9936Stamizhr@codeaurora.org };
5280466b9936Stamizhr@codeaurora.org 
5281466b9936Stamizhr@codeaurora.org /**
5282466b9936Stamizhr@codeaurora.org  * struct sta_opmode_info - Station's ht/vht operation mode information
5283466b9936Stamizhr@codeaurora.org  * @changed: contains value from &enum wiphy_opmode_flag
52845e78abd0Stamizhr@codeaurora.org  * @smps_mode: New SMPS mode value from &enum nl80211_smps_mode of a station
52855e78abd0Stamizhr@codeaurora.org  * @bw: new max bandwidth value from &enum nl80211_chan_width of a station
5286466b9936Stamizhr@codeaurora.org  * @rx_nss: new rx_nss value of a station
5287466b9936Stamizhr@codeaurora.org  */
5288466b9936Stamizhr@codeaurora.org 
5289466b9936Stamizhr@codeaurora.org struct sta_opmode_info {
5290466b9936Stamizhr@codeaurora.org 	u32 changed;
52915e78abd0Stamizhr@codeaurora.org 	enum nl80211_smps_mode smps_mode;
52925e78abd0Stamizhr@codeaurora.org 	enum nl80211_chan_width bw;
5293466b9936Stamizhr@codeaurora.org 	u8 rx_nss;
5294466b9936Stamizhr@codeaurora.org };
5295466b9936Stamizhr@codeaurora.org 
529691046d63SJohannes Berg #define VENDOR_CMD_RAW_DATA ((const struct nla_policy *)(long)(-ENODATA))
5297901bb989SJohannes Berg 
5298466b9936Stamizhr@codeaurora.org /**
5299ad7e718cSJohannes Berg  * struct wiphy_vendor_command - vendor command definition
5300ad7e718cSJohannes Berg  * @info: vendor command identifying information, as used in nl80211
5301ad7e718cSJohannes Berg  * @flags: flags, see &enum wiphy_vendor_command_flags
5302ad7e718cSJohannes Berg  * @doit: callback for the operation, note that wdev is %NULL if the
5303ad7e718cSJohannes Berg  *	flags didn't ask for a wdev and non-%NULL otherwise; the data
5304ad7e718cSJohannes Berg  *	pointer may be %NULL if userspace provided no data at all
53057bdbe400SJohannes Berg  * @dumpit: dump callback, for transferring bigger/multiple items. The
53067bdbe400SJohannes Berg  *	@storage points to cb->args[5], ie. is preserved over the multiple
53077bdbe400SJohannes Berg  *	dumpit calls.
5308901bb989SJohannes Berg  * @policy: policy pointer for attributes within %NL80211_ATTR_VENDOR_DATA.
5309901bb989SJohannes Berg  *	Set this to %VENDOR_CMD_RAW_DATA if no policy can be given and the
5310901bb989SJohannes Berg  *	attribute is just raw data (e.g. a firmware command).
5311901bb989SJohannes Berg  * @maxattr: highest attribute number in policy
53127bdbe400SJohannes Berg  * It's recommended to not have the same sub command with both @doit and
53137bdbe400SJohannes Berg  * @dumpit, so that userspace can assume certain ones are get and others
53147bdbe400SJohannes Berg  * are used with dump requests.
5315ad7e718cSJohannes Berg  */
5316ad7e718cSJohannes Berg struct wiphy_vendor_command {
5317ad7e718cSJohannes Berg 	struct nl80211_vendor_cmd_info info;
5318ad7e718cSJohannes Berg 	u32 flags;
5319ad7e718cSJohannes Berg 	int (*doit)(struct wiphy *wiphy, struct wireless_dev *wdev,
5320ad7e718cSJohannes Berg 		    const void *data, int data_len);
53217bdbe400SJohannes Berg 	int (*dumpit)(struct wiphy *wiphy, struct wireless_dev *wdev,
53227bdbe400SJohannes Berg 		      struct sk_buff *skb, const void *data, int data_len,
53237bdbe400SJohannes Berg 		      unsigned long *storage);
5324901bb989SJohannes Berg 	const struct nla_policy *policy;
5325901bb989SJohannes Berg 	unsigned int maxattr;
5326ad7e718cSJohannes Berg };
5327ad7e718cSJohannes Berg 
5328ad7e718cSJohannes Berg /**
5329019ae3a9SKanchanapally, Vidyullatha  * struct wiphy_iftype_ext_capab - extended capabilities per interface type
5330019ae3a9SKanchanapally, Vidyullatha  * @iftype: interface type
5331019ae3a9SKanchanapally, Vidyullatha  * @extended_capabilities: extended capabilities supported by the driver,
5332019ae3a9SKanchanapally, Vidyullatha  *	additional capabilities might be supported by userspace; these are the
5333019ae3a9SKanchanapally, Vidyullatha  *	802.11 extended capabilities ("Extended Capabilities element") and are
5334019ae3a9SKanchanapally, Vidyullatha  *	in the same format as in the information element. See IEEE Std
5335019ae3a9SKanchanapally, Vidyullatha  *	802.11-2012 8.4.2.29 for the defined fields.
5336019ae3a9SKanchanapally, Vidyullatha  * @extended_capabilities_mask: mask of the valid values
5337019ae3a9SKanchanapally, Vidyullatha  * @extended_capabilities_len: length of the extended capabilities
53384e9c3af3SJohannes Berg  * @eml_capabilities: EML capabilities (for MLO)
53394e9c3af3SJohannes Berg  * @mld_capa_and_ops: MLD capabilities and operations (for MLO)
5340019ae3a9SKanchanapally, Vidyullatha  */
5341019ae3a9SKanchanapally, Vidyullatha struct wiphy_iftype_ext_capab {
5342019ae3a9SKanchanapally, Vidyullatha 	enum nl80211_iftype iftype;
5343019ae3a9SKanchanapally, Vidyullatha 	const u8 *extended_capabilities;
5344019ae3a9SKanchanapally, Vidyullatha 	const u8 *extended_capabilities_mask;
5345019ae3a9SKanchanapally, Vidyullatha 	u8 extended_capabilities_len;
53464e9c3af3SJohannes Berg 	u16 eml_capabilities;
53474e9c3af3SJohannes Berg 	u16 mld_capa_and_ops;
5348019ae3a9SKanchanapally, Vidyullatha };
5349019ae3a9SKanchanapally, Vidyullatha 
5350019ae3a9SKanchanapally, Vidyullatha /**
53517464f665SJohannes Berg  * cfg80211_get_iftype_ext_capa - lookup interface type extended capability
53527464f665SJohannes Berg  * @wiphy: the wiphy to look up from
53537464f665SJohannes Berg  * @type: the interface type to look up
535462cc206cSJeff Johnson  *
535562cc206cSJeff Johnson  * Return: The extended capability for the given interface @type, may be %NULL
53567464f665SJohannes Berg  */
53577464f665SJohannes Berg const struct wiphy_iftype_ext_capab *
53587464f665SJohannes Berg cfg80211_get_iftype_ext_capa(struct wiphy *wiphy, enum nl80211_iftype type);
53597464f665SJohannes Berg 
53607464f665SJohannes Berg /**
53619bb7e0f2SJohannes Berg  * struct cfg80211_pmsr_capabilities - cfg80211 peer measurement capabilities
53629bb7e0f2SJohannes Berg  * @max_peers: maximum number of peers in a single measurement
53639bb7e0f2SJohannes Berg  * @report_ap_tsf: can report assoc AP's TSF for radio resource measurement
53649bb7e0f2SJohannes Berg  * @randomize_mac_addr: can randomize MAC address for measurement
53652d8b08feSMauro Carvalho Chehab  * @ftm: FTM measurement data
53669bb7e0f2SJohannes Berg  * @ftm.supported: FTM measurement is supported
53679bb7e0f2SJohannes Berg  * @ftm.asap: ASAP-mode is supported
53689bb7e0f2SJohannes Berg  * @ftm.non_asap: non-ASAP-mode is supported
53699bb7e0f2SJohannes Berg  * @ftm.request_lci: can request LCI data
53709bb7e0f2SJohannes Berg  * @ftm.request_civicloc: can request civic location data
53719bb7e0f2SJohannes Berg  * @ftm.preambles: bitmap of preambles supported (&enum nl80211_preamble)
53729bb7e0f2SJohannes Berg  * @ftm.bandwidths: bitmap of bandwidths supported (&enum nl80211_chan_width)
53739bb7e0f2SJohannes Berg  * @ftm.max_bursts_exponent: maximum burst exponent supported
53749bb7e0f2SJohannes Berg  *	(set to -1 if not limited; note that setting this will necessarily
53759bb7e0f2SJohannes Berg  *	forbid using the value 15 to let the responder pick)
53769bb7e0f2SJohannes Berg  * @ftm.max_ftms_per_burst: maximum FTMs per burst supported (set to 0 if
53779bb7e0f2SJohannes Berg  *	not limited)
5378efb5520dSAvraham Stern  * @ftm.trigger_based: trigger based ranging measurement is supported
5379efb5520dSAvraham Stern  * @ftm.non_trigger_based: non trigger based ranging measurement is supported
53809bb7e0f2SJohannes Berg  */
53819bb7e0f2SJohannes Berg struct cfg80211_pmsr_capabilities {
53829bb7e0f2SJohannes Berg 	unsigned int max_peers;
53839bb7e0f2SJohannes Berg 	u8 report_ap_tsf:1,
53849bb7e0f2SJohannes Berg 	   randomize_mac_addr:1;
53859bb7e0f2SJohannes Berg 
53869bb7e0f2SJohannes Berg 	struct {
53879bb7e0f2SJohannes Berg 		u32 preambles;
53889bb7e0f2SJohannes Berg 		u32 bandwidths;
53899bb7e0f2SJohannes Berg 		s8 max_bursts_exponent;
53909bb7e0f2SJohannes Berg 		u8 max_ftms_per_burst;
53919bb7e0f2SJohannes Berg 		u8 supported:1,
53929bb7e0f2SJohannes Berg 		   asap:1,
53939bb7e0f2SJohannes Berg 		   non_asap:1,
53949bb7e0f2SJohannes Berg 		   request_lci:1,
5395efb5520dSAvraham Stern 		   request_civicloc:1,
5396efb5520dSAvraham Stern 		   trigger_based:1,
5397efb5520dSAvraham Stern 		   non_trigger_based:1;
53989bb7e0f2SJohannes Berg 	} ftm;
53999bb7e0f2SJohannes Berg };
54009bb7e0f2SJohannes Berg 
54019bb7e0f2SJohannes Berg /**
5402d6039a34SVeerendranath Jakkam  * struct wiphy_iftype_akm_suites - This structure encapsulates supported akm
5403d6039a34SVeerendranath Jakkam  * suites for interface types defined in @iftypes_mask. Each type in the
5404d6039a34SVeerendranath Jakkam  * @iftypes_mask must be unique across all instances of iftype_akm_suites.
5405d6039a34SVeerendranath Jakkam  *
5406d6039a34SVeerendranath Jakkam  * @iftypes_mask: bitmask of interfaces types
5407d6039a34SVeerendranath Jakkam  * @akm_suites: points to an array of supported akm suites
5408d6039a34SVeerendranath Jakkam  * @n_akm_suites: number of supported AKM suites
5409d6039a34SVeerendranath Jakkam  */
5410d6039a34SVeerendranath Jakkam struct wiphy_iftype_akm_suites {
5411d6039a34SVeerendranath Jakkam 	u16 iftypes_mask;
5412d6039a34SVeerendranath Jakkam 	const u32 *akm_suites;
5413d6039a34SVeerendranath Jakkam 	int n_akm_suites;
5414d6039a34SVeerendranath Jakkam };
5415d6039a34SVeerendranath Jakkam 
5416e6c06ca8SFelix Fietkau /**
5417e6c06ca8SFelix Fietkau  * struct wiphy_radio_freq_range - wiphy frequency range
5418e6c06ca8SFelix Fietkau  * @start_freq:  start range edge frequency (kHz)
5419e6c06ca8SFelix Fietkau  * @end_freq:    end range edge frequency (kHz)
5420e6c06ca8SFelix Fietkau  */
5421e6c06ca8SFelix Fietkau struct wiphy_radio_freq_range {
5422e6c06ca8SFelix Fietkau 	u32 start_freq;
5423e6c06ca8SFelix Fietkau 	u32 end_freq;
5424e6c06ca8SFelix Fietkau };
5425e6c06ca8SFelix Fietkau 
5426e6c06ca8SFelix Fietkau 
5427e6c06ca8SFelix Fietkau /**
5428e6c06ca8SFelix Fietkau  * struct wiphy_radio - physical radio of a wiphy
5429e6c06ca8SFelix Fietkau  * This structure describes a physical radio belonging to a wiphy.
5430e6c06ca8SFelix Fietkau  * It is used to describe concurrent-channel capabilities. Only one channel
5431e6c06ca8SFelix Fietkau  * can be active on the radio described by struct wiphy_radio.
5432e6c06ca8SFelix Fietkau  *
5433e6c06ca8SFelix Fietkau  * @freq_range: frequency range that the radio can operate on.
5434e6c06ca8SFelix Fietkau  * @n_freq_range: number of elements in @freq_range
5435e6c06ca8SFelix Fietkau  *
5436e6c06ca8SFelix Fietkau  * @iface_combinations: Valid interface combinations array, should not
5437e6c06ca8SFelix Fietkau  *	list single interface types.
5438e6c06ca8SFelix Fietkau  * @n_iface_combinations: number of entries in @iface_combinations array.
5439e6c06ca8SFelix Fietkau  */
5440e6c06ca8SFelix Fietkau struct wiphy_radio {
5441e6c06ca8SFelix Fietkau 	const struct wiphy_radio_freq_range *freq_range;
5442e6c06ca8SFelix Fietkau 	int n_freq_range;
5443e6c06ca8SFelix Fietkau 
5444e6c06ca8SFelix Fietkau 	const struct ieee80211_iface_combination *iface_combinations;
5445e6c06ca8SFelix Fietkau 	int n_iface_combinations;
5446e6c06ca8SFelix Fietkau };
5447e6c06ca8SFelix Fietkau 
5448cbbaf2bbSAvraham Stern #define CFG80211_HW_TIMESTAMP_ALL_PEERS	0xffff
5449cbbaf2bbSAvraham Stern 
5450d6039a34SVeerendranath Jakkam /**
54515be83de5SJohannes Berg  * struct wiphy - wireless hardware description
5452a05829a7SJohannes Berg  * @mtx: mutex for the data (structures) of this device
54532784fe91SLuis R. Rodriguez  * @reg_notifier: the driver's regulatory notification callback,
54542784fe91SLuis R. Rodriguez  *	note that if your driver uses wiphy_apply_custom_regulatory()
54552784fe91SLuis R. Rodriguez  *	the reg_notifier's request can be passed as NULL
5456d3236553SJohannes Berg  * @regd: the driver's regulatory domain, if one was requested via
5457d3236553SJohannes Berg  *	the regulatory_hint() API. This can be used by the driver
5458d3236553SJohannes Berg  *	on the reg_notifier() if it chooses to ignore future
5459d3236553SJohannes Berg  *	regulatory domain changes caused by other drivers.
5460d3236553SJohannes Berg  * @signal_type: signal type reported in &struct cfg80211_bss.
5461d3236553SJohannes Berg  * @cipher_suites: supported cipher suites
5462d3236553SJohannes Berg  * @n_cipher_suites: number of supported cipher suites
5463d6039a34SVeerendranath Jakkam  * @akm_suites: supported AKM suites. These are the default AKMs supported if
5464d6039a34SVeerendranath Jakkam  *	the supported AKMs not advertized for a specific interface type in
5465d6039a34SVeerendranath Jakkam  *	iftype_akm_suites.
5466ab4dfa20SVeerendranath Jakkam  * @n_akm_suites: number of supported AKM suites
5467d6039a34SVeerendranath Jakkam  * @iftype_akm_suites: array of supported akm suites info per interface type.
5468d6039a34SVeerendranath Jakkam  *	Note that the bits in @iftypes_mask inside this structure cannot
5469d6039a34SVeerendranath Jakkam  *	overlap (i.e. only one occurrence of each type is allowed across all
5470d6039a34SVeerendranath Jakkam  *	instances of iftype_akm_suites).
5471d6039a34SVeerendranath Jakkam  * @num_iftype_akm_suites: number of interface types for which supported akm
5472d6039a34SVeerendranath Jakkam  *	suites are specified separately.
5473b9a5f8caSJouni Malinen  * @retry_short: Retry limit for short frames (dot11ShortRetryLimit)
5474b9a5f8caSJouni Malinen  * @retry_long: Retry limit for long frames (dot11LongRetryLimit)
5475b9a5f8caSJouni Malinen  * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold);
5476b9a5f8caSJouni Malinen  *	-1 = fragmentation disabled, only odd values >= 256 used
5477b9a5f8caSJouni Malinen  * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled
5478abe37c4bSJohannes Berg  * @_net: the network namespace this wiphy currently lives in
5479ef15aac6SJohannes Berg  * @perm_addr: permanent MAC address of this device
5480ef15aac6SJohannes Berg  * @addr_mask: If the device supports multiple MAC addresses by masking,
5481ef15aac6SJohannes Berg  *	set this to a mask with variable bits set to 1, e.g. if the last
54820fcf8ac5SLuciano Coelho  *	four bits are variable then set it to 00-00-00-00-00-0f. The actual
5483ef15aac6SJohannes Berg  *	variable bits shall be determined by the interfaces added, with
5484ef15aac6SJohannes Berg  *	interfaces not matching the mask being rejected to be brought up.
5485ef15aac6SJohannes Berg  * @n_addresses: number of addresses in @addresses.
5486ef15aac6SJohannes Berg  * @addresses: If the device has more than one address, set this pointer
5487ef15aac6SJohannes Berg  *	to a list of addresses (6 bytes each). The first one will be used
5488ef15aac6SJohannes Berg  *	by default for perm_addr. In this case, the mask should be set to
5489ef15aac6SJohannes Berg  *	all-zeroes. In this case it is assumed that the device can handle
5490ef15aac6SJohannes Berg  *	the same number of arbitrary MAC addresses.
5491fd235913SRandy Dunlap  * @registered: protects ->resume and ->suspend sysfs callbacks against
5492fd235913SRandy Dunlap  *	unregister hardware
5493edf77192SJérôme Pouiller  * @debugfsdir: debugfs directory used for this wiphy (ieee80211/<wiphyname>).
5494edf77192SJérôme Pouiller  *	It will be renamed automatically on wiphy renames
549515bc6dfbSJérôme Pouiller  * @dev: (virtual) struct device for this wiphy. The item in
549615bc6dfbSJérôme Pouiller  *	/sys/class/ieee80211/ points to this. You need use set_wiphy_dev()
549715bc6dfbSJérôme Pouiller  *	(see below).
5498abe37c4bSJohannes Berg  * @wext: wireless extension handlers
5499abe37c4bSJohannes Berg  * @priv: driver private data (sized according to wiphy_new() parameter)
5500abe37c4bSJohannes Berg  * @interface_modes: bitmask of interfaces types valid for this wiphy,
5501abe37c4bSJohannes Berg  *	must be set by driver
55027527a782SJohannes Berg  * @iface_combinations: Valid interface combinations array, should not
55037527a782SJohannes Berg  *	list single interface types.
55047527a782SJohannes Berg  * @n_iface_combinations: number of entries in @iface_combinations array.
55057527a782SJohannes Berg  * @software_iftypes: bitmask of software interface types, these are not
55067527a782SJohannes Berg  *	subject to any restrictions since they are purely managed in SW.
5507abe37c4bSJohannes Berg  * @flags: wiphy flags, see &enum wiphy_flags
5508a2f73b6cSLuis R. Rodriguez  * @regulatory_flags: wiphy regulatory flags, see
5509a2f73b6cSLuis R. Rodriguez  *	&enum ieee80211_regulatory_flags
55101f074bd8SJohannes Berg  * @features: features advertised to nl80211, see &enum nl80211_feature_flags.
5511d75bb06bSGautam Kumar Shukla  * @ext_features: extended features advertised to nl80211, see
5512d75bb06bSGautam Kumar Shukla  *	&enum nl80211_ext_feature_index.
5513abe37c4bSJohannes Berg  * @bss_priv_size: each BSS struct has private data allocated with it,
5514abe37c4bSJohannes Berg  *	this variable determines its size
5515abe37c4bSJohannes Berg  * @max_scan_ssids: maximum number of SSIDs the device can scan for in
5516abe37c4bSJohannes Berg  *	any given scan
5517ca986ad9SArend Van Spriel  * @max_sched_scan_reqs: maximum number of scheduled scan requests that
5518ca986ad9SArend Van Spriel  *	the device can run concurrently.
551993b6aa69SLuciano Coelho  * @max_sched_scan_ssids: maximum number of SSIDs the device can scan
552093b6aa69SLuciano Coelho  *	for in any given scheduled scan
5521a1f1c21cSLuciano Coelho  * @max_match_sets: maximum number of match sets the device can handle
5522a1f1c21cSLuciano Coelho  *	when performing a scheduled scan, 0 if filtering is not
5523a1f1c21cSLuciano Coelho  *	supported.
5524abe37c4bSJohannes Berg  * @max_scan_ie_len: maximum length of user-controlled IEs device can
5525abe37c4bSJohannes Berg  *	add to probe request frames transmitted during a scan, must not
5526abe37c4bSJohannes Berg  *	include fixed IEs like supported rates
55275a865badSLuciano Coelho  * @max_sched_scan_ie_len: same as max_scan_ie_len, but for scheduled
55285a865badSLuciano Coelho  *	scans
55293b06d277SAvraham Stern  * @max_sched_scan_plans: maximum number of scan plans (scan interval and number
55303b06d277SAvraham Stern  *	of iterations) for scheduled scan supported by the device.
55313b06d277SAvraham Stern  * @max_sched_scan_plan_interval: maximum interval (in seconds) for a
55323b06d277SAvraham Stern  *	single scan plan supported by the device.
55333b06d277SAvraham Stern  * @max_sched_scan_plan_iterations: maximum number of iterations for a single
55343b06d277SAvraham Stern  *	scan plan supported by the device.
5535abe37c4bSJohannes Berg  * @coverage_class: current coverage class
5536abe37c4bSJohannes Berg  * @fw_version: firmware version for ethtool reporting
5537abe37c4bSJohannes Berg  * @hw_version: hardware version for ethtool reporting
5538abe37c4bSJohannes Berg  * @max_num_pmkids: maximum number of PMKIDs supported by device
5539abe37c4bSJohannes Berg  * @privid: a pointer that drivers can use to identify if an arbitrary
5540abe37c4bSJohannes Berg  *	wiphy is theirs, e.g. in global notifiers
5541abe37c4bSJohannes Berg  * @bands: information about bands/channels supported by this device
55422e161f78SJohannes Berg  *
55432e161f78SJohannes Berg  * @mgmt_stypes: bitmasks of frame subtypes that can be subscribed to or
55442e161f78SJohannes Berg  *	transmitted through nl80211, points to an array indexed by interface
55452e161f78SJohannes Berg  *	type
5546a7ffac95SBruno Randolf  *
55477f531e03SBruno Randolf  * @available_antennas_tx: bitmap of antennas which are available to be
55487f531e03SBruno Randolf  *	configured as TX antennas. Antenna configuration commands will be
55497f531e03SBruno Randolf  *	rejected unless this or @available_antennas_rx is set.
55507f531e03SBruno Randolf  *
55517f531e03SBruno Randolf  * @available_antennas_rx: bitmap of antennas which are available to be
55527f531e03SBruno Randolf  *	configured as RX antennas. Antenna configuration commands will be
55537f531e03SBruno Randolf  *	rejected unless this or @available_antennas_tx is set.
5554a293911dSJohannes Berg  *
555515f0ebc2SRandy Dunlap  * @probe_resp_offload:
555615f0ebc2SRandy Dunlap  *	 Bitmap of supported protocols for probe response offloading.
555715f0ebc2SRandy Dunlap  *	 See &enum nl80211_probe_resp_offload_support_attr. Only valid
555815f0ebc2SRandy Dunlap  *	 when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set.
555915f0ebc2SRandy Dunlap  *
5560a293911dSJohannes Berg  * @max_remain_on_channel_duration: Maximum time a remain-on-channel operation
5561a293911dSJohannes Berg  *	may request, if implemented.
5562ff1b6e69SJohannes Berg  *
5563ff1b6e69SJohannes Berg  * @wowlan: WoWLAN support information
55646abb9cb9SJohannes Berg  * @wowlan_config: current WoWLAN configuration; this should usually not be
55656abb9cb9SJohannes Berg  *	used since access to it is necessarily racy, use the parameter passed
55666abb9cb9SJohannes Berg  *	to the suspend() operation instead.
5567562a7480SJohannes Berg  *
5568562a7480SJohannes Berg  * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features.
55697e7c8926SBen Greear  * @ht_capa_mod_mask:  Specify what ht_cap values can be over-ridden.
55707e7c8926SBen Greear  *	If null, then none can be over-ridden.
5571ee2aca34SJohannes Berg  * @vht_capa_mod_mask:  Specify what VHT capabilities can be over-ridden.
5572ee2aca34SJohannes Berg  *	If null, then none can be over-ridden.
557377765eafSVasanthakumar Thiagarajan  *
557453873f13SJohannes Berg  * @wdev_list: the list of associated (virtual) interfaces; this list must
557553873f13SJohannes Berg  *	not be modified by the driver, but can be read with RTNL/RCU protection.
557653873f13SJohannes Berg  *
557777765eafSVasanthakumar Thiagarajan  * @max_acl_mac_addrs: Maximum number of MAC addresses that the device
557877765eafSVasanthakumar Thiagarajan  *	supports for ACL.
5579a50df0c4SJohannes Berg  *
5580a50df0c4SJohannes Berg  * @extended_capabilities: extended capabilities supported by the driver,
5581a50df0c4SJohannes Berg  *	additional capabilities might be supported by userspace; these are
5582a50df0c4SJohannes Berg  *	the 802.11 extended capabilities ("Extended Capabilities element")
5583a50df0c4SJohannes Berg  *	and are in the same format as in the information element. See
5584019ae3a9SKanchanapally, Vidyullatha  *	802.11-2012 8.4.2.29 for the defined fields. These are the default
5585019ae3a9SKanchanapally, Vidyullatha  *	extended capabilities to be used if the capabilities are not specified
5586019ae3a9SKanchanapally, Vidyullatha  *	for a specific interface type in iftype_ext_capab.
5587a50df0c4SJohannes Berg  * @extended_capabilities_mask: mask of the valid values
5588a50df0c4SJohannes Berg  * @extended_capabilities_len: length of the extended capabilities
5589019ae3a9SKanchanapally, Vidyullatha  * @iftype_ext_capab: array of extended capabilities per interface type
5590019ae3a9SKanchanapally, Vidyullatha  * @num_iftype_ext_capab: number of interface types for which extended
5591019ae3a9SKanchanapally, Vidyullatha  *	capabilities are specified separately.
5592be29b99aSAmitkumar Karwar  * @coalesce: packet coalescing support information
5593ad7e718cSJohannes Berg  *
5594ad7e718cSJohannes Berg  * @vendor_commands: array of vendor commands supported by the hardware
5595ad7e718cSJohannes Berg  * @n_vendor_commands: number of vendor commands
5596567ffc35SJohannes Berg  * @vendor_events: array of vendor events supported by the hardware
5597567ffc35SJohannes Berg  * @n_vendor_events: number of vendor events
5598b43504cfSJouni Malinen  *
5599b43504cfSJouni Malinen  * @max_ap_assoc_sta: maximum number of associated stations supported in AP mode
5600b43504cfSJouni Malinen  *	(including P2P GO) or 0 to indicate no such limit is advertised. The
5601b43504cfSJouni Malinen  *	driver is allowed to advertise a theoretical limit that it can reach in
5602b43504cfSJouni Malinen  *	some cases, but may not always reach.
5603c2e4323bSLuciano Coelho  *
5604c2e4323bSLuciano Coelho  * @max_num_csa_counters: Number of supported csa_counters in beacons
5605c2e4323bSLuciano Coelho  *	and probe responses.  This value should be set if the driver
5606c2e4323bSLuciano Coelho  *	wishes to limit the number of csa counters. Default (0) means
5607c2e4323bSLuciano Coelho  *	infinite.
560838de03d2SArend van Spriel  * @bss_select_support: bitmask indicating the BSS selection criteria supported
560938de03d2SArend van Spriel  *	by the driver in the .connect() callback. The bit position maps to the
561038de03d2SArend van Spriel  *	attribute indices defined in &enum nl80211_bss_select_attr.
5611a442b761SAyala Beker  *
56128585989dSLuca Coelho  * @nan_supported_bands: bands supported by the device in NAN mode, a
56138585989dSLuca Coelho  *	bitmap of &enum nl80211_band values.  For instance, for
56148585989dSLuca Coelho  *	NL80211_BAND_2GHZ, bit 0 would be set
56158585989dSLuca Coelho  *	(i.e. BIT(NL80211_BAND_2GHZ)).
5616f3a7ca64SJohannes Berg  *
5617f3a7ca64SJohannes Berg  * @txq_limit: configuration of internal TX queue frame limit
5618f3a7ca64SJohannes Berg  * @txq_memory_limit: configuration internal TX queue memory limit
5619f3a7ca64SJohannes Berg  * @txq_quantum: configuration of internal TX queue scheduler quantum
56209bb7e0f2SJohannes Berg  *
5621a710d214SLothar Rubusch  * @tx_queue_len: allow setting transmit queue len for drivers not using
5622a710d214SLothar Rubusch  *	wake_tx_queue
5623a710d214SLothar Rubusch  *
5624213ed579SSara Sharon  * @support_mbssid: can HW support association with nontransmitted AP
5625213ed579SSara Sharon  * @support_only_he_mbssid: don't parse MBSSID elements if it is not
5626213ed579SSara Sharon  *	HE AP, in order to avoid compatibility issues.
5627213ed579SSara Sharon  *	@support_mbssid must be set for this to have any effect.
5628213ed579SSara Sharon  *
56299bb7e0f2SJohannes Berg  * @pmsr_capa: peer measurement capabilities
56303710a8a6SJohannes Berg  *
56313710a8a6SJohannes Berg  * @tid_config_support: describes the per-TID config support that the
56323710a8a6SJohannes Berg  *	device has
56333710a8a6SJohannes Berg  * @tid_config_support.vif: bitmap of attributes (configurations)
56343710a8a6SJohannes Berg  *	supported by the driver for each vif
56353710a8a6SJohannes Berg  * @tid_config_support.peer: bitmap of attributes (configurations)
56363710a8a6SJohannes Berg  *	supported by the driver for each peer
56376a21d16cSTamizh chelvam  * @tid_config_support.max_retry: maximum supported retry count for
56386a21d16cSTamizh chelvam  *	long/short retry configuration
5639a710d214SLothar Rubusch  *
5640a710d214SLothar Rubusch  * @max_data_retry_count: maximum supported per TID retry count for
5641a710d214SLothar Rubusch  *	configuration through the %NL80211_TID_CONFIG_ATTR_RETRY_SHORT and
5642a710d214SLothar Rubusch  *	%NL80211_TID_CONFIG_ATTR_RETRY_LONG attributes
564370b6ff35SJohannes Berg  * @sar_capa: SAR control capabilities
5644358ae888SEmmanuel Grumbach  * @rfkill: a pointer to the rfkill structure
5645dc1e3cb8SJohn Crispin  *
5646dc1e3cb8SJohn Crispin  * @mbssid_max_interfaces: maximum number of interfaces supported by the driver
5647dc1e3cb8SJohn Crispin  *	in a multiple BSSID set. This field must be set to a non-zero value
5648dc1e3cb8SJohn Crispin  *	by the driver to advertise MBSSID support.
5649f9d366d4SJohannes Berg  * @ema_max_profile_periodicity: maximum profile periodicity supported by
5650dc1e3cb8SJohn Crispin  *	the driver. Setting this field to a non-zero value indicates that the
5651dc1e3cb8SJohn Crispin  *	driver supports enhanced multi-BSSID advertisements (EMA AP).
5652ecad3b0bSVeerendranath Jakkam  * @max_num_akm_suites: maximum number of AKM suites allowed for
5653ecad3b0bSVeerendranath Jakkam  *	configuration through %NL80211_CMD_CONNECT, %NL80211_CMD_ASSOCIATE and
5654ecad3b0bSVeerendranath Jakkam  *	%NL80211_CMD_START_AP. Set to NL80211_MAX_NR_AKM_SUITES if not set by
5655ecad3b0bSVeerendranath Jakkam  *	driver. If set by driver minimum allowed value is
5656ecad3b0bSVeerendranath Jakkam  *	NL80211_MAX_NR_AKM_SUITES in order to avoid compatibility issues with
5657ecad3b0bSVeerendranath Jakkam  *	legacy userspace and maximum allowed value is
5658ecad3b0bSVeerendranath Jakkam  *	CFG80211_MAX_NUM_AKM_SUITES.
5659cbbaf2bbSAvraham Stern  *
5660cbbaf2bbSAvraham Stern  * @hw_timestamp_max_peers: maximum number of peers that the driver supports
5661cbbaf2bbSAvraham Stern  *	enabling HW timestamping for concurrently. Setting this field to a
5662cbbaf2bbSAvraham Stern  *	non-zero value indicates that the driver supports HW timestamping.
5663cbbaf2bbSAvraham Stern  *	A value of %CFG80211_HW_TIMESTAMP_ALL_PEERS indicates the driver
5664cbbaf2bbSAvraham Stern  *	supports enabling HW timestamping for all peers (i.e. no need to
5665cbbaf2bbSAvraham Stern  *	specify a mac address).
5666e6c06ca8SFelix Fietkau  *
5667e6c06ca8SFelix Fietkau  * @radio: radios belonging to this wiphy
5668e6c06ca8SFelix Fietkau  * @n_radio: number of radios
5669d3236553SJohannes Berg  */
5670d3236553SJohannes Berg struct wiphy {
5671a05829a7SJohannes Berg 	struct mutex mtx;
5672a05829a7SJohannes Berg 
5673d3236553SJohannes Berg 	/* assign these fields before you register the wiphy */
5674d3236553SJohannes Berg 
5675d3236553SJohannes Berg 	u8 perm_addr[ETH_ALEN];
5676ef15aac6SJohannes Berg 	u8 addr_mask[ETH_ALEN];
5677ef15aac6SJohannes Berg 
5678ef15aac6SJohannes Berg 	struct mac_address *addresses;
5679d3236553SJohannes Berg 
56802e161f78SJohannes Berg 	const struct ieee80211_txrx_stypes *mgmt_stypes;
56812e161f78SJohannes Berg 
56827527a782SJohannes Berg 	const struct ieee80211_iface_combination *iface_combinations;
56837527a782SJohannes Berg 	int n_iface_combinations;
56847527a782SJohannes Berg 	u16 software_iftypes;
56857527a782SJohannes Berg 
56862e161f78SJohannes Berg 	u16 n_addresses;
56872e161f78SJohannes Berg 
5688d3236553SJohannes Berg 	/* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
5689d3236553SJohannes Berg 	u16 interface_modes;
5690d3236553SJohannes Berg 
569177765eafSVasanthakumar Thiagarajan 	u16 max_acl_mac_addrs;
569277765eafSVasanthakumar Thiagarajan 
5693a2f73b6cSLuis R. Rodriguez 	u32 flags, regulatory_flags, features;
5694d75bb06bSGautam Kumar Shukla 	u8 ext_features[DIV_ROUND_UP(NUM_NL80211_EXT_FEATURES, 8)];
5695463d0183SJohannes Berg 
5696562a7480SJohannes Berg 	u32 ap_sme_capa;
5697562a7480SJohannes Berg 
5698d3236553SJohannes Berg 	enum cfg80211_signal_type signal_type;
5699d3236553SJohannes Berg 
5700d3236553SJohannes Berg 	int bss_priv_size;
5701d3236553SJohannes Berg 	u8 max_scan_ssids;
5702ca986ad9SArend Van Spriel 	u8 max_sched_scan_reqs;
570393b6aa69SLuciano Coelho 	u8 max_sched_scan_ssids;
5704a1f1c21cSLuciano Coelho 	u8 max_match_sets;
5705d3236553SJohannes Berg 	u16 max_scan_ie_len;
57065a865badSLuciano Coelho 	u16 max_sched_scan_ie_len;
57073b06d277SAvraham Stern 	u32 max_sched_scan_plans;
57083b06d277SAvraham Stern 	u32 max_sched_scan_plan_interval;
57093b06d277SAvraham Stern 	u32 max_sched_scan_plan_iterations;
5710d3236553SJohannes Berg 
5711d3236553SJohannes Berg 	int n_cipher_suites;
5712d3236553SJohannes Berg 	const u32 *cipher_suites;
5713d3236553SJohannes Berg 
5714ab4dfa20SVeerendranath Jakkam 	int n_akm_suites;
5715ab4dfa20SVeerendranath Jakkam 	const u32 *akm_suites;
5716ab4dfa20SVeerendranath Jakkam 
5717d6039a34SVeerendranath Jakkam 	const struct wiphy_iftype_akm_suites *iftype_akm_suites;
5718d6039a34SVeerendranath Jakkam 	unsigned int num_iftype_akm_suites;
5719d6039a34SVeerendranath Jakkam 
5720b9a5f8caSJouni Malinen 	u8 retry_short;
5721b9a5f8caSJouni Malinen 	u8 retry_long;
5722b9a5f8caSJouni Malinen 	u32 frag_threshold;
5723b9a5f8caSJouni Malinen 	u32 rts_threshold;
572481077e82SLukáš Turek 	u8 coverage_class;
5725b9a5f8caSJouni Malinen 
572681135548SJiri Pirko 	char fw_version[ETHTOOL_FWVERS_LEN];
5727dfce95f5SKalle Valo 	u32 hw_version;
5728dfce95f5SKalle Valo 
5729dfb89c56SJohannes Berg #ifdef CONFIG_PM
5730964dc9e2SJohannes Berg 	const struct wiphy_wowlan_support *wowlan;
57316abb9cb9SJohannes Berg 	struct cfg80211_wowlan *wowlan_config;
5732dfb89c56SJohannes Berg #endif
5733ff1b6e69SJohannes Berg 
5734a293911dSJohannes Berg 	u16 max_remain_on_channel_duration;
5735a293911dSJohannes Berg 
573667fbb16bSSamuel Ortiz 	u8 max_num_pmkids;
573767fbb16bSSamuel Ortiz 
57387f531e03SBruno Randolf 	u32 available_antennas_tx;
57397f531e03SBruno Randolf 	u32 available_antennas_rx;
5740a7ffac95SBruno Randolf 
574187bbbe22SArik Nemtsov 	u32 probe_resp_offload;
574287bbbe22SArik Nemtsov 
5743a50df0c4SJohannes Berg 	const u8 *extended_capabilities, *extended_capabilities_mask;
5744a50df0c4SJohannes Berg 	u8 extended_capabilities_len;
5745a50df0c4SJohannes Berg 
5746019ae3a9SKanchanapally, Vidyullatha 	const struct wiphy_iftype_ext_capab *iftype_ext_capab;
5747019ae3a9SKanchanapally, Vidyullatha 	unsigned int num_iftype_ext_capab;
5748019ae3a9SKanchanapally, Vidyullatha 
5749cf5aa2f1SDavid Kilroy 	const void *privid;
5750d3236553SJohannes Berg 
575157fbcce3SJohannes Berg 	struct ieee80211_supported_band *bands[NUM_NL80211_BANDS];
5752d3236553SJohannes Berg 
57530c0280bdSLuis R. Rodriguez 	void (*reg_notifier)(struct wiphy *wiphy,
5754d3236553SJohannes Berg 			     struct regulatory_request *request);
5755d3236553SJohannes Berg 
5756d3236553SJohannes Berg 	/* fields below are read-only, assigned by cfg80211 */
5757d3236553SJohannes Berg 
5758458f4f9eSJohannes Berg 	const struct ieee80211_regdomain __rcu *regd;
5759d3236553SJohannes Berg 
5760d3236553SJohannes Berg 	struct device dev;
5761d3236553SJohannes Berg 
5762ecb44335SStanislaw Gruszka 	bool registered;
5763ecb44335SStanislaw Gruszka 
5764d3236553SJohannes Berg 	struct dentry *debugfsdir;
5765d3236553SJohannes Berg 
57667e7c8926SBen Greear 	const struct ieee80211_ht_cap *ht_capa_mod_mask;
5767ee2aca34SJohannes Berg 	const struct ieee80211_vht_cap *vht_capa_mod_mask;
57687e7c8926SBen Greear 
576953873f13SJohannes Berg 	struct list_head wdev_list;
577053873f13SJohannes Berg 
57710c5c9fb5SEric W. Biederman 	possible_net_t _net;
5772463d0183SJohannes Berg 
57733d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT
57743d23e349SJohannes Berg 	const struct iw_handler_def *wext;
57753d23e349SJohannes Berg #endif
57763d23e349SJohannes Berg 
5777be29b99aSAmitkumar Karwar 	const struct wiphy_coalesce_support *coalesce;
5778be29b99aSAmitkumar Karwar 
5779ad7e718cSJohannes Berg 	const struct wiphy_vendor_command *vendor_commands;
5780567ffc35SJohannes Berg 	const struct nl80211_vendor_cmd_info *vendor_events;
5781567ffc35SJohannes Berg 	int n_vendor_commands, n_vendor_events;
5782ad7e718cSJohannes Berg 
5783b43504cfSJouni Malinen 	u16 max_ap_assoc_sta;
5784b43504cfSJouni Malinen 
57859a774c78SAndrei Otcheretianski 	u8 max_num_csa_counters;
57869a774c78SAndrei Otcheretianski 
578738de03d2SArend van Spriel 	u32 bss_select_support;
578838de03d2SArend van Spriel 
57898585989dSLuca Coelho 	u8 nan_supported_bands;
57908585989dSLuca Coelho 
579152539ca8SToke Høiland-Jørgensen 	u32 txq_limit;
579252539ca8SToke Høiland-Jørgensen 	u32 txq_memory_limit;
579352539ca8SToke Høiland-Jørgensen 	u32 txq_quantum;
579452539ca8SToke Høiland-Jørgensen 
57951f6e0baaSJohn Crispin 	unsigned long tx_queue_len;
57961f6e0baaSJohn Crispin 
5797213ed579SSara Sharon 	u8 support_mbssid:1,
5798213ed579SSara Sharon 	   support_only_he_mbssid:1;
5799213ed579SSara Sharon 
58009bb7e0f2SJohannes Berg 	const struct cfg80211_pmsr_capabilities *pmsr_capa;
58019bb7e0f2SJohannes Berg 
58023710a8a6SJohannes Berg 	struct {
58033710a8a6SJohannes Berg 		u64 peer, vif;
58046a21d16cSTamizh chelvam 		u8 max_retry;
58053710a8a6SJohannes Berg 	} tid_config_support;
58063710a8a6SJohannes Berg 
58076a21d16cSTamizh chelvam 	u8 max_data_retry_count;
58086a21d16cSTamizh chelvam 
58096bdb68ceSCarl Huang 	const struct cfg80211_sar_capa *sar_capa;
58106bdb68ceSCarl Huang 
5811358ae888SEmmanuel Grumbach 	struct rfkill *rfkill;
5812358ae888SEmmanuel Grumbach 
5813dc1e3cb8SJohn Crispin 	u8 mbssid_max_interfaces;
5814dc1e3cb8SJohn Crispin 	u8 ema_max_profile_periodicity;
5815ecad3b0bSVeerendranath Jakkam 	u16 max_num_akm_suites;
5816dc1e3cb8SJohn Crispin 
5817cbbaf2bbSAvraham Stern 	u16 hw_timestamp_max_peers;
5818cbbaf2bbSAvraham Stern 
5819e6c06ca8SFelix Fietkau 	int n_radio;
5820e6c06ca8SFelix Fietkau 	const struct wiphy_radio *radio;
5821e6c06ca8SFelix Fietkau 
5822396fba0aSGustavo A. R. Silva 	char priv[] __aligned(NETDEV_ALIGN);
5823d3236553SJohannes Berg };
5824d3236553SJohannes Berg 
wiphy_net(struct wiphy * wiphy)5825463d0183SJohannes Berg static inline struct net *wiphy_net(struct wiphy *wiphy)
5826463d0183SJohannes Berg {
5827c2d9ba9bSEric Dumazet 	return read_pnet(&wiphy->_net);
5828463d0183SJohannes Berg }
5829463d0183SJohannes Berg 
wiphy_net_set(struct wiphy * wiphy,struct net * net)5830463d0183SJohannes Berg static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net)
5831463d0183SJohannes Berg {
5832c2d9ba9bSEric Dumazet 	write_pnet(&wiphy->_net, net);
5833463d0183SJohannes Berg }
5834463d0183SJohannes Berg 
5835d3236553SJohannes Berg /**
5836d3236553SJohannes Berg  * wiphy_priv - return priv from wiphy
5837d3236553SJohannes Berg  *
5838d3236553SJohannes Berg  * @wiphy: the wiphy whose priv pointer to return
58390ae997dcSYacine Belkadi  * Return: The priv of @wiphy.
5840d3236553SJohannes Berg  */
wiphy_priv(struct wiphy * wiphy)5841d3236553SJohannes Berg static inline void *wiphy_priv(struct wiphy *wiphy)
5842d3236553SJohannes Berg {
5843d3236553SJohannes Berg 	BUG_ON(!wiphy);
5844d3236553SJohannes Berg 	return &wiphy->priv;
5845d3236553SJohannes Berg }
5846d3236553SJohannes Berg 
5847d3236553SJohannes Berg /**
5848f1f74825SDavid Kilroy  * priv_to_wiphy - return the wiphy containing the priv
5849f1f74825SDavid Kilroy  *
5850f1f74825SDavid Kilroy  * @priv: a pointer previously returned by wiphy_priv
58510ae997dcSYacine Belkadi  * Return: The wiphy of @priv.
5852f1f74825SDavid Kilroy  */
priv_to_wiphy(void * priv)5853f1f74825SDavid Kilroy static inline struct wiphy *priv_to_wiphy(void *priv)
5854f1f74825SDavid Kilroy {
5855f1f74825SDavid Kilroy 	BUG_ON(!priv);
5856f1f74825SDavid Kilroy 	return container_of(priv, struct wiphy, priv);
5857f1f74825SDavid Kilroy }
5858f1f74825SDavid Kilroy 
5859f1f74825SDavid Kilroy /**
5860d3236553SJohannes Berg  * set_wiphy_dev - set device pointer for wiphy
5861d3236553SJohannes Berg  *
5862d3236553SJohannes Berg  * @wiphy: The wiphy whose device to bind
5863d3236553SJohannes Berg  * @dev: The device to parent it to
5864d3236553SJohannes Berg  */
set_wiphy_dev(struct wiphy * wiphy,struct device * dev)5865d3236553SJohannes Berg static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev)
5866d3236553SJohannes Berg {
5867d3236553SJohannes Berg 	wiphy->dev.parent = dev;
5868d3236553SJohannes Berg }
5869d3236553SJohannes Berg 
5870d3236553SJohannes Berg /**
5871d3236553SJohannes Berg  * wiphy_dev - get wiphy dev pointer
5872d3236553SJohannes Berg  *
5873d3236553SJohannes Berg  * @wiphy: The wiphy whose device struct to look up
58740ae997dcSYacine Belkadi  * Return: The dev of @wiphy.
5875d3236553SJohannes Berg  */
wiphy_dev(struct wiphy * wiphy)5876d3236553SJohannes Berg static inline struct device *wiphy_dev(struct wiphy *wiphy)
5877d3236553SJohannes Berg {
5878d3236553SJohannes Berg 	return wiphy->dev.parent;
5879d3236553SJohannes Berg }
5880d3236553SJohannes Berg 
5881d3236553SJohannes Berg /**
5882d3236553SJohannes Berg  * wiphy_name - get wiphy name
5883d3236553SJohannes Berg  *
5884d3236553SJohannes Berg  * @wiphy: The wiphy whose name to return
58850ae997dcSYacine Belkadi  * Return: The name of @wiphy.
5886d3236553SJohannes Berg  */
wiphy_name(const struct wiphy * wiphy)5887e1db74fcSJoe Perches static inline const char *wiphy_name(const struct wiphy *wiphy)
5888d3236553SJohannes Berg {
5889d3236553SJohannes Berg 	return dev_name(&wiphy->dev);
5890d3236553SJohannes Berg }
5891d3236553SJohannes Berg 
5892d3236553SJohannes Berg /**
58931998d90aSBen Greear  * wiphy_new_nm - create a new wiphy for use with cfg80211
58941998d90aSBen Greear  *
58951998d90aSBen Greear  * @ops: The configuration operations for this device
58961998d90aSBen Greear  * @sizeof_priv: The size of the private area to allocate
58971998d90aSBen Greear  * @requested_name: Request a particular name.
58981998d90aSBen Greear  *	NULL is valid value, and means use the default phy%d naming.
58991998d90aSBen Greear  *
59001998d90aSBen Greear  * Create a new wiphy and associate the given operations with it.
59011998d90aSBen Greear  * @sizeof_priv bytes are allocated for private use.
59021998d90aSBen Greear  *
59031998d90aSBen Greear  * Return: A pointer to the new wiphy. This pointer must be
59041998d90aSBen Greear  * assigned to each netdev's ieee80211_ptr for proper operation.
59051998d90aSBen Greear  */
59061998d90aSBen Greear struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv,
59071998d90aSBen Greear 			   const char *requested_name);
59081998d90aSBen Greear 
59091998d90aSBen Greear /**
5910d3236553SJohannes Berg  * wiphy_new - create a new wiphy for use with cfg80211
5911d3236553SJohannes Berg  *
5912d3236553SJohannes Berg  * @ops: The configuration operations for this device
5913d3236553SJohannes Berg  * @sizeof_priv: The size of the private area to allocate
5914d3236553SJohannes Berg  *
5915d3236553SJohannes Berg  * Create a new wiphy and associate the given operations with it.
5916d3236553SJohannes Berg  * @sizeof_priv bytes are allocated for private use.
5917d3236553SJohannes Berg  *
59180ae997dcSYacine Belkadi  * Return: A pointer to the new wiphy. This pointer must be
59190ae997dcSYacine Belkadi  * assigned to each netdev's ieee80211_ptr for proper operation.
5920d3236553SJohannes Berg  */
wiphy_new(const struct cfg80211_ops * ops,int sizeof_priv)59211998d90aSBen Greear static inline struct wiphy *wiphy_new(const struct cfg80211_ops *ops,
59221998d90aSBen Greear 				      int sizeof_priv)
59231998d90aSBen Greear {
59241998d90aSBen Greear 	return wiphy_new_nm(ops, sizeof_priv, NULL);
59251998d90aSBen Greear }
5926d3236553SJohannes Berg 
5927d3236553SJohannes Berg /**
5928d3236553SJohannes Berg  * wiphy_register - register a wiphy with cfg80211
5929d3236553SJohannes Berg  *
5930d3236553SJohannes Berg  * @wiphy: The wiphy to register.
5931d3236553SJohannes Berg  *
59320ae997dcSYacine Belkadi  * Return: A non-negative wiphy index or a negative error code.
5933d3236553SJohannes Berg  */
593410dd9b7cSJoe Perches int wiphy_register(struct wiphy *wiphy);
5935d3236553SJohannes Berg 
5936a05829a7SJohannes Berg /* this is a define for better error reporting (file/line) */
5937a05829a7SJohannes Berg #define lockdep_assert_wiphy(wiphy) lockdep_assert_held(&(wiphy)->mtx)
5938a05829a7SJohannes Berg 
5939a05829a7SJohannes Berg /**
5940a05829a7SJohannes Berg  * rcu_dereference_wiphy - rcu_dereference with debug checking
5941a05829a7SJohannes Berg  * @wiphy: the wiphy to check the locking on
5942a05829a7SJohannes Berg  * @p: The pointer to read, prior to dereferencing
5943a05829a7SJohannes Berg  *
5944a05829a7SJohannes Berg  * Do an rcu_dereference(p), but check caller either holds rcu_read_lock()
5945a05829a7SJohannes Berg  * or RTNL. Note: Please prefer wiphy_dereference() or rcu_dereference().
5946a05829a7SJohannes Berg  */
5947a05829a7SJohannes Berg #define rcu_dereference_wiphy(wiphy, p)				\
5948a05829a7SJohannes Berg         rcu_dereference_check(p, lockdep_is_held(&wiphy->mtx))
5949a05829a7SJohannes Berg 
5950a05829a7SJohannes Berg /**
5951a05829a7SJohannes Berg  * wiphy_dereference - fetch RCU pointer when updates are prevented by wiphy mtx
5952a05829a7SJohannes Berg  * @wiphy: the wiphy to check the locking on
5953a05829a7SJohannes Berg  * @p: The pointer to read, prior to dereferencing
5954a05829a7SJohannes Berg  *
5955a05829a7SJohannes Berg  * Return the value of the specified RCU-protected pointer, but omit the
5956a05829a7SJohannes Berg  * READ_ONCE(), because caller holds the wiphy mutex used for updates.
5957a05829a7SJohannes Berg  */
5958a05829a7SJohannes Berg #define wiphy_dereference(wiphy, p)				\
5959a05829a7SJohannes Berg         rcu_dereference_protected(p, lockdep_is_held(&wiphy->mtx))
5960a05829a7SJohannes Berg 
5961a05829a7SJohannes Berg /**
5962a05829a7SJohannes Berg  * get_wiphy_regdom - get custom regdomain for the given wiphy
5963a05829a7SJohannes Berg  * @wiphy: the wiphy to get the regdomain from
596462cc206cSJeff Johnson  *
596562cc206cSJeff Johnson  * Context: Requires any of RTNL, wiphy mutex or RCU protection.
596662cc206cSJeff Johnson  *
596762cc206cSJeff Johnson  * Return: pointer to the regulatory domain associated with the wiphy
5968a05829a7SJohannes Berg  */
5969a05829a7SJohannes Berg const struct ieee80211_regdomain *get_wiphy_regdom(struct wiphy *wiphy);
5970a05829a7SJohannes Berg 
5971d3236553SJohannes Berg /**
5972d3236553SJohannes Berg  * wiphy_unregister - deregister a wiphy from cfg80211
5973d3236553SJohannes Berg  *
5974d3236553SJohannes Berg  * @wiphy: The wiphy to unregister.
5975d3236553SJohannes Berg  *
5976d3236553SJohannes Berg  * After this call, no more requests can be made with this priv
5977d3236553SJohannes Berg  * pointer, but the call may sleep to wait for an outstanding
5978d3236553SJohannes Berg  * request that is being handled.
5979d3236553SJohannes Berg  */
598010dd9b7cSJoe Perches void wiphy_unregister(struct wiphy *wiphy);
5981d3236553SJohannes Berg 
5982d3236553SJohannes Berg /**
5983d3236553SJohannes Berg  * wiphy_free - free wiphy
5984d3236553SJohannes Berg  *
5985d3236553SJohannes Berg  * @wiphy: The wiphy to free
5986d3236553SJohannes Berg  */
598710dd9b7cSJoe Perches void wiphy_free(struct wiphy *wiphy);
5988d3236553SJohannes Berg 
5989fffd0934SJohannes Berg /* internal structs */
59906829c878SJohannes Berg struct cfg80211_conn;
599119957bb3SJohannes Berg struct cfg80211_internal_bss;
5992fffd0934SJohannes Berg struct cfg80211_cached_keys;
59934a4b8169SAndrew Zaborowski struct cfg80211_cqm_config;
599419957bb3SJohannes Berg 
5995d3236553SJohannes Berg /**
5996a05829a7SJohannes Berg  * wiphy_lock - lock the wiphy
5997a05829a7SJohannes Berg  * @wiphy: the wiphy to lock
5998a05829a7SJohannes Berg  *
5999a3ee4dc8SJohannes Berg  * This is needed around registering and unregistering netdevs that
6000a3ee4dc8SJohannes Berg  * aren't created through cfg80211 calls, since that requires locking
6001a3ee4dc8SJohannes Berg  * in cfg80211 when the notifiers is called, but that cannot
6002a3ee4dc8SJohannes Berg  * differentiate which way it's called.
6003a3ee4dc8SJohannes Berg  *
6004a3ee4dc8SJohannes Berg  * It can also be used by drivers for their own purposes.
6005a05829a7SJohannes Berg  *
6006a05829a7SJohannes Berg  * When cfg80211 ops are called, the wiphy is already locked.
6007a3ee4dc8SJohannes Berg  *
6008a3ee4dc8SJohannes Berg  * Note that this makes sure that no workers that have been queued
6009a3ee4dc8SJohannes Berg  * with wiphy_queue_work() are running.
6010a05829a7SJohannes Berg  */
wiphy_lock(struct wiphy * wiphy)6011a05829a7SJohannes Berg static inline void wiphy_lock(struct wiphy *wiphy)
6012a05829a7SJohannes Berg 	__acquires(&wiphy->mtx)
6013a05829a7SJohannes Berg {
6014a05829a7SJohannes Berg 	mutex_lock(&wiphy->mtx);
6015a05829a7SJohannes Berg 	__acquire(&wiphy->mtx);
6016a05829a7SJohannes Berg }
6017a05829a7SJohannes Berg 
6018a05829a7SJohannes Berg /**
6019a05829a7SJohannes Berg  * wiphy_unlock - unlock the wiphy again
6020a05829a7SJohannes Berg  * @wiphy: the wiphy to unlock
6021a05829a7SJohannes Berg  */
wiphy_unlock(struct wiphy * wiphy)6022a05829a7SJohannes Berg static inline void wiphy_unlock(struct wiphy *wiphy)
6023a05829a7SJohannes Berg 	__releases(&wiphy->mtx)
6024a05829a7SJohannes Berg {
6025a05829a7SJohannes Berg 	__release(&wiphy->mtx);
6026a05829a7SJohannes Berg 	mutex_unlock(&wiphy->mtx);
6027a05829a7SJohannes Berg }
6028a05829a7SJohannes Berg 
6029a3ee4dc8SJohannes Berg struct wiphy_work;
6030a3ee4dc8SJohannes Berg typedef void (*wiphy_work_func_t)(struct wiphy *, struct wiphy_work *);
6031a3ee4dc8SJohannes Berg 
6032a3ee4dc8SJohannes Berg struct wiphy_work {
6033a3ee4dc8SJohannes Berg 	struct list_head entry;
6034a3ee4dc8SJohannes Berg 	wiphy_work_func_t func;
6035a3ee4dc8SJohannes Berg };
6036a3ee4dc8SJohannes Berg 
wiphy_work_init(struct wiphy_work * work,wiphy_work_func_t func)6037a3ee4dc8SJohannes Berg static inline void wiphy_work_init(struct wiphy_work *work,
6038a3ee4dc8SJohannes Berg 				   wiphy_work_func_t func)
6039a3ee4dc8SJohannes Berg {
6040a3ee4dc8SJohannes Berg 	INIT_LIST_HEAD(&work->entry);
6041a3ee4dc8SJohannes Berg 	work->func = func;
6042a3ee4dc8SJohannes Berg }
6043a3ee4dc8SJohannes Berg 
6044a3ee4dc8SJohannes Berg /**
6045a3ee4dc8SJohannes Berg  * wiphy_work_queue - queue work for the wiphy
6046a3ee4dc8SJohannes Berg  * @wiphy: the wiphy to queue for
6047a3ee4dc8SJohannes Berg  * @work: the work item
6048a3ee4dc8SJohannes Berg  *
6049a3ee4dc8SJohannes Berg  * This is useful for work that must be done asynchronously, and work
6050a3ee4dc8SJohannes Berg  * queued here has the special property that the wiphy mutex will be
6051a3ee4dc8SJohannes Berg  * held as if wiphy_lock() was called, and that it cannot be running
6052a3ee4dc8SJohannes Berg  * after wiphy_lock() was called. Therefore, wiphy_cancel_work() can
6053a3ee4dc8SJohannes Berg  * use just cancel_work() instead of cancel_work_sync(), it requires
6054a3ee4dc8SJohannes Berg  * being in a section protected by wiphy_lock().
6055a3ee4dc8SJohannes Berg  */
6056a3ee4dc8SJohannes Berg void wiphy_work_queue(struct wiphy *wiphy, struct wiphy_work *work);
6057a3ee4dc8SJohannes Berg 
6058a3ee4dc8SJohannes Berg /**
6059a3ee4dc8SJohannes Berg  * wiphy_work_cancel - cancel previously queued work
6060a3ee4dc8SJohannes Berg  * @wiphy: the wiphy, for debug purposes
6061a3ee4dc8SJohannes Berg  * @work: the work to cancel
6062a3ee4dc8SJohannes Berg  *
6063a3ee4dc8SJohannes Berg  * Cancel the work *without* waiting for it, this assumes being
6064a3ee4dc8SJohannes Berg  * called under the wiphy mutex acquired by wiphy_lock().
6065a3ee4dc8SJohannes Berg  */
6066a3ee4dc8SJohannes Berg void wiphy_work_cancel(struct wiphy *wiphy, struct wiphy_work *work);
6067a3ee4dc8SJohannes Berg 
606856cfb8ceSJohannes Berg /**
606956cfb8ceSJohannes Berg  * wiphy_work_flush - flush previously queued work
607056cfb8ceSJohannes Berg  * @wiphy: the wiphy, for debug purposes
607156cfb8ceSJohannes Berg  * @work: the work to flush, this can be %NULL to flush all work
607256cfb8ceSJohannes Berg  *
607356cfb8ceSJohannes Berg  * Flush the work (i.e. run it if pending). This must be called
607456cfb8ceSJohannes Berg  * under the wiphy mutex acquired by wiphy_lock().
607556cfb8ceSJohannes Berg  */
607656cfb8ceSJohannes Berg void wiphy_work_flush(struct wiphy *wiphy, struct wiphy_work *work);
607756cfb8ceSJohannes Berg 
6078a3ee4dc8SJohannes Berg struct wiphy_delayed_work {
6079a3ee4dc8SJohannes Berg 	struct wiphy_work work;
6080a3ee4dc8SJohannes Berg 	struct wiphy *wiphy;
6081a3ee4dc8SJohannes Berg 	struct timer_list timer;
6082a3ee4dc8SJohannes Berg };
6083a3ee4dc8SJohannes Berg 
6084a3ee4dc8SJohannes Berg void wiphy_delayed_work_timer(struct timer_list *t);
6085a3ee4dc8SJohannes Berg 
wiphy_delayed_work_init(struct wiphy_delayed_work * dwork,wiphy_work_func_t func)6086a3ee4dc8SJohannes Berg static inline void wiphy_delayed_work_init(struct wiphy_delayed_work *dwork,
6087a3ee4dc8SJohannes Berg 					   wiphy_work_func_t func)
6088a3ee4dc8SJohannes Berg {
6089a3ee4dc8SJohannes Berg 	timer_setup(&dwork->timer, wiphy_delayed_work_timer, 0);
6090a3ee4dc8SJohannes Berg 	wiphy_work_init(&dwork->work, func);
6091a3ee4dc8SJohannes Berg }
6092a3ee4dc8SJohannes Berg 
6093a3ee4dc8SJohannes Berg /**
6094a3ee4dc8SJohannes Berg  * wiphy_delayed_work_queue - queue delayed work for the wiphy
6095a3ee4dc8SJohannes Berg  * @wiphy: the wiphy to queue for
6096a3ee4dc8SJohannes Berg  * @dwork: the delayable worker
6097a3ee4dc8SJohannes Berg  * @delay: number of jiffies to wait before queueing
6098a3ee4dc8SJohannes Berg  *
6099a3ee4dc8SJohannes Berg  * This is useful for work that must be done asynchronously, and work
6100a3ee4dc8SJohannes Berg  * queued here has the special property that the wiphy mutex will be
6101a3ee4dc8SJohannes Berg  * held as if wiphy_lock() was called, and that it cannot be running
6102a3ee4dc8SJohannes Berg  * after wiphy_lock() was called. Therefore, wiphy_cancel_work() can
6103a3ee4dc8SJohannes Berg  * use just cancel_work() instead of cancel_work_sync(), it requires
6104a3ee4dc8SJohannes Berg  * being in a section protected by wiphy_lock().
6105a3ee4dc8SJohannes Berg  */
6106a3ee4dc8SJohannes Berg void wiphy_delayed_work_queue(struct wiphy *wiphy,
6107a3ee4dc8SJohannes Berg 			      struct wiphy_delayed_work *dwork,
6108a3ee4dc8SJohannes Berg 			      unsigned long delay);
6109a3ee4dc8SJohannes Berg 
6110a3ee4dc8SJohannes Berg /**
6111a3ee4dc8SJohannes Berg  * wiphy_delayed_work_cancel - cancel previously queued delayed work
6112a3ee4dc8SJohannes Berg  * @wiphy: the wiphy, for debug purposes
6113a3ee4dc8SJohannes Berg  * @dwork: the delayed work to cancel
6114a3ee4dc8SJohannes Berg  *
6115a3ee4dc8SJohannes Berg  * Cancel the work *without* waiting for it, this assumes being
6116a3ee4dc8SJohannes Berg  * called under the wiphy mutex acquired by wiphy_lock().
6117a3ee4dc8SJohannes Berg  */
6118a3ee4dc8SJohannes Berg void wiphy_delayed_work_cancel(struct wiphy *wiphy,
6119a3ee4dc8SJohannes Berg 			       struct wiphy_delayed_work *dwork);
6120a3ee4dc8SJohannes Berg 
6121a05829a7SJohannes Berg /**
61228c73d524SJohannes Berg  * wiphy_delayed_work_flush - flush previously queued delayed work
612356cfb8ceSJohannes Berg  * @wiphy: the wiphy, for debug purposes
61249c386911SJohannes Berg  * @dwork: the delayed work to flush
612556cfb8ceSJohannes Berg  *
612656cfb8ceSJohannes Berg  * Flush the work (i.e. run it if pending). This must be called
612756cfb8ceSJohannes Berg  * under the wiphy mutex acquired by wiphy_lock().
612856cfb8ceSJohannes Berg  */
612956cfb8ceSJohannes Berg void wiphy_delayed_work_flush(struct wiphy *wiphy,
613056cfb8ceSJohannes Berg 			      struct wiphy_delayed_work *dwork);
613156cfb8ceSJohannes Berg 
613256cfb8ceSJohannes Berg /**
61330a9314adSJohannes Berg  * enum ieee80211_ap_reg_power - regulatory power for an Access Point
61340a9314adSJohannes Berg  *
61350a9314adSJohannes Berg  * @IEEE80211_REG_UNSET_AP: Access Point has no regulatory power mode
61360a9314adSJohannes Berg  * @IEEE80211_REG_LPI_AP: Indoor Access Point
61370a9314adSJohannes Berg  * @IEEE80211_REG_SP_AP: Standard power Access Point
61380a9314adSJohannes Berg  * @IEEE80211_REG_VLP_AP: Very low power Access Point
61390a9314adSJohannes Berg  */
61400a9314adSJohannes Berg enum ieee80211_ap_reg_power {
61410a9314adSJohannes Berg 	IEEE80211_REG_UNSET_AP,
61420a9314adSJohannes Berg 	IEEE80211_REG_LPI_AP,
61430a9314adSJohannes Berg 	IEEE80211_REG_SP_AP,
61440a9314adSJohannes Berg 	IEEE80211_REG_VLP_AP,
61450a9314adSJohannes Berg };
61460a9314adSJohannes Berg 
61470a9314adSJohannes Berg /**
614889a54e48SJohannes Berg  * struct wireless_dev - wireless device state
6149d3236553SJohannes Berg  *
615089a54e48SJohannes Berg  * For netdevs, this structure must be allocated by the driver
615189a54e48SJohannes Berg  * that uses the ieee80211_ptr field in struct net_device (this
615289a54e48SJohannes Berg  * is intentional so it can be allocated along with the netdev.)
615389a54e48SJohannes Berg  * It need not be registered then as netdev registration will
6154a05829a7SJohannes Berg  * be intercepted by cfg80211 to see the new wireless device,
6155a05829a7SJohannes Berg  * however, drivers must lock the wiphy before registering or
6156a05829a7SJohannes Berg  * unregistering netdevs if they pre-create any netdevs (in ops
6157a05829a7SJohannes Berg  * called from cfg80211, the wiphy is already locked.)
615889a54e48SJohannes Berg  *
615989a54e48SJohannes Berg  * For non-netdev uses, it must also be allocated by the driver
616089a54e48SJohannes Berg  * in response to the cfg80211 callbacks that require it, as
616189a54e48SJohannes Berg  * there's no netdev registration in that case it may not be
616289a54e48SJohannes Berg  * allocated outside of callback operations that return it.
6163d3236553SJohannes Berg  *
6164d3236553SJohannes Berg  * @wiphy: pointer to hardware description
6165d3236553SJohannes Berg  * @iftype: interface type
61662fe8ef10SJohannes Berg  * @registered: is this wdev already registered with cfg80211
616740c575d1SJohannes Berg  * @registering: indicates we're doing registration under wiphy lock
616840c575d1SJohannes Berg  *	for the notifier
6169d3236553SJohannes Berg  * @list: (private) Used to collect the interfaces
617089a54e48SJohannes Berg  * @netdev: (private) Used to reference back to the netdev, may be %NULL
617189a54e48SJohannes Berg  * @identifier: (private) Identifier used in nl80211 to identify this
617289a54e48SJohannes Berg  *	wireless device if it has no netdev
61732d8b08feSMauro Carvalho Chehab  * @u: union containing data specific to @iftype
61747b0a0e3cSJohannes Berg  * @connected: indicates if connected or not (STA mode)
6175d3236553SJohannes Berg  * @wext: (private) Used by the internal wireless extensions compat code
61769874b71fSJohannes Berg  * @wext.ibss: (private) IBSS data part of wext handling
61779874b71fSJohannes Berg  * @wext.connect: (private) connection handling data
61789874b71fSJohannes Berg  * @wext.keys: (private) (WEP) key data
61799874b71fSJohannes Berg  * @wext.ie: (private) extra elements for association
61809874b71fSJohannes Berg  * @wext.ie_len: (private) length of extra elements
61819874b71fSJohannes Berg  * @wext.bssid: (private) selected network BSSID
61829874b71fSJohannes Berg  * @wext.ssid: (private) selected network SSID
61839874b71fSJohannes Berg  * @wext.default_key: (private) selected default key index
61849874b71fSJohannes Berg  * @wext.default_mgmt_key: (private) selected default management key index
61859874b71fSJohannes Berg  * @wext.prev_bssid: (private) previous BSSID for reassociation
61869874b71fSJohannes Berg  * @wext.prev_bssid_valid: (private) previous BSSID validity
61879bc383deSJohannes Berg  * @use_4addr: indicates 4addr mode is used on this interface, must be
61889bc383deSJohannes Berg  *	set by driver (if supported) on add_interface BEFORE registering the
61899bc383deSJohannes Berg  *	netdev and may otherwise be used by driver read-only, will be update
61909bc383deSJohannes Berg  *	by cfg80211 on change_interface
61912e161f78SJohannes Berg  * @mgmt_registrations: list of registrations for management frames
619279ea1e12SJohannes Berg  * @mgmt_registrations_need_update: mgmt registrations were updated,
619379ea1e12SJohannes Berg  *	need to propagate the update to the driver
619498104fdeSJohannes Berg  * @address: The address for this device, valid only if @netdev is %NULL
619573c7da3dSArend Van Spriel  * @is_running: true if this is a non-netdev device that has been started, e.g.
619673c7da3dSArend Van Spriel  *	the P2P Device.
6197780b40dfSJohannes Berg  * @ps: powersave mode is enabled
6198780b40dfSJohannes Berg  * @ps_timeout: dynamic powersave timeout
6199780b40dfSJohannes Berg  * @ap_unexpected_nlportid: (private) netlink port ID of application
6200780b40dfSJohannes Berg  *	registered for unexpected class 3 frames (AP mode)
6201780b40dfSJohannes Berg  * @conn: (private) cfg80211 software SME connection state machine data
6202780b40dfSJohannes Berg  * @connect_keys: (private) keys to set after connection is established
620334d50519SLior David  * @conn_bss_type: connecting/connected BSS type
6204bd2522b1SAndrzej Zaborowski  * @conn_owner_nlportid: (private) connection owner socket port ID
6205bd2522b1SAndrzej Zaborowski  * @disconnect_wk: (private) auto-disconnect work
6206bd2522b1SAndrzej Zaborowski  * @disconnect_bssid: (private) the BSSID to use for auto-disconnect
6207780b40dfSJohannes Berg  * @event_list: (private) list for internal event processing
6208780b40dfSJohannes Berg  * @event_lock: (private) lock for event list
620978f22b6aSJohannes Berg  * @owner_nlportid: (private) owner socket port ID
6210ab81007aSJohannes Berg  * @nl_owner_dead: (private) owner socket went away
6211d1383077SJohannes Berg  * @cqm_rssi_work: (private) CQM RSSI reporting work
62124a4b8169SAndrew Zaborowski  * @cqm_config: (private) nl80211 RSSI monitor state
62139bb7e0f2SJohannes Berg  * @pmsr_list: (private) peer measurement requests
62149bb7e0f2SJohannes Berg  * @pmsr_lock: (private) peer measurements requests/results lock
62159bb7e0f2SJohannes Berg  * @pmsr_free_wk: (private) peer measurements cleanup work
62164d797fceSJouni Malinen  * @unprot_beacon_reported: (private) timestamp of last
62174d797fceSJouni Malinen  *	unprotected beacon report
62182d8b08feSMauro Carvalho Chehab  * @links: array of %IEEE80211_MLD_MAX_NUM_LINKS elements containing @addr
62192d8b08feSMauro Carvalho Chehab  *	@ap and @client for each link
6220*4e1b5586SJohannes Berg  * @links.cac_started: true if DFS channel availability check has been
622162c16f21SAditya Kumar Singh  *	started
6222*4e1b5586SJohannes Berg  * @links.cac_start_time: timestamp (jiffies) when the dfs state was
622362c16f21SAditya Kumar Singh  *	entered.
6224*4e1b5586SJohannes Berg  * @links.cac_time_ms: CAC time in ms
62252d8b08feSMauro Carvalho Chehab  * @valid_links: bitmap describing what elements of @links are valid
6226d3236553SJohannes Berg  */
6227d3236553SJohannes Berg struct wireless_dev {
6228d3236553SJohannes Berg 	struct wiphy *wiphy;
6229d3236553SJohannes Berg 	enum nl80211_iftype iftype;
6230d3236553SJohannes Berg 
6231667503ddSJohannes Berg 	/* the remainder of this struct should be private to cfg80211 */
6232d3236553SJohannes Berg 	struct list_head list;
6233d3236553SJohannes Berg 	struct net_device *netdev;
6234d3236553SJohannes Berg 
623589a54e48SJohannes Berg 	u32 identifier;
623689a54e48SJohannes Berg 
62372e161f78SJohannes Berg 	struct list_head mgmt_registrations;
623879ea1e12SJohannes Berg 	u8 mgmt_registrations_need_update:1;
6239026331c4SJouni Malinen 
624040c575d1SJohannes Berg 	bool use_4addr, is_running, registered, registering;
624198104fdeSJohannes Berg 
624298104fdeSJohannes Berg 	u8 address[ETH_ALEN] __aligned(sizeof(u16));
62439bc383deSJohannes Berg 
6244b23aa676SSamuel Ortiz 	/* currently used for IBSS and SME - might be rearranged later */
62456829c878SJohannes Berg 	struct cfg80211_conn *conn;
6246fffd0934SJohannes Berg 	struct cfg80211_cached_keys *connect_keys;
624734d50519SLior David 	enum ieee80211_bss_type conn_bss_type;
6248bd2522b1SAndrzej Zaborowski 	u32 conn_owner_nlportid;
6249bd2522b1SAndrzej Zaborowski 
6250bd2522b1SAndrzej Zaborowski 	struct work_struct disconnect_wk;
6251bd2522b1SAndrzej Zaborowski 	u8 disconnect_bssid[ETH_ALEN];
6252d3236553SJohannes Berg 
6253667503ddSJohannes Berg 	struct list_head event_list;
6254667503ddSJohannes Berg 	spinlock_t event_lock;
6255667503ddSJohannes Berg 
62567b0a0e3cSJohannes Berg 	u8 connected:1;
6257f4489ebeSMichal Kazior 
6258ffb9eb3dSKalle Valo 	bool ps;
6259ffb9eb3dSKalle Valo 	int ps_timeout;
6260ffb9eb3dSKalle Valo 
626115e47304SEric W. Biederman 	u32 ap_unexpected_nlportid;
626228946da7SJohannes Berg 
6263ab81007aSJohannes Berg 	u32 owner_nlportid;
6264ab81007aSJohannes Berg 	bool nl_owner_dead;
6265ab81007aSJohannes Berg 
62663d23e349SJohannes Berg #ifdef CONFIG_CFG80211_WEXT
6267d3236553SJohannes Berg 	/* wext data */
6268cbe8fa9cSJohannes Berg 	struct {
6269cbe8fa9cSJohannes Berg 		struct cfg80211_ibss_params ibss;
6270f2129354SJohannes Berg 		struct cfg80211_connect_params connect;
6271fffd0934SJohannes Berg 		struct cfg80211_cached_keys *keys;
6272c1e5f471SJohannes Berg 		const u8 *ie;
6273f2129354SJohannes Berg 		size_t ie_len;
62749874b71fSJohannes Berg 		u8 bssid[ETH_ALEN];
62759874b71fSJohannes Berg 		u8 prev_bssid[ETH_ALEN];
6276f2129354SJohannes Berg 		u8 ssid[IEEE80211_MAX_SSID_LEN];
627708645126SJohannes Berg 		s8 default_key, default_mgmt_key;
6278ffb9eb3dSKalle Valo 		bool prev_bssid_valid;
6279cbe8fa9cSJohannes Berg 	} wext;
6280d3236553SJohannes Berg #endif
62814a4b8169SAndrew Zaborowski 
628237c20b2eSJohannes Berg 	struct wiphy_work cqm_rssi_work;
628337c20b2eSJohannes Berg 	struct cfg80211_cqm_config __rcu *cqm_config;
62849bb7e0f2SJohannes Berg 
62859bb7e0f2SJohannes Berg 	struct list_head pmsr_list;
62869bb7e0f2SJohannes Berg 	spinlock_t pmsr_lock;
62879bb7e0f2SJohannes Berg 	struct work_struct pmsr_free_wk;
62884d797fceSJouni Malinen 
62894d797fceSJouni Malinen 	unsigned long unprot_beacon_reported;
62907b0a0e3cSJohannes Berg 
62917b0a0e3cSJohannes Berg 	union {
62927b0a0e3cSJohannes Berg 		struct {
62937b0a0e3cSJohannes Berg 			u8 connected_addr[ETH_ALEN] __aligned(2);
62947b0a0e3cSJohannes Berg 			u8 ssid[IEEE80211_MAX_SSID_LEN];
62957b0a0e3cSJohannes Berg 			u8 ssid_len;
62967b0a0e3cSJohannes Berg 		} client;
62977b0a0e3cSJohannes Berg 		struct {
62987b0a0e3cSJohannes Berg 			int beacon_interval;
62997b0a0e3cSJohannes Berg 			struct cfg80211_chan_def preset_chandef;
63007b0a0e3cSJohannes Berg 			struct cfg80211_chan_def chandef;
6301414532d8SJohannes Berg 			u8 id[IEEE80211_MAX_MESH_ID_LEN];
63027b0a0e3cSJohannes Berg 			u8 id_len, id_up_len;
63037b0a0e3cSJohannes Berg 		} mesh;
63047b0a0e3cSJohannes Berg 		struct {
63057b0a0e3cSJohannes Berg 			struct cfg80211_chan_def preset_chandef;
63067b0a0e3cSJohannes Berg 			u8 ssid[IEEE80211_MAX_SSID_LEN];
63077b0a0e3cSJohannes Berg 			u8 ssid_len;
63087b0a0e3cSJohannes Berg 		} ap;
63097b0a0e3cSJohannes Berg 		struct {
63107b0a0e3cSJohannes Berg 			struct cfg80211_internal_bss *current_bss;
63117b0a0e3cSJohannes Berg 			struct cfg80211_chan_def chandef;
63127b0a0e3cSJohannes Berg 			int beacon_interval;
63137b0a0e3cSJohannes Berg 			u8 ssid[IEEE80211_MAX_SSID_LEN];
63147b0a0e3cSJohannes Berg 			u8 ssid_len;
63157b0a0e3cSJohannes Berg 		} ibss;
63167b0a0e3cSJohannes Berg 		struct {
63177b0a0e3cSJohannes Berg 			struct cfg80211_chan_def chandef;
63187b0a0e3cSJohannes Berg 		} ocb;
63197b0a0e3cSJohannes Berg 	} u;
63207b0a0e3cSJohannes Berg 
63217b0a0e3cSJohannes Berg 	struct {
63227b0a0e3cSJohannes Berg 		u8 addr[ETH_ALEN] __aligned(2);
63237b0a0e3cSJohannes Berg 		union {
63247b0a0e3cSJohannes Berg 			struct {
63257b0a0e3cSJohannes Berg 				unsigned int beacon_interval;
63267b0a0e3cSJohannes Berg 				struct cfg80211_chan_def chandef;
63277b0a0e3cSJohannes Berg 			} ap;
63287b0a0e3cSJohannes Berg 			struct {
63297b0a0e3cSJohannes Berg 				struct cfg80211_internal_bss *current_bss;
63307b0a0e3cSJohannes Berg 			} client;
63317b0a0e3cSJohannes Berg 		};
633262c16f21SAditya Kumar Singh 
633362c16f21SAditya Kumar Singh 		bool cac_started;
633462c16f21SAditya Kumar Singh 		unsigned long cac_start_time;
633562c16f21SAditya Kumar Singh 		unsigned int cac_time_ms;
63367b0a0e3cSJohannes Berg 	} links[IEEE80211_MLD_MAX_NUM_LINKS];
63377b0a0e3cSJohannes Berg 	u16 valid_links;
6338d3236553SJohannes Berg };
6339d3236553SJohannes Berg 
wdev_address(struct wireless_dev * wdev)634010de5a59SJakub Kicinski static inline const u8 *wdev_address(struct wireless_dev *wdev)
634198104fdeSJohannes Berg {
634298104fdeSJohannes Berg 	if (wdev->netdev)
634398104fdeSJohannes Berg 		return wdev->netdev->dev_addr;
634498104fdeSJohannes Berg 	return wdev->address;
634598104fdeSJohannes Berg }
634698104fdeSJohannes Berg 
wdev_running(struct wireless_dev * wdev)634773c7da3dSArend Van Spriel static inline bool wdev_running(struct wireless_dev *wdev)
634873c7da3dSArend Van Spriel {
634973c7da3dSArend Van Spriel 	if (wdev->netdev)
635073c7da3dSArend Van Spriel 		return netif_running(wdev->netdev);
635173c7da3dSArend Van Spriel 	return wdev->is_running;
635273c7da3dSArend Van Spriel }
635373c7da3dSArend Van Spriel 
6354d3236553SJohannes Berg /**
6355d3236553SJohannes Berg  * wdev_priv - return wiphy priv from wireless_dev
6356d3236553SJohannes Berg  *
6357d3236553SJohannes Berg  * @wdev: The wireless device whose wiphy's priv pointer to return
63580ae997dcSYacine Belkadi  * Return: The wiphy priv of @wdev.
6359d3236553SJohannes Berg  */
wdev_priv(struct wireless_dev * wdev)6360d3236553SJohannes Berg static inline void *wdev_priv(struct wireless_dev *wdev)
6361d3236553SJohannes Berg {
6362d3236553SJohannes Berg 	BUG_ON(!wdev);
6363d3236553SJohannes Berg 	return wiphy_priv(wdev->wiphy);
6364d3236553SJohannes Berg }
6365d3236553SJohannes Berg 
6366d70e9693SJohannes Berg /**
63677b0a0e3cSJohannes Berg  * wdev_chandef - return chandef pointer from wireless_dev
63687b0a0e3cSJohannes Berg  * @wdev: the wdev
63697b0a0e3cSJohannes Berg  * @link_id: the link ID for MLO
63707b0a0e3cSJohannes Berg  *
63717b0a0e3cSJohannes Berg  * Return: The chandef depending on the mode, or %NULL.
63727b0a0e3cSJohannes Berg  */
63737b0a0e3cSJohannes Berg struct cfg80211_chan_def *wdev_chandef(struct wireless_dev *wdev,
63747b0a0e3cSJohannes Berg 				       unsigned int link_id);
63757b0a0e3cSJohannes Berg 
WARN_INVALID_LINK_ID(struct wireless_dev * wdev,unsigned int link_id)63767b0a0e3cSJohannes Berg static inline void WARN_INVALID_LINK_ID(struct wireless_dev *wdev,
63777b0a0e3cSJohannes Berg 					unsigned int link_id)
63787b0a0e3cSJohannes Berg {
63797b0a0e3cSJohannes Berg 	WARN_ON(link_id && !wdev->valid_links);
63807b0a0e3cSJohannes Berg 	WARN_ON(wdev->valid_links &&
63817b0a0e3cSJohannes Berg 		!(wdev->valid_links & BIT(link_id)));
63827b0a0e3cSJohannes Berg }
63837b0a0e3cSJohannes Berg 
6384efbabc11SVeerendranath Jakkam #define for_each_valid_link(link_info, link_id)			\
63857b0a0e3cSJohannes Berg 	for (link_id = 0;					\
6386efbabc11SVeerendranath Jakkam 	     link_id < ((link_info)->valid_links ?		\
6387efbabc11SVeerendranath Jakkam 			ARRAY_SIZE((link_info)->links) : 1);	\
63887b0a0e3cSJohannes Berg 	     link_id++)						\
6389efbabc11SVeerendranath Jakkam 		if (!(link_info)->valid_links ||		\
6390efbabc11SVeerendranath Jakkam 		    ((link_info)->valid_links & BIT(link_id)))
63917b0a0e3cSJohannes Berg 
63927b0a0e3cSJohannes Berg /**
6393d70e9693SJohannes Berg  * DOC: Utility functions
6394d70e9693SJohannes Berg  *
6395d70e9693SJohannes Berg  * cfg80211 offers a number of utility functions that can be useful.
6396d3236553SJohannes Berg  */
6397d3236553SJohannes Berg 
6398d3236553SJohannes Berg /**
6399934f4c7dSThomas Pedersen  * ieee80211_channel_equal - compare two struct ieee80211_channel
6400934f4c7dSThomas Pedersen  *
6401934f4c7dSThomas Pedersen  * @a: 1st struct ieee80211_channel
6402934f4c7dSThomas Pedersen  * @b: 2nd struct ieee80211_channel
6403934f4c7dSThomas Pedersen  * Return: true if center frequency of @a == @b
6404934f4c7dSThomas Pedersen  */
6405934f4c7dSThomas Pedersen static inline bool
ieee80211_channel_equal(struct ieee80211_channel * a,struct ieee80211_channel * b)6406934f4c7dSThomas Pedersen ieee80211_channel_equal(struct ieee80211_channel *a,
6407934f4c7dSThomas Pedersen 			struct ieee80211_channel *b)
6408934f4c7dSThomas Pedersen {
6409934f4c7dSThomas Pedersen 	return (a->center_freq == b->center_freq &&
6410934f4c7dSThomas Pedersen 		a->freq_offset == b->freq_offset);
6411934f4c7dSThomas Pedersen }
6412934f4c7dSThomas Pedersen 
6413934f4c7dSThomas Pedersen /**
6414934f4c7dSThomas Pedersen  * ieee80211_channel_to_khz - convert ieee80211_channel to frequency in KHz
6415934f4c7dSThomas Pedersen  * @chan: struct ieee80211_channel to convert
6416934f4c7dSThomas Pedersen  * Return: The corresponding frequency (in KHz)
6417934f4c7dSThomas Pedersen  */
6418934f4c7dSThomas Pedersen static inline u32
ieee80211_channel_to_khz(const struct ieee80211_channel * chan)6419934f4c7dSThomas Pedersen ieee80211_channel_to_khz(const struct ieee80211_channel *chan)
6420934f4c7dSThomas Pedersen {
6421934f4c7dSThomas Pedersen 	return MHZ_TO_KHZ(chan->center_freq) + chan->freq_offset;
6422934f4c7dSThomas Pedersen }
6423934f4c7dSThomas Pedersen 
6424934f4c7dSThomas Pedersen /**
642511b34737SThomas Pedersen  * ieee80211_s1g_channel_width - get allowed channel width from @chan
642611b34737SThomas Pedersen  *
642711b34737SThomas Pedersen  * Only allowed for band NL80211_BAND_S1GHZ
642811b34737SThomas Pedersen  * @chan: channel
642911b34737SThomas Pedersen  * Return: The allowed channel width for this center_freq
643011b34737SThomas Pedersen  */
643111b34737SThomas Pedersen enum nl80211_chan_width
643211b34737SThomas Pedersen ieee80211_s1g_channel_width(const struct ieee80211_channel *chan);
643311b34737SThomas Pedersen 
643411b34737SThomas Pedersen /**
6435934f4c7dSThomas Pedersen  * ieee80211_channel_to_freq_khz - convert channel number to frequency
6436934f4c7dSThomas Pedersen  * @chan: channel number
6437934f4c7dSThomas Pedersen  * @band: band, necessary due to channel number overlap
6438934f4c7dSThomas Pedersen  * Return: The corresponding frequency (in KHz), or 0 if the conversion failed.
6439934f4c7dSThomas Pedersen  */
6440934f4c7dSThomas Pedersen u32 ieee80211_channel_to_freq_khz(int chan, enum nl80211_band band);
6441934f4c7dSThomas Pedersen 
6442934f4c7dSThomas Pedersen /**
6443d3236553SJohannes Berg  * ieee80211_channel_to_frequency - convert channel number to frequency
6444abe37c4bSJohannes Berg  * @chan: channel number
644559eb21a6SBruno Randolf  * @band: band, necessary due to channel number overlap
64460ae997dcSYacine Belkadi  * Return: The corresponding frequency (in MHz), or 0 if the conversion failed.
6447d3236553SJohannes Berg  */
6448934f4c7dSThomas Pedersen static inline int
ieee80211_channel_to_frequency(int chan,enum nl80211_band band)6449934f4c7dSThomas Pedersen ieee80211_channel_to_frequency(int chan, enum nl80211_band band)
6450934f4c7dSThomas Pedersen {
6451934f4c7dSThomas Pedersen 	return KHZ_TO_MHZ(ieee80211_channel_to_freq_khz(chan, band));
6452934f4c7dSThomas Pedersen }
6453934f4c7dSThomas Pedersen 
6454934f4c7dSThomas Pedersen /**
6455934f4c7dSThomas Pedersen  * ieee80211_freq_khz_to_channel - convert frequency to channel number
6456934f4c7dSThomas Pedersen  * @freq: center frequency in KHz
6457934f4c7dSThomas Pedersen  * Return: The corresponding channel, or 0 if the conversion failed.
6458934f4c7dSThomas Pedersen  */
6459934f4c7dSThomas Pedersen int ieee80211_freq_khz_to_channel(u32 freq);
6460d3236553SJohannes Berg 
6461d3236553SJohannes Berg /**
6462d3236553SJohannes Berg  * ieee80211_frequency_to_channel - convert frequency to channel number
6463934f4c7dSThomas Pedersen  * @freq: center frequency in MHz
64640ae997dcSYacine Belkadi  * Return: The corresponding channel, or 0 if the conversion failed.
6465d3236553SJohannes Berg  */
6466934f4c7dSThomas Pedersen static inline int
ieee80211_frequency_to_channel(int freq)6467934f4c7dSThomas Pedersen ieee80211_frequency_to_channel(int freq)
6468934f4c7dSThomas Pedersen {
6469934f4c7dSThomas Pedersen 	return ieee80211_freq_khz_to_channel(MHZ_TO_KHZ(freq));
6470934f4c7dSThomas Pedersen }
6471934f4c7dSThomas Pedersen 
6472934f4c7dSThomas Pedersen /**
6473934f4c7dSThomas Pedersen  * ieee80211_get_channel_khz - get channel struct from wiphy for specified
6474934f4c7dSThomas Pedersen  * frequency
6475934f4c7dSThomas Pedersen  * @wiphy: the struct wiphy to get the channel for
6476934f4c7dSThomas Pedersen  * @freq: the center frequency (in KHz) of the channel
6477934f4c7dSThomas Pedersen  * Return: The channel struct from @wiphy at @freq.
6478934f4c7dSThomas Pedersen  */
6479934f4c7dSThomas Pedersen struct ieee80211_channel *
6480934f4c7dSThomas Pedersen ieee80211_get_channel_khz(struct wiphy *wiphy, u32 freq);
6481d3236553SJohannes Berg 
6482d3236553SJohannes Berg /**
6483d3236553SJohannes Berg  * ieee80211_get_channel - get channel struct from wiphy for specified frequency
6484543b921bSArend Van Spriel  *
6485abe37c4bSJohannes Berg  * @wiphy: the struct wiphy to get the channel for
6486934f4c7dSThomas Pedersen  * @freq: the center frequency (in MHz) of the channel
64870ae997dcSYacine Belkadi  * Return: The channel struct from @wiphy at @freq.
6488d3236553SJohannes Berg  */
6489934f4c7dSThomas Pedersen static inline struct ieee80211_channel *
ieee80211_get_channel(struct wiphy * wiphy,int freq)6490934f4c7dSThomas Pedersen ieee80211_get_channel(struct wiphy *wiphy, int freq)
6491934f4c7dSThomas Pedersen {
6492934f4c7dSThomas Pedersen 	return ieee80211_get_channel_khz(wiphy, MHZ_TO_KHZ(freq));
6493934f4c7dSThomas Pedersen }
6494d3236553SJohannes Berg 
6495d3236553SJohannes Berg /**
6496afbc9c9eSJohannes Berg  * cfg80211_channel_is_psc - Check if the channel is a 6 GHz PSC
6497afbc9c9eSJohannes Berg  * @chan: control channel to check
6498afbc9c9eSJohannes Berg  *
6499afbc9c9eSJohannes Berg  * The Preferred Scanning Channels (PSC) are defined in
6500afbc9c9eSJohannes Berg  * Draft IEEE P802.11ax/D5.0, 26.17.2.3.3
650162cc206cSJeff Johnson  *
650262cc206cSJeff Johnson  * Return: %true if channel is a PSC, %false otherwise
6503afbc9c9eSJohannes Berg  */
cfg80211_channel_is_psc(struct ieee80211_channel * chan)6504afbc9c9eSJohannes Berg static inline bool cfg80211_channel_is_psc(struct ieee80211_channel *chan)
6505afbc9c9eSJohannes Berg {
6506afbc9c9eSJohannes Berg 	if (chan->band != NL80211_BAND_6GHZ)
6507afbc9c9eSJohannes Berg 		return false;
6508afbc9c9eSJohannes Berg 
6509afbc9c9eSJohannes Berg 	return ieee80211_frequency_to_channel(chan->center_freq) % 16 == 5;
6510afbc9c9eSJohannes Berg }
6511afbc9c9eSJohannes Berg 
6512afbc9c9eSJohannes Berg /**
6513510dba80SFelix Fietkau  * cfg80211_radio_chandef_valid - Check if the radio supports the chandef
6514510dba80SFelix Fietkau  *
6515510dba80SFelix Fietkau  * @radio: wiphy radio
6516510dba80SFelix Fietkau  * @chandef: chandef for current channel
6517510dba80SFelix Fietkau  *
6518510dba80SFelix Fietkau  * Return: whether or not the given chandef is valid for the given radio
6519510dba80SFelix Fietkau  */
6520510dba80SFelix Fietkau bool cfg80211_radio_chandef_valid(const struct wiphy_radio *radio,
6521510dba80SFelix Fietkau 				  const struct cfg80211_chan_def *chandef);
6522510dba80SFelix Fietkau 
6523510dba80SFelix Fietkau /**
6524d3236553SJohannes Berg  * ieee80211_get_response_rate - get basic rate for a given rate
6525d3236553SJohannes Berg  *
6526d3236553SJohannes Berg  * @sband: the band to look for rates in
6527d3236553SJohannes Berg  * @basic_rates: bitmap of basic rates
6528d3236553SJohannes Berg  * @bitrate: the bitrate for which to find the basic rate
6529d3236553SJohannes Berg  *
65300ae997dcSYacine Belkadi  * Return: The basic rate corresponding to a given bitrate, that
65310ae997dcSYacine Belkadi  * is the next lower bitrate contained in the basic rate map,
65320ae997dcSYacine Belkadi  * which is, for this function, given as a bitmap of indices of
65330ae997dcSYacine Belkadi  * rates in the band's bitrate table.
6534d3236553SJohannes Berg  */
6535623b988fSJoe Perches const struct ieee80211_rate *
6536d3236553SJohannes Berg ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
6537d3236553SJohannes Berg 			    u32 basic_rates, int bitrate);
6538d3236553SJohannes Berg 
6539b422c6cdSAshok Nagarajan /**
6540b422c6cdSAshok Nagarajan  * ieee80211_mandatory_rates - get mandatory rates for a given band
6541b422c6cdSAshok Nagarajan  * @sband: the band to look for rates in
6542b422c6cdSAshok Nagarajan  *
654362cc206cSJeff Johnson  * Return: a bitmap of the mandatory rates for the given band, bits
654462cc206cSJeff Johnson  * are set according to the rate position in the bitrates array.
6545b422c6cdSAshok Nagarajan  */
65465add321cSJohannes Berg u32 ieee80211_mandatory_rates(struct ieee80211_supported_band *sband);
6547b422c6cdSAshok Nagarajan 
6548d3236553SJohannes Berg /*
6549d3236553SJohannes Berg  * Radiotap parsing functions -- for controlled injection support
6550d3236553SJohannes Berg  *
6551d3236553SJohannes Berg  * Implemented in net/wireless/radiotap.c
655266d495d0SMauro Carvalho Chehab  * Documentation in Documentation/networking/radiotap-headers.rst
6553d3236553SJohannes Berg  */
6554d3236553SJohannes Berg 
655533e5a2f7SJohannes Berg struct radiotap_align_size {
655633e5a2f7SJohannes Berg 	uint8_t align:4, size:4;
655733e5a2f7SJohannes Berg };
655833e5a2f7SJohannes Berg 
655933e5a2f7SJohannes Berg struct ieee80211_radiotap_namespace {
656033e5a2f7SJohannes Berg 	const struct radiotap_align_size *align_size;
656133e5a2f7SJohannes Berg 	int n_bits;
656233e5a2f7SJohannes Berg 	uint32_t oui;
656333e5a2f7SJohannes Berg 	uint8_t subns;
656433e5a2f7SJohannes Berg };
656533e5a2f7SJohannes Berg 
656633e5a2f7SJohannes Berg struct ieee80211_radiotap_vendor_namespaces {
656733e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_namespace *ns;
656833e5a2f7SJohannes Berg 	int n_ns;
656933e5a2f7SJohannes Berg };
657033e5a2f7SJohannes Berg 
6571d3236553SJohannes Berg /**
6572d3236553SJohannes Berg  * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args
657333e5a2f7SJohannes Berg  * @this_arg_index: index of current arg, valid after each successful call
657433e5a2f7SJohannes Berg  *	to ieee80211_radiotap_iterator_next()
657533e5a2f7SJohannes Berg  * @this_arg: pointer to current radiotap arg; it is valid after each
657633e5a2f7SJohannes Berg  *	call to ieee80211_radiotap_iterator_next() but also after
657733e5a2f7SJohannes Berg  *	ieee80211_radiotap_iterator_init() where it will point to
657833e5a2f7SJohannes Berg  *	the beginning of the actual data portion
657933e5a2f7SJohannes Berg  * @this_arg_size: length of the current arg, for convenience
658033e5a2f7SJohannes Berg  * @current_namespace: pointer to the current namespace definition
658133e5a2f7SJohannes Berg  *	(or internally %NULL if the current namespace is unknown)
658233e5a2f7SJohannes Berg  * @is_radiotap_ns: indicates whether the current namespace is the default
658333e5a2f7SJohannes Berg  *	radiotap namespace or not
658433e5a2f7SJohannes Berg  *
658533e5a2f7SJohannes Berg  * @_rtheader: pointer to the radiotap header we are walking through
658633e5a2f7SJohannes Berg  * @_max_length: length of radiotap header in cpu byte ordering
658733e5a2f7SJohannes Berg  * @_arg_index: next argument index
658833e5a2f7SJohannes Berg  * @_arg: next argument pointer
658933e5a2f7SJohannes Berg  * @_next_bitmap: internal pointer to next present u32
659033e5a2f7SJohannes Berg  * @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present
659133e5a2f7SJohannes Berg  * @_vns: vendor namespace definitions
659233e5a2f7SJohannes Berg  * @_next_ns_data: beginning of the next namespace's data
659333e5a2f7SJohannes Berg  * @_reset_on_ext: internal; reset the arg index to 0 when going to the
659433e5a2f7SJohannes Berg  *	next bitmap word
659533e5a2f7SJohannes Berg  *
659633e5a2f7SJohannes Berg  * Describes the radiotap parser state. Fields prefixed with an underscore
659733e5a2f7SJohannes Berg  * must not be used by users of the parser, only by the parser internally.
6598d3236553SJohannes Berg  */
6599d3236553SJohannes Berg 
6600d3236553SJohannes Berg struct ieee80211_radiotap_iterator {
660133e5a2f7SJohannes Berg 	struct ieee80211_radiotap_header *_rtheader;
660233e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_vendor_namespaces *_vns;
660333e5a2f7SJohannes Berg 	const struct ieee80211_radiotap_namespace *current_namespace;
6604d3236553SJohannes Berg 
660533e5a2f7SJohannes Berg 	unsigned char *_arg, *_next_ns_data;
660667272440SJohannes Berg 	__le32 *_next_bitmap;
660733e5a2f7SJohannes Berg 
660833e5a2f7SJohannes Berg 	unsigned char *this_arg;
660933e5a2f7SJohannes Berg 	int this_arg_index;
661033e5a2f7SJohannes Berg 	int this_arg_size;
661133e5a2f7SJohannes Berg 
661233e5a2f7SJohannes Berg 	int is_radiotap_ns;
661333e5a2f7SJohannes Berg 
661433e5a2f7SJohannes Berg 	int _max_length;
661533e5a2f7SJohannes Berg 	int _arg_index;
661633e5a2f7SJohannes Berg 	uint32_t _bitmap_shifter;
661733e5a2f7SJohannes Berg 	int _reset_on_ext;
6618d3236553SJohannes Berg };
6619d3236553SJohannes Berg 
662010dd9b7cSJoe Perches int
662110dd9b7cSJoe Perches ieee80211_radiotap_iterator_init(struct ieee80211_radiotap_iterator *iterator,
6622d3236553SJohannes Berg 				 struct ieee80211_radiotap_header *radiotap_header,
662310dd9b7cSJoe Perches 				 int max_length,
662410dd9b7cSJoe Perches 				 const struct ieee80211_radiotap_vendor_namespaces *vns);
6625d3236553SJohannes Berg 
662610dd9b7cSJoe Perches int
662710dd9b7cSJoe Perches ieee80211_radiotap_iterator_next(struct ieee80211_radiotap_iterator *iterator);
6628d3236553SJohannes Berg 
662933e5a2f7SJohannes Berg 
6630e31a16d6SZhu Yi extern const unsigned char rfc1042_header[6];
6631e31a16d6SZhu Yi extern const unsigned char bridge_tunnel_header[6];
6632e31a16d6SZhu Yi 
6633e31a16d6SZhu Yi /**
6634e31a16d6SZhu Yi  * ieee80211_get_hdrlen_from_skb - get header length from data
6635e31a16d6SZhu Yi  *
6636e31a16d6SZhu Yi  * @skb: the frame
66370ae997dcSYacine Belkadi  *
66380ae997dcSYacine Belkadi  * Given an skb with a raw 802.11 header at the data pointer this function
66390ae997dcSYacine Belkadi  * returns the 802.11 header length.
66400ae997dcSYacine Belkadi  *
66410ae997dcSYacine Belkadi  * Return: The 802.11 header length in bytes (not including encryption
66420ae997dcSYacine Belkadi  * headers). Or 0 if the data in the sk_buff is too short to contain a valid
66430ae997dcSYacine Belkadi  * 802.11 header.
6644e31a16d6SZhu Yi  */
6645e31a16d6SZhu Yi unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb);
6646e31a16d6SZhu Yi 
6647e31a16d6SZhu Yi /**
6648e31a16d6SZhu Yi  * ieee80211_hdrlen - get header length in bytes from frame control
6649e31a16d6SZhu Yi  * @fc: frame control field in little-endian format
66500ae997dcSYacine Belkadi  * Return: The header length in bytes.
6651e31a16d6SZhu Yi  */
6652633adf1aSJohannes Berg unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc);
6653e31a16d6SZhu Yi 
6654e31a16d6SZhu Yi /**
66559b395bc3SJohannes Berg  * ieee80211_get_mesh_hdrlen - get mesh extension header length
66569b395bc3SJohannes Berg  * @meshhdr: the mesh extension header, only the flags field
66579b395bc3SJohannes Berg  *	(first byte) will be accessed
66580ae997dcSYacine Belkadi  * Return: The length of the extension header, which is always at
66599b395bc3SJohannes Berg  * least 6 bytes and at most 18 if address 5 and 6 are present.
66609b395bc3SJohannes Berg  */
66619b395bc3SJohannes Berg unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr);
66629b395bc3SJohannes Berg 
66639b395bc3SJohannes Berg /**
6664d70e9693SJohannes Berg  * DOC: Data path helpers
6665d70e9693SJohannes Berg  *
6666d70e9693SJohannes Berg  * In addition to generic utilities, cfg80211 also offers
6667d70e9693SJohannes Berg  * functions that help implement the data path for devices
6668d70e9693SJohannes Berg  * that do not do the 802.11/802.3 conversion on the device.
6669d70e9693SJohannes Berg  */
6670d70e9693SJohannes Berg 
6671d70e9693SJohannes Berg /**
66727f6990c8SJohannes Berg  * ieee80211_data_to_8023_exthdr - convert an 802.11 data frame to 802.3
66737f6990c8SJohannes Berg  * @skb: the 802.11 data frame
66747f6990c8SJohannes Berg  * @ehdr: pointer to a &struct ethhdr that will get the header, instead
66757f6990c8SJohannes Berg  *	of it being pushed into the SKB
66767f6990c8SJohannes Berg  * @addr: the device MAC address
66777f6990c8SJohannes Berg  * @iftype: the virtual interface type
667824bba078SFelix Fietkau  * @data_offset: offset of payload after the 802.11 header
66792d8b08feSMauro Carvalho Chehab  * @is_amsdu: true if the 802.11 header is A-MSDU
66807f6990c8SJohannes Berg  * Return: 0 on success. Non-zero on error.
66817f6990c8SJohannes Berg  */
66827f6990c8SJohannes Berg int ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr,
668324bba078SFelix Fietkau 				  const u8 *addr, enum nl80211_iftype iftype,
6684a1d5ff56SMathy Vanhoef 				  u8 data_offset, bool is_amsdu);
66857f6990c8SJohannes Berg 
66867f6990c8SJohannes Berg /**
6687e31a16d6SZhu Yi  * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3
6688e31a16d6SZhu Yi  * @skb: the 802.11 data frame
6689e31a16d6SZhu Yi  * @addr: the device MAC address
6690e31a16d6SZhu Yi  * @iftype: the virtual interface type
66910ae997dcSYacine Belkadi  * Return: 0 on success. Non-zero on error.
6692e31a16d6SZhu Yi  */
ieee80211_data_to_8023(struct sk_buff * skb,const u8 * addr,enum nl80211_iftype iftype)66937f6990c8SJohannes Berg static inline int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
66947f6990c8SJohannes Berg 					 enum nl80211_iftype iftype)
66957f6990c8SJohannes Berg {
6696a1d5ff56SMathy Vanhoef 	return ieee80211_data_to_8023_exthdr(skb, NULL, addr, iftype, 0, false);
66977f6990c8SJohannes Berg }
6698e31a16d6SZhu Yi 
6699e31a16d6SZhu Yi /**
67006e4c0d04SFelix Fietkau  * ieee80211_is_valid_amsdu - check if subframe lengths of an A-MSDU are valid
67016e4c0d04SFelix Fietkau  *
67026e4c0d04SFelix Fietkau  * This is used to detect non-standard A-MSDU frames, e.g. the ones generated
67036e4c0d04SFelix Fietkau  * by ath10k and ath11k, where the subframe length includes the length of the
67046e4c0d04SFelix Fietkau  * mesh control field.
67056e4c0d04SFelix Fietkau  *
67066e4c0d04SFelix Fietkau  * @skb: The input A-MSDU frame without any headers.
6707fe4a6d2dSFelix Fietkau  * @mesh_hdr: the type of mesh header to test
6708fe4a6d2dSFelix Fietkau  *	0: non-mesh A-MSDU length field
6709fe4a6d2dSFelix Fietkau  *	1: big-endian mesh A-MSDU length field
6710fe4a6d2dSFelix Fietkau  *	2: little-endian mesh A-MSDU length field
67116e4c0d04SFelix Fietkau  * Returns: true if subframe header lengths are valid for the @mesh_hdr mode
67126e4c0d04SFelix Fietkau  */
6713fe4a6d2dSFelix Fietkau bool ieee80211_is_valid_amsdu(struct sk_buff *skb, u8 mesh_hdr);
67146e4c0d04SFelix Fietkau 
67156e4c0d04SFelix Fietkau /**
6716eaf85ca7SZhu Yi  * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame
6717eaf85ca7SZhu Yi  *
67187f6990c8SJohannes Berg  * Decode an IEEE 802.11 A-MSDU and convert it to a list of 802.3 frames.
67197f6990c8SJohannes Berg  * The @list will be empty if the decode fails. The @skb must be fully
67207f6990c8SJohannes Berg  * header-less before being passed in here; it is freed in this function.
6721eaf85ca7SZhu Yi  *
67227f6990c8SJohannes Berg  * @skb: The input A-MSDU frame without any headers.
6723eaf85ca7SZhu Yi  * @list: The output list of 802.3 frames. It must be allocated and
6724085a6c10SRandy Dunlap  *	initialized by the caller.
6725eaf85ca7SZhu Yi  * @addr: The device MAC address.
6726eaf85ca7SZhu Yi  * @iftype: The device interface type.
6727eaf85ca7SZhu Yi  * @extra_headroom: The hardware extra headroom for SKBs in the @list.
67288b935ee2SJohannes Berg  * @check_da: DA to check in the inner ethernet header, or NULL
67298b935ee2SJohannes Berg  * @check_sa: SA to check in the inner ethernet header, or NULL
6730fe4a6d2dSFelix Fietkau  * @mesh_control: see mesh_hdr in ieee80211_is_valid_amsdu
6731eaf85ca7SZhu Yi  */
6732eaf85ca7SZhu Yi void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,
6733eaf85ca7SZhu Yi 			      const u8 *addr, enum nl80211_iftype iftype,
67348b3becadSYogesh Ashok Powar 			      const unsigned int extra_headroom,
6735986e43b1SFelix Fietkau 			      const u8 *check_da, const u8 *check_sa,
6736fe4a6d2dSFelix Fietkau 			      u8 mesh_control);
6737986e43b1SFelix Fietkau 
6738986e43b1SFelix Fietkau /**
6739986e43b1SFelix Fietkau  * ieee80211_get_8023_tunnel_proto - get RFC1042 or bridge tunnel encap protocol
6740986e43b1SFelix Fietkau  *
6741986e43b1SFelix Fietkau  * Check for RFC1042 or bridge tunnel header and fetch the encapsulated
6742986e43b1SFelix Fietkau  * protocol.
6743986e43b1SFelix Fietkau  *
6744986e43b1SFelix Fietkau  * @hdr: pointer to the MSDU payload
6745986e43b1SFelix Fietkau  * @proto: destination pointer to store the protocol
6746986e43b1SFelix Fietkau  * Return: true if encapsulation was found
6747986e43b1SFelix Fietkau  */
6748986e43b1SFelix Fietkau bool ieee80211_get_8023_tunnel_proto(const void *hdr, __be16 *proto);
6749986e43b1SFelix Fietkau 
6750986e43b1SFelix Fietkau /**
6751986e43b1SFelix Fietkau  * ieee80211_strip_8023_mesh_hdr - strip mesh header from converted 802.3 frames
6752986e43b1SFelix Fietkau  *
6753986e43b1SFelix Fietkau  * Strip the mesh header, which was left in by ieee80211_data_to_8023 as part
6754986e43b1SFelix Fietkau  * of the MSDU data. Also move any source/destination addresses from the mesh
6755986e43b1SFelix Fietkau  * header to the ethernet header (if present).
6756986e43b1SFelix Fietkau  *
6757986e43b1SFelix Fietkau  * @skb: The 802.3 frame with embedded mesh header
675862cc206cSJeff Johnson  *
675962cc206cSJeff Johnson  * Return: 0 on success. Non-zero on error.
6760986e43b1SFelix Fietkau  */
6761986e43b1SFelix Fietkau int ieee80211_strip_8023_mesh_hdr(struct sk_buff *skb);
6762eaf85ca7SZhu Yi 
6763eaf85ca7SZhu Yi /**
6764e31a16d6SZhu Yi  * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame
6765e31a16d6SZhu Yi  * @skb: the data frame
6766fa9ffc74SKyeyoon Park  * @qos_map: Interworking QoS mapping or %NULL if not in use
67670ae997dcSYacine Belkadi  * Return: The 802.1p/1d tag.
6768e31a16d6SZhu Yi  */
6769fa9ffc74SKyeyoon Park unsigned int cfg80211_classify8021d(struct sk_buff *skb,
6770fa9ffc74SKyeyoon Park 				    struct cfg80211_qos_map *qos_map);
6771e31a16d6SZhu Yi 
6772c21dbf92SJohannes Berg /**
677349a68e0dSJohannes Berg  * cfg80211_find_elem_match - match information element and byte array in data
677449a68e0dSJohannes Berg  *
677549a68e0dSJohannes Berg  * @eid: element ID
677649a68e0dSJohannes Berg  * @ies: data consisting of IEs
677749a68e0dSJohannes Berg  * @len: length of data
677849a68e0dSJohannes Berg  * @match: byte array to match
677949a68e0dSJohannes Berg  * @match_len: number of bytes in the match array
678049a68e0dSJohannes Berg  * @match_offset: offset in the IE data where the byte array should match.
678149a68e0dSJohannes Berg  *	Note the difference to cfg80211_find_ie_match() which considers
678249a68e0dSJohannes Berg  *	the offset to start from the element ID byte, but here we take
678349a68e0dSJohannes Berg  *	the data portion instead.
678449a68e0dSJohannes Berg  *
678549a68e0dSJohannes Berg  * Return: %NULL if the element ID could not be found or if
678649a68e0dSJohannes Berg  * the element is invalid (claims to be longer than the given
678749a68e0dSJohannes Berg  * data) or if the byte array doesn't match; otherwise return the
678849a68e0dSJohannes Berg  * requested element struct.
678949a68e0dSJohannes Berg  *
679049a68e0dSJohannes Berg  * Note: There are no checks on the element length other than
679149a68e0dSJohannes Berg  * having to fit into the given data and being large enough for the
679249a68e0dSJohannes Berg  * byte array to match.
679349a68e0dSJohannes Berg  */
679449a68e0dSJohannes Berg const struct element *
679549a68e0dSJohannes Berg cfg80211_find_elem_match(u8 eid, const u8 *ies, unsigned int len,
679649a68e0dSJohannes Berg 			 const u8 *match, unsigned int match_len,
679749a68e0dSJohannes Berg 			 unsigned int match_offset);
679849a68e0dSJohannes Berg 
679949a68e0dSJohannes Berg /**
6800fbd05e4aSLuca Coelho  * cfg80211_find_ie_match - match information element and byte array in data
6801fbd05e4aSLuca Coelho  *
6802fbd05e4aSLuca Coelho  * @eid: element ID
6803fbd05e4aSLuca Coelho  * @ies: data consisting of IEs
6804fbd05e4aSLuca Coelho  * @len: length of data
6805fbd05e4aSLuca Coelho  * @match: byte array to match
6806fbd05e4aSLuca Coelho  * @match_len: number of bytes in the match array
6807fbd05e4aSLuca Coelho  * @match_offset: offset in the IE where the byte array should match.
6808fbd05e4aSLuca Coelho  *	If match_len is zero, this must also be set to zero.
6809fbd05e4aSLuca Coelho  *	Otherwise this must be set to 2 or more, because the first
6810fbd05e4aSLuca Coelho  *	byte is the element id, which is already compared to eid, and
6811fbd05e4aSLuca Coelho  *	the second byte is the IE length.
6812fbd05e4aSLuca Coelho  *
6813fbd05e4aSLuca Coelho  * Return: %NULL if the element ID could not be found or if
6814fbd05e4aSLuca Coelho  * the element is invalid (claims to be longer than the given
6815fbd05e4aSLuca Coelho  * data) or if the byte array doesn't match, or a pointer to the first
6816fbd05e4aSLuca Coelho  * byte of the requested element, that is the byte containing the
6817fbd05e4aSLuca Coelho  * element ID.
6818fbd05e4aSLuca Coelho  *
6819fbd05e4aSLuca Coelho  * Note: There are no checks on the element length other than
6820fbd05e4aSLuca Coelho  * having to fit into the given data and being large enough for the
6821fbd05e4aSLuca Coelho  * byte array to match.
6822fbd05e4aSLuca Coelho  */
682349a68e0dSJohannes Berg static inline const u8 *
cfg80211_find_ie_match(u8 eid,const u8 * ies,unsigned int len,const u8 * match,unsigned int match_len,unsigned int match_offset)682449a68e0dSJohannes Berg cfg80211_find_ie_match(u8 eid, const u8 *ies, unsigned int len,
682549a68e0dSJohannes Berg 		       const u8 *match, unsigned int match_len,
682649a68e0dSJohannes Berg 		       unsigned int match_offset)
682749a68e0dSJohannes Berg {
682849a68e0dSJohannes Berg 	/* match_offset can't be smaller than 2, unless match_len is
682949a68e0dSJohannes Berg 	 * zero, in which case match_offset must be zero as well.
683049a68e0dSJohannes Berg 	 */
683149a68e0dSJohannes Berg 	if (WARN_ON((match_len && match_offset < 2) ||
683249a68e0dSJohannes Berg 		    (!match_len && match_offset)))
683349a68e0dSJohannes Berg 		return NULL;
683449a68e0dSJohannes Berg 
68357e367b06SJohannes Berg 	return (const void *)cfg80211_find_elem_match(eid, ies, len,
683649a68e0dSJohannes Berg 						      match, match_len,
683749a68e0dSJohannes Berg 						      match_offset ?
683849a68e0dSJohannes Berg 							match_offset - 2 : 0);
683949a68e0dSJohannes Berg }
684049a68e0dSJohannes Berg 
684149a68e0dSJohannes Berg /**
684249a68e0dSJohannes Berg  * cfg80211_find_elem - find information element in data
684349a68e0dSJohannes Berg  *
684449a68e0dSJohannes Berg  * @eid: element ID
684549a68e0dSJohannes Berg  * @ies: data consisting of IEs
684649a68e0dSJohannes Berg  * @len: length of data
684749a68e0dSJohannes Berg  *
684849a68e0dSJohannes Berg  * Return: %NULL if the element ID could not be found or if
684949a68e0dSJohannes Berg  * the element is invalid (claims to be longer than the given
685049a68e0dSJohannes Berg  * data) or if the byte array doesn't match; otherwise return the
685149a68e0dSJohannes Berg  * requested element struct.
685249a68e0dSJohannes Berg  *
685349a68e0dSJohannes Berg  * Note: There are no checks on the element length other than
685449a68e0dSJohannes Berg  * having to fit into the given data.
685549a68e0dSJohannes Berg  */
685649a68e0dSJohannes Berg static inline const struct element *
cfg80211_find_elem(u8 eid,const u8 * ies,int len)685749a68e0dSJohannes Berg cfg80211_find_elem(u8 eid, const u8 *ies, int len)
685849a68e0dSJohannes Berg {
685949a68e0dSJohannes Berg 	return cfg80211_find_elem_match(eid, ies, len, NULL, 0, 0);
686049a68e0dSJohannes Berg }
6861fbd05e4aSLuca Coelho 
6862fbd05e4aSLuca Coelho /**
6863c21dbf92SJohannes Berg  * cfg80211_find_ie - find information element in data
6864c21dbf92SJohannes Berg  *
6865c21dbf92SJohannes Berg  * @eid: element ID
6866c21dbf92SJohannes Berg  * @ies: data consisting of IEs
6867c21dbf92SJohannes Berg  * @len: length of data
6868c21dbf92SJohannes Berg  *
68690ae997dcSYacine Belkadi  * Return: %NULL if the element ID could not be found or if
68700ae997dcSYacine Belkadi  * the element is invalid (claims to be longer than the given
68710ae997dcSYacine Belkadi  * data), or a pointer to the first byte of the requested
68720ae997dcSYacine Belkadi  * element, that is the byte containing the element ID.
68730ae997dcSYacine Belkadi  *
68740ae997dcSYacine Belkadi  * Note: There are no checks on the element length other than
68750ae997dcSYacine Belkadi  * having to fit into the given data.
6876c21dbf92SJohannes Berg  */
cfg80211_find_ie(u8 eid,const u8 * ies,int len)6877fbd05e4aSLuca Coelho static inline const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len)
6878fbd05e4aSLuca Coelho {
6879fbd05e4aSLuca Coelho 	return cfg80211_find_ie_match(eid, ies, len, NULL, 0, 0);
6880fbd05e4aSLuca Coelho }
6881c21dbf92SJohannes Berg 
6882d70e9693SJohannes Berg /**
688349a68e0dSJohannes Berg  * cfg80211_find_ext_elem - find information element with EID Extension in data
688449a68e0dSJohannes Berg  *
688549a68e0dSJohannes Berg  * @ext_eid: element ID Extension
688649a68e0dSJohannes Berg  * @ies: data consisting of IEs
688749a68e0dSJohannes Berg  * @len: length of data
688849a68e0dSJohannes Berg  *
688998e0c7f8SRandy Dunlap  * Return: %NULL if the extended element could not be found or if
689049a68e0dSJohannes Berg  * the element is invalid (claims to be longer than the given
689149a68e0dSJohannes Berg  * data) or if the byte array doesn't match; otherwise return the
689249a68e0dSJohannes Berg  * requested element struct.
689349a68e0dSJohannes Berg  *
689449a68e0dSJohannes Berg  * Note: There are no checks on the element length other than
689549a68e0dSJohannes Berg  * having to fit into the given data.
689649a68e0dSJohannes Berg  */
689749a68e0dSJohannes Berg static inline const struct element *
cfg80211_find_ext_elem(u8 ext_eid,const u8 * ies,int len)689849a68e0dSJohannes Berg cfg80211_find_ext_elem(u8 ext_eid, const u8 *ies, int len)
689949a68e0dSJohannes Berg {
690049a68e0dSJohannes Berg 	return cfg80211_find_elem_match(WLAN_EID_EXTENSION, ies, len,
690149a68e0dSJohannes Berg 					&ext_eid, 1, 0);
690249a68e0dSJohannes Berg }
690349a68e0dSJohannes Berg 
690449a68e0dSJohannes Berg /**
69053f817fe7SJouni Malinen  * cfg80211_find_ext_ie - find information element with EID Extension in data
69063f817fe7SJouni Malinen  *
69073f817fe7SJouni Malinen  * @ext_eid: element ID Extension
69083f817fe7SJouni Malinen  * @ies: data consisting of IEs
69093f817fe7SJouni Malinen  * @len: length of data
69103f817fe7SJouni Malinen  *
69113f817fe7SJouni Malinen  * Return: %NULL if the extended element ID could not be found or if
69123f817fe7SJouni Malinen  * the element is invalid (claims to be longer than the given
69133f817fe7SJouni Malinen  * data), or a pointer to the first byte of the requested
69143f817fe7SJouni Malinen  * element, that is the byte containing the element ID.
69153f817fe7SJouni Malinen  *
69163f817fe7SJouni Malinen  * Note: There are no checks on the element length other than
69173f817fe7SJouni Malinen  * having to fit into the given data.
69183f817fe7SJouni Malinen  */
cfg80211_find_ext_ie(u8 ext_eid,const u8 * ies,int len)69193f817fe7SJouni Malinen static inline const u8 *cfg80211_find_ext_ie(u8 ext_eid, const u8 *ies, int len)
69203f817fe7SJouni Malinen {
69213f817fe7SJouni Malinen 	return cfg80211_find_ie_match(WLAN_EID_EXTENSION, ies, len,
69223f817fe7SJouni Malinen 				      &ext_eid, 1, 2);
69233f817fe7SJouni Malinen }
69243f817fe7SJouni Malinen 
69253f817fe7SJouni Malinen /**
692649a68e0dSJohannes Berg  * cfg80211_find_vendor_elem - find vendor specific information element in data
692749a68e0dSJohannes Berg  *
692849a68e0dSJohannes Berg  * @oui: vendor OUI
692949a68e0dSJohannes Berg  * @oui_type: vendor-specific OUI type (must be < 0xff), negative means any
693049a68e0dSJohannes Berg  * @ies: data consisting of IEs
693149a68e0dSJohannes Berg  * @len: length of data
693249a68e0dSJohannes Berg  *
693349a68e0dSJohannes Berg  * Return: %NULL if the vendor specific element ID could not be found or if the
693449a68e0dSJohannes Berg  * element is invalid (claims to be longer than the given data); otherwise
693549a68e0dSJohannes Berg  * return the element structure for the requested element.
693649a68e0dSJohannes Berg  *
693749a68e0dSJohannes Berg  * Note: There are no checks on the element length other than having to fit into
693849a68e0dSJohannes Berg  * the given data.
693949a68e0dSJohannes Berg  */
694049a68e0dSJohannes Berg const struct element *cfg80211_find_vendor_elem(unsigned int oui, int oui_type,
694149a68e0dSJohannes Berg 						const u8 *ies,
694249a68e0dSJohannes Berg 						unsigned int len);
694349a68e0dSJohannes Berg 
694449a68e0dSJohannes Berg /**
69450c28ec58SEliad Peller  * cfg80211_find_vendor_ie - find vendor specific information element in data
69460c28ec58SEliad Peller  *
69470c28ec58SEliad Peller  * @oui: vendor OUI
69489e9ea439SEmmanuel Grumbach  * @oui_type: vendor-specific OUI type (must be < 0xff), negative means any
69490c28ec58SEliad Peller  * @ies: data consisting of IEs
69500c28ec58SEliad Peller  * @len: length of data
69510c28ec58SEliad Peller  *
69520ae997dcSYacine Belkadi  * Return: %NULL if the vendor specific element ID could not be found or if the
69530ae997dcSYacine Belkadi  * element is invalid (claims to be longer than the given data), or a pointer to
69540ae997dcSYacine Belkadi  * the first byte of the requested element, that is the byte containing the
69550ae997dcSYacine Belkadi  * element ID.
69560ae997dcSYacine Belkadi  *
69570ae997dcSYacine Belkadi  * Note: There are no checks on the element length other than having to fit into
69580ae997dcSYacine Belkadi  * the given data.
69590c28ec58SEliad Peller  */
696049a68e0dSJohannes Berg static inline const u8 *
cfg80211_find_vendor_ie(unsigned int oui,int oui_type,const u8 * ies,unsigned int len)696149a68e0dSJohannes Berg cfg80211_find_vendor_ie(unsigned int oui, int oui_type,
696249a68e0dSJohannes Berg 			const u8 *ies, unsigned int len)
696349a68e0dSJohannes Berg {
69647e367b06SJohannes Berg 	return (const void *)cfg80211_find_vendor_elem(oui, oui_type, ies, len);
696549a68e0dSJohannes Berg }
69660c28ec58SEliad Peller 
69670c28ec58SEliad Peller /**
696822667035SJohannes Berg  * enum cfg80211_rnr_iter_ret - reduced neighbor report iteration state
696922667035SJohannes Berg  * @RNR_ITER_CONTINUE: continue iterating with the next entry
697022667035SJohannes Berg  * @RNR_ITER_BREAK: break iteration and return success
697122667035SJohannes Berg  * @RNR_ITER_ERROR: break iteration and return error
697222667035SJohannes Berg  */
697322667035SJohannes Berg enum cfg80211_rnr_iter_ret {
697422667035SJohannes Berg 	RNR_ITER_CONTINUE,
697522667035SJohannes Berg 	RNR_ITER_BREAK,
697622667035SJohannes Berg 	RNR_ITER_ERROR,
697722667035SJohannes Berg };
697822667035SJohannes Berg 
697922667035SJohannes Berg /**
698022667035SJohannes Berg  * cfg80211_iter_rnr - iterate reduced neighbor report entries
698122667035SJohannes Berg  * @elems: the frame elements to iterate RNR elements and then
698222667035SJohannes Berg  *	their entries in
698322667035SJohannes Berg  * @elems_len: length of the elements
698422667035SJohannes Berg  * @iter: iteration function, see also &enum cfg80211_rnr_iter_ret
698522667035SJohannes Berg  *	for the return value
698622667035SJohannes Berg  * @iter_data: additional data passed to the iteration function
698722667035SJohannes Berg  * Return: %true on success (after successfully iterating all entries
698822667035SJohannes Berg  *	or if the iteration function returned %RNR_ITER_BREAK),
698922667035SJohannes Berg  *	%false on error (iteration function returned %RNR_ITER_ERROR
699022667035SJohannes Berg  *	or elements were malformed.)
699122667035SJohannes Berg  */
699222667035SJohannes Berg bool cfg80211_iter_rnr(const u8 *elems, size_t elems_len,
699322667035SJohannes Berg 		       enum cfg80211_rnr_iter_ret
699422667035SJohannes Berg 		       (*iter)(void *data, u8 type,
699522667035SJohannes Berg 			       const struct ieee80211_neighbor_ap_info *info,
699622667035SJohannes Berg 			       const u8 *tbtt_info, u8 tbtt_info_len),
699722667035SJohannes Berg 		       void *iter_data);
699822667035SJohannes Berg 
699922667035SJohannes Berg /**
7000f837a653SBenjamin Berg  * cfg80211_defragment_element - Defrag the given element data into a buffer
7001f837a653SBenjamin Berg  *
7002f837a653SBenjamin Berg  * @elem: the element to defragment
7003f837a653SBenjamin Berg  * @ies: elements where @elem is contained
7004f837a653SBenjamin Berg  * @ieslen: length of @ies
70058ade3356SJohannes Berg  * @data: buffer to store element data, or %NULL to just determine size
70068ade3356SJohannes Berg  * @data_len: length of @data, or 0
7007f837a653SBenjamin Berg  * @frag_id: the element ID of fragments
7008f837a653SBenjamin Berg  *
7009f837a653SBenjamin Berg  * Return: length of @data, or -EINVAL on error
7010f837a653SBenjamin Berg  *
7011f837a653SBenjamin Berg  * Copy out all data from an element that may be fragmented into @data, while
7012f837a653SBenjamin Berg  * skipping all headers.
7013f837a653SBenjamin Berg  *
7014f837a653SBenjamin Berg  * The function uses memmove() internally. It is acceptable to defragment an
7015f837a653SBenjamin Berg  * element in-place.
7016f837a653SBenjamin Berg  */
7017f837a653SBenjamin Berg ssize_t cfg80211_defragment_element(const struct element *elem, const u8 *ies,
7018f837a653SBenjamin Berg 				    size_t ieslen, u8 *data, size_t data_len,
7019f837a653SBenjamin Berg 				    u8 frag_id);
7020f837a653SBenjamin Berg 
7021f837a653SBenjamin Berg /**
702230ca1aa5SDedy Lansky  * cfg80211_send_layer2_update - send layer 2 update frame
702330ca1aa5SDedy Lansky  *
702430ca1aa5SDedy Lansky  * @dev: network device
702530ca1aa5SDedy Lansky  * @addr: STA MAC address
702630ca1aa5SDedy Lansky  *
702730ca1aa5SDedy Lansky  * Wireless drivers can use this function to update forwarding tables in bridge
702830ca1aa5SDedy Lansky  * devices upon STA association.
702930ca1aa5SDedy Lansky  */
703030ca1aa5SDedy Lansky void cfg80211_send_layer2_update(struct net_device *dev, const u8 *addr);
703130ca1aa5SDedy Lansky 
703230ca1aa5SDedy Lansky /**
7033d70e9693SJohannes Berg  * DOC: Regulatory enforcement infrastructure
7034d70e9693SJohannes Berg  *
7035d70e9693SJohannes Berg  * TODO
7036d3236553SJohannes Berg  */
7037d3236553SJohannes Berg 
7038d3236553SJohannes Berg /**
7039d3236553SJohannes Berg  * regulatory_hint - driver hint to the wireless core a regulatory domain
7040d3236553SJohannes Berg  * @wiphy: the wireless device giving the hint (used only for reporting
7041d3236553SJohannes Berg  *	conflicts)
7042d3236553SJohannes Berg  * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain
7043d3236553SJohannes Berg  *	should be in. If @rd is set this should be NULL. Note that if you
7044d3236553SJohannes Berg  *	set this to NULL you should still set rd->alpha2 to some accepted
7045d3236553SJohannes Berg  *	alpha2.
7046d3236553SJohannes Berg  *
7047d3236553SJohannes Berg  * Wireless drivers can use this function to hint to the wireless core
7048d3236553SJohannes Berg  * what it believes should be the current regulatory domain by
7049d3236553SJohannes Berg  * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory
7050d3236553SJohannes Berg  * domain should be in or by providing a completely build regulatory domain.
7051d3236553SJohannes Berg  * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried
7052d3236553SJohannes Berg  * for a regulatory domain structure for the respective country.
7053d3236553SJohannes Berg  *
7054d3236553SJohannes Berg  * The wiphy must have been registered to cfg80211 prior to this call.
7055d3236553SJohannes Berg  * For cfg80211 drivers this means you must first use wiphy_register(),
7056d3236553SJohannes Berg  * for mac80211 drivers you must first use ieee80211_register_hw().
7057d3236553SJohannes Berg  *
7058d3236553SJohannes Berg  * Drivers should check the return value, its possible you can get
7059d3236553SJohannes Berg  * an -ENOMEM.
70600ae997dcSYacine Belkadi  *
70610ae997dcSYacine Belkadi  * Return: 0 on success. -ENOMEM.
7062d3236553SJohannes Berg  */
706310dd9b7cSJoe Perches int regulatory_hint(struct wiphy *wiphy, const char *alpha2);
7064d3236553SJohannes Berg 
7065d3236553SJohannes Berg /**
7066b0d7aa59SJonathan Doron  * regulatory_set_wiphy_regd - set regdom info for self managed drivers
7067b0d7aa59SJonathan Doron  * @wiphy: the wireless device we want to process the regulatory domain on
706898e0c7f8SRandy Dunlap  * @rd: the regulatory domain information to use for this wiphy
7069b0d7aa59SJonathan Doron  *
7070b0d7aa59SJonathan Doron  * Set the regulatory domain information for self-managed wiphys, only they
7071b0d7aa59SJonathan Doron  * may use this function. See %REGULATORY_WIPHY_SELF_MANAGED for more
7072b0d7aa59SJonathan Doron  * information.
7073b0d7aa59SJonathan Doron  *
7074b0d7aa59SJonathan Doron  * Return: 0 on success. -EINVAL, -EPERM
7075b0d7aa59SJonathan Doron  */
7076b0d7aa59SJonathan Doron int regulatory_set_wiphy_regd(struct wiphy *wiphy,
7077b0d7aa59SJonathan Doron 			      struct ieee80211_regdomain *rd);
7078b0d7aa59SJonathan Doron 
7079b0d7aa59SJonathan Doron /**
7080a05829a7SJohannes Berg  * regulatory_set_wiphy_regd_sync - set regdom for self-managed drivers
70812c3e861cSArik Nemtsov  * @wiphy: the wireless device we want to process the regulatory domain on
70822c3e861cSArik Nemtsov  * @rd: the regulatory domain information to use for this wiphy
70832c3e861cSArik Nemtsov  *
7084a05829a7SJohannes Berg  * This functions requires the RTNL and the wiphy mutex to be held and
7085a05829a7SJohannes Berg  * applies the new regdomain synchronously to this wiphy. For more details
7086a05829a7SJohannes Berg  * see regulatory_set_wiphy_regd().
70872c3e861cSArik Nemtsov  *
70882c3e861cSArik Nemtsov  * Return: 0 on success. -EINVAL, -EPERM
70892c3e861cSArik Nemtsov  */
7090a05829a7SJohannes Berg int regulatory_set_wiphy_regd_sync(struct wiphy *wiphy,
70912c3e861cSArik Nemtsov 				   struct ieee80211_regdomain *rd);
70922c3e861cSArik Nemtsov 
70932c3e861cSArik Nemtsov /**
7094d3236553SJohannes Berg  * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain
7095d3236553SJohannes Berg  * @wiphy: the wireless device we want to process the regulatory domain on
7096d3236553SJohannes Berg  * @regd: the custom regulatory domain to use for this wiphy
7097d3236553SJohannes Berg  *
7098d3236553SJohannes Berg  * Drivers can sometimes have custom regulatory domains which do not apply
7099d3236553SJohannes Berg  * to a specific country. Drivers can use this to apply such custom regulatory
7100d3236553SJohannes Berg  * domains. This routine must be called prior to wiphy registration. The
7101d3236553SJohannes Berg  * custom regulatory domain will be trusted completely and as such previous
7102d3236553SJohannes Berg  * default channel settings will be disregarded. If no rule is found for a
7103d3236553SJohannes Berg  * channel on the regulatory domain the channel will be disabled.
7104222ea581SLuis R. Rodriguez  * Drivers using this for a wiphy should also set the wiphy flag
7105ce26151bSKalle Valo  * REGULATORY_CUSTOM_REG or cfg80211 will set it for the wiphy
7106222ea581SLuis R. Rodriguez  * that called this helper.
7107d3236553SJohannes Berg  */
710810dd9b7cSJoe Perches void wiphy_apply_custom_regulatory(struct wiphy *wiphy,
7109d3236553SJohannes Berg 				   const struct ieee80211_regdomain *regd);
7110d3236553SJohannes Berg 
7111d3236553SJohannes Berg /**
7112d3236553SJohannes Berg  * freq_reg_info - get regulatory information for the given frequency
7113d3236553SJohannes Berg  * @wiphy: the wiphy for which we want to process this rule for
7114d3236553SJohannes Berg  * @center_freq: Frequency in KHz for which we want regulatory information for
7115d3236553SJohannes Berg  *
7116d3236553SJohannes Berg  * Use this function to get the regulatory rule for a specific frequency on
7117d3236553SJohannes Berg  * a given wireless device. If the device has a specific regulatory domain
7118d3236553SJohannes Berg  * it wants to follow we respect that unless a country IE has been received
7119d3236553SJohannes Berg  * and processed already.
7120d3236553SJohannes Berg  *
71210ae997dcSYacine Belkadi  * Return: A valid pointer, or, when an error occurs, for example if no rule
71220ae997dcSYacine Belkadi  * can be found, the return value is encoded using ERR_PTR(). Use IS_ERR() to
71230ae997dcSYacine Belkadi  * check and PTR_ERR() to obtain the numeric return value. The numeric return
71240ae997dcSYacine Belkadi  * value will be -ERANGE if we determine the given center_freq does not even
71250ae997dcSYacine Belkadi  * have a regulatory rule for a frequency range in the center_freq's band.
71260ae997dcSYacine Belkadi  * See freq_in_rule_band() for our current definition of a band -- this is
71270ae997dcSYacine Belkadi  * purely subjective and right now it's 802.11 specific.
7128d3236553SJohannes Berg  */
7129361c9c8bSJohannes Berg const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy,
7130361c9c8bSJohannes Berg 					       u32 center_freq);
7131d3236553SJohannes Berg 
7132034c6d6eSLuis R. Rodriguez /**
7133034c6d6eSLuis R. Rodriguez  * reg_initiator_name - map regulatory request initiator enum to name
7134034c6d6eSLuis R. Rodriguez  * @initiator: the regulatory request initiator
7135034c6d6eSLuis R. Rodriguez  *
7136034c6d6eSLuis R. Rodriguez  * You can use this to map the regulatory request initiator enum to a
7137034c6d6eSLuis R. Rodriguez  * proper string representation.
713862cc206cSJeff Johnson  *
713962cc206cSJeff Johnson  * Return: pointer to string representation of the initiator
7140034c6d6eSLuis R. Rodriguez  */
7141034c6d6eSLuis R. Rodriguez const char *reg_initiator_name(enum nl80211_reg_initiator initiator);
7142034c6d6eSLuis R. Rodriguez 
714319d3577eSHaim Dreyfuss /**
7144dc0c18edSAaron Komisar  * regulatory_pre_cac_allowed - check if pre-CAC allowed in the current regdom
7145dc0c18edSAaron Komisar  * @wiphy: wiphy for which pre-CAC capability is checked.
7146dc0c18edSAaron Komisar  *
7147dc0c18edSAaron Komisar  * Pre-CAC is allowed only in some regdomains (notable ETSI).
714862cc206cSJeff Johnson  *
714962cc206cSJeff Johnson  * Return: %true if allowed, %false otherwise
7150dc0c18edSAaron Komisar  */
7151dc0c18edSAaron Komisar bool regulatory_pre_cac_allowed(struct wiphy *wiphy);
7152dc0c18edSAaron Komisar 
7153dc0c18edSAaron Komisar /**
715419d3577eSHaim Dreyfuss  * DOC: Internal regulatory db functions
715519d3577eSHaim Dreyfuss  *
715619d3577eSHaim Dreyfuss  */
715719d3577eSHaim Dreyfuss 
715819d3577eSHaim Dreyfuss /**
715919d3577eSHaim Dreyfuss  * reg_query_regdb_wmm -  Query internal regulatory db for wmm rule
716019d3577eSHaim Dreyfuss  * Regulatory self-managed driver can use it to proactively
716119d3577eSHaim Dreyfuss  *
716219d3577eSHaim Dreyfuss  * @alpha2: the ISO/IEC 3166 alpha2 wmm rule to be queried.
716398e0c7f8SRandy Dunlap  * @freq: the frequency (in MHz) to be queried.
716419d3577eSHaim Dreyfuss  * @rule: pointer to store the wmm rule from the regulatory db.
716519d3577eSHaim Dreyfuss  *
716619d3577eSHaim Dreyfuss  * Self-managed wireless drivers can use this function to  query
716719d3577eSHaim Dreyfuss  * the internal regulatory database to check whether the given
716819d3577eSHaim Dreyfuss  * ISO/IEC 3166 alpha2 country and freq have wmm rule limitations.
716919d3577eSHaim Dreyfuss  *
717019d3577eSHaim Dreyfuss  * Drivers should check the return value, its possible you can get
717119d3577eSHaim Dreyfuss  * an -ENODATA.
717219d3577eSHaim Dreyfuss  *
717319d3577eSHaim Dreyfuss  * Return: 0 on success. -ENODATA.
717419d3577eSHaim Dreyfuss  */
717538cb87eeSStanislaw Gruszka int reg_query_regdb_wmm(char *alpha2, int freq,
717638cb87eeSStanislaw Gruszka 			struct ieee80211_reg_rule *rule);
717719d3577eSHaim Dreyfuss 
7178d3236553SJohannes Berg /*
7179d3236553SJohannes Berg  * callbacks for asynchronous cfg80211 methods, notification
7180d3236553SJohannes Berg  * functions and BSS handling helpers
7181d3236553SJohannes Berg  */
7182d3236553SJohannes Berg 
71832a519311SJohannes Berg /**
71842a519311SJohannes Berg  * cfg80211_scan_done - notify that scan finished
71852a519311SJohannes Berg  *
71862a519311SJohannes Berg  * @request: the corresponding scan request
71871d76250bSAvraham Stern  * @info: information about the completed scan
71882a519311SJohannes Berg  */
71891d76250bSAvraham Stern void cfg80211_scan_done(struct cfg80211_scan_request *request,
71901d76250bSAvraham Stern 			struct cfg80211_scan_info *info);
71912a519311SJohannes Berg 
71922a519311SJohannes Berg /**
7193807f8a8cSLuciano Coelho  * cfg80211_sched_scan_results - notify that new scan results are available
7194807f8a8cSLuciano Coelho  *
7195807f8a8cSLuciano Coelho  * @wiphy: the wiphy which got scheduled scan results
7196b34939b9SArend Van Spriel  * @reqid: identifier for the related scheduled scan request
7197807f8a8cSLuciano Coelho  */
7198b34939b9SArend Van Spriel void cfg80211_sched_scan_results(struct wiphy *wiphy, u64 reqid);
7199807f8a8cSLuciano Coelho 
7200807f8a8cSLuciano Coelho /**
7201807f8a8cSLuciano Coelho  * cfg80211_sched_scan_stopped - notify that the scheduled scan has stopped
7202807f8a8cSLuciano Coelho  *
7203807f8a8cSLuciano Coelho  * @wiphy: the wiphy on which the scheduled scan stopped
7204b34939b9SArend Van Spriel  * @reqid: identifier for the related scheduled scan request
7205807f8a8cSLuciano Coelho  *
7206807f8a8cSLuciano Coelho  * The driver can call this function to inform cfg80211 that the
7207807f8a8cSLuciano Coelho  * scheduled scan had to be stopped, for whatever reason.  The driver
7208807f8a8cSLuciano Coelho  * is then called back via the sched_scan_stop operation when done.
7209807f8a8cSLuciano Coelho  */
7210b34939b9SArend Van Spriel void cfg80211_sched_scan_stopped(struct wiphy *wiphy, u64 reqid);
7211807f8a8cSLuciano Coelho 
7212807f8a8cSLuciano Coelho /**
7213a05829a7SJohannes Berg  * cfg80211_sched_scan_stopped_locked - notify that the scheduled scan has stopped
7214792e6aa7SEliad Peller  *
7215792e6aa7SEliad Peller  * @wiphy: the wiphy on which the scheduled scan stopped
7216b34939b9SArend Van Spriel  * @reqid: identifier for the related scheduled scan request
7217792e6aa7SEliad Peller  *
7218792e6aa7SEliad Peller  * The driver can call this function to inform cfg80211 that the
7219792e6aa7SEliad Peller  * scheduled scan had to be stopped, for whatever reason.  The driver
7220792e6aa7SEliad Peller  * is then called back via the sched_scan_stop operation when done.
7221a05829a7SJohannes Berg  * This function should be called with the wiphy mutex held.
7222792e6aa7SEliad Peller  */
7223a05829a7SJohannes Berg void cfg80211_sched_scan_stopped_locked(struct wiphy *wiphy, u64 reqid);
7224792e6aa7SEliad Peller 
7225792e6aa7SEliad Peller /**
72266e19bc4bSDmitry Shmidt  * cfg80211_inform_bss_frame_data - inform cfg80211 of a received BSS frame
72272a519311SJohannes Berg  * @wiphy: the wiphy reporting the BSS
72286e19bc4bSDmitry Shmidt  * @data: the BSS metadata
7229abe37c4bSJohannes Berg  * @mgmt: the management frame (probe response or beacon)
7230abe37c4bSJohannes Berg  * @len: length of the management frame
72312a519311SJohannes Berg  * @gfp: context flags
72322a519311SJohannes Berg  *
72332a519311SJohannes Berg  * This informs cfg80211 that BSS information was found and
72342a519311SJohannes Berg  * the BSS should be updated/added.
7235ef100682SJohannes Berg  *
72360ae997dcSYacine Belkadi  * Return: A referenced struct, must be released with cfg80211_put_bss()!
72370ae997dcSYacine Belkadi  * Or %NULL on error.
72382a519311SJohannes Berg  */
7239ef100682SJohannes Berg struct cfg80211_bss * __must_check
72406e19bc4bSDmitry Shmidt cfg80211_inform_bss_frame_data(struct wiphy *wiphy,
72416e19bc4bSDmitry Shmidt 			       struct cfg80211_inform_bss *data,
72426e19bc4bSDmitry Shmidt 			       struct ieee80211_mgmt *mgmt, size_t len,
72436e19bc4bSDmitry Shmidt 			       gfp_t gfp);
72446e19bc4bSDmitry Shmidt 
72456e19bc4bSDmitry Shmidt static inline struct cfg80211_bss * __must_check
cfg80211_inform_bss_frame(struct wiphy * wiphy,struct ieee80211_channel * rx_channel,struct ieee80211_mgmt * mgmt,size_t len,s32 signal,gfp_t gfp)72462a519311SJohannes Berg cfg80211_inform_bss_frame(struct wiphy *wiphy,
72473afc2167SEmmanuel Grumbach 			  struct ieee80211_channel *rx_channel,
72482a519311SJohannes Berg 			  struct ieee80211_mgmt *mgmt, size_t len,
7249dcd6eac1SSimon Wunderlich 			  s32 signal, gfp_t gfp)
7250dcd6eac1SSimon Wunderlich {
72516e19bc4bSDmitry Shmidt 	struct cfg80211_inform_bss data = {
72526e19bc4bSDmitry Shmidt 		.chan = rx_channel,
72536e19bc4bSDmitry Shmidt 		.signal = signal,
72546e19bc4bSDmitry Shmidt 	};
72556e19bc4bSDmitry Shmidt 
72566e19bc4bSDmitry Shmidt 	return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp);
7257dcd6eac1SSimon Wunderlich }
72582a519311SJohannes Berg 
7259abe37c4bSJohannes Berg /**
72607ece9c37SSara Sharon  * cfg80211_gen_new_bssid - generate a nontransmitted BSSID for multi-BSSID
72617ece9c37SSara Sharon  * @bssid: transmitter BSSID
72627ece9c37SSara Sharon  * @max_bssid: max BSSID indicator, taken from Multiple BSSID element
72637ece9c37SSara Sharon  * @mbssid_index: BSSID index, taken from Multiple BSSID index element
72645d4071abSJohannes Berg  * @new_bssid: calculated nontransmitted BSSID
72657ece9c37SSara Sharon  */
cfg80211_gen_new_bssid(const u8 * bssid,u8 max_bssid,u8 mbssid_index,u8 * new_bssid)72667ece9c37SSara Sharon static inline void cfg80211_gen_new_bssid(const u8 *bssid, u8 max_bssid,
72675d4071abSJohannes Berg 					  u8 mbssid_index, u8 *new_bssid)
72687ece9c37SSara Sharon {
72695d4071abSJohannes Berg 	u64 bssid_u64 = ether_addr_to_u64(bssid);
72705d4071abSJohannes Berg 	u64 mask = GENMASK_ULL(max_bssid - 1, 0);
72715d4071abSJohannes Berg 	u64 new_bssid_u64;
72727ece9c37SSara Sharon 
72735d4071abSJohannes Berg 	new_bssid_u64 = bssid_u64 & ~mask;
72747ece9c37SSara Sharon 
72755d4071abSJohannes Berg 	new_bssid_u64 |= ((bssid_u64 & mask) + mbssid_index) & mask;
72767ece9c37SSara Sharon 
72775d4071abSJohannes Berg 	u64_to_ether_addr(new_bssid_u64, new_bssid);
72787ece9c37SSara Sharon }
72797ece9c37SSara Sharon 
72807ece9c37SSara Sharon /**
7281f7dacfb1SSara Sharon  * cfg80211_is_element_inherited - returns if element ID should be inherited
7282f7dacfb1SSara Sharon  * @element: element to check
7283f7dacfb1SSara Sharon  * @non_inherit_element: non inheritance element
728462cc206cSJeff Johnson  *
728562cc206cSJeff Johnson  * Return: %true if should be inherited, %false otherwise
7286f7dacfb1SSara Sharon  */
7287f7dacfb1SSara Sharon bool cfg80211_is_element_inherited(const struct element *element,
7288f7dacfb1SSara Sharon 				   const struct element *non_inherit_element);
7289f7dacfb1SSara Sharon 
7290f7dacfb1SSara Sharon /**
7291fe806e49SSara Sharon  * cfg80211_merge_profile - merges a MBSSID profile if it is split between IEs
7292fe806e49SSara Sharon  * @ie: ies
7293fe806e49SSara Sharon  * @ielen: length of IEs
7294fe806e49SSara Sharon  * @mbssid_elem: current MBSSID element
7295fe806e49SSara Sharon  * @sub_elem: current MBSSID subelement (profile)
7296fe806e49SSara Sharon  * @merged_ie: location of the merged profile
7297fe806e49SSara Sharon  * @max_copy_len: max merged profile length
729862cc206cSJeff Johnson  *
729962cc206cSJeff Johnson  * Return: the number of bytes merged
7300fe806e49SSara Sharon  */
7301fe806e49SSara Sharon size_t cfg80211_merge_profile(const u8 *ie, size_t ielen,
7302fe806e49SSara Sharon 			      const struct element *mbssid_elem,
7303fe806e49SSara Sharon 			      const struct element *sub_elem,
73045809a5d5SDan Carpenter 			      u8 *merged_ie, size_t max_copy_len);
7305fe806e49SSara Sharon 
7306fe806e49SSara Sharon /**
73075bc8c1f2SJohannes Berg  * enum cfg80211_bss_frame_type - frame type that the BSS data came from
73085bc8c1f2SJohannes Berg  * @CFG80211_BSS_FTYPE_UNKNOWN: driver doesn't know whether the data is
73095bc8c1f2SJohannes Berg  *	from a beacon or probe response
73105bc8c1f2SJohannes Berg  * @CFG80211_BSS_FTYPE_BEACON: data comes from a beacon
73115bc8c1f2SJohannes Berg  * @CFG80211_BSS_FTYPE_PRESP: data comes from a probe response
73127e899c1dSJohannes Berg  * @CFG80211_BSS_FTYPE_S1G_BEACON: data comes from an S1G beacon
73135bc8c1f2SJohannes Berg  */
73145bc8c1f2SJohannes Berg enum cfg80211_bss_frame_type {
73155bc8c1f2SJohannes Berg 	CFG80211_BSS_FTYPE_UNKNOWN,
73165bc8c1f2SJohannes Berg 	CFG80211_BSS_FTYPE_BEACON,
73175bc8c1f2SJohannes Berg 	CFG80211_BSS_FTYPE_PRESP,
73187e899c1dSJohannes Berg 	CFG80211_BSS_FTYPE_S1G_BEACON,
73195bc8c1f2SJohannes Berg };
73205bc8c1f2SJohannes Berg 
73215bc8c1f2SJohannes Berg /**
73227f599aecSAyala Beker  * cfg80211_get_ies_channel_number - returns the channel number from ies
73237f599aecSAyala Beker  * @ie: IEs
73247f599aecSAyala Beker  * @ielen: length of IEs
73257f599aecSAyala Beker  * @band: enum nl80211_band of the channel
73267f599aecSAyala Beker  *
732762cc206cSJeff Johnson  * Return: the channel number, or -1 if none could be determined.
73287f599aecSAyala Beker  */
73297f599aecSAyala Beker int cfg80211_get_ies_channel_number(const u8 *ie, size_t ielen,
73306ff9efcfSMordechay Goodstein 				    enum nl80211_band band);
73317f599aecSAyala Beker 
73327f599aecSAyala Beker /**
73331c1c2b37SDmitry Antipov  * cfg80211_ssid_eq - compare two SSIDs
73341c1c2b37SDmitry Antipov  * @a: first SSID
73351c1c2b37SDmitry Antipov  * @b: second SSID
73361c1c2b37SDmitry Antipov  *
73371c1c2b37SDmitry Antipov  * Return: %true if SSIDs are equal, %false otherwise.
73381c1c2b37SDmitry Antipov  */
73391c1c2b37SDmitry Antipov static inline bool
cfg80211_ssid_eq(struct cfg80211_ssid * a,struct cfg80211_ssid * b)73401c1c2b37SDmitry Antipov cfg80211_ssid_eq(struct cfg80211_ssid *a, struct cfg80211_ssid *b)
73411c1c2b37SDmitry Antipov {
73421c1c2b37SDmitry Antipov 	if (WARN_ON(!a || !b))
73431c1c2b37SDmitry Antipov 		return false;
73441c1c2b37SDmitry Antipov 	if (a->ssid_len != b->ssid_len)
73451c1c2b37SDmitry Antipov 		return false;
73461c1c2b37SDmitry Antipov 	return memcmp(a->ssid, b->ssid, a->ssid_len) ? false : true;
73471c1c2b37SDmitry Antipov }
73481c1c2b37SDmitry Antipov 
73491c1c2b37SDmitry Antipov /**
73506e19bc4bSDmitry Shmidt  * cfg80211_inform_bss_data - inform cfg80211 of a new BSS
7351abe37c4bSJohannes Berg  *
7352abe37c4bSJohannes Berg  * @wiphy: the wiphy reporting the BSS
73536e19bc4bSDmitry Shmidt  * @data: the BSS metadata
73545bc8c1f2SJohannes Berg  * @ftype: frame type (if known)
7355abe37c4bSJohannes Berg  * @bssid: the BSSID of the BSS
73567b8bcff2SJohannes Berg  * @tsf: the TSF sent by the peer in the beacon/probe response (or 0)
7357abe37c4bSJohannes Berg  * @capability: the capability field sent by the peer
7358abe37c4bSJohannes Berg  * @beacon_interval: the beacon interval announced by the peer
7359abe37c4bSJohannes Berg  * @ie: additional IEs sent by the peer
7360abe37c4bSJohannes Berg  * @ielen: length of the additional IEs
7361abe37c4bSJohannes Berg  * @gfp: context flags
7362abe37c4bSJohannes Berg  *
7363abe37c4bSJohannes Berg  * This informs cfg80211 that BSS information was found and
7364abe37c4bSJohannes Berg  * the BSS should be updated/added.
7365ef100682SJohannes Berg  *
73660ae997dcSYacine Belkadi  * Return: A referenced struct, must be released with cfg80211_put_bss()!
73670ae997dcSYacine Belkadi  * Or %NULL on error.
7368abe37c4bSJohannes Berg  */
7369ef100682SJohannes Berg struct cfg80211_bss * __must_check
73706e19bc4bSDmitry Shmidt cfg80211_inform_bss_data(struct wiphy *wiphy,
73716e19bc4bSDmitry Shmidt 			 struct cfg80211_inform_bss *data,
73726e19bc4bSDmitry Shmidt 			 enum cfg80211_bss_frame_type ftype,
73736e19bc4bSDmitry Shmidt 			 const u8 *bssid, u64 tsf, u16 capability,
73746e19bc4bSDmitry Shmidt 			 u16 beacon_interval, const u8 *ie, size_t ielen,
73756e19bc4bSDmitry Shmidt 			 gfp_t gfp);
73766e19bc4bSDmitry Shmidt 
73776e19bc4bSDmitry Shmidt static inline struct cfg80211_bss * __must_check
cfg80211_inform_bss(struct wiphy * wiphy,struct ieee80211_channel * rx_channel,enum cfg80211_bss_frame_type ftype,const u8 * bssid,u64 tsf,u16 capability,u16 beacon_interval,const u8 * ie,size_t ielen,s32 signal,gfp_t gfp)737806aa7afaSJussi Kivilinna cfg80211_inform_bss(struct wiphy *wiphy,
73793afc2167SEmmanuel Grumbach 		    struct ieee80211_channel *rx_channel,
73805bc8c1f2SJohannes Berg 		    enum cfg80211_bss_frame_type ftype,
73817b8bcff2SJohannes Berg 		    const u8 *bssid, u64 tsf, u16 capability,
73827b8bcff2SJohannes Berg 		    u16 beacon_interval, const u8 *ie, size_t ielen,
7383dcd6eac1SSimon Wunderlich 		    s32 signal, gfp_t gfp)
7384dcd6eac1SSimon Wunderlich {
73856e19bc4bSDmitry Shmidt 	struct cfg80211_inform_bss data = {
73866e19bc4bSDmitry Shmidt 		.chan = rx_channel,
73876e19bc4bSDmitry Shmidt 		.signal = signal,
73886e19bc4bSDmitry Shmidt 	};
73896e19bc4bSDmitry Shmidt 
73906e19bc4bSDmitry Shmidt 	return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf,
73916e19bc4bSDmitry Shmidt 					capability, beacon_interval, ie, ielen,
7392dcd6eac1SSimon Wunderlich 					gfp);
7393dcd6eac1SSimon Wunderlich }
739406aa7afaSJussi Kivilinna 
739527548677SJohannes Berg /**
7396d02a12b8SJohannes Berg  * __cfg80211_get_bss - get a BSS reference
7397d02a12b8SJohannes Berg  * @wiphy: the wiphy this BSS struct belongs to
7398d02a12b8SJohannes Berg  * @channel: the channel to search on (or %NULL)
7399d02a12b8SJohannes Berg  * @bssid: the desired BSSID (or %NULL)
7400d02a12b8SJohannes Berg  * @ssid: the desired SSID (or %NULL)
7401d02a12b8SJohannes Berg  * @ssid_len: length of the SSID (or 0)
7402d02a12b8SJohannes Berg  * @bss_type: type of BSS, see &enum ieee80211_bss_type
7403d02a12b8SJohannes Berg  * @privacy: privacy filter, see &enum ieee80211_privacy
7404d02a12b8SJohannes Berg  * @use_for: indicates which use is intended
740562cc206cSJeff Johnson  *
740662cc206cSJeff Johnson  * Return: Reference-counted BSS on success. %NULL on error.
7407d02a12b8SJohannes Berg  */
7408d02a12b8SJohannes Berg struct cfg80211_bss *__cfg80211_get_bss(struct wiphy *wiphy,
7409d02a12b8SJohannes Berg 					struct ieee80211_channel *channel,
7410d02a12b8SJohannes Berg 					const u8 *bssid,
7411d02a12b8SJohannes Berg 					const u8 *ssid, size_t ssid_len,
7412d02a12b8SJohannes Berg 					enum ieee80211_bss_type bss_type,
7413d02a12b8SJohannes Berg 					enum ieee80211_privacy privacy,
7414d02a12b8SJohannes Berg 					u32 use_for);
7415d02a12b8SJohannes Berg 
7416d02a12b8SJohannes Berg /**
741727548677SJohannes Berg  * cfg80211_get_bss - get a BSS reference
741827548677SJohannes Berg  * @wiphy: the wiphy this BSS struct belongs to
741927548677SJohannes Berg  * @channel: the channel to search on (or %NULL)
742027548677SJohannes Berg  * @bssid: the desired BSSID (or %NULL)
742127548677SJohannes Berg  * @ssid: the desired SSID (or %NULL)
742227548677SJohannes Berg  * @ssid_len: length of the SSID (or 0)
742327548677SJohannes Berg  * @bss_type: type of BSS, see &enum ieee80211_bss_type
742427548677SJohannes Berg  * @privacy: privacy filter, see &enum ieee80211_privacy
7425d02a12b8SJohannes Berg  *
7426d02a12b8SJohannes Berg  * This version implies regular usage, %NL80211_BSS_USE_FOR_NORMAL.
742762cc206cSJeff Johnson  *
742862cc206cSJeff Johnson  * Return: Reference-counted BSS on success. %NULL on error.
742927548677SJohannes Berg  */
7430d02a12b8SJohannes Berg static inline struct cfg80211_bss *
cfg80211_get_bss(struct wiphy * wiphy,struct ieee80211_channel * channel,const u8 * bssid,const u8 * ssid,size_t ssid_len,enum ieee80211_bss_type bss_type,enum ieee80211_privacy privacy)7431d02a12b8SJohannes Berg cfg80211_get_bss(struct wiphy *wiphy, struct ieee80211_channel *channel,
7432d02a12b8SJohannes Berg 		 const u8 *bssid, const u8 *ssid, size_t ssid_len,
74336eb18137SDedy Lansky 		 enum ieee80211_bss_type bss_type,
7434d02a12b8SJohannes Berg 		 enum ieee80211_privacy privacy)
7435d02a12b8SJohannes Berg {
7436d02a12b8SJohannes Berg 	return __cfg80211_get_bss(wiphy, channel, bssid, ssid, ssid_len,
7437d02a12b8SJohannes Berg 				  bss_type, privacy,
7438d02a12b8SJohannes Berg 				  NL80211_BSS_USE_FOR_NORMAL);
7439d02a12b8SJohannes Berg }
7440d02a12b8SJohannes Berg 
744179420f09SJohannes Berg static inline struct cfg80211_bss *
cfg80211_get_ibss(struct wiphy * wiphy,struct ieee80211_channel * channel,const u8 * ssid,size_t ssid_len)744279420f09SJohannes Berg cfg80211_get_ibss(struct wiphy *wiphy,
744379420f09SJohannes Berg 		  struct ieee80211_channel *channel,
744479420f09SJohannes Berg 		  const u8 *ssid, size_t ssid_len)
744579420f09SJohannes Berg {
744679420f09SJohannes Berg 	return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len,
74476eb18137SDedy Lansky 				IEEE80211_BSS_TYPE_IBSS,
74486eb18137SDedy Lansky 				IEEE80211_PRIVACY_ANY);
744979420f09SJohannes Berg }
745079420f09SJohannes Berg 
74514c0c0b75SJohannes Berg /**
74524c0c0b75SJohannes Berg  * cfg80211_ref_bss - reference BSS struct
74535b112d3dSJohannes Berg  * @wiphy: the wiphy this BSS struct belongs to
74544c0c0b75SJohannes Berg  * @bss: the BSS struct to reference
74554c0c0b75SJohannes Berg  *
74564c0c0b75SJohannes Berg  * Increments the refcount of the given BSS struct.
74574c0c0b75SJohannes Berg  */
74585b112d3dSJohannes Berg void cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
74594c0c0b75SJohannes Berg 
74604c0c0b75SJohannes Berg /**
74614c0c0b75SJohannes Berg  * cfg80211_put_bss - unref BSS struct
74625b112d3dSJohannes Berg  * @wiphy: the wiphy this BSS struct belongs to
74634c0c0b75SJohannes Berg  * @bss: the BSS struct
74644c0c0b75SJohannes Berg  *
74654c0c0b75SJohannes Berg  * Decrements the refcount of the given BSS struct.
74664c0c0b75SJohannes Berg  */
74675b112d3dSJohannes Berg void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
7468d3236553SJohannes Berg 
7469d491af19SJohannes Berg /**
7470d491af19SJohannes Berg  * cfg80211_unlink_bss - unlink BSS from internal data structures
7471d491af19SJohannes Berg  * @wiphy: the wiphy
7472d491af19SJohannes Berg  * @bss: the bss to remove
7473d491af19SJohannes Berg  *
7474d491af19SJohannes Berg  * This function removes the given BSS from the internal data structures
7475d491af19SJohannes Berg  * thereby making it no longer show up in scan results etc. Use this
7476d491af19SJohannes Berg  * function when you detect a BSS is gone. Normally BSSes will also time
7477d491af19SJohannes Berg  * out, so it is not necessary to use this function at all.
7478d491af19SJohannes Berg  */
7479d491af19SJohannes Berg void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
7480fee52678SJohannes Berg 
74814770c8f9SIlan Peer /**
74824770c8f9SIlan Peer  * cfg80211_bss_iter - iterate all BSS entries
74834770c8f9SIlan Peer  *
74844770c8f9SIlan Peer  * This function iterates over the BSS entries associated with the given wiphy
74854770c8f9SIlan Peer  * and calls the callback for the iterated BSS. The iterator function is not
74864770c8f9SIlan Peer  * allowed to call functions that might modify the internal state of the BSS DB.
74874770c8f9SIlan Peer  *
74884770c8f9SIlan Peer  * @wiphy: the wiphy
74894770c8f9SIlan Peer  * @chandef: if given, the iterator function will be called only if the channel
74904770c8f9SIlan Peer  *     of the currently iterated BSS is a subset of the given channel.
74914770c8f9SIlan Peer  * @iter: the iterator function to call
74924770c8f9SIlan Peer  * @iter_data: an argument to the iterator function
74934770c8f9SIlan Peer  */
74944770c8f9SIlan Peer void cfg80211_bss_iter(struct wiphy *wiphy,
74954770c8f9SIlan Peer 		       struct cfg80211_chan_def *chandef,
74964770c8f9SIlan Peer 		       void (*iter)(struct wiphy *wiphy,
74974770c8f9SIlan Peer 				    struct cfg80211_bss *bss,
74984770c8f9SIlan Peer 				    void *data),
74994770c8f9SIlan Peer 		       void *iter_data);
75004770c8f9SIlan Peer 
75016039f6d2SJouni Malinen /**
75026ff57cf8SJohannes Berg  * cfg80211_rx_mlme_mgmt - notification of processed MLME management frame
75036039f6d2SJouni Malinen  * @dev: network device
75046039f6d2SJouni Malinen  * @buf: authentication frame (header + body)
75056039f6d2SJouni Malinen  * @len: length of the frame data
75066039f6d2SJouni Malinen  *
75076ff57cf8SJohannes Berg  * This function is called whenever an authentication, disassociation or
75086ff57cf8SJohannes Berg  * deauthentication frame has been received and processed in station mode.
75096ff57cf8SJohannes Berg  * After being asked to authenticate via cfg80211_ops::auth() the driver must
75106ff57cf8SJohannes Berg  * call either this function or cfg80211_auth_timeout().
75116ff57cf8SJohannes Berg  * After being asked to associate via cfg80211_ops::assoc() the driver must
75126ff57cf8SJohannes Berg  * call either this function or cfg80211_auth_timeout().
75136ff57cf8SJohannes Berg  * While connected, the driver must calls this for received and processed
75146ff57cf8SJohannes Berg  * disassociation and deauthentication frames. If the frame couldn't be used
75156ff57cf8SJohannes Berg  * because it was unprotected, the driver must call the function
75166ff57cf8SJohannes Berg  * cfg80211_rx_unprot_mlme_mgmt() instead.
75176ff57cf8SJohannes Berg  *
75186ff57cf8SJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's mutex.
75196039f6d2SJouni Malinen  */
75206ff57cf8SJohannes Berg void cfg80211_rx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len);
75216039f6d2SJouni Malinen 
75226039f6d2SJouni Malinen /**
75236ff57cf8SJohannes Berg  * cfg80211_auth_timeout - notification of timed out authentication
75241965c853SJouni Malinen  * @dev: network device
75251965c853SJouni Malinen  * @addr: The MAC address of the device with which the authentication timed out
7526cb0b4bebSJohannes Berg  *
75278d61ffa5SJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's
75288d61ffa5SJohannes Berg  * mutex.
75291965c853SJouni Malinen  */
75306ff57cf8SJohannes Berg void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr);
75311965c853SJouni Malinen 
75321965c853SJouni Malinen /**
75338e4687f6SKalle Valo  * struct cfg80211_rx_assoc_resp_data - association response data
75344d9ec73dSJouni Malinen  * @buf: (Re)Association Response frame (header + body)
75356039f6d2SJouni Malinen  * @len: length of the frame data
7536f438ceb8SEmmanuel Grumbach  * @uapsd_queues: bitmap of queues configured for uapsd. Same format
7537f438ceb8SEmmanuel Grumbach  *	as the AC bitmap in the QoS info field
75384d9ec73dSJouni Malinen  * @req_ies: information elements from the (Re)Association Request frame
75394d9ec73dSJouni Malinen  * @req_ies_len: length of req_ies data
75405cd212cbSJohannes Berg  * @ap_mld_addr: AP MLD address (in case of MLO)
75415cd212cbSJohannes Berg  * @links: per-link information indexed by link ID, use links[0] for
75425cd212cbSJohannes Berg  *	non-MLO connections
754333615978SJonathan Corbet  * @links.bss: the BSS that association was requested with, ownership of the
754433615978SJonathan Corbet  *      pointer moves to cfg80211 in the call to cfg80211_rx_assoc_resp()
754553ad07e9SJohannes Berg  * @links.status: Set this (along with a BSS pointer) for links that
754653ad07e9SJohannes Berg  *	were rejected by the AP.
7547cd47c0f5SJohannes Berg  */
75488e4687f6SKalle Valo struct cfg80211_rx_assoc_resp_data {
7549cd47c0f5SJohannes Berg 	const u8 *buf;
7550cd47c0f5SJohannes Berg 	size_t len;
7551cd47c0f5SJohannes Berg 	const u8 *req_ies;
7552cd47c0f5SJohannes Berg 	size_t req_ies_len;
7553cd47c0f5SJohannes Berg 	int uapsd_queues;
75545cd212cbSJohannes Berg 	const u8 *ap_mld_addr;
75555cd212cbSJohannes Berg 	struct {
7556234249d8SWen Gong 		u8 addr[ETH_ALEN] __aligned(2);
75575cd212cbSJohannes Berg 		struct cfg80211_bss *bss;
755853ad07e9SJohannes Berg 		u16 status;
75595cd212cbSJohannes Berg 	} links[IEEE80211_MLD_MAX_NUM_LINKS];
7560cd47c0f5SJohannes Berg };
7561cd47c0f5SJohannes Berg 
7562cd47c0f5SJohannes Berg /**
7563cd47c0f5SJohannes Berg  * cfg80211_rx_assoc_resp - notification of processed association response
7564cd47c0f5SJohannes Berg  * @dev: network device
75658e4687f6SKalle Valo  * @data: association response data, &struct cfg80211_rx_assoc_resp_data
75666039f6d2SJouni Malinen  *
75676ff57cf8SJohannes Berg  * After being asked to associate via cfg80211_ops::assoc() the driver must
75686ff57cf8SJohannes Berg  * call either this function or cfg80211_auth_timeout().
75696ff57cf8SJohannes Berg  *
75706ff57cf8SJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's mutex.
75716039f6d2SJouni Malinen  */
75726ff57cf8SJohannes Berg void cfg80211_rx_assoc_resp(struct net_device *dev,
757388f29324SJohannes Berg 			    const struct cfg80211_rx_assoc_resp_data *data);
75746039f6d2SJouni Malinen 
75756039f6d2SJouni Malinen /**
7576f662d2f4SJohannes Berg  * struct cfg80211_assoc_failure - association failure data
7577f662d2f4SJohannes Berg  * @ap_mld_addr: AP MLD address, or %NULL
7578f662d2f4SJohannes Berg  * @bss: list of BSSes, must use entry 0 for non-MLO connections
7579f662d2f4SJohannes Berg  *	(@ap_mld_addr is %NULL)
7580f662d2f4SJohannes Berg  * @timeout: indicates the association failed due to timeout, otherwise
7581f662d2f4SJohannes Berg  *	the association was abandoned for a reason reported through some
7582f662d2f4SJohannes Berg  *	other API (e.g. deauth RX)
75831965c853SJouni Malinen  */
7584f662d2f4SJohannes Berg struct cfg80211_assoc_failure {
7585f662d2f4SJohannes Berg 	const u8 *ap_mld_addr;
7586f662d2f4SJohannes Berg 	struct cfg80211_bss *bss[IEEE80211_MLD_MAX_NUM_LINKS];
7587f662d2f4SJohannes Berg 	bool timeout;
7588f662d2f4SJohannes Berg };
75891965c853SJouni Malinen 
75901965c853SJouni Malinen /**
7591f662d2f4SJohannes Berg  * cfg80211_assoc_failure - notification of association failure
7592e6f462dfSJohannes Berg  * @dev: network device
7593f662d2f4SJohannes Berg  * @data: data describing the association failure
7594e6f462dfSJohannes Berg  *
7595e6f462dfSJohannes Berg  * This function may sleep. The caller must hold the corresponding wdev's mutex.
7596e6f462dfSJohannes Berg  */
7597f662d2f4SJohannes Berg void cfg80211_assoc_failure(struct net_device *dev,
7598f662d2f4SJohannes Berg 			    struct cfg80211_assoc_failure *data);
7599e6f462dfSJohannes Berg 
7600e6f462dfSJohannes Berg /**
76016ff57cf8SJohannes Berg  * cfg80211_tx_mlme_mgmt - notification of transmitted deauth/disassoc frame
76026039f6d2SJouni Malinen  * @dev: network device
76036ff57cf8SJohannes Berg  * @buf: 802.11 frame (header + body)
76046039f6d2SJouni Malinen  * @len: length of the frame data
76053bb02143SJohannes Berg  * @reconnect: immediate reconnect is desired (include the nl80211 attribute)
76066039f6d2SJouni Malinen  *
76076039f6d2SJouni Malinen  * This function is called whenever deauthentication has been processed in
760853b46b84SJouni Malinen  * station mode. This includes both received deauthentication frames and
76098d61ffa5SJohannes Berg  * locally generated ones. This function may sleep. The caller must hold the
76108d61ffa5SJohannes Berg  * corresponding wdev's mutex.
76116039f6d2SJouni Malinen  */
76123bb02143SJohannes Berg void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len,
76133bb02143SJohannes Berg 			   bool reconnect);
7614ce470613SHolger Schurig 
7615ce470613SHolger Schurig /**
76166ff57cf8SJohannes Berg  * cfg80211_rx_unprot_mlme_mgmt - notification of unprotected mlme mgmt frame
7617cf4e594eSJouni Malinen  * @dev: network device
76184d797fceSJouni Malinen  * @buf: received management frame (header + body)
7619cf4e594eSJouni Malinen  * @len: length of the frame data
7620cf4e594eSJouni Malinen  *
76216ff57cf8SJohannes Berg  * This function is called whenever a received deauthentication or dissassoc
76226ff57cf8SJohannes Berg  * frame has been dropped in station mode because of MFP being used but the
76234d797fceSJouni Malinen  * frame was not protected. This is also used to notify reception of a Beacon
76244d797fceSJouni Malinen  * frame that was dropped because it did not include a valid MME MIC while
76254d797fceSJouni Malinen  * beacon protection was enabled (BIGTK configured in station mode).
76264d797fceSJouni Malinen  *
76274d797fceSJouni Malinen  * This function may sleep.
7628cf4e594eSJouni Malinen  */
76296ff57cf8SJohannes Berg void cfg80211_rx_unprot_mlme_mgmt(struct net_device *dev,
76306ff57cf8SJohannes Berg 				  const u8 *buf, size_t len);
7631cf4e594eSJouni Malinen 
7632cf4e594eSJouni Malinen /**
7633a3b8b056SJouni Malinen  * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP)
7634a3b8b056SJouni Malinen  * @dev: network device
7635a3b8b056SJouni Malinen  * @addr: The source MAC address of the frame
7636a3b8b056SJouni Malinen  * @key_type: The key type that the received frame used
7637a66b98dbSArik Nemtsov  * @key_id: Key identifier (0..3). Can be -1 if missing.
7638a3b8b056SJouni Malinen  * @tsc: The TSC value of the frame that generated the MIC failure (6 octets)
7639e6d6e342SJohannes Berg  * @gfp: allocation flags
7640a3b8b056SJouni Malinen  *
7641a3b8b056SJouni Malinen  * This function is called whenever the local MAC detects a MIC failure in a
7642a3b8b056SJouni Malinen  * received frame. This matches with MLME-MICHAELMICFAILURE.indication()
7643a3b8b056SJouni Malinen  * primitive.
7644a3b8b056SJouni Malinen  */
7645a3b8b056SJouni Malinen void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,
7646a3b8b056SJouni Malinen 				  enum nl80211_key_type key_type, int key_id,
7647e6d6e342SJohannes Berg 				  const u8 *tsc, gfp_t gfp);
7648a3b8b056SJouni Malinen 
764904a773adSJohannes Berg /**
765004a773adSJohannes Berg  * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS
765104a773adSJohannes Berg  *
765204a773adSJohannes Berg  * @dev: network device
765304a773adSJohannes Berg  * @bssid: the BSSID of the IBSS joined
7654fe94f3a4SAntonio Quartulli  * @channel: the channel of the IBSS joined
765504a773adSJohannes Berg  * @gfp: allocation flags
765604a773adSJohannes Berg  *
765704a773adSJohannes Berg  * This function notifies cfg80211 that the device joined an IBSS or
765804a773adSJohannes Berg  * switched to a different BSSID. Before this function can be called,
765904a773adSJohannes Berg  * either a beacon has to have been received from the IBSS, or one of
766004a773adSJohannes Berg  * the cfg80211_inform_bss{,_frame} functions must have been called
766104a773adSJohannes Berg  * with the locally generated beacon -- this guarantees that there is
766204a773adSJohannes Berg  * always a scan result for this IBSS. cfg80211 will handle the rest.
766304a773adSJohannes Berg  */
7664fe94f3a4SAntonio Quartulli void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid,
7665fe94f3a4SAntonio Quartulli 			  struct ieee80211_channel *channel, gfp_t gfp);
766604a773adSJohannes Berg 
76671f87f7d3SJohannes Berg /**
7668b1e8eb11SMauro Carvalho Chehab  * cfg80211_notify_new_peer_candidate - notify cfg80211 of a new mesh peer
7669b1e8eb11SMauro Carvalho Chehab  * 					candidate
7670c93b5e71SJavier Cardona  *
7671c93b5e71SJavier Cardona  * @dev: network device
7672c93b5e71SJavier Cardona  * @macaddr: the MAC address of the new candidate
7673c93b5e71SJavier Cardona  * @ie: information elements advertised by the peer candidate
76745ac4a12dSMatteo Croce  * @ie_len: length of the information elements buffer
76752d8b08feSMauro Carvalho Chehab  * @sig_dbm: signal level in dBm
7676c93b5e71SJavier Cardona  * @gfp: allocation flags
7677c93b5e71SJavier Cardona  *
7678c93b5e71SJavier Cardona  * This function notifies cfg80211 that the mesh peer candidate has been
7679c93b5e71SJavier Cardona  * detected, most likely via a beacon or, less likely, via a probe response.
7680c93b5e71SJavier Cardona  * cfg80211 then sends a notification to userspace.
7681c93b5e71SJavier Cardona  */
7682c93b5e71SJavier Cardona void cfg80211_notify_new_peer_candidate(struct net_device *dev,
7683ecbc12adSBob Copeland 		const u8 *macaddr, const u8 *ie, u8 ie_len,
7684ecbc12adSBob Copeland 		int sig_dbm, gfp_t gfp);
7685c93b5e71SJavier Cardona 
7686c93b5e71SJavier Cardona /**
7687d70e9693SJohannes Berg  * DOC: RFkill integration
7688d70e9693SJohannes Berg  *
7689d70e9693SJohannes Berg  * RFkill integration in cfg80211 is almost invisible to drivers,
7690d70e9693SJohannes Berg  * as cfg80211 automatically registers an rfkill instance for each
7691d70e9693SJohannes Berg  * wireless device it knows about. Soft kill is also translated
769205b23456SRandy Dunlap  * into disconnecting and turning all interfaces off. Drivers are
7693d70e9693SJohannes Berg  * expected to turn off the device when all interfaces are down.
7694d70e9693SJohannes Berg  *
7695d70e9693SJohannes Berg  * However, devices may have a hard RFkill line, in which case they
7696d70e9693SJohannes Berg  * also need to interact with the rfkill subsystem, via cfg80211.
7697d70e9693SJohannes Berg  * They can do this with a few helper functions documented here.
7698d70e9693SJohannes Berg  */
7699d70e9693SJohannes Berg 
7700d70e9693SJohannes Berg /**
7701810344edSEmmanuel Grumbach  * wiphy_rfkill_set_hw_state_reason - notify cfg80211 about hw block state
77021f87f7d3SJohannes Berg  * @wiphy: the wiphy
77031f87f7d3SJohannes Berg  * @blocked: block status
77046f779a66SEmmanuel Grumbach  * @reason: one of reasons in &enum rfkill_hard_block_reasons
77051f87f7d3SJohannes Berg  */
77066f779a66SEmmanuel Grumbach void wiphy_rfkill_set_hw_state_reason(struct wiphy *wiphy, bool blocked,
77076f779a66SEmmanuel Grumbach 				      enum rfkill_hard_block_reasons reason);
77086f779a66SEmmanuel Grumbach 
wiphy_rfkill_set_hw_state(struct wiphy * wiphy,bool blocked)77096f779a66SEmmanuel Grumbach static inline void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked)
77106f779a66SEmmanuel Grumbach {
77116f779a66SEmmanuel Grumbach 	wiphy_rfkill_set_hw_state_reason(wiphy, blocked,
77126f779a66SEmmanuel Grumbach 					 RFKILL_HARD_BLOCK_SIGNAL);
77136f779a66SEmmanuel Grumbach }
77141f87f7d3SJohannes Berg 
77151f87f7d3SJohannes Berg /**
77161f87f7d3SJohannes Berg  * wiphy_rfkill_start_polling - start polling rfkill
77171f87f7d3SJohannes Berg  * @wiphy: the wiphy
77181f87f7d3SJohannes Berg  */
77191f87f7d3SJohannes Berg void wiphy_rfkill_start_polling(struct wiphy *wiphy);
77201f87f7d3SJohannes Berg 
77211f87f7d3SJohannes Berg /**
77221f87f7d3SJohannes Berg  * wiphy_rfkill_stop_polling - stop polling rfkill
77231f87f7d3SJohannes Berg  * @wiphy: the wiphy
77241f87f7d3SJohannes Berg  */
wiphy_rfkill_stop_polling(struct wiphy * wiphy)7725358ae888SEmmanuel Grumbach static inline void wiphy_rfkill_stop_polling(struct wiphy *wiphy)
7726358ae888SEmmanuel Grumbach {
7727358ae888SEmmanuel Grumbach 	rfkill_pause_polling(wiphy->rfkill);
7728358ae888SEmmanuel Grumbach }
77291f87f7d3SJohannes Berg 
7730ad7e718cSJohannes Berg /**
7731ad7e718cSJohannes Berg  * DOC: Vendor commands
7732ad7e718cSJohannes Berg  *
7733ad7e718cSJohannes Berg  * Occasionally, there are special protocol or firmware features that
7734ad7e718cSJohannes Berg  * can't be implemented very openly. For this and similar cases, the
7735ad7e718cSJohannes Berg  * vendor command functionality allows implementing the features with
7736ad7e718cSJohannes Berg  * (typically closed-source) userspace and firmware, using nl80211 as
7737ad7e718cSJohannes Berg  * the configuration mechanism.
7738ad7e718cSJohannes Berg  *
7739ad7e718cSJohannes Berg  * A driver supporting vendor commands must register them as an array
774005b23456SRandy Dunlap  * in struct wiphy, with handlers for each one. Each command has an
7741ad7e718cSJohannes Berg  * OUI and sub command ID to identify it.
7742ad7e718cSJohannes Berg  *
7743ad7e718cSJohannes Berg  * Note that this feature should not be (ab)used to implement protocol
7744ad7e718cSJohannes Berg  * features that could openly be shared across drivers. In particular,
7745ad7e718cSJohannes Berg  * it must never be required to use vendor commands to implement any
7746ad7e718cSJohannes Berg  * "normal" functionality that higher-level userspace like connection
7747ad7e718cSJohannes Berg  * managers etc. need.
7748ad7e718cSJohannes Berg  */
7749ad7e718cSJohannes Berg 
7750ad7e718cSJohannes Berg struct sk_buff *__cfg80211_alloc_reply_skb(struct wiphy *wiphy,
7751ad7e718cSJohannes Berg 					   enum nl80211_commands cmd,
7752ad7e718cSJohannes Berg 					   enum nl80211_attrs attr,
7753ad7e718cSJohannes Berg 					   int approxlen);
7754ad7e718cSJohannes Berg 
7755567ffc35SJohannes Berg struct sk_buff *__cfg80211_alloc_event_skb(struct wiphy *wiphy,
77566c09e791SAhmad Kholaif 					   struct wireless_dev *wdev,
7757567ffc35SJohannes Berg 					   enum nl80211_commands cmd,
7758567ffc35SJohannes Berg 					   enum nl80211_attrs attr,
775955c1fdf0SJohannes Berg 					   unsigned int portid,
7760567ffc35SJohannes Berg 					   int vendor_event_idx,
7761567ffc35SJohannes Berg 					   int approxlen, gfp_t gfp);
7762567ffc35SJohannes Berg 
7763567ffc35SJohannes Berg void __cfg80211_send_event_skb(struct sk_buff *skb, gfp_t gfp);
7764567ffc35SJohannes Berg 
7765ad7e718cSJohannes Berg /**
7766ad7e718cSJohannes Berg  * cfg80211_vendor_cmd_alloc_reply_skb - allocate vendor command reply
7767ad7e718cSJohannes Berg  * @wiphy: the wiphy
7768ad7e718cSJohannes Berg  * @approxlen: an upper bound of the length of the data that will
7769ad7e718cSJohannes Berg  *	be put into the skb
7770ad7e718cSJohannes Berg  *
7771ad7e718cSJohannes Berg  * This function allocates and pre-fills an skb for a reply to
7772ad7e718cSJohannes Berg  * a vendor command. Since it is intended for a reply, calling
7773ad7e718cSJohannes Berg  * it outside of a vendor command's doit() operation is invalid.
7774ad7e718cSJohannes Berg  *
7775ad7e718cSJohannes Berg  * The returned skb is pre-filled with some identifying data in
7776ad7e718cSJohannes Berg  * a way that any data that is put into the skb (with skb_put(),
7777ad7e718cSJohannes Berg  * nla_put() or similar) will end up being within the
7778ad7e718cSJohannes Berg  * %NL80211_ATTR_VENDOR_DATA attribute, so all that needs to be done
7779ad7e718cSJohannes Berg  * with the skb is adding data for the corresponding userspace tool
7780ad7e718cSJohannes Berg  * which can then read that data out of the vendor data attribute.
7781ad7e718cSJohannes Berg  * You must not modify the skb in any other way.
7782ad7e718cSJohannes Berg  *
7783ad7e718cSJohannes Berg  * When done, call cfg80211_vendor_cmd_reply() with the skb and return
7784ad7e718cSJohannes Berg  * its error code as the result of the doit() operation.
7785ad7e718cSJohannes Berg  *
7786ad7e718cSJohannes Berg  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
7787ad7e718cSJohannes Berg  */
7788ad7e718cSJohannes Berg static inline struct sk_buff *
cfg80211_vendor_cmd_alloc_reply_skb(struct wiphy * wiphy,int approxlen)7789ad7e718cSJohannes Berg cfg80211_vendor_cmd_alloc_reply_skb(struct wiphy *wiphy, int approxlen)
7790ad7e718cSJohannes Berg {
7791ad7e718cSJohannes Berg 	return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_VENDOR,
7792ad7e718cSJohannes Berg 					  NL80211_ATTR_VENDOR_DATA, approxlen);
7793ad7e718cSJohannes Berg }
7794ad7e718cSJohannes Berg 
7795ad7e718cSJohannes Berg /**
7796ad7e718cSJohannes Berg  * cfg80211_vendor_cmd_reply - send the reply skb
7797ad7e718cSJohannes Berg  * @skb: The skb, must have been allocated with
7798ad7e718cSJohannes Berg  *	cfg80211_vendor_cmd_alloc_reply_skb()
7799ad7e718cSJohannes Berg  *
7800ad7e718cSJohannes Berg  * Since calling this function will usually be the last thing
7801ad7e718cSJohannes Berg  * before returning from the vendor command doit() you should
7802ad7e718cSJohannes Berg  * return the error code.  Note that this function consumes the
7803ad7e718cSJohannes Berg  * skb regardless of the return value.
7804ad7e718cSJohannes Berg  *
7805ad7e718cSJohannes Berg  * Return: An error code or 0 on success.
7806ad7e718cSJohannes Berg  */
7807ad7e718cSJohannes Berg int cfg80211_vendor_cmd_reply(struct sk_buff *skb);
7808ad7e718cSJohannes Berg 
7809567ffc35SJohannes Berg /**
78105d9c358dSRandy Dunlap  * cfg80211_vendor_cmd_get_sender - get the current sender netlink ID
781155c1fdf0SJohannes Berg  * @wiphy: the wiphy
781255c1fdf0SJohannes Berg  *
781362cc206cSJeff Johnson  * Return: the current netlink port ID in a vendor command handler.
781462cc206cSJeff Johnson  *
781562cc206cSJeff Johnson  * Context: May only be called from a vendor command handler
781655c1fdf0SJohannes Berg  */
781755c1fdf0SJohannes Berg unsigned int cfg80211_vendor_cmd_get_sender(struct wiphy *wiphy);
781855c1fdf0SJohannes Berg 
781955c1fdf0SJohannes Berg /**
7820567ffc35SJohannes Berg  * cfg80211_vendor_event_alloc - allocate vendor-specific event skb
7821567ffc35SJohannes Berg  * @wiphy: the wiphy
78226c09e791SAhmad Kholaif  * @wdev: the wireless device
7823567ffc35SJohannes Berg  * @event_idx: index of the vendor event in the wiphy's vendor_events
7824567ffc35SJohannes Berg  * @approxlen: an upper bound of the length of the data that will
7825567ffc35SJohannes Berg  *	be put into the skb
7826567ffc35SJohannes Berg  * @gfp: allocation flags
7827567ffc35SJohannes Berg  *
7828567ffc35SJohannes Berg  * This function allocates and pre-fills an skb for an event on the
7829567ffc35SJohannes Berg  * vendor-specific multicast group.
7830567ffc35SJohannes Berg  *
78316c09e791SAhmad Kholaif  * If wdev != NULL, both the ifindex and identifier of the specified
78326c09e791SAhmad Kholaif  * wireless device are added to the event message before the vendor data
78336c09e791SAhmad Kholaif  * attribute.
78346c09e791SAhmad Kholaif  *
7835567ffc35SJohannes Berg  * When done filling the skb, call cfg80211_vendor_event() with the
7836567ffc35SJohannes Berg  * skb to send the event.
7837567ffc35SJohannes Berg  *
7838567ffc35SJohannes Berg  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
7839567ffc35SJohannes Berg  */
7840567ffc35SJohannes Berg static inline struct sk_buff *
cfg80211_vendor_event_alloc(struct wiphy * wiphy,struct wireless_dev * wdev,int approxlen,int event_idx,gfp_t gfp)78416c09e791SAhmad Kholaif cfg80211_vendor_event_alloc(struct wiphy *wiphy, struct wireless_dev *wdev,
78426c09e791SAhmad Kholaif 			     int approxlen, int event_idx, gfp_t gfp)
7843567ffc35SJohannes Berg {
78446c09e791SAhmad Kholaif 	return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR,
7845567ffc35SJohannes Berg 					  NL80211_ATTR_VENDOR_DATA,
784655c1fdf0SJohannes Berg 					  0, event_idx, approxlen, gfp);
784755c1fdf0SJohannes Berg }
784855c1fdf0SJohannes Berg 
784955c1fdf0SJohannes Berg /**
785055c1fdf0SJohannes Berg  * cfg80211_vendor_event_alloc_ucast - alloc unicast vendor-specific event skb
785155c1fdf0SJohannes Berg  * @wiphy: the wiphy
785255c1fdf0SJohannes Berg  * @wdev: the wireless device
785355c1fdf0SJohannes Berg  * @event_idx: index of the vendor event in the wiphy's vendor_events
785455c1fdf0SJohannes Berg  * @portid: port ID of the receiver
785555c1fdf0SJohannes Berg  * @approxlen: an upper bound of the length of the data that will
785655c1fdf0SJohannes Berg  *	be put into the skb
785755c1fdf0SJohannes Berg  * @gfp: allocation flags
785855c1fdf0SJohannes Berg  *
785955c1fdf0SJohannes Berg  * This function allocates and pre-fills an skb for an event to send to
786055c1fdf0SJohannes Berg  * a specific (userland) socket. This socket would previously have been
786155c1fdf0SJohannes Berg  * obtained by cfg80211_vendor_cmd_get_sender(), and the caller MUST take
786255c1fdf0SJohannes Berg  * care to register a netlink notifier to see when the socket closes.
786355c1fdf0SJohannes Berg  *
786455c1fdf0SJohannes Berg  * If wdev != NULL, both the ifindex and identifier of the specified
786555c1fdf0SJohannes Berg  * wireless device are added to the event message before the vendor data
786655c1fdf0SJohannes Berg  * attribute.
786755c1fdf0SJohannes Berg  *
786855c1fdf0SJohannes Berg  * When done filling the skb, call cfg80211_vendor_event() with the
786955c1fdf0SJohannes Berg  * skb to send the event.
787055c1fdf0SJohannes Berg  *
787155c1fdf0SJohannes Berg  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
787255c1fdf0SJohannes Berg  */
787355c1fdf0SJohannes Berg static inline struct sk_buff *
cfg80211_vendor_event_alloc_ucast(struct wiphy * wiphy,struct wireless_dev * wdev,unsigned int portid,int approxlen,int event_idx,gfp_t gfp)787455c1fdf0SJohannes Berg cfg80211_vendor_event_alloc_ucast(struct wiphy *wiphy,
787555c1fdf0SJohannes Berg 				  struct wireless_dev *wdev,
787655c1fdf0SJohannes Berg 				  unsigned int portid, int approxlen,
787755c1fdf0SJohannes Berg 				  int event_idx, gfp_t gfp)
787855c1fdf0SJohannes Berg {
787955c1fdf0SJohannes Berg 	return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR,
788055c1fdf0SJohannes Berg 					  NL80211_ATTR_VENDOR_DATA,
788155c1fdf0SJohannes Berg 					  portid, event_idx, approxlen, gfp);
7882567ffc35SJohannes Berg }
7883567ffc35SJohannes Berg 
7884567ffc35SJohannes Berg /**
7885567ffc35SJohannes Berg  * cfg80211_vendor_event - send the event
7886567ffc35SJohannes Berg  * @skb: The skb, must have been allocated with cfg80211_vendor_event_alloc()
7887567ffc35SJohannes Berg  * @gfp: allocation flags
7888567ffc35SJohannes Berg  *
7889567ffc35SJohannes Berg  * This function sends the given @skb, which must have been allocated
7890567ffc35SJohannes Berg  * by cfg80211_vendor_event_alloc(), as an event. It always consumes it.
7891567ffc35SJohannes Berg  */
cfg80211_vendor_event(struct sk_buff * skb,gfp_t gfp)7892567ffc35SJohannes Berg static inline void cfg80211_vendor_event(struct sk_buff *skb, gfp_t gfp)
7893567ffc35SJohannes Berg {
7894567ffc35SJohannes Berg 	__cfg80211_send_event_skb(skb, gfp);
7895567ffc35SJohannes Berg }
7896567ffc35SJohannes Berg 
7897aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE
7898aff89a9bSJohannes Berg /**
7899d70e9693SJohannes Berg  * DOC: Test mode
7900d70e9693SJohannes Berg  *
7901d70e9693SJohannes Berg  * Test mode is a set of utility functions to allow drivers to
7902d70e9693SJohannes Berg  * interact with driver-specific tools to aid, for instance,
7903d70e9693SJohannes Berg  * factory programming.
7904d70e9693SJohannes Berg  *
790505b23456SRandy Dunlap  * This chapter describes how drivers interact with it. For more
7906d70e9693SJohannes Berg  * information see the nl80211 book's chapter on it.
7907d70e9693SJohannes Berg  */
7908d70e9693SJohannes Berg 
7909d70e9693SJohannes Berg /**
7910aff89a9bSJohannes Berg  * cfg80211_testmode_alloc_reply_skb - allocate testmode reply
7911aff89a9bSJohannes Berg  * @wiphy: the wiphy
7912aff89a9bSJohannes Berg  * @approxlen: an upper bound of the length of the data that will
7913aff89a9bSJohannes Berg  *	be put into the skb
7914aff89a9bSJohannes Berg  *
7915aff89a9bSJohannes Berg  * This function allocates and pre-fills an skb for a reply to
7916aff89a9bSJohannes Berg  * the testmode command. Since it is intended for a reply, calling
7917aff89a9bSJohannes Berg  * it outside of the @testmode_cmd operation is invalid.
7918aff89a9bSJohannes Berg  *
79190ae997dcSYacine Belkadi  * The returned skb is pre-filled with the wiphy index and set up in
79200ae997dcSYacine Belkadi  * a way that any data that is put into the skb (with skb_put(),
79210ae997dcSYacine Belkadi  * nla_put() or similar) will end up being within the
79220ae997dcSYacine Belkadi  * %NL80211_ATTR_TESTDATA attribute, so all that needs to be done
79230ae997dcSYacine Belkadi  * with the skb is adding data for the corresponding userspace tool
79240ae997dcSYacine Belkadi  * which can then read that data out of the testdata attribute. You
79250ae997dcSYacine Belkadi  * must not modify the skb in any other way.
7926aff89a9bSJohannes Berg  *
7927aff89a9bSJohannes Berg  * When done, call cfg80211_testmode_reply() with the skb and return
7928aff89a9bSJohannes Berg  * its error code as the result of the @testmode_cmd operation.
79290ae997dcSYacine Belkadi  *
79300ae997dcSYacine Belkadi  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
7931aff89a9bSJohannes Berg  */
7932ad7e718cSJohannes Berg static inline struct sk_buff *
cfg80211_testmode_alloc_reply_skb(struct wiphy * wiphy,int approxlen)7933ad7e718cSJohannes Berg cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy, int approxlen)
7934ad7e718cSJohannes Berg {
7935ad7e718cSJohannes Berg 	return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_TESTMODE,
7936ad7e718cSJohannes Berg 					  NL80211_ATTR_TESTDATA, approxlen);
7937ad7e718cSJohannes Berg }
7938aff89a9bSJohannes Berg 
7939aff89a9bSJohannes Berg /**
7940aff89a9bSJohannes Berg  * cfg80211_testmode_reply - send the reply skb
7941aff89a9bSJohannes Berg  * @skb: The skb, must have been allocated with
7942aff89a9bSJohannes Berg  *	cfg80211_testmode_alloc_reply_skb()
7943aff89a9bSJohannes Berg  *
79440ae997dcSYacine Belkadi  * Since calling this function will usually be the last thing
79450ae997dcSYacine Belkadi  * before returning from the @testmode_cmd you should return
79460ae997dcSYacine Belkadi  * the error code.  Note that this function consumes the skb
79470ae997dcSYacine Belkadi  * regardless of the return value.
79480ae997dcSYacine Belkadi  *
79490ae997dcSYacine Belkadi  * Return: An error code or 0 on success.
7950aff89a9bSJohannes Berg  */
cfg80211_testmode_reply(struct sk_buff * skb)7951ad7e718cSJohannes Berg static inline int cfg80211_testmode_reply(struct sk_buff *skb)
7952ad7e718cSJohannes Berg {
7953ad7e718cSJohannes Berg 	return cfg80211_vendor_cmd_reply(skb);
7954ad7e718cSJohannes Berg }
7955aff89a9bSJohannes Berg 
7956aff89a9bSJohannes Berg /**
7957aff89a9bSJohannes Berg  * cfg80211_testmode_alloc_event_skb - allocate testmode event
7958aff89a9bSJohannes Berg  * @wiphy: the wiphy
7959aff89a9bSJohannes Berg  * @approxlen: an upper bound of the length of the data that will
7960aff89a9bSJohannes Berg  *	be put into the skb
7961aff89a9bSJohannes Berg  * @gfp: allocation flags
7962aff89a9bSJohannes Berg  *
7963aff89a9bSJohannes Berg  * This function allocates and pre-fills an skb for an event on the
7964aff89a9bSJohannes Berg  * testmode multicast group.
7965aff89a9bSJohannes Berg  *
79660ae997dcSYacine Belkadi  * The returned skb is set up in the same way as with
79670ae997dcSYacine Belkadi  * cfg80211_testmode_alloc_reply_skb() but prepared for an event. As
79680ae997dcSYacine Belkadi  * there, you should simply add data to it that will then end up in the
79690ae997dcSYacine Belkadi  * %NL80211_ATTR_TESTDATA attribute. Again, you must not modify the skb
79700ae997dcSYacine Belkadi  * in any other way.
7971aff89a9bSJohannes Berg  *
7972aff89a9bSJohannes Berg  * When done filling the skb, call cfg80211_testmode_event() with the
7973aff89a9bSJohannes Berg  * skb to send the event.
79740ae997dcSYacine Belkadi  *
79750ae997dcSYacine Belkadi  * Return: An allocated and pre-filled skb. %NULL if any errors happen.
7976aff89a9bSJohannes Berg  */
7977567ffc35SJohannes Berg static inline struct sk_buff *
cfg80211_testmode_alloc_event_skb(struct wiphy * wiphy,int approxlen,gfp_t gfp)7978567ffc35SJohannes Berg cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy, int approxlen, gfp_t gfp)
7979567ffc35SJohannes Berg {
79806c09e791SAhmad Kholaif 	return __cfg80211_alloc_event_skb(wiphy, NULL, NL80211_CMD_TESTMODE,
798155c1fdf0SJohannes Berg 					  NL80211_ATTR_TESTDATA, 0, -1,
7982567ffc35SJohannes Berg 					  approxlen, gfp);
7983567ffc35SJohannes Berg }
7984aff89a9bSJohannes Berg 
7985aff89a9bSJohannes Berg /**
7986aff89a9bSJohannes Berg  * cfg80211_testmode_event - send the event
7987aff89a9bSJohannes Berg  * @skb: The skb, must have been allocated with
7988aff89a9bSJohannes Berg  *	cfg80211_testmode_alloc_event_skb()
7989aff89a9bSJohannes Berg  * @gfp: allocation flags
7990aff89a9bSJohannes Berg  *
7991aff89a9bSJohannes Berg  * This function sends the given @skb, which must have been allocated
7992aff89a9bSJohannes Berg  * by cfg80211_testmode_alloc_event_skb(), as an event. It always
7993aff89a9bSJohannes Berg  * consumes it.
7994aff89a9bSJohannes Berg  */
cfg80211_testmode_event(struct sk_buff * skb,gfp_t gfp)7995567ffc35SJohannes Berg static inline void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp)
7996567ffc35SJohannes Berg {
7997567ffc35SJohannes Berg 	__cfg80211_send_event_skb(skb, gfp);
7998567ffc35SJohannes Berg }
7999aff89a9bSJohannes Berg 
8000aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd)	.testmode_cmd = (cmd),
800171063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd)	.testmode_dump = (cmd),
8002aff89a9bSJohannes Berg #else
8003aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd)
800471063f0eSWey-Yi Guy #define CFG80211_TESTMODE_DUMP(cmd)
8005aff89a9bSJohannes Berg #endif
8006aff89a9bSJohannes Berg 
8007b23aa676SSamuel Ortiz /**
800876804d28SArend Van Spriel  * struct cfg80211_fils_resp_params - FILS connection response params
800976804d28SArend Van Spriel  * @kek: KEK derived from a successful FILS connection (may be %NULL)
801076804d28SArend Van Spriel  * @kek_len: Length of @fils_kek in octets
801176804d28SArend Van Spriel  * @update_erp_next_seq_num: Boolean value to specify whether the value in
801276804d28SArend Van Spriel  *	@erp_next_seq_num is valid.
801376804d28SArend Van Spriel  * @erp_next_seq_num: The next sequence number to use in ERP message in
801476804d28SArend Van Spriel  *	FILS Authentication. This value should be specified irrespective of the
801576804d28SArend Van Spriel  *	status for a FILS connection.
801676804d28SArend Van Spriel  * @pmk: A new PMK if derived from a successful FILS connection (may be %NULL).
801776804d28SArend Van Spriel  * @pmk_len: Length of @pmk in octets
801876804d28SArend Van Spriel  * @pmkid: A new PMKID if derived from a successful FILS connection or the PMKID
801976804d28SArend Van Spriel  *	used for this FILS connection (may be %NULL).
802076804d28SArend Van Spriel  */
802176804d28SArend Van Spriel struct cfg80211_fils_resp_params {
802276804d28SArend Van Spriel 	const u8 *kek;
802376804d28SArend Van Spriel 	size_t kek_len;
802476804d28SArend Van Spriel 	bool update_erp_next_seq_num;
802576804d28SArend Van Spriel 	u16 erp_next_seq_num;
802676804d28SArend Van Spriel 	const u8 *pmk;
802776804d28SArend Van Spriel 	size_t pmk_len;
802876804d28SArend Van Spriel 	const u8 *pmkid;
802976804d28SArend Van Spriel };
803076804d28SArend Van Spriel 
803176804d28SArend Van Spriel /**
80325349a0f7SVidyullatha Kanchanapally  * struct cfg80211_connect_resp_params - Connection response params
80335349a0f7SVidyullatha Kanchanapally  * @status: Status code, %WLAN_STATUS_SUCCESS for successful connection, use
80345349a0f7SVidyullatha Kanchanapally  *	%WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
80355349a0f7SVidyullatha Kanchanapally  *	the real status code for failures. If this call is used to report a
80365349a0f7SVidyullatha Kanchanapally  *	failure due to a timeout (e.g., not receiving an Authentication frame
80375349a0f7SVidyullatha Kanchanapally  *	from the AP) instead of an explicit rejection by the AP, -1 is used to
80385349a0f7SVidyullatha Kanchanapally  *	indicate that this is a failure, but without a status code.
80395349a0f7SVidyullatha Kanchanapally  *	@timeout_reason is used to report the reason for the timeout in that
80405349a0f7SVidyullatha Kanchanapally  *	case.
80415349a0f7SVidyullatha Kanchanapally  * @req_ie: Association request IEs (may be %NULL)
80425349a0f7SVidyullatha Kanchanapally  * @req_ie_len: Association request IEs length
80435349a0f7SVidyullatha Kanchanapally  * @resp_ie: Association response IEs (may be %NULL)
80445349a0f7SVidyullatha Kanchanapally  * @resp_ie_len: Association response IEs length
804576804d28SArend Van Spriel  * @fils: FILS connection response parameters.
80465349a0f7SVidyullatha Kanchanapally  * @timeout_reason: Reason for connection timeout. This is used when the
80475349a0f7SVidyullatha Kanchanapally  *	connection fails due to a timeout instead of an explicit rejection from
80485349a0f7SVidyullatha Kanchanapally  *	the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is
80495349a0f7SVidyullatha Kanchanapally  *	not known. This value is used only if @status < 0 to indicate that the
80505349a0f7SVidyullatha Kanchanapally  *	failure is due to a timeout and not due to explicit rejection by the AP.
80515349a0f7SVidyullatha Kanchanapally  *	This value is ignored in other cases (@status >= 0).
8052efbabc11SVeerendranath Jakkam  * @valid_links: For MLO connection, BIT mask of the valid link ids. Otherwise
8053efbabc11SVeerendranath Jakkam  *	zero.
8054efbabc11SVeerendranath Jakkam  * @ap_mld_addr: For MLO connection, MLD address of the AP. Otherwise %NULL.
8055efbabc11SVeerendranath Jakkam  * @links : For MLO connection, contains link info for the valid links indicated
8056efbabc11SVeerendranath Jakkam  *	using @valid_links. For non-MLO connection, links[0] contains the
8057efbabc11SVeerendranath Jakkam  *	connected AP info.
8058efbabc11SVeerendranath Jakkam  * @links.addr: For MLO connection, MAC address of the STA link. Otherwise
8059efbabc11SVeerendranath Jakkam  *	%NULL.
8060efbabc11SVeerendranath Jakkam  * @links.bssid: For MLO connection, MAC address of the AP link. For non-MLO
8061efbabc11SVeerendranath Jakkam  *	connection, links[0].bssid points to the BSSID of the AP (may be %NULL).
8062efbabc11SVeerendranath Jakkam  * @links.bss: For MLO connection, entry of bss to which STA link is connected.
8063efbabc11SVeerendranath Jakkam  *	For non-MLO connection, links[0].bss points to entry of bss to which STA
8064efbabc11SVeerendranath Jakkam  *	is connected. It can be obtained through cfg80211_get_bss() (may be
8065efbabc11SVeerendranath Jakkam  *	%NULL). It is recommended to store the bss from the connect_request and
8066efbabc11SVeerendranath Jakkam  *	hold a reference to it and return through this param to avoid a warning
8067efbabc11SVeerendranath Jakkam  *	if the bss is expired during the connection, esp. for those drivers
8068efbabc11SVeerendranath Jakkam  *	implementing connect op. Only one parameter among @bssid and @bss needs
8069efbabc11SVeerendranath Jakkam  *	to be specified.
807053ad07e9SJohannes Berg  * @links.status: per-link status code, to report a status code that's not
807153ad07e9SJohannes Berg  *	%WLAN_STATUS_SUCCESS for a given link, it must also be in the
807253ad07e9SJohannes Berg  *	@valid_links bitmap and may have a BSS pointer (which is then released)
80735349a0f7SVidyullatha Kanchanapally  */
80745349a0f7SVidyullatha Kanchanapally struct cfg80211_connect_resp_params {
80755349a0f7SVidyullatha Kanchanapally 	int status;
80765349a0f7SVidyullatha Kanchanapally 	const u8 *req_ie;
80775349a0f7SVidyullatha Kanchanapally 	size_t req_ie_len;
80785349a0f7SVidyullatha Kanchanapally 	const u8 *resp_ie;
80795349a0f7SVidyullatha Kanchanapally 	size_t resp_ie_len;
808076804d28SArend Van Spriel 	struct cfg80211_fils_resp_params fils;
80815349a0f7SVidyullatha Kanchanapally 	enum nl80211_timeout_reason timeout_reason;
8082efbabc11SVeerendranath Jakkam 
8083efbabc11SVeerendranath Jakkam 	const u8 *ap_mld_addr;
8084efbabc11SVeerendranath Jakkam 	u16 valid_links;
8085efbabc11SVeerendranath Jakkam 	struct {
8086efbabc11SVeerendranath Jakkam 		const u8 *addr;
8087efbabc11SVeerendranath Jakkam 		const u8 *bssid;
8088efbabc11SVeerendranath Jakkam 		struct cfg80211_bss *bss;
808953ad07e9SJohannes Berg 		u16 status;
8090efbabc11SVeerendranath Jakkam 	} links[IEEE80211_MLD_MAX_NUM_LINKS];
80915349a0f7SVidyullatha Kanchanapally };
80925349a0f7SVidyullatha Kanchanapally 
80935349a0f7SVidyullatha Kanchanapally /**
80945349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_done - notify cfg80211 of connection result
80955349a0f7SVidyullatha Kanchanapally  *
80965349a0f7SVidyullatha Kanchanapally  * @dev: network device
80975349a0f7SVidyullatha Kanchanapally  * @params: connection response parameters
80985349a0f7SVidyullatha Kanchanapally  * @gfp: allocation flags
80995349a0f7SVidyullatha Kanchanapally  *
81005349a0f7SVidyullatha Kanchanapally  * It should be called by the underlying driver once execution of the connection
81015349a0f7SVidyullatha Kanchanapally  * request from connect() has been completed. This is similar to
81025349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_bss(), but takes a structure pointer for connection response
81035349a0f7SVidyullatha Kanchanapally  * parameters. Only one of the functions among cfg80211_connect_bss(),
81045349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_result(), cfg80211_connect_timeout(),
81055349a0f7SVidyullatha Kanchanapally  * and cfg80211_connect_done() should be called.
81065349a0f7SVidyullatha Kanchanapally  */
81075349a0f7SVidyullatha Kanchanapally void cfg80211_connect_done(struct net_device *dev,
81085349a0f7SVidyullatha Kanchanapally 			   struct cfg80211_connect_resp_params *params,
81095349a0f7SVidyullatha Kanchanapally 			   gfp_t gfp);
81105349a0f7SVidyullatha Kanchanapally 
81115349a0f7SVidyullatha Kanchanapally /**
8112e7054989SKanchanapally, Vidyullatha  * cfg80211_connect_bss - notify cfg80211 of connection result
8113e7054989SKanchanapally, Vidyullatha  *
8114e7054989SKanchanapally, Vidyullatha  * @dev: network device
8115e7054989SKanchanapally, Vidyullatha  * @bssid: the BSSID of the AP
8116a3ce17d1SChaitanya Tata  * @bss: Entry of bss to which STA got connected to, can be obtained through
8117a3ce17d1SChaitanya Tata  *	cfg80211_get_bss() (may be %NULL). But it is recommended to store the
8118a3ce17d1SChaitanya Tata  *	bss from the connect_request and hold a reference to it and return
8119a3ce17d1SChaitanya Tata  *	through this param to avoid a warning if the bss is expired during the
8120a3ce17d1SChaitanya Tata  *	connection, esp. for those drivers implementing connect op.
8121a3ce17d1SChaitanya Tata  *	Only one parameter among @bssid and @bss needs to be specified.
8122e7054989SKanchanapally, Vidyullatha  * @req_ie: association request IEs (maybe be %NULL)
8123e7054989SKanchanapally, Vidyullatha  * @req_ie_len: association request IEs length
8124e7054989SKanchanapally, Vidyullatha  * @resp_ie: association response IEs (may be %NULL)
8125e7054989SKanchanapally, Vidyullatha  * @resp_ie_len: assoc response IEs length
8126c88215d7SJouni Malinen  * @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use
8127e7054989SKanchanapally, Vidyullatha  *	%WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
8128c88215d7SJouni Malinen  *	the real status code for failures. If this call is used to report a
8129c88215d7SJouni Malinen  *	failure due to a timeout (e.g., not receiving an Authentication frame
8130c88215d7SJouni Malinen  *	from the AP) instead of an explicit rejection by the AP, -1 is used to
8131c88215d7SJouni Malinen  *	indicate that this is a failure, but without a status code.
8132c88215d7SJouni Malinen  *	@timeout_reason is used to report the reason for the timeout in that
8133c88215d7SJouni Malinen  *	case.
8134e7054989SKanchanapally, Vidyullatha  * @gfp: allocation flags
81353093ebbeSPurushottam Kushwaha  * @timeout_reason: reason for connection timeout. This is used when the
81363093ebbeSPurushottam Kushwaha  *	connection fails due to a timeout instead of an explicit rejection from
81373093ebbeSPurushottam Kushwaha  *	the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is
81383093ebbeSPurushottam Kushwaha  *	not known. This value is used only if @status < 0 to indicate that the
81393093ebbeSPurushottam Kushwaha  *	failure is due to a timeout and not due to explicit rejection by the AP.
81403093ebbeSPurushottam Kushwaha  *	This value is ignored in other cases (@status >= 0).
8141e7054989SKanchanapally, Vidyullatha  *
8142c88215d7SJouni Malinen  * It should be called by the underlying driver once execution of the connection
8143c88215d7SJouni Malinen  * request from connect() has been completed. This is similar to
8144c88215d7SJouni Malinen  * cfg80211_connect_result(), but with the option of identifying the exact bss
81455349a0f7SVidyullatha Kanchanapally  * entry for the connection. Only one of the functions among
81465349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_bss(), cfg80211_connect_result(),
81475349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
8148e7054989SKanchanapally, Vidyullatha  */
81495349a0f7SVidyullatha Kanchanapally static inline void
cfg80211_connect_bss(struct net_device * dev,const u8 * bssid,struct cfg80211_bss * bss,const u8 * req_ie,size_t req_ie_len,const u8 * resp_ie,size_t resp_ie_len,int status,gfp_t gfp,enum nl80211_timeout_reason timeout_reason)81505349a0f7SVidyullatha Kanchanapally cfg80211_connect_bss(struct net_device *dev, const u8 *bssid,
8151e7054989SKanchanapally, Vidyullatha 		     struct cfg80211_bss *bss, const u8 *req_ie,
8152e7054989SKanchanapally, Vidyullatha 		     size_t req_ie_len, const u8 *resp_ie,
81533093ebbeSPurushottam Kushwaha 		     size_t resp_ie_len, int status, gfp_t gfp,
81545349a0f7SVidyullatha Kanchanapally 		     enum nl80211_timeout_reason timeout_reason)
81555349a0f7SVidyullatha Kanchanapally {
81565349a0f7SVidyullatha Kanchanapally 	struct cfg80211_connect_resp_params params;
81575349a0f7SVidyullatha Kanchanapally 
81585349a0f7SVidyullatha Kanchanapally 	memset(&params, 0, sizeof(params));
81595349a0f7SVidyullatha Kanchanapally 	params.status = status;
8160efbabc11SVeerendranath Jakkam 	params.links[0].bssid = bssid;
8161efbabc11SVeerendranath Jakkam 	params.links[0].bss = bss;
81625349a0f7SVidyullatha Kanchanapally 	params.req_ie = req_ie;
81635349a0f7SVidyullatha Kanchanapally 	params.req_ie_len = req_ie_len;
81645349a0f7SVidyullatha Kanchanapally 	params.resp_ie = resp_ie;
81655349a0f7SVidyullatha Kanchanapally 	params.resp_ie_len = resp_ie_len;
81665349a0f7SVidyullatha Kanchanapally 	params.timeout_reason = timeout_reason;
81675349a0f7SVidyullatha Kanchanapally 
81685349a0f7SVidyullatha Kanchanapally 	cfg80211_connect_done(dev, &params, gfp);
81695349a0f7SVidyullatha Kanchanapally }
8170e7054989SKanchanapally, Vidyullatha 
8171e7054989SKanchanapally, Vidyullatha /**
8172b23aa676SSamuel Ortiz  * cfg80211_connect_result - notify cfg80211 of connection result
8173b23aa676SSamuel Ortiz  *
8174b23aa676SSamuel Ortiz  * @dev: network device
8175b23aa676SSamuel Ortiz  * @bssid: the BSSID of the AP
8176b23aa676SSamuel Ortiz  * @req_ie: association request IEs (maybe be %NULL)
8177b23aa676SSamuel Ortiz  * @req_ie_len: association request IEs length
8178b23aa676SSamuel Ortiz  * @resp_ie: association response IEs (may be %NULL)
8179b23aa676SSamuel Ortiz  * @resp_ie_len: assoc response IEs length
8180c88215d7SJouni Malinen  * @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use
8181b23aa676SSamuel Ortiz  *	%WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
8182b23aa676SSamuel Ortiz  *	the real status code for failures.
8183b23aa676SSamuel Ortiz  * @gfp: allocation flags
8184b23aa676SSamuel Ortiz  *
8185c88215d7SJouni Malinen  * It should be called by the underlying driver once execution of the connection
8186c88215d7SJouni Malinen  * request from connect() has been completed. This is similar to
8187c88215d7SJouni Malinen  * cfg80211_connect_bss() which allows the exact bss entry to be specified. Only
81885349a0f7SVidyullatha Kanchanapally  * one of the functions among cfg80211_connect_bss(), cfg80211_connect_result(),
81895349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
8190b23aa676SSamuel Ortiz  */
8191e7054989SKanchanapally, Vidyullatha static inline void
cfg80211_connect_result(struct net_device * dev,const u8 * bssid,const u8 * req_ie,size_t req_ie_len,const u8 * resp_ie,size_t resp_ie_len,u16 status,gfp_t gfp)8192e7054989SKanchanapally, Vidyullatha cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
8193b23aa676SSamuel Ortiz 			const u8 *req_ie, size_t req_ie_len,
8194b23aa676SSamuel Ortiz 			const u8 *resp_ie, size_t resp_ie_len,
8195e7054989SKanchanapally, Vidyullatha 			u16 status, gfp_t gfp)
8196e7054989SKanchanapally, Vidyullatha {
8197e7054989SKanchanapally, Vidyullatha 	cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, resp_ie,
81983093ebbeSPurushottam Kushwaha 			     resp_ie_len, status, gfp,
81993093ebbeSPurushottam Kushwaha 			     NL80211_TIMEOUT_UNSPECIFIED);
8200e7054989SKanchanapally, Vidyullatha }
8201b23aa676SSamuel Ortiz 
8202b23aa676SSamuel Ortiz /**
8203bf1ecd21SJouni Malinen  * cfg80211_connect_timeout - notify cfg80211 of connection timeout
8204bf1ecd21SJouni Malinen  *
8205bf1ecd21SJouni Malinen  * @dev: network device
8206bf1ecd21SJouni Malinen  * @bssid: the BSSID of the AP
8207bf1ecd21SJouni Malinen  * @req_ie: association request IEs (maybe be %NULL)
8208bf1ecd21SJouni Malinen  * @req_ie_len: association request IEs length
8209bf1ecd21SJouni Malinen  * @gfp: allocation flags
82103093ebbeSPurushottam Kushwaha  * @timeout_reason: reason for connection timeout.
8211bf1ecd21SJouni Malinen  *
8212bf1ecd21SJouni Malinen  * It should be called by the underlying driver whenever connect() has failed
8213bf1ecd21SJouni Malinen  * in a sequence where no explicit authentication/association rejection was
8214bf1ecd21SJouni Malinen  * received from the AP. This could happen, e.g., due to not being able to send
8215bf1ecd21SJouni Malinen  * out the Authentication or Association Request frame or timing out while
82165349a0f7SVidyullatha Kanchanapally  * waiting for the response. Only one of the functions among
82175349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_bss(), cfg80211_connect_result(),
82185349a0f7SVidyullatha Kanchanapally  * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
8219bf1ecd21SJouni Malinen  */
8220bf1ecd21SJouni Malinen static inline void
cfg80211_connect_timeout(struct net_device * dev,const u8 * bssid,const u8 * req_ie,size_t req_ie_len,gfp_t gfp,enum nl80211_timeout_reason timeout_reason)8221bf1ecd21SJouni Malinen cfg80211_connect_timeout(struct net_device *dev, const u8 *bssid,
82223093ebbeSPurushottam Kushwaha 			 const u8 *req_ie, size_t req_ie_len, gfp_t gfp,
82233093ebbeSPurushottam Kushwaha 			 enum nl80211_timeout_reason timeout_reason)
8224bf1ecd21SJouni Malinen {
8225bf1ecd21SJouni Malinen 	cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, NULL, 0, -1,
82263093ebbeSPurushottam Kushwaha 			     gfp, timeout_reason);
8227bf1ecd21SJouni Malinen }
8228bf1ecd21SJouni Malinen 
8229bf1ecd21SJouni Malinen /**
823029ce6ecbSAvraham Stern  * struct cfg80211_roam_info - driver initiated roaming information
823129ce6ecbSAvraham Stern  *
823229ce6ecbSAvraham Stern  * @req_ie: association request IEs (maybe be %NULL)
823329ce6ecbSAvraham Stern  * @req_ie_len: association request IEs length
823429ce6ecbSAvraham Stern  * @resp_ie: association response IEs (may be %NULL)
823529ce6ecbSAvraham Stern  * @resp_ie_len: assoc response IEs length
8236e841b7b1SArend Van Spriel  * @fils: FILS related roaming information.
8237efbabc11SVeerendranath Jakkam  * @valid_links: For MLO roaming, BIT mask of the new valid links is set.
8238efbabc11SVeerendranath Jakkam  *	Otherwise zero.
8239efbabc11SVeerendranath Jakkam  * @ap_mld_addr: For MLO roaming, MLD address of the new AP. Otherwise %NULL.
8240efbabc11SVeerendranath Jakkam  * @links : For MLO roaming, contains new link info for the valid links set in
8241efbabc11SVeerendranath Jakkam  *	@valid_links. For non-MLO roaming, links[0] contains the new AP info.
8242efbabc11SVeerendranath Jakkam  * @links.addr: For MLO roaming, MAC address of the STA link. Otherwise %NULL.
8243efbabc11SVeerendranath Jakkam  * @links.bssid: For MLO roaming, MAC address of the new AP link. For non-MLO
8244efbabc11SVeerendranath Jakkam  *	roaming, links[0].bssid points to the BSSID of the new AP. May be
8245efbabc11SVeerendranath Jakkam  *	%NULL if %links.bss is set.
8246efbabc11SVeerendranath Jakkam  * @links.channel: the channel of the new AP.
8247efbabc11SVeerendranath Jakkam  * @links.bss: For MLO roaming, entry of new bss to which STA link got
8248efbabc11SVeerendranath Jakkam  *	roamed. For non-MLO roaming, links[0].bss points to entry of bss to
8249efbabc11SVeerendranath Jakkam  *	which STA got roamed (may be %NULL if %links.bssid is set)
825029ce6ecbSAvraham Stern  */
825129ce6ecbSAvraham Stern struct cfg80211_roam_info {
825229ce6ecbSAvraham Stern 	const u8 *req_ie;
825329ce6ecbSAvraham Stern 	size_t req_ie_len;
825429ce6ecbSAvraham Stern 	const u8 *resp_ie;
825529ce6ecbSAvraham Stern 	size_t resp_ie_len;
8256e841b7b1SArend Van Spriel 	struct cfg80211_fils_resp_params fils;
8257efbabc11SVeerendranath Jakkam 
8258efbabc11SVeerendranath Jakkam 	const u8 *ap_mld_addr;
8259efbabc11SVeerendranath Jakkam 	u16 valid_links;
8260efbabc11SVeerendranath Jakkam 	struct {
8261efbabc11SVeerendranath Jakkam 		const u8 *addr;
8262efbabc11SVeerendranath Jakkam 		const u8 *bssid;
8263efbabc11SVeerendranath Jakkam 		struct ieee80211_channel *channel;
8264efbabc11SVeerendranath Jakkam 		struct cfg80211_bss *bss;
8265efbabc11SVeerendranath Jakkam 	} links[IEEE80211_MLD_MAX_NUM_LINKS];
826629ce6ecbSAvraham Stern };
826729ce6ecbSAvraham Stern 
826829ce6ecbSAvraham Stern /**
8269b23aa676SSamuel Ortiz  * cfg80211_roamed - notify cfg80211 of roaming
8270b23aa676SSamuel Ortiz  *
8271b23aa676SSamuel Ortiz  * @dev: network device
827229ce6ecbSAvraham Stern  * @info: information about the new BSS. struct &cfg80211_roam_info.
8273b23aa676SSamuel Ortiz  * @gfp: allocation flags
8274b23aa676SSamuel Ortiz  *
827529ce6ecbSAvraham Stern  * This function may be called with the driver passing either the BSSID of the
827629ce6ecbSAvraham Stern  * new AP or passing the bss entry to avoid a race in timeout of the bss entry.
827729ce6ecbSAvraham Stern  * It should be called by the underlying driver whenever it roamed from one AP
827829ce6ecbSAvraham Stern  * to another while connected. Drivers which have roaming implemented in
827929ce6ecbSAvraham Stern  * firmware should pass the bss entry to avoid a race in bss entry timeout where
828029ce6ecbSAvraham Stern  * the bss entry of the new AP is seen in the driver, but gets timed out by the
828129ce6ecbSAvraham Stern  * time it is accessed in __cfg80211_roamed() due to delay in scheduling
8282adbde344SVasanthakumar Thiagarajan  * rdev->event_work. In case of any failures, the reference is released
828329ce6ecbSAvraham Stern  * either in cfg80211_roamed() or in __cfg80211_romed(), Otherwise, it will be
8284e1b18549SGeert Uytterhoeven  * released while disconnecting from the current bss.
8285adbde344SVasanthakumar Thiagarajan  */
828629ce6ecbSAvraham Stern void cfg80211_roamed(struct net_device *dev, struct cfg80211_roam_info *info,
828729ce6ecbSAvraham Stern 		     gfp_t gfp);
8288adbde344SVasanthakumar Thiagarajan 
8289adbde344SVasanthakumar Thiagarajan /**
8290503c1fb9SAvraham Stern  * cfg80211_port_authorized - notify cfg80211 of successful security association
8291503c1fb9SAvraham Stern  *
8292503c1fb9SAvraham Stern  * @dev: network device
8293e4e7e3afSVinayak Yadawad  * @peer_addr: BSSID of the AP/P2P GO in case of STA/GC or STA/GC MAC address
8294e4e7e3afSVinayak Yadawad  *	in case of AP/P2P GO
82950ff57171SVinayak Yadawad  * @td_bitmap: transition disable policy
82960ff57171SVinayak Yadawad  * @td_bitmap_len: Length of transition disable policy
8297503c1fb9SAvraham Stern  * @gfp: allocation flags
8298503c1fb9SAvraham Stern  *
8299503c1fb9SAvraham Stern  * This function should be called by a driver that supports 4 way handshake
8300503c1fb9SAvraham Stern  * offload after a security association was successfully established (i.e.,
8301503c1fb9SAvraham Stern  * the 4 way handshake was completed successfully). The call to this function
8302503c1fb9SAvraham Stern  * should be preceded with a call to cfg80211_connect_result(),
8303503c1fb9SAvraham Stern  * cfg80211_connect_done(), cfg80211_connect_bss() or cfg80211_roamed() to
8304503c1fb9SAvraham Stern  * indicate the 802.11 association.
8305e4e7e3afSVinayak Yadawad  * This function can also be called by AP/P2P GO driver that supports
8306e4e7e3afSVinayak Yadawad  * authentication offload. In this case the peer_mac passed is that of
8307e4e7e3afSVinayak Yadawad  * associated STA/GC.
8308503c1fb9SAvraham Stern  */
8309e4e7e3afSVinayak Yadawad void cfg80211_port_authorized(struct net_device *dev, const u8 *peer_addr,
83100ff57171SVinayak Yadawad 			      const u8* td_bitmap, u8 td_bitmap_len, gfp_t gfp);
8311503c1fb9SAvraham Stern 
8312503c1fb9SAvraham Stern /**
8313b23aa676SSamuel Ortiz  * cfg80211_disconnected - notify cfg80211 that connection was dropped
8314b23aa676SSamuel Ortiz  *
8315b23aa676SSamuel Ortiz  * @dev: network device
8316b23aa676SSamuel Ortiz  * @ie: information elements of the deauth/disassoc frame (may be %NULL)
8317b23aa676SSamuel Ortiz  * @ie_len: length of IEs
8318b23aa676SSamuel Ortiz  * @reason: reason code for the disconnection, set it to 0 if unknown
831980279fb7SJohannes Berg  * @locally_generated: disconnection was requested locally
8320b23aa676SSamuel Ortiz  * @gfp: allocation flags
8321b23aa676SSamuel Ortiz  *
8322b23aa676SSamuel Ortiz  * After it calls this function, the driver should enter an idle state
8323b23aa676SSamuel Ortiz  * and not try to connect to any AP any more.
8324b23aa676SSamuel Ortiz  */
8325b23aa676SSamuel Ortiz void cfg80211_disconnected(struct net_device *dev, u16 reason,
832680279fb7SJohannes Berg 			   const u8 *ie, size_t ie_len,
832780279fb7SJohannes Berg 			   bool locally_generated, gfp_t gfp);
8328b23aa676SSamuel Ortiz 
83299588bbd5SJouni Malinen /**
83309588bbd5SJouni Malinen  * cfg80211_ready_on_channel - notification of remain_on_channel start
833171bbc994SJohannes Berg  * @wdev: wireless device
83329588bbd5SJouni Malinen  * @cookie: the request cookie
83339588bbd5SJouni Malinen  * @chan: The current channel (from remain_on_channel request)
83349588bbd5SJouni Malinen  * @duration: Duration in milliseconds that the driver intents to remain on the
83359588bbd5SJouni Malinen  *	channel
83369588bbd5SJouni Malinen  * @gfp: allocation flags
83379588bbd5SJouni Malinen  */
833871bbc994SJohannes Berg void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie,
83399588bbd5SJouni Malinen 			       struct ieee80211_channel *chan,
83409588bbd5SJouni Malinen 			       unsigned int duration, gfp_t gfp);
83419588bbd5SJouni Malinen 
83429588bbd5SJouni Malinen /**
83439588bbd5SJouni Malinen  * cfg80211_remain_on_channel_expired - remain_on_channel duration expired
834471bbc994SJohannes Berg  * @wdev: wireless device
83459588bbd5SJouni Malinen  * @cookie: the request cookie
83469588bbd5SJouni Malinen  * @chan: The current channel (from remain_on_channel request)
83479588bbd5SJouni Malinen  * @gfp: allocation flags
83489588bbd5SJouni Malinen  */
834971bbc994SJohannes Berg void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie,
83509588bbd5SJouni Malinen 					struct ieee80211_channel *chan,
83519588bbd5SJouni Malinen 					gfp_t gfp);
8352b23aa676SSamuel Ortiz 
83538689c051SArend van Spriel /**
83541c38c7f2SJames Prestwood  * cfg80211_tx_mgmt_expired - tx_mgmt duration expired
83551c38c7f2SJames Prestwood  * @wdev: wireless device
83561c38c7f2SJames Prestwood  * @cookie: the requested cookie
83571c38c7f2SJames Prestwood  * @chan: The current channel (from tx_mgmt request)
83581c38c7f2SJames Prestwood  * @gfp: allocation flags
83591c38c7f2SJames Prestwood  */
83601c38c7f2SJames Prestwood void cfg80211_tx_mgmt_expired(struct wireless_dev *wdev, u64 cookie,
83611c38c7f2SJames Prestwood 			      struct ieee80211_channel *chan, gfp_t gfp);
83621c38c7f2SJames Prestwood 
83631c38c7f2SJames Prestwood /**
83648689c051SArend van Spriel  * cfg80211_sinfo_alloc_tid_stats - allocate per-tid statistics.
83658689c051SArend van Spriel  *
83668689c051SArend van Spriel  * @sinfo: the station information
83678689c051SArend van Spriel  * @gfp: allocation flags
836862cc206cSJeff Johnson  *
836962cc206cSJeff Johnson  * Return: 0 on success. Non-zero on error.
83708689c051SArend van Spriel  */
83718689c051SArend van Spriel int cfg80211_sinfo_alloc_tid_stats(struct station_info *sinfo, gfp_t gfp);
837298b62183SJohannes Berg 
837398b62183SJohannes Berg /**
83747ea3e110SJohannes Berg  * cfg80211_sinfo_release_content - release contents of station info
83757ea3e110SJohannes Berg  * @sinfo: the station information
83767ea3e110SJohannes Berg  *
83777ea3e110SJohannes Berg  * Releases any potentially allocated sub-information of the station
83787ea3e110SJohannes Berg  * information, but not the struct itself (since it's typically on
83797ea3e110SJohannes Berg  * the stack.)
83807ea3e110SJohannes Berg  */
cfg80211_sinfo_release_content(struct station_info * sinfo)83817ea3e110SJohannes Berg static inline void cfg80211_sinfo_release_content(struct station_info *sinfo)
83827ea3e110SJohannes Berg {
83837ea3e110SJohannes Berg 	kfree(sinfo->pertid);
83847ea3e110SJohannes Berg }
83857ea3e110SJohannes Berg 
83867ea3e110SJohannes Berg /**
838798b62183SJohannes Berg  * cfg80211_new_sta - notify userspace about station
838898b62183SJohannes Berg  *
838998b62183SJohannes Berg  * @dev: the netdev
839098b62183SJohannes Berg  * @mac_addr: the station's address
839198b62183SJohannes Berg  * @sinfo: the station information
839298b62183SJohannes Berg  * @gfp: allocation flags
839398b62183SJohannes Berg  */
839498b62183SJohannes Berg void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr,
839598b62183SJohannes Berg 		      struct station_info *sinfo, gfp_t gfp);
839698b62183SJohannes Berg 
8397026331c4SJouni Malinen /**
8398cf5ead82SJohannes Berg  * cfg80211_del_sta_sinfo - notify userspace about deletion of a station
8399cf5ead82SJohannes Berg  * @dev: the netdev
8400bfc55167SVeerendranath Jakkam  * @mac_addr: the station's address. For MLD station, MLD address is used.
8401cf5ead82SJohannes Berg  * @sinfo: the station information/statistics
8402cf5ead82SJohannes Berg  * @gfp: allocation flags
8403cf5ead82SJohannes Berg  */
8404cf5ead82SJohannes Berg void cfg80211_del_sta_sinfo(struct net_device *dev, const u8 *mac_addr,
8405cf5ead82SJohannes Berg 			    struct station_info *sinfo, gfp_t gfp);
8406cf5ead82SJohannes Berg 
8407cf5ead82SJohannes Berg /**
8408ec15e68bSJouni Malinen  * cfg80211_del_sta - notify userspace about deletion of a station
8409ec15e68bSJouni Malinen  *
8410ec15e68bSJouni Malinen  * @dev: the netdev
8411bfc55167SVeerendranath Jakkam  * @mac_addr: the station's address. For MLD station, MLD address is used.
8412ec15e68bSJouni Malinen  * @gfp: allocation flags
8413ec15e68bSJouni Malinen  */
cfg80211_del_sta(struct net_device * dev,const u8 * mac_addr,gfp_t gfp)8414cf5ead82SJohannes Berg static inline void cfg80211_del_sta(struct net_device *dev,
8415cf5ead82SJohannes Berg 				    const u8 *mac_addr, gfp_t gfp)
8416cf5ead82SJohannes Berg {
8417cf5ead82SJohannes Berg 	cfg80211_del_sta_sinfo(dev, mac_addr, NULL, gfp);
8418cf5ead82SJohannes Berg }
8419ec15e68bSJouni Malinen 
8420ec15e68bSJouni Malinen /**
8421ed44a951SPandiyarajan Pitchaimuthu  * cfg80211_conn_failed - connection request failed notification
8422ed44a951SPandiyarajan Pitchaimuthu  *
8423ed44a951SPandiyarajan Pitchaimuthu  * @dev: the netdev
8424ed44a951SPandiyarajan Pitchaimuthu  * @mac_addr: the station's address
8425ed44a951SPandiyarajan Pitchaimuthu  * @reason: the reason for connection failure
8426ed44a951SPandiyarajan Pitchaimuthu  * @gfp: allocation flags
8427ed44a951SPandiyarajan Pitchaimuthu  *
8428ed44a951SPandiyarajan Pitchaimuthu  * Whenever a station tries to connect to an AP and if the station
8429ed44a951SPandiyarajan Pitchaimuthu  * could not connect to the AP as the AP has rejected the connection
8430ed44a951SPandiyarajan Pitchaimuthu  * for some reasons, this function is called.
8431ed44a951SPandiyarajan Pitchaimuthu  *
8432ed44a951SPandiyarajan Pitchaimuthu  * The reason for connection failure can be any of the value from
8433ed44a951SPandiyarajan Pitchaimuthu  * nl80211_connect_failed_reason enum
8434ed44a951SPandiyarajan Pitchaimuthu  */
8435ed44a951SPandiyarajan Pitchaimuthu void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr,
8436ed44a951SPandiyarajan Pitchaimuthu 			  enum nl80211_connect_failed_reason reason,
8437ed44a951SPandiyarajan Pitchaimuthu 			  gfp_t gfp);
8438ed44a951SPandiyarajan Pitchaimuthu 
8439ed44a951SPandiyarajan Pitchaimuthu /**
844000b3d840SAvraham Stern  * struct cfg80211_rx_info - received management frame info
844100b3d840SAvraham Stern  *
844200b3d840SAvraham Stern  * @freq: Frequency on which the frame was received in kHz
844300b3d840SAvraham Stern  * @sig_dbm: signal strength in dBm, or 0 if unknown
84446074c9e5SJohannes Berg  * @have_link_id: indicates the frame was received on a link of
84456074c9e5SJohannes Berg  *	an MLD, i.e. the @link_id field is valid
84466074c9e5SJohannes Berg  * @link_id: the ID of the link the frame was received	on
844700b3d840SAvraham Stern  * @buf: Management frame (header + body)
844800b3d840SAvraham Stern  * @len: length of the frame data
84491dcf396bSDmitry Antipov  * @flags: flags, as defined in &enum nl80211_rxmgmt_flags
84501ff715ffSAvraham Stern  * @rx_tstamp: Hardware timestamp of frame RX in nanoseconds
84511ff715ffSAvraham Stern  * @ack_tstamp: Hardware timestamp of ack TX in nanoseconds
845200b3d840SAvraham Stern  */
845300b3d840SAvraham Stern struct cfg80211_rx_info {
845400b3d840SAvraham Stern 	int freq;
845500b3d840SAvraham Stern 	int sig_dbm;
84566074c9e5SJohannes Berg 	bool have_link_id;
84576074c9e5SJohannes Berg 	u8 link_id;
845800b3d840SAvraham Stern 	const u8 *buf;
845900b3d840SAvraham Stern 	size_t len;
846000b3d840SAvraham Stern 	u32 flags;
84611ff715ffSAvraham Stern 	u64 rx_tstamp;
84621ff715ffSAvraham Stern 	u64 ack_tstamp;
846300b3d840SAvraham Stern };
846400b3d840SAvraham Stern 
846500b3d840SAvraham Stern /**
846600b3d840SAvraham Stern  * cfg80211_rx_mgmt_ext - management frame notification with extended info
846700b3d840SAvraham Stern  * @wdev: wireless device receiving the frame
846800b3d840SAvraham Stern  * @info: RX info as defined in struct cfg80211_rx_info
846900b3d840SAvraham Stern  *
847000b3d840SAvraham Stern  * This function is called whenever an Action frame is received for a station
847100b3d840SAvraham Stern  * mode interface, but is not processed in kernel.
847200b3d840SAvraham Stern  *
847300b3d840SAvraham Stern  * Return: %true if a user space application has registered for this frame.
847400b3d840SAvraham Stern  * For action frames, that makes it responsible for rejecting unrecognized
847500b3d840SAvraham Stern  * action frames; %false otherwise, in which case for action frames the
847600b3d840SAvraham Stern  * driver is responsible for rejecting the frame.
847700b3d840SAvraham Stern  */
847800b3d840SAvraham Stern bool cfg80211_rx_mgmt_ext(struct wireless_dev *wdev,
847900b3d840SAvraham Stern 			  struct cfg80211_rx_info *info);
848000b3d840SAvraham Stern 
848100b3d840SAvraham Stern /**
8482e76fede8SThomas Pedersen  * cfg80211_rx_mgmt_khz - notification of received, unprocessed management frame
8483e76fede8SThomas Pedersen  * @wdev: wireless device receiving the frame
8484e76fede8SThomas Pedersen  * @freq: Frequency on which the frame was received in KHz
8485e76fede8SThomas Pedersen  * @sig_dbm: signal strength in dBm, or 0 if unknown
8486e76fede8SThomas Pedersen  * @buf: Management frame (header + body)
8487e76fede8SThomas Pedersen  * @len: length of the frame data
8488e76fede8SThomas Pedersen  * @flags: flags, as defined in enum nl80211_rxmgmt_flags
8489e76fede8SThomas Pedersen  *
8490e76fede8SThomas Pedersen  * This function is called whenever an Action frame is received for a station
8491e76fede8SThomas Pedersen  * mode interface, but is not processed in kernel.
8492e76fede8SThomas Pedersen  *
8493e76fede8SThomas Pedersen  * Return: %true if a user space application has registered for this frame.
8494e76fede8SThomas Pedersen  * For action frames, that makes it responsible for rejecting unrecognized
8495e76fede8SThomas Pedersen  * action frames; %false otherwise, in which case for action frames the
8496e76fede8SThomas Pedersen  * driver is responsible for rejecting the frame.
8497e76fede8SThomas Pedersen  */
cfg80211_rx_mgmt_khz(struct wireless_dev * wdev,int freq,int sig_dbm,const u8 * buf,size_t len,u32 flags)849800b3d840SAvraham Stern static inline bool cfg80211_rx_mgmt_khz(struct wireless_dev *wdev, int freq,
849900b3d840SAvraham Stern 					int sig_dbm, const u8 *buf, size_t len,
850000b3d840SAvraham Stern 					u32 flags)
850100b3d840SAvraham Stern {
850200b3d840SAvraham Stern 	struct cfg80211_rx_info info = {
850300b3d840SAvraham Stern 		.freq = freq,
850400b3d840SAvraham Stern 		.sig_dbm = sig_dbm,
850500b3d840SAvraham Stern 		.buf = buf,
850600b3d840SAvraham Stern 		.len = len,
850700b3d840SAvraham Stern 		.flags = flags
850800b3d840SAvraham Stern 	};
850900b3d840SAvraham Stern 
851000b3d840SAvraham Stern 	return cfg80211_rx_mgmt_ext(wdev, &info);
851100b3d840SAvraham Stern }
8512e76fede8SThomas Pedersen 
8513e76fede8SThomas Pedersen /**
85142e161f78SJohannes Berg  * cfg80211_rx_mgmt - notification of received, unprocessed management frame
851571bbc994SJohannes Berg  * @wdev: wireless device receiving the frame
8516026331c4SJouni Malinen  * @freq: Frequency on which the frame was received in MHz
85176c2fb1e6SSergey Matyukevich  * @sig_dbm: signal strength in dBm, or 0 if unknown
85182e161f78SJohannes Berg  * @buf: Management frame (header + body)
8519026331c4SJouni Malinen  * @len: length of the frame data
852019504cf5SVladimir Kondratiev  * @flags: flags, as defined in enum nl80211_rxmgmt_flags
85212e161f78SJohannes Berg  *
85220ae997dcSYacine Belkadi  * This function is called whenever an Action frame is received for a station
85230ae997dcSYacine Belkadi  * mode interface, but is not processed in kernel.
85240ae997dcSYacine Belkadi  *
85250ae997dcSYacine Belkadi  * Return: %true if a user space application has registered for this frame.
85262e161f78SJohannes Berg  * For action frames, that makes it responsible for rejecting unrecognized
85272e161f78SJohannes Berg  * action frames; %false otherwise, in which case for action frames the
85282e161f78SJohannes Berg  * driver is responsible for rejecting the frame.
8529026331c4SJouni Malinen  */
cfg80211_rx_mgmt(struct wireless_dev * wdev,int freq,int sig_dbm,const u8 * buf,size_t len,u32 flags)8530e76fede8SThomas Pedersen static inline bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq,
8531e76fede8SThomas Pedersen 				    int sig_dbm, const u8 *buf, size_t len,
8532e76fede8SThomas Pedersen 				    u32 flags)
8533e76fede8SThomas Pedersen {
853400b3d840SAvraham Stern 	struct cfg80211_rx_info info = {
853500b3d840SAvraham Stern 		.freq = MHZ_TO_KHZ(freq),
853600b3d840SAvraham Stern 		.sig_dbm = sig_dbm,
853700b3d840SAvraham Stern 		.buf = buf,
853800b3d840SAvraham Stern 		.len = len,
853900b3d840SAvraham Stern 		.flags = flags
854000b3d840SAvraham Stern 	};
854100b3d840SAvraham Stern 
854200b3d840SAvraham Stern 	return cfg80211_rx_mgmt_ext(wdev, &info);
8543e76fede8SThomas Pedersen }
8544026331c4SJouni Malinen 
8545026331c4SJouni Malinen /**
8546ea7d50c9SAvraham Stern  * struct cfg80211_tx_status - TX status for management frame information
8547ea7d50c9SAvraham Stern  *
8548ea7d50c9SAvraham Stern  * @cookie: Cookie returned by cfg80211_ops::mgmt_tx()
8549ea7d50c9SAvraham Stern  * @tx_tstamp: hardware TX timestamp in nanoseconds
8550ea7d50c9SAvraham Stern  * @ack_tstamp: hardware ack RX timestamp in nanoseconds
8551ea7d50c9SAvraham Stern  * @buf: Management frame (header + body)
8552ea7d50c9SAvraham Stern  * @len: length of the frame data
8553ea7d50c9SAvraham Stern  * @ack: Whether frame was acknowledged
8554ea7d50c9SAvraham Stern  */
8555ea7d50c9SAvraham Stern struct cfg80211_tx_status {
8556ea7d50c9SAvraham Stern 	u64 cookie;
8557ea7d50c9SAvraham Stern 	u64 tx_tstamp;
8558ea7d50c9SAvraham Stern 	u64 ack_tstamp;
8559ea7d50c9SAvraham Stern 	const u8 *buf;
8560ea7d50c9SAvraham Stern 	size_t len;
8561ea7d50c9SAvraham Stern 	bool ack;
8562ea7d50c9SAvraham Stern };
8563ea7d50c9SAvraham Stern 
8564ea7d50c9SAvraham Stern /**
8565ea7d50c9SAvraham Stern  * cfg80211_mgmt_tx_status_ext - TX status notification with extended info
8566ea7d50c9SAvraham Stern  * @wdev: wireless device receiving the frame
8567ea7d50c9SAvraham Stern  * @status: TX status data
8568ea7d50c9SAvraham Stern  * @gfp: context flags
8569ea7d50c9SAvraham Stern  *
8570ea7d50c9SAvraham Stern  * This function is called whenever a management frame was requested to be
8571ea7d50c9SAvraham Stern  * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the
8572ea7d50c9SAvraham Stern  * transmission attempt with extended info.
8573ea7d50c9SAvraham Stern  */
8574ea7d50c9SAvraham Stern void cfg80211_mgmt_tx_status_ext(struct wireless_dev *wdev,
8575ea7d50c9SAvraham Stern 				 struct cfg80211_tx_status *status, gfp_t gfp);
8576ea7d50c9SAvraham Stern 
8577ea7d50c9SAvraham Stern /**
85782e161f78SJohannes Berg  * cfg80211_mgmt_tx_status - notification of TX status for management frame
857971bbc994SJohannes Berg  * @wdev: wireless device receiving the frame
85802e161f78SJohannes Berg  * @cookie: Cookie returned by cfg80211_ops::mgmt_tx()
85812e161f78SJohannes Berg  * @buf: Management frame (header + body)
8582026331c4SJouni Malinen  * @len: length of the frame data
8583026331c4SJouni Malinen  * @ack: Whether frame was acknowledged
8584026331c4SJouni Malinen  * @gfp: context flags
8585026331c4SJouni Malinen  *
85862e161f78SJohannes Berg  * This function is called whenever a management frame was requested to be
85872e161f78SJohannes Berg  * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the
8588026331c4SJouni Malinen  * transmission attempt.
8589026331c4SJouni Malinen  */
cfg80211_mgmt_tx_status(struct wireless_dev * wdev,u64 cookie,const u8 * buf,size_t len,bool ack,gfp_t gfp)8590ea7d50c9SAvraham Stern static inline void cfg80211_mgmt_tx_status(struct wireless_dev *wdev,
8591ea7d50c9SAvraham Stern 					   u64 cookie, const u8 *buf,
8592ea7d50c9SAvraham Stern 					   size_t len, bool ack, gfp_t gfp)
8593ea7d50c9SAvraham Stern {
8594ea7d50c9SAvraham Stern 	struct cfg80211_tx_status status = {
8595ea7d50c9SAvraham Stern 		.cookie = cookie,
8596ea7d50c9SAvraham Stern 		.buf = buf,
8597ea7d50c9SAvraham Stern 		.len = len,
8598ea7d50c9SAvraham Stern 		.ack = ack
8599ea7d50c9SAvraham Stern 	};
8600ea7d50c9SAvraham Stern 
8601ea7d50c9SAvraham Stern 	cfg80211_mgmt_tx_status_ext(wdev, &status, gfp);
8602ea7d50c9SAvraham Stern }
8603026331c4SJouni Malinen 
8604dca9ca2dSMarkus Theil /**
8605dca9ca2dSMarkus Theil  * cfg80211_control_port_tx_status - notification of TX status for control
8606dca9ca2dSMarkus Theil  *                                   port frames
8607dca9ca2dSMarkus Theil  * @wdev: wireless device receiving the frame
8608dca9ca2dSMarkus Theil  * @cookie: Cookie returned by cfg80211_ops::tx_control_port()
8609dca9ca2dSMarkus Theil  * @buf: Data frame (header + body)
8610dca9ca2dSMarkus Theil  * @len: length of the frame data
8611dca9ca2dSMarkus Theil  * @ack: Whether frame was acknowledged
8612dca9ca2dSMarkus Theil  * @gfp: context flags
8613dca9ca2dSMarkus Theil  *
8614dca9ca2dSMarkus Theil  * This function is called whenever a control port frame was requested to be
8615dca9ca2dSMarkus Theil  * transmitted with cfg80211_ops::tx_control_port() to report the TX status of
8616dca9ca2dSMarkus Theil  * the transmission attempt.
8617dca9ca2dSMarkus Theil  */
8618dca9ca2dSMarkus Theil void cfg80211_control_port_tx_status(struct wireless_dev *wdev, u64 cookie,
8619dca9ca2dSMarkus Theil 				     const u8 *buf, size_t len, bool ack,
8620dca9ca2dSMarkus Theil 				     gfp_t gfp);
8621d6dc1a38SJuuso Oikarinen 
8622d6dc1a38SJuuso Oikarinen /**
86236a671a50SDenis Kenzior  * cfg80211_rx_control_port - notification about a received control port frame
86246a671a50SDenis Kenzior  * @dev: The device the frame matched to
8625a948f713SDenis Kenzior  * @skb: The skbuf with the control port frame.  It is assumed that the skbuf
8626a948f713SDenis Kenzior  *	is 802.3 formatted (with 802.3 header).  The skb can be non-linear.
8627a948f713SDenis Kenzior  *	This function does not take ownership of the skb, so the caller is
8628a948f713SDenis Kenzior  *	responsible for any cleanup.  The caller must also ensure that
8629a948f713SDenis Kenzior  *	skb->protocol is set appropriately.
86306a671a50SDenis Kenzior  * @unencrypted: Whether the frame was received unencrypted
86314c532321SJohannes Berg  * @link_id: the link the frame was received on, -1 if not applicable or unknown
86326a671a50SDenis Kenzior  *
86336a671a50SDenis Kenzior  * This function is used to inform userspace about a received control port
86346a671a50SDenis Kenzior  * frame.  It should only be used if userspace indicated it wants to receive
86356a671a50SDenis Kenzior  * control port frames over nl80211.
86366a671a50SDenis Kenzior  *
86376a671a50SDenis Kenzior  * The frame is the data portion of the 802.3 or 802.11 data frame with all
86386a671a50SDenis Kenzior  * network layer headers removed (e.g. the raw EAPoL frame).
86396a671a50SDenis Kenzior  *
86406a671a50SDenis Kenzior  * Return: %true if the frame was passed to userspace
86416a671a50SDenis Kenzior  */
86424c532321SJohannes Berg bool cfg80211_rx_control_port(struct net_device *dev, struct sk_buff *skb,
86434c532321SJohannes Berg 			      bool unencrypted, int link_id);
86446a671a50SDenis Kenzior 
86456a671a50SDenis Kenzior /**
8646d6dc1a38SJuuso Oikarinen  * cfg80211_cqm_rssi_notify - connection quality monitoring rssi event
8647d6dc1a38SJuuso Oikarinen  * @dev: network device
8648d6dc1a38SJuuso Oikarinen  * @rssi_event: the triggered RSSI event
8649bee427b8SAndrzej Zaborowski  * @rssi_level: new RSSI level value or 0 if not available
8650d6dc1a38SJuuso Oikarinen  * @gfp: context flags
8651d6dc1a38SJuuso Oikarinen  *
8652d6dc1a38SJuuso Oikarinen  * This function is called when a configured connection quality monitoring
8653d6dc1a38SJuuso Oikarinen  * rssi threshold reached event occurs.
8654d6dc1a38SJuuso Oikarinen  */
8655d6dc1a38SJuuso Oikarinen void cfg80211_cqm_rssi_notify(struct net_device *dev,
8656d6dc1a38SJuuso Oikarinen 			      enum nl80211_cqm_rssi_threshold_event rssi_event,
8657bee427b8SAndrzej Zaborowski 			      s32 rssi_level, gfp_t gfp);
8658d6dc1a38SJuuso Oikarinen 
8659c063dbf5SJohannes Berg /**
8660c063dbf5SJohannes Berg  * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer
8661c063dbf5SJohannes Berg  * @dev: network device
8662c063dbf5SJohannes Berg  * @peer: peer's MAC address
8663c063dbf5SJohannes Berg  * @num_packets: how many packets were lost -- should be a fixed threshold
8664c063dbf5SJohannes Berg  *	but probably no less than maybe 50, or maybe a throughput dependent
8665c063dbf5SJohannes Berg  *	threshold (to account for temporary interference)
8666c063dbf5SJohannes Berg  * @gfp: context flags
8667c063dbf5SJohannes Berg  */
8668c063dbf5SJohannes Berg void cfg80211_cqm_pktloss_notify(struct net_device *dev,
8669c063dbf5SJohannes Berg 				 const u8 *peer, u32 num_packets, gfp_t gfp);
8670c063dbf5SJohannes Berg 
8671e5497d76SJohannes Berg /**
867284f10708SThomas Pedersen  * cfg80211_cqm_txe_notify - TX error rate event
867384f10708SThomas Pedersen  * @dev: network device
867484f10708SThomas Pedersen  * @peer: peer's MAC address
867584f10708SThomas Pedersen  * @num_packets: how many packets were lost
867684f10708SThomas Pedersen  * @rate: % of packets which failed transmission
867784f10708SThomas Pedersen  * @intvl: interval (in s) over which the TX failure threshold was breached.
867884f10708SThomas Pedersen  * @gfp: context flags
867984f10708SThomas Pedersen  *
868084f10708SThomas Pedersen  * Notify userspace when configured % TX failures over number of packets in a
868184f10708SThomas Pedersen  * given interval is exceeded.
868284f10708SThomas Pedersen  */
868384f10708SThomas Pedersen void cfg80211_cqm_txe_notify(struct net_device *dev, const u8 *peer,
868484f10708SThomas Pedersen 			     u32 num_packets, u32 rate, u32 intvl, gfp_t gfp);
868584f10708SThomas Pedersen 
868684f10708SThomas Pedersen /**
868798f03342SJohannes Berg  * cfg80211_cqm_beacon_loss_notify - beacon loss event
868898f03342SJohannes Berg  * @dev: network device
868998f03342SJohannes Berg  * @gfp: context flags
869098f03342SJohannes Berg  *
869198f03342SJohannes Berg  * Notify userspace about beacon loss from the connected AP.
869298f03342SJohannes Berg  */
869398f03342SJohannes Berg void cfg80211_cqm_beacon_loss_notify(struct net_device *dev, gfp_t gfp);
869498f03342SJohannes Berg 
869598f03342SJohannes Berg /**
8696c47240cbSLorenzo Bianconi  * __cfg80211_radar_event - radar detection event
86975b97f49dSJohannes Berg  * @wiphy: the wiphy
86985b97f49dSJohannes Berg  * @chandef: chandef for the current channel
8699c47240cbSLorenzo Bianconi  * @offchan: the radar has been detected on the offchannel chain
87005b97f49dSJohannes Berg  * @gfp: context flags
87015b97f49dSJohannes Berg  *
87025b97f49dSJohannes Berg  * This function is called when a radar is detected on the current chanenl.
87035b97f49dSJohannes Berg  */
8704c47240cbSLorenzo Bianconi void __cfg80211_radar_event(struct wiphy *wiphy,
8705c47240cbSLorenzo Bianconi 			    struct cfg80211_chan_def *chandef,
8706c47240cbSLorenzo Bianconi 			    bool offchan, gfp_t gfp);
8707c47240cbSLorenzo Bianconi 
8708c47240cbSLorenzo Bianconi static inline void
cfg80211_radar_event(struct wiphy * wiphy,struct cfg80211_chan_def * chandef,gfp_t gfp)8709c47240cbSLorenzo Bianconi cfg80211_radar_event(struct wiphy *wiphy,
8710c47240cbSLorenzo Bianconi 		     struct cfg80211_chan_def *chandef,
8711c47240cbSLorenzo Bianconi 		     gfp_t gfp)
8712c47240cbSLorenzo Bianconi {
8713c47240cbSLorenzo Bianconi 	__cfg80211_radar_event(wiphy, chandef, false, gfp);
8714c47240cbSLorenzo Bianconi }
8715c47240cbSLorenzo Bianconi 
8716c47240cbSLorenzo Bianconi static inline void
cfg80211_background_radar_event(struct wiphy * wiphy,struct cfg80211_chan_def * chandef,gfp_t gfp)8717a95bfb87SLorenzo Bianconi cfg80211_background_radar_event(struct wiphy *wiphy,
8718c47240cbSLorenzo Bianconi 				struct cfg80211_chan_def *chandef,
8719c47240cbSLorenzo Bianconi 				gfp_t gfp)
8720c47240cbSLorenzo Bianconi {
8721c47240cbSLorenzo Bianconi 	__cfg80211_radar_event(wiphy, chandef, true, gfp);
8722c47240cbSLorenzo Bianconi }
87235b97f49dSJohannes Berg 
87245b97f49dSJohannes Berg /**
8725466b9936Stamizhr@codeaurora.org  * cfg80211_sta_opmode_change_notify - STA's ht/vht operation mode change event
8726466b9936Stamizhr@codeaurora.org  * @dev: network device
8727466b9936Stamizhr@codeaurora.org  * @mac: MAC address of a station which opmode got modified
8728466b9936Stamizhr@codeaurora.org  * @sta_opmode: station's current opmode value
8729466b9936Stamizhr@codeaurora.org  * @gfp: context flags
8730466b9936Stamizhr@codeaurora.org  *
8731466b9936Stamizhr@codeaurora.org  * Driver should call this function when station's opmode modified via action
8732466b9936Stamizhr@codeaurora.org  * frame.
8733466b9936Stamizhr@codeaurora.org  */
8734466b9936Stamizhr@codeaurora.org void cfg80211_sta_opmode_change_notify(struct net_device *dev, const u8 *mac,
8735466b9936Stamizhr@codeaurora.org 				       struct sta_opmode_info *sta_opmode,
8736466b9936Stamizhr@codeaurora.org 				       gfp_t gfp);
8737466b9936Stamizhr@codeaurora.org 
8738466b9936Stamizhr@codeaurora.org /**
87395b97f49dSJohannes Berg  * cfg80211_cac_event - Channel availability check (CAC) event
87405b97f49dSJohannes Berg  * @netdev: network device
87415b97f49dSJohannes Berg  * @chandef: chandef for the current channel
87425b97f49dSJohannes Berg  * @event: type of event
87435b97f49dSJohannes Berg  * @gfp: context flags
874481f67d60SAditya Kumar Singh  * @link_id: valid link_id for MLO operation or 0 otherwise.
87455b97f49dSJohannes Berg  *
87465b97f49dSJohannes Berg  * This function is called when a Channel availability check (CAC) is finished
87475b97f49dSJohannes Berg  * or aborted. This must be called to notify the completion of a CAC process,
87485b97f49dSJohannes Berg  * also by full-MAC drivers.
87495b97f49dSJohannes Berg  */
87505b97f49dSJohannes Berg void cfg80211_cac_event(struct net_device *netdev,
87515b97f49dSJohannes Berg 			const struct cfg80211_chan_def *chandef,
875281f67d60SAditya Kumar Singh 			enum nl80211_radar_event event, gfp_t gfp,
875381f67d60SAditya Kumar Singh 			unsigned int link_id);
87545b97f49dSJohannes Berg 
8755bc2dfc02SLorenzo Bianconi /**
8756a95bfb87SLorenzo Bianconi  * cfg80211_background_cac_abort - Channel Availability Check offchan abort event
8757bc2dfc02SLorenzo Bianconi  * @wiphy: the wiphy
8758bc2dfc02SLorenzo Bianconi  *
87591507b153SLorenzo Bianconi  * This function is called by the driver when a Channel Availability Check
87601507b153SLorenzo Bianconi  * (CAC) is aborted by a offchannel dedicated chain.
8761bc2dfc02SLorenzo Bianconi  */
8762a95bfb87SLorenzo Bianconi void cfg80211_background_cac_abort(struct wiphy *wiphy);
87635b97f49dSJohannes Berg 
87645b97f49dSJohannes Berg /**
8765e5497d76SJohannes Berg  * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying
8766e5497d76SJohannes Berg  * @dev: network device
8767e5497d76SJohannes Berg  * @bssid: BSSID of AP (to avoid races)
8768e5497d76SJohannes Berg  * @replay_ctr: new replay counter
8769af71ff85SJohannes Berg  * @gfp: allocation flags
8770e5497d76SJohannes Berg  */
8771e5497d76SJohannes Berg void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid,
8772e5497d76SJohannes Berg 			       const u8 *replay_ctr, gfp_t gfp);
8773e5497d76SJohannes Berg 
8774c9df56b4SJouni Malinen /**
8775c9df56b4SJouni Malinen  * cfg80211_pmksa_candidate_notify - notify about PMKSA caching candidate
8776c9df56b4SJouni Malinen  * @dev: network device
8777c9df56b4SJouni Malinen  * @index: candidate index (the smaller the index, the higher the priority)
8778c9df56b4SJouni Malinen  * @bssid: BSSID of AP
8779c9df56b4SJouni Malinen  * @preauth: Whether AP advertises support for RSN pre-authentication
8780c9df56b4SJouni Malinen  * @gfp: allocation flags
8781c9df56b4SJouni Malinen  */
8782c9df56b4SJouni Malinen void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index,
8783c9df56b4SJouni Malinen 				     const u8 *bssid, bool preauth, gfp_t gfp);
8784c9df56b4SJouni Malinen 
878528946da7SJohannes Berg /**
878628946da7SJohannes Berg  * cfg80211_rx_spurious_frame - inform userspace about a spurious frame
878728946da7SJohannes Berg  * @dev: The device the frame matched to
878828946da7SJohannes Berg  * @addr: the transmitter address
878928946da7SJohannes Berg  * @gfp: context flags
879028946da7SJohannes Berg  *
879128946da7SJohannes Berg  * This function is used in AP mode (only!) to inform userspace that
879228946da7SJohannes Berg  * a spurious class 3 frame was received, to be able to deauth the
879328946da7SJohannes Berg  * sender.
87940ae997dcSYacine Belkadi  * Return: %true if the frame was passed to userspace (or this failed
879528946da7SJohannes Berg  * for a reason other than not having a subscription.)
879628946da7SJohannes Berg  */
879728946da7SJohannes Berg bool cfg80211_rx_spurious_frame(struct net_device *dev,
879828946da7SJohannes Berg 				const u8 *addr, gfp_t gfp);
879928946da7SJohannes Berg 
88007f6cf311SJohannes Berg /**
8801b92ab5d8SJohannes Berg  * cfg80211_rx_unexpected_4addr_frame - inform about unexpected WDS frame
8802b92ab5d8SJohannes Berg  * @dev: The device the frame matched to
8803b92ab5d8SJohannes Berg  * @addr: the transmitter address
8804b92ab5d8SJohannes Berg  * @gfp: context flags
8805b92ab5d8SJohannes Berg  *
8806b92ab5d8SJohannes Berg  * This function is used in AP mode (only!) to inform userspace that
8807b92ab5d8SJohannes Berg  * an associated station sent a 4addr frame but that wasn't expected.
8808b92ab5d8SJohannes Berg  * It is allowed and desirable to send this event only once for each
8809b92ab5d8SJohannes Berg  * station to avoid event flooding.
88100ae997dcSYacine Belkadi  * Return: %true if the frame was passed to userspace (or this failed
8811b92ab5d8SJohannes Berg  * for a reason other than not having a subscription.)
8812b92ab5d8SJohannes Berg  */
8813b92ab5d8SJohannes Berg bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev,
8814b92ab5d8SJohannes Berg 					const u8 *addr, gfp_t gfp);
8815b92ab5d8SJohannes Berg 
8816b92ab5d8SJohannes Berg /**
88177f6cf311SJohannes Berg  * cfg80211_probe_status - notify userspace about probe status
88187f6cf311SJohannes Berg  * @dev: the device the probe was sent on
88197f6cf311SJohannes Berg  * @addr: the address of the peer
88207f6cf311SJohannes Berg  * @cookie: the cookie filled in @probe_client previously
88217f6cf311SJohannes Berg  * @acked: indicates whether probe was acked or not
8822c4b50cd3SVenkateswara Naralasetty  * @ack_signal: signal strength (in dBm) of the ACK frame.
8823c4b50cd3SVenkateswara Naralasetty  * @is_valid_ack_signal: indicates the ack_signal is valid or not.
88247f6cf311SJohannes Berg  * @gfp: allocation flags
88257f6cf311SJohannes Berg  */
88267f6cf311SJohannes Berg void cfg80211_probe_status(struct net_device *dev, const u8 *addr,
8827c4b50cd3SVenkateswara Naralasetty 			   u64 cookie, bool acked, s32 ack_signal,
8828c4b50cd3SVenkateswara Naralasetty 			   bool is_valid_ack_signal, gfp_t gfp);
88297f6cf311SJohannes Berg 
88305e760230SJohannes Berg /**
8831e76fede8SThomas Pedersen  * cfg80211_report_obss_beacon_khz - report beacon from other APs
8832e76fede8SThomas Pedersen  * @wiphy: The wiphy that received the beacon
8833e76fede8SThomas Pedersen  * @frame: the frame
8834e76fede8SThomas Pedersen  * @len: length of the frame
8835e76fede8SThomas Pedersen  * @freq: frequency the frame was received on in KHz
8836e76fede8SThomas Pedersen  * @sig_dbm: signal strength in dBm, or 0 if unknown
8837e76fede8SThomas Pedersen  *
8838e76fede8SThomas Pedersen  * Use this function to report to userspace when a beacon was
8839e76fede8SThomas Pedersen  * received. It is not useful to call this when there is no
8840e76fede8SThomas Pedersen  * netdev that is in AP/GO mode.
8841e76fede8SThomas Pedersen  */
8842e76fede8SThomas Pedersen void cfg80211_report_obss_beacon_khz(struct wiphy *wiphy, const u8 *frame,
8843e76fede8SThomas Pedersen 				     size_t len, int freq, int sig_dbm);
8844e76fede8SThomas Pedersen 
8845e76fede8SThomas Pedersen /**
88465e760230SJohannes Berg  * cfg80211_report_obss_beacon - report beacon from other APs
88475e760230SJohannes Berg  * @wiphy: The wiphy that received the beacon
88485e760230SJohannes Berg  * @frame: the frame
88495e760230SJohannes Berg  * @len: length of the frame
88505e760230SJohannes Berg  * @freq: frequency the frame was received on
88516c2fb1e6SSergey Matyukevich  * @sig_dbm: signal strength in dBm, or 0 if unknown
88525e760230SJohannes Berg  *
88535e760230SJohannes Berg  * Use this function to report to userspace when a beacon was
88545e760230SJohannes Berg  * received. It is not useful to call this when there is no
88555e760230SJohannes Berg  * netdev that is in AP/GO mode.
88565e760230SJohannes Berg  */
cfg80211_report_obss_beacon(struct wiphy * wiphy,const u8 * frame,size_t len,int freq,int sig_dbm)8857e76fede8SThomas Pedersen static inline void cfg80211_report_obss_beacon(struct wiphy *wiphy,
88585e760230SJohannes Berg 					       const u8 *frame, size_t len,
8859e76fede8SThomas Pedersen 					       int freq, int sig_dbm)
8860e76fede8SThomas Pedersen {
8861e76fede8SThomas Pedersen 	cfg80211_report_obss_beacon_khz(wiphy, frame, len, MHZ_TO_KHZ(freq),
8862e76fede8SThomas Pedersen 					sig_dbm);
8863e76fede8SThomas Pedersen }
88645e760230SJohannes Berg 
8865d58e7e37SJohannes Berg /**
88669fd171a7SJohannes Berg  * struct cfg80211_beaconing_check_config - beacon check configuration
88679fd171a7SJohannes Berg  * @iftype: the interface type to check for
88689fd171a7SJohannes Berg  * @relax: allow IR-relaxation conditions to apply (e.g. another
88699fd171a7SJohannes Berg  *	interface connected already on the same channel)
88709fd171a7SJohannes Berg  *	NOTE: If this is set, wiphy mutex must be held.
8871c1d8bd8dSJohannes Berg  * @reg_power: &enum ieee80211_ap_reg_power value indicating the
8872c1d8bd8dSJohannes Berg  *	advertised/used 6 GHz regulatory power setting
88739fd171a7SJohannes Berg  */
88749fd171a7SJohannes Berg struct cfg80211_beaconing_check_config {
88759fd171a7SJohannes Berg 	enum nl80211_iftype iftype;
8876c1d8bd8dSJohannes Berg 	enum ieee80211_ap_reg_power reg_power;
88779fd171a7SJohannes Berg 	bool relax;
88789fd171a7SJohannes Berg };
88799fd171a7SJohannes Berg 
88809fd171a7SJohannes Berg /**
88819fd171a7SJohannes Berg  * cfg80211_reg_check_beaconing - check if beaconing is allowed
88829fd171a7SJohannes Berg  * @wiphy: the wiphy
88839fd171a7SJohannes Berg  * @chandef: the channel definition
88849fd171a7SJohannes Berg  * @cfg: additional parameters for the checking
88859fd171a7SJohannes Berg  *
88869fd171a7SJohannes Berg  * Return: %true if there is no secondary channel or the secondary channel(s)
88879fd171a7SJohannes Berg  * can be used for beaconing (i.e. is not a radar channel etc.)
88889fd171a7SJohannes Berg  */
88899fd171a7SJohannes Berg bool cfg80211_reg_check_beaconing(struct wiphy *wiphy,
88909fd171a7SJohannes Berg 				  struct cfg80211_chan_def *chandef,
88919fd171a7SJohannes Berg 				  struct cfg80211_beaconing_check_config *cfg);
88929fd171a7SJohannes Berg 
88939fd171a7SJohannes Berg /**
8894683b6d3bSJohannes Berg  * cfg80211_reg_can_beacon - check if beaconing is allowed
889554858ee5SAlexander Simon  * @wiphy: the wiphy
8896683b6d3bSJohannes Berg  * @chandef: the channel definition
8897174e0cd2SIlan Peer  * @iftype: interface type
8898d58e7e37SJohannes Berg  *
88990ae997dcSYacine Belkadi  * Return: %true if there is no secondary channel or the secondary channel(s)
89000ae997dcSYacine Belkadi  * can be used for beaconing (i.e. is not a radar channel etc.)
890154858ee5SAlexander Simon  */
89029fd171a7SJohannes Berg static inline bool
cfg80211_reg_can_beacon(struct wiphy * wiphy,struct cfg80211_chan_def * chandef,enum nl80211_iftype iftype)89039fd171a7SJohannes Berg cfg80211_reg_can_beacon(struct wiphy *wiphy,
8904174e0cd2SIlan Peer 			struct cfg80211_chan_def *chandef,
89059fd171a7SJohannes Berg 			enum nl80211_iftype iftype)
89069fd171a7SJohannes Berg {
89079fd171a7SJohannes Berg 	struct cfg80211_beaconing_check_config config = {
89089fd171a7SJohannes Berg 		.iftype = iftype,
89099fd171a7SJohannes Berg 	};
89109fd171a7SJohannes Berg 
89119fd171a7SJohannes Berg 	return cfg80211_reg_check_beaconing(wiphy, chandef, &config);
89129fd171a7SJohannes Berg }
891354858ee5SAlexander Simon 
8914923b352fSArik Nemtsov /**
8915923b352fSArik Nemtsov  * cfg80211_reg_can_beacon_relax - check if beaconing is allowed with relaxation
8916923b352fSArik Nemtsov  * @wiphy: the wiphy
8917923b352fSArik Nemtsov  * @chandef: the channel definition
8918923b352fSArik Nemtsov  * @iftype: interface type
8919923b352fSArik Nemtsov  *
8920923b352fSArik Nemtsov  * Return: %true if there is no secondary channel or the secondary channel(s)
8921923b352fSArik Nemtsov  * can be used for beaconing (i.e. is not a radar channel etc.). This version
8922923b352fSArik Nemtsov  * also checks if IR-relaxation conditions apply, to allow beaconing under
8923923b352fSArik Nemtsov  * more permissive conditions.
8924923b352fSArik Nemtsov  *
892562cc206cSJeff Johnson  * Context: Requires the wiphy mutex to be held.
8926923b352fSArik Nemtsov  */
89279fd171a7SJohannes Berg static inline bool
cfg80211_reg_can_beacon_relax(struct wiphy * wiphy,struct cfg80211_chan_def * chandef,enum nl80211_iftype iftype)89289fd171a7SJohannes Berg cfg80211_reg_can_beacon_relax(struct wiphy *wiphy,
8929923b352fSArik Nemtsov 			      struct cfg80211_chan_def *chandef,
89309fd171a7SJohannes Berg 			      enum nl80211_iftype iftype)
89319fd171a7SJohannes Berg {
89329fd171a7SJohannes Berg 	struct cfg80211_beaconing_check_config config = {
89339fd171a7SJohannes Berg 		.iftype = iftype,
89349fd171a7SJohannes Berg 		.relax = true,
89359fd171a7SJohannes Berg 	};
89369fd171a7SJohannes Berg 
89379fd171a7SJohannes Berg 	return cfg80211_reg_check_beaconing(wiphy, chandef, &config);
89389fd171a7SJohannes Berg }
8939923b352fSArik Nemtsov 
894062cc206cSJeff Johnson /**
89415314526bSThomas Pedersen  * cfg80211_ch_switch_notify - update wdev channel and notify userspace
89425314526bSThomas Pedersen  * @dev: the device which switched channels
8943683b6d3bSJohannes Berg  * @chandef: the new channel definition
89447b0a0e3cSJohannes Berg  * @link_id: the link ID for MLO, must be 0 for non-MLO
89455314526bSThomas Pedersen  *
8946076fc877SJohannes Berg  * Caller must hold wiphy mutex, therefore must only be called from sleepable
8947e487eaebSSimon Wunderlich  * driver context!
89485314526bSThomas Pedersen  */
8949683b6d3bSJohannes Berg void cfg80211_ch_switch_notify(struct net_device *dev,
89507b0a0e3cSJohannes Berg 			       struct cfg80211_chan_def *chandef,
8951b82730bfSJohannes Berg 			       unsigned int link_id);
89525314526bSThomas Pedersen 
895362cc206cSJeff Johnson /**
8954f8d7552eSLuciano Coelho  * cfg80211_ch_switch_started_notify - notify channel switch start
8955f8d7552eSLuciano Coelho  * @dev: the device on which the channel switch started
8956f8d7552eSLuciano Coelho  * @chandef: the future channel definition
8957b8c9024eSVeerendranath Jakkam  * @link_id: the link ID for MLO, must be 0 for non-MLO
8958f8d7552eSLuciano Coelho  * @count: the number of TBTTs until the channel switch happens
8959669b8413SJohannes Berg  * @quiet: whether or not immediate quiet was requested by the AP
8960f8d7552eSLuciano Coelho  *
8961f8d7552eSLuciano Coelho  * Inform the userspace about the channel switch that has just
8962f8d7552eSLuciano Coelho  * started, so that it can take appropriate actions (eg. starting
8963f8d7552eSLuciano Coelho  * channel switch on other vifs), if necessary.
8964f8d7552eSLuciano Coelho  */
8965f8d7552eSLuciano Coelho void cfg80211_ch_switch_started_notify(struct net_device *dev,
8966f8d7552eSLuciano Coelho 				       struct cfg80211_chan_def *chandef,
8967b8c9024eSVeerendranath Jakkam 				       unsigned int link_id, u8 count,
8968b82730bfSJohannes Berg 				       bool quiet);
8969f8d7552eSLuciano Coelho 
89701ce3e82bSJohannes Berg /**
89711ce3e82bSJohannes Berg  * ieee80211_operating_class_to_band - convert operating class to band
89721ce3e82bSJohannes Berg  *
89731ce3e82bSJohannes Berg  * @operating_class: the operating class to convert
89741ce3e82bSJohannes Berg  * @band: band pointer to fill
89751ce3e82bSJohannes Berg  *
897662cc206cSJeff Johnson  * Return: %true if the conversion was successful, %false otherwise.
89771ce3e82bSJohannes Berg  */
89781ce3e82bSJohannes Berg bool ieee80211_operating_class_to_band(u8 operating_class,
897957fbcce3SJohannes Berg 				       enum nl80211_band *band);
89801ce3e82bSJohannes Berg 
8981a38700ddSArik Nemtsov /**
898268de1302SMichael-CY Lee  * ieee80211_operating_class_to_chandef - convert operating class to chandef
898368de1302SMichael-CY Lee  *
898468de1302SMichael-CY Lee  * @operating_class: the operating class to convert
898568de1302SMichael-CY Lee  * @chan: the ieee80211_channel to convert
898668de1302SMichael-CY Lee  * @chandef: a pointer to the resulting chandef
898768de1302SMichael-CY Lee  *
898862cc206cSJeff Johnson  * Return: %true if the conversion was successful, %false otherwise.
898968de1302SMichael-CY Lee  */
899068de1302SMichael-CY Lee bool ieee80211_operating_class_to_chandef(u8 operating_class,
899168de1302SMichael-CY Lee 					  struct ieee80211_channel *chan,
899268de1302SMichael-CY Lee 					  struct cfg80211_chan_def *chandef);
899368de1302SMichael-CY Lee 
899468de1302SMichael-CY Lee /**
8995a38700ddSArik Nemtsov  * ieee80211_chandef_to_operating_class - convert chandef to operation class
8996a38700ddSArik Nemtsov  *
8997a38700ddSArik Nemtsov  * @chandef: the chandef to convert
8998a38700ddSArik Nemtsov  * @op_class: a pointer to the resulting operating class
8999a38700ddSArik Nemtsov  *
900062cc206cSJeff Johnson  * Return: %true if the conversion was successful, %false otherwise.
9001a38700ddSArik Nemtsov  */
9002a38700ddSArik Nemtsov bool ieee80211_chandef_to_operating_class(struct cfg80211_chan_def *chandef,
9003a38700ddSArik Nemtsov 					  u8 *op_class);
9004a38700ddSArik Nemtsov 
9005934f4c7dSThomas Pedersen /**
9006934f4c7dSThomas Pedersen  * ieee80211_chandef_to_khz - convert chandef to frequency in KHz
9007934f4c7dSThomas Pedersen  *
9008934f4c7dSThomas Pedersen  * @chandef: the chandef to convert
9009934f4c7dSThomas Pedersen  *
901062cc206cSJeff Johnson  * Return: the center frequency of chandef (1st segment) in KHz.
9011934f4c7dSThomas Pedersen  */
9012934f4c7dSThomas Pedersen static inline u32
ieee80211_chandef_to_khz(const struct cfg80211_chan_def * chandef)9013934f4c7dSThomas Pedersen ieee80211_chandef_to_khz(const struct cfg80211_chan_def *chandef)
9014934f4c7dSThomas Pedersen {
9015934f4c7dSThomas Pedersen 	return MHZ_TO_KHZ(chandef->center_freq1) + chandef->freq1_offset;
9016934f4c7dSThomas Pedersen }
9017934f4c7dSThomas Pedersen 
901862cc206cSJeff Johnson /**
90193475b094SJouni Malinen  * cfg80211_tdls_oper_request - request userspace to perform TDLS operation
90203475b094SJouni Malinen  * @dev: the device on which the operation is requested
90213475b094SJouni Malinen  * @peer: the MAC address of the peer device
90223475b094SJouni Malinen  * @oper: the requested TDLS operation (NL80211_TDLS_SETUP or
90233475b094SJouni Malinen  *	NL80211_TDLS_TEARDOWN)
90243475b094SJouni Malinen  * @reason_code: the reason code for teardown request
90253475b094SJouni Malinen  * @gfp: allocation flags
90263475b094SJouni Malinen  *
90273475b094SJouni Malinen  * This function is used to request userspace to perform TDLS operation that
90283475b094SJouni Malinen  * requires knowledge of keys, i.e., link setup or teardown when the AP
90293475b094SJouni Malinen  * connection uses encryption. This is optional mechanism for the driver to use
90303475b094SJouni Malinen  * if it can automatically determine when a TDLS link could be useful (e.g.,
90313475b094SJouni Malinen  * based on traffic and signal strength for a peer).
90323475b094SJouni Malinen  */
90333475b094SJouni Malinen void cfg80211_tdls_oper_request(struct net_device *dev, const u8 *peer,
90343475b094SJouni Malinen 				enum nl80211_tdls_operation oper,
90353475b094SJouni Malinen 				u16 reason_code, gfp_t gfp);
90363475b094SJouni Malinen 
903762cc206cSJeff Johnson /**
90388097e149SThomas Pedersen  * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units)
90398097e149SThomas Pedersen  * @rate: given rate_info to calculate bitrate from
90408097e149SThomas Pedersen  *
904162cc206cSJeff Johnson  * Return: calculated bitrate
90428097e149SThomas Pedersen  */
90438eb41c8dSVladimir Kondratiev u32 cfg80211_calculate_bitrate(struct rate_info *rate);
90448097e149SThomas Pedersen 
904598104fdeSJohannes Berg /**
904698104fdeSJohannes Berg  * cfg80211_unregister_wdev - remove the given wdev
904798104fdeSJohannes Berg  * @wdev: struct wireless_dev to remove
904898104fdeSJohannes Berg  *
90492fe8ef10SJohannes Berg  * This function removes the device so it can no longer be used. It is necessary
90502fe8ef10SJohannes Berg  * to call this function even when cfg80211 requests the removal of the device
90512fe8ef10SJohannes Berg  * by calling the del_virtual_intf() callback. The function must also be called
90522fe8ef10SJohannes Berg  * when the driver wishes to unregister the wdev, e.g. when the hardware device
90532fe8ef10SJohannes Berg  * is unbound from the driver.
905498104fdeSJohannes Berg  *
905562cc206cSJeff Johnson  * Context: Requires the RTNL and wiphy mutex to be held.
905698104fdeSJohannes Berg  */
905798104fdeSJohannes Berg void cfg80211_unregister_wdev(struct wireless_dev *wdev);
905898104fdeSJohannes Berg 
90590ee45355SJohannes Berg /**
90602fe8ef10SJohannes Berg  * cfg80211_register_netdevice - register the given netdev
90612fe8ef10SJohannes Berg  * @dev: the netdev to register
90622fe8ef10SJohannes Berg  *
90632fe8ef10SJohannes Berg  * Note: In contexts coming from cfg80211 callbacks, you must call this rather
90642fe8ef10SJohannes Berg  * than register_netdevice(), unregister_netdev() is impossible as the RTNL is
90652fe8ef10SJohannes Berg  * held. Otherwise, both register_netdevice() and register_netdev() are usable
90662fe8ef10SJohannes Berg  * instead as well.
9067a05829a7SJohannes Berg  *
906862cc206cSJeff Johnson  * Context: Requires the RTNL and wiphy mutex to be held.
906962cc206cSJeff Johnson  *
907062cc206cSJeff Johnson  * Return: 0 on success. Non-zero on error.
90712fe8ef10SJohannes Berg  */
90722fe8ef10SJohannes Berg int cfg80211_register_netdevice(struct net_device *dev);
90732fe8ef10SJohannes Berg 
90742fe8ef10SJohannes Berg /**
90752fe8ef10SJohannes Berg  * cfg80211_unregister_netdevice - unregister the given netdev
90762fe8ef10SJohannes Berg  * @dev: the netdev to register
90772fe8ef10SJohannes Berg  *
90782fe8ef10SJohannes Berg  * Note: In contexts coming from cfg80211 callbacks, you must call this rather
90792fe8ef10SJohannes Berg  * than unregister_netdevice(), unregister_netdev() is impossible as the RTNL
90802fe8ef10SJohannes Berg  * is held. Otherwise, both unregister_netdevice() and unregister_netdev() are
90812fe8ef10SJohannes Berg  * usable instead as well.
9082a05829a7SJohannes Berg  *
908362cc206cSJeff Johnson  * Context: Requires the RTNL and wiphy mutex to be held.
90842fe8ef10SJohannes Berg  */
cfg80211_unregister_netdevice(struct net_device * dev)90852fe8ef10SJohannes Berg static inline void cfg80211_unregister_netdevice(struct net_device *dev)
90862fe8ef10SJohannes Berg {
9087c304eddcSJakub Kicinski #if IS_ENABLED(CONFIG_CFG80211)
90882fe8ef10SJohannes Berg 	cfg80211_unregister_wdev(dev->ieee80211_ptr);
9089c304eddcSJakub Kicinski #endif
90902fe8ef10SJohannes Berg }
90912fe8ef10SJohannes Berg 
90922fe8ef10SJohannes Berg /**
9093b1e8eb11SMauro Carvalho Chehab  * struct cfg80211_ft_event_params - FT Information Elements
9094355199e0SJouni Malinen  * @ies: FT IEs
9095355199e0SJouni Malinen  * @ies_len: length of the FT IE in bytes
9096355199e0SJouni Malinen  * @target_ap: target AP's MAC address
9097355199e0SJouni Malinen  * @ric_ies: RIC IE
9098355199e0SJouni Malinen  * @ric_ies_len: length of the RIC IE in bytes
9099355199e0SJouni Malinen  */
9100355199e0SJouni Malinen struct cfg80211_ft_event_params {
9101355199e0SJouni Malinen 	const u8 *ies;
9102355199e0SJouni Malinen 	size_t ies_len;
9103355199e0SJouni Malinen 	const u8 *target_ap;
9104355199e0SJouni Malinen 	const u8 *ric_ies;
9105355199e0SJouni Malinen 	size_t ric_ies_len;
9106355199e0SJouni Malinen };
9107355199e0SJouni Malinen 
9108355199e0SJouni Malinen /**
9109355199e0SJouni Malinen  * cfg80211_ft_event - notify userspace about FT IE and RIC IE
9110355199e0SJouni Malinen  * @netdev: network device
9111355199e0SJouni Malinen  * @ft_event: IE information
9112355199e0SJouni Malinen  */
9113355199e0SJouni Malinen void cfg80211_ft_event(struct net_device *netdev,
9114355199e0SJouni Malinen 		       struct cfg80211_ft_event_params *ft_event);
9115355199e0SJouni Malinen 
9116355199e0SJouni Malinen /**
91170ee45355SJohannes Berg  * cfg80211_get_p2p_attr - find and copy a P2P attribute from IE buffer
91180ee45355SJohannes Berg  * @ies: the input IE buffer
91190ee45355SJohannes Berg  * @len: the input length
91200ee45355SJohannes Berg  * @attr: the attribute ID to find
91210ee45355SJohannes Berg  * @buf: output buffer, can be %NULL if the data isn't needed, e.g.
91220ee45355SJohannes Berg  *	if the function is only called to get the needed buffer size
91230ee45355SJohannes Berg  * @bufsize: size of the output buffer
91240ee45355SJohannes Berg  *
91250ee45355SJohannes Berg  * The function finds a given P2P attribute in the (vendor) IEs and
91260ee45355SJohannes Berg  * copies its contents to the given buffer.
91270ee45355SJohannes Berg  *
91280ae997dcSYacine Belkadi  * Return: A negative error code (-%EILSEQ or -%ENOENT) if the data is
91290ae997dcSYacine Belkadi  * malformed or the attribute can't be found (respectively), or the
91300ae997dcSYacine Belkadi  * length of the found attribute (which can be zero).
91310ee45355SJohannes Berg  */
9132c216e641SArend van Spriel int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len,
9133c216e641SArend van Spriel 			  enum ieee80211_p2p_attr_id attr,
9134c216e641SArend van Spriel 			  u8 *buf, unsigned int bufsize);
91350ee45355SJohannes Berg 
9136cd8f7cb4SJohannes Berg /**
913729464cccSJohannes Berg  * ieee80211_ie_split_ric - split an IE buffer according to ordering (with RIC)
913829464cccSJohannes Berg  * @ies: the IE buffer
913929464cccSJohannes Berg  * @ielen: the length of the IE buffer
914029464cccSJohannes Berg  * @ids: an array with element IDs that are allowed before
91412512b1b1SLiad Kaufman  *	the split. A WLAN_EID_EXTENSION value means that the next
91422512b1b1SLiad Kaufman  *	EID in the list is a sub-element of the EXTENSION IE.
914329464cccSJohannes Berg  * @n_ids: the size of the element ID array
914429464cccSJohannes Berg  * @after_ric: array IE types that come after the RIC element
914529464cccSJohannes Berg  * @n_after_ric: size of the @after_ric array
914629464cccSJohannes Berg  * @offset: offset where to start splitting in the buffer
914729464cccSJohannes Berg  *
914829464cccSJohannes Berg  * This function splits an IE buffer by updating the @offset
914929464cccSJohannes Berg  * variable to point to the location where the buffer should be
915029464cccSJohannes Berg  * split.
915129464cccSJohannes Berg  *
915229464cccSJohannes Berg  * It assumes that the given IE buffer is well-formed, this
915329464cccSJohannes Berg  * has to be guaranteed by the caller!
915429464cccSJohannes Berg  *
915529464cccSJohannes Berg  * It also assumes that the IEs in the buffer are ordered
915629464cccSJohannes Berg  * correctly, if not the result of using this function will not
915729464cccSJohannes Berg  * be ordered correctly either, i.e. it does no reordering.
915829464cccSJohannes Berg  *
915962cc206cSJeff Johnson  * Return: The offset where the next part of the buffer starts, which
916062cc206cSJeff Johnson  * may be @ielen if the entire (remainder) of the buffer should be
916162cc206cSJeff Johnson  * used.
916229464cccSJohannes Berg  */
916329464cccSJohannes Berg size_t ieee80211_ie_split_ric(const u8 *ies, size_t ielen,
916429464cccSJohannes Berg 			      const u8 *ids, int n_ids,
916529464cccSJohannes Berg 			      const u8 *after_ric, int n_after_ric,
916629464cccSJohannes Berg 			      size_t offset);
916729464cccSJohannes Berg 
916829464cccSJohannes Berg /**
916929464cccSJohannes Berg  * ieee80211_ie_split - split an IE buffer according to ordering
917029464cccSJohannes Berg  * @ies: the IE buffer
917129464cccSJohannes Berg  * @ielen: the length of the IE buffer
917229464cccSJohannes Berg  * @ids: an array with element IDs that are allowed before
91732512b1b1SLiad Kaufman  *	the split. A WLAN_EID_EXTENSION value means that the next
91742512b1b1SLiad Kaufman  *	EID in the list is a sub-element of the EXTENSION IE.
917529464cccSJohannes Berg  * @n_ids: the size of the element ID array
917629464cccSJohannes Berg  * @offset: offset where to start splitting in the buffer
917729464cccSJohannes Berg  *
917829464cccSJohannes Berg  * This function splits an IE buffer by updating the @offset
917929464cccSJohannes Berg  * variable to point to the location where the buffer should be
918029464cccSJohannes Berg  * split.
918129464cccSJohannes Berg  *
918229464cccSJohannes Berg  * It assumes that the given IE buffer is well-formed, this
918329464cccSJohannes Berg  * has to be guaranteed by the caller!
918429464cccSJohannes Berg  *
918529464cccSJohannes Berg  * It also assumes that the IEs in the buffer are ordered
918629464cccSJohannes Berg  * correctly, if not the result of using this function will not
918729464cccSJohannes Berg  * be ordered correctly either, i.e. it does no reordering.
918829464cccSJohannes Berg  *
918962cc206cSJeff Johnson  * Return: The offset where the next part of the buffer starts, which
919062cc206cSJeff Johnson  * may be @ielen if the entire (remainder) of the buffer should be
919162cc206cSJeff Johnson  * used.
919229464cccSJohannes Berg  */
ieee80211_ie_split(const u8 * ies,size_t ielen,const u8 * ids,int n_ids,size_t offset)91930483eeacSJohannes Berg static inline size_t ieee80211_ie_split(const u8 *ies, size_t ielen,
91940483eeacSJohannes Berg 					const u8 *ids, int n_ids, size_t offset)
91950483eeacSJohannes Berg {
91960483eeacSJohannes Berg 	return ieee80211_ie_split_ric(ies, ielen, ids, n_ids, NULL, 0, offset);
91970483eeacSJohannes Berg }
919829464cccSJohannes Berg 
919929464cccSJohannes Berg /**
92005806ef25SBenjamin Berg  * ieee80211_fragment_element - fragment the last element in skb
92015806ef25SBenjamin Berg  * @skb: The skbuf that the element was added to
92025806ef25SBenjamin Berg  * @len_pos: Pointer to length of the element to fragment
92035806ef25SBenjamin Berg  * @frag_id: The element ID to use for fragments
92045806ef25SBenjamin Berg  *
92055806ef25SBenjamin Berg  * This function fragments all data after @len_pos, adding fragmentation
92065806ef25SBenjamin Berg  * elements with the given ID as appropriate. The SKB will grow in size
92075806ef25SBenjamin Berg  * accordingly.
92085806ef25SBenjamin Berg  */
92095806ef25SBenjamin Berg void ieee80211_fragment_element(struct sk_buff *skb, u8 *len_pos, u8 frag_id);
92105806ef25SBenjamin Berg 
92115806ef25SBenjamin Berg /**
9212cd8f7cb4SJohannes Berg  * cfg80211_report_wowlan_wakeup - report wakeup from WoWLAN
9213cd8f7cb4SJohannes Berg  * @wdev: the wireless device reporting the wakeup
9214cd8f7cb4SJohannes Berg  * @wakeup: the wakeup report
9215cd8f7cb4SJohannes Berg  * @gfp: allocation flags
9216cd8f7cb4SJohannes Berg  *
9217cd8f7cb4SJohannes Berg  * This function reports that the given device woke up. If it
9218cd8f7cb4SJohannes Berg  * caused the wakeup, report the reason(s), otherwise you may
9219cd8f7cb4SJohannes Berg  * pass %NULL as the @wakeup parameter to advertise that something
9220cd8f7cb4SJohannes Berg  * else caused the wakeup.
9221cd8f7cb4SJohannes Berg  */
9222cd8f7cb4SJohannes Berg void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev,
9223cd8f7cb4SJohannes Berg 				   struct cfg80211_wowlan_wakeup *wakeup,
9224cd8f7cb4SJohannes Berg 				   gfp_t gfp);
9225cd8f7cb4SJohannes Berg 
92265de17984SArend van Spriel /**
92275de17984SArend van Spriel  * cfg80211_crit_proto_stopped() - indicate critical protocol stopped by driver.
92285de17984SArend van Spriel  *
92295de17984SArend van Spriel  * @wdev: the wireless device for which critical protocol is stopped.
923003f831a6SRobert P. J. Day  * @gfp: allocation flags
92315de17984SArend van Spriel  *
92325de17984SArend van Spriel  * This function can be called by the driver to indicate it has reverted
92335de17984SArend van Spriel  * operation back to normal. One reason could be that the duration given
92345de17984SArend van Spriel  * by .crit_proto_start() has expired.
92355de17984SArend van Spriel  */
92365de17984SArend van Spriel void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp);
92375de17984SArend van Spriel 
9238bdfbec2dSIlan Peer /**
9239bdfbec2dSIlan Peer  * ieee80211_get_num_supported_channels - get number of channels device has
9240bdfbec2dSIlan Peer  * @wiphy: the wiphy
9241bdfbec2dSIlan Peer  *
9242bdfbec2dSIlan Peer  * Return: the number of channels supported by the device.
9243bdfbec2dSIlan Peer  */
9244bdfbec2dSIlan Peer unsigned int ieee80211_get_num_supported_channels(struct wiphy *wiphy);
9245bdfbec2dSIlan Peer 
9246cb2d956dSLuciano Coelho /**
9247cb2d956dSLuciano Coelho  * cfg80211_check_combinations - check interface combinations
9248cb2d956dSLuciano Coelho  *
9249cb2d956dSLuciano Coelho  * @wiphy: the wiphy
9250e227300cSPurushottam Kushwaha  * @params: the interface combinations parameter
9251cb2d956dSLuciano Coelho  *
9252cb2d956dSLuciano Coelho  * This function can be called by the driver to check whether a
9253cb2d956dSLuciano Coelho  * combination of interfaces and their types are allowed according to
9254cb2d956dSLuciano Coelho  * the interface combinations.
925562cc206cSJeff Johnson  *
925662cc206cSJeff Johnson  * Return: 0 if combinations are allowed. Non-zero on error.
9257cb2d956dSLuciano Coelho  */
9258cb2d956dSLuciano Coelho int cfg80211_check_combinations(struct wiphy *wiphy,
9259e227300cSPurushottam Kushwaha 				struct iface_combination_params *params);
9260cb2d956dSLuciano Coelho 
926165a124ddSMichal Kazior /**
926265a124ddSMichal Kazior  * cfg80211_iter_combinations - iterate over matching combinations
926365a124ddSMichal Kazior  *
926465a124ddSMichal Kazior  * @wiphy: the wiphy
9265e227300cSPurushottam Kushwaha  * @params: the interface combinations parameter
926665a124ddSMichal Kazior  * @iter: function to call for each matching combination
926765a124ddSMichal Kazior  * @data: pointer to pass to iter function
926865a124ddSMichal Kazior  *
926965a124ddSMichal Kazior  * This function can be called by the driver to check what possible
927065a124ddSMichal Kazior  * combinations it fits in at a given moment, e.g. for channel switching
927165a124ddSMichal Kazior  * purposes.
927262cc206cSJeff Johnson  *
927362cc206cSJeff Johnson  * Return: 0 on success. Non-zero on error.
927465a124ddSMichal Kazior  */
927565a124ddSMichal Kazior int cfg80211_iter_combinations(struct wiphy *wiphy,
9276e227300cSPurushottam Kushwaha 			       struct iface_combination_params *params,
927765a124ddSMichal Kazior 			       void (*iter)(const struct ieee80211_iface_combination *c,
927865a124ddSMichal Kazior 					    void *data),
927965a124ddSMichal Kazior 			       void *data);
928065a124ddSMichal Kazior 
928162cc206cSJeff Johnson /**
9282f04c2203SMichal Kazior  * cfg80211_stop_iface - trigger interface disconnection
9283f04c2203SMichal Kazior  *
9284f04c2203SMichal Kazior  * @wiphy: the wiphy
9285f04c2203SMichal Kazior  * @wdev: wireless device
9286f04c2203SMichal Kazior  * @gfp: context flags
9287f04c2203SMichal Kazior  *
9288f04c2203SMichal Kazior  * Trigger interface to be stopped as if AP was stopped, IBSS/mesh left, STA
9289f04c2203SMichal Kazior  * disconnected.
9290f04c2203SMichal Kazior  *
9291f04c2203SMichal Kazior  * Note: This doesn't need any locks and is asynchronous.
9292f04c2203SMichal Kazior  */
9293f04c2203SMichal Kazior void cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev,
9294f04c2203SMichal Kazior 			 gfp_t gfp);
9295f04c2203SMichal Kazior 
9296f6837ba8SJohannes Berg /**
9297f6837ba8SJohannes Berg  * cfg80211_shutdown_all_interfaces - shut down all interfaces for a wiphy
9298f6837ba8SJohannes Berg  * @wiphy: the wiphy to shut down
9299f6837ba8SJohannes Berg  *
9300f6837ba8SJohannes Berg  * This function shuts down all interfaces belonging to this wiphy by
9301f6837ba8SJohannes Berg  * calling dev_close() (and treating non-netdev interfaces as needed).
9302f6837ba8SJohannes Berg  * It shouldn't really be used unless there are some fatal device errors
9303f6837ba8SJohannes Berg  * that really can't be recovered in any other way.
9304f6837ba8SJohannes Berg  *
9305f6837ba8SJohannes Berg  * Callers must hold the RTNL and be able to deal with callbacks into
9306f6837ba8SJohannes Berg  * the driver while the function is running.
9307f6837ba8SJohannes Berg  */
9308f6837ba8SJohannes Berg void cfg80211_shutdown_all_interfaces(struct wiphy *wiphy);
9309f6837ba8SJohannes Berg 
9310d75bb06bSGautam Kumar Shukla /**
9311d75bb06bSGautam Kumar Shukla  * wiphy_ext_feature_set - set the extended feature flag
9312d75bb06bSGautam Kumar Shukla  *
9313d75bb06bSGautam Kumar Shukla  * @wiphy: the wiphy to modify.
9314d75bb06bSGautam Kumar Shukla  * @ftidx: extended feature bit index.
9315d75bb06bSGautam Kumar Shukla  *
9316d75bb06bSGautam Kumar Shukla  * The extended features are flagged in multiple bytes (see
9317d75bb06bSGautam Kumar Shukla  * &struct wiphy.@ext_features)
9318d75bb06bSGautam Kumar Shukla  */
wiphy_ext_feature_set(struct wiphy * wiphy,enum nl80211_ext_feature_index ftidx)9319d75bb06bSGautam Kumar Shukla static inline void wiphy_ext_feature_set(struct wiphy *wiphy,
9320d75bb06bSGautam Kumar Shukla 					 enum nl80211_ext_feature_index ftidx)
9321d75bb06bSGautam Kumar Shukla {
9322d75bb06bSGautam Kumar Shukla 	u8 *ft_byte;
9323d75bb06bSGautam Kumar Shukla 
9324d75bb06bSGautam Kumar Shukla 	ft_byte = &wiphy->ext_features[ftidx / 8];
9325d75bb06bSGautam Kumar Shukla 	*ft_byte |= BIT(ftidx % 8);
9326d75bb06bSGautam Kumar Shukla }
9327d75bb06bSGautam Kumar Shukla 
9328d75bb06bSGautam Kumar Shukla /**
9329d75bb06bSGautam Kumar Shukla  * wiphy_ext_feature_isset - check the extended feature flag
9330d75bb06bSGautam Kumar Shukla  *
9331d75bb06bSGautam Kumar Shukla  * @wiphy: the wiphy to modify.
9332d75bb06bSGautam Kumar Shukla  * @ftidx: extended feature bit index.
9333d75bb06bSGautam Kumar Shukla  *
9334d75bb06bSGautam Kumar Shukla  * The extended features are flagged in multiple bytes (see
9335d75bb06bSGautam Kumar Shukla  * &struct wiphy.@ext_features)
933662cc206cSJeff Johnson  *
933762cc206cSJeff Johnson  * Return: %true if extended feature flag is set, %false otherwise
9338d75bb06bSGautam Kumar Shukla  */
9339d75bb06bSGautam Kumar Shukla static inline bool
wiphy_ext_feature_isset(struct wiphy * wiphy,enum nl80211_ext_feature_index ftidx)9340d75bb06bSGautam Kumar Shukla wiphy_ext_feature_isset(struct wiphy *wiphy,
9341d75bb06bSGautam Kumar Shukla 			enum nl80211_ext_feature_index ftidx)
9342d75bb06bSGautam Kumar Shukla {
9343d75bb06bSGautam Kumar Shukla 	u8 ft_byte;
9344d75bb06bSGautam Kumar Shukla 
9345d75bb06bSGautam Kumar Shukla 	ft_byte = wiphy->ext_features[ftidx / 8];
9346d75bb06bSGautam Kumar Shukla 	return (ft_byte & BIT(ftidx % 8)) != 0;
9347d75bb06bSGautam Kumar Shukla }
9348b7ffbd7eSJohannes Berg 
9349a442b761SAyala Beker /**
9350a442b761SAyala Beker  * cfg80211_free_nan_func - free NAN function
9351a442b761SAyala Beker  * @f: NAN function that should be freed
9352a442b761SAyala Beker  *
9353a442b761SAyala Beker  * Frees all the NAN function and all it's allocated members.
9354a442b761SAyala Beker  */
9355a442b761SAyala Beker void cfg80211_free_nan_func(struct cfg80211_nan_func *f);
9356a442b761SAyala Beker 
935750bcd31dSAyala Beker /**
935850bcd31dSAyala Beker  * struct cfg80211_nan_match_params - NAN match parameters
935950bcd31dSAyala Beker  * @type: the type of the function that triggered a match. If it is
936050bcd31dSAyala Beker  *	 %NL80211_NAN_FUNC_SUBSCRIBE it means that we replied to a subscriber.
936150bcd31dSAyala Beker  *	 If it is %NL80211_NAN_FUNC_PUBLISH, it means that we got a discovery
936250bcd31dSAyala Beker  *	 result.
936350bcd31dSAyala Beker  *	 If it is %NL80211_NAN_FUNC_FOLLOW_UP, we received a follow up.
936450bcd31dSAyala Beker  * @inst_id: the local instance id
936550bcd31dSAyala Beker  * @peer_inst_id: the instance id of the peer's function
936650bcd31dSAyala Beker  * @addr: the MAC address of the peer
936750bcd31dSAyala Beker  * @info_len: the length of the &info
936850bcd31dSAyala Beker  * @info: the Service Specific Info from the peer (if any)
936950bcd31dSAyala Beker  * @cookie: unique identifier of the corresponding function
937050bcd31dSAyala Beker  */
937150bcd31dSAyala Beker struct cfg80211_nan_match_params {
937250bcd31dSAyala Beker 	enum nl80211_nan_function_type type;
937350bcd31dSAyala Beker 	u8 inst_id;
937450bcd31dSAyala Beker 	u8 peer_inst_id;
937550bcd31dSAyala Beker 	const u8 *addr;
937650bcd31dSAyala Beker 	u8 info_len;
937750bcd31dSAyala Beker 	const u8 *info;
937850bcd31dSAyala Beker 	u64 cookie;
937950bcd31dSAyala Beker };
938050bcd31dSAyala Beker 
938150bcd31dSAyala Beker /**
938250bcd31dSAyala Beker  * cfg80211_nan_match - report a match for a NAN function.
938350bcd31dSAyala Beker  * @wdev: the wireless device reporting the match
938450bcd31dSAyala Beker  * @match: match notification parameters
938550bcd31dSAyala Beker  * @gfp: allocation flags
938650bcd31dSAyala Beker  *
938750bcd31dSAyala Beker  * This function reports that the a NAN function had a match. This
938850bcd31dSAyala Beker  * can be a subscribe that had a match or a solicited publish that
938950bcd31dSAyala Beker  * was sent. It can also be a follow up that was received.
939050bcd31dSAyala Beker  */
939150bcd31dSAyala Beker void cfg80211_nan_match(struct wireless_dev *wdev,
939250bcd31dSAyala Beker 			struct cfg80211_nan_match_params *match, gfp_t gfp);
939350bcd31dSAyala Beker 
9394368e5a7bSAyala Beker /**
9395368e5a7bSAyala Beker  * cfg80211_nan_func_terminated - notify about NAN function termination.
9396368e5a7bSAyala Beker  *
9397368e5a7bSAyala Beker  * @wdev: the wireless device reporting the match
9398368e5a7bSAyala Beker  * @inst_id: the local instance id
9399368e5a7bSAyala Beker  * @reason: termination reason (one of the NL80211_NAN_FUNC_TERM_REASON_*)
9400368e5a7bSAyala Beker  * @cookie: unique NAN function identifier
9401368e5a7bSAyala Beker  * @gfp: allocation flags
9402368e5a7bSAyala Beker  *
9403368e5a7bSAyala Beker  * This function reports that the a NAN function is terminated.
9404368e5a7bSAyala Beker  */
9405368e5a7bSAyala Beker void cfg80211_nan_func_terminated(struct wireless_dev *wdev,
9406368e5a7bSAyala Beker 				  u8 inst_id,
9407368e5a7bSAyala Beker 				  enum nl80211_nan_func_term_reason reason,
9408368e5a7bSAyala Beker 				  u64 cookie, gfp_t gfp);
9409368e5a7bSAyala Beker 
9410b7ffbd7eSJohannes Berg /* ethtool helper */
9411b7ffbd7eSJohannes Berg void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info);
9412b7ffbd7eSJohannes Berg 
941340cbfa90SSrinivas Dasari /**
941440cbfa90SSrinivas Dasari  * cfg80211_external_auth_request - userspace request for authentication
941540cbfa90SSrinivas Dasari  * @netdev: network device
941640cbfa90SSrinivas Dasari  * @params: External authentication parameters
941740cbfa90SSrinivas Dasari  * @gfp: allocation flags
941840cbfa90SSrinivas Dasari  * Returns: 0 on success, < 0 on error
941940cbfa90SSrinivas Dasari  */
942040cbfa90SSrinivas Dasari int cfg80211_external_auth_request(struct net_device *netdev,
942140cbfa90SSrinivas Dasari 				   struct cfg80211_external_auth_params *params,
942240cbfa90SSrinivas Dasari 				   gfp_t gfp);
942340cbfa90SSrinivas Dasari 
94249bb7e0f2SJohannes Berg /**
94259bb7e0f2SJohannes Berg  * cfg80211_pmsr_report - report peer measurement result data
94269bb7e0f2SJohannes Berg  * @wdev: the wireless device reporting the measurement
94279bb7e0f2SJohannes Berg  * @req: the original measurement request
94289bb7e0f2SJohannes Berg  * @result: the result data
94299bb7e0f2SJohannes Berg  * @gfp: allocation flags
94309bb7e0f2SJohannes Berg  */
94319bb7e0f2SJohannes Berg void cfg80211_pmsr_report(struct wireless_dev *wdev,
94329bb7e0f2SJohannes Berg 			  struct cfg80211_pmsr_request *req,
94339bb7e0f2SJohannes Berg 			  struct cfg80211_pmsr_result *result,
94349bb7e0f2SJohannes Berg 			  gfp_t gfp);
94359bb7e0f2SJohannes Berg 
94369bb7e0f2SJohannes Berg /**
94379bb7e0f2SJohannes Berg  * cfg80211_pmsr_complete - report peer measurement completed
94389bb7e0f2SJohannes Berg  * @wdev: the wireless device reporting the measurement
94399bb7e0f2SJohannes Berg  * @req: the original measurement request
94409bb7e0f2SJohannes Berg  * @gfp: allocation flags
94419bb7e0f2SJohannes Berg  *
94429bb7e0f2SJohannes Berg  * Report that the entire measurement completed, after this
94439bb7e0f2SJohannes Berg  * the request pointer will no longer be valid.
94449bb7e0f2SJohannes Berg  */
94459bb7e0f2SJohannes Berg void cfg80211_pmsr_complete(struct wireless_dev *wdev,
94469bb7e0f2SJohannes Berg 			    struct cfg80211_pmsr_request *req,
94479bb7e0f2SJohannes Berg 			    gfp_t gfp);
94489bb7e0f2SJohannes Berg 
9449e6f40511SManikanta Pubbisetty /**
9450e6f40511SManikanta Pubbisetty  * cfg80211_iftype_allowed - check whether the interface can be allowed
9451e6f40511SManikanta Pubbisetty  * @wiphy: the wiphy
9452e6f40511SManikanta Pubbisetty  * @iftype: interface type
9453e6f40511SManikanta Pubbisetty  * @is_4addr: use_4addr flag, must be '0' when check_swif is '1'
9454e6f40511SManikanta Pubbisetty  * @check_swif: check iftype against software interfaces
9455e6f40511SManikanta Pubbisetty  *
9456e6f40511SManikanta Pubbisetty  * Check whether the interface is allowed to operate; additionally, this API
9457e6f40511SManikanta Pubbisetty  * can be used to check iftype against the software interfaces when
9458e6f40511SManikanta Pubbisetty  * check_swif is '1'.
945962cc206cSJeff Johnson  *
946062cc206cSJeff Johnson  * Return: %true if allowed, %false otherwise
9461e6f40511SManikanta Pubbisetty  */
9462e6f40511SManikanta Pubbisetty bool cfg80211_iftype_allowed(struct wiphy *wiphy, enum nl80211_iftype iftype,
9463e6f40511SManikanta Pubbisetty 			     bool is_4addr, u8 check_swif);
9464e6f40511SManikanta Pubbisetty 
9465e6f40511SManikanta Pubbisetty 
9466a083ee8aSIlan Peer /**
9467a083ee8aSIlan Peer  * cfg80211_assoc_comeback - notification of association that was
946898e0c7f8SRandy Dunlap  * temporarily rejected with a comeback
9469a083ee8aSIlan Peer  * @netdev: network device
947098e0c7f8SRandy Dunlap  * @ap_addr: AP (MLD) address that rejected the association
9471a083ee8aSIlan Peer  * @timeout: timeout interval value TUs.
9472a083ee8aSIlan Peer  *
9473a083ee8aSIlan Peer  * this function may sleep. the caller must hold the corresponding wdev's mutex.
9474a083ee8aSIlan Peer  */
9475a083ee8aSIlan Peer void cfg80211_assoc_comeback(struct net_device *netdev,
9476e69dac88SJohannes Berg 			     const u8 *ap_addr, u32 timeout);
9477a083ee8aSIlan Peer 
9478e1db74fcSJoe Perches /* Logging, debugging and troubleshooting/diagnostic helpers. */
9479e1db74fcSJoe Perches 
9480e1db74fcSJoe Perches /* wiphy_printk helpers, similar to dev_printk */
9481e1db74fcSJoe Perches 
9482e1db74fcSJoe Perches #define wiphy_printk(level, wiphy, format, args...)		\
94839c376639SJoe Perches 	dev_printk(level, &(wiphy)->dev, format, ##args)
9484e1db74fcSJoe Perches #define wiphy_emerg(wiphy, format, args...)			\
94859c376639SJoe Perches 	dev_emerg(&(wiphy)->dev, format, ##args)
9486e1db74fcSJoe Perches #define wiphy_alert(wiphy, format, args...)			\
94879c376639SJoe Perches 	dev_alert(&(wiphy)->dev, format, ##args)
9488e1db74fcSJoe Perches #define wiphy_crit(wiphy, format, args...)			\
94899c376639SJoe Perches 	dev_crit(&(wiphy)->dev, format, ##args)
9490e1db74fcSJoe Perches #define wiphy_err(wiphy, format, args...)			\
94919c376639SJoe Perches 	dev_err(&(wiphy)->dev, format, ##args)
9492e1db74fcSJoe Perches #define wiphy_warn(wiphy, format, args...)			\
94939c376639SJoe Perches 	dev_warn(&(wiphy)->dev, format, ##args)
9494e1db74fcSJoe Perches #define wiphy_notice(wiphy, format, args...)			\
94959c376639SJoe Perches 	dev_notice(&(wiphy)->dev, format, ##args)
9496e1db74fcSJoe Perches #define wiphy_info(wiphy, format, args...)			\
94979c376639SJoe Perches 	dev_info(&(wiphy)->dev, format, ##args)
9498761025b5SDmitry Osipenko #define wiphy_info_once(wiphy, format, args...)			\
9499761025b5SDmitry Osipenko 	dev_info_once(&(wiphy)->dev, format, ##args)
9500073730d7SJoe Perches 
9501a58d7525SStanislaw Gruszka #define wiphy_err_ratelimited(wiphy, format, args...)		\
9502a58d7525SStanislaw Gruszka 	dev_err_ratelimited(&(wiphy)->dev, format, ##args)
9503a58d7525SStanislaw Gruszka #define wiphy_warn_ratelimited(wiphy, format, args...)		\
9504a58d7525SStanislaw Gruszka 	dev_warn_ratelimited(&(wiphy)->dev, format, ##args)
9505a58d7525SStanislaw Gruszka 
95069c376639SJoe Perches #define wiphy_debug(wiphy, format, args...)			\
9507e1db74fcSJoe Perches 	wiphy_printk(KERN_DEBUG, wiphy, format, ##args)
95089c376639SJoe Perches 
9509e1db74fcSJoe Perches #define wiphy_dbg(wiphy, format, args...)			\
95109c376639SJoe Perches 	dev_dbg(&(wiphy)->dev, format, ##args)
9511e1db74fcSJoe Perches 
9512e1db74fcSJoe Perches #if defined(VERBOSE_DEBUG)
9513e1db74fcSJoe Perches #define wiphy_vdbg	wiphy_dbg
9514e1db74fcSJoe Perches #else
9515e1db74fcSJoe Perches #define wiphy_vdbg(wiphy, format, args...)				\
9516e1db74fcSJoe Perches ({									\
9517e1db74fcSJoe Perches 	if (0)								\
9518e1db74fcSJoe Perches 		wiphy_printk(KERN_DEBUG, wiphy, format, ##args);	\
9519e1db74fcSJoe Perches 	0;								\
9520e1db74fcSJoe Perches })
9521e1db74fcSJoe Perches #endif
9522e1db74fcSJoe Perches 
9523e1db74fcSJoe Perches /*
9524e1db74fcSJoe Perches  * wiphy_WARN() acts like wiphy_printk(), but with the key difference
9525e1db74fcSJoe Perches  * of using a WARN/WARN_ON to get the message out, including the
9526e1db74fcSJoe Perches  * file/line information and a backtrace.
9527e1db74fcSJoe Perches  */
9528e1db74fcSJoe Perches #define wiphy_WARN(wiphy, format, args...)			\
9529e1db74fcSJoe Perches 	WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args);
9530e1db74fcSJoe Perches 
9531cb74e977SSunil Dutt /**
9532cb74e977SSunil Dutt  * cfg80211_update_owe_info_event - Notify the peer's OWE info to user space
9533cb74e977SSunil Dutt  * @netdev: network device
9534cb74e977SSunil Dutt  * @owe_info: peer's owe info
9535cb74e977SSunil Dutt  * @gfp: allocation flags
9536cb74e977SSunil Dutt  */
9537cb74e977SSunil Dutt void cfg80211_update_owe_info_event(struct net_device *netdev,
9538cb74e977SSunil Dutt 				    struct cfg80211_update_owe_info *owe_info,
9539cb74e977SSunil Dutt 				    gfp_t gfp);
9540cb74e977SSunil Dutt 
95412f1805eaSEmmanuel Grumbach /**
95422f1805eaSEmmanuel Grumbach  * cfg80211_bss_flush - resets all the scan entries
95432f1805eaSEmmanuel Grumbach  * @wiphy: the wiphy
95442f1805eaSEmmanuel Grumbach  */
95452f1805eaSEmmanuel Grumbach void cfg80211_bss_flush(struct wiphy *wiphy);
95462f1805eaSEmmanuel Grumbach 
95470d2ab3aeSJohn Crispin /**
95480d2ab3aeSJohn Crispin  * cfg80211_bss_color_notify - notify about bss color event
95490d2ab3aeSJohn Crispin  * @dev: network device
95500d2ab3aeSJohn Crispin  * @cmd: the actual event we want to notify
95510d2ab3aeSJohn Crispin  * @count: the number of TBTTs until the color change happens
95520d2ab3aeSJohn Crispin  * @color_bitmap: representations of the colors that the local BSS is aware of
955391d2b6eeSAditya Kumar Singh  * @link_id: valid link_id in case of MLO or 0 for non-MLO.
955462cc206cSJeff Johnson  *
955562cc206cSJeff Johnson  * Return: 0 on success. Non-zero on error.
95560d2ab3aeSJohn Crispin  */
9557935ef47bSLorenzo Bianconi int cfg80211_bss_color_notify(struct net_device *dev,
95580d2ab3aeSJohn Crispin 			      enum nl80211_commands cmd, u8 count,
955991d2b6eeSAditya Kumar Singh 			      u64 color_bitmap, u8 link_id);
95600d2ab3aeSJohn Crispin 
95610d2ab3aeSJohn Crispin /**
95620d2ab3aeSJohn Crispin  * cfg80211_obss_color_collision_notify - notify about bss color collision
95630d2ab3aeSJohn Crispin  * @dev: network device
95640d2ab3aeSJohn Crispin  * @color_bitmap: representations of the colors that the local BSS is aware of
956591d2b6eeSAditya Kumar Singh  * @link_id: valid link_id in case of MLO or 0 for non-MLO.
956662cc206cSJeff Johnson  *
956762cc206cSJeff Johnson  * Return: 0 on success. Non-zero on error.
95680d2ab3aeSJohn Crispin  */
cfg80211_obss_color_collision_notify(struct net_device * dev,u64 color_bitmap,u8 link_id)95690d2ab3aeSJohn Crispin static inline int cfg80211_obss_color_collision_notify(struct net_device *dev,
957091d2b6eeSAditya Kumar Singh 						       u64 color_bitmap,
957191d2b6eeSAditya Kumar Singh 						       u8 link_id)
95720d2ab3aeSJohn Crispin {
9573935ef47bSLorenzo Bianconi 	return cfg80211_bss_color_notify(dev, NL80211_CMD_OBSS_COLOR_COLLISION,
957491d2b6eeSAditya Kumar Singh 					 0, color_bitmap, link_id);
95750d2ab3aeSJohn Crispin }
95760d2ab3aeSJohn Crispin 
95770d2ab3aeSJohn Crispin /**
95780d2ab3aeSJohn Crispin  * cfg80211_color_change_started_notify - notify color change start
95790d2ab3aeSJohn Crispin  * @dev: the device on which the color is switched
95800d2ab3aeSJohn Crispin  * @count: the number of TBTTs until the color change happens
958191d2b6eeSAditya Kumar Singh  * @link_id: valid link_id in case of MLO or 0 for non-MLO.
95820d2ab3aeSJohn Crispin  *
95830d2ab3aeSJohn Crispin  * Inform the userspace about the color change that has started.
958462cc206cSJeff Johnson  *
958562cc206cSJeff Johnson  * Return: 0 on success. Non-zero on error.
95860d2ab3aeSJohn Crispin  */
cfg80211_color_change_started_notify(struct net_device * dev,u8 count,u8 link_id)95870d2ab3aeSJohn Crispin static inline int cfg80211_color_change_started_notify(struct net_device *dev,
958891d2b6eeSAditya Kumar Singh 						       u8 count, u8 link_id)
95890d2ab3aeSJohn Crispin {
9590935ef47bSLorenzo Bianconi 	return cfg80211_bss_color_notify(dev, NL80211_CMD_COLOR_CHANGE_STARTED,
959191d2b6eeSAditya Kumar Singh 					 count, 0, link_id);
95920d2ab3aeSJohn Crispin }
95930d2ab3aeSJohn Crispin 
95940d2ab3aeSJohn Crispin /**
95950d2ab3aeSJohn Crispin  * cfg80211_color_change_aborted_notify - notify color change abort
95960d2ab3aeSJohn Crispin  * @dev: the device on which the color is switched
959791d2b6eeSAditya Kumar Singh  * @link_id: valid link_id in case of MLO or 0 for non-MLO.
95980d2ab3aeSJohn Crispin  *
95990d2ab3aeSJohn Crispin  * Inform the userspace about the color change that has aborted.
960062cc206cSJeff Johnson  *
960162cc206cSJeff Johnson  * Return: 0 on success. Non-zero on error.
96020d2ab3aeSJohn Crispin  */
cfg80211_color_change_aborted_notify(struct net_device * dev,u8 link_id)960391d2b6eeSAditya Kumar Singh static inline int cfg80211_color_change_aborted_notify(struct net_device *dev,
960491d2b6eeSAditya Kumar Singh 						       u8 link_id)
96050d2ab3aeSJohn Crispin {
9606935ef47bSLorenzo Bianconi 	return cfg80211_bss_color_notify(dev, NL80211_CMD_COLOR_CHANGE_ABORTED,
960791d2b6eeSAditya Kumar Singh 					 0, 0, link_id);
96080d2ab3aeSJohn Crispin }
96090d2ab3aeSJohn Crispin 
96100d2ab3aeSJohn Crispin /**
96110d2ab3aeSJohn Crispin  * cfg80211_color_change_notify - notify color change completion
96120d2ab3aeSJohn Crispin  * @dev: the device on which the color was switched
961391d2b6eeSAditya Kumar Singh  * @link_id: valid link_id in case of MLO or 0 for non-MLO.
96140d2ab3aeSJohn Crispin  *
96150d2ab3aeSJohn Crispin  * Inform the userspace about the color change that has completed.
961662cc206cSJeff Johnson  *
961762cc206cSJeff Johnson  * Return: 0 on success. Non-zero on error.
96180d2ab3aeSJohn Crispin  */
cfg80211_color_change_notify(struct net_device * dev,u8 link_id)961991d2b6eeSAditya Kumar Singh static inline int cfg80211_color_change_notify(struct net_device *dev,
962091d2b6eeSAditya Kumar Singh 					       u8 link_id)
96210d2ab3aeSJohn Crispin {
9622935ef47bSLorenzo Bianconi 	return cfg80211_bss_color_notify(dev,
96230d2ab3aeSJohn Crispin 					 NL80211_CMD_COLOR_CHANGE_COMPLETED,
962491d2b6eeSAditya Kumar Singh 					 0, 0, link_id);
96250d2ab3aeSJohn Crispin }
96260d2ab3aeSJohn Crispin 
9627b25413feSAloka Dixit /**
9628065563b2SVeerendranath Jakkam  * cfg80211_links_removed - Notify about removed STA MLD setup links.
9629065563b2SVeerendranath Jakkam  * @dev: network device.
9630065563b2SVeerendranath Jakkam  * @link_mask: BIT mask of removed STA MLD setup link IDs.
9631065563b2SVeerendranath Jakkam  *
9632065563b2SVeerendranath Jakkam  * Inform cfg80211 and the userspace about removed STA MLD setup links due to
9633065563b2SVeerendranath Jakkam  * AP MLD removing the corresponding affiliated APs with Multi-Link
9634065563b2SVeerendranath Jakkam  * reconfiguration. Note that it's not valid to remove all links, in this
9635065563b2SVeerendranath Jakkam  * case disconnect instead.
9636065563b2SVeerendranath Jakkam  * Also note that the wdev mutex must be held.
9637065563b2SVeerendranath Jakkam  */
9638065563b2SVeerendranath Jakkam void cfg80211_links_removed(struct net_device *dev, u16 link_mask);
9639065563b2SVeerendranath Jakkam 
96409be61558SAndrei Otcheretianski /**
96419be61558SAndrei Otcheretianski  * cfg80211_schedule_channels_check - schedule regulatory check if needed
96429be61558SAndrei Otcheretianski  * @wdev: the wireless device to check
96439be61558SAndrei Otcheretianski  *
96449be61558SAndrei Otcheretianski  * In case the device supports NO_IR or DFS relaxations, schedule regulatory
96459be61558SAndrei Otcheretianski  * channels check, as previous concurrent operation conditions may not
96469be61558SAndrei Otcheretianski  * hold anymore.
96479be61558SAndrei Otcheretianski  */
96489be61558SAndrei Otcheretianski void cfg80211_schedule_channels_check(struct wireless_dev *wdev);
96499be61558SAndrei Otcheretianski 
9650b590b9aeSJohannes Berg #ifdef CONFIG_CFG80211_DEBUGFS
9651b590b9aeSJohannes Berg /**
9652b590b9aeSJohannes Berg  * wiphy_locked_debugfs_read - do a locked read in debugfs
9653b590b9aeSJohannes Berg  * @wiphy: the wiphy to use
9654b590b9aeSJohannes Berg  * @file: the file being read
9655b590b9aeSJohannes Berg  * @buf: the buffer to fill and then read from
9656b590b9aeSJohannes Berg  * @bufsize: size of the buffer
9657b590b9aeSJohannes Berg  * @userbuf: the user buffer to copy to
9658b590b9aeSJohannes Berg  * @count: read count
9659b590b9aeSJohannes Berg  * @ppos: read position
9660b590b9aeSJohannes Berg  * @handler: the read handler to call (under wiphy lock)
9661b590b9aeSJohannes Berg  * @data: additional data to pass to the read handler
966262cc206cSJeff Johnson  *
966362cc206cSJeff Johnson  * Return: the number of characters read, or a negative errno
9664b590b9aeSJohannes Berg  */
9665b590b9aeSJohannes Berg ssize_t wiphy_locked_debugfs_read(struct wiphy *wiphy, struct file *file,
9666b590b9aeSJohannes Berg 				  char *buf, size_t bufsize,
9667b590b9aeSJohannes Berg 				  char __user *userbuf, size_t count,
9668b590b9aeSJohannes Berg 				  loff_t *ppos,
9669b590b9aeSJohannes Berg 				  ssize_t (*handler)(struct wiphy *wiphy,
9670b590b9aeSJohannes Berg 						     struct file *file,
9671b590b9aeSJohannes Berg 						     char *buf,
9672b590b9aeSJohannes Berg 						     size_t bufsize,
9673b590b9aeSJohannes Berg 						     void *data),
9674b590b9aeSJohannes Berg 				  void *data);
9675b590b9aeSJohannes Berg 
9676b590b9aeSJohannes Berg /**
9677b590b9aeSJohannes Berg  * wiphy_locked_debugfs_write - do a locked write in debugfs
9678b590b9aeSJohannes Berg  * @wiphy: the wiphy to use
9679b590b9aeSJohannes Berg  * @file: the file being written to
9680b590b9aeSJohannes Berg  * @buf: the buffer to copy the user data to
9681b590b9aeSJohannes Berg  * @bufsize: size of the buffer
9682b590b9aeSJohannes Berg  * @userbuf: the user buffer to copy from
9683b590b9aeSJohannes Berg  * @count: read count
9684b590b9aeSJohannes Berg  * @handler: the write handler to call (under wiphy lock)
9685b590b9aeSJohannes Berg  * @data: additional data to pass to the write handler
968662cc206cSJeff Johnson  *
968762cc206cSJeff Johnson  * Return: the number of characters written, or a negative errno
9688b590b9aeSJohannes Berg  */
9689b590b9aeSJohannes Berg ssize_t wiphy_locked_debugfs_write(struct wiphy *wiphy, struct file *file,
9690b590b9aeSJohannes Berg 				   char *buf, size_t bufsize,
9691b590b9aeSJohannes Berg 				   const char __user *userbuf, size_t count,
9692b590b9aeSJohannes Berg 				   ssize_t (*handler)(struct wiphy *wiphy,
9693b590b9aeSJohannes Berg 						      struct file *file,
9694b590b9aeSJohannes Berg 						      char *buf,
9695b590b9aeSJohannes Berg 						      size_t count,
9696b590b9aeSJohannes Berg 						      void *data),
9697b590b9aeSJohannes Berg 				   void *data);
9698b590b9aeSJohannes Berg #endif
9699b590b9aeSJohannes Berg 
9700704232c2SJohannes Berg #endif /* __NET_CFG80211_H */
9701